diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index e15b1069f..37d8f174b 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -1,6 +1,6 @@ { "name": "@relative-ci/agent-action", - "version": "2.1.1", + "version": "2.1.2", "lockfileVersion": 2, "requires": true, "packages": { @@ -57,30 +57,30 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.19.3.tgz", - "integrity": "sha512-prBHMK4JYYK+wDjJF1q99KK4JLL+egWS4nmNqdlMUgCExMZ+iZW0hGhyC3VEbsPjvaN0TBhW//VIFwBrk8sEiw==", + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.20.1.tgz", + "integrity": "sha512-EWZ4mE2diW3QALKvDMiXnbZpRvlj+nayZ112nK93SnhqOtpdsbVD4W+2tEoT3YNBAG9RBR0ISY758ZkOgsn6pQ==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.19.3.tgz", - "integrity": "sha512-WneDJxdsjEvyKtXKsaBGbDeiyOjR5vYq4HcShxnIbG0qixpoHjI3MqeZM9NDvsojNCEBItQE4juOo/bU6e72gQ==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.20.5.tgz", + "integrity": "sha512-UdOWmk4pNWTm/4DlPUl/Pt4Gz4rcEMb7CY0Y3eJl5Yz1vI8ZJGmHWaVE55LoxRjdpx0z259GE9U5STA9atUinQ==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.3", - "@babel/helper-compilation-targets": "^7.19.3", - "@babel/helper-module-transforms": "^7.19.0", - "@babel/helpers": "^7.19.0", - "@babel/parser": "^7.19.3", + "@babel/generator": "^7.20.5", + "@babel/helper-compilation-targets": "^7.20.0", + "@babel/helper-module-transforms": "^7.20.2", + "@babel/helpers": "^7.20.5", + "@babel/parser": "^7.20.5", "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.3", - "@babel/types": "^7.19.3", + "@babel/traverse": "^7.20.5", + "@babel/types": "^7.20.5", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -153,12 +153,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.3.tgz", - "integrity": "sha512-fqVZnmp1ncvZU757UzDheKZpfPgatqY59XtW2/j/18H7u76akb8xqvjw82f+i2UKd/ksYsSick/BCLQUUtJ/qQ==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.20.5.tgz", + "integrity": "sha512-jl7JY2Ykn9S0yj4DQP82sYvPU+T3g0HFcWTqDLqiuA9tGRNIj9VfbtXGAYTTkyNEnQk1jkMGOdYka8aG/lulCA==", "dev": true, "dependencies": { - "@babel/types": "^7.19.3", + "@babel/types": "^7.20.5", "@jridgewell/gen-mapping": "^0.3.2", "jsesc": "^2.5.1" }, @@ -206,12 +206,12 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.3.tgz", - "integrity": "sha512-65ESqLGyGmLvgR0mst5AdW1FkNlj9rQsCKduzEoEPhBCDFGXvz2jW6bXFG6i0/MrV2s7hhXjjb2yAzcPuQlLwg==", + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.0.tgz", + "integrity": "sha512-0jp//vDGp9e8hZzBc6N/KwA5ZK3Wsm/pfm4CrY7vzegkVxc65SgSn6wYOnwHe9Js9HRQ1YTCKLGPzDtaS3RoLQ==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.19.3", + "@babel/compat-data": "^7.20.0", "@babel/helper-validator-option": "^7.18.6", "browserslist": "^4.21.3", "semver": "^6.3.0" @@ -366,19 +366,19 @@ } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.19.0.tgz", - "integrity": "sha512-3HBZ377Fe14RbLIA+ac3sY4PTgpxHVkFrESaWhoI5PuyXPBBX8+C34qblV9G89ZtycGJCmCI/Ut+VUDK4bltNQ==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.20.2.tgz", + "integrity": "sha512-zvBKyJXRbmK07XhMuujYoJ48B5yvvmM6+wcpv6Ivj4Yg6qO7NOZOSnvZN9CRl1zz1Z4cKf8YejmCMh8clOoOeA==", "dev": true, "dependencies": { "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", + "@babel/helper-simple-access": "^7.20.2", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/helper-validator-identifier": "^7.18.6", + "@babel/helper-validator-identifier": "^7.19.1", "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.0", - "@babel/types": "^7.19.0" + "@babel/traverse": "^7.20.1", + "@babel/types": "^7.20.2" }, "engines": { "node": ">=6.9.0" @@ -397,9 +397,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.19.0.tgz", - "integrity": "sha512-40Ryx7I8mT+0gaNxm8JGTZFUITNqdLAgdg0hXzeVZxVD6nFsdhQvip6v8dqkRHzsz1VFpFAaOCHNn0vKBL7Czw==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz", + "integrity": "sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==", "dev": true, "engines": { "node": ">=6.9.0" @@ -424,28 +424,28 @@ } }, "node_modules/@babel/helper-replace-supers": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.18.9.tgz", - "integrity": "sha512-dNsWibVI4lNT6HiuOIBr1oyxo40HvIVmbwPUm3XZ7wMh4k2WxrxTqZwSqw/eEmXDS9np0ey5M2bz9tBmO9c+YQ==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.19.1.tgz", + "integrity": "sha512-T7ahH7wV0Hfs46SFh5Jz3s0B6+o8g3c+7TMxu7xKfmHikg7EAZ3I2Qk9LFhjxXq8sL7UkP5JflezNwoZa8WvWw==", "dev": true, "dependencies": { "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-member-expression-to-functions": "^7.18.9", "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/traverse": "^7.18.9", - "@babel/types": "^7.18.9" + "@babel/traverse": "^7.19.1", + "@babel/types": "^7.19.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-simple-access": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.18.6.tgz", - "integrity": "sha512-iNpIgTgyAvDQpDj76POqg+YEt8fPxx3yaNBg3S30dxNKm2SWfYhD0TGrK/Eu9wHpUW63VQU894TsTg+GLbUa1g==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz", + "integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==", "dev": true, "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.20.2" }, "engines": { "node": ">=6.9.0" @@ -476,9 +476,9 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz", - "integrity": "sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw==", + "version": "7.19.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", + "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", "dev": true, "engines": { "node": ">=6.9.0" @@ -517,14 +517,14 @@ } }, "node_modules/@babel/helpers": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.19.0.tgz", - "integrity": "sha512-DRBCKGwIEdqY3+rPJgG/dKfQy9+08rHIAJx8q2p+HSWP87s2HCrQmaAMMyMll2kIXKCW0cO1RdQskx15Xakftg==", + "version": "7.20.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.20.6.tgz", + "integrity": "sha512-Pf/OjgfgFRW5bApskEz5pvidpim7tEDPlFtKcNRXWmfHGn9IEI2W2flqRQXTFb7gIPTyK++N6rVHuwKut4XK6w==", "dev": true, "dependencies": { "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.0", - "@babel/types": "^7.19.0" + "@babel/traverse": "^7.20.5", + "@babel/types": "^7.20.5" }, "engines": { "node": ">=6.9.0" @@ -544,9 +544,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.3.tgz", - "integrity": "sha512-pJ9xOlNWHiy9+FuFP09DEAFbAn4JskgRsVcc169w2xRBC3FRGuQEwjeIMMND9L2zc0iEhO/tGv4Zq+km+hxNpQ==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.5.tgz", + "integrity": "sha512-r27t/cy/m9uKLXQNWWebeCUHgnAZq0CpG1OwKRxzJMP1vpSU4bSIK2hq+/cp0bQxetkXx38n09rNu8jVkcK/zA==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -588,9 +588,9 @@ } }, "node_modules/@babel/plugin-proposal-async-generator-functions": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.19.1.tgz", - "integrity": "sha512-0yu8vNATgLy4ivqMNBIwb1HebCelqN7YX8SL3FDXORv/RqT0zEEWUCH4GH44JsSrvCu6GqnAdR5EBFAPeNBB4Q==", + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.20.1.tgz", + "integrity": "sha512-Gh5rchzSwE4kC+o/6T8waD0WHEQIsDmjltY8WnWRXHUdH8axZhuH86Ov9M72YhJfDrZseQwuuWaaIT/TmePp3g==", "dev": true, "dependencies": { "@babel/helper-environment-visitor": "^7.18.9", @@ -735,16 +735,16 @@ } }, "node_modules/@babel/plugin-proposal-object-rest-spread": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.18.9.tgz", - "integrity": "sha512-kDDHQ5rflIeY5xl69CEqGEZ0KY369ehsCIEbTGb4siHG5BE9sga/T0r0OUwyZNLMmZE79E1kbsqAjwFCW4ds6Q==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.2.tgz", + "integrity": "sha512-Ks6uej9WFK+fvIMesSqbAto5dD8Dz4VuuFvGJFKgIGSkJuRGcrwGECPA1fDgQK3/DbExBJpEkTeYeB8geIFCSQ==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.18.8", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9", + "@babel/compat-data": "^7.20.1", + "@babel/helper-compilation-targets": "^7.20.0", + "@babel/helper-plugin-utils": "^7.20.2", "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.18.8" + "@babel/plugin-transform-parameters": "^7.20.1" }, "engines": { "node": ">=6.9.0" @@ -900,12 +900,12 @@ } }, "node_modules/@babel/plugin-syntax-import-assertions": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.18.6.tgz", - "integrity": "sha512-/DU3RXad9+bZwrgWJQKbr39gYbJpLJHezqEzRzi/BHRlJ9zsQb4CK2CA/5apllXNomwA1qHwzvHl+AdEmC5krQ==", + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.20.0.tgz", + "integrity": "sha512-IUh1vakzNoWalR8ch/areW7qFopR2AEw03JlG7BbrDqmQ4X3q9uuipQwSGrUn7oGiemKjtSLDhNtQHzMHr1JdQ==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.19.0" }, "engines": { "node": ">=6.9.0" @@ -1076,12 +1076,12 @@ } }, "node_modules/@babel/plugin-transform-block-scoping": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.18.9.tgz", - "integrity": "sha512-5sDIJRV1KtQVEbt/EIBwGy4T01uYIo4KRB3VUqzkhrAIOGx7AoctL9+Ux88btY0zXdDyPJ9mW+bg+v+XEkGmtw==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.20.2.tgz", + "integrity": "sha512-y5V15+04ry69OV2wULmwhEA6jwSWXO1TwAtIwiPXcvHcoOQUqpyMVd2bDsQJMW8AurjulIyUV8kDqtjSwHy1uQ==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.20.2" }, "engines": { "node": ">=6.9.0" @@ -1091,18 +1091,18 @@ } }, "node_modules/@babel/plugin-transform-classes": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.19.0.tgz", - "integrity": "sha512-YfeEE9kCjqTS9IitkgfJuxjcEtLUHMqa8yUJ6zdz8vR7hKuo6mOy2C05P0F1tdMmDCeuyidKnlrw/iTppHcr2A==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.20.2.tgz", + "integrity": "sha512-9rbPp0lCVVoagvtEyQKSo5L8oo0nQS/iif+lwlAz29MccX2642vWDlSZK+2T2buxbopotId2ld7zZAzRfz9j1g==", "dev": true, "dependencies": { "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-compilation-targets": "^7.19.0", + "@babel/helper-compilation-targets": "^7.20.0", "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-function-name": "^7.19.0", "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-replace-supers": "^7.18.9", + "@babel/helper-plugin-utils": "^7.20.2", + "@babel/helper-replace-supers": "^7.19.1", "@babel/helper-split-export-declaration": "^7.18.6", "globals": "^11.1.0" }, @@ -1129,12 +1129,12 @@ } }, "node_modules/@babel/plugin-transform-destructuring": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.18.13.tgz", - "integrity": "sha512-TodpQ29XekIsex2A+YJPj5ax2plkGa8YYY6mFjCohk/IG9IY42Rtuj1FuDeemfg2ipxIFLzPeA83SIBnlhSIow==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.20.2.tgz", + "integrity": "sha512-mENM+ZHrvEgxLTBXUiQ621rRXZes3KWUv6NdQlrnr1TkWVw+hUjQBZuP2X32qKlrlG2BzgR95gkuCRSkJl8vIw==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.20.2" }, "engines": { "node": ">=6.9.0" @@ -1253,14 +1253,13 @@ } }, "node_modules/@babel/plugin-transform-modules-amd": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.18.6.tgz", - "integrity": "sha512-Pra5aXsmTsOnjM3IajS8rTaLCy++nGM4v3YR4esk5PCsyg9z8NA5oQLwxzMUtDBd8F+UmVza3VxoAaWCbzH1rg==", + "version": "7.19.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.19.6.tgz", + "integrity": "sha512-uG3od2mXvAtIFQIh0xrpLH6r5fpSQN04gIVovl+ODLdUMANokxQLZnPBHcjmv3GxRjnqwLuHvppjjcelqUFZvg==", "dev": true, "dependencies": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-module-transforms": "^7.19.6", + "@babel/helper-plugin-utils": "^7.19.0" }, "engines": { "node": ">=6.9.0" @@ -1270,15 +1269,14 @@ } }, "node_modules/@babel/plugin-transform-modules-commonjs": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.18.6.tgz", - "integrity": "sha512-Qfv2ZOWikpvmedXQJDSbxNqy7Xr/j2Y8/KfijM0iJyKkBTmWuvCA1yeH1yDM7NJhBW/2aXxeucLj6i80/LAJ/Q==", + "version": "7.19.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.19.6.tgz", + "integrity": "sha512-8PIa1ym4XRTKuSsOUXqDG0YaOlEuTVvHMe5JCfgBMOtHvJKw/4NGovEGN33viISshG/rZNVrACiBmPQLvWN8xQ==", "dev": true, "dependencies": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-module-transforms": "^7.19.6", + "@babel/helper-plugin-utils": "^7.19.0", + "@babel/helper-simple-access": "^7.19.4" }, "engines": { "node": ">=6.9.0" @@ -1288,16 +1286,15 @@ } }, "node_modules/@babel/plugin-transform-modules-systemjs": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.19.0.tgz", - "integrity": "sha512-x9aiR0WXAWmOWsqcsnrzGR+ieaTMVyGyffPVA7F8cXAGt/UxefYv6uSHZLkAFChN5M5Iy1+wjE+xJuPt22H39A==", + "version": "7.19.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.19.6.tgz", + "integrity": "sha512-fqGLBepcc3kErfR9R3DnVpURmckXP7gj7bAlrTQyBxrigFqszZCkFkcoxzCp2v32XmwXLvbw+8Yq9/b+QqksjQ==", "dev": true, "dependencies": { "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-module-transforms": "^7.19.0", + "@babel/helper-module-transforms": "^7.19.6", "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-validator-identifier": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-validator-identifier": "^7.19.1" }, "engines": { "node": ">=6.9.0" @@ -1370,12 +1367,12 @@ } }, "node_modules/@babel/plugin-transform-parameters": { - "version": "7.18.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.18.8.tgz", - "integrity": "sha512-ivfbE3X2Ss+Fj8nnXvKJS6sjRG4gzwPMsP+taZC+ZzEGjAYlvENixmt1sZ5Ca6tWls+BlKSGKPJ6OOXvXCbkFg==", + "version": "7.20.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.20.3.tgz", + "integrity": "sha512-oZg/Fpx0YDrj13KsLyO8I/CX3Zdw7z0O9qOd95SqcoIzuqy/WTGWvePeHAnZCN54SfdyjHcb1S30gc8zlzlHcA==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.20.2" }, "engines": { "node": ">=6.9.0" @@ -1538,18 +1535,18 @@ } }, "node_modules/@babel/preset-env": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.19.3.tgz", - "integrity": "sha512-ziye1OTc9dGFOAXSWKUqQblYHNlBOaDl8wzqf2iKXJAltYiR3hKHUKmkt+S9PppW7RQpq4fFCrwwpIDj/f5P4w==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.20.2.tgz", + "integrity": "sha512-1G0efQEWR1EHkKvKHqbG+IN/QdgwfByUpM5V5QroDzGV2t3S/WXNQd693cHiHTlCFMpr9B6FkPFXDA2lQcKoDg==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.19.3", - "@babel/helper-compilation-targets": "^7.19.3", - "@babel/helper-plugin-utils": "^7.19.0", + "@babel/compat-data": "^7.20.1", + "@babel/helper-compilation-targets": "^7.20.0", + "@babel/helper-plugin-utils": "^7.20.2", "@babel/helper-validator-option": "^7.18.6", "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.18.6", "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.18.9", - "@babel/plugin-proposal-async-generator-functions": "^7.19.1", + "@babel/plugin-proposal-async-generator-functions": "^7.20.1", "@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-proposal-class-static-block": "^7.18.6", "@babel/plugin-proposal-dynamic-import": "^7.18.6", @@ -1558,7 +1555,7 @@ "@babel/plugin-proposal-logical-assignment-operators": "^7.18.9", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", "@babel/plugin-proposal-numeric-separator": "^7.18.6", - "@babel/plugin-proposal-object-rest-spread": "^7.18.9", + "@babel/plugin-proposal-object-rest-spread": "^7.20.2", "@babel/plugin-proposal-optional-catch-binding": "^7.18.6", "@babel/plugin-proposal-optional-chaining": "^7.18.9", "@babel/plugin-proposal-private-methods": "^7.18.6", @@ -1569,7 +1566,7 @@ "@babel/plugin-syntax-class-static-block": "^7.14.5", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-import-assertions": "^7.18.6", + "@babel/plugin-syntax-import-assertions": "^7.20.0", "@babel/plugin-syntax-json-strings": "^7.8.3", "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", @@ -1582,10 +1579,10 @@ "@babel/plugin-transform-arrow-functions": "^7.18.6", "@babel/plugin-transform-async-to-generator": "^7.18.6", "@babel/plugin-transform-block-scoped-functions": "^7.18.6", - "@babel/plugin-transform-block-scoping": "^7.18.9", - "@babel/plugin-transform-classes": "^7.19.0", + "@babel/plugin-transform-block-scoping": "^7.20.2", + "@babel/plugin-transform-classes": "^7.20.2", "@babel/plugin-transform-computed-properties": "^7.18.9", - "@babel/plugin-transform-destructuring": "^7.18.13", + "@babel/plugin-transform-destructuring": "^7.20.2", "@babel/plugin-transform-dotall-regex": "^7.18.6", "@babel/plugin-transform-duplicate-keys": "^7.18.9", "@babel/plugin-transform-exponentiation-operator": "^7.18.6", @@ -1593,14 +1590,14 @@ "@babel/plugin-transform-function-name": "^7.18.9", "@babel/plugin-transform-literals": "^7.18.9", "@babel/plugin-transform-member-expression-literals": "^7.18.6", - "@babel/plugin-transform-modules-amd": "^7.18.6", - "@babel/plugin-transform-modules-commonjs": "^7.18.6", - "@babel/plugin-transform-modules-systemjs": "^7.19.0", + "@babel/plugin-transform-modules-amd": "^7.19.6", + "@babel/plugin-transform-modules-commonjs": "^7.19.6", + "@babel/plugin-transform-modules-systemjs": "^7.19.6", "@babel/plugin-transform-modules-umd": "^7.18.6", "@babel/plugin-transform-named-capturing-groups-regex": "^7.19.1", "@babel/plugin-transform-new-target": "^7.18.6", "@babel/plugin-transform-object-super": "^7.18.6", - "@babel/plugin-transform-parameters": "^7.18.8", + "@babel/plugin-transform-parameters": "^7.20.1", "@babel/plugin-transform-property-literals": "^7.18.6", "@babel/plugin-transform-regenerator": "^7.18.6", "@babel/plugin-transform-reserved-words": "^7.18.6", @@ -1612,7 +1609,7 @@ "@babel/plugin-transform-unicode-escapes": "^7.18.10", "@babel/plugin-transform-unicode-regex": "^7.18.6", "@babel/preset-modules": "^0.1.5", - "@babel/types": "^7.19.3", + "@babel/types": "^7.20.2", "babel-plugin-polyfill-corejs2": "^0.3.3", "babel-plugin-polyfill-corejs3": "^0.6.0", "babel-plugin-polyfill-regenerator": "^0.4.1", @@ -1678,19 +1675,19 @@ } }, "node_modules/@babel/traverse": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.3.tgz", - "integrity": "sha512-qh5yf6149zhq2sgIXmwjnsvmnNQC2iw70UFjp4olxucKrWd/dvlUsBI88VSLUsnMNF7/vnOiA+nk1+yLoCqROQ==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.20.5.tgz", + "integrity": "sha512-WM5ZNN3JITQIq9tFZaw1ojLU3WgWdtkxnhM1AegMS+PvHjkM5IXjmYEGY7yukz5XS4sJyEf2VzWjI8uAavhxBQ==", "dev": true, "dependencies": { "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.3", + "@babel/generator": "^7.20.5", "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-function-name": "^7.19.0", "@babel/helper-hoist-variables": "^7.18.6", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.19.3", - "@babel/types": "^7.19.3", + "@babel/parser": "^7.20.5", + "@babel/types": "^7.20.5", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -1699,12 +1696,12 @@ } }, "node_modules/@babel/types": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.19.3.tgz", - "integrity": "sha512-hGCaQzIY22DJlDh9CH7NOxgKkFjBk0Cw9xDO1Xmh2151ti7wiGfQ3LauXzL4HP1fmFlTX6XjpRETTpUcv7wQLw==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.20.5.tgz", + "integrity": "sha512-c9fst/h2/dcF7H+MJKZ2T0KjEQ8hY/BNnDk/H3XY8C4Aw/eWQXWn/lWntHF9ooUBnGmEvbfGrTgLWc+um0YDUg==", "dev": true, "dependencies": { - "@babel/helper-string-parser": "^7.18.10", + "@babel/helper-string-parser": "^7.19.4", "@babel/helper-validator-identifier": "^7.19.1", "to-fast-properties": "^2.0.0" }, @@ -1713,9 +1710,9 @@ } }, "node_modules/@bundle-stats/plugin-webpack-filter": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@bundle-stats/plugin-webpack-filter/-/plugin-webpack-filter-4.1.0.tgz", - "integrity": "sha512-EL+PqTNp3O0gOI03jwz1VEIuz0CpR+K2WO3jpKatFeudMITOzSccwIZdvb07kULsiLLMisRH2ElQe0AX4q5Jcw==", + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/@bundle-stats/plugin-webpack-filter/-/plugin-webpack-filter-4.1.5.tgz", + "integrity": "sha512-XWwRJD5K8wKoiLZg0nxd54IbLPgt8e/A9R2PY6tyDBMNPDa21uobkFk+yyvVIo2h2ovN7/lldqxV7QKF3avlTg==", "engines": { "node": ">= 14.0" }, @@ -1724,12 +1721,12 @@ } }, "node_modules/@bundle-stats/plugin-webpack-validate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@bundle-stats/plugin-webpack-validate/-/plugin-webpack-validate-4.1.0.tgz", - "integrity": "sha512-sZmPC3KkOVTdMxheSqtJ3+wFcXcylthMA3lTWhIw10HGKQyNU7bSFatrac48zhkQLTF0TLdrqJp3ZTuAraixMQ==", + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/@bundle-stats/plugin-webpack-validate/-/plugin-webpack-validate-4.1.5.tgz", + "integrity": "sha512-JwNrx+gczi3vBIKAjsndvX2hRAbXUeOOix9yPmD+X6fePQ5KtlGqNHTbx3qezJm7372zPUyJpil+JMPg58FMlg==", "dependencies": { "lodash": "4.17.21", - "superstruct": "0.16.5" + "superstruct": "1.0.3" }, "engines": { "node": ">= 14.0" @@ -1745,9 +1742,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.2.tgz", - "integrity": "sha512-AXYd23w1S/bv3fTs3Lz0vjiYemS08jWkI3hYyS9I1ry+0f+Yjs1wm+sU0BS8qDOPrBIkp4qHYC16I8uVtpLajQ==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", + "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -1783,9 +1780,9 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.5.tgz", - "integrity": "sha512-XVVDtp+dVvRxMoxSiSfasYaG02VEe1qH5cKgMQJWhol6HwzbcqoCMJi8dAGoYAO57jhUyhI6cWuRiTcRaDaYug==", + "version": "0.11.6", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.6.tgz", + "integrity": "sha512-jJr+hPTJYKyDILJfhNSHsjiwXYf26Flsz8DvNndOsHs5pwSnpGUEy8yzF0JYhCEvTDdV2vuOK5tt8BVhwO5/hg==", "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^1.2.1", @@ -1796,16 +1793,6 @@ "node": ">=10.10.0" } }, - "node_modules/@humanwhocodes/gitignore-to-minimatch": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/gitignore-to-minimatch/-/gitignore-to-minimatch-1.0.2.tgz", - "integrity": "sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -2053,21 +2040,21 @@ "deprecated": "Use @octokit/webhooks-types, @octokit/webhooks-schemas, or @octokit/webhooks-examples instead. See https://github.com/octokit/webhooks/issues/447" }, "node_modules/@relative-ci/agent": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/@relative-ci/agent/-/agent-4.1.1.tgz", - "integrity": "sha512-J+ec6c5xQQW3S/ZF9EaN1Eit48s3xJbr9WjcHLO9lXpt3XAY7Wunptv0j2he9rRrO+hhSsGNQyjh9dlSrIYSQg==", - "dependencies": { - "@bundle-stats/plugin-webpack-filter": "4.1.0", - "@bundle-stats/plugin-webpack-validate": "4.1.0", - "core-js": "3.25.5", - "cosmiconfig": "7.0.1", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@relative-ci/agent/-/agent-4.1.2.tgz", + "integrity": "sha512-kJ5PiZDW9tpJGXjBbPvtTxeXfeDWh5PJv/c5fI5fSvLVLtr/sq6smanY0DcyWYv1Ha+3e0IqkOKcLnZFEHn9Ow==", + "dependencies": { + "@bundle-stats/plugin-webpack-filter": "4.1.5", + "@bundle-stats/plugin-webpack-validate": "4.1.5", + "core-js": "3.26.1", + "cosmiconfig": "8.0.0", "debug": "4.3.4", "dotenv": "16.0.3", "env-ci": "7.3.0", - "fs-extra": "10.1.0", + "fs-extra": "11.1.0", "isomorphic-fetch": "3.0.0", "lodash": "4.17.21", - "yargs": "17.6.0" + "yargs": "17.6.2" }, "bin": { "relative-ci-agent": "bin/index.js" @@ -2128,11 +2115,6 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.14.tgz", "integrity": "sha512-SbjLmERksKOGzWzPNuW7fJM7fk3YXVTFiZWB/Hs99gwhk+/dnrQRPBQjPW9aO+fi1tAffi9PrwFvsmOKmDTyng==" }, - "node_modules/@types/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==" - }, "node_modules/@webassemblyjs/helper-numbers": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz", @@ -2154,34 +2136,42 @@ "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==" }, "node_modules/@webpack-cli/configtest": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz", - "integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.0.0.tgz", + "integrity": "sha512-war4OU8NGjBqU3DP3bx6ciODXIh7dSXcpQq+P4K2Tqyd8L5OjZ7COx9QXx/QdCIwL2qoX09Wr4Cwf7uS4qdEng==", "dev": true, + "engines": { + "node": ">=14.15.0" + }, "peerDependencies": { - "webpack": "4.x.x || 5.x.x", - "webpack-cli": "4.x.x" + "webpack": "5.x.x", + "webpack-cli": "5.x.x" } }, "node_modules/@webpack-cli/info": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz", - "integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-2.0.0.tgz", + "integrity": "sha512-NNxDgbo4VOkNhOlTgY0Elhz3vKpOJq4/PKeKg7r8cmYM+GQA9vDofLYyup8jS6EpUvhNmR30cHTCEIyvXpskwA==", "dev": true, - "dependencies": { - "envinfo": "^7.7.3" + "engines": { + "node": ">=14.15.0" }, "peerDependencies": { - "webpack-cli": "4.x.x" + "webpack": "5.x.x", + "webpack-cli": "5.x.x" } }, "node_modules/@webpack-cli/serve": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz", - "integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-2.0.0.tgz", + "integrity": "sha512-Rumq5mHvGXamnOh3O8yLk1sjx8dB30qF1OeR6VC00DIR6SLJ4bwwUGKC4pE7qBFoQyyh0H9sAg3fikYgAqVR0w==", "dev": true, + "engines": { + "node": ">=14.15.0" + }, "peerDependencies": { - "webpack-cli": "4.x.x" + "webpack": "5.x.x", + "webpack-cli": "5.x.x" }, "peerDependenciesMeta": { "webpack-dev-server": { @@ -2242,6 +2232,45 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-formats/node_modules/ajv": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, "node_modules/ajv-keywords": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", @@ -2272,8 +2301,7 @@ "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, "node_modules/array-includes": { "version": "3.1.4", @@ -2295,15 +2323,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/array.prototype.flat": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz", @@ -2323,22 +2342,20 @@ } }, "node_modules/babel-loader": { - "version": "8.2.5", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.2.5.tgz", - "integrity": "sha512-OSiFfH89LrEMiWd4pLNqGz4CwJDtbs2ZVc+iGu2HrkRfPxId9F2anQj38IxWpmRfsUY0aBZYi1EFcd3mhtRMLQ==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.1.0.tgz", + "integrity": "sha512-Antt61KJPinUMwHwIIz9T5zfMgevnfZkEVWYDWlG888fgdvRRGD0JTuf/fFozQnfT+uq64sk1bmdHDy/mOEWnA==", "dev": true, "dependencies": { - "find-cache-dir": "^3.3.1", - "loader-utils": "^2.0.0", - "make-dir": "^3.1.0", - "schema-utils": "^2.6.5" + "find-cache-dir": "^3.3.2", + "schema-utils": "^4.0.0" }, "engines": { - "node": ">= 8.9" + "node": ">= 14.15.0" }, "peerDependencies": { - "@babel/core": "^7.0.0", - "webpack": ">=2" + "@babel/core": "^7.12.0", + "webpack": ">=5" } }, "node_modules/babel-loader/node_modules/find-cache-dir": { @@ -2373,24 +2390,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/babel-loader/node_modules/schema-utils": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz", - "integrity": "sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==", - "dev": true, - "dependencies": { - "@types/json-schema": "^7.0.5", - "ajv": "^6.12.4", - "ajv-keywords": "^3.5.2" - }, - "engines": { - "node": ">= 8.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, "node_modules/babel-loader/node_modules/semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", @@ -2400,15 +2399,6 @@ "semver": "bin/semver.js" } }, - "node_modules/babel-plugin-dynamic-import-node": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", - "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", - "dev": true, - "dependencies": { - "object.assign": "^4.1.0" - } - }, "node_modules/babel-plugin-polyfill-corejs2": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.3.tgz", @@ -2468,15 +2458,6 @@ "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz", "integrity": "sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ==" }, - "node_modules/big.js": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", - "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -2635,12 +2616,12 @@ "dev": true }, "node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.4.1.tgz", + "integrity": "sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==", "dev": true, "engines": { - "node": ">= 10" + "node": "^12.20.0 || >=14" } }, "node_modules/commondir": { @@ -2677,9 +2658,9 @@ "dev": true }, "node_modules/core-js": { - "version": "3.25.5", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.25.5.tgz", - "integrity": "sha512-nbm6eZSjm+ZuBQxCUPQKQCoUEfFOXjUZ8dTTyikyKaWrTYmAVbykQfwsKE5dBK88u3QCkCrzsx/PPlKfhsvgpw==", + "version": "3.26.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.26.1.tgz", + "integrity": "sha512-21491RRQVzUn0GGM9Z1Jrpr6PNPxPi+Za8OM9q4tksTSnlbXXGKK1nXNg/QvwFYettXvSX6zWKCtHHfjN4puyA==", "hasInstallScript": true, "funding": { "type": "opencollective", @@ -2700,18 +2681,17 @@ } }, "node_modules/cosmiconfig": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", - "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.0.0.tgz", + "integrity": "sha512-da1EafcpH6b/TD8vDRaWV7xFINlHlF6zKsGwS1TsuVJTZRkquaS5HTMq7uq6h31619QjbsYl21gVDOm32KM1vQ==", "dependencies": { - "@types/parse-json": "^4.0.0", "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.10.0" + "path-type": "^4.0.0" }, "engines": { - "node": ">=10" + "node": ">=14" } }, "node_modules/cross-spawn": { @@ -2766,18 +2746,6 @@ "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -2808,15 +2776,6 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, - "node_modules/emojis-list": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", - "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, "node_modules/encoding": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", @@ -2944,15 +2903,15 @@ } }, "node_modules/eslint": { - "version": "8.24.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.24.0.tgz", - "integrity": "sha512-dWFaPhGhTAiPcCgm3f6LI2MBWbogMnTJzFBbhXVRQDJPkr9pGZvVjlVfXd+vyDcWPA2Ic9L2AXPIQM0+vk/cSQ==", + "version": "8.29.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.29.0.tgz", + "integrity": "sha512-isQ4EEiyUjZFbEKvEGJKKGBwXtvXX+zJbkVKCgTuB9t/+jUBcy8avhkEwWJecI15BkRkOYmvIM5ynbhRjEkoeg==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.3.2", - "@humanwhocodes/config-array": "^0.10.5", - "@humanwhocodes/gitignore-to-minimatch": "^1.0.2", + "@eslint/eslintrc": "^1.3.3", + "@humanwhocodes/config-array": "^0.11.6", "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -2968,14 +2927,14 @@ "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", - "glob-parent": "^6.0.1", + "glob-parent": "^6.0.2", "globals": "^13.15.0", - "globby": "^11.1.0", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", @@ -3540,22 +3499,6 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, - "node_modules/fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "engines": { - "node": ">=8.6.0" - } - }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -3673,16 +3616,16 @@ ] }, "node_modules/fs-extra": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.0.tgz", + "integrity": "sha512-0rcTq621PD5jM/e0a3EJoGC/1TC5ZBCERW82LQuwfGnCa1V8w7dpYH1yNu+SLb6E5dkeCBzKEyLGlFrnr+dUyw==", "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" }, "engines": { - "node": ">=12" + "node": ">=14.14" } }, "node_modules/fs.realpath": { @@ -3775,18 +3718,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/glob-to-regexp": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", @@ -3801,26 +3732,6 @@ "node": ">=4" } }, - "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/graceful-fs": { "version": "4.2.9", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", @@ -3991,18 +3902,18 @@ } }, "node_modules/interpret": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", - "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", + "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", "dev": true, "engines": { - "node": ">= 0.10" + "node": ">=10.13.0" } }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" }, "node_modules/is-bigint": { "version": "1.0.4", @@ -4136,6 +4047,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -4307,7 +4227,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, "dependencies": { "argparse": "^2.0.1" }, @@ -4394,32 +4313,6 @@ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, - "node_modules/loader-utils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz", - "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==", - "dev": true, - "dependencies": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - }, - "engines": { - "node": ">=8.9.0" - } - }, - "node_modules/loader-utils/node_modules/json5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", - "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", - "dev": true, - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -4466,15 +4359,6 @@ "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, "node_modules/micromatch": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", @@ -4871,15 +4755,15 @@ } }, "node_modules/rechoir": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", - "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", "dev": true, "dependencies": { - "resolve": "^1.9.0" + "resolve": "^1.20.0" }, "engines": { - "node": ">= 0.10" + "node": ">= 10.13.0" } }, "node_modules/regenerate": { @@ -4979,6 +4863,15 @@ "node": ">=0.10.0" } }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/resolve": { "version": "1.22.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", @@ -5083,6 +4976,59 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "devOptional": true }, + "node_modules/schema-utils": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", + "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.8.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.0.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/schema-utils/node_modules/ajv": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/schema-utils/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/schema-utils/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, "node_modules/semver": { "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", @@ -5156,15 +5102,6 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -5263,9 +5200,9 @@ } }, "node_modules/superstruct": { - "version": "0.16.5", - "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.16.5.tgz", - "integrity": "sha512-GBa1VPdCUDAIrsoMVy2lzE/hKQnieUlc1JVoVzJ2YLx47SoPY4AqF85Ht1bPg5r+8I0v54GbaRdNTnYQ0p+T+Q==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.3.tgz", + "integrity": "sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg==", "engines": { "node": ">=14.0.0" } @@ -5421,9 +5358,9 @@ "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" }, "node_modules/ts-loader": { - "version": "9.4.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.1.tgz", - "integrity": "sha512-384TYAqGs70rn9F0VBnh6BPTfhga7yFNdC5gXbQpDrBj9/KsT4iRkGqKXhziofHOlE2j6YEaiTYVGKKvPhGWvw==", + "version": "9.4.2", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.2.tgz", + "integrity": "sha512-OmlC4WVmFv5I0PpaxYb+qGeGOdm5giHU7HwDDUjw59emP2UYMHy9fFSDcYgSNoH8sXcj4hGCSEhlDZ9ULeDraA==", "dev": true, "dependencies": { "chalk": "^4.1.0", @@ -5555,9 +5492,9 @@ } }, "node_modules/typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz", + "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -5694,9 +5631,9 @@ "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" }, "node_modules/webpack": { - "version": "5.74.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.74.0.tgz", - "integrity": "sha512-A2InDwnhhGN4LYctJj6M1JEaGL7Luj6LOmyBHjcI8529cm5p6VXiTIW2sn6ffvEAKmveLzvu4jrihwXtPojlAA==", + "version": "5.75.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.75.0.tgz", + "integrity": "sha512-piaIaoVJlqMsPtX/+3KTTO6jfvrSYgauFVdt8cr9LTHKmcq/AMd4mhzsiP7ZF/PGRNPGA8336jldh9l2Kt2ogQ==", "dependencies": { "@types/eslint-scope": "^3.7.3", "@types/estree": "^0.0.51", @@ -5740,44 +5677,42 @@ } }, "node_modules/webpack-cli": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz", - "integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.0.0.tgz", + "integrity": "sha512-AACDTo20yG+xn6HPW5xjbn2Be4KUzQPebWXsDMHwPPyKh9OnTOJgZN2Nc+g/FZKV3ObRTYsGvibAvc+5jAUrVA==", "dev": true, "dependencies": { "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^1.2.0", - "@webpack-cli/info": "^1.5.0", - "@webpack-cli/serve": "^1.7.0", + "@webpack-cli/configtest": "^2.0.0", + "@webpack-cli/info": "^2.0.0", + "@webpack-cli/serve": "^2.0.0", "colorette": "^2.0.14", - "commander": "^7.0.0", + "commander": "^9.4.1", "cross-spawn": "^7.0.3", + "envinfo": "^7.7.3", "fastest-levenshtein": "^1.0.12", "import-local": "^3.0.2", - "interpret": "^2.2.0", - "rechoir": "^0.7.0", + "interpret": "^3.1.1", + "rechoir": "^0.8.0", "webpack-merge": "^5.7.3" }, "bin": { "webpack-cli": "bin/cli.js" }, "engines": { - "node": ">=10.13.0" + "node": ">=14.15.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" }, "peerDependencies": { - "webpack": "4.x.x || 5.x.x" + "webpack": "5.x.x" }, "peerDependenciesMeta": { "@webpack-cli/generators": { "optional": true }, - "@webpack-cli/migrate": { - "optional": true - }, "webpack-bundle-analyzer": { "optional": true }, @@ -6092,18 +6027,10 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, - "node_modules/yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", - "engines": { - "node": ">= 6" - } - }, "node_modules/yargs": { - "version": "17.6.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.0.tgz", - "integrity": "sha512-8H/wTDqlSwoSnScvV2N/JHfLWOKuh5MVla9hqLjK3nsfyy6Y4kDSYSvkU5YCUEPOSnRXfIyx3Sq+B/IWudTo4g==", + "version": "17.6.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", + "integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==", "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", @@ -6111,7 +6038,7 @@ "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^21.0.0" + "yargs-parser": "^21.1.1" }, "engines": { "node": ">=12" diff --git a/node_modules/@babel/compat-data/data/corejs2-built-ins.json b/node_modules/@babel/compat-data/data/corejs2-built-ins.json index b9e4cfe37..bf3be88e4 100644 --- a/node_modules/@babel/compat-data/data/corejs2-built-ins.json +++ b/node_modules/@babel/compat-data/data/corejs2-built-ins.json @@ -6,6 +6,7 @@ "firefox": "32", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "5", "rhino": "1.7.13", @@ -18,6 +19,7 @@ "firefox": "2", "safari": "3.1", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "6", @@ -33,6 +35,7 @@ "firefox": "31", "safari": "7.1", "node": "4", + "deno": "1", "ios": "8", "samsung": "5", "rhino": "1.7.13", @@ -45,6 +48,7 @@ "firefox": "48", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -56,6 +60,7 @@ "firefox": "25", "safari": "7.1", "node": "4", + "deno": "1", "ios": "8", "samsung": "5", "rhino": "1.7.13", @@ -68,6 +73,7 @@ "firefox": "25", "safari": "7.1", "node": "4", + "deno": "1", "ios": "8", "samsung": "5", "rhino": "1.7.13", @@ -80,6 +86,7 @@ "firefox": "62", "safari": "12", "node": "11", + "deno": "1", "ios": "12", "samsung": "10", "electron": "4.0" @@ -91,6 +98,7 @@ "firefox": "2", "safari": "3.1", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "6", @@ -106,6 +114,7 @@ "firefox": "36", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -117,6 +126,7 @@ "firefox": "102", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.36" @@ -128,6 +138,7 @@ "firefox": "2", "safari": "3.1", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "6", @@ -143,6 +154,7 @@ "firefox": "4", "safari": "4", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "6", @@ -158,6 +170,7 @@ "firefox": "60", "safari": "9", "node": "10", + "deno": "1", "ios": "9", "samsung": "9", "rhino": "1.7.13", @@ -170,6 +183,7 @@ "firefox": "2", "safari": "3.1", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "6", @@ -185,6 +199,7 @@ "firefox": "48", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -196,6 +211,7 @@ "firefox": "25", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "5", "rhino": "1.7.13", @@ -208,6 +224,7 @@ "firefox": "3", "safari": "4", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "6", @@ -223,6 +240,7 @@ "firefox": "3", "safari": "4", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "6", @@ -238,6 +256,7 @@ "firefox": "48", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -249,6 +268,7 @@ "firefox": "2", "safari": "3.1", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "6", @@ -264,6 +284,7 @@ "firefox": "5", "safari": "12", "node": "10", + "deno": "1", "ie": "9", "ios": "12", "samsung": "8", @@ -277,6 +298,7 @@ "firefox": "48", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -288,6 +310,7 @@ "firefox": "2", "safari": "4", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "6", @@ -303,6 +326,7 @@ "firefox": "3.5", "safari": "4", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "6", @@ -318,6 +342,7 @@ "firefox": "4", "safari": "10", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "10", @@ -332,6 +357,7 @@ "firefox": "44", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.36" @@ -343,6 +369,7 @@ "firefox": "2", "safari": "3.1", "node": "0.4", + "deno": "1", "ie": "10", "android": "4", "ios": "6", @@ -358,6 +385,7 @@ "firefox": "4", "safari": "5.1", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "6", @@ -373,6 +401,7 @@ "firefox": "50", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -384,6 +413,7 @@ "firefox": "2", "safari": "4", "node": "0.4", + "deno": "1", "android": "4", "ios": "6", "phantom": "1.9", @@ -398,6 +428,7 @@ "firefox": "53", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -409,6 +440,7 @@ "firefox": "25", "safari": "7.1", "node": "0.12", + "deno": "1", "ios": "8", "samsung": "3", "rhino": "1.7.13", @@ -421,6 +453,7 @@ "firefox": "25", "safari": "7.1", "node": "0.12", + "deno": "1", "ios": "8", "samsung": "3", "rhino": "1.7.13", @@ -433,6 +466,7 @@ "firefox": "25", "safari": "7.1", "node": "0.12", + "deno": "1", "ios": "8", "samsung": "3", "rhino": "1.7.13", @@ -445,6 +479,7 @@ "firefox": "25", "safari": "7.1", "node": "0.12", + "deno": "1", "ios": "8", "samsung": "3", "rhino": "1.7.13", @@ -457,6 +492,7 @@ "firefox": "31", "safari": "9", "node": "0.12", + "deno": "1", "ios": "9", "samsung": "3", "rhino": "1.7.13", @@ -469,6 +505,7 @@ "firefox": "25", "safari": "7.1", "node": "0.12", + "deno": "1", "ios": "8", "samsung": "3", "rhino": "1.7.13", @@ -481,6 +518,7 @@ "firefox": "25", "safari": "7.1", "node": "0.12", + "deno": "1", "ios": "8", "samsung": "3", "rhino": "1.7.13", @@ -493,6 +531,7 @@ "firefox": "26", "safari": "7.1", "node": "0.12", + "deno": "1", "ios": "8", "samsung": "3", "rhino": "1.7.13", @@ -505,6 +544,7 @@ "firefox": "27", "safari": "7.1", "node": "0.12", + "deno": "1", "ios": "8", "samsung": "3", "rhino": "1.7.13", @@ -517,6 +557,7 @@ "firefox": "23", "safari": "7", "node": "0.12", + "deno": "1", "android": "4.4", "ios": "7", "samsung": "2", @@ -530,6 +571,7 @@ "firefox": "25", "safari": "7.1", "node": "0.12", + "deno": "1", "ios": "8", "samsung": "3", "rhino": "1.7.13", @@ -542,6 +584,7 @@ "firefox": "25", "safari": "7.1", "node": "0.12", + "deno": "1", "ios": "8", "samsung": "3", "rhino": "1.7.13", @@ -554,6 +597,7 @@ "firefox": "25", "safari": "7.1", "node": "0.12", + "deno": "1", "ios": "8", "samsung": "3", "rhino": "1.7.13", @@ -566,6 +610,7 @@ "firefox": "25", "safari": "9", "node": "0.12", + "deno": "1", "ios": "9", "samsung": "3", "rhino": "1.7.13", @@ -578,6 +623,7 @@ "firefox": "25", "safari": "7.1", "node": "0.12", + "deno": "1", "ios": "8", "samsung": "3", "rhino": "1.7.13", @@ -590,6 +636,7 @@ "firefox": "25", "safari": "7.1", "node": "0.12", + "deno": "1", "ios": "8", "samsung": "3", "rhino": "1.7.13", @@ -602,6 +649,7 @@ "firefox": "25", "safari": "7.1", "node": "0.12", + "deno": "1", "ios": "8", "samsung": "3", "rhino": "1.7.13", @@ -614,6 +662,7 @@ "firefox": "36", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "3.4", "rhino": "1.7.13", @@ -626,6 +675,7 @@ "firefox": "25", "safari": "9", "node": "0.12", + "deno": "1", "ios": "9", "samsung": "2", "rhino": "1.7.14", @@ -638,6 +688,7 @@ "firefox": "16", "safari": "9", "node": "0.8", + "deno": "1", "android": "4.1", "ios": "9", "samsung": "1.5", @@ -651,6 +702,7 @@ "firefox": "16", "safari": "9", "node": "0.12", + "deno": "1", "ios": "9", "samsung": "2", "rhino": "1.7.13", @@ -663,6 +715,7 @@ "firefox": "15", "safari": "9", "node": "0.8", + "deno": "1", "android": "4.1", "ios": "9", "samsung": "1.5", @@ -676,6 +729,7 @@ "firefox": "32", "safari": "9", "node": "0.12", + "deno": "1", "ios": "9", "samsung": "2", "rhino": "1.7.13", @@ -688,6 +742,7 @@ "firefox": "31", "safari": "9", "node": "0.12", + "deno": "1", "ios": "9", "samsung": "2", "rhino": "1.7.13", @@ -700,6 +755,7 @@ "firefox": "31", "safari": "9", "node": "0.12", + "deno": "1", "ios": "9", "samsung": "2", "rhino": "1.7.13", @@ -712,6 +768,7 @@ "firefox": "25", "safari": "9", "node": "0.12", + "deno": "1", "ios": "9", "samsung": "2", "rhino": "1.7.14", @@ -724,6 +781,7 @@ "firefox": "25", "safari": "9", "node": "0.12", + "deno": "1", "ios": "9", "samsung": "2", "rhino": "1.7.14", @@ -736,6 +794,7 @@ "firefox": "36", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" @@ -747,6 +806,7 @@ "firefox": "4", "safari": "4", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "6", @@ -762,6 +822,7 @@ "firefox": "48", "safari": "9", "node": "8.10", + "deno": "1", "ios": "9", "samsung": "8", "electron": "3.0" @@ -773,6 +834,7 @@ "firefox": "48", "safari": "9", "node": "8.10", + "deno": "1", "ios": "9", "samsung": "8", "electron": "3.0" @@ -784,6 +846,7 @@ "firefox": "4", "safari": "5.1", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "6", @@ -799,6 +862,7 @@ "firefox": "4", "safari": "4", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "6", @@ -814,6 +878,7 @@ "firefox": "47", "safari": "10.1", "node": "7", + "deno": "1", "ios": "10.3", "samsung": "6", "rhino": "1.7.14", @@ -826,6 +891,7 @@ "firefox": "35", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "4", "rhino": "1.7.13", @@ -838,6 +904,7 @@ "firefox": "35", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "4", "rhino": "1.7.13", @@ -850,6 +917,7 @@ "firefox": "50", "safari": "10.1", "node": "7", + "deno": "1", "ios": "10.3", "samsung": "6", "electron": "1.4" @@ -861,6 +929,7 @@ "firefox": "33", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "3.4", "rhino": "1.7.13", @@ -873,6 +942,7 @@ "firefox": "35", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "4", "rhino": "1.7.13", @@ -885,6 +955,7 @@ "firefox": "36", "safari": "9", "node": "8.10", + "deno": "1", "ios": "9", "samsung": "8", "electron": "3.0" @@ -896,6 +967,7 @@ "firefox": "36", "safari": "9", "node": "8.10", + "deno": "1", "ios": "9", "samsung": "8", "electron": "3.0" @@ -907,6 +979,7 @@ "firefox": "35", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "4", "rhino": "1.7.13", @@ -919,6 +992,7 @@ "firefox": "51", "safari": "10", "node": "8", + "deno": "1", "ios": "10", "samsung": "7", "electron": "1.7" @@ -930,6 +1004,7 @@ "firefox": "22", "safari": "9", "node": "0.8", + "deno": "1", "android": "4.1", "ios": "9", "samsung": "1.5", @@ -943,6 +1018,7 @@ "firefox": "35", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "4", "rhino": "1.7.13", @@ -955,6 +1031,7 @@ "firefox": "35", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "4", "rhino": "1.7.13", @@ -967,6 +1044,7 @@ "firefox": "35", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "4", "rhino": "1.7.13", @@ -979,6 +1057,7 @@ "firefox": "35", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "3.4", "rhino": "1.7.13", @@ -991,6 +1070,7 @@ "firefox": "35", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "4", "rhino": "1.7.13", @@ -1003,6 +1083,7 @@ "firefox": "31", "safari": "9", "node": "0.12", + "deno": "1", "ie": "11", "ios": "9", "samsung": "2", @@ -1016,6 +1097,7 @@ "firefox": "47", "safari": "10.1", "node": "7", + "deno": "1", "ios": "10.3", "samsung": "6", "rhino": "1.7.14", @@ -1028,6 +1110,7 @@ "firefox": "45", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -1039,6 +1122,7 @@ "firefox": "58", "safari": "11.1", "node": "10", + "deno": "1", "ios": "11.3", "samsung": "8", "electron": "3.0" @@ -1050,6 +1134,7 @@ "firefox": "42", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" @@ -1061,6 +1146,7 @@ "firefox": "49", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" @@ -1072,6 +1158,7 @@ "firefox": "42", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" @@ -1083,6 +1170,7 @@ "firefox": "42", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" @@ -1094,6 +1182,7 @@ "firefox": "42", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" @@ -1105,6 +1194,7 @@ "firefox": "42", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" @@ -1116,6 +1206,7 @@ "firefox": "42", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" @@ -1127,6 +1218,7 @@ "firefox": "42", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" @@ -1138,6 +1230,7 @@ "firefox": "42", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" @@ -1149,6 +1242,7 @@ "firefox": "42", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" @@ -1160,6 +1254,7 @@ "firefox": "42", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" @@ -1171,6 +1266,7 @@ "firefox": "42", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" @@ -1182,6 +1278,7 @@ "firefox": "42", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" @@ -1193,6 +1290,7 @@ "firefox": "40", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.1" @@ -1204,6 +1302,7 @@ "firefox": "37", "safari": "9", "node": "6", + "deno": "1", "ios": "9", "samsung": "5", "electron": "0.37" @@ -1215,6 +1314,7 @@ "firefox": "49", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "rhino": "1.7.13", @@ -1227,6 +1327,7 @@ "firefox": "49", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.1" @@ -1238,6 +1339,7 @@ "firefox": "49", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.1" @@ -1249,6 +1351,7 @@ "firefox": "49", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "rhino": "1.7.13", @@ -1261,6 +1364,7 @@ "firefox": "39", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.1" @@ -1272,6 +1376,7 @@ "firefox": "53", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -1283,6 +1388,7 @@ "firefox": "51", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -1294,6 +1400,7 @@ "firefox": "57", "safari": "12", "node": "10", + "deno": "1", "ios": "12", "samsung": "8", "electron": "3.0" @@ -1305,6 +1412,7 @@ "firefox": "17", "safari": "6", "node": "0.4", + "deno": "1", "android": "4", "ios": "7", "phantom": "1.9", @@ -1319,6 +1427,7 @@ "firefox": "17", "safari": "6", "node": "0.4", + "deno": "1", "android": "4", "ios": "7", "phantom": "1.9", @@ -1333,6 +1442,7 @@ "firefox": "17", "safari": "6", "node": "0.4", + "deno": "1", "android": "4", "ios": "7", "phantom": "1.9", @@ -1347,6 +1457,7 @@ "firefox": "17", "safari": "6", "node": "0.4", + "deno": "1", "android": "4", "ios": "7", "phantom": "1.9", @@ -1361,6 +1472,7 @@ "firefox": "29", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "3.4", "rhino": "1.7.13", @@ -1373,6 +1485,7 @@ "firefox": "29", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "3.4", "rhino": "1.7.13", @@ -1385,6 +1498,7 @@ "firefox": "17", "safari": "6", "node": "0.4", + "deno": "1", "android": "4", "ios": "7", "phantom": "1.9", @@ -1399,6 +1513,7 @@ "firefox": "17", "safari": "6", "node": "0.4", + "deno": "1", "android": "4", "ios": "7", "phantom": "1.9", @@ -1413,6 +1528,7 @@ "firefox": "17", "safari": "6", "node": "0.4", + "deno": "1", "android": "4", "ios": "7", "phantom": "1.9", @@ -1427,6 +1543,7 @@ "firefox": "29", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "3.4", "rhino": "1.7.13", @@ -1439,6 +1556,7 @@ "firefox": "40", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "3.4", "rhino": "1.7.13", @@ -1451,6 +1569,7 @@ "firefox": "17", "safari": "6", "node": "0.4", + "deno": "1", "android": "4", "ios": "7", "phantom": "1.9", @@ -1465,6 +1584,7 @@ "firefox": "36", "safari": "9", "node": "0.12", + "deno": "1", "ios": "9", "samsung": "3", "rhino": "1.7.13", @@ -1477,6 +1597,7 @@ "firefox": "17", "safari": "6", "node": "0.4", + "deno": "1", "android": "4", "ios": "7", "phantom": "1.9", @@ -1491,6 +1612,7 @@ "firefox": "48", "safari": "10", "node": "8", + "deno": "1", "ios": "10", "samsung": "7", "rhino": "1.7.13", @@ -1503,6 +1625,7 @@ "firefox": "48", "safari": "10", "node": "8", + "deno": "1", "ios": "10", "samsung": "7", "rhino": "1.7.13", @@ -1515,6 +1638,7 @@ "firefox": "34", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "3.4", "rhino": "1.7.14", @@ -1527,6 +1651,7 @@ "firefox": "24", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "3.4", "rhino": "1.7.13", @@ -1539,6 +1664,7 @@ "firefox": "17", "safari": "6", "node": "0.4", + "deno": "1", "android": "4", "ios": "7", "phantom": "1.9", @@ -1553,6 +1679,7 @@ "firefox": "29", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "3.4", "rhino": "1.7.13", @@ -1565,6 +1692,7 @@ "firefox": "17", "safari": "6", "node": "0.4", + "deno": "1", "android": "4", "ios": "7", "phantom": "1.9", @@ -1579,6 +1707,7 @@ "firefox": "17", "safari": "6", "node": "0.4", + "deno": "1", "android": "4", "ios": "7", "phantom": "1.9", @@ -1593,6 +1722,7 @@ "firefox": "17", "safari": "6", "node": "0.4", + "deno": "1", "android": "4", "ios": "7", "phantom": "1.9", @@ -1607,6 +1737,7 @@ "firefox": "3.5", "safari": "4", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "6", @@ -1622,6 +1753,7 @@ "firefox": "61", "safari": "12", "node": "10", + "deno": "1", "ios": "12", "samsung": "9", "rhino": "1.7.13", @@ -1634,6 +1766,7 @@ "firefox": "61", "safari": "12", "node": "10", + "deno": "1", "ios": "12", "samsung": "9", "rhino": "1.7.13", @@ -1646,6 +1779,7 @@ "firefox": "48", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -1657,6 +1791,7 @@ "firefox": "15", "safari": "5.1", "node": "0.4", + "deno": "1", "ie": "10", "android": "4", "ios": "6", @@ -1672,6 +1807,7 @@ "firefox": "48", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -1683,6 +1819,7 @@ "firefox": "48", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -1694,6 +1831,7 @@ "firefox": "48", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -1705,6 +1843,7 @@ "firefox": "48", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -1716,6 +1855,7 @@ "firefox": "48", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -1727,6 +1867,7 @@ "firefox": "48", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -1738,6 +1879,7 @@ "firefox": "48", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -1749,6 +1891,7 @@ "firefox": "48", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -1760,6 +1903,7 @@ "firefox": "48", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -1771,6 +1915,7 @@ "firefox": "53", "safari": "9", "node": "6.5", + "deno": "1", "ios": "9", "samsung": "5", "electron": "1.2" @@ -1782,6 +1927,7 @@ "firefox": "53", "safari": "9", "node": "6.5", + "deno": "1", "ios": "9", "samsung": "5", "electron": "1.2" diff --git a/node_modules/@babel/compat-data/data/overlapping-plugins.json b/node_modules/@babel/compat-data/data/overlapping-plugins.json index 6ad09e432..94fda05db 100644 --- a/node_modules/@babel/compat-data/data/overlapping-plugins.json +++ b/node_modules/@babel/compat-data/data/overlapping-plugins.json @@ -16,6 +16,9 @@ "transform-template-literals": [ "bugfix/transform-tagged-template-caching" ], + "transform-optional-chaining": [ + "bugfix/transform-v8-spread-parameters-in-optional-chaining" + ], "proposal-optional-chaining": [ "bugfix/transform-v8-spread-parameters-in-optional-chaining" ] diff --git a/node_modules/@babel/compat-data/data/plugin-bugfixes.json b/node_modules/@babel/compat-data/data/plugin-bugfixes.json index a16d707df..dc6f74626 100644 --- a/node_modules/@babel/compat-data/data/plugin-bugfixes.json +++ b/node_modules/@babel/compat-data/data/plugin-bugfixes.json @@ -6,6 +6,7 @@ "firefox": "52", "safari": "11", "node": "7.6", + "deno": "1", "ios": "11", "samsung": "6", "electron": "1.6" @@ -17,6 +18,7 @@ "firefox": "52", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" @@ -28,6 +30,7 @@ "firefox": "53", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -39,6 +42,7 @@ "firefox": "44", "safari": "11", "node": "6", + "deno": "1", "ie": "11", "ios": "11", "samsung": "5", @@ -51,6 +55,7 @@ "firefox": "4", "safari": "11", "node": "6", + "deno": "1", "ie": "11", "ios": "11", "samsung": "5", @@ -63,6 +68,7 @@ "edge": "14", "firefox": "2", "node": "6", + "deno": "1", "samsung": "5", "electron": "0.37" }, @@ -73,6 +79,7 @@ "firefox": "34", "safari": "13", "node": "4", + "deno": "1", "ios": "13", "samsung": "3.4", "rhino": "1.7.14", @@ -85,9 +92,22 @@ "firefox": "74", "safari": "13.1", "node": "16.9", + "deno": "1.9", "ios": "13.4", "electron": "13.0" }, + "transform-optional-chaining": { + "chrome": "80", + "opera": "67", + "edge": "80", + "firefox": "74", + "safari": "13.1", + "node": "14", + "deno": "1", + "ios": "13.4", + "samsung": "13", + "electron": "8.0" + }, "proposal-optional-chaining": { "chrome": "80", "opera": "67", @@ -95,6 +115,7 @@ "firefox": "74", "safari": "13.1", "node": "14", + "deno": "1", "ios": "13.4", "samsung": "13", "electron": "8.0" @@ -106,6 +127,7 @@ "firefox": "53", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" @@ -117,6 +139,7 @@ "firefox": "52", "safari": "10.1", "node": "7.6", + "deno": "1", "ios": "10.3", "samsung": "6", "electron": "1.6" @@ -128,6 +151,7 @@ "firefox": "34", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "3.4", "electron": "0.21" @@ -139,6 +163,7 @@ "firefox": "53", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -150,6 +175,7 @@ "firefox": "51", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" diff --git a/node_modules/@babel/compat-data/data/plugins.json b/node_modules/@babel/compat-data/data/plugins.json index 96c64cab3..80f2fbfbb 100644 --- a/node_modules/@babel/compat-data/data/plugins.json +++ b/node_modules/@babel/compat-data/data/plugins.json @@ -1,12 +1,33 @@ { + "transform-class-static-block": { + "chrome": "94", + "opera": "80", + "edge": "94", + "firefox": "93", + "node": "16.11", + "deno": "1.14", + "electron": "15.0" + }, "proposal-class-static-block": { "chrome": "94", "opera": "80", "edge": "94", "firefox": "93", "node": "16.11", + "deno": "1.14", "electron": "15.0" }, + "transform-private-property-in-object": { + "chrome": "91", + "opera": "77", + "edge": "91", + "firefox": "90", + "safari": "15", + "node": "16.9", + "deno": "1.9", + "ios": "15", + "electron": "13.0" + }, "proposal-private-property-in-object": { "chrome": "91", "opera": "77", @@ -14,9 +35,22 @@ "firefox": "90", "safari": "15", "node": "16.9", + "deno": "1.9", "ios": "15", "electron": "13.0" }, + "transform-class-properties": { + "chrome": "74", + "opera": "62", + "edge": "79", + "firefox": "90", + "safari": "14.1", + "node": "12", + "deno": "1", + "ios": "15", + "samsung": "11", + "electron": "6.0" + }, "proposal-class-properties": { "chrome": "74", "opera": "62", @@ -24,10 +58,23 @@ "firefox": "90", "safari": "14.1", "node": "12", + "deno": "1", "ios": "15", "samsung": "11", "electron": "6.0" }, + "transform-private-methods": { + "chrome": "84", + "opera": "70", + "edge": "84", + "firefox": "90", + "safari": "15", + "node": "14.6", + "deno": "1", + "ios": "15", + "samsung": "14", + "electron": "10.0" + }, "proposal-private-methods": { "chrome": "84", "opera": "70", @@ -35,10 +82,24 @@ "firefox": "90", "safari": "15", "node": "14.6", + "deno": "1", "ios": "15", "samsung": "14", "electron": "10.0" }, + "transform-numeric-separator": { + "chrome": "75", + "opera": "62", + "edge": "79", + "firefox": "70", + "safari": "13", + "node": "12.5", + "deno": "1", + "ios": "13", + "samsung": "11", + "rhino": "1.7.14", + "electron": "6.0" + }, "proposal-numeric-separator": { "chrome": "75", "opera": "62", @@ -46,11 +107,24 @@ "firefox": "70", "safari": "13", "node": "12.5", + "deno": "1", "ios": "13", "samsung": "11", "rhino": "1.7.14", "electron": "6.0" }, + "transform-logical-assignment-operators": { + "chrome": "85", + "opera": "71", + "edge": "85", + "firefox": "79", + "safari": "14", + "node": "15", + "deno": "1.2", + "ios": "14", + "samsung": "14", + "electron": "10.0" + }, "proposal-logical-assignment-operators": { "chrome": "85", "opera": "71", @@ -58,10 +132,23 @@ "firefox": "79", "safari": "14", "node": "15", + "deno": "1.2", "ios": "14", "samsung": "14", "electron": "10.0" }, + "transform-nullish-coalescing-operator": { + "chrome": "80", + "opera": "67", + "edge": "80", + "firefox": "72", + "safari": "13.1", + "node": "14", + "deno": "1", + "ios": "13.4", + "samsung": "13", + "electron": "8.0" + }, "proposal-nullish-coalescing-operator": { "chrome": "80", "opera": "67", @@ -69,10 +156,22 @@ "firefox": "72", "safari": "13.1", "node": "14", + "deno": "1", "ios": "13.4", "samsung": "13", "electron": "8.0" }, + "transform-optional-chaining": { + "chrome": "91", + "opera": "77", + "edge": "91", + "firefox": "74", + "safari": "13.1", + "node": "16.9", + "deno": "1.9", + "ios": "13.4", + "electron": "13.0" + }, "proposal-optional-chaining": { "chrome": "91", "opera": "77", @@ -80,9 +179,23 @@ "firefox": "74", "safari": "13.1", "node": "16.9", + "deno": "1.9", "ios": "13.4", "electron": "13.0" }, + "transform-json-strings": { + "chrome": "66", + "opera": "53", + "edge": "79", + "firefox": "62", + "safari": "12", + "node": "10", + "deno": "1", + "ios": "12", + "samsung": "9", + "rhino": "1.7.14", + "electron": "3.0" + }, "proposal-json-strings": { "chrome": "66", "opera": "53", @@ -90,11 +203,24 @@ "firefox": "62", "safari": "12", "node": "10", + "deno": "1", "ios": "12", "samsung": "9", "rhino": "1.7.14", "electron": "3.0" }, + "transform-optional-catch-binding": { + "chrome": "66", + "opera": "53", + "edge": "79", + "firefox": "58", + "safari": "11.1", + "node": "10", + "deno": "1", + "ios": "11.3", + "samsung": "9", + "electron": "3.0" + }, "proposal-optional-catch-binding": { "chrome": "66", "opera": "53", @@ -102,6 +228,7 @@ "firefox": "58", "safari": "11.1", "node": "10", + "deno": "1", "ios": "11.3", "samsung": "9", "electron": "3.0" @@ -112,9 +239,22 @@ "edge": "18", "firefox": "53", "node": "6", + "deno": "1", "samsung": "5", "electron": "0.37" }, + "transform-async-generator-functions": { + "chrome": "63", + "opera": "50", + "edge": "79", + "firefox": "57", + "safari": "12", + "node": "10", + "deno": "1", + "ios": "12", + "samsung": "8", + "electron": "3.0" + }, "proposal-async-generator-functions": { "chrome": "63", "opera": "50", @@ -122,10 +262,23 @@ "firefox": "57", "safari": "12", "node": "10", + "deno": "1", "ios": "12", "samsung": "8", "electron": "3.0" }, + "transform-object-rest-spread": { + "chrome": "60", + "opera": "47", + "edge": "79", + "firefox": "55", + "safari": "11.1", + "node": "8.3", + "deno": "1", + "ios": "11.3", + "samsung": "8", + "electron": "2.0" + }, "proposal-object-rest-spread": { "chrome": "60", "opera": "47", @@ -133,6 +286,7 @@ "firefox": "55", "safari": "11.1", "node": "8.3", + "deno": "1", "ios": "11.3", "samsung": "8", "electron": "2.0" @@ -144,10 +298,23 @@ "firefox": "78", "safari": "11.1", "node": "8.10", + "deno": "1", "ios": "11.3", "samsung": "8", "electron": "3.0" }, + "transform-unicode-property-regex": { + "chrome": "64", + "opera": "51", + "edge": "79", + "firefox": "78", + "safari": "11.1", + "node": "10", + "deno": "1", + "ios": "11.3", + "samsung": "9", + "electron": "3.0" + }, "proposal-unicode-property-regex": { "chrome": "64", "opera": "51", @@ -155,6 +322,7 @@ "firefox": "78", "safari": "11.1", "node": "10", + "deno": "1", "ios": "11.3", "samsung": "9", "electron": "3.0" @@ -166,6 +334,7 @@ "firefox": "78", "safari": "11.1", "node": "10", + "deno": "1", "ios": "11.3", "samsung": "9", "electron": "3.0" @@ -177,6 +346,7 @@ "firefox": "52", "safari": "11", "node": "7.6", + "deno": "1", "ios": "11", "samsung": "6", "electron": "1.6" @@ -188,6 +358,7 @@ "firefox": "52", "safari": "10.1", "node": "7", + "deno": "1", "ios": "10.3", "samsung": "6", "rhino": "1.7.14", @@ -200,6 +371,7 @@ "firefox": "34", "safari": "13", "node": "4", + "deno": "1", "ios": "13", "samsung": "3.4", "electron": "0.21" @@ -211,6 +383,7 @@ "firefox": "53", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "4", "electron": "0.30" @@ -222,6 +395,7 @@ "firefox": "53", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -233,6 +407,7 @@ "firefox": "43", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "rhino": "1.7.13", @@ -245,6 +420,7 @@ "firefox": "46", "safari": "10", "node": "4", + "deno": "1", "ie": "11", "ios": "10", "samsung": "3.4", @@ -257,6 +433,7 @@ "firefox": "45", "safari": "10", "node": "5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.36" @@ -268,6 +445,7 @@ "firefox": "45", "safari": "10", "node": "5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.36" @@ -279,6 +457,7 @@ "firefox": "33", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "4", "rhino": "1.7.14", @@ -291,6 +470,7 @@ "firefox": "34", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "3.4", "electron": "0.25" @@ -302,6 +482,7 @@ "firefox": "34", "safari": "7.1", "node": "4", + "deno": "1", "ios": "8", "samsung": "4", "electron": "0.30" @@ -313,6 +494,7 @@ "firefox": "53", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -324,6 +506,7 @@ "firefox": "3", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.37" @@ -335,6 +518,7 @@ "firefox": "53", "safari": "9", "node": "4", + "deno": "1", "ios": "9", "samsung": "4", "electron": "0.30" @@ -346,6 +530,7 @@ "firefox": "46", "safari": "12", "node": "6", + "deno": "1", "ios": "12", "samsung": "5", "electron": "1.1" @@ -357,6 +542,7 @@ "firefox": "45", "safari": "10", "node": "5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.36" @@ -368,6 +554,7 @@ "firefox": "53", "safari": "10", "node": "6.5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.2" @@ -379,6 +566,7 @@ "firefox": "51", "safari": "11", "node": "6", + "deno": "1", "ios": "11", "samsung": "5", "electron": "0.37" @@ -390,6 +578,7 @@ "firefox": "36", "safari": "9", "node": "0.12", + "deno": "1", "ios": "9", "samsung": "3", "rhino": "1.7.13", @@ -402,6 +591,7 @@ "firefox": "41", "safari": "10", "node": "5", + "deno": "1", "ios": "10", "samsung": "5", "electron": "0.36" @@ -413,6 +603,7 @@ "firefox": "53", "safari": "10", "node": "6", + "deno": "1", "ios": "10", "samsung": "5", "electron": "1.1" @@ -424,6 +615,7 @@ "firefox": "2", "safari": "5.1", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "6", @@ -439,6 +631,7 @@ "firefox": "2", "safari": "5.1", "node": "0.4", + "deno": "1", "ie": "9", "android": "4", "ios": "6", @@ -454,6 +647,7 @@ "firefox": "2", "safari": "3.1", "node": "0.6", + "deno": "1", "ie": "9", "android": "4.4", "ios": "6", @@ -462,6 +656,19 @@ "rhino": "1.7.13", "electron": "0.20" }, + "transform-export-namespace-from": { + "chrome": "72", + "and_chr": "72", + "edge": "79", + "firefox": "80", + "and_ff": "80", + "node": "13.2", + "opera": "60", + "op_mob": "51", + "samsung": "11.0", + "android": "72", + "electron": "5.0" + }, "proposal-export-namespace-from": { "chrome": "72", "and_chr": "72", diff --git a/node_modules/@babel/compat-data/package.json b/node_modules/@babel/compat-data/package.json index f2ae11945..a905debe6 100644 --- a/node_modules/@babel/compat-data/package.json +++ b/node_modules/@babel/compat-data/package.json @@ -1,6 +1,6 @@ { "name": "@babel/compat-data", - "version": "7.19.3", + "version": "7.20.1", "author": "The Babel Team (https://babel.dev/team)", "license": "MIT", "description": "", diff --git a/node_modules/@babel/core/lib/config/caching.js b/node_modules/@babel/core/lib/config/caching.js index 31e7db174..6362db3ce 100644 --- a/node_modules/@babel/core/lib/config/caching.js +++ b/node_modules/@babel/core/lib/config/caching.js @@ -8,21 +8,15 @@ exports.makeStrongCache = makeStrongCache; exports.makeStrongCacheSync = makeStrongCacheSync; exports.makeWeakCache = makeWeakCache; exports.makeWeakCacheSync = makeWeakCacheSync; - function _gensync() { const data = require("gensync"); - _gensync = function () { return data; }; - return data; } - var _async = require("../gensync-utils/async"); - var _util = require("./util"); - const synchronize = gen => { return _gensync()(gen).sync; }; @@ -30,19 +24,15 @@ const synchronize = gen => { function* genTrue() { return true; } - function makeWeakCache(handler) { return makeCachedFunction(WeakMap, handler); } - function makeWeakCacheSync(handler) { return synchronize(makeWeakCache(handler)); } - function makeStrongCache(handler) { return makeCachedFunction(Map, handler); } - function makeStrongCacheSync(handler) { return synchronize(makeStrongCache(handler)); } @@ -60,7 +50,6 @@ function makeCachedFunction(CallCache, handler) { const handlerResult = handler(arg, cache); let finishLock; let value; - if ((0, _util.isIterableIterator)(handlerResult)) { value = yield* (0, _async.onFirstPause)(handlerResult, () => { finishLock = setupAsyncLocks(cache, futureCache, arg); @@ -68,21 +57,16 @@ function makeCachedFunction(CallCache, handler) { } else { value = handlerResult; } - updateFunctionCache(callCache, cache, arg, value); - if (finishLock) { futureCache.delete(arg); finishLock.release(value); } - return value; }; } - function* getCachedValue(cache, arg, data) { const cachedValue = cache.get(arg); - if (cachedValue) { for (const { value, @@ -94,23 +78,18 @@ function* getCachedValue(cache, arg, data) { }; } } - return { valid: false, value: null }; } - function* getCachedValueOrWait(asyncContext, callCache, futureCache, arg, data) { const cached = yield* getCachedValue(callCache, arg, data); - if (cached.valid) { return cached; } - if (asyncContext) { const cached = yield* getCachedValue(futureCache, arg, data); - if (cached.valid) { const value = yield* (0, _async.waitFor)(cached.value.promise); return { @@ -119,24 +98,20 @@ function* getCachedValueOrWait(asyncContext, callCache, futureCache, arg, data) }; } } - return { valid: false, value: null }; } - function setupAsyncLocks(config, futureCache, arg) { const finishLock = new Lock(); updateFunctionCache(futureCache, config, arg, finishLock); return finishLock; } - function updateFunctionCache(cache, config, arg, value) { if (!config.configured()) config.forever(); let cachedValue = cache.get(arg); config.deactivate(); - switch (config.mode()) { case "forever": cachedValue = [{ @@ -145,7 +120,6 @@ function updateFunctionCache(cache, config, arg, value) { }]; cache.set(arg, cachedValue); break; - case "invalidate": cachedValue = [{ value, @@ -153,7 +127,6 @@ function updateFunctionCache(cache, config, arg, value) { }]; cache.set(arg, cachedValue); break; - case "valid": if (cachedValue) { cachedValue.push({ @@ -167,10 +140,8 @@ function updateFunctionCache(cache, config, arg, value) { }]; cache.set(arg, cachedValue); } - } } - class CacheConfigurator { constructor(data) { this._active = true; @@ -182,114 +153,86 @@ class CacheConfigurator { this._data = void 0; this._data = data; } - simple() { return makeSimpleConfigurator(this); } - mode() { if (this._never) return "never"; if (this._forever) return "forever"; if (this._invalidate) return "invalidate"; return "valid"; } - forever() { if (!this._active) { throw new Error("Cannot change caching after evaluation has completed."); } - if (this._never) { throw new Error("Caching has already been configured with .never()"); } - this._forever = true; this._configured = true; } - never() { if (!this._active) { throw new Error("Cannot change caching after evaluation has completed."); } - if (this._forever) { throw new Error("Caching has already been configured with .forever()"); } - this._never = true; this._configured = true; } - using(handler) { if (!this._active) { throw new Error("Cannot change caching after evaluation has completed."); } - if (this._never || this._forever) { throw new Error("Caching has already been configured with .never or .forever()"); } - this._configured = true; const key = handler(this._data); const fn = (0, _async.maybeAsync)(handler, `You appear to be using an async cache handler, but Babel has been called synchronously`); - if ((0, _async.isThenable)(key)) { return key.then(key => { this._pairs.push([key, fn]); - return key; }); } - this._pairs.push([key, fn]); - return key; } - invalidate(handler) { this._invalidate = true; return this.using(handler); } - validator() { const pairs = this._pairs; return function* (data) { for (const [key, fn] of pairs) { if (key !== (yield* fn(data))) return false; } - return true; }; } - deactivate() { this._active = false; } - configured() { return this._configured; } - } - function makeSimpleConfigurator(cache) { function cacheFn(val) { if (typeof val === "boolean") { if (val) cache.forever();else cache.never(); return; } - return cache.using(() => assertSimpleType(val())); } - cacheFn.forever = () => cache.forever(); - cacheFn.never = () => cache.never(); - cacheFn.using = cb => cache.using(() => assertSimpleType(cb())); - cacheFn.invalidate = cb => cache.invalidate(() => assertSimpleType(cb())); - return cacheFn; } @@ -297,14 +240,11 @@ function assertSimpleType(value) { if ((0, _async.isThenable)(value)) { throw new Error(`You appear to be using an async cache handler, ` + `which your current version of Babel does not support. ` + `We may add support for this in the future, ` + `but if you're on the most recent version of @babel/core and still ` + `seeing this error, then you'll need to synchronously handle your caching logic.`); } - if (value != null && typeof value !== "string" && typeof value !== "boolean" && typeof value !== "number") { throw new Error("Cache keys must be either string, boolean, number, null, or undefined."); } - return value; } - class Lock { constructor() { this.released = false; @@ -314,15 +254,11 @@ class Lock { this._resolve = resolve; }); } - release(value) { this.released = true; - this._resolve(value); } - } - 0 && 0; //# sourceMappingURL=caching.js.map diff --git a/node_modules/@babel/core/lib/config/caching.js.map b/node_modules/@babel/core/lib/config/caching.js.map index e5d3333d9..a2ac90cb0 100644 --- a/node_modules/@babel/core/lib/config/caching.js.map +++ b/node_modules/@babel/core/lib/config/caching.js.map @@ -1 +1 @@ -{"version":3,"names":["synchronize","gen","gensync","sync","genTrue","makeWeakCache","handler","makeCachedFunction","WeakMap","makeWeakCacheSync","makeStrongCache","Map","makeStrongCacheSync","CallCache","callCacheSync","callCacheAsync","futureCache","cachedFunction","arg","data","asyncContext","isAsync","callCache","cached","getCachedValueOrWait","valid","value","cache","CacheConfigurator","handlerResult","finishLock","isIterableIterator","onFirstPause","setupAsyncLocks","updateFunctionCache","delete","release","getCachedValue","cachedValue","get","waitFor","promise","config","Lock","configured","forever","deactivate","mode","set","validator","push","constructor","_active","_never","_forever","_invalidate","_configured","_pairs","_data","simple","makeSimpleConfigurator","Error","never","using","key","fn","maybeAsync","isThenable","then","invalidate","pairs","cacheFn","val","assertSimpleType","cb","released","_resolve","Promise","resolve"],"sources":["../../src/config/caching.ts"],"sourcesContent":["import gensync from \"gensync\";\nimport type { Handler } from \"gensync\";\nimport {\n maybeAsync,\n isAsync,\n onFirstPause,\n waitFor,\n isThenable,\n} from \"../gensync-utils/async\";\nimport { isIterableIterator } from \"./util\";\n\nexport type { CacheConfigurator };\n\nexport type SimpleCacheConfigurator = {\n (forever: boolean): void;\n (handler: () => T): T;\n\n forever: () => void;\n never: () => void;\n using: (handler: () => T) => T;\n invalidate: (handler: () => T) => T;\n};\n\nexport type CacheEntry = Array<{\n value: ResultT;\n valid: (channel: SideChannel) => Handler;\n}>;\n\nconst synchronize = (\n gen: (...args: ArgsT) => Handler,\n): ((...args: ArgsT) => ResultT) => {\n return gensync(gen).sync;\n};\n\n// eslint-disable-next-line require-yield\nfunction* genTrue() {\n return true;\n}\n\nexport function makeWeakCache(\n handler: (\n arg: ArgT,\n cache: CacheConfigurator,\n ) => Handler | ResultT,\n): (arg: ArgT, data: SideChannel) => Handler {\n return makeCachedFunction(WeakMap, handler);\n}\n\nexport function makeWeakCacheSync(\n handler: (arg: ArgT, cache?: CacheConfigurator) => ResultT,\n): (arg: ArgT, data?: SideChannel) => ResultT {\n return synchronize<[ArgT, SideChannel], ResultT>(\n makeWeakCache(handler),\n );\n}\n\nexport function makeStrongCache(\n handler: (\n arg: ArgT,\n cache: CacheConfigurator,\n ) => Handler | ResultT,\n): (arg: ArgT, data: SideChannel) => Handler {\n return makeCachedFunction(Map, handler);\n}\n\nexport function makeStrongCacheSync(\n handler: (arg: ArgT, cache?: CacheConfigurator) => ResultT,\n): (arg: ArgT, data?: SideChannel) => ResultT {\n return synchronize<[ArgT, SideChannel], ResultT>(\n makeStrongCache(handler),\n );\n}\n\n/* NOTE: Part of the logic explained in this comment is explained in the\n * getCachedValueOrWait and setupAsyncLocks functions.\n *\n * > There are only two hard things in Computer Science: cache invalidation and naming things.\n * > -- Phil Karlton\n *\n * I don't know if Phil was also thinking about handling a cache whose invalidation function is\n * defined asynchronously is considered, but it is REALLY hard to do correctly.\n *\n * The implemented logic (only when gensync is run asynchronously) is the following:\n * 1. If there is a valid cache associated to the current \"arg\" parameter,\n * a. RETURN the cached value\n * 3. If there is a FinishLock associated to the current \"arg\" parameter representing a valid cache,\n * a. Wait for that lock to be released\n * b. RETURN the value associated with that lock\n * 5. Start executing the function to be cached\n * a. If it pauses on a promise, then\n * i. Let FinishLock be a new lock\n * ii. Store FinishLock as associated to the current \"arg\" parameter\n * iii. Wait for the function to finish executing\n * iv. Release FinishLock\n * v. Send the function result to anyone waiting on FinishLock\n * 6. Store the result in the cache\n * 7. RETURN the result\n */\nfunction makeCachedFunction(\n CallCache: new () => CacheMap,\n handler: (\n arg: ArgT,\n cache: CacheConfigurator,\n ) => Handler | ResultT,\n): (arg: ArgT, data: SideChannel) => Handler {\n const callCacheSync = new CallCache();\n const callCacheAsync = new CallCache();\n const futureCache = new CallCache>();\n\n return function* cachedFunction(arg: ArgT, data: SideChannel) {\n const asyncContext = yield* isAsync();\n const callCache = asyncContext ? callCacheAsync : callCacheSync;\n\n const cached = yield* getCachedValueOrWait(\n asyncContext,\n callCache,\n futureCache,\n arg,\n data,\n );\n if (cached.valid) return cached.value;\n\n const cache = new CacheConfigurator(data);\n\n const handlerResult: Handler | ResultT = handler(arg, cache);\n\n let finishLock: Lock;\n let value: ResultT;\n\n if (isIterableIterator(handlerResult)) {\n value = yield* onFirstPause(handlerResult, () => {\n finishLock = setupAsyncLocks(cache, futureCache, arg);\n });\n } else {\n value = handlerResult;\n }\n\n updateFunctionCache(callCache, cache, arg, value);\n\n if (finishLock) {\n futureCache.delete(arg);\n finishLock.release(value);\n }\n\n return value;\n };\n}\n\ntype CacheMap =\n | Map>\n // @ts-expect-error todo(flow->ts): add `extends object` constraint to ArgT\n | WeakMap>;\n\nfunction* getCachedValue(\n cache: CacheMap,\n arg: ArgT,\n data: SideChannel,\n): Handler<{ valid: true; value: ResultT } | { valid: false; value: null }> {\n const cachedValue: CacheEntry | void = cache.get(arg);\n\n if (cachedValue) {\n for (const { value, valid } of cachedValue) {\n if (yield* valid(data)) return { valid: true, value };\n }\n }\n\n return { valid: false, value: null };\n}\n\nfunction* getCachedValueOrWait(\n asyncContext: boolean,\n callCache: CacheMap,\n futureCache: CacheMap, SideChannel>,\n arg: ArgT,\n data: SideChannel,\n): Handler<{ valid: true; value: ResultT } | { valid: false; value: null }> {\n const cached = yield* getCachedValue(callCache, arg, data);\n if (cached.valid) {\n return cached;\n }\n\n if (asyncContext) {\n const cached = yield* getCachedValue(futureCache, arg, data);\n if (cached.valid) {\n const value = yield* waitFor(cached.value.promise);\n return { valid: true, value };\n }\n }\n\n return { valid: false, value: null };\n}\n\nfunction setupAsyncLocks(\n config: CacheConfigurator,\n futureCache: CacheMap, SideChannel>,\n arg: ArgT,\n): Lock {\n const finishLock = new Lock();\n\n updateFunctionCache(futureCache, config, arg, finishLock);\n\n return finishLock;\n}\n\nfunction updateFunctionCache<\n ArgT,\n ResultT,\n SideChannel,\n Cache extends CacheMap,\n>(\n cache: Cache,\n config: CacheConfigurator,\n arg: ArgT,\n value: ResultT,\n) {\n if (!config.configured()) config.forever();\n\n let cachedValue: CacheEntry | void = cache.get(arg);\n\n config.deactivate();\n\n switch (config.mode()) {\n case \"forever\":\n cachedValue = [{ value, valid: genTrue }];\n cache.set(arg, cachedValue);\n break;\n case \"invalidate\":\n cachedValue = [{ value, valid: config.validator() }];\n cache.set(arg, cachedValue);\n break;\n case \"valid\":\n if (cachedValue) {\n cachedValue.push({ value, valid: config.validator() });\n } else {\n cachedValue = [{ value, valid: config.validator() }];\n cache.set(arg, cachedValue);\n }\n }\n}\n\nclass CacheConfigurator {\n _active: boolean = true;\n _never: boolean = false;\n _forever: boolean = false;\n _invalidate: boolean = false;\n\n _configured: boolean = false;\n\n _pairs: Array<\n [cachedValue: unknown, handler: (data: SideChannel) => Handler]\n > = [];\n\n _data: SideChannel;\n\n constructor(data: SideChannel) {\n this._data = data;\n }\n\n simple() {\n return makeSimpleConfigurator(this);\n }\n\n mode() {\n if (this._never) return \"never\";\n if (this._forever) return \"forever\";\n if (this._invalidate) return \"invalidate\";\n return \"valid\";\n }\n\n forever() {\n if (!this._active) {\n throw new Error(\"Cannot change caching after evaluation has completed.\");\n }\n if (this._never) {\n throw new Error(\"Caching has already been configured with .never()\");\n }\n this._forever = true;\n this._configured = true;\n }\n\n never() {\n if (!this._active) {\n throw new Error(\"Cannot change caching after evaluation has completed.\");\n }\n if (this._forever) {\n throw new Error(\"Caching has already been configured with .forever()\");\n }\n this._never = true;\n this._configured = true;\n }\n\n using(handler: (data: SideChannel) => T): T {\n if (!this._active) {\n throw new Error(\"Cannot change caching after evaluation has completed.\");\n }\n if (this._never || this._forever) {\n throw new Error(\n \"Caching has already been configured with .never or .forever()\",\n );\n }\n this._configured = true;\n\n const key = handler(this._data);\n\n const fn = maybeAsync(\n handler,\n `You appear to be using an async cache handler, but Babel has been called synchronously`,\n );\n\n if (isThenable(key)) {\n // @ts-expect-error todo(flow->ts): improve function return type annotation\n return key.then((key: unknown) => {\n this._pairs.push([key, fn]);\n return key;\n });\n }\n\n this._pairs.push([key, fn]);\n return key;\n }\n\n invalidate(handler: (data: SideChannel) => T): T {\n this._invalidate = true;\n return this.using(handler);\n }\n\n validator(): (data: SideChannel) => Handler {\n const pairs = this._pairs;\n return function* (data: SideChannel) {\n for (const [key, fn] of pairs) {\n if (key !== (yield* fn(data))) return false;\n }\n return true;\n };\n }\n\n deactivate() {\n this._active = false;\n }\n\n configured() {\n return this._configured;\n }\n}\n\nfunction makeSimpleConfigurator(\n cache: CacheConfigurator,\n): SimpleCacheConfigurator {\n function cacheFn(val: any) {\n if (typeof val === \"boolean\") {\n if (val) cache.forever();\n else cache.never();\n return;\n }\n\n return cache.using(() => assertSimpleType(val()));\n }\n cacheFn.forever = () => cache.forever();\n cacheFn.never = () => cache.never();\n cacheFn.using = (cb: { (): SimpleType }) =>\n cache.using(() => assertSimpleType(cb()));\n cacheFn.invalidate = (cb: { (): SimpleType }) =>\n cache.invalidate(() => assertSimpleType(cb()));\n\n return cacheFn as any;\n}\n\n// Types are limited here so that in the future these values can be used\n// as part of Babel's caching logic.\nexport type SimpleType =\n | string\n | boolean\n | number\n | null\n | void\n | Promise;\nexport function assertSimpleType(value: unknown): SimpleType {\n if (isThenable(value)) {\n throw new Error(\n `You appear to be using an async cache handler, ` +\n `which your current version of Babel does not support. ` +\n `We may add support for this in the future, ` +\n `but if you're on the most recent version of @babel/core and still ` +\n `seeing this error, then you'll need to synchronously handle your caching logic.`,\n );\n }\n\n if (\n value != null &&\n typeof value !== \"string\" &&\n typeof value !== \"boolean\" &&\n typeof value !== \"number\"\n ) {\n throw new Error(\n \"Cache keys must be either string, boolean, number, null, or undefined.\",\n );\n }\n // @ts-expect-error Type 'unknown' is not assignable to type 'SimpleType'. This can be removed\n // when strictNullCheck is enabled\n return value;\n}\n\nclass Lock {\n released: boolean = false;\n promise: Promise;\n _resolve: (value: T) => void;\n\n constructor() {\n this.promise = new Promise(resolve => {\n this._resolve = resolve;\n });\n }\n\n release(value: T) {\n this.released = true;\n this._resolve(value);\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;;AAOA;;AAmBA,MAAMA,WAAW,GACfC,GADkB,IAEgB;EAClC,OAAOC,UAAA,CAAQD,GAAR,EAAaE,IAApB;AACD,CAJD;;AAOA,UAAUC,OAAV,GAAoB;EAClB,OAAO,IAAP;AACD;;AAEM,SAASC,aAAT,CACLC,OADK,EAK+C;EACpD,OAAOC,kBAAkB,CAA6BC,OAA7B,EAAsCF,OAAtC,CAAzB;AACD;;AAEM,SAASG,iBAAT,CACLH,OADK,EAEuC;EAC5C,OAAON,WAAW,CAChBK,aAAa,CAA6BC,OAA7B,CADG,CAAlB;AAGD;;AAEM,SAASI,eAAT,CACLJ,OADK,EAK+C;EACpD,OAAOC,kBAAkB,CAA6BI,GAA7B,EAAkCL,OAAlC,CAAzB;AACD;;AAEM,SAASM,mBAAT,CACLN,OADK,EAEuC;EAC5C,OAAON,WAAW,CAChBU,eAAe,CAA6BJ,OAA7B,CADC,CAAlB;AAGD;;AA2BD,SAASC,kBAAT,CACEM,SADF,EAEEP,OAFF,EAMsD;EACpD,MAAMQ,aAAa,GAAG,IAAID,SAAJ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ACR,KAAR,GAAiBW,EAAD,IACd/C,KAAK,CAACoC,KAAN,CAAY,MAAMU,gBAAgB,CAACC,EAAE,EAAH,CAAlC,CADF;;EAEAH,OAAO,CAACF,UAAR,GAAsBK,EAAD,IACnB/C,KAAK,CAAC0C,UAAN,CAAiB,MAAMI,gBAAgB,CAACC,EAAE,EAAH,CAAvC,CADF;;EAGA,OAAOH,OAAP;AACD;;AAWM,SAASE,gBAAT,CAA0B/C,KAA1B,EAAsD;EAC3D,IAAI,IAAAyC,iBAAA,EAAWzC,KAAX,CAAJ,EAAuB;IACrB,MAAM,IAAImC,KAAJ,CACH,iDAAD,GACG,wDADH,GAEG,6CAFH,GAGG,oEAHH,GAIG,iFALC,CAAN;EAOD;;EAED,IACEnC,KAAK,IAAI,IAAT,IACA,OAAOA,KAAP,KAAiB,QADjB,IAEA,OAAOA,KAAP,KAAiB,SAFjB,IAGA,OAAOA,KAAP,KAAiB,QAJnB,EAKE;IACA,MAAM,IAAImC,KAAJ,CACJ,wEADI,CAAN;EAGD;;EAGD,OAAOnC,KAAP;AACD;;AAED,MAAMiB,IAAN,CAAc;EAKZQ,WAAW,GAAG;IAAA,KAJdwB,QAIc,GAJM,KAIN;IAAA,KAHdlC,OAGc;IAAA,KAFdmC,QAEc;IACZ,KAAKnC,OAAL,GAAe,IAAIoC,OAAJ,CAAYC,OAAO,IAAI;MACpC,KAAKF,QAAL,GAAgBE,OAAhB;IACD,CAFc,CAAf;EAGD;;EAED1C,OAAO,CAACV,KAAD,EAAW;IAChB,KAAKiD,QAAL,GAAgB,IAAhB;;IACA,KAAKC,QAAL,CAAclD,KAAd;EACD;;AAdW"} \ No newline at end of file +{"version":3,"names":["synchronize","gen","gensync","sync","genTrue","makeWeakCache","handler","makeCachedFunction","WeakMap","makeWeakCacheSync","makeStrongCache","Map","makeStrongCacheSync","CallCache","callCacheSync","callCacheAsync","futureCache","cachedFunction","arg","data","asyncContext","isAsync","callCache","cached","getCachedValueOrWait","valid","value","cache","CacheConfigurator","handlerResult","finishLock","isIterableIterator","onFirstPause","setupAsyncLocks","updateFunctionCache","delete","release","getCachedValue","cachedValue","get","waitFor","promise","config","Lock","configured","forever","deactivate","mode","set","validator","push","constructor","_active","_never","_forever","_invalidate","_configured","_pairs","_data","simple","makeSimpleConfigurator","Error","never","using","key","fn","maybeAsync","isThenable","then","invalidate","pairs","cacheFn","val","assertSimpleType","cb","released","_resolve","Promise","resolve"],"sources":["../../src/config/caching.ts"],"sourcesContent":["import gensync from \"gensync\";\nimport type { Handler } from \"gensync\";\nimport {\n maybeAsync,\n isAsync,\n onFirstPause,\n waitFor,\n isThenable,\n} from \"../gensync-utils/async\";\nimport { isIterableIterator } from \"./util\";\n\nexport type { CacheConfigurator };\n\nexport type SimpleCacheConfigurator = {\n (forever: boolean): void;\n (handler: () => T): T;\n\n forever: () => void;\n never: () => void;\n using: (handler: () => T) => T;\n invalidate: (handler: () => T) => T;\n};\n\nexport type CacheEntry = Array<{\n value: ResultT;\n valid: (channel: SideChannel) => Handler;\n}>;\n\nconst synchronize = (\n gen: (...args: ArgsT) => Handler,\n): ((...args: ArgsT) => ResultT) => {\n return gensync(gen).sync;\n};\n\n// eslint-disable-next-line require-yield\nfunction* genTrue() {\n return true;\n}\n\nexport function makeWeakCache(\n handler: (\n arg: ArgT,\n cache: CacheConfigurator,\n ) => Handler | ResultT,\n): (arg: ArgT, data: SideChannel) => Handler {\n return makeCachedFunction(WeakMap, handler);\n}\n\nexport function makeWeakCacheSync(\n handler: (arg: ArgT, cache?: CacheConfigurator) => ResultT,\n): (arg: ArgT, data?: SideChannel) => ResultT {\n return synchronize<[ArgT, SideChannel], ResultT>(\n makeWeakCache(handler),\n );\n}\n\nexport function makeStrongCache(\n handler: (\n arg: ArgT,\n cache: CacheConfigurator,\n ) => Handler | ResultT,\n): (arg: ArgT, data: SideChannel) => Handler {\n return makeCachedFunction(Map, handler);\n}\n\nexport function makeStrongCacheSync(\n handler: (arg: ArgT, cache?: CacheConfigurator) => ResultT,\n): (arg: ArgT, data?: SideChannel) => ResultT {\n return synchronize<[ArgT, SideChannel], ResultT>(\n makeStrongCache(handler),\n );\n}\n\n/* NOTE: Part of the logic explained in this comment is explained in the\n * getCachedValueOrWait and setupAsyncLocks functions.\n *\n * > There are only two hard things in Computer Science: cache invalidation and naming things.\n * > -- Phil Karlton\n *\n * I don't know if Phil was also thinking about handling a cache whose invalidation function is\n * defined asynchronously is considered, but it is REALLY hard to do correctly.\n *\n * The implemented logic (only when gensync is run asynchronously) is the following:\n * 1. If there is a valid cache associated to the current \"arg\" parameter,\n * a. RETURN the cached value\n * 3. If there is a FinishLock associated to the current \"arg\" parameter representing a valid cache,\n * a. Wait for that lock to be released\n * b. RETURN the value associated with that lock\n * 5. Start executing the function to be cached\n * a. If it pauses on a promise, then\n * i. Let FinishLock be a new lock\n * ii. Store FinishLock as associated to the current \"arg\" parameter\n * iii. Wait for the function to finish executing\n * iv. Release FinishLock\n * v. Send the function result to anyone waiting on FinishLock\n * 6. Store the result in the cache\n * 7. RETURN the result\n */\nfunction makeCachedFunction(\n CallCache: new () => CacheMap,\n handler: (\n arg: ArgT,\n cache: CacheConfigurator,\n ) => Handler | ResultT,\n): (arg: ArgT, data: SideChannel) => Handler {\n const callCacheSync = new CallCache();\n const callCacheAsync = new CallCache();\n const futureCache = new CallCache>();\n\n return function* cachedFunction(arg: ArgT, data: SideChannel) {\n const asyncContext = yield* isAsync();\n const callCache = asyncContext ? callCacheAsync : callCacheSync;\n\n const cached = yield* getCachedValueOrWait(\n asyncContext,\n callCache,\n futureCache,\n arg,\n data,\n );\n if (cached.valid) return cached.value;\n\n const cache = new CacheConfigurator(data);\n\n const handlerResult: Handler | ResultT = handler(arg, cache);\n\n let finishLock: Lock;\n let value: ResultT;\n\n if (isIterableIterator(handlerResult)) {\n value = yield* onFirstPause(handlerResult, () => {\n finishLock = setupAsyncLocks(cache, futureCache, arg);\n });\n } else {\n value = handlerResult;\n }\n\n updateFunctionCache(callCache, cache, arg, value);\n\n if (finishLock) {\n futureCache.delete(arg);\n finishLock.release(value);\n }\n\n return value;\n };\n}\n\ntype CacheMap =\n | Map>\n // @ts-expect-error todo(flow->ts): add `extends object` constraint to ArgT\n | WeakMap>;\n\nfunction* getCachedValue(\n cache: CacheMap,\n arg: ArgT,\n data: SideChannel,\n): Handler<{ valid: true; value: ResultT } | { valid: false; value: null }> {\n const cachedValue: CacheEntry | void = cache.get(arg);\n\n if (cachedValue) {\n for (const { value, valid } of cachedValue) {\n if (yield* valid(data)) return { valid: true, value };\n }\n }\n\n return { valid: false, value: null };\n}\n\nfunction* getCachedValueOrWait(\n asyncContext: boolean,\n callCache: CacheMap,\n futureCache: CacheMap, SideChannel>,\n arg: ArgT,\n data: SideChannel,\n): Handler<{ valid: true; value: ResultT } | { valid: false; value: null }> {\n const cached = yield* getCachedValue(callCache, arg, data);\n if (cached.valid) {\n return cached;\n }\n\n if (asyncContext) {\n const cached = yield* getCachedValue(futureCache, arg, data);\n if (cached.valid) {\n const value = yield* waitFor(cached.value.promise);\n return { valid: true, value };\n }\n }\n\n return { valid: false, value: null };\n}\n\nfunction setupAsyncLocks(\n config: CacheConfigurator,\n futureCache: CacheMap, SideChannel>,\n arg: ArgT,\n): Lock {\n const finishLock = new Lock();\n\n updateFunctionCache(futureCache, config, arg, finishLock);\n\n return finishLock;\n}\n\nfunction updateFunctionCache<\n ArgT,\n ResultT,\n SideChannel,\n Cache extends CacheMap,\n>(\n cache: Cache,\n config: CacheConfigurator,\n arg: ArgT,\n value: ResultT,\n) {\n if (!config.configured()) config.forever();\n\n let cachedValue: CacheEntry | void = cache.get(arg);\n\n config.deactivate();\n\n switch (config.mode()) {\n case \"forever\":\n cachedValue = [{ value, valid: genTrue }];\n cache.set(arg, cachedValue);\n break;\n case \"invalidate\":\n cachedValue = [{ value, valid: config.validator() }];\n cache.set(arg, cachedValue);\n break;\n case \"valid\":\n if (cachedValue) {\n cachedValue.push({ value, valid: config.validator() });\n } else {\n cachedValue = [{ value, valid: config.validator() }];\n cache.set(arg, cachedValue);\n }\n }\n}\n\nclass CacheConfigurator {\n _active: boolean = true;\n _never: boolean = false;\n _forever: boolean = false;\n _invalidate: boolean = false;\n\n _configured: boolean = false;\n\n _pairs: Array<\n [cachedValue: unknown, handler: (data: SideChannel) => Handler]\n > = [];\n\n _data: SideChannel;\n\n constructor(data: SideChannel) {\n this._data = data;\n }\n\n simple() {\n return makeSimpleConfigurator(this);\n }\n\n mode() {\n if (this._never) return \"never\";\n if (this._forever) return \"forever\";\n if (this._invalidate) return \"invalidate\";\n return \"valid\";\n }\n\n forever() {\n if (!this._active) {\n throw new Error(\"Cannot change caching after evaluation has completed.\");\n }\n if (this._never) {\n throw new Error(\"Caching has already been configured with .never()\");\n }\n this._forever = true;\n this._configured = true;\n }\n\n never() {\n if (!this._active) {\n throw new Error(\"Cannot change caching after evaluation has completed.\");\n }\n if (this._forever) {\n throw new Error(\"Caching has already been configured with .forever()\");\n }\n this._never = true;\n this._configured = true;\n }\n\n using(handler: (data: SideChannel) => T): T {\n if (!this._active) {\n throw new Error(\"Cannot change caching after evaluation has completed.\");\n }\n if (this._never || this._forever) {\n throw new Error(\n \"Caching has already been configured with .never or .forever()\",\n );\n }\n this._configured = true;\n\n const key = handler(this._data);\n\n const fn = maybeAsync(\n handler,\n `You appear to be using an async cache handler, but Babel has been called synchronously`,\n );\n\n if (isThenable(key)) {\n // @ts-expect-error todo(flow->ts): improve function return type annotation\n return key.then((key: unknown) => {\n this._pairs.push([key, fn]);\n return key;\n });\n }\n\n this._pairs.push([key, fn]);\n return key;\n }\n\n invalidate(handler: (data: SideChannel) => T): T {\n this._invalidate = true;\n return this.using(handler);\n }\n\n validator(): (data: SideChannel) => Handler {\n const pairs = this._pairs;\n return function* (data: SideChannel) {\n for (const [key, fn] of pairs) {\n if (key !== (yield* fn(data))) return false;\n }\n return true;\n };\n }\n\n deactivate() {\n this._active = false;\n }\n\n configured() {\n return this._configured;\n }\n}\n\nfunction makeSimpleConfigurator(\n cache: CacheConfigurator,\n): SimpleCacheConfigurator {\n function cacheFn(val: any) {\n if (typeof val === \"boolean\") {\n if (val) cache.forever();\n else cache.never();\n return;\n }\n\n return cache.using(() => assertSimpleType(val()));\n }\n cacheFn.forever = () => cache.forever();\n cacheFn.never = () => cache.never();\n cacheFn.using = (cb: { (): SimpleType }) =>\n cache.using(() => assertSimpleType(cb()));\n cacheFn.invalidate = (cb: { (): SimpleType }) =>\n cache.invalidate(() => assertSimpleType(cb()));\n\n return cacheFn as any;\n}\n\n// Types are limited here so that in the future these values can be used\n// as part of Babel's caching logic.\nexport type SimpleType =\n | string\n | boolean\n | number\n | null\n | void\n | Promise;\nexport function assertSimpleType(value: unknown): SimpleType {\n if (isThenable(value)) {\n throw new Error(\n `You appear to be using an async cache handler, ` +\n `which your current version of Babel does not support. ` +\n `We may add support for this in the future, ` +\n `but if you're on the most recent version of @babel/core and still ` +\n `seeing this error, then you'll need to synchronously handle your caching logic.`,\n );\n }\n\n if (\n value != null &&\n typeof value !== \"string\" &&\n typeof value !== \"boolean\" &&\n typeof value !== \"number\"\n ) {\n throw new Error(\n \"Cache keys must be either string, boolean, number, null, or undefined.\",\n );\n }\n // @ts-expect-error Type 'unknown' is not assignable to type 'SimpleType'. This can be removed\n // when strictNullCheck is enabled\n return value;\n}\n\nclass Lock {\n released: boolean = false;\n promise: Promise;\n _resolve: (value: T) => void;\n\n constructor() {\n this.promise = new Promise(resolve => {\n this._resolve = resolve;\n });\n }\n\n release(value: T) {\n this.released = true;\n this._resolve(value);\n }\n}\n"],"mappings":";;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AAOA;AAmBA,MAAMA,WAAW,GACfC,GAAyC,IACP;EAClC,OAAOC,UAAO,CAACD,GAAG,CAAC,CAACE,IAAI;AAC1B,CAAC;;AAGD,UAAUC,OAAO,GAAG;EAClB,OAAO,IAAI;AACb;AAEO,SAASC,aAAa,CAC3BC,OAG+B,EACqB;EACpD,OAAOC,kBAAkB,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,KAJdwB,QAAQ,GAAY,KAAK;IAAA,KACzBlC,OAAO;IAAA,KACPmC,QAAQ;IAGN,IAAI,CAACnC,OAAO,GAAG,IAAIoC,OAAO,CAACC,OAAO,IAAI;MACpC,IAAI,CAACF,QAAQ,GAAGE,OAAO;IACzB,CAAC,CAAC;EACJ;EAEA1C,OAAO,CAACV,KAAQ,EAAE;IAChB,IAAI,CAACiD,QAAQ,GAAG,IAAI;IACpB,IAAI,CAACC,QAAQ,CAAClD,KAAK,CAAC;EACtB;AACF;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/config-chain.js b/node_modules/@babel/core/lib/config/config-chain.js index 9f4d1d571..ab3ab47c2 100644 --- a/node_modules/@babel/core/lib/config/config-chain.js +++ b/node_modules/@babel/core/lib/config/config-chain.js @@ -6,45 +6,30 @@ Object.defineProperty(exports, "__esModule", { exports.buildPresetChain = buildPresetChain; exports.buildPresetChainWalker = void 0; exports.buildRootChain = buildRootChain; - function _path() { const data = require("path"); - _path = function () { return data; }; - return data; } - function _debug() { const data = require("debug"); - _debug = function () { return data; }; - return data; } - var _options = require("./validation/options"); - var _patternToRegex = require("./pattern-to-regex"); - var _printer = require("./printer"); - var _rewriteStackTrace = require("../errors/rewrite-stack-trace"); - var _configError = require("../errors/config-error"); - var _files = require("./files"); - var _caching = require("./caching"); - var _configDescriptors = require("./config-descriptors"); const debug = _debug()("babel:config:config-chain"); - function* buildPresetChain(arg, context) { const chain = yield* buildPresetChainWalker(arg, context); if (!chain) return null; @@ -55,7 +40,6 @@ function* buildPresetChain(arg, context) { files: new Set() }; } - const buildPresetChainWalker = makeChainWalker({ root: preset => loadPresetDescriptors(preset), env: (preset, envName) => loadPresetEnvDescriptors(preset)(envName), @@ -68,7 +52,6 @@ const loadPresetDescriptors = (0, _caching.makeWeakCacheSync)(preset => buildRoo const loadPresetEnvDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, envName))); const loadPresetOverridesDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(index => buildOverrideDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index))); const loadPresetOverridesEnvDescriptors = (0, _caching.makeWeakCacheSync)(preset => (0, _caching.makeStrongCacheSync)(index => (0, _caching.makeStrongCacheSync)(envName => buildOverrideEnvDescriptors(preset, preset.alias, _configDescriptors.createUncachedDescriptors, index, envName)))); - function* buildRootChain(opts, context) { let configReport, babelRcReport; const programmaticLogger = new _printer.ConfigPrinter(); @@ -79,13 +62,11 @@ function* buildRootChain(opts, context) { if (!programmaticChain) return null; const programmaticReport = yield* programmaticLogger.output(); let configFile; - if (typeof opts.configFile === "string") { configFile = yield* (0, _files.loadConfig)(opts.configFile, context.cwd, context.envName, context.caller); } else if (opts.configFile !== false) { configFile = yield* (0, _files.findRootConfig)(context.root, context.envName, context.caller); } - let { babelrc, babelrcRoots @@ -93,7 +74,6 @@ function* buildRootChain(opts, context) { let babelrcRootsDirectory = context.cwd; const configFileChain = emptyChain(); const configFileLogger = new _printer.ConfigPrinter(); - if (configFile) { const validatedFile = validateConfigFile(configFile); const result = yield* loadFileChain(validatedFile, context, undefined, configFileLogger); @@ -103,41 +83,32 @@ function* buildRootChain(opts, context) { if (babelrc === undefined) { babelrc = validatedFile.options.babelrc; } - if (babelrcRoots === undefined) { babelrcRootsDirectory = validatedFile.dirname; babelrcRoots = validatedFile.options.babelrcRoots; } - mergeChain(configFileChain, result); } - let ignoreFile, babelrcFile; let isIgnored = false; const fileChain = emptyChain(); - if ((babelrc === true || babelrc === undefined) && typeof context.filename === "string") { const pkgData = yield* (0, _files.findPackageData)(context.filename); - if (pkgData && babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)) { ({ ignore: ignoreFile, config: babelrcFile } = yield* (0, _files.findRelativeConfig)(pkgData, context.envName, context.caller)); - if (ignoreFile) { fileChain.files.add(ignoreFile.filepath); } - if (ignoreFile && shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)) { isIgnored = true; } - if (babelrcFile && !isIgnored) { const validatedFile = validateBabelrcFile(babelrcFile); const babelrcLogger = new _printer.ConfigPrinter(); const result = yield* loadFileChain(validatedFile, context, undefined, babelrcLogger); - if (!result) { isIgnored = true; } else { @@ -145,17 +116,15 @@ function* buildRootChain(opts, context) { mergeChain(fileChain, result); } } - if (babelrcFile && isIgnored) { fileChain.files.add(babelrcFile.filepath); } } } - if (context.showConfig) { - console.log(`Babel configs on "${context.filename}" (ascending priority):\n` + [configReport, babelRcReport, programmaticReport].filter(x => !!x).join("\n\n") + "\n-----End Babel configs-----"); + console.log(`Babel configs on "${context.filename}" (ascending priority):\n` + + [configReport, babelRcReport, programmaticReport].filter(x => !!x).join("\n\n") + "\n-----End Babel configs-----"); } - const chain = mergeChain(mergeChain(mergeChain(emptyChain(), configFileChain), fileChain), programmaticChain); return { plugins: isIgnored ? [] : dedupDescriptors(chain.plugins), @@ -168,7 +137,6 @@ function* buildRootChain(opts, context) { files: chain.files }; } - function babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory) { if (typeof babelrcRoots === "boolean") return babelrcRoots; const absoluteRoot = context.root; @@ -176,13 +144,10 @@ function babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirector if (babelrcRoots === undefined) { return pkgData.directories.indexOf(absoluteRoot) !== -1; } - let babelrcPatterns = babelrcRoots; - if (!Array.isArray(babelrcPatterns)) { babelrcPatterns = [babelrcPatterns]; } - babelrcPatterns = babelrcPatterns.map(pat => { return typeof pat === "string" ? _path().resolve(babelrcRootsDirectory, pat) : pat; }); @@ -190,18 +155,15 @@ function babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirector if (babelrcPatterns.length === 1 && babelrcPatterns[0] === absoluteRoot) { return pkgData.directories.indexOf(absoluteRoot) !== -1; } - return babelrcPatterns.some(pat => { if (typeof pat === "string") { pat = (0, _patternToRegex.default)(pat, babelrcRootsDirectory); } - return pkgData.directories.some(directory => { return matchPattern(pat, babelrcRootsDirectory, directory, context); }); }); } - const validateConfigFile = (0, _caching.makeWeakCacheSync)(file => ({ filepath: file.filepath, dirname: file.dirname, @@ -217,6 +179,7 @@ const validateExtendFile = (0, _caching.makeWeakCacheSync)(file => ({ dirname: file.dirname, options: (0, _options.validate)("extendsfile", file.options, file.filepath) })); + const loadProgrammaticChain = makeChainWalker({ root: input => buildRootDescriptors(input, "base", _configDescriptors.createCachedDescriptors), env: (input, envName) => buildEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, envName), @@ -224,6 +187,7 @@ const loadProgrammaticChain = makeChainWalker({ overridesEnv: (input, index, envName) => buildOverrideEnvDescriptors(input, "base", _configDescriptors.createCachedDescriptors, index, envName), createLogger: (input, context, baseLogger) => buildProgrammaticLogger(input, context, baseLogger) }); + const loadFileChainWalker = makeChainWalker({ root: file => loadFileDescriptors(file), env: (file, envName) => loadFileEnvDescriptors(file)(envName), @@ -231,51 +195,40 @@ const loadFileChainWalker = makeChainWalker({ overridesEnv: (file, index, envName) => loadFileOverridesEnvDescriptors(file)(index)(envName), createLogger: (file, context, baseLogger) => buildFileLogger(file.filepath, context, baseLogger) }); - function* loadFileChain(input, context, files, baseLogger) { const chain = yield* loadFileChainWalker(input, context, files, baseLogger); - if (chain) { chain.files.add(input.filepath); } - return chain; } - const loadFileDescriptors = (0, _caching.makeWeakCacheSync)(file => buildRootDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors)); const loadFileEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(envName => buildEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, envName))); const loadFileOverridesDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => buildOverrideDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index))); const loadFileOverridesEnvDescriptors = (0, _caching.makeWeakCacheSync)(file => (0, _caching.makeStrongCacheSync)(index => (0, _caching.makeStrongCacheSync)(envName => buildOverrideEnvDescriptors(file, file.filepath, _configDescriptors.createUncachedDescriptors, index, envName)))); - function buildFileLogger(filepath, context, baseLogger) { if (!baseLogger) { return () => {}; } - return baseLogger.configure(context.showConfig, _printer.ChainFormatter.Config, { filepath }); } - function buildRootDescriptors({ dirname, options }, alias, descriptors) { return descriptors(dirname, options, alias); } - function buildProgrammaticLogger(_, context, baseLogger) { var _context$caller; - if (!baseLogger) { return () => {}; } - return baseLogger.configure(context.showConfig, _printer.ChainFormatter.Programmatic, { callerName: (_context$caller = context.caller) == null ? void 0 : _context$caller.name }); } - function buildEnvDescriptors({ dirname, options @@ -283,7 +236,6 @@ function buildEnvDescriptors({ const opts = options.env && options.env[envName]; return opts ? descriptors(dirname, opts, `${alias}.env["${envName}"]`) : null; } - function buildOverrideDescriptors({ dirname, options @@ -292,7 +244,6 @@ function buildOverrideDescriptors({ if (!opts) throw new Error("Assertion failure - missing override"); return descriptors(dirname, opts, `${alias}.overrides[${index}]`); } - function buildOverrideEnvDescriptors({ dirname, options @@ -302,7 +253,6 @@ function buildOverrideEnvDescriptors({ const opts = override.env && override.env[envName]; return opts ? descriptors(dirname, opts, `${alias}.overrides[${index}].env["${envName}"]`) : null; } - function makeChainWalker({ root, env, @@ -316,7 +266,6 @@ function makeChainWalker({ } = input; const flattenedConfigs = []; const rootOpts = root(input); - if (configIsApplicable(rootOpts, dirname, context, input.filepath)) { flattenedConfigs.push({ config: rootOpts, @@ -324,7 +273,6 @@ function makeChainWalker({ index: undefined }); const envOpts = env(input, context.envName); - if (envOpts && configIsApplicable(envOpts, dirname, context, input.filepath)) { flattenedConfigs.push({ config: envOpts, @@ -332,10 +280,8 @@ function makeChainWalker({ index: undefined }); } - (rootOpts.options.overrides || []).forEach((_, index) => { const overrideOps = overrides(input, index); - if (configIsApplicable(overrideOps, dirname, context, input.filepath)) { flattenedConfigs.push({ config: overrideOps, @@ -343,7 +289,6 @@ function makeChainWalker({ envName: undefined }); const overrideEnvOpts = overridesEnv(input, index, context.envName); - if (overrideEnvOpts && configIsApplicable(overrideEnvOpts, dirname, context, input.filepath)) { flattenedConfigs.push({ config: overrideEnvOpts, @@ -365,10 +310,8 @@ function makeChainWalker({ }) => shouldIgnore(context, ignore, only, dirname))) { return null; } - const chain = emptyChain(); const logger = createLogger(input, context, baseLogger); - for (const { config, index, @@ -377,23 +320,18 @@ function makeChainWalker({ if (!(yield* mergeExtendsChain(chain, config.options, dirname, context, files, baseLogger))) { return null; } - logger(config, index, envName); yield* mergeChainOpts(chain, config); } - return chain; }; } - function* mergeExtendsChain(chain, opts, dirname, context, files, baseLogger) { if (opts.extends === undefined) return true; const file = yield* (0, _files.loadConfig)(opts.extends, dirname, context.envName, context.caller); - if (files.has(file)) { throw new Error(`Configuration cycle detected loading ${file.filepath}.\n` + `File already loaded following the config chain:\n` + Array.from(files, file => ` - ${file.filepath}`).join("\n")); } - files.add(file); const fileChain = yield* loadFileChain(validateExtendFile(file), context, files, baseLogger); files.delete(file); @@ -401,19 +339,15 @@ function* mergeExtendsChain(chain, opts, dirname, context, files, baseLogger) { mergeChain(chain, fileChain); return true; } - function mergeChain(target, source) { target.options.push(...source.options); target.plugins.push(...source.plugins); target.presets.push(...source.presets); - for (const file of source.files) { target.files.add(file); } - return target; } - function* mergeChainOpts(target, { options, plugins, @@ -424,7 +358,6 @@ function* mergeChainOpts(target, { target.presets.push(...(yield* presets())); return target; } - function emptyChain() { return { options: [], @@ -433,7 +366,6 @@ function emptyChain() { files: new Set() }; } - function normalizeOptions(opts) { const options = Object.assign({}, opts); delete options.extends; @@ -452,31 +384,26 @@ function normalizeOptions(opts) { options.sourceMaps = options.sourceMap; delete options.sourceMap; } - return options; } - function dedupDescriptors(items) { const map = new Map(); const descriptors = []; - for (const item of items) { if (typeof item.value === "function") { const fnKey = item.value; let nameMap = map.get(fnKey); - if (!nameMap) { nameMap = new Map(); map.set(fnKey, nameMap); } - let desc = nameMap.get(item.name); - if (!desc) { desc = { value: item }; descriptors.push(desc); + if (!item.ownPass) nameMap.set(item.name, desc); } else { desc.value = item; @@ -487,19 +414,16 @@ function dedupDescriptors(items) { }); } } - return descriptors.reduce((acc, desc) => { acc.push(desc.value); return acc; }, []); } - function configIsApplicable({ options }, dirname, context, configName) { return (options.test === undefined || configFieldIsApplicable(context, options.test, dirname, configName)) && (options.include === undefined || configFieldIsApplicable(context, options.include, dirname, configName)) && (options.exclude === undefined || !configFieldIsApplicable(context, options.exclude, dirname, configName)); } - function configFieldIsApplicable(context, test, dirname, configName) { const patterns = Array.isArray(test) ? test : [test]; return matchesPatterns(context, patterns, dirname, configName); @@ -509,44 +433,34 @@ function ignoreListReplacer(_key, value) { if (value instanceof RegExp) { return String(value); } - return value; } function shouldIgnore(context, ignore, only, dirname) { if (ignore && matchesPatterns(context, ignore, dirname)) { var _context$filename; - const message = `No config is applied to "${(_context$filename = context.filename) != null ? _context$filename : "(unknown)"}" because it matches one of \`ignore: ${JSON.stringify(ignore, ignoreListReplacer)}\` from "${dirname}"`; debug(message); - if (context.showConfig) { console.log(message); } - return true; } - if (only && !matchesPatterns(context, only, dirname)) { var _context$filename2; - const message = `No config is applied to "${(_context$filename2 = context.filename) != null ? _context$filename2 : "(unknown)"}" because it fails to match one of \`only: ${JSON.stringify(only, ignoreListReplacer)}\` from "${dirname}"`; debug(message); - if (context.showConfig) { console.log(message); } - return true; } - return false; } function matchesPatterns(context, patterns, dirname, configName) { return patterns.some(pattern => matchPattern(pattern, dirname, context.filename, context, configName)); } - function matchPattern(pattern, dirname, pathToTest, context, configName) { if (typeof pattern === "function") { return !!(0, _rewriteStackTrace.endHiddenCallStack)(pattern)(pathToTest, { @@ -555,18 +469,14 @@ function matchPattern(pattern, dirname, pathToTest, context, configName) { caller: context.caller }); } - if (typeof pathToTest !== "string") { throw new _configError.default(`Configuration contains string/RegExp pattern, but no filename was passed to Babel`, configName); } - if (typeof pattern === "string") { pattern = (0, _patternToRegex.default)(pattern, dirname); } - return pattern.test(pathToTest); } - 0 && 0; //# sourceMappingURL=config-chain.js.map diff --git a/node_modules/@babel/core/lib/config/config-chain.js.map b/node_modules/@babel/core/lib/config/config-chain.js.map index f211c7a5c..52a17cf29 100644 --- a/node_modules/@babel/core/lib/config/config-chain.js.map +++ b/node_modules/@babel/core/lib/config/config-chain.js.map @@ -1 +1 @@ -{"version":3,"names":["debug","buildDebug","buildPresetChain","arg","context","chain","buildPresetChainWalker","plugins","dedupDescriptors","presets","options","map","o","normalizeOptions","files","Set","makeChainWalker","root","preset","loadPresetDescriptors","env","envName","loadPresetEnvDescriptors","overrides","index","loadPresetOverridesDescriptors","overridesEnv","loadPresetOverridesEnvDescriptors","createLogger","makeWeakCacheSync","buildRootDescriptors","alias","createUncachedDescriptors","makeStrongCacheSync","buildEnvDescriptors","buildOverrideDescriptors","buildOverrideEnvDescriptors","buildRootChain","opts","configReport","babelRcReport","programmaticLogger","ConfigPrinter","programmaticChain","loadProgrammaticChain","dirname","cwd","undefined","programmaticReport","output","configFile","loadConfig","caller","findRootConfig","babelrc","babelrcRoots","babelrcRootsDirectory","configFileChain","emptyChain","configFileLogger","validatedFile","validateConfigFile","result","loadFileChain","mergeChain","ignoreFile","babelrcFile","isIgnored","fileChain","filename","pkgData","findPackageData","babelrcLoadEnabled","ignore","config","findRelativeConfig","add","filepath","shouldIgnore","validateBabelrcFile","babelrcLogger","showConfig","console","log","filter","x","join","fileHandling","absoluteRoot","directories","indexOf","babelrcPatterns","Array","isArray","pat","path","resolve","length","some","pathPatternToRegex","directory","matchPattern","file","validate","validateExtendFile","input","createCachedDescriptors","baseLogger","buildProgrammaticLogger","loadFileChainWalker","loadFileDescriptors","loadFileEnvDescriptors","loadFileOverridesDescriptors","loadFileOverridesEnvDescriptors","buildFileLogger","configure","ChainFormatter","Config","descriptors","_","Programmatic","callerName","name","Error","override","chainWalker","flattenedConfigs","rootOpts","configIsApplicable","push","envOpts","forEach","overrideOps","overrideEnvOpts","only","logger","mergeExtendsChain","mergeChainOpts","extends","has","from","delete","target","source","passPerPreset","test","include","exclude","Object","prototype","hasOwnProperty","call","sourceMaps","sourceMap","items","Map","item","value","fnKey","nameMap","get","set","desc","ownPass","reduce","acc","configName","configFieldIsApplicable","patterns","matchesPatterns","ignoreListReplacer","_key","RegExp","String","message","JSON","stringify","pattern","pathToTest","endHiddenCallStack","ConfigError"],"sources":["../../src/config/config-chain.ts"],"sourcesContent":["import path from \"path\";\nimport buildDebug from \"debug\";\nimport type { Handler } from \"gensync\";\nimport { validate } from \"./validation/options\";\nimport type {\n ValidatedOptions,\n IgnoreList,\n ConfigApplicableTest,\n BabelrcSearch,\n CallerMetadata,\n IgnoreItem,\n} from \"./validation/options\";\nimport pathPatternToRegex from \"./pattern-to-regex\";\nimport { ConfigPrinter, ChainFormatter } from \"./printer\";\nimport type { ReadonlyDeepArray } from \"./helpers/deep-array\";\n\nimport { endHiddenCallStack } from \"../errors/rewrite-stack-trace\";\nimport ConfigError from \"../errors/config-error\";\n\nconst debug = buildDebug(\"babel:config:config-chain\");\n\nimport {\n findPackageData,\n findRelativeConfig,\n findRootConfig,\n loadConfig,\n} from \"./files\";\nimport type { ConfigFile, IgnoreFile, FilePackageData } from \"./files\";\n\nimport { makeWeakCacheSync, makeStrongCacheSync } from \"./caching\";\n\nimport {\n createCachedDescriptors,\n createUncachedDescriptors,\n} from \"./config-descriptors\";\nimport type {\n UnloadedDescriptor,\n OptionsAndDescriptors,\n ValidatedFile,\n} from \"./config-descriptors\";\n\nexport type ConfigChain = {\n plugins: Array;\n presets: Array;\n options: Array;\n files: Set;\n};\n\nexport type PresetInstance = {\n options: ValidatedOptions;\n alias: string;\n dirname: string;\n externalDependencies: ReadonlyDeepArray;\n};\n\nexport type ConfigContext = {\n filename: string | undefined;\n cwd: string;\n root: string;\n envName: string;\n caller: CallerMetadata | undefined;\n showConfig: boolean;\n};\n\n/**\n * Build a config chain for a given preset.\n */\nexport function* buildPresetChain(\n arg: PresetInstance,\n context: any,\n): Handler {\n const chain = yield* buildPresetChainWalker(arg, context);\n if (!chain) return null;\n\n return {\n plugins: dedupDescriptors(chain.plugins),\n presets: dedupDescriptors(chain.presets),\n options: chain.options.map(o => normalizeOptions(o)),\n files: new Set(),\n };\n}\n\nexport const buildPresetChainWalker = makeChainWalker({\n root: preset => loadPresetDescriptors(preset),\n env: (preset, envName) => loadPresetEnvDescriptors(preset)(envName),\n overrides: (preset, index) => loadPresetOverridesDescriptors(preset)(index),\n overridesEnv: (preset, index, envName) =>\n loadPresetOverridesEnvDescriptors(preset)(index)(envName),\n createLogger: () => () => {}, // Currently we don't support logging how preset is expanded\n});\nconst loadPresetDescriptors = makeWeakCacheSync((preset: PresetInstance) =>\n buildRootDescriptors(preset, preset.alias, createUncachedDescriptors),\n);\nconst loadPresetEnvDescriptors = makeWeakCacheSync((preset: PresetInstance) =>\n makeStrongCacheSync((envName: string) =>\n buildEnvDescriptors(\n preset,\n preset.alias,\n createUncachedDescriptors,\n envName,\n ),\n ),\n);\nconst loadPresetOverridesDescriptors = makeWeakCacheSync(\n (preset: PresetInstance) =>\n makeStrongCacheSync((index: number) =>\n buildOverrideDescriptors(\n preset,\n preset.alias,\n createUncachedDescriptors,\n index,\n ),\n ),\n);\nconst loadPresetOverridesEnvDescriptors = makeWeakCacheSync(\n (preset: PresetInstance) =>\n makeStrongCacheSync((index: number) =>\n makeStrongCacheSync((envName: string) =>\n buildOverrideEnvDescriptors(\n preset,\n preset.alias,\n createUncachedDescriptors,\n index,\n envName,\n ),\n ),\n ),\n);\n\nexport type FileHandling = \"transpile\" | \"ignored\" | \"unsupported\";\nexport type RootConfigChain = ConfigChain & {\n babelrc: ConfigFile | void;\n config: ConfigFile | void;\n ignore: IgnoreFile | void;\n fileHandling: FileHandling;\n files: Set;\n};\n\n/**\n * Build a config chain for Babel's full root configuration.\n */\nexport function* buildRootChain(\n opts: ValidatedOptions,\n context: ConfigContext,\n): Handler {\n let configReport, babelRcReport;\n const programmaticLogger = new ConfigPrinter();\n const programmaticChain = yield* loadProgrammaticChain(\n {\n options: opts,\n dirname: context.cwd,\n },\n context,\n undefined,\n programmaticLogger,\n );\n if (!programmaticChain) return null;\n const programmaticReport = yield* programmaticLogger.output();\n\n let configFile;\n if (typeof opts.configFile === \"string\") {\n configFile = yield* loadConfig(\n opts.configFile,\n context.cwd,\n context.envName,\n context.caller,\n );\n } else if (opts.configFile !== false) {\n configFile = yield* findRootConfig(\n context.root,\n context.envName,\n context.caller,\n );\n }\n\n let { babelrc, babelrcRoots } = opts;\n let babelrcRootsDirectory = context.cwd;\n\n const configFileChain = emptyChain();\n const configFileLogger = new ConfigPrinter();\n if (configFile) {\n const validatedFile = validateConfigFile(configFile);\n const result = yield* loadFileChain(\n validatedFile,\n context,\n undefined,\n configFileLogger,\n );\n if (!result) return null;\n configReport = yield* configFileLogger.output();\n\n // Allow config files to toggle `.babelrc` resolution on and off and\n // specify where the roots are.\n if (babelrc === undefined) {\n babelrc = validatedFile.options.babelrc;\n }\n if (babelrcRoots === undefined) {\n babelrcRootsDirectory = validatedFile.dirname;\n babelrcRoots = validatedFile.options.babelrcRoots;\n }\n\n mergeChain(configFileChain, result);\n }\n\n let ignoreFile, babelrcFile;\n let isIgnored = false;\n const fileChain = emptyChain();\n // resolve all .babelrc files\n if (\n (babelrc === true || babelrc === undefined) &&\n typeof context.filename === \"string\"\n ) {\n const pkgData = yield* findPackageData(context.filename);\n\n if (\n pkgData &&\n babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)\n ) {\n ({ ignore: ignoreFile, config: babelrcFile } = yield* findRelativeConfig(\n pkgData,\n context.envName,\n context.caller,\n ));\n\n if (ignoreFile) {\n fileChain.files.add(ignoreFile.filepath);\n }\n\n if (\n ignoreFile &&\n shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)\n ) {\n isIgnored = true;\n }\n\n if (babelrcFile && !isIgnored) {\n const validatedFile = validateBabelrcFile(babelrcFile);\n const babelrcLogger = new ConfigPrinter();\n const result = yield* loadFileChain(\n validatedFile,\n context,\n undefined,\n babelrcLogger,\n );\n if (!result) {\n isIgnored = true;\n } else {\n babelRcReport = yield* babelrcLogger.output();\n mergeChain(fileChain, result);\n }\n }\n\n if (babelrcFile && isIgnored) {\n fileChain.files.add(babelrcFile.filepath);\n }\n }\n }\n\n if (context.showConfig) {\n console.log(\n `Babel configs on \"${context.filename}\" (ascending priority):\\n` +\n // print config by the order of ascending priority\n [configReport, babelRcReport, programmaticReport]\n .filter(x => !!x)\n .join(\"\\n\\n\") +\n \"\\n-----End Babel configs-----\",\n );\n }\n // Insert file chain in front so programmatic options have priority\n // over configuration file chain items.\n const chain = mergeChain(\n mergeChain(mergeChain(emptyChain(), configFileChain), fileChain),\n programmaticChain,\n );\n\n return {\n plugins: isIgnored ? [] : dedupDescriptors(chain.plugins),\n presets: isIgnored ? [] : dedupDescriptors(chain.presets),\n options: isIgnored ? [] : chain.options.map(o => normalizeOptions(o)),\n fileHandling: isIgnored ? \"ignored\" : \"transpile\",\n ignore: ignoreFile || undefined,\n babelrc: babelrcFile || undefined,\n config: configFile || undefined,\n files: chain.files,\n };\n}\n\nfunction babelrcLoadEnabled(\n context: ConfigContext,\n pkgData: FilePackageData,\n babelrcRoots: BabelrcSearch | undefined,\n babelrcRootsDirectory: string,\n): boolean {\n if (typeof babelrcRoots === \"boolean\") return babelrcRoots;\n\n const absoluteRoot = context.root;\n\n // Fast path to avoid having to match patterns if the babelrc is just\n // loading in the standard root directory.\n if (babelrcRoots === undefined) {\n return pkgData.directories.indexOf(absoluteRoot) !== -1;\n }\n\n let babelrcPatterns = babelrcRoots;\n if (!Array.isArray(babelrcPatterns)) {\n babelrcPatterns = [babelrcPatterns as IgnoreItem];\n }\n babelrcPatterns = babelrcPatterns.map(pat => {\n return typeof pat === \"string\"\n ? path.resolve(babelrcRootsDirectory, pat)\n : pat;\n });\n\n // Fast path to avoid having to match patterns if the babelrc is just\n // loading in the standard root directory.\n if (babelrcPatterns.length === 1 && babelrcPatterns[0] === absoluteRoot) {\n return pkgData.directories.indexOf(absoluteRoot) !== -1;\n }\n\n return babelrcPatterns.some(pat => {\n if (typeof pat === \"string\") {\n pat = pathPatternToRegex(pat, babelrcRootsDirectory);\n }\n\n return pkgData.directories.some(directory => {\n return matchPattern(pat, babelrcRootsDirectory, directory, context);\n });\n });\n}\n\nconst validateConfigFile = makeWeakCacheSync(\n (file: ConfigFile): ValidatedFile => ({\n filepath: file.filepath,\n dirname: file.dirname,\n options: validate(\"configfile\", file.options, file.filepath),\n }),\n);\n\nconst validateBabelrcFile = makeWeakCacheSync(\n (file: ConfigFile): ValidatedFile => ({\n filepath: file.filepath,\n dirname: file.dirname,\n options: validate(\"babelrcfile\", file.options, file.filepath),\n }),\n);\n\nconst validateExtendFile = makeWeakCacheSync(\n (file: ConfigFile): ValidatedFile => ({\n filepath: file.filepath,\n dirname: file.dirname,\n options: validate(\"extendsfile\", file.options, file.filepath),\n }),\n);\n\n/**\n * Build a config chain for just the programmatic options passed into Babel.\n */\nconst loadProgrammaticChain = makeChainWalker({\n root: input => buildRootDescriptors(input, \"base\", createCachedDescriptors),\n env: (input, envName) =>\n buildEnvDescriptors(input, \"base\", createCachedDescriptors, envName),\n overrides: (input, index) =>\n buildOverrideDescriptors(input, \"base\", createCachedDescriptors, index),\n overridesEnv: (input, index, envName) =>\n buildOverrideEnvDescriptors(\n input,\n \"base\",\n createCachedDescriptors,\n index,\n envName,\n ),\n createLogger: (input, context, baseLogger) =>\n buildProgrammaticLogger(input, context, baseLogger),\n});\n\n/**\n * Build a config chain for a given file.\n */\nconst loadFileChainWalker = makeChainWalker({\n root: file => loadFileDescriptors(file),\n env: (file, envName) => loadFileEnvDescriptors(file)(envName),\n overrides: (file, index) => loadFileOverridesDescriptors(file)(index),\n overridesEnv: (file, index, envName) =>\n loadFileOverridesEnvDescriptors(file)(index)(envName),\n createLogger: (file, context, baseLogger) =>\n buildFileLogger(file.filepath, context, baseLogger),\n});\n\nfunction* loadFileChain(\n input: ValidatedFile,\n context: ConfigContext,\n files: Set,\n baseLogger: ConfigPrinter,\n) {\n const chain = yield* loadFileChainWalker(input, context, files, baseLogger);\n if (chain) {\n chain.files.add(input.filepath);\n }\n\n return chain;\n}\n\nconst loadFileDescriptors = makeWeakCacheSync((file: ValidatedFile) =>\n buildRootDescriptors(file, file.filepath, createUncachedDescriptors),\n);\nconst loadFileEnvDescriptors = makeWeakCacheSync((file: ValidatedFile) =>\n makeStrongCacheSync((envName: string) =>\n buildEnvDescriptors(\n file,\n file.filepath,\n createUncachedDescriptors,\n envName,\n ),\n ),\n);\nconst loadFileOverridesDescriptors = makeWeakCacheSync((file: ValidatedFile) =>\n makeStrongCacheSync((index: number) =>\n buildOverrideDescriptors(\n file,\n file.filepath,\n createUncachedDescriptors,\n index,\n ),\n ),\n);\nconst loadFileOverridesEnvDescriptors = makeWeakCacheSync(\n (file: ValidatedFile) =>\n makeStrongCacheSync((index: number) =>\n makeStrongCacheSync((envName: string) =>\n buildOverrideEnvDescriptors(\n file,\n file.filepath,\n createUncachedDescriptors,\n index,\n envName,\n ),\n ),\n ),\n);\n\nfunction buildFileLogger(\n filepath: string,\n context: ConfigContext,\n baseLogger: ConfigPrinter | void,\n) {\n if (!baseLogger) {\n return () => {};\n }\n return baseLogger.configure(context.showConfig, ChainFormatter.Config, {\n filepath,\n });\n}\n\nfunction buildRootDescriptors(\n { dirname, options }: Partial,\n alias: string,\n descriptors: (\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n ) => OptionsAndDescriptors,\n) {\n return descriptors(dirname, options, alias);\n}\n\nfunction buildProgrammaticLogger(\n _: unknown,\n context: ConfigContext,\n baseLogger: ConfigPrinter | void,\n) {\n if (!baseLogger) {\n return () => {};\n }\n return baseLogger.configure(context.showConfig, ChainFormatter.Programmatic, {\n callerName: context.caller?.name,\n });\n}\n\nfunction buildEnvDescriptors(\n { dirname, options }: Partial,\n alias: string,\n descriptors: (\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n ) => OptionsAndDescriptors,\n envName: string,\n) {\n const opts = options.env && options.env[envName];\n return opts ? descriptors(dirname, opts, `${alias}.env[\"${envName}\"]`) : null;\n}\n\nfunction buildOverrideDescriptors(\n { dirname, options }: Partial,\n alias: string,\n descriptors: (\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n ) => OptionsAndDescriptors,\n index: number,\n) {\n const opts = options.overrides && options.overrides[index];\n if (!opts) throw new Error(\"Assertion failure - missing override\");\n\n return descriptors(dirname, opts, `${alias}.overrides[${index}]`);\n}\n\nfunction buildOverrideEnvDescriptors(\n { dirname, options }: Partial,\n alias: string,\n descriptors: (\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n ) => OptionsAndDescriptors,\n index: number,\n envName: string,\n) {\n const override = options.overrides && options.overrides[index];\n if (!override) throw new Error(\"Assertion failure - missing override\");\n\n const opts = override.env && override.env[envName];\n return opts\n ? descriptors(\n dirname,\n opts,\n `${alias}.overrides[${index}].env[\"${envName}\"]`,\n )\n : null;\n}\n\nfunction makeChainWalker<\n ArgT extends {\n options: ValidatedOptions;\n dirname: string;\n filepath?: string;\n },\n>({\n root,\n env,\n overrides,\n overridesEnv,\n createLogger,\n}: {\n root: (configEntry: ArgT) => OptionsAndDescriptors;\n env: (configEntry: ArgT, env: string) => OptionsAndDescriptors | null;\n overrides: (configEntry: ArgT, index: number) => OptionsAndDescriptors;\n overridesEnv: (\n configEntry: ArgT,\n index: number,\n env: string,\n ) => OptionsAndDescriptors | null;\n createLogger: (\n configEntry: ArgT,\n context: ConfigContext,\n printer: ConfigPrinter | void,\n ) => (\n opts: OptionsAndDescriptors,\n index?: number | null,\n env?: string | null,\n ) => void;\n}): (\n configEntry: ArgT,\n context: ConfigContext,\n files?: Set,\n baseLogger?: ConfigPrinter,\n) => Handler {\n return function* chainWalker(input, context, files = new Set(), baseLogger) {\n const { dirname } = input;\n\n const flattenedConfigs: Array<{\n config: OptionsAndDescriptors;\n index: number | undefined | null;\n envName: string | undefined | null;\n }> = [];\n\n const rootOpts = root(input);\n if (configIsApplicable(rootOpts, dirname, context, input.filepath)) {\n flattenedConfigs.push({\n config: rootOpts,\n envName: undefined,\n index: undefined,\n });\n\n const envOpts = env(input, context.envName);\n if (\n envOpts &&\n configIsApplicable(envOpts, dirname, context, input.filepath)\n ) {\n flattenedConfigs.push({\n config: envOpts,\n envName: context.envName,\n index: undefined,\n });\n }\n\n (rootOpts.options.overrides || []).forEach((_, index) => {\n const overrideOps = overrides(input, index);\n if (configIsApplicable(overrideOps, dirname, context, input.filepath)) {\n flattenedConfigs.push({\n config: overrideOps,\n index,\n envName: undefined,\n });\n\n const overrideEnvOpts = overridesEnv(input, index, context.envName);\n if (\n overrideEnvOpts &&\n configIsApplicable(\n overrideEnvOpts,\n dirname,\n context,\n input.filepath,\n )\n ) {\n flattenedConfigs.push({\n config: overrideEnvOpts,\n index,\n envName: context.envName,\n });\n }\n }\n });\n }\n\n // Process 'ignore' and 'only' before 'extends' items are processed so\n // that we don't do extra work loading extended configs if a file is\n // ignored.\n if (\n flattenedConfigs.some(\n ({\n config: {\n options: { ignore, only },\n },\n }) => shouldIgnore(context, ignore, only, dirname),\n )\n ) {\n return null;\n }\n\n const chain = emptyChain();\n const logger = createLogger(input, context, baseLogger);\n\n for (const { config, index, envName } of flattenedConfigs) {\n if (\n !(yield* mergeExtendsChain(\n chain,\n config.options,\n dirname,\n context,\n files,\n baseLogger,\n ))\n ) {\n return null;\n }\n\n logger(config, index, envName);\n yield* mergeChainOpts(chain, config);\n }\n return chain;\n };\n}\n\nfunction* mergeExtendsChain(\n chain: ConfigChain,\n opts: ValidatedOptions,\n dirname: string,\n context: ConfigContext,\n files: Set,\n baseLogger?: ConfigPrinter,\n): Handler {\n if (opts.extends === undefined) return true;\n\n const file = yield* loadConfig(\n opts.extends,\n dirname,\n context.envName,\n context.caller,\n );\n\n if (files.has(file)) {\n throw new Error(\n `Configuration cycle detected loading ${file.filepath}.\\n` +\n `File already loaded following the config chain:\\n` +\n Array.from(files, file => ` - ${file.filepath}`).join(\"\\n\"),\n );\n }\n\n files.add(file);\n const fileChain = yield* loadFileChain(\n validateExtendFile(file),\n context,\n files,\n baseLogger,\n );\n files.delete(file);\n\n if (!fileChain) return false;\n\n mergeChain(chain, fileChain);\n\n return true;\n}\n\nfunction mergeChain(target: ConfigChain, source: ConfigChain): ConfigChain {\n target.options.push(...source.options);\n target.plugins.push(...source.plugins);\n target.presets.push(...source.presets);\n for (const file of source.files) {\n target.files.add(file);\n }\n\n return target;\n}\n\nfunction* mergeChainOpts(\n target: ConfigChain,\n { options, plugins, presets }: OptionsAndDescriptors,\n): Handler {\n target.options.push(options);\n target.plugins.push(...(yield* plugins()));\n target.presets.push(...(yield* presets()));\n\n return target;\n}\n\nfunction emptyChain(): ConfigChain {\n return {\n options: [],\n presets: [],\n plugins: [],\n files: new Set(),\n };\n}\n\nfunction normalizeOptions(opts: ValidatedOptions): ValidatedOptions {\n const options = {\n ...opts,\n };\n delete options.extends;\n delete options.env;\n delete options.overrides;\n delete options.plugins;\n delete options.presets;\n delete options.passPerPreset;\n delete options.ignore;\n delete options.only;\n delete options.test;\n delete options.include;\n delete options.exclude;\n\n // \"sourceMap\" is just aliased to sourceMap, so copy it over as\n // we merge the options together.\n if (Object.prototype.hasOwnProperty.call(options, \"sourceMap\")) {\n options.sourceMaps = options.sourceMap;\n delete options.sourceMap;\n }\n return options;\n}\n\nfunction dedupDescriptors(\n items: Array,\n): Array {\n const map: Map<\n Function,\n Map\n > = new Map();\n\n const descriptors = [];\n\n for (const item of items) {\n if (typeof item.value === \"function\") {\n const fnKey = item.value;\n let nameMap = map.get(fnKey);\n if (!nameMap) {\n nameMap = new Map();\n map.set(fnKey, nameMap);\n }\n let desc = nameMap.get(item.name);\n if (!desc) {\n desc = { value: item };\n descriptors.push(desc);\n\n // Treat passPerPreset presets as unique, skipping them\n // in the merge processing steps.\n if (!item.ownPass) nameMap.set(item.name, desc);\n } else {\n desc.value = item;\n }\n } else {\n descriptors.push({ value: item });\n }\n }\n\n return descriptors.reduce((acc, desc) => {\n acc.push(desc.value);\n return acc;\n }, []);\n}\n\nfunction configIsApplicable(\n { options }: OptionsAndDescriptors,\n dirname: string,\n context: ConfigContext,\n configName: string,\n): boolean {\n return (\n (options.test === undefined ||\n configFieldIsApplicable(context, options.test, dirname, configName)) &&\n (options.include === undefined ||\n configFieldIsApplicable(context, options.include, dirname, configName)) &&\n (options.exclude === undefined ||\n !configFieldIsApplicable(context, options.exclude, dirname, configName))\n );\n}\n\nfunction configFieldIsApplicable(\n context: ConfigContext,\n test: ConfigApplicableTest,\n dirname: string,\n configName: string,\n): boolean {\n const patterns = Array.isArray(test) ? test : [test];\n\n return matchesPatterns(context, patterns, dirname, configName);\n}\n\n/**\n * Print the ignoreList-values in a more helpful way than the default.\n */\nfunction ignoreListReplacer(\n _key: string,\n value: IgnoreList | IgnoreItem,\n): IgnoreList | IgnoreItem | string {\n if (value instanceof RegExp) {\n return String(value);\n }\n\n return value;\n}\n\n/**\n * Tests if a filename should be ignored based on \"ignore\" and \"only\" options.\n */\nfunction shouldIgnore(\n context: ConfigContext,\n ignore: IgnoreList | undefined | null,\n only: IgnoreList | undefined | null,\n dirname: string,\n): boolean {\n if (ignore && matchesPatterns(context, ignore, dirname)) {\n const message = `No config is applied to \"${\n context.filename ?? \"(unknown)\"\n }\" because it matches one of \\`ignore: ${JSON.stringify(\n ignore,\n ignoreListReplacer,\n )}\\` from \"${dirname}\"`;\n debug(message);\n if (context.showConfig) {\n console.log(message);\n }\n return true;\n }\n\n if (only && !matchesPatterns(context, only, dirname)) {\n const message = `No config is applied to \"${\n context.filename ?? \"(unknown)\"\n }\" because it fails to match one of \\`only: ${JSON.stringify(\n only,\n ignoreListReplacer,\n )}\\` from \"${dirname}\"`;\n debug(message);\n if (context.showConfig) {\n console.log(message);\n }\n return true;\n }\n\n return false;\n}\n\n/**\n * Returns result of calling function with filename if pattern is a function.\n * Otherwise returns result of matching pattern Regex with filename.\n */\nfunction matchesPatterns(\n context: ConfigContext,\n patterns: IgnoreList,\n dirname: string,\n configName?: string,\n): boolean {\n return patterns.some(pattern =>\n matchPattern(pattern, dirname, context.filename, context, configName),\n );\n}\n\nfunction matchPattern(\n pattern: IgnoreItem,\n dirname: string,\n pathToTest: string | undefined,\n context: ConfigContext,\n configName?: string,\n): boolean {\n if (typeof pattern === \"function\") {\n return !!endHiddenCallStack(pattern)(pathToTest, {\n dirname,\n envName: context.envName,\n caller: context.caller,\n });\n }\n\n if (typeof pathToTest !== \"string\") {\n throw new ConfigError(\n `Configuration contains string/RegExp pattern, but no filename was passed to Babel`,\n configName,\n );\n }\n\n if (typeof pattern === \"string\") {\n pattern = pathPatternToRegex(pattern, dirname);\n }\n return pattern.test(pathToTest);\n}\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;;AASA;;AACA;;AAGA;;AACA;;AAIA;;AAQA;;AAEA;;AAZA,MAAMA,KAAK,GAAGC,QAAA,CAAW,2BAAX,CAAd;;AAgDO,UAAUC,gBAAV,CACLC,GADK,EAELC,OAFK,EAGwB;EAC7B,MAAMC,KAAK,GAAG,OAAOC,sBAAsB,CAACH,GAAD,EAAMC,OAAN,CAA3C;EACA,IAAI,CAACC,KAAL,EAAY,OAAO,IAAP;EAEZ,OAAO;IACLE,OAAO,EAAEC,gBAAgB,CAACH,KAAK,CAACE,OAAP,CADpB;IAELE,OAAO,EAAED,gBAAgB,CAACH,KAAK,CAACI,OAAP,CAFpB;IAGLC,OAAO,EAAEL,KAAK,CAACK,OAAN,CAAcC,GAAd,CAAkBC,CAAC,IAAIC,gBAAgB,CAACD,CAAD,CAAvC,CAHJ;IAILE,KAAK,EAAE,IAAIC,GAAJ;EAJF,CAAP;AAMD;;AAEM,MAAMT,sBAAsB,GAAGU,eAAe,CAAiB;EACpEC,IAAI,EAAEC,MAAM,IAAIC,qBAAqB,CAACD,MAAD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C,CAG5C,YAAW7H,OAAQ,GALrB;IAMA7C,KAAK,CAAC8K,OAAD,CAAL;;IACA,IAAI1K,OAAO,CAAC6E,UAAZ,EAAwB;MACtBC,OAAO,CAACC,GAAR,CAAY2F,OAAZ;IACD;;IACD,OAAO,IAAP;EACD;;EAED,OAAO,KAAP;AACD;;AAMD,SAASL,eAAT,CACErK,OADF,EAEEoK,QAFF,EAGE3H,OAHF,EAIEyH,UAJF,EAKW;EACT,OAAOE,QAAQ,CAACtE,IAAT,CAAc+E,OAAO,IAC1B5E,YAAY,CAAC4E,OAAD,EAAUpI,OAAV,EAAmBzC,OAAO,CAACiE,QAA3B,EAAqCjE,OAArC,EAA8CkK,UAA9C,CADP,CAAP;AAGD;;AAED,SAASjE,YAAT,CACE4E,OADF,EAEEpI,OAFF,EAGEqI,UAHF,EAIE9K,OAJF,EAKEkK,UALF,EAMW;EACT,IAAI,OAAOW,OAAP,KAAmB,UAAvB,EAAmC;IACjC,OAAO,CAAC,CAAC,IAAAE,qCAAA,EAAmBF,OAAnB,EAA4BC,UAA5B,EAAwC;MAC/CrI,OAD+C;MAE/CxB,OAAO,EAAEjB,OAAO,CAACiB,OAF8B;MAG/C+B,MAAM,EAAEhD,OAAO,CAACgD;IAH+B,CAAxC,CAAT;EAKD;;EAED,IAAI,OAAO8H,UAAP,KAAsB,QAA1B,EAAoC;IAClC,MAAM,IAAIE,oBAAJ,CACH,mFADG,EAEJd,UAFI,CAAN;EAID;;EAED,IAAI,OAAOW,OAAP,KAAmB,QAAvB,EAAiC;IAC/BA,OAAO,GAAG,IAAA9E,uBAAA,EAAmB8E,OAAnB,EAA4BpI,OAA5B,CAAV;EACD;;EACD,OAAOoI,OAAO,CAAChC,IAAR,CAAaiC,UAAb,CAAP;AACD"} \ No newline at end of file +{"version":3,"names":["debug","buildDebug","buildPresetChain","arg","context","chain","buildPresetChainWalker","plugins","dedupDescriptors","presets","options","map","o","normalizeOptions","files","Set","makeChainWalker","root","preset","loadPresetDescriptors","env","envName","loadPresetEnvDescriptors","overrides","index","loadPresetOverridesDescriptors","overridesEnv","loadPresetOverridesEnvDescriptors","createLogger","makeWeakCacheSync","buildRootDescriptors","alias","createUncachedDescriptors","makeStrongCacheSync","buildEnvDescriptors","buildOverrideDescriptors","buildOverrideEnvDescriptors","buildRootChain","opts","configReport","babelRcReport","programmaticLogger","ConfigPrinter","programmaticChain","loadProgrammaticChain","dirname","cwd","undefined","programmaticReport","output","configFile","loadConfig","caller","findRootConfig","babelrc","babelrcRoots","babelrcRootsDirectory","configFileChain","emptyChain","configFileLogger","validatedFile","validateConfigFile","result","loadFileChain","mergeChain","ignoreFile","babelrcFile","isIgnored","fileChain","filename","pkgData","findPackageData","babelrcLoadEnabled","ignore","config","findRelativeConfig","add","filepath","shouldIgnore","validateBabelrcFile","babelrcLogger","showConfig","console","log","filter","x","join","fileHandling","absoluteRoot","directories","indexOf","babelrcPatterns","Array","isArray","pat","path","resolve","length","some","pathPatternToRegex","directory","matchPattern","file","validate","validateExtendFile","input","createCachedDescriptors","baseLogger","buildProgrammaticLogger","loadFileChainWalker","loadFileDescriptors","loadFileEnvDescriptors","loadFileOverridesDescriptors","loadFileOverridesEnvDescriptors","buildFileLogger","configure","ChainFormatter","Config","descriptors","_","Programmatic","callerName","name","Error","override","chainWalker","flattenedConfigs","rootOpts","configIsApplicable","push","envOpts","forEach","overrideOps","overrideEnvOpts","only","logger","mergeExtendsChain","mergeChainOpts","extends","has","from","delete","target","source","passPerPreset","test","include","exclude","Object","prototype","hasOwnProperty","call","sourceMaps","sourceMap","items","Map","item","value","fnKey","nameMap","get","set","desc","ownPass","reduce","acc","configName","configFieldIsApplicable","patterns","matchesPatterns","ignoreListReplacer","_key","RegExp","String","message","JSON","stringify","pattern","pathToTest","endHiddenCallStack","ConfigError"],"sources":["../../src/config/config-chain.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-use-before-define */\n\nimport path from \"path\";\nimport buildDebug from \"debug\";\nimport type { Handler } from \"gensync\";\nimport { validate } from \"./validation/options\";\nimport type {\n ValidatedOptions,\n IgnoreList,\n ConfigApplicableTest,\n BabelrcSearch,\n CallerMetadata,\n IgnoreItem,\n} from \"./validation/options\";\nimport pathPatternToRegex from \"./pattern-to-regex\";\nimport { ConfigPrinter, ChainFormatter } from \"./printer\";\nimport type { ReadonlyDeepArray } from \"./helpers/deep-array\";\n\nimport { endHiddenCallStack } from \"../errors/rewrite-stack-trace\";\nimport ConfigError from \"../errors/config-error\";\n\nconst debug = buildDebug(\"babel:config:config-chain\");\n\nimport {\n findPackageData,\n findRelativeConfig,\n findRootConfig,\n loadConfig,\n} from \"./files\";\nimport type { ConfigFile, IgnoreFile, FilePackageData } from \"./files\";\n\nimport { makeWeakCacheSync, makeStrongCacheSync } from \"./caching\";\n\nimport {\n createCachedDescriptors,\n createUncachedDescriptors,\n} from \"./config-descriptors\";\nimport type {\n UnloadedDescriptor,\n OptionsAndDescriptors,\n ValidatedFile,\n} from \"./config-descriptors\";\n\nexport type ConfigChain = {\n plugins: Array;\n presets: Array;\n options: Array;\n files: Set;\n};\n\nexport type PresetInstance = {\n options: ValidatedOptions;\n alias: string;\n dirname: string;\n externalDependencies: ReadonlyDeepArray;\n};\n\nexport type ConfigContext = {\n filename: string | undefined;\n cwd: string;\n root: string;\n envName: string;\n caller: CallerMetadata | undefined;\n showConfig: boolean;\n};\n\n/**\n * Build a config chain for a given preset.\n */\nexport function* buildPresetChain(\n arg: PresetInstance,\n context: any,\n): Handler {\n const chain = yield* buildPresetChainWalker(arg, context);\n if (!chain) return null;\n\n return {\n plugins: dedupDescriptors(chain.plugins),\n presets: dedupDescriptors(chain.presets),\n options: chain.options.map(o => normalizeOptions(o)),\n files: new Set(),\n };\n}\n\nexport const buildPresetChainWalker = makeChainWalker({\n root: preset => loadPresetDescriptors(preset),\n env: (preset, envName) => loadPresetEnvDescriptors(preset)(envName),\n overrides: (preset, index) => loadPresetOverridesDescriptors(preset)(index),\n overridesEnv: (preset, index, envName) =>\n loadPresetOverridesEnvDescriptors(preset)(index)(envName),\n createLogger: () => () => {}, // Currently we don't support logging how preset is expanded\n});\nconst loadPresetDescriptors = makeWeakCacheSync((preset: PresetInstance) =>\n buildRootDescriptors(preset, preset.alias, createUncachedDescriptors),\n);\nconst loadPresetEnvDescriptors = makeWeakCacheSync((preset: PresetInstance) =>\n makeStrongCacheSync((envName: string) =>\n buildEnvDescriptors(\n preset,\n preset.alias,\n createUncachedDescriptors,\n envName,\n ),\n ),\n);\nconst loadPresetOverridesDescriptors = makeWeakCacheSync(\n (preset: PresetInstance) =>\n makeStrongCacheSync((index: number) =>\n buildOverrideDescriptors(\n preset,\n preset.alias,\n createUncachedDescriptors,\n index,\n ),\n ),\n);\nconst loadPresetOverridesEnvDescriptors = makeWeakCacheSync(\n (preset: PresetInstance) =>\n makeStrongCacheSync((index: number) =>\n makeStrongCacheSync((envName: string) =>\n buildOverrideEnvDescriptors(\n preset,\n preset.alias,\n createUncachedDescriptors,\n index,\n envName,\n ),\n ),\n ),\n);\n\nexport type FileHandling = \"transpile\" | \"ignored\" | \"unsupported\";\nexport type RootConfigChain = ConfigChain & {\n babelrc: ConfigFile | void;\n config: ConfigFile | void;\n ignore: IgnoreFile | void;\n fileHandling: FileHandling;\n files: Set;\n};\n\n/**\n * Build a config chain for Babel's full root configuration.\n */\nexport function* buildRootChain(\n opts: ValidatedOptions,\n context: ConfigContext,\n): Handler {\n let configReport, babelRcReport;\n const programmaticLogger = new ConfigPrinter();\n const programmaticChain = yield* loadProgrammaticChain(\n {\n options: opts,\n dirname: context.cwd,\n },\n context,\n undefined,\n programmaticLogger,\n );\n if (!programmaticChain) return null;\n const programmaticReport = yield* programmaticLogger.output();\n\n let configFile;\n if (typeof opts.configFile === \"string\") {\n configFile = yield* loadConfig(\n opts.configFile,\n context.cwd,\n context.envName,\n context.caller,\n );\n } else if (opts.configFile !== false) {\n configFile = yield* findRootConfig(\n context.root,\n context.envName,\n context.caller,\n );\n }\n\n let { babelrc, babelrcRoots } = opts;\n let babelrcRootsDirectory = context.cwd;\n\n const configFileChain = emptyChain();\n const configFileLogger = new ConfigPrinter();\n if (configFile) {\n const validatedFile = validateConfigFile(configFile);\n const result = yield* loadFileChain(\n validatedFile,\n context,\n undefined,\n configFileLogger,\n );\n if (!result) return null;\n configReport = yield* configFileLogger.output();\n\n // Allow config files to toggle `.babelrc` resolution on and off and\n // specify where the roots are.\n if (babelrc === undefined) {\n babelrc = validatedFile.options.babelrc;\n }\n if (babelrcRoots === undefined) {\n babelrcRootsDirectory = validatedFile.dirname;\n babelrcRoots = validatedFile.options.babelrcRoots;\n }\n\n mergeChain(configFileChain, result);\n }\n\n let ignoreFile, babelrcFile;\n let isIgnored = false;\n const fileChain = emptyChain();\n // resolve all .babelrc files\n if (\n (babelrc === true || babelrc === undefined) &&\n typeof context.filename === \"string\"\n ) {\n const pkgData = yield* findPackageData(context.filename);\n\n if (\n pkgData &&\n babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)\n ) {\n ({ ignore: ignoreFile, config: babelrcFile } = yield* findRelativeConfig(\n pkgData,\n context.envName,\n context.caller,\n ));\n\n if (ignoreFile) {\n fileChain.files.add(ignoreFile.filepath);\n }\n\n if (\n ignoreFile &&\n shouldIgnore(context, ignoreFile.ignore, null, ignoreFile.dirname)\n ) {\n isIgnored = true;\n }\n\n if (babelrcFile && !isIgnored) {\n const validatedFile = validateBabelrcFile(babelrcFile);\n const babelrcLogger = new ConfigPrinter();\n const result = yield* loadFileChain(\n validatedFile,\n context,\n undefined,\n babelrcLogger,\n );\n if (!result) {\n isIgnored = true;\n } else {\n babelRcReport = yield* babelrcLogger.output();\n mergeChain(fileChain, result);\n }\n }\n\n if (babelrcFile && isIgnored) {\n fileChain.files.add(babelrcFile.filepath);\n }\n }\n }\n\n if (context.showConfig) {\n console.log(\n `Babel configs on \"${context.filename}\" (ascending priority):\\n` +\n // print config by the order of ascending priority\n [configReport, babelRcReport, programmaticReport]\n .filter(x => !!x)\n .join(\"\\n\\n\") +\n \"\\n-----End Babel configs-----\",\n );\n }\n // Insert file chain in front so programmatic options have priority\n // over configuration file chain items.\n const chain = mergeChain(\n mergeChain(mergeChain(emptyChain(), configFileChain), fileChain),\n programmaticChain,\n );\n\n return {\n plugins: isIgnored ? [] : dedupDescriptors(chain.plugins),\n presets: isIgnored ? [] : dedupDescriptors(chain.presets),\n options: isIgnored ? [] : chain.options.map(o => normalizeOptions(o)),\n fileHandling: isIgnored ? \"ignored\" : \"transpile\",\n ignore: ignoreFile || undefined,\n babelrc: babelrcFile || undefined,\n config: configFile || undefined,\n files: chain.files,\n };\n}\n\nfunction babelrcLoadEnabled(\n context: ConfigContext,\n pkgData: FilePackageData,\n babelrcRoots: BabelrcSearch | undefined,\n babelrcRootsDirectory: string,\n): boolean {\n if (typeof babelrcRoots === \"boolean\") return babelrcRoots;\n\n const absoluteRoot = context.root;\n\n // Fast path to avoid having to match patterns if the babelrc is just\n // loading in the standard root directory.\n if (babelrcRoots === undefined) {\n return pkgData.directories.indexOf(absoluteRoot) !== -1;\n }\n\n let babelrcPatterns = babelrcRoots;\n if (!Array.isArray(babelrcPatterns)) {\n babelrcPatterns = [babelrcPatterns as IgnoreItem];\n }\n babelrcPatterns = babelrcPatterns.map(pat => {\n return typeof pat === \"string\"\n ? path.resolve(babelrcRootsDirectory, pat)\n : pat;\n });\n\n // Fast path to avoid having to match patterns if the babelrc is just\n // loading in the standard root directory.\n if (babelrcPatterns.length === 1 && babelrcPatterns[0] === absoluteRoot) {\n return pkgData.directories.indexOf(absoluteRoot) !== -1;\n }\n\n return babelrcPatterns.some(pat => {\n if (typeof pat === \"string\") {\n pat = pathPatternToRegex(pat, babelrcRootsDirectory);\n }\n\n return pkgData.directories.some(directory => {\n return matchPattern(pat, babelrcRootsDirectory, directory, context);\n });\n });\n}\n\nconst validateConfigFile = makeWeakCacheSync(\n (file: ConfigFile): ValidatedFile => ({\n filepath: file.filepath,\n dirname: file.dirname,\n options: validate(\"configfile\", file.options, file.filepath),\n }),\n);\n\nconst validateBabelrcFile = makeWeakCacheSync(\n (file: ConfigFile): ValidatedFile => ({\n filepath: file.filepath,\n dirname: file.dirname,\n options: validate(\"babelrcfile\", file.options, file.filepath),\n }),\n);\n\nconst validateExtendFile = makeWeakCacheSync(\n (file: ConfigFile): ValidatedFile => ({\n filepath: file.filepath,\n dirname: file.dirname,\n options: validate(\"extendsfile\", file.options, file.filepath),\n }),\n);\n\n/**\n * Build a config chain for just the programmatic options passed into Babel.\n */\nconst loadProgrammaticChain = makeChainWalker({\n root: input => buildRootDescriptors(input, \"base\", createCachedDescriptors),\n env: (input, envName) =>\n buildEnvDescriptors(input, \"base\", createCachedDescriptors, envName),\n overrides: (input, index) =>\n buildOverrideDescriptors(input, \"base\", createCachedDescriptors, index),\n overridesEnv: (input, index, envName) =>\n buildOverrideEnvDescriptors(\n input,\n \"base\",\n createCachedDescriptors,\n index,\n envName,\n ),\n createLogger: (input, context, baseLogger) =>\n buildProgrammaticLogger(input, context, baseLogger),\n});\n\n/**\n * Build a config chain for a given file.\n */\nconst loadFileChainWalker = makeChainWalker({\n root: file => loadFileDescriptors(file),\n env: (file, envName) => loadFileEnvDescriptors(file)(envName),\n overrides: (file, index) => loadFileOverridesDescriptors(file)(index),\n overridesEnv: (file, index, envName) =>\n loadFileOverridesEnvDescriptors(file)(index)(envName),\n createLogger: (file, context, baseLogger) =>\n buildFileLogger(file.filepath, context, baseLogger),\n});\n\nfunction* loadFileChain(\n input: ValidatedFile,\n context: ConfigContext,\n files: Set,\n baseLogger: ConfigPrinter,\n) {\n const chain = yield* loadFileChainWalker(input, context, files, baseLogger);\n if (chain) {\n chain.files.add(input.filepath);\n }\n\n return chain;\n}\n\nconst loadFileDescriptors = makeWeakCacheSync((file: ValidatedFile) =>\n buildRootDescriptors(file, file.filepath, createUncachedDescriptors),\n);\nconst loadFileEnvDescriptors = makeWeakCacheSync((file: ValidatedFile) =>\n makeStrongCacheSync((envName: string) =>\n buildEnvDescriptors(\n file,\n file.filepath,\n createUncachedDescriptors,\n envName,\n ),\n ),\n);\nconst loadFileOverridesDescriptors = makeWeakCacheSync((file: ValidatedFile) =>\n makeStrongCacheSync((index: number) =>\n buildOverrideDescriptors(\n file,\n file.filepath,\n createUncachedDescriptors,\n index,\n ),\n ),\n);\nconst loadFileOverridesEnvDescriptors = makeWeakCacheSync(\n (file: ValidatedFile) =>\n makeStrongCacheSync((index: number) =>\n makeStrongCacheSync((envName: string) =>\n buildOverrideEnvDescriptors(\n file,\n file.filepath,\n createUncachedDescriptors,\n index,\n envName,\n ),\n ),\n ),\n);\n\nfunction buildFileLogger(\n filepath: string,\n context: ConfigContext,\n baseLogger: ConfigPrinter | void,\n) {\n if (!baseLogger) {\n return () => {};\n }\n return baseLogger.configure(context.showConfig, ChainFormatter.Config, {\n filepath,\n });\n}\n\nfunction buildRootDescriptors(\n { dirname, options }: Partial,\n alias: string,\n descriptors: (\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n ) => OptionsAndDescriptors,\n) {\n return descriptors(dirname, options, alias);\n}\n\nfunction buildProgrammaticLogger(\n _: unknown,\n context: ConfigContext,\n baseLogger: ConfigPrinter | void,\n) {\n if (!baseLogger) {\n return () => {};\n }\n return baseLogger.configure(context.showConfig, ChainFormatter.Programmatic, {\n callerName: context.caller?.name,\n });\n}\n\nfunction buildEnvDescriptors(\n { dirname, options }: Partial,\n alias: string,\n descriptors: (\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n ) => OptionsAndDescriptors,\n envName: string,\n) {\n const opts = options.env && options.env[envName];\n return opts ? descriptors(dirname, opts, `${alias}.env[\"${envName}\"]`) : null;\n}\n\nfunction buildOverrideDescriptors(\n { dirname, options }: Partial,\n alias: string,\n descriptors: (\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n ) => OptionsAndDescriptors,\n index: number,\n) {\n const opts = options.overrides && options.overrides[index];\n if (!opts) throw new Error(\"Assertion failure - missing override\");\n\n return descriptors(dirname, opts, `${alias}.overrides[${index}]`);\n}\n\nfunction buildOverrideEnvDescriptors(\n { dirname, options }: Partial,\n alias: string,\n descriptors: (\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n ) => OptionsAndDescriptors,\n index: number,\n envName: string,\n) {\n const override = options.overrides && options.overrides[index];\n if (!override) throw new Error(\"Assertion failure - missing override\");\n\n const opts = override.env && override.env[envName];\n return opts\n ? descriptors(\n dirname,\n opts,\n `${alias}.overrides[${index}].env[\"${envName}\"]`,\n )\n : null;\n}\n\nfunction makeChainWalker<\n ArgT extends {\n options: ValidatedOptions;\n dirname: string;\n filepath?: string;\n },\n>({\n root,\n env,\n overrides,\n overridesEnv,\n createLogger,\n}: {\n root: (configEntry: ArgT) => OptionsAndDescriptors;\n env: (configEntry: ArgT, env: string) => OptionsAndDescriptors | null;\n overrides: (configEntry: ArgT, index: number) => OptionsAndDescriptors;\n overridesEnv: (\n configEntry: ArgT,\n index: number,\n env: string,\n ) => OptionsAndDescriptors | null;\n createLogger: (\n configEntry: ArgT,\n context: ConfigContext,\n printer: ConfigPrinter | void,\n ) => (\n opts: OptionsAndDescriptors,\n index?: number | null,\n env?: string | null,\n ) => void;\n}): (\n configEntry: ArgT,\n context: ConfigContext,\n files?: Set,\n baseLogger?: ConfigPrinter,\n) => Handler {\n return function* chainWalker(input, context, files = new Set(), baseLogger) {\n const { dirname } = input;\n\n const flattenedConfigs: Array<{\n config: OptionsAndDescriptors;\n index: number | undefined | null;\n envName: string | undefined | null;\n }> = [];\n\n const rootOpts = root(input);\n if (configIsApplicable(rootOpts, dirname, context, input.filepath)) {\n flattenedConfigs.push({\n config: rootOpts,\n envName: undefined,\n index: undefined,\n });\n\n const envOpts = env(input, context.envName);\n if (\n envOpts &&\n configIsApplicable(envOpts, dirname, context, input.filepath)\n ) {\n flattenedConfigs.push({\n config: envOpts,\n envName: context.envName,\n index: undefined,\n });\n }\n\n (rootOpts.options.overrides || []).forEach((_, index) => {\n const overrideOps = overrides(input, index);\n if (configIsApplicable(overrideOps, dirname, context, input.filepath)) {\n flattenedConfigs.push({\n config: overrideOps,\n index,\n envName: undefined,\n });\n\n const overrideEnvOpts = overridesEnv(input, index, context.envName);\n if (\n overrideEnvOpts &&\n configIsApplicable(\n overrideEnvOpts,\n dirname,\n context,\n input.filepath,\n )\n ) {\n flattenedConfigs.push({\n config: overrideEnvOpts,\n index,\n envName: context.envName,\n });\n }\n }\n });\n }\n\n // Process 'ignore' and 'only' before 'extends' items are processed so\n // that we don't do extra work loading extended configs if a file is\n // ignored.\n if (\n flattenedConfigs.some(\n ({\n config: {\n options: { ignore, only },\n },\n }) => shouldIgnore(context, ignore, only, dirname),\n )\n ) {\n return null;\n }\n\n const chain = emptyChain();\n const logger = createLogger(input, context, baseLogger);\n\n for (const { config, index, envName } of flattenedConfigs) {\n if (\n !(yield* mergeExtendsChain(\n chain,\n config.options,\n dirname,\n context,\n files,\n baseLogger,\n ))\n ) {\n return null;\n }\n\n logger(config, index, envName);\n yield* mergeChainOpts(chain, config);\n }\n return chain;\n };\n}\n\nfunction* mergeExtendsChain(\n chain: ConfigChain,\n opts: ValidatedOptions,\n dirname: string,\n context: ConfigContext,\n files: Set,\n baseLogger?: ConfigPrinter,\n): Handler {\n if (opts.extends === undefined) return true;\n\n const file = yield* loadConfig(\n opts.extends,\n dirname,\n context.envName,\n context.caller,\n );\n\n if (files.has(file)) {\n throw new Error(\n `Configuration cycle detected loading ${file.filepath}.\\n` +\n `File already loaded following the config chain:\\n` +\n Array.from(files, file => ` - ${file.filepath}`).join(\"\\n\"),\n );\n }\n\n files.add(file);\n const fileChain = yield* loadFileChain(\n validateExtendFile(file),\n context,\n files,\n baseLogger,\n );\n files.delete(file);\n\n if (!fileChain) return false;\n\n mergeChain(chain, fileChain);\n\n return true;\n}\n\nfunction mergeChain(target: ConfigChain, source: ConfigChain): ConfigChain {\n target.options.push(...source.options);\n target.plugins.push(...source.plugins);\n target.presets.push(...source.presets);\n for (const file of source.files) {\n target.files.add(file);\n }\n\n return target;\n}\n\nfunction* mergeChainOpts(\n target: ConfigChain,\n { options, plugins, presets }: OptionsAndDescriptors,\n): Handler {\n target.options.push(options);\n target.plugins.push(...(yield* plugins()));\n target.presets.push(...(yield* presets()));\n\n return target;\n}\n\nfunction emptyChain(): ConfigChain {\n return {\n options: [],\n presets: [],\n plugins: [],\n files: new Set(),\n };\n}\n\nfunction normalizeOptions(opts: ValidatedOptions): ValidatedOptions {\n const options = {\n ...opts,\n };\n delete options.extends;\n delete options.env;\n delete options.overrides;\n delete options.plugins;\n delete options.presets;\n delete options.passPerPreset;\n delete options.ignore;\n delete options.only;\n delete options.test;\n delete options.include;\n delete options.exclude;\n\n // \"sourceMap\" is just aliased to sourceMap, so copy it over as\n // we merge the options together.\n if (Object.prototype.hasOwnProperty.call(options, \"sourceMap\")) {\n options.sourceMaps = options.sourceMap;\n delete options.sourceMap;\n }\n return options;\n}\n\nfunction dedupDescriptors(\n items: Array,\n): Array {\n const map: Map<\n Function,\n Map\n > = new Map();\n\n const descriptors = [];\n\n for (const item of items) {\n if (typeof item.value === \"function\") {\n const fnKey = item.value;\n let nameMap = map.get(fnKey);\n if (!nameMap) {\n nameMap = new Map();\n map.set(fnKey, nameMap);\n }\n let desc = nameMap.get(item.name);\n if (!desc) {\n desc = { value: item };\n descriptors.push(desc);\n\n // Treat passPerPreset presets as unique, skipping them\n // in the merge processing steps.\n if (!item.ownPass) nameMap.set(item.name, desc);\n } else {\n desc.value = item;\n }\n } else {\n descriptors.push({ value: item });\n }\n }\n\n return descriptors.reduce((acc, desc) => {\n acc.push(desc.value);\n return acc;\n }, []);\n}\n\nfunction configIsApplicable(\n { options }: OptionsAndDescriptors,\n dirname: string,\n context: ConfigContext,\n configName: string,\n): boolean {\n return (\n (options.test === undefined ||\n configFieldIsApplicable(context, options.test, dirname, configName)) &&\n (options.include === undefined ||\n configFieldIsApplicable(context, options.include, dirname, configName)) &&\n (options.exclude === undefined ||\n !configFieldIsApplicable(context, options.exclude, dirname, configName))\n );\n}\n\nfunction configFieldIsApplicable(\n context: ConfigContext,\n test: ConfigApplicableTest,\n dirname: string,\n configName: string,\n): boolean {\n const patterns = Array.isArray(test) ? test : [test];\n\n return matchesPatterns(context, patterns, dirname, configName);\n}\n\n/**\n * Print the ignoreList-values in a more helpful way than the default.\n */\nfunction ignoreListReplacer(\n _key: string,\n value: IgnoreList | IgnoreItem,\n): IgnoreList | IgnoreItem | string {\n if (value instanceof RegExp) {\n return String(value);\n }\n\n return value;\n}\n\n/**\n * Tests if a filename should be ignored based on \"ignore\" and \"only\" options.\n */\nfunction shouldIgnore(\n context: ConfigContext,\n ignore: IgnoreList | undefined | null,\n only: IgnoreList | undefined | null,\n dirname: string,\n): boolean {\n if (ignore && matchesPatterns(context, ignore, dirname)) {\n const message = `No config is applied to \"${\n context.filename ?? \"(unknown)\"\n }\" because it matches one of \\`ignore: ${JSON.stringify(\n ignore,\n ignoreListReplacer,\n )}\\` from \"${dirname}\"`;\n debug(message);\n if (context.showConfig) {\n console.log(message);\n }\n return true;\n }\n\n if (only && !matchesPatterns(context, only, dirname)) {\n const message = `No config is applied to \"${\n context.filename ?? \"(unknown)\"\n }\" because it fails to match one of \\`only: ${JSON.stringify(\n only,\n ignoreListReplacer,\n )}\\` from \"${dirname}\"`;\n debug(message);\n if (context.showConfig) {\n console.log(message);\n }\n return true;\n }\n\n return false;\n}\n\n/**\n * Returns result of calling function with filename if pattern is a function.\n * Otherwise returns result of matching pattern Regex with filename.\n */\nfunction matchesPatterns(\n context: ConfigContext,\n patterns: IgnoreList,\n dirname: string,\n configName?: string,\n): boolean {\n return patterns.some(pattern =>\n matchPattern(pattern, dirname, context.filename, context, configName),\n );\n}\n\nfunction matchPattern(\n pattern: IgnoreItem,\n dirname: string,\n pathToTest: string | undefined,\n context: ConfigContext,\n configName?: string,\n): boolean {\n if (typeof pattern === \"function\") {\n return !!endHiddenCallStack(pattern)(pathToTest, {\n dirname,\n envName: context.envName,\n caller: context.caller,\n });\n }\n\n if (typeof pathToTest !== \"string\") {\n throw new ConfigError(\n `Configuration contains string/RegExp pattern, but no filename was passed to Babel`,\n configName,\n );\n }\n\n if (typeof pattern === \"string\") {\n pattern = pathPatternToRegex(pattern, dirname);\n }\n return pattern.test(pathToTest);\n}\n"],"mappings":";;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AASA;AACA;AAGA;AACA;AAIA;AAQA;AAEA;;AAZA,MAAMA,KAAK,GAAGC,QAAU,CAAC,2BAA2B,CAAC;AAgD9C,UAAUC,gBAAgB,CAC/BC,GAAmB,EACnBC,OAAY,EACiB;EAC7B,MAAMC,KAAK,GAAG,OAAOC,sBAAsB,CAACH,GAAG,EAAEC,OAAO,CAAC;EACzD,IAAI,CAACC,KAAK,EAAE,OAAO,IAAI;EAEvB,OAAO;IACLE,OAAO,EAAEC,gBAAgB,CAACH,KAAK,CAACE,OAAO,CAAC;IACxCE,OAAO,EAAED,gBAAgB,CAACH,KAAK,CAACI,OAAO,CAAC;IACxCC,OAAO,EAAEL,KAAK,CAACK,OAAO,CAACC,GAAG,CAACC,CAAC,IAAIC,gBAAgB,CAACD,CAAC,CAAC,CAAC;IACpDE,KAAK,EAAE,IAAIC,GAAG;EAChB,CAAC;AACH;AAEO,MAAMT,sBAAsB,GAAGU,eAAe,CAAiB;EACpEC,IAAI,EAAEC,MAAM,IAAIC,qBAAqB,CAACD,MAAM,CAAC;EAC7CE,GAAG,EAAE,CAACF,MAAM,EAAEG,OAAO,KAAKC,wBAAwB,CAACJ,MAAM,CAAC,CAACG,OAAO,CAAC;EACnEE,SAAS,EAAE,CAACL,MAAM,EAAEM,KAAK,KAAKC,8BAA8B,CAACP,MAAM,CAAC,CAACM,KAAK,CAAC;EAC3EE,YAAY,EAAE,CAACR,MAAM,EAAEM,KAAK,EAAEH,OAAO,KACnCM,iCAAiC,CAACT,MAAM,CAAC,CAACM,KAAK,CAAC,CAACH,OAAO,CAAC;EAC3DO,YAAY,EAAE,M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PxB,OAAO,EAAEjB,OAAO,CAACiB,OAAO;MACxB+B,MAAM,EAAEhD,OAAO,CAACgD;IAClB,CAAC,CAAC;EACJ;EAEA,IAAI,OAAO8H,UAAU,KAAK,QAAQ,EAAE;IAClC,MAAM,IAAIE,oBAAW,CAClB,mFAAkF,EACnFd,UAAU,CACX;EACH;EAEA,IAAI,OAAOW,OAAO,KAAK,QAAQ,EAAE;IAC/BA,OAAO,GAAG,IAAA9E,uBAAkB,EAAC8E,OAAO,EAAEpI,OAAO,CAAC;EAChD;EACA,OAAOoI,OAAO,CAAChC,IAAI,CAACiC,UAAU,CAAC;AACjC;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/config-descriptors.js b/node_modules/@babel/core/lib/config/config-descriptors.js index cbadedd90..83f34ec06 100644 --- a/node_modules/@babel/core/lib/config/config-descriptors.js +++ b/node_modules/@babel/core/lib/config/config-descriptors.js @@ -6,40 +6,28 @@ Object.defineProperty(exports, "__esModule", { exports.createCachedDescriptors = createCachedDescriptors; exports.createDescriptor = createDescriptor; exports.createUncachedDescriptors = createUncachedDescriptors; - function _gensync() { const data = require("gensync"); - _gensync = function () { return data; }; - return data; } - var _functional = require("../gensync-utils/functional"); - var _files = require("./files"); - var _item = require("./item"); - var _caching = require("./caching"); - var _resolveTargets = require("./resolve-targets"); - function isEqualDescriptor(a, b) { return a.name === b.name && a.value === b.value && a.options === b.options && a.dirname === b.dirname && a.alias === b.alias && a.ownPass === b.ownPass && (a.file && a.file.request) === (b.file && b.file.request) && (a.file && a.file.resolved) === (b.file && b.file.resolved); } - function* handlerOf(value) { return value; } - function optionsWithResolvedBrowserslistConfigFile(options, dirname) { if (typeof options.browserslistConfigFile === "string") { options.browserslistConfigFile = (0, _resolveTargets.resolveBrowserslistConfigFile)(options.browserslistConfigFile, dirname); } - return options; } @@ -51,8 +39,10 @@ function createCachedDescriptors(dirname, options, alias) { } = options; return { options: optionsWithResolvedBrowserslistConfigFile(options, dirname), - plugins: plugins ? () => createCachedPluginDescriptors(plugins, dirname)(alias) : () => handlerOf([]), - presets: presets ? () => createCachedPresetDescriptors(presets, dirname)(alias)(!!passPerPreset) : () => handlerOf([]) + plugins: plugins ? () => + createCachedPluginDescriptors(plugins, dirname)(alias) : () => handlerOf([]), + presets: presets ? () => + createCachedPresetDescriptors(presets, dirname)(alias)(!!passPerPreset) : () => handlerOf([]) }; } @@ -63,13 +53,13 @@ function createUncachedDescriptors(dirname, options, alias) { presets: (0, _functional.once)(() => createPresetDescriptors(options.presets || [], dirname, alias, !!options.passPerPreset)) }; } - const PRESET_DESCRIPTOR_CACHE = new WeakMap(); const createCachedPresetDescriptors = (0, _caching.makeWeakCacheSync)((items, cache) => { const dirname = cache.using(dir => dir); return (0, _caching.makeStrongCacheSync)(alias => (0, _caching.makeStrongCache)(function* (passPerPreset) { const descriptors = yield* createPresetDescriptors(items, dirname, alias, passPerPreset); - return descriptors.map(desc => loadCachedDescriptor(PRESET_DESCRIPTOR_CACHE, desc)); + return descriptors.map( + desc => loadCachedDescriptor(PRESET_DESCRIPTOR_CACHE, desc)); })); }); const PLUGIN_DESCRIPTOR_CACHE = new WeakMap(); @@ -77,9 +67,11 @@ const createCachedPluginDescriptors = (0, _caching.makeWeakCacheSync)((items, ca const dirname = cache.using(dir => dir); return (0, _caching.makeStrongCache)(function* (alias) { const descriptors = yield* createPluginDescriptors(items, dirname, alias); - return descriptors.map(desc => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc)); + return descriptors.map( + desc => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc)); }); }); + const DEFAULT_OPTIONS = {}; function loadCachedDescriptor(cache, desc) { @@ -89,40 +81,30 @@ function loadCachedDescriptor(cache, desc) { } = desc; if (options === false) return desc; let cacheByOptions = cache.get(value); - if (!cacheByOptions) { cacheByOptions = new WeakMap(); cache.set(value, cacheByOptions); } - let possibilities = cacheByOptions.get(options); - if (!possibilities) { possibilities = []; cacheByOptions.set(options, possibilities); } - if (possibilities.indexOf(desc) === -1) { const matches = possibilities.filter(possibility => isEqualDescriptor(possibility, desc)); - if (matches.length > 0) { return matches[0]; } - possibilities.push(desc); } - return desc; } - function* createPresetDescriptors(items, dirname, alias, passPerPreset) { return yield* createDescriptors("preset", items, dirname, alias, passPerPreset); } - function* createPluginDescriptors(items, dirname, alias) { return yield* createDescriptors("plugin", items, dirname, alias); } - function* createDescriptors(type, items, dirname, alias, ownPass) { const descriptors = yield* _gensync().all(items.map((item, index) => createDescriptor(item, dirname, { type, @@ -139,15 +121,12 @@ function* createDescriptor(pair, dirname, { ownPass }) { const desc = (0, _item.getItemDescriptor)(pair); - if (desc) { return desc; } - let name; let options; let value = pair; - if (Array.isArray(value)) { if (value.length === 3) { [value, options, name] = value; @@ -155,15 +134,12 @@ function* createDescriptor(pair, dirname, { [value, options] = value; } } - let file = undefined; let filepath = null; - if (typeof value === "string") { if (typeof type !== "string") { throw new Error("To resolve a string-based item, the type of item must be given"); } - const resolver = type === "plugin" ? _files.loadPlugin : _files.loadPreset; const request = value; ({ @@ -175,11 +151,9 @@ function* createDescriptor(pair, dirname, { resolved: filepath }; } - if (!value) { throw new Error(`Unexpected falsy value: ${String(value)}`); } - if (typeof value === "object" && value.__esModule) { if (value.default) { value = value.default; @@ -187,15 +161,12 @@ function* createDescriptor(pair, dirname, { throw new Error("Must export a default export when using ES6 modules."); } } - if (typeof value !== "object" && typeof value !== "function") { throw new Error(`Unsupported format: ${typeof value}. Expected an object or a function.`); } - if (filepath !== null && typeof value === "object" && value) { throw new Error(`Plugin/Preset files are not allowed to export objects, only functions. In ${filepath}`); } - return { name, alias: filepath || alias, @@ -206,28 +177,22 @@ function* createDescriptor(pair, dirname, { file }; } - function assertNoDuplicates(items) { const map = new Map(); - for (const item of items) { if (typeof item.value !== "function") continue; let nameMap = map.get(item.value); - if (!nameMap) { nameMap = new Set(); map.set(item.value, nameMap); } - if (nameMap.has(item.name)) { const conflicts = items.filter(i => i.value === item.value); throw new Error([`Duplicate plugin/preset detected.`, `If you'd like to use two separate instances of a plugin,`, `they need separate names, e.g.`, ``, ` plugins: [`, ` ['some-plugin', {}],`, ` ['some-plugin', {}, 'some unique name'],`, ` ]`, ``, `Duplicates detected are:`, `${JSON.stringify(conflicts, null, 2)}`].join("\n")); } - nameMap.add(item.name); } } - 0 && 0; //# sourceMappingURL=config-descriptors.js.map diff --git a/node_modules/@babel/core/lib/config/config-descriptors.js.map b/node_modules/@babel/core/lib/config/config-descriptors.js.map index 37b2622fb..152ce0d4c 100644 --- a/node_modules/@babel/core/lib/config/config-descriptors.js.map +++ b/node_modules/@babel/core/lib/config/config-descriptors.js.map @@ -1 +1 @@ -{"version":3,"names":["isEqualDescriptor","a","b","name","value","options","dirname","alias","ownPass","file","request","resolved","handlerOf","optionsWithResolvedBrowserslistConfigFile","browserslistConfigFile","resolveBrowserslistConfigFile","createCachedDescriptors","plugins","presets","passPerPreset","createCachedPluginDescriptors","createCachedPresetDescriptors","createUncachedDescriptors","once","createPluginDescriptors","createPresetDescriptors","PRESET_DESCRIPTOR_CACHE","WeakMap","makeWeakCacheSync","items","cache","using","dir","makeStrongCacheSync","makeStrongCache","descriptors","map","desc","loadCachedDescriptor","PLUGIN_DESCRIPTOR_CACHE","DEFAULT_OPTIONS","cacheByOptions","get","set","possibilities","indexOf","matches","filter","possibility","length","push","createDescriptors","type","gensync","all","item","index","createDescriptor","assertNoDuplicates","pair","getItemDescriptor","Array","isArray","undefined","filepath","Error","resolver","loadPlugin","loadPreset","String","__esModule","default","Map","nameMap","Set","has","conflicts","i","JSON","stringify","join","add"],"sources":["../../src/config/config-descriptors.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\nimport { once } from \"../gensync-utils/functional\";\n\nimport { loadPlugin, loadPreset } from \"./files\";\n\nimport { getItemDescriptor } from \"./item\";\n\nimport {\n makeWeakCacheSync,\n makeStrongCacheSync,\n makeStrongCache,\n} from \"./caching\";\nimport type { CacheConfigurator } from \"./caching\";\n\nimport type {\n ValidatedOptions,\n PluginList,\n PluginItem,\n} from \"./validation/options\";\n\nimport { resolveBrowserslistConfigFile } from \"./resolve-targets\";\n\n// Represents a config object and functions to lazily load the descriptors\n// for the plugins and presets so we don't load the plugins/presets unless\n// the options object actually ends up being applicable.\nexport type OptionsAndDescriptors = {\n options: ValidatedOptions;\n plugins: () => Handler>;\n presets: () => Handler>;\n};\n\n// Represents a plugin or presets at a given location in a config object.\n// At this point these have been resolved to a specific object or function,\n// but have not yet been executed to call functions with options.\nexport type UnloadedDescriptor = {\n name: string | undefined;\n value: any | Function;\n options: {} | undefined | false;\n dirname: string;\n alias: string;\n ownPass?: boolean;\n file?: {\n request: string;\n resolved: string;\n };\n};\n\nfunction isEqualDescriptor(\n a: UnloadedDescriptor,\n b: UnloadedDescriptor,\n): boolean {\n return (\n a.name === b.name &&\n a.value === b.value &&\n a.options === b.options &&\n a.dirname === b.dirname &&\n a.alias === b.alias &&\n a.ownPass === b.ownPass &&\n (a.file && a.file.request) === (b.file && b.file.request) &&\n (a.file && a.file.resolved) === (b.file && b.file.resolved)\n );\n}\n\nexport type ValidatedFile = {\n filepath: string;\n dirname: string;\n options: ValidatedOptions;\n};\n\n// eslint-disable-next-line require-yield\nfunction* handlerOf(value: T): Handler {\n return value;\n}\n\nfunction optionsWithResolvedBrowserslistConfigFile(\n options: ValidatedOptions,\n dirname: string,\n): ValidatedOptions {\n if (typeof options.browserslistConfigFile === \"string\") {\n options.browserslistConfigFile = resolveBrowserslistConfigFile(\n options.browserslistConfigFile,\n dirname,\n );\n }\n return options;\n}\n\n/**\n * Create a set of descriptors from a given options object, preserving\n * descriptor identity based on the identity of the plugin/preset arrays\n * themselves, and potentially on the identity of the plugins/presets + options.\n */\nexport function createCachedDescriptors(\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n): OptionsAndDescriptors {\n const { plugins, presets, passPerPreset } = options;\n return {\n options: optionsWithResolvedBrowserslistConfigFile(options, dirname),\n plugins: plugins\n ? () =>\n // @ts-expect-error todo(flow->ts) ts complains about incorrect arguments\n createCachedPluginDescriptors(plugins, dirname)(alias)\n : () => handlerOf([]),\n presets: presets\n ? () =>\n // @ts-expect-error todo(flow->ts) ts complains about incorrect arguments\n createCachedPresetDescriptors(presets, dirname)(alias)(\n !!passPerPreset,\n )\n : () => handlerOf([]),\n };\n}\n\n/**\n * Create a set of descriptors from a given options object, with consistent\n * identity for the descriptors, but not caching based on any specific identity.\n */\nexport function createUncachedDescriptors(\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n): OptionsAndDescriptors {\n return {\n options: optionsWithResolvedBrowserslistConfigFile(options, dirname),\n // The returned result here is cached to represent a config object in\n // memory, so we build and memoize the descriptors to ensure the same\n // values are returned consistently.\n plugins: once(() =>\n createPluginDescriptors(options.plugins || [], dirname, alias),\n ),\n presets: once(() =>\n createPresetDescriptors(\n options.presets || [],\n dirname,\n alias,\n !!options.passPerPreset,\n ),\n ),\n };\n}\n\nconst PRESET_DESCRIPTOR_CACHE = new WeakMap();\nconst createCachedPresetDescriptors = makeWeakCacheSync(\n (items: PluginList, cache: CacheConfigurator) => {\n const dirname = cache.using(dir => dir);\n return makeStrongCacheSync((alias: string) =>\n makeStrongCache(function* (\n passPerPreset: boolean,\n ): Handler> {\n const descriptors = yield* createPresetDescriptors(\n items,\n dirname,\n alias,\n passPerPreset,\n );\n return descriptors.map(\n // Items are cached using the overall preset array identity when\n // possibly, but individual descriptors are also cached if a match\n // can be found in the previously-used descriptor lists.\n desc => loadCachedDescriptor(PRESET_DESCRIPTOR_CACHE, desc),\n );\n }),\n );\n },\n);\n\nconst PLUGIN_DESCRIPTOR_CACHE = new WeakMap();\nconst createCachedPluginDescriptors = makeWeakCacheSync(\n (items: PluginList, cache: CacheConfigurator) => {\n const dirname = cache.using(dir => dir);\n return makeStrongCache(function* (\n alias: string,\n ): Handler> {\n const descriptors = yield* createPluginDescriptors(items, dirname, alias);\n return descriptors.map(\n // Items are cached using the overall plugin array identity when\n // possibly, but individual descriptors are also cached if a match\n // can be found in the previously-used descriptor lists.\n desc => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc),\n );\n });\n },\n);\n\n/**\n * When no options object is given in a descriptor, this object is used\n * as a WeakMap key in order to have consistent identity.\n */\nconst DEFAULT_OPTIONS = {};\n\n/**\n * Given the cache and a descriptor, returns a matching descriptor from the\n * cache, or else returns the input descriptor and adds it to the cache for\n * next time.\n */\nfunction loadCachedDescriptor(\n cache: WeakMap<{} | Function, WeakMap<{}, Array>>,\n desc: UnloadedDescriptor,\n) {\n const { value, options = DEFAULT_OPTIONS } = desc;\n if (options === false) return desc;\n\n let cacheByOptions = cache.get(value);\n if (!cacheByOptions) {\n cacheByOptions = new WeakMap();\n cache.set(value, cacheByOptions);\n }\n\n let possibilities = cacheByOptions.get(options);\n if (!possibilities) {\n possibilities = [];\n cacheByOptions.set(options, possibilities);\n }\n\n if (possibilities.indexOf(desc) === -1) {\n const matches = possibilities.filter(possibility =>\n isEqualDescriptor(possibility, desc),\n );\n if (matches.length > 0) {\n return matches[0];\n }\n\n possibilities.push(desc);\n }\n\n return desc;\n}\n\nfunction* createPresetDescriptors(\n items: PluginList,\n dirname: string,\n alias: string,\n passPerPreset: boolean,\n): Handler> {\n return yield* createDescriptors(\n \"preset\",\n items,\n dirname,\n alias,\n passPerPreset,\n );\n}\n\nfunction* createPluginDescriptors(\n items: PluginList,\n dirname: string,\n alias: string,\n): Handler> {\n return yield* createDescriptors(\"plugin\", items, dirname, alias);\n}\n\nfunction* createDescriptors(\n type: \"plugin\" | \"preset\",\n items: PluginList,\n dirname: string,\n alias: string,\n ownPass?: boolean,\n): Handler> {\n const descriptors = yield* gensync.all(\n items.map((item, index) =>\n createDescriptor(item, dirname, {\n type,\n alias: `${alias}$${index}`,\n ownPass: !!ownPass,\n }),\n ),\n );\n\n assertNoDuplicates(descriptors);\n\n return descriptors;\n}\n\n/**\n * Given a plugin/preset item, resolve it into a standard format.\n */\nexport function* createDescriptor(\n pair: PluginItem,\n dirname: string,\n {\n type,\n alias,\n ownPass,\n }: {\n type?: \"plugin\" | \"preset\";\n alias: string;\n ownPass?: boolean;\n },\n): Handler {\n const desc = getItemDescriptor(pair);\n if (desc) {\n return desc;\n }\n\n let name;\n let options;\n // todo(flow->ts) better type annotation\n let value: any = pair;\n if (Array.isArray(value)) {\n if (value.length === 3) {\n [value, options, name] = value;\n } else {\n [value, options] = value;\n }\n }\n\n let file = undefined;\n let filepath = null;\n if (typeof value === \"string\") {\n if (typeof type !== \"string\") {\n throw new Error(\n \"To resolve a string-based item, the type of item must be given\",\n );\n }\n const resolver = type === \"plugin\" ? loadPlugin : loadPreset;\n const request = value;\n\n ({ filepath, value } = yield* resolver(value, dirname));\n\n file = {\n request,\n resolved: filepath,\n };\n }\n\n if (!value) {\n throw new Error(`Unexpected falsy value: ${String(value)}`);\n }\n\n if (typeof value === \"object\" && value.__esModule) {\n if (value.default) {\n value = value.default;\n } else {\n throw new Error(\"Must export a default export when using ES6 modules.\");\n }\n }\n\n if (typeof value !== \"object\" && typeof value !== \"function\") {\n throw new Error(\n `Unsupported format: ${typeof value}. Expected an object or a function.`,\n );\n }\n\n if (filepath !== null && typeof value === \"object\" && value) {\n // We allow object values for plugins/presets nested directly within a\n // config object, because it can be useful to define them in nested\n // configuration contexts.\n throw new Error(\n `Plugin/Preset files are not allowed to export objects, only functions. In ${filepath}`,\n );\n }\n\n return {\n name,\n alias: filepath || alias,\n value,\n options,\n dirname,\n ownPass,\n file,\n };\n}\n\nfunction assertNoDuplicates(items: Array): void {\n const map = new Map();\n\n for (const item of items) {\n if (typeof item.value !== \"function\") continue;\n\n let nameMap = map.get(item.value);\n if (!nameMap) {\n nameMap = new Set();\n map.set(item.value, nameMap);\n }\n\n if (nameMap.has(item.name)) {\n const conflicts = items.filter(i => i.value === item.value);\n throw new Error(\n [\n `Duplicate plugin/preset detected.`,\n `If you'd like to use two separate instances of a plugin,`,\n `they need separate names, e.g.`,\n ``,\n ` plugins: [`,\n ` ['some-plugin', {}],`,\n ` ['some-plugin', {}, 'some unique name'],`,\n ` ]`,\n ``,\n `Duplicates detected are:`,\n `${JSON.stringify(conflicts, null, 2)}`,\n ].join(\"\\n\"),\n );\n }\n\n nameMap.add(item.name);\n }\n}\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;;AAEA;;AAEA;;AAEA;;AAaA;;AA2BA,SAASA,iBAAT,CACEC,CADF,EAEEC,CAFF,EAGW;EACT,OACED,CAAC,CAACE,IAAF,KAAWD,CAAC,CAACC,IAAb,IACAF,CAAC,CAACG,KAAF,KAAYF,CAAC,CAACE,KADd,IAEAH,CAAC,CAACI,OAAF,KAAcH,CAAC,CAACG,OAFhB,IAGAJ,CAAC,CAACK,OAAF,KAAcJ,CAAC,CAACI,OAHhB,IAIAL,CAAC,CAACM,KAAF,KAAYL,CAAC,CAACK,KAJd,IAKAN,CAAC,CAACO,OAAF,KAAcN,CAAC,CAACM,OALhB,IAMA,CAACP,CAAC,CAACQ,IAAF,IAAUR,CAAC,CAACQ,IAAF,CAAOC,OAAlB,OAAgCR,CAAC,CAACO,IAAF,IAAUP,CAAC,CAACO,IAAF,CAAOC,OAAjD,CANA,IAOA,CAACT,CAAC,CAACQ,IAAF,IAAUR,CAAC,CAACQ,IAAF,CAAOE,QAAlB,OAAiCT,CAAC,CAACO,IAAF,IAAUP,CAAC,CAACO,IAAF,CAAOE,QAAlD,CARF;AAUD;;AASD,UAAUC,SAAV,CAAuBR,KAAvB,EAA6C;EAC3C,OAAOA,KAAP;AACD;;AAED,SAASS,yCAAT,CACER,OADF,EAEEC,OAFF,EAGoB;EAClB,IAAI,OAAOD,OAAO,CAACS,sBAAf,KAA0C,QAA9C,EAAwD;IACtDT,OAAO,CAACS,sBAAR,GAAiC,IAAAC,6CAAA,EAC/BV,OAAO,CAACS,sBADuB,EAE/BR,OAF+B,CAAjC;EAID;;EACD,OAAOD,OAAP;AACD;;AAOM,SAASW,uBAAT,CACLV,OADK,EAELD,OA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AACkB,MAAN,CAAa8B,CAAC,IAAIA,CAAC,CAACzE,KAAF,KAAYmD,IAAI,CAACnD,KAAnC,CAAlB;MACA,MAAM,IAAI6D,KAAJ,CACJ,CACG,mCADH,EAEG,0DAFH,EAGG,gCAHH,EAIG,EAJH,EAKG,cALH,EAMG,0BANH,EAOG,8CAPH,EAQG,KARH,EASG,EATH,EAUG,0BAVH,EAWG,GAAEa,IAAI,CAACC,SAAL,CAAeH,SAAf,EAA0B,IAA1B,EAAgC,CAAhC,CAAmC,EAXxC,EAYEI,IAZF,CAYO,IAZP,CADI,CAAN;IAeD;;IAEDP,OAAO,CAACQ,GAAR,CAAY1B,IAAI,CAACpD,IAAjB;EACD;AACF"} \ No newline at end of file +{"version":3,"names":["isEqualDescriptor","a","b","name","value","options","dirname","alias","ownPass","file","request","resolved","handlerOf","optionsWithResolvedBrowserslistConfigFile","browserslistConfigFile","resolveBrowserslistConfigFile","createCachedDescriptors","plugins","presets","passPerPreset","createCachedPluginDescriptors","createCachedPresetDescriptors","createUncachedDescriptors","once","createPluginDescriptors","createPresetDescriptors","PRESET_DESCRIPTOR_CACHE","WeakMap","makeWeakCacheSync","items","cache","using","dir","makeStrongCacheSync","makeStrongCache","descriptors","map","desc","loadCachedDescriptor","PLUGIN_DESCRIPTOR_CACHE","DEFAULT_OPTIONS","cacheByOptions","get","set","possibilities","indexOf","matches","filter","possibility","length","push","createDescriptors","type","gensync","all","item","index","createDescriptor","assertNoDuplicates","pair","getItemDescriptor","Array","isArray","undefined","filepath","Error","resolver","loadPlugin","loadPreset","String","__esModule","default","Map","nameMap","Set","has","conflicts","i","JSON","stringify","join","add"],"sources":["../../src/config/config-descriptors.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\nimport { once } from \"../gensync-utils/functional\";\n\nimport { loadPlugin, loadPreset } from \"./files\";\n\nimport { getItemDescriptor } from \"./item\";\n\nimport {\n makeWeakCacheSync,\n makeStrongCacheSync,\n makeStrongCache,\n} from \"./caching\";\nimport type { CacheConfigurator } from \"./caching\";\n\nimport type {\n ValidatedOptions,\n PluginList,\n PluginItem,\n} from \"./validation/options\";\n\nimport { resolveBrowserslistConfigFile } from \"./resolve-targets\";\n\n// Represents a config object and functions to lazily load the descriptors\n// for the plugins and presets so we don't load the plugins/presets unless\n// the options object actually ends up being applicable.\nexport type OptionsAndDescriptors = {\n options: ValidatedOptions;\n plugins: () => Handler>;\n presets: () => Handler>;\n};\n\n// Represents a plugin or presets at a given location in a config object.\n// At this point these have been resolved to a specific object or function,\n// but have not yet been executed to call functions with options.\nexport type UnloadedDescriptor = {\n name: string | undefined;\n value: any | Function;\n options: {} | undefined | false;\n dirname: string;\n alias: string;\n ownPass?: boolean;\n file?: {\n request: string;\n resolved: string;\n };\n};\n\nfunction isEqualDescriptor(\n a: UnloadedDescriptor,\n b: UnloadedDescriptor,\n): boolean {\n return (\n a.name === b.name &&\n a.value === b.value &&\n a.options === b.options &&\n a.dirname === b.dirname &&\n a.alias === b.alias &&\n a.ownPass === b.ownPass &&\n (a.file && a.file.request) === (b.file && b.file.request) &&\n (a.file && a.file.resolved) === (b.file && b.file.resolved)\n );\n}\n\nexport type ValidatedFile = {\n filepath: string;\n dirname: string;\n options: ValidatedOptions;\n};\n\n// eslint-disable-next-line require-yield\nfunction* handlerOf(value: T): Handler {\n return value;\n}\n\nfunction optionsWithResolvedBrowserslistConfigFile(\n options: ValidatedOptions,\n dirname: string,\n): ValidatedOptions {\n if (typeof options.browserslistConfigFile === \"string\") {\n options.browserslistConfigFile = resolveBrowserslistConfigFile(\n options.browserslistConfigFile,\n dirname,\n );\n }\n return options;\n}\n\n/**\n * Create a set of descriptors from a given options object, preserving\n * descriptor identity based on the identity of the plugin/preset arrays\n * themselves, and potentially on the identity of the plugins/presets + options.\n */\nexport function createCachedDescriptors(\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n): OptionsAndDescriptors {\n const { plugins, presets, passPerPreset } = options;\n return {\n options: optionsWithResolvedBrowserslistConfigFile(options, dirname),\n plugins: plugins\n ? () =>\n // @ts-expect-error todo(flow->ts) ts complains about incorrect arguments\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n createCachedPluginDescriptors(plugins, dirname)(alias)\n : () => handlerOf([]),\n presets: presets\n ? () =>\n // @ts-expect-error todo(flow->ts) ts complains about incorrect arguments\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n createCachedPresetDescriptors(presets, dirname)(alias)(\n !!passPerPreset,\n )\n : () => handlerOf([]),\n };\n}\n\n/**\n * Create a set of descriptors from a given options object, with consistent\n * identity for the descriptors, but not caching based on any specific identity.\n */\nexport function createUncachedDescriptors(\n dirname: string,\n options: ValidatedOptions,\n alias: string,\n): OptionsAndDescriptors {\n return {\n options: optionsWithResolvedBrowserslistConfigFile(options, dirname),\n // The returned result here is cached to represent a config object in\n // memory, so we build and memoize the descriptors to ensure the same\n // values are returned consistently.\n plugins: once(() =>\n createPluginDescriptors(options.plugins || [], dirname, alias),\n ),\n presets: once(() =>\n createPresetDescriptors(\n options.presets || [],\n dirname,\n alias,\n !!options.passPerPreset,\n ),\n ),\n };\n}\n\nconst PRESET_DESCRIPTOR_CACHE = new WeakMap();\nconst createCachedPresetDescriptors = makeWeakCacheSync(\n (items: PluginList, cache: CacheConfigurator) => {\n const dirname = cache.using(dir => dir);\n return makeStrongCacheSync((alias: string) =>\n makeStrongCache(function* (\n passPerPreset: boolean,\n ): Handler> {\n const descriptors = yield* createPresetDescriptors(\n items,\n dirname,\n alias,\n passPerPreset,\n );\n return descriptors.map(\n // Items are cached using the overall preset array identity when\n // possibly, but individual descriptors are also cached if a match\n // can be found in the previously-used descriptor lists.\n desc => loadCachedDescriptor(PRESET_DESCRIPTOR_CACHE, desc),\n );\n }),\n );\n },\n);\n\nconst PLUGIN_DESCRIPTOR_CACHE = new WeakMap();\nconst createCachedPluginDescriptors = makeWeakCacheSync(\n (items: PluginList, cache: CacheConfigurator) => {\n const dirname = cache.using(dir => dir);\n return makeStrongCache(function* (\n alias: string,\n ): Handler> {\n const descriptors = yield* createPluginDescriptors(items, dirname, alias);\n return descriptors.map(\n // Items are cached using the overall plugin array identity when\n // possibly, but individual descriptors are also cached if a match\n // can be found in the previously-used descriptor lists.\n desc => loadCachedDescriptor(PLUGIN_DESCRIPTOR_CACHE, desc),\n );\n });\n },\n);\n\n/**\n * When no options object is given in a descriptor, this object is used\n * as a WeakMap key in order to have consistent identity.\n */\nconst DEFAULT_OPTIONS = {};\n\n/**\n * Given the cache and a descriptor, returns a matching descriptor from the\n * cache, or else returns the input descriptor and adds it to the cache for\n * next time.\n */\nfunction loadCachedDescriptor(\n cache: WeakMap<{} | Function, WeakMap<{}, Array>>,\n desc: UnloadedDescriptor,\n) {\n const { value, options = DEFAULT_OPTIONS } = desc;\n if (options === false) return desc;\n\n let cacheByOptions = cache.get(value);\n if (!cacheByOptions) {\n cacheByOptions = new WeakMap();\n cache.set(value, cacheByOptions);\n }\n\n let possibilities = cacheByOptions.get(options);\n if (!possibilities) {\n possibilities = [];\n cacheByOptions.set(options, possibilities);\n }\n\n if (possibilities.indexOf(desc) === -1) {\n const matches = possibilities.filter(possibility =>\n isEqualDescriptor(possibility, desc),\n );\n if (matches.length > 0) {\n return matches[0];\n }\n\n possibilities.push(desc);\n }\n\n return desc;\n}\n\nfunction* createPresetDescriptors(\n items: PluginList,\n dirname: string,\n alias: string,\n passPerPreset: boolean,\n): Handler> {\n return yield* createDescriptors(\n \"preset\",\n items,\n dirname,\n alias,\n passPerPreset,\n );\n}\n\nfunction* createPluginDescriptors(\n items: PluginList,\n dirname: string,\n alias: string,\n): Handler> {\n return yield* createDescriptors(\"plugin\", items, dirname, alias);\n}\n\nfunction* createDescriptors(\n type: \"plugin\" | \"preset\",\n items: PluginList,\n dirname: string,\n alias: string,\n ownPass?: boolean,\n): Handler> {\n const descriptors = yield* gensync.all(\n items.map((item, index) =>\n createDescriptor(item, dirname, {\n type,\n alias: `${alias}$${index}`,\n ownPass: !!ownPass,\n }),\n ),\n );\n\n assertNoDuplicates(descriptors);\n\n return descriptors;\n}\n\n/**\n * Given a plugin/preset item, resolve it into a standard format.\n */\nexport function* createDescriptor(\n pair: PluginItem,\n dirname: string,\n {\n type,\n alias,\n ownPass,\n }: {\n type?: \"plugin\" | \"preset\";\n alias: string;\n ownPass?: boolean;\n },\n): Handler {\n const desc = getItemDescriptor(pair);\n if (desc) {\n return desc;\n }\n\n let name;\n let options;\n // todo(flow->ts) better type annotation\n let value: any = pair;\n if (Array.isArray(value)) {\n if (value.length === 3) {\n [value, options, name] = value;\n } else {\n [value, options] = value;\n }\n }\n\n let file = undefined;\n let filepath = null;\n if (typeof value === \"string\") {\n if (typeof type !== \"string\") {\n throw new Error(\n \"To resolve a string-based item, the type of item must be given\",\n );\n }\n const resolver = type === \"plugin\" ? loadPlugin : loadPreset;\n const request = value;\n\n ({ filepath, value } = yield* resolver(value, dirname));\n\n file = {\n request,\n resolved: filepath,\n };\n }\n\n if (!value) {\n throw new Error(`Unexpected falsy value: ${String(value)}`);\n }\n\n if (typeof value === \"object\" && value.__esModule) {\n if (value.default) {\n value = value.default;\n } else {\n throw new Error(\"Must export a default export when using ES6 modules.\");\n }\n }\n\n if (typeof value !== \"object\" && typeof value !== \"function\") {\n throw new Error(\n `Unsupported format: ${typeof value}. Expected an object or a function.`,\n );\n }\n\n if (filepath !== null && typeof value === \"object\" && value) {\n // We allow object values for plugins/presets nested directly within a\n // config object, because it can be useful to define them in nested\n // configuration contexts.\n throw new Error(\n `Plugin/Preset files are not allowed to export objects, only functions. In ${filepath}`,\n );\n }\n\n return {\n name,\n alias: filepath || alias,\n value,\n options,\n dirname,\n ownPass,\n file,\n };\n}\n\nfunction assertNoDuplicates(items: Array): void {\n const map = new Map();\n\n for (const item of items) {\n if (typeof item.value !== \"function\") continue;\n\n let nameMap = map.get(item.value);\n if (!nameMap) {\n nameMap = new Set();\n map.set(item.value, nameMap);\n }\n\n if (nameMap.has(item.name)) {\n const conflicts = items.filter(i => i.value === item.value);\n throw new Error(\n [\n `Duplicate plugin/preset detected.`,\n `If you'd like to use two separate instances of a plugin,`,\n `they need separate names, e.g.`,\n ``,\n ` plugins: [`,\n ` ['some-plugin', {}],`,\n ` ['some-plugin', {}, 'some unique name'],`,\n ` ]`,\n ``,\n `Duplicates detected are:`,\n `${JSON.stringify(conflicts, null, 2)}`,\n ].join(\"\\n\"),\n );\n }\n\n nameMap.add(item.name);\n }\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AAEA;AAEA;AAEA;AAaA;AA2BA,SAASA,iBAAiB,CACxBC,CAAqB,EACrBC,CAAqB,EACZ;EACT,OACED,CAAC,CAACE,IAAI,KAAKD,CAAC,CAACC,IAAI,IACjBF,CAAC,CAACG,KAAK,KAAKF,CAAC,CAACE,KAAK,IACnBH,CAAC,CAACI,OAAO,KAAKH,CAAC,CAACG,OAAO,IACvBJ,CAAC,CAACK,OAAO,KAAKJ,CAAC,CAACI,OAAO,IACvBL,CAAC,CAACM,KAAK,KAAKL,CAAC,CAACK,KAAK,IACnBN,CAAC,CAACO,OAAO,KAAKN,CAAC,CAACM,OAAO,IACvB,CAACP,CAAC,CAACQ,IAAI,IAAIR,CAAC,CAACQ,IAAI,CAACC,OAAO,OAAOR,CAAC,CAACO,IAAI,IAAIP,CAAC,CAACO,IAAI,CAACC,OAAO,CAAC,IACzD,CAACT,CAAC,CAACQ,IAAI,IAAIR,CAAC,CAACQ,IAAI,CAACE,QAAQ,OAAOT,CAAC,CAACO,IAAI,IAAIP,CAAC,CAACO,IAAI,CAACE,QAAQ,CAAC;AAE/D;AASA,UAAUC,SAAS,CAAIR,KAAQ,EAAc;EAC3C,OAAOA,KAAK;AACd;AAEA,SAASS,yCAAyC,CAChDR,OAAyB,EACzBC,OAAe,EACG;EAClB,IAAI,OAAOD,OAAO,CAACS,sBAAsB,KAAK,QAAQ,EAAE;IACtDT,OAAO,CAACS,sBAAsB,GAAG,IAAAC,6CAA6B,EAC5DV,OAAO,CAAC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/C,KAAK,CAACkB,MAAM,CAAC8B,CAAC,IAAIA,CAAC,CAACzE,KAAK,KAAKmD,IAAI,CAACnD,KAAK,CAAC;MAC3D,MAAM,IAAI6D,KAAK,CACb,CACG,mCAAkC,EAClC,0DAAyD,EACzD,gCAA+B,EAC/B,EAAC,EACD,cAAa,EACb,0BAAyB,EACzB,8CAA6C,EAC7C,KAAI,EACJ,EAAC,EACD,0BAAyB,EACzB,GAAEa,IAAI,CAACC,SAAS,CAACH,SAAS,EAAE,IAAI,EAAE,CAAC,CAAE,EAAC,CACxC,CAACI,IAAI,CAAC,IAAI,CAAC,CACb;IACH;IAEAP,OAAO,CAACQ,GAAG,CAAC1B,IAAI,CAACpD,IAAI,CAAC;EACxB;AACF;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/configuration.js b/node_modules/@babel/core/lib/config/files/configuration.js index 27d4f0e03..d5494d551 100644 --- a/node_modules/@babel/core/lib/config/files/configuration.js +++ b/node_modules/@babel/core/lib/config/files/configuration.js @@ -9,192 +9,61 @@ exports.findRelativeConfig = findRelativeConfig; exports.findRootConfig = findRootConfig; exports.loadConfig = loadConfig; exports.resolveShowConfigPath = resolveShowConfigPath; - function _debug() { const data = require("debug"); - _debug = function () { return data; }; - return data; } - function _fs() { const data = require("fs"); - _fs = function () { return data; }; - return data; } - function _path() { const data = require("path"); - _path = function () { return data; }; - return data; } - function _json() { const data = require("json5"); - _json = function () { return data; }; - return data; } - function _gensync() { const data = require("gensync"); - _gensync = function () { return data; }; - return data; } - var _caching = require("../caching"); - var _configApi = require("../helpers/config-api"); - var _utils = require("./utils"); - var _moduleTypes = require("./module-types"); - var _patternToRegex = require("../pattern-to-regex"); - var _configError = require("../../errors/config-error"); - var fs = require("../../gensync-utils/fs"); - function _module() { const data = require("module"); - _module = function () { return data; }; - return data; } - var _rewriteStackTrace = require("../../errors/rewrite-stack-trace"); - const debug = _debug()("babel:config:loading:files:configuration"); - const ROOT_CONFIG_FILENAMES = ["babel.config.js", "babel.config.cjs", "babel.config.mjs", "babel.config.json"]; exports.ROOT_CONFIG_FILENAMES = ROOT_CONFIG_FILENAMES; const RELATIVE_CONFIG_FILENAMES = [".babelrc", ".babelrc.js", ".babelrc.cjs", ".babelrc.mjs", ".babelrc.json"]; const BABELIGNORE_FILENAME = ".babelignore"; - -function findConfigUpwards(rootDir) { - let dirname = rootDir; - - for (;;) { - for (const filename of ROOT_CONFIG_FILENAMES) { - if (_fs().existsSync(_path().join(dirname, filename))) { - return dirname; - } - } - - const nextDir = _path().dirname(dirname); - - if (dirname === nextDir) break; - dirname = nextDir; - } - - return null; -} - -function* findRelativeConfig(packageData, envName, caller) { - let config = null; - let ignore = null; - - const dirname = _path().dirname(packageData.filepath); - - for (const loc of packageData.directories) { - if (!config) { - var _packageData$pkg; - - config = yield* loadOneConfig(RELATIVE_CONFIG_FILENAMES, loc, envName, caller, ((_packageData$pkg = packageData.pkg) == null ? void 0 : _packageData$pkg.dirname) === loc ? packageToBabelConfig(packageData.pkg) : null); - } - - if (!ignore) { - const ignoreLoc = _path().join(loc, BABELIGNORE_FILENAME); - - ignore = yield* readIgnoreConfig(ignoreLoc); - - if (ignore) { - debug("Found ignore %o from %o.", ignore.filepath, dirname); - } - } - } - - return { - config, - ignore - }; -} - -function findRootConfig(dirname, envName, caller) { - return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller); -} - -function* loadOneConfig(names, dirname, envName, caller, previousConfig = null) { - const configs = yield* _gensync().all(names.map(filename => readConfig(_path().join(dirname, filename), envName, caller))); - const config = configs.reduce((previousConfig, config) => { - if (config && previousConfig) { - throw new _configError.default(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().basename(previousConfig.filepath)}\n` + ` - ${config.filepath}\n` + `from ${dirname}`); - } - - return config || previousConfig; - }, previousConfig); - - if (config) { - debug("Found configuration %o from %o.", config.filepath, dirname); - } - - return config; -} - -function* loadConfig(name, dirname, envName, caller) { - const filepath = (((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "8.9") ? require.resolve : (r, { - paths: [b] - }, M = require("module")) => { - let f = M._findPath(r, M._nodeModulePaths(b).concat(b)); - - if (f) return f; - f = new Error(`Cannot resolve module '${r}'`); - f.code = "MODULE_NOT_FOUND"; - throw f; - })(name, { - paths: [dirname] - }); - const conf = yield* readConfig(filepath, envName, caller); - - if (!conf) { - throw new _configError.default(`Config file contains no configuration data`, filepath); - } - - debug("Loaded config %o from %o.", name, dirname); - return conf; -} - -function readConfig(filepath, envName, caller) { - const ext = _path().extname(filepath); - - return ext === ".js" || ext === ".cjs" || ext === ".mjs" ? readConfigJS(filepath, { - envName, - caller - }) : readConfigJSON5(filepath); -} - const LOADING_CONFIGS = new Set(); const readConfigJS = (0, _caching.makeStrongCache)(function* readConfigJS(filepath, cache) { if (!_fs().existsSync(filepath)) { @@ -211,24 +80,19 @@ const readConfigJS = (0, _caching.makeStrongCache)(function* readConfigJS(filepa options: {} }; } - let options; - try { LOADING_CONFIGS.add(filepath); options = yield* (0, _moduleTypes.default)(filepath, "You appear to be using a native ECMAScript module configuration " + "file, which is only supported when running Babel asynchronously."); } finally { LOADING_CONFIGS.delete(filepath); } - let assertCache = false; - if (typeof options === "function") { yield* []; options = (0, _rewriteStackTrace.endHiddenCallStack)(options)((0, _configApi.makeConfigAPI)(cache)); assertCache = true; } - if (!options || typeof options !== "object" || Array.isArray(options)) { throw new _configError.default(`Configuration should be an exported JavaScript object.`, filepath); } @@ -236,7 +100,6 @@ const readConfigJS = (0, _caching.makeStrongCache)(function* readConfigJS(filepa if (typeof options.then === "function") { throw new _configError.default(`You appear to be using an async configuration, ` + `which your current version of Babel does not support. ` + `We may add support for this in the future, ` + `but if you're on the most recent version of @babel/core and still ` + `seeing this error, then you'll need to synchronously return your config.`, filepath); } - if (assertCache && !cache.configured()) throwConfigError(filepath); return { filepath, @@ -247,11 +110,9 @@ const readConfigJS = (0, _caching.makeStrongCache)(function* readConfigJS(filepa const packageToBabelConfig = (0, _caching.makeWeakCacheSync)(file => { const babel = file.options["babel"]; if (typeof babel === "undefined") return null; - if (typeof babel !== "object" || Array.isArray(babel) || babel === null) { throw new _configError.default(`.babel property must be an object`, file.filepath); } - return { filepath: file.filepath, dirname: file.dirname, @@ -260,23 +121,18 @@ const packageToBabelConfig = (0, _caching.makeWeakCacheSync)(file => { }); const readConfigJSON5 = (0, _utils.makeStaticFileCache)((filepath, content) => { let options; - try { options = _json().parse(content); } catch (err) { throw new _configError.default(`Error while parsing config - ${err.message}`, filepath); } - if (!options) throw new _configError.default(`No config detected`, filepath); - if (typeof options !== "object") { throw new _configError.default(`Config returned typeof ${typeof options}`, filepath); } - if (Array.isArray(options)) { throw new _configError.default(`Expected config object but found array`, filepath); } - delete options["$schema"]; return { filepath, @@ -286,40 +142,109 @@ const readConfigJSON5 = (0, _utils.makeStaticFileCache)((filepath, content) => { }); const readIgnoreConfig = (0, _utils.makeStaticFileCache)((filepath, content) => { const ignoreDir = _path().dirname(filepath); - const ignorePatterns = content.split("\n").map(line => line.replace(/#(.*?)$/, "").trim()).filter(line => !!line); - for (const pattern of ignorePatterns) { if (pattern[0] === "!") { throw new _configError.default(`Negation of file paths is not supported.`, filepath); } } - return { filepath, dirname: _path().dirname(filepath), ignore: ignorePatterns.map(pattern => (0, _patternToRegex.default)(pattern, ignoreDir)) }; }); +function findConfigUpwards(rootDir) { + let dirname = rootDir; + for (;;) { + for (const filename of ROOT_CONFIG_FILENAMES) { + if (_fs().existsSync(_path().join(dirname, filename))) { + return dirname; + } + } + const nextDir = _path().dirname(dirname); + if (dirname === nextDir) break; + dirname = nextDir; + } + return null; +} +function* findRelativeConfig(packageData, envName, caller) { + let config = null; + let ignore = null; + const dirname = _path().dirname(packageData.filepath); + for (const loc of packageData.directories) { + if (!config) { + var _packageData$pkg; + config = yield* loadOneConfig(RELATIVE_CONFIG_FILENAMES, loc, envName, caller, ((_packageData$pkg = packageData.pkg) == null ? void 0 : _packageData$pkg.dirname) === loc ? packageToBabelConfig(packageData.pkg) : null); + } + if (!ignore) { + const ignoreLoc = _path().join(loc, BABELIGNORE_FILENAME); + ignore = yield* readIgnoreConfig(ignoreLoc); + if (ignore) { + debug("Found ignore %o from %o.", ignore.filepath, dirname); + } + } + } + return { + config, + ignore + }; +} +function findRootConfig(dirname, envName, caller) { + return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller); +} +function* loadOneConfig(names, dirname, envName, caller, previousConfig = null) { + const configs = yield* _gensync().all(names.map(filename => readConfig(_path().join(dirname, filename), envName, caller))); + const config = configs.reduce((previousConfig, config) => { + if (config && previousConfig) { + throw new _configError.default(`Multiple configuration files found. Please remove one:\n` + ` - ${_path().basename(previousConfig.filepath)}\n` + ` - ${config.filepath}\n` + `from ${dirname}`); + } + return config || previousConfig; + }, previousConfig); + if (config) { + debug("Found configuration %o from %o.", config.filepath, dirname); + } + return config; +} +function* loadConfig(name, dirname, envName, caller) { + const filepath = (((v, w) => (v = v.split("."), w = w.split("."), +v[0] > +w[0] || v[0] == w[0] && +v[1] >= +w[1]))(process.versions.node, "8.9") ? require.resolve : (r, { + paths: [b] + }, M = require("module")) => { + let f = M._findPath(r, M._nodeModulePaths(b).concat(b)); + if (f) return f; + f = new Error(`Cannot resolve module '${r}'`); + f.code = "MODULE_NOT_FOUND"; + throw f; + })(name, { + paths: [dirname] + }); + const conf = yield* readConfig(filepath, envName, caller); + if (!conf) { + throw new _configError.default(`Config file contains no configuration data`, filepath); + } + debug("Loaded config %o from %o.", name, dirname); + return conf; +} +function readConfig(filepath, envName, caller) { + const ext = _path().extname(filepath); + return ext === ".js" || ext === ".cjs" || ext === ".mjs" ? readConfigJS(filepath, { + envName, + caller + }) : readConfigJSON5(filepath); +} function* resolveShowConfigPath(dirname) { const targetPath = process.env.BABEL_SHOW_CONFIG_FOR; - if (targetPath != null) { const absolutePath = _path().resolve(dirname, targetPath); - const stats = yield* fs.stat(absolutePath); - if (!stats.isFile()) { throw new Error(`${absolutePath}: BABEL_SHOW_CONFIG_FOR must refer to a regular file, directories are not supported.`); } - return absolutePath; } - return null; } - function throwConfigError(filepath) { throw new _configError.default(`\ Caching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured @@ -356,7 +281,6 @@ module.exports = function(api) { return { }; };`, filepath); } - 0 && 0; //# sourceMappingURL=configuration.js.map diff --git a/node_modules/@babel/core/lib/config/files/configuration.js.map b/node_modules/@babel/core/lib/config/files/configuration.js.map index c237d12b7..fc29920cd 100644 --- a/node_modules/@babel/core/lib/config/files/configuration.js.map +++ b/node_modules/@babel/core/lib/config/files/configuration.js.map @@ -1 +1 @@ -{"version":3,"names":["debug","buildDebug","ROOT_CONFIG_FILENAMES","RELATIVE_CONFIG_FILENAMES","BABELIGNORE_FILENAME","findConfigUpwards","rootDir","dirname","filename","nodeFs","existsSync","path","join","nextDir","findRelativeConfig","packageData","envName","caller","config","ignore","filepath","loc","directories","loadOneConfig","pkg","packageToBabelConfig","ignoreLoc","readIgnoreConfig","findRootConfig","names","previousConfig","configs","gensync","all","map","readConfig","reduce","ConfigError","basename","loadConfig","name","paths","conf","ext","extname","readConfigJS","readConfigJSON5","LOADING_CONFIGS","Set","makeStrongCache","cache","never","has","options","add","loadCjsOrMjsDefault","delete","assertCache","endHiddenCallStack","makeConfigAPI","Array","isArray","then","configured","throwConfigError","makeWeakCacheSync","file","babel","makeStaticFileCache","content","json5","parse","err","message","ignoreDir","ignorePatterns","split","line","replace","trim","filter","pattern","pathPatternToRegex","resolveShowConfigPath","targetPath","process","env","BABEL_SHOW_CONFIG_FOR","absolutePath","resolve","stats","fs","stat","isFile","Error"],"sources":["../../../src/config/files/configuration.ts"],"sourcesContent":["import buildDebug from \"debug\";\nimport nodeFs from \"fs\";\nimport path from \"path\";\nimport json5 from \"json5\";\nimport gensync from \"gensync\";\nimport type { Handler } from \"gensync\";\nimport { makeStrongCache, makeWeakCacheSync } from \"../caching\";\nimport type { CacheConfigurator } from \"../caching\";\nimport { makeConfigAPI } from \"../helpers/config-api\";\nimport type { ConfigAPI } from \"../helpers/config-api\";\nimport { makeStaticFileCache } from \"./utils\";\nimport loadCjsOrMjsDefault from \"./module-types\";\nimport pathPatternToRegex from \"../pattern-to-regex\";\nimport type { FilePackageData, RelativeConfig, ConfigFile } from \"./types\";\nimport type { CallerMetadata } from \"../validation/options\";\nimport ConfigError from \"../../errors/config-error\";\n\nimport * as fs from \"../../gensync-utils/fs\";\n\nimport { createRequire } from \"module\";\nimport { endHiddenCallStack } from \"../../errors/rewrite-stack-trace\";\nconst require = createRequire(import.meta.url);\n\nconst debug = buildDebug(\"babel:config:loading:files:configuration\");\n\nexport const ROOT_CONFIG_FILENAMES = [\n \"babel.config.js\",\n \"babel.config.cjs\",\n \"babel.config.mjs\",\n \"babel.config.json\",\n];\nconst RELATIVE_CONFIG_FILENAMES = [\n \".babelrc\",\n \".babelrc.js\",\n \".babelrc.cjs\",\n \".babelrc.mjs\",\n \".babelrc.json\",\n];\n\nconst BABELIGNORE_FILENAME = \".babelignore\";\n\nexport function findConfigUpwards(rootDir: string): string | null {\n let dirname = rootDir;\n for (;;) {\n for (const filename of ROOT_CONFIG_FILENAMES) {\n if (nodeFs.existsSync(path.join(dirname, filename))) {\n return dirname;\n }\n }\n\n const nextDir = path.dirname(dirname);\n if (dirname === nextDir) break;\n dirname = nextDir;\n }\n\n return null;\n}\n\nexport function* findRelativeConfig(\n packageData: FilePackageData,\n envName: string,\n caller: CallerMetadata | undefined,\n): Handler {\n let config = null;\n let ignore = null;\n\n const dirname = path.dirname(packageData.filepath);\n\n for (const loc of packageData.directories) {\n if (!config) {\n config = yield* loadOneConfig(\n RELATIVE_CONFIG_FILENAMES,\n loc,\n envName,\n caller,\n packageData.pkg?.dirname === loc\n ? packageToBabelConfig(packageData.pkg as ConfigFile)\n : null,\n );\n }\n\n if (!ignore) {\n const ignoreLoc = path.join(loc, BABELIGNORE_FILENAME);\n ignore = yield* readIgnoreConfig(ignoreLoc);\n\n if (ignore) {\n debug(\"Found ignore %o from %o.\", ignore.filepath, dirname);\n }\n }\n }\n\n return { config, ignore };\n}\n\nexport function findRootConfig(\n dirname: string,\n envName: string,\n caller: CallerMetadata | undefined,\n): Handler {\n return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller);\n}\n\nfunction* loadOneConfig(\n names: string[],\n dirname: string,\n envName: string,\n caller: CallerMetadata | undefined,\n previousConfig: ConfigFile | null = null,\n): Handler {\n const configs = yield* gensync.all(\n names.map(filename =>\n readConfig(path.join(dirname, filename), envName, caller),\n ),\n );\n const config = configs.reduce((previousConfig: ConfigFile | null, config) => {\n if (config && previousConfig) {\n throw new ConfigError(\n `Multiple configuration files found. Please remove one:\\n` +\n ` - ${path.basename(previousConfig.filepath)}\\n` +\n ` - ${config.filepath}\\n` +\n `from ${dirname}`,\n );\n }\n\n return config || previousConfig;\n }, previousConfig);\n\n if (config) {\n debug(\"Found configuration %o from %o.\", config.filepath, dirname);\n }\n return config;\n}\n\nexport function* loadConfig(\n name: string,\n dirname: string,\n envName: string,\n caller: CallerMetadata | undefined,\n): Handler {\n const filepath = require.resolve(name, { paths: [dirname] });\n\n const conf = yield* readConfig(filepath, envName, caller);\n if (!conf) {\n throw new ConfigError(\n `Config file contains no configuration data`,\n filepath,\n );\n }\n\n debug(\"Loaded config %o from %o.\", name, dirname);\n return conf;\n}\n\n/**\n * Read the given config file, returning the result. Returns null if no config was found, but will\n * throw if there are parsing errors while loading a config.\n */\nfunction readConfig(\n filepath: string,\n envName: string,\n caller: CallerMetadata | undefined,\n): Handler {\n const ext = path.extname(filepath);\n return ext === \".js\" || ext === \".cjs\" || ext === \".mjs\"\n ? readConfigJS(filepath, { envName, caller })\n : readConfigJSON5(filepath);\n}\n\nconst LOADING_CONFIGS = new Set();\n\nconst readConfigJS = makeStrongCache(function* readConfigJS(\n filepath: string,\n cache: CacheConfigurator<{\n envName: string;\n caller: CallerMetadata | undefined;\n }>,\n): Handler {\n if (!nodeFs.existsSync(filepath)) {\n cache.never();\n return null;\n }\n\n // The `require()` call below can make this code reentrant if a require hook like @babel/register has been\n // loaded into the system. That would cause Babel to attempt to compile the `.babelrc.js` file as it loads\n // below. To cover this case, we auto-ignore re-entrant config processing.\n if (LOADING_CONFIGS.has(filepath)) {\n cache.never();\n\n debug(\"Auto-ignoring usage of config %o.\", filepath);\n return {\n filepath,\n dirname: path.dirname(filepath),\n options: {},\n };\n }\n\n let options: unknown;\n try {\n LOADING_CONFIGS.add(filepath);\n options = yield* loadCjsOrMjsDefault(\n filepath,\n \"You appear to be using a native ECMAScript module configuration \" +\n \"file, which is only supported when running Babel asynchronously.\",\n );\n } finally {\n LOADING_CONFIGS.delete(filepath);\n }\n\n let assertCache = false;\n if (typeof options === \"function\") {\n // @ts-expect-error - if we want to make it possible to use async configs\n yield* [];\n\n options = endHiddenCallStack(options as any as (api: ConfigAPI) => {})(\n makeConfigAPI(cache),\n );\n\n assertCache = true;\n }\n\n if (!options || typeof options !== \"object\" || Array.isArray(options)) {\n throw new ConfigError(\n `Configuration should be an exported JavaScript object.`,\n filepath,\n );\n }\n\n // @ts-expect-error todo(flow->ts)\n if (typeof options.then === \"function\") {\n throw new ConfigError(\n `You appear to be using an async configuration, ` +\n `which your current version of Babel does not support. ` +\n `We may add support for this in the future, ` +\n `but if you're on the most recent version of @babel/core and still ` +\n `seeing this error, then you'll need to synchronously return your config.`,\n filepath,\n );\n }\n\n if (assertCache && !cache.configured()) throwConfigError(filepath);\n\n return {\n filepath,\n dirname: path.dirname(filepath),\n options,\n };\n});\n\nconst packageToBabelConfig = makeWeakCacheSync(\n (file: ConfigFile): ConfigFile | null => {\n const babel: unknown = file.options[\"babel\"];\n\n if (typeof babel === \"undefined\") return null;\n\n if (typeof babel !== \"object\" || Array.isArray(babel) || babel === null) {\n throw new ConfigError(`.babel property must be an object`, file.filepath);\n }\n\n return {\n filepath: file.filepath,\n dirname: file.dirname,\n options: babel,\n };\n },\n);\n\nconst readConfigJSON5 = makeStaticFileCache((filepath, content): ConfigFile => {\n let options;\n try {\n options = json5.parse(content);\n } catch (err) {\n throw new ConfigError(\n `Error while parsing config - ${err.message}`,\n filepath,\n );\n }\n\n if (!options) throw new ConfigError(`No config detected`, filepath);\n\n if (typeof options !== \"object\") {\n throw new ConfigError(`Config returned typeof ${typeof options}`, filepath);\n }\n if (Array.isArray(options)) {\n throw new ConfigError(`Expected config object but found array`, filepath);\n }\n\n delete options[\"$schema\"];\n\n return {\n filepath,\n dirname: path.dirname(filepath),\n options,\n };\n});\n\nconst readIgnoreConfig = makeStaticFileCache((filepath, content) => {\n const ignoreDir = path.dirname(filepath);\n const ignorePatterns = content\n .split(\"\\n\")\n .map(line => line.replace(/#(.*?)$/, \"\").trim())\n .filter(line => !!line);\n\n for (const pattern of ignorePatterns) {\n if (pattern[0] === \"!\") {\n throw new ConfigError(\n `Negation of file paths is not supported.`,\n filepath,\n );\n }\n }\n\n return {\n filepath,\n dirname: path.dirname(filepath),\n ignore: ignorePatterns.map(pattern =>\n pathPatternToRegex(pattern, ignoreDir),\n ),\n };\n});\n\nexport function* resolveShowConfigPath(\n dirname: string,\n): Handler {\n const targetPath = process.env.BABEL_SHOW_CONFIG_FOR;\n if (targetPath != null) {\n const absolutePath = path.resolve(dirname, targetPath);\n const stats = yield* fs.stat(absolutePath);\n if (!stats.isFile()) {\n throw new Error(\n `${absolutePath}: BABEL_SHOW_CONFIG_FOR must refer to a regular file, directories are not supported.`,\n );\n }\n return absolutePath;\n }\n return null;\n}\n\nfunction throwConfigError(filepath: string): never {\n throw new ConfigError(\n `\\\nCaching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured\nfor various types of caching, using the first param of their handler functions:\n\nmodule.exports = function(api) {\n // The API exposes the following:\n\n // Cache the returned value forever and don't call this function again.\n api.cache(true);\n\n // Don't cache at all. Not recommended because it will be very slow.\n api.cache(false);\n\n // Cached based on the value of some function. If this function returns a value different from\n // a previously-encountered value, the plugins will re-evaluate.\n var env = api.cache(() => process.env.NODE_ENV);\n\n // If testing for a specific env, we recommend specifics to avoid instantiating a plugin for\n // any possible NODE_ENV value that might come up during plugin execution.\n var isProd = api.cache(() => process.env.NODE_ENV === \"production\");\n\n // .cache(fn) will perform a linear search though instances to find the matching plugin based\n // based on previous instantiated plugins. If you want to recreate the plugin and discard the\n // previous instance whenever something changes, you may use:\n var isProd = api.cache.invalidate(() => process.env.NODE_ENV === \"production\");\n\n // Note, we also expose the following more-verbose versions of the above examples:\n api.cache.forever(); // api.cache(true)\n api.cache.never(); // api.cache(false)\n api.cache.using(fn); // api.cache(fn)\n\n // Return the value that will be cached.\n return { };\n};`,\n filepath,\n );\n}\n"],"mappings":";;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;;AAEA;;AAEA;;AACA;;AACA;;AAGA;;AAEA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;;AAGA,MAAMA,KAAK,GAAGC,QAAA,CAAW,0CAAX,CAAd;;AAEO,MAAMC,qBAAqB,GAAG,CACnC,iBADmC,EAEnC,kBAFmC,EAGnC,kBAHmC,EAInC,mBAJmC,CAA9B;;AAMP,MAAMC,yBAAyB,GAAG,CAChC,UADgC,EAEhC,aAFgC,EAGhC,cAHgC,EAIhC,cAJgC,EAKhC,eALgC,CAAlC;AAQA,MAAMC,oBAAoB,GAAG,cAA7B;;AAEO,SAASC,iBAAT,CAA2BC,OAA3B,EAA2D;EAChE,IAAIC,OAAO,GAAGD,OAAd;;EACA,SAAS;IACP,KAAK,MAAME,QAAX,IAAuBN,qBAAvB,EAA8C;MAC5C,IAAIO,KAAA,CAAOC,UAAP,CAAkBC,OAAA,CAAKC,IAAL,CAAU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,QAnCI,CAAN;AAqCD"} \ No newline at end of file +{"version":3,"names":["debug","buildDebug","ROOT_CONFIG_FILENAMES","RELATIVE_CONFIG_FILENAMES","BABELIGNORE_FILENAME","LOADING_CONFIGS","Set","readConfigJS","makeStrongCache","filepath","cache","nodeFs","existsSync","never","has","dirname","path","options","add","loadCjsOrMjsDefault","delete","assertCache","endHiddenCallStack","makeConfigAPI","Array","isArray","ConfigError","then","configured","throwConfigError","packageToBabelConfig","makeWeakCacheSync","file","babel","readConfigJSON5","makeStaticFileCache","content","json5","parse","err","message","readIgnoreConfig","ignoreDir","ignorePatterns","split","map","line","replace","trim","filter","pattern","ignore","pathPatternToRegex","findConfigUpwards","rootDir","filename","join","nextDir","findRelativeConfig","packageData","envName","caller","config","loc","directories","loadOneConfig","pkg","ignoreLoc","findRootConfig","names","previousConfig","configs","gensync","all","readConfig","reduce","basename","loadConfig","name","paths","conf","ext","extname","resolveShowConfigPath","targetPath","process","env","BABEL_SHOW_CONFIG_FOR","absolutePath","resolve","stats","fs","stat","isFile","Error"],"sources":["../../../src/config/files/configuration.ts"],"sourcesContent":["import buildDebug from \"debug\";\nimport nodeFs from \"fs\";\nimport path from \"path\";\nimport json5 from \"json5\";\nimport gensync from \"gensync\";\nimport type { Handler } from \"gensync\";\nimport { makeStrongCache, makeWeakCacheSync } from \"../caching\";\nimport type { CacheConfigurator } from \"../caching\";\nimport { makeConfigAPI } from \"../helpers/config-api\";\nimport type { ConfigAPI } from \"../helpers/config-api\";\nimport { makeStaticFileCache } from \"./utils\";\nimport loadCjsOrMjsDefault from \"./module-types\";\nimport pathPatternToRegex from \"../pattern-to-regex\";\nimport type { FilePackageData, RelativeConfig, ConfigFile } from \"./types\";\nimport type { CallerMetadata } from \"../validation/options\";\nimport ConfigError from \"../../errors/config-error\";\n\nimport * as fs from \"../../gensync-utils/fs\";\n\nimport { createRequire } from \"module\";\nimport { endHiddenCallStack } from \"../../errors/rewrite-stack-trace\";\nconst require = createRequire(import.meta.url);\n\nconst debug = buildDebug(\"babel:config:loading:files:configuration\");\n\nexport const ROOT_CONFIG_FILENAMES = [\n \"babel.config.js\",\n \"babel.config.cjs\",\n \"babel.config.mjs\",\n \"babel.config.json\",\n];\nconst RELATIVE_CONFIG_FILENAMES = [\n \".babelrc\",\n \".babelrc.js\",\n \".babelrc.cjs\",\n \".babelrc.mjs\",\n \".babelrc.json\",\n];\n\nconst BABELIGNORE_FILENAME = \".babelignore\";\n\nconst LOADING_CONFIGS = new Set();\n\nconst readConfigJS = makeStrongCache(function* readConfigJS(\n filepath: string,\n cache: CacheConfigurator<{\n envName: string;\n caller: CallerMetadata | undefined;\n }>,\n): Handler {\n if (!nodeFs.existsSync(filepath)) {\n cache.never();\n return null;\n }\n\n // The `require()` call below can make this code reentrant if a require hook like @babel/register has been\n // loaded into the system. That would cause Babel to attempt to compile the `.babelrc.js` file as it loads\n // below. To cover this case, we auto-ignore re-entrant config processing.\n if (LOADING_CONFIGS.has(filepath)) {\n cache.never();\n\n debug(\"Auto-ignoring usage of config %o.\", filepath);\n return {\n filepath,\n dirname: path.dirname(filepath),\n options: {},\n };\n }\n\n let options: unknown;\n try {\n LOADING_CONFIGS.add(filepath);\n options = yield* loadCjsOrMjsDefault(\n filepath,\n \"You appear to be using a native ECMAScript module configuration \" +\n \"file, which is only supported when running Babel asynchronously.\",\n );\n } finally {\n LOADING_CONFIGS.delete(filepath);\n }\n\n let assertCache = false;\n if (typeof options === \"function\") {\n // @ts-expect-error - if we want to make it possible to use async configs\n yield* [];\n\n options = endHiddenCallStack(options as any as (api: ConfigAPI) => {})(\n makeConfigAPI(cache),\n );\n\n assertCache = true;\n }\n\n if (!options || typeof options !== \"object\" || Array.isArray(options)) {\n throw new ConfigError(\n `Configuration should be an exported JavaScript object.`,\n filepath,\n );\n }\n\n // @ts-expect-error todo(flow->ts)\n if (typeof options.then === \"function\") {\n throw new ConfigError(\n `You appear to be using an async configuration, ` +\n `which your current version of Babel does not support. ` +\n `We may add support for this in the future, ` +\n `but if you're on the most recent version of @babel/core and still ` +\n `seeing this error, then you'll need to synchronously return your config.`,\n filepath,\n );\n }\n\n if (assertCache && !cache.configured()) throwConfigError(filepath);\n\n return {\n filepath,\n dirname: path.dirname(filepath),\n options,\n };\n});\n\nconst packageToBabelConfig = makeWeakCacheSync(\n (file: ConfigFile): ConfigFile | null => {\n const babel: unknown = file.options[\"babel\"];\n\n if (typeof babel === \"undefined\") return null;\n\n if (typeof babel !== \"object\" || Array.isArray(babel) || babel === null) {\n throw new ConfigError(`.babel property must be an object`, file.filepath);\n }\n\n return {\n filepath: file.filepath,\n dirname: file.dirname,\n options: babel,\n };\n },\n);\n\nconst readConfigJSON5 = makeStaticFileCache((filepath, content): ConfigFile => {\n let options;\n try {\n options = json5.parse(content);\n } catch (err) {\n throw new ConfigError(\n `Error while parsing config - ${err.message}`,\n filepath,\n );\n }\n\n if (!options) throw new ConfigError(`No config detected`, filepath);\n\n if (typeof options !== \"object\") {\n throw new ConfigError(`Config returned typeof ${typeof options}`, filepath);\n }\n if (Array.isArray(options)) {\n throw new ConfigError(`Expected config object but found array`, filepath);\n }\n\n delete options[\"$schema\"];\n\n return {\n filepath,\n dirname: path.dirname(filepath),\n options,\n };\n});\n\nconst readIgnoreConfig = makeStaticFileCache((filepath, content) => {\n const ignoreDir = path.dirname(filepath);\n const ignorePatterns = content\n .split(\"\\n\")\n .map(line => line.replace(/#(.*?)$/, \"\").trim())\n .filter(line => !!line);\n\n for (const pattern of ignorePatterns) {\n if (pattern[0] === \"!\") {\n throw new ConfigError(\n `Negation of file paths is not supported.`,\n filepath,\n );\n }\n }\n\n return {\n filepath,\n dirname: path.dirname(filepath),\n ignore: ignorePatterns.map(pattern =>\n pathPatternToRegex(pattern, ignoreDir),\n ),\n };\n});\n\nexport function findConfigUpwards(rootDir: string): string | null {\n let dirname = rootDir;\n for (;;) {\n for (const filename of ROOT_CONFIG_FILENAMES) {\n if (nodeFs.existsSync(path.join(dirname, filename))) {\n return dirname;\n }\n }\n\n const nextDir = path.dirname(dirname);\n if (dirname === nextDir) break;\n dirname = nextDir;\n }\n\n return null;\n}\n\nexport function* findRelativeConfig(\n packageData: FilePackageData,\n envName: string,\n caller: CallerMetadata | undefined,\n): Handler {\n let config = null;\n let ignore = null;\n\n const dirname = path.dirname(packageData.filepath);\n\n for (const loc of packageData.directories) {\n if (!config) {\n config = yield* loadOneConfig(\n RELATIVE_CONFIG_FILENAMES,\n loc,\n envName,\n caller,\n packageData.pkg?.dirname === loc\n ? packageToBabelConfig(packageData.pkg as ConfigFile)\n : null,\n );\n }\n\n if (!ignore) {\n const ignoreLoc = path.join(loc, BABELIGNORE_FILENAME);\n ignore = yield* readIgnoreConfig(ignoreLoc);\n\n if (ignore) {\n debug(\"Found ignore %o from %o.\", ignore.filepath, dirname);\n }\n }\n }\n\n return { config, ignore };\n}\n\nexport function findRootConfig(\n dirname: string,\n envName: string,\n caller: CallerMetadata | undefined,\n): Handler {\n return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller);\n}\n\nfunction* loadOneConfig(\n names: string[],\n dirname: string,\n envName: string,\n caller: CallerMetadata | undefined,\n previousConfig: ConfigFile | null = null,\n): Handler {\n const configs = yield* gensync.all(\n names.map(filename =>\n readConfig(path.join(dirname, filename), envName, caller),\n ),\n );\n const config = configs.reduce((previousConfig: ConfigFile | null, config) => {\n if (config && previousConfig) {\n throw new ConfigError(\n `Multiple configuration files found. Please remove one:\\n` +\n ` - ${path.basename(previousConfig.filepath)}\\n` +\n ` - ${config.filepath}\\n` +\n `from ${dirname}`,\n );\n }\n\n return config || previousConfig;\n }, previousConfig);\n\n if (config) {\n debug(\"Found configuration %o from %o.\", config.filepath, dirname);\n }\n return config;\n}\n\nexport function* loadConfig(\n name: string,\n dirname: string,\n envName: string,\n caller: CallerMetadata | undefined,\n): Handler {\n const filepath = require.resolve(name, { paths: [dirname] });\n\n const conf = yield* readConfig(filepath, envName, caller);\n if (!conf) {\n throw new ConfigError(\n `Config file contains no configuration data`,\n filepath,\n );\n }\n\n debug(\"Loaded config %o from %o.\", name, dirname);\n return conf;\n}\n\n/**\n * Read the given config file, returning the result. Returns null if no config was found, but will\n * throw if there are parsing errors while loading a config.\n */\nfunction readConfig(\n filepath: string,\n envName: string,\n caller: CallerMetadata | undefined,\n): Handler {\n const ext = path.extname(filepath);\n return ext === \".js\" || ext === \".cjs\" || ext === \".mjs\"\n ? readConfigJS(filepath, { envName, caller })\n : readConfigJSON5(filepath);\n}\n\nexport function* resolveShowConfigPath(\n dirname: string,\n): Handler {\n const targetPath = process.env.BABEL_SHOW_CONFIG_FOR;\n if (targetPath != null) {\n const absolutePath = path.resolve(dirname, targetPath);\n const stats = yield* fs.stat(absolutePath);\n if (!stats.isFile()) {\n throw new Error(\n `${absolutePath}: BABEL_SHOW_CONFIG_FOR must refer to a regular file, directories are not supported.`,\n );\n }\n return absolutePath;\n }\n return null;\n}\n\nfunction throwConfigError(filepath: string): never {\n throw new ConfigError(\n `\\\nCaching was left unconfigured. Babel's plugins, presets, and .babelrc.js files can be configured\nfor various types of caching, using the first param of their handler functions:\n\nmodule.exports = function(api) {\n // The API exposes the following:\n\n // Cache the returned value forever and don't call this function again.\n api.cache(true);\n\n // Don't cache at all. Not recommended because it will be very slow.\n api.cache(false);\n\n // Cached based on the value of some function. If this function returns a value different from\n // a previously-encountered value, the plugins will re-evaluate.\n var env = api.cache(() => process.env.NODE_ENV);\n\n // If testing for a specific env, we recommend specifics to avoid instantiating a plugin for\n // any possible NODE_ENV value that might come up during plugin execution.\n var isProd = api.cache(() => process.env.NODE_ENV === \"production\");\n\n // .cache(fn) will perform a linear search though instances to find the matching plugin based\n // based on previous instantiated plugins. If you want to recreate the plugin and discard the\n // previous instance whenever something changes, you may use:\n var isProd = api.cache.invalidate(() => process.env.NODE_ENV === \"production\");\n\n // Note, we also expose the following more-verbose versions of the above examples:\n api.cache.forever(); // api.cache(true)\n api.cache.never(); // api.cache(false)\n api.cache.using(fn); // api.cache(fn)\n\n // Return the value that will be cached.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,CAAC;AAC/B;AAEO,UAAU0E,qBAAqB,CACpCpE,OAAe,EACS;EACxB,MAAMqE,UAAU,GAAGC,OAAO,CAACC,GAAG,CAACC,qBAAqB;EACpD,IAAIH,UAAU,IAAI,IAAI,EAAE;IACtB,MAAMI,YAAY,GAAGxE,OAAI,CAACyE,OAAO,CAAC1E,OAAO,EAAEqE,UAAU,CAAC;IACtD,MAAMM,KAAK,GAAG,OAAOC,EAAE,CAACC,IAAI,CAACJ,YAAY,CAAC;IAC1C,IAAI,CAACE,KAAK,CAACG,MAAM,EAAE,EAAE;MACnB,MAAM,IAAIC,KAAK,CACZ,GAAEN,YAAa,sFAAqF,CACtG;IACH;IACA,OAAOA,YAAY;EACrB;EACA,OAAO,IAAI;AACb;AAEA,SAAS3D,gBAAgB,CAACpB,QAAgB,EAAS;EACjD,MAAM,IAAIiB,oBAAW,CAClB;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG,EACCjB,QAAQ,CACT;AACH;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/import-meta-resolve.js b/node_modules/@babel/core/lib/config/files/import-meta-resolve.js index ea52f2481..a003681d6 100644 --- a/node_modules/@babel/core/lib/config/files/import-meta-resolve.js +++ b/node_modules/@babel/core/lib/config/files/import-meta-resolve.js @@ -4,42 +4,32 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = resolve; - function _module() { const data = require("module"); - _module = function () { return data; }; - return data; } - var _importMetaResolve = require("../../vendor/import-meta-resolve"); - function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - let import_; - try { import_ = require("./import.cjs"); } catch (_unused) {} -const importMetaResolveP = import_ && process.execArgv.includes("--experimental-import-meta-resolve") ? import_("data:text/javascript,export default import.meta.resolve").then(m => m.default || _importMetaResolve.resolve, () => _importMetaResolve.resolve) : Promise.resolve(_importMetaResolve.resolve); - +const importMetaResolveP = import_ && +process.execArgv.includes("--experimental-import-meta-resolve") ? import_("data:text/javascript,export default import.meta.resolve").then(m => m.default || _importMetaResolve.resolve, () => _importMetaResolve.resolve) : Promise.resolve(_importMetaResolve.resolve); function resolve(_x, _x2) { return _resolve.apply(this, arguments); } - function _resolve() { _resolve = _asyncToGenerator(function* (specifier, parent) { return (yield importMetaResolveP)(specifier, parent); }); return _resolve.apply(this, arguments); } - 0 && 0; //# sourceMappingURL=import-meta-resolve.js.map diff --git a/node_modules/@babel/core/lib/config/files/import-meta-resolve.js.map b/node_modules/@babel/core/lib/config/files/import-meta-resolve.js.map index 0391dc08d..5f005ab46 100644 --- a/node_modules/@babel/core/lib/config/files/import-meta-resolve.js.map +++ b/node_modules/@babel/core/lib/config/files/import-meta-resolve.js.map @@ -1 +1 @@ -{"version":3,"names":["import_","require","importMetaResolveP","process","execArgv","includes","then","m","default","polyfill","Promise","resolve","specifier","parent"],"sources":["../../../src/config/files/import-meta-resolve.ts"],"sourcesContent":["import { createRequire } from \"module\";\nimport { resolve as polyfill } from \"../../vendor/import-meta-resolve\";\n\nconst require = createRequire(import.meta.url);\n\nlet import_;\ntry {\n // Node < 13.3 doesn't support import() syntax.\n import_ = require(\"./import.cjs\");\n} catch {}\n\n// import.meta.resolve is only available in ESM, but this file is compiled to CJS.\n// We can extract it using dynamic import.\nconst importMetaResolveP: Promise =\n import_ &&\n // Due to a Node.js/V8 bug (https://github.com/nodejs/node/issues/35889), we cannot\n // use always dynamic import because it segfaults when running in a Node.js `vm` context,\n // which is used by the default Jest environment and by webpack-cli.\n //\n // However, import.meta.resolve is experimental and only enabled when Node.js is run\n // with the `--experimental-import-meta-resolve` flag: we can avoid calling import()\n // when that flag is not enabled, so that the default behavior never segfaults.\n //\n // Hopefully, before Node.js unflags import.meta.resolve, either:\n // - we will move to ESM, so that we have direct access to import.meta.resolve, or\n // - the V8 bug will be fixed so that we can safely use dynamic import by default.\n //\n // I (@nicolo-ribaudo) am really anoyed by this bug, because there is no known\n // work-around other than \"don't use dynamic import if you are running in a `vm` context\",\n // but there is no reliable way to detect it (you cannot try/catch segfaults).\n //\n // This is the only place where we *need* to use dynamic import because we need to access\n // an ES module. All the other places will first try using require() and *then*, if\n // it throws because it's a module, will fallback to import().\n process.execArgv.includes(\"--experimental-import-meta-resolve\")\n ? import_(\"data:text/javascript,export default import.meta.resolve\").then(\n (m: { default: ImportMeta[\"resolve\"] | undefined }) =>\n m.default || polyfill,\n () => polyfill,\n )\n : Promise.resolve(polyfill);\n\nexport default async function resolve(\n specifier: Parameters[0],\n parent?: Parameters[1],\n): ReturnType {\n return (await importMetaResolveP)(specifier, parent);\n}\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;;;;;;AAIA,IAAIA,OAAJ;;AACA,IAAI;EAEFA,OAAO,GAAGC,OAAO,CAAC,cAAD,CAAjB;AACD,CAHD,CAGE,gBAAM,CAAE;;AAIV,MAAMC,kBAAkD,GACtDF,OAAO,IAoBPG,OAAO,CAACC,QAAR,CAAiBC,QAAjB,CAA0B,oCAA1B,CApBA,GAqBIL,OAAO,CAAC,yDAAD,CAAP,CAAmEM,IAAnE,CACGC,CAAD,IACEA,CAAC,CAACC,OAAF,IAAaC,0BAFjB,EAGE,MAAMA,0BAHR,CArBJ,GA0BIC,OAAO,CAACC,OAAR,CAAgBF,0BAAhB,CA3BN;;SA6B8BE,O;;;;;+BAAf,WACbC,SADa,EAEbC,MAFa,EAGsB;IACnC,OAAO,OAAOX,kBAAP,EAA2BU,SAA3B,EAAsCC,MAAtC,CAAP;EACD,C"} \ No newline at end of file +{"version":3,"names":["import_","require","importMetaResolveP","process","execArgv","includes","then","m","default","polyfill","Promise","resolve","specifier","parent"],"sources":["../../../src/config/files/import-meta-resolve.ts"],"sourcesContent":["import { createRequire } from \"module\";\nimport { resolve as polyfill } from \"../../vendor/import-meta-resolve\";\n\nconst require = createRequire(import.meta.url);\n\nlet import_;\ntry {\n // Node < 13.3 doesn't support import() syntax.\n import_ = require(\"./import.cjs\");\n} catch {}\n\n// import.meta.resolve is only available in ESM, but this file is compiled to CJS.\n// We can extract it using dynamic import.\nconst importMetaResolveP: Promise =\n import_ &&\n // Due to a Node.js/V8 bug (https://github.com/nodejs/node/issues/35889), we cannot\n // use always dynamic import because it segfaults when running in a Node.js `vm` context,\n // which is used by the default Jest environment and by webpack-cli.\n //\n // However, import.meta.resolve is experimental and only enabled when Node.js is run\n // with the `--experimental-import-meta-resolve` flag: we can avoid calling import()\n // when that flag is not enabled, so that the default behavior never segfaults.\n //\n // Hopefully, before Node.js unflags import.meta.resolve, either:\n // - we will move to ESM, so that we have direct access to import.meta.resolve, or\n // - the V8 bug will be fixed so that we can safely use dynamic import by default.\n //\n // I (@nicolo-ribaudo) am really anoyed by this bug, because there is no known\n // work-around other than \"don't use dynamic import if you are running in a `vm` context\",\n // but there is no reliable way to detect it (you cannot try/catch segfaults).\n //\n // This is the only place where we *need* to use dynamic import because we need to access\n // an ES module. All the other places will first try using require() and *then*, if\n // it throws because it's a module, will fallback to import().\n process.execArgv.includes(\"--experimental-import-meta-resolve\")\n ? import_(\"data:text/javascript,export default import.meta.resolve\").then(\n (m: { default: ImportMeta[\"resolve\"] | undefined }) =>\n m.default || polyfill,\n () => polyfill,\n )\n : Promise.resolve(polyfill);\n\nexport default async function resolve(\n specifier: Parameters[0],\n parent?: Parameters[1],\n): ReturnType {\n return (await importMetaResolveP)(specifier, parent);\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AAAuE;AAAA;AAIvE,IAAIA,OAAO;AACX,IAAI;EAEFA,OAAO,GAAGC,OAAO,CAAC,cAAc,CAAC;AACnC,CAAC,CAAC,gBAAM,CAAC;;AAIT,MAAMC,kBAAkD,GACtDF,OAAO;AAoBPG,OAAO,CAACC,QAAQ,CAACC,QAAQ,CAAC,oCAAoC,CAAC,GAC3DL,OAAO,CAAC,yDAAyD,CAAC,CAACM,IAAI,CACpEC,CAAiD,IAChDA,CAAC,CAACC,OAAO,IAAIC,0BAAQ,EACvB,MAAMA,0BAAQ,CACf,GACDC,OAAO,CAACC,OAAO,CAACF,0BAAQ,CAAC;AAAC,SAEFE,OAAO;EAAA;AAAA;AAAA;EAAA,6BAAtB,WACbC,SAA+C,EAC/CC,MAA6C,EACV;IACnC,OAAO,OAAOX,kBAAkB,EAAEU,SAAS,EAAEC,MAAM,CAAC;EACtD,CAAC;EAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/import.cjs b/node_modules/@babel/core/lib/config/files/import.cjs index c66e76cac..a298b0aca 100644 --- a/node_modules/@babel/core/lib/config/files/import.cjs +++ b/node_modules/@babel/core/lib/config/files/import.cjs @@ -1,7 +1,8 @@ + + module.exports = function import_(filepath) { return import(filepath); }; - 0 && 0; //# sourceMappingURL=import.cjs.map diff --git a/node_modules/@babel/core/lib/config/files/import.cjs.map b/node_modules/@babel/core/lib/config/files/import.cjs.map index a872a8186..fcb50bd3b 100644 --- a/node_modules/@babel/core/lib/config/files/import.cjs.map +++ b/node_modules/@babel/core/lib/config/files/import.cjs.map @@ -1 +1 @@ -{"version":3,"names":["module","exports","import_","filepath"],"sources":["../../../src/config/files/import.cjs"],"sourcesContent":["// We keep this in a separate file so that in older node versions, where\n// import() isn't supported, we can try/catch around the require() call\n// when loading this file.\n\nmodule.exports = function import_(filepath) {\n return import(filepath);\n};\n"],"mappings":"AAIAA,MAAM,CAACC,OAAP,GAAiB,SAASC,OAAT,CAAiBC,QAAjB,EAA2B;EAC1C,OAAO,OAAOA,QAAP,CAAP;AACD,CAFD"} \ No newline at end of file +{"version":3,"names":["module","exports","import_","filepath"],"sources":["../../../src/config/files/import.cjs"],"sourcesContent":["// We keep this in a separate file so that in older node versions, where\n// import() isn't supported, we can try/catch around the require() call\n// when loading this file.\n\nmodule.exports = function import_(filepath) {\n return import(filepath);\n};\n"],"mappings":";;AAIAA,MAAM,CAACC,OAAO,GAAG,SAASC,OAAO,CAACC,QAAQ,EAAE;EAC1C,OAAO,MAAM,CAACA,QAAQ,CAAC;AACzB,CAAC;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/index-browser.js b/node_modules/@babel/core/lib/config/files/index-browser.js index c8d1cf9b6..fd5b7109b 100644 --- a/node_modules/@babel/core/lib/config/files/index-browser.js +++ b/node_modules/@babel/core/lib/config/files/index-browser.js @@ -14,8 +14,8 @@ exports.loadPreset = loadPreset; exports.resolvePlugin = resolvePlugin; exports.resolvePreset = resolvePreset; exports.resolveShowConfigPath = resolveShowConfigPath; - -function findConfigUpwards(rootDir) { +function findConfigUpwards( +rootDir) { return null; } @@ -28,28 +28,36 @@ function* findPackageData(filepath) { }; } -function* findRelativeConfig(pkgData, envName, caller) { +function* findRelativeConfig( +pkgData, +envName, +caller) { return { config: null, ignore: null }; } -function* findRootConfig(dirname, envName, caller) { +function* findRootConfig( +dirname, +envName, +caller) { return null; } -function* loadConfig(name, dirname, envName, caller) { +function* loadConfig(name, dirname, +envName, +caller) { throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`); } -function* resolveShowConfigPath(dirname) { +function* resolveShowConfigPath( +dirname) { return null; } - const ROOT_CONFIG_FILENAMES = []; -exports.ROOT_CONFIG_FILENAMES = ROOT_CONFIG_FILENAMES; +exports.ROOT_CONFIG_FILENAMES = ROOT_CONFIG_FILENAMES; function resolvePlugin(name, dirname) { return null; } @@ -57,15 +65,12 @@ function resolvePlugin(name, dirname) { function resolvePreset(name, dirname) { return null; } - function loadPlugin(name, dirname) { throw new Error(`Cannot load plugin ${name} relative to ${dirname} in a browser`); } - function loadPreset(name, dirname) { throw new Error(`Cannot load preset ${name} relative to ${dirname} in a browser`); } - 0 && 0; //# sourceMappingURL=index-browser.js.map diff --git a/node_modules/@babel/core/lib/config/files/index-browser.js.map b/node_modules/@babel/core/lib/config/files/index-browser.js.map index 2ed5e1dfc..bd7e21315 100644 --- a/node_modules/@babel/core/lib/config/files/index-browser.js.map +++ b/node_modules/@babel/core/lib/config/files/index-browser.js.map @@ -1 +1 @@ -{"version":3,"names":["findConfigUpwards","rootDir","findPackageData","filepath","directories","pkg","isPackage","findRelativeConfig","pkgData","envName","caller","config","ignore","findRootConfig","dirname","loadConfig","name","Error","resolveShowConfigPath","ROOT_CONFIG_FILENAMES","resolvePlugin","resolvePreset","loadPlugin","loadPreset"],"sources":["../../../src/config/files/index-browser.ts"],"sourcesContent":["import type { Handler } from \"gensync\";\n\nimport type {\n ConfigFile,\n IgnoreFile,\n RelativeConfig,\n FilePackageData,\n} from \"./types\";\n\nimport type { CallerMetadata } from \"../validation/options\";\n\nexport type { ConfigFile, IgnoreFile, RelativeConfig, FilePackageData };\n\nexport function findConfigUpwards(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n rootDir: string,\n): string | null {\n return null;\n}\n\n// eslint-disable-next-line require-yield\nexport function* findPackageData(filepath: string): Handler {\n return {\n filepath,\n directories: [],\n pkg: null,\n isPackage: false,\n };\n}\n\n// eslint-disable-next-line require-yield\nexport function* findRelativeConfig(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n pkgData: FilePackageData,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n envName: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n caller: CallerMetadata | undefined,\n): Handler {\n return { config: null, ignore: null };\n}\n\n// eslint-disable-next-line require-yield\nexport function* findRootConfig(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n dirname: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n envName: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n caller: CallerMetadata | undefined,\n): Handler {\n return null;\n}\n\n// eslint-disable-next-line require-yield\nexport function* loadConfig(\n name: string,\n dirname: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n envName: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n caller: CallerMetadata | undefined,\n): Handler {\n throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);\n}\n\n// eslint-disable-next-line require-yield\nexport function* resolveShowConfigPath(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n dirname: string,\n): Handler {\n return null;\n}\n\nexport const ROOT_CONFIG_FILENAMES: string[] = [];\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function resolvePlugin(name: string, dirname: string): string | null {\n return null;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function resolvePreset(name: string, dirname: string): string | null {\n return null;\n}\n\nexport function loadPlugin(\n name: string,\n dirname: string,\n): Handler<{\n filepath: string;\n value: unknown;\n}> {\n throw new Error(\n `Cannot load plugin ${name} relative to ${dirname} in a browser`,\n );\n}\n\nexport function loadPreset(\n name: string,\n dirname: string,\n): Handler<{\n filepath: string;\n value: unknown;\n}> {\n throw new Error(\n `Cannot load preset ${name} relative to ${dirname} in a browser`,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAaO,SAASA,iBAAT,CAELC,OAFK,EAGU;EACf,OAAO,IAAP;AACD;;AAGM,UAAUC,eAAV,CAA0BC,QAA1B,EAAsE;EAC3E,OAAO;IACLA,QADK;IAELC,WAAW,EAAE,EAFR;IAGLC,GAAG,EAAE,IAHA;IAILC,SAAS,EAAE;EAJN,CAAP;AAMD;;AAGM,UAAUC,kBAAV,CAELC,OAFK,EAILC,OAJK,EAMLC,MANK,EAOoB;EACzB,OAAO;IAAEC,MAAM,EAAE,IAAV;IAAgBC,MAAM,EAAE;EAAxB,CAAP;AACD;;AAGM,UAAUC,cAAV,CAELC,OAFK,EAILL,OAJK,EAMLC,MANK,EAOuB;EAC5B,OAAO,IAAP;AACD;;AAGM,UAAUK,UAAV,CACLC,IADK,EAELF,OAFK,EAILL,OAJK,EAMLC,MANK,EAOgB;EACrB,MAAM,IAAIO,KAAJ,CAAW,eAAcD,IAAK,gBAAeF,OAAQ,eAArD,CAAN;AACD;;AAGM,UAAUI,qBAAV,CAELJ,OAFK,EAGmB;EACxB,OAAO,IAAP;AACD;;AAEM,MAAMK,qBAA+B,GAAG,EAAxC;;;AAGA,SAASC,aAAT,CAAuBJ,IAAvB,EAAqCF,OAArC,EAAqE;EAC1E,OAAO,IAAP;AACD;;AAGM,SAASO,aAAT,CAAuBL,IAAvB,EAAqCF,OAArC,EAAqE;EAC1E,OAAO,IAAP;AACD;;AAEM,SAASQ,UAAT,CACLN,IADK,EAELF,OAFK,EAMJ;EACD,MAAM,IAAIG,KAAJ,CACH,sBAAqBD,IAAK,gBAAeF,OAAQ,eAD9C,CAAN;AAGD;;AAEM,SAASS,UAAT,CACLP,IADK,EAELF,OAFK,EAMJ;EACD,MAAM,IAAIG,KAAJ,CACH,sBAAqBD,IAAK,gBAAeF,OAAQ,eAD9C,CAAN;AAGD"} \ No newline at end of file +{"version":3,"names":["findConfigUpwards","rootDir","findPackageData","filepath","directories","pkg","isPackage","findRelativeConfig","pkgData","envName","caller","config","ignore","findRootConfig","dirname","loadConfig","name","Error","resolveShowConfigPath","ROOT_CONFIG_FILENAMES","resolvePlugin","resolvePreset","loadPlugin","loadPreset"],"sources":["../../../src/config/files/index-browser.ts"],"sourcesContent":["import type { Handler } from \"gensync\";\n\nimport type {\n ConfigFile,\n IgnoreFile,\n RelativeConfig,\n FilePackageData,\n} from \"./types\";\n\nimport type { CallerMetadata } from \"../validation/options\";\n\nexport type { ConfigFile, IgnoreFile, RelativeConfig, FilePackageData };\n\nexport function findConfigUpwards(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n rootDir: string,\n): string | null {\n return null;\n}\n\n// eslint-disable-next-line require-yield\nexport function* findPackageData(filepath: string): Handler {\n return {\n filepath,\n directories: [],\n pkg: null,\n isPackage: false,\n };\n}\n\n// eslint-disable-next-line require-yield\nexport function* findRelativeConfig(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n pkgData: FilePackageData,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n envName: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n caller: CallerMetadata | undefined,\n): Handler {\n return { config: null, ignore: null };\n}\n\n// eslint-disable-next-line require-yield\nexport function* findRootConfig(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n dirname: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n envName: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n caller: CallerMetadata | undefined,\n): Handler {\n return null;\n}\n\n// eslint-disable-next-line require-yield\nexport function* loadConfig(\n name: string,\n dirname: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n envName: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n caller: CallerMetadata | undefined,\n): Handler {\n throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);\n}\n\n// eslint-disable-next-line require-yield\nexport function* resolveShowConfigPath(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n dirname: string,\n): Handler {\n return null;\n}\n\nexport const ROOT_CONFIG_FILENAMES: string[] = [];\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function resolvePlugin(name: string, dirname: string): string | null {\n return null;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function resolvePreset(name: string, dirname: string): string | null {\n return null;\n}\n\nexport function loadPlugin(\n name: string,\n dirname: string,\n): Handler<{\n filepath: string;\n value: unknown;\n}> {\n throw new Error(\n `Cannot load plugin ${name} relative to ${dirname} in a browser`,\n );\n}\n\nexport function loadPreset(\n name: string,\n dirname: string,\n): Handler<{\n filepath: string;\n value: unknown;\n}> {\n throw new Error(\n `Cannot load preset ${name} relative to ${dirname} in a browser`,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAaO,SAASA,iBAAiB;AAE/BC,OAAe,EACA;EACf,OAAO,IAAI;AACb;;AAGO,UAAUC,eAAe,CAACC,QAAgB,EAA4B;EAC3E,OAAO;IACLA,QAAQ;IACRC,WAAW,EAAE,EAAE;IACfC,GAAG,EAAE,IAAI;IACTC,SAAS,EAAE;EACb,CAAC;AACH;;AAGO,UAAUC,kBAAkB;AAEjCC,OAAwB;AAExBC,OAAe;AAEfC,MAAkC,EACT;EACzB,OAAO;IAAEC,MAAM,EAAE,IAAI;IAAEC,MAAM,EAAE;EAAK,CAAC;AACvC;;AAGO,UAAUC,cAAc;AAE7BC,OAAe;AAEfL,OAAe;AAEfC,MAAkC,EACN;EAC5B,OAAO,IAAI;AACb;;AAGO,UAAUK,UAAU,CACzBC,IAAY,EACZF,OAAe;AAEfL,OAAe;AAEfC,MAAkC,EACb;EACrB,MAAM,IAAIO,KAAK,CAAE,eAAcD,IAAK,gBAAeF,OAAQ,eAAc,CAAC;AAC5E;;AAGO,UAAUI,qBAAqB;AAEpCJ,OAAe,EACS;EACxB,OAAO,IAAI;AACb;AAEO,MAAMK,qBAA+B,GAAG,EAAE;;AAAC;AAG3C,SAASC,aAAa,CAACJ,IAAY,EAAEF,OAAe,EAAiB;EAC1E,OAAO,IAAI;AACb;;AAGO,SAASO,aAAa,CAACL,IAAY,EAAEF,OAAe,EAAiB;EAC1E,OAAO,IAAI;AACb;AAEO,SAASQ,UAAU,CACxBN,IAAY,EACZF,OAAe,EAId;EACD,MAAM,IAAIG,KAAK,CACZ,sBAAqBD,IAAK,gBAAeF,OAAQ,eAAc,CACjE;AACH;AAEO,SAASS,UAAU,CACxBP,IAAY,EACZF,OAAe,EAId;EACD,MAAM,IAAIG,KAAK,CACZ,sBAAqBD,IAAK,gBAAeF,OAAQ,eAAc,CACjE;AACH;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/index.js b/node_modules/@babel/core/lib/config/files/index.js index c6acd931f..f93e6b22b 100644 --- a/node_modules/@babel/core/lib/config/files/index.js +++ b/node_modules/@babel/core/lib/config/files/index.js @@ -58,31 +58,20 @@ Object.defineProperty(exports, "resolveShowConfigPath", { return _configuration.resolveShowConfigPath; } }); - var _package = require("./package"); - var _configuration = require("./configuration"); - var plugins = require("./plugins"); - function _gensync() { const data = require("gensync"); - _gensync = function () { return data; }; - return data; } - ({}); - const resolvePlugin = _gensync()(plugins.resolvePlugin).sync; - exports.resolvePlugin = resolvePlugin; - const resolvePreset = _gensync()(plugins.resolvePreset).sync; - exports.resolvePreset = resolvePreset; 0 && 0; diff --git a/node_modules/@babel/core/lib/config/files/index.js.map b/node_modules/@babel/core/lib/config/files/index.js.map index 2fba62f45..1add0a6d3 100644 --- a/node_modules/@babel/core/lib/config/files/index.js.map +++ b/node_modules/@babel/core/lib/config/files/index.js.map @@ -1 +1 @@ -{"version":3,"names":["resolvePlugin","gensync","plugins","sync","resolvePreset"],"sources":["../../../src/config/files/index.ts"],"sourcesContent":["type indexBrowserType = typeof import(\"./index-browser\");\ntype indexType = typeof import(\"./index\");\n\n// Kind of gross, but essentially asserting that the exports of this module are the same as the\n// exports of index-browser, since this file may be replaced at bundle time with index-browser.\n({} as any as indexBrowserType as indexType);\n\nexport { findPackageData } from \"./package\";\n\nexport {\n findConfigUpwards,\n findRelativeConfig,\n findRootConfig,\n loadConfig,\n resolveShowConfigPath,\n ROOT_CONFIG_FILENAMES,\n} from \"./configuration\";\nexport type {\n ConfigFile,\n IgnoreFile,\n RelativeConfig,\n FilePackageData,\n} from \"./types\";\nexport { loadPlugin, loadPreset } from \"./plugins\";\n\nimport gensync from \"gensync\";\nimport * as plugins from \"./plugins\";\n\nexport const resolvePlugin = gensync(plugins.resolvePlugin).sync;\nexport const resolvePreset = gensync(plugins.resolvePreset).sync;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA;;AAEA;;AAcA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AApBA,CAAC,EAAD;;AAuBO,MAAMA,aAAa,GAAGC,UAAA,CAAQC,OAAO,CAACF,aAAhB,EAA+BG,IAArD;;;;AACA,MAAMC,aAAa,GAAGH,UAAA,CAAQC,OAAO,CAACE,aAAhB,EAA+BD,IAArD"} \ No newline at end of file +{"version":3,"names":["resolvePlugin","gensync","plugins","sync","resolvePreset"],"sources":["../../../src/config/files/index.ts"],"sourcesContent":["type indexBrowserType = typeof import(\"./index-browser\");\ntype indexType = typeof import(\"./index\");\n\n// Kind of gross, but essentially asserting that the exports of this module are the same as the\n// exports of index-browser, since this file may be replaced at bundle time with index-browser.\n({} as any as indexBrowserType as indexType);\n\nexport { findPackageData } from \"./package\";\n\nexport {\n findConfigUpwards,\n findRelativeConfig,\n findRootConfig,\n loadConfig,\n resolveShowConfigPath,\n ROOT_CONFIG_FILENAMES,\n} from \"./configuration\";\nexport type {\n ConfigFile,\n IgnoreFile,\n RelativeConfig,\n FilePackageData,\n} from \"./types\";\nexport { loadPlugin, loadPreset } from \"./plugins\";\n\nimport gensync from \"gensync\";\nimport * as plugins from \"./plugins\";\n\nexport const resolvePlugin = gensync(plugins.resolvePlugin).sync;\nexport const resolvePreset = gensync(plugins.resolvePreset).sync;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA;AAEA;AAcA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AApBA,CAAC,CAAC,CAAC;AAuBI,MAAMA,aAAa,GAAGC,UAAO,CAACC,OAAO,CAACF,aAAa,CAAC,CAACG,IAAI;AAAC;AAC1D,MAAMC,aAAa,GAAGH,UAAO,CAACC,OAAO,CAACE,aAAa,CAAC,CAACD,IAAI;AAAC;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/module-types.js b/node_modules/@babel/core/lib/config/files/module-types.js index e4435079a..eefe3ea05 100644 --- a/node_modules/@babel/core/lib/config/files/module-types.js +++ b/node_modules/@babel/core/lib/config/files/module-types.js @@ -5,110 +5,82 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = loadCjsOrMjsDefault; exports.supportsESM = void 0; - var _async = require("../../gensync-utils/async"); - function _path() { const data = require("path"); - _path = function () { return data; }; - return data; } - function _url() { const data = require("url"); - _url = function () { return data; }; - return data; } - function _module() { const data = require("module"); - _module = function () { return data; }; - return data; } - function _semver() { const data = require("semver"); - _semver = function () { return data; }; - return data; } - var _rewriteStackTrace = require("../../errors/rewrite-stack-trace"); - var _configError = require("../../errors/config-error"); - function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - let import_; - try { import_ = require("./import.cjs"); } catch (_unused) {} - -const supportsESM = _semver().satisfies(process.versions.node, "^12.17 || >=13.2"); - +const supportsESM = _semver().satisfies(process.versions.node, +"^12.17 || >=13.2"); exports.supportsESM = supportsESM; - -function* loadCjsOrMjsDefault(filepath, asyncError, fallbackToTranspiledModule = false) { +function* loadCjsOrMjsDefault(filepath, asyncError, +fallbackToTranspiledModule = false) { switch (guessJSModuleType(filepath)) { case "cjs": return loadCjsDefault(filepath, fallbackToTranspiledModule); - case "unknown": try { return loadCjsDefault(filepath, fallbackToTranspiledModule); } catch (e) { if (e.code !== "ERR_REQUIRE_ESM") throw e; } - case "mjs": if (yield* (0, _async.isAsync)()) { return yield* (0, _async.waitFor)(loadMjsDefault(filepath)); } - throw new _configError.default(asyncError, filepath); } } - function guessJSModuleType(filename) { switch (_path().extname(filename)) { case ".cjs": return "cjs"; - case ".mjs": return "mjs"; - default: return "unknown"; } } - function loadCjsDefault(filepath, fallbackToTranspiledModule) { const module = (0, _rewriteStackTrace.endHiddenCallStack)(require)(filepath); - return module != null && module.__esModule ? module.default || (fallbackToTranspiledModule ? module : undefined) : module; + return module != null && module.__esModule ? + module.default || (fallbackToTranspiledModule ? module : undefined) : module; } - function loadMjsDefault(_x) { return _loadMjsDefault.apply(this, arguments); } - function _loadMjsDefault() { _loadMjsDefault = _asyncToGenerator(function* (filepath) { if (!import_) { @@ -120,7 +92,6 @@ function _loadMjsDefault() { }); return _loadMjsDefault.apply(this, arguments); } - 0 && 0; //# sourceMappingURL=module-types.js.map diff --git a/node_modules/@babel/core/lib/config/files/module-types.js.map b/node_modules/@babel/core/lib/config/files/module-types.js.map index 012928dde..0cd944b74 100644 --- a/node_modules/@babel/core/lib/config/files/module-types.js.map +++ b/node_modules/@babel/core/lib/config/files/module-types.js.map @@ -1 +1 @@ -{"version":3,"names":["import_","require","supportsESM","semver","satisfies","process","versions","node","loadCjsOrMjsDefault","filepath","asyncError","fallbackToTranspiledModule","guessJSModuleType","loadCjsDefault","e","code","isAsync","waitFor","loadMjsDefault","ConfigError","filename","path","extname","module","endHiddenCallStack","__esModule","default","undefined","pathToFileURL"],"sources":["../../../src/config/files/module-types.ts"],"sourcesContent":["import { isAsync, waitFor } from \"../../gensync-utils/async\";\nimport type { Handler } from \"gensync\";\nimport path from \"path\";\nimport { pathToFileURL } from \"url\";\nimport { createRequire } from \"module\";\nimport semver from \"semver\";\n\nimport { endHiddenCallStack } from \"../../errors/rewrite-stack-trace\";\nimport ConfigError from \"../../errors/config-error\";\n\nconst require = createRequire(import.meta.url);\n\nlet import_: ((specifier: string | URL) => any) | undefined;\ntry {\n // Old Node.js versions don't support import() syntax.\n import_ = require(\"./import.cjs\");\n} catch {}\n\nexport const supportsESM = semver.satisfies(\n process.versions.node,\n // older versions, starting from 10, support the dynamic\n // import syntax but always return a rejected promise.\n \"^12.17 || >=13.2\",\n);\n\nexport default function* loadCjsOrMjsDefault(\n filepath: string,\n asyncError: string,\n // TODO(Babel 8): Remove this\n fallbackToTranspiledModule: boolean = false,\n): Handler {\n switch (guessJSModuleType(filepath)) {\n case \"cjs\":\n return loadCjsDefault(filepath, fallbackToTranspiledModule);\n case \"unknown\":\n try {\n return loadCjsDefault(filepath, fallbackToTranspiledModule);\n } catch (e) {\n if (e.code !== \"ERR_REQUIRE_ESM\") throw e;\n }\n // fall through\n case \"mjs\":\n if (yield* isAsync()) {\n return yield* waitFor(loadMjsDefault(filepath));\n }\n throw new ConfigError(asyncError, filepath);\n }\n}\n\nfunction guessJSModuleType(filename: string): \"cjs\" | \"mjs\" | \"unknown\" {\n switch (path.extname(filename)) {\n case \".cjs\":\n return \"cjs\";\n case \".mjs\":\n return \"mjs\";\n default:\n return \"unknown\";\n }\n}\n\nfunction loadCjsDefault(filepath: string, fallbackToTranspiledModule: boolean) {\n const module = endHiddenCallStack(require)(filepath) as any;\n return module?.__esModule\n ? // TODO (Babel 8): Remove \"module\" and \"undefined\" fallback\n module.default || (fallbackToTranspiledModule ? module : undefined)\n : module;\n}\n\nasync function loadMjsDefault(filepath: string) {\n if (!import_) {\n throw new ConfigError(\n \"Internal error: Native ECMAScript modules aren't supported\" +\n \" by this platform.\\n\",\n filepath,\n );\n }\n\n // import() expects URLs, not file paths.\n // https://github.com/nodejs/node/issues/31710\n const module = await endHiddenCallStack(import_)(pathToFileURL(filepath));\n return module.default;\n}\n"],"mappings":";;;;;;;;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;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,CAACG,OAAP,KAAmBf,0BAA0B,GAAGY,MAAH,GAAYI,SAAzD,CAFG,GAGHJ,MAHJ;AAID;;SAEcL,c;;;;;sCAAf,WAA8BT,QAA9B,EAAgD;IAC9C,IAAI,CAACT,OAAL,EAAc;MACZ,MAAM,IAAImB,oBAAJ,CACJ,+DACE,sBAFE,EAGJV,QAHI,CAAN;IAKD;;IAID,MAAMc,MAAM,SAAS,IAAAC,qCAAA,EAAmBxB,OAAnB,EAA4B,IAAA4B,oBAAA,EAAcnB,QAAd,CAA5B,CAArB;IACA,OAAOc,MAAM,CAACG,OAAd;EACD,C"} \ No newline at end of file +{"version":3,"names":["import_","require","supportsESM","semver","satisfies","process","versions","node","loadCjsOrMjsDefault","filepath","asyncError","fallbackToTranspiledModule","guessJSModuleType","loadCjsDefault","e","code","isAsync","waitFor","loadMjsDefault","ConfigError","filename","path","extname","module","endHiddenCallStack","__esModule","default","undefined","pathToFileURL"],"sources":["../../../src/config/files/module-types.ts"],"sourcesContent":["import { isAsync, waitFor } from \"../../gensync-utils/async\";\nimport type { Handler } from \"gensync\";\nimport path from \"path\";\nimport { pathToFileURL } from \"url\";\nimport { createRequire } from \"module\";\nimport semver from \"semver\";\n\nimport { endHiddenCallStack } from \"../../errors/rewrite-stack-trace\";\nimport ConfigError from \"../../errors/config-error\";\n\nconst require = createRequire(import.meta.url);\n\nlet import_: ((specifier: string | URL) => any) | undefined;\ntry {\n // Old Node.js versions don't support import() syntax.\n import_ = require(\"./import.cjs\");\n} catch {}\n\nexport const supportsESM = semver.satisfies(\n process.versions.node,\n // older versions, starting from 10, support the dynamic\n // import syntax but always return a rejected promise.\n \"^12.17 || >=13.2\",\n);\n\nexport default function* loadCjsOrMjsDefault(\n filepath: string,\n asyncError: string,\n // TODO(Babel 8): Remove this\n fallbackToTranspiledModule: boolean = false,\n): Handler {\n switch (guessJSModuleType(filepath)) {\n case \"cjs\":\n return loadCjsDefault(filepath, fallbackToTranspiledModule);\n case \"unknown\":\n try {\n return loadCjsDefault(filepath, fallbackToTranspiledModule);\n } catch (e) {\n if (e.code !== \"ERR_REQUIRE_ESM\") throw e;\n }\n // fall through\n case \"mjs\":\n if (yield* isAsync()) {\n return yield* waitFor(loadMjsDefault(filepath));\n }\n throw new ConfigError(asyncError, filepath);\n }\n}\n\nfunction guessJSModuleType(filename: string): \"cjs\" | \"mjs\" | \"unknown\" {\n switch (path.extname(filename)) {\n case \".cjs\":\n return \"cjs\";\n case \".mjs\":\n return \"mjs\";\n default:\n return \"unknown\";\n }\n}\n\nfunction loadCjsDefault(filepath: string, fallbackToTranspiledModule: boolean) {\n const module = endHiddenCallStack(require)(filepath) as any;\n return module?.__esModule\n ? // TODO (Babel 8): Remove \"module\" and \"undefined\" fallback\n module.default || (fallbackToTranspiledModule ? module : undefined)\n : module;\n}\n\nasync function loadMjsDefault(filepath: string) {\n if (!import_) {\n throw new ConfigError(\n \"Internal error: Native ECMAScript modules aren't supported\" +\n \" by this platform.\\n\",\n filepath,\n );\n }\n\n // import() expects URLs, not file paths.\n // https://github.com/nodejs/node/issues/31710\n const module = await endHiddenCallStack(import_)(pathToFileURL(filepath));\n return module.default;\n}\n"],"mappings":";;;;;;;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACA;AAAoD;AAAA;AAIpD,IAAIA,OAAuD;AAC3D,IAAI;EAEFA,OAAO,GAAGC,OAAO,CAAC,cAAc,CAAC;AACnC,CAAC,CAAC,gBAAM,CAAC;AAEF,MAAMC,WAAW,GAAGC,SAAM,CAACC,SAAS,CACzCC,OAAO,CAACC,QAAQ,CAACC,IAAI;AAGrB,kBAAkB,CACnB;AAAC;AAEa,UAAUC,mBAAmB,CAC1CC,QAAgB,EAChBC,UAAkB;AAElBC,0BAAmC,GAAG,KAAK,EACzB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,CAAC,IAAA4B,oBAAa,EAACnB,QAAQ,CAAC,CAAC;IACzE,OAAOc,MAAM,CAACG,OAAO;EACvB,CAAC;EAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/package.js b/node_modules/@babel/core/lib/config/files/package.js index c5108b82f..b30c907e9 100644 --- a/node_modules/@babel/core/lib/config/files/package.js +++ b/node_modules/@babel/core/lib/config/files/package.js @@ -4,44 +4,52 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.findPackageData = findPackageData; - function _path() { const data = require("path"); - _path = function () { return data; }; - return data; } - var _utils = require("./utils"); - var _configError = require("../../errors/config-error"); - const PACKAGE_FILENAME = "package.json"; +const readConfigPackage = (0, _utils.makeStaticFileCache)((filepath, content) => { + let options; + try { + options = JSON.parse(content); + } catch (err) { + throw new _configError.default(`Error while parsing JSON - ${err.message}`, filepath); + } + if (!options) throw new Error(`${filepath}: No config detected`); + if (typeof options !== "object") { + throw new _configError.default(`Config returned typeof ${typeof options}`, filepath); + } + if (Array.isArray(options)) { + throw new _configError.default(`Expected config object but found array`, filepath); + } + return { + filepath, + dirname: _path().dirname(filepath), + options + }; +}); function* findPackageData(filepath) { let pkg = null; const directories = []; let isPackage = true; - let dirname = _path().dirname(filepath); - while (!pkg && _path().basename(dirname) !== "node_modules") { directories.push(dirname); pkg = yield* readConfigPackage(_path().join(dirname, PACKAGE_FILENAME)); - const nextLoc = _path().dirname(dirname); - if (dirname === nextLoc) { isPackage = false; break; } - dirname = nextLoc; } - return { filepath, directories, @@ -49,32 +57,6 @@ function* findPackageData(filepath) { isPackage }; } - -const readConfigPackage = (0, _utils.makeStaticFileCache)((filepath, content) => { - let options; - - try { - options = JSON.parse(content); - } catch (err) { - throw new _configError.default(`Error while parsing JSON - ${err.message}`, filepath); - } - - if (!options) throw new Error(`${filepath}: No config detected`); - - if (typeof options !== "object") { - throw new _configError.default(`Config returned typeof ${typeof options}`, filepath); - } - - if (Array.isArray(options)) { - throw new _configError.default(`Expected config object but found array`, filepath); - } - - return { - filepath, - dirname: _path().dirname(filepath), - options - }; -}); 0 && 0; //# sourceMappingURL=package.js.map diff --git a/node_modules/@babel/core/lib/config/files/package.js.map b/node_modules/@babel/core/lib/config/files/package.js.map index 05fe1fbe6..773da3e48 100644 --- a/node_modules/@babel/core/lib/config/files/package.js.map +++ b/node_modules/@babel/core/lib/config/files/package.js.map @@ -1 +1 @@ -{"version":3,"names":["PACKAGE_FILENAME","findPackageData","filepath","pkg","directories","isPackage","dirname","path","basename","push","readConfigPackage","join","nextLoc","makeStaticFileCache","content","options","JSON","parse","err","ConfigError","message","Error","Array","isArray"],"sources":["../../../src/config/files/package.ts"],"sourcesContent":["import path from \"path\";\nimport type { Handler } from \"gensync\";\nimport { makeStaticFileCache } from \"./utils\";\n\nimport type { ConfigFile, FilePackageData } from \"./types\";\n\nimport ConfigError from \"../../errors/config-error\";\n\nconst PACKAGE_FILENAME = \"package.json\";\n\n/**\n * Find metadata about the package that this file is inside of. Resolution\n * of Babel's config requires general package information to decide when to\n * search for .babelrc files\n */\nexport function* findPackageData(filepath: string): Handler {\n let pkg = null;\n const directories = [];\n let isPackage = true;\n\n let dirname = path.dirname(filepath);\n while (!pkg && path.basename(dirname) !== \"node_modules\") {\n directories.push(dirname);\n\n pkg = yield* readConfigPackage(path.join(dirname, PACKAGE_FILENAME));\n\n const nextLoc = path.dirname(dirname);\n if (dirname === nextLoc) {\n isPackage = false;\n break;\n }\n dirname = nextLoc;\n }\n\n return { filepath, directories, pkg, isPackage };\n}\n\nconst readConfigPackage = makeStaticFileCache(\n (filepath, content): ConfigFile => {\n let options;\n try {\n options = JSON.parse(content) as unknown;\n } catch (err) {\n throw new ConfigError(\n `Error while parsing JSON - ${err.message}`,\n filepath,\n );\n }\n\n if (!options) throw new Error(`${filepath}: No config detected`);\n\n if (typeof options !== \"object\") {\n throw new ConfigError(\n `Config returned typeof ${typeof options}`,\n filepath,\n );\n }\n if (Array.isArray(options)) {\n throw new ConfigError(`Expected config object but found array`, filepath);\n }\n\n return {\n filepath,\n dirname: path.dirname(filepath),\n options,\n };\n },\n);\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;;AAIA;;AAEA,MAAMA,gBAAgB,GAAG,cAAzB;;AAOO,UAAUC,eAAV,CAA0BC,QAA1B,EAAsE;EAC3E,IAAIC,GAAG,GAAG,IAAV;EACA,MAAMC,WAAW,GAAG,EAApB;EACA,IAAIC,SAAS,GAAG,IAAhB;;EAEA,IAAIC,OAAO,GAAGC,OAAA,CAAKD,OAAL,CAAaJ,QAAb,CAAd;;EACA,OAAO,CAACC,GAAD,IAAQI,OAAA,CAAKC,QAAL,CAAcF,OAAd,MAA2B,cAA1C,EAA0D;IACxDF,WAAW,CAACK,IAAZ,CAAiBH,OAAjB;IAEAH,GAAG,GAAG,OAAOO,iBAAiB,CAACH,OAAA,CAAKI,IAAL,CAAUL,OAAV,EAAmBN,gBAAnB,CAAD,CAA9B;;IAEA,MAAMY,OAAO,GAAGL,OAAA,CAAKD,OAAL,CAAaA,OAAb,CAAhB;;IACA,IAAIA,OAAO,KAAKM,OAAhB,EAAyB;MACvBP,SAAS,GAAG,KAAZ;MACA;IACD;;IACDC,OAAO,GAAGM,OAAV;EACD;;EAED,OAAO;IAAEV,QAAF;IAAYE,WAAZ;IAAyBD,GAAzB;IAA8BE;EAA9B,CAAP;AACD;;AAED,MAAMK,iBAAiB,GAAG,IAAAG,0BAAA,EACxB,CAACX,QAAD,EAAWY,OAAX,KAAmC;EACjC,IAAIC,OAAJ;;EACA,IAAI;IACFA,OAAO,GAAGC,IAAI,CAACC,KAAL,CAAWH,OAAX,CAAV;EACD,CAFD,CAEE,OAAOI,GAAP,EAAY;IACZ,MAAM,IAAIC,oBAAJ,CACH,8BAA6BD,GAAG,CAACE,OAAQ,EADtC,EAEJlB,QAFI,CAAN;EAID;;EAED,IAAI,CAACa,OAAL,EAAc,MAAM,IAAIM,KAAJ,CAAW,GAAEnB,QAAS,sBAAtB,CAAN;;EAEd,IAAI,OAAOa,OAAP,KAAmB,QAAvB,EAAiC;IAC/B,MAAM,IAAII,oBAAJ,CACH,0BAAyB,OAAOJ,OAAQ,EADrC,EAEJb,QAFI,CAAN;EAID;;EACD,IAAIoB,KAAK,CAACC,OAAN,CAAcR,OAAd,CAAJ,EAA4B;IAC1B,MAAM,IAAII,oBAAJ,CAAiB,wCAAjB,EAA0DjB,QAA1D,CAAN;EACD;;EAED,OAAO;IACLA,QADK;IAELI,OAAO,EAAEC,OAAA,CAAKD,OAAL,CAAaJ,QAAb,CAFJ;IAGLa;EAHK,CAAP;AAKD,CA7BuB,CAA1B"} \ No newline at end of file +{"version":3,"names":["PACKAGE_FILENAME","readConfigPackage","makeStaticFileCache","filepath","content","options","JSON","parse","err","ConfigError","message","Error","Array","isArray","dirname","path","findPackageData","pkg","directories","isPackage","basename","push","join","nextLoc"],"sources":["../../../src/config/files/package.ts"],"sourcesContent":["import path from \"path\";\nimport type { Handler } from \"gensync\";\nimport { makeStaticFileCache } from \"./utils\";\n\nimport type { ConfigFile, FilePackageData } from \"./types\";\n\nimport ConfigError from \"../../errors/config-error\";\n\nconst PACKAGE_FILENAME = \"package.json\";\n\nconst readConfigPackage = makeStaticFileCache(\n (filepath, content): ConfigFile => {\n let options;\n try {\n options = JSON.parse(content) as unknown;\n } catch (err) {\n throw new ConfigError(\n `Error while parsing JSON - ${err.message}`,\n filepath,\n );\n }\n\n if (!options) throw new Error(`${filepath}: No config detected`);\n\n if (typeof options !== \"object\") {\n throw new ConfigError(\n `Config returned typeof ${typeof options}`,\n filepath,\n );\n }\n if (Array.isArray(options)) {\n throw new ConfigError(`Expected config object but found array`, filepath);\n }\n\n return {\n filepath,\n dirname: path.dirname(filepath),\n options,\n };\n },\n);\n\n/**\n * Find metadata about the package that this file is inside of. Resolution\n * of Babel's config requires general package information to decide when to\n * search for .babelrc files\n */\nexport function* findPackageData(filepath: string): Handler {\n let pkg = null;\n const directories = [];\n let isPackage = true;\n\n let dirname = path.dirname(filepath);\n while (!pkg && path.basename(dirname) !== \"node_modules\") {\n directories.push(dirname);\n\n pkg = yield* readConfigPackage(path.join(dirname, PACKAGE_FILENAME));\n\n const nextLoc = path.dirname(dirname);\n if (dirname === nextLoc) {\n isPackage = false;\n break;\n }\n dirname = nextLoc;\n }\n\n return { filepath, directories, pkg, isPackage };\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AAIA;AAEA,MAAMA,gBAAgB,GAAG,cAAc;AAEvC,MAAMC,iBAAiB,GAAG,IAAAC,0BAAmB,EAC3C,CAACC,QAAQ,EAAEC,OAAO,KAAiB;EACjC,IAAIC,OAAO;EACX,IAAI;IACFA,OAAO,GAAGC,IAAI,CAACC,KAAK,CAACH,OAAO,CAAY;EAC1C,CAAC,CAAC,OAAOI,GAAG,EAAE;IACZ,MAAM,IAAIC,oBAAW,CAClB,8BAA6BD,GAAG,CAACE,OAAQ,EAAC,EAC3CP,QAAQ,CACT;EACH;EAEA,IAAI,CAACE,OAAO,EAAE,MAAM,IAAIM,KAAK,CAAE,GAAER,QAAS,sBAAqB,CAAC;EAEhE,IAAI,OAAOE,OAAO,KAAK,QAAQ,EAAE;IAC/B,MAAM,IAAII,oBAAW,CAClB,0BAAyB,OAAOJ,OAAQ,EAAC,EAC1CF,QAAQ,CACT;EACH;EACA,IAAIS,KAAK,CAACC,OAAO,CAACR,OAAO,CAAC,EAAE;IAC1B,MAAM,IAAII,oBAAW,CAAE,wCAAuC,EAAEN,QAAQ,CAAC;EAC3E;EAEA,OAAO;IACLA,QAAQ;IACRW,OAAO,EAAEC,OAAI,CAACD,OAAO,CAACX,QAAQ,CAAC;IAC/BE;EACF,CAAC;AACH,CAAC,CACF;;AAOM,UAAUW,eAAe,CAACb,QAAgB,EAA4B;EAC3E,IAAIc,GAAG,GAAG,IAAI;EACd,MAAMC,WAAW,GAAG,EAAE;EACtB,IAAIC,SAAS,GAAG,IAAI;EAEpB,IAAIL,OAAO,GAAGC,OAAI,CAACD,OAAO,CAACX,QAAQ,CAAC;EACpC,OAAO,CAACc,GAAG,IAAIF,OAAI,CAACK,QAAQ,CAACN,OAAO,CAAC,KAAK,cAAc,EAAE;IACxDI,WAAW,CAACG,IAAI,CAACP,OAAO,CAAC;IAEzBG,GAAG,GAAG,OAAOhB,iBAAiB,CAACc,OAAI,CAACO,IAAI,CAACR,OAAO,EAAEd,gBAAgB,CAAC,CAAC;IAEpE,MAAMuB,OAAO,GAAGR,OAAI,CAACD,OAAO,CAACA,OAAO,CAAC;IACrC,IAAIA,OAAO,KAAKS,OAAO,EAAE;MACvBJ,SAAS,GAAG,KAAK;MACjB;IACF;IACAL,OAAO,GAAGS,OAAO;EACnB;EAEA,OAAO;IAAEpB,QAAQ;IAAEe,WAAW;IAAED,GAAG;IAAEE;EAAU,CAAC;AAClD;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/plugins.js b/node_modules/@babel/core/lib/config/files/plugins.js index 327eb7dc3..4c98e49a8 100644 --- a/node_modules/@babel/core/lib/config/files/plugins.js +++ b/node_modules/@babel/core/lib/config/files/plugins.js @@ -7,69 +7,47 @@ exports.loadPlugin = loadPlugin; exports.loadPreset = loadPreset; exports.resolvePlugin = resolvePlugin; exports.resolvePreset = resolvePreset; - function _debug() { const data = require("debug"); - _debug = function () { return data; }; - return data; } - function _path() { const data = require("path"); - _path = function () { return data; }; - return data; } - function _gensync() { const data = require("gensync"); - _gensync = function () { return data; }; - return data; } - var _async = require("../../gensync-utils/async"); - var _moduleTypes = require("./module-types"); - function _url() { const data = require("url"); - _url = function () { return data; }; - return data; } - var _importMetaResolve = require("./import-meta-resolve"); - function _module() { const data = require("module"); - _module = function () { return data; }; - return data; } - function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - const debug = _debug()("babel:config:loading:files:plugins"); - const EXACT_RE = /^module:/; const BABEL_PLUGIN_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-plugin-)/; const BABEL_PRESET_PREFIX_RE = /^(?!@|module:|[^/]+\/|babel-preset-)/; @@ -78,15 +56,12 @@ const BABEL_PRESET_ORG_RE = /^(@babel\/)(?!preset-|[^/]+\/)/; const OTHER_PLUGIN_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-plugin(?:-|\/|$)|[^/]+\/)/; const OTHER_PRESET_ORG_RE = /^(@(?!babel\/)[^/]+\/)(?![^/]*babel-preset(?:-|\/|$)|[^/]+\/)/; const OTHER_ORG_DEFAULT_RE = /^(@(?!babel$)[^/]+)$/; - function* resolvePlugin(name, dirname) { return yield* resolveStandardizedName("plugin", name, dirname); } - function* resolvePreset(name, dirname) { return yield* resolveStandardizedName("preset", name, dirname); } - function* loadPlugin(name, dirname) { const filepath = yield* resolvePlugin(name, dirname); const value = yield* requireModule("plugin", filepath); @@ -96,7 +71,6 @@ function* loadPlugin(name, dirname) { value }; } - function* loadPreset(name, dirname) { const filepath = yield* resolvePreset(name, dirname); const value = yield* requireModule("preset", filepath); @@ -106,13 +80,16 @@ function* loadPreset(name, dirname) { value }; } - function standardizeName(type, name) { if (_path().isAbsolute(name)) return name; const isPreset = type === "preset"; - return name.replace(isPreset ? BABEL_PRESET_PREFIX_RE : BABEL_PLUGIN_PREFIX_RE, `babel-${type}-`).replace(isPreset ? BABEL_PRESET_ORG_RE : BABEL_PLUGIN_ORG_RE, `$1${type}-`).replace(isPreset ? OTHER_PRESET_ORG_RE : OTHER_PLUGIN_ORG_RE, `$1babel-${type}-`).replace(OTHER_ORG_DEFAULT_RE, `$1/babel-${type}`).replace(EXACT_RE, ""); + return name + .replace(isPreset ? BABEL_PRESET_PREFIX_RE : BABEL_PLUGIN_PREFIX_RE, `babel-${type}-`) + .replace(isPreset ? BABEL_PRESET_ORG_RE : BABEL_PLUGIN_ORG_RE, `$1${type}-`) + .replace(isPreset ? OTHER_PRESET_ORG_RE : OTHER_PLUGIN_ORG_RE, `$1babel-${type}-`) + .replace(OTHER_ORG_DEFAULT_RE, `$1/babel-${type}`) + .replace(EXACT_RE, ""); } - function* resolveAlternativesHelper(type, name) { const standardizedName = standardizeName(type, name); const { @@ -120,25 +97,20 @@ function* resolveAlternativesHelper(type, name) { value } = yield standardizedName; if (!error) return value; - if (error.code !== "MODULE_NOT_FOUND") throw error; + if (error.code !== "MODULE_NOT_FOUND") throw error; if (standardizedName !== name && !(yield name).error) { error.message += `\n- If you want to resolve "${name}", use "module:${name}"`; } - if (!(yield standardizeName(type, "@babel/" + name)).error) { error.message += `\n- Did you mean "@babel/${name}"?`; } - const oppositeType = type === "preset" ? "plugin" : "preset"; - if (!(yield standardizeName(oppositeType, name)).error) { error.message += `\n- Did you accidentally pass a ${oppositeType} as a ${type}?`; } - throw error; } - function tryRequireResolve(id, { paths: [dirname] }) { @@ -149,7 +121,6 @@ function tryRequireResolve(id, { paths: [b] }, M = require("module")) => { let f = M._findPath(r, M._nodeModulePaths(b).concat(b)); - if (f) return f; f = new Error(`Cannot resolve module '${r}'`); f.code = "MODULE_NOT_FOUND"; @@ -165,11 +136,9 @@ function tryRequireResolve(id, { }; } } - function tryImportMetaResolve(_x, _x2) { return _tryImportMetaResolve.apply(this, arguments); } - function _tryImportMetaResolve() { _tryImportMetaResolve = _asyncToGenerator(function* (id, options) { try { @@ -186,50 +155,40 @@ function _tryImportMetaResolve() { }); return _tryImportMetaResolve.apply(this, arguments); } - function resolveStandardizedNameForRequire(type, name, dirname) { const it = resolveAlternativesHelper(type, name); let res = it.next(); - while (!res.done) { res = it.next(tryRequireResolve(res.value, { paths: [dirname] })); } - return res.value; } - function resolveStandardizedNameForImport(_x3, _x4, _x5) { return _resolveStandardizedNameForImport.apply(this, arguments); } - function _resolveStandardizedNameForImport() { _resolveStandardizedNameForImport = _asyncToGenerator(function* (type, name, dirname) { const parentUrl = (0, _url().pathToFileURL)(_path().join(dirname, "./babel-virtual-resolve-base.js")).href; const it = resolveAlternativesHelper(type, name); let res = it.next(); - while (!res.done) { res = it.next(yield tryImportMetaResolve(res.value, parentUrl)); } - return (0, _url().fileURLToPath)(res.value); }); return _resolveStandardizedNameForImport.apply(this, arguments); } - const resolveStandardizedName = _gensync()({ sync(type, name, dirname = process.cwd()) { return resolveStandardizedNameForRequire(type, name, dirname); }, - async(type, name, dirname = process.cwd()) { return _asyncToGenerator(function* () { if (!_moduleTypes.supportsESM) { return resolveStandardizedNameForRequire(type, name, dirname); } - try { return yield resolveStandardizedNameForImport(type, name, dirname); } catch (e) { @@ -243,25 +202,22 @@ const resolveStandardizedName = _gensync()({ } })(); } - }); - { var LOADING_MODULES = new Set(); } - function* requireModule(type, name) { { if (!(yield* (0, _async.isAsync)()) && LOADING_MODULES.has(name)) { throw new Error(`Reentrant ${type} detected trying to load "${name}". This module is not ignored ` + "and is trying to load itself while compiling itself, leading to a dependency cycle. " + 'We recommend adding it to your "ignore" list in your babelrc, or to a .babelignore.'); } } - try { { LOADING_MODULES.add(name); } - return yield* (0, _moduleTypes.default)(name, `You appear to be using a native ECMAScript module ${type}, ` + "which is only supported when running Babel asynchronously.", true); + return yield* (0, _moduleTypes.default)(name, `You appear to be using a native ECMAScript module ${type}, ` + "which is only supported when running Babel asynchronously.", + true); } catch (err) { err.message = `[BABEL]: ${err.message} (While processing: ${name})`; throw err; @@ -271,7 +227,6 @@ function* requireModule(type, name) { } } } - 0 && 0; //# sourceMappingURL=plugins.js.map diff --git a/node_modules/@babel/core/lib/config/files/plugins.js.map b/node_modules/@babel/core/lib/config/files/plugins.js.map index 2ef528e51..eb6c19bfe 100644 --- a/node_modules/@babel/core/lib/config/files/plugins.js.map +++ b/node_modules/@babel/core/lib/config/files/plugins.js.map @@ -1 +1 @@ -{"version":3,"names":["debug","buildDebug","EXACT_RE","BABEL_PLUGIN_PREFIX_RE","BABEL_PRESET_PREFIX_RE","BABEL_PLUGIN_ORG_RE","BABEL_PRESET_ORG_RE","OTHER_PLUGIN_ORG_RE","OTHER_PRESET_ORG_RE","OTHER_ORG_DEFAULT_RE","resolvePlugin","name","dirname","resolveStandardizedName","resolvePreset","loadPlugin","filepath","value","requireModule","loadPreset","standardizeName","type","path","isAbsolute","isPreset","replace","resolveAlternativesHelper","standardizedName","error","code","message","oppositeType","tryRequireResolve","id","paths","tryImportMetaResolve","options","importMetaResolve","resolveStandardizedNameForRequire","it","res","next","done","resolveStandardizedNameForImport","parentUrl","pathToFileURL","join","href","fileURLToPath","gensync","sync","process","cwd","async","supportsESM","e","e2","LOADING_MODULES","Set","isAsync","has","Error","add","loadCjsOrMjsDefault","err","delete"],"sources":["../../../src/config/files/plugins.ts"],"sourcesContent":["/**\n * This file handles all logic for converting string-based configuration references into loaded objects.\n */\n\nimport buildDebug from \"debug\";\nimport path from \"path\";\nimport gensync, { type Handler } from \"gensync\";\nimport { isAsync } from \"../../gensync-utils/async\";\nimport loadCjsOrMjsDefault, { supportsESM } from \"./module-types\";\nimport { fileURLToPath, pathToFileURL } from \"url\";\n\nimport importMetaResolve from \"./import-meta-resolve\";\n\nimport { createRequire } from \"module\";\nconst require = createRequire(import.meta.url);\n\nconst debug = buildDebug(\"babel:config:loading:files:plugins\");\n\nconst EXACT_RE = /^module:/;\nconst BABEL_PLUGIN_PREFIX_RE = /^(?!@|module:|[^/]+\\/|babel-plugin-)/;\nconst BABEL_PRESET_PREFIX_RE = /^(?!@|module:|[^/]+\\/|babel-preset-)/;\nconst BABEL_PLUGIN_ORG_RE = /^(@babel\\/)(?!plugin-|[^/]+\\/)/;\nconst BABEL_PRESET_ORG_RE = /^(@babel\\/)(?!preset-|[^/]+\\/)/;\nconst OTHER_PLUGIN_ORG_RE =\n /^(@(?!babel\\/)[^/]+\\/)(?![^/]*babel-plugin(?:-|\\/|$)|[^/]+\\/)/;\nconst OTHER_PRESET_ORG_RE =\n /^(@(?!babel\\/)[^/]+\\/)(?![^/]*babel-preset(?:-|\\/|$)|[^/]+\\/)/;\nconst OTHER_ORG_DEFAULT_RE = /^(@(?!babel$)[^/]+)$/;\n\nexport function* resolvePlugin(name: string, dirname: string): Handler {\n return yield* resolveStandardizedName(\"plugin\", name, dirname);\n}\n\nexport function* resolvePreset(name: string, dirname: string): Handler {\n return yield* resolveStandardizedName(\"preset\", name, dirname);\n}\n\nexport function* loadPlugin(\n name: string,\n dirname: string,\n): Handler<{ filepath: string; value: unknown }> {\n const filepath = yield* resolvePlugin(name, dirname);\n\n const value = yield* requireModule(\"plugin\", filepath);\n debug(\"Loaded plugin %o from %o.\", name, dirname);\n\n return { filepath, value };\n}\n\nexport function* loadPreset(\n name: string,\n dirname: string,\n): Handler<{ filepath: string; value: unknown }> {\n const filepath = yield* resolvePreset(name, dirname);\n\n const value = yield* requireModule(\"preset\", filepath);\n\n debug(\"Loaded preset %o from %o.\", name, dirname);\n\n return { filepath, value };\n}\n\nfunction standardizeName(type: \"plugin\" | \"preset\", name: string) {\n // Let absolute and relative paths through.\n if (path.isAbsolute(name)) return name;\n\n const isPreset = type === \"preset\";\n\n return (\n name\n // foo -> babel-preset-foo\n .replace(\n isPreset ? BABEL_PRESET_PREFIX_RE : BABEL_PLUGIN_PREFIX_RE,\n `babel-${type}-`,\n )\n // @babel/es2015 -> @babel/preset-es2015\n .replace(\n isPreset ? BABEL_PRESET_ORG_RE : BABEL_PLUGIN_ORG_RE,\n `$1${type}-`,\n )\n // @foo/mypreset -> @foo/babel-preset-mypreset\n .replace(\n isPreset ? OTHER_PRESET_ORG_RE : OTHER_PLUGIN_ORG_RE,\n `$1babel-${type}-`,\n )\n // @foo -> @foo/babel-preset\n .replace(OTHER_ORG_DEFAULT_RE, `$1/babel-${type}`)\n // module:mypreset -> mypreset\n .replace(EXACT_RE, \"\")\n );\n}\n\ntype Result = { error: Error; value: null } | { error: null; value: T };\n\nfunction* resolveAlternativesHelper(\n type: \"plugin\" | \"preset\",\n name: string,\n): Iterator> {\n const standardizedName = standardizeName(type, name);\n const { error, value } = yield standardizedName;\n if (!error) return value;\n\n // @ts-expect-error code may not index error\n if (error.code !== \"MODULE_NOT_FOUND\") throw error;\n\n if (standardizedName !== name && !(yield name).error) {\n error.message += `\\n- If you want to resolve \"${name}\", use \"module:${name}\"`;\n }\n\n if (!(yield standardizeName(type, \"@babel/\" + name)).error) {\n error.message += `\\n- Did you mean \"@babel/${name}\"?`;\n }\n\n const oppositeType = type === \"preset\" ? \"plugin\" : \"preset\";\n if (!(yield standardizeName(oppositeType, name)).error) {\n error.message += `\\n- Did you accidentally pass a ${oppositeType} as a ${type}?`;\n }\n\n throw error;\n}\n\nfunction tryRequireResolve(\n id: Parameters[0],\n { paths: [dirname] }: Parameters[1],\n): Result {\n try {\n return { error: null, value: require.resolve(id, { paths: [dirname] }) };\n } catch (error) {\n return { error, value: null };\n }\n}\n\nasync function tryImportMetaResolve(\n id: Parameters[0],\n options: Parameters[1],\n): Promise> {\n try {\n return { error: null, value: await importMetaResolve(id, options) };\n } catch (error) {\n return { error, value: null };\n }\n}\n\nfunction resolveStandardizedNameForRequire(\n type: \"plugin\" | \"preset\",\n name: string,\n dirname: string,\n) {\n const it = resolveAlternativesHelper(type, name);\n let res = it.next();\n while (!res.done) {\n res = it.next(tryRequireResolve(res.value, { paths: [dirname] }));\n }\n return res.value;\n}\nasync function resolveStandardizedNameForImport(\n type: \"plugin\" | \"preset\",\n name: string,\n dirname: string,\n) {\n const parentUrl = pathToFileURL(\n path.join(dirname, \"./babel-virtual-resolve-base.js\"),\n ).href;\n\n const it = resolveAlternativesHelper(type, name);\n let res = it.next();\n while (!res.done) {\n res = it.next(await tryImportMetaResolve(res.value, parentUrl));\n }\n return fileURLToPath(res.value);\n}\n\nconst resolveStandardizedName = gensync<\n [type: \"plugin\" | \"preset\", name: string, dirname?: string],\n string\n>({\n sync(type, name, dirname = process.cwd()) {\n return resolveStandardizedNameForRequire(type, name, dirname);\n },\n async async(type, name, dirname = process.cwd()) {\n if (!supportsESM) {\n return resolveStandardizedNameForRequire(type, name, dirname);\n }\n\n try {\n return await resolveStandardizedNameForImport(type, name, dirname);\n } catch (e) {\n try {\n return resolveStandardizedNameForRequire(type, name, dirname);\n } catch (e2) {\n if (e.type === \"MODULE_NOT_FOUND\") throw e;\n if (e2.type === \"MODULE_NOT_FOUND\") throw e2;\n throw e;\n }\n }\n },\n});\n\nif (!process.env.BABEL_8_BREAKING) {\n // eslint-disable-next-line no-var\n var LOADING_MODULES = new Set();\n}\nfunction* requireModule(type: string, name: string): Handler {\n if (!process.env.BABEL_8_BREAKING) {\n if (!(yield* isAsync()) && LOADING_MODULES.has(name)) {\n throw new Error(\n `Reentrant ${type} detected trying to load \"${name}\". This module is not ignored ` +\n \"and is trying to load itself while compiling itself, leading to a dependency cycle. \" +\n 'We recommend adding it to your \"ignore\" list in your babelrc, or to a .babelignore.',\n );\n }\n }\n\n try {\n if (!process.env.BABEL_8_BREAKING) {\n LOADING_MODULES.add(name);\n }\n return yield* loadCjsOrMjsDefault(\n name,\n `You appear to be using a native ECMAScript module ${type}, ` +\n \"which is only supported when running Babel asynchronously.\",\n // For backward compatibility, we need to support malformed presets\n // defined as separate named exports rather than a single default\n // export.\n // See packages/babel-core/test/fixtures/option-manager/presets/es2015_named.js\n true,\n );\n } catch (err) {\n err.message = `[BABEL]: ${err.message} (While processing: ${name})`;\n throw err;\n } finally {\n if (!process.env.BABEL_8_BREAKING) {\n LOADING_MODULES.delete(name);\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAIA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAA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ORG_RE","BABEL_PRESET_ORG_RE","OTHER_PLUGIN_ORG_RE","OTHER_PRESET_ORG_RE","OTHER_ORG_DEFAULT_RE","resolvePlugin","name","dirname","resolveStandardizedName","resolvePreset","loadPlugin","filepath","value","requireModule","loadPreset","standardizeName","type","path","isAbsolute","isPreset","replace","resolveAlternativesHelper","standardizedName","error","code","message","oppositeType","tryRequireResolve","id","paths","tryImportMetaResolve","options","importMetaResolve","resolveStandardizedNameForRequire","it","res","next","done","resolveStandardizedNameForImport","parentUrl","pathToFileURL","join","href","fileURLToPath","gensync","sync","process","cwd","async","supportsESM","e","e2","LOADING_MODULES","Set","isAsync","has","Error","add","loadCjsOrMjsDefault","err","delete"],"sources":["../../../src/config/files/plugins.ts"],"sourcesContent":["/**\n * This file handles all logic for converting string-based configuration references into loaded objects.\n */\n\nimport buildDebug from \"debug\";\nimport path from \"path\";\nimport gensync, { type Handler } from \"gensync\";\nimport { isAsync } from \"../../gensync-utils/async\";\nimport loadCjsOrMjsDefault, { supportsESM } from \"./module-types\";\nimport { fileURLToPath, pathToFileURL } from \"url\";\n\nimport importMetaResolve from \"./import-meta-resolve\";\n\nimport { createRequire } from \"module\";\nconst require = createRequire(import.meta.url);\n\nconst debug = buildDebug(\"babel:config:loading:files:plugins\");\n\nconst EXACT_RE = /^module:/;\nconst BABEL_PLUGIN_PREFIX_RE = /^(?!@|module:|[^/]+\\/|babel-plugin-)/;\nconst BABEL_PRESET_PREFIX_RE = /^(?!@|module:|[^/]+\\/|babel-preset-)/;\nconst BABEL_PLUGIN_ORG_RE = /^(@babel\\/)(?!plugin-|[^/]+\\/)/;\nconst BABEL_PRESET_ORG_RE = /^(@babel\\/)(?!preset-|[^/]+\\/)/;\nconst OTHER_PLUGIN_ORG_RE =\n /^(@(?!babel\\/)[^/]+\\/)(?![^/]*babel-plugin(?:-|\\/|$)|[^/]+\\/)/;\nconst OTHER_PRESET_ORG_RE =\n /^(@(?!babel\\/)[^/]+\\/)(?![^/]*babel-preset(?:-|\\/|$)|[^/]+\\/)/;\nconst OTHER_ORG_DEFAULT_RE = /^(@(?!babel$)[^/]+)$/;\n\nexport function* resolvePlugin(name: string, dirname: string): Handler {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return yield* resolveStandardizedName(\"plugin\", name, dirname);\n}\n\nexport function* resolvePreset(name: string, dirname: string): Handler {\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return yield* resolveStandardizedName(\"preset\", name, dirname);\n}\n\nexport function* loadPlugin(\n name: string,\n dirname: string,\n): Handler<{ filepath: string; value: unknown }> {\n const filepath = yield* resolvePlugin(name, dirname);\n\n const value = yield* requireModule(\"plugin\", filepath);\n debug(\"Loaded plugin %o from %o.\", name, dirname);\n\n return { filepath, value };\n}\n\nexport function* loadPreset(\n name: string,\n dirname: string,\n): Handler<{ filepath: string; value: unknown }> {\n const filepath = yield* resolvePreset(name, dirname);\n\n const value = yield* requireModule(\"preset\", filepath);\n\n debug(\"Loaded preset %o from %o.\", name, dirname);\n\n return { filepath, value };\n}\n\nfunction standardizeName(type: \"plugin\" | \"preset\", name: string) {\n // Let absolute and relative paths through.\n if (path.isAbsolute(name)) return name;\n\n const isPreset = type === \"preset\";\n\n return (\n name\n // foo -> babel-preset-foo\n .replace(\n isPreset ? BABEL_PRESET_PREFIX_RE : BABEL_PLUGIN_PREFIX_RE,\n `babel-${type}-`,\n )\n // @babel/es2015 -> @babel/preset-es2015\n .replace(\n isPreset ? BABEL_PRESET_ORG_RE : BABEL_PLUGIN_ORG_RE,\n `$1${type}-`,\n )\n // @foo/mypreset -> @foo/babel-preset-mypreset\n .replace(\n isPreset ? OTHER_PRESET_ORG_RE : OTHER_PLUGIN_ORG_RE,\n `$1babel-${type}-`,\n )\n // @foo -> @foo/babel-preset\n .replace(OTHER_ORG_DEFAULT_RE, `$1/babel-${type}`)\n // module:mypreset -> mypreset\n .replace(EXACT_RE, \"\")\n );\n}\n\ntype Result = { error: Error; value: null } | { error: null; value: T };\n\nfunction* resolveAlternativesHelper(\n type: \"plugin\" | \"preset\",\n name: string,\n): Iterator> {\n const standardizedName = standardizeName(type, name);\n const { error, value } = yield standardizedName;\n if (!error) return value;\n\n // @ts-expect-error code may not index error\n if (error.code !== \"MODULE_NOT_FOUND\") throw error;\n\n if (standardizedName !== name && !(yield name).error) {\n error.message += `\\n- If you want to resolve \"${name}\", use \"module:${name}\"`;\n }\n\n if (!(yield standardizeName(type, \"@babel/\" + name)).error) {\n error.message += `\\n- Did you mean \"@babel/${name}\"?`;\n }\n\n const oppositeType = type === \"preset\" ? \"plugin\" : \"preset\";\n if (!(yield standardizeName(oppositeType, name)).error) {\n error.message += `\\n- Did you accidentally pass a ${oppositeType} as a ${type}?`;\n }\n\n throw error;\n}\n\nfunction tryRequireResolve(\n id: Parameters[0],\n { paths: [dirname] }: Parameters[1],\n): Result {\n try {\n return { error: null, value: require.resolve(id, { paths: [dirname] }) };\n } catch (error) {\n return { error, value: null };\n }\n}\n\nasync function tryImportMetaResolve(\n id: Parameters[0],\n options: Parameters[1],\n): Promise> {\n try {\n return { error: null, value: await importMetaResolve(id, options) };\n } catch (error) {\n return { error, value: null };\n }\n}\n\nfunction resolveStandardizedNameForRequire(\n type: \"plugin\" | \"preset\",\n name: string,\n dirname: string,\n) {\n const it = resolveAlternativesHelper(type, name);\n let res = it.next();\n while (!res.done) {\n res = it.next(tryRequireResolve(res.value, { paths: [dirname] }));\n }\n return res.value;\n}\nasync function resolveStandardizedNameForImport(\n type: \"plugin\" | \"preset\",\n name: string,\n dirname: string,\n) {\n const parentUrl = pathToFileURL(\n path.join(dirname, \"./babel-virtual-resolve-base.js\"),\n ).href;\n\n const it = resolveAlternativesHelper(type, name);\n let res = it.next();\n while (!res.done) {\n res = it.next(await tryImportMetaResolve(res.value, parentUrl));\n }\n return fileURLToPath(res.value);\n}\n\nconst resolveStandardizedName = gensync<\n [type: \"plugin\" | \"preset\", name: string, dirname?: string],\n string\n>({\n sync(type, name, dirname = process.cwd()) {\n return resolveStandardizedNameForRequire(type, name, dirname);\n },\n async async(type, name, dirname = process.cwd()) {\n if (!supportsESM) {\n return resolveStandardizedNameForRequire(type, name, dirname);\n }\n\n try {\n return await resolveStandardizedNameForImport(type, name, dirname);\n } catch (e) {\n try {\n return resolveStandardizedNameForRequire(type, name, dirname);\n } catch (e2) {\n if (e.type === \"MODULE_NOT_FOUND\") throw e;\n if (e2.type === \"MODULE_NOT_FOUND\") throw e2;\n throw e;\n }\n }\n },\n});\n\nif (!process.env.BABEL_8_BREAKING) {\n // eslint-disable-next-line no-var\n var LOADING_MODULES = new Set();\n}\nfunction* requireModule(type: string, name: string): Handler {\n if (!process.env.BABEL_8_BREAKING) {\n if (!(yield* isAsync()) && LOADING_MODULES.has(name)) {\n throw new Error(\n `Reentrant ${type} detected trying to load \"${name}\". This module is not ignored ` +\n \"and is trying to load itself while compiling itself, leading to a dependency cycle. \" +\n 'We recommend adding it to your \"ignore\" list in your babelrc, or to a .babelignore.',\n );\n }\n }\n\n try {\n if (!process.env.BABEL_8_BREAKING) {\n LOADING_MODULES.add(name);\n }\n return yield* loadCjsOrMjsDefault(\n name,\n `You appear to be using a native ECMAScript module ${type}, ` +\n \"which is only supported when running Babel asynchronously.\",\n // For backward compatibility, we need to support malformed presets\n // defined as separate named exports rather than a single default\n // export.\n // See packages/babel-core/test/fixtures/option-manager/presets/es2015_named.js\n true,\n );\n } catch (err) {\n err.message = `[BABEL]: ${err.message} (While processing: ${name})`;\n throw err;\n } finally {\n if (!process.env.BABEL_8_BREAKING) {\n LOADING_MODULES.delete(name);\n }\n }\n}\n"],"mappings":";;;;;;;;;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AACA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAuC;AAAA;AAGvC,M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,CAAC,EAAE;QACV,IAAI;UACF,OAAOjB,iCAAiC,CAACjB,IAAI,EAAEV,IAAI,EAAEC,OAAO,CAAC;QAC/D,CAAC,CAAC,OAAO4C,EAAE,EAAE;UACX,IAAID,CAAC,CAAClC,IAAI,KAAK,kBAAkB,EAAE,MAAMkC,CAAC;UAC1C,IAAIC,EAAE,CAACnC,IAAI,KAAK,kBAAkB,EAAE,MAAMmC,EAAE;UAC5C,MAAMD,CAAC;QACT;MACF;IAAC;EACH;AACF,CAAC,CAAC;AAEiC;EAEjC,IAAIE,eAAe,GAAG,IAAIC,GAAG,EAAE;AACjC;AACA,UAAUxC,aAAa,CAACG,IAAY,EAAEV,IAAY,EAAoB;EACjC;IACjC,IAAI,EAAE,OAAO,IAAAgD,cAAO,GAAE,CAAC,IAAIF,eAAe,CAACG,GAAG,CAACjD,IAAI,CAAC,EAAE;MACpD,MAAM,IAAIkD,KAAK,CACZ,aAAYxC,IAAK,6BAA4BV,IAAK,gCAA+B,GAChF,sFAAsF,GACtF,qFAAqF,CACxF;IACH;EACF;EAEA,IAAI;IACiC;MACjC8C,eAAe,CAACK,GAAG,CAACnD,IAAI,CAAC;IAC3B;IACA,OAAO,OAAO,IAAAoD,oBAAmB,EAC/BpD,IAAI,EACH,qDAAoDU,IAAK,IAAG,GAC3D,4DAA4D;IAK9D,IAAI,CACL;EACH,CAAC,CAAC,OAAO2C,GAAG,EAAE;IACZA,GAAG,CAAClC,OAAO,GAAI,YAAWkC,GAAG,CAAClC,OAAQ,uBAAsBnB,IAAK,GAAE;IACnE,MAAMqD,GAAG;EACX,CAAC,SAAS;IAC2B;MACjCP,eAAe,CAACQ,MAAM,CAACtD,IAAI,CAAC;IAC9B;EACF;AACF;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/files/utils.js b/node_modules/@babel/core/lib/config/files/utils.js index e60f0bef3..1c4ccbf0d 100644 --- a/node_modules/@babel/core/lib/config/files/utils.js +++ b/node_modules/@babel/core/lib/config/files/utils.js @@ -4,45 +4,33 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.makeStaticFileCache = makeStaticFileCache; - var _caching = require("../caching"); - var fs = require("../../gensync-utils/fs"); - function _fs2() { const data = require("fs"); - _fs2 = function () { return data; }; - return data; } - function makeStaticFileCache(fn) { return (0, _caching.makeStrongCache)(function* (filepath, cache) { const cached = cache.invalidate(() => fileMtime(filepath)); - if (cached === null) { return null; } - return fn(filepath, yield* fs.readFile(filepath, "utf8")); }); } - function fileMtime(filepath) { if (!_fs2().existsSync(filepath)) return null; - try { return +_fs2().statSync(filepath).mtime; } catch (e) { if (e.code !== "ENOENT" && e.code !== "ENOTDIR") throw e; } - return null; } - 0 && 0; //# sourceMappingURL=utils.js.map diff --git a/node_modules/@babel/core/lib/config/files/utils.js.map b/node_modules/@babel/core/lib/config/files/utils.js.map index 36a6a3720..03629e1c0 100644 --- a/node_modules/@babel/core/lib/config/files/utils.js.map +++ b/node_modules/@babel/core/lib/config/files/utils.js.map @@ -1 +1 @@ -{"version":3,"names":["makeStaticFileCache","fn","makeStrongCache","filepath","cache","cached","invalidate","fileMtime","fs","readFile","nodeFs","existsSync","statSync","mtime","e","code"],"sources":["../../../src/config/files/utils.ts"],"sourcesContent":["import type { Handler } from \"gensync\";\n\nimport { makeStrongCache } from \"../caching\";\nimport type { CacheConfigurator } from \"../caching\";\nimport * as fs from \"../../gensync-utils/fs\";\nimport nodeFs from \"fs\";\n\nexport function makeStaticFileCache(\n fn: (filepath: string, contents: string) => T,\n) {\n return makeStrongCache(function* (\n filepath: string,\n cache: CacheConfigurator,\n ): Handler {\n const cached = cache.invalidate(() => fileMtime(filepath));\n\n if (cached === null) {\n return null;\n }\n\n return fn(filepath, yield* fs.readFile(filepath, \"utf8\"));\n });\n}\n\nfunction fileMtime(filepath: string): number | null {\n if (!nodeFs.existsSync(filepath)) return null;\n\n try {\n return +nodeFs.statSync(filepath).mtime;\n } catch (e) {\n if (e.code !== \"ENOENT\" && e.code !== \"ENOTDIR\") throw e;\n }\n\n return null;\n}\n"],"mappings":";;;;;;;AAEA;;AAEA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,SAASA,mBAAT,CACLC,EADK,EAEL;EACA,OAAO,IAAAC,wBAAA,EAAgB,WACrBC,QADqB,EAErBC,KAFqB,EAGF;IACnB,MAAMC,MAAM,GAAGD,KAAK,CAACE,UAAN,CAAiB,MAAMC,SAAS,CAACJ,QAAD,CAAhC,CAAf;;IAEA,IAAIE,MAAM,KAAK,IAAf,EAAqB;MACnB,OAAO,IAAP;IACD;;IAED,OAAOJ,EAAE,CAACE,QAAD,EAAW,OAAOK,EAAE,CAACC,QAAH,CAAYN,QAAZ,EAAsB,MAAtB,CAAlB,CAAT;EACD,CAXM,CAAP;AAYD;;AAED,SAASI,SAAT,CAAmBJ,QAAnB,EAAoD;EAClD,IAAI,CAACO,MAAA,CAAOC,UAAP,CAAkBR,QAAlB,CAAL,EAAkC,OAAO,IAAP;;EAElC,IAAI;IACF,OAAO,CAACO,MAAA,CAAOE,QAAP,CAAgBT,QAAhB,EAA0BU,KAAlC;EACD,CAFD,CAEE,OAAOC,CAAP,EAAU;IACV,IAAIA,CAAC,CAACC,IAAF,KAAW,QAAX,IAAuBD,CAAC,CAACC,IAAF,KAAW,SAAtC,EAAiD,MAAMD,CAAN;EAClD;;EAED,OAAO,IAAP;AACD"} \ No newline at end of file +{"version":3,"names":["makeStaticFileCache","fn","makeStrongCache","filepath","cache","cached","invalidate","fileMtime","fs","readFile","nodeFs","existsSync","statSync","mtime","e","code"],"sources":["../../../src/config/files/utils.ts"],"sourcesContent":["import type { Handler } from \"gensync\";\n\nimport { makeStrongCache } from \"../caching\";\nimport type { CacheConfigurator } from \"../caching\";\nimport * as fs from \"../../gensync-utils/fs\";\nimport nodeFs from \"fs\";\n\nexport function makeStaticFileCache(\n fn: (filepath: string, contents: string) => T,\n) {\n return makeStrongCache(function* (\n filepath: string,\n cache: CacheConfigurator,\n ): Handler {\n const cached = cache.invalidate(() => fileMtime(filepath));\n\n if (cached === null) {\n return null;\n }\n\n return fn(filepath, yield* fs.readFile(filepath, \"utf8\"));\n });\n}\n\nfunction fileMtime(filepath: string): number | null {\n if (!nodeFs.existsSync(filepath)) return null;\n\n try {\n return +nodeFs.statSync(filepath).mtime;\n } catch (e) {\n if (e.code !== \"ENOENT\" && e.code !== \"ENOTDIR\") throw e;\n }\n\n return null;\n}\n"],"mappings":";;;;;;AAEA;AAEA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,SAASA,mBAAmB,CACjCC,EAA6C,EAC7C;EACA,OAAO,IAAAC,wBAAe,EAAC,WACrBC,QAAgB,EAChBC,KAA8B,EACX;IACnB,MAAMC,MAAM,GAAGD,KAAK,CAACE,UAAU,CAAC,MAAMC,SAAS,CAACJ,QAAQ,CAAC,CAAC;IAE1D,IAAIE,MAAM,KAAK,IAAI,EAAE;MACnB,OAAO,IAAI;IACb;IAEA,OAAOJ,EAAE,CAACE,QAAQ,EAAE,OAAOK,EAAE,CAACC,QAAQ,CAACN,QAAQ,EAAE,MAAM,CAAC,CAAC;EAC3D,CAAC,CAAC;AACJ;AAEA,SAASI,SAAS,CAACJ,QAAgB,EAAiB;EAClD,IAAI,CAACO,MAAM,CAACC,UAAU,CAACR,QAAQ,CAAC,EAAE,OAAO,IAAI;EAE7C,IAAI;IACF,OAAO,CAACO,MAAM,CAACE,QAAQ,CAACT,QAAQ,CAAC,CAACU,KAAK;EACzC,CAAC,CAAC,OAAOC,CAAC,EAAE;IACV,IAAIA,CAAC,CAACC,IAAI,KAAK,QAAQ,IAAID,CAAC,CAACC,IAAI,KAAK,SAAS,EAAE,MAAMD,CAAC;EAC1D;EAEA,OAAO,IAAI;AACb;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/full.js b/node_modules/@babel/core/lib/config/full.js index 9beecffa4..172992f59 100644 --- a/node_modules/@babel/core/lib/config/full.js +++ b/node_modules/@babel/core/lib/config/full.js @@ -4,96 +4,65 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; - function _gensync() { const data = require("gensync"); - _gensync = function () { return data; }; - return data; } - var _async = require("../gensync-utils/async"); - var _util = require("./util"); - var context = require("../index"); - var _plugin = require("./plugin"); - var _item = require("./item"); - var _configChain = require("./config-chain"); - var _deepArray = require("./helpers/deep-array"); - function _traverse() { const data = require("@babel/traverse"); - _traverse = function () { return data; }; - return data; } - var _caching = require("./caching"); - var _options = require("./validation/options"); - var _plugins = require("./validation/plugins"); - var _configApi = require("./helpers/config-api"); - var _partial = require("./partial"); - var _configError = require("../errors/config-error"); - var _default = _gensync()(function* loadFullConfig(inputOpts) { var _opts$assumptions; - const result = yield* (0, _partial.default)(inputOpts); - if (!result) { return null; } - const { options, context, fileHandling } = result; - if (fileHandling === "ignored") { return null; } - const optionDefaults = {}; const { plugins, presets } = options; - if (!plugins || !presets) { throw new Error("Assertion failure - plugins and presets exist"); } - const presetContext = Object.assign({}, context, { targets: options.targets }); - const toDescriptor = item => { const desc = (0, _item.getItemDescriptor)(item); - if (!desc) { throw new Error("Assertion failure - must be config item"); } - return desc; }; - const presetsDescriptors = presets.map(toDescriptor); const initialPluginsDescriptors = plugins.map(toDescriptor); const pluginDescriptorsByPass = [[]]; @@ -101,10 +70,8 @@ var _default = _gensync()(function* loadFullConfig(inputOpts) { const externalDependencies = []; const ignored = yield* enhanceError(context, function* recursePresetDescriptors(rawPresets, pluginDescriptorsPass) { const presets = []; - for (let i = 0; i < rawPresets.length; i++) { const descriptor = rawPresets[i]; - if (descriptor.options !== false) { try { var preset = yield* loadPresetDescriptor(descriptor, presetContext); @@ -112,10 +79,8 @@ var _default = _gensync()(function* loadFullConfig(inputOpts) { if (e.code === "BABEL_UNKNOWN_OPTION") { (0, _options.checkNoUnwrappedItemOptionPairs)(rawPresets, i, "preset", e); } - throw e; } - externalDependencies.push(preset.externalDependencies); if (descriptor.ownPass) { @@ -134,7 +99,6 @@ var _default = _gensync()(function* loadFullConfig(inputOpts) { if (presets.length > 0) { pluginDescriptorsByPass.splice(1, 0, ...presets.map(o => o.pass).filter(p => p !== pluginDescriptorsPass)); - for (const { preset, pass @@ -157,14 +121,11 @@ var _default = _gensync()(function* loadFullConfig(inputOpts) { }); yield* enhanceError(context, function* loadPluginDescriptors() { pluginDescriptorsByPass[0].unshift(...initialPluginsDescriptors); - for (const descs of pluginDescriptorsByPass) { const pass = []; passes.push(pass); - for (let i = 0; i < descs.length; i++) { const descriptor = descs[i]; - if (descriptor.options !== false) { try { var plugin = yield* loadPluginDescriptor(descriptor, pluginContext); @@ -172,10 +133,8 @@ var _default = _gensync()(function* loadFullConfig(inputOpts) { if (e.code === "BABEL_UNKNOWN_PLUGIN_PROPERTY") { (0, _options.checkNoUnwrappedItemOptionPairs)(descs, i, "plugin", e); } - throw e; } - pass.push(plugin); externalDependencies.push(plugin.externalDependencies); } @@ -193,9 +152,7 @@ var _default = _gensync()(function* loadFullConfig(inputOpts) { externalDependencies: (0, _deepArray.finalize)(externalDependencies) }; }); - exports.default = _default; - function enhanceError(context, fn) { return function* (arg1, arg2) { try { @@ -203,10 +160,8 @@ function enhanceError(context, fn) { } catch (e) { if (!/^\[BABEL\]/.test(e.message)) { var _context$filename; - e.message = `[BABEL] ${(_context$filename = context.filename) != null ? _context$filename : "unknown file"}: ${e.message}`; } - throw e; } }; @@ -222,44 +177,35 @@ const makeDescriptorLoader = apiFactory => (0, _caching.makeWeakCache)(function* options = options || {}; const externalDependencies = []; let item = value; - if (typeof value === "function") { const factory = (0, _async.maybeAsync)(value, `You appear to be using an async plugin/preset, but Babel has been called synchronously`); const api = Object.assign({}, context, apiFactory(cache, externalDependencies)); - try { item = yield* factory(api, options, dirname); } catch (e) { if (alias) { e.message += ` (While processing: ${JSON.stringify(alias)})`; } - throw e; } } - if (!item || typeof item !== "object") { throw new Error("Plugin/Preset did not return an object."); } - if ((0, _async.isThenable)(item)) { yield* []; throw new Error(`You appear to be using a promise as a plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version. ` + `As an alternative, you can prefix the promise with "await". ` + `(While processing: ${JSON.stringify(alias)})`); } - if (externalDependencies.length > 0 && (!cache.configured() || cache.mode() === "forever")) { let error = `A plugin/preset has external untracked dependencies ` + `(${externalDependencies[0]}), but the cache `; - if (!cache.configured()) { error += `has not been configured to be invalidated when the external dependencies change. `; } else { error += ` has been configured to never be invalidated. `; } - error += `Plugins/presets should configure their cache to be invalidated when the external ` + `dependencies change, for example using \`api.cache.invalidate(() => ` + `statSync(filepath).mtimeMs)\` or \`api.cache.never()\`\n` + `(While processing: ${JSON.stringify(alias)})`; throw new Error(error); } - return { value: item, options, @@ -268,22 +214,8 @@ const makeDescriptorLoader = apiFactory => (0, _caching.makeWeakCache)(function* externalDependencies: (0, _deepArray.finalize)(externalDependencies) }; }); - const pluginDescriptorLoader = makeDescriptorLoader(_configApi.makePluginAPI); const presetDescriptorLoader = makeDescriptorLoader(_configApi.makePresetAPI); - -function* loadPluginDescriptor(descriptor, context) { - if (descriptor.value instanceof _plugin.default) { - if (descriptor.options) { - throw new Error("Passed options to an existing Plugin instance will not work."); - } - - return descriptor.value; - } - - return yield* instantiatePlugin(yield* pluginDescriptorLoader(descriptor, context), context); -} - const instantiatePlugin = (0, _caching.makeWeakCache)(function* ({ value, options, @@ -293,11 +225,9 @@ const instantiatePlugin = (0, _caching.makeWeakCache)(function* ({ }, cache) { const pluginObj = (0, _plugins.validatePluginObject)(value); const plugin = Object.assign({}, pluginObj); - if (plugin.visitor) { plugin.visitor = _traverse().default.explode(Object.assign({}, plugin.visitor)); } - if (plugin.inherits) { const inheritsDescriptor = { name: undefined, @@ -313,7 +243,6 @@ const instantiatePlugin = (0, _caching.makeWeakCache)(function* ({ plugin.post = chain(inherits.post, plugin.post); plugin.manipulateOptions = chain(inherits.manipulateOptions, plugin.manipulateOptions); plugin.visitor = _traverse().default.visitors.merge([inherits.visitor || {}, plugin.visitor || {}]); - if (inherits.externalDependencies.length > 0) { if (externalDependencies.length === 0) { externalDependencies = inherits.externalDependencies; @@ -322,41 +251,36 @@ const instantiatePlugin = (0, _caching.makeWeakCache)(function* ({ } } } - return new _plugin.default(plugin, options, alias, externalDependencies); }); +function* loadPluginDescriptor(descriptor, context) { + if (descriptor.value instanceof _plugin.default) { + if (descriptor.options) { + throw new Error("Passed options to an existing Plugin instance will not work."); + } + return descriptor.value; + } + return yield* instantiatePlugin(yield* pluginDescriptorLoader(descriptor, context), context); +} const needsFilename = val => val && typeof val !== "function"; - const validateIfOptionNeedsFilename = (options, descriptor) => { if (needsFilename(options.test) || needsFilename(options.include) || needsFilename(options.exclude)) { const formattedPresetName = descriptor.name ? `"${descriptor.name}"` : "/* your preset */"; throw new _configError.default([`Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`, `\`\`\``, `babel.transformSync(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`, `\`\`\``, `See https://babeljs.io/docs/en/options#filename for more information.`].join("\n")); } }; - const validatePreset = (preset, context, descriptor) => { if (!context.filename) { const { options } = preset; validateIfOptionNeedsFilename(options, descriptor); - if (options.overrides) { options.overrides.forEach(overrideOptions => validateIfOptionNeedsFilename(overrideOptions, descriptor)); } } }; - -function* loadPresetDescriptor(descriptor, context) { - const preset = instantiatePreset(yield* presetDescriptorLoader(descriptor, context)); - validatePreset(preset, context, descriptor); - return { - chain: yield* (0, _configChain.buildPresetChain)(preset, context), - externalDependencies: preset.externalDependencies - }; -} - const instantiatePreset = (0, _caching.makeWeakCacheSync)(({ value, dirname, @@ -371,6 +295,14 @@ const instantiatePreset = (0, _caching.makeWeakCacheSync)(({ }; }); +function* loadPresetDescriptor(descriptor, context) { + const preset = instantiatePreset(yield* presetDescriptorLoader(descriptor, context)); + validatePreset(preset, context, descriptor); + return { + chain: yield* (0, _configChain.buildPresetChain)(preset, context), + externalDependencies: preset.externalDependencies + }; +} function chain(a, b) { const fns = [a, b].filter(Boolean); if (fns.length <= 1) return fns[0]; @@ -380,7 +312,6 @@ function chain(a, b) { } }; } - 0 && 0; //# sourceMappingURL=full.js.map diff --git a/node_modules/@babel/core/lib/config/full.js.map b/node_modules/@babel/core/lib/config/full.js.map index 9bacc4000..b51016df5 100644 --- a/node_modules/@babel/core/lib/config/full.js.map +++ b/node_modules/@babel/core/lib/config/full.js.map @@ -1 +1 @@ -{"version":3,"names":["gensync","loadFullConfig","inputOpts","result","loadPrivatePartialConfig","options","context","fileHandling","optionDefaults","plugins","presets","Error","presetContext","targets","toDescriptor","item","desc","getItemDescriptor","presetsDescriptors","map","initialPluginsDescriptors","pluginDescriptorsByPass","passes","externalDependencies","ignored","enhanceError","recursePresetDescriptors","rawPresets","pluginDescriptorsPass","i","length","descriptor","preset","loadPresetDescriptor","e","code","checkNoUnwrappedItemOptionPairs","push","ownPass","chain","pass","unshift","splice","o","filter","p","forEach","opts","mergeOptions","pluginContext","assumptions","loadPluginDescriptors","descs","plugin","loadPluginDescriptor","slice","passPerPreset","freezeDeepArray","fn","arg1","arg2","test","message","filename","makeDescriptorLoader","apiFactory","makeWeakCache","value","dirname","alias","cache","factory","maybeAsync","api","JSON","stringify","isThenable","configured","mode","error","pluginDescriptorLoader","makePluginAPI","presetDescriptorLoader","makePresetAPI","Plugin","instantiatePlugin","pluginObj","validatePluginObject","visitor","traverse","explode","inherits","inheritsDescriptor","name","undefined","forwardAsync","run","invalidate","data","pre","post","manipulateOptions","visitors","merge","needsFilename","val","validateIfOptionNeedsFilename","include","exclude","formattedPresetName","ConfigError","join","validatePreset","overrides","overrideOptions","instantiatePreset","buildPresetChain","makeWeakCacheSync","validate","a","b","fns","Boolean","args","apply"],"sources":["../../src/config/full.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\nimport { forwardAsync, maybeAsync, isThenable } from \"../gensync-utils/async\";\n\nimport { mergeOptions } from \"./util\";\nimport * as context from \"../index\";\nimport Plugin from \"./plugin\";\nimport { getItemDescriptor } from \"./item\";\nimport { buildPresetChain } from \"./config-chain\";\nimport { finalize as freezeDeepArray } from \"./helpers/deep-array\";\nimport type { DeepArray, ReadonlyDeepArray } from \"./helpers/deep-array\";\nimport type {\n ConfigContext,\n ConfigChain,\n PresetInstance,\n} from \"./config-chain\";\nimport type { UnloadedDescriptor } from \"./config-descriptors\";\nimport traverse from \"@babel/traverse\";\nimport { makeWeakCache, makeWeakCacheSync } from \"./caching\";\nimport type { CacheConfigurator } from \"./caching\";\nimport {\n validate,\n checkNoUnwrappedItemOptionPairs,\n} from \"./validation/options\";\nimport type { PluginItem } from \"./validation/options\";\nimport { validatePluginObject } from \"./validation/plugins\";\nimport { makePluginAPI, makePresetAPI } from \"./helpers/config-api\";\nimport type { PluginAPI, PresetAPI } from \"./helpers/config-api\";\n\nimport loadPrivatePartialConfig from \"./partial\";\nimport type { ValidatedOptions } from \"./validation/options\";\n\nimport type * as Context from \"./cache-contexts\";\nimport ConfigError from \"../errors/config-error\";\n\ntype LoadedDescriptor = {\n value: {};\n options: {};\n dirname: string;\n alias: string;\n externalDependencies: ReadonlyDeepArray;\n};\n\nexport type { InputOptions } from \"./validation/options\";\n\nexport type ResolvedConfig = {\n options: any;\n passes: PluginPasses;\n externalDependencies: ReadonlyDeepArray;\n};\n\nexport type { Plugin };\nexport type PluginPassList = Array;\nexport type PluginPasses = Array;\n\nexport default gensync(function* loadFullConfig(\n inputOpts: unknown,\n): Handler {\n const result = yield* loadPrivatePartialConfig(inputOpts);\n if (!result) {\n return null;\n }\n const { options, context, fileHandling } = result;\n\n if (fileHandling === \"ignored\") {\n return null;\n }\n\n const optionDefaults = {};\n\n const { plugins, presets } = options;\n\n if (!plugins || !presets) {\n throw new Error(\"Assertion failure - plugins and presets exist\");\n }\n\n const presetContext: Context.FullPreset = {\n ...context,\n targets: options.targets,\n };\n\n const toDescriptor = (item: PluginItem) => {\n const desc = getItemDescriptor(item);\n if (!desc) {\n throw new Error(\"Assertion failure - must be config item\");\n }\n\n return desc;\n };\n\n const presetsDescriptors = presets.map(toDescriptor);\n const initialPluginsDescriptors = plugins.map(toDescriptor);\n const pluginDescriptorsByPass: Array> = [[]];\n const passes: Array> = [];\n\n const externalDependencies: DeepArray = [];\n\n const ignored = yield* enhanceError(\n context,\n function* recursePresetDescriptors(\n rawPresets: Array,\n pluginDescriptorsPass: Array,\n ): Handler {\n const presets: Array<{\n preset: ConfigChain | null;\n pass: Array;\n }> = [];\n\n for (let i = 0; i < rawPresets.length; i++) {\n const descriptor = rawPresets[i];\n if (descriptor.options !== false) {\n try {\n // eslint-disable-next-line no-var\n var preset = yield* loadPresetDescriptor(descriptor, presetContext);\n } catch (e) {\n if (e.code === \"BABEL_UNKNOWN_OPTION\") {\n checkNoUnwrappedItemOptionPairs(rawPresets, i, \"preset\", e);\n }\n throw e;\n }\n\n externalDependencies.push(preset.externalDependencies);\n\n // Presets normally run in reverse order, but if they\n // have their own pass they run after the presets\n // in the previous pass.\n if (descriptor.ownPass) {\n presets.push({ preset: preset.chain, pass: [] });\n } else {\n presets.unshift({\n preset: preset.chain,\n pass: pluginDescriptorsPass,\n });\n }\n }\n }\n\n // resolve presets\n if (presets.length > 0) {\n // The passes are created in the same order as the preset list, but are inserted before any\n // existing additional passes.\n pluginDescriptorsByPass.splice(\n 1,\n 0,\n ...presets.map(o => o.pass).filter(p => p !== pluginDescriptorsPass),\n );\n\n for (const { preset, pass } of presets) {\n if (!preset) return true;\n\n pass.push(...preset.plugins);\n\n const ignored = yield* recursePresetDescriptors(preset.presets, pass);\n if (ignored) return true;\n\n preset.options.forEach(opts => {\n mergeOptions(optionDefaults, opts);\n });\n }\n }\n },\n )(presetsDescriptors, pluginDescriptorsByPass[0]);\n\n if (ignored) return null;\n\n const opts: any = optionDefaults;\n mergeOptions(opts, options);\n\n const pluginContext: Context.FullPlugin = {\n ...presetContext,\n assumptions: opts.assumptions ?? {},\n };\n\n yield* enhanceError(context, function* loadPluginDescriptors() {\n pluginDescriptorsByPass[0].unshift(...initialPluginsDescriptors);\n\n for (const descs of pluginDescriptorsByPass) {\n const pass: Plugin[] = [];\n passes.push(pass);\n\n for (let i = 0; i < descs.length; i++) {\n const descriptor: UnloadedDescriptor = descs[i];\n if (descriptor.options !== false) {\n try {\n // eslint-disable-next-line no-var\n var plugin = yield* loadPluginDescriptor(descriptor, pluginContext);\n } catch (e) {\n if (e.code === \"BABEL_UNKNOWN_PLUGIN_PROPERTY\") {\n // print special message for `plugins: [\"@babel/foo\", { foo: \"option\" }]`\n checkNoUnwrappedItemOptionPairs(descs, i, \"plugin\", e);\n }\n throw e;\n }\n pass.push(plugin);\n\n externalDependencies.push(plugin.externalDependencies);\n }\n }\n }\n })();\n\n opts.plugins = passes[0];\n opts.presets = passes\n .slice(1)\n .filter(plugins => plugins.length > 0)\n .map(plugins => ({ plugins }));\n opts.passPerPreset = opts.presets.length > 0;\n\n return {\n options: opts,\n passes: passes,\n externalDependencies: freezeDeepArray(externalDependencies),\n };\n});\n\nfunction enhanceError(context: ConfigContext, fn: T): T {\n return function* (arg1: unknown, arg2: unknown) {\n try {\n return yield* fn(arg1, arg2);\n } catch (e) {\n // There are a few case where thrown errors will try to annotate themselves multiple times, so\n // to keep things simple we just bail out if re-wrapping the message.\n if (!/^\\[BABEL\\]/.test(e.message)) {\n e.message = `[BABEL] ${context.filename ?? \"unknown file\"}: ${\n e.message\n }`;\n }\n\n throw e;\n }\n } as any;\n}\n\n/**\n * Load a generic plugin/preset from the given descriptor loaded from the config object.\n */\nconst makeDescriptorLoader = (\n apiFactory: (\n cache: CacheConfigurator,\n externalDependencies: Array,\n ) => API,\n) =>\n makeWeakCache(function* (\n { value, options, dirname, alias }: UnloadedDescriptor,\n cache: CacheConfigurator,\n ): Handler {\n // Disabled presets should already have been filtered out\n if (options === false) throw new Error(\"Assertion failure\");\n\n options = options || {};\n\n const externalDependencies: Array = [];\n\n let item = value;\n if (typeof value === \"function\") {\n const factory = maybeAsync(\n value,\n `You appear to be using an async plugin/preset, but Babel has been called synchronously`,\n );\n\n const api = {\n ...context,\n ...apiFactory(cache, externalDependencies),\n };\n try {\n item = yield* factory(api, options, dirname);\n } catch (e) {\n if (alias) {\n e.message += ` (While processing: ${JSON.stringify(alias)})`;\n }\n throw e;\n }\n }\n\n if (!item || typeof item !== \"object\") {\n throw new Error(\"Plugin/Preset did not return an object.\");\n }\n\n if (isThenable(item)) {\n // @ts-expect-error - if we want to support async plugins\n yield* [];\n\n throw new Error(\n `You appear to be using a promise as a plugin, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, ` +\n `you may need to upgrade your @babel/core version. ` +\n `As an alternative, you can prefix the promise with \"await\". ` +\n `(While processing: ${JSON.stringify(alias)})`,\n );\n }\n\n if (\n externalDependencies.length > 0 &&\n (!cache.configured() || cache.mode() === \"forever\")\n ) {\n let error =\n `A plugin/preset has external untracked dependencies ` +\n `(${externalDependencies[0]}), but the cache `;\n if (!cache.configured()) {\n error += `has not been configured to be invalidated when the external dependencies change. `;\n } else {\n error += ` has been configured to never be invalidated. `;\n }\n error +=\n `Plugins/presets should configure their cache to be invalidated when the external ` +\n `dependencies change, for example using \\`api.cache.invalidate(() => ` +\n `statSync(filepath).mtimeMs)\\` or \\`api.cache.never()\\`\\n` +\n `(While processing: ${JSON.stringify(alias)})`;\n\n throw new Error(error);\n }\n\n return {\n value: item,\n options,\n dirname,\n alias,\n externalDependencies: freezeDeepArray(externalDependencies),\n };\n });\n\nconst pluginDescriptorLoader = makeDescriptorLoader<\n Context.SimplePlugin,\n PluginAPI\n>(makePluginAPI);\nconst presetDescriptorLoader = makeDescriptorLoader<\n Context.SimplePreset,\n PresetAPI\n>(makePresetAPI);\n\n/**\n * Instantiate a plugin for the given descriptor, returning the plugin/options pair.\n */\nfunction* loadPluginDescriptor(\n descriptor: UnloadedDescriptor,\n context: Context.SimplePlugin,\n): Handler {\n if (descriptor.value instanceof Plugin) {\n if (descriptor.options) {\n throw new Error(\n \"Passed options to an existing Plugin instance will not work.\",\n );\n }\n\n return descriptor.value;\n }\n\n return yield* instantiatePlugin(\n yield* pluginDescriptorLoader(descriptor, context),\n context,\n );\n}\n\nconst instantiatePlugin = makeWeakCache(function* (\n { value, options, dirname, alias, externalDependencies }: LoadedDescriptor,\n cache: CacheConfigurator,\n): Handler {\n const pluginObj = validatePluginObject(value);\n\n const plugin = {\n ...pluginObj,\n };\n if (plugin.visitor) {\n plugin.visitor = traverse.explode({\n ...plugin.visitor,\n });\n }\n\n if (plugin.inherits) {\n const inheritsDescriptor: UnloadedDescriptor = {\n name: undefined,\n alias: `${alias}$inherits`,\n value: plugin.inherits,\n options,\n dirname,\n };\n\n const inherits = yield* forwardAsync(loadPluginDescriptor, run => {\n // If the inherited plugin changes, reinstantiate this plugin.\n return cache.invalidate(data => run(inheritsDescriptor, data));\n });\n\n plugin.pre = chain(inherits.pre, plugin.pre);\n plugin.post = chain(inherits.post, plugin.post);\n plugin.manipulateOptions = chain(\n inherits.manipulateOptions,\n plugin.manipulateOptions,\n );\n plugin.visitor = traverse.visitors.merge([\n inherits.visitor || {},\n plugin.visitor || {},\n ]);\n\n if (inherits.externalDependencies.length > 0) {\n if (externalDependencies.length === 0) {\n externalDependencies = inherits.externalDependencies;\n } else {\n externalDependencies = freezeDeepArray([\n externalDependencies,\n inherits.externalDependencies,\n ]);\n }\n }\n }\n\n return new Plugin(plugin, options, alias, externalDependencies);\n});\n\nconst needsFilename = (val: unknown) => val && typeof val !== \"function\";\n\nconst validateIfOptionNeedsFilename = (\n options: ValidatedOptions,\n descriptor: UnloadedDescriptor,\n): void => {\n if (\n needsFilename(options.test) ||\n needsFilename(options.include) ||\n needsFilename(options.exclude)\n ) {\n const formattedPresetName = descriptor.name\n ? `\"${descriptor.name}\"`\n : \"/* your preset */\";\n throw new ConfigError(\n [\n `Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`,\n `\\`\\`\\``,\n `babel.transformSync(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`,\n `\\`\\`\\``,\n `See https://babeljs.io/docs/en/options#filename for more information.`,\n ].join(\"\\n\"),\n );\n }\n};\n\nconst validatePreset = (\n preset: PresetInstance,\n context: ConfigContext,\n descriptor: UnloadedDescriptor,\n): void => {\n if (!context.filename) {\n const { options } = preset;\n validateIfOptionNeedsFilename(options, descriptor);\n if (options.overrides) {\n options.overrides.forEach(overrideOptions =>\n validateIfOptionNeedsFilename(overrideOptions, descriptor),\n );\n }\n }\n};\n\n/**\n * Generate a config object that will act as the root of a new nested config.\n */\nfunction* loadPresetDescriptor(\n descriptor: UnloadedDescriptor,\n context: Context.FullPreset,\n): Handler<{\n chain: ConfigChain | null;\n externalDependencies: ReadonlyDeepArray;\n}> {\n const preset = instantiatePreset(\n yield* presetDescriptorLoader(descriptor, context),\n );\n validatePreset(preset, context, descriptor);\n return {\n chain: yield* buildPresetChain(preset, context),\n externalDependencies: preset.externalDependencies,\n };\n}\n\nconst instantiatePreset = makeWeakCacheSync(\n ({\n value,\n dirname,\n alias,\n externalDependencies,\n }: LoadedDescriptor): PresetInstance => {\n return {\n options: validate(\"preset\", value),\n alias,\n dirname,\n externalDependencies,\n };\n },\n);\n\nfunction chain(\n a: undefined | ((...args: Args) => void),\n b: undefined | ((...args: Args) => void),\n) {\n const fns = [a, b].filter(Boolean);\n if (fns.length <= 1) return fns[0];\n\n return function (this: unknown, ...args: unknown[]) {\n for (const fn of fns) {\n fn.apply(this, args);\n }\n };\n}\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAQA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;;AAEA;;AAKA;;AACA;;AAGA;;AAIA;;eAsBeA,UAAA,CAAQ,UAAUC,cAAV,CACrBC,SADqB,EAEW;EAAA;;EAChC,MAAMC,MAAM,GAAG,OAAO,IAAAC,gBAAA,EAAyBF,SAAzB,CAAtB;;EACA,IAAI,CAACC,MAAL,EAAa;IACX,OAAO,IAAP;EACD;;EACD,MAAM;IAAEE,OAAF;IAAWC,OAAX;I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,GAAGmF,iBAAiB,CAC9B,OAAOjC,sBAAsB,CAACnD,UAAD,EAAazB,OAAb,CADC,CAAhC;EAGA0G,cAAc,CAAChF,MAAD,EAAS1B,OAAT,EAAkByB,UAAlB,CAAd;EACA,OAAO;IACLQ,KAAK,EAAE,OAAO,IAAA6E,6BAAA,EAAiBpF,MAAjB,EAAyB1B,OAAzB,CADT;IAELiB,oBAAoB,EAAES,MAAM,CAACT;EAFxB,CAAP;AAID;;AAED,MAAM4F,iBAAiB,GAAG,IAAAE,0BAAA,EACxB,CAAC;EACClD,KADD;EAECC,OAFD;EAGCC,KAHD;EAIC9C;AAJD,CAAD,KAKwC;EACtC,OAAO;IACLlB,OAAO,EAAE,IAAAiH,iBAAA,EAAS,QAAT,EAAmBnD,KAAnB,CADJ;IAELE,KAFK;IAGLD,OAHK;IAIL7C;EAJK,CAAP;AAMD,CAbuB,CAA1B;;AAgBA,SAASgB,KAAT,CACEgF,CADF,EAEEC,CAFF,EAGE;EACA,MAAMC,GAAG,GAAG,CAACF,CAAD,EAAIC,CAAJ,EAAO5E,MAAP,CAAc8E,OAAd,CAAZ;EACA,IAAID,GAAG,CAAC3F,MAAJ,IAAc,CAAlB,EAAqB,OAAO2F,GAAG,CAAC,CAAD,CAAV;EAErB,OAAO,UAAyB,GAAGE,IAA5B,EAA6C;IAClD,KAAK,MAAMjE,EAAX,IAAiB+D,GAAjB,EAAsB;MACpB/D,EAAE,CAACkE,KAAH,CAAS,IAAT,EAAeD,IAAf;IACD;EACF,CAJD;AAKD"} \ No newline at end of file +{"version":3,"names":["gensync","loadFullConfig","inputOpts","result","loadPrivatePartialConfig","options","context","fileHandling","optionDefaults","plugins","presets","Error","presetContext","targets","toDescriptor","item","desc","getItemDescriptor","presetsDescriptors","map","initialPluginsDescriptors","pluginDescriptorsByPass","passes","externalDependencies","ignored","enhanceError","recursePresetDescriptors","rawPresets","pluginDescriptorsPass","i","length","descriptor","preset","loadPresetDescriptor","e","code","checkNoUnwrappedItemOptionPairs","push","ownPass","chain","pass","unshift","splice","o","filter","p","forEach","opts","mergeOptions","pluginContext","assumptions","loadPluginDescriptors","descs","plugin","loadPluginDescriptor","slice","passPerPreset","freezeDeepArray","fn","arg1","arg2","test","message","filename","makeDescriptorLoader","apiFactory","makeWeakCache","value","dirname","alias","cache","factory","maybeAsync","api","JSON","stringify","isThenable","configured","mode","error","pluginDescriptorLoader","makePluginAPI","presetDescriptorLoader","makePresetAPI","instantiatePlugin","pluginObj","validatePluginObject","visitor","traverse","explode","inherits","inheritsDescriptor","name","undefined","forwardAsync","run","invalidate","data","pre","post","manipulateOptions","visitors","merge","Plugin","needsFilename","val","validateIfOptionNeedsFilename","include","exclude","formattedPresetName","ConfigError","join","validatePreset","overrides","overrideOptions","instantiatePreset","makeWeakCacheSync","validate","buildPresetChain","a","b","fns","Boolean","args","apply"],"sources":["../../src/config/full.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\nimport { forwardAsync, maybeAsync, isThenable } from \"../gensync-utils/async\";\n\nimport { mergeOptions } from \"./util\";\nimport * as context from \"../index\";\nimport Plugin from \"./plugin\";\nimport { getItemDescriptor } from \"./item\";\nimport { buildPresetChain } from \"./config-chain\";\nimport { finalize as freezeDeepArray } from \"./helpers/deep-array\";\nimport type { DeepArray, ReadonlyDeepArray } from \"./helpers/deep-array\";\nimport type {\n ConfigContext,\n ConfigChain,\n PresetInstance,\n} from \"./config-chain\";\nimport type { UnloadedDescriptor } from \"./config-descriptors\";\nimport traverse from \"@babel/traverse\";\nimport { makeWeakCache, makeWeakCacheSync } from \"./caching\";\nimport type { CacheConfigurator } from \"./caching\";\nimport {\n validate,\n checkNoUnwrappedItemOptionPairs,\n} from \"./validation/options\";\nimport type { PluginItem } from \"./validation/options\";\nimport { validatePluginObject } from \"./validation/plugins\";\nimport { makePluginAPI, makePresetAPI } from \"./helpers/config-api\";\nimport type { PluginAPI, PresetAPI } from \"./helpers/config-api\";\n\nimport loadPrivatePartialConfig from \"./partial\";\nimport type { ValidatedOptions } from \"./validation/options\";\n\nimport type * as Context from \"./cache-contexts\";\nimport ConfigError from \"../errors/config-error\";\n\ntype LoadedDescriptor = {\n value: {};\n options: {};\n dirname: string;\n alias: string;\n externalDependencies: ReadonlyDeepArray;\n};\n\nexport type { InputOptions } from \"./validation/options\";\n\nexport type ResolvedConfig = {\n options: any;\n passes: PluginPasses;\n externalDependencies: ReadonlyDeepArray;\n};\n\nexport type { Plugin };\nexport type PluginPassList = Array;\nexport type PluginPasses = Array;\n\nexport default gensync(function* loadFullConfig(\n inputOpts: unknown,\n): Handler {\n const result = yield* loadPrivatePartialConfig(inputOpts);\n if (!result) {\n return null;\n }\n const { options, context, fileHandling } = result;\n\n if (fileHandling === \"ignored\") {\n return null;\n }\n\n const optionDefaults = {};\n\n const { plugins, presets } = options;\n\n if (!plugins || !presets) {\n throw new Error(\"Assertion failure - plugins and presets exist\");\n }\n\n const presetContext: Context.FullPreset = {\n ...context,\n targets: options.targets,\n };\n\n const toDescriptor = (item: PluginItem) => {\n const desc = getItemDescriptor(item);\n if (!desc) {\n throw new Error(\"Assertion failure - must be config item\");\n }\n\n return desc;\n };\n\n const presetsDescriptors = presets.map(toDescriptor);\n const initialPluginsDescriptors = plugins.map(toDescriptor);\n const pluginDescriptorsByPass: Array> = [[]];\n const passes: Array> = [];\n\n const externalDependencies: DeepArray = [];\n\n const ignored = yield* enhanceError(\n context,\n function* recursePresetDescriptors(\n rawPresets: Array,\n pluginDescriptorsPass: Array,\n ): Handler {\n const presets: Array<{\n preset: ConfigChain | null;\n pass: Array;\n }> = [];\n\n for (let i = 0; i < rawPresets.length; i++) {\n const descriptor = rawPresets[i];\n if (descriptor.options !== false) {\n try {\n // eslint-disable-next-line no-var\n var preset = yield* loadPresetDescriptor(descriptor, presetContext);\n } catch (e) {\n if (e.code === \"BABEL_UNKNOWN_OPTION\") {\n checkNoUnwrappedItemOptionPairs(rawPresets, i, \"preset\", e);\n }\n throw e;\n }\n\n externalDependencies.push(preset.externalDependencies);\n\n // Presets normally run in reverse order, but if they\n // have their own pass they run after the presets\n // in the previous pass.\n if (descriptor.ownPass) {\n presets.push({ preset: preset.chain, pass: [] });\n } else {\n presets.unshift({\n preset: preset.chain,\n pass: pluginDescriptorsPass,\n });\n }\n }\n }\n\n // resolve presets\n if (presets.length > 0) {\n // The passes are created in the same order as the preset list, but are inserted before any\n // existing additional passes.\n pluginDescriptorsByPass.splice(\n 1,\n 0,\n ...presets.map(o => o.pass).filter(p => p !== pluginDescriptorsPass),\n );\n\n for (const { preset, pass } of presets) {\n if (!preset) return true;\n\n pass.push(...preset.plugins);\n\n const ignored = yield* recursePresetDescriptors(preset.presets, pass);\n if (ignored) return true;\n\n preset.options.forEach(opts => {\n mergeOptions(optionDefaults, opts);\n });\n }\n }\n },\n )(presetsDescriptors, pluginDescriptorsByPass[0]);\n\n if (ignored) return null;\n\n const opts: any = optionDefaults;\n mergeOptions(opts, options);\n\n const pluginContext: Context.FullPlugin = {\n ...presetContext,\n assumptions: opts.assumptions ?? {},\n };\n\n yield* enhanceError(context, function* loadPluginDescriptors() {\n pluginDescriptorsByPass[0].unshift(...initialPluginsDescriptors);\n\n for (const descs of pluginDescriptorsByPass) {\n const pass: Plugin[] = [];\n passes.push(pass);\n\n for (let i = 0; i < descs.length; i++) {\n const descriptor: UnloadedDescriptor = descs[i];\n if (descriptor.options !== false) {\n try {\n // eslint-disable-next-line no-var\n var plugin = yield* loadPluginDescriptor(descriptor, pluginContext);\n } catch (e) {\n if (e.code === \"BABEL_UNKNOWN_PLUGIN_PROPERTY\") {\n // print special message for `plugins: [\"@babel/foo\", { foo: \"option\" }]`\n checkNoUnwrappedItemOptionPairs(descs, i, \"plugin\", e);\n }\n throw e;\n }\n pass.push(plugin);\n\n externalDependencies.push(plugin.externalDependencies);\n }\n }\n }\n })();\n\n opts.plugins = passes[0];\n opts.presets = passes\n .slice(1)\n .filter(plugins => plugins.length > 0)\n .map(plugins => ({ plugins }));\n opts.passPerPreset = opts.presets.length > 0;\n\n return {\n options: opts,\n passes: passes,\n externalDependencies: freezeDeepArray(externalDependencies),\n };\n});\n\nfunction enhanceError(context: ConfigContext, fn: T): T {\n return function* (arg1: unknown, arg2: unknown) {\n try {\n return yield* fn(arg1, arg2);\n } catch (e) {\n // There are a few case where thrown errors will try to annotate themselves multiple times, so\n // to keep things simple we just bail out if re-wrapping the message.\n if (!/^\\[BABEL\\]/.test(e.message)) {\n e.message = `[BABEL] ${context.filename ?? \"unknown file\"}: ${\n e.message\n }`;\n }\n\n throw e;\n }\n } as any;\n}\n\n/**\n * Load a generic plugin/preset from the given descriptor loaded from the config object.\n */\nconst makeDescriptorLoader = (\n apiFactory: (\n cache: CacheConfigurator,\n externalDependencies: Array,\n ) => API,\n) =>\n makeWeakCache(function* (\n { value, options, dirname, alias }: UnloadedDescriptor,\n cache: CacheConfigurator,\n ): Handler {\n // Disabled presets should already have been filtered out\n if (options === false) throw new Error(\"Assertion failure\");\n\n options = options || {};\n\n const externalDependencies: Array = [];\n\n let item = value;\n if (typeof value === \"function\") {\n const factory = maybeAsync(\n value,\n `You appear to be using an async plugin/preset, but Babel has been called synchronously`,\n );\n\n const api = {\n ...context,\n ...apiFactory(cache, externalDependencies),\n };\n try {\n item = yield* factory(api, options, dirname);\n } catch (e) {\n if (alias) {\n e.message += ` (While processing: ${JSON.stringify(alias)})`;\n }\n throw e;\n }\n }\n\n if (!item || typeof item !== \"object\") {\n throw new Error(\"Plugin/Preset did not return an object.\");\n }\n\n if (isThenable(item)) {\n // @ts-expect-error - if we want to support async plugins\n yield* [];\n\n throw new Error(\n `You appear to be using a promise as a plugin, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, ` +\n `you may need to upgrade your @babel/core version. ` +\n `As an alternative, you can prefix the promise with \"await\". ` +\n `(While processing: ${JSON.stringify(alias)})`,\n );\n }\n\n if (\n externalDependencies.length > 0 &&\n (!cache.configured() || cache.mode() === \"forever\")\n ) {\n let error =\n `A plugin/preset has external untracked dependencies ` +\n `(${externalDependencies[0]}), but the cache `;\n if (!cache.configured()) {\n error += `has not been configured to be invalidated when the external dependencies change. `;\n } else {\n error += ` has been configured to never be invalidated. `;\n }\n error +=\n `Plugins/presets should configure their cache to be invalidated when the external ` +\n `dependencies change, for example using \\`api.cache.invalidate(() => ` +\n `statSync(filepath).mtimeMs)\\` or \\`api.cache.never()\\`\\n` +\n `(While processing: ${JSON.stringify(alias)})`;\n\n throw new Error(error);\n }\n\n return {\n value: item,\n options,\n dirname,\n alias,\n externalDependencies: freezeDeepArray(externalDependencies),\n };\n });\n\nconst pluginDescriptorLoader = makeDescriptorLoader<\n Context.SimplePlugin,\n PluginAPI\n>(makePluginAPI);\nconst presetDescriptorLoader = makeDescriptorLoader<\n Context.SimplePreset,\n PresetAPI\n>(makePresetAPI);\n\nconst instantiatePlugin = makeWeakCache(function* (\n { value, options, dirname, alias, externalDependencies }: LoadedDescriptor,\n cache: CacheConfigurator,\n): Handler {\n const pluginObj = validatePluginObject(value);\n\n const plugin = {\n ...pluginObj,\n };\n if (plugin.visitor) {\n plugin.visitor = traverse.explode({\n ...plugin.visitor,\n });\n }\n\n if (plugin.inherits) {\n const inheritsDescriptor: UnloadedDescriptor = {\n name: undefined,\n alias: `${alias}$inherits`,\n value: plugin.inherits,\n options,\n dirname,\n };\n\n const inherits = yield* forwardAsync(loadPluginDescriptor, run => {\n // If the inherited plugin changes, reinstantiate this plugin.\n return cache.invalidate(data => run(inheritsDescriptor, data));\n });\n\n plugin.pre = chain(inherits.pre, plugin.pre);\n plugin.post = chain(inherits.post, plugin.post);\n plugin.manipulateOptions = chain(\n inherits.manipulateOptions,\n plugin.manipulateOptions,\n );\n plugin.visitor = traverse.visitors.merge([\n inherits.visitor || {},\n plugin.visitor || {},\n ]);\n\n if (inherits.externalDependencies.length > 0) {\n if (externalDependencies.length === 0) {\n externalDependencies = inherits.externalDependencies;\n } else {\n externalDependencies = freezeDeepArray([\n externalDependencies,\n inherits.externalDependencies,\n ]);\n }\n }\n }\n\n return new Plugin(plugin, options, alias, externalDependencies);\n});\n\n/**\n * Instantiate a plugin for the given descriptor, returning the plugin/options pair.\n */\nfunction* loadPluginDescriptor(\n descriptor: UnloadedDescriptor,\n context: Context.SimplePlugin,\n): Handler {\n if (descriptor.value instanceof Plugin) {\n if (descriptor.options) {\n throw new Error(\n \"Passed options to an existing Plugin instance will not work.\",\n );\n }\n\n return descriptor.value;\n }\n\n return yield* instantiatePlugin(\n yield* pluginDescriptorLoader(descriptor, context),\n context,\n );\n}\n\nconst needsFilename = (val: unknown) => val && typeof val !== \"function\";\n\nconst validateIfOptionNeedsFilename = (\n options: ValidatedOptions,\n descriptor: UnloadedDescriptor,\n): void => {\n if (\n needsFilename(options.test) ||\n needsFilename(options.include) ||\n needsFilename(options.exclude)\n ) {\n const formattedPresetName = descriptor.name\n ? `\"${descriptor.name}\"`\n : \"/* your preset */\";\n throw new ConfigError(\n [\n `Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`,\n `\\`\\`\\``,\n `babel.transformSync(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`,\n `\\`\\`\\``,\n `See https://babeljs.io/docs/en/options#filename for more information.`,\n ].join(\"\\n\"),\n );\n }\n};\n\nconst validatePreset = (\n preset: PresetInstance,\n context: ConfigContext,\n descriptor: UnloadedDescriptor,\n): void => {\n if (!context.filename) {\n const { options } = preset;\n validateIfOptionNeedsFilename(options, descriptor);\n if (options.overrides) {\n options.overrides.forEach(overrideOptions =>\n validateIfOptionNeedsFilename(overrideOptions, descriptor),\n );\n }\n }\n};\n\nconst instantiatePreset = makeWeakCacheSync(\n ({\n value,\n dirname,\n alias,\n externalDependencies,\n }: LoadedDescriptor): PresetInstance => {\n return {\n options: validate(\"preset\", value),\n alias,\n dirname,\n externalDependencies,\n };\n },\n);\n\n/**\n * Generate a config object that will act as the root of a new nested config.\n */\nfunction* loadPresetDescriptor(\n descriptor: UnloadedDescriptor,\n context: Context.FullPreset,\n): Handler<{\n chain: ConfigChain | null;\n externalDependencies: ReadonlyDeepArray;\n}> {\n const preset = instantiatePreset(\n yield* presetDescriptorLoader(descriptor, context),\n );\n validatePreset(preset, context, descriptor);\n return {\n chain: yield* buildPresetChain(preset, context),\n externalDependencies: preset.externalDependencies,\n };\n}\n\nfunction chain(\n a: undefined | ((...args: Args) => void),\n b: undefined | ((...args: Args) => void),\n) {\n const fns = [a, b].filter(Boolean);\n if (fns.length <= 1) return fns[0];\n\n return function (this: unknown, ...args: unknown[]) {\n for (const fn of fns) {\n fn.apply(this, args);\n }\n };\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAQA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AAEA;AAKA;AACA;AAGA;AAIA;AAAiD,eAsBlCA,UAAO,CAAC,UAAUC,cAAc,CAC7CC,SAAkB,EACc;EAAA;EAChC,MAAMC,MAAM,GAAG,OAAO,IAAAC,gBAAwB,EAACF,SAAS,CAAC;EACzD,IAAI,CAACC,MAAM,EAAE;IACX,OAAO,IAAI;EACb;EACA,MAAM;IAAEE,OAAO;IAAEC,OAAO;IAAEC;EAAa,CAAC,GAAGJ,MAAM;EAEjD,IAAII,YAAY,KAAK,SAAS,EAAE;IAC9B,OAAO,IAAI;EACb;EAEA,MAAMC,cAAc,GAAG,CAAC,CAAC;EAEzB,MAAM;IAAEC,OAAO;IAAEC;EAAQ,CAAC,GAAGL,OAAO;EAEpC,IAAI,CAACI,OAAO,IAAI,CAACC,OAAO,EAAE;IACxB,MAAM,IAAIC,KAAK,CAAC,+CAA+C,CAAC;EAClE;EAEA,MAAMC,aAAiC,qBAClCN,OAAO;IACVO,OAAO,EAAER,OAAO,CAACQ;EAAO,EACzB;EAED,MAAMC,YAAY,GAAIC,IAAgB,IAAK;IACzC,MAAMC,IAAI,GAAG,IAAAC,uBAAiB,EAACF,IAAI,CAAC;IACpC,IAAI,CAACC,IAAI,EAAE;MACT,MAAM,I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EA,SAASgB,KAAK,CACZgF,CAAwC,EACxCC,CAAwC,EACxC;EACA,MAAMC,GAAG,GAAG,CAACF,CAAC,EAAEC,CAAC,CAAC,CAAC5E,MAAM,CAAC8E,OAAO,CAAC;EAClC,IAAID,GAAG,CAAC3F,MAAM,IAAI,CAAC,EAAE,OAAO2F,GAAG,CAAC,CAAC,CAAC;EAElC,OAAO,UAAyB,GAAGE,IAAe,EAAE;IAClD,KAAK,MAAMjE,EAAE,IAAI+D,GAAG,EAAE;MACpB/D,EAAE,CAACkE,KAAK,CAAC,IAAI,EAAED,IAAI,CAAC;IACtB;EACF,CAAC;AACH;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/helpers/config-api.js b/node_modules/@babel/core/lib/config/helpers/config-api.js index 8a654571b..1ca96778c 100644 --- a/node_modules/@babel/core/lib/config/helpers/config-api.js +++ b/node_modules/@babel/core/lib/config/helpers/config-api.js @@ -6,40 +6,29 @@ Object.defineProperty(exports, "__esModule", { exports.makeConfigAPI = makeConfigAPI; exports.makePluginAPI = makePluginAPI; exports.makePresetAPI = makePresetAPI; - function _semver() { const data = require("semver"); - _semver = function () { return data; }; - return data; } - var _ = require("../../"); - var _caching = require("../caching"); - function makeConfigAPI(cache) { const env = value => cache.using(data => { if (typeof value === "undefined") return data.envName; - if (typeof value === "function") { return (0, _caching.assertSimpleType)(value(data.envName)); } - return (Array.isArray(value) ? value : [value]).some(entry => { if (typeof entry !== "string") { throw new Error("Unexpected non-string value"); } - return entry === data.envName; }); }); - const caller = cb => cache.using(data => (0, _caching.assertSimpleType)(cb(data.caller))); - return { version: _.version, cache: cache.simple(), @@ -49,61 +38,48 @@ function makeConfigAPI(cache) { assertVersion }; } - function makePresetAPI(cache, externalDependencies) { - const targets = () => JSON.parse(cache.using(data => JSON.stringify(data.targets))); - + const targets = () => + JSON.parse(cache.using(data => JSON.stringify(data.targets))); const addExternalDependency = ref => { externalDependencies.push(ref); }; - return Object.assign({}, makeConfigAPI(cache), { targets, addExternalDependency }); } - function makePluginAPI(cache, externalDependencies) { const assumption = name => cache.using(data => data.assumptions[name]); - return Object.assign({}, makePresetAPI(cache, externalDependencies), { assumption }); } - function assertVersion(range) { if (typeof range === "number") { if (!Number.isInteger(range)) { throw new Error("Expected string or integer value."); } - range = `^${range}.0.0-0`; } - if (typeof range !== "string") { throw new Error("Expected string or integer value."); } - if (_semver().satisfies(_.version, range)) return; const limit = Error.stackTraceLimit; - if (typeof limit === "number" && limit < 25) { Error.stackTraceLimit = 25; } - const err = new Error(`Requires Babel "${range}", but was loaded with "${_.version}". ` + `If you are sure you have a compatible version of @babel/core, ` + `it is likely that something in your build process is loading the ` + `wrong version. Inspect the stack trace of this error to look for ` + `the first entry that doesn't mention "@babel/core" or "babel-core" ` + `to see what is calling Babel.`); - if (typeof limit === "number") { Error.stackTraceLimit = limit; } - throw Object.assign(err, { code: "BABEL_VERSION_UNSUPPORTED", version: _.version, range }); } - 0 && 0; //# sourceMappingURL=config-api.js.map diff --git a/node_modules/@babel/core/lib/config/helpers/config-api.js.map b/node_modules/@babel/core/lib/config/helpers/config-api.js.map index 0c64ee44e..9698d1fe6 100644 --- a/node_modules/@babel/core/lib/config/helpers/config-api.js.map +++ b/node_modules/@babel/core/lib/config/helpers/config-api.js.map @@ -1 +1 @@ -{"version":3,"names":["makeConfigAPI","cache","env","value","using","data","envName","assertSimpleType","Array","isArray","some","entry","Error","caller","cb","version","coreVersion","simple","async","assertVersion","makePresetAPI","externalDependencies","targets","JSON","parse","stringify","addExternalDependency","ref","push","makePluginAPI","assumption","name","assumptions","range","Number","isInteger","semver","satisfies","limit","stackTraceLimit","err","Object","assign","code"],"sources":["../../../src/config/helpers/config-api.ts"],"sourcesContent":["import semver from \"semver\";\nimport type { Targets } from \"@babel/helper-compilation-targets\";\n\nimport { version as coreVersion } from \"../../\";\nimport { assertSimpleType } from \"../caching\";\nimport type {\n CacheConfigurator,\n SimpleCacheConfigurator,\n SimpleType,\n} from \"../caching\";\n\nimport type { AssumptionName, CallerMetadata } from \"../validation/options\";\n\nimport type * as Context from \"../cache-contexts\";\n\ntype EnvFunction = {\n (): string;\n (extractor: (babelEnv: string) => T): T;\n (envVar: string): boolean;\n (envVars: Array): boolean;\n};\n\ntype CallerFactory = (\n extractor: (callerMetadata: CallerMetadata | undefined) => unknown,\n) => SimpleType;\ntype TargetsFunction = () => Targets;\ntype AssumptionFunction = (name: AssumptionName) => boolean | undefined;\n\nexport type ConfigAPI = {\n version: string;\n cache: SimpleCacheConfigurator;\n env: EnvFunction;\n async: () => boolean;\n assertVersion: typeof assertVersion;\n caller?: CallerFactory;\n};\n\nexport type PresetAPI = {\n targets: TargetsFunction;\n addExternalDependency: (ref: string) => void;\n} & ConfigAPI;\n\nexport type PluginAPI = {\n assumption: AssumptionFunction;\n} & PresetAPI;\n\nexport function makeConfigAPI(\n cache: CacheConfigurator,\n): ConfigAPI {\n // TODO(@nicolo-ribaudo): If we remove the explicit type from `value`\n // and the `as any` type cast, TypeScript crashes in an infinite\n // recursion. After upgrading to TS4.7 and finishing the noImplicitAny\n // PR, we should check if it still crashes and report it to the TS team.\n const env: EnvFunction = ((\n value: string | string[] | ((babelEnv: string) => T),\n ) =>\n cache.using(data => {\n if (typeof value === \"undefined\") return data.envName;\n if (typeof value === \"function\") {\n return assertSimpleType(value(data.envName));\n }\n return (Array.isArray(value) ? value : [value]).some(entry => {\n if (typeof entry !== \"string\") {\n throw new Error(\"Unexpected non-string value\");\n }\n return entry === data.envName;\n });\n })) as any;\n\n const caller = (cb: {\n (CallerMetadata: CallerMetadata | undefined): SimpleType;\n }) => cache.using(data => assertSimpleType(cb(data.caller)));\n\n return {\n version: coreVersion,\n cache: cache.simple(),\n // Expose \".env()\" so people can easily get the same env that we expose using the \"env\" key.\n env,\n async: () => false,\n caller,\n assertVersion,\n };\n}\n\nexport function makePresetAPI(\n cache: CacheConfigurator,\n externalDependencies: Array,\n): PresetAPI {\n const targets = () =>\n // We are using JSON.parse/JSON.stringify because it's only possible to cache\n // primitive values. We can safely stringify the targets object because it\n // only contains strings as its properties.\n // Please make the Record and Tuple proposal happen!\n JSON.parse(cache.using(data => JSON.stringify(data.targets)));\n\n const addExternalDependency = (ref: string) => {\n externalDependencies.push(ref);\n };\n\n return { ...makeConfigAPI(cache), targets, addExternalDependency };\n}\n\nexport function makePluginAPI(\n cache: CacheConfigurator,\n externalDependencies: Array,\n): PluginAPI {\n const assumption = (name: string) =>\n cache.using(data => data.assumptions[name]);\n\n return { ...makePresetAPI(cache, externalDependencies), assumption };\n}\n\nfunction assertVersion(range: string | number): void {\n if (typeof range === \"number\") {\n if (!Number.isInteger(range)) {\n throw new Error(\"Expected string or integer value.\");\n }\n range = `^${range}.0.0-0`;\n }\n if (typeof range !== \"string\") {\n throw new Error(\"Expected string or integer value.\");\n }\n\n if (semver.satisfies(coreVersion, range)) return;\n\n const limit = Error.stackTraceLimit;\n\n if (typeof limit === \"number\" && limit < 25) {\n // Bump up the limit if needed so that users are more likely\n // to be able to see what is calling Babel.\n Error.stackTraceLimit = 25;\n }\n\n const err = new Error(\n `Requires Babel \"${range}\", but was loaded with \"${coreVersion}\". ` +\n `If you are sure you have a compatible version of @babel/core, ` +\n `it is likely that something in your build process is loading the ` +\n `wrong version. Inspect the stack trace of this error to look for ` +\n `the first entry that doesn't mention \"@babel/core\" or \"babel-core\" ` +\n `to see what is calling Babel.`,\n );\n\n if (typeof limit === \"number\") {\n Error.stackTraceLimit = limit;\n }\n\n throw Object.assign(err, {\n code: \"BABEL_VERSION_UNSUPPORTED\",\n version: coreVersion,\n range,\n });\n}\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;;AACA;;AA0CO,SAASA,aAAT,CACLC,KADK,EAEM;EAKX,MAAMC,GAAgB,GACpBC,KADwB,IAGxBF,KAAK,CAACG,KAAN,CAAYC,IAAI,IAAI;IAClB,IAAI,OAAOF,KAAP,KAAiB,WAArB,EAAkC,OAAOE,IAAI,CAACC,O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jB9B,KAAK,CAACG,KAAN,CAAYC,IAAI,IAAIA,IAAI,CAAC2B,WAAL,CAAiBD,IAAjB,CAApB,CADF;;EAGA,yBAAYX,aAAa,CAACnB,KAAD,EAAQoB,oBAAR,CAAzB;IAAwDS;EAAxD;AACD;;AAED,SAASX,aAAT,CAAuBc,KAAvB,EAAqD;EACnD,IAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;IAC7B,IAAI,CAACC,MAAM,CAACC,SAAP,CAAiBF,KAAjB,CAAL,EAA8B;MAC5B,MAAM,IAAIrB,KAAJ,CAAU,mCAAV,CAAN;IACD;;IACDqB,KAAK,GAAI,IAAGA,KAAM,QAAlB;EACD;;EACD,IAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;IAC7B,MAAM,IAAIrB,KAAJ,CAAU,mCAAV,CAAN;EACD;;EAED,IAAIwB,SAAA,CAAOC,SAAP,CAAiBrB,SAAjB,EAA8BiB,KAA9B,CAAJ,EAA0C;EAE1C,MAAMK,KAAK,GAAG1B,KAAK,CAAC2B,eAApB;;EAEA,IAAI,OAAOD,KAAP,KAAiB,QAAjB,IAA6BA,KAAK,GAAG,EAAzC,EAA6C;IAG3C1B,KAAK,CAAC2B,eAAN,GAAwB,EAAxB;EACD;;EAED,MAAMC,GAAG,GAAG,IAAI5B,KAAJ,CACT,mBAAkBqB,KAAM,2BAA0BjB,SAAY,KAA/D,GACG,gEADH,GAEG,mEAFH,GAGG,mEAHH,GAIG,qEAJH,GAKG,+BANO,CAAZ;;EASA,IAAI,OAAOsB,KAAP,KAAiB,QAArB,EAA+B;IAC7B1B,KAAK,CAAC2B,eAAN,GAAwBD,KAAxB;EACD;;EAED,MAAMG,MAAM,CAACC,MAAP,CAAcF,GAAd,EAAmB;IACvBG,IAAI,EAAE,2BADiB;IAEvB5B,OAAO,EAAEC,SAFc;IAGvBiB;EAHuB,CAAnB,CAAN;AAKD"} \ No newline at end of file +{"version":3,"names":["makeConfigAPI","cache","env","value","using","data","envName","assertSimpleType","Array","isArray","some","entry","Error","caller","cb","version","coreVersion","simple","async","assertVersion","makePresetAPI","externalDependencies","targets","JSON","parse","stringify","addExternalDependency","ref","push","makePluginAPI","assumption","name","assumptions","range","Number","isInteger","semver","satisfies","limit","stackTraceLimit","err","Object","assign","code"],"sources":["../../../src/config/helpers/config-api.ts"],"sourcesContent":["import semver from \"semver\";\nimport type { Targets } from \"@babel/helper-compilation-targets\";\n\nimport { version as coreVersion } from \"../../\";\nimport { assertSimpleType } from \"../caching\";\nimport type {\n CacheConfigurator,\n SimpleCacheConfigurator,\n SimpleType,\n} from \"../caching\";\n\nimport type { AssumptionName, CallerMetadata } from \"../validation/options\";\n\nimport type * as Context from \"../cache-contexts\";\n\ntype EnvFunction = {\n (): string;\n (extractor: (babelEnv: string) => T): T;\n (envVar: string): boolean;\n (envVars: Array): boolean;\n};\n\ntype CallerFactory = (\n extractor: (callerMetadata: CallerMetadata | undefined) => unknown,\n) => SimpleType;\ntype TargetsFunction = () => Targets;\ntype AssumptionFunction = (name: AssumptionName) => boolean | undefined;\n\nexport type ConfigAPI = {\n version: string;\n cache: SimpleCacheConfigurator;\n env: EnvFunction;\n async: () => boolean;\n assertVersion: typeof assertVersion;\n caller?: CallerFactory;\n};\n\nexport type PresetAPI = {\n targets: TargetsFunction;\n addExternalDependency: (ref: string) => void;\n} & ConfigAPI;\n\nexport type PluginAPI = {\n assumption: AssumptionFunction;\n} & PresetAPI;\n\nexport function makeConfigAPI(\n cache: CacheConfigurator,\n): ConfigAPI {\n // TODO(@nicolo-ribaudo): If we remove the explicit type from `value`\n // and the `as any` type cast, TypeScript crashes in an infinite\n // recursion. After upgrading to TS4.7 and finishing the noImplicitAny\n // PR, we should check if it still crashes and report it to the TS team.\n const env: EnvFunction = ((\n value: string | string[] | ((babelEnv: string) => T),\n ) =>\n cache.using(data => {\n if (typeof value === \"undefined\") return data.envName;\n if (typeof value === \"function\") {\n return assertSimpleType(value(data.envName));\n }\n return (Array.isArray(value) ? value : [value]).some(entry => {\n if (typeof entry !== \"string\") {\n throw new Error(\"Unexpected non-string value\");\n }\n return entry === data.envName;\n });\n })) as any;\n\n const caller = (cb: {\n (CallerMetadata: CallerMetadata | undefined): SimpleType;\n }) => cache.using(data => assertSimpleType(cb(data.caller)));\n\n return {\n version: coreVersion,\n cache: cache.simple(),\n // Expose \".env()\" so people can easily get the same env that we expose using the \"env\" key.\n env,\n async: () => false,\n caller,\n assertVersion,\n };\n}\n\nexport function makePresetAPI(\n cache: CacheConfigurator,\n externalDependencies: Array,\n): PresetAPI {\n const targets = () =>\n // We are using JSON.parse/JSON.stringify because it's only possible to cache\n // primitive values. We can safely stringify the targets object because it\n // only contains strings as its properties.\n // Please make the Record and Tuple proposal happen!\n JSON.parse(cache.using(data => JSON.stringify(data.targets)));\n\n const addExternalDependency = (ref: string) => {\n externalDependencies.push(ref);\n };\n\n return { ...makeConfigAPI(cache), targets, addExternalDependency };\n}\n\nexport function makePluginAPI(\n cache: CacheConfigurator,\n externalDependencies: Array,\n): PluginAPI {\n const assumption = (name: string) =>\n cache.using(data => data.assumptions[name]);\n\n return { ...makePresetAPI(cache, externalDependencies), assumption };\n}\n\nfunction assertVersion(range: string | number): void {\n if (typeof range === \"number\") {\n if (!Number.isInteger(range)) {\n throw new Error(\"Expected string or integer value.\");\n }\n range = `^${range}.0.0-0`;\n }\n if (typeof range !== \"string\") {\n throw new Error(\"Expected string or integer value.\");\n }\n\n if (semver.satisfies(coreVersion, range)) return;\n\n const limit = Error.stackTraceLimit;\n\n if (typeof limit === \"number\" && limit < 25) {\n // Bump up the limit if needed so that users are more likely\n // to be able to see what is calling Babel.\n Error.stackTraceLimit = 25;\n }\n\n const err = new Error(\n `Requires Babel \"${range}\", but was loaded with \"${coreVersion}\". ` +\n `If you are sure you have a compatible version of @babel/core, ` +\n `it is likely that something in your build process is loading the ` +\n `wrong version. Inspect the stack trace of this error to look for ` +\n `the first entry that doesn't mention \"@babel/core\" or \"babel-core\" ` +\n `to see what is calling Babel.`,\n );\n\n if (typeof limit === \"number\") {\n Error.stackTraceLimit = limit;\n }\n\n throw Object.assign(err, {\n code: \"BABEL_VERSION_UNSUPPORTED\",\n version: coreVersion,\n range,\n });\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;AACA;AA0CO,SAASA,aAAa,CAC3BC,KAAqC,EAC1B;EAKX,MAAMC,GAAgB,GACpBC,KAAuD,IAEvDF,KAAK,CAACG,KAAK,CAACC,IAAI,IAAI;IAClB,IAAI,OAAOF,KAAK,KAAK,WAAW,EAAE,OAAOE,IAAI,CAACC,OAAO;IACrD,IAAI,OAAOH,KAAK,KAAK,UAAU,EAAE;MAC/B,OAAO,IAAAI,yBAAgB,EAACJ,KAAK,CAACE,IAAI,CAACC,OAAO,CAAC,CAAC;IAC9C;IACA,OAAO,CAACE,KAAK,CAACC,OAAO,CAACN,KAAK,CAAC,GAAGA,KAAK,GAAG,CAACA,KAAK,CAAC,EAAEO,IAAI,CAACC,KAAK,IAAI;MAC5D,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;QAC7B,MAAM,IAAIC,KAAK,CAAC,6BAA6B,CAAC;MAChD;MACA,OAAOD,KAAK,KAAKN,IAAI,CAACC,OAAO;IAC/B,CAAC,CAAC;EACJ,CAAC,CAAS;EAEZ,MAAMO,MAAM,GAAIC,EAEf,IAAKb,KAAK,CAACG,KAAK,CAACC,IAAI,IAAI,IAAAE,yBAAgB,EAACO,EAAE,CAACT,IAAI,CAACQ,MAAM,CAAC,CAAC,CAAC;EAE5D,OAAO;IACLE,OAAO,EAAEC,SAAW;IACpBf,KAAK,EAAEA,KAAK,CAACgB,MAAM,EAAE;IAErBf,GAAG;IACHgB,KAAK,EAAE,MAAM,KAAK;IAClBL,MAAM;IACNM;EACF,CAAC;AACH;AAEO,SAASC,aAAa,CAC3BnB,KAAqC,EACrCoB,oBAAmC,EACxB;EACX,MAAMC,OAAO,GAAG;EAKdC,IAAI,CAACC,KAA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mEAAkE,GAClE,mEAAkE,GAClE,qEAAoE,GACpE,+BAA8B,CAClC;EAED,IAAI,OAAOsB,KAAK,KAAK,QAAQ,EAAE;IAC7B1B,KAAK,CAAC2B,eAAe,GAAGD,KAAK;EAC/B;EAEA,MAAMG,MAAM,CAACC,MAAM,CAACF,GAAG,EAAE;IACvBG,IAAI,EAAE,2BAA2B;IACjC5B,OAAO,EAAEC,SAAW;IACpBiB;EACF,CAAC,CAAC;AACJ;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/helpers/deep-array.js b/node_modules/@babel/core/lib/config/helpers/deep-array.js index 80cc2d066..cca42bff1 100644 --- a/node_modules/@babel/core/lib/config/helpers/deep-array.js +++ b/node_modules/@babel/core/lib/config/helpers/deep-array.js @@ -9,20 +9,16 @@ exports.flattenToSet = flattenToSet; function finalize(deepArr) { return Object.freeze(deepArr); } - function flattenToSet(arr) { const result = new Set(); const stack = [arr]; - while (stack.length > 0) { for (const el of stack.pop()) { if (Array.isArray(el)) stack.push(el);else result.add(el); } } - return result; } - 0 && 0; //# sourceMappingURL=deep-array.js.map diff --git a/node_modules/@babel/core/lib/config/helpers/deep-array.js.map b/node_modules/@babel/core/lib/config/helpers/deep-array.js.map index dcaf80114..1a5b30459 100644 --- a/node_modules/@babel/core/lib/config/helpers/deep-array.js.map +++ b/node_modules/@babel/core/lib/config/helpers/deep-array.js.map @@ -1 +1 @@ -{"version":3,"names":["finalize","deepArr","Object","freeze","flattenToSet","arr","result","Set","stack","length","el","pop","Array","isArray","push","add"],"sources":["../../../src/config/helpers/deep-array.ts"],"sourcesContent":["export type DeepArray = Array>;\n\n// Just to make sure that DeepArray is not assignable to ReadonlyDeepArray\ndeclare const __marker: unique symbol;\nexport type ReadonlyDeepArray = ReadonlyArray> & {\n [__marker]: true;\n};\n\nexport function finalize(deepArr: DeepArray): ReadonlyDeepArray {\n return Object.freeze(deepArr) as ReadonlyDeepArray;\n}\n\nexport function flattenToSet(\n arr: ReadonlyDeepArray,\n): Set {\n const result = new Set();\n const stack = [arr];\n while (stack.length > 0) {\n for (const el of stack.pop()) {\n if (Array.isArray(el)) stack.push(el as ReadonlyDeepArray);\n else result.add(el as T);\n }\n }\n return result;\n}\n"],"mappings":";;;;;;;;AAQO,SAASA,QAAT,CAAqBC,OAArB,EAAkE;EACvE,OAAOC,MAAM,CAACC,MAAP,CAAcF,OAAd,CAAP;AACD;;AAEM,SAASG,YAAT,CACLC,GADK,EAEG;EACR,MAAMC,MAAM,GAAG,IAAIC,GAAJ,EAAf;EACA,MAAMC,KAAK,GAAG,CAACH,GAAD,CAAd;;EACA,OAAOG,KAAK,CAACC,MAAN,GAAe,CAAtB,EAAyB;IACvB,KAAK,MAAMC,EAAX,IAAiBF,KAAK,CAACG,GAAN,EAAjB,EAA8B;MAC5B,IAAIC,KAAK,CAACC,OAAN,CAAcH,EAAd,CAAJ,EAAuBF,KAAK,CAACM,IAAN,CAAWJ,EAAX,EAAvB,KACKJ,MAAM,CAACS,GAAP,CAAWL,EAAX;IACN;EACF;;EACD,OAAOJ,MAAP;AACD"} \ No newline at end of file +{"version":3,"names":["finalize","deepArr","Object","freeze","flattenToSet","arr","result","Set","stack","length","el","pop","Array","isArray","push","add"],"sources":["../../../src/config/helpers/deep-array.ts"],"sourcesContent":["export type DeepArray = Array>;\n\n// Just to make sure that DeepArray is not assignable to ReadonlyDeepArray\ndeclare const __marker: unique symbol;\nexport type ReadonlyDeepArray = ReadonlyArray> & {\n [__marker]: true;\n};\n\nexport function finalize(deepArr: DeepArray): ReadonlyDeepArray {\n return Object.freeze(deepArr) as ReadonlyDeepArray;\n}\n\nexport function flattenToSet(\n arr: ReadonlyDeepArray,\n): Set {\n const result = new Set();\n const stack = [arr];\n while (stack.length > 0) {\n for (const el of stack.pop()) {\n if (Array.isArray(el)) stack.push(el as ReadonlyDeepArray);\n else result.add(el as T);\n }\n }\n return result;\n}\n"],"mappings":";;;;;;;;AAQO,SAASA,QAAQ,CAAIC,OAAqB,EAAwB;EACvE,OAAOC,MAAM,CAACC,MAAM,CAACF,OAAO,CAAC;AAC/B;AAEO,SAASG,YAAY,CAC1BC,GAAyB,EACjB;EACR,MAAMC,MAAM,GAAG,IAAIC,GAAG,EAAK;EAC3B,MAAMC,KAAK,GAAG,CAACH,GAAG,CAAC;EACnB,OAAOG,KAAK,CAACC,MAAM,GAAG,CAAC,EAAE;IACvB,KAAK,MAAMC,EAAE,IAAIF,KAAK,CAACG,GAAG,EAAE,EAAE;MAC5B,IAAIC,KAAK,CAACC,OAAO,CAACH,EAAE,CAAC,EAAEF,KAAK,CAACM,IAAI,CAACJ,EAAE,CAAyB,CAAC,KACzDJ,MAAM,CAACS,GAAG,CAACL,EAAE,CAAM;IAC1B;EACF;EACA,OAAOJ,MAAM;AACf;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/helpers/environment.js b/node_modules/@babel/core/lib/config/helpers/environment.js index c0c1caa06..a23b80bec 100644 --- a/node_modules/@babel/core/lib/config/helpers/environment.js +++ b/node_modules/@babel/core/lib/config/helpers/environment.js @@ -4,11 +4,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.getEnv = getEnv; - function getEnv(defaultValue = "development") { return process.env.BABEL_ENV || process.env.NODE_ENV || defaultValue; } - 0 && 0; //# sourceMappingURL=environment.js.map diff --git a/node_modules/@babel/core/lib/config/helpers/environment.js.map b/node_modules/@babel/core/lib/config/helpers/environment.js.map index eeae387c1..5992a64b9 100644 --- a/node_modules/@babel/core/lib/config/helpers/environment.js.map +++ b/node_modules/@babel/core/lib/config/helpers/environment.js.map @@ -1 +1 @@ -{"version":3,"names":["getEnv","defaultValue","process","env","BABEL_ENV","NODE_ENV"],"sources":["../../../src/config/helpers/environment.ts"],"sourcesContent":["export function getEnv(defaultValue: string = \"development\"): string {\n return process.env.BABEL_ENV || process.env.NODE_ENV || defaultValue;\n}\n"],"mappings":";;;;;;;AAAO,SAASA,MAAT,CAAgBC,YAAoB,GAAG,aAAvC,EAA8D;EACnE,OAAOC,OAAO,CAACC,GAAR,CAAYC,SAAZ,IAAyBF,OAAO,CAACC,GAAR,CAAYE,QAArC,IAAiDJ,YAAxD;AACD"} \ No newline at end of file +{"version":3,"names":["getEnv","defaultValue","process","env","BABEL_ENV","NODE_ENV"],"sources":["../../../src/config/helpers/environment.ts"],"sourcesContent":["export function getEnv(defaultValue: string = \"development\"): string {\n return process.env.BABEL_ENV || process.env.NODE_ENV || defaultValue;\n}\n"],"mappings":";;;;;;AAAO,SAASA,MAAM,CAACC,YAAoB,GAAG,aAAa,EAAU;EACnE,OAAOC,OAAO,CAACC,GAAG,CAACC,SAAS,IAAIF,OAAO,CAACC,GAAG,CAACE,QAAQ,IAAIJ,YAAY;AACtE;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/index.js b/node_modules/@babel/core/lib/config/index.js index dbc1c8733..f58755f21 100644 --- a/node_modules/@babel/core/lib/config/index.js +++ b/node_modules/@babel/core/lib/config/index.js @@ -12,36 +12,25 @@ Object.defineProperty(exports, "default", { } }); exports.loadPartialConfigSync = exports.loadPartialConfigAsync = exports.loadPartialConfig = exports.loadOptionsSync = exports.loadOptionsAsync = exports.loadOptions = void 0; - function _gensync() { const data = require("gensync"); - _gensync = function () { return data; }; - return data; } - var _full = require("./full"); - var _partial = require("./partial"); - var _item = require("./item"); - const loadOptionsRunner = _gensync()(function* (opts) { var _config$options; - const config = yield* (0, _full.default)(opts); return (_config$options = config == null ? void 0 : config.options) != null ? _config$options : null; }); - const createConfigItemRunner = _gensync()(_item.createConfigItem); - const maybeErrback = runner => (argOrCallback, maybeCallback) => { let arg; let callback; - if (maybeCallback === undefined && typeof argOrCallback === "function") { callback = argOrCallback; arg = undefined; @@ -49,10 +38,8 @@ const maybeErrback = runner => (argOrCallback, maybeCallback) => { callback = maybeCallback; arg = argOrCallback; } - return callback ? runner.errback(arg, callback) : runner.sync(arg); }; - const loadPartialConfig = maybeErrback(_partial.loadPartialConfig); exports.loadPartialConfig = loadPartialConfig; const loadPartialConfigSync = _partial.loadPartialConfig.sync; @@ -69,7 +56,6 @@ const createConfigItemSync = createConfigItemRunner.sync; exports.createConfigItemSync = createConfigItemSync; const createConfigItemAsync = createConfigItemRunner.async; exports.createConfigItemAsync = createConfigItemAsync; - function createConfigItem(target, options, callback) { if (callback !== undefined) { return createConfigItemRunner.errback(target, options, callback); @@ -79,7 +65,6 @@ function createConfigItem(target, options, callback) { return createConfigItemRunner.sync(target, options); } } - 0 && 0; //# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/core/lib/config/index.js.map b/node_modules/@babel/core/lib/config/index.js.map index 4b8d9ca76..c390caeb8 100644 --- a/node_modules/@babel/core/lib/config/index.js.map +++ b/node_modules/@babel/core/lib/config/index.js.map @@ -1 +1 @@ -{"version":3,"names":["loadOptionsRunner","gensync","opts","config","loadFullConfig","options","createConfigItemRunner","createConfigItemImpl","maybeErrback","runner","argOrCallback","maybeCallback","arg","callback","undefined","errback","sync","loadPartialConfig","loadPartialConfigRunner","loadPartialConfigSync","loadPartialConfigAsync","async","loadOptions","loadOptionsSync","loadOptionsAsync","createConfigItemSync","createConfigItemAsync","createConfigItem","target"],"sources":["../../src/config/index.ts"],"sourcesContent":["import gensync, { type Handler, type Callback } from \"gensync\";\n\nexport type {\n ResolvedConfig,\n InputOptions,\n PluginPasses,\n Plugin,\n} from \"./full\";\n\nimport type { PluginTarget } from \"./validation/options\";\n\nimport type {\n PluginAPI as basePluginAPI,\n PresetAPI as basePresetAPI,\n} from \"./helpers/config-api\";\nexport type { PluginObject } from \"./validation/plugins\";\ntype PluginAPI = basePluginAPI & typeof import(\"..\");\ntype PresetAPI = basePresetAPI & typeof import(\"..\");\nexport type { PluginAPI, PresetAPI };\n// todo: may need to refine PresetObject to be a subset of ValidatedOptions\nexport type {\n CallerMetadata,\n ValidatedOptions as PresetObject,\n} from \"./validation/options\";\n\nimport loadFullConfig, { type ResolvedConfig } from \"./full\";\nimport { loadPartialConfig as loadPartialConfigRunner } from \"./partial\";\n\nexport { loadFullConfig as default };\nexport type { PartialConfig } from \"./partial\";\n\nimport { createConfigItem as createConfigItemImpl } from \"./item\";\nimport type { ConfigItem } from \"./item\";\n\nconst loadOptionsRunner = gensync(function* (\n opts: unknown,\n): Handler {\n const config = yield* loadFullConfig(opts);\n // NOTE: We want to return \"null\" explicitly, while ?. alone returns undefined\n return config?.options ?? null;\n});\n\nconst createConfigItemRunner = gensync(createConfigItemImpl);\n\nconst maybeErrback =\n (runner: gensync.Gensync<[Arg], Return>) =>\n (argOrCallback: Arg | Callback, maybeCallback?: Callback) => {\n let arg: Arg | undefined;\n let callback: Callback;\n if (maybeCallback === undefined && typeof argOrCallback === \"function\") {\n callback = argOrCallback as Callback;\n arg = undefined;\n } else {\n callback = maybeCallback;\n arg = argOrCallback as Arg;\n }\n return callback ? runner.errback(arg, callback) : runner.sync(arg);\n };\n\nexport const loadPartialConfig = maybeErrback(loadPartialConfigRunner);\nexport const loadPartialConfigSync = loadPartialConfigRunner.sync;\nexport const loadPartialConfigAsync = loadPartialConfigRunner.async;\n\nexport const loadOptions = maybeErrback(loadOptionsRunner);\nexport const loadOptionsSync = loadOptionsRunner.sync;\nexport const loadOptionsAsync = loadOptionsRunner.async;\n\nexport const createConfigItemSync = createConfigItemRunner.sync;\nexport const createConfigItemAsync = createConfigItemRunner.async;\nexport function createConfigItem(\n target: PluginTarget,\n options: Parameters[1],\n callback?: (err: Error, val: ConfigItem | null) => void,\n) {\n if (callback !== undefined) {\n return createConfigItemRunner.errback(target, options, callback);\n } else if (typeof options === \"function\") {\n return createConfigItemRunner.errback(target, undefined, callback);\n } else {\n return createConfigItemRunner.sync(target, options);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAyBA;;AACA;;AAKA;;AAGA,MAAMA,iBAAiB,GAAGC,UAAA,CAAQ,WAChCC,IADgC,EAEA;EAAA;;EAChC,MAAMC,MAAM,GAAG,OAAO,IAAAC,a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AAhD,CAAP;EACD,CAFD,MAEO,IAAI,OAAOR,OAAP,KAAmB,UAAvB,EAAmC;IACxC,OAAOC,sBAAsB,CAACS,OAAvB,CAA+Ba,MAA/B,EAAuCd,SAAvC,EAAkDD,QAAlD,CAAP;EACD,CAFM,MAEA;IACL,OAAOP,sBAAsB,CAACU,IAAvB,CAA4BY,MAA5B,EAAoCvB,OAApC,CAAP;EACD;AACF"} \ No newline at end of file +{"version":3,"names":["loadOptionsRunner","gensync","opts","config","loadFullConfig","options","createConfigItemRunner","createConfigItemImpl","maybeErrback","runner","argOrCallback","maybeCallback","arg","callback","undefined","errback","sync","loadPartialConfig","loadPartialConfigRunner","loadPartialConfigSync","loadPartialConfigAsync","async","loadOptions","loadOptionsSync","loadOptionsAsync","createConfigItemSync","createConfigItemAsync","createConfigItem","target"],"sources":["../../src/config/index.ts"],"sourcesContent":["import gensync, { type Handler, type Callback } from \"gensync\";\n\nexport type {\n ResolvedConfig,\n InputOptions,\n PluginPasses,\n Plugin,\n} from \"./full\";\n\nimport type { PluginTarget } from \"./validation/options\";\n\nimport type {\n PluginAPI as basePluginAPI,\n PresetAPI as basePresetAPI,\n} from \"./helpers/config-api\";\nexport type { PluginObject } from \"./validation/plugins\";\ntype PluginAPI = basePluginAPI & typeof import(\"..\");\ntype PresetAPI = basePresetAPI & typeof import(\"..\");\nexport type { PluginAPI, PresetAPI };\n// todo: may need to refine PresetObject to be a subset of ValidatedOptions\nexport type {\n CallerMetadata,\n ValidatedOptions as PresetObject,\n} from \"./validation/options\";\n\nimport loadFullConfig, { type ResolvedConfig } from \"./full\";\nimport { loadPartialConfig as loadPartialConfigRunner } from \"./partial\";\n\nexport { loadFullConfig as default };\nexport type { PartialConfig } from \"./partial\";\n\nimport { createConfigItem as createConfigItemImpl } from \"./item\";\nimport type { ConfigItem } from \"./item\";\n\nconst loadOptionsRunner = gensync(function* (\n opts: unknown,\n): Handler {\n const config = yield* loadFullConfig(opts);\n // NOTE: We want to return \"null\" explicitly, while ?. alone returns undefined\n return config?.options ?? null;\n});\n\nconst createConfigItemRunner = gensync(createConfigItemImpl);\n\nconst maybeErrback =\n (runner: gensync.Gensync<[Arg], Return>) =>\n (argOrCallback: Arg | Callback, maybeCallback?: Callback) => {\n let arg: Arg | undefined;\n let callback: Callback;\n if (maybeCallback === undefined && typeof argOrCallback === \"function\") {\n callback = argOrCallback as Callback;\n arg = undefined;\n } else {\n callback = maybeCallback;\n arg = argOrCallback as Arg;\n }\n return callback ? runner.errback(arg, callback) : runner.sync(arg);\n };\n\nexport const loadPartialConfig = maybeErrback(loadPartialConfigRunner);\nexport const loadPartialConfigSync = loadPartialConfigRunner.sync;\nexport const loadPartialConfigAsync = loadPartialConfigRunner.async;\n\nexport const loadOptions = maybeErrback(loadOptionsRunner);\nexport const loadOptionsSync = loadOptionsRunner.sync;\nexport const loadOptionsAsync = loadOptionsRunner.async;\n\nexport const createConfigItemSync = createConfigItemRunner.sync;\nexport const createConfigItemAsync = createConfigItemRunner.async;\nexport function createConfigItem(\n target: PluginTarget,\n options: Parameters[1],\n callback?: (err: Error, val: ConfigItem | null) => void,\n) {\n if (callback !== undefined) {\n return createConfigItemRunner.errback(target, options, callback);\n } else if (typeof options === \"function\") {\n return createConfigItemRunner.errback(target, undefined, callback);\n } else {\n return createConfigItemRunner.sync(target, options);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAyBA;AACA;AAKA;AAGA,MAAMA,iBAAiB,GAAGC,UAAO,CAAC,WAChCC,IAAa,EACmB;EAAA;EAChC,MAAMC,MAAM,GAAG,OAAO,IAAAC,aAAc,EAACF,IAAI,CAAC;EAE1C,0BAAOC,MAAM,oBAANA,MAAM,CAAEE,OAAO,8BAAI,IAAI;AAChC,CAAC,CAAC;AAEF,MAAMC,sBAAsB,GAAGL,UAAO,CAACM,sBAAoB,CAAC;AAE5D,MAAMC,YAAY,GACFC,MAAsC,IACpD,CAACC,aAAqC,EAAEC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,CAACU,IAAI,CAACY,MAAM,EAAEvB,OAAO,CAAC;EACrD;AACF;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/item.js b/node_modules/@babel/core/lib/config/item.js index 2620ad3e9..37f1348d8 100644 --- a/node_modules/@babel/core/lib/config/item.js +++ b/node_modules/@babel/core/lib/config/item.js @@ -6,19 +6,14 @@ Object.defineProperty(exports, "__esModule", { exports.createConfigItem = createConfigItem; exports.createItemFromDescriptor = createItemFromDescriptor; exports.getItemDescriptor = getItemDescriptor; - function _path() { const data = require("path"); - _path = function () { return data; }; - return data; } - var _configDescriptors = require("./config-descriptors"); - function createItemFromDescriptor(desc) { return new ConfigItem(desc); } @@ -33,18 +28,15 @@ function* createConfigItem(value, { }); return createItemFromDescriptor(descriptor); } - +const CONFIG_ITEM_BRAND = Symbol.for("@babel/core@7 - ConfigItem"); function getItemDescriptor(item) { if (item != null && item[CONFIG_ITEM_BRAND]) { return item._descriptor; } - return undefined; } - -const CONFIG_ITEM_BRAND = Symbol.for("@babel/core@7 - ConfigItem"); - class ConfigItem { + constructor(descriptor) { this._descriptor = void 0; this[CONFIG_ITEM_BRAND] = true; @@ -68,11 +60,10 @@ class ConfigItem { request: this._descriptor.file.request, resolved: this._descriptor.file.resolved } : undefined; + Object.freeze(this); } - } - Object.freeze(ConfigItem.prototype); 0 && 0; diff --git a/node_modules/@babel/core/lib/config/item.js.map b/node_modules/@babel/core/lib/config/item.js.map index 519fc9815..f5e0a478a 100644 --- a/node_modules/@babel/core/lib/config/item.js.map +++ b/node_modules/@babel/core/lib/config/item.js.map @@ -1 +1 @@ -{"version":3,"names":["createItemFromDescriptor","desc","ConfigItem","createConfigItem","value","dirname","type","descriptor","createDescriptor","path","resolve","alias","getItemDescriptor","item","CONFIG_ITEM_BRAND","_descriptor","undefined","Symbol","for","constructor","options","name","file","Object","defineProperty","enumerable","request","resolved","freeze","prototype"],"sources":["../../src/config/item.ts"],"sourcesContent":["import type { Handler } from \"gensync\";\nimport type { PluginTarget, PluginOptions } from \"./validation/options\";\n\nimport path from \"path\";\nimport { createDescriptor } from \"./config-descriptors\";\n\nimport type { UnloadedDescriptor } from \"./config-descriptors\";\n\nexport function createItemFromDescriptor(desc: UnloadedDescriptor): ConfigItem {\n return new ConfigItem(desc);\n}\n\n/**\n * Create a config item using the same value format used in Babel's config\n * files. Items returned from this function should be cached by the caller\n * ideally, as recreating the config item will mean re-resolving the item\n * and re-evaluating the plugin/preset function.\n */\nexport function* createConfigItem(\n value:\n | PluginTarget\n | [PluginTarget, PluginOptions]\n | [PluginTarget, PluginOptions, string | void],\n {\n dirname = \".\",\n type,\n }: {\n dirname?: string;\n type?: \"preset\" | \"plugin\";\n } = {},\n): Handler {\n const descriptor = yield* createDescriptor(value, path.resolve(dirname), {\n type,\n alias: \"programmatic item\",\n });\n\n return createItemFromDescriptor(descriptor);\n}\n\nexport function getItemDescriptor(item: unknown): UnloadedDescriptor | void {\n if ((item as any)?.[CONFIG_ITEM_BRAND]) {\n return (item as ConfigItem)._descriptor;\n }\n\n return undefined;\n}\n\nexport type { ConfigItem };\n\nconst CONFIG_ITEM_BRAND = Symbol.for(\"@babel/core@7 - ConfigItem\");\n\n/**\n * A public representation of a plugin/preset that will _eventually_ be load.\n * Users can use this to interact with the results of a loaded Babel\n * configuration.\n *\n * Any changes to public properties of this class should be considered a\n * breaking change to Babel's API.\n */\nclass ConfigItem {\n /**\n * The private underlying descriptor that Babel actually cares about.\n * If you access this, you are a bad person.\n */\n _descriptor: UnloadedDescriptor;\n\n // TODO(Babel 8): Check if this symbol needs to be updated\n /**\n * Used to detect ConfigItem instances from other Babel instances.\n */\n [CONFIG_ITEM_BRAND] = true;\n\n /**\n * The resolved value of the item itself.\n */\n value: {} | Function;\n\n /**\n * The options, if any, that were passed to the item.\n * Mutating this will lead to undefined behavior.\n *\n * \"false\" means that this item has been disabled.\n */\n options: {} | void | false;\n\n /**\n * The directory that the options for this item are relative to.\n */\n dirname: string;\n\n /**\n * Get the name of the plugin, if the user gave it one.\n */\n name: string | void;\n\n /**\n * Data about the file that the item was loaded from, if Babel knows it.\n */\n file: {\n // The requested path, e.g. \"@babel/env\".\n request: string;\n // The resolved absolute path of the file.\n resolved: string;\n } | void;\n\n constructor(descriptor: UnloadedDescriptor) {\n // Make people less likely to stumble onto this if they are exploring\n // programmatically, and also make sure that if people happen to\n // pass the item through JSON.stringify, it doesn't show up.\n this._descriptor = descriptor;\n Object.defineProperty(this, \"_descriptor\", { enumerable: false });\n\n Object.defineProperty(this, CONFIG_ITEM_BRAND, { enumerable: false });\n\n this.value = this._descriptor.value;\n this.options = this._descriptor.options;\n this.dirname = this._descriptor.dirname;\n this.name = this._descriptor.name;\n this.file = this._descriptor.file\n ? {\n request: this._descriptor.file.request,\n resolved: this._descriptor.file.resolved,\n }\n : undefined;\n\n // Freeze the object to make it clear that people shouldn't expect mutating\n // this object to do anything. A new item should be created if they want\n // to change something.\n Object.freeze(this);\n }\n}\n\nObject.freeze(ConfigItem.prototype);\n"],"mappings":";;;;;;;;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;;AAIO,SAASA,wBAAT,CAAkCC,IAAlC,EAAwE;EAC7E,OAAO,IAAIC,UAAJ,CAAeD,IAAf,CAAP;AACD;;AAQM,UAAUE,gBAAV,CACLC,KADK,EAKL;EACEC,OAAO,GAAG,GADZ;EAEEC;AAFF,IAMI,EAXC,EAYgB;EACrB,MAAMC,UAAU,GAAG,OAAO,IAAAC,mCAAA,EAAiBJ,KAAjB,EAAwBK,OAAA,CAAKC,OAAL,CAAaL,OAAb,CAAxB,EAA+C;IACvEC,IADuE;IAEvEK,KAAK,EAAE;EAFgE,CAA/C,CAA1B;EAKA,OAAOX,wBAAwB,CAACO,UAAD,CAA/B;AACD;;AAEM,SAASK,iBAAT,CAA2BC,IAA3B,EAAqE;EAC1E,IAAKA,IAAL,YAAKA,IAAD,CAAgBC,iBAAhB,CAAJ,EAAwC;IACtC,OAAQD,IAAD,CAAqBE,WAA5B;EACD;;EAED,OAAOC,SAAP;AACD;;AAID,MAAMF,iBAAiB,GAAGG,MAAM,CAACC,GAAP,CAAW,4BAAX,CAA1B;;AAUA,MAAMhB,UAAN,CAAiB;EA8CfiB,WAAW,CAACZ,UAAD,EAAiC;IAAA,KAzC5CQ,WAyC4C;IAAA,KAnC3CD,iBAmC2C,IAnCtB,IAmCsB;IAAA,KA9B5CV,KA8B4C;IAAA,KAtB5CgB,OAsB4C;IAAA,KAjB5Cf,OAiB4C;IAAA,KAZ5CgB,IAY4C;IAAA,KAP5CC,IAO4C;IAI1C,KAAKP,WAAL,GAAmBR,UAAnB;IACAgB,MAAM,CAACC,cAAP,CAAsB,IAAtB,EAA4B,aAA5B,EAA2C;MAAEC,UAAU,EAAE;IAAd,CAA3C;IAEAF,MAAM,CAACC,cAAP,CAAsB,IAAtB,EAA4BV,iBAA5B,EAA+C;MAAEW,UAAU,EAAE;IAAd,CAA/C;IAEA,KAAKrB,KAAL,GAAa,KAAKW,WAAL,CAAiBX,KAA9B;IACA,KAAKgB,OAAL,GAAe,KAAKL,WAAL,CAAiBK,OAAhC;IACA,KAAKf,OAAL,GAAe,KAAKU,WAAL,CAAiBV,OAAhC;IACA,KAAKgB,IAAL,GAAY,KAAKN,WAAL,CAAiBM,IAA7B;IACA,KAAKC,IAAL,GAAY,KAAKP,WAAL,CAAiBO,IAAjB,GACR;MACEI,OAAO,EAAE,KAAKX,WAAL,CAAiBO,IAAjB,CAAsBI,OADjC;MAEEC,QAAQ,EAAE,KAAKZ,WAAL,CAAiBO,IAAjB,CAAsBK;IAFlC,CADQ,GAKRX,SALJ;IAUAO,MAAM,CAACK,MAAP,CAAc,IAAd;EACD;;AAtEc;;AAyEjBL,MAAM,CAACK,MAAP,CAAc1B,UAAU,CAAC2B,SAAzB"} \ No newline at end of file +{"version":3,"names":["createItemFromDescriptor","desc","ConfigItem","createConfigItem","value","dirname","type","descriptor","createDescriptor","path","resolve","alias","CONFIG_ITEM_BRAND","Symbol","for","getItemDescriptor","item","_descriptor","undefined","constructor","options","name","file","Object","defineProperty","enumerable","request","resolved","freeze","prototype"],"sources":["../../src/config/item.ts"],"sourcesContent":["import type { Handler } from \"gensync\";\nimport type { PluginTarget, PluginOptions } from \"./validation/options\";\n\nimport path from \"path\";\nimport { createDescriptor } from \"./config-descriptors\";\n\nimport type { UnloadedDescriptor } from \"./config-descriptors\";\n\nexport function createItemFromDescriptor(desc: UnloadedDescriptor): ConfigItem {\n return new ConfigItem(desc);\n}\n\n/**\n * Create a config item using the same value format used in Babel's config\n * files. Items returned from this function should be cached by the caller\n * ideally, as recreating the config item will mean re-resolving the item\n * and re-evaluating the plugin/preset function.\n */\nexport function* createConfigItem(\n value:\n | PluginTarget\n | [PluginTarget, PluginOptions]\n | [PluginTarget, PluginOptions, string | void],\n {\n dirname = \".\",\n type,\n }: {\n dirname?: string;\n type?: \"preset\" | \"plugin\";\n } = {},\n): Handler {\n const descriptor = yield* createDescriptor(value, path.resolve(dirname), {\n type,\n alias: \"programmatic item\",\n });\n\n return createItemFromDescriptor(descriptor);\n}\n\nconst CONFIG_ITEM_BRAND = Symbol.for(\"@babel/core@7 - ConfigItem\");\n\nexport function getItemDescriptor(item: unknown): UnloadedDescriptor | void {\n if ((item as any)?.[CONFIG_ITEM_BRAND]) {\n return (item as ConfigItem)._descriptor;\n }\n\n return undefined;\n}\n\nexport type { ConfigItem };\n\n/**\n * A public representation of a plugin/preset that will _eventually_ be load.\n * Users can use this to interact with the results of a loaded Babel\n * configuration.\n *\n * Any changes to public properties of this class should be considered a\n * breaking change to Babel's API.\n */\nclass ConfigItem {\n /**\n * The private underlying descriptor that Babel actually cares about.\n * If you access this, you are a bad person.\n */\n _descriptor: UnloadedDescriptor;\n\n // TODO(Babel 8): Check if this symbol needs to be updated\n /**\n * Used to detect ConfigItem instances from other Babel instances.\n */\n [CONFIG_ITEM_BRAND] = true;\n\n /**\n * The resolved value of the item itself.\n */\n value: {} | Function;\n\n /**\n * The options, if any, that were passed to the item.\n * Mutating this will lead to undefined behavior.\n *\n * \"false\" means that this item has been disabled.\n */\n options: {} | void | false;\n\n /**\n * The directory that the options for this item are relative to.\n */\n dirname: string;\n\n /**\n * Get the name of the plugin, if the user gave it one.\n */\n name: string | void;\n\n /**\n * Data about the file that the item was loaded from, if Babel knows it.\n */\n file: {\n // The requested path, e.g. \"@babel/env\".\n request: string;\n // The resolved absolute path of the file.\n resolved: string;\n } | void;\n\n constructor(descriptor: UnloadedDescriptor) {\n // Make people less likely to stumble onto this if they are exploring\n // programmatically, and also make sure that if people happen to\n // pass the item through JSON.stringify, it doesn't show up.\n this._descriptor = descriptor;\n Object.defineProperty(this, \"_descriptor\", { enumerable: false });\n\n Object.defineProperty(this, CONFIG_ITEM_BRAND, { enumerable: false });\n\n this.value = this._descriptor.value;\n this.options = this._descriptor.options;\n this.dirname = this._descriptor.dirname;\n this.name = this._descriptor.name;\n this.file = this._descriptor.file\n ? {\n request: this._descriptor.file.request,\n resolved: this._descriptor.file.resolved,\n }\n : undefined;\n\n // Freeze the object to make it clear that people shouldn't expect mutating\n // this object to do anything. A new item should be created if they want\n // to change something.\n Object.freeze(this);\n }\n}\n\nObject.freeze(ConfigItem.prototype);\n"],"mappings":";;;;;;;;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AAIO,SAASA,wBAAwB,CAACC,IAAwB,EAAc;EAC7E,OAAO,IAAIC,UAAU,CAACD,IAAI,CAAC;AAC7B;;AAQO,UAAUE,gBAAgB,CAC/BC,KAGgD,EAChD;EACEC,OAAO,GAAG,GAAG;EACbC;AAIF,CAAC,GAAG,CAAC,CAAC,EACe;EACrB,MAAMC,UAAU,GAAG,OAAO,IAAAC,mCAAgB,EAACJ,KAAK,EAAEK,OAAI,CAACC,OAAO,CAACL,OAAO,CAAC,EAAE;IACvEC,IAAI;IACJK,KAAK,EAAE;EACT,CAAC,CAAC;EAEF,OAAOX,wBAAwB,CAACO,UAAU,CAAC;AAC7C;AAEA,MAAMK,iB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S,CAAC;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/partial.js b/node_modules/@babel/core/lib/config/partial.js index 87b2c8135..d724fd7de 100644 --- a/node_modules/@babel/core/lib/config/partial.js +++ b/node_modules/@babel/core/lib/config/partial.js @@ -5,58 +5,39 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = loadPrivatePartialConfig; exports.loadPartialConfig = void 0; - function _path() { const data = require("path"); - _path = function () { return data; }; - return data; } - function _gensync() { const data = require("gensync"); - _gensync = function () { return data; }; - return data; } - var _plugin = require("./plugin"); - var _util = require("./util"); - var _item = require("./item"); - var _configChain = require("./config-chain"); - var _environment = require("./helpers/environment"); - var _options = require("./validation/options"); - var _files = require("./files"); - var _resolveTargets = require("./resolve-targets"); - const _excluded = ["showIgnoredFiles"]; - function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } - function resolveRootMode(rootDir, rootMode) { switch (rootMode) { case "root": return rootDir; - case "upward-optional": { const upwardRootDir = (0, _files.findConfigUpwards)(rootDir); return upwardRootDir === null ? rootDir : upwardRootDir; } - case "upward": { const upwardRootDir = (0, _files.findConfigUpwards)(rootDir); @@ -66,17 +47,14 @@ function resolveRootMode(rootDir, rootMode) { dirname: rootDir }); } - default: throw new Error(`Assertion failure - unknown rootMode value.`); } } - function* loadPrivatePartialConfig(inputOpts) { if (inputOpts != null && (typeof inputOpts !== "object" || Array.isArray(inputOpts))) { throw new Error("Babel options must be an object, null, or undefined"); } - const args = inputOpts ? (0, _options.validate)("arguments", inputOpts) : {}; const { envName = (0, _environment.getEnv)(), @@ -86,9 +64,7 @@ function* loadPrivatePartialConfig(inputOpts) { caller, cloneInputAst = true } = args; - const absoluteCwd = _path().resolve(cwd); - const absoluteRootDir = resolveRootMode(_path().resolve(absoluteCwd, rootDir), rootMode); const filename = typeof args.filename === "string" ? _path().resolve(cwd, args.filename) : undefined; const showConfigPath = yield* (0, _files.resolveShowConfigPath)(absoluteCwd); @@ -133,10 +109,8 @@ function* loadPrivatePartialConfig(inputOpts) { files: configChain.files }; } - const loadPartialConfig = _gensync()(function* (opts) { let showIgnoredFiles = false; - if (typeof opts === "object" && opts !== null && !Array.isArray(opts)) { var _opts = opts; ({ @@ -145,7 +119,6 @@ const loadPartialConfig = _gensync()(function* (opts) { opts = _objectWithoutPropertiesLoose(_opts, _excluded); _opts; } - const result = yield* loadPrivatePartialConfig(opts); if (!result) return null; const { @@ -156,11 +129,9 @@ const loadPartialConfig = _gensync()(function* (opts) { fileHandling, files } = result; - if (fileHandling === "ignored" && !showIgnoredFiles) { return null; } - (options.plugins || []).forEach(item => { if (item.value instanceof _plugin.default) { throw new Error("Passing cached plugin instances is not supported in " + "babel.loadPartialConfig()"); @@ -168,10 +139,9 @@ const loadPartialConfig = _gensync()(function* (opts) { }); return new PartialConfig(options, babelrc ? babelrc.filepath : undefined, ignore ? ignore.filepath : undefined, config ? config.filepath : undefined, fileHandling, files); }); - exports.loadPartialConfig = loadPartialConfig; - class PartialConfig { + constructor(options, babelrc, ignore, config, fileHandling, files) { this.options = void 0; this.babelrc = void 0; @@ -185,15 +155,14 @@ class PartialConfig { this.config = config; this.fileHandling = fileHandling; this.files = files; + Object.freeze(this); } hasFilesystemConfig() { return this.babelrc !== undefined || this.config !== undefined; } - } - Object.freeze(PartialConfig.prototype); 0 && 0; diff --git a/node_modules/@babel/core/lib/config/partial.js.map b/node_modules/@babel/core/lib/config/partial.js.map index b6291074c..300bfd860 100644 --- a/node_modules/@babel/core/lib/config/partial.js.map +++ b/node_modules/@babel/core/lib/config/partial.js.map @@ -1 +1 @@ -{"version":3,"names":["resolveRootMode","rootDir","rootMode","upwardRootDir","findConfigUpwards","Object","assign","Error","ROOT_CONFIG_FILENAMES","join","code","dirname","loadPrivatePartialConfig","inputOpts","Array","isArray","args","validate","envName","getEnv","cwd","root","caller","cloneInputAst","absoluteCwd","path","resolve","absoluteRootDir","filename","undefined","showConfigPath","resolveShowConfigPath","context","showConfig","configChain","buildRootChain","merged","assumptions","options","forEach","opts","mergeOptions","targets","resolveTargets","babelrc","configFile","browserslistConfigFile","passPerPreset","plugins","map","descriptor","createItemFromDescriptor","presets","fileHandling","ignore","config","files","loadPartialConfig","gensync","showIgnoredFiles","result","item","value","Plugin","PartialConfig","filepath","constructor","babelignore","freeze","hasFilesystemConfig","prototype"],"sources":["../../src/config/partial.ts"],"sourcesContent":["import path from \"path\";\nimport gensync from \"gensync\";\nimport type { Handler } from \"gensync\";\nimport Plugin from \"./plugin\";\nimport { mergeOptions } from \"./util\";\nimport { createItemFromDescriptor } from \"./item\";\nimport { buildRootChain } from \"./config-chain\";\nimport type { ConfigContext, FileHandling } from \"./config-chain\";\nimport { getEnv } from \"./helpers/environment\";\nimport { validate } from \"./validation/options\";\n\nimport type {\n ValidatedOptions,\n NormalizedOptions,\n RootMode,\n} from \"./validation/options\";\n\nimport {\n findConfigUpwards,\n resolveShowConfigPath,\n ROOT_CONFIG_FILENAMES,\n} from \"./files\";\nimport type { ConfigFile, IgnoreFile } from \"./files\";\nimport { resolveTargets } from \"./resolve-targets\";\n\nfunction resolveRootMode(rootDir: string, rootMode: RootMode): string {\n switch (rootMode) {\n case \"root\":\n return rootDir;\n\n case \"upward-optional\": {\n const upwardRootDir = findConfigUpwards(rootDir);\n return upwardRootDir === null ? rootDir : upwardRootDir;\n }\n\n case \"upward\": {\n const upwardRootDir = findConfigUpwards(rootDir);\n if (upwardRootDir !== null) return upwardRootDir;\n\n throw Object.assign(\n new Error(\n `Babel was run with rootMode:\"upward\" but a root could not ` +\n `be found when searching upward from \"${rootDir}\".\\n` +\n `One of the following config files must be in the directory tree: ` +\n `\"${ROOT_CONFIG_FILENAMES.join(\", \")}\".`,\n ) as any,\n {\n code: \"BABEL_ROOT_NOT_FOUND\",\n dirname: rootDir,\n },\n );\n }\n default:\n throw new Error(`Assertion failure - unknown rootMode value.`);\n }\n}\n\ntype PrivPartialConfig = {\n options: NormalizedOptions;\n context: ConfigContext;\n fileHandling: FileHandling;\n ignore: IgnoreFile | void;\n babelrc: ConfigFile | void;\n config: ConfigFile | void;\n files: Set;\n};\n\nexport default function* loadPrivatePartialConfig(\n inputOpts: unknown,\n): Handler {\n if (\n inputOpts != null &&\n (typeof inputOpts !== \"object\" || Array.isArray(inputOpts))\n ) {\n throw new Error(\"Babel options must be an object, null, or undefined\");\n }\n\n const args = inputOpts ? validate(\"arguments\", inputOpts) : {};\n\n const {\n envName = getEnv(),\n cwd = \".\",\n root: rootDir = \".\",\n rootMode = \"root\",\n caller,\n cloneInputAst = true,\n } = args;\n const absoluteCwd = path.resolve(cwd);\n const absoluteRootDir = resolveRootMode(\n path.resolve(absoluteCwd, rootDir),\n rootMode,\n );\n\n const filename =\n typeof args.filename === \"string\"\n ? path.resolve(cwd, args.filename)\n : undefined;\n\n const showConfigPath = yield* resolveShowConfigPath(absoluteCwd);\n\n const context: ConfigContext = {\n filename,\n cwd: absoluteCwd,\n root: absoluteRootDir,\n envName,\n caller,\n showConfig: showConfigPath === filename,\n };\n\n const configChain = yield* buildRootChain(args, context);\n if (!configChain) return null;\n\n const merged: ValidatedOptions = {\n assumptions: {},\n };\n configChain.options.forEach(opts => {\n mergeOptions(merged as any, opts);\n });\n\n const options: NormalizedOptions = {\n ...merged,\n targets: resolveTargets(merged, absoluteRootDir),\n\n // Tack the passes onto the object itself so that, if this object is\n // passed back to Babel a second time, it will be in the right structure\n // to not change behavior.\n cloneInputAst,\n babelrc: false,\n configFile: false,\n browserslistConfigFile: false,\n passPerPreset: false,\n envName: context.envName,\n cwd: context.cwd,\n root: context.root,\n rootMode: \"root\",\n filename:\n typeof context.filename === \"string\" ? context.filename : undefined,\n\n plugins: configChain.plugins.map(descriptor =>\n createItemFromDescriptor(descriptor),\n ),\n presets: configChain.presets.map(descriptor =>\n createItemFromDescriptor(descriptor),\n ),\n };\n\n return {\n options,\n context,\n fileHandling: configChain.fileHandling,\n ignore: configChain.ignore,\n babelrc: configChain.babelrc,\n config: configChain.config,\n files: configChain.files,\n };\n}\n\ntype LoadPartialConfigOpts = {\n showIgnoredFiles?: boolean;\n};\n\nexport const loadPartialConfig = gensync(function* (\n opts?: LoadPartialConfigOpts,\n): Handler {\n let showIgnoredFiles = false;\n // We only extract showIgnoredFiles if opts is an object, so that\n // loadPrivatePartialConfig can throw the appropriate error if it's not.\n if (typeof opts === \"object\" && opts !== null && !Array.isArray(opts)) {\n ({ showIgnoredFiles, ...opts } = opts);\n }\n\n const result: PrivPartialConfig | undefined | null =\n yield* loadPrivatePartialConfig(opts);\n if (!result) return null;\n\n const { options, babelrc, ignore, config, fileHandling, files } = result;\n\n if (fileHandling === \"ignored\" && !showIgnoredFiles) {\n return null;\n }\n\n (options.plugins || []).forEach(item => {\n // @ts-expect-error todo(flow->ts): better type annotation for `item.value`\n if (item.value instanceof Plugin) {\n throw new Error(\n \"Passing cached plugin instances is not supported in \" +\n \"babel.loadPartialConfig()\",\n );\n }\n });\n\n return new PartialConfig(\n options,\n babelrc ? babelrc.filepath : undefined,\n ignore ? ignore.filepath : undefined,\n config ? config.filepath : undefined,\n fileHandling,\n files,\n );\n});\n\nexport type { PartialConfig };\n\nclass PartialConfig {\n /**\n * These properties are public, so any changes to them should be considered\n * a breaking change to Babel's API.\n */\n options: NormalizedOptions;\n babelrc: string | void;\n babelignore: string | void;\n config: string | void;\n fileHandling: FileHandling;\n files: Set;\n\n constructor(\n options: NormalizedOptions,\n babelrc: string | void,\n ignore: string | void,\n config: string | void,\n fileHandling: FileHandling,\n files: Set,\n ) {\n this.options = options;\n this.babelignore = ignore;\n this.babelrc = babelrc;\n this.config = config;\n this.fileHandling = fileHandling;\n this.files = files;\n\n // Freeze since this is a public API and it should be extremely obvious that\n // reassigning properties on here does nothing.\n Object.freeze(this);\n }\n\n /**\n * Returns true if there is a config file in the filesystem for this config.\n */\n hasFilesystemConfig(): boolean {\n return this.babelrc !== undefined || this.config !== undefined;\n }\n}\nObject.freeze(PartialConfig.prototype);\n"],"mappings":";;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAQA;;AAMA;;;;;;AAEA,SAASA,eAAT,CAAyBC,OAAzB,EAA0CC,QAA1C,EAAsE;EACpE,QAAQA,QAAR;IACE,KAAK,MAAL;MACE,OAAOD,OAAP;;IAEF,KAAK,iBAAL;MAAwB;QACtB,MAAME,aAAa,GAAG,IAAAC,wBAAA,EAAkBH,OAAlB,CAAtB;QACA,OAAOE,aAAa,KAAK,IAAlB,GAAyBF,OAAzB,GAAmCE,aAA1C;MACD;;IAED,KAAK,QAAL;MAAe;QACb,MAAMA,aAAa,GAAG,IAAAC,wBAAA,EAAkBH,OAAlB,CAAtB;QACA,IAAIE,aAAa,KAAK,IAAtB,EAA4B,OAAOA,aAAP;QAE5B,MAAME,MAAM,CAACC,MAAP,CACJ,IAAIC,KAAJ,CACG,4DAAD,GACG,wCAAuCN,OAAQ,MADlD,GAEG,mEAFH,GAGG,IAAGO,4BAAA,CAAsBC,IAAtB,CAA2B,IAA3B,CAAiC,IAJzC,CADI,EAOJ;UACEC,IAAI,EAAE,sBADR;UAEEC,OAAO,EAAEV;QAFX,CAPI,CAAN;MAYD;;IACD;MACE,MAAM,IAAIM,KAAJ,CAAW,6CAAX,CAAN;EA3BJ;AA6BD;;AAYc,UAAUK,wBAAV,CACbC,SADa,EAEsB;EACnC,IACEA,SAAS,IAAI,IAAb,KACC,OAAOA,SAAP,KAAqB,QAArB,IAAiCC,KAAK,CAACC,OAAN,CAAcF,SAAd,CADlC,CADF,EAGE;IACA,MAAM,IAAIN,KAAJ,CAAU,qDAAV,CAAN;EACD;;EAED,MAAMS,IAAI,GAAGH,SAAS,GAAG,IAAAI,iBAAA,EAAS,WAAT,EAAs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C,mBAAmB,GAAY;IAC7B,OAAO,KAAKzB,OAAL,KAAiBf,SAAjB,IAA8B,KAAK0B,MAAL,KAAgB1B,SAArD;EACD;;AArCiB;;AAuCpBxB,MAAM,CAAC+D,MAAP,CAAcJ,aAAa,CAACM,SAA5B"} \ No newline at end of file +{"version":3,"names":["resolveRootMode","rootDir","rootMode","upwardRootDir","findConfigUpwards","Object","assign","Error","ROOT_CONFIG_FILENAMES","join","code","dirname","loadPrivatePartialConfig","inputOpts","Array","isArray","args","validate","envName","getEnv","cwd","root","caller","cloneInputAst","absoluteCwd","path","resolve","absoluteRootDir","filename","undefined","showConfigPath","resolveShowConfigPath","context","showConfig","configChain","buildRootChain","merged","assumptions","options","forEach","opts","mergeOptions","targets","resolveTargets","babelrc","configFile","browserslistConfigFile","passPerPreset","plugins","map","descriptor","createItemFromDescriptor","presets","fileHandling","ignore","config","files","loadPartialConfig","gensync","showIgnoredFiles","result","item","value","Plugin","PartialConfig","filepath","constructor","babelignore","freeze","hasFilesystemConfig","prototype"],"sources":["../../src/config/partial.ts"],"sourcesContent":["import path from \"path\";\nimport gensync from \"gensync\";\nimport type { Handler } from \"gensync\";\nimport Plugin from \"./plugin\";\nimport { mergeOptions } from \"./util\";\nimport { createItemFromDescriptor } from \"./item\";\nimport { buildRootChain } from \"./config-chain\";\nimport type { ConfigContext, FileHandling } from \"./config-chain\";\nimport { getEnv } from \"./helpers/environment\";\nimport { validate } from \"./validation/options\";\n\nimport type {\n ValidatedOptions,\n NormalizedOptions,\n RootMode,\n} from \"./validation/options\";\n\nimport {\n findConfigUpwards,\n resolveShowConfigPath,\n ROOT_CONFIG_FILENAMES,\n} from \"./files\";\nimport type { ConfigFile, IgnoreFile } from \"./files\";\nimport { resolveTargets } from \"./resolve-targets\";\n\nfunction resolveRootMode(rootDir: string, rootMode: RootMode): string {\n switch (rootMode) {\n case \"root\":\n return rootDir;\n\n case \"upward-optional\": {\n const upwardRootDir = findConfigUpwards(rootDir);\n return upwardRootDir === null ? rootDir : upwardRootDir;\n }\n\n case \"upward\": {\n const upwardRootDir = findConfigUpwards(rootDir);\n if (upwardRootDir !== null) return upwardRootDir;\n\n throw Object.assign(\n new Error(\n `Babel was run with rootMode:\"upward\" but a root could not ` +\n `be found when searching upward from \"${rootDir}\".\\n` +\n `One of the following config files must be in the directory tree: ` +\n `\"${ROOT_CONFIG_FILENAMES.join(\", \")}\".`,\n ) as any,\n {\n code: \"BABEL_ROOT_NOT_FOUND\",\n dirname: rootDir,\n },\n );\n }\n default:\n throw new Error(`Assertion failure - unknown rootMode value.`);\n }\n}\n\ntype PrivPartialConfig = {\n options: NormalizedOptions;\n context: ConfigContext;\n fileHandling: FileHandling;\n ignore: IgnoreFile | void;\n babelrc: ConfigFile | void;\n config: ConfigFile | void;\n files: Set;\n};\n\nexport default function* loadPrivatePartialConfig(\n inputOpts: unknown,\n): Handler {\n if (\n inputOpts != null &&\n (typeof inputOpts !== \"object\" || Array.isArray(inputOpts))\n ) {\n throw new Error(\"Babel options must be an object, null, or undefined\");\n }\n\n const args = inputOpts ? validate(\"arguments\", inputOpts) : {};\n\n const {\n envName = getEnv(),\n cwd = \".\",\n root: rootDir = \".\",\n rootMode = \"root\",\n caller,\n cloneInputAst = true,\n } = args;\n const absoluteCwd = path.resolve(cwd);\n const absoluteRootDir = resolveRootMode(\n path.resolve(absoluteCwd, rootDir),\n rootMode,\n );\n\n const filename =\n typeof args.filename === \"string\"\n ? path.resolve(cwd, args.filename)\n : undefined;\n\n const showConfigPath = yield* resolveShowConfigPath(absoluteCwd);\n\n const context: ConfigContext = {\n filename,\n cwd: absoluteCwd,\n root: absoluteRootDir,\n envName,\n caller,\n showConfig: showConfigPath === filename,\n };\n\n const configChain = yield* buildRootChain(args, context);\n if (!configChain) return null;\n\n const merged: ValidatedOptions = {\n assumptions: {},\n };\n configChain.options.forEach(opts => {\n mergeOptions(merged as any, opts);\n });\n\n const options: NormalizedOptions = {\n ...merged,\n targets: resolveTargets(merged, absoluteRootDir),\n\n // Tack the passes onto the object itself so that, if this object is\n // passed back to Babel a second time, it will be in the right structure\n // to not change behavior.\n cloneInputAst,\n babelrc: false,\n configFile: false,\n browserslistConfigFile: false,\n passPerPreset: false,\n envName: context.envName,\n cwd: context.cwd,\n root: context.root,\n rootMode: \"root\",\n filename:\n typeof context.filename === \"string\" ? context.filename : undefined,\n\n plugins: configChain.plugins.map(descriptor =>\n createItemFromDescriptor(descriptor),\n ),\n presets: configChain.presets.map(descriptor =>\n createItemFromDescriptor(descriptor),\n ),\n };\n\n return {\n options,\n context,\n fileHandling: configChain.fileHandling,\n ignore: configChain.ignore,\n babelrc: configChain.babelrc,\n config: configChain.config,\n files: configChain.files,\n };\n}\n\ntype LoadPartialConfigOpts = {\n showIgnoredFiles?: boolean;\n};\n\nexport const loadPartialConfig = gensync(function* (\n opts?: LoadPartialConfigOpts,\n): Handler {\n let showIgnoredFiles = false;\n // We only extract showIgnoredFiles if opts is an object, so that\n // loadPrivatePartialConfig can throw the appropriate error if it's not.\n if (typeof opts === \"object\" && opts !== null && !Array.isArray(opts)) {\n ({ showIgnoredFiles, ...opts } = opts);\n }\n\n const result: PrivPartialConfig | undefined | null =\n yield* loadPrivatePartialConfig(opts);\n if (!result) return null;\n\n const { options, babelrc, ignore, config, fileHandling, files } = result;\n\n if (fileHandling === \"ignored\" && !showIgnoredFiles) {\n return null;\n }\n\n (options.plugins || []).forEach(item => {\n // @ts-expect-error todo(flow->ts): better type annotation for `item.value`\n if (item.value instanceof Plugin) {\n throw new Error(\n \"Passing cached plugin instances is not supported in \" +\n \"babel.loadPartialConfig()\",\n );\n }\n });\n\n return new PartialConfig(\n options,\n babelrc ? babelrc.filepath : undefined,\n ignore ? ignore.filepath : undefined,\n config ? config.filepath : undefined,\n fileHandling,\n files,\n );\n});\n\nexport type { PartialConfig };\n\nclass PartialConfig {\n /**\n * These properties are public, so any changes to them should be considered\n * a breaking change to Babel's API.\n */\n options: NormalizedOptions;\n babelrc: string | void;\n babelignore: string | void;\n config: string | void;\n fileHandling: FileHandling;\n files: Set;\n\n constructor(\n options: NormalizedOptions,\n babelrc: string | void,\n ignore: string | void,\n config: string | void,\n fileHandling: FileHandling,\n files: Set,\n ) {\n this.options = options;\n this.babelignore = ignore;\n this.babelrc = babelrc;\n this.config = config;\n this.fileHandling = fileHandling;\n this.files = files;\n\n // Freeze since this is a public API and it should be extremely obvious that\n // reassigning properties on here does nothing.\n Object.freeze(this);\n }\n\n /**\n * Returns true if there is a config file in the filesystem for this config.\n */\n hasFilesystemConfig(): boolean {\n return this.babelrc !== undefined || this.config !== undefined;\n }\n}\nObject.freeze(PartialConfig.prototype);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACA;AACA;AACA;AAEA;AACA;AAQA;AAMA;AAAmD;AAAA;AAEnD,SAASA,eAAe,CAACC,OAAe,EAAEC,QAAkB,EAAU;EACpE,QAAQA,QAAQ;IACd,KAAK,MAAM;MACT,OAAOD,OAAO;IAEhB,KAAK,iBAAiB;MAAE;QACtB,MAAME,aAAa,GAAG,IAAAC,wBAAiB,EAACH,OAAO,CAAC;QAChD,OAAOE,aAAa,KAAK,IAAI,GAAGF,OAAO,GAAGE,aAAa;MACzD;IAEA,KAAK,QAAQ;MAAE;QACb,MAAMA,aAAa,GAAG,IAAAC,wBAAiB,EAACH,OAAO,CAAC;QAChD,IAAIE,aAAa,KAAK,IAAI,EAAE,OAAOA,aAAa;QAEhD,MAAME,MAAM,CAACC,MAAM,CACjB,IAAIC,KAAK,CACN,4DAA2D,GACzD,wCAAuCN,OAAQ,MAAK,GACpD,mEAAkE,GAClE,IAAGO,4BAAqB,CAACC,IAAI,CAAC,IAAI,CAAE,IAAG,CAC3C,EACD;UACEC,IAAI,EAAE,sBAAsB;UAC5BC,OAAO,EAAEV;QACX,CAAC,CACF;MACH;IACA;MACE,MAAM,IAAIM,KAAK,CAAE,6CAA4C,CAAC;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AAO;IACtB,IAAI,CAAC6B,WAAW,GAAGb,MAAM;IACzB,IAAI,CAACV,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACW,MAAM,GAAGA,MAAM;IACpB,IAAI,CAACF,YAAY,GAAGA,YAAY;IAChC,IAAI,CAACG,KAAK,GAAGA,KAAK;;IAIlBnD,MAAM,CAAC+D,MAAM,CAAC,IAAI,CAAC;EACrB;;EAKAC,mBAAmB,GAAY;IAC7B,OAAO,IAAI,CAACzB,OAAO,KAAKf,SAAS,IAAI,IAAI,CAAC0B,MAAM,KAAK1B,SAAS;EAChE;AACF;AACAxB,MAAM,CAAC+D,MAAM,CAACJ,aAAa,CAACM,SAAS,CAAC;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/pattern-to-regex.js b/node_modules/@babel/core/lib/config/pattern-to-regex.js index f4408a249..73bfc1b62 100644 --- a/node_modules/@babel/core/lib/config/pattern-to-regex.js +++ b/node_modules/@babel/core/lib/config/pattern-to-regex.js @@ -4,17 +4,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = pathToPattern; - function _path() { const data = require("path"); - _path = function () { return data; }; - return data; } - const sep = `\\${_path().sep}`; const endSep = `(?:${sep}|$)`; const substitution = `[^${sep}]+`; @@ -22,17 +18,17 @@ const starPat = `(?:${substitution}${sep})`; const starPatLast = `(?:${substitution}${endSep})`; const starStarPat = `${starPat}*?`; const starStarPatLast = `${starPat}*?${starPatLast}?`; - function escapeRegExp(string) { return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&"); } function pathToPattern(pattern, dirname) { const parts = _path().resolve(dirname, pattern).split(_path().sep); - return new RegExp(["^", ...parts.map((part, i) => { const last = i === parts.length - 1; + if (part === "**") return last ? starStarPatLast : starStarPat; + if (part === "*") return last ? starPatLast : starPat; if (part.indexOf("*.") === 0) { @@ -42,7 +38,6 @@ function pathToPattern(pattern, dirname) { return escapeRegExp(part) + (last ? endSep : sep); })].join("")); } - 0 && 0; //# sourceMappingURL=pattern-to-regex.js.map diff --git a/node_modules/@babel/core/lib/config/pattern-to-regex.js.map b/node_modules/@babel/core/lib/config/pattern-to-regex.js.map index ba99f47e7..4b6a594f4 100644 --- a/node_modules/@babel/core/lib/config/pattern-to-regex.js.map +++ b/node_modules/@babel/core/lib/config/pattern-to-regex.js.map @@ -1 +1 @@ -{"version":3,"names":["sep","path","endSep","substitution","starPat","starPatLast","starStarPat","starStarPatLast","escapeRegExp","string","replace","pathToPattern","pattern","dirname","parts","resolve","split","RegExp","map","part","i","last","length","indexOf","slice","join"],"sources":["../../src/config/pattern-to-regex.ts"],"sourcesContent":["import path from \"path\";\n\nconst sep = `\\\\${path.sep}`;\nconst endSep = `(?:${sep}|$)`;\n\nconst substitution = `[^${sep}]+`;\n\nconst starPat = `(?:${substitution}${sep})`;\nconst starPatLast = `(?:${substitution}${endSep})`;\n\nconst starStarPat = `${starPat}*?`;\nconst starStarPatLast = `${starPat}*?${starPatLast}?`;\n\nfunction escapeRegExp(string: string) {\n return string.replace(/[|\\\\{}()[\\]^$+*?.]/g, \"\\\\$&\");\n}\n\n/**\n * Implement basic pattern matching that will allow users to do the simple\n * tests with * and **. If users want full complex pattern matching, then can\n * always use regex matching, or function validation.\n */\nexport default function pathToPattern(\n pattern: string,\n dirname: string,\n): RegExp {\n const parts = path.resolve(dirname, pattern).split(path.sep);\n\n return new RegExp(\n [\n \"^\",\n ...parts.map((part, i) => {\n const last = i === parts.length - 1;\n\n // ** matches 0 or more path parts.\n if (part === \"**\") return last ? starStarPatLast : starStarPat;\n\n // * matches 1 path part.\n if (part === \"*\") return last ? starPatLast : starPat;\n\n // *.ext matches a wildcard with an extension.\n if (part.indexOf(\"*.\") === 0) {\n return (\n substitution + escapeRegExp(part.slice(1)) + (last ? endSep : sep)\n );\n }\n\n // Otherwise match the pattern text.\n return escapeRegExp(part) + (last ? endSep : sep);\n }),\n ].join(\"\"),\n );\n}\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAA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YAAY,CAACW,IAAD,CAAZ,IAAsBE,IAAI,GAAGnB,MAAH,GAAYF,GAAtC,CAAP;EACD,CAlBE,CAFL,EAqBEyB,IArBF,CAqBO,EArBP,CADK,CAAP;AAwBD"} \ No newline at end of file +{"version":3,"names":["sep","path","endSep","substitution","starPat","starPatLast","starStarPat","starStarPatLast","escapeRegExp","string","replace","pathToPattern","pattern","dirname","parts","resolve","split","RegExp","map","part","i","last","length","indexOf","slice","join"],"sources":["../../src/config/pattern-to-regex.ts"],"sourcesContent":["import path from \"path\";\n\nconst sep = `\\\\${path.sep}`;\nconst endSep = `(?:${sep}|$)`;\n\nconst substitution = `[^${sep}]+`;\n\nconst starPat = `(?:${substitution}${sep})`;\nconst starPatLast = `(?:${substitution}${endSep})`;\n\nconst starStarPat = `${starPat}*?`;\nconst starStarPatLast = `${starPat}*?${starPatLast}?`;\n\nfunction escapeRegExp(string: string) {\n return string.replace(/[|\\\\{}()[\\]^$+*?.]/g, \"\\\\$&\");\n}\n\n/**\n * Implement basic pattern matching that will allow users to do the simple\n * tests with * and **. If users want full complex pattern matching, then can\n * always use regex matching, or function validation.\n */\nexport default function pathToPattern(\n pattern: string,\n dirname: string,\n): RegExp {\n const parts = path.resolve(dirname, pattern).split(path.sep);\n\n return new RegExp(\n [\n \"^\",\n ...parts.map((part, i) => {\n const last = i === parts.length - 1;\n\n // ** matches 0 or more path parts.\n if (part === \"**\") return last ? starStarPatLast : starStarPat;\n\n // * matches 1 path part.\n if (part === \"*\") return last ? starPatLast : starPat;\n\n // *.ext matches a wildcard with an extension.\n if (part.indexOf(\"*.\") === 0) {\n return (\n substitution + escapeRegExp(part.slice(1)) + (last ? endSep : sep)\n );\n }\n\n // Otherwise match the pattern text.\n return escapeRegExp(part) + (last ? endSep : sep);\n }),\n ].join(\"\"),\n );\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA,MAAMA,GAAG,GAAI,KAAIC,OAAI,CAACD,GAAI,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C,CAAC,CACH,CAACyB,IAAI,CAAC,EAAE,CAAC,CACX;AACH;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/plugin.js b/node_modules/@babel/core/lib/config/plugin.js index cefb645f1..58dcb0340 100644 --- a/node_modules/@babel/core/lib/config/plugin.js +++ b/node_modules/@babel/core/lib/config/plugin.js @@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; - var _deepArray = require("./helpers/deep-array"); - class Plugin { constructor(plugin, options, key, externalDependencies = (0, _deepArray.finalize)([])) { this.key = void 0; @@ -28,9 +26,7 @@ class Plugin { this.options = options; this.externalDependencies = externalDependencies; } - } - exports.default = Plugin; 0 && 0; diff --git a/node_modules/@babel/core/lib/config/plugin.js.map b/node_modules/@babel/core/lib/config/plugin.js.map index 92acd710f..2ad796173 100644 --- a/node_modules/@babel/core/lib/config/plugin.js.map +++ b/node_modules/@babel/core/lib/config/plugin.js.map @@ -1 +1 @@ -{"version":3,"names":["Plugin","constructor","plugin","options","key","externalDependencies","finalize","manipulateOptions","post","pre","visitor","parserOverride","generatorOverride","name"],"sources":["../../src/config/plugin.ts"],"sourcesContent":["import { finalize } from \"./helpers/deep-array\";\nimport type { ReadonlyDeepArray } from \"./helpers/deep-array\";\nimport type { PluginObject } from \"./validation/plugins\";\n\nexport default class Plugin {\n key: string | undefined | null;\n manipulateOptions?: (options: unknown, parserOpts: unknown) => void;\n post?: PluginObject[\"post\"];\n pre?: PluginObject[\"pre\"];\n visitor: PluginObject[\"visitor\"];\n\n parserOverride?: Function;\n generatorOverride?: Function;\n\n options: {};\n\n externalDependencies: ReadonlyDeepArray;\n\n constructor(\n plugin: PluginObject,\n options: {},\n key?: string,\n externalDependencies: ReadonlyDeepArray = finalize([]),\n ) {\n this.key = plugin.name || key;\n\n this.manipulateOptions = plugin.manipulateOptions;\n this.post = plugin.post;\n this.pre = plugin.pre;\n this.visitor = plugin.visitor || {};\n this.parserOverride = plugin.parserOverride;\n this.generatorOverride = plugin.generatorOverride;\n\n this.options = options;\n this.externalDependencies = externalDependencies;\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAIe,MAAMA,MAAN,CAAa;EAc1BC,WAAW,CACTC,MADS,EAETC,OAFS,EAGTC,GAHS,EAITC,oBAA+C,GAAG,IAAAC,mBAAA,EAAS,EAAT,CAJzC,EAKT;IAAA,KAlBFF,GAkBE;IAAA,KAjBFG,iBAiBE;IAAA,KAhBFC,IAgBE;IAAA,KAfFC,GAeE;IAAA,KAdFC,OAcE;IAAA,KAZFC,cAYE;IAAA,KAXFC,iBAWE;IAAA,KATFT,OASE;IAAA,KAPFE,oBAOE;IACA,KAAKD,GAAL,GAAWF,MAAM,CAACW,IAAP,IAAeT,GAA1B;IAEA,KAAKG,iBAAL,GAAyBL,MAAM,CAACK,iBAAhC;IACA,KAAKC,IAAL,GAAYN,MAAM,CAACM,IAAnB;IACA,KAAKC,GAAL,GAAWP,MAAM,CAACO,GAAlB;IACA,KAAKC,OAAL,GAAeR,MAAM,CAACQ,OAAP,IAAkB,EAAjC;IACA,KAAKC,cAAL,GAAsBT,MAAM,CAACS,cAA7B;IACA,KAAKC,iBAAL,GAAyBV,MAAM,CAACU,iBAAhC;IAEA,KAAKT,OAAL,GAAeA,OAAf;IACA,KAAKE,oBAAL,GAA4BA,oBAA5B;EACD;;AA/ByB"} \ No newline at end of file +{"version":3,"names":["Plugin","constructor","plugin","options","key","externalDependencies","finalize","manipulateOptions","post","pre","visitor","parserOverride","generatorOverride","name"],"sources":["../../src/config/plugin.ts"],"sourcesContent":["import { finalize } from \"./helpers/deep-array\";\nimport type { ReadonlyDeepArray } from \"./helpers/deep-array\";\nimport type { PluginObject } from \"./validation/plugins\";\n\nexport default class Plugin {\n key: string | undefined | null;\n manipulateOptions?: (options: unknown, parserOpts: unknown) => void;\n post?: PluginObject[\"post\"];\n pre?: PluginObject[\"pre\"];\n visitor: PluginObject[\"visitor\"];\n\n parserOverride?: Function;\n generatorOverride?: Function;\n\n options: {};\n\n externalDependencies: ReadonlyDeepArray;\n\n constructor(\n plugin: PluginObject,\n options: {},\n key?: string,\n externalDependencies: ReadonlyDeepArray = finalize([]),\n ) {\n this.key = plugin.name || key;\n\n this.manipulateOptions = plugin.manipulateOptions;\n this.post = plugin.post;\n this.pre = plugin.pre;\n this.visitor = plugin.visitor || {};\n this.parserOverride = plugin.parserOverride;\n this.generatorOverride = plugin.generatorOverride;\n\n this.options = options;\n this.externalDependencies = externalDependencies;\n }\n}\n"],"mappings":";;;;;;AAAA;AAIe,MAAMA,MAAM,CAAC;EAc1BC,WAAW,CACTC,MAAoB,EACpBC,OAAW,EACXC,GAAY,EACZC,oBAA+C,GAAG,IAAAC,mBAAQ,EAAC,EAAE,CAAC,EAC9D;IAAA,KAlBFF,GAAG;IAAA,KACHG,iBAAiB;IAAA,KACjBC,IAAI;IAAA,KACJC,GAAG;IAAA,KACHC,OAAO;IAAA,KAEPC,cAAc;IAAA,KACdC,iBAAiB;IAAA,KAEjBT,OAAO;IAAA,KAEPE,oBAAoB;IAQlB,IAAI,CAACD,GAAG,GAAGF,MAAM,CAACW,IAAI,IAAIT,GAAG;IAE7B,IAAI,CAACG,iBAAiB,GAAGL,MAAM,CAACK,iBAAiB;IACjD,IAAI,CAACC,IAAI,GAAGN,MAAM,CAACM,IAAI;IACvB,IAAI,CAACC,GAAG,GAAGP,MAAM,CAACO,GAAG;IACrB,IAAI,CAACC,OAAO,GAAGR,MAAM,CAACQ,OAAO,IAAI,CAAC,CAAC;IACnC,IAAI,CAACC,cAAc,GAAGT,MAAM,CAACS,cAAc;IAC3C,IAAI,CAACC,iBAAiB,GAAGV,MAAM,CAACU,iBAAiB;IAEjD,IAAI,CAACT,OAAO,GAAGA,OAAO;IACtB,IAAI,CAACE,oBAAoB,GAAGA,oBAAoB;EAClD;AACF;AAAC;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/printer.js b/node_modules/@babel/core/lib/config/printer.js index 58c97ac41..3fb9ced37 100644 --- a/node_modules/@babel/core/lib/config/printer.js +++ b/node_modules/@babel/core/lib/config/printer.js @@ -4,17 +4,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.ConfigPrinter = exports.ChainFormatter = void 0; - function _gensync() { const data = require("gensync"); - _gensync = function () { return data; }; - return data; } - const ChainFormatter = { Programmatic: 0, Config: 1 @@ -23,60 +19,44 @@ exports.ChainFormatter = ChainFormatter; const Formatter = { title(type, callerName, filepath) { let title = ""; - if (type === ChainFormatter.Programmatic) { title = "programmatic options"; - if (callerName) { title += " from " + callerName; } } else { title = "config " + filepath; } - return title; }, - loc(index, envName) { let loc = ""; - if (index != null) { loc += `.overrides[${index}]`; } - if (envName != null) { loc += `.env["${envName}"]`; } - return loc; }, - *optionsAndDescriptors(opt) { const content = Object.assign({}, opt.options); delete content.overrides; delete content.env; const pluginDescriptors = [...(yield* opt.plugins())]; - if (pluginDescriptors.length) { content.plugins = pluginDescriptors.map(d => descriptorToConfig(d)); } - const presetDescriptors = [...(yield* opt.presets())]; - if (presetDescriptors.length) { content.presets = [...presetDescriptors].map(d => descriptorToConfig(d)); } - return JSON.stringify(content, undefined, 2); } - }; - function descriptorToConfig(d) { var _d$file; - let name = (_d$file = d.file) == null ? void 0 : _d$file.request; - if (name == null) { if (typeof d.value === "object") { name = d.value; @@ -84,11 +64,9 @@ function descriptorToConfig(d) { name = `[Function: ${d.value.toString().slice(0, 50)} ... ]`; } } - if (name == null) { name = "[Unknown]"; } - if (d.options === undefined) { return name; } else if (d.name == null) { @@ -97,12 +75,10 @@ function descriptorToConfig(d) { return [name, d.options, d.name]; } } - class ConfigPrinter { constructor() { this._stack = []; } - configure(enabled, type, { callerName, filepath @@ -119,7 +95,6 @@ class ConfigPrinter { }); }; } - static *format(config) { let title = Formatter.title(config.type, config.callerName, config.filepath); const loc = Formatter.loc(config.index, config.envName); @@ -127,15 +102,12 @@ class ConfigPrinter { const content = yield* Formatter.optionsAndDescriptors(config.content); return `${title}\n${content}`; } - *output() { if (this._stack.length === 0) return ""; const configs = yield* _gensync().all(this._stack.map(s => ConfigPrinter.format(s))); return configs.join("\n\n"); } - } - exports.ConfigPrinter = ConfigPrinter; 0 && 0; diff --git a/node_modules/@babel/core/lib/config/printer.js.map b/node_modules/@babel/core/lib/config/printer.js.map index 10a771150..ae26f6a51 100644 --- a/node_modules/@babel/core/lib/config/printer.js.map +++ b/node_modules/@babel/core/lib/config/printer.js.map @@ -1 +1 @@ -{"version":3,"names":["ChainFormatter","Programmatic","Config","Formatter","title","type","callerName","filepath","loc","index","envName","optionsAndDescriptors","opt","content","options","overrides","env","pluginDescriptors","plugins","length","map","d","descriptorToConfig","presetDescriptors","presets","JSON","stringify","undefined","name","file","request","value","toString","slice","ConfigPrinter","_stack","configure","enabled","push","format","config","output","configs","gensync","all","s","join"],"sources":["../../src/config/printer.ts"],"sourcesContent":["import gensync from \"gensync\";\n\nimport type { Handler } from \"gensync\";\n\nimport type {\n OptionsAndDescriptors,\n UnloadedDescriptor,\n} from \"./config-descriptors\";\n\n// todo: Use flow enums when @babel/transform-flow-types supports it\nexport const ChainFormatter = {\n Programmatic: 0,\n Config: 1,\n};\n\ntype PrintableConfig = {\n content: OptionsAndDescriptors;\n type: typeof ChainFormatter[keyof typeof ChainFormatter];\n callerName: string | undefined | null;\n filepath: string | undefined | null;\n index: number | undefined | null;\n envName: string | undefined | null;\n};\n\nconst Formatter = {\n title(\n type: typeof ChainFormatter[keyof typeof ChainFormatter],\n callerName?: string | null,\n filepath?: string | null,\n ): string {\n let title = \"\";\n if (type === ChainFormatter.Programmatic) {\n title = \"programmatic options\";\n if (callerName) {\n title += \" from \" + callerName;\n }\n } else {\n title = \"config \" + filepath;\n }\n return title;\n },\n loc(index?: number | null, envName?: string | null): string {\n let loc = \"\";\n if (index != null) {\n loc += `.overrides[${index}]`;\n }\n if (envName != null) {\n loc += `.env[\"${envName}\"]`;\n }\n return loc;\n },\n\n *optionsAndDescriptors(opt: OptionsAndDescriptors) {\n const content = { ...opt.options };\n // overrides and env will be printed as separated config items\n delete content.overrides;\n delete content.env;\n // resolve to descriptors\n const pluginDescriptors = [...(yield* opt.plugins())];\n if (pluginDescriptors.length) {\n content.plugins = pluginDescriptors.map(d => descriptorToConfig(d));\n }\n const presetDescriptors = [...(yield* opt.presets())];\n if (presetDescriptors.length) {\n content.presets = [...presetDescriptors].map(d => descriptorToConfig(d));\n }\n return JSON.stringify(content, undefined, 2);\n },\n};\n\nfunction descriptorToConfig(\n d: UnloadedDescriptor,\n): string | {} | Array {\n let name = d.file?.request;\n if (name == null) {\n if (typeof d.value === \"object\") {\n name = d.value;\n } else if (typeof d.value === \"function\") {\n // If the unloaded descriptor is a function, i.e. `plugins: [ require(\"my-plugin\") ]`,\n // we print the first 50 characters of the function source code and hopefully we can see\n // `name: 'my-plugin'` in the source\n name = `[Function: ${d.value.toString().slice(0, 50)} ... ]`;\n }\n }\n if (name == null) {\n name = \"[Unknown]\";\n }\n if (d.options === undefined) {\n return name;\n } else if (d.name == null) {\n return [name, d.options];\n } else {\n return [name, d.options, d.name];\n }\n}\n\nexport class ConfigPrinter {\n _stack: Array = [];\n configure(\n enabled: boolean,\n type: typeof ChainFormatter[keyof typeof ChainFormatter],\n {\n callerName,\n filepath,\n }: {\n callerName?: string;\n filepath?: string;\n },\n ) {\n if (!enabled) return () => {};\n return (\n content: OptionsAndDescriptors,\n index?: number | null,\n envName?: string | null,\n ) => {\n this._stack.push({\n type,\n callerName,\n filepath,\n content,\n index,\n envName,\n });\n };\n }\n static *format(config: PrintableConfig): Handler {\n let title = Formatter.title(\n config.type,\n config.callerName,\n config.filepath,\n );\n const loc = Formatter.loc(config.index, config.envName);\n if (loc) title += ` ${loc}`;\n const content = yield* Formatter.optionsAndDescriptors(config.content);\n return `${title}\\n${content}`;\n }\n\n *output(): Handler {\n if (this._stack.length === 0) return \"\";\n const configs = yield* gensync.all(\n this._stack.map(s => ConfigPrinter.format(s)),\n );\n return configs.join(\"\\n\\n\");\n }\n}\n"],"mappings":";;;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F;IAEEC;EAFF,CAHO,EAUP;IACA,IAAI,CAAC8B,OAAL,EAAc,OAAO,MAAM,CAAE,CAAf;IACd,OAAO,CACLxB,OADK,EAELJ,KAFK,EAGLC,OAHK,KAIF;MACH,KAAKyB,MAAL,CAAYG,IAAZ,CAAiB;QACfjC,IADe;QAEfC,UAFe;QAGfC,QAHe;QAIfM,OAJe;QAKfJ,KALe;QAMfC;MANe,CAAjB;IAQD,CAbD;EAcD;;EACa,QAAN6B,MAAM,CAACC,MAAD,EAA2C;IACvD,IAAIpC,KAAK,GAAGD,SAAS,CAACC,KAAV,CACVoC,MAAM,CAACnC,IADG,EAEVmC,MAAM,CAAClC,UAFG,EAGVkC,MAAM,CAACjC,QAHG,CAAZ;IAKA,MAAMC,GAAG,GAAGL,SAAS,CAACK,GAAV,CAAcgC,MAAM,CAAC/B,KAArB,EAA4B+B,MAAM,CAAC9B,OAAnC,CAAZ;IACA,IAAIF,GAAJ,EAASJ,KAAK,IAAK,IAAGI,GAAI,EAAjB;IACT,MAAMK,OAAO,GAAG,OAAOV,SAAS,CAACQ,qBAAV,CAAgC6B,MAAM,CAAC3B,OAAvC,CAAvB;IACA,OAAQ,GAAET,KAAM,KAAIS,OAAQ,EAA5B;EACD;;EAEM,CAAN4B,MAAM,GAAoB;IACzB,IAAI,KAAKN,MAAL,CAAYhB,MAAZ,KAAuB,CAA3B,EAA8B,OAAO,EAAP;IAC9B,MAAMuB,OAAO,GAAG,OAAOC,UAAA,CAAQC,GAAR,CACrB,KAAKT,MAAL,CAAYf,GAAZ,CAAgByB,CAAC,IAAIX,aAAa,CAACK,MAAd,CAAqBM,CAArB,CAArB,CADqB,CAAvB;IAGA,OAAOH,OAAO,CAACI,IAAR,CAAa,MAAb,CAAP;EACD;;AA/CwB"} \ No newline at end of file +{"version":3,"names":["ChainFormatter","Programmatic","Config","Formatter","title","type","callerName","filepath","loc","index","envName","optionsAndDescriptors","opt","content","options","overrides","env","pluginDescriptors","plugins","length","map","d","descriptorToConfig","presetDescriptors","presets","JSON","stringify","undefined","name","file","request","value","toString","slice","ConfigPrinter","_stack","configure","enabled","push","format","config","output","configs","gensync","all","s","join"],"sources":["../../src/config/printer.ts"],"sourcesContent":["import gensync from \"gensync\";\n\nimport type { Handler } from \"gensync\";\n\nimport type {\n OptionsAndDescriptors,\n UnloadedDescriptor,\n} from \"./config-descriptors\";\n\n// todo: Use flow enums when @babel/transform-flow-types supports it\nexport const ChainFormatter = {\n Programmatic: 0,\n Config: 1,\n};\n\ntype PrintableConfig = {\n content: OptionsAndDescriptors;\n type: typeof ChainFormatter[keyof typeof ChainFormatter];\n callerName: string | undefined | null;\n filepath: string | undefined | null;\n index: number | undefined | null;\n envName: string | undefined | null;\n};\n\nconst Formatter = {\n title(\n type: typeof ChainFormatter[keyof typeof ChainFormatter],\n callerName?: string | null,\n filepath?: string | null,\n ): string {\n let title = \"\";\n if (type === ChainFormatter.Programmatic) {\n title = \"programmatic options\";\n if (callerName) {\n title += \" from \" + callerName;\n }\n } else {\n title = \"config \" + filepath;\n }\n return title;\n },\n loc(index?: number | null, envName?: string | null): string {\n let loc = \"\";\n if (index != null) {\n loc += `.overrides[${index}]`;\n }\n if (envName != null) {\n loc += `.env[\"${envName}\"]`;\n }\n return loc;\n },\n\n *optionsAndDescriptors(opt: OptionsAndDescriptors) {\n const content = { ...opt.options };\n // overrides and env will be printed as separated config items\n delete content.overrides;\n delete content.env;\n // resolve to descriptors\n const pluginDescriptors = [...(yield* opt.plugins())];\n if (pluginDescriptors.length) {\n content.plugins = pluginDescriptors.map(d => descriptorToConfig(d));\n }\n const presetDescriptors = [...(yield* opt.presets())];\n if (presetDescriptors.length) {\n content.presets = [...presetDescriptors].map(d => descriptorToConfig(d));\n }\n return JSON.stringify(content, undefined, 2);\n },\n};\n\nfunction descriptorToConfig(\n d: UnloadedDescriptor,\n): string | {} | Array {\n let name = d.file?.request;\n if (name == null) {\n if (typeof d.value === \"object\") {\n name = d.value;\n } else if (typeof d.value === \"function\") {\n // If the unloaded descriptor is a function, i.e. `plugins: [ require(\"my-plugin\") ]`,\n // we print the first 50 characters of the function source code and hopefully we can see\n // `name: 'my-plugin'` in the source\n name = `[Function: ${d.value.toString().slice(0, 50)} ... ]`;\n }\n }\n if (name == null) {\n name = \"[Unknown]\";\n }\n if (d.options === undefined) {\n return name;\n } else if (d.name == null) {\n return [name, d.options];\n } else {\n return [name, d.options, d.name];\n }\n}\n\nexport class ConfigPrinter {\n _stack: Array = [];\n configure(\n enabled: boolean,\n type: typeof ChainFormatter[keyof typeof ChainFormatter],\n {\n callerName,\n filepath,\n }: {\n callerName?: string;\n filepath?: string;\n },\n ) {\n if (!enabled) return () => {};\n return (\n content: OptionsAndDescriptors,\n index?: number | null,\n envName?: string | null,\n ) => {\n this._stack.push({\n type,\n callerName,\n filepath,\n content,\n index,\n envName,\n });\n };\n }\n static *format(config: PrintableConfig): Handler {\n let title = Formatter.title(\n config.type,\n config.callerName,\n config.filepath,\n );\n const loc = Formatter.loc(config.index, config.envName);\n if (loc) title += ` ${loc}`;\n const content = yield* Formatter.optionsAndDescriptors(config.content);\n return `${title}\\n${content}`;\n }\n\n *output(): Handler {\n if (this._stack.length === 0) return \"\";\n const configs = yield* gensync.all(\n this._stack.map(s => ConfigPrinter.format(s)),\n );\n return configs.join(\"\\n\\n\");\n }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAUO,MAAMA,cAAc,GAAG;EAC5BC,YAAY,EAAE,CAAC;EACfC,MAAM,EAAE;AACV,CAAC;AAAC;AAWF,MAAMC,SAAS,GAAG;EAChBC,KAAK,CACHC,IAAwD,EACxDC,UAA0B,EAC1BC,QAAwB,EAChB;IACR,IAAIH,KAAK,GAAG,EAAE;IACd,IAAIC,IAAI,KAAKL,cAAc,CAACC,YAAY,EAAE;MACxCG,KAAK,GAAG,sBAAsB;MAC9B,IAAIE,UAAU,EAAE;QACdF,KAAK,IAAI,QAAQ,GAAGE,UAAU;MAChC;IACF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M,CAACjC,QAAQ,CAChB;IACD,MAAMC,GAAG,GAAGL,SAAS,CAACK,GAAG,CAACgC,MAAM,CAAC/B,KAAK,EAAE+B,MAAM,CAAC9B,OAAO,CAAC;IACvD,IAAIF,GAAG,EAAEJ,KAAK,IAAK,IAAGI,GAAI,EAAC;IAC3B,MAAMK,OAAO,GAAG,OAAOV,SAAS,CAACQ,qBAAqB,CAAC6B,MAAM,CAAC3B,OAAO,CAAC;IACtE,OAAQ,GAAET,KAAM,KAAIS,OAAQ,EAAC;EAC/B;EAEA,CAAC4B,MAAM,GAAoB;IACzB,IAAI,IAAI,CAACN,MAAM,CAAChB,MAAM,KAAK,CAAC,EAAE,OAAO,EAAE;IACvC,MAAMuB,OAAO,GAAG,OAAOC,UAAO,CAACC,GAAG,CAChC,IAAI,CAACT,MAAM,CAACf,GAAG,CAACyB,CAAC,IAAIX,aAAa,CAACK,MAAM,CAACM,CAAC,CAAC,CAAC,CAC9C;IACD,OAAOH,OAAO,CAACI,IAAI,CAAC,MAAM,CAAC;EAC7B;AACF;AAAC;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/resolve-targets-browser.js b/node_modules/@babel/core/lib/config/resolve-targets-browser.js index 8a81905af..d2c2aa3cf 100644 --- a/node_modules/@babel/core/lib/config/resolve-targets-browser.js +++ b/node_modules/@babel/core/lib/config/resolve-targets-browser.js @@ -5,25 +5,22 @@ Object.defineProperty(exports, "__esModule", { }); exports.resolveBrowserslistConfigFile = resolveBrowserslistConfigFile; exports.resolveTargets = resolveTargets; - function _helperCompilationTargets() { const data = require("@babel/helper-compilation-targets"); - _helperCompilationTargets = function () { return data; }; - return data; } - -function resolveBrowserslistConfigFile(browserslistConfigFile, configFilePath) { +function resolveBrowserslistConfigFile( +browserslistConfigFile, +configFilePath) { return undefined; } - -function resolveTargets(options, root) { +function resolveTargets(options, +root) { const optTargets = options.targets; let targets; - if (typeof optTargets === "string" || Array.isArray(optTargets)) { targets = { browsers: optTargets @@ -37,13 +34,11 @@ function resolveTargets(options, root) { targets = optTargets; } } - return (0, _helperCompilationTargets().default)(targets, { ignoreBrowserslistConfig: true, browserslistEnv: options.browserslistEnv }); } - 0 && 0; //# sourceMappingURL=resolve-targets-browser.js.map diff --git a/node_modules/@babel/core/lib/config/resolve-targets-browser.js.map b/node_modules/@babel/core/lib/config/resolve-targets-browser.js.map index 1e8a7e02b..986bfef80 100644 --- a/node_modules/@babel/core/lib/config/resolve-targets-browser.js.map +++ b/node_modules/@babel/core/lib/config/resolve-targets-browser.js.map @@ -1 +1 @@ -{"version":3,"names":["resolveBrowserslistConfigFile","browserslistConfigFile","configFilePath","undefined","resolveTargets","options","root","optTargets","targets","Array","isArray","browsers","esmodules","getTargets","ignoreBrowserslistConfig","browserslistEnv"],"sources":["../../src/config/resolve-targets-browser.ts"],"sourcesContent":["import type { ValidatedOptions } from \"./validation/options\";\nimport getTargets, {\n type InputTargets,\n} from \"@babel/helper-compilation-targets\";\n\nimport type { Targets } from \"@babel/helper-compilation-targets\";\n\nexport function resolveBrowserslistConfigFile(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n browserslistConfigFile: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n configFilePath: string,\n): string | void {\n return undefined;\n}\n\nexport function resolveTargets(\n options: ValidatedOptions,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n root: string,\n): Targets {\n const optTargets = options.targets;\n let targets: InputTargets;\n\n if (typeof optTargets === \"string\" || Array.isArray(optTargets)) {\n targets = { browsers: optTargets };\n } else if (optTargets) {\n if (\"esmodules\" in optTargets) {\n targets = { ...optTargets, esmodules: \"intersect\" };\n } else {\n // https://github.com/microsoft/TypeScript/issues/17002\n targets = optTargets as InputTargets;\n }\n }\n\n return getTargets(targets, {\n ignoreBrowserslistConfig: true,\n browserslistEnv: options.browserslistEnv,\n });\n}\n"],"mappings":";;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAMO,SAASA,6BAAT,CAELC,sBAFK,EAILC,cAJK,EAKU;EACf,OAAOC,SAAP;AACD;;AAEM,SAASC,cAAT,CACLC,OADK,EAGLC,IAHK,EAII;EACT,MAAMC,UAAU,GAAGF,OAAO,CAACG,OAA3B;EACA,IAAIA,OAAJ;;EAEA,IAAI,OAAOD,UAAP,KAAsB,QAAtB,IAAkCE,KAAK,CAACC,OAAN,CAAcH,UAAd,CAAtC,EAAiE;IAC/DC,OAAO,GAAG;MAAEG,QAAQ,EAAEJ;IAAZ,CAAV;EACD,CAFD,MAEO,IAAIA,UAAJ,EAAgB;IACrB,IAAI,eAAeA,UAAnB,EAA+B;MAC7BC,OAAO,qBAAQD,UAAR;QAAoBK,SAAS,EAAE;MAA/B,EAAP;IACD,CAFD,MAEO;MAELJ,OAAO,GAAGD,UAAV;IACD;EACF;;EAED,OAAO,IAAAM,mCAAA,EAAWL,OAAX,EAAoB;IACzBM,wBAAwB,EAAE,IADD;IAEzBC,eAAe,EAAEV,OAAO,CAACU;EAFA,CAApB,CAAP;AAID"} \ No newline at end of file +{"version":3,"names":["resolveBrowserslistConfigFile","browserslistConfigFile","configFilePath","undefined","resolveTargets","options","root","optTargets","targets","Array","isArray","browsers","esmodules","getTargets","ignoreBrowserslistConfig","browserslistEnv"],"sources":["../../src/config/resolve-targets-browser.ts"],"sourcesContent":["import type { ValidatedOptions } from \"./validation/options\";\nimport getTargets, {\n type InputTargets,\n} from \"@babel/helper-compilation-targets\";\n\nimport type { Targets } from \"@babel/helper-compilation-targets\";\n\nexport function resolveBrowserslistConfigFile(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n browserslistConfigFile: string,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n configFilePath: string,\n): string | void {\n return undefined;\n}\n\nexport function resolveTargets(\n options: ValidatedOptions,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n root: string,\n): Targets {\n const optTargets = options.targets;\n let targets: InputTargets;\n\n if (typeof optTargets === \"string\" || Array.isArray(optTargets)) {\n targets = { browsers: optTargets };\n } else if (optTargets) {\n if (\"esmodules\" in optTargets) {\n targets = { ...optTargets, esmodules: \"intersect\" };\n } else {\n // https://github.com/microsoft/TypeScript/issues/17002\n targets = optTargets as InputTargets;\n }\n }\n\n return getTargets(targets, {\n ignoreBrowserslistConfig: true,\n browserslistEnv: options.browserslistEnv,\n });\n}\n"],"mappings":";;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAMO,SAASA,6BAA6B;AAE3CC,sBAA8B;AAE9BC,cAAsB,EACP;EACf,OAAOC,SAAS;AAClB;AAEO,SAASC,cAAc,CAC5BC,OAAyB;AAEzBC,IAAY,EACH;EACT,MAAMC,UAAU,GAAGF,OAAO,CAACG,OAAO;EAClC,IAAIA,OAAqB;EAEzB,IAAI,OAAOD,UAAU,KAAK,QAAQ,IAAIE,KAAK,CAACC,OAAO,CAACH,UAAU,CAAC,EAAE;IAC/DC,OAAO,GAAG;MAAEG,QAAQ,EAAEJ;IAAW,CAAC;EACpC,CAAC,MAAM,IAAIA,UAAU,EAAE;IACrB,IAAI,WAAW,IAAIA,UAAU,EAAE;MAC7BC,OAAO,qBAAQD,UAAU;QAAEK,SAAS,EAAE;MAAW,EAAE;IACrD,CAAC,MAAM;MAELJ,OAAO,GAAGD,UAA0B;IACtC;EACF;EAEA,OAAO,IAAAM,mCAAU,EAACL,OAAO,EAAE;IACzBM,wBAAwB,EAAE,IAAI;IAC9BC,eAAe,EAAEV,OAAO,CAACU;EAC3B,CAAC,CAAC;AACJ;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/resolve-targets.js b/node_modules/@babel/core/lib/config/resolve-targets.js index a08d3ab4b..1fc539a77 100644 --- a/node_modules/@babel/core/lib/config/resolve-targets.js +++ b/node_modules/@babel/core/lib/config/resolve-targets.js @@ -5,37 +5,27 @@ Object.defineProperty(exports, "__esModule", { }); exports.resolveBrowserslistConfigFile = resolveBrowserslistConfigFile; exports.resolveTargets = resolveTargets; - function _path() { const data = require("path"); - _path = function () { return data; }; - return data; } - function _helperCompilationTargets() { const data = require("@babel/helper-compilation-targets"); - _helperCompilationTargets = function () { return data; }; - return data; } - ({}); - function resolveBrowserslistConfigFile(browserslistConfigFile, configFileDir) { return _path().resolve(configFileDir, browserslistConfigFile); } - function resolveTargets(options, root) { const optTargets = options.targets; let targets; - if (typeof optTargets === "string" || Array.isArray(optTargets)) { targets = { browsers: optTargets @@ -49,19 +39,16 @@ function resolveTargets(options, root) { targets = optTargets; } } - const { browserslistConfigFile } = options; let configFile; let ignoreBrowserslistConfig = false; - if (typeof browserslistConfigFile === "string") { configFile = browserslistConfigFile; } else { ignoreBrowserslistConfig = browserslistConfigFile === false; } - return (0, _helperCompilationTargets().default)(targets, { ignoreBrowserslistConfig, configFile, @@ -69,7 +56,6 @@ function resolveTargets(options, root) { browserslistEnv: options.browserslistEnv }); } - 0 && 0; //# sourceMappingURL=resolve-targets.js.map diff --git a/node_modules/@babel/core/lib/config/resolve-targets.js.map b/node_modules/@babel/core/lib/config/resolve-targets.js.map index e0b2f04df..f3059fe52 100644 --- a/node_modules/@babel/core/lib/config/resolve-targets.js.map +++ b/node_modules/@babel/core/lib/config/resolve-targets.js.map @@ -1 +1 @@ -{"version":3,"names":["resolveBrowserslistConfigFile","browserslistConfigFile","configFileDir","path","resolve","resolveTargets","options","root","optTargets","targets","Array","isArray","browsers","esmodules","configFile","ignoreBrowserslistConfig","getTargets","configPath","browserslistEnv"],"sources":["../../src/config/resolve-targets.ts"],"sourcesContent":["type browserType = typeof import(\"./resolve-targets-browser\");\ntype nodeType = typeof import(\"./resolve-targets\");\n\n// Kind of gross, but essentially asserting that the exports of this module are the same as the\n// exports of index-browser, since this file may be replaced at bundle time with index-browser.\n({} as any as browserType as nodeType);\n\nimport type { ValidatedOptions } from \"./validation/options\";\nimport path from \"path\";\nimport getTargets, {\n type InputTargets,\n} from \"@babel/helper-compilation-targets\";\n\nimport type { Targets } from \"@babel/helper-compilation-targets\";\n\nexport function resolveBrowserslistConfigFile(\n browserslistConfigFile: string,\n configFileDir: string,\n): string | undefined {\n return path.resolve(configFileDir, browserslistConfigFile);\n}\n\nexport function resolveTargets(\n options: ValidatedOptions,\n root: string,\n): Targets {\n const optTargets = options.targets;\n let targets: InputTargets;\n\n if (typeof optTargets === \"string\" || Array.isArray(optTargets)) {\n targets = { browsers: optTargets };\n } else if (optTargets) {\n if (\"esmodules\" in optTargets) {\n targets = { ...optTargets, esmodules: \"intersect\" };\n } else {\n // https://github.com/microsoft/TypeScript/issues/17002\n targets = optTargets as InputTargets;\n }\n }\n\n const { browserslistConfigFile } = options;\n let configFile;\n let ignoreBrowserslistConfig = false;\n if (typeof browserslistConfigFile === \"string\") {\n configFile = browserslistConfigFile;\n } else {\n ignoreBrowserslistConfig = browserslistConfigFile === false;\n }\n\n return getTargets(targets, {\n ignoreBrowserslistConfig,\n configFile,\n configPath: root,\n browserslistEnv: options.browserslistEnv,\n });\n}\n"],"mappings":";;;;;;;;AAQA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAJA,CAAC,EAAD;;AAUO,SAASA,6BAAT,CACLC,sBADK,EAELC,aAFK,EAGe;EACpB,OAAOC,OAAA,CAAKC,OAAL,CAAaF,aAAb,EAA4BD,sBAA5B,CAAP;AACD;;AAEM,SAASI,cAAT,CACLC,OADK,EAELC,IAFK,EAGI;EACT,MAAMC,UAAU,GAAGF,OAAO,CAACG,OAA3B;EACA,IAAIA,OAAJ;;EAEA,IAAI,OAAOD,UAAP,KAAsB,QAAtB,IAAkCE,KAAK,CAACC,OAAN,CAAcH,UAAd,CAAtC,EAAiE;IAC/DC,OAAO,GAAG;MAAEG,QAAQ,EAAEJ;IAAZ,CAAV;EACD,CAFD,MAEO,IAAIA,UAAJ,EAAgB;IACrB,IAAI,eAAeA,UAAnB,EAA+B;MAC7BC,OAAO,qBAAQD,UAAR;QAAoBK,SAAS,EAAE;MAA/B,EAAP;IACD,CAFD,MAEO;MAELJ,OAAO,GAAGD,UAAV;IACD;EACF;;EAED,MAAM;IAAEP;EAAF,IAA6BK,OAAnC;EACA,IAAIQ,UAAJ;EACA,IAAIC,wBAAwB,GAAG,KAA/B;;EACA,IAAI,OAAOd,sBAAP,KAAkC,QAAtC,EAAgD;IAC9Ca,UAAU,GAAGb,sBAAb;EACD,CAFD,MAEO;IACLc,wBAAwB,GAAGd,sBAAsB,KAAK,KAAtD;EACD;;EAED,OAAO,IAAAe,mCAAA,EAAWP,OAAX,EAAoB;IACzBM,wBADyB;IAEzBD,UAFyB;IAGzBG,UAAU,EAAEV,IAHa;IAIzBW,eAAe,EAAEZ,OAAO,CAACY;EAJA,CAApB,CAAP;AAMD"} \ No newline at end of file +{"version":3,"names":["resolveBrowserslistConfigFile","browserslistConfigFile","configFileDir","path","resolve","resolveTargets","options","root","optTargets","targets","Array","isArray","browsers","esmodules","configFile","ignoreBrowserslistConfig","getTargets","configPath","browserslistEnv"],"sources":["../../src/config/resolve-targets.ts"],"sourcesContent":["type browserType = typeof import(\"./resolve-targets-browser\");\ntype nodeType = typeof import(\"./resolve-targets\");\n\n// Kind of gross, but essentially asserting that the exports of this module are the same as the\n// exports of index-browser, since this file may be replaced at bundle time with index-browser.\n({} as any as browserType as nodeType);\n\nimport type { ValidatedOptions } from \"./validation/options\";\nimport path from \"path\";\nimport getTargets, {\n type InputTargets,\n} from \"@babel/helper-compilation-targets\";\n\nimport type { Targets } from \"@babel/helper-compilation-targets\";\n\nexport function resolveBrowserslistConfigFile(\n browserslistConfigFile: string,\n configFileDir: string,\n): string | undefined {\n return path.resolve(configFileDir, browserslistConfigFile);\n}\n\nexport function resolveTargets(\n options: ValidatedOptions,\n root: string,\n): Targets {\n const optTargets = options.targets;\n let targets: InputTargets;\n\n if (typeof optTargets === \"string\" || Array.isArray(optTargets)) {\n targets = { browsers: optTargets };\n } else if (optTargets) {\n if (\"esmodules\" in optTargets) {\n targets = { ...optTargets, esmodules: \"intersect\" };\n } else {\n // https://github.com/microsoft/TypeScript/issues/17002\n targets = optTargets as InputTargets;\n }\n }\n\n const { browserslistConfigFile } = options;\n let configFile;\n let ignoreBrowserslistConfig = false;\n if (typeof browserslistConfigFile === \"string\") {\n configFile = browserslistConfigFile;\n } else {\n ignoreBrowserslistConfig = browserslistConfigFile === false;\n }\n\n return getTargets(targets, {\n ignoreBrowserslistConfig,\n configFile,\n configPath: root,\n browserslistEnv: options.browserslistEnv,\n });\n}\n"],"mappings":";;;;;;;AAQA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAJA,CAAC,CAAC,CAAC;AAUI,SAASA,6BAA6B,CAC3CC,sBAA8B,EAC9BC,aAAqB,EACD;EACpB,OAAOC,OAAI,CAACC,OAAO,CAACF,aAAa,EAAED,sBAAsB,CAAC;AAC5D;AAEO,SAASI,cAAc,CAC5BC,OAAyB,EACzBC,IAAY,EACH;EACT,MAAMC,UAAU,GAAGF,OAAO,CAACG,OAAO;EAClC,IAAIA,OAAqB;EAEzB,IAAI,OAAOD,UAAU,KAAK,QAAQ,IAAIE,KAAK,CAACC,OAAO,CAACH,UAAU,CAAC,EAAE;IAC/DC,OAAO,GAAG;MAAEG,QAAQ,EAAEJ;IAAW,CAAC;EACpC,CAAC,MAAM,IAAIA,UAAU,EAAE;IACrB,IAAI,WAAW,IAAIA,UAAU,EAAE;MAC7BC,OAAO,qBAAQD,UAAU;QAAEK,SAAS,EAAE;MAAW,EAAE;IACrD,CAAC,MAAM;MAELJ,OAAO,GAAGD,UAA0B;IACtC;EACF;EAEA,MAAM;IAAEP;EAAuB,CAAC,GAAGK,OAAO;EAC1C,IAAIQ,UAAU;EACd,IAAIC,wBAAwB,GAAG,KAAK;EACpC,IAAI,OAAOd,sBAAsB,KAAK,QAAQ,EAAE;IAC9Ca,UAAU,GAAGb,sBAAsB;EACrC,CAAC,MAAM;IACLc,wBAAwB,GAAGd,sBAAsB,KAAK,KAAK;EAC7D;EAEA,OAAO,IAAAe,mCAAU,EAACP,OAAO,EAAE;IACzBM,wBAAwB;IACxBD,UAAU;IACVG,UAAU,EAAEV,IAAI;IAChBW,eAAe,EAAEZ,OAAO,CAACY;EAC3B,CAAC,CAAC;AACJ;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/util.js b/node_modules/@babel/core/lib/config/util.js index 0e039e99c..077f1af8c 100644 --- a/node_modules/@babel/core/lib/config/util.js +++ b/node_modules/@babel/core/lib/config/util.js @@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", { }); exports.isIterableIterator = isIterableIterator; exports.mergeOptions = mergeOptions; - function mergeOptions(target, source) { for (const k of Object.keys(source)) { if ((k === "parserOpts" || k === "generatorOpts" || k === "assumptions") && source[k]) { @@ -18,18 +17,15 @@ function mergeOptions(target, source) { } } } - function mergeDefaultFields(target, source) { for (const k of Object.keys(source)) { const val = source[k]; if (val !== undefined) target[k] = val; } } - function isIterableIterator(value) { return !!value && typeof value.next === "function" && typeof value[Symbol.iterator] === "function"; } - 0 && 0; //# sourceMappingURL=util.js.map diff --git a/node_modules/@babel/core/lib/config/util.js.map b/node_modules/@babel/core/lib/config/util.js.map index 65ae59bae..4157eca2c 100644 --- a/node_modules/@babel/core/lib/config/util.js.map +++ b/node_modules/@babel/core/lib/config/util.js.map @@ -1 +1 @@ -{"version":3,"names":["mergeOptions","target","source","k","Object","keys","parserOpts","targetObj","mergeDefaultFields","val","undefined","isIterableIterator","value","next","Symbol","iterator"],"sources":["../../src/config/util.ts"],"sourcesContent":["import type { ValidatedOptions, NormalizedOptions } from \"./validation/options\";\n\nexport function mergeOptions(\n target: ValidatedOptions,\n source: ValidatedOptions | NormalizedOptions,\n): void {\n for (const k of Object.keys(source)) {\n if (\n (k === \"parserOpts\" || k === \"generatorOpts\" || k === \"assumptions\") &&\n source[k]\n ) {\n const parserOpts = source[k];\n const targetObj = target[k] || (target[k] = {});\n mergeDefaultFields(targetObj, parserOpts);\n } else {\n //@ts-expect-error k must index source\n const val = source[k];\n //@ts-expect-error assigning source to target\n if (val !== undefined) target[k] = val as any;\n }\n }\n}\n\nfunction mergeDefaultFields(target: T, source: T) {\n for (const k of Object.keys(source) as (keyof T)[]) {\n const val = source[k];\n if (val !== undefined) target[k] = val;\n }\n}\n\nexport function isIterableIterator(value: any): value is IterableIterator {\n return (\n !!value &&\n typeof value.next === \"function\" &&\n typeof value[Symbol.iterator] === \"function\"\n );\n}\n"],"mappings":";;;;;;;;AAEO,SAASA,YAAT,CACLC,MADK,EAELC,MAFK,EAGC;EACN,KAAK,MAAMC,CAAX,IAAgBC,MAAM,CAACC,IAAP,CAAYH,MAAZ,CAAhB,EAAqC;IACnC,IACE,CAACC,CAAC,KAAK,YAAN,IAAsBA,CAAC,KAAK,eAA5B,IAA+CA,CAAC,KAAK,aAAtD,KACAD,MAAM,CAACC,CAAD,CAFR,EAGE;MACA,MAAMG,UAAU,GAAGJ,MAAM,CAACC,CAAD,CAAzB;MACA,MAAMI,SAAS,GAAGN,MAAM,CAACE,CAAD,CAAN,KAAcF,MAAM,CAACE,CAAD,CAAN,GAAY,EAA1B,CAAlB;MACAK,kBAAkB,CAACD,SAAD,EAAYD,UAAZ,CAAlB;IACD,CAPD,MAOO;MAEL,MAAMG,GAAG,GAAGP,MAAM,CAACC,CAAD,CAAlB;MAEA,IAAIM,GAAG,KAAKC,SAAZ,EAAuBT,MAAM,CAACE,CAAD,CAAN,GAAYM,GAAZ;IACxB;EACF;AACF;;AAED,SAASD,kBAAT,CAA0CP,MAA1C,EAAqDC,MAArD,EAAgE;EAC9D,KAAK,MAAMC,CAAX,IAAgBC,MAAM,CAACC,IAAP,CAAYH,MAAZ,CAAhB,EAAoD;IAClD,MAAMO,GAAG,GAAGP,MAAM,CAACC,CAAD,CAAlB;IACA,IAAIM,GAAG,KAAKC,SAAZ,EAAuBT,MAAM,CAACE,CAAD,CAAN,GAAYM,GAAZ;EACxB;AACF;;AAEM,SAASE,kBAAT,CAA4BC,KAA5B,EAAwE;EAC7E,OACE,CAAC,CAACA,KAAF,IACA,OAAOA,KAAK,CAACC,IAAb,KAAsB,UADtB,IAEA,OAAOD,KAAK,CAACE,MAAM,CAACC,QAAR,CAAZ,KAAkC,UAHpC;AAKD"} \ No newline at end of file +{"version":3,"names":["mergeOptions","target","source","k","Object","keys","parserOpts","targetObj","mergeDefaultFields","val","undefined","isIterableIterator","value","next","Symbol","iterator"],"sources":["../../src/config/util.ts"],"sourcesContent":["import type { ValidatedOptions, NormalizedOptions } from \"./validation/options\";\n\nexport function mergeOptions(\n target: ValidatedOptions,\n source: ValidatedOptions | NormalizedOptions,\n): void {\n for (const k of Object.keys(source)) {\n if (\n (k === \"parserOpts\" || k === \"generatorOpts\" || k === \"assumptions\") &&\n source[k]\n ) {\n const parserOpts = source[k];\n const targetObj = target[k] || (target[k] = {});\n mergeDefaultFields(targetObj, parserOpts);\n } else {\n //@ts-expect-error k must index source\n const val = source[k];\n //@ts-expect-error assigning source to target\n if (val !== undefined) target[k] = val as any;\n }\n }\n}\n\nfunction mergeDefaultFields(target: T, source: T) {\n for (const k of Object.keys(source) as (keyof T)[]) {\n const val = source[k];\n if (val !== undefined) target[k] = val;\n }\n}\n\nexport function isIterableIterator(value: any): value is IterableIterator {\n return (\n !!value &&\n typeof value.next === \"function\" &&\n typeof value[Symbol.iterator] === \"function\"\n );\n}\n"],"mappings":";;;;;;;AAEO,SAASA,YAAY,CAC1BC,MAAwB,EACxBC,MAA4C,EACtC;EACN,KAAK,MAAMC,CAAC,IAAIC,MAAM,CAACC,IAAI,CAACH,MAAM,CAAC,EAAE;IACnC,IACE,CAACC,CAAC,KAAK,YAAY,IAAIA,CAAC,KAAK,eAAe,IAAIA,CAAC,KAAK,aAAa,KACnED,MAAM,CAACC,CAAC,CAAC,EACT;MACA,MAAMG,UAAU,GAAGJ,MAAM,CAACC,CAAC,CAAC;MAC5B,MAAMI,SAAS,GAAGN,MAAM,CAACE,CAAC,CAAC,KAAKF,MAAM,CAACE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;MAC/CK,kBAAkB,CAACD,SAAS,EAAED,UAAU,CAAC;IAC3C,CAAC,MAAM;MAEL,MAAMG,GAAG,GAAGP,MAAM,CAACC,CAAC,CAAC;MAErB,IAAIM,GAAG,KAAKC,SAAS,EAAET,MAAM,CAACE,CAAC,CAAC,GAAGM,GAAU;IAC/C;EACF;AACF;AAEA,SAASD,kBAAkB,CAAeP,MAAS,EAAEC,MAAS,EAAE;EAC9D,KAAK,MAAMC,CAAC,IAAIC,MAAM,CAACC,IAAI,CAACH,MAAM,CAAC,EAAiB;IAClD,MAAMO,GAAG,GAAGP,MAAM,CAACC,CAAC,CAAC;IACrB,IAAIM,GAAG,KAAKC,SAAS,EAAET,MAAM,CAACE,CAAC,CAAC,GAAGM,GAAG;EACxC;AACF;AAEO,SAASE,kBAAkB,CAACC,KAAU,EAAkC;EAC7E,OACE,CAAC,CAACA,KAAK,IACP,OAAOA,KAAK,CAACC,IAAI,KAAK,UAAU,IAChC,OAAOD,KAAK,CAACE,MAAM,CAACC,QAAQ,CAAC,KAAK,UAAU;AAEhD;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/validation/option-assertions.js b/node_modules/@babel/core/lib/config/validation/option-assertions.js index cdd523784..21bc8490d 100644 --- a/node_modules/@babel/core/lib/config/validation/option-assertions.js +++ b/node_modules/@babel/core/lib/config/validation/option-assertions.js @@ -23,41 +23,30 @@ exports.assertSourceType = assertSourceType; exports.assertString = assertString; exports.assertTargets = assertTargets; exports.msg = msg; - function _helperCompilationTargets() { const data = require("@babel/helper-compilation-targets"); - _helperCompilationTargets = function () { return data; }; - return data; } - var _options = require("./options"); - function msg(loc) { switch (loc.type) { case "root": return ``; - case "env": return `${msg(loc.parent)}.env["${loc.name}"]`; - case "overrides": return `${msg(loc.parent)}.overrides[${loc.index}]`; - case "option": return `${msg(loc.parent)}.${loc.name}`; - case "access": return `${msg(loc.parent)}[${JSON.stringify(loc.name)}]`; - default: throw new Error(`Assertion failure: Unknown type ${loc.type}`); } } - function access(loc, name) { return { type: "access", @@ -65,129 +54,99 @@ function access(loc, name) { parent: loc }; } - function assertRootMode(loc, value) { if (value !== undefined && value !== "root" && value !== "upward" && value !== "upward-optional") { throw new Error(`${msg(loc)} must be a "root", "upward", "upward-optional" or undefined`); } - return value; } - function assertSourceMaps(loc, value) { if (value !== undefined && typeof value !== "boolean" && value !== "inline" && value !== "both") { throw new Error(`${msg(loc)} must be a boolean, "inline", "both", or undefined`); } - return value; } - function assertCompact(loc, value) { if (value !== undefined && typeof value !== "boolean" && value !== "auto") { throw new Error(`${msg(loc)} must be a boolean, "auto", or undefined`); } - return value; } - function assertSourceType(loc, value) { if (value !== undefined && value !== "module" && value !== "script" && value !== "unambiguous") { throw new Error(`${msg(loc)} must be "module", "script", "unambiguous", or undefined`); } - return value; } - function assertCallerMetadata(loc, value) { const obj = assertObject(loc, value); - if (obj) { if (typeof obj.name !== "string") { throw new Error(`${msg(loc)} set but does not contain "name" property string`); } - for (const prop of Object.keys(obj)) { const propLoc = access(loc, prop); const value = obj[prop]; - if (value != null && typeof value !== "boolean" && typeof value !== "string" && typeof value !== "number") { throw new Error(`${msg(propLoc)} must be null, undefined, a boolean, a string, or a number.`); } } } - return value; } - function assertInputSourceMap(loc, value) { if (value !== undefined && typeof value !== "boolean" && (typeof value !== "object" || !value)) { throw new Error(`${msg(loc)} must be a boolean, object, or undefined`); } - return value; } - function assertString(loc, value) { if (value !== undefined && typeof value !== "string") { throw new Error(`${msg(loc)} must be a string, or undefined`); } - return value; } - function assertFunction(loc, value) { if (value !== undefined && typeof value !== "function") { throw new Error(`${msg(loc)} must be a function, or undefined`); } - return value; } - function assertBoolean(loc, value) { if (value !== undefined && typeof value !== "boolean") { throw new Error(`${msg(loc)} must be a boolean, or undefined`); } - return value; } - function assertObject(loc, value) { if (value !== undefined && (typeof value !== "object" || Array.isArray(value) || !value)) { throw new Error(`${msg(loc)} must be an object, or undefined`); } - return value; } - function assertArray(loc, value) { if (value != null && !Array.isArray(value)) { throw new Error(`${msg(loc)} must be an array, or undefined`); } - return value; } - function assertIgnoreList(loc, value) { const arr = assertArray(loc, value); - if (arr) { arr.forEach((item, i) => assertIgnoreItem(access(loc, i), item)); } - return arr; } - function assertIgnoreItem(loc, value) { if (typeof value !== "string" && typeof value !== "function" && !(value instanceof RegExp)) { throw new Error(`${msg(loc)} must be an array of string/Function/RegExp values, or undefined`); } - return value; } - function assertConfigApplicableTest(loc, value) { - if (value === undefined) return value; - + if (value === undefined) { + return value; + } if (Array.isArray(value)) { value.forEach((item, i) => { if (!checkValidTest(item)) { @@ -197,25 +156,21 @@ function assertConfigApplicableTest(loc, value) { } else if (!checkValidTest(value)) { throw new Error(`${msg(loc)} must be a string/Function/RegExp, or an array of those`); } - return value; } - function checkValidTest(value) { return typeof value === "string" || typeof value === "function" || value instanceof RegExp; } - function assertConfigFileSearch(loc, value) { if (value !== undefined && typeof value !== "boolean" && typeof value !== "string") { throw new Error(`${msg(loc)} must be a undefined, a boolean, a string, ` + `got ${JSON.stringify(value)}`); } - return value; } - function assertBabelrcSearch(loc, value) { - if (value === undefined || typeof value === "boolean") return value; - + if (value === undefined || typeof value === "boolean") { + return value; + } if (Array.isArray(value)) { value.forEach((item, i) => { if (!checkValidTest(item)) { @@ -225,43 +180,32 @@ function assertBabelrcSearch(loc, value) { } else if (!checkValidTest(value)) { throw new Error(`${msg(loc)} must be a undefined, a boolean, a string/Function/RegExp ` + `or an array of those, got ${JSON.stringify(value)}`); } - return value; } - function assertPluginList(loc, value) { const arr = assertArray(loc, value); - if (arr) { arr.forEach((item, i) => assertPluginItem(access(loc, i), item)); } - return arr; } - function assertPluginItem(loc, value) { if (Array.isArray(value)) { if (value.length === 0) { throw new Error(`${msg(loc)} must include an object`); } - if (value.length > 3) { throw new Error(`${msg(loc)} may only be a two-tuple or three-tuple`); } - assertPluginTarget(access(loc, 0), value[0]); - if (value.length > 1) { const opts = value[1]; - if (opts !== undefined && opts !== false && (typeof opts !== "object" || Array.isArray(opts) || opts === null)) { throw new Error(`${msg(access(loc, 1))} must be an object, false, or undefined`); } } - if (value.length === 3) { const name = value[2]; - if (name !== undefined && typeof name !== "string") { throw new Error(`${msg(access(loc, 2))} must be a string, or undefined`); } @@ -272,27 +216,21 @@ function assertPluginItem(loc, value) { return value; } - function assertPluginTarget(loc, value) { if ((typeof value !== "object" || !value) && typeof value !== "string" && typeof value !== "function") { throw new Error(`${msg(loc)} must be a string, object, function`); } - return value; } - function assertTargets(loc, value) { if ((0, _helperCompilationTargets().isBrowsersQueryValid)(value)) return value; - if (typeof value !== "object" || !value || Array.isArray(value)) { throw new Error(`${msg(loc)} must be a string, an array of strings or an object`); } - const browsersLoc = access(loc, "browsers"); const esmodulesLoc = access(loc, "esmodules"); assertBrowsersList(browsersLoc, value.browsers); assertBoolean(esmodulesLoc, value.esmodules); - for (const key of Object.keys(value)) { const val = value[key]; const subLoc = access(loc, key); @@ -301,48 +239,37 @@ function assertTargets(loc, value) { throw new Error(`${msg(subLoc)} is not a valid target. Supported targets are ${validTargets}`); } else assertBrowserVersion(subLoc, val); } - return value; } - function assertBrowsersList(loc, value) { if (value !== undefined && !(0, _helperCompilationTargets().isBrowsersQueryValid)(value)) { throw new Error(`${msg(loc)} must be undefined, a string or an array of strings`); } } - function assertBrowserVersion(loc, value) { if (typeof value === "number" && Math.round(value) === value) return; if (typeof value === "string") return; throw new Error(`${msg(loc)} must be a string or an integer number`); } - function assertAssumptions(loc, value) { if (value === undefined) return; - if (typeof value !== "object" || value === null) { throw new Error(`${msg(loc)} must be an object or undefined.`); } let root = loc; - do { root = root.parent; } while (root.type !== "root"); - const inPreset = root.source === "preset"; - for (const name of Object.keys(value)) { const subLoc = access(loc, name); - if (!_options.assumptionsNames.has(name)) { throw new Error(`${msg(subLoc)} is not a supported assumption.`); } - if (typeof value[name] !== "boolean") { throw new Error(`${msg(subLoc)} must be a boolean.`); } - if (inPreset && value[name] === false) { throw new Error(`${msg(subLoc)} cannot be set to 'false' inside presets.`); } @@ -350,7 +277,6 @@ function assertAssumptions(loc, value) { return value; } - 0 && 0; //# sourceMappingURL=option-assertions.js.map diff --git a/node_modules/@babel/core/lib/config/validation/option-assertions.js.map b/node_modules/@babel/core/lib/config/validation/option-assertions.js.map index 8debd60cd..e36c4948d 100644 --- a/node_modules/@babel/core/lib/config/validation/option-assertions.js.map +++ b/node_modules/@babel/core/lib/config/validation/option-assertions.js.map @@ -1 +1 @@ -{"version":3,"names":["msg","loc","type","parent","name","index","JSON","stringify","Error","access","assertRootMode","value","undefined","assertSourceMaps","assertCompact","assertSourceType","assertCallerMetadata","obj","assertObject","prop","Object","keys","propLoc","assertInputSourceMap","assertString","assertFunction","assertBoolean","Array","isArray","assertArray","assertIgnoreList","arr","forEach","item","i","assertIgnoreItem","RegExp","assertConfigApplicableTest","checkValidTest","assertConfigFileSearch","assertBabelrcSearch","assertPluginList","assertPluginItem","length","assertPluginTarget","opts","assertTargets","isBrowsersQueryValid","browsersLoc","esmodulesLoc","assertBrowsersList","browsers","esmodules","key","val","subLoc","hasOwnProperty","call","TargetNames","validTargets","join","assertBrowserVersion","Math","round","assertAssumptions","root","inPreset","source","assumptionsNames","has"],"sources":["../../../src/config/validation/option-assertions.ts"],"sourcesContent":["import {\n isBrowsersQueryValid,\n TargetNames,\n} from \"@babel/helper-compilation-targets\";\n\nimport type {\n ConfigFileSearch,\n BabelrcSearch,\n IgnoreList,\n IgnoreItem,\n PluginList,\n PluginItem,\n PluginTarget,\n ConfigApplicableTest,\n SourceMapsOption,\n SourceTypeOption,\n CompactOption,\n RootInputSourceMapOption,\n NestingPath,\n CallerMetadata,\n RootMode,\n TargetsListOrObject,\n AssumptionName,\n} from \"./options\";\n\nimport { assumptionsNames } from \"./options\";\n\nexport type { RootPath } from \"./options\";\n\nexport type ValidatorSet = {\n [name: string]: Validator;\n};\n\nexport type Validator = (loc: OptionPath, value: unknown) => T;\n\nexport function msg(loc: NestingPath | GeneralPath): string {\n switch (loc.type) {\n case \"root\":\n return ``;\n case \"env\":\n return `${msg(loc.parent)}.env[\"${loc.name}\"]`;\n case \"overrides\":\n return `${msg(loc.parent)}.overrides[${loc.index}]`;\n case \"option\":\n return `${msg(loc.parent)}.${loc.name}`;\n case \"access\":\n return `${msg(loc.parent)}[${JSON.stringify(loc.name)}]`;\n default:\n // @ts-expect-error should not happen when code is type checked\n throw new Error(`Assertion failure: Unknown type ${loc.type}`);\n }\n}\n\nexport function access(loc: GeneralPath, name: string | number): AccessPath {\n return {\n type: \"access\",\n name,\n parent: loc,\n };\n}\n\nexport type OptionPath = Readonly<{\n type: \"option\";\n name: string;\n parent: NestingPath;\n}>;\ntype AccessPath = Readonly<{\n type: \"access\";\n name: string | number;\n parent: GeneralPath;\n}>;\ntype GeneralPath = OptionPath | AccessPath;\n\nexport function assertRootMode(\n loc: OptionPath,\n value: unknown,\n): RootMode | void {\n if (\n value !== undefined &&\n value !== \"root\" &&\n value !== \"upward\" &&\n value !== \"upward-optional\"\n ) {\n throw new Error(\n `${msg(loc)} must be a \"root\", \"upward\", \"upward-optional\" or undefined`,\n );\n }\n return value;\n}\n\nexport function assertSourceMaps(\n loc: OptionPath,\n value: unknown,\n): SourceMapsOption | void {\n if (\n value !== undefined &&\n typeof value !== \"boolean\" &&\n value !== \"inline\" &&\n value !== \"both\"\n ) {\n throw new Error(\n `${msg(loc)} must be a boolean, \"inline\", \"both\", or undefined`,\n );\n }\n return value;\n}\n\nexport function assertCompact(\n loc: OptionPath,\n value: unknown,\n): CompactOption | void {\n if (value !== undefined && typeof value !== \"boolean\" && value !== \"auto\") {\n throw new Error(`${msg(loc)} must be a boolean, \"auto\", or undefined`);\n }\n return value;\n}\n\nexport function assertSourceType(\n loc: OptionPath,\n value: unknown,\n): SourceTypeOption | void {\n if (\n value !== undefined &&\n value !== \"module\" &&\n value !== \"script\" &&\n value !== \"unambiguous\"\n ) {\n throw new Error(\n `${msg(loc)} must be \"module\", \"script\", \"unambiguous\", or undefined`,\n );\n }\n return value;\n}\n\nexport function assertCallerMetadata(\n loc: OptionPath,\n value: unknown,\n): CallerMetadata | undefined {\n const obj = assertObject(loc, value);\n if (obj) {\n if (typeof obj.name !== \"string\") {\n throw new Error(\n `${msg(loc)} set but does not contain \"name\" property string`,\n );\n }\n\n for (const prop of Object.keys(obj)) {\n const propLoc = access(loc, prop);\n const value = obj[prop];\n if (\n value != null &&\n typeof value !== \"boolean\" &&\n typeof value !== \"string\" &&\n typeof value !== \"number\"\n ) {\n // NOTE(logan): I'm limiting the type here so that we can guarantee that\n // the \"caller\" value will serialize to JSON nicely. We can always\n // allow more complex structures later though.\n throw new Error(\n `${msg(\n propLoc,\n )} must be null, undefined, a boolean, a string, or a number.`,\n );\n }\n }\n }\n // @ts-expect-error todo(flow->ts)\n return value;\n}\n\nexport function assertInputSourceMap(\n loc: OptionPath,\n value: unknown,\n): RootInputSourceMapOption | void {\n if (\n value !== undefined &&\n typeof value !== \"boolean\" &&\n (typeof value !== \"object\" || !value)\n ) {\n throw new Error(`${msg(loc)} must be a boolean, object, or undefined`);\n }\n return value;\n}\n\nexport function assertString(loc: GeneralPath, value: unknown): string | void {\n if (value !== undefined && typeof value !== \"string\") {\n throw new Error(`${msg(loc)} must be a string, or undefined`);\n }\n return value;\n}\n\nexport function assertFunction(\n loc: GeneralPath,\n value: unknown,\n): Function | void {\n if (value !== undefined && typeof value !== \"function\") {\n throw new Error(`${msg(loc)} must be a function, or undefined`);\n }\n return value;\n}\n\nexport function assertBoolean(\n loc: GeneralPath,\n value: unknown,\n): boolean | void {\n if (value !== undefined && typeof value !== \"boolean\") {\n throw new Error(`${msg(loc)} must be a boolean, or undefined`);\n }\n return value;\n}\n\nexport function assertObject(\n loc: GeneralPath,\n value: unknown,\n): { readonly [key: string]: unknown } | void {\n if (\n value !== undefined &&\n (typeof value !== \"object\" || Array.isArray(value) || !value)\n ) {\n throw new Error(`${msg(loc)} must be an object, or undefined`);\n }\n // @ts-expect-error todo(flow->ts) value is still typed as unknown, also assert function typically should not return a value\n return value;\n}\n\nexport function assertArray(\n loc: GeneralPath,\n value: Array | undefined | null,\n): ReadonlyArray | undefined | null {\n if (value != null && !Array.isArray(value)) {\n throw new Error(`${msg(loc)} must be an array, or undefined`);\n }\n return value;\n}\n\nexport function assertIgnoreList(\n loc: OptionPath,\n value: unknown[] | undefined,\n): IgnoreList | void {\n const arr = assertArray(loc, value);\n if (arr) {\n arr.forEach((item, i) => assertIgnoreItem(access(loc, i), item));\n }\n // @ts-expect-error todo(flow->ts)\n return arr;\n}\nfunction assertIgnoreItem(loc: GeneralPath, value: unknown): IgnoreItem {\n if (\n typeof value !== \"string\" &&\n typeof value !== \"function\" &&\n !(value instanceof RegExp)\n ) {\n throw new Error(\n `${msg(\n loc,\n )} must be an array of string/Function/RegExp values, or undefined`,\n );\n }\n return value as IgnoreItem;\n}\n\nexport function assertConfigApplicableTest(\n loc: OptionPath,\n value: unknown,\n): ConfigApplicableTest | void {\n if (value === undefined) return value;\n\n if (Array.isArray(value)) {\n value.forEach((item, i) => {\n if (!checkValidTest(item)) {\n throw new Error(\n `${msg(access(loc, i))} must be a string/Function/RegExp.`,\n );\n }\n });\n } else if (!checkValidTest(value)) {\n throw new Error(\n `${msg(loc)} must be a string/Function/RegExp, or an array of those`,\n );\n }\n return value as ConfigApplicableTest;\n}\n\nfunction checkValidTest(value: unknown): value is string | Function | RegExp {\n return (\n typeof value === \"string\" ||\n typeof value === \"function\" ||\n value instanceof RegExp\n );\n}\n\nexport function assertConfigFileSearch(\n loc: OptionPath,\n value: unknown,\n): ConfigFileSearch | void {\n if (\n value !== undefined &&\n typeof value !== \"boolean\" &&\n typeof value !== \"string\"\n ) {\n throw new Error(\n `${msg(loc)} must be a undefined, a boolean, a string, ` +\n `got ${JSON.stringify(value)}`,\n );\n }\n\n return value;\n}\n\nexport function assertBabelrcSearch(\n loc: OptionPath,\n value: unknown,\n): BabelrcSearch | void {\n if (value === undefined || typeof value === \"boolean\") return value;\n\n if (Array.isArray(value)) {\n value.forEach((item, i) => {\n if (!checkValidTest(item)) {\n throw new Error(\n `${msg(access(loc, i))} must be a string/Function/RegExp.`,\n );\n }\n });\n } else if (!checkValidTest(value)) {\n throw new Error(\n `${msg(loc)} must be a undefined, a boolean, a string/Function/RegExp ` +\n `or an array of those, got ${JSON.stringify(value as any)}`,\n );\n }\n return value as BabelrcSearch;\n}\n\nexport function assertPluginList(\n loc: OptionPath,\n value: unknown[] | null | undefined,\n): PluginList | void {\n const arr = assertArray(loc, value);\n if (arr) {\n // Loop instead of using `.map` in order to preserve object identity\n // for plugin array for use during config chain processing.\n arr.forEach((item, i) => assertPluginItem(access(loc, i), item));\n }\n return arr as any;\n}\nfunction assertPluginItem(loc: GeneralPath, value: unknown): PluginItem {\n if (Array.isArray(value)) {\n if (value.length === 0) {\n throw new Error(`${msg(loc)} must include an object`);\n }\n\n if (value.length > 3) {\n throw new Error(`${msg(loc)} may only be a two-tuple or three-tuple`);\n }\n\n assertPluginTarget(access(loc, 0), value[0]);\n\n if (value.length > 1) {\n const opts = value[1];\n if (\n opts !== undefined &&\n opts !== false &&\n (typeof opts !== \"object\" || Array.isArray(opts) || opts === null)\n ) {\n throw new Error(\n `${msg(access(loc, 1))} must be an object, false, or undefined`,\n );\n }\n }\n if (value.length === 3) {\n const name = value[2];\n if (name !== undefined && typeof name !== \"string\") {\n throw new Error(\n `${msg(access(loc, 2))} must be a string, or undefined`,\n );\n }\n }\n } else {\n assertPluginTarget(loc, value);\n }\n\n // @ts-expect-error todo(flow->ts)\n return value;\n}\nfunction assertPluginTarget(loc: GeneralPath, value: unknown): PluginTarget {\n if (\n (typeof value !== \"object\" || !value) &&\n typeof value !== \"string\" &&\n typeof value !== \"function\"\n ) {\n throw new Error(`${msg(loc)} must be a string, object, function`);\n }\n return value;\n}\n\nexport function assertTargets(\n loc: GeneralPath,\n value: any,\n): TargetsListOrObject {\n if (isBrowsersQueryValid(value)) return value;\n\n if (typeof value !== \"object\" || !value || Array.isArray(value)) {\n throw new Error(\n `${msg(loc)} must be a string, an array of strings or an object`,\n );\n }\n\n const browsersLoc = access(loc, \"browsers\");\n const esmodulesLoc = access(loc, \"esmodules\");\n\n assertBrowsersList(browsersLoc, value.browsers);\n assertBoolean(esmodulesLoc, value.esmodules);\n\n for (const key of Object.keys(value)) {\n const val = value[key];\n const subLoc = access(loc, key);\n\n if (key === \"esmodules\") assertBoolean(subLoc, val);\n else if (key === \"browsers\") assertBrowsersList(subLoc, val);\n else if (!Object.hasOwnProperty.call(TargetNames, key)) {\n const validTargets = Object.keys(TargetNames).join(\", \");\n throw new Error(\n `${msg(\n subLoc,\n )} is not a valid target. Supported targets are ${validTargets}`,\n );\n } else assertBrowserVersion(subLoc, val);\n }\n\n return value;\n}\n\nfunction assertBrowsersList(loc: GeneralPath, value: unknown) {\n if (value !== undefined && !isBrowsersQueryValid(value)) {\n throw new Error(\n `${msg(loc)} must be undefined, a string or an array of strings`,\n );\n }\n}\n\nfunction assertBrowserVersion(loc: GeneralPath, value: unknown) {\n if (typeof value === \"number\" && Math.round(value) === value) return;\n if (typeof value === \"string\") return;\n\n throw new Error(`${msg(loc)} must be a string or an integer number`);\n}\n\nexport function assertAssumptions(\n loc: GeneralPath,\n value: { [key: string]: unknown },\n): { [name: string]: boolean } | void {\n if (value === undefined) return;\n\n if (typeof value !== \"object\" || value === null) {\n throw new Error(`${msg(loc)} must be an object or undefined.`);\n }\n\n // todo(flow->ts): remove any\n let root: any = loc;\n do {\n root = root.parent;\n } while (root.type !== \"root\");\n const inPreset = root.source === \"preset\";\n\n for (const name of Object.keys(value)) {\n const subLoc = access(loc, name);\n if (!assumptionsNames.has(name as AssumptionName)) {\n throw new Error(`${msg(subLoc)} is not a supported assumption.`);\n }\n if (typeof value[name] !== \"boolean\") {\n throw new Error(`${msg(subLoc)} must be a boolean.`);\n }\n if (inPreset && value[name] === false) {\n throw new Error(\n `${msg(subLoc)} cannot be set to 'false' inside presets.`,\n );\n }\n }\n\n // @ts-expect-error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CAAN;IACD;;IACD,IAAI,OAAO5C,KAAK,CAACP,IAAD,CAAZ,KAAuB,SAA3B,EAAsC;MACpC,MAAM,IAAII,KAAJ,CAAW,GAAER,GAAG,CAACuD,MAAD,CAAS,qBAAzB,CAAN;IACD;;IACD,IAAIW,QAAQ,IAAIvD,KAAK,CAACP,IAAD,CAAL,KAAgB,KAAhC,EAAuC;MACrC,MAAM,IAAII,KAAJ,CACH,GAAER,GAAG,CAACuD,MAAD,CAAS,2CADX,CAAN;IAGD;EACF;;EAGD,OAAO5C,KAAP;AACD"} \ No newline at end of file +{"version":3,"names":["msg","loc","type","parent","name","index","JSON","stringify","Error","access","assertRootMode","value","undefined","assertSourceMaps","assertCompact","assertSourceType","assertCallerMetadata","obj","assertObject","prop","Object","keys","propLoc","assertInputSourceMap","assertString","assertFunction","assertBoolean","Array","isArray","assertArray","assertIgnoreList","arr","forEach","item","i","assertIgnoreItem","RegExp","assertConfigApplicableTest","checkValidTest","assertConfigFileSearch","assertBabelrcSearch","assertPluginList","assertPluginItem","length","assertPluginTarget","opts","assertTargets","isBrowsersQueryValid","browsersLoc","esmodulesLoc","assertBrowsersList","browsers","esmodules","key","val","subLoc","hasOwnProperty","call","TargetNames","validTargets","join","assertBrowserVersion","Math","round","assertAssumptions","root","inPreset","source","assumptionsNames","has"],"sources":["../../../src/config/validation/option-assertions.ts"],"sourcesContent":["import {\n isBrowsersQueryValid,\n TargetNames,\n} from \"@babel/helper-compilation-targets\";\n\nimport type {\n ConfigFileSearch,\n BabelrcSearch,\n IgnoreList,\n IgnoreItem,\n PluginList,\n PluginItem,\n PluginTarget,\n ConfigApplicableTest,\n SourceMapsOption,\n SourceTypeOption,\n CompactOption,\n RootInputSourceMapOption,\n NestingPath,\n CallerMetadata,\n RootMode,\n TargetsListOrObject,\n AssumptionName,\n} from \"./options\";\n\nimport { assumptionsNames } from \"./options\";\n\nexport type { RootPath } from \"./options\";\n\nexport type ValidatorSet = {\n [name: string]: Validator;\n};\n\nexport type Validator = (loc: OptionPath, value: unknown) => T;\n\nexport function msg(loc: NestingPath | GeneralPath): string {\n switch (loc.type) {\n case \"root\":\n return ``;\n case \"env\":\n return `${msg(loc.parent)}.env[\"${loc.name}\"]`;\n case \"overrides\":\n return `${msg(loc.parent)}.overrides[${loc.index}]`;\n case \"option\":\n return `${msg(loc.parent)}.${loc.name}`;\n case \"access\":\n return `${msg(loc.parent)}[${JSON.stringify(loc.name)}]`;\n default:\n // @ts-expect-error should not happen when code is type checked\n throw new Error(`Assertion failure: Unknown type ${loc.type}`);\n }\n}\n\nexport function access(loc: GeneralPath, name: string | number): AccessPath {\n return {\n type: \"access\",\n name,\n parent: loc,\n };\n}\n\nexport type OptionPath = Readonly<{\n type: \"option\";\n name: string;\n parent: NestingPath;\n}>;\ntype AccessPath = Readonly<{\n type: \"access\";\n name: string | number;\n parent: GeneralPath;\n}>;\ntype GeneralPath = OptionPath | AccessPath;\n\nexport function assertRootMode(\n loc: OptionPath,\n value: unknown,\n): RootMode | void {\n if (\n value !== undefined &&\n value !== \"root\" &&\n value !== \"upward\" &&\n value !== \"upward-optional\"\n ) {\n throw new Error(\n `${msg(loc)} must be a \"root\", \"upward\", \"upward-optional\" or undefined`,\n );\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertSourceMaps(\n loc: OptionPath,\n value: unknown,\n): SourceMapsOption | void {\n if (\n value !== undefined &&\n typeof value !== \"boolean\" &&\n value !== \"inline\" &&\n value !== \"both\"\n ) {\n throw new Error(\n `${msg(loc)} must be a boolean, \"inline\", \"both\", or undefined`,\n );\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertCompact(\n loc: OptionPath,\n value: unknown,\n): CompactOption | void {\n if (value !== undefined && typeof value !== \"boolean\" && value !== \"auto\") {\n throw new Error(`${msg(loc)} must be a boolean, \"auto\", or undefined`);\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertSourceType(\n loc: OptionPath,\n value: unknown,\n): SourceTypeOption | void {\n if (\n value !== undefined &&\n value !== \"module\" &&\n value !== \"script\" &&\n value !== \"unambiguous\"\n ) {\n throw new Error(\n `${msg(loc)} must be \"module\", \"script\", \"unambiguous\", or undefined`,\n );\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertCallerMetadata(\n loc: OptionPath,\n value: unknown,\n): CallerMetadata | undefined {\n const obj = assertObject(loc, value);\n if (obj) {\n if (typeof obj.name !== \"string\") {\n throw new Error(\n `${msg(loc)} set but does not contain \"name\" property string`,\n );\n }\n\n for (const prop of Object.keys(obj)) {\n const propLoc = access(loc, prop);\n const value = obj[prop];\n if (\n value != null &&\n typeof value !== \"boolean\" &&\n typeof value !== \"string\" &&\n typeof value !== \"number\"\n ) {\n // NOTE(logan): I'm limiting the type here so that we can guarantee that\n // the \"caller\" value will serialize to JSON nicely. We can always\n // allow more complex structures later though.\n throw new Error(\n `${msg(\n propLoc,\n )} must be null, undefined, a boolean, a string, or a number.`,\n );\n }\n }\n }\n // @ts-expect-error todo(flow->ts)\n return value;\n}\n\nexport function assertInputSourceMap(\n loc: OptionPath,\n value: unknown,\n): RootInputSourceMapOption | void {\n if (\n value !== undefined &&\n typeof value !== \"boolean\" &&\n (typeof value !== \"object\" || !value)\n ) {\n throw new Error(`${msg(loc)} must be a boolean, object, or undefined`);\n }\n return value;\n}\n\nexport function assertString(loc: GeneralPath, value: unknown): string | void {\n if (value !== undefined && typeof value !== \"string\") {\n throw new Error(`${msg(loc)} must be a string, or undefined`);\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertFunction(\n loc: GeneralPath,\n value: unknown,\n): Function | void {\n if (value !== undefined && typeof value !== \"function\") {\n throw new Error(`${msg(loc)} must be a function, or undefined`);\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertBoolean(\n loc: GeneralPath,\n value: unknown,\n): boolean | void {\n if (value !== undefined && typeof value !== \"boolean\") {\n throw new Error(`${msg(loc)} must be a boolean, or undefined`);\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertObject(\n loc: GeneralPath,\n value: unknown,\n): { readonly [key: string]: unknown } | void {\n if (\n value !== undefined &&\n (typeof value !== \"object\" || Array.isArray(value) || !value)\n ) {\n throw new Error(`${msg(loc)} must be an object, or undefined`);\n }\n // @ts-expect-error todo(flow->ts) value is still typed as unknown, also assert function typically should not return a value\n return value;\n}\n\nexport function assertArray(\n loc: GeneralPath,\n value: Array | undefined | null,\n): ReadonlyArray | undefined | null {\n if (value != null && !Array.isArray(value)) {\n throw new Error(`${msg(loc)} must be an array, or undefined`);\n }\n return value;\n}\n\nexport function assertIgnoreList(\n loc: OptionPath,\n value: unknown[] | undefined,\n): IgnoreList | void {\n const arr = assertArray(loc, value);\n if (arr) {\n arr.forEach((item, i) => assertIgnoreItem(access(loc, i), item));\n }\n // @ts-expect-error todo(flow->ts)\n return arr;\n}\nfunction assertIgnoreItem(loc: GeneralPath, value: unknown): IgnoreItem {\n if (\n typeof value !== \"string\" &&\n typeof value !== \"function\" &&\n !(value instanceof RegExp)\n ) {\n throw new Error(\n `${msg(\n loc,\n )} must be an array of string/Function/RegExp values, or undefined`,\n );\n }\n return value as IgnoreItem;\n}\n\nexport function assertConfigApplicableTest(\n loc: OptionPath,\n value: unknown,\n): ConfigApplicableTest | void {\n if (value === undefined) {\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n }\n\n if (Array.isArray(value)) {\n value.forEach((item, i) => {\n if (!checkValidTest(item)) {\n throw new Error(\n `${msg(access(loc, i))} must be a string/Function/RegExp.`,\n );\n }\n });\n } else if (!checkValidTest(value)) {\n throw new Error(\n `${msg(loc)} must be a string/Function/RegExp, or an array of those`,\n );\n }\n return value as ConfigApplicableTest;\n}\n\nfunction checkValidTest(value: unknown): value is string | Function | RegExp {\n return (\n typeof value === \"string\" ||\n typeof value === \"function\" ||\n value instanceof RegExp\n );\n}\n\nexport function assertConfigFileSearch(\n loc: OptionPath,\n value: unknown,\n): ConfigFileSearch | void {\n if (\n value !== undefined &&\n typeof value !== \"boolean\" &&\n typeof value !== \"string\"\n ) {\n throw new Error(\n `${msg(loc)} must be a undefined, a boolean, a string, ` +\n `got ${JSON.stringify(value)}`,\n );\n }\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n}\n\nexport function assertBabelrcSearch(\n loc: OptionPath,\n value: unknown,\n): BabelrcSearch | void {\n if (value === undefined || typeof value === \"boolean\") {\n // @ts-expect-error: TS can only narrow down the type when \"strictNullCheck\" is true\n return value;\n }\n\n if (Array.isArray(value)) {\n value.forEach((item, i) => {\n if (!checkValidTest(item)) {\n throw new Error(\n `${msg(access(loc, i))} must be a string/Function/RegExp.`,\n );\n }\n });\n } else if (!checkValidTest(value)) {\n throw new Error(\n `${msg(loc)} must be a undefined, a boolean, a string/Function/RegExp ` +\n `or an array of those, got ${JSON.stringify(value as any)}`,\n );\n }\n return value as BabelrcSearch;\n}\n\nexport function assertPluginList(\n loc: OptionPath,\n value: unknown[] | null | undefined,\n): PluginList | void {\n const arr = assertArray(loc, value);\n if (arr) {\n // Loop instead of using `.map` in order to preserve object identity\n // for plugin array for use during config chain processing.\n arr.forEach((item, i) => assertPluginItem(access(loc, i), item));\n }\n return arr as any;\n}\nfunction assertPluginItem(loc: GeneralPath, value: unknown): PluginItem {\n if (Array.isArray(value)) {\n if (value.length === 0) {\n throw new Error(`${msg(loc)} must include an object`);\n }\n\n if (value.length > 3) {\n throw new Error(`${msg(loc)} may only be a two-tuple or three-tuple`);\n }\n\n assertPluginTarget(access(loc, 0), value[0]);\n\n if (value.length > 1) {\n const opts = value[1];\n if (\n opts !== undefined &&\n opts !== false &&\n (typeof opts !== \"object\" || Array.isArray(opts) || opts === null)\n ) {\n throw new Error(\n `${msg(access(loc, 1))} must be an object, false, or undefined`,\n );\n }\n }\n if (value.length === 3) {\n const name = value[2];\n if (name !== undefined && typeof name !== \"string\") {\n throw new Error(\n `${msg(access(loc, 2))} must be a string, or undefined`,\n );\n }\n }\n } else {\n assertPluginTarget(loc, value);\n }\n\n // @ts-expect-error todo(flow->ts)\n return value;\n}\nfunction assertPluginTarget(loc: GeneralPath, value: unknown): PluginTarget {\n if (\n (typeof value !== \"object\" || !value) &&\n typeof value !== \"string\" &&\n typeof value !== \"function\"\n ) {\n throw new Error(`${msg(loc)} must be a string, object, function`);\n }\n return value;\n}\n\nexport function assertTargets(\n loc: GeneralPath,\n value: any,\n): TargetsListOrObject {\n if (isBrowsersQueryValid(value)) return value;\n\n if (typeof value !== \"object\" || !value || Array.isArray(value)) {\n throw new Error(\n `${msg(loc)} must be a string, an array of strings or an object`,\n );\n }\n\n const browsersLoc = access(loc, \"browsers\");\n const esmodulesLoc = access(loc, \"esmodules\");\n\n assertBrowsersList(browsersLoc, value.browsers);\n assertBoolean(esmodulesLoc, value.esmodules);\n\n for (const key of Object.keys(value)) {\n const val = value[key];\n const subLoc = access(loc, key);\n\n if (key === \"esmodules\") assertBoolean(subLoc, val);\n else if (key === \"browsers\") assertBrowsersList(subLoc, val);\n else if (!Object.hasOwnProperty.call(TargetNames, key)) {\n const validTargets = Object.keys(TargetNames).join(\", \");\n throw new Error(\n `${msg(\n subLoc,\n )} is not a valid target. Supported targets are ${validTargets}`,\n );\n } else assertBrowserVersion(subLoc, val);\n }\n\n return value;\n}\n\nfunction assertBrowsersList(loc: GeneralPath, value: unknown) {\n if (value !== undefined && !isBrowsersQueryValid(value)) {\n throw new Error(\n `${msg(loc)} must be undefined, a string or an array of strings`,\n );\n }\n}\n\nfunction assertBrowserVersion(loc: GeneralPath, value: unknown) {\n if (typeof value === \"number\" && Math.round(value) === value) return;\n if (typeof value === \"string\") return;\n\n throw new Error(`${msg(loc)} must be a string or an integer number`);\n}\n\nexport function assertAssumptions(\n loc: GeneralPath,\n value: { [key: string]: unknown },\n): { [name: string]: boolean } | void {\n if (value === undefined) return;\n\n if (typeof value !== \"object\" || value === null) {\n throw new Error(`${msg(loc)} must be an object or undefined.`);\n }\n\n // todo(flow->ts): remove any\n let root: any = loc;\n do {\n root = root.parent;\n } while (root.type !== \"root\");\n const inPreset = root.source === \"preset\";\n\n for (const name of Object.keys(value)) {\n const subLoc = access(loc, name);\n if (!assumptionsNames.has(name as AssumptionName)) {\n throw new Error(`${msg(subLoc)} is not a supported assumption.`);\n }\n if (typeof value[name] !== \"boolean\") {\n throw new Error(`${msg(subLoc)} must be a boolean.`);\n }\n if (inPreset && value[name] === false) {\n throw new Error(\n `${msg(subLoc)} cannot be set to 'false' inside presets.`,\n );\n }\n }\n\n // @ts-expect-error todo(flow->ts)\n return value;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAyBA;AAUO,SAASA,GAAG,CAACC,GAA8B,EAAU;EAC1D,QAAQA,GAAG,CAACC,IAAI;IACd,KAAK,MAAM;MACT,OAAQ,EAAC;IACX,KAAK,KAAK;MACR,OAAQ,GAAEF,GAAG,CAACC,GAAG,CAACE,MAAM,CAAE,SAAQF,GAAG,CAACG,IAAK,IAAG;IAChD,KAAK,WAAW;MACd,OAAQ,GAAEJ,GAAG,CAACC,GAAG,CAACE,MAAM,CAAE,cAAaF,GAAG,CAACI,KAAM,GAAE;IACrD,KAAK,QAAQ;MACX,OAAQ,GAAEL,GAAG,CAACC,GAAG,CAACE,MAAM,CAAE,IAAGF,GAAG,CAACG,IAAK,EAAC;IACzC,KAAK,QAAQ;MACX,OAAQ,GAAEJ,GAAG,CAACC,GAAG,CAACE,MAAM,CAAE,IAAGG,IAAI,CAACC,SAAS,CAACN,GAAG,CAACG,IAAI,CAAE,GAAE;IAC1D;MAEE,MAAM,IAAII,KAAK,CAAE,mCAAkCP,GAAG,CAACC,IAAK,EA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I,KAAK,MAAM;EAC7B,MAAMgE,QAAQ,GAAGD,IAAI,CAACE,MAAM,KAAK,QAAQ;EAEzC,KAAK,MAAM/D,IAAI,IAAIgB,MAAM,CAACC,IAAI,CAACV,KAAK,CAAC,EAAE;IACrC,MAAM4C,MAAM,GAAG9C,MAAM,CAACR,GAAG,EAAEG,IAAI,CAAC;IAChC,IAAI,CAACgE,yBAAgB,CAACC,GAAG,CAACjE,IAAI,CAAmB,EAAE;MACjD,MAAM,IAAII,KAAK,CAAE,GAAER,GAAG,CAACuD,MAAM,CAAE,iCAAgC,CAAC;IAClE;IACA,IAAI,OAAO5C,KAAK,CAACP,IAAI,CAAC,KAAK,SAAS,EAAE;MACpC,MAAM,IAAII,KAAK,CAAE,GAAER,GAAG,CAACuD,MAAM,CAAE,qBAAoB,CAAC;IACtD;IACA,IAAIW,QAAQ,IAAIvD,KAAK,CAACP,IAAI,CAAC,KAAK,KAAK,EAAE;MACrC,MAAM,IAAII,KAAK,CACZ,GAAER,GAAG,CAACuD,MAAM,CAAE,2CAA0C,CAC1D;IACH;EACF;;EAGA,OAAO5C,KAAK;AACd;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/validation/options.js b/node_modules/@babel/core/lib/config/validation/options.js index 3bb31cf54..144b79203 100644 --- a/node_modules/@babel/core/lib/config/validation/options.js +++ b/node_modules/@babel/core/lib/config/validation/options.js @@ -6,13 +6,9 @@ Object.defineProperty(exports, "__esModule", { exports.assumptionsNames = void 0; exports.checkNoUnwrappedItemOptionPairs = checkNoUnwrappedItemOptionPairs; exports.validate = validate; - var _removed = require("./removed"); - var _optionAssertions = require("./option-assertions"); - var _configError = require("../../errors/config-error"); - const ROOT_VALIDATORS = { cwd: _optionAssertions.assertString, root: _optionAssertions.assertString, @@ -77,11 +73,9 @@ const COMMON_VALIDATORS = { const knownAssumptions = ["arrayLikeIsIterable", "constantReexports", "constantSuper", "enumerableModuleMeta", "ignoreFunctionLength", "ignoreToPrimitiveHint", "iterableIsArray", "mutableTemplateObject", "noClassCalls", "noDocumentAll", "noIncompleteNsImportDetection", "noNewArrows", "objectRestNoSymbols", "privateFieldsAsProperties", "pureGetters", "setClassMethods", "setComputedProperties", "setPublicClassFields", "setSpreadProperties", "skipForOfIteratorClosing", "superIsCallableConstructor"]; const assumptionsNames = new Set(knownAssumptions); exports.assumptionsNames = assumptionsNames; - function getSource(loc) { return loc.type === "root" ? loc.source : getSource(loc.parent); } - function validate(type, opts, filename) { try { return validateNested({ @@ -94,7 +88,6 @@ function validate(type, opts, filename) { throw configError; } } - function validateNested(loc, opts) { const type = getSource(loc); assertNoDuplicateSourcemap(opts); @@ -104,32 +97,25 @@ function validateNested(loc, opts) { name: key, parent: loc }; - if (type === "preset" && NONPRESET_VALIDATORS[key]) { throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is not allowed in preset options`); } - if (type !== "arguments" && ROOT_VALIDATORS[key]) { throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is only allowed in root programmatic options`); } - if (type !== "arguments" && type !== "configfile" && BABELRC_VALIDATORS[key]) { if (type === "babelrcfile" || type === "extendsfile") { throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is not allowed in .babelrc or "extends"ed files, only in root programmatic options, ` + `or babel.config.js/config file options`); } - throw new Error(`${(0, _optionAssertions.msg)(optLoc)} is only allowed in root programmatic options, or babel.config.js/config file options`); } - const validator = COMMON_VALIDATORS[key] || NONPRESET_VALIDATORS[key] || BABELRC_VALIDATORS[key] || ROOT_VALIDATORS[key] || throwUnknownError; validator(optLoc, opts[key]); }); return opts; } - function throwUnknownError(loc) { const key = loc.name; - if (_removed.default[key]) { const { message, @@ -142,25 +128,20 @@ function throwUnknownError(loc) { throw unknownOptErr; } } - function has(obj, key) { return Object.prototype.hasOwnProperty.call(obj, key); } - function assertNoDuplicateSourcemap(opts) { if (has(opts, "sourceMap") && has(opts, "sourceMaps")) { throw new Error(".sourceMap is an alias for .sourceMaps, cannot use both"); } } - function assertEnvSet(loc, value) { if (loc.parent.type === "env") { throw new Error(`${(0, _optionAssertions.msg)(loc)} is not allowed inside of another .env block`); } - const parent = loc.parent; const obj = (0, _optionAssertions.assertObject)(loc, value); - if (obj) { for (const envName of Object.keys(obj)) { const env = (0, _optionAssertions.assertObject)((0, _optionAssertions.access)(loc, envName), obj[envName]); @@ -173,22 +154,17 @@ function assertEnvSet(loc, value) { validateNested(envLoc, env); } } - return obj; } - function assertOverridesList(loc, value) { if (loc.parent.type === "env") { throw new Error(`${(0, _optionAssertions.msg)(loc)} is not allowed inside an .env block`); } - if (loc.parent.type === "overrides") { throw new Error(`${(0, _optionAssertions.msg)(loc)} is not allowed inside an .overrides block`); } - const parent = loc.parent; const arr = (0, _optionAssertions.assertArray)(loc, value); - if (arr) { for (const [index, item] of arr.entries()) { const objLoc = (0, _optionAssertions.access)(loc, index); @@ -202,20 +178,16 @@ function assertOverridesList(loc, value) { validateNested(overridesLoc, env); } } - return arr; } - function checkNoUnwrappedItemOptionPairs(items, index, type, e) { if (index === 0) return; const lastItem = items[index - 1]; const thisItem = items[index]; - if (lastItem.file && lastItem.options === undefined && typeof thisItem.value === "object") { e.message += `\n- Maybe you meant to use\n` + `"${type}s": [\n ["${lastItem.file.request}", ${JSON.stringify(thisItem.value, undefined, 2)}]\n]\n` + `To be a valid ${type}, its name and options should be wrapped in a pair of brackets`; } } - 0 && 0; //# sourceMappingURL=options.js.map diff --git a/node_modules/@babel/core/lib/config/validation/options.js.map b/node_modules/@babel/core/lib/config/validation/options.js.map index 684fcdeb5..5e2d81e56 100644 --- a/node_modules/@babel/core/lib/config/validation/options.js.map +++ b/node_modules/@babel/core/lib/config/validation/options.js.map @@ -1 +1 @@ -{"version":3,"names":["ROOT_VALIDATORS","cwd","assertString","root","rootMode","assertRootMode","configFile","assertConfigFileSearch","caller","assertCallerMetadata","filename","filenameRelative","code","assertBoolean","ast","cloneInputAst","envName","BABELRC_VALIDATORS","babelrc","babelrcRoots","assertBabelrcSearch","NONPRESET_VALIDATORS","extends","ignore","assertIgnoreList","only","targets","assertTargets","browserslistConfigFile","browserslistEnv","COMMON_VALIDATORS","inputSourceMap","assertInputSourceMap","presets","assertPluginList","plugins","passPerPreset","assumptions","assertAssumptions","env","assertEnvSet","overrides","assertOverridesList","test","assertConfigApplicableTest","include","exclude","retainLines","comments","shouldPrintComment","assertFunction","compact","assertCompact","minified","auxiliaryCommentBefore","auxiliaryCommentAfter","sourceType","assertSourceType","wrapPluginVisitorMethod","highlightCode","sourceMaps","assertSourceMaps","sourceMap","sourceFileName","sourceRoot","parserOpts","assertObject","generatorOpts","Object","assign","getModuleId","moduleRoot","moduleIds","moduleId","knownAssumptions","assumptionsNames","Set","getSource","loc","type","source","parent","validate","opts","validateNested","error","configError","ConfigError","message","assertNoDuplicateSourcemap","keys","forEach","key","optLoc","name","Error","msg","validator","throwUnknownError","removed","version","unknownOptErr","has","obj","prototype","hasOwnProperty","call","value","access","envLoc","arr","assertArray","index","item","entries","objLoc","overridesLoc","checkNoUnwrappedItemOptionPairs","items","e","lastItem","thisItem","file","options","undefined","request","JSON","stringify"],"sources":["../../../src/config/validation/options.ts"],"sourcesContent":["import type { InputTargets, Targets } from \"@babel/helper-compilation-targets\";\n\nimport type { ConfigItem } from \"../item\";\nimport type Plugin from \"../plugin\";\n\nimport removed from \"./removed\";\nimport {\n msg,\n access,\n assertString,\n assertBoolean,\n assertObject,\n assertArray,\n assertCallerMetadata,\n assertInputSourceMap,\n assertIgnoreList,\n assertPluginList,\n assertConfigApplicableTest,\n assertConfigFileSearch,\n assertBabelrcSearch,\n assertFunction,\n assertRootMode,\n assertSourceMaps,\n assertCompact,\n assertSourceType,\n assertTargets,\n assertAssumptions,\n} from \"./option-assertions\";\nimport type { ValidatorSet, Validator, OptionPath } from \"./option-assertions\";\nimport type { UnloadedDescriptor } from \"../config-descriptors\";\nimport type { ParserOptions } from \"@babel/parser\";\nimport type { GeneratorOptions } from \"@babel/generator\";\nimport ConfigError from \"../../errors/config-error\";\n\nconst ROOT_VALIDATORS: ValidatorSet = {\n cwd: assertString as Validator,\n root: assertString as Validator,\n rootMode: assertRootMode as Validator,\n configFile: assertConfigFileSearch as Validator<\n ValidatedOptions[\"configFile\"]\n >,\n\n caller: assertCallerMetadata as Validator,\n filename: assertString as Validator,\n filenameRelative: assertString as Validator<\n ValidatedOptions[\"filenameRelative\"]\n >,\n code: assertBoolean as Validator,\n ast: assertBoolean as Validator,\n\n cloneInputAst: assertBoolean as Validator,\n\n envName: assertString as Validator,\n};\n\nconst BABELRC_VALIDATORS: ValidatorSet = {\n babelrc: assertBoolean as Validator,\n babelrcRoots: assertBabelrcSearch as Validator<\n ValidatedOptions[\"babelrcRoots\"]\n >,\n};\n\nconst NONPRESET_VALIDATORS: ValidatorSet = {\n extends: assertString as Validator,\n ignore: assertIgnoreList as Validator,\n only: assertIgnoreList as Validator,\n\n targets: assertTargets as Validator,\n browserslistConfigFile: assertConfigFileSearch as Validator<\n ValidatedOptions[\"browserslistConfigFile\"]\n >,\n browserslistEnv: assertString as Validator<\n ValidatedOptions[\"browserslistEnv\"]\n >,\n};\n\nconst COMMON_VALIDATORS: ValidatorSet = {\n // TODO: Should 'inputSourceMap' be moved to be a root-only option?\n // We may want a boolean-only version to be a common option, with the\n // object only allowed as a root config argument.\n inputSourceMap: assertInputSourceMap as Validator<\n ValidatedOptions[\"inputSourceMap\"]\n >,\n presets: assertPluginList as Validator,\n plugins: assertPluginList as Validator,\n passPerPreset: assertBoolean as Validator,\n assumptions: assertAssumptions as Validator,\n\n env: assertEnvSet as Validator,\n overrides: assertOverridesList as Validator,\n\n // We could limit these to 'overrides' blocks, but it's not clear why we'd\n // bother, when the ability to limit a config to a specific set of files\n // is a fairly general useful feature.\n test: assertConfigApplicableTest as Validator,\n include: assertConfigApplicableTest as Validator,\n exclude: assertConfigApplicableTest as Validator,\n\n retainLines: assertBoolean as Validator,\n comments: assertBoolean as Validator,\n shouldPrintComment: assertFunction as Validator<\n ValidatedOptions[\"shouldPrintComment\"]\n >,\n compact: assertCompact as Validator,\n minified: assertBoolean as Validator,\n auxiliaryCommentBefore: assertString as Validator<\n ValidatedOptions[\"auxiliaryCommentBefore\"]\n >,\n auxiliaryCommentAfter: assertString as Validator<\n ValidatedOptions[\"auxiliaryCommentAfter\"]\n >,\n sourceType: assertSourceType as Validator,\n wrapPluginVisitorMethod: assertFunction as Validator<\n ValidatedOptions[\"wrapPluginVisitorMethod\"]\n >,\n highlightCode: assertBoolean as Validator,\n sourceMaps: assertSourceMaps as Validator,\n sourceMap: assertSourceMaps as Validator,\n sourceFileName: assertString as Validator,\n sourceRoot: assertString as Validator,\n parserOpts: assertObject as Validator,\n generatorOpts: assertObject as Validator,\n};\nif (!process.env.BABEL_8_BREAKING) {\n Object.assign(COMMON_VALIDATORS, {\n getModuleId: assertFunction,\n moduleRoot: assertString,\n moduleIds: assertBoolean,\n moduleId: assertString,\n });\n}\n\nexport type InputOptions = ValidatedOptions;\n\nexport type ValidatedOptions = {\n cwd?: string;\n filename?: string;\n filenameRelative?: string;\n babelrc?: boolean;\n babelrcRoots?: BabelrcSearch;\n configFile?: ConfigFileSearch;\n root?: string;\n rootMode?: RootMode;\n code?: boolean;\n ast?: boolean;\n cloneInputAst?: boolean;\n inputSourceMap?: RootInputSourceMapOption;\n envName?: string;\n caller?: CallerMetadata;\n extends?: string;\n env?: EnvSet;\n ignore?: IgnoreList;\n only?: IgnoreList;\n overrides?: OverridesList;\n // Generally verify if a given config object should be applied to the given file.\n test?: ConfigApplicableTest;\n include?: ConfigApplicableTest;\n exclude?: ConfigApplicableTest;\n presets?: PluginList;\n plugins?: PluginList;\n passPerPreset?: boolean;\n assumptions?: {\n [name: string]: boolean;\n };\n // browserslists-related options\n targets?: TargetsListOrObject;\n browserslistConfigFile?: ConfigFileSearch;\n browserslistEnv?: string;\n // Options for @babel/generator\n retainLines?: boolean;\n comments?: boolean;\n shouldPrintComment?: Function;\n compact?: CompactOption;\n minified?: boolean;\n auxiliaryCommentBefore?: string;\n auxiliaryCommentAfter?: string;\n // Parser\n sourceType?: SourceTypeOption;\n wrapPluginVisitorMethod?: Function;\n highlightCode?: boolean;\n // Sourcemap generation options.\n sourceMaps?: SourceMapsOption;\n sourceMap?: SourceMapsOption;\n sourceFileName?: string;\n sourceRoot?: string;\n // Deprecate top level parserOpts\n parserOpts?: ParserOptions;\n // Deprecate top level generatorOpts\n generatorOpts?: GeneratorOptions;\n};\n\nexport type NormalizedOptions = {\n readonly targets: Targets;\n} & Omit;\n\nexport type CallerMetadata = {\n // If 'caller' is specified, require that the name is given for debugging\n // messages.\n name: string;\n};\nexport type EnvSet = {\n [x: string]: T;\n};\nexport type IgnoreItem =\n | string\n | RegExp\n | ((\n path: string | undefined,\n context: { dirname: string; caller: CallerMetadata; envName: string },\n ) => unknown);\nexport type IgnoreList = ReadonlyArray;\n\nexport type PluginOptions = object | void | false;\nexport type PluginTarget = string | object | Function;\nexport type PluginItem =\n | ConfigItem\n | Plugin\n | PluginTarget\n | [PluginTarget, PluginOptions]\n | [PluginTarget, PluginOptions, string | void];\nexport type PluginList = ReadonlyArray;\n\nexport type OverridesList = Array;\nexport type ConfigApplicableTest = IgnoreItem | Array;\n\nexport type ConfigFileSearch = string | boolean;\nexport type BabelrcSearch = boolean | IgnoreItem | IgnoreList;\nexport type SourceMapsOption = boolean | \"inline\" | \"both\";\nexport type SourceTypeOption = \"module\" | \"script\" | \"unambiguous\";\nexport type CompactOption = boolean | \"auto\";\nexport type RootInputSourceMapOption = {} | boolean;\nexport type RootMode = \"root\" | \"upward\" | \"upward-optional\";\n\nexport type TargetsListOrObject =\n | Targets\n | InputTargets\n | InputTargets[\"browsers\"];\n\nexport type OptionsSource =\n | \"arguments\"\n | \"configfile\"\n | \"babelrcfile\"\n | \"extendsfile\"\n | \"preset\"\n | \"plugin\";\n\nexport type RootPath = Readonly<{\n type: \"root\";\n source: OptionsSource;\n}>;\n\ntype OverridesPath = Readonly<{\n type: \"overrides\";\n index: number;\n parent: RootPath;\n}>;\n\ntype EnvPath = Readonly<{\n type: \"env\";\n name: string;\n parent: RootPath | OverridesPath;\n}>;\n\nexport type NestingPath = RootPath | OverridesPath | EnvPath;\n\nconst knownAssumptions = [\n \"arrayLikeIsIterable\",\n \"constantReexports\",\n \"constantSuper\",\n \"enumerableModuleMeta\",\n \"ignoreFunctionLength\",\n \"ignoreToPrimitiveHint\",\n \"iterableIsArray\",\n \"mutableTemplateObject\",\n \"noClassCalls\",\n \"noDocumentAll\",\n \"noIncompleteNsImportDetection\",\n \"noNewArrows\",\n \"objectRestNoSymbols\",\n \"privateFieldsAsProperties\",\n \"pureGetters\",\n \"setClassMethods\",\n \"setComputedProperties\",\n \"setPublicClassFields\",\n \"setSpreadProperties\",\n \"skipForOfIteratorClosing\",\n \"superIsCallableConstructor\",\n] as const;\nexport type AssumptionName = typeof knownAssumptions[number];\nexport const assumptionsNames = new Set(knownAssumptions);\n\nfunction getSource(loc: NestingPath): OptionsSource {\n return loc.type === \"root\" ? loc.source : getSource(loc.parent);\n}\n\nexport function validate(\n type: OptionsSource,\n opts: {},\n filename?: string,\n): ValidatedOptions {\n try {\n return validateNested(\n {\n type: \"root\",\n source: type,\n },\n opts,\n );\n } catch (error) {\n const configError = new ConfigError(error.message, filename);\n // @ts-expect-error TODO: .code is not defined on ConfigError or Error\n if (error.code) configError.code = error.code;\n throw configError;\n }\n}\n\nfunction validateNested(loc: NestingPath, opts: { [key: string]: unknown }) {\n const type = getSource(loc);\n\n assertNoDuplicateSourcemap(opts);\n\n Object.keys(opts).forEach((key: string) => {\n const optLoc = {\n type: \"option\",\n name: key,\n parent: loc,\n } as const;\n\n if (type === \"preset\" && NONPRESET_VALIDATORS[key]) {\n throw new Error(`${msg(optLoc)} is not allowed in preset options`);\n }\n if (type !== \"arguments\" && ROOT_VALIDATORS[key]) {\n throw new Error(\n `${msg(optLoc)} is only allowed in root programmatic options`,\n );\n }\n if (\n type !== \"arguments\" &&\n type !== \"configfile\" &&\n BABELRC_VALIDATORS[key]\n ) {\n if (type === \"babelrcfile\" || type === \"extendsfile\") {\n throw new Error(\n `${msg(\n optLoc,\n )} is not allowed in .babelrc or \"extends\"ed files, only in root programmatic options, ` +\n `or babel.config.js/config file options`,\n );\n }\n\n throw new Error(\n `${msg(\n optLoc,\n )} is only allowed in root programmatic options, or babel.config.js/config file options`,\n );\n }\n\n const validator =\n COMMON_VALIDATORS[key] ||\n NONPRESET_VALIDATORS[key] ||\n BABELRC_VALIDATORS[key] ||\n ROOT_VALIDATORS[key] ||\n (throwUnknownError as Validator);\n\n validator(optLoc, opts[key]);\n });\n\n return opts;\n}\n\nfunction throwUnknownError(loc: OptionPath) {\n const key = loc.name;\n\n if (removed[key]) {\n const { message, version = 5 } = removed[key];\n\n throw new Error(\n `Using removed Babel ${version} option: ${msg(loc)} - ${message}`,\n );\n } else {\n // eslint-disable-next-line max-len\n const unknownOptErr = new Error(\n `Unknown option: ${msg(\n loc,\n )}. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.`,\n );\n // @ts-expect-error todo(flow->ts): consider creating something like BabelConfigError with code field in it\n unknownOptErr.code = \"BABEL_UNKNOWN_OPTION\";\n\n throw unknownOptErr;\n }\n}\n\nfunction has(obj: {}, key: string) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nfunction assertNoDuplicateSourcemap(opts: {}): void {\n if (has(opts, \"sourceMap\") && has(opts, \"sourceMaps\")) {\n throw new Error(\".sourceMap is an alias for .sourceMaps, cannot use both\");\n }\n}\n\nfunction assertEnvSet(\n loc: OptionPath,\n value: unknown,\n): void | EnvSet {\n if (loc.parent.type === \"env\") {\n throw new Error(`${msg(loc)} is not allowed inside of another .env block`);\n }\n const parent: RootPath | OverridesPath = loc.parent;\n\n const obj = assertObject(loc, value);\n if (obj) {\n // Validate but don't copy the .env object in order to preserve\n // object identity for use during config chain processing.\n for (const envName of Object.keys(obj)) {\n const env = assertObject(access(loc, envName), obj[envName]);\n if (!env) continue;\n\n const envLoc = {\n type: \"env\",\n name: envName,\n parent,\n } as const;\n validateNested(envLoc, env);\n }\n }\n return obj;\n}\n\nfunction assertOverridesList(\n loc: OptionPath,\n value: unknown[],\n): undefined | OverridesList {\n if (loc.parent.type === \"env\") {\n throw new Error(`${msg(loc)} is not allowed inside an .env block`);\n }\n if (loc.parent.type === \"overrides\") {\n throw new Error(`${msg(loc)} is not allowed inside an .overrides block`);\n }\n const parent: RootPath = loc.parent;\n\n const arr = assertArray(loc, value);\n if (arr) {\n for (const [index, item] of arr.entries()) {\n const objLoc = access(loc, index);\n const env = assertObject(objLoc, item);\n if (!env) throw new Error(`${msg(objLoc)} must be an object`);\n\n const overridesLoc = {\n type: \"overrides\",\n index,\n parent,\n } as const;\n validateNested(overridesLoc, env);\n }\n }\n return arr as OverridesList;\n}\n\nexport function checkNoUnwrappedItemOptionPairs(\n items: Array,\n index: number,\n type: \"plugin\" | \"preset\",\n e: Error,\n): void {\n if (index === 0) return;\n\n const lastItem = items[index - 1];\n const thisItem = items[index];\n\n if (\n lastItem.file &&\n lastItem.options === undefined &&\n typeof thisItem.value === \"object\"\n ) {\n e.message +=\n `\\n- Maybe you meant to use\\n` +\n `\"${type}s\": [\\n [\"${lastItem.file.request}\", ${JSON.stringify(\n thisItem.value,\n undefined,\n 2,\n )}]\\n]\\n` +\n `To be a valid ${type}, its name and options should be wrapped in a pair of brackets`;\n }\n}\n"],"mappings":";;;;;;;;;AAKA;;AACA;;AA0BA;;AAEA,MAAMA,eAA6B,GAAG;EACpCC,GAAG,EAAEC,8BAD+B;EAEpCC,IAAI,EAAED,8BAF8B;EAGpCE,QAAQ,EAAEC,gCAH0B;EAIpCC,UAAU,EAAEC,wCAJwB;EAQpCC,MAAM,EAAEC,sCAR4B;EASpCC,QAAQ,EAAER,8BAT0B;EAUpCS,gBAAgB,EAAET,8BAVkB;EAapCU,IAAI,EAAEC,+BAb8B;EAcpCC,GAAG,EAAED,+BAd+B;EAgBpCE,aAAa,EAAEF,+BAhBqB;EAkBpCG,OAAO,EAAEd;AAlB2B,CAAtC;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AAqBF,IAArB,CAAZ;MACA,IAAI,CAAC1E,GAAL,EAAU,MAAM,IAAIwD,KAAJ,CAAW,GAAE,IAAAC,qBAAA,EAAImB,MAAJ,CAAY,oBAAzB,CAAN;MAEV,MAAMC,YAAY,GAAG;QACnBrC,IAAI,EAAE,WADa;QAEnBiC,KAFmB;QAGnB/B;MAHmB,CAArB;MAKAG,cAAc,CAACgC,YAAD,EAAe7E,GAAf,CAAd;IACD;EACF;;EACD,OAAOuE,GAAP;AACD;;AAEM,SAASO,+BAAT,CACLC,KADK,EAELN,KAFK,EAGLjC,IAHK,EAILwC,CAJK,EAKC;EACN,IAAIP,KAAK,KAAK,CAAd,EAAiB;EAEjB,MAAMQ,QAAQ,GAAGF,KAAK,CAACN,KAAK,GAAG,CAAT,CAAtB;EACA,MAAMS,QAAQ,GAAGH,KAAK,CAACN,KAAD,CAAtB;;EAEA,IACEQ,QAAQ,CAACE,IAAT,IACAF,QAAQ,CAACG,OAAT,KAAqBC,SADrB,IAEA,OAAOH,QAAQ,CAACd,KAAhB,KAA0B,QAH5B,EAIE;IACAY,CAAC,CAAC/B,OAAF,IACG,8BAAD,GACC,IAAGT,IAAK,cAAayC,QAAQ,CAACE,IAAT,CAAcG,OAAQ,MAAKC,IAAI,CAACC,SAAL,CAC/CN,QAAQ,CAACd,KADsC,EAE/CiB,SAF+C,EAG/C,CAH+C,CAI/C,QALF,GAMC,iBAAgB7C,IAAK,gEAPxB;EAQD;AACF"} \ No newline at end of file +{"version":3,"names":["ROOT_VALIDATORS","cwd","assertString","root","rootMode","assertRootMode","configFile","assertConfigFileSearch","caller","assertCallerMetadata","filename","filenameRelative","code","assertBoolean","ast","cloneInputAst","envName","BABELRC_VALIDATORS","babelrc","babelrcRoots","assertBabelrcSearch","NONPRESET_VALIDATORS","extends","ignore","assertIgnoreList","only","targets","assertTargets","browserslistConfigFile","browserslistEnv","COMMON_VALIDATORS","inputSourceMap","assertInputSourceMap","presets","assertPluginList","plugins","passPerPreset","assumptions","assertAssumptions","env","assertEnvSet","overrides","assertOverridesList","test","assertConfigApplicableTest","include","exclude","retainLines","comments","shouldPrintComment","assertFunction","compact","assertCompact","minified","auxiliaryCommentBefore","auxiliaryCommentAfter","sourceType","assertSourceType","wrapPluginVisitorMethod","highlightCode","sourceMaps","assertSourceMaps","sourceMap","sourceFileName","sourceRoot","parserOpts","assertObject","generatorOpts","Object","assign","getModuleId","moduleRoot","moduleIds","moduleId","knownAssumptions","assumptionsNames","Set","getSource","loc","type","source","parent","validate","opts","validateNested","error","configError","ConfigError","message","assertNoDuplicateSourcemap","keys","forEach","key","optLoc","name","Error","msg","validator","throwUnknownError","removed","version","unknownOptErr","has","obj","prototype","hasOwnProperty","call","value","access","envLoc","arr","assertArray","index","item","entries","objLoc","overridesLoc","checkNoUnwrappedItemOptionPairs","items","e","lastItem","thisItem","file","options","undefined","request","JSON","stringify"],"sources":["../../../src/config/validation/options.ts"],"sourcesContent":["import type { InputTargets, Targets } from \"@babel/helper-compilation-targets\";\n\nimport type { ConfigItem } from \"../item\";\nimport type Plugin from \"../plugin\";\n\nimport removed from \"./removed\";\nimport {\n msg,\n access,\n assertString,\n assertBoolean,\n assertObject,\n assertArray,\n assertCallerMetadata,\n assertInputSourceMap,\n assertIgnoreList,\n assertPluginList,\n assertConfigApplicableTest,\n assertConfigFileSearch,\n assertBabelrcSearch,\n assertFunction,\n assertRootMode,\n assertSourceMaps,\n assertCompact,\n assertSourceType,\n assertTargets,\n assertAssumptions,\n} from \"./option-assertions\";\nimport type { ValidatorSet, Validator, OptionPath } from \"./option-assertions\";\nimport type { UnloadedDescriptor } from \"../config-descriptors\";\nimport type { ParserOptions } from \"@babel/parser\";\nimport type { GeneratorOptions } from \"@babel/generator\";\nimport ConfigError from \"../../errors/config-error\";\n\nconst ROOT_VALIDATORS: ValidatorSet = {\n cwd: assertString as Validator,\n root: assertString as Validator,\n rootMode: assertRootMode as Validator,\n configFile: assertConfigFileSearch as Validator<\n ValidatedOptions[\"configFile\"]\n >,\n\n caller: assertCallerMetadata as Validator,\n filename: assertString as Validator,\n filenameRelative: assertString as Validator<\n ValidatedOptions[\"filenameRelative\"]\n >,\n code: assertBoolean as Validator,\n ast: assertBoolean as Validator,\n\n cloneInputAst: assertBoolean as Validator,\n\n envName: assertString as Validator,\n};\n\nconst BABELRC_VALIDATORS: ValidatorSet = {\n babelrc: assertBoolean as Validator,\n babelrcRoots: assertBabelrcSearch as Validator<\n ValidatedOptions[\"babelrcRoots\"]\n >,\n};\n\nconst NONPRESET_VALIDATORS: ValidatorSet = {\n extends: assertString as Validator,\n ignore: assertIgnoreList as Validator,\n only: assertIgnoreList as Validator,\n\n targets: assertTargets as Validator,\n browserslistConfigFile: assertConfigFileSearch as Validator<\n ValidatedOptions[\"browserslistConfigFile\"]\n >,\n browserslistEnv: assertString as Validator<\n ValidatedOptions[\"browserslistEnv\"]\n >,\n};\n\nconst COMMON_VALIDATORS: ValidatorSet = {\n // TODO: Should 'inputSourceMap' be moved to be a root-only option?\n // We may want a boolean-only version to be a common option, with the\n // object only allowed as a root config argument.\n inputSourceMap: assertInputSourceMap as Validator<\n ValidatedOptions[\"inputSourceMap\"]\n >,\n presets: assertPluginList as Validator,\n plugins: assertPluginList as Validator,\n passPerPreset: assertBoolean as Validator,\n assumptions: assertAssumptions as Validator,\n\n env: assertEnvSet as Validator,\n overrides: assertOverridesList as Validator,\n\n // We could limit these to 'overrides' blocks, but it's not clear why we'd\n // bother, when the ability to limit a config to a specific set of files\n // is a fairly general useful feature.\n test: assertConfigApplicableTest as Validator,\n include: assertConfigApplicableTest as Validator,\n exclude: assertConfigApplicableTest as Validator,\n\n retainLines: assertBoolean as Validator,\n comments: assertBoolean as Validator,\n shouldPrintComment: assertFunction as Validator<\n ValidatedOptions[\"shouldPrintComment\"]\n >,\n compact: assertCompact as Validator,\n minified: assertBoolean as Validator,\n auxiliaryCommentBefore: assertString as Validator<\n ValidatedOptions[\"auxiliaryCommentBefore\"]\n >,\n auxiliaryCommentAfter: assertString as Validator<\n ValidatedOptions[\"auxiliaryCommentAfter\"]\n >,\n sourceType: assertSourceType as Validator,\n wrapPluginVisitorMethod: assertFunction as Validator<\n ValidatedOptions[\"wrapPluginVisitorMethod\"]\n >,\n highlightCode: assertBoolean as Validator,\n sourceMaps: assertSourceMaps as Validator,\n sourceMap: assertSourceMaps as Validator,\n sourceFileName: assertString as Validator,\n sourceRoot: assertString as Validator,\n parserOpts: assertObject as Validator,\n generatorOpts: assertObject as Validator,\n};\nif (!process.env.BABEL_8_BREAKING) {\n Object.assign(COMMON_VALIDATORS, {\n getModuleId: assertFunction,\n moduleRoot: assertString,\n moduleIds: assertBoolean,\n moduleId: assertString,\n });\n}\n\nexport type InputOptions = ValidatedOptions;\n\nexport type ValidatedOptions = {\n cwd?: string;\n filename?: string;\n filenameRelative?: string;\n babelrc?: boolean;\n babelrcRoots?: BabelrcSearch;\n configFile?: ConfigFileSearch;\n root?: string;\n rootMode?: RootMode;\n code?: boolean;\n ast?: boolean;\n cloneInputAst?: boolean;\n inputSourceMap?: RootInputSourceMapOption;\n envName?: string;\n caller?: CallerMetadata;\n extends?: string;\n env?: EnvSet;\n ignore?: IgnoreList;\n only?: IgnoreList;\n overrides?: OverridesList;\n // Generally verify if a given config object should be applied to the given file.\n test?: ConfigApplicableTest;\n include?: ConfigApplicableTest;\n exclude?: ConfigApplicableTest;\n presets?: PluginList;\n plugins?: PluginList;\n passPerPreset?: boolean;\n assumptions?: {\n [name: string]: boolean;\n };\n // browserslists-related options\n targets?: TargetsListOrObject;\n browserslistConfigFile?: ConfigFileSearch;\n browserslistEnv?: string;\n // Options for @babel/generator\n retainLines?: boolean;\n comments?: boolean;\n shouldPrintComment?: Function;\n compact?: CompactOption;\n minified?: boolean;\n auxiliaryCommentBefore?: string;\n auxiliaryCommentAfter?: string;\n // Parser\n sourceType?: SourceTypeOption;\n wrapPluginVisitorMethod?: Function;\n highlightCode?: boolean;\n // Sourcemap generation options.\n sourceMaps?: SourceMapsOption;\n sourceMap?: SourceMapsOption;\n sourceFileName?: string;\n sourceRoot?: string;\n // Deprecate top level parserOpts\n parserOpts?: ParserOptions;\n // Deprecate top level generatorOpts\n generatorOpts?: GeneratorOptions;\n};\n\nexport type NormalizedOptions = {\n readonly targets: Targets;\n} & Omit;\n\nexport type CallerMetadata = {\n // If 'caller' is specified, require that the name is given for debugging\n // messages.\n name: string;\n};\nexport type EnvSet = {\n [x: string]: T;\n};\nexport type IgnoreItem =\n | string\n | RegExp\n | ((\n path: string | undefined,\n context: { dirname: string; caller: CallerMetadata; envName: string },\n ) => unknown);\nexport type IgnoreList = ReadonlyArray;\n\nexport type PluginOptions = object | void | false;\nexport type PluginTarget = string | object | Function;\nexport type PluginItem =\n | ConfigItem\n | Plugin\n | PluginTarget\n | [PluginTarget, PluginOptions]\n | [PluginTarget, PluginOptions, string | void];\nexport type PluginList = ReadonlyArray;\n\nexport type OverridesList = Array;\nexport type ConfigApplicableTest = IgnoreItem | Array;\n\nexport type ConfigFileSearch = string | boolean;\nexport type BabelrcSearch = boolean | IgnoreItem | IgnoreList;\nexport type SourceMapsOption = boolean | \"inline\" | \"both\";\nexport type SourceTypeOption = \"module\" | \"script\" | \"unambiguous\";\nexport type CompactOption = boolean | \"auto\";\nexport type RootInputSourceMapOption = {} | boolean;\nexport type RootMode = \"root\" | \"upward\" | \"upward-optional\";\n\nexport type TargetsListOrObject =\n | Targets\n | InputTargets\n | InputTargets[\"browsers\"];\n\nexport type OptionsSource =\n | \"arguments\"\n | \"configfile\"\n | \"babelrcfile\"\n | \"extendsfile\"\n | \"preset\"\n | \"plugin\";\n\nexport type RootPath = Readonly<{\n type: \"root\";\n source: OptionsSource;\n}>;\n\ntype OverridesPath = Readonly<{\n type: \"overrides\";\n index: number;\n parent: RootPath;\n}>;\n\ntype EnvPath = Readonly<{\n type: \"env\";\n name: string;\n parent: RootPath | OverridesPath;\n}>;\n\nexport type NestingPath = RootPath | OverridesPath | EnvPath;\n\nconst knownAssumptions = [\n \"arrayLikeIsIterable\",\n \"constantReexports\",\n \"constantSuper\",\n \"enumerableModuleMeta\",\n \"ignoreFunctionLength\",\n \"ignoreToPrimitiveHint\",\n \"iterableIsArray\",\n \"mutableTemplateObject\",\n \"noClassCalls\",\n \"noDocumentAll\",\n \"noIncompleteNsImportDetection\",\n \"noNewArrows\",\n \"objectRestNoSymbols\",\n \"privateFieldsAsProperties\",\n \"pureGetters\",\n \"setClassMethods\",\n \"setComputedProperties\",\n \"setPublicClassFields\",\n \"setSpreadProperties\",\n \"skipForOfIteratorClosing\",\n \"superIsCallableConstructor\",\n] as const;\nexport type AssumptionName = typeof knownAssumptions[number];\nexport const assumptionsNames = new Set(knownAssumptions);\n\nfunction getSource(loc: NestingPath): OptionsSource {\n return loc.type === \"root\" ? loc.source : getSource(loc.parent);\n}\n\nexport function validate(\n type: OptionsSource,\n opts: {},\n filename?: string,\n): ValidatedOptions {\n try {\n return validateNested(\n {\n type: \"root\",\n source: type,\n },\n opts,\n );\n } catch (error) {\n const configError = new ConfigError(error.message, filename);\n // @ts-expect-error TODO: .code is not defined on ConfigError or Error\n if (error.code) configError.code = error.code;\n throw configError;\n }\n}\n\nfunction validateNested(loc: NestingPath, opts: { [key: string]: unknown }) {\n const type = getSource(loc);\n\n assertNoDuplicateSourcemap(opts);\n\n Object.keys(opts).forEach((key: string) => {\n const optLoc = {\n type: \"option\",\n name: key,\n parent: loc,\n } as const;\n\n if (type === \"preset\" && NONPRESET_VALIDATORS[key]) {\n throw new Error(`${msg(optLoc)} is not allowed in preset options`);\n }\n if (type !== \"arguments\" && ROOT_VALIDATORS[key]) {\n throw new Error(\n `${msg(optLoc)} is only allowed in root programmatic options`,\n );\n }\n if (\n type !== \"arguments\" &&\n type !== \"configfile\" &&\n BABELRC_VALIDATORS[key]\n ) {\n if (type === \"babelrcfile\" || type === \"extendsfile\") {\n throw new Error(\n `${msg(\n optLoc,\n )} is not allowed in .babelrc or \"extends\"ed files, only in root programmatic options, ` +\n `or babel.config.js/config file options`,\n );\n }\n\n throw new Error(\n `${msg(\n optLoc,\n )} is only allowed in root programmatic options, or babel.config.js/config file options`,\n );\n }\n\n const validator =\n COMMON_VALIDATORS[key] ||\n NONPRESET_VALIDATORS[key] ||\n BABELRC_VALIDATORS[key] ||\n ROOT_VALIDATORS[key] ||\n (throwUnknownError as Validator);\n\n validator(optLoc, opts[key]);\n });\n\n return opts;\n}\n\nfunction throwUnknownError(loc: OptionPath) {\n const key = loc.name;\n\n if (removed[key]) {\n const { message, version = 5 } = removed[key];\n\n throw new Error(\n `Using removed Babel ${version} option: ${msg(loc)} - ${message}`,\n );\n } else {\n // eslint-disable-next-line max-len\n const unknownOptErr = new Error(\n `Unknown option: ${msg(\n loc,\n )}. Check out https://babeljs.io/docs/en/babel-core/#options for more information about options.`,\n );\n // @ts-expect-error todo(flow->ts): consider creating something like BabelConfigError with code field in it\n unknownOptErr.code = \"BABEL_UNKNOWN_OPTION\";\n\n throw unknownOptErr;\n }\n}\n\nfunction has(obj: {}, key: string) {\n return Object.prototype.hasOwnProperty.call(obj, key);\n}\n\nfunction assertNoDuplicateSourcemap(opts: {}): void {\n if (has(opts, \"sourceMap\") && has(opts, \"sourceMaps\")) {\n throw new Error(\".sourceMap is an alias for .sourceMaps, cannot use both\");\n }\n}\n\nfunction assertEnvSet(\n loc: OptionPath,\n value: unknown,\n): void | EnvSet {\n if (loc.parent.type === \"env\") {\n throw new Error(`${msg(loc)} is not allowed inside of another .env block`);\n }\n const parent: RootPath | OverridesPath = loc.parent;\n\n const obj = assertObject(loc, value);\n if (obj) {\n // Validate but don't copy the .env object in order to preserve\n // object identity for use during config chain processing.\n for (const envName of Object.keys(obj)) {\n const env = assertObject(access(loc, envName), obj[envName]);\n if (!env) continue;\n\n const envLoc = {\n type: \"env\",\n name: envName,\n parent,\n } as const;\n validateNested(envLoc, env);\n }\n }\n return obj;\n}\n\nfunction assertOverridesList(\n loc: OptionPath,\n value: unknown[],\n): undefined | OverridesList {\n if (loc.parent.type === \"env\") {\n throw new Error(`${msg(loc)} is not allowed inside an .env block`);\n }\n if (loc.parent.type === \"overrides\") {\n throw new Error(`${msg(loc)} is not allowed inside an .overrides block`);\n }\n const parent: RootPath = loc.parent;\n\n const arr = assertArray(loc, value);\n if (arr) {\n for (const [index, item] of arr.entries()) {\n const objLoc = access(loc, index);\n const env = assertObject(objLoc, item);\n if (!env) throw new Error(`${msg(objLoc)} must be an object`);\n\n const overridesLoc = {\n type: \"overrides\",\n index,\n parent,\n } as const;\n validateNested(overridesLoc, env);\n }\n }\n return arr as OverridesList;\n}\n\nexport function checkNoUnwrappedItemOptionPairs(\n items: Array,\n index: number,\n type: \"plugin\" | \"preset\",\n e: Error,\n): void {\n if (index === 0) return;\n\n const lastItem = items[index - 1];\n const thisItem = items[index];\n\n if (\n lastItem.file &&\n lastItem.options === undefined &&\n typeof thisItem.value === \"object\"\n ) {\n e.message +=\n `\\n- Maybe you meant to use\\n` +\n `\"${type}s\": [\\n [\"${lastItem.file.request}\", ${JSON.stringify(\n thisItem.value,\n undefined,\n 2,\n )}]\\n]\\n` +\n `To be a valid ${type}, its name and options should be wrapped in a pair of brackets`;\n }\n}\n"],"mappings":";;;;;;;;AAKA;AACA;AA0BA;AAEA,MAAMA,eAA6B,GAAG;EACpCC,GAAG,EAAEC,8BAAkD;EACvDC,IAAI,EAAED,8BAAmD;EACzDE,QAAQ,EAAEC,gCAAyD;EACnEC,UAAU,EAAEC,wCAEX;EAEDC,MAAM,EAAEC,sCAA6D;EACrEC,QAAQ,EAAER,8BAAuD;EACjES,gBAAgB,EAAET,8BAEjB;EACDU,IAAI,EAAEC,+BAAoD;EAC1DC,GAAG,EAAED,+BAAmD;EAExDE,aAAa,EAAEF,+BAA6D;EAE5EG,OAAO,EAAEd;AACX,CAAC;AAED,MAAMe,kBAAgC,GAAG;EACvCC,OAAO,EAAEL,+BAAuD;EAChEM,YAAY,EAAEC;AAGhB,CAAC;AAED,MAAMC,oBAAkC,GAAG;EACzCC,OAAO,EAAEpB,8BAAsD;EA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ACzBwC,CAAQ,EACF;EACN,IAAIP,KAAK,KAAK,CAAC,EAAE;EAEjB,MAAMQ,QAAQ,GAAGF,KAAK,CAACN,KAAK,GAAG,CAAC,CAAC;EACjC,MAAMS,QAAQ,GAAGH,KAAK,CAACN,KAAK,CAAC;EAE7B,IACEQ,QAAQ,CAACE,IAAI,IACbF,QAAQ,CAACG,OAAO,KAAKC,SAAS,IAC9B,OAAOH,QAAQ,CAACd,KAAK,KAAK,QAAQ,EAClC;IACAY,CAAC,CAAC/B,OAAO,IACN,8BAA6B,GAC7B,IAAGT,IAAK,cAAayC,QAAQ,CAACE,IAAI,CAACG,OAAQ,MAAKC,IAAI,CAACC,SAAS,CAC7DN,QAAQ,CAACd,KAAK,EACdiB,SAAS,EACT,CAAC,CACD,QAAO,GACR,iBAAgB7C,IAAK,gEAA+D;EACzF;AACF;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/validation/plugins.js b/node_modules/@babel/core/lib/config/validation/plugins.js index ec8389665..6ea3a0dc0 100644 --- a/node_modules/@babel/core/lib/config/validation/plugins.js +++ b/node_modules/@babel/core/lib/config/validation/plugins.js @@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.validatePluginObject = validatePluginObject; - var _optionAssertions = require("./option-assertions"); - const VALIDATORS = { name: _optionAssertions.assertString, manipulateOptions: _optionAssertions.assertFunction, @@ -17,21 +15,16 @@ const VALIDATORS = { parserOverride: _optionAssertions.assertFunction, generatorOverride: _optionAssertions.assertFunction }; - function assertVisitorMap(loc, value) { const obj = (0, _optionAssertions.assertObject)(loc, value); - if (obj) { Object.keys(obj).forEach(prop => assertVisitorHandler(prop, obj[prop])); - if (obj.enter || obj.exit) { throw new Error(`${(0, _optionAssertions.msg)(loc)} cannot contain catch-all "enter" or "exit" handlers. Please target individual nodes.`); } } - return obj; } - function assertVisitorHandler(key, value) { if (value && typeof value === "object") { Object.keys(value).forEach(handler => { @@ -42,10 +35,8 @@ function assertVisitorHandler(key, value) { } else if (typeof value !== "function") { throw new Error(`.visitor["${key}"] must be a function`); } - return value; } - function validatePluginObject(obj) { const rootPath = { type: "root", @@ -53,7 +44,6 @@ function validatePluginObject(obj) { }; Object.keys(obj).forEach(key => { const validator = VALIDATORS[key]; - if (validator) { const optLoc = { type: "option", @@ -69,7 +59,6 @@ function validatePluginObject(obj) { }); return obj; } - 0 && 0; //# sourceMappingURL=plugins.js.map diff --git a/node_modules/@babel/core/lib/config/validation/plugins.js.map b/node_modules/@babel/core/lib/config/validation/plugins.js.map index 50121cdd7..fbaf16edd 100644 --- a/node_modules/@babel/core/lib/config/validation/plugins.js.map +++ b/node_modules/@babel/core/lib/config/validation/plugins.js.map @@ -1 +1 @@ -{"version":3,"names":["VALIDATORS","name","assertString","manipulateOptions","assertFunction","pre","post","inherits","visitor","assertVisitorMap","parserOverride","generatorOverride","loc","value","obj","assertObject","Object","keys","forEach","prop","assertVisitorHandler","enter","exit","Error","msg","key","handler","validatePluginObject","rootPath","type","source","validator","optLoc","parent","invalidPluginPropertyError","code"],"sources":["../../../src/config/validation/plugins.ts"],"sourcesContent":["import {\n assertString,\n assertFunction,\n assertObject,\n msg,\n} from \"./option-assertions\";\n\nimport type {\n ValidatorSet,\n Validator,\n OptionPath,\n RootPath,\n} from \"./option-assertions\";\nimport type { ParserOptions } from \"@babel/parser\";\nimport type { Visitor } from \"@babel/traverse\";\nimport type { ValidatedOptions } from \"./options\";\nimport type { File, PluginPass } from \"../../index\";\n\n// Note: The casts here are just meant to be static assertions to make sure\n// that the assertion functions actually assert that the value's type matches\n// the declared types.\nconst VALIDATORS: ValidatorSet = {\n name: assertString as Validator,\n manipulateOptions: assertFunction as Validator<\n PluginObject[\"manipulateOptions\"]\n >,\n pre: assertFunction as Validator,\n post: assertFunction as Validator,\n inherits: assertFunction as Validator,\n visitor: assertVisitorMap as Validator,\n\n parserOverride: assertFunction as Validator,\n generatorOverride: assertFunction as Validator<\n PluginObject[\"generatorOverride\"]\n >,\n};\n\nfunction assertVisitorMap(loc: OptionPath, value: unknown): Visitor {\n const obj = assertObject(loc, value);\n if (obj) {\n Object.keys(obj).forEach(prop => assertVisitorHandler(prop, obj[prop]));\n\n if (obj.enter || obj.exit) {\n throw new Error(\n `${msg(\n loc,\n )} cannot contain catch-all \"enter\" or \"exit\" handlers. Please target individual nodes.`,\n );\n }\n }\n return obj as Visitor;\n}\n\nfunction assertVisitorHandler(\n key: string,\n value: unknown,\n): VisitorHandler | void {\n if (value && typeof value === \"object\") {\n Object.keys(value).forEach((handler: string) => {\n if (handler !== \"enter\" && handler !== \"exit\") {\n throw new Error(\n `.visitor[\"${key}\"] may only have .enter and/or .exit handlers.`,\n );\n }\n });\n } else if (typeof value !== \"function\") {\n throw new Error(`.visitor[\"${key}\"] must be a function`);\n }\n\n return value as any;\n}\n\ntype VisitorHandler =\n | Function\n | {\n enter?: Function;\n exit?: Function;\n };\n\nexport type PluginObject = {\n name?: string;\n manipulateOptions?: (\n options: ValidatedOptions,\n parserOpts: ParserOptions,\n ) => void;\n pre?: (this: S, file: File) => void;\n post?: (this: S, file: File) => void;\n inherits?: Function;\n visitor?: Visitor;\n parserOverride?: Function;\n generatorOverride?: Function;\n};\n\nexport function validatePluginObject(obj: {\n [key: string]: unknown;\n}): PluginObject {\n const rootPath: RootPath = {\n type: \"root\",\n source: \"plugin\",\n };\n Object.keys(obj).forEach((key: string) => {\n const validator = VALIDATORS[key];\n\n if (validator) {\n const optLoc: OptionPath = {\n type: \"option\",\n name: key,\n parent: rootPath,\n };\n validator(optLoc, obj[key]);\n } else {\n const invalidPluginPropertyError = new Error(\n `.${key} is not a valid Plugin property`,\n );\n // @ts-expect-error todo(flow->ts) consider additing BabelConfigError with code field\n invalidPluginPropertyError.code = \"BABEL_UNKNOWN_PLUGIN_PROPERTY\";\n throw invalidPluginPropertyError;\n }\n });\n\n return obj as any;\n}\n"],"mappings":";;;;;;;AAAA;;AAqBA,MAAMA,UAAwB,GAAG;EAC/BC,IAAI,EAAEC,8BADy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AMc,QAAkB,GAAG;IACzBC,IAAI,EAAE,MADmB;IAEzBC,MAAM,EAAE;EAFiB,CAA3B;EAIAd,MAAM,CAACC,IAAP,CAAYH,GAAZ,EAAiBI,OAAjB,CAA0BO,GAAD,IAAiB;IACxC,MAAMM,SAAS,GAAG/B,UAAU,CAACyB,GAAD,CAA5B;;IAEA,IAAIM,SAAJ,EAAe;MACb,MAAMC,MAAkB,GAAG;QACzBH,IAAI,EAAE,QADmB;QAEzB5B,IAAI,EAAEwB,GAFmB;QAGzBQ,MAAM,EAAEL;MAHiB,CAA3B;MAKAG,SAAS,CAACC,MAAD,EAASlB,GAAG,CAACW,GAAD,CAAZ,CAAT;IACD,CAPD,MAOO;MACL,MAAMS,0BAA0B,GAAG,IAAIX,KAAJ,CAChC,IAAGE,GAAI,iCADyB,CAAnC;MAIAS,0BAA0B,CAACC,IAA3B,GAAkC,+BAAlC;MACA,MAAMD,0BAAN;IACD;EACF,CAlBD;EAoBA,OAAOpB,GAAP;AACD"} \ No newline at end of file +{"version":3,"names":["VALIDATORS","name","assertString","manipulateOptions","assertFunction","pre","post","inherits","visitor","assertVisitorMap","parserOverride","generatorOverride","loc","value","obj","assertObject","Object","keys","forEach","prop","assertVisitorHandler","enter","exit","Error","msg","key","handler","validatePluginObject","rootPath","type","source","validator","optLoc","parent","invalidPluginPropertyError","code"],"sources":["../../../src/config/validation/plugins.ts"],"sourcesContent":["import {\n assertString,\n assertFunction,\n assertObject,\n msg,\n} from \"./option-assertions\";\n\nimport type {\n ValidatorSet,\n Validator,\n OptionPath,\n RootPath,\n} from \"./option-assertions\";\nimport type { ParserOptions } from \"@babel/parser\";\nimport type { Visitor } from \"@babel/traverse\";\nimport type { ValidatedOptions } from \"./options\";\nimport type { File, PluginPass } from \"../../index\";\n\n// Note: The casts here are just meant to be static assertions to make sure\n// that the assertion functions actually assert that the value's type matches\n// the declared types.\nconst VALIDATORS: ValidatorSet = {\n name: assertString as Validator,\n manipulateOptions: assertFunction as Validator<\n PluginObject[\"manipulateOptions\"]\n >,\n pre: assertFunction as Validator,\n post: assertFunction as Validator,\n inherits: assertFunction as Validator,\n visitor: assertVisitorMap as Validator,\n\n parserOverride: assertFunction as Validator,\n generatorOverride: assertFunction as Validator<\n PluginObject[\"generatorOverride\"]\n >,\n};\n\nfunction assertVisitorMap(loc: OptionPath, value: unknown): Visitor {\n const obj = assertObject(loc, value);\n if (obj) {\n Object.keys(obj).forEach(prop => assertVisitorHandler(prop, obj[prop]));\n\n if (obj.enter || obj.exit) {\n throw new Error(\n `${msg(\n loc,\n )} cannot contain catch-all \"enter\" or \"exit\" handlers. Please target individual nodes.`,\n );\n }\n }\n return obj as Visitor;\n}\n\nfunction assertVisitorHandler(\n key: string,\n value: unknown,\n): VisitorHandler | void {\n if (value && typeof value === \"object\") {\n Object.keys(value).forEach((handler: string) => {\n if (handler !== \"enter\" && handler !== \"exit\") {\n throw new Error(\n `.visitor[\"${key}\"] may only have .enter and/or .exit handlers.`,\n );\n }\n });\n } else if (typeof value !== \"function\") {\n throw new Error(`.visitor[\"${key}\"] must be a function`);\n }\n\n return value as any;\n}\n\ntype VisitorHandler =\n | Function\n | {\n enter?: Function;\n exit?: Function;\n };\n\nexport type PluginObject = {\n name?: string;\n manipulateOptions?: (\n options: ValidatedOptions,\n parserOpts: ParserOptions,\n ) => void;\n pre?: (this: S, file: File) => void;\n post?: (this: S, file: File) => void;\n inherits?: Function;\n visitor?: Visitor;\n parserOverride?: Function;\n generatorOverride?: Function;\n};\n\nexport function validatePluginObject(obj: {\n [key: string]: unknown;\n}): PluginObject {\n const rootPath: RootPath = {\n type: \"root\",\n source: \"plugin\",\n };\n Object.keys(obj).forEach((key: string) => {\n const validator = VALIDATORS[key];\n\n if (validator) {\n const optLoc: OptionPath = {\n type: \"option\",\n name: key,\n parent: rootPath,\n };\n validator(optLoc, obj[key]);\n } else {\n const invalidPluginPropertyError = new Error(\n `.${key} is not a valid Plugin property`,\n );\n // @ts-expect-error todo(flow->ts) consider additing BabelConfigError with code field\n invalidPluginPropertyError.code = \"BABEL_UNKNOWN_PLUGIN_PROPERTY\";\n throw invalidPluginPropertyError;\n }\n });\n\n return obj as any;\n}\n"],"mappings":";;;;;;AAAA;AAqBA,MAAMA,UAAwB,GAAG;EAC/BC,IAAI,EAAEC,8BAA+C;EACrDC,iBAAiB,EAAEC,gCAElB;EACDC,GAAG,EAAED,gCAAgD;EACrDE,IAAI,EAAEF,gCAAiD;EACvDG,QAAQ,EAAEH,gCAAqD;EAC/DI,OAAO,EAAEC,gBAAsD;EAE/DC,cAAc,EAAEN,gCAA2D;EAC3EO,iBAAiB,EAAEP;AAGrB,CAAC;AAED,SAASK,gBAAgB,CAACG,GAAe,EAAEC,KAAc,EAAW;EAClE,MAAMC,GAAG,GAAG,IAAAC,8BAAY,EAACH,GAAG,EAAEC,KAAK,CAAC;EACpC,IAAIC,GAAG,EAAE;IACPE,MAAM,CAACC,IAAI,CAACH,GAAG,CAAC,CAACI,OAAO,CAACC,IAAI,IAAIC,oBAAoB,CAACD,IAAI,EAAEL,GAAG,CAACK,IAAI,CAAC,CAAC,CAAC;IAEvE,IAAIL,GAAG,CAACO,KAAK,IAAIP,GAAG,CAACQ,IAAI,EAAE;MACzB,MAAM,IAAIC,KAAK,CACZ,GAAE,IAAAC,qBAAG,EACJZ,GAAG,CACH,uFAAsF,CACzF;IACH;EACF;EACA,OAAOE,GAAG;AACZ;AAEA,SAASM,oBAAoB,CAC3BK,GAAW,EACXZ,KAAc,EACS;EACvB,IAAIA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IACtCG,MAAM,CAACC,IAAI,CAACJ,KAAK,CAAC,CAACK,OAAO,CAAEQ,OAAe,IAAK;MAC9C,IAAIA,OAAO,KAAK,OAAO,IAAIA,OAAO,KAAK,MAAM,EAAE;QAC7C,MAAM,IAAIH,KAAK,CACZ,aAAYE,GAAI,gDAA+C,CACjE;MACH;IACF,CAAC,CAAC;EACJ,CAAC,MAAM,IAAI,OAAOZ,KAAK,KAAK,UAAU,EAAE;IACtC,MAAM,IAAIU,KAAK,CAAE,aAAYE,GAAI,uBAAsB,CAAC;EAC1D;EAEA,OAAOZ,KAAK;AACd;AAuBO,SAASc,oBAAoB,CAACb,GAEpC,EAAgB;EACf,MAAMc,QAAkB,GAAG;IACzBC,IAAI,EAAE,MAAM;IACZC,MAAM,EAAE;EACV,CAAC;EACDd,MAAM,CAACC,IAAI,CAACH,GAAG,CAAC,CAACI,OAAO,CAAEO,GAAW,IAAK;IACxC,MAAMM,SAAS,GAAG/B,UAAU,CAACyB,GAAG,CAAC;IAEjC,IAAIM,SAAS,EAAE;MACb,MAAMC,MAAkB,GAAG;QACzBH,IAAI,EAAE,QAAQ;QACd5B,IAAI,EAAEwB,GAAG;QACTQ,MAAM,EAAEL;MACV,CAAC;MACDG,SAAS,CAACC,MAAM,EAAElB,GAAG,CAACW,GAAG,CAAC,CAAC;IAC7B,CAAC,MAAM;MACL,MAAMS,0BAA0B,GAAG,IAAIX,KAAK,CACzC,IAAGE,GAAI,iCAAgC,CACzC;MAEDS,0BAA0B,CAACC,IAAI,GAAG,+BAA+B;MACjE,MAAMD,0BAA0B;IAClC;EACF,CAAC,CAAC;EAEF,OAAOpB,GAAG;AACZ;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/config/validation/removed.js.map b/node_modules/@babel/core/lib/config/validation/removed.js.map index dc7836d0c..da9a0972e 100644 --- a/node_modules/@babel/core/lib/config/validation/removed.js.map +++ b/node_modules/@babel/core/lib/config/validation/removed.js.map @@ -1 +1 @@ -{"version":3,"names":["auxiliaryComment","message","blacklist","breakConfig","experimental","externalHelpers","extra","jsxPragma","loose","metadataUsedHelpers","modules","nonStandard","optional","sourceMapName","stage","whitelist","resolveModuleSource","version","metadata","sourceMapTarget"],"sources":["../../../src/config/validation/removed.ts"],"sourcesContent":["export default {\n auxiliaryComment: {\n message: \"Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`\",\n },\n blacklist: {\n message: \"Put the specific transforms you want in the `plugins` option\",\n },\n breakConfig: {\n message: \"This is not a necessary option in Babel 6\",\n },\n experimental: {\n message: \"Put the specific transforms you want in the `plugins` option\",\n },\n externalHelpers: {\n message:\n \"Use the `external-helpers` plugin instead. \" +\n \"Check out http://babeljs.io/docs/plugins/external-helpers/\",\n },\n extra: {\n message: \"\",\n },\n jsxPragma: {\n message:\n \"use the `pragma` option in the `react-jsx` plugin. \" +\n \"Check out http://babeljs.io/docs/plugins/transform-react-jsx/\",\n },\n loose: {\n message:\n \"Specify the `loose` option for the relevant plugin you are using \" +\n \"or use a preset that sets the option.\",\n },\n metadataUsedHelpers: {\n message: \"Not required anymore as this is enabled by default\",\n },\n modules: {\n message:\n \"Use the corresponding module transform plugin in the `plugins` option. \" +\n \"Check out http://babeljs.io/docs/plugins/#modules\",\n },\n nonStandard: {\n message:\n \"Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. \" +\n \"Also check out the react preset http://babeljs.io/docs/plugins/preset-react/\",\n },\n optional: {\n message: \"Put the specific transforms you want in the `plugins` option\",\n },\n sourceMapName: {\n message:\n \"The `sourceMapName` option has been removed because it makes more sense for the \" +\n \"tooling that calls Babel to assign `map.file` themselves.\",\n },\n stage: {\n message:\n \"Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets\",\n },\n whitelist: {\n message: \"Put the specific transforms you want in the `plugins` option\",\n },\n\n resolveModuleSource: {\n version: 6,\n message: \"Use `babel-plugin-module-resolver@3`'s 'resolvePath' options\",\n },\n metadata: {\n version: 6,\n message:\n \"Generated plugin metadata is always included in the output result\",\n },\n sourceMapTarget: {\n version: 6,\n message:\n \"The `sourceMapTarget` option has been removed because it makes more sense for the tooling \" +\n \"that calls Babel to assign `map.file` themselves.\",\n },\n} as { [name: string]: { version?: number; message: string } };\n"],"mappings":";;;;;;eAAe;EACbA,gBAAgB,EAAE;IAChBC,OAAO,EAAE;EADO,CADL;EAIbC,SAAS,EAAE;IACTD,OAAO,EAAE;EADA,CAJE;EAObE,WAAW,EAAE;IACXF,OAAO,EAAE;EADE,CAPA;EAUbG,YAAY,EAAE;IACZH,OAAO,EAAE;EADG,CAVD;EAabI,eAAe,EAAE;IACfJ,OAAO,EACL,gDACA;EAHa,CAbJ;EAkBbK,KAAK,EAAE;IACLL,OAAO,EAAE;EADJ,CAlBM;EAqBbM,SAAS,EAAE;IACTN,OAAO,EACL,wDACA;EAHO,CArBE;EA0BbO,KAAK,EAAE;IACLP,OAAO,EACL,sEACA;EAHG,CA1BM;EA+BbQ,mBAAmB,EAAE;IACnBR,OAAO,EAAE;EADU,CA/BR;EAkCbS,OAAO,EAAE;IACPT,OAAO,EACL,4EACA;EAHK,CAlCI;EAuCbU,WAAW,EAAE;IACXV,OAAO,EACL,iFACA;EAHS,CAvCA;EA4CbW,QAAQ,EAAE;IACRX,OAAO,EAAE;EADD,CA5CG;EA+CbY,aAAa,EAAE;IACbZ,OAAO,EACL,qFACA;EAHW,CA/CF;EAoDba,KAAK,EAAE;IACLb,OAAO,EACL;EAFG,CApDM;EAwDbc,SAAS,EAAE;IACTd,OAAO,EAAE;EADA,CAxDE;EA4Dbe,mBAAmB,EAAE;IACnBC,OAAO,EAAE,CADU;IAEnBhB,OAAO,EAAE;EAFU,CA5DR;EAgEbiB,QAAQ,EAAE;IACRD,OAAO,EAAE,CADD;IAERhB,OAAO,EACL;EAHM,CAhEG;EAqEbkB,eAAe,EAAE;IACfF,OAAO,EAAE,CADM;IAEfhB,OAAO,EACL,+FACA;EAJa;AArEJ,C"} \ No newline at end of file +{"version":3,"names":["auxiliaryComment","message","blacklist","breakConfig","experimental","externalHelpers","extra","jsxPragma","loose","metadataUsedHelpers","modules","nonStandard","optional","sourceMapName","stage","whitelist","resolveModuleSource","version","metadata","sourceMapTarget"],"sources":["../../../src/config/validation/removed.ts"],"sourcesContent":["export default {\n auxiliaryComment: {\n message: \"Use `auxiliaryCommentBefore` or `auxiliaryCommentAfter`\",\n },\n blacklist: {\n message: \"Put the specific transforms you want in the `plugins` option\",\n },\n breakConfig: {\n message: \"This is not a necessary option in Babel 6\",\n },\n experimental: {\n message: \"Put the specific transforms you want in the `plugins` option\",\n },\n externalHelpers: {\n message:\n \"Use the `external-helpers` plugin instead. \" +\n \"Check out http://babeljs.io/docs/plugins/external-helpers/\",\n },\n extra: {\n message: \"\",\n },\n jsxPragma: {\n message:\n \"use the `pragma` option in the `react-jsx` plugin. \" +\n \"Check out http://babeljs.io/docs/plugins/transform-react-jsx/\",\n },\n loose: {\n message:\n \"Specify the `loose` option for the relevant plugin you are using \" +\n \"or use a preset that sets the option.\",\n },\n metadataUsedHelpers: {\n message: \"Not required anymore as this is enabled by default\",\n },\n modules: {\n message:\n \"Use the corresponding module transform plugin in the `plugins` option. \" +\n \"Check out http://babeljs.io/docs/plugins/#modules\",\n },\n nonStandard: {\n message:\n \"Use the `react-jsx` and `flow-strip-types` plugins to support JSX and Flow. \" +\n \"Also check out the react preset http://babeljs.io/docs/plugins/preset-react/\",\n },\n optional: {\n message: \"Put the specific transforms you want in the `plugins` option\",\n },\n sourceMapName: {\n message:\n \"The `sourceMapName` option has been removed because it makes more sense for the \" +\n \"tooling that calls Babel to assign `map.file` themselves.\",\n },\n stage: {\n message:\n \"Check out the corresponding stage-x presets http://babeljs.io/docs/plugins/#presets\",\n },\n whitelist: {\n message: \"Put the specific transforms you want in the `plugins` option\",\n },\n\n resolveModuleSource: {\n version: 6,\n message: \"Use `babel-plugin-module-resolver@3`'s 'resolvePath' options\",\n },\n metadata: {\n version: 6,\n message:\n \"Generated plugin metadata is always included in the output result\",\n },\n sourceMapTarget: {\n version: 6,\n message:\n \"The `sourceMapTarget` option has been removed because it makes more sense for the tooling \" +\n \"that calls Babel to assign `map.file` themselves.\",\n },\n} as { [name: string]: { version?: number; message: string } };\n"],"mappings":";;;;;;eAAe;EACbA,gBAAgB,EAAE;IAChBC,OAAO,EAAE;EACX,CAAC;EACDC,SAAS,EAAE;IACTD,OAAO,EAAE;EACX,CAAC;EACDE,WAAW,EAAE;IACXF,OAAO,EAAE;EACX,CAAC;EACDG,YAAY,EAAE;IACZH,OAAO,EAAE;EACX,CAAC;EACDI,eAAe,EAAE;IACfJ,OAAO,EACL,6CAA6C,GAC7C;EACJ,CAAC;EACDK,KAAK,EAAE;IACLL,OAAO,EAAE;EACX,CAAC;EACDM,SAAS,EAAE;IACTN,OAAO,EACL,qDAAqD,GACrD;EACJ,CAAC;EACDO,KAAK,EAAE;IACLP,OAAO,EACL,mEAAmE,GACnE;EACJ,CAAC;EACDQ,mBAAmB,EAAE;IACnBR,OAAO,EAAE;EACX,CAAC;EACDS,OAAO,EAAE;IACPT,OAAO,EACL,yEAAyE,GACzE;EACJ,CAAC;EACDU,WAAW,EAAE;IACXV,OAAO,EACL,8EAA8E,GAC9E;EACJ,CAAC;EACDW,QAAQ,EAAE;IACRX,OAAO,EAAE;EACX,CAAC;EACDY,aAAa,EAAE;IACbZ,OAAO,EACL,kFAAkF,GAClF;EACJ,CAAC;EACDa,KAAK,EAAE;IACLb,OAAO,EACL;EACJ,CAAC;EACDc,SAAS,EAAE;IACTd,OAAO,EAAE;EACX,CAAC;EAEDe,mBAAmB,EAAE;IACnBC,OAAO,EAAE,CAAC;IACVhB,OAAO,EAAE;EACX,CAAC;EACDiB,QAAQ,EAAE;IACRD,OAAO,EAAE,CAAC;IACVhB,OAAO,EACL;EACJ,CAAC;EACDkB,eAAe,EAAE;IACfF,OAAO,EAAE,CAAC;IACVhB,OAAO,EACL,4FAA4F,GAC5F;EACJ;AACF,CAAC;AAAA;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/errors/config-error.js b/node_modules/@babel/core/lib/errors/config-error.js index ecab2dc26..1ee56a883 100644 --- a/node_modules/@babel/core/lib/errors/config-error.js +++ b/node_modules/@babel/core/lib/errors/config-error.js @@ -4,18 +4,14 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; - var _rewriteStackTrace = require("./rewrite-stack-trace"); - class ConfigError extends Error { constructor(message, filename) { super(message); (0, _rewriteStackTrace.expectedError)(this); if (filename) (0, _rewriteStackTrace.injcectVirtualStackFrame)(this, filename); } - } - exports.default = ConfigError; 0 && 0; diff --git a/node_modules/@babel/core/lib/errors/config-error.js.map b/node_modules/@babel/core/lib/errors/config-error.js.map index 864e8b743..3aaf90ab5 100644 --- a/node_modules/@babel/core/lib/errors/config-error.js.map +++ b/node_modules/@babel/core/lib/errors/config-error.js.map @@ -1 +1 @@ -{"version":3,"names":["ConfigError","Error","constructor","message","filename","expectedError","injcectVirtualStackFrame"],"sources":["../../src/errors/config-error.ts"],"sourcesContent":["import { injcectVirtualStackFrame, expectedError } from \"./rewrite-stack-trace\";\n\nexport default class ConfigError extends Error {\n constructor(message: string, filename?: string) {\n super(message);\n expectedError(this);\n if (filename) injcectVirtualStackFrame(this, filename);\n }\n}\n"],"mappings":";;;;;;;AAAA;;AAEe,MAAMA,WAAN,SAA0BC,KAA1B,CAAgC;EAC7CC,WAAW,CAACC,OAAD,EAAkBC,QAAlB,EAAqC;IAC9C,MAAMD,OAAN;IACA,IAAAE,gCAAA,EAAc,IAAd;IACA,IAAID,QAAJ,EAAc,IAAAE,2CAAA,EAAyB,IAAzB,EAA+BF,QAA/B;EACf;;AAL4C"} \ No newline at end of file +{"version":3,"names":["ConfigError","Error","constructor","message","filename","expectedError","injcectVirtualStackFrame"],"sources":["../../src/errors/config-error.ts"],"sourcesContent":["import { injcectVirtualStackFrame, expectedError } from \"./rewrite-stack-trace\";\n\nexport default class ConfigError extends Error {\n constructor(message: string, filename?: string) {\n super(message);\n expectedError(this);\n if (filename) injcectVirtualStackFrame(this, filename);\n }\n}\n"],"mappings":";;;;;;AAAA;AAEe,MAAMA,WAAW,SAASC,KAAK,CAAC;EAC7CC,WAAW,CAACC,OAAe,EAAEC,QAAiB,EAAE;IAC9C,KAAK,CAACD,OAAO,CAAC;IACd,IAAAE,gCAAa,EAAC,IAAI,CAAC;IACnB,IAAID,QAAQ,EAAE,IAAAE,2CAAwB,EAAC,IAAI,EAAEF,QAAQ,CAAC;EACxD;AACF;AAAC;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js b/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js index c193a636a..b07288b6f 100644 --- a/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js +++ b/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js @@ -7,13 +7,13 @@ exports.beginHiddenCallStack = beginHiddenCallStack; exports.endHiddenCallStack = endHiddenCallStack; exports.expectedError = expectedError; exports.injcectVirtualStackFrame = injcectVirtualStackFrame; + const ErrorToString = Function.call.bind(Error.prototype.toString); const SUPPORTED = !!Error.captureStackTrace; const START_HIDNG = "startHiding - secret - don't use this - v1"; const STOP_HIDNG = "stopHiding - secret - don't use this - v1"; const expectedErrors = new WeakSet(); const virtualFrames = new WeakMap(); - function CallSite(filename) { return Object.create({ isNative: () => false, @@ -28,7 +28,6 @@ function CallSite(filename) { toString: () => filename }); } - function injcectVirtualStackFrame(error, filename) { if (!SUPPORTED) return; let frames = virtualFrames.get(error); @@ -36,13 +35,11 @@ function injcectVirtualStackFrame(error, filename) { frames.push(CallSite(filename)); return error; } - function expectedError(error) { if (!SUPPORTED) return; expectedErrors.add(error); return error; } - function beginHiddenCallStack(fn) { if (!SUPPORTED) return fn; return Object.defineProperty(function (...args) { @@ -52,7 +49,6 @@ function beginHiddenCallStack(fn) { value: STOP_HIDNG }); } - function endHiddenCallStack(fn) { if (!SUPPORTED) return fn; return Object.defineProperty(function (...args) { @@ -61,30 +57,25 @@ function endHiddenCallStack(fn) { value: START_HIDNG }); } - function setupPrepareStackTrace() { setupPrepareStackTrace = () => {}; - const { prepareStackTrace = defaultPrepareStackTrace } = Error; + const MIN_STACK_TRACE_LIMIT = 50; Error.stackTraceLimit && (Error.stackTraceLimit = Math.max(Error.stackTraceLimit, MIN_STACK_TRACE_LIMIT)); - Error.prepareStackTrace = function stackTraceRewriter(err, trace) { let newTrace = []; const isExpected = expectedErrors.has(err); let status = isExpected ? "hiding" : "unknown"; - for (let i = 0; i < trace.length; i++) { const name = trace[i].getFunctionName(); - if (name === START_HIDNG) { status = "hiding"; } else if (name === STOP_HIDNG) { if (status === "hiding") { status = "showing"; - if (virtualFrames.has(err)) { newTrace.unshift(...virtualFrames.get(err)); } @@ -96,16 +87,13 @@ function setupPrepareStackTrace() { newTrace.push(trace[i]); } } - return prepareStackTrace(err, newTrace); }; } - function defaultPrepareStackTrace(err, trace) { if (trace.length === 0) return ErrorToString(err); return `${ErrorToString(err)}\n at ${trace.join("\n at ")}`; } - 0 && 0; //# sourceMappingURL=rewrite-stack-trace.js.map diff --git a/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js.map b/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js.map index 408e8faff..f7e90cdea 100644 --- a/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js.map +++ b/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js.map @@ -1 +1 @@ -{"version":3,"names":["ErrorToString","Function","call","bind","Error","prototype","toString","SUPPORTED","captureStackTrace","START_HIDNG","STOP_HIDNG","expectedErrors","WeakSet","virtualFrames","WeakMap","CallSite","filename","Object","create","isNative","isConstructor","isToplevel","getFileName","getLineNumber","undefined","getColumnNumber","getFunctionName","getMethodName","getTypeName","injcectVirtualStackFrame","error","frames","get","set","push","expectedError","add","beginHiddenCallStack","fn","defineProperty","args","setupPrepareStackTrace","value","endHiddenCallStack","prepareStackTrace","defaultPrepareStackTrace","MIN_STACK_TRACE_LIMIT","stackTraceLimit","Math","max","stackTraceRewriter","err","trace","newTrace","isExpected","has","status","i","length","name","unshift","join"],"sources":["../../src/errors/rewrite-stack-trace.ts"],"sourcesContent":["/**\n * This file uses the iternal V8 Stack Trace API (https://v8.dev/docs/stack-trace-api)\n * to provide utilities to rewrite the stack trace.\n * When this API is not present, all the functions in this file become noops.\n *\n * beginHiddenCallStack(fn) and endHiddenCallStack(fn) wrap their parameter to\n * mark an hidden portion of the stack trace. The function passed to\n * beginHiddenCallStack is the first hidden function, while the function passed\n * to endHiddenCallStack is the first shown function.\n *\n * When an error is thrown _outside_ of the hidden zone, everything between\n * beginHiddenCallStack and endHiddenCallStack will not be shown.\n * If an error is thrown _inside_ the hidden zone, then the whole stack trace\n * will be visible: this is to avoid hiding real bugs.\n * However, if an error inside the hidden zone is expected, it can be marked\n * with the expectedError(error) function to keep the hidden frames hidden.\n *\n * Consider this call stack (the outer function is the bottom one):\n *\n * 1. a()\n * 2. endHiddenCallStack(b)()\n * 3. c()\n * 4. beginHiddenCallStack(d)()\n * 5. e()\n * 6. f()\n *\n * - If a() throws an error, then its shown call stack will be \"a, b, e, f\"\n * - If b() throws an error, then its shown call stack will be \"b, e, f\"\n * - If c() throws an expected error, then its shown call stack will be \"e, f\"\n * - If c() throws an unexpected error, then its shown call stack will be \"c, d, e, f\"\n * - If d() throws an expected error, then its shown call stack will be \"e, f\"\n * - If d() throws an unexpected error, then its shown call stack will be \"d, e, f\"\n * - If e() throws an error, then its shown call stack will be \"e, f\"\n *\n * Additionally, an error can inject additional \"virtual\" stack frames using the\n * injcectVirtualStackFrame(error, filename) function: those are injected as a\n * replacement of the hidden frames.\n * In the example above, if we called injcectVirtualStackFrame(err, \"h\") and\n * injcectVirtualStackFrame(err, \"i\") on the expected error thrown by c(), its\n * shown call stack would have been \"h, i, e, f\".\n * This can be useful, for example, to report config validation errors as if they\n * were directly thrown in the config file.\n */\n\nconst ErrorToString = Function.call.bind(Error.prototype.toString);\n\nconst SUPPORTED = !!Error.captureStackTrace;\n\nconst START_HIDNG = \"startHiding - secret - don't use this - v1\";\nconst STOP_HIDNG = \"stopHiding - secret - don't use this - v1\";\n\ntype CallSite = Parameters[1][number];\n\nconst expectedErrors = new WeakSet();\nconst virtualFrames = new WeakMap();\n\nfunction CallSite(filename: string): CallSite {\n // We need to use a prototype otherwise it breaks source-map-support's internals\n return Object.create({\n isNative: () => false,\n isConstructor: () => false,\n isToplevel: () => true,\n getFileName: () => filename,\n getLineNumber: () => undefined,\n getColumnNumber: () => undefined,\n getFunctionName: () => undefined,\n getMethodName: () => undefined,\n getTypeName: () => undefined,\n toString: () => filename,\n } as CallSite);\n}\n\nexport function injcectVirtualStackFrame(error: Error, filename: string) {\n if (!SUPPORTED) return;\n\n let frames = virtualFrames.get(error);\n if (!frames) virtualFrames.set(error, (frames = []));\n frames.push(CallSite(filename));\n\n return error;\n}\n\nexport function expectedError(error: Error) {\n if (!SUPPORTED) return;\n expectedErrors.add(error);\n return error;\n}\n\nexport function beginHiddenCallStack(\n fn: (...args: A) => R,\n) {\n if (!SUPPORTED) return fn;\n\n return Object.defineProperty(\n function (...args: A) {\n setupPrepareStackTrace();\n return fn(...args);\n },\n \"name\",\n { value: STOP_HIDNG },\n );\n}\n\nexport function endHiddenCallStack(\n fn: (...args: A) => R,\n) {\n if (!SUPPORTED) return fn;\n\n return Object.defineProperty(\n function (...args: A) {\n return fn(...args);\n },\n \"name\",\n { value: START_HIDNG },\n );\n}\n\nfunction setupPrepareStackTrace() {\n // @ts-expect-error This function is a singleton\n // eslint-disable-next-line no-func-assign\n setupPrepareStackTrace = () => {};\n\n const { prepareStackTrace = defaultPrepareStackTrace } = Error;\n\n // We add some extra frames to Error.stackTraceLimit, so that we can\n // always show some useful frames even after deleting ours.\n // STACK_TRACE_LIMIT_DELTA should be around the maximum expected number\n // of internal frames, and not too big because capturing the stack trace\n // is slow (this is why Error.stackTraceLimit does not default to Infinity!).\n // Increase it if needed.\n // However, we only do it if the user did not explicitly set it to 0.\n const MIN_STACK_TRACE_LIMIT = 50;\n Error.stackTraceLimit &&= Math.max(\n Error.stackTraceLimit,\n MIN_STACK_TRACE_LIMIT,\n );\n\n Error.prepareStackTrace = function stackTraceRewriter(err, trace) {\n let newTrace = [];\n\n const isExpected = expectedErrors.has(err);\n let status: \"showing\" | \"hiding\" | \"unknown\" = isExpected\n ? \"hiding\"\n : \"unknown\";\n for (let i = 0; i < trace.length; i++) {\n const name = trace[i].getFunctionName();\n if (name === START_HIDNG) {\n status = \"hiding\";\n } else if (name === STOP_HIDNG) {\n if (status === \"hiding\") {\n status = \"showing\";\n if (virtualFrames.has(err)) {\n newTrace.unshift(...virtualFrames.get(err));\n }\n } else if (status === \"unknown\") {\n // Unexpected internal error, show the full stack trace\n newTrace = trace;\n break;\n }\n } else if (status !== \"hiding\") {\n newTrace.push(trace[i]);\n }\n }\n\n return prepareStackTrace(err, newTrace);\n };\n}\n\nfunction defaultPrepareStackTrace(err: Error, trace: CallSite[]) {\n if (trace.length === 0) return ErrorToString(err);\n return `${ErrorToString(err)}\\n at ${trace.join(\"\\n at \")}`;\n}\n"],"mappings":";;;;;;;;;AA4CA,MAAMA,aAAa,GAAGC,QAAQ,CAACC,IAAT,CAAcC,IAAd,CAAmBC,KAAK,CAACC,SAAN,CAAgBC,QAAnC,CAAtB;AAEA,MAAMC,SAAS,GAAG,CAAC,CAACH,KAAK,CAACI,iBAA1B;AAEA,MAAMC,WAAW,GAAG,4CAApB;AACA,MAAMC,UAAU,GAAG,2CAAnB;AAIA,MAAMC,cAAc,GAAG,IAAIC,OAAJ,EAAvB;AACA,MAAMC,aAAa,GAAG,IAAIC,OAAJ,EAAtB;;AAEA,SAASC,QAAT,CAAkBC,QAAlB,EAA8C;EAE5C,OAAOC,MAAM,CAACC,MAAP,CAAc;IACnBC,QAAQ,EAAE,MAAM,KADG;IAEnBC,aAAa,EAAE,MAAM,KAFF;IAGnBC,UAAU,EAAE,MAAM,IAHC;IAInBC,WAAW,EAAE,MAAMN,QAJA;IAKnBO,aAAa,EAAE,MAAMC,SALF;IAMnBC,eAAe,EAAE,MAAMD,SANJ;IAOnBE,eAAe,EAAE,MAAMF,SAPJ;IAQnBG,aAAa,EAAE,MAAMH,SARF;IASnBI,WAAW,EAAE,MAAMJ,SATA;IAUnBlB,QAAQ,EAAE,MAAMU;EAVG,CAAd,CAAP;AAYD;;AAEM,SAASa,wBAAT,CAAkCC,KAAlC,EAAgDd,QAAhD,EAAk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ApB;EACxB,OAAQ,GAAEnD,aAAa,CAACmD,GAAD,CAAM,YAAWC,KAAK,CAACS,IAAN,CAAW,WAAX,CAAwB,EAAhE;AACD"} \ No newline at end of file +{"version":3,"names":["ErrorToString","Function","call","bind","Error","prototype","toString","SUPPORTED","captureStackTrace","START_HIDNG","STOP_HIDNG","expectedErrors","WeakSet","virtualFrames","WeakMap","CallSite","filename","Object","create","isNative","isConstructor","isToplevel","getFileName","getLineNumber","undefined","getColumnNumber","getFunctionName","getMethodName","getTypeName","injcectVirtualStackFrame","error","frames","get","set","push","expectedError","add","beginHiddenCallStack","fn","defineProperty","args","setupPrepareStackTrace","value","endHiddenCallStack","prepareStackTrace","defaultPrepareStackTrace","MIN_STACK_TRACE_LIMIT","stackTraceLimit","Math","max","stackTraceRewriter","err","trace","newTrace","isExpected","has","status","i","length","name","unshift","join"],"sources":["../../src/errors/rewrite-stack-trace.ts"],"sourcesContent":["/**\n * This file uses the iternal V8 Stack Trace API (https://v8.dev/docs/stack-trace-api)\n * to provide utilities to rewrite the stack trace.\n * When this API is not present, all the functions in this file become noops.\n *\n * beginHiddenCallStack(fn) and endHiddenCallStack(fn) wrap their parameter to\n * mark an hidden portion of the stack trace. The function passed to\n * beginHiddenCallStack is the first hidden function, while the function passed\n * to endHiddenCallStack is the first shown function.\n *\n * When an error is thrown _outside_ of the hidden zone, everything between\n * beginHiddenCallStack and endHiddenCallStack will not be shown.\n * If an error is thrown _inside_ the hidden zone, then the whole stack trace\n * will be visible: this is to avoid hiding real bugs.\n * However, if an error inside the hidden zone is expected, it can be marked\n * with the expectedError(error) function to keep the hidden frames hidden.\n *\n * Consider this call stack (the outer function is the bottom one):\n *\n * 1. a()\n * 2. endHiddenCallStack(b)()\n * 3. c()\n * 4. beginHiddenCallStack(d)()\n * 5. e()\n * 6. f()\n *\n * - If a() throws an error, then its shown call stack will be \"a, b, e, f\"\n * - If b() throws an error, then its shown call stack will be \"b, e, f\"\n * - If c() throws an expected error, then its shown call stack will be \"e, f\"\n * - If c() throws an unexpected error, then its shown call stack will be \"c, d, e, f\"\n * - If d() throws an expected error, then its shown call stack will be \"e, f\"\n * - If d() throws an unexpected error, then its shown call stack will be \"d, e, f\"\n * - If e() throws an error, then its shown call stack will be \"e, f\"\n *\n * Additionally, an error can inject additional \"virtual\" stack frames using the\n * injcectVirtualStackFrame(error, filename) function: those are injected as a\n * replacement of the hidden frames.\n * In the example above, if we called injcectVirtualStackFrame(err, \"h\") and\n * injcectVirtualStackFrame(err, \"i\") on the expected error thrown by c(), its\n * shown call stack would have been \"h, i, e, f\".\n * This can be useful, for example, to report config validation errors as if they\n * were directly thrown in the config file.\n */\n\nconst ErrorToString = Function.call.bind(Error.prototype.toString);\n\nconst SUPPORTED = !!Error.captureStackTrace;\n\nconst START_HIDNG = \"startHiding - secret - don't use this - v1\";\nconst STOP_HIDNG = \"stopHiding - secret - don't use this - v1\";\n\ntype CallSite = Parameters[1][number];\n\nconst expectedErrors = new WeakSet();\nconst virtualFrames = new WeakMap();\n\nfunction CallSite(filename: string): CallSite {\n // We need to use a prototype otherwise it breaks source-map-support's internals\n return Object.create({\n isNative: () => false,\n isConstructor: () => false,\n isToplevel: () => true,\n getFileName: () => filename,\n getLineNumber: () => undefined,\n getColumnNumber: () => undefined,\n getFunctionName: () => undefined,\n getMethodName: () => undefined,\n getTypeName: () => undefined,\n toString: () => filename,\n } as CallSite);\n}\n\nexport function injcectVirtualStackFrame(error: Error, filename: string) {\n if (!SUPPORTED) return;\n\n let frames = virtualFrames.get(error);\n if (!frames) virtualFrames.set(error, (frames = []));\n frames.push(CallSite(filename));\n\n return error;\n}\n\nexport function expectedError(error: Error) {\n if (!SUPPORTED) return;\n expectedErrors.add(error);\n return error;\n}\n\nexport function beginHiddenCallStack(\n fn: (...args: A) => R,\n) {\n if (!SUPPORTED) return fn;\n\n return Object.defineProperty(\n function (...args: A) {\n setupPrepareStackTrace();\n return fn(...args);\n },\n \"name\",\n { value: STOP_HIDNG },\n );\n}\n\nexport function endHiddenCallStack(\n fn: (...args: A) => R,\n) {\n if (!SUPPORTED) return fn;\n\n return Object.defineProperty(\n function (...args: A) {\n return fn(...args);\n },\n \"name\",\n { value: START_HIDNG },\n );\n}\n\nfunction setupPrepareStackTrace() {\n // @ts-expect-error This function is a singleton\n // eslint-disable-next-line no-func-assign\n setupPrepareStackTrace = () => {};\n\n const { prepareStackTrace = defaultPrepareStackTrace } = Error;\n\n // We add some extra frames to Error.stackTraceLimit, so that we can\n // always show some useful frames even after deleting ours.\n // STACK_TRACE_LIMIT_DELTA should be around the maximum expected number\n // of internal frames, and not too big because capturing the stack trace\n // is slow (this is why Error.stackTraceLimit does not default to Infinity!).\n // Increase it if needed.\n // However, we only do it if the user did not explicitly set it to 0.\n const MIN_STACK_TRACE_LIMIT = 50;\n Error.stackTraceLimit &&= Math.max(\n Error.stackTraceLimit,\n MIN_STACK_TRACE_LIMIT,\n );\n\n Error.prepareStackTrace = function stackTraceRewriter(err, trace) {\n let newTrace = [];\n\n const isExpected = expectedErrors.has(err);\n let status: \"showing\" | \"hiding\" | \"unknown\" = isExpected\n ? \"hiding\"\n : \"unknown\";\n for (let i = 0; i < trace.length; i++) {\n const name = trace[i].getFunctionName();\n if (name === START_HIDNG) {\n status = \"hiding\";\n } else if (name === STOP_HIDNG) {\n if (status === \"hiding\") {\n status = \"showing\";\n if (virtualFrames.has(err)) {\n newTrace.unshift(...virtualFrames.get(err));\n }\n } else if (status === \"unknown\") {\n // Unexpected internal error, show the full stack trace\n newTrace = trace;\n break;\n }\n } else if (status !== \"hiding\") {\n newTrace.push(trace[i]);\n }\n }\n\n return prepareStackTrace(err, newTrace);\n };\n}\n\nfunction defaultPrepareStackTrace(err: Error, trace: CallSite[]) {\n if (trace.length === 0) return ErrorToString(err);\n return `${ErrorToString(err)}\\n at ${trace.join(\"\\n at \")}`;\n}\n"],"mappings":";;;;;;;;;;AA4CA,MAAMA,aAAa,GAAGC,QAAQ,CAACC,IAAI,CAACC,IAAI,CAACC,KAAK,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AAE;QACxB+C,MAAM,GAAG,QAAQ;MACnB,CAAC,MAAM,IAAIG,IAAI,KAAKjD,UAAU,EAAE;QAC9B,IAAI8C,MAAM,KAAK,QAAQ,EAAE;UACvBA,MAAM,GAAG,SAAS;UAClB,IAAI3C,aAAa,CAAC0C,GAAG,CAACJ,GAAG,CAAC,EAAE;YAC1BE,QAAQ,CAACO,OAAO,CAAC,GAAG/C,aAAa,CAACmB,GAAG,CAACmB,GAAG,CAAC,CAAC;UAC7C;QACF,CAAC,MAAM,IAAIK,MAAM,KAAK,SAAS,EAAE;UAE/BH,QAAQ,GAAGD,KAAK;UAChB;QACF;MACF,CAAC,MAAM,IAAII,MAAM,KAAK,QAAQ,EAAE;QAC9BH,QAAQ,CAACnB,IAAI,CAACkB,KAAK,CAACK,CAAC,CAAC,CAAC;MACzB;IACF;IAEA,OAAOb,iBAAiB,CAACO,GAAG,EAAEE,QAAQ,CAAC;EACzC,CAAC;AACH;AAEA,SAASR,wBAAwB,CAACM,GAAU,EAAEC,KAAiB,EAAE;EAC/D,IAAIA,KAAK,CAACM,MAAM,KAAK,CAAC,EAAE,OAAO1D,aAAa,CAACmD,GAAG,CAAC;EACjD,OAAQ,GAAEnD,aAAa,CAACmD,GAAG,CAAE,YAAWC,KAAK,CAACS,IAAI,CAAC,WAAW,CAAE,EAAC;AACnE;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/gensync-utils/async.js b/node_modules/@babel/core/lib/gensync-utils/async.js index 724b0fdb9..1a37dc25d 100644 --- a/node_modules/@babel/core/lib/gensync-utils/async.js +++ b/node_modules/@babel/core/lib/gensync-utils/async.js @@ -8,21 +8,15 @@ exports.isAsync = void 0; exports.isThenable = isThenable; exports.maybeAsync = maybeAsync; exports.waitFor = exports.onFirstPause = void 0; - function _gensync() { const data = require("gensync"); - _gensync = function () { return data; }; - return data; } - function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - const runGenerator = _gensync()(function* (item) { return yield* item; }); @@ -33,7 +27,6 @@ const isAsync = _gensync()({ }); exports.isAsync = isAsync; - function maybeAsync(fn, message) { return _gensync()({ sync(...args) { @@ -41,21 +34,17 @@ function maybeAsync(fn, message) { if (isThenable(result)) throw new Error(message); return result; }, - async(...args) { return Promise.resolve(fn.apply(this, args)); } - }); } - const withKind = _gensync()({ sync: cb => cb("sync"), async: function () { var _ref = _asyncToGenerator(function* (cb) { return cb("async"); }); - return function async(_x) { return _ref.apply(this, arguments); }; @@ -64,7 +53,6 @@ const withKind = _gensync()({ function forwardAsync(action, cb) { const g = _gensync()(action); - return withKind(kind => { const adapted = g[kind]; return cb(adapted); @@ -83,7 +71,6 @@ const onFirstPause = _gensync()({ completed = true; cb(err, value); }); - if (!completed) { firstPause(); } @@ -91,26 +78,21 @@ const onFirstPause = _gensync()({ }); exports.onFirstPause = onFirstPause; - const waitFor = _gensync()({ sync: x => x, async: function () { var _ref2 = _asyncToGenerator(function* (x) { return x; }); - return function async(_x2) { return _ref2.apply(this, arguments); }; }() }); - exports.waitFor = waitFor; - function isThenable(val) { return !!val && (typeof val === "object" || typeof val === "function") && !!val.then && typeof val.then === "function"; } - 0 && 0; //# sourceMappingURL=async.js.map diff --git a/node_modules/@babel/core/lib/gensync-utils/async.js.map b/node_modules/@babel/core/lib/gensync-utils/async.js.map index 330e0ee2a..b0a7b7528 100644 --- a/node_modules/@babel/core/lib/gensync-utils/async.js.map +++ b/node_modules/@babel/core/lib/gensync-utils/async.js.map @@ -1 +1 @@ -{"version":3,"names":["runGenerator","gensync","item","isAsync","sync","errback","cb","maybeAsync","fn","message","args","result","apply","isThenable","Error","async","Promise","resolve","withKind","forwardAsync","action","g","kind","adapted","onFirstPause","name","arity","firstPause","completed","err","value","waitFor","x","val","then"],"sources":["../../src/gensync-utils/async.ts"],"sourcesContent":["import gensync, { type Gensync, type Handler, type Callback } from \"gensync\";\n\ntype MaybePromise = T | Promise;\n\nconst runGenerator: {\n sync(gen: Handler): Return;\n async(gen: Handler): Promise;\n errback(gen: Handler, cb: Callback): void;\n} = gensync(function* (item: Handler): Handler {\n return yield* item;\n});\n\n// This Gensync returns true if the current execution context is\n// asynchronous, otherwise it returns false.\nexport const isAsync = gensync({\n sync: () => false,\n errback: cb => cb(null, true),\n});\n\n// This function wraps any functions (which could be either synchronous or\n// asynchronous) with a Gensync. If the wrapped function returns a promise\n// but the current execution context is synchronous, it will throw the\n// provided error.\n// This is used to handle user-provided functions which could be asynchronous.\nexport function maybeAsync(\n fn: (...args: Args) => Return,\n message: string,\n): Gensync {\n return gensync({\n sync(...args) {\n const result = fn.apply(this, args) as Return;\n if (isThenable(result)) throw new Error(message);\n return result;\n },\n async(...args) {\n return Promise.resolve(fn.apply(this, args));\n },\n });\n}\n\nconst withKind = gensync({\n sync: cb => cb(\"sync\"),\n async: async cb => cb(\"async\"),\n}) as (cb: (kind: \"sync\" | \"async\") => MaybePromise) => Handler;\n\n// This function wraps a generator (or a Gensync) into another function which,\n// when called, will run the provided generator in a sync or async way, depending\n// on the execution context where this forwardAsync function is called.\n// This is useful, for example, when passing a callback to a function which isn't\n// aware of gensync, but it only knows about synchronous and asynchronous functions.\n// An example is cache.using, which being exposed to the user must be as simple as\n// possible:\n// yield* forwardAsync(gensyncFn, wrappedFn =>\n// cache.using(x => {\n// // Here we don't know about gensync. wrappedFn is a\n// // normal sync or async function\n// return wrappedFn(x);\n// })\n// )\nexport function forwardAsync(\n action: (...args: Args) => Handler,\n cb: (\n adapted: (...args: Args) => MaybePromise,\n ) => MaybePromise,\n): Handler {\n const g = gensync(action);\n return withKind(kind => {\n const adapted = g[kind];\n return cb(adapted);\n });\n}\n\n// If the given generator is executed asynchronously, the first time that it\n// is paused (i.e. When it yields a gensync generator which can't be run\n// synchronously), call the \"firstPause\" callback.\nexport const onFirstPause = gensync<\n [gen: Handler, firstPause: () => void],\n unknown\n>({\n name: \"onFirstPause\",\n arity: 2,\n sync: function (item) {\n return runGenerator.sync(item);\n },\n errback: function (item, firstPause, cb) {\n let completed = false;\n\n runGenerator.errback(item, (err, value) => {\n completed = true;\n cb(err, value);\n });\n\n if (!completed) {\n firstPause();\n }\n },\n}) as (gen: Handler, firstPause: () => void) => Handler;\n\n// Wait for the given promise to be resolved\nexport const waitFor = gensync({\n sync: x => x,\n async: async x => x,\n}) as (p: T | Promise) => Handler;\n\nexport function isThenable(val: any): val is PromiseLike {\n return (\n !!val &&\n (typeof val === \"object\" || typeof val === \"function\") &&\n !!val.then &&\n typeof val.then === \"function\"\n );\n}\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;;;AAIA,MAAMA,YAIL,GAAGC,UAAA,CAAQ,WAAWC,IAAX,EAA6C;EACvD,OAAO,OAAOA,IAAd;AACD,CAFG,CAJJ;;AAUO,MAAMC,OAAO,GAAGF,UAAA,CAAQ;EAC7BG,IAAI,EAAE,MAAM,KADiB;EAE7BC,OAAO,EAAEC,EAAE,IAAIA,EAAE,CAAC,IAAD,EAAO,IAAP;AAFY,CAAR,CAAhB;;;;AAUA,SAASC,UAAT,CACLC,EADK,EAELC,OAFK,EAGkB;EACvB,OAAOR,UAAA,CAAQ;IACbG,IAAI,CAAC,GAAGM,IAAJ,EAAU;MACZ,MAAMC,MAAM,GAAGH,EAAE,CAACI,KAAH,CAAS,IAAT,EAAeF,IAAf,CAAf;MACA,IAAIG,UAAU,CAACF,MAAD,CAAd,EAAwB,MAAM,IAAIG,KAAJ,CAAUL,OAAV,CAAN;MACxB,OAAOE,MAAP;IACD,CALY;;IAMbI,KAAK,CAAC,G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I,EAAE4B,CAAC,IAAIA,CADkB;EAE7BjB,KAAK;IAAA,8BAAE,WAAMiB,CAAN;MAAA,OAAWA,CAAX;IAAA,CAAF;;IAAA;MAAA;IAAA;EAAA;AAFwB,CAAR,CAAhB;;;;AAKA,SAASnB,UAAT,CAA6BoB,GAA7B,EAA8D;EACnE,OACE,CAAC,CAACA,GAAF,KACC,OAAOA,GAAP,KAAe,QAAf,IAA2B,OAAOA,GAAP,KAAe,UAD3C,KAEA,CAAC,CAACA,GAAG,CAACC,IAFN,IAGA,OAAOD,GAAG,CAACC,IAAX,KAAoB,UAJtB;AAMD"} \ No newline at end of file +{"version":3,"names":["runGenerator","gensync","item","isAsync","sync","errback","cb","maybeAsync","fn","message","args","result","apply","isThenable","Error","async","Promise","resolve","withKind","forwardAsync","action","g","kind","adapted","onFirstPause","name","arity","firstPause","completed","err","value","waitFor","x","val","then"],"sources":["../../src/gensync-utils/async.ts"],"sourcesContent":["import gensync, { type Gensync, type Handler, type Callback } from \"gensync\";\n\ntype MaybePromise = T | Promise;\n\nconst runGenerator: {\n sync(gen: Handler): Return;\n async(gen: Handler): Promise;\n errback(gen: Handler, cb: Callback): void;\n} = gensync(function* (item: Handler): Handler {\n return yield* item;\n});\n\n// This Gensync returns true if the current execution context is\n// asynchronous, otherwise it returns false.\nexport const isAsync = gensync({\n sync: () => false,\n errback: cb => cb(null, true),\n});\n\n// This function wraps any functions (which could be either synchronous or\n// asynchronous) with a Gensync. If the wrapped function returns a promise\n// but the current execution context is synchronous, it will throw the\n// provided error.\n// This is used to handle user-provided functions which could be asynchronous.\nexport function maybeAsync(\n fn: (...args: Args) => Return,\n message: string,\n): Gensync {\n return gensync({\n sync(...args) {\n const result = fn.apply(this, args) as Return;\n if (isThenable(result)) throw new Error(message);\n return result;\n },\n async(...args) {\n return Promise.resolve(fn.apply(this, args));\n },\n });\n}\n\nconst withKind = gensync({\n sync: cb => cb(\"sync\"),\n async: async cb => cb(\"async\"),\n}) as (cb: (kind: \"sync\" | \"async\") => MaybePromise) => Handler;\n\n// This function wraps a generator (or a Gensync) into another function which,\n// when called, will run the provided generator in a sync or async way, depending\n// on the execution context where this forwardAsync function is called.\n// This is useful, for example, when passing a callback to a function which isn't\n// aware of gensync, but it only knows about synchronous and asynchronous functions.\n// An example is cache.using, which being exposed to the user must be as simple as\n// possible:\n// yield* forwardAsync(gensyncFn, wrappedFn =>\n// cache.using(x => {\n// // Here we don't know about gensync. wrappedFn is a\n// // normal sync or async function\n// return wrappedFn(x);\n// })\n// )\nexport function forwardAsync(\n action: (...args: Args) => Handler,\n cb: (\n adapted: (...args: Args) => MaybePromise,\n ) => MaybePromise,\n): Handler {\n const g = gensync(action);\n return withKind(kind => {\n const adapted = g[kind];\n return cb(adapted);\n });\n}\n\n// If the given generator is executed asynchronously, the first time that it\n// is paused (i.e. When it yields a gensync generator which can't be run\n// synchronously), call the \"firstPause\" callback.\nexport const onFirstPause = gensync<\n [gen: Handler, firstPause: () => void],\n unknown\n>({\n name: \"onFirstPause\",\n arity: 2,\n sync: function (item) {\n return runGenerator.sync(item);\n },\n errback: function (item, firstPause, cb) {\n let completed = false;\n\n runGenerator.errback(item, (err, value) => {\n completed = true;\n cb(err, value);\n });\n\n if (!completed) {\n firstPause();\n }\n },\n}) as (gen: Handler, firstPause: () => void) => Handler;\n\n// Wait for the given promise to be resolved\nexport const waitFor = gensync({\n sync: x => x,\n async: async x => x,\n}) as (p: T | Promise) => Handler;\n\nexport function isThenable(val: any): val is PromiseLike {\n return (\n !!val &&\n (typeof val === \"object\" || typeof val === \"function\") &&\n !!val.then &&\n typeof val.then === \"function\"\n );\n}\n"],"mappings":";;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA6E;AAAA;AAI7E,MAAMA,YAIL,GAAGC,UAAO,CAAC,WAAWC,IAAkB,EAAgB;EACvD,OAAO,OAAOA,IAAI;AACpB,CAAC,CAAC;;AAIK,MAAMC,OAAO,GAAGF,UAAO,CAAC;EAC7BG,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ACF,IAAI,CAAC;EAChC,CAAC;EACDG,OAAO,EAAE,UAAUH,IAAI,EAAEyB,UAAU,EAAErB,EAAE,EAAE;IACvC,IAAIsB,SAAS,GAAG,KAAK;IAErB5B,YAAY,CAACK,OAAO,CAACH,IAAI,EAAE,CAAC2B,GAAG,EAAEC,KAAK,KAAK;MACzCF,SAAS,GAAG,IAAI;MAChBtB,EAAE,CAACuB,GAAG,EAAEC,KAAK,CAAC;IAChB,CAAC,CAAC;IAEF,IAAI,CAACF,SAAS,EAAE;MACdD,UAAU,EAAE;IACd;EACF;AACF,CAAC,CAA+D;;AAAC;AAG1D,MAAMI,OAAO,GAAG9B,UAAO,CAAC;EAC7BG,IAAI,EAAE4B,CAAC,IAAIA,CAAC;EACZjB,KAAK;IAAA,8BAAE,WAAMiB,CAAC;MAAA,OAAIA,CAAC;IAAA;IAAA;MAAA;IAAA;EAAA;AACrB,CAAC,CAAyC;AAAC;AAEpC,SAASnB,UAAU,CAAUoB,GAAQ,EAAyB;EACnE,OACE,CAAC,CAACA,GAAG,KACJ,OAAOA,GAAG,KAAK,QAAQ,IAAI,OAAOA,GAAG,KAAK,UAAU,CAAC,IACtD,CAAC,CAACA,GAAG,CAACC,IAAI,IACV,OAAOD,GAAG,CAACC,IAAI,KAAK,UAAU;AAElC;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/gensync-utils/fs.js b/node_modules/@babel/core/lib/gensync-utils/fs.js index 31f49ae55..db7f3d1d3 100644 --- a/node_modules/@babel/core/lib/gensync-utils/fs.js +++ b/node_modules/@babel/core/lib/gensync-utils/fs.js @@ -4,39 +4,29 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.stat = exports.readFile = void 0; - function _fs() { const data = require("fs"); - _fs = function () { return data; }; - return data; } - function _gensync() { const data = require("gensync"); - _gensync = function () { return data; }; - return data; } - const readFile = _gensync()({ sync: _fs().readFileSync, errback: _fs().readFile }); - exports.readFile = readFile; - const stat = _gensync()({ sync: _fs().statSync, errback: _fs().stat }); - exports.stat = stat; 0 && 0; diff --git a/node_modules/@babel/core/lib/gensync-utils/fs.js.map b/node_modules/@babel/core/lib/gensync-utils/fs.js.map index cc32eb1f5..788a14fa6 100644 --- a/node_modules/@babel/core/lib/gensync-utils/fs.js.map +++ b/node_modules/@babel/core/lib/gensync-utils/fs.js.map @@ -1 +1 @@ -{"version":3,"names":["readFile","gensync","sync","fs","readFileSync","errback","stat","statSync"],"sources":["../../src/gensync-utils/fs.ts"],"sourcesContent":["import fs from \"fs\";\nimport gensync from \"gensync\";\n\nexport const readFile = gensync<[filepath: string, encoding: \"utf8\"], string>({\n sync: fs.readFileSync,\n errback: fs.readFile,\n});\n\nexport const stat = gensync({\n sync: fs.statSync,\n errback: fs.stat,\n});\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,QAAQ,GAAGC,UAAA,CAAsD;EAC5EC,IAAI,EAAEC,KAAA,CAAGC,YADmE;EAE5EC,OAAO,EAAEF,KAAA,CAAGH;AAFgE,CAAtD,CAAjB;;;;AAKA,MAAMM,IAAI,GAAGL,UAAA,CAAQ;EAC1BC,IAAI,EAAEC,KAAA,CAAGI,QADiB;EAE1BF,OAAO,EAAEF,KAAA,CAAGG;AAFc,CAAR,CAAb"} \ No newline at end of file +{"version":3,"names":["readFile","gensync","sync","fs","readFileSync","errback","stat","statSync"],"sources":["../../src/gensync-utils/fs.ts"],"sourcesContent":["import fs from \"fs\";\nimport gensync from \"gensync\";\n\nexport const readFile = gensync<[filepath: string, encoding: \"utf8\"], string>({\n sync: fs.readFileSync,\n errback: fs.readFile,\n});\n\nexport const stat = gensync({\n sync: fs.statSync,\n errback: fs.stat,\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,QAAQ,GAAGC,UAAO,CAA+C;EAC5EC,IAAI,EAAEC,KAAE,CAACC,YAAY;EACrBC,OAAO,EAAEF,KAAE,CAACH;AACd,CAAC,CAAC;AAAC;AAEI,MAAMM,IAAI,GAAGL,UAAO,CAAC;EAC1BC,IAAI,EAAEC,KAAE,CAACI,QAAQ;EACjBF,OAAO,EAAEF,KAAE,CAACG;AACd,CAAC,CAAC;AAAC;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/gensync-utils/functional.js b/node_modules/@babel/core/lib/gensync-utils/functional.js index a80eaf712..db849596b 100644 --- a/node_modules/@babel/core/lib/gensync-utils/functional.js +++ b/node_modules/@babel/core/lib/gensync-utils/functional.js @@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.once = once; - var _async = require("./async"); - function once(fn) { let result; let resultP; @@ -19,7 +17,6 @@ function once(fn) { resolve = res; reject = rej; }); - try { result = yield* fn(); resultP = null; @@ -31,7 +28,6 @@ function once(fn) { } }; } - 0 && 0; //# sourceMappingURL=functional.js.map diff --git a/node_modules/@babel/core/lib/gensync-utils/functional.js.map b/node_modules/@babel/core/lib/gensync-utils/functional.js.map index 0db106a7a..cfa6ed024 100644 --- a/node_modules/@babel/core/lib/gensync-utils/functional.js.map +++ b/node_modules/@babel/core/lib/gensync-utils/functional.js.map @@ -1 +1 @@ -{"version":3,"names":["once","fn","result","resultP","isAsync","waitFor","resolve","reject","Promise","res","rej","error"],"sources":["../../src/gensync-utils/functional.ts"],"sourcesContent":["import type { Handler } from \"gensync\";\n\nimport { isAsync, waitFor } from \"./async\";\n\nexport function once(fn: () => Handler): () => Handler {\n let result: R;\n let resultP: Promise;\n return function* () {\n if (result) return result;\n if (!(yield* isAsync())) return (result = yield* fn());\n if (resultP) return yield* waitFor(resultP);\n\n let resolve: (result: R) => void, reject: (error: unknown) => void;\n resultP = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n\n try {\n result = yield* fn();\n // Avoid keeping the promise around\n // now that we have the result.\n resultP = null;\n resolve(result);\n return result;\n } catch (error) {\n reject(error);\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;;AAEA;;AAEO,SAASA,IAAT,CAAiBC,EAAjB,EAAyD;EAC9D,IAAIC,MAAJ;EACA,IAAIC,OAAJ;EACA,OAAO,aAAa;IAClB,IAAID,MAAJ,EAAY,OAAOA,MAAP;IACZ,IAAI,EAAE,OAAO,IAAAE,cAAA,GAAT,CAAJ,EAAyB,OAAQF,MAAM,GAAG,OAAOD,EAAE,EAA1B;IACzB,IAAIE,OAAJ,EAAa,OAAO,OAAO,IAAAE,cAAA,EAAQF,OAAR,CAAd;IAEb,IAAIG,OAAJ,EAAkCC,MAAlC;IACAJ,OAAO,GAAG,IAAIK,OAAJ,CAAY,CAACC,GAAD,EAAMC,GAAN,KAAc;MAClCJ,OAAO,GAAGG,GAAV;MACAF,MAAM,GAAGG,GAAT;IACD,CAHS,CAAV;;IAKA,IAAI;MACFR,MAAM,GAAG,OAAOD,EAAE,EAAlB;MAGAE,OAAO,GAAG,IAAV;MACAG,OAAO,CAACJ,MAAD,CAAP;MACA,OAAOA,MAAP;IACD,CAPD,CAOE,OAAOS,KAAP,EAAc;MACdJ,MAAM,CAACI,KAAD,CAAN;MACA,MAAMA,KAAN;IACD;EACF,CAtBD;AAuBD"} \ No newline at end of file +{"version":3,"names":["once","fn","result","resultP","isAsync","waitFor","resolve","reject","Promise","res","rej","error"],"sources":["../../src/gensync-utils/functional.ts"],"sourcesContent":["import type { Handler } from \"gensync\";\n\nimport { isAsync, waitFor } from \"./async\";\n\nexport function once(fn: () => Handler): () => Handler {\n let result: R;\n let resultP: Promise;\n return function* () {\n if (result) return result;\n if (!(yield* isAsync())) return (result = yield* fn());\n if (resultP) return yield* waitFor(resultP);\n\n let resolve: (result: R) => void, reject: (error: unknown) => void;\n resultP = new Promise((res, rej) => {\n resolve = res;\n reject = rej;\n });\n\n try {\n result = yield* fn();\n // Avoid keeping the promise around\n // now that we have the result.\n resultP = null;\n resolve(result);\n return result;\n } catch (error) {\n reject(error);\n throw error;\n }\n };\n}\n"],"mappings":";;;;;;AAEA;AAEO,SAASA,IAAI,CAAIC,EAAoB,EAAoB;EAC9D,IAAIC,MAAS;EACb,IAAIC,OAAmB;EACvB,OAAO,aAAa;IAClB,IAAID,MAAM,EAAE,OAAOA,MAAM;IACzB,IAAI,EAAE,OAAO,IAAAE,cAAO,GAAE,CAAC,EAAE,OAAQF,MAAM,GAAG,OAAOD,EAAE,EAAE;IACrD,IAAIE,OAAO,EAAE,OAAO,OAAO,IAAAE,cAAO,EAACF,OAAO,CAAC;IAE3C,IAAIG,OAA4B,EAAEC,MAAgC;IAClEJ,OAAO,GAAG,IAAIK,OAAO,CAAC,CAACC,GAAG,EAAEC,GAAG,KAAK;MAClCJ,OAAO,GAAGG,GAAG;MACbF,MAAM,GAAGG,GAAG;IACd,CAAC,CAAC;IAEF,IAAI;MACFR,MAAM,GAAG,OAAOD,EAAE,EAAE;MAGpBE,OAAO,GAAG,IAAI;MACdG,OAAO,CAACJ,MAAM,CAAC;MACf,OAAOA,MAAM;IACf,CAAC,CAAC,OAAOS,KAAK,EAAE;MACdJ,MAAM,CAACI,KAAK,CAAC;MACb,MAAMA,KAAK;IACb;EACF,CAAC;AACH;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/index.js b/node_modules/@babel/core/lib/index.js index 53693a270..cd6d14890 100644 --- a/node_modules/@babel/core/lib/index.js +++ b/node_modules/@babel/core/lib/index.js @@ -181,90 +181,63 @@ Object.defineProperty((0, exports), "traverse", { } }); exports.version = exports.types = void 0; - var _file = require("./transformation/file/file"); - var _buildExternalHelpers = require("./tools/build-external-helpers"); - var _files = require("./config/files"); - var _environment = require("./config/helpers/environment"); - function _types() { const data = require("@babel/types"); - _types = function () { return data; }; - return data; } - Object.defineProperty((0, exports), "types", { enumerable: true, get: function () { return _types(); } }); - function _parser() { const data = require("@babel/parser"); - _parser = function () { return data; }; - return data; } - function _traverse() { const data = require("@babel/traverse"); - _traverse = function () { return data; }; - return data; } - function _template() { const data = require("@babel/template"); - _template = function () { return data; }; - return data; } - var _config = require("./config"); - var _transform = require("./transform"); - var _transformFile = require("./transform-file"); - var _transformAst = require("./transform-ast"); - var _parse = require("./parse"); - -const version = "7.19.3"; +const version = "7.20.5"; exports.version = version; const DEFAULT_EXTENSIONS = Object.freeze([".js", ".jsx", ".es6", ".es", ".mjs", ".cjs"]); -exports.DEFAULT_EXTENSIONS = DEFAULT_EXTENSIONS; +exports.DEFAULT_EXTENSIONS = DEFAULT_EXTENSIONS; class OptionManager { init(opts) { return (0, _config.loadOptionsSync)(opts); } - } - exports.OptionManager = OptionManager; - function Plugin(alias) { throw new Error(`The (${alias}) Babel 5 plugin is being run with an unsupported Babel version.`); } - 0 && (exports.types = exports.traverse = exports.tokTypes = exports.template = 0); //# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/core/lib/index.js.map b/node_modules/@babel/core/lib/index.js.map index bde43bb79..140d7cc62 100644 --- a/node_modules/@babel/core/lib/index.js.map +++ b/node_modules/@babel/core/lib/index.js.map @@ -1 +1 @@ -{"version":3,"names":["version","DEFAULT_EXTENSIONS","Object","freeze","OptionManager","init","opts","loadOptionsSync","Plugin","alias","Error"],"sources":["../src/index.ts"],"sourcesContent":["declare const PACKAGE_JSON: { name: string; version: string };\nexport const version = PACKAGE_JSON.version;\n\nexport { default as File } from \"./transformation/file/file\";\nexport type { default as PluginPass } from \"./transformation/plugin-pass\";\nexport { default as buildExternalHelpers } from \"./tools/build-external-helpers\";\nexport { resolvePlugin, resolvePreset } from \"./config/files\";\n\nexport { getEnv } from \"./config/helpers/environment\";\n\n// NOTE: Lazy re-exports aren't detected by the Node.js CJS-ESM interop.\n// These are handled by pluginInjectNodeReexportsHints in our babel.config.js\n// so that they can work well.\nexport * as types from \"@babel/types\";\nexport { tokTypes } from \"@babel/parser\";\nexport { default as traverse } from \"@babel/traverse\";\nexport { default as template } from \"@babel/template\";\n\nexport {\n createConfigItem,\n createConfigItemSync,\n createConfigItemAsync,\n} from \"./config\";\n\nexport {\n loadPartialConfig,\n loadPartialConfigSync,\n loadPartialConfigAsync,\n loadOptions,\n loadOptionsSync,\n loadOptionsAsync,\n} from \"./config\";\n\nexport type {\n CallerMetadata,\n InputOptions,\n PluginAPI,\n PluginObject,\n PresetAPI,\n PresetObject,\n} from \"./config\";\n\nexport {\n transform,\n transformSync,\n transformAsync,\n type FileResult,\n} from \"./transform\";\nexport {\n transformFile,\n transformFileSync,\n transformFileAsync,\n} from \"./transform-file\";\nexport {\n transformFromAst,\n transformFromAstSync,\n transformFromAstAsync,\n} from \"./transform-ast\";\nexport { parse, parseSync, parseAsync } from \"./parse\";\n\n/**\n * Recommended set of compilable extensions. Not used in @babel/core directly, but meant as\n * as an easy source for tooling making use of @babel/core.\n */\nexport const DEFAULT_EXTENSIONS = Object.freeze([\n \".js\",\n \".jsx\",\n \".es6\",\n \".es\",\n \".mjs\",\n \".cjs\",\n] as const);\n\n// For easier backward-compatibility, provide an API like the one we exposed in Babel 6.\nimport { loadOptionsSync } from \"./config\";\nexport class OptionManager {\n init(opts: {}) {\n return loadOptionsSync(opts);\n }\n}\n\nexport function Plugin(alias: string) {\n throw new Error(\n `The (${alias}) Babel 5 plugin is being run with an unsupported Babel version.`,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;AAEA;;AACA;;AAEA;;;;;;;;;;;;;;;;;;;AAMA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;;AAwBA;;AAMA;;AAKA;;AAKA;;AAzDO,MAAMA,OAAO,WAAb;;AA+DA,MAAMC,kBAAkB,GAAGC,MAAM,CAACC,MAAP,CAAc,CAC9C,KAD8C,EAE9C,MAF8C,EAG9C,MAH8C,EAI9C,KAJ8C,EAK9C,MAL8C,EAM9C,MAN8C,CAAd,CAA3B;;;AAWA,MAAMC,aAAN,CAAoB;EACzBC,IAAI,CAACC,IAAD,EAAW;IACb,OAAO,IAAAC,uBAAA,EAAgBD,IAAhB,CAAP;EACD;;AAHwB;;;;AAMpB,SAASE,MAAT,CAAgBC,KAAhB,EAA+B;EACpC,MAAM,IAAIC,KAAJ,CACH,QAAOD,KAAM,kEADV,CAAN;AAGD"} \ No newline at end of file +{"version":3,"names":["version","DEFAULT_EXTENSIONS","Object","freeze","OptionManager","init","opts","loadOptionsSync","Plugin","alias","Error"],"sources":["../src/index.ts"],"sourcesContent":["declare const PACKAGE_JSON: { name: string; version: string };\nexport const version = PACKAGE_JSON.version;\n\nexport { default as File } from \"./transformation/file/file\";\nexport type { default as PluginPass } from \"./transformation/plugin-pass\";\nexport { default as buildExternalHelpers } from \"./tools/build-external-helpers\";\nexport { resolvePlugin, resolvePreset } from \"./config/files\";\n\nexport { getEnv } from \"./config/helpers/environment\";\n\n// NOTE: Lazy re-exports aren't detected by the Node.js CJS-ESM interop.\n// These are handled by pluginInjectNodeReexportsHints in our babel.config.js\n// so that they can work well.\nexport * as types from \"@babel/types\";\nexport { tokTypes } from \"@babel/parser\";\nexport { default as traverse } from \"@babel/traverse\";\nexport { default as template } from \"@babel/template\";\n\nexport {\n createConfigItem,\n createConfigItemSync,\n createConfigItemAsync,\n} from \"./config\";\n\nexport {\n loadPartialConfig,\n loadPartialConfigSync,\n loadPartialConfigAsync,\n loadOptions,\n loadOptionsSync,\n loadOptionsAsync,\n} from \"./config\";\n\nexport type {\n CallerMetadata,\n InputOptions,\n PluginAPI,\n PluginObject,\n PresetAPI,\n PresetObject,\n} from \"./config\";\n\nexport {\n transform,\n transformSync,\n transformAsync,\n type FileResult,\n} from \"./transform\";\nexport {\n transformFile,\n transformFileSync,\n transformFileAsync,\n} from \"./transform-file\";\nexport {\n transformFromAst,\n transformFromAstSync,\n transformFromAstAsync,\n} from \"./transform-ast\";\nexport { parse, parseSync, parseAsync } from \"./parse\";\n\n/**\n * Recommended set of compilable extensions. Not used in @babel/core directly, but meant as\n * as an easy source for tooling making use of @babel/core.\n */\nexport const DEFAULT_EXTENSIONS = Object.freeze([\n \".js\",\n \".jsx\",\n \".es6\",\n \".es\",\n \".mjs\",\n \".cjs\",\n] as const);\n\n// For easier backward-compatibility, provide an API like the one we exposed in Babel 6.\nimport { loadOptionsSync } from \"./config\";\nexport class OptionManager {\n init(opts: {}) {\n return loadOptionsSync(opts);\n }\n}\n\nexport function Plugin(alias: string) {\n throw new Error(\n `The (${alias}) Babel 5 plugin is being run with an unsupported Babel version.`,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;AAEA;AACA;AAEA;AAAsD;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAAA;EAAA;EAAA;IAAA;EAAA;AAAA;AAMtD;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AAwBA;AAMA;AAKA;AAKA;AAzDO,MAAMA,OAAO,WAAuB;AAAC;AA+DrC,MAAMC,kBAAkB,GAAGC,MAAM,CAACC,MAAM,CAAC,CAC9C,KAAK,EACL,MAAM,EACN,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,CACP,CAAU;;AAAC;AAIL,MAAMC,aAAa,CAAC;EACzBC,IAAI,CAACC,IAAQ,EAAE;IACb,OAAO,IAAAC,uBAAe,EAACD,IAAI,CAAC;EAC9B;AACF;AAAC;AAEM,SAASE,MAAM,CAACC,KAAa,EAAE;EACpC,MAAM,IAAIC,KAAK,CACZ,QAAOD,KAAM,kEAAiE,CAChF;AACH;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/parse.js b/node_modules/@babel/core/lib/parse.js index 0c39e6af1..93bb7d100 100644 --- a/node_modules/@babel/core/lib/parse.js +++ b/node_modules/@babel/core/lib/parse.js @@ -6,60 +6,43 @@ Object.defineProperty(exports, "__esModule", { exports.parse = void 0; exports.parseAsync = parseAsync; exports.parseSync = parseSync; - function _gensync() { const data = require("gensync"); - _gensync = function () { return data; }; - return data; } - var _config = require("./config"); - var _parser = require("./parser"); - var _normalizeOpts = require("./transformation/normalize-opts"); - var _rewriteStackTrace = require("./errors/rewrite-stack-trace"); - const parseRunner = _gensync()(function* parse(code, opts) { const config = yield* (0, _config.default)(opts); - if (config === null) { return null; } - return yield* (0, _parser.default)(config.passes, (0, _normalizeOpts.default)(config), code); }); - const parse = function parse(code, opts, callback) { if (typeof opts === "function") { callback = opts; opts = undefined; } - if (callback === undefined) { { return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.sync)(code, opts); } } - (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.errback)(code, opts, callback); }; - exports.parse = parse; - function parseSync(...args) { return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.sync)(...args); } - function parseAsync(...args) { return (0, _rewriteStackTrace.beginHiddenCallStack)(parseRunner.async)(...args); } - 0 && 0; //# sourceMappingURL=parse.js.map diff --git a/node_modules/@babel/core/lib/parse.js.map b/node_modules/@babel/core/lib/parse.js.map index 1988c9fb7..f22369678 100644 --- a/node_modules/@babel/core/lib/parse.js.map +++ b/node_modules/@babel/core/lib/parse.js.map @@ -1 +1 @@ -{"version":3,"names":["parseRunner","gensync","parse","code","opts","config","loadConfig","parser","passes","normalizeOptions","callback","undefined","beginHiddenCallStack","sync","errback","parseSync","args","parseAsync","async"],"sources":["../src/parse.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\n\nimport loadConfig from \"./config\";\nimport type { InputOptions } from \"./config\";\nimport parser from \"./parser\";\nimport type { ParseResult } from \"./parser\";\nimport normalizeOptions from \"./transformation/normalize-opts\";\nimport type { ValidatedOptions } from \"./config/validation/options\";\n\nimport { beginHiddenCallStack } from \"./errors/rewrite-stack-trace\";\n\ntype FileParseCallback = {\n (err: Error, ast: null): void;\n (err: null, ast: ParseResult | null): void;\n};\n\ntype Parse = {\n (code: string, callback: FileParseCallback): void;\n (\n code: string,\n opts: InputOptions | undefined | null,\n callback: FileParseCallback,\n ): void;\n (code: string, opts?: InputOptions | null): ParseResult | null;\n};\n\nconst parseRunner = gensync(function* parse(\n code: string,\n opts: InputOptions | undefined | null,\n): Handler {\n const config = yield* loadConfig(opts);\n\n if (config === null) {\n return null;\n }\n\n return yield* parser(config.passes, normalizeOptions(config), code);\n});\n\nexport const parse: Parse = function parse(\n code,\n opts?,\n callback?: FileParseCallback,\n) {\n if (typeof opts === \"function\") {\n callback = opts;\n opts = undefined as ValidatedOptions;\n }\n\n if (callback === undefined) {\n if (process.env.BABEL_8_BREAKING) {\n throw new Error(\n \"Starting from Babel 8.0.0, the 'parse' function expects a callback. If you need to call it synchronously, please use 'parseSync'.\",\n );\n } else {\n // console.warn(\n // \"Starting from Babel 8.0.0, the 'parse' function will expect a callback. If you need to call it synchronously, please use 'parseSync'.\",\n // );\n return beginHiddenCallStack(parseRunner.sync)(code, opts);\n }\n }\n\n beginHiddenCallStack(parseRunner.errback)(code, opts, callback);\n};\n\nexport function parseSync(...args: Parameters) {\n return beginHiddenCallStack(parseRunner.sync)(...args);\n}\nexport function parseAsync(...args: Parameters) {\n return beginHiddenCallStack(parseRunner.async)(...args);\n}\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;;AAEA;;AAEA;;AAGA;;AAiBA,MAAMA,WAAW,GAAGC,UAAA,CAAQ,UAAUC,KAAV,CAC1BC,IAD0B,EAE1BC,IAF0B,EAGG;EAC7B,MAAMC,MAAM,GAAG,OAAO,IAAAC,eAAA,EAAWF,IAAX,CAAtB;;EAEA,IAAIC,MAAM,KAAK,IAAf,EAAqB;IACnB,OAAO,IAAP;EACD;;EAED,OAAO,OAAO,IAAAE,eAAA,EAAOF,MAAM,CAACG,MAAd,EAAsB,IAAAC,sBAAA,EAAiBJ,MAAjB,CAAtB,EAAgDF,IAAhD,CAAd;AACD,CAXmB,CAApB;;AAaO,MAAMD,KAAY,GAAG,SAASA,KAAT,CAC1BC,IAD0B,EAE1BC,IAF0B,EAG1BM,QAH0B,EAI1B;EACA,IAAI,OAAON,IAAP,KAAgB,UAApB,EAAgC;IAC9BM,QAAQ,GAAGN,IAAX;IACAA,IAAI,GAAGO,SAAP;EACD;;EAED,IAAID,QAAQ,KAAKC,SAAjB,EAA4B;IAKnB;MAIL,OAAO,IAAAC,uCAAA,EAAqBZ,WAAW,CAACa,IAAjC,EAAuCV,IAAvC,EAA6CC,IAA7C,CAAP;IACD;EACF;;EAED,IAAAQ,uCAAA,EAAqBZ,WAAW,CAACc,OAAjC,EAA0CX,IAA1C,EAAgDC,IAAhD,EAAsDM,QAAtD;AACD,CAxBM;;;;AA0BA,SAASK,SAAT,CAAmB,GAAGC,IAAtB,EAAiE;EACtE,OAAO,IAAAJ,uCAAA,EAAqBZ,WAAW,CAACa,IAAjC,EAAuC,GAAGG,IAA1C,CAAP;AACD;;AACM,SAASC,UAAT,CAAoB,GAAGD,IAAvB,EAAmE;EACxE,OAAO,IAAAJ,uCAAA,EAAqBZ,WAAW,CAACkB,KAAjC,EAAwC,GAAGF,IAA3C,CAAP;AACD"} \ No newline at end of file +{"version":3,"names":["parseRunner","gensync","parse","code","opts","config","loadConfig","parser","passes","normalizeOptions","callback","undefined","beginHiddenCallStack","sync","errback","parseSync","args","parseAsync","async"],"sources":["../src/parse.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\n\nimport loadConfig from \"./config\";\nimport type { InputOptions } from \"./config\";\nimport parser from \"./parser\";\nimport type { ParseResult } from \"./parser\";\nimport normalizeOptions from \"./transformation/normalize-opts\";\nimport type { ValidatedOptions } from \"./config/validation/options\";\n\nimport { beginHiddenCallStack } from \"./errors/rewrite-stack-trace\";\n\ntype FileParseCallback = {\n (err: Error, ast: null): void;\n (err: null, ast: ParseResult | null): void;\n};\n\ntype Parse = {\n (code: string, callback: FileParseCallback): void;\n (\n code: string,\n opts: InputOptions | undefined | null,\n callback: FileParseCallback,\n ): void;\n (code: string, opts?: InputOptions | null): ParseResult | null;\n};\n\nconst parseRunner = gensync(function* parse(\n code: string,\n opts: InputOptions | undefined | null,\n): Handler {\n const config = yield* loadConfig(opts);\n\n if (config === null) {\n return null;\n }\n\n return yield* parser(config.passes, normalizeOptions(config), code);\n});\n\nexport const parse: Parse = function parse(\n code,\n opts?,\n callback?: FileParseCallback,\n) {\n if (typeof opts === \"function\") {\n callback = opts;\n opts = undefined as ValidatedOptions;\n }\n\n if (callback === undefined) {\n if (process.env.BABEL_8_BREAKING) {\n throw new Error(\n \"Starting from Babel 8.0.0, the 'parse' function expects a callback. If you need to call it synchronously, please use 'parseSync'.\",\n );\n } else {\n // console.warn(\n // \"Starting from Babel 8.0.0, the 'parse' function will expect a callback. If you need to call it synchronously, please use 'parseSync'.\",\n // );\n return beginHiddenCallStack(parseRunner.sync)(code, opts);\n }\n }\n\n beginHiddenCallStack(parseRunner.errback)(code, opts, callback);\n};\n\nexport function parseSync(...args: Parameters) {\n return beginHiddenCallStack(parseRunner.sync)(...args);\n}\nexport function parseAsync(...args: Parameters) {\n return beginHiddenCallStack(parseRunner.async)(...args);\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AAEA;AAEA;AAGA;AAiBA,MAAMA,WAAW,GAAGC,UAAO,CAAC,UAAUC,KAAK,CACzCC,IAAY,EACZC,IAAqC,EACR;EAC7B,MAAMC,MAAM,GAAG,OAAO,IAAAC,eAAU,EAACF,IAAI,CAAC;EAEtC,IAAIC,MAAM,KAAK,IAAI,EAAE;IACnB,OAAO,IAAI;EACb;EAEA,OAAO,OAAO,IAAAE,eAAM,EAACF,MAAM,CAACG,MAAM,EAAE,IAAAC,sBAAgB,EAACJ,MAAM,CAAC,EAAEF,IAAI,CAAC;AACrE,CAAC,CAAC;AAEK,MAAMD,KAAY,GAAG,SAASA,KAAK,CACxCC,IAAI,EACJC,IAAK,EACLM,QAA4B,EAC5B;EACA,IAAI,OAAON,IAAI,KAAK,UAAU,EAAE;IAC9BM,QAAQ,GAAGN,IAAI;IACfA,IAAI,GAAGO,SAA6B;EACtC;EAEA,IAAID,QAAQ,KAAKC,SAAS,EAAE;IAKnB;MAIL,OAAO,IAAAC,uCAAoB,EAACZ,WAAW,CAACa,IAAI,CAAC,CAACV,IAAI,EAAEC,IAAI,CAAC;IAC3D;EACF;EAEA,IAAAQ,uCAAoB,EAACZ,WAAW,CAACc,OAAO,CAAC,CAACX,IAAI,EAAEC,IAAI,EAAEM,QAAQ,CAAC;AACjE,CAAC;AAAC;AAEK,SAASK,SAAS,CAAC,GAAGC,IAAyC,EAAE;EACtE,OAAO,IAAAJ,uCAAoB,EAACZ,WAAW,CAACa,IAAI,CAAC,CAAC,GAAGG,IAAI,CAAC;AACxD;AACO,SAASC,UAAU,CAAC,GAAGD,IAA0C,EAAE;EACxE,OAAO,IAAAJ,uCAAoB,EAACZ,WAAW,CAACkB,KAAK,CAAC,CAAC,GAAGF,IAAI,CAAC;AACzD;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/parser/index.js b/node_modules/@babel/core/lib/parser/index.js index 67d1771ff..582c3e7f8 100644 --- a/node_modules/@babel/core/lib/parser/index.js +++ b/node_modules/@babel/core/lib/parser/index.js @@ -4,29 +4,21 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = parser; - function _parser() { const data = require("@babel/parser"); - _parser = function () { return data; }; - return data; } - function _codeFrame() { const data = require("@babel/code-frame"); - _codeFrame = function () { return data; }; - return data; } - var _missingPluginHelper = require("./util/missing-plugin-helper"); - function* parser(pluginPasses, { parserOpts, highlightCode = true, @@ -34,32 +26,26 @@ function* parser(pluginPasses, { }, code) { try { const results = []; - for (const plugins of pluginPasses) { for (const plugin of plugins) { const { parserOverride } = plugin; - if (parserOverride) { const ast = parserOverride(code, parserOpts, _parser().parse); if (ast !== undefined) results.push(ast); } } } - if (results.length === 0) { return (0, _parser().parse)(code, parserOpts); } else if (results.length === 1) { yield* []; - if (typeof results[0].then === "function") { throw new Error(`You appear to be using an async parser plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`); } - return results[0]; } - throw new Error("More than one plugin attempted to override parsing."); } catch (err) { if (err.code === "BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED") { @@ -70,7 +56,6 @@ function* parser(pluginPasses, { loc, missingPlugin } = err; - if (loc) { const codeFrame = (0, _codeFrame().codeFrameColumns)(code, { start: { @@ -80,20 +65,16 @@ function* parser(pluginPasses, { }, { highlightCode }); - if (missingPlugin) { err.message = `${filename}: ` + (0, _missingPluginHelper.default)(missingPlugin[0], loc, codeFrame); } else { err.message = `${filename}: ${err.message}\n\n` + codeFrame; } - err.code = "BABEL_PARSE_ERROR"; } - throw err; } } - 0 && 0; //# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/core/lib/parser/index.js.map b/node_modules/@babel/core/lib/parser/index.js.map index ea7837d15..fe6d0cb50 100644 --- a/node_modules/@babel/core/lib/parser/index.js.map +++ b/node_modules/@babel/core/lib/parser/index.js.map @@ -1 +1 @@ -{"version":3,"names":["parser","pluginPasses","parserOpts","highlightCode","filename","code","results","plugins","plugin","parserOverride","ast","parse","undefined","push","length","then","Error","err","message","loc","missingPlugin","codeFrame","codeFrameColumns","start","line","column","generateMissingPluginMessage"],"sources":["../../src/parser/index.ts"],"sourcesContent":["import type { Handler } from \"gensync\";\nimport { parse } from \"@babel/parser\";\nimport { codeFrameColumns } from \"@babel/code-frame\";\nimport generateMissingPluginMessage from \"./util/missing-plugin-helper\";\nimport type { PluginPasses } from \"../config\";\n\nexport type ParseResult = ReturnType;\n\nexport default function* parser(\n pluginPasses: PluginPasses,\n { parserOpts, highlightCode = true, filename = \"unknown\" }: any,\n code: string,\n): Handler {\n try {\n const results = [];\n for (const plugins of pluginPasses) {\n for (const plugin of plugins) {\n const { parserOverride } = plugin;\n if (parserOverride) {\n const ast = parserOverride(code, parserOpts, parse);\n\n if (ast !== undefined) results.push(ast);\n }\n }\n }\n\n if (results.length === 0) {\n return parse(code, parserOpts);\n } else if (results.length === 1) {\n // @ts-expect-error - If we want to allow async parsers\n yield* [];\n if (typeof results[0].then === \"function\") {\n throw new Error(\n `You appear to be using an async parser plugin, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, you may need to upgrade ` +\n `your @babel/core version.`,\n );\n }\n return results[0];\n }\n // TODO: Add an error code\n throw new Error(\"More than one plugin attempted to override parsing.\");\n } catch (err) {\n if (err.code === \"BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED\") {\n err.message +=\n \"\\nConsider renaming the file to '.mjs', or setting sourceType:module \" +\n \"or sourceType:unambiguous in your Babel config for this file.\";\n // err.code will be changed to BABEL_PARSE_ERROR later.\n }\n\n const { loc, missingPlugin } = err;\n if (loc) {\n const codeFrame = codeFrameColumns(\n code,\n {\n start: {\n line: loc.line,\n column: loc.column + 1,\n },\n },\n {\n highlightCode,\n },\n );\n if (missingPlugin) {\n err.message =\n `${filename}: ` +\n generateMissingPluginMessage(missingPlugin[0], loc, codeFrame);\n } else {\n err.message = `${filename}: ${err.message}\\n\\n` + codeFrame;\n }\n err.code = \"BABEL_PARSE_ERROR\";\n }\n throw err;\n }\n}\n"],"mappings":";;;;;;;AACA;EAAA;;E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,GAA/B;;IACA,IAAIE,GAAJ,EAAS;MACP,MAAME,SAAS,GAAG,IAAAC,6BAAA,EAChBjB,IADgB,EAEhB;QACEkB,KAAK,EAAE;UACLC,IAAI,EAAEL,GAAG,CAACK,IADL;UAELC,MAAM,EAAEN,GAAG,CAACM,MAAJ,GAAa;QAFhB;MADT,CAFgB,EAQhB;QACEtB;MADF,CARgB,CAAlB;;MAYA,IAAIiB,aAAJ,EAAmB;QACjBH,GAAG,CAACC,OAAJ,GACG,GAAEd,QAAS,IAAZ,GACA,IAAAsB,4BAAA,EAA6BN,aAAa,CAAC,CAAD,CAA1C,EAA+CD,GAA/C,EAAoDE,SAApD,CAFF;MAGD,CAJD,MAIO;QACLJ,GAAG,CAACC,OAAJ,GAAe,GAAEd,QAAS,KAAIa,GAAG,CAACC,OAAQ,MAA5B,GAAoCG,SAAlD;MACD;;MACDJ,GAAG,CAACZ,IAAJ,GAAW,mBAAX;IACD;;IACD,MAAMY,GAAN;EACD;AACF"} \ No newline at end of file +{"version":3,"names":["parser","pluginPasses","parserOpts","highlightCode","filename","code","results","plugins","plugin","parserOverride","ast","parse","undefined","push","length","then","Error","err","message","loc","missingPlugin","codeFrame","codeFrameColumns","start","line","column","generateMissingPluginMessage"],"sources":["../../src/parser/index.ts"],"sourcesContent":["import type { Handler } from \"gensync\";\nimport { parse } from \"@babel/parser\";\nimport { codeFrameColumns } from \"@babel/code-frame\";\nimport generateMissingPluginMessage from \"./util/missing-plugin-helper\";\nimport type { PluginPasses } from \"../config\";\n\nexport type ParseResult = ReturnType;\n\nexport default function* parser(\n pluginPasses: PluginPasses,\n { parserOpts, highlightCode = true, filename = \"unknown\" }: any,\n code: string,\n): Handler {\n try {\n const results = [];\n for (const plugins of pluginPasses) {\n for (const plugin of plugins) {\n const { parserOverride } = plugin;\n if (parserOverride) {\n const ast = parserOverride(code, parserOpts, parse);\n\n if (ast !== undefined) results.push(ast);\n }\n }\n }\n\n if (results.length === 0) {\n return parse(code, parserOpts);\n } else if (results.length === 1) {\n // @ts-expect-error - If we want to allow async parsers\n yield* [];\n if (typeof results[0].then === \"function\") {\n throw new Error(\n `You appear to be using an async parser plugin, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, you may need to upgrade ` +\n `your @babel/core version.`,\n );\n }\n return results[0];\n }\n // TODO: Add an error code\n throw new Error(\"More than one plugin attempted to override parsing.\");\n } catch (err) {\n if (err.code === \"BABEL_PARSER_SOURCETYPE_MODULE_REQUIRED\") {\n err.message +=\n \"\\nConsider renaming the file to '.mjs', or setting sourceType:module \" +\n \"or sourceType:unambiguous in your Babel config for this file.\";\n // err.code will be changed to BABEL_PARSE_ERROR later.\n }\n\n const { loc, missingPlugin } = err;\n if (loc) {\n const codeFrame = codeFrameColumns(\n code,\n {\n start: {\n line: loc.line,\n column: loc.column + 1,\n },\n },\n {\n highlightCode,\n },\n );\n if (missingPlugin) {\n err.message =\n `${filename}: ` +\n generateMissingPluginMessage(missingPlugin[0], loc, codeFrame);\n } else {\n err.message = `${filename}: ${err.message}\\n\\n` + codeFrame;\n }\n err.code = \"BABEL_PARSE_ERROR\";\n }\n throw err;\n }\n}\n"],"mappings":";;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AAKe,UAAUA,MAAM,CAC7BC,YAA0B,EAC1B;EAAEC,UAAU;EAAEC,aAAa,GAAG,IAAI;EAAEC,QAAQ,GAAG;AAAe,CAAC,EAC/DC,IAAY,EACU;EACtB,IAAI;IACF,MAAMC,OAAO,GAAG,EAAE;IAClB,KAAK,MAAMC,OAAO,IAAIN,YAAY,EAAE;MAClC,KAAK,MAAMO,MAAM,IAAID,OAAO,EAAE;QAC5B,MAAM;UAAEE;QAAe,CAAC,GAAGD,MAAM;QACjC,IAAIC,cAAc,EAAE;UAClB,MAAMC,GAAG,GAAGD,cAAc,CAACJ,IAAI,EAAEH,UAAU,EAAES,eAAK,CAAC;UAEnD,IAAID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MAC7D;MACAJ,GAAG,CAACZ,IAAI,GAAG,mBAAmB;IAChC;IACA,MAAMY,GAAG;EACX;AACF;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js b/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js index c076116e4..992bf81d4 100644 --- a/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js +++ b/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js @@ -11,46 +11,6 @@ const pluginNameMap = { url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-async-do-expressions" } }, - classProperties: { - syntax: { - name: "@babel/plugin-syntax-class-properties", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties" - }, - transform: { - name: "@babel/plugin-proposal-class-properties", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-class-properties" - } - }, - classPrivateProperties: { - syntax: { - name: "@babel/plugin-syntax-class-properties", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties" - }, - transform: { - name: "@babel/plugin-proposal-class-properties", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-class-properties" - } - }, - classPrivateMethods: { - syntax: { - name: "@babel/plugin-syntax-class-properties", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties" - }, - transform: { - name: "@babel/plugin-proposal-private-methods", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-private-methods" - } - }, - classStaticBlock: { - syntax: { - name: "@babel/plugin-syntax-class-static-block", - url: "https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-syntax-class-static-block" - }, - transform: { - name: "@babel/plugin-proposal-class-static-block", - url: "https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-proposal-class-static-block" - } - }, decimal: { syntax: { name: "@babel/plugin-syntax-decimal", @@ -77,12 +37,6 @@ const pluginNameMap = { url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-do-expressions" } }, - dynamicImport: { - syntax: { - name: "@babel/plugin-syntax-dynamic-import", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-dynamic-import" - } - }, exportDefaultFrom: { syntax: { name: "@babel/plugin-syntax-export-default-from", @@ -93,16 +47,6 @@ const pluginNameMap = { url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-export-default-from" } }, - exportNamespaceFrom: { - syntax: { - name: "@babel/plugin-syntax-export-namespace-from", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-export-namespace-from" - }, - transform: { - name: "@babel/plugin-proposal-export-namespace-from", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-export-namespace-from" - } - }, flow: { syntax: { name: "@babel/plugin-syntax-flow", @@ -133,12 +77,6 @@ const pluginNameMap = { url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-function-sent" } }, - importMeta: { - syntax: { - name: "@babel/plugin-syntax-import-meta", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-import-meta" - } - }, jsx: { syntax: { name: "@babel/plugin-syntax-jsx", @@ -155,32 +93,6 @@ const pluginNameMap = { url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-import-assertions" } }, - moduleStringNames: { - syntax: { - name: "@babel/plugin-syntax-module-string-names", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-module-string-names" - } - }, - numericSeparator: { - syntax: { - name: "@babel/plugin-syntax-numeric-separator", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-numeric-separator" - }, - transform: { - name: "@babel/plugin-proposal-numeric-separator", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-numeric-separator" - } - }, - optionalChaining: { - syntax: { - name: "@babel/plugin-syntax-optional-chaining", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-optional-chaining" - }, - transform: { - name: "@babel/plugin-proposal-optional-chaining", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-optional-chaining" - } - }, pipelineOperator: { syntax: { name: "@babel/plugin-syntax-pipeline-operator", @@ -191,16 +103,6 @@ const pluginNameMap = { url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-pipeline-operator" } }, - privateIn: { - syntax: { - name: "@babel/plugin-syntax-private-property-in-object", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-private-property-in-object" - }, - transform: { - name: "@babel/plugin-proposal-private-property-in-object", - url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-private-property-in-object" - } - }, recordAndTuple: { syntax: { name: "@babel/plugin-syntax-record-and-tuple", @@ -247,6 +149,68 @@ const pluginNameMap = { url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-async-generator-functions" } }, + classProperties: { + syntax: { + name: "@babel/plugin-syntax-class-properties", + url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties" + }, + transform: { + name: "@babel/plugin-proposal-class-properties", + url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-class-properties" + } + }, + classPrivateProperties: { + syntax: { + name: "@babel/plugin-syntax-class-properties", + url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties" + }, + transform: { + name: "@babel/plugin-proposal-class-properties", + url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-class-properties" + } + }, + classPrivateMethods: { + syntax: { + name: "@babel/plugin-syntax-class-properties", + url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties" + }, + transform: { + name: "@babel/plugin-proposal-private-methods", + url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-private-methods" + } + }, + classStaticBlock: { + syntax: { + name: "@babel/plugin-syntax-class-static-block", + url: "https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-syntax-class-static-block" + }, + transform: { + name: "@babel/plugin-proposal-class-static-block", + url: "https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-proposal-class-static-block" + } + }, + dynamicImport: { + syntax: { + name: "@babel/plugin-syntax-dynamic-import", + url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-dynamic-import" + } + }, + exportNamespaceFrom: { + syntax: { + name: "@babel/plugin-syntax-export-namespace-from", + url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-export-namespace-from" + }, + transform: { + name: "@babel/plugin-proposal-export-namespace-from", + url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-export-namespace-from" + } + }, + importMeta: { + syntax: { + name: "@babel/plugin-syntax-import-meta", + url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-import-meta" + } + }, logicalAssignment: { syntax: { name: "@babel/plugin-syntax-logical-assignment-operators", @@ -257,6 +221,22 @@ const pluginNameMap = { url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-logical-assignment-operators" } }, + moduleStringNames: { + syntax: { + name: "@babel/plugin-syntax-module-string-names", + url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-module-string-names" + } + }, + numericSeparator: { + syntax: { + name: "@babel/plugin-syntax-numeric-separator", + url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-numeric-separator" + }, + transform: { + name: "@babel/plugin-proposal-numeric-separator", + url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-numeric-separator" + } + }, nullishCoalescingOperator: { syntax: { name: "@babel/plugin-syntax-nullish-coalescing-operator", @@ -286,10 +266,30 @@ const pluginNameMap = { name: "@babel/plugin-proposal-optional-catch-binding", url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-optional-catch-binding" } + }, + optionalChaining: { + syntax: { + name: "@babel/plugin-syntax-optional-chaining", + url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-optional-chaining" + }, + transform: { + name: "@babel/plugin-proposal-optional-chaining", + url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-optional-chaining" + } + }, + privateIn: { + syntax: { + name: "@babel/plugin-syntax-private-property-in-object", + url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-private-property-in-object" + }, + transform: { + name: "@babel/plugin-proposal-private-property-in-object", + url: "https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-private-property-in-object" + } } }; -pluginNameMap.privateIn.syntax = pluginNameMap.privateIn.transform; +pluginNameMap.privateIn.syntax = pluginNameMap.privateIn.transform; const getNameURLCombination = ({ name, url @@ -298,16 +298,13 @@ const getNameURLCombination = ({ function generateMissingPluginMessage(missingPluginName, loc, codeFrame) { let helpMessage = `Support for the experimental syntax '${missingPluginName}' isn't currently enabled ` + `(${loc.line}:${loc.column + 1}):\n\n` + codeFrame; const pluginInfo = pluginNameMap[missingPluginName]; - if (pluginInfo) { const { syntax: syntaxPlugin, transform: transformPlugin } = pluginInfo; - if (syntaxPlugin) { const syntaxPluginInfo = getNameURLCombination(syntaxPlugin); - if (transformPlugin) { const transformPluginInfo = getNameURLCombination(transformPlugin); const sectionType = transformPlugin.name.startsWith("@babel/plugin") ? "plugins" : "presets"; @@ -318,10 +315,8 @@ If you want to leave it as-is, add ${syntaxPluginInfo} to the 'plugins' section } } } - return helpMessage; } - 0 && 0; //# sourceMappingURL=missing-plugin-helper.js.map diff --git a/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js.map b/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js.map index 607625148..3c17cbc01 100644 --- a/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js.map +++ b/node_modules/@babel/core/lib/parser/util/missing-plugin-helper.js.map @@ -1 +1 @@ -{"version":3,"names":["pluginNameMap","asyncDoExpressions","syntax","name","url","classProperties","transform","classPrivateProperties","classPrivateMethods","classStaticBlock","decimal","decorators","doExpressions","dynamicImport","exportDefaultFrom","exportNamespaceFrom","flow","functionBind","functionSent","importMeta","jsx","importAssertions","moduleStringNames","numericSeparator","optionalChaining","pipelineOperator","privateIn","recordAndTuple","regexpUnicodeSets","throwExpressions","typescript","asyncGenerators","logicalAssignment","nullishCoalescingOperator","objectRestSpread","optionalCatchBinding","getNameURLCombination","generateMissingPluginMessage","missingPluginName","loc","codeFrame","helpMessage","line","column","pluginInfo","syntaxPlugin","transformPlugin","syntaxPluginInfo","transformPluginInfo","sectionType","startsWith"],"sources":["../../../src/parser/util/missing-plugin-helper.ts"],"sourcesContent":["const pluginNameMap: Record<\n string,\n Partial>>\n> = {\n asyncDoExpressions: {\n syntax: {\n name: \"@babel/plugin-syntax-async-do-expressions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-async-do-expressions\",\n },\n },\n classProperties: {\n syntax: {\n name: \"@babel/plugin-syntax-class-properties\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties\",\n },\n transform: {\n name: \"@babel/plugin-proposal-class-properties\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-class-properties\",\n },\n },\n classPrivateProperties: {\n syntax: {\n name: \"@babel/plugin-syntax-class-properties\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties\",\n },\n transform: {\n name: \"@babel/plugin-proposal-class-properties\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-class-properties\",\n },\n },\n classPrivateMethods: {\n syntax: {\n name: \"@babel/plugin-syntax-class-properties\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties\",\n },\n transform: {\n name: \"@babel/plugin-proposal-private-methods\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-private-methods\",\n },\n },\n classStaticBlock: {\n syntax: {\n name: \"@babel/plugin-syntax-class-static-block\",\n url: \"https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-syntax-class-static-block\",\n },\n transform: {\n name: \"@babel/plugin-proposal-class-static-block\",\n url: \"https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-proposal-class-static-block\",\n },\n },\n decimal: {\n syntax: {\n name: \"@babel/plugin-syntax-decimal\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-decimal\",\n },\n },\n decorators: {\n syntax: {\n name: \"@babel/plugin-syntax-decorators\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-decorators\",\n },\n transform: {\n name: \"@babel/plugin-proposal-decorators\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-decorators\",\n },\n },\n doExpressions: {\n syntax: {\n name: \"@babel/plugin-syntax-do-expressions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-do-expressions\",\n },\n transform: {\n name: \"@babel/plugin-proposal-do-expressions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-do-expressions\",\n },\n },\n dynamicImport: {\n syntax: {\n name: \"@babel/plugin-syntax-dynamic-import\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-dynamic-import\",\n },\n },\n exportDefaultFrom: {\n syntax: {\n name: \"@babel/plugin-syntax-export-default-from\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-export-default-from\",\n },\n transform: {\n name: \"@babel/plugin-proposal-export-default-from\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-export-default-from\",\n },\n },\n exportNamespaceFrom: {\n syntax: {\n name: \"@babel/plugin-syntax-export-namespace-from\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-export-namespace-from\",\n },\n transform: {\n name: \"@babel/plugin-proposal-export-namespace-from\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-export-namespace-from\",\n },\n },\n flow: {\n syntax: {\n name: \"@babel/plugin-syntax-flow\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-flow\",\n },\n transform: {\n name: \"@babel/preset-flow\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-preset-flow\",\n },\n },\n functionBind: {\n syntax: {\n name: \"@babel/plugin-syntax-function-bind\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-function-bind\",\n },\n transform: {\n name: \"@babel/plugin-proposal-function-bind\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-function-bind\",\n },\n },\n functionSent: {\n syntax: {\n name: \"@babel/plugin-syntax-function-sent\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-function-sent\",\n },\n transform: {\n name: \"@babel/plugin-proposal-function-sent\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-function-sent\",\n },\n },\n importMeta: {\n syntax: {\n name: \"@babel/plugin-syntax-import-meta\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-import-meta\",\n },\n },\n jsx: {\n syntax: {\n name: \"@babel/plugin-syntax-jsx\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-jsx\",\n },\n transform: {\n name: \"@babel/preset-react\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-preset-react\",\n },\n },\n importAssertions: {\n syntax: {\n name: \"@babel/plugin-syntax-import-assertions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-import-assertions\",\n },\n },\n moduleStringNames: {\n syntax: {\n name: \"@babel/plugin-syntax-module-string-names\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-module-string-names\",\n },\n },\n numericSeparator: {\n syntax: {\n name: \"@babel/plugin-syntax-numeric-separator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-numeric-separator\",\n },\n transform: {\n name: \"@babel/plugin-proposal-numeric-separator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-numeric-separator\",\n },\n },\n optionalChaining: {\n syntax: {\n name: \"@babel/plugin-syntax-optional-chaining\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-optional-chaining\",\n },\n transform: {\n name: \"@babel/plugin-proposal-optional-chaining\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-optional-chaining\",\n },\n },\n pipelineOperator: {\n syntax: {\n name: \"@babel/plugin-syntax-pipeline-operator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-pipeline-operator\",\n },\n transform: {\n name: \"@babel/plugin-proposal-pipeline-operator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-pipeline-operator\",\n },\n },\n privateIn: {\n syntax: {\n name: \"@babel/plugin-syntax-private-property-in-object\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-private-property-in-object\",\n },\n transform: {\n name: \"@babel/plugin-proposal-private-property-in-object\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-private-property-in-object\",\n },\n },\n recordAndTuple: {\n syntax: {\n name: \"@babel/plugin-syntax-record-and-tuple\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-record-and-tuple\",\n },\n },\n regexpUnicodeSets: {\n syntax: {\n name: \"@babel/plugin-syntax-unicode-sets-regex\",\n url: \"https://github.com/babel/babel/blob/main/packages/babel-plugin-syntax-unicode-sets-regex/README.md\",\n },\n transform: {\n name: \"@babel/plugin-proposal-unicode-sets-regex\",\n url: \"https://github.com/babel/babel/blob/main/packages/babel-plugin-proposalunicode-sets-regex/README.md\",\n },\n },\n throwExpressions: {\n syntax: {\n name: \"@babel/plugin-syntax-throw-expressions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-throw-expressions\",\n },\n transform: {\n name: \"@babel/plugin-proposal-throw-expressions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-throw-expressions\",\n },\n },\n typescript: {\n syntax: {\n name: \"@babel/plugin-syntax-typescript\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-typescript\",\n },\n transform: {\n name: \"@babel/preset-typescript\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-preset-typescript\",\n },\n },\n\n // TODO: This plugins are now supported by default by @babel/parser: they can\n // be removed from this list. Although removing them isn't a breaking change,\n // it's better to keep a nice error message for users using older versions of\n // the parser. They can be removed in Babel 8.\n asyncGenerators: {\n syntax: {\n name: \"@babel/plugin-syntax-async-generators\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-async-generators\",\n },\n transform: {\n name: \"@babel/plugin-proposal-async-generator-functions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-async-generator-functions\",\n },\n },\n logicalAssignment: {\n syntax: {\n name: \"@babel/plugin-syntax-logical-assignment-operators\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-logical-assignment-operators\",\n },\n transform: {\n name: \"@babel/plugin-proposal-logical-assignment-operators\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-logical-assignment-operators\",\n },\n },\n nullishCoalescingOperator: {\n syntax: {\n name: \"@babel/plugin-syntax-nullish-coalescing-operator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-nullish-coalescing-operator\",\n },\n transform: {\n name: \"@babel/plugin-proposal-nullish-coalescing-operator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-transform-nullish-coalescing-opearator\",\n },\n },\n objectRestSpread: {\n syntax: {\n name: \"@babel/plugin-syntax-object-rest-spread\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-object-rest-spread\",\n },\n transform: {\n name: \"@babel/plugin-proposal-object-rest-spread\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-object-rest-spread\",\n },\n },\n optionalCatchBinding: {\n syntax: {\n name: \"@babel/plugin-syntax-optional-catch-binding\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-optional-catch-binding\",\n },\n transform: {\n name: \"@babel/plugin-proposal-optional-catch-binding\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-optional-catch-binding\",\n },\n },\n};\n\n//todo: we don't have plugin-syntax-private-property-in-object\npluginNameMap.privateIn.syntax = pluginNameMap.privateIn.transform;\n\nconst getNameURLCombination = ({ name, url }: { name: string; url: string }) =>\n `${name} (${url})`;\n\n/*\nReturns a string of the format:\nSupport for the experimental syntax [@babel/parser plugin name] isn't currently enabled ([loc]):\n\n[code frame]\n\nAdd [npm package name] ([url]) to the 'plugins' section of your Babel config\nto enable [parsing|transformation].\n*/\nexport default function generateMissingPluginMessage(\n missingPluginName: string,\n loc: {\n line: number;\n column: number;\n },\n codeFrame: string,\n): string {\n let helpMessage =\n `Support for the experimental syntax '${missingPluginName}' isn't currently enabled ` +\n `(${loc.line}:${loc.column + 1}):\\n\\n` +\n codeFrame;\n const pluginInfo = pluginNameMap[missingPluginName];\n if (pluginInfo) {\n const { syntax: syntaxPlugin, transform: transformPlugin } = pluginInfo;\n if (syntaxPlugin) {\n const syntaxPluginInfo = getNameURLCombination(syntaxPlugin);\n if (transformPlugin) {\n const transformPluginInfo = getNameURLCombination(transformPlugin);\n const sectionType = transformPlugin.name.startsWith(\"@babel/plugin\")\n ? \"plugins\"\n : \"presets\";\n helpMessage += `\\n\\nAdd ${transformPluginInfo} to the '${sectionType}' section of your Babel config to enable transformation.\nIf you want to leave it as-is, add ${syntaxPluginInfo} to the 'plugins' section to enable parsing.`;\n } else {\n helpMessage +=\n `\\n\\nAdd ${syntaxPluginInfo} to the 'plugins' section of your Babel config ` +\n `to enable parsing.`;\n }\n }\n }\n return helpMessage;\n}\n"],"mappings":";;;;;;AAAA,MAAMA,aAGL,GAAG;EACFC,kBAAkB,EAAE;IAClBC,MAAM,EAAE;MACNC,IAAI,EAAE,2CADA;MAENC,GAAG,EAAE;IAFC;EADU,CADlB;EAOFC,eAAe,EAAE;IACfH,MAAM,EAAE;MACNC,IAAI,EAAE,uCADA;MAENC,GAAG,EAAE;IAFC,CADO;IAKfE,SAAS,EAAE;MACTH,IAAI,EAAE,yCADG;MAETC,GAAG,EAAE;IAFI;EALI,CAPf;EAiBFG,sBAAsB,EAAE;IACtBL,MAAM,EAAE;MACNC,IAAI,EAAE,uCADA;MAENC,GAAG,EAAE;IAFC,CADc;IAKtBE,SAAS,EAAE;MACTH,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GAAa,CAAE,QAD/B,GAEAH,SAHF;EAIA,MAAMI,UAAU,GAAG5C,aAAa,CAACsC,iBAAD,CAAhC;;EACA,IAAIM,UAAJ,EAAgB;IACd,MAAM;MAAE1C,MAAM,EAAE2C,YAAV;MAAwBvC,SAAS,EAAEwC;IAAnC,IAAuDF,UAA7D;;IACA,IAAIC,YAAJ,EAAkB;MAChB,MAAME,gBAAgB,GAAGX,qBAAqB,CAACS,YAAD,CAA9C;;MACA,IAAIC,eAAJ,EAAqB;QACnB,MAAME,mBAAmB,GAAGZ,qBAAqB,CAACU,eAAD,CAAjD;QACA,MAAMG,WAAW,GAAGH,eAAe,CAAC3C,IAAhB,CAAqB+C,UAArB,CAAgC,eAAhC,IAChB,SADgB,GAEhB,SAFJ;QAGAT,WAAW,IAAK,WAAUO,mBAAoB,YAAWC,WAAY;AAC7E,qCAAqCF,gBAAiB,8CAD9C;MAED,CAPD,MAOO;QACLN,WAAW,IACR,WAAUM,gBAAiB,iDAA5B,GACC,oBAFH;MAGD;IACF;EACF;;EACD,OAAON,WAAP;AACD"} \ No newline at end of file +{"version":3,"names":["pluginNameMap","asyncDoExpressions","syntax","name","url","decimal","decorators","transform","doExpressions","exportDefaultFrom","flow","functionBind","functionSent","jsx","importAssertions","pipelineOperator","recordAndTuple","regexpUnicodeSets","throwExpressions","typescript","asyncGenerators","classProperties","classPrivateProperties","classPrivateMethods","classStaticBlock","dynamicImport","exportNamespaceFrom","importMeta","logicalAssignment","moduleStringNames","numericSeparator","nullishCoalescingOperator","objectRestSpread","optionalCatchBinding","optionalChaining","privateIn","getNameURLCombination","generateMissingPluginMessage","missingPluginName","loc","codeFrame","helpMessage","line","column","pluginInfo","syntaxPlugin","transformPlugin","syntaxPluginInfo","transformPluginInfo","sectionType","startsWith"],"sources":["../../../src/parser/util/missing-plugin-helper.ts"],"sourcesContent":["const pluginNameMap: Record<\n string,\n Partial>>\n> = {\n asyncDoExpressions: {\n syntax: {\n name: \"@babel/plugin-syntax-async-do-expressions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-async-do-expressions\",\n },\n },\n decimal: {\n syntax: {\n name: \"@babel/plugin-syntax-decimal\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-decimal\",\n },\n },\n decorators: {\n syntax: {\n name: \"@babel/plugin-syntax-decorators\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-decorators\",\n },\n transform: {\n name: \"@babel/plugin-proposal-decorators\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-decorators\",\n },\n },\n doExpressions: {\n syntax: {\n name: \"@babel/plugin-syntax-do-expressions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-do-expressions\",\n },\n transform: {\n name: \"@babel/plugin-proposal-do-expressions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-do-expressions\",\n },\n },\n exportDefaultFrom: {\n syntax: {\n name: \"@babel/plugin-syntax-export-default-from\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-export-default-from\",\n },\n transform: {\n name: \"@babel/plugin-proposal-export-default-from\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-export-default-from\",\n },\n },\n flow: {\n syntax: {\n name: \"@babel/plugin-syntax-flow\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-flow\",\n },\n transform: {\n name: \"@babel/preset-flow\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-preset-flow\",\n },\n },\n functionBind: {\n syntax: {\n name: \"@babel/plugin-syntax-function-bind\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-function-bind\",\n },\n transform: {\n name: \"@babel/plugin-proposal-function-bind\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-function-bind\",\n },\n },\n functionSent: {\n syntax: {\n name: \"@babel/plugin-syntax-function-sent\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-function-sent\",\n },\n transform: {\n name: \"@babel/plugin-proposal-function-sent\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-function-sent\",\n },\n },\n jsx: {\n syntax: {\n name: \"@babel/plugin-syntax-jsx\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-jsx\",\n },\n transform: {\n name: \"@babel/preset-react\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-preset-react\",\n },\n },\n importAssertions: {\n syntax: {\n name: \"@babel/plugin-syntax-import-assertions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-import-assertions\",\n },\n },\n pipelineOperator: {\n syntax: {\n name: \"@babel/plugin-syntax-pipeline-operator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-pipeline-operator\",\n },\n transform: {\n name: \"@babel/plugin-proposal-pipeline-operator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-pipeline-operator\",\n },\n },\n recordAndTuple: {\n syntax: {\n name: \"@babel/plugin-syntax-record-and-tuple\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-record-and-tuple\",\n },\n },\n regexpUnicodeSets: {\n syntax: {\n name: \"@babel/plugin-syntax-unicode-sets-regex\",\n url: \"https://github.com/babel/babel/blob/main/packages/babel-plugin-syntax-unicode-sets-regex/README.md\",\n },\n transform: {\n name: \"@babel/plugin-proposal-unicode-sets-regex\",\n url: \"https://github.com/babel/babel/blob/main/packages/babel-plugin-proposalunicode-sets-regex/README.md\",\n },\n },\n throwExpressions: {\n syntax: {\n name: \"@babel/plugin-syntax-throw-expressions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-throw-expressions\",\n },\n transform: {\n name: \"@babel/plugin-proposal-throw-expressions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-throw-expressions\",\n },\n },\n typescript: {\n syntax: {\n name: \"@babel/plugin-syntax-typescript\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-typescript\",\n },\n transform: {\n name: \"@babel/preset-typescript\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-preset-typescript\",\n },\n },\n\n // TODO: This plugins are now supported by default by @babel/parser: they can\n // be removed from this list. Although removing them isn't a breaking change,\n // it's better to keep a nice error message for users using older versions of\n // the parser. They can be removed in Babel 8.\n asyncGenerators: {\n syntax: {\n name: \"@babel/plugin-syntax-async-generators\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-async-generators\",\n },\n transform: {\n name: \"@babel/plugin-proposal-async-generator-functions\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-async-generator-functions\",\n },\n },\n classProperties: {\n syntax: {\n name: \"@babel/plugin-syntax-class-properties\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties\",\n },\n transform: {\n name: \"@babel/plugin-proposal-class-properties\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-class-properties\",\n },\n },\n classPrivateProperties: {\n syntax: {\n name: \"@babel/plugin-syntax-class-properties\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties\",\n },\n transform: {\n name: \"@babel/plugin-proposal-class-properties\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-class-properties\",\n },\n },\n classPrivateMethods: {\n syntax: {\n name: \"@babel/plugin-syntax-class-properties\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-class-properties\",\n },\n transform: {\n name: \"@babel/plugin-proposal-private-methods\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-private-methods\",\n },\n },\n classStaticBlock: {\n syntax: {\n name: \"@babel/plugin-syntax-class-static-block\",\n url: \"https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-syntax-class-static-block\",\n },\n transform: {\n name: \"@babel/plugin-proposal-class-static-block\",\n url: \"https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-proposal-class-static-block\",\n },\n },\n dynamicImport: {\n syntax: {\n name: \"@babel/plugin-syntax-dynamic-import\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-dynamic-import\",\n },\n },\n exportNamespaceFrom: {\n syntax: {\n name: \"@babel/plugin-syntax-export-namespace-from\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-export-namespace-from\",\n },\n transform: {\n name: \"@babel/plugin-proposal-export-namespace-from\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-export-namespace-from\",\n },\n },\n importMeta: {\n syntax: {\n name: \"@babel/plugin-syntax-import-meta\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-import-meta\",\n },\n },\n logicalAssignment: {\n syntax: {\n name: \"@babel/plugin-syntax-logical-assignment-operators\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-logical-assignment-operators\",\n },\n transform: {\n name: \"@babel/plugin-proposal-logical-assignment-operators\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-logical-assignment-operators\",\n },\n },\n moduleStringNames: {\n syntax: {\n name: \"@babel/plugin-syntax-module-string-names\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-module-string-names\",\n },\n },\n numericSeparator: {\n syntax: {\n name: \"@babel/plugin-syntax-numeric-separator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-numeric-separator\",\n },\n transform: {\n name: \"@babel/plugin-proposal-numeric-separator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-numeric-separator\",\n },\n },\n nullishCoalescingOperator: {\n syntax: {\n name: \"@babel/plugin-syntax-nullish-coalescing-operator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-nullish-coalescing-operator\",\n },\n transform: {\n name: \"@babel/plugin-proposal-nullish-coalescing-operator\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-transform-nullish-coalescing-opearator\",\n },\n },\n objectRestSpread: {\n syntax: {\n name: \"@babel/plugin-syntax-object-rest-spread\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-object-rest-spread\",\n },\n transform: {\n name: \"@babel/plugin-proposal-object-rest-spread\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-object-rest-spread\",\n },\n },\n optionalCatchBinding: {\n syntax: {\n name: \"@babel/plugin-syntax-optional-catch-binding\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-optional-catch-binding\",\n },\n transform: {\n name: \"@babel/plugin-proposal-optional-catch-binding\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-optional-catch-binding\",\n },\n },\n optionalChaining: {\n syntax: {\n name: \"@babel/plugin-syntax-optional-chaining\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-optional-chaining\",\n },\n transform: {\n name: \"@babel/plugin-proposal-optional-chaining\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-optional-chaining\",\n },\n },\n privateIn: {\n syntax: {\n name: \"@babel/plugin-syntax-private-property-in-object\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-syntax-private-property-in-object\",\n },\n transform: {\n name: \"@babel/plugin-proposal-private-property-in-object\",\n url: \"https://github.com/babel/babel/tree/main/packages/babel-plugin-proposal-private-property-in-object\",\n },\n },\n};\n\n//todo: we don't have plugin-syntax-private-property-in-object\npluginNameMap.privateIn.syntax = pluginNameMap.privateIn.transform;\n\nconst getNameURLCombination = ({ name, url }: { name: string; url: string }) =>\n `${name} (${url})`;\n\n/*\nReturns a string of the format:\nSupport for the experimental syntax [@babel/parser plugin name] isn't currently enabled ([loc]):\n\n[code frame]\n\nAdd [npm package name] ([url]) to the 'plugins' section of your Babel config\nto enable [parsing|transformation].\n*/\nexport default function generateMissingPluginMessage(\n missingPluginName: string,\n loc: {\n line: number;\n column: number;\n },\n codeFrame: string,\n): string {\n let helpMessage =\n `Support for the experimental syntax '${missingPluginName}' isn't currently enabled ` +\n `(${loc.line}:${loc.column + 1}):\\n\\n` +\n codeFrame;\n const pluginInfo = pluginNameMap[missingPluginName];\n if (pluginInfo) {\n const { syntax: syntaxPlugin, transform: transformPlugin } = pluginInfo;\n if (syntaxPlugin) {\n const syntaxPluginInfo = getNameURLCombination(syntaxPlugin);\n if (transformPlugin) {\n const transformPluginInfo = getNameURLCombination(transformPlugin);\n const sectionType = transformPlugin.name.startsWith(\"@babel/plugin\")\n ? \"plugins\"\n : \"presets\";\n helpMessage += `\\n\\nAdd ${transformPluginInfo} to the '${sectionType}' section of your Babel config to enable transformation.\nIf you want to leave it as-is, add ${syntaxPluginInfo} to the 'plugins' section to enable parsing.`;\n } else {\n helpMessage +=\n `\\n\\nAdd ${syntaxPluginInfo} to the 'plugins' section of your Babel config ` +\n `to enable parsing.`;\n }\n }\n }\n return helpMessage;\n}\n"],"mappings":";;;;;;AAAA,MAAMA,aAGL,GAAG;EACFC,kBAAkB,EAAE;IAClBC,MAAM,EAAE;MACNC,IAAI,EAAE,2CAA2C;MACjDC,GAAG,EAAE;IACP;EACF,CAAC;EACDC,OAAO,EAAE;IACPH,MAAM,EAAE;MACNC,IAAI,EAAE,8BAA8B;MACpCC,GAAG,EAAE;IACP;EACF,CAAC;EACDE,UAAU,EAAE;IACVJ,MAAM,EAAE;MACNC,IAAI,EAAE,iCAAiC;MACvCC,GAAG,EAAE;IACP,CAAC;IACDG,SAAS,EAAE;MACTJ,IAAI,EAAE,mCAAmC;MACzCC,GAAG,EAAE;IACP;EACF,CAAC;EACDI,aAAa,EAAE;IACbN,MAAM,EAAE;MACNC,IAAI,EAAE,qCAAqC;MAC3CC,GAAG,EAAE;IACP,CAAC;IACDG,SAAS,EAAE;MACTJ,IAAI,EAAE,uCAAuC;MAC7CC,GAAG,EAAE;IACP;EACF,CAAC;EACDK,iBAAiB,EAAE;IACjBP,MAAM,EAAE;MACNC,IAAI,EAAE,0CAA0C;MAChDC,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IACvE,IAAIC,YAAY,EAAE;MAChB,MAAME,gBAAgB,GAAGX,qBAAqB,CAACS,YAAY,CAAC;MAC5D,IAAIC,eAAe,EAAE;QACnB,MAAME,mBAAmB,GAAGZ,qBAAqB,CAACU,eAAe,CAAC;QAClE,MAAMG,WAAW,GAAGH,eAAe,CAAC3C,IAAI,CAAC+C,UAAU,CAAC,eAAe,CAAC,GAChE,SAAS,GACT,SAAS;QACbT,WAAW,IAAK,WAAUO,mBAAoB,YAAWC,WAAY;AAC7E,qCAAqCF,gBAAiB,8CAA6C;MAC7F,CAAC,MAAM;QACLN,WAAW,IACR,WAAUM,gBAAiB,iDAAgD,GAC3E,oBAAmB;MACxB;IACF;EACF;EACA,OAAON,WAAW;AACpB;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/tools/build-external-helpers.js b/node_modules/@babel/core/lib/tools/build-external-helpers.js index 0fa09dcb7..5ecbb6709 100644 --- a/node_modules/@babel/core/lib/tools/build-external-helpers.js +++ b/node_modules/@babel/core/lib/tools/build-external-helpers.js @@ -4,49 +4,35 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = _default; - function helpers() { const data = require("@babel/helpers"); - helpers = function () { return data; }; - return data; } - function _generator() { const data = require("@babel/generator"); - _generator = function () { return data; }; - return data; } - function _template() { const data = require("@babel/template"); - _template = function () { return data; }; - return data; } - function _t() { const data = require("@babel/types"); - _t = function () { return data; }; - return data; } - var _file = require("../transformation/file/file"); - const { arrayExpression, assignmentExpression, @@ -68,7 +54,6 @@ const { variableDeclaration, variableDeclarator } = _t(); - const buildUmdWrapper = replacements => _template().default.statement` (function (root, factory) { if (typeof define === "function" && define.amd) { @@ -82,17 +67,16 @@ const buildUmdWrapper = replacements => _template().default.statement` FACTORY_BODY }); `(replacements); - function buildGlobal(allowlist) { const namespace = identifier("babelHelpers"); const body = []; const container = functionExpression(null, [identifier("global")], blockStatement(body)); - const tree = program([expressionStatement(callExpression(container, [conditionalExpression(binaryExpression("===", unaryExpression("typeof", identifier("global")), stringLiteral("undefined")), identifier("self"), identifier("global"))]))]); + const tree = program([expressionStatement(callExpression(container, [ + conditionalExpression(binaryExpression("===", unaryExpression("typeof", identifier("global")), stringLiteral("undefined")), identifier("self"), identifier("global"))]))]); body.push(variableDeclaration("var", [variableDeclarator(namespace, assignmentExpression("=", memberExpression(identifier("global"), namespace), objectExpression([])))])); buildHelpers(body, namespace, allowlist); return tree; } - function buildModule(allowlist) { const body = []; const refs = buildHelpers(body, null, allowlist); @@ -101,7 +85,6 @@ function buildModule(allowlist) { }))); return program(body, [], "module"); } - function buildUmd(allowlist) { const namespace = identifier("babelHelpers"); const body = []; @@ -116,7 +99,6 @@ function buildUmd(allowlist) { UMD_ROOT: identifier("this") })]); } - function buildVar(allowlist) { const namespace = identifier("babelHelpers"); const body = []; @@ -126,12 +108,10 @@ function buildVar(allowlist) { body.push(expressionStatement(namespace)); return tree; } - function buildHelpers(body, namespace, allowlist) { const getHelperReference = name => { return namespace ? memberExpression(namespace, identifier(name)) : identifier(`_${name}`); }; - const refs = {}; helpers().list.forEach(function (name) { if (allowlist && allowlist.indexOf(name) < 0) return; @@ -144,7 +124,6 @@ function buildHelpers(body, namespace, allowlist) { }); return refs; } - function _default(allowlist, outputType = "global") { let tree; const build = { @@ -153,16 +132,13 @@ function _default(allowlist, outputType = "global") { umd: buildUmd, var: buildVar }[outputType]; - if (build) { tree = build(allowlist); } else { throw new Error(`Unsupported output type ${outputType}`); } - return (0, _generator().default)(tree).code; } - 0 && 0; //# sourceMappingURL=build-external-helpers.js.map diff --git a/node_modules/@babel/core/lib/tools/build-external-helpers.js.map b/node_modules/@babel/core/lib/tools/build-external-helpers.js.map index 1e1876423..8fe76f55c 100644 --- a/node_modules/@babel/core/lib/tools/build-external-helpers.js.map +++ b/node_modules/@babel/core/lib/tools/build-external-helpers.js.map @@ -1 +1 @@ -{"version":3,"names":["arrayExpression","assignmentExpression","binaryExpression","blockStatement","callExpression","cloneNode","conditionalExpression","exportNamedDeclaration","exportSpecifier","expressionStatement","functionExpression","identifier","memberExpression","objectExpression","program","stringLiteral","unaryExpression","variableDeclaration","variableDeclarator","buildUmdWrapper","replacements","template","statement","buildGlobal","allowlist","namespace","body","container","tree","push","buildHelpers","buildModule","refs","unshift","Object","keys","map","name","buildUmd","FACTORY_PARAMETERS","BROWSER_ARGUMENTS","COMMON_ARGUMENTS","AMD_ARGUMENTS","FACTORY_BODY","UMD_ROOT","buildVar","getHelperReference","helpers","list","forEach","indexOf","ref","ensure","File","nodes","get","outputType","build","global","module","umd","var","Error","generator","code"],"sources":["../../src/tools/build-external-helpers.ts"],"sourcesContent":["import * as helpers from \"@babel/helpers\";\nimport generator from \"@babel/generator\";\nimport template from \"@babel/template\";\nimport {\n arrayExpression,\n assignmentExpression,\n binaryExpression,\n blockStatement,\n callExpression,\n cloneNode,\n conditionalExpression,\n exportNamedDeclaration,\n exportSpecifier,\n expressionStatement,\n functionExpression,\n identifier,\n memberExpression,\n objectExpression,\n program,\n stringLiteral,\n unaryExpression,\n variableDeclaration,\n variableDeclarator,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport File from \"../transformation/file/file\";\nimport type { PublicReplacements } from \"@babel/template/src/options\";\n\n// Wrapped to avoid wasting time parsing this when almost no-one uses\n// build-external-helpers.\nconst buildUmdWrapper = (replacements: PublicReplacements) =>\n template.statement`\n (function (root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(AMD_ARGUMENTS, factory);\n } else if (typeof exports === \"object\") {\n factory(COMMON_ARGUMENTS);\n } else {\n factory(BROWSER_ARGUMENTS);\n }\n })(UMD_ROOT, function (FACTORY_PARAMETERS) {\n FACTORY_BODY\n });\n `(replacements);\n\nfunction buildGlobal(allowlist?: Array) {\n const namespace = identifier(\"babelHelpers\");\n\n const body: t.Statement[] = [];\n const container = functionExpression(\n null,\n [identifier(\"global\")],\n blockStatement(body),\n );\n const tree = program([\n expressionStatement(\n callExpression(container, [\n // typeof global === \"undefined\" ? self : global\n conditionalExpression(\n binaryExpression(\n \"===\",\n unaryExpression(\"typeof\", identifier(\"global\")),\n stringLiteral(\"undefined\"),\n ),\n identifier(\"self\"),\n identifier(\"global\"),\n ),\n ]),\n ),\n ]);\n\n body.push(\n variableDeclaration(\"var\", [\n variableDeclarator(\n namespace,\n assignmentExpression(\n \"=\",\n memberExpression(identifier(\"global\"), namespace),\n objectExpression([]),\n ),\n ),\n ]),\n );\n\n buildHelpers(body, namespace, allowlist);\n\n return tree;\n}\n\nfunction buildModule(allowlist?: Array) {\n const body: t.Statement[] = [];\n const refs = buildHelpers(body, null, allowlist);\n\n body.unshift(\n exportNamedDeclaration(\n null,\n Object.keys(refs).map(name => {\n return exportSpecifier(cloneNode(refs[name]), identifier(name));\n }),\n ),\n );\n\n return program(body, [], \"module\");\n}\n\nfunction buildUmd(allowlist?: Array) {\n const namespace = identifier(\"babelHelpers\");\n\n const body: t.Statement[] = [];\n body.push(\n variableDeclaration(\"var\", [\n variableDeclarator(namespace, identifier(\"global\")),\n ]),\n );\n\n buildHelpers(body, namespace, allowlist);\n\n return program([\n buildUmdWrapper({\n FACTORY_PARAMETERS: identifier(\"global\"),\n BROWSER_ARGUMENTS: assignmentExpression(\n \"=\",\n memberExpression(identifier(\"root\"), namespace),\n objectExpression([]),\n ),\n COMMON_ARGUMENTS: identifier(\"exports\"),\n AMD_ARGUMENTS: arrayExpression([stringLiteral(\"exports\")]),\n FACTORY_BODY: body,\n UMD_ROOT: identifier(\"this\"),\n }),\n ]);\n}\n\nfunction buildVar(allowlist?: Array) {\n const namespace = identifier(\"babelHelpers\");\n\n const body: t.Statement[] = [];\n body.push(\n variableDeclaration(\"var\", [\n variableDeclarator(namespace, objectExpression([])),\n ]),\n );\n const tree = program(body);\n buildHelpers(body, namespace, allowlist);\n body.push(expressionStatement(namespace));\n return tree;\n}\n\nfunction buildHelpers(\n body: t.Statement[],\n namespace: t.Expression,\n allowlist?: Array,\n): Record;\nfunction buildHelpers(\n body: t.Statement[],\n namespace: null,\n allowlist?: Array,\n): Record;\n\nfunction buildHelpers(\n body: t.Statement[],\n namespace: t.Expression | null,\n allowlist?: Array,\n) {\n const getHelperReference = (name: string) => {\n return namespace\n ? memberExpression(namespace, identifier(name))\n : identifier(`_${name}`);\n };\n\n const refs: { [key: string]: t.Identifier | t.MemberExpression } = {};\n helpers.list.forEach(function (name) {\n if (allowlist && allowlist.indexOf(name) < 0) return;\n\n const ref = (refs[name] = getHelperReference(name));\n\n helpers.ensure(name, File);\n const { nodes } = helpers.get(name, getHelperReference, ref);\n\n body.push(...nodes);\n });\n return refs;\n}\nexport default function (\n allowlist?: Array,\n outputType: \"global\" | \"module\" | \"umd\" | \"var\" = \"global\",\n) {\n let tree: t.Program;\n\n const build = {\n global: buildGlobal,\n module: buildModule,\n umd: buildUmd,\n var: buildVar,\n }[outputType];\n\n if (build) {\n tree = build(allowlist);\n } else {\n throw new Error(`Unsupported output type ${outputType}`);\n }\n\n return generator(tree).code;\n}\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAsBA;;;EArBEA,e;EACAC,oB;EACAC,gB;EACAC,c;EACAC,c;EACAC,S;EACAC,qB;EACAC,sB;EACAC,e;EACAC,mB;EACAC,kB;EACAC,U;EACAC,gB;EACAC,gB;EACAC,O;EACAC,a;EACAC,e;EACAC,mB;EACAC;;;AAQF,MAAMC,eAAe,GAAIC,YAAD,IACtBC,mBAAA,CAASC,SAAU;AACrB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAZE,CAYEF,YAZF,CADF;;AAeA,SAASG,WAAT,CAAqBC,SAArB,EAAgD;EAC9C,MAAMC,SAAS,GAAGd,UAAU,CAAC,cAAD,CAA5B;EAEA,MAAMe,IAAmB,GA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UAAW,EAAhD,CAAN;EACD;;EAED,OAAO,IAAAO,oBAAA,EAAUnC,IAAV,EAAgBoC,IAAvB;AACD"} \ No newline at end of file +{"version":3,"names":["arrayExpression","assignmentExpression","binaryExpression","blockStatement","callExpression","cloneNode","conditionalExpression","exportNamedDeclaration","exportSpecifier","expressionStatement","functionExpression","identifier","memberExpression","objectExpression","program","stringLiteral","unaryExpression","variableDeclaration","variableDeclarator","buildUmdWrapper","replacements","template","statement","buildGlobal","allowlist","namespace","body","container","tree","push","buildHelpers","buildModule","refs","unshift","Object","keys","map","name","buildUmd","FACTORY_PARAMETERS","BROWSER_ARGUMENTS","COMMON_ARGUMENTS","AMD_ARGUMENTS","FACTORY_BODY","UMD_ROOT","buildVar","getHelperReference","helpers","list","forEach","indexOf","ref","ensure","File","nodes","get","outputType","build","global","module","umd","var","Error","generator","code"],"sources":["../../src/tools/build-external-helpers.ts"],"sourcesContent":["import * as helpers from \"@babel/helpers\";\nimport generator from \"@babel/generator\";\nimport template from \"@babel/template\";\nimport {\n arrayExpression,\n assignmentExpression,\n binaryExpression,\n blockStatement,\n callExpression,\n cloneNode,\n conditionalExpression,\n exportNamedDeclaration,\n exportSpecifier,\n expressionStatement,\n functionExpression,\n identifier,\n memberExpression,\n objectExpression,\n program,\n stringLiteral,\n unaryExpression,\n variableDeclaration,\n variableDeclarator,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport File from \"../transformation/file/file\";\nimport type { PublicReplacements } from \"@babel/template/src/options\";\n\n// Wrapped to avoid wasting time parsing this when almost no-one uses\n// build-external-helpers.\nconst buildUmdWrapper = (replacements: PublicReplacements) =>\n template.statement`\n (function (root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(AMD_ARGUMENTS, factory);\n } else if (typeof exports === \"object\") {\n factory(COMMON_ARGUMENTS);\n } else {\n factory(BROWSER_ARGUMENTS);\n }\n })(UMD_ROOT, function (FACTORY_PARAMETERS) {\n FACTORY_BODY\n });\n `(replacements);\n\nfunction buildGlobal(allowlist?: Array) {\n const namespace = identifier(\"babelHelpers\");\n\n const body: t.Statement[] = [];\n const container = functionExpression(\n null,\n [identifier(\"global\")],\n blockStatement(body),\n );\n const tree = program([\n expressionStatement(\n callExpression(container, [\n // typeof global === \"undefined\" ? self : global\n conditionalExpression(\n binaryExpression(\n \"===\",\n unaryExpression(\"typeof\", identifier(\"global\")),\n stringLiteral(\"undefined\"),\n ),\n identifier(\"self\"),\n identifier(\"global\"),\n ),\n ]),\n ),\n ]);\n\n body.push(\n variableDeclaration(\"var\", [\n variableDeclarator(\n namespace,\n assignmentExpression(\n \"=\",\n memberExpression(identifier(\"global\"), namespace),\n objectExpression([]),\n ),\n ),\n ]),\n );\n\n buildHelpers(body, namespace, allowlist);\n\n return tree;\n}\n\nfunction buildModule(allowlist?: Array) {\n const body: t.Statement[] = [];\n const refs = buildHelpers(body, null, allowlist);\n\n body.unshift(\n exportNamedDeclaration(\n null,\n Object.keys(refs).map(name => {\n return exportSpecifier(cloneNode(refs[name]), identifier(name));\n }),\n ),\n );\n\n return program(body, [], \"module\");\n}\n\nfunction buildUmd(allowlist?: Array) {\n const namespace = identifier(\"babelHelpers\");\n\n const body: t.Statement[] = [];\n body.push(\n variableDeclaration(\"var\", [\n variableDeclarator(namespace, identifier(\"global\")),\n ]),\n );\n\n buildHelpers(body, namespace, allowlist);\n\n return program([\n buildUmdWrapper({\n FACTORY_PARAMETERS: identifier(\"global\"),\n BROWSER_ARGUMENTS: assignmentExpression(\n \"=\",\n memberExpression(identifier(\"root\"), namespace),\n objectExpression([]),\n ),\n COMMON_ARGUMENTS: identifier(\"exports\"),\n AMD_ARGUMENTS: arrayExpression([stringLiteral(\"exports\")]),\n FACTORY_BODY: body,\n UMD_ROOT: identifier(\"this\"),\n }),\n ]);\n}\n\nfunction buildVar(allowlist?: Array) {\n const namespace = identifier(\"babelHelpers\");\n\n const body: t.Statement[] = [];\n body.push(\n variableDeclaration(\"var\", [\n variableDeclarator(namespace, objectExpression([])),\n ]),\n );\n const tree = program(body);\n buildHelpers(body, namespace, allowlist);\n body.push(expressionStatement(namespace));\n return tree;\n}\n\nfunction buildHelpers(\n body: t.Statement[],\n namespace: t.Expression,\n allowlist?: Array,\n): Record;\nfunction buildHelpers(\n body: t.Statement[],\n namespace: null,\n allowlist?: Array,\n): Record;\n\nfunction buildHelpers(\n body: t.Statement[],\n namespace: t.Expression | null,\n allowlist?: Array,\n) {\n const getHelperReference = (name: string) => {\n return namespace\n ? memberExpression(namespace, identifier(name))\n : identifier(`_${name}`);\n };\n\n const refs: { [key: string]: t.Identifier | t.MemberExpression } = {};\n helpers.list.forEach(function (name) {\n if (allowlist && allowlist.indexOf(name) < 0) return;\n\n const ref = (refs[name] = getHelperReference(name));\n\n helpers.ensure(name, File);\n const { nodes } = helpers.get(name, getHelperReference, ref);\n\n body.push(...nodes);\n });\n return refs;\n}\nexport default function (\n allowlist?: Array,\n outputType: \"global\" | \"module\" | \"umd\" | \"var\" = \"global\",\n) {\n let tree: t.Program;\n\n const build = {\n global: buildGlobal,\n module: buildModule,\n umd: buildUmd,\n var: buildVar,\n }[outputType];\n\n if (build) {\n tree = build(allowlist);\n } else {\n throw new Error(`Unsupported output type ${outputType}`);\n }\n\n return generator(tree).code;\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAsBA;AAA+C;EArB7CA,eAAe;EACfC,oBAAoB;EACpBC,gBAAgB;EAChBC,cAAc;EACdC,cAAc;EACdC,SAAS;EACTC,qBAAqB;EACrBC,sBAAsB;EACtBC,eAAe;EACfC,mBAAmB;EACnBC,kBAAkB;EAClBC,UAAU;EACVC,gBAAgB;EAChBC,gBAAgB;EAChBC,OAAO;EACPC,aAAa;EACbC,eAAe;EACfC,mBAAmB;EACnBC;AAAkB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,GAAG;IACZC,MAAM,EAAEnC,WAAW;IACnBoC,MAAM,EAAE5B,WAAW;IACnB6B,GAAG,EAAEtB,QAAQ;IACbuB,GAAG,EAAEhB;EACP,CAAC,CAACW,UAAU,CAAC;EAEb,IAAIC,KAAK,EAAE;IACT7B,IAAI,GAAG6B,KAAK,CAACjC,SAAS,CAAC;EACzB,CAAC,MAAM;IACL,MAAM,IAAIsC,KAAK,CAAE,2BAA0BN,UAAW,EAAC,CAAC;EAC1D;EAEA,OAAO,IAAAO,oBAAS,EAACnC,IAAI,CAAC,CAACoC,IAAI;AAC7B;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transform-ast.js b/node_modules/@babel/core/lib/transform-ast.js index 3b8e147dc..ac9819b7a 100644 --- a/node_modules/@babel/core/lib/transform-ast.js +++ b/node_modules/@babel/core/lib/transform-ast.js @@ -6,34 +6,25 @@ Object.defineProperty(exports, "__esModule", { exports.transformFromAst = void 0; exports.transformFromAstAsync = transformFromAstAsync; exports.transformFromAstSync = transformFromAstSync; - function _gensync() { const data = require("gensync"); - _gensync = function () { return data; }; - return data; } - var _config = require("./config"); - var _transformation = require("./transformation"); - var _rewriteStackTrace = require("./errors/rewrite-stack-trace"); - const transformFromAstRunner = _gensync()(function* (ast, code, opts) { const config = yield* (0, _config.default)(opts); if (config === null) return null; if (!ast) throw new Error("No AST given"); return yield* (0, _transformation.run)(config, code, ast); }); - const transformFromAst = function transformFromAst(ast, code, optsOrCallback, maybeCallback) { let opts; let callback; - if (typeof optsOrCallback === "function") { callback = optsOrCallback; opts = undefined; @@ -41,26 +32,20 @@ const transformFromAst = function transformFromAst(ast, code, optsOrCallback, ma opts = optsOrCallback; callback = maybeCallback; } - if (callback === undefined) { { return (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.sync)(ast, code, opts); } } - (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.errback)(ast, code, opts, callback); }; - exports.transformFromAst = transformFromAst; - function transformFromAstSync(...args) { return (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.sync)(...args); } - function transformFromAstAsync(...args) { return (0, _rewriteStackTrace.beginHiddenCallStack)(transformFromAstRunner.async)(...args); } - 0 && 0; //# sourceMappingURL=transform-ast.js.map diff --git a/node_modules/@babel/core/lib/transform-ast.js.map b/node_modules/@babel/core/lib/transform-ast.js.map index e60b5f2fe..e4297a106 100644 --- a/node_modules/@babel/core/lib/transform-ast.js.map +++ b/node_modules/@babel/core/lib/transform-ast.js.map @@ -1 +1 @@ -{"version":3,"names":["transformFromAstRunner","gensync","ast","code","opts","config","loadConfig","Error","run","transformFromAst","optsOrCallback","maybeCallback","callback","undefined","beginHiddenCallStack","sync","errback","transformFromAstSync","args","transformFromAstAsync","async"],"sources":["../src/transform-ast.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\n\nimport loadConfig from \"./config\";\nimport type { InputOptions, ResolvedConfig } from \"./config\";\nimport { run } from \"./transformation\";\nimport type * as t from \"@babel/types\";\n\nimport { beginHiddenCallStack } from \"./errors/rewrite-stack-trace\";\n\nimport type { FileResult, FileResultCallback } from \"./transformation\";\ntype AstRoot = t.File | t.Program;\n\ntype TransformFromAst = {\n (ast: AstRoot, code: string, callback: FileResultCallback): void;\n (\n ast: AstRoot,\n code: string,\n opts: InputOptions | undefined | null,\n callback: FileResultCallback,\n ): void;\n (ast: AstRoot, code: string, opts?: InputOptions | null): FileResult | null;\n};\n\nconst transformFromAstRunner = gensync(function* (\n ast: AstRoot,\n code: string,\n opts: InputOptions | undefined | null,\n): Handler {\n const config: ResolvedConfig | null = yield* loadConfig(opts);\n if (config === null) return null;\n\n if (!ast) throw new Error(\"No AST given\");\n\n return yield* run(config, code, ast);\n});\n\nexport const transformFromAst: TransformFromAst = function transformFromAst(\n ast,\n code,\n optsOrCallback?: InputOptions | null | undefined | FileResultCallback,\n maybeCallback?: FileResultCallback,\n) {\n let opts: InputOptions | undefined | null;\n let callback: FileResultCallback | undefined;\n if (typeof optsOrCallback === \"function\") {\n callback = optsOrCallback;\n opts = undefined;\n } else {\n opts = optsOrCallback;\n callback = maybeCallback;\n }\n\n if (callback === undefined) {\n if (process.env.BABEL_8_BREAKING) {\n throw new Error(\n \"Starting from Babel 8.0.0, the 'transformFromAst' function expects a callback. If you need to call it synchronously, please use 'transformFromAstSync'.\",\n );\n } else {\n // console.warn(\n // \"Starting from Babel 8.0.0, the 'transformFromAst' function will expect a callback. If you need to call it synchronously, please use 'transformFromAstSync'.\",\n // );\n return beginHiddenCallStack(transformFromAstRunner.sync)(ast, code, opts);\n }\n }\n\n beginHiddenCallStack(transformFromAstRunner.errback)(\n ast,\n code,\n opts,\n callback,\n );\n};\n\nexport function transformFromAstSync(\n ...args: Parameters\n) {\n return beginHiddenCallStack(transformFromAstRunner.sync)(...args);\n}\n\nexport function transformFromAstAsync(\n ...args: Parameters\n) {\n return beginHiddenCallStack(transformFromAstRunner.async)(...args);\n}\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;;AAEA;;AAGA;;AAgBA,MAAMA,sBAAsB,GAAGC,UAAA,CAAQ,WACrCC,GADqC,EAErCC,IAFqC,EAGrCC,IAHqC,EAIT;EAC5B,MAAMC,MAA6B,GAAG,OAAO,IAAAC,eAAA,EAAWF,IAAX,CAA7C;EACA,IAAIC,MAAM,KAAK,IAAf,EAAqB,OAAO,IAAP;EAErB,IAAI,CAACH,GAAL,EAAU,MAAM,IAAIK,KAAJ,CAAU,cAAV,CAAN;EAEV,OAAO,OAAO,IAAAC,mBAAA,EAAIH,MAAJ,EAAYF,IAAZ,EAAkBD,GAAlB,CAAd;AACD,CAX8B,CAA/B;;AAaO,MAAMO,gBAAkC,GAAG,SAASA,gBAAT,CAChDP,GADgD,EAEhDC,IAFgD,EAGhDO,cAHgD,EAIhDC,aAJgD,EAKhD;EACA,IAAIP,IAAJ;EACA,IAAIQ,QAAJ;;EACA,IAAI,OAAOF,cAAP,KAA0B,UAA9B,EAA0C;IACxCE,QAAQ,GAAGF,cAAX;IACAN,IAAI,GAAGS,SAAP;EACD,CAHD,MAGO;IACLT,IAAI,GAAGM,cAAP;IACAE,QAAQ,GAAGD,aAAX;EACD;;EAED,IAAIC,QAAQ,KAAKC,SAAjB,EAA4B;IAKnB;MAIL,OAAO,IAAAC,uCAAA,EAAqBd,sBAAsB,CAACe,IAA5C,EAAkDb,GAAlD,EAAuDC,IAAvD,EAA6DC,IAA7D,CAAP;IACD;EACF;;EAED,IAAAU,uCAAA,EAAqBd,sBAAsB,CAACgB,OAA5C,EACEd,GADF,EAEEC,IAFF,EAGEC,IAHF,EAIEQ,QAJF;AAMD,CAnCM;;;;AAqCA,SAASK,oBAAT,CACL,GAAGC,IADE,EAEL;EACA,OAAO,IAAAJ,uCAAA,EAAqBd,sBAAsB,CAACe,IAA5C,EAAkD,GAAGG,IAArD,CAAP;AACD;;AAEM,SAASC,qBAAT,CACL,GAAGD,IADE,EAEL;EACA,OAAO,IAAAJ,uCAAA,EAAqBd,sBAAsB,CAACoB,KAA5C,EAAmD,GAAGF,IAAtD,CAAP;AACD"} \ No newline at end of file +{"version":3,"names":["transformFromAstRunner","gensync","ast","code","opts","config","loadConfig","Error","run","transformFromAst","optsOrCallback","maybeCallback","callback","undefined","beginHiddenCallStack","sync","errback","transformFromAstSync","args","transformFromAstAsync","async"],"sources":["../src/transform-ast.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\n\nimport loadConfig from \"./config\";\nimport type { InputOptions, ResolvedConfig } from \"./config\";\nimport { run } from \"./transformation\";\nimport type * as t from \"@babel/types\";\n\nimport { beginHiddenCallStack } from \"./errors/rewrite-stack-trace\";\n\nimport type { FileResult, FileResultCallback } from \"./transformation\";\ntype AstRoot = t.File | t.Program;\n\ntype TransformFromAst = {\n (ast: AstRoot, code: string, callback: FileResultCallback): void;\n (\n ast: AstRoot,\n code: string,\n opts: InputOptions | undefined | null,\n callback: FileResultCallback,\n ): void;\n (ast: AstRoot, code: string, opts?: InputOptions | null): FileResult | null;\n};\n\nconst transformFromAstRunner = gensync(function* (\n ast: AstRoot,\n code: string,\n opts: InputOptions | undefined | null,\n): Handler {\n const config: ResolvedConfig | null = yield* loadConfig(opts);\n if (config === null) return null;\n\n if (!ast) throw new Error(\"No AST given\");\n\n return yield* run(config, code, ast);\n});\n\nexport const transformFromAst: TransformFromAst = function transformFromAst(\n ast,\n code,\n optsOrCallback?: InputOptions | null | undefined | FileResultCallback,\n maybeCallback?: FileResultCallback,\n) {\n let opts: InputOptions | undefined | null;\n let callback: FileResultCallback | undefined;\n if (typeof optsOrCallback === \"function\") {\n callback = optsOrCallback;\n opts = undefined;\n } else {\n opts = optsOrCallback;\n callback = maybeCallback;\n }\n\n if (callback === undefined) {\n if (process.env.BABEL_8_BREAKING) {\n throw new Error(\n \"Starting from Babel 8.0.0, the 'transformFromAst' function expects a callback. If you need to call it synchronously, please use 'transformFromAstSync'.\",\n );\n } else {\n // console.warn(\n // \"Starting from Babel 8.0.0, the 'transformFromAst' function will expect a callback. If you need to call it synchronously, please use 'transformFromAstSync'.\",\n // );\n return beginHiddenCallStack(transformFromAstRunner.sync)(ast, code, opts);\n }\n }\n\n beginHiddenCallStack(transformFromAstRunner.errback)(\n ast,\n code,\n opts,\n callback,\n );\n};\n\nexport function transformFromAstSync(\n ...args: Parameters\n) {\n return beginHiddenCallStack(transformFromAstRunner.sync)(...args);\n}\n\nexport function transformFromAstAsync(\n ...args: Parameters\n) {\n return beginHiddenCallStack(transformFromAstRunner.async)(...args);\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AAEA;AAGA;AAgBA,MAAMA,sBAAsB,GAAGC,UAAO,CAAC,WACrCC,GAAY,EACZC,IAAY,EACZC,IAAqC,EACT;EAC5B,MAAMC,MAA6B,GAAG,OAAO,IAAAC,eAAU,EAACF,IAAI,CAAC;EAC7D,IAAIC,MAAM,KAAK,IAAI,EAAE,OAAO,IAAI;EAEhC,IAAI,CAACH,GAAG,EAAE,MAAM,IAAIK,KAAK,CAAC,cAAc,CAAC;EAEzC,OAAO,OAAO,IAAAC,mBAAG,EAACH,MAAM,EAAEF,IAAI,EAAED,GAAG,CAAC;AACtC,CAAC,CAAC;AAEK,MAAMO,gBAAkC,GAAG,SAASA,gBAAgB,CACzEP,GAAG,EACHC,IAAI,EACJO,cAAqE,EACrEC,aAAkC,EAClC;EACA,IAAIP,IAAqC;EACzC,IAAIQ,QAAwC;EAC5C,IAAI,OAAOF,cAAc,KAAK,UAAU,EAAE;IACxCE,QAAQ,GAAGF,cAAc;IACzBN,IAAI,GAAGS,SAAS;EAClB,CAAC,MAAM;IACLT,IAAI,GAAGM,cAAc;IACrBE,QAAQ,GAAGD,aAAa;EAC1B;EAEA,IAAIC,QAAQ,KAAKC,SAAS,EAAE;IAKnB;MAIL,OAAO,IAAAC,uCAAoB,EAACd,sBAAsB,CAACe,IAAI,CAAC,CAACb,GAAG,EAAEC,IAAI,EAAEC,IAAI,CAAC;IAC3E;EACF;EAEA,IAAAU,uCAAoB,EAACd,sBAAsB,CAACgB,OAAO,CAAC,CAClDd,GAAG,EACHC,IAAI,EACJC,IAAI,EACJQ,QAAQ,CACT;AACH,CAAC;AAAC;AAEK,SAASK,oBAAoB,CAClC,GAAGC,IAAoD,EACvD;EACA,OAAO,IAAAJ,uCAAoB,EAACd,sBAAsB,CAACe,IAAI,CAAC,CAAC,GAAGG,IAAI,CAAC;AACnE;AAEO,SAASC,qBAAqB,CACnC,GAAGD,IAAqD,EACxD;EACA,OAAO,IAAAJ,uCAAoB,EAACd,sBAAsB,CAACoB,KAAK,CAAC,CAAC,GAAGF,IAAI,CAAC;AACpE;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transform-file-browser.js b/node_modules/@babel/core/lib/transform-file-browser.js index 97ad36632..a14110f1c 100644 --- a/node_modules/@babel/core/lib/transform-file-browser.js +++ b/node_modules/@babel/core/lib/transform-file-browser.js @@ -11,20 +11,15 @@ const transformFile = function transformFile(filename, opts, callback) { if (typeof opts === "function") { callback = opts; } - callback(new Error("Transforming files is not supported in browsers"), null); }; - exports.transformFile = transformFile; - function transformFileSync() { throw new Error("Transforming files is not supported in browsers"); } - function transformFileAsync() { return Promise.reject(new Error("Transforming files is not supported in browsers")); } - 0 && 0; //# sourceMappingURL=transform-file-browser.js.map diff --git a/node_modules/@babel/core/lib/transform-file-browser.js.map b/node_modules/@babel/core/lib/transform-file-browser.js.map index 8bc230f46..9f800ed4a 100644 --- a/node_modules/@babel/core/lib/transform-file-browser.js.map +++ b/node_modules/@babel/core/lib/transform-file-browser.js.map @@ -1 +1 @@ -{"version":3,"names":["transformFile","filename","opts","callback","Error","transformFileSync","transformFileAsync","Promise","reject"],"sources":["../src/transform-file-browser.ts"],"sourcesContent":["// duplicated from transform-file so we do not have to import anything here\ntype TransformFile = {\n (filename: string, callback: (error: Error, file: null) => void): void;\n (\n filename: string,\n opts: any,\n callback: (error: Error, file: null) => void,\n ): void;\n};\n\nexport const transformFile: TransformFile = function transformFile(\n filename,\n opts,\n callback?: (error: Error, file: null) => void,\n) {\n if (typeof opts === \"function\") {\n callback = opts;\n }\n\n callback(new Error(\"Transforming files is not supported in browsers\"), null);\n};\n\nexport function transformFileSync(): never {\n throw new Error(\"Transforming files is not supported in browsers\");\n}\n\nexport function transformFileAsync() {\n return Promise.reject(\n new Error(\"Transforming files is not supported in browsers\"),\n );\n}\n"],"mappings":";;;;;;;;;AAUO,MAAMA,aAA4B,GAAG,SAASA,aAAT,CAC1CC,QAD0C,EAE1CC,IAF0C,EAG1CC,QAH0C,EAI1C;EACA,IAAI,OAAOD,IAAP,KAAgB,UAApB,EAAgC;IAC9BC,QAAQ,GAAGD,IAAX;EACD;;EAEDC,QAAQ,CAAC,IAAIC,KAAJ,CAAU,iDAAV,CAAD,EAA+D,IAA/D,CAAR;AACD,CAVM;;;;AAYA,SAASC,iBAAT,GAAoC;EACzC,MAAM,IAAID,KAAJ,CAAU,iDAAV,CAAN;AACD;;AAEM,SAASE,kBAAT,GAA8B;EACnC,OAAOC,OAAO,CAACC,MAAR,CACL,IAAIJ,KAAJ,CAAU,iDAAV,CADK,CAAP;AAGD"} \ No newline at end of file +{"version":3,"names":["transformFile","filename","opts","callback","Error","transformFileSync","transformFileAsync","Promise","reject"],"sources":["../src/transform-file-browser.ts"],"sourcesContent":["// duplicated from transform-file so we do not have to import anything here\ntype TransformFile = {\n (filename: string, callback: (error: Error, file: null) => void): void;\n (\n filename: string,\n opts: any,\n callback: (error: Error, file: null) => void,\n ): void;\n};\n\nexport const transformFile: TransformFile = function transformFile(\n filename,\n opts,\n callback?: (error: Error, file: null) => void,\n) {\n if (typeof opts === \"function\") {\n callback = opts;\n }\n\n callback(new Error(\"Transforming files is not supported in browsers\"), null);\n};\n\nexport function transformFileSync(): never {\n throw new Error(\"Transforming files is not supported in browsers\");\n}\n\nexport function transformFileAsync() {\n return Promise.reject(\n new Error(\"Transforming files is not supported in browsers\"),\n );\n}\n"],"mappings":";;;;;;;;;AAUO,MAAMA,aAA4B,GAAG,SAASA,aAAa,CAChEC,QAAQ,EACRC,IAAI,EACJC,QAA6C,EAC7C;EACA,IAAI,OAAOD,IAAI,KAAK,UAAU,EAAE;IAC9BC,QAAQ,GAAGD,IAAI;EACjB;EAEAC,QAAQ,CAAC,IAAIC,KAAK,CAAC,iDAAiD,CAAC,EAAE,IAAI,CAAC;AAC9E,CAAC;AAAC;AAEK,SAASC,iBAAiB,GAAU;EACzC,MAAM,IAAID,KAAK,CAAC,iDAAiD,CAAC;AACpE;AAEO,SAASE,kBAAkB,GAAG;EACnC,OAAOC,OAAO,CAACC,MAAM,CACnB,IAAIJ,KAAK,CAAC,iDAAiD,CAAC,CAC7D;AACH;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transform-file.js b/node_modules/@babel/core/lib/transform-file.js index 7edcc0547..6d8730761 100644 --- a/node_modules/@babel/core/lib/transform-file.js +++ b/node_modules/@babel/core/lib/transform-file.js @@ -6,25 +6,17 @@ Object.defineProperty(exports, "__esModule", { exports.transformFile = transformFile; exports.transformFileAsync = transformFileAsync; exports.transformFileSync = transformFileSync; - function _gensync() { const data = require("gensync"); - _gensync = function () { return data; }; - return data; } - var _config = require("./config"); - var _transformation = require("./transformation"); - var fs = require("./gensync-utils/fs"); - ({}); - const transformFileRunner = _gensync()(function* (filename, opts) { const options = Object.assign({}, opts, { filename @@ -38,15 +30,12 @@ const transformFileRunner = _gensync()(function* (filename, opts) { function transformFile(...args) { return transformFileRunner.errback(...args); } - function transformFileSync(...args) { return transformFileRunner.sync(...args); } - function transformFileAsync(...args) { return transformFileRunner.async(...args); } - 0 && 0; //# sourceMappingURL=transform-file.js.map diff --git a/node_modules/@babel/core/lib/transform-file.js.map b/node_modules/@babel/core/lib/transform-file.js.map index d770cb0ad..88e32a666 100644 --- a/node_modules/@babel/core/lib/transform-file.js.map +++ b/node_modules/@babel/core/lib/transform-file.js.map @@ -1 +1 @@ -{"version":3,"names":["transformFileRunner","gensync","filename","opts","options","config","loadConfig","code","fs","readFile","run","transformFile","args","errback","transformFileSync","sync","transformFileAsync","async"],"sources":["../src/transform-file.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\n\nimport loadConfig from \"./config\";\nimport type { InputOptions, ResolvedConfig } from \"./config\";\nimport { run } from \"./transformation\";\nimport type { FileResult, FileResultCallback } from \"./transformation\";\nimport * as fs from \"./gensync-utils/fs\";\n\ntype transformFileBrowserType = typeof import(\"./transform-file-browser\");\ntype transformFileType = typeof import(\"./transform-file\");\n\n// Kind of gross, but essentially asserting that the exports of this module are the same as the\n// exports of transform-file-browser, since this file may be replaced at bundle time with\n// transform-file-browser.\n({} as any as transformFileBrowserType as transformFileType);\n\nconst transformFileRunner = gensync(function* (\n filename: string,\n opts?: InputOptions,\n): Handler {\n const options = { ...opts, filename };\n\n const config: ResolvedConfig | null = yield* loadConfig(options);\n if (config === null) return null;\n\n const code = yield* fs.readFile(filename, \"utf8\");\n return yield* run(config, code);\n});\n\n// @ts-expect-error TS doesn't detect that this signature is compatible\nexport function transformFile(\n filename: string,\n callback: FileResultCallback,\n): void;\nexport function transformFile(\n filename: string,\n opts: InputOptions | undefined | null,\n callback: FileResultCallback,\n): void;\nexport function transformFile(\n ...args: Parameters\n) {\n return transformFileRunner.errback(...args);\n}\n\nexport function transformFileSync(\n ...args: Parameters\n) {\n return transformFileRunner.sync(...args);\n}\nexport function transformFileAsync(\n ...args: Parameters\n) {\n return transformFileRunner.async(...args);\n}\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;;AAEA;;AAEA;;AAQA,CAAC,EAAD;;AAEA,MAAMA,mBAAmB,GAAGC,UAAA,CAAQ,WAClCC,QADkC,EAElCC,IAFkC,EAGN;EAC5B,MAAMC,OAAO,qBAAQD,IAAR;IAAcD;EAAd,EAAb;EAEA,MAAMG,MAA6B,GAAG,OAAO,IAAAC,eAAA,EAAWF,OAAX,CAA7C;EACA,IAAIC,MAAM,KAAK,IAAf,EAAqB,OAAO,IAAP;EAErB,MAAME,IAAI,GAAG,OAAOC,EAAE,CAACC,QAAH,CAAYP,QAAZ,EAAsB,MAAtB,CAApB;EACA,OAAO,OAAO,IAAAQ,mBAAA,EAAIL,MAAJ,EAAYE,IAAZ,CAAd;AACD,CAX2B,CAA5B;;AAuBO,SAASI,aAAT,CACL,GAAGC,IADE,EAEL;EACA,OAAOZ,mBAAmB,CAACa,OAApB,CAA4B,GAAGD,IAA/B,CAAP;AACD;;AAEM,SAASE,iBAAT,CACL,GAAGF,IADE,EAEL;EACA,OAAOZ,mBAAmB,CAACe,IAApB,CAAyB,GAAGH,IAA5B,CAAP;AACD;;AACM,SAASI,kBAAT,CACL,GAAGJ,IADE,EAEL;EACA,OAAOZ,mBAAmB,CAACiB,KAApB,CAA0B,GAAGL,IAA7B,CAAP;AACD"} \ No newline at end of file +{"version":3,"names":["transformFileRunner","gensync","filename","opts","options","config","loadConfig","code","fs","readFile","run","transformFile","args","errback","transformFileSync","sync","transformFileAsync","async"],"sources":["../src/transform-file.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\n\nimport loadConfig from \"./config\";\nimport type { InputOptions, ResolvedConfig } from \"./config\";\nimport { run } from \"./transformation\";\nimport type { FileResult, FileResultCallback } from \"./transformation\";\nimport * as fs from \"./gensync-utils/fs\";\n\ntype transformFileBrowserType = typeof import(\"./transform-file-browser\");\ntype transformFileType = typeof import(\"./transform-file\");\n\n// Kind of gross, but essentially asserting that the exports of this module are the same as the\n// exports of transform-file-browser, since this file may be replaced at bundle time with\n// transform-file-browser.\n({} as any as transformFileBrowserType as transformFileType);\n\nconst transformFileRunner = gensync(function* (\n filename: string,\n opts?: InputOptions,\n): Handler {\n const options = { ...opts, filename };\n\n const config: ResolvedConfig | null = yield* loadConfig(options);\n if (config === null) return null;\n\n const code = yield* fs.readFile(filename, \"utf8\");\n return yield* run(config, code);\n});\n\n// @ts-expect-error TS doesn't detect that this signature is compatible\nexport function transformFile(\n filename: string,\n callback: FileResultCallback,\n): void;\nexport function transformFile(\n filename: string,\n opts: InputOptions | undefined | null,\n callback: FileResultCallback,\n): void;\nexport function transformFile(\n ...args: Parameters\n) {\n return transformFileRunner.errback(...args);\n}\n\nexport function transformFileSync(\n ...args: Parameters\n) {\n return transformFileRunner.sync(...args);\n}\nexport function transformFileAsync(\n ...args: Parameters\n) {\n return transformFileRunner.async(...args);\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AAEA;AAEA;AAQA,CAAC,CAAC,CAAC;AAEH,MAAMA,mBAAmB,GAAGC,UAAO,CAAC,WAClCC,QAAgB,EAChBC,IAAmB,EACS;EAC5B,MAAMC,OAAO,qBAAQD,IAAI;IAAED;EAAQ,EAAE;EAErC,MAAMG,MAA6B,GAAG,OAAO,IAAAC,eAAU,EAACF,OAAO,CAAC;EAChE,IAAIC,MAAM,KAAK,IAAI,EAAE,OAAO,IAAI;EAEhC,MAAME,IAAI,GAAG,OAAOC,EAAE,CAACC,QAAQ,CAACP,QAAQ,EAAE,MAAM,CAAC;EACjD,OAAO,OAAO,IAAAQ,mBAAG,EAACL,MAAM,EAAEE,IAAI,CAAC;AACjC,CAAC,CAAC;;AAYK,SAASI,aAAa,CAC3B,GAAGC,IAAoD,EACvD;EACA,OAAOZ,mBAAmB,CAACa,OAAO,CAAC,GAAGD,IAAI,CAAC;AAC7C;AAEO,SAASE,iBAAiB,CAC/B,GAAGF,IAAiD,EACpD;EACA,OAAOZ,mBAAmB,CAACe,IAAI,CAAC,GAAGH,IAAI,CAAC;AAC1C;AACO,SAASI,kBAAkB,CAChC,GAAGJ,IAAkD,EACrD;EACA,OAAOZ,mBAAmB,CAACiB,KAAK,CAAC,GAAGL,IAAI,CAAC;AAC3C;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transform.js b/node_modules/@babel/core/lib/transform.js index 3a5af74c2..e523a5337 100644 --- a/node_modules/@babel/core/lib/transform.js +++ b/node_modules/@babel/core/lib/transform.js @@ -6,33 +6,24 @@ Object.defineProperty(exports, "__esModule", { exports.transform = void 0; exports.transformAsync = transformAsync; exports.transformSync = transformSync; - function _gensync() { const data = require("gensync"); - _gensync = function () { return data; }; - return data; } - var _config = require("./config"); - var _transformation = require("./transformation"); - var _rewriteStackTrace = require("./errors/rewrite-stack-trace"); - const transformRunner = _gensync()(function* transform(code, opts) { const config = yield* (0, _config.default)(opts); if (config === null) return null; return yield* (0, _transformation.run)(config, code); }); - const transform = function transform(code, optsOrCallback, maybeCallback) { let opts; let callback; - if (typeof optsOrCallback === "function") { callback = optsOrCallback; opts = undefined; @@ -40,26 +31,20 @@ const transform = function transform(code, optsOrCallback, maybeCallback) { opts = optsOrCallback; callback = maybeCallback; } - if (callback === undefined) { { return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.sync)(code, opts); } } - (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.errback)(code, opts, callback); }; - exports.transform = transform; - function transformSync(...args) { return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.sync)(...args); } - function transformAsync(...args) { return (0, _rewriteStackTrace.beginHiddenCallStack)(transformRunner.async)(...args); } - 0 && 0; //# sourceMappingURL=transform.js.map diff --git a/node_modules/@babel/core/lib/transform.js.map b/node_modules/@babel/core/lib/transform.js.map index 2f18c9f18..cc6a8109b 100644 --- a/node_modules/@babel/core/lib/transform.js.map +++ b/node_modules/@babel/core/lib/transform.js.map @@ -1 +1 @@ -{"version":3,"names":["transformRunner","gensync","transform","code","opts","config","loadConfig","run","optsOrCallback","maybeCallback","callback","undefined","beginHiddenCallStack","sync","errback","transformSync","args","transformAsync","async"],"sources":["../src/transform.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\n\nimport loadConfig from \"./config\";\nimport type { InputOptions, ResolvedConfig } from \"./config\";\nimport { run } from \"./transformation\";\n\nimport type { FileResult, FileResultCallback } from \"./transformation\";\nimport { beginHiddenCallStack } from \"./errors/rewrite-stack-trace\";\n\nexport type { FileResult } from \"./transformation\";\n\ntype Transform = {\n (code: string, callback: FileResultCallback): void;\n (\n code: string,\n opts: InputOptions | undefined | null,\n callback: FileResultCallback,\n ): void;\n (code: string, opts?: InputOptions | null): FileResult | null;\n};\n\nconst transformRunner = gensync(function* transform(\n code: string,\n opts?: InputOptions,\n): Handler {\n const config: ResolvedConfig | null = yield* loadConfig(opts);\n if (config === null) return null;\n\n return yield* run(config, code);\n});\n\nexport const transform: Transform = function transform(\n code,\n optsOrCallback?: InputOptions | null | undefined | FileResultCallback,\n maybeCallback?: FileResultCallback,\n) {\n let opts: InputOptions | undefined | null;\n let callback: FileResultCallback | undefined;\n if (typeof optsOrCallback === \"function\") {\n callback = optsOrCallback;\n opts = undefined;\n } else {\n opts = optsOrCallback;\n callback = maybeCallback;\n }\n\n if (callback === undefined) {\n if (process.env.BABEL_8_BREAKING) {\n throw new Error(\n \"Starting from Babel 8.0.0, the 'transform' function expects a callback. If you need to call it synchronously, please use 'transformSync'.\",\n );\n } else {\n // console.warn(\n // \"Starting from Babel 8.0.0, the 'transform' function will expect a callback. If you need to call it synchronously, please use 'transformSync'.\",\n // );\n return beginHiddenCallStack(transformRunner.sync)(code, opts);\n }\n }\n\n beginHiddenCallStack(transformRunner.errback)(code, opts, callback);\n};\n\nexport function transformSync(\n ...args: Parameters\n) {\n return beginHiddenCallStack(transformRunner.sync)(...args);\n}\nexport function transformAsync(\n ...args: Parameters\n) {\n return beginHiddenCallStack(transformRunner.async)(...args);\n}\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;;AAEA;;AAGA;;AAcA,MAAMA,eAAe,GAAGC,UAAA,CAAQ,UAAUC,SAAV,CAC9BC,IAD8B,EAE9BC,IAF8B,EAGF;EAC5B,MAAMC,MAA6B,GAAG,OAAO,IAAAC,eAAA,EAAWF,IAAX,CAA7C;EACA,IAAIC,MAAM,KAAK,IAAf,EAAqB,OAAO,IAAP;EAErB,OAAO,OAAO,IAAAE,mBAAA,EAAIF,MAAJ,EAAYF,IAAZ,CAAd;AACD,CARuB,CAAxB;;AAUO,MAAMD,SAAoB,GAAG,SAASA,SAAT,CAClCC,IADkC,EAElCK,cAFkC,EAGlCC,aAHkC,EAIlC;EACA,IAAIL,IAAJ;EACA,IAAIM,QAAJ;;EACA,IAAI,OAAOF,cAAP,KAA0B,UAA9B,EAA0C;IACxCE,QAAQ,GAAGF,cAAX;IACAJ,IAAI,GAAGO,SAAP;EACD,CAHD,MAGO;IACLP,IAAI,GAAGI,cAAP;IACAE,QAAQ,GAAGD,aAAX;EACD;;EAED,IAAIC,QAAQ,KAAKC,SAAjB,EAA4B;IAKnB;MAIL,OAAO,IAAAC,uCAAA,EAAqBZ,eAAe,CAACa,IAArC,EAA2CV,IAA3C,EAAiDC,IAAjD,CAAP;IACD;EACF;;EAED,IAAAQ,uCAAA,EAAqBZ,eAAe,CAACc,OAArC,EAA8CX,IAA9C,EAAoDC,IAApD,EAA0DM,QAA1D;AACD,CA7BM;;;;AA+BA,SAASK,aAAT,CACL,GAAGC,IADE,EAEL;EACA,OAAO,IAAAJ,uCAAA,EAAqBZ,eAAe,CAACa,IAArC,EAA2C,GAAGG,IAA9C,CAAP;AACD;;AACM,SAASC,cAAT,CACL,GAAGD,IADE,EAEL;EACA,OAAO,IAAAJ,uCAAA,EAAqBZ,eAAe,CAACkB,KAArC,EAA4C,GAAGF,IAA/C,CAAP;AACD"} \ No newline at end of file +{"version":3,"names":["transformRunner","gensync","transform","code","opts","config","loadConfig","run","optsOrCallback","maybeCallback","callback","undefined","beginHiddenCallStack","sync","errback","transformSync","args","transformAsync","async"],"sources":["../src/transform.ts"],"sourcesContent":["import gensync, { type Handler } from \"gensync\";\n\nimport loadConfig from \"./config\";\nimport type { InputOptions, ResolvedConfig } from \"./config\";\nimport { run } from \"./transformation\";\n\nimport type { FileResult, FileResultCallback } from \"./transformation\";\nimport { beginHiddenCallStack } from \"./errors/rewrite-stack-trace\";\n\nexport type { FileResult } from \"./transformation\";\n\ntype Transform = {\n (code: string, callback: FileResultCallback): void;\n (\n code: string,\n opts: InputOptions | undefined | null,\n callback: FileResultCallback,\n ): void;\n (code: string, opts?: InputOptions | null): FileResult | null;\n};\n\nconst transformRunner = gensync(function* transform(\n code: string,\n opts?: InputOptions,\n): Handler {\n const config: ResolvedConfig | null = yield* loadConfig(opts);\n if (config === null) return null;\n\n return yield* run(config, code);\n});\n\nexport const transform: Transform = function transform(\n code,\n optsOrCallback?: InputOptions | null | undefined | FileResultCallback,\n maybeCallback?: FileResultCallback,\n) {\n let opts: InputOptions | undefined | null;\n let callback: FileResultCallback | undefined;\n if (typeof optsOrCallback === \"function\") {\n callback = optsOrCallback;\n opts = undefined;\n } else {\n opts = optsOrCallback;\n callback = maybeCallback;\n }\n\n if (callback === undefined) {\n if (process.env.BABEL_8_BREAKING) {\n throw new Error(\n \"Starting from Babel 8.0.0, the 'transform' function expects a callback. If you need to call it synchronously, please use 'transformSync'.\",\n );\n } else {\n // console.warn(\n // \"Starting from Babel 8.0.0, the 'transform' function will expect a callback. If you need to call it synchronously, please use 'transformSync'.\",\n // );\n return beginHiddenCallStack(transformRunner.sync)(code, opts);\n }\n }\n\n beginHiddenCallStack(transformRunner.errback)(code, opts, callback);\n};\n\nexport function transformSync(\n ...args: Parameters\n) {\n return beginHiddenCallStack(transformRunner.sync)(...args);\n}\nexport function transformAsync(\n ...args: Parameters\n) {\n return beginHiddenCallStack(transformRunner.async)(...args);\n}\n"],"mappings":";;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AAEA;AAGA;AAcA,MAAMA,eAAe,GAAGC,UAAO,CAAC,UAAUC,SAAS,CACjDC,IAAY,EACZC,IAAmB,EACS;EAC5B,MAAMC,MAA6B,GAAG,OAAO,IAAAC,eAAU,EAACF,IAAI,CAAC;EAC7D,IAAIC,MAAM,KAAK,IAAI,EAAE,OAAO,IAAI;EAEhC,OAAO,OAAO,IAAAE,mBAAG,EAACF,MAAM,EAAEF,IAAI,CAAC;AACjC,CAAC,CAAC;AAEK,MAAMD,SAAoB,GAAG,SAASA,SAAS,CACpDC,IAAI,EACJK,cAAqE,EACrEC,aAAkC,EAClC;EACA,IAAIL,IAAqC;EACzC,IAAIM,QAAwC;EAC5C,IAAI,OAAOF,cAAc,KAAK,UAAU,EAAE;IACxCE,QAAQ,GAAGF,cAAc;IACzBJ,IAAI,GAAGO,SAAS;EAClB,CAAC,MAAM;IACLP,IAAI,GAAGI,cAAc;IACrBE,QAAQ,GAAGD,aAAa;EAC1B;EAEA,IAAIC,QAAQ,KAAKC,SAAS,EAAE;IAKnB;MAIL,OAAO,IAAAC,uCAAoB,EAACZ,eAAe,CAACa,IAAI,CAAC,CAACV,IAAI,EAAEC,IAAI,CAAC;IAC/D;EACF;EAEA,IAAAQ,uCAAoB,EAACZ,eAAe,CAACc,OAAO,CAAC,CAACX,IAAI,EAAEC,IAAI,EAAEM,QAAQ,CAAC;AACrE,CAAC;AAAC;AAEK,SAASK,aAAa,CAC3B,GAAGC,IAA6C,EAChD;EACA,OAAO,IAAAJ,uCAAoB,EAACZ,eAAe,CAACa,IAAI,CAAC,CAAC,GAAGG,IAAI,CAAC;AAC5D;AACO,SAASC,cAAc,CAC5B,GAAGD,IAA8C,EACjD;EACA,OAAO,IAAAJ,uCAAoB,EAACZ,eAAe,CAACkB,KAAK,CAAC,CAAC,GAAGF,IAAI,CAAC;AAC7D;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js b/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js index 65745ed48..0f0d35005 100644 --- a/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js +++ b/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js @@ -4,94 +4,80 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = loadBlockHoistPlugin; - function _traverse() { const data = require("@babel/traverse"); - _traverse = function () { return data; }; - return data; } - var _plugin = require("../config/plugin"); - let LOADED_PLUGIN; +const blockHoistPlugin = { + name: "internal.blockHoist", + visitor: { + Block: { + exit({ + node + }) { + const { + body + } = node; + + let max = Math.pow(2, 30) - 1; + let hasChange = false; + for (let i = 0; i < body.length; i++) { + const n = body[i]; + const p = priority(n); + if (p > max) { + hasChange = true; + break; + } + max = p; + } + if (!hasChange) return; + + node.body = stableSort(body.slice()); + } + } + } +}; function loadBlockHoistPlugin() { if (!LOADED_PLUGIN) { LOADED_PLUGIN = new _plugin.default(Object.assign({}, blockHoistPlugin, { visitor: _traverse().default.explode(blockHoistPlugin.visitor) }), {}); } - return LOADED_PLUGIN; } - function priority(bodyNode) { const priority = bodyNode == null ? void 0 : bodyNode._blockHoist; if (priority == null) return 1; if (priority === true) return 2; return priority; } - function stableSort(body) { const buckets = Object.create(null); for (let i = 0; i < body.length; i++) { const n = body[i]; const p = priority(n); + const bucket = buckets[p] || (buckets[p] = []); bucket.push(n); } const keys = Object.keys(buckets).map(k => +k).sort((a, b) => b - a); let index = 0; - for (const key of keys) { const bucket = buckets[key]; - for (const n of bucket) { body[index++] = n; } } - return body; } - -const blockHoistPlugin = { - name: "internal.blockHoist", - visitor: { - Block: { - exit({ - node - }) { - const { - body - } = node; - let max = Math.pow(2, 30) - 1; - let hasChange = false; - - for (let i = 0; i < body.length; i++) { - const n = body[i]; - const p = priority(n); - - if (p > max) { - hasChange = true; - break; - } - - max = p; - } - - if (!hasChange) return; - node.body = stableSort(body.slice()); - } - - } - } -}; 0 && 0; //# sourceMappingURL=block-hoist-plugin.js.map diff --git a/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js.map b/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js.map index 28132275d..231cadde0 100644 --- a/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js.map +++ b/node_modules/@babel/core/lib/transformation/block-hoist-plugin.js.map @@ -1 +1 @@ -{"version":3,"names":["LOADED_PLUGIN","loadBlockHoistPlugin","Plugin","blockHoistPlugin","visitor","traverse","explode","priority","bodyNode","_blockHoist","stableSort","body","buckets","Object","create","i","length","n","p","bucket","push","keys","map","k","sort","a","b","index","key","name","Block","exit","node","max","hasChange","slice"],"sources":["../../src/transformation/block-hoist-plugin.ts"],"sourcesContent":["import traverse from \"@babel/traverse\";\nimport type { Statement } from \"@babel/types\";\nimport type { PluginObject } from \"../config\";\nimport Plugin from \"../config/plugin\";\n\nlet LOADED_PLUGIN: Plugin | void;\n\nexport default function loadBlockHoistPlugin(): Plugin {\n if (!LOADED_PLUGIN) {\n // cache the loaded blockHoist plugin plugin\n LOADED_PLUGIN = new Plugin(\n {\n ...blockHoistPlugin,\n visitor: traverse.explode(blockHoistPlugin.visitor),\n },\n {},\n );\n }\n\n return LOADED_PLUGIN;\n}\nfunction priority(bodyNode: Statement & { _blockHoist?: number | true }) {\n const priority = bodyNode?._blockHoist;\n if (priority == null) return 1;\n if (priority === true) return 2;\n return priority;\n}\n\nfunction stableSort(body: Statement[]) {\n // By default, we use priorities of 0-4.\n const buckets = Object.create(null);\n\n // By collecting into buckets, we can guarantee a stable sort.\n for (let i = 0; i < body.length; i++) {\n const n = body[i];\n const p = priority(n);\n\n // In case some plugin is setting an unexpected priority.\n const bucket = buckets[p] || (buckets[p] = []);\n bucket.push(n);\n }\n\n // Sort our keys in descending order. Keys are unique, so we don't have to\n // worry about stability.\n const keys = Object.keys(buckets)\n .map(k => +k)\n .sort((a, b) => b - a);\n\n let index = 0;\n for (const key of keys) {\n const bucket = buckets[key];\n for (const n of bucket) {\n body[index++] = n;\n }\n }\n return body;\n}\n\nconst blockHoistPlugin: PluginObject = {\n /**\n * [Please add a description.]\n *\n * Priority:\n *\n * - 0 We want this to be at the **very** bottom\n * - 1 Default node position\n * - 2 Priority over normal nodes\n * - 3 We want this to be at the **very** top\n * - 4 Reserved for the helpers used to implement module imports.\n */\n\n name: \"internal.blockHoist\",\n\n visitor: {\n Block: {\n exit({ node }) {\n const { body } = node;\n\n // Largest SMI\n let max = 2 ** 30 - 1;\n let hasChange = false;\n for (let i = 0; i < body.length; i++) {\n const n = body[i];\n const p = priority(n);\n if (p > max) {\n hasChange = true;\n break;\n }\n max = p;\n }\n if (!hasChange) return;\n\n // My kingdom for a stable sort!\n node.body = stableSort(body.slice());\n },\n },\n },\n};\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;;AAEA,IAAIA,aAAJ;;AAEe,SAASC,oBAAT,GAAwC;EACrD,IAAI,CAACD,aAAL,EAAoB;IAElBA,aAAa,GAAG,IAAIE,eAAJ,mBAETC,gBAFS;MAGZC,OAAO,EAAEC,mBAAA,CAASC,OAAT,CAAiBH,gBAAgB,CAACC,OAAlC;IAHG,IAKd,EALc,CAAhB;EAOD;;EAED,OAAOJ,aAAP;AACD;;AACD,SAASO,QAAT,CAAkBC,QAAlB,EAAyE;EACvE,MAAMD,QAAQ,GAAGC,QAAH,oBAA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AAjB;QAGA,IAAIC,GAAG,GAAG,YAAK,EAAL,IAAU,CAApB;QACA,IAAIC,SAAS,GAAG,KAAhB;;QACA,KAAK,IAAInB,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGJ,IAAI,CAACK,MAAzB,EAAiCD,CAAC,EAAlC,EAAsC;UACpC,MAAME,CAAC,GAAGN,IAAI,CAACI,CAAD,CAAd;UACA,MAAMG,CAAC,GAAGX,QAAQ,CAACU,CAAD,CAAlB;;UACA,IAAIC,CAAC,GAAGe,GAAR,EAAa;YACXC,SAAS,GAAG,IAAZ;YACA;UACD;;UACDD,GAAG,GAAGf,CAAN;QACD;;QACD,IAAI,CAACgB,SAAL,EAAgB;QAGhBF,IAAI,CAACrB,IAAL,GAAYD,UAAU,CAACC,IAAI,CAACwB,KAAL,EAAD,CAAtB;MACD;;IApBI;EADA;AAf4B,CAAvC"} \ No newline at end of file +{"version":3,"names":["LOADED_PLUGIN","blockHoistPlugin","name","visitor","Block","exit","node","body","max","hasChange","i","length","n","p","priority","stableSort","slice","loadBlockHoistPlugin","Plugin","traverse","explode","bodyNode","_blockHoist","buckets","Object","create","bucket","push","keys","map","k","sort","a","b","index","key"],"sources":["../../src/transformation/block-hoist-plugin.ts"],"sourcesContent":["import traverse from \"@babel/traverse\";\nimport type { Statement } from \"@babel/types\";\nimport type { PluginObject } from \"../config\";\nimport Plugin from \"../config/plugin\";\n\nlet LOADED_PLUGIN: Plugin | void;\n\nconst blockHoistPlugin: PluginObject = {\n /**\n * [Please add a description.]\n *\n * Priority:\n *\n * - 0 We want this to be at the **very** bottom\n * - 1 Default node position\n * - 2 Priority over normal nodes\n * - 3 We want this to be at the **very** top\n * - 4 Reserved for the helpers used to implement module imports.\n */\n\n name: \"internal.blockHoist\",\n\n visitor: {\n Block: {\n exit({ node }) {\n const { body } = node;\n\n // Largest SMI\n let max = 2 ** 30 - 1;\n let hasChange = false;\n for (let i = 0; i < body.length; i++) {\n const n = body[i];\n const p = priority(n);\n if (p > max) {\n hasChange = true;\n break;\n }\n max = p;\n }\n if (!hasChange) return;\n\n // My kingdom for a stable sort!\n node.body = stableSort(body.slice());\n },\n },\n },\n};\n\nexport default function loadBlockHoistPlugin(): Plugin {\n if (!LOADED_PLUGIN) {\n // cache the loaded blockHoist plugin plugin\n LOADED_PLUGIN = new Plugin(\n {\n ...blockHoistPlugin,\n visitor: traverse.explode(blockHoistPlugin.visitor),\n },\n {},\n );\n }\n\n return LOADED_PLUGIN;\n}\n\nfunction priority(bodyNode: Statement & { _blockHoist?: number | true }) {\n const priority = bodyNode?._blockHoist;\n if (priority == null) return 1;\n if (priority === true) return 2;\n return priority;\n}\n\nfunction stableSort(body: Statement[]) {\n // By default, we use priorities of 0-4.\n const buckets = Object.create(null);\n\n // By collecting into buckets, we can guarantee a stable sort.\n for (let i = 0; i < body.length; i++) {\n const n = body[i];\n const p = priority(n);\n\n // In case some plugin is setting an unexpected priority.\n const bucket = buckets[p] || (buckets[p] = []);\n bucket.push(n);\n }\n\n // Sort our keys in descending order. Keys are unique, so we don't have to\n // worry about stability.\n const keys = Object.keys(buckets)\n .map(k => +k)\n .sort((a, b) => b - a);\n\n let index = 0;\n for (const key of keys) {\n const bucket = buckets[key];\n for (const n of bucket) {\n body[index++] = n;\n }\n }\n return body;\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;AAEA,IAAIA,aAA4B;AAEhC,MAAMC,gBAA8B,GAAG;;EAarCC,IAAI,EAAE,qBAAqB;EAE3BC,OAAO,EAAE;IACPC,KAAK,EAAE;MACLC,IAAI,CAAC;QAAEC;MAAK,CAAC,EAAE;QACb,MAAM;UAAEC;QAAK,CAAC,GAAGD,IAAI;;QAGrB,IAAIE,GAAG,GAAG,UAAC,EAAI,EAAE,IAAG,CAAC;QACrB,IAAIC,SAAS,GAAG,KAAK;QACrB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,IAAI,CAACI,MAAM,EAAED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AC;IAC9Ca,MAAM,CAACC,IAAI,CAACf,CAAC,CAAC;EAChB;;EAIA,MAAMgB,IAAI,GAAGJ,MAAM,CAACI,IAAI,CAACL,OAAO,CAAC,CAC9BM,GAAG,CAACC,CAAC,IAAI,CAACA,CAAC,CAAC,CACZC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKA,CAAC,GAAGD,CAAC,CAAC;EAExB,IAAIE,KAAK,GAAG,CAAC;EACb,KAAK,MAAMC,GAAG,IAAIP,IAAI,EAAE;IACtB,MAAMF,MAAM,GAAGH,OAAO,CAACY,GAAG,CAAC;IAC3B,KAAK,MAAMvB,CAAC,IAAIc,MAAM,EAAE;MACtBnB,IAAI,CAAC2B,KAAK,EAAE,CAAC,GAAGtB,CAAC;IACnB;EACF;EACA,OAAOL,IAAI;AACb;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/file/file.js b/node_modules/@babel/core/lib/transformation/file/file.js index d4f372393..77d941fc2 100644 --- a/node_modules/@babel/core/lib/transformation/file/file.js +++ b/node_modules/@babel/core/lib/transformation/file/file.js @@ -4,84 +4,61 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; - function helpers() { const data = require("@babel/helpers"); - helpers = function () { return data; }; - return data; } - function _traverse() { const data = require("@babel/traverse"); - _traverse = function () { return data; }; - return data; } - function _codeFrame() { const data = require("@babel/code-frame"); - _codeFrame = function () { return data; }; - return data; } - function _t() { const data = require("@babel/types"); - _t = function () { return data; }; - return data; } - function _helperModuleTransforms() { const data = require("@babel/helper-module-transforms"); - _helperModuleTransforms = function () { return data; }; - return data; } - function _semver() { const data = require("semver"); - _semver = function () { return data; }; - return data; } - const { cloneNode, interpreterDirective } = _t(); - const errorVisitor = { enter(path, state) { const loc = path.node.loc; - if (loc) { state.loc = loc; path.stop(); } } - }; - class File { constructor(options, { code, @@ -124,7 +101,6 @@ class File { } = this.path.node; return interpreter ? interpreter.value : ""; } - set shebang(value) { if (value) { this.path.get("interpreter").replaceWith(interpreterDirective(value)); @@ -132,51 +108,42 @@ class File { this.path.get("interpreter").remove(); } } - set(key, val) { if (key === "helpersNamespace") { throw new Error("Babel 7.0.0-beta.56 has dropped support for the 'helpersNamespace' utility." + "If you are using @babel/plugin-external-helpers you will need to use a newer " + "version than the one you currently have installed. " + "If you have your own implementation, you'll want to explore using 'helperGenerator' " + "alongside 'file.availableHelper()'."); } - this._map.set(key, val); } - get(key) { return this._map.get(key); } - has(key) { return this._map.has(key); } - getModuleName() { return (0, _helperModuleTransforms().getModuleName)(this.opts, this.opts); } - addImport() { throw new Error("This API has been removed. If you're looking for this " + "functionality in Babel 7, you should import the " + "'@babel/helper-module-imports' module and use the functions exposed " + " from that module, such as 'addNamed' or 'addDefault'."); } availableHelper(name, versionRange) { let minVersion; - try { minVersion = helpers().minVersion(name); } catch (err) { if (err.code !== "BABEL_HELPER_UNKNOWN") throw err; return false; } - if (typeof versionRange !== "string") return true; + if (_semver().valid(versionRange)) versionRange = `^${versionRange}`; return !_semver().intersects(`<${minVersion}`, versionRange) && !_semver().intersects(`>=8.0.0`, versionRange); } - addHelper(name) { const declar = this.declarations[name]; if (declar) return cloneNode(declar); const generator = this.get("helperGenerator"); - if (generator) { const res = generator(name); if (res) return res; @@ -185,11 +152,9 @@ class File { helpers().ensure(name, File); const uid = this.declarations[name] = this.scope.generateUidIdentifier(name); const dependencies = {}; - for (const dep of helpers().getDependencies(name)) { dependencies[dep] = this.addHelper(dep); } - const { nodes, globals @@ -209,14 +174,11 @@ class File { }); return uid; } - addTemplateObject() { throw new Error("This function has been moved into the template literal transform itself."); } - buildCodeFrameError(node, msg, _Error = SyntaxError) { let loc = node && (node.loc || node._loc); - if (!loc && node) { const state = { loc: null @@ -227,7 +189,6 @@ class File { if (loc) txt += " Location has been estimated."; msg += ` (${txt})`; } - if (loc) { const { highlightCode = true @@ -245,12 +206,9 @@ class File { highlightCode }); } - return new _Error(msg); } - } - exports.default = File; 0 && 0; diff --git a/node_modules/@babel/core/lib/transformation/file/file.js.map b/node_modules/@babel/core/lib/transformation/file/file.js.map index 3eb7a4574..30438781f 100644 --- a/node_modules/@babel/core/lib/transformation/file/file.js.map +++ b/node_modules/@babel/core/lib/transformation/file/file.js.map @@ -1 +1 @@ -{"version":3,"names":["cloneNode","interpreterDirective","errorVisitor","enter","path","state","loc","node","stop","File","constructor","options","code","ast","inputMap","_map","Map","opts","declarations","scope","metadata","hub","file","getCode","getScope","addHelper","bind","buildError","buildCodeFrameError","NodePath","get","parentPath","parent","container","key","setContext","shebang","interpreter","value","replaceWith","remove","set","val","Error","has","getModuleName","addImport","availableHelper","name","versionRange","minVersion","helpers","err","semver","valid","intersects","declar","generator","res","ensure","uid","generateUidIdentifier","dependencies","dep","getDependencies","nodes","globals","Object","keys","getAllBindings","forEach","hasBinding","rename","_compact","unshiftContainer","indexOf","isVariableDeclaration","registerDeclaration","addTemplateObject","msg","_Error","SyntaxError","_loc","traverse","txt","highlightCode","codeFrameColumns","start","line","column","end","undefined"],"sources":["../../../src/transformation/file/file.ts"],"sourcesContent":["import * as helpers from \"@babel/helpers\";\nimport { NodePath } from \"@babel/traverse\";\nimport type { HubInterface, Visitor, Scope } from \"@babel/traverse\";\nimport { codeFrameColumns } from \"@babel/code-frame\";\nimport traverse from \"@babel/traverse\";\nimport { cloneNode, interpreterDirective } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport { getModuleName } from \"@babel/helper-module-transforms\";\nimport semver from \"semver\";\n\nimport type { NormalizedFile } from \"../normalize-file\";\n\nconst errorVisitor: Visitor<{ loc: NodeLocation[\"loc\"] | null }> = {\n enter(path, state) {\n const loc = path.node.loc;\n if (loc) {\n state.loc = loc;\n path.stop();\n }\n },\n};\n\nexport type NodeLocation = {\n loc?: {\n end?: {\n line: number;\n column: number;\n };\n start: {\n line: number;\n column: number;\n };\n };\n _loc?: {\n end?: {\n line: number;\n column: number;\n };\n start: {\n line: number;\n column: number;\n };\n };\n};\n\nexport default class File {\n _map: Map = new Map();\n opts: { [key: string]: any };\n declarations: { [key: string]: t.Identifier } = {};\n path: NodePath;\n ast: t.File;\n scope: Scope;\n metadata: { [key: string]: any } = {};\n code: string = \"\";\n inputMap: any;\n\n hub: HubInterface & { file: File } = {\n // keep it for the usage in babel-core, ex: path.hub.file.opts.filename\n file: this,\n getCode: () => this.code,\n getScope: () => this.scope,\n addHelper: this.addHelper.bind(this),\n buildError: this.buildCodeFrameError.bind(this),\n };\n\n constructor(options: {}, { code, ast, inputMap }: NormalizedFile) {\n this.opts = options;\n this.code = code;\n this.ast = ast;\n this.inputMap = inputMap;\n\n this.path = NodePath.get({\n hub: this.hub,\n parentPath: null,\n parent: this.ast,\n container: this.ast,\n key: \"program\",\n }).setContext() as NodePath;\n this.scope = this.path.scope;\n }\n\n /**\n * Provide backward-compatible access to the interpreter directive handling\n * in Babel 6.x. If you are writing a plugin for Babel 7.x, it would be\n * best to use 'program.interpreter' directly.\n */\n get shebang(): string {\n const { interpreter } = this.path.node;\n return interpreter ? interpreter.value : \"\";\n }\n set shebang(value: string) {\n if (value) {\n this.path.get(\"interpreter\").replaceWith(interpreterDirective(value));\n } else {\n this.path.get(\"interpreter\").remove();\n }\n }\n\n set(key: unknown, val: unknown) {\n if (key === \"helpersNamespace\") {\n throw new Error(\n \"Babel 7.0.0-beta.56 has dropped support for the 'helpersNamespace' utility.\" +\n \"If you are using @babel/plugin-external-helpers you will need to use a newer \" +\n \"version than the one you currently have installed. \" +\n \"If you have your own implementation, you'll want to explore using 'helperGenerator' \" +\n \"alongside 'file.availableHelper()'.\",\n );\n }\n\n this._map.set(key, val);\n }\n\n get(key: unknown): any {\n return this._map.get(key);\n }\n\n has(key: unknown): boolean {\n return this._map.has(key);\n }\n\n getModuleName(): string | undefined | null {\n return getModuleName(this.opts, this.opts);\n }\n\n addImport() {\n throw new Error(\n \"This API has been removed. If you're looking for this \" +\n \"functionality in Babel 7, you should import the \" +\n \"'@babel/helper-module-imports' module and use the functions exposed \" +\n \" from that module, such as 'addNamed' or 'addDefault'.\",\n );\n }\n\n /**\n * Check if a given helper is available in @babel/core's helper list.\n *\n * This _also_ allows you to pass a Babel version specifically. If the\n * helper exists, but was not available for the full given range, it will be\n * considered unavailable.\n */\n availableHelper(name: string, versionRange?: string | null): boolean {\n let minVersion;\n try {\n minVersion = helpers.minVersion(name);\n } catch (err) {\n if (err.code !== \"BABEL_HELPER_UNKNOWN\") throw err;\n\n return false;\n }\n\n if (typeof versionRange !== \"string\") return true;\n\n // semver.intersects() has some surprising behavior with comparing ranges\n // with pre-release versions. We add '^' to ensure that we are always\n // comparing ranges with ranges, which sidesteps this logic.\n // For example:\n //\n // semver.intersects(`<7.0.1`, \"7.0.0-beta.0\") // false - surprising\n // semver.intersects(`<7.0.1`, \"^7.0.0-beta.0\") // true - expected\n //\n // This is because the first falls back to\n //\n // semver.satisfies(\"7.0.0-beta.0\", `<7.0.1`) // false - surprising\n //\n // and this fails because a prerelease version can only satisfy a range\n // if it is a prerelease within the same major/minor/patch range.\n //\n // Note: If this is found to have issues, please also revisit the logic in\n // transform-runtime's definitions.js file.\n if (semver.valid(versionRange)) versionRange = `^${versionRange}`;\n\n return (\n !semver.intersects(`<${minVersion}`, versionRange) &&\n !semver.intersects(`>=8.0.0`, versionRange)\n );\n }\n\n addHelper(name: string): t.Identifier {\n const declar = this.declarations[name];\n if (declar) return cloneNode(declar);\n\n const generator = this.get(\"helperGenerator\");\n if (generator) {\n const res = generator(name);\n if (res) return res;\n }\n\n // make sure that the helper exists\n helpers.ensure(name, File);\n\n const uid = (this.declarations[name] =\n this.scope.generateUidIdentifier(name));\n\n const dependencies: { [key: string]: t.Identifier } = {};\n for (const dep of helpers.getDependencies(name)) {\n dependencies[dep] = this.addHelper(dep);\n }\n\n const { nodes, globals } = helpers.get(\n name,\n dep => dependencies[dep],\n uid,\n Object.keys(this.scope.getAllBindings()),\n );\n\n globals.forEach(name => {\n if (this.path.scope.hasBinding(name, true /* noGlobals */)) {\n this.path.scope.rename(name);\n }\n });\n\n nodes.forEach(node => {\n // @ts-expect-error Fixeme: document _compact node property\n node._compact = true;\n });\n\n this.path.unshiftContainer(\"body\", nodes);\n // TODO: NodePath#unshiftContainer should automatically register new\n // bindings.\n this.path.get(\"body\").forEach(path => {\n if (nodes.indexOf(path.node) === -1) return;\n if (path.isVariableDeclaration()) this.scope.registerDeclaration(path);\n });\n\n return uid;\n }\n\n addTemplateObject() {\n throw new Error(\n \"This function has been moved into the template literal transform itself.\",\n );\n }\n\n buildCodeFrameError(\n node: NodeLocation | undefined | null,\n msg: string,\n _Error: typeof Error = SyntaxError,\n ): Error {\n let loc = node && (node.loc || node._loc);\n\n if (!loc && node) {\n const state: { loc?: NodeLocation[\"loc\"] | null } = {\n loc: null,\n };\n traverse(node as t.Node, errorVisitor, this.scope, state);\n loc = state.loc;\n\n let txt =\n \"This is an error on an internal node. Probably an internal error.\";\n if (loc) txt += \" Location has been estimated.\";\n\n msg += ` (${txt})`;\n }\n\n if (loc) {\n const { highlightCode = true } = this.opts;\n\n msg +=\n \"\\n\" +\n codeFrameColumns(\n this.code,\n {\n start: {\n line: loc.start.line,\n column: loc.start.column + 1,\n },\n end:\n loc.end && loc.start.line === loc.end.line\n ? {\n line: loc.end.line,\n column: loc.end.column + 1,\n }\n : undefined,\n },\n { highlightCode },\n );\n }\n\n return new _Error(msg);\n }\n}\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;EAHSA,S;EAAWC;;;AAOpB,MAAMC,YAA0D,GAAG;EACjEC,KAAK,CAACC,IAAD,EAAOC,KAAP,EAAc;IACjB,MAAMC,GAAG,GAA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B,EAAuC,KAAKiB,KAA5C,EAAmDd,KAAnD;MACAC,GAAG,GAAGD,KAAK,CAACC,GAAZ;MAEA,IAAI8E,GAAG,GACL,mEADF;MAEA,IAAI9E,GAAJ,EAAS8E,GAAG,IAAI,+BAAP;MAETL,GAAG,IAAK,KAAIK,GAAI,GAAhB;IACD;;IAED,IAAI9E,GAAJ,EAAS;MACP,MAAM;QAAE+E,aAAa,GAAG;MAAlB,IAA2B,KAAKpE,IAAtC;MAEA8D,GAAG,IACD,OACA,IAAAO,6BAAA,EACE,KAAK1E,IADP,EAEE;QACE2E,KAAK,EAAE;UACLC,IAAI,EAAElF,GAAG,CAACiF,KAAJ,CAAUC,IADX;UAELC,MAAM,EAAEnF,GAAG,CAACiF,KAAJ,CAAUE,MAAV,GAAmB;QAFtB,CADT;QAKEC,GAAG,EACDpF,GAAG,CAACoF,GAAJ,IAAWpF,GAAG,CAACiF,KAAJ,CAAUC,IAAV,KAAmBlF,GAAG,CAACoF,GAAJ,CAAQF,IAAtC,GACI;UACEA,IAAI,EAAElF,GAAG,CAACoF,GAAJ,CAAQF,IADhB;UAEEC,MAAM,EAAEnF,GAAG,CAACoF,GAAJ,CAAQD,MAAR,GAAiB;QAF3B,CADJ,GAKIE;MAXR,CAFF,EAeE;QAAEN;MAAF,CAfF,CAFF;IAmBD;;IAED,OAAO,IAAIL,MAAJ,CAAWD,GAAX,CAAP;EACD;;AA1OuB"} \ No newline at end of file +{"version":3,"names":["cloneNode","interpreterDirective","errorVisitor","enter","path","state","loc","node","stop","File","constructor","options","code","ast","inputMap","_map","Map","opts","declarations","scope","metadata","hub","file","getCode","getScope","addHelper","bind","buildError","buildCodeFrameError","NodePath","get","parentPath","parent","container","key","setContext","shebang","interpreter","value","replaceWith","remove","set","val","Error","has","getModuleName","addImport","availableHelper","name","versionRange","minVersion","helpers","err","semver","valid","intersects","declar","generator","res","ensure","uid","generateUidIdentifier","dependencies","dep","getDependencies","nodes","globals","Object","keys","getAllBindings","forEach","hasBinding","rename","_compact","unshiftContainer","indexOf","isVariableDeclaration","registerDeclaration","addTemplateObject","msg","_Error","SyntaxError","_loc","traverse","txt","highlightCode","codeFrameColumns","start","line","column","end","undefined"],"sources":["../../../src/transformation/file/file.ts"],"sourcesContent":["import * as helpers from \"@babel/helpers\";\nimport { NodePath } from \"@babel/traverse\";\nimport type { HubInterface, Visitor, Scope } from \"@babel/traverse\";\nimport { codeFrameColumns } from \"@babel/code-frame\";\nimport traverse from \"@babel/traverse\";\nimport { cloneNode, interpreterDirective } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport { getModuleName } from \"@babel/helper-module-transforms\";\nimport semver from \"semver\";\n\nimport type { NormalizedFile } from \"../normalize-file\";\n\nconst errorVisitor: Visitor<{ loc: NodeLocation[\"loc\"] | null }> = {\n enter(path, state) {\n const loc = path.node.loc;\n if (loc) {\n state.loc = loc;\n path.stop();\n }\n },\n};\n\nexport type NodeLocation = {\n loc?: {\n end?: {\n line: number;\n column: number;\n };\n start: {\n line: number;\n column: number;\n };\n };\n _loc?: {\n end?: {\n line: number;\n column: number;\n };\n start: {\n line: number;\n column: number;\n };\n };\n};\n\nexport default class File {\n _map: Map = new Map();\n opts: { [key: string]: any };\n declarations: { [key: string]: t.Identifier } = {};\n path: NodePath;\n ast: t.File;\n scope: Scope;\n metadata: { [key: string]: any } = {};\n code: string = \"\";\n inputMap: any;\n\n hub: HubInterface & { file: File } = {\n // keep it for the usage in babel-core, ex: path.hub.file.opts.filename\n file: this,\n getCode: () => this.code,\n getScope: () => this.scope,\n addHelper: this.addHelper.bind(this),\n buildError: this.buildCodeFrameError.bind(this),\n };\n\n constructor(options: {}, { code, ast, inputMap }: NormalizedFile) {\n this.opts = options;\n this.code = code;\n this.ast = ast;\n this.inputMap = inputMap;\n\n this.path = NodePath.get({\n hub: this.hub,\n parentPath: null,\n parent: this.ast,\n container: this.ast,\n key: \"program\",\n }).setContext() as NodePath;\n this.scope = this.path.scope;\n }\n\n /**\n * Provide backward-compatible access to the interpreter directive handling\n * in Babel 6.x. If you are writing a plugin for Babel 7.x, it would be\n * best to use 'program.interpreter' directly.\n */\n get shebang(): string {\n const { interpreter } = this.path.node;\n return interpreter ? interpreter.value : \"\";\n }\n set shebang(value: string) {\n if (value) {\n this.path.get(\"interpreter\").replaceWith(interpreterDirective(value));\n } else {\n this.path.get(\"interpreter\").remove();\n }\n }\n\n set(key: unknown, val: unknown) {\n if (key === \"helpersNamespace\") {\n throw new Error(\n \"Babel 7.0.0-beta.56 has dropped support for the 'helpersNamespace' utility.\" +\n \"If you are using @babel/plugin-external-helpers you will need to use a newer \" +\n \"version than the one you currently have installed. \" +\n \"If you have your own implementation, you'll want to explore using 'helperGenerator' \" +\n \"alongside 'file.availableHelper()'.\",\n );\n }\n\n this._map.set(key, val);\n }\n\n get(key: unknown): any {\n return this._map.get(key);\n }\n\n has(key: unknown): boolean {\n return this._map.has(key);\n }\n\n getModuleName(): string | undefined | null {\n return getModuleName(this.opts, this.opts);\n }\n\n addImport() {\n throw new Error(\n \"This API has been removed. If you're looking for this \" +\n \"functionality in Babel 7, you should import the \" +\n \"'@babel/helper-module-imports' module and use the functions exposed \" +\n \" from that module, such as 'addNamed' or 'addDefault'.\",\n );\n }\n\n /**\n * Check if a given helper is available in @babel/core's helper list.\n *\n * This _also_ allows you to pass a Babel version specifically. If the\n * helper exists, but was not available for the full given range, it will be\n * considered unavailable.\n */\n availableHelper(name: string, versionRange?: string | null): boolean {\n let minVersion;\n try {\n minVersion = helpers.minVersion(name);\n } catch (err) {\n if (err.code !== \"BABEL_HELPER_UNKNOWN\") throw err;\n\n return false;\n }\n\n if (typeof versionRange !== \"string\") return true;\n\n // semver.intersects() has some surprising behavior with comparing ranges\n // with pre-release versions. We add '^' to ensure that we are always\n // comparing ranges with ranges, which sidesteps this logic.\n // For example:\n //\n // semver.intersects(`<7.0.1`, \"7.0.0-beta.0\") // false - surprising\n // semver.intersects(`<7.0.1`, \"^7.0.0-beta.0\") // true - expected\n //\n // This is because the first falls back to\n //\n // semver.satisfies(\"7.0.0-beta.0\", `<7.0.1`) // false - surprising\n //\n // and this fails because a prerelease version can only satisfy a range\n // if it is a prerelease within the same major/minor/patch range.\n //\n // Note: If this is found to have issues, please also revisit the logic in\n // transform-runtime's definitions.js file.\n if (semver.valid(versionRange)) versionRange = `^${versionRange}`;\n\n return (\n !semver.intersects(`<${minVersion}`, versionRange) &&\n !semver.intersects(`>=8.0.0`, versionRange)\n );\n }\n\n addHelper(name: string): t.Identifier {\n const declar = this.declarations[name];\n if (declar) return cloneNode(declar);\n\n const generator = this.get(\"helperGenerator\");\n if (generator) {\n const res = generator(name);\n if (res) return res;\n }\n\n // make sure that the helper exists\n helpers.ensure(name, File);\n\n const uid = (this.declarations[name] =\n this.scope.generateUidIdentifier(name));\n\n const dependencies: { [key: string]: t.Identifier } = {};\n for (const dep of helpers.getDependencies(name)) {\n dependencies[dep] = this.addHelper(dep);\n }\n\n const { nodes, globals } = helpers.get(\n name,\n dep => dependencies[dep],\n uid,\n Object.keys(this.scope.getAllBindings()),\n );\n\n globals.forEach(name => {\n if (this.path.scope.hasBinding(name, true /* noGlobals */)) {\n this.path.scope.rename(name);\n }\n });\n\n nodes.forEach(node => {\n // @ts-expect-error Fixeme: document _compact node property\n node._compact = true;\n });\n\n this.path.unshiftContainer(\"body\", nodes);\n // TODO: NodePath#unshiftContainer should automatically register new\n // bindings.\n this.path.get(\"body\").forEach(path => {\n if (nodes.indexOf(path.node) === -1) return;\n if (path.isVariableDeclaration()) this.scope.registerDeclaration(path);\n });\n\n return uid;\n }\n\n addTemplateObject() {\n throw new Error(\n \"This function has been moved into the template literal transform itself.\",\n );\n }\n\n buildCodeFrameError(\n node: NodeLocation | undefined | null,\n msg: string,\n _Error: typeof Error = SyntaxError,\n ): Error {\n let loc = node && (node.loc || node._loc);\n\n if (!loc && node) {\n const state: { loc?: NodeLocation[\"loc\"] | null } = {\n loc: null,\n };\n traverse(node as t.Node, errorVisitor, this.scope, state);\n loc = state.loc;\n\n let txt =\n \"This is an error on an internal node. Probably an internal error.\";\n if (loc) txt += \" Location has been estimated.\";\n\n msg += ` (${txt})`;\n }\n\n if (loc) {\n const { highlightCode = true } = this.opts;\n\n msg +=\n \"\\n\" +\n codeFrameColumns(\n this.code,\n {\n start: {\n line: loc.start.line,\n column: loc.start.column + 1,\n },\n end:\n loc.end && loc.start.line === loc.end.line\n ? {\n line: loc.end.line,\n column: loc.end.column + 1,\n }\n : undefined,\n },\n { highlightCode },\n );\n }\n\n return new _Error(msg);\n }\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA4B;EAHnBA,SAAS;EAAEC;AAAoB;AAOxC,MAAMC,YAA0D,GAAG;EACjEC,KAAK,CAACC,IAAI,EAAEC,KAAK,EAAE;IACjB,MAAMC,GAAG,GAAGF,IAAI,CAACG,IAAI,CAACD,GAAG;IACzB,IAAIA,GAAG,EAAE;MACPD,KAAK,CAACC,GAAG,GAAGA,GAAG;MACfF,IAAI,CAACI,IAAI,EAAE;IACb;EACF;AACF,CAAC;AAyBc,MAAMC,IAAI,CAAC;EAoBxBC,WAAW,CAACC,OAAW,EAAE;IAAEC,IAAI;IAAEC,GAAG;IAAEC;EAAyB,CAAC,EAAE;IAAA,KAnBlEC,IAAI,GAA0B,IAAIC,GAAG,EAAE;IAAA,KACvCC,IAAI;IAAA,KACJC,YAAY,GAAoC,CAAC,CAAC;IAAA,KAClDd,IAAI;IAAA,KACJS,GAAG;IAAA,KACHM,KAAK;IAAA,KACLC,QAAQ,GAA2B,CAAC,CAAC;IAAA,KACrCR,IAAI,GAAW,EAAE;IAAA,KACjBE,QA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C1E,IAAI,EACT;QACE2E,KAAK,EAAE;UACLC,IAAI,EAAElF,GAAG,CAACiF,KAAK,CAACC,IAAI;UACpBC,MAAM,EAAEnF,GAAG,CAACiF,KAAK,CAACE,MAAM,GAAG;QAC7B,CAAC;QACDC,GAAG,EACDpF,GAAG,CAACoF,GAAG,IAAIpF,GAAG,CAACiF,KAAK,CAACC,IAAI,KAAKlF,GAAG,CAACoF,GAAG,CAACF,IAAI,GACtC;UACEA,IAAI,EAAElF,GAAG,CAACoF,GAAG,CAACF,IAAI;UAClBC,MAAM,EAAEnF,GAAG,CAACoF,GAAG,CAACD,MAAM,GAAG;QAC3B,CAAC,GACDE;MACR,CAAC,EACD;QAAEN;MAAc,CAAC,CAClB;IACL;IAEA,OAAO,IAAIL,MAAM,CAACD,GAAG,CAAC;EACxB;AACF;AAAC;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/file/generate.js b/node_modules/@babel/core/lib/transformation/file/generate.js index 9b7aae784..b71146909 100644 --- a/node_modules/@babel/core/lib/transformation/file/generate.js +++ b/node_modules/@babel/core/lib/transformation/file/generate.js @@ -4,29 +4,21 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = generateCode; - function _convertSourceMap() { const data = require("convert-source-map"); - _convertSourceMap = function () { return data; }; - return data; } - function _generator() { const data = require("@babel/generator"); - _generator = function () { return data; }; - return data; } - var _mergeMap = require("./merge-map"); - function generateCode(pluginPasses, file) { const { opts, @@ -38,27 +30,22 @@ function generateCode(pluginPasses, file) { generatorOpts } = opts; const results = []; - for (const plugins of pluginPasses) { for (const plugin of plugins) { const { generatorOverride } = plugin; - if (generatorOverride) { const result = generatorOverride(ast, generatorOpts, code, _generator().default); if (result !== undefined) results.push(result); } } } - let result; - if (results.length === 0) { result = (0, _generator().default)(ast, generatorOpts, code); } else if (results.length === 1) { result = results[0]; - if (typeof result.then === "function") { throw new Error(`You appear to be using an async codegen plugin, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, ` + `you may need to upgrade your @babel/core version.`); } @@ -70,7 +57,6 @@ function generateCode(pluginPasses, file) { code: outputCode, decodedMap: outputMap = result.map } = result; - if (outputMap) { if (inputMap) { outputMap = (0, _mergeMap.default)(inputMap.toObject(), outputMap, generatorOpts.sourceFileName); @@ -78,21 +64,17 @@ function generateCode(pluginPasses, file) { outputMap = result.map; } } - if (opts.sourceMaps === "inline" || opts.sourceMaps === "both") { outputCode += "\n" + _convertSourceMap().fromObject(outputMap).toComment(); } - if (opts.sourceMaps === "inline") { outputMap = null; } - return { outputCode, outputMap }; } - 0 && 0; //# sourceMappingURL=generate.js.map diff --git a/node_modules/@babel/core/lib/transformation/file/generate.js.map b/node_modules/@babel/core/lib/transformation/file/generate.js.map index c47782953..c9fa3fd48 100644 --- a/node_modules/@babel/core/lib/transformation/file/generate.js.map +++ b/node_modules/@babel/core/lib/transformation/file/generate.js.map @@ -1 +1 @@ -{"version":3,"names":["generateCode","pluginPasses","file","opts","ast","code","inputMap","generatorOpts","results","plugins","plugin","generatorOverride","result","generate","undefined","push","length","then","Error","outputCode","decodedMap","outputMap","map","mergeSourceMap","toObject","sourceFileName","sourceMaps","convertSourceMap","fromObject","toComment"],"sources":["../../../src/transformation/file/generate.ts"],"sourcesContent":["import type { PluginPasses } from \"../../config\";\nimport convertSourceMap from \"convert-source-map\";\ntype SourceMap = any;\nimport generate from \"@babel/generator\";\n\nimport type File from \"./file\";\nimport mergeSourceMap from \"./merge-map\";\n\nexport default function generateCode(\n pluginPasses: PluginPasses,\n file: File,\n): {\n outputCode: string;\n outputMap: SourceMap | null;\n} {\n const { opts, ast, code, inputMap } = file;\n const { generatorOpts } = opts;\n\n const results = [];\n for (const plugins of pluginPasses) {\n for (const plugin of plugins) {\n const { generatorOverride } = plugin;\n if (generatorOverride) {\n const result = generatorOverride(ast, generatorOpts, code, generate);\n\n if (result !== undefined) results.push(result);\n }\n }\n }\n\n let result;\n if (results.length === 0) {\n result = generate(ast, generatorOpts, code);\n } else if (results.length === 1) {\n result = results[0];\n\n if (typeof result.then === \"function\") {\n throw new Error(\n `You appear to be using an async codegen plugin, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, ` +\n `you may need to upgrade your @babel/core version.`,\n );\n }\n } else {\n throw new Error(\"More than one plugin attempted to override codegen.\");\n }\n\n // Decoded maps are faster to merge, so we attempt to get use the decodedMap\n // first. But to preserve backwards compat with older Generator, we'll fall\n // back to the encoded map.\n let { code: outputCode, decodedMap: outputMap = result.map } = result;\n\n if (outputMap) {\n if (inputMap) {\n // mergeSourceMap returns an encoded map\n outputMap = mergeSourceMap(\n inputMap.toObject(),\n outputMap,\n generatorOpts.sourceFileName,\n );\n } else {\n // We cannot output a decoded map, so retrieve the encoded form. Because\n // the decoded form is free, it's fine to prioritize decoded first.\n outputMap = result.map;\n }\n }\n\n if (opts.sourceMaps === \"inline\" || opts.sourceMaps === \"both\") {\n outputCode += \"\\n\" + convertSourceMap.fromObject(outputMap).toComment();\n }\n\n if (opts.sourceMaps === \"inline\") {\n outputMap = null;\n }\n\n return { outputCode, outputMap };\n}\n"],"mappings":";;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;;AAEe,SAASA,YAAT,CACbC,YADa,EAEbC,IAFa,EAMb;EACA,MAAM;IAAEC,IAAF;IAAQC,GAAR;IAAaC,IAAb;IAAmBC;EAAnB,IAAgCJ,IAAtC;EACA,MAAM;IAAEK;EAAF,IAAoBJ,IAA1B;EAEA,MAAMK,OAAO,GAAG,EAAhB;;EACA,KAAK,MAAMC,OAAX,IAAsBR,YAAtB,EAAoC;IAClC,KAAK,MAAMS,MAAX,IAAqBD,OAArB,EAA8B;MAC5B,MAAM;QAAEE;MAAF,IAAwBD,MAA9B;;MACA,IAAIC,iBAAJ,EAAuB;QACrB,MAAMC,MAAM,GAAGD,iBAAiB,CAACP,GAAD,EAAMG,aAAN,EAAqBF,IAArB,EAA2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AEF,UAAF;IAAcE;EAAd,CAAP;AACD"} \ No newline at end of file +{"version":3,"names":["generateCode","pluginPasses","file","opts","ast","code","inputMap","generatorOpts","results","plugins","plugin","generatorOverride","result","generate","undefined","push","length","then","Error","outputCode","decodedMap","outputMap","map","mergeSourceMap","toObject","sourceFileName","sourceMaps","convertSourceMap","fromObject","toComment"],"sources":["../../../src/transformation/file/generate.ts"],"sourcesContent":["import type { PluginPasses } from \"../../config\";\nimport convertSourceMap from \"convert-source-map\";\ntype SourceMap = any;\nimport generate from \"@babel/generator\";\n\nimport type File from \"./file\";\nimport mergeSourceMap from \"./merge-map\";\n\nexport default function generateCode(\n pluginPasses: PluginPasses,\n file: File,\n): {\n outputCode: string;\n outputMap: SourceMap | null;\n} {\n const { opts, ast, code, inputMap } = file;\n const { generatorOpts } = opts;\n\n const results = [];\n for (const plugins of pluginPasses) {\n for (const plugin of plugins) {\n const { generatorOverride } = plugin;\n if (generatorOverride) {\n const result = generatorOverride(ast, generatorOpts, code, generate);\n\n if (result !== undefined) results.push(result);\n }\n }\n }\n\n let result;\n if (results.length === 0) {\n result = generate(ast, generatorOpts, code);\n } else if (results.length === 1) {\n result = results[0];\n\n if (typeof result.then === \"function\") {\n throw new Error(\n `You appear to be using an async codegen plugin, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, ` +\n `you may need to upgrade your @babel/core version.`,\n );\n }\n } else {\n throw new Error(\"More than one plugin attempted to override codegen.\");\n }\n\n // Decoded maps are faster to merge, so we attempt to get use the decodedMap\n // first. But to preserve backwards compat with older Generator, we'll fall\n // back to the encoded map.\n let { code: outputCode, decodedMap: outputMap = result.map } = result;\n\n if (outputMap) {\n if (inputMap) {\n // mergeSourceMap returns an encoded map\n outputMap = mergeSourceMap(\n inputMap.toObject(),\n outputMap,\n generatorOpts.sourceFileName,\n );\n } else {\n // We cannot output a decoded map, so retrieve the encoded form. Because\n // the decoded form is free, it's fine to prioritize decoded first.\n outputMap = result.map;\n }\n }\n\n if (opts.sourceMaps === \"inline\" || opts.sourceMaps === \"both\") {\n outputCode += \"\\n\" + convertSourceMap.fromObject(outputMap).toComment();\n }\n\n if (opts.sourceMaps === \"inline\") {\n outputMap = null;\n }\n\n return { outputCode, outputMap };\n}\n"],"mappings":";;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;AAEe,SAASA,YAAY,CAClCC,YAA0B,EAC1BC,IAAU,EAIV;EACA,MAAM;IAAEC,IAAI;IAAEC,GAAG;IAAEC,IAAI;IAAEC;EAAS,CAAC,GAAGJ,IAAI;EAC1C,MAAM;IAAEK;EAAc,CAAC,GAAGJ,IAAI;EAE9B,MAAMK,OAAO,GAAG,EAAE;EAClB,KAAK,MAAMC,OAAO,IAAIR,YAAY,EAAE;IAClC,KAAK,MAAMS,MAAM,IAAID,OAAO,EAAE;MAC5B,MAAM;QAAEE;MAAkB,CAAC,GAAGD,MAAM;MACpC,IAAIC,iBAAiB,EAAE;QACrB,MAAMC,MAAM,GAAGD,iBAAiB,CAACP,GAAG,EAAEG,aAAa,EAAEF,IAAI,EAAEQ,oBAAQ,CAAC;QAEpE,IAAID,MAAM,KAAKE,SAAS,EAAEN,OAAO,CAACO,IAAI,CAACH,MAAM,CAAC;MAChD;IACF;EACF;EAEA,IAAIA,MAAM;EACV,IAAIJ,OAAO,CAACQ,MAAM,KAAK,CAAC,EAAE;IACxBJ,MAAM,GAAG,IAAAC,oBAAQ,EAACT,GAAG,EAAEG,aAAa,EAAEF,IAAI,CAAC;EAC7C,CAAC,MAAM,IAAIG,OAAO,CAACQ,MAAM,KAAK,CAAC,EAAE;IAC/BJ,MAAM,GAAGJ,OAAO,CAAC,CAAC,CAAC;IAEnB,IAAI,OAAOI,MAAM,CAACK,IAAI,KAAK,UAAU,EAAE;MACrC,MAAM,IAAIC,KAAK,CACZ,kDAAiD,GAC/C,wDAAuD,GACvD,sCAAqC,GACrC,mDAAkD,CACtD;IACH;EACF,CAAC,MAAM;IACL,MAAM,IAAIA,KAAK,CAAC,qDAAqD,CAAC;EACxE;;EAKA,IAAI;IAAEb,IAAI,EAAEc,UAAU;IAAEC,UAAU,EAAEC,SAAS,GAAGT,MAAM,CAACU;EAAI,CAAC,GAAGV,MAAM;EAErE,IAAIS,SAAS,EAAE;IACb,IAAIf,QAAQ,EAAE;MAEZe,SAAS,GAAG,IAAAE,iBAAc,EACxBjB,QAAQ,CAACkB,QAAQ,EAAE,EACnBH,SAAS,EACTd,aAAa,CAACkB,cAAc,CAC7B;IACH,CAAC,MAAM;MAGLJ,SAAS,GAAGT,MAAM,CAACU,GAAG;IACxB;EACF;EAEA,IAAInB,IAAI,CAACuB,UAAU,KAAK,QAAQ,IAAIvB,IAAI,CAACuB,UAAU,KAAK,MAAM,EAAE;IAC9DP,UAAU,IAAI,IAAI,GAAGQ,mBAAgB,CAACC,UAAU,CAACP,SAAS,CAAC,CAACQ,SAAS,EAAE;EACzE;EAEA,IAAI1B,IAAI,CAACuB,UAAU,KAAK,QAAQ,EAAE;IAChCL,SAAS,GAAG,IAAI;EAClB;EAEA,OAAO;IAAEF,UAAU;IAAEE;EAAU,CAAC;AAClC;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/file/merge-map.js b/node_modules/@babel/core/lib/transformation/file/merge-map.js index 422ec2784..62fab307e 100644 --- a/node_modules/@babel/core/lib/transformation/file/merge-map.js +++ b/node_modules/@babel/core/lib/transformation/file/merge-map.js @@ -4,44 +4,36 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = mergeSourceMap; - function _remapping() { const data = require("@ampproject/remapping"); - _remapping = function () { return data; }; - return data; } - function mergeSourceMap(inputMap, map, sourceFileName) { const source = sourceFileName.replace(/\\/g, "/"); - let found = false; + let found = false; const result = _remapping()(rootless(map), (s, ctx) => { if (s === source && !found) { found = true; ctx.source = ""; return rootless(inputMap); } - return null; }); - if (typeof inputMap.sourceRoot === "string") { result.sourceRoot = inputMap.sourceRoot; } return Object.assign({}, result); } - function rootless(map) { return Object.assign({}, map, { sourceRoot: null }); } - 0 && 0; //# sourceMappingURL=merge-map.js.map diff --git a/node_modules/@babel/core/lib/transformation/file/merge-map.js.map b/node_modules/@babel/core/lib/transformation/file/merge-map.js.map index 528562c8e..208fd3233 100644 --- a/node_modules/@babel/core/lib/transformation/file/merge-map.js.map +++ b/node_modules/@babel/core/lib/transformation/file/merge-map.js.map @@ -1 +1 @@ -{"version":3,"names":["mergeSourceMap","inputMap","map","sourceFileName","source","replace","found","result","remapping","rootless","s","ctx","sourceRoot"],"sources":["../../../src/transformation/file/merge-map.ts"],"sourcesContent":["type SourceMap = any;\nimport remapping from \"@ampproject/remapping\";\n\nexport default function mergeSourceMap(\n inputMap: SourceMap,\n map: SourceMap,\n sourceFileName: string,\n): SourceMap {\n // On win32 machines, the sourceFileName uses backslash paths like\n // `C:\\foo\\bar.js`. But sourcemaps are always posix paths, so we need to\n // normalize to regular slashes before we can merge (else we won't find the\n // source associated with our input map).\n // This mirrors code done while generating the output map at\n // https://github.com/babel/babel/blob/5c2fcadc9ae34fd20dd72b1111d5cf50476d700d/packages/babel-generator/src/source-map.ts#L102\n const source = sourceFileName.replace(/\\\\/g, \"/\");\n\n // Prevent an infinite recursion if one of the input map's sources has the\n // same resolved path as the input map. In the case, it would keep find the\n // input map, then get it's sources which will include a path like the input\n // map, on and on.\n let found = false;\n const result = remapping(rootless(map), (s, ctx) => {\n if (s === source && !found) {\n found = true;\n // We empty the source location, which will prevent the sourcemap from\n // becoming relative to the input's location. Eg, if we're transforming a\n // file 'foo/bar.js', and it is a transformation of a `baz.js` file in the\n // same directory, the expected output is just `baz.js`. Without this step,\n // it would become `foo/baz.js`.\n ctx.source = \"\";\n\n return rootless(inputMap);\n }\n\n return null;\n });\n\n if (typeof inputMap.sourceRoot === \"string\") {\n result.sourceRoot = inputMap.sourceRoot;\n }\n\n // remapping returns a SourceMap class type, but this breaks code downstream in\n // @babel/traverse and @babel/types that relies on data being plain objects.\n // When it encounters the sourcemap type it outputs a \"don't know how to turn\n // this value into a node\" error. As a result, we are converting the merged\n // sourcemap to a plain js object.\n return { ...result };\n}\n\nfunction rootless(map: SourceMap): SourceMap {\n return {\n ...map,\n\n // This is a bit hack. Remapping will create absolute sources in our\n // sourcemap, but we want to maintain sources relative to the sourceRoot.\n // We'll re-add the sourceRoot after remapping.\n sourceRoot: null,\n };\n}\n"],"mappings":";;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEe,SAASA,cAAT,CACbC,QADa,EAEbC,GAFa,EAGbC,cAHa,EAIF;EAOX,MAAMC,MAAM,GAAGD,cAAc,CAACE,OAAf,CAAuB,KAAvB,EAA8B,GAA9B,CAAf;EAMA,IAAIC,KAAK,GAAG,KAAZ;;EACA,MAAMC,MAAM,GAAGC,YAAA,CAAUC,QAAQ,CAACP,GAAD,CAAlB,EAAyB,CAACQ,CAAD,EAAIC,GAAJ,KAAY;IAClD,IAAID,CAAC,KAAKN,MAAN,IAAgB,CAACE,KAArB,EAA4B;MAC1BA,KAAK,GAAG,IAAR;MAMAK,GAAG,CAACP,MAAJ,GAAa,EAAb;MAEA,OAAOK,QAAQ,CAACR,QAAD,CAAf;IACD;;IAED,OAAO,IAAP;EACD,CAdc,CAAf;;EAgBA,IAAI,OAAOA,QAAQ,CAACW,UAAhB,KAA+B,QAAnC,EAA6C;IAC3CL,MAAM,CAACK,UAAP,GAAoBX,QAAQ,CAACW,UAA7B;EACD;;EAOD,yBAAYL,MAAZ;AACD;;AAED,SAASE,QAAT,CAAkBP,GAAlB,EAA6C;EAC3C,yBACKA,GADL;IAMEU,UAAU,EAAE;EANd;AAQD"} \ No newline at end of file +{"version":3,"names":["mergeSourceMap","inputMap","map","sourceFileName","source","replace","found","result","remapping","rootless","s","ctx","sourceRoot"],"sources":["../../../src/transformation/file/merge-map.ts"],"sourcesContent":["type SourceMap = any;\nimport remapping from \"@ampproject/remapping\";\n\nexport default function mergeSourceMap(\n inputMap: SourceMap,\n map: SourceMap,\n sourceFileName: string,\n): SourceMap {\n // On win32 machines, the sourceFileName uses backslash paths like\n // `C:\\foo\\bar.js`. But sourcemaps are always posix paths, so we need to\n // normalize to regular slashes before we can merge (else we won't find the\n // source associated with our input map).\n // This mirrors code done while generating the output map at\n // https://github.com/babel/babel/blob/5c2fcadc9ae34fd20dd72b1111d5cf50476d700d/packages/babel-generator/src/source-map.ts#L102\n const source = sourceFileName.replace(/\\\\/g, \"/\");\n\n // Prevent an infinite recursion if one of the input map's sources has the\n // same resolved path as the input map. In the case, it would keep find the\n // input map, then get it's sources which will include a path like the input\n // map, on and on.\n let found = false;\n const result = remapping(rootless(map), (s, ctx) => {\n if (s === source && !found) {\n found = true;\n // We empty the source location, which will prevent the sourcemap from\n // becoming relative to the input's location. Eg, if we're transforming a\n // file 'foo/bar.js', and it is a transformation of a `baz.js` file in the\n // same directory, the expected output is just `baz.js`. Without this step,\n // it would become `foo/baz.js`.\n ctx.source = \"\";\n\n return rootless(inputMap);\n }\n\n return null;\n });\n\n if (typeof inputMap.sourceRoot === \"string\") {\n result.sourceRoot = inputMap.sourceRoot;\n }\n\n // remapping returns a SourceMap class type, but this breaks code downstream in\n // @babel/traverse and @babel/types that relies on data being plain objects.\n // When it encounters the sourcemap type it outputs a \"don't know how to turn\n // this value into a node\" error. As a result, we are converting the merged\n // sourcemap to a plain js object.\n return { ...result };\n}\n\nfunction rootless(map: SourceMap): SourceMap {\n return {\n ...map,\n\n // This is a bit hack. Remapping will create absolute sources in our\n // sourcemap, but we want to maintain sources relative to the sourceRoot.\n // We'll re-add the sourceRoot after remapping.\n sourceRoot: null,\n };\n}\n"],"mappings":";;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEe,SAASA,cAAc,CACpCC,QAAmB,EACnBC,GAAc,EACdC,cAAsB,EACX;EAOX,MAAMC,MAAM,GAAGD,cAAc,CAACE,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;;EAMjD,IAAIC,KAAK,GAAG,KAAK;EACjB,MAAMC,MAAM,GAAGC,YAAS,CAACC,QAAQ,CAACP,GAAG,CAAC,EAAE,CAACQ,CAAC,EAAEC,GAAG,KAAK;IAClD,IAAID,CAAC,KAAKN,MAAM,IAAI,CAACE,KAAK,EAAE;MAC1BA,KAAK,GAAG,IAAI;MAMZK,GAAG,CAACP,MAAM,GAAG,EAAE;MAEf,OAAOK,QAAQ,CAACR,QAAQ,CAAC;IAC3B;IAEA,OAAO,IAAI;EACb,CAAC,CAAC;EAEF,IAAI,OAAOA,QAAQ,CAACW,UAAU,KAAK,QAAQ,EAAE;IAC3CL,MAAM,CAACK,UAAU,GAAGX,QAAQ,CAACW,UAAU;EACzC;;EAOA,yBAAYL,MAAM;AACpB;AAEA,SAASE,QAAQ,CAACP,GAAc,EAAa;EAC3C,yBACKA,GAAG;IAKNU,UAAU,EAAE;EAAI;AAEpB;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/index.js b/node_modules/@babel/core/lib/transformation/index.js index 17f8e3109..8eaf3b3be 100644 --- a/node_modules/@babel/core/lib/transformation/index.js +++ b/node_modules/@babel/core/lib/transformation/index.js @@ -4,49 +4,33 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.run = run; - function _traverse() { const data = require("@babel/traverse"); - _traverse = function () { return data; }; - return data; } - var _pluginPass = require("./plugin-pass"); - var _blockHoistPlugin = require("./block-hoist-plugin"); - var _normalizeOpts = require("./normalize-opts"); - var _normalizeFile = require("./normalize-file"); - var _generate = require("./file/generate"); - var _deepArray = require("../config/helpers/deep-array"); - function* run(config, code, ast) { const file = yield* (0, _normalizeFile.default)(config.passes, (0, _normalizeOpts.default)(config), code, ast); const opts = file.opts; - try { yield* transformFile(file, config.passes); } catch (e) { var _opts$filename; - e.message = `${(_opts$filename = opts.filename) != null ? _opts$filename : "unknown file"}: ${e.message}`; - if (!e.code) { e.code = "BABEL_TRANSFORM_ERROR"; } - throw e; } - let outputCode, outputMap; - try { if (opts.code !== false) { ({ @@ -56,16 +40,12 @@ function* run(config, code, ast) { } } catch (e) { var _opts$filename2; - e.message = `${(_opts$filename2 = opts.filename) != null ? _opts$filename2 : "unknown file"}: ${e.message}`; - if (!e.code) { e.code = "BABEL_GENERATE_ERROR"; } - throw e; } - return { metadata: file.metadata, options: opts, @@ -76,27 +56,23 @@ function* run(config, code, ast) { externalDependencies: (0, _deepArray.flattenToSet)(config.externalDependencies) }; } - function* transformFile(file, pluginPasses) { for (const pluginPairs of pluginPasses) { const passPairs = []; const passes = []; const visitors = []; - for (const plugin of pluginPairs.concat([(0, _blockHoistPlugin.default)()])) { const pass = new _pluginPass.default(file, plugin.key, plugin.options); passPairs.push([plugin, pass]); passes.push(pass); visitors.push(plugin.visitor); } - for (const [plugin, pass] of passPairs) { const fn = plugin.pre; - if (fn) { const result = fn.call(pass, file); - yield* []; + yield* []; if (isThenable(result)) { throw new Error(`You appear to be using an plugin with an async .pre, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`); } @@ -104,16 +80,13 @@ function* transformFile(file, pluginPasses) { } const visitor = _traverse().default.visitors.merge(visitors, passes, file.opts.wrapPluginVisitorMethod); - (0, _traverse().default)(file.ast, visitor, file.scope); - for (const [plugin, pass] of passPairs) { const fn = plugin.post; - if (fn) { const result = fn.call(pass, file); - yield* []; + yield* []; if (isThenable(result)) { throw new Error(`You appear to be using an plugin with an async .post, ` + `which your current version of Babel does not support. ` + `If you're using a published plugin, you may need to upgrade ` + `your @babel/core version.`); } @@ -121,11 +94,9 @@ function* transformFile(file, pluginPasses) { } } } - function isThenable(val) { return !!val && (typeof val === "object" || typeof val === "function") && !!val.then && typeof val.then === "function"; } - 0 && 0; //# sourceMappingURL=index.js.map diff --git a/node_modules/@babel/core/lib/transformation/index.js.map b/node_modules/@babel/core/lib/transformation/index.js.map index 1580118d6..289f93b15 100644 --- a/node_modules/@babel/core/lib/transformation/index.js.map +++ b/node_modules/@babel/core/lib/transformation/index.js.map @@ -1 +1 @@ -{"version":3,"names":["run","config","code","ast","file","normalizeFile","passes","normalizeOptions","opts","transformFile","e","message","filename","outputCode","outputMap","generateCode","metadata","options","undefined","map","sourceType","program","externalDependencies","flattenToSet","pluginPasses","pluginPairs","passPairs","visitors","plugin","concat","loadBlockHoistPlugin","pass","PluginPass","key","push","visitor","fn","pre","result","call","isThenable","Error","traverse","merge","wrapPluginVisitorMethod","scope","post","val","then"],"sources":["../../src/transformation/index.ts"],"sourcesContent":["import traverse from \"@babel/traverse\";\nimport type * as t from \"@babel/types\";\ntype SourceMap = any;\nimport type { Handler } from \"gensync\";\n\nimport type { ResolvedConfig, Plugin, PluginPasses } from \"../config\";\n\nimport PluginPass from \"./plugin-pass\";\nimport loadBlockHoistPlugin from \"./block-hoist-plugin\";\nimport normalizeOptions from \"./normalize-opts\";\nimport normalizeFile from \"./normalize-file\";\n\nimport generateCode from \"./file/generate\";\nimport type File from \"./file/file\";\n\nimport { flattenToSet } from \"../config/helpers/deep-array\";\n\nexport type FileResultCallback = {\n (err: Error, file: null): void;\n (err: null, file: FileResult | null): void;\n};\n\nexport type FileResult = {\n metadata: { [key: string]: any };\n options: { [key: string]: any };\n ast: t.File | null;\n code: string | null;\n map: SourceMap | null;\n sourceType: \"script\" | \"module\";\n externalDependencies: Set;\n};\n\nexport function* run(\n config: ResolvedConfig,\n code: string,\n ast?: t.File | t.Program | null,\n): Handler {\n const file = yield* normalizeFile(\n config.passes,\n normalizeOptions(config),\n code,\n ast,\n );\n\n const opts = file.opts;\n try {\n yield* transformFile(file, config.passes);\n } catch (e) {\n e.message = `${opts.filename ?? \"unknown file\"}: ${e.message}`;\n if (!e.code) {\n e.code = \"BABEL_TRANSFORM_ERROR\";\n }\n throw e;\n }\n\n let outputCode, outputMap;\n try {\n if (opts.code !== false) {\n ({ outputCode, outputMap } = generateCode(config.passes, file));\n }\n } catch (e) {\n e.message = `${opts.filename ?? \"unknown file\"}: ${e.message}`;\n if (!e.code) {\n e.code = \"BABEL_GENERATE_ERROR\";\n }\n throw e;\n }\n\n return {\n metadata: file.metadata,\n options: opts,\n ast: opts.ast === true ? file.ast : null,\n code: outputCode === undefined ? null : outputCode,\n map: outputMap === undefined ? null : outputMap,\n sourceType: file.ast.program.sourceType,\n externalDependencies: flattenToSet(config.externalDependencies),\n };\n}\n\nfunction* transformFile(file: File, pluginPasses: PluginPasses): Handler {\n for (const pluginPairs of pluginPasses) {\n const passPairs: [Plugin, PluginPass][] = [];\n const passes = [];\n const visitors = [];\n\n for (const plugin of pluginPairs.concat([loadBlockHoistPlugin()])) {\n const pass = new PluginPass(file, plugin.key, plugin.options);\n\n passPairs.push([plugin, pass]);\n passes.push(pass);\n visitors.push(plugin.visitor);\n }\n\n for (const [plugin, pass] of passPairs) {\n const fn = plugin.pre;\n if (fn) {\n const result = fn.call(pass, file);\n\n // @ts-expect-error - If we want to support async .pre\n yield* [];\n\n if (isThenable(result)) {\n throw new Error(\n `You appear to be using an plugin with an async .pre, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, you may need to upgrade ` +\n `your @babel/core version.`,\n );\n }\n }\n }\n\n // merge all plugin visitors into a single visitor\n const visitor = traverse.visitors.merge(\n visitors,\n passes,\n file.opts.wrapPluginVisitorMethod,\n );\n traverse(file.ast, visitor, file.scope);\n\n for (const [plugin, pass] of passPairs) {\n const fn = plugin.post;\n if (fn) {\n const result = fn.call(pass, file);\n\n // @ts-expect-error - If we want to support async .post\n yield* [];\n\n if (isThenable(result)) {\n throw new Error(\n `You appear to be using an plugin with an async .post, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, you may need to upgrade ` +\n `your @babel/core version.`,\n );\n }\n }\n }\n }\n}\n\nfunction isThenable>(val: any): val is T {\n return (\n !!val &&\n (typeof val === \"object\" || typeof val === \"function\") &&\n !!val.then &&\n typeof val.then === \"function\"\n );\n}\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;A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,KAAJ,CACH,uDAAD,GACG,wDADH,GAEG,8DAFH,GAGG,2BAJC,CAAN;QAMD;MACF;IACF;;IAGD,MAAMN,OAAO,GAAGO,mBAAA,CAASf,QAAT,CAAkBgB,KAAlB,CACdhB,QADc,EAEdrB,MAFc,EAGdF,IAAI,CAACI,IAAL,CAAUoC,uBAHI,CAAhB;;IAKA,IAAAF,mBAAA,EAAStC,IAAI,CAACD,GAAd,EAAmBgC,OAAnB,EAA4B/B,IAAI,CAACyC,KAAjC;;IAEA,KAAK,MAAM,CAACjB,MAAD,EAASG,IAAT,CAAX,IAA6BL,SAA7B,EAAwC;MACtC,MAAMU,EAAE,GAAGR,MAAM,CAACkB,IAAlB;;MACA,IAAIV,EAAJ,EAAQ;QACN,MAAME,MAAM,GAAGF,EAAE,CAACG,IAAH,CAAQR,IAAR,EAAc3B,IAAd,CAAf;QAGA,OAAO,EAAP;;QAEA,IAAIoC,UAAU,CAACF,MAAD,CAAd,EAAwB;UACtB,MAAM,IAAIG,KAAJ,CACH,wDAAD,GACG,wDADH,GAEG,8DAFH,GAGG,2BAJC,CAAN;QAMD;MACF;IACF;EACF;AACF;;AAED,SAASD,UAAT,CAAgDO,GAAhD,EAAoE;EAClE,OACE,CAAC,CAACA,GAAF,KACC,OAAOA,GAAP,KAAe,QAAf,IAA2B,OAAOA,GAAP,KAAe,UAD3C,KAEA,CAAC,CAACA,GAAG,CAACC,IAFN,IAGA,OAAOD,GAAG,CAACC,IAAX,KAAoB,UAJtB;AAMD"} \ No newline at end of file +{"version":3,"names":["run","config","code","ast","file","normalizeFile","passes","normalizeOptions","opts","transformFile","e","message","filename","outputCode","outputMap","generateCode","metadata","options","undefined","map","sourceType","program","externalDependencies","flattenToSet","pluginPasses","pluginPairs","passPairs","visitors","plugin","concat","loadBlockHoistPlugin","pass","PluginPass","key","push","visitor","fn","pre","result","call","isThenable","Error","traverse","merge","wrapPluginVisitorMethod","scope","post","val","then"],"sources":["../../src/transformation/index.ts"],"sourcesContent":["import traverse from \"@babel/traverse\";\nimport type * as t from \"@babel/types\";\ntype SourceMap = any;\nimport type { Handler } from \"gensync\";\n\nimport type { ResolvedConfig, Plugin, PluginPasses } from \"../config\";\n\nimport PluginPass from \"./plugin-pass\";\nimport loadBlockHoistPlugin from \"./block-hoist-plugin\";\nimport normalizeOptions from \"./normalize-opts\";\nimport normalizeFile from \"./normalize-file\";\n\nimport generateCode from \"./file/generate\";\nimport type File from \"./file/file\";\n\nimport { flattenToSet } from \"../config/helpers/deep-array\";\n\nexport type FileResultCallback = {\n (err: Error, file: null): void;\n (err: null, file: FileResult | null): void;\n};\n\nexport type FileResult = {\n metadata: { [key: string]: any };\n options: { [key: string]: any };\n ast: t.File | null;\n code: string | null;\n map: SourceMap | null;\n sourceType: \"script\" | \"module\";\n externalDependencies: Set;\n};\n\nexport function* run(\n config: ResolvedConfig,\n code: string,\n ast?: t.File | t.Program | null,\n): Handler {\n const file = yield* normalizeFile(\n config.passes,\n normalizeOptions(config),\n code,\n ast,\n );\n\n const opts = file.opts;\n try {\n yield* transformFile(file, config.passes);\n } catch (e) {\n e.message = `${opts.filename ?? \"unknown file\"}: ${e.message}`;\n if (!e.code) {\n e.code = \"BABEL_TRANSFORM_ERROR\";\n }\n throw e;\n }\n\n let outputCode, outputMap;\n try {\n if (opts.code !== false) {\n ({ outputCode, outputMap } = generateCode(config.passes, file));\n }\n } catch (e) {\n e.message = `${opts.filename ?? \"unknown file\"}: ${e.message}`;\n if (!e.code) {\n e.code = \"BABEL_GENERATE_ERROR\";\n }\n throw e;\n }\n\n return {\n metadata: file.metadata,\n options: opts,\n ast: opts.ast === true ? file.ast : null,\n code: outputCode === undefined ? null : outputCode,\n map: outputMap === undefined ? null : outputMap,\n sourceType: file.ast.program.sourceType,\n externalDependencies: flattenToSet(config.externalDependencies),\n };\n}\n\nfunction* transformFile(file: File, pluginPasses: PluginPasses): Handler {\n for (const pluginPairs of pluginPasses) {\n const passPairs: [Plugin, PluginPass][] = [];\n const passes = [];\n const visitors = [];\n\n for (const plugin of pluginPairs.concat([loadBlockHoistPlugin()])) {\n const pass = new PluginPass(file, plugin.key, plugin.options);\n\n passPairs.push([plugin, pass]);\n passes.push(pass);\n visitors.push(plugin.visitor);\n }\n\n for (const [plugin, pass] of passPairs) {\n const fn = plugin.pre;\n if (fn) {\n const result = fn.call(pass, file);\n\n // @ts-expect-error - If we want to support async .pre\n yield* [];\n\n if (isThenable(result)) {\n throw new Error(\n `You appear to be using an plugin with an async .pre, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, you may need to upgrade ` +\n `your @babel/core version.`,\n );\n }\n }\n }\n\n // merge all plugin visitors into a single visitor\n const visitor = traverse.visitors.merge(\n visitors,\n passes,\n file.opts.wrapPluginVisitorMethod,\n );\n traverse(file.ast, visitor, file.scope);\n\n for (const [plugin, pass] of passPairs) {\n const fn = plugin.post;\n if (fn) {\n const result = fn.call(pass, file);\n\n // @ts-expect-error - If we want to support async .post\n yield* [];\n\n if (isThenable(result)) {\n throw new Error(\n `You appear to be using an plugin with an async .post, ` +\n `which your current version of Babel does not support. ` +\n `If you're using a published plugin, you may need to upgrade ` +\n `your @babel/core version.`,\n );\n }\n }\n }\n }\n}\n\nfunction isThenable>(val: any): val is T {\n return (\n !!val &&\n (typeof val === \"object\" || typeof val === \"function\") &&\n !!val.then &&\n typeof val.then === \"function\"\n );\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAOA;AACA;AACA;AACA;AAEA;AAGA;AAiBO,UAAUA,GAAG,CAClBC,MAAsB,EACtBC,IAAY,EACZC,GAA+B,EACV;EACrB,MAAMC,IAAI,GAAG,OAAO,IAAAC,sBAAa,EAC/BJ,MAAM,CAACK,MAAM,EACb,IAAAC,sBAAgB,EAACN,MAAM,CAAC,EACxBC,IAAI,EACJC,GAAG,CACJ;EAED,MAAMK,IAAI,GAAGJ,IAAI,CAACI,IAAI;EACtB,IAAI;IACF,OAAOC,aAAa,CAACL,IAAI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AAIL,SAAS,EAAE;MACtC,MAAMU,EAAE,GAAGR,MAAM,CAACkB,IAAI;MACtB,IAAIV,EAAE,EAAE;QACN,MAAME,MAAM,GAAGF,EAAE,CAACG,IAAI,CAACR,IAAI,EAAE3B,IAAI,CAAC;;QAGlC,OAAO,EAAE;QAET,IAAIoC,UAAU,CAACF,MAAM,CAAC,EAAE;UACtB,MAAM,IAAIG,KAAK,CACZ,wDAAuD,GACrD,wDAAuD,GACvD,8DAA6D,GAC7D,2BAA0B,CAC9B;QACH;MACF;IACF;EACF;AACF;AAEA,SAASD,UAAU,CAA6BO,GAAQ,EAAY;EAClE,OACE,CAAC,CAACA,GAAG,KACJ,OAAOA,GAAG,KAAK,QAAQ,IAAI,OAAOA,GAAG,KAAK,UAAU,CAAC,IACtD,CAAC,CAACA,GAAG,CAACC,IAAI,IACV,OAAOD,GAAG,CAACC,IAAI,KAAK,UAAU;AAElC;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/normalize-file.js b/node_modules/@babel/core/lib/transformation/normalize-file.js index 98a8f0ad3..dd3cc8dc8 100644 --- a/node_modules/@babel/core/lib/transformation/normalize-file.js +++ b/node_modules/@babel/core/lib/transformation/normalize-file.js @@ -4,99 +4,74 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = normalizeFile; - function _fs() { const data = require("fs"); - _fs = function () { return data; }; - return data; } - function _path() { const data = require("path"); - _path = function () { return data; }; - return data; } - function _debug() { const data = require("debug"); - _debug = function () { return data; }; - return data; } - function _t() { const data = require("@babel/types"); - _t = function () { return data; }; - return data; } - function _convertSourceMap() { const data = require("convert-source-map"); - _convertSourceMap = function () { return data; }; - return data; } - var _file = require("./file/file"); - var _parser = require("../parser"); - var _cloneDeep = require("./util/clone-deep"); - const { file, traverseFast } = _t(); - const debug = _debug()("babel:transform:file"); - const LARGE_INPUT_SOURCEMAP_THRESHOLD = 3000000; +const INLINE_SOURCEMAP_REGEX = /^[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/; +const EXTERNAL_SOURCEMAP_REGEX = /^[@#][ \t]+sourceMappingURL=([^\s'"`]+)[ \t]*$/; function* normalizeFile(pluginPasses, options, code, ast) { code = `${code || ""}`; - if (ast) { if (ast.type === "Program") { ast = file(ast, [], []); } else if (ast.type !== "File") { throw new Error("AST root must be a Program or File node"); } - if (options.cloneInputAst) { ast = (0, _cloneDeep.default)(ast); } } else { ast = yield* (0, _parser.default)(pluginPasses, options, code); } - let inputMap = null; - if (options.inputSourceMap !== false) { if (typeof options.inputSourceMap === "object") { inputMap = _convertSourceMap().fromObject(options.inputSourceMap); } - if (!inputMap) { const lastComment = extractComments(INLINE_SOURCEMAP_REGEX, ast); - if (lastComment) { try { inputMap = _convertSourceMap().fromComment(lastComment); @@ -105,20 +80,17 @@ function* normalizeFile(pluginPasses, options, code, ast) { } } } - if (!inputMap) { const lastComment = extractComments(EXTERNAL_SOURCEMAP_REGEX, ast); - if (typeof options.filename === "string" && lastComment) { try { const match = EXTERNAL_SOURCEMAP_REGEX.exec(lastComment); - const inputMapContent = _fs().readFileSync(_path().resolve(_path().dirname(options.filename), match[1])); - if (inputMapContent.length > LARGE_INPUT_SOURCEMAP_THRESHOLD) { debug("skip merging input map > 1 MB"); } else { - inputMap = _convertSourceMap().fromJSON(inputMapContent); + inputMap = _convertSourceMap().fromJSON( + inputMapContent); } } catch (err) { debug("discarding unknown file input sourcemap", err); @@ -128,17 +100,12 @@ function* normalizeFile(pluginPasses, options, code, ast) { } } } - return new _file.default(options, { code, ast: ast, inputMap }); } - -const INLINE_SOURCEMAP_REGEX = /^[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/; -const EXTERNAL_SOURCEMAP_REGEX = /^[@#][ \t]+sourceMappingURL=([^\s'"`]+)[ \t]*$/; - function extractCommentsFromList(regex, comments, lastComment) { if (comments) { comments = comments.filter(({ @@ -148,14 +115,11 @@ function extractCommentsFromList(regex, comments, lastComment) { lastComment = value; return false; } - return true; }); } - return [comments, lastComment]; } - function extractComments(regex, ast) { let lastComment = null; traverseFast(ast, node => { @@ -165,7 +129,6 @@ function extractComments(regex, ast) { }); return lastComment; } - 0 && 0; //# sourceMappingURL=normalize-file.js.map diff --git a/node_modules/@babel/core/lib/transformation/normalize-file.js.map b/node_modules/@babel/core/lib/transformation/normalize-file.js.map index bf511510b..745351bc7 100644 --- a/node_modules/@babel/core/lib/transformation/normalize-file.js.map +++ b/node_modules/@babel/core/lib/transformation/normalize-file.js.map @@ -1 +1 @@ -{"version":3,"names":["file","traverseFast","debug","buildDebug","LARGE_INPUT_SOURCEMAP_THRESHOLD","normalizeFile","pluginPasses","options","code","ast","type","Error","cloneInputAst","cloneDeep","parser","inputMap","inputSourceMap","convertSourceMap","fromObject","lastComment","extractComments","INLINE_SOURCEMAP_REGEX","fromComment","err","EXTERNAL_SOURCEMAP_REGEX","filename","match","exec","inputMapContent","fs","readFileSync","path","resolve","dirname","length","fromJSON","File","extractCommentsFromList","regex","comments","filter","value","test","node","leadingComments","innerComments","trailingComments"],"sources":["../../src/transformation/normalize-file.ts"],"sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\nimport buildDebug from \"debug\";\nimport type { Handler } from \"gensync\";\nimport { file, traverseFast } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type { PluginPasses } from \"../config\";\nimport convertSourceMap from \"convert-source-map\";\nimport type { SourceMapConverter as Converter } from \"convert-source-map\";\nimport File from \"./file/file\";\nimport parser from \"../parser\";\nimport cloneDeep from \"./util/clone-deep\";\n\nconst debug = buildDebug(\"babel:transform:file\");\nconst LARGE_INPUT_SOURCEMAP_THRESHOLD = 3_000_000;\n\nexport type NormalizedFile = {\n code: string;\n ast: t.File;\n inputMap: Converter | null;\n};\n\nexport default function* normalizeFile(\n pluginPasses: PluginPasses,\n options: { [key: string]: any },\n code: string,\n ast?: t.File | t.Program | null,\n): Handler {\n code = `${code || \"\"}`;\n\n if (ast) {\n if (ast.type === \"Program\") {\n ast = file(ast, [], []);\n } else if (ast.type !== \"File\") {\n throw new Error(\"AST root must be a Program or File node\");\n }\n\n if (options.cloneInputAst) {\n ast = cloneDeep(ast) as t.File;\n }\n } else {\n // @ts-expect-error todo: use babel-types ast typings in Babel parser\n ast = yield* parser(pluginPasses, options, code);\n }\n\n let inputMap = null;\n if (options.inputSourceMap !== false) {\n // If an explicit object is passed in, it overrides the processing of\n // source maps that may be in the file itself.\n if (typeof options.inputSourceMap === \"object\") {\n inputMap = convertSourceMap.fromObject(options.inputSourceMap);\n }\n\n if (!inputMap) {\n const lastComment = extractComments(INLINE_SOURCEMAP_REGEX, ast);\n if (lastComment) {\n try {\n inputMap = convertSourceMap.fromComment(lastComment);\n } catch (err) {\n debug(\"discarding unknown inline input sourcemap\", err);\n }\n }\n }\n\n if (!inputMap) {\n const lastComment = extractComments(EXTERNAL_SOURCEMAP_REGEX, ast);\n if (typeof options.filename === \"string\" && lastComment) {\n try {\n // when `lastComment` is non-null, EXTERNAL_SOURCEMAP_REGEX must have matches\n const match: [string, string] = EXTERNAL_SOURCEMAP_REGEX.exec(\n lastComment,\n ) as any;\n const inputMapContent = fs.readFileSync(\n path.resolve(path.dirname(options.filename), match[1]),\n );\n if (inputMapContent.length > LARGE_INPUT_SOURCEMAP_THRESHOLD) {\n debug(\"skip merging input map > 1 MB\");\n } else {\n inputMap = convertSourceMap.fromJSON(\n // todo:\n inputMapContent as unknown as string,\n );\n }\n } catch (err) {\n debug(\"discarding unknown file input sourcemap\", err);\n }\n } else if (lastComment) {\n debug(\"discarding un-loadable file input sourcemap\");\n }\n }\n }\n\n return new File(options, {\n code,\n ast: ast as t.File,\n inputMap,\n });\n}\n\n// These regexps are copied from the convert-source-map package,\n// but without // or /* at the beginning of the comment.\n\n// eslint-disable-next-line max-len\nconst INLINE_SOURCEMAP_REGEX =\n /^[@#]\\s+sourceMappingURL=data:(?:application|text)\\/json;(?:charset[:=]\\S+?;)?base64,(?:.*)$/;\nconst EXTERNAL_SOURCEMAP_REGEX =\n /^[@#][ \\t]+sourceMappingURL=([^\\s'\"`]+)[ \\t]*$/;\n\nfunction extractCommentsFromList(\n regex: RegExp,\n comments: t.Comment[],\n lastComment: string | null,\n): [t.Comment[], string | null] {\n if (comments) {\n comments = comments.filter(({ value }) => {\n if (regex.test(value)) {\n lastComment = value;\n return false;\n }\n return true;\n });\n }\n return [comments, lastComment];\n}\n\nfunction extractComments(regex: RegExp, ast: t.Node) {\n let lastComment: string = null;\n traverseFast(ast, node => {\n [node.leadingComments, lastComment] = extractCommentsFromList(\n regex,\n node.leadingComments,\n lastComment,\n );\n [node.innerComments, lastComment] = extractCommentsFromList(\n regex,\n node.innerComments,\n lastComment,\n );\n [node.trailingComments, lastComment] = extractCommentsFromList(\n regex,\n node.trailingComments,\n lastComment,\n );\n });\n return lastComment;\n}\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;;AACA;;AACA;;;EAPSA,I;EAAMC;;;AASf,MAAMC,KAAK,GAAGC,QAAA,CAAW,sBAAX,CAAd;;AACA,MAAMC,+BAA+B,GAAG,OAAxC;;AAQe,UAAUC,aAAV,CACbC,YADa,EAEbC,OAFa,EAGbC,IAHa,EAIbC,GAJa,EAKE;EACfD,IAAI,GAAI,GAAEA,IAAI,IAAI,EAAG,EAArB;;EAEA,IAAIC,GAAJ,EAAS;IACP,IAAIA,GAAG,CAACC,IAAJ,KAAa,SAAjB,EAA4B;MAC1BD,GAAG,GAAGT,IAAI,CAACS,GAAD,EAAM,EAAN,EAAU,EAAV,CAAV;IACD,CAFD,MAEO,IAAIA,GAAG,CAACC,IAAJ,KA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AI,CAACE,aAAN,EAAqB1B,WAArB,IAAoCkB,uBAAuB,CACzDC,KADyD,EAEzDK,IAAI,CAACE,aAFoD,EAGzD1B,WAHyD,CAA3D;IAKA,CAACwB,IAAI,CAACG,gBAAN,EAAwB3B,WAAxB,IAAuCkB,uBAAuB,CAC5DC,KAD4D,EAE5DK,IAAI,CAACG,gBAFuD,EAG5D3B,WAH4D,CAA9D;EAKD,CAhBW,CAAZ;EAiBA,OAAOA,WAAP;AACD"} \ No newline at end of file +{"version":3,"names":["file","traverseFast","debug","buildDebug","LARGE_INPUT_SOURCEMAP_THRESHOLD","INLINE_SOURCEMAP_REGEX","EXTERNAL_SOURCEMAP_REGEX","normalizeFile","pluginPasses","options","code","ast","type","Error","cloneInputAst","cloneDeep","parser","inputMap","inputSourceMap","convertSourceMap","fromObject","lastComment","extractComments","fromComment","err","filename","match","exec","inputMapContent","fs","readFileSync","path","resolve","dirname","length","fromJSON","File","extractCommentsFromList","regex","comments","filter","value","test","node","leadingComments","innerComments","trailingComments"],"sources":["../../src/transformation/normalize-file.ts"],"sourcesContent":["import fs from \"fs\";\nimport path from \"path\";\nimport buildDebug from \"debug\";\nimport type { Handler } from \"gensync\";\nimport { file, traverseFast } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type { PluginPasses } from \"../config\";\nimport convertSourceMap from \"convert-source-map\";\nimport type { SourceMapConverter as Converter } from \"convert-source-map\";\nimport File from \"./file/file\";\nimport parser from \"../parser\";\nimport cloneDeep from \"./util/clone-deep\";\n\nconst debug = buildDebug(\"babel:transform:file\");\nconst LARGE_INPUT_SOURCEMAP_THRESHOLD = 3_000_000;\n\n// These regexps are copied from the convert-source-map package,\n// but without // or /* at the beginning of the comment.\n\n// eslint-disable-next-line max-len\nconst INLINE_SOURCEMAP_REGEX =\n /^[@#]\\s+sourceMappingURL=data:(?:application|text)\\/json;(?:charset[:=]\\S+?;)?base64,(?:.*)$/;\nconst EXTERNAL_SOURCEMAP_REGEX =\n /^[@#][ \\t]+sourceMappingURL=([^\\s'\"`]+)[ \\t]*$/;\n\nexport type NormalizedFile = {\n code: string;\n ast: t.File;\n inputMap: Converter | null;\n};\n\nexport default function* normalizeFile(\n pluginPasses: PluginPasses,\n options: { [key: string]: any },\n code: string,\n ast?: t.File | t.Program | null,\n): Handler {\n code = `${code || \"\"}`;\n\n if (ast) {\n if (ast.type === \"Program\") {\n ast = file(ast, [], []);\n } else if (ast.type !== \"File\") {\n throw new Error(\"AST root must be a Program or File node\");\n }\n\n if (options.cloneInputAst) {\n ast = cloneDeep(ast) as t.File;\n }\n } else {\n // @ts-expect-error todo: use babel-types ast typings in Babel parser\n ast = yield* parser(pluginPasses, options, code);\n }\n\n let inputMap = null;\n if (options.inputSourceMap !== false) {\n // If an explicit object is passed in, it overrides the processing of\n // source maps that may be in the file itself.\n if (typeof options.inputSourceMap === \"object\") {\n inputMap = convertSourceMap.fromObject(options.inputSourceMap);\n }\n\n if (!inputMap) {\n const lastComment = extractComments(INLINE_SOURCEMAP_REGEX, ast);\n if (lastComment) {\n try {\n inputMap = convertSourceMap.fromComment(lastComment);\n } catch (err) {\n debug(\"discarding unknown inline input sourcemap\", err);\n }\n }\n }\n\n if (!inputMap) {\n const lastComment = extractComments(EXTERNAL_SOURCEMAP_REGEX, ast);\n if (typeof options.filename === \"string\" && lastComment) {\n try {\n // when `lastComment` is non-null, EXTERNAL_SOURCEMAP_REGEX must have matches\n const match: [string, string] = EXTERNAL_SOURCEMAP_REGEX.exec(\n lastComment,\n ) as any;\n const inputMapContent = fs.readFileSync(\n path.resolve(path.dirname(options.filename), match[1]),\n );\n if (inputMapContent.length > LARGE_INPUT_SOURCEMAP_THRESHOLD) {\n debug(\"skip merging input map > 1 MB\");\n } else {\n inputMap = convertSourceMap.fromJSON(\n // todo:\n inputMapContent as unknown as string,\n );\n }\n } catch (err) {\n debug(\"discarding unknown file input sourcemap\", err);\n }\n } else if (lastComment) {\n debug(\"discarding un-loadable file input sourcemap\");\n }\n }\n }\n\n return new File(options, {\n code,\n ast: ast as t.File,\n inputMap,\n });\n}\n\nfunction extractCommentsFromList(\n regex: RegExp,\n comments: t.Comment[],\n lastComment: string | null,\n): [t.Comment[], string | null] {\n if (comments) {\n comments = comments.filter(({ value }) => {\n if (regex.test(value)) {\n lastComment = value;\n return false;\n }\n return true;\n });\n }\n return [comments, lastComment];\n}\n\nfunction extractComments(regex: RegExp, ast: t.Node) {\n let lastComment: string = null;\n traverseFast(ast, node => {\n [node.leadingComments, lastComment] = extractCommentsFromList(\n regex,\n node.leadingComments,\n lastComment,\n );\n [node.innerComments, lastComment] = extractCommentsFromList(\n regex,\n node.innerComments,\n lastComment,\n );\n [node.trailingComments, lastComment] = extractCommentsFromList(\n regex,\n node.trailingComments,\n lastComment,\n );\n });\n return lastComment;\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACA;AACA;AAA0C;EAPjCA,IAAI;EAAEC;AAAY;AAS3B,MAAMC,KAAK,GAAGC,QAAU,CAAC,sBAAsB,CAAC;AAChD,MAAMC,+BAA+B,GAAG,OAAS;;AAMjD,MAAMC,sBAAsB,GAC1B,8FAA8F;AAChG,MAAMC,wBAAwB,GAC5B,gDAAgD;AAQnC,UAAUC,aAAa,CACpCC,YAA0B,EAC1BC,OAA+B,EAC/BC,IAAY,EACZC,GAA+B,EAChB;EACfD,IAAI,GAAI,GAAEA,IAAI,IAAI,EAAG,EAAC;EAEtB,IAAIC,GAAG,EAAE;IACP,IAAIA,GAAG,CAACC,IAAI,KAAK,SAAS,EAAE;MAC1BD,GAAG,GAAGX,IAAI,CAACW,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC;IACzB,CAAC,MAAM,IAAIA,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AI,CAACG,gBAAgB,EAAEzB,WAAW,CAAC,GAAGgB,uBAAuB,CAC5DC,KAAK,EACLK,IAAI,CAACG,gBAAgB,EACrBzB,WAAW,CACZ;EACH,CAAC,CAAC;EACF,OAAOA,WAAW;AACpB;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/normalize-opts.js b/node_modules/@babel/core/lib/transformation/normalize-opts.js index 1f0656e8c..20826fc20 100644 --- a/node_modules/@babel/core/lib/transformation/normalize-opts.js +++ b/node_modules/@babel/core/lib/transformation/normalize-opts.js @@ -4,17 +4,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = normalizeOptions; - function _path() { const data = require("path"); - _path = function () { return data; }; - return data; } - function normalizeOptions(config) { const { filename, @@ -49,7 +45,6 @@ function normalizeOptions(config) { sourceFileName }, opts.generatorOpts) }); - for (const plugins of config.passes) { for (const plugin of plugins) { if (plugin.manipulateOptions) { @@ -57,10 +52,8 @@ function normalizeOptions(config) { } } } - return options; } - 0 && 0; //# sourceMappingURL=normalize-opts.js.map diff --git a/node_modules/@babel/core/lib/transformation/normalize-opts.js.map b/node_modules/@babel/core/lib/transformation/normalize-opts.js.map index f679f938c..7ff0d99ca 100644 --- a/node_modules/@babel/core/lib/transformation/normalize-opts.js.map +++ b/node_modules/@babel/core/lib/transformation/normalize-opts.js.map @@ -1 +1 @@ -{"version":3,"names":["normalizeOptions","config","filename","cwd","filenameRelative","path","relative","sourceType","inputSourceMap","sourceMaps","sourceRoot","options","moduleRoot","sourceFileName","basename","comments","compact","opts","parserOpts","extname","plugins","generatorOpts","auxiliaryCommentBefore","auxiliaryCommentAfter","retainLines","shouldPrintComment","minified","passes","plugin","manipulateOptions"],"sources":["../../src/transformation/normalize-opts.ts"],"sourcesContent":["import path from \"path\";\nimport type { ResolvedConfig } from \"../config\";\n\nexport default function normalizeOptions(config: ResolvedConfig): {} {\n const {\n filename,\n cwd,\n filenameRelative = typeof filename === \"string\"\n ? path.relative(cwd, filename)\n : \"unknown\",\n sourceType = \"module\",\n inputSourceMap,\n sourceMaps = !!inputSourceMap,\n sourceRoot = process.env.BABEL_8_BREAKING\n ? undefined\n : config.options.moduleRoot,\n\n sourceFileName = path.basename(filenameRelative),\n\n comments = true,\n compact = \"auto\",\n } = config.options;\n\n const opts = config.options;\n\n const options = {\n ...opts,\n\n parserOpts: {\n sourceType:\n path.extname(filenameRelative) === \".mjs\" ? \"module\" : sourceType,\n\n sourceFileName: filename,\n plugins: [],\n ...opts.parserOpts,\n },\n\n generatorOpts: {\n // General generator flags.\n filename,\n\n auxiliaryCommentBefore: opts.auxiliaryCommentBefore,\n auxiliaryCommentAfter: opts.auxiliaryCommentAfter,\n retainLines: opts.retainLines,\n comments,\n shouldPrintComment: opts.shouldPrintComment,\n compact,\n minified: opts.minified,\n\n // Source-map generation flags.\n sourceMaps,\n\n sourceRoot,\n sourceFileName,\n ...opts.generatorOpts,\n },\n };\n\n for (const plugins of config.passes) {\n for (const plugin of plugins) {\n if (plugin.manipulateOptions) {\n plugin.manipulateOptions(options, options.parserOpts);\n }\n }\n }\n\n return options;\n}\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGe,SAASA,gBAAT,CAA0BC,MAA1B,EAAsD;EACnE,MAAM;IACJC,QADI;IAEJC,GAFI;IAGJC,gBAAgB,GAAG,OAAOF,QAAP,KAAoB,QAApB,GACfG,OAAA,CAAKC,QAAL,CAAcH,GAAd,EAAmBD,QAAnB,CADe,GAEf,SALA;IAMJK,UAAU,GAAG,QANT;IAOJC,cAPI;IAQJC,UAAU,GAAG,CAAC,CAACD,cARX;IASJE,UAAU,GAENT,MAAM,CAACU,OAAP,CAAeC,UAXf;IAaJC,cAAc,GAAGR,OAAA,CAAKS,QAAL,CAAcV,gBAAd,CAbb;IAeJW,QAAQ,GAAG,IAfP;IAgBJC,OAAO,GAAG;EAhBN,IAiBFf,MAAM,CAACU,OAjBX;EAmBA,MAAMM,IAAI,GAAGhB,MAAM,CAACU,OAApB;EAEA,MAAMA,OAAO,qBACRM,IADQ;IAGXC,UAAU;MACRX,UAAU,EACRF,OAAA,CAAKc,OAAL,CAAaf,gBAAb,MAAmC,MAAnC,GAA4C,QAA5C,GAAuDG,UAFjD;MAIRM,cAAc,EAAEX,QAJR;MAKRkB,OAAO,EAAE;IALD,GAMLH,IAAI,CAACC,UANA,CAHC;IAYXG,aAAa;MAEXnB,QAFW;MAIXoB,sBAAsB,EAAEL,IAAI,CAACK,sBAJlB;MAKXC,qBAAqB,EAAEN,IAAI,CAACM,qBALjB;MAMXC,WAAW,EAAEP,IAAI,CAACO,WANP;MAOXT,QAPW;MAQXU,kBAAkB,EAAER,IAAI,CAACQ,kBARd;MASXT,OATW;MAUXU,QAAQ,EAAET,IAAI,CAACS,QAVJ;MAaXjB,UAbW;MAeXC,UAfW;MAgBXG;IAhBW,GAiBRI,IAAI,CAACI,aAjBG;EAZF,EAAb;;EAiCA,KAAK,MAAMD,OAAX,IAAsBnB,MAAM,CAAC0B,MAA7B,EAAqC;IACnC,KAAK,MAAMC,MAAX,IAAqBR,OAArB,EAA8B;MAC5B,IAAIQ,MAAM,CAACC,iBAAX,EAA8B;QAC5BD,MAAM,CAACC,iBAAP,CAAyBlB,OAAzB,EAAkCA,OAAO,CAACO,UAA1C;MACD;IACF;EACF;;EAED,OAAOP,OAAP;AACD"} \ No newline at end of file +{"version":3,"names":["normalizeOptions","config","filename","cwd","filenameRelative","path","relative","sourceType","inputSourceMap","sourceMaps","sourceRoot","options","moduleRoot","sourceFileName","basename","comments","compact","opts","parserOpts","extname","plugins","generatorOpts","auxiliaryCommentBefore","auxiliaryCommentAfter","retainLines","shouldPrintComment","minified","passes","plugin","manipulateOptions"],"sources":["../../src/transformation/normalize-opts.ts"],"sourcesContent":["import path from \"path\";\nimport type { ResolvedConfig } from \"../config\";\n\nexport default function normalizeOptions(config: ResolvedConfig): {} {\n const {\n filename,\n cwd,\n filenameRelative = typeof filename === \"string\"\n ? path.relative(cwd, filename)\n : \"unknown\",\n sourceType = \"module\",\n inputSourceMap,\n sourceMaps = !!inputSourceMap,\n sourceRoot = process.env.BABEL_8_BREAKING\n ? undefined\n : config.options.moduleRoot,\n\n sourceFileName = path.basename(filenameRelative),\n\n comments = true,\n compact = \"auto\",\n } = config.options;\n\n const opts = config.options;\n\n const options = {\n ...opts,\n\n parserOpts: {\n sourceType:\n path.extname(filenameRelative) === \".mjs\" ? \"module\" : sourceType,\n\n sourceFileName: filename,\n plugins: [],\n ...opts.parserOpts,\n },\n\n generatorOpts: {\n // General generator flags.\n filename,\n\n auxiliaryCommentBefore: opts.auxiliaryCommentBefore,\n auxiliaryCommentAfter: opts.auxiliaryCommentAfter,\n retainLines: opts.retainLines,\n comments,\n shouldPrintComment: opts.shouldPrintComment,\n compact,\n minified: opts.minified,\n\n // Source-map generation flags.\n sourceMaps,\n\n sourceRoot,\n sourceFileName,\n ...opts.generatorOpts,\n },\n };\n\n for (const plugins of config.passes) {\n for (const plugin of plugins) {\n if (plugin.manipulateOptions) {\n plugin.manipulateOptions(options, options.parserOpts);\n }\n }\n }\n\n return options;\n}\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGe,SAASA,gBAAgB,CAACC,MAAsB,EAAM;EACnE,MAAM;IACJC,QAAQ;IACRC,GAAG;IACHC,gBAAgB,GAAG,OAAOF,QAAQ,KAAK,QAAQ,GAC3CG,OAAI,CAACC,QAAQ,CAACH,GAAG,EAAED,QAAQ,CAAC,GAC5B,SAAS;IACbK,UAAU,GAAG,QAAQ;IACrBC,cAAc;IACdC,UAAU,GAAG,CAAC,CAACD,cAAc;IAC7BE,UAAU,GAENT,MAAM,CAACU,OAAO,CAACC,UAAU;IAE7BC,cAAc,GAAGR,OAAI,CAACS,QAAQ,CAACV,gBAAgB,CAAC;IAEhDW,QAAQ,GAAG,IAAI;IACfC,OAAO,GAAG;EACZ,CAAC,GAAGf,MAAM,CAACU,OAAO;EAElB,MAAMM,IAAI,GAAGhB,MAAM,CAACU,OAAO;EAE3B,MAAMA,OAAO,qBACRM,IAAI;IAEPC,UAAU;MACRX,UAAU,EACRF,OAAI,CAACc,OAAO,CAACf,gBAAgB,CAAC,KAAK,MAAM,GAAG,QAAQ,GAAGG,UAAU;MAEnEM,cAAc,EAAEX,QAAQ;MACxBkB,OAAO,EAAE;IAAE,GACRH,IAAI,CAACC,UAAU,CACnB;IAEDG,aAAa;MAEXnB,QAAQ;MAERoB,sBAAsB,EAAEL,IAAI,CAACK,sBAAsB;MACnDC,qBAAqB,EAAEN,IAAI,CAACM,qBAAqB;MACjDC,WAAW,EAAEP,IAAI,CAACO,WAAW;MAC7BT,QAAQ;MACRU,kBAAkB,EAAER,IAAI,CAACQ,kBAAkB;MAC3CT,OAAO;MACPU,QAAQ,EAAET,IAAI,CAACS,QAAQ;MAGvBjB,UAAU;MAEVC,UAAU;MACVG;IAAc,GACXI,IAAI,CAACI,aAAa;EACtB,EACF;EAED,KAAK,MAAMD,OAAO,IAAInB,MAAM,CAAC0B,MAAM,EAAE;IACnC,KAAK,MAAMC,MAAM,IAAIR,OAAO,EAAE;MAC5B,IAAIQ,MAAM,CAACC,iBAAiB,EAAE;QAC5BD,MAAM,CAACC,iBAAiB,CAAClB,OAAO,EAAEA,OAAO,CAACO,UAAU,CAAC;MACvD;IACF;EACF;EAEA,OAAOP,OAAO;AAChB;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/plugin-pass.js b/node_modules/@babel/core/lib/transformation/plugin-pass.js index c49cfe617..90b3e847f 100644 --- a/node_modules/@babel/core/lib/transformation/plugin-pass.js +++ b/node_modules/@babel/core/lib/transformation/plugin-pass.js @@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; - class PluginPass { + constructor(file, key, options) { this._map = new Map(); this.key = void 0; @@ -19,33 +19,25 @@ class PluginPass { this.cwd = file.opts.cwd; this.filename = file.opts.filename; } - set(key, val) { this._map.set(key, val); } - get(key) { return this._map.get(key); } - availableHelper(name, versionRange) { return this.file.availableHelper(name, versionRange); } - addHelper(name) { return this.file.addHelper(name); } - addImport() { return this.file.addImport(); } - buildCodeFrameError(node, msg, _Error) { return this.file.buildCodeFrameError(node, msg, _Error); } - } - exports.default = PluginPass; { PluginPass.prototype.getModuleName = function getModuleName() { diff --git a/node_modules/@babel/core/lib/transformation/plugin-pass.js.map b/node_modules/@babel/core/lib/transformation/plugin-pass.js.map index ecb970fb2..b31b8c77e 100644 --- a/node_modules/@babel/core/lib/transformation/plugin-pass.js.map +++ b/node_modules/@babel/core/lib/transformation/plugin-pass.js.map @@ -1 +1 @@ -{"version":3,"names":["PluginPass","constructor","file","key","options","_map","Map","opts","cwd","filename","set","val","get","availableHelper","name","versionRange","addHelper","addImport","buildCodeFrameError","node","msg","_Error","prototype","getModuleName"],"sources":["../../src/transformation/plugin-pass.ts"],"sourcesContent":["import type File from \"./file/file\";\nimport type { NodeLocation } from \"./file/file\";\n\nexport default class PluginPass {\n _map: Map = new Map();\n key: string | undefined | null;\n file: File;\n opts: any;\n\n // The working directory that Babel's programmatic options are loaded\n // relative to.\n cwd: string;\n\n // The absolute path of the file being compiled.\n filename: string | void;\n\n constructor(file: File, key?: string | null, options?: any | null) {\n this.key = key;\n this.file = file;\n this.opts = options || {};\n this.cwd = file.opts.cwd;\n this.filename = file.opts.filename;\n }\n\n set(key: unknown, val: unknown) {\n this._map.set(key, val);\n }\n\n get(key: unknown): any {\n return this._map.get(key);\n }\n\n availableHelper(name: string, versionRange?: string | null) {\n return this.file.availableHelper(name, versionRange);\n }\n\n addHelper(name: string) {\n return this.file.addHelper(name);\n }\n\n addImport() {\n return this.file.addImport();\n }\n\n buildCodeFrameError(\n node: NodeLocation | undefined | null,\n msg: string,\n _Error?: typeof Error,\n ) {\n return this.file.buildCodeFrameError(node, msg, _Error);\n }\n}\n\nif (!process.env.BABEL_8_BREAKING) {\n (PluginPass as any).prototype.getModuleName = function getModuleName():\n | string\n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oBsB,SAApB,CAA8BC,aAA9B,GAA8C,SAASA,aAAT,GAEhC;IACZ,OAAO,KAAKrB,IAAL,CAAUqB,aAAV,EAAP;EACD,CAJD;AAKD"} \ No newline at end of file +{"version":3,"names":["PluginPass","constructor","file","key","options","_map","Map","opts","cwd","filename","set","val","get","availableHelper","name","versionRange","addHelper","addImport","buildCodeFrameError","node","msg","_Error","prototype","getModuleName"],"sources":["../../src/transformation/plugin-pass.ts"],"sourcesContent":["import type File from \"./file/file\";\nimport type { NodeLocation } from \"./file/file\";\n\nexport default class PluginPass {\n _map: Map = new Map();\n key: string | undefined | null;\n file: File;\n opts: any;\n\n // The working directory that Babel's programmatic options are loaded\n // relative to.\n cwd: string;\n\n // The absolute path of the file being compiled.\n filename: string | void;\n\n constructor(file: File, key?: string | null, options?: any | null) {\n this.key = key;\n this.file = file;\n this.opts = options || {};\n this.cwd = file.opts.cwd;\n this.filename = file.opts.filename;\n }\n\n set(key: unknown, val: unknown) {\n this._map.set(key, val);\n }\n\n get(key: unknown): any {\n return this._map.get(key);\n }\n\n availableHelper(name: string, versionRange?: string | null) {\n return this.file.availableHelper(name, versionRange);\n }\n\n addHelper(name: string) {\n return this.file.addHelper(name);\n }\n\n addImport() {\n return this.file.addImport();\n }\n\n buildCodeFrameError(\n node: NodeLocation | undefined | null,\n msg: string,\n _Error?: typeof Error,\n ) {\n return this.file.buildCodeFrameError(node, msg, _Error);\n }\n}\n\nif (!process.env.BABEL_8_BREAKING) {\n (PluginPass as any).prototype.getModuleName = function getModuleName():\n | string\n | undefined {\n return this.file.getModuleName();\n };\n}\n"],"mappings":";;;;;;AAGe,MAAMA,UAAU,CAAC;;EAa9BC,WAAW,CAACC,IAAU,EAAEC,GAAmB,EAAEC,OAAoB,EAAE;IAAA,KAZnEC,IAAI,GAA0B,IAAIC,GAAG,EAAE;IAAA,KACvCH,GAAG;IAAA,KACHD,IAAI;IAAA,KACJK,IAAI;IAAA,KAIJC,GAAG;IAAA,KAGHC,QAAQ;IAGN,IAAI,CAACN,GAAG,GAAGA,GAAG;IACd,IAAI,CAACD,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACK,IAAI,GAAGH,OAAO,IAAI,CAAC,CAAC;IACzB,IAAI,CAACI,GAAG,GAAGN,IAAI,CAACK,IAAI,CAACC,GAAG;IACxB,IAAI,CAACC,QAAQ,GAAGP,IAAI,CAACK,IAAI,CAACE,QAAQ;EACpC;EAEAC,GAAG,CAACP,GAAY,EAAEQ,GAAY,EAAE;IAC9B,IAAI,CAACN,IAAI,CAACK,GAAG,CAACP,GAAG,EAAEQ,GAAG,CAAC;EACzB;EAEAC,GAAG,CAACT,GAAY,EAAO;IACrB,OAAO,IAAI,CAACE,IAAI,CAACO,GAAG,CAACT,GAAG,CAAC;EAC3B;EAEAU,eAAe,CAACC,IAAY,EAAEC,YAA4B,EAAE;IAC1D,OAAO,IAAI,CAACb,IAAI,CAACW,eAAe,CAACC,IAAI,EAAEC,YAAY,CAAC;EACtD;EAEAC,SAAS,CAACF,IAAY,EAAE;IACtB,OAAO,IAAI,CAACZ,IAAI,CAACc,SAAS,CAACF,IAAI,CAAC;EAClC;EAEAG,SAAS,GAAG;IACV,OAAO,IAAI,CAACf,IAAI,CAACe,SAAS,EAAE;EAC9B;EAEAC,mBAAmB,CACjBC,IAAqC,EACrCC,GAAW,EACXC,MAAqB,EACrB;IACA,OAAO,IAAI,CAACnB,IAAI,CAACgB,mBAAmB,CAACC,IAAI,EAAEC,GAAG,EAAEC,MAAM,CAAC;EACzD;AACF;AAAC;AAEkC;EAChCrB,UAAU,CAASsB,SAAS,CAACC,aAAa,GAAG,SAASA,aAAa,GAEtD;IACZ,OAAO,IAAI,CAACrB,IAAI,CAACqB,aAAa,EAAE;EAClC,CAAC;AACH;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/transformation/util/clone-deep.js b/node_modules/@babel/core/lib/transformation/util/clone-deep.js index bce456c9e..94d0101b2 100644 --- a/node_modules/@babel/core/lib/transformation/util/clone-deep.js +++ b/node_modules/@babel/core/lib/transformation/util/clone-deep.js @@ -4,40 +4,32 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = _default; - function deepClone(value, cache) { if (value !== null) { if (cache.has(value)) return cache.get(value); let cloned; - if (Array.isArray(value)) { cloned = new Array(value.length); - for (let i = 0; i < value.length; i++) { cloned[i] = typeof value[i] !== "object" ? value[i] : deepClone(value[i], cache); } } else { cloned = {}; const keys = Object.keys(value); - for (let i = 0; i < keys.length; i++) { const key = keys[i]; cloned[key] = typeof value[key] !== "object" ? value[key] : deepClone(value[key], cache); } } - cache.set(value, cloned); return cloned; } - return value; } - function _default(value) { if (typeof value !== "object") return value; return deepClone(value, new Map()); } - 0 && 0; //# sourceMappingURL=clone-deep.js.map diff --git a/node_modules/@babel/core/lib/transformation/util/clone-deep.js.map b/node_modules/@babel/core/lib/transformation/util/clone-deep.js.map index 167507600..8eda50867 100644 --- a/node_modules/@babel/core/lib/transformation/util/clone-deep.js.map +++ b/node_modules/@babel/core/lib/transformation/util/clone-deep.js.map @@ -1 +1 @@ -{"version":3,"names":["deepClone","value","cache","has","get","cloned","Array","isArray","length","i","keys","Object","key","set","Map"],"sources":["../../../src/transformation/util/clone-deep.ts"],"sourcesContent":["//https://github.com/babel/babel/pull/14583#discussion_r882828856\nfunction deepClone(value: any, cache: Map): any {\n if (value !== null) {\n if (cache.has(value)) return cache.get(value);\n let cloned: any;\n if (Array.isArray(value)) {\n cloned = new Array(value.length);\n for (let i = 0; i < value.length; i++) {\n cloned[i] =\n typeof value[i] !== \"object\" ? value[i] : deepClone(value[i], cache);\n }\n } else {\n cloned = {};\n const keys = Object.keys(value);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n cloned[key] =\n typeof value[key] !== \"object\"\n ? value[key]\n : deepClone(value[key], cache);\n }\n }\n cache.set(value, cloned);\n return cloned;\n }\n return value;\n}\n\nexport default function (value: T): T {\n if (typeof value !== \"object\") return value;\n return deepClone(value, new Map());\n}\n"],"mappings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IAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B,OAAOA,KAAP;EAC/B,OAAOD,SAAS,CAACC,KAAD,EAAQ,IAAIa,GAAJ,EAAR,CAAhB;AACD"} \ No newline at end of file +{"version":3,"names":["deepClone","value","cache","has","get","cloned","Array","isArray","length","i","keys","Object","key","set","Map"],"sources":["../../../src/transformation/util/clone-deep.ts"],"sourcesContent":["//https://github.com/babel/babel/pull/14583#discussion_r882828856\nfunction deepClone(value: any, cache: Map): any {\n if (value !== null) {\n if (cache.has(value)) return cache.get(value);\n let cloned: any;\n if (Array.isArray(value)) {\n cloned = new Array(value.length);\n for (let i = 0; i < value.length; i++) {\n cloned[i] =\n typeof value[i] !== \"object\" ? value[i] : deepClone(value[i], cache);\n }\n } else {\n cloned = {};\n const keys = Object.keys(value);\n for (let i = 0; i < keys.length; i++) {\n const key = keys[i];\n cloned[key] =\n typeof value[key] !== \"object\"\n ? value[key]\n : deepClone(value[key], cache);\n }\n }\n cache.set(value, cloned);\n return cloned;\n }\n return value;\n}\n\nexport default function (value: T): T {\n if (typeof value !== \"object\") return value;\n return deepClone(value, new Map());\n}\n"],"mappings":";;;;;;AACA,SAASA,SAAS,CAACC,KAAU,EAAEC,KAAoB,EAAO;EACxD,IAAID,KAAK,KAAK,IAAI,EAAE;IAClB,IAAIC,KAAK,CAACC,GAAG,CAACF,KAAK,CAAC,EAAE,OAAOC,KAAK,CAACE,GAAG,CAACH,KAAK,CAAC;IAC7C,IAAII,MAAW;IACf,IAAIC,KAAK,CAACC,OAAO,CAACN,KAAK,CAAC,EAAE;MACxBI,MAAM,GAAG,IAAIC,KAAK,CAACL,KAAK,CAACO,MAAM,CAAC;MAChC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGR,KAAK,CAACO,MAAM,EAAEC,CAAC,EAAE,EAAE;QACrCJ,MAAM,CAACI,CAAC,CAAC,GACP,OAAOR,KAAK,CAACQ,CAAC,CAAC,KAAK,QAAQ,GAAGR,KAAK,CAACQ,CAAC,CAAC,GAAGT,SAAS,CAACC,KAAK,CAACQ,CAAC,CAAC,EAAEP,KAAK,CAAC;MACxE;IACF,CAAC,MAAM;MACLG,MAAM,GAAG,CAAC,CAAC;MACX,MAAMK,IAAI,GAAGC,MAAM,CAACD,IAAI,CAACT,KAAK,CAAC;MAC/B,KAAK,IAAIQ,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGC,IAAI,CAACF,MAAM,EAAEC,CAAC,EAAE,EAAE;QACpC,MAAMG,GAAG,GAAGF,IAAI,CAACD,CAAC,CAAC;QACnBJ,MAAM,CAACO,GAAG,CAAC,GACT,OAAOX,KAAK,CAACW,GAAG,CAAC,KAAK,QAAQ,GAC1BX,KAAK,CAACW,GAAG,CAAC,GACVZ,SAAS,CAACC,KAAK,CAACW,GAAG,CAAC,EAAEV,KAAK,CAAC;MACpC;IACF;IACAA,KAAK,CAACW,GAAG,CAACZ,KAAK,EAAEI,MAAM,CAAC;IACxB,OAAOA,MAAM;EACf;EACA,OAAOJ,KAAK;AACd;AAEe,kBAAaA,KAAQ,EAAK;EACvC,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE,OAAOA,KAAK;EAC3C,OAAOD,SAAS,CAACC,KAAK,EAAE,IAAIa,GAAG,EAAE,CAAC;AACpC;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/core/lib/vendor/import-meta-resolve.js b/node_modules/@babel/core/lib/vendor/import-meta-resolve.js index 637019e03..475bdcbe8 100644 --- a/node_modules/@babel/core/lib/vendor/import-meta-resolve.js +++ b/node_modules/@babel/core/lib/vendor/import-meta-resolve.js @@ -5,71 +5,53 @@ Object.defineProperty(exports, "__esModule", { }); exports.moduleResolve = moduleResolve; exports.resolve = resolve; - function _url() { const data = require("url"); - _url = function () { return data; }; - return data; } - function _fs() { const data = _interopRequireWildcard(require("fs"), true); - _fs = function () { return data; }; - return data; } - function _path() { const data = require("path"); - _path = function () { return data; }; - return data; } - function _assert() { const data = require("assert"); - _assert = function () { return data; }; - return data; } - function _util() { const data = require("util"); - _util = function () { return data; }; - return data; } - function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - var re$3 = { exports: {} }; + const SEMVER_SPEC_VERSION = '2.0.0'; const MAX_LENGTH$2 = 256; const MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER || 9007199254740991; + const MAX_SAFE_COMPONENT_LENGTH = 16; var constants = { SEMVER_SPEC_VERSION, @@ -79,18 +61,17 @@ var constants = { }; const debug$1 = typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error('SEMVER', ...args) : () => {}; var debug_1 = debug$1; - (function (module, exports) { const { MAX_SAFE_COMPONENT_LENGTH } = constants; const debug = debug_1; exports = module.exports = {}; + const re = exports.re = []; const src = exports.src = []; const t = exports.t = {}; let R = 0; - const createToken = (name, value, isGlobal) => { const index = R++; debug(name, index, value); @@ -101,75 +82,84 @@ var debug_1 = debug$1; createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*'); createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+'); + createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*'); + createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})\\.` + `(${src[t.NUMERICIDENTIFIER]})`); createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + `(${src[t.NUMERICIDENTIFIERLOOSE]})`); + createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]}|${src[t.NONNUMERICIDENTIFIER]})`); createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]}|${src[t.NONNUMERICIDENTIFIER]})`); + createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`); createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`); + createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+'); + createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]}(?:\\.${src[t.BUILDIDENTIFIER]})*))`); + createToken('FULLPLAIN', `v?${src[t.MAINVERSION]}${src[t.PRERELEASE]}?${src[t.BUILD]}?`); createToken('FULL', `^${src[t.FULLPLAIN]}$`); + createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]}${src[t.PRERELEASELOOSE]}?${src[t.BUILD]}?`); createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`); createToken('GTLT', '((?:<|>)?=?)'); + createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`); createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`); createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + `(?:${src[t.PRERELEASE]})?${src[t.BUILD]}?` + `)?)?`); createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + `(?:${src[t.PRERELEASELOOSE]})?${src[t.BUILD]}?` + `)?)?`); createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`); createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`); + createToken('COERCE', `${'(^|[^\\d])' + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + `(?:$|[^\\d])`); createToken('COERCERTL', src[t.COERCE], true); + createToken('LONETILDE', '(?:~>?)'); createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true); exports.tildeTrimReplace = '$1~'; createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`); createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`); + createToken('LONECARET', '(?:\\^)'); createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true); exports.caretTrimReplace = '$1^'; createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`); createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`); + createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`); createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`); + createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true); exports.comparatorTrimReplace = '$1$2$3'; + createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAIN]})` + `\\s*$`); createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + `\\s+-\\s+` + `(${src[t.XRANGEPLAINLOOSE]})` + `\\s*$`); + createToken('STAR', '(<|>)?=?\\s*\\*'); createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$'); createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$'); })(re$3, re$3.exports); const opts = ['includePrerelease', 'loose', 'rtl']; - const parseOptions$2 = options => !options ? {} : typeof options !== 'object' ? { loose: true } : opts.filter(k => options[k]).reduce((o, k) => { o[k] = true; return o; }, {}); - var parseOptions_1 = parseOptions$2; const numeric = /^[0-9]+$/; - const compareIdentifiers$1 = (a, b) => { const anum = numeric.test(a); const bnum = numeric.test(b); - if (anum && bnum) { a = +a; b = +b; } - return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1; }; - const rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a); - var identifiers = { compareIdentifiers: compareIdentifiers$1, rcompareIdentifiers @@ -187,11 +177,9 @@ const parseOptions$1 = parseOptions_1; const { compareIdentifiers } = identifiers; - class SemVer$c { constructor(version, options) { options = parseOptions$1(options); - if (version instanceof SemVer$c) { if (version.loose === !!options.loose && version.includePrerelease === !!options.includePrerelease) { return version; @@ -201,34 +189,28 @@ class SemVer$c { } else if (typeof version !== 'string') { throw new TypeError(`Invalid Version: ${version}`); } - if (version.length > MAX_LENGTH$1) { throw new TypeError(`version is longer than ${MAX_LENGTH$1} characters`); } - debug('SemVer', version, options); this.options = options; this.loose = !!options.loose; this.includePrerelease = !!options.includePrerelease; const m = version.trim().match(options.loose ? re$2[t$2.LOOSE] : re$2[t$2.FULL]); - if (!m) { throw new TypeError(`Invalid Version: ${version}`); } - this.raw = version; + this.major = +m[1]; this.minor = +m[2]; this.patch = +m[3]; - if (this.major > MAX_SAFE_INTEGER || this.major < 0) { throw new TypeError('Invalid major version'); } - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { throw new TypeError('Invalid minor version'); } - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { throw new TypeError('Invalid patch version'); } @@ -239,60 +221,45 @@ class SemVer$c { this.prerelease = m[4].split('.').map(id => { if (/^[0-9]+$/.test(id)) { const num = +id; - if (num >= 0 && num < MAX_SAFE_INTEGER) { return num; } } - return id; }); } - this.build = m[5] ? m[5].split('.') : []; this.format(); } - format() { this.version = `${this.major}.${this.minor}.${this.patch}`; - if (this.prerelease.length) { this.version += `-${this.prerelease.join('.')}`; } - return this.version; } - toString() { return this.version; } - compare(other) { debug('SemVer.compare', this.version, this.options, other); - if (!(other instanceof SemVer$c)) { if (typeof other === 'string' && other === this.version) { return 0; } - other = new SemVer$c(other, this.options); } - if (other.version === this.version) { return 0; } - return this.compareMain(other) || this.comparePre(other); } - compareMain(other) { if (!(other instanceof SemVer$c)) { other = new SemVer$c(other, this.options); } - return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch); } - comparePre(other) { if (!(other instanceof SemVer$c)) { other = new SemVer$c(other, this.options); @@ -305,14 +272,11 @@ class SemVer$c { } else if (!this.prerelease.length && !other.prerelease.length) { return 0; } - let i = 0; - do { const a = this.prerelease[i]; const b = other.prerelease[i]; debug('prerelease compare', i, a, b); - if (a === undefined && b === undefined) { return 0; } else if (b === undefined) { @@ -326,19 +290,15 @@ class SemVer$c { } } while (++i); } - compareBuild(other) { if (!(other instanceof SemVer$c)) { other = new SemVer$c(other, this.options); } - let i = 0; - do { const a = this.build[i]; const b = other.build[i]; debug('prerelease compare', i, a, b); - if (a === undefined && b === undefined) { return 0; } else if (b === undefined) { @@ -362,73 +322,59 @@ class SemVer$c { this.major++; this.inc('pre', identifier); break; - case 'preminor': this.prerelease.length = 0; this.patch = 0; this.minor++; this.inc('pre', identifier); break; - case 'prepatch': this.prerelease.length = 0; this.inc('patch', identifier); this.inc('pre', identifier); break; - case 'prerelease': if (this.prerelease.length === 0) { this.inc('patch', identifier); } - this.inc('pre', identifier); break; - case 'major': if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) { this.major++; } - this.minor = 0; this.patch = 0; this.prerelease = []; break; - case 'minor': if (this.patch !== 0 || this.prerelease.length === 0) { this.minor++; } - this.patch = 0; this.prerelease = []; break; - case 'patch': if (this.prerelease.length === 0) { this.patch++; } - this.prerelease = []; break; - case 'pre': if (this.prerelease.length === 0) { this.prerelease = [0]; } else { let i = this.prerelease.length; - while (--i >= 0) { if (typeof this.prerelease[i] === 'number') { this.prerelease[i]++; i = -2; } } - if (i === -1) { this.prerelease.push(0); } } - if (identifier) { if (compareIdentifiers(this.prerelease[0], identifier) === 0) { if (isNaN(this.prerelease[1])) { @@ -438,20 +384,15 @@ class SemVer$c { this.prerelease = [identifier, 0]; } } - break; - default: throw new Error(`invalid increment argument: ${release}`); } - this.format(); this.raw = this.version; return this; } - } - var semver$2 = SemVer$c; const { MAX_LENGTH @@ -462,81 +403,61 @@ const { } = re$3.exports; const SemVer$b = semver$2; const parseOptions = parseOptions_1; - const parse$5 = (version, options) => { options = parseOptions(options); - if (version instanceof SemVer$b) { return version; } - if (typeof version !== 'string') { return null; } - if (version.length > MAX_LENGTH) { return null; } - const r = options.loose ? re$1[t$1.LOOSE] : re$1[t$1.FULL]; - if (!r.test(version)) { return null; } - try { return new SemVer$b(version, options); } catch (er) { return null; } }; - var parse_1 = parse$5; const parse$4 = parse_1; - const valid$1 = (version, options) => { const v = parse$4(version, options); return v ? v.version : null; }; - var valid_1 = valid$1; const parse$3 = parse_1; - const clean = (version, options) => { const s = parse$3(version.trim().replace(/^[=v]+/, ''), options); return s ? s.version : null; }; - var clean_1 = clean; const SemVer$a = semver$2; - const inc = (version, release, options, identifier) => { if (typeof options === 'string') { identifier = options; options = undefined; } - try { return new SemVer$a(version instanceof SemVer$a ? version.version : version, options).inc(release, identifier).version; } catch (er) { return null; } }; - var inc_1 = inc; const SemVer$9 = semver$2; - const compare$a = (a, b, loose) => new SemVer$9(a, loose).compare(new SemVer$9(b, loose)); - var compare_1 = compare$a; const compare$9 = compare_1; - const eq$2 = (a, b, loose) => compare$9(a, b, loose) === 0; - var eq_1 = eq$2; const parse$2 = parse_1; const eq$1 = eq_1; - const diff = (version1, version2) => { if (eq$1(version1, version2)) { return null; @@ -546,7 +467,6 @@ const diff = (version1, version2) => { const hasPre = v1.prerelease.length || v2.prerelease.length; const prefix = hasPre ? 'pre' : ''; const defaultResult = hasPre ? 'prerelease' : ''; - for (const key in v1) { if (key === 'major' || key === 'minor' || key === 'patch') { if (v1[key] !== v2[key]) { @@ -554,88 +474,59 @@ const diff = (version1, version2) => { } } } - return defaultResult; } }; var diff_1 = diff; const SemVer$8 = semver$2; - const major = (a, loose) => new SemVer$8(a, loose).major; - var major_1 = major; const SemVer$7 = semver$2; - const minor = (a, loose) => new SemVer$7(a, loose).minor; - var minor_1 = minor; const SemVer$6 = semver$2; - const patch = (a, loose) => new SemVer$6(a, loose).patch; - var patch_1 = patch; const parse$1 = parse_1; - const prerelease = (version, options) => { const parsed = parse$1(version, options); return parsed && parsed.prerelease.length ? parsed.prerelease : null; }; - var prerelease_1 = prerelease; const compare$8 = compare_1; - const rcompare = (a, b, loose) => compare$8(b, a, loose); - var rcompare_1 = rcompare; const compare$7 = compare_1; - const compareLoose = (a, b) => compare$7(a, b, true); - var compareLoose_1 = compareLoose; const SemVer$5 = semver$2; - const compareBuild$2 = (a, b, loose) => { const versionA = new SemVer$5(a, loose); const versionB = new SemVer$5(b, loose); return versionA.compare(versionB) || versionA.compareBuild(versionB); }; - var compareBuild_1 = compareBuild$2; const compareBuild$1 = compareBuild_1; - const sort = (list, loose) => list.sort((a, b) => compareBuild$1(a, b, loose)); - var sort_1 = sort; const compareBuild = compareBuild_1; - const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)); - var rsort_1 = rsort; const compare$6 = compare_1; - const gt$3 = (a, b, loose) => compare$6(a, b, loose) > 0; - var gt_1 = gt$3; const compare$5 = compare_1; - const lt$2 = (a, b, loose) => compare$5(a, b, loose) < 0; - var lt_1 = lt$2; const compare$4 = compare_1; - const neq$1 = (a, b, loose) => compare$4(a, b, loose) !== 0; - var neq_1 = neq$1; const compare$3 = compare_1; - const gte$2 = (a, b, loose) => compare$3(a, b, loose) >= 0; - var gte_1 = gte$2; const compare$2 = compare_1; - const lte$2 = (a, b, loose) => compare$2(a, b, loose) <= 0; - var lte_1 = lte$2; const eq = eq_1; const neq = neq_1; @@ -643,56 +534,42 @@ const gt$2 = gt_1; const gte$1 = gte_1; const lt$1 = lt_1; const lte$1 = lte_1; - const cmp = (a, op, b, loose) => { switch (op) { case '===': if (typeof a === 'object') { a = a.version; } - if (typeof b === 'object') { b = b.version; } - return a === b; - case '!==': if (typeof a === 'object') { a = a.version; } - if (typeof b === 'object') { b = b.version; } - return a !== b; - case '': case '=': case '==': return eq(a, b, loose); - case '!=': return neq(a, b, loose); - case '>': return gt$2(a, b, loose); - case '>=': return gte$1(a, b, loose); - case '<': return lt$1(a, b, loose); - case '<=': return lte$1(a, b, loose); - default: throw new TypeError(`Invalid operator: ${op}`); } }; - var cmp_1 = cmp; const SemVer$4 = semver$2; const parse = parse_1; @@ -700,54 +577,41 @@ const { re, t } = re$3.exports; - const coerce = (version, options) => { if (version instanceof SemVer$4) { return version; } - if (typeof version === 'number') { version = String(version); } - if (typeof version !== 'string') { return null; } - options = options || {}; let match = null; - if (!options.rtl) { match = version.match(re[t.COERCE]); } else { let next; - while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) { if (!match || next.index + next[0].length !== match.index + match[0].length) { match = next; } - re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length; } - re[t.COERCERTL].lastIndex = -1; } - if (match === null) { return null; } - return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options); }; - var coerce_1 = coerce; var iterator; var hasRequiredIterator; - function requireIterator() { if (hasRequiredIterator) return iterator; hasRequiredIterator = 1; - iterator = function (Yallist) { Yallist.prototype[Symbol.iterator] = function* () { for (let walker = this.head; walker; walker = walker.next) { @@ -755,31 +619,24 @@ function requireIterator() { } }; }; - return iterator; } - var yallist; var hasRequiredYallist; - function requireYallist() { if (hasRequiredYallist) return yallist; hasRequiredYallist = 1; yallist = Yallist; Yallist.Node = Node; Yallist.create = Yallist; - function Yallist(list) { var self = this; - if (!(self instanceof Yallist)) { self = new Yallist(); } - self.tail = null; self.head = null; self.length = 0; - if (list && typeof list.forEach === 'function') { list.forEach(function (item) { self.push(item); @@ -789,211 +646,161 @@ function requireYallist() { self.push(arguments[i]); } } - return self; } - Yallist.prototype.removeNode = function (node) { if (node.list !== this) { throw new Error('removing node which does not belong to this list'); } - var next = node.next; var prev = node.prev; - if (next) { next.prev = prev; } - if (prev) { prev.next = next; } - if (node === this.head) { this.head = next; } - if (node === this.tail) { this.tail = prev; } - node.list.length--; node.next = null; node.prev = null; node.list = null; return next; }; - Yallist.prototype.unshiftNode = function (node) { if (node === this.head) { return; } - if (node.list) { node.list.removeNode(node); } - var head = this.head; node.list = this; node.next = head; - if (head) { head.prev = node; } - this.head = node; - if (!this.tail) { this.tail = node; } - this.length++; }; - Yallist.prototype.pushNode = function (node) { if (node === this.tail) { return; } - if (node.list) { node.list.removeNode(node); } - var tail = this.tail; node.list = this; node.prev = tail; - if (tail) { tail.next = node; } - this.tail = node; - if (!this.head) { this.head = node; } - this.length++; }; - Yallist.prototype.push = function () { for (var i = 0, l = arguments.length; i < l; i++) { push(this, arguments[i]); } - return this.length; }; - Yallist.prototype.unshift = function () { for (var i = 0, l = arguments.length; i < l; i++) { unshift(this, arguments[i]); } - return this.length; }; - Yallist.prototype.pop = function () { if (!this.tail) { return undefined; } - var res = this.tail.value; this.tail = this.tail.prev; - if (this.tail) { this.tail.next = null; } else { this.head = null; } - this.length--; return res; }; - Yallist.prototype.shift = function () { if (!this.head) { return undefined; } - var res = this.head.value; this.head = this.head.next; - if (this.head) { this.head.prev = null; } else { this.tail = null; } - this.length--; return res; }; - Yallist.prototype.forEach = function (fn, thisp) { thisp = thisp || this; - for (var walker = this.head, i = 0; walker !== null; i++) { fn.call(thisp, walker.value, i, this); walker = walker.next; } }; - Yallist.prototype.forEachReverse = function (fn, thisp) { thisp = thisp || this; - for (var walker = this.tail, i = this.length - 1; walker !== null; i--) { fn.call(thisp, walker.value, i, this); walker = walker.prev; } }; - Yallist.prototype.get = function (n) { for (var i = 0, walker = this.head; walker !== null && i < n; i++) { walker = walker.next; } - if (i === n && walker !== null) { return walker.value; } }; - Yallist.prototype.getReverse = function (n) { for (var i = 0, walker = this.tail; walker !== null && i < n; i++) { walker = walker.prev; } - if (i === n && walker !== null) { return walker.value; } }; - Yallist.prototype.map = function (fn, thisp) { thisp = thisp || this; var res = new Yallist(); - for (var walker = this.head; walker !== null;) { res.push(fn.call(thisp, walker.value, this)); walker = walker.next; } - return res; }; - Yallist.prototype.mapReverse = function (fn, thisp) { thisp = thisp || this; var res = new Yallist(); - for (var walker = this.tail; walker !== null;) { res.push(fn.call(thisp, walker.value, this)); walker = walker.prev; } - return res; }; - Yallist.prototype.reduce = function (fn, initial) { var acc; var walker = this.head; - if (arguments.length > 1) { acc = initial; } else if (this.head) { @@ -1002,19 +809,15 @@ function requireYallist() { } else { throw new TypeError('Reduce of empty list with no initial value'); } - for (var i = 0; walker !== null; i++) { acc = fn(acc, walker.value, i); walker = walker.next; } - return acc; }; - Yallist.prototype.reduceReverse = function (fn, initial) { var acc; var walker = this.tail; - if (arguments.length > 1) { acc = initial; } else if (this.tail) { @@ -1023,213 +826,157 @@ function requireYallist() { } else { throw new TypeError('Reduce of empty list with no initial value'); } - for (var i = this.length - 1; walker !== null; i--) { acc = fn(acc, walker.value, i); walker = walker.prev; } - return acc; }; - Yallist.prototype.toArray = function () { var arr = new Array(this.length); - for (var i = 0, walker = this.head; walker !== null; i++) { arr[i] = walker.value; walker = walker.next; } - return arr; }; - Yallist.prototype.toArrayReverse = function () { var arr = new Array(this.length); - for (var i = 0, walker = this.tail; walker !== null; i++) { arr[i] = walker.value; walker = walker.prev; } - return arr; }; - Yallist.prototype.slice = function (from, to) { to = to || this.length; - if (to < 0) { to += this.length; } - from = from || 0; - if (from < 0) { from += this.length; } - var ret = new Yallist(); - if (to < from || to < 0) { return ret; } - if (from < 0) { from = 0; } - if (to > this.length) { to = this.length; } - for (var i = 0, walker = this.head; walker !== null && i < from; i++) { walker = walker.next; } - for (; walker !== null && i < to; i++, walker = walker.next) { ret.push(walker.value); } - return ret; }; - Yallist.prototype.sliceReverse = function (from, to) { to = to || this.length; - if (to < 0) { to += this.length; } - from = from || 0; - if (from < 0) { from += this.length; } - var ret = new Yallist(); - if (to < from || to < 0) { return ret; } - if (from < 0) { from = 0; } - if (to > this.length) { to = this.length; } - for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) { walker = walker.prev; } - for (; walker !== null && i > from; i--, walker = walker.prev) { ret.push(walker.value); } - return ret; }; - Yallist.prototype.splice = function (start, deleteCount, ...nodes) { if (start > this.length) { start = this.length - 1; } - if (start < 0) { start = this.length + start; } - for (var i = 0, walker = this.head; walker !== null && i < start; i++) { walker = walker.next; } - var ret = []; - for (var i = 0; walker && i < deleteCount; i++) { ret.push(walker.value); walker = this.removeNode(walker); } - if (walker === null) { walker = this.tail; } - if (walker !== this.head && walker !== this.tail) { walker = walker.prev; } - for (var i = 0; i < nodes.length; i++) { walker = insert(this, walker, nodes[i]); } - return ret; }; - Yallist.prototype.reverse = function () { var head = this.head; var tail = this.tail; - for (var walker = head; walker !== null; walker = walker.prev) { var p = walker.prev; walker.prev = walker.next; walker.next = p; } - this.head = tail; this.tail = head; return this; }; - function insert(self, node, value) { var inserted = node === self.head ? new Node(value, null, node, self) : new Node(value, node, node.next, self); - if (inserted.next === null) { self.tail = inserted; } - if (inserted.prev === null) { self.head = inserted; } - self.length++; return inserted; } - function push(self, item) { self.tail = new Node(item, self.tail, null, self); - if (!self.head) { self.head = self.tail; } - self.length++; } - function unshift(self, item) { self.head = new Node(item, null, self.head, self); - if (!self.tail) { self.tail = self.head; } - self.length++; } - function Node(value, prev, next, list) { if (!(this instanceof Node)) { return new Node(value, prev, next, list); } - this.list = list; this.value = value; - if (prev) { prev.next = this; this.prev = prev; } else { this.prev = null; } - if (next) { next.prev = this; this.next = next; @@ -1237,20 +984,17 @@ function requireYallist() { this.next = null; } } - try { requireIterator()(Yallist); } catch (er) {} - return yallist; } - var lruCache; var hasRequiredLruCache; - function requireLruCache() { if (hasRequiredLruCache) return lruCache; hasRequiredLruCache = 1; + const Yallist = requireYallist(); const MAX = Symbol('max'); const LENGTH = Symbol('length'); @@ -1262,7 +1006,6 @@ function requireLruCache() { const LRU_LIST = Symbol('lruList'); const CACHE = Symbol('cache'); const UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet'); - const naiveLength = () => 1; class LRUCache { @@ -1289,32 +1032,26 @@ function requireLruCache() { this[MAX] = mL || Infinity; trim(this); } - get max() { return this[MAX]; } - set allowStale(allowStale) { this[ALLOW_STALE] = !!allowStale; } - get allowStale() { return this[ALLOW_STALE]; } - set maxAge(mA) { if (typeof mA !== 'number') throw new TypeError('maxAge must be a non-negative number'); this[MAX_AGE] = mA; trim(this); } - get maxAge() { return this[MAX_AGE]; } set lengthCalculator(lC) { if (typeof lC !== 'function') lC = naiveLength; - if (lC !== this[LENGTH_CALCULATOR]) { this[LENGTH_CALCULATOR] = lC; this[LENGTH] = 0; @@ -1323,55 +1060,43 @@ function requireLruCache() { this[LENGTH] += hit.length; }); } - trim(this); } - get lengthCalculator() { return this[LENGTH_CALCULATOR]; } - get length() { return this[LENGTH]; } - get itemCount() { return this[LRU_LIST].length; } - rforEach(fn, thisp) { thisp = thisp || this; - for (let walker = this[LRU_LIST].tail; walker !== null;) { const prev = walker.prev; forEachStep(this, fn, walker, thisp); walker = prev; } } - forEach(fn, thisp) { thisp = thisp || this; - for (let walker = this[LRU_LIST].head; walker !== null;) { const next = walker.next; forEachStep(this, fn, walker, thisp); walker = next; } } - keys() { return this[LRU_LIST].toArray().map(k => k.key); } - values() { return this[LRU_LIST].toArray().map(k => k.value); } - reset() { if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) { this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value)); } - this[CACHE] = new Map(); this[LRU_LIST] = new Yallist(); this[LENGTH] = 0; @@ -1384,30 +1109,25 @@ function requireLruCache() { e: hit.now + (hit.maxAge || 0) }).toArray().filter(h => h); } - dumpLru() { return this[LRU_LIST]; } - set(key, value, maxAge) { maxAge = maxAge || this[MAX_AGE]; if (maxAge && typeof maxAge !== 'number') throw new TypeError('maxAge must be a number'); const now = maxAge ? Date.now() : 0; const len = this[LENGTH_CALCULATOR](value, key); - if (this[CACHE].has(key)) { if (len > this[MAX]) { del(this, this[CACHE].get(key)); return false; } - const node = this[CACHE].get(key); const item = node.value; if (this[DISPOSE]) { if (!this[NO_DISPOSE_ON_SET]) this[DISPOSE](key, item.value); } - item.now = now; item.maxAge = maxAge; item.value = value; @@ -1417,75 +1137,61 @@ function requireLruCache() { trim(this); return true; } - const hit = new Entry(key, value, len, now, maxAge); if (hit.length > this[MAX]) { if (this[DISPOSE]) this[DISPOSE](key, value); return false; } - this[LENGTH] += hit.length; this[LRU_LIST].unshift(hit); this[CACHE].set(key, this[LRU_LIST].head); trim(this); return true; } - has(key) { if (!this[CACHE].has(key)) return false; const hit = this[CACHE].get(key).value; return !isStale(this, hit); } - get(key) { return get(this, key, true); } - peek(key) { return get(this, key, false); } - pop() { const node = this[LRU_LIST].tail; if (!node) return null; del(this, node); return node.value; } - del(key) { del(this, this[CACHE].get(key)); } - load(arr) { this.reset(); const now = Date.now(); - for (let l = arr.length - 1; l >= 0; l--) { const hit = arr[l]; const expiresAt = hit.e || 0; - if (expiresAt === 0) this.set(hit.k, hit.v);else { + if (expiresAt === 0) + this.set(hit.k, hit.v);else { const maxAge = expiresAt - now; - if (maxAge > 0) { this.set(hit.k, hit.v, maxAge); } } } } - prune() { this[CACHE].forEach((value, key) => get(this, key, false)); } - } - const get = (self, key, doUse) => { const node = self[CACHE].get(key); - if (node) { const hit = node.value; - if (isStale(self, hit)) { del(self, node); if (!self[ALLOW_STALE]) return undefined; @@ -1495,17 +1201,14 @@ function requireLruCache() { self[LRU_LIST].unshiftNode(node); } } - return hit.value; } }; - const isStale = (self, hit) => { if (!hit || !hit.maxAge && !self[MAX_AGE]) return false; const diff = Date.now() - hit.now; return hit.maxAge ? diff > hit.maxAge : self[MAX_AGE] && diff > self[MAX_AGE]; }; - const trim = self => { if (self[LENGTH] > self[MAX]) { for (let walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null;) { @@ -1515,7 +1218,6 @@ function requireLruCache() { } } }; - const del = (self, node) => { if (node) { const hit = node.value; @@ -1525,7 +1227,6 @@ function requireLruCache() { self[LRU_LIST].removeNode(node); } }; - class Entry { constructor(key, value, length, now, maxAge) { this.key = key; @@ -1534,35 +1235,26 @@ function requireLruCache() { this.now = now; this.maxAge = maxAge || 0; } - } - const forEachStep = (self, fn, node, thisp) => { let hit = node.value; - if (isStale(self, hit)) { del(self, node); if (!self[ALLOW_STALE]) hit = undefined; } - if (hit) fn.call(thisp, hit.value, hit.key, self); }; - lruCache = LRUCache; return lruCache; } - var range; var hasRequiredRange; - function requireRange() { if (hasRequiredRange) return range; hasRequiredRange = 1; - class Range { constructor(range, options) { options = parseOptions(options); - if (range instanceof Range) { if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) { return range; @@ -1570,20 +1262,20 @@ function requireRange() { return new Range(range.raw, options); } } - if (range instanceof Comparator) { this.raw = range.value; this.set = [[range]]; this.format(); return this; } - this.options = options; this.loose = !!options.loose; this.includePrerelease = !!options.includePrerelease; - this.raw = range; - this.set = range.split('||').map(r => this.parseRange(r.trim())).filter(c => c.length); + this.raw = range; + this.set = range.split('||') + .map(r => this.parseRange(r.trim())) + .filter(c => c.length); if (!this.set.length) { throw new TypeError(`Invalid SemVer Range: ${range}`); } @@ -1591,7 +1283,6 @@ function requireRange() { if (this.set.length > 1) { const first = this.set[0]; this.set = this.set.filter(c => !isNullSet(c[0])); - if (this.set.length === 0) { this.set = [first]; } else if (this.set.length > 1) { @@ -1603,75 +1294,68 @@ function requireRange() { } } } - this.format(); } - format() { this.range = this.set.map(comps => { return comps.join(' ').trim(); }).join('||').trim(); return this.range; } - toString() { return this.range; } - parseRange(range) { range = range.trim(); + const memoOpts = Object.keys(this.options).join(','); const memoKey = `parseRange:${memoOpts}:${range}`; const cached = cache.get(memoKey); - if (cached) { return cached; } - const loose = this.options.loose; const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]; range = range.replace(hr, hyphenReplace(this.options.includePrerelease)); debug('hyphen replace', range); range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace); debug('comparator trim', range); + range = range.replace(re[t.TILDETRIM], tildeTrimReplace); + range = range.replace(re[t.CARETTRIM], caretTrimReplace); + range = range.split(/\s+/).join(' '); - let rangeList = range.split(' ').map(comp => parseComparator(comp, this.options)).join(' ').split(/\s+/).map(comp => replaceGTE0(comp, this.options)); + let rangeList = range.split(' ').map(comp => parseComparator(comp, this.options)).join(' ').split(/\s+/) + .map(comp => replaceGTE0(comp, this.options)); if (loose) { rangeList = rangeList.filter(comp => { debug('loose invalid filter', comp, this.options); return !!comp.match(re[t.COMPARATORLOOSE]); }); } - debug('range list', rangeList); + const rangeMap = new Map(); const comparators = rangeList.map(comp => new Comparator(comp, this.options)); - for (const comp of comparators) { if (isNullSet(comp)) { return [comp]; } - rangeMap.set(comp.value, comp); } - if (rangeMap.size > 1 && rangeMap.has('')) { rangeMap.delete(''); } - const result = [...rangeMap.values()]; cache.set(memoKey, result); return result; } - intersects(range, options) { if (!(range instanceof Range)) { throw new TypeError('a Range is required'); } - return this.set.some(thisComparators => { return isSatisfiable(thisComparators, options) && range.set.some(rangeComparators => { return isSatisfiable(rangeComparators, options) && thisComparators.every(thisComparator => { @@ -1687,7 +1371,6 @@ function requireRange() { if (!version) { return false; } - if (typeof version === 'string') { try { version = new SemVer(version, this.options); @@ -1695,18 +1378,14 @@ function requireRange() { return false; } } - for (let i = 0; i < this.set.length; i++) { if (testSet(this.set[i], version, this.options)) { return true; } } - return false; } - } - range = Range; const LRU = requireLruCache(); const cache = new LRU({ @@ -1723,23 +1402,19 @@ function requireRange() { tildeTrimReplace, caretTrimReplace } = re$3.exports; - const isNullSet = c => c.value === '<0.0.0-0'; - const isAny = c => c.value === ''; const isSatisfiable = (comparators, options) => { let result = true; const remainingComparators = comparators.slice(); let testComparator = remainingComparators.pop(); - while (result && remainingComparators.length) { result = remainingComparators.every(otherComparator => { return testComparator.intersects(otherComparator, options); }); testComparator = remainingComparators.pop(); } - return result; }; @@ -1755,19 +1430,16 @@ function requireRange() { debug('stars', comp); return comp; }; - const isX = id => !id || id.toLowerCase() === 'x' || id === '*'; const replaceTildes = (comp, options) => comp.trim().split(/\s+/).map(c => { return replaceTilde(c, options); }).join(' '); - const replaceTilde = (comp, options) => { const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]; return comp.replace(r, (_, M, m, p, pr) => { debug('tilde', comp, _, M, m, p, pr); let ret; - if (isX(M)) { ret = ''; } else if (isX(m)) { @@ -1780,7 +1452,6 @@ function requireRange() { } else { ret = `>=${M}.${m}.${p} <${M}.${+m + 1}.0-0`; } - debug('tilde return', ret); return ret; }); @@ -1789,7 +1460,6 @@ function requireRange() { const replaceCarets = (comp, options) => comp.trim().split(/\s+/).map(c => { return replaceCaret(c, options); }).join(' '); - const replaceCaret = (comp, options) => { debug('caret', comp, options); const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]; @@ -1797,7 +1467,6 @@ function requireRange() { return comp.replace(r, (_, M, m, p, pr) => { debug('caret', comp, _, M, m, p, pr); let ret; - if (isX(M)) { ret = ''; } else if (isX(m)) { @@ -1810,7 +1479,6 @@ function requireRange() { } } else if (pr) { debug('replaceCaret pr', pr); - if (M === '0') { if (m === '0') { ret = `>=${M}.${m}.${p}-${pr} <${M}.${m}.${+p + 1}-0`; @@ -1822,7 +1490,6 @@ function requireRange() { } } else { debug('no pr'); - if (M === '0') { if (m === '0') { ret = `>=${M}.${m}.${p}${z} <${M}.${m}.${+p + 1}-0`; @@ -1833,19 +1500,16 @@ function requireRange() { ret = `>=${M}.${m}.${p} <${+M + 1}.0.0-0`; } } - debug('caret return', ret); return ret; }); }; - const replaceXRanges = (comp, options) => { debug('replaceXRanges', comp, options); return comp.split(/\s+/).map(c => { return replaceXRange(c, options); }).join(' '); }; - const replaceXRange = (comp, options) => { comp = comp.trim(); const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]; @@ -1855,13 +1519,11 @@ function requireRange() { const xm = xM || isX(m); const xp = xm || isX(p); const anyX = xp; - if (gtlt === '=' && anyX) { gtlt = ''; } pr = options.includePrerelease ? '-0' : ''; - if (xM) { if (gtlt === '>' || gtlt === '<') { ret = '<0.0.0-0'; @@ -1872,12 +1534,9 @@ function requireRange() { if (xm) { m = 0; } - p = 0; - if (gtlt === '>') { gtlt = '>='; - if (xm) { M = +M + 1; m = 0; @@ -1888,25 +1547,21 @@ function requireRange() { } } else if (gtlt === '<=') { gtlt = '<'; - if (xm) { M = +M + 1; } else { m = +m + 1; } } - if (gtlt === '<') { pr = '-0'; } - ret = `${gtlt + M}.${m}.${p}${pr}`; } else if (xm) { ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`; } else if (xp) { ret = `>=${M}.${m}.0${pr} <${M}.${+m + 1}.0-0`; } - debug('xRange return', ret); return ret; }); @@ -1916,7 +1571,6 @@ function requireRange() { debug('replaceStars', comp, options); return comp.trim().replace(re[t.STAR], ''); }; - const replaceGTE0 = (comp, options) => { debug('replaceGTE0', comp, options); return comp.trim().replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], ''); @@ -1934,7 +1588,6 @@ function requireRange() { } else { from = `>=${from}${incPr ? '-0' : ''}`; } - if (isX(tM)) { to = ''; } else if (isX(tm)) { @@ -1948,28 +1601,22 @@ function requireRange() { } else { to = `<=${to}`; } - return `${from} ${to}`.trim(); }; - const testSet = (set, version, options) => { for (let i = 0; i < set.length; i++) { if (!set[i].test(version)) { return false; } } - if (version.prerelease.length && !options.includePrerelease) { for (let i = 0; i < set.length; i++) { debug(set[i].semver); - if (set[i].semver === Comparator.ANY) { continue; } - if (set[i].semver.prerelease.length > 0) { const allowed = set[i].semver; - if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) { return true; } @@ -1978,29 +1625,22 @@ function requireRange() { return false; } - return true; }; - return range; } - var comparator; var hasRequiredComparator; - function requireComparator() { if (hasRequiredComparator) return comparator; hasRequiredComparator = 1; const ANY = Symbol('SemVer ANY'); - class Comparator { static get ANY() { return ANY; } - constructor(comp, options) { options = parseOptions(options); - if (comp instanceof Comparator) { if (comp.loose === !!options.loose) { return comp; @@ -2008,31 +1648,24 @@ function requireComparator() { comp = comp.value; } } - debug('comparator', comp, options); this.options = options; this.loose = !!options.loose; this.parse(comp); - if (this.semver === ANY) { this.value = ''; } else { this.value = this.operator + this.semver.version; } - debug('comp', this); } - parse(comp) { const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]; const m = comp.match(r); - if (!m) { throw new TypeError(`Invalid comparator: ${comp}`); } - this.operator = m[1] !== undefined ? m[1] : ''; - if (this.operator === '=') { this.operator = ''; } @@ -2043,18 +1676,14 @@ function requireComparator() { this.semver = new SemVer(m[2], this.options.loose); } } - toString() { return this.value; } - test(version) { debug('Comparator.test', version, this.options.loose); - if (this.semver === ANY || version === ANY) { return true; } - if (typeof version === 'string') { try { version = new SemVer(version, this.options); @@ -2062,36 +1691,29 @@ function requireComparator() { return false; } } - return cmp(version, this.operator, this.semver, this.options); } - intersects(comp, options) { if (!(comp instanceof Comparator)) { throw new TypeError('a Comparator is required'); } - if (!options || typeof options !== 'object') { options = { loose: !!options, includePrerelease: false }; } - if (this.operator === '') { if (this.value === '') { return true; } - return new Range(comp.value, options).test(this.value); } else if (comp.operator === '') { if (comp.value === '') { return true; } - return new Range(this.value, options).test(comp.semver); } - const sameDirectionIncreasing = (this.operator === '>=' || this.operator === '>') && (comp.operator === '>=' || comp.operator === '>'); const sameDirectionDecreasing = (this.operator === '<=' || this.operator === '<') && (comp.operator === '<=' || comp.operator === '<'); const sameSemVer = this.semver.version === comp.semver.version; @@ -2100,9 +1722,7 @@ function requireComparator() { const oppositeDirectionsGreaterThan = cmp(this.semver, '>', comp.semver, options) && (this.operator === '<=' || this.operator === '<') && (comp.operator === '>=' || comp.operator === '>'); return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan; } - } - comparator = Comparator; const parseOptions = parseOptions_1; const { @@ -2115,39 +1735,31 @@ function requireComparator() { const Range = requireRange(); return comparator; } - const Range$8 = requireRange(); - const satisfies$3 = (version, range, options) => { try { range = new Range$8(range, options); } catch (er) { return false; } - return range.test(version); }; - var satisfies_1 = satisfies$3; const Range$7 = requireRange(); const toComparators = (range, options) => new Range$7(range, options).set.map(comp => comp.map(c => c.value).join(' ').trim().split(' ')); - var toComparators_1 = toComparators; const SemVer$3 = semver$2; const Range$6 = requireRange(); - const maxSatisfying = (versions, range, options) => { let max = null; let maxSV = null; let rangeObj = null; - try { rangeObj = new Range$6(range, options); } catch (er) { return null; } - versions.forEach(v => { if (rangeObj.test(v)) { if (!max || maxSV.compare(v) === -1) { @@ -2158,22 +1770,18 @@ const maxSatisfying = (versions, range, options) => { }); return max; }; - var maxSatisfying_1 = maxSatisfying; const SemVer$2 = semver$2; const Range$5 = requireRange(); - const minSatisfying = (versions, range, options) => { let min = null; let minSV = null; let rangeObj = null; - try { rangeObj = new Range$5(range, options); } catch (er) { return null; } - versions.forEach(v => { if (rangeObj.test(v)) { if (!min || minSV.compare(v) === 1) { @@ -2184,34 +1792,26 @@ const minSatisfying = (versions, range, options) => { }); return min; }; - var minSatisfying_1 = minSatisfying; const SemVer$1 = semver$2; const Range$4 = requireRange(); const gt$1 = gt_1; - const minVersion = (range, loose) => { range = new Range$4(range, loose); let minver = new SemVer$1('0.0.0'); - if (range.test(minver)) { return minver; } - minver = new SemVer$1('0.0.0-0'); - if (range.test(minver)) { return minver; } - minver = null; - for (let i = 0; i < range.set.length; ++i) { const comparators = range.set[i]; let setMin = null; comparators.forEach(comparator => { const compver = new SemVer$1(comparator.semver.version); - switch (comparator.operator) { case '>': if (compver.prerelease.length === 0) { @@ -2219,41 +1819,31 @@ const minVersion = (range, loose) => { } else { compver.prerelease.push(0); } - compver.raw = compver.format(); - case '': case '>=': if (!setMin || gt$1(compver, setMin)) { setMin = compver; } - break; - case '<': case '<=': break; - default: throw new Error(`Unexpected operation: ${comparator.operator}`); } }); - if (setMin && (!minver || gt$1(minver, setMin))) { minver = setMin; } } - if (minver && range.test(minver)) { return minver; } - return null; }; - var minVersion_1 = minVersion; const Range$3 = requireRange(); - const validRange = (range, options) => { try { return new Range$3(range, options).range || '*'; @@ -2261,7 +1851,6 @@ const validRange = (range, options) => { return null; } }; - var valid = validRange; const SemVer = semver$2; const Comparator$1 = requireComparator(); @@ -2274,12 +1863,10 @@ const gt = gt_1; const lt = lt_1; const lte = lte_1; const gte = gte_1; - const outside$2 = (version, range, hilo, options) => { version = new SemVer(version, options); range = new Range$2(range, options); let gtfn, ltefn, ltfn, comp, ecomp; - switch (hilo) { case '>': gtfn = gt; @@ -2288,7 +1875,6 @@ const outside$2 = (version, range, hilo, options) => { comp = '>'; ecomp = '>='; break; - case '<': gtfn = lt; ltefn = gte; @@ -2296,7 +1882,6 @@ const outside$2 = (version, range, hilo, options) => { comp = '<'; ecomp = '<='; break; - default: throw new TypeError('Must provide a hilo val of "<" or ">"'); } @@ -2313,10 +1898,8 @@ const outside$2 = (version, range, hilo, options) => { if (comparator.semver === ANY$1) { comparator = new Comparator$1('>=0.0.0'); } - high = high || comparator; low = low || comparator; - if (gtfn(comparator.semver, high.semver, options)) { high = comparator; } else if (ltfn(comparator.semver, low.semver, options)) { @@ -2334,45 +1917,35 @@ const outside$2 = (version, range, hilo, options) => { return false; } } - return true; }; - var outside_1 = outside$2; -const outside$1 = outside_1; +const outside$1 = outside_1; const gtr = (version, range, options) => outside$1(version, range, '>', options); - var gtr_1 = gtr; const outside = outside_1; - const ltr = (version, range, options) => outside(version, range, '<', options); - var ltr_1 = ltr; const Range$1 = requireRange(); - const intersects = (r1, r2, options) => { r1 = new Range$1(r1, options); r2 = new Range$1(r2, options); return r1.intersects(r2); }; - var intersects_1 = intersects; + const satisfies$1 = satisfies_1; const compare$1 = compare_1; - var simplify = (versions, range, options) => { const set = []; let first = null; let prev = null; const v = versions.sort((a, b) => compare$1(a, b, options)); - for (const version of v) { const included = satisfies$1(version, range, options); - if (included) { prev = version; - if (!first) { first = version; } @@ -2380,18 +1953,14 @@ var simplify = (versions, range, options) => { if (prev) { set.push([first, prev]); } - prev = null; first = null; } } - if (first) { set.push([first, null]); } - const ranges = []; - for (const [min, max] of set) { if (min === max) { ranges.push(min); @@ -2405,12 +1974,10 @@ var simplify = (versions, range, options) => { ranges.push(`${min} - ${max}`); } } - const simplified = ranges.join(' || '); const original = typeof range.raw === 'string' ? range.raw : String(range); return simplified.length < original.length ? simplified : range; }; - const Range = requireRange(); const Comparator = requireComparator(); const { @@ -2423,34 +1990,27 @@ const subset = (sub, dom, options = {}) => { if (sub === dom) { return true; } - sub = new Range(sub, options); dom = new Range(dom, options); let sawNonNull = false; - OUTER: for (const simpleSub of sub.set) { for (const simpleDom of dom.set) { const isSub = simpleSubset(simpleSub, simpleDom, options); sawNonNull = sawNonNull || isSub !== null; - if (isSub) { continue OUTER; } } - if (sawNonNull) { return false; } } - return true; }; - const simpleSubset = (sub, dom, options) => { if (sub === dom) { return true; } - if (sub.length === 1 && sub[0].semver === ANY) { if (dom.length === 1 && dom[0].semver === ANY) { return true; @@ -2460,7 +2020,6 @@ const simpleSubset = (sub, dom, options) => { sub = [new Comparator('>=0.0.0')]; } } - if (dom.length === 1 && dom[0].semver === ANY) { if (options.includePrerelease) { return true; @@ -2468,10 +2027,8 @@ const simpleSubset = (sub, dom, options) => { dom = [new Comparator('>=0.0.0')]; } } - const eqSet = new Set(); let gt, lt; - for (const c of sub) { if (c.operator === '>' || c.operator === '>=') { gt = higherGT(gt, c, options); @@ -2481,16 +2038,12 @@ const simpleSubset = (sub, dom, options) => { eqSet.add(c.semver); } } - if (eqSet.size > 1) { return null; } - let gtltComp; - if (gt && lt) { gtltComp = compare(gt.semver, lt.semver, options); - if (gtltComp > 0) { return null; } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) { @@ -2502,43 +2055,34 @@ const simpleSubset = (sub, dom, options) => { if (gt && !satisfies(eq, String(gt), options)) { return null; } - if (lt && !satisfies(eq, String(lt), options)) { return null; } - for (const c of dom) { if (!satisfies(eq, String(c), options)) { return false; } } - return true; } - let higher, lower; let hasDomLT, hasDomGT; let needDomLTPre = lt && !options.includePrerelease && lt.semver.prerelease.length ? lt.semver : false; let needDomGTPre = gt && !options.includePrerelease && gt.semver.prerelease.length ? gt.semver : false; - if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === '<' && needDomLTPre.prerelease[0] === 0) { needDomLTPre = false; } - for (const c of dom) { hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>='; hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<='; - if (gt) { if (needDomGTPre) { if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomGTPre.major && c.semver.minor === needDomGTPre.minor && c.semver.patch === needDomGTPre.patch) { needDomGTPre = false; } } - if (c.operator === '>' || c.operator === '>=') { higher = higherGT(gt, c, options); - if (higher === c && higher !== gt) { return false; } @@ -2546,17 +2090,14 @@ const simpleSubset = (sub, dom, options) => { return false; } } - if (lt) { if (needDomLTPre) { if (c.semver.prerelease && c.semver.prerelease.length && c.semver.major === needDomLTPre.major && c.semver.minor === needDomLTPre.minor && c.semver.patch === needDomLTPre.patch) { needDomLTPre = false; } } - if (c.operator === '<' || c.operator === '<=') { lower = lowerLT(lt, c, options); - if (lower === c && lower !== lt) { return false; } @@ -2564,7 +2105,6 @@ const simpleSubset = (sub, dom, options) => { return false; } } - if (!c.operator && (lt || gt) && gtltComp !== 0) { return false; } @@ -2573,7 +2113,6 @@ const simpleSubset = (sub, dom, options) => { if (gt && hasDomLT && !lt && gtltComp !== 0) { return false; } - if (lt && hasDomGT && !gt && gtltComp !== 0) { return false; } @@ -2581,7 +2120,6 @@ const simpleSubset = (sub, dom, options) => { if (needDomGTPre || needDomLTPre) { return false; } - return true; }; @@ -2589,7 +2127,6 @@ const higherGT = (a, b, options) => { if (!a) { return b; } - const comp = compare(a.semver, b.semver, options); return comp > 0 ? a : comp < 0 ? b : b.operator === '>' && a.operator === '>=' ? b : a; }; @@ -2598,12 +2135,11 @@ const lowerLT = (a, b, options) => { if (!a) { return b; } - const comp = compare(a.semver, b.semver, options); return comp < 0 ? a : comp > 0 ? b : b.operator === '<' && a.operator === '<=' ? b : a; }; - var subset_1 = subset; + const internalRe = re$3.exports; var semver$1 = { re: internalRe.re, @@ -2652,7 +2188,6 @@ var semver$1 = { subset: subset_1 }; var semver = semver$1; - var builtins = function ({ version = process.version, experimental = false @@ -2666,15 +2201,12 @@ var builtins = function ({ if (semver.gte(version, '8.4.0')) coreModules.push('http2'); if (semver.gte(version, '8.5.0')) coreModules.push('perf_hooks'); if (semver.gte(version, '10.0.0')) coreModules.push('trace_events'); - if (semver.gte(version, '10.5.0') && (experimental || semver.gte(version, '12.0.0'))) { coreModules.push('worker_threads'); } - if (semver.gte(version, '12.16.0') && experimental) { coreModules.push('wasi'); } - return coreModules; }; @@ -2689,14 +2221,12 @@ function read(jsonPath) { function find(dir) { try { const string = _fs().default.readFileSync(_path().toNamespacedPath(_path().join(dir, 'package.json')), 'utf8'); - return { string }; } catch (error) { if (error.code === 'ENOENT') { const parent = _path().dirname(dir); - if (dir !== parent) return find(parent); return { string: undefined @@ -2710,55 +2240,59 @@ function find(dir) { const isWindows = process.platform === 'win32'; const own$1 = {}.hasOwnProperty; const codes = {}; + const messages = new Map(); const nodeInternalPrefix = '__node_internal_'; let userStackTraceLimit; -codes.ERR_INVALID_MODULE_SPECIFIER = createError('ERR_INVALID_MODULE_SPECIFIER', (request, reason, base = undefined) => { +codes.ERR_INVALID_MODULE_SPECIFIER = createError('ERR_INVALID_MODULE_SPECIFIER', +(request, reason, base = undefined) => { return `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ''}`; }, TypeError); -codes.ERR_INVALID_PACKAGE_CONFIG = createError('ERR_INVALID_PACKAGE_CONFIG', (path, base, message) => { +codes.ERR_INVALID_PACKAGE_CONFIG = createError('ERR_INVALID_PACKAGE_CONFIG', +(path, base, message) => { return `Invalid package config ${path}${base ? ` while importing ${base}` : ''}${message ? `. ${message}` : ''}`; }, Error); -codes.ERR_INVALID_PACKAGE_TARGET = createError('ERR_INVALID_PACKAGE_TARGET', (pkgPath, key, target, isImport = false, base = undefined) => { +codes.ERR_INVALID_PACKAGE_TARGET = createError('ERR_INVALID_PACKAGE_TARGET', +(pkgPath, key, target, isImport = false, base = undefined) => { const relError = typeof target === 'string' && !isImport && target.length > 0 && !target.startsWith('./'); - if (key === '.') { _assert()(isImport === false); - return `Invalid "exports" main target ${JSON.stringify(target)} defined ` + `in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ''}${relError ? '; targets must start with "./"' : ''}`; } - return `Invalid "${isImport ? 'imports' : 'exports'}" target ${JSON.stringify(target)} defined for '${key}' in the package config ${pkgPath}package.json${base ? ` imported from ${base}` : ''}${relError ? '; targets must start with "./"' : ''}`; }, Error); -codes.ERR_MODULE_NOT_FOUND = createError('ERR_MODULE_NOT_FOUND', (path, base, type = 'package') => { +codes.ERR_MODULE_NOT_FOUND = createError('ERR_MODULE_NOT_FOUND', +(path, base, type = 'package') => { return `Cannot find ${type} '${path}' imported from ${base}`; }, Error); -codes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError('ERR_PACKAGE_IMPORT_NOT_DEFINED', (specifier, packagePath, base) => { +codes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError('ERR_PACKAGE_IMPORT_NOT_DEFINED', +(specifier, packagePath, base) => { return `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath}package.json` : ''} imported from ${base}`; }, TypeError); -codes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError('ERR_PACKAGE_PATH_NOT_EXPORTED', (pkgPath, subpath, base = undefined) => { +codes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError('ERR_PACKAGE_PATH_NOT_EXPORTED', +(pkgPath, subpath, base = undefined) => { if (subpath === '.') return `No "exports" main defined in ${pkgPath}package.json${base ? ` imported from ${base}` : ''}`; return `Package subpath '${subpath}' is not defined by "exports" in ${pkgPath}package.json${base ? ` imported from ${base}` : ''}`; }, Error); codes.ERR_UNSUPPORTED_DIR_IMPORT = createError('ERR_UNSUPPORTED_DIR_IMPORT', "Directory import '%s' is not supported " + 'resolving ES modules imported from %s', Error); codes.ERR_UNKNOWN_FILE_EXTENSION = createError('ERR_UNKNOWN_FILE_EXTENSION', 'Unknown file extension "%s" for %s', TypeError); -codes.ERR_INVALID_ARG_VALUE = createError('ERR_INVALID_ARG_VALUE', (name, value, reason = 'is invalid') => { +codes.ERR_INVALID_ARG_VALUE = createError('ERR_INVALID_ARG_VALUE', +(name, value, reason = 'is invalid') => { let inspected = (0, _util().inspect)(value); - if (inspected.length > 128) { inspected = `${inspected.slice(0, 128)}...`; } - const type = name.includes('.') ? 'property' : 'argument'; return `The ${type} '${name}' ${reason}. Received ${inspected}`; -}, TypeError); -codes.ERR_UNSUPPORTED_ESM_URL_SCHEME = createError('ERR_UNSUPPORTED_ESM_URL_SCHEME', url => { - let message = 'Only file and data URLs are supported by the default ESM loader'; +}, TypeError +); +codes.ERR_UNSUPPORTED_ESM_URL_SCHEME = createError('ERR_UNSUPPORTED_ESM_URL_SCHEME', +url => { + let message = 'Only file and data URLs are supported by the default ESM loader'; if (isWindows && url.protocol.length === 2) { message += '. On Windows, absolute paths must be valid file:// URLs'; } - message += `. Received protocol '${url.protocol}'`; return message; }, Error); @@ -2770,7 +2304,6 @@ function createError(sym, value, def) { function makeNodeErrorWithCode(Base, key) { return NodeError; - function NodeError(...args) { const limit = Error.stackTraceLimit; if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0; @@ -2787,7 +2320,6 @@ function makeNodeErrorWithCode(Base, key) { value() { return `${this.name} [${key}]: ${this.message}`; }, - enumerable: false, writable: true, configurable: true @@ -2797,12 +2329,11 @@ function makeNodeErrorWithCode(Base, key) { return error; } } - -const addCodeToName = hideStackFrames(function (error, name, code) { +const addCodeToName = hideStackFrames( +function (error, name, code) { error = captureLargerStackTrace(error); error.name = `${name} [${code}]`; error.stack; - if (name === 'SystemError') { Object.defineProperty(error, 'name', { value: name, @@ -2817,11 +2348,9 @@ const addCodeToName = hideStackFrames(function (error, name, code) { function isErrorStackTraceLimitWritable() { const desc = Object.getOwnPropertyDescriptor(Error, 'stackTraceLimit'); - if (desc === undefined) { return Object.isExtensible(Error); } - return own$1.call(desc, 'writable') ? desc.writable : desc.set !== undefined; } @@ -2832,33 +2361,28 @@ function hideStackFrames(fn) { }); return fn; } - -const captureLargerStackTrace = hideStackFrames(function (error) { +const captureLargerStackTrace = hideStackFrames( +function (error) { const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable(); - if (stackTraceLimitIsWritable) { userStackTraceLimit = Error.stackTraceLimit; Error.stackTraceLimit = Number.POSITIVE_INFINITY; } - Error.captureStackTrace(error); + if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit; return error; }); function getMessage(key, args, self) { const message = messages.get(key); - if (typeof message === 'function') { - _assert()(message.length <= args.length, `Code: ${key}; The provided arguments length (${args.length}) does not ` + `match the required ones (${message.length}).`); - + _assert()(message.length <= args.length, + `Code: ${key}; The provided arguments length (${args.length}) does not ` + `match the required ones (${message.length}).`); return Reflect.apply(message, self, args); } - const expectedLength = (message.match(/%[dfijoOs]/g) || []).length; - _assert()(expectedLength === args.length, `Code: ${key}; The provided arguments length (${args.length}) does not ` + `match the required ones (${expectedLength}).`); - if (args.length === 0) return message; args.unshift(message); return Reflect.apply(_util().format, null, args); @@ -2880,9 +2404,7 @@ function defaultGetFormat(url) { format: 'builtin' }; } - const parsed = new (_url().URL)(url); - if (parsed.protocol === 'data:') { const { 1: mime @@ -2892,27 +2414,21 @@ function defaultGetFormat(url) { format }; } - if (parsed.protocol === 'file:') { const ext = _path().extname(parsed.pathname); - let format; - if (ext === '.js') { format = getPackageType(parsed.href) === 'module' ? 'module' : 'commonjs'; } else { format = extensionFormatMap[ext]; } - if (!format) { throw new ERR_UNKNOWN_FILE_EXTENSION(ext, (0, _url().fileURLToPath)(url)); } - return { format: format || null }; } - return { format: null }; @@ -2962,10 +2478,8 @@ function getConditionsSet(conditions) { if (!Array.isArray(conditions)) { throw new ERR_INVALID_ARG_VALUE('conditions', conditions, 'expected an array'); } - return new Set(conditions); } - return DEFAULT_CONDITIONS_SET; } @@ -2979,13 +2493,10 @@ function tryStatSync(path) { function getPackageConfig(path, specifier, base) { const existing = packageJsonCache.get(path); - if (existing !== undefined) { return existing; } - const source = reader.read(path).string; - if (source === undefined) { const packageConfig = { pjsonPath: path, @@ -3001,13 +2512,11 @@ function getPackageConfig(path, specifier, base) { } let packageJson; - try { packageJson = JSON.parse(source); } catch (error) { throw new ERR_INVALID_PACKAGE_CONFIG(path, (base ? `"${specifier}" from ` : '') + (0, _url().fileURLToPath)(base || specifier), error.message); } - const { exports, imports, @@ -3015,6 +2524,7 @@ function getPackageConfig(path, specifier, base) { name, type } = packageJson; + const packageConfig = { pjsonPath: path, exists: true, @@ -3030,7 +2540,6 @@ function getPackageConfig(path, specifier, base) { function getPackageScopeConfig(resolved) { let packageJsonUrl = new (_url().URL)('./package.json', resolved); - while (true) { const packageJsonPath = packageJsonUrl.pathname; if (packageJsonPath.endsWith('node_modules/package.json')) break; @@ -3038,9 +2547,9 @@ function getPackageScopeConfig(resolved) { if (packageConfig.exists) return packageConfig; const lastPackageJsonUrl = packageJsonUrl; packageJsonUrl = new (_url().URL)('../package.json', packageJsonUrl); + if (packageJsonUrl.pathname === lastPackageJsonUrl.pathname) break; } - const packageJsonPath = (0, _url().fileURLToPath)(packageJsonUrl); const packageConfig = { pjsonPath: packageJsonPath, @@ -3061,19 +2570,16 @@ function fileExists(url) { function legacyMainResolve(packageJsonUrl, packageConfig, base) { let guess; - if (packageConfig.main !== undefined) { guess = new (_url().URL)(`./${packageConfig.main}`, packageJsonUrl); if (fileExists(guess)) return guess; const tries = [`./${packageConfig.main}.js`, `./${packageConfig.main}.json`, `./${packageConfig.main}.node`, `./${packageConfig.main}/index.js`, `./${packageConfig.main}/index.json`, `./${packageConfig.main}/index.node`]; let i = -1; - while (++i < tries.length) { guess = new (_url().URL)(tries[i], packageJsonUrl); if (fileExists(guess)) break; guess = undefined; } - if (guess) { emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main); return guess; @@ -3082,13 +2588,11 @@ function legacyMainResolve(packageJsonUrl, packageConfig, base) { const tries = ['./index.js', './index.json', './index.node']; let i = -1; - while (++i < tries.length) { guess = new (_url().URL)(tries[i], packageJsonUrl); if (fileExists(guess)) break; guess = undefined; } - if (guess) { emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main); return guess; @@ -3101,17 +2605,14 @@ function finalizeResolution(resolved, base) { if (encodedSepRegEx.test(resolved.pathname)) throw new ERR_INVALID_MODULE_SPECIFIER(resolved.pathname, 'must not include encoded "/" or "\\" characters', (0, _url().fileURLToPath)(base)); const path = (0, _url().fileURLToPath)(resolved); const stats = tryStatSync(path.endsWith('/') ? path.slice(-1) : path); - if (stats.isDirectory()) { const error = new ERR_UNSUPPORTED_DIR_IMPORT(path, (0, _url().fileURLToPath)(base)); error.url = String(resolved); throw error; } - if (!stats.isFile()) { throw new ERR_MODULE_NOT_FOUND(path || resolved.pathname, base && (0, _url().fileURLToPath)(base), 'module'); } - return resolved; } @@ -3135,25 +2636,20 @@ function throwInvalidPackageTarget(subpath, target, packageJsonUrl, internal, ba function resolvePackageTargetString(target, subpath, match, packageJsonUrl, base, pattern, internal, conditions) { if (subpath !== '' && !pattern && target[target.length - 1] !== '/') throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base); - if (!target.startsWith('./')) { if (internal && !target.startsWith('../') && !target.startsWith('/')) { let isURL = false; - try { new (_url().URL)(target); isURL = true; } catch (_unused2) {} - if (!isURL) { const exportTarget = pattern ? target.replace(patternRegEx, subpath) : target + subpath; return packageResolve(exportTarget, packageJsonUrl, conditions); } } - throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base); } - if (invalidSegmentRegEx.test(target.slice(2))) throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base); const resolved = new (_url().URL)(target, packageJsonUrl); const resolvedPath = resolved.pathname; @@ -3175,17 +2671,15 @@ function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, b if (typeof target === 'string') { return resolvePackageTargetString(target, subpath, packageSubpath, packageJsonUrl, base, pattern, internal, conditions); } - if (Array.isArray(target)) { const targetList = target; if (targetList.length === 0) return null; + let lastException; let i = -1; - while (++i < targetList.length) { const targetItem = targetList[i]; let resolved; - try { resolved = resolvePackageTarget(packageJsonUrl, targetItem, subpath, packageSubpath, base, pattern, internal, conditions); } catch (error) { @@ -3193,41 +2687,30 @@ function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, b if (error.code === 'ERR_INVALID_PACKAGE_TARGET') continue; throw error; } - if (resolved === undefined) continue; - if (resolved === null) { lastException = null; continue; } - return resolved; } - if (lastException === undefined || lastException === null) { return lastException; } - throw lastException; } - if (typeof target === 'object' && target !== null) { const keys = Object.getOwnPropertyNames(target); let i = -1; - while (++i < keys.length) { const key = keys[i]; - if (isArrayIndex(key)) { throw new ERR_INVALID_PACKAGE_CONFIG((0, _url().fileURLToPath)(packageJsonUrl), base, '"exports" cannot contain numeric property keys.'); } } - i = -1; - while (++i < keys.length) { const key = keys[i]; - if (key === 'default' || conditions && conditions.has(key)) { const conditionalTarget = target[key]; const resolved = resolvePackageTarget(packageJsonUrl, conditionalTarget, subpath, packageSubpath, base, pattern, internal, conditions); @@ -3235,14 +2718,11 @@ function resolvePackageTarget(packageJsonUrl, target, subpath, packageSubpath, b return resolved; } } - return undefined; } - if (target === null) { return null; } - throwInvalidPackageTarget(packageSubpath, target, packageJsonUrl, internal, base); } @@ -3253,18 +2733,15 @@ function isConditionalExportsMainSugar(exports, packageJsonUrl, base) { let isConditionalSugar = false; let i = 0; let j = -1; - while (++j < keys.length) { const key = keys[j]; const curIsConditionalSugar = key === '' || key[0] !== '.'; - if (i++ === 0) { isConditionalSugar = curIsConditionalSugar; } else if (isConditionalSugar !== curIsConditionalSugar) { throw new ERR_INVALID_PACKAGE_CONFIG((0, _url().fileURLToPath)(packageJsonUrl), base, '"exports" cannot contain some keys starting with \'.\' and some not.' + ' The exports object must either be an object of package subpath keys' + ' or an object of main entry condition name keys only.'); } } - return isConditionalSugar; } @@ -3273,7 +2750,6 @@ function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, ba if (isConditionalExportsMainSugar(exports, packageJsonUrl, base)) exports = { '.': exports }; - if (own.call(exports, packageSubpath)) { const target = exports[packageSubpath]; const resolved = resolvePackageTarget(packageJsonUrl, target, '', packageSubpath, base, false, false, conditions); @@ -3283,21 +2759,17 @@ function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, ba exact: true }; } - let bestMatch = ''; const keys = Object.getOwnPropertyNames(exports); let i = -1; - while (++i < keys.length) { const key = keys[i]; - if (key[key.length - 1] === '*' && packageSubpath.startsWith(key.slice(0, -1)) && packageSubpath.length >= key.length && key.length > bestMatch.length) { bestMatch = key; } else if (key[key.length - 1] === '/' && packageSubpath.startsWith(key) && key.length > bestMatch.length) { bestMatch = key; } } - if (bestMatch) { const target = exports[bestMatch]; const pattern = bestMatch[bestMatch.length - 1] === '*'; @@ -3310,7 +2782,6 @@ function packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, ba exact: pattern }; } - throwExportsNotFound(packageSubpath, packageJsonUrl, base); } @@ -3322,11 +2793,9 @@ function packageImportsResolve(name, base, conditions) { let packageJsonUrl; const packageConfig = getPackageScopeConfig(base); - if (packageConfig.exists) { packageJsonUrl = (0, _url().pathToFileURL)(packageConfig.pjsonPath); const imports = packageConfig.imports; - if (imports) { if (own.call(imports, name)) { const resolved = resolvePackageTarget(packageJsonUrl, imports[name], '', name, base, false, true, conditions); @@ -3338,23 +2807,19 @@ function packageImportsResolve(name, base, conditions) { let bestMatch = ''; const keys = Object.getOwnPropertyNames(imports); let i = -1; - while (++i < keys.length) { const key = keys[i]; - if (key[key.length - 1] === '*' && name.startsWith(key.slice(0, -1)) && name.length >= key.length && key.length > bestMatch.length) { bestMatch = key; } else if (key[key.length - 1] === '/' && name.startsWith(key) && key.length > bestMatch.length) { bestMatch = key; } } - if (bestMatch) { const target = imports[bestMatch]; const pattern = bestMatch[bestMatch.length - 1] === '*'; const subpath = name.slice(bestMatch.length - (pattern ? 1 : 0)); const resolved = resolvePackageTarget(packageJsonUrl, target, subpath, bestMatch, base, pattern, true, conditions); - if (resolved !== null) { if (!pattern) emitFolderMapDeprecation(bestMatch, packageJsonUrl, false, base); return { @@ -3366,7 +2831,6 @@ function packageImportsResolve(name, base, conditions) { } } } - throwImportNotDefined(name, packageJsonUrl, base); } @@ -3379,31 +2843,26 @@ function parsePackageName(specifier, base) { let separatorIndex = specifier.indexOf('/'); let validPackageName = true; let isScoped = false; - if (specifier[0] === '@') { isScoped = true; - if (separatorIndex === -1 || specifier.length === 0) { validPackageName = false; } else { separatorIndex = specifier.indexOf('/', separatorIndex + 1); } } - const packageName = separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex); - let i = -1; + let i = -1; while (++i < packageName.length) { if (packageName[i] === '%' || packageName[i] === '\\') { validPackageName = false; break; } } - if (!validPackageName) { throw new ERR_INVALID_MODULE_SPECIFIER(specifier, 'is not a valid package name', (0, _url().fileURLToPath)(base)); } - const packageSubpath = '.' + (separatorIndex === -1 ? '' : specifier.slice(separatorIndex)); return { packageName, @@ -3418,23 +2877,20 @@ function packageResolve(specifier, base, conditions) { packageSubpath, isScoped } = parsePackageName(specifier, base); + const packageConfig = getPackageScopeConfig(base); if (packageConfig.exists) { const packageJsonUrl = (0, _url().pathToFileURL)(packageConfig.pjsonPath); - if (packageConfig.name === packageName && packageConfig.exports !== undefined && packageConfig.exports !== null) { return packageExportsResolve(packageJsonUrl, packageSubpath, packageConfig, base, conditions).resolved; } } - let packageJsonUrl = new (_url().URL)('./node_modules/' + packageName + '/package.json', base); let packageJsonPath = (0, _url().fileURLToPath)(packageJsonUrl); let lastPath; - do { const stat = tryStatSync(packageJsonPath.slice(0, -13)); - if (!stat.isDirectory()) { lastPath = packageJsonPath; packageJsonUrl = new (_url().URL)((isScoped ? '../../../../node_modules/' : '../../../node_modules/') + packageName + '/package.json', packageJsonUrl); @@ -3447,19 +2903,16 @@ function packageResolve(specifier, base, conditions) { if (packageSubpath === '.') return legacyMainResolve(packageJsonUrl, packageConfig, base); return new (_url().URL)(packageSubpath, packageJsonUrl); } while (packageJsonPath.length !== lastPath.length); - throw new ERR_MODULE_NOT_FOUND(packageName, (0, _url().fileURLToPath)(base)); } function isRelativeSpecifier(specifier) { if (specifier[0] === '.') { if (specifier.length === 1 || specifier[1] === '/') return true; - if (specifier[1] === '.' && (specifier.length === 2 || specifier[2] === '/')) { return true; } } - return false; } @@ -3471,7 +2924,6 @@ function shouldBeTreatedAsRelativeOrAbsolutePath(specifier) { function moduleResolve(specifier, base, conditions) { let resolved; - if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) { resolved = new (_url().URL)(specifier, base); } else if (specifier[0] === '#') { @@ -3485,7 +2937,6 @@ function moduleResolve(specifier, base, conditions) { resolved = packageResolve(specifier, base, conditions); } } - return finalizeResolution(resolved, base); } @@ -3494,32 +2945,26 @@ function defaultResolve(specifier, context = {}) { parentURL } = context; let parsed; - try { parsed = new (_url().URL)(specifier); - if (parsed.protocol === 'data:') { return { url: specifier }; } } catch (_unused4) {} - if (parsed && parsed.protocol === 'node:') return { url: specifier }; if (parsed && parsed.protocol !== 'file:' && parsed.protocol !== 'data:') throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed); - if (listOfBuiltins.includes(specifier)) { return { url: 'node:' + specifier }; } - if (parentURL.startsWith('data:')) { new (_url().URL)(specifier, parentURL); } - const conditions = getConditionsSet(context.conditions); let url = moduleResolve(specifier, new (_url().URL)(parentURL), conditions); const urlPath = (0, _url().fileURLToPath)(url); @@ -3536,13 +2981,11 @@ function defaultResolve(specifier, context = {}) { function resolve(_x, _x2) { return _resolve.apply(this, arguments); } - function _resolve() { _resolve = _asyncToGenerator(function* (specifier, parent) { if (!parent) { throw new Error('Please pass `parent`: `import-meta-resolve` cannot ponyfill that'); } - try { return defaultResolve(specifier, { parentURL: parent @@ -3553,7 +2996,6 @@ function _resolve() { }); return _resolve.apply(this, arguments); } - 0 && 0; //# sourceMappingURL=import-meta-resolve.js.map diff --git a/node_modules/@babel/core/lib/vendor/import-meta-resolve.js.map b/node_modules/@babel/core/lib/vendor/import-meta-resolve.js.map index d7389f358..bfb7c5628 100644 --- a/node_modules/@babel/core/lib/vendor/import-meta-resolve.js.map +++ b/node_modules/@babel/core/lib/vendor/import-meta-resolve.js.map @@ -1 +1 @@ -{"version":3,"names":["re$3","exports","SEMVER_SPEC_VERSION","MAX_LENGTH$2","MAX_SAFE_INTEGER$1","Number","MAX_SAFE_INTEGER","MAX_SAFE_COMPONENT_LENGTH","constants","MAX_LENGTH","debug$1","process","env","NODE_DEBUG","test","args","console","error","debug_1","module","debug","re","src","t","R","createToken","name","value","isGlobal","index","RegExp","undefined","NUMERICIDENTIFIER","NUMERICIDENTIFIERLOOSE","NONNUMERICIDENTIFIER","PRERELEASEIDENTIFIER","PRERELEASEIDENTIFIERLOOSE","BUILDIDENTIFIER","MAINVERSION","PRERELEASE","BUILD","FULLPLAIN","MAINVERSIONLOOSE","PRERELEASELOOSE","LOOSEPLAIN","XRANGEIDENTIFIER","XRANGEIDENTIFIERLOOSE","GTLT","XRANGEPLAIN","XRANGEPLAINLOOSE","COERCE","LONETILDE","tildeTrimReplace","LONECARET","caretTrimReplace","comparatorTrimReplace","opts","parseOptions$2","options","loose","filter","k","reduce","o","parseOptions_1","numeric","compareIdentifiers$1","a","b","anum","bnum","rcompareIdentifiers","identifiers","compareIdentifiers","MAX_LENGTH$1","re$2","t$2","parseOptions$1","SemVer$c","constructor","version","includePrerelease","TypeError","length","m","trim","match","LOOSE","FULL","raw","major","minor","patch","prerelease","split","map","id","num","build","format","join","toString","compare","other","compareMain","comparePre","i","compareBuild","inc","release","identifier","push","isNaN","Error","semver$2","re$1","t$1","SemVer$b","parseOptions","parse$5","r","er","parse_1","parse$4","valid$1","v","valid_1","parse$3","clean","s","replace","clean_1","SemVer$a","inc_1","SemVer$9","compare$a","compare_1","compare$9","eq$2","eq_1","parse$2","eq$1","diff","version1","version2","v1","v2","hasPre","prefix","defaultResult","key","diff_1","SemVer$8","major_1","SemVer$7","minor_1","SemVer$6","patch_1","parse$1","parsed","prerelease_1","compare$8","rcompare","rcompare_1","compare$7","compareLoose","compareLoose_1","SemVer$5","compareBuild$2","versionA","versionB","compareBuild_1","compareBuild$1","sort","list","sort_1","rsort","rsort_1","compare$6","gt$3","gt_1","compare$5","lt$2","lt_1","compare$4","neq$1","neq_1","compare$3","gte$2","gte_1","compare$2","lte$2","lte_1","eq","neq","gt$2","gte$1","lt$1","lte$1","cmp","op","cmp_1","SemVer$4","parse","coerce","String","rtl","next","COERCERTL","exec","lastIndex","coerce_1","iterator","hasRequiredIterator","requireIterator","Yallist","prototype","Symbol","walker","head","yallist","hasRequiredYallist","requireYallist","Node","create","self","tail","forEach","item","arguments","l","removeNode","node","prev","unshiftNode","pushNode","unshift","pop","res","shift","fn","thisp","call","forEachReverse","get","n","getReverse","mapReverse","initial","acc","reduceReverse","toArray","arr","Array","toArrayReverse","slice","from","to","ret","sliceReverse","splice","start","deleteCount","nodes","insert","reverse","p","inserted","lruCache","hasRequiredLruCache","requireLruCache","MAX","LENGTH","LENGTH_CALCULATOR","ALLOW_STALE","MAX_AGE","DISPOSE","NO_DISPOSE_ON_SET","LRU_LIST","CACHE","UPDATE_AGE_ON_GET","naiveLength","LRUCache","max","Infinity","lc","stale","maxAge","dispose","noDisposeOnSet","updateAgeOnGet","reset","mL","allowStale","mA","lengthCalculator","lC","hit","itemCount","rforEach","forEachStep","keys","values","Map","dump","isStale","e","now","h","dumpLru","set","Date","len","has","del","Entry","peek","load","expiresAt","prune","doUse","delete","range","hasRequiredRange","requireRange","Range","Comparator","parseRange","c","first","isNullSet","isAny","comps","memoOpts","Object","memoKey","cached","cache","hr","HYPHENRANGELOOSE","HYPHENRANGE","hyphenReplace","COMPARATORTRIM","TILDETRIM","CARETTRIM","rangeList","comp","parseComparator","replaceGTE0","COMPARATORLOOSE","rangeMap","comparators","size","result","intersects","some","thisComparators","isSatisfiable","rangeComparators","every","thisComparator","rangeComparator","SemVer","testSet","LRU","requireComparator","remainingComparators","testComparator","otherComparator","replaceCarets","replaceTildes","replaceXRanges","replaceStars","isX","toLowerCase","replaceTilde","TILDELOOSE","TILDE","_","M","pr","replaceCaret","CARETLOOSE","CARET","z","replaceXRange","XRANGELOOSE","XRANGE","gtlt","xM","xm","xp","anyX","STAR","GTE0PRE","GTE0","incPr","$0","fM","fm","fp","fpr","fb","tM","tm","tp","tpr","tb","semver","ANY","allowed","comparator","hasRequiredComparator","operator","COMPARATOR","sameDirectionIncreasing","sameDirectionDecreasing","sameSemVer","differentDirectionsInclusive","oppositeDirectionsLessThan","oppositeDirectionsGreaterThan","Range$8","satisfies$3","satisfies_1","Range$7","toComparators","toComparators_1","SemVer$3","Range$6","maxSatisfying","versions","maxSV","rangeObj","maxSatisfying_1","SemVer$2","Range$5","minSatisfying","min","minSV","minSatisfying_1","SemVer$1","Range$4","gt$1","minVersion","minver","setMin","compver","minVersion_1","Range$3","validRange","valid","Comparator$1","ANY$1","Range$2","satisfies$2","gt","lt","lte","gte","outside$2","hilo","gtfn","ltefn","ltfn","ecomp","high","low","outside_1","outside$1","gtr","gtr_1","outside","ltr","ltr_1","Range$1","r1","r2","intersects_1","satisfies$1","compare$1","simplify","included","ranges","simplified","original","satisfies","subset","sub","dom","sawNonNull","OUTER","simpleSub","simpleDom","isSub","simpleSubset","eqSet","Set","higherGT","lowerLT","add","gtltComp","higher","lower","hasDomLT","hasDomGT","needDomLTPre","needDomGTPre","subset_1","internalRe","semver$1","tokens","simplifyRange","builtins","experimental","coreModules","reader","read","jsonPath","find","path","dirname","dir","string","fs","readFileSync","toNamespacedPath","code","parent","isWindows","platform","own$1","hasOwnProperty","codes","messages","nodeInternalPrefix","userStackTraceLimit","ERR_INVALID_MODULE_SPECIFIER","createError","request","reason","base","ERR_INVALID_PACKAGE_CONFIG","message","ERR_INVALID_PACKAGE_TARGET","pkgPath","target","isImport","relError","startsWith","assert","JSON","stringify","ERR_MODULE_NOT_FOUND","type","ERR_PACKAGE_IMPORT_NOT_DEFINED","specifier","packagePath","ERR_PACKAGE_PATH_NOT_EXPORTED","subpath","ERR_UNSUPPORTED_DIR_IMPORT","ERR_UNKNOWN_FILE_EXTENSION","ERR_INVALID_ARG_VALUE","inspected","inspect","includes","ERR_UNSUPPORTED_ESM_URL_SCHEME","url","protocol","sym","def","makeNodeErrorWithCode","Base","NodeError","limit","stackTraceLimit","isErrorStackTraceLimitWritable","getMessage","defineProperty","enumerable","writable","configurable","addCodeToName","hideStackFrames","captureLargerStackTrace","stack","desc","getOwnPropertyDescriptor","isExtensible","hidden","stackTraceLimitIsWritable","POSITIVE_INFINITY","captureStackTrace","Reflect","apply","expectedLength","extensionFormatMap","__proto__","defaultGetFormat","URL","mime","pathname","ext","extname","getPackageType","href","fileURLToPath","listOfBuiltins","own","DEFAULT_CONDITIONS","freeze","DEFAULT_CONDITIONS_SET","invalidSegmentRegEx","patternRegEx","encodedSepRegEx","emittedPackageWarnings","packageJsonCache","emitFolderMapDeprecation","pjsonUrl","isExports","pjsonPath","emitWarning","emitLegacyIndexDeprecation","packageJsonUrl","main","basePath","getConditionsSet","conditions","isArray","tryStatSync","statSync","Stats","getPackageConfig","existing","source","packageConfig","exists","imports","packageJson","getPackageScopeConfig","resolved","packageJsonPath","endsWith","lastPackageJsonUrl","fileExists","isFile","legacyMainResolve","guess","tries","finalizeResolution","stats","isDirectory","throwImportNotDefined","throwExportsNotFound","throwInvalidSubpath","internal","throwInvalidPackageTarget","resolvePackageTargetString","pattern","isURL","exportTarget","packageResolve","resolvedPath","isArrayIndex","keyNumber","resolvePackageTarget","packageSubpath","targetList","lastException","targetItem","getOwnPropertyNames","conditionalTarget","isConditionalExportsMainSugar","isConditionalSugar","j","curIsConditionalSugar","packageExportsResolve","exact","bestMatch","packageImportsResolve","pathToFileURL","parsePackageName","separatorIndex","indexOf","validPackageName","isScoped","packageName","lastPath","stat","isRelativeSpecifier","shouldBeTreatedAsRelativeOrAbsolutePath","moduleResolve","defaultResolve","context","parentURL","urlPath","real","realpathSync","old","sep","search","hash","resolve","Promise","reject"],"sources":["../../src/vendor/import-meta-resolve.js"],"sourcesContent":["\n/****************************************************************************\\\n * NOTE FROM BABEL AUTHORS *\n * This file is inlined from https://github.com/wooorm/import-meta-resolve, *\n * because we need to compile it to CommonJS. *\n\\****************************************************************************/\n\n/*\n(The MIT License)\n\nCopyright (c) 2021 Titus Wormer \n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n---\n\nThis is a derivative work based on:\n.\nWhich is licensed:\n\n\"\"\"\nCopyright Node.js contributors. All rights reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n\"\"\"\n\nThis license applies to parts of Node.js originating from the\nhttps://github.com/joyent/node repository:\n\n\"\"\"\nCopyright Joyent, Inc. and other Node contributors. All rights reserved.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n\"\"\"\n*/\n\nimport { URL, fileURLToPath, pathToFileURL } from 'url';\nimport fs, { realpathSync, statSync, Stats } from 'fs';\nimport path from 'path';\nimport assert from 'assert';\nimport { format, inspect } from 'util';\n\nvar re$3 = {exports: {}};\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0';\n\nconst MAX_LENGTH$2 = 256;\nconst MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991;\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16;\n\nvar constants = {\n SEMVER_SPEC_VERSION,\n MAX_LENGTH: MAX_LENGTH$2,\n MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,\n MAX_SAFE_COMPONENT_LENGTH,\n};\n\nconst debug$1 = (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n : () => {};\n\nvar debug_1 = debug$1;\n\n(function (module, exports) {\n\tconst { MAX_SAFE_COMPONENT_LENGTH } = constants;\n\tconst debug = debug_1;\n\texports = module.exports = {};\n\n\t// The actual regexps go on exports.re\n\tconst re = exports.re = [];\n\tconst src = exports.src = [];\n\tconst t = exports.t = {};\n\tlet R = 0;\n\n\tconst createToken = (name, value, isGlobal) => {\n\t const index = R++;\n\t debug(name, index, value);\n\t t[name] = index;\n\t src[index] = value;\n\t re[index] = new RegExp(value, isGlobal ? 'g' : undefined);\n\t};\n\n\t// The following Regular Expressions can be used for tokenizing,\n\t// validating, and parsing SemVer version strings.\n\n\t// ## Numeric Identifier\n\t// A single `0`, or a non-zero digit followed by zero or more digits.\n\n\tcreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*');\n\tcreateToken('NUMERICIDENTIFIERLOOSE', '[0-9]+');\n\n\t// ## Non-numeric Identifier\n\t// Zero or more digits, followed by a letter or hyphen, and then zero or\n\t// more letters, digits, or hyphens.\n\n\tcreateToken('NONNUMERICIDENTIFIER', '\\\\d*[a-zA-Z-][a-zA-Z0-9-]*');\n\n\t// ## Main Version\n\t// Three dot-separated numeric identifiers.\n\n\tcreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n\t `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n\t `(${src[t.NUMERICIDENTIFIER]})`);\n\n\tcreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n\t `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n\t `(${src[t.NUMERICIDENTIFIERLOOSE]})`);\n\n\t// ## Pre-release Version Identifier\n\t// A numeric identifier, or a non-numeric identifier.\n\n\tcreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]\n\t}|${src[t.NONNUMERICIDENTIFIER]})`);\n\n\tcreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]\n\t}|${src[t.NONNUMERICIDENTIFIER]})`);\n\n\t// ## Pre-release Version\n\t// Hyphen, followed by one or more dot-separated pre-release version\n\t// identifiers.\n\n\tcreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n\t}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`);\n\n\tcreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n\t}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);\n\n\t// ## Build Metadata Identifier\n\t// Any combination of digits, letters, or hyphens.\n\n\tcreateToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+');\n\n\t// ## Build Metadata\n\t// Plus sign, followed by one or more period-separated build metadata\n\t// identifiers.\n\n\tcreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n\t}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`);\n\n\t// ## Full Version String\n\t// A main version, followed optionally by a pre-release version and\n\t// build metadata.\n\n\t// Note that the only major, minor, patch, and pre-release sections of\n\t// the version string are capturing groups. The build metadata is not a\n\t// capturing group, because it should not ever be used in version\n\t// comparison.\n\n\tcreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n\t}${src[t.PRERELEASE]}?${\n\t src[t.BUILD]}?`);\n\n\tcreateToken('FULL', `^${src[t.FULLPLAIN]}$`);\n\n\t// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n\t// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n\t// common in the npm registry.\n\tcreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n\t}${src[t.PRERELEASELOOSE]}?${\n\t src[t.BUILD]}?`);\n\n\tcreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);\n\n\tcreateToken('GTLT', '((?:<|>)?=?)');\n\n\t// Something like \"2.*\" or \"1.2.x\".\n\t// Note that \"x.x\" is a valid xRange identifer, meaning \"any version\"\n\t// Only the first item is strictly required.\n\tcreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`);\n\tcreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`);\n\n\tcreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n\t `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n\t `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n\t `(?:${src[t.PRERELEASE]})?${\n\t src[t.BUILD]}?` +\n\t `)?)?`);\n\n\tcreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n\t `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n\t `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n\t `(?:${src[t.PRERELEASELOOSE]})?${\n\t src[t.BUILD]}?` +\n\t `)?)?`);\n\n\tcreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`);\n\tcreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`);\n\n\t// Coercion.\n\t// Extract anything that could conceivably be a part of a valid semver\n\tcreateToken('COERCE', `${'(^|[^\\\\d])' +\n\t '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n\t `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n\t `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n\t `(?:$|[^\\\\d])`);\n\tcreateToken('COERCERTL', src[t.COERCE], true);\n\n\t// Tilde ranges.\n\t// Meaning is \"reasonably at or greater than\"\n\tcreateToken('LONETILDE', '(?:~>?)');\n\n\tcreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true);\n\texports.tildeTrimReplace = '$1~';\n\n\tcreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);\n\tcreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);\n\n\t// Caret ranges.\n\t// Meaning is \"at least and backwards compatible with\"\n\tcreateToken('LONECARET', '(?:\\\\^)');\n\n\tcreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true);\n\texports.caretTrimReplace = '$1^';\n\n\tcreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);\n\tcreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);\n\n\t// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\n\tcreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`);\n\tcreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`);\n\n\t// An expression to strip any whitespace between the gtlt and the thing\n\t// it modifies, so that `> 1.2.3` ==> `>1.2.3`\n\tcreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n\t}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);\n\texports.comparatorTrimReplace = '$1$2$3';\n\n\t// Something like `1.2.3 - 1.2.4`\n\t// Note that these all use the loose form, because they'll be\n\t// checked against either the strict or loose comparator form\n\t// later.\n\tcreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n\t `\\\\s+-\\\\s+` +\n\t `(${src[t.XRANGEPLAIN]})` +\n\t `\\\\s*$`);\n\n\tcreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n\t `\\\\s+-\\\\s+` +\n\t `(${src[t.XRANGEPLAINLOOSE]})` +\n\t `\\\\s*$`);\n\n\t// Star ranges basically just allow anything at all.\n\tcreateToken('STAR', '(<|>)?=?\\\\s*\\\\*');\n\t// >=0.0.0 is like a star\n\tcreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$');\n\tcreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$');\n} (re$3, re$3.exports));\n\n// parse out just the options we care about so we always get a consistent\n// obj with keys in a consistent order.\nconst opts = ['includePrerelease', 'loose', 'rtl'];\nconst parseOptions$2 = options =>\n !options ? {}\n : typeof options !== 'object' ? { loose: true }\n : opts.filter(k => options[k]).reduce((o, k) => {\n o[k] = true;\n return o\n }, {});\nvar parseOptions_1 = parseOptions$2;\n\nconst numeric = /^[0-9]+$/;\nconst compareIdentifiers$1 = (a, b) => {\n const anum = numeric.test(a);\n const bnum = numeric.test(b);\n\n if (anum && bnum) {\n a = +a;\n b = +b;\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n};\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);\n\nvar identifiers = {\n compareIdentifiers: compareIdentifiers$1,\n rcompareIdentifiers,\n};\n\nconst debug = debug_1;\nconst { MAX_LENGTH: MAX_LENGTH$1, MAX_SAFE_INTEGER } = constants;\nconst { re: re$2, t: t$2 } = re$3.exports;\n\nconst parseOptions$1 = parseOptions_1;\nconst { compareIdentifiers } = identifiers;\nclass SemVer$c {\n constructor (version, options) {\n options = parseOptions$1(options);\n\n if (version instanceof SemVer$c) {\n if (version.loose === !!options.loose &&\n version.includePrerelease === !!options.includePrerelease) {\n return version\n } else {\n version = version.version;\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n if (version.length > MAX_LENGTH$1) {\n throw new TypeError(\n `version is longer than ${MAX_LENGTH$1} characters`\n )\n }\n\n debug('SemVer', version, options);\n this.options = options;\n this.loose = !!options.loose;\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease;\n\n const m = version.trim().match(options.loose ? re$2[t$2.LOOSE] : re$2[t$2.FULL]);\n\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n this.raw = version;\n\n // these are actually numbers\n this.major = +m[1];\n this.minor = +m[2];\n this.patch = +m[3];\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = [];\n } else {\n this.prerelease = m[4].split('.').map((id) => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id;\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n });\n }\n\n this.build = m[5] ? m[5].split('.') : [];\n this.format();\n }\n\n format () {\n this.version = `${this.major}.${this.minor}.${this.patch}`;\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`;\n }\n return this.version\n }\n\n toString () {\n return this.version\n }\n\n compare (other) {\n debug('SemVer.compare', this.version, this.options, other);\n if (!(other instanceof SemVer$c)) {\n if (typeof other === 'string' && other === this.version) {\n return 0\n }\n other = new SemVer$c(other, this.options);\n }\n\n if (other.version === this.version) {\n return 0\n }\n\n return this.compareMain(other) || this.comparePre(other)\n }\n\n compareMain (other) {\n if (!(other instanceof SemVer$c)) {\n other = new SemVer$c(other, this.options);\n }\n\n return (\n compareIdentifiers(this.major, other.major) ||\n compareIdentifiers(this.minor, other.minor) ||\n compareIdentifiers(this.patch, other.patch)\n )\n }\n\n comparePre (other) {\n if (!(other instanceof SemVer$c)) {\n other = new SemVer$c(other, this.options);\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n let i = 0;\n do {\n const a = this.prerelease[i];\n const b = other.prerelease[i];\n debug('prerelease compare', i, a, b);\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n compareBuild (other) {\n if (!(other instanceof SemVer$c)) {\n other = new SemVer$c(other, this.options);\n }\n\n let i = 0;\n do {\n const a = this.build[i];\n const b = other.build[i];\n debug('prerelease compare', i, a, b);\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc (release, identifier) {\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0;\n this.patch = 0;\n this.minor = 0;\n this.major++;\n this.inc('pre', identifier);\n break\n case 'preminor':\n this.prerelease.length = 0;\n this.patch = 0;\n this.minor++;\n this.inc('pre', identifier);\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0;\n this.inc('patch', identifier);\n this.inc('pre', identifier);\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier);\n }\n this.inc('pre', identifier);\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (\n this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0\n ) {\n this.major++;\n }\n this.minor = 0;\n this.patch = 0;\n this.prerelease = [];\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++;\n }\n this.patch = 0;\n this.prerelease = [];\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++;\n }\n this.prerelease = [];\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre':\n if (this.prerelease.length === 0) {\n this.prerelease = [0];\n } else {\n let i = this.prerelease.length;\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++;\n i = -2;\n }\n }\n if (i === -1) {\n // didn't increment anything\n this.prerelease.push(0);\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n if (compareIdentifiers(this.prerelease[0], identifier) === 0) {\n if (isNaN(this.prerelease[1])) {\n this.prerelease = [identifier, 0];\n }\n } else {\n this.prerelease = [identifier, 0];\n }\n }\n break\n\n default:\n throw new Error(`invalid increment argument: ${release}`)\n }\n this.format();\n this.raw = this.version;\n return this\n }\n}\n\nvar semver$2 = SemVer$c;\n\nconst { MAX_LENGTH } = constants;\nconst { re: re$1, t: t$1 } = re$3.exports;\nconst SemVer$b = semver$2;\n\nconst parseOptions = parseOptions_1;\nconst parse$5 = (version, options) => {\n options = parseOptions(options);\n\n if (version instanceof SemVer$b) {\n return version\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n if (version.length > MAX_LENGTH) {\n return null\n }\n\n const r = options.loose ? re$1[t$1.LOOSE] : re$1[t$1.FULL];\n if (!r.test(version)) {\n return null\n }\n\n try {\n return new SemVer$b(version, options)\n } catch (er) {\n return null\n }\n};\n\nvar parse_1 = parse$5;\n\nconst parse$4 = parse_1;\nconst valid$1 = (version, options) => {\n const v = parse$4(version, options);\n return v ? v.version : null\n};\nvar valid_1 = valid$1;\n\nconst parse$3 = parse_1;\nconst clean = (version, options) => {\n const s = parse$3(version.trim().replace(/^[=v]+/, ''), options);\n return s ? s.version : null\n};\nvar clean_1 = clean;\n\nconst SemVer$a = semver$2;\n\nconst inc = (version, release, options, identifier) => {\n if (typeof (options) === 'string') {\n identifier = options;\n options = undefined;\n }\n\n try {\n return new SemVer$a(\n version instanceof SemVer$a ? version.version : version,\n options\n ).inc(release, identifier).version\n } catch (er) {\n return null\n }\n};\nvar inc_1 = inc;\n\nconst SemVer$9 = semver$2;\nconst compare$a = (a, b, loose) =>\n new SemVer$9(a, loose).compare(new SemVer$9(b, loose));\n\nvar compare_1 = compare$a;\n\nconst compare$9 = compare_1;\nconst eq$2 = (a, b, loose) => compare$9(a, b, loose) === 0;\nvar eq_1 = eq$2;\n\nconst parse$2 = parse_1;\nconst eq$1 = eq_1;\n\nconst diff = (version1, version2) => {\n if (eq$1(version1, version2)) {\n return null\n } else {\n const v1 = parse$2(version1);\n const v2 = parse$2(version2);\n const hasPre = v1.prerelease.length || v2.prerelease.length;\n const prefix = hasPre ? 'pre' : '';\n const defaultResult = hasPre ? 'prerelease' : '';\n for (const key in v1) {\n if (key === 'major' || key === 'minor' || key === 'patch') {\n if (v1[key] !== v2[key]) {\n return prefix + key\n }\n }\n }\n return defaultResult // may be undefined\n }\n};\nvar diff_1 = diff;\n\nconst SemVer$8 = semver$2;\nconst major = (a, loose) => new SemVer$8(a, loose).major;\nvar major_1 = major;\n\nconst SemVer$7 = semver$2;\nconst minor = (a, loose) => new SemVer$7(a, loose).minor;\nvar minor_1 = minor;\n\nconst SemVer$6 = semver$2;\nconst patch = (a, loose) => new SemVer$6(a, loose).patch;\nvar patch_1 = patch;\n\nconst parse$1 = parse_1;\nconst prerelease = (version, options) => {\n const parsed = parse$1(version, options);\n return (parsed && parsed.prerelease.length) ? parsed.prerelease : null\n};\nvar prerelease_1 = prerelease;\n\nconst compare$8 = compare_1;\nconst rcompare = (a, b, loose) => compare$8(b, a, loose);\nvar rcompare_1 = rcompare;\n\nconst compare$7 = compare_1;\nconst compareLoose = (a, b) => compare$7(a, b, true);\nvar compareLoose_1 = compareLoose;\n\nconst SemVer$5 = semver$2;\nconst compareBuild$2 = (a, b, loose) => {\n const versionA = new SemVer$5(a, loose);\n const versionB = new SemVer$5(b, loose);\n return versionA.compare(versionB) || versionA.compareBuild(versionB)\n};\nvar compareBuild_1 = compareBuild$2;\n\nconst compareBuild$1 = compareBuild_1;\nconst sort = (list, loose) => list.sort((a, b) => compareBuild$1(a, b, loose));\nvar sort_1 = sort;\n\nconst compareBuild = compareBuild_1;\nconst rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));\nvar rsort_1 = rsort;\n\nconst compare$6 = compare_1;\nconst gt$3 = (a, b, loose) => compare$6(a, b, loose) > 0;\nvar gt_1 = gt$3;\n\nconst compare$5 = compare_1;\nconst lt$2 = (a, b, loose) => compare$5(a, b, loose) < 0;\nvar lt_1 = lt$2;\n\nconst compare$4 = compare_1;\nconst neq$1 = (a, b, loose) => compare$4(a, b, loose) !== 0;\nvar neq_1 = neq$1;\n\nconst compare$3 = compare_1;\nconst gte$2 = (a, b, loose) => compare$3(a, b, loose) >= 0;\nvar gte_1 = gte$2;\n\nconst compare$2 = compare_1;\nconst lte$2 = (a, b, loose) => compare$2(a, b, loose) <= 0;\nvar lte_1 = lte$2;\n\nconst eq = eq_1;\nconst neq = neq_1;\nconst gt$2 = gt_1;\nconst gte$1 = gte_1;\nconst lt$1 = lt_1;\nconst lte$1 = lte_1;\n\nconst cmp = (a, op, b, loose) => {\n switch (op) {\n case '===':\n if (typeof a === 'object') {\n a = a.version;\n }\n if (typeof b === 'object') {\n b = b.version;\n }\n return a === b\n\n case '!==':\n if (typeof a === 'object') {\n a = a.version;\n }\n if (typeof b === 'object') {\n b = b.version;\n }\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt$2(a, b, loose)\n\n case '>=':\n return gte$1(a, b, loose)\n\n case '<':\n return lt$1(a, b, loose)\n\n case '<=':\n return lte$1(a, b, loose)\n\n default:\n throw new TypeError(`Invalid operator: ${op}`)\n }\n};\nvar cmp_1 = cmp;\n\nconst SemVer$4 = semver$2;\nconst parse = parse_1;\nconst { re, t } = re$3.exports;\n\nconst coerce = (version, options) => {\n if (version instanceof SemVer$4) {\n return version\n }\n\n if (typeof version === 'number') {\n version = String(version);\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n options = options || {};\n\n let match = null;\n if (!options.rtl) {\n match = version.match(re[t.COERCE]);\n } else {\n // Find the right-most coercible string that does not share\n // a terminus with a more left-ward coercible string.\n // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'\n //\n // Walk through the string checking with a /g regexp\n // Manually set the index so as to pick up overlapping matches.\n // Stop when we get a match that ends at the string end, since no\n // coercible string can be more right-ward without the same terminus.\n let next;\n while ((next = re[t.COERCERTL].exec(version)) &&\n (!match || match.index + match[0].length !== version.length)\n ) {\n if (!match ||\n next.index + next[0].length !== match.index + match[0].length) {\n match = next;\n }\n re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;\n }\n // leave it in a clean state\n re[t.COERCERTL].lastIndex = -1;\n }\n\n if (match === null) {\n return null\n }\n\n return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)\n};\nvar coerce_1 = coerce;\n\nvar iterator;\nvar hasRequiredIterator;\n\nfunction requireIterator () {\n\tif (hasRequiredIterator) return iterator;\n\thasRequiredIterator = 1;\n\titerator = function (Yallist) {\n\t Yallist.prototype[Symbol.iterator] = function* () {\n\t for (let walker = this.head; walker; walker = walker.next) {\n\t yield walker.value;\n\t }\n\t };\n\t};\n\treturn iterator;\n}\n\nvar yallist;\nvar hasRequiredYallist;\n\nfunction requireYallist () {\n\tif (hasRequiredYallist) return yallist;\n\thasRequiredYallist = 1;\n\tyallist = Yallist;\n\n\tYallist.Node = Node;\n\tYallist.create = Yallist;\n\n\tfunction Yallist (list) {\n\t var self = this;\n\t if (!(self instanceof Yallist)) {\n\t self = new Yallist();\n\t }\n\n\t self.tail = null;\n\t self.head = null;\n\t self.length = 0;\n\n\t if (list && typeof list.forEach === 'function') {\n\t list.forEach(function (item) {\n\t self.push(item);\n\t });\n\t } else if (arguments.length > 0) {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t self.push(arguments[i]);\n\t }\n\t }\n\n\t return self\n\t}\n\n\tYallist.prototype.removeNode = function (node) {\n\t if (node.list !== this) {\n\t throw new Error('removing node which does not belong to this list')\n\t }\n\n\t var next = node.next;\n\t var prev = node.prev;\n\n\t if (next) {\n\t next.prev = prev;\n\t }\n\n\t if (prev) {\n\t prev.next = next;\n\t }\n\n\t if (node === this.head) {\n\t this.head = next;\n\t }\n\t if (node === this.tail) {\n\t this.tail = prev;\n\t }\n\n\t node.list.length--;\n\t node.next = null;\n\t node.prev = null;\n\t node.list = null;\n\n\t return next\n\t};\n\n\tYallist.prototype.unshiftNode = function (node) {\n\t if (node === this.head) {\n\t return\n\t }\n\n\t if (node.list) {\n\t node.list.removeNode(node);\n\t }\n\n\t var head = this.head;\n\t node.list = this;\n\t node.next = head;\n\t if (head) {\n\t head.prev = node;\n\t }\n\n\t this.head = node;\n\t if (!this.tail) {\n\t this.tail = node;\n\t }\n\t this.length++;\n\t};\n\n\tYallist.prototype.pushNode = function (node) {\n\t if (node === this.tail) {\n\t return\n\t }\n\n\t if (node.list) {\n\t node.list.removeNode(node);\n\t }\n\n\t var tail = this.tail;\n\t node.list = this;\n\t node.prev = tail;\n\t if (tail) {\n\t tail.next = node;\n\t }\n\n\t this.tail = node;\n\t if (!this.head) {\n\t this.head = node;\n\t }\n\t this.length++;\n\t};\n\n\tYallist.prototype.push = function () {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t push(this, arguments[i]);\n\t }\n\t return this.length\n\t};\n\n\tYallist.prototype.unshift = function () {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t unshift(this, arguments[i]);\n\t }\n\t return this.length\n\t};\n\n\tYallist.prototype.pop = function () {\n\t if (!this.tail) {\n\t return undefined\n\t }\n\n\t var res = this.tail.value;\n\t this.tail = this.tail.prev;\n\t if (this.tail) {\n\t this.tail.next = null;\n\t } else {\n\t this.head = null;\n\t }\n\t this.length--;\n\t return res\n\t};\n\n\tYallist.prototype.shift = function () {\n\t if (!this.head) {\n\t return undefined\n\t }\n\n\t var res = this.head.value;\n\t this.head = this.head.next;\n\t if (this.head) {\n\t this.head.prev = null;\n\t } else {\n\t this.tail = null;\n\t }\n\t this.length--;\n\t return res\n\t};\n\n\tYallist.prototype.forEach = function (fn, thisp) {\n\t thisp = thisp || this;\n\t for (var walker = this.head, i = 0; walker !== null; i++) {\n\t fn.call(thisp, walker.value, i, this);\n\t walker = walker.next;\n\t }\n\t};\n\n\tYallist.prototype.forEachReverse = function (fn, thisp) {\n\t thisp = thisp || this;\n\t for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {\n\t fn.call(thisp, walker.value, i, this);\n\t walker = walker.prev;\n\t }\n\t};\n\n\tYallist.prototype.get = function (n) {\n\t for (var i = 0, walker = this.head; walker !== null && i < n; i++) {\n\t // abort out of the list early if we hit a cycle\n\t walker = walker.next;\n\t }\n\t if (i === n && walker !== null) {\n\t return walker.value\n\t }\n\t};\n\n\tYallist.prototype.getReverse = function (n) {\n\t for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {\n\t // abort out of the list early if we hit a cycle\n\t walker = walker.prev;\n\t }\n\t if (i === n && walker !== null) {\n\t return walker.value\n\t }\n\t};\n\n\tYallist.prototype.map = function (fn, thisp) {\n\t thisp = thisp || this;\n\t var res = new Yallist();\n\t for (var walker = this.head; walker !== null;) {\n\t res.push(fn.call(thisp, walker.value, this));\n\t walker = walker.next;\n\t }\n\t return res\n\t};\n\n\tYallist.prototype.mapReverse = function (fn, thisp) {\n\t thisp = thisp || this;\n\t var res = new Yallist();\n\t for (var walker = this.tail; walker !== null;) {\n\t res.push(fn.call(thisp, walker.value, this));\n\t walker = walker.prev;\n\t }\n\t return res\n\t};\n\n\tYallist.prototype.reduce = function (fn, initial) {\n\t var acc;\n\t var walker = this.head;\n\t if (arguments.length > 1) {\n\t acc = initial;\n\t } else if (this.head) {\n\t walker = this.head.next;\n\t acc = this.head.value;\n\t } else {\n\t throw new TypeError('Reduce of empty list with no initial value')\n\t }\n\n\t for (var i = 0; walker !== null; i++) {\n\t acc = fn(acc, walker.value, i);\n\t walker = walker.next;\n\t }\n\n\t return acc\n\t};\n\n\tYallist.prototype.reduceReverse = function (fn, initial) {\n\t var acc;\n\t var walker = this.tail;\n\t if (arguments.length > 1) {\n\t acc = initial;\n\t } else if (this.tail) {\n\t walker = this.tail.prev;\n\t acc = this.tail.value;\n\t } else {\n\t throw new TypeError('Reduce of empty list with no initial value')\n\t }\n\n\t for (var i = this.length - 1; walker !== null; i--) {\n\t acc = fn(acc, walker.value, i);\n\t walker = walker.prev;\n\t }\n\n\t return acc\n\t};\n\n\tYallist.prototype.toArray = function () {\n\t var arr = new Array(this.length);\n\t for (var i = 0, walker = this.head; walker !== null; i++) {\n\t arr[i] = walker.value;\n\t walker = walker.next;\n\t }\n\t return arr\n\t};\n\n\tYallist.prototype.toArrayReverse = function () {\n\t var arr = new Array(this.length);\n\t for (var i = 0, walker = this.tail; walker !== null; i++) {\n\t arr[i] = walker.value;\n\t walker = walker.prev;\n\t }\n\t return arr\n\t};\n\n\tYallist.prototype.slice = function (from, to) {\n\t to = to || this.length;\n\t if (to < 0) {\n\t to += this.length;\n\t }\n\t from = from || 0;\n\t if (from < 0) {\n\t from += this.length;\n\t }\n\t var ret = new Yallist();\n\t if (to < from || to < 0) {\n\t return ret\n\t }\n\t if (from < 0) {\n\t from = 0;\n\t }\n\t if (to > this.length) {\n\t to = this.length;\n\t }\n\t for (var i = 0, walker = this.head; walker !== null && i < from; i++) {\n\t walker = walker.next;\n\t }\n\t for (; walker !== null && i < to; i++, walker = walker.next) {\n\t ret.push(walker.value);\n\t }\n\t return ret\n\t};\n\n\tYallist.prototype.sliceReverse = function (from, to) {\n\t to = to || this.length;\n\t if (to < 0) {\n\t to += this.length;\n\t }\n\t from = from || 0;\n\t if (from < 0) {\n\t from += this.length;\n\t }\n\t var ret = new Yallist();\n\t if (to < from || to < 0) {\n\t return ret\n\t }\n\t if (from < 0) {\n\t from = 0;\n\t }\n\t if (to > this.length) {\n\t to = this.length;\n\t }\n\t for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {\n\t walker = walker.prev;\n\t }\n\t for (; walker !== null && i > from; i--, walker = walker.prev) {\n\t ret.push(walker.value);\n\t }\n\t return ret\n\t};\n\n\tYallist.prototype.splice = function (start, deleteCount, ...nodes) {\n\t if (start > this.length) {\n\t start = this.length - 1;\n\t }\n\t if (start < 0) {\n\t start = this.length + start;\n\t }\n\n\t for (var i = 0, walker = this.head; walker !== null && i < start; i++) {\n\t walker = walker.next;\n\t }\n\n\t var ret = [];\n\t for (var i = 0; walker && i < deleteCount; i++) {\n\t ret.push(walker.value);\n\t walker = this.removeNode(walker);\n\t }\n\t if (walker === null) {\n\t walker = this.tail;\n\t }\n\n\t if (walker !== this.head && walker !== this.tail) {\n\t walker = walker.prev;\n\t }\n\n\t for (var i = 0; i < nodes.length; i++) {\n\t walker = insert(this, walker, nodes[i]);\n\t }\n\t return ret;\n\t};\n\n\tYallist.prototype.reverse = function () {\n\t var head = this.head;\n\t var tail = this.tail;\n\t for (var walker = head; walker !== null; walker = walker.prev) {\n\t var p = walker.prev;\n\t walker.prev = walker.next;\n\t walker.next = p;\n\t }\n\t this.head = tail;\n\t this.tail = head;\n\t return this\n\t};\n\n\tfunction insert (self, node, value) {\n\t var inserted = node === self.head ?\n\t new Node(value, null, node, self) :\n\t new Node(value, node, node.next, self);\n\n\t if (inserted.next === null) {\n\t self.tail = inserted;\n\t }\n\t if (inserted.prev === null) {\n\t self.head = inserted;\n\t }\n\n\t self.length++;\n\n\t return inserted\n\t}\n\n\tfunction push (self, item) {\n\t self.tail = new Node(item, self.tail, null, self);\n\t if (!self.head) {\n\t self.head = self.tail;\n\t }\n\t self.length++;\n\t}\n\n\tfunction unshift (self, item) {\n\t self.head = new Node(item, null, self.head, self);\n\t if (!self.tail) {\n\t self.tail = self.head;\n\t }\n\t self.length++;\n\t}\n\n\tfunction Node (value, prev, next, list) {\n\t if (!(this instanceof Node)) {\n\t return new Node(value, prev, next, list)\n\t }\n\n\t this.list = list;\n\t this.value = value;\n\n\t if (prev) {\n\t prev.next = this;\n\t this.prev = prev;\n\t } else {\n\t this.prev = null;\n\t }\n\n\t if (next) {\n\t next.prev = this;\n\t this.next = next;\n\t } else {\n\t this.next = null;\n\t }\n\t}\n\n\ttry {\n\t // add if support for Symbol.iterator is present\n\t requireIterator()(Yallist);\n\t} catch (er) {}\n\treturn yallist;\n}\n\nvar lruCache;\nvar hasRequiredLruCache;\n\nfunction requireLruCache () {\n\tif (hasRequiredLruCache) return lruCache;\n\thasRequiredLruCache = 1;\n\n\t// A linked list to keep track of recently-used-ness\n\tconst Yallist = requireYallist();\n\n\tconst MAX = Symbol('max');\n\tconst LENGTH = Symbol('length');\n\tconst LENGTH_CALCULATOR = Symbol('lengthCalculator');\n\tconst ALLOW_STALE = Symbol('allowStale');\n\tconst MAX_AGE = Symbol('maxAge');\n\tconst DISPOSE = Symbol('dispose');\n\tconst NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');\n\tconst LRU_LIST = Symbol('lruList');\n\tconst CACHE = Symbol('cache');\n\tconst UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');\n\n\tconst naiveLength = () => 1;\n\n\t// lruList is a yallist where the head is the youngest\n\t// item, and the tail is the oldest. the list contains the Hit\n\t// objects as the entries.\n\t// Each Hit object has a reference to its Yallist.Node. This\n\t// never changes.\n\t//\n\t// cache is a Map (or PseudoMap) that matches the keys to\n\t// the Yallist.Node object.\n\tclass LRUCache {\n\t constructor (options) {\n\t if (typeof options === 'number')\n\t options = { max: options };\n\n\t if (!options)\n\t options = {};\n\n\t if (options.max && (typeof options.max !== 'number' || options.max < 0))\n\t throw new TypeError('max must be a non-negative number')\n\t // Kind of weird to have a default max of Infinity, but oh well.\n\t this[MAX] = options.max || Infinity;\n\n\t const lc = options.length || naiveLength;\n\t this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc;\n\t this[ALLOW_STALE] = options.stale || false;\n\t if (options.maxAge && typeof options.maxAge !== 'number')\n\t throw new TypeError('maxAge must be a number')\n\t this[MAX_AGE] = options.maxAge || 0;\n\t this[DISPOSE] = options.dispose;\n\t this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;\n\t this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;\n\t this.reset();\n\t }\n\n\t // resize the cache when the max changes.\n\t set max (mL) {\n\t if (typeof mL !== 'number' || mL < 0)\n\t throw new TypeError('max must be a non-negative number')\n\n\t this[MAX] = mL || Infinity;\n\t trim(this);\n\t }\n\t get max () {\n\t return this[MAX]\n\t }\n\n\t set allowStale (allowStale) {\n\t this[ALLOW_STALE] = !!allowStale;\n\t }\n\t get allowStale () {\n\t return this[ALLOW_STALE]\n\t }\n\n\t set maxAge (mA) {\n\t if (typeof mA !== 'number')\n\t throw new TypeError('maxAge must be a non-negative number')\n\n\t this[MAX_AGE] = mA;\n\t trim(this);\n\t }\n\t get maxAge () {\n\t return this[MAX_AGE]\n\t }\n\n\t // resize the cache when the lengthCalculator changes.\n\t set lengthCalculator (lC) {\n\t if (typeof lC !== 'function')\n\t lC = naiveLength;\n\n\t if (lC !== this[LENGTH_CALCULATOR]) {\n\t this[LENGTH_CALCULATOR] = lC;\n\t this[LENGTH] = 0;\n\t this[LRU_LIST].forEach(hit => {\n\t hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);\n\t this[LENGTH] += hit.length;\n\t });\n\t }\n\t trim(this);\n\t }\n\t get lengthCalculator () { return this[LENGTH_CALCULATOR] }\n\n\t get length () { return this[LENGTH] }\n\t get itemCount () { return this[LRU_LIST].length }\n\n\t rforEach (fn, thisp) {\n\t thisp = thisp || this;\n\t for (let walker = this[LRU_LIST].tail; walker !== null;) {\n\t const prev = walker.prev;\n\t forEachStep(this, fn, walker, thisp);\n\t walker = prev;\n\t }\n\t }\n\n\t forEach (fn, thisp) {\n\t thisp = thisp || this;\n\t for (let walker = this[LRU_LIST].head; walker !== null;) {\n\t const next = walker.next;\n\t forEachStep(this, fn, walker, thisp);\n\t walker = next;\n\t }\n\t }\n\n\t keys () {\n\t return this[LRU_LIST].toArray().map(k => k.key)\n\t }\n\n\t values () {\n\t return this[LRU_LIST].toArray().map(k => k.value)\n\t }\n\n\t reset () {\n\t if (this[DISPOSE] &&\n\t this[LRU_LIST] &&\n\t this[LRU_LIST].length) {\n\t this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));\n\t }\n\n\t this[CACHE] = new Map(); // hash of items by key\n\t this[LRU_LIST] = new Yallist(); // list of items in order of use recency\n\t this[LENGTH] = 0; // length of items in the list\n\t }\n\n\t dump () {\n\t return this[LRU_LIST].map(hit =>\n\t isStale(this, hit) ? false : {\n\t k: hit.key,\n\t v: hit.value,\n\t e: hit.now + (hit.maxAge || 0)\n\t }).toArray().filter(h => h)\n\t }\n\n\t dumpLru () {\n\t return this[LRU_LIST]\n\t }\n\n\t set (key, value, maxAge) {\n\t maxAge = maxAge || this[MAX_AGE];\n\n\t if (maxAge && typeof maxAge !== 'number')\n\t throw new TypeError('maxAge must be a number')\n\n\t const now = maxAge ? Date.now() : 0;\n\t const len = this[LENGTH_CALCULATOR](value, key);\n\n\t if (this[CACHE].has(key)) {\n\t if (len > this[MAX]) {\n\t del(this, this[CACHE].get(key));\n\t return false\n\t }\n\n\t const node = this[CACHE].get(key);\n\t const item = node.value;\n\n\t // dispose of the old one before overwriting\n\t // split out into 2 ifs for better coverage tracking\n\t if (this[DISPOSE]) {\n\t if (!this[NO_DISPOSE_ON_SET])\n\t this[DISPOSE](key, item.value);\n\t }\n\n\t item.now = now;\n\t item.maxAge = maxAge;\n\t item.value = value;\n\t this[LENGTH] += len - item.length;\n\t item.length = len;\n\t this.get(key);\n\t trim(this);\n\t return true\n\t }\n\n\t const hit = new Entry(key, value, len, now, maxAge);\n\n\t // oversized objects fall out of cache automatically.\n\t if (hit.length > this[MAX]) {\n\t if (this[DISPOSE])\n\t this[DISPOSE](key, value);\n\n\t return false\n\t }\n\n\t this[LENGTH] += hit.length;\n\t this[LRU_LIST].unshift(hit);\n\t this[CACHE].set(key, this[LRU_LIST].head);\n\t trim(this);\n\t return true\n\t }\n\n\t has (key) {\n\t if (!this[CACHE].has(key)) return false\n\t const hit = this[CACHE].get(key).value;\n\t return !isStale(this, hit)\n\t }\n\n\t get (key) {\n\t return get(this, key, true)\n\t }\n\n\t peek (key) {\n\t return get(this, key, false)\n\t }\n\n\t pop () {\n\t const node = this[LRU_LIST].tail;\n\t if (!node)\n\t return null\n\n\t del(this, node);\n\t return node.value\n\t }\n\n\t del (key) {\n\t del(this, this[CACHE].get(key));\n\t }\n\n\t load (arr) {\n\t // reset the cache\n\t this.reset();\n\n\t const now = Date.now();\n\t // A previous serialized cache has the most recent items first\n\t for (let l = arr.length - 1; l >= 0; l--) {\n\t const hit = arr[l];\n\t const expiresAt = hit.e || 0;\n\t if (expiresAt === 0)\n\t // the item was created without expiration in a non aged cache\n\t this.set(hit.k, hit.v);\n\t else {\n\t const maxAge = expiresAt - now;\n\t // dont add already expired items\n\t if (maxAge > 0) {\n\t this.set(hit.k, hit.v, maxAge);\n\t }\n\t }\n\t }\n\t }\n\n\t prune () {\n\t this[CACHE].forEach((value, key) => get(this, key, false));\n\t }\n\t}\n\n\tconst get = (self, key, doUse) => {\n\t const node = self[CACHE].get(key);\n\t if (node) {\n\t const hit = node.value;\n\t if (isStale(self, hit)) {\n\t del(self, node);\n\t if (!self[ALLOW_STALE])\n\t return undefined\n\t } else {\n\t if (doUse) {\n\t if (self[UPDATE_AGE_ON_GET])\n\t node.value.now = Date.now();\n\t self[LRU_LIST].unshiftNode(node);\n\t }\n\t }\n\t return hit.value\n\t }\n\t};\n\n\tconst isStale = (self, hit) => {\n\t if (!hit || (!hit.maxAge && !self[MAX_AGE]))\n\t return false\n\n\t const diff = Date.now() - hit.now;\n\t return hit.maxAge ? diff > hit.maxAge\n\t : self[MAX_AGE] && (diff > self[MAX_AGE])\n\t};\n\n\tconst trim = self => {\n\t if (self[LENGTH] > self[MAX]) {\n\t for (let walker = self[LRU_LIST].tail;\n\t self[LENGTH] > self[MAX] && walker !== null;) {\n\t // We know that we're about to delete this one, and also\n\t // what the next least recently used key will be, so just\n\t // go ahead and set it now.\n\t const prev = walker.prev;\n\t del(self, walker);\n\t walker = prev;\n\t }\n\t }\n\t};\n\n\tconst del = (self, node) => {\n\t if (node) {\n\t const hit = node.value;\n\t if (self[DISPOSE])\n\t self[DISPOSE](hit.key, hit.value);\n\n\t self[LENGTH] -= hit.length;\n\t self[CACHE].delete(hit.key);\n\t self[LRU_LIST].removeNode(node);\n\t }\n\t};\n\n\tclass Entry {\n\t constructor (key, value, length, now, maxAge) {\n\t this.key = key;\n\t this.value = value;\n\t this.length = length;\n\t this.now = now;\n\t this.maxAge = maxAge || 0;\n\t }\n\t}\n\n\tconst forEachStep = (self, fn, node, thisp) => {\n\t let hit = node.value;\n\t if (isStale(self, hit)) {\n\t del(self, node);\n\t if (!self[ALLOW_STALE])\n\t hit = undefined;\n\t }\n\t if (hit)\n\t fn.call(thisp, hit.value, hit.key, self);\n\t};\n\n\tlruCache = LRUCache;\n\treturn lruCache;\n}\n\nvar range;\nvar hasRequiredRange;\n\nfunction requireRange () {\n\tif (hasRequiredRange) return range;\n\thasRequiredRange = 1;\n\t// hoisted class for cyclic dependency\n\tclass Range {\n\t constructor (range, options) {\n\t options = parseOptions(options);\n\n\t if (range instanceof Range) {\n\t if (\n\t range.loose === !!options.loose &&\n\t range.includePrerelease === !!options.includePrerelease\n\t ) {\n\t return range\n\t } else {\n\t return new Range(range.raw, options)\n\t }\n\t }\n\n\t if (range instanceof Comparator) {\n\t // just put it in the set and return\n\t this.raw = range.value;\n\t this.set = [[range]];\n\t this.format();\n\t return this\n\t }\n\n\t this.options = options;\n\t this.loose = !!options.loose;\n\t this.includePrerelease = !!options.includePrerelease;\n\n\t // First, split based on boolean or ||\n\t this.raw = range;\n\t this.set = range\n\t .split('||')\n\t // map the range to a 2d array of comparators\n\t .map(r => this.parseRange(r.trim()))\n\t // throw out any comparator lists that are empty\n\t // this generally means that it was not a valid range, which is allowed\n\t // in loose mode, but will still throw if the WHOLE range is invalid.\n\t .filter(c => c.length);\n\n\t if (!this.set.length) {\n\t throw new TypeError(`Invalid SemVer Range: ${range}`)\n\t }\n\n\t // if we have any that are not the null set, throw out null sets.\n\t if (this.set.length > 1) {\n\t // keep the first one, in case they're all null sets\n\t const first = this.set[0];\n\t this.set = this.set.filter(c => !isNullSet(c[0]));\n\t if (this.set.length === 0) {\n\t this.set = [first];\n\t } else if (this.set.length > 1) {\n\t // if we have any that are *, then the range is just *\n\t for (const c of this.set) {\n\t if (c.length === 1 && isAny(c[0])) {\n\t this.set = [c];\n\t break\n\t }\n\t }\n\t }\n\t }\n\n\t this.format();\n\t }\n\n\t format () {\n\t this.range = this.set\n\t .map((comps) => {\n\t return comps.join(' ').trim()\n\t })\n\t .join('||')\n\t .trim();\n\t return this.range\n\t }\n\n\t toString () {\n\t return this.range\n\t }\n\n\t parseRange (range) {\n\t range = range.trim();\n\n\t // memoize range parsing for performance.\n\t // this is a very hot path, and fully deterministic.\n\t const memoOpts = Object.keys(this.options).join(',');\n\t const memoKey = `parseRange:${memoOpts}:${range}`;\n\t const cached = cache.get(memoKey);\n\t if (cached) {\n\t return cached\n\t }\n\n\t const loose = this.options.loose;\n\t // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n\t const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];\n\t range = range.replace(hr, hyphenReplace(this.options.includePrerelease));\n\t debug('hyphen replace', range);\n\t // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n\t range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);\n\t debug('comparator trim', range);\n\n\t // `~ 1.2.3` => `~1.2.3`\n\t range = range.replace(re[t.TILDETRIM], tildeTrimReplace);\n\n\t // `^ 1.2.3` => `^1.2.3`\n\t range = range.replace(re[t.CARETTRIM], caretTrimReplace);\n\n\t // normalize spaces\n\t range = range.split(/\\s+/).join(' ');\n\n\t // At this point, the range is completely trimmed and\n\t // ready to be split into comparators.\n\n\t let rangeList = range\n\t .split(' ')\n\t .map(comp => parseComparator(comp, this.options))\n\t .join(' ')\n\t .split(/\\s+/)\n\t // >=0.0.0 is equivalent to *\n\t .map(comp => replaceGTE0(comp, this.options));\n\n\t if (loose) {\n\t // in loose mode, throw out any that are not valid comparators\n\t rangeList = rangeList.filter(comp => {\n\t debug('loose invalid filter', comp, this.options);\n\t return !!comp.match(re[t.COMPARATORLOOSE])\n\t });\n\t }\n\t debug('range list', rangeList);\n\n\t // if any comparators are the null set, then replace with JUST null set\n\t // if more than one comparator, remove any * comparators\n\t // also, don't include the same comparator more than once\n\t const rangeMap = new Map();\n\t const comparators = rangeList.map(comp => new Comparator(comp, this.options));\n\t for (const comp of comparators) {\n\t if (isNullSet(comp)) {\n\t return [comp]\n\t }\n\t rangeMap.set(comp.value, comp);\n\t }\n\t if (rangeMap.size > 1 && rangeMap.has('')) {\n\t rangeMap.delete('');\n\t }\n\n\t const result = [...rangeMap.values()];\n\t cache.set(memoKey, result);\n\t return result\n\t }\n\n\t intersects (range, options) {\n\t if (!(range instanceof Range)) {\n\t throw new TypeError('a Range is required')\n\t }\n\n\t return this.set.some((thisComparators) => {\n\t return (\n\t isSatisfiable(thisComparators, options) &&\n\t range.set.some((rangeComparators) => {\n\t return (\n\t isSatisfiable(rangeComparators, options) &&\n\t thisComparators.every((thisComparator) => {\n\t return rangeComparators.every((rangeComparator) => {\n\t return thisComparator.intersects(rangeComparator, options)\n\t })\n\t })\n\t )\n\t })\n\t )\n\t })\n\t }\n\n\t // if ANY of the sets match ALL of its comparators, then pass\n\t test (version) {\n\t if (!version) {\n\t return false\n\t }\n\n\t if (typeof version === 'string') {\n\t try {\n\t version = new SemVer(version, this.options);\n\t } catch (er) {\n\t return false\n\t }\n\t }\n\n\t for (let i = 0; i < this.set.length; i++) {\n\t if (testSet(this.set[i], version, this.options)) {\n\t return true\n\t }\n\t }\n\t return false\n\t }\n\t}\n\trange = Range;\n\n\tconst LRU = requireLruCache();\n\tconst cache = new LRU({ max: 1000 });\n\n\tconst parseOptions = parseOptions_1;\n\tconst Comparator = requireComparator();\n\tconst debug = debug_1;\n\tconst SemVer = semver$2;\n\tconst {\n\t re,\n\t t,\n\t comparatorTrimReplace,\n\t tildeTrimReplace,\n\t caretTrimReplace,\n\t} = re$3.exports;\n\n\tconst isNullSet = c => c.value === '<0.0.0-0';\n\tconst isAny = c => c.value === '';\n\n\t// take a set of comparators and determine whether there\n\t// exists a version which can satisfy it\n\tconst isSatisfiable = (comparators, options) => {\n\t let result = true;\n\t const remainingComparators = comparators.slice();\n\t let testComparator = remainingComparators.pop();\n\n\t while (result && remainingComparators.length) {\n\t result = remainingComparators.every((otherComparator) => {\n\t return testComparator.intersects(otherComparator, options)\n\t });\n\n\t testComparator = remainingComparators.pop();\n\t }\n\n\t return result\n\t};\n\n\t// comprised of xranges, tildes, stars, and gtlt's at this point.\n\t// already replaced the hyphen ranges\n\t// turn into a set of JUST comparators.\n\tconst parseComparator = (comp, options) => {\n\t debug('comp', comp, options);\n\t comp = replaceCarets(comp, options);\n\t debug('caret', comp);\n\t comp = replaceTildes(comp, options);\n\t debug('tildes', comp);\n\t comp = replaceXRanges(comp, options);\n\t debug('xrange', comp);\n\t comp = replaceStars(comp, options);\n\t debug('stars', comp);\n\t return comp\n\t};\n\n\tconst isX = id => !id || id.toLowerCase() === 'x' || id === '*';\n\n\t// ~, ~> --> * (any, kinda silly)\n\t// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n\t// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n\t// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n\t// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n\t// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n\tconst replaceTildes = (comp, options) =>\n\t comp.trim().split(/\\s+/).map((c) => {\n\t return replaceTilde(c, options)\n\t }).join(' ');\n\n\tconst replaceTilde = (comp, options) => {\n\t const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];\n\t return comp.replace(r, (_, M, m, p, pr) => {\n\t debug('tilde', comp, _, M, m, p, pr);\n\t let ret;\n\n\t if (isX(M)) {\n\t ret = '';\n\t } else if (isX(m)) {\n\t ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;\n\t } else if (isX(p)) {\n\t // ~1.2 == >=1.2.0 <1.3.0-0\n\t ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;\n\t } else if (pr) {\n\t debug('replaceTilde pr', pr);\n\t ret = `>=${M}.${m}.${p}-${pr\n\t } <${M}.${+m + 1}.0-0`;\n\t } else {\n\t // ~1.2.3 == >=1.2.3 <1.3.0-0\n\t ret = `>=${M}.${m}.${p\n\t } <${M}.${+m + 1}.0-0`;\n\t }\n\n\t debug('tilde return', ret);\n\t return ret\n\t })\n\t};\n\n\t// ^ --> * (any, kinda silly)\n\t// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n\t// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n\t// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n\t// ^1.2.3 --> >=1.2.3 <2.0.0-0\n\t// ^1.2.0 --> >=1.2.0 <2.0.0-0\n\tconst replaceCarets = (comp, options) =>\n\t comp.trim().split(/\\s+/).map((c) => {\n\t return replaceCaret(c, options)\n\t }).join(' ');\n\n\tconst replaceCaret = (comp, options) => {\n\t debug('caret', comp, options);\n\t const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];\n\t const z = options.includePrerelease ? '-0' : '';\n\t return comp.replace(r, (_, M, m, p, pr) => {\n\t debug('caret', comp, _, M, m, p, pr);\n\t let ret;\n\n\t if (isX(M)) {\n\t ret = '';\n\t } else if (isX(m)) {\n\t ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;\n\t } else if (isX(p)) {\n\t if (M === '0') {\n\t ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;\n\t } else {\n\t ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;\n\t }\n\t } else if (pr) {\n\t debug('replaceCaret pr', pr);\n\t if (M === '0') {\n\t if (m === '0') {\n\t ret = `>=${M}.${m}.${p}-${pr\n\t } <${M}.${m}.${+p + 1}-0`;\n\t } else {\n\t ret = `>=${M}.${m}.${p}-${pr\n\t } <${M}.${+m + 1}.0-0`;\n\t }\n\t } else {\n\t ret = `>=${M}.${m}.${p}-${pr\n\t } <${+M + 1}.0.0-0`;\n\t }\n\t } else {\n\t debug('no pr');\n\t if (M === '0') {\n\t if (m === '0') {\n\t ret = `>=${M}.${m}.${p\n\t }${z} <${M}.${m}.${+p + 1}-0`;\n\t } else {\n\t ret = `>=${M}.${m}.${p\n\t }${z} <${M}.${+m + 1}.0-0`;\n\t }\n\t } else {\n\t ret = `>=${M}.${m}.${p\n\t } <${+M + 1}.0.0-0`;\n\t }\n\t }\n\n\t debug('caret return', ret);\n\t return ret\n\t })\n\t};\n\n\tconst replaceXRanges = (comp, options) => {\n\t debug('replaceXRanges', comp, options);\n\t return comp.split(/\\s+/).map((c) => {\n\t return replaceXRange(c, options)\n\t }).join(' ')\n\t};\n\n\tconst replaceXRange = (comp, options) => {\n\t comp = comp.trim();\n\t const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];\n\t return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n\t debug('xRange', comp, ret, gtlt, M, m, p, pr);\n\t const xM = isX(M);\n\t const xm = xM || isX(m);\n\t const xp = xm || isX(p);\n\t const anyX = xp;\n\n\t if (gtlt === '=' && anyX) {\n\t gtlt = '';\n\t }\n\n\t // if we're including prereleases in the match, then we need\n\t // to fix this to -0, the lowest possible prerelease value\n\t pr = options.includePrerelease ? '-0' : '';\n\n\t if (xM) {\n\t if (gtlt === '>' || gtlt === '<') {\n\t // nothing is allowed\n\t ret = '<0.0.0-0';\n\t } else {\n\t // nothing is forbidden\n\t ret = '*';\n\t }\n\t } else if (gtlt && anyX) {\n\t // we know patch is an x, because we have any x at all.\n\t // replace X with 0\n\t if (xm) {\n\t m = 0;\n\t }\n\t p = 0;\n\n\t if (gtlt === '>') {\n\t // >1 => >=2.0.0\n\t // >1.2 => >=1.3.0\n\t gtlt = '>=';\n\t if (xm) {\n\t M = +M + 1;\n\t m = 0;\n\t p = 0;\n\t } else {\n\t m = +m + 1;\n\t p = 0;\n\t }\n\t } else if (gtlt === '<=') {\n\t // <=0.7.x is actually <0.8.0, since any 0.7.x should\n\t // pass. Similarly, <=7.x is actually <8.0.0, etc.\n\t gtlt = '<';\n\t if (xm) {\n\t M = +M + 1;\n\t } else {\n\t m = +m + 1;\n\t }\n\t }\n\n\t if (gtlt === '<') {\n\t pr = '-0';\n\t }\n\n\t ret = `${gtlt + M}.${m}.${p}${pr}`;\n\t } else if (xm) {\n\t ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;\n\t } else if (xp) {\n\t ret = `>=${M}.${m}.0${pr\n\t } <${M}.${+m + 1}.0-0`;\n\t }\n\n\t debug('xRange return', ret);\n\n\t return ret\n\t })\n\t};\n\n\t// Because * is AND-ed with everything else in the comparator,\n\t// and '' means \"any version\", just remove the *s entirely.\n\tconst replaceStars = (comp, options) => {\n\t debug('replaceStars', comp, options);\n\t // Looseness is ignored here. star is always as loose as it gets!\n\t return comp.trim().replace(re[t.STAR], '')\n\t};\n\n\tconst replaceGTE0 = (comp, options) => {\n\t debug('replaceGTE0', comp, options);\n\t return comp.trim()\n\t .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n\t};\n\n\t// This function is passed to string.replace(re[t.HYPHENRANGE])\n\t// M, m, patch, prerelease, build\n\t// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n\t// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n\t// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n\tconst hyphenReplace = incPr => ($0,\n\t from, fM, fm, fp, fpr, fb,\n\t to, tM, tm, tp, tpr, tb) => {\n\t if (isX(fM)) {\n\t from = '';\n\t } else if (isX(fm)) {\n\t from = `>=${fM}.0.0${incPr ? '-0' : ''}`;\n\t } else if (isX(fp)) {\n\t from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`;\n\t } else if (fpr) {\n\t from = `>=${from}`;\n\t } else {\n\t from = `>=${from}${incPr ? '-0' : ''}`;\n\t }\n\n\t if (isX(tM)) {\n\t to = '';\n\t } else if (isX(tm)) {\n\t to = `<${+tM + 1}.0.0-0`;\n\t } else if (isX(tp)) {\n\t to = `<${tM}.${+tm + 1}.0-0`;\n\t } else if (tpr) {\n\t to = `<=${tM}.${tm}.${tp}-${tpr}`;\n\t } else if (incPr) {\n\t to = `<${tM}.${tm}.${+tp + 1}-0`;\n\t } else {\n\t to = `<=${to}`;\n\t }\n\n\t return (`${from} ${to}`).trim()\n\t};\n\n\tconst testSet = (set, version, options) => {\n\t for (let i = 0; i < set.length; i++) {\n\t if (!set[i].test(version)) {\n\t return false\n\t }\n\t }\n\n\t if (version.prerelease.length && !options.includePrerelease) {\n\t // Find the set of versions that are allowed to have prereleases\n\t // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n\t // That should allow `1.2.3-pr.2` to pass.\n\t // However, `1.2.4-alpha.notready` should NOT be allowed,\n\t // even though it's within the range set by the comparators.\n\t for (let i = 0; i < set.length; i++) {\n\t debug(set[i].semver);\n\t if (set[i].semver === Comparator.ANY) {\n\t continue\n\t }\n\n\t if (set[i].semver.prerelease.length > 0) {\n\t const allowed = set[i].semver;\n\t if (allowed.major === version.major &&\n\t allowed.minor === version.minor &&\n\t allowed.patch === version.patch) {\n\t return true\n\t }\n\t }\n\t }\n\n\t // Version has a -pre, but it's not one of the ones we like.\n\t return false\n\t }\n\n\t return true\n\t};\n\treturn range;\n}\n\nvar comparator;\nvar hasRequiredComparator;\n\nfunction requireComparator () {\n\tif (hasRequiredComparator) return comparator;\n\thasRequiredComparator = 1;\n\tconst ANY = Symbol('SemVer ANY');\n\t// hoisted class for cyclic dependency\n\tclass Comparator {\n\t static get ANY () {\n\t return ANY\n\t }\n\n\t constructor (comp, options) {\n\t options = parseOptions(options);\n\n\t if (comp instanceof Comparator) {\n\t if (comp.loose === !!options.loose) {\n\t return comp\n\t } else {\n\t comp = comp.value;\n\t }\n\t }\n\n\t debug('comparator', comp, options);\n\t this.options = options;\n\t this.loose = !!options.loose;\n\t this.parse(comp);\n\n\t if (this.semver === ANY) {\n\t this.value = '';\n\t } else {\n\t this.value = this.operator + this.semver.version;\n\t }\n\n\t debug('comp', this);\n\t }\n\n\t parse (comp) {\n\t const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];\n\t const m = comp.match(r);\n\n\t if (!m) {\n\t throw new TypeError(`Invalid comparator: ${comp}`)\n\t }\n\n\t this.operator = m[1] !== undefined ? m[1] : '';\n\t if (this.operator === '=') {\n\t this.operator = '';\n\t }\n\n\t // if it literally is just '>' or '' then allow anything.\n\t if (!m[2]) {\n\t this.semver = ANY;\n\t } else {\n\t this.semver = new SemVer(m[2], this.options.loose);\n\t }\n\t }\n\n\t toString () {\n\t return this.value\n\t }\n\n\t test (version) {\n\t debug('Comparator.test', version, this.options.loose);\n\n\t if (this.semver === ANY || version === ANY) {\n\t return true\n\t }\n\n\t if (typeof version === 'string') {\n\t try {\n\t version = new SemVer(version, this.options);\n\t } catch (er) {\n\t return false\n\t }\n\t }\n\n\t return cmp(version, this.operator, this.semver, this.options)\n\t }\n\n\t intersects (comp, options) {\n\t if (!(comp instanceof Comparator)) {\n\t throw new TypeError('a Comparator is required')\n\t }\n\n\t if (!options || typeof options !== 'object') {\n\t options = {\n\t loose: !!options,\n\t includePrerelease: false,\n\t };\n\t }\n\n\t if (this.operator === '') {\n\t if (this.value === '') {\n\t return true\n\t }\n\t return new Range(comp.value, options).test(this.value)\n\t } else if (comp.operator === '') {\n\t if (comp.value === '') {\n\t return true\n\t }\n\t return new Range(this.value, options).test(comp.semver)\n\t }\n\n\t const sameDirectionIncreasing =\n\t (this.operator === '>=' || this.operator === '>') &&\n\t (comp.operator === '>=' || comp.operator === '>');\n\t const sameDirectionDecreasing =\n\t (this.operator === '<=' || this.operator === '<') &&\n\t (comp.operator === '<=' || comp.operator === '<');\n\t const sameSemVer = this.semver.version === comp.semver.version;\n\t const differentDirectionsInclusive =\n\t (this.operator === '>=' || this.operator === '<=') &&\n\t (comp.operator === '>=' || comp.operator === '<=');\n\t const oppositeDirectionsLessThan =\n\t cmp(this.semver, '<', comp.semver, options) &&\n\t (this.operator === '>=' || this.operator === '>') &&\n\t (comp.operator === '<=' || comp.operator === '<');\n\t const oppositeDirectionsGreaterThan =\n\t cmp(this.semver, '>', comp.semver, options) &&\n\t (this.operator === '<=' || this.operator === '<') &&\n\t (comp.operator === '>=' || comp.operator === '>');\n\n\t return (\n\t sameDirectionIncreasing ||\n\t sameDirectionDecreasing ||\n\t (sameSemVer && differentDirectionsInclusive) ||\n\t oppositeDirectionsLessThan ||\n\t oppositeDirectionsGreaterThan\n\t )\n\t }\n\t}\n\n\tcomparator = Comparator;\n\n\tconst parseOptions = parseOptions_1;\n\tconst { re, t } = re$3.exports;\n\tconst cmp = cmp_1;\n\tconst debug = debug_1;\n\tconst SemVer = semver$2;\n\tconst Range = requireRange();\n\treturn comparator;\n}\n\nconst Range$8 = requireRange();\nconst satisfies$3 = (version, range, options) => {\n try {\n range = new Range$8(range, options);\n } catch (er) {\n return false\n }\n return range.test(version)\n};\nvar satisfies_1 = satisfies$3;\n\nconst Range$7 = requireRange();\n\n// Mostly just for testing and legacy API reasons\nconst toComparators = (range, options) =>\n new Range$7(range, options).set\n .map(comp => comp.map(c => c.value).join(' ').trim().split(' '));\n\nvar toComparators_1 = toComparators;\n\nconst SemVer$3 = semver$2;\nconst Range$6 = requireRange();\n\nconst maxSatisfying = (versions, range, options) => {\n let max = null;\n let maxSV = null;\n let rangeObj = null;\n try {\n rangeObj = new Range$6(range, options);\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!max || maxSV.compare(v) === -1) {\n // compare(max, v, true)\n max = v;\n maxSV = new SemVer$3(max, options);\n }\n }\n });\n return max\n};\nvar maxSatisfying_1 = maxSatisfying;\n\nconst SemVer$2 = semver$2;\nconst Range$5 = requireRange();\nconst minSatisfying = (versions, range, options) => {\n let min = null;\n let minSV = null;\n let rangeObj = null;\n try {\n rangeObj = new Range$5(range, options);\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!min || minSV.compare(v) === 1) {\n // compare(min, v, true)\n min = v;\n minSV = new SemVer$2(min, options);\n }\n }\n });\n return min\n};\nvar minSatisfying_1 = minSatisfying;\n\nconst SemVer$1 = semver$2;\nconst Range$4 = requireRange();\nconst gt$1 = gt_1;\n\nconst minVersion = (range, loose) => {\n range = new Range$4(range, loose);\n\n let minver = new SemVer$1('0.0.0');\n if (range.test(minver)) {\n return minver\n }\n\n minver = new SemVer$1('0.0.0-0');\n if (range.test(minver)) {\n return minver\n }\n\n minver = null;\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i];\n\n let setMin = null;\n comparators.forEach((comparator) => {\n // Clone to avoid manipulating the comparator's semver object.\n const compver = new SemVer$1(comparator.semver.version);\n switch (comparator.operator) {\n case '>':\n if (compver.prerelease.length === 0) {\n compver.patch++;\n } else {\n compver.prerelease.push(0);\n }\n compver.raw = compver.format();\n /* fallthrough */\n case '':\n case '>=':\n if (!setMin || gt$1(compver, setMin)) {\n setMin = compver;\n }\n break\n case '<':\n case '<=':\n /* Ignore maximum versions */\n break\n /* istanbul ignore next */\n default:\n throw new Error(`Unexpected operation: ${comparator.operator}`)\n }\n });\n if (setMin && (!minver || gt$1(minver, setMin))) {\n minver = setMin;\n }\n }\n\n if (minver && range.test(minver)) {\n return minver\n }\n\n return null\n};\nvar minVersion_1 = minVersion;\n\nconst Range$3 = requireRange();\nconst validRange = (range, options) => {\n try {\n // Return '*' instead of '' so that truthiness works.\n // This will throw if it's invalid anyway\n return new Range$3(range, options).range || '*'\n } catch (er) {\n return null\n }\n};\nvar valid = validRange;\n\nconst SemVer = semver$2;\nconst Comparator$1 = requireComparator();\nconst { ANY: ANY$1 } = Comparator$1;\nconst Range$2 = requireRange();\nconst satisfies$2 = satisfies_1;\nconst gt = gt_1;\nconst lt = lt_1;\nconst lte = lte_1;\nconst gte = gte_1;\n\nconst outside$2 = (version, range, hilo, options) => {\n version = new SemVer(version, options);\n range = new Range$2(range, options);\n\n let gtfn, ltefn, ltfn, comp, ecomp;\n switch (hilo) {\n case '>':\n gtfn = gt;\n ltefn = lte;\n ltfn = lt;\n comp = '>';\n ecomp = '>=';\n break\n case '<':\n gtfn = lt;\n ltefn = gte;\n ltfn = gt;\n comp = '<';\n ecomp = '<=';\n break\n default:\n throw new TypeError('Must provide a hilo val of \"<\" or \">\"')\n }\n\n // If it satisfies the range it is not outside\n if (satisfies$2(version, range, options)) {\n return false\n }\n\n // From now on, variable terms are as if we're in \"gtr\" mode.\n // but note that everything is flipped for the \"ltr\" function.\n\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i];\n\n let high = null;\n let low = null;\n\n comparators.forEach((comparator) => {\n if (comparator.semver === ANY$1) {\n comparator = new Comparator$1('>=0.0.0');\n }\n high = high || comparator;\n low = low || comparator;\n if (gtfn(comparator.semver, high.semver, options)) {\n high = comparator;\n } else if (ltfn(comparator.semver, low.semver, options)) {\n low = comparator;\n }\n });\n\n // If the edge version comparator has a operator then our version\n // isn't outside it\n if (high.operator === comp || high.operator === ecomp) {\n return false\n }\n\n // If the lowest version comparator has an operator and our version\n // is less than it then it isn't higher than the range\n if ((!low.operator || low.operator === comp) &&\n ltefn(version, low.semver)) {\n return false\n } else if (low.operator === ecomp && ltfn(version, low.semver)) {\n return false\n }\n }\n return true\n};\n\nvar outside_1 = outside$2;\n\n// Determine if version is greater than all the versions possible in the range.\nconst outside$1 = outside_1;\nconst gtr = (version, range, options) => outside$1(version, range, '>', options);\nvar gtr_1 = gtr;\n\nconst outside = outside_1;\n// Determine if version is less than all the versions possible in the range\nconst ltr = (version, range, options) => outside(version, range, '<', options);\nvar ltr_1 = ltr;\n\nconst Range$1 = requireRange();\nconst intersects = (r1, r2, options) => {\n r1 = new Range$1(r1, options);\n r2 = new Range$1(r2, options);\n return r1.intersects(r2)\n};\nvar intersects_1 = intersects;\n\n// given a set of versions and a range, create a \"simplified\" range\n// that includes the same versions that the original range does\n// If the original range is shorter than the simplified one, return that.\nconst satisfies$1 = satisfies_1;\nconst compare$1 = compare_1;\nvar simplify = (versions, range, options) => {\n const set = [];\n let first = null;\n let prev = null;\n const v = versions.sort((a, b) => compare$1(a, b, options));\n for (const version of v) {\n const included = satisfies$1(version, range, options);\n if (included) {\n prev = version;\n if (!first) {\n first = version;\n }\n } else {\n if (prev) {\n set.push([first, prev]);\n }\n prev = null;\n first = null;\n }\n }\n if (first) {\n set.push([first, null]);\n }\n\n const ranges = [];\n for (const [min, max] of set) {\n if (min === max) {\n ranges.push(min);\n } else if (!max && min === v[0]) {\n ranges.push('*');\n } else if (!max) {\n ranges.push(`>=${min}`);\n } else if (min === v[0]) {\n ranges.push(`<=${max}`);\n } else {\n ranges.push(`${min} - ${max}`);\n }\n }\n const simplified = ranges.join(' || ');\n const original = typeof range.raw === 'string' ? range.raw : String(range);\n return simplified.length < original.length ? simplified : range\n};\n\nconst Range = requireRange();\nconst Comparator = requireComparator();\nconst { ANY } = Comparator;\nconst satisfies = satisfies_1;\nconst compare = compare_1;\n\n// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:\n// - Every simple range `r1, r2, ...` is a null set, OR\n// - Every simple range `r1, r2, ...` which is not a null set is a subset of\n// some `R1, R2, ...`\n//\n// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:\n// - If c is only the ANY comparator\n// - If C is only the ANY comparator, return true\n// - Else if in prerelease mode, return false\n// - else replace c with `[>=0.0.0]`\n// - If C is only the ANY comparator\n// - if in prerelease mode, return true\n// - else replace C with `[>=0.0.0]`\n// - Let EQ be the set of = comparators in c\n// - If EQ is more than one, return true (null set)\n// - Let GT be the highest > or >= comparator in c\n// - Let LT be the lowest < or <= comparator in c\n// - If GT and LT, and GT.semver > LT.semver, return true (null set)\n// - If any C is a = range, and GT or LT are set, return false\n// - If EQ\n// - If GT, and EQ does not satisfy GT, return true (null set)\n// - If LT, and EQ does not satisfy LT, return true (null set)\n// - If EQ satisfies every C, return true\n// - Else return false\n// - If GT\n// - If GT.semver is lower than any > or >= comp in C, return false\n// - If GT is >=, and GT.semver does not satisfy every C, return false\n// - If GT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the GT.semver tuple, return false\n// - If LT\n// - If LT.semver is greater than any < or <= comp in C, return false\n// - If LT is <=, and LT.semver does not satisfy every C, return false\n// - If GT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the LT.semver tuple, return false\n// - Else return true\n\nconst subset = (sub, dom, options = {}) => {\n if (sub === dom) {\n return true\n }\n\n sub = new Range(sub, options);\n dom = new Range(dom, options);\n let sawNonNull = false;\n\n OUTER: for (const simpleSub of sub.set) {\n for (const simpleDom of dom.set) {\n const isSub = simpleSubset(simpleSub, simpleDom, options);\n sawNonNull = sawNonNull || isSub !== null;\n if (isSub) {\n continue OUTER\n }\n }\n // the null set is a subset of everything, but null simple ranges in\n // a complex range should be ignored. so if we saw a non-null range,\n // then we know this isn't a subset, but if EVERY simple range was null,\n // then it is a subset.\n if (sawNonNull) {\n return false\n }\n }\n return true\n};\n\nconst simpleSubset = (sub, dom, options) => {\n if (sub === dom) {\n return true\n }\n\n if (sub.length === 1 && sub[0].semver === ANY) {\n if (dom.length === 1 && dom[0].semver === ANY) {\n return true\n } else if (options.includePrerelease) {\n sub = [new Comparator('>=0.0.0-0')];\n } else {\n sub = [new Comparator('>=0.0.0')];\n }\n }\n\n if (dom.length === 1 && dom[0].semver === ANY) {\n if (options.includePrerelease) {\n return true\n } else {\n dom = [new Comparator('>=0.0.0')];\n }\n }\n\n const eqSet = new Set();\n let gt, lt;\n for (const c of sub) {\n if (c.operator === '>' || c.operator === '>=') {\n gt = higherGT(gt, c, options);\n } else if (c.operator === '<' || c.operator === '<=') {\n lt = lowerLT(lt, c, options);\n } else {\n eqSet.add(c.semver);\n }\n }\n\n if (eqSet.size > 1) {\n return null\n }\n\n let gtltComp;\n if (gt && lt) {\n gtltComp = compare(gt.semver, lt.semver, options);\n if (gtltComp > 0) {\n return null\n } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {\n return null\n }\n }\n\n // will iterate one or zero times\n for (const eq of eqSet) {\n if (gt && !satisfies(eq, String(gt), options)) {\n return null\n }\n\n if (lt && !satisfies(eq, String(lt), options)) {\n return null\n }\n\n for (const c of dom) {\n if (!satisfies(eq, String(c), options)) {\n return false\n }\n }\n\n return true\n }\n\n let higher, lower;\n let hasDomLT, hasDomGT;\n // if the subset has a prerelease, we need a comparator in the superset\n // with the same tuple and a prerelease, or it's not a subset\n let needDomLTPre = lt &&\n !options.includePrerelease &&\n lt.semver.prerelease.length ? lt.semver : false;\n let needDomGTPre = gt &&\n !options.includePrerelease &&\n gt.semver.prerelease.length ? gt.semver : false;\n // exception: <1.2.3-0 is the same as <1.2.3\n if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&\n lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {\n needDomLTPre = false;\n }\n\n for (const c of dom) {\n hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=';\n hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=';\n if (gt) {\n if (needDomGTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomGTPre.major &&\n c.semver.minor === needDomGTPre.minor &&\n c.semver.patch === needDomGTPre.patch) {\n needDomGTPre = false;\n }\n }\n if (c.operator === '>' || c.operator === '>=') {\n higher = higherGT(gt, c, options);\n if (higher === c && higher !== gt) {\n return false\n }\n } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {\n return false\n }\n }\n if (lt) {\n if (needDomLTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomLTPre.major &&\n c.semver.minor === needDomLTPre.minor &&\n c.semver.patch === needDomLTPre.patch) {\n needDomLTPre = false;\n }\n }\n if (c.operator === '<' || c.operator === '<=') {\n lower = lowerLT(lt, c, options);\n if (lower === c && lower !== lt) {\n return false\n }\n } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {\n return false\n }\n }\n if (!c.operator && (lt || gt) && gtltComp !== 0) {\n return false\n }\n }\n\n // if there was a < or >, and nothing in the dom, then must be false\n // UNLESS it was limited by another range in the other direction.\n // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0\n if (gt && hasDomLT && !lt && gtltComp !== 0) {\n return false\n }\n\n if (lt && hasDomGT && !gt && gtltComp !== 0) {\n return false\n }\n\n // we needed a prerelease range in a specific tuple, but didn't get one\n // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,\n // because it includes prereleases in the 1.2.3 tuple\n if (needDomGTPre || needDomLTPre) {\n return false\n }\n\n return true\n};\n\n// >=1.2.3 is lower than >1.2.3\nconst higherGT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options);\n return comp > 0 ? a\n : comp < 0 ? b\n : b.operator === '>' && a.operator === '>=' ? b\n : a\n};\n\n// <=1.2.3 is higher than <1.2.3\nconst lowerLT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options);\n return comp < 0 ? a\n : comp > 0 ? b\n : b.operator === '<' && a.operator === '<=' ? b\n : a\n};\n\nvar subset_1 = subset;\n\n// just pre-load all the stuff that index.js lazily exports\nconst internalRe = re$3.exports;\nvar semver$1 = {\n re: internalRe.re,\n src: internalRe.src,\n tokens: internalRe.t,\n SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,\n SemVer: semver$2,\n compareIdentifiers: identifiers.compareIdentifiers,\n rcompareIdentifiers: identifiers.rcompareIdentifiers,\n parse: parse_1,\n valid: valid_1,\n clean: clean_1,\n inc: inc_1,\n diff: diff_1,\n major: major_1,\n minor: minor_1,\n patch: patch_1,\n prerelease: prerelease_1,\n compare: compare_1,\n rcompare: rcompare_1,\n compareLoose: compareLoose_1,\n compareBuild: compareBuild_1,\n sort: sort_1,\n rsort: rsort_1,\n gt: gt_1,\n lt: lt_1,\n eq: eq_1,\n neq: neq_1,\n gte: gte_1,\n lte: lte_1,\n cmp: cmp_1,\n coerce: coerce_1,\n Comparator: requireComparator(),\n Range: requireRange(),\n satisfies: satisfies_1,\n toComparators: toComparators_1,\n maxSatisfying: maxSatisfying_1,\n minSatisfying: minSatisfying_1,\n minVersion: minVersion_1,\n validRange: valid,\n outside: outside_1,\n gtr: gtr_1,\n ltr: ltr_1,\n intersects: intersects_1,\n simplifyRange: simplify,\n subset: subset_1,\n};\n\nvar semver = semver$1;\n\nvar builtins = function ({\n version = process.version,\n experimental = false\n} = {}) {\n var coreModules = [\n 'assert',\n 'buffer',\n 'child_process',\n 'cluster',\n 'console',\n 'constants',\n 'crypto',\n 'dgram',\n 'dns',\n 'domain',\n 'events',\n 'fs',\n 'http',\n 'https',\n 'module',\n 'net',\n 'os',\n 'path',\n 'punycode',\n 'querystring',\n 'readline',\n 'repl',\n 'stream',\n 'string_decoder',\n 'sys',\n 'timers',\n 'tls',\n 'tty',\n 'url',\n 'util',\n 'vm',\n 'zlib'\n ];\n\n if (semver.lt(version, '6.0.0')) coreModules.push('freelist');\n if (semver.gte(version, '1.0.0')) coreModules.push('v8');\n if (semver.gte(version, '1.1.0')) coreModules.push('process');\n if (semver.gte(version, '8.0.0')) coreModules.push('inspector');\n if (semver.gte(version, '8.1.0')) coreModules.push('async_hooks');\n if (semver.gte(version, '8.4.0')) coreModules.push('http2');\n if (semver.gte(version, '8.5.0')) coreModules.push('perf_hooks');\n if (semver.gte(version, '10.0.0')) coreModules.push('trace_events');\n\n if (\n semver.gte(version, '10.5.0') &&\n (experimental || semver.gte(version, '12.0.0'))\n ) {\n coreModules.push('worker_threads');\n }\n if (semver.gte(version, '12.16.0') && experimental) {\n coreModules.push('wasi');\n }\n \n return coreModules\n};\n\n// Manually “tree shaken” from:\n\nconst reader = {read};\n\n/**\n * @param {string} jsonPath\n * @returns {{string: string}}\n */\nfunction read(jsonPath) {\n return find(path.dirname(jsonPath))\n}\n\n/**\n * @param {string} dir\n * @returns {{string: string}}\n */\nfunction find(dir) {\n try {\n const string = fs.readFileSync(\n path.toNamespacedPath(path.join(dir, 'package.json')),\n 'utf8'\n );\n return {string}\n } catch (error) {\n if (error.code === 'ENOENT') {\n const parent = path.dirname(dir);\n if (dir !== parent) return find(parent)\n return {string: undefined}\n // Throw all other errors.\n /* c8 ignore next 4 */\n }\n\n throw error\n }\n}\n\n// Manually “tree shaken” from:\n\nconst isWindows = process.platform === 'win32';\n\nconst own$1 = {}.hasOwnProperty;\n\nconst codes = {};\n\n/**\n * @typedef {(...args: unknown[]) => string} MessageFunction\n */\n\n/** @type {Map} */\nconst messages = new Map();\nconst nodeInternalPrefix = '__node_internal_';\n/** @type {number} */\nlet userStackTraceLimit;\n\ncodes.ERR_INVALID_MODULE_SPECIFIER = createError(\n 'ERR_INVALID_MODULE_SPECIFIER',\n /**\n * @param {string} request\n * @param {string} reason\n * @param {string} [base]\n */\n (request, reason, base = undefined) => {\n return `Invalid module \"${request}\" ${reason}${\n base ? ` imported from ${base}` : ''\n }`\n },\n TypeError\n);\n\ncodes.ERR_INVALID_PACKAGE_CONFIG = createError(\n 'ERR_INVALID_PACKAGE_CONFIG',\n /**\n * @param {string} path\n * @param {string} [base]\n * @param {string} [message]\n */\n (path, base, message) => {\n return `Invalid package config ${path}${\n base ? ` while importing ${base}` : ''\n }${message ? `. ${message}` : ''}`\n },\n Error\n);\n\ncodes.ERR_INVALID_PACKAGE_TARGET = createError(\n 'ERR_INVALID_PACKAGE_TARGET',\n /**\n * @param {string} pkgPath\n * @param {string} key\n * @param {unknown} target\n * @param {boolean} [isImport=false]\n * @param {string} [base]\n */\n (pkgPath, key, target, isImport = false, base = undefined) => {\n const relError =\n typeof target === 'string' &&\n !isImport &&\n target.length > 0 &&\n !target.startsWith('./');\n if (key === '.') {\n assert(isImport === false);\n return (\n `Invalid \"exports\" main target ${JSON.stringify(target)} defined ` +\n `in the package config ${pkgPath}package.json${\n base ? ` imported from ${base}` : ''\n }${relError ? '; targets must start with \"./\"' : ''}`\n )\n }\n\n return `Invalid \"${\n isImport ? 'imports' : 'exports'\n }\" target ${JSON.stringify(\n target\n )} defined for '${key}' in the package config ${pkgPath}package.json${\n base ? ` imported from ${base}` : ''\n }${relError ? '; targets must start with \"./\"' : ''}`\n },\n Error\n);\n\ncodes.ERR_MODULE_NOT_FOUND = createError(\n 'ERR_MODULE_NOT_FOUND',\n /**\n * @param {string} path\n * @param {string} base\n * @param {string} [type]\n */\n (path, base, type = 'package') => {\n return `Cannot find ${type} '${path}' imported from ${base}`\n },\n Error\n);\n\ncodes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(\n 'ERR_PACKAGE_IMPORT_NOT_DEFINED',\n /**\n * @param {string} specifier\n * @param {string} packagePath\n * @param {string} base\n */\n (specifier, packagePath, base) => {\n return `Package import specifier \"${specifier}\" is not defined${\n packagePath ? ` in package ${packagePath}package.json` : ''\n } imported from ${base}`\n },\n TypeError\n);\n\ncodes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError(\n 'ERR_PACKAGE_PATH_NOT_EXPORTED',\n /**\n * @param {string} pkgPath\n * @param {string} subpath\n * @param {string} [base]\n */\n (pkgPath, subpath, base = undefined) => {\n if (subpath === '.')\n return `No \"exports\" main defined in ${pkgPath}package.json${\n base ? ` imported from ${base}` : ''\n }`\n return `Package subpath '${subpath}' is not defined by \"exports\" in ${pkgPath}package.json${\n base ? ` imported from ${base}` : ''\n }`\n },\n Error\n);\n\ncodes.ERR_UNSUPPORTED_DIR_IMPORT = createError(\n 'ERR_UNSUPPORTED_DIR_IMPORT',\n \"Directory import '%s' is not supported \" +\n 'resolving ES modules imported from %s',\n Error\n);\n\ncodes.ERR_UNKNOWN_FILE_EXTENSION = createError(\n 'ERR_UNKNOWN_FILE_EXTENSION',\n 'Unknown file extension \"%s\" for %s',\n TypeError\n);\n\ncodes.ERR_INVALID_ARG_VALUE = createError(\n 'ERR_INVALID_ARG_VALUE',\n /**\n * @param {string} name\n * @param {unknown} value\n * @param {string} [reason='is invalid']\n */\n (name, value, reason = 'is invalid') => {\n let inspected = inspect(value);\n\n if (inspected.length > 128) {\n inspected = `${inspected.slice(0, 128)}...`;\n }\n\n const type = name.includes('.') ? 'property' : 'argument';\n\n return `The ${type} '${name}' ${reason}. Received ${inspected}`\n },\n TypeError\n // Note: extra classes have been shaken out.\n // , RangeError\n);\n\ncodes.ERR_UNSUPPORTED_ESM_URL_SCHEME = createError(\n 'ERR_UNSUPPORTED_ESM_URL_SCHEME',\n /**\n * @param {URL} url\n */\n (url) => {\n let message =\n 'Only file and data URLs are supported by the default ESM loader';\n\n if (isWindows && url.protocol.length === 2) {\n message += '. On Windows, absolute paths must be valid file:// URLs';\n }\n\n message += `. Received protocol '${url.protocol}'`;\n return message\n },\n Error\n);\n\n/**\n * Utility function for registering the error codes. Only used here. Exported\n * *only* to allow for testing.\n * @param {string} sym\n * @param {MessageFunction|string} value\n * @param {ErrorConstructor} def\n * @returns {new (...args: unknown[]) => Error}\n */\nfunction createError(sym, value, def) {\n // Special case for SystemError that formats the error message differently\n // The SystemErrors only have SystemError as their base classes.\n messages.set(sym, value);\n\n return makeNodeErrorWithCode(def, sym)\n}\n\n/**\n * @param {ErrorConstructor} Base\n * @param {string} key\n * @returns {ErrorConstructor}\n */\nfunction makeNodeErrorWithCode(Base, key) {\n // @ts-expect-error It’s a Node error.\n return NodeError\n /**\n * @param {unknown[]} args\n */\n function NodeError(...args) {\n const limit = Error.stackTraceLimit;\n if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;\n const error = new Base();\n // Reset the limit and setting the name property.\n if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;\n const message = getMessage(key, args, error);\n Object.defineProperty(error, 'message', {\n value: message,\n enumerable: false,\n writable: true,\n configurable: true\n });\n Object.defineProperty(error, 'toString', {\n /** @this {Error} */\n value() {\n return `${this.name} [${key}]: ${this.message}`\n },\n enumerable: false,\n writable: true,\n configurable: true\n });\n addCodeToName(error, Base.name, key);\n // @ts-expect-error It’s a Node error.\n error.code = key;\n return error\n }\n}\n\nconst addCodeToName = hideStackFrames(\n /**\n * @param {Error} error\n * @param {string} name\n * @param {string} code\n * @returns {void}\n */\n function (error, name, code) {\n // Set the stack\n error = captureLargerStackTrace(error);\n // Add the error code to the name to include it in the stack trace.\n error.name = `${name} [${code}]`;\n // Access the stack to generate the error message including the error code\n // from the name.\n error.stack; // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n if (name === 'SystemError') {\n Object.defineProperty(error, 'name', {\n value: name,\n enumerable: false,\n writable: true,\n configurable: true\n });\n } else {\n delete error.name;\n }\n }\n);\n\n/**\n * @returns {boolean}\n */\nfunction isErrorStackTraceLimitWritable() {\n const desc = Object.getOwnPropertyDescriptor(Error, 'stackTraceLimit');\n if (desc === undefined) {\n return Object.isExtensible(Error)\n }\n\n return own$1.call(desc, 'writable') ? desc.writable : desc.set !== undefined\n}\n\n/**\n * This function removes unnecessary frames from Node.js core errors.\n * @template {(...args: unknown[]) => unknown} T\n * @type {(fn: T) => T}\n */\nfunction hideStackFrames(fn) {\n // We rename the functions that will be hidden to cut off the stacktrace\n // at the outermost one\n const hidden = nodeInternalPrefix + fn.name;\n Object.defineProperty(fn, 'name', {value: hidden});\n return fn\n}\n\nconst captureLargerStackTrace = hideStackFrames(\n /**\n * @param {Error} error\n * @returns {Error}\n */\n function (error) {\n const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();\n if (stackTraceLimitIsWritable) {\n userStackTraceLimit = Error.stackTraceLimit;\n Error.stackTraceLimit = Number.POSITIVE_INFINITY;\n }\n\n Error.captureStackTrace(error);\n\n // Reset the limit\n if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;\n\n return error\n }\n);\n\n/**\n * @param {string} key\n * @param {unknown[]} args\n * @param {Error} self\n * @returns {string}\n */\nfunction getMessage(key, args, self) {\n const message = messages.get(key);\n\n if (typeof message === 'function') {\n assert(\n message.length <= args.length, // Default options do not count.\n `Code: ${key}; The provided arguments length (${args.length}) does not ` +\n `match the required ones (${message.length}).`\n );\n return Reflect.apply(message, self, args)\n }\n\n const expectedLength = (message.match(/%[dfijoOs]/g) || []).length;\n assert(\n expectedLength === args.length,\n `Code: ${key}; The provided arguments length (${args.length}) does not ` +\n `match the required ones (${expectedLength}).`\n );\n if (args.length === 0) return message\n\n args.unshift(message);\n return Reflect.apply(format, null, args)\n}\n\n// Manually “tree shaken” from:\n\nconst {ERR_UNKNOWN_FILE_EXTENSION} = codes;\n\nconst extensionFormatMap = {\n __proto__: null,\n '.cjs': 'commonjs',\n '.js': 'module',\n '.mjs': 'module'\n};\n\n/**\n * @param {string} url\n * @returns {{format: string|null}}\n */\nfunction defaultGetFormat(url) {\n if (url.startsWith('node:')) {\n return {format: 'builtin'}\n }\n\n const parsed = new URL(url);\n\n if (parsed.protocol === 'data:') {\n const {1: mime} = /^([^/]+\\/[^;,]+)[^,]*?(;base64)?,/.exec(\n parsed.pathname\n ) || [null, null];\n const format = mime === 'text/javascript' ? 'module' : null;\n return {format}\n }\n\n if (parsed.protocol === 'file:') {\n const ext = path.extname(parsed.pathname);\n /** @type {string} */\n let format;\n if (ext === '.js') {\n format = getPackageType(parsed.href) === 'module' ? 'module' : 'commonjs';\n } else {\n format = extensionFormatMap[ext];\n }\n\n if (!format) {\n throw new ERR_UNKNOWN_FILE_EXTENSION(ext, fileURLToPath(url))\n }\n\n return {format: format || null}\n }\n\n return {format: null}\n}\n\n// Manually “tree shaken” from:\n\nconst listOfBuiltins = builtins();\n\nconst {\n ERR_INVALID_MODULE_SPECIFIER,\n ERR_INVALID_PACKAGE_CONFIG,\n ERR_INVALID_PACKAGE_TARGET,\n ERR_MODULE_NOT_FOUND,\n ERR_PACKAGE_IMPORT_NOT_DEFINED,\n ERR_PACKAGE_PATH_NOT_EXPORTED,\n ERR_UNSUPPORTED_DIR_IMPORT,\n ERR_UNSUPPORTED_ESM_URL_SCHEME,\n ERR_INVALID_ARG_VALUE\n} = codes;\n\nconst own = {}.hasOwnProperty;\n\nconst DEFAULT_CONDITIONS = Object.freeze(['node', 'import']);\nconst DEFAULT_CONDITIONS_SET = new Set(DEFAULT_CONDITIONS);\n\nconst invalidSegmentRegEx = /(^|\\\\|\\/)(\\.\\.?|node_modules)(\\\\|\\/|$)/;\nconst patternRegEx = /\\*/g;\nconst encodedSepRegEx = /%2f|%2c/i;\n/** @type {Set} */\nconst emittedPackageWarnings = new Set();\n/** @type {Map} */\nconst packageJsonCache = new Map();\n\n/**\n * @param {string} match\n * @param {URL} pjsonUrl\n * @param {boolean} isExports\n * @param {URL} base\n * @returns {void}\n */\nfunction emitFolderMapDeprecation(match, pjsonUrl, isExports, base) {\n const pjsonPath = fileURLToPath(pjsonUrl);\n\n if (emittedPackageWarnings.has(pjsonPath + '|' + match)) return\n emittedPackageWarnings.add(pjsonPath + '|' + match);\n process.emitWarning(\n `Use of deprecated folder mapping \"${match}\" in the ${\n isExports ? '\"exports\"' : '\"imports\"'\n } field module resolution of the package at ${pjsonPath}${\n base ? ` imported from ${fileURLToPath(base)}` : ''\n }.\\n` +\n `Update this package.json to use a subpath pattern like \"${match}*\".`,\n 'DeprecationWarning',\n 'DEP0148'\n );\n}\n\n/**\n * @param {URL} url\n * @param {URL} packageJsonUrl\n * @param {URL} base\n * @param {unknown} [main]\n * @returns {void}\n */\nfunction emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {\n const {format} = defaultGetFormat(url.href);\n if (format !== 'module') return\n const path = fileURLToPath(url.href);\n const pkgPath = fileURLToPath(new URL('.', packageJsonUrl));\n const basePath = fileURLToPath(base);\n if (main)\n process.emitWarning(\n `Package ${pkgPath} has a \"main\" field set to ${JSON.stringify(main)}, ` +\n `excluding the full filename and extension to the resolved file at \"${path.slice(\n pkgPath.length\n )}\", imported from ${basePath}.\\n Automatic extension resolution of the \"main\" field is` +\n 'deprecated for ES modules.',\n 'DeprecationWarning',\n 'DEP0151'\n );\n else\n process.emitWarning(\n `No \"main\" or \"exports\" field defined in the package.json for ${pkgPath} resolving the main entry point \"${path.slice(\n pkgPath.length\n )}\", imported from ${basePath}.\\nDefault \"index\" lookups for the main are deprecated for ES modules.`,\n 'DeprecationWarning',\n 'DEP0151'\n );\n}\n\n/**\n * @param {string[]} [conditions]\n * @returns {Set}\n */\nfunction getConditionsSet(conditions) {\n if (conditions !== undefined && conditions !== DEFAULT_CONDITIONS) {\n if (!Array.isArray(conditions)) {\n throw new ERR_INVALID_ARG_VALUE(\n 'conditions',\n conditions,\n 'expected an array'\n )\n }\n\n return new Set(conditions)\n }\n\n return DEFAULT_CONDITIONS_SET\n}\n\n/**\n * @param {string} path\n * @returns {Stats}\n */\nfunction tryStatSync(path) {\n // Note: from Node 15 onwards we can use `throwIfNoEntry: false` instead.\n try {\n return statSync(path)\n } catch {\n return new Stats()\n }\n}\n\n/**\n * @param {string} path\n * @param {string|URL} specifier Note: `specifier` is actually optional, not base.\n * @param {URL} [base]\n * @returns {PackageConfig}\n */\nfunction getPackageConfig(path, specifier, base) {\n const existing = packageJsonCache.get(path);\n if (existing !== undefined) {\n return existing\n }\n\n const source = reader.read(path).string;\n\n if (source === undefined) {\n /** @type {PackageConfig} */\n const packageConfig = {\n pjsonPath: path,\n exists: false,\n main: undefined,\n name: undefined,\n type: 'none',\n exports: undefined,\n imports: undefined\n };\n packageJsonCache.set(path, packageConfig);\n return packageConfig\n }\n\n /** @type {Object.} */\n let packageJson;\n try {\n packageJson = JSON.parse(source);\n } catch (error) {\n throw new ERR_INVALID_PACKAGE_CONFIG(\n path,\n (base ? `\"${specifier}\" from ` : '') + fileURLToPath(base || specifier),\n error.message\n )\n }\n\n const {exports, imports, main, name, type} = packageJson;\n\n /** @type {PackageConfig} */\n const packageConfig = {\n pjsonPath: path,\n exists: true,\n main: typeof main === 'string' ? main : undefined,\n name: typeof name === 'string' ? name : undefined,\n type: type === 'module' || type === 'commonjs' ? type : 'none',\n // @ts-expect-error Assume `Object.`.\n exports,\n // @ts-expect-error Assume `Object.`.\n imports: imports && typeof imports === 'object' ? imports : undefined\n };\n packageJsonCache.set(path, packageConfig);\n return packageConfig\n}\n\n/**\n * @param {URL|string} resolved\n * @returns {PackageConfig}\n */\nfunction getPackageScopeConfig(resolved) {\n let packageJsonUrl = new URL('./package.json', resolved);\n\n while (true) {\n const packageJsonPath = packageJsonUrl.pathname;\n\n if (packageJsonPath.endsWith('node_modules/package.json')) break\n\n const packageConfig = getPackageConfig(\n fileURLToPath(packageJsonUrl),\n resolved\n );\n if (packageConfig.exists) return packageConfig\n\n const lastPackageJsonUrl = packageJsonUrl;\n packageJsonUrl = new URL('../package.json', packageJsonUrl);\n\n // Terminates at root where ../package.json equals ../../package.json\n // (can't just check \"/package.json\" for Windows support).\n if (packageJsonUrl.pathname === lastPackageJsonUrl.pathname) break\n }\n\n const packageJsonPath = fileURLToPath(packageJsonUrl);\n /** @type {PackageConfig} */\n const packageConfig = {\n pjsonPath: packageJsonPath,\n exists: false,\n main: undefined,\n name: undefined,\n type: 'none',\n exports: undefined,\n imports: undefined\n };\n packageJsonCache.set(packageJsonPath, packageConfig);\n return packageConfig\n}\n\n/**\n * Legacy CommonJS main resolution:\n * 1. let M = pkg_url + (json main field)\n * 2. TRY(M, M.js, M.json, M.node)\n * 3. TRY(M/index.js, M/index.json, M/index.node)\n * 4. TRY(pkg_url/index.js, pkg_url/index.json, pkg_url/index.node)\n * 5. NOT_FOUND\n *\n * @param {URL} url\n * @returns {boolean}\n */\nfunction fileExists(url) {\n return tryStatSync(fileURLToPath(url)).isFile()\n}\n\n/**\n * @param {URL} packageJsonUrl\n * @param {PackageConfig} packageConfig\n * @param {URL} base\n * @returns {URL}\n */\nfunction legacyMainResolve(packageJsonUrl, packageConfig, base) {\n /** @type {URL} */\n let guess;\n if (packageConfig.main !== undefined) {\n guess = new URL(`./${packageConfig.main}`, packageJsonUrl);\n // Note: fs check redundances will be handled by Descriptor cache here.\n if (fileExists(guess)) return guess\n\n const tries = [\n `./${packageConfig.main}.js`,\n `./${packageConfig.main}.json`,\n `./${packageConfig.main}.node`,\n `./${packageConfig.main}/index.js`,\n `./${packageConfig.main}/index.json`,\n `./${packageConfig.main}/index.node`\n ];\n let i = -1;\n\n while (++i < tries.length) {\n guess = new URL(tries[i], packageJsonUrl);\n if (fileExists(guess)) break\n guess = undefined;\n }\n\n if (guess) {\n emitLegacyIndexDeprecation(\n guess,\n packageJsonUrl,\n base,\n packageConfig.main\n );\n return guess\n }\n // Fallthrough.\n }\n\n const tries = ['./index.js', './index.json', './index.node'];\n let i = -1;\n\n while (++i < tries.length) {\n guess = new URL(tries[i], packageJsonUrl);\n if (fileExists(guess)) break\n guess = undefined;\n }\n\n if (guess) {\n emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main);\n return guess\n }\n\n // Not found.\n throw new ERR_MODULE_NOT_FOUND(\n fileURLToPath(new URL('.', packageJsonUrl)),\n fileURLToPath(base)\n )\n}\n\n/**\n * @param {URL} resolved\n * @param {URL} base\n * @returns {URL}\n */\nfunction finalizeResolution(resolved, base) {\n if (encodedSepRegEx.test(resolved.pathname))\n throw new ERR_INVALID_MODULE_SPECIFIER(\n resolved.pathname,\n 'must not include encoded \"/\" or \"\\\\\" characters',\n fileURLToPath(base)\n )\n\n const path = fileURLToPath(resolved);\n\n const stats = tryStatSync(path.endsWith('/') ? path.slice(-1) : path);\n\n if (stats.isDirectory()) {\n const error = new ERR_UNSUPPORTED_DIR_IMPORT(path, fileURLToPath(base));\n // @ts-expect-error Add this for `import.meta.resolve`.\n error.url = String(resolved);\n throw error\n }\n\n if (!stats.isFile()) {\n throw new ERR_MODULE_NOT_FOUND(\n path || resolved.pathname,\n base && fileURLToPath(base),\n 'module'\n )\n }\n\n return resolved\n}\n\n/**\n * @param {string} specifier\n * @param {URL?} packageJsonUrl\n * @param {URL} base\n * @returns {never}\n */\nfunction throwImportNotDefined(specifier, packageJsonUrl, base) {\n throw new ERR_PACKAGE_IMPORT_NOT_DEFINED(\n specifier,\n packageJsonUrl && fileURLToPath(new URL('.', packageJsonUrl)),\n fileURLToPath(base)\n )\n}\n\n/**\n * @param {string} subpath\n * @param {URL} packageJsonUrl\n * @param {URL} base\n * @returns {never}\n */\nfunction throwExportsNotFound(subpath, packageJsonUrl, base) {\n throw new ERR_PACKAGE_PATH_NOT_EXPORTED(\n fileURLToPath(new URL('.', packageJsonUrl)),\n subpath,\n base && fileURLToPath(base)\n )\n}\n\n/**\n * @param {string} subpath\n * @param {URL} packageJsonUrl\n * @param {boolean} internal\n * @param {URL} [base]\n * @returns {never}\n */\nfunction throwInvalidSubpath(subpath, packageJsonUrl, internal, base) {\n const reason = `request is not a valid subpath for the \"${\n internal ? 'imports' : 'exports'\n }\" resolution of ${fileURLToPath(packageJsonUrl)}`;\n\n throw new ERR_INVALID_MODULE_SPECIFIER(\n subpath,\n reason,\n base && fileURLToPath(base)\n )\n}\n\n/**\n * @param {string} subpath\n * @param {unknown} target\n * @param {URL} packageJsonUrl\n * @param {boolean} internal\n * @param {URL} [base]\n * @returns {never}\n */\nfunction throwInvalidPackageTarget(\n subpath,\n target,\n packageJsonUrl,\n internal,\n base\n) {\n target =\n typeof target === 'object' && target !== null\n ? JSON.stringify(target, null, '')\n : `${target}`;\n\n throw new ERR_INVALID_PACKAGE_TARGET(\n fileURLToPath(new URL('.', packageJsonUrl)),\n subpath,\n target,\n internal,\n base && fileURLToPath(base)\n )\n}\n\n/**\n * @param {string} target\n * @param {string} subpath\n * @param {string} match\n * @param {URL} packageJsonUrl\n * @param {URL} base\n * @param {boolean} pattern\n * @param {boolean} internal\n * @param {Set} conditions\n * @returns {URL}\n */\nfunction resolvePackageTargetString(\n target,\n subpath,\n match,\n packageJsonUrl,\n base,\n pattern,\n internal,\n conditions\n) {\n if (subpath !== '' && !pattern && target[target.length - 1] !== '/')\n throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base);\n\n if (!target.startsWith('./')) {\n if (internal && !target.startsWith('../') && !target.startsWith('/')) {\n let isURL = false;\n\n try {\n new URL(target);\n isURL = true;\n } catch {}\n\n if (!isURL) {\n const exportTarget = pattern\n ? target.replace(patternRegEx, subpath)\n : target + subpath;\n\n return packageResolve(exportTarget, packageJsonUrl, conditions)\n }\n }\n\n throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base);\n }\n\n if (invalidSegmentRegEx.test(target.slice(2)))\n throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base);\n\n const resolved = new URL(target, packageJsonUrl);\n const resolvedPath = resolved.pathname;\n const packagePath = new URL('.', packageJsonUrl).pathname;\n\n if (!resolvedPath.startsWith(packagePath))\n throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base);\n\n if (subpath === '') return resolved\n\n if (invalidSegmentRegEx.test(subpath))\n throwInvalidSubpath(match + subpath, packageJsonUrl, internal, base);\n\n if (pattern) return new URL(resolved.href.replace(patternRegEx, subpath))\n return new URL(subpath, resolved)\n}\n\n/**\n * @param {string} key\n * @returns {boolean}\n */\nfunction isArrayIndex(key) {\n const keyNumber = Number(key);\n if (`${keyNumber}` !== key) return false\n return keyNumber >= 0 && keyNumber < 0xffff_ffff\n}\n\n/**\n * @param {URL} packageJsonUrl\n * @param {unknown} target\n * @param {string} subpath\n * @param {string} packageSubpath\n * @param {URL} base\n * @param {boolean} pattern\n * @param {boolean} internal\n * @param {Set} conditions\n * @returns {URL}\n */\nfunction resolvePackageTarget(\n packageJsonUrl,\n target,\n subpath,\n packageSubpath,\n base,\n pattern,\n internal,\n conditions\n) {\n if (typeof target === 'string') {\n return resolvePackageTargetString(\n target,\n subpath,\n packageSubpath,\n packageJsonUrl,\n base,\n pattern,\n internal,\n conditions\n )\n }\n\n if (Array.isArray(target)) {\n /** @type {unknown[]} */\n const targetList = target;\n if (targetList.length === 0) return null\n\n /** @type {Error} */\n let lastException;\n let i = -1;\n\n while (++i < targetList.length) {\n const targetItem = targetList[i];\n /** @type {URL} */\n let resolved;\n try {\n resolved = resolvePackageTarget(\n packageJsonUrl,\n targetItem,\n subpath,\n packageSubpath,\n base,\n pattern,\n internal,\n conditions\n );\n } catch (error) {\n lastException = error;\n if (error.code === 'ERR_INVALID_PACKAGE_TARGET') continue\n throw error\n }\n\n if (resolved === undefined) continue\n\n if (resolved === null) {\n lastException = null;\n continue\n }\n\n return resolved\n }\n\n if (lastException === undefined || lastException === null) {\n // @ts-expect-error The diff between `undefined` and `null` seems to be\n // intentional\n return lastException\n }\n\n throw lastException\n }\n\n if (typeof target === 'object' && target !== null) {\n const keys = Object.getOwnPropertyNames(target);\n let i = -1;\n\n while (++i < keys.length) {\n const key = keys[i];\n if (isArrayIndex(key)) {\n throw new ERR_INVALID_PACKAGE_CONFIG(\n fileURLToPath(packageJsonUrl),\n base,\n '\"exports\" cannot contain numeric property keys.'\n )\n }\n }\n\n i = -1;\n\n while (++i < keys.length) {\n const key = keys[i];\n if (key === 'default' || (conditions && conditions.has(key))) {\n /** @type {unknown} */\n const conditionalTarget = target[key];\n const resolved = resolvePackageTarget(\n packageJsonUrl,\n conditionalTarget,\n subpath,\n packageSubpath,\n base,\n pattern,\n internal,\n conditions\n );\n if (resolved === undefined) continue\n return resolved\n }\n }\n\n return undefined\n }\n\n if (target === null) {\n return null\n }\n\n throwInvalidPackageTarget(\n packageSubpath,\n target,\n packageJsonUrl,\n internal,\n base\n );\n}\n\n/**\n * @param {unknown} exports\n * @param {URL} packageJsonUrl\n * @param {URL} base\n * @returns {boolean}\n */\nfunction isConditionalExportsMainSugar(exports, packageJsonUrl, base) {\n if (typeof exports === 'string' || Array.isArray(exports)) return true\n if (typeof exports !== 'object' || exports === null) return false\n\n const keys = Object.getOwnPropertyNames(exports);\n let isConditionalSugar = false;\n let i = 0;\n let j = -1;\n while (++j < keys.length) {\n const key = keys[j];\n const curIsConditionalSugar = key === '' || key[0] !== '.';\n if (i++ === 0) {\n isConditionalSugar = curIsConditionalSugar;\n } else if (isConditionalSugar !== curIsConditionalSugar) {\n throw new ERR_INVALID_PACKAGE_CONFIG(\n fileURLToPath(packageJsonUrl),\n base,\n '\"exports\" cannot contain some keys starting with \\'.\\' and some not.' +\n ' The exports object must either be an object of package subpath keys' +\n ' or an object of main entry condition name keys only.'\n )\n }\n }\n\n return isConditionalSugar\n}\n\n/**\n * @param {URL} packageJsonUrl\n * @param {string} packageSubpath\n * @param {Object.} packageConfig\n * @param {URL} base\n * @param {Set} conditions\n * @returns {ResolveObject}\n */\nfunction packageExportsResolve(\n packageJsonUrl,\n packageSubpath,\n packageConfig,\n base,\n conditions\n) {\n let exports = packageConfig.exports;\n if (isConditionalExportsMainSugar(exports, packageJsonUrl, base))\n exports = {'.': exports};\n\n if (own.call(exports, packageSubpath)) {\n const target = exports[packageSubpath];\n const resolved = resolvePackageTarget(\n packageJsonUrl,\n target,\n '',\n packageSubpath,\n base,\n false,\n false,\n conditions\n );\n if (resolved === null || resolved === undefined)\n throwExportsNotFound(packageSubpath, packageJsonUrl, base);\n return {resolved, exact: true}\n }\n\n let bestMatch = '';\n const keys = Object.getOwnPropertyNames(exports);\n let i = -1;\n\n while (++i < keys.length) {\n const key = keys[i];\n if (\n key[key.length - 1] === '*' &&\n packageSubpath.startsWith(key.slice(0, -1)) &&\n packageSubpath.length >= key.length &&\n key.length > bestMatch.length\n ) {\n bestMatch = key;\n } else if (\n key[key.length - 1] === '/' &&\n packageSubpath.startsWith(key) &&\n key.length > bestMatch.length\n ) {\n bestMatch = key;\n }\n }\n\n if (bestMatch) {\n const target = exports[bestMatch];\n const pattern = bestMatch[bestMatch.length - 1] === '*';\n const subpath = packageSubpath.slice(bestMatch.length - (pattern ? 1 : 0));\n const resolved = resolvePackageTarget(\n packageJsonUrl,\n target,\n subpath,\n bestMatch,\n base,\n pattern,\n false,\n conditions\n );\n if (resolved === null || resolved === undefined)\n throwExportsNotFound(packageSubpath, packageJsonUrl, base);\n if (!pattern)\n emitFolderMapDeprecation(bestMatch, packageJsonUrl, true, base);\n return {resolved, exact: pattern}\n }\n\n throwExportsNotFound(packageSubpath, packageJsonUrl, base);\n}\n\n/**\n * @param {string} name\n * @param {URL} base\n * @param {Set} [conditions]\n * @returns {ResolveObject}\n */\nfunction packageImportsResolve(name, base, conditions) {\n if (name === '#' || name.startsWith('#/')) {\n const reason = 'is not a valid internal imports specifier name';\n throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, fileURLToPath(base))\n }\n\n /** @type {URL} */\n let packageJsonUrl;\n\n const packageConfig = getPackageScopeConfig(base);\n\n if (packageConfig.exists) {\n packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);\n const imports = packageConfig.imports;\n if (imports) {\n if (own.call(imports, name)) {\n const resolved = resolvePackageTarget(\n packageJsonUrl,\n imports[name],\n '',\n name,\n base,\n false,\n true,\n conditions\n );\n if (resolved !== null) return {resolved, exact: true}\n } else {\n let bestMatch = '';\n const keys = Object.getOwnPropertyNames(imports);\n let i = -1;\n\n while (++i < keys.length) {\n const key = keys[i];\n\n if (\n key[key.length - 1] === '*' &&\n name.startsWith(key.slice(0, -1)) &&\n name.length >= key.length &&\n key.length > bestMatch.length\n ) {\n bestMatch = key;\n } else if (\n key[key.length - 1] === '/' &&\n name.startsWith(key) &&\n key.length > bestMatch.length\n ) {\n bestMatch = key;\n }\n }\n\n if (bestMatch) {\n const target = imports[bestMatch];\n const pattern = bestMatch[bestMatch.length - 1] === '*';\n const subpath = name.slice(bestMatch.length - (pattern ? 1 : 0));\n const resolved = resolvePackageTarget(\n packageJsonUrl,\n target,\n subpath,\n bestMatch,\n base,\n pattern,\n true,\n conditions\n );\n if (resolved !== null) {\n if (!pattern)\n emitFolderMapDeprecation(bestMatch, packageJsonUrl, false, base);\n return {resolved, exact: pattern}\n }\n }\n }\n }\n }\n\n throwImportNotDefined(name, packageJsonUrl, base);\n}\n\n/**\n * @param {string} url\n * @returns {PackageType}\n */\nfunction getPackageType(url) {\n const packageConfig = getPackageScopeConfig(url);\n return packageConfig.type\n}\n\n/**\n * @param {string} specifier\n * @param {URL} base\n */\nfunction parsePackageName(specifier, base) {\n let separatorIndex = specifier.indexOf('/');\n let validPackageName = true;\n let isScoped = false;\n if (specifier[0] === '@') {\n isScoped = true;\n if (separatorIndex === -1 || specifier.length === 0) {\n validPackageName = false;\n } else {\n separatorIndex = specifier.indexOf('/', separatorIndex + 1);\n }\n }\n\n const packageName =\n separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex);\n\n // Package name cannot have leading . and cannot have percent-encoding or\n // separators.\n let i = -1;\n while (++i < packageName.length) {\n if (packageName[i] === '%' || packageName[i] === '\\\\') {\n validPackageName = false;\n break\n }\n }\n\n if (!validPackageName) {\n throw new ERR_INVALID_MODULE_SPECIFIER(\n specifier,\n 'is not a valid package name',\n fileURLToPath(base)\n )\n }\n\n const packageSubpath =\n '.' + (separatorIndex === -1 ? '' : specifier.slice(separatorIndex));\n\n return {packageName, packageSubpath, isScoped}\n}\n\n/**\n * @param {string} specifier\n * @param {URL} base\n * @param {Set} conditions\n * @returns {URL}\n */\nfunction packageResolve(specifier, base, conditions) {\n const {packageName, packageSubpath, isScoped} = parsePackageName(\n specifier,\n base\n );\n\n // ResolveSelf\n const packageConfig = getPackageScopeConfig(base);\n\n // Can’t test.\n /* c8 ignore next 16 */\n if (packageConfig.exists) {\n const packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);\n if (\n packageConfig.name === packageName &&\n packageConfig.exports !== undefined &&\n packageConfig.exports !== null\n ) {\n return packageExportsResolve(\n packageJsonUrl,\n packageSubpath,\n packageConfig,\n base,\n conditions\n ).resolved\n }\n }\n\n let packageJsonUrl = new URL(\n './node_modules/' + packageName + '/package.json',\n base\n );\n let packageJsonPath = fileURLToPath(packageJsonUrl);\n /** @type {string} */\n let lastPath;\n do {\n const stat = tryStatSync(packageJsonPath.slice(0, -13));\n if (!stat.isDirectory()) {\n lastPath = packageJsonPath;\n packageJsonUrl = new URL(\n (isScoped ? '../../../../node_modules/' : '../../../node_modules/') +\n packageName +\n '/package.json',\n packageJsonUrl\n );\n packageJsonPath = fileURLToPath(packageJsonUrl);\n continue\n }\n\n // Package match.\n const packageConfig = getPackageConfig(packageJsonPath, specifier, base);\n if (packageConfig.exports !== undefined && packageConfig.exports !== null)\n return packageExportsResolve(\n packageJsonUrl,\n packageSubpath,\n packageConfig,\n base,\n conditions\n ).resolved\n if (packageSubpath === '.')\n return legacyMainResolve(packageJsonUrl, packageConfig, base)\n return new URL(packageSubpath, packageJsonUrl)\n // Cross-platform root check.\n } while (packageJsonPath.length !== lastPath.length)\n\n throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base))\n}\n\n/**\n * @param {string} specifier\n * @returns {boolean}\n */\nfunction isRelativeSpecifier(specifier) {\n if (specifier[0] === '.') {\n if (specifier.length === 1 || specifier[1] === '/') return true\n if (\n specifier[1] === '.' &&\n (specifier.length === 2 || specifier[2] === '/')\n ) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * @param {string} specifier\n * @returns {boolean}\n */\nfunction shouldBeTreatedAsRelativeOrAbsolutePath(specifier) {\n if (specifier === '') return false\n if (specifier[0] === '/') return true\n return isRelativeSpecifier(specifier)\n}\n\n/**\n * The “Resolver Algorithm Specification” as detailed in the Node docs (which is\n * sync and slightly lower-level than `resolve`).\n *\n *\n *\n * @param {string} specifier\n * @param {URL} base\n * @param {Set} [conditions]\n * @returns {URL}\n */\nfunction moduleResolve(specifier, base, conditions) {\n // Order swapped from spec for minor perf gain.\n // Ok since relative URLs cannot parse as URLs.\n /** @type {URL} */\n let resolved;\n\n if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {\n resolved = new URL(specifier, base);\n } else if (specifier[0] === '#') {\n({resolved} = packageImportsResolve(specifier, base, conditions));\n } else {\n try {\n resolved = new URL(specifier);\n } catch {\n resolved = packageResolve(specifier, base, conditions);\n }\n }\n\n return finalizeResolution(resolved, base)\n}\n\n/**\n * @param {string} specifier\n * @param {{parentURL?: string, conditions?: string[]}} context\n * @returns {{url: string}}\n */\nfunction defaultResolve(specifier, context = {}) {\n const {parentURL} = context;\n /** @type {URL} */\n let parsed;\n\n try {\n parsed = new URL(specifier);\n if (parsed.protocol === 'data:') {\n return {url: specifier}\n }\n } catch {}\n\n if (parsed && parsed.protocol === 'node:') return {url: specifier}\n if (parsed && parsed.protocol !== 'file:' && parsed.protocol !== 'data:')\n throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed)\n\n if (listOfBuiltins.includes(specifier)) {\n return {url: 'node:' + specifier}\n }\n\n if (parentURL.startsWith('data:')) {\n // This is gonna blow up, we want the error\n new URL(specifier, parentURL);\n }\n\n const conditions = getConditionsSet(context.conditions);\n let url = moduleResolve(specifier, new URL(parentURL), conditions);\n\n const urlPath = fileURLToPath(url);\n const real = realpathSync(urlPath);\n const old = url;\n url = pathToFileURL(real + (urlPath.endsWith(path.sep) ? '/' : ''));\n url.search = old.search;\n url.hash = old.hash;\n\n return {url: `${url}`}\n}\n\n/**\n * Provides a module-relative resolution function scoped to each module,\n * returning the URL string.\n * `import.meta.resolve` also accepts a second argument which is the parent\n * module from which to resolve from.\n *\n * This function is asynchronous because the ES module resolver in Node.js is\n * allowed to be asynchronous.\n *\n * @param {string} specifier The module specifier to resolve relative to parent.\n * @param {string} parent The absolute parent module URL to resolve from.\n * You should pass `import.meta.url` or something else\n * @returns {Promise}\n */\nasync function resolve(specifier, parent) {\n if (!parent) {\n throw new Error(\n 'Please pass `parent`: `import-meta-resolve` cannot ponyfill that'\n )\n }\n\n try {\n return defaultResolve(specifier, {parentURL: parent}).url\n } catch (error) {\n return error.code === 'ERR_UNSUPPORTED_DIR_IMPORT'\n ? error.url\n : Promise.reject(error)\n }\n}\n\nexport { moduleResolve, resolve };\n"],"mappings":";;;;;;;;AAoFA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;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;AACD;;SAgBcuI,O;;;;;+BAAf,WAAuBlJ,SAAvB,EAAkC5B,MAAlC,EAA0C;IACxC,IAAI,CAACA,MAAL,EAAa;MACX,MAAM,IAAI9Z,KAAJ,CACJ,kEADI,CAAN;IAGD;;IAED,IAAI;MACF,OAAOkkB,cAAc,CAACxI,SAAD,EAAY;QAAC0I,SAAS,EAAEtK;MAAZ,CAAZ,CAAd,CAA+CuC,GAAtD;IACD,CAFD,CAEE,OAAOriB,KAAP,EAAc;MACd,OAAOA,KAAK,CAAC6f,IAAN,KAAe,4BAAf,GACH7f,KAAK,CAACqiB,GADH,GAEHwI,OAAO,CAACC,MAAR,CAAe9qB,KAAf,CAFJ;IAGD;EACF,C"} \ No newline at end of file +{"version":3,"names":["re$3","exports","SEMVER_SPEC_VERSION","MAX_LENGTH$2","MAX_SAFE_INTEGER$1","Number","MAX_SAFE_INTEGER","MAX_SAFE_COMPONENT_LENGTH","constants","MAX_LENGTH","debug$1","process","env","NODE_DEBUG","test","args","console","error","debug_1","module","debug","re","src","t","R","createToken","name","value","isGlobal","index","RegExp","undefined","NUMERICIDENTIFIER","NUMERICIDENTIFIERLOOSE","NONNUMERICIDENTIFIER","PRERELEASEIDENTIFIER","PRERELEASEIDENTIFIERLOOSE","BUILDIDENTIFIER","MAINVERSION","PRERELEASE","BUILD","FULLPLAIN","MAINVERSIONLOOSE","PRERELEASELOOSE","LOOSEPLAIN","XRANGEIDENTIFIER","XRANGEIDENTIFIERLOOSE","GTLT","XRANGEPLAIN","XRANGEPLAINLOOSE","COERCE","LONETILDE","tildeTrimReplace","LONECARET","caretTrimReplace","comparatorTrimReplace","opts","parseOptions$2","options","loose","filter","k","reduce","o","parseOptions_1","numeric","compareIdentifiers$1","a","b","anum","bnum","rcompareIdentifiers","identifiers","compareIdentifiers","MAX_LENGTH$1","re$2","t$2","parseOptions$1","SemVer$c","constructor","version","includePrerelease","TypeError","length","m","trim","match","LOOSE","FULL","raw","major","minor","patch","prerelease","split","map","id","num","build","format","join","toString","compare","other","compareMain","comparePre","i","compareBuild","inc","release","identifier","push","isNaN","Error","semver$2","re$1","t$1","SemVer$b","parseOptions","parse$5","r","er","parse_1","parse$4","valid$1","v","valid_1","parse$3","clean","s","replace","clean_1","SemVer$a","inc_1","SemVer$9","compare$a","compare_1","compare$9","eq$2","eq_1","parse$2","eq$1","diff","version1","version2","v1","v2","hasPre","prefix","defaultResult","key","diff_1","SemVer$8","major_1","SemVer$7","minor_1","SemVer$6","patch_1","parse$1","parsed","prerelease_1","compare$8","rcompare","rcompare_1","compare$7","compareLoose","compareLoose_1","SemVer$5","compareBuild$2","versionA","versionB","compareBuild_1","compareBuild$1","sort","list","sort_1","rsort","rsort_1","compare$6","gt$3","gt_1","compare$5","lt$2","lt_1","compare$4","neq$1","neq_1","compare$3","gte$2","gte_1","compare$2","lte$2","lte_1","eq","neq","gt$2","gte$1","lt$1","lte$1","cmp","op","cmp_1","SemVer$4","parse","coerce","String","rtl","next","COERCERTL","exec","lastIndex","coerce_1","iterator","hasRequiredIterator","requireIterator","Yallist","prototype","Symbol","walker","head","yallist","hasRequiredYallist","requireYallist","Node","create","self","tail","forEach","item","arguments","l","removeNode","node","prev","unshiftNode","pushNode","unshift","pop","res","shift","fn","thisp","call","forEachReverse","get","n","getReverse","mapReverse","initial","acc","reduceReverse","toArray","arr","Array","toArrayReverse","slice","from","to","ret","sliceReverse","splice","start","deleteCount","nodes","insert","reverse","p","inserted","lruCache","hasRequiredLruCache","requireLruCache","MAX","LENGTH","LENGTH_CALCULATOR","ALLOW_STALE","MAX_AGE","DISPOSE","NO_DISPOSE_ON_SET","LRU_LIST","CACHE","UPDATE_AGE_ON_GET","naiveLength","LRUCache","max","Infinity","lc","stale","maxAge","dispose","noDisposeOnSet","updateAgeOnGet","reset","mL","allowStale","mA","lengthCalculator","lC","hit","itemCount","rforEach","forEachStep","keys","values","Map","dump","isStale","e","now","h","dumpLru","set","Date","len","has","del","Entry","peek","load","expiresAt","prune","doUse","delete","range","hasRequiredRange","requireRange","Range","Comparator","parseRange","c","first","isNullSet","isAny","comps","memoOpts","Object","memoKey","cached","cache","hr","HYPHENRANGELOOSE","HYPHENRANGE","hyphenReplace","COMPARATORTRIM","TILDETRIM","CARETTRIM","rangeList","comp","parseComparator","replaceGTE0","COMPARATORLOOSE","rangeMap","comparators","size","result","intersects","some","thisComparators","isSatisfiable","rangeComparators","every","thisComparator","rangeComparator","SemVer","testSet","LRU","requireComparator","remainingComparators","testComparator","otherComparator","replaceCarets","replaceTildes","replaceXRanges","replaceStars","isX","toLowerCase","replaceTilde","TILDELOOSE","TILDE","_","M","pr","replaceCaret","CARETLOOSE","CARET","z","replaceXRange","XRANGELOOSE","XRANGE","gtlt","xM","xm","xp","anyX","STAR","GTE0PRE","GTE0","incPr","$0","fM","fm","fp","fpr","fb","tM","tm","tp","tpr","tb","semver","ANY","allowed","comparator","hasRequiredComparator","operator","COMPARATOR","sameDirectionIncreasing","sameDirectionDecreasing","sameSemVer","differentDirectionsInclusive","oppositeDirectionsLessThan","oppositeDirectionsGreaterThan","Range$8","satisfies$3","satisfies_1","Range$7","toComparators","toComparators_1","SemVer$3","Range$6","maxSatisfying","versions","maxSV","rangeObj","maxSatisfying_1","SemVer$2","Range$5","minSatisfying","min","minSV","minSatisfying_1","SemVer$1","Range$4","gt$1","minVersion","minver","setMin","compver","minVersion_1","Range$3","validRange","valid","Comparator$1","ANY$1","Range$2","satisfies$2","gt","lt","lte","gte","outside$2","hilo","gtfn","ltefn","ltfn","ecomp","high","low","outside_1","outside$1","gtr","gtr_1","outside","ltr","ltr_1","Range$1","r1","r2","intersects_1","satisfies$1","compare$1","simplify","included","ranges","simplified","original","satisfies","subset","sub","dom","sawNonNull","OUTER","simpleSub","simpleDom","isSub","simpleSubset","eqSet","Set","higherGT","lowerLT","add","gtltComp","higher","lower","hasDomLT","hasDomGT","needDomLTPre","needDomGTPre","subset_1","internalRe","semver$1","tokens","simplifyRange","builtins","experimental","coreModules","reader","read","jsonPath","find","path","dirname","dir","string","fs","readFileSync","toNamespacedPath","code","parent","isWindows","platform","own$1","hasOwnProperty","codes","messages","nodeInternalPrefix","userStackTraceLimit","ERR_INVALID_MODULE_SPECIFIER","createError","request","reason","base","ERR_INVALID_PACKAGE_CONFIG","message","ERR_INVALID_PACKAGE_TARGET","pkgPath","target","isImport","relError","startsWith","assert","JSON","stringify","ERR_MODULE_NOT_FOUND","type","ERR_PACKAGE_IMPORT_NOT_DEFINED","specifier","packagePath","ERR_PACKAGE_PATH_NOT_EXPORTED","subpath","ERR_UNSUPPORTED_DIR_IMPORT","ERR_UNKNOWN_FILE_EXTENSION","ERR_INVALID_ARG_VALUE","inspected","inspect","includes","ERR_UNSUPPORTED_ESM_URL_SCHEME","url","protocol","sym","def","makeNodeErrorWithCode","Base","NodeError","limit","stackTraceLimit","isErrorStackTraceLimitWritable","getMessage","defineProperty","enumerable","writable","configurable","addCodeToName","hideStackFrames","captureLargerStackTrace","stack","desc","getOwnPropertyDescriptor","isExtensible","hidden","stackTraceLimitIsWritable","POSITIVE_INFINITY","captureStackTrace","Reflect","apply","expectedLength","extensionFormatMap","__proto__","defaultGetFormat","URL","mime","pathname","ext","extname","getPackageType","href","fileURLToPath","listOfBuiltins","own","DEFAULT_CONDITIONS","freeze","DEFAULT_CONDITIONS_SET","invalidSegmentRegEx","patternRegEx","encodedSepRegEx","emittedPackageWarnings","packageJsonCache","emitFolderMapDeprecation","pjsonUrl","isExports","pjsonPath","emitWarning","emitLegacyIndexDeprecation","packageJsonUrl","main","basePath","getConditionsSet","conditions","isArray","tryStatSync","statSync","Stats","getPackageConfig","existing","source","packageConfig","exists","imports","packageJson","getPackageScopeConfig","resolved","packageJsonPath","endsWith","lastPackageJsonUrl","fileExists","isFile","legacyMainResolve","guess","tries","finalizeResolution","stats","isDirectory","throwImportNotDefined","throwExportsNotFound","throwInvalidSubpath","internal","throwInvalidPackageTarget","resolvePackageTargetString","pattern","isURL","exportTarget","packageResolve","resolvedPath","isArrayIndex","keyNumber","resolvePackageTarget","packageSubpath","targetList","lastException","targetItem","getOwnPropertyNames","conditionalTarget","isConditionalExportsMainSugar","isConditionalSugar","j","curIsConditionalSugar","packageExportsResolve","exact","bestMatch","packageImportsResolve","pathToFileURL","parsePackageName","separatorIndex","indexOf","validPackageName","isScoped","packageName","lastPath","stat","isRelativeSpecifier","shouldBeTreatedAsRelativeOrAbsolutePath","moduleResolve","defaultResolve","context","parentURL","urlPath","real","realpathSync","old","sep","search","hash","resolve","Promise","reject"],"sources":["../../src/vendor/import-meta-resolve.js"],"sourcesContent":["\n/****************************************************************************\\\n * NOTE FROM BABEL AUTHORS *\n * This file is inlined from https://github.com/wooorm/import-meta-resolve, *\n * because we need to compile it to CommonJS. *\n\\****************************************************************************/\n\n/*\n(The MIT License)\n\nCopyright (c) 2021 Titus Wormer \n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n---\n\nThis is a derivative work based on:\n.\nWhich is licensed:\n\n\"\"\"\nCopyright Node.js contributors. All rights reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n\"\"\"\n\nThis license applies to parts of Node.js originating from the\nhttps://github.com/joyent/node repository:\n\n\"\"\"\nCopyright Joyent, Inc. and other Node contributors. All rights reserved.\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE.\n\"\"\"\n*/\n\nimport { URL, fileURLToPath, pathToFileURL } from 'url';\nimport fs, { realpathSync, statSync, Stats } from 'fs';\nimport path from 'path';\nimport assert from 'assert';\nimport { format, inspect } from 'util';\n\nvar re$3 = {exports: {}};\n\n// Note: this is the semver.org version of the spec that it implements\n// Not necessarily the package version of this code.\nconst SEMVER_SPEC_VERSION = '2.0.0';\n\nconst MAX_LENGTH$2 = 256;\nconst MAX_SAFE_INTEGER$1 = Number.MAX_SAFE_INTEGER ||\n/* istanbul ignore next */ 9007199254740991;\n\n// Max safe segment length for coercion.\nconst MAX_SAFE_COMPONENT_LENGTH = 16;\n\nvar constants = {\n SEMVER_SPEC_VERSION,\n MAX_LENGTH: MAX_LENGTH$2,\n MAX_SAFE_INTEGER: MAX_SAFE_INTEGER$1,\n MAX_SAFE_COMPONENT_LENGTH,\n};\n\nconst debug$1 = (\n typeof process === 'object' &&\n process.env &&\n process.env.NODE_DEBUG &&\n /\\bsemver\\b/i.test(process.env.NODE_DEBUG)\n) ? (...args) => console.error('SEMVER', ...args)\n : () => {};\n\nvar debug_1 = debug$1;\n\n(function (module, exports) {\n\tconst { MAX_SAFE_COMPONENT_LENGTH } = constants;\n\tconst debug = debug_1;\n\texports = module.exports = {};\n\n\t// The actual regexps go on exports.re\n\tconst re = exports.re = [];\n\tconst src = exports.src = [];\n\tconst t = exports.t = {};\n\tlet R = 0;\n\n\tconst createToken = (name, value, isGlobal) => {\n\t const index = R++;\n\t debug(name, index, value);\n\t t[name] = index;\n\t src[index] = value;\n\t re[index] = new RegExp(value, isGlobal ? 'g' : undefined);\n\t};\n\n\t// The following Regular Expressions can be used for tokenizing,\n\t// validating, and parsing SemVer version strings.\n\n\t// ## Numeric Identifier\n\t// A single `0`, or a non-zero digit followed by zero or more digits.\n\n\tcreateToken('NUMERICIDENTIFIER', '0|[1-9]\\\\d*');\n\tcreateToken('NUMERICIDENTIFIERLOOSE', '[0-9]+');\n\n\t// ## Non-numeric Identifier\n\t// Zero or more digits, followed by a letter or hyphen, and then zero or\n\t// more letters, digits, or hyphens.\n\n\tcreateToken('NONNUMERICIDENTIFIER', '\\\\d*[a-zA-Z-][a-zA-Z0-9-]*');\n\n\t// ## Main Version\n\t// Three dot-separated numeric identifiers.\n\n\tcreateToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n\t `(${src[t.NUMERICIDENTIFIER]})\\\\.` +\n\t `(${src[t.NUMERICIDENTIFIER]})`);\n\n\tcreateToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n\t `(${src[t.NUMERICIDENTIFIERLOOSE]})\\\\.` +\n\t `(${src[t.NUMERICIDENTIFIERLOOSE]})`);\n\n\t// ## Pre-release Version Identifier\n\t// A numeric identifier, or a non-numeric identifier.\n\n\tcreateToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER]\n\t}|${src[t.NONNUMERICIDENTIFIER]})`);\n\n\tcreateToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE]\n\t}|${src[t.NONNUMERICIDENTIFIER]})`);\n\n\t// ## Pre-release Version\n\t// Hyphen, followed by one or more dot-separated pre-release version\n\t// identifiers.\n\n\tcreateToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]\n\t}(?:\\\\.${src[t.PRERELEASEIDENTIFIER]})*))`);\n\n\tcreateToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]\n\t}(?:\\\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);\n\n\t// ## Build Metadata Identifier\n\t// Any combination of digits, letters, or hyphens.\n\n\tcreateToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+');\n\n\t// ## Build Metadata\n\t// Plus sign, followed by one or more period-separated build metadata\n\t// identifiers.\n\n\tcreateToken('BUILD', `(?:\\\\+(${src[t.BUILDIDENTIFIER]\n\t}(?:\\\\.${src[t.BUILDIDENTIFIER]})*))`);\n\n\t// ## Full Version String\n\t// A main version, followed optionally by a pre-release version and\n\t// build metadata.\n\n\t// Note that the only major, minor, patch, and pre-release sections of\n\t// the version string are capturing groups. The build metadata is not a\n\t// capturing group, because it should not ever be used in version\n\t// comparison.\n\n\tcreateToken('FULLPLAIN', `v?${src[t.MAINVERSION]\n\t}${src[t.PRERELEASE]}?${\n\t src[t.BUILD]}?`);\n\n\tcreateToken('FULL', `^${src[t.FULLPLAIN]}$`);\n\n\t// like full, but allows v1.2.3 and =1.2.3, which people do sometimes.\n\t// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty\n\t// common in the npm registry.\n\tcreateToken('LOOSEPLAIN', `[v=\\\\s]*${src[t.MAINVERSIONLOOSE]\n\t}${src[t.PRERELEASELOOSE]}?${\n\t src[t.BUILD]}?`);\n\n\tcreateToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);\n\n\tcreateToken('GTLT', '((?:<|>)?=?)');\n\n\t// Something like \"2.*\" or \"1.2.x\".\n\t// Note that \"x.x\" is a valid xRange identifer, meaning \"any version\"\n\t// Only the first item is strictly required.\n\tcreateToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\\\*`);\n\tcreateToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\\\*`);\n\n\tcreateToken('XRANGEPLAIN', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIER]})` +\n\t `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n\t `(?:\\\\.(${src[t.XRANGEIDENTIFIER]})` +\n\t `(?:${src[t.PRERELEASE]})?${\n\t src[t.BUILD]}?` +\n\t `)?)?`);\n\n\tcreateToken('XRANGEPLAINLOOSE', `[v=\\\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n\t `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n\t `(?:\\\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +\n\t `(?:${src[t.PRERELEASELOOSE]})?${\n\t src[t.BUILD]}?` +\n\t `)?)?`);\n\n\tcreateToken('XRANGE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAIN]}$`);\n\tcreateToken('XRANGELOOSE', `^${src[t.GTLT]}\\\\s*${src[t.XRANGEPLAINLOOSE]}$`);\n\n\t// Coercion.\n\t// Extract anything that could conceivably be a part of a valid semver\n\tcreateToken('COERCE', `${'(^|[^\\\\d])' +\n\t '(\\\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +\n\t `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n\t `(?:\\\\.(\\\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +\n\t `(?:$|[^\\\\d])`);\n\tcreateToken('COERCERTL', src[t.COERCE], true);\n\n\t// Tilde ranges.\n\t// Meaning is \"reasonably at or greater than\"\n\tcreateToken('LONETILDE', '(?:~>?)');\n\n\tcreateToken('TILDETRIM', `(\\\\s*)${src[t.LONETILDE]}\\\\s+`, true);\n\texports.tildeTrimReplace = '$1~';\n\n\tcreateToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);\n\tcreateToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);\n\n\t// Caret ranges.\n\t// Meaning is \"at least and backwards compatible with\"\n\tcreateToken('LONECARET', '(?:\\\\^)');\n\n\tcreateToken('CARETTRIM', `(\\\\s*)${src[t.LONECARET]}\\\\s+`, true);\n\texports.caretTrimReplace = '$1^';\n\n\tcreateToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);\n\tcreateToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);\n\n\t// A simple gt/lt/eq thing, or just \"\" to indicate \"any version\"\n\tcreateToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\\\s*(${src[t.LOOSEPLAIN]})$|^$`);\n\tcreateToken('COMPARATOR', `^${src[t.GTLT]}\\\\s*(${src[t.FULLPLAIN]})$|^$`);\n\n\t// An expression to strip any whitespace between the gtlt and the thing\n\t// it modifies, so that `> 1.2.3` ==> `>1.2.3`\n\tcreateToken('COMPARATORTRIM', `(\\\\s*)${src[t.GTLT]\n\t}\\\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);\n\texports.comparatorTrimReplace = '$1$2$3';\n\n\t// Something like `1.2.3 - 1.2.4`\n\t// Note that these all use the loose form, because they'll be\n\t// checked against either the strict or loose comparator form\n\t// later.\n\tcreateToken('HYPHENRANGE', `^\\\\s*(${src[t.XRANGEPLAIN]})` +\n\t `\\\\s+-\\\\s+` +\n\t `(${src[t.XRANGEPLAIN]})` +\n\t `\\\\s*$`);\n\n\tcreateToken('HYPHENRANGELOOSE', `^\\\\s*(${src[t.XRANGEPLAINLOOSE]})` +\n\t `\\\\s+-\\\\s+` +\n\t `(${src[t.XRANGEPLAINLOOSE]})` +\n\t `\\\\s*$`);\n\n\t// Star ranges basically just allow anything at all.\n\tcreateToken('STAR', '(<|>)?=?\\\\s*\\\\*');\n\t// >=0.0.0 is like a star\n\tcreateToken('GTE0', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0\\\\s*$');\n\tcreateToken('GTE0PRE', '^\\\\s*>=\\\\s*0\\\\.0\\\\.0-0\\\\s*$');\n} (re$3, re$3.exports));\n\n// parse out just the options we care about so we always get a consistent\n// obj with keys in a consistent order.\nconst opts = ['includePrerelease', 'loose', 'rtl'];\nconst parseOptions$2 = options =>\n !options ? {}\n : typeof options !== 'object' ? { loose: true }\n : opts.filter(k => options[k]).reduce((o, k) => {\n o[k] = true;\n return o\n }, {});\nvar parseOptions_1 = parseOptions$2;\n\nconst numeric = /^[0-9]+$/;\nconst compareIdentifiers$1 = (a, b) => {\n const anum = numeric.test(a);\n const bnum = numeric.test(b);\n\n if (anum && bnum) {\n a = +a;\n b = +b;\n }\n\n return a === b ? 0\n : (anum && !bnum) ? -1\n : (bnum && !anum) ? 1\n : a < b ? -1\n : 1\n};\n\nconst rcompareIdentifiers = (a, b) => compareIdentifiers$1(b, a);\n\nvar identifiers = {\n compareIdentifiers: compareIdentifiers$1,\n rcompareIdentifiers,\n};\n\nconst debug = debug_1;\nconst { MAX_LENGTH: MAX_LENGTH$1, MAX_SAFE_INTEGER } = constants;\nconst { re: re$2, t: t$2 } = re$3.exports;\n\nconst parseOptions$1 = parseOptions_1;\nconst { compareIdentifiers } = identifiers;\nclass SemVer$c {\n constructor (version, options) {\n options = parseOptions$1(options);\n\n if (version instanceof SemVer$c) {\n if (version.loose === !!options.loose &&\n version.includePrerelease === !!options.includePrerelease) {\n return version\n } else {\n version = version.version;\n }\n } else if (typeof version !== 'string') {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n if (version.length > MAX_LENGTH$1) {\n throw new TypeError(\n `version is longer than ${MAX_LENGTH$1} characters`\n )\n }\n\n debug('SemVer', version, options);\n this.options = options;\n this.loose = !!options.loose;\n // this isn't actually relevant for versions, but keep it so that we\n // don't run into trouble passing this.options around.\n this.includePrerelease = !!options.includePrerelease;\n\n const m = version.trim().match(options.loose ? re$2[t$2.LOOSE] : re$2[t$2.FULL]);\n\n if (!m) {\n throw new TypeError(`Invalid Version: ${version}`)\n }\n\n this.raw = version;\n\n // these are actually numbers\n this.major = +m[1];\n this.minor = +m[2];\n this.patch = +m[3];\n\n if (this.major > MAX_SAFE_INTEGER || this.major < 0) {\n throw new TypeError('Invalid major version')\n }\n\n if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {\n throw new TypeError('Invalid minor version')\n }\n\n if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {\n throw new TypeError('Invalid patch version')\n }\n\n // numberify any prerelease numeric ids\n if (!m[4]) {\n this.prerelease = [];\n } else {\n this.prerelease = m[4].split('.').map((id) => {\n if (/^[0-9]+$/.test(id)) {\n const num = +id;\n if (num >= 0 && num < MAX_SAFE_INTEGER) {\n return num\n }\n }\n return id\n });\n }\n\n this.build = m[5] ? m[5].split('.') : [];\n this.format();\n }\n\n format () {\n this.version = `${this.major}.${this.minor}.${this.patch}`;\n if (this.prerelease.length) {\n this.version += `-${this.prerelease.join('.')}`;\n }\n return this.version\n }\n\n toString () {\n return this.version\n }\n\n compare (other) {\n debug('SemVer.compare', this.version, this.options, other);\n if (!(other instanceof SemVer$c)) {\n if (typeof other === 'string' && other === this.version) {\n return 0\n }\n other = new SemVer$c(other, this.options);\n }\n\n if (other.version === this.version) {\n return 0\n }\n\n return this.compareMain(other) || this.comparePre(other)\n }\n\n compareMain (other) {\n if (!(other instanceof SemVer$c)) {\n other = new SemVer$c(other, this.options);\n }\n\n return (\n compareIdentifiers(this.major, other.major) ||\n compareIdentifiers(this.minor, other.minor) ||\n compareIdentifiers(this.patch, other.patch)\n )\n }\n\n comparePre (other) {\n if (!(other instanceof SemVer$c)) {\n other = new SemVer$c(other, this.options);\n }\n\n // NOT having a prerelease is > having one\n if (this.prerelease.length && !other.prerelease.length) {\n return -1\n } else if (!this.prerelease.length && other.prerelease.length) {\n return 1\n } else if (!this.prerelease.length && !other.prerelease.length) {\n return 0\n }\n\n let i = 0;\n do {\n const a = this.prerelease[i];\n const b = other.prerelease[i];\n debug('prerelease compare', i, a, b);\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n compareBuild (other) {\n if (!(other instanceof SemVer$c)) {\n other = new SemVer$c(other, this.options);\n }\n\n let i = 0;\n do {\n const a = this.build[i];\n const b = other.build[i];\n debug('prerelease compare', i, a, b);\n if (a === undefined && b === undefined) {\n return 0\n } else if (b === undefined) {\n return 1\n } else if (a === undefined) {\n return -1\n } else if (a === b) {\n continue\n } else {\n return compareIdentifiers(a, b)\n }\n } while (++i)\n }\n\n // preminor will bump the version up to the next minor release, and immediately\n // down to pre-release. premajor and prepatch work the same way.\n inc (release, identifier) {\n switch (release) {\n case 'premajor':\n this.prerelease.length = 0;\n this.patch = 0;\n this.minor = 0;\n this.major++;\n this.inc('pre', identifier);\n break\n case 'preminor':\n this.prerelease.length = 0;\n this.patch = 0;\n this.minor++;\n this.inc('pre', identifier);\n break\n case 'prepatch':\n // If this is already a prerelease, it will bump to the next version\n // drop any prereleases that might already exist, since they are not\n // relevant at this point.\n this.prerelease.length = 0;\n this.inc('patch', identifier);\n this.inc('pre', identifier);\n break\n // If the input is a non-prerelease version, this acts the same as\n // prepatch.\n case 'prerelease':\n if (this.prerelease.length === 0) {\n this.inc('patch', identifier);\n }\n this.inc('pre', identifier);\n break\n\n case 'major':\n // If this is a pre-major version, bump up to the same major version.\n // Otherwise increment major.\n // 1.0.0-5 bumps to 1.0.0\n // 1.1.0 bumps to 2.0.0\n if (\n this.minor !== 0 ||\n this.patch !== 0 ||\n this.prerelease.length === 0\n ) {\n this.major++;\n }\n this.minor = 0;\n this.patch = 0;\n this.prerelease = [];\n break\n case 'minor':\n // If this is a pre-minor version, bump up to the same minor version.\n // Otherwise increment minor.\n // 1.2.0-5 bumps to 1.2.0\n // 1.2.1 bumps to 1.3.0\n if (this.patch !== 0 || this.prerelease.length === 0) {\n this.minor++;\n }\n this.patch = 0;\n this.prerelease = [];\n break\n case 'patch':\n // If this is not a pre-release version, it will increment the patch.\n // If it is a pre-release it will bump up to the same patch version.\n // 1.2.0-5 patches to 1.2.0\n // 1.2.0 patches to 1.2.1\n if (this.prerelease.length === 0) {\n this.patch++;\n }\n this.prerelease = [];\n break\n // This probably shouldn't be used publicly.\n // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.\n case 'pre':\n if (this.prerelease.length === 0) {\n this.prerelease = [0];\n } else {\n let i = this.prerelease.length;\n while (--i >= 0) {\n if (typeof this.prerelease[i] === 'number') {\n this.prerelease[i]++;\n i = -2;\n }\n }\n if (i === -1) {\n // didn't increment anything\n this.prerelease.push(0);\n }\n }\n if (identifier) {\n // 1.2.0-beta.1 bumps to 1.2.0-beta.2,\n // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0\n if (compareIdentifiers(this.prerelease[0], identifier) === 0) {\n if (isNaN(this.prerelease[1])) {\n this.prerelease = [identifier, 0];\n }\n } else {\n this.prerelease = [identifier, 0];\n }\n }\n break\n\n default:\n throw new Error(`invalid increment argument: ${release}`)\n }\n this.format();\n this.raw = this.version;\n return this\n }\n}\n\nvar semver$2 = SemVer$c;\n\nconst { MAX_LENGTH } = constants;\nconst { re: re$1, t: t$1 } = re$3.exports;\nconst SemVer$b = semver$2;\n\nconst parseOptions = parseOptions_1;\nconst parse$5 = (version, options) => {\n options = parseOptions(options);\n\n if (version instanceof SemVer$b) {\n return version\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n if (version.length > MAX_LENGTH) {\n return null\n }\n\n const r = options.loose ? re$1[t$1.LOOSE] : re$1[t$1.FULL];\n if (!r.test(version)) {\n return null\n }\n\n try {\n return new SemVer$b(version, options)\n } catch (er) {\n return null\n }\n};\n\nvar parse_1 = parse$5;\n\nconst parse$4 = parse_1;\nconst valid$1 = (version, options) => {\n const v = parse$4(version, options);\n return v ? v.version : null\n};\nvar valid_1 = valid$1;\n\nconst parse$3 = parse_1;\nconst clean = (version, options) => {\n const s = parse$3(version.trim().replace(/^[=v]+/, ''), options);\n return s ? s.version : null\n};\nvar clean_1 = clean;\n\nconst SemVer$a = semver$2;\n\nconst inc = (version, release, options, identifier) => {\n if (typeof (options) === 'string') {\n identifier = options;\n options = undefined;\n }\n\n try {\n return new SemVer$a(\n version instanceof SemVer$a ? version.version : version,\n options\n ).inc(release, identifier).version\n } catch (er) {\n return null\n }\n};\nvar inc_1 = inc;\n\nconst SemVer$9 = semver$2;\nconst compare$a = (a, b, loose) =>\n new SemVer$9(a, loose).compare(new SemVer$9(b, loose));\n\nvar compare_1 = compare$a;\n\nconst compare$9 = compare_1;\nconst eq$2 = (a, b, loose) => compare$9(a, b, loose) === 0;\nvar eq_1 = eq$2;\n\nconst parse$2 = parse_1;\nconst eq$1 = eq_1;\n\nconst diff = (version1, version2) => {\n if (eq$1(version1, version2)) {\n return null\n } else {\n const v1 = parse$2(version1);\n const v2 = parse$2(version2);\n const hasPre = v1.prerelease.length || v2.prerelease.length;\n const prefix = hasPre ? 'pre' : '';\n const defaultResult = hasPre ? 'prerelease' : '';\n for (const key in v1) {\n if (key === 'major' || key === 'minor' || key === 'patch') {\n if (v1[key] !== v2[key]) {\n return prefix + key\n }\n }\n }\n return defaultResult // may be undefined\n }\n};\nvar diff_1 = diff;\n\nconst SemVer$8 = semver$2;\nconst major = (a, loose) => new SemVer$8(a, loose).major;\nvar major_1 = major;\n\nconst SemVer$7 = semver$2;\nconst minor = (a, loose) => new SemVer$7(a, loose).minor;\nvar minor_1 = minor;\n\nconst SemVer$6 = semver$2;\nconst patch = (a, loose) => new SemVer$6(a, loose).patch;\nvar patch_1 = patch;\n\nconst parse$1 = parse_1;\nconst prerelease = (version, options) => {\n const parsed = parse$1(version, options);\n return (parsed && parsed.prerelease.length) ? parsed.prerelease : null\n};\nvar prerelease_1 = prerelease;\n\nconst compare$8 = compare_1;\nconst rcompare = (a, b, loose) => compare$8(b, a, loose);\nvar rcompare_1 = rcompare;\n\nconst compare$7 = compare_1;\nconst compareLoose = (a, b) => compare$7(a, b, true);\nvar compareLoose_1 = compareLoose;\n\nconst SemVer$5 = semver$2;\nconst compareBuild$2 = (a, b, loose) => {\n const versionA = new SemVer$5(a, loose);\n const versionB = new SemVer$5(b, loose);\n return versionA.compare(versionB) || versionA.compareBuild(versionB)\n};\nvar compareBuild_1 = compareBuild$2;\n\nconst compareBuild$1 = compareBuild_1;\nconst sort = (list, loose) => list.sort((a, b) => compareBuild$1(a, b, loose));\nvar sort_1 = sort;\n\nconst compareBuild = compareBuild_1;\nconst rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));\nvar rsort_1 = rsort;\n\nconst compare$6 = compare_1;\nconst gt$3 = (a, b, loose) => compare$6(a, b, loose) > 0;\nvar gt_1 = gt$3;\n\nconst compare$5 = compare_1;\nconst lt$2 = (a, b, loose) => compare$5(a, b, loose) < 0;\nvar lt_1 = lt$2;\n\nconst compare$4 = compare_1;\nconst neq$1 = (a, b, loose) => compare$4(a, b, loose) !== 0;\nvar neq_1 = neq$1;\n\nconst compare$3 = compare_1;\nconst gte$2 = (a, b, loose) => compare$3(a, b, loose) >= 0;\nvar gte_1 = gte$2;\n\nconst compare$2 = compare_1;\nconst lte$2 = (a, b, loose) => compare$2(a, b, loose) <= 0;\nvar lte_1 = lte$2;\n\nconst eq = eq_1;\nconst neq = neq_1;\nconst gt$2 = gt_1;\nconst gte$1 = gte_1;\nconst lt$1 = lt_1;\nconst lte$1 = lte_1;\n\nconst cmp = (a, op, b, loose) => {\n switch (op) {\n case '===':\n if (typeof a === 'object') {\n a = a.version;\n }\n if (typeof b === 'object') {\n b = b.version;\n }\n return a === b\n\n case '!==':\n if (typeof a === 'object') {\n a = a.version;\n }\n if (typeof b === 'object') {\n b = b.version;\n }\n return a !== b\n\n case '':\n case '=':\n case '==':\n return eq(a, b, loose)\n\n case '!=':\n return neq(a, b, loose)\n\n case '>':\n return gt$2(a, b, loose)\n\n case '>=':\n return gte$1(a, b, loose)\n\n case '<':\n return lt$1(a, b, loose)\n\n case '<=':\n return lte$1(a, b, loose)\n\n default:\n throw new TypeError(`Invalid operator: ${op}`)\n }\n};\nvar cmp_1 = cmp;\n\nconst SemVer$4 = semver$2;\nconst parse = parse_1;\nconst { re, t } = re$3.exports;\n\nconst coerce = (version, options) => {\n if (version instanceof SemVer$4) {\n return version\n }\n\n if (typeof version === 'number') {\n version = String(version);\n }\n\n if (typeof version !== 'string') {\n return null\n }\n\n options = options || {};\n\n let match = null;\n if (!options.rtl) {\n match = version.match(re[t.COERCE]);\n } else {\n // Find the right-most coercible string that does not share\n // a terminus with a more left-ward coercible string.\n // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'\n //\n // Walk through the string checking with a /g regexp\n // Manually set the index so as to pick up overlapping matches.\n // Stop when we get a match that ends at the string end, since no\n // coercible string can be more right-ward without the same terminus.\n let next;\n while ((next = re[t.COERCERTL].exec(version)) &&\n (!match || match.index + match[0].length !== version.length)\n ) {\n if (!match ||\n next.index + next[0].length !== match.index + match[0].length) {\n match = next;\n }\n re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length;\n }\n // leave it in a clean state\n re[t.COERCERTL].lastIndex = -1;\n }\n\n if (match === null) {\n return null\n }\n\n return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options)\n};\nvar coerce_1 = coerce;\n\nvar iterator;\nvar hasRequiredIterator;\n\nfunction requireIterator () {\n\tif (hasRequiredIterator) return iterator;\n\thasRequiredIterator = 1;\n\titerator = function (Yallist) {\n\t Yallist.prototype[Symbol.iterator] = function* () {\n\t for (let walker = this.head; walker; walker = walker.next) {\n\t yield walker.value;\n\t }\n\t };\n\t};\n\treturn iterator;\n}\n\nvar yallist;\nvar hasRequiredYallist;\n\nfunction requireYallist () {\n\tif (hasRequiredYallist) return yallist;\n\thasRequiredYallist = 1;\n\tyallist = Yallist;\n\n\tYallist.Node = Node;\n\tYallist.create = Yallist;\n\n\tfunction Yallist (list) {\n\t var self = this;\n\t if (!(self instanceof Yallist)) {\n\t self = new Yallist();\n\t }\n\n\t self.tail = null;\n\t self.head = null;\n\t self.length = 0;\n\n\t if (list && typeof list.forEach === 'function') {\n\t list.forEach(function (item) {\n\t self.push(item);\n\t });\n\t } else if (arguments.length > 0) {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t self.push(arguments[i]);\n\t }\n\t }\n\n\t return self\n\t}\n\n\tYallist.prototype.removeNode = function (node) {\n\t if (node.list !== this) {\n\t throw new Error('removing node which does not belong to this list')\n\t }\n\n\t var next = node.next;\n\t var prev = node.prev;\n\n\t if (next) {\n\t next.prev = prev;\n\t }\n\n\t if (prev) {\n\t prev.next = next;\n\t }\n\n\t if (node === this.head) {\n\t this.head = next;\n\t }\n\t if (node === this.tail) {\n\t this.tail = prev;\n\t }\n\n\t node.list.length--;\n\t node.next = null;\n\t node.prev = null;\n\t node.list = null;\n\n\t return next\n\t};\n\n\tYallist.prototype.unshiftNode = function (node) {\n\t if (node === this.head) {\n\t return\n\t }\n\n\t if (node.list) {\n\t node.list.removeNode(node);\n\t }\n\n\t var head = this.head;\n\t node.list = this;\n\t node.next = head;\n\t if (head) {\n\t head.prev = node;\n\t }\n\n\t this.head = node;\n\t if (!this.tail) {\n\t this.tail = node;\n\t }\n\t this.length++;\n\t};\n\n\tYallist.prototype.pushNode = function (node) {\n\t if (node === this.tail) {\n\t return\n\t }\n\n\t if (node.list) {\n\t node.list.removeNode(node);\n\t }\n\n\t var tail = this.tail;\n\t node.list = this;\n\t node.prev = tail;\n\t if (tail) {\n\t tail.next = node;\n\t }\n\n\t this.tail = node;\n\t if (!this.head) {\n\t this.head = node;\n\t }\n\t this.length++;\n\t};\n\n\tYallist.prototype.push = function () {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t push(this, arguments[i]);\n\t }\n\t return this.length\n\t};\n\n\tYallist.prototype.unshift = function () {\n\t for (var i = 0, l = arguments.length; i < l; i++) {\n\t unshift(this, arguments[i]);\n\t }\n\t return this.length\n\t};\n\n\tYallist.prototype.pop = function () {\n\t if (!this.tail) {\n\t return undefined\n\t }\n\n\t var res = this.tail.value;\n\t this.tail = this.tail.prev;\n\t if (this.tail) {\n\t this.tail.next = null;\n\t } else {\n\t this.head = null;\n\t }\n\t this.length--;\n\t return res\n\t};\n\n\tYallist.prototype.shift = function () {\n\t if (!this.head) {\n\t return undefined\n\t }\n\n\t var res = this.head.value;\n\t this.head = this.head.next;\n\t if (this.head) {\n\t this.head.prev = null;\n\t } else {\n\t this.tail = null;\n\t }\n\t this.length--;\n\t return res\n\t};\n\n\tYallist.prototype.forEach = function (fn, thisp) {\n\t thisp = thisp || this;\n\t for (var walker = this.head, i = 0; walker !== null; i++) {\n\t fn.call(thisp, walker.value, i, this);\n\t walker = walker.next;\n\t }\n\t};\n\n\tYallist.prototype.forEachReverse = function (fn, thisp) {\n\t thisp = thisp || this;\n\t for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {\n\t fn.call(thisp, walker.value, i, this);\n\t walker = walker.prev;\n\t }\n\t};\n\n\tYallist.prototype.get = function (n) {\n\t for (var i = 0, walker = this.head; walker !== null && i < n; i++) {\n\t // abort out of the list early if we hit a cycle\n\t walker = walker.next;\n\t }\n\t if (i === n && walker !== null) {\n\t return walker.value\n\t }\n\t};\n\n\tYallist.prototype.getReverse = function (n) {\n\t for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {\n\t // abort out of the list early if we hit a cycle\n\t walker = walker.prev;\n\t }\n\t if (i === n && walker !== null) {\n\t return walker.value\n\t }\n\t};\n\n\tYallist.prototype.map = function (fn, thisp) {\n\t thisp = thisp || this;\n\t var res = new Yallist();\n\t for (var walker = this.head; walker !== null;) {\n\t res.push(fn.call(thisp, walker.value, this));\n\t walker = walker.next;\n\t }\n\t return res\n\t};\n\n\tYallist.prototype.mapReverse = function (fn, thisp) {\n\t thisp = thisp || this;\n\t var res = new Yallist();\n\t for (var walker = this.tail; walker !== null;) {\n\t res.push(fn.call(thisp, walker.value, this));\n\t walker = walker.prev;\n\t }\n\t return res\n\t};\n\n\tYallist.prototype.reduce = function (fn, initial) {\n\t var acc;\n\t var walker = this.head;\n\t if (arguments.length > 1) {\n\t acc = initial;\n\t } else if (this.head) {\n\t walker = this.head.next;\n\t acc = this.head.value;\n\t } else {\n\t throw new TypeError('Reduce of empty list with no initial value')\n\t }\n\n\t for (var i = 0; walker !== null; i++) {\n\t acc = fn(acc, walker.value, i);\n\t walker = walker.next;\n\t }\n\n\t return acc\n\t};\n\n\tYallist.prototype.reduceReverse = function (fn, initial) {\n\t var acc;\n\t var walker = this.tail;\n\t if (arguments.length > 1) {\n\t acc = initial;\n\t } else if (this.tail) {\n\t walker = this.tail.prev;\n\t acc = this.tail.value;\n\t } else {\n\t throw new TypeError('Reduce of empty list with no initial value')\n\t }\n\n\t for (var i = this.length - 1; walker !== null; i--) {\n\t acc = fn(acc, walker.value, i);\n\t walker = walker.prev;\n\t }\n\n\t return acc\n\t};\n\n\tYallist.prototype.toArray = function () {\n\t var arr = new Array(this.length);\n\t for (var i = 0, walker = this.head; walker !== null; i++) {\n\t arr[i] = walker.value;\n\t walker = walker.next;\n\t }\n\t return arr\n\t};\n\n\tYallist.prototype.toArrayReverse = function () {\n\t var arr = new Array(this.length);\n\t for (var i = 0, walker = this.tail; walker !== null; i++) {\n\t arr[i] = walker.value;\n\t walker = walker.prev;\n\t }\n\t return arr\n\t};\n\n\tYallist.prototype.slice = function (from, to) {\n\t to = to || this.length;\n\t if (to < 0) {\n\t to += this.length;\n\t }\n\t from = from || 0;\n\t if (from < 0) {\n\t from += this.length;\n\t }\n\t var ret = new Yallist();\n\t if (to < from || to < 0) {\n\t return ret\n\t }\n\t if (from < 0) {\n\t from = 0;\n\t }\n\t if (to > this.length) {\n\t to = this.length;\n\t }\n\t for (var i = 0, walker = this.head; walker !== null && i < from; i++) {\n\t walker = walker.next;\n\t }\n\t for (; walker !== null && i < to; i++, walker = walker.next) {\n\t ret.push(walker.value);\n\t }\n\t return ret\n\t};\n\n\tYallist.prototype.sliceReverse = function (from, to) {\n\t to = to || this.length;\n\t if (to < 0) {\n\t to += this.length;\n\t }\n\t from = from || 0;\n\t if (from < 0) {\n\t from += this.length;\n\t }\n\t var ret = new Yallist();\n\t if (to < from || to < 0) {\n\t return ret\n\t }\n\t if (from < 0) {\n\t from = 0;\n\t }\n\t if (to > this.length) {\n\t to = this.length;\n\t }\n\t for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {\n\t walker = walker.prev;\n\t }\n\t for (; walker !== null && i > from; i--, walker = walker.prev) {\n\t ret.push(walker.value);\n\t }\n\t return ret\n\t};\n\n\tYallist.prototype.splice = function (start, deleteCount, ...nodes) {\n\t if (start > this.length) {\n\t start = this.length - 1;\n\t }\n\t if (start < 0) {\n\t start = this.length + start;\n\t }\n\n\t for (var i = 0, walker = this.head; walker !== null && i < start; i++) {\n\t walker = walker.next;\n\t }\n\n\t var ret = [];\n\t for (var i = 0; walker && i < deleteCount; i++) {\n\t ret.push(walker.value);\n\t walker = this.removeNode(walker);\n\t }\n\t if (walker === null) {\n\t walker = this.tail;\n\t }\n\n\t if (walker !== this.head && walker !== this.tail) {\n\t walker = walker.prev;\n\t }\n\n\t for (var i = 0; i < nodes.length; i++) {\n\t walker = insert(this, walker, nodes[i]);\n\t }\n\t return ret;\n\t};\n\n\tYallist.prototype.reverse = function () {\n\t var head = this.head;\n\t var tail = this.tail;\n\t for (var walker = head; walker !== null; walker = walker.prev) {\n\t var p = walker.prev;\n\t walker.prev = walker.next;\n\t walker.next = p;\n\t }\n\t this.head = tail;\n\t this.tail = head;\n\t return this\n\t};\n\n\tfunction insert (self, node, value) {\n\t var inserted = node === self.head ?\n\t new Node(value, null, node, self) :\n\t new Node(value, node, node.next, self);\n\n\t if (inserted.next === null) {\n\t self.tail = inserted;\n\t }\n\t if (inserted.prev === null) {\n\t self.head = inserted;\n\t }\n\n\t self.length++;\n\n\t return inserted\n\t}\n\n\tfunction push (self, item) {\n\t self.tail = new Node(item, self.tail, null, self);\n\t if (!self.head) {\n\t self.head = self.tail;\n\t }\n\t self.length++;\n\t}\n\n\tfunction unshift (self, item) {\n\t self.head = new Node(item, null, self.head, self);\n\t if (!self.tail) {\n\t self.tail = self.head;\n\t }\n\t self.length++;\n\t}\n\n\tfunction Node (value, prev, next, list) {\n\t if (!(this instanceof Node)) {\n\t return new Node(value, prev, next, list)\n\t }\n\n\t this.list = list;\n\t this.value = value;\n\n\t if (prev) {\n\t prev.next = this;\n\t this.prev = prev;\n\t } else {\n\t this.prev = null;\n\t }\n\n\t if (next) {\n\t next.prev = this;\n\t this.next = next;\n\t } else {\n\t this.next = null;\n\t }\n\t}\n\n\ttry {\n\t // add if support for Symbol.iterator is present\n\t requireIterator()(Yallist);\n\t} catch (er) {}\n\treturn yallist;\n}\n\nvar lruCache;\nvar hasRequiredLruCache;\n\nfunction requireLruCache () {\n\tif (hasRequiredLruCache) return lruCache;\n\thasRequiredLruCache = 1;\n\n\t// A linked list to keep track of recently-used-ness\n\tconst Yallist = requireYallist();\n\n\tconst MAX = Symbol('max');\n\tconst LENGTH = Symbol('length');\n\tconst LENGTH_CALCULATOR = Symbol('lengthCalculator');\n\tconst ALLOW_STALE = Symbol('allowStale');\n\tconst MAX_AGE = Symbol('maxAge');\n\tconst DISPOSE = Symbol('dispose');\n\tconst NO_DISPOSE_ON_SET = Symbol('noDisposeOnSet');\n\tconst LRU_LIST = Symbol('lruList');\n\tconst CACHE = Symbol('cache');\n\tconst UPDATE_AGE_ON_GET = Symbol('updateAgeOnGet');\n\n\tconst naiveLength = () => 1;\n\n\t// lruList is a yallist where the head is the youngest\n\t// item, and the tail is the oldest. the list contains the Hit\n\t// objects as the entries.\n\t// Each Hit object has a reference to its Yallist.Node. This\n\t// never changes.\n\t//\n\t// cache is a Map (or PseudoMap) that matches the keys to\n\t// the Yallist.Node object.\n\tclass LRUCache {\n\t constructor (options) {\n\t if (typeof options === 'number')\n\t options = { max: options };\n\n\t if (!options)\n\t options = {};\n\n\t if (options.max && (typeof options.max !== 'number' || options.max < 0))\n\t throw new TypeError('max must be a non-negative number')\n\t // Kind of weird to have a default max of Infinity, but oh well.\n\t this[MAX] = options.max || Infinity;\n\n\t const lc = options.length || naiveLength;\n\t this[LENGTH_CALCULATOR] = (typeof lc !== 'function') ? naiveLength : lc;\n\t this[ALLOW_STALE] = options.stale || false;\n\t if (options.maxAge && typeof options.maxAge !== 'number')\n\t throw new TypeError('maxAge must be a number')\n\t this[MAX_AGE] = options.maxAge || 0;\n\t this[DISPOSE] = options.dispose;\n\t this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;\n\t this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false;\n\t this.reset();\n\t }\n\n\t // resize the cache when the max changes.\n\t set max (mL) {\n\t if (typeof mL !== 'number' || mL < 0)\n\t throw new TypeError('max must be a non-negative number')\n\n\t this[MAX] = mL || Infinity;\n\t trim(this);\n\t }\n\t get max () {\n\t return this[MAX]\n\t }\n\n\t set allowStale (allowStale) {\n\t this[ALLOW_STALE] = !!allowStale;\n\t }\n\t get allowStale () {\n\t return this[ALLOW_STALE]\n\t }\n\n\t set maxAge (mA) {\n\t if (typeof mA !== 'number')\n\t throw new TypeError('maxAge must be a non-negative number')\n\n\t this[MAX_AGE] = mA;\n\t trim(this);\n\t }\n\t get maxAge () {\n\t return this[MAX_AGE]\n\t }\n\n\t // resize the cache when the lengthCalculator changes.\n\t set lengthCalculator (lC) {\n\t if (typeof lC !== 'function')\n\t lC = naiveLength;\n\n\t if (lC !== this[LENGTH_CALCULATOR]) {\n\t this[LENGTH_CALCULATOR] = lC;\n\t this[LENGTH] = 0;\n\t this[LRU_LIST].forEach(hit => {\n\t hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);\n\t this[LENGTH] += hit.length;\n\t });\n\t }\n\t trim(this);\n\t }\n\t get lengthCalculator () { return this[LENGTH_CALCULATOR] }\n\n\t get length () { return this[LENGTH] }\n\t get itemCount () { return this[LRU_LIST].length }\n\n\t rforEach (fn, thisp) {\n\t thisp = thisp || this;\n\t for (let walker = this[LRU_LIST].tail; walker !== null;) {\n\t const prev = walker.prev;\n\t forEachStep(this, fn, walker, thisp);\n\t walker = prev;\n\t }\n\t }\n\n\t forEach (fn, thisp) {\n\t thisp = thisp || this;\n\t for (let walker = this[LRU_LIST].head; walker !== null;) {\n\t const next = walker.next;\n\t forEachStep(this, fn, walker, thisp);\n\t walker = next;\n\t }\n\t }\n\n\t keys () {\n\t return this[LRU_LIST].toArray().map(k => k.key)\n\t }\n\n\t values () {\n\t return this[LRU_LIST].toArray().map(k => k.value)\n\t }\n\n\t reset () {\n\t if (this[DISPOSE] &&\n\t this[LRU_LIST] &&\n\t this[LRU_LIST].length) {\n\t this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value));\n\t }\n\n\t this[CACHE] = new Map(); // hash of items by key\n\t this[LRU_LIST] = new Yallist(); // list of items in order of use recency\n\t this[LENGTH] = 0; // length of items in the list\n\t }\n\n\t dump () {\n\t return this[LRU_LIST].map(hit =>\n\t isStale(this, hit) ? false : {\n\t k: hit.key,\n\t v: hit.value,\n\t e: hit.now + (hit.maxAge || 0)\n\t }).toArray().filter(h => h)\n\t }\n\n\t dumpLru () {\n\t return this[LRU_LIST]\n\t }\n\n\t set (key, value, maxAge) {\n\t maxAge = maxAge || this[MAX_AGE];\n\n\t if (maxAge && typeof maxAge !== 'number')\n\t throw new TypeError('maxAge must be a number')\n\n\t const now = maxAge ? Date.now() : 0;\n\t const len = this[LENGTH_CALCULATOR](value, key);\n\n\t if (this[CACHE].has(key)) {\n\t if (len > this[MAX]) {\n\t del(this, this[CACHE].get(key));\n\t return false\n\t }\n\n\t const node = this[CACHE].get(key);\n\t const item = node.value;\n\n\t // dispose of the old one before overwriting\n\t // split out into 2 ifs for better coverage tracking\n\t if (this[DISPOSE]) {\n\t if (!this[NO_DISPOSE_ON_SET])\n\t this[DISPOSE](key, item.value);\n\t }\n\n\t item.now = now;\n\t item.maxAge = maxAge;\n\t item.value = value;\n\t this[LENGTH] += len - item.length;\n\t item.length = len;\n\t this.get(key);\n\t trim(this);\n\t return true\n\t }\n\n\t const hit = new Entry(key, value, len, now, maxAge);\n\n\t // oversized objects fall out of cache automatically.\n\t if (hit.length > this[MAX]) {\n\t if (this[DISPOSE])\n\t this[DISPOSE](key, value);\n\n\t return false\n\t }\n\n\t this[LENGTH] += hit.length;\n\t this[LRU_LIST].unshift(hit);\n\t this[CACHE].set(key, this[LRU_LIST].head);\n\t trim(this);\n\t return true\n\t }\n\n\t has (key) {\n\t if (!this[CACHE].has(key)) return false\n\t const hit = this[CACHE].get(key).value;\n\t return !isStale(this, hit)\n\t }\n\n\t get (key) {\n\t return get(this, key, true)\n\t }\n\n\t peek (key) {\n\t return get(this, key, false)\n\t }\n\n\t pop () {\n\t const node = this[LRU_LIST].tail;\n\t if (!node)\n\t return null\n\n\t del(this, node);\n\t return node.value\n\t }\n\n\t del (key) {\n\t del(this, this[CACHE].get(key));\n\t }\n\n\t load (arr) {\n\t // reset the cache\n\t this.reset();\n\n\t const now = Date.now();\n\t // A previous serialized cache has the most recent items first\n\t for (let l = arr.length - 1; l >= 0; l--) {\n\t const hit = arr[l];\n\t const expiresAt = hit.e || 0;\n\t if (expiresAt === 0)\n\t // the item was created without expiration in a non aged cache\n\t this.set(hit.k, hit.v);\n\t else {\n\t const maxAge = expiresAt - now;\n\t // dont add already expired items\n\t if (maxAge > 0) {\n\t this.set(hit.k, hit.v, maxAge);\n\t }\n\t }\n\t }\n\t }\n\n\t prune () {\n\t this[CACHE].forEach((value, key) => get(this, key, false));\n\t }\n\t}\n\n\tconst get = (self, key, doUse) => {\n\t const node = self[CACHE].get(key);\n\t if (node) {\n\t const hit = node.value;\n\t if (isStale(self, hit)) {\n\t del(self, node);\n\t if (!self[ALLOW_STALE])\n\t return undefined\n\t } else {\n\t if (doUse) {\n\t if (self[UPDATE_AGE_ON_GET])\n\t node.value.now = Date.now();\n\t self[LRU_LIST].unshiftNode(node);\n\t }\n\t }\n\t return hit.value\n\t }\n\t};\n\n\tconst isStale = (self, hit) => {\n\t if (!hit || (!hit.maxAge && !self[MAX_AGE]))\n\t return false\n\n\t const diff = Date.now() - hit.now;\n\t return hit.maxAge ? diff > hit.maxAge\n\t : self[MAX_AGE] && (diff > self[MAX_AGE])\n\t};\n\n\tconst trim = self => {\n\t if (self[LENGTH] > self[MAX]) {\n\t for (let walker = self[LRU_LIST].tail;\n\t self[LENGTH] > self[MAX] && walker !== null;) {\n\t // We know that we're about to delete this one, and also\n\t // what the next least recently used key will be, so just\n\t // go ahead and set it now.\n\t const prev = walker.prev;\n\t del(self, walker);\n\t walker = prev;\n\t }\n\t }\n\t};\n\n\tconst del = (self, node) => {\n\t if (node) {\n\t const hit = node.value;\n\t if (self[DISPOSE])\n\t self[DISPOSE](hit.key, hit.value);\n\n\t self[LENGTH] -= hit.length;\n\t self[CACHE].delete(hit.key);\n\t self[LRU_LIST].removeNode(node);\n\t }\n\t};\n\n\tclass Entry {\n\t constructor (key, value, length, now, maxAge) {\n\t this.key = key;\n\t this.value = value;\n\t this.length = length;\n\t this.now = now;\n\t this.maxAge = maxAge || 0;\n\t }\n\t}\n\n\tconst forEachStep = (self, fn, node, thisp) => {\n\t let hit = node.value;\n\t if (isStale(self, hit)) {\n\t del(self, node);\n\t if (!self[ALLOW_STALE])\n\t hit = undefined;\n\t }\n\t if (hit)\n\t fn.call(thisp, hit.value, hit.key, self);\n\t};\n\n\tlruCache = LRUCache;\n\treturn lruCache;\n}\n\nvar range;\nvar hasRequiredRange;\n\nfunction requireRange () {\n\tif (hasRequiredRange) return range;\n\thasRequiredRange = 1;\n\t// hoisted class for cyclic dependency\n\tclass Range {\n\t constructor (range, options) {\n\t options = parseOptions(options);\n\n\t if (range instanceof Range) {\n\t if (\n\t range.loose === !!options.loose &&\n\t range.includePrerelease === !!options.includePrerelease\n\t ) {\n\t return range\n\t } else {\n\t return new Range(range.raw, options)\n\t }\n\t }\n\n\t if (range instanceof Comparator) {\n\t // just put it in the set and return\n\t this.raw = range.value;\n\t this.set = [[range]];\n\t this.format();\n\t return this\n\t }\n\n\t this.options = options;\n\t this.loose = !!options.loose;\n\t this.includePrerelease = !!options.includePrerelease;\n\n\t // First, split based on boolean or ||\n\t this.raw = range;\n\t this.set = range\n\t .split('||')\n\t // map the range to a 2d array of comparators\n\t .map(r => this.parseRange(r.trim()))\n\t // throw out any comparator lists that are empty\n\t // this generally means that it was not a valid range, which is allowed\n\t // in loose mode, but will still throw if the WHOLE range is invalid.\n\t .filter(c => c.length);\n\n\t if (!this.set.length) {\n\t throw new TypeError(`Invalid SemVer Range: ${range}`)\n\t }\n\n\t // if we have any that are not the null set, throw out null sets.\n\t if (this.set.length > 1) {\n\t // keep the first one, in case they're all null sets\n\t const first = this.set[0];\n\t this.set = this.set.filter(c => !isNullSet(c[0]));\n\t if (this.set.length === 0) {\n\t this.set = [first];\n\t } else if (this.set.length > 1) {\n\t // if we have any that are *, then the range is just *\n\t for (const c of this.set) {\n\t if (c.length === 1 && isAny(c[0])) {\n\t this.set = [c];\n\t break\n\t }\n\t }\n\t }\n\t }\n\n\t this.format();\n\t }\n\n\t format () {\n\t this.range = this.set\n\t .map((comps) => {\n\t return comps.join(' ').trim()\n\t })\n\t .join('||')\n\t .trim();\n\t return this.range\n\t }\n\n\t toString () {\n\t return this.range\n\t }\n\n\t parseRange (range) {\n\t range = range.trim();\n\n\t // memoize range parsing for performance.\n\t // this is a very hot path, and fully deterministic.\n\t const memoOpts = Object.keys(this.options).join(',');\n\t const memoKey = `parseRange:${memoOpts}:${range}`;\n\t const cached = cache.get(memoKey);\n\t if (cached) {\n\t return cached\n\t }\n\n\t const loose = this.options.loose;\n\t // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`\n\t const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];\n\t range = range.replace(hr, hyphenReplace(this.options.includePrerelease));\n\t debug('hyphen replace', range);\n\t // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`\n\t range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);\n\t debug('comparator trim', range);\n\n\t // `~ 1.2.3` => `~1.2.3`\n\t range = range.replace(re[t.TILDETRIM], tildeTrimReplace);\n\n\t // `^ 1.2.3` => `^1.2.3`\n\t range = range.replace(re[t.CARETTRIM], caretTrimReplace);\n\n\t // normalize spaces\n\t range = range.split(/\\s+/).join(' ');\n\n\t // At this point, the range is completely trimmed and\n\t // ready to be split into comparators.\n\n\t let rangeList = range\n\t .split(' ')\n\t .map(comp => parseComparator(comp, this.options))\n\t .join(' ')\n\t .split(/\\s+/)\n\t // >=0.0.0 is equivalent to *\n\t .map(comp => replaceGTE0(comp, this.options));\n\n\t if (loose) {\n\t // in loose mode, throw out any that are not valid comparators\n\t rangeList = rangeList.filter(comp => {\n\t debug('loose invalid filter', comp, this.options);\n\t return !!comp.match(re[t.COMPARATORLOOSE])\n\t });\n\t }\n\t debug('range list', rangeList);\n\n\t // if any comparators are the null set, then replace with JUST null set\n\t // if more than one comparator, remove any * comparators\n\t // also, don't include the same comparator more than once\n\t const rangeMap = new Map();\n\t const comparators = rangeList.map(comp => new Comparator(comp, this.options));\n\t for (const comp of comparators) {\n\t if (isNullSet(comp)) {\n\t return [comp]\n\t }\n\t rangeMap.set(comp.value, comp);\n\t }\n\t if (rangeMap.size > 1 && rangeMap.has('')) {\n\t rangeMap.delete('');\n\t }\n\n\t const result = [...rangeMap.values()];\n\t cache.set(memoKey, result);\n\t return result\n\t }\n\n\t intersects (range, options) {\n\t if (!(range instanceof Range)) {\n\t throw new TypeError('a Range is required')\n\t }\n\n\t return this.set.some((thisComparators) => {\n\t return (\n\t isSatisfiable(thisComparators, options) &&\n\t range.set.some((rangeComparators) => {\n\t return (\n\t isSatisfiable(rangeComparators, options) &&\n\t thisComparators.every((thisComparator) => {\n\t return rangeComparators.every((rangeComparator) => {\n\t return thisComparator.intersects(rangeComparator, options)\n\t })\n\t })\n\t )\n\t })\n\t )\n\t })\n\t }\n\n\t // if ANY of the sets match ALL of its comparators, then pass\n\t test (version) {\n\t if (!version) {\n\t return false\n\t }\n\n\t if (typeof version === 'string') {\n\t try {\n\t version = new SemVer(version, this.options);\n\t } catch (er) {\n\t return false\n\t }\n\t }\n\n\t for (let i = 0; i < this.set.length; i++) {\n\t if (testSet(this.set[i], version, this.options)) {\n\t return true\n\t }\n\t }\n\t return false\n\t }\n\t}\n\trange = Range;\n\n\tconst LRU = requireLruCache();\n\tconst cache = new LRU({ max: 1000 });\n\n\tconst parseOptions = parseOptions_1;\n\tconst Comparator = requireComparator();\n\tconst debug = debug_1;\n\tconst SemVer = semver$2;\n\tconst {\n\t re,\n\t t,\n\t comparatorTrimReplace,\n\t tildeTrimReplace,\n\t caretTrimReplace,\n\t} = re$3.exports;\n\n\tconst isNullSet = c => c.value === '<0.0.0-0';\n\tconst isAny = c => c.value === '';\n\n\t// take a set of comparators and determine whether there\n\t// exists a version which can satisfy it\n\tconst isSatisfiable = (comparators, options) => {\n\t let result = true;\n\t const remainingComparators = comparators.slice();\n\t let testComparator = remainingComparators.pop();\n\n\t while (result && remainingComparators.length) {\n\t result = remainingComparators.every((otherComparator) => {\n\t return testComparator.intersects(otherComparator, options)\n\t });\n\n\t testComparator = remainingComparators.pop();\n\t }\n\n\t return result\n\t};\n\n\t// comprised of xranges, tildes, stars, and gtlt's at this point.\n\t// already replaced the hyphen ranges\n\t// turn into a set of JUST comparators.\n\tconst parseComparator = (comp, options) => {\n\t debug('comp', comp, options);\n\t comp = replaceCarets(comp, options);\n\t debug('caret', comp);\n\t comp = replaceTildes(comp, options);\n\t debug('tildes', comp);\n\t comp = replaceXRanges(comp, options);\n\t debug('xrange', comp);\n\t comp = replaceStars(comp, options);\n\t debug('stars', comp);\n\t return comp\n\t};\n\n\tconst isX = id => !id || id.toLowerCase() === 'x' || id === '*';\n\n\t// ~, ~> --> * (any, kinda silly)\n\t// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0\n\t// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0\n\t// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0\n\t// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0\n\t// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0\n\tconst replaceTildes = (comp, options) =>\n\t comp.trim().split(/\\s+/).map((c) => {\n\t return replaceTilde(c, options)\n\t }).join(' ');\n\n\tconst replaceTilde = (comp, options) => {\n\t const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];\n\t return comp.replace(r, (_, M, m, p, pr) => {\n\t debug('tilde', comp, _, M, m, p, pr);\n\t let ret;\n\n\t if (isX(M)) {\n\t ret = '';\n\t } else if (isX(m)) {\n\t ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;\n\t } else if (isX(p)) {\n\t // ~1.2 == >=1.2.0 <1.3.0-0\n\t ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;\n\t } else if (pr) {\n\t debug('replaceTilde pr', pr);\n\t ret = `>=${M}.${m}.${p}-${pr\n\t } <${M}.${+m + 1}.0-0`;\n\t } else {\n\t // ~1.2.3 == >=1.2.3 <1.3.0-0\n\t ret = `>=${M}.${m}.${p\n\t } <${M}.${+m + 1}.0-0`;\n\t }\n\n\t debug('tilde return', ret);\n\t return ret\n\t })\n\t};\n\n\t// ^ --> * (any, kinda silly)\n\t// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0\n\t// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0\n\t// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0\n\t// ^1.2.3 --> >=1.2.3 <2.0.0-0\n\t// ^1.2.0 --> >=1.2.0 <2.0.0-0\n\tconst replaceCarets = (comp, options) =>\n\t comp.trim().split(/\\s+/).map((c) => {\n\t return replaceCaret(c, options)\n\t }).join(' ');\n\n\tconst replaceCaret = (comp, options) => {\n\t debug('caret', comp, options);\n\t const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];\n\t const z = options.includePrerelease ? '-0' : '';\n\t return comp.replace(r, (_, M, m, p, pr) => {\n\t debug('caret', comp, _, M, m, p, pr);\n\t let ret;\n\n\t if (isX(M)) {\n\t ret = '';\n\t } else if (isX(m)) {\n\t ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;\n\t } else if (isX(p)) {\n\t if (M === '0') {\n\t ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;\n\t } else {\n\t ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;\n\t }\n\t } else if (pr) {\n\t debug('replaceCaret pr', pr);\n\t if (M === '0') {\n\t if (m === '0') {\n\t ret = `>=${M}.${m}.${p}-${pr\n\t } <${M}.${m}.${+p + 1}-0`;\n\t } else {\n\t ret = `>=${M}.${m}.${p}-${pr\n\t } <${M}.${+m + 1}.0-0`;\n\t }\n\t } else {\n\t ret = `>=${M}.${m}.${p}-${pr\n\t } <${+M + 1}.0.0-0`;\n\t }\n\t } else {\n\t debug('no pr');\n\t if (M === '0') {\n\t if (m === '0') {\n\t ret = `>=${M}.${m}.${p\n\t }${z} <${M}.${m}.${+p + 1}-0`;\n\t } else {\n\t ret = `>=${M}.${m}.${p\n\t }${z} <${M}.${+m + 1}.0-0`;\n\t }\n\t } else {\n\t ret = `>=${M}.${m}.${p\n\t } <${+M + 1}.0.0-0`;\n\t }\n\t }\n\n\t debug('caret return', ret);\n\t return ret\n\t })\n\t};\n\n\tconst replaceXRanges = (comp, options) => {\n\t debug('replaceXRanges', comp, options);\n\t return comp.split(/\\s+/).map((c) => {\n\t return replaceXRange(c, options)\n\t }).join(' ')\n\t};\n\n\tconst replaceXRange = (comp, options) => {\n\t comp = comp.trim();\n\t const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];\n\t return comp.replace(r, (ret, gtlt, M, m, p, pr) => {\n\t debug('xRange', comp, ret, gtlt, M, m, p, pr);\n\t const xM = isX(M);\n\t const xm = xM || isX(m);\n\t const xp = xm || isX(p);\n\t const anyX = xp;\n\n\t if (gtlt === '=' && anyX) {\n\t gtlt = '';\n\t }\n\n\t // if we're including prereleases in the match, then we need\n\t // to fix this to -0, the lowest possible prerelease value\n\t pr = options.includePrerelease ? '-0' : '';\n\n\t if (xM) {\n\t if (gtlt === '>' || gtlt === '<') {\n\t // nothing is allowed\n\t ret = '<0.0.0-0';\n\t } else {\n\t // nothing is forbidden\n\t ret = '*';\n\t }\n\t } else if (gtlt && anyX) {\n\t // we know patch is an x, because we have any x at all.\n\t // replace X with 0\n\t if (xm) {\n\t m = 0;\n\t }\n\t p = 0;\n\n\t if (gtlt === '>') {\n\t // >1 => >=2.0.0\n\t // >1.2 => >=1.3.0\n\t gtlt = '>=';\n\t if (xm) {\n\t M = +M + 1;\n\t m = 0;\n\t p = 0;\n\t } else {\n\t m = +m + 1;\n\t p = 0;\n\t }\n\t } else if (gtlt === '<=') {\n\t // <=0.7.x is actually <0.8.0, since any 0.7.x should\n\t // pass. Similarly, <=7.x is actually <8.0.0, etc.\n\t gtlt = '<';\n\t if (xm) {\n\t M = +M + 1;\n\t } else {\n\t m = +m + 1;\n\t }\n\t }\n\n\t if (gtlt === '<') {\n\t pr = '-0';\n\t }\n\n\t ret = `${gtlt + M}.${m}.${p}${pr}`;\n\t } else if (xm) {\n\t ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;\n\t } else if (xp) {\n\t ret = `>=${M}.${m}.0${pr\n\t } <${M}.${+m + 1}.0-0`;\n\t }\n\n\t debug('xRange return', ret);\n\n\t return ret\n\t })\n\t};\n\n\t// Because * is AND-ed with everything else in the comparator,\n\t// and '' means \"any version\", just remove the *s entirely.\n\tconst replaceStars = (comp, options) => {\n\t debug('replaceStars', comp, options);\n\t // Looseness is ignored here. star is always as loose as it gets!\n\t return comp.trim().replace(re[t.STAR], '')\n\t};\n\n\tconst replaceGTE0 = (comp, options) => {\n\t debug('replaceGTE0', comp, options);\n\t return comp.trim()\n\t .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')\n\t};\n\n\t// This function is passed to string.replace(re[t.HYPHENRANGE])\n\t// M, m, patch, prerelease, build\n\t// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5\n\t// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do\n\t// 1.2 - 3.4 => >=1.2.0 <3.5.0-0\n\tconst hyphenReplace = incPr => ($0,\n\t from, fM, fm, fp, fpr, fb,\n\t to, tM, tm, tp, tpr, tb) => {\n\t if (isX(fM)) {\n\t from = '';\n\t } else if (isX(fm)) {\n\t from = `>=${fM}.0.0${incPr ? '-0' : ''}`;\n\t } else if (isX(fp)) {\n\t from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`;\n\t } else if (fpr) {\n\t from = `>=${from}`;\n\t } else {\n\t from = `>=${from}${incPr ? '-0' : ''}`;\n\t }\n\n\t if (isX(tM)) {\n\t to = '';\n\t } else if (isX(tm)) {\n\t to = `<${+tM + 1}.0.0-0`;\n\t } else if (isX(tp)) {\n\t to = `<${tM}.${+tm + 1}.0-0`;\n\t } else if (tpr) {\n\t to = `<=${tM}.${tm}.${tp}-${tpr}`;\n\t } else if (incPr) {\n\t to = `<${tM}.${tm}.${+tp + 1}-0`;\n\t } else {\n\t to = `<=${to}`;\n\t }\n\n\t return (`${from} ${to}`).trim()\n\t};\n\n\tconst testSet = (set, version, options) => {\n\t for (let i = 0; i < set.length; i++) {\n\t if (!set[i].test(version)) {\n\t return false\n\t }\n\t }\n\n\t if (version.prerelease.length && !options.includePrerelease) {\n\t // Find the set of versions that are allowed to have prereleases\n\t // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0\n\t // That should allow `1.2.3-pr.2` to pass.\n\t // However, `1.2.4-alpha.notready` should NOT be allowed,\n\t // even though it's within the range set by the comparators.\n\t for (let i = 0; i < set.length; i++) {\n\t debug(set[i].semver);\n\t if (set[i].semver === Comparator.ANY) {\n\t continue\n\t }\n\n\t if (set[i].semver.prerelease.length > 0) {\n\t const allowed = set[i].semver;\n\t if (allowed.major === version.major &&\n\t allowed.minor === version.minor &&\n\t allowed.patch === version.patch) {\n\t return true\n\t }\n\t }\n\t }\n\n\t // Version has a -pre, but it's not one of the ones we like.\n\t return false\n\t }\n\n\t return true\n\t};\n\treturn range;\n}\n\nvar comparator;\nvar hasRequiredComparator;\n\nfunction requireComparator () {\n\tif (hasRequiredComparator) return comparator;\n\thasRequiredComparator = 1;\n\tconst ANY = Symbol('SemVer ANY');\n\t// hoisted class for cyclic dependency\n\tclass Comparator {\n\t static get ANY () {\n\t return ANY\n\t }\n\n\t constructor (comp, options) {\n\t options = parseOptions(options);\n\n\t if (comp instanceof Comparator) {\n\t if (comp.loose === !!options.loose) {\n\t return comp\n\t } else {\n\t comp = comp.value;\n\t }\n\t }\n\n\t debug('comparator', comp, options);\n\t this.options = options;\n\t this.loose = !!options.loose;\n\t this.parse(comp);\n\n\t if (this.semver === ANY) {\n\t this.value = '';\n\t } else {\n\t this.value = this.operator + this.semver.version;\n\t }\n\n\t debug('comp', this);\n\t }\n\n\t parse (comp) {\n\t const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];\n\t const m = comp.match(r);\n\n\t if (!m) {\n\t throw new TypeError(`Invalid comparator: ${comp}`)\n\t }\n\n\t this.operator = m[1] !== undefined ? m[1] : '';\n\t if (this.operator === '=') {\n\t this.operator = '';\n\t }\n\n\t // if it literally is just '>' or '' then allow anything.\n\t if (!m[2]) {\n\t this.semver = ANY;\n\t } else {\n\t this.semver = new SemVer(m[2], this.options.loose);\n\t }\n\t }\n\n\t toString () {\n\t return this.value\n\t }\n\n\t test (version) {\n\t debug('Comparator.test', version, this.options.loose);\n\n\t if (this.semver === ANY || version === ANY) {\n\t return true\n\t }\n\n\t if (typeof version === 'string') {\n\t try {\n\t version = new SemVer(version, this.options);\n\t } catch (er) {\n\t return false\n\t }\n\t }\n\n\t return cmp(version, this.operator, this.semver, this.options)\n\t }\n\n\t intersects (comp, options) {\n\t if (!(comp instanceof Comparator)) {\n\t throw new TypeError('a Comparator is required')\n\t }\n\n\t if (!options || typeof options !== 'object') {\n\t options = {\n\t loose: !!options,\n\t includePrerelease: false,\n\t };\n\t }\n\n\t if (this.operator === '') {\n\t if (this.value === '') {\n\t return true\n\t }\n\t return new Range(comp.value, options).test(this.value)\n\t } else if (comp.operator === '') {\n\t if (comp.value === '') {\n\t return true\n\t }\n\t return new Range(this.value, options).test(comp.semver)\n\t }\n\n\t const sameDirectionIncreasing =\n\t (this.operator === '>=' || this.operator === '>') &&\n\t (comp.operator === '>=' || comp.operator === '>');\n\t const sameDirectionDecreasing =\n\t (this.operator === '<=' || this.operator === '<') &&\n\t (comp.operator === '<=' || comp.operator === '<');\n\t const sameSemVer = this.semver.version === comp.semver.version;\n\t const differentDirectionsInclusive =\n\t (this.operator === '>=' || this.operator === '<=') &&\n\t (comp.operator === '>=' || comp.operator === '<=');\n\t const oppositeDirectionsLessThan =\n\t cmp(this.semver, '<', comp.semver, options) &&\n\t (this.operator === '>=' || this.operator === '>') &&\n\t (comp.operator === '<=' || comp.operator === '<');\n\t const oppositeDirectionsGreaterThan =\n\t cmp(this.semver, '>', comp.semver, options) &&\n\t (this.operator === '<=' || this.operator === '<') &&\n\t (comp.operator === '>=' || comp.operator === '>');\n\n\t return (\n\t sameDirectionIncreasing ||\n\t sameDirectionDecreasing ||\n\t (sameSemVer && differentDirectionsInclusive) ||\n\t oppositeDirectionsLessThan ||\n\t oppositeDirectionsGreaterThan\n\t )\n\t }\n\t}\n\n\tcomparator = Comparator;\n\n\tconst parseOptions = parseOptions_1;\n\tconst { re, t } = re$3.exports;\n\tconst cmp = cmp_1;\n\tconst debug = debug_1;\n\tconst SemVer = semver$2;\n\tconst Range = requireRange();\n\treturn comparator;\n}\n\nconst Range$8 = requireRange();\nconst satisfies$3 = (version, range, options) => {\n try {\n range = new Range$8(range, options);\n } catch (er) {\n return false\n }\n return range.test(version)\n};\nvar satisfies_1 = satisfies$3;\n\nconst Range$7 = requireRange();\n\n// Mostly just for testing and legacy API reasons\nconst toComparators = (range, options) =>\n new Range$7(range, options).set\n .map(comp => comp.map(c => c.value).join(' ').trim().split(' '));\n\nvar toComparators_1 = toComparators;\n\nconst SemVer$3 = semver$2;\nconst Range$6 = requireRange();\n\nconst maxSatisfying = (versions, range, options) => {\n let max = null;\n let maxSV = null;\n let rangeObj = null;\n try {\n rangeObj = new Range$6(range, options);\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!max || maxSV.compare(v) === -1) {\n // compare(max, v, true)\n max = v;\n maxSV = new SemVer$3(max, options);\n }\n }\n });\n return max\n};\nvar maxSatisfying_1 = maxSatisfying;\n\nconst SemVer$2 = semver$2;\nconst Range$5 = requireRange();\nconst minSatisfying = (versions, range, options) => {\n let min = null;\n let minSV = null;\n let rangeObj = null;\n try {\n rangeObj = new Range$5(range, options);\n } catch (er) {\n return null\n }\n versions.forEach((v) => {\n if (rangeObj.test(v)) {\n // satisfies(v, range, options)\n if (!min || minSV.compare(v) === 1) {\n // compare(min, v, true)\n min = v;\n minSV = new SemVer$2(min, options);\n }\n }\n });\n return min\n};\nvar minSatisfying_1 = minSatisfying;\n\nconst SemVer$1 = semver$2;\nconst Range$4 = requireRange();\nconst gt$1 = gt_1;\n\nconst minVersion = (range, loose) => {\n range = new Range$4(range, loose);\n\n let minver = new SemVer$1('0.0.0');\n if (range.test(minver)) {\n return minver\n }\n\n minver = new SemVer$1('0.0.0-0');\n if (range.test(minver)) {\n return minver\n }\n\n minver = null;\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i];\n\n let setMin = null;\n comparators.forEach((comparator) => {\n // Clone to avoid manipulating the comparator's semver object.\n const compver = new SemVer$1(comparator.semver.version);\n switch (comparator.operator) {\n case '>':\n if (compver.prerelease.length === 0) {\n compver.patch++;\n } else {\n compver.prerelease.push(0);\n }\n compver.raw = compver.format();\n /* fallthrough */\n case '':\n case '>=':\n if (!setMin || gt$1(compver, setMin)) {\n setMin = compver;\n }\n break\n case '<':\n case '<=':\n /* Ignore maximum versions */\n break\n /* istanbul ignore next */\n default:\n throw new Error(`Unexpected operation: ${comparator.operator}`)\n }\n });\n if (setMin && (!minver || gt$1(minver, setMin))) {\n minver = setMin;\n }\n }\n\n if (minver && range.test(minver)) {\n return minver\n }\n\n return null\n};\nvar minVersion_1 = minVersion;\n\nconst Range$3 = requireRange();\nconst validRange = (range, options) => {\n try {\n // Return '*' instead of '' so that truthiness works.\n // This will throw if it's invalid anyway\n return new Range$3(range, options).range || '*'\n } catch (er) {\n return null\n }\n};\nvar valid = validRange;\n\nconst SemVer = semver$2;\nconst Comparator$1 = requireComparator();\nconst { ANY: ANY$1 } = Comparator$1;\nconst Range$2 = requireRange();\nconst satisfies$2 = satisfies_1;\nconst gt = gt_1;\nconst lt = lt_1;\nconst lte = lte_1;\nconst gte = gte_1;\n\nconst outside$2 = (version, range, hilo, options) => {\n version = new SemVer(version, options);\n range = new Range$2(range, options);\n\n let gtfn, ltefn, ltfn, comp, ecomp;\n switch (hilo) {\n case '>':\n gtfn = gt;\n ltefn = lte;\n ltfn = lt;\n comp = '>';\n ecomp = '>=';\n break\n case '<':\n gtfn = lt;\n ltefn = gte;\n ltfn = gt;\n comp = '<';\n ecomp = '<=';\n break\n default:\n throw new TypeError('Must provide a hilo val of \"<\" or \">\"')\n }\n\n // If it satisfies the range it is not outside\n if (satisfies$2(version, range, options)) {\n return false\n }\n\n // From now on, variable terms are as if we're in \"gtr\" mode.\n // but note that everything is flipped for the \"ltr\" function.\n\n for (let i = 0; i < range.set.length; ++i) {\n const comparators = range.set[i];\n\n let high = null;\n let low = null;\n\n comparators.forEach((comparator) => {\n if (comparator.semver === ANY$1) {\n comparator = new Comparator$1('>=0.0.0');\n }\n high = high || comparator;\n low = low || comparator;\n if (gtfn(comparator.semver, high.semver, options)) {\n high = comparator;\n } else if (ltfn(comparator.semver, low.semver, options)) {\n low = comparator;\n }\n });\n\n // If the edge version comparator has a operator then our version\n // isn't outside it\n if (high.operator === comp || high.operator === ecomp) {\n return false\n }\n\n // If the lowest version comparator has an operator and our version\n // is less than it then it isn't higher than the range\n if ((!low.operator || low.operator === comp) &&\n ltefn(version, low.semver)) {\n return false\n } else if (low.operator === ecomp && ltfn(version, low.semver)) {\n return false\n }\n }\n return true\n};\n\nvar outside_1 = outside$2;\n\n// Determine if version is greater than all the versions possible in the range.\nconst outside$1 = outside_1;\nconst gtr = (version, range, options) => outside$1(version, range, '>', options);\nvar gtr_1 = gtr;\n\nconst outside = outside_1;\n// Determine if version is less than all the versions possible in the range\nconst ltr = (version, range, options) => outside(version, range, '<', options);\nvar ltr_1 = ltr;\n\nconst Range$1 = requireRange();\nconst intersects = (r1, r2, options) => {\n r1 = new Range$1(r1, options);\n r2 = new Range$1(r2, options);\n return r1.intersects(r2)\n};\nvar intersects_1 = intersects;\n\n// given a set of versions and a range, create a \"simplified\" range\n// that includes the same versions that the original range does\n// If the original range is shorter than the simplified one, return that.\nconst satisfies$1 = satisfies_1;\nconst compare$1 = compare_1;\nvar simplify = (versions, range, options) => {\n const set = [];\n let first = null;\n let prev = null;\n const v = versions.sort((a, b) => compare$1(a, b, options));\n for (const version of v) {\n const included = satisfies$1(version, range, options);\n if (included) {\n prev = version;\n if (!first) {\n first = version;\n }\n } else {\n if (prev) {\n set.push([first, prev]);\n }\n prev = null;\n first = null;\n }\n }\n if (first) {\n set.push([first, null]);\n }\n\n const ranges = [];\n for (const [min, max] of set) {\n if (min === max) {\n ranges.push(min);\n } else if (!max && min === v[0]) {\n ranges.push('*');\n } else if (!max) {\n ranges.push(`>=${min}`);\n } else if (min === v[0]) {\n ranges.push(`<=${max}`);\n } else {\n ranges.push(`${min} - ${max}`);\n }\n }\n const simplified = ranges.join(' || ');\n const original = typeof range.raw === 'string' ? range.raw : String(range);\n return simplified.length < original.length ? simplified : range\n};\n\nconst Range = requireRange();\nconst Comparator = requireComparator();\nconst { ANY } = Comparator;\nconst satisfies = satisfies_1;\nconst compare = compare_1;\n\n// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:\n// - Every simple range `r1, r2, ...` is a null set, OR\n// - Every simple range `r1, r2, ...` which is not a null set is a subset of\n// some `R1, R2, ...`\n//\n// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:\n// - If c is only the ANY comparator\n// - If C is only the ANY comparator, return true\n// - Else if in prerelease mode, return false\n// - else replace c with `[>=0.0.0]`\n// - If C is only the ANY comparator\n// - if in prerelease mode, return true\n// - else replace C with `[>=0.0.0]`\n// - Let EQ be the set of = comparators in c\n// - If EQ is more than one, return true (null set)\n// - Let GT be the highest > or >= comparator in c\n// - Let LT be the lowest < or <= comparator in c\n// - If GT and LT, and GT.semver > LT.semver, return true (null set)\n// - If any C is a = range, and GT or LT are set, return false\n// - If EQ\n// - If GT, and EQ does not satisfy GT, return true (null set)\n// - If LT, and EQ does not satisfy LT, return true (null set)\n// - If EQ satisfies every C, return true\n// - Else return false\n// - If GT\n// - If GT.semver is lower than any > or >= comp in C, return false\n// - If GT is >=, and GT.semver does not satisfy every C, return false\n// - If GT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the GT.semver tuple, return false\n// - If LT\n// - If LT.semver is greater than any < or <= comp in C, return false\n// - If LT is <=, and LT.semver does not satisfy every C, return false\n// - If GT.semver has a prerelease, and not in prerelease mode\n// - If no C has a prerelease and the LT.semver tuple, return false\n// - Else return true\n\nconst subset = (sub, dom, options = {}) => {\n if (sub === dom) {\n return true\n }\n\n sub = new Range(sub, options);\n dom = new Range(dom, options);\n let sawNonNull = false;\n\n OUTER: for (const simpleSub of sub.set) {\n for (const simpleDom of dom.set) {\n const isSub = simpleSubset(simpleSub, simpleDom, options);\n sawNonNull = sawNonNull || isSub !== null;\n if (isSub) {\n continue OUTER\n }\n }\n // the null set is a subset of everything, but null simple ranges in\n // a complex range should be ignored. so if we saw a non-null range,\n // then we know this isn't a subset, but if EVERY simple range was null,\n // then it is a subset.\n if (sawNonNull) {\n return false\n }\n }\n return true\n};\n\nconst simpleSubset = (sub, dom, options) => {\n if (sub === dom) {\n return true\n }\n\n if (sub.length === 1 && sub[0].semver === ANY) {\n if (dom.length === 1 && dom[0].semver === ANY) {\n return true\n } else if (options.includePrerelease) {\n sub = [new Comparator('>=0.0.0-0')];\n } else {\n sub = [new Comparator('>=0.0.0')];\n }\n }\n\n if (dom.length === 1 && dom[0].semver === ANY) {\n if (options.includePrerelease) {\n return true\n } else {\n dom = [new Comparator('>=0.0.0')];\n }\n }\n\n const eqSet = new Set();\n let gt, lt;\n for (const c of sub) {\n if (c.operator === '>' || c.operator === '>=') {\n gt = higherGT(gt, c, options);\n } else if (c.operator === '<' || c.operator === '<=') {\n lt = lowerLT(lt, c, options);\n } else {\n eqSet.add(c.semver);\n }\n }\n\n if (eqSet.size > 1) {\n return null\n }\n\n let gtltComp;\n if (gt && lt) {\n gtltComp = compare(gt.semver, lt.semver, options);\n if (gtltComp > 0) {\n return null\n } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {\n return null\n }\n }\n\n // will iterate one or zero times\n for (const eq of eqSet) {\n if (gt && !satisfies(eq, String(gt), options)) {\n return null\n }\n\n if (lt && !satisfies(eq, String(lt), options)) {\n return null\n }\n\n for (const c of dom) {\n if (!satisfies(eq, String(c), options)) {\n return false\n }\n }\n\n return true\n }\n\n let higher, lower;\n let hasDomLT, hasDomGT;\n // if the subset has a prerelease, we need a comparator in the superset\n // with the same tuple and a prerelease, or it's not a subset\n let needDomLTPre = lt &&\n !options.includePrerelease &&\n lt.semver.prerelease.length ? lt.semver : false;\n let needDomGTPre = gt &&\n !options.includePrerelease &&\n gt.semver.prerelease.length ? gt.semver : false;\n // exception: <1.2.3-0 is the same as <1.2.3\n if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&\n lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {\n needDomLTPre = false;\n }\n\n for (const c of dom) {\n hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=';\n hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=';\n if (gt) {\n if (needDomGTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomGTPre.major &&\n c.semver.minor === needDomGTPre.minor &&\n c.semver.patch === needDomGTPre.patch) {\n needDomGTPre = false;\n }\n }\n if (c.operator === '>' || c.operator === '>=') {\n higher = higherGT(gt, c, options);\n if (higher === c && higher !== gt) {\n return false\n }\n } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {\n return false\n }\n }\n if (lt) {\n if (needDomLTPre) {\n if (c.semver.prerelease && c.semver.prerelease.length &&\n c.semver.major === needDomLTPre.major &&\n c.semver.minor === needDomLTPre.minor &&\n c.semver.patch === needDomLTPre.patch) {\n needDomLTPre = false;\n }\n }\n if (c.operator === '<' || c.operator === '<=') {\n lower = lowerLT(lt, c, options);\n if (lower === c && lower !== lt) {\n return false\n }\n } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {\n return false\n }\n }\n if (!c.operator && (lt || gt) && gtltComp !== 0) {\n return false\n }\n }\n\n // if there was a < or >, and nothing in the dom, then must be false\n // UNLESS it was limited by another range in the other direction.\n // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0\n if (gt && hasDomLT && !lt && gtltComp !== 0) {\n return false\n }\n\n if (lt && hasDomGT && !gt && gtltComp !== 0) {\n return false\n }\n\n // we needed a prerelease range in a specific tuple, but didn't get one\n // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,\n // because it includes prereleases in the 1.2.3 tuple\n if (needDomGTPre || needDomLTPre) {\n return false\n }\n\n return true\n};\n\n// >=1.2.3 is lower than >1.2.3\nconst higherGT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options);\n return comp > 0 ? a\n : comp < 0 ? b\n : b.operator === '>' && a.operator === '>=' ? b\n : a\n};\n\n// <=1.2.3 is higher than <1.2.3\nconst lowerLT = (a, b, options) => {\n if (!a) {\n return b\n }\n const comp = compare(a.semver, b.semver, options);\n return comp < 0 ? a\n : comp > 0 ? b\n : b.operator === '<' && a.operator === '<=' ? b\n : a\n};\n\nvar subset_1 = subset;\n\n// just pre-load all the stuff that index.js lazily exports\nconst internalRe = re$3.exports;\nvar semver$1 = {\n re: internalRe.re,\n src: internalRe.src,\n tokens: internalRe.t,\n SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,\n SemVer: semver$2,\n compareIdentifiers: identifiers.compareIdentifiers,\n rcompareIdentifiers: identifiers.rcompareIdentifiers,\n parse: parse_1,\n valid: valid_1,\n clean: clean_1,\n inc: inc_1,\n diff: diff_1,\n major: major_1,\n minor: minor_1,\n patch: patch_1,\n prerelease: prerelease_1,\n compare: compare_1,\n rcompare: rcompare_1,\n compareLoose: compareLoose_1,\n compareBuild: compareBuild_1,\n sort: sort_1,\n rsort: rsort_1,\n gt: gt_1,\n lt: lt_1,\n eq: eq_1,\n neq: neq_1,\n gte: gte_1,\n lte: lte_1,\n cmp: cmp_1,\n coerce: coerce_1,\n Comparator: requireComparator(),\n Range: requireRange(),\n satisfies: satisfies_1,\n toComparators: toComparators_1,\n maxSatisfying: maxSatisfying_1,\n minSatisfying: minSatisfying_1,\n minVersion: minVersion_1,\n validRange: valid,\n outside: outside_1,\n gtr: gtr_1,\n ltr: ltr_1,\n intersects: intersects_1,\n simplifyRange: simplify,\n subset: subset_1,\n};\n\nvar semver = semver$1;\n\nvar builtins = function ({\n version = process.version,\n experimental = false\n} = {}) {\n var coreModules = [\n 'assert',\n 'buffer',\n 'child_process',\n 'cluster',\n 'console',\n 'constants',\n 'crypto',\n 'dgram',\n 'dns',\n 'domain',\n 'events',\n 'fs',\n 'http',\n 'https',\n 'module',\n 'net',\n 'os',\n 'path',\n 'punycode',\n 'querystring',\n 'readline',\n 'repl',\n 'stream',\n 'string_decoder',\n 'sys',\n 'timers',\n 'tls',\n 'tty',\n 'url',\n 'util',\n 'vm',\n 'zlib'\n ];\n\n if (semver.lt(version, '6.0.0')) coreModules.push('freelist');\n if (semver.gte(version, '1.0.0')) coreModules.push('v8');\n if (semver.gte(version, '1.1.0')) coreModules.push('process');\n if (semver.gte(version, '8.0.0')) coreModules.push('inspector');\n if (semver.gte(version, '8.1.0')) coreModules.push('async_hooks');\n if (semver.gte(version, '8.4.0')) coreModules.push('http2');\n if (semver.gte(version, '8.5.0')) coreModules.push('perf_hooks');\n if (semver.gte(version, '10.0.0')) coreModules.push('trace_events');\n\n if (\n semver.gte(version, '10.5.0') &&\n (experimental || semver.gte(version, '12.0.0'))\n ) {\n coreModules.push('worker_threads');\n }\n if (semver.gte(version, '12.16.0') && experimental) {\n coreModules.push('wasi');\n }\n \n return coreModules\n};\n\n// Manually “tree shaken” from:\n\nconst reader = {read};\n\n/**\n * @param {string} jsonPath\n * @returns {{string: string}}\n */\nfunction read(jsonPath) {\n return find(path.dirname(jsonPath))\n}\n\n/**\n * @param {string} dir\n * @returns {{string: string}}\n */\nfunction find(dir) {\n try {\n const string = fs.readFileSync(\n path.toNamespacedPath(path.join(dir, 'package.json')),\n 'utf8'\n );\n return {string}\n } catch (error) {\n if (error.code === 'ENOENT') {\n const parent = path.dirname(dir);\n if (dir !== parent) return find(parent)\n return {string: undefined}\n // Throw all other errors.\n /* c8 ignore next 4 */\n }\n\n throw error\n }\n}\n\n// Manually “tree shaken” from:\n\nconst isWindows = process.platform === 'win32';\n\nconst own$1 = {}.hasOwnProperty;\n\nconst codes = {};\n\n/**\n * @typedef {(...args: unknown[]) => string} MessageFunction\n */\n\n/** @type {Map} */\nconst messages = new Map();\nconst nodeInternalPrefix = '__node_internal_';\n/** @type {number} */\nlet userStackTraceLimit;\n\ncodes.ERR_INVALID_MODULE_SPECIFIER = createError(\n 'ERR_INVALID_MODULE_SPECIFIER',\n /**\n * @param {string} request\n * @param {string} reason\n * @param {string} [base]\n */\n (request, reason, base = undefined) => {\n return `Invalid module \"${request}\" ${reason}${\n base ? ` imported from ${base}` : ''\n }`\n },\n TypeError\n);\n\ncodes.ERR_INVALID_PACKAGE_CONFIG = createError(\n 'ERR_INVALID_PACKAGE_CONFIG',\n /**\n * @param {string} path\n * @param {string} [base]\n * @param {string} [message]\n */\n (path, base, message) => {\n return `Invalid package config ${path}${\n base ? ` while importing ${base}` : ''\n }${message ? `. ${message}` : ''}`\n },\n Error\n);\n\ncodes.ERR_INVALID_PACKAGE_TARGET = createError(\n 'ERR_INVALID_PACKAGE_TARGET',\n /**\n * @param {string} pkgPath\n * @param {string} key\n * @param {unknown} target\n * @param {boolean} [isImport=false]\n * @param {string} [base]\n */\n (pkgPath, key, target, isImport = false, base = undefined) => {\n const relError =\n typeof target === 'string' &&\n !isImport &&\n target.length > 0 &&\n !target.startsWith('./');\n if (key === '.') {\n assert(isImport === false);\n return (\n `Invalid \"exports\" main target ${JSON.stringify(target)} defined ` +\n `in the package config ${pkgPath}package.json${\n base ? ` imported from ${base}` : ''\n }${relError ? '; targets must start with \"./\"' : ''}`\n )\n }\n\n return `Invalid \"${\n isImport ? 'imports' : 'exports'\n }\" target ${JSON.stringify(\n target\n )} defined for '${key}' in the package config ${pkgPath}package.json${\n base ? ` imported from ${base}` : ''\n }${relError ? '; targets must start with \"./\"' : ''}`\n },\n Error\n);\n\ncodes.ERR_MODULE_NOT_FOUND = createError(\n 'ERR_MODULE_NOT_FOUND',\n /**\n * @param {string} path\n * @param {string} base\n * @param {string} [type]\n */\n (path, base, type = 'package') => {\n return `Cannot find ${type} '${path}' imported from ${base}`\n },\n Error\n);\n\ncodes.ERR_PACKAGE_IMPORT_NOT_DEFINED = createError(\n 'ERR_PACKAGE_IMPORT_NOT_DEFINED',\n /**\n * @param {string} specifier\n * @param {string} packagePath\n * @param {string} base\n */\n (specifier, packagePath, base) => {\n return `Package import specifier \"${specifier}\" is not defined${\n packagePath ? ` in package ${packagePath}package.json` : ''\n } imported from ${base}`\n },\n TypeError\n);\n\ncodes.ERR_PACKAGE_PATH_NOT_EXPORTED = createError(\n 'ERR_PACKAGE_PATH_NOT_EXPORTED',\n /**\n * @param {string} pkgPath\n * @param {string} subpath\n * @param {string} [base]\n */\n (pkgPath, subpath, base = undefined) => {\n if (subpath === '.')\n return `No \"exports\" main defined in ${pkgPath}package.json${\n base ? ` imported from ${base}` : ''\n }`\n return `Package subpath '${subpath}' is not defined by \"exports\" in ${pkgPath}package.json${\n base ? ` imported from ${base}` : ''\n }`\n },\n Error\n);\n\ncodes.ERR_UNSUPPORTED_DIR_IMPORT = createError(\n 'ERR_UNSUPPORTED_DIR_IMPORT',\n \"Directory import '%s' is not supported \" +\n 'resolving ES modules imported from %s',\n Error\n);\n\ncodes.ERR_UNKNOWN_FILE_EXTENSION = createError(\n 'ERR_UNKNOWN_FILE_EXTENSION',\n 'Unknown file extension \"%s\" for %s',\n TypeError\n);\n\ncodes.ERR_INVALID_ARG_VALUE = createError(\n 'ERR_INVALID_ARG_VALUE',\n /**\n * @param {string} name\n * @param {unknown} value\n * @param {string} [reason='is invalid']\n */\n (name, value, reason = 'is invalid') => {\n let inspected = inspect(value);\n\n if (inspected.length > 128) {\n inspected = `${inspected.slice(0, 128)}...`;\n }\n\n const type = name.includes('.') ? 'property' : 'argument';\n\n return `The ${type} '${name}' ${reason}. Received ${inspected}`\n },\n TypeError\n // Note: extra classes have been shaken out.\n // , RangeError\n);\n\ncodes.ERR_UNSUPPORTED_ESM_URL_SCHEME = createError(\n 'ERR_UNSUPPORTED_ESM_URL_SCHEME',\n /**\n * @param {URL} url\n */\n (url) => {\n let message =\n 'Only file and data URLs are supported by the default ESM loader';\n\n if (isWindows && url.protocol.length === 2) {\n message += '. On Windows, absolute paths must be valid file:// URLs';\n }\n\n message += `. Received protocol '${url.protocol}'`;\n return message\n },\n Error\n);\n\n/**\n * Utility function for registering the error codes. Only used here. Exported\n * *only* to allow for testing.\n * @param {string} sym\n * @param {MessageFunction|string} value\n * @param {ErrorConstructor} def\n * @returns {new (...args: unknown[]) => Error}\n */\nfunction createError(sym, value, def) {\n // Special case for SystemError that formats the error message differently\n // The SystemErrors only have SystemError as their base classes.\n messages.set(sym, value);\n\n return makeNodeErrorWithCode(def, sym)\n}\n\n/**\n * @param {ErrorConstructor} Base\n * @param {string} key\n * @returns {ErrorConstructor}\n */\nfunction makeNodeErrorWithCode(Base, key) {\n // @ts-expect-error It’s a Node error.\n return NodeError\n /**\n * @param {unknown[]} args\n */\n function NodeError(...args) {\n const limit = Error.stackTraceLimit;\n if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = 0;\n const error = new Base();\n // Reset the limit and setting the name property.\n if (isErrorStackTraceLimitWritable()) Error.stackTraceLimit = limit;\n const message = getMessage(key, args, error);\n Object.defineProperty(error, 'message', {\n value: message,\n enumerable: false,\n writable: true,\n configurable: true\n });\n Object.defineProperty(error, 'toString', {\n /** @this {Error} */\n value() {\n return `${this.name} [${key}]: ${this.message}`\n },\n enumerable: false,\n writable: true,\n configurable: true\n });\n addCodeToName(error, Base.name, key);\n // @ts-expect-error It’s a Node error.\n error.code = key;\n return error\n }\n}\n\nconst addCodeToName = hideStackFrames(\n /**\n * @param {Error} error\n * @param {string} name\n * @param {string} code\n * @returns {void}\n */\n function (error, name, code) {\n // Set the stack\n error = captureLargerStackTrace(error);\n // Add the error code to the name to include it in the stack trace.\n error.name = `${name} [${code}]`;\n // Access the stack to generate the error message including the error code\n // from the name.\n error.stack; // eslint-disable-line no-unused-expressions\n // Reset the name to the actual name.\n if (name === 'SystemError') {\n Object.defineProperty(error, 'name', {\n value: name,\n enumerable: false,\n writable: true,\n configurable: true\n });\n } else {\n delete error.name;\n }\n }\n);\n\n/**\n * @returns {boolean}\n */\nfunction isErrorStackTraceLimitWritable() {\n const desc = Object.getOwnPropertyDescriptor(Error, 'stackTraceLimit');\n if (desc === undefined) {\n return Object.isExtensible(Error)\n }\n\n return own$1.call(desc, 'writable') ? desc.writable : desc.set !== undefined\n}\n\n/**\n * This function removes unnecessary frames from Node.js core errors.\n * @template {(...args: unknown[]) => unknown} T\n * @type {(fn: T) => T}\n */\nfunction hideStackFrames(fn) {\n // We rename the functions that will be hidden to cut off the stacktrace\n // at the outermost one\n const hidden = nodeInternalPrefix + fn.name;\n Object.defineProperty(fn, 'name', {value: hidden});\n return fn\n}\n\nconst captureLargerStackTrace = hideStackFrames(\n /**\n * @param {Error} error\n * @returns {Error}\n */\n function (error) {\n const stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();\n if (stackTraceLimitIsWritable) {\n userStackTraceLimit = Error.stackTraceLimit;\n Error.stackTraceLimit = Number.POSITIVE_INFINITY;\n }\n\n Error.captureStackTrace(error);\n\n // Reset the limit\n if (stackTraceLimitIsWritable) Error.stackTraceLimit = userStackTraceLimit;\n\n return error\n }\n);\n\n/**\n * @param {string} key\n * @param {unknown[]} args\n * @param {Error} self\n * @returns {string}\n */\nfunction getMessage(key, args, self) {\n const message = messages.get(key);\n\n if (typeof message === 'function') {\n assert(\n message.length <= args.length, // Default options do not count.\n `Code: ${key}; The provided arguments length (${args.length}) does not ` +\n `match the required ones (${message.length}).`\n );\n return Reflect.apply(message, self, args)\n }\n\n const expectedLength = (message.match(/%[dfijoOs]/g) || []).length;\n assert(\n expectedLength === args.length,\n `Code: ${key}; The provided arguments length (${args.length}) does not ` +\n `match the required ones (${expectedLength}).`\n );\n if (args.length === 0) return message\n\n args.unshift(message);\n return Reflect.apply(format, null, args)\n}\n\n// Manually “tree shaken” from:\n\nconst {ERR_UNKNOWN_FILE_EXTENSION} = codes;\n\nconst extensionFormatMap = {\n __proto__: null,\n '.cjs': 'commonjs',\n '.js': 'module',\n '.mjs': 'module'\n};\n\n/**\n * @param {string} url\n * @returns {{format: string|null}}\n */\nfunction defaultGetFormat(url) {\n if (url.startsWith('node:')) {\n return {format: 'builtin'}\n }\n\n const parsed = new URL(url);\n\n if (parsed.protocol === 'data:') {\n const {1: mime} = /^([^/]+\\/[^;,]+)[^,]*?(;base64)?,/.exec(\n parsed.pathname\n ) || [null, null];\n const format = mime === 'text/javascript' ? 'module' : null;\n return {format}\n }\n\n if (parsed.protocol === 'file:') {\n const ext = path.extname(parsed.pathname);\n /** @type {string} */\n let format;\n if (ext === '.js') {\n format = getPackageType(parsed.href) === 'module' ? 'module' : 'commonjs';\n } else {\n format = extensionFormatMap[ext];\n }\n\n if (!format) {\n throw new ERR_UNKNOWN_FILE_EXTENSION(ext, fileURLToPath(url))\n }\n\n return {format: format || null}\n }\n\n return {format: null}\n}\n\n// Manually “tree shaken” from:\n\nconst listOfBuiltins = builtins();\n\nconst {\n ERR_INVALID_MODULE_SPECIFIER,\n ERR_INVALID_PACKAGE_CONFIG,\n ERR_INVALID_PACKAGE_TARGET,\n ERR_MODULE_NOT_FOUND,\n ERR_PACKAGE_IMPORT_NOT_DEFINED,\n ERR_PACKAGE_PATH_NOT_EXPORTED,\n ERR_UNSUPPORTED_DIR_IMPORT,\n ERR_UNSUPPORTED_ESM_URL_SCHEME,\n ERR_INVALID_ARG_VALUE\n} = codes;\n\nconst own = {}.hasOwnProperty;\n\nconst DEFAULT_CONDITIONS = Object.freeze(['node', 'import']);\nconst DEFAULT_CONDITIONS_SET = new Set(DEFAULT_CONDITIONS);\n\nconst invalidSegmentRegEx = /(^|\\\\|\\/)(\\.\\.?|node_modules)(\\\\|\\/|$)/;\nconst patternRegEx = /\\*/g;\nconst encodedSepRegEx = /%2f|%2c/i;\n/** @type {Set} */\nconst emittedPackageWarnings = new Set();\n/** @type {Map} */\nconst packageJsonCache = new Map();\n\n/**\n * @param {string} match\n * @param {URL} pjsonUrl\n * @param {boolean} isExports\n * @param {URL} base\n * @returns {void}\n */\nfunction emitFolderMapDeprecation(match, pjsonUrl, isExports, base) {\n const pjsonPath = fileURLToPath(pjsonUrl);\n\n if (emittedPackageWarnings.has(pjsonPath + '|' + match)) return\n emittedPackageWarnings.add(pjsonPath + '|' + match);\n process.emitWarning(\n `Use of deprecated folder mapping \"${match}\" in the ${\n isExports ? '\"exports\"' : '\"imports\"'\n } field module resolution of the package at ${pjsonPath}${\n base ? ` imported from ${fileURLToPath(base)}` : ''\n }.\\n` +\n `Update this package.json to use a subpath pattern like \"${match}*\".`,\n 'DeprecationWarning',\n 'DEP0148'\n );\n}\n\n/**\n * @param {URL} url\n * @param {URL} packageJsonUrl\n * @param {URL} base\n * @param {unknown} [main]\n * @returns {void}\n */\nfunction emitLegacyIndexDeprecation(url, packageJsonUrl, base, main) {\n const {format} = defaultGetFormat(url.href);\n if (format !== 'module') return\n const path = fileURLToPath(url.href);\n const pkgPath = fileURLToPath(new URL('.', packageJsonUrl));\n const basePath = fileURLToPath(base);\n if (main)\n process.emitWarning(\n `Package ${pkgPath} has a \"main\" field set to ${JSON.stringify(main)}, ` +\n `excluding the full filename and extension to the resolved file at \"${path.slice(\n pkgPath.length\n )}\", imported from ${basePath}.\\n Automatic extension resolution of the \"main\" field is` +\n 'deprecated for ES modules.',\n 'DeprecationWarning',\n 'DEP0151'\n );\n else\n process.emitWarning(\n `No \"main\" or \"exports\" field defined in the package.json for ${pkgPath} resolving the main entry point \"${path.slice(\n pkgPath.length\n )}\", imported from ${basePath}.\\nDefault \"index\" lookups for the main are deprecated for ES modules.`,\n 'DeprecationWarning',\n 'DEP0151'\n );\n}\n\n/**\n * @param {string[]} [conditions]\n * @returns {Set}\n */\nfunction getConditionsSet(conditions) {\n if (conditions !== undefined && conditions !== DEFAULT_CONDITIONS) {\n if (!Array.isArray(conditions)) {\n throw new ERR_INVALID_ARG_VALUE(\n 'conditions',\n conditions,\n 'expected an array'\n )\n }\n\n return new Set(conditions)\n }\n\n return DEFAULT_CONDITIONS_SET\n}\n\n/**\n * @param {string} path\n * @returns {Stats}\n */\nfunction tryStatSync(path) {\n // Note: from Node 15 onwards we can use `throwIfNoEntry: false` instead.\n try {\n return statSync(path)\n } catch {\n return new Stats()\n }\n}\n\n/**\n * @param {string} path\n * @param {string|URL} specifier Note: `specifier` is actually optional, not base.\n * @param {URL} [base]\n * @returns {PackageConfig}\n */\nfunction getPackageConfig(path, specifier, base) {\n const existing = packageJsonCache.get(path);\n if (existing !== undefined) {\n return existing\n }\n\n const source = reader.read(path).string;\n\n if (source === undefined) {\n /** @type {PackageConfig} */\n const packageConfig = {\n pjsonPath: path,\n exists: false,\n main: undefined,\n name: undefined,\n type: 'none',\n exports: undefined,\n imports: undefined\n };\n packageJsonCache.set(path, packageConfig);\n return packageConfig\n }\n\n /** @type {Object.} */\n let packageJson;\n try {\n packageJson = JSON.parse(source);\n } catch (error) {\n throw new ERR_INVALID_PACKAGE_CONFIG(\n path,\n (base ? `\"${specifier}\" from ` : '') + fileURLToPath(base || specifier),\n error.message\n )\n }\n\n const {exports, imports, main, name, type} = packageJson;\n\n /** @type {PackageConfig} */\n const packageConfig = {\n pjsonPath: path,\n exists: true,\n main: typeof main === 'string' ? main : undefined,\n name: typeof name === 'string' ? name : undefined,\n type: type === 'module' || type === 'commonjs' ? type : 'none',\n // @ts-expect-error Assume `Object.`.\n exports,\n // @ts-expect-error Assume `Object.`.\n imports: imports && typeof imports === 'object' ? imports : undefined\n };\n packageJsonCache.set(path, packageConfig);\n return packageConfig\n}\n\n/**\n * @param {URL|string} resolved\n * @returns {PackageConfig}\n */\nfunction getPackageScopeConfig(resolved) {\n let packageJsonUrl = new URL('./package.json', resolved);\n\n while (true) {\n const packageJsonPath = packageJsonUrl.pathname;\n\n if (packageJsonPath.endsWith('node_modules/package.json')) break\n\n const packageConfig = getPackageConfig(\n fileURLToPath(packageJsonUrl),\n resolved\n );\n if (packageConfig.exists) return packageConfig\n\n const lastPackageJsonUrl = packageJsonUrl;\n packageJsonUrl = new URL('../package.json', packageJsonUrl);\n\n // Terminates at root where ../package.json equals ../../package.json\n // (can't just check \"/package.json\" for Windows support).\n if (packageJsonUrl.pathname === lastPackageJsonUrl.pathname) break\n }\n\n const packageJsonPath = fileURLToPath(packageJsonUrl);\n /** @type {PackageConfig} */\n const packageConfig = {\n pjsonPath: packageJsonPath,\n exists: false,\n main: undefined,\n name: undefined,\n type: 'none',\n exports: undefined,\n imports: undefined\n };\n packageJsonCache.set(packageJsonPath, packageConfig);\n return packageConfig\n}\n\n/**\n * Legacy CommonJS main resolution:\n * 1. let M = pkg_url + (json main field)\n * 2. TRY(M, M.js, M.json, M.node)\n * 3. TRY(M/index.js, M/index.json, M/index.node)\n * 4. TRY(pkg_url/index.js, pkg_url/index.json, pkg_url/index.node)\n * 5. NOT_FOUND\n *\n * @param {URL} url\n * @returns {boolean}\n */\nfunction fileExists(url) {\n return tryStatSync(fileURLToPath(url)).isFile()\n}\n\n/**\n * @param {URL} packageJsonUrl\n * @param {PackageConfig} packageConfig\n * @param {URL} base\n * @returns {URL}\n */\nfunction legacyMainResolve(packageJsonUrl, packageConfig, base) {\n /** @type {URL} */\n let guess;\n if (packageConfig.main !== undefined) {\n guess = new URL(`./${packageConfig.main}`, packageJsonUrl);\n // Note: fs check redundances will be handled by Descriptor cache here.\n if (fileExists(guess)) return guess\n\n const tries = [\n `./${packageConfig.main}.js`,\n `./${packageConfig.main}.json`,\n `./${packageConfig.main}.node`,\n `./${packageConfig.main}/index.js`,\n `./${packageConfig.main}/index.json`,\n `./${packageConfig.main}/index.node`\n ];\n let i = -1;\n\n while (++i < tries.length) {\n guess = new URL(tries[i], packageJsonUrl);\n if (fileExists(guess)) break\n guess = undefined;\n }\n\n if (guess) {\n emitLegacyIndexDeprecation(\n guess,\n packageJsonUrl,\n base,\n packageConfig.main\n );\n return guess\n }\n // Fallthrough.\n }\n\n const tries = ['./index.js', './index.json', './index.node'];\n let i = -1;\n\n while (++i < tries.length) {\n guess = new URL(tries[i], packageJsonUrl);\n if (fileExists(guess)) break\n guess = undefined;\n }\n\n if (guess) {\n emitLegacyIndexDeprecation(guess, packageJsonUrl, base, packageConfig.main);\n return guess\n }\n\n // Not found.\n throw new ERR_MODULE_NOT_FOUND(\n fileURLToPath(new URL('.', packageJsonUrl)),\n fileURLToPath(base)\n )\n}\n\n/**\n * @param {URL} resolved\n * @param {URL} base\n * @returns {URL}\n */\nfunction finalizeResolution(resolved, base) {\n if (encodedSepRegEx.test(resolved.pathname))\n throw new ERR_INVALID_MODULE_SPECIFIER(\n resolved.pathname,\n 'must not include encoded \"/\" or \"\\\\\" characters',\n fileURLToPath(base)\n )\n\n const path = fileURLToPath(resolved);\n\n const stats = tryStatSync(path.endsWith('/') ? path.slice(-1) : path);\n\n if (stats.isDirectory()) {\n const error = new ERR_UNSUPPORTED_DIR_IMPORT(path, fileURLToPath(base));\n // @ts-expect-error Add this for `import.meta.resolve`.\n error.url = String(resolved);\n throw error\n }\n\n if (!stats.isFile()) {\n throw new ERR_MODULE_NOT_FOUND(\n path || resolved.pathname,\n base && fileURLToPath(base),\n 'module'\n )\n }\n\n return resolved\n}\n\n/**\n * @param {string} specifier\n * @param {URL?} packageJsonUrl\n * @param {URL} base\n * @returns {never}\n */\nfunction throwImportNotDefined(specifier, packageJsonUrl, base) {\n throw new ERR_PACKAGE_IMPORT_NOT_DEFINED(\n specifier,\n packageJsonUrl && fileURLToPath(new URL('.', packageJsonUrl)),\n fileURLToPath(base)\n )\n}\n\n/**\n * @param {string} subpath\n * @param {URL} packageJsonUrl\n * @param {URL} base\n * @returns {never}\n */\nfunction throwExportsNotFound(subpath, packageJsonUrl, base) {\n throw new ERR_PACKAGE_PATH_NOT_EXPORTED(\n fileURLToPath(new URL('.', packageJsonUrl)),\n subpath,\n base && fileURLToPath(base)\n )\n}\n\n/**\n * @param {string} subpath\n * @param {URL} packageJsonUrl\n * @param {boolean} internal\n * @param {URL} [base]\n * @returns {never}\n */\nfunction throwInvalidSubpath(subpath, packageJsonUrl, internal, base) {\n const reason = `request is not a valid subpath for the \"${\n internal ? 'imports' : 'exports'\n }\" resolution of ${fileURLToPath(packageJsonUrl)}`;\n\n throw new ERR_INVALID_MODULE_SPECIFIER(\n subpath,\n reason,\n base && fileURLToPath(base)\n )\n}\n\n/**\n * @param {string} subpath\n * @param {unknown} target\n * @param {URL} packageJsonUrl\n * @param {boolean} internal\n * @param {URL} [base]\n * @returns {never}\n */\nfunction throwInvalidPackageTarget(\n subpath,\n target,\n packageJsonUrl,\n internal,\n base\n) {\n target =\n typeof target === 'object' && target !== null\n ? JSON.stringify(target, null, '')\n : `${target}`;\n\n throw new ERR_INVALID_PACKAGE_TARGET(\n fileURLToPath(new URL('.', packageJsonUrl)),\n subpath,\n target,\n internal,\n base && fileURLToPath(base)\n )\n}\n\n/**\n * @param {string} target\n * @param {string} subpath\n * @param {string} match\n * @param {URL} packageJsonUrl\n * @param {URL} base\n * @param {boolean} pattern\n * @param {boolean} internal\n * @param {Set} conditions\n * @returns {URL}\n */\nfunction resolvePackageTargetString(\n target,\n subpath,\n match,\n packageJsonUrl,\n base,\n pattern,\n internal,\n conditions\n) {\n if (subpath !== '' && !pattern && target[target.length - 1] !== '/')\n throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base);\n\n if (!target.startsWith('./')) {\n if (internal && !target.startsWith('../') && !target.startsWith('/')) {\n let isURL = false;\n\n try {\n new URL(target);\n isURL = true;\n } catch {}\n\n if (!isURL) {\n const exportTarget = pattern\n ? target.replace(patternRegEx, subpath)\n : target + subpath;\n\n return packageResolve(exportTarget, packageJsonUrl, conditions)\n }\n }\n\n throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base);\n }\n\n if (invalidSegmentRegEx.test(target.slice(2)))\n throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base);\n\n const resolved = new URL(target, packageJsonUrl);\n const resolvedPath = resolved.pathname;\n const packagePath = new URL('.', packageJsonUrl).pathname;\n\n if (!resolvedPath.startsWith(packagePath))\n throwInvalidPackageTarget(match, target, packageJsonUrl, internal, base);\n\n if (subpath === '') return resolved\n\n if (invalidSegmentRegEx.test(subpath))\n throwInvalidSubpath(match + subpath, packageJsonUrl, internal, base);\n\n if (pattern) return new URL(resolved.href.replace(patternRegEx, subpath))\n return new URL(subpath, resolved)\n}\n\n/**\n * @param {string} key\n * @returns {boolean}\n */\nfunction isArrayIndex(key) {\n const keyNumber = Number(key);\n if (`${keyNumber}` !== key) return false\n return keyNumber >= 0 && keyNumber < 0xffff_ffff\n}\n\n/**\n * @param {URL} packageJsonUrl\n * @param {unknown} target\n * @param {string} subpath\n * @param {string} packageSubpath\n * @param {URL} base\n * @param {boolean} pattern\n * @param {boolean} internal\n * @param {Set} conditions\n * @returns {URL}\n */\nfunction resolvePackageTarget(\n packageJsonUrl,\n target,\n subpath,\n packageSubpath,\n base,\n pattern,\n internal,\n conditions\n) {\n if (typeof target === 'string') {\n return resolvePackageTargetString(\n target,\n subpath,\n packageSubpath,\n packageJsonUrl,\n base,\n pattern,\n internal,\n conditions\n )\n }\n\n if (Array.isArray(target)) {\n /** @type {unknown[]} */\n const targetList = target;\n if (targetList.length === 0) return null\n\n /** @type {Error} */\n let lastException;\n let i = -1;\n\n while (++i < targetList.length) {\n const targetItem = targetList[i];\n /** @type {URL} */\n let resolved;\n try {\n resolved = resolvePackageTarget(\n packageJsonUrl,\n targetItem,\n subpath,\n packageSubpath,\n base,\n pattern,\n internal,\n conditions\n );\n } catch (error) {\n lastException = error;\n if (error.code === 'ERR_INVALID_PACKAGE_TARGET') continue\n throw error\n }\n\n if (resolved === undefined) continue\n\n if (resolved === null) {\n lastException = null;\n continue\n }\n\n return resolved\n }\n\n if (lastException === undefined || lastException === null) {\n // @ts-expect-error The diff between `undefined` and `null` seems to be\n // intentional\n return lastException\n }\n\n throw lastException\n }\n\n if (typeof target === 'object' && target !== null) {\n const keys = Object.getOwnPropertyNames(target);\n let i = -1;\n\n while (++i < keys.length) {\n const key = keys[i];\n if (isArrayIndex(key)) {\n throw new ERR_INVALID_PACKAGE_CONFIG(\n fileURLToPath(packageJsonUrl),\n base,\n '\"exports\" cannot contain numeric property keys.'\n )\n }\n }\n\n i = -1;\n\n while (++i < keys.length) {\n const key = keys[i];\n if (key === 'default' || (conditions && conditions.has(key))) {\n /** @type {unknown} */\n const conditionalTarget = target[key];\n const resolved = resolvePackageTarget(\n packageJsonUrl,\n conditionalTarget,\n subpath,\n packageSubpath,\n base,\n pattern,\n internal,\n conditions\n );\n if (resolved === undefined) continue\n return resolved\n }\n }\n\n return undefined\n }\n\n if (target === null) {\n return null\n }\n\n throwInvalidPackageTarget(\n packageSubpath,\n target,\n packageJsonUrl,\n internal,\n base\n );\n}\n\n/**\n * @param {unknown} exports\n * @param {URL} packageJsonUrl\n * @param {URL} base\n * @returns {boolean}\n */\nfunction isConditionalExportsMainSugar(exports, packageJsonUrl, base) {\n if (typeof exports === 'string' || Array.isArray(exports)) return true\n if (typeof exports !== 'object' || exports === null) return false\n\n const keys = Object.getOwnPropertyNames(exports);\n let isConditionalSugar = false;\n let i = 0;\n let j = -1;\n while (++j < keys.length) {\n const key = keys[j];\n const curIsConditionalSugar = key === '' || key[0] !== '.';\n if (i++ === 0) {\n isConditionalSugar = curIsConditionalSugar;\n } else if (isConditionalSugar !== curIsConditionalSugar) {\n throw new ERR_INVALID_PACKAGE_CONFIG(\n fileURLToPath(packageJsonUrl),\n base,\n '\"exports\" cannot contain some keys starting with \\'.\\' and some not.' +\n ' The exports object must either be an object of package subpath keys' +\n ' or an object of main entry condition name keys only.'\n )\n }\n }\n\n return isConditionalSugar\n}\n\n/**\n * @param {URL} packageJsonUrl\n * @param {string} packageSubpath\n * @param {Object.} packageConfig\n * @param {URL} base\n * @param {Set} conditions\n * @returns {ResolveObject}\n */\nfunction packageExportsResolve(\n packageJsonUrl,\n packageSubpath,\n packageConfig,\n base,\n conditions\n) {\n let exports = packageConfig.exports;\n if (isConditionalExportsMainSugar(exports, packageJsonUrl, base))\n exports = {'.': exports};\n\n if (own.call(exports, packageSubpath)) {\n const target = exports[packageSubpath];\n const resolved = resolvePackageTarget(\n packageJsonUrl,\n target,\n '',\n packageSubpath,\n base,\n false,\n false,\n conditions\n );\n if (resolved === null || resolved === undefined)\n throwExportsNotFound(packageSubpath, packageJsonUrl, base);\n return {resolved, exact: true}\n }\n\n let bestMatch = '';\n const keys = Object.getOwnPropertyNames(exports);\n let i = -1;\n\n while (++i < keys.length) {\n const key = keys[i];\n if (\n key[key.length - 1] === '*' &&\n packageSubpath.startsWith(key.slice(0, -1)) &&\n packageSubpath.length >= key.length &&\n key.length > bestMatch.length\n ) {\n bestMatch = key;\n } else if (\n key[key.length - 1] === '/' &&\n packageSubpath.startsWith(key) &&\n key.length > bestMatch.length\n ) {\n bestMatch = key;\n }\n }\n\n if (bestMatch) {\n const target = exports[bestMatch];\n const pattern = bestMatch[bestMatch.length - 1] === '*';\n const subpath = packageSubpath.slice(bestMatch.length - (pattern ? 1 : 0));\n const resolved = resolvePackageTarget(\n packageJsonUrl,\n target,\n subpath,\n bestMatch,\n base,\n pattern,\n false,\n conditions\n );\n if (resolved === null || resolved === undefined)\n throwExportsNotFound(packageSubpath, packageJsonUrl, base);\n if (!pattern)\n emitFolderMapDeprecation(bestMatch, packageJsonUrl, true, base);\n return {resolved, exact: pattern}\n }\n\n throwExportsNotFound(packageSubpath, packageJsonUrl, base);\n}\n\n/**\n * @param {string} name\n * @param {URL} base\n * @param {Set} [conditions]\n * @returns {ResolveObject}\n */\nfunction packageImportsResolve(name, base, conditions) {\n if (name === '#' || name.startsWith('#/')) {\n const reason = 'is not a valid internal imports specifier name';\n throw new ERR_INVALID_MODULE_SPECIFIER(name, reason, fileURLToPath(base))\n }\n\n /** @type {URL} */\n let packageJsonUrl;\n\n const packageConfig = getPackageScopeConfig(base);\n\n if (packageConfig.exists) {\n packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);\n const imports = packageConfig.imports;\n if (imports) {\n if (own.call(imports, name)) {\n const resolved = resolvePackageTarget(\n packageJsonUrl,\n imports[name],\n '',\n name,\n base,\n false,\n true,\n conditions\n );\n if (resolved !== null) return {resolved, exact: true}\n } else {\n let bestMatch = '';\n const keys = Object.getOwnPropertyNames(imports);\n let i = -1;\n\n while (++i < keys.length) {\n const key = keys[i];\n\n if (\n key[key.length - 1] === '*' &&\n name.startsWith(key.slice(0, -1)) &&\n name.length >= key.length &&\n key.length > bestMatch.length\n ) {\n bestMatch = key;\n } else if (\n key[key.length - 1] === '/' &&\n name.startsWith(key) &&\n key.length > bestMatch.length\n ) {\n bestMatch = key;\n }\n }\n\n if (bestMatch) {\n const target = imports[bestMatch];\n const pattern = bestMatch[bestMatch.length - 1] === '*';\n const subpath = name.slice(bestMatch.length - (pattern ? 1 : 0));\n const resolved = resolvePackageTarget(\n packageJsonUrl,\n target,\n subpath,\n bestMatch,\n base,\n pattern,\n true,\n conditions\n );\n if (resolved !== null) {\n if (!pattern)\n emitFolderMapDeprecation(bestMatch, packageJsonUrl, false, base);\n return {resolved, exact: pattern}\n }\n }\n }\n }\n }\n\n throwImportNotDefined(name, packageJsonUrl, base);\n}\n\n/**\n * @param {string} url\n * @returns {PackageType}\n */\nfunction getPackageType(url) {\n const packageConfig = getPackageScopeConfig(url);\n return packageConfig.type\n}\n\n/**\n * @param {string} specifier\n * @param {URL} base\n */\nfunction parsePackageName(specifier, base) {\n let separatorIndex = specifier.indexOf('/');\n let validPackageName = true;\n let isScoped = false;\n if (specifier[0] === '@') {\n isScoped = true;\n if (separatorIndex === -1 || specifier.length === 0) {\n validPackageName = false;\n } else {\n separatorIndex = specifier.indexOf('/', separatorIndex + 1);\n }\n }\n\n const packageName =\n separatorIndex === -1 ? specifier : specifier.slice(0, separatorIndex);\n\n // Package name cannot have leading . and cannot have percent-encoding or\n // separators.\n let i = -1;\n while (++i < packageName.length) {\n if (packageName[i] === '%' || packageName[i] === '\\\\') {\n validPackageName = false;\n break\n }\n }\n\n if (!validPackageName) {\n throw new ERR_INVALID_MODULE_SPECIFIER(\n specifier,\n 'is not a valid package name',\n fileURLToPath(base)\n )\n }\n\n const packageSubpath =\n '.' + (separatorIndex === -1 ? '' : specifier.slice(separatorIndex));\n\n return {packageName, packageSubpath, isScoped}\n}\n\n/**\n * @param {string} specifier\n * @param {URL} base\n * @param {Set} conditions\n * @returns {URL}\n */\nfunction packageResolve(specifier, base, conditions) {\n const {packageName, packageSubpath, isScoped} = parsePackageName(\n specifier,\n base\n );\n\n // ResolveSelf\n const packageConfig = getPackageScopeConfig(base);\n\n // Can’t test.\n /* c8 ignore next 16 */\n if (packageConfig.exists) {\n const packageJsonUrl = pathToFileURL(packageConfig.pjsonPath);\n if (\n packageConfig.name === packageName &&\n packageConfig.exports !== undefined &&\n packageConfig.exports !== null\n ) {\n return packageExportsResolve(\n packageJsonUrl,\n packageSubpath,\n packageConfig,\n base,\n conditions\n ).resolved\n }\n }\n\n let packageJsonUrl = new URL(\n './node_modules/' + packageName + '/package.json',\n base\n );\n let packageJsonPath = fileURLToPath(packageJsonUrl);\n /** @type {string} */\n let lastPath;\n do {\n const stat = tryStatSync(packageJsonPath.slice(0, -13));\n if (!stat.isDirectory()) {\n lastPath = packageJsonPath;\n packageJsonUrl = new URL(\n (isScoped ? '../../../../node_modules/' : '../../../node_modules/') +\n packageName +\n '/package.json',\n packageJsonUrl\n );\n packageJsonPath = fileURLToPath(packageJsonUrl);\n continue\n }\n\n // Package match.\n const packageConfig = getPackageConfig(packageJsonPath, specifier, base);\n if (packageConfig.exports !== undefined && packageConfig.exports !== null)\n return packageExportsResolve(\n packageJsonUrl,\n packageSubpath,\n packageConfig,\n base,\n conditions\n ).resolved\n if (packageSubpath === '.')\n return legacyMainResolve(packageJsonUrl, packageConfig, base)\n return new URL(packageSubpath, packageJsonUrl)\n // Cross-platform root check.\n } while (packageJsonPath.length !== lastPath.length)\n\n throw new ERR_MODULE_NOT_FOUND(packageName, fileURLToPath(base))\n}\n\n/**\n * @param {string} specifier\n * @returns {boolean}\n */\nfunction isRelativeSpecifier(specifier) {\n if (specifier[0] === '.') {\n if (specifier.length === 1 || specifier[1] === '/') return true\n if (\n specifier[1] === '.' &&\n (specifier.length === 2 || specifier[2] === '/')\n ) {\n return true\n }\n }\n\n return false\n}\n\n/**\n * @param {string} specifier\n * @returns {boolean}\n */\nfunction shouldBeTreatedAsRelativeOrAbsolutePath(specifier) {\n if (specifier === '') return false\n if (specifier[0] === '/') return true\n return isRelativeSpecifier(specifier)\n}\n\n/**\n * The “Resolver Algorithm Specification” as detailed in the Node docs (which is\n * sync and slightly lower-level than `resolve`).\n *\n *\n *\n * @param {string} specifier\n * @param {URL} base\n * @param {Set} [conditions]\n * @returns {URL}\n */\nfunction moduleResolve(specifier, base, conditions) {\n // Order swapped from spec for minor perf gain.\n // Ok since relative URLs cannot parse as URLs.\n /** @type {URL} */\n let resolved;\n\n if (shouldBeTreatedAsRelativeOrAbsolutePath(specifier)) {\n resolved = new URL(specifier, base);\n } else if (specifier[0] === '#') {\n({resolved} = packageImportsResolve(specifier, base, conditions));\n } else {\n try {\n resolved = new URL(specifier);\n } catch {\n resolved = packageResolve(specifier, base, conditions);\n }\n }\n\n return finalizeResolution(resolved, base)\n}\n\n/**\n * @param {string} specifier\n * @param {{parentURL?: string, conditions?: string[]}} context\n * @returns {{url: string}}\n */\nfunction defaultResolve(specifier, context = {}) {\n const {parentURL} = context;\n /** @type {URL} */\n let parsed;\n\n try {\n parsed = new URL(specifier);\n if (parsed.protocol === 'data:') {\n return {url: specifier}\n }\n } catch {}\n\n if (parsed && parsed.protocol === 'node:') return {url: specifier}\n if (parsed && parsed.protocol !== 'file:' && parsed.protocol !== 'data:')\n throw new ERR_UNSUPPORTED_ESM_URL_SCHEME(parsed)\n\n if (listOfBuiltins.includes(specifier)) {\n return {url: 'node:' + specifier}\n }\n\n if (parentURL.startsWith('data:')) {\n // This is gonna blow up, we want the error\n new URL(specifier, parentURL);\n }\n\n const conditions = getConditionsSet(context.conditions);\n let url = moduleResolve(specifier, new URL(parentURL), conditions);\n\n const urlPath = fileURLToPath(url);\n const real = realpathSync(urlPath);\n const old = url;\n url = pathToFileURL(real + (urlPath.endsWith(path.sep) ? '/' : ''));\n url.search = old.search;\n url.hash = old.hash;\n\n return {url: `${url}`}\n}\n\n/**\n * Provides a module-relative resolution function scoped to each module,\n * returning the URL string.\n * `import.meta.resolve` also accepts a second argument which is the parent\n * module from which to resolve from.\n *\n * This function is asynchronous because the ES module resolver in Node.js is\n * allowed to be asynchronous.\n *\n * @param {string} specifier The module specifier to resolve relative to parent.\n * @param {string} parent The absolute parent module URL to resolve from.\n * You should pass `import.meta.url` or something else\n * @returns {Promise}\n */\nasync function resolve(specifier, parent) {\n if (!parent) {\n throw new Error(\n 'Please pass `parent`: `import-meta-resolve` cannot ponyfill that'\n )\n }\n\n try {\n return defaultResolve(specifier, {parentURL: parent}).url\n } catch (error) {\n return error.code === 'ERR_UNSUPPORTED_DIR_IMPORT'\n ? error.url\n :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Ac,CAACxI,SAAS,EAAE;QAAC0I,SAAS,EAAEtK;MAAM,CAAC,CAAC,CAACuC,GAAG;IAC3D,CAAC,CAAC,OAAOriB,KAAK,EAAE;MACd,OAAOA,KAAK,CAAC6f,IAAI,KAAK,4BAA4B,GAC9C7f,KAAK,CAACqiB,GAAG,GACTwI,OAAO,CAACC,MAAM,CAAC9qB,KAAK,CAAC;IAC3B;EACF,CAAC;EAAA;AAAA;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/core/package.json b/node_modules/@babel/core/package.json index e4813da0a..42ee7aaa4 100644 --- a/node_modules/@babel/core/package.json +++ b/node_modules/@babel/core/package.json @@ -1,6 +1,6 @@ { "name": "@babel/core", - "version": "7.19.3", + "version": "7.20.5", "description": "Babel compiler core.", "main": "./lib/index.js", "author": "The Babel Team (https://babel.dev/team)", @@ -48,14 +48,14 @@ "dependencies": { "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.3", - "@babel/helper-compilation-targets": "^7.19.3", - "@babel/helper-module-transforms": "^7.19.0", - "@babel/helpers": "^7.19.0", - "@babel/parser": "^7.19.3", + "@babel/generator": "^7.20.5", + "@babel/helper-compilation-targets": "^7.20.0", + "@babel/helper-module-transforms": "^7.20.2", + "@babel/helpers": "^7.20.5", + "@babel/parser": "^7.20.5", "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.3", - "@babel/types": "^7.19.3", + "@babel/traverse": "^7.20.5", + "@babel/types": "^7.20.5", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -63,11 +63,11 @@ "semver": "^6.3.0" }, "devDependencies": { - "@babel/helper-transform-fixture-test-runner": "^7.19.3", + "@babel/helper-transform-fixture-test-runner": "^7.19.4", "@babel/plugin-syntax-flow": "^7.18.6", "@babel/plugin-transform-flow-strip-types": "^7.19.0", - "@babel/plugin-transform-modules-commonjs": "^7.18.6", - "@babel/preset-env": "^7.19.3", + "@babel/plugin-transform-modules-commonjs": "^7.19.6", + "@babel/preset-env": "^7.20.2", "@jridgewell/trace-mapping": "^0.3.8", "@types/convert-source-map": "^1.5.1", "@types/debug": "^4.1.0", diff --git a/node_modules/@babel/generator/lib/buffer.js b/node_modules/@babel/generator/lib/buffer.js index 5932f628a..21393e2fc 100644 --- a/node_modules/@babel/generator/lib/buffer.js +++ b/node_modules/@babel/generator/lib/buffer.js @@ -4,16 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; - -function SourcePos() { - return { - identifierName: undefined, - line: undefined, - column: undefined, - filename: undefined - }; -} - class Buffer { constructor(map) { this._map = null; @@ -27,22 +17,17 @@ class Buffer { line: 1, column: 0 }; - this._sourcePosition = SourcePos(); - this._disallowedPop = { + this._sourcePosition = { identifierName: undefined, line: undefined, column: undefined, - filename: undefined, - objectReusable: true + filename: undefined }; this._map = map; - this._allocQueue(); } - _allocQueue() { const queue = this._queue; - for (let i = 0; i < 16; i++) { queue.push({ char: 0, @@ -54,14 +39,11 @@ class Buffer { }); } } - _pushQueue(char, repeat, line, column, identifierName, filename) { const cursor = this._queueCursor; - if (cursor === this._queue.length) { this._allocQueue(); } - const item = this._queue[cursor]; item.char = char; item.repeat = repeat; @@ -71,62 +53,51 @@ class Buffer { item.filename = filename; this._queueCursor++; } - _popQueue() { if (this._queueCursor === 0) { throw new Error("Cannot pop from empty queue"); } - return this._queue[--this._queueCursor]; } get() { this._flush(); - const map = this._map; const result = { code: (this._buf + this._str).trimRight(), decodedMap: map == null ? void 0 : map.getDecoded(), - get map() { const resultMap = map ? map.get() : null; result.map = resultMap; return resultMap; }, - set map(value) { Object.defineProperty(result, "map", { value, writable: true }); }, - get rawMappings() { const mappings = map == null ? void 0 : map.getRawMappings(); result.rawMappings = mappings; return mappings; }, - set rawMappings(value) { Object.defineProperty(result, "rawMappings", { value, writable: true }); } - }; return result; } append(str, maybeNewline) { this._flush(); - this._append(str, this._sourcePosition, maybeNewline); } - appendChar(char) { this._flush(); - this._appendChar(char, 1, this._sourcePosition); } @@ -134,55 +105,43 @@ class Buffer { if (char === 10) { while (this._queueCursor !== 0) { const char = this._queue[this._queueCursor - 1].char; - if (char !== 32 && char !== 9) { break; } - this._queueCursor--; } } - const sourcePosition = this._sourcePosition; - this._pushQueue(char, 1, sourcePosition.line, sourcePosition.column, sourcePosition.identifierName, sourcePosition.filename); } queueIndentation(char, repeat) { this._pushQueue(char, repeat, undefined, undefined, undefined, undefined); } - _flush() { const queueCursor = this._queueCursor; const queue = this._queue; - for (let i = 0; i < queueCursor; i++) { const item = queue[i]; - this._appendChar(item.char, item.repeat, item); } - this._queueCursor = 0; } - _appendChar(char, repeat, sourcePos) { this._last = char; this._str += repeat > 1 ? String.fromCharCode(char).repeat(repeat) : String.fromCharCode(char); - if (char !== 10) { this._mark(sourcePos.line, sourcePos.column, sourcePos.identifierName, sourcePos.filename); - this._position.column += repeat; } else { this._position.line++; this._position.column = 0; } } - _append(str, sourcePos, maybeNewline) { const len = str.length; + const position = this._position; this._last = str.charCodeAt(len - 1); - if (++this._appendCount > 4096) { +this._str; this._buf += this._str; @@ -191,18 +150,17 @@ class Buffer { } else { this._str += str; } - if (!maybeNewline && !this._map) { - this._position.column += len; + position.column += len; return; } - const { column, identifierName, filename } = sourcePos; let line = sourcePos.line; + let i = str.indexOf("\n"); let last = 0; @@ -211,55 +169,57 @@ class Buffer { } while (i !== -1) { - this._position.line++; - this._position.column = 0; + position.line++; + position.column = 0; last = i + 1; - if (last < str.length) { + if (last < len) { this._mark(++line, 0, identifierName, filename); } - i = str.indexOf("\n", last); } - - this._position.column += str.length - last; + position.column += len - last; } - _mark(line, column, identifierName, filename) { var _this$_map; - (_this$_map = this._map) == null ? void 0 : _this$_map.mark(this._position, line, column, identifierName, filename); } - removeTrailingNewline() { const queueCursor = this._queueCursor; - if (queueCursor !== 0 && this._queue[queueCursor - 1].char === 10) { this._queueCursor--; } } - removeLastSemicolon() { const queueCursor = this._queueCursor; - if (queueCursor !== 0 && this._queue[queueCursor - 1].char === 59) { this._queueCursor--; } } - getLastChar() { const queueCursor = this._queueCursor; return queueCursor !== 0 ? this._queue[queueCursor - 1].char : this._last; } + getNewlineCount() { + const queueCursor = this._queueCursor; + let count = 0; + if (queueCursor === 0) return this._last === 10 ? 1 : 0; + for (let i = queueCursor - 1; i >= 0; i--) { + if (this._queue[i].char !== 10) { + break; + } + count++; + } + return count === queueCursor && this._last === 10 ? count + 1 : count; + } + endsWithCharAndNewline() { const queue = this._queue; const queueCursor = this._queueCursor; - if (queueCursor !== 0) { const lastCp = queue[queueCursor - 1].char; if (lastCp !== 10) return; - if (queueCursor > 1) { return queue[queueCursor - 2].char; } else { @@ -277,90 +237,58 @@ class Buffer { this.source("start", loc); cb(); this.source("end", loc); - - this._disallowPop("start", loc); } source(prop, loc) { - if (!loc) return; + if (!this._map) return; - this._normalizePosition(prop, loc, this._sourcePosition); + this._normalizePosition(prop, loc, 0, 0); + } + sourceWithOffset(prop, loc, lineOffset, columnOffset) { + if (!this._map) return; + this._normalizePosition(prop, loc, lineOffset, columnOffset); } withSource(prop, loc, cb) { if (!this._map) return cb(); - const originalLine = this._sourcePosition.line; - const originalColumn = this._sourcePosition.column; - const originalFilename = this._sourcePosition.filename; - const originalIdentifierName = this._sourcePosition.identifierName; this.source(prop, loc); cb(); - - if (this._disallowedPop.objectReusable || this._disallowedPop.line !== originalLine || this._disallowedPop.column !== originalColumn || this._disallowedPop.filename !== originalFilename) { - this._sourcePosition.line = originalLine; - this._sourcePosition.column = originalColumn; - this._sourcePosition.filename = originalFilename; - this._sourcePosition.identifierName = originalIdentifierName; - this._disallowedPop.objectReusable = true; - } } - - _disallowPop(prop, loc) { - if (!loc) return; - const disallowedPop = this._disallowedPop; - - this._normalizePosition(prop, loc, disallowedPop); - - disallowedPop.objectReusable = false; - } - - _normalizePosition(prop, loc, targetObj) { + _normalizePosition(prop, loc, lineOffset, columnOffset) { const pos = loc[prop]; - targetObj.identifierName = prop === "start" && loc.identifierName || undefined; - + const target = this._sourcePosition; + target.identifierName = prop === "start" && loc.identifierName || undefined; if (pos) { - targetObj.line = pos.line; - targetObj.column = pos.column; - targetObj.filename = loc.filename; - } else { - targetObj.line = null; - targetObj.column = null; - targetObj.filename = null; + target.line = pos.line + lineOffset; + target.column = pos.column + columnOffset; + target.filename = loc.filename; } } - getCurrentColumn() { const queue = this._queue; + const queueCursor = this._queueCursor; let lastIndex = -1; let len = 0; - - for (let i = 0; i < this._queueCursor; i++) { + for (let i = 0; i < queueCursor; i++) { const item = queue[i]; - if (item.char === 10) { - lastIndex = i; - len += item.repeat; + lastIndex = len; } + len += item.repeat; } - return lastIndex === -1 ? this._position.column + len : len - 1 - lastIndex; } - getCurrentLine() { let count = 0; const queue = this._queue; - for (let i = 0; i < this._queueCursor; i++) { if (queue[i].char === 10) { count++; } } - return this._position.line + count; } - } - exports.default = Buffer; //# sourceMappingURL=buffer.js.map diff --git a/node_modules/@babel/generator/lib/buffer.js.map b/node_modules/@babel/generator/lib/buffer.js.map index cea9351ee..5f01393ed 100644 --- a/node_modules/@babel/generator/lib/buffer.js.map +++ b/node_modules/@babel/generator/lib/buffer.js.map @@ -1 +1 @@ -{"version":3,"names":["SourcePos","identifierName","undefined","line","column","filename","Buffer","constructor","map","_map","_buf","_str","_appendCount","_last","_queue","_queueCursor","_position","_sourcePosition","_disallowedPop","objectReusable","_allocQueue","queue","i","push","char","repeat","_pushQueue","cursor","length","item","_popQueue","Error","get","_flush","result","code","trimRight","decodedMap","getDecoded","resultMap","value","Object","defineProperty","writable","rawMappings","mappings","getRawMappings","append","str","maybeNewline","_append","appendChar","_appendChar","sourcePosition","queueIndentation","queueCursor","sourcePos","String","fromCharCode","_mark","len","charCodeAt","indexOf","last","mark","removeTrailingNewline","removeLastSemicolon","getLastChar","endsWithCharAndNewline","lastCp","hasContent","exactSource","loc","cb","source","_disallowPop","prop","_normalizePosition","withSource","originalLine","originalColumn","originalFilename","originalIdentifierName","disallowedPop","targetObj","pos","getCurrentColumn","lastIndex","getCurrentLine","count"],"sources":["../src/buffer.ts"],"sourcesContent":["import type SourceMap from \"./source-map\";\nimport * as charcodes from \"charcodes\";\n\nexport type Pos = {\n line: number;\n column: number;\n};\nexport type Loc = {\n start?: Pos;\n end?: Pos;\n identifierName?: string;\n filename?: string;\n};\ntype SourcePos = {\n identifierName: string | undefined;\n line: number | undefined;\n column: number | undefined;\n filename: string | undefined;\n};\n\ntype QueueItem = {\n char: number;\n repeat: number;\n line: number | undefined;\n column: number | undefined;\n identifierName: string | undefined;\n filename: string | undefined;\n};\n\nfunction SourcePos(): SourcePos {\n return {\n identifierName: undefined,\n line: undefined,\n column: undefined,\n filename: undefined,\n };\n}\n\nexport default class Buffer {\n constructor(map?: SourceMap | null) {\n this._map = map;\n\n this._allocQueue();\n }\n\n _map: SourceMap = null;\n _buf = \"\";\n _str = \"\";\n _appendCount = 0;\n _last = 0;\n _queue: QueueItem[] = [];\n _queueCursor = 0;\n\n _position = {\n line: 1,\n column: 0,\n };\n _sourcePosition = SourcePos();\n _disallowedPop: SourcePos & { objectReusable: boolean } = {\n identifierName: undefined,\n line: undefined,\n column: undefined,\n filename: undefined,\n objectReusable: true, // To avoid deleting and re-creating objects, we reuse existing objects when they are not needed anymore.\n };\n\n _allocQueue() {\n const queue = this._queue;\n\n for (let i = 0; i < 16; i++) {\n queue.push({\n char: 0,\n repeat: 1,\n line: undefined,\n column: undefined,\n identifierName: undefined,\n filename: \"\",\n });\n }\n }\n\n _pushQueue(\n char: number,\n repeat: number,\n line: number | undefined,\n column: number | undefined,\n identifierName: string | undefined,\n filename: string | undefined,\n ) {\n const cursor = this._queueCursor;\n if (cursor === this._queue.length) {\n this._allocQueue();\n }\n const item = this._queue[cursor];\n item.char = char;\n item.repeat = repeat;\n item.line = line;\n item.column = column;\n item.identifierName = identifierName;\n item.filename = filename;\n\n this._queueCursor++;\n }\n\n _popQueue(): QueueItem {\n if (this._queueCursor === 0) {\n throw new Error(\"Cannot pop from empty queue\");\n }\n return this._queue[--this._queueCursor];\n }\n\n /**\n * Get the final string output from the buffer, along with the sourcemap if one exists.\n */\n\n get() {\n this._flush();\n\n const map = this._map;\n const result = {\n // Whatever trim is used here should not execute a regex against the\n // source string since it may be arbitrarily large after all transformations\n code: (this._buf + this._str).trimRight(),\n // Decoded sourcemap is free to generate.\n decodedMap: map?.getDecoded(),\n\n // Encoding the sourcemap is moderately CPU expensive.\n get map() {\n const resultMap = map ? map.get() : null;\n result.map = resultMap;\n return resultMap;\n },\n set map(value) {\n Object.defineProperty(result, \"map\", { value, writable: true });\n },\n // Retrieving the raw mappings is very memory intensive.\n get rawMappings() {\n const mappings = map?.getRawMappings();\n result.rawMappings = mappings;\n return mappings;\n },\n set rawMappings(value) {\n Object.defineProperty(result, \"rawMappings\", { value, writable: true });\n },\n };\n\n return result;\n }\n\n /**\n * Add a string to the buffer that cannot be reverted.\n */\n\n append(str: string, maybeNewline: boolean): void {\n this._flush();\n\n this._append(str, this._sourcePosition, maybeNewline);\n }\n\n appendChar(char: number): void {\n this._flush();\n this._appendChar(char, 1, this._sourcePosition);\n }\n\n /**\n * Add a string to the buffer than can be reverted.\n */\n queue(char: number): void {\n // Drop trailing spaces when a newline is inserted.\n if (char === charcodes.lineFeed) {\n while (this._queueCursor !== 0) {\n const char = this._queue[this._queueCursor - 1].char;\n if (char !== charcodes.space && char !== charcodes.tab) {\n break;\n }\n\n this._queueCursor--;\n }\n }\n\n const sourcePosition = this._sourcePosition;\n this._pushQueue(\n char,\n 1,\n sourcePosition.line,\n sourcePosition.column,\n sourcePosition.identifierName,\n sourcePosition.filename,\n );\n }\n\n /**\n * Same as queue, but this indentation will never have a sourcmap marker.\n */\n queueIndentation(char: number, repeat: number): void {\n this._pushQueue(char, repeat, undefined, undefined, undefined, undefined);\n }\n\n _flush(): void {\n const queueCursor = this._queueCursor;\n const queue = this._queue;\n for (let i = 0; i < queueCursor; i++) {\n const item: QueueItem = queue[i];\n this._appendChar(item.char, item.repeat, item);\n }\n this._queueCursor = 0;\n }\n\n _appendChar(char: number, repeat: number, sourcePos: SourcePos): void {\n this._last = char;\n\n this._str +=\n repeat > 1\n ? String.fromCharCode(char).repeat(repeat)\n : String.fromCharCode(char);\n\n if (char !== charcodes.lineFeed) {\n this._mark(\n sourcePos.line,\n sourcePos.column,\n sourcePos.identifierName,\n sourcePos.filename,\n );\n this._position.column += repeat;\n } else {\n this._position.line++;\n this._position.column = 0;\n }\n }\n\n _append(str: string, sourcePos: SourcePos, maybeNewline: boolean): void {\n const len = str.length;\n\n this._last = str.charCodeAt(len - 1);\n\n if (++this._appendCount > 4096) {\n +this._str; // Unexplainable huge performance boost. Ref: https://github.com/davidmarkclements/flatstr License: MIT\n this._buf += this._str;\n this._str = str;\n this._appendCount = 0;\n } else {\n this._str += str;\n }\n\n if (!maybeNewline && !this._map) {\n this._position.column += len;\n return;\n }\n\n const { column, identifierName, filename } = sourcePos;\n let line = sourcePos.line;\n\n // Search for newline chars. We search only for `\\n`, since both `\\r` and\n // `\\r\\n` are normalized to `\\n` during parse. We exclude `\\u2028` and\n // `\\u2029` for performance reasons, they're so uncommon that it's probably\n // ok. It's also unclear how other sourcemap utilities handle them...\n let i = str.indexOf(\"\\n\");\n let last = 0;\n\n // If the string starts with a newline char, then adding a mark is redundant.\n // This catches both \"no newlines\" and \"newline after several chars\".\n if (i !== 0) {\n this._mark(line, column, identifierName, filename);\n }\n\n // Now, find each reamining newline char in the string.\n while (i !== -1) {\n this._position.line++;\n this._position.column = 0;\n last = i + 1;\n\n // We mark the start of each line, which happens directly after this newline char\n // unless this is the last char.\n if (last < str.length) {\n this._mark(++line, 0, identifierName, filename);\n }\n i = str.indexOf(\"\\n\", last);\n }\n this._position.column += str.length - last;\n }\n\n _mark(\n line: number | undefined,\n column: number | undefined,\n identifierName: string | undefined,\n filename: string | undefined,\n ): void {\n this._map?.mark(this._position, line, column, identifierName, filename);\n }\n\n removeTrailingNewline(): void {\n const queueCursor = this._queueCursor;\n if (\n queueCursor !== 0 &&\n this._queue[queueCursor - 1].char === charcodes.lineFeed\n ) {\n this._queueCursor--;\n }\n }\n\n removeLastSemicolon(): void {\n const queueCursor = this._queueCursor;\n if (\n queueCursor !== 0 &&\n this._queue[queueCursor - 1].char === charcodes.semicolon\n ) {\n this._queueCursor--;\n }\n }\n\n getLastChar(): number {\n const queueCursor = this._queueCursor;\n return queueCursor !== 0 ? this._queue[queueCursor - 1].char : this._last;\n }\n\n /**\n * check if current _last + queue ends with newline, return the character before newline\n *\n * @param {*} ch\n * @memberof Buffer\n */\n endsWithCharAndNewline(): number {\n const queue = this._queue;\n const queueCursor = this._queueCursor;\n if (queueCursor !== 0) {\n // every element in queue is one-length whitespace string\n const lastCp = queue[queueCursor - 1].char;\n if (lastCp !== charcodes.lineFeed) return;\n if (queueCursor > 1) {\n return queue[queueCursor - 2].char;\n } else {\n return this._last;\n }\n }\n // We assume that everything being matched is at most a single token plus some whitespace,\n // which everything currently is, but otherwise we'd have to expand _last or check _buf.\n }\n\n hasContent(): boolean {\n return this._queueCursor !== 0 || !!this._last;\n }\n\n /**\n * Certain sourcemap usecases expect mappings to be more accurate than\n * Babel's generic sourcemap handling allows. For now, we special-case\n * identifiers to allow for the primary cases to work.\n * The goal of this line is to ensure that the map output from Babel will\n * have an exact range on identifiers in the output code. Without this\n * line, Babel would potentially include some number of trailing tokens\n * that are printed after the identifier, but before another location has\n * been assigned.\n * This allows tooling like Rollup and Webpack to more accurately perform\n * their own transformations. Most importantly, this allows the import/export\n * transformations performed by those tools to loose less information when\n * applying their own transformations on top of the code and map results\n * generated by Babel itself.\n *\n * The primary example of this is the snippet:\n *\n * import mod from \"mod\";\n * mod();\n *\n * With this line, there will be one mapping range over \"mod\" and another\n * over \"();\", where previously it would have been a single mapping.\n */\n exactSource(loc: Loc | undefined, cb: () => void) {\n if (!this._map) return cb();\n\n this.source(\"start\", loc);\n\n cb();\n\n // In cases where tokens are printed after this item, we want to\n // ensure that they get the location of the _end_ of the identifier.\n // To accomplish this, we assign the location and explicitly disable\n // the standard Buffer withSource previous-position \"reactivation\"\n // logic. This means that if another item calls '.source()' to set\n // the location after the identifier, it is fine, but the position won't\n // be automatically replaced with the previous value.\n this.source(\"end\", loc);\n this._disallowPop(\"start\", loc);\n }\n\n /**\n * Sets a given position as the current source location so generated code after this call\n * will be given this position in the sourcemap.\n */\n\n source(prop: \"start\" | \"end\", loc: Loc | undefined): void {\n if (!loc) return;\n\n // Since this is called extremely often, we re-use the same _sourcePosition\n // object for the whole lifetime of the buffer.\n this._normalizePosition(prop, loc, this._sourcePosition);\n }\n\n /**\n * Call a callback with a specific source location and restore on completion.\n */\n\n withSource(prop: \"start\" | \"end\", loc: Loc, cb: () => void): void {\n if (!this._map) return cb();\n\n // Use the call stack to manage a stack of \"source location\" data because\n // the _sourcePosition object is mutated over the course of code generation,\n // and constantly copying it would be slower.\n const originalLine = this._sourcePosition.line;\n const originalColumn = this._sourcePosition.column;\n const originalFilename = this._sourcePosition.filename;\n const originalIdentifierName = this._sourcePosition.identifierName;\n\n this.source(prop, loc);\n\n cb();\n\n if (\n // Verify if reactivating this specific position has been disallowed.\n this._disallowedPop.objectReusable ||\n this._disallowedPop.line !== originalLine ||\n this._disallowedPop.column !== originalColumn ||\n this._disallowedPop.filename !== originalFilename\n ) {\n this._sourcePosition.line = originalLine;\n this._sourcePosition.column = originalColumn;\n this._sourcePosition.filename = originalFilename;\n this._sourcePosition.identifierName = originalIdentifierName;\n this._disallowedPop.objectReusable = true;\n }\n }\n\n /**\n * Allow printers to disable the default location-reset behavior of the\n * sourcemap output, so that certain printers can be sure that the\n * \"end\" location that they set is actually treated as the end position.\n */\n _disallowPop(prop: \"start\" | \"end\", loc: Loc) {\n if (!loc) return;\n\n const disallowedPop = this._disallowedPop;\n\n this._normalizePosition(prop, loc, disallowedPop);\n\n disallowedPop.objectReusable = false;\n }\n\n _normalizePosition(prop: \"start\" | \"end\", loc: Loc, targetObj: SourcePos) {\n const pos = loc[prop];\n\n targetObj.identifierName =\n (prop === \"start\" && loc.identifierName) || undefined;\n if (pos) {\n targetObj.line = pos.line;\n targetObj.column = pos.column;\n targetObj.filename = loc.filename;\n } else {\n targetObj.line = null;\n targetObj.column = null;\n targetObj.filename = null;\n }\n }\n\n getCurrentColumn(): number {\n const queue = this._queue;\n\n let lastIndex = -1;\n let len = 0;\n for (let i = 0; i < this._queueCursor; i++) {\n const item = queue[i];\n if (item.char === charcodes.lineFeed) {\n lastIndex = i;\n len += item.repeat;\n }\n }\n\n return lastIndex === -1 ? this._position.column + len : len - 1 - lastIndex;\n }\n\n getCurrentLine(): number {\n let count = 0;\n\n const queue = this._queue;\n for (let i = 0; i < this._queueCursor; i++) {\n if (queue[i].char === charcodes.lineFeed) {\n count++;\n }\n }\n\n return this._position.line + count;\n }\n}\n"],"mappings":";;;;;;;AA6BA,SAASA,SAAT,GAAgC;EAC9B,OAAO;IACLC,cAAc,EAAEC,SADX;IAELC,IAAI,EAAED,SAFD;IAGLE,MAAM,EAAEF,SAHH;IAILG,QAAQ,EAAEH;EAJL,CAAP;AAMD;;AAEc,MAAMI,MAAN,CAAa;EAC1BC,WAAW,CAACC,GAAD,EAAyB;IAAA,KAMpCC,IANoC,GAMlB,IANkB;IAAA,KAOpCC,IAPoC,GAO7B,EAP6B;IAAA,KAQpCC,IARoC,GAQ7B,EAR6B;IAAA,KASpCC,YAToC,GASrB,CATqB;IAAA,KAUpCC,KAVoC,GAU5B,CAV4B;IAAA,KAWpCC,MAXoC,GAWd,EAXc;IAAA,KAYpCC,YAZoC,GAYrB,CAZqB;IAAA,KAcpCC,SAdoC,GAcxB;MACVb,IAAI,EAAE,CADI;MAEVC,MAAM,EAAE;IAFE,CAdwB;IAAA,KAkBpCa,eAlBoC,GAkBlBjB,SAAS,EAlBS;IAAA,KAmBpCkB,cAnBoC,GAmBsB;MACxDjB,cAAc,EAAEC,SADwC;MAExDC,IAAI,EAAED,SAFkD;MAGxDE,MAAM,EAAEF,SAHgD;MAIxDG,QAAQ,EAAEH,SAJ8C;MAKxDiB,cAAc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S,CAAChF,MAAV,GAAmBiF,GAAG,CAACjF,MAAvB;MACAgF,SAAS,CAAC/E,QAAV,GAAqBmE,GAAG,CAACnE,QAAzB;IACD,CAJD,MAIO;MACL+E,SAAS,CAACjF,IAAV,GAAiB,IAAjB;MACAiF,SAAS,CAAChF,MAAV,GAAmB,IAAnB;MACAgF,SAAS,CAAC/E,QAAV,GAAqB,IAArB;IACD;EACF;;EAEDiF,gBAAgB,GAAW;IACzB,MAAMjE,KAAK,GAAG,KAAKP,MAAnB;IAEA,IAAIyE,SAAS,GAAG,CAAC,CAAjB;IACA,IAAI3B,GAAG,GAAG,CAAV;;IACA,KAAK,IAAItC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,KAAKP,YAAzB,EAAuCO,CAAC,EAAxC,EAA4C;MAC1C,MAAMO,IAAI,GAAGR,KAAK,CAACC,CAAD,CAAlB;;MACA,IAAIO,IAAI,CAACL,IAAL,OAAJ,EAAsC;QACpC+D,SAAS,GAAGjE,CAAZ;QACAsC,GAAG,IAAI/B,IAAI,CAACJ,MAAZ;MACD;IACF;;IAED,OAAO8D,SAAS,KAAK,CAAC,CAAf,GAAmB,KAAKvE,SAAL,CAAeZ,MAAf,GAAwBwD,GAA3C,GAAiDA,GAAG,GAAG,CAAN,GAAU2B,SAAlE;EACD;;EAEDC,cAAc,GAAW;IACvB,IAAIC,KAAK,GAAG,CAAZ;IAEA,MAAMpE,KAAK,GAAG,KAAKP,MAAnB;;IACA,KAAK,IAAIQ,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,KAAKP,YAAzB,EAAuCO,CAAC,EAAxC,EAA4C;MAC1C,IAAID,KAAK,CAACC,CAAD,CAAL,CAASE,IAAT,OAAJ,EAA0C;QACxCiE,KAAK;MACN;IACF;;IAED,OAAO,KAAKzE,SAAL,CAAeb,IAAf,GAAsBsF,KAA7B;EACD;;AAlcyB"} \ No newline at end of file +{"version":3,"names":["Buffer","constructor","map","_map","_buf","_str","_appendCount","_last","_queue","_queueCursor","_position","line","column","_sourcePosition","identifierName","undefined","filename","_allocQueue","queue","i","push","char","repeat","_pushQueue","cursor","length","item","_popQueue","Error","get","_flush","result","code","trimRight","decodedMap","getDecoded","resultMap","value","Object","defineProperty","writable","rawMappings","mappings","getRawMappings","append","str","maybeNewline","_append","appendChar","_appendChar","sourcePosition","queueIndentation","queueCursor","sourcePos","String","fromCharCode","_mark","len","position","charCodeAt","indexOf","last","mark","removeTrailingNewline","removeLastSemicolon","getLastChar","getNewlineCount","count","endsWithCharAndNewline","lastCp","hasContent","exactSource","loc","cb","source","prop","_normalizePosition","sourceWithOffset","lineOffset","columnOffset","withSource","pos","target","getCurrentColumn","lastIndex","getCurrentLine"],"sources":["../src/buffer.ts"],"sourcesContent":["import type SourceMap from \"./source-map\";\nimport * as charcodes from \"charcodes\";\n\nexport type Pos = {\n line: number;\n column: number;\n};\nexport type Loc = {\n start?: Pos;\n end?: Pos;\n identifierName?: string;\n filename?: string;\n};\ntype SourcePos = {\n identifierName: string | undefined;\n line: number | undefined;\n column: number | undefined;\n filename: string | undefined;\n};\n\ntype QueueItem = {\n char: number;\n repeat: number;\n line: number | undefined;\n column: number | undefined;\n identifierName: string | undefined;\n filename: string | undefined;\n};\n\nexport default class Buffer {\n constructor(map?: SourceMap | null) {\n this._map = map;\n\n this._allocQueue();\n }\n\n _map: SourceMap = null;\n _buf = \"\";\n _str = \"\";\n _appendCount = 0;\n _last = 0;\n _queue: QueueItem[] = [];\n _queueCursor = 0;\n\n _position = {\n line: 1,\n column: 0,\n };\n _sourcePosition: SourcePos = {\n identifierName: undefined,\n line: undefined,\n column: undefined,\n filename: undefined,\n };\n\n _allocQueue() {\n const queue = this._queue;\n\n for (let i = 0; i < 16; i++) {\n queue.push({\n char: 0,\n repeat: 1,\n line: undefined,\n column: undefined,\n identifierName: undefined,\n filename: \"\",\n });\n }\n }\n\n _pushQueue(\n char: number,\n repeat: number,\n line: number | undefined,\n column: number | undefined,\n identifierName: string | undefined,\n filename: string | undefined,\n ) {\n const cursor = this._queueCursor;\n if (cursor === this._queue.length) {\n this._allocQueue();\n }\n const item = this._queue[cursor];\n item.char = char;\n item.repeat = repeat;\n item.line = line;\n item.column = column;\n item.identifierName = identifierName;\n item.filename = filename;\n\n this._queueCursor++;\n }\n\n _popQueue(): QueueItem {\n if (this._queueCursor === 0) {\n throw new Error(\"Cannot pop from empty queue\");\n }\n return this._queue[--this._queueCursor];\n }\n\n /**\n * Get the final string output from the buffer, along with the sourcemap if one exists.\n */\n\n get() {\n this._flush();\n\n const map = this._map;\n const result = {\n // Whatever trim is used here should not execute a regex against the\n // source string since it may be arbitrarily large after all transformations\n code: (this._buf + this._str).trimRight(),\n // Decoded sourcemap is free to generate.\n decodedMap: map?.getDecoded(),\n\n // Encoding the sourcemap is moderately CPU expensive.\n get map() {\n const resultMap = map ? map.get() : null;\n result.map = resultMap;\n return resultMap;\n },\n set map(value) {\n Object.defineProperty(result, \"map\", { value, writable: true });\n },\n // Retrieving the raw mappings is very memory intensive.\n get rawMappings() {\n const mappings = map?.getRawMappings();\n result.rawMappings = mappings;\n return mappings;\n },\n set rawMappings(value) {\n Object.defineProperty(result, \"rawMappings\", { value, writable: true });\n },\n };\n\n return result;\n }\n\n /**\n * Add a string to the buffer that cannot be reverted.\n */\n\n append(str: string, maybeNewline: boolean): void {\n this._flush();\n\n this._append(str, this._sourcePosition, maybeNewline);\n }\n\n appendChar(char: number): void {\n this._flush();\n this._appendChar(char, 1, this._sourcePosition);\n }\n\n /**\n * Add a string to the buffer than can be reverted.\n */\n queue(char: number): void {\n // Drop trailing spaces when a newline is inserted.\n if (char === charcodes.lineFeed) {\n while (this._queueCursor !== 0) {\n const char = this._queue[this._queueCursor - 1].char;\n if (char !== charcodes.space && char !== charcodes.tab) {\n break;\n }\n\n this._queueCursor--;\n }\n }\n\n const sourcePosition = this._sourcePosition;\n this._pushQueue(\n char,\n 1,\n sourcePosition.line,\n sourcePosition.column,\n sourcePosition.identifierName,\n sourcePosition.filename,\n );\n }\n\n /**\n * Same as queue, but this indentation will never have a sourcmap marker.\n */\n queueIndentation(char: number, repeat: number): void {\n this._pushQueue(char, repeat, undefined, undefined, undefined, undefined);\n }\n\n _flush(): void {\n const queueCursor = this._queueCursor;\n const queue = this._queue;\n for (let i = 0; i < queueCursor; i++) {\n const item: QueueItem = queue[i];\n this._appendChar(item.char, item.repeat, item);\n }\n this._queueCursor = 0;\n }\n\n _appendChar(char: number, repeat: number, sourcePos: SourcePos): void {\n this._last = char;\n\n this._str +=\n repeat > 1\n ? String.fromCharCode(char).repeat(repeat)\n : String.fromCharCode(char);\n\n if (char !== charcodes.lineFeed) {\n this._mark(\n sourcePos.line,\n sourcePos.column,\n sourcePos.identifierName,\n sourcePos.filename,\n );\n this._position.column += repeat;\n } else {\n this._position.line++;\n this._position.column = 0;\n }\n }\n\n _append(str: string, sourcePos: SourcePos, maybeNewline: boolean): void {\n const len = str.length;\n const position = this._position;\n\n this._last = str.charCodeAt(len - 1);\n\n if (++this._appendCount > 4096) {\n +this._str; // Unexplainable huge performance boost. Ref: https://github.com/davidmarkclements/flatstr License: MIT\n this._buf += this._str;\n this._str = str;\n this._appendCount = 0;\n } else {\n this._str += str;\n }\n\n if (!maybeNewline && !this._map) {\n position.column += len;\n return;\n }\n\n const { column, identifierName, filename } = sourcePos;\n let line = sourcePos.line;\n\n // Search for newline chars. We search only for `\\n`, since both `\\r` and\n // `\\r\\n` are normalized to `\\n` during parse. We exclude `\\u2028` and\n // `\\u2029` for performance reasons, they're so uncommon that it's probably\n // ok. It's also unclear how other sourcemap utilities handle them...\n let i = str.indexOf(\"\\n\");\n let last = 0;\n\n // If the string starts with a newline char, then adding a mark is redundant.\n // This catches both \"no newlines\" and \"newline after several chars\".\n if (i !== 0) {\n this._mark(line, column, identifierName, filename);\n }\n\n // Now, find each reamining newline char in the string.\n while (i !== -1) {\n position.line++;\n position.column = 0;\n last = i + 1;\n\n // We mark the start of each line, which happens directly after this newline char\n // unless this is the last char.\n if (last < len) {\n this._mark(++line, 0, identifierName, filename);\n }\n i = str.indexOf(\"\\n\", last);\n }\n position.column += len - last;\n }\n\n _mark(\n line: number | undefined,\n column: number | undefined,\n identifierName: string | undefined,\n filename: string | undefined,\n ): void {\n this._map?.mark(this._position, line, column, identifierName, filename);\n }\n\n removeTrailingNewline(): void {\n const queueCursor = this._queueCursor;\n if (\n queueCursor !== 0 &&\n this._queue[queueCursor - 1].char === charcodes.lineFeed\n ) {\n this._queueCursor--;\n }\n }\n\n removeLastSemicolon(): void {\n const queueCursor = this._queueCursor;\n if (\n queueCursor !== 0 &&\n this._queue[queueCursor - 1].char === charcodes.semicolon\n ) {\n this._queueCursor--;\n }\n }\n\n getLastChar(): number {\n const queueCursor = this._queueCursor;\n return queueCursor !== 0 ? this._queue[queueCursor - 1].char : this._last;\n }\n\n /**\n * This will only detect at most 1 newline after a call to `flush()`,\n * but this has not been found so far, and an accurate count can be achieved if needed later.\n */\n getNewlineCount(): number {\n const queueCursor = this._queueCursor;\n let count = 0;\n if (queueCursor === 0) return this._last === charcodes.lineFeed ? 1 : 0;\n for (let i = queueCursor - 1; i >= 0; i--) {\n if (this._queue[i].char !== charcodes.lineFeed) {\n break;\n }\n count++;\n }\n return count === queueCursor && this._last === charcodes.lineFeed\n ? count + 1\n : count;\n }\n\n /**\n * check if current _last + queue ends with newline, return the character before newline\n *\n * @param {*} ch\n * @memberof Buffer\n */\n endsWithCharAndNewline(): number {\n const queue = this._queue;\n const queueCursor = this._queueCursor;\n if (queueCursor !== 0) {\n // every element in queue is one-length whitespace string\n const lastCp = queue[queueCursor - 1].char;\n if (lastCp !== charcodes.lineFeed) return;\n if (queueCursor > 1) {\n return queue[queueCursor - 2].char;\n } else {\n return this._last;\n }\n }\n // We assume that everything being matched is at most a single token plus some whitespace,\n // which everything currently is, but otherwise we'd have to expand _last or check _buf.\n }\n\n hasContent(): boolean {\n return this._queueCursor !== 0 || !!this._last;\n }\n\n /**\n * Certain sourcemap usecases expect mappings to be more accurate than\n * Babel's generic sourcemap handling allows. For now, we special-case\n * identifiers to allow for the primary cases to work.\n * The goal of this line is to ensure that the map output from Babel will\n * have an exact range on identifiers in the output code. Without this\n * line, Babel would potentially include some number of trailing tokens\n * that are printed after the identifier, but before another location has\n * been assigned.\n * This allows tooling like Rollup and Webpack to more accurately perform\n * their own transformations. Most importantly, this allows the import/export\n * transformations performed by those tools to loose less information when\n * applying their own transformations on top of the code and map results\n * generated by Babel itself.\n *\n * The primary example of this is the snippet:\n *\n * import mod from \"mod\";\n * mod();\n *\n * With this line, there will be one mapping range over \"mod\" and another\n * over \"();\", where previously it would have been a single mapping.\n */\n exactSource(loc: Loc | undefined, cb: () => void) {\n if (!this._map) return cb();\n\n this.source(\"start\", loc);\n\n cb();\n\n this.source(\"end\", loc);\n }\n\n /**\n * Sets a given position as the current source location so generated code after this call\n * will be given this position in the sourcemap.\n */\n\n source(prop: \"start\" | \"end\", loc: Loc | undefined): void {\n if (!this._map) return;\n\n // Since this is called extremely often, we re-use the same _sourcePosition\n // object for the whole lifetime of the buffer.\n this._normalizePosition(prop, loc, 0, 0);\n }\n\n sourceWithOffset(\n prop: \"start\" | \"end\",\n loc: Loc | undefined,\n lineOffset: number,\n columnOffset: number,\n ): void {\n if (!this._map) return;\n\n this._normalizePosition(prop, loc, lineOffset, columnOffset);\n }\n\n /**\n * Call a callback with a specific source location\n */\n\n withSource(prop: \"start\" | \"end\", loc: Loc, cb: () => void): void {\n if (!this._map) return cb();\n\n this.source(prop, loc);\n\n cb();\n }\n\n _normalizePosition(\n prop: \"start\" | \"end\",\n loc: Loc,\n lineOffset: number,\n columnOffset: number,\n ) {\n const pos = loc[prop];\n const target = this._sourcePosition;\n\n target.identifierName =\n (prop === \"start\" && loc.identifierName) || undefined;\n if (pos) {\n target.line = pos.line + lineOffset;\n target.column = pos.column + columnOffset;\n target.filename = loc.filename;\n }\n }\n\n getCurrentColumn(): number {\n const queue = this._queue;\n const queueCursor = this._queueCursor;\n\n let lastIndex = -1;\n let len = 0;\n for (let i = 0; i < queueCursor; i++) {\n const item = queue[i];\n if (item.char === charcodes.lineFeed) {\n lastIndex = len;\n }\n len += item.repeat;\n }\n\n return lastIndex === -1 ? this._position.column + len : len - 1 - lastIndex;\n }\n\n getCurrentLine(): number {\n let count = 0;\n\n const queue = this._queue;\n for (let i = 0; i < this._queueCursor; i++) {\n if (queue[i].char === charcodes.lineFeed) {\n count++;\n }\n }\n\n return this._position.line + count;\n }\n}\n"],"mappings":";;;;;;AA6Be,MAAMA,MAAM,CAAC;EAC1BC,WAAW,CAACC,GAAsB,EAAE;IAAA,KAMpCC,IAAI,GAAc,IAAI;IAAA,KACtBC,IAAI,GAAG,EAAE;IAAA,KACTC,IAAI,GAAG,EAAE;IAAA,KACTC,YAAY,GAAG,CAAC;IAAA,KAChBC,KAAK,GAAG,CAAC;IAAA,KACTC,MAAM,GAAgB,EAAE;IAAA,KACxBC,YAAY,GAAG,CAAC;IAAA,KAEhBC,SAAS,GAAG;MACVC,IAAI,EAAE,CAAC;MACPC,MAAM,EAAE;IACV,CAAC;IAAA,KACDC,eAAe,GAAc;MAC3BC,cAAc,EAAEC,SAAS;MACzBJ,IAAI,EAAEI,SAAS;MACfH,MAAM,EAAEG,SAAS;MACjBC,QAAQ,EAAED;IACZ,CAAC;IAtBC,IAAI,CAACZ,IAAI,GAAGD,GAAG;IAEf,IAAI,CAACe,WAAW,EAAE;EACpB;EAqBAA,WAAW,GAAG;IACZ,MAAMC,KAAK,GAAG,IAAI,CAACV,MAAM;IAEzB,KAAK,IAAIW,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,EAAE,EAAEA,CAAC,EAAE,EAAE;MAC3BD,KAAK,CAACE,IAAI,CAAC;QACTC,IAAI,EAAE,CAAC;QACPC,MAAM,EAAE,CAAC;QACTX,IAAI,EAAEI,SAAS;QACfH,MAAM,EAAEG,SAAS;QACjBD,cAAc,EAAEC,SAAS;QACzBC,QAAQ,EAAE;MACZ,CAAC,CAAC;IACJ;EACF;EAEAO,U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AI2E,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI3B,GAAG,GAAG,CAAC;IACX,KAAK,IAAItC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGiC,WAAW,EAAEjC,CAAC,EAAE,EAAE;MACpC,MAAMO,IAAI,GAAGR,KAAK,CAACC,CAAC,CAAC;MACrB,IAAIO,IAAI,CAACL,IAAI,OAAuB,EAAE;QACpC+D,SAAS,GAAG3B,GAAG;MACjB;MACAA,GAAG,IAAI/B,IAAI,CAACJ,MAAM;IACpB;IAEA,OAAO8D,SAAS,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC1E,SAAS,CAACE,MAAM,GAAG6C,GAAG,GAAGA,GAAG,GAAG,CAAC,GAAG2B,SAAS;EAC7E;EAEAC,cAAc,GAAW;IACvB,IAAIlB,KAAK,GAAG,CAAC;IAEb,MAAMjD,KAAK,GAAG,IAAI,CAACV,MAAM;IACzB,KAAK,IAAIW,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAG,IAAI,CAACV,YAAY,EAAEU,CAAC,EAAE,EAAE;MAC1C,IAAID,KAAK,CAACC,CAAC,CAAC,CAACE,IAAI,OAAuB,EAAE;QACxC8C,KAAK,EAAE;MACT;IACF;IAEA,OAAO,IAAI,CAACzD,SAAS,CAACC,IAAI,GAAGwD,KAAK;EACpC;AACF;AAAC"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/base.js b/node_modules/@babel/generator/lib/generators/base.js index 7507c4c3c..cf6da0cf9 100644 --- a/node_modules/@babel/generator/lib/generators/base.js +++ b/node_modules/@babel/generator/lib/generators/base.js @@ -10,48 +10,50 @@ exports.File = File; exports.InterpreterDirective = InterpreterDirective; exports.Placeholder = Placeholder; exports.Program = Program; - function File(node) { if (node.program) { this.print(node.program.interpreter, node); } - this.print(node.program, node); } - function Program(node) { - this.printInnerComments(node, false); - this.printSequence(node.directives, node); - if (node.directives && node.directives.length) this.newline(); + var _node$directives; + this.noIndentInnerCommentsHere(); + this.printInnerComments(); + const directivesLen = (_node$directives = node.directives) == null ? void 0 : _node$directives.length; + if (directivesLen) { + var _node$directives$trai; + const newline = node.body.length ? 2 : 1; + this.printSequence(node.directives, node, { + trailingCommentsLineOffset: newline + }); + if (!((_node$directives$trai = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai.length)) { + this.newline(newline); + } + } this.printSequence(node.body, node); } - function BlockStatement(node) { - var _node$directives; - + var _node$directives2; this.tokenChar(123); - this.printInnerComments(node); - const hasDirectives = (_node$directives = node.directives) == null ? void 0 : _node$directives.length; - - if (node.body.length || hasDirectives) { - this.newline(); + const directivesLen = (_node$directives2 = node.directives) == null ? void 0 : _node$directives2.length; + if (directivesLen) { + var _node$directives$trai2; + const newline = node.body.length ? 2 : 1; this.printSequence(node.directives, node, { - indent: true - }); - if (hasDirectives) this.newline(); - this.printSequence(node.body, node, { - indent: true + indent: true, + trailingCommentsLineOffset: newline }); - this.removeTrailingNewline(); - this.source("end", node.loc); - if (!this.endsWith(10)) this.newline(); - this.rightBrace(); - } else { - this.source("end", node.loc); - this.tokenChar(125); + if (!((_node$directives$trai2 = node.directives[directivesLen - 1].trailingComments) != null && _node$directives$trai2.length)) { + this.newline(newline); + } } + this.printSequence(node.body, node, { + indent: true + }); + this.sourceWithOffset("end", node.loc, 0, -1); + this.rightBrace(); } - function Directive(node) { this.print(node.value, node); this.semicolon(); @@ -59,15 +61,12 @@ function Directive(node) { const unescapedSingleQuoteRE = /(?:^|[^\\])(?:\\\\)*'/; const unescapedDoubleQuoteRE = /(?:^|[^\\])(?:\\\\)*"/; - function DirectiveLiteral(node) { const raw = this.getPossibleRaw(node); - if (!this.format.minified && raw !== undefined) { this.token(raw); return; } - const { value } = node; @@ -80,16 +79,14 @@ function DirectiveLiteral(node) { throw new Error("Malformed AST: it is not possible to print a directive containing" + " both unescaped single and double quotes."); } } - function InterpreterDirective(node) { - this.token(`#!${node.value}\n`, true); + this.token(`#!${node.value}`); + this.newline(1, true); } - function Placeholder(node) { this.token("%%"); this.print(node.name); this.token("%%"); - if (node.expectedNode === "Statement") { this.semicolon(); } diff --git a/node_modules/@babel/generator/lib/generators/base.js.map b/node_modules/@babel/generator/lib/generators/base.js.map index 821b89171..62a2aa637 100644 --- a/node_modules/@babel/generator/lib/generators/base.js.map +++ b/node_modules/@babel/generator/lib/generators/base.js.map @@ -1 +1 @@ -{"version":3,"names":["File","node","program","print","interpreter","Program","printInnerComments","printSequence","directives","length","newline","body","BlockStatement","token","hasDirectives","indent","removeTrailingNewline","source","loc","endsWith","rightBrace","Directive","value","semicolon","unescapedSingleQuoteRE","unescapedDoubleQuoteRE","DirectiveLiteral","raw","getPossibleRaw","format","minified","undefined","test","Error","InterpreterDirective","Placeholder","name","expectedNode"],"sources":["../../src/generators/base.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport type * as t from \"@babel/types\";\nimport * as charCodes from \"charcodes\";\n\nexport function File(this: Printer, node: t.File) {\n if (node.program) {\n // Print this here to ensure that Program node 'leadingComments' still\n // get printed after the hashbang.\n this.print(node.program.interpreter, node);\n }\n\n this.print(node.program, node);\n}\n\nexport function Program(this: Printer, node: t.Program) {\n this.printInnerComments(node, false);\n\n this.printSequence(node.directives, node);\n if (node.directives && node.directives.length) this.newline();\n\n this.printSequence(node.body, node);\n}\n\nexport function BlockStatement(this: Printer, node: t.BlockStatement) {\n this.token(\"{\");\n this.printInnerComments(node);\n\n const hasDirectives = node.directives?.length;\n\n if (node.body.length || hasDirectives) {\n this.newline();\n\n this.printSequence(node.directives, node, { indent: true });\n if (hasDirectives) this.newline();\n\n this.printSequence(node.body, node, { indent: true });\n this.removeTrailingNewline();\n\n this.source(\"end\", node.loc);\n\n if (!this.endsWith(charCodes.lineFeed)) this.newline();\n\n this.rightBrace();\n } else {\n this.source(\"end\", node.loc);\n this.token(\"}\");\n }\n}\n\nexport function Directive(this: Printer, node: t.Directive) {\n this.print(node.value, node);\n this.semicolon();\n}\n\n// These regexes match an even number of \\ followed by a quote\nconst unescapedSingleQuoteRE = /(?:^|[^\\\\])(?:\\\\\\\\)*'/;\nconst unescapedDoubleQuoteRE = /(?:^|[^\\\\])(?:\\\\\\\\)*\"/;\n\nexport function DirectiveLiteral(this: Printer, node: t.DirectiveLiteral) {\n const raw = this.getPossibleRaw(node);\n if (!this.format.minified && raw !== undefined) {\n this.token(raw);\n return;\n }\n\n const { value } = node;\n\n // NOTE: In directives we can't change escapings,\n // because they change the behavior.\n // e.g. \"us\\x65 string\" (\\x65 is e) is not a \"use strict\" directive.\n\n if (!unescapedDoubleQuoteRE.test(value)) {\n this.token(`\"${value}\"`);\n } else if (!unescapedSingleQuoteRE.test(value)) {\n this.token(`'${value}'`);\n } else {\n throw new Error(\n \"Malformed AST: it is not possible to print a directive containing\" +\n \" both unescaped single and double quotes.\",\n );\n }\n}\n\nexport function InterpreterDirective(\n this: Printer,\n node: t.InterpreterDirective,\n) {\n this.token(`#!${node.value}\\n`, true);\n}\n\nexport function Placeholder(this: Printer, node: t.Placeholder) {\n this.token(\"%%\");\n this.print(node.name);\n this.token(\"%%\");\n\n if (node.expectedNode === \"Statement\") {\n this.semicolon();\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAIO,SAASA,IAAT,CAA6BC,IAA7B,EAA2C;EAChD,IAAIA,IAAI,CAACC,OAAT,EAAkB;IAGhB,KAAKC,KAAL,CAAWF,IAAI,CAACC,OAAL,CAAaE,WAAxB,EAAqCH,IAArC;EACD;;EAED,KAAKE,KAAL,CAAWF,IAAI,CAACC,OAAhB,EAAyBD,IAAzB;AACD;;AAEM,SAASI,OAAT,CAAgCJ,IAAhC,EAAiD;EACtD,KAAKK,kBAAL,CAAwBL,IAAxB,EAA8B,KAA9B;EAEA,KAAKM,aAAL,CAAmBN,IAAI,CAACO,UAAxB,EAAoCP,IAApC;EACA,IAAIA,IAAI,CAACO,UAAL,IAAmBP,IAAI,CAACO,UAAL,CAAgBC,MAAvC,EAA+C,KAAKC,OAAL;EAE/C,KAAKH,aAAL,CAAmBN,IAAI,CA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A;EACD;;EAED,MAAM;IAAEL;EAAF,IAAYrB,IAAlB;;EAMA,IAAI,CAACwB,sBAAsB,CAACO,IAAvB,CAA4BV,KAA5B,CAAL,EAAyC;IACvC,KAAKT,KAAL,CAAY,IAAGS,KAAM,GAArB;EACD,CAFD,MAEO,IAAI,CAACE,sBAAsB,CAACQ,IAAvB,CAA4BV,KAA5B,CAAL,EAAyC;IAC9C,KAAKT,KAAL,CAAY,IAAGS,KAAM,GAArB;EACD,CAFM,MAEA;IACL,MAAM,IAAIW,KAAJ,CACJ,sEACE,2CAFE,CAAN;EAID;AACF;;AAEM,SAASC,oBAAT,CAELjC,IAFK,EAGL;EACA,KAAKY,KAAL,CAAY,KAAIZ,IAAI,CAACqB,KAAM,IAA3B,EAAgC,IAAhC;AACD;;AAEM,SAASa,WAAT,CAAoClC,IAApC,EAAyD;EAC9D,KAAKY,KAAL,CAAW,IAAX;EACA,KAAKV,KAAL,CAAWF,IAAI,CAACmC,IAAhB;EACA,KAAKvB,KAAL,CAAW,IAAX;;EAEA,IAAIZ,IAAI,CAACoC,YAAL,KAAsB,WAA1B,EAAuC;IACrC,KAAKd,SAAL;EACD;AACF"} \ No newline at end of file +{"version":3,"names":["File","node","program","print","interpreter","Program","noIndentInnerCommentsHere","printInnerComments","directivesLen","directives","length","newline","body","printSequence","trailingCommentsLineOffset","trailingComments","BlockStatement","token","indent","sourceWithOffset","loc","rightBrace","Directive","value","semicolon","unescapedSingleQuoteRE","unescapedDoubleQuoteRE","DirectiveLiteral","raw","getPossibleRaw","format","minified","undefined","test","Error","InterpreterDirective","Placeholder","name","expectedNode"],"sources":["../../src/generators/base.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport type * as t from \"@babel/types\";\n\nexport function File(this: Printer, node: t.File) {\n if (node.program) {\n // Print this here to ensure that Program node 'leadingComments' still\n // get printed after the hashbang.\n this.print(node.program.interpreter, node);\n }\n\n this.print(node.program, node);\n}\n\nexport function Program(this: Printer, node: t.Program) {\n // An empty Program doesn't have any inner tokens, so\n // we must explicitly print its inner comments.\n this.noIndentInnerCommentsHere();\n this.printInnerComments();\n\n const directivesLen = node.directives?.length;\n if (directivesLen) {\n const newline = node.body.length ? 2 : 1;\n this.printSequence(node.directives, node, {\n trailingCommentsLineOffset: newline,\n });\n if (!node.directives[directivesLen - 1].trailingComments?.length) {\n this.newline(newline);\n }\n }\n\n this.printSequence(node.body, node);\n}\n\nexport function BlockStatement(this: Printer, node: t.BlockStatement) {\n this.token(\"{\");\n\n const directivesLen = node.directives?.length;\n if (directivesLen) {\n const newline = node.body.length ? 2 : 1;\n this.printSequence(node.directives, node, {\n indent: true,\n trailingCommentsLineOffset: newline,\n });\n if (!node.directives[directivesLen - 1].trailingComments?.length) {\n this.newline(newline);\n }\n }\n\n this.printSequence(node.body, node, { indent: true });\n\n this.sourceWithOffset(\"end\", node.loc, 0, -1);\n\n this.rightBrace();\n}\n\nexport function Directive(this: Printer, node: t.Directive) {\n this.print(node.value, node);\n this.semicolon();\n}\n\n// These regexes match an even number of \\ followed by a quote\nconst unescapedSingleQuoteRE = /(?:^|[^\\\\])(?:\\\\\\\\)*'/;\nconst unescapedDoubleQuoteRE = /(?:^|[^\\\\])(?:\\\\\\\\)*\"/;\n\nexport function DirectiveLiteral(this: Printer, node: t.DirectiveLiteral) {\n const raw = this.getPossibleRaw(node);\n if (!this.format.minified && raw !== undefined) {\n this.token(raw);\n return;\n }\n\n const { value } = node;\n\n // NOTE: In directives we can't change escapings,\n // because they change the behavior.\n // e.g. \"us\\x65 strict\" (\\x65 is e) is not a \"use strict\" directive.\n\n if (!unescapedDoubleQuoteRE.test(value)) {\n this.token(`\"${value}\"`);\n } else if (!unescapedSingleQuoteRE.test(value)) {\n this.token(`'${value}'`);\n } else {\n throw new Error(\n \"Malformed AST: it is not possible to print a directive containing\" +\n \" both unescaped single and double quotes.\",\n );\n }\n}\n\nexport function InterpreterDirective(\n this: Printer,\n node: t.InterpreterDirective,\n) {\n this.token(`#!${node.value}`);\n this.newline(1, true);\n}\n\nexport function Placeholder(this: Printer, node: t.Placeholder) {\n this.token(\"%%\");\n this.print(node.name);\n this.token(\"%%\");\n\n if (node.expectedNode === \"Statement\") {\n this.semicolon();\n }\n}\n"],"mappings":";;;;;;;;;;;;AAGO,SAASA,IAAI,CAAgBC,IAAY,EAAE;EAChD,IAAIA,IAAI,CAACC,OAAO,EAAE;IAGhB,IAAI,CAACC,KAAK,CAACF,IAAI,CAACC,OAAO,CAACE,WAAW,EAAEH,IAAI,CAAC;EAC5C;EAEA,IAAI,CAACE,KAAK,CAACF,IAAI,CAACC,OAAO,EAAED,IAAI,CAAC;AAChC;AAEO,SAASI,OAAO,CAAgBJ,IAAe,EAAE;EAAA;EAGtD,IAAI,CAACK,yBAAyB,EAAE;EAChC,IAAI,CAACC,kBAAkB,EAAE;EAEzB,MAAMC,aAAa,uBAAGP,IAAI,CAACQ,UAAU,qBAAf,iBAAiBC,MAAM;EAC7C,IAAIF,aAAa,EAAE;IAAA;IACjB,MAAMG,OAAO,GAAGV,IAAI,CAACW,IAAI,CAACF,MAAM,GAAG,CAAC,GAAG,CAAC;IACxC,IAAI,CAACG,aAAa,CAACZ,IAAI,CAACQ,UAAU,EAAER,IAAI,EAAE;MACxCa,0BAA0B,EAAEH;IAC9B,CAAC,CAAC;IACF,IAAI,2BAACV,IAAI,CAACQ,UAAU,CAACD,aAAa,GAAG,CAAC,CAAC,CAACO,gBAAgB,aAAnD,sBAAqDL,MAAM,GAAE;MAChE,IAAI,CAACC,OAAO,CAACA,OAAO,CAAC;IACvB;EACF;EAEA,IAAI,CAACE,aAAa,CAACZ,IAAI,CAACW,IAAI,EAAEX,IAAI,CAAC;AACrC;AAEO,SAASe,cAAc,CAAgBf,IAAsB,EAAE;EAAA;EACpE,IAAI,CAACgB,SAAK,KAAK;EAEf,MAAMT,aAAa,wBAAGP,IAAI,CAACQ,UAAU,qBAAf,kBAAiBC,MAAM;EAC7C,IAAIF,aAAa,EAAE;IAAA;IACjB,MAAMG,OA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AAM,GAAE,CAAC;EAC1B,CAAC,MAAM,IAAI,CAACE,sBAAsB,CAACQ,IAAI,CAACV,KAAK,CAAC,EAAE;IAC9C,IAAI,CAACN,KAAK,CAAE,IAAGM,KAAM,GAAE,CAAC;EAC1B,CAAC,MAAM;IACL,MAAM,IAAIW,KAAK,CACb,mEAAmE,GACjE,2CAA2C,CAC9C;EACH;AACF;AAEO,SAASC,oBAAoB,CAElClC,IAA4B,EAC5B;EACA,IAAI,CAACgB,KAAK,CAAE,KAAIhB,IAAI,CAACsB,KAAM,EAAC,CAAC;EAC7B,IAAI,CAACZ,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC;AACvB;AAEO,SAASyB,WAAW,CAAgBnC,IAAmB,EAAE;EAC9D,IAAI,CAACgB,KAAK,CAAC,IAAI,CAAC;EAChB,IAAI,CAACd,KAAK,CAACF,IAAI,CAACoC,IAAI,CAAC;EACrB,IAAI,CAACpB,KAAK,CAAC,IAAI,CAAC;EAEhB,IAAIhB,IAAI,CAACqC,YAAY,KAAK,WAAW,EAAE;IACrC,IAAI,CAACd,SAAS,EAAE;EAClB;AACF"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/classes.js b/node_modules/@babel/generator/lib/generators/classes.js index f6773a0cc..bd8f780d6 100644 --- a/node_modules/@babel/generator/lib/generators/classes.js +++ b/node_modules/@babel/generator/lib/generators/classes.js @@ -12,41 +12,31 @@ exports.ClassPrivateProperty = ClassPrivateProperty; exports.ClassProperty = ClassProperty; exports.StaticBlock = StaticBlock; exports._classMethodHead = _classMethodHead; - var _t = require("@babel/types"); - const { isExportDefaultDeclaration, isExportNamedDeclaration } = _t; - function ClassDeclaration(node, parent) { { if (!this.format.decoratorsBeforeExport || !isExportDefaultDeclaration(parent) && !isExportNamedDeclaration(parent)) { this.printJoin(node.decorators, node); } } - if (node.declare) { this.word("declare"); this.space(); } - if (node.abstract) { this.word("abstract"); this.space(); } - this.word("class"); - this.printInnerComments(node); - if (node.id) { this.space(); this.print(node.id, node); } - this.print(node.typeParameters, node); - if (node.superClass) { this.space(); this.word("extends"); @@ -54,22 +44,17 @@ function ClassDeclaration(node, parent) { this.print(node.superClass, node); this.print(node.superTypeParameters, node); } - if (node.implements) { this.space(); this.word("implements"); this.space(); this.printList(node.implements, node); } - this.space(); this.print(node.body, node); } - function ClassBody(node) { this.tokenChar(123); - this.printInnerComments(node); - if (node.body.length === 0) { this.tokenChar(125); } else { @@ -78,131 +63,114 @@ function ClassBody(node) { this.printSequence(node.body, node); this.dedent(); if (!this.endsWith(10)) this.newline(); + this.sourceWithOffset("end", node.loc, 0, -1); this.rightBrace(); } } - function ClassProperty(node) { + var _node$key$loc, _node$key$loc$end; this.printJoin(node.decorators, node); - this.source("end", node.key.loc); - this.tsPrintClassMemberModifiers(node); + const endLine = (_node$key$loc = node.key.loc) == null ? void 0 : (_node$key$loc$end = _node$key$loc.end) == null ? void 0 : _node$key$loc$end.line; + if (endLine) this.catchUp(endLine); + this.tsPrintClassMemberModifiers(node); if (node.computed) { this.tokenChar(91); this.print(node.key, node); this.tokenChar(93); } else { this._variance(node); - this.print(node.key, node); } if (node.optional) { this.tokenChar(63); } - if (node.definite) { this.tokenChar(33); } - this.print(node.typeAnnotation, node); - if (node.value) { this.space(); this.tokenChar(61); this.space(); this.print(node.value, node); } - this.semicolon(); } - function ClassAccessorProperty(node) { + var _node$key$loc2, _node$key$loc2$end; this.printJoin(node.decorators, node); - this.source("end", node.key.loc); + + const endLine = (_node$key$loc2 = node.key.loc) == null ? void 0 : (_node$key$loc2$end = _node$key$loc2.end) == null ? void 0 : _node$key$loc2$end.line; + if (endLine) this.catchUp(endLine); + this.tsPrintClassMemberModifiers(node); - this.word("accessor"); - this.printInnerComments(node); + this.word("accessor", true); this.space(); - if (node.computed) { this.tokenChar(91); this.print(node.key, node); this.tokenChar(93); } else { this._variance(node); - this.print(node.key, node); } if (node.optional) { this.tokenChar(63); } - if (node.definite) { this.tokenChar(33); } - this.print(node.typeAnnotation, node); - if (node.value) { this.space(); this.tokenChar(61); this.space(); this.print(node.value, node); } - this.semicolon(); } - function ClassPrivateProperty(node) { this.printJoin(node.decorators, node); - if (node.static) { this.word("static"); this.space(); } - this.print(node.key, node); this.print(node.typeAnnotation, node); - if (node.value) { this.space(); this.tokenChar(61); this.space(); this.print(node.value, node); } - this.semicolon(); } - function ClassMethod(node) { this._classMethodHead(node); - this.space(); this.print(node.body, node); } - function ClassPrivateMethod(node) { this._classMethodHead(node); - this.space(); this.print(node.body, node); } - function _classMethodHead(node) { + var _node$key$loc3, _node$key$loc3$end; this.printJoin(node.decorators, node); - this.source("end", node.key.loc); - this.tsPrintClassMemberModifiers(node); + const endLine = (_node$key$loc3 = node.key.loc) == null ? void 0 : (_node$key$loc3$end = _node$key$loc3.end) == null ? void 0 : _node$key$loc3$end.line; + if (endLine) this.catchUp(endLine); + this.tsPrintClassMemberModifiers(node); this._methodHead(node); } - function StaticBlock(node) { this.word("static"); this.space(); this.tokenChar(123); - if (node.body.length === 0) { this.tokenChar(125); } else { @@ -210,6 +178,7 @@ function StaticBlock(node) { this.printSequence(node.body, node, { indent: true }); + this.sourceWithOffset("end", node.loc, 0, -1); this.rightBrace(); } } diff --git a/node_modules/@babel/generator/lib/generators/classes.js.map b/node_modules/@babel/generator/lib/generators/classes.js.map index 6771af4ac..990bd3a9c 100644 --- a/node_modules/@babel/generator/lib/generators/classes.js.map +++ b/node_modules/@babel/generator/lib/generators/classes.js.map @@ -1 +1 @@ -{"version":3,"names":["isExportDefaultDeclaration","isExportNamedDeclaration","ClassDeclaration","node","parent","format","decoratorsBeforeExport","printJoin","decorators","declare","word","space","abstract","printInnerComments","id","print","typeParameters","superClass","superTypeParameters","implements","printList","body","ClassBody","token","length","newline","indent","printSequence","dedent","endsWith","rightBrace","ClassProperty","source","key","loc","tsPrintClassMemberModifiers","computed","_variance","optional","definite","typeAnnotation","value","semicolon","ClassAccessorProperty","ClassPrivateProperty","static","ClassMethod","_classMethodHead","ClassPrivateMethod","_methodHead","StaticBlock"],"sources":["../../src/generators/classes.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport {\n isExportDefaultDeclaration,\n isExportNamedDeclaration,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport * as charCodes from \"charcodes\";\n\nexport function ClassDeclaration(\n this: Printer,\n node: t.ClassDeclaration,\n parent: t.Node,\n) {\n if (process.env.BABEL_8_BREAKING) {\n this.printJoin(node.decorators, node);\n } else {\n if (\n !this.format.decoratorsBeforeExport ||\n (!isExportDefaultDeclaration(parent) && !isExportNamedDeclaration(parent))\n ) {\n this.printJoin(node.decorators, node);\n }\n }\n\n if (node.declare) {\n // TS\n this.word(\"declare\");\n this.space();\n }\n\n if (node.abstract) {\n // TS\n this.word(\"abstract\");\n this.space();\n }\n\n this.word(\"class\");\n this.printInnerComments(node);\n\n if (node.id) {\n this.space();\n this.print(node.id, node);\n }\n\n this.print(node.typeParameters, node);\n\n if (node.superClass) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.print(node.superClass, node);\n this.print(node.superTypeParameters, node);\n }\n\n if (node.implements) {\n this.space();\n this.word(\"implements\");\n this.space();\n this.printList(node.implements, node);\n }\n\n this.space();\n this.print(node.body, node);\n}\n\nexport { ClassDeclaration as ClassExpression };\n\nexport function ClassBody(this: Printer, node: t.ClassBody) {\n this.token(\"{\");\n this.printInnerComments(node);\n if (node.body.length === 0) {\n this.token(\"}\");\n } else {\n this.newline();\n\n this.indent();\n this.printSequence(node.body, node);\n this.dedent();\n\n if (!this.endsWith(charCodes.lineFeed)) this.newline();\n\n this.rightBrace();\n }\n}\n\nexport function ClassProperty(this: Printer, node: t.ClassProperty) {\n this.printJoin(node.decorators, node);\n\n // catch up to property key, avoid line break\n // between member modifiers and the property key.\n this.source(\"end\", node.key.loc);\n\n this.tsPrintClassMemberModifiers(node);\n\n if (node.computed) {\n this.token(\"[\");\n this.print(node.key, node);\n this.token(\"]\");\n } else {\n this._variance(node);\n this.print(node.key, node);\n }\n\n // TS\n if (node.optional) {\n this.token(\"?\");\n }\n if (node.definite) {\n this.token(\"!\");\n }\n\n this.print(node.typeAnnotation, node);\n if (node.value) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.value, node);\n }\n this.semicolon();\n}\n\nexport function ClassAccessorProperty(\n this: Printer,\n node: t.ClassAccessorProperty,\n) {\n this.printJoin(node.decorators, node);\n\n // catch up to property key, avoid line break\n // between member modifiers and the property key.\n this.source(\"end\", node.key.loc);\n\n // TS does not support class accessor property yet\n this.tsPrintClassMemberModifiers(node);\n\n this.word(\"accessor\");\n this.printInnerComments(node);\n this.space();\n\n if (node.computed) {\n this.token(\"[\");\n this.print(node.key, node);\n this.token(\"]\");\n } else {\n // Todo: Flow does not support class accessor property yet.\n this._variance(node);\n this.print(node.key, node);\n }\n\n // TS\n if (node.optional) {\n this.token(\"?\");\n }\n if (node.definite) {\n this.token(\"!\");\n }\n\n this.print(node.typeAnnotation, node);\n if (node.value) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.value, node);\n }\n this.semicolon();\n}\n\nexport function ClassPrivateProperty(\n this: Printer,\n node: t.ClassPrivateProperty,\n) {\n this.printJoin(node.decorators, node);\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n this.print(node.key, node);\n this.print(node.typeAnnotation, node);\n if (node.value) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.value, node);\n }\n this.semicolon();\n}\n\nexport function ClassMethod(this: Printer, node: t.ClassMethod) {\n this._classMethodHead(node);\n this.space();\n this.print(node.body, node);\n}\n\nexport function ClassPrivateMethod(this: Printer, node: t.ClassPrivateMethod) {\n this._classMethodHead(node);\n this.space();\n this.print(node.body, node);\n}\n\nexport function _classMethodHead(\n this: Printer,\n node: t.ClassMethod | t.ClassPrivateMethod | t.TSDeclareMethod,\n) {\n this.printJoin(node.decorators, node);\n // catch up to method key, avoid line break\n // between member modifiers/method heads and the method key.\n this.source(\"end\", node.key.loc);\n this.tsPrintClassMemberModifiers(node);\n this._methodHead(node);\n}\n\nexport function StaticBlock(this: Printer, node: t.StaticBlock) {\n this.word(\"static\");\n this.space();\n this.token(\"{\");\n if (node.body.length === 0) {\n this.token(\"}\");\n } else {\n this.newline();\n this.printSequence(node.body, node, {\n indent: true,\n });\n this.rightBrace();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AACA;;;EACEA,0B;EACAC;;;AAKK,SAASC,gBAAT,CAELC,IAFK,EAGLC,MAHK,EAIL;EAGO;IACL,IACE,CAAC,KAAKC,MAAL,CAAYC,sBAAb,IACC,CAACN,0BAA0B,CAACI,MAAD,CAA3B,IAAuC,CAACH,wBAAwB,CAACG,MAAD,CAFnE,EAGE;MACA,KAAKG,SAAL,CAAeJ,IAAI,CAACK,UAApB,EAAgCL,IAAhC;IACD;EACF;;EAED,IAAIA,IAAI,CAACM,OAAT,EAAkB;IAEhB,KAAKC,IAAL,CAAU,SAAV;IACA,KAAKC,KAAL;EACD;;EAED,IAAIR,IAAI,CAACS,QAAT,EAAmB;IAEjB,KAAKF,IAAL,CAAU,UAAV;IACA,KAAKC,KAAL;EACD;;EAED,KAAKD,IAAL,CAAU,OAAV;EACA,KAAKG,kBAAL,CAAwBV,IAAxB;;EAEA,IAAIA,IAAI,CAACW,EAAT,EAAa;IACX,KAAKH,KAAL;IACA,KAAKI,KAAL,CAAWZ,IAAI,CAACW,EAAhB,EAAoBX,IAApB;EACD;;EAED,KAAKY,KAAL,CAAWZ,IAAI,CAACa,cAAhB,EAAgCb,IAAhC;;EAEA,IAAIA,IAAI,CAACc,UAAT,EAAqB;IACnB,KAAKN,KAAL;IACA,KAAKD,IAAL,CAAU,SAAV;IACA,KAAKC,KAAL;IACA,KAAKI,KAAL,CAAWZ,IAAI,CAACc,UAAhB,EAA4Bd,IAA5B;IACA,KAAKY,KAAL,CAAWZ,IAAI,CAACe,mBAAhB,EAAqCf,IAArC;EACD;;EAED,IAAIA,IAAI,CAACgB,UAAT,EAAqB;IACnB,KAAKR,KAAL;IACA,KAAKD,IAAL,C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AAzB,EAA4B;IAC1B,KAAKD,SAAL;EACD,CAFD,MAEO;IACL,KAAKE,OAAL;IACA,KAAKE,aAAL,CAAmBxB,IAAI,CAACkB,IAAxB,EAA8BlB,IAA9B,EAAoC;MAClCuB,MAAM,EAAE;IAD0B,CAApC;IAGA,KAAKI,UAAL;EACD;AACF"} \ No newline at end of file +{"version":3,"names":["isExportDefaultDeclaration","isExportNamedDeclaration","ClassDeclaration","node","parent","format","decoratorsBeforeExport","printJoin","decorators","declare","word","space","abstract","id","print","typeParameters","superClass","superTypeParameters","implements","printList","body","ClassBody","token","length","newline","indent","printSequence","dedent","endsWith","sourceWithOffset","loc","rightBrace","ClassProperty","endLine","key","end","line","catchUp","tsPrintClassMemberModifiers","computed","_variance","optional","definite","typeAnnotation","value","semicolon","ClassAccessorProperty","ClassPrivateProperty","static","ClassMethod","_classMethodHead","ClassPrivateMethod","_methodHead","StaticBlock"],"sources":["../../src/generators/classes.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport {\n isExportDefaultDeclaration,\n isExportNamedDeclaration,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport * as charCodes from \"charcodes\";\n\nexport function ClassDeclaration(\n this: Printer,\n node: t.ClassDeclaration,\n parent: t.Node,\n) {\n if (process.env.BABEL_8_BREAKING) {\n this.printJoin(node.decorators, node);\n } else {\n if (\n !this.format.decoratorsBeforeExport ||\n (!isExportDefaultDeclaration(parent) && !isExportNamedDeclaration(parent))\n ) {\n this.printJoin(node.decorators, node);\n }\n }\n\n if (node.declare) {\n // TS\n this.word(\"declare\");\n this.space();\n }\n\n if (node.abstract) {\n // TS\n this.word(\"abstract\");\n this.space();\n }\n\n this.word(\"class\");\n\n if (node.id) {\n this.space();\n this.print(node.id, node);\n }\n\n this.print(node.typeParameters, node);\n\n if (node.superClass) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.print(node.superClass, node);\n this.print(node.superTypeParameters, node);\n }\n\n if (node.implements) {\n this.space();\n this.word(\"implements\");\n this.space();\n this.printList(node.implements, node);\n }\n\n this.space();\n this.print(node.body, node);\n}\n\nexport { ClassDeclaration as ClassExpression };\n\nexport function ClassBody(this: Printer, node: t.ClassBody) {\n this.token(\"{\");\n if (node.body.length === 0) {\n this.token(\"}\");\n } else {\n this.newline();\n\n this.indent();\n this.printSequence(node.body, node);\n this.dedent();\n\n if (!this.endsWith(charCodes.lineFeed)) this.newline();\n\n this.sourceWithOffset(\"end\", node.loc, 0, -1);\n\n this.rightBrace();\n }\n}\n\nexport function ClassProperty(this: Printer, node: t.ClassProperty) {\n this.printJoin(node.decorators, node);\n\n // catch up to property key, avoid line break\n // between member modifiers and the property key.\n const endLine = node.key.loc?.end?.line;\n if (endLine) this.catchUp(endLine);\n\n this.tsPrintClassMemberModifiers(node);\n\n if (node.computed) {\n this.token(\"[\");\n this.print(node.key, node);\n this.token(\"]\");\n } else {\n this._variance(node);\n this.print(node.key, node);\n }\n\n // TS\n if (node.optional) {\n this.token(\"?\");\n }\n if (node.definite) {\n this.token(\"!\");\n }\n\n this.print(node.typeAnnotation, node);\n if (node.value) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.value, node);\n }\n this.semicolon();\n}\n\nexport function ClassAccessorProperty(\n this: Printer,\n node: t.ClassAccessorProperty,\n) {\n this.printJoin(node.decorators, node);\n\n // catch up to property key, avoid line break\n // between member modifiers and the property key.\n const endLine = node.key.loc?.end?.line;\n if (endLine) this.catchUp(endLine);\n\n // TS does not support class accessor property yet\n this.tsPrintClassMemberModifiers(node);\n\n this.word(\"accessor\", true);\n this.space();\n\n if (node.computed) {\n this.token(\"[\");\n this.print(node.key, node);\n this.token(\"]\");\n } else {\n // Todo: Flow does not support class accessor property yet.\n this._variance(node);\n this.print(node.key, node);\n }\n\n // TS\n if (node.optional) {\n this.token(\"?\");\n }\n if (node.definite) {\n this.token(\"!\");\n }\n\n this.print(node.typeAnnotation, node);\n if (node.value) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.value, node);\n }\n this.semicolon();\n}\n\nexport function ClassPrivateProperty(\n this: Printer,\n node: t.ClassPrivateProperty,\n) {\n this.printJoin(node.decorators, node);\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n this.print(node.key, node);\n this.print(node.typeAnnotation, node);\n if (node.value) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.value, node);\n }\n this.semicolon();\n}\n\nexport function ClassMethod(this: Printer, node: t.ClassMethod) {\n this._classMethodHead(node);\n this.space();\n this.print(node.body, node);\n}\n\nexport function ClassPrivateMethod(this: Printer, node: t.ClassPrivateMethod) {\n this._classMethodHead(node);\n this.space();\n this.print(node.body, node);\n}\n\nexport function _classMethodHead(\n this: Printer,\n node: t.ClassMethod | t.ClassPrivateMethod | t.TSDeclareMethod,\n) {\n this.printJoin(node.decorators, node);\n\n // catch up to method key, avoid line break\n // between member modifiers/method heads and the method key.\n const endLine = node.key.loc?.end?.line;\n if (endLine) this.catchUp(endLine);\n\n this.tsPrintClassMemberModifiers(node);\n this._methodHead(node);\n}\n\nexport function StaticBlock(this: Printer, node: t.StaticBlock) {\n this.word(\"static\");\n this.space();\n this.token(\"{\");\n if (node.body.length === 0) {\n this.token(\"}\");\n } else {\n this.newline();\n this.printSequence(node.body, node, {\n indent: true,\n });\n\n this.sourceWithOffset(\"end\", node.loc, 0, -1);\n\n this.rightBrace();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AACA;AAGsB;EAFpBA,0BAA0B;EAC1BC;AAAwB;AAKnB,SAASC,gBAAgB,CAE9BC,IAAwB,EACxBC,MAAc,EACd;EAGO;IACL,IACE,CAAC,IAAI,CAACC,MAAM,CAACC,sBAAsB,IAClC,CAACN,0BAA0B,CAACI,MAAM,CAAC,IAAI,CAACH,wBAAwB,CAACG,MAAM,CAAE,EAC1E;MACA,IAAI,CAACG,SAAS,CAACJ,IAAI,CAACK,UAAU,EAAEL,IAAI,CAAC;IACvC;EACF;EAEA,IAAIA,IAAI,CAACM,OAAO,EAAE;IAEhB,IAA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IAAI,CAAC;AAC7B;AAEO,SAAS+C,gBAAgB,CAE9B/C,IAA8D,EAC9D;EAAA;EACA,IAAI,CAACI,SAAS,CAACJ,IAAI,CAACK,UAAU,EAAEL,IAAI,CAAC;;EAIrC,MAAM8B,OAAO,qBAAG9B,IAAI,CAAC+B,GAAG,CAACJ,GAAG,2CAAZ,eAAcK,GAAG,qBAAjB,mBAAmBC,IAAI;EACvC,IAAIH,OAAO,EAAE,IAAI,CAACI,OAAO,CAACJ,OAAO,CAAC;EAElC,IAAI,CAACK,2BAA2B,CAACnC,IAAI,CAAC;EACtC,IAAI,CAACiD,WAAW,CAACjD,IAAI,CAAC;AACxB;AAEO,SAASkD,WAAW,CAAgBlD,IAAmB,EAAE;EAC9D,IAAI,CAACO,IAAI,CAAC,QAAQ,CAAC;EACnB,IAAI,CAACC,KAAK,EAAE;EACZ,IAAI,CAACW,SAAK,KAAK;EACf,IAAInB,IAAI,CAACiB,IAAI,CAACG,MAAM,KAAK,CAAC,EAAE;IAC1B,IAAI,CAACD,SAAK,KAAK;EACjB,CAAC,MAAM;IACL,IAAI,CAACE,OAAO,EAAE;IACd,IAAI,CAACE,aAAa,CAACvB,IAAI,CAACiB,IAAI,EAAEjB,IAAI,EAAE;MAClCsB,MAAM,EAAE;IACV,CAAC,CAAC;IAEF,IAAI,CAACI,gBAAgB,CAAC,KAAK,EAAE1B,IAAI,CAAC2B,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAE7C,IAAI,CAACC,UAAU,EAAE;EACnB;AACF"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/expressions.js b/node_modules/@babel/generator/lib/generators/expressions.js index 9610468f9..f35a28914 100644 --- a/node_modules/@babel/generator/lib/generators/expressions.js +++ b/node_modules/@babel/generator/lib/generators/expressions.js @@ -29,46 +29,38 @@ exports.UnaryExpression = UnaryExpression; exports.UpdateExpression = UpdateExpression; exports.V8IntrinsicIdentifier = V8IntrinsicIdentifier; exports.YieldExpression = YieldExpression; - var _t = require("@babel/types"); - var n = require("../node"); - const { isCallExpression, isLiteral, isMemberExpression, isNewExpression } = _t; - function UnaryExpression(node) { - if (node.operator === "void" || node.operator === "delete" || node.operator === "typeof" || node.operator === "throw") { + if (node.operator === "void" || node.operator === "delete" || node.operator === "typeof" || + node.operator === "throw") { this.word(node.operator); this.space(); } else { this.token(node.operator); } - this.print(node.argument, node); } - function DoExpression(node) { if (node.async) { - this.word("async"); + this.word("async", true); this.space(); } - this.word("do"); this.space(); this.print(node.body, node); } - function ParenthesizedExpression(node) { this.tokenChar(40); this.print(node.expression, node); this.tokenChar(41); } - function UpdateExpression(node) { if (node.prefix) { this.token(node.operator); @@ -78,7 +70,6 @@ function UpdateExpression(node) { this.token(node.operator); } } - function ConditionalExpression(node) { this.print(node.test, node); this.space(); @@ -90,69 +81,55 @@ function ConditionalExpression(node) { this.space(); this.print(node.alternate, node); } - function NewExpression(node, parent) { this.word("new"); this.space(); this.print(node.callee, node); - if (this.format.minified && node.arguments.length === 0 && !node.optional && !isCallExpression(parent, { callee: node }) && !isMemberExpression(parent) && !isNewExpression(parent)) { return; } - this.print(node.typeArguments, node); this.print(node.typeParameters, node); if (node.optional) { this.token("?."); } - this.tokenChar(40); this.printList(node.arguments, node); this.tokenChar(41); } - function SequenceExpression(node) { this.printList(node.expressions, node); } - function ThisExpression() { this.word("this"); } - function Super() { this.word("super"); } - function isDecoratorMemberExpression(node) { switch (node.type) { case "Identifier": return true; - case "MemberExpression": return !node.computed && node.property.type === "Identifier" && isDecoratorMemberExpression(node.object); - default: return false; } } - function shouldParenthesizeDecoratorExpression(node) { if (node.type === "ParenthesizedExpression") { return false; } - return !isDecoratorMemberExpression(node.type === "CallExpression" ? node.callee : node); } - function Decorator(node) { this.tokenChar(64); const { expression } = node; - if (shouldParenthesizeDecoratorExpression(expression)) { this.tokenChar(40); this.print(expression, node); @@ -160,27 +137,20 @@ function Decorator(node) { } else { this.print(expression, node); } - this.newline(); } - function OptionalMemberExpression(node) { this.print(node.object, node); - if (!node.computed && isMemberExpression(node.property)) { throw new TypeError("Got a MemberExpression for MemberExpression property"); } - let computed = node.computed; - if (isLiteral(node.property) && typeof node.property.value === "number") { computed = true; } - if (node.optional) { this.token("?."); } - if (computed) { this.tokenChar(91); this.print(node.property, node); @@ -189,11 +159,9 @@ function OptionalMemberExpression(node) { if (!node.optional) { this.tokenChar(46); } - this.print(node.property, node); } } - function OptionalCallExpression(node) { this.print(node.callee, node); this.print(node.typeParameters, node); @@ -201,13 +169,12 @@ function OptionalCallExpression(node) { if (node.optional) { this.token("?."); } - this.print(node.typeArguments, node); + this.tokenChar(40); this.printList(node.arguments, node); this.tokenChar(41); } - function CallExpression(node) { this.print(node.callee, node); this.print(node.typeArguments, node); @@ -216,33 +183,31 @@ function CallExpression(node) { this.printList(node.arguments, node); this.tokenChar(41); } - function Import() { this.word("import"); } - function AwaitExpression(node) { this.word("await"); - if (node.argument) { this.space(); this.printTerminatorless(node.argument, node, false); } } - function YieldExpression(node) { - this.word("yield"); - + this.word("yield", true); if (node.delegate) { this.tokenChar(42); - } - - if (node.argument) { - this.space(); - this.printTerminatorless(node.argument, node, false); + if (node.argument) { + this.space(); + this.print(node.argument, node); + } + } else { + if (node.argument) { + this.space(); + this.printTerminatorless(node.argument, node, false); + } } } - function EmptyStatement() { this.semicolon(true); } @@ -251,7 +216,6 @@ function ExpressionStatement(node) { this.print(node.expression, node); this.semicolon(); } - function AssignmentPattern(node) { this.print(node.left, node); if (node.left.optional) this.tokenChar(63); @@ -261,50 +225,38 @@ function AssignmentPattern(node) { this.space(); this.print(node.right, node); } - function AssignmentExpression(node, parent) { const parens = this.inForStatementInitCounter && node.operator === "in" && !n.needsParens(node, parent); - if (parens) { this.tokenChar(40); } - this.print(node.left, node); this.space(); - if (node.operator === "in" || node.operator === "instanceof") { this.word(node.operator); } else { this.token(node.operator); } - this.space(); this.print(node.right, node); - if (parens) { this.tokenChar(41); } } - function BindExpression(node) { this.print(node.object, node); this.token("::"); this.print(node.callee, node); } - function MemberExpression(node) { this.print(node.object, node); - if (!node.computed && isMemberExpression(node.property)) { throw new TypeError("Got a MemberExpression for MemberExpression property"); } - let computed = node.computed; - if (isLiteral(node.property) && typeof node.property.value === "number") { computed = true; } - if (computed) { this.tokenChar(91); this.print(node.property, node); @@ -314,37 +266,34 @@ function MemberExpression(node) { this.print(node.property, node); } } - function MetaProperty(node) { this.print(node.meta, node); this.tokenChar(46); this.print(node.property, node); } - function PrivateName(node) { this.tokenChar(35); this.print(node.id, node); } - function V8IntrinsicIdentifier(node) { this.tokenChar(37); this.word(node.name); } - function ModuleExpression(node) { - this.word("module"); + this.word("module", true); this.space(); this.tokenChar(123); - - if (node.body.body.length === 0) { - this.tokenChar(125); - } else { + this.indent(); + const { + body + } = node; + if (body.body.length || body.directives.length) { this.newline(); - this.printSequence(node.body.body, node, { - indent: true - }); - this.rightBrace(); } + this.print(body, node); + this.dedent(); + this.sourceWithOffset("end", node.loc, 0, -1); + this.rightBrace(); } //# sourceMappingURL=expressions.js.map diff --git a/node_modules/@babel/generator/lib/generators/expressions.js.map b/node_modules/@babel/generator/lib/generators/expressions.js.map index 3a95d11e5..abdac34d7 100644 --- a/node_modules/@babel/generator/lib/generators/expressions.js.map +++ b/node_modules/@babel/generator/lib/generators/expressions.js.map @@ -1 +1 @@ -{"version":3,"names":["isCallExpression","isLiteral","isMemberExpression","isNewExpression","UnaryExpression","node","operator","word","space","token","print","argument","DoExpression","async","body","ParenthesizedExpression","expression","UpdateExpression","prefix","printTerminatorless","ConditionalExpression","test","consequent","alternate","NewExpression","parent","callee","format","minified","arguments","length","optional","typeArguments","typeParameters","printList","SequenceExpression","expressions","ThisExpression","Super","isDecoratorMemberExpression","type","computed","property","object","shouldParenthesizeDecoratorExpression","Decorator","newline","OptionalMemberExpression","TypeError","value","OptionalCallExpression","CallExpression","Import","AwaitExpression","YieldExpression","delegate","EmptyStatement","semicolon","ExpressionStatement","AssignmentPattern","left","typeAnnotation","right","AssignmentExpression","parens","inForStatementInitCounter","n","needsParens","BindExpression","MemberExpression","MetaProperty","meta","PrivateName","id","V8IntrinsicIdentifier","name","ModuleExpression","printSequence","indent","rightBrace"],"sources":["../../src/generators/expressions.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport {\n isCallExpression,\n isLiteral,\n isMemberExpression,\n isNewExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport * as n from \"../node\";\n\nexport function UnaryExpression(this: Printer, node: t.UnaryExpression) {\n if (\n node.operator === \"void\" ||\n node.operator === \"delete\" ||\n node.operator === \"typeof\" ||\n // throwExpressions\n node.operator === \"throw\"\n ) {\n this.word(node.operator);\n this.space();\n } else {\n this.token(node.operator);\n }\n\n this.print(node.argument, node);\n}\n\nexport function DoExpression(this: Printer, node: t.DoExpression) {\n if (node.async) {\n this.word(\"async\");\n this.space();\n }\n this.word(\"do\");\n this.space();\n this.print(node.body, node);\n}\n\nexport function ParenthesizedExpression(\n this: Printer,\n node: t.ParenthesizedExpression,\n) {\n this.token(\"(\");\n this.print(node.expression, node);\n this.token(\")\");\n}\n\nexport function UpdateExpression(this: Printer, node: t.UpdateExpression) {\n if (node.prefix) {\n this.token(node.operator);\n this.print(node.argument, node);\n } else {\n this.printTerminatorless(node.argument, node, true);\n this.token(node.operator);\n }\n}\n\nexport function ConditionalExpression(\n this: Printer,\n node: t.ConditionalExpression,\n) {\n this.print(node.test, node);\n this.space();\n this.token(\"?\");\n this.space();\n this.print(node.consequent, node);\n this.space();\n this.token(\":\");\n this.space();\n this.print(node.alternate, node);\n}\n\nexport function NewExpression(\n this: Printer,\n node: t.NewExpression,\n parent: t.Node,\n) {\n this.word(\"new\");\n this.space();\n this.print(node.callee, node);\n if (\n this.format.minified &&\n node.arguments.length === 0 &&\n !node.optional &&\n !isCallExpression(parent, { callee: node }) &&\n !isMemberExpression(parent) &&\n !isNewExpression(parent)\n ) {\n return;\n }\n\n this.print(node.typeArguments, node); // Flow\n this.print(node.typeParameters, node); // TS\n\n if (node.optional) {\n // TODO: This can never happen\n this.token(\"?.\");\n }\n this.token(\"(\");\n this.printList(node.arguments, node);\n this.token(\")\");\n}\n\nexport function SequenceExpression(this: Printer, node: t.SequenceExpression) {\n this.printList(node.expressions, node);\n}\n\nexport function ThisExpression(this: Printer) {\n this.word(\"this\");\n}\n\nexport function Super(this: Printer) {\n this.word(\"super\");\n}\n\nfunction isDecoratorMemberExpression(\n node: t.Expression | t.Super | t.V8IntrinsicIdentifier,\n): boolean {\n switch (node.type) {\n case \"Identifier\":\n return true;\n case \"MemberExpression\":\n return (\n !node.computed &&\n node.property.type === \"Identifier\" &&\n isDecoratorMemberExpression(node.object)\n );\n default:\n return false;\n }\n}\nfunction shouldParenthesizeDecoratorExpression(\n node: t.Expression | t.Super | t.V8IntrinsicIdentifier,\n) {\n if (node.type === \"ParenthesizedExpression\") {\n // We didn't check extra?.parenthesized here because we don't track decorators in needsParen\n return false;\n }\n return !isDecoratorMemberExpression(\n node.type === \"CallExpression\" ? node.callee : node,\n );\n}\n\nexport function Decorator(this: Printer, node: t.Decorator) {\n this.token(\"@\");\n const { expression } = node;\n if (shouldParenthesizeDecoratorExpression(expression)) {\n this.token(\"(\");\n this.print(expression, node);\n this.token(\")\");\n } else {\n this.print(expression, node);\n }\n this.newline();\n}\n\nexport function OptionalMemberExpression(\n this: Printer,\n node: t.OptionalMemberExpression,\n) {\n this.print(node.object, node);\n\n if (!node.computed && isMemberExpression(node.property)) {\n throw new TypeError(\"Got a MemberExpression for MemberExpression property\");\n }\n\n let computed = node.computed;\n // @ts-expect-error todo(flow->ts) maybe instead of typeof check specific literal types?\n if (isLiteral(node.property) && typeof node.property.value === \"number\") {\n computed = true;\n }\n if (node.optional) {\n this.token(\"?.\");\n }\n\n if (computed) {\n this.token(\"[\");\n this.print(node.property, node);\n this.token(\"]\");\n } else {\n if (!node.optional) {\n this.token(\".\");\n }\n this.print(node.property, node);\n }\n}\n\nexport function OptionalCallExpression(\n this: Printer,\n node: t.OptionalCallExpression,\n) {\n this.print(node.callee, node);\n\n this.print(node.typeParameters, node); // TS\n\n if (node.optional) {\n this.token(\"?.\");\n }\n\n this.print(node.typeArguments, node); // Flow\n\n this.token(\"(\");\n this.printList(node.arguments, node);\n this.token(\")\");\n}\n\nexport function CallExpression(this: Printer, node: t.CallExpression) {\n this.print(node.callee, node);\n\n this.print(node.typeArguments, node); // Flow\n this.print(node.typeParameters, node); // TS\n this.token(\"(\");\n this.printList(node.arguments, node);\n this.token(\")\");\n}\n\nexport function Import(this: Printer) {\n this.word(\"import\");\n}\n\nexport function AwaitExpression(this: Printer, node: t.AwaitExpression) {\n this.word(\"await\");\n\n if (node.argument) {\n this.space();\n this.printTerminatorless(node.argument, node, false);\n }\n}\n\nexport function YieldExpression(this: Printer, node: t.YieldExpression) {\n this.word(\"yield\");\n\n if (node.delegate) {\n this.token(\"*\");\n }\n\n if (node.argument) {\n this.space();\n this.printTerminatorless(node.argument, node, false);\n }\n}\n\nexport function EmptyStatement(this: Printer) {\n this.semicolon(true /* force */);\n}\n\nexport function ExpressionStatement(\n this: Printer,\n node: t.ExpressionStatement,\n) {\n this.print(node.expression, node);\n this.semicolon();\n}\n\nexport function AssignmentPattern(this: Printer, node: t.AssignmentPattern) {\n this.print(node.left, node);\n // @ts-expect-error todo(flow->ts) property present on some of the types in union but not all\n if (node.left.optional) this.token(\"?\");\n // @ts-expect-error todo(flow->ts) property present on some of the types in union but not all\n this.print(node.left.typeAnnotation, node);\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.right, node);\n}\n\nexport function AssignmentExpression(\n this: Printer,\n node: t.AssignmentExpression,\n parent: t.Node,\n) {\n // Somewhere inside a for statement `init` node but doesn't usually\n // needs a paren except for `in` expressions: `for (a in b ? a : b;;)`\n const parens =\n this.inForStatementInitCounter &&\n node.operator === \"in\" &&\n !n.needsParens(node, parent);\n\n if (parens) {\n this.token(\"(\");\n }\n\n this.print(node.left, node);\n\n this.space();\n if (node.operator === \"in\" || node.operator === \"instanceof\") {\n this.word(node.operator);\n } else {\n this.token(node.operator);\n }\n this.space();\n\n this.print(node.right, node);\n\n if (parens) {\n this.token(\")\");\n }\n}\n\nexport function BindExpression(this: Printer, node: t.BindExpression) {\n this.print(node.object, node);\n this.token(\"::\");\n this.print(node.callee, node);\n}\n\nexport {\n AssignmentExpression as BinaryExpression,\n AssignmentExpression as LogicalExpression,\n};\n\nexport function MemberExpression(this: Printer, node: t.MemberExpression) {\n this.print(node.object, node);\n\n if (!node.computed && isMemberExpression(node.property)) {\n throw new TypeError(\"Got a MemberExpression for MemberExpression property\");\n }\n\n let computed = node.computed;\n // @ts-expect-error todo(flow->ts) maybe use specific literal types\n if (isLiteral(node.property) && typeof node.property.value === \"number\") {\n computed = true;\n }\n\n if (computed) {\n this.token(\"[\");\n this.print(node.property, node);\n this.token(\"]\");\n } else {\n this.token(\".\");\n this.print(node.property, node);\n }\n}\n\nexport function MetaProperty(this: Printer, node: t.MetaProperty) {\n this.print(node.meta, node);\n this.token(\".\");\n this.print(node.property, node);\n}\n\nexport function PrivateName(this: Printer, node: t.PrivateName) {\n this.token(\"#\");\n this.print(node.id, node);\n}\n\nexport function V8IntrinsicIdentifier(\n this: Printer,\n node: t.V8IntrinsicIdentifier,\n) {\n this.token(\"%\");\n this.word(node.name);\n}\n\nexport function ModuleExpression(this: Printer, node: t.ModuleExpression) {\n this.word(\"module\");\n this.space();\n this.token(\"{\");\n if (node.body.body.length === 0) {\n this.token(\"}\");\n } else {\n this.newline();\n this.printSequence(node.body.body, node, { indent: true });\n this.rightBrace();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAOA;;;EANEA,gB;EACAC,S;EACAC,kB;EACAC;;;AAKK,SAASC,eAAT,CAAwCC,IAAxC,EAAiE;EACtE,IACEA,IAAI,CAACC,QAAL,KAAkB,MAAlB,IACAD,IAAI,CAACC,QAAL,KAAkB,QADlB,IAEAD,IAAI,CAACC,QAAL,KAAkB,QAFlB,IAIAD,IAAI,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AL;EACD,CAJD,MAIO;IACL,KAAKA,SAAL;IACA,KAAKC,KAAL,CAAWL,IAAI,CAACqC,QAAhB,EAA0BrC,IAA1B;EACD;AACF;;AAEM,SAASiE,YAAT,CAAqCjE,IAArC,EAA2D;EAChE,KAAKK,KAAL,CAAWL,IAAI,CAACkE,IAAhB,EAAsBlE,IAAtB;EACA,KAAKI,SAAL;EACA,KAAKC,KAAL,CAAWL,IAAI,CAACqC,QAAhB,EAA0BrC,IAA1B;AACD;;AAEM,SAASmE,WAAT,CAAoCnE,IAApC,EAAyD;EAC9D,KAAKI,SAAL;EACA,KAAKC,KAAL,CAAWL,IAAI,CAACoE,EAAhB,EAAoBpE,IAApB;AACD;;AAEM,SAASqE,qBAAT,CAELrE,IAFK,EAGL;EACA,KAAKI,SAAL;EACA,KAAKF,IAAL,CAAUF,IAAI,CAACsE,IAAf;AACD;;AAEM,SAASC,gBAAT,CAAyCvE,IAAzC,EAAmE;EACxE,KAAKE,IAAL,CAAU,QAAV;EACA,KAAKC,KAAL;EACA,KAAKC,SAAL;;EACA,IAAIJ,IAAI,CAACS,IAAL,CAAUA,IAAV,CAAegB,MAAf,KAA0B,CAA9B,EAAiC;IAC/B,KAAKrB,SAAL;EACD,CAFD,MAEO;IACL,KAAKqC,OAAL;IACA,KAAK+B,aAAL,CAAmBxE,IAAI,CAACS,IAAL,CAAUA,IAA7B,EAAmCT,IAAnC,EAAyC;MAAEyE,MAAM,EAAE;IAAV,CAAzC;IACA,KAAKC,UAAL;EACD;AACF"} \ No newline at end of file +{"version":3,"names":["isCallExpression","isLiteral","isMemberExpression","isNewExpression","UnaryExpression","node","operator","word","space","token","print","argument","DoExpression","async","body","ParenthesizedExpression","expression","UpdateExpression","prefix","printTerminatorless","ConditionalExpression","test","consequent","alternate","NewExpression","parent","callee","format","minified","arguments","length","optional","typeArguments","typeParameters","printList","SequenceExpression","expressions","ThisExpression","Super","isDecoratorMemberExpression","type","computed","property","object","shouldParenthesizeDecoratorExpression","Decorator","newline","OptionalMemberExpression","TypeError","value","OptionalCallExpression","CallExpression","Import","AwaitExpression","YieldExpression","delegate","EmptyStatement","semicolon","ExpressionStatement","AssignmentPattern","left","typeAnnotation","right","AssignmentExpression","parens","inForStatementInitCounter","n","needsParens","BindExpression","MemberExpression","MetaProperty","meta","PrivateName","id","V8IntrinsicIdentifier","name","ModuleExpression","indent","directives","dedent","sourceWithOffset","loc","rightBrace"],"sources":["../../src/generators/expressions.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport {\n isCallExpression,\n isLiteral,\n isMemberExpression,\n isNewExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport * as n from \"../node\";\n\nexport function UnaryExpression(this: Printer, node: t.UnaryExpression) {\n if (\n node.operator === \"void\" ||\n node.operator === \"delete\" ||\n node.operator === \"typeof\" ||\n // throwExpressions\n node.operator === \"throw\"\n ) {\n this.word(node.operator);\n this.space();\n } else {\n this.token(node.operator);\n }\n\n this.print(node.argument, node);\n}\n\nexport function DoExpression(this: Printer, node: t.DoExpression) {\n if (node.async) {\n this.word(\"async\", true);\n this.space();\n }\n this.word(\"do\");\n this.space();\n this.print(node.body, node);\n}\n\nexport function ParenthesizedExpression(\n this: Printer,\n node: t.ParenthesizedExpression,\n) {\n this.token(\"(\");\n this.print(node.expression, node);\n this.token(\")\");\n}\n\nexport function UpdateExpression(this: Printer, node: t.UpdateExpression) {\n if (node.prefix) {\n this.token(node.operator);\n this.print(node.argument, node);\n } else {\n this.printTerminatorless(node.argument, node, true);\n this.token(node.operator);\n }\n}\n\nexport function ConditionalExpression(\n this: Printer,\n node: t.ConditionalExpression,\n) {\n this.print(node.test, node);\n this.space();\n this.token(\"?\");\n this.space();\n this.print(node.consequent, node);\n this.space();\n this.token(\":\");\n this.space();\n this.print(node.alternate, node);\n}\n\nexport function NewExpression(\n this: Printer,\n node: t.NewExpression,\n parent: t.Node,\n) {\n this.word(\"new\");\n this.space();\n this.print(node.callee, node);\n if (\n this.format.minified &&\n node.arguments.length === 0 &&\n !node.optional &&\n !isCallExpression(parent, { callee: node }) &&\n !isMemberExpression(parent) &&\n !isNewExpression(parent)\n ) {\n return;\n }\n\n this.print(node.typeArguments, node); // Flow\n this.print(node.typeParameters, node); // TS\n\n if (node.optional) {\n // TODO: This can never happen\n this.token(\"?.\");\n }\n this.token(\"(\");\n this.printList(node.arguments, node);\n this.token(\")\");\n}\n\nexport function SequenceExpression(this: Printer, node: t.SequenceExpression) {\n this.printList(node.expressions, node);\n}\n\nexport function ThisExpression(this: Printer) {\n this.word(\"this\");\n}\n\nexport function Super(this: Printer) {\n this.word(\"super\");\n}\n\nfunction isDecoratorMemberExpression(\n node: t.Expression | t.Super | t.V8IntrinsicIdentifier,\n): boolean {\n switch (node.type) {\n case \"Identifier\":\n return true;\n case \"MemberExpression\":\n return (\n !node.computed &&\n node.property.type === \"Identifier\" &&\n isDecoratorMemberExpression(node.object)\n );\n default:\n return false;\n }\n}\nfunction shouldParenthesizeDecoratorExpression(\n node: t.Expression | t.Super | t.V8IntrinsicIdentifier,\n) {\n if (node.type === \"ParenthesizedExpression\") {\n // We didn't check extra?.parenthesized here because we don't track decorators in needsParen\n return false;\n }\n return !isDecoratorMemberExpression(\n node.type === \"CallExpression\" ? node.callee : node,\n );\n}\n\nexport function Decorator(this: Printer, node: t.Decorator) {\n this.token(\"@\");\n const { expression } = node;\n if (shouldParenthesizeDecoratorExpression(expression)) {\n this.token(\"(\");\n this.print(expression, node);\n this.token(\")\");\n } else {\n this.print(expression, node);\n }\n this.newline();\n}\n\nexport function OptionalMemberExpression(\n this: Printer,\n node: t.OptionalMemberExpression,\n) {\n this.print(node.object, node);\n\n if (!node.computed && isMemberExpression(node.property)) {\n throw new TypeError(\"Got a MemberExpression for MemberExpression property\");\n }\n\n let computed = node.computed;\n // @ts-expect-error todo(flow->ts) maybe instead of typeof check specific literal types?\n if (isLiteral(node.property) && typeof node.property.value === \"number\") {\n computed = true;\n }\n if (node.optional) {\n this.token(\"?.\");\n }\n\n if (computed) {\n this.token(\"[\");\n this.print(node.property, node);\n this.token(\"]\");\n } else {\n if (!node.optional) {\n this.token(\".\");\n }\n this.print(node.property, node);\n }\n}\n\nexport function OptionalCallExpression(\n this: Printer,\n node: t.OptionalCallExpression,\n) {\n this.print(node.callee, node);\n\n this.print(node.typeParameters, node); // TS\n\n if (node.optional) {\n this.token(\"?.\");\n }\n\n this.print(node.typeArguments, node); // Flow\n\n this.token(\"(\");\n this.printList(node.arguments, node);\n this.token(\")\");\n}\n\nexport function CallExpression(this: Printer, node: t.CallExpression) {\n this.print(node.callee, node);\n\n this.print(node.typeArguments, node); // Flow\n this.print(node.typeParameters, node); // TS\n this.token(\"(\");\n this.printList(node.arguments, node);\n this.token(\")\");\n}\n\nexport function Import(this: Printer) {\n this.word(\"import\");\n}\n\nexport function AwaitExpression(this: Printer, node: t.AwaitExpression) {\n this.word(\"await\");\n\n if (node.argument) {\n this.space();\n this.printTerminatorless(node.argument, node, false);\n }\n}\n\nexport function YieldExpression(this: Printer, node: t.YieldExpression) {\n this.word(\"yield\", true);\n\n if (node.delegate) {\n this.token(\"*\");\n if (node.argument) {\n this.space();\n // line terminators are allowed after yield*\n this.print(node.argument, node);\n }\n } else {\n if (node.argument) {\n this.space();\n this.printTerminatorless(node.argument, node, false);\n }\n }\n}\n\nexport function EmptyStatement(this: Printer) {\n this.semicolon(true /* force */);\n}\n\nexport function ExpressionStatement(\n this: Printer,\n node: t.ExpressionStatement,\n) {\n this.print(node.expression, node);\n this.semicolon();\n}\n\nexport function AssignmentPattern(this: Printer, node: t.AssignmentPattern) {\n this.print(node.left, node);\n // @ts-expect-error todo(flow->ts) property present on some of the types in union but not all\n if (node.left.optional) this.token(\"?\");\n // @ts-expect-error todo(flow->ts) property present on some of the types in union but not all\n this.print(node.left.typeAnnotation, node);\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.right, node);\n}\n\nexport function AssignmentExpression(\n this: Printer,\n node: t.AssignmentExpression,\n parent: t.Node,\n) {\n // Somewhere inside a for statement `init` node but doesn't usually\n // needs a paren except for `in` expressions: `for (a in b ? a : b;;)`\n const parens =\n this.inForStatementInitCounter &&\n node.operator === \"in\" &&\n !n.needsParens(node, parent);\n\n if (parens) {\n this.token(\"(\");\n }\n\n this.print(node.left, node);\n\n this.space();\n if (node.operator === \"in\" || node.operator === \"instanceof\") {\n this.word(node.operator);\n } else {\n this.token(node.operator);\n }\n this.space();\n\n this.print(node.right, node);\n\n if (parens) {\n this.token(\")\");\n }\n}\n\nexport function BindExpression(this: Printer, node: t.BindExpression) {\n this.print(node.object, node);\n this.token(\"::\");\n this.print(node.callee, node);\n}\n\nexport {\n AssignmentExpression as BinaryExpression,\n AssignmentExpression as LogicalExpression,\n};\n\nexport function MemberExpression(this: Printer, node: t.MemberExpression) {\n this.print(node.object, node);\n\n if (!node.computed && isMemberExpression(node.property)) {\n throw new TypeError(\"Got a MemberExpression for MemberExpression property\");\n }\n\n let computed = node.computed;\n // @ts-expect-error todo(flow->ts) maybe use specific literal types\n if (isLiteral(node.property) && typeof node.property.value === \"number\") {\n computed = true;\n }\n\n if (computed) {\n this.token(\"[\");\n this.print(node.property, node);\n this.token(\"]\");\n } else {\n this.token(\".\");\n this.print(node.property, node);\n }\n}\n\nexport function MetaProperty(this: Printer, node: t.MetaProperty) {\n this.print(node.meta, node);\n this.token(\".\");\n this.print(node.property, node);\n}\n\nexport function PrivateName(this: Printer, node: t.PrivateName) {\n this.token(\"#\");\n this.print(node.id, node);\n}\n\nexport function V8IntrinsicIdentifier(\n this: Printer,\n node: t.V8IntrinsicIdentifier,\n) {\n this.token(\"%\");\n this.word(node.name);\n}\n\nexport function ModuleExpression(this: Printer, node: t.ModuleExpression) {\n this.word(\"module\", true);\n this.space();\n this.token(\"{\");\n this.indent();\n const { body } = node;\n if (body.body.length || body.directives.length) {\n this.newline();\n }\n this.print(body, node);\n this.dedent();\n this.sourceWithOffset(\"end\", node.loc, 0, -1);\n this.rightBrace();\n}\n"],"mappings":";;;;;;;;;;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AET,IAAI,CAAC;EACtB,IAAI,CAAC0E,MAAM,EAAE;EACb,IAAI,CAACC,gBAAgB,CAAC,KAAK,EAAE3E,IAAI,CAAC4E,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;EAC7C,IAAI,CAACC,UAAU,EAAE;AACnB"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/flow.js b/node_modules/@babel/generator/lib/generators/flow.js index a1fb0bba4..bde042c1b 100644 --- a/node_modules/@babel/generator/lib/generators/flow.js +++ b/node_modules/@babel/generator/lib/generators/flow.js @@ -77,76 +77,58 @@ exports.Variance = Variance; exports.VoidTypeAnnotation = VoidTypeAnnotation; exports._interfaceish = _interfaceish; exports._variance = _variance; - var _t = require("@babel/types"); - var _modules = require("./modules"); - var _types2 = require("./types"); - const { isDeclareExportDeclaration, isStatement } = _t; - function AnyTypeAnnotation() { this.word("any"); } - function ArrayTypeAnnotation(node) { this.print(node.elementType, node, true); this.tokenChar(91); this.tokenChar(93); } - function BooleanTypeAnnotation() { this.word("boolean"); } - function BooleanLiteralTypeAnnotation(node) { this.word(node.value ? "true" : "false"); } - function NullLiteralTypeAnnotation() { this.word("null"); } - function DeclareClass(node, parent) { if (!isDeclareExportDeclaration(parent)) { this.word("declare"); this.space(); } - this.word("class"); this.space(); - this._interfaceish(node); } - function DeclareFunction(node, parent) { if (!isDeclareExportDeclaration(parent)) { this.word("declare"); this.space(); } - this.word("function"); this.space(); this.print(node.id, node); this.print(node.id.typeAnnotation.typeAnnotation, node); - if (node.predicate) { this.space(); this.print(node.predicate, node); } - this.semicolon(); } - function InferredPredicate() { this.tokenChar(37); this.word("checks"); } - function DeclaredPredicate(node) { this.tokenChar(37); this.word("checks"); @@ -154,13 +136,11 @@ function DeclaredPredicate(node) { this.print(node.value, node); this.tokenChar(41); } - function DeclareInterface(node) { this.word("declare"); this.space(); this.InterfaceDeclaration(node); } - function DeclareModule(node) { this.word("declare"); this.space(); @@ -170,7 +150,6 @@ function DeclareModule(node) { this.space(); this.print(node.body, node); } - function DeclareModuleExports(node) { this.word("declare"); this.space(); @@ -179,56 +158,45 @@ function DeclareModuleExports(node) { this.word("exports"); this.print(node.typeAnnotation, node); } - function DeclareTypeAlias(node) { this.word("declare"); this.space(); this.TypeAlias(node); } - function DeclareOpaqueType(node, parent) { if (!isDeclareExportDeclaration(parent)) { this.word("declare"); this.space(); } - this.OpaqueType(node); } - function DeclareVariable(node, parent) { if (!isDeclareExportDeclaration(parent)) { this.word("declare"); this.space(); } - this.word("var"); this.space(); this.print(node.id, node); this.print(node.id.typeAnnotation, node); this.semicolon(); } - function DeclareExportDeclaration(node) { this.word("declare"); this.space(); this.word("export"); this.space(); - if (node.default) { this.word("default"); this.space(); } - FlowExportDeclaration.call(this, node); } - function DeclareExportAllDeclaration(node) { this.word("declare"); this.space(); - _modules.ExportAllDeclaration.call(this, node); } - function EnumDeclaration(node) { const { id, @@ -239,7 +207,6 @@ function EnumDeclaration(node) { this.print(id, node); this.print(body, node); } - function enumExplicitType(context, name, hasExplicitType) { if (hasExplicitType) { context.space(); @@ -247,10 +214,8 @@ function enumExplicitType(context, name, hasExplicitType) { context.space(); context.word(name); } - context.space(); } - function enumBody(context, node) { const { members @@ -258,21 +223,17 @@ function enumBody(context, node) { context.token("{"); context.indent(); context.newline(); - for (const member of members) { context.print(member, node); context.newline(); } - if (node.hasUnknownMembers) { context.token("..."); context.newline(); } - context.dedent(); context.token("}"); } - function EnumBooleanBody(node) { const { explicitType @@ -280,7 +241,6 @@ function EnumBooleanBody(node) { enumExplicitType(this, "boolean", explicitType); enumBody(this, node); } - function EnumNumberBody(node) { const { explicitType @@ -288,7 +248,6 @@ function EnumNumberBody(node) { enumExplicitType(this, "number", explicitType); enumBody(this, node); } - function EnumStringBody(node) { const { explicitType @@ -296,12 +255,10 @@ function EnumStringBody(node) { enumExplicitType(this, "string", explicitType); enumBody(this, node); } - function EnumSymbolBody(node) { enumExplicitType(this, "symbol", true); enumBody(this, node); } - function EnumDefaultedMember(node) { const { id @@ -309,7 +266,6 @@ function EnumDefaultedMember(node) { this.print(id, node); this.tokenChar(44); } - function enumInitializedMember(context, node) { const { id, @@ -322,19 +278,15 @@ function enumInitializedMember(context, node) { context.print(init, node); context.token(","); } - function EnumBooleanMember(node) { enumInitializedMember(this, node); } - function EnumNumberMember(node) { enumInitializedMember(this, node); } - function EnumStringMember(node) { enumInitializedMember(this, node); } - function FlowExportDeclaration(node) { if (node.declaration) { const declar = node.declaration; @@ -342,58 +294,46 @@ function FlowExportDeclaration(node) { if (!isStatement(declar)) this.semicolon(); } else { this.tokenChar(123); - if (node.specifiers.length) { this.space(); this.printList(node.specifiers, node); this.space(); } - this.tokenChar(125); - if (node.source) { this.space(); this.word("from"); this.space(); this.print(node.source, node); } - this.semicolon(); } } - function ExistsTypeAnnotation() { this.tokenChar(42); } - function FunctionTypeAnnotation(node, parent) { this.print(node.typeParameters, node); this.tokenChar(40); - if (node.this) { this.word("this"); this.tokenChar(58); this.space(); this.print(node.this.typeAnnotation, node); - if (node.params.length || node.rest) { this.tokenChar(44); this.space(); } } - this.printList(node.params, node); - if (node.rest) { if (node.params.length) { this.tokenChar(44); this.space(); } - this.token("..."); this.print(node.rest, node); } - this.tokenChar(41); if (parent && (parent.type === "ObjectTypeCallProperty" || parent.type === "ObjectTypeInternalSlot" || parent.type === "DeclareFunction" || parent.type === "ObjectTypeProperty" && parent.method)) { @@ -402,59 +342,47 @@ function FunctionTypeAnnotation(node, parent) { this.space(); this.token("=>"); } - this.space(); this.print(node.returnType, node); } - function FunctionTypeParam(node) { this.print(node.name, node); if (node.optional) this.tokenChar(63); - if (node.name) { this.tokenChar(58); this.space(); } - this.print(node.typeAnnotation, node); } - function InterfaceExtends(node) { this.print(node.id, node); this.print(node.typeParameters, node, true); } - function _interfaceish(node) { var _node$extends; - this.print(node.id, node); this.print(node.typeParameters, node); - if ((_node$extends = node.extends) != null && _node$extends.length) { this.space(); this.word("extends"); this.space(); this.printList(node.extends, node); } - if (node.mixins && node.mixins.length) { this.space(); this.word("mixins"); this.space(); this.printList(node.mixins, node); } - if (node.implements && node.implements.length) { this.space(); this.word("implements"); this.space(); this.printList(node.implements, node); } - this.space(); this.print(node.body, node); } - function _variance(node) { if (node.variance) { if (node.variance.kind === "plus") { @@ -464,77 +392,61 @@ function _variance(node) { } } } - function InterfaceDeclaration(node) { this.word("interface"); this.space(); - this._interfaceish(node); } - function andSeparator() { this.space(); this.tokenChar(38); this.space(); } - function InterfaceTypeAnnotation(node) { this.word("interface"); - if (node.extends && node.extends.length) { this.space(); this.word("extends"); this.space(); this.printList(node.extends, node); } - this.space(); this.print(node.body, node); } - function IntersectionTypeAnnotation(node) { this.printJoin(node.types, node, { separator: andSeparator }); } - function MixedTypeAnnotation() { this.word("mixed"); } - function EmptyTypeAnnotation() { this.word("empty"); } - function NullableTypeAnnotation(node) { this.tokenChar(63); this.print(node.typeAnnotation, node); } - function NumberTypeAnnotation() { this.word("number"); } - function StringTypeAnnotation() { this.word("string"); } - function ThisTypeAnnotation() { this.word("this"); } - function TupleTypeAnnotation(node) { this.tokenChar(91); this.printList(node.types, node); this.tokenChar(93); } - function TypeofTypeAnnotation(node) { this.word("typeof"); this.space(); this.print(node.argument, node); } - function TypeAlias(node) { this.word("type"); this.space(); @@ -546,29 +458,23 @@ function TypeAlias(node) { this.print(node.right, node); this.semicolon(); } - function TypeAnnotation(node) { this.tokenChar(58); this.space(); if (node.optional) this.tokenChar(63); this.print(node.typeAnnotation, node); } - function TypeParameterInstantiation(node) { this.tokenChar(60); this.printList(node.params, node, {}); this.tokenChar(62); } - function TypeParameter(node) { this._variance(node); - this.word(node.name); - if (node.bound) { this.print(node.bound, node); } - if (node.default) { this.space(); this.tokenChar(61); @@ -576,7 +482,6 @@ function TypeParameter(node) { this.print(node.default, node); } } - function OpaqueType(node) { this.word("opaque"); this.space(); @@ -584,23 +489,19 @@ function OpaqueType(node) { this.space(); this.print(node.id, node); this.print(node.typeParameters, node); - if (node.supertype) { this.tokenChar(58); this.space(); this.print(node.supertype, node); } - if (node.impltype) { this.space(); this.tokenChar(61); this.space(); this.print(node.impltype, node); } - this.semicolon(); } - function ObjectTypeAnnotation(node) { if (node.exact) { this.token("{|"); @@ -609,14 +510,13 @@ function ObjectTypeAnnotation(node) { } const props = [...node.properties, ...(node.callProperties || []), ...(node.indexers || []), ...(node.internalSlots || [])]; - if (props.length) { + this.newline(); this.space(); this.printJoin(props, node, { addNewlines(leading) { if (leading && !props[0]) return 1; }, - indent: true, statement: true, iterator: () => { @@ -628,141 +528,112 @@ function ObjectTypeAnnotation(node) { }); this.space(); } - if (node.inexact) { this.indent(); this.token("..."); - if (props.length) { this.newline(); } - this.dedent(); } - if (node.exact) { this.token("|}"); } else { this.tokenChar(125); } } - function ObjectTypeInternalSlot(node) { if (node.static) { this.word("static"); this.space(); } - this.tokenChar(91); this.tokenChar(91); this.print(node.id, node); this.tokenChar(93); this.tokenChar(93); if (node.optional) this.tokenChar(63); - if (!node.method) { this.tokenChar(58); this.space(); } - this.print(node.value, node); } - function ObjectTypeCallProperty(node) { if (node.static) { this.word("static"); this.space(); } - this.print(node.value, node); } - function ObjectTypeIndexer(node) { if (node.static) { this.word("static"); this.space(); } - this._variance(node); - this.tokenChar(91); - if (node.id) { this.print(node.id, node); this.tokenChar(58); this.space(); } - this.print(node.key, node); this.tokenChar(93); this.tokenChar(58); this.space(); this.print(node.value, node); } - function ObjectTypeProperty(node) { if (node.proto) { this.word("proto"); this.space(); } - if (node.static) { this.word("static"); this.space(); } - if (node.kind === "get" || node.kind === "set") { this.word(node.kind); this.space(); } - this._variance(node); - this.print(node.key, node); if (node.optional) this.tokenChar(63); - if (!node.method) { this.tokenChar(58); this.space(); } - this.print(node.value, node); } - function ObjectTypeSpreadProperty(node) { this.token("..."); this.print(node.argument, node); } - function QualifiedTypeIdentifier(node) { this.print(node.qualification, node); this.tokenChar(46); this.print(node.id, node); } - function SymbolTypeAnnotation() { this.word("symbol"); } - function orSeparator() { this.space(); this.tokenChar(124); this.space(); } - function UnionTypeAnnotation(node) { this.printJoin(node.types, node, { separator: orSeparator }); } - function TypeCastExpression(node) { this.tokenChar(40); this.print(node.expression, node); this.print(node.typeAnnotation, node); this.tokenChar(41); } - function Variance(node) { if (node.kind === "plus") { this.tokenChar(43); @@ -770,25 +641,20 @@ function Variance(node) { this.tokenChar(45); } } - function VoidTypeAnnotation() { this.word("void"); } - function IndexedAccessType(node) { this.print(node.objectType, node, true); this.tokenChar(91); this.print(node.indexType, node); this.tokenChar(93); } - function OptionalIndexedAccessType(node) { this.print(node.objectType, node); - if (node.optional) { this.token("?."); } - this.tokenChar(91); this.print(node.indexType, node); this.tokenChar(93); diff --git a/node_modules/@babel/generator/lib/generators/flow.js.map b/node_modules/@babel/generator/lib/generators/flow.js.map index 52bd2c539..5edf9ee1b 100644 --- a/node_modules/@babel/generator/lib/generators/flow.js.map +++ b/node_modules/@babel/generator/lib/generators/flow.js.map @@ -1 +1 @@ -{"version":3,"names":["isDeclareExportDeclaration","isStatement","AnyTypeAnnotation","word","ArrayTypeAnnotation","node","print","elementType","token","BooleanTypeAnnotation","BooleanLiteralTypeAnnotation","value","NullLiteralTypeAnnotation","DeclareClass","parent","space","_interfaceish","DeclareFunction","id","typeAnnotation","predicate","semicolon","InferredPredicate","DeclaredPredicate","DeclareInterface","InterfaceDeclaration","DeclareModule","body","DeclareModuleExports","DeclareTypeAlias","TypeAlias","DeclareOpaqueType","OpaqueType","DeclareVariable","DeclareExportDeclaration","default","FlowExportDeclaration","call","DeclareExportAllDeclaration","ExportAllDeclaration","EnumDeclaration","enumExplicitType","context","name","hasExplicitType","enumBody","members","indent","newline","member","hasUnknownMembers","dedent","EnumBooleanBody","explicitType","EnumNumberBody","EnumStringBody","EnumSymbolBody","EnumDefaultedMember","enumInitializedMember","init","EnumBooleanMember","EnumNumberMember","EnumStringMember","declaration","declar","specifiers","length","printList","source","ExistsTypeAnnotation","FunctionTypeAnnotation","typeParameters","this","params","rest","type","method","returnType","FunctionTypeParam","optional","InterfaceExtends","extends","mixins","implements","_variance","variance","kind","andSeparator","InterfaceTypeAnnotation","IntersectionTypeAnnotation","printJoin","types","separator","MixedTypeAnnotation","EmptyTypeAnnotation","NullableTypeAnnotation","NumberTypeAnnotation","StringTypeAnnotation","ThisTypeAnnotation","TupleTypeAnnotation","TypeofTypeAnnotation","argument","right","TypeAnnotation","TypeParameterInstantiation","TypeParameter","bound","supertype","impltype","ObjectTypeAnnotation","exact","props","properties","callProperties","indexers","internalSlots","addNewlines","leading","statement","iterator","inexact","ObjectTypeInternalSlot","static","ObjectTypeCallProperty","ObjectTypeIndexer","key","ObjectTypeProperty","proto","ObjectTypeSpreadProperty","QualifiedTypeIdentifier","qualification","SymbolTypeAnnotation","orSeparator","UnionTypeAnnotation","TypeCastExpression","expression","Variance","VoidTypeAnnotation","IndexedAccessType","objectType","indexType","OptionalIndexedAccessType"],"sources":["../../src/generators/flow.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport { isDeclareExportDeclaration, isStatement } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport { ExportAllDeclaration } from \"./modules\";\n\nexport function AnyTypeAnnotation(this: Printer) {\n this.word(\"any\");\n}\n\nexport function ArrayTypeAnnotation(\n this: Printer,\n node: t.ArrayTypeAnnotation,\n) {\n this.print(node.elementType, node, true);\n this.token(\"[\");\n this.token(\"]\");\n}\n\nexport function BooleanTypeAnnotation(this: Printer) {\n this.word(\"boolean\");\n}\n\nexport function BooleanLiteralTypeAnnotation(\n this: Printer,\n node: t.BooleanLiteralTypeAnnotation,\n) {\n this.word(node.value ? \"true\" : \"false\");\n}\n\nexport function NullLiteralTypeAnnotation(this: Printer) {\n this.word(\"null\");\n}\n\nexport function DeclareClass(\n this: Printer,\n node: t.DeclareClass,\n parent: t.Node,\n) {\n if (!isDeclareExportDeclaration(parent)) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"class\");\n this.space();\n this._interfaceish(node);\n}\n\nexport function DeclareFunction(\n this: Printer,\n node: t.DeclareFunction,\n parent: t.Node,\n) {\n if (!isDeclareExportDeclaration(parent)) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"function\");\n this.space();\n this.print(node.id, node);\n // @ts-ignore(Babel 7 vs Babel 8) TODO(Babel 8) Remove this comment, since we'll remove the Noop node\n this.print(node.id.typeAnnotation.typeAnnotation, node);\n\n if (node.predicate) {\n this.space();\n this.print(node.predicate, node);\n }\n\n this.semicolon();\n}\n\nexport function InferredPredicate(this: Printer) {\n this.token(\"%\");\n this.word(\"checks\");\n}\n\nexport function DeclaredPredicate(this: Printer, node: t.DeclaredPredicate) {\n this.token(\"%\");\n this.word(\"checks\");\n this.token(\"(\");\n this.print(node.value, node);\n this.token(\")\");\n}\n\nexport function DeclareInterface(this: Printer, node: t.DeclareInterface) {\n this.word(\"declare\");\n this.space();\n this.InterfaceDeclaration(node);\n}\n\nexport function DeclareModule(this: Printer, node: t.DeclareModule) {\n this.word(\"declare\");\n this.space();\n this.word(\"module\");\n this.space();\n this.print(node.id, node);\n this.space();\n this.print(node.body, node);\n}\n\nexport function DeclareModuleExports(\n this: Printer,\n node: t.DeclareModuleExports,\n) {\n this.word(\"declare\");\n this.space();\n this.word(\"module\");\n this.token(\".\");\n this.word(\"exports\");\n this.print(node.typeAnnotation, node);\n}\n\nexport function DeclareTypeAlias(this: Printer, node: t.DeclareTypeAlias) {\n this.word(\"declare\");\n this.space();\n this.TypeAlias(node);\n}\n\nexport function DeclareOpaqueType(\n this: Printer,\n node: t.DeclareOpaqueType,\n parent: t.Node,\n) {\n if (!isDeclareExportDeclaration(parent)) {\n this.word(\"declare\");\n this.space();\n }\n this.OpaqueType(node);\n}\n\nexport function DeclareVariable(\n this: Printer,\n node: t.DeclareVariable,\n parent: t.Node,\n) {\n if (!isDeclareExportDeclaration(parent)) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"var\");\n this.space();\n this.print(node.id, node);\n this.print(node.id.typeAnnotation, node);\n this.semicolon();\n}\n\nexport function DeclareExportDeclaration(\n this: Printer,\n node: t.DeclareExportDeclaration,\n) {\n this.word(\"declare\");\n this.space();\n this.word(\"export\");\n this.space();\n if (node.default) {\n this.word(\"default\");\n this.space();\n }\n\n FlowExportDeclaration.call(this, node);\n}\n\nexport function DeclareExportAllDeclaration(\n this: Printer,\n node: t.DeclareExportAllDeclaration,\n) {\n this.word(\"declare\");\n this.space();\n ExportAllDeclaration.call(this, node);\n}\n\nexport function EnumDeclaration(this: Printer, node: t.EnumDeclaration) {\n const { id, body } = node;\n this.word(\"enum\");\n this.space();\n this.print(id, node);\n this.print(body, node);\n}\n\nfunction enumExplicitType(\n context: Printer,\n name: string,\n hasExplicitType: boolean,\n) {\n if (hasExplicitType) {\n context.space();\n context.word(\"of\");\n context.space();\n context.word(name);\n }\n context.space();\n}\n\nfunction enumBody(context: Printer, node: t.EnumBody) {\n const { members } = node;\n context.token(\"{\");\n context.indent();\n context.newline();\n for (const member of members) {\n context.print(member, node);\n context.newline();\n }\n if (node.hasUnknownMembers) {\n context.token(\"...\");\n context.newline();\n }\n context.dedent();\n context.token(\"}\");\n}\n\nexport function EnumBooleanBody(this: Printer, node: t.EnumBooleanBody) {\n const { explicitType } = node;\n enumExplicitType(this, \"boolean\", explicitType);\n enumBody(this, node);\n}\n\nexport function EnumNumberBody(this: Printer, node: t.EnumNumberBody) {\n const { explicitType } = node;\n enumExplicitType(this, \"number\", explicitType);\n enumBody(this, node);\n}\n\nexport function EnumStringBody(this: Printer, node: t.EnumStringBody) {\n const { explicitType } = node;\n enumExplicitType(this, \"string\", explicitType);\n enumBody(this, node);\n}\n\nexport function EnumSymbolBody(this: Printer, node: t.EnumSymbolBody) {\n enumExplicitType(this, \"symbol\", true);\n enumBody(this, node);\n}\n\nexport function EnumDefaultedMember(\n this: Printer,\n node: t.EnumDefaultedMember,\n) {\n const { id } = node;\n this.print(id, node);\n this.token(\",\");\n}\n\nfunction enumInitializedMember(\n context: Printer,\n node: t.EnumBooleanMember | t.EnumNumberMember | t.EnumStringMember,\n) {\n const { id, init } = node;\n context.print(id, node);\n context.space();\n context.token(\"=\");\n context.space();\n context.print(init, node);\n context.token(\",\");\n}\n\nexport function EnumBooleanMember(this: Printer, node: t.EnumBooleanMember) {\n enumInitializedMember(this, node);\n}\n\nexport function EnumNumberMember(this: Printer, node: t.EnumNumberMember) {\n enumInitializedMember(this, node);\n}\n\nexport function EnumStringMember(this: Printer, node: t.EnumStringMember) {\n enumInitializedMember(this, node);\n}\n\nfunction FlowExportDeclaration(\n this: Printer,\n node: t.DeclareExportDeclaration,\n) {\n if (node.declaration) {\n const declar = node.declaration;\n this.print(declar, node);\n if (!isStatement(declar)) this.semicolon();\n } else {\n this.token(\"{\");\n if (node.specifiers.length) {\n this.space();\n this.printList(node.specifiers, node);\n this.space();\n }\n this.token(\"}\");\n\n if (node.source) {\n this.space();\n this.word(\"from\");\n this.space();\n this.print(node.source, node);\n }\n\n this.semicolon();\n }\n}\n\nexport function ExistsTypeAnnotation(this: Printer) {\n this.token(\"*\");\n}\n\nexport function FunctionTypeAnnotation(\n this: Printer,\n node: t.FunctionTypeAnnotation,\n parent: t.Node | void,\n) {\n this.print(node.typeParameters, node);\n this.token(\"(\");\n\n if (node.this) {\n this.word(\"this\");\n this.token(\":\");\n this.space();\n this.print(node.this.typeAnnotation, node);\n if (node.params.length || node.rest) {\n this.token(\",\");\n this.space();\n }\n }\n\n this.printList(node.params, node);\n\n if (node.rest) {\n if (node.params.length) {\n this.token(\",\");\n this.space();\n }\n this.token(\"...\");\n this.print(node.rest, node);\n }\n\n this.token(\")\");\n\n // this node type is overloaded, not sure why but it makes it EXTREMELY annoying\n if (\n parent &&\n (parent.type === \"ObjectTypeCallProperty\" ||\n parent.type === \"ObjectTypeInternalSlot\" ||\n parent.type === \"DeclareFunction\" ||\n (parent.type === \"ObjectTypeProperty\" && parent.method))\n ) {\n this.token(\":\");\n } else {\n this.space();\n this.token(\"=>\");\n }\n\n this.space();\n this.print(node.returnType, node);\n}\n\nexport function FunctionTypeParam(this: Printer, node: t.FunctionTypeParam) {\n this.print(node.name, node);\n if (node.optional) this.token(\"?\");\n if (node.name) {\n this.token(\":\");\n this.space();\n }\n this.print(node.typeAnnotation, node);\n}\n\nexport function InterfaceExtends(this: Printer, node: t.InterfaceExtends) {\n this.print(node.id, node);\n this.print(node.typeParameters, node, true);\n}\n\nexport {\n InterfaceExtends as ClassImplements,\n InterfaceExtends as GenericTypeAnnotation,\n};\n\nexport function _interfaceish(\n this: Printer,\n node: t.InterfaceDeclaration | t.DeclareInterface | t.DeclareClass,\n) {\n this.print(node.id, node);\n this.print(node.typeParameters, node);\n if (node.extends?.length) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.printList(node.extends, node);\n }\n if (node.mixins && node.mixins.length) {\n this.space();\n this.word(\"mixins\");\n this.space();\n this.printList(node.mixins, node);\n }\n if (node.implements && node.implements.length) {\n this.space();\n this.word(\"implements\");\n this.space();\n this.printList(node.implements, node);\n }\n this.space();\n this.print(node.body, node);\n}\n\nexport function _variance(\n this: Printer,\n node:\n | t.TypeParameter\n | t.ObjectTypeIndexer\n | t.ObjectTypeProperty\n | t.ClassProperty\n | t.ClassPrivateProperty\n | t.ClassAccessorProperty,\n) {\n if (node.variance) {\n if (node.variance.kind === \"plus\") {\n this.token(\"+\");\n } else if (node.variance.kind === \"minus\") {\n this.token(\"-\");\n }\n }\n}\n\nexport function InterfaceDeclaration(\n this: Printer,\n node: t.InterfaceDeclaration | t.DeclareInterface,\n) {\n this.word(\"interface\");\n this.space();\n this._interfaceish(node);\n}\n\nfunction andSeparator(this: Printer) {\n this.space();\n this.token(\"&\");\n this.space();\n}\n\nexport function InterfaceTypeAnnotation(\n this: Printer,\n node: t.InterfaceTypeAnnotation,\n) {\n this.word(\"interface\");\n if (node.extends && node.extends.length) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.printList(node.extends, node);\n }\n this.space();\n this.print(node.body, node);\n}\n\nexport function IntersectionTypeAnnotation(\n this: Printer,\n node: t.IntersectionTypeAnnotation,\n) {\n this.printJoin(node.types, node, { separator: andSeparator });\n}\n\nexport function MixedTypeAnnotation(this: Printer) {\n this.word(\"mixed\");\n}\n\nexport function EmptyTypeAnnotation(this: Printer) {\n this.word(\"empty\");\n}\n\nexport function NullableTypeAnnotation(\n this: Printer,\n node: t.NullableTypeAnnotation,\n) {\n this.token(\"?\");\n this.print(node.typeAnnotation, node);\n}\n\nexport {\n NumericLiteral as NumberLiteralTypeAnnotation,\n StringLiteral as StringLiteralTypeAnnotation,\n} from \"./types\";\n\nexport function NumberTypeAnnotation(this: Printer) {\n this.word(\"number\");\n}\n\nexport function StringTypeAnnotation(this: Printer) {\n this.word(\"string\");\n}\n\nexport function ThisTypeAnnotation(this: Printer) {\n this.word(\"this\");\n}\n\nexport function TupleTypeAnnotation(\n this: Printer,\n node: t.TupleTypeAnnotation,\n) {\n this.token(\"[\");\n this.printList(node.types, node);\n this.token(\"]\");\n}\n\nexport function TypeofTypeAnnotation(\n this: Printer,\n node: t.TypeofTypeAnnotation,\n) {\n this.word(\"typeof\");\n this.space();\n this.print(node.argument, node);\n}\n\nexport function TypeAlias(\n this: Printer,\n node: t.TypeAlias | t.DeclareTypeAlias,\n) {\n this.word(\"type\");\n this.space();\n this.print(node.id, node);\n this.print(node.typeParameters, node);\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.right, node);\n this.semicolon();\n}\n\nexport function TypeAnnotation(this: Printer, node: t.TypeAnnotation) {\n this.token(\":\");\n this.space();\n // @ts-expect-error todo(flow->ts) can this be removed? `.optional` looks to be not existing property\n if (node.optional) this.token(\"?\");\n this.print(node.typeAnnotation, node);\n}\n\nexport function TypeParameterInstantiation(\n this: Printer,\n node: t.TypeParameterInstantiation,\n): void {\n this.token(\"<\");\n this.printList(node.params, node, {});\n this.token(\">\");\n}\n\nexport { TypeParameterInstantiation as TypeParameterDeclaration };\n\nexport function TypeParameter(this: Printer, node: t.TypeParameter) {\n this._variance(node);\n\n this.word(node.name);\n\n if (node.bound) {\n this.print(node.bound, node);\n }\n\n if (node.default) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.default, node);\n }\n}\n\nexport function OpaqueType(\n this: Printer,\n node: t.OpaqueType | t.DeclareOpaqueType,\n) {\n this.word(\"opaque\");\n this.space();\n this.word(\"type\");\n this.space();\n this.print(node.id, node);\n this.print(node.typeParameters, node);\n if (node.supertype) {\n this.token(\":\");\n this.space();\n this.print(node.supertype, node);\n }\n\n if (node.impltype) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.impltype, node);\n }\n this.semicolon();\n}\n\nexport function ObjectTypeAnnotation(\n this: Printer,\n node: t.ObjectTypeAnnotation,\n) {\n if (node.exact) {\n this.token(\"{|\");\n } else {\n this.token(\"{\");\n }\n\n // TODO: remove the array fallbacks and instead enforce the types to require an array\n const props = [\n ...node.properties,\n ...(node.callProperties || []),\n ...(node.indexers || []),\n ...(node.internalSlots || []),\n ];\n\n if (props.length) {\n this.space();\n\n this.printJoin(props, node, {\n addNewlines(leading) {\n if (leading && !props[0]) return 1;\n },\n indent: true,\n statement: true,\n iterator: () => {\n if (props.length !== 1 || node.inexact) {\n this.token(\",\");\n this.space();\n }\n },\n });\n\n this.space();\n }\n\n if (node.inexact) {\n this.indent();\n this.token(\"...\");\n if (props.length) {\n this.newline();\n }\n this.dedent();\n }\n\n if (node.exact) {\n this.token(\"|}\");\n } else {\n this.token(\"}\");\n }\n}\n\nexport function ObjectTypeInternalSlot(\n this: Printer,\n node: t.ObjectTypeInternalSlot,\n) {\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n this.token(\"[\");\n this.token(\"[\");\n this.print(node.id, node);\n this.token(\"]\");\n this.token(\"]\");\n if (node.optional) this.token(\"?\");\n if (!node.method) {\n this.token(\":\");\n this.space();\n }\n this.print(node.value, node);\n}\n\nexport function ObjectTypeCallProperty(\n this: Printer,\n node: t.ObjectTypeCallProperty,\n) {\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n this.print(node.value, node);\n}\n\nexport function ObjectTypeIndexer(this: Printer, node: t.ObjectTypeIndexer) {\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n this._variance(node);\n this.token(\"[\");\n if (node.id) {\n this.print(node.id, node);\n this.token(\":\");\n this.space();\n }\n this.print(node.key, node);\n this.token(\"]\");\n this.token(\":\");\n this.space();\n this.print(node.value, node);\n}\n\nexport function ObjectTypeProperty(this: Printer, node: t.ObjectTypeProperty) {\n if (node.proto) {\n this.word(\"proto\");\n this.space();\n }\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n if (node.kind === \"get\" || node.kind === \"set\") {\n this.word(node.kind);\n this.space();\n }\n this._variance(node);\n this.print(node.key, node);\n if (node.optional) this.token(\"?\");\n if (!node.method) {\n this.token(\":\");\n this.space();\n }\n this.print(node.value, node);\n}\n\nexport function ObjectTypeSpreadProperty(\n this: Printer,\n node: t.ObjectTypeSpreadProperty,\n) {\n this.token(\"...\");\n this.print(node.argument, node);\n}\n\nexport function QualifiedTypeIdentifier(\n this: Printer,\n node: t.QualifiedTypeIdentifier,\n) {\n this.print(node.qualification, node);\n this.token(\".\");\n this.print(node.id, node);\n}\n\nexport function SymbolTypeAnnotation(this: Printer) {\n this.word(\"symbol\");\n}\n\nfunction orSeparator(this: Printer) {\n this.space();\n this.token(\"|\");\n this.space();\n}\n\nexport function UnionTypeAnnotation(\n this: Printer,\n node: t.UnionTypeAnnotation,\n) {\n this.printJoin(node.types, node, { separator: orSeparator });\n}\n\nexport function TypeCastExpression(this: Printer, node: t.TypeCastExpression) {\n this.token(\"(\");\n this.print(node.expression, node);\n this.print(node.typeAnnotation, node);\n this.token(\")\");\n}\n\nexport function Variance(this: Printer, node: t.Variance) {\n if (node.kind === \"plus\") {\n this.token(\"+\");\n } else {\n this.token(\"-\");\n }\n}\n\nexport function VoidTypeAnnotation(this: Printer) {\n this.word(\"void\");\n}\n\nexport function IndexedAccessType(this: Printer, node: t.IndexedAccessType) {\n this.print(node.objectType, node, true);\n this.token(\"[\");\n this.print(node.indexType, node);\n this.token(\"]\");\n}\n\nexport function OptionalIndexedAccessType(\n this: Printer,\n node: t.OptionalIndexedAccessType,\n) {\n this.print(node.objectType, node);\n if (node.optional) {\n this.token(\"?.\");\n }\n this.token(\"[\");\n this.print(node.indexType, node);\n this.token(\"]\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;AAidA;;;EAndSA,0B;EAA4BC;;;AAI9B,SAASC,iBAAT,GAA0C;EAC/C,KAAKC,IAAL,CAAU,KAAV;AACD;;AAEM,SAASC,mBAAT,CAELC,IAFK,EAGL;EACA,KAAKC,KAAL,CAAWD,IAAI,CAACE,WAAhB,EAA6BF,IAA7B,EAAmC,IAAnC;EACA,KAAKG,SAAL;EACA,KAAKA,SAAL;AACD;;AAEM,SAASC,qBAAT,GAA8C;EACnD,KAAKN,IAAL,CAAU,SAAV;AACD;;AAEM,SAASO,4BAAT,CAELL,IAFK,EAGL;EACA,KAAKF,IAAL,CAAUE,IAAI,CAACM,KAAL,GAAa,MAAb,GAAsB,OAAhC;AACD;;AAEM,SAASC,yBAAT,GAAkD;EACvD,KAAKT,IAAL,CAAU,MAAV;AACD;;AAEM,SAASU,YAAT,CAELR,IAFK,EAGLS,MAHK,EAIL;EACA,IAAI,CAACd,0BAA0B,CAACc,MAAD,CAA/B,EAAyC;IACvC,KAAKX,IAAL,CAAU,SAAV;IACA,KAAKY,KAAL;EACD;;EACD,KAAKZ,IAAL,CAAU,OAAV;EACA,KAAKY,KAAL;;EACA,KAAKC,aAAL,CAAmBX,IAAnB;AACD;;AAEM,SAASY,eAAT,CAELZ,IAFK,EAGLS,MAHK,EAIL;EACA,IAAI,CAACd,0BAA0B,CAACc,MAAD,CAA/B,EAAyC;IACvC,KAAKX,IAAL,CAAU,SAAV;IACA,KAAKY,KAAL;EACD;;EACD,KAAKZ,IAAL,CAAU,UAAV;EACA,KAAKY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AAL,CAAWD,IAAI,CAACsI,UAAhB,EAA4BtI,IAA5B,EAAkC,IAAlC;EACA,KAAKG,SAAL;EACA,KAAKF,KAAL,CAAWD,IAAI,CAACuI,SAAhB,EAA2BvI,IAA3B;EACA,KAAKG,SAAL;AACD;;AAEM,SAASqI,yBAAT,CAELxI,IAFK,EAGL;EACA,KAAKC,KAAL,CAAWD,IAAI,CAACsI,UAAhB,EAA4BtI,IAA5B;;EACA,IAAIA,IAAI,CAAC0E,QAAT,EAAmB;IACjB,KAAKvE,KAAL,CAAW,IAAX;EACD;;EACD,KAAKA,SAAL;EACA,KAAKF,KAAL,CAAWD,IAAI,CAACuI,SAAhB,EAA2BvI,IAA3B;EACA,KAAKG,SAAL;AACD"} \ No newline at end of file +{"version":3,"names":["isDeclareExportDeclaration","isStatement","AnyTypeAnnotation","word","ArrayTypeAnnotation","node","print","elementType","token","BooleanTypeAnnotation","BooleanLiteralTypeAnnotation","value","NullLiteralTypeAnnotation","DeclareClass","parent","space","_interfaceish","DeclareFunction","id","typeAnnotation","predicate","semicolon","InferredPredicate","DeclaredPredicate","DeclareInterface","InterfaceDeclaration","DeclareModule","body","DeclareModuleExports","DeclareTypeAlias","TypeAlias","DeclareOpaqueType","OpaqueType","DeclareVariable","DeclareExportDeclaration","default","FlowExportDeclaration","call","DeclareExportAllDeclaration","ExportAllDeclaration","EnumDeclaration","enumExplicitType","context","name","hasExplicitType","enumBody","members","indent","newline","member","hasUnknownMembers","dedent","EnumBooleanBody","explicitType","EnumNumberBody","EnumStringBody","EnumSymbolBody","EnumDefaultedMember","enumInitializedMember","init","EnumBooleanMember","EnumNumberMember","EnumStringMember","declaration","declar","specifiers","length","printList","source","ExistsTypeAnnotation","FunctionTypeAnnotation","typeParameters","this","params","rest","type","method","returnType","FunctionTypeParam","optional","InterfaceExtends","extends","mixins","implements","_variance","variance","kind","andSeparator","InterfaceTypeAnnotation","IntersectionTypeAnnotation","printJoin","types","separator","MixedTypeAnnotation","EmptyTypeAnnotation","NullableTypeAnnotation","NumberTypeAnnotation","StringTypeAnnotation","ThisTypeAnnotation","TupleTypeAnnotation","TypeofTypeAnnotation","argument","right","TypeAnnotation","TypeParameterInstantiation","TypeParameter","bound","supertype","impltype","ObjectTypeAnnotation","exact","props","properties","callProperties","indexers","internalSlots","addNewlines","leading","statement","iterator","inexact","ObjectTypeInternalSlot","static","ObjectTypeCallProperty","ObjectTypeIndexer","key","ObjectTypeProperty","proto","ObjectTypeSpreadProperty","QualifiedTypeIdentifier","qualification","SymbolTypeAnnotation","orSeparator","UnionTypeAnnotation","TypeCastExpression","expression","Variance","VoidTypeAnnotation","IndexedAccessType","objectType","indexType","OptionalIndexedAccessType"],"sources":["../../src/generators/flow.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport { isDeclareExportDeclaration, isStatement } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport { ExportAllDeclaration } from \"./modules\";\n\nexport function AnyTypeAnnotation(this: Printer) {\n this.word(\"any\");\n}\n\nexport function ArrayTypeAnnotation(\n this: Printer,\n node: t.ArrayTypeAnnotation,\n) {\n this.print(node.elementType, node, true);\n this.token(\"[\");\n this.token(\"]\");\n}\n\nexport function BooleanTypeAnnotation(this: Printer) {\n this.word(\"boolean\");\n}\n\nexport function BooleanLiteralTypeAnnotation(\n this: Printer,\n node: t.BooleanLiteralTypeAnnotation,\n) {\n this.word(node.value ? \"true\" : \"false\");\n}\n\nexport function NullLiteralTypeAnnotation(this: Printer) {\n this.word(\"null\");\n}\n\nexport function DeclareClass(\n this: Printer,\n node: t.DeclareClass,\n parent: t.Node,\n) {\n if (!isDeclareExportDeclaration(parent)) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"class\");\n this.space();\n this._interfaceish(node);\n}\n\nexport function DeclareFunction(\n this: Printer,\n node: t.DeclareFunction,\n parent: t.Node,\n) {\n if (!isDeclareExportDeclaration(parent)) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"function\");\n this.space();\n this.print(node.id, node);\n // @ts-ignore(Babel 7 vs Babel 8) TODO(Babel 8) Remove this comment, since we'll remove the Noop node\n this.print(node.id.typeAnnotation.typeAnnotation, node);\n\n if (node.predicate) {\n this.space();\n this.print(node.predicate, node);\n }\n\n this.semicolon();\n}\n\nexport function InferredPredicate(this: Printer) {\n this.token(\"%\");\n this.word(\"checks\");\n}\n\nexport function DeclaredPredicate(this: Printer, node: t.DeclaredPredicate) {\n this.token(\"%\");\n this.word(\"checks\");\n this.token(\"(\");\n this.print(node.value, node);\n this.token(\")\");\n}\n\nexport function DeclareInterface(this: Printer, node: t.DeclareInterface) {\n this.word(\"declare\");\n this.space();\n this.InterfaceDeclaration(node);\n}\n\nexport function DeclareModule(this: Printer, node: t.DeclareModule) {\n this.word(\"declare\");\n this.space();\n this.word(\"module\");\n this.space();\n this.print(node.id, node);\n this.space();\n this.print(node.body, node);\n}\n\nexport function DeclareModuleExports(\n this: Printer,\n node: t.DeclareModuleExports,\n) {\n this.word(\"declare\");\n this.space();\n this.word(\"module\");\n this.token(\".\");\n this.word(\"exports\");\n this.print(node.typeAnnotation, node);\n}\n\nexport function DeclareTypeAlias(this: Printer, node: t.DeclareTypeAlias) {\n this.word(\"declare\");\n this.space();\n this.TypeAlias(node);\n}\n\nexport function DeclareOpaqueType(\n this: Printer,\n node: t.DeclareOpaqueType,\n parent: t.Node,\n) {\n if (!isDeclareExportDeclaration(parent)) {\n this.word(\"declare\");\n this.space();\n }\n this.OpaqueType(node);\n}\n\nexport function DeclareVariable(\n this: Printer,\n node: t.DeclareVariable,\n parent: t.Node,\n) {\n if (!isDeclareExportDeclaration(parent)) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"var\");\n this.space();\n this.print(node.id, node);\n this.print(node.id.typeAnnotation, node);\n this.semicolon();\n}\n\nexport function DeclareExportDeclaration(\n this: Printer,\n node: t.DeclareExportDeclaration,\n) {\n this.word(\"declare\");\n this.space();\n this.word(\"export\");\n this.space();\n if (node.default) {\n this.word(\"default\");\n this.space();\n }\n\n FlowExportDeclaration.call(this, node);\n}\n\nexport function DeclareExportAllDeclaration(\n this: Printer,\n node: t.DeclareExportAllDeclaration,\n) {\n this.word(\"declare\");\n this.space();\n ExportAllDeclaration.call(this, node);\n}\n\nexport function EnumDeclaration(this: Printer, node: t.EnumDeclaration) {\n const { id, body } = node;\n this.word(\"enum\");\n this.space();\n this.print(id, node);\n this.print(body, node);\n}\n\nfunction enumExplicitType(\n context: Printer,\n name: string,\n hasExplicitType: boolean,\n) {\n if (hasExplicitType) {\n context.space();\n context.word(\"of\");\n context.space();\n context.word(name);\n }\n context.space();\n}\n\nfunction enumBody(context: Printer, node: t.EnumBody) {\n const { members } = node;\n context.token(\"{\");\n context.indent();\n context.newline();\n for (const member of members) {\n context.print(member, node);\n context.newline();\n }\n if (node.hasUnknownMembers) {\n context.token(\"...\");\n context.newline();\n }\n context.dedent();\n context.token(\"}\");\n}\n\nexport function EnumBooleanBody(this: Printer, node: t.EnumBooleanBody) {\n const { explicitType } = node;\n enumExplicitType(this, \"boolean\", explicitType);\n enumBody(this, node);\n}\n\nexport function EnumNumberBody(this: Printer, node: t.EnumNumberBody) {\n const { explicitType } = node;\n enumExplicitType(this, \"number\", explicitType);\n enumBody(this, node);\n}\n\nexport function EnumStringBody(this: Printer, node: t.EnumStringBody) {\n const { explicitType } = node;\n enumExplicitType(this, \"string\", explicitType);\n enumBody(this, node);\n}\n\nexport function EnumSymbolBody(this: Printer, node: t.EnumSymbolBody) {\n enumExplicitType(this, \"symbol\", true);\n enumBody(this, node);\n}\n\nexport function EnumDefaultedMember(\n this: Printer,\n node: t.EnumDefaultedMember,\n) {\n const { id } = node;\n this.print(id, node);\n this.token(\",\");\n}\n\nfunction enumInitializedMember(\n context: Printer,\n node: t.EnumBooleanMember | t.EnumNumberMember | t.EnumStringMember,\n) {\n const { id, init } = node;\n context.print(id, node);\n context.space();\n context.token(\"=\");\n context.space();\n context.print(init, node);\n context.token(\",\");\n}\n\nexport function EnumBooleanMember(this: Printer, node: t.EnumBooleanMember) {\n enumInitializedMember(this, node);\n}\n\nexport function EnumNumberMember(this: Printer, node: t.EnumNumberMember) {\n enumInitializedMember(this, node);\n}\n\nexport function EnumStringMember(this: Printer, node: t.EnumStringMember) {\n enumInitializedMember(this, node);\n}\n\nfunction FlowExportDeclaration(\n this: Printer,\n node: t.DeclareExportDeclaration,\n) {\n if (node.declaration) {\n const declar = node.declaration;\n this.print(declar, node);\n if (!isStatement(declar)) this.semicolon();\n } else {\n this.token(\"{\");\n if (node.specifiers.length) {\n this.space();\n this.printList(node.specifiers, node);\n this.space();\n }\n this.token(\"}\");\n\n if (node.source) {\n this.space();\n this.word(\"from\");\n this.space();\n this.print(node.source, node);\n }\n\n this.semicolon();\n }\n}\n\nexport function ExistsTypeAnnotation(this: Printer) {\n this.token(\"*\");\n}\n\nexport function FunctionTypeAnnotation(\n this: Printer,\n node: t.FunctionTypeAnnotation,\n parent: t.Node | void,\n) {\n this.print(node.typeParameters, node);\n this.token(\"(\");\n\n if (node.this) {\n this.word(\"this\");\n this.token(\":\");\n this.space();\n this.print(node.this.typeAnnotation, node);\n if (node.params.length || node.rest) {\n this.token(\",\");\n this.space();\n }\n }\n\n this.printList(node.params, node);\n\n if (node.rest) {\n if (node.params.length) {\n this.token(\",\");\n this.space();\n }\n this.token(\"...\");\n this.print(node.rest, node);\n }\n\n this.token(\")\");\n\n // this node type is overloaded, not sure why but it makes it EXTREMELY annoying\n if (\n parent &&\n (parent.type === \"ObjectTypeCallProperty\" ||\n parent.type === \"ObjectTypeInternalSlot\" ||\n parent.type === \"DeclareFunction\" ||\n (parent.type === \"ObjectTypeProperty\" && parent.method))\n ) {\n this.token(\":\");\n } else {\n this.space();\n this.token(\"=>\");\n }\n\n this.space();\n this.print(node.returnType, node);\n}\n\nexport function FunctionTypeParam(this: Printer, node: t.FunctionTypeParam) {\n this.print(node.name, node);\n if (node.optional) this.token(\"?\");\n if (node.name) {\n this.token(\":\");\n this.space();\n }\n this.print(node.typeAnnotation, node);\n}\n\nexport function InterfaceExtends(this: Printer, node: t.InterfaceExtends) {\n this.print(node.id, node);\n this.print(node.typeParameters, node, true);\n}\n\nexport {\n InterfaceExtends as ClassImplements,\n InterfaceExtends as GenericTypeAnnotation,\n};\n\nexport function _interfaceish(\n this: Printer,\n node: t.InterfaceDeclaration | t.DeclareInterface | t.DeclareClass,\n) {\n this.print(node.id, node);\n this.print(node.typeParameters, node);\n if (node.extends?.length) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.printList(node.extends, node);\n }\n if (node.mixins && node.mixins.length) {\n this.space();\n this.word(\"mixins\");\n this.space();\n this.printList(node.mixins, node);\n }\n if (node.implements && node.implements.length) {\n this.space();\n this.word(\"implements\");\n this.space();\n this.printList(node.implements, node);\n }\n this.space();\n this.print(node.body, node);\n}\n\nexport function _variance(\n this: Printer,\n node:\n | t.TypeParameter\n | t.ObjectTypeIndexer\n | t.ObjectTypeProperty\n | t.ClassProperty\n | t.ClassPrivateProperty\n | t.ClassAccessorProperty,\n) {\n if (node.variance) {\n if (node.variance.kind === \"plus\") {\n this.token(\"+\");\n } else if (node.variance.kind === \"minus\") {\n this.token(\"-\");\n }\n }\n}\n\nexport function InterfaceDeclaration(\n this: Printer,\n node: t.InterfaceDeclaration | t.DeclareInterface,\n) {\n this.word(\"interface\");\n this.space();\n this._interfaceish(node);\n}\n\nfunction andSeparator(this: Printer) {\n this.space();\n this.token(\"&\");\n this.space();\n}\n\nexport function InterfaceTypeAnnotation(\n this: Printer,\n node: t.InterfaceTypeAnnotation,\n) {\n this.word(\"interface\");\n if (node.extends && node.extends.length) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.printList(node.extends, node);\n }\n this.space();\n this.print(node.body, node);\n}\n\nexport function IntersectionTypeAnnotation(\n this: Printer,\n node: t.IntersectionTypeAnnotation,\n) {\n this.printJoin(node.types, node, { separator: andSeparator });\n}\n\nexport function MixedTypeAnnotation(this: Printer) {\n this.word(\"mixed\");\n}\n\nexport function EmptyTypeAnnotation(this: Printer) {\n this.word(\"empty\");\n}\n\nexport function NullableTypeAnnotation(\n this: Printer,\n node: t.NullableTypeAnnotation,\n) {\n this.token(\"?\");\n this.print(node.typeAnnotation, node);\n}\n\nexport {\n NumericLiteral as NumberLiteralTypeAnnotation,\n StringLiteral as StringLiteralTypeAnnotation,\n} from \"./types\";\n\nexport function NumberTypeAnnotation(this: Printer) {\n this.word(\"number\");\n}\n\nexport function StringTypeAnnotation(this: Printer) {\n this.word(\"string\");\n}\n\nexport function ThisTypeAnnotation(this: Printer) {\n this.word(\"this\");\n}\n\nexport function TupleTypeAnnotation(\n this: Printer,\n node: t.TupleTypeAnnotation,\n) {\n this.token(\"[\");\n this.printList(node.types, node);\n this.token(\"]\");\n}\n\nexport function TypeofTypeAnnotation(\n this: Printer,\n node: t.TypeofTypeAnnotation,\n) {\n this.word(\"typeof\");\n this.space();\n this.print(node.argument, node);\n}\n\nexport function TypeAlias(\n this: Printer,\n node: t.TypeAlias | t.DeclareTypeAlias,\n) {\n this.word(\"type\");\n this.space();\n this.print(node.id, node);\n this.print(node.typeParameters, node);\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.right, node);\n this.semicolon();\n}\n\nexport function TypeAnnotation(this: Printer, node: t.TypeAnnotation) {\n this.token(\":\");\n this.space();\n // @ts-expect-error todo(flow->ts) can this be removed? `.optional` looks to be not existing property\n if (node.optional) this.token(\"?\");\n this.print(node.typeAnnotation, node);\n}\n\nexport function TypeParameterInstantiation(\n this: Printer,\n node: t.TypeParameterInstantiation,\n): void {\n this.token(\"<\");\n this.printList(node.params, node, {});\n this.token(\">\");\n}\n\nexport { TypeParameterInstantiation as TypeParameterDeclaration };\n\nexport function TypeParameter(this: Printer, node: t.TypeParameter) {\n this._variance(node);\n\n this.word(node.name);\n\n if (node.bound) {\n this.print(node.bound, node);\n }\n\n if (node.default) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.default, node);\n }\n}\n\nexport function OpaqueType(\n this: Printer,\n node: t.OpaqueType | t.DeclareOpaqueType,\n) {\n this.word(\"opaque\");\n this.space();\n this.word(\"type\");\n this.space();\n this.print(node.id, node);\n this.print(node.typeParameters, node);\n if (node.supertype) {\n this.token(\":\");\n this.space();\n this.print(node.supertype, node);\n }\n\n if (node.impltype) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.impltype, node);\n }\n this.semicolon();\n}\n\nexport function ObjectTypeAnnotation(\n this: Printer,\n node: t.ObjectTypeAnnotation,\n) {\n if (node.exact) {\n this.token(\"{|\");\n } else {\n this.token(\"{\");\n }\n\n // TODO: remove the array fallbacks and instead enforce the types to require an array\n const props = [\n ...node.properties,\n ...(node.callProperties || []),\n ...(node.indexers || []),\n ...(node.internalSlots || []),\n ];\n\n if (props.length) {\n this.newline();\n\n this.space();\n\n this.printJoin(props, node, {\n addNewlines(leading) {\n if (leading && !props[0]) return 1;\n },\n indent: true,\n statement: true,\n iterator: () => {\n if (props.length !== 1 || node.inexact) {\n this.token(\",\");\n this.space();\n }\n },\n });\n\n this.space();\n }\n\n if (node.inexact) {\n this.indent();\n this.token(\"...\");\n if (props.length) {\n this.newline();\n }\n this.dedent();\n }\n\n if (node.exact) {\n this.token(\"|}\");\n } else {\n this.token(\"}\");\n }\n}\n\nexport function ObjectTypeInternalSlot(\n this: Printer,\n node: t.ObjectTypeInternalSlot,\n) {\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n this.token(\"[\");\n this.token(\"[\");\n this.print(node.id, node);\n this.token(\"]\");\n this.token(\"]\");\n if (node.optional) this.token(\"?\");\n if (!node.method) {\n this.token(\":\");\n this.space();\n }\n this.print(node.value, node);\n}\n\nexport function ObjectTypeCallProperty(\n this: Printer,\n node: t.ObjectTypeCallProperty,\n) {\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n this.print(node.value, node);\n}\n\nexport function ObjectTypeIndexer(this: Printer, node: t.ObjectTypeIndexer) {\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n this._variance(node);\n this.token(\"[\");\n if (node.id) {\n this.print(node.id, node);\n this.token(\":\");\n this.space();\n }\n this.print(node.key, node);\n this.token(\"]\");\n this.token(\":\");\n this.space();\n this.print(node.value, node);\n}\n\nexport function ObjectTypeProperty(this: Printer, node: t.ObjectTypeProperty) {\n if (node.proto) {\n this.word(\"proto\");\n this.space();\n }\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n if (node.kind === \"get\" || node.kind === \"set\") {\n this.word(node.kind);\n this.space();\n }\n this._variance(node);\n this.print(node.key, node);\n if (node.optional) this.token(\"?\");\n if (!node.method) {\n this.token(\":\");\n this.space();\n }\n this.print(node.value, node);\n}\n\nexport function ObjectTypeSpreadProperty(\n this: Printer,\n node: t.ObjectTypeSpreadProperty,\n) {\n this.token(\"...\");\n this.print(node.argument, node);\n}\n\nexport function QualifiedTypeIdentifier(\n this: Printer,\n node: t.QualifiedTypeIdentifier,\n) {\n this.print(node.qualification, node);\n this.token(\".\");\n this.print(node.id, node);\n}\n\nexport function SymbolTypeAnnotation(this: Printer) {\n this.word(\"symbol\");\n}\n\nfunction orSeparator(this: Printer) {\n this.space();\n this.token(\"|\");\n this.space();\n}\n\nexport function UnionTypeAnnotation(\n this: Printer,\n node: t.UnionTypeAnnotation,\n) {\n this.printJoin(node.types, node, { separator: orSeparator });\n}\n\nexport function TypeCastExpression(this: Printer, node: t.TypeCastExpression) {\n this.token(\"(\");\n this.print(node.expression, node);\n this.print(node.typeAnnotation, node);\n this.token(\")\");\n}\n\nexport function Variance(this: Printer, node: t.Variance) {\n if (node.kind === \"plus\") {\n this.token(\"+\");\n } else {\n this.token(\"-\");\n }\n}\n\nexport function VoidTypeAnnotation(this: Printer) {\n this.word(\"void\");\n}\n\nexport function IndexedAccessType(this: Printer, node: t.IndexedAccessType) {\n this.print(node.objectType, node, true);\n this.token(\"[\");\n this.print(node.indexType, node);\n this.token(\"]\");\n}\n\nexport function OptionalIndexedAccessType(\n this: Printer,\n node: t.OptionalIndexedAccessType,\n) {\n this.print(node.objectType, node);\n if (node.optional) {\n this.token(\"?.\");\n }\n this.token(\"[\");\n this.print(node.indexType, node);\n this.token(\"]\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AAEA;AAidA;AAGiB;EAtdRA,0BAA0B;EAAEC;AAAW;AAIzC,SAASC,iBAAiB,GAAgB;EAC/C,IAAI,CAACC,IAAI,CAAC,KAAK,CAAC;AAClB;AAEO,SAASC,mBAAmB,CAEjCC,IAA2B,EAC3B;EACA,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,WAAW,EAAEF,IAAI,EAAE,IAAI,CAAC;EACxC,IAAI,CAACG,SAAK,IAAK;EACf,IAAI,CAACA,SAAK,IAAK;AACjB;AAEO,SAASC,qBAAqB,GAAgB;EACnD,IAAI,CAACN,IAAI,CAAC,SAAS,CAAC;AACtB;AAEO,SAASO,4BAA4B,CAE1CL,IAAoC,EACpC;EACA,IAAI,CAACF,IAAI,CAACE,IAAI,CAACM,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAC1C;AAEO,SAASC,yBAAyB,GAAgB;EACvD,IAAI,CAACT,IAAI,CAAC,MAAM,CAAC;AACnB;AAEO,SAASU,YAAY,CAE1BR,IAAoB,EACpBS,MAAc,EACd;EACA,IAAI,CAACd,0BAA0B,CAACc,MAAM,CAAC,EAAE;IACvC,IAAI,CAACX,IAAI,CAAC,SAAS,CAAC;IACpB,IAAI,CAACY,KAAK,EAAE;EACd;EACA,IAAI,CAACZ,IAAI,CAAC,OAAO,CAAC;EAClB,IAAI,CAACY,KAAK,EAAE;EACZ,IAAI,CAACC,aAAa,CAACX,IAAI,CAAC;AAC1B;AAEO,SAASY,eAAe,CAE7BZ,IAAuB,EACvBS,MAAc,EACd;EACA,IAAI,CAACd,0BAA0B,CAACc,MAAM,CAAC,EAAE;IACvC,IAAI,CAACX,IAAI,CAAC,SAAS,CAAC;IACpB,IAAI,CAACY,K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,EAAEd,IAAI,CAAC;EACrC,IAAI,CAACG,SAAK,IAAK;AACjB;AAEO,SAASgI,QAAQ,CAAgBnI,IAAgB,EAAE;EACxD,IAAIA,IAAI,CAACiF,IAAI,KAAK,MAAM,EAAE;IACxB,IAAI,CAAC9E,SAAK,IAAK;EACjB,CAAC,MAAM;IACL,IAAI,CAACA,SAAK,IAAK;EACjB;AACF;AAEO,SAASiI,kBAAkB,GAAgB;EAChD,IAAI,CAACtI,IAAI,CAAC,MAAM,CAAC;AACnB;AAEO,SAASuI,iBAAiB,CAAgBrI,IAAyB,EAAE;EAC1E,IAAI,CAACC,KAAK,CAACD,IAAI,CAACsI,UAAU,EAAEtI,IAAI,EAAE,IAAI,CAAC;EACvC,IAAI,CAACG,SAAK,IAAK;EACf,IAAI,CAACF,KAAK,CAACD,IAAI,CAACuI,SAAS,EAAEvI,IAAI,CAAC;EAChC,IAAI,CAACG,SAAK,IAAK;AACjB;AAEO,SAASqI,yBAAyB,CAEvCxI,IAAiC,EACjC;EACA,IAAI,CAACC,KAAK,CAACD,IAAI,CAACsI,UAAU,EAAEtI,IAAI,CAAC;EACjC,IAAIA,IAAI,CAAC0E,QAAQ,EAAE;IACjB,IAAI,CAACvE,KAAK,CAAC,IAAI,CAAC;EAClB;EACA,IAAI,CAACA,SAAK,IAAK;EACf,IAAI,CAACF,KAAK,CAACD,IAAI,CAACuI,SAAS,EAAEvI,IAAI,CAAC;EAChC,IAAI,CAACG,SAAK,IAAK;AACjB"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/index.js b/node_modules/@babel/generator/lib/generators/index.js index 97e73ba27..25ad36b14 100644 --- a/node_modules/@babel/generator/lib/generators/index.js +++ b/node_modules/@babel/generator/lib/generators/index.js @@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); - var _templateLiterals = require("./template-literals"); - Object.keys(_templateLiterals).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _templateLiterals[key]) return; @@ -16,9 +14,7 @@ Object.keys(_templateLiterals).forEach(function (key) { } }); }); - var _expressions = require("./expressions"); - Object.keys(_expressions).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _expressions[key]) return; @@ -29,9 +25,7 @@ Object.keys(_expressions).forEach(function (key) { } }); }); - var _statements = require("./statements"); - Object.keys(_statements).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _statements[key]) return; @@ -42,9 +36,7 @@ Object.keys(_statements).forEach(function (key) { } }); }); - var _classes = require("./classes"); - Object.keys(_classes).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _classes[key]) return; @@ -55,9 +47,7 @@ Object.keys(_classes).forEach(function (key) { } }); }); - var _methods = require("./methods"); - Object.keys(_methods).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _methods[key]) return; @@ -68,9 +58,7 @@ Object.keys(_methods).forEach(function (key) { } }); }); - var _modules = require("./modules"); - Object.keys(_modules).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _modules[key]) return; @@ -81,9 +69,7 @@ Object.keys(_modules).forEach(function (key) { } }); }); - var _types = require("./types"); - Object.keys(_types).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _types[key]) return; @@ -94,9 +80,7 @@ Object.keys(_types).forEach(function (key) { } }); }); - var _flow = require("./flow"); - Object.keys(_flow).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _flow[key]) return; @@ -107,9 +91,7 @@ Object.keys(_flow).forEach(function (key) { } }); }); - var _base = require("./base"); - Object.keys(_base).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _base[key]) return; @@ -120,9 +102,7 @@ Object.keys(_base).forEach(function (key) { } }); }); - var _jsx = require("./jsx"); - Object.keys(_jsx).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _jsx[key]) return; @@ -133,9 +113,7 @@ Object.keys(_jsx).forEach(function (key) { } }); }); - var _typescript = require("./typescript"); - Object.keys(_typescript).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _typescript[key]) return; diff --git a/node_modules/@babel/generator/lib/generators/index.js.map b/node_modules/@babel/generator/lib/generators/index.js.map index e272e47a4..a03022f0e 100644 --- a/node_modules/@babel/generator/lib/generators/index.js.map +++ b/node_modules/@babel/generator/lib/generators/index.js.map @@ -1 +1 @@ -{"version":3,"names":[],"sources":["../../src/generators/index.ts"],"sourcesContent":["export * from \"./template-literals\";\nexport * from \"./expressions\";\nexport * from \"./statements\";\nexport * from \"./classes\";\nexport * from \"./methods\";\nexport * from \"./modules\";\nexport * from \"./types\";\nexport * from \"./flow\";\nexport * from \"./base\";\nexport * from \"./jsx\";\nexport * from \"./typescript\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"} \ No newline at end of file +{"version":3,"names":[],"sources":["../../src/generators/index.ts"],"sourcesContent":["export * from \"./template-literals\";\nexport * from \"./expressions\";\nexport * from \"./statements\";\nexport * from \"./classes\";\nexport * from \"./methods\";\nexport * from \"./modules\";\nexport * from \"./types\";\nexport * from \"./flow\";\nexport * from \"./base\";\nexport * from \"./jsx\";\nexport * from \"./typescript\";\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/jsx.js b/node_modules/@babel/generator/lib/generators/jsx.js index 363a14551..4b8dd7a76 100644 --- a/node_modules/@babel/generator/lib/generators/jsx.js +++ b/node_modules/@babel/generator/lib/generators/jsx.js @@ -18,92 +18,75 @@ exports.JSXOpeningFragment = JSXOpeningFragment; exports.JSXSpreadAttribute = JSXSpreadAttribute; exports.JSXSpreadChild = JSXSpreadChild; exports.JSXText = JSXText; - function JSXAttribute(node) { this.print(node.name, node); - if (node.value) { this.tokenChar(61); this.print(node.value, node); } } - function JSXIdentifier(node) { this.word(node.name); } - function JSXNamespacedName(node) { this.print(node.namespace, node); this.tokenChar(58); this.print(node.name, node); } - function JSXMemberExpression(node) { this.print(node.object, node); this.tokenChar(46); this.print(node.property, node); } - function JSXSpreadAttribute(node) { this.tokenChar(123); this.token("..."); this.print(node.argument, node); this.tokenChar(125); } - function JSXExpressionContainer(node) { this.tokenChar(123); this.print(node.expression, node); this.tokenChar(125); } - function JSXSpreadChild(node) { this.tokenChar(123); this.token("..."); this.print(node.expression, node); this.tokenChar(125); } - function JSXText(node) { const raw = this.getPossibleRaw(node); - if (raw !== undefined) { this.token(raw, true); } else { this.token(node.value, true); } } - function JSXElement(node) { const open = node.openingElement; this.print(open, node); if (open.selfClosing) return; this.indent(); - for (const child of node.children) { this.print(child, node); } - this.dedent(); this.print(node.closingElement, node); } - function spaceSeparator() { this.space(); } - function JSXOpeningElement(node) { this.tokenChar(60); this.print(node.name, node); this.print(node.typeParameters, node); - if (node.attributes.length > 0) { this.space(); this.printJoin(node.attributes, node, { separator: spaceSeparator }); } - if (node.selfClosing) { this.space(); this.token("/>"); @@ -111,34 +94,27 @@ function JSXOpeningElement(node) { this.tokenChar(62); } } - function JSXClosingElement(node) { this.token(" 0) {\n this.space();\n this.printJoin(node.attributes, node, { separator: spaceSeparator });\n }\n if (node.selfClosing) {\n this.space();\n this.token(\"/>\");\n } else {\n this.token(\">\");\n }\n}\n\nexport function JSXClosingElement(this: Printer, node: t.JSXClosingElement) {\n this.token(\"\");\n}\n\nexport function JSXEmptyExpression(this: Printer, node: t.JSXEmptyExpression) {\n this.printInnerComments(node);\n}\n\nexport function JSXFragment(this: Printer, node: t.JSXFragment) {\n this.print(node.openingFragment, node);\n\n this.indent();\n for (const child of node.children) {\n this.print(child, node);\n }\n this.dedent();\n\n this.print(node.closingFragment, node);\n}\n\nexport function JSXOpeningFragment(this: Printer) {\n this.token(\"<\");\n this.token(\">\");\n}\n\nexport function JSXClosingFragment(this: Printer) {\n this.token(\"\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGO,SAASA,YAAT,CAAqCC,IAArC,EAA2D;EAChE,KAAKC,KAAL,CAAWD,IAAI,CAACE,IAAhB,EAAsBF,IAAtB;;EACA,IAAIA,IAAI,CAACG,KAAT,EAAgB;IACd,KAAKC,SAAL;IACA,KAAKH,KAAL,CAAWD,IAAI,CAACG,KAAhB,EAAuBH,IAAvB;EACD;AACF;;AAEM,SAASK,aAAT,CAAsCL,IAAtC,EAA6D;EAClE,KAAKM,IAAL,CAAUN,IAAI,CAACE,IAAf;AACD;;AAEM,SAASK,iBAAT,CAA0CP,IAA1C,EAAqE;EAC1E,KAAKC,KAAL,CAAWD,IAAI,CAACQ,SAAhB,EAA2BR,IAA3B;EACA,KAAKI,SAAL;EACA,KAAKH,KAAL,CAAWD,IAAI,CAACE,IAAhB,EAAsBF,IAAtB;AACD;;AAEM,SAASS,mBAAT,CAELT,IAFK,EAGL;EACA,KAAKC,KAAL,CAAWD,IAAI,CAACU,MAAhB,EAAwBV,IAAxB;EACA,KAAKI,SAAL;EACA,KAAKH,KAAL,CAAWD,IAAI,CAACW,QAAhB,EAA0BX,IAA1B;AACD;;AAEM,SAASY,kBAAT,CAA2CZ,IAA3C,EAAuE;EAC5E,KAAKI,SAAL;EACA,KAAKA,KAAL,CAAW,KAAX;EACA,KAAKH,KAAL,CAAWD,IAAI,CAACa,QAAhB,EAA0Bb,IAA1B;EACA,KAAKI,SAAL;AACD;;AAEM,SAASU,sBAAT,CAELd,IAFK,EAGL;EACA,KAAKI,SAAL;EACA,KAAKH,KAAL,CAAWD,IAAI,CAACe,UAAhB,EAA4Bf,IAA5B;EACA,KAAKI,SAAL;AACD;;AAEM,SAASY,cAAT,CAAuChB,IAAvC,EAA+D;EACpE,KAAK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AS,EAAEP;IAAb,CAAtC;EACD;;EACD,IAAI9B,IAAI,CAACwB,WAAT,EAAsB;IACpB,KAAKO,KAAL;IACA,KAAK3B,KAAL,CAAW,IAAX;EACD,CAHD,MAGO;IACL,KAAKA,SAAL;EACD;AACF;;AAEM,SAASkC,iBAAT,CAA0CtC,IAA1C,EAAqE;EAC1E,KAAKI,KAAL,CAAW,IAAX;EACA,KAAKH,KAAL,CAAWD,IAAI,CAACE,IAAhB,EAAsBF,IAAtB;EACA,KAAKI,SAAL;AACD;;AAEM,SAASmC,kBAAT,CAA2CvC,IAA3C,EAAuE;EAC5E,KAAKwC,kBAAL,CAAwBxC,IAAxB;AACD;;AAEM,SAASyC,WAAT,CAAoCzC,IAApC,EAAyD;EAC9D,KAAKC,KAAL,CAAWD,IAAI,CAAC0C,eAAhB,EAAiC1C,IAAjC;EAEA,KAAKyB,MAAL;;EACA,KAAK,MAAMC,KAAX,IAAoB1B,IAAI,CAAC2B,QAAzB,EAAmC;IACjC,KAAK1B,KAAL,CAAWyB,KAAX,EAAkB1B,IAAlB;EACD;;EACD,KAAK4B,MAAL;EAEA,KAAK3B,KAAL,CAAWD,IAAI,CAAC2C,eAAhB,EAAiC3C,IAAjC;AACD;;AAEM,SAAS4C,kBAAT,GAA2C;EAChD,KAAKxC,SAAL;EACA,KAAKA,SAAL;AACD;;AAEM,SAASyC,kBAAT,GAA2C;EAChD,KAAKzC,KAAL,CAAW,IAAX;EACA,KAAKA,SAAL;AACD"} \ No newline at end of file +{"version":3,"names":["JSXAttribute","node","print","name","value","token","JSXIdentifier","word","JSXNamespacedName","namespace","JSXMemberExpression","object","property","JSXSpreadAttribute","argument","JSXExpressionContainer","expression","JSXSpreadChild","JSXText","raw","getPossibleRaw","undefined","JSXElement","open","openingElement","selfClosing","indent","child","children","dedent","closingElement","spaceSeparator","space","JSXOpeningElement","typeParameters","attributes","length","printJoin","separator","JSXClosingElement","JSXEmptyExpression","printInnerComments","JSXFragment","openingFragment","closingFragment","JSXOpeningFragment","JSXClosingFragment"],"sources":["../../src/generators/jsx.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport type * as t from \"@babel/types\";\n\nexport function JSXAttribute(this: Printer, node: t.JSXAttribute) {\n this.print(node.name, node);\n if (node.value) {\n this.token(\"=\");\n this.print(node.value, node);\n }\n}\n\nexport function JSXIdentifier(this: Printer, node: t.JSXIdentifier) {\n this.word(node.name);\n}\n\nexport function JSXNamespacedName(this: Printer, node: t.JSXNamespacedName) {\n this.print(node.namespace, node);\n this.token(\":\");\n this.print(node.name, node);\n}\n\nexport function JSXMemberExpression(\n this: Printer,\n node: t.JSXMemberExpression,\n) {\n this.print(node.object, node);\n this.token(\".\");\n this.print(node.property, node);\n}\n\nexport function JSXSpreadAttribute(this: Printer, node: t.JSXSpreadAttribute) {\n this.token(\"{\");\n this.token(\"...\");\n this.print(node.argument, node);\n this.token(\"}\");\n}\n\nexport function JSXExpressionContainer(\n this: Printer,\n node: t.JSXExpressionContainer,\n) {\n this.token(\"{\");\n this.print(node.expression, node);\n this.token(\"}\");\n}\n\nexport function JSXSpreadChild(this: Printer, node: t.JSXSpreadChild) {\n this.token(\"{\");\n this.token(\"...\");\n this.print(node.expression, node);\n this.token(\"}\");\n}\n\nexport function JSXText(this: Printer, node: t.JSXText) {\n const raw = this.getPossibleRaw(node);\n\n if (raw !== undefined) {\n this.token(raw, true);\n } else {\n this.token(node.value, true);\n }\n}\n\nexport function JSXElement(this: Printer, node: t.JSXElement) {\n const open = node.openingElement;\n this.print(open, node);\n if (open.selfClosing) return;\n\n this.indent();\n for (const child of node.children) {\n this.print(child, node);\n }\n this.dedent();\n\n this.print(node.closingElement, node);\n}\n\nfunction spaceSeparator(this: Printer) {\n this.space();\n}\n\nexport function JSXOpeningElement(this: Printer, node: t.JSXOpeningElement) {\n this.token(\"<\");\n this.print(node.name, node);\n this.print(node.typeParameters, node); // TS\n if (node.attributes.length > 0) {\n this.space();\n this.printJoin(node.attributes, node, { separator: spaceSeparator });\n }\n if (node.selfClosing) {\n this.space();\n this.token(\"/>\");\n } else {\n this.token(\">\");\n }\n}\n\nexport function JSXClosingElement(this: Printer, node: t.JSXClosingElement) {\n this.token(\"\");\n}\n\nexport function JSXEmptyExpression(this: Printer) {\n // This node is empty, so forcefully print its inner comments.\n this.printInnerComments();\n}\n\nexport function JSXFragment(this: Printer, node: t.JSXFragment) {\n this.print(node.openingFragment, node);\n\n this.indent();\n for (const child of node.children) {\n this.print(child, node);\n }\n this.dedent();\n\n this.print(node.closingFragment, node);\n}\n\nexport function JSXOpeningFragment(this: Printer) {\n this.token(\"<\");\n this.token(\">\");\n}\n\nexport function JSXClosingFragment(this: Printer) {\n this.token(\"\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAGO,SAASA,YAAY,CAAgBC,IAAoB,EAAE;EAChE,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,IAAI,EAAEF,IAAI,CAAC;EAC3B,IAAIA,IAAI,CAACG,KAAK,EAAE;IACd,IAAI,CAACC,SAAK,IAAK;IACf,IAAI,CAACH,KAAK,CAACD,IAAI,CAACG,KAAK,EAAEH,IAAI,CAAC;EAC9B;AACF;AAEO,SAASK,aAAa,CAAgBL,IAAqB,EAAE;EAClE,IAAI,CAACM,IAAI,CAACN,IAAI,CAACE,IAAI,CAAC;AACtB;AAEO,SAASK,iBAAiB,CAAgBP,IAAyB,EAAE;EAC1E,IAAI,CAACC,KAAK,CAACD,IAAI,CAACQ,SAAS,EAAER,IAAI,CAAC;EAChC,IAAI,CAACI,SAAK,IAAK;EACf,IAAI,CAACH,KAAK,CAACD,IAAI,CAACE,IAAI,EAAEF,IAAI,CAAC;AAC7B;AAEO,SAASS,mBAAmB,CAEjCT,IAA2B,EAC3B;EACA,IAAI,CAACC,KAAK,CAACD,IAAI,CAACU,MAAM,EAAEV,IAAI,CAAC;EAC7B,IAAI,CAACI,SAAK,IAAK;EACf,IAAI,CAACH,KAAK,CAACD,IAAI,CAACW,QAAQ,EAAEX,IAAI,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AAI1B,IAAI,CAAC2B,QAAQ,EAAE;IACjC,IAAI,CAAC1B,KAAK,CAACyB,KAAK,EAAE1B,IAAI,CAAC;EACzB;EACA,IAAI,CAAC4B,MAAM,EAAE;EAEb,IAAI,CAAC3B,KAAK,CAACD,IAAI,CAAC2C,eAAe,EAAE3C,IAAI,CAAC;AACxC;AAEO,SAAS4C,kBAAkB,GAAgB;EAChD,IAAI,CAACxC,SAAK,IAAK;EACf,IAAI,CAACA,SAAK,IAAK;AACjB;AAEO,SAASyC,kBAAkB,GAAgB;EAChD,IAAI,CAACzC,KAAK,CAAC,IAAI,CAAC;EAChB,IAAI,CAACA,SAAK,IAAK;AACjB"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/methods.js b/node_modules/@babel/generator/lib/generators/methods.js index 1018e2152..f0784729e 100644 --- a/node_modules/@babel/generator/lib/generators/methods.js +++ b/node_modules/@babel/generator/lib/generators/methods.js @@ -11,67 +11,58 @@ exports._param = _param; exports._parameters = _parameters; exports._params = _params; exports._predicate = _predicate; - var _t = require("@babel/types"); - const { isIdentifier } = _t; - function _params(node) { this.print(node.typeParameters, node); this.tokenChar(40); - this._parameters(node.params, node); - this.tokenChar(41); - this.print(node.returnType, node, node.type === "ArrowFunctionExpression"); + const noLineTerminator = node.type === "ArrowFunctionExpression"; + this.print(node.returnType, node, noLineTerminator); + this._noLineTerminator = noLineTerminator; } - function _parameters(parameters, parent) { - for (let i = 0; i < parameters.length; i++) { + const paramLength = parameters.length; + for (let i = 0; i < paramLength; i++) { this._param(parameters[i], parent); - if (i < parameters.length - 1) { this.tokenChar(44); this.space(); } } } - function _param(parameter, parent) { this.printJoin(parameter.decorators, parameter); this.print(parameter, parent); - - if (parameter.optional) { + if ( + parameter.optional) { this.tokenChar(63); } - this.print(parameter.typeAnnotation, parameter); + this.print( + parameter.typeAnnotation, parameter); } function _methodHead(node) { const kind = node.kind; const key = node.key; - if (kind === "get" || kind === "set") { this.word(kind); this.space(); } - if (node.async) { - this._catchUp("start", key.loc); - - this.word("async"); + this.word("async", true); this.space(); } - - if (kind === "method" || kind === "init") { + if (kind === "method" || + kind === "init") { if (node.generator) { this.tokenChar(42); } } - if (node.computed) { this.tokenChar(91); this.print(key, node); @@ -79,79 +70,67 @@ function _methodHead(node) { } else { this.print(key, node); } - - if (node.optional) { + if ( + node.optional) { this.tokenChar(63); } - this._params(node); } - -function _predicate(node) { +function _predicate(node, noLineTerminatorAfter) { if (node.predicate) { if (!node.returnType) { this.tokenChar(58); } - this.space(); - this.print(node.predicate, node); + this.print(node.predicate, node, noLineTerminatorAfter); } } - function _functionHead(node) { if (node.async) { this.word("async"); + this._endsWithInnerRaw = false; this.space(); } - this.word("function"); - if (node.generator) this.tokenChar(42); - this.printInnerComments(node); + if (node.generator) { + this._endsWithInnerRaw = false; + this.tokenChar(42); + } this.space(); - if (node.id) { this.print(node.id, node); } - this._params(node); - if (node.type !== "TSDeclareFunction") { this._predicate(node); } } - function FunctionExpression(node) { this._functionHead(node); - this.space(); this.print(node.body, node); } - function ArrowFunctionExpression(node) { if (node.async) { - this.word("async"); + this.word("async", true); this.space(); } - const firstParam = node.params[0]; - - if (!this.format.retainLines && !this.format.auxiliaryCommentBefore && !this.format.auxiliaryCommentAfter && node.params.length === 1 && isIdentifier(firstParam) && !hasTypesOrComments(node, firstParam)) { - this.print(firstParam, node); + let firstParam; + if (!this.format.retainLines && node.params.length === 1 && isIdentifier(firstParam = node.params[0]) && !hasTypesOrComments(node, firstParam)) { + this.print(firstParam, node, true); } else { this._params(node); } - - this._predicate(node); - + this._predicate(node, true); this.space(); + this.printInnerComments(); this.token("=>"); this.space(); this.print(node.body, node); } - function hasTypesOrComments(node, param) { var _param$leadingComment, _param$trailingCommen; - return !!(node.typeParameters || node.returnType || node.predicate || param.typeAnnotation || param.optional || (_param$leadingComment = param.leadingComments) != null && _param$leadingComment.length || (_param$trailingCommen = param.trailingComments) != null && _param$trailingCommen.length); } diff --git a/node_modules/@babel/generator/lib/generators/methods.js.map b/node_modules/@babel/generator/lib/generators/methods.js.map index b058ed77c..c8b10bfcc 100644 --- a/node_modules/@babel/generator/lib/generators/methods.js.map +++ b/node_modules/@babel/generator/lib/generators/methods.js.map @@ -1 +1 @@ -{"version":3,"names":["isIdentifier","_params","node","print","typeParameters","token","_parameters","params","returnType","type","parameters","parent","i","length","_param","space","parameter","printJoin","decorators","optional","typeAnnotation","_methodHead","kind","key","word","async","_catchUp","loc","generator","computed","_predicate","predicate","_functionHead","printInnerComments","id","FunctionExpression","body","ArrowFunctionExpression","firstParam","format","retainLines","auxiliaryCommentBefore","auxiliaryCommentAfter","hasTypesOrComments","param","leadingComments","trailingComments"],"sources":["../../src/generators/methods.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport { isIdentifier } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\nexport function _params(\n this: Printer,\n node: t.Function | t.TSDeclareMethod | t.TSDeclareFunction,\n) {\n this.print(node.typeParameters, node);\n this.token(\"(\");\n this._parameters(node.params, node);\n this.token(\")\");\n\n this.print(node.returnType, node, node.type === \"ArrowFunctionExpression\");\n}\n\nexport function _parameters(\n this: Printer,\n parameters: t.Function[\"params\"],\n parent:\n | t.Function\n | t.TSIndexSignature\n | t.TSDeclareMethod\n | t.TSDeclareFunction\n | t.TSFunctionType\n | t.TSConstructorType,\n) {\n for (let i = 0; i < parameters.length; i++) {\n this._param(parameters[i], parent);\n\n if (i < parameters.length - 1) {\n this.token(\",\");\n this.space();\n }\n }\n}\n\nexport function _param(\n this: Printer,\n parameter: t.Identifier | t.RestElement | t.Pattern | t.TSParameterProperty,\n parent?:\n | t.Function\n | t.TSIndexSignature\n | t.TSDeclareMethod\n | t.TSDeclareFunction\n | t.TSFunctionType\n | t.TSConstructorType,\n) {\n this.printJoin(parameter.decorators, parameter);\n this.print(parameter, parent);\n if (\n // @ts-expect-error optional is not in TSParameterProperty\n parameter.optional\n ) {\n this.token(\"?\"); // TS / flow\n }\n\n this.print(\n // @ts-expect-error typeAnnotation is not in TSParameterProperty\n parameter.typeAnnotation,\n parameter,\n ); // TS / flow\n}\n\nexport function _methodHead(this: Printer, node: t.Method | t.TSDeclareMethod) {\n const kind = node.kind;\n const key = node.key;\n\n if (kind === \"get\" || kind === \"set\") {\n this.word(kind);\n this.space();\n }\n\n if (node.async) {\n // ensure `async` is in the same line with property name\n this._catchUp(\"start\", key.loc);\n this.word(\"async\");\n this.space();\n }\n\n if (\n kind === \"method\" ||\n // @ts-expect-error Fixme: kind: \"init\" is not defined\n kind === \"init\"\n ) {\n if (node.generator) {\n this.token(\"*\");\n }\n }\n\n if (node.computed) {\n this.token(\"[\");\n this.print(key, node);\n this.token(\"]\");\n } else {\n this.print(key, node);\n }\n\n if (\n // @ts-expect-error optional is not in ObjectMethod\n node.optional\n ) {\n // TS\n this.token(\"?\");\n }\n\n this._params(node);\n}\n\nexport function _predicate(\n this: Printer,\n node:\n | t.FunctionDeclaration\n | t.FunctionExpression\n | t.ArrowFunctionExpression,\n) {\n if (node.predicate) {\n if (!node.returnType) {\n this.token(\":\");\n }\n this.space();\n this.print(node.predicate, node);\n }\n}\n\nexport function _functionHead(\n this: Printer,\n node: t.FunctionDeclaration | t.FunctionExpression | t.TSDeclareFunction,\n) {\n if (node.async) {\n this.word(\"async\");\n this.space();\n }\n this.word(\"function\");\n if (node.generator) this.token(\"*\");\n this.printInnerComments(node);\n\n this.space();\n if (node.id) {\n this.print(node.id, node);\n }\n\n this._params(node);\n if (node.type !== \"TSDeclareFunction\") {\n this._predicate(node);\n }\n}\n\nexport function FunctionExpression(this: Printer, node: t.FunctionExpression) {\n this._functionHead(node);\n this.space();\n this.print(node.body, node);\n}\n\nexport { FunctionExpression as FunctionDeclaration };\n\nexport function ArrowFunctionExpression(\n this: Printer,\n node: t.ArrowFunctionExpression,\n) {\n if (node.async) {\n this.word(\"async\");\n this.space();\n }\n\n const firstParam = node.params[0];\n\n // Try to avoid printing parens in simple cases, but only if we're pretty\n // sure that they aren't needed by type annotations or potential newlines.\n if (\n !this.format.retainLines &&\n // Auxiliary comments can introduce unexpected newlines\n !this.format.auxiliaryCommentBefore &&\n !this.format.auxiliaryCommentAfter &&\n node.params.length === 1 &&\n isIdentifier(firstParam) &&\n !hasTypesOrComments(node, firstParam)\n ) {\n this.print(firstParam, node);\n } else {\n this._params(node);\n }\n\n this._predicate(node);\n\n this.space();\n this.token(\"=>\");\n this.space();\n\n this.print(node.body, node);\n}\n\nfunction hasTypesOrComments(\n node: t.ArrowFunctionExpression,\n param: t.Identifier,\n): boolean {\n return !!(\n node.typeParameters ||\n node.returnType ||\n node.predicate ||\n param.typeAnnotation ||\n param.optional ||\n param.leadingComments?.length ||\n param.trailingComments?.length\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AACA;;;EAASA;;;AAGF,SAASC,OAAT,CAELC,IAFK,EAGL;EACA,KAAKC,KAAL,CAAWD,IAAI,CAACE,cAAhB,EAAgCF,IAAhC;EACA,KAAKG,SAAL;;EACA,KAAKC,WAAL,CAAiBJ,IAAI,CAACK,MAAtB,EAA8BL,IAA9B;;EACA,KAAKG,SAAL;EAEA,KAAKF,KAAL,CAAWD,IAAI,CAACM,UAAhB,EAA4BN,IAA5B,EAAkCA,IAAI,CAACO,IAAL,KAAc,yBAAhD;AACD;;AAEM,SAASH,WAAT,CAELI,UAFK,EAGLC,MAHK,EAUL;EACA,KAAK,IAAIC,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGF,UAAU,CAACG,MAA/B,EAAuCD,CAAC,EAAxC,EAA4C;IAC1C,KAAKE,MAAL,CAAYJ,UAAU,CAACE,CAAD,CAAtB,EAA2BD,MAA3B;;IAEA,IAAIC,CAAC,GAAGF,UAAU,CAACG,MAAX,GAAoB,CAA5B,EAA+B;MAC7B,KAAKR,SAAL;MACA,KAAKU,KAAL;IACD;EACF;AACF;;AAEM,SAASD,MAAT,CAELE,SAFK,EAGLL,MAHK,EAUL;EACA,KAAKM,SAAL,CAAeD,SAAS,CAACE,UAAzB,EAAqCF,SAArC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AuBpC,IAAvB;EACD,CAVD,MAUO;IACL,KAAKD,OAAL,CAAaC,IAAb;EACD;;EAED,KAAK4B,UAAL,CAAgB5B,IAAhB;;EAEA,KAAKa,KAAL;EACA,KAAKV,KAAL,CAAW,IAAX;EACA,KAAKU,KAAL;EAEA,KAAKZ,KAAL,CAAWD,IAAI,CAACkC,IAAhB,EAAsBlC,IAAtB;AACD;;AAED,SAASyC,kBAAT,CACEzC,IADF,EAEE0C,KAFF,EAGW;EAAA;;EACT,OAAO,CAAC,EACN1C,IAAI,CAACE,cAAL,IACAF,IAAI,CAACM,UADL,IAEAN,IAAI,CAAC6B,SAFL,IAGAa,KAAK,CAACxB,cAHN,IAIAwB,KAAK,CAACzB,QAJN,6BAKAyB,KAAK,CAACC,eALN,aAKA,sBAAuBhC,MALvB,6BAMA+B,KAAK,CAACE,gBANN,aAMA,sBAAwBjC,MAPlB,CAAR;AASD"} \ No newline at end of file +{"version":3,"names":["isIdentifier","_params","node","print","typeParameters","token","_parameters","params","noLineTerminator","type","returnType","_noLineTerminator","parameters","parent","paramLength","length","i","_param","space","parameter","printJoin","decorators","optional","typeAnnotation","_methodHead","kind","key","word","async","generator","computed","_predicate","noLineTerminatorAfter","predicate","_functionHead","_endsWithInnerRaw","id","FunctionExpression","body","ArrowFunctionExpression","firstParam","format","retainLines","hasTypesOrComments","printInnerComments","param","leadingComments","trailingComments"],"sources":["../../src/generators/methods.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport { isIdentifier } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\nexport function _params(\n this: Printer,\n node: t.Function | t.TSDeclareMethod | t.TSDeclareFunction,\n) {\n this.print(node.typeParameters, node);\n this.token(\"(\");\n this._parameters(node.params, node);\n this.token(\")\");\n\n const noLineTerminator = node.type === \"ArrowFunctionExpression\";\n this.print(node.returnType, node, noLineTerminator);\n\n this._noLineTerminator = noLineTerminator;\n}\n\nexport function _parameters(\n this: Printer,\n parameters: t.Function[\"params\"],\n parent:\n | t.Function\n | t.TSIndexSignature\n | t.TSDeclareMethod\n | t.TSDeclareFunction\n | t.TSFunctionType\n | t.TSConstructorType,\n) {\n const paramLength = parameters.length;\n for (let i = 0; i < paramLength; i++) {\n this._param(parameters[i], parent);\n\n if (i < parameters.length - 1) {\n this.token(\",\");\n this.space();\n }\n }\n}\n\nexport function _param(\n this: Printer,\n parameter: t.Identifier | t.RestElement | t.Pattern | t.TSParameterProperty,\n parent?:\n | t.Function\n | t.TSIndexSignature\n | t.TSDeclareMethod\n | t.TSDeclareFunction\n | t.TSFunctionType\n | t.TSConstructorType,\n) {\n this.printJoin(parameter.decorators, parameter);\n this.print(parameter, parent);\n if (\n // @ts-expect-error optional is not in TSParameterProperty\n parameter.optional\n ) {\n this.token(\"?\"); // TS / flow\n }\n\n this.print(\n // @ts-expect-error typeAnnotation is not in TSParameterProperty\n parameter.typeAnnotation,\n parameter,\n ); // TS / flow\n}\n\nexport function _methodHead(this: Printer, node: t.Method | t.TSDeclareMethod) {\n const kind = node.kind;\n const key = node.key;\n\n if (kind === \"get\" || kind === \"set\") {\n this.word(kind);\n this.space();\n }\n\n if (node.async) {\n this.word(\"async\", true);\n this.space();\n }\n\n if (\n kind === \"method\" ||\n // @ts-expect-error Fixme: kind: \"init\" is not defined\n kind === \"init\"\n ) {\n if (node.generator) {\n this.token(\"*\");\n }\n }\n\n if (node.computed) {\n this.token(\"[\");\n this.print(key, node);\n this.token(\"]\");\n } else {\n this.print(key, node);\n }\n\n if (\n // @ts-expect-error optional is not in ObjectMethod\n node.optional\n ) {\n // TS\n this.token(\"?\");\n }\n\n this._params(node);\n}\n\nexport function _predicate(\n this: Printer,\n node:\n | t.FunctionDeclaration\n | t.FunctionExpression\n | t.ArrowFunctionExpression,\n noLineTerminatorAfter?: boolean,\n) {\n if (node.predicate) {\n if (!node.returnType) {\n this.token(\":\");\n }\n this.space();\n this.print(node.predicate, node, noLineTerminatorAfter);\n }\n}\n\nexport function _functionHead(\n this: Printer,\n node: t.FunctionDeclaration | t.FunctionExpression | t.TSDeclareFunction,\n) {\n if (node.async) {\n this.word(\"async\");\n // We prevent inner comments from being printed here,\n // so that they are always consistently printed in the\n // same place regardless of the function type.\n this._endsWithInnerRaw = false;\n this.space();\n }\n this.word(\"function\");\n if (node.generator) {\n // We prevent inner comments from being printed here,\n // so that they are always consistently printed in the\n // same place regardless of the function type.\n this._endsWithInnerRaw = false;\n this.token(\"*\");\n }\n\n this.space();\n if (node.id) {\n this.print(node.id, node);\n }\n\n this._params(node);\n if (node.type !== \"TSDeclareFunction\") {\n this._predicate(node);\n }\n}\n\nexport function FunctionExpression(this: Printer, node: t.FunctionExpression) {\n this._functionHead(node);\n this.space();\n this.print(node.body, node);\n}\n\nexport { FunctionExpression as FunctionDeclaration };\n\nexport function ArrowFunctionExpression(\n this: Printer,\n node: t.ArrowFunctionExpression,\n) {\n if (node.async) {\n this.word(\"async\", true);\n this.space();\n }\n\n // Try to avoid printing parens in simple cases, but only if we're pretty\n // sure that they aren't needed by type annotations or potential newlines.\n let firstParam;\n if (\n !this.format.retainLines &&\n node.params.length === 1 &&\n isIdentifier((firstParam = node.params[0])) &&\n !hasTypesOrComments(node, firstParam)\n ) {\n this.print(firstParam, node, true);\n } else {\n this._params(node);\n }\n\n this._predicate(node, true);\n this.space();\n // When printing (x)/*1*/=>{}, we remove the parentheses\n // and thus there aren't two contiguous inner tokens.\n // We forcefully print inner comments here.\n this.printInnerComments();\n this.token(\"=>\");\n\n this.space();\n\n this.print(node.body, node);\n}\n\nfunction hasTypesOrComments(\n node: t.ArrowFunctionExpression,\n param: t.Identifier,\n): boolean {\n return !!(\n node.typeParameters ||\n node.returnType ||\n node.predicate ||\n param.typeAnnotation ||\n param.optional ||\n // Flow does not support `foo /*: string*/ => {};`\n param.leadingComments?.length ||\n param.trailingComments?.length\n );\n}\n"],"mappings":";;;;;;;;;;;;;AACA;AAA4C;EAAnCA;AAAY;AAGd,SAASC,OAAO,CAErBC,IAA0D,EAC1D;EACA,IAAI,CA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AM;IACL,IAAI,CAACD,OAAO,CAACC,IAAI,CAAC;EACpB;EAEA,IAAI,CAAC6B,UAAU,CAAC7B,IAAI,EAAE,IAAI,CAAC;EAC3B,IAAI,CAACgB,KAAK,EAAE;EAIZ,IAAI,CAAC0B,kBAAkB,EAAE;EACzB,IAAI,CAACvC,KAAK,CAAC,IAAI,CAAC;EAEhB,IAAI,CAACa,KAAK,EAAE;EAEZ,IAAI,CAACf,KAAK,CAACD,IAAI,CAACoC,IAAI,EAAEpC,IAAI,CAAC;AAC7B;AAEA,SAASyC,kBAAkB,CACzBzC,IAA+B,EAC/B2C,KAAmB,EACV;EAAA;EACT,OAAO,CAAC,EACN3C,IAAI,CAACE,cAAc,IACnBF,IAAI,CAACQ,UAAU,IACfR,IAAI,CAAC+B,SAAS,IACdY,KAAK,CAACtB,cAAc,IACpBsB,KAAK,CAACvB,QAAQ,6BAEduB,KAAK,CAACC,eAAe,aAArB,sBAAuB/B,MAAM,6BAC7B8B,KAAK,CAACE,gBAAgB,aAAtB,sBAAwBhC,MAAM,CAC/B;AACH"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/modules.js b/node_modules/@babel/generator/lib/generators/modules.js index cd3ba11eb..d51d013ca 100644 --- a/node_modules/@babel/generator/lib/generators/modules.js +++ b/node_modules/@babel/generator/lib/generators/modules.js @@ -14,9 +14,8 @@ exports.ImportDeclaration = ImportDeclaration; exports.ImportDefaultSpecifier = ImportDefaultSpecifier; exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier; exports.ImportSpecifier = ImportSpecifier; - +exports._printAssertions = _printAssertions; var _t = require("@babel/types"); - const { isClassDeclaration, isExportDefaultSpecifier, @@ -25,15 +24,12 @@ const { isImportNamespaceSpecifier, isStatement } = _t; - function ImportSpecifier(node) { if (node.importKind === "type" || node.importKind === "typeof") { this.word(node.importKind); this.space(); } - this.print(node.imported, node); - if (node.local && node.local.name !== node.imported.name) { this.space(); this.word("as"); @@ -41,23 +37,18 @@ function ImportSpecifier(node) { this.print(node.local, node); } } - function ImportDefaultSpecifier(node) { this.print(node.local, node); } - function ExportDefaultSpecifier(node) { this.print(node.exported, node); } - function ExportSpecifier(node) { if (node.exportKind === "type") { this.word("type"); this.space(); } - this.print(node.local, node); - if (node.exported && node.local.name !== node.exported.name) { this.space(); this.word("as"); @@ -65,7 +56,6 @@ function ExportSpecifier(node) { this.print(node.exported, node); } } - function ExportNamespaceSpecifier(node) { this.tokenChar(42); this.space(); @@ -73,25 +63,36 @@ function ExportNamespaceSpecifier(node) { this.space(); this.print(node.exported, node); } - +function _printAssertions(node) { + this.word("assert"); + this.space(); + this.tokenChar(123); + this.space(); + this.printList(node.assertions, node); + this.space(); + this.tokenChar(125); +} function ExportAllDeclaration(node) { + var _node$assertions; this.word("export"); this.space(); - if (node.exportKind === "type") { this.word("type"); this.space(); } - this.tokenChar(42); this.space(); this.word("from"); this.space(); - this.print(node.source, node); - this.printAssertions(node); + if ((_node$assertions = node.assertions) != null && _node$assertions.length) { + this.print(node.source, node, true); + this.space(); + this._printAssertions(node); + } else { + this.print(node.source, node); + } this.semicolon(); } - function ExportNamedDeclaration(node) { { if (this.format.decoratorsBeforeExport && isClassDeclaration(node.declaration)) { @@ -100,7 +101,6 @@ function ExportNamedDeclaration(node) { } this.word("export"); this.space(); - if (node.declaration) { const declar = node.declaration; this.print(declar, node); @@ -110,17 +110,14 @@ function ExportNamedDeclaration(node) { this.word("type"); this.space(); } - const specifiers = node.specifiers.slice(0); - let hasSpecial = false; + let hasSpecial = false; for (;;) { const first = specifiers[0]; - if (isExportDefaultSpecifier(first) || isExportNamespaceSpecifier(first)) { hasSpecial = true; this.print(specifiers.shift(), node); - if (specifiers.length) { this.tokenChar(44); this.space(); @@ -129,31 +126,31 @@ function ExportNamedDeclaration(node) { break; } } - if (specifiers.length || !specifiers.length && !hasSpecial) { this.tokenChar(123); - if (specifiers.length) { this.space(); this.printList(specifiers, node); this.space(); } - this.tokenChar(125); } - if (node.source) { + var _node$assertions2; this.space(); this.word("from"); this.space(); - this.print(node.source, node); - this.printAssertions(node); + if ((_node$assertions2 = node.assertions) != null && _node$assertions2.length) { + this.print(node.source, node, true); + this.space(); + this._printAssertions(node); + } else { + this.print(node.source, node); + } } - this.semicolon(); } } - function ExportDefaultDeclaration(node) { { if (this.format.decoratorsBeforeExport && isClassDeclaration(node.declaration)) { @@ -161,6 +158,7 @@ function ExportDefaultDeclaration(node) { } } this.word("export"); + this.noIndentInnerCommentsHere(); this.space(); this.word("default"); this.space(); @@ -168,26 +166,26 @@ function ExportDefaultDeclaration(node) { this.print(declar, node); if (!isStatement(declar)) this.semicolon(); } - function ImportDeclaration(node) { + var _node$assertions3; this.word("import"); this.space(); const isTypeKind = node.importKind === "type" || node.importKind === "typeof"; - if (isTypeKind) { + this.noIndentInnerCommentsHere(); this.word(node.importKind); this.space(); + } else if (node.module) { + this.noIndentInnerCommentsHere(); + this.word("module"); + this.space(); } - const specifiers = node.specifiers.slice(0); const hasSpecifiers = !!specifiers.length; - while (hasSpecifiers) { const first = specifiers[0]; - if (isImportDefaultSpecifier(first) || isImportNamespaceSpecifier(first)) { this.print(specifiers.shift(), node); - if (specifiers.length) { this.tokenChar(44); this.space(); @@ -196,7 +194,6 @@ function ImportDeclaration(node) { break; } } - if (specifiers.length) { this.tokenChar(123); this.space(); @@ -207,18 +204,20 @@ function ImportDeclaration(node) { this.tokenChar(123); this.tokenChar(125); } - if (hasSpecifiers || isTypeKind) { this.space(); this.word("from"); this.space(); } - - this.print(node.source, node); - this.printAssertions(node); + if ((_node$assertions3 = node.assertions) != null && _node$assertions3.length) { + this.print(node.source, node, true); + this.space(); + this._printAssertions(node); + } else { + this.print(node.source, node); + } { var _node$attributes; - if ((_node$attributes = node.attributes) != null && _node$attributes.length) { this.space(); this.word("with"); @@ -228,14 +227,12 @@ function ImportDeclaration(node) { } this.semicolon(); } - function ImportAttribute(node) { this.print(node.key); this.tokenChar(58); this.space(); this.print(node.value); } - function ImportNamespaceSpecifier(node) { this.tokenChar(42); this.space(); diff --git a/node_modules/@babel/generator/lib/generators/modules.js.map b/node_modules/@babel/generator/lib/generators/modules.js.map index 2ddae7cd1..db8d9edc9 100644 --- a/node_modules/@babel/generator/lib/generators/modules.js.map +++ b/node_modules/@babel/generator/lib/generators/modules.js.map @@ -1 +1 @@ -{"version":3,"names":["isClassDeclaration","isExportDefaultSpecifier","isExportNamespaceSpecifier","isImportDefaultSpecifier","isImportNamespaceSpecifier","isStatement","ImportSpecifier","node","importKind","word","space","print","imported","local","name","ImportDefaultSpecifier","ExportDefaultSpecifier","exported","ExportSpecifier","exportKind","ExportNamespaceSpecifier","token","ExportAllDeclaration","source","printAssertions","semicolon","ExportNamedDeclaration","format","decoratorsBeforeExport","declaration","printJoin","decorators","declar","specifiers","slice","hasSpecial","first","shift","length","printList","ExportDefaultDeclaration","ImportDeclaration","isTypeKind","hasSpecifiers","attributes","ImportAttribute","key","value","ImportNamespaceSpecifier"],"sources":["../../src/generators/modules.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport {\n isClassDeclaration,\n isExportDefaultSpecifier,\n isExportNamespaceSpecifier,\n isImportDefaultSpecifier,\n isImportNamespaceSpecifier,\n isStatement,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\nexport function ImportSpecifier(this: Printer, node: t.ImportSpecifier) {\n if (node.importKind === \"type\" || node.importKind === \"typeof\") {\n this.word(node.importKind);\n this.space();\n }\n\n this.print(node.imported, node);\n // @ts-expect-error todo(flow-ts) maybe check node type instead of relying on name to be undefined on t.StringLiteral\n if (node.local && node.local.name !== node.imported.name) {\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.local, node);\n }\n}\n\nexport function ImportDefaultSpecifier(\n this: Printer,\n node: t.ImportDefaultSpecifier,\n) {\n this.print(node.local, node);\n}\n\nexport function ExportDefaultSpecifier(\n this: Printer,\n node: t.ExportDefaultSpecifier,\n) {\n this.print(node.exported, node);\n}\n\nexport function ExportSpecifier(this: Printer, node: t.ExportSpecifier) {\n if (node.exportKind === \"type\") {\n this.word(\"type\");\n this.space();\n }\n\n this.print(node.local, node);\n // @ts-expect-error todo(flow-ts) maybe check node type instead of relying on name to be undefined on t.StringLiteral\n if (node.exported && node.local.name !== node.exported.name) {\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.exported, node);\n }\n}\n\nexport function ExportNamespaceSpecifier(\n this: Printer,\n node: t.ExportNamespaceSpecifier,\n) {\n this.token(\"*\");\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.exported, node);\n}\n\nexport function ExportAllDeclaration(\n this: Printer,\n node: t.ExportAllDeclaration | t.DeclareExportAllDeclaration,\n) {\n this.word(\"export\");\n this.space();\n if (node.exportKind === \"type\") {\n this.word(\"type\");\n this.space();\n }\n this.token(\"*\");\n this.space();\n this.word(\"from\");\n this.space();\n this.print(node.source, node);\n // @ts-expect-error Fixme: assertions is not defined in DeclareExportAllDeclaration\n this.printAssertions(node);\n this.semicolon();\n}\n\nexport function ExportNamedDeclaration(\n this: Printer,\n node: t.ExportNamedDeclaration,\n) {\n if (!process.env.BABEL_8_BREAKING) {\n if (\n this.format.decoratorsBeforeExport &&\n isClassDeclaration(node.declaration)\n ) {\n this.printJoin(node.declaration.decorators, node);\n }\n }\n\n this.word(\"export\");\n this.space();\n if (node.declaration) {\n const declar = node.declaration;\n this.print(declar, node);\n if (!isStatement(declar)) this.semicolon();\n } else {\n if (node.exportKind === \"type\") {\n this.word(\"type\");\n this.space();\n }\n\n const specifiers = node.specifiers.slice(0);\n\n // print \"special\" specifiers first\n let hasSpecial = false;\n for (;;) {\n const first = specifiers[0];\n if (\n isExportDefaultSpecifier(first) ||\n isExportNamespaceSpecifier(first)\n ) {\n hasSpecial = true;\n this.print(specifiers.shift(), node);\n if (specifiers.length) {\n this.token(\",\");\n this.space();\n }\n } else {\n break;\n }\n }\n\n if (specifiers.length || (!specifiers.length && !hasSpecial)) {\n this.token(\"{\");\n if (specifiers.length) {\n this.space();\n this.printList(specifiers, node);\n this.space();\n }\n this.token(\"}\");\n }\n\n if (node.source) {\n this.space();\n this.word(\"from\");\n this.space();\n this.print(node.source, node);\n this.printAssertions(node);\n }\n\n this.semicolon();\n }\n}\n\nexport function ExportDefaultDeclaration(\n this: Printer,\n node: t.ExportDefaultDeclaration,\n) {\n if (!process.env.BABEL_8_BREAKING) {\n if (\n this.format.decoratorsBeforeExport &&\n isClassDeclaration(node.declaration)\n ) {\n this.printJoin(node.declaration.decorators, node);\n }\n }\n\n this.word(\"export\");\n this.space();\n this.word(\"default\");\n this.space();\n const declar = node.declaration;\n this.print(declar, node);\n if (!isStatement(declar)) this.semicolon();\n}\n\nexport function ImportDeclaration(this: Printer, node: t.ImportDeclaration) {\n this.word(\"import\");\n this.space();\n\n const isTypeKind = node.importKind === \"type\" || node.importKind === \"typeof\";\n if (isTypeKind) {\n this.word(node.importKind);\n this.space();\n }\n\n const specifiers = node.specifiers.slice(0);\n const hasSpecifiers = !!specifiers.length;\n // print \"special\" specifiers first. The loop condition is constant,\n // but there is a \"break\" in the body.\n while (hasSpecifiers) {\n const first = specifiers[0];\n if (isImportDefaultSpecifier(first) || isImportNamespaceSpecifier(first)) {\n this.print(specifiers.shift(), node);\n if (specifiers.length) {\n this.token(\",\");\n this.space();\n }\n } else {\n break;\n }\n }\n\n if (specifiers.length) {\n this.token(\"{\");\n this.space();\n this.printList(specifiers, node);\n this.space();\n this.token(\"}\");\n } else if (isTypeKind && !hasSpecifiers) {\n this.token(\"{\");\n this.token(\"}\");\n }\n\n if (hasSpecifiers || isTypeKind) {\n this.space();\n this.word(\"from\");\n this.space();\n }\n\n this.print(node.source, node);\n\n this.printAssertions(node);\n if (!process.env.BABEL_8_BREAKING) {\n // @ts-ignore(Babel 7 vs Babel 8) Babel 7 supports module attributes\n if (node.attributes?.length) {\n this.space();\n this.word(\"with\");\n this.space();\n // @ts-ignore(Babel 7 vs Babel 8) Babel 7 supports module attributes\n this.printList(node.attributes, node);\n }\n }\n\n this.semicolon();\n}\n\nexport function ImportAttribute(this: Printer, node: t.ImportAttribute) {\n this.print(node.key);\n this.token(\":\");\n this.space();\n this.print(node.value);\n}\n\nexport function ImportNamespaceSpecifier(\n this: Printer,\n node: t.ImportNamespaceSpecifier,\n) {\n this.token(\"*\");\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.local, node);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA;;;EACEA,kB;EACAC,wB;EACAC,0B;EACAC,wB;EACAC,0B;EACAC;;;AAIK,SAASC,eAAT,CAAwCC,IAAxC,EAAiE;EACtE,IAAIA,IAAI,CAACC,UAAL,KAAoB,MAApB,IAA8BD,IAAI,CAACC,UAAL,KAAoB,QAAtD,EAAgE;IAC9D,KAAKC,IAAL,CAAUF,IAAI,CAACC,UAAf;IACA,KAAKE,KAAL;EACD;;EAED,KAAKC,KAAL,CAAWJ,IAAI,CAACK,QAAhB,EAA0BL,IAA1B;;EAEA,IAAIA,IAAI,CAACM,KAAL,IAAcN,IAAI,CAACM,KAAL,CAAWC,IAAX,KAAoBP,IAAI,CAACK,QAAL,CAAcE,IAApD,EAA0D;IACxD,KAAKJ,KAAL;IACA,KAAKD,IAAL,CAAU,IAAV;IACA,KAAKC,KAAL;IACA,KAAKC,KAAL,CAAWJ,IAAI,CAACM,KAAhB,EAAuBN,IAAvB;EACD;AACF;;AAEM,SAASQ,sBAAT,CAELR,IAFK,EAGL;EACA,KAAKI,KAAL,CAAWJ,IAAI,CAACM,KAAhB,EAAuBN,IAAvB;AACD;;AAEM,SAASS,sBAAT,CAELT,IAFK,EAGL;EACA,KAAKI,KAAL,CAAWJ,IAAI,CAACU,QAAhB,EAA0BV,IAA1B;AACD;;AAEM,SAASW,eAAT,CAAwCX,IAAxC,EAAiE;EACtE,IAAIA,IAAI,CAACY,UAAL,KAAoB,MAAxB,EAAgC;IAC9B,KAAKV,IAAL,CAAU,MAAV;IACA,KAAKC,KAAL;EACD;;EAED,KAAKC,KAAL,CAAWJ,IAAI,CAACM,KAAhB,EAAuBN,IAAvB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,MAMO;MACL;IACD;EACF;;EAED,IAAIuB,UAAU,CAACK,MAAf,EAAuB;IACrB,KAAKjB,SAAL;IACA,KAAKX,KAAL;IACA,KAAK6B,SAAL,CAAeN,UAAf,EAA2B1B,IAA3B;IACA,KAAKG,KAAL;IACA,KAAKW,SAAL;EACD,CAND,MAMO,IAAIqB,UAAU,IAAI,CAACC,aAAnB,EAAkC;IACvC,KAAKtB,SAAL;IACA,KAAKA,SAAL;EACD;;EAED,IAAIsB,aAAa,IAAID,UAArB,EAAiC;IAC/B,KAAKhC,KAAL;IACA,KAAKD,IAAL,CAAU,MAAV;IACA,KAAKC,KAAL;EACD;;EAED,KAAKC,KAAL,CAAWJ,IAAI,CAACgB,MAAhB,EAAwBhB,IAAxB;EAEA,KAAKiB,eAAL,CAAqBjB,IAArB;EACmC;IAAA;;IAEjC,wBAAIA,IAAI,CAACqC,UAAT,aAAI,iBAAiBN,MAArB,EAA6B;MAC3B,KAAK5B,KAAL;MACA,KAAKD,IAAL,CAAU,MAAV;MACA,KAAKC,KAAL;MAEA,KAAK6B,SAAL,CAAehC,IAAI,CAACqC,UAApB,EAAgCrC,IAAhC;IACD;EACF;EAED,KAAKkB,SAAL;AACD;;AAEM,SAASoB,eAAT,CAAwCtC,IAAxC,EAAiE;EACtE,KAAKI,KAAL,CAAWJ,IAAI,CAACuC,GAAhB;EACA,KAAKzB,SAAL;EACA,KAAKX,KAAL;EACA,KAAKC,KAAL,CAAWJ,IAAI,CAACwC,KAAhB;AACD;;AAEM,SAASC,wBAAT,CAELzC,IAFK,EAGL;EACA,KAAKc,SAAL;EACA,KAAKX,KAAL;EACA,KAAKD,IAAL,CAAU,IAAV;EACA,KAAKC,KAAL;EACA,KAAKC,KAAL,CAAWJ,IAAI,CAACM,KAAhB,EAAuBN,IAAvB;AACD"} \ No newline at end of file +{"version":3,"names":["isClassDeclaration","isExportDefaultSpecifier","isExportNamespaceSpecifier","isImportDefaultSpecifier","isImportNamespaceSpecifier","isStatement","ImportSpecifier","node","importKind","word","space","print","imported","local","name","ImportDefaultSpecifier","ExportDefaultSpecifier","exported","ExportSpecifier","exportKind","ExportNamespaceSpecifier","token","_printAssertions","printList","assertions","ExportAllDeclaration","length","source","semicolon","ExportNamedDeclaration","format","decoratorsBeforeExport","declaration","printJoin","decorators","declar","specifiers","slice","hasSpecial","first","shift","ExportDefaultDeclaration","noIndentInnerCommentsHere","ImportDeclaration","isTypeKind","module","hasSpecifiers","attributes","ImportAttribute","key","value","ImportNamespaceSpecifier"],"sources":["../../src/generators/modules.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport {\n isClassDeclaration,\n isExportDefaultSpecifier,\n isExportNamespaceSpecifier,\n isImportDefaultSpecifier,\n isImportNamespaceSpecifier,\n isStatement,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\nexport function ImportSpecifier(this: Printer, node: t.ImportSpecifier) {\n if (node.importKind === \"type\" || node.importKind === \"typeof\") {\n this.word(node.importKind);\n this.space();\n }\n\n this.print(node.imported, node);\n // @ts-expect-error todo(flow-ts) maybe check node type instead of relying on name to be undefined on t.StringLiteral\n if (node.local && node.local.name !== node.imported.name) {\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.local, node);\n }\n}\n\nexport function ImportDefaultSpecifier(\n this: Printer,\n node: t.ImportDefaultSpecifier,\n) {\n this.print(node.local, node);\n}\n\nexport function ExportDefaultSpecifier(\n this: Printer,\n node: t.ExportDefaultSpecifier,\n) {\n this.print(node.exported, node);\n}\n\nexport function ExportSpecifier(this: Printer, node: t.ExportSpecifier) {\n if (node.exportKind === \"type\") {\n this.word(\"type\");\n this.space();\n }\n\n this.print(node.local, node);\n // @ts-expect-error todo(flow-ts) maybe check node type instead of relying on name to be undefined on t.StringLiteral\n if (node.exported && node.local.name !== node.exported.name) {\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.exported, node);\n }\n}\n\nexport function ExportNamespaceSpecifier(\n this: Printer,\n node: t.ExportNamespaceSpecifier,\n) {\n this.token(\"*\");\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.exported, node);\n}\n\nexport function _printAssertions(\n this: Printer,\n node: Extract,\n) {\n this.word(\"assert\");\n this.space();\n this.token(\"{\");\n this.space();\n this.printList(node.assertions, node);\n this.space();\n this.token(\"}\");\n}\n\nexport function ExportAllDeclaration(\n this: Printer,\n node: t.ExportAllDeclaration | t.DeclareExportAllDeclaration,\n) {\n this.word(\"export\");\n this.space();\n if (node.exportKind === \"type\") {\n this.word(\"type\");\n this.space();\n }\n this.token(\"*\");\n this.space();\n this.word(\"from\");\n this.space();\n // @ts-expect-error Fixme: assertions is not defined in DeclareExportAllDeclaration\n if (node.assertions?.length) {\n this.print(node.source, node, true);\n this.space();\n // @ts-expect-error Fixme: assertions is not defined in DeclareExportAllDeclaration\n this._printAssertions(node);\n } else {\n this.print(node.source, node);\n }\n\n this.semicolon();\n}\n\nexport function ExportNamedDeclaration(\n this: Printer,\n node: t.ExportNamedDeclaration,\n) {\n if (!process.env.BABEL_8_BREAKING) {\n if (\n this.format.decoratorsBeforeExport &&\n isClassDeclaration(node.declaration)\n ) {\n this.printJoin(node.declaration.decorators, node);\n }\n }\n\n this.word(\"export\");\n this.space();\n if (node.declaration) {\n const declar = node.declaration;\n this.print(declar, node);\n if (!isStatement(declar)) this.semicolon();\n } else {\n if (node.exportKind === \"type\") {\n this.word(\"type\");\n this.space();\n }\n\n const specifiers = node.specifiers.slice(0);\n\n // print \"special\" specifiers first\n let hasSpecial = false;\n for (;;) {\n const first = specifiers[0];\n if (\n isExportDefaultSpecifier(first) ||\n isExportNamespaceSpecifier(first)\n ) {\n hasSpecial = true;\n this.print(specifiers.shift(), node);\n if (specifiers.length) {\n this.token(\",\");\n this.space();\n }\n } else {\n break;\n }\n }\n\n if (specifiers.length || (!specifiers.length && !hasSpecial)) {\n this.token(\"{\");\n if (specifiers.length) {\n this.space();\n this.printList(specifiers, node);\n this.space();\n }\n this.token(\"}\");\n }\n\n if (node.source) {\n this.space();\n this.word(\"from\");\n this.space();\n if (node.assertions?.length) {\n this.print(node.source, node, true);\n this.space();\n this._printAssertions(node);\n } else {\n this.print(node.source, node);\n }\n }\n\n this.semicolon();\n }\n}\n\nexport function ExportDefaultDeclaration(\n this: Printer,\n node: t.ExportDefaultDeclaration,\n) {\n if (!process.env.BABEL_8_BREAKING) {\n if (\n this.format.decoratorsBeforeExport &&\n isClassDeclaration(node.declaration)\n ) {\n this.printJoin(node.declaration.decorators, node);\n }\n }\n\n this.word(\"export\");\n this.noIndentInnerCommentsHere();\n this.space();\n this.word(\"default\");\n this.space();\n const declar = node.declaration;\n this.print(declar, node);\n if (!isStatement(declar)) this.semicolon();\n}\n\nexport function ImportDeclaration(this: Printer, node: t.ImportDeclaration) {\n this.word(\"import\");\n this.space();\n\n const isTypeKind = node.importKind === \"type\" || node.importKind === \"typeof\";\n if (isTypeKind) {\n this.noIndentInnerCommentsHere();\n this.word(node.importKind);\n this.space();\n } else if (node.module) {\n this.noIndentInnerCommentsHere();\n this.word(\"module\");\n this.space();\n }\n\n const specifiers = node.specifiers.slice(0);\n const hasSpecifiers = !!specifiers.length;\n // print \"special\" specifiers first. The loop condition is constant,\n // but there is a \"break\" in the body.\n while (hasSpecifiers) {\n const first = specifiers[0];\n if (isImportDefaultSpecifier(first) || isImportNamespaceSpecifier(first)) {\n this.print(specifiers.shift(), node);\n if (specifiers.length) {\n this.token(\",\");\n this.space();\n }\n } else {\n break;\n }\n }\n\n if (specifiers.length) {\n this.token(\"{\");\n this.space();\n this.printList(specifiers, node);\n this.space();\n this.token(\"}\");\n } else if (isTypeKind && !hasSpecifiers) {\n this.token(\"{\");\n this.token(\"}\");\n }\n\n if (hasSpecifiers || isTypeKind) {\n this.space();\n this.word(\"from\");\n this.space();\n }\n\n if (node.assertions?.length) {\n this.print(node.source, node, true);\n this.space();\n this._printAssertions(node);\n } else {\n this.print(node.source, node);\n }\n if (!process.env.BABEL_8_BREAKING) {\n // @ts-ignore(Babel 7 vs Babel 8) Babel 7 supports module attributes\n if (node.attributes?.length) {\n this.space();\n this.word(\"with\");\n this.space();\n // @ts-ignore(Babel 7 vs Babel 8) Babel 7 supports module attributes\n this.printList(node.attributes, node);\n }\n }\n\n this.semicolon();\n}\n\nexport function ImportAttribute(this: Printer, node: t.ImportAttribute) {\n this.print(node.key);\n this.token(\":\");\n this.space();\n this.print(node.value);\n}\n\nexport function ImportNamespaceSpecifier(\n this: Printer,\n node: t.ImportNamespaceSpecifier,\n) {\n this.token(\"*\");\n this.space();\n this.word(\"as\");\n this.space();\n this.print(node.local, node);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA;AAOsB;EANpBA,kBAAkB;EAClBC,wBAAwB;EACxBC,0BAA0B;EAC1BC,wBAAwB;EACxBC,0BAA0B;EAC1BC;AAAW;AAIN,SAASC,eAAe,CAAgBC,IAAuB,EAAE;EACtE,IAAIA,IAAI,CAACC,UAAU,KAAK,MAAM,IAAID,IAAI,CAACC,UAAU,KAAK,QAAQ,EAAE;IAC9D,IAAI,CAACC,IAAI,CAACF,IAAI,CAACC,UAAU,CAAC;IAC1B,IAAI,CAACE,KAAK,EAAE;EACd;EAEA,IAAI,CAACC,KAAK,CAACJ,IAAI,CAACK,QAAQ,EAAEL,IAAI,CAAC;EAE/B,IAAIA,IAAI,CAACM,KAAK,IAAIN,IAAI,CAACM,KAAK,CAACC,IAAI,KAAKP,IAAI,CAACK,QAAQ,CAACE,IAAI,EAAE;IACxD,IAAI,CAACJ,KAAK,EAAE;IACZ,IAAI,CAACD,IAAI,CAAC,IAAI,CAAC;IACf,IAAI,CAACC,KAAK,EAAE;IACZ,IAAI,CAACC,KAAK,CAACJ,IAAI,CAACM,KAAK,EAAEN,IAAI,CAAC;EAC9B;AACF;AAEO,SAASQ,sBAAsB,CAEpCR,IAA8B,EAC9B;EACA,IAAI,CAACI,KAAK,CAACJ,IAAI,CAACM,KAAK,EAAEN,IAAI,CAAC;AAC9B;AAEO,SAASS,sBAAsB,CAEpCT,IAA8B,EAC9B;E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IAAI,EAAE,IAAI,CAAC;IACnC,IAAI,CAACG,KAAK,EAAE;IACZ,IAAI,CAACY,gBAAgB,CAACf,IAAI,CAAC;EAC7B,CAAC,MAAM;IACL,IAAI,CAACI,KAAK,CAACJ,IAAI,CAACoB,MAAM,EAAEpB,IAAI,CAAC;EAC/B;EACmC;IAAA;IAEjC,wBAAIA,IAAI,CAACwC,UAAU,aAAf,iBAAiBrB,MAAM,EAAE;MAC3B,IAAI,CAAChB,KAAK,EAAE;MACZ,IAAI,CAACD,IAAI,CAAC,MAAM,CAAC;MACjB,IAAI,CAACC,KAAK,EAAE;MAEZ,IAAI,CAACa,SAAS,CAAChB,IAAI,CAACwC,UAAU,EAAExC,IAAI,CAAC;IACvC;EACF;EAEA,IAAI,CAACqB,SAAS,EAAE;AAClB;AAEO,SAASoB,eAAe,CAAgBzC,IAAuB,EAAE;EACtE,IAAI,CAACI,KAAK,CAACJ,IAAI,CAAC0C,GAAG,CAAC;EACpB,IAAI,CAAC5B,SAAK,IAAK;EACf,IAAI,CAACX,KAAK,EAAE;EACZ,IAAI,CAACC,KAAK,CAACJ,IAAI,CAAC2C,KAAK,CAAC;AACxB;AAEO,SAASC,wBAAwB,CAEtC5C,IAAgC,EAChC;EACA,IAAI,CAACc,SAAK,IAAK;EACf,IAAI,CAACX,KAAK,EAAE;EACZ,IAAI,CAACD,IAAI,CAAC,IAAI,CAAC;EACf,IAAI,CAACC,KAAK,EAAE;EACZ,IAAI,CAACC,KAAK,CAACJ,IAAI,CAACM,KAAK,EAAEN,IAAI,CAAC;AAC9B"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/statements.js b/node_modules/@babel/generator/lib/generators/statements.js index ef1777eda..72a9e7e1d 100644 --- a/node_modules/@babel/generator/lib/generators/statements.js +++ b/node_modules/@babel/generator/lib/generators/statements.js @@ -21,16 +21,13 @@ exports.VariableDeclaration = VariableDeclaration; exports.VariableDeclarator = VariableDeclarator; exports.WhileStatement = WhileStatement; exports.WithStatement = WithStatement; - var _t = require("@babel/types"); - const { isFor, isForStatement, isIfStatement, isStatement } = _t; - function WithStatement(node) { this.word("with"); this.space(); @@ -39,7 +36,6 @@ function WithStatement(node) { this.tokenChar(41); this.printBlock(node); } - function IfStatement(node) { this.word("if"); this.space(); @@ -48,21 +44,17 @@ function IfStatement(node) { this.tokenChar(41); this.space(); const needsBlock = node.alternate && isIfStatement(getLastStatement(node.consequent)); - if (needsBlock) { this.tokenChar(123); this.newline(); this.indent(); } - this.printAndIndentOnComments(node.consequent, node); - if (needsBlock) { this.dedent(); this.newline(); this.tokenChar(125); } - if (node.alternate) { if (this.endsWith(125)) this.space(); this.word("else"); @@ -75,14 +67,11 @@ function getLastStatement(statement) { const { body } = statement; - if (isStatement(body) === false) { return statement; } - return getLastStatement(body); } - function ForStatement(node) { this.word("for"); this.space(); @@ -91,23 +80,18 @@ function ForStatement(node) { this.print(node.init, node); this.inForStatementInitCounter--; this.tokenChar(59); - if (node.test) { this.space(); this.print(node.test, node); } - this.tokenChar(59); - if (node.update) { this.space(); this.print(node.update, node); } - this.tokenChar(41); this.printBlock(node); } - function WhileStatement(node) { this.word("while"); this.space(); @@ -116,17 +100,15 @@ function WhileStatement(node) { this.tokenChar(41); this.printBlock(node); } - function ForXStatement(node) { this.word("for"); this.space(); const isForOf = node.type === "ForOfStatement"; - if (isForOf && node.await) { this.word("await"); this.space(); } - + this.noIndentInnerCommentsHere(); this.tokenChar(40); this.print(node.left, node); this.space(); @@ -136,12 +118,10 @@ function ForXStatement(node) { this.tokenChar(41); this.printBlock(node); } - const ForInStatement = ForXStatement; exports.ForInStatement = ForInStatement; const ForOfStatement = ForXStatement; exports.ForOfStatement = ForOfStatement; - function DoWhileStatement(node) { this.word("do"); this.space(); @@ -154,43 +134,35 @@ function DoWhileStatement(node) { this.tokenChar(41); this.semicolon(); } - function printStatementAfterKeyword(printer, node, parent, isLabel) { if (node) { printer.space(); printer.printTerminatorless(node, parent, isLabel); } - printer.semicolon(); } - function BreakStatement(node) { this.word("break"); printStatementAfterKeyword(this, node.label, node, true); } - function ContinueStatement(node) { this.word("continue"); printStatementAfterKeyword(this, node.label, node, true); } - function ReturnStatement(node) { this.word("return"); printStatementAfterKeyword(this, node.argument, node, false); } - function ThrowStatement(node) { this.word("throw"); printStatementAfterKeyword(this, node.argument, node, false); } - function LabeledStatement(node) { this.print(node.label, node); this.tokenChar(58); this.space(); this.print(node.body, node); } - function TryStatement(node) { this.word("try"); this.space(); @@ -202,7 +174,6 @@ function TryStatement(node) { } else { this.print(node.handler, node); } - if (node.finalizer) { this.space(); this.word("finally"); @@ -210,11 +181,9 @@ function TryStatement(node) { this.print(node.finalizer, node); } } - function CatchClause(node) { this.word("catch"); this.space(); - if (node.param) { this.tokenChar(40); this.print(node.param, node); @@ -222,10 +191,8 @@ function CatchClause(node) { this.tokenChar(41); this.space(); } - this.print(node.body, node); } - function SwitchStatement(node) { this.word("switch"); this.space(); @@ -236,15 +203,12 @@ function SwitchStatement(node) { this.tokenChar(123); this.printSequence(node.cases, node, { indent: true, - addNewlines(leading, cas) { if (!leading && node.cases[node.cases.length - 1] === cas) return -1; } - }); this.tokenChar(125); } - function SwitchCase(node) { if (node.test) { this.word("case"); @@ -255,7 +219,6 @@ function SwitchCase(node) { this.word("default"); this.tokenChar(58); } - if (node.consequent.length) { this.newline(); this.printSequence(node.consequent, node, { @@ -263,40 +226,21 @@ function SwitchCase(node) { }); } } - function DebuggerStatement() { this.word("debugger"); this.semicolon(); } - -function variableDeclarationIndent() { - this.tokenChar(44); - this.newline(); - - if (this.endsWith(10)) { - for (let i = 0; i < 4; i++) this.space(true); - } -} - -function constDeclarationIndent() { - this.tokenChar(44); - this.newline(); - - if (this.endsWith(10)) { - for (let i = 0; i < 6; i++) this.space(true); - } -} - function VariableDeclaration(node, parent) { if (node.declare) { this.word("declare"); this.space(); } - - this.word(node.kind); + const { + kind + } = node; + this.word(kind, kind === "using"); this.space(); let hasInits = false; - if (!isFor(parent)) { for (const declar of node.declarations) { if (declar.init) { @@ -305,16 +249,13 @@ function VariableDeclaration(node, parent) { } } - let separator; - - if (hasInits) { - separator = node.kind === "const" ? constDeclarationIndent : variableDeclarationIndent; - } - this.printList(node.declarations, node, { - separator + separator: hasInits ? function () { + this.tokenChar(44); + this.newline(); + } : undefined, + indent: node.declarations.length > 1 ? true : false }); - if (isFor(parent)) { if (isForStatement(parent)) { if (parent.init === node) return; @@ -322,15 +263,12 @@ function VariableDeclaration(node, parent) { if (parent.left === node) return; } } - this.semicolon(); } - function VariableDeclarator(node) { this.print(node.id, node); if (node.definite) this.tokenChar(33); this.print(node.id.typeAnnotation, node); - if (node.init) { this.space(); this.tokenChar(61); diff --git a/node_modules/@babel/generator/lib/generators/statements.js.map b/node_modules/@babel/generator/lib/generators/statements.js.map index 1f10e5000..a165f35d1 100644 --- a/node_modules/@babel/generator/lib/generators/statements.js.map +++ b/node_modules/@babel/generator/lib/generators/statements.js.map @@ -1 +1 @@ -{"version":3,"names":["isFor","isForStatement","isIfStatement","isStatement","WithStatement","node","word","space","token","print","object","printBlock","IfStatement","test","needsBlock","alternate","getLastStatement","consequent","newline","indent","printAndIndentOnComments","dedent","endsWith","statement","body","ForStatement","inForStatementInitCounter","init","update","WhileStatement","ForXStatement","isForOf","type","await","left","right","ForInStatement","ForOfStatement","DoWhileStatement","semicolon","printStatementAfterKeyword","printer","parent","isLabel","printTerminatorless","BreakStatement","label","ContinueStatement","ReturnStatement","argument","ThrowStatement","LabeledStatement","TryStatement","block","handlers","handler","finalizer","CatchClause","param","typeAnnotation","SwitchStatement","discriminant","printSequence","cases","addNewlines","leading","cas","length","SwitchCase","DebuggerStatement","variableDeclarationIndent","i","constDeclarationIndent","VariableDeclaration","declare","kind","hasInits","declar","declarations","separator","printList","VariableDeclarator","id","definite"],"sources":["../../src/generators/statements.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport {\n isFor,\n isForStatement,\n isIfStatement,\n isStatement,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport * as charCodes from \"charcodes\";\n\nexport function WithStatement(this: Printer, node: t.WithStatement) {\n this.word(\"with\");\n this.space();\n this.token(\"(\");\n this.print(node.object, node);\n this.token(\")\");\n this.printBlock(node);\n}\n\nexport function IfStatement(this: Printer, node: t.IfStatement) {\n this.word(\"if\");\n this.space();\n this.token(\"(\");\n this.print(node.test, node);\n this.token(\")\");\n this.space();\n\n const needsBlock =\n node.alternate && isIfStatement(getLastStatement(node.consequent));\n if (needsBlock) {\n this.token(\"{\");\n this.newline();\n this.indent();\n }\n\n this.printAndIndentOnComments(node.consequent, node);\n\n if (needsBlock) {\n this.dedent();\n this.newline();\n this.token(\"}\");\n }\n\n if (node.alternate) {\n if (this.endsWith(charCodes.rightCurlyBrace)) this.space();\n this.word(\"else\");\n this.space();\n this.printAndIndentOnComments(node.alternate, node);\n }\n}\n\n// Recursively get the last statement.\nfunction getLastStatement(statement: t.Statement): t.Statement {\n // @ts-expect-error: If statement.body is empty or not a Node, isStatement will return false\n const { body } = statement;\n if (isStatement(body) === false) {\n return statement;\n }\n\n return getLastStatement(body);\n}\n\nexport function ForStatement(this: Printer, node: t.ForStatement) {\n this.word(\"for\");\n this.space();\n this.token(\"(\");\n\n this.inForStatementInitCounter++;\n this.print(node.init, node);\n this.inForStatementInitCounter--;\n this.token(\";\");\n\n if (node.test) {\n this.space();\n this.print(node.test, node);\n }\n this.token(\";\");\n\n if (node.update) {\n this.space();\n this.print(node.update, node);\n }\n\n this.token(\")\");\n this.printBlock(node);\n}\n\nexport function WhileStatement(this: Printer, node: t.WhileStatement) {\n this.word(\"while\");\n this.space();\n this.token(\"(\");\n this.print(node.test, node);\n this.token(\")\");\n this.printBlock(node);\n}\n\nfunction ForXStatement(this: Printer, node: t.ForXStatement) {\n this.word(\"for\");\n this.space();\n const isForOf = node.type === \"ForOfStatement\";\n if (isForOf && node.await) {\n this.word(\"await\");\n this.space();\n }\n this.token(\"(\");\n this.print(node.left, node);\n this.space();\n this.word(isForOf ? \"of\" : \"in\");\n this.space();\n this.print(node.right, node);\n this.token(\")\");\n this.printBlock(node);\n}\n\nexport const ForInStatement = ForXStatement;\nexport const ForOfStatement = ForXStatement;\n\nexport function DoWhileStatement(this: Printer, node: t.DoWhileStatement) {\n this.word(\"do\");\n this.space();\n this.print(node.body, node);\n this.space();\n this.word(\"while\");\n this.space();\n this.token(\"(\");\n this.print(node.test, node);\n this.token(\")\");\n this.semicolon();\n}\n\nfunction printStatementAfterKeyword(\n printer: Printer,\n node: t.Node,\n parent: t.Node,\n isLabel: boolean,\n) {\n if (node) {\n printer.space();\n printer.printTerminatorless(node, parent, isLabel);\n }\n\n printer.semicolon();\n}\n\nexport function BreakStatement(this: Printer, node: t.ContinueStatement) {\n this.word(\"break\");\n printStatementAfterKeyword(this, node.label, node, true);\n}\n\nexport function ContinueStatement(this: Printer, node: t.ContinueStatement) {\n this.word(\"continue\");\n printStatementAfterKeyword(this, node.label, node, true);\n}\n\nexport function ReturnStatement(this: Printer, node: t.ReturnStatement) {\n this.word(\"return\");\n printStatementAfterKeyword(this, node.argument, node, false);\n}\n\nexport function ThrowStatement(this: Printer, node: t.ThrowStatement) {\n this.word(\"throw\");\n printStatementAfterKeyword(this, node.argument, node, false);\n}\n\nexport function LabeledStatement(this: Printer, node: t.LabeledStatement) {\n this.print(node.label, node);\n this.token(\":\");\n this.space();\n this.print(node.body, node);\n}\n\nexport function TryStatement(this: Printer, node: t.TryStatement) {\n this.word(\"try\");\n this.space();\n this.print(node.block, node);\n this.space();\n\n // Esprima bug puts the catch clause in a `handlers` array.\n // see https://code.google.com/p/esprima/issues/detail?id=433\n // We run into this from regenerator generated ast.\n // @ts-expect-error todo(flow->ts) should ast node type be updated to support this?\n if (node.handlers) {\n // @ts-expect-error todo(flow->ts) should ast node type be updated to support this?\n this.print(node.handlers[0], node);\n } else {\n this.print(node.handler, node);\n }\n\n if (node.finalizer) {\n this.space();\n this.word(\"finally\");\n this.space();\n this.print(node.finalizer, node);\n }\n}\n\nexport function CatchClause(this: Printer, node: t.CatchClause) {\n this.word(\"catch\");\n this.space();\n if (node.param) {\n this.token(\"(\");\n this.print(node.param, node);\n this.print(node.param.typeAnnotation, node);\n this.token(\")\");\n this.space();\n }\n this.print(node.body, node);\n}\n\nexport function SwitchStatement(this: Printer, node: t.SwitchStatement) {\n this.word(\"switch\");\n this.space();\n this.token(\"(\");\n this.print(node.discriminant, node);\n this.token(\")\");\n this.space();\n this.token(\"{\");\n\n this.printSequence(node.cases, node, {\n indent: true,\n addNewlines(leading, cas) {\n if (!leading && node.cases[node.cases.length - 1] === cas) return -1;\n },\n });\n\n this.token(\"}\");\n}\n\nexport function SwitchCase(this: Printer, node: t.SwitchCase) {\n if (node.test) {\n this.word(\"case\");\n this.space();\n this.print(node.test, node);\n this.token(\":\");\n } else {\n this.word(\"default\");\n this.token(\":\");\n }\n\n if (node.consequent.length) {\n this.newline();\n this.printSequence(node.consequent, node, { indent: true });\n }\n}\n\nexport function DebuggerStatement(this: Printer) {\n this.word(\"debugger\");\n this.semicolon();\n}\n\nfunction variableDeclarationIndent(this: Printer) {\n // \"let \" or \"var \" indentation.\n this.token(\",\");\n this.newline();\n if (this.endsWith(charCodes.lineFeed)) {\n for (let i = 0; i < 4; i++) this.space(true);\n }\n}\n\nfunction constDeclarationIndent(this: Printer) {\n // \"const \" indentation.\n this.token(\",\");\n this.newline();\n if (this.endsWith(charCodes.lineFeed)) {\n for (let i = 0; i < 6; i++) this.space(true);\n }\n}\n\nexport function VariableDeclaration(\n this: Printer,\n node: t.VariableDeclaration,\n parent: t.Node,\n) {\n if (node.declare) {\n // TS\n this.word(\"declare\");\n this.space();\n }\n\n this.word(node.kind);\n this.space();\n\n let hasInits = false;\n // don't add whitespace to loop heads\n if (!isFor(parent)) {\n for (const declar of node.declarations) {\n if (declar.init) {\n // has an init so let's split it up over multiple lines\n hasInits = true;\n }\n }\n }\n\n //\n // use a pretty separator when we aren't in compact mode, have initializers and don't have retainLines on\n // this will format declarations like:\n //\n // let foo = \"bar\", bar = \"foo\";\n //\n // into\n //\n // let foo = \"bar\",\n // bar = \"foo\";\n //\n\n let separator;\n if (hasInits) {\n separator =\n node.kind === \"const\"\n ? constDeclarationIndent\n : variableDeclarationIndent;\n }\n\n //\n\n this.printList(node.declarations, node, { separator });\n\n if (isFor(parent)) {\n // don't give semicolons to these nodes since they'll be inserted in the parent generator\n if (isForStatement(parent)) {\n if (parent.init === node) return;\n } else {\n if (parent.left === node) return;\n }\n }\n\n this.semicolon();\n}\n\nexport function VariableDeclarator(this: Printer, node: t.VariableDeclarator) {\n this.print(node.id, node);\n if (node.definite) this.token(\"!\"); // TS\n // @ts-expect-error todo(flow-ts) Property 'typeAnnotation' does not exist on type 'MemberExpression'.\n this.print(node.id.typeAnnotation, node);\n if (node.init) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.init, node);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA;;;EACEA,K;EACAC,c;EACAC,a;EACAC;;;AAKK,SAASC,aAAT,CAAsCC,IAAtC,EAA6D;EAClE,KAAKC,IAAL,CAAU,MAAV;EACA,KAAKC,KAAL;EACA,KAAKC,SAAL;EACA,KAAKC,KAAL,CAAWJ,IAAI,CAACK,MAAhB,EAAwBL,IAAxB;EACA,KAAKG,SAAL;EACA,KAAKG,UAAL,CAAgBN,IAAhB;AACD;;AAEM,SAASO,WAAT,CAAoCP,IAApC,EAAyD;EAC9D,KAAKC,IAAL,CAAU,IAAV;EACA,KAAKC,KAAL;EACA,KAAKC,SAAL;EACA,KAAKC,KAAL,CAAWJ,IAAI,CAACQ,IAAhB,EAAsBR,IAAtB;EACA,KAAKG,SAAL;EACA,KAAKD,KAAL;EAEA,MAAMO,UAAU,GACdT,IAAI,CAACU,SAAL,IAAkBb,aAAa,CAACc,gBAAgB,CAACX,IAAI,CAACY,UAAN,CAAjB,CADjC;;EAEA,IAAIH,UAAJ,EAAgB;IACd,KAAKN,SAAL;IACA,KAAKU,OAAL;IACA,KAAKC,MAAL;EACD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ACA,KAAKD,KAAL;IACA,KAAKE,KAAL,CAAWJ,IAAI,CAACsB,IAAhB,EAAsBtB,IAAtB;EACD;AACF"} \ No newline at end of file +{"version":3,"names":["isFor","isForStatement","isIfStatement","isStatement","WithStatement","node","word","space","token","print","object","printBlock","IfStatement","test","needsBlock","alternate","getLastStatement","consequent","newline","indent","printAndIndentOnComments","dedent","endsWith","statement","body","ForStatement","inForStatementInitCounter","init","update","WhileStatement","ForXStatement","isForOf","type","await","noIndentInnerCommentsHere","left","right","ForInStatement","ForOfStatement","DoWhileStatement","semicolon","printStatementAfterKeyword","printer","parent","isLabel","printTerminatorless","BreakStatement","label","ContinueStatement","ReturnStatement","argument","ThrowStatement","LabeledStatement","TryStatement","block","handlers","handler","finalizer","CatchClause","param","typeAnnotation","SwitchStatement","discriminant","printSequence","cases","addNewlines","leading","cas","length","SwitchCase","DebuggerStatement","VariableDeclaration","declare","kind","hasInits","declar","declarations","printList","separator","undefined","VariableDeclarator","id","definite"],"sources":["../../src/generators/statements.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport {\n isFor,\n isForStatement,\n isIfStatement,\n isStatement,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport * as charCodes from \"charcodes\";\n\nexport function WithStatement(this: Printer, node: t.WithStatement) {\n this.word(\"with\");\n this.space();\n this.token(\"(\");\n this.print(node.object, node);\n this.token(\")\");\n this.printBlock(node);\n}\n\nexport function IfStatement(this: Printer, node: t.IfStatement) {\n this.word(\"if\");\n this.space();\n this.token(\"(\");\n this.print(node.test, node);\n this.token(\")\");\n this.space();\n\n const needsBlock =\n node.alternate && isIfStatement(getLastStatement(node.consequent));\n if (needsBlock) {\n this.token(\"{\");\n this.newline();\n this.indent();\n }\n\n this.printAndIndentOnComments(node.consequent, node);\n\n if (needsBlock) {\n this.dedent();\n this.newline();\n this.token(\"}\");\n }\n\n if (node.alternate) {\n if (this.endsWith(charCodes.rightCurlyBrace)) this.space();\n this.word(\"else\");\n this.space();\n this.printAndIndentOnComments(node.alternate, node);\n }\n}\n\n// Recursively get the last statement.\nfunction getLastStatement(statement: t.Statement): t.Statement {\n // @ts-expect-error: If statement.body is empty or not a Node, isStatement will return false\n const { body } = statement;\n if (isStatement(body) === false) {\n return statement;\n }\n\n return getLastStatement(body);\n}\n\nexport function ForStatement(this: Printer, node: t.ForStatement) {\n this.word(\"for\");\n this.space();\n this.token(\"(\");\n\n this.inForStatementInitCounter++;\n this.print(node.init, node);\n this.inForStatementInitCounter--;\n this.token(\";\");\n\n if (node.test) {\n this.space();\n this.print(node.test, node);\n }\n this.token(\";\");\n\n if (node.update) {\n this.space();\n this.print(node.update, node);\n }\n\n this.token(\")\");\n this.printBlock(node);\n}\n\nexport function WhileStatement(this: Printer, node: t.WhileStatement) {\n this.word(\"while\");\n this.space();\n this.token(\"(\");\n this.print(node.test, node);\n this.token(\")\");\n this.printBlock(node);\n}\n\nfunction ForXStatement(this: Printer, node: t.ForXStatement) {\n this.word(\"for\");\n this.space();\n const isForOf = node.type === \"ForOfStatement\";\n if (isForOf && node.await) {\n this.word(\"await\");\n this.space();\n }\n this.noIndentInnerCommentsHere();\n this.token(\"(\");\n this.print(node.left, node);\n this.space();\n this.word(isForOf ? \"of\" : \"in\");\n this.space();\n this.print(node.right, node);\n this.token(\")\");\n this.printBlock(node);\n}\n\nexport const ForInStatement = ForXStatement;\nexport const ForOfStatement = ForXStatement;\n\nexport function DoWhileStatement(this: Printer, node: t.DoWhileStatement) {\n this.word(\"do\");\n this.space();\n this.print(node.body, node);\n this.space();\n this.word(\"while\");\n this.space();\n this.token(\"(\");\n this.print(node.test, node);\n this.token(\")\");\n this.semicolon();\n}\n\nfunction printStatementAfterKeyword(\n printer: Printer,\n node: t.Node,\n parent: t.Node,\n isLabel: boolean,\n) {\n if (node) {\n printer.space();\n printer.printTerminatorless(node, parent, isLabel);\n }\n\n printer.semicolon();\n}\n\nexport function BreakStatement(this: Printer, node: t.ContinueStatement) {\n this.word(\"break\");\n printStatementAfterKeyword(this, node.label, node, true);\n}\n\nexport function ContinueStatement(this: Printer, node: t.ContinueStatement) {\n this.word(\"continue\");\n printStatementAfterKeyword(this, node.label, node, true);\n}\n\nexport function ReturnStatement(this: Printer, node: t.ReturnStatement) {\n this.word(\"return\");\n printStatementAfterKeyword(this, node.argument, node, false);\n}\n\nexport function ThrowStatement(this: Printer, node: t.ThrowStatement) {\n this.word(\"throw\");\n printStatementAfterKeyword(this, node.argument, node, false);\n}\n\nexport function LabeledStatement(this: Printer, node: t.LabeledStatement) {\n this.print(node.label, node);\n this.token(\":\");\n this.space();\n this.print(node.body, node);\n}\n\nexport function TryStatement(this: Printer, node: t.TryStatement) {\n this.word(\"try\");\n this.space();\n this.print(node.block, node);\n this.space();\n\n // Esprima bug puts the catch clause in a `handlers` array.\n // see https://code.google.com/p/esprima/issues/detail?id=433\n // We run into this from regenerator generated ast.\n // @ts-expect-error todo(flow->ts) should ast node type be updated to support this?\n if (node.handlers) {\n // @ts-expect-error todo(flow->ts) should ast node type be updated to support this?\n this.print(node.handlers[0], node);\n } else {\n this.print(node.handler, node);\n }\n\n if (node.finalizer) {\n this.space();\n this.word(\"finally\");\n this.space();\n this.print(node.finalizer, node);\n }\n}\n\nexport function CatchClause(this: Printer, node: t.CatchClause) {\n this.word(\"catch\");\n this.space();\n if (node.param) {\n this.token(\"(\");\n this.print(node.param, node);\n this.print(node.param.typeAnnotation, node);\n this.token(\")\");\n this.space();\n }\n this.print(node.body, node);\n}\n\nexport function SwitchStatement(this: Printer, node: t.SwitchStatement) {\n this.word(\"switch\");\n this.space();\n this.token(\"(\");\n this.print(node.discriminant, node);\n this.token(\")\");\n this.space();\n this.token(\"{\");\n\n this.printSequence(node.cases, node, {\n indent: true,\n addNewlines(leading, cas) {\n if (!leading && node.cases[node.cases.length - 1] === cas) return -1;\n },\n });\n\n this.token(\"}\");\n}\n\nexport function SwitchCase(this: Printer, node: t.SwitchCase) {\n if (node.test) {\n this.word(\"case\");\n this.space();\n this.print(node.test, node);\n this.token(\":\");\n } else {\n this.word(\"default\");\n this.token(\":\");\n }\n\n if (node.consequent.length) {\n this.newline();\n this.printSequence(node.consequent, node, { indent: true });\n }\n}\n\nexport function DebuggerStatement(this: Printer) {\n this.word(\"debugger\");\n this.semicolon();\n}\n\nexport function VariableDeclaration(\n this: Printer,\n node: t.VariableDeclaration,\n parent: t.Node,\n) {\n if (node.declare) {\n // TS\n this.word(\"declare\");\n this.space();\n }\n\n const { kind } = node;\n this.word(kind, kind === \"using\");\n this.space();\n\n let hasInits = false;\n // don't add whitespace to loop heads\n if (!isFor(parent)) {\n for (const declar of node.declarations) {\n if (declar.init) {\n // has an init so let's split it up over multiple lines\n hasInits = true;\n }\n }\n }\n\n //\n // use a pretty separator when we aren't in compact mode, have initializers and don't have retainLines on\n // this will format declarations like:\n //\n // let foo = \"bar\", bar = \"foo\";\n //\n // into\n //\n // let foo = \"bar\",\n // bar = \"foo\";\n //\n\n this.printList(node.declarations, node, {\n separator: hasInits\n ? function (this: Printer) {\n this.token(\",\");\n this.newline();\n }\n : undefined,\n indent: node.declarations.length > 1 ? true : false,\n });\n\n if (isFor(parent)) {\n // don't give semicolons to these nodes since they'll be inserted in the parent generator\n if (isForStatement(parent)) {\n if (parent.init === node) return;\n } else {\n if (parent.left === node) return;\n }\n }\n\n this.semicolon();\n}\n\nexport function VariableDeclarator(this: Printer, node: t.VariableDeclarator) {\n this.print(node.id, node);\n if (node.definite) this.token(\"!\"); // TS\n // @ts-expect-error todo(flow-ts) Property 'typeAnnotation' does not exist on type 'MemberExpression'.\n this.print(node.id.typeAnnotation, node);\n if (node.init) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.init, node);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;AAKsB;EAJpBA,KAAK;EACLC,cAAc;EACdC,aAAa;EACbC;AAAW;AAKN,SAASC,aAAa,CAAgBC,IAAqB,EAAE;EAClE,IAAI,CAACC,IAAI,CAAC,MAAM,CAAC;EACjB,IA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AE,IAAI,CAAC1E,SAAK,IAAK;EAElC,IAAI,CAACC,KAAK,CAACJ,IAAI,CAAC4E,EAAE,CAACrB,cAAc,EAAEvD,IAAI,CAAC;EACxC,IAAIA,IAAI,CAACsB,IAAI,EAAE;IACb,IAAI,CAACpB,KAAK,EAAE;IACZ,IAAI,CAACC,SAAK,IAAK;IACf,IAAI,CAACD,KAAK,EAAE;IACZ,IAAI,CAACE,KAAK,CAACJ,IAAI,CAACsB,IAAI,EAAEtB,IAAI,CAAC;EAC7B;AACF"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/template-literals.js b/node_modules/@babel/generator/lib/generators/template-literals.js index 6d38dd8f8..737d33c60 100644 --- a/node_modules/@babel/generator/lib/generators/template-literals.js +++ b/node_modules/@babel/generator/lib/generators/template-literals.js @@ -6,26 +6,21 @@ Object.defineProperty(exports, "__esModule", { exports.TaggedTemplateExpression = TaggedTemplateExpression; exports.TemplateElement = TemplateElement; exports.TemplateLiteral = TemplateLiteral; - function TaggedTemplateExpression(node) { this.print(node.tag, node); this.print(node.typeParameters, node); this.print(node.quasi, node); } - function TemplateElement(node, parent) { const isFirst = parent.quasis[0] === node; const isLast = parent.quasis[parent.quasis.length - 1] === node; const value = (isFirst ? "`" : "}") + node.value.raw + (isLast ? "`" : "${"); this.token(value, true); } - function TemplateLiteral(node) { const quasis = node.quasis; - for (let i = 0; i < quasis.length; i++) { this.print(quasis[i], node); - if (i + 1 < quasis.length) { this.print(node.expressions[i], node); } diff --git a/node_modules/@babel/generator/lib/generators/template-literals.js.map b/node_modules/@babel/generator/lib/generators/template-literals.js.map index 27e01d137..6d89ddbe9 100644 --- a/node_modules/@babel/generator/lib/generators/template-literals.js.map +++ b/node_modules/@babel/generator/lib/generators/template-literals.js.map @@ -1 +1 @@ -{"version":3,"names":["TaggedTemplateExpression","node","print","tag","typeParameters","quasi","TemplateElement","parent","isFirst","quasis","isLast","length","value","raw","token","TemplateLiteral","i","expressions"],"sources":["../../src/generators/template-literals.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport type * as t from \"@babel/types\";\n\nexport function TaggedTemplateExpression(\n this: Printer,\n node: t.TaggedTemplateExpression,\n) {\n this.print(node.tag, node);\n this.print(node.typeParameters, node); // TS\n this.print(node.quasi, node);\n}\n\nexport function TemplateElement(\n this: Printer,\n node: t.TemplateElement,\n parent: t.TemplateLiteral,\n) {\n const isFirst = parent.quasis[0] === node;\n const isLast = parent.quasis[parent.quasis.length - 1] === node;\n\n const value = (isFirst ? \"`\" : \"}\") + node.value.raw + (isLast ? \"`\" : \"${\");\n\n this.token(value, true);\n}\n\nexport function TemplateLiteral(this: Printer, node: t.TemplateLiteral) {\n const quasis = node.quasis;\n\n for (let i = 0; i < quasis.length; i++) {\n this.print(quasis[i], node);\n\n if (i + 1 < quasis.length) {\n this.print(node.expressions[i], node);\n }\n }\n}\n"],"mappings":";;;;;;;;;AAGO,SAASA,wBAAT,CAELC,IAFK,EAGL;EACA,KAAKC,KAAL,CAAWD,IAAI,CAACE,GAAhB,EAAqBF,IAArB;EACA,KAAKC,KAAL,CAAWD,IAAI,CAACG,cAAhB,EAAgCH,IAAhC;EACA,KAAKC,KAAL,CAAWD,IAAI,CAACI,KAAhB,EAAuBJ,IAAvB;AACD;;AAEM,SAASK,eAAT,CAELL,IAFK,EAGLM,MAHK,EAIL;EACA,MAAMC,OAAO,GAAGD,MAAM,CAACE,MAAP,CAAc,CAAd,MAAqBR,IAArC;EACA,MAAMS,MAAM,GAAGH,MAAM,CAACE,MAAP,CAAcF,MAAM,CAACE,MAAP,CAAcE,MAAd,GAAuB,CAArC,MAA4CV,IAA3D;EAEA,MAAMW,KAAK,GAAG,CAACJ,OAAO,GAAG,GAAH,GAAS,GAAjB,IAAwBP,IAAI,CAACW,KAAL,CAAWC,GAAnC,IAA0CH,MAAM,GAAG,GAAH,GAAS,IAAzD,CAAd;EAEA,KAAKI,KAAL,CAAWF,KAAX,EAAkB,IAAlB;AACD;;AAEM,SAASG,eAAT,CAAwCd,IAAxC,EAAiE;EACtE,MAAMQ,MAAM,GAAGR,IAAI,CAACQ,MAApB;;EAEA,KAAK,IAAIO,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGP,MAAM,CAACE,MAA3B,EAAmCK,CAAC,EAApC,EAAwC;IACtC,KAAKd,KAAL,CAAWO,MAAM,CAACO,CAAD,CAAjB,EAAsBf,IAAtB;;IAEA,IAAIe,CAAC,GAAG,CAAJ,GAAQP,MAAM,CAACE,MAAnB,EAA2B;MACzB,KAAKT,KAAL,CAAWD,IAAI,CAACgB,WAAL,CAAiBD,CAAjB,CAAX,EAAgCf,IAAhC;IACD;EACF;AACF"} \ No newline at end of file +{"version":3,"names":["TaggedTemplateExpression","node","print","tag","typeParameters","quasi","TemplateElement","parent","isFirst","quasis","isLast","length","value","raw","token","TemplateLiteral","i","expressions"],"sources":["../../src/generators/template-literals.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport type * as t from \"@babel/types\";\n\nexport function TaggedTemplateExpression(\n this: Printer,\n node: t.TaggedTemplateExpression,\n) {\n this.print(node.tag, node);\n this.print(node.typeParameters, node); // TS\n this.print(node.quasi, node);\n}\n\nexport function TemplateElement(\n this: Printer,\n node: t.TemplateElement,\n parent: t.TemplateLiteral,\n) {\n const isFirst = parent.quasis[0] === node;\n const isLast = parent.quasis[parent.quasis.length - 1] === node;\n\n const value = (isFirst ? \"`\" : \"}\") + node.value.raw + (isLast ? \"`\" : \"${\");\n\n this.token(value, true);\n}\n\nexport function TemplateLiteral(this: Printer, node: t.TemplateLiteral) {\n const quasis = node.quasis;\n\n for (let i = 0; i < quasis.length; i++) {\n this.print(quasis[i], node);\n\n if (i + 1 < quasis.length) {\n this.print(node.expressions[i], node);\n }\n }\n}\n"],"mappings":";;;;;;;;AAGO,SAASA,wBAAwB,CAEtCC,IAAgC,EAChC;EACA,IAAI,CAACC,KAAK,CAACD,IAAI,CAACE,GAAG,EAAEF,IAAI,CAAC;EAC1B,IAAI,CAACC,KAAK,CAACD,IAAI,CAACG,cAAc,EAAEH,IAAI,CAAC;EACrC,IAAI,CAACC,KAAK,CAACD,IAAI,CAACI,KAAK,EAAEJ,IAAI,CAAC;AAC9B;AAEO,SAASK,eAAe,CAE7BL,IAAuB,EACvBM,MAAyB,EACzB;EACA,MAAMC,OAAO,GAAGD,MAAM,CAACE,MAAM,CAAC,CAAC,CAAC,KAAKR,IAAI;EACzC,MAAMS,MAAM,GAAGH,MAAM,CAACE,MAAM,CAACF,MAAM,CAACE,MAAM,CAACE,MAAM,GAAG,CAAC,CAAC,KAAKV,IAAI;EAE/D,MAAMW,KAAK,GAAG,CAACJ,OAAO,GAAG,GAAG,GAAG,GAAG,IAAIP,IAAI,CAACW,KAAK,CAACC,GAAG,IAAIH,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC;EAE5E,IAAI,CAACI,KAAK,CAACF,KAAK,EAAE,IAAI,CAAC;AACzB;AAEO,SAASG,eAAe,CAAgBd,IAAuB,EAAE;EACtE,MAAMQ,MAAM,GAAGR,IAAI,CAACQ,MAAM;EAE1B,KAAK,IAAIO,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGP,MAAM,CAACE,MAAM,EAAEK,CAAC,EAAE,EAAE;IACtC,IAAI,CAACd,KAAK,CAACO,MAAM,CAACO,CAAC,CAAC,EAAEf,IAAI,CAAC;IAE3B,IAAIe,CAAC,GAAG,CAAC,GAAGP,MAAM,CAACE,MAAM,EAAE;MACzB,IAAI,CAACT,KAAK,CAACD,IAAI,CAACgB,WAAW,CAACD,CAAC,CAAC,EAAEf,IAAI,CAAC;IACvC;EACF;AACF"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/types.js b/node_modules/@babel/generator/lib/generators/types.js index 0c61f00f5..a13edbbd7 100644 --- a/node_modules/@babel/generator/lib/generators/types.js +++ b/node_modules/@babel/generator/lib/generators/types.js @@ -23,36 +23,25 @@ exports.SpreadElement = exports.RestElement = RestElement; exports.StringLiteral = StringLiteral; exports.TopicReference = TopicReference; exports.TupleExpression = TupleExpression; - var _t = require("@babel/types"); - var _jsesc = require("jsesc"); - const { isAssignmentPattern, isIdentifier } = _t; - function Identifier(node) { - this.exactSource(node.loc, () => { - this.word(node.name); - }); + this.word(node.name); } - function ArgumentPlaceholder() { this.tokenChar(63); } - function RestElement(node) { this.token("..."); this.print(node.argument, node); } - function ObjectExpression(node) { const props = node.properties; this.tokenChar(123); - this.printInnerComments(node); - if (props.length) { this.space(); this.printList(props, node, { @@ -61,53 +50,43 @@ function ObjectExpression(node) { }); this.space(); } - + this.sourceWithOffset("end", node.loc, 0, -1); this.tokenChar(125); } - function ObjectMethod(node) { this.printJoin(node.decorators, node); - this._methodHead(node); - this.space(); this.print(node.body, node); } - function ObjectProperty(node) { this.printJoin(node.decorators, node); - if (node.computed) { this.tokenChar(91); this.print(node.key, node); this.tokenChar(93); } else { - if (isAssignmentPattern(node.value) && isIdentifier(node.key) && node.key.name === node.value.left.name) { + if (isAssignmentPattern(node.value) && isIdentifier(node.key) && + node.key.name === node.value.left.name) { this.print(node.value, node); return; } - this.print(node.key, node); if (node.shorthand && isIdentifier(node.key) && isIdentifier(node.value) && node.key.name === node.value.name) { return; } } - this.tokenChar(58); this.space(); this.print(node.value, node); } - function ArrayExpression(node) { const elems = node.elements; const len = elems.length; this.tokenChar(91); - this.printInnerComments(node); - for (let i = 0; i < elems.length; i++) { const elem = elems[i]; - if (elem) { if (i > 0) this.space(); this.print(elem, node); @@ -116,15 +95,12 @@ function ArrayExpression(node) { this.tokenChar(44); } } - this.tokenChar(93); } - function RecordExpression(node) { const props = node.properties; let startToken; let endToken; - if (this.format.recordAndTupleSyntaxType === "bar") { startToken = "{|"; endToken = "|}"; @@ -134,10 +110,7 @@ function RecordExpression(node) { startToken = "#{"; endToken = "}"; } - this.token(startToken); - this.printInnerComments(node); - if (props.length) { this.space(); this.printList(props, node, { @@ -146,16 +119,13 @@ function RecordExpression(node) { }); this.space(); } - this.token(endToken); } - function TupleExpression(node) { const elems = node.elements; const len = elems.length; let startToken; let endToken; - if (this.format.recordAndTupleSyntaxType === "bar") { startToken = "[|"; endToken = "|]"; @@ -165,40 +135,30 @@ function TupleExpression(node) { } else { throw new Error(`${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`); } - this.token(startToken); - this.printInnerComments(node); - for (let i = 0; i < elems.length; i++) { const elem = elems[i]; - if (elem) { if (i > 0) this.space(); this.print(elem, node); if (i < len - 1) this.tokenChar(44); } } - this.token(endToken); } - function RegExpLiteral(node) { this.word(`/${node.pattern}/${node.flags}`); } - function BooleanLiteral(node) { this.word(node.value ? "true" : "false"); } - function NullLiteral() { this.word("null"); } - function NumericLiteral(node) { const raw = this.getPossibleRaw(node); const opts = this.format.jsescOption; const value = node.value + ""; - if (opts.numbers) { this.number(_jsesc(node.value, opts)); } else if (raw == null) { @@ -209,51 +169,39 @@ function NumericLiteral(node) { this.number(raw); } } - function StringLiteral(node) { const raw = this.getPossibleRaw(node); - if (!this.format.minified && raw !== undefined) { this.token(raw); return; } - const val = _jsesc(node.value, Object.assign(this.format.jsescOption, this.format.jsonCompatibleStrings && { json: true })); - return this.token(val); } - function BigIntLiteral(node) { const raw = this.getPossibleRaw(node); - if (!this.format.minified && raw !== undefined) { this.word(raw); return; } - this.word(node.value + "n"); } - function DecimalLiteral(node) { const raw = this.getPossibleRaw(node); - if (!this.format.minified && raw !== undefined) { this.word(raw); return; } - this.word(node.value + "m"); } const validTopicTokenSet = new Set(["^^", "@@", "^", "%", "#"]); - function TopicReference() { const { topicToken } = this.format; - if (validTopicTokenSet.has(topicToken)) { this.token(topicToken); } else { @@ -266,11 +214,9 @@ function TopicReference() { function PipelineTopicExpression(node) { this.print(node.expression, node); } - function PipelineBareFunction(node) { this.print(node.callee, node); } - function PipelinePrimaryTopicReference() { this.tokenChar(35); } diff --git a/node_modules/@babel/generator/lib/generators/types.js.map b/node_modules/@babel/generator/lib/generators/types.js.map index 18ea3d1bb..5b0afb5ee 100644 --- a/node_modules/@babel/generator/lib/generators/types.js.map +++ b/node_modules/@babel/generator/lib/generators/types.js.map @@ -1 +1 @@ -{"version":3,"names":["isAssignmentPattern","isIdentifier","Identifier","node","exactSource","loc","word","name","ArgumentPlaceholder","token","RestElement","print","argument","ObjectExpression","props","properties","printInnerComments","length","space","printList","indent","statement","ObjectMethod","printJoin","decorators","_methodHead","body","ObjectProperty","computed","key","value","left","shorthand","ArrayExpression","elems","elements","len","i","elem","RecordExpression","startToken","endToken","format","recordAndTupleSyntaxType","Error","JSON","stringify","TupleExpression","RegExpLiteral","pattern","flags","BooleanLiteral","NullLiteral","NumericLiteral","raw","getPossibleRaw","opts","jsescOption","numbers","number","jsesc","minified","StringLiteral","undefined","val","Object","assign","jsonCompatibleStrings","json","BigIntLiteral","DecimalLiteral","validTopicTokenSet","Set","TopicReference","topicToken","has","givenTopicTokenJSON","validTopics","Array","from","v","join","PipelineTopicExpression","expression","PipelineBareFunction","callee","PipelinePrimaryTopicReference"],"sources":["../../src/generators/types.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport { isAssignmentPattern, isIdentifier } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport jsesc from \"jsesc\";\n\nexport function Identifier(this: Printer, node: t.Identifier) {\n this.exactSource(node.loc, () => {\n this.word(node.name);\n });\n}\n\nexport function ArgumentPlaceholder(this: Printer) {\n this.token(\"?\");\n}\n\nexport function RestElement(this: Printer, node: t.RestElement) {\n this.token(\"...\");\n this.print(node.argument, node);\n}\n\nexport { RestElement as SpreadElement };\n\nexport function ObjectExpression(this: Printer, node: t.ObjectExpression) {\n const props = node.properties;\n\n this.token(\"{\");\n this.printInnerComments(node);\n\n if (props.length) {\n this.space();\n this.printList(props, node, { indent: true, statement: true });\n this.space();\n }\n\n this.token(\"}\");\n}\n\nexport { ObjectExpression as ObjectPattern };\n\nexport function ObjectMethod(this: Printer, node: t.ObjectMethod) {\n this.printJoin(node.decorators, node);\n this._methodHead(node);\n this.space();\n this.print(node.body, node);\n}\n\nexport function ObjectProperty(this: Printer, node: t.ObjectProperty) {\n this.printJoin(node.decorators, node);\n\n if (node.computed) {\n this.token(\"[\");\n this.print(node.key, node);\n this.token(\"]\");\n } else {\n // print `({ foo: foo = 5 } = {})` as `({ foo = 5 } = {});`\n if (\n isAssignmentPattern(node.value) &&\n isIdentifier(node.key) &&\n // @ts-expect-error todo(flow->ts) `.name` does not exist on some types in union\n node.key.name === node.value.left.name\n ) {\n this.print(node.value, node);\n return;\n }\n\n this.print(node.key, node);\n\n // shorthand!\n if (\n node.shorthand &&\n isIdentifier(node.key) &&\n isIdentifier(node.value) &&\n node.key.name === node.value.name\n ) {\n return;\n }\n }\n\n this.token(\":\");\n this.space();\n this.print(node.value, node);\n}\n\nexport function ArrayExpression(this: Printer, node: t.ArrayExpression) {\n const elems = node.elements;\n const len = elems.length;\n\n this.token(\"[\");\n this.printInnerComments(node);\n\n for (let i = 0; i < elems.length; i++) {\n const elem = elems[i];\n if (elem) {\n if (i > 0) this.space();\n this.print(elem, node);\n if (i < len - 1) this.token(\",\");\n } else {\n // If the array expression ends with a hole, that hole\n // will be ignored by the interpreter, but if it ends with\n // two (or more) holes, we need to write out two (or more)\n // commas so that the resulting code is interpreted with\n // both (all) of the holes.\n this.token(\",\");\n }\n }\n\n this.token(\"]\");\n}\n\nexport { ArrayExpression as ArrayPattern };\n\nexport function RecordExpression(this: Printer, node: t.RecordExpression) {\n const props = node.properties;\n\n let startToken;\n let endToken;\n if (this.format.recordAndTupleSyntaxType === \"bar\") {\n startToken = \"{|\";\n endToken = \"|}\";\n } else if (\n this.format.recordAndTupleSyntaxType !== \"hash\" &&\n this.format.recordAndTupleSyntaxType != null\n ) {\n throw new Error(\n `The \"recordAndTupleSyntaxType\" generator option must be \"bar\" or \"hash\" (${JSON.stringify(\n this.format.recordAndTupleSyntaxType,\n )} received).`,\n );\n } else {\n startToken = \"#{\";\n endToken = \"}\";\n }\n\n this.token(startToken);\n this.printInnerComments(node);\n\n if (props.length) {\n this.space();\n this.printList(props, node, { indent: true, statement: true });\n this.space();\n }\n this.token(endToken);\n}\n\nexport function TupleExpression(this: Printer, node: t.TupleExpression) {\n const elems = node.elements;\n const len = elems.length;\n\n let startToken;\n let endToken;\n if (this.format.recordAndTupleSyntaxType === \"bar\") {\n startToken = \"[|\";\n endToken = \"|]\";\n } else if (this.format.recordAndTupleSyntaxType === \"hash\") {\n startToken = \"#[\";\n endToken = \"]\";\n } else {\n throw new Error(\n `${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`,\n );\n }\n\n this.token(startToken);\n this.printInnerComments(node);\n\n for (let i = 0; i < elems.length; i++) {\n const elem = elems[i];\n if (elem) {\n if (i > 0) this.space();\n this.print(elem, node);\n if (i < len - 1) this.token(\",\");\n }\n }\n\n this.token(endToken);\n}\n\nexport function RegExpLiteral(this: Printer, node: t.RegExpLiteral) {\n this.word(`/${node.pattern}/${node.flags}`);\n}\n\nexport function BooleanLiteral(this: Printer, node: t.BooleanLiteral) {\n this.word(node.value ? \"true\" : \"false\");\n}\n\nexport function NullLiteral(this: Printer) {\n this.word(\"null\");\n}\n\nexport function NumericLiteral(this: Printer, node: t.NumericLiteral) {\n const raw = this.getPossibleRaw(node);\n const opts = this.format.jsescOption;\n const value = node.value + \"\";\n if (opts.numbers) {\n this.number(jsesc(node.value, opts));\n } else if (raw == null) {\n this.number(value); // normalize\n } else if (this.format.minified) {\n this.number(raw.length < value.length ? raw : value);\n } else {\n this.number(raw);\n }\n}\n\nexport function StringLiteral(this: Printer, node: t.StringLiteral) {\n const raw = this.getPossibleRaw(node);\n if (!this.format.minified && raw !== undefined) {\n this.token(raw);\n return;\n }\n\n const val = jsesc(\n node.value,\n process.env.BABEL_8_BREAKING\n ? this.format.jsescOption\n : Object.assign(\n this.format.jsescOption,\n this.format.jsonCompatibleStrings && { json: true },\n ),\n );\n\n return this.token(val);\n}\n\nexport function BigIntLiteral(this: Printer, node: t.BigIntLiteral) {\n const raw = this.getPossibleRaw(node);\n if (!this.format.minified && raw !== undefined) {\n this.word(raw);\n return;\n }\n this.word(node.value + \"n\");\n}\n\nexport function DecimalLiteral(this: Printer, node: t.DecimalLiteral) {\n const raw = this.getPossibleRaw(node);\n if (!this.format.minified && raw !== undefined) {\n this.word(raw);\n return;\n }\n this.word(node.value + \"m\");\n}\n\n// Hack pipe operator\nconst validTopicTokenSet = new Set([\"^^\", \"@@\", \"^\", \"%\", \"#\"]);\nexport function TopicReference(this: Printer) {\n const { topicToken } = this.format;\n\n if (validTopicTokenSet.has(topicToken)) {\n this.token(topicToken);\n } else {\n const givenTopicTokenJSON = JSON.stringify(topicToken);\n const validTopics = Array.from(validTopicTokenSet, v => JSON.stringify(v));\n throw new Error(\n `The \"topicToken\" generator option must be one of ` +\n `${validTopics.join(\", \")} (${givenTopicTokenJSON} received instead).`,\n );\n }\n}\n\n// Smart-mix pipe operator\nexport function PipelineTopicExpression(\n this: Printer,\n node: t.PipelineTopicExpression,\n) {\n this.print(node.expression, node);\n}\n\nexport function PipelineBareFunction(\n this: Printer,\n node: t.PipelineBareFunction,\n) {\n this.print(node.callee, node);\n}\n\nexport function PipelinePrimaryTopicReference(this: Printer) {\n this.token(\"#\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;;EAFSA,mB;EAAqBC;;;AAIvB,SAASC,UAAT,CAAmCC,IAAnC,EAAuD;EAC5D,KAAKC,WAAL,CAAiBD,IAAI,CAACE,GAAtB,EAA2B,MAAM;IAC/B,KAAKC,IAAL,CAAUH,IAAI,CAACI,IAAf;EACD,CAFD;AAGD;;AAEM,SAASC,mBAAT,GAA4C;EACjD,KAAKC,SAAL;AACD;;AAEM,SAASC,WAAT,CAAoCP,IAApC,EAAyD;EAC9D,KAAKM,KAAL,CAAW,KAAX;EACA,KAAKE,KAAL,CAAWR,IAAI,CAACS,QAAhB,EAA0BT,IAA1B;AACD;;AAIM,SAASU,gBAAT,CAAyCV,IAAzC,EAAmE;EACxE,MAAMW,KAAK,GAAGX,IAAI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,cAAT,GAAuC;EAC5C,MAAM;IAAEC;EAAF,IAAiB,KAAKhC,MAA5B;;EAEA,IAAI6B,kBAAkB,CAACI,GAAnB,CAAuBD,UAAvB,CAAJ,EAAwC;IACtC,KAAKjE,KAAL,CAAWiE,UAAX;EACD,CAFD,MAEO;IACL,MAAME,mBAAmB,GAAG/B,IAAI,CAACC,SAAL,CAAe4B,UAAf,CAA5B;IACA,MAAMG,WAAW,GAAGC,KAAK,CAACC,IAAN,CAAWR,kBAAX,EAA+BS,CAAC,IAAInC,IAAI,CAACC,SAAL,CAAekC,CAAf,CAApC,CAApB;IACA,MAAM,IAAIpC,KAAJ,CACH,mDAAD,GACG,GAAEiC,WAAW,CAACI,IAAZ,CAAiB,IAAjB,CAAuB,KAAIL,mBAAoB,qBAFhD,CAAN;EAID;AACF;;AAGM,SAASM,uBAAT,CAEL/E,IAFK,EAGL;EACA,KAAKQ,KAAL,CAAWR,IAAI,CAACgF,UAAhB,EAA4BhF,IAA5B;AACD;;AAEM,SAASiF,oBAAT,CAELjF,IAFK,EAGL;EACA,KAAKQ,KAAL,CAAWR,IAAI,CAACkF,MAAhB,EAAwBlF,IAAxB;AACD;;AAEM,SAASmF,6BAAT,GAAsD;EAC3D,KAAK7E,SAAL;AACD"} \ No newline at end of file +{"version":3,"names":["isAssignmentPattern","isIdentifier","Identifier","node","word","name","ArgumentPlaceholder","token","RestElement","print","argument","ObjectExpression","props","properties","length","space","printList","indent","statement","sourceWithOffset","loc","ObjectMethod","printJoin","decorators","_methodHead","body","ObjectProperty","computed","key","value","left","shorthand","ArrayExpression","elems","elements","len","i","elem","RecordExpression","startToken","endToken","format","recordAndTupleSyntaxType","Error","JSON","stringify","TupleExpression","RegExpLiteral","pattern","flags","BooleanLiteral","NullLiteral","NumericLiteral","raw","getPossibleRaw","opts","jsescOption","numbers","number","jsesc","minified","StringLiteral","undefined","val","Object","assign","jsonCompatibleStrings","json","BigIntLiteral","DecimalLiteral","validTopicTokenSet","Set","TopicReference","topicToken","has","givenTopicTokenJSON","validTopics","Array","from","v","join","PipelineTopicExpression","expression","PipelineBareFunction","callee","PipelinePrimaryTopicReference"],"sources":["../../src/generators/types.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport { isAssignmentPattern, isIdentifier } from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport jsesc from \"jsesc\";\n\nexport function Identifier(this: Printer, node: t.Identifier) {\n this.word(node.name);\n}\n\nexport function ArgumentPlaceholder(this: Printer) {\n this.token(\"?\");\n}\n\nexport function RestElement(this: Printer, node: t.RestElement) {\n this.token(\"...\");\n this.print(node.argument, node);\n}\n\nexport { RestElement as SpreadElement };\n\nexport function ObjectExpression(this: Printer, node: t.ObjectExpression) {\n const props = node.properties;\n\n this.token(\"{\");\n\n if (props.length) {\n this.space();\n this.printList(props, node, { indent: true, statement: true });\n this.space();\n }\n\n this.sourceWithOffset(\"end\", node.loc, 0, -1);\n\n this.token(\"}\");\n}\n\nexport { ObjectExpression as ObjectPattern };\n\nexport function ObjectMethod(this: Printer, node: t.ObjectMethod) {\n this.printJoin(node.decorators, node);\n this._methodHead(node);\n this.space();\n this.print(node.body, node);\n}\n\nexport function ObjectProperty(this: Printer, node: t.ObjectProperty) {\n this.printJoin(node.decorators, node);\n\n if (node.computed) {\n this.token(\"[\");\n this.print(node.key, node);\n this.token(\"]\");\n } else {\n // print `({ foo: foo = 5 } = {})` as `({ foo = 5 } = {});`\n if (\n isAssignmentPattern(node.value) &&\n isIdentifier(node.key) &&\n // @ts-expect-error todo(flow->ts) `.name` does not exist on some types in union\n node.key.name === node.value.left.name\n ) {\n this.print(node.value, node);\n return;\n }\n\n this.print(node.key, node);\n\n // shorthand!\n if (\n node.shorthand &&\n isIdentifier(node.key) &&\n isIdentifier(node.value) &&\n node.key.name === node.value.name\n ) {\n return;\n }\n }\n\n this.token(\":\");\n this.space();\n this.print(node.value, node);\n}\n\nexport function ArrayExpression(this: Printer, node: t.ArrayExpression) {\n const elems = node.elements;\n const len = elems.length;\n\n this.token(\"[\");\n\n for (let i = 0; i < elems.length; i++) {\n const elem = elems[i];\n if (elem) {\n if (i > 0) this.space();\n this.print(elem, node);\n if (i < len - 1) this.token(\",\");\n } else {\n // If the array expression ends with a hole, that hole\n // will be ignored by the interpreter, but if it ends with\n // two (or more) holes, we need to write out two (or more)\n // commas so that the resulting code is interpreted with\n // both (all) of the holes.\n this.token(\",\");\n }\n }\n\n this.token(\"]\");\n}\n\nexport { ArrayExpression as ArrayPattern };\n\nexport function RecordExpression(this: Printer, node: t.RecordExpression) {\n const props = node.properties;\n\n let startToken;\n let endToken;\n if (this.format.recordAndTupleSyntaxType === \"bar\") {\n startToken = \"{|\";\n endToken = \"|}\";\n } else if (\n this.format.recordAndTupleSyntaxType !== \"hash\" &&\n this.format.recordAndTupleSyntaxType != null\n ) {\n throw new Error(\n `The \"recordAndTupleSyntaxType\" generator option must be \"bar\" or \"hash\" (${JSON.stringify(\n this.format.recordAndTupleSyntaxType,\n )} received).`,\n );\n } else {\n startToken = \"#{\";\n endToken = \"}\";\n }\n\n this.token(startToken);\n\n if (props.length) {\n this.space();\n this.printList(props, node, { indent: true, statement: true });\n this.space();\n }\n this.token(endToken);\n}\n\nexport function TupleExpression(this: Printer, node: t.TupleExpression) {\n const elems = node.elements;\n const len = elems.length;\n\n let startToken;\n let endToken;\n if (this.format.recordAndTupleSyntaxType === \"bar\") {\n startToken = \"[|\";\n endToken = \"|]\";\n } else if (this.format.recordAndTupleSyntaxType === \"hash\") {\n startToken = \"#[\";\n endToken = \"]\";\n } else {\n throw new Error(\n `${this.format.recordAndTupleSyntaxType} is not a valid recordAndTuple syntax type`,\n );\n }\n\n this.token(startToken);\n\n for (let i = 0; i < elems.length; i++) {\n const elem = elems[i];\n if (elem) {\n if (i > 0) this.space();\n this.print(elem, node);\n if (i < len - 1) this.token(\",\");\n }\n }\n\n this.token(endToken);\n}\n\nexport function RegExpLiteral(this: Printer, node: t.RegExpLiteral) {\n this.word(`/${node.pattern}/${node.flags}`);\n}\n\nexport function BooleanLiteral(this: Printer, node: t.BooleanLiteral) {\n this.word(node.value ? \"true\" : \"false\");\n}\n\nexport function NullLiteral(this: Printer) {\n this.word(\"null\");\n}\n\nexport function NumericLiteral(this: Printer, node: t.NumericLiteral) {\n const raw = this.getPossibleRaw(node);\n const opts = this.format.jsescOption;\n const value = node.value + \"\";\n if (opts.numbers) {\n this.number(jsesc(node.value, opts));\n } else if (raw == null) {\n this.number(value); // normalize\n } else if (this.format.minified) {\n this.number(raw.length < value.length ? raw : value);\n } else {\n this.number(raw);\n }\n}\n\nexport function StringLiteral(this: Printer, node: t.StringLiteral) {\n const raw = this.getPossibleRaw(node);\n if (!this.format.minified && raw !== undefined) {\n this.token(raw);\n return;\n }\n\n const val = jsesc(\n node.value,\n process.env.BABEL_8_BREAKING\n ? this.format.jsescOption\n : Object.assign(\n this.format.jsescOption,\n this.format.jsonCompatibleStrings && { json: true },\n ),\n );\n\n return this.token(val);\n}\n\nexport function BigIntLiteral(this: Printer, node: t.BigIntLiteral) {\n const raw = this.getPossibleRaw(node);\n if (!this.format.minified && raw !== undefined) {\n this.word(raw);\n return;\n }\n this.word(node.value + \"n\");\n}\n\nexport function DecimalLiteral(this: Printer, node: t.DecimalLiteral) {\n const raw = this.getPossibleRaw(node);\n if (!this.format.minified && raw !== undefined) {\n this.word(raw);\n return;\n }\n this.word(node.value + \"m\");\n}\n\n// Hack pipe operator\nconst validTopicTokenSet = new Set([\"^^\", \"@@\", \"^\", \"%\", \"#\"]);\nexport function TopicReference(this: Printer) {\n const { topicToken } = this.format;\n\n if (validTopicTokenSet.has(topicToken)) {\n this.token(topicToken);\n } else {\n const givenTopicTokenJSON = JSON.stringify(topicToken);\n const validTopics = Array.from(validTopicTokenSet, v => JSON.stringify(v));\n throw new Error(\n `The \"topicToken\" generator option must be one of ` +\n `${validTopics.join(\", \")} (${givenTopicTokenJSON} received instead).`,\n );\n }\n}\n\n// Smart-mix pipe operator\nexport function PipelineTopicExpression(\n this: Printer,\n node: t.PipelineTopicExpression,\n) {\n this.print(node.expression, node);\n}\n\nexport function PipelineBareFunction(\n this: Printer,\n node: t.PipelineBareFunction,\n) {\n this.print(node.callee, node);\n}\n\nexport function PipelinePrimaryTopicReference(this: Printer) {\n this.token(\"#\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA;AAEA;AAA0B;EAFjBA,mBAAmB;EAAEC;AAAY;AAInC,SAASC,UAAU,CAAgBC,IAAkB,EAAE;EAC5D,IAAI,CAACC,IAAI,CAACD,IAAI,CAACE,IAAI,CAAC;AACtB;AAEO,SAASC,mBAAmB,GAAgB;EACjD,IAAI,CAACC,SAAK,IAAK;AACjB;AAEO,SAASC,WAAW,CAAgBL,IAAmB,EAAE;EAC9D,IAAI,CAACI,KAAK,CAAC,KAAK,CAAC;EACjB,IAAI,CAACE,KAAK,CAACN,IAAI,CAACO,QAAQ,EAAEP,IAAI,CAAC;AACjC;AAIO,SAASQ,gBAAgB,CAAgBR,IAAwB,EAAE;EACxE,MAAMS,KAAK,GAAGT,IAAI,CAACU,UAAU;EAE7B,IAAI,CAACN,SAAK,KAAK;EAEf,IAAIK,KAAK,CAACE,MAAM,EAAE;IAChB,IAAI,CAACC,KAAK,EAAE;IACZ,IAAI,CAACC,SAAS,CAACJ,KAAK,EAAET,IAAI,EAAE;MAAEc,MAAM,EAAE,IAAI;MAAEC,SAAS,EAAE;IAAK,CAAC,CAAC;IAC9D,IAAI,CAACH,KAAK,EAAE;EACd;EAEA,IAAI,CAACI,gBAAgB,CAAC,KAAK,EAAEhB,IAAI,CAACiB,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;EAE7C,IAAI,CAACb,SAAK,KAAK;AACjB;AAIO,SAASc,YAAY,CAAgBlB,IAAoB,EAAE;EAChE,IAAI,CAACmB,SAAS,CAACnB,IAAI,CAACoB,UAAU,EAAEpB,IAAI,CAAC;EACrC,IAAI,CAACqB,WAAW,CAACrB,IAAI,CAAC;EACtB,IAAI,C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ACxB,CAAC,MAAM;IACL,MAAME,mBAAmB,GAAG/B,IAAI,CAACC,SAAS,CAAC4B,UAAU,CAAC;IACtD,MAAMG,WAAW,GAAGC,KAAK,CAACC,IAAI,CAACR,kBAAkB,EAAES,CAAC,IAAInC,IAAI,CAACC,SAAS,CAACkC,CAAC,CAAC,CAAC;IAC1E,MAAM,IAAIpC,KAAK,CACZ,mDAAkD,GAChD,GAAEiC,WAAW,CAACI,IAAI,CAAC,IAAI,CAAE,KAAIL,mBAAoB,qBAAoB,CACzE;EACH;AACF;;AAGO,SAASM,uBAAuB,CAErC9E,IAA+B,EAC/B;EACA,IAAI,CAACM,KAAK,CAACN,IAAI,CAAC+E,UAAU,EAAE/E,IAAI,CAAC;AACnC;AAEO,SAASgF,oBAAoB,CAElChF,IAA4B,EAC5B;EACA,IAAI,CAACM,KAAK,CAACN,IAAI,CAACiF,MAAM,EAAEjF,IAAI,CAAC;AAC/B;AAEO,SAASkF,6BAA6B,GAAgB;EAC3D,IAAI,CAAC9E,SAAK,IAAK;AACjB"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/generators/typescript.js b/node_modules/@babel/generator/lib/generators/typescript.js index aca097453..56624653a 100644 --- a/node_modules/@babel/generator/lib/generators/typescript.js +++ b/node_modules/@babel/generator/lib/generators/typescript.js @@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.TSAnyKeyword = TSAnyKeyword; exports.TSArrayType = TSArrayType; -exports.TSAsExpression = TSAsExpression; +exports.TSSatisfiesExpression = exports.TSAsExpression = TSTypeExpression; exports.TSBigIntKeyword = TSBigIntKeyword; exports.TSBooleanKeyword = TSBooleanKeyword; exports.TSCallSignatureDeclaration = TSCallSignatureDeclaration; @@ -71,45 +71,36 @@ exports.tsPrintFunctionOrConstructorType = tsPrintFunctionOrConstructorType; exports.tsPrintPropertyOrMethodName = tsPrintPropertyOrMethodName; exports.tsPrintSignatureDeclarationBase = tsPrintSignatureDeclarationBase; exports.tsPrintTypeLiteralOrInterfaceBody = tsPrintTypeLiteralOrInterfaceBody; - function TSTypeAnnotation(node) { this.tokenChar(58); this.space(); if (node.optional) this.tokenChar(63); this.print(node.typeAnnotation, node); } - function TSTypeParameterInstantiation(node, parent) { this.tokenChar(60); this.printList(node.params, node, {}); - if (parent.type === "ArrowFunctionExpression" && node.params.length === 1) { this.tokenChar(44); } - this.tokenChar(62); } - function TSTypeParameter(node) { if (node.in) { this.word("in"); this.space(); } - if (node.out) { this.word("out"); this.space(); } - this.word(node.name); - if (node.constraint) { this.space(); this.word("extends"); this.space(); this.print(node.constraint, node); } - if (node.default) { this.space(); this.tokenChar(61); @@ -117,238 +108,187 @@ function TSTypeParameter(node) { this.print(node.default, node); } } - function TSParameterProperty(node) { if (node.accessibility) { this.word(node.accessibility); this.space(); } - if (node.readonly) { this.word("readonly"); this.space(); } - this._param(node.parameter); } - function TSDeclareFunction(node) { if (node.declare) { this.word("declare"); this.space(); } - this._functionHead(node); - this.tokenChar(59); } - function TSDeclareMethod(node) { this._classMethodHead(node); - this.tokenChar(59); } - function TSQualifiedName(node) { this.print(node.left, node); this.tokenChar(46); this.print(node.right, node); } - function TSCallSignatureDeclaration(node) { this.tsPrintSignatureDeclarationBase(node); this.tokenChar(59); } - function TSConstructSignatureDeclaration(node) { this.word("new"); this.space(); this.tsPrintSignatureDeclarationBase(node); this.tokenChar(59); } - function TSPropertySignature(node) { const { readonly, initializer } = node; - if (readonly) { this.word("readonly"); this.space(); } - this.tsPrintPropertyOrMethodName(node); this.print(node.typeAnnotation, node); - if (initializer) { this.space(); this.tokenChar(61); this.space(); this.print(initializer, node); } - this.tokenChar(59); } - function tsPrintPropertyOrMethodName(node) { if (node.computed) { this.tokenChar(91); } - this.print(node.key, node); - if (node.computed) { this.tokenChar(93); } - if (node.optional) { this.tokenChar(63); } } - function TSMethodSignature(node) { const { kind } = node; - if (kind === "set" || kind === "get") { this.word(kind); this.space(); } - this.tsPrintPropertyOrMethodName(node); this.tsPrintSignatureDeclarationBase(node); this.tokenChar(59); } - function TSIndexSignature(node) { const { readonly, static: isStatic } = node; - if (isStatic) { this.word("static"); this.space(); } - if (readonly) { this.word("readonly"); this.space(); } - this.tokenChar(91); - this._parameters(node.parameters, node); - this.tokenChar(93); this.print(node.typeAnnotation, node); this.tokenChar(59); } - function TSAnyKeyword() { this.word("any"); } - function TSBigIntKeyword() { this.word("bigint"); } - function TSUnknownKeyword() { this.word("unknown"); } - function TSNumberKeyword() { this.word("number"); } - function TSObjectKeyword() { this.word("object"); } - function TSBooleanKeyword() { this.word("boolean"); } - function TSStringKeyword() { this.word("string"); } - function TSSymbolKeyword() { this.word("symbol"); } - function TSVoidKeyword() { this.word("void"); } - function TSUndefinedKeyword() { this.word("undefined"); } - function TSNullKeyword() { this.word("null"); } - function TSNeverKeyword() { this.word("never"); } - function TSIntrinsicKeyword() { this.word("intrinsic"); } - function TSThisType() { this.word("this"); } - function TSFunctionType(node) { this.tsPrintFunctionOrConstructorType(node); } - function TSConstructorType(node) { if (node.abstract) { this.word("abstract"); this.space(); } - this.word("new"); this.space(); this.tsPrintFunctionOrConstructorType(node); } - function tsPrintFunctionOrConstructorType(node) { const { typeParameters } = node; - const parameters = node.parameters; + const parameters = + node.parameters; this.print(typeParameters, node); this.tokenChar(40); - this._parameters(parameters, node); - this.tokenChar(41); this.space(); this.token("=>"); this.space(); - const returnType = node.typeAnnotation; + const returnType = + node.typeAnnotation; this.print(returnType.typeAnnotation, node); } - function TSTypeReference(node) { this.print(node.typeName, node, true); this.print(node.typeParameters, node, true); } - function TSTypePredicate(node) { if (node.asserts) { this.word("asserts"); this.space(); } - this.print(node.parameterName); - if (node.typeAnnotation) { this.space(); this.word("is"); @@ -356,65 +296,51 @@ function TSTypePredicate(node) { this.print(node.typeAnnotation.typeAnnotation); } } - function TSTypeQuery(node) { this.word("typeof"); this.space(); this.print(node.exprName); - if (node.typeParameters) { this.print(node.typeParameters, node); } } - function TSTypeLiteral(node) { this.tsPrintTypeLiteralOrInterfaceBody(node.members, node); } - function tsPrintTypeLiteralOrInterfaceBody(members, node) { tsPrintBraced(this, members, node); } - function tsPrintBraced(printer, members, node) { printer.token("{"); - if (members.length) { printer.indent(); printer.newline(); - for (const member of members) { printer.print(member, node); printer.newline(); } - printer.dedent(); - printer.rightBrace(); - } else { - printer.token("}"); } + printer.sourceWithOffset("end", node.loc, 0, -1); + printer.rightBrace(); } - function TSArrayType(node) { this.print(node.elementType, node, true); this.token("[]"); } - function TSTupleType(node) { this.tokenChar(91); this.printList(node.elementTypes, node); this.tokenChar(93); } - function TSOptionalType(node) { this.print(node.typeAnnotation, node); this.tokenChar(63); } - function TSRestType(node) { this.token("..."); this.print(node.typeAnnotation, node); } - function TSNamedTupleMember(node) { this.print(node.label, node); if (node.optional) this.tokenChar(63); @@ -422,15 +348,12 @@ function TSNamedTupleMember(node) { this.space(); this.print(node.elementType, node); } - function TSUnionType(node) { tsPrintUnionOrIntersectionType(this, node, "|"); } - function TSIntersectionType(node) { tsPrintUnionOrIntersectionType(this, node, "&"); } - function tsPrintUnionOrIntersectionType(printer, node, sep) { printer.printJoin(node.types, node, { separator() { @@ -438,10 +361,8 @@ function tsPrintUnionOrIntersectionType(printer, node, sep) { this.token(sep); this.space(); } - }); } - function TSConditionalType(node) { this.print(node.checkType); this.space(); @@ -457,32 +378,27 @@ function TSConditionalType(node) { this.space(); this.print(node.falseType); } - function TSInferType(node) { this.token("infer"); this.space(); this.print(node.typeParameter); } - function TSParenthesizedType(node) { this.tokenChar(40); this.print(node.typeAnnotation, node); this.tokenChar(41); } - function TSTypeOperator(node) { this.word(node.operator); this.space(); this.print(node.typeAnnotation, node); } - function TSIndexedAccessType(node) { this.print(node.objectType, node, true); this.tokenChar(91); this.print(node.indexType, node); this.tokenChar(93); } - function TSMappedType(node) { const { nameType, @@ -492,56 +408,46 @@ function TSMappedType(node) { } = node; this.tokenChar(123); this.space(); - if (readonly) { tokenIfPlusMinus(this, readonly); this.word("readonly"); this.space(); } - this.tokenChar(91); this.word(typeParameter.name); this.space(); this.word("in"); this.space(); this.print(typeParameter.constraint, typeParameter); - if (nameType) { this.space(); this.word("as"); this.space(); this.print(nameType, node); } - this.tokenChar(93); - if (optional) { tokenIfPlusMinus(this, optional); this.tokenChar(63); } - this.tokenChar(58); this.space(); this.print(node.typeAnnotation, node); this.space(); this.tokenChar(125); } - function tokenIfPlusMinus(self, tok) { if (tok !== true) { self.token(tok); } } - function TSLiteralType(node) { this.print(node.literal, node); } - function TSExpressionWithTypeArguments(node) { this.print(node.expression, node); this.print(node.typeParameters, node); } - function TSInterfaceDeclaration(node) { const { declare, @@ -550,32 +456,26 @@ function TSInterfaceDeclaration(node) { extends: extendz, body } = node; - if (declare) { this.word("declare"); this.space(); } - this.word("interface"); this.space(); this.print(id, node); this.print(typeParameters, node); - if (extendz != null && extendz.length) { this.space(); this.word("extends"); this.space(); this.printList(extendz, node); } - this.space(); this.print(body, node); } - function TSInterfaceBody(node) { this.tsPrintTypeLiteralOrInterfaceBody(node.body, node); } - function TSTypeAliasDeclaration(node) { const { declare, @@ -583,12 +483,10 @@ function TSTypeAliasDeclaration(node) { typeParameters, typeAnnotation } = node; - if (declare) { this.word("declare"); this.space(); } - this.word("type"); this.space(); this.print(id, node); @@ -599,19 +497,20 @@ function TSTypeAliasDeclaration(node) { this.print(typeAnnotation, node); this.tokenChar(59); } - -function TSAsExpression(node) { +function TSTypeExpression(node) { + var _expression$trailingC; const { + type, expression, typeAnnotation } = node; - this.print(expression, node); + const forceParens = !!((_expression$trailingC = expression.trailingComments) != null && _expression$trailingC.length); + this.print(expression, node, true, undefined, forceParens); this.space(); - this.word("as"); + this.word(type === "TSAsExpression" ? "as" : "satisfies"); this.space(); this.print(typeAnnotation, node); } - function TSTypeAssertion(node) { const { typeAnnotation, @@ -623,12 +522,10 @@ function TSTypeAssertion(node) { this.space(); this.print(expression, node); } - function TSInstantiationExpression(node) { this.print(node.expression, node); this.print(node.typeParameters, node); } - function TSEnumDeclaration(node) { const { declare, @@ -636,80 +533,64 @@ function TSEnumDeclaration(node) { id, members } = node; - if (declare) { this.word("declare"); this.space(); } - if (isConst) { this.word("const"); this.space(); } - this.word("enum"); this.space(); this.print(id, node); this.space(); tsPrintBraced(this, members, node); } - function TSEnumMember(node) { const { id, initializer } = node; this.print(id, node); - if (initializer) { this.space(); this.tokenChar(61); this.space(); this.print(initializer, node); } - this.tokenChar(44); } - function TSModuleDeclaration(node) { const { declare, id } = node; - if (declare) { this.word("declare"); this.space(); } - if (!node.global) { this.word(id.type === "Identifier" ? "namespace" : "module"); this.space(); } - this.print(id, node); - if (!node.body) { this.tokenChar(59); return; } - let body = node.body; - while (body.type === "TSModuleDeclaration") { this.tokenChar(46); this.print(body.id, body); body = body.body; } - this.space(); this.print(body, node); } - function TSModuleBlock(node) { tsPrintBraced(this, node.body, node); } - function TSImportType(node) { const { argument, @@ -720,29 +601,24 @@ function TSImportType(node) { this.tokenChar(40); this.print(argument, node); this.tokenChar(41); - if (qualifier) { this.tokenChar(46); this.print(qualifier, node); } - if (typeParameters) { this.print(typeParameters, node); } } - function TSImportEqualsDeclaration(node) { const { isExport, id, moduleReference } = node; - if (isExport) { this.word("export"); this.space(); } - this.word("import"); this.space(); this.print(id, node); @@ -752,18 +628,15 @@ function TSImportEqualsDeclaration(node) { this.print(moduleReference, node); this.tokenChar(59); } - function TSExternalModuleReference(node) { this.token("require("); this.print(node.expression, node); this.tokenChar(41); } - function TSNonNullExpression(node) { this.print(node.expression, node); this.tokenChar(33); } - function TSExportAssignment(node) { this.word("export"); this.space(); @@ -772,7 +645,6 @@ function TSExportAssignment(node) { this.print(node.expression, node); this.tokenChar(59); } - function TSNamespaceExportDeclaration(node) { this.word("export"); this.space(); @@ -782,7 +654,6 @@ function TSNamespaceExportDeclaration(node) { this.space(); this.print(node.id, node); } - function tsPrintSignatureDeclarationBase(node) { const { typeParameters @@ -790,42 +661,33 @@ function tsPrintSignatureDeclarationBase(node) { const parameters = node.parameters; this.print(typeParameters, node); this.tokenChar(40); - this._parameters(parameters, node); - this.tokenChar(41); const returnType = node.typeAnnotation; this.print(returnType, node); } - function tsPrintClassMemberModifiers(node) { const isField = node.type === "ClassAccessorProperty" || node.type === "ClassProperty"; - if (isField && node.declare) { this.word("declare"); this.space(); } - if (node.accessibility) { this.word(node.accessibility); this.space(); } - if (node.static) { this.word("static"); this.space(); } - if (node.override) { this.word("override"); this.space(); } - if (node.abstract) { this.word("abstract"); this.space(); } - if (isField && node.readonly) { this.word("readonly"); this.space(); diff --git a/node_modules/@babel/generator/lib/generators/typescript.js.map b/node_modules/@babel/generator/lib/generators/typescript.js.map index 8e671749b..fa65acce1 100644 --- a/node_modules/@babel/generator/lib/generators/typescript.js.map +++ b/node_modules/@babel/generator/lib/generators/typescript.js.map @@ -1 +1 @@ -{"version":3,"names":["TSTypeAnnotation","node","token","space","optional","print","typeAnnotation","TSTypeParameterInstantiation","parent","printList","params","type","length","TSTypeParameter","in","word","out","name","constraint","default","TSParameterProperty","accessibility","readonly","_param","parameter","TSDeclareFunction","declare","_functionHead","TSDeclareMethod","_classMethodHead","TSQualifiedName","left","right","TSCallSignatureDeclaration","tsPrintSignatureDeclarationBase","TSConstructSignatureDeclaration","TSPropertySignature","initializer","tsPrintPropertyOrMethodName","computed","key","TSMethodSignature","kind","TSIndexSignature","static","isStatic","_parameters","parameters","TSAnyKeyword","TSBigIntKeyword","TSUnknownKeyword","TSNumberKeyword","TSObjectKeyword","TSBooleanKeyword","TSStringKeyword","TSSymbolKeyword","TSVoidKeyword","TSUndefinedKeyword","TSNullKeyword","TSNeverKeyword","TSIntrinsicKeyword","TSThisType","TSFunctionType","tsPrintFunctionOrConstructorType","TSConstructorType","abstract","typeParameters","returnType","TSTypeReference","typeName","TSTypePredicate","asserts","parameterName","TSTypeQuery","exprName","TSTypeLiteral","tsPrintTypeLiteralOrInterfaceBody","members","tsPrintBraced","printer","indent","newline","member","dedent","rightBrace","TSArrayType","elementType","TSTupleType","elementTypes","TSOptionalType","TSRestType","TSNamedTupleMember","label","TSUnionType","tsPrintUnionOrIntersectionType","TSIntersectionType","sep","printJoin","types","separator","TSConditionalType","checkType","extendsType","trueType","falseType","TSInferType","typeParameter","TSParenthesizedType","TSTypeOperator","operator","TSIndexedAccessType","objectType","indexType","TSMappedType","nameType","tokenIfPlusMinus","self","tok","TSLiteralType","literal","TSExpressionWithTypeArguments","expression","TSInterfaceDeclaration","id","extends","extendz","body","TSInterfaceBody","TSTypeAliasDeclaration","TSAsExpression","TSTypeAssertion","TSInstantiationExpression","TSEnumDeclaration","const","isConst","TSEnumMember","TSModuleDeclaration","global","TSModuleBlock","TSImportType","argument","qualifier","TSImportEqualsDeclaration","isExport","moduleReference","TSExternalModuleReference","TSNonNullExpression","TSExportAssignment","TSNamespaceExportDeclaration","tsPrintClassMemberModifiers","isField","override"],"sources":["../../src/generators/typescript.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport type * as t from \"@babel/types\";\n\nexport function TSTypeAnnotation(this: Printer, node: t.TSTypeAnnotation) {\n this.token(\":\");\n this.space();\n // @ts-expect-error todo(flow->ts) can this be removed? `.optional` looks to be not existing property\n if (node.optional) this.token(\"?\");\n this.print(node.typeAnnotation, node);\n}\n\nexport function TSTypeParameterInstantiation(\n this: Printer,\n node: t.TSTypeParameterInstantiation,\n parent: t.Node,\n): void {\n this.token(\"<\");\n this.printList(node.params, node, {});\n if (parent.type === \"ArrowFunctionExpression\" && node.params.length === 1) {\n this.token(\",\");\n }\n this.token(\">\");\n}\n\nexport { TSTypeParameterInstantiation as TSTypeParameterDeclaration };\n\nexport function TSTypeParameter(this: Printer, node: t.TSTypeParameter) {\n if (node.in) {\n this.word(\"in\");\n this.space();\n }\n\n if (node.out) {\n this.word(\"out\");\n this.space();\n }\n\n this.word(\n !process.env.BABEL_8_BREAKING\n ? (node.name as unknown as string)\n : (node.name as unknown as t.Identifier).name,\n );\n\n if (node.constraint) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.print(node.constraint, node);\n }\n\n if (node.default) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.default, node);\n }\n}\n\nexport function TSParameterProperty(\n this: Printer,\n node: t.TSParameterProperty,\n) {\n if (node.accessibility) {\n this.word(node.accessibility);\n this.space();\n }\n\n if (node.readonly) {\n this.word(\"readonly\");\n this.space();\n }\n\n this._param(node.parameter);\n}\n\nexport function TSDeclareFunction(this: Printer, node: t.TSDeclareFunction) {\n if (node.declare) {\n this.word(\"declare\");\n this.space();\n }\n this._functionHead(node);\n this.token(\";\");\n}\n\nexport function TSDeclareMethod(this: Printer, node: t.TSDeclareMethod) {\n this._classMethodHead(node);\n this.token(\";\");\n}\n\nexport function TSQualifiedName(this: Printer, node: t.TSQualifiedName) {\n this.print(node.left, node);\n this.token(\".\");\n this.print(node.right, node);\n}\n\nexport function TSCallSignatureDeclaration(\n this: Printer,\n node: t.TSCallSignatureDeclaration,\n) {\n this.tsPrintSignatureDeclarationBase(node);\n this.token(\";\");\n}\n\nexport function TSConstructSignatureDeclaration(\n this: Printer,\n node: t.TSConstructSignatureDeclaration,\n) {\n this.word(\"new\");\n this.space();\n this.tsPrintSignatureDeclarationBase(node);\n this.token(\";\");\n}\n\nexport function TSPropertySignature(\n this: Printer,\n node: t.TSPropertySignature,\n) {\n const { readonly, initializer } = node;\n if (readonly) {\n this.word(\"readonly\");\n this.space();\n }\n this.tsPrintPropertyOrMethodName(node);\n this.print(node.typeAnnotation, node);\n if (initializer) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(initializer, node);\n }\n this.token(\";\");\n}\n\nexport function tsPrintPropertyOrMethodName(\n this: Printer,\n node: t.TSPropertySignature | t.TSMethodSignature,\n) {\n if (node.computed) {\n this.token(\"[\");\n }\n this.print(node.key, node);\n if (node.computed) {\n this.token(\"]\");\n }\n if (node.optional) {\n this.token(\"?\");\n }\n}\n\nexport function TSMethodSignature(this: Printer, node: t.TSMethodSignature) {\n const { kind } = node;\n if (kind === \"set\" || kind === \"get\") {\n this.word(kind);\n this.space();\n }\n this.tsPrintPropertyOrMethodName(node);\n this.tsPrintSignatureDeclarationBase(node);\n this.token(\";\");\n}\n\nexport function TSIndexSignature(this: Printer, node: t.TSIndexSignature) {\n const { readonly, static: isStatic } = node;\n if (isStatic) {\n this.word(\"static\");\n this.space();\n }\n if (readonly) {\n this.word(\"readonly\");\n this.space();\n }\n this.token(\"[\");\n this._parameters(node.parameters, node);\n this.token(\"]\");\n this.print(node.typeAnnotation, node);\n this.token(\";\");\n}\n\nexport function TSAnyKeyword(this: Printer) {\n this.word(\"any\");\n}\nexport function TSBigIntKeyword(this: Printer) {\n this.word(\"bigint\");\n}\nexport function TSUnknownKeyword(this: Printer) {\n this.word(\"unknown\");\n}\nexport function TSNumberKeyword(this: Printer) {\n this.word(\"number\");\n}\nexport function TSObjectKeyword(this: Printer) {\n this.word(\"object\");\n}\nexport function TSBooleanKeyword(this: Printer) {\n this.word(\"boolean\");\n}\nexport function TSStringKeyword(this: Printer) {\n this.word(\"string\");\n}\nexport function TSSymbolKeyword(this: Printer) {\n this.word(\"symbol\");\n}\nexport function TSVoidKeyword(this: Printer) {\n this.word(\"void\");\n}\nexport function TSUndefinedKeyword(this: Printer) {\n this.word(\"undefined\");\n}\nexport function TSNullKeyword(this: Printer) {\n this.word(\"null\");\n}\nexport function TSNeverKeyword(this: Printer) {\n this.word(\"never\");\n}\nexport function TSIntrinsicKeyword(this: Printer) {\n this.word(\"intrinsic\");\n}\n\nexport function TSThisType(this: Printer) {\n this.word(\"this\");\n}\n\nexport function TSFunctionType(this: Printer, node: t.TSFunctionType) {\n this.tsPrintFunctionOrConstructorType(node);\n}\n\nexport function TSConstructorType(this: Printer, node: t.TSConstructorType) {\n if (node.abstract) {\n this.word(\"abstract\");\n this.space();\n }\n this.word(\"new\");\n this.space();\n this.tsPrintFunctionOrConstructorType(node);\n}\n\nexport function tsPrintFunctionOrConstructorType(\n this: Printer,\n node: t.TSFunctionType | t.TSConstructorType,\n) {\n const { typeParameters } = node;\n const parameters = process.env.BABEL_8_BREAKING\n ? // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST shape\n node.params\n : // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape\n node.parameters;\n this.print(typeParameters, node);\n this.token(\"(\");\n this._parameters(parameters, node);\n this.token(\")\");\n this.space();\n this.token(\"=>\");\n this.space();\n const returnType = process.env.BABEL_8_BREAKING\n ? // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST shape\n node.returnType\n : // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape\n node.typeAnnotation;\n this.print(returnType.typeAnnotation, node);\n}\n\nexport function TSTypeReference(this: Printer, node: t.TSTypeReference) {\n this.print(node.typeName, node, true);\n this.print(node.typeParameters, node, true);\n}\n\nexport function TSTypePredicate(this: Printer, node: t.TSTypePredicate) {\n if (node.asserts) {\n this.word(\"asserts\");\n this.space();\n }\n this.print(node.parameterName);\n if (node.typeAnnotation) {\n this.space();\n this.word(\"is\");\n this.space();\n this.print(node.typeAnnotation.typeAnnotation);\n }\n}\n\nexport function TSTypeQuery(this: Printer, node: t.TSTypeQuery) {\n this.word(\"typeof\");\n this.space();\n this.print(node.exprName);\n\n if (node.typeParameters) {\n this.print(node.typeParameters, node);\n }\n}\n\nexport function TSTypeLiteral(this: Printer, node: t.TSTypeLiteral) {\n this.tsPrintTypeLiteralOrInterfaceBody(node.members, node);\n}\n\nexport function tsPrintTypeLiteralOrInterfaceBody(\n this: Printer,\n members: t.TSTypeElement[],\n node: t.TSType | t.TSInterfaceBody,\n) {\n tsPrintBraced(this, members, node);\n}\n\nfunction tsPrintBraced(printer: Printer, members: t.Node[], node: t.Node) {\n printer.token(\"{\");\n if (members.length) {\n printer.indent();\n printer.newline();\n for (const member of members) {\n printer.print(member, node);\n //this.token(sep);\n printer.newline();\n }\n printer.dedent();\n printer.rightBrace();\n } else {\n printer.token(\"}\");\n }\n}\n\nexport function TSArrayType(this: Printer, node: t.TSArrayType) {\n this.print(node.elementType, node, true);\n\n this.token(\"[]\");\n}\n\nexport function TSTupleType(this: Printer, node: t.TSTupleType) {\n this.token(\"[\");\n this.printList(node.elementTypes, node);\n this.token(\"]\");\n}\n\nexport function TSOptionalType(this: Printer, node: t.TSOptionalType) {\n this.print(node.typeAnnotation, node);\n this.token(\"?\");\n}\n\nexport function TSRestType(this: Printer, node: t.TSRestType) {\n this.token(\"...\");\n this.print(node.typeAnnotation, node);\n}\n\nexport function TSNamedTupleMember(this: Printer, node: t.TSNamedTupleMember) {\n this.print(node.label, node);\n if (node.optional) this.token(\"?\");\n this.token(\":\");\n this.space();\n this.print(node.elementType, node);\n}\n\nexport function TSUnionType(this: Printer, node: t.TSUnionType) {\n tsPrintUnionOrIntersectionType(this, node, \"|\");\n}\n\nexport function TSIntersectionType(this: Printer, node: t.TSIntersectionType) {\n tsPrintUnionOrIntersectionType(this, node, \"&\");\n}\n\nfunction tsPrintUnionOrIntersectionType(\n printer: Printer,\n node: t.TSUnionType | t.TSIntersectionType,\n sep: \"|\" | \"&\",\n) {\n printer.printJoin(node.types, node, {\n separator() {\n this.space();\n this.token(sep);\n this.space();\n },\n });\n}\n\nexport function TSConditionalType(this: Printer, node: t.TSConditionalType) {\n this.print(node.checkType);\n this.space();\n this.word(\"extends\");\n this.space();\n this.print(node.extendsType);\n this.space();\n this.token(\"?\");\n this.space();\n this.print(node.trueType);\n this.space();\n this.token(\":\");\n this.space();\n this.print(node.falseType);\n}\n\nexport function TSInferType(this: Printer, node: t.TSInferType) {\n this.token(\"infer\");\n this.space();\n this.print(node.typeParameter);\n}\n\nexport function TSParenthesizedType(\n this: Printer,\n node: t.TSParenthesizedType,\n) {\n this.token(\"(\");\n this.print(node.typeAnnotation, node);\n this.token(\")\");\n}\n\nexport function TSTypeOperator(this: Printer, node: t.TSTypeOperator) {\n this.word(node.operator);\n this.space();\n this.print(node.typeAnnotation, node);\n}\n\nexport function TSIndexedAccessType(\n this: Printer,\n node: t.TSIndexedAccessType,\n) {\n this.print(node.objectType, node, true);\n this.token(\"[\");\n this.print(node.indexType, node);\n this.token(\"]\");\n}\n\nexport function TSMappedType(this: Printer, node: t.TSMappedType) {\n const { nameType, optional, readonly, typeParameter } = node;\n this.token(\"{\");\n this.space();\n if (readonly) {\n tokenIfPlusMinus(this, readonly);\n this.word(\"readonly\");\n this.space();\n }\n\n this.token(\"[\");\n this.word(\n !process.env.BABEL_8_BREAKING\n ? (typeParameter.name as unknown as string)\n : (typeParameter.name as unknown as t.Identifier).name,\n );\n this.space();\n this.word(\"in\");\n this.space();\n this.print(typeParameter.constraint, typeParameter);\n\n if (nameType) {\n this.space();\n this.word(\"as\");\n this.space();\n this.print(nameType, node);\n }\n\n this.token(\"]\");\n\n if (optional) {\n tokenIfPlusMinus(this, optional);\n this.token(\"?\");\n }\n this.token(\":\");\n this.space();\n this.print(node.typeAnnotation, node);\n this.space();\n this.token(\"}\");\n}\n\nfunction tokenIfPlusMinus(self: Printer, tok: true | \"+\" | \"-\") {\n if (tok !== true) {\n self.token(tok);\n }\n}\n\nexport function TSLiteralType(this: Printer, node: t.TSLiteralType) {\n this.print(node.literal, node);\n}\n\nexport function TSExpressionWithTypeArguments(\n this: Printer,\n node: t.TSExpressionWithTypeArguments,\n) {\n this.print(node.expression, node);\n this.print(node.typeParameters, node);\n}\n\nexport function TSInterfaceDeclaration(\n this: Printer,\n node: t.TSInterfaceDeclaration,\n) {\n const { declare, id, typeParameters, extends: extendz, body } = node;\n if (declare) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"interface\");\n this.space();\n this.print(id, node);\n this.print(typeParameters, node);\n if (extendz?.length) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.printList(extendz, node);\n }\n this.space();\n this.print(body, node);\n}\n\nexport function TSInterfaceBody(this: Printer, node: t.TSInterfaceBody) {\n this.tsPrintTypeLiteralOrInterfaceBody(node.body, node);\n}\n\nexport function TSTypeAliasDeclaration(\n this: Printer,\n node: t.TSTypeAliasDeclaration,\n) {\n const { declare, id, typeParameters, typeAnnotation } = node;\n if (declare) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"type\");\n this.space();\n this.print(id, node);\n this.print(typeParameters, node);\n this.space();\n this.token(\"=\");\n this.space();\n this.print(typeAnnotation, node);\n this.token(\";\");\n}\n\nexport function TSAsExpression(this: Printer, node: t.TSAsExpression) {\n const { expression, typeAnnotation } = node;\n this.print(expression, node);\n this.space();\n this.word(\"as\");\n this.space();\n this.print(typeAnnotation, node);\n}\n\nexport function TSTypeAssertion(this: Printer, node: t.TSTypeAssertion) {\n const { typeAnnotation, expression } = node;\n this.token(\"<\");\n this.print(typeAnnotation, node);\n this.token(\">\");\n this.space();\n this.print(expression, node);\n}\n\nexport function TSInstantiationExpression(\n this: Printer,\n node: t.TSInstantiationExpression,\n) {\n this.print(node.expression, node);\n this.print(node.typeParameters, node);\n}\n\nexport function TSEnumDeclaration(this: Printer, node: t.TSEnumDeclaration) {\n const { declare, const: isConst, id, members } = node;\n if (declare) {\n this.word(\"declare\");\n this.space();\n }\n if (isConst) {\n this.word(\"const\");\n this.space();\n }\n this.word(\"enum\");\n this.space();\n this.print(id, node);\n this.space();\n tsPrintBraced(this, members, node);\n}\n\nexport function TSEnumMember(this: Printer, node: t.TSEnumMember) {\n const { id, initializer } = node;\n this.print(id, node);\n if (initializer) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(initializer, node);\n }\n this.token(\",\");\n}\n\nexport function TSModuleDeclaration(\n this: Printer,\n node: t.TSModuleDeclaration,\n) {\n const { declare, id } = node;\n\n if (declare) {\n this.word(\"declare\");\n this.space();\n }\n\n if (!node.global) {\n this.word(id.type === \"Identifier\" ? \"namespace\" : \"module\");\n this.space();\n }\n this.print(id, node);\n\n if (!node.body) {\n this.token(\";\");\n return;\n }\n\n let body = node.body;\n while (body.type === \"TSModuleDeclaration\") {\n this.token(\".\");\n this.print(body.id, body);\n body = body.body;\n }\n\n this.space();\n this.print(body, node);\n}\n\nexport function TSModuleBlock(this: Printer, node: t.TSModuleBlock) {\n tsPrintBraced(this, node.body, node);\n}\n\nexport function TSImportType(this: Printer, node: t.TSImportType) {\n const { argument, qualifier, typeParameters } = node;\n this.word(\"import\");\n this.token(\"(\");\n this.print(argument, node);\n this.token(\")\");\n if (qualifier) {\n this.token(\".\");\n this.print(qualifier, node);\n }\n if (typeParameters) {\n this.print(typeParameters, node);\n }\n}\n\nexport function TSImportEqualsDeclaration(\n this: Printer,\n node: t.TSImportEqualsDeclaration,\n) {\n const { isExport, id, moduleReference } = node;\n if (isExport) {\n this.word(\"export\");\n this.space();\n }\n this.word(\"import\");\n this.space();\n this.print(id, node);\n this.space();\n this.token(\"=\");\n this.space();\n this.print(moduleReference, node);\n this.token(\";\");\n}\n\nexport function TSExternalModuleReference(\n this: Printer,\n node: t.TSExternalModuleReference,\n) {\n this.token(\"require(\");\n this.print(node.expression, node);\n this.token(\")\");\n}\n\nexport function TSNonNullExpression(\n this: Printer,\n node: t.TSNonNullExpression,\n) {\n this.print(node.expression, node);\n this.token(\"!\");\n}\n\nexport function TSExportAssignment(this: Printer, node: t.TSExportAssignment) {\n this.word(\"export\");\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.expression, node);\n this.token(\";\");\n}\n\nexport function TSNamespaceExportDeclaration(\n this: Printer,\n node: t.TSNamespaceExportDeclaration,\n) {\n this.word(\"export\");\n this.space();\n this.word(\"as\");\n this.space();\n this.word(\"namespace\");\n this.space();\n this.print(node.id, node);\n}\n\nexport function tsPrintSignatureDeclarationBase(this: Printer, node: any) {\n const { typeParameters } = node;\n const parameters = process.env.BABEL_8_BREAKING\n ? node.params\n : node.parameters;\n this.print(typeParameters, node);\n this.token(\"(\");\n this._parameters(parameters, node);\n this.token(\")\");\n const returnType = process.env.BABEL_8_BREAKING\n ? node.returnType\n : node.typeAnnotation;\n this.print(returnType, node);\n}\n\nexport function tsPrintClassMemberModifiers(\n this: Printer,\n node:\n | t.ClassProperty\n | t.ClassAccessorProperty\n | t.ClassMethod\n | t.ClassPrivateMethod\n | t.TSDeclareMethod,\n) {\n const isField =\n node.type === \"ClassAccessorProperty\" || node.type === \"ClassProperty\";\n if (isField && node.declare) {\n this.word(\"declare\");\n this.space();\n }\n if (node.accessibility) {\n this.word(node.accessibility);\n this.space();\n }\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n if (node.override) {\n this.word(\"override\");\n this.space();\n }\n if (node.abstract) {\n this.word(\"abstract\");\n this.space();\n }\n if (isField && node.readonly) {\n this.word(\"readonly\");\n this.space();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,SAASA,gBAAT,CAAyCC,IAAzC,EAAmE;EACxE,KAAKC,SAAL;EACA,KAAKC,KAAL;EAEA,IAAIF,IAAI,CAACG,QAAT,EAAmB,KAAKF,SAAL;EACnB,KAAKG,KAAL,CAAWJ,IAAI,CAACK,cAAhB,EAAgCL,IAAhC;AACD;;AAEM,SAASM,4BAAT,CAELN,IAFK,EAGLO,MAHK,EAIC;EACN,KAAKN,SAAL;EACA,KAAKO,SAAL,CAAeR,IAAI,CAACS,MAApB,EAA4BT,IAA5B,EAAkC,EAAlC;;EACA,IAAIO,MAAM,CAACG,IAAP,KAAgB,yBAAhB,IAA6CV,IAAI,CAACS,MAAL,CAAYE,MAAZ,KAAuB,CAAxE,EAA2E;IACzE,KAAKV,SAAL;EACD;;EACD,KAAKA,SAAL;AACD;;AAIM,SAASW,eAAT,CAAwCZ,IAAxC,EAAiE;EACtE,IAAIA,IAAI,CAACa,EAAT,EAAa;IACX,KAAKC,IAAL,CAAU,IAAV;IACA,KAAKZ,KAAL;EACD;;EAED,IAAIF,IAAI,CAACe,GAAT,EAAc;IACZ,KAAKD,IAAL,CAAU,KAAV;IACA,KAAKZ,KAAL;EACD;;EAED,KAAKY,IAAL,CAEOd,IAAI,CAACgB,IAFZ;;EAMA,IAAIhB,IAAI,CAACiB,UAAT,EAAqB;IACnB,KAAKf,KAAL;IACA,KAAKY,IAAL,CAAU,SAA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IAAI,CAACsJ,QAAT,EAAmB;IACjB,KAAKxI,IAAL,CAAU,UAAV;IACA,KAAKZ,KAAL;EACD;;EACD,IAAIF,IAAI,CAACgE,QAAT,EAAmB;IACjB,KAAKlD,IAAL,CAAU,UAAV;IACA,KAAKZ,KAAL;EACD;;EACD,IAAImJ,OAAO,IAAIrJ,IAAI,CAACqB,QAApB,EAA8B;IAC5B,KAAKP,IAAL,CAAU,UAAV;IACA,KAAKZ,KAAL;EACD;AACF"} \ No newline at end of file +{"version":3,"names":["TSTypeAnnotation","node","token","space","optional","print","typeAnnotation","TSTypeParameterInstantiation","parent","printList","params","type","length","TSTypeParameter","in","word","out","name","constraint","default","TSParameterProperty","accessibility","readonly","_param","parameter","TSDeclareFunction","declare","_functionHead","TSDeclareMethod","_classMethodHead","TSQualifiedName","left","right","TSCallSignatureDeclaration","tsPrintSignatureDeclarationBase","TSConstructSignatureDeclaration","TSPropertySignature","initializer","tsPrintPropertyOrMethodName","computed","key","TSMethodSignature","kind","TSIndexSignature","static","isStatic","_parameters","parameters","TSAnyKeyword","TSBigIntKeyword","TSUnknownKeyword","TSNumberKeyword","TSObjectKeyword","TSBooleanKeyword","TSStringKeyword","TSSymbolKeyword","TSVoidKeyword","TSUndefinedKeyword","TSNullKeyword","TSNeverKeyword","TSIntrinsicKeyword","TSThisType","TSFunctionType","tsPrintFunctionOrConstructorType","TSConstructorType","abstract","typeParameters","returnType","TSTypeReference","typeName","TSTypePredicate","asserts","parameterName","TSTypeQuery","exprName","TSTypeLiteral","tsPrintTypeLiteralOrInterfaceBody","members","tsPrintBraced","printer","indent","newline","member","dedent","sourceWithOffset","loc","rightBrace","TSArrayType","elementType","TSTupleType","elementTypes","TSOptionalType","TSRestType","TSNamedTupleMember","label","TSUnionType","tsPrintUnionOrIntersectionType","TSIntersectionType","sep","printJoin","types","separator","TSConditionalType","checkType","extendsType","trueType","falseType","TSInferType","typeParameter","TSParenthesizedType","TSTypeOperator","operator","TSIndexedAccessType","objectType","indexType","TSMappedType","nameType","tokenIfPlusMinus","self","tok","TSLiteralType","literal","TSExpressionWithTypeArguments","expression","TSInterfaceDeclaration","id","extends","extendz","body","TSInterfaceBody","TSTypeAliasDeclaration","TSTypeExpression","forceParens","trailingComments","undefined","TSTypeAssertion","TSInstantiationExpression","TSEnumDeclaration","const","isConst","TSEnumMember","TSModuleDeclaration","global","TSModuleBlock","TSImportType","argument","qualifier","TSImportEqualsDeclaration","isExport","moduleReference","TSExternalModuleReference","TSNonNullExpression","TSExportAssignment","TSNamespaceExportDeclaration","tsPrintClassMemberModifiers","isField","override"],"sources":["../../src/generators/typescript.ts"],"sourcesContent":["import type Printer from \"../printer\";\nimport type * as t from \"@babel/types\";\n\nexport function TSTypeAnnotation(this: Printer, node: t.TSTypeAnnotation) {\n this.token(\":\");\n this.space();\n // @ts-expect-error todo(flow->ts) can this be removed? `.optional` looks to be not existing property\n if (node.optional) this.token(\"?\");\n this.print(node.typeAnnotation, node);\n}\n\nexport function TSTypeParameterInstantiation(\n this: Printer,\n node: t.TSTypeParameterInstantiation,\n parent: t.Node,\n): void {\n this.token(\"<\");\n this.printList(node.params, node, {});\n if (parent.type === \"ArrowFunctionExpression\" && node.params.length === 1) {\n this.token(\",\");\n }\n this.token(\">\");\n}\n\nexport { TSTypeParameterInstantiation as TSTypeParameterDeclaration };\n\nexport function TSTypeParameter(this: Printer, node: t.TSTypeParameter) {\n if (node.in) {\n this.word(\"in\");\n this.space();\n }\n\n if (node.out) {\n this.word(\"out\");\n this.space();\n }\n\n this.word(\n !process.env.BABEL_8_BREAKING\n ? (node.name as unknown as string)\n : (node.name as unknown as t.Identifier).name,\n );\n\n if (node.constraint) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.print(node.constraint, node);\n }\n\n if (node.default) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.default, node);\n }\n}\n\nexport function TSParameterProperty(\n this: Printer,\n node: t.TSParameterProperty,\n) {\n if (node.accessibility) {\n this.word(node.accessibility);\n this.space();\n }\n\n if (node.readonly) {\n this.word(\"readonly\");\n this.space();\n }\n\n this._param(node.parameter);\n}\n\nexport function TSDeclareFunction(this: Printer, node: t.TSDeclareFunction) {\n if (node.declare) {\n this.word(\"declare\");\n this.space();\n }\n this._functionHead(node);\n this.token(\";\");\n}\n\nexport function TSDeclareMethod(this: Printer, node: t.TSDeclareMethod) {\n this._classMethodHead(node);\n this.token(\";\");\n}\n\nexport function TSQualifiedName(this: Printer, node: t.TSQualifiedName) {\n this.print(node.left, node);\n this.token(\".\");\n this.print(node.right, node);\n}\n\nexport function TSCallSignatureDeclaration(\n this: Printer,\n node: t.TSCallSignatureDeclaration,\n) {\n this.tsPrintSignatureDeclarationBase(node);\n this.token(\";\");\n}\n\nexport function TSConstructSignatureDeclaration(\n this: Printer,\n node: t.TSConstructSignatureDeclaration,\n) {\n this.word(\"new\");\n this.space();\n this.tsPrintSignatureDeclarationBase(node);\n this.token(\";\");\n}\n\nexport function TSPropertySignature(\n this: Printer,\n node: t.TSPropertySignature,\n) {\n const { readonly, initializer } = node;\n if (readonly) {\n this.word(\"readonly\");\n this.space();\n }\n this.tsPrintPropertyOrMethodName(node);\n this.print(node.typeAnnotation, node);\n if (initializer) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(initializer, node);\n }\n this.token(\";\");\n}\n\nexport function tsPrintPropertyOrMethodName(\n this: Printer,\n node: t.TSPropertySignature | t.TSMethodSignature,\n) {\n if (node.computed) {\n this.token(\"[\");\n }\n this.print(node.key, node);\n if (node.computed) {\n this.token(\"]\");\n }\n if (node.optional) {\n this.token(\"?\");\n }\n}\n\nexport function TSMethodSignature(this: Printer, node: t.TSMethodSignature) {\n const { kind } = node;\n if (kind === \"set\" || kind === \"get\") {\n this.word(kind);\n this.space();\n }\n this.tsPrintPropertyOrMethodName(node);\n this.tsPrintSignatureDeclarationBase(node);\n this.token(\";\");\n}\n\nexport function TSIndexSignature(this: Printer, node: t.TSIndexSignature) {\n const { readonly, static: isStatic } = node;\n if (isStatic) {\n this.word(\"static\");\n this.space();\n }\n if (readonly) {\n this.word(\"readonly\");\n this.space();\n }\n this.token(\"[\");\n this._parameters(node.parameters, node);\n this.token(\"]\");\n this.print(node.typeAnnotation, node);\n this.token(\";\");\n}\n\nexport function TSAnyKeyword(this: Printer) {\n this.word(\"any\");\n}\nexport function TSBigIntKeyword(this: Printer) {\n this.word(\"bigint\");\n}\nexport function TSUnknownKeyword(this: Printer) {\n this.word(\"unknown\");\n}\nexport function TSNumberKeyword(this: Printer) {\n this.word(\"number\");\n}\nexport function TSObjectKeyword(this: Printer) {\n this.word(\"object\");\n}\nexport function TSBooleanKeyword(this: Printer) {\n this.word(\"boolean\");\n}\nexport function TSStringKeyword(this: Printer) {\n this.word(\"string\");\n}\nexport function TSSymbolKeyword(this: Printer) {\n this.word(\"symbol\");\n}\nexport function TSVoidKeyword(this: Printer) {\n this.word(\"void\");\n}\nexport function TSUndefinedKeyword(this: Printer) {\n this.word(\"undefined\");\n}\nexport function TSNullKeyword(this: Printer) {\n this.word(\"null\");\n}\nexport function TSNeverKeyword(this: Printer) {\n this.word(\"never\");\n}\nexport function TSIntrinsicKeyword(this: Printer) {\n this.word(\"intrinsic\");\n}\n\nexport function TSThisType(this: Printer) {\n this.word(\"this\");\n}\n\nexport function TSFunctionType(this: Printer, node: t.TSFunctionType) {\n this.tsPrintFunctionOrConstructorType(node);\n}\n\nexport function TSConstructorType(this: Printer, node: t.TSConstructorType) {\n if (node.abstract) {\n this.word(\"abstract\");\n this.space();\n }\n this.word(\"new\");\n this.space();\n this.tsPrintFunctionOrConstructorType(node);\n}\n\nexport function tsPrintFunctionOrConstructorType(\n this: Printer,\n node: t.TSFunctionType | t.TSConstructorType,\n) {\n const { typeParameters } = node;\n const parameters = process.env.BABEL_8_BREAKING\n ? // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST shape\n node.params\n : // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape\n node.parameters;\n this.print(typeParameters, node);\n this.token(\"(\");\n this._parameters(parameters, node);\n this.token(\")\");\n this.space();\n this.token(\"=>\");\n this.space();\n const returnType = process.env.BABEL_8_BREAKING\n ? // @ts-ignore(Babel 7 vs Babel 8) Babel 8 AST shape\n node.returnType\n : // @ts-ignore(Babel 7 vs Babel 8) Babel 7 AST shape\n node.typeAnnotation;\n this.print(returnType.typeAnnotation, node);\n}\n\nexport function TSTypeReference(this: Printer, node: t.TSTypeReference) {\n this.print(node.typeName, node, true);\n this.print(node.typeParameters, node, true);\n}\n\nexport function TSTypePredicate(this: Printer, node: t.TSTypePredicate) {\n if (node.asserts) {\n this.word(\"asserts\");\n this.space();\n }\n this.print(node.parameterName);\n if (node.typeAnnotation) {\n this.space();\n this.word(\"is\");\n this.space();\n this.print(node.typeAnnotation.typeAnnotation);\n }\n}\n\nexport function TSTypeQuery(this: Printer, node: t.TSTypeQuery) {\n this.word(\"typeof\");\n this.space();\n this.print(node.exprName);\n\n if (node.typeParameters) {\n this.print(node.typeParameters, node);\n }\n}\n\nexport function TSTypeLiteral(this: Printer, node: t.TSTypeLiteral) {\n this.tsPrintTypeLiteralOrInterfaceBody(node.members, node);\n}\n\nexport function tsPrintTypeLiteralOrInterfaceBody(\n this: Printer,\n members: t.TSTypeElement[],\n node: t.TSType | t.TSInterfaceBody,\n) {\n tsPrintBraced(this, members, node);\n}\n\nfunction tsPrintBraced(printer: Printer, members: t.Node[], node: t.Node) {\n printer.token(\"{\");\n if (members.length) {\n printer.indent();\n printer.newline();\n for (const member of members) {\n printer.print(member, node);\n //this.token(sep);\n printer.newline();\n }\n printer.dedent();\n }\n\n printer.sourceWithOffset(\"end\", node.loc, 0, -1);\n\n printer.rightBrace();\n}\n\nexport function TSArrayType(this: Printer, node: t.TSArrayType) {\n this.print(node.elementType, node, true);\n\n this.token(\"[]\");\n}\n\nexport function TSTupleType(this: Printer, node: t.TSTupleType) {\n this.token(\"[\");\n this.printList(node.elementTypes, node);\n this.token(\"]\");\n}\n\nexport function TSOptionalType(this: Printer, node: t.TSOptionalType) {\n this.print(node.typeAnnotation, node);\n this.token(\"?\");\n}\n\nexport function TSRestType(this: Printer, node: t.TSRestType) {\n this.token(\"...\");\n this.print(node.typeAnnotation, node);\n}\n\nexport function TSNamedTupleMember(this: Printer, node: t.TSNamedTupleMember) {\n this.print(node.label, node);\n if (node.optional) this.token(\"?\");\n this.token(\":\");\n this.space();\n this.print(node.elementType, node);\n}\n\nexport function TSUnionType(this: Printer, node: t.TSUnionType) {\n tsPrintUnionOrIntersectionType(this, node, \"|\");\n}\n\nexport function TSIntersectionType(this: Printer, node: t.TSIntersectionType) {\n tsPrintUnionOrIntersectionType(this, node, \"&\");\n}\n\nfunction tsPrintUnionOrIntersectionType(\n printer: Printer,\n node: t.TSUnionType | t.TSIntersectionType,\n sep: \"|\" | \"&\",\n) {\n printer.printJoin(node.types, node, {\n separator() {\n this.space();\n this.token(sep);\n this.space();\n },\n });\n}\n\nexport function TSConditionalType(this: Printer, node: t.TSConditionalType) {\n this.print(node.checkType);\n this.space();\n this.word(\"extends\");\n this.space();\n this.print(node.extendsType);\n this.space();\n this.token(\"?\");\n this.space();\n this.print(node.trueType);\n this.space();\n this.token(\":\");\n this.space();\n this.print(node.falseType);\n}\n\nexport function TSInferType(this: Printer, node: t.TSInferType) {\n this.token(\"infer\");\n this.space();\n this.print(node.typeParameter);\n}\n\nexport function TSParenthesizedType(\n this: Printer,\n node: t.TSParenthesizedType,\n) {\n this.token(\"(\");\n this.print(node.typeAnnotation, node);\n this.token(\")\");\n}\n\nexport function TSTypeOperator(this: Printer, node: t.TSTypeOperator) {\n this.word(node.operator);\n this.space();\n this.print(node.typeAnnotation, node);\n}\n\nexport function TSIndexedAccessType(\n this: Printer,\n node: t.TSIndexedAccessType,\n) {\n this.print(node.objectType, node, true);\n this.token(\"[\");\n this.print(node.indexType, node);\n this.token(\"]\");\n}\n\nexport function TSMappedType(this: Printer, node: t.TSMappedType) {\n const { nameType, optional, readonly, typeParameter } = node;\n this.token(\"{\");\n this.space();\n if (readonly) {\n tokenIfPlusMinus(this, readonly);\n this.word(\"readonly\");\n this.space();\n }\n\n this.token(\"[\");\n this.word(\n !process.env.BABEL_8_BREAKING\n ? (typeParameter.name as unknown as string)\n : (typeParameter.name as unknown as t.Identifier).name,\n );\n this.space();\n this.word(\"in\");\n this.space();\n this.print(typeParameter.constraint, typeParameter);\n\n if (nameType) {\n this.space();\n this.word(\"as\");\n this.space();\n this.print(nameType, node);\n }\n\n this.token(\"]\");\n\n if (optional) {\n tokenIfPlusMinus(this, optional);\n this.token(\"?\");\n }\n this.token(\":\");\n this.space();\n this.print(node.typeAnnotation, node);\n this.space();\n this.token(\"}\");\n}\n\nfunction tokenIfPlusMinus(self: Printer, tok: true | \"+\" | \"-\") {\n if (tok !== true) {\n self.token(tok);\n }\n}\n\nexport function TSLiteralType(this: Printer, node: t.TSLiteralType) {\n this.print(node.literal, node);\n}\n\nexport function TSExpressionWithTypeArguments(\n this: Printer,\n node: t.TSExpressionWithTypeArguments,\n) {\n this.print(node.expression, node);\n this.print(node.typeParameters, node);\n}\n\nexport function TSInterfaceDeclaration(\n this: Printer,\n node: t.TSInterfaceDeclaration,\n) {\n const { declare, id, typeParameters, extends: extendz, body } = node;\n if (declare) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"interface\");\n this.space();\n this.print(id, node);\n this.print(typeParameters, node);\n if (extendz?.length) {\n this.space();\n this.word(\"extends\");\n this.space();\n this.printList(extendz, node);\n }\n this.space();\n this.print(body, node);\n}\n\nexport function TSInterfaceBody(this: Printer, node: t.TSInterfaceBody) {\n this.tsPrintTypeLiteralOrInterfaceBody(node.body, node);\n}\n\nexport function TSTypeAliasDeclaration(\n this: Printer,\n node: t.TSTypeAliasDeclaration,\n) {\n const { declare, id, typeParameters, typeAnnotation } = node;\n if (declare) {\n this.word(\"declare\");\n this.space();\n }\n this.word(\"type\");\n this.space();\n this.print(id, node);\n this.print(typeParameters, node);\n this.space();\n this.token(\"=\");\n this.space();\n this.print(typeAnnotation, node);\n this.token(\";\");\n}\n\nfunction TSTypeExpression(\n this: Printer,\n node: t.TSAsExpression | t.TSSatisfiesExpression,\n) {\n const { type, expression, typeAnnotation } = node;\n const forceParens = !!expression.trailingComments?.length;\n this.print(expression, node, true, undefined, forceParens);\n this.space();\n this.word(type === \"TSAsExpression\" ? \"as\" : \"satisfies\");\n this.space();\n this.print(typeAnnotation, node);\n}\n\nexport {\n TSTypeExpression as TSAsExpression,\n TSTypeExpression as TSSatisfiesExpression,\n};\n\nexport function TSTypeAssertion(this: Printer, node: t.TSTypeAssertion) {\n const { typeAnnotation, expression } = node;\n this.token(\"<\");\n this.print(typeAnnotation, node);\n this.token(\">\");\n this.space();\n this.print(expression, node);\n}\n\nexport function TSInstantiationExpression(\n this: Printer,\n node: t.TSInstantiationExpression,\n) {\n this.print(node.expression, node);\n this.print(node.typeParameters, node);\n}\n\nexport function TSEnumDeclaration(this: Printer, node: t.TSEnumDeclaration) {\n const { declare, const: isConst, id, members } = node;\n if (declare) {\n this.word(\"declare\");\n this.space();\n }\n if (isConst) {\n this.word(\"const\");\n this.space();\n }\n this.word(\"enum\");\n this.space();\n this.print(id, node);\n this.space();\n tsPrintBraced(this, members, node);\n}\n\nexport function TSEnumMember(this: Printer, node: t.TSEnumMember) {\n const { id, initializer } = node;\n this.print(id, node);\n if (initializer) {\n this.space();\n this.token(\"=\");\n this.space();\n this.print(initializer, node);\n }\n this.token(\",\");\n}\n\nexport function TSModuleDeclaration(\n this: Printer,\n node: t.TSModuleDeclaration,\n) {\n const { declare, id } = node;\n\n if (declare) {\n this.word(\"declare\");\n this.space();\n }\n\n if (!node.global) {\n this.word(id.type === \"Identifier\" ? \"namespace\" : \"module\");\n this.space();\n }\n this.print(id, node);\n\n if (!node.body) {\n this.token(\";\");\n return;\n }\n\n let body = node.body;\n while (body.type === \"TSModuleDeclaration\") {\n this.token(\".\");\n this.print(body.id, body);\n body = body.body;\n }\n\n this.space();\n this.print(body, node);\n}\n\nexport function TSModuleBlock(this: Printer, node: t.TSModuleBlock) {\n tsPrintBraced(this, node.body, node);\n}\n\nexport function TSImportType(this: Printer, node: t.TSImportType) {\n const { argument, qualifier, typeParameters } = node;\n this.word(\"import\");\n this.token(\"(\");\n this.print(argument, node);\n this.token(\")\");\n if (qualifier) {\n this.token(\".\");\n this.print(qualifier, node);\n }\n if (typeParameters) {\n this.print(typeParameters, node);\n }\n}\n\nexport function TSImportEqualsDeclaration(\n this: Printer,\n node: t.TSImportEqualsDeclaration,\n) {\n const { isExport, id, moduleReference } = node;\n if (isExport) {\n this.word(\"export\");\n this.space();\n }\n this.word(\"import\");\n this.space();\n this.print(id, node);\n this.space();\n this.token(\"=\");\n this.space();\n this.print(moduleReference, node);\n this.token(\";\");\n}\n\nexport function TSExternalModuleReference(\n this: Printer,\n node: t.TSExternalModuleReference,\n) {\n this.token(\"require(\");\n this.print(node.expression, node);\n this.token(\")\");\n}\n\nexport function TSNonNullExpression(\n this: Printer,\n node: t.TSNonNullExpression,\n) {\n this.print(node.expression, node);\n this.token(\"!\");\n}\n\nexport function TSExportAssignment(this: Printer, node: t.TSExportAssignment) {\n this.word(\"export\");\n this.space();\n this.token(\"=\");\n this.space();\n this.print(node.expression, node);\n this.token(\";\");\n}\n\nexport function TSNamespaceExportDeclaration(\n this: Printer,\n node: t.TSNamespaceExportDeclaration,\n) {\n this.word(\"export\");\n this.space();\n this.word(\"as\");\n this.space();\n this.word(\"namespace\");\n this.space();\n this.print(node.id, node);\n}\n\nexport function tsPrintSignatureDeclarationBase(this: Printer, node: any) {\n const { typeParameters } = node;\n const parameters = process.env.BABEL_8_BREAKING\n ? node.params\n : node.parameters;\n this.print(typeParameters, node);\n this.token(\"(\");\n this._parameters(parameters, node);\n this.token(\")\");\n const returnType = process.env.BABEL_8_BREAKING\n ? node.returnType\n : node.typeAnnotation;\n this.print(returnType, node);\n}\n\nexport function tsPrintClassMemberModifiers(\n this: Printer,\n node:\n | t.ClassProperty\n | t.ClassAccessorProperty\n | t.ClassMethod\n | t.ClassPrivateMethod\n | t.TSDeclareMethod,\n) {\n const isField =\n node.type === \"ClassAccessorProperty\" || node.type === \"ClassProperty\";\n if (isField && node.declare) {\n this.word(\"declare\");\n this.space();\n }\n if (node.accessibility) {\n this.word(node.accessibility);\n this.space();\n }\n if (node.static) {\n this.word(\"static\");\n this.space();\n }\n if (node.override) {\n this.word(\"override\");\n this.space();\n }\n if (node.abstract) {\n this.word(\"abstract\");\n this.space();\n }\n if (isField && node.readonly) {\n this.word(\"readonly\");\n this.space();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,SAASA,gBAAgB,CAAgBC,IAAwB,EAAE;EACxE,IAAI,CAACC,SAAK,IAAK;EACf,IAAI,CAACC,KAAK,EAAE;EAEZ,IAAIF,IAAI,CAACG,QAAQ,EAAE,IAAI,CAACF,SAAK,IAAK;EAClC,IAAI,CAACG,KAAK,CAACJ,IAAI,CAACK,cAAc,EAAEL,IAAI,CAAC;AACvC;AAEO,SAASM,4BAA4B,CAE1CN,IAAoC,EACpCO,MAAc,EACR;EACN,IAAI,CAACN,SAAK,IAAK;EACf,IAAI,CAACO,SAAS,CAACR,IAAI,CAACS,MAAM,EAAET,IAAI,EAAE,CAAC,CAAC,CAAC;EACrC,IAAIO,MAAM,CAACG,IAAI,KAAK,yBAAyB,IAAIV,IAAI,CAACS,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE;IACzE,IAAI,CAACV,SAAK,IAAK;EACjB;EACA,IAAI,CAACA,SAAK,IAAK;AACjB;AAIO,SAASW,eAAe,CAAgBZ,IAAuB,EAAE;EACtE,IAAIA,IAAI,CAACa,EAAE,EAAE;IACX,IAAI,CAACC,IAAI,CAAC,IAAI,CAAC;IACf,IAAI,CAACZ,KAAK,EAAE;EACd;EAEA,IAAIF,IAAI,CAACe,GAAG,EAAE;IACZ,IAAI,CAACD,IAAI,CAAC,KAAK,CAAC;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AACP,IAAI,CAAC,UAAU,CAAC;IACrB,IAAI,CAACZ,KAAK,EAAE;EACd;AACF"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/index.js b/node_modules/@babel/generator/lib/index.js index fea33707c..4fee1ef43 100644 --- a/node_modules/@babel/generator/lib/index.js +++ b/node_modules/@babel/generator/lib/index.js @@ -5,9 +5,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.CodeGenerator = void 0; exports.default = generate; - var _sourceMap = require("./source-map"); - var _printer = require("./printer"); class Generator extends _printer.default { @@ -22,7 +20,6 @@ class Generator extends _printer.default { generate() { return super.generate(this.ast); } - } function normalizeOptions(code, opts) { @@ -52,15 +49,12 @@ function normalizeOptions(code, opts) { format.decoratorsBeforeExport = !!opts.decoratorsBeforeExport; format.jsonCompatibleStrings = opts.jsonCompatibleStrings; } - if (format.minified) { format.compact = true; - format.shouldPrintComment = format.shouldPrintComment || (() => format.comments); } else { format.shouldPrintComment = format.shouldPrintComment || (value => format.comments || value.includes("@license") || value.includes("@preserve")); } - if (format.compact === "auto") { format.compact = code.length > 500000; @@ -68,11 +62,20 @@ function normalizeOptions(code, opts) { console.error("[BABEL] Note: The code generator has deoptimised the styling of " + `${opts.filename} as it exceeds the max of ${"500KB"}.`); } } - if (format.compact) { format.indent.adjustMultilineComment = false; } - + const { + auxiliaryCommentBefore, + auxiliaryCommentAfter, + shouldPrintComment + } = format; + if (auxiliaryCommentBefore && !shouldPrintComment(auxiliaryCommentBefore)) { + format.auxiliaryCommentBefore = undefined; + } + if (auxiliaryCommentAfter && !shouldPrintComment(auxiliaryCommentAfter)) { + format.auxiliaryCommentAfter = undefined; + } return format; } @@ -81,15 +84,12 @@ class CodeGenerator { this._generator = void 0; this._generator = new Generator(ast, opts, code); } - generate() { return this._generator.generate(); } - } exports.CodeGenerator = CodeGenerator; - function generate(ast, opts, code) { const gen = new Generator(ast, opts, code); return gen.generate(); diff --git a/node_modules/@babel/generator/lib/index.js.map b/node_modules/@babel/generator/lib/index.js.map index 07e2b3f65..61b9032d9 100644 --- a/node_modules/@babel/generator/lib/index.js.map +++ b/node_modules/@babel/generator/lib/index.js.map @@ -1 +1 @@ -{"version":3,"names":["Generator","Printer","constructor","ast","opts","code","format","normalizeOptions","map","sourceMaps","SourceMap","generate","auxiliaryCommentBefore","auxiliaryCommentAfter","shouldPrintComment","retainLines","retainFunctionParens","comments","compact","minified","concise","indent","adjustMultilineComment","style","jsescOption","quotes","wrap","minimal","recordAndTupleSyntaxType","topicToken","decoratorsBeforeExport","jsonCompatibleStrings","value","includes","length","console","error","filename","CodeGenerator","_generator","gen"],"sources":["../src/index.ts"],"sourcesContent":["import SourceMap from \"./source-map\";\nimport Printer from \"./printer\";\nimport type * as t from \"@babel/types\";\nimport type { Opts as jsescOptions } from \"jsesc\";\nimport type { Format } from \"./printer\";\nimport type {\n RecordAndTuplePluginOptions,\n PipelineOperatorPluginOptions,\n} from \"@babel/parser\";\nimport type { DecodedSourceMap, Mapping } from \"@jridgewell/gen-mapping\";\n\n/**\n * Babel's code generator, turns an ast into code, maintaining sourcemaps,\n * user preferences, and valid output.\n */\n\nclass Generator extends Printer {\n constructor(\n ast: t.Node,\n opts: GeneratorOptions = {},\n code: string | { [filename: string]: string },\n ) {\n const format = normalizeOptions(code, opts);\n const map = opts.sourceMaps ? new SourceMap(opts, code) : null;\n super(format, map);\n\n this.ast = ast;\n }\n\n ast: t.Node;\n\n /**\n * Generate code and sourcemap from ast.\n *\n * Appends comments that weren't attached to any node to the end of the generated output.\n */\n\n generate() {\n return super.generate(this.ast);\n }\n}\n\n/**\n * Normalize generator options, setting defaults.\n *\n * - Detects code indentation.\n * - If `opts.compact = \"auto\"` and the code is over 500KB, `compact` will be set to `true`.\n */\n\nfunction normalizeOptions(\n code: string | { [filename: string]: string },\n opts: GeneratorOptions,\n): Format {\n const format: Format = {\n auxiliaryCommentBefore: opts.auxiliaryCommentBefore,\n auxiliaryCommentAfter: opts.auxiliaryCommentAfter,\n shouldPrintComment: opts.shouldPrintComment,\n retainLines: opts.retainLines,\n retainFunctionParens: opts.retainFunctionParens,\n comments: opts.comments == null || opts.comments,\n compact: opts.compact,\n minified: opts.minified,\n concise: opts.concise,\n indent: {\n adjustMultilineComment: true,\n style: \" \",\n },\n jsescOption: {\n quotes: \"double\",\n wrap: true,\n minimal: process.env.BABEL_8_BREAKING ? true : false,\n ...opts.jsescOption,\n },\n recordAndTupleSyntaxType: opts.recordAndTupleSyntaxType,\n topicToken: opts.topicToken,\n };\n\n if (!process.env.BABEL_8_BREAKING) {\n format.decoratorsBeforeExport = !!opts.decoratorsBeforeExport;\n format.jsonCompatibleStrings = opts.jsonCompatibleStrings;\n }\n\n if (format.minified) {\n format.compact = true;\n\n format.shouldPrintComment =\n format.shouldPrintComment || (() => format.comments);\n } else {\n format.shouldPrintComment =\n format.shouldPrintComment ||\n (value =>\n format.comments ||\n value.includes(\"@license\") ||\n value.includes(\"@preserve\"));\n }\n\n if (format.compact === \"auto\") {\n format.compact = code.length > 500_000; // 500KB\n\n if (format.compact) {\n console.error(\n \"[BABEL] Note: The code generator has deoptimised the styling of \" +\n `${opts.filename} as it exceeds the max of ${\"500KB\"}.`,\n );\n }\n }\n\n if (format.compact) {\n format.indent.adjustMultilineComment = false;\n }\n\n return format;\n}\n\nexport interface GeneratorOptions {\n /**\n * Optional string to add as a block comment at the start of the output file.\n */\n auxiliaryCommentBefore?: string;\n\n /**\n * Optional string to add as a block comment at the end of the output file.\n */\n auxiliaryCommentAfter?: string;\n\n /**\n * Function that takes a comment (as a string) and returns true if the comment should be included in the output.\n * By default, comments are included if `opts.comments` is `true` or if `opts.minifed` is `false` and the comment\n * contains `@preserve` or `@license`.\n */\n shouldPrintComment?(comment: string): boolean;\n\n /**\n * Attempt to use the same line numbers in the output code as in the source code (helps preserve stack traces).\n * Defaults to `false`.\n */\n retainLines?: boolean;\n\n /**\n * Retain parens around function expressions (could be used to change engine parsing behavior)\n * Defaults to `false`.\n */\n retainFunctionParens?: boolean;\n\n /**\n * Should comments be included in output? Defaults to `true`.\n */\n comments?: boolean;\n\n /**\n * Set to true to avoid adding whitespace for formatting. Defaults to the value of `opts.minified`.\n */\n compact?: boolean | \"auto\";\n\n /**\n * Should the output be minified. Defaults to `false`.\n */\n minified?: boolean;\n\n /**\n * Set to true to reduce whitespace (but not as much as opts.compact). Defaults to `false`.\n */\n concise?: boolean;\n\n /**\n * Used in warning messages\n */\n filename?: string;\n\n /**\n * Enable generating source maps. Defaults to `false`.\n */\n sourceMaps?: boolean;\n\n /**\n * A root for all relative URLs in the source map.\n */\n sourceRoot?: string;\n\n /**\n * The filename for the source code (i.e. the code in the `code` argument).\n * This will only be used if `code` is a string.\n */\n sourceFileName?: string;\n\n /**\n * Set to true to run jsesc with \"json\": true to print \"\\u00A9\" vs. \"©\";\n * @deprecated use `jsescOptions: { json: true }` instead\n */\n jsonCompatibleStrings?: boolean;\n\n /**\n * Set to true to enable support for experimental decorators syntax before module exports.\n * Defaults to `false`.\n * @deprecated Removed in Babel 8\n */\n decoratorsBeforeExport?: boolean;\n\n /**\n * Options for outputting jsesc representation.\n */\n jsescOption?: jsescOptions;\n\n /**\n * For use with the recordAndTuple token.\n */\n recordAndTupleSyntaxType?: RecordAndTuplePluginOptions[\"syntaxType\"];\n /**\n * For use with the Hack-style pipe operator.\n * Changes what token is used for pipe bodies’ topic references.\n */\n topicToken?: PipelineOperatorPluginOptions[\"topicToken\"];\n}\n\nexport interface GeneratorResult {\n code: string;\n map: {\n version: number;\n sources: readonly string[];\n names: readonly string[];\n sourceRoot?: string;\n sourcesContent?: readonly string[];\n mappings: string;\n file?: string;\n } | null;\n decodedMap: DecodedSourceMap | undefined;\n rawMappings: Mapping[] | undefined;\n}\n\n/**\n * We originally exported the Generator class above, but to make it extra clear that it is a private API,\n * we have moved that to an internal class instance and simplified the interface to the two public methods\n * that we wish to support.\n */\n\nexport class CodeGenerator {\n private _generator: Generator;\n constructor(ast: t.Node, opts?: GeneratorOptions, code?: string) {\n this._generator = new Generator(ast, opts, code);\n }\n generate(): GeneratorResult {\n return this._generator.generate();\n }\n}\n\n/**\n * Turns an AST into code, maintaining sourcemaps, user preferences, and valid output.\n * @param ast - the abstract syntax tree from which to generate output code.\n * @param opts - used for specifying options for code generation.\n * @param code - the original source code, used for source maps.\n * @returns - an object containing the output code and source map.\n */\nexport default function generate(\n ast: t.Node,\n opts?: GeneratorOptions,\n code?: string | { [filename: string]: string },\n) {\n const gen = new Generator(ast, opts, code);\n return gen.generate();\n}\n"],"mappings":";;;;;;;;AAAA;;AACA;;AAeA,MAAMA,SAAN,SAAwBC,gBAAxB,CAAgC;EAC9BC,WAAW,CACTC,GADS,EAETC,IAAsB,GAAG,EAFhB,EAGTC,IAHS,EAIT;IACA,MAAMC,MAAM,GAAGC,gBAAgB,CAACF,IAAD,EAAOD,IAAP,CAA/B;IACA,MAAMI,GAAG,GAAGJ,IAAI,CAACK,UAAL,GAAkB,IAAIC,kBAAJ,CAAcN,IAAd,EAAoBC,IAApB,CAAlB,GAA8C,IAA1D;IACA,MAAMC,MAAN,EAAcE,GAAd;IAHA,KAQFL,GARE;IAKA,KAAKA,GAAL,GAAWA,GAAX;EACD;;EAUDQ,QAAQ,GAAG;IACT,OAAO,MAAMA,QAAN,CAAe,KAAKR,GAApB,CAAP;EACD;;AAvB6B;;AAiChC,SAASI,gBAAT,CACEF,IADF,EAEED,IAFF,EAGU;EACR,MAAME,MAAc,GAAG;IACrBM,sBAAsB,EAAER,IAAI,CAACQ,sBADR;IAErBC,qBAAqB,EAAET,IAAI,CAACS,qBAFP;IAGrBC,kBAAkB,EAAEV,IAAI,CAACU,kBAHJ;IAIrBC,WAAW,EAAEX,IAAI,CAACW,WAJG;IAKrBC,oBAAoB,EAAEZ,IAAI,CAACY,oBALN;IAMrBC,QAAQ,EAAEb,IAAI,CAACa,QAAL,IAAiB,IAAjB,IAAyBb,IAAI,CAACa,QANnB;IAOrBC,OAAO,EAAEd,IAAI,CAACc,OAPO;IAQrBC,QAAQ,EAAEf,IAA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EAED,OAAOhB,MAAP;AACD;;AA2HM,MAAMgC,aAAN,CAAoB;EAEzBpC,WAAW,CAACC,GAAD,EAAcC,IAAd,EAAuCC,IAAvC,EAAsD;IAAA,KADzDkC,UACyD;IAC/D,KAAKA,UAAL,GAAkB,IAAIvC,SAAJ,CAAcG,GAAd,EAAmBC,IAAnB,EAAyBC,IAAzB,CAAlB;EACD;;EACDM,QAAQ,GAAoB;IAC1B,OAAO,KAAK4B,UAAL,CAAgB5B,QAAhB,EAAP;EACD;;AAPwB;;;;AAiBZ,SAASA,QAAT,CACbR,GADa,EAEbC,IAFa,EAGbC,IAHa,EAIb;EACA,MAAMmC,GAAG,GAAG,IAAIxC,SAAJ,CAAcG,GAAd,EAAmBC,IAAnB,EAAyBC,IAAzB,CAAZ;EACA,OAAOmC,GAAG,CAAC7B,QAAJ,EAAP;AACD"} \ No newline at end of file +{"version":3,"names":["Generator","Printer","constructor","ast","opts","code","format","normalizeOptions","map","sourceMaps","SourceMap","generate","auxiliaryCommentBefore","auxiliaryCommentAfter","shouldPrintComment","retainLines","retainFunctionParens","comments","compact","minified","concise","indent","adjustMultilineComment","style","jsescOption","quotes","wrap","minimal","recordAndTupleSyntaxType","topicToken","decoratorsBeforeExport","jsonCompatibleStrings","value","includes","length","console","error","filename","undefined","CodeGenerator","_generator","gen"],"sources":["../src/index.ts"],"sourcesContent":["import SourceMap from \"./source-map\";\nimport Printer from \"./printer\";\nimport type * as t from \"@babel/types\";\nimport type { Opts as jsescOptions } from \"jsesc\";\nimport type { Format } from \"./printer\";\nimport type {\n RecordAndTuplePluginOptions,\n PipelineOperatorPluginOptions,\n} from \"@babel/parser\";\nimport type { DecodedSourceMap, Mapping } from \"@jridgewell/gen-mapping\";\n\n/**\n * Babel's code generator, turns an ast into code, maintaining sourcemaps,\n * user preferences, and valid output.\n */\n\nclass Generator extends Printer {\n constructor(\n ast: t.Node,\n opts: GeneratorOptions = {},\n code: string | { [filename: string]: string },\n ) {\n const format = normalizeOptions(code, opts);\n const map = opts.sourceMaps ? new SourceMap(opts, code) : null;\n super(format, map);\n\n this.ast = ast;\n }\n\n ast: t.Node;\n\n /**\n * Generate code and sourcemap from ast.\n *\n * Appends comments that weren't attached to any node to the end of the generated output.\n */\n\n generate() {\n return super.generate(this.ast);\n }\n}\n\n/**\n * Normalize generator options, setting defaults.\n *\n * - Detects code indentation.\n * - If `opts.compact = \"auto\"` and the code is over 500KB, `compact` will be set to `true`.\n */\n\nfunction normalizeOptions(\n code: string | { [filename: string]: string },\n opts: GeneratorOptions,\n): Format {\n const format: Format = {\n auxiliaryCommentBefore: opts.auxiliaryCommentBefore,\n auxiliaryCommentAfter: opts.auxiliaryCommentAfter,\n shouldPrintComment: opts.shouldPrintComment,\n retainLines: opts.retainLines,\n retainFunctionParens: opts.retainFunctionParens,\n comments: opts.comments == null || opts.comments,\n compact: opts.compact,\n minified: opts.minified,\n concise: opts.concise,\n indent: {\n adjustMultilineComment: true,\n style: \" \",\n },\n jsescOption: {\n quotes: \"double\",\n wrap: true,\n minimal: process.env.BABEL_8_BREAKING ? true : false,\n ...opts.jsescOption,\n },\n recordAndTupleSyntaxType: opts.recordAndTupleSyntaxType,\n topicToken: opts.topicToken,\n };\n\n if (!process.env.BABEL_8_BREAKING) {\n format.decoratorsBeforeExport = !!opts.decoratorsBeforeExport;\n format.jsonCompatibleStrings = opts.jsonCompatibleStrings;\n }\n\n if (format.minified) {\n format.compact = true;\n\n format.shouldPrintComment =\n format.shouldPrintComment || (() => format.comments);\n } else {\n format.shouldPrintComment =\n format.shouldPrintComment ||\n (value =>\n format.comments ||\n value.includes(\"@license\") ||\n value.includes(\"@preserve\"));\n }\n\n if (format.compact === \"auto\") {\n format.compact = code.length > 500_000; // 500KB\n\n if (format.compact) {\n console.error(\n \"[BABEL] Note: The code generator has deoptimised the styling of \" +\n `${opts.filename} as it exceeds the max of ${\"500KB\"}.`,\n );\n }\n }\n\n if (format.compact) {\n format.indent.adjustMultilineComment = false;\n }\n\n const { auxiliaryCommentBefore, auxiliaryCommentAfter, shouldPrintComment } =\n format;\n\n if (auxiliaryCommentBefore && !shouldPrintComment(auxiliaryCommentBefore)) {\n format.auxiliaryCommentBefore = undefined;\n }\n if (auxiliaryCommentAfter && !shouldPrintComment(auxiliaryCommentAfter)) {\n format.auxiliaryCommentAfter = undefined;\n }\n\n return format;\n}\n\nexport interface GeneratorOptions {\n /**\n * Optional string to add as a block comment at the start of the output file.\n */\n auxiliaryCommentBefore?: string;\n\n /**\n * Optional string to add as a block comment at the end of the output file.\n */\n auxiliaryCommentAfter?: string;\n\n /**\n * Function that takes a comment (as a string) and returns true if the comment should be included in the output.\n * By default, comments are included if `opts.comments` is `true` or if `opts.minifed` is `false` and the comment\n * contains `@preserve` or `@license`.\n */\n shouldPrintComment?(comment: string): boolean;\n\n /**\n * Attempt to use the same line numbers in the output code as in the source code (helps preserve stack traces).\n * Defaults to `false`.\n */\n retainLines?: boolean;\n\n /**\n * Retain parens around function expressions (could be used to change engine parsing behavior)\n * Defaults to `false`.\n */\n retainFunctionParens?: boolean;\n\n /**\n * Should comments be included in output? Defaults to `true`.\n */\n comments?: boolean;\n\n /**\n * Set to true to avoid adding whitespace for formatting. Defaults to the value of `opts.minified`.\n */\n compact?: boolean | \"auto\";\n\n /**\n * Should the output be minified. Defaults to `false`.\n */\n minified?: boolean;\n\n /**\n * Set to true to reduce whitespace (but not as much as opts.compact). Defaults to `false`.\n */\n concise?: boolean;\n\n /**\n * Used in warning messages\n */\n filename?: string;\n\n /**\n * Enable generating source maps. Defaults to `false`.\n */\n sourceMaps?: boolean;\n\n /**\n * A root for all relative URLs in the source map.\n */\n sourceRoot?: string;\n\n /**\n * The filename for the source code (i.e. the code in the `code` argument).\n * This will only be used if `code` is a string.\n */\n sourceFileName?: string;\n\n /**\n * Set to true to run jsesc with \"json\": true to print \"\\u00A9\" vs. \"©\";\n * @deprecated use `jsescOptions: { json: true }` instead\n */\n jsonCompatibleStrings?: boolean;\n\n /**\n * Set to true to enable support for experimental decorators syntax before module exports.\n * Defaults to `false`.\n * @deprecated Removed in Babel 8\n */\n decoratorsBeforeExport?: boolean;\n\n /**\n * Options for outputting jsesc representation.\n */\n jsescOption?: jsescOptions;\n\n /**\n * For use with the recordAndTuple token.\n */\n recordAndTupleSyntaxType?: RecordAndTuplePluginOptions[\"syntaxType\"];\n /**\n * For use with the Hack-style pipe operator.\n * Changes what token is used for pipe bodies’ topic references.\n */\n topicToken?: PipelineOperatorPluginOptions[\"topicToken\"];\n}\n\nexport interface GeneratorResult {\n code: string;\n map: {\n version: number;\n sources: readonly string[];\n names: readonly string[];\n sourceRoot?: string;\n sourcesContent?: readonly string[];\n mappings: string;\n file?: string;\n } | null;\n decodedMap: DecodedSourceMap | undefined;\n rawMappings: Mapping[] | undefined;\n}\n\n/**\n * We originally exported the Generator class above, but to make it extra clear that it is a private API,\n * we have moved that to an internal class instance and simplified the interface to the two public methods\n * that we wish to support.\n */\n\nexport class CodeGenerator {\n private _generator: Generator;\n constructor(ast: t.Node, opts?: GeneratorOptions, code?: string) {\n this._generator = new Generator(ast, opts, code);\n }\n generate(): GeneratorResult {\n return this._generator.generate();\n }\n}\n\n/**\n * Turns an AST into code, maintaining sourcemaps, user preferences, and valid output.\n * @param ast - the abstract syntax tree from which to generate output code.\n * @param opts - used for specifying options for code generation.\n * @param code - the original source code, used for source maps.\n * @returns - an object containing the output code and source map.\n */\nexport default function generate(\n ast: t.Node,\n opts?: GeneratorOptions,\n code?: string | { [filename: string]: string },\n) {\n const gen = new Generator(ast, opts, code);\n return gen.generate();\n}\n"],"mappings":";;;;;;;AAAA;AACA;;AAeA,MAAMA,SAAS,SAASC,gBAAO,CAAC;EAC9BC,WAAW,CACTC,GAAW,EACXC,IAAsB,GAAG,CAAC,CAAC,EAC3BC,IAA6C,EAC7C;IACA,MAAMC,MAAM,GAAGC,gBAAgB,CAACF,IAAI,EAAED,IAAI,CAAC;IAC3C,MAAMI,GAAG,GAAGJ,IAAI,CAACK,UAAU,GAAG,IAAIC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I,EAAEC,IAAI,CAAC;EAClD;EACAM,QAAQ,GAAoB;IAC1B,OAAO,IAAI,CAAC6B,UAAU,CAAC7B,QAAQ,EAAE;EACnC;AACF;;AAAC;AASc,SAASA,QAAQ,CAC9BR,GAAW,EACXC,IAAuB,EACvBC,IAA8C,EAC9C;EACA,MAAMoC,GAAG,GAAG,IAAIzC,SAAS,CAACG,GAAG,EAAEC,IAAI,EAAEC,IAAI,CAAC;EAC1C,OAAOoC,GAAG,CAAC9B,QAAQ,EAAE;AACvB"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/node/index.js b/node_modules/@babel/generator/lib/node/index.js index 07dc2f0fd..d42879d9c 100644 --- a/node_modules/@babel/generator/lib/node/index.js +++ b/node_modules/@babel/generator/lib/node/index.js @@ -7,13 +7,9 @@ exports.needsParens = needsParens; exports.needsWhitespace = needsWhitespace; exports.needsWhitespaceAfter = needsWhitespaceAfter; exports.needsWhitespaceBefore = needsWhitespaceBefore; - var whitespace = require("./whitespace"); - var parens = require("./parentheses"); - var _t = require("@babel/types"); - const { FLIPPED_ALIAS_KEYS, isCallExpression, @@ -21,10 +17,8 @@ const { isMemberExpression, isNewExpression } = _t; - function expandAliases(obj) { const newObj = {}; - function add(type, func) { const fn = newObj[type]; newObj[type] = fn ? function (node, parent, stack) { @@ -32,10 +26,8 @@ function expandAliases(obj) { return result == null ? func(node, parent, stack) : result; } : func; } - for (const type of Object.keys(obj)) { const aliases = FLIPPED_ALIAS_KEYS[type]; - if (aliases) { for (const alias of aliases) { add(alias, obj[type]); @@ -44,57 +36,43 @@ function expandAliases(obj) { add(type, obj[type]); } } - return newObj; } const expandedParens = expandAliases(parens); const expandedWhitespaceNodes = expandAliases(whitespace.nodes); - function find(obj, node, parent, printStack) { const fn = obj[node.type]; return fn ? fn(node, parent, printStack) : null; } - function isOrHasCallExpression(node) { if (isCallExpression(node)) { return true; } - return isMemberExpression(node) && isOrHasCallExpression(node.object); } - function needsWhitespace(node, parent, type) { if (!node) return false; - if (isExpressionStatement(node)) { node = node.expression; } - const flag = find(expandedWhitespaceNodes, node, parent); - if (typeof flag === "number") { return (flag & type) !== 0; } - return false; } - function needsWhitespaceBefore(node, parent) { return needsWhitespace(node, parent, 1); } - function needsWhitespaceAfter(node, parent) { return needsWhitespace(node, parent, 2); } - function needsParens(node, parent, printStack) { if (!parent) return false; - if (isNewExpression(parent) && parent.callee === node) { if (isOrHasCallExpression(node)) return true; } - return find(expandedParens, node, parent, printStack); } diff --git a/node_modules/@babel/generator/lib/node/index.js.map b/node_modules/@babel/generator/lib/node/index.js.map index 687e38537..2687e39d9 100644 --- a/node_modules/@babel/generator/lib/node/index.js.map +++ b/node_modules/@babel/generator/lib/node/index.js.map @@ -1 +1 @@ -{"version":3,"names":["FLIPPED_ALIAS_KEYS","isCallExpression","isExpressionStatement","isMemberExpression","isNewExpression","expandAliases","obj","newObj","add","type","func","fn","node","parent","stack","result","Object","keys","aliases","alias","expandedParens","parens","expandedWhitespaceNodes","whitespace","nodes","find","printStack","isOrHasCallExpression","object","needsWhitespace","expression","flag","needsWhitespaceBefore","needsWhitespaceAfter","needsParens","callee"],"sources":["../../src/node/index.ts"],"sourcesContent":["import * as whitespace from \"./whitespace\";\nimport * as parens from \"./parentheses\";\nimport {\n FLIPPED_ALIAS_KEYS,\n isCallExpression,\n isExpressionStatement,\n isMemberExpression,\n isNewExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\nimport type { WhitespaceFlag } from \"./whitespace\";\n\nexport type NodeHandlers = {\n [K in string]?: (\n node: K extends t.Node[\"type\"] ? Extract : t.Node,\n // todo:\n // node: K extends keyof typeof t\n // ? Extract\n // : t.Node,\n parent: t.Node,\n stack: t.Node[],\n ) => R;\n};\n\nfunction expandAliases(obj: NodeHandlers) {\n const newObj: NodeHandlers = {};\n\n function add(\n type: string,\n func: (node: t.Node, parent: t.Node, stack: t.Node[]) => R,\n ) {\n const fn = newObj[type];\n newObj[type] = fn\n ? function (node, parent, stack) {\n const result = fn(node, parent, stack);\n\n return result == null ? func(node, parent, stack) : result;\n }\n : func;\n }\n\n for (const type of Object.keys(obj)) {\n const aliases = FLIPPED_ALIAS_KEYS[type];\n if (aliases) {\n for (const alias of aliases) {\n add(alias, obj[type]);\n }\n } else {\n add(type, obj[type]);\n }\n }\n\n return newObj;\n}\n\n// Rather than using `t.is` on each object property, we pre-expand any type aliases\n// into concrete types so that the 'find' call below can be as fast as possible.\nconst expandedParens = expandAliases(parens);\nconst expandedWhitespaceNodes = expandAliases(whitespace.nodes);\n\nfunction find(\n obj: NodeHandlers,\n node: t.Node,\n parent: t.Node,\n printStack?: t.Node[],\n): R | null {\n const fn = obj[node.type];\n return fn ? fn(node, parent, printStack) : null;\n}\n\nfunction isOrHasCallExpression(node: t.Node): boolean {\n if (isCallExpression(node)) {\n return true;\n }\n\n return isMemberExpression(node) && isOrHasCallExpression(node.object);\n}\n\nexport function needsWhitespace(\n node: t.Node,\n parent: t.Node,\n type: WhitespaceFlag,\n): boolean {\n if (!node) return false;\n\n if (isExpressionStatement(node)) {\n node = node.expression;\n }\n\n const flag = find(expandedWhitespaceNodes, node, parent);\n\n if (typeof flag === \"number\") {\n return (flag & type) !== 0;\n }\n\n return false;\n}\n\nexport function needsWhitespaceBefore(node: t.Node, parent: t.Node) {\n return needsWhitespace(node, parent, 1);\n}\n\nexport function needsWhitespaceAfter(node: t.Node, parent: t.Node) {\n return needsWhitespace(node, parent, 2);\n}\n\nexport function needsParens(\n node: t.Node,\n parent: t.Node,\n printStack?: t.Node[],\n) {\n if (!parent) return false;\n\n if (isNewExpression(parent) && parent.callee === node) {\n if (isOrHasCallExpression(node)) return true;\n }\n\n return find(expandedParens, node, parent, printStack);\n}\n"],"mappings":";;;;;;;;;;AAAA;;AACA;;AACA;;;EACEA,kB;EACAC,gB;EACAC,qB;EACAC,kB;EACAC;;;AAkBF,SAASC,aAAT,CAA0BC,GAA1B,EAAgD;EAC9C,MAAMC,MAAuB,GAAG,EAAhC;;EAEA,SAASC,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;IAC1B,OAAO,IAAP;EACD;;EAED,OAAOT,kBAAkB,CAACS,IAAD,CAAlB,IAA4Be,qBAAqB,CAACf,IAAI,CAACgB,MAAN,CAAxD;AACD;;AAEM,SAASC,eAAT,CACLjB,IADK,EAELC,MAFK,EAGLJ,IAHK,EAII;EACT,IAAI,CAACG,IAAL,EAAW,OAAO,KAAP;;EAEX,IAAIV,qBAAqB,CAACU,IAAD,CAAzB,EAAiC;IAC/BA,IAAI,GAAGA,IAAI,CAACkB,UAAZ;EACD;;EAED,MAAMC,IAAI,GAAGN,IAAI,CAACH,uBAAD,EAA0BV,IAA1B,EAAgCC,MAAhC,CAAjB;;EAEA,IAAI,OAAOkB,IAAP,KAAgB,QAApB,EAA8B;IAC5B,OAAO,CAACA,IAAI,GAAGtB,IAAR,MAAkB,CAAzB;EACD;;EAED,OAAO,KAAP;AACD;;AAEM,SAASuB,qBAAT,CAA+BpB,IAA/B,EAA6CC,MAA7C,EAA6D;EAClE,OAAOgB,eAAe,CAACjB,IAAD,EAAOC,MAAP,EAAe,CAAf,CAAtB;AACD;;AAEM,SAASoB,oBAAT,CAA8BrB,IAA9B,EAA4CC,MAA5C,EAA4D;EACjE,OAAOgB,eAAe,CAACjB,IAAD,EAAOC,MAAP,EAAe,CAAf,CAAtB;AACD;;AAEM,SAASqB,WAAT,CACLtB,IADK,EAELC,MAFK,EAGLa,UAHK,EAIL;EACA,IAAI,CAACb,MAAL,EAAa,OAAO,KAAP;;EAEb,IAAIT,eAAe,CAACS,MAAD,CAAf,IAA2BA,MAAM,CAACsB,MAAP,KAAkBvB,IAAjD,EAAuD;IACrD,IAAIe,qBAAqB,CAACf,IAAD,CAAzB,EAAiC,OAAO,IAAP;EAClC;;EAED,OAAOa,IAAI,CAACL,cAAD,EAAiBR,IAAjB,EAAuBC,MAAvB,EAA+Ba,UAA/B,CAAX;AACD"} \ No newline at end of file +{"version":3,"names":["FLIPPED_ALIAS_KEYS","isCallExpression","isExpressionStatement","isMemberExpression","isNewExpression","expandAliases","obj","newObj","add","type","func","fn","node","parent","stack","result","Object","keys","aliases","alias","expandedParens","parens","expandedWhitespaceNodes","whitespace","nodes","find","printStack","isOrHasCallExpression","object","needsWhitespace","expression","flag","needsWhitespaceBefore","needsWhitespaceAfter","needsParens","callee"],"sources":["../../src/node/index.ts"],"sourcesContent":["import * as whitespace from \"./whitespace\";\nimport * as parens from \"./parentheses\";\nimport {\n FLIPPED_ALIAS_KEYS,\n isCallExpression,\n isExpressionStatement,\n isMemberExpression,\n isNewExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\n\nimport type { WhitespaceFlag } from \"./whitespace\";\n\nexport type NodeHandlers = {\n [K in string]?: (\n node: K extends t.Node[\"type\"] ? Extract : t.Node,\n // todo:\n // node: K extends keyof typeof t\n // ? Extract\n // : t.Node,\n parent: t.Node,\n stack: t.Node[],\n ) => R;\n};\n\nfunction expandAliases(obj: NodeHandlers) {\n const newObj: NodeHandlers = {};\n\n function add(\n type: string,\n func: (node: t.Node, parent: t.Node, stack: t.Node[]) => R,\n ) {\n const fn = newObj[type];\n newObj[type] = fn\n ? function (node, parent, stack) {\n const result = fn(node, parent, stack);\n\n return result == null ? func(node, parent, stack) : result;\n }\n : func;\n }\n\n for (const type of Object.keys(obj)) {\n const aliases = FLIPPED_ALIAS_KEYS[type];\n if (aliases) {\n for (const alias of aliases) {\n add(alias, obj[type]);\n }\n } else {\n add(type, obj[type]);\n }\n }\n\n return newObj;\n}\n\n// Rather than using `t.is` on each object property, we pre-expand any type aliases\n// into concrete types so that the 'find' call below can be as fast as possible.\nconst expandedParens = expandAliases(parens);\nconst expandedWhitespaceNodes = expandAliases(whitespace.nodes);\n\nfunction find(\n obj: NodeHandlers,\n node: t.Node,\n parent: t.Node,\n printStack?: t.Node[],\n): R | null {\n const fn = obj[node.type];\n return fn ? fn(node, parent, printStack) : null;\n}\n\nfunction isOrHasCallExpression(node: t.Node): boolean {\n if (isCallExpression(node)) {\n return true;\n }\n\n return isMemberExpression(node) && isOrHasCallExpression(node.object);\n}\n\nexport function needsWhitespace(\n node: t.Node,\n parent: t.Node,\n type: WhitespaceFlag,\n): boolean {\n if (!node) return false;\n\n if (isExpressionStatement(node)) {\n node = node.expression;\n }\n\n const flag = find(expandedWhitespaceNodes, node, parent);\n\n if (typeof flag === \"number\") {\n return (flag & type) !== 0;\n }\n\n return false;\n}\n\nexport function needsWhitespaceBefore(node: t.Node, parent: t.Node) {\n return needsWhitespace(node, parent, 1);\n}\n\nexport function needsWhitespaceAfter(node: t.Node, parent: t.Node) {\n return needsWhitespace(node, parent, 2);\n}\n\nexport function needsParens(\n node: t.Node,\n parent: t.Node,\n printStack?: t.Node[],\n) {\n if (!parent) return false;\n\n if (isNewExpression(parent) && parent.callee === node) {\n if (isOrHasCallExpression(node)) return true;\n }\n\n return find(expandedParens, node, parent, printStack);\n}\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AAMsB;EALpBA,kBAAkB;EAClBC,gBAAgB;EAChBC,qBAAqB;EACrBC,kBAAkB;EAClBC;AAAe;AAkBjB,SAASC,aAAa,CAAIC,GAAoB,EAAE;EAC9C,MAAMC,MAAuB,GAAG,CAAC,CAAC;EAElC,SAASC,GAAG,CACVC,IAAY,EACZC,IAA0D,EAC1D;IACA,MAAMC,EAAE,GAAGJ,MAAM,CAACE,IAAI,CAAC;IACvBF,MAAM,CAACE,IAAI,CAAC,GAAGE,EAAE,GACb,UAAUC,IAAI,EAAEC,MAAM,EAAEC,KAAK,EAAE;MAC7B,MAAMC,MAAM,GAAGJ,EAAE,CAACC,IAAI,EAAEC,MAAM,EAAEC,KAAK,CAAC;MAEtC,OAAOC,MAAM,IAAI,IAAI,GAAGL,IAAI,CAACE,IAAI,EAAEC,MAAM,EAAEC,KAAK,CAAC,GAAGC,MAAM;IAC5D,CAAC,GACDL,IAAI;EACV;EAEA,KAAK,MAAMD,IAAI,IAAIO,MAAM,CAACC,IAAI,CAACX,GAAG,CAAC,EAAE;IACnC,MAAMY,OAAO,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AO,KAAK;AACd;AAEO,SAASuB,qBAAqB,CAACpB,IAAY,EAAEC,MAAc,EAAE;EAClE,OAAOgB,eAAe,CAACjB,IAAI,EAAEC,MAAM,EAAE,CAAC,CAAC;AACzC;AAEO,SAASoB,oBAAoB,CAACrB,IAAY,EAAEC,MAAc,EAAE;EACjE,OAAOgB,eAAe,CAACjB,IAAI,EAAEC,MAAM,EAAE,CAAC,CAAC;AACzC;AAEO,SAASqB,WAAW,CACzBtB,IAAY,EACZC,MAAc,EACda,UAAqB,EACrB;EACA,IAAI,CAACb,MAAM,EAAE,OAAO,KAAK;EAEzB,IAAIT,eAAe,CAACS,MAAM,CAAC,IAAIA,MAAM,CAACsB,MAAM,KAAKvB,IAAI,EAAE;IACrD,IAAIe,qBAAqB,CAACf,IAAI,CAAC,EAAE,OAAO,IAAI;EAC9C;EAEA,OAAOa,IAAI,CAACL,cAAc,EAAER,IAAI,EAAEC,MAAM,EAAEa,UAAU,CAAC;AACvD"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/node/parentheses.js b/node_modules/@babel/generator/lib/node/parentheses.js index 616797a95..72e6d388b 100644 --- a/node_modules/@babel/generator/lib/node/parentheses.js +++ b/node_modules/@babel/generator/lib/node/parentheses.js @@ -19,18 +19,15 @@ exports.ObjectExpression = ObjectExpression; exports.OptionalIndexedAccessType = OptionalIndexedAccessType; exports.OptionalCallExpression = exports.OptionalMemberExpression = OptionalMemberExpression; exports.SequenceExpression = SequenceExpression; -exports.TSAsExpression = TSAsExpression; +exports.TSTypeAssertion = exports.TSSatisfiesExpression = exports.TSAsExpression = TSAsExpression; exports.TSInferType = TSInferType; exports.TSInstantiationExpression = TSInstantiationExpression; -exports.TSTypeAssertion = TSTypeAssertion; exports.TSIntersectionType = exports.TSUnionType = TSUnionType; exports.UnaryLike = UnaryLike; exports.IntersectionTypeAnnotation = exports.UnionTypeAnnotation = UnionTypeAnnotation; exports.UpdateExpression = UpdateExpression; exports.AwaitExpression = exports.YieldExpression = YieldExpression; - var _t = require("@babel/types"); - const { isArrayTypeAnnotation, isArrowFunctionExpression, @@ -81,7 +78,8 @@ const { isUnionTypeAnnotation, isVariableDeclarator, isWhileStatement, - isYieldExpression + isYieldExpression, + isTSSatisfiesExpression } = _t; const PRECEDENCE = { "||": 0, @@ -111,136 +109,112 @@ const PRECEDENCE = { "%": 9, "**": 10 }; - const isClassExtendsClause = (node, parent) => isClass(parent, { superClass: node }); - const hasPostfixPart = (node, parent) => (isMemberExpression(parent) || isOptionalMemberExpression(parent)) && parent.object === node || (isCallExpression(parent) || isOptionalCallExpression(parent) || isNewExpression(parent)) && parent.callee === node || isTaggedTemplateExpression(parent) && parent.tag === node || isTSNonNullExpression(parent); - function NullableTypeAnnotation(node, parent) { return isArrayTypeAnnotation(parent); } - function FunctionTypeAnnotation(node, parent, printStack) { if (printStack.length < 3) return; - return isUnionTypeAnnotation(parent) || isIntersectionTypeAnnotation(parent) || isArrayTypeAnnotation(parent) || isTypeAnnotation(parent) && isArrowFunctionExpression(printStack[printStack.length - 3]); + return ( + isUnionTypeAnnotation(parent) || + isIntersectionTypeAnnotation(parent) || + isArrayTypeAnnotation(parent) || + isTypeAnnotation(parent) && + isArrowFunctionExpression(printStack[printStack.length - 3]) + ); } - function UpdateExpression(node, parent) { return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent); } - function ObjectExpression(node, parent, printStack) { return isFirstInContext(printStack, 1 | 2); } - function DoExpression(node, parent, printStack) { return !node.async && isFirstInContext(printStack, 1); } - function Binary(node, parent) { if (node.operator === "**" && isBinaryExpression(parent, { operator: "**" })) { return parent.left === node; } - if (isClassExtendsClause(node, parent)) { return true; } - if (hasPostfixPart(node, parent) || isUnaryLike(parent) || isAwaitExpression(parent)) { return true; } - if (isBinary(parent)) { const parentOp = parent.operator; const parentPos = PRECEDENCE[parentOp]; const nodeOp = node.operator; const nodePos = PRECEDENCE[nodeOp]; - - if (parentPos === nodePos && parent.right === node && !isLogicalExpression(parent) || parentPos > nodePos) { + if ( + parentPos === nodePos && parent.right === node && !isLogicalExpression(parent) || parentPos > nodePos) { return true; } } } - function UnionTypeAnnotation(node, parent) { return isArrayTypeAnnotation(parent) || isNullableTypeAnnotation(parent) || isIntersectionTypeAnnotation(parent) || isUnionTypeAnnotation(parent); } - function OptionalIndexedAccessType(node, parent) { return isIndexedAccessType(parent, { objectType: node }); } - function TSAsExpression() { return true; } - -function TSTypeAssertion() { - return true; -} - function TSUnionType(node, parent) { return isTSArrayType(parent) || isTSOptionalType(parent) || isTSIntersectionType(parent) || isTSUnionType(parent) || isTSRestType(parent); } - function TSInferType(node, parent) { return isTSArrayType(parent) || isTSOptionalType(parent); } - function TSInstantiationExpression(node, parent) { return (isCallExpression(parent) || isOptionalCallExpression(parent) || isNewExpression(parent) || isTSInstantiationExpression(parent)) && !!parent.typeParameters; } - function BinaryExpression(node, parent) { return node.operator === "in" && (isVariableDeclarator(parent) || isFor(parent)); } - function SequenceExpression(node, parent) { - if (isForStatement(parent) || isThrowStatement(parent) || isReturnStatement(parent) || isIfStatement(parent) && parent.test === node || isWhileStatement(parent) && parent.test === node || isForInStatement(parent) && parent.right === node || isSwitchStatement(parent) && parent.discriminant === node || isExpressionStatement(parent) && parent.expression === node) { + if ( + isForStatement(parent) || isThrowStatement(parent) || isReturnStatement(parent) || isIfStatement(parent) && parent.test === node || isWhileStatement(parent) && parent.test === node || isForInStatement(parent) && parent.right === node || isSwitchStatement(parent) && parent.discriminant === node || isExpressionStatement(parent) && parent.expression === node) { return false; } return true; } - function YieldExpression(node, parent) { return isBinary(parent) || isUnaryLike(parent) || hasPostfixPart(node, parent) || isAwaitExpression(parent) && isYieldExpression(node) || isConditionalExpression(parent) && node === parent.test || isClassExtendsClause(node, parent); } - function ClassExpression(node, parent, printStack) { return isFirstInContext(printStack, 1 | 4); } - function UnaryLike(node, parent) { return hasPostfixPart(node, parent) || isBinaryExpression(parent, { operator: "**", left: node }) || isClassExtendsClause(node, parent); } - function FunctionExpression(node, parent, printStack) { return isFirstInContext(printStack, 1 | 4); } - function ArrowFunctionExpression(node, parent) { return isExportDeclaration(parent) || ConditionalExpression(node, parent); } - function ConditionalExpression(node, parent) { if (isUnaryLike(parent) || isBinary(parent) || isConditionalExpression(parent, { test: node - }) || isAwaitExpression(parent) || isTSTypeAssertion(parent) || isTSAsExpression(parent)) { + }) || isAwaitExpression(parent) || isTSTypeAssertion(parent) || isTSAsExpression(parent) || isTSSatisfiesExpression(parent)) { return true; } - return UnaryLike(node, parent); } - function OptionalMemberExpression(node, parent) { return isCallExpression(parent, { callee: node @@ -248,7 +222,6 @@ function OptionalMemberExpression(node, parent) { object: node }); } - function AssignmentExpression(node, parent) { if (isObjectPattern(node.left)) { return true; @@ -256,32 +229,26 @@ function AssignmentExpression(node, parent) { return ConditionalExpression(node, parent); } } - function LogicalExpression(node, parent) { switch (node.operator) { case "||": if (!isLogicalExpression(parent)) return false; return parent.operator === "??" || parent.operator === "&&"; - case "&&": return isLogicalExpression(parent, { operator: "??" }); - case "??": return isLogicalExpression(parent) && parent.operator !== "??"; } } - function Identifier(node, parent, printStack) { var _node$extra; - if ((_node$extra = node.extra) != null && _node$extra.parenthesized && isAssignmentExpression(parent, { left: node }) && (isFunctionExpression(parent.right) || isClassExpression(parent.right)) && parent.right.id == null) { return true; } - if (node.name === "let") { const isFollowedByBracket = isMemberExpression(parent, { object: node, @@ -309,7 +276,6 @@ function isFirstInContext(printStack, checkParam) { let node = printStack[i]; i--; let parent = printStack[i]; - while (i >= 0) { if (expressionStatement && isExpressionStatement(parent, { expression: node @@ -326,7 +292,6 @@ function isFirstInContext(printStack, checkParam) { })) { return true; } - if (i > 0 && (hasPostfixPart(node, parent) && !isNewExpression(parent) || isSequenceExpression(parent) && parent.expressions[0] === node || isUpdateExpression(parent) && !parent.prefix || isConditional(parent, { test: node }) || isBinary(parent, { @@ -341,7 +306,6 @@ function isFirstInContext(printStack, checkParam) { return false; } } - return false; } diff --git a/node_modules/@babel/generator/lib/node/parentheses.js.map b/node_modules/@babel/generator/lib/node/parentheses.js.map index c743488b7..fc6386843 100644 --- a/node_modules/@babel/generator/lib/node/parentheses.js.map +++ b/node_modules/@babel/generator/lib/node/parentheses.js.map @@ -1 +1 @@ -{"version":3,"names":["isArrayTypeAnnotation","isArrowFunctionExpression","isAssignmentExpression","isAwaitExpression","isBinary","isBinaryExpression","isUpdateExpression","isCallExpression","isClass","isClassExpression","isConditional","isConditionalExpression","isExportDeclaration","isExportDefaultDeclaration","isExpressionStatement","isFor","isForInStatement","isForOfStatement","isForStatement","isFunctionExpression","isIfStatement","isIndexedAccessType","isIntersectionTypeAnnotation","isLogicalExpression","isMemberExpression","isNewExpression","isNullableTypeAnnotation","isObjectPattern","isOptionalCallExpression","isOptionalMemberExpression","isReturnStatement","isSequenceExpression","isSwitchStatement","isTSArrayType","isTSAsExpression","isTSInstantiationExpression","isTSIntersectionType","isTSNonNullExpression","isTSOptionalType","isTSRestType","isTSTypeAssertion","isTSUnionType","isTaggedTemplateExpression","isThrowStatement","isTypeAnnotation","isUnaryLike","isUnionTypeAnnotation","isVariableDeclarator","isWhileStatement","isYieldExpression","PRECEDENCE","in","instanceof","isClassExtendsClause","node","parent","superClass","hasPostfixPart","object","callee","tag","NullableTypeAnnotation","FunctionTypeAnnotation","printStack","length","UpdateExpression","ObjectExpression","isFirstInContext","DoExpression","async","Binary","operator","left","parentOp","parentPos","nodeOp","nodePos","right","UnionTypeAnnotation","OptionalIndexedAccessType","objectType","TSAsExpression","TSTypeAssertion","TSUnionType","TSInferType","TSInstantiationExpression","typeParameters","BinaryExpression","SequenceExpression","test","discriminant","expression","YieldExpression","ClassExpression","UnaryLike","FunctionExpression","ArrowFunctionExpression","ConditionalExpression","OptionalMemberExpression","AssignmentExpression","LogicalExpression","Identifier","extra","parenthesized","id","name","isFollowedByBracket","computed","optional","checkParam","expressionStatement","arrowBody","exportDefault","forHead","forInHead","forOfHead","i","declaration","body","init","expressions","prefix"],"sources":["../../src/node/parentheses.ts"],"sourcesContent":["import {\n isArrayTypeAnnotation,\n isArrowFunctionExpression,\n isAssignmentExpression,\n isAwaitExpression,\n isBinary,\n isBinaryExpression,\n isUpdateExpression,\n isCallExpression,\n isClass,\n isClassExpression,\n isConditional,\n isConditionalExpression,\n isExportDeclaration,\n isExportDefaultDeclaration,\n isExpressionStatement,\n isFor,\n isForInStatement,\n isForOfStatement,\n isForStatement,\n isFunctionExpression,\n isIfStatement,\n isIndexedAccessType,\n isIntersectionTypeAnnotation,\n isLogicalExpression,\n isMemberExpression,\n isNewExpression,\n isNullableTypeAnnotation,\n isObjectPattern,\n isOptionalCallExpression,\n isOptionalMemberExpression,\n isReturnStatement,\n isSequenceExpression,\n isSwitchStatement,\n isTSArrayType,\n isTSAsExpression,\n isTSInstantiationExpression,\n isTSIntersectionType,\n isTSNonNullExpression,\n isTSOptionalType,\n isTSRestType,\n isTSTypeAssertion,\n isTSUnionType,\n isTaggedTemplateExpression,\n isThrowStatement,\n isTypeAnnotation,\n isUnaryLike,\n isUnionTypeAnnotation,\n isVariableDeclarator,\n isWhileStatement,\n isYieldExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nconst PRECEDENCE = {\n \"||\": 0,\n \"??\": 0,\n \"|>\": 0,\n \"&&\": 1,\n \"|\": 2,\n \"^\": 3,\n \"&\": 4,\n \"==\": 5,\n \"===\": 5,\n \"!=\": 5,\n \"!==\": 5,\n \"<\": 6,\n \">\": 6,\n \"<=\": 6,\n \">=\": 6,\n in: 6,\n instanceof: 6,\n \">>\": 7,\n \"<<\": 7,\n \">>>\": 7,\n \"+\": 8,\n \"-\": 8,\n \"*\": 9,\n \"/\": 9,\n \"%\": 9,\n \"**\": 10,\n};\n\nconst enum CheckParam {\n expressionStatement = 1 << 0,\n arrowBody = 1 << 1,\n exportDefault = 1 << 2,\n forHead = 1 << 3,\n forInHead = 1 << 4,\n forOfHead = 1 << 5,\n}\n\nconst isClassExtendsClause = (\n node: t.Node,\n parent: t.Node,\n): parent is t.Class => isClass(parent, { superClass: node });\n\nconst hasPostfixPart = (node: t.Node, parent: t.Node) =>\n ((isMemberExpression(parent) || isOptionalMemberExpression(parent)) &&\n parent.object === node) ||\n ((isCallExpression(parent) ||\n isOptionalCallExpression(parent) ||\n isNewExpression(parent)) &&\n parent.callee === node) ||\n (isTaggedTemplateExpression(parent) && parent.tag === node) ||\n isTSNonNullExpression(parent);\n\nexport function NullableTypeAnnotation(\n node: t.NullableTypeAnnotation,\n parent: t.Node,\n): boolean {\n return isArrayTypeAnnotation(parent);\n}\n\nexport function FunctionTypeAnnotation(\n node: t.FunctionTypeAnnotation,\n parent: t.Node,\n printStack: Array,\n): boolean {\n if (printStack.length < 3) return;\n\n return (\n // (() => A) | (() => B)\n isUnionTypeAnnotation(parent) ||\n // (() => A) & (() => B)\n isIntersectionTypeAnnotation(parent) ||\n // (() => A)[]\n isArrayTypeAnnotation(parent) ||\n // (A: T): (T => T[]) => B => [A, B]\n (isTypeAnnotation(parent) &&\n // Check grandparent\n isArrowFunctionExpression(printStack[printStack.length - 3]))\n );\n}\n\nexport function UpdateExpression(\n node: t.UpdateExpression,\n parent: t.Node,\n): boolean {\n return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent);\n}\n\nexport function ObjectExpression(\n node: t.ObjectExpression,\n parent: t.Node,\n printStack: Array,\n): boolean {\n return isFirstInContext(\n printStack,\n CheckParam.expressionStatement | CheckParam.arrowBody,\n );\n}\n\nexport function DoExpression(\n node: t.DoExpression,\n parent: t.Node,\n printStack: Array,\n): boolean {\n // `async do` can start an expression statement\n return (\n !node.async && isFirstInContext(printStack, CheckParam.expressionStatement)\n );\n}\n\nexport function Binary(node: t.BinaryExpression, parent: t.Node): boolean {\n if (\n node.operator === \"**\" &&\n isBinaryExpression(parent, { operator: \"**\" })\n ) {\n return parent.left === node;\n }\n\n if (isClassExtendsClause(node, parent)) {\n return true;\n }\n\n if (\n hasPostfixPart(node, parent) ||\n isUnaryLike(parent) ||\n isAwaitExpression(parent)\n ) {\n return true;\n }\n\n if (isBinary(parent)) {\n const parentOp = parent.operator;\n const parentPos = PRECEDENCE[parentOp];\n\n const nodeOp = node.operator;\n const nodePos = PRECEDENCE[nodeOp];\n\n if (\n // Logical expressions with the same precedence don't need parens.\n (parentPos === nodePos &&\n parent.right === node &&\n !isLogicalExpression(parent)) ||\n parentPos > nodePos\n ) {\n return true;\n }\n }\n}\n\nexport function UnionTypeAnnotation(\n node: t.UnionTypeAnnotation,\n parent: t.Node,\n): boolean {\n return (\n isArrayTypeAnnotation(parent) ||\n isNullableTypeAnnotation(parent) ||\n isIntersectionTypeAnnotation(parent) ||\n isUnionTypeAnnotation(parent)\n );\n}\n\nexport { UnionTypeAnnotation as IntersectionTypeAnnotation };\n\nexport function OptionalIndexedAccessType(\n node: t.OptionalIndexedAccessType,\n parent: t.Node,\n): boolean {\n return isIndexedAccessType(parent, { objectType: node });\n}\n\nexport function TSAsExpression() {\n return true;\n}\n\nexport function TSTypeAssertion() {\n return true;\n}\n\nexport function TSUnionType(node: t.TSUnionType, parent: t.Node): boolean {\n return (\n isTSArrayType(parent) ||\n isTSOptionalType(parent) ||\n isTSIntersectionType(parent) ||\n isTSUnionType(parent) ||\n isTSRestType(parent)\n );\n}\n\nexport { TSUnionType as TSIntersectionType };\n\nexport function TSInferType(node: t.TSInferType, parent: t.Node): boolean {\n return isTSArrayType(parent) || isTSOptionalType(parent);\n}\n\nexport function TSInstantiationExpression(\n node: t.TSInstantiationExpression,\n parent: t.Node,\n) {\n return (\n (isCallExpression(parent) ||\n isOptionalCallExpression(parent) ||\n isNewExpression(parent) ||\n isTSInstantiationExpression(parent)) &&\n !!parent.typeParameters\n );\n}\n\nexport function BinaryExpression(\n node: t.BinaryExpression,\n parent: t.Node,\n): boolean {\n // let i = (1 in []);\n // for ((1 in []);;);\n return (\n node.operator === \"in\" && (isVariableDeclarator(parent) || isFor(parent))\n );\n}\n\nexport function SequenceExpression(\n node: t.SequenceExpression,\n parent: t.Node,\n): boolean {\n if (\n // Although parentheses wouldn\"t hurt around sequence\n // expressions in the head of for loops, traditional style\n // dictates that e.g. i++, j++ should not be wrapped with\n // parentheses.\n isForStatement(parent) ||\n isThrowStatement(parent) ||\n isReturnStatement(parent) ||\n (isIfStatement(parent) && parent.test === node) ||\n (isWhileStatement(parent) && parent.test === node) ||\n (isForInStatement(parent) && parent.right === node) ||\n (isSwitchStatement(parent) && parent.discriminant === node) ||\n (isExpressionStatement(parent) && parent.expression === node)\n ) {\n return false;\n }\n\n // Otherwise err on the side of overparenthesization, adding\n // explicit exceptions above if this proves overzealous.\n return true;\n}\n\nexport function YieldExpression(\n node: t.YieldExpression,\n parent: t.Node,\n): boolean {\n return (\n isBinary(parent) ||\n isUnaryLike(parent) ||\n hasPostfixPart(node, parent) ||\n (isAwaitExpression(parent) && isYieldExpression(node)) ||\n (isConditionalExpression(parent) && node === parent.test) ||\n isClassExtendsClause(node, parent)\n );\n}\n\nexport { YieldExpression as AwaitExpression };\n\nexport function ClassExpression(\n node: t.ClassExpression,\n parent: t.Node,\n printStack: Array,\n): boolean {\n return isFirstInContext(\n printStack,\n CheckParam.expressionStatement | CheckParam.exportDefault,\n );\n}\n\nexport function UnaryLike(\n node:\n | t.UnaryLike\n | t.ArrowFunctionExpression\n | t.ConditionalExpression\n | t.AssignmentExpression,\n parent: t.Node,\n): boolean {\n return (\n hasPostfixPart(node, parent) ||\n isBinaryExpression(parent, { operator: \"**\", left: node }) ||\n isClassExtendsClause(node, parent)\n );\n}\n\nexport function FunctionExpression(\n node: t.FunctionExpression,\n parent: t.Node,\n printStack: Array,\n): boolean {\n return isFirstInContext(\n printStack,\n CheckParam.expressionStatement | CheckParam.exportDefault,\n );\n}\n\nexport function ArrowFunctionExpression(\n node: t.ArrowFunctionExpression,\n parent: t.Node,\n): boolean {\n return isExportDeclaration(parent) || ConditionalExpression(node, parent);\n}\n\nexport function ConditionalExpression(\n node:\n | t.ConditionalExpression\n | t.ArrowFunctionExpression\n | t.AssignmentExpression,\n parent?: t.Node,\n): boolean {\n if (\n isUnaryLike(parent) ||\n isBinary(parent) ||\n isConditionalExpression(parent, { test: node }) ||\n isAwaitExpression(parent) ||\n isTSTypeAssertion(parent) ||\n isTSAsExpression(parent)\n ) {\n return true;\n }\n\n return UnaryLike(node, parent);\n}\n\nexport function OptionalMemberExpression(\n node: t.OptionalMemberExpression,\n parent: t.Node,\n): boolean {\n return (\n isCallExpression(parent, { callee: node }) ||\n isMemberExpression(parent, { object: node })\n );\n}\n\nexport { OptionalMemberExpression as OptionalCallExpression };\n\nexport function AssignmentExpression(\n node: t.AssignmentExpression,\n parent: t.Node,\n): boolean {\n if (isObjectPattern(node.left)) {\n return true;\n } else {\n return ConditionalExpression(node, parent);\n }\n}\n\nexport function LogicalExpression(\n node: t.LogicalExpression,\n parent: t.Node,\n): boolean {\n switch (node.operator) {\n case \"||\":\n if (!isLogicalExpression(parent)) return false;\n return parent.operator === \"??\" || parent.operator === \"&&\";\n case \"&&\":\n return isLogicalExpression(parent, { operator: \"??\" });\n case \"??\":\n return isLogicalExpression(parent) && parent.operator !== \"??\";\n }\n}\n\nexport function Identifier(\n node: t.Identifier,\n parent: t.Node,\n printStack: Array,\n): boolean {\n // 13.15.2 AssignmentExpression RS: Evaluation\n // (fn) = function () {};\n if (\n node.extra?.parenthesized &&\n isAssignmentExpression(parent, { left: node }) &&\n (isFunctionExpression(parent.right) || isClassExpression(parent.right)) &&\n parent.right.id == null\n ) {\n return true;\n }\n // Non-strict code allows the identifier `let`, but it cannot occur as-is in\n // certain contexts to avoid ambiguity with contextual keyword `let`.\n if (node.name === \"let\") {\n // Some contexts only forbid `let [`, so check if the next token would\n // be the left bracket of a computed member expression.\n const isFollowedByBracket =\n isMemberExpression(parent, {\n object: node,\n computed: true,\n }) ||\n isOptionalMemberExpression(parent, {\n object: node,\n computed: true,\n optional: false,\n });\n return isFirstInContext(\n printStack,\n isFollowedByBracket\n ? CheckParam.expressionStatement |\n CheckParam.forHead |\n CheckParam.forInHead |\n CheckParam.forOfHead\n : CheckParam.forOfHead,\n );\n }\n\n // ECMAScript specifically forbids a for-of loop from starting with the\n // token sequence `for (async of`, because it would be ambiguous with\n // `for (async of => {};;)`, so we need to add extra parentheses.\n //\n // If the parent is a for-await-of loop (i.e. parent.await === true), the\n // parentheses aren't strictly needed, but we add them anyway because\n // some tools (including earlier Babel versions) can't parse\n // `for await (async of [])` without them.\n return (\n node.name === \"async\" && isForOfStatement(parent) && node === parent.left\n );\n}\n\n// Walk up the print stack to determine if our node can come first\n// in a particular context.\nfunction isFirstInContext(\n printStack: Array,\n checkParam: CheckParam,\n): boolean {\n const expressionStatement = checkParam & CheckParam.expressionStatement;\n const arrowBody = checkParam & CheckParam.arrowBody;\n const exportDefault = checkParam & CheckParam.exportDefault;\n const forHead = checkParam & CheckParam.forHead;\n const forInHead = checkParam & CheckParam.forInHead;\n const forOfHead = checkParam & CheckParam.forOfHead;\n\n let i = printStack.length - 1;\n if (i <= 0) return;\n let node = printStack[i];\n i--;\n let parent = printStack[i];\n while (i >= 0) {\n if (\n (expressionStatement &&\n isExpressionStatement(parent, { expression: node })) ||\n (exportDefault &&\n isExportDefaultDeclaration(parent, { declaration: node })) ||\n (arrowBody && isArrowFunctionExpression(parent, { body: node })) ||\n (forHead && isForStatement(parent, { init: node })) ||\n (forInHead && isForInStatement(parent, { left: node })) ||\n (forOfHead && isForOfStatement(parent, { left: node }))\n ) {\n return true;\n }\n\n if (\n i > 0 &&\n ((hasPostfixPart(node, parent) && !isNewExpression(parent)) ||\n (isSequenceExpression(parent) && parent.expressions[0] === node) ||\n (isUpdateExpression(parent) && !parent.prefix) ||\n isConditional(parent, { test: node }) ||\n isBinary(parent, { left: node }) ||\n isAssignmentExpression(parent, { left: node }))\n ) {\n node = parent;\n i--;\n parent = printStack[i];\n } else {\n return false;\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;EACEA,qB;EACAC,yB;EACAC,sB;EACAC,iB;EACAC,Q;EACAC,kB;EACAC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AEkC,IAAI,EAAEnC;IAAR,CAAT,CAHd,IAIClD,QAAQ,CAACmD,MAAD,EAAS;MAAEiB,IAAI,EAAElB;IAAR,CAAT,CAJT,IAKCpD,sBAAsB,CAACqD,MAAD,EAAS;MAAEiB,IAAI,EAAElB;IAAR,CAAT,CANxB,CADF,EAQE;MACAA,IAAI,GAAGC,MAAP;MACA6D,CAAC;MACD7D,MAAM,GAAGQ,UAAU,CAACqD,CAAD,CAAnB;IACD,CAZD,MAYO;MACL,OAAO,KAAP;IACD;EACF;;EAED,OAAO,KAAP;AACD"} \ No newline at end of file +{"version":3,"names":["isArrayTypeAnnotation","isArrowFunctionExpression","isAssignmentExpression","isAwaitExpression","isBinary","isBinaryExpression","isUpdateExpression","isCallExpression","isClass","isClassExpression","isConditional","isConditionalExpression","isExportDeclaration","isExportDefaultDeclaration","isExpressionStatement","isFor","isForInStatement","isForOfStatement","isForStatement","isFunctionExpression","isIfStatement","isIndexedAccessType","isIntersectionTypeAnnotation","isLogicalExpression","isMemberExpression","isNewExpression","isNullableTypeAnnotation","isObjectPattern","isOptionalCallExpression","isOptionalMemberExpression","isReturnStatement","isSequenceExpression","isSwitchStatement","isTSArrayType","isTSAsExpression","isTSInstantiationExpression","isTSIntersectionType","isTSNonNullExpression","isTSOptionalType","isTSRestType","isTSTypeAssertion","isTSUnionType","isTaggedTemplateExpression","isThrowStatement","isTypeAnnotation","isUnaryLike","isUnionTypeAnnotation","isVariableDeclarator","isWhileStatement","isYieldExpression","isTSSatisfiesExpression","PRECEDENCE","in","instanceof","isClassExtendsClause","node","parent","superClass","hasPostfixPart","object","callee","tag","NullableTypeAnnotation","FunctionTypeAnnotation","printStack","length","UpdateExpression","ObjectExpression","isFirstInContext","DoExpression","async","Binary","operator","left","parentOp","parentPos","nodeOp","nodePos","right","UnionTypeAnnotation","OptionalIndexedAccessType","objectType","TSAsExpression","TSUnionType","TSInferType","TSInstantiationExpression","typeParameters","BinaryExpression","SequenceExpression","test","discriminant","expression","YieldExpression","ClassExpression","UnaryLike","FunctionExpression","ArrowFunctionExpression","ConditionalExpression","OptionalMemberExpression","AssignmentExpression","LogicalExpression","Identifier","extra","parenthesized","id","name","isFollowedByBracket","computed","optional","checkParam","expressionStatement","arrowBody","exportDefault","forHead","forInHead","forOfHead","i","declaration","body","init","expressions","prefix"],"sources":["../../src/node/parentheses.ts"],"sourcesContent":["import {\n isArrayTypeAnnotation,\n isArrowFunctionExpression,\n isAssignmentExpression,\n isAwaitExpression,\n isBinary,\n isBinaryExpression,\n isUpdateExpression,\n isCallExpression,\n isClass,\n isClassExpression,\n isConditional,\n isConditionalExpression,\n isExportDeclaration,\n isExportDefaultDeclaration,\n isExpressionStatement,\n isFor,\n isForInStatement,\n isForOfStatement,\n isForStatement,\n isFunctionExpression,\n isIfStatement,\n isIndexedAccessType,\n isIntersectionTypeAnnotation,\n isLogicalExpression,\n isMemberExpression,\n isNewExpression,\n isNullableTypeAnnotation,\n isObjectPattern,\n isOptionalCallExpression,\n isOptionalMemberExpression,\n isReturnStatement,\n isSequenceExpression,\n isSwitchStatement,\n isTSArrayType,\n isTSAsExpression,\n isTSInstantiationExpression,\n isTSIntersectionType,\n isTSNonNullExpression,\n isTSOptionalType,\n isTSRestType,\n isTSTypeAssertion,\n isTSUnionType,\n isTaggedTemplateExpression,\n isThrowStatement,\n isTypeAnnotation,\n isUnaryLike,\n isUnionTypeAnnotation,\n isVariableDeclarator,\n isWhileStatement,\n isYieldExpression,\n isTSSatisfiesExpression,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nconst PRECEDENCE = {\n \"||\": 0,\n \"??\": 0,\n \"|>\": 0,\n \"&&\": 1,\n \"|\": 2,\n \"^\": 3,\n \"&\": 4,\n \"==\": 5,\n \"===\": 5,\n \"!=\": 5,\n \"!==\": 5,\n \"<\": 6,\n \">\": 6,\n \"<=\": 6,\n \">=\": 6,\n in: 6,\n instanceof: 6,\n \">>\": 7,\n \"<<\": 7,\n \">>>\": 7,\n \"+\": 8,\n \"-\": 8,\n \"*\": 9,\n \"/\": 9,\n \"%\": 9,\n \"**\": 10,\n};\n\nconst enum CheckParam {\n expressionStatement = 1 << 0,\n arrowBody = 1 << 1,\n exportDefault = 1 << 2,\n forHead = 1 << 3,\n forInHead = 1 << 4,\n forOfHead = 1 << 5,\n}\n\nconst isClassExtendsClause = (\n node: t.Node,\n parent: t.Node,\n): parent is t.Class => isClass(parent, { superClass: node });\n\nconst hasPostfixPart = (node: t.Node, parent: t.Node) =>\n ((isMemberExpression(parent) || isOptionalMemberExpression(parent)) &&\n parent.object === node) ||\n ((isCallExpression(parent) ||\n isOptionalCallExpression(parent) ||\n isNewExpression(parent)) &&\n parent.callee === node) ||\n (isTaggedTemplateExpression(parent) && parent.tag === node) ||\n isTSNonNullExpression(parent);\n\nexport function NullableTypeAnnotation(\n node: t.NullableTypeAnnotation,\n parent: t.Node,\n): boolean {\n return isArrayTypeAnnotation(parent);\n}\n\nexport function FunctionTypeAnnotation(\n node: t.FunctionTypeAnnotation,\n parent: t.Node,\n printStack: Array,\n): boolean {\n if (printStack.length < 3) return;\n\n return (\n // (() => A) | (() => B)\n isUnionTypeAnnotation(parent) ||\n // (() => A) & (() => B)\n isIntersectionTypeAnnotation(parent) ||\n // (() => A)[]\n isArrayTypeAnnotation(parent) ||\n // (A: T): (T => T[]) => B => [A, B]\n (isTypeAnnotation(parent) &&\n // Check grandparent\n isArrowFunctionExpression(printStack[printStack.length - 3]))\n );\n}\n\nexport function UpdateExpression(\n node: t.UpdateExpression,\n parent: t.Node,\n): boolean {\n return hasPostfixPart(node, parent) || isClassExtendsClause(node, parent);\n}\n\nexport function ObjectExpression(\n node: t.ObjectExpression,\n parent: t.Node,\n printStack: Array,\n): boolean {\n return isFirstInContext(\n printStack,\n CheckParam.expressionStatement | CheckParam.arrowBody,\n );\n}\n\nexport function DoExpression(\n node: t.DoExpression,\n parent: t.Node,\n printStack: Array,\n): boolean {\n // `async do` can start an expression statement\n return (\n !node.async && isFirstInContext(printStack, CheckParam.expressionStatement)\n );\n}\n\nexport function Binary(node: t.BinaryExpression, parent: t.Node): boolean {\n if (\n node.operator === \"**\" &&\n isBinaryExpression(parent, { operator: \"**\" })\n ) {\n return parent.left === node;\n }\n\n if (isClassExtendsClause(node, parent)) {\n return true;\n }\n\n if (\n hasPostfixPart(node, parent) ||\n isUnaryLike(parent) ||\n isAwaitExpression(parent)\n ) {\n return true;\n }\n\n if (isBinary(parent)) {\n const parentOp = parent.operator;\n const parentPos = PRECEDENCE[parentOp];\n\n const nodeOp = node.operator;\n const nodePos = PRECEDENCE[nodeOp];\n\n if (\n // Logical expressions with the same precedence don't need parens.\n (parentPos === nodePos &&\n parent.right === node &&\n !isLogicalExpression(parent)) ||\n parentPos > nodePos\n ) {\n return true;\n }\n }\n}\n\nexport function UnionTypeAnnotation(\n node: t.UnionTypeAnnotation,\n parent: t.Node,\n): boolean {\n return (\n isArrayTypeAnnotation(parent) ||\n isNullableTypeAnnotation(parent) ||\n isIntersectionTypeAnnotation(parent) ||\n isUnionTypeAnnotation(parent)\n );\n}\n\nexport { UnionTypeAnnotation as IntersectionTypeAnnotation };\n\nexport function OptionalIndexedAccessType(\n node: t.OptionalIndexedAccessType,\n parent: t.Node,\n): boolean {\n return isIndexedAccessType(parent, { objectType: node });\n}\n\nexport function TSAsExpression() {\n return true;\n}\n\nexport {\n TSAsExpression as TSSatisfiesExpression,\n TSAsExpression as TSTypeAssertion,\n};\n\nexport function TSUnionType(node: t.TSUnionType, parent: t.Node): boolean {\n return (\n isTSArrayType(parent) ||\n isTSOptionalType(parent) ||\n isTSIntersectionType(parent) ||\n isTSUnionType(parent) ||\n isTSRestType(parent)\n );\n}\n\nexport { TSUnionType as TSIntersectionType };\n\nexport function TSInferType(node: t.TSInferType, parent: t.Node): boolean {\n return isTSArrayType(parent) || isTSOptionalType(parent);\n}\n\nexport function TSInstantiationExpression(\n node: t.TSInstantiationExpression,\n parent: t.Node,\n) {\n return (\n (isCallExpression(parent) ||\n isOptionalCallExpression(parent) ||\n isNewExpression(parent) ||\n isTSInstantiationExpression(parent)) &&\n !!parent.typeParameters\n );\n}\n\nexport function BinaryExpression(\n node: t.BinaryExpression,\n parent: t.Node,\n): boolean {\n // let i = (1 in []);\n // for ((1 in []);;);\n return (\n node.operator === \"in\" && (isVariableDeclarator(parent) || isFor(parent))\n );\n}\n\nexport function SequenceExpression(\n node: t.SequenceExpression,\n parent: t.Node,\n): boolean {\n if (\n // Although parentheses wouldn\"t hurt around sequence\n // expressions in the head of for loops, traditional style\n // dictates that e.g. i++, j++ should not be wrapped with\n // parentheses.\n isForStatement(parent) ||\n isThrowStatement(parent) ||\n isReturnStatement(parent) ||\n (isIfStatement(parent) && parent.test === node) ||\n (isWhileStatement(parent) && parent.test === node) ||\n (isForInStatement(parent) && parent.right === node) ||\n (isSwitchStatement(parent) && parent.discriminant === node) ||\n (isExpressionStatement(parent) && parent.expression === node)\n ) {\n return false;\n }\n\n // Otherwise err on the side of overparenthesization, adding\n // explicit exceptions above if this proves overzealous.\n return true;\n}\n\nexport function YieldExpression(\n node: t.YieldExpression,\n parent: t.Node,\n): boolean {\n return (\n isBinary(parent) ||\n isUnaryLike(parent) ||\n hasPostfixPart(node, parent) ||\n (isAwaitExpression(parent) && isYieldExpression(node)) ||\n (isConditionalExpression(parent) && node === parent.test) ||\n isClassExtendsClause(node, parent)\n );\n}\n\nexport { YieldExpression as AwaitExpression };\n\nexport function ClassExpression(\n node: t.ClassExpression,\n parent: t.Node,\n printStack: Array,\n): boolean {\n return isFirstInContext(\n printStack,\n CheckParam.expressionStatement | CheckParam.exportDefault,\n );\n}\n\nexport function UnaryLike(\n node:\n | t.UnaryLike\n | t.ArrowFunctionExpression\n | t.ConditionalExpression\n | t.AssignmentExpression,\n parent: t.Node,\n): boolean {\n return (\n hasPostfixPart(node, parent) ||\n isBinaryExpression(parent, { operator: \"**\", left: node }) ||\n isClassExtendsClause(node, parent)\n );\n}\n\nexport function FunctionExpression(\n node: t.FunctionExpression,\n parent: t.Node,\n printStack: Array,\n): boolean {\n return isFirstInContext(\n printStack,\n CheckParam.expressionStatement | CheckParam.exportDefault,\n );\n}\n\nexport function ArrowFunctionExpression(\n node: t.ArrowFunctionExpression,\n parent: t.Node,\n): boolean {\n return isExportDeclaration(parent) || ConditionalExpression(node, parent);\n}\n\nexport function ConditionalExpression(\n node:\n | t.ConditionalExpression\n | t.ArrowFunctionExpression\n | t.AssignmentExpression,\n parent?: t.Node,\n): boolean {\n if (\n isUnaryLike(parent) ||\n isBinary(parent) ||\n isConditionalExpression(parent, { test: node }) ||\n isAwaitExpression(parent) ||\n isTSTypeAssertion(parent) ||\n isTSAsExpression(parent) ||\n isTSSatisfiesExpression(parent)\n ) {\n return true;\n }\n\n return UnaryLike(node, parent);\n}\n\nexport function OptionalMemberExpression(\n node: t.OptionalMemberExpression,\n parent: t.Node,\n): boolean {\n return (\n isCallExpression(parent, { callee: node }) ||\n isMemberExpression(parent, { object: node })\n );\n}\n\nexport { OptionalMemberExpression as OptionalCallExpression };\n\nexport function AssignmentExpression(\n node: t.AssignmentExpression,\n parent: t.Node,\n): boolean {\n if (isObjectPattern(node.left)) {\n return true;\n } else {\n return ConditionalExpression(node, parent);\n }\n}\n\nexport function LogicalExpression(\n node: t.LogicalExpression,\n parent: t.Node,\n): boolean {\n switch (node.operator) {\n case \"||\":\n if (!isLogicalExpression(parent)) return false;\n return parent.operator === \"??\" || parent.operator === \"&&\";\n case \"&&\":\n return isLogicalExpression(parent, { operator: \"??\" });\n case \"??\":\n return isLogicalExpression(parent) && parent.operator !== \"??\";\n }\n}\n\nexport function Identifier(\n node: t.Identifier,\n parent: t.Node,\n printStack: Array,\n): boolean {\n // 13.15.2 AssignmentExpression RS: Evaluation\n // (fn) = function () {};\n if (\n node.extra?.parenthesized &&\n isAssignmentExpression(parent, { left: node }) &&\n (isFunctionExpression(parent.right) || isClassExpression(parent.right)) &&\n parent.right.id == null\n ) {\n return true;\n }\n // Non-strict code allows the identifier `let`, but it cannot occur as-is in\n // certain contexts to avoid ambiguity with contextual keyword `let`.\n if (node.name === \"let\") {\n // Some contexts only forbid `let [`, so check if the next token would\n // be the left bracket of a computed member expression.\n const isFollowedByBracket =\n isMemberExpression(parent, {\n object: node,\n computed: true,\n }) ||\n isOptionalMemberExpression(parent, {\n object: node,\n computed: true,\n optional: false,\n });\n return isFirstInContext(\n printStack,\n isFollowedByBracket\n ? CheckParam.expressionStatement |\n CheckParam.forHead |\n CheckParam.forInHead |\n CheckParam.forOfHead\n : CheckParam.forOfHead,\n );\n }\n\n // ECMAScript specifically forbids a for-of loop from starting with the\n // token sequence `for (async of`, because it would be ambiguous with\n // `for (async of => {};;)`, so we need to add extra parentheses.\n //\n // If the parent is a for-await-of loop (i.e. parent.await === true), the\n // parentheses aren't strictly needed, but we add them anyway because\n // some tools (including earlier Babel versions) can't parse\n // `for await (async of [])` without them.\n return (\n node.name === \"async\" && isForOfStatement(parent) && node === parent.left\n );\n}\n\n// Walk up the print stack to determine if our node can come first\n// in a particular context.\nfunction isFirstInContext(\n printStack: Array,\n checkParam: CheckParam,\n): boolean {\n const expressionStatement = checkParam & CheckParam.expressionStatement;\n const arrowBody = checkParam & CheckParam.arrowBody;\n const exportDefault = checkParam & CheckParam.exportDefault;\n const forHead = checkParam & CheckParam.forHead;\n const forInHead = checkParam & CheckParam.forInHead;\n const forOfHead = checkParam & CheckParam.forOfHead;\n\n let i = printStack.length - 1;\n if (i <= 0) return;\n let node = printStack[i];\n i--;\n let parent = printStack[i];\n while (i >= 0) {\n if (\n (expressionStatement &&\n isExpressionStatement(parent, { expression: node })) ||\n (exportDefault &&\n isExportDefaultDeclaration(parent, { declaration: node })) ||\n (arrowBody && isArrowFunctionExpression(parent, { body: node })) ||\n (forHead && isForStatement(parent, { init: node })) ||\n (forInHead && isForInStatement(parent, { left: node })) ||\n (forOfHead && isForOfStatement(parent, { left: node }))\n ) {\n return true;\n }\n\n if (\n i > 0 &&\n ((hasPostfixPart(node, parent) && !isNewExpression(parent)) ||\n (isSequenceExpression(parent) && parent.expressions[0] === node) ||\n (isUpdateExpression(parent) && !parent.prefix) ||\n isConditional(parent, { test: node }) ||\n isBinary(parent, { left: node }) ||\n isAssignmentExpression(parent, { left: node }))\n ) {\n node = parent;\n i--;\n parent = printStack[i];\n } else {\n return false;\n }\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAoDsB;EAnDpBA,qBAAqB;EACrBC,yBAAyB;EACzBC,sBAAsB;EACtBC,iBAAiB;EACjBC,QAAQ;EACRC,kBAAkB;EAClBC,kBAAkB;EAClBC,gBAAgB;EAChBC,OAAO;EACPC,iBAAiB;EACjBC,aAAa;EACbC,uBAAuB;EACvBC,mBAAmB;EACnBC,0BAA0B;EAC1BC,qBAAqB;EACrBC,KAAK;EACLC,gBAAgB;EAChBC,gBAAgB;EAChBC,cAAc;EACdC,oBAAoB;EACpBC,aAAa;EACbC,mBAAmB;EACnBC,4BAA4B;EAC5BC,mBAAmB;EACnBC,kBAAkB;EAClBC,eAAe;EACfC,wBAAwB;EACxBC,eAAe;EACfC,wBAAwB;EACxBC,0BAA0B;EAC1BC,iBAAiB;EACjBC,oBAAoB;EACpBC,iBAAiB;EACjBC,aAAa;EACbC,gBAAgB;EAChBC,2BAA2B;EAC3BC,oBAAoB;EACpBC,qBAAqB;EACrBC,gBAAgB;EAChBC,YAAY;EACZC,iBAAiB;EACjBC,aAAa;EACbC,0BAA0B;EAC1BC,gBAAgB;EAChBC,gBAAgB;EAChBC,WAAW;EACXC,qBAAqB;EACrBC,oBAAoB;EACpBC,gBAAgB;EAChBC,iBAAiB;EACjBC;AAAuB;AAGzB,MAAMC,UAAU,GAAG;EACjB,IAAI,EAAE,CAAC;EACP,IAAI,EAAE,CAAC;EACP,IAAI,EAAE,CAAC;EACP,IAAI,EAAE,CAAC;EACP,GAAG,EAAE,CAAC;EACN,GAAG,EAAE,CAAC;EACN,GAAG,EAAE,CAAC;EACN,IAAI,EAAE,CAAC;E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K,CAAC,CAAE,IAC3DwD,SAAS,IAAI9G,yBAAyB,CAACuD,MAAM,EAAE;MAAE8D,IAAI,EAAE/D;IAAK,CAAC,CAAE,IAC/D0D,OAAO,IAAI/F,cAAc,CAACsC,MAAM,EAAE;MAAE+D,IAAI,EAAEhE;IAAK,CAAC,CAAE,IAClD2D,SAAS,IAAIlG,gBAAgB,CAACwC,MAAM,EAAE;MAAEiB,IAAI,EAAElB;IAAK,CAAC,CAAE,IACtD4D,SAAS,IAAIlG,gBAAgB,CAACuC,MAAM,EAAE;MAAEiB,IAAI,EAAElB;IAAK,CAAC,CAAE,EACvD;MACA,OAAO,IAAI;IACb;IAEA,IACE6D,CAAC,GAAG,CAAC,KACH1D,cAAc,CAACH,IAAI,EAAEC,MAAM,CAAC,IAAI,CAAC/B,eAAe,CAAC+B,MAAM,CAAC,IACvDzB,oBAAoB,CAACyB,MAAM,CAAC,IAAIA,MAAM,CAACgE,WAAW,CAAC,CAAC,CAAC,KAAKjE,IAAK,IAC/DjD,kBAAkB,CAACkD,MAAM,CAAC,IAAI,CAACA,MAAM,CAACiE,MAAO,IAC9C/G,aAAa,CAAC8C,MAAM,EAAE;MAAEiC,IAAI,EAAElC;IAAK,CAAC,CAAC,IACrCnD,QAAQ,CAACoD,MAAM,EAAE;MAAEiB,IAAI,EAAElB;IAAK,CAAC,CAAC,IAChCrD,sBAAsB,CAACsD,MAAM,EAAE;MAAEiB,IAAI,EAAElB;IAAK,CAAC,CAAC,CAAC,EACjD;MACAA,IAAI,GAAGC,MAAM;MACb4D,CAAC,EAAE;MACH5D,MAAM,GAAGQ,UAAU,CAACoD,CAAC,CAAC;IACxB,CAAC,MAAM;MACL,OAAO,KAAK;IACd;EACF;EAEA,OAAO,KAAK;AACd"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/node/whitespace.js b/node_modules/@babel/generator/lib/node/whitespace.js index ccb54017d..e5196fb8e 100644 --- a/node_modules/@babel/generator/lib/node/whitespace.js +++ b/node_modules/@babel/generator/lib/node/whitespace.js @@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.nodes = void 0; - var _t = require("@babel/types"); - const { FLIPPED_ALIAS_KEYS, isArrayExpression, @@ -23,10 +21,8 @@ const { isOptionalMemberExpression, isStringLiteral } = _t; - function crawlInternal(node, state) { if (!node) return state; - if (isMemberExpression(node) || isOptionalMemberExpression(node)) { crawlInternal(node.object, state); if (node.computed) crawlInternal(node.property, state); @@ -39,9 +35,9 @@ function crawlInternal(node, state) { } else if (isFunction(node)) { state.hasFunction = true; } else if (isIdentifier(node)) { - state.hasHelper = state.hasHelper || node.callee && isHelper(node.callee); + state.hasHelper = + state.hasHelper || node.callee && isHelper(node.callee); } - return state; } @@ -55,7 +51,6 @@ function crawl(node) { function isHelper(node) { if (!node) return false; - if (isMemberExpression(node)) { return isHelper(node.object) || isHelper(node.property); } else if (isIdentifier(node)) { @@ -68,15 +63,14 @@ function isHelper(node) { return false; } } - function isType(node) { return isLiteral(node) || isObjectExpression(node) || isArrayExpression(node) || isIdentifier(node) || isMemberExpression(node); } const nodes = { + AssignmentExpression(node) { const state = crawl(node.right); - if (state.hasCall && state.hasHelper || state.hasFunction) { return state.hasFunction ? 1 | 2 : 2; } @@ -103,7 +97,6 @@ const nodes = { return 1 | 2; } }, - OptionalCallExpression(node) { if (isFunction(node.callee)) { return 1 | 2; @@ -114,12 +107,10 @@ const nodes = { for (let i = 0; i < node.declarations.length; i++) { const declar = node.declarations[i]; let enabled = isHelper(declar.id) && !isType(declar.init); - if (!enabled && declar.init) { const state = crawl(declar.init); enabled = isHelper(declar.init) && state.hasCall || state.hasFunction; } - if (enabled) { return 1 | 2; } @@ -131,8 +122,8 @@ const nodes = { return 1 | 2; } } - }; + exports.nodes = nodes; nodes.ObjectProperty = nodes.ObjectTypeProperty = nodes.ObjectMethod = function (node, parent) { @@ -140,26 +131,20 @@ nodes.ObjectProperty = nodes.ObjectTypeProperty = nodes.ObjectMethod = function return 1; } }; - nodes.ObjectTypeCallProperty = function (node, parent) { var _parent$properties; - if (parent.callProperties[0] === node && !((_parent$properties = parent.properties) != null && _parent$properties.length)) { return 1; } }; - nodes.ObjectTypeIndexer = function (node, parent) { var _parent$properties2, _parent$callPropertie; - if (parent.indexers[0] === node && !((_parent$properties2 = parent.properties) != null && _parent$properties2.length) && !((_parent$callPropertie = parent.callProperties) != null && _parent$callPropertie.length)) { return 1; } }; - nodes.ObjectTypeInternalSlot = function (node, parent) { var _parent$properties3, _parent$callPropertie2, _parent$indexers; - if (parent.internalSlots[0] === node && !((_parent$properties3 = parent.properties) != null && _parent$properties3.length) && !((_parent$callPropertie2 = parent.callProperties) != null && _parent$callPropertie2.length) && !((_parent$indexers = parent.indexers) != null && _parent$indexers.length)) { return 1; } @@ -168,7 +153,6 @@ nodes.ObjectTypeInternalSlot = function (node, parent) { [["Function", true], ["Class", true], ["Loop", true], ["LabeledStatement", true], ["SwitchStatement", true], ["TryStatement", true]].forEach(function ([type, amounts]) { [type].concat(FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) { const ret = amounts ? 1 | 2 : 0; - nodes[type] = () => ret; }); }); diff --git a/node_modules/@babel/generator/lib/node/whitespace.js.map b/node_modules/@babel/generator/lib/node/whitespace.js.map index 90fcd3fae..e1232cfa6 100644 --- a/node_modules/@babel/generator/lib/node/whitespace.js.map +++ b/node_modules/@babel/generator/lib/node/whitespace.js.map @@ -1 +1 @@ -{"version":3,"names":["FLIPPED_ALIAS_KEYS","isArrayExpression","isAssignmentExpression","isBinary","isBlockStatement","isCallExpression","isFunction","isIdentifier","isLiteral","isMemberExpression","isObjectExpression","isOptionalCallExpression","isOptionalMemberExpression","isStringLiteral","crawlInternal","node","state","object","computed","property","left","right","hasCall","callee","hasFunction","hasHelper","isHelper","crawl","name","charCodeAt","isType","nodes","AssignmentExpression","SwitchCase","parent","consequent","length","cases","LogicalExpression","Literal","value","CallExpression","OptionalCallExpression","VariableDeclaration","i","declarations","declar","enabled","id","init","IfStatement","ObjectProperty","ObjectTypeProperty","ObjectMethod","properties","ObjectTypeCallProperty","callProperties","ObjectTypeIndexer","indexers","ObjectTypeInternalSlot","internalSlots","forEach","type","amounts","concat","ret"],"sources":["../../src/node/whitespace.ts"],"sourcesContent":["import {\n FLIPPED_ALIAS_KEYS,\n isArrayExpression,\n isAssignmentExpression,\n isBinary,\n isBlockStatement,\n isCallExpression,\n isFunction,\n isIdentifier,\n isLiteral,\n isMemberExpression,\n isObjectExpression,\n isOptionalCallExpression,\n isOptionalMemberExpression,\n isStringLiteral,\n} from \"@babel/types\";\nimport * as charCodes from \"charcodes\";\n\nimport type { NodeHandlers } from \"./index\";\n\nimport type * as t from \"@babel/types\";\n\nconst enum WhitespaceFlag {\n before = 1 << 0,\n after = 1 << 1,\n}\n\nexport type { WhitespaceFlag };\n\nfunction crawlInternal(\n node: t.Node,\n state: { hasCall: boolean; hasFunction: boolean; hasHelper: boolean },\n) {\n if (!node) return state;\n\n if (isMemberExpression(node) || isOptionalMemberExpression(node)) {\n crawlInternal(node.object, state);\n if (node.computed) crawlInternal(node.property, state);\n } else if (isBinary(node) || isAssignmentExpression(node)) {\n crawlInternal(node.left, state);\n crawlInternal(node.right, state);\n } else if (isCallExpression(node) || isOptionalCallExpression(node)) {\n state.hasCall = true;\n crawlInternal(node.callee, state);\n } else if (isFunction(node)) {\n state.hasFunction = true;\n } else if (isIdentifier(node)) {\n state.hasHelper =\n // @ts-expect-error todo(flow->ts): node.callee is not really expected here…\n state.hasHelper || (node.callee && isHelper(node.callee));\n }\n\n return state;\n}\n\n/**\n * Crawl a node to test if it contains a CallExpression, a Function, or a Helper.\n *\n * @example\n * crawl(node)\n * // { hasCall: false, hasFunction: true, hasHelper: false }\n */\n\nfunction crawl(node: t.Node) {\n return crawlInternal(node, {\n hasCall: false,\n hasFunction: false,\n hasHelper: false,\n });\n}\n\n/**\n * Test if a node is or has a helper.\n */\n\nfunction isHelper(node: t.Node): boolean {\n if (!node) return false;\n\n if (isMemberExpression(node)) {\n return isHelper(node.object) || isHelper(node.property);\n } else if (isIdentifier(node)) {\n return (\n node.name === \"require\" ||\n node.name.charCodeAt(0) === charCodes.underscore\n );\n } else if (isCallExpression(node)) {\n return isHelper(node.callee);\n } else if (isBinary(node) || isAssignmentExpression(node)) {\n return (\n (isIdentifier(node.left) && isHelper(node.left)) || isHelper(node.right)\n );\n } else {\n return false;\n }\n}\n\nfunction isType(node: t.Node) {\n return (\n isLiteral(node) ||\n isObjectExpression(node) ||\n isArrayExpression(node) ||\n isIdentifier(node) ||\n isMemberExpression(node)\n );\n}\n\n/**\n * Tests for node types that need whitespace.\n */\n\nexport const nodes: NodeHandlers = {\n /**\n * Test if AssignmentExpression needs whitespace.\n */\n\n AssignmentExpression(node: t.AssignmentExpression): WhitespaceFlag {\n const state = crawl(node.right);\n if ((state.hasCall && state.hasHelper) || state.hasFunction) {\n return state.hasFunction\n ? WhitespaceFlag.before | WhitespaceFlag.after\n : WhitespaceFlag.after;\n }\n },\n\n /**\n * Test if SwitchCase needs whitespace.\n */\n\n SwitchCase(node: t.SwitchCase, parent: t.SwitchStatement): WhitespaceFlag {\n return (\n (!!node.consequent.length || parent.cases[0] === node\n ? WhitespaceFlag.before\n : 0) |\n (!node.consequent.length && parent.cases[parent.cases.length - 1] === node\n ? WhitespaceFlag.after\n : 0)\n );\n },\n\n /**\n * Test if LogicalExpression needs whitespace.\n */\n\n LogicalExpression(node: t.LogicalExpression): WhitespaceFlag {\n if (isFunction(node.left) || isFunction(node.right)) {\n return WhitespaceFlag.after;\n }\n },\n\n /**\n * Test if Literal needs whitespace.\n */\n\n Literal(node: t.Literal): WhitespaceFlag {\n if (isStringLiteral(node) && node.value === \"use strict\") {\n return WhitespaceFlag.after;\n }\n },\n\n /**\n * Test if CallExpressionish needs whitespace.\n */\n\n CallExpression(node: t.CallExpression): WhitespaceFlag {\n if (isFunction(node.callee) || isHelper(node)) {\n return WhitespaceFlag.before | WhitespaceFlag.after;\n }\n },\n\n OptionalCallExpression(node: t.OptionalCallExpression): WhitespaceFlag {\n if (isFunction(node.callee)) {\n return WhitespaceFlag.before | WhitespaceFlag.after;\n }\n },\n\n /**\n * Test if VariableDeclaration needs whitespace.\n */\n\n VariableDeclaration(node: t.VariableDeclaration): WhitespaceFlag {\n for (let i = 0; i < node.declarations.length; i++) {\n const declar = node.declarations[i];\n\n let enabled = isHelper(declar.id) && !isType(declar.init);\n if (!enabled && declar.init) {\n const state = crawl(declar.init);\n enabled = (isHelper(declar.init) && state.hasCall) || state.hasFunction;\n }\n\n if (enabled) {\n return WhitespaceFlag.before | WhitespaceFlag.after;\n }\n }\n },\n\n /**\n * Test if IfStatement needs whitespace.\n */\n\n IfStatement(node: t.IfStatement): WhitespaceFlag {\n if (isBlockStatement(node.consequent)) {\n return WhitespaceFlag.before | WhitespaceFlag.after;\n }\n },\n};\n\n/**\n * Test if Property needs whitespace.\n */\n\nnodes.ObjectProperty =\n nodes.ObjectTypeProperty =\n nodes.ObjectMethod =\n function (\n node: t.ObjectProperty | t.ObjectTypeProperty | t.ObjectMethod,\n parent: t.ObjectExpression,\n ): WhitespaceFlag {\n if (parent.properties[0] === node) {\n return WhitespaceFlag.before;\n }\n };\n\nnodes.ObjectTypeCallProperty = function (\n node: t.ObjectTypeCallProperty,\n parent: t.ObjectTypeAnnotation,\n): WhitespaceFlag {\n if (parent.callProperties[0] === node && !parent.properties?.length) {\n return WhitespaceFlag.before;\n }\n};\n\nnodes.ObjectTypeIndexer = function (\n node: t.ObjectTypeIndexer,\n parent: t.ObjectTypeAnnotation,\n): WhitespaceFlag {\n if (\n parent.indexers[0] === node &&\n !parent.properties?.length &&\n !parent.callProperties?.length\n ) {\n return WhitespaceFlag.before;\n }\n};\n\nnodes.ObjectTypeInternalSlot = function (\n node: t.ObjectTypeInternalSlot,\n parent: t.ObjectTypeAnnotation,\n): WhitespaceFlag {\n if (\n parent.internalSlots[0] === node &&\n !parent.properties?.length &&\n !parent.callProperties?.length &&\n !parent.indexers?.length\n ) {\n return WhitespaceFlag.before;\n }\n};\n\n/**\n * Add whitespace tests for nodes and their aliases.\n */\n\n(\n [\n [\"Function\", true],\n [\"Class\", true],\n [\"Loop\", true],\n [\"LabeledStatement\", true],\n [\"SwitchStatement\", true],\n [\"TryStatement\", true],\n ] as const\n).forEach(function ([type, amounts]) {\n [type as string]\n .concat(FLIPPED_ALIAS_KEYS[type] || [])\n .forEach(function (type) {\n const ret = amounts ? WhitespaceFlag.before | WhitespaceFlag.after : 0;\n nodes[type] = () => ret;\n });\n});\n"],"mappings":";;;;;;;AAAA;;;EACEA,kB;EACAC,iB;EACAC,sB;EACAC,Q;EACAC,gB;EACAC,gB;EACAC,U;EACAC,Y;EACAC,S;EACAC,kB;EACAC,kB;EACAC,wB;EACAC,0B;EACAC;;;AAeF,SAASC,aAAT,CACEC,IADF,EAEEC,KAFF,EAGE;EACA,IAAI,CAACD,IAAL,EAAW,OAAOC,KAAP;;EAEX,IAAIP,kBAAkB,CAACM,IAAD,CAAlB,IAA4BH,0BAA0B,CAACG,IAAD,CAA1D,EAAkE;IAChED,aAAa,CAACC,IAAI,CAACE,MAAN,EAAcD,KAAd,CAAb;IACA,IAAID,IAAI,CAACG,QAAT,EAAmBJ,aAAa,CAACC,IAAI,CAACI,QAAN,EAAgBH,KAAhB,CAAb;EACpB,CAHD,MAGO,IAAIb,QAAQ,CAACY,IAAD,CAAR,IAAkBb,sBAAsB,CAACa,IAAD,CAA5C,EAAoD;IACzDD,aAAa,CAACC,IAAI,CAACK,IAAN,EAAYJ,KAAZ,CAAb;IACAF,aAAa,CAACC,IAAI,CAACM,KAAN,EAAaL,KAAb,CAAb;EACD,CAHM,MAGA,IAAIX,gBAAgB,CAACU,IAAD,CAAhB,IAA0BJ,wBAAwB,CAACI,IAAD,CAAtD,EAA8D;IACnEC,KAAK,CAACM,OAAN,GAAgB,IAAhB;IACAR,aAAa,CAACC,IAAI,CAACQ,MAAN,EAAcP,KAAd,CAAb;EACD,CAHM,MAGA,IAAIV,UAAU,CAACS,IAA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,EAA2B;EACnC,CAACD,IAAD,EACGE,MADH,CACUhE,kBAAkB,CAAC8D,IAAD,CAAlB,IAA4B,EADtC,EAEGD,OAFH,CAEW,UAAUC,IAAV,EAAgB;IACvB,MAAMG,GAAG,GAAGF,OAAO,GAAG,KAAH,GAAkD,CAArE;;IACAhC,KAAK,CAAC+B,IAAD,CAAL,GAAc,MAAMG,GAApB;EACD,CALH;AAMD,CAhBD"} \ No newline at end of file +{"version":3,"names":["FLIPPED_ALIAS_KEYS","isArrayExpression","isAssignmentExpression","isBinary","isBlockStatement","isCallExpression","isFunction","isIdentifier","isLiteral","isMemberExpression","isObjectExpression","isOptionalCallExpression","isOptionalMemberExpression","isStringLiteral","crawlInternal","node","state","object","computed","property","left","right","hasCall","callee","hasFunction","hasHelper","isHelper","crawl","name","charCodeAt","isType","nodes","AssignmentExpression","SwitchCase","parent","consequent","length","cases","LogicalExpression","Literal","value","CallExpression","OptionalCallExpression","VariableDeclaration","i","declarations","declar","enabled","id","init","IfStatement","ObjectProperty","ObjectTypeProperty","ObjectMethod","properties","ObjectTypeCallProperty","callProperties","ObjectTypeIndexer","indexers","ObjectTypeInternalSlot","internalSlots","forEach","type","amounts","concat","ret"],"sources":["../../src/node/whitespace.ts"],"sourcesContent":["import {\n FLIPPED_ALIAS_KEYS,\n isArrayExpression,\n isAssignmentExpression,\n isBinary,\n isBlockStatement,\n isCallExpression,\n isFunction,\n isIdentifier,\n isLiteral,\n isMemberExpression,\n isObjectExpression,\n isOptionalCallExpression,\n isOptionalMemberExpression,\n isStringLiteral,\n} from \"@babel/types\";\nimport * as charCodes from \"charcodes\";\n\nimport type { NodeHandlers } from \"./index\";\n\nimport type * as t from \"@babel/types\";\n\nconst enum WhitespaceFlag {\n before = 1 << 0,\n after = 1 << 1,\n}\n\nexport type { WhitespaceFlag };\n\nfunction crawlInternal(\n node: t.Node,\n state: { hasCall: boolean; hasFunction: boolean; hasHelper: boolean },\n) {\n if (!node) return state;\n\n if (isMemberExpression(node) || isOptionalMemberExpression(node)) {\n crawlInternal(node.object, state);\n if (node.computed) crawlInternal(node.property, state);\n } else if (isBinary(node) || isAssignmentExpression(node)) {\n crawlInternal(node.left, state);\n crawlInternal(node.right, state);\n } else if (isCallExpression(node) || isOptionalCallExpression(node)) {\n state.hasCall = true;\n crawlInternal(node.callee, state);\n } else if (isFunction(node)) {\n state.hasFunction = true;\n } else if (isIdentifier(node)) {\n state.hasHelper =\n // @ts-expect-error todo(flow->ts): node.callee is not really expected here…\n state.hasHelper || (node.callee && isHelper(node.callee));\n }\n\n return state;\n}\n\n/**\n * Crawl a node to test if it contains a CallExpression, a Function, or a Helper.\n *\n * @example\n * crawl(node)\n * // { hasCall: false, hasFunction: true, hasHelper: false }\n */\n\nfunction crawl(node: t.Node) {\n return crawlInternal(node, {\n hasCall: false,\n hasFunction: false,\n hasHelper: false,\n });\n}\n\n/**\n * Test if a node is or has a helper.\n */\n\nfunction isHelper(node: t.Node): boolean {\n if (!node) return false;\n\n if (isMemberExpression(node)) {\n return isHelper(node.object) || isHelper(node.property);\n } else if (isIdentifier(node)) {\n return (\n node.name === \"require\" ||\n node.name.charCodeAt(0) === charCodes.underscore\n );\n } else if (isCallExpression(node)) {\n return isHelper(node.callee);\n } else if (isBinary(node) || isAssignmentExpression(node)) {\n return (\n (isIdentifier(node.left) && isHelper(node.left)) || isHelper(node.right)\n );\n } else {\n return false;\n }\n}\n\nfunction isType(node: t.Node) {\n return (\n isLiteral(node) ||\n isObjectExpression(node) ||\n isArrayExpression(node) ||\n isIdentifier(node) ||\n isMemberExpression(node)\n );\n}\n\n/**\n * Tests for node types that need whitespace.\n */\n\nexport const nodes: NodeHandlers = {\n /**\n * Test if AssignmentExpression needs whitespace.\n */\n\n AssignmentExpression(node: t.AssignmentExpression): WhitespaceFlag {\n const state = crawl(node.right);\n if ((state.hasCall && state.hasHelper) || state.hasFunction) {\n return state.hasFunction\n ? WhitespaceFlag.before | WhitespaceFlag.after\n : WhitespaceFlag.after;\n }\n },\n\n /**\n * Test if SwitchCase needs whitespace.\n */\n\n SwitchCase(node: t.SwitchCase, parent: t.SwitchStatement): WhitespaceFlag {\n return (\n (!!node.consequent.length || parent.cases[0] === node\n ? WhitespaceFlag.before\n : 0) |\n (!node.consequent.length && parent.cases[parent.cases.length - 1] === node\n ? WhitespaceFlag.after\n : 0)\n );\n },\n\n /**\n * Test if LogicalExpression needs whitespace.\n */\n\n LogicalExpression(node: t.LogicalExpression): WhitespaceFlag {\n if (isFunction(node.left) || isFunction(node.right)) {\n return WhitespaceFlag.after;\n }\n },\n\n /**\n * Test if Literal needs whitespace.\n */\n\n Literal(node: t.Literal): WhitespaceFlag {\n if (isStringLiteral(node) && node.value === \"use strict\") {\n return WhitespaceFlag.after;\n }\n },\n\n /**\n * Test if CallExpressionish needs whitespace.\n */\n\n CallExpression(node: t.CallExpression): WhitespaceFlag {\n if (isFunction(node.callee) || isHelper(node)) {\n return WhitespaceFlag.before | WhitespaceFlag.after;\n }\n },\n\n OptionalCallExpression(node: t.OptionalCallExpression): WhitespaceFlag {\n if (isFunction(node.callee)) {\n return WhitespaceFlag.before | WhitespaceFlag.after;\n }\n },\n\n /**\n * Test if VariableDeclaration needs whitespace.\n */\n\n VariableDeclaration(node: t.VariableDeclaration): WhitespaceFlag {\n for (let i = 0; i < node.declarations.length; i++) {\n const declar = node.declarations[i];\n\n let enabled = isHelper(declar.id) && !isType(declar.init);\n if (!enabled && declar.init) {\n const state = crawl(declar.init);\n enabled = (isHelper(declar.init) && state.hasCall) || state.hasFunction;\n }\n\n if (enabled) {\n return WhitespaceFlag.before | WhitespaceFlag.after;\n }\n }\n },\n\n /**\n * Test if IfStatement needs whitespace.\n */\n\n IfStatement(node: t.IfStatement): WhitespaceFlag {\n if (isBlockStatement(node.consequent)) {\n return WhitespaceFlag.before | WhitespaceFlag.after;\n }\n },\n};\n\n/**\n * Test if Property needs whitespace.\n */\n\nnodes.ObjectProperty =\n nodes.ObjectTypeProperty =\n nodes.ObjectMethod =\n function (\n node: t.ObjectProperty | t.ObjectTypeProperty | t.ObjectMethod,\n parent: t.ObjectExpression,\n ): WhitespaceFlag {\n if (parent.properties[0] === node) {\n return WhitespaceFlag.before;\n }\n };\n\nnodes.ObjectTypeCallProperty = function (\n node: t.ObjectTypeCallProperty,\n parent: t.ObjectTypeAnnotation,\n): WhitespaceFlag {\n if (parent.callProperties[0] === node && !parent.properties?.length) {\n return WhitespaceFlag.before;\n }\n};\n\nnodes.ObjectTypeIndexer = function (\n node: t.ObjectTypeIndexer,\n parent: t.ObjectTypeAnnotation,\n): WhitespaceFlag {\n if (\n parent.indexers[0] === node &&\n !parent.properties?.length &&\n !parent.callProperties?.length\n ) {\n return WhitespaceFlag.before;\n }\n};\n\nnodes.ObjectTypeInternalSlot = function (\n node: t.ObjectTypeInternalSlot,\n parent: t.ObjectTypeAnnotation,\n): WhitespaceFlag {\n if (\n parent.internalSlots[0] === node &&\n !parent.properties?.length &&\n !parent.callProperties?.length &&\n !parent.indexers?.length\n ) {\n return WhitespaceFlag.before;\n }\n};\n\n/**\n * Add whitespace tests for nodes and their aliases.\n */\n\n(\n [\n [\"Function\", true],\n [\"Class\", true],\n [\"Loop\", true],\n [\"LabeledStatement\", true],\n [\"SwitchStatement\", true],\n [\"TryStatement\", true],\n ] as const\n).forEach(function ([type, amounts]) {\n [type as string]\n .concat(FLIPPED_ALIAS_KEYS[type] || [])\n .forEach(function (type) {\n const ret = amounts ? WhitespaceFlag.before | WhitespaceFlag.after : 0;\n nodes[type] = () => ret;\n });\n});\n"],"mappings":";;;;;;AAAA;AAesB;EAdpBA,kBAAkB;EAClBC,iBAAiB;EACjBC,sBAAsB;EACtBC,QAAQ;EACRC,gBAAgB;EAChBC,gBAAgB;EAChBC,UAAU;EACVC,YAAY;EACZC,SAAS;EACTC,kBAAkB;EAClBC,kBAAkB;EAClBC,wBAAwB;EACxBC,0BAA0B;EAC1BC;AAAe;AAejB,SAASC,aAAa,CACpBC,IAAY,EACZC,KAAqE,EACrE;EACA,I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AG,UAC7B5C,IAA8B,EAC9BmB,MAA8B,EACd;EAAA;EAChB,IACEA,MAAM,CAAC0B,aAAa,CAAC,CAAC,CAAC,KAAK7C,IAAI,IAChC,yBAACmB,MAAM,CAACoB,UAAU,aAAjB,oBAAmBlB,MAAM,KAC1B,4BAACF,MAAM,CAACsB,cAAc,aAArB,uBAAuBpB,MAAM,KAC9B,sBAACF,MAAM,CAACwB,QAAQ,aAAf,iBAAiBtB,MAAM,GACxB;IACA;EACF;AACF,CAAC;;AAOC,CACE,CAAC,UAAU,EAAE,IAAI,CAAC,EAClB,CAAC,OAAO,EAAE,IAAI,CAAC,EACf,CAAC,MAAM,EAAE,IAAI,CAAC,EACd,CAAC,kBAAkB,EAAE,IAAI,CAAC,EAC1B,CAAC,iBAAiB,EAAE,IAAI,CAAC,EACzB,CAAC,cAAc,EAAE,IAAI,CAAC,CACvB,CACDyB,OAAO,CAAC,UAAU,CAACC,IAAI,EAAEC,OAAO,CAAC,EAAE;EACnC,CAACD,IAAI,CAAW,CACbE,MAAM,CAAChE,kBAAkB,CAAC8D,IAAI,CAAC,IAAI,EAAE,CAAC,CACtCD,OAAO,CAAC,UAAUC,IAAI,EAAE;IACvB,MAAMG,GAAG,GAAGF,OAAO,GAAG,KAA4C,GAAG,CAAC;IACtEhC,KAAK,CAAC+B,IAAI,CAAC,GAAG,MAAMG,GAAG;EACzB,CAAC,CAAC;AACN,CAAC,CAAC"} \ No newline at end of file diff --git a/node_modules/@babel/generator/lib/printer.js b/node_modules/@babel/generator/lib/printer.js index 013d0b244..8af734c35 100644 --- a/node_modules/@babel/generator/lib/printer.js +++ b/node_modules/@babel/generator/lib/printer.js @@ -4,23 +4,25 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; - var _buffer = require("./buffer"); - var n = require("./node"); - +var _t = require("@babel/types"); var generatorFunctions = require("./generators"); - +const { + isFunction, + isStatement, + isClassBody, + isTSInterfaceBody +} = _t; const SCIENTIFIC_NOTATION = /e/i; const ZERO_DECIMAL_INTEGER = /\.0+$/; const NON_DECIMAL_LITERAL = /^0[box]/; const PURE_ANNOTATION_RE = /^\s*[@#]__PURE__\s*$/; +const HAS_NEWLINE = /[\n\r\u2028\u2029]/; +const HAS_BlOCK_COMMENT_END = /\*\//; const { - needsParens, - needsWhitespaceAfter, - needsWhitespaceBefore + needsParens } = n; - class Printer { constructor(format, map) { this.inForStatementInitCounter = 0; @@ -35,17 +37,17 @@ class Printer { this._printedComments = new Set(); this._endsWithInteger = false; this._endsWithWord = false; + this._lastCommentLine = 0; + this._endsWithInnerRaw = false; + this._indentInnerComments = true; this.format = format; this._buf = new _buffer.default(map); this._indentChar = format.indent.style.charCodeAt(0); this._indentRepeat = format.indent.style.length; } - generate(ast) { this.print(ast); - this._maybeAddAuxComment(); - return this._buf.get(); } @@ -61,181 +63,165 @@ class Printer { semicolon(force = false) { this._maybeAddAuxComment(); - if (force) { this._appendChar(59); } else { this._queue(59); } + this._noLineTerminator = false; } rightBrace() { if (this.format.minified) { this._buf.removeLastSemicolon(); } - this.tokenChar(125); } space(force = false) { if (this.format.compact) return; - if (force) { this._space(); } else if (this._buf.hasContent()) { const lastCp = this.getLastChar(); - if (lastCp !== 32 && lastCp !== 10) { this._space(); } } } - word(str) { + word(str, noLineTerminatorAfter = false) { + this._maybePrintInnerComments(); + if (this._endsWithWord || str.charCodeAt(0) === 47 && this.endsWith(47)) { this._space(); } - this._maybeAddAuxComment(); - this._append(str, false); - this._endsWithWord = true; + this._noLineTerminator = noLineTerminatorAfter; } number(str) { this.word(str); + this._endsWithInteger = Number.isInteger(+str) && !NON_DECIMAL_LITERAL.test(str) && !SCIENTIFIC_NOTATION.test(str) && !ZERO_DECIMAL_INTEGER.test(str) && str.charCodeAt(str.length - 1) !== 46; } token(str, maybeNewline = false) { + this._maybePrintInnerComments(); + const lastChar = this.getLastChar(); const strFirst = str.charCodeAt(0); - - if (lastChar === 33 && str === "--" || strFirst === 43 && lastChar === 43 || strFirst === 45 && lastChar === 45 || strFirst === 46 && this._endsWithInteger) { + if (lastChar === 33 && str === "--" || + strFirst === 43 && lastChar === 43 || strFirst === 45 && lastChar === 45 || + strFirst === 46 && this._endsWithInteger) { this._space(); } - this._maybeAddAuxComment(); - this._append(str, maybeNewline); + this._noLineTerminator = false; } - tokenChar(char) { - const lastChar = this.getLastChar(); + this._maybePrintInnerComments(); - if (char === 43 && lastChar === 43 || char === 45 && lastChar === 45 || char === 46 && this._endsWithInteger) { + const lastChar = this.getLastChar(); + if ( + char === 43 && lastChar === 43 || char === 45 && lastChar === 45 || + char === 46 && this._endsWithInteger) { this._space(); } - this._maybeAddAuxComment(); - this._appendChar(char); + this._noLineTerminator = false; } - newline(i = 1) { - if (this.format.retainLines || this.format.compact) return; - - if (this.format.concise) { - this.space(); - return; - } - - const charBeforeNewline = this.endsWithCharAndNewline(); - if (charBeforeNewline === 10) return; - - if (charBeforeNewline === 123 || charBeforeNewline === 58) { - i--; - } - + newline(i = 1, force) { if (i <= 0) return; + if (!force) { + if (this.format.retainLines || this.format.compact) return; + if (this.format.concise) { + this.space(); + return; + } + } + if (i > 2) i = 2; + i -= this._buf.getNewlineCount(); for (let j = 0; j < i; j++) { this._newline(); } + return; } - endsWith(char) { return this.getLastChar() === char; } - getLastChar() { return this._buf.getLastChar(); } - endsWithCharAndNewline() { return this._buf.endsWithCharAndNewline(); } - removeTrailingNewline() { this._buf.removeTrailingNewline(); } - exactSource(loc, cb) { + if (!loc) return cb(); this._catchUp("start", loc); - this._buf.exactSource(loc, cb); } - source(prop, loc) { + if (!loc) return; this._catchUp(prop, loc); - this._buf.source(prop, loc); } - + sourceWithOffset(prop, loc, lineOffset, columnOffset) { + if (!loc) return; + this._catchUp(prop, loc); + this._buf.sourceWithOffset(prop, loc, lineOffset, columnOffset); + } withSource(prop, loc, cb) { + if (!loc) return cb(); this._catchUp(prop, loc); - this._buf.withSource(prop, loc, cb); } - _space() { this._queue(32); } - _newline() { this._queue(10); } - _append(str, maybeNewline) { this._maybeAddParen(str); - this._maybeIndent(str.charCodeAt(0)); - this._buf.append(str, maybeNewline); - this._endsWithWord = false; this._endsWithInteger = false; } - _appendChar(char) { this._maybeAddParenChar(char); - this._maybeIndent(char); - this._buf.appendChar(char); - this._endsWithWord = false; this._endsWithInteger = false; } - _queue(char) { this._maybeAddParenChar(char); - this._maybeIndent(char); - this._buf.queue(char); - this._endsWithWord = false; this._endsWithInteger = false; } - _maybeIndent(firstChar) { if (this._indent && firstChar !== 10 && this.endsWith(10)) { this._buf.queueIndentation(this._indentChar, this._getIndent()); } } - + _shouldIndent(firstChar) { + if (this._indent && firstChar !== 10 && this.endsWith(10)) { + return true; + } + } _maybeAddParenChar(char) { const parenPushNewlineState = this._parenPushNewlineState; if (!parenPushNewlineState) return; @@ -248,56 +234,59 @@ class Printer { this._parenPushNewlineState = null; return; } - this.tokenChar(40); this.indent(); parenPushNewlineState.printed = true; } - _maybeAddParen(str) { const parenPushNewlineState = this._parenPushNewlineState; if (!parenPushNewlineState) return; + const len = str.length; let i; - for (i = 0; i < len && str.charCodeAt(i) === 32; i++) continue; - if (i === len) { return; } const cha = str.charCodeAt(i); - if (cha !== 10) { - if (cha !== 47 || i + 1 === len) { + if ( + cha !== 47 || + i + 1 === len) { this._parenPushNewlineState = null; return; } - const chaPost = str.charCodeAt(i + 1); - if (chaPost === 42) { + if (PURE_ANNOTATION_RE.test(str.slice(i + 2, len - 2))) { return; } + } else if (chaPost !== 47) { this._parenPushNewlineState = null; return; } } - this.tokenChar(40); this.indent(); parenPushNewlineState.printed = true; } + catchUp(line) { + if (!this.format.retainLines) return; + const count = line - this._buf.getCurrentLine(); + for (let i = 0; i < count; i++) { + this._newline(); + } + } _catchUp(prop, loc) { if (!this.format.retainLines) return; - const pos = loc ? loc[prop] : null; + const pos = loc ? loc[prop] : null; if ((pos == null ? void 0 : pos.line) != null) { const count = pos.line - this._buf.getCurrentLine(); - for (let i = 0; i < count; i++) { this._newline(); } @@ -307,19 +296,16 @@ class Printer { _getIndent() { return this._indentRepeat * this._indent; } - printTerminatorless(node, parent, isLabel) { if (isLabel) { this._noLineTerminator = true; this.print(node, parent); - this._noLineTerminator = false; } else { const terminatorState = { printed: false }; this._parenPushNewlineState = terminatorState; this.print(node, parent); - if (terminatorState.printed) { this.dedent(); this.newline(); @@ -327,278 +313,341 @@ class Printer { } } } - - print(node, parent, noLineTerminator) { + print(node, parent, noLineTerminatorAfter, + trailingCommentsLineOffset, forceParens) { if (!node) return; + this._endsWithInnerRaw = false; const nodeType = node.type; const format = this.format; const oldConcise = format.concise; - - if (node._compact) { + if ( + node._compact) { format.concise = true; } - const printMethod = this[nodeType]; - if (printMethod === undefined) { throw new ReferenceError(`unknown node of type ${JSON.stringify(nodeType)} with constructor ${JSON.stringify(node.constructor.name)}`); } - this._printStack.push(node); - const oldInAux = this._insideAux; this._insideAux = node.loc == undefined; - this._maybeAddAuxComment(this._insideAux && !oldInAux); - - let shouldPrintParens; - - if (format.retainFunctionParens && nodeType === "FunctionExpression" && node.extra && node.extra.parenthesized) { + let shouldPrintParens = false; + if (forceParens) { + shouldPrintParens = true; + } else if (format.retainFunctionParens && nodeType === "FunctionExpression" && node.extra && node.extra.parenthesized) { shouldPrintParens = true; } else { shouldPrintParens = needsParens(node, parent, this._printStack); } - - if (shouldPrintParens) this.tokenChar(40); - - this._printLeadingComments(node); - + if (shouldPrintParens) { + this.tokenChar(40); + this._endsWithInnerRaw = false; + } + this._lastCommentLine = 0; + this._printLeadingComments(node, parent); const loc = nodeType === "Program" || nodeType === "File" ? null : node.loc; - this.withSource("start", loc, printMethod.bind(this, node, parent)); - - if (noLineTerminator && !this._noLineTerminator) { + this.exactSource(loc, printMethod.bind(this, node, parent)); + if (shouldPrintParens) { + this._printTrailingComments(node, parent); + this.tokenChar(41); + this._noLineTerminator = noLineTerminatorAfter; + } else if (noLineTerminatorAfter && !this._noLineTerminator) { this._noLineTerminator = true; - - this._printTrailingComments(node); - - this._noLineTerminator = false; + this._printTrailingComments(node, parent); } else { - this._printTrailingComments(node); + this._printTrailingComments(node, parent, trailingCommentsLineOffset); } - if (shouldPrintParens) this.tokenChar(41); - this._printStack.pop(); - format.concise = oldConcise; this._insideAux = oldInAux; + this._endsWithInnerRaw = false; } - _maybeAddAuxComment(enteredPositionlessNode) { if (enteredPositionlessNode) this._printAuxBeforeComment(); if (!this._insideAux) this._printAuxAfterComment(); } - _printAuxBeforeComment() { if (this._printAuxAfterOnNextUserNode) return; this._printAuxAfterOnNextUserNode = true; const comment = this.format.auxiliaryCommentBefore; - if (comment) { this._printComment({ type: "CommentBlock", value: comment - }); + }, 0); } } - _printAuxAfterComment() { if (!this._printAuxAfterOnNextUserNode) return; this._printAuxAfterOnNextUserNode = false; const comment = this.format.auxiliaryCommentAfter; - if (comment) { this._printComment({ type: "CommentBlock", value: comment - }); + }, 0); } } - getPossibleRaw(node) { const extra = node.extra; - if (extra && extra.raw != null && extra.rawValue != null && node.value === extra.rawValue) { return extra.raw; } } - printJoin(nodes, parent, opts = {}) { if (!(nodes != null && nodes.length)) return; if (opts.indent) this.indent(); const newlineOpts = { - addNewlines: opts.addNewlines + addNewlines: opts.addNewlines, + nextNodeStartLine: 0 }; + const separator = opts.separator ? opts.separator.bind(this) : null; const len = nodes.length; - for (let i = 0; i < len; i++) { const node = nodes[i]; if (!node) continue; - if (opts.statement) this._printNewline(true, node, parent, newlineOpts); - this.print(node, parent); - - if (opts.iterator) { - opts.iterator(node, i); - } - - if (opts.separator && i < len - 1) { - opts.separator.call(this); + if (opts.statement) this._printNewline(i === 0, newlineOpts); + this.print(node, parent, undefined, opts.trailingCommentsLineOffset || 0); + opts.iterator == null ? void 0 : opts.iterator(node, i); + if (i < len - 1) separator == null ? void 0 : separator(); + if (opts.statement) { + if (i + 1 === len) { + this.newline(1); + } else { + var _nextNode$loc; + const nextNode = nodes[i + 1]; + newlineOpts.nextNodeStartLine = ((_nextNode$loc = nextNode.loc) == null ? void 0 : _nextNode$loc.start.line) || 0; + this._printNewline(true, newlineOpts); + } } - - if (opts.statement) this._printNewline(false, node, parent, newlineOpts); } - if (opts.indent) this.dedent(); } - printAndIndentOnComments(node, parent) { const indent = node.leadingComments && node.leadingComments.length > 0; if (indent) this.indent(); this.print(node, parent); if (indent) this.dedent(); } - printBlock(parent) { const node = parent.body; - if (node.type !== "EmptyStatement") { this.space(); } - this.print(node, parent); } - - _printTrailingComments(node) { - this._printComments(this._getComments(false, node)); + _printTrailingComments(node, parent, lineOffset) { + const { + innerComments, + trailingComments + } = node; + if (innerComments != null && innerComments.length) { + this._printComments(2, innerComments, node, parent, lineOffset); + } + if (trailingComments != null && trailingComments.length) { + this._printComments(2, trailingComments, node, parent, lineOffset); + } } - - _printLeadingComments(node) { - this._printComments(this._getComments(true, node), true); + _printLeadingComments(node, parent) { + const comments = node.leadingComments; + if (!(comments != null && comments.length)) return; + this._printComments(0, comments, node, parent); } - - printInnerComments(node, indent = true) { - var _node$innerComments; - - if (!((_node$innerComments = node.innerComments) != null && _node$innerComments.length)) return; + _maybePrintInnerComments() { + if (this._endsWithInnerRaw) this.printInnerComments(); + this._endsWithInnerRaw = true; + this._indentInnerComments = true; + } + printInnerComments() { + const node = this._printStack[this._printStack.length - 1]; + const comments = node.innerComments; + if (!(comments != null && comments.length)) return; + const hasSpace = this.endsWith(32); + const indent = this._indentInnerComments; + const printedCommentsCount = this._printedComments.size; if (indent) this.indent(); - - this._printComments(node.innerComments); - + this._printComments(1, comments, node); + if (hasSpace && printedCommentsCount !== this._printedComments.size) { + this.space(); + } if (indent) this.dedent(); } - + noIndentInnerCommentsHere() { + this._indentInnerComments = false; + } printSequence(nodes, parent, opts = {}) { opts.statement = true; return this.printJoin(nodes, parent, opts); } - printList(items, parent, opts = {}) { if (opts.separator == null) { opts.separator = commaSeparator; } - return this.printJoin(items, parent, opts); } - - _printNewline(leading, node, parent, opts) { + _printNewline(newLine, opts) { if (this.format.retainLines || this.format.compact) return; if (this.format.concise) { this.space(); return; } - - let lines = 0; + if (!newLine) { + return; + } + const startLine = opts.nextNodeStartLine; + const lastCommentLine = this._lastCommentLine; + if (startLine > 0 && lastCommentLine > 0) { + const offset = startLine - lastCommentLine; + if (offset >= 0) { + this.newline(offset || 1); + return; + } + } if (this._buf.hasContent()) { - if (!leading) lines++; - if (opts.addNewlines) lines += opts.addNewlines(leading, node) || 0; - const needs = leading ? needsWhitespaceBefore : needsWhitespaceAfter; - if (needs(node, parent)) lines++; - } - this.newline(Math.min(2, lines)); + this.newline(1); + } } - _getComments(leading, node) { - return node && (leading ? node.leadingComments : node.trailingComments) || null; + _shouldPrintComment(comment) { + if (comment.ignore) return 0; + if (this._printedComments.has(comment)) return 0; + if (this._noLineTerminator && (HAS_NEWLINE.test(comment.value) || HAS_BlOCK_COMMENT_END.test(comment.value))) { + return 2; + } + this._printedComments.add(comment); + if (!this.format.shouldPrintComment(comment.value)) { + return 0; + } + return 1; } - _printComment(comment, skipNewLines) { - if (comment.ignore) return; - if (this._printedComments.has(comment)) return; - if (!this.format.shouldPrintComment(comment.value)) return; - - this._printedComments.add(comment); - + const noLineTerminator = this._noLineTerminator; const isBlockComment = comment.type === "CommentBlock"; - const printNewLines = isBlockComment && !skipNewLines && !this._noLineTerminator; - if (printNewLines && this._buf.hasContent()) this.newline(1); - const lastCharCode = this.getLastChar(); + const printNewLines = isBlockComment && skipNewLines !== 1 && !this._noLineTerminator; + if (printNewLines && this._buf.hasContent() && skipNewLines !== 2) { + this.newline(1); + } + const lastCharCode = this.getLastChar(); if (lastCharCode !== 91 && lastCharCode !== 123) { this.space(); } - let val; - let maybeNewline = false; - if (isBlockComment) { val = `/*${comment.value}*/`; - if (this.format.indent.adjustMultilineComment) { var _comment$loc; - const offset = (_comment$loc = comment.loc) == null ? void 0 : _comment$loc.start.column; - if (offset) { const newlineRegex = new RegExp("\\n\\s{1," + offset + "}", "g"); val = val.replace(newlineRegex, "\n"); } - - const indentSize = Math.max(this._getIndent(), this.format.retainLines ? 0 : this._buf.getCurrentColumn()); + let indentSize = this.format.retainLines ? 0 : this._buf.getCurrentColumn(); + if (this._shouldIndent(47) || this.format.retainLines) { + indentSize += this._getIndent(); + } val = val.replace(/\n(?!$)/g, `\n${" ".repeat(indentSize)}`); - maybeNewline = true; } - } else if (!this._noLineTerminator) { - val = `//${comment.value}\n`; - maybeNewline = true; + } else if (!noLineTerminator) { + val = `//${comment.value}`; } else { val = `/*${comment.value}*/`; } if (this.endsWith(47)) this._space(); - this.withSource("start", comment.loc, this._append.bind(this, val, maybeNewline)); - if (printNewLines) this.newline(1); - } - - _printComments(comments, inlinePureAnnotation) { - if (!(comments != null && comments.length)) return; - - if (inlinePureAnnotation && comments.length === 1 && PURE_ANNOTATION_RE.test(comments[0].value)) { - this._printComment(comments[0], this._buf.hasContent() && !this.endsWith(10)); - } else { - for (const comment of comments) { - this._printComment(comment); + this.source("start", comment.loc); + this._append(val, isBlockComment); + if (!isBlockComment && !noLineTerminator) { + this.newline(1, true); + } + if (printNewLines && skipNewLines !== 3) { + this.newline(1); + } + } + _printComments(type, comments, node, parent, lineOffset = 0) { + const nodeLoc = node.loc; + const len = comments.length; + let hasLoc = !!nodeLoc; + const nodeStartLine = hasLoc ? nodeLoc.start.line : 0; + const nodeEndLine = hasLoc ? nodeLoc.end.line : 0; + let lastLine = 0; + let leadingCommentNewline = 0; + const maybeNewline = this._noLineTerminator ? function () {} : this.newline.bind(this); + for (let i = 0; i < len; i++) { + const comment = comments[i]; + const shouldPrint = this._shouldPrintComment(comment); + if (shouldPrint === 2) { + hasLoc = false; + break; + } + if (hasLoc && comment.loc && shouldPrint === 1) { + const commentStartLine = comment.loc.start.line; + const commentEndLine = comment.loc.end.line; + if (type === 0) { + let offset = 0; + if (i === 0) { + if (this._buf.hasContent() && (comment.type === "CommentLine" || commentStartLine != commentEndLine)) { + offset = leadingCommentNewline = 1; + } + } else { + offset = commentStartLine - lastLine; + } + lastLine = commentEndLine; + maybeNewline(offset); + this._printComment(comment, 1); + if (i + 1 === len) { + maybeNewline(Math.max(nodeStartLine - lastLine, leadingCommentNewline)); + lastLine = nodeStartLine; + } + } else if (type === 1) { + const offset = commentStartLine - (i === 0 ? nodeStartLine : lastLine); + lastLine = commentEndLine; + maybeNewline(offset); + this._printComment(comment, 1); + if (i + 1 === len) { + maybeNewline(Math.min(1, nodeEndLine - lastLine)); + lastLine = nodeEndLine; + } + } else { + const offset = commentStartLine - (i === 0 ? nodeEndLine - lineOffset : lastLine); + lastLine = commentEndLine; + maybeNewline(offset); + this._printComment(comment, 1); + } + } else { + hasLoc = false; + if (shouldPrint !== 1) { + continue; + } + if (len === 1) { + const singleLine = comment.loc ? comment.loc.start.line === comment.loc.end.line : !HAS_NEWLINE.test(comment.value); + const shouldSkipNewline = singleLine && !isStatement(node) && !isClassBody(parent) && !isTSInterfaceBody(parent); + if (type === 0) { + this._printComment(comment, shouldSkipNewline && node.type !== "ObjectExpression" || singleLine && isFunction(parent, { + body: node + }) ? 1 : 0); + } else if (shouldSkipNewline && type === 2) { + this._printComment(comment, 1); + } else { + this._printComment(comment, 0); + } + } else if (type === 1 && !(node.type === "ObjectExpression" && node.properties.length > 1) && node.type !== "ClassBody" && node.type !== "TSInterfaceBody") { + + this._printComment(comment, i === 0 ? 2 : i === len - 1 ? 3 : 0); + } else { + this._printComment(comment, 0); + } } } - } - - printAssertions(node) { - var _node$assertions; - - if ((_node$assertions = node.assertions) != null && _node$assertions.length) { - this.space(); - this.word("assert"); - this.space(); - this.tokenChar(123); - this.space(); - this.printList(node.assertions, node); - this.space(); - this.tokenChar(125); + if (type === 2 && hasLoc && lastLine) { + this._lastCommentLine = lastLine; } } - } Object.assign(Printer.prototype, generatorFunctions); @@ -607,7 +656,6 @@ Object.assign(Printer.prototype, generatorFunctions); } var _default = Printer; exports.default = _default; - function commaSeparator() { this.tokenChar(44); this.space(); diff --git a/node_modules/@babel/generator/lib/printer.js.map b/node_modules/@babel/generator/lib/printer.js.map index cdca3d196..41e2c18d6 100644 --- a/node_modules/@babel/generator/lib/printer.js.map +++ b/node_modules/@babel/generator/lib/printer.js.map @@ -1 +1 @@ -{"version":3,"names":["SCIENTIFIC_NOTATION","ZERO_DECIMAL_INTEGER","NON_DECIMAL_LITERAL","PURE_ANNOTATION_RE","needsParens","needsWhitespaceAfter","needsWhitespaceBefore","n","Printer","constructor","format","map","inForStatementInitCounter","_printStack","_indent","_indentChar","_indentRepeat","_insideAux","_parenPushNewlineState","_noLineTerminator","_printAuxAfterOnNextUserNode","_printedComments","Set","_endsWithInteger","_endsWithWord","_buf","Buffer","indent","style","charCodeAt","length","generate","ast","print","_maybeAddAuxComment","get","compact","concise","dedent","semicolon","force","_appendChar","_queue","rightBrace","minified","removeLastSemicolon","token","space","_space","hasContent","lastCp","getLastChar","word","str","endsWith","_append","number","Number","isInteger","test","maybeNewline","lastChar","strFirst","tokenChar","char","newline","i","retainLines","charBeforeNewline","endsWithCharAndNewline","j","_newline","removeTrailingNewline","exactSource","loc","cb","_catchUp","source","prop","withSource","_maybeAddParen","_maybeIndent","append","_maybeAddParenChar","appendChar","queue","firstChar","queueIndentation","_getIndent","parenPushNewlineState","printed","len","cha","chaPost","slice","pos","line","count","getCurrentLine","printTerminatorless","node","parent","isLabel","terminatorState","noLineTerminator","nodeType","type","oldConcise","_compact","printMethod","undefined","ReferenceError","JSON","stringify","name","push","oldInAux","shouldPrintParens","retainFunctionParens","extra","parenthesized","_printLeadingComments","bind","_printTrailingComments","pop","enteredPositionlessNode","_printAuxBeforeComment","_printAuxAfterComment","comment","auxiliaryCommentBefore","_printComment","value","auxiliaryCommentAfter","getPossibleRaw","raw","rawValue","printJoin","nodes","opts","newlineOpts","addNewlines","statement","_printNewline","iterator","separator","call","printAndIndentOnComments","leadingComments","printBlock","body","_printComments","_getComments","printInnerComments","innerComments","printSequence","printList","items","commaSeparator","leading","lines","needs","Math","min","trailingComments","skipNewLines","ignore","has","shouldPrintComment","add","isBlockComment","printNewLines","lastCharCode","val","adjustMultilineComment","offset","start","column","newlineRegex","RegExp","replace","indentSize","max","getCurrentColumn","repeat","comments","inlinePureAnnotation","printAssertions","assertions","Object","assign","prototype","generatorFunctions","Noop"],"sources":["../src/printer.ts"],"sourcesContent":["import Buffer from \"./buffer\";\nimport type { Loc } from \"./buffer\";\nimport * as n from \"./node\";\nimport type * as t from \"@babel/types\";\nimport type {\n RecordAndTuplePluginOptions,\n PipelineOperatorPluginOptions,\n} from \"@babel/parser\";\nimport type { Opts as jsescOptions } from \"jsesc\";\n\nimport * as generatorFunctions from \"./generators\";\nimport type SourceMap from \"./source-map\";\nimport * as charCodes from \"charcodes\";\n\nconst SCIENTIFIC_NOTATION = /e/i;\nconst ZERO_DECIMAL_INTEGER = /\\.0+$/;\nconst NON_DECIMAL_LITERAL = /^0[box]/;\nconst PURE_ANNOTATION_RE = /^\\s*[@#]__PURE__\\s*$/;\n\nconst { needsParens, needsWhitespaceAfter, needsWhitespaceBefore } = n;\n\nexport type Format = {\n shouldPrintComment: (comment: string) => boolean;\n retainLines: boolean;\n retainFunctionParens: boolean;\n comments: boolean;\n auxiliaryCommentBefore: string;\n auxiliaryCommentAfter: string;\n compact: boolean | \"auto\";\n minified: boolean;\n concise: boolean;\n indent: {\n adjustMultilineComment: boolean;\n style: string;\n };\n recordAndTupleSyntaxType: RecordAndTuplePluginOptions[\"syntaxType\"];\n jsescOption: jsescOptions;\n jsonCompatibleStrings?: boolean;\n /**\n * For use with the Hack-style pipe operator.\n * Changes what token is used for pipe bodies’ topic references.\n */\n topicToken?: PipelineOperatorPluginOptions[\"topicToken\"];\n /**\n * @deprecated Removed in Babel 8\n */\n decoratorsBeforeExport?: boolean;\n};\n\ninterface AddNewlinesOptions {\n addNewlines(leading: boolean, node: t.Node): number;\n}\n\ninterface PrintSequenceOptions extends Partial {\n statement?: boolean;\n indent?: boolean;\n}\n\ninterface PrintListOptions {\n separator?: (this: Printer) => void;\n statement?: boolean;\n indent?: boolean;\n}\n\ntype PrintJoinOptions = PrintListOptions &\n PrintSequenceOptions & {\n iterator?: (node: t.Node, index: number) => void;\n };\nclass Printer {\n constructor(format: Format, map: SourceMap) {\n this.format = format;\n this._buf = new Buffer(map);\n\n this._indentChar = format.indent.style.charCodeAt(0);\n this._indentRepeat = format.indent.style.length;\n }\n\n declare format: Format;\n inForStatementInitCounter: number = 0;\n\n declare _buf: Buffer;\n _printStack: Array = [];\n _indent: number = 0;\n _indentChar: number = 0;\n _indentRepeat: number = 0;\n _insideAux: boolean = false;\n _parenPushNewlineState: { printed: boolean } | null = null;\n _noLineTerminator: boolean = false;\n _printAuxAfterOnNextUserNode: boolean = false;\n _printedComments = new Set();\n _endsWithInteger = false;\n _endsWithWord = false;\n\n generate(ast: t.Node) {\n this.print(ast);\n this._maybeAddAuxComment();\n\n return this._buf.get();\n }\n\n /**\n * Increment indent size.\n */\n\n indent(): void {\n if (this.format.compact || this.format.concise) return;\n\n this._indent++;\n }\n\n /**\n * Decrement indent size.\n */\n\n dedent(): void {\n if (this.format.compact || this.format.concise) return;\n\n this._indent--;\n }\n\n /**\n * Add a semicolon to the buffer.\n */\n\n semicolon(force: boolean = false): void {\n this._maybeAddAuxComment();\n if (force) {\n this._appendChar(charCodes.semicolon);\n } else {\n this._queue(charCodes.semicolon);\n }\n }\n\n /**\n * Add a right brace to the buffer.\n */\n\n rightBrace(): void {\n if (this.format.minified) {\n this._buf.removeLastSemicolon();\n }\n this.token(\"}\");\n }\n\n /**\n * Add a space to the buffer unless it is compact.\n */\n\n space(force: boolean = false): void {\n if (this.format.compact) return;\n\n if (force) {\n this._space();\n } else if (this._buf.hasContent()) {\n const lastCp = this.getLastChar();\n if (lastCp !== charCodes.space && lastCp !== charCodes.lineFeed) {\n this._space();\n }\n }\n }\n\n /**\n * Writes a token that can't be safely parsed without taking whitespace into account.\n */\n\n word(str: string): void {\n // prevent concatenating words and creating // comment out of division and regex\n if (\n this._endsWithWord ||\n (str.charCodeAt(0) === charCodes.slash && this.endsWith(charCodes.slash))\n ) {\n this._space();\n }\n\n this._maybeAddAuxComment();\n this._append(str, false);\n\n this._endsWithWord = true;\n }\n\n /**\n * Writes a number token so that we can validate if it is an integer.\n */\n\n number(str: string): void {\n this.word(str);\n\n // Integer tokens need special handling because they cannot have '.'s inserted\n // immediately after them.\n this._endsWithInteger =\n Number.isInteger(+str) &&\n !NON_DECIMAL_LITERAL.test(str) &&\n !SCIENTIFIC_NOTATION.test(str) &&\n !ZERO_DECIMAL_INTEGER.test(str) &&\n str.charCodeAt(str.length - 1) !== charCodes.dot;\n }\n\n /**\n * Writes a simple token.\n */\n\n token(str: string, maybeNewline = false): void {\n // space is mandatory to avoid outputting ` line comment\n const comment = this.skipLineComment(3);\n if (comment !== undefined) {\n this.addComment(comment);\n if (this.options.attachComment) comments.push(comment);\n }\n } else {\n break loop;\n }\n } else if (ch === charCodes.lessThan && !this.inModule) {\n const pos = this.state.pos;\n if (\n this.input.charCodeAt(pos + 1) === charCodes.exclamationMark &&\n this.input.charCodeAt(pos + 2) === charCodes.dash &&\n this.input.charCodeAt(pos + 3) === charCodes.dash\n ) {\n // `` line comment\n const comment = this.skipLineComment(3);\n if (comment !== undefined) {\n this.addComment(comment);\n if (this.options.attachComment) comments.push(comment);\n }\n } else {\n break loop;\n }\n } else if (ch === charCodes.lessThan && !this.inModule) {\n const pos = this.state.pos;\n if (\n this.input.charCodeAt(pos + 1) === charCodes.exclamationMark &&\n this.input.charCodeAt(pos + 2) === charCodes.dash &&\n this.input.charCodeAt(pos + 3) === charCodes.dash\n ) {\n // ` - -> This module contains methods for building ASTs manually and for checking the types of AST nodes. - -## Install - -\`\`\`sh -npm install --save-dev @babel/types -\`\`\` - -## API`, -]; - -const customTypes = { - ClassMethod: { - key: "if computed then `Expression` else `Identifier | Literal`", - }, - Identifier: { - name: "`string`", - }, - MemberExpression: { - property: "if computed then `Expression` else `Identifier`", - }, - ObjectMethod: { - key: "if computed then `Expression` else `Identifier | Literal`", - }, - ObjectProperty: { - key: "if computed then `Expression` else `Identifier | Literal`", - }, - ClassPrivateMethod: { - computed: "'false'", - }, - ClassPrivateProperty: { - computed: "'false'", - }, -}; -const APIHistory = { - ClassProperty: [["v7.6.0", "Supports `static`"]], -}; -function formatHistory(historyItems) { - const lines = historyItems.map( - item => "| `" + item[0] + "` | " + item[1] + " |" - ); - return [ - "
", - " History", - "| Version | Changes |", - "| --- | --- |", - ...lines, - "
", - ]; -} -function printAPIHistory(key, readme) { - if (APIHistory[key]) { - readme.push(""); - readme.push(...formatHistory(APIHistory[key])); - } -} -function printNodeFields(key, readme) { - if (Object.keys(t.NODE_FIELDS[key]).length > 0) { - readme.push(""); - readme.push("AST Node `" + key + "` shape:"); - Object.keys(t.NODE_FIELDS[key]) - .sort(function (fieldA, fieldB) { - const indexA = t.BUILDER_KEYS[key].indexOf(fieldA); - const indexB = t.BUILDER_KEYS[key].indexOf(fieldB); - if (indexA === indexB) return fieldA < fieldB ? -1 : 1; - if (indexA === -1) return 1; - if (indexB === -1) return -1; - return indexA - indexB; - }) - .forEach(function (field) { - const defaultValue = t.NODE_FIELDS[key][field].default; - const fieldDescription = ["`" + field + "`"]; - const validator = t.NODE_FIELDS[key][field].validate; - if (customTypes[key] && customTypes[key][field]) { - fieldDescription.push(`: ${customTypes[key][field]}`); - } else if (validator) { - try { - fieldDescription.push( - ": `" + stringifyValidator(validator, "") + "`" - ); - } catch (ex) { - if (ex.code === "UNEXPECTED_VALIDATOR_TYPE") { - console.log( - "Unrecognised validator type for " + key + "." + field - ); - console.dir(ex.validator, { depth: 10, colors: true }); - } - } - } - if (defaultValue !== null || t.NODE_FIELDS[key][field].optional) { - fieldDescription.push( - " (default: `" + util.inspect(defaultValue) + "`" - ); - if (t.BUILDER_KEYS[key].indexOf(field) < 0) { - fieldDescription.push(", excluded from builder function"); - } - fieldDescription.push(")"); - } else { - fieldDescription.push(" (required)"); - } - readme.push("- " + fieldDescription.join("")); - }); - } -} - -function printAliasKeys(key, readme) { - if (t.ALIAS_KEYS[key] && t.ALIAS_KEYS[key].length) { - readme.push(""); - readme.push( - "Aliases: " + - t.ALIAS_KEYS[key] - .map(function (key) { - return "[`" + key + "`](#" + key.toLowerCase() + ")"; - }) - .join(", ") - ); - } -} -readme.push("### Node Builders"); -readme.push(""); -Object.keys(t.BUILDER_KEYS) - .sort() - .forEach(function (key) { - readme.push("#### " + toFunctionName(key)); - readme.push(""); - readme.push("```javascript"); - readme.push( - "t." + toFunctionName(key) + "(" + t.BUILDER_KEYS[key].join(", ") + ");" - ); - readme.push("```"); - printAPIHistory(key, readme); - readme.push(""); - readme.push( - "See also `t.is" + - key + - "(node, opts)` and `t.assert" + - key + - "(node, opts)`." - ); - - printNodeFields(key, readme); - printAliasKeys(key, readme); - - readme.push(""); - readme.push("---"); - readme.push(""); - }); - -function generateMapAliasToNodeTypes() { - const result = new Map(); - for (const nodeType of Object.keys(t.ALIAS_KEYS)) { - const aliases = t.ALIAS_KEYS[nodeType]; - if (!aliases) continue; - for (const alias of aliases) { - if (!result.has(alias)) { - result.set(alias, []); - } - const nodeTypes = result.get(alias); - nodeTypes.push(nodeType); - } - } - return result; -} -const aliasDescriptions = { - Accessor: "Deprecated. Will be removed in Babel 8.", - Binary: - "A cover of BinaryExpression and LogicalExpression, which share the same AST shape.", - Block: "Deprecated. Will be removed in Babel 8.", - BlockParent: - "A cover of AST nodes that start an execution context with new [LexicalEnvironment](https://tc39.es/ecma262/#table-additional-state-components-for-ecmascript-code-execution-contexts). In other words, they define the scope of `let` and `const` declarations.", - Class: - "A cover of ClassExpression and ClassDeclaration, which share the same AST shape.", - CompletionStatement: - "A statement that indicates the [completion records](https://tc39.es/ecma262/#sec-completion-record-specification-type). In other words, they define the control flow of the program, such as when should a loop break or an action throws critical errors.", - Conditional: - "A cover of ConditionalExpression and IfStatement, which share the same AST shape.", - Declaration: - "A cover of any [Declaration](https://tc39.es/ecma262/#prod-Declaration)s.", - EnumBody: "A cover of Flow enum bodies.", - EnumMember: "A cover of Flow enum membors.", - ExportDeclaration: - "A cover of any [ExportDeclaration](https://tc39.es/ecma262/#prod-ExportDeclaration)s.", - Expression: - "A cover of any [Expression](https://tc39.es/ecma262/#sec-ecmascript-language-expressions)s.", - ExpressionWrapper: - "A wrapper of expression that does not have runtime semantics.", - Flow: "A cover of AST nodes defined for Flow.", - FlowBaseAnnotation: "A cover of primary Flow type annotations.", - FlowDeclaration: "A cover of Flow declarations.", - FlowPredicate: "A cover of Flow predicates.", - FlowType: "A cover of Flow type annotations.", - For: "A cover of [ForStatement](https://tc39.es/ecma262/#sec-for-statement)s and [ForXStatement](#forxstatement)s.", - ForXStatement: - "A cover of [ForInStatements and ForOfStatements](https://tc39.es/ecma262/#sec-for-in-and-for-of-statements).", - Function: - "A cover of functions and [method](#method)s, the must have `body` and `params`. Note: `Function` is different to `FunctionParent`. For example, a `StaticBlock` is a `FunctionParent` but not `Function`.", - FunctionParent: - "A cover of AST nodes that start an execution context with new [VariableEnvironment](https://tc39.es/ecma262/#table-additional-state-components-for-ecmascript-code-execution-contexts). In other words, they define the scope of `var` declarations. FunctionParent did not include `Program` since Babel 7.", - Immutable: - "A cover of immutable objects and JSX elements. An object is [immutable](https://tc39.es/ecma262/#immutable-prototype-exotic-object) if no other properties can be defined once created.", - JSX: "A cover of AST nodes defined for [JSX](https://facebook.github.io/jsx/).", - LVal: "A cover of left hand side expressions used in the `left` of assignment expressions and [ForXStatement](#forxstatement)s. ", - Literal: - "A cover of [Literal](https://tc39.es/ecma262/#sec-primary-expression-literals)s, [Regular Expression Literal](https://tc39.es/ecma262/#sec-primary-expression-regular-expression-literals)s and [Template Literal](https://tc39.es/ecma262/#sec-template-literals)s.", - Loop: "A cover of loop statements.", - Method: "A cover of object methods and class methods.", - Miscellaneous: - "A cover of non-standard AST types that are sometimes useful for development.", - ModuleDeclaration: - "A cover of ImportDeclaration and [ExportDeclaration](#exportdeclaration)", - ModuleSpecifier: - "A cover of import and export specifiers. Note: It is _not_ the [ModuleSpecifier](https://tc39.es/ecma262/#prod-ModuleSpecifier) defined in the spec.", - ObjectMember: - "A cover of [members](https://tc39.es/ecma262/#prod-PropertyDefinitionList) in an object literal.", - Pattern: - "A cover of [BindingPattern](https://tc39.es/ecma262/#prod-BindingPattern) except Identifiers.", - PatternLike: - "A cover of [BindingPattern](https://tc39.es/ecma262/#prod-BindingPattern)s. ", - Private: "A cover of private class elements and private identifiers.", - Property: "A cover of object properties and class properties.", - Pureish: - "A cover of AST nodes which do not have side-effects. In other words, there is no observable behaviour changes if they are evaluated more than once.", - Scopable: - "A cover of [FunctionParent](#functionparent) and [BlockParent](#blockparent).", - Standardized: - "A cover of AST nodes which are part of an official ECMAScript specification.", - Statement: - "A cover of any [Statement](https://tc39.es/ecma262/#prod-Statement)s.", - TSBaseType: "A cover of primary TypeScript type annotations.", - TSEntityName: "A cover of ts entities.", - TSType: "A cover of TypeScript type annotations.", - TSTypeElement: "A cover of TypeScript type declarations.", - TypeScript: "A cover of AST nodes defined for TypeScript.", - Terminatorless: - "A cover of AST nodes whose semantic will change when a line terminator is inserted between the operator and the operand.", - UnaryLike: "A cover of UnaryExpression and SpreadElement.", - UserWhitespacable: "Deprecated. Will be removed in Babel 8.", - While: - "A cover of DoWhileStatement and WhileStatement, which share the same AST shape.", -}; -const mapAliasToNodeTypes = generateMapAliasToNodeTypes(); -readme.push("### Aliases"); -readme.push(""); -for (const alias of [...mapAliasToNodeTypes.keys()].sort()) { - const nodeTypes = mapAliasToNodeTypes.get(alias); - nodeTypes.sort(); - if (!(alias in aliasDescriptions)) { - throw new Error( - 'Missing alias descriptions of "' + - alias + - ", which covers " + - nodeTypes.join(",") - ); - } - readme.push("#### " + alias); - readme.push(""); - readme.push(aliasDescriptions[alias]); - readme.push("```javascript"); - readme.push("t.is" + alias + "(node);"); - readme.push("```"); - readme.push(""); - readme.push("Covered nodes: "); - for (const nodeType of nodeTypes) { - readme.push("- [`" + nodeType + "`](#" + nodeType.toLowerCase() + ")"); - } - readme.push(""); -} - -process.stdout.write(readme.join("\n")); diff --git a/node_modules/@babel/types/scripts/generators/flow.js b/node_modules/@babel/types/scripts/generators/flow.js deleted file mode 100644 index 06cd388ce..000000000 --- a/node_modules/@babel/types/scripts/generators/flow.js +++ /dev/null @@ -1,260 +0,0 @@ -import * as t from "../../lib/index.js"; -import stringifyValidator from "../utils/stringifyValidator.js"; -import toFunctionName from "../utils/toFunctionName.js"; - -const NODE_PREFIX = "BabelNode"; - -let code = `// NOTE: This file is autogenerated. Do not modify. -// See packages/babel-types/scripts/generators/flow.js for script used. - -declare class ${NODE_PREFIX}Comment { - value: string; - start: number; - end: number; - loc: ${NODE_PREFIX}SourceLocation; -} - -declare class ${NODE_PREFIX}CommentBlock extends ${NODE_PREFIX}Comment { - type: "CommentBlock"; -} - -declare class ${NODE_PREFIX}CommentLine extends ${NODE_PREFIX}Comment { - type: "CommentLine"; -} - -declare class ${NODE_PREFIX}SourceLocation { - start: { - line: number; - column: number; - }; - - end: { - line: number; - column: number; - }; -} - -declare class ${NODE_PREFIX} { - leadingComments?: Array<${NODE_PREFIX}Comment>; - innerComments?: Array<${NODE_PREFIX}Comment>; - trailingComments?: Array<${NODE_PREFIX}Comment>; - start: ?number; - end: ?number; - loc: ?${NODE_PREFIX}SourceLocation; - extra?: { [string]: mixed }; -}\n\n`; - -// - -const lines = []; - -for (const type in t.NODE_FIELDS) { - const fields = t.NODE_FIELDS[type]; - - const struct = ['type: "' + type + '";']; - const args = []; - const builderNames = t.BUILDER_KEYS[type]; - - Object.keys(t.NODE_FIELDS[type]) - .sort((fieldA, fieldB) => { - const indexA = t.BUILDER_KEYS[type].indexOf(fieldA); - const indexB = t.BUILDER_KEYS[type].indexOf(fieldB); - if (indexA === indexB) return fieldA < fieldB ? -1 : 1; - if (indexA === -1) return 1; - if (indexB === -1) return -1; - return indexA - indexB; - }) - .forEach(fieldName => { - const field = fields[fieldName]; - - let suffix = ""; - if (field.optional || field.default != null) suffix += "?"; - - let typeAnnotation = "any"; - - const validate = field.validate; - if (validate) { - typeAnnotation = stringifyValidator(validate, NODE_PREFIX); - } - - if (typeAnnotation) { - suffix += ": " + typeAnnotation; - } - if (builderNames.includes(fieldName)) { - args.push(t.toBindingIdentifierName(fieldName) + suffix); - } - - if (t.isValidIdentifier(fieldName)) { - struct.push(fieldName + suffix + ";"); - } - }); - - code += `declare class ${NODE_PREFIX}${type} extends ${NODE_PREFIX} { - ${struct.join("\n ").trim()} -}\n\n`; - - // Flow chokes on super() and import() :/ - if (type !== "Super" && type !== "Import") { - lines.push( - `declare export function ${toFunctionName(type)}(${args.join( - ", " - )}): ${NODE_PREFIX}${type};` - ); - } else { - const functionName = toFunctionName(type); - lines.push( - `declare function _${functionName}(${args.join( - ", " - )}): ${NODE_PREFIX}${type};`, - `declare export { _${functionName} as ${functionName} }` - ); - } -} - -for (const typeName of t.TYPES) { - const isDeprecated = !!t.DEPRECATED_KEYS[typeName]; - const realName = isDeprecated ? t.DEPRECATED_KEYS[typeName] : typeName; - - let decl = `declare export function is${typeName}(node: ?Object, opts?: ?Object): boolean`; - if (t.NODE_FIELDS[realName]) { - decl += ` %checks (node instanceof ${NODE_PREFIX}${realName})`; - } - lines.push(decl); - - lines.push( - `declare export function assert${typeName}(node: ?Object, opts?: ?Object): void` - ); -} - -lines.push( - `declare export var VISITOR_KEYS: { [type: string]: string[] }`, - - // assert/ - `declare export function assertNode(obj: any): void`, - - // builders/ - // eslint-disable-next-line max-len - `declare export function createTypeAnnotationBasedOnTypeof(type: 'string' | 'number' | 'undefined' | 'boolean' | 'function' | 'object' | 'symbol'): ${NODE_PREFIX}TypeAnnotation`, - // eslint-disable-next-line max-len - `declare export function createUnionTypeAnnotation(types: Array<${NODE_PREFIX}FlowType>): ${NODE_PREFIX}UnionTypeAnnotation`, - // eslint-disable-next-line max-len - `declare export function createFlowUnionType(types: Array<${NODE_PREFIX}FlowType>): ${NODE_PREFIX}UnionTypeAnnotation`, - // this smells like "internal API" - // eslint-disable-next-line max-len - `declare export function buildChildren(node: { children: Array<${NODE_PREFIX}JSXText | ${NODE_PREFIX}JSXExpressionContainer | ${NODE_PREFIX}JSXSpreadChild | ${NODE_PREFIX}JSXElement | ${NODE_PREFIX}JSXFragment | ${NODE_PREFIX}JSXEmptyExpression> }): Array<${NODE_PREFIX}JSXText | ${NODE_PREFIX}JSXExpressionContainer | ${NODE_PREFIX}JSXSpreadChild | ${NODE_PREFIX}JSXElement | ${NODE_PREFIX}JSXFragment>`, - - // clone/ - `declare export function clone(n: T): T;`, - `declare export function cloneDeep(n: T): T;`, - `declare export function cloneDeepWithoutLoc(n: T): T;`, - `declare export function cloneNode(n: T, deep?: boolean, withoutLoc?: boolean): T;`, - `declare export function cloneWithoutLoc(n: T): T;`, - - // comments/ - `declare type CommentTypeShorthand = 'leading' | 'inner' | 'trailing'`, - // eslint-disable-next-line max-len - `declare export function addComment(node: T, type: CommentTypeShorthand, content: string, line?: boolean): T`, - // eslint-disable-next-line max-len - `declare export function addComments(node: T, type: CommentTypeShorthand, comments: Array): T`, - `declare export function inheritInnerComments(node: BabelNode, parent: BabelNode): void`, - `declare export function inheritLeadingComments(node: BabelNode, parent: BabelNode): void`, - `declare export function inheritsComments(node: T, parent: BabelNode): void`, - `declare export function inheritTrailingComments(node: BabelNode, parent: BabelNode): void`, - `declare export function removeComments(node: T): T`, - - // converters/ - `declare export function ensureBlock(node: ${NODE_PREFIX}, key: string): ${NODE_PREFIX}BlockStatement`, - `declare export function toBindingIdentifierName(name?: ?string): string`, - // eslint-disable-next-line max-len - `declare export function toBlock(node: ${NODE_PREFIX}Statement | ${NODE_PREFIX}Expression, parent?: ${NODE_PREFIX}Function | null): ${NODE_PREFIX}BlockStatement`, - // eslint-disable-next-line max-len - `declare export function toComputedKey(node: ${NODE_PREFIX}Method | ${NODE_PREFIX}Property, key?: ${NODE_PREFIX}Expression | ${NODE_PREFIX}Identifier): ${NODE_PREFIX}Expression`, - // eslint-disable-next-line max-len - `declare export function toExpression(node: ${NODE_PREFIX}ExpressionStatement | ${NODE_PREFIX}Expression | ${NODE_PREFIX}Class | ${NODE_PREFIX}Function): ${NODE_PREFIX}Expression`, - `declare export function toIdentifier(name?: ?string): string`, - // eslint-disable-next-line max-len - `declare export function toKeyAlias(node: ${NODE_PREFIX}Method | ${NODE_PREFIX}Property, key?: ${NODE_PREFIX}): string`, - // toSequenceExpression relies on types that aren't declared in flow - // eslint-disable-next-line max-len - `declare export function toStatement(node: ${NODE_PREFIX}Statement | ${NODE_PREFIX}Class | ${NODE_PREFIX}Function | ${NODE_PREFIX}AssignmentExpression, ignore?: boolean): ${NODE_PREFIX}Statement | void`, - `declare export function valueToNode(value: any): ${NODE_PREFIX}Expression`, - - // modifications/ - // eslint-disable-next-line max-len - `declare export function removeTypeDuplicates(types: Array<${NODE_PREFIX}FlowType>): Array<${NODE_PREFIX}FlowType>`, - // eslint-disable-next-line max-len - `declare export function appendToMemberExpression(member: ${NODE_PREFIX}MemberExpression, append: ${NODE_PREFIX}, computed?: boolean): ${NODE_PREFIX}MemberExpression`, - // eslint-disable-next-line max-len - `declare export function inherits(child: T, parent: ${NODE_PREFIX} | null | void): T`, - // eslint-disable-next-line max-len - `declare export function prependToMemberExpression(member: ${NODE_PREFIX}MemberExpression, prepend: ${NODE_PREFIX}Expression): ${NODE_PREFIX}MemberExpression`, - `declare export function removeProperties(n: T, opts: ?{}): void;`, - `declare export function removePropertiesDeep(n: T, opts: ?{}): T;`, - - // retrievers/ - // eslint-disable-next-line max-len - `declare export var getBindingIdentifiers: { - (node: ${NODE_PREFIX}, duplicates?: boolean, outerOnly?: boolean): { [key: string]: ${NODE_PREFIX}Identifier | Array<${NODE_PREFIX}Identifier> }, - keys: { [type: string]: string[] } - }`, - // eslint-disable-next-line max-len - `declare export function getOuterBindingIdentifiers(node: BabelNode, duplicates?: boolean): { [key: string]: ${NODE_PREFIX}Identifier | Array<${NODE_PREFIX}Identifier> }`, - - // traverse/ - `declare type TraversalAncestors = Array<{ - node: BabelNode, - key: string, - index?: number, - }>; - declare type TraversalHandler = (BabelNode, TraversalAncestors, T) => void; - declare type TraversalHandlers = { - enter?: TraversalHandler, - exit?: TraversalHandler, - };`.replace(/(^|\n) {2}/g, "$1"), - // eslint-disable-next-line - `declare export function traverse(n: BabelNode, TraversalHandler | TraversalHandlers, state?: T): void;`, - `declare export function traverseFast(n: BabelNode, h: TraversalHandler, state?: T): void;`, - - // utils/ - // cleanJSXElementLiteralChild is not exported - // inherit is not exported - `declare export function shallowEqual(actual: Object, expected: Object): boolean`, - - // validators/ - // eslint-disable-next-line max-len - `declare export function buildMatchMemberExpression(match: string, allowPartial?: boolean): (?BabelNode) => boolean`, - `declare export function is(type: string, n: BabelNode, opts: Object): boolean;`, - `declare export function isBinding(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean`, - `declare export function isBlockScoped(node: BabelNode): boolean`, - `declare export function isImmutable(node: BabelNode): boolean`, - `declare export function isLet(node: BabelNode): boolean`, - `declare export function isNode(node: ?Object): boolean`, - `declare export function isNodesEquivalent(a: any, b: any): boolean`, - `declare export function isPlaceholderType(placeholderType: string, targetType: string): boolean`, - `declare export function isReferenced(node: BabelNode, parent: BabelNode, grandparent?: BabelNode): boolean`, - `declare export function isScope(node: BabelNode, parent: BabelNode): boolean`, - `declare export function isSpecifierDefault(specifier: BabelNodeModuleSpecifier): boolean`, - `declare export function isType(nodetype: ?string, targetType: string): boolean`, - `declare export function isValidES3Identifier(name: string): boolean`, - `declare export function isValidES3Identifier(name: string): boolean`, - `declare export function isValidIdentifier(name: string): boolean`, - `declare export function isVar(node: BabelNode): boolean`, - // eslint-disable-next-line max-len - `declare export function matchesPattern(node: ?BabelNode, match: string | Array, allowPartial?: boolean): boolean`, - `declare export function validate(n: BabelNode, key: string, value: mixed): void;` -); - -for (const type in t.FLIPPED_ALIAS_KEYS) { - const types = t.FLIPPED_ALIAS_KEYS[type]; - code += `type ${NODE_PREFIX}${type} = ${types - .map(type => `${NODE_PREFIX}${type}`) - .join(" | ")};\n`; -} - -code += `\ndeclare module "@babel/types" { - ${lines.join("\n").replace(/\n/g, "\n ").trim()} -}\n`; - -// - -process.stdout.write(code); diff --git a/node_modules/@babel/types/scripts/generators/typescript-legacy.js b/node_modules/@babel/types/scripts/generators/typescript-legacy.js deleted file mode 100644 index 770104715..000000000 --- a/node_modules/@babel/types/scripts/generators/typescript-legacy.js +++ /dev/null @@ -1,369 +0,0 @@ -import * as t from "../../lib/index.js"; -import stringifyValidator from "../utils/stringifyValidator.js"; -import toFunctionName from "../utils/toFunctionName.js"; - -let code = `// NOTE: This file is autogenerated. Do not modify. -// See packages/babel-types/scripts/generators/typescript-legacy.js for script used. - -interface BaseComment { - value: string; - start: number; - end: number; - loc: SourceLocation; - type: "CommentBlock" | "CommentLine"; -} - -export interface CommentBlock extends BaseComment { - type: "CommentBlock"; -} - -export interface CommentLine extends BaseComment { - type: "CommentLine"; -} - -export type Comment = CommentBlock | CommentLine; - -export interface SourceLocation { - start: { - line: number; - column: number; - }; - - end: { - line: number; - column: number; - }; -} - -interface BaseNode { - leadingComments: ReadonlyArray | null; - innerComments: ReadonlyArray | null; - trailingComments: ReadonlyArray | null; - start: number | null; - end: number | null; - loc: SourceLocation | null; - type: Node["type"]; - extra?: Record; -} - -export type Node = ${t.TYPES.sort().join(" | ")};\n\n`; - -// - -const lines = []; - -for (const type in t.NODE_FIELDS) { - const fields = t.NODE_FIELDS[type]; - const fieldNames = sortFieldNames(Object.keys(t.NODE_FIELDS[type]), type); - const builderNames = t.BUILDER_KEYS[type]; - - const struct = ['type: "' + type + '";']; - const args = []; - - fieldNames.forEach(fieldName => { - const field = fields[fieldName]; - // Future / annoying TODO: - // MemberExpression.property, ObjectProperty.key and ObjectMethod.key need special cases; either: - // - convert the declaration to chain() like ClassProperty.key and ClassMethod.key, - // - declare an alias type for valid keys, detect the case and reuse it here, - // - declare a disjoint union with, for example, ObjectPropertyBase, - // ObjectPropertyLiteralKey and ObjectPropertyComputedKey, and declare ObjectProperty - // as "ObjectPropertyBase & (ObjectPropertyLiteralKey | ObjectPropertyComputedKey)" - let typeAnnotation = stringifyValidator(field.validate, ""); - - if (isNullable(field) && !hasDefault(field)) { - typeAnnotation += " | null"; - } - - if (builderNames.includes(fieldName)) { - if (areAllRemainingFieldsNullable(fieldName, builderNames, fields)) { - args.push( - `${t.toBindingIdentifierName(fieldName)}${ - isNullable(field) ? "?:" : ":" - } ${typeAnnotation}` - ); - } else { - args.push( - `${t.toBindingIdentifierName(fieldName)}: ${typeAnnotation}${ - isNullable(field) ? " | undefined" : "" - }` - ); - } - } - - const alphaNumeric = /^\w+$/; - - if (t.isValidIdentifier(fieldName) || alphaNumeric.test(fieldName)) { - struct.push(`${fieldName}: ${typeAnnotation};`); - } else { - struct.push(`"${fieldName}": ${typeAnnotation};`); - } - }); - - code += `export interface ${type} extends BaseNode { - ${struct.join("\n ").trim()} -}\n\n`; - - // super and import are reserved words in JavaScript - if (type !== "Super" && type !== "Import") { - lines.push( - `export function ${toFunctionName(type)}(${args.join(", ")}): ${type};` - ); - } else { - const functionName = toFunctionName(type); - lines.push( - `declare function _${functionName}(${args.join(", ")}): ${type};`, - `export { _${functionName} as ${functionName}}` - ); - } -} - -for (const typeName of t.TYPES) { - const isDeprecated = !!t.DEPRECATED_KEYS[typeName]; - const realName = isDeprecated ? t.DEPRECATED_KEYS[typeName] : typeName; - - const result = - t.NODE_FIELDS[realName] || t.FLIPPED_ALIAS_KEYS[realName] - ? `node is ${realName}` - : "boolean"; - - if (isDeprecated) { - lines.push(`/** @deprecated Use \`is${realName}\` */`); - } - lines.push( - `export function is${typeName}(node: object | null | undefined, opts?: object | null): ${result};` - ); - - if (isDeprecated) { - lines.push(`/** @deprecated Use \`assert${realName}\` */`); - } - lines.push( - `export function assert${typeName}(node: object | null | undefined, opts?: object | null): void;` - ); -} - -lines.push( - // assert/ - `export function assertNode(obj: any): void`, - - // builders/ - // eslint-disable-next-line max-len - `export function createTypeAnnotationBasedOnTypeof(type: 'string' | 'number' | 'undefined' | 'boolean' | 'function' | 'object' | 'symbol'): StringTypeAnnotation | VoidTypeAnnotation | NumberTypeAnnotation | BooleanTypeAnnotation | GenericTypeAnnotation`, - `export function createUnionTypeAnnotation(types: [T]): T`, - `export function createFlowUnionType(types: [T]): T`, - // this probably misbehaves if there are 0 elements, and it's not a UnionTypeAnnotation if there's only 1 - // it is possible to require "2 or more" for this overload ([T, T, ...T[]]) but it requires typescript 3.0 - `export function createUnionTypeAnnotation(types: ReadonlyArray): UnionTypeAnnotation`, - `export function createFlowUnionType(types: ReadonlyArray): UnionTypeAnnotation`, - // this smells like "internal API" - // eslint-disable-next-line max-len - `export function buildChildren(node: { children: ReadonlyArray }): JSXElement['children']`, - - // clone/ - `export function clone(n: T): T;`, - `export function cloneDeep(n: T): T;`, - `export function cloneDeepWithoutLoc(n: T): T;`, - `export function cloneNode(n: T, deep?: boolean, withoutLoc?: boolean): T;`, - `export function cloneWithoutLoc(n: T): T;`, - - // comments/ - `export type CommentTypeShorthand = 'leading' | 'inner' | 'trailing'`, - // eslint-disable-next-line max-len - `export function addComment(node: T, type: CommentTypeShorthand, content: string, line?: boolean): T`, - // eslint-disable-next-line max-len - `export function addComments(node: T, type: CommentTypeShorthand, comments: ReadonlyArray): T`, - `export function inheritInnerComments(node: Node, parent: Node): void`, - `export function inheritLeadingComments(node: Node, parent: Node): void`, - `export function inheritsComments(node: T, parent: Node): void`, - `export function inheritTrailingComments(node: Node, parent: Node): void`, - `export function removeComments(node: T): T`, - - // converters/ - // eslint-disable-next-line max-len - `export function ensureBlock(node: Extract): BlockStatement`, - // too complex? - // eslint-disable-next-line max-len - `export function ensureBlock = 'body'>(node: Extract>, key: K): BlockStatement`, - // gatherSequenceExpressions is not exported - `export function toBindingIdentifierName(name: { toString(): string } | null | undefined): string`, - `export function toBlock(node: Statement | Expression, parent?: Function | null): BlockStatement`, - // it is possible for `node` to be an arbitrary object if `key` is always provided, - // but that doesn't look like intended API - // eslint-disable-next-line max-len - `export function toComputedKey>(node: T, key?: Expression | Identifier): Expression`, - `export function toExpression(node: Function): FunctionExpression`, - `export function toExpression(node: Class): ClassExpression`, - `export function toExpression(node: ExpressionStatement | Expression | Class | Function): Expression`, - `export function toIdentifier(name: { toString(): string } | null | undefined): string`, - `export function toKeyAlias(node: Method | Property, key?: Node): string`, - // NOTE: this actually uses Scope from @babel/traverse, but we can't add a dependency on its types, - // as they live in @types. Declare the structural subset that is required. - // eslint-disable-next-line max-len - `export function toSequenceExpression(nodes: ReadonlyArray, scope: { push(value: { id: LVal; kind: 'var'; init?: Expression}): void; buildUndefinedNode(): Node }): SequenceExpression | undefined`, - `export function toStatement(node: AssignmentExpression, ignore?: boolean): ExpressionStatement`, - `export function toStatement(node: Statement | AssignmentExpression, ignore?: boolean): Statement`, - `export function toStatement(node: Class, ignore: true): ClassDeclaration | undefined`, - `export function toStatement(node: Class, ignore?: boolean): ClassDeclaration`, - `export function toStatement(node: Function, ignore: true): FunctionDeclaration | undefined`, - `export function toStatement(node: Function, ignore?: boolean): FunctionDeclaration`, - // eslint-disable-next-line max-len - `export function toStatement(node: Statement | Class | Function | AssignmentExpression, ignore: true): Statement | undefined`, - // eslint-disable-next-line max-len - `export function toStatement(node: Statement | Class | Function | AssignmentExpression, ignore?: boolean): Statement`, - // eslint-disable-next-line max-len - `export function valueToNode(value: undefined): Identifier`, // (should this not be a UnaryExpression to avoid shadowing?) - `export function valueToNode(value: boolean): BooleanLiteral`, - `export function valueToNode(value: null): NullLiteral`, - `export function valueToNode(value: string): StringLiteral`, - // Infinities and NaN need to use a BinaryExpression; negative values must be wrapped in UnaryExpression - `export function valueToNode(value: number): NumericLiteral | BinaryExpression | UnaryExpression`, - `export function valueToNode(value: RegExp): RegExpLiteral`, - // eslint-disable-next-line max-len - `export function valueToNode(value: ReadonlyArray): ArrayExpression`, - // this throws with objects that are not PlainObject according to lodash, - // or if there are non-valueToNode-able values - `export function valueToNode(value: object): ObjectExpression`, - // eslint-disable-next-line max-len - `export function valueToNode(value: undefined | boolean | null | string | number | RegExp | object): Expression`, - - // modifications/ - // eslint-disable-next-line max-len - `export function removeTypeDuplicates(types: ReadonlyArray): FlowType[]`, - // eslint-disable-next-line max-len - `export function appendToMemberExpression>(member: T, append: MemberExpression['property'], computed?: boolean): T`, - // eslint-disable-next-line max-len - `export function inherits(child: T, parent: Node | null | undefined): T`, - // eslint-disable-next-line max-len - `export function prependToMemberExpression>(member: T, prepend: MemberExpression['object']): T`, - `export function removeProperties( - n: Node, - opts?: { preserveComments: boolean } | null -): void;`, - `export function removePropertiesDeep( - n: T, - opts?: { preserveComments: boolean } | null -): T;`, - - // retrievers/ - // eslint-disable-next-line max-len - `export function getBindingIdentifiers(node: Node, duplicates: true, outerOnly?: boolean): Record>`, - // eslint-disable-next-line max-len - `export function getBindingIdentifiers(node: Node, duplicates?: false, outerOnly?: boolean): Record`, - // eslint-disable-next-line max-len - `export function getBindingIdentifiers(node: Node, duplicates: boolean, outerOnly?: boolean): Record>`, - // eslint-disable-next-line max-len - `export function getOuterBindingIdentifiers(node: Node, duplicates: true): Record>`, - `export function getOuterBindingIdentifiers(node: Node, duplicates?: false): Record`, - // eslint-disable-next-line max-len - `export function getOuterBindingIdentifiers(node: Node, duplicates: boolean): Record>`, - - // traverse/ - `export type TraversalAncestors = ReadonlyArray<{ - node: Node, - key: string, - index?: number, - }>; - export type TraversalHandler = ( - this: undefined, node: Node, parent: TraversalAncestors, type: T - ) => void; - export type TraversalHandlers = { - enter?: TraversalHandler, - exit?: TraversalHandler, - };`.replace(/(^|\n) {2}/g, "$1"), - // eslint-disable-next-line - `export function traverse(n: Node, h: TraversalHandler | TraversalHandlers, state?: T): void;`, - `export function traverseFast(n: Node, h: TraversalHandler, state?: T): void;`, - - // utils/ - // cleanJSXElementLiteralChild is not exported - // inherit is not exported - `export function shallowEqual(actual: object, expected: T): actual is T`, - - // validators/ - // eslint-disable-next-line max-len - `export function buildMatchMemberExpression(match: string, allowPartial?: boolean): (node: Node | null | undefined) => node is MemberExpression`, - // eslint-disable-next-line max-len - `export function is(type: T, n: Node | null | undefined, required?: undefined): n is Extract`, - // eslint-disable-next-line max-len - `export function is>(type: T, n: Node | null | undefined, required: Partial

): n is P`, - // eslint-disable-next-line max-len - `export function is

(type: string, n: Node | null | undefined, required: Partial

): n is P`, - `export function is(type: string, n: Node | null | undefined, required?: Partial): n is Node`, - `export function isBinding(node: Node, parent: Node, grandparent?: Node): boolean`, - // eslint-disable-next-line max-len - `export function isBlockScoped(node: Node): node is FunctionDeclaration | ClassDeclaration | VariableDeclaration`, - `export function isImmutable(node: Node): node is Immutable`, - `export function isLet(node: Node): node is VariableDeclaration`, - `export function isNode(node: object | null | undefined): node is Node`, - `export function isNodesEquivalent>(a: T, b: any): b is T`, - `export function isNodesEquivalent(a: any, b: any): boolean`, - `export function isPlaceholderType(placeholderType: Node['type'], targetType: Node['type']): boolean`, - `export function isReferenced(node: Node, parent: Node, grandparent?: Node): boolean`, - `export function isScope(node: Node, parent: Node): node is Scopable`, - `export function isSpecifierDefault(specifier: ModuleSpecifier): boolean`, - `export function isType(nodetype: string, targetType: T): nodetype is T`, - `export function isType(nodetype: string | null | undefined, targetType: string): boolean`, - `export function isValidES3Identifier(name: string): boolean`, - `export function isValidIdentifier(name: string): boolean`, - `export function isVar(node: Node): node is VariableDeclaration`, - // the MemberExpression implication is incidental, but it follows from the implementation - // eslint-disable-next-line max-len - `export function matchesPattern(node: Node | null | undefined, match: string | ReadonlyArray, allowPartial?: boolean): node is MemberExpression`, - // eslint-disable-next-line max-len - `export function validate(n: Node | null | undefined, key: K, value: T[K]): void;`, - `export function validate(n: Node, key: string, value: any): void;` -); - -for (const type in t.DEPRECATED_KEYS) { - code += `/** - * @deprecated Use \`${t.DEPRECATED_KEYS[type]}\` - */ -export type ${type} = ${t.DEPRECATED_KEYS[type]};\n -`; -} - -for (const type in t.FLIPPED_ALIAS_KEYS) { - const types = t.FLIPPED_ALIAS_KEYS[type]; - code += `export type ${type} = ${types - .map(type => `${type}`) - .join(" | ")};\n`; -} -code += "\n"; - -code += "export interface Aliases {\n"; -for (const type in t.FLIPPED_ALIAS_KEYS) { - code += ` ${type}: ${type};\n`; -} -code += "}\n\n"; - -code += lines.join("\n") + "\n"; - -// - -process.stdout.write(code); - -// - -function areAllRemainingFieldsNullable(fieldName, fieldNames, fields) { - const index = fieldNames.indexOf(fieldName); - return fieldNames.slice(index).every(_ => isNullable(fields[_])); -} - -function hasDefault(field) { - return field.default != null; -} - -function isNullable(field) { - return field.optional || hasDefault(field); -} - -function sortFieldNames(fields, type) { - return fields.sort((fieldA, fieldB) => { - const indexA = t.BUILDER_KEYS[type].indexOf(fieldA); - const indexB = t.BUILDER_KEYS[type].indexOf(fieldB); - if (indexA === indexB) return fieldA < fieldB ? -1 : 1; - if (indexA === -1) return 1; - if (indexB === -1) return -1; - return indexA - indexB; - }); -} diff --git a/node_modules/@babel/types/scripts/generators/validators.js b/node_modules/@babel/types/scripts/generators/validators.js deleted file mode 100644 index f7ac23a51..000000000 --- a/node_modules/@babel/types/scripts/generators/validators.js +++ /dev/null @@ -1,91 +0,0 @@ -import { - DEPRECATED_KEYS, - FLIPPED_ALIAS_KEYS, - NODE_FIELDS, - PLACEHOLDERS, - PLACEHOLDERS_FLIPPED_ALIAS, - VISITOR_KEYS, -} from "../../lib/index.js"; - -const has = Function.call.bind(Object.prototype.hasOwnProperty); - -function joinComparisons(leftArr, right) { - return ( - leftArr.map(JSON.stringify).join(` === ${right} || `) + ` === ${right}` - ); -} - -function addIsHelper(type, aliasKeys, deprecated) { - const targetType = JSON.stringify(type); - let aliasSource = ""; - if (aliasKeys) { - aliasSource = joinComparisons(aliasKeys, "nodeType"); - } - - let placeholderSource = ""; - const placeholderTypes = []; - if (PLACEHOLDERS.includes(type) && has(FLIPPED_ALIAS_KEYS, type)) { - placeholderTypes.push(type); - } - if (has(PLACEHOLDERS_FLIPPED_ALIAS, type)) { - placeholderTypes.push(...PLACEHOLDERS_FLIPPED_ALIAS[type]); - } - if (placeholderTypes.length > 0) { - placeholderSource = - ' || nodeType === "Placeholder" && (' + - joinComparisons( - placeholderTypes, - "(node as t.Placeholder).expectedNode" - ) + - ")"; - } - - const result = - NODE_FIELDS[type] || FLIPPED_ALIAS_KEYS[type] - ? `node is t.${type}` - : "boolean"; - - return `export function is${type}(node: object | null | undefined, opts?: object | null): ${result} { - ${deprecated || ""} - if (!node) return false; - - const nodeType = (node as t.Node).type; - if (${ - aliasSource ? aliasSource : `nodeType === ${targetType}` - }${placeholderSource}) { - if (typeof opts === "undefined") { - return true; - } else { - return shallowEqual(node, opts); - } - } - - return false; - } - `; -} - -export default function generateValidators() { - let output = `/* - * This file is auto-generated! Do not modify it directly. - * To re-generate run 'make build' - */ -import shallowEqual from "../../utils/shallowEqual"; -import type * as t from "../..";\n\n`; - - Object.keys(VISITOR_KEYS).forEach(type => { - output += addIsHelper(type); - }); - - Object.keys(FLIPPED_ALIAS_KEYS).forEach(type => { - output += addIsHelper(type, FLIPPED_ALIAS_KEYS[type]); - }); - - Object.keys(DEPRECATED_KEYS).forEach(type => { - const newType = DEPRECATED_KEYS[type]; - const deprecated = `console.trace("The node type ${type} has been renamed to ${newType}");`; - output += addIsHelper(type, null, deprecated); - }); - - return output; -} diff --git a/node_modules/@babel/types/scripts/package.json b/node_modules/@babel/types/scripts/package.json deleted file mode 100644 index 5ffd9800b..000000000 --- a/node_modules/@babel/types/scripts/package.json +++ /dev/null @@ -1 +0,0 @@ -{ "type": "module" } diff --git a/node_modules/@babel/types/scripts/utils/formatBuilderName.js b/node_modules/@babel/types/scripts/utils/formatBuilderName.js deleted file mode 100644 index f00a3c4a6..000000000 --- a/node_modules/@babel/types/scripts/utils/formatBuilderName.js +++ /dev/null @@ -1,8 +0,0 @@ -const toLowerCase = Function.call.bind("".toLowerCase); - -export default function formatBuilderName(type) { - // FunctionExpression -> functionExpression - // JSXIdentifier -> jsxIdentifier - // V8IntrinsicIdentifier -> v8IntrinsicIdentifier - return type.replace(/^([A-Z](?=[a-z0-9])|[A-Z]+(?=[A-Z]))/, toLowerCase); -} diff --git a/node_modules/@babel/types/scripts/utils/lowerFirst.js b/node_modules/@babel/types/scripts/utils/lowerFirst.js deleted file mode 100644 index 012f252a7..000000000 --- a/node_modules/@babel/types/scripts/utils/lowerFirst.js +++ /dev/null @@ -1,3 +0,0 @@ -export default function lowerFirst(string) { - return string[0].toLowerCase() + string.slice(1); -} diff --git a/node_modules/@babel/types/scripts/utils/stringifyValidator.js b/node_modules/@babel/types/scripts/utils/stringifyValidator.js deleted file mode 100644 index a3da470ad..000000000 --- a/node_modules/@babel/types/scripts/utils/stringifyValidator.js +++ /dev/null @@ -1,69 +0,0 @@ -export default function stringifyValidator(validator, nodePrefix) { - if (validator === undefined) { - return "any"; - } - - if (validator.each) { - return `Array<${stringifyValidator(validator.each, nodePrefix)}>`; - } - - if (validator.chainOf) { - const ret = stringifyValidator(validator.chainOf[1], nodePrefix); - return Array.isArray(ret) && ret.length === 1 && ret[0] === "any" - ? stringifyValidator(validator.chainOf[0], nodePrefix) - : ret; - } - - if (validator.oneOf) { - return validator.oneOf.map(JSON.stringify).join(" | "); - } - - if (validator.oneOfNodeTypes) { - return validator.oneOfNodeTypes.map(_ => nodePrefix + _).join(" | "); - } - - if (validator.oneOfNodeOrValueTypes) { - return validator.oneOfNodeOrValueTypes - .map(_ => { - return isValueType(_) ? _ : nodePrefix + _; - }) - .join(" | "); - } - - if (validator.type) { - return validator.type; - } - - if (validator.shapeOf) { - return ( - "{ " + - Object.keys(validator.shapeOf) - .map(shapeKey => { - const propertyDefinition = validator.shapeOf[shapeKey]; - if (propertyDefinition.validate) { - const isOptional = - propertyDefinition.optional || propertyDefinition.default != null; - return ( - shapeKey + - (isOptional ? "?: " : ": ") + - stringifyValidator(propertyDefinition.validate) - ); - } - return null; - }) - .filter(Boolean) - .join(", ") + - " }" - ); - } - - return ["any"]; -} - -/** - * Heuristic to decide whether or not the given type is a value type (eg. "null") - * or a Node type (eg. "Expression"). - */ -export function isValueType(type) { - return type.charAt(0).toLowerCase() === type.charAt(0); -} diff --git a/node_modules/@babel/types/scripts/utils/toFunctionName.js b/node_modules/@babel/types/scripts/utils/toFunctionName.js deleted file mode 100644 index 2b645780e..000000000 --- a/node_modules/@babel/types/scripts/utils/toFunctionName.js +++ /dev/null @@ -1,4 +0,0 @@ -export default function toFunctionName(typeName) { - const _ = typeName.replace(/^TS/, "ts").replace(/^JSX/, "jsx"); - return _.slice(0, 1).toLowerCase() + _.slice(1); -} diff --git a/node_modules/@bundle-stats/plugin-webpack-filter/package.json b/node_modules/@bundle-stats/plugin-webpack-filter/package.json index b1b99f104..b35429655 100644 --- a/node_modules/@bundle-stats/plugin-webpack-filter/package.json +++ b/node_modules/@bundle-stats/plugin-webpack-filter/package.json @@ -1,6 +1,6 @@ { "name": "@bundle-stats/plugin-webpack-filter", - "version": "4.1.0", + "version": "4.1.5", "description": "BundleStats webpack filter plugin", "main": "lib/index.js", "module": "lib-esm/index.js", @@ -35,18 +35,18 @@ }, "homepage": "https://github.com/relative-ci/bundle-stats/blob/master/packages/plugin-webpack-filter#readme", "devDependencies": { - "@types/jest": "29.1.1", + "@types/jest": "29.2.3", "@types/webpack": "5.28.0", - "core-js": "3.25.5", - "jest": "27.5.1", - "jest-cli": "28.1.3", + "core-js": "3.26.1", + "jest": "29.3.1", + "jest-cli": "29.3.1", "jest-date-mock": "1.0.8", - "regenerator-runtime": "0.13.9", + "regenerator-runtime": "0.13.11", "ts-jest": "29.0.3", - "typescript": "4.8.4" + "typescript": "4.9.3" }, "peerDependencies": { "core-js": "^3.0.0" }, - "gitHead": "8818d4843bcb9bc369036eae79e930c4e2269d36" + "gitHead": "20d73826ed85f6eb23f40947fbb7ba94e6ead76d" } diff --git a/node_modules/@bundle-stats/plugin-webpack-validate/package.json b/node_modules/@bundle-stats/plugin-webpack-validate/package.json index f44e1d5f8..9dc9b258c 100644 --- a/node_modules/@bundle-stats/plugin-webpack-validate/package.json +++ b/node_modules/@bundle-stats/plugin-webpack-validate/package.json @@ -1,6 +1,6 @@ { "name": "@bundle-stats/plugin-webpack-validate", - "version": "4.1.0", + "version": "4.1.5", "description": "BundleStats webpack validate plugin", "main": "lib/index.js", "module": "lib-esm/index.js", @@ -35,17 +35,17 @@ }, "homepage": "https://github.com/relative-ci/bundle-stats/blob/master/packages/plugin-webpack-filter#readme", "devDependencies": { - "@types/jest": "29.1.1", - "jest": "27.5.1", - "jest-cli": "28.1.3", + "@types/jest": "29.2.3", + "jest": "29.3.1", + "jest-cli": "29.3.1", "jest-date-mock": "1.0.8", - "regenerator-runtime": "0.13.9", + "regenerator-runtime": "0.13.11", "ts-jest": "29.0.3", - "typescript": "4.8.4" + "typescript": "4.9.3" }, "dependencies": { "lodash": "4.17.21", - "superstruct": "0.16.5" + "superstruct": "1.0.3" }, - "gitHead": "8818d4843bcb9bc369036eae79e930c4e2269d36" + "gitHead": "20d73826ed85f6eb23f40947fbb7ba94e6ead76d" } diff --git a/node_modules/@eslint/eslintrc/README.md b/node_modules/@eslint/eslintrc/README.md index 61a3a55d4..b33279485 100644 --- a/node_modules/@eslint/eslintrc/README.md +++ b/node_modules/@eslint/eslintrc/README.md @@ -1,8 +1,8 @@ # ESLintRC Library -This repository contains the legacy ESLintRC configuration file format for ESLint. +This repository contains the legacy ESLintRC configuration file format for ESLint. This package is not intended for use outside of the ESLint ecosystem. It is ESLint-specific and not intended for use in other programs. -**Note:** This package is not intended for use outside of the ESLint ecosystem. It is ESLint-specific and not intended for use in other programs. +**Note:** This package is frozen except for critical bug fixes as ESLint moves to a new config system. ## Installation @@ -16,14 +16,18 @@ npm install @eslint/eslintrc --save-dev yarn add @eslint/eslintrc -D ``` -## Future Usage - -**Note:** This package is not intended for public use at this time. The following is an example of how it will be used in the future. +## Usage The primary class in this package is `FlatCompat`, which is a utility to translate ESLintRC-style configs into flat configs. Here's how you use it inside of your `eslint.config.js` file: ```js import { FlatCompat } from "@eslint/eslintrc"; +import path from "path"; +import { fileURLToPath } from "url"; + +// mimic CommonJS variables -- not needed if using CommonJS +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); const compat = new FlatCompat({ baseDirectory: __dirname, // optional; default: process.cwd() diff --git a/node_modules/@eslint/eslintrc/dist/eslintrc.cjs b/node_modules/@eslint/eslintrc/dist/eslintrc.cjs index 1fa743c91..a722b6ce1 100644 --- a/node_modules/@eslint/eslintrc/dist/eslintrc.cjs +++ b/node_modules/@eslint/eslintrc/dist/eslintrc.cjs @@ -3706,8 +3706,7 @@ class CascadingConfigArrayFactory { configArrayFactory, cwd, rulePaths, - loadRules, - resolver + loadRules }), baseConfigData, cliConfigArray: createCLIConfigArray({ diff --git a/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map b/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map index 947c25e66..924313cdc 100644 --- a/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map +++ b/node_modules/@eslint/eslintrc/dist/eslintrc.cjs.map @@ -1 +1 @@ -{"version":3,"file":"eslintrc.cjs","sources":["../lib/config-array/ignore-pattern.js","../lib/config-array/extracted-config.js","../lib/config-array/config-array.js","../lib/config-array/config-dependency.js","../lib/config-array/override-tester.js","../lib/config-array/index.js","../lib/shared/config-ops.js","../lib/shared/deprecation-warnings.js","../lib/shared/ajv.js","../conf/config-schema.js","../conf/environments.js","../lib/shared/config-validator.js","../lib/shared/naming.js","../lib/shared/relative-module-resolver.js","../lib/config-array-factory.js","../lib/cascading-config-array-factory.js","../lib/flat-compat.js","../lib/index.js"],"sourcesContent":["/**\n * @fileoverview `IgnorePattern` class.\n *\n * `IgnorePattern` class has the set of glob patterns and the base path.\n *\n * It provides two static methods.\n *\n * - `IgnorePattern.createDefaultIgnore(cwd)`\n * Create the default predicate function.\n * - `IgnorePattern.createIgnore(ignorePatterns)`\n * Create the predicate function from multiple `IgnorePattern` objects.\n *\n * It provides two properties and a method.\n *\n * - `patterns`\n * The glob patterns that ignore to lint.\n * - `basePath`\n * The base path of the glob patterns. If absolute paths existed in the\n * glob patterns, those are handled as relative paths to the base path.\n * - `getPatternsRelativeTo(basePath)`\n * Get `patterns` as modified for a given base path. It modifies the\n * absolute paths in the patterns as prepending the difference of two base\n * paths.\n *\n * `ConfigArrayFactory` creates `IgnorePattern` objects when it processes\n * `ignorePatterns` properties.\n *\n * @author Toru Nagashima \n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport assert from \"assert\";\nimport path from \"path\";\nimport ignore from \"ignore\";\nimport debugOrig from \"debug\";\n\nconst debug = debugOrig(\"eslintrc:ignore-pattern\");\n\n/** @typedef {ReturnType} Ignore */\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Get the path to the common ancestor directory of given paths.\n * @param {string[]} sourcePaths The paths to calculate the common ancestor.\n * @returns {string} The path to the common ancestor directory.\n */\nfunction getCommonAncestorPath(sourcePaths) {\n let result = sourcePaths[0];\n\n for (let i = 1; i < sourcePaths.length; ++i) {\n const a = result;\n const b = sourcePaths[i];\n\n // Set the shorter one (it's the common ancestor if one includes the other).\n result = a.length < b.length ? a : b;\n\n // Set the common ancestor.\n for (let j = 0, lastSepPos = 0; j < a.length && j < b.length; ++j) {\n if (a[j] !== b[j]) {\n result = a.slice(0, lastSepPos);\n break;\n }\n if (a[j] === path.sep) {\n lastSepPos = j;\n }\n }\n }\n\n let resolvedResult = result || path.sep;\n\n // if Windows common ancestor is root of drive must have trailing slash to be absolute.\n if (resolvedResult && resolvedResult.endsWith(\":\") && process.platform === \"win32\") {\n resolvedResult += path.sep;\n }\n return resolvedResult;\n}\n\n/**\n * Make relative path.\n * @param {string} from The source path to get relative path.\n * @param {string} to The destination path to get relative path.\n * @returns {string} The relative path.\n */\nfunction relative(from, to) {\n const relPath = path.relative(from, to);\n\n if (path.sep === \"/\") {\n return relPath;\n }\n return relPath.split(path.sep).join(\"/\");\n}\n\n/**\n * Get the trailing slash if existed.\n * @param {string} filePath The path to check.\n * @returns {string} The trailing slash if existed.\n */\nfunction dirSuffix(filePath) {\n const isDir = (\n filePath.endsWith(path.sep) ||\n (process.platform === \"win32\" && filePath.endsWith(\"/\"))\n );\n\n return isDir ? \"/\" : \"\";\n}\n\nconst DefaultPatterns = Object.freeze([\"/**/node_modules/*\"]);\nconst DotPatterns = Object.freeze([\".*\", \"!.eslintrc.*\", \"!../\"]);\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nclass IgnorePattern {\n\n /**\n * The default patterns.\n * @type {string[]}\n */\n static get DefaultPatterns() {\n return DefaultPatterns;\n }\n\n /**\n * Create the default predicate function.\n * @param {string} cwd The current working directory.\n * @returns {((filePath:string, dot:boolean) => boolean) & {basePath:string; patterns:string[]}}\n * The preficate function.\n * The first argument is an absolute path that is checked.\n * The second argument is the flag to not ignore dotfiles.\n * If the predicate function returned `true`, it means the path should be ignored.\n */\n static createDefaultIgnore(cwd) {\n return this.createIgnore([new IgnorePattern(DefaultPatterns, cwd)]);\n }\n\n /**\n * Create the predicate function from multiple `IgnorePattern` objects.\n * @param {IgnorePattern[]} ignorePatterns The list of ignore patterns.\n * @returns {((filePath:string, dot?:boolean) => boolean) & {basePath:string; patterns:string[]}}\n * The preficate function.\n * The first argument is an absolute path that is checked.\n * The second argument is the flag to not ignore dotfiles.\n * If the predicate function returned `true`, it means the path should be ignored.\n */\n static createIgnore(ignorePatterns) {\n debug(\"Create with: %o\", ignorePatterns);\n\n const basePath = getCommonAncestorPath(ignorePatterns.map(p => p.basePath));\n const patterns = [].concat(\n ...ignorePatterns.map(p => p.getPatternsRelativeTo(basePath))\n );\n const ig = ignore({ allowRelativePaths: true }).add([...DotPatterns, ...patterns]);\n const dotIg = ignore({ allowRelativePaths: true }).add(patterns);\n\n debug(\" processed: %o\", { basePath, patterns });\n\n return Object.assign(\n (filePath, dot = false) => {\n assert(path.isAbsolute(filePath), \"'filePath' should be an absolute path.\");\n const relPathRaw = relative(basePath, filePath);\n const relPath = relPathRaw && (relPathRaw + dirSuffix(filePath));\n const adoptedIg = dot ? dotIg : ig;\n const result = relPath !== \"\" && adoptedIg.ignores(relPath);\n\n debug(\"Check\", { filePath, dot, relativePath: relPath, result });\n return result;\n },\n { basePath, patterns }\n );\n }\n\n /**\n * Initialize a new `IgnorePattern` instance.\n * @param {string[]} patterns The glob patterns that ignore to lint.\n * @param {string} basePath The base path of `patterns`.\n */\n constructor(patterns, basePath) {\n assert(path.isAbsolute(basePath), \"'basePath' should be an absolute path.\");\n\n /**\n * The glob patterns that ignore to lint.\n * @type {string[]}\n */\n this.patterns = patterns;\n\n /**\n * The base path of `patterns`.\n * @type {string}\n */\n this.basePath = basePath;\n\n /**\n * If `true` then patterns which don't start with `/` will match the paths to the outside of `basePath`. Defaults to `false`.\n *\n * It's set `true` for `.eslintignore`, `package.json`, and `--ignore-path` for backward compatibility.\n * It's `false` as-is for `ignorePatterns` property in config files.\n * @type {boolean}\n */\n this.loose = false;\n }\n\n /**\n * Get `patterns` as modified for a given base path. It modifies the\n * absolute paths in the patterns as prepending the difference of two base\n * paths.\n * @param {string} newBasePath The base path.\n * @returns {string[]} Modifired patterns.\n */\n getPatternsRelativeTo(newBasePath) {\n assert(path.isAbsolute(newBasePath), \"'newBasePath' should be an absolute path.\");\n const { basePath, loose, patterns } = this;\n\n if (newBasePath === basePath) {\n return patterns;\n }\n const prefix = `/${relative(newBasePath, basePath)}`;\n\n return patterns.map(pattern => {\n const negative = pattern.startsWith(\"!\");\n const head = negative ? \"!\" : \"\";\n const body = negative ? pattern.slice(1) : pattern;\n\n if (body.startsWith(\"/\") || body.startsWith(\"../\")) {\n return `${head}${prefix}${body}`;\n }\n return loose ? pattern : `${head}${prefix}/**/${body}`;\n });\n }\n}\n\nexport { IgnorePattern };\n","/**\n * @fileoverview `ExtractedConfig` class.\n *\n * `ExtractedConfig` class expresses a final configuration for a specific file.\n *\n * It provides one method.\n *\n * - `toCompatibleObjectAsConfigFileContent()`\n * Convert this configuration to the compatible object as the content of\n * config files. It converts the loaded parser and plugins to strings.\n * `CLIEngine#getConfigForFile(filePath)` method uses this method.\n *\n * `ConfigArray#extractConfig(filePath)` creates a `ExtractedConfig` instance.\n *\n * @author Toru Nagashima \n */\n\nimport { IgnorePattern } from \"./ignore-pattern.js\";\n\n// For VSCode intellisense\n/** @typedef {import(\"../../shared/types\").ConfigData} ConfigData */\n/** @typedef {import(\"../../shared/types\").GlobalConf} GlobalConf */\n/** @typedef {import(\"../../shared/types\").SeverityConf} SeverityConf */\n/** @typedef {import(\"./config-dependency\").DependentParser} DependentParser */\n/** @typedef {import(\"./config-dependency\").DependentPlugin} DependentPlugin */\n\n/**\n * Check if `xs` starts with `ys`.\n * @template T\n * @param {T[]} xs The array to check.\n * @param {T[]} ys The array that may be the first part of `xs`.\n * @returns {boolean} `true` if `xs` starts with `ys`.\n */\nfunction startsWith(xs, ys) {\n return xs.length >= ys.length && ys.every((y, i) => y === xs[i]);\n}\n\n/**\n * The class for extracted config data.\n */\nclass ExtractedConfig {\n constructor() {\n\n /**\n * The config name what `noInlineConfig` setting came from.\n * @type {string}\n */\n this.configNameOfNoInlineConfig = \"\";\n\n /**\n * Environments.\n * @type {Record}\n */\n this.env = {};\n\n /**\n * Global variables.\n * @type {Record}\n */\n this.globals = {};\n\n /**\n * The glob patterns that ignore to lint.\n * @type {(((filePath:string, dot?:boolean) => boolean) & { basePath:string; patterns:string[] }) | undefined}\n */\n this.ignores = void 0;\n\n /**\n * The flag that disables directive comments.\n * @type {boolean|undefined}\n */\n this.noInlineConfig = void 0;\n\n /**\n * Parser definition.\n * @type {DependentParser|null}\n */\n this.parser = null;\n\n /**\n * Options for the parser.\n * @type {Object}\n */\n this.parserOptions = {};\n\n /**\n * Plugin definitions.\n * @type {Record}\n */\n this.plugins = {};\n\n /**\n * Processor ID.\n * @type {string|null}\n */\n this.processor = null;\n\n /**\n * The flag that reports unused `eslint-disable` directive comments.\n * @type {boolean|undefined}\n */\n this.reportUnusedDisableDirectives = void 0;\n\n /**\n * Rule settings.\n * @type {Record}\n */\n this.rules = {};\n\n /**\n * Shared settings.\n * @type {Object}\n */\n this.settings = {};\n }\n\n /**\n * Convert this config to the compatible object as a config file content.\n * @returns {ConfigData} The converted object.\n */\n toCompatibleObjectAsConfigFileContent() {\n const {\n /* eslint-disable no-unused-vars */\n configNameOfNoInlineConfig: _ignore1,\n processor: _ignore2,\n /* eslint-enable no-unused-vars */\n ignores,\n ...config\n } = this;\n\n config.parser = config.parser && config.parser.filePath;\n config.plugins = Object.keys(config.plugins).filter(Boolean).reverse();\n config.ignorePatterns = ignores ? ignores.patterns : [];\n\n // Strip the default patterns from `ignorePatterns`.\n if (startsWith(config.ignorePatterns, IgnorePattern.DefaultPatterns)) {\n config.ignorePatterns =\n config.ignorePatterns.slice(IgnorePattern.DefaultPatterns.length);\n }\n\n return config;\n }\n}\n\nexport { ExtractedConfig };\n","/**\n * @fileoverview `ConfigArray` class.\n *\n * `ConfigArray` class expresses the full of a configuration. It has the entry\n * config file, base config files that were extended, loaded parsers, and loaded\n * plugins.\n *\n * `ConfigArray` class provides three properties and two methods.\n *\n * - `pluginEnvironments`\n * - `pluginProcessors`\n * - `pluginRules`\n * The `Map` objects that contain the members of all plugins that this\n * config array contains. Those map objects don't have mutation methods.\n * Those keys are the member ID such as `pluginId/memberName`.\n * - `isRoot()`\n * If `true` then this configuration has `root:true` property.\n * - `extractConfig(filePath)`\n * Extract the final configuration for a given file. This means merging\n * every config array element which that `criteria` property matched. The\n * `filePath` argument must be an absolute path.\n *\n * `ConfigArrayFactory` provides the loading logic of config files.\n *\n * @author Toru Nagashima \n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport { ExtractedConfig } from \"./extracted-config.js\";\nimport { IgnorePattern } from \"./ignore-pattern.js\";\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n// Define types for VSCode IntelliSense.\n/** @typedef {import(\"../../shared/types\").Environment} Environment */\n/** @typedef {import(\"../../shared/types\").GlobalConf} GlobalConf */\n/** @typedef {import(\"../../shared/types\").RuleConf} RuleConf */\n/** @typedef {import(\"../../shared/types\").Rule} Rule */\n/** @typedef {import(\"../../shared/types\").Plugin} Plugin */\n/** @typedef {import(\"../../shared/types\").Processor} Processor */\n/** @typedef {import(\"./config-dependency\").DependentParser} DependentParser */\n/** @typedef {import(\"./config-dependency\").DependentPlugin} DependentPlugin */\n/** @typedef {import(\"./override-tester\")[\"OverrideTester\"]} OverrideTester */\n\n/**\n * @typedef {Object} ConfigArrayElement\n * @property {string} name The name of this config element.\n * @property {string} filePath The path to the source file of this config element.\n * @property {InstanceType|null} criteria The tester for the `files` and `excludedFiles` of this config element.\n * @property {Record|undefined} env The environment settings.\n * @property {Record|undefined} globals The global variable settings.\n * @property {IgnorePattern|undefined} ignorePattern The ignore patterns.\n * @property {boolean|undefined} noInlineConfig The flag that disables directive comments.\n * @property {DependentParser|undefined} parser The parser loader.\n * @property {Object|undefined} parserOptions The parser options.\n * @property {Record|undefined} plugins The plugin loaders.\n * @property {string|undefined} processor The processor name to refer plugin's processor.\n * @property {boolean|undefined} reportUnusedDisableDirectives The flag to report unused `eslint-disable` comments.\n * @property {boolean|undefined} root The flag to express root.\n * @property {Record|undefined} rules The rule settings\n * @property {Object|undefined} settings The shared settings.\n * @property {\"config\" | \"ignore\" | \"implicit-processor\"} type The element type.\n */\n\n/**\n * @typedef {Object} ConfigArrayInternalSlots\n * @property {Map} cache The cache to extract configs.\n * @property {ReadonlyMap|null} envMap The map from environment ID to environment definition.\n * @property {ReadonlyMap|null} processorMap The map from processor ID to environment definition.\n * @property {ReadonlyMap|null} ruleMap The map from rule ID to rule definition.\n */\n\n/** @type {WeakMap} */\nconst internalSlotsMap = new class extends WeakMap {\n get(key) {\n let value = super.get(key);\n\n if (!value) {\n value = {\n cache: new Map(),\n envMap: null,\n processorMap: null,\n ruleMap: null\n };\n super.set(key, value);\n }\n\n return value;\n }\n}();\n\n/**\n * Get the indices which are matched to a given file.\n * @param {ConfigArrayElement[]} elements The elements.\n * @param {string} filePath The path to a target file.\n * @returns {number[]} The indices.\n */\nfunction getMatchedIndices(elements, filePath) {\n const indices = [];\n\n for (let i = elements.length - 1; i >= 0; --i) {\n const element = elements[i];\n\n if (!element.criteria || (filePath && element.criteria.test(filePath))) {\n indices.push(i);\n }\n }\n\n return indices;\n}\n\n/**\n * Check if a value is a non-null object.\n * @param {any} x The value to check.\n * @returns {boolean} `true` if the value is a non-null object.\n */\nfunction isNonNullObject(x) {\n return typeof x === \"object\" && x !== null;\n}\n\n/**\n * Merge two objects.\n *\n * Assign every property values of `y` to `x` if `x` doesn't have the property.\n * If `x`'s property value is an object, it does recursive.\n * @param {Object} target The destination to merge\n * @param {Object|undefined} source The source to merge.\n * @returns {void}\n */\nfunction mergeWithoutOverwrite(target, source) {\n if (!isNonNullObject(source)) {\n return;\n }\n\n for (const key of Object.keys(source)) {\n if (key === \"__proto__\") {\n continue;\n }\n\n if (isNonNullObject(target[key])) {\n mergeWithoutOverwrite(target[key], source[key]);\n } else if (target[key] === void 0) {\n if (isNonNullObject(source[key])) {\n target[key] = Array.isArray(source[key]) ? [] : {};\n mergeWithoutOverwrite(target[key], source[key]);\n } else if (source[key] !== void 0) {\n target[key] = source[key];\n }\n }\n }\n}\n\n/**\n * The error for plugin conflicts.\n */\nclass PluginConflictError extends Error {\n\n /**\n * Initialize this error object.\n * @param {string} pluginId The plugin ID.\n * @param {{filePath:string, importerName:string}[]} plugins The resolved plugins.\n */\n constructor(pluginId, plugins) {\n super(`Plugin \"${pluginId}\" was conflicted between ${plugins.map(p => `\"${p.importerName}\"`).join(\" and \")}.`);\n this.messageTemplate = \"plugin-conflict\";\n this.messageData = { pluginId, plugins };\n }\n}\n\n/**\n * Merge plugins.\n * `target`'s definition is prior to `source`'s.\n * @param {Record} target The destination to merge\n * @param {Record|undefined} source The source to merge.\n * @returns {void}\n */\nfunction mergePlugins(target, source) {\n if (!isNonNullObject(source)) {\n return;\n }\n\n for (const key of Object.keys(source)) {\n if (key === \"__proto__\") {\n continue;\n }\n const targetValue = target[key];\n const sourceValue = source[key];\n\n // Adopt the plugin which was found at first.\n if (targetValue === void 0) {\n if (sourceValue.error) {\n throw sourceValue.error;\n }\n target[key] = sourceValue;\n } else if (sourceValue.filePath !== targetValue.filePath) {\n throw new PluginConflictError(key, [\n {\n filePath: targetValue.filePath,\n importerName: targetValue.importerName\n },\n {\n filePath: sourceValue.filePath,\n importerName: sourceValue.importerName\n }\n ]);\n }\n }\n}\n\n/**\n * Merge rule configs.\n * `target`'s definition is prior to `source`'s.\n * @param {Record} target The destination to merge\n * @param {Record|undefined} source The source to merge.\n * @returns {void}\n */\nfunction mergeRuleConfigs(target, source) {\n if (!isNonNullObject(source)) {\n return;\n }\n\n for (const key of Object.keys(source)) {\n if (key === \"__proto__\") {\n continue;\n }\n const targetDef = target[key];\n const sourceDef = source[key];\n\n // Adopt the rule config which was found at first.\n if (targetDef === void 0) {\n if (Array.isArray(sourceDef)) {\n target[key] = [...sourceDef];\n } else {\n target[key] = [sourceDef];\n }\n\n /*\n * If the first found rule config is severity only and the current rule\n * config has options, merge the severity and the options.\n */\n } else if (\n targetDef.length === 1 &&\n Array.isArray(sourceDef) &&\n sourceDef.length >= 2\n ) {\n targetDef.push(...sourceDef.slice(1));\n }\n }\n}\n\n/**\n * Create the extracted config.\n * @param {ConfigArray} instance The config elements.\n * @param {number[]} indices The indices to use.\n * @returns {ExtractedConfig} The extracted config.\n */\nfunction createConfig(instance, indices) {\n const config = new ExtractedConfig();\n const ignorePatterns = [];\n\n // Merge elements.\n for (const index of indices) {\n const element = instance[index];\n\n // Adopt the parser which was found at first.\n if (!config.parser && element.parser) {\n if (element.parser.error) {\n throw element.parser.error;\n }\n config.parser = element.parser;\n }\n\n // Adopt the processor which was found at first.\n if (!config.processor && element.processor) {\n config.processor = element.processor;\n }\n\n // Adopt the noInlineConfig which was found at first.\n if (config.noInlineConfig === void 0 && element.noInlineConfig !== void 0) {\n config.noInlineConfig = element.noInlineConfig;\n config.configNameOfNoInlineConfig = element.name;\n }\n\n // Adopt the reportUnusedDisableDirectives which was found at first.\n if (config.reportUnusedDisableDirectives === void 0 && element.reportUnusedDisableDirectives !== void 0) {\n config.reportUnusedDisableDirectives = element.reportUnusedDisableDirectives;\n }\n\n // Collect ignorePatterns\n if (element.ignorePattern) {\n ignorePatterns.push(element.ignorePattern);\n }\n\n // Merge others.\n mergeWithoutOverwrite(config.env, element.env);\n mergeWithoutOverwrite(config.globals, element.globals);\n mergeWithoutOverwrite(config.parserOptions, element.parserOptions);\n mergeWithoutOverwrite(config.settings, element.settings);\n mergePlugins(config.plugins, element.plugins);\n mergeRuleConfigs(config.rules, element.rules);\n }\n\n // Create the predicate function for ignore patterns.\n if (ignorePatterns.length > 0) {\n config.ignores = IgnorePattern.createIgnore(ignorePatterns.reverse());\n }\n\n return config;\n}\n\n/**\n * Collect definitions.\n * @template T, U\n * @param {string} pluginId The plugin ID for prefix.\n * @param {Record} defs The definitions to collect.\n * @param {Map} map The map to output.\n * @param {function(T): U} [normalize] The normalize function for each value.\n * @returns {void}\n */\nfunction collect(pluginId, defs, map, normalize) {\n if (defs) {\n const prefix = pluginId && `${pluginId}/`;\n\n for (const [key, value] of Object.entries(defs)) {\n map.set(\n `${prefix}${key}`,\n normalize ? normalize(value) : value\n );\n }\n }\n}\n\n/**\n * Normalize a rule definition.\n * @param {Function|Rule} rule The rule definition to normalize.\n * @returns {Rule} The normalized rule definition.\n */\nfunction normalizePluginRule(rule) {\n return typeof rule === \"function\" ? { create: rule } : rule;\n}\n\n/**\n * Delete the mutation methods from a given map.\n * @param {Map} map The map object to delete.\n * @returns {void}\n */\nfunction deleteMutationMethods(map) {\n Object.defineProperties(map, {\n clear: { configurable: true, value: void 0 },\n delete: { configurable: true, value: void 0 },\n set: { configurable: true, value: void 0 }\n });\n}\n\n/**\n * Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array.\n * @param {ConfigArrayElement[]} elements The config elements.\n * @param {ConfigArrayInternalSlots} slots The internal slots.\n * @returns {void}\n */\nfunction initPluginMemberMaps(elements, slots) {\n const processed = new Set();\n\n slots.envMap = new Map();\n slots.processorMap = new Map();\n slots.ruleMap = new Map();\n\n for (const element of elements) {\n if (!element.plugins) {\n continue;\n }\n\n for (const [pluginId, value] of Object.entries(element.plugins)) {\n const plugin = value.definition;\n\n if (!plugin || processed.has(pluginId)) {\n continue;\n }\n processed.add(pluginId);\n\n collect(pluginId, plugin.environments, slots.envMap);\n collect(pluginId, plugin.processors, slots.processorMap);\n collect(pluginId, plugin.rules, slots.ruleMap, normalizePluginRule);\n }\n }\n\n deleteMutationMethods(slots.envMap);\n deleteMutationMethods(slots.processorMap);\n deleteMutationMethods(slots.ruleMap);\n}\n\n/**\n * Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array.\n * @param {ConfigArray} instance The config elements.\n * @returns {ConfigArrayInternalSlots} The extracted config.\n */\nfunction ensurePluginMemberMaps(instance) {\n const slots = internalSlotsMap.get(instance);\n\n if (!slots.ruleMap) {\n initPluginMemberMaps(instance, slots);\n }\n\n return slots;\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * The Config Array.\n *\n * `ConfigArray` instance contains all settings, parsers, and plugins.\n * You need to call `ConfigArray#extractConfig(filePath)` method in order to\n * extract, merge and get only the config data which is related to an arbitrary\n * file.\n * @extends {Array}\n */\nclass ConfigArray extends Array {\n\n /**\n * Get the plugin environments.\n * The returned map cannot be mutated.\n * @type {ReadonlyMap} The plugin environments.\n */\n get pluginEnvironments() {\n return ensurePluginMemberMaps(this).envMap;\n }\n\n /**\n * Get the plugin processors.\n * The returned map cannot be mutated.\n * @type {ReadonlyMap} The plugin processors.\n */\n get pluginProcessors() {\n return ensurePluginMemberMaps(this).processorMap;\n }\n\n /**\n * Get the plugin rules.\n * The returned map cannot be mutated.\n * @returns {ReadonlyMap} The plugin rules.\n */\n get pluginRules() {\n return ensurePluginMemberMaps(this).ruleMap;\n }\n\n /**\n * Check if this config has `root` flag.\n * @returns {boolean} `true` if this config array is root.\n */\n isRoot() {\n for (let i = this.length - 1; i >= 0; --i) {\n const root = this[i].root;\n\n if (typeof root === \"boolean\") {\n return root;\n }\n }\n return false;\n }\n\n /**\n * Extract the config data which is related to a given file.\n * @param {string} filePath The absolute path to the target file.\n * @returns {ExtractedConfig} The extracted config data.\n */\n extractConfig(filePath) {\n const { cache } = internalSlotsMap.get(this);\n const indices = getMatchedIndices(this, filePath);\n const cacheKey = indices.join(\",\");\n\n if (!cache.has(cacheKey)) {\n cache.set(cacheKey, createConfig(this, indices));\n }\n\n return cache.get(cacheKey);\n }\n\n /**\n * Check if a given path is an additional lint target.\n * @param {string} filePath The absolute path to the target file.\n * @returns {boolean} `true` if the file is an additional lint target.\n */\n isAdditionalTargetPath(filePath) {\n for (const { criteria, type } of this) {\n if (\n type === \"config\" &&\n criteria &&\n !criteria.endsWithWildcard &&\n criteria.test(filePath)\n ) {\n return true;\n }\n }\n return false;\n }\n}\n\n/**\n * Get the used extracted configs.\n * CLIEngine will use this method to collect used deprecated rules.\n * @param {ConfigArray} instance The config array object to get.\n * @returns {ExtractedConfig[]} The used extracted configs.\n * @private\n */\nfunction getUsedExtractedConfigs(instance) {\n const { cache } = internalSlotsMap.get(instance);\n\n return Array.from(cache.values());\n}\n\n\nexport {\n ConfigArray,\n getUsedExtractedConfigs\n};\n","/**\n * @fileoverview `ConfigDependency` class.\n *\n * `ConfigDependency` class expresses a loaded parser or plugin.\n *\n * If the parser or plugin was loaded successfully, it has `definition` property\n * and `filePath` property. Otherwise, it has `error` property.\n *\n * When `JSON.stringify()` converted a `ConfigDependency` object to a JSON, it\n * omits `definition` property.\n *\n * `ConfigArrayFactory` creates `ConfigDependency` objects when it loads parsers\n * or plugins.\n *\n * @author Toru Nagashima \n */\n\nimport util from \"util\";\n\n/**\n * The class is to store parsers or plugins.\n * This class hides the loaded object from `JSON.stringify()` and `console.log`.\n * @template T\n */\nclass ConfigDependency {\n\n /**\n * Initialize this instance.\n * @param {Object} data The dependency data.\n * @param {T} [data.definition] The dependency if the loading succeeded.\n * @param {Error} [data.error] The error object if the loading failed.\n * @param {string} [data.filePath] The actual path to the dependency if the loading succeeded.\n * @param {string} data.id The ID of this dependency.\n * @param {string} data.importerName The name of the config file which loads this dependency.\n * @param {string} data.importerPath The path to the config file which loads this dependency.\n */\n constructor({\n definition = null,\n error = null,\n filePath = null,\n id,\n importerName,\n importerPath\n }) {\n\n /**\n * The loaded dependency if the loading succeeded.\n * @type {T|null}\n */\n this.definition = definition;\n\n /**\n * The error object if the loading failed.\n * @type {Error|null}\n */\n this.error = error;\n\n /**\n * The loaded dependency if the loading succeeded.\n * @type {string|null}\n */\n this.filePath = filePath;\n\n /**\n * The ID of this dependency.\n * @type {string}\n */\n this.id = id;\n\n /**\n * The name of the config file which loads this dependency.\n * @type {string}\n */\n this.importerName = importerName;\n\n /**\n * The path to the config file which loads this dependency.\n * @type {string}\n */\n this.importerPath = importerPath;\n }\n\n // eslint-disable-next-line jsdoc/require-description\n /**\n * @returns {Object} a JSON compatible object.\n */\n toJSON() {\n const obj = this[util.inspect.custom]();\n\n // Display `error.message` (`Error#message` is unenumerable).\n if (obj.error instanceof Error) {\n obj.error = { ...obj.error, message: obj.error.message };\n }\n\n return obj;\n }\n\n // eslint-disable-next-line jsdoc/require-description\n /**\n * @returns {Object} an object to display by `console.log()`.\n */\n [util.inspect.custom]() {\n const {\n definition: _ignore, // eslint-disable-line no-unused-vars\n ...obj\n } = this;\n\n return obj;\n }\n}\n\n/** @typedef {ConfigDependency} DependentParser */\n/** @typedef {ConfigDependency} DependentPlugin */\n\nexport { ConfigDependency };\n","/**\n * @fileoverview `OverrideTester` class.\n *\n * `OverrideTester` class handles `files` property and `excludedFiles` property\n * of `overrides` config.\n *\n * It provides one method.\n *\n * - `test(filePath)`\n * Test if a file path matches the pair of `files` property and\n * `excludedFiles` property. The `filePath` argument must be an absolute\n * path.\n *\n * `ConfigArrayFactory` creates `OverrideTester` objects when it processes\n * `overrides` properties.\n *\n * @author Toru Nagashima \n */\n\nimport assert from \"assert\";\nimport path from \"path\";\nimport util from \"util\";\nimport minimatch from \"minimatch\";\n\nconst { Minimatch } = minimatch;\n\nconst minimatchOpts = { dot: true, matchBase: true };\n\n/**\n * @typedef {Object} Pattern\n * @property {InstanceType[] | null} includes The positive matchers.\n * @property {InstanceType[] | null} excludes The negative matchers.\n */\n\n/**\n * Normalize a given pattern to an array.\n * @param {string|string[]|undefined} patterns A glob pattern or an array of glob patterns.\n * @returns {string[]|null} Normalized patterns.\n * @private\n */\nfunction normalizePatterns(patterns) {\n if (Array.isArray(patterns)) {\n return patterns.filter(Boolean);\n }\n if (typeof patterns === \"string\" && patterns) {\n return [patterns];\n }\n return [];\n}\n\n/**\n * Create the matchers of given patterns.\n * @param {string[]} patterns The patterns.\n * @returns {InstanceType[] | null} The matchers.\n */\nfunction toMatcher(patterns) {\n if (patterns.length === 0) {\n return null;\n }\n return patterns.map(pattern => {\n if (/^\\.[/\\\\]/u.test(pattern)) {\n return new Minimatch(\n pattern.slice(2),\n\n // `./*.js` should not match with `subdir/foo.js`\n { ...minimatchOpts, matchBase: false }\n );\n }\n return new Minimatch(pattern, minimatchOpts);\n });\n}\n\n/**\n * Convert a given matcher to string.\n * @param {Pattern} matchers The matchers.\n * @returns {string} The string expression of the matcher.\n */\nfunction patternToJson({ includes, excludes }) {\n return {\n includes: includes && includes.map(m => m.pattern),\n excludes: excludes && excludes.map(m => m.pattern)\n };\n}\n\n/**\n * The class to test given paths are matched by the patterns.\n */\nclass OverrideTester {\n\n /**\n * Create a tester with given criteria.\n * If there are no criteria, returns `null`.\n * @param {string|string[]} files The glob patterns for included files.\n * @param {string|string[]} excludedFiles The glob patterns for excluded files.\n * @param {string} basePath The path to the base directory to test paths.\n * @returns {OverrideTester|null} The created instance or `null`.\n */\n static create(files, excludedFiles, basePath) {\n const includePatterns = normalizePatterns(files);\n const excludePatterns = normalizePatterns(excludedFiles);\n let endsWithWildcard = false;\n\n if (includePatterns.length === 0) {\n return null;\n }\n\n // Rejects absolute paths or relative paths to parents.\n for (const pattern of includePatterns) {\n if (path.isAbsolute(pattern) || pattern.includes(\"..\")) {\n throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`);\n }\n if (pattern.endsWith(\"*\")) {\n endsWithWildcard = true;\n }\n }\n for (const pattern of excludePatterns) {\n if (path.isAbsolute(pattern) || pattern.includes(\"..\")) {\n throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`);\n }\n }\n\n const includes = toMatcher(includePatterns);\n const excludes = toMatcher(excludePatterns);\n\n return new OverrideTester(\n [{ includes, excludes }],\n basePath,\n endsWithWildcard\n );\n }\n\n /**\n * Combine two testers by logical and.\n * If either of the testers was `null`, returns the other tester.\n * The `basePath` property of the two must be the same value.\n * @param {OverrideTester|null} a A tester.\n * @param {OverrideTester|null} b Another tester.\n * @returns {OverrideTester|null} Combined tester.\n */\n static and(a, b) {\n if (!b) {\n return a && new OverrideTester(\n a.patterns,\n a.basePath,\n a.endsWithWildcard\n );\n }\n if (!a) {\n return new OverrideTester(\n b.patterns,\n b.basePath,\n b.endsWithWildcard\n );\n }\n\n assert.strictEqual(a.basePath, b.basePath);\n return new OverrideTester(\n a.patterns.concat(b.patterns),\n a.basePath,\n a.endsWithWildcard || b.endsWithWildcard\n );\n }\n\n /**\n * Initialize this instance.\n * @param {Pattern[]} patterns The matchers.\n * @param {string} basePath The base path.\n * @param {boolean} endsWithWildcard If `true` then a pattern ends with `*`.\n */\n constructor(patterns, basePath, endsWithWildcard = false) {\n\n /** @type {Pattern[]} */\n this.patterns = patterns;\n\n /** @type {string} */\n this.basePath = basePath;\n\n /** @type {boolean} */\n this.endsWithWildcard = endsWithWildcard;\n }\n\n /**\n * Test if a given path is matched or not.\n * @param {string} filePath The absolute path to the target file.\n * @returns {boolean} `true` if the path was matched.\n */\n test(filePath) {\n if (typeof filePath !== \"string\" || !path.isAbsolute(filePath)) {\n throw new Error(`'filePath' should be an absolute path, but got ${filePath}.`);\n }\n const relativePath = path.relative(this.basePath, filePath);\n\n return this.patterns.every(({ includes, excludes }) => (\n (!includes || includes.some(m => m.match(relativePath))) &&\n (!excludes || !excludes.some(m => m.match(relativePath)))\n ));\n }\n\n // eslint-disable-next-line jsdoc/require-description\n /**\n * @returns {Object} a JSON compatible object.\n */\n toJSON() {\n if (this.patterns.length === 1) {\n return {\n ...patternToJson(this.patterns[0]),\n basePath: this.basePath\n };\n }\n return {\n AND: this.patterns.map(patternToJson),\n basePath: this.basePath\n };\n }\n\n // eslint-disable-next-line jsdoc/require-description\n /**\n * @returns {Object} an object to display by `console.log()`.\n */\n [util.inspect.custom]() {\n return this.toJSON();\n }\n}\n\nexport { OverrideTester };\n","/**\n * @fileoverview `ConfigArray` class.\n * @author Toru Nagashima \n */\n\nimport { ConfigArray, getUsedExtractedConfigs } from \"./config-array.js\";\nimport { ConfigDependency } from \"./config-dependency.js\";\nimport { ExtractedConfig } from \"./extracted-config.js\";\nimport { IgnorePattern } from \"./ignore-pattern.js\";\nimport { OverrideTester } from \"./override-tester.js\";\n\nexport {\n ConfigArray,\n ConfigDependency,\n ExtractedConfig,\n IgnorePattern,\n OverrideTester,\n getUsedExtractedConfigs\n};\n","/**\n * @fileoverview Config file operations. This file must be usable in the browser,\n * so no Node-specific code can be here.\n * @author Nicholas C. Zakas\n */\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\n\nconst RULE_SEVERITY_STRINGS = [\"off\", \"warn\", \"error\"],\n RULE_SEVERITY = RULE_SEVERITY_STRINGS.reduce((map, value, index) => {\n map[value] = index;\n return map;\n }, {}),\n VALID_SEVERITIES = [0, 1, 2, \"off\", \"warn\", \"error\"];\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Normalizes the severity value of a rule's configuration to a number\n * @param {(number|string|[number, ...*]|[string, ...*])} ruleConfig A rule's configuration value, generally\n * received from the user. A valid config value is either 0, 1, 2, the string \"off\" (treated the same as 0),\n * the string \"warn\" (treated the same as 1), the string \"error\" (treated the same as 2), or an array\n * whose first element is one of the above values. Strings are matched case-insensitively.\n * @returns {(0|1|2)} The numeric severity value if the config value was valid, otherwise 0.\n */\nfunction getRuleSeverity(ruleConfig) {\n const severityValue = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;\n\n if (severityValue === 0 || severityValue === 1 || severityValue === 2) {\n return severityValue;\n }\n\n if (typeof severityValue === \"string\") {\n return RULE_SEVERITY[severityValue.toLowerCase()] || 0;\n }\n\n return 0;\n}\n\n/**\n * Converts old-style severity settings (0, 1, 2) into new-style\n * severity settings (off, warn, error) for all rules. Assumption is that severity\n * values have already been validated as correct.\n * @param {Object} config The config object to normalize.\n * @returns {void}\n */\nfunction normalizeToStrings(config) {\n\n if (config.rules) {\n Object.keys(config.rules).forEach(ruleId => {\n const ruleConfig = config.rules[ruleId];\n\n if (typeof ruleConfig === \"number\") {\n config.rules[ruleId] = RULE_SEVERITY_STRINGS[ruleConfig] || RULE_SEVERITY_STRINGS[0];\n } else if (Array.isArray(ruleConfig) && typeof ruleConfig[0] === \"number\") {\n ruleConfig[0] = RULE_SEVERITY_STRINGS[ruleConfig[0]] || RULE_SEVERITY_STRINGS[0];\n }\n });\n }\n}\n\n/**\n * Determines if the severity for the given rule configuration represents an error.\n * @param {int|string|Array} ruleConfig The configuration for an individual rule.\n * @returns {boolean} True if the rule represents an error, false if not.\n */\nfunction isErrorSeverity(ruleConfig) {\n return getRuleSeverity(ruleConfig) === 2;\n}\n\n/**\n * Checks whether a given config has valid severity or not.\n * @param {number|string|Array} ruleConfig The configuration for an individual rule.\n * @returns {boolean} `true` if the configuration has valid severity.\n */\nfunction isValidSeverity(ruleConfig) {\n let severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;\n\n if (typeof severity === \"string\") {\n severity = severity.toLowerCase();\n }\n return VALID_SEVERITIES.indexOf(severity) !== -1;\n}\n\n/**\n * Checks whether every rule of a given config has valid severity or not.\n * @param {Object} config The configuration for rules.\n * @returns {boolean} `true` if the configuration has valid severity.\n */\nfunction isEverySeverityValid(config) {\n return Object.keys(config).every(ruleId => isValidSeverity(config[ruleId]));\n}\n\n/**\n * Normalizes a value for a global in a config\n * @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in\n * a global directive comment\n * @returns {(\"readable\"|\"writeable\"|\"off\")} The value normalized as a string\n * @throws Error if global value is invalid\n */\nfunction normalizeConfigGlobal(configuredValue) {\n switch (configuredValue) {\n case \"off\":\n return \"off\";\n\n case true:\n case \"true\":\n case \"writeable\":\n case \"writable\":\n return \"writable\";\n\n case null:\n case false:\n case \"false\":\n case \"readable\":\n case \"readonly\":\n return \"readonly\";\n\n default:\n throw new Error(`'${configuredValue}' is not a valid configuration for a global (use 'readonly', 'writable', or 'off')`);\n }\n}\n\nexport {\n getRuleSeverity,\n normalizeToStrings,\n isErrorSeverity,\n isValidSeverity,\n isEverySeverityValid,\n normalizeConfigGlobal\n};\n","/**\n * @fileoverview Provide the function that emits deprecation warnings.\n * @author Toru Nagashima \n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport path from \"path\";\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\n\n// Defitions for deprecation warnings.\nconst deprecationWarningMessages = {\n ESLINT_LEGACY_ECMAFEATURES:\n \"The 'ecmaFeatures' config file property is deprecated and has no effect.\",\n ESLINT_PERSONAL_CONFIG_LOAD:\n \"'~/.eslintrc.*' config files have been deprecated. \" +\n \"Please use a config file per project or the '--config' option.\",\n ESLINT_PERSONAL_CONFIG_SUPPRESS:\n \"'~/.eslintrc.*' config files have been deprecated. \" +\n \"Please remove it or add 'root:true' to the config files in your \" +\n \"projects in order to avoid loading '~/.eslintrc.*' accidentally.\"\n};\n\nconst sourceFileErrorCache = new Set();\n\n/**\n * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted\n * for each unique file path, but repeated invocations with the same file path have no effect.\n * No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active.\n * @param {string} source The name of the configuration source to report the warning for.\n * @param {string} errorCode The warning message to show.\n * @returns {void}\n */\nfunction emitDeprecationWarning(source, errorCode) {\n const cacheKey = JSON.stringify({ source, errorCode });\n\n if (sourceFileErrorCache.has(cacheKey)) {\n return;\n }\n sourceFileErrorCache.add(cacheKey);\n\n const rel = path.relative(process.cwd(), source);\n const message = deprecationWarningMessages[errorCode];\n\n process.emitWarning(\n `${message} (found in \"${rel}\")`,\n \"DeprecationWarning\",\n errorCode\n );\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\nexport {\n emitDeprecationWarning\n};\n","/**\n * @fileoverview The instance of Ajv validator.\n * @author Evgeny Poberezkin\n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport Ajv from \"ajv\";\n\n//-----------------------------------------------------------------------------\n// Helpers\n//-----------------------------------------------------------------------------\n\n/*\n * Copied from ajv/lib/refs/json-schema-draft-04.json\n * The MIT License (MIT)\n * Copyright (c) 2015-2017 Evgeny Poberezkin\n */\nconst metaSchema = {\n id: \"http://json-schema.org/draft-04/schema#\",\n $schema: \"http://json-schema.org/draft-04/schema#\",\n description: \"Core schema meta-schema\",\n definitions: {\n schemaArray: {\n type: \"array\",\n minItems: 1,\n items: { $ref: \"#\" }\n },\n positiveInteger: {\n type: \"integer\",\n minimum: 0\n },\n positiveIntegerDefault0: {\n allOf: [{ $ref: \"#/definitions/positiveInteger\" }, { default: 0 }]\n },\n simpleTypes: {\n enum: [\"array\", \"boolean\", \"integer\", \"null\", \"number\", \"object\", \"string\"]\n },\n stringArray: {\n type: \"array\",\n items: { type: \"string\" },\n minItems: 1,\n uniqueItems: true\n }\n },\n type: \"object\",\n properties: {\n id: {\n type: \"string\"\n },\n $schema: {\n type: \"string\"\n },\n title: {\n type: \"string\"\n },\n description: {\n type: \"string\"\n },\n default: { },\n multipleOf: {\n type: \"number\",\n minimum: 0,\n exclusiveMinimum: true\n },\n maximum: {\n type: \"number\"\n },\n exclusiveMaximum: {\n type: \"boolean\",\n default: false\n },\n minimum: {\n type: \"number\"\n },\n exclusiveMinimum: {\n type: \"boolean\",\n default: false\n },\n maxLength: { $ref: \"#/definitions/positiveInteger\" },\n minLength: { $ref: \"#/definitions/positiveIntegerDefault0\" },\n pattern: {\n type: \"string\",\n format: \"regex\"\n },\n additionalItems: {\n anyOf: [\n { type: \"boolean\" },\n { $ref: \"#\" }\n ],\n default: { }\n },\n items: {\n anyOf: [\n { $ref: \"#\" },\n { $ref: \"#/definitions/schemaArray\" }\n ],\n default: { }\n },\n maxItems: { $ref: \"#/definitions/positiveInteger\" },\n minItems: { $ref: \"#/definitions/positiveIntegerDefault0\" },\n uniqueItems: {\n type: \"boolean\",\n default: false\n },\n maxProperties: { $ref: \"#/definitions/positiveInteger\" },\n minProperties: { $ref: \"#/definitions/positiveIntegerDefault0\" },\n required: { $ref: \"#/definitions/stringArray\" },\n additionalProperties: {\n anyOf: [\n { type: \"boolean\" },\n { $ref: \"#\" }\n ],\n default: { }\n },\n definitions: {\n type: \"object\",\n additionalProperties: { $ref: \"#\" },\n default: { }\n },\n properties: {\n type: \"object\",\n additionalProperties: { $ref: \"#\" },\n default: { }\n },\n patternProperties: {\n type: \"object\",\n additionalProperties: { $ref: \"#\" },\n default: { }\n },\n dependencies: {\n type: \"object\",\n additionalProperties: {\n anyOf: [\n { $ref: \"#\" },\n { $ref: \"#/definitions/stringArray\" }\n ]\n }\n },\n enum: {\n type: \"array\",\n minItems: 1,\n uniqueItems: true\n },\n type: {\n anyOf: [\n { $ref: \"#/definitions/simpleTypes\" },\n {\n type: \"array\",\n items: { $ref: \"#/definitions/simpleTypes\" },\n minItems: 1,\n uniqueItems: true\n }\n ]\n },\n format: { type: \"string\" },\n allOf: { $ref: \"#/definitions/schemaArray\" },\n anyOf: { $ref: \"#/definitions/schemaArray\" },\n oneOf: { $ref: \"#/definitions/schemaArray\" },\n not: { $ref: \"#\" }\n },\n dependencies: {\n exclusiveMaximum: [\"maximum\"],\n exclusiveMinimum: [\"minimum\"]\n },\n default: { }\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\nexport default (additionalOptions = {}) => {\n const ajv = new Ajv({\n meta: false,\n useDefaults: true,\n validateSchema: false,\n missingRefs: \"ignore\",\n verbose: true,\n schemaId: \"auto\",\n ...additionalOptions\n });\n\n ajv.addMetaSchema(metaSchema);\n // eslint-disable-next-line no-underscore-dangle\n ajv._opts.defaultMeta = metaSchema.id;\n\n return ajv;\n};\n","/**\n * @fileoverview Defines a schema for configs.\n * @author Sylvan Mably\n */\n\nconst baseConfigProperties = {\n $schema: { type: \"string\" },\n env: { type: \"object\" },\n extends: { $ref: \"#/definitions/stringOrStrings\" },\n globals: { type: \"object\" },\n overrides: {\n type: \"array\",\n items: { $ref: \"#/definitions/overrideConfig\" },\n additionalItems: false\n },\n parser: { type: [\"string\", \"null\"] },\n parserOptions: { type: \"object\" },\n plugins: { type: \"array\" },\n processor: { type: \"string\" },\n rules: { type: \"object\" },\n settings: { type: \"object\" },\n noInlineConfig: { type: \"boolean\" },\n reportUnusedDisableDirectives: { type: \"boolean\" },\n\n ecmaFeatures: { type: \"object\" } // deprecated; logs a warning when used\n};\n\nconst configSchema = {\n definitions: {\n stringOrStrings: {\n oneOf: [\n { type: \"string\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n additionalItems: false\n }\n ]\n },\n stringOrStringsRequired: {\n oneOf: [\n { type: \"string\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n additionalItems: false,\n minItems: 1\n }\n ]\n },\n\n // Config at top-level.\n objectConfig: {\n type: \"object\",\n properties: {\n root: { type: \"boolean\" },\n ignorePatterns: { $ref: \"#/definitions/stringOrStrings\" },\n ...baseConfigProperties\n },\n additionalProperties: false\n },\n\n // Config in `overrides`.\n overrideConfig: {\n type: \"object\",\n properties: {\n excludedFiles: { $ref: \"#/definitions/stringOrStrings\" },\n files: { $ref: \"#/definitions/stringOrStringsRequired\" },\n ...baseConfigProperties\n },\n required: [\"files\"],\n additionalProperties: false\n }\n },\n\n $ref: \"#/definitions/objectConfig\"\n};\n\nexport default configSchema;\n","/**\n * @fileoverview Defines environment settings and globals.\n * @author Elan Shanker\n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport globals from \"globals\";\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Get the object that has difference.\n * @param {Record} current The newer object.\n * @param {Record} prev The older object.\n * @returns {Record} The difference object.\n */\nfunction getDiff(current, prev) {\n const retv = {};\n\n for (const [key, value] of Object.entries(current)) {\n if (!Object.hasOwnProperty.call(prev, key)) {\n retv[key] = value;\n }\n }\n\n return retv;\n}\n\nconst newGlobals2015 = getDiff(globals.es2015, globals.es5); // 19 variables such as Promise, Map, ...\nconst newGlobals2017 = {\n Atomics: false,\n SharedArrayBuffer: false\n};\nconst newGlobals2020 = {\n BigInt: false,\n BigInt64Array: false,\n BigUint64Array: false,\n globalThis: false\n};\n\nconst newGlobals2021 = {\n AggregateError: false,\n FinalizationRegistry: false,\n WeakRef: false\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/** @type {Map} */\nexport default new Map(Object.entries({\n\n // Language\n builtin: {\n globals: globals.es5\n },\n es6: {\n globals: newGlobals2015,\n parserOptions: {\n ecmaVersion: 6\n }\n },\n es2015: {\n globals: newGlobals2015,\n parserOptions: {\n ecmaVersion: 6\n }\n },\n es2016: {\n globals: newGlobals2015,\n parserOptions: {\n ecmaVersion: 7\n }\n },\n es2017: {\n globals: { ...newGlobals2015, ...newGlobals2017 },\n parserOptions: {\n ecmaVersion: 8\n }\n },\n es2018: {\n globals: { ...newGlobals2015, ...newGlobals2017 },\n parserOptions: {\n ecmaVersion: 9\n }\n },\n es2019: {\n globals: { ...newGlobals2015, ...newGlobals2017 },\n parserOptions: {\n ecmaVersion: 10\n }\n },\n es2020: {\n globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 },\n parserOptions: {\n ecmaVersion: 11\n }\n },\n es2021: {\n globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },\n parserOptions: {\n ecmaVersion: 12\n }\n },\n es2022: {\n globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },\n parserOptions: {\n ecmaVersion: 13\n }\n },\n\n // Platforms\n browser: {\n globals: globals.browser\n },\n node: {\n globals: globals.node,\n parserOptions: {\n ecmaFeatures: {\n globalReturn: true\n }\n }\n },\n \"shared-node-browser\": {\n globals: globals[\"shared-node-browser\"]\n },\n worker: {\n globals: globals.worker\n },\n serviceworker: {\n globals: globals.serviceworker\n },\n\n // Frameworks\n commonjs: {\n globals: globals.commonjs,\n parserOptions: {\n ecmaFeatures: {\n globalReturn: true\n }\n }\n },\n amd: {\n globals: globals.amd\n },\n mocha: {\n globals: globals.mocha\n },\n jasmine: {\n globals: globals.jasmine\n },\n jest: {\n globals: globals.jest\n },\n phantomjs: {\n globals: globals.phantomjs\n },\n jquery: {\n globals: globals.jquery\n },\n qunit: {\n globals: globals.qunit\n },\n prototypejs: {\n globals: globals.prototypejs\n },\n shelljs: {\n globals: globals.shelljs\n },\n meteor: {\n globals: globals.meteor\n },\n mongo: {\n globals: globals.mongo\n },\n protractor: {\n globals: globals.protractor\n },\n applescript: {\n globals: globals.applescript\n },\n nashorn: {\n globals: globals.nashorn\n },\n atomtest: {\n globals: globals.atomtest\n },\n embertest: {\n globals: globals.embertest\n },\n webextensions: {\n globals: globals.webextensions\n },\n greasemonkey: {\n globals: globals.greasemonkey\n }\n}));\n","/**\n * @fileoverview Validates configs.\n * @author Brandon Mills\n */\n\n/* eslint class-methods-use-this: \"off\" */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport util from \"util\";\nimport * as ConfigOps from \"./config-ops.js\";\nimport { emitDeprecationWarning } from \"./deprecation-warnings.js\";\nimport ajvOrig from \"./ajv.js\";\nimport configSchema from \"../../conf/config-schema.js\";\nimport BuiltInEnvironments from \"../../conf/environments.js\";\n\nconst ajv = ajvOrig();\n\nconst ruleValidators = new WeakMap();\nconst noop = Function.prototype;\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\nlet validateSchema;\nconst severityMap = {\n error: 2,\n warn: 1,\n off: 0\n};\n\nconst validated = new WeakSet();\n\n//-----------------------------------------------------------------------------\n// Exports\n//-----------------------------------------------------------------------------\n\nexport default class ConfigValidator {\n constructor({ builtInRules = new Map() } = {}) {\n this.builtInRules = builtInRules;\n }\n\n /**\n * Gets a complete options schema for a rule.\n * @param {{create: Function, schema: (Array|null)}} rule A new-style rule object\n * @returns {Object} JSON Schema for the rule's options.\n */\n getRuleOptionsSchema(rule) {\n if (!rule) {\n return null;\n }\n\n const schema = rule.schema || rule.meta && rule.meta.schema;\n\n // Given a tuple of schemas, insert warning level at the beginning\n if (Array.isArray(schema)) {\n if (schema.length) {\n return {\n type: \"array\",\n items: schema,\n minItems: 0,\n maxItems: schema.length\n };\n }\n return {\n type: \"array\",\n minItems: 0,\n maxItems: 0\n };\n\n }\n\n // Given a full schema, leave it alone\n return schema || null;\n }\n\n /**\n * Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid.\n * @param {options} options The given options for the rule.\n * @returns {number|string} The rule's severity value\n */\n validateRuleSeverity(options) {\n const severity = Array.isArray(options) ? options[0] : options;\n const normSeverity = typeof severity === \"string\" ? severityMap[severity.toLowerCase()] : severity;\n\n if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) {\n return normSeverity;\n }\n\n throw new Error(`\\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util.inspect(severity).replace(/'/gu, \"\\\"\").replace(/\\n/gu, \"\")}').\\n`);\n\n }\n\n /**\n * Validates the non-severity options passed to a rule, based on its schema.\n * @param {{create: Function}} rule The rule to validate\n * @param {Array} localOptions The options for the rule, excluding severity\n * @returns {void}\n */\n validateRuleSchema(rule, localOptions) {\n if (!ruleValidators.has(rule)) {\n const schema = this.getRuleOptionsSchema(rule);\n\n if (schema) {\n ruleValidators.set(rule, ajv.compile(schema));\n }\n }\n\n const validateRule = ruleValidators.get(rule);\n\n if (validateRule) {\n validateRule(localOptions);\n if (validateRule.errors) {\n throw new Error(validateRule.errors.map(\n error => `\\tValue ${JSON.stringify(error.data)} ${error.message}.\\n`\n ).join(\"\"));\n }\n }\n }\n\n /**\n * Validates a rule's options against its schema.\n * @param {{create: Function}|null} rule The rule that the config is being validated for\n * @param {string} ruleId The rule's unique name.\n * @param {Array|number} options The given options for the rule.\n * @param {string|null} source The name of the configuration source to report in any errors. If null or undefined,\n * no source is prepended to the message.\n * @returns {void}\n */\n validateRuleOptions(rule, ruleId, options, source = null) {\n try {\n const severity = this.validateRuleSeverity(options);\n\n if (severity !== 0) {\n this.validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []);\n }\n } catch (err) {\n const enhancedMessage = `Configuration for rule \"${ruleId}\" is invalid:\\n${err.message}`;\n\n if (typeof source === \"string\") {\n throw new Error(`${source}:\\n\\t${enhancedMessage}`);\n } else {\n throw new Error(enhancedMessage);\n }\n }\n }\n\n /**\n * Validates an environment object\n * @param {Object} environment The environment config object to validate.\n * @param {string} source The name of the configuration source to report in any errors.\n * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments.\n * @returns {void}\n */\n validateEnvironment(\n environment,\n source,\n getAdditionalEnv = noop\n ) {\n\n // not having an environment is ok\n if (!environment) {\n return;\n }\n\n Object.keys(environment).forEach(id => {\n const env = getAdditionalEnv(id) || BuiltInEnvironments.get(id) || null;\n\n if (!env) {\n const message = `${source}:\\n\\tEnvironment key \"${id}\" is unknown\\n`;\n\n throw new Error(message);\n }\n });\n }\n\n /**\n * Validates a rules config object\n * @param {Object} rulesConfig The rules config object to validate.\n * @param {string} source The name of the configuration source to report in any errors.\n * @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules\n * @returns {void}\n */\n validateRules(\n rulesConfig,\n source,\n getAdditionalRule = noop\n ) {\n if (!rulesConfig) {\n return;\n }\n\n Object.keys(rulesConfig).forEach(id => {\n const rule = getAdditionalRule(id) || this.builtInRules.get(id) || null;\n\n this.validateRuleOptions(rule, id, rulesConfig[id], source);\n });\n }\n\n /**\n * Validates a `globals` section of a config file\n * @param {Object} globalsConfig The `globals` section\n * @param {string|null} source The name of the configuration source to report in the event of an error.\n * @returns {void}\n */\n validateGlobals(globalsConfig, source = null) {\n if (!globalsConfig) {\n return;\n }\n\n Object.entries(globalsConfig)\n .forEach(([configuredGlobal, configuredValue]) => {\n try {\n ConfigOps.normalizeConfigGlobal(configuredValue);\n } catch (err) {\n throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\\n${err.message}`);\n }\n });\n }\n\n /**\n * Validate `processor` configuration.\n * @param {string|undefined} processorName The processor name.\n * @param {string} source The name of config file.\n * @param {function(id:string): Processor} getProcessor The getter of defined processors.\n * @returns {void}\n */\n validateProcessor(processorName, source, getProcessor) {\n if (processorName && !getProcessor(processorName)) {\n throw new Error(`ESLint configuration of processor in '${source}' is invalid: '${processorName}' was not found.`);\n }\n }\n\n /**\n * Formats an array of schema validation errors.\n * @param {Array} errors An array of error messages to format.\n * @returns {string} Formatted error message\n */\n formatErrors(errors) {\n return errors.map(error => {\n if (error.keyword === \"additionalProperties\") {\n const formattedPropertyPath = error.dataPath.length ? `${error.dataPath.slice(1)}.${error.params.additionalProperty}` : error.params.additionalProperty;\n\n return `Unexpected top-level property \"${formattedPropertyPath}\"`;\n }\n if (error.keyword === \"type\") {\n const formattedField = error.dataPath.slice(1);\n const formattedExpectedType = Array.isArray(error.schema) ? error.schema.join(\"/\") : error.schema;\n const formattedValue = JSON.stringify(error.data);\n\n return `Property \"${formattedField}\" is the wrong type (expected ${formattedExpectedType} but got \\`${formattedValue}\\`)`;\n }\n\n const field = error.dataPath[0] === \".\" ? error.dataPath.slice(1) : error.dataPath;\n\n return `\"${field}\" ${error.message}. Value: ${JSON.stringify(error.data)}`;\n }).map(message => `\\t- ${message}.\\n`).join(\"\");\n }\n\n /**\n * Validates the top level properties of the config object.\n * @param {Object} config The config object to validate.\n * @param {string} source The name of the configuration source to report in any errors.\n * @returns {void}\n */\n validateConfigSchema(config, source = null) {\n validateSchema = validateSchema || ajv.compile(configSchema);\n\n if (!validateSchema(config)) {\n throw new Error(`ESLint configuration in ${source} is invalid:\\n${this.formatErrors(validateSchema.errors)}`);\n }\n\n if (Object.hasOwnProperty.call(config, \"ecmaFeatures\")) {\n emitDeprecationWarning(source, \"ESLINT_LEGACY_ECMAFEATURES\");\n }\n }\n\n /**\n * Validates an entire config object.\n * @param {Object} config The config object to validate.\n * @param {string} source The name of the configuration source to report in any errors.\n * @param {function(ruleId:string): Object} [getAdditionalRule] A map from strings to loaded rules.\n * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded envs.\n * @returns {void}\n */\n validate(config, source, getAdditionalRule, getAdditionalEnv) {\n this.validateConfigSchema(config, source);\n this.validateRules(config.rules, source, getAdditionalRule);\n this.validateEnvironment(config.env, source, getAdditionalEnv);\n this.validateGlobals(config.globals, source);\n\n for (const override of config.overrides || []) {\n this.validateRules(override.rules, source, getAdditionalRule);\n this.validateEnvironment(override.env, source, getAdditionalEnv);\n this.validateGlobals(config.globals, source);\n }\n }\n\n /**\n * Validate config array object.\n * @param {ConfigArray} configArray The config array to validate.\n * @returns {void}\n */\n validateConfigArray(configArray) {\n const getPluginEnv = Map.prototype.get.bind(configArray.pluginEnvironments);\n const getPluginProcessor = Map.prototype.get.bind(configArray.pluginProcessors);\n const getPluginRule = Map.prototype.get.bind(configArray.pluginRules);\n\n // Validate.\n for (const element of configArray) {\n if (validated.has(element)) {\n continue;\n }\n validated.add(element);\n\n this.validateEnvironment(element.env, element.name, getPluginEnv);\n this.validateGlobals(element.globals, element.name);\n this.validateProcessor(element.processor, element.name, getPluginProcessor);\n this.validateRules(element.rules, element.name, getPluginRule);\n }\n }\n\n}\n","/**\n * @fileoverview Common helpers for naming of plugins, formatters and configs\n */\n\nconst NAMESPACE_REGEX = /^@.*\\//iu;\n\n/**\n * Brings package name to correct format based on prefix\n * @param {string} name The name of the package.\n * @param {string} prefix Can be either \"eslint-plugin\", \"eslint-config\" or \"eslint-formatter\"\n * @returns {string} Normalized name of the package\n * @private\n */\nfunction normalizePackageName(name, prefix) {\n let normalizedName = name;\n\n /**\n * On Windows, name can come in with Windows slashes instead of Unix slashes.\n * Normalize to Unix first to avoid errors later on.\n * https://github.com/eslint/eslint/issues/5644\n */\n if (normalizedName.includes(\"\\\\\")) {\n normalizedName = normalizedName.replace(/\\\\/gu, \"/\");\n }\n\n if (normalizedName.charAt(0) === \"@\") {\n\n /**\n * it's a scoped package\n * package name is the prefix, or just a username\n */\n const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`, \"u\"),\n scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, \"u\");\n\n if (scopedPackageShortcutRegex.test(normalizedName)) {\n normalizedName = normalizedName.replace(scopedPackageShortcutRegex, `$1/${prefix}`);\n } else if (!scopedPackageNameRegex.test(normalizedName.split(\"/\")[1])) {\n\n /**\n * for scoped packages, insert the prefix after the first / unless\n * the path is already @scope/eslint or @scope/eslint-xxx-yyy\n */\n normalizedName = normalizedName.replace(/^@([^/]+)\\/(.*)$/u, `@$1/${prefix}-$2`);\n }\n } else if (!normalizedName.startsWith(`${prefix}-`)) {\n normalizedName = `${prefix}-${normalizedName}`;\n }\n\n return normalizedName;\n}\n\n/**\n * Removes the prefix from a fullname.\n * @param {string} fullname The term which may have the prefix.\n * @param {string} prefix The prefix to remove.\n * @returns {string} The term without prefix.\n */\nfunction getShorthandName(fullname, prefix) {\n if (fullname[0] === \"@\") {\n let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, \"u\").exec(fullname);\n\n if (matchResult) {\n return matchResult[1];\n }\n\n matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, \"u\").exec(fullname);\n if (matchResult) {\n return `${matchResult[1]}/${matchResult[2]}`;\n }\n } else if (fullname.startsWith(`${prefix}-`)) {\n return fullname.slice(prefix.length + 1);\n }\n\n return fullname;\n}\n\n/**\n * Gets the scope (namespace) of a term.\n * @param {string} term The term which may have the namespace.\n * @returns {string} The namespace of the term if it has one.\n */\nfunction getNamespaceFromTerm(term) {\n const match = term.match(NAMESPACE_REGEX);\n\n return match ? match[0] : \"\";\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\nexport {\n normalizePackageName,\n getShorthandName,\n getNamespaceFromTerm\n};\n","/**\n * Utility for resolving a module relative to another module\n * @author Teddy Katz\n */\n\nimport Module from \"module\";\n\n/*\n * `Module.createRequire` is added in v12.2.0. It supports URL as well.\n * We only support the case where the argument is a filepath, not a URL.\n */\nconst createRequire = Module.createRequire;\n\n/**\n * Resolves a Node module relative to another module\n * @param {string} moduleName The name of a Node module, or a path to a Node module.\n * @param {string} relativeToPath An absolute path indicating the module that `moduleName` should be resolved relative to. This must be\n * a file rather than a directory, but the file need not actually exist.\n * @returns {string} The absolute path that would result from calling `require.resolve(moduleName)` in a file located at `relativeToPath`\n */\nfunction resolve(moduleName, relativeToPath) {\n try {\n return createRequire(relativeToPath).resolve(moduleName);\n } catch (error) {\n\n // This `if` block is for older Node.js than 12.0.0. We can remove this block in the future.\n if (\n typeof error === \"object\" &&\n error !== null &&\n error.code === \"MODULE_NOT_FOUND\" &&\n !error.requireStack &&\n error.message.includes(moduleName)\n ) {\n error.message += `\\nRequire stack:\\n- ${relativeToPath}`;\n }\n throw error;\n }\n}\n\nexport {\n resolve\n};\n","/**\n * @fileoverview The factory of `ConfigArray` objects.\n *\n * This class provides methods to create `ConfigArray` instance.\n *\n * - `create(configData, options)`\n * Create a `ConfigArray` instance from a config data. This is to handle CLI\n * options except `--config`.\n * - `loadFile(filePath, options)`\n * Create a `ConfigArray` instance from a config file. This is to handle\n * `--config` option. If the file was not found, throws the following error:\n * - If the filename was `*.js`, a `MODULE_NOT_FOUND` error.\n * - If the filename was `package.json`, an IO error or an\n * `ESLINT_CONFIG_FIELD_NOT_FOUND` error.\n * - Otherwise, an IO error such as `ENOENT`.\n * - `loadInDirectory(directoryPath, options)`\n * Create a `ConfigArray` instance from a config file which is on a given\n * directory. This tries to load `.eslintrc.*` or `package.json`. If not\n * found, returns an empty `ConfigArray`.\n * - `loadESLintIgnore(filePath)`\n * Create a `ConfigArray` instance from a config file that is `.eslintignore`\n * format. This is to handle `--ignore-path` option.\n * - `loadDefaultESLintIgnore()`\n * Create a `ConfigArray` instance from `.eslintignore` or `package.json` in\n * the current working directory.\n *\n * `ConfigArrayFactory` class has the responsibility that loads configuration\n * files, including loading `extends`, `parser`, and `plugins`. The created\n * `ConfigArray` instance has the loaded `extends`, `parser`, and `plugins`.\n *\n * But this class doesn't handle cascading. `CascadingConfigArrayFactory` class\n * handles cascading and hierarchy.\n *\n * @author Toru Nagashima \n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport debugOrig from \"debug\";\nimport fs from \"fs\";\nimport importFresh from \"import-fresh\";\nimport { createRequire } from \"module\";\nimport path from \"path\";\nimport stripComments from \"strip-json-comments\";\n\nimport {\n ConfigArray,\n ConfigDependency,\n IgnorePattern,\n OverrideTester\n} from \"./config-array/index.js\";\nimport ConfigValidator from \"./shared/config-validator.js\";\nimport * as naming from \"./shared/naming.js\";\nimport * as ModuleResolver from \"./shared/relative-module-resolver.js\";\n\nconst require = createRequire(import.meta.url);\n\nconst debug = debugOrig(\"eslintrc:config-array-factory\");\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\nconst configFilenames = [\n \".eslintrc.js\",\n \".eslintrc.cjs\",\n \".eslintrc.yaml\",\n \".eslintrc.yml\",\n \".eslintrc.json\",\n \".eslintrc\",\n \"package.json\"\n];\n\n// Define types for VSCode IntelliSense.\n/** @typedef {import(\"./shared/types\").ConfigData} ConfigData */\n/** @typedef {import(\"./shared/types\").OverrideConfigData} OverrideConfigData */\n/** @typedef {import(\"./shared/types\").Parser} Parser */\n/** @typedef {import(\"./shared/types\").Plugin} Plugin */\n/** @typedef {import(\"./shared/types\").Rule} Rule */\n/** @typedef {import(\"./config-array/config-dependency\").DependentParser} DependentParser */\n/** @typedef {import(\"./config-array/config-dependency\").DependentPlugin} DependentPlugin */\n/** @typedef {ConfigArray[0]} ConfigArrayElement */\n\n/**\n * @typedef {Object} ConfigArrayFactoryOptions\n * @property {Map} [additionalPluginPool] The map for additional plugins.\n * @property {string} [cwd] The path to the current working directory.\n * @property {string} [resolvePluginsRelativeTo] A path to the directory that plugins should be resolved from. Defaults to `cwd`.\n * @property {Map} builtInRules The rules that are built in to ESLint.\n * @property {Object} [resolver=ModuleResolver] The module resolver object.\n * @property {string} eslintAllPath The path to the definitions for eslint:all.\n * @property {Function} getEslintAllConfig Returns the config data for eslint:all.\n * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended.\n * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended.\n */\n\n/**\n * @typedef {Object} ConfigArrayFactoryInternalSlots\n * @property {Map} additionalPluginPool The map for additional plugins.\n * @property {string} cwd The path to the current working directory.\n * @property {string | undefined} resolvePluginsRelativeTo An absolute path the the directory that plugins should be resolved from.\n * @property {Map} builtInRules The rules that are built in to ESLint.\n * @property {Object} [resolver=ModuleResolver] The module resolver object.\n * @property {string} eslintAllPath The path to the definitions for eslint:all.\n * @property {Function} getEslintAllConfig Returns the config data for eslint:all.\n * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended.\n * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended.\n */\n\n/**\n * @typedef {Object} ConfigArrayFactoryLoadingContext\n * @property {string} filePath The path to the current configuration.\n * @property {string} matchBasePath The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.\n * @property {string} name The name of the current configuration.\n * @property {string} pluginBasePath The base path to resolve plugins.\n * @property {\"config\" | \"ignore\" | \"implicit-processor\"} type The type of the current configuration. This is `\"config\"` in normal. This is `\"ignore\"` if it came from `.eslintignore`. This is `\"implicit-processor\"` if it came from legacy file-extension processors.\n */\n\n/**\n * @typedef {Object} ConfigArrayFactoryLoadingContext\n * @property {string} filePath The path to the current configuration.\n * @property {string} matchBasePath The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.\n * @property {string} name The name of the current configuration.\n * @property {\"config\" | \"ignore\" | \"implicit-processor\"} type The type of the current configuration. This is `\"config\"` in normal. This is `\"ignore\"` if it came from `.eslintignore`. This is `\"implicit-processor\"` if it came from legacy file-extension processors.\n */\n\n/** @type {WeakMap} */\nconst internalSlotsMap = new WeakMap();\n\n/** @type {WeakMap} */\nconst normalizedPlugins = new WeakMap();\n\n/**\n * Check if a given string is a file path.\n * @param {string} nameOrPath A module name or file path.\n * @returns {boolean} `true` if the `nameOrPath` is a file path.\n */\nfunction isFilePath(nameOrPath) {\n return (\n /^\\.{1,2}[/\\\\]/u.test(nameOrPath) ||\n path.isAbsolute(nameOrPath)\n );\n}\n\n/**\n * Convenience wrapper for synchronously reading file contents.\n * @param {string} filePath The filename to read.\n * @returns {string} The file contents, with the BOM removed.\n * @private\n */\nfunction readFile(filePath) {\n return fs.readFileSync(filePath, \"utf8\").replace(/^\\ufeff/u, \"\");\n}\n\n/**\n * Loads a YAML configuration from a file.\n * @param {string} filePath The filename to load.\n * @returns {ConfigData} The configuration object from the file.\n * @throws {Error} If the file cannot be read.\n * @private\n */\nfunction loadYAMLConfigFile(filePath) {\n debug(`Loading YAML config file: ${filePath}`);\n\n // lazy load YAML to improve performance when not used\n const yaml = require(\"js-yaml\");\n\n try {\n\n // empty YAML file can be null, so always use\n return yaml.load(readFile(filePath)) || {};\n } catch (e) {\n debug(`Error reading YAML file: ${filePath}`);\n e.message = `Cannot read config file: ${filePath}\\nError: ${e.message}`;\n throw e;\n }\n}\n\n/**\n * Loads a JSON configuration from a file.\n * @param {string} filePath The filename to load.\n * @returns {ConfigData} The configuration object from the file.\n * @throws {Error} If the file cannot be read.\n * @private\n */\nfunction loadJSONConfigFile(filePath) {\n debug(`Loading JSON config file: ${filePath}`);\n\n try {\n return JSON.parse(stripComments(readFile(filePath)));\n } catch (e) {\n debug(`Error reading JSON file: ${filePath}`);\n e.message = `Cannot read config file: ${filePath}\\nError: ${e.message}`;\n e.messageTemplate = \"failed-to-read-json\";\n e.messageData = {\n path: filePath,\n message: e.message\n };\n throw e;\n }\n}\n\n/**\n * Loads a legacy (.eslintrc) configuration from a file.\n * @param {string} filePath The filename to load.\n * @returns {ConfigData} The configuration object from the file.\n * @throws {Error} If the file cannot be read.\n * @private\n */\nfunction loadLegacyConfigFile(filePath) {\n debug(`Loading legacy config file: ${filePath}`);\n\n // lazy load YAML to improve performance when not used\n const yaml = require(\"js-yaml\");\n\n try {\n return yaml.load(stripComments(readFile(filePath))) || /* istanbul ignore next */ {};\n } catch (e) {\n debug(\"Error reading YAML file: %s\\n%o\", filePath, e);\n e.message = `Cannot read config file: ${filePath}\\nError: ${e.message}`;\n throw e;\n }\n}\n\n/**\n * Loads a JavaScript configuration from a file.\n * @param {string} filePath The filename to load.\n * @returns {ConfigData} The configuration object from the file.\n * @throws {Error} If the file cannot be read.\n * @private\n */\nfunction loadJSConfigFile(filePath) {\n debug(`Loading JS config file: ${filePath}`);\n try {\n return importFresh(filePath);\n } catch (e) {\n debug(`Error reading JavaScript file: ${filePath}`);\n e.message = `Cannot read config file: ${filePath}\\nError: ${e.message}`;\n throw e;\n }\n}\n\n/**\n * Loads a configuration from a package.json file.\n * @param {string} filePath The filename to load.\n * @returns {ConfigData} The configuration object from the file.\n * @throws {Error} If the file cannot be read.\n * @private\n */\nfunction loadPackageJSONConfigFile(filePath) {\n debug(`Loading package.json config file: ${filePath}`);\n try {\n const packageData = loadJSONConfigFile(filePath);\n\n if (!Object.hasOwnProperty.call(packageData, \"eslintConfig\")) {\n throw Object.assign(\n new Error(\"package.json file doesn't have 'eslintConfig' field.\"),\n { code: \"ESLINT_CONFIG_FIELD_NOT_FOUND\" }\n );\n }\n\n return packageData.eslintConfig;\n } catch (e) {\n debug(`Error reading package.json file: ${filePath}`);\n e.message = `Cannot read config file: ${filePath}\\nError: ${e.message}`;\n throw e;\n }\n}\n\n/**\n * Loads a `.eslintignore` from a file.\n * @param {string} filePath The filename to load.\n * @returns {string[]} The ignore patterns from the file.\n * @private\n */\nfunction loadESLintIgnoreFile(filePath) {\n debug(`Loading .eslintignore file: ${filePath}`);\n\n try {\n return readFile(filePath)\n .split(/\\r?\\n/gu)\n .filter(line => line.trim() !== \"\" && !line.startsWith(\"#\"));\n } catch (e) {\n debug(`Error reading .eslintignore file: ${filePath}`);\n e.message = `Cannot read .eslintignore file: ${filePath}\\nError: ${e.message}`;\n throw e;\n }\n}\n\n/**\n * Creates an error to notify about a missing config to extend from.\n * @param {string} configName The name of the missing config.\n * @param {string} importerName The name of the config that imported the missing config\n * @param {string} messageTemplate The text template to source error strings from.\n * @returns {Error} The error object to throw\n * @private\n */\nfunction configInvalidError(configName, importerName, messageTemplate) {\n return Object.assign(\n new Error(`Failed to load config \"${configName}\" to extend from.`),\n {\n messageTemplate,\n messageData: { configName, importerName }\n }\n );\n}\n\n/**\n * Loads a configuration file regardless of the source. Inspects the file path\n * to determine the correctly way to load the config file.\n * @param {string} filePath The path to the configuration.\n * @returns {ConfigData|null} The configuration information.\n * @private\n */\nfunction loadConfigFile(filePath) {\n switch (path.extname(filePath)) {\n case \".js\":\n case \".cjs\":\n return loadJSConfigFile(filePath);\n\n case \".json\":\n if (path.basename(filePath) === \"package.json\") {\n return loadPackageJSONConfigFile(filePath);\n }\n return loadJSONConfigFile(filePath);\n\n case \".yaml\":\n case \".yml\":\n return loadYAMLConfigFile(filePath);\n\n default:\n return loadLegacyConfigFile(filePath);\n }\n}\n\n/**\n * Write debug log.\n * @param {string} request The requested module name.\n * @param {string} relativeTo The file path to resolve the request relative to.\n * @param {string} filePath The resolved file path.\n * @returns {void}\n */\nfunction writeDebugLogForLoading(request, relativeTo, filePath) {\n /* istanbul ignore next */\n if (debug.enabled) {\n let nameAndVersion = null;\n\n try {\n const packageJsonPath = ModuleResolver.resolve(\n `${request}/package.json`,\n relativeTo\n );\n const { version = \"unknown\" } = require(packageJsonPath);\n\n nameAndVersion = `${request}@${version}`;\n } catch (error) {\n debug(\"package.json was not found:\", error.message);\n nameAndVersion = request;\n }\n\n debug(\"Loaded: %s (%s)\", nameAndVersion, filePath);\n }\n}\n\n/**\n * Create a new context with default values.\n * @param {ConfigArrayFactoryInternalSlots} slots The internal slots.\n * @param {\"config\" | \"ignore\" | \"implicit-processor\" | undefined} providedType The type of the current configuration. Default is `\"config\"`.\n * @param {string | undefined} providedName The name of the current configuration. Default is the relative path from `cwd` to `filePath`.\n * @param {string | undefined} providedFilePath The path to the current configuration. Default is empty string.\n * @param {string | undefined} providedMatchBasePath The type of the current configuration. Default is the directory of `filePath` or `cwd`.\n * @returns {ConfigArrayFactoryLoadingContext} The created context.\n */\nfunction createContext(\n { cwd, resolvePluginsRelativeTo },\n providedType,\n providedName,\n providedFilePath,\n providedMatchBasePath\n) {\n const filePath = providedFilePath\n ? path.resolve(cwd, providedFilePath)\n : \"\";\n const matchBasePath =\n (providedMatchBasePath && path.resolve(cwd, providedMatchBasePath)) ||\n (filePath && path.dirname(filePath)) ||\n cwd;\n const name =\n providedName ||\n (filePath && path.relative(cwd, filePath)) ||\n \"\";\n const pluginBasePath =\n resolvePluginsRelativeTo ||\n (filePath && path.dirname(filePath)) ||\n cwd;\n const type = providedType || \"config\";\n\n return { filePath, matchBasePath, name, pluginBasePath, type };\n}\n\n/**\n * Normalize a given plugin.\n * - Ensure the object to have four properties: configs, environments, processors, and rules.\n * - Ensure the object to not have other properties.\n * @param {Plugin} plugin The plugin to normalize.\n * @returns {Plugin} The normalized plugin.\n */\nfunction normalizePlugin(plugin) {\n\n // first check the cache\n let normalizedPlugin = normalizedPlugins.get(plugin);\n\n if (normalizedPlugin) {\n return normalizedPlugin;\n }\n\n normalizedPlugin = {\n configs: plugin.configs || {},\n environments: plugin.environments || {},\n processors: plugin.processors || {},\n rules: plugin.rules || {}\n };\n\n // save the reference for later\n normalizedPlugins.set(plugin, normalizedPlugin);\n\n return normalizedPlugin;\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * The factory of `ConfigArray` objects.\n */\nclass ConfigArrayFactory {\n\n /**\n * Initialize this instance.\n * @param {ConfigArrayFactoryOptions} [options] The map for additional plugins.\n */\n constructor({\n additionalPluginPool = new Map(),\n cwd = process.cwd(),\n resolvePluginsRelativeTo,\n builtInRules,\n resolver = ModuleResolver,\n eslintAllPath,\n getEslintAllConfig,\n eslintRecommendedPath,\n getEslintRecommendedConfig\n } = {}) {\n internalSlotsMap.set(this, {\n additionalPluginPool,\n cwd,\n resolvePluginsRelativeTo:\n resolvePluginsRelativeTo &&\n path.resolve(cwd, resolvePluginsRelativeTo),\n builtInRules,\n resolver,\n eslintAllPath,\n getEslintAllConfig,\n eslintRecommendedPath,\n getEslintRecommendedConfig\n });\n }\n\n /**\n * Create `ConfigArray` instance from a config data.\n * @param {ConfigData|null} configData The config data to create.\n * @param {Object} [options] The options.\n * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.\n * @param {string} [options.filePath] The path to this config data.\n * @param {string} [options.name] The config name.\n * @returns {ConfigArray} Loaded config.\n */\n create(configData, { basePath, filePath, name } = {}) {\n if (!configData) {\n return new ConfigArray();\n }\n\n const slots = internalSlotsMap.get(this);\n const ctx = createContext(slots, \"config\", name, filePath, basePath);\n const elements = this._normalizeConfigData(configData, ctx);\n\n return new ConfigArray(...elements);\n }\n\n /**\n * Load a config file.\n * @param {string} filePath The path to a config file.\n * @param {Object} [options] The options.\n * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.\n * @param {string} [options.name] The config name.\n * @returns {ConfigArray} Loaded config.\n */\n loadFile(filePath, { basePath, name } = {}) {\n const slots = internalSlotsMap.get(this);\n const ctx = createContext(slots, \"config\", name, filePath, basePath);\n\n return new ConfigArray(...this._loadConfigData(ctx));\n }\n\n /**\n * Load the config file on a given directory if exists.\n * @param {string} directoryPath The path to a directory.\n * @param {Object} [options] The options.\n * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.\n * @param {string} [options.name] The config name.\n * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.\n */\n loadInDirectory(directoryPath, { basePath, name } = {}) {\n const slots = internalSlotsMap.get(this);\n\n for (const filename of configFilenames) {\n const ctx = createContext(\n slots,\n \"config\",\n name,\n path.join(directoryPath, filename),\n basePath\n );\n\n if (fs.existsSync(ctx.filePath) && fs.statSync(ctx.filePath).isFile()) {\n let configData;\n\n try {\n configData = loadConfigFile(ctx.filePath);\n } catch (error) {\n if (!error || error.code !== \"ESLINT_CONFIG_FIELD_NOT_FOUND\") {\n throw error;\n }\n }\n\n if (configData) {\n debug(`Config file found: ${ctx.filePath}`);\n return new ConfigArray(\n ...this._normalizeConfigData(configData, ctx)\n );\n }\n }\n }\n\n debug(`Config file not found on ${directoryPath}`);\n return new ConfigArray();\n }\n\n /**\n * Check if a config file on a given directory exists or not.\n * @param {string} directoryPath The path to a directory.\n * @returns {string | null} The path to the found config file. If not found then null.\n */\n static getPathToConfigFileInDirectory(directoryPath) {\n for (const filename of configFilenames) {\n const filePath = path.join(directoryPath, filename);\n\n if (fs.existsSync(filePath)) {\n if (filename === \"package.json\") {\n try {\n loadPackageJSONConfigFile(filePath);\n return filePath;\n } catch { /* ignore */ }\n } else {\n return filePath;\n }\n }\n }\n return null;\n }\n\n /**\n * Load `.eslintignore` file.\n * @param {string} filePath The path to a `.eslintignore` file to load.\n * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.\n */\n loadESLintIgnore(filePath) {\n const slots = internalSlotsMap.get(this);\n const ctx = createContext(\n slots,\n \"ignore\",\n void 0,\n filePath,\n slots.cwd\n );\n const ignorePatterns = loadESLintIgnoreFile(ctx.filePath);\n\n return new ConfigArray(\n ...this._normalizeESLintIgnoreData(ignorePatterns, ctx)\n );\n }\n\n /**\n * Load `.eslintignore` file in the current working directory.\n * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.\n */\n loadDefaultESLintIgnore() {\n const slots = internalSlotsMap.get(this);\n const eslintIgnorePath = path.resolve(slots.cwd, \".eslintignore\");\n const packageJsonPath = path.resolve(slots.cwd, \"package.json\");\n\n if (fs.existsSync(eslintIgnorePath)) {\n return this.loadESLintIgnore(eslintIgnorePath);\n }\n if (fs.existsSync(packageJsonPath)) {\n const data = loadJSONConfigFile(packageJsonPath);\n\n if (Object.hasOwnProperty.call(data, \"eslintIgnore\")) {\n if (!Array.isArray(data.eslintIgnore)) {\n throw new Error(\"Package.json eslintIgnore property requires an array of paths\");\n }\n const ctx = createContext(\n slots,\n \"ignore\",\n \"eslintIgnore in package.json\",\n packageJsonPath,\n slots.cwd\n );\n\n return new ConfigArray(\n ...this._normalizeESLintIgnoreData(data.eslintIgnore, ctx)\n );\n }\n }\n\n return new ConfigArray();\n }\n\n /**\n * Load a given config file.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} Loaded config.\n * @private\n */\n _loadConfigData(ctx) {\n return this._normalizeConfigData(loadConfigFile(ctx.filePath), ctx);\n }\n\n /**\n * Normalize a given `.eslintignore` data to config array elements.\n * @param {string[]} ignorePatterns The patterns to ignore files.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n *_normalizeESLintIgnoreData(ignorePatterns, ctx) {\n const elements = this._normalizeObjectConfigData(\n { ignorePatterns },\n ctx\n );\n\n // Set `ignorePattern.loose` flag for backward compatibility.\n for (const element of elements) {\n if (element.ignorePattern) {\n element.ignorePattern.loose = true;\n }\n yield element;\n }\n }\n\n /**\n * Normalize a given config to an array.\n * @param {ConfigData} configData The config data to normalize.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n _normalizeConfigData(configData, ctx) {\n const validator = new ConfigValidator();\n\n validator.validateConfigSchema(configData, ctx.name || ctx.filePath);\n return this._normalizeObjectConfigData(configData, ctx);\n }\n\n /**\n * Normalize a given config to an array.\n * @param {ConfigData|OverrideConfigData} configData The config data to normalize.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n *_normalizeObjectConfigData(configData, ctx) {\n const { files, excludedFiles, ...configBody } = configData;\n const criteria = OverrideTester.create(\n files,\n excludedFiles,\n ctx.matchBasePath\n );\n const elements = this._normalizeObjectConfigDataBody(configBody, ctx);\n\n // Apply the criteria to every element.\n for (const element of elements) {\n\n /*\n * Merge the criteria.\n * This is for the `overrides` entries that came from the\n * configurations of `overrides[].extends`.\n */\n element.criteria = OverrideTester.and(criteria, element.criteria);\n\n /*\n * Remove `root` property to ignore `root` settings which came from\n * `extends` in `overrides`.\n */\n if (element.criteria) {\n element.root = void 0;\n }\n\n yield element;\n }\n }\n\n /**\n * Normalize a given config to an array.\n * @param {ConfigData} configData The config data to normalize.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n *_normalizeObjectConfigDataBody(\n {\n env,\n extends: extend,\n globals,\n ignorePatterns,\n noInlineConfig,\n parser: parserName,\n parserOptions,\n plugins: pluginList,\n processor,\n reportUnusedDisableDirectives,\n root,\n rules,\n settings,\n overrides: overrideList = []\n },\n ctx\n ) {\n const extendList = Array.isArray(extend) ? extend : [extend];\n const ignorePattern = ignorePatterns && new IgnorePattern(\n Array.isArray(ignorePatterns) ? ignorePatterns : [ignorePatterns],\n ctx.matchBasePath\n );\n\n // Flatten `extends`.\n for (const extendName of extendList.filter(Boolean)) {\n yield* this._loadExtends(extendName, ctx);\n }\n\n // Load parser & plugins.\n const parser = parserName && this._loadParser(parserName, ctx);\n const plugins = pluginList && this._loadPlugins(pluginList, ctx);\n\n // Yield pseudo config data for file extension processors.\n if (plugins) {\n yield* this._takeFileExtensionProcessors(plugins, ctx);\n }\n\n // Yield the config data except `extends` and `overrides`.\n yield {\n\n // Debug information.\n type: ctx.type,\n name: ctx.name,\n filePath: ctx.filePath,\n\n // Config data.\n criteria: null,\n env,\n globals,\n ignorePattern,\n noInlineConfig,\n parser,\n parserOptions,\n plugins,\n processor,\n reportUnusedDisableDirectives,\n root,\n rules,\n settings\n };\n\n // Flatten `overries`.\n for (let i = 0; i < overrideList.length; ++i) {\n yield* this._normalizeObjectConfigData(\n overrideList[i],\n { ...ctx, name: `${ctx.name}#overrides[${i}]` }\n );\n }\n }\n\n /**\n * Load configs of an element in `extends`.\n * @param {string} extendName The name of a base config.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n _loadExtends(extendName, ctx) {\n debug(\"Loading {extends:%j} relative to %s\", extendName, ctx.filePath);\n try {\n if (extendName.startsWith(\"eslint:\")) {\n return this._loadExtendedBuiltInConfig(extendName, ctx);\n }\n if (extendName.startsWith(\"plugin:\")) {\n return this._loadExtendedPluginConfig(extendName, ctx);\n }\n return this._loadExtendedShareableConfig(extendName, ctx);\n } catch (error) {\n error.message += `\\nReferenced from: ${ctx.filePath || ctx.name}`;\n throw error;\n }\n }\n\n /**\n * Load configs of an element in `extends`.\n * @param {string} extendName The name of a base config.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n _loadExtendedBuiltInConfig(extendName, ctx) {\n const {\n eslintAllPath,\n getEslintAllConfig,\n eslintRecommendedPath,\n getEslintRecommendedConfig\n } = internalSlotsMap.get(this);\n\n if (extendName === \"eslint:recommended\") {\n const name = `${ctx.name} » ${extendName}`;\n\n if (getEslintRecommendedConfig) {\n if (typeof getEslintRecommendedConfig !== \"function\") {\n throw new Error(`getEslintRecommendedConfig must be a function instead of '${getEslintRecommendedConfig}'`);\n }\n return this._normalizeConfigData(getEslintRecommendedConfig(), { ...ctx, name, filePath: \"\" });\n }\n return this._loadConfigData({\n ...ctx,\n name,\n filePath: eslintRecommendedPath\n });\n }\n if (extendName === \"eslint:all\") {\n const name = `${ctx.name} » ${extendName}`;\n\n if (getEslintAllConfig) {\n if (typeof getEslintAllConfig !== \"function\") {\n throw new Error(`getEslintAllConfig must be a function instead of '${getEslintAllConfig}'`);\n }\n return this._normalizeConfigData(getEslintAllConfig(), { ...ctx, name, filePath: \"\" });\n }\n return this._loadConfigData({\n ...ctx,\n name,\n filePath: eslintAllPath\n });\n }\n\n throw configInvalidError(extendName, ctx.name, \"extend-config-missing\");\n }\n\n /**\n * Load configs of an element in `extends`.\n * @param {string} extendName The name of a base config.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n _loadExtendedPluginConfig(extendName, ctx) {\n const slashIndex = extendName.lastIndexOf(\"/\");\n\n if (slashIndex === -1) {\n throw configInvalidError(extendName, ctx.filePath, \"plugin-invalid\");\n }\n\n const pluginName = extendName.slice(\"plugin:\".length, slashIndex);\n const configName = extendName.slice(slashIndex + 1);\n\n if (isFilePath(pluginName)) {\n throw new Error(\"'extends' cannot use a file path for plugins.\");\n }\n\n const plugin = this._loadPlugin(pluginName, ctx);\n const configData =\n plugin.definition &&\n plugin.definition.configs[configName];\n\n if (configData) {\n return this._normalizeConfigData(configData, {\n ...ctx,\n filePath: plugin.filePath || ctx.filePath,\n name: `${ctx.name} » plugin:${plugin.id}/${configName}`\n });\n }\n\n throw plugin.error || configInvalidError(extendName, ctx.filePath, \"extend-config-missing\");\n }\n\n /**\n * Load configs of an element in `extends`.\n * @param {string} extendName The name of a base config.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n _loadExtendedShareableConfig(extendName, ctx) {\n const { cwd, resolver } = internalSlotsMap.get(this);\n const relativeTo = ctx.filePath || path.join(cwd, \"__placeholder__.js\");\n let request;\n\n if (isFilePath(extendName)) {\n request = extendName;\n } else if (extendName.startsWith(\".\")) {\n request = `./${extendName}`; // For backward compatibility. A ton of tests depended on this behavior.\n } else {\n request = naming.normalizePackageName(\n extendName,\n \"eslint-config\"\n );\n }\n\n let filePath;\n\n try {\n filePath = resolver.resolve(request, relativeTo);\n } catch (error) {\n /* istanbul ignore else */\n if (error && error.code === \"MODULE_NOT_FOUND\") {\n throw configInvalidError(extendName, ctx.filePath, \"extend-config-missing\");\n }\n throw error;\n }\n\n writeDebugLogForLoading(request, relativeTo, filePath);\n return this._loadConfigData({\n ...ctx,\n filePath,\n name: `${ctx.name} » ${request}`\n });\n }\n\n /**\n * Load given plugins.\n * @param {string[]} names The plugin names to load.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {Record} The loaded parser.\n * @private\n */\n _loadPlugins(names, ctx) {\n return names.reduce((map, name) => {\n if (isFilePath(name)) {\n throw new Error(\"Plugins array cannot includes file paths.\");\n }\n const plugin = this._loadPlugin(name, ctx);\n\n map[plugin.id] = plugin;\n\n return map;\n }, {});\n }\n\n /**\n * Load a given parser.\n * @param {string} nameOrPath The package name or the path to a parser file.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {DependentParser} The loaded parser.\n */\n _loadParser(nameOrPath, ctx) {\n debug(\"Loading parser %j from %s\", nameOrPath, ctx.filePath);\n\n const { cwd, resolver } = internalSlotsMap.get(this);\n const relativeTo = ctx.filePath || path.join(cwd, \"__placeholder__.js\");\n\n try {\n const filePath = resolver.resolve(nameOrPath, relativeTo);\n\n writeDebugLogForLoading(nameOrPath, relativeTo, filePath);\n\n return new ConfigDependency({\n definition: require(filePath),\n filePath,\n id: nameOrPath,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n } catch (error) {\n\n // If the parser name is \"espree\", load the espree of ESLint.\n if (nameOrPath === \"espree\") {\n debug(\"Fallback espree.\");\n return new ConfigDependency({\n definition: require(\"espree\"),\n filePath: require.resolve(\"espree\"),\n id: nameOrPath,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n }\n\n debug(\"Failed to load parser '%s' declared in '%s'.\", nameOrPath, ctx.name);\n error.message = `Failed to load parser '${nameOrPath}' declared in '${ctx.name}': ${error.message}`;\n\n return new ConfigDependency({\n error,\n id: nameOrPath,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n }\n }\n\n /**\n * Load a given plugin.\n * @param {string} name The plugin name to load.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {DependentPlugin} The loaded plugin.\n * @private\n */\n _loadPlugin(name, ctx) {\n debug(\"Loading plugin %j from %s\", name, ctx.filePath);\n\n const { additionalPluginPool, resolver } = internalSlotsMap.get(this);\n const request = naming.normalizePackageName(name, \"eslint-plugin\");\n const id = naming.getShorthandName(request, \"eslint-plugin\");\n const relativeTo = path.join(ctx.pluginBasePath, \"__placeholder__.js\");\n\n if (name.match(/\\s+/u)) {\n const error = Object.assign(\n new Error(`Whitespace found in plugin name '${name}'`),\n {\n messageTemplate: \"whitespace-found\",\n messageData: { pluginName: request }\n }\n );\n\n return new ConfigDependency({\n error,\n id,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n }\n\n // Check for additional pool.\n const plugin =\n additionalPluginPool.get(request) ||\n additionalPluginPool.get(id);\n\n if (plugin) {\n return new ConfigDependency({\n definition: normalizePlugin(plugin),\n filePath: \"\", // It's unknown where the plugin came from.\n id,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n }\n\n let filePath;\n let error;\n\n try {\n filePath = resolver.resolve(request, relativeTo);\n } catch (resolveError) {\n error = resolveError;\n /* istanbul ignore else */\n if (error && error.code === \"MODULE_NOT_FOUND\") {\n error.messageTemplate = \"plugin-missing\";\n error.messageData = {\n pluginName: request,\n resolvePluginsRelativeTo: ctx.pluginBasePath,\n importerName: ctx.name\n };\n }\n }\n\n if (filePath) {\n try {\n writeDebugLogForLoading(request, relativeTo, filePath);\n\n const startTime = Date.now();\n const pluginDefinition = require(filePath);\n\n debug(`Plugin ${filePath} loaded in: ${Date.now() - startTime}ms`);\n\n return new ConfigDependency({\n definition: normalizePlugin(pluginDefinition),\n filePath,\n id,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n } catch (loadError) {\n error = loadError;\n }\n }\n\n debug(\"Failed to load plugin '%s' declared in '%s'.\", name, ctx.name);\n error.message = `Failed to load plugin '${name}' declared in '${ctx.name}': ${error.message}`;\n return new ConfigDependency({\n error,\n id,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n }\n\n /**\n * Take file expression processors as config array elements.\n * @param {Record} plugins The plugin definitions.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The config array elements of file expression processors.\n * @private\n */\n *_takeFileExtensionProcessors(plugins, ctx) {\n for (const pluginId of Object.keys(plugins)) {\n const processors =\n plugins[pluginId] &&\n plugins[pluginId].definition &&\n plugins[pluginId].definition.processors;\n\n if (!processors) {\n continue;\n }\n\n for (const processorId of Object.keys(processors)) {\n if (processorId.startsWith(\".\")) {\n yield* this._normalizeObjectConfigData(\n {\n files: [`*${processorId}`],\n processor: `${pluginId}/${processorId}`\n },\n {\n ...ctx,\n type: \"implicit-processor\",\n name: `${ctx.name}#processors[\"${pluginId}/${processorId}\"]`\n }\n );\n }\n }\n }\n }\n}\n\nexport { ConfigArrayFactory, createContext };\n","/**\n * @fileoverview `CascadingConfigArrayFactory` class.\n *\n * `CascadingConfigArrayFactory` class has a responsibility:\n *\n * 1. Handles cascading of config files.\n *\n * It provides two methods:\n *\n * - `getConfigArrayForFile(filePath)`\n * Get the corresponded configuration of a given file. This method doesn't\n * throw even if the given file didn't exist.\n * - `clearCache()`\n * Clear the internal cache. You have to call this method when\n * `additionalPluginPool` was updated if `baseConfig` or `cliConfig` depends\n * on the additional plugins. (`CLIEngine#addPlugin()` method calls this.)\n *\n * @author Toru Nagashima \n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport debugOrig from \"debug\";\nimport os from \"os\";\nimport path from \"path\";\n\nimport { ConfigArrayFactory } from \"./config-array-factory.js\";\nimport {\n ConfigArray,\n ConfigDependency,\n IgnorePattern\n} from \"./config-array/index.js\";\nimport ConfigValidator from \"./shared/config-validator.js\";\nimport { emitDeprecationWarning } from \"./shared/deprecation-warnings.js\";\n\nconst debug = debugOrig(\"eslintrc:cascading-config-array-factory\");\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n// Define types for VSCode IntelliSense.\n/** @typedef {import(\"./shared/types\").ConfigData} ConfigData */\n/** @typedef {import(\"./shared/types\").Parser} Parser */\n/** @typedef {import(\"./shared/types\").Plugin} Plugin */\n/** @typedef {import(\"./shared/types\").Rule} Rule */\n/** @typedef {ReturnType} ConfigArray */\n\n/**\n * @typedef {Object} CascadingConfigArrayFactoryOptions\n * @property {Map} [additionalPluginPool] The map for additional plugins.\n * @property {ConfigData} [baseConfig] The config by `baseConfig` option.\n * @property {ConfigData} [cliConfig] The config by CLI options (`--env`, `--global`, `--ignore-pattern`, `--parser`, `--parser-options`, `--plugin`, and `--rule`). CLI options overwrite the setting in config files.\n * @property {string} [cwd] The base directory to start lookup.\n * @property {string} [ignorePath] The path to the alternative file of `.eslintignore`.\n * @property {string[]} [rulePaths] The value of `--rulesdir` option.\n * @property {string} [specificConfigPath] The value of `--config` option.\n * @property {boolean} [useEslintrc] if `false` then it doesn't load config files.\n * @property {Function} loadRules The function to use to load rules.\n * @property {Map} builtInRules The rules that are built in to ESLint.\n * @property {Object} [resolver=ModuleResolver] The module resolver object.\n * @property {string} eslintAllPath The path to the definitions for eslint:all.\n * @property {Function} getEslintAllConfig Returns the config data for eslint:all.\n * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended.\n * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended.\n */\n\n/**\n * @typedef {Object} CascadingConfigArrayFactoryInternalSlots\n * @property {ConfigArray} baseConfigArray The config array of `baseConfig` option.\n * @property {ConfigData} baseConfigData The config data of `baseConfig` option. This is used to reset `baseConfigArray`.\n * @property {ConfigArray} cliConfigArray The config array of CLI options.\n * @property {ConfigData} cliConfigData The config data of CLI options. This is used to reset `cliConfigArray`.\n * @property {ConfigArrayFactory} configArrayFactory The factory for config arrays.\n * @property {Map} configCache The cache from directory paths to config arrays.\n * @property {string} cwd The base directory to start lookup.\n * @property {WeakMap} finalizeCache The cache from config arrays to finalized config arrays.\n * @property {string} [ignorePath] The path to the alternative file of `.eslintignore`.\n * @property {string[]|null} rulePaths The value of `--rulesdir` option. This is used to reset `baseConfigArray`.\n * @property {string|null} specificConfigPath The value of `--config` option. This is used to reset `cliConfigArray`.\n * @property {boolean} useEslintrc if `false` then it doesn't load config files.\n * @property {Function} loadRules The function to use to load rules.\n * @property {Map} builtInRules The rules that are built in to ESLint.\n * @property {Object} [resolver=ModuleResolver] The module resolver object.\n * @property {string} eslintAllPath The path to the definitions for eslint:all.\n * @property {Function} getEslintAllConfig Returns the config data for eslint:all.\n * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended.\n * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended.\n */\n\n/** @type {WeakMap} */\nconst internalSlotsMap = new WeakMap();\n\n/**\n * Create the config array from `baseConfig` and `rulePaths`.\n * @param {CascadingConfigArrayFactoryInternalSlots} slots The slots.\n * @returns {ConfigArray} The config array of the base configs.\n */\nfunction createBaseConfigArray({\n configArrayFactory,\n baseConfigData,\n rulePaths,\n cwd,\n loadRules\n}) {\n const baseConfigArray = configArrayFactory.create(\n baseConfigData,\n { name: \"BaseConfig\" }\n );\n\n /*\n * Create the config array element for the default ignore patterns.\n * This element has `ignorePattern` property that ignores the default\n * patterns in the current working directory.\n */\n baseConfigArray.unshift(configArrayFactory.create(\n { ignorePatterns: IgnorePattern.DefaultPatterns },\n { name: \"DefaultIgnorePattern\" }\n )[0]);\n\n /*\n * Load rules `--rulesdir` option as a pseudo plugin.\n * Use a pseudo plugin to define rules of `--rulesdir`, so we can validate\n * the rule's options with only information in the config array.\n */\n if (rulePaths && rulePaths.length > 0) {\n baseConfigArray.push({\n type: \"config\",\n name: \"--rulesdir\",\n filePath: \"\",\n plugins: {\n \"\": new ConfigDependency({\n definition: {\n rules: rulePaths.reduce(\n (map, rulesPath) => Object.assign(\n map,\n loadRules(rulesPath, cwd)\n ),\n {}\n )\n },\n filePath: \"\",\n id: \"\",\n importerName: \"--rulesdir\",\n importerPath: \"\"\n })\n }\n });\n }\n\n return baseConfigArray;\n}\n\n/**\n * Create the config array from CLI options.\n * @param {CascadingConfigArrayFactoryInternalSlots} slots The slots.\n * @returns {ConfigArray} The config array of the base configs.\n */\nfunction createCLIConfigArray({\n cliConfigData,\n configArrayFactory,\n cwd,\n ignorePath,\n specificConfigPath\n}) {\n const cliConfigArray = configArrayFactory.create(\n cliConfigData,\n { name: \"CLIOptions\" }\n );\n\n cliConfigArray.unshift(\n ...(ignorePath\n ? configArrayFactory.loadESLintIgnore(ignorePath)\n : configArrayFactory.loadDefaultESLintIgnore())\n );\n\n if (specificConfigPath) {\n cliConfigArray.unshift(\n ...configArrayFactory.loadFile(\n specificConfigPath,\n { name: \"--config\", basePath: cwd }\n )\n );\n }\n\n return cliConfigArray;\n}\n\n/**\n * The error type when there are files matched by a glob, but all of them have been ignored.\n */\nclass ConfigurationNotFoundError extends Error {\n\n // eslint-disable-next-line jsdoc/require-description\n /**\n * @param {string} directoryPath The directory path.\n */\n constructor(directoryPath) {\n super(`No ESLint configuration found in ${directoryPath}.`);\n this.messageTemplate = \"no-config-found\";\n this.messageData = { directoryPath };\n }\n}\n\n/**\n * This class provides the functionality that enumerates every file which is\n * matched by given glob patterns and that configuration.\n */\nclass CascadingConfigArrayFactory {\n\n /**\n * Initialize this enumerator.\n * @param {CascadingConfigArrayFactoryOptions} options The options.\n */\n constructor({\n additionalPluginPool = new Map(),\n baseConfig: baseConfigData = null,\n cliConfig: cliConfigData = null,\n cwd = process.cwd(),\n ignorePath,\n resolvePluginsRelativeTo,\n rulePaths = [],\n specificConfigPath = null,\n useEslintrc = true,\n builtInRules = new Map(),\n loadRules,\n resolver,\n eslintRecommendedPath,\n getEslintRecommendedConfig,\n eslintAllPath,\n getEslintAllConfig\n } = {}) {\n const configArrayFactory = new ConfigArrayFactory({\n additionalPluginPool,\n cwd,\n resolvePluginsRelativeTo,\n builtInRules,\n resolver,\n eslintRecommendedPath,\n getEslintRecommendedConfig,\n eslintAllPath,\n getEslintAllConfig\n });\n\n internalSlotsMap.set(this, {\n baseConfigArray: createBaseConfigArray({\n baseConfigData,\n configArrayFactory,\n cwd,\n rulePaths,\n loadRules,\n resolver\n }),\n baseConfigData,\n cliConfigArray: createCLIConfigArray({\n cliConfigData,\n configArrayFactory,\n cwd,\n ignorePath,\n specificConfigPath\n }),\n cliConfigData,\n configArrayFactory,\n configCache: new Map(),\n cwd,\n finalizeCache: new WeakMap(),\n ignorePath,\n rulePaths,\n specificConfigPath,\n useEslintrc,\n builtInRules,\n loadRules\n });\n }\n\n /**\n * The path to the current working directory.\n * This is used by tests.\n * @type {string}\n */\n get cwd() {\n const { cwd } = internalSlotsMap.get(this);\n\n return cwd;\n }\n\n /**\n * Get the config array of a given file.\n * If `filePath` was not given, it returns the config which contains only\n * `baseConfigData` and `cliConfigData`.\n * @param {string} [filePath] The file path to a file.\n * @param {Object} [options] The options.\n * @param {boolean} [options.ignoreNotFoundError] If `true` then it doesn't throw `ConfigurationNotFoundError`.\n * @returns {ConfigArray} The config array of the file.\n */\n getConfigArrayForFile(filePath, { ignoreNotFoundError = false } = {}) {\n const {\n baseConfigArray,\n cliConfigArray,\n cwd\n } = internalSlotsMap.get(this);\n\n if (!filePath) {\n return new ConfigArray(...baseConfigArray, ...cliConfigArray);\n }\n\n const directoryPath = path.dirname(path.resolve(cwd, filePath));\n\n debug(`Load config files for ${directoryPath}.`);\n\n return this._finalizeConfigArray(\n this._loadConfigInAncestors(directoryPath),\n directoryPath,\n ignoreNotFoundError\n );\n }\n\n /**\n * Set the config data to override all configs.\n * Require to call `clearCache()` method after this method is called.\n * @param {ConfigData} configData The config data to override all configs.\n * @returns {void}\n */\n setOverrideConfig(configData) {\n const slots = internalSlotsMap.get(this);\n\n slots.cliConfigData = configData;\n }\n\n /**\n * Clear config cache.\n * @returns {void}\n */\n clearCache() {\n const slots = internalSlotsMap.get(this);\n\n slots.baseConfigArray = createBaseConfigArray(slots);\n slots.cliConfigArray = createCLIConfigArray(slots);\n slots.configCache.clear();\n }\n\n /**\n * Load and normalize config files from the ancestor directories.\n * @param {string} directoryPath The path to a leaf directory.\n * @param {boolean} configsExistInSubdirs `true` if configurations exist in subdirectories.\n * @returns {ConfigArray} The loaded config.\n * @private\n */\n _loadConfigInAncestors(directoryPath, configsExistInSubdirs = false) {\n const {\n baseConfigArray,\n configArrayFactory,\n configCache,\n cwd,\n useEslintrc\n } = internalSlotsMap.get(this);\n\n if (!useEslintrc) {\n return baseConfigArray;\n }\n\n let configArray = configCache.get(directoryPath);\n\n // Hit cache.\n if (configArray) {\n debug(`Cache hit: ${directoryPath}.`);\n return configArray;\n }\n debug(`No cache found: ${directoryPath}.`);\n\n const homePath = os.homedir();\n\n // Consider this is root.\n if (directoryPath === homePath && cwd !== homePath) {\n debug(\"Stop traversing because of considered root.\");\n if (configsExistInSubdirs) {\n const filePath = ConfigArrayFactory.getPathToConfigFileInDirectory(directoryPath);\n\n if (filePath) {\n emitDeprecationWarning(\n filePath,\n \"ESLINT_PERSONAL_CONFIG_SUPPRESS\"\n );\n }\n }\n return this._cacheConfig(directoryPath, baseConfigArray);\n }\n\n // Load the config on this directory.\n try {\n configArray = configArrayFactory.loadInDirectory(directoryPath);\n } catch (error) {\n /* istanbul ignore next */\n if (error.code === \"EACCES\") {\n debug(\"Stop traversing because of 'EACCES' error.\");\n return this._cacheConfig(directoryPath, baseConfigArray);\n }\n throw error;\n }\n\n if (configArray.length > 0 && configArray.isRoot()) {\n debug(\"Stop traversing because of 'root:true'.\");\n configArray.unshift(...baseConfigArray);\n return this._cacheConfig(directoryPath, configArray);\n }\n\n // Load from the ancestors and merge it.\n const parentPath = path.dirname(directoryPath);\n const parentConfigArray = parentPath && parentPath !== directoryPath\n ? this._loadConfigInAncestors(\n parentPath,\n configsExistInSubdirs || configArray.length > 0\n )\n : baseConfigArray;\n\n if (configArray.length > 0) {\n configArray.unshift(...parentConfigArray);\n } else {\n configArray = parentConfigArray;\n }\n\n // Cache and return.\n return this._cacheConfig(directoryPath, configArray);\n }\n\n /**\n * Freeze and cache a given config.\n * @param {string} directoryPath The path to a directory as a cache key.\n * @param {ConfigArray} configArray The config array as a cache value.\n * @returns {ConfigArray} The `configArray` (frozen).\n */\n _cacheConfig(directoryPath, configArray) {\n const { configCache } = internalSlotsMap.get(this);\n\n Object.freeze(configArray);\n configCache.set(directoryPath, configArray);\n\n return configArray;\n }\n\n /**\n * Finalize a given config array.\n * Concatenate `--config` and other CLI options.\n * @param {ConfigArray} configArray The parent config array.\n * @param {string} directoryPath The path to the leaf directory to find config files.\n * @param {boolean} ignoreNotFoundError If `true` then it doesn't throw `ConfigurationNotFoundError`.\n * @returns {ConfigArray} The loaded config.\n * @private\n */\n _finalizeConfigArray(configArray, directoryPath, ignoreNotFoundError) {\n const {\n cliConfigArray,\n configArrayFactory,\n finalizeCache,\n useEslintrc,\n builtInRules\n } = internalSlotsMap.get(this);\n\n let finalConfigArray = finalizeCache.get(configArray);\n\n if (!finalConfigArray) {\n finalConfigArray = configArray;\n\n // Load the personal config if there are no regular config files.\n if (\n useEslintrc &&\n configArray.every(c => !c.filePath) &&\n cliConfigArray.every(c => !c.filePath) // `--config` option can be a file.\n ) {\n const homePath = os.homedir();\n\n debug(\"Loading the config file of the home directory:\", homePath);\n\n const personalConfigArray = configArrayFactory.loadInDirectory(\n homePath,\n { name: \"PersonalConfig\" }\n );\n\n if (\n personalConfigArray.length > 0 &&\n !directoryPath.startsWith(homePath)\n ) {\n const lastElement =\n personalConfigArray[personalConfigArray.length - 1];\n\n emitDeprecationWarning(\n lastElement.filePath,\n \"ESLINT_PERSONAL_CONFIG_LOAD\"\n );\n }\n\n finalConfigArray = finalConfigArray.concat(personalConfigArray);\n }\n\n // Apply CLI options.\n if (cliConfigArray.length > 0) {\n finalConfigArray = finalConfigArray.concat(cliConfigArray);\n }\n\n // Validate rule settings and environments.\n const validator = new ConfigValidator({\n builtInRules\n });\n\n validator.validateConfigArray(finalConfigArray);\n\n // Cache it.\n Object.freeze(finalConfigArray);\n finalizeCache.set(configArray, finalConfigArray);\n\n debug(\n \"Configuration was determined: %o on %s\",\n finalConfigArray,\n directoryPath\n );\n }\n\n // At least one element (the default ignore patterns) exists.\n if (!ignoreNotFoundError && useEslintrc && finalConfigArray.length <= 1) {\n throw new ConfigurationNotFoundError(directoryPath);\n }\n\n return finalConfigArray;\n }\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\nexport { CascadingConfigArrayFactory };\n","/**\n * @fileoverview Compatibility class for flat config.\n * @author Nicholas C. Zakas\n */\n\n//-----------------------------------------------------------------------------\n// Requirements\n//-----------------------------------------------------------------------------\n\nimport createDebug from \"debug\";\nimport path from \"path\";\n\nimport environments from \"../conf/environments.js\";\nimport { ConfigArrayFactory } from \"./config-array-factory.js\";\n\n//-----------------------------------------------------------------------------\n// Helpers\n//-----------------------------------------------------------------------------\n\n/** @typedef {import(\"../../shared/types\").Environment} Environment */\n/** @typedef {import(\"../../shared/types\").Processor} Processor */\n\nconst debug = createDebug(\"eslintrc:flat-compat\");\nconst cafactory = Symbol(\"cafactory\");\n\n/**\n * Translates an ESLintRC-style config object into a flag-config-style config\n * object.\n * @param {Object} eslintrcConfig An ESLintRC-style config object.\n * @param {Object} options Options to help translate the config.\n * @param {string} options.resolveConfigRelativeTo To the directory to resolve\n * configs from.\n * @param {string} options.resolvePluginsRelativeTo The directory to resolve\n * plugins from.\n * @param {ReadOnlyMap} options.pluginEnvironments A map of plugin environment\n * names to objects.\n * @param {ReadOnlyMap} options.pluginProcessors A map of plugin processor\n * names to objects.\n * @returns {Object} A flag-config-style config object.\n */\nfunction translateESLintRC(eslintrcConfig, {\n resolveConfigRelativeTo,\n resolvePluginsRelativeTo,\n pluginEnvironments,\n pluginProcessors\n}) {\n\n const flatConfig = {};\n const configs = [];\n const languageOptions = {};\n const linterOptions = {};\n const keysToCopy = [\"settings\", \"rules\", \"processor\"];\n const languageOptionsKeysToCopy = [\"globals\", \"parser\", \"parserOptions\"];\n const linterOptionsKeysToCopy = [\"noInlineConfig\", \"reportUnusedDisableDirectives\"];\n\n // check for special settings for eslint:all and eslint:recommended:\n if (eslintrcConfig.settings) {\n if (eslintrcConfig.settings[\"eslint:all\"] === true) {\n return [\"eslint:all\"];\n }\n\n if (eslintrcConfig.settings[\"eslint:recommended\"] === true) {\n return [\"eslint:recommended\"];\n }\n }\n\n // copy over simple translations\n for (const key of keysToCopy) {\n if (key in eslintrcConfig && typeof eslintrcConfig[key] !== \"undefined\") {\n flatConfig[key] = eslintrcConfig[key];\n }\n }\n\n // copy over languageOptions\n for (const key of languageOptionsKeysToCopy) {\n if (key in eslintrcConfig && typeof eslintrcConfig[key] !== \"undefined\") {\n\n // create the languageOptions key in the flat config\n flatConfig.languageOptions = languageOptions;\n\n if (key === \"parser\") {\n debug(`Resolving parser '${languageOptions[key]}' relative to ${resolveConfigRelativeTo}`);\n\n if (eslintrcConfig[key].error) {\n throw eslintrcConfig[key].error;\n }\n\n languageOptions[key] = eslintrcConfig[key].definition;\n continue;\n }\n\n // clone any object values that are in the eslintrc config\n if (eslintrcConfig[key] && typeof eslintrcConfig[key] === \"object\") {\n languageOptions[key] = {\n ...eslintrcConfig[key]\n };\n } else {\n languageOptions[key] = eslintrcConfig[key];\n }\n }\n }\n\n // copy over linterOptions\n for (const key of linterOptionsKeysToCopy) {\n if (key in eslintrcConfig && typeof eslintrcConfig[key] !== \"undefined\") {\n flatConfig.linterOptions = linterOptions;\n linterOptions[key] = eslintrcConfig[key];\n }\n }\n\n // move ecmaVersion a level up\n if (languageOptions.parserOptions) {\n\n if (\"ecmaVersion\" in languageOptions.parserOptions) {\n languageOptions.ecmaVersion = languageOptions.parserOptions.ecmaVersion;\n delete languageOptions.parserOptions.ecmaVersion;\n }\n\n if (\"sourceType\" in languageOptions.parserOptions) {\n languageOptions.sourceType = languageOptions.parserOptions.sourceType;\n delete languageOptions.parserOptions.sourceType;\n }\n\n // check to see if we even need parserOptions anymore and remove it if not\n if (Object.keys(languageOptions.parserOptions).length === 0) {\n delete languageOptions.parserOptions;\n }\n }\n\n // overrides\n if (eslintrcConfig.criteria) {\n flatConfig.files = [absoluteFilePath => eslintrcConfig.criteria.test(absoluteFilePath)];\n }\n\n // translate plugins\n if (eslintrcConfig.plugins && typeof eslintrcConfig.plugins === \"object\") {\n debug(`Translating plugins: ${eslintrcConfig.plugins}`);\n\n flatConfig.plugins = {};\n\n for (const pluginName of Object.keys(eslintrcConfig.plugins)) {\n\n debug(`Translating plugin: ${pluginName}`);\n debug(`Resolving plugin '${pluginName} relative to ${resolvePluginsRelativeTo}`);\n\n const { definition: plugin, error } = eslintrcConfig.plugins[pluginName];\n\n if (error) {\n throw error;\n }\n\n flatConfig.plugins[pluginName] = plugin;\n\n // create a config for any processors\n if (plugin.processors) {\n for (const processorName of Object.keys(plugin.processors)) {\n if (processorName.startsWith(\".\")) {\n debug(`Assigning processor: ${pluginName}/${processorName}`);\n\n configs.unshift({\n files: [`**/*${processorName}`],\n processor: pluginProcessors.get(`${pluginName}/${processorName}`)\n });\n }\n\n }\n }\n }\n }\n\n // translate env - must come after plugins\n if (eslintrcConfig.env && typeof eslintrcConfig.env === \"object\") {\n for (const envName of Object.keys(eslintrcConfig.env)) {\n\n // only add environments that are true\n if (eslintrcConfig.env[envName]) {\n debug(`Translating environment: ${envName}`);\n\n if (environments.has(envName)) {\n\n // built-in environments should be defined first\n configs.unshift(...translateESLintRC(environments.get(envName), {\n resolveConfigRelativeTo,\n resolvePluginsRelativeTo\n }));\n } else if (pluginEnvironments.has(envName)) {\n\n // if the environment comes from a plugin, it should come after the plugin config\n configs.push(...translateESLintRC(pluginEnvironments.get(envName), {\n resolveConfigRelativeTo,\n resolvePluginsRelativeTo\n }));\n }\n }\n }\n }\n\n // only add if there are actually keys in the config\n if (Object.keys(flatConfig).length > 0) {\n configs.push(flatConfig);\n }\n\n return configs;\n}\n\n\n//-----------------------------------------------------------------------------\n// Exports\n//-----------------------------------------------------------------------------\n\n/**\n * A compatibility class for working with configs.\n */\nclass FlatCompat {\n\n constructor({\n baseDirectory = process.cwd(),\n resolvePluginsRelativeTo = baseDirectory\n } = {}) {\n this.baseDirectory = baseDirectory;\n this.resolvePluginsRelativeTo = resolvePluginsRelativeTo;\n this[cafactory] = new ConfigArrayFactory({\n cwd: baseDirectory,\n resolvePluginsRelativeTo,\n getEslintAllConfig: () => ({ settings: { \"eslint:all\": true } }),\n getEslintRecommendedConfig: () => ({ settings: { \"eslint:recommended\": true } })\n });\n }\n\n /**\n * Translates an ESLintRC-style config into a flag-config-style config.\n * @param {Object} eslintrcConfig The ESLintRC-style config object.\n * @returns {Object} A flag-config-style config object.\n */\n config(eslintrcConfig) {\n const eslintrcArray = this[cafactory].create(eslintrcConfig, {\n basePath: this.baseDirectory\n });\n\n const flatArray = [];\n let hasIgnorePatterns = false;\n\n eslintrcArray.forEach(configData => {\n if (configData.type === \"config\") {\n hasIgnorePatterns = hasIgnorePatterns || configData.ignorePattern;\n flatArray.push(...translateESLintRC(configData, {\n resolveConfigRelativeTo: path.join(this.baseDirectory, \"__placeholder.js\"),\n resolvePluginsRelativeTo: path.join(this.resolvePluginsRelativeTo, \"__placeholder.js\"),\n pluginEnvironments: eslintrcArray.pluginEnvironments,\n pluginProcessors: eslintrcArray.pluginProcessors\n }));\n }\n });\n\n // combine ignorePatterns to emulate ESLintRC behavior better\n if (hasIgnorePatterns) {\n flatArray.unshift({\n ignores: [filePath => {\n\n // Compute the final config for this file.\n // This filters config array elements by `files`/`excludedFiles` then merges the elements.\n const finalConfig = eslintrcArray.extractConfig(filePath);\n\n // Test the `ignorePattern` properties of the final config.\n return Boolean(finalConfig.ignores) && finalConfig.ignores(filePath);\n }]\n });\n }\n\n return flatArray;\n }\n\n /**\n * Translates the `env` section of an ESLintRC-style config.\n * @param {Object} envConfig The `env` section of an ESLintRC config.\n * @returns {Object} A flag-config object representing the environments.\n */\n env(envConfig) {\n return this.config({\n env: envConfig\n });\n }\n\n /**\n * Translates the `extends` section of an ESLintRC-style config.\n * @param {...string} configsToExtend The names of the configs to load.\n * @returns {Object} A flag-config object representing the config.\n */\n extends(...configsToExtend) {\n return this.config({\n extends: configsToExtend\n });\n }\n\n /**\n * Translates the `plugins` section of an ESLintRC-style config.\n * @param {...string} plugins The names of the plugins to load.\n * @returns {Object} A flag-config object representing the plugins.\n */\n plugins(...plugins) {\n return this.config({\n plugins\n });\n }\n}\n\nexport { FlatCompat };\n","/**\n * @fileoverview Package exports for @eslint/eslintrc\n * @author Nicholas C. Zakas\n */\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport {\n ConfigArrayFactory,\n createContext as createConfigArrayFactoryContext\n} from \"./config-array-factory.js\";\n\nimport { CascadingConfigArrayFactory } from \"./cascading-config-array-factory.js\";\nimport * as ModuleResolver from \"./shared/relative-module-resolver.js\";\nimport { ConfigArray, getUsedExtractedConfigs } from \"./config-array/index.js\";\nimport { ConfigDependency } from \"./config-array/config-dependency.js\";\nimport { ExtractedConfig } from \"./config-array/extracted-config.js\";\nimport { IgnorePattern } from \"./config-array/ignore-pattern.js\";\nimport { OverrideTester } from \"./config-array/override-tester.js\";\nimport * as ConfigOps from \"./shared/config-ops.js\";\nimport ConfigValidator from \"./shared/config-validator.js\";\nimport * as naming from \"./shared/naming.js\";\nimport { FlatCompat } from \"./flat-compat.js\";\nimport environments from \"../conf/environments.js\";\n\n//-----------------------------------------------------------------------------\n// Exports\n//-----------------------------------------------------------------------------\n\nconst Legacy = {\n ConfigArray,\n createConfigArrayFactoryContext,\n CascadingConfigArrayFactory,\n ConfigArrayFactory,\n ConfigDependency,\n ExtractedConfig,\n IgnorePattern,\n OverrideTester,\n getUsedExtractedConfigs,\n environments,\n\n // shared\n ConfigOps,\n ConfigValidator,\n ModuleResolver,\n naming\n};\n\nexport {\n\n Legacy,\n\n FlatCompat\n\n};\n"],"names":["debug","debugOrig","path","ignore","assert","internalSlotsMap","util","minimatch","Ajv","globals","BuiltInEnvironments","ConfigOps.normalizeConfigGlobal","Module","require","createRequire","fs","stripComments","importFresh","ModuleResolver.resolve","naming.normalizePackageName","naming.getShorthandName","os","createDebug","createConfigArrayFactoryContext"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA,MAAMA,OAAK,GAAGC,6BAAS,CAAC,yBAAyB,CAAC,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,qBAAqB,CAAC,WAAW,EAAE;AAC5C,IAAI,IAAI,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAChC;AACA,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;AACjD,QAAQ,MAAM,CAAC,GAAG,MAAM,CAAC;AACzB,QAAQ,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AACjC;AACA;AACA,QAAQ,MAAM,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7C;AACA;A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BAAiB;AACjB,aAAa;AACb,SAAS;AACT,KAAK;AACL;;AC1nCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA;AACA,MAAMA,OAAK,GAAGC,6BAAS,CAAC,yCAAyC,CAAC,CAAC;AACnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAAE,CAAC;AACvC;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,qBAAqB,CAAC;AAC/B,IAAI,kBAAkB;AACtB,IAAI,cAAc;AAClB,IAAI,SAAS;AACb,IAAI,GAAG;AACP,IAAI,SAAS;AACb,CAAC,EAAE;AACH,IAAI,MAAM,eAAe,GAAG,kBAAkB,CAAC,MAAM;AACrD,QAAQ,cAAc;AACtB,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE;AAC9B,KAAK,CAAC;AACN;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,eAAe,CAAC,OAAO,CAAC,kBAAkB,CAAC,MAAM;AACrD,QAAQ,EAAE,cAAc,EAAE,aAAa,CAAC,eAAe,EAAE;AACzD,QAAQ,EAAE,IAAI,EAAE,sBAAsB,EAAE;AACxC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AACV;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,IAAI,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;AAC3C,QAAQ,eAAe,CAAC,IAAI,CAAC;AAC7B,YAAY,IAAI,EAAE,QAAQ;AAC1B,YAAY,IAAI,EA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,MAAM,GAAG;AACf,IAAI,WAAW;AACf,qCAAIqB,aAA+B;AACnC,IAAI,2BAA2B;AAC/B,IAAI,kBAAkB;AACtB,IAAI,gBAAgB;AACpB,IAAI,eAAe;AACnB,IAAI,aAAa;AACjB,IAAI,cAAc;AAClB,IAAI,uBAAuB;AAC3B,IAAI,YAAY;AAChB;AACA;AACA,IAAI,SAAS;AACb,IAAI,eAAe;AACnB,IAAI,cAAc;AAClB,IAAI,MAAM;AACV;;;;;"} \ No newline at end of file +{"version":3,"file":"eslintrc.cjs","sources":["../lib/config-array/ignore-pattern.js","../lib/config-array/extracted-config.js","../lib/config-array/config-array.js","../lib/config-array/config-dependency.js","../lib/config-array/override-tester.js","../lib/config-array/index.js","../lib/shared/config-ops.js","../lib/shared/deprecation-warnings.js","../lib/shared/ajv.js","../conf/config-schema.js","../conf/environments.js","../lib/shared/config-validator.js","../lib/shared/naming.js","../lib/shared/relative-module-resolver.js","../lib/config-array-factory.js","../lib/cascading-config-array-factory.js","../lib/flat-compat.js","../lib/index.js"],"sourcesContent":["/**\n * @fileoverview `IgnorePattern` class.\n *\n * `IgnorePattern` class has the set of glob patterns and the base path.\n *\n * It provides two static methods.\n *\n * - `IgnorePattern.createDefaultIgnore(cwd)`\n * Create the default predicate function.\n * - `IgnorePattern.createIgnore(ignorePatterns)`\n * Create the predicate function from multiple `IgnorePattern` objects.\n *\n * It provides two properties and a method.\n *\n * - `patterns`\n * The glob patterns that ignore to lint.\n * - `basePath`\n * The base path of the glob patterns. If absolute paths existed in the\n * glob patterns, those are handled as relative paths to the base path.\n * - `getPatternsRelativeTo(basePath)`\n * Get `patterns` as modified for a given base path. It modifies the\n * absolute paths in the patterns as prepending the difference of two base\n * paths.\n *\n * `ConfigArrayFactory` creates `IgnorePattern` objects when it processes\n * `ignorePatterns` properties.\n *\n * @author Toru Nagashima \n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport assert from \"assert\";\nimport path from \"path\";\nimport ignore from \"ignore\";\nimport debugOrig from \"debug\";\n\nconst debug = debugOrig(\"eslintrc:ignore-pattern\");\n\n/** @typedef {ReturnType} Ignore */\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Get the path to the common ancestor directory of given paths.\n * @param {string[]} sourcePaths The paths to calculate the common ancestor.\n * @returns {string} The path to the common ancestor directory.\n */\nfunction getCommonAncestorPath(sourcePaths) {\n let result = sourcePaths[0];\n\n for (let i = 1; i < sourcePaths.length; ++i) {\n const a = result;\n const b = sourcePaths[i];\n\n // Set the shorter one (it's the common ancestor if one includes the other).\n result = a.length < b.length ? a : b;\n\n // Set the common ancestor.\n for (let j = 0, lastSepPos = 0; j < a.length && j < b.length; ++j) {\n if (a[j] !== b[j]) {\n result = a.slice(0, lastSepPos);\n break;\n }\n if (a[j] === path.sep) {\n lastSepPos = j;\n }\n }\n }\n\n let resolvedResult = result || path.sep;\n\n // if Windows common ancestor is root of drive must have trailing slash to be absolute.\n if (resolvedResult && resolvedResult.endsWith(\":\") && process.platform === \"win32\") {\n resolvedResult += path.sep;\n }\n return resolvedResult;\n}\n\n/**\n * Make relative path.\n * @param {string} from The source path to get relative path.\n * @param {string} to The destination path to get relative path.\n * @returns {string} The relative path.\n */\nfunction relative(from, to) {\n const relPath = path.relative(from, to);\n\n if (path.sep === \"/\") {\n return relPath;\n }\n return relPath.split(path.sep).join(\"/\");\n}\n\n/**\n * Get the trailing slash if existed.\n * @param {string} filePath The path to check.\n * @returns {string} The trailing slash if existed.\n */\nfunction dirSuffix(filePath) {\n const isDir = (\n filePath.endsWith(path.sep) ||\n (process.platform === \"win32\" && filePath.endsWith(\"/\"))\n );\n\n return isDir ? \"/\" : \"\";\n}\n\nconst DefaultPatterns = Object.freeze([\"/**/node_modules/*\"]);\nconst DotPatterns = Object.freeze([\".*\", \"!.eslintrc.*\", \"!../\"]);\n\n//------------------------------------------------------------------------------\n// Public\n//------------------------------------------------------------------------------\n\nclass IgnorePattern {\n\n /**\n * The default patterns.\n * @type {string[]}\n */\n static get DefaultPatterns() {\n return DefaultPatterns;\n }\n\n /**\n * Create the default predicate function.\n * @param {string} cwd The current working directory.\n * @returns {((filePath:string, dot:boolean) => boolean) & {basePath:string; patterns:string[]}}\n * The preficate function.\n * The first argument is an absolute path that is checked.\n * The second argument is the flag to not ignore dotfiles.\n * If the predicate function returned `true`, it means the path should be ignored.\n */\n static createDefaultIgnore(cwd) {\n return this.createIgnore([new IgnorePattern(DefaultPatterns, cwd)]);\n }\n\n /**\n * Create the predicate function from multiple `IgnorePattern` objects.\n * @param {IgnorePattern[]} ignorePatterns The list of ignore patterns.\n * @returns {((filePath:string, dot?:boolean) => boolean) & {basePath:string; patterns:string[]}}\n * The preficate function.\n * The first argument is an absolute path that is checked.\n * The second argument is the flag to not ignore dotfiles.\n * If the predicate function returned `true`, it means the path should be ignored.\n */\n static createIgnore(ignorePatterns) {\n debug(\"Create with: %o\", ignorePatterns);\n\n const basePath = getCommonAncestorPath(ignorePatterns.map(p => p.basePath));\n const patterns = [].concat(\n ...ignorePatterns.map(p => p.getPatternsRelativeTo(basePath))\n );\n const ig = ignore({ allowRelativePaths: true }).add([...DotPatterns, ...patterns]);\n const dotIg = ignore({ allowRelativePaths: true }).add(patterns);\n\n debug(\" processed: %o\", { basePath, patterns });\n\n return Object.assign(\n (filePath, dot = false) => {\n assert(path.isAbsolute(filePath), \"'filePath' should be an absolute path.\");\n const relPathRaw = relative(basePath, filePath);\n const relPath = relPathRaw && (relPathRaw + dirSuffix(filePath));\n const adoptedIg = dot ? dotIg : ig;\n const result = relPath !== \"\" && adoptedIg.ignores(relPath);\n\n debug(\"Check\", { filePath, dot, relativePath: relPath, result });\n return result;\n },\n { basePath, patterns }\n );\n }\n\n /**\n * Initialize a new `IgnorePattern` instance.\n * @param {string[]} patterns The glob patterns that ignore to lint.\n * @param {string} basePath The base path of `patterns`.\n */\n constructor(patterns, basePath) {\n assert(path.isAbsolute(basePath), \"'basePath' should be an absolute path.\");\n\n /**\n * The glob patterns that ignore to lint.\n * @type {string[]}\n */\n this.patterns = patterns;\n\n /**\n * The base path of `patterns`.\n * @type {string}\n */\n this.basePath = basePath;\n\n /**\n * If `true` then patterns which don't start with `/` will match the paths to the outside of `basePath`. Defaults to `false`.\n *\n * It's set `true` for `.eslintignore`, `package.json`, and `--ignore-path` for backward compatibility.\n * It's `false` as-is for `ignorePatterns` property in config files.\n * @type {boolean}\n */\n this.loose = false;\n }\n\n /**\n * Get `patterns` as modified for a given base path. It modifies the\n * absolute paths in the patterns as prepending the difference of two base\n * paths.\n * @param {string} newBasePath The base path.\n * @returns {string[]} Modifired patterns.\n */\n getPatternsRelativeTo(newBasePath) {\n assert(path.isAbsolute(newBasePath), \"'newBasePath' should be an absolute path.\");\n const { basePath, loose, patterns } = this;\n\n if (newBasePath === basePath) {\n return patterns;\n }\n const prefix = `/${relative(newBasePath, basePath)}`;\n\n return patterns.map(pattern => {\n const negative = pattern.startsWith(\"!\");\n const head = negative ? \"!\" : \"\";\n const body = negative ? pattern.slice(1) : pattern;\n\n if (body.startsWith(\"/\") || body.startsWith(\"../\")) {\n return `${head}${prefix}${body}`;\n }\n return loose ? pattern : `${head}${prefix}/**/${body}`;\n });\n }\n}\n\nexport { IgnorePattern };\n","/**\n * @fileoverview `ExtractedConfig` class.\n *\n * `ExtractedConfig` class expresses a final configuration for a specific file.\n *\n * It provides one method.\n *\n * - `toCompatibleObjectAsConfigFileContent()`\n * Convert this configuration to the compatible object as the content of\n * config files. It converts the loaded parser and plugins to strings.\n * `CLIEngine#getConfigForFile(filePath)` method uses this method.\n *\n * `ConfigArray#extractConfig(filePath)` creates a `ExtractedConfig` instance.\n *\n * @author Toru Nagashima \n */\n\nimport { IgnorePattern } from \"./ignore-pattern.js\";\n\n// For VSCode intellisense\n/** @typedef {import(\"../../shared/types\").ConfigData} ConfigData */\n/** @typedef {import(\"../../shared/types\").GlobalConf} GlobalConf */\n/** @typedef {import(\"../../shared/types\").SeverityConf} SeverityConf */\n/** @typedef {import(\"./config-dependency\").DependentParser} DependentParser */\n/** @typedef {import(\"./config-dependency\").DependentPlugin} DependentPlugin */\n\n/**\n * Check if `xs` starts with `ys`.\n * @template T\n * @param {T[]} xs The array to check.\n * @param {T[]} ys The array that may be the first part of `xs`.\n * @returns {boolean} `true` if `xs` starts with `ys`.\n */\nfunction startsWith(xs, ys) {\n return xs.length >= ys.length && ys.every((y, i) => y === xs[i]);\n}\n\n/**\n * The class for extracted config data.\n */\nclass ExtractedConfig {\n constructor() {\n\n /**\n * The config name what `noInlineConfig` setting came from.\n * @type {string}\n */\n this.configNameOfNoInlineConfig = \"\";\n\n /**\n * Environments.\n * @type {Record}\n */\n this.env = {};\n\n /**\n * Global variables.\n * @type {Record}\n */\n this.globals = {};\n\n /**\n * The glob patterns that ignore to lint.\n * @type {(((filePath:string, dot?:boolean) => boolean) & { basePath:string; patterns:string[] }) | undefined}\n */\n this.ignores = void 0;\n\n /**\n * The flag that disables directive comments.\n * @type {boolean|undefined}\n */\n this.noInlineConfig = void 0;\n\n /**\n * Parser definition.\n * @type {DependentParser|null}\n */\n this.parser = null;\n\n /**\n * Options for the parser.\n * @type {Object}\n */\n this.parserOptions = {};\n\n /**\n * Plugin definitions.\n * @type {Record}\n */\n this.plugins = {};\n\n /**\n * Processor ID.\n * @type {string|null}\n */\n this.processor = null;\n\n /**\n * The flag that reports unused `eslint-disable` directive comments.\n * @type {boolean|undefined}\n */\n this.reportUnusedDisableDirectives = void 0;\n\n /**\n * Rule settings.\n * @type {Record}\n */\n this.rules = {};\n\n /**\n * Shared settings.\n * @type {Object}\n */\n this.settings = {};\n }\n\n /**\n * Convert this config to the compatible object as a config file content.\n * @returns {ConfigData} The converted object.\n */\n toCompatibleObjectAsConfigFileContent() {\n const {\n /* eslint-disable no-unused-vars */\n configNameOfNoInlineConfig: _ignore1,\n processor: _ignore2,\n /* eslint-enable no-unused-vars */\n ignores,\n ...config\n } = this;\n\n config.parser = config.parser && config.parser.filePath;\n config.plugins = Object.keys(config.plugins).filter(Boolean).reverse();\n config.ignorePatterns = ignores ? ignores.patterns : [];\n\n // Strip the default patterns from `ignorePatterns`.\n if (startsWith(config.ignorePatterns, IgnorePattern.DefaultPatterns)) {\n config.ignorePatterns =\n config.ignorePatterns.slice(IgnorePattern.DefaultPatterns.length);\n }\n\n return config;\n }\n}\n\nexport { ExtractedConfig };\n","/**\n * @fileoverview `ConfigArray` class.\n *\n * `ConfigArray` class expresses the full of a configuration. It has the entry\n * config file, base config files that were extended, loaded parsers, and loaded\n * plugins.\n *\n * `ConfigArray` class provides three properties and two methods.\n *\n * - `pluginEnvironments`\n * - `pluginProcessors`\n * - `pluginRules`\n * The `Map` objects that contain the members of all plugins that this\n * config array contains. Those map objects don't have mutation methods.\n * Those keys are the member ID such as `pluginId/memberName`.\n * - `isRoot()`\n * If `true` then this configuration has `root:true` property.\n * - `extractConfig(filePath)`\n * Extract the final configuration for a given file. This means merging\n * every config array element which that `criteria` property matched. The\n * `filePath` argument must be an absolute path.\n *\n * `ConfigArrayFactory` provides the loading logic of config files.\n *\n * @author Toru Nagashima \n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport { ExtractedConfig } from \"./extracted-config.js\";\nimport { IgnorePattern } from \"./ignore-pattern.js\";\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n// Define types for VSCode IntelliSense.\n/** @typedef {import(\"../../shared/types\").Environment} Environment */\n/** @typedef {import(\"../../shared/types\").GlobalConf} GlobalConf */\n/** @typedef {import(\"../../shared/types\").RuleConf} RuleConf */\n/** @typedef {import(\"../../shared/types\").Rule} Rule */\n/** @typedef {import(\"../../shared/types\").Plugin} Plugin */\n/** @typedef {import(\"../../shared/types\").Processor} Processor */\n/** @typedef {import(\"./config-dependency\").DependentParser} DependentParser */\n/** @typedef {import(\"./config-dependency\").DependentPlugin} DependentPlugin */\n/** @typedef {import(\"./override-tester\")[\"OverrideTester\"]} OverrideTester */\n\n/**\n * @typedef {Object} ConfigArrayElement\n * @property {string} name The name of this config element.\n * @property {string} filePath The path to the source file of this config element.\n * @property {InstanceType|null} criteria The tester for the `files` and `excludedFiles` of this config element.\n * @property {Record|undefined} env The environment settings.\n * @property {Record|undefined} globals The global variable settings.\n * @property {IgnorePattern|undefined} ignorePattern The ignore patterns.\n * @property {boolean|undefined} noInlineConfig The flag that disables directive comments.\n * @property {DependentParser|undefined} parser The parser loader.\n * @property {Object|undefined} parserOptions The parser options.\n * @property {Record|undefined} plugins The plugin loaders.\n * @property {string|undefined} processor The processor name to refer plugin's processor.\n * @property {boolean|undefined} reportUnusedDisableDirectives The flag to report unused `eslint-disable` comments.\n * @property {boolean|undefined} root The flag to express root.\n * @property {Record|undefined} rules The rule settings\n * @property {Object|undefined} settings The shared settings.\n * @property {\"config\" | \"ignore\" | \"implicit-processor\"} type The element type.\n */\n\n/**\n * @typedef {Object} ConfigArrayInternalSlots\n * @property {Map} cache The cache to extract configs.\n * @property {ReadonlyMap|null} envMap The map from environment ID to environment definition.\n * @property {ReadonlyMap|null} processorMap The map from processor ID to environment definition.\n * @property {ReadonlyMap|null} ruleMap The map from rule ID to rule definition.\n */\n\n/** @type {WeakMap} */\nconst internalSlotsMap = new class extends WeakMap {\n get(key) {\n let value = super.get(key);\n\n if (!value) {\n value = {\n cache: new Map(),\n envMap: null,\n processorMap: null,\n ruleMap: null\n };\n super.set(key, value);\n }\n\n return value;\n }\n}();\n\n/**\n * Get the indices which are matched to a given file.\n * @param {ConfigArrayElement[]} elements The elements.\n * @param {string} filePath The path to a target file.\n * @returns {number[]} The indices.\n */\nfunction getMatchedIndices(elements, filePath) {\n const indices = [];\n\n for (let i = elements.length - 1; i >= 0; --i) {\n const element = elements[i];\n\n if (!element.criteria || (filePath && element.criteria.test(filePath))) {\n indices.push(i);\n }\n }\n\n return indices;\n}\n\n/**\n * Check if a value is a non-null object.\n * @param {any} x The value to check.\n * @returns {boolean} `true` if the value is a non-null object.\n */\nfunction isNonNullObject(x) {\n return typeof x === \"object\" && x !== null;\n}\n\n/**\n * Merge two objects.\n *\n * Assign every property values of `y` to `x` if `x` doesn't have the property.\n * If `x`'s property value is an object, it does recursive.\n * @param {Object} target The destination to merge\n * @param {Object|undefined} source The source to merge.\n * @returns {void}\n */\nfunction mergeWithoutOverwrite(target, source) {\n if (!isNonNullObject(source)) {\n return;\n }\n\n for (const key of Object.keys(source)) {\n if (key === \"__proto__\") {\n continue;\n }\n\n if (isNonNullObject(target[key])) {\n mergeWithoutOverwrite(target[key], source[key]);\n } else if (target[key] === void 0) {\n if (isNonNullObject(source[key])) {\n target[key] = Array.isArray(source[key]) ? [] : {};\n mergeWithoutOverwrite(target[key], source[key]);\n } else if (source[key] !== void 0) {\n target[key] = source[key];\n }\n }\n }\n}\n\n/**\n * The error for plugin conflicts.\n */\nclass PluginConflictError extends Error {\n\n /**\n * Initialize this error object.\n * @param {string} pluginId The plugin ID.\n * @param {{filePath:string, importerName:string}[]} plugins The resolved plugins.\n */\n constructor(pluginId, plugins) {\n super(`Plugin \"${pluginId}\" was conflicted between ${plugins.map(p => `\"${p.importerName}\"`).join(\" and \")}.`);\n this.messageTemplate = \"plugin-conflict\";\n this.messageData = { pluginId, plugins };\n }\n}\n\n/**\n * Merge plugins.\n * `target`'s definition is prior to `source`'s.\n * @param {Record} target The destination to merge\n * @param {Record|undefined} source The source to merge.\n * @returns {void}\n */\nfunction mergePlugins(target, source) {\n if (!isNonNullObject(source)) {\n return;\n }\n\n for (const key of Object.keys(source)) {\n if (key === \"__proto__\") {\n continue;\n }\n const targetValue = target[key];\n const sourceValue = source[key];\n\n // Adopt the plugin which was found at first.\n if (targetValue === void 0) {\n if (sourceValue.error) {\n throw sourceValue.error;\n }\n target[key] = sourceValue;\n } else if (sourceValue.filePath !== targetValue.filePath) {\n throw new PluginConflictError(key, [\n {\n filePath: targetValue.filePath,\n importerName: targetValue.importerName\n },\n {\n filePath: sourceValue.filePath,\n importerName: sourceValue.importerName\n }\n ]);\n }\n }\n}\n\n/**\n * Merge rule configs.\n * `target`'s definition is prior to `source`'s.\n * @param {Record} target The destination to merge\n * @param {Record|undefined} source The source to merge.\n * @returns {void}\n */\nfunction mergeRuleConfigs(target, source) {\n if (!isNonNullObject(source)) {\n return;\n }\n\n for (const key of Object.keys(source)) {\n if (key === \"__proto__\") {\n continue;\n }\n const targetDef = target[key];\n const sourceDef = source[key];\n\n // Adopt the rule config which was found at first.\n if (targetDef === void 0) {\n if (Array.isArray(sourceDef)) {\n target[key] = [...sourceDef];\n } else {\n target[key] = [sourceDef];\n }\n\n /*\n * If the first found rule config is severity only and the current rule\n * config has options, merge the severity and the options.\n */\n } else if (\n targetDef.length === 1 &&\n Array.isArray(sourceDef) &&\n sourceDef.length >= 2\n ) {\n targetDef.push(...sourceDef.slice(1));\n }\n }\n}\n\n/**\n * Create the extracted config.\n * @param {ConfigArray} instance The config elements.\n * @param {number[]} indices The indices to use.\n * @returns {ExtractedConfig} The extracted config.\n */\nfunction createConfig(instance, indices) {\n const config = new ExtractedConfig();\n const ignorePatterns = [];\n\n // Merge elements.\n for (const index of indices) {\n const element = instance[index];\n\n // Adopt the parser which was found at first.\n if (!config.parser && element.parser) {\n if (element.parser.error) {\n throw element.parser.error;\n }\n config.parser = element.parser;\n }\n\n // Adopt the processor which was found at first.\n if (!config.processor && element.processor) {\n config.processor = element.processor;\n }\n\n // Adopt the noInlineConfig which was found at first.\n if (config.noInlineConfig === void 0 && element.noInlineConfig !== void 0) {\n config.noInlineConfig = element.noInlineConfig;\n config.configNameOfNoInlineConfig = element.name;\n }\n\n // Adopt the reportUnusedDisableDirectives which was found at first.\n if (config.reportUnusedDisableDirectives === void 0 && element.reportUnusedDisableDirectives !== void 0) {\n config.reportUnusedDisableDirectives = element.reportUnusedDisableDirectives;\n }\n\n // Collect ignorePatterns\n if (element.ignorePattern) {\n ignorePatterns.push(element.ignorePattern);\n }\n\n // Merge others.\n mergeWithoutOverwrite(config.env, element.env);\n mergeWithoutOverwrite(config.globals, element.globals);\n mergeWithoutOverwrite(config.parserOptions, element.parserOptions);\n mergeWithoutOverwrite(config.settings, element.settings);\n mergePlugins(config.plugins, element.plugins);\n mergeRuleConfigs(config.rules, element.rules);\n }\n\n // Create the predicate function for ignore patterns.\n if (ignorePatterns.length > 0) {\n config.ignores = IgnorePattern.createIgnore(ignorePatterns.reverse());\n }\n\n return config;\n}\n\n/**\n * Collect definitions.\n * @template T, U\n * @param {string} pluginId The plugin ID for prefix.\n * @param {Record} defs The definitions to collect.\n * @param {Map} map The map to output.\n * @param {function(T): U} [normalize] The normalize function for each value.\n * @returns {void}\n */\nfunction collect(pluginId, defs, map, normalize) {\n if (defs) {\n const prefix = pluginId && `${pluginId}/`;\n\n for (const [key, value] of Object.entries(defs)) {\n map.set(\n `${prefix}${key}`,\n normalize ? normalize(value) : value\n );\n }\n }\n}\n\n/**\n * Normalize a rule definition.\n * @param {Function|Rule} rule The rule definition to normalize.\n * @returns {Rule} The normalized rule definition.\n */\nfunction normalizePluginRule(rule) {\n return typeof rule === \"function\" ? { create: rule } : rule;\n}\n\n/**\n * Delete the mutation methods from a given map.\n * @param {Map} map The map object to delete.\n * @returns {void}\n */\nfunction deleteMutationMethods(map) {\n Object.defineProperties(map, {\n clear: { configurable: true, value: void 0 },\n delete: { configurable: true, value: void 0 },\n set: { configurable: true, value: void 0 }\n });\n}\n\n/**\n * Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array.\n * @param {ConfigArrayElement[]} elements The config elements.\n * @param {ConfigArrayInternalSlots} slots The internal slots.\n * @returns {void}\n */\nfunction initPluginMemberMaps(elements, slots) {\n const processed = new Set();\n\n slots.envMap = new Map();\n slots.processorMap = new Map();\n slots.ruleMap = new Map();\n\n for (const element of elements) {\n if (!element.plugins) {\n continue;\n }\n\n for (const [pluginId, value] of Object.entries(element.plugins)) {\n const plugin = value.definition;\n\n if (!plugin || processed.has(pluginId)) {\n continue;\n }\n processed.add(pluginId);\n\n collect(pluginId, plugin.environments, slots.envMap);\n collect(pluginId, plugin.processors, slots.processorMap);\n collect(pluginId, plugin.rules, slots.ruleMap, normalizePluginRule);\n }\n }\n\n deleteMutationMethods(slots.envMap);\n deleteMutationMethods(slots.processorMap);\n deleteMutationMethods(slots.ruleMap);\n}\n\n/**\n * Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array.\n * @param {ConfigArray} instance The config elements.\n * @returns {ConfigArrayInternalSlots} The extracted config.\n */\nfunction ensurePluginMemberMaps(instance) {\n const slots = internalSlotsMap.get(instance);\n\n if (!slots.ruleMap) {\n initPluginMemberMaps(instance, slots);\n }\n\n return slots;\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * The Config Array.\n *\n * `ConfigArray` instance contains all settings, parsers, and plugins.\n * You need to call `ConfigArray#extractConfig(filePath)` method in order to\n * extract, merge and get only the config data which is related to an arbitrary\n * file.\n * @extends {Array}\n */\nclass ConfigArray extends Array {\n\n /**\n * Get the plugin environments.\n * The returned map cannot be mutated.\n * @type {ReadonlyMap} The plugin environments.\n */\n get pluginEnvironments() {\n return ensurePluginMemberMaps(this).envMap;\n }\n\n /**\n * Get the plugin processors.\n * The returned map cannot be mutated.\n * @type {ReadonlyMap} The plugin processors.\n */\n get pluginProcessors() {\n return ensurePluginMemberMaps(this).processorMap;\n }\n\n /**\n * Get the plugin rules.\n * The returned map cannot be mutated.\n * @returns {ReadonlyMap} The plugin rules.\n */\n get pluginRules() {\n return ensurePluginMemberMaps(this).ruleMap;\n }\n\n /**\n * Check if this config has `root` flag.\n * @returns {boolean} `true` if this config array is root.\n */\n isRoot() {\n for (let i = this.length - 1; i >= 0; --i) {\n const root = this[i].root;\n\n if (typeof root === \"boolean\") {\n return root;\n }\n }\n return false;\n }\n\n /**\n * Extract the config data which is related to a given file.\n * @param {string} filePath The absolute path to the target file.\n * @returns {ExtractedConfig} The extracted config data.\n */\n extractConfig(filePath) {\n const { cache } = internalSlotsMap.get(this);\n const indices = getMatchedIndices(this, filePath);\n const cacheKey = indices.join(\",\");\n\n if (!cache.has(cacheKey)) {\n cache.set(cacheKey, createConfig(this, indices));\n }\n\n return cache.get(cacheKey);\n }\n\n /**\n * Check if a given path is an additional lint target.\n * @param {string} filePath The absolute path to the target file.\n * @returns {boolean} `true` if the file is an additional lint target.\n */\n isAdditionalTargetPath(filePath) {\n for (const { criteria, type } of this) {\n if (\n type === \"config\" &&\n criteria &&\n !criteria.endsWithWildcard &&\n criteria.test(filePath)\n ) {\n return true;\n }\n }\n return false;\n }\n}\n\n/**\n * Get the used extracted configs.\n * CLIEngine will use this method to collect used deprecated rules.\n * @param {ConfigArray} instance The config array object to get.\n * @returns {ExtractedConfig[]} The used extracted configs.\n * @private\n */\nfunction getUsedExtractedConfigs(instance) {\n const { cache } = internalSlotsMap.get(instance);\n\n return Array.from(cache.values());\n}\n\n\nexport {\n ConfigArray,\n getUsedExtractedConfigs\n};\n","/**\n * @fileoverview `ConfigDependency` class.\n *\n * `ConfigDependency` class expresses a loaded parser or plugin.\n *\n * If the parser or plugin was loaded successfully, it has `definition` property\n * and `filePath` property. Otherwise, it has `error` property.\n *\n * When `JSON.stringify()` converted a `ConfigDependency` object to a JSON, it\n * omits `definition` property.\n *\n * `ConfigArrayFactory` creates `ConfigDependency` objects when it loads parsers\n * or plugins.\n *\n * @author Toru Nagashima \n */\n\nimport util from \"util\";\n\n/**\n * The class is to store parsers or plugins.\n * This class hides the loaded object from `JSON.stringify()` and `console.log`.\n * @template T\n */\nclass ConfigDependency {\n\n /**\n * Initialize this instance.\n * @param {Object} data The dependency data.\n * @param {T} [data.definition] The dependency if the loading succeeded.\n * @param {Error} [data.error] The error object if the loading failed.\n * @param {string} [data.filePath] The actual path to the dependency if the loading succeeded.\n * @param {string} data.id The ID of this dependency.\n * @param {string} data.importerName The name of the config file which loads this dependency.\n * @param {string} data.importerPath The path to the config file which loads this dependency.\n */\n constructor({\n definition = null,\n error = null,\n filePath = null,\n id,\n importerName,\n importerPath\n }) {\n\n /**\n * The loaded dependency if the loading succeeded.\n * @type {T|null}\n */\n this.definition = definition;\n\n /**\n * The error object if the loading failed.\n * @type {Error|null}\n */\n this.error = error;\n\n /**\n * The loaded dependency if the loading succeeded.\n * @type {string|null}\n */\n this.filePath = filePath;\n\n /**\n * The ID of this dependency.\n * @type {string}\n */\n this.id = id;\n\n /**\n * The name of the config file which loads this dependency.\n * @type {string}\n */\n this.importerName = importerName;\n\n /**\n * The path to the config file which loads this dependency.\n * @type {string}\n */\n this.importerPath = importerPath;\n }\n\n // eslint-disable-next-line jsdoc/require-description\n /**\n * @returns {Object} a JSON compatible object.\n */\n toJSON() {\n const obj = this[util.inspect.custom]();\n\n // Display `error.message` (`Error#message` is unenumerable).\n if (obj.error instanceof Error) {\n obj.error = { ...obj.error, message: obj.error.message };\n }\n\n return obj;\n }\n\n // eslint-disable-next-line jsdoc/require-description\n /**\n * @returns {Object} an object to display by `console.log()`.\n */\n [util.inspect.custom]() {\n const {\n definition: _ignore, // eslint-disable-line no-unused-vars\n ...obj\n } = this;\n\n return obj;\n }\n}\n\n/** @typedef {ConfigDependency} DependentParser */\n/** @typedef {ConfigDependency} DependentPlugin */\n\nexport { ConfigDependency };\n","/**\n * @fileoverview `OverrideTester` class.\n *\n * `OverrideTester` class handles `files` property and `excludedFiles` property\n * of `overrides` config.\n *\n * It provides one method.\n *\n * - `test(filePath)`\n * Test if a file path matches the pair of `files` property and\n * `excludedFiles` property. The `filePath` argument must be an absolute\n * path.\n *\n * `ConfigArrayFactory` creates `OverrideTester` objects when it processes\n * `overrides` properties.\n *\n * @author Toru Nagashima \n */\n\nimport assert from \"assert\";\nimport path from \"path\";\nimport util from \"util\";\nimport minimatch from \"minimatch\";\n\nconst { Minimatch } = minimatch;\n\nconst minimatchOpts = { dot: true, matchBase: true };\n\n/**\n * @typedef {Object} Pattern\n * @property {InstanceType[] | null} includes The positive matchers.\n * @property {InstanceType[] | null} excludes The negative matchers.\n */\n\n/**\n * Normalize a given pattern to an array.\n * @param {string|string[]|undefined} patterns A glob pattern or an array of glob patterns.\n * @returns {string[]|null} Normalized patterns.\n * @private\n */\nfunction normalizePatterns(patterns) {\n if (Array.isArray(patterns)) {\n return patterns.filter(Boolean);\n }\n if (typeof patterns === \"string\" && patterns) {\n return [patterns];\n }\n return [];\n}\n\n/**\n * Create the matchers of given patterns.\n * @param {string[]} patterns The patterns.\n * @returns {InstanceType[] | null} The matchers.\n */\nfunction toMatcher(patterns) {\n if (patterns.length === 0) {\n return null;\n }\n return patterns.map(pattern => {\n if (/^\\.[/\\\\]/u.test(pattern)) {\n return new Minimatch(\n pattern.slice(2),\n\n // `./*.js` should not match with `subdir/foo.js`\n { ...minimatchOpts, matchBase: false }\n );\n }\n return new Minimatch(pattern, minimatchOpts);\n });\n}\n\n/**\n * Convert a given matcher to string.\n * @param {Pattern} matchers The matchers.\n * @returns {string} The string expression of the matcher.\n */\nfunction patternToJson({ includes, excludes }) {\n return {\n includes: includes && includes.map(m => m.pattern),\n excludes: excludes && excludes.map(m => m.pattern)\n };\n}\n\n/**\n * The class to test given paths are matched by the patterns.\n */\nclass OverrideTester {\n\n /**\n * Create a tester with given criteria.\n * If there are no criteria, returns `null`.\n * @param {string|string[]} files The glob patterns for included files.\n * @param {string|string[]} excludedFiles The glob patterns for excluded files.\n * @param {string} basePath The path to the base directory to test paths.\n * @returns {OverrideTester|null} The created instance or `null`.\n */\n static create(files, excludedFiles, basePath) {\n const includePatterns = normalizePatterns(files);\n const excludePatterns = normalizePatterns(excludedFiles);\n let endsWithWildcard = false;\n\n if (includePatterns.length === 0) {\n return null;\n }\n\n // Rejects absolute paths or relative paths to parents.\n for (const pattern of includePatterns) {\n if (path.isAbsolute(pattern) || pattern.includes(\"..\")) {\n throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`);\n }\n if (pattern.endsWith(\"*\")) {\n endsWithWildcard = true;\n }\n }\n for (const pattern of excludePatterns) {\n if (path.isAbsolute(pattern) || pattern.includes(\"..\")) {\n throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`);\n }\n }\n\n const includes = toMatcher(includePatterns);\n const excludes = toMatcher(excludePatterns);\n\n return new OverrideTester(\n [{ includes, excludes }],\n basePath,\n endsWithWildcard\n );\n }\n\n /**\n * Combine two testers by logical and.\n * If either of the testers was `null`, returns the other tester.\n * The `basePath` property of the two must be the same value.\n * @param {OverrideTester|null} a A tester.\n * @param {OverrideTester|null} b Another tester.\n * @returns {OverrideTester|null} Combined tester.\n */\n static and(a, b) {\n if (!b) {\n return a && new OverrideTester(\n a.patterns,\n a.basePath,\n a.endsWithWildcard\n );\n }\n if (!a) {\n return new OverrideTester(\n b.patterns,\n b.basePath,\n b.endsWithWildcard\n );\n }\n\n assert.strictEqual(a.basePath, b.basePath);\n return new OverrideTester(\n a.patterns.concat(b.patterns),\n a.basePath,\n a.endsWithWildcard || b.endsWithWildcard\n );\n }\n\n /**\n * Initialize this instance.\n * @param {Pattern[]} patterns The matchers.\n * @param {string} basePath The base path.\n * @param {boolean} endsWithWildcard If `true` then a pattern ends with `*`.\n */\n constructor(patterns, basePath, endsWithWildcard = false) {\n\n /** @type {Pattern[]} */\n this.patterns = patterns;\n\n /** @type {string} */\n this.basePath = basePath;\n\n /** @type {boolean} */\n this.endsWithWildcard = endsWithWildcard;\n }\n\n /**\n * Test if a given path is matched or not.\n * @param {string} filePath The absolute path to the target file.\n * @returns {boolean} `true` if the path was matched.\n */\n test(filePath) {\n if (typeof filePath !== \"string\" || !path.isAbsolute(filePath)) {\n throw new Error(`'filePath' should be an absolute path, but got ${filePath}.`);\n }\n const relativePath = path.relative(this.basePath, filePath);\n\n return this.patterns.every(({ includes, excludes }) => (\n (!includes || includes.some(m => m.match(relativePath))) &&\n (!excludes || !excludes.some(m => m.match(relativePath)))\n ));\n }\n\n // eslint-disable-next-line jsdoc/require-description\n /**\n * @returns {Object} a JSON compatible object.\n */\n toJSON() {\n if (this.patterns.length === 1) {\n return {\n ...patternToJson(this.patterns[0]),\n basePath: this.basePath\n };\n }\n return {\n AND: this.patterns.map(patternToJson),\n basePath: this.basePath\n };\n }\n\n // eslint-disable-next-line jsdoc/require-description\n /**\n * @returns {Object} an object to display by `console.log()`.\n */\n [util.inspect.custom]() {\n return this.toJSON();\n }\n}\n\nexport { OverrideTester };\n","/**\n * @fileoverview `ConfigArray` class.\n * @author Toru Nagashima \n */\n\nimport { ConfigArray, getUsedExtractedConfigs } from \"./config-array.js\";\nimport { ConfigDependency } from \"./config-dependency.js\";\nimport { ExtractedConfig } from \"./extracted-config.js\";\nimport { IgnorePattern } from \"./ignore-pattern.js\";\nimport { OverrideTester } from \"./override-tester.js\";\n\nexport {\n ConfigArray,\n ConfigDependency,\n ExtractedConfig,\n IgnorePattern,\n OverrideTester,\n getUsedExtractedConfigs\n};\n","/**\n * @fileoverview Config file operations. This file must be usable in the browser,\n * so no Node-specific code can be here.\n * @author Nicholas C. Zakas\n */\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\n\nconst RULE_SEVERITY_STRINGS = [\"off\", \"warn\", \"error\"],\n RULE_SEVERITY = RULE_SEVERITY_STRINGS.reduce((map, value, index) => {\n map[value] = index;\n return map;\n }, {}),\n VALID_SEVERITIES = [0, 1, 2, \"off\", \"warn\", \"error\"];\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * Normalizes the severity value of a rule's configuration to a number\n * @param {(number|string|[number, ...*]|[string, ...*])} ruleConfig A rule's configuration value, generally\n * received from the user. A valid config value is either 0, 1, 2, the string \"off\" (treated the same as 0),\n * the string \"warn\" (treated the same as 1), the string \"error\" (treated the same as 2), or an array\n * whose first element is one of the above values. Strings are matched case-insensitively.\n * @returns {(0|1|2)} The numeric severity value if the config value was valid, otherwise 0.\n */\nfunction getRuleSeverity(ruleConfig) {\n const severityValue = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;\n\n if (severityValue === 0 || severityValue === 1 || severityValue === 2) {\n return severityValue;\n }\n\n if (typeof severityValue === \"string\") {\n return RULE_SEVERITY[severityValue.toLowerCase()] || 0;\n }\n\n return 0;\n}\n\n/**\n * Converts old-style severity settings (0, 1, 2) into new-style\n * severity settings (off, warn, error) for all rules. Assumption is that severity\n * values have already been validated as correct.\n * @param {Object} config The config object to normalize.\n * @returns {void}\n */\nfunction normalizeToStrings(config) {\n\n if (config.rules) {\n Object.keys(config.rules).forEach(ruleId => {\n const ruleConfig = config.rules[ruleId];\n\n if (typeof ruleConfig === \"number\") {\n config.rules[ruleId] = RULE_SEVERITY_STRINGS[ruleConfig] || RULE_SEVERITY_STRINGS[0];\n } else if (Array.isArray(ruleConfig) && typeof ruleConfig[0] === \"number\") {\n ruleConfig[0] = RULE_SEVERITY_STRINGS[ruleConfig[0]] || RULE_SEVERITY_STRINGS[0];\n }\n });\n }\n}\n\n/**\n * Determines if the severity for the given rule configuration represents an error.\n * @param {int|string|Array} ruleConfig The configuration for an individual rule.\n * @returns {boolean} True if the rule represents an error, false if not.\n */\nfunction isErrorSeverity(ruleConfig) {\n return getRuleSeverity(ruleConfig) === 2;\n}\n\n/**\n * Checks whether a given config has valid severity or not.\n * @param {number|string|Array} ruleConfig The configuration for an individual rule.\n * @returns {boolean} `true` if the configuration has valid severity.\n */\nfunction isValidSeverity(ruleConfig) {\n let severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig;\n\n if (typeof severity === \"string\") {\n severity = severity.toLowerCase();\n }\n return VALID_SEVERITIES.indexOf(severity) !== -1;\n}\n\n/**\n * Checks whether every rule of a given config has valid severity or not.\n * @param {Object} config The configuration for rules.\n * @returns {boolean} `true` if the configuration has valid severity.\n */\nfunction isEverySeverityValid(config) {\n return Object.keys(config).every(ruleId => isValidSeverity(config[ruleId]));\n}\n\n/**\n * Normalizes a value for a global in a config\n * @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in\n * a global directive comment\n * @returns {(\"readable\"|\"writeable\"|\"off\")} The value normalized as a string\n * @throws Error if global value is invalid\n */\nfunction normalizeConfigGlobal(configuredValue) {\n switch (configuredValue) {\n case \"off\":\n return \"off\";\n\n case true:\n case \"true\":\n case \"writeable\":\n case \"writable\":\n return \"writable\";\n\n case null:\n case false:\n case \"false\":\n case \"readable\":\n case \"readonly\":\n return \"readonly\";\n\n default:\n throw new Error(`'${configuredValue}' is not a valid configuration for a global (use 'readonly', 'writable', or 'off')`);\n }\n}\n\nexport {\n getRuleSeverity,\n normalizeToStrings,\n isErrorSeverity,\n isValidSeverity,\n isEverySeverityValid,\n normalizeConfigGlobal\n};\n","/**\n * @fileoverview Provide the function that emits deprecation warnings.\n * @author Toru Nagashima \n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport path from \"path\";\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\n\n// Defitions for deprecation warnings.\nconst deprecationWarningMessages = {\n ESLINT_LEGACY_ECMAFEATURES:\n \"The 'ecmaFeatures' config file property is deprecated and has no effect.\",\n ESLINT_PERSONAL_CONFIG_LOAD:\n \"'~/.eslintrc.*' config files have been deprecated. \" +\n \"Please use a config file per project or the '--config' option.\",\n ESLINT_PERSONAL_CONFIG_SUPPRESS:\n \"'~/.eslintrc.*' config files have been deprecated. \" +\n \"Please remove it or add 'root:true' to the config files in your \" +\n \"projects in order to avoid loading '~/.eslintrc.*' accidentally.\"\n};\n\nconst sourceFileErrorCache = new Set();\n\n/**\n * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted\n * for each unique file path, but repeated invocations with the same file path have no effect.\n * No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active.\n * @param {string} source The name of the configuration source to report the warning for.\n * @param {string} errorCode The warning message to show.\n * @returns {void}\n */\nfunction emitDeprecationWarning(source, errorCode) {\n const cacheKey = JSON.stringify({ source, errorCode });\n\n if (sourceFileErrorCache.has(cacheKey)) {\n return;\n }\n sourceFileErrorCache.add(cacheKey);\n\n const rel = path.relative(process.cwd(), source);\n const message = deprecationWarningMessages[errorCode];\n\n process.emitWarning(\n `${message} (found in \"${rel}\")`,\n \"DeprecationWarning\",\n errorCode\n );\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\nexport {\n emitDeprecationWarning\n};\n","/**\n * @fileoverview The instance of Ajv validator.\n * @author Evgeny Poberezkin\n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport Ajv from \"ajv\";\n\n//-----------------------------------------------------------------------------\n// Helpers\n//-----------------------------------------------------------------------------\n\n/*\n * Copied from ajv/lib/refs/json-schema-draft-04.json\n * The MIT License (MIT)\n * Copyright (c) 2015-2017 Evgeny Poberezkin\n */\nconst metaSchema = {\n id: \"http://json-schema.org/draft-04/schema#\",\n $schema: \"http://json-schema.org/draft-04/schema#\",\n description: \"Core schema meta-schema\",\n definitions: {\n schemaArray: {\n type: \"array\",\n minItems: 1,\n items: { $ref: \"#\" }\n },\n positiveInteger: {\n type: \"integer\",\n minimum: 0\n },\n positiveIntegerDefault0: {\n allOf: [{ $ref: \"#/definitions/positiveInteger\" }, { default: 0 }]\n },\n simpleTypes: {\n enum: [\"array\", \"boolean\", \"integer\", \"null\", \"number\", \"object\", \"string\"]\n },\n stringArray: {\n type: \"array\",\n items: { type: \"string\" },\n minItems: 1,\n uniqueItems: true\n }\n },\n type: \"object\",\n properties: {\n id: {\n type: \"string\"\n },\n $schema: {\n type: \"string\"\n },\n title: {\n type: \"string\"\n },\n description: {\n type: \"string\"\n },\n default: { },\n multipleOf: {\n type: \"number\",\n minimum: 0,\n exclusiveMinimum: true\n },\n maximum: {\n type: \"number\"\n },\n exclusiveMaximum: {\n type: \"boolean\",\n default: false\n },\n minimum: {\n type: \"number\"\n },\n exclusiveMinimum: {\n type: \"boolean\",\n default: false\n },\n maxLength: { $ref: \"#/definitions/positiveInteger\" },\n minLength: { $ref: \"#/definitions/positiveIntegerDefault0\" },\n pattern: {\n type: \"string\",\n format: \"regex\"\n },\n additionalItems: {\n anyOf: [\n { type: \"boolean\" },\n { $ref: \"#\" }\n ],\n default: { }\n },\n items: {\n anyOf: [\n { $ref: \"#\" },\n { $ref: \"#/definitions/schemaArray\" }\n ],\n default: { }\n },\n maxItems: { $ref: \"#/definitions/positiveInteger\" },\n minItems: { $ref: \"#/definitions/positiveIntegerDefault0\" },\n uniqueItems: {\n type: \"boolean\",\n default: false\n },\n maxProperties: { $ref: \"#/definitions/positiveInteger\" },\n minProperties: { $ref: \"#/definitions/positiveIntegerDefault0\" },\n required: { $ref: \"#/definitions/stringArray\" },\n additionalProperties: {\n anyOf: [\n { type: \"boolean\" },\n { $ref: \"#\" }\n ],\n default: { }\n },\n definitions: {\n type: \"object\",\n additionalProperties: { $ref: \"#\" },\n default: { }\n },\n properties: {\n type: \"object\",\n additionalProperties: { $ref: \"#\" },\n default: { }\n },\n patternProperties: {\n type: \"object\",\n additionalProperties: { $ref: \"#\" },\n default: { }\n },\n dependencies: {\n type: \"object\",\n additionalProperties: {\n anyOf: [\n { $ref: \"#\" },\n { $ref: \"#/definitions/stringArray\" }\n ]\n }\n },\n enum: {\n type: \"array\",\n minItems: 1,\n uniqueItems: true\n },\n type: {\n anyOf: [\n { $ref: \"#/definitions/simpleTypes\" },\n {\n type: \"array\",\n items: { $ref: \"#/definitions/simpleTypes\" },\n minItems: 1,\n uniqueItems: true\n }\n ]\n },\n format: { type: \"string\" },\n allOf: { $ref: \"#/definitions/schemaArray\" },\n anyOf: { $ref: \"#/definitions/schemaArray\" },\n oneOf: { $ref: \"#/definitions/schemaArray\" },\n not: { $ref: \"#\" }\n },\n dependencies: {\n exclusiveMaximum: [\"maximum\"],\n exclusiveMinimum: [\"minimum\"]\n },\n default: { }\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\nexport default (additionalOptions = {}) => {\n const ajv = new Ajv({\n meta: false,\n useDefaults: true,\n validateSchema: false,\n missingRefs: \"ignore\",\n verbose: true,\n schemaId: \"auto\",\n ...additionalOptions\n });\n\n ajv.addMetaSchema(metaSchema);\n // eslint-disable-next-line no-underscore-dangle\n ajv._opts.defaultMeta = metaSchema.id;\n\n return ajv;\n};\n","/**\n * @fileoverview Defines a schema for configs.\n * @author Sylvan Mably\n */\n\nconst baseConfigProperties = {\n $schema: { type: \"string\" },\n env: { type: \"object\" },\n extends: { $ref: \"#/definitions/stringOrStrings\" },\n globals: { type: \"object\" },\n overrides: {\n type: \"array\",\n items: { $ref: \"#/definitions/overrideConfig\" },\n additionalItems: false\n },\n parser: { type: [\"string\", \"null\"] },\n parserOptions: { type: \"object\" },\n plugins: { type: \"array\" },\n processor: { type: \"string\" },\n rules: { type: \"object\" },\n settings: { type: \"object\" },\n noInlineConfig: { type: \"boolean\" },\n reportUnusedDisableDirectives: { type: \"boolean\" },\n\n ecmaFeatures: { type: \"object\" } // deprecated; logs a warning when used\n};\n\nconst configSchema = {\n definitions: {\n stringOrStrings: {\n oneOf: [\n { type: \"string\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n additionalItems: false\n }\n ]\n },\n stringOrStringsRequired: {\n oneOf: [\n { type: \"string\" },\n {\n type: \"array\",\n items: { type: \"string\" },\n additionalItems: false,\n minItems: 1\n }\n ]\n },\n\n // Config at top-level.\n objectConfig: {\n type: \"object\",\n properties: {\n root: { type: \"boolean\" },\n ignorePatterns: { $ref: \"#/definitions/stringOrStrings\" },\n ...baseConfigProperties\n },\n additionalProperties: false\n },\n\n // Config in `overrides`.\n overrideConfig: {\n type: \"object\",\n properties: {\n excludedFiles: { $ref: \"#/definitions/stringOrStrings\" },\n files: { $ref: \"#/definitions/stringOrStringsRequired\" },\n ...baseConfigProperties\n },\n required: [\"files\"],\n additionalProperties: false\n }\n },\n\n $ref: \"#/definitions/objectConfig\"\n};\n\nexport default configSchema;\n","/**\n * @fileoverview Defines environment settings and globals.\n * @author Elan Shanker\n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport globals from \"globals\";\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n/**\n * Get the object that has difference.\n * @param {Record} current The newer object.\n * @param {Record} prev The older object.\n * @returns {Record} The difference object.\n */\nfunction getDiff(current, prev) {\n const retv = {};\n\n for (const [key, value] of Object.entries(current)) {\n if (!Object.hasOwnProperty.call(prev, key)) {\n retv[key] = value;\n }\n }\n\n return retv;\n}\n\nconst newGlobals2015 = getDiff(globals.es2015, globals.es5); // 19 variables such as Promise, Map, ...\nconst newGlobals2017 = {\n Atomics: false,\n SharedArrayBuffer: false\n};\nconst newGlobals2020 = {\n BigInt: false,\n BigInt64Array: false,\n BigUint64Array: false,\n globalThis: false\n};\n\nconst newGlobals2021 = {\n AggregateError: false,\n FinalizationRegistry: false,\n WeakRef: false\n};\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/** @type {Map} */\nexport default new Map(Object.entries({\n\n // Language\n builtin: {\n globals: globals.es5\n },\n es6: {\n globals: newGlobals2015,\n parserOptions: {\n ecmaVersion: 6\n }\n },\n es2015: {\n globals: newGlobals2015,\n parserOptions: {\n ecmaVersion: 6\n }\n },\n es2016: {\n globals: newGlobals2015,\n parserOptions: {\n ecmaVersion: 7\n }\n },\n es2017: {\n globals: { ...newGlobals2015, ...newGlobals2017 },\n parserOptions: {\n ecmaVersion: 8\n }\n },\n es2018: {\n globals: { ...newGlobals2015, ...newGlobals2017 },\n parserOptions: {\n ecmaVersion: 9\n }\n },\n es2019: {\n globals: { ...newGlobals2015, ...newGlobals2017 },\n parserOptions: {\n ecmaVersion: 10\n }\n },\n es2020: {\n globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 },\n parserOptions: {\n ecmaVersion: 11\n }\n },\n es2021: {\n globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },\n parserOptions: {\n ecmaVersion: 12\n }\n },\n es2022: {\n globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 },\n parserOptions: {\n ecmaVersion: 13\n }\n },\n\n // Platforms\n browser: {\n globals: globals.browser\n },\n node: {\n globals: globals.node,\n parserOptions: {\n ecmaFeatures: {\n globalReturn: true\n }\n }\n },\n \"shared-node-browser\": {\n globals: globals[\"shared-node-browser\"]\n },\n worker: {\n globals: globals.worker\n },\n serviceworker: {\n globals: globals.serviceworker\n },\n\n // Frameworks\n commonjs: {\n globals: globals.commonjs,\n parserOptions: {\n ecmaFeatures: {\n globalReturn: true\n }\n }\n },\n amd: {\n globals: globals.amd\n },\n mocha: {\n globals: globals.mocha\n },\n jasmine: {\n globals: globals.jasmine\n },\n jest: {\n globals: globals.jest\n },\n phantomjs: {\n globals: globals.phantomjs\n },\n jquery: {\n globals: globals.jquery\n },\n qunit: {\n globals: globals.qunit\n },\n prototypejs: {\n globals: globals.prototypejs\n },\n shelljs: {\n globals: globals.shelljs\n },\n meteor: {\n globals: globals.meteor\n },\n mongo: {\n globals: globals.mongo\n },\n protractor: {\n globals: globals.protractor\n },\n applescript: {\n globals: globals.applescript\n },\n nashorn: {\n globals: globals.nashorn\n },\n atomtest: {\n globals: globals.atomtest\n },\n embertest: {\n globals: globals.embertest\n },\n webextensions: {\n globals: globals.webextensions\n },\n greasemonkey: {\n globals: globals.greasemonkey\n }\n}));\n","/**\n * @fileoverview Validates configs.\n * @author Brandon Mills\n */\n\n/* eslint class-methods-use-this: \"off\" */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport util from \"util\";\nimport * as ConfigOps from \"./config-ops.js\";\nimport { emitDeprecationWarning } from \"./deprecation-warnings.js\";\nimport ajvOrig from \"./ajv.js\";\nimport configSchema from \"../../conf/config-schema.js\";\nimport BuiltInEnvironments from \"../../conf/environments.js\";\n\nconst ajv = ajvOrig();\n\nconst ruleValidators = new WeakMap();\nconst noop = Function.prototype;\n\n//------------------------------------------------------------------------------\n// Private\n//------------------------------------------------------------------------------\nlet validateSchema;\nconst severityMap = {\n error: 2,\n warn: 1,\n off: 0\n};\n\nconst validated = new WeakSet();\n\n//-----------------------------------------------------------------------------\n// Exports\n//-----------------------------------------------------------------------------\n\nexport default class ConfigValidator {\n constructor({ builtInRules = new Map() } = {}) {\n this.builtInRules = builtInRules;\n }\n\n /**\n * Gets a complete options schema for a rule.\n * @param {{create: Function, schema: (Array|null)}} rule A new-style rule object\n * @returns {Object} JSON Schema for the rule's options.\n */\n getRuleOptionsSchema(rule) {\n if (!rule) {\n return null;\n }\n\n const schema = rule.schema || rule.meta && rule.meta.schema;\n\n // Given a tuple of schemas, insert warning level at the beginning\n if (Array.isArray(schema)) {\n if (schema.length) {\n return {\n type: \"array\",\n items: schema,\n minItems: 0,\n maxItems: schema.length\n };\n }\n return {\n type: \"array\",\n minItems: 0,\n maxItems: 0\n };\n\n }\n\n // Given a full schema, leave it alone\n return schema || null;\n }\n\n /**\n * Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid.\n * @param {options} options The given options for the rule.\n * @returns {number|string} The rule's severity value\n */\n validateRuleSeverity(options) {\n const severity = Array.isArray(options) ? options[0] : options;\n const normSeverity = typeof severity === \"string\" ? severityMap[severity.toLowerCase()] : severity;\n\n if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) {\n return normSeverity;\n }\n\n throw new Error(`\\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util.inspect(severity).replace(/'/gu, \"\\\"\").replace(/\\n/gu, \"\")}').\\n`);\n\n }\n\n /**\n * Validates the non-severity options passed to a rule, based on its schema.\n * @param {{create: Function}} rule The rule to validate\n * @param {Array} localOptions The options for the rule, excluding severity\n * @returns {void}\n */\n validateRuleSchema(rule, localOptions) {\n if (!ruleValidators.has(rule)) {\n const schema = this.getRuleOptionsSchema(rule);\n\n if (schema) {\n ruleValidators.set(rule, ajv.compile(schema));\n }\n }\n\n const validateRule = ruleValidators.get(rule);\n\n if (validateRule) {\n validateRule(localOptions);\n if (validateRule.errors) {\n throw new Error(validateRule.errors.map(\n error => `\\tValue ${JSON.stringify(error.data)} ${error.message}.\\n`\n ).join(\"\"));\n }\n }\n }\n\n /**\n * Validates a rule's options against its schema.\n * @param {{create: Function}|null} rule The rule that the config is being validated for\n * @param {string} ruleId The rule's unique name.\n * @param {Array|number} options The given options for the rule.\n * @param {string|null} source The name of the configuration source to report in any errors. If null or undefined,\n * no source is prepended to the message.\n * @returns {void}\n */\n validateRuleOptions(rule, ruleId, options, source = null) {\n try {\n const severity = this.validateRuleSeverity(options);\n\n if (severity !== 0) {\n this.validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []);\n }\n } catch (err) {\n const enhancedMessage = `Configuration for rule \"${ruleId}\" is invalid:\\n${err.message}`;\n\n if (typeof source === \"string\") {\n throw new Error(`${source}:\\n\\t${enhancedMessage}`);\n } else {\n throw new Error(enhancedMessage);\n }\n }\n }\n\n /**\n * Validates an environment object\n * @param {Object} environment The environment config object to validate.\n * @param {string} source The name of the configuration source to report in any errors.\n * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments.\n * @returns {void}\n */\n validateEnvironment(\n environment,\n source,\n getAdditionalEnv = noop\n ) {\n\n // not having an environment is ok\n if (!environment) {\n return;\n }\n\n Object.keys(environment).forEach(id => {\n const env = getAdditionalEnv(id) || BuiltInEnvironments.get(id) || null;\n\n if (!env) {\n const message = `${source}:\\n\\tEnvironment key \"${id}\" is unknown\\n`;\n\n throw new Error(message);\n }\n });\n }\n\n /**\n * Validates a rules config object\n * @param {Object} rulesConfig The rules config object to validate.\n * @param {string} source The name of the configuration source to report in any errors.\n * @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules\n * @returns {void}\n */\n validateRules(\n rulesConfig,\n source,\n getAdditionalRule = noop\n ) {\n if (!rulesConfig) {\n return;\n }\n\n Object.keys(rulesConfig).forEach(id => {\n const rule = getAdditionalRule(id) || this.builtInRules.get(id) || null;\n\n this.validateRuleOptions(rule, id, rulesConfig[id], source);\n });\n }\n\n /**\n * Validates a `globals` section of a config file\n * @param {Object} globalsConfig The `globals` section\n * @param {string|null} source The name of the configuration source to report in the event of an error.\n * @returns {void}\n */\n validateGlobals(globalsConfig, source = null) {\n if (!globalsConfig) {\n return;\n }\n\n Object.entries(globalsConfig)\n .forEach(([configuredGlobal, configuredValue]) => {\n try {\n ConfigOps.normalizeConfigGlobal(configuredValue);\n } catch (err) {\n throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\\n${err.message}`);\n }\n });\n }\n\n /**\n * Validate `processor` configuration.\n * @param {string|undefined} processorName The processor name.\n * @param {string} source The name of config file.\n * @param {function(id:string): Processor} getProcessor The getter of defined processors.\n * @returns {void}\n */\n validateProcessor(processorName, source, getProcessor) {\n if (processorName && !getProcessor(processorName)) {\n throw new Error(`ESLint configuration of processor in '${source}' is invalid: '${processorName}' was not found.`);\n }\n }\n\n /**\n * Formats an array of schema validation errors.\n * @param {Array} errors An array of error messages to format.\n * @returns {string} Formatted error message\n */\n formatErrors(errors) {\n return errors.map(error => {\n if (error.keyword === \"additionalProperties\") {\n const formattedPropertyPath = error.dataPath.length ? `${error.dataPath.slice(1)}.${error.params.additionalProperty}` : error.params.additionalProperty;\n\n return `Unexpected top-level property \"${formattedPropertyPath}\"`;\n }\n if (error.keyword === \"type\") {\n const formattedField = error.dataPath.slice(1);\n const formattedExpectedType = Array.isArray(error.schema) ? error.schema.join(\"/\") : error.schema;\n const formattedValue = JSON.stringify(error.data);\n\n return `Property \"${formattedField}\" is the wrong type (expected ${formattedExpectedType} but got \\`${formattedValue}\\`)`;\n }\n\n const field = error.dataPath[0] === \".\" ? error.dataPath.slice(1) : error.dataPath;\n\n return `\"${field}\" ${error.message}. Value: ${JSON.stringify(error.data)}`;\n }).map(message => `\\t- ${message}.\\n`).join(\"\");\n }\n\n /**\n * Validates the top level properties of the config object.\n * @param {Object} config The config object to validate.\n * @param {string} source The name of the configuration source to report in any errors.\n * @returns {void}\n */\n validateConfigSchema(config, source = null) {\n validateSchema = validateSchema || ajv.compile(configSchema);\n\n if (!validateSchema(config)) {\n throw new Error(`ESLint configuration in ${source} is invalid:\\n${this.formatErrors(validateSchema.errors)}`);\n }\n\n if (Object.hasOwnProperty.call(config, \"ecmaFeatures\")) {\n emitDeprecationWarning(source, \"ESLINT_LEGACY_ECMAFEATURES\");\n }\n }\n\n /**\n * Validates an entire config object.\n * @param {Object} config The config object to validate.\n * @param {string} source The name of the configuration source to report in any errors.\n * @param {function(ruleId:string): Object} [getAdditionalRule] A map from strings to loaded rules.\n * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded envs.\n * @returns {void}\n */\n validate(config, source, getAdditionalRule, getAdditionalEnv) {\n this.validateConfigSchema(config, source);\n this.validateRules(config.rules, source, getAdditionalRule);\n this.validateEnvironment(config.env, source, getAdditionalEnv);\n this.validateGlobals(config.globals, source);\n\n for (const override of config.overrides || []) {\n this.validateRules(override.rules, source, getAdditionalRule);\n this.validateEnvironment(override.env, source, getAdditionalEnv);\n this.validateGlobals(config.globals, source);\n }\n }\n\n /**\n * Validate config array object.\n * @param {ConfigArray} configArray The config array to validate.\n * @returns {void}\n */\n validateConfigArray(configArray) {\n const getPluginEnv = Map.prototype.get.bind(configArray.pluginEnvironments);\n const getPluginProcessor = Map.prototype.get.bind(configArray.pluginProcessors);\n const getPluginRule = Map.prototype.get.bind(configArray.pluginRules);\n\n // Validate.\n for (const element of configArray) {\n if (validated.has(element)) {\n continue;\n }\n validated.add(element);\n\n this.validateEnvironment(element.env, element.name, getPluginEnv);\n this.validateGlobals(element.globals, element.name);\n this.validateProcessor(element.processor, element.name, getPluginProcessor);\n this.validateRules(element.rules, element.name, getPluginRule);\n }\n }\n\n}\n","/**\n * @fileoverview Common helpers for naming of plugins, formatters and configs\n */\n\nconst NAMESPACE_REGEX = /^@.*\\//iu;\n\n/**\n * Brings package name to correct format based on prefix\n * @param {string} name The name of the package.\n * @param {string} prefix Can be either \"eslint-plugin\", \"eslint-config\" or \"eslint-formatter\"\n * @returns {string} Normalized name of the package\n * @private\n */\nfunction normalizePackageName(name, prefix) {\n let normalizedName = name;\n\n /**\n * On Windows, name can come in with Windows slashes instead of Unix slashes.\n * Normalize to Unix first to avoid errors later on.\n * https://github.com/eslint/eslint/issues/5644\n */\n if (normalizedName.includes(\"\\\\\")) {\n normalizedName = normalizedName.replace(/\\\\/gu, \"/\");\n }\n\n if (normalizedName.charAt(0) === \"@\") {\n\n /**\n * it's a scoped package\n * package name is the prefix, or just a username\n */\n const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`, \"u\"),\n scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, \"u\");\n\n if (scopedPackageShortcutRegex.test(normalizedName)) {\n normalizedName = normalizedName.replace(scopedPackageShortcutRegex, `$1/${prefix}`);\n } else if (!scopedPackageNameRegex.test(normalizedName.split(\"/\")[1])) {\n\n /**\n * for scoped packages, insert the prefix after the first / unless\n * the path is already @scope/eslint or @scope/eslint-xxx-yyy\n */\n normalizedName = normalizedName.replace(/^@([^/]+)\\/(.*)$/u, `@$1/${prefix}-$2`);\n }\n } else if (!normalizedName.startsWith(`${prefix}-`)) {\n normalizedName = `${prefix}-${normalizedName}`;\n }\n\n return normalizedName;\n}\n\n/**\n * Removes the prefix from a fullname.\n * @param {string} fullname The term which may have the prefix.\n * @param {string} prefix The prefix to remove.\n * @returns {string} The term without prefix.\n */\nfunction getShorthandName(fullname, prefix) {\n if (fullname[0] === \"@\") {\n let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, \"u\").exec(fullname);\n\n if (matchResult) {\n return matchResult[1];\n }\n\n matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, \"u\").exec(fullname);\n if (matchResult) {\n return `${matchResult[1]}/${matchResult[2]}`;\n }\n } else if (fullname.startsWith(`${prefix}-`)) {\n return fullname.slice(prefix.length + 1);\n }\n\n return fullname;\n}\n\n/**\n * Gets the scope (namespace) of a term.\n * @param {string} term The term which may have the namespace.\n * @returns {string} The namespace of the term if it has one.\n */\nfunction getNamespaceFromTerm(term) {\n const match = term.match(NAMESPACE_REGEX);\n\n return match ? match[0] : \"\";\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\nexport {\n normalizePackageName,\n getShorthandName,\n getNamespaceFromTerm\n};\n","/**\n * Utility for resolving a module relative to another module\n * @author Teddy Katz\n */\n\nimport Module from \"module\";\n\n/*\n * `Module.createRequire` is added in v12.2.0. It supports URL as well.\n * We only support the case where the argument is a filepath, not a URL.\n */\nconst createRequire = Module.createRequire;\n\n/**\n * Resolves a Node module relative to another module\n * @param {string} moduleName The name of a Node module, or a path to a Node module.\n * @param {string} relativeToPath An absolute path indicating the module that `moduleName` should be resolved relative to. This must be\n * a file rather than a directory, but the file need not actually exist.\n * @returns {string} The absolute path that would result from calling `require.resolve(moduleName)` in a file located at `relativeToPath`\n */\nfunction resolve(moduleName, relativeToPath) {\n try {\n return createRequire(relativeToPath).resolve(moduleName);\n } catch (error) {\n\n // This `if` block is for older Node.js than 12.0.0. We can remove this block in the future.\n if (\n typeof error === \"object\" &&\n error !== null &&\n error.code === \"MODULE_NOT_FOUND\" &&\n !error.requireStack &&\n error.message.includes(moduleName)\n ) {\n error.message += `\\nRequire stack:\\n- ${relativeToPath}`;\n }\n throw error;\n }\n}\n\nexport {\n resolve\n};\n","/**\n * @fileoverview The factory of `ConfigArray` objects.\n *\n * This class provides methods to create `ConfigArray` instance.\n *\n * - `create(configData, options)`\n * Create a `ConfigArray` instance from a config data. This is to handle CLI\n * options except `--config`.\n * - `loadFile(filePath, options)`\n * Create a `ConfigArray` instance from a config file. This is to handle\n * `--config` option. If the file was not found, throws the following error:\n * - If the filename was `*.js`, a `MODULE_NOT_FOUND` error.\n * - If the filename was `package.json`, an IO error or an\n * `ESLINT_CONFIG_FIELD_NOT_FOUND` error.\n * - Otherwise, an IO error such as `ENOENT`.\n * - `loadInDirectory(directoryPath, options)`\n * Create a `ConfigArray` instance from a config file which is on a given\n * directory. This tries to load `.eslintrc.*` or `package.json`. If not\n * found, returns an empty `ConfigArray`.\n * - `loadESLintIgnore(filePath)`\n * Create a `ConfigArray` instance from a config file that is `.eslintignore`\n * format. This is to handle `--ignore-path` option.\n * - `loadDefaultESLintIgnore()`\n * Create a `ConfigArray` instance from `.eslintignore` or `package.json` in\n * the current working directory.\n *\n * `ConfigArrayFactory` class has the responsibility that loads configuration\n * files, including loading `extends`, `parser`, and `plugins`. The created\n * `ConfigArray` instance has the loaded `extends`, `parser`, and `plugins`.\n *\n * But this class doesn't handle cascading. `CascadingConfigArrayFactory` class\n * handles cascading and hierarchy.\n *\n * @author Toru Nagashima \n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport debugOrig from \"debug\";\nimport fs from \"fs\";\nimport importFresh from \"import-fresh\";\nimport { createRequire } from \"module\";\nimport path from \"path\";\nimport stripComments from \"strip-json-comments\";\n\nimport {\n ConfigArray,\n ConfigDependency,\n IgnorePattern,\n OverrideTester\n} from \"./config-array/index.js\";\nimport ConfigValidator from \"./shared/config-validator.js\";\nimport * as naming from \"./shared/naming.js\";\nimport * as ModuleResolver from \"./shared/relative-module-resolver.js\";\n\nconst require = createRequire(import.meta.url);\n\nconst debug = debugOrig(\"eslintrc:config-array-factory\");\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\nconst configFilenames = [\n \".eslintrc.js\",\n \".eslintrc.cjs\",\n \".eslintrc.yaml\",\n \".eslintrc.yml\",\n \".eslintrc.json\",\n \".eslintrc\",\n \"package.json\"\n];\n\n// Define types for VSCode IntelliSense.\n/** @typedef {import(\"./shared/types\").ConfigData} ConfigData */\n/** @typedef {import(\"./shared/types\").OverrideConfigData} OverrideConfigData */\n/** @typedef {import(\"./shared/types\").Parser} Parser */\n/** @typedef {import(\"./shared/types\").Plugin} Plugin */\n/** @typedef {import(\"./shared/types\").Rule} Rule */\n/** @typedef {import(\"./config-array/config-dependency\").DependentParser} DependentParser */\n/** @typedef {import(\"./config-array/config-dependency\").DependentPlugin} DependentPlugin */\n/** @typedef {ConfigArray[0]} ConfigArrayElement */\n\n/**\n * @typedef {Object} ConfigArrayFactoryOptions\n * @property {Map} [additionalPluginPool] The map for additional plugins.\n * @property {string} [cwd] The path to the current working directory.\n * @property {string} [resolvePluginsRelativeTo] A path to the directory that plugins should be resolved from. Defaults to `cwd`.\n * @property {Map} builtInRules The rules that are built in to ESLint.\n * @property {Object} [resolver=ModuleResolver] The module resolver object.\n * @property {string} eslintAllPath The path to the definitions for eslint:all.\n * @property {Function} getEslintAllConfig Returns the config data for eslint:all.\n * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended.\n * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended.\n */\n\n/**\n * @typedef {Object} ConfigArrayFactoryInternalSlots\n * @property {Map} additionalPluginPool The map for additional plugins.\n * @property {string} cwd The path to the current working directory.\n * @property {string | undefined} resolvePluginsRelativeTo An absolute path the the directory that plugins should be resolved from.\n * @property {Map} builtInRules The rules that are built in to ESLint.\n * @property {Object} [resolver=ModuleResolver] The module resolver object.\n * @property {string} eslintAllPath The path to the definitions for eslint:all.\n * @property {Function} getEslintAllConfig Returns the config data for eslint:all.\n * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended.\n * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended.\n */\n\n/**\n * @typedef {Object} ConfigArrayFactoryLoadingContext\n * @property {string} filePath The path to the current configuration.\n * @property {string} matchBasePath The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.\n * @property {string} name The name of the current configuration.\n * @property {string} pluginBasePath The base path to resolve plugins.\n * @property {\"config\" | \"ignore\" | \"implicit-processor\"} type The type of the current configuration. This is `\"config\"` in normal. This is `\"ignore\"` if it came from `.eslintignore`. This is `\"implicit-processor\"` if it came from legacy file-extension processors.\n */\n\n/**\n * @typedef {Object} ConfigArrayFactoryLoadingContext\n * @property {string} filePath The path to the current configuration.\n * @property {string} matchBasePath The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.\n * @property {string} name The name of the current configuration.\n * @property {\"config\" | \"ignore\" | \"implicit-processor\"} type The type of the current configuration. This is `\"config\"` in normal. This is `\"ignore\"` if it came from `.eslintignore`. This is `\"implicit-processor\"` if it came from legacy file-extension processors.\n */\n\n/** @type {WeakMap} */\nconst internalSlotsMap = new WeakMap();\n\n/** @type {WeakMap} */\nconst normalizedPlugins = new WeakMap();\n\n/**\n * Check if a given string is a file path.\n * @param {string} nameOrPath A module name or file path.\n * @returns {boolean} `true` if the `nameOrPath` is a file path.\n */\nfunction isFilePath(nameOrPath) {\n return (\n /^\\.{1,2}[/\\\\]/u.test(nameOrPath) ||\n path.isAbsolute(nameOrPath)\n );\n}\n\n/**\n * Convenience wrapper for synchronously reading file contents.\n * @param {string} filePath The filename to read.\n * @returns {string} The file contents, with the BOM removed.\n * @private\n */\nfunction readFile(filePath) {\n return fs.readFileSync(filePath, \"utf8\").replace(/^\\ufeff/u, \"\");\n}\n\n/**\n * Loads a YAML configuration from a file.\n * @param {string} filePath The filename to load.\n * @returns {ConfigData} The configuration object from the file.\n * @throws {Error} If the file cannot be read.\n * @private\n */\nfunction loadYAMLConfigFile(filePath) {\n debug(`Loading YAML config file: ${filePath}`);\n\n // lazy load YAML to improve performance when not used\n const yaml = require(\"js-yaml\");\n\n try {\n\n // empty YAML file can be null, so always use\n return yaml.load(readFile(filePath)) || {};\n } catch (e) {\n debug(`Error reading YAML file: ${filePath}`);\n e.message = `Cannot read config file: ${filePath}\\nError: ${e.message}`;\n throw e;\n }\n}\n\n/**\n * Loads a JSON configuration from a file.\n * @param {string} filePath The filename to load.\n * @returns {ConfigData} The configuration object from the file.\n * @throws {Error} If the file cannot be read.\n * @private\n */\nfunction loadJSONConfigFile(filePath) {\n debug(`Loading JSON config file: ${filePath}`);\n\n try {\n return JSON.parse(stripComments(readFile(filePath)));\n } catch (e) {\n debug(`Error reading JSON file: ${filePath}`);\n e.message = `Cannot read config file: ${filePath}\\nError: ${e.message}`;\n e.messageTemplate = \"failed-to-read-json\";\n e.messageData = {\n path: filePath,\n message: e.message\n };\n throw e;\n }\n}\n\n/**\n * Loads a legacy (.eslintrc) configuration from a file.\n * @param {string} filePath The filename to load.\n * @returns {ConfigData} The configuration object from the file.\n * @throws {Error} If the file cannot be read.\n * @private\n */\nfunction loadLegacyConfigFile(filePath) {\n debug(`Loading legacy config file: ${filePath}`);\n\n // lazy load YAML to improve performance when not used\n const yaml = require(\"js-yaml\");\n\n try {\n return yaml.load(stripComments(readFile(filePath))) || /* istanbul ignore next */ {};\n } catch (e) {\n debug(\"Error reading YAML file: %s\\n%o\", filePath, e);\n e.message = `Cannot read config file: ${filePath}\\nError: ${e.message}`;\n throw e;\n }\n}\n\n/**\n * Loads a JavaScript configuration from a file.\n * @param {string} filePath The filename to load.\n * @returns {ConfigData} The configuration object from the file.\n * @throws {Error} If the file cannot be read.\n * @private\n */\nfunction loadJSConfigFile(filePath) {\n debug(`Loading JS config file: ${filePath}`);\n try {\n return importFresh(filePath);\n } catch (e) {\n debug(`Error reading JavaScript file: ${filePath}`);\n e.message = `Cannot read config file: ${filePath}\\nError: ${e.message}`;\n throw e;\n }\n}\n\n/**\n * Loads a configuration from a package.json file.\n * @param {string} filePath The filename to load.\n * @returns {ConfigData} The configuration object from the file.\n * @throws {Error} If the file cannot be read.\n * @private\n */\nfunction loadPackageJSONConfigFile(filePath) {\n debug(`Loading package.json config file: ${filePath}`);\n try {\n const packageData = loadJSONConfigFile(filePath);\n\n if (!Object.hasOwnProperty.call(packageData, \"eslintConfig\")) {\n throw Object.assign(\n new Error(\"package.json file doesn't have 'eslintConfig' field.\"),\n { code: \"ESLINT_CONFIG_FIELD_NOT_FOUND\" }\n );\n }\n\n return packageData.eslintConfig;\n } catch (e) {\n debug(`Error reading package.json file: ${filePath}`);\n e.message = `Cannot read config file: ${filePath}\\nError: ${e.message}`;\n throw e;\n }\n}\n\n/**\n * Loads a `.eslintignore` from a file.\n * @param {string} filePath The filename to load.\n * @returns {string[]} The ignore patterns from the file.\n * @private\n */\nfunction loadESLintIgnoreFile(filePath) {\n debug(`Loading .eslintignore file: ${filePath}`);\n\n try {\n return readFile(filePath)\n .split(/\\r?\\n/gu)\n .filter(line => line.trim() !== \"\" && !line.startsWith(\"#\"));\n } catch (e) {\n debug(`Error reading .eslintignore file: ${filePath}`);\n e.message = `Cannot read .eslintignore file: ${filePath}\\nError: ${e.message}`;\n throw e;\n }\n}\n\n/**\n * Creates an error to notify about a missing config to extend from.\n * @param {string} configName The name of the missing config.\n * @param {string} importerName The name of the config that imported the missing config\n * @param {string} messageTemplate The text template to source error strings from.\n * @returns {Error} The error object to throw\n * @private\n */\nfunction configInvalidError(configName, importerName, messageTemplate) {\n return Object.assign(\n new Error(`Failed to load config \"${configName}\" to extend from.`),\n {\n messageTemplate,\n messageData: { configName, importerName }\n }\n );\n}\n\n/**\n * Loads a configuration file regardless of the source. Inspects the file path\n * to determine the correctly way to load the config file.\n * @param {string} filePath The path to the configuration.\n * @returns {ConfigData|null} The configuration information.\n * @private\n */\nfunction loadConfigFile(filePath) {\n switch (path.extname(filePath)) {\n case \".js\":\n case \".cjs\":\n return loadJSConfigFile(filePath);\n\n case \".json\":\n if (path.basename(filePath) === \"package.json\") {\n return loadPackageJSONConfigFile(filePath);\n }\n return loadJSONConfigFile(filePath);\n\n case \".yaml\":\n case \".yml\":\n return loadYAMLConfigFile(filePath);\n\n default:\n return loadLegacyConfigFile(filePath);\n }\n}\n\n/**\n * Write debug log.\n * @param {string} request The requested module name.\n * @param {string} relativeTo The file path to resolve the request relative to.\n * @param {string} filePath The resolved file path.\n * @returns {void}\n */\nfunction writeDebugLogForLoading(request, relativeTo, filePath) {\n /* istanbul ignore next */\n if (debug.enabled) {\n let nameAndVersion = null;\n\n try {\n const packageJsonPath = ModuleResolver.resolve(\n `${request}/package.json`,\n relativeTo\n );\n const { version = \"unknown\" } = require(packageJsonPath);\n\n nameAndVersion = `${request}@${version}`;\n } catch (error) {\n debug(\"package.json was not found:\", error.message);\n nameAndVersion = request;\n }\n\n debug(\"Loaded: %s (%s)\", nameAndVersion, filePath);\n }\n}\n\n/**\n * Create a new context with default values.\n * @param {ConfigArrayFactoryInternalSlots} slots The internal slots.\n * @param {\"config\" | \"ignore\" | \"implicit-processor\" | undefined} providedType The type of the current configuration. Default is `\"config\"`.\n * @param {string | undefined} providedName The name of the current configuration. Default is the relative path from `cwd` to `filePath`.\n * @param {string | undefined} providedFilePath The path to the current configuration. Default is empty string.\n * @param {string | undefined} providedMatchBasePath The type of the current configuration. Default is the directory of `filePath` or `cwd`.\n * @returns {ConfigArrayFactoryLoadingContext} The created context.\n */\nfunction createContext(\n { cwd, resolvePluginsRelativeTo },\n providedType,\n providedName,\n providedFilePath,\n providedMatchBasePath\n) {\n const filePath = providedFilePath\n ? path.resolve(cwd, providedFilePath)\n : \"\";\n const matchBasePath =\n (providedMatchBasePath && path.resolve(cwd, providedMatchBasePath)) ||\n (filePath && path.dirname(filePath)) ||\n cwd;\n const name =\n providedName ||\n (filePath && path.relative(cwd, filePath)) ||\n \"\";\n const pluginBasePath =\n resolvePluginsRelativeTo ||\n (filePath && path.dirname(filePath)) ||\n cwd;\n const type = providedType || \"config\";\n\n return { filePath, matchBasePath, name, pluginBasePath, type };\n}\n\n/**\n * Normalize a given plugin.\n * - Ensure the object to have four properties: configs, environments, processors, and rules.\n * - Ensure the object to not have other properties.\n * @param {Plugin} plugin The plugin to normalize.\n * @returns {Plugin} The normalized plugin.\n */\nfunction normalizePlugin(plugin) {\n\n // first check the cache\n let normalizedPlugin = normalizedPlugins.get(plugin);\n\n if (normalizedPlugin) {\n return normalizedPlugin;\n }\n\n normalizedPlugin = {\n configs: plugin.configs || {},\n environments: plugin.environments || {},\n processors: plugin.processors || {},\n rules: plugin.rules || {}\n };\n\n // save the reference for later\n normalizedPlugins.set(plugin, normalizedPlugin);\n\n return normalizedPlugin;\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\n/**\n * The factory of `ConfigArray` objects.\n */\nclass ConfigArrayFactory {\n\n /**\n * Initialize this instance.\n * @param {ConfigArrayFactoryOptions} [options] The map for additional plugins.\n */\n constructor({\n additionalPluginPool = new Map(),\n cwd = process.cwd(),\n resolvePluginsRelativeTo,\n builtInRules,\n resolver = ModuleResolver,\n eslintAllPath,\n getEslintAllConfig,\n eslintRecommendedPath,\n getEslintRecommendedConfig\n } = {}) {\n internalSlotsMap.set(this, {\n additionalPluginPool,\n cwd,\n resolvePluginsRelativeTo:\n resolvePluginsRelativeTo &&\n path.resolve(cwd, resolvePluginsRelativeTo),\n builtInRules,\n resolver,\n eslintAllPath,\n getEslintAllConfig,\n eslintRecommendedPath,\n getEslintRecommendedConfig\n });\n }\n\n /**\n * Create `ConfigArray` instance from a config data.\n * @param {ConfigData|null} configData The config data to create.\n * @param {Object} [options] The options.\n * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.\n * @param {string} [options.filePath] The path to this config data.\n * @param {string} [options.name] The config name.\n * @returns {ConfigArray} Loaded config.\n */\n create(configData, { basePath, filePath, name } = {}) {\n if (!configData) {\n return new ConfigArray();\n }\n\n const slots = internalSlotsMap.get(this);\n const ctx = createContext(slots, \"config\", name, filePath, basePath);\n const elements = this._normalizeConfigData(configData, ctx);\n\n return new ConfigArray(...elements);\n }\n\n /**\n * Load a config file.\n * @param {string} filePath The path to a config file.\n * @param {Object} [options] The options.\n * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.\n * @param {string} [options.name] The config name.\n * @returns {ConfigArray} Loaded config.\n */\n loadFile(filePath, { basePath, name } = {}) {\n const slots = internalSlotsMap.get(this);\n const ctx = createContext(slots, \"config\", name, filePath, basePath);\n\n return new ConfigArray(...this._loadConfigData(ctx));\n }\n\n /**\n * Load the config file on a given directory if exists.\n * @param {string} directoryPath The path to a directory.\n * @param {Object} [options] The options.\n * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`.\n * @param {string} [options.name] The config name.\n * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.\n */\n loadInDirectory(directoryPath, { basePath, name } = {}) {\n const slots = internalSlotsMap.get(this);\n\n for (const filename of configFilenames) {\n const ctx = createContext(\n slots,\n \"config\",\n name,\n path.join(directoryPath, filename),\n basePath\n );\n\n if (fs.existsSync(ctx.filePath) && fs.statSync(ctx.filePath).isFile()) {\n let configData;\n\n try {\n configData = loadConfigFile(ctx.filePath);\n } catch (error) {\n if (!error || error.code !== \"ESLINT_CONFIG_FIELD_NOT_FOUND\") {\n throw error;\n }\n }\n\n if (configData) {\n debug(`Config file found: ${ctx.filePath}`);\n return new ConfigArray(\n ...this._normalizeConfigData(configData, ctx)\n );\n }\n }\n }\n\n debug(`Config file not found on ${directoryPath}`);\n return new ConfigArray();\n }\n\n /**\n * Check if a config file on a given directory exists or not.\n * @param {string} directoryPath The path to a directory.\n * @returns {string | null} The path to the found config file. If not found then null.\n */\n static getPathToConfigFileInDirectory(directoryPath) {\n for (const filename of configFilenames) {\n const filePath = path.join(directoryPath, filename);\n\n if (fs.existsSync(filePath)) {\n if (filename === \"package.json\") {\n try {\n loadPackageJSONConfigFile(filePath);\n return filePath;\n } catch { /* ignore */ }\n } else {\n return filePath;\n }\n }\n }\n return null;\n }\n\n /**\n * Load `.eslintignore` file.\n * @param {string} filePath The path to a `.eslintignore` file to load.\n * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.\n */\n loadESLintIgnore(filePath) {\n const slots = internalSlotsMap.get(this);\n const ctx = createContext(\n slots,\n \"ignore\",\n void 0,\n filePath,\n slots.cwd\n );\n const ignorePatterns = loadESLintIgnoreFile(ctx.filePath);\n\n return new ConfigArray(\n ...this._normalizeESLintIgnoreData(ignorePatterns, ctx)\n );\n }\n\n /**\n * Load `.eslintignore` file in the current working directory.\n * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist.\n */\n loadDefaultESLintIgnore() {\n const slots = internalSlotsMap.get(this);\n const eslintIgnorePath = path.resolve(slots.cwd, \".eslintignore\");\n const packageJsonPath = path.resolve(slots.cwd, \"package.json\");\n\n if (fs.existsSync(eslintIgnorePath)) {\n return this.loadESLintIgnore(eslintIgnorePath);\n }\n if (fs.existsSync(packageJsonPath)) {\n const data = loadJSONConfigFile(packageJsonPath);\n\n if (Object.hasOwnProperty.call(data, \"eslintIgnore\")) {\n if (!Array.isArray(data.eslintIgnore)) {\n throw new Error(\"Package.json eslintIgnore property requires an array of paths\");\n }\n const ctx = createContext(\n slots,\n \"ignore\",\n \"eslintIgnore in package.json\",\n packageJsonPath,\n slots.cwd\n );\n\n return new ConfigArray(\n ...this._normalizeESLintIgnoreData(data.eslintIgnore, ctx)\n );\n }\n }\n\n return new ConfigArray();\n }\n\n /**\n * Load a given config file.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} Loaded config.\n * @private\n */\n _loadConfigData(ctx) {\n return this._normalizeConfigData(loadConfigFile(ctx.filePath), ctx);\n }\n\n /**\n * Normalize a given `.eslintignore` data to config array elements.\n * @param {string[]} ignorePatterns The patterns to ignore files.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n *_normalizeESLintIgnoreData(ignorePatterns, ctx) {\n const elements = this._normalizeObjectConfigData(\n { ignorePatterns },\n ctx\n );\n\n // Set `ignorePattern.loose` flag for backward compatibility.\n for (const element of elements) {\n if (element.ignorePattern) {\n element.ignorePattern.loose = true;\n }\n yield element;\n }\n }\n\n /**\n * Normalize a given config to an array.\n * @param {ConfigData} configData The config data to normalize.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n _normalizeConfigData(configData, ctx) {\n const validator = new ConfigValidator();\n\n validator.validateConfigSchema(configData, ctx.name || ctx.filePath);\n return this._normalizeObjectConfigData(configData, ctx);\n }\n\n /**\n * Normalize a given config to an array.\n * @param {ConfigData|OverrideConfigData} configData The config data to normalize.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n *_normalizeObjectConfigData(configData, ctx) {\n const { files, excludedFiles, ...configBody } = configData;\n const criteria = OverrideTester.create(\n files,\n excludedFiles,\n ctx.matchBasePath\n );\n const elements = this._normalizeObjectConfigDataBody(configBody, ctx);\n\n // Apply the criteria to every element.\n for (const element of elements) {\n\n /*\n * Merge the criteria.\n * This is for the `overrides` entries that came from the\n * configurations of `overrides[].extends`.\n */\n element.criteria = OverrideTester.and(criteria, element.criteria);\n\n /*\n * Remove `root` property to ignore `root` settings which came from\n * `extends` in `overrides`.\n */\n if (element.criteria) {\n element.root = void 0;\n }\n\n yield element;\n }\n }\n\n /**\n * Normalize a given config to an array.\n * @param {ConfigData} configData The config data to normalize.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n *_normalizeObjectConfigDataBody(\n {\n env,\n extends: extend,\n globals,\n ignorePatterns,\n noInlineConfig,\n parser: parserName,\n parserOptions,\n plugins: pluginList,\n processor,\n reportUnusedDisableDirectives,\n root,\n rules,\n settings,\n overrides: overrideList = []\n },\n ctx\n ) {\n const extendList = Array.isArray(extend) ? extend : [extend];\n const ignorePattern = ignorePatterns && new IgnorePattern(\n Array.isArray(ignorePatterns) ? ignorePatterns : [ignorePatterns],\n ctx.matchBasePath\n );\n\n // Flatten `extends`.\n for (const extendName of extendList.filter(Boolean)) {\n yield* this._loadExtends(extendName, ctx);\n }\n\n // Load parser & plugins.\n const parser = parserName && this._loadParser(parserName, ctx);\n const plugins = pluginList && this._loadPlugins(pluginList, ctx);\n\n // Yield pseudo config data for file extension processors.\n if (plugins) {\n yield* this._takeFileExtensionProcessors(plugins, ctx);\n }\n\n // Yield the config data except `extends` and `overrides`.\n yield {\n\n // Debug information.\n type: ctx.type,\n name: ctx.name,\n filePath: ctx.filePath,\n\n // Config data.\n criteria: null,\n env,\n globals,\n ignorePattern,\n noInlineConfig,\n parser,\n parserOptions,\n plugins,\n processor,\n reportUnusedDisableDirectives,\n root,\n rules,\n settings\n };\n\n // Flatten `overries`.\n for (let i = 0; i < overrideList.length; ++i) {\n yield* this._normalizeObjectConfigData(\n overrideList[i],\n { ...ctx, name: `${ctx.name}#overrides[${i}]` }\n );\n }\n }\n\n /**\n * Load configs of an element in `extends`.\n * @param {string} extendName The name of a base config.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n _loadExtends(extendName, ctx) {\n debug(\"Loading {extends:%j} relative to %s\", extendName, ctx.filePath);\n try {\n if (extendName.startsWith(\"eslint:\")) {\n return this._loadExtendedBuiltInConfig(extendName, ctx);\n }\n if (extendName.startsWith(\"plugin:\")) {\n return this._loadExtendedPluginConfig(extendName, ctx);\n }\n return this._loadExtendedShareableConfig(extendName, ctx);\n } catch (error) {\n error.message += `\\nReferenced from: ${ctx.filePath || ctx.name}`;\n throw error;\n }\n }\n\n /**\n * Load configs of an element in `extends`.\n * @param {string} extendName The name of a base config.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n _loadExtendedBuiltInConfig(extendName, ctx) {\n const {\n eslintAllPath,\n getEslintAllConfig,\n eslintRecommendedPath,\n getEslintRecommendedConfig\n } = internalSlotsMap.get(this);\n\n if (extendName === \"eslint:recommended\") {\n const name = `${ctx.name} » ${extendName}`;\n\n if (getEslintRecommendedConfig) {\n if (typeof getEslintRecommendedConfig !== \"function\") {\n throw new Error(`getEslintRecommendedConfig must be a function instead of '${getEslintRecommendedConfig}'`);\n }\n return this._normalizeConfigData(getEslintRecommendedConfig(), { ...ctx, name, filePath: \"\" });\n }\n return this._loadConfigData({\n ...ctx,\n name,\n filePath: eslintRecommendedPath\n });\n }\n if (extendName === \"eslint:all\") {\n const name = `${ctx.name} » ${extendName}`;\n\n if (getEslintAllConfig) {\n if (typeof getEslintAllConfig !== \"function\") {\n throw new Error(`getEslintAllConfig must be a function instead of '${getEslintAllConfig}'`);\n }\n return this._normalizeConfigData(getEslintAllConfig(), { ...ctx, name, filePath: \"\" });\n }\n return this._loadConfigData({\n ...ctx,\n name,\n filePath: eslintAllPath\n });\n }\n\n throw configInvalidError(extendName, ctx.name, \"extend-config-missing\");\n }\n\n /**\n * Load configs of an element in `extends`.\n * @param {string} extendName The name of a base config.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n _loadExtendedPluginConfig(extendName, ctx) {\n const slashIndex = extendName.lastIndexOf(\"/\");\n\n if (slashIndex === -1) {\n throw configInvalidError(extendName, ctx.filePath, \"plugin-invalid\");\n }\n\n const pluginName = extendName.slice(\"plugin:\".length, slashIndex);\n const configName = extendName.slice(slashIndex + 1);\n\n if (isFilePath(pluginName)) {\n throw new Error(\"'extends' cannot use a file path for plugins.\");\n }\n\n const plugin = this._loadPlugin(pluginName, ctx);\n const configData =\n plugin.definition &&\n plugin.definition.configs[configName];\n\n if (configData) {\n return this._normalizeConfigData(configData, {\n ...ctx,\n filePath: plugin.filePath || ctx.filePath,\n name: `${ctx.name} » plugin:${plugin.id}/${configName}`\n });\n }\n\n throw plugin.error || configInvalidError(extendName, ctx.filePath, \"extend-config-missing\");\n }\n\n /**\n * Load configs of an element in `extends`.\n * @param {string} extendName The name of a base config.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The normalized config.\n * @private\n */\n _loadExtendedShareableConfig(extendName, ctx) {\n const { cwd, resolver } = internalSlotsMap.get(this);\n const relativeTo = ctx.filePath || path.join(cwd, \"__placeholder__.js\");\n let request;\n\n if (isFilePath(extendName)) {\n request = extendName;\n } else if (extendName.startsWith(\".\")) {\n request = `./${extendName}`; // For backward compatibility. A ton of tests depended on this behavior.\n } else {\n request = naming.normalizePackageName(\n extendName,\n \"eslint-config\"\n );\n }\n\n let filePath;\n\n try {\n filePath = resolver.resolve(request, relativeTo);\n } catch (error) {\n /* istanbul ignore else */\n if (error && error.code === \"MODULE_NOT_FOUND\") {\n throw configInvalidError(extendName, ctx.filePath, \"extend-config-missing\");\n }\n throw error;\n }\n\n writeDebugLogForLoading(request, relativeTo, filePath);\n return this._loadConfigData({\n ...ctx,\n filePath,\n name: `${ctx.name} » ${request}`\n });\n }\n\n /**\n * Load given plugins.\n * @param {string[]} names The plugin names to load.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {Record} The loaded parser.\n * @private\n */\n _loadPlugins(names, ctx) {\n return names.reduce((map, name) => {\n if (isFilePath(name)) {\n throw new Error(\"Plugins array cannot includes file paths.\");\n }\n const plugin = this._loadPlugin(name, ctx);\n\n map[plugin.id] = plugin;\n\n return map;\n }, {});\n }\n\n /**\n * Load a given parser.\n * @param {string} nameOrPath The package name or the path to a parser file.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {DependentParser} The loaded parser.\n */\n _loadParser(nameOrPath, ctx) {\n debug(\"Loading parser %j from %s\", nameOrPath, ctx.filePath);\n\n const { cwd, resolver } = internalSlotsMap.get(this);\n const relativeTo = ctx.filePath || path.join(cwd, \"__placeholder__.js\");\n\n try {\n const filePath = resolver.resolve(nameOrPath, relativeTo);\n\n writeDebugLogForLoading(nameOrPath, relativeTo, filePath);\n\n return new ConfigDependency({\n definition: require(filePath),\n filePath,\n id: nameOrPath,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n } catch (error) {\n\n // If the parser name is \"espree\", load the espree of ESLint.\n if (nameOrPath === \"espree\") {\n debug(\"Fallback espree.\");\n return new ConfigDependency({\n definition: require(\"espree\"),\n filePath: require.resolve(\"espree\"),\n id: nameOrPath,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n }\n\n debug(\"Failed to load parser '%s' declared in '%s'.\", nameOrPath, ctx.name);\n error.message = `Failed to load parser '${nameOrPath}' declared in '${ctx.name}': ${error.message}`;\n\n return new ConfigDependency({\n error,\n id: nameOrPath,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n }\n }\n\n /**\n * Load a given plugin.\n * @param {string} name The plugin name to load.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {DependentPlugin} The loaded plugin.\n * @private\n */\n _loadPlugin(name, ctx) {\n debug(\"Loading plugin %j from %s\", name, ctx.filePath);\n\n const { additionalPluginPool, resolver } = internalSlotsMap.get(this);\n const request = naming.normalizePackageName(name, \"eslint-plugin\");\n const id = naming.getShorthandName(request, \"eslint-plugin\");\n const relativeTo = path.join(ctx.pluginBasePath, \"__placeholder__.js\");\n\n if (name.match(/\\s+/u)) {\n const error = Object.assign(\n new Error(`Whitespace found in plugin name '${name}'`),\n {\n messageTemplate: \"whitespace-found\",\n messageData: { pluginName: request }\n }\n );\n\n return new ConfigDependency({\n error,\n id,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n }\n\n // Check for additional pool.\n const plugin =\n additionalPluginPool.get(request) ||\n additionalPluginPool.get(id);\n\n if (plugin) {\n return new ConfigDependency({\n definition: normalizePlugin(plugin),\n filePath: \"\", // It's unknown where the plugin came from.\n id,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n }\n\n let filePath;\n let error;\n\n try {\n filePath = resolver.resolve(request, relativeTo);\n } catch (resolveError) {\n error = resolveError;\n /* istanbul ignore else */\n if (error && error.code === \"MODULE_NOT_FOUND\") {\n error.messageTemplate = \"plugin-missing\";\n error.messageData = {\n pluginName: request,\n resolvePluginsRelativeTo: ctx.pluginBasePath,\n importerName: ctx.name\n };\n }\n }\n\n if (filePath) {\n try {\n writeDebugLogForLoading(request, relativeTo, filePath);\n\n const startTime = Date.now();\n const pluginDefinition = require(filePath);\n\n debug(`Plugin ${filePath} loaded in: ${Date.now() - startTime}ms`);\n\n return new ConfigDependency({\n definition: normalizePlugin(pluginDefinition),\n filePath,\n id,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n } catch (loadError) {\n error = loadError;\n }\n }\n\n debug(\"Failed to load plugin '%s' declared in '%s'.\", name, ctx.name);\n error.message = `Failed to load plugin '${name}' declared in '${ctx.name}': ${error.message}`;\n return new ConfigDependency({\n error,\n id,\n importerName: ctx.name,\n importerPath: ctx.filePath\n });\n }\n\n /**\n * Take file expression processors as config array elements.\n * @param {Record} plugins The plugin definitions.\n * @param {ConfigArrayFactoryLoadingContext} ctx The loading context.\n * @returns {IterableIterator} The config array elements of file expression processors.\n * @private\n */\n *_takeFileExtensionProcessors(plugins, ctx) {\n for (const pluginId of Object.keys(plugins)) {\n const processors =\n plugins[pluginId] &&\n plugins[pluginId].definition &&\n plugins[pluginId].definition.processors;\n\n if (!processors) {\n continue;\n }\n\n for (const processorId of Object.keys(processors)) {\n if (processorId.startsWith(\".\")) {\n yield* this._normalizeObjectConfigData(\n {\n files: [`*${processorId}`],\n processor: `${pluginId}/${processorId}`\n },\n {\n ...ctx,\n type: \"implicit-processor\",\n name: `${ctx.name}#processors[\"${pluginId}/${processorId}\"]`\n }\n );\n }\n }\n }\n }\n}\n\nexport { ConfigArrayFactory, createContext };\n","/**\n * @fileoverview `CascadingConfigArrayFactory` class.\n *\n * `CascadingConfigArrayFactory` class has a responsibility:\n *\n * 1. Handles cascading of config files.\n *\n * It provides two methods:\n *\n * - `getConfigArrayForFile(filePath)`\n * Get the corresponded configuration of a given file. This method doesn't\n * throw even if the given file didn't exist.\n * - `clearCache()`\n * Clear the internal cache. You have to call this method when\n * `additionalPluginPool` was updated if `baseConfig` or `cliConfig` depends\n * on the additional plugins. (`CLIEngine#addPlugin()` method calls this.)\n *\n * @author Toru Nagashima \n */\n\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport debugOrig from \"debug\";\nimport os from \"os\";\nimport path from \"path\";\n\nimport { ConfigArrayFactory } from \"./config-array-factory.js\";\nimport {\n ConfigArray,\n ConfigDependency,\n IgnorePattern\n} from \"./config-array/index.js\";\nimport ConfigValidator from \"./shared/config-validator.js\";\nimport { emitDeprecationWarning } from \"./shared/deprecation-warnings.js\";\n\nconst debug = debugOrig(\"eslintrc:cascading-config-array-factory\");\n\n//------------------------------------------------------------------------------\n// Helpers\n//------------------------------------------------------------------------------\n\n// Define types for VSCode IntelliSense.\n/** @typedef {import(\"./shared/types\").ConfigData} ConfigData */\n/** @typedef {import(\"./shared/types\").Parser} Parser */\n/** @typedef {import(\"./shared/types\").Plugin} Plugin */\n/** @typedef {import(\"./shared/types\").Rule} Rule */\n/** @typedef {ReturnType} ConfigArray */\n\n/**\n * @typedef {Object} CascadingConfigArrayFactoryOptions\n * @property {Map} [additionalPluginPool] The map for additional plugins.\n * @property {ConfigData} [baseConfig] The config by `baseConfig` option.\n * @property {ConfigData} [cliConfig] The config by CLI options (`--env`, `--global`, `--ignore-pattern`, `--parser`, `--parser-options`, `--plugin`, and `--rule`). CLI options overwrite the setting in config files.\n * @property {string} [cwd] The base directory to start lookup.\n * @property {string} [ignorePath] The path to the alternative file of `.eslintignore`.\n * @property {string[]} [rulePaths] The value of `--rulesdir` option.\n * @property {string} [specificConfigPath] The value of `--config` option.\n * @property {boolean} [useEslintrc] if `false` then it doesn't load config files.\n * @property {Function} loadRules The function to use to load rules.\n * @property {Map} builtInRules The rules that are built in to ESLint.\n * @property {Object} [resolver=ModuleResolver] The module resolver object.\n * @property {string} eslintAllPath The path to the definitions for eslint:all.\n * @property {Function} getEslintAllConfig Returns the config data for eslint:all.\n * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended.\n * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended.\n */\n\n/**\n * @typedef {Object} CascadingConfigArrayFactoryInternalSlots\n * @property {ConfigArray} baseConfigArray The config array of `baseConfig` option.\n * @property {ConfigData} baseConfigData The config data of `baseConfig` option. This is used to reset `baseConfigArray`.\n * @property {ConfigArray} cliConfigArray The config array of CLI options.\n * @property {ConfigData} cliConfigData The config data of CLI options. This is used to reset `cliConfigArray`.\n * @property {ConfigArrayFactory} configArrayFactory The factory for config arrays.\n * @property {Map} configCache The cache from directory paths to config arrays.\n * @property {string} cwd The base directory to start lookup.\n * @property {WeakMap} finalizeCache The cache from config arrays to finalized config arrays.\n * @property {string} [ignorePath] The path to the alternative file of `.eslintignore`.\n * @property {string[]|null} rulePaths The value of `--rulesdir` option. This is used to reset `baseConfigArray`.\n * @property {string|null} specificConfigPath The value of `--config` option. This is used to reset `cliConfigArray`.\n * @property {boolean} useEslintrc if `false` then it doesn't load config files.\n * @property {Function} loadRules The function to use to load rules.\n * @property {Map} builtInRules The rules that are built in to ESLint.\n * @property {Object} [resolver=ModuleResolver] The module resolver object.\n * @property {string} eslintAllPath The path to the definitions for eslint:all.\n * @property {Function} getEslintAllConfig Returns the config data for eslint:all.\n * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended.\n * @property {Function} getEslintRecommendedConfig Returns the config data for eslint:recommended.\n */\n\n/** @type {WeakMap} */\nconst internalSlotsMap = new WeakMap();\n\n/**\n * Create the config array from `baseConfig` and `rulePaths`.\n * @param {CascadingConfigArrayFactoryInternalSlots} slots The slots.\n * @returns {ConfigArray} The config array of the base configs.\n */\nfunction createBaseConfigArray({\n configArrayFactory,\n baseConfigData,\n rulePaths,\n cwd,\n loadRules\n}) {\n const baseConfigArray = configArrayFactory.create(\n baseConfigData,\n { name: \"BaseConfig\" }\n );\n\n /*\n * Create the config array element for the default ignore patterns.\n * This element has `ignorePattern` property that ignores the default\n * patterns in the current working directory.\n */\n baseConfigArray.unshift(configArrayFactory.create(\n { ignorePatterns: IgnorePattern.DefaultPatterns },\n { name: \"DefaultIgnorePattern\" }\n )[0]);\n\n /*\n * Load rules `--rulesdir` option as a pseudo plugin.\n * Use a pseudo plugin to define rules of `--rulesdir`, so we can validate\n * the rule's options with only information in the config array.\n */\n if (rulePaths && rulePaths.length > 0) {\n baseConfigArray.push({\n type: \"config\",\n name: \"--rulesdir\",\n filePath: \"\",\n plugins: {\n \"\": new ConfigDependency({\n definition: {\n rules: rulePaths.reduce(\n (map, rulesPath) => Object.assign(\n map,\n loadRules(rulesPath, cwd)\n ),\n {}\n )\n },\n filePath: \"\",\n id: \"\",\n importerName: \"--rulesdir\",\n importerPath: \"\"\n })\n }\n });\n }\n\n return baseConfigArray;\n}\n\n/**\n * Create the config array from CLI options.\n * @param {CascadingConfigArrayFactoryInternalSlots} slots The slots.\n * @returns {ConfigArray} The config array of the base configs.\n */\nfunction createCLIConfigArray({\n cliConfigData,\n configArrayFactory,\n cwd,\n ignorePath,\n specificConfigPath\n}) {\n const cliConfigArray = configArrayFactory.create(\n cliConfigData,\n { name: \"CLIOptions\" }\n );\n\n cliConfigArray.unshift(\n ...(ignorePath\n ? configArrayFactory.loadESLintIgnore(ignorePath)\n : configArrayFactory.loadDefaultESLintIgnore())\n );\n\n if (specificConfigPath) {\n cliConfigArray.unshift(\n ...configArrayFactory.loadFile(\n specificConfigPath,\n { name: \"--config\", basePath: cwd }\n )\n );\n }\n\n return cliConfigArray;\n}\n\n/**\n * The error type when there are files matched by a glob, but all of them have been ignored.\n */\nclass ConfigurationNotFoundError extends Error {\n\n // eslint-disable-next-line jsdoc/require-description\n /**\n * @param {string} directoryPath The directory path.\n */\n constructor(directoryPath) {\n super(`No ESLint configuration found in ${directoryPath}.`);\n this.messageTemplate = \"no-config-found\";\n this.messageData = { directoryPath };\n }\n}\n\n/**\n * This class provides the functionality that enumerates every file which is\n * matched by given glob patterns and that configuration.\n */\nclass CascadingConfigArrayFactory {\n\n /**\n * Initialize this enumerator.\n * @param {CascadingConfigArrayFactoryOptions} options The options.\n */\n constructor({\n additionalPluginPool = new Map(),\n baseConfig: baseConfigData = null,\n cliConfig: cliConfigData = null,\n cwd = process.cwd(),\n ignorePath,\n resolvePluginsRelativeTo,\n rulePaths = [],\n specificConfigPath = null,\n useEslintrc = true,\n builtInRules = new Map(),\n loadRules,\n resolver,\n eslintRecommendedPath,\n getEslintRecommendedConfig,\n eslintAllPath,\n getEslintAllConfig\n } = {}) {\n const configArrayFactory = new ConfigArrayFactory({\n additionalPluginPool,\n cwd,\n resolvePluginsRelativeTo,\n builtInRules,\n resolver,\n eslintRecommendedPath,\n getEslintRecommendedConfig,\n eslintAllPath,\n getEslintAllConfig\n });\n\n internalSlotsMap.set(this, {\n baseConfigArray: createBaseConfigArray({\n baseConfigData,\n configArrayFactory,\n cwd,\n rulePaths,\n loadRules\n }),\n baseConfigData,\n cliConfigArray: createCLIConfigArray({\n cliConfigData,\n configArrayFactory,\n cwd,\n ignorePath,\n specificConfigPath\n }),\n cliConfigData,\n configArrayFactory,\n configCache: new Map(),\n cwd,\n finalizeCache: new WeakMap(),\n ignorePath,\n rulePaths,\n specificConfigPath,\n useEslintrc,\n builtInRules,\n loadRules\n });\n }\n\n /**\n * The path to the current working directory.\n * This is used by tests.\n * @type {string}\n */\n get cwd() {\n const { cwd } = internalSlotsMap.get(this);\n\n return cwd;\n }\n\n /**\n * Get the config array of a given file.\n * If `filePath` was not given, it returns the config which contains only\n * `baseConfigData` and `cliConfigData`.\n * @param {string} [filePath] The file path to a file.\n * @param {Object} [options] The options.\n * @param {boolean} [options.ignoreNotFoundError] If `true` then it doesn't throw `ConfigurationNotFoundError`.\n * @returns {ConfigArray} The config array of the file.\n */\n getConfigArrayForFile(filePath, { ignoreNotFoundError = false } = {}) {\n const {\n baseConfigArray,\n cliConfigArray,\n cwd\n } = internalSlotsMap.get(this);\n\n if (!filePath) {\n return new ConfigArray(...baseConfigArray, ...cliConfigArray);\n }\n\n const directoryPath = path.dirname(path.resolve(cwd, filePath));\n\n debug(`Load config files for ${directoryPath}.`);\n\n return this._finalizeConfigArray(\n this._loadConfigInAncestors(directoryPath),\n directoryPath,\n ignoreNotFoundError\n );\n }\n\n /**\n * Set the config data to override all configs.\n * Require to call `clearCache()` method after this method is called.\n * @param {ConfigData} configData The config data to override all configs.\n * @returns {void}\n */\n setOverrideConfig(configData) {\n const slots = internalSlotsMap.get(this);\n\n slots.cliConfigData = configData;\n }\n\n /**\n * Clear config cache.\n * @returns {void}\n */\n clearCache() {\n const slots = internalSlotsMap.get(this);\n\n slots.baseConfigArray = createBaseConfigArray(slots);\n slots.cliConfigArray = createCLIConfigArray(slots);\n slots.configCache.clear();\n }\n\n /**\n * Load and normalize config files from the ancestor directories.\n * @param {string} directoryPath The path to a leaf directory.\n * @param {boolean} configsExistInSubdirs `true` if configurations exist in subdirectories.\n * @returns {ConfigArray} The loaded config.\n * @private\n */\n _loadConfigInAncestors(directoryPath, configsExistInSubdirs = false) {\n const {\n baseConfigArray,\n configArrayFactory,\n configCache,\n cwd,\n useEslintrc\n } = internalSlotsMap.get(this);\n\n if (!useEslintrc) {\n return baseConfigArray;\n }\n\n let configArray = configCache.get(directoryPath);\n\n // Hit cache.\n if (configArray) {\n debug(`Cache hit: ${directoryPath}.`);\n return configArray;\n }\n debug(`No cache found: ${directoryPath}.`);\n\n const homePath = os.homedir();\n\n // Consider this is root.\n if (directoryPath === homePath && cwd !== homePath) {\n debug(\"Stop traversing because of considered root.\");\n if (configsExistInSubdirs) {\n const filePath = ConfigArrayFactory.getPathToConfigFileInDirectory(directoryPath);\n\n if (filePath) {\n emitDeprecationWarning(\n filePath,\n \"ESLINT_PERSONAL_CONFIG_SUPPRESS\"\n );\n }\n }\n return this._cacheConfig(directoryPath, baseConfigArray);\n }\n\n // Load the config on this directory.\n try {\n configArray = configArrayFactory.loadInDirectory(directoryPath);\n } catch (error) {\n /* istanbul ignore next */\n if (error.code === \"EACCES\") {\n debug(\"Stop traversing because of 'EACCES' error.\");\n return this._cacheConfig(directoryPath, baseConfigArray);\n }\n throw error;\n }\n\n if (configArray.length > 0 && configArray.isRoot()) {\n debug(\"Stop traversing because of 'root:true'.\");\n configArray.unshift(...baseConfigArray);\n return this._cacheConfig(directoryPath, configArray);\n }\n\n // Load from the ancestors and merge it.\n const parentPath = path.dirname(directoryPath);\n const parentConfigArray = parentPath && parentPath !== directoryPath\n ? this._loadConfigInAncestors(\n parentPath,\n configsExistInSubdirs || configArray.length > 0\n )\n : baseConfigArray;\n\n if (configArray.length > 0) {\n configArray.unshift(...parentConfigArray);\n } else {\n configArray = parentConfigArray;\n }\n\n // Cache and return.\n return this._cacheConfig(directoryPath, configArray);\n }\n\n /**\n * Freeze and cache a given config.\n * @param {string} directoryPath The path to a directory as a cache key.\n * @param {ConfigArray} configArray The config array as a cache value.\n * @returns {ConfigArray} The `configArray` (frozen).\n */\n _cacheConfig(directoryPath, configArray) {\n const { configCache } = internalSlotsMap.get(this);\n\n Object.freeze(configArray);\n configCache.set(directoryPath, configArray);\n\n return configArray;\n }\n\n /**\n * Finalize a given config array.\n * Concatenate `--config` and other CLI options.\n * @param {ConfigArray} configArray The parent config array.\n * @param {string} directoryPath The path to the leaf directory to find config files.\n * @param {boolean} ignoreNotFoundError If `true` then it doesn't throw `ConfigurationNotFoundError`.\n * @returns {ConfigArray} The loaded config.\n * @private\n */\n _finalizeConfigArray(configArray, directoryPath, ignoreNotFoundError) {\n const {\n cliConfigArray,\n configArrayFactory,\n finalizeCache,\n useEslintrc,\n builtInRules\n } = internalSlotsMap.get(this);\n\n let finalConfigArray = finalizeCache.get(configArray);\n\n if (!finalConfigArray) {\n finalConfigArray = configArray;\n\n // Load the personal config if there are no regular config files.\n if (\n useEslintrc &&\n configArray.every(c => !c.filePath) &&\n cliConfigArray.every(c => !c.filePath) // `--config` option can be a file.\n ) {\n const homePath = os.homedir();\n\n debug(\"Loading the config file of the home directory:\", homePath);\n\n const personalConfigArray = configArrayFactory.loadInDirectory(\n homePath,\n { name: \"PersonalConfig\" }\n );\n\n if (\n personalConfigArray.length > 0 &&\n !directoryPath.startsWith(homePath)\n ) {\n const lastElement =\n personalConfigArray[personalConfigArray.length - 1];\n\n emitDeprecationWarning(\n lastElement.filePath,\n \"ESLINT_PERSONAL_CONFIG_LOAD\"\n );\n }\n\n finalConfigArray = finalConfigArray.concat(personalConfigArray);\n }\n\n // Apply CLI options.\n if (cliConfigArray.length > 0) {\n finalConfigArray = finalConfigArray.concat(cliConfigArray);\n }\n\n // Validate rule settings and environments.\n const validator = new ConfigValidator({\n builtInRules\n });\n\n validator.validateConfigArray(finalConfigArray);\n\n // Cache it.\n Object.freeze(finalConfigArray);\n finalizeCache.set(configArray, finalConfigArray);\n\n debug(\n \"Configuration was determined: %o on %s\",\n finalConfigArray,\n directoryPath\n );\n }\n\n // At least one element (the default ignore patterns) exists.\n if (!ignoreNotFoundError && useEslintrc && finalConfigArray.length <= 1) {\n throw new ConfigurationNotFoundError(directoryPath);\n }\n\n return finalConfigArray;\n }\n}\n\n//------------------------------------------------------------------------------\n// Public Interface\n//------------------------------------------------------------------------------\n\nexport { CascadingConfigArrayFactory };\n","/**\n * @fileoverview Compatibility class for flat config.\n * @author Nicholas C. Zakas\n */\n\n//-----------------------------------------------------------------------------\n// Requirements\n//-----------------------------------------------------------------------------\n\nimport createDebug from \"debug\";\nimport path from \"path\";\n\nimport environments from \"../conf/environments.js\";\nimport { ConfigArrayFactory } from \"./config-array-factory.js\";\n\n//-----------------------------------------------------------------------------\n// Helpers\n//-----------------------------------------------------------------------------\n\n/** @typedef {import(\"../../shared/types\").Environment} Environment */\n/** @typedef {import(\"../../shared/types\").Processor} Processor */\n\nconst debug = createDebug(\"eslintrc:flat-compat\");\nconst cafactory = Symbol(\"cafactory\");\n\n/**\n * Translates an ESLintRC-style config object into a flag-config-style config\n * object.\n * @param {Object} eslintrcConfig An ESLintRC-style config object.\n * @param {Object} options Options to help translate the config.\n * @param {string} options.resolveConfigRelativeTo To the directory to resolve\n * configs from.\n * @param {string} options.resolvePluginsRelativeTo The directory to resolve\n * plugins from.\n * @param {ReadOnlyMap} options.pluginEnvironments A map of plugin environment\n * names to objects.\n * @param {ReadOnlyMap} options.pluginProcessors A map of plugin processor\n * names to objects.\n * @returns {Object} A flag-config-style config object.\n */\nfunction translateESLintRC(eslintrcConfig, {\n resolveConfigRelativeTo,\n resolvePluginsRelativeTo,\n pluginEnvironments,\n pluginProcessors\n}) {\n\n const flatConfig = {};\n const configs = [];\n const languageOptions = {};\n const linterOptions = {};\n const keysToCopy = [\"settings\", \"rules\", \"processor\"];\n const languageOptionsKeysToCopy = [\"globals\", \"parser\", \"parserOptions\"];\n const linterOptionsKeysToCopy = [\"noInlineConfig\", \"reportUnusedDisableDirectives\"];\n\n // check for special settings for eslint:all and eslint:recommended:\n if (eslintrcConfig.settings) {\n if (eslintrcConfig.settings[\"eslint:all\"] === true) {\n return [\"eslint:all\"];\n }\n\n if (eslintrcConfig.settings[\"eslint:recommended\"] === true) {\n return [\"eslint:recommended\"];\n }\n }\n\n // copy over simple translations\n for (const key of keysToCopy) {\n if (key in eslintrcConfig && typeof eslintrcConfig[key] !== \"undefined\") {\n flatConfig[key] = eslintrcConfig[key];\n }\n }\n\n // copy over languageOptions\n for (const key of languageOptionsKeysToCopy) {\n if (key in eslintrcConfig && typeof eslintrcConfig[key] !== \"undefined\") {\n\n // create the languageOptions key in the flat config\n flatConfig.languageOptions = languageOptions;\n\n if (key === \"parser\") {\n debug(`Resolving parser '${languageOptions[key]}' relative to ${resolveConfigRelativeTo}`);\n\n if (eslintrcConfig[key].error) {\n throw eslintrcConfig[key].error;\n }\n\n languageOptions[key] = eslintrcConfig[key].definition;\n continue;\n }\n\n // clone any object values that are in the eslintrc config\n if (eslintrcConfig[key] && typeof eslintrcConfig[key] === \"object\") {\n languageOptions[key] = {\n ...eslintrcConfig[key]\n };\n } else {\n languageOptions[key] = eslintrcConfig[key];\n }\n }\n }\n\n // copy over linterOptions\n for (const key of linterOptionsKeysToCopy) {\n if (key in eslintrcConfig && typeof eslintrcConfig[key] !== \"undefined\") {\n flatConfig.linterOptions = linterOptions;\n linterOptions[key] = eslintrcConfig[key];\n }\n }\n\n // move ecmaVersion a level up\n if (languageOptions.parserOptions) {\n\n if (\"ecmaVersion\" in languageOptions.parserOptions) {\n languageOptions.ecmaVersion = languageOptions.parserOptions.ecmaVersion;\n delete languageOptions.parserOptions.ecmaVersion;\n }\n\n if (\"sourceType\" in languageOptions.parserOptions) {\n languageOptions.sourceType = languageOptions.parserOptions.sourceType;\n delete languageOptions.parserOptions.sourceType;\n }\n\n // check to see if we even need parserOptions anymore and remove it if not\n if (Object.keys(languageOptions.parserOptions).length === 0) {\n delete languageOptions.parserOptions;\n }\n }\n\n // overrides\n if (eslintrcConfig.criteria) {\n flatConfig.files = [absoluteFilePath => eslintrcConfig.criteria.test(absoluteFilePath)];\n }\n\n // translate plugins\n if (eslintrcConfig.plugins && typeof eslintrcConfig.plugins === \"object\") {\n debug(`Translating plugins: ${eslintrcConfig.plugins}`);\n\n flatConfig.plugins = {};\n\n for (const pluginName of Object.keys(eslintrcConfig.plugins)) {\n\n debug(`Translating plugin: ${pluginName}`);\n debug(`Resolving plugin '${pluginName} relative to ${resolvePluginsRelativeTo}`);\n\n const { definition: plugin, error } = eslintrcConfig.plugins[pluginName];\n\n if (error) {\n throw error;\n }\n\n flatConfig.plugins[pluginName] = plugin;\n\n // create a config for any processors\n if (plugin.processors) {\n for (const processorName of Object.keys(plugin.processors)) {\n if (processorName.startsWith(\".\")) {\n debug(`Assigning processor: ${pluginName}/${processorName}`);\n\n configs.unshift({\n files: [`**/*${processorName}`],\n processor: pluginProcessors.get(`${pluginName}/${processorName}`)\n });\n }\n\n }\n }\n }\n }\n\n // translate env - must come after plugins\n if (eslintrcConfig.env && typeof eslintrcConfig.env === \"object\") {\n for (const envName of Object.keys(eslintrcConfig.env)) {\n\n // only add environments that are true\n if (eslintrcConfig.env[envName]) {\n debug(`Translating environment: ${envName}`);\n\n if (environments.has(envName)) {\n\n // built-in environments should be defined first\n configs.unshift(...translateESLintRC(environments.get(envName), {\n resolveConfigRelativeTo,\n resolvePluginsRelativeTo\n }));\n } else if (pluginEnvironments.has(envName)) {\n\n // if the environment comes from a plugin, it should come after the plugin config\n configs.push(...translateESLintRC(pluginEnvironments.get(envName), {\n resolveConfigRelativeTo,\n resolvePluginsRelativeTo\n }));\n }\n }\n }\n }\n\n // only add if there are actually keys in the config\n if (Object.keys(flatConfig).length > 0) {\n configs.push(flatConfig);\n }\n\n return configs;\n}\n\n\n//-----------------------------------------------------------------------------\n// Exports\n//-----------------------------------------------------------------------------\n\n/**\n * A compatibility class for working with configs.\n */\nclass FlatCompat {\n\n constructor({\n baseDirectory = process.cwd(),\n resolvePluginsRelativeTo = baseDirectory\n } = {}) {\n this.baseDirectory = baseDirectory;\n this.resolvePluginsRelativeTo = resolvePluginsRelativeTo;\n this[cafactory] = new ConfigArrayFactory({\n cwd: baseDirectory,\n resolvePluginsRelativeTo,\n getEslintAllConfig: () => ({ settings: { \"eslint:all\": true } }),\n getEslintRecommendedConfig: () => ({ settings: { \"eslint:recommended\": true } })\n });\n }\n\n /**\n * Translates an ESLintRC-style config into a flag-config-style config.\n * @param {Object} eslintrcConfig The ESLintRC-style config object.\n * @returns {Object} A flag-config-style config object.\n */\n config(eslintrcConfig) {\n const eslintrcArray = this[cafactory].create(eslintrcConfig, {\n basePath: this.baseDirectory\n });\n\n const flatArray = [];\n let hasIgnorePatterns = false;\n\n eslintrcArray.forEach(configData => {\n if (configData.type === \"config\") {\n hasIgnorePatterns = hasIgnorePatterns || configData.ignorePattern;\n flatArray.push(...translateESLintRC(configData, {\n resolveConfigRelativeTo: path.join(this.baseDirectory, \"__placeholder.js\"),\n resolvePluginsRelativeTo: path.join(this.resolvePluginsRelativeTo, \"__placeholder.js\"),\n pluginEnvironments: eslintrcArray.pluginEnvironments,\n pluginProcessors: eslintrcArray.pluginProcessors\n }));\n }\n });\n\n // combine ignorePatterns to emulate ESLintRC behavior better\n if (hasIgnorePatterns) {\n flatArray.unshift({\n ignores: [filePath => {\n\n // Compute the final config for this file.\n // This filters config array elements by `files`/`excludedFiles` then merges the elements.\n const finalConfig = eslintrcArray.extractConfig(filePath);\n\n // Test the `ignorePattern` properties of the final config.\n return Boolean(finalConfig.ignores) && finalConfig.ignores(filePath);\n }]\n });\n }\n\n return flatArray;\n }\n\n /**\n * Translates the `env` section of an ESLintRC-style config.\n * @param {Object} envConfig The `env` section of an ESLintRC config.\n * @returns {Object} A flag-config object representing the environments.\n */\n env(envConfig) {\n return this.config({\n env: envConfig\n });\n }\n\n /**\n * Translates the `extends` section of an ESLintRC-style config.\n * @param {...string} configsToExtend The names of the configs to load.\n * @returns {Object} A flag-config object representing the config.\n */\n extends(...configsToExtend) {\n return this.config({\n extends: configsToExtend\n });\n }\n\n /**\n * Translates the `plugins` section of an ESLintRC-style config.\n * @param {...string} plugins The names of the plugins to load.\n * @returns {Object} A flag-config object representing the plugins.\n */\n plugins(...plugins) {\n return this.config({\n plugins\n });\n }\n}\n\nexport { FlatCompat };\n","/**\n * @fileoverview Package exports for @eslint/eslintrc\n * @author Nicholas C. Zakas\n */\n//------------------------------------------------------------------------------\n// Requirements\n//------------------------------------------------------------------------------\n\nimport {\n ConfigArrayFactory,\n createContext as createConfigArrayFactoryContext\n} from \"./config-array-factory.js\";\n\nimport { CascadingConfigArrayFactory } from \"./cascading-config-array-factory.js\";\nimport * as ModuleResolver from \"./shared/relative-module-resolver.js\";\nimport { ConfigArray, getUsedExtractedConfigs } from \"./config-array/index.js\";\nimport { ConfigDependency } from \"./config-array/config-dependency.js\";\nimport { ExtractedConfig } from \"./config-array/extracted-config.js\";\nimport { IgnorePattern } from \"./config-array/ignore-pattern.js\";\nimport { OverrideTester } from \"./config-array/override-tester.js\";\nimport * as ConfigOps from \"./shared/config-ops.js\";\nimport ConfigValidator from \"./shared/config-validator.js\";\nimport * as naming from \"./shared/naming.js\";\nimport { FlatCompat } from \"./flat-compat.js\";\nimport environments from \"../conf/environments.js\";\n\n//-----------------------------------------------------------------------------\n// Exports\n//-----------------------------------------------------------------------------\n\nconst Legacy = {\n ConfigArray,\n createConfigArrayFactoryContext,\n CascadingConfigArrayFactory,\n ConfigArrayFactory,\n ConfigDependency,\n ExtractedConfig,\n IgnorePattern,\n OverrideTester,\n getUsedExtractedConfigs,\n environments,\n\n // shared\n ConfigOps,\n ConfigValidator,\n ModuleResolver,\n naming\n};\n\nexport {\n\n Legacy,\n\n FlatCompat\n\n};\n"],"names":["debug","debugOrig","path","ignore","assert","internalSlotsMap","util","minimatch","Ajv","globals","BuiltInEnvironments","ConfigOps.normalizeConfigGlobal","Module","require","createRequire","fs","stripComments","importFresh","ModuleResolver.resolve","naming.normalizePackageName","naming.getShorthandName","os","createDebug","createConfigArrayFactoryContext"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAUA;AACA,MAAMA,OAAK,GAAGC,6BAAS,CAAC,yBAAyB,CAAC,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,qBAAqB,CAAC,WAAW,EAAE;AAC5C,IAAI,IAAI,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AAChC;AACA,IAAI,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;AACjD,QAAQ,MAAM,CAAC,GAAG,MAAM,CAAC;AACzB,QAAQ,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;AACjC;AACA;AACA,QAAQ,MAAM,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;AAC7C;AACA;AACA,QAAQ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,UAAU,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC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AAI,uBAAuB;AAC3B,IAAI,YAAY;AAChB;AACA;AACA,IAAI,SAAS;AACb,IAAI,eAAe;AACnB,IAAI,cAAc;AAClB,IAAI,MAAM;AACV;;;;;"} \ No newline at end of file diff --git a/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js b/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js index 4b575c2dc..597352e43 100644 --- a/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js +++ b/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js @@ -250,8 +250,7 @@ class CascadingConfigArrayFactory { configArrayFactory, cwd, rulePaths, - loadRules, - resolver + loadRules }), baseConfigData, cliConfigArray: createCLIConfigArray({ diff --git a/node_modules/@eslint/eslintrc/package.json b/node_modules/@eslint/eslintrc/package.json index bc9989719..ea8a18dcb 100644 --- a/node_modules/@eslint/eslintrc/package.json +++ b/node_modules/@eslint/eslintrc/package.json @@ -1,6 +1,6 @@ { "name": "@eslint/eslintrc", - "version": "1.3.2", + "version": "1.3.3", "description": "The legacy ESLintRC config file format for ESLint", "type": "module", "main": "./dist/eslintrc.cjs", diff --git a/node_modules/@humanwhocodes/config-array/CHANGELOG.md b/node_modules/@humanwhocodes/config-array/CHANGELOG.md index ff37c42cd..23df7c198 100644 --- a/node_modules/@humanwhocodes/config-array/CHANGELOG.md +++ b/node_modules/@humanwhocodes/config-array/CHANGELOG.md @@ -1,5 +1,75 @@ # Changelog +## [0.11.6](https://github.com/humanwhocodes/config-array/compare/v0.11.5...v0.11.6) (2022-10-21) + + +### Bug Fixes + +* Only apply universal patterns if others match. ([e69c8fd](https://github.com/humanwhocodes/config-array/commit/e69c8fdbb7696b406821bc723b86b4c5304c4260)) + +## [0.11.5](https://github.com/humanwhocodes/config-array/compare/v0.11.4...v0.11.5) (2022-10-17) + + +### Bug Fixes + +* Unignoring of directories should work ([e1c9dcd](https://github.com/humanwhocodes/config-array/commit/e1c9dcd05534619effe258596191ea9dc5bb37af)) + +## [0.11.4](https://github.com/humanwhocodes/config-array/compare/v0.11.3...v0.11.4) (2022-10-14) + + +### Bug Fixes + +* Ensure subdirectories of ignored directories are ignored ([0df450e](https://github.com/humanwhocodes/config-array/commit/0df450eabeb595ae22fe680ce3320dc47edb1e66)) + +## [0.11.3](https://github.com/humanwhocodes/config-array/compare/v0.11.2...v0.11.3) (2022-10-13) + + +### Bug Fixes + +* Ensure directories can be unignored. ([206404c](https://github.com/humanwhocodes/config-array/commit/206404c490d354a4f39ef9b4a6d0ceaec119abc5)) + +## [0.11.2](https://github.com/humanwhocodes/config-array/compare/v0.11.1...v0.11.2) (2022-10-03) + + +### Bug Fixes + +* Error conditions for isDirectoryIgnored ([0bd81f5](https://github.com/humanwhocodes/config-array/commit/0bd81f53b7c217d561f70709057c7d77f17e8c6d)) +* isDirectoryIgnored should match on relative path. ([3d1eaf6](https://github.com/humanwhocodes/config-array/commit/3d1eaf6389056215e27793cde9c2954c01c78df8)) +* isFileIgnored should call isDirectoryIgnored ([270d359](https://github.com/humanwhocodes/config-array/commit/270d359295f376edb0c73905f62a848284d34053)) + + +### Performance Improvements + +* Cache isDirectoryIgnored calls ([c5e6720](https://github.com/humanwhocodes/config-array/commit/c5e67208618e253c08bd320efeae4b1f63641e63)) + +## [0.11.1](https://github.com/humanwhocodes/config-array/compare/v0.11.0...v0.11.1) (2022-09-30) + + +### Bug Fixes + +* isDirectoryIgnored should not test negated patterns ([f6cdb68](https://github.com/humanwhocodes/config-array/commit/f6cdb688784901970fda72eb688eb1a00c44b09a)) + +## [0.11.0](https://github.com/humanwhocodes/config-array/compare/v0.10.7...v0.11.0) (2022-09-30) + + +### Features + +* Add isDirectoryIgnored; deprecated isIgnored ([e6942f2](https://github.com/humanwhocodes/config-array/commit/e6942f2ce075007d39f23530593b7adb19178a52)) + +## [0.10.7](https://github.com/humanwhocodes/config-array/compare/v0.10.6...v0.10.7) (2022-09-29) + + +### Bug Fixes + +* Cache negated patterns separately ([fef617b](https://github.com/humanwhocodes/config-array/commit/fef617b6999f9a4b5871d4525c82c4181bc96fb7)) + +## [0.10.6](https://github.com/humanwhocodes/config-array/compare/v0.10.5...v0.10.6) (2022-09-28) + + +### Performance Improvements + +* Cache Minimatch instances ([5cf9af7](https://github.com/humanwhocodes/config-array/commit/5cf9af7ecaf227d2106be0cebd92d7f5148867e6)) + ## [0.10.5](https://github.com/humanwhocodes/config-array/compare/v0.10.4...v0.10.5) (2022-09-21) diff --git a/node_modules/@humanwhocodes/config-array/README.md b/node_modules/@humanwhocodes/config-array/README.md index 3e24dfe6e..d64784c17 100644 --- a/node_modules/@humanwhocodes/config-array/README.md +++ b/node_modules/@humanwhocodes/config-array/README.md @@ -288,7 +288,39 @@ A few things to keep in mind: * You must pass in the absolute filename to get a config for. * The returned config object never has `files`, `ignores`, or `name` properties; the only properties on the object will be the other configuration options specified. * The config array caches configs, so subsequent calls to `getConfig()` with the same filename will return in a fast lookup rather than another calculation. -* A config will only be generated if the filename matches an entry in a `files` key. A config will not be generated without matching a `files` key (configs without a `files` key are only applied when another config with a `files` key is applied; configs without `files` are never applied on their own). +* A config will only be generated if the filename matches an entry in a `files` key. A config will not be generated without matching a `files` key (configs without a `files` key are only applied when another config with a `files` key is applied; configs without `files` are never applied on their own). Any config with a `files` key entry ending with `/**` or `/*` will only be applied if another entry in the same `files` key matches or another config matches. + +## Determining Ignored Paths + +You can determine if a file is ignored by using the `isFileIgnored()` method and passing in the absolute path of any file, as in this example: + +```js +const ignored = configs.isFileIgnored('/foo/bar/baz.txt'); +``` + +A file is considered ignored if any of the following is true: + +* **It's parent directory is ignored.** For example, if `foo` is in `ignores`, then `foo/a.js` is considered ignored. +* **It has an ancestor directory that is ignored.** For example, if `foo` is in `ignores`, then `foo/baz/a.js` is considered ignored. +* **It matches an ignored file pattern.** For example, if `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored. +* **If it matches an entry in `files` and also in `ignores`.** For example, if `**/*.js` is in `files` and `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored. +* **The file is outside the `basePath`.** If the `basePath` is `/usr/me`, then `/foo/a.js` is considered ignored. + +For directories, use the `isDirectoryIgnored()` method and pass in the absolute path of any directory, as in this example: + +```js +const ignored = configs.isDirectoryIgnored('/foo/bar/'); +``` + +A directory is considered ignored if any of the following is true: + +* **It's parent directory is ignored.** For example, if `foo` is in `ignores`, then `foo/baz` is considered ignored. +* **It has an ancestor directory that is ignored.** For example, if `foo` is in `ignores`, then `foo/bar/baz/a.js` is considered ignored. +* **It matches and ignored file pattern.** For example, if `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored. +* **If it matches an entry in `files` and also in `ignores`.** For example, if `**/*.js` is in `files` and `**/a.js` is in `ignores`, then `foo/a.js` and `foo/baz/a.js` are considered ignored. +* **The file is outside the `basePath`.** If the `basePath` is `/usr/me`, then `/foo/a.js` is considered ignored. + +**Important:** A pattern such as `foo/**` means that `foo` and `foo/` are *not* ignored whereas `foo/bar` is ignored. If you want to ignore `foo` and all of its subdirectories, use the pattern `foo` or `foo/` in `ignores`. ## Caching Mechanisms diff --git a/node_modules/@humanwhocodes/config-array/api.js b/node_modules/@humanwhocodes/config-array/api.js index c0d58fc4a..2b1945ac8 100644 --- a/node_modules/@humanwhocodes/config-array/api.js +++ b/node_modules/@humanwhocodes/config-array/api.js @@ -103,6 +103,9 @@ const baseSchema = Object.freeze({ // Helpers //------------------------------------------------------------------------------ +const Minimatch = minimatch.Minimatch; +const minimatchCache = new Map(); +const negatedMinimatchCache = new Map(); const debug = createDebug('@hwc/config-array'); const MINIMATCH_OPTIONS = { @@ -121,6 +124,44 @@ function isString(value) { return typeof value === 'string'; } +/** + * Asserts that the files key of a config object is a nonempty array. + * @param {object} config The config object to check. + * @returns {void} + * @throws {TypeError} If the files key isn't a nonempty array. + */ +function assertNonEmptyFilesArray(config) { + if (!Array.isArray(config.files) || config.files.length === 0) { + throw new TypeError('The files key must be a non-empty array.'); + } +} + +/** + * Wrapper around minimatch that caches minimatch patterns for + * faster matching speed over multiple file path evaluations. + * @param {string} filepath The file path to match. + * @param {string} pattern The glob pattern to match against. + * @param {object} options The minimatch options to use. + * @returns + */ +function doMatch(filepath, pattern, options = {}) { + + let cache = minimatchCache; + + if (options.flipNegate) { + cache = negatedMinimatchCache; + } + + let matcher = cache.get(pattern); + + if (!matcher) { + matcher = new Minimatch(pattern, Object.assign({}, MINIMATCH_OPTIONS, options)); + cache.set(pattern, matcher); + } + + return matcher.match(filepath); +} + /** * Normalizes a `ConfigArray` by flattening it and executing any functions * that are found inside. @@ -231,51 +272,42 @@ function normalizeSync(items, context, extraConfigTypes) { * @param {string} relativeFilePath The relative path of the file to check. * @returns {boolean} True if the path should be ignored and false if not. */ -function shouldIgnoreFilePath(ignores, filePath, relativeFilePath) { +function shouldIgnorePath(ignores, filePath, relativeFilePath) { // all files outside of the basePath are ignored if (relativeFilePath.startsWith('..')) { return true; } - let shouldIgnore = false; - - for (const matcher of ignores) { + return ignores.reduce((ignored, matcher) => { - if (typeof matcher === 'function') { - shouldIgnore = shouldIgnore || matcher(filePath); - continue; - } + if (!ignored) { - /* - * If there's a negated pattern, that means anything matching - * must NOT be ignored. To do that, we need to use the `flipNegate` - * option for minimatch to check if the filepath matches the - * pattern specified after the !, and if that result is true, - * then we return false immediately because this file should - * never be ignored. - */ - if (matcher.startsWith('!')) { + if (typeof matcher === 'function') { + return matcher(filePath); + } - /* - * The file must already be ignored in order to apply a negated - * pattern, because negated patterns simply remove files that - * would already be ignored. - */ - if (shouldIgnore && - minimatch(relativeFilePath, matcher, { - ...MINIMATCH_OPTIONS, - flipNegate: true - })) { - return false; + // don't check negated patterns because we're not ignored yet + if (!matcher.startsWith('!')) { + return doMatch(relativeFilePath, matcher); } - } else { - shouldIgnore = shouldIgnore || minimatch(relativeFilePath, matcher, MINIMATCH_OPTIONS); + + // otherwise we're still not ignored + return false; + } - } + // only need to check negated patterns because we're ignored + if (typeof matcher === 'string' && matcher.startsWith('!')) { + return !doMatch(relativeFilePath, matcher, { + flipNegate: true + }); + } + + return ignored; + + }, false); - return shouldIgnore; } /** @@ -298,15 +330,13 @@ function pathMatches(filePath, basePath, config) { const relativeFilePath = path.relative(basePath, filePath); // if files isn't an array, throw an error - if (!Array.isArray(config.files) || config.files.length === 0) { - throw new TypeError('The files key must be a non-empty array.'); - } + assertNonEmptyFilesArray(config); // match both strings and functions const match = pattern => { if (isString(pattern)) { - return minimatch(relativeFilePath, pattern, MINIMATCH_OPTIONS); + return doMatch(relativeFilePath, pattern); } if (typeof pattern === 'function') { @@ -330,7 +360,7 @@ function pathMatches(filePath, basePath, config) { * if there are any files to ignore. */ if (filePathMatchesPattern && config.ignores) { - filePathMatchesPattern = !shouldIgnoreFilePath(config.ignores, filePath, relativeFilePath); + filePathMatchesPattern = !shouldIgnorePath(config.ignores, filePath, relativeFilePath); } return filePathMatchesPattern; @@ -400,11 +430,11 @@ class ConfigArray extends Array { * @param {Array} [options.configTypes] List of config types supported. */ constructor(configs, { - basePath = '', - normalized = false, - schema: customSchema, - extraConfigTypes = [] - } = {} + basePath = '', + normalized = false, + schema: customSchema, + extraConfigTypes = [] + } = {} ) { super(); @@ -452,7 +482,12 @@ class ConfigArray extends Array { this[ConfigArraySymbol.configCache] = new Map(); // init cache - dataCache.set(this, { explicitMatches: new Map() }); + dataCache.set(this, { + explicitMatches: new Map(), + directoryMatches: new Map(), + files: undefined, + ignores: undefined + }); // load the configs into this array if (Array.isArray(configs)) { @@ -541,7 +576,38 @@ class ConfigArray extends Array { * are additional keys, then ignores act like exclusions. */ if (config.ignores && Object.keys(config).length === 1) { - result.push(...config.ignores); + + /* + * If there are directory ignores, then we need to double up + * the patterns to be ignored. For instance, `foo` will also + * need `foo/**` in order to account for subdirectories. + */ + config.ignores.forEach(ignore => { + + result.push(ignore); + + if (typeof ignore === 'string') { + + // unignoring files won't work unless we unignore directories too + if (ignore.startsWith('!')) { + + if (ignore.endsWith('/**')) { + result.push(ignore.slice(0, ignore.length - 3)); + } else if (ignore.endsWith('/*')) { + result.push(ignore.slice(0, ignore.length - 2)); + } + } + + // directories should work with or without a trailing slash + if (ignore.endsWith('/')) { + result.push(ignore.slice(0, ignore.length - 1)); + result.push(ignore + '**'); + } else if (!ignore.endsWith('*')) { + result.push(ignore + '/**'); + } + + } + }); } } @@ -649,7 +715,7 @@ class ConfigArray extends Array { // TODO: Maybe move elsewhere? Maybe combine with getConfig() logic? const relativeFilePath = path.relative(this.basePath, filePath); - if (shouldIgnoreFilePath(this.ignores, filePath, relativeFilePath)) { + if (shouldIgnorePath(this.ignores, filePath, relativeFilePath)) { debug(`Ignoring ${filePath}`); // cache and return result @@ -695,11 +761,20 @@ class ConfigArray extends Array { // next check to see if the file should be ignored + // check if this should be ignored due to its directory + if (this.isDirectoryIgnored(path.dirname(filePath))) { + debug(`Ignoring ${filePath} based on directory pattern`); + + // cache and return result - finalConfig is undefined at this point + cache.set(filePath, finalConfig); + return finalConfig; + } + // TODO: Maybe move elsewhere? const relativeFilePath = path.relative(this.basePath, filePath); - if (shouldIgnoreFilePath(this.ignores, filePath, relativeFilePath)) { - debug(`Ignoring ${filePath}`); + if (shouldIgnorePath(this.ignores, filePath, relativeFilePath)) { + debug(`Ignoring ${filePath} based on file pattern`); // cache and return result - finalConfig is undefined at this point cache.set(filePath, finalConfig); @@ -710,15 +785,70 @@ class ConfigArray extends Array { const matchingConfigIndices = []; let matchFound = false; + const universalPattern = /\/\*{1,2}$/; this.forEach((config, index) => { if (!config.files) { - debug(`Universal config found for ${filePath}`); + debug(`Anonymous universal config found for ${filePath}`); matchingConfigIndices.push(index); return; } + assertNonEmptyFilesArray(config); + + /* + * If a config has a files pattern ending in /** or /*, and the + * filePath only matches those patterns, then the config is only + * applied if there is another config where the filePath matches + * a file with a specific extensions such as *.js. + */ + + const universalFiles = config.files.filter( + pattern => universalPattern.test(pattern) + ); + + // universal patterns were found so we need to check the config twice + if (universalFiles.length) { + + debug('Universal files patterns found. Checking carefully.'); + + const nonUniversalFiles = config.files.filter( + pattern => !universalPattern.test(pattern) + ); + + // check that the config matches without the non-universal files first + if ( + nonUniversalFiles.length && + pathMatches( + filePath, this.basePath, + { files: nonUniversalFiles, ignores: config.ignores } + ) + ) { + debug(`Matching config found for ${filePath}`); + matchingConfigIndices.push(index); + matchFound = true; + return; + } + + // if there wasn't a match then check if it matches with universal files + if ( + universalFiles.length && + pathMatches( + filePath, this.basePath, + { files: universalFiles, ignores: config.ignores } + ) + ) { + debug(`Matching config found for ${filePath}`); + matchingConfigIndices.push(index); + return; + } + + // if we make here, then there was no match + return; + } + + // the normal case if (pathMatches(filePath, this.basePath, config)) { debug(`Matching config found for ${filePath}`); matchingConfigIndices.push(index); @@ -766,11 +896,60 @@ class ConfigArray extends Array { * Determines if the given filepath is ignored based on the configs. * @param {string} filePath The complete path of a file to check. * @returns {boolean} True if the path is ignored, false if not. + * @deprecated Use `isFileIgnored` instead. */ isIgnored(filePath) { + return this.isFileIgnored(filePath); + } + + /** + * Determines if the given filepath is ignored based on the configs. + * @param {string} filePath The complete path of a file to check. + * @returns {boolean} True if the path is ignored, false if not. + */ + isFileIgnored(filePath) { return this.getConfig(filePath) === undefined; } + /** + * Determines if the given directory is ignored based on the configs. + * This checks only default `ignores` that don't have `files` in the + * same config. A pattern such as `/foo` be considered to ignore the directory + * while a pattern such as `/foo/**` is not considered to ignore the + * directory because it is matching files. + * @param {string} directoryPath The complete path of a directory to check. + * @returns {boolean} True if the directory is ignored, false if not. Will + * return true for any directory that is not inside of `basePath`. + * @throws {Error} When the `ConfigArray` is not normalized. + */ + isDirectoryIgnored(directoryPath) { + + assertNormalized(this); + + const relativeDirectoryPath = path.relative(this.basePath, directoryPath); + if (relativeDirectoryPath.startsWith('..')) { + return true; + } + + // first check the cache + const cache = dataCache.get(this).directoryMatches; + + if (cache.has(relativeDirectoryPath)) { + return cache.get(relativeDirectoryPath); + } + + // first check non-/** paths + const result = shouldIgnorePath( + this.ignores, //.filter(matcher => typeof matcher === "function" || !matcher.endsWith("/**")), + directoryPath, + relativeDirectoryPath + ); + + cache.set(relativeDirectoryPath, result); + + return result; + } + } exports.ConfigArray = ConfigArray; diff --git a/node_modules/@humanwhocodes/config-array/package.json b/node_modules/@humanwhocodes/config-array/package.json index 0d0a37144..cb4c0a6b5 100644 --- a/node_modules/@humanwhocodes/config-array/package.json +++ b/node_modules/@humanwhocodes/config-array/package.json @@ -1,6 +1,6 @@ { "name": "@humanwhocodes/config-array", - "version": "0.10.5", + "version": "0.11.6", "description": "Glob-based configuration matching.", "author": "Nicholas C. Zakas", "main": "api.js", @@ -19,6 +19,7 @@ "build": "rollup -c", "format": "nitpik", "lint": "eslint *.config.js src/*.js tests/*.js", + "lint:fix": "eslint --fix *.config.js src/*.js tests/*.js", "prepublish": "npm run build", "test:coverage": "nyc --include src/*.js npm run test", "test": "mocha -r esm tests/ --recursive" @@ -48,8 +49,8 @@ "devDependencies": { "@nitpik/javascript": "0.4.0", "@nitpik/node": "0.0.5", - "chai": "4.2.0", - "eslint": "8.23.1", + "chai": "4.3.6", + "eslint": "8.25.0", "esm": "3.2.25", "lint-staged": "13.0.3", "mocha": "6.2.3", diff --git a/node_modules/@humanwhocodes/gitignore-to-minimatch/LICENSE b/node_modules/@humanwhocodes/gitignore-to-minimatch/LICENSE deleted file mode 100644 index 261eeb9e9..000000000 --- a/node_modules/@humanwhocodes/gitignore-to-minimatch/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/@humanwhocodes/gitignore-to-minimatch/README.md b/node_modules/@humanwhocodes/gitignore-to-minimatch/README.md deleted file mode 100644 index 1f457a596..000000000 --- a/node_modules/@humanwhocodes/gitignore-to-minimatch/README.md +++ /dev/null @@ -1,78 +0,0 @@ -# Gitignore to Minimatch Utility - -by [Nicholas C. Zakas](https://humanwhocodes.com) - -If you find this useful, please consider supporting my work with a [donation](https://humanwhocodes.com/donate). - -## Description - -A function that converts a [gitignore](https://git-scm.com/docs/gitignore#_pattern_format) pattern into a [minimatch](https://github.com/isaacs/minimatch) pattern. There are subtle differences between these two formats, and depending on the utilities you're using, you may need one or the other. - -## Usage - -### Node.js - -Install using [npm][npm] or [yarn][yarn]: - -``` -npm install @humanwhocodes/gitignore-to-minimatch --save - -# or - -yarn add @humanwhocodes/gitignore-to-minimatch -``` - -Import into your Node.js project: - -```js -// CommonJS -const { gitignoreToMinimatch } = require("@humanwhocodes/gitignore-to-minimatch"); - -// ESM -import { gitignoreToMinimatch } from "@humanwhocodes/gitignore-to-minimatch"; -``` - -### Deno - -Import into your Deno project: - -```js -import { gitignoreToMinimatch } from "https://cdn.skypack.dev/@humanwhocodes/gitignore-to-minimatch?dts"; -``` - -### Browser - -It's recommended to import the minified version to save bandwidth: - -```js -import { gitignoreToMinimatch } from "https://cdn.skypack.dev/@humanwhocodes/gitignore-to-minimatch?min"; -``` - -However, you can also import the unminified version for debugging purposes: - -```js -import { gitignoreToMinimatch } from "https://cdn.skypack.dev/@humanwhocodes/gitignore-to-minimatch"; -``` - -## API - -After importing, call `gitignoreToMinimatch` with a string argument, like this: - -```js -const minimatchPattern = gitignoreToMinimatch("foo"); -console.log(minimatchPattern); // "**/foo" -``` - -## Developer Setup - -1. Fork the repository -2. Clone your fork -3. Run `npm install` to setup dependencies -4. Run `npm test` to run tests - -## License - -Apache 2.0 - -[npm]: https://npmjs.com/ -[yarn]: https://yarnpkg.com/ diff --git a/node_modules/@humanwhocodes/gitignore-to-minimatch/dist/gitignore-to-minimatch.cjs b/node_modules/@humanwhocodes/gitignore-to-minimatch/dist/gitignore-to-minimatch.cjs deleted file mode 100644 index 110bb2d59..000000000 --- a/node_modules/@humanwhocodes/gitignore-to-minimatch/dist/gitignore-to-minimatch.cjs +++ /dev/null @@ -1,71 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -/** - * @fileoverview Utility to convert gitignore patterns to minimatch. - * @author Nicholas C. Zakas - */ - -/** - * Converts a gitignore pattern to a minimatch pattern. - * @param {string} pattern The gitignore pattern to convert. - * @returns {string} A minimatch pattern equivalent to `pattern`. - */ -function gitignoreToMinimatch(pattern) { - - if (typeof pattern !== "string") { - throw new TypeError("Argument must be a string."); - } - - // Special case: Empty string - if (!pattern) { - return pattern; - } - - // strip off negation to make life easier - const negated = pattern.startsWith("!"); - let patternToTest = negated ? pattern.slice(1) : pattern; - let result = patternToTest; - let leadingSlash = false; - - // strip off leading slash - if (patternToTest[0] === "/") { - leadingSlash = true; - result = patternToTest.slice(1); - } - - // For the most part, the first character determines what to do - switch (result[0]) { - - case "*": - if (patternToTest[1] !== "*") { - result = "**/" + result; - } - break; - - default: - if (!leadingSlash && !result.includes("/") || result.endsWith("/")) { - result = "**/" + result; - } - - // no further changes if the pattern ends with a wildcard - if (result.endsWith("*") || result.endsWith("?")) { - break; - } - - // differentiate between filenames and directory names - if (!/\.[a-z\d_-]+$/.test(result)) { - if (!result.endsWith("/")) { - result += "/"; - } - - result += "**"; - } - } - - return negated ? "!" + result : result; - -} - -exports.gitignoreToMinimatch = gitignoreToMinimatch; diff --git a/node_modules/@humanwhocodes/gitignore-to-minimatch/dist/gitignore-to-minimatch.d.ts b/node_modules/@humanwhocodes/gitignore-to-minimatch/dist/gitignore-to-minimatch.d.ts deleted file mode 100644 index 921272ce5..000000000 --- a/node_modules/@humanwhocodes/gitignore-to-minimatch/dist/gitignore-to-minimatch.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -/** - * @fileoverview Utility to convert gitignore patterns to minimatch. - * @author Nicholas C. Zakas - */ -/** - * Converts a gitignore pattern to a minimatch pattern. - * @param {string} pattern The gitignore pattern to convert. - * @returns {string} A minimatch pattern equivalent to `pattern`. - */ -export function gitignoreToMinimatch(pattern: string): string; diff --git a/node_modules/@humanwhocodes/gitignore-to-minimatch/dist/gitignore-to-minimatch.js b/node_modules/@humanwhocodes/gitignore-to-minimatch/dist/gitignore-to-minimatch.js deleted file mode 100644 index 8c4d1710d..000000000 --- a/node_modules/@humanwhocodes/gitignore-to-minimatch/dist/gitignore-to-minimatch.js +++ /dev/null @@ -1,67 +0,0 @@ -/** - * @fileoverview Utility to convert gitignore patterns to minimatch. - * @author Nicholas C. Zakas - */ - -/** - * Converts a gitignore pattern to a minimatch pattern. - * @param {string} pattern The gitignore pattern to convert. - * @returns {string} A minimatch pattern equivalent to `pattern`. - */ -function gitignoreToMinimatch(pattern) { - - if (typeof pattern !== "string") { - throw new TypeError("Argument must be a string."); - } - - // Special case: Empty string - if (!pattern) { - return pattern; - } - - // strip off negation to make life easier - const negated = pattern.startsWith("!"); - let patternToTest = negated ? pattern.slice(1) : pattern; - let result = patternToTest; - let leadingSlash = false; - - // strip off leading slash - if (patternToTest[0] === "/") { - leadingSlash = true; - result = patternToTest.slice(1); - } - - // For the most part, the first character determines what to do - switch (result[0]) { - - case "*": - if (patternToTest[1] !== "*") { - result = "**/" + result; - } - break; - - default: - if (!leadingSlash && !result.includes("/") || result.endsWith("/")) { - result = "**/" + result; - } - - // no further changes if the pattern ends with a wildcard - if (result.endsWith("*") || result.endsWith("?")) { - break; - } - - // differentiate between filenames and directory names - if (!/\.[a-z\d_-]+$/.test(result)) { - if (!result.endsWith("/")) { - result += "/"; - } - - result += "**"; - } - } - - return negated ? "!" + result : result; - -} - -export { gitignoreToMinimatch }; diff --git a/node_modules/@humanwhocodes/gitignore-to-minimatch/package.json b/node_modules/@humanwhocodes/gitignore-to-minimatch/package.json deleted file mode 100644 index 3a6ea6b03..000000000 --- a/node_modules/@humanwhocodes/gitignore-to-minimatch/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "@humanwhocodes/gitignore-to-minimatch", - "version": "1.0.2", - "description": "Utility to convert gitignore patterns to minimatch patterns", - "type": "module", - "main": "dist/gitignore-to-minimatch.cjs", - "module": "dist/gitignore-to-minimatch.js", - "types": "dist/gitignore-to-minimatch.d.ts", - "exports": { - "require": "./dist/gitignore-to-minimatch.cjs", - "import": "./dist/gitignore-to-minimatch.js" - }, - "files": [ - "dist" - ], - "publishConfig": { - "access": "public" - }, - "gitHooks": { - "pre-commit": "lint-staged" - }, - "lint-staged": { - "*.js": [ - "eslint --fix" - ] - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - }, - "scripts": { - "build": "rollup -c && tsc", - "prepare": "npm run build", - "lint": "eslint src/ tests/", - "lint:fix": "eslint src/ tests/", - "pretest": "npm run build", - "test:unit": "mocha tests/gitignore-to-minimatch.test.js", - "test:build": "node tests/pkg.test.cjs && node tests/pkg.test.mjs", - "test": "npm run test:unit && npm run test:build" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/humanwhocodes/gitignore-to-minimatch.git" - }, - "keywords": [ - "gitignore", - "minimatch", - "glob" - ], - "author": "Nicholas C. Zaks", - "license": "Apache-2.0", - "devDependencies": { - "chai": "^4.3.4", - "eslint": "^7.32.0", - "lint-staged": "^10.4.0", - "mocha": "^9.0.3", - "rollup": "^1.20.3", - "typescript": "^4.0.3", - "yorkie": "^2.0.0" - } -} diff --git a/node_modules/@relative-ci/agent/README.md b/node_modules/@relative-ci/agent/README.md index 2d0214446..a5252a41b 100644 --- a/node_modules/@relative-ci/agent/README.md +++ b/node_modules/@relative-ci/agent/README.md @@ -6,7 +6,7 @@ [![npm](https://img.shields.io/npm/v/@relative-ci/agent.svg)](https://www.npmjs.com/package/@relative-ci/agent) [![node version](https://img.shields.io/node/v/@relative-ci/agent.svg)](https://www.npmjs.com/package/@relative-ci/agent) -[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/relative-ci/agent.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/relative-ci/agent/context:javascript) +[![CodeQL](https://github.com/relative-ci/agent/actions/workflows/codeql.yml/badge.svg)](https://github.com/relative-ci/agent/actions/workflows/codeql.yml) > Send webpack stats and CI build information to [RelativeCI](https://relative-ci.com?utm_source=github-agent). diff --git a/node_modules/@relative-ci/agent/lib/agent.js b/node_modules/@relative-ci/agent/lib/agent.js index a491bf406..316beee5f 100644 --- a/node_modules/@relative-ci/agent/lib/agent.js +++ b/node_modules/@relative-ci/agent/lib/agent.js @@ -4,45 +4,32 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.agent = void 0; - var _dotenv = _interopRequireDefault(require("dotenv")); - var _lodash = require("lodash"); - var _pluginWebpackFilter = _interopRequireDefault(require("@bundle-stats/plugin-webpack-filter")); - var _package = _interopRequireDefault(require("../package.json")); - var LOCALES = _interopRequireWildcard(require("../locales/en")); - var _send = _interopRequireDefault(require("./send")); - var _utils = require("./utils"); - function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - const DEFAULT_ENDPOINT = 'https://api.relative-ci.com/save'; const WEBPACK_STATS = 'webpack.stats'; const SOURCE_EXTRACTORS = { [WEBPACK_STATS]: _pluginWebpackFilter.default }; - const getFilteredData = artifactsData => artifactsData.reduce((agg, { key, data, options }) => (0, _lodash.set)(agg, key, SOURCE_EXTRACTORS[key](data, options)), {}); - const agent = (artifactsData, config, args = {}, logger = console) => { _dotenv.default.config(); - const envCIVars = (0, _utils.getEnvCI)(); - (0, _utils.debug)('env-ci environment variables', envCIVars); // Resolved params + (0, _utils.debug)('env-ci environment variables', envCIVars); + // Resolved params const envVars = { slug: args.slug || process.env.RELATIVE_CI_SLUG || envCIVars.slug, // env-ci is reporting the branch of the PR as prBranch @@ -70,27 +57,24 @@ const agent = (artifactsData, config, args = {}, logger = console) => { commitMessage: (0, _utils.getCommitMessage)() }) }; - (0, _utils.debug)('Job parameters', params); // Validate parameters + (0, _utils.debug)('Job parameters', params); + // Validate parameters if (!params.key) { return logger.warn(LOCALES.AGENT_MISSING_KEY_ERROR); } - if (!params.slug) { return logger.warn(LOCALES.AGENT_MISSING_SLUG_ERROR); } - if (!params.commit) { return logger.warn(LOCALES.AGENT_MISSING_COMMIT_ERROR); } - if (!params.branch) { return logger.warn(LOCALES.AGENT_MISSING_BRANCH_ERROR); - } // Filter only the necessary data - + } + // Filter only the necessary data const filteredData = getFilteredData(artifactsData); return (0, _send.default)(filteredData, params, config, logger); }; - exports.agent = agent; \ No newline at end of file diff --git a/node_modules/@relative-ci/agent/lib/index.js b/node_modules/@relative-ci/agent/lib/index.js index f0266484f..c7274323d 100644 --- a/node_modules/@relative-ci/agent/lib/index.js +++ b/node_modules/@relative-ci/agent/lib/index.js @@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); - var _agent = require("./agent"); - Object.keys(_agent).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _agent[key]) return; @@ -16,9 +14,7 @@ Object.keys(_agent).forEach(function (key) { } }); }); - var _webpackPlugin = require("./webpack-plugin"); - Object.keys(_webpackPlugin).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (key in exports && exports[key] === _webpackPlugin[key]) return; diff --git a/node_modules/@relative-ci/agent/lib/send.js b/node_modules/@relative-ci/agent/lib/send.js index 5d3554aac..051678ab2 100644 --- a/node_modules/@relative-ci/agent/lib/send.js +++ b/node_modules/@relative-ci/agent/lib/send.js @@ -4,21 +4,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; - require("core-js/modules/es.promise.js"); - var _fs = _interopRequireDefault(require("fs")); - var _lodash = require("lodash"); - var _isomorphicFetch = _interopRequireDefault(require("isomorphic-fetch")); - var _en = _interopRequireDefault(require("../locales/en")); - var _utils = require("./utils"); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var _default = async (data, params, config, logger) => { const { key, @@ -53,24 +45,20 @@ var _default = async (data, params, config, logger) => { } = config; (0, _utils.debug)('Payload', payload); (0, _utils.debug)('Payload size', Buffer.byteLength(JSON.stringify(payload))); - if (payloadFilepath) { logger.info('Save payload to', payloadFilepath); - try { // Obfuscate private data - const output = { ...payload, + const output = { + ...payload, key: '***' }; - _fs.default.writeFileSync(payloadFilepath, JSON.stringify(output, null, 2)); } catch (err) { logger.warn('Error saving payload', err.message); } } - logger.info('Send stats to RelativeCI', `branch=${branch}`, `commit=${commit}`); - try { const response = await (0, _isomorphicFetch.default)(endpoint, { method: 'POST', @@ -81,21 +69,17 @@ var _default = async (data, params, config, logger) => { }); const responseData = await response.json(); (0, _utils.debug)('Response', responseData); - if (responseData.code) { logger.warn(responseData); return; } - const { res } = responseData; - if (!res) { logger.warn(_en.default.GENERIC_ERROR, responseData); return; } - const buildNumber = (0, _lodash.get)(res, 'job.internalBuildNumber'); const buildSizeInfo = (0, _lodash.get)(responseData, 'info.message.txt'); logger.info(`Job #${buildNumber} done.`); @@ -105,5 +89,4 @@ var _default = async (data, params, config, logger) => { (0, _utils.debug)('@relative-ci/agent could not send the data', err); } }; - exports.default = _default; \ No newline at end of file diff --git a/node_modules/@relative-ci/agent/lib/utils.js b/node_modules/@relative-ci/agent/lib/utils.js index 6eccd9a69..719057349 100644 --- a/node_modules/@relative-ci/agent/lib/utils.js +++ b/node_modules/@relative-ci/agent/lib/utils.js @@ -1,16 +1,11 @@ "use strict"; const childProcess = require('child_process'); - const { pick } = require('lodash'); - const envCI = require('env-ci'); - const CI_ENV_VAR_NAMES = ['branch', 'build', 'buildUrl', 'commit', 'isCi', 'pr', 'prBranch', 'service', 'slug']; module.exports.debug = require('debug')('relative-ci:agent'); - module.exports.getCommitMessage = () => childProcess.execSync('git log -1 --pretty=%B').toString().trim(); - module.exports.getEnvCI = () => pick(envCI(), CI_ENV_VAR_NAMES); \ No newline at end of file diff --git a/node_modules/@relative-ci/agent/lib/webpack-plugin.js b/node_modules/@relative-ci/agent/lib/webpack-plugin.js index 80cea6883..d710f9081 100644 --- a/node_modules/@relative-ci/agent/lib/webpack-plugin.js +++ b/node_modules/@relative-ci/agent/lib/webpack-plugin.js @@ -4,21 +4,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.RelativeCiAgentWebpackPlugin = void 0; - require("core-js/modules/es.promise.js"); - var _webpack = _interopRequireDefault(require("webpack")); - var _lodash = require("lodash"); - var _pluginWebpackValidate = _interopRequireDefault(require("@bundle-stats/plugin-webpack-validate")); - var _agent = require("./agent"); - var _utils = require("./utils"); - function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - const PLUGIN_NAME = 'RelativeCiAgent'; const DEFAULT_OPTIONS = { includeCommitMessage: true, @@ -30,7 +22,6 @@ const DEFAULT_OPTIONS = { } }; const isWebpack5 = parseInt(_webpack.default.version, 10) === 5; - const sendStats = async (compilation, options) => { const { stats: statsOptions, @@ -39,23 +30,19 @@ const sendStats = async (compilation, options) => { const data = compilation.getStats().toJson(statsOptions); const logger = compilation.getInfrastructureLogger ? compilation.getInfrastructureLogger(PLUGIN_NAME) : console; const invalidData = (0, _pluginWebpackValidate.default)(data); - if (invalidData) { logger.warn(invalidData); return; } - (0, _agent.agent)([{ key: 'webpack.stats', data }], config, undefined, logger); }; - class RelativeCiAgentWebpackPlugin { constructor(options) { this.options = options; } - apply(compiler) { const { isCi @@ -63,13 +50,13 @@ class RelativeCiAgentWebpackPlugin { const options = (0, _lodash.merge)({}, DEFAULT_OPTIONS, { enabled: isCi }, this.options); - (0, _utils.debug)(options); // Skip if not enabled + (0, _utils.debug)(options); + // Skip if not enabled if (!options.enabled) { (0, _utils.debug)(`${PLUGIN_NAME} is disabled, skip sending data`); return; } - if (isWebpack5) { compiler.hooks.make.tap(PLUGIN_NAME, compilation => { compilation.hooks.processAssets.tap({ @@ -79,13 +66,10 @@ class RelativeCiAgentWebpackPlugin { }); return; } - compiler.hooks.emit.tapAsync(PLUGIN_NAME, async (compilation, callback) => { await sendStats(compilation, options); callback(); }); } - } - exports.RelativeCiAgentWebpackPlugin = RelativeCiAgentWebpackPlugin; \ No newline at end of file diff --git a/node_modules/@relative-ci/agent/package.json b/node_modules/@relative-ci/agent/package.json index 99b1ccf13..4179f6ae6 100644 --- a/node_modules/@relative-ci/agent/package.json +++ b/node_modules/@relative-ci/agent/package.json @@ -1,6 +1,6 @@ { "name": "@relative-ci/agent", - "version": "4.1.1", + "version": "4.1.2", "description": "Relative CI agent", "repository": "relative-ci/agent", "main": "lib/index.js", @@ -42,29 +42,29 @@ "homepage": "https://relative-ci.com/documentation/setup", "devDependencies": { "@babel/cli": "7.19.3", - "@babel/core": "7.19.3", - "@babel/preset-env": "7.19.3", - "@types/jest": "29.1.2", - "eslint": "8.24.0", + "@babel/core": "7.20.5", + "@babel/preset-env": "7.20.2", + "@types/jest": "29.2.3", + "eslint": "8.29.0", "eslint-config-airbnb-base": "15.0.0", "eslint-plugin-import": "2.26.0", - "eslint-plugin-jest": "27.1.1", - "jest": "29.1.2", + "eslint-plugin-jest": "27.1.6", + "jest": "29.3.1", "memory-fs": "0.5.0", - "webpack": "5.74.0" + "webpack": "5.75.0" }, "dependencies": { - "@bundle-stats/plugin-webpack-filter": "4.1.0", - "@bundle-stats/plugin-webpack-validate": "4.1.0", - "core-js": "3.25.5", - "cosmiconfig": "7.0.1", + "@bundle-stats/plugin-webpack-filter": "4.1.5", + "@bundle-stats/plugin-webpack-validate": "4.1.5", + "core-js": "3.26.1", + "cosmiconfig": "8.0.0", "debug": "4.3.4", "dotenv": "16.0.3", "env-ci": "7.3.0", - "fs-extra": "10.1.0", + "fs-extra": "11.1.0", "isomorphic-fetch": "3.0.0", "lodash": "4.17.21", - "yargs": "17.6.0" + "yargs": "17.6.2" }, "peerDependencies": { "webpack": "^4.0.0 || ^5.0.0-rc.1" diff --git a/node_modules/@relative-ci/agent/typings.d.ts b/node_modules/@relative-ci/agent/typings.d.ts index dfce11825..59c38e90e 100644 --- a/node_modules/@relative-ci/agent/typings.d.ts +++ b/node_modules/@relative-ci/agent/typings.d.ts @@ -1,6 +1,7 @@ export class RelativeCiAgentWebpackPlugin { - constructor(options?: Partial) {} - apply(compiler: Compiler): void; + constructor(options?: Partial) {} + + apply(compiler: RelativeCiAgentWebpackPlugin.Compiler): void; }; declare namespace RelativeCiAgentWebpackPlugin { @@ -11,12 +12,6 @@ declare namespace RelativeCiAgentWebpackPlugin { */ assets?: Boolean; - /** - * Output webpack entrypoints information - * Default: `true`. - */ - entrypoints?: Boolean; - /** * Output webpack chunks information * Default: `true`. @@ -45,4 +40,6 @@ declare namespace RelativeCiAgentWebpackPlugin { stats?: Partial } + + type Compiler = import('webpack').Compiler; } diff --git a/node_modules/@types/parse-json/LICENSE b/node_modules/@types/parse-json/LICENSE deleted file mode 100644 index 4b1ad51b2..000000000 --- a/node_modules/@types/parse-json/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE diff --git a/node_modules/@types/parse-json/README.md b/node_modules/@types/parse-json/README.md deleted file mode 100644 index 6c7d67d33..000000000 --- a/node_modules/@types/parse-json/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Installation -> `npm install --save @types/parse-json` - -# Summary -This package contains type definitions for parse-json (https://github.com/sindresorhus/parse-json). - -# Details -Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/parse-json - -Additional Details - * Last updated: Tue, 14 Nov 2017 00:30:05 GMT - * Dependencies: none - * Global values: none - -# Credits -These definitions were written by mrmlnc . diff --git a/node_modules/@types/parse-json/index.d.ts b/node_modules/@types/parse-json/index.d.ts deleted file mode 100644 index 293a4a9b4..000000000 --- a/node_modules/@types/parse-json/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Type definitions for parse-json 4.0 -// Project: https://github.com/sindresorhus/parse-json -// Definitions by: mrmlnc -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare function parseJson(input: string | null, filepath?: string): any; -declare function parseJson(input: string | null, reviver: (key: any, value: any) => any, filepath?: string): any; - -export = parseJson; diff --git a/node_modules/@types/parse-json/package.json b/node_modules/@types/parse-json/package.json deleted file mode 100644 index cdc08dc53..000000000 --- a/node_modules/@types/parse-json/package.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "@types/parse-json", - "version": "4.0.0", - "description": "TypeScript definitions for parse-json", - "license": "MIT", - "contributors": [ - { - "name": "mrmlnc", - "url": "https://github.com/mrmlnc", - "githubUsername": "mrmlnc" - } - ], - "main": "", - "repository": { - "type": "git", - "url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git" - }, - "scripts": {}, - "dependencies": {}, - "typesPublisherContentHash": "68b3120a3ffa0ae0c978a90b74a1e50adc0340a9d11f17cc1efb7bf2186e7751", - "typeScriptVersion": "2.0" -} \ No newline at end of file diff --git a/node_modules/@webpack-cli/configtest/README.md b/node_modules/@webpack-cli/configtest/README.md index 07f991f33..49afdb683 100644 --- a/node_modules/@webpack-cli/configtest/README.md +++ b/node_modules/@webpack-cli/configtest/README.md @@ -2,6 +2,10 @@ [![NPM Downloads][downloads]][downloads-url] +> **Note** +> +> This package is used by webpack-cli under-the-hood and is not intended for installation + ## Description This package validates a webpack configuration. diff --git a/node_modules/@webpack-cli/configtest/lib/index.js b/node_modules/@webpack-cli/configtest/lib/index.js index 98690a444..e20fd58ad 100644 --- a/node_modules/@webpack-cli/configtest/lib/index.js +++ b/node_modules/@webpack-cli/configtest/lib/index.js @@ -31,13 +31,7 @@ class ConfigTestCommand { } cli.logger.info(`Validate '${Array.from(configPaths).join(" ,")}'.`); try { - // @ts-expect-error cli.webpack.validate returns void - const error = cli.webpack.validate(config.options); - // TODO remove this after drop webpack@4 - if (error && error.length > 0) { - // @ts-expect-error schema argument is missing - throw new cli.webpack.WebpackOptionsValidationError(error); - } + cli.webpack.validate(config.options); } catch (error) { if (cli.isValidationError(error)) { diff --git a/node_modules/@webpack-cli/configtest/package.json b/node_modules/@webpack-cli/configtest/package.json index 077b4bbf3..50f1a5b01 100644 --- a/node_modules/@webpack-cli/configtest/package.json +++ b/node_modules/@webpack-cli/configtest/package.json @@ -1,10 +1,13 @@ { "name": "@webpack-cli/configtest", - "version": "1.2.0", + "version": "2.0.0", "description": "Validate a webpack configuration.", "main": "lib/index.js", "types": "lib/index.d.ts", "license": "MIT", + "engines": { + "node": ">=14.15.0" + }, "publishConfig": { "access": "public" }, @@ -17,8 +20,8 @@ "lib" ], "peerDependencies": { - "webpack": "4.x.x || 5.x.x", - "webpack-cli": "4.x.x" + "webpack": "5.x.x", + "webpack-cli": "5.x.x" }, - "gitHead": "20882d463450d010bb76e0824fe555e9785e9561" + "gitHead": "1d6ada1a84c68a00e56c536d2f004f60939bd946" } diff --git a/node_modules/@webpack-cli/info/README.md b/node_modules/@webpack-cli/info/README.md index aa99d3711..448692588 100644 --- a/node_modules/@webpack-cli/info/README.md +++ b/node_modules/@webpack-cli/info/README.md @@ -2,6 +2,10 @@ [![NPM Downloads][downloads]][downloads-url] +> **Note** +> +> This package is used by webpack-cli under-the-hood and is not intended for installation + ## Description This package returns a set of information related to the local environment. diff --git a/node_modules/@webpack-cli/info/lib/index.js b/node_modules/@webpack-cli/info/lib/index.js index bd926465d..1702ed0e3 100644 --- a/node_modules/@webpack-cli/info/lib/index.js +++ b/node_modules/@webpack-cli/info/lib/index.js @@ -1,9 +1,5 @@ "use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); -const envinfo_1 = __importDefault(require("envinfo")); class InfoCommand { async apply(cli) { await cli.makeCommand({ @@ -12,71 +8,8 @@ class InfoCommand { description: "Outputs information about your system.", usage: "[options]", pkg: "@webpack-cli/info", - }, [ - { - name: "output", - alias: "o", - configs: [ - { - type: "string", - }, - ], - description: "To get the output in a specified format ( accept json or markdown )", - }, - { - name: "additional-package", - alias: "a", - configs: [{ type: "string" }], - multiple: true, - description: "Adds additional packages to the output", - }, - ], async (options) => { - let { output } = options; - const envinfoConfig = {}; - if (output) { - // Remove quotes if exist - output = output.replace(/['"]+/g, ""); - switch (output) { - case "markdown": - envinfoConfig["markdown"] = true; - break; - case "json": - envinfoConfig["json"] = true; - break; - default: - cli.logger.error(`'${output}' is not a valid value for output`); - process.exit(2); - } - } - const defaultInformation = { - Binaries: ["Node", "Yarn", "npm"], - Browsers: [ - "Brave Browser", - "Chrome", - "Chrome Canary", - "Edge", - "Firefox", - "Firefox Developer Edition", - "Firefox Nightly", - "Internet Explorer", - "Safari", - "Safari Technology Preview", - ], - Monorepos: ["Yarn Workspaces", "Lerna"], - System: ["OS", "CPU", "Memory"], - npmGlobalPackages: ["webpack", "webpack-cli", "webpack-dev-server"], - npmPackages: "{*webpack*,*loader*}", - }; - let defaultPackages = ["webpack", "loader"]; - if (typeof options.additionalPackage !== "undefined") { - defaultPackages = [...defaultPackages, ...options.additionalPackage]; - } - defaultInformation.npmPackages = `{${defaultPackages - .map((item) => `*${item}*`) - .join(",")}}`; - let info = await envinfo_1.default.run(defaultInformation, envinfoConfig); - info = info.replace(/npmPackages/g, "Packages"); - info = info.replace(/npmGlobalPackages/g, "Global Packages"); + }, cli.getInfoOptions(), async (options) => { + const info = await cli.getInfoOutput(options); cli.logger.raw(info); }); } diff --git a/node_modules/@webpack-cli/info/package.json b/node_modules/@webpack-cli/info/package.json index 11e005f39..5dfd9cb8a 100644 --- a/node_modules/@webpack-cli/info/package.json +++ b/node_modules/@webpack-cli/info/package.json @@ -1,10 +1,13 @@ { "name": "@webpack-cli/info", - "version": "1.5.0", + "version": "2.0.0", "description": "Outputs info about system and webpack config", "main": "lib/index.js", "types": "lib/index.d.ts", "license": "MIT", + "engines": { + "node": ">=14.15.0" + }, "publishConfig": { "access": "public" }, @@ -16,14 +19,9 @@ "files": [ "lib" ], - "dependencies": { - "envinfo": "^7.7.3" - }, - "gitHead": "20882d463450d010bb76e0824fe555e9785e9561", + "gitHead": "1d6ada1a84c68a00e56c536d2f004f60939bd946", "peerDependencies": { - "webpack-cli": "4.x.x" - }, - "devDependencies": { - "@types/envinfo": "^7.8.1" + "webpack": "5.x.x", + "webpack-cli": "5.x.x" } } diff --git a/node_modules/@webpack-cli/serve/README.md b/node_modules/@webpack-cli/serve/README.md index 44757464e..03279ae42 100644 --- a/node_modules/@webpack-cli/serve/README.md +++ b/node_modules/@webpack-cli/serve/README.md @@ -2,7 +2,9 @@ [![NPM Downloads][downloads]][downloads-url] -**This package is used by webpack-cli under-the-hood and is not intended for installation as of v0.2.0** +> **Note** +> +> This package is used by webpack-cli under-the-hood and is not intended for installation ## Description diff --git a/node_modules/@webpack-cli/serve/lib/index.js b/node_modules/@webpack-cli/serve/lib/index.js index 0b71cd75a..9447f0b6e 100644 --- a/node_modules/@webpack-cli/serve/lib/index.js +++ b/node_modules/@webpack-cli/serve/lib/index.js @@ -5,32 +5,10 @@ const WEBPACK_DEV_SERVER_PACKAGE = process.env.WEBPACK_DEV_SERVER_PACKAGE || "we class ServeCommand { async apply(cli) { const loadDevServerOptions = () => { - // TODO simplify this after drop webpack v4 and webpack-dev-server v3 // eslint-disable-next-line @typescript-eslint/no-var-requires const devServer = require(WEBPACK_DEV_SERVER_PACKAGE); - const isNewDevServerCLIAPI = typeof devServer.schema !== "undefined"; // eslint-disable-next-line @typescript-eslint/no-explicit-any - let options = {}; - if (isNewDevServerCLIAPI) { - if (cli.webpack.cli && typeof cli.webpack.cli.getArguments === "function") { - options = cli.webpack.cli.getArguments(devServer.schema); - } - else { - options = devServer.cli.getArguments(); - } - } - else { - options = require(`${WEBPACK_DEV_SERVER_PACKAGE}/bin/cli-flags`); - } - // Old options format - // { devServer: [{...}, {}...] } - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - if (options.devServer) { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - return options.devServer; - } + const options = cli.webpack.cli.getArguments(devServer.schema); // New options format // { flag1: {}, flag2: {} } return Object.keys(options).map((key) => { @@ -78,10 +56,9 @@ class ServeCommand { const processors = []; for (const optionName in options) { const kebabedOption = cli.toKebabCase(optionName); - // `webpack-dev-server` has own logic for the `--hot` option - const isBuiltInOption = kebabedOption !== "hot" && - // eslint-disable-next-line @typescript-eslint/no-explicit-any - builtInOptions.find((builtInOption) => builtInOption.name === kebabedOption); + const isBuiltInOption = builtInOptions.find( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (builtInOption) => builtInOption.name === kebabedOption); if (isBuiltInOption) { webpackCLIOptions[optionName] = options[optionName]; } @@ -116,15 +93,7 @@ class ServeCommand { } process.stdin.on("end", () => { Promise.all(servers.map((server) => { - if (typeof server.stop === "function") { - return server.stop(); - } - // TODO remove in the next major release - return new Promise((resolve) => { - server.close(() => { - resolve(); - }); - }); + return server.stop(); })).then(() => { process.exit(0); }); @@ -133,11 +102,9 @@ class ServeCommand { } // eslint-disable-next-line @typescript-eslint/no-var-requires const DevServer = require(WEBPACK_DEV_SERVER_PACKAGE); - const isNewDevServerCLIAPI = typeof DevServer.schema !== "undefined"; - let devServerVersion; try { // eslint-disable-next-line @typescript-eslint/no-var-requires - devServerVersion = require(`${WEBPACK_DEV_SERVER_PACKAGE}/package.json`).version; + require(`${WEBPACK_DEV_SERVER_PACKAGE}/package.json`).version; } catch (err) { cli.logger.error(`You need to install 'webpack-dev-server' for running 'webpack serve'.\n${err}`); @@ -146,97 +113,46 @@ class ServeCommand { const compilers = cli.isMultipleCompiler(compiler) ? compiler.compilers : [compiler]; const possibleCompilers = compilers.filter((compiler) => compiler.options.devServer); const compilersForDevServer = possibleCompilers.length > 0 ? possibleCompilers : [compilers[0]]; - const isDevServer4 = devServerVersion.startsWith("4"); const usedPorts = []; for (const compilerForDevServer of compilersForDevServer) { - let devServerOptions; - if (isNewDevServerCLIAPI) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const args = devServerFlags.reduce((accumulator, flag) => { - accumulator[flag.name] = flag; - return accumulator; - }, {}); - const values = Object.keys(devServerCLIOptions).reduce( - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (accumulator, name) => { - const kebabName = cli.toKebabCase(name); - if (args[kebabName]) { - accumulator[kebabName] = options[name]; - } - return accumulator; - }, {}); - const result = Object.assign({}, (compilerForDevServer.options.devServer || {})); - const problems = (cli.webpack.cli && typeof cli.webpack.cli.processArguments === "function" - ? cli.webpack.cli - : DevServer.cli).processArguments(args, result, values); - if (problems) { - const groupBy = (xs, key) => { - return xs.reduce((rv, x) => { - (rv[x[key]] = rv[x[key]] || []).push(x); - return rv; - }, {}); - }; - const problemsByPath = groupBy(problems, "path"); - for (const path in problemsByPath) { - const problems = problemsByPath[path]; - problems.forEach((problem) => { - cli.logger.error(`${cli.capitalizeFirstLetter(problem.type.replace(/-/g, " "))}${problem.value ? ` '${problem.value}'` : ""} for the '--${problem.argument}' option${problem.index ? ` by index '${problem.index}'` : ""}`); - if (problem.expected) { - cli.logger.error(`Expected: '${problem.expected}'`); - } - }); - } - process.exit(2); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const args = devServerFlags.reduce((accumulator, flag) => { + accumulator[flag.name] = flag; + return accumulator; + }, {}); + const values = Object.keys(devServerCLIOptions).reduce( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (accumulator, name) => { + const kebabName = cli.toKebabCase(name); + if (args[kebabName]) { + accumulator[kebabName] = options[name]; } - devServerOptions = result; - } - else { - // TODO remove in the next major release - const mergeOptions = (devServerOptions, devServerCliOptions) => { - // CLI options should take precedence over devServer options, - // and CLI options should have no default values included - const options = Object.assign(Object.assign({}, devServerOptions), devServerCliOptions); - if (devServerOptions.client && - devServerCliOptions.client && - typeof devServerOptions.client === "object" && - typeof devServerCliOptions.client === "object") { - // the user could set some client options in their devServer config, - // then also specify client options on the CLI - options.client = Object.assign(Object.assign({}, devServerOptions.client), devServerCliOptions.client); - } - return options; - }; - devServerOptions = mergeOptions(compilerForDevServer.options.devServer || {}, devServerCLIOptions); - } - // TODO remove in the next major release - if (!isDevServer4) { - const getPublicPathOption = () => { - const normalizePublicPath = (publicPath) => typeof publicPath === "undefined" || publicPath === "auto" ? "/" : publicPath; - if (options.outputPublicPath) { - return normalizePublicPath(compilerForDevServer.options.output.publicPath); - } - if (devServerOptions.publicPath) { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - return normalizePublicPath(devServerOptions.publicPath); - } - return normalizePublicPath(compilerForDevServer.options.output.publicPath); - }; - const getStatsOption = () => { - if (options.stats) { - return options.stats; - } - if (devServerOptions.stats) { - return devServerOptions.stats; - } - return compilerForDevServer.options.stats; + return accumulator; + }, {}); + const result = Object.assign({}, (compilerForDevServer.options.devServer || {})); + const problems = (cli.webpack.cli && typeof cli.webpack.cli.processArguments === "function" + ? cli.webpack.cli + : DevServer.cli).processArguments(args, result, values); + if (problems) { + const groupBy = (xs, key) => { + return xs.reduce((rv, x) => { + (rv[x[key]] = rv[x[key]] || []).push(x); + return rv; + }, {}); }; - devServerOptions.host = devServerOptions.host || "localhost"; - devServerOptions.port = - typeof devServerOptions.port !== "undefined" ? devServerOptions.port : 8080; - devServerOptions.stats = getStatsOption(); - devServerOptions.publicPath = getPublicPathOption(); + const problemsByPath = groupBy(problems, "path"); + for (const path in problemsByPath) { + const problems = problemsByPath[path]; + problems.forEach((problem) => { + cli.logger.error(`${cli.capitalizeFirstLetter(problem.type.replace(/-/g, " "))}${problem.value ? ` '${problem.value}'` : ""} for the '--${problem.argument}' option${problem.index ? ` by index '${problem.index}'` : ""}`); + if (problem.expected) { + cli.logger.error(`Expected: '${problem.expected}'`); + } + }); + } + process.exit(2); } + const devServerOptions = result; if (devServerOptions.port) { const portNumber = Number(devServerOptions.port); if (usedPorts.find((port) => portNumber === port)) { @@ -245,25 +161,8 @@ class ServeCommand { usedPorts.push(portNumber); } try { - let server; - // TODO: remove after dropping webpack-dev-server@v3 - if (isDevServer4) { - server = new DevServer(devServerOptions, compiler); - } - else { - server = new DevServer(compiler, devServerOptions); - } - if (typeof server.start === "function") { - await server.start(); - } - else { - // TODO remove in the next major release - server.listen(devServerOptions.port, devServerOptions.host, (error) => { - if (error) { - throw error; - } - }); - } + const server = new DevServer(devServerOptions, compiler); + await server.start(); servers.push(server); } catch (error) { diff --git a/node_modules/@webpack-cli/serve/package.json b/node_modules/@webpack-cli/serve/package.json index cad9fdc80..084a3ec62 100644 --- a/node_modules/@webpack-cli/serve/package.json +++ b/node_modules/@webpack-cli/serve/package.json @@ -1,6 +1,6 @@ { "name": "@webpack-cli/serve", - "version": "1.7.0", + "version": "2.0.0", "description": "", "main": "lib/index.js", "types": "lib/index.d.ts", @@ -14,16 +14,20 @@ }, "homepage": "https://github.com/webpack/webpack-cli/tree/master/packages/serve", "license": "MIT", + "engines": { + "node": ">=14.15.0" + }, "files": [ "lib" ], "peerDependencies": { - "webpack-cli": "4.x.x" + "webpack": "5.x.x", + "webpack-cli": "5.x.x" }, "peerDependenciesMeta": { "webpack-dev-server": { "optional": true } }, - "gitHead": "20882d463450d010bb76e0824fe555e9785e9561" + "gitHead": "1d6ada1a84c68a00e56c536d2f004f60939bd946" } diff --git a/node_modules/ajv-formats/LICENSE b/node_modules/ajv-formats/LICENSE new file mode 100644 index 000000000..a3f8ba027 --- /dev/null +++ b/node_modules/ajv-formats/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/ajv-formats/README.md b/node_modules/ajv-formats/README.md new file mode 100644 index 000000000..5b4706dc1 --- /dev/null +++ b/node_modules/ajv-formats/README.md @@ -0,0 +1,123 @@ +# ajv-formats + +JSON Schema formats for Ajv + +[![Build Status](https://travis-ci.org/ajv-validator/ajv-formats.svg?branch=master)](https://travis-ci.org/ajv-validator/ajv-formats) +[![npm](https://img.shields.io/npm/v/ajv-formats.svg)](https://www.npmjs.com/package/ajv-formats) +[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv) +[![GitHub Sponsors](https://img.shields.io/badge/$-sponsors-brightgreen)](https://github.com/sponsors/epoberezkin) + +## Usage + +```javascript +// ESM/TypeScript import +import Ajv from "ajv" +import addFormats from "ajv-formats" +// Node.js require: +const Ajv = require("ajv") +const addFormats = require("ajv-formats") + +const ajv = new Ajv() +addFormats(ajv) +``` + +## Formats + +The package defines these formats: + +- _date_: full-date according to [RFC3339](http://tools.ietf.org/html/rfc3339#section-5.6). +- _time_: time with optional time-zone. +- _date-time_: date-time from the same source (time-zone is mandatory). +- _duration_: duration from [RFC3339](https://tools.ietf.org/html/rfc3339#appendix-A) +- _uri_: full URI. +- _uri-reference_: URI reference, including full and relative URIs. +- _uri-template_: URI template according to [RFC6570](https://tools.ietf.org/html/rfc6570) +- _url_ (deprecated): [URL record](https://url.spec.whatwg.org/#concept-url). +- _email_: email address. +- _hostname_: host name according to [RFC1034](http://tools.ietf.org/html/rfc1034#section-3.5). +- _ipv4_: IP address v4. +- _ipv6_: IP address v6. +- _regex_: tests whether a string is a valid regular expression by passing it to RegExp constructor. +- _uuid_: Universally Unique IDentifier according to [RFC4122](http://tools.ietf.org/html/rfc4122). +- _json-pointer_: JSON-pointer according to [RFC6901](https://tools.ietf.org/html/rfc6901). +- _relative-json-pointer_: relative JSON-pointer according to [this draft](http://tools.ietf.org/html/draft-luff-relative-json-pointer-00). +- _byte_: base64 encoded data according to the [openApi 3.0.0 specification](https://spec.openapis.org/oas/v3.0.0#data-types) +- _int32_: signed 32 bits integer according to the [openApi 3.0.0 specification](https://spec.openapis.org/oas/v3.0.0#data-types) +- _int64_: signed 64 bits according to the [openApi 3.0.0 specification](https://spec.openapis.org/oas/v3.0.0#data-types) +- _float_: float according to the [openApi 3.0.0 specification](https://spec.openapis.org/oas/v3.0.0#data-types) +- _double_: double according to the [openApi 3.0.0 specification](https://spec.openapis.org/oas/v3.0.0#data-types) +- _password_: password string according to the [openApi 3.0.0 specification](https://spec.openapis.org/oas/v3.0.0#data-types) +- _binary_: binary string according to the [openApi 3.0.0 specification](https://spec.openapis.org/oas/v3.0.0#data-types) + +See regular expressions used for format validation and the sources that were used in [formats.ts](https://github.com/ajv-validator/ajv-formats/blob/master/src/formats.ts). + +**Please note**: JSON Schema draft-07 also defines formats `iri`, `iri-reference`, `idn-hostname` and `idn-email` for URLs, hostnames and emails with international characters. These formats are available in [ajv-formats-draft2019](https://github.com/luzlab/ajv-formats-draft2019) plugin. + +## Keywords to compare values: `formatMaximum` / `formatMinimum` and `formatExclusiveMaximum` / `formatExclusiveMinimum` + +These keywords allow to define minimum/maximum constraints when the format keyword defines ordering (`compare` function in format definition). + +These keywords are added to ajv instance when ajv-formats is used without options or with option `keywords: true`. + +These keywords apply only to strings. If the data is not a string, the validation succeeds. + +The value of keywords `formatMaximum`/`formatMinimum` and `formatExclusiveMaximum`/`formatExclusiveMinimum` should be a string or [\$data reference](https://github.com/ajv-validator/ajv/blob/master/docs/validation.md#data-reference). This value is the maximum (minimum) allowed value for the data to be valid as determined by `format` keyword. If `format` keyword is not present schema compilation will throw exception. + +When these keyword are added, they also add comparison functions to formats `"date"`, `"time"` and `"date-time"`. User-defined formats also can have comparison functions. See [addFormat](https://github.com/ajv-validator/ajv/blob/master/docs/api.md#api-addformat) method. + +```javascript +require("ajv-formats")(ajv) + +const schema = { + type: "string", + format: "date", + formatMinimum: "2016-02-06", + formatExclusiveMaximum: "2016-12-27", +} + +const validDataList = ["2016-02-06", "2016-12-26"] + +const invalidDataList = ["2016-02-05", "2016-12-27", "abc"] +``` + +## Options + +Options can be passed via the second parameter. Options value can be + +1. The list of format names that will be added to ajv instance: + +```javascript +addFormats(ajv, ["date", "time"]) +``` + +**Please note**: when ajv encounters an undefined format it throws exception (unless ajv instance was configured with `strict: false` option). To allow specific undefined formats they have to be passed to ajv instance via `formats` option with `true` value: + +```javascript +const ajv = new Ajv((formats: {date: true, time: true})) // to ignore "date" and "time" formats in schemas. +``` + +2. Format validation mode (default is `"full"`) with optional list of format names and `keywords` option to add additional format comparison keywords: + +```javascript +addFormats(ajv, {mode: "fast"}) +``` + +or + +```javascript +addFormats(ajv, {mode: "fast", formats: ["date", "time"], keywords: true}) +``` + +In `"fast"` mode the following formats are simplified: `"date"`, `"time"`, `"date-time"`, `"uri"`, `"uri-reference"`, `"email"`. For example `"date"`, `"time"` and `"date-time"` do not validate ranges in `"fast"` mode, only string structure, and other formats have simplified regular expressions. + +## Tests + +```bash +npm install +git submodule update --init +npm test +``` + +## License + +[MIT](https://github.com/ajv-validator/ajv-formats/blob/master/LICENSE) diff --git a/node_modules/ajv-formats/dist/formats.d.ts b/node_modules/ajv-formats/dist/formats.d.ts new file mode 100644 index 000000000..8a3e1404b --- /dev/null +++ b/node_modules/ajv-formats/dist/formats.d.ts @@ -0,0 +1,9 @@ +import type { Format } from "ajv"; +export declare type FormatMode = "fast" | "full"; +export declare type FormatName = "date" | "time" | "date-time" | "duration" | "uri" | "uri-reference" | "uri-template" | "url" | "email" | "hostname" | "ipv4" | "ipv6" | "regex" | "uuid" | "json-pointer" | "json-pointer-uri-fragment" | "relative-json-pointer" | "byte" | "int32" | "int64" | "float" | "double" | "password" | "binary"; +export declare type DefinedFormats = { + [key in FormatName]: Format; +}; +export declare const fullFormats: DefinedFormats; +export declare const fastFormats: DefinedFormats; +export declare const formatNames: FormatName[]; diff --git a/node_modules/ajv-formats/dist/formats.js b/node_modules/ajv-formats/dist/formats.js new file mode 100644 index 000000000..e345121b9 --- /dev/null +++ b/node_modules/ajv-formats/dist/formats.js @@ -0,0 +1,173 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.formatNames = exports.fastFormats = exports.fullFormats = void 0; +function fmtDef(validate, compare) { + return { validate, compare }; +} +exports.fullFormats = { + // date: http://tools.ietf.org/html/rfc3339#section-5.6 + date: fmtDef(date, compareDate), + // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 + time: fmtDef(time, compareTime), + "date-time": fmtDef(date_time, compareDateTime), + // duration: https://tools.ietf.org/html/rfc3339#appendix-A + duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/, + uri, + "uri-reference": /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i, + // uri-template: https://tools.ietf.org/html/rfc6570 + "uri-template": /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i, + // For the source: https://gist.github.com/dperini/729294 + // For test cases: https://mathiasbynens.be/demo/url-regex + url: /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu, + email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, + hostname: /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i, + // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html + ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, + ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i, + regex, + // uuid: http://tools.ietf.org/html/rfc4122 + uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i, + // JSON-pointer: https://tools.ietf.org/html/rfc6901 + // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A + "json-pointer": /^(?:\/(?:[^~/]|~0|~1)*)*$/, + "json-pointer-uri-fragment": /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i, + // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00 + "relative-json-pointer": /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/, + // the following formats are used by the openapi specification: https://spec.openapis.org/oas/v3.0.0#data-types + // byte: https://github.com/miguelmota/is-base64 + byte, + // signed 32 bit integer + int32: { type: "number", validate: validateInt32 }, + // signed 64 bit integer + int64: { type: "number", validate: validateInt64 }, + // C-type float + float: { type: "number", validate: validateNumber }, + // C-type double + double: { type: "number", validate: validateNumber }, + // hint to the UI to hide input strings + password: true, + // unchecked string payload + binary: true, +}; +exports.fastFormats = { + ...exports.fullFormats, + date: fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, compareDate), + time: fmtDef(/^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, compareTime), + "date-time": fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, compareDateTime), + // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js + uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i, + "uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i, + // email (sources from jsen validator): + // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363 + // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'wilful violation') + email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i, +}; +exports.formatNames = Object.keys(exports.fullFormats); +function isLeapYear(year) { + // https://tools.ietf.org/html/rfc3339#appendix-C + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); +} +const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/; +const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; +function date(str) { + // full-date from http://tools.ietf.org/html/rfc3339#section-5.6 + const matches = DATE.exec(str); + if (!matches) + return false; + const year = +matches[1]; + const month = +matches[2]; + const day = +matches[3]; + return (month >= 1 && + month <= 12 && + day >= 1 && + day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month])); +} +function compareDate(d1, d2) { + if (!(d1 && d2)) + return undefined; + if (d1 > d2) + return 1; + if (d1 < d2) + return -1; + return 0; +} +const TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i; +function time(str, withTimeZone) { + const matches = TIME.exec(str); + if (!matches) + return false; + const hour = +matches[1]; + const minute = +matches[2]; + const second = +matches[3]; + const timeZone = matches[5]; + return (((hour <= 23 && minute <= 59 && second <= 59) || + (hour === 23 && minute === 59 && second === 60)) && + (!withTimeZone || timeZone !== "")); +} +function compareTime(t1, t2) { + if (!(t1 && t2)) + return undefined; + const a1 = TIME.exec(t1); + const a2 = TIME.exec(t2); + if (!(a1 && a2)) + return undefined; + t1 = a1[1] + a1[2] + a1[3] + (a1[4] || ""); + t2 = a2[1] + a2[2] + a2[3] + (a2[4] || ""); + if (t1 > t2) + return 1; + if (t1 < t2) + return -1; + return 0; +} +const DATE_TIME_SEPARATOR = /t|\s/i; +function date_time(str) { + // http://tools.ietf.org/html/rfc3339#section-5.6 + const dateTime = str.split(DATE_TIME_SEPARATOR); + return dateTime.length === 2 && date(dateTime[0]) && time(dateTime[1], true); +} +function compareDateTime(dt1, dt2) { + if (!(dt1 && dt2)) + return undefined; + const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR); + const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR); + const res = compareDate(d1, d2); + if (res === undefined) + return undefined; + return res || compareTime(t1, t2); +} +const NOT_URI_FRAGMENT = /\/|:/; +const URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i; +function uri(str) { + // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "." + return NOT_URI_FRAGMENT.test(str) && URI.test(str); +} +const BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm; +function byte(str) { + BYTE.lastIndex = 0; + return BYTE.test(str); +} +const MIN_INT32 = -(2 ** 31); +const MAX_INT32 = 2 ** 31 - 1; +function validateInt32(value) { + return Number.isInteger(value) && value <= MAX_INT32 && value >= MIN_INT32; +} +function validateInt64(value) { + // JSON and javascript max Int is 2**53, so any int that passes isInteger is valid for Int64 + return Number.isInteger(value); +} +function validateNumber() { + return true; +} +const Z_ANCHOR = /[^\\]\\Z/; +function regex(str) { + if (Z_ANCHOR.test(str)) + return false; + try { + new RegExp(str); + return true; + } + catch (e) { + return false; + } +} +//# sourceMappingURL=formats.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/dist/formats.js.map b/node_modules/ajv-formats/dist/formats.js.map new file mode 100644 index 000000000..86e93a1bc --- /dev/null +++ b/node_modules/ajv-formats/dist/formats.js.map @@ -0,0 +1 @@ +{"version":3,"file":"formats.js","sourceRoot":"","sources":["../src/formats.ts"],"names":[],"mappings":";;;AAmCA,SAAS,MAAM,CACb,QAA0C,EAC1C,OAA8B;IAE9B,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAC,CAAA;AAC5B,CAAC;AAEY,QAAA,WAAW,GAAmB;IACzC,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;IAC/B,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC,SAAS,EAAE,eAAe,CAAC;IAC/C,2DAA2D;IAC3D,QAAQ,EAAE,wEAAwE;IAClF,GAAG;IACH,eAAe,EACb,woCAAwoC;IAC1oC,oDAAoD;IACpD,cAAc,EACZ,mLAAmL;IACrL,yDAAyD;IACzD,0DAA0D;IAC1D,GAAG,EAAE,odAAod;IACzd,KAAK,EACH,0IAA0I;IAC5I,QAAQ,EACN,uGAAuG;IACzG,mHAAmH;IACnH,IAAI,EAAE,2EAA2E;IACjF,IAAI,EAAE,k/BAA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,CAAA;AACpD,CAAC;AAED,MAAM,IAAI,GAAG,oEAAoE,CAAA;AAEjF,SAAS,IAAI,CAAC,GAAW;IACvB,IAAI,CAAC,SAAS,GAAG,CAAC,CAAA;IAClB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACvB,CAAC;AAED,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;AAC5B,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;AAE7B,SAAS,aAAa,CAAC,KAAa;IAClC,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,SAAS,IAAI,KAAK,IAAI,SAAS,CAAA;AAC5E,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,4FAA4F;IAC5F,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;AAChC,CAAC;AAED,SAAS,cAAc;IACrB,OAAO,IAAI,CAAA;AACb,CAAC;AAED,MAAM,QAAQ,GAAG,UAAU,CAAA;AAC3B,SAAS,KAAK,CAAC,GAAW;IACxB,IAAI,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,KAAK,CAAA;IACpC,IAAI;QACF,IAAI,MAAM,CAAC,GAAG,CAAC,CAAA;QACf,OAAO,IAAI,CAAA;KACZ;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,KAAK,CAAA;KACb;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/dist/index.d.ts b/node_modules/ajv-formats/dist/index.d.ts new file mode 100644 index 000000000..479d40522 --- /dev/null +++ b/node_modules/ajv-formats/dist/index.d.ts @@ -0,0 +1,15 @@ +import { FormatMode, FormatName } from "./formats"; +import type { Plugin, Format } from "ajv"; +export { FormatMode, FormatName } from "./formats"; +export { LimitFormatError } from "./limit"; +export interface FormatOptions { + mode?: FormatMode; + formats?: FormatName[]; + keywords?: boolean; +} +export declare type FormatsPluginOptions = FormatName[] | FormatOptions; +export interface FormatsPlugin extends Plugin { + get: (format: FormatName, mode?: FormatMode) => Format; +} +declare const formatsPlugin: FormatsPlugin; +export default formatsPlugin; diff --git a/node_modules/ajv-formats/dist/index.js b/node_modules/ajv-formats/dist/index.js new file mode 100644 index 000000000..5db64fec3 --- /dev/null +++ b/node_modules/ajv-formats/dist/index.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const formats_1 = require("./formats"); +const limit_1 = require("./limit"); +const codegen_1 = require("ajv/dist/compile/codegen"); +const fullName = new codegen_1.Name("fullFormats"); +const fastName = new codegen_1.Name("fastFormats"); +const formatsPlugin = (ajv, opts = { keywords: true }) => { + if (Array.isArray(opts)) { + addFormats(ajv, opts, formats_1.fullFormats, fullName); + return ajv; + } + const [formats, exportName] = opts.mode === "fast" ? [formats_1.fastFormats, fastName] : [formats_1.fullFormats, fullName]; + const list = opts.formats || formats_1.formatNames; + addFormats(ajv, list, formats, exportName); + if (opts.keywords) + limit_1.default(ajv); + return ajv; +}; +formatsPlugin.get = (name, mode = "full") => { + const formats = mode === "fast" ? formats_1.fastFormats : formats_1.fullFormats; + const f = formats[name]; + if (!f) + throw new Error(`Unknown format "${name}"`); + return f; +}; +function addFormats(ajv, list, fs, exportName) { + var _a; + var _b; + (_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : (_b.formats = codegen_1._ `require("ajv-formats/dist/formats").${exportName}`); + for (const f of list) + ajv.addFormat(f, fs[f]); +} +module.exports = exports = formatsPlugin; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = formatsPlugin; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/dist/index.js.map b/node_modules/ajv-formats/dist/index.js.map new file mode 100644 index 000000000..9a61c691b --- /dev/null +++ b/node_modules/ajv-formats/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"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AAC,GAAQ,EAAE,IAAkB,EAAE,EAAkB,EAAE,UAAgB;;;IACpF,YAAA,GAAG,CAAC,IAAI,CAAC,IAAI,EAAC,OAAO,uCAAP,OAAO,GAAK,WAAC,CAAA,uCAAuC,UAAU,EAAE,EAAA;IAC9E,KAAK,MAAM,CAAC,IAAI,IAAI;QAAE,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;AAC/C,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,aAAa,CAAA;AACxC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,aAAa,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/dist/limit.d.ts b/node_modules/ajv-formats/dist/limit.d.ts new file mode 100644 index 000000000..f7367da42 --- /dev/null +++ b/node_modules/ajv-formats/dist/limit.d.ts @@ -0,0 +1,10 @@ +import type { Plugin, CodeKeywordDefinition, ErrorObject } from "ajv"; +declare type Kwd = "formatMaximum" | "formatMinimum" | "formatExclusiveMaximum" | "formatExclusiveMinimum"; +declare type Comparison = "<=" | ">=" | "<" | ">"; +export declare type LimitFormatError = ErrorObject; +export declare const formatLimitDefinition: CodeKeywordDefinition; +declare const formatLimitPlugin: Plugin; +export default formatLimitPlugin; diff --git a/node_modules/ajv-formats/dist/limit.js b/node_modules/ajv-formats/dist/limit.js new file mode 100644 index 000000000..7f6c7fdc8 --- /dev/null +++ b/node_modules/ajv-formats/dist/limit.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.formatLimitDefinition = void 0; +const ajv_1 = require("ajv"); +const codegen_1 = require("ajv/dist/compile/codegen"); +const ops = codegen_1.operators; +const KWDs = { + formatMaximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT }, + formatMinimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT }, + formatExclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE }, + formatExclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }, +}; +const error = { + message: ({ keyword, schemaCode }) => codegen_1.str `should be ${KWDs[keyword].okStr} ${schemaCode}`, + params: ({ keyword, schemaCode }) => codegen_1._ `{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`, +}; +exports.formatLimitDefinition = { + keyword: Object.keys(KWDs), + type: "string", + schemaType: "string", + $data: true, + error, + code(cxt) { + const { gen, data, schemaCode, keyword, it } = cxt; + const { opts, self } = it; + if (!opts.validateFormats) + return; + const fCxt = new ajv_1.KeywordCxt(it, self.RULES.all.format.definition, "format"); + if (fCxt.$data) + validate$DataFormat(); + else + validateFormat(); + function validate$DataFormat() { + const fmts = gen.scopeValue("formats", { + ref: self.formats, + code: opts.code.formats, + }); + const fmt = gen.const("fmt", codegen_1._ `${fmts}[${fCxt.schemaCode}]`); + cxt.fail$data(codegen_1.or(codegen_1._ `typeof ${fmt} != "object"`, codegen_1._ `${fmt} instanceof RegExp`, codegen_1._ `typeof ${fmt}.compare != "function"`, compareCode(fmt))); + } + function validateFormat() { + const format = fCxt.schema; + const fmtDef = self.formats[format]; + if (!fmtDef || fmtDef === true) + return; + if (typeof fmtDef != "object" || + fmtDef instanceof RegExp || + typeof fmtDef.compare != "function") { + throw new Error(`"${keyword}": format "${format}" does not define "compare" function`); + } + const fmt = gen.scopeValue("formats", { + key: format, + ref: fmtDef, + code: opts.code.formats ? codegen_1._ `${opts.code.formats}${codegen_1.getProperty(format)}` : undefined, + }); + cxt.fail$data(compareCode(fmt)); + } + function compareCode(fmt) { + return codegen_1._ `${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword].fail} 0`; + } + }, + dependencies: ["format"], +}; +const formatLimitPlugin = (ajv) => { + ajv.addKeyword(exports.formatLimitDefinition); + return ajv; +}; +exports.default = formatLimitPlugin; +//# sourceMappingURL=limit.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/dist/limit.js.map b/node_modules/ajv-formats/dist/limit.js.map new file mode 100644 index 000000000..ff9c19e05 --- /dev/null +++ b/node_modules/ajv-formats/dist/limit.js.map @@ -0,0 +1 @@ +{"version":3,"file":"limit.js","sourceRoot":"","sources":["../src/limit.ts"],"names":[],"mappings":";;;AAWA,6BAA8B;AAC9B,sDAA2E;AAM3E,MAAM,GAAG,GAAG,mBAAS,CAAA;AAErB,MAAM,IAAI,GAA4D;IACpE,aAAa,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,EAAC;IACvD,aAAa,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,EAAC;IACvD,sBAAsB,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,EAAC;IAC/D,sBAAsB,EAAE,EAAC,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,EAAC;CAChE,CAAA;AAID,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC,EAAE,EAAE,CAAC,aAAG,CAAA,aAAa,IAAI,CAAC,OAAc,CAAC,CAAC,KAAK,IAAI,UAAU,EAAE;IAC9F,MAAM,EAAE,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC,EAAE,EAAE,CAChC,WAAC,CAAA,gBAAgB,IAAI,CAAC,OAAc,CAAC,CAAC,KAAK,YAAY,UAAU,GAAG;CACvE,CAAA;AAEY,QAAA,qBAAqB,GAA0B;IAC1D,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;IAC1B,IAAI,EAAE,QAAQ;I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O,MAAM,IAAI,QAAQ;gBACzB,MAAM,YAAY,MAAM;gBACxB,OAAO,MAAM,CAAC,OAAO,IAAI,UAAU,EACnC;gBACA,MAAM,IAAI,KAAK,CAAC,IAAI,OAAO,cAAc,MAAM,sCAAsC,CAAC,CAAA;aACvF;YACD,MAAM,GAAG,GAAG,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE;gBACpC,GAAG,EAAE,MAAM;gBACX,GAAG,EAAE,MAAM;gBACX,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,WAAC,CAAA,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,GAAG,qBAAW,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;aACpF,CAAC,CAAA;YAEF,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAA;QACjC,CAAC;QAED,SAAS,WAAW,CAAC,GAAS;YAC5B,OAAO,WAAC,CAAA,GAAG,GAAG,YAAY,IAAI,KAAK,UAAU,KAAK,IAAI,CAAC,OAAc,CAAC,CAAC,IAAI,IAAI,CAAA;QACjF,CAAC;IACH,CAAC;IACD,YAAY,EAAE,CAAC,QAAQ,CAAC;CACzB,CAAA;AAED,MAAM,iBAAiB,GAAsB,CAAC,GAAQ,EAAO,EAAE;IAC7D,GAAG,CAAC,UAAU,CAAC,6BAAqB,CAAC,CAAA;IACrC,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,kBAAe,iBAAiB,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/.runkit_example.js b/node_modules/ajv-formats/node_modules/ajv/.runkit_example.js new file mode 100644 index 000000000..0d578d5d5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/.runkit_example.js @@ -0,0 +1,23 @@ +const Ajv = require("ajv") +const ajv = new Ajv({allErrors: true}) + +const schema = { + type: "object", + properties: { + foo: {type: "string"}, + bar: {type: "number", maximum: 3}, + }, + required: ["foo", "bar"], + additionalProperties: false, +} + +const validate = ajv.compile(schema) + +test({foo: "abc", bar: 2}) +test({foo: 2, bar: 4}) + +function test(data) { + const valid = validate(data) + if (valid) console.log("Valid!") + else console.log("Invalid: " + ajv.errorsText(validate.errors)) +} diff --git a/node_modules/ajv-formats/node_modules/ajv/LICENSE b/node_modules/ajv-formats/node_modules/ajv/LICENSE new file mode 100644 index 000000000..139162ad2 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015-2021 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/node_modules/ajv-formats/node_modules/ajv/README.md b/node_modules/ajv-formats/node_modules/ajv/README.md new file mode 100644 index 000000000..aa3baaab5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/README.md @@ -0,0 +1,193 @@ +Ajv logo + +  + +# Ajv JSON schema validator + +The fastest JSON validator for Node.js and browser. + +Supports JSON Schema draft-04/06/07/2019-09/2020-12 ([draft-04 support](https://ajv.js.org/json-schema.html#draft-04) requires ajv-draft-04 package) and JSON Type Definition [RFC8927](https://datatracker.ietf.org/doc/rfc8927/). + +[![build](https://github.com/ajv-validator/ajv/workflows/build/badge.svg)](https://github.com/ajv-validator/ajv/actions?query=workflow%3Abuild) +[![npm](https://img.shields.io/npm/v/ajv.svg)](https://www.npmjs.com/package/ajv) +[![npm downloads](https://img.shields.io/npm/dm/ajv.svg)](https://www.npmjs.com/package/ajv) +[![Coverage Status](https://coveralls.io/repos/github/ajv-validator/ajv/badge.svg?branch=master)](https://coveralls.io/github/ajv-validator/ajv?branch=master) +[![SimpleX](https://img.shields.io/badge/chat-on%20SimpleX-%2307b4b9)](https://simplex.chat/contact#/?v=1&smp=smp%3A%2F%2Fu2dS9sG8nMNURyZwqASV4yROM28Er0luVTx5X1CsMrU%3D%40smp4.simplex.im%2Fap4lMFzfXF8Hzmh-Vz0WNxp_1jKiOa-h%23MCowBQYDK2VuAyEAcdefddRvDfI8iAuBpztm_J3qFucj8MDZoVs_2EcMTzU%3D) +[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv) +[![GitHub Sponsors](https://img.shields.io/badge/$-sponsors-brightgreen)](https://github.com/sponsors/epoberezkin) + +## Ajv sponsors + +[Mozilla](https://www.mozilla.org)[](https://opencollective.com/ajv) + +[Microsoft](https://opensource.microsoft.com)[](https://opencollective.com/ajv)[](https://opencollective.com/ajv) + +[Retool](https://retool.com/?utm_source=sponsor&utm_campaign=ajv)[Tidelift](https://tidelift.com/subscription/pkg/npm-ajv?utm_source=npm-ajv&utm_medium=referral&utm_campaign=enterprise)[SimpleX](https://github.com/simplex-chat/simplex-chat)[](https://opencollective.com/ajv) + +## Contributing + +More than 100 people contributed to Ajv, and we would love to have you join the development. We welcome implementing new features that will benefit many users and ideas to improve our documentation. + +Please review [Contributing guidelines](./CONTRIBUTING.md) and [Code components](https://ajv.js.org/components.html). + +## Documentation + +All documentation is available on the [Ajv website](https://ajv.js.org). + +Some useful site links: +- [Getting started](https://ajv.js.org/guide/getting-started.html) +- [JSON Schema vs JSON Type Definition](https://ajv.js.org/guide/schema-language.html) +- [API reference](https://ajv.js.org/api.html) +- [Strict mode](https://ajv.js.org/strict-mode.html) +- [Standalone validation code](https://ajv.js.org/standalone.html) +- [Security considerations](https://ajv.js.org/security.html) +- [Command line interface](https://ajv.js.org/packages/ajv-cli.html) +- [Frequently Asked Questions](https://ajv.js.org/faq.html) + +## Please [sponsor Ajv development](https://github.com/sponsors/epoberezkin) + +Since I asked to support Ajv development 40 people and 6 organizations contributed via GitHub and OpenCollective - this support helped receiving the MOSS grant! + +Your continuing support is very important - the funds will be used to develop and maintain Ajv once the next major version is released. + +Please sponsor Ajv via: + +- [GitHub sponsors page](https://github.com/sponsors/epoberezkin) (GitHub will match it) +- [Ajv Open Collective️](https://opencollective.com/ajv) + +Thank you. + +#### Open Collective sponsors + + + + + + + + + + + + + + + + +## Performance + +Ajv generates code to turn JSON Schemas into super-fast validation functions that are efficient for v8 optimization. + +Currently Ajv is the fastest and the most standard compliant validator according to these benchmarks: + +- [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark) - 50% faster than the second place +- [jsck benchmark](https://github.com/pandastrike/jsck#benchmarks) - 20-190% faster +- [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html) +- [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html) + +Performance of different validators by [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark): + +[![performance](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=62,4,1&chs=600x416&chxl=-1:|ajv|@exodus/schemasafe|is-my-json-valid|djv|@cfworker/json-schema|jsonschema&chd=t:100,69.2,51.5,13.1,5.1,1.2)](https://github.com/ebdrup/json-schema-benchmark/blob/master/README.md#performance) + +## Features + +- Ajv implements JSON Schema [draft-06/07/2019-09/2020-12](http://json-schema.org/) standards (draft-04 is supported in v6): + - all validation keywords (see [JSON Schema validation keywords](https://ajv.js.org/json-schema.html)) + - [OpenAPI](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md) extensions: + - NEW: keyword [discriminator](https://ajv.js.org/json-schema.html#discriminator). + - keyword [nullable](https://ajv.js.org/json-schema.html#nullable). + - full support of remote references (remote schemas have to be added with `addSchema` or compiled to be available) + - support of recursive references between schemas + - correct string lengths for strings with unicode pairs + - JSON Schema [formats](https://ajv.js.org/guide/formats.html) (with [ajv-formats](https://github.com/ajv-validator/ajv-formats) plugin). + - [validates schemas against meta-schema](https://ajv.js.org/api.html#api-validateschema) +- NEW: supports [JSON Type Definition](https://datatracker.ietf.org/doc/rfc8927/): + - all keywords (see [JSON Type Definition schema forms](https://ajv.js.org/json-type-definition.html)) + - meta-schema for JTD schemas + - "union" keyword and user-defined keywords (can be used inside "metadata" member of the schema) +- supports [browsers](https://ajv.js.org/guide/environments.html#browsers) and Node.js 10.x - current +- [asynchronous loading](https://ajv.js.org/guide/managing-schemas.html#asynchronous-schema-loading) of referenced schemas during compilation +- "All errors" validation mode with [option allErrors](https://ajv.js.org/options.html#allerrors) +- [error messages with parameters](https://ajv.js.org/api.html#validation-errors) describing error reasons to allow error message generation +- i18n error messages support with [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) package +- [removing-additional-properties](https://ajv.js.org/guide/modifying-data.html#removing-additional-properties) +- [assigning defaults](https://ajv.js.org/guide/modifying-data.html#assigning-defaults) to missing properties and items +- [coercing data](https://ajv.js.org/guide/modifying-data.html#coercing-data-types) to the types specified in `type` keywords +- [user-defined keywords](https://ajv.js.org/guide/user-keywords.html) +- additional extension keywords with [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package +- [\$data reference](https://ajv.js.org/guide/combining-schemas.html#data-reference) to use values from the validated data as values for the schema keywords +- [asynchronous validation](https://ajv.js.org/guide/async-validation.html) of user-defined formats and keywords + +## Install + +To install version 8: + +``` +npm install ajv +``` + +## Getting started + +Try it in the Node.js REPL: https://runkit.com/npm/ajv + +In JavaScript: + +```javascript +// or ESM/TypeScript import +import Ajv from "ajv" +// Node.js require: +const Ajv = require("ajv") + +const ajv = new Ajv() // options can be passed, e.g. {allErrors: true} + +const schema = { + type: "object", + properties: { + foo: {type: "integer"}, + bar: {type: "string"} + }, + required: ["foo"], + additionalProperties: false, +} + +const data = { + foo: 1, + bar: "abc" +} + +const validate = ajv.compile(schema) +const valid = validate(data) +if (!valid) console.log(validate.errors) +``` + +Learn how to use Ajv and see more examples in the [Guide: getting started](https://ajv.js.org/guide/getting-started.html) + +## Changes history + +See [https://github.com/ajv-validator/ajv/releases](https://github.com/ajv-validator/ajv/releases) + +**Please note**: [Changes in version 8.0.0](https://github.com/ajv-validator/ajv/releases/tag/v8.0.0) + +[Version 7.0.0](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0) + +[Version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0). + +## Code of conduct + +Please review and follow the [Code of conduct](./CODE_OF_CONDUCT.md). + +Please report any unacceptable behaviour to ajv.validator@gmail.com - it will be reviewed by the project team. + +## Security contact + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerabilities via GitHub issues. + +## Open-source software support + +Ajv is a part of [Tidelift subscription](https://tidelift.com/subscription/pkg/npm-ajv?utm_source=npm-ajv&utm_medium=referral&utm_campaign=readme) - it provides a centralised support to open-source software users, in addition to the support provided by software maintainers. + +## License + +[MIT](./LICENSE) diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/2019.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/2019.d.ts new file mode 100644 index 000000000..5a391dd6e --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/2019.d.ts @@ -0,0 +1,17 @@ +import type { AnySchemaObject } from "./types"; +import AjvCore, { Options } from "./core"; +declare class Ajv2019 extends AjvCore { + constructor(opts?: Options); + _addVocabularies(): void; + _addDefaultMetaSchema(): void; + defaultMeta(): string | AnySchemaObject | undefined; +} +export default Ajv2019; +export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, ErrorNoParams, } from "./types"; +export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core"; +export { SchemaCxt, SchemaObjCxt } from "./compile"; +export { KeywordCxt } from "./compile/validate"; +export { DefinedError } from "./vocabularies/errors"; +export { JSONType } from "./compile/rules"; +export { JSONSchemaType } from "./types/json-schema"; +export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/2019.js b/node_modules/ajv-formats/node_modules/ajv/dist/2019.js new file mode 100644 index 000000000..89d78532f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/2019.js @@ -0,0 +1,55 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0; +const core_1 = require("./core"); +const draft7_1 = require("./vocabularies/draft7"); +const dynamic_1 = require("./vocabularies/dynamic"); +const next_1 = require("./vocabularies/next"); +const unevaluated_1 = require("./vocabularies/unevaluated"); +const discriminator_1 = require("./vocabularies/discriminator"); +const json_schema_2019_09_1 = require("./refs/json-schema-2019-09"); +const META_SCHEMA_ID = "https://json-schema.org/draft/2019-09/schema"; +class Ajv2019 extends core_1.default { + constructor(opts = {}) { + super({ + ...opts, + dynamicRef: true, + next: true, + unevaluated: true, + }); + } + _addVocabularies() { + super._addVocabularies(); + this.addVocabulary(dynamic_1.default); + draft7_1.default.forEach((v) => this.addVocabulary(v)); + this.addVocabulary(next_1.default); + this.addVocabulary(unevaluated_1.default); + if (this.opts.discriminator) + this.addKeyword(discriminator_1.default); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + const { $data, meta } = this.opts; + if (!meta) + return; + json_schema_2019_09_1.default.call(this, $data); + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID; + } + defaultMeta() { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); + } +} +module.exports = exports = Ajv2019; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = Ajv2019; +var validate_1 = require("./compile/validate"); +Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +//# sourceMappingURL=2019.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/2019.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/2019.js.map new file mode 100644 index 000000000..8e4e87cae --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/2019.js.map @@ -0,0 +1 @@ +{"version":3,"file":"2019.js","sourceRoot":"","sources":["../lib/2019.ts"],"names":[],"mappings":";;;AACA,iCAAuC;AAEvC,kDAAsD;AACtD,oDAAsD;AACtD,8CAAgD;AAChD,4DAA8D;AAC9D,gEAAwD;AACxD,oEAA0D;AAE1D,MAAM,cAAc,GAAG,8CAA8C,CAAA;AAErE,MAAM,OAAQ,SAAQ,cAAO;IAC3B,YAAY,OAAgB,EAAE;QAC5B,KAAK,CAAC;YACJ,GA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AA6C;AAArC,sGAAA,UAAU,OAAA;AAIlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/2020.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/2020.d.ts new file mode 100644 index 000000000..21bae8f60 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/2020.d.ts @@ -0,0 +1,17 @@ +import type { AnySchemaObject } from "./types"; +import AjvCore, { Options } from "./core"; +declare class Ajv2020 extends AjvCore { + constructor(opts?: Options); + _addVocabularies(): void; + _addDefaultMetaSchema(): void; + defaultMeta(): string | AnySchemaObject | undefined; +} +export default Ajv2020; +export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, ErrorNoParams, } from "./types"; +export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core"; +export { SchemaCxt, SchemaObjCxt } from "./compile"; +export { KeywordCxt } from "./compile/validate"; +export { DefinedError } from "./vocabularies/errors"; +export { JSONType } from "./compile/rules"; +export { JSONSchemaType } from "./types/json-schema"; +export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/2020.js b/node_modules/ajv-formats/node_modules/ajv/dist/2020.js new file mode 100644 index 000000000..bdd1dd69d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/2020.js @@ -0,0 +1,49 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0; +const core_1 = require("./core"); +const draft2020_1 = require("./vocabularies/draft2020"); +const discriminator_1 = require("./vocabularies/discriminator"); +const json_schema_2020_12_1 = require("./refs/json-schema-2020-12"); +const META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema"; +class Ajv2020 extends core_1.default { + constructor(opts = {}) { + super({ + ...opts, + dynamicRef: true, + next: true, + unevaluated: true, + }); + } + _addVocabularies() { + super._addVocabularies(); + draft2020_1.default.forEach((v) => this.addVocabulary(v)); + if (this.opts.discriminator) + this.addKeyword(discriminator_1.default); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + const { $data, meta } = this.opts; + if (!meta) + return; + json_schema_2020_12_1.default.call(this, $data); + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID; + } + defaultMeta() { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); + } +} +module.exports = exports = Ajv2020; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = Ajv2020; +var validate_1 = require("./compile/validate"); +Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +//# sourceMappingURL=2020.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/2020.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/2020.js.map new file mode 100644 index 000000000..922393521 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/2020.js.map @@ -0,0 +1 @@ +{"version":3,"file":"2020.js","sourceRoot":"","sources":["../lib/2020.ts"],"names":[],"mappings":";;;AACA,iCAAuC;AAEvC,wDAA4D;AAC5D,gEAAwD;AACxD,oEAA0D;AAE1D,MAAM,cAAc,GAAG,8CAA8C,CAAA;AAErE,MAAM,OAAQ,SAAQ,cAAO;IAC3B,YAAY,OAAgB,EAAE;QAC5B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,IAAI;YACV,WAAW,EAAE,IAAI;SAClB,CAAC,CAAA;IACJ,CAAC;IAED,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,mBAAqB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QAC3D,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,UAAU,CAAC,uBAAa,CAAC,CAAA;IAC7D,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,MAAM,EAAC,KAAK,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;QAC/B,IAAI,CAAC,IAAI;YAAE,OAAM;QACjB,6BAAiB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACnC,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,GAAG,cAAc,CAAA;IAC7D,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;YAC3B,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IACzF,CAAC;CACF;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,OAAO,CAAA;AAClC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,OAAO,CAAA;AAyBtB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAIlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/ajv.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/ajv.d.ts new file mode 100644 index 000000000..ce43bbf2e --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/ajv.d.ts @@ -0,0 +1,16 @@ +import type { AnySchemaObject } from "./types"; +import AjvCore from "./core"; +declare class Ajv extends AjvCore { + _addVocabularies(): void; + _addDefaultMetaSchema(): void; + defaultMeta(): string | AnySchemaObject | undefined; +} +export default Ajv; +export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, SchemaValidateFunction, ErrorObject, ErrorNoParams, } from "./types"; +export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core"; +export { SchemaCxt, SchemaObjCxt } from "./compile"; +export { KeywordCxt } from "./compile/validate"; +export { DefinedError } from "./vocabularies/errors"; +export { JSONType } from "./compile/rules"; +export { JSONSchemaType } from "./types/json-schema"; +export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/ajv.js b/node_modules/ajv-formats/node_modules/ajv/dist/ajv.js new file mode 100644 index 000000000..219bcf0da --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/ajv.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0; +const core_1 = require("./core"); +const draft7_1 = require("./vocabularies/draft7"); +const discriminator_1 = require("./vocabularies/discriminator"); +const draft7MetaSchema = require("./refs/json-schema-draft-07.json"); +const META_SUPPORT_DATA = ["/properties"]; +const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema"; +class Ajv extends core_1.default { + _addVocabularies() { + super._addVocabularies(); + draft7_1.default.forEach((v) => this.addVocabulary(v)); + if (this.opts.discriminator) + this.addKeyword(discriminator_1.default); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + if (!this.opts.meta) + return; + const metaSchema = this.opts.$data + ? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA) + : draft7MetaSchema; + this.addMetaSchema(metaSchema, META_SCHEMA_ID, false); + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID; + } + defaultMeta() { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); + } +} +module.exports = exports = Ajv; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = Ajv; +var validate_1 = require("./compile/validate"); +Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +//# sourceMappingURL=ajv.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/ajv.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/ajv.js.map new file mode 100644 index 000000000..18006d4b7 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/ajv.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ajv.js","sourceRoot":"","sources":["../lib/ajv.ts"],"names":[],"mappings":";;;AACA,iCAA4B;AAC5B,kDAAsD;AACtD,gEAAwD;AACxD,qEAAoE;AAEpE,MAAM,iBAAiB,GAAG,CAAC,aAAa,CAAC,CAAA;AAEzC,MAAM,cAAc,GAAG,wCAAwC,CAAA;AAE/D,MAAM,GAAI,SAAQ,cAAO;IACvB,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,gBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QACxD,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,UAAU,CAAC,uBAAa,CAAC,CAAA;IAC7D,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAM;QAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK;YAChC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;YAC3D,CAAC,CAAC,gBAAgB,CAAA;QACpB,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,cAAc,EAAE,KAAK,CAAC,CAAA;QACrD,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,GAAG,cAAc,CAAA;IAC7D,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;YAC3B,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IACzF,CAAC;CACF;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,GAAG,CAAA;AAC9B,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,GAAG,CAAA;AA0BlB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAIlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.d.ts new file mode 100644 index 000000000..8023c1817 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.d.ts @@ -0,0 +1,40 @@ +export declare abstract class _CodeOrName { + abstract readonly str: string; + abstract readonly names: UsedNames; + abstract toString(): string; + abstract emptyStr(): boolean; +} +export declare const IDENTIFIER: RegExp; +export declare class Name extends _CodeOrName { + readonly str: string; + constructor(s: string); + toString(): string; + emptyStr(): boolean; + get names(): UsedNames; +} +export declare class _Code extends _CodeOrName { + readonly _items: readonly CodeItem[]; + private _str?; + private _names?; + constructor(code: string | readonly CodeItem[]); + toString(): string; + emptyStr(): boolean; + get str(): string; + get names(): UsedNames; +} +export declare type CodeItem = Name | string | number | boolean | null; +export declare type UsedNames = Record; +export declare type Code = _Code | Name; +export declare type SafeExpr = Code | number | boolean | null; +export declare const nil: _Code; +declare type CodeArg = SafeExpr | string | undefined; +export declare function _(strs: TemplateStringsArray, ...args: CodeArg[]): _Code; +export declare function str(strs: TemplateStringsArray, ...args: (CodeArg | string[])[]): _Code; +export declare function addCodeArg(code: CodeItem[], arg: CodeArg | string[]): void; +export declare function strConcat(c1: Code, c2: Code): Code; +export declare function stringify(x: unknown): Code; +export declare function safeStringify(x: unknown): string; +export declare function getProperty(key: Code | string | number): Code; +export declare function getEsmExportName(key: Code | string | number): Code; +export declare function regexpCode(rx: RegExp): Code; +export {}; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js new file mode 100644 index 000000000..f8268838a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js @@ -0,0 +1,155 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0; +class _CodeOrName { +} +exports._CodeOrName = _CodeOrName; +exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; +class Name extends _CodeOrName { + constructor(s) { + super(); + if (!exports.IDENTIFIER.test(s)) + throw new Error("CodeGen: name must be a valid identifier"); + this.str = s; + } + toString() { + return this.str; + } + emptyStr() { + return false; + } + get names() { + return { [this.str]: 1 }; + } +} +exports.Name = Name; +class _Code extends _CodeOrName { + constructor(code) { + super(); + this._items = typeof code === "string" ? [code] : code; + } + toString() { + return this.str; + } + emptyStr() { + if (this._items.length > 1) + return false; + const item = this._items[0]; + return item === "" || item === '""'; + } + get str() { + var _a; + return ((_a = this._str) !== null && _a !== void 0 ? _a : (this._str = this._items.reduce((s, c) => `${s}${c}`, ""))); + } + get names() { + var _a; + return ((_a = this._names) !== null && _a !== void 0 ? _a : (this._names = this._items.reduce((names, c) => { + if (c instanceof Name) + names[c.str] = (names[c.str] || 0) + 1; + return names; + }, {}))); + } +} +exports._Code = _Code; +exports.nil = new _Code(""); +function _(strs, ...args) { + const code = [strs[0]]; + let i = 0; + while (i < args.length) { + addCodeArg(code, args[i]); + code.push(strs[++i]); + } + return new _Code(code); +} +exports._ = _; +const plus = new _Code("+"); +function str(strs, ...args) { + const expr = [safeStringify(strs[0])]; + let i = 0; + while (i < args.length) { + expr.push(plus); + addCodeArg(expr, args[i]); + expr.push(plus, safeStringify(strs[++i])); + } + optimize(expr); + return new _Code(expr); +} +exports.str = str; +function addCodeArg(code, arg) { + if (arg instanceof _Code) + code.push(...arg._items); + else if (arg instanceof Name) + code.push(arg); + else + code.push(interpolate(arg)); +} +exports.addCodeArg = addCodeArg; +function optimize(expr) { + let i = 1; + while (i < expr.length - 1) { + if (expr[i] === plus) { + const res = mergeExprItems(expr[i - 1], expr[i + 1]); + if (res !== undefined) { + expr.splice(i - 1, 3, res); + continue; + } + expr[i++] = "+"; + } + i++; + } +} +function mergeExprItems(a, b) { + if (b === '""') + return a; + if (a === '""') + return b; + if (typeof a == "string") { + if (b instanceof Name || a[a.length - 1] !== '"') + return; + if (typeof b != "string") + return `${a.slice(0, -1)}${b}"`; + if (b[0] === '"') + return a.slice(0, -1) + b.slice(1); + return; + } + if (typeof b == "string" && b[0] === '"' && !(a instanceof Name)) + return `"${a}${b.slice(1)}`; + return; +} +function strConcat(c1, c2) { + return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str `${c1}${c2}`; +} +exports.strConcat = strConcat; +// TODO do not allow arrays here +function interpolate(x) { + return typeof x == "number" || typeof x == "boolean" || x === null + ? x + : safeStringify(Array.isArray(x) ? x.join(",") : x); +} +function stringify(x) { + return new _Code(safeStringify(x)); +} +exports.stringify = stringify; +function safeStringify(x) { + return JSON.stringify(x) + .replace(/\u2028/g, "\\u2028") + .replace(/\u2029/g, "\\u2029"); +} +exports.safeStringify = safeStringify; +function getProperty(key) { + return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`; +} +exports.getProperty = getProperty; +//Does best effort to format the name properly +function getEsmExportName(key) { + if (typeof key == "string" && exports.IDENTIFIER.test(key)) { + return new _Code(`${key}`); + } + throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`); +} +exports.getEsmExportName = getEsmExportName; +function regexpCode(rx) { + return new _Code(rx.toString()); +} +exports.regexpCode = regexpCode; +//# sourceMappingURL=code.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js.map new file mode 100644 index 000000000..c5c7a3961 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/code.js.map @@ -0,0 +1 @@ +{"version":3,"file":"code.js","sourceRoot":"","sources":["../../../lib/compile/codegen/code.ts"],"names":[],"mappings":";;;AAAA,MAAsB,WAAW;CAKhC;AALD,kCAKC;AAEY,QAAA,UAAU,GAAG,uBAAuB,CAAA;AAEjD,MAAa,IAAK,SAAQ,WAAW;IAEnC,YAAY,CAAS;QACnB,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,kBAAU,CAAC,IAAI,CAAC,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;QACpF,IAAI,CAAC,GAAG,GAAG,CAAC,CAAA;IACd,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,GAAG,CAAA;IACjB,CAAC;IAED,QAAQ;QACN,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,KAAK;QACP,OAAO,EAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAC,CAAA;IACxB,CAAC;CACF;AAnBD,oBAmBC;AAED,MAAa,KAAM,SAAQ,WAAW;IAKpC,YAAY,IAAkC;QAC5C,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,MAAM,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,C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AAC5F,CAAC;AAFD,kCAEC;AAED,8CAA8C;AAC9C,SAAgB,gBAAgB,CAAC,GAA2B;IAC1D,IAAI,OAAO,GAAG,IAAI,QAAQ,IAAI,kBAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAClD,OAAO,IAAI,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,CAAA;KAC3B;IACD,MAAM,IAAI,KAAK,CAAC,iCAAiC,GAAG,iCAAiC,CAAC,CAAA;AACxF,CAAC;AALD,4CAKC;AAED,SAAgB,UAAU,CAAC,EAAU;IACnC,OAAO,IAAI,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAA;AACjC,CAAC;AAFD,gCAEC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/index.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/index.d.ts new file mode 100644 index 000000000..db9101ddb --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/index.d.ts @@ -0,0 +1,79 @@ +import type { ScopeValueSets, NameValue, ValueScope, ValueScopeName } from "./scope"; +import { _Code, Code, Name } from "./code"; +import { Scope } from "./scope"; +export { _, str, strConcat, nil, getProperty, stringify, regexpCode, Name, Code } from "./code"; +export { Scope, ScopeStore, ValueScope, ValueScopeName, ScopeValueSets, varKinds } from "./scope"; +export declare type SafeExpr = Code | number | boolean | null; +export declare type Block = Code | (() => void); +export declare const operators: { + GT: _Code; + GTE: _Code; + LT: _Code; + LTE: _Code; + EQ: _Code; + NEQ: _Code; + NOT: _Code; + OR: _Code; + AND: _Code; + ADD: _Code; +}; +export interface CodeGenOptions { + es5?: boolean; + lines?: boolean; + ownProperties?: boolean; +} +export declare class CodeGen { + readonly _scope: Scope; + readonly _extScope: ValueScope; + readonly _values: ScopeValueSets; + private readonly _nodes; + private readonly _blockStarts; + private readonly _constants; + private readonly opts; + constructor(extScope: ValueScope, opts?: CodeGenOptions); + toString(): string; + name(prefix: string): Name; + scopeName(prefix: string): ValueScopeName; + scopeValue(prefixOrName: ValueScopeName | string, value: NameValue): Name; + getScopeValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined; + scopeRefs(scopeName: Name): Code; + scopeCode(): Code; + private _def; + const(nameOrPrefix: Name | string, rhs: SafeExpr, _constant?: boolean): Name; + let(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name; + var(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name; + assign(lhs: Code, rhs: SafeExpr, sideEffects?: boolean): CodeGen; + add(lhs: Code, rhs: SafeExpr): CodeGen; + code(c: Block | SafeExpr): CodeGen; + object(...keyValues: [Name | string, SafeExpr | string][]): _Code; + if(condition: Code | boolean, thenBody?: Block, elseBody?: Block): CodeGen; + elseIf(condition: Code | boolean): CodeGen; + else(): CodeGen; + endIf(): CodeGen; + private _for; + for(iteration: Code, forBody?: Block): CodeGen; + forRange(nameOrPrefix: Name | string, from: SafeExpr, to: SafeExpr, forBody: (index: Name) => void, varKind?: Code): CodeGen; + forOf(nameOrPrefix: Name | string, iterable: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen; + forIn(nameOrPrefix: Name | string, obj: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen; + endFor(): CodeGen; + label(label: Name): CodeGen; + break(label?: Code): CodeGen; + return(value: Block | SafeExpr): CodeGen; + try(tryBody: Block, catchCode?: (e: Name) => void, finallyCode?: Block): CodeGen; + throw(error: Code): CodeGen; + block(body?: Block, nodeCount?: number): CodeGen; + endBlock(nodeCount?: number): CodeGen; + func(name: Name, args?: Code, async?: boolean, funcBody?: Block): CodeGen; + endFunc(): CodeGen; + optimize(n?: number): void; + private _leafNode; + private _blockNode; + private _endBlockNode; + private _elseNode; + private get _root(); + private get _currNode(); + private set _currNode(value); +} +export declare function not(x: T): T; +export declare function and(...args: Code[]): Code; +export declare function or(...args: Code[]): Code; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/index.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/index.js new file mode 100644 index 000000000..a6c805af1 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/index.js @@ -0,0 +1,697 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0; +const code_1 = require("./code"); +const scope_1 = require("./scope"); +var code_2 = require("./code"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return code_2._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return code_2.str; } }); +Object.defineProperty(exports, "strConcat", { enumerable: true, get: function () { return code_2.strConcat; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return code_2.nil; } }); +Object.defineProperty(exports, "getProperty", { enumerable: true, get: function () { return code_2.getProperty; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return code_2.stringify; } }); +Object.defineProperty(exports, "regexpCode", { enumerable: true, get: function () { return code_2.regexpCode; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return code_2.Name; } }); +var scope_2 = require("./scope"); +Object.defineProperty(exports, "Scope", { enumerable: true, get: function () { return scope_2.Scope; } }); +Object.defineProperty(exports, "ValueScope", { enumerable: true, get: function () { return scope_2.ValueScope; } }); +Object.defineProperty(exports, "ValueScopeName", { enumerable: true, get: function () { return scope_2.ValueScopeName; } }); +Object.defineProperty(exports, "varKinds", { enumerable: true, get: function () { return scope_2.varKinds; } }); +exports.operators = { + GT: new code_1._Code(">"), + GTE: new code_1._Code(">="), + LT: new code_1._Code("<"), + LTE: new code_1._Code("<="), + EQ: new code_1._Code("==="), + NEQ: new code_1._Code("!=="), + NOT: new code_1._Code("!"), + OR: new code_1._Code("||"), + AND: new code_1._Code("&&"), + ADD: new code_1._Code("+"), +}; +class Node { + optimizeNodes() { + return this; + } + optimizeNames(_names, _constants) { + return this; + } +} +class Def extends Node { + constructor(varKind, name, rhs) { + super(); + this.varKind = varKind; + this.name = name; + this.rhs = rhs; + } + render({ es5, _n }) { + const varKind = es5 ? scope_1.varKinds.var : this.varKind; + const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}`; + return `${varKind} ${this.name}${rhs};` + _n; + } + optimizeNames(names, constants) { + if (!names[this.name.str]) + return; + if (this.rhs) + this.rhs = optimizeExpr(this.rhs, names, constants); + return this; + } + get names() { + return this.rhs instanceof code_1._CodeOrName ? this.rhs.names : {}; + } +} +class Assign extends Node { + constructor(lhs, rhs, sideEffects) { + super(); + this.lhs = lhs; + this.rhs = rhs; + this.sideEffects = sideEffects; + } + render({ _n }) { + return `${this.lhs} = ${this.rhs};` + _n; + } + optimizeNames(names, constants) { + if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects) + return; + this.rhs = optimizeExpr(this.rhs, names, constants); + return this; + } + get names() { + const names = this.lhs instanceof code_1.Name ? {} : { ...this.lhs.names }; + return addExprNames(names, this.rhs); + } +} +class AssignOp extends Assign { + constructor(lhs, op, rhs, sideEffects) { + super(lhs, rhs, sideEffects); + this.op = op; + } + render({ _n }) { + return `${this.lhs} ${this.op}= ${this.rhs};` + _n; + } +} +class Label extends Node { + constructor(label) { + super(); + this.label = label; + this.names = {}; + } + render({ _n }) { + return `${this.label}:` + _n; + } +} +class Break extends Node { + constructor(label) { + super(); + this.label = label; + this.names = {}; + } + render({ _n }) { + const label = this.label ? ` ${this.label}` : ""; + return `break${label};` + _n; + } +} +class Throw extends Node { + constructor(error) { + super(); + this.error = error; + } + render({ _n }) { + return `throw ${this.error};` + _n; + } + get names() { + return this.error.names; + } +} +class AnyCode extends Node { + constructor(code) { + super(); + this.code = code; + } + render({ _n }) { + return `${this.code};` + _n; + } + optimizeNodes() { + return `${this.code}` ? this : undefined; + } + optimizeNames(names, constants) { + this.code = optimizeExpr(this.code, names, constants); + return this; + } + get names() { + return this.code instanceof code_1._CodeOrName ? this.code.names : {}; + } +} +class ParentNode extends Node { + constructor(nodes = []) { + super(); + this.nodes = nodes; + } + render(opts) { + return this.nodes.reduce((code, n) => code + n.render(opts), ""); + } + optimizeNodes() { + const { nodes } = this; + let i = nodes.length; + while (i--) { + const n = nodes[i].optimizeNodes(); + if (Array.isArray(n)) + nodes.splice(i, 1, ...n); + else if (n) + nodes[i] = n; + else + nodes.splice(i, 1); + } + return nodes.length > 0 ? this : undefined; + } + optimizeNames(names, constants) { + const { nodes } = this; + let i = nodes.length; + while (i--) { + // iterating backwards improves 1-pass optimization + const n = nodes[i]; + if (n.optimizeNames(names, constants)) + continue; + subtractNames(names, n.names); + nodes.splice(i, 1); + } + return nodes.length > 0 ? this : undefined; + } + get names() { + return this.nodes.reduce((names, n) => addNames(names, n.names), {}); + } +} +class BlockNode extends ParentNode { + render(opts) { + return "{" + opts._n + super.render(opts) + "}" + opts._n; + } +} +class Root extends ParentNode { +} +class Else extends BlockNode { +} +Else.kind = "else"; +class If extends BlockNode { + constructor(condition, nodes) { + super(nodes); + this.condition = condition; + } + render(opts) { + let code = `if(${this.condition})` + super.render(opts); + if (this.else) + code += "else " + this.else.render(opts); + return code; + } + optimizeNodes() { + super.optimizeNodes(); + const cond = this.condition; + if (cond === true) + return this.nodes; // else is ignored here + let e = this.else; + if (e) { + const ns = e.optimizeNodes(); + e = this.else = Array.isArray(ns) ? new Else(ns) : ns; + } + if (e) { + if (cond === false) + return e instanceof If ? e : e.nodes; + if (this.nodes.length) + return this; + return new If(not(cond), e instanceof If ? [e] : e.nodes); + } + if (cond === false || !this.nodes.length) + return undefined; + return this; + } + optimizeNames(names, constants) { + var _a; + this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants); + if (!(super.optimizeNames(names, constants) || this.else)) + return; + this.condition = optimizeExpr(this.condition, names, constants); + return this; + } + get names() { + const names = super.names; + addExprNames(names, this.condition); + if (this.else) + addNames(names, this.else.names); + return names; + } +} +If.kind = "if"; +class For extends BlockNode { +} +For.kind = "for"; +class ForLoop extends For { + constructor(iteration) { + super(); + this.iteration = iteration; + } + render(opts) { + return `for(${this.iteration})` + super.render(opts); + } + optimizeNames(names, constants) { + if (!super.optimizeNames(names, constants)) + return; + this.iteration = optimizeExpr(this.iteration, names, constants); + return this; + } + get names() { + return addNames(super.names, this.iteration.names); + } +} +class ForRange extends For { + constructor(varKind, name, from, to) { + super(); + this.varKind = varKind; + this.name = name; + this.from = from; + this.to = to; + } + render(opts) { + const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind; + const { name, from, to } = this; + return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts); + } + get names() { + const names = addExprNames(super.names, this.from); + return addExprNames(names, this.to); + } +} +class ForIter extends For { + constructor(loop, varKind, name, iterable) { + super(); + this.loop = loop; + this.varKind = varKind; + this.name = name; + this.iterable = iterable; + } + render(opts) { + return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts); + } + optimizeNames(names, constants) { + if (!super.optimizeNames(names, constants)) + return; + this.iterable = optimizeExpr(this.iterable, names, constants); + return this; + } + get names() { + return addNames(super.names, this.iterable.names); + } +} +class Func extends BlockNode { + constructor(name, args, async) { + super(); + this.name = name; + this.args = args; + this.async = async; + } + render(opts) { + const _async = this.async ? "async " : ""; + return `${_async}function ${this.name}(${this.args})` + super.render(opts); + } +} +Func.kind = "func"; +class Return extends ParentNode { + render(opts) { + return "return " + super.render(opts); + } +} +Return.kind = "return"; +class Try extends BlockNode { + render(opts) { + let code = "try" + super.render(opts); + if (this.catch) + code += this.catch.render(opts); + if (this.finally) + code += this.finally.render(opts); + return code; + } + optimizeNodes() { + var _a, _b; + super.optimizeNodes(); + (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNodes(); + (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes(); + return this; + } + optimizeNames(names, constants) { + var _a, _b; + super.optimizeNames(names, constants); + (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants); + (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants); + return this; + } + get names() { + const names = super.names; + if (this.catch) + addNames(names, this.catch.names); + if (this.finally) + addNames(names, this.finally.names); + return names; + } +} +class Catch extends BlockNode { + constructor(error) { + super(); + this.error = error; + } + render(opts) { + return `catch(${this.error})` + super.render(opts); + } +} +Catch.kind = "catch"; +class Finally extends BlockNode { + render(opts) { + return "finally" + super.render(opts); + } +} +Finally.kind = "finally"; +class CodeGen { + constructor(extScope, opts = {}) { + this._values = {}; + this._blockStarts = []; + this._constants = {}; + this.opts = { ...opts, _n: opts.lines ? "\n" : "" }; + this._extScope = extScope; + this._scope = new scope_1.Scope({ parent: extScope }); + this._nodes = [new Root()]; + } + toString() { + return this._root.render(this.opts); + } + // returns unique name in the internal scope + name(prefix) { + return this._scope.name(prefix); + } + // reserves unique name in the external scope + scopeName(prefix) { + return this._extScope.name(prefix); + } + // reserves unique name in the external scope and assigns value to it + scopeValue(prefixOrName, value) { + const name = this._extScope.value(prefixOrName, value); + const vs = this._values[name.prefix] || (this._values[name.prefix] = new Set()); + vs.add(name); + return name; + } + getScopeValue(prefix, keyOrRef) { + return this._extScope.getValue(prefix, keyOrRef); + } + // return code that assigns values in the external scope to the names that are used internally + // (same names that were returned by gen.scopeName or gen.scopeValue) + scopeRefs(scopeName) { + return this._extScope.scopeRefs(scopeName, this._values); + } + scopeCode() { + return this._extScope.scopeCode(this._values); + } + _def(varKind, nameOrPrefix, rhs, constant) { + const name = this._scope.toName(nameOrPrefix); + if (rhs !== undefined && constant) + this._constants[name.str] = rhs; + this._leafNode(new Def(varKind, name, rhs)); + return name; + } + // `const` declaration (`var` in es5 mode) + const(nameOrPrefix, rhs, _constant) { + return this._def(scope_1.varKinds.const, nameOrPrefix, rhs, _constant); + } + // `let` declaration with optional assignment (`var` in es5 mode) + let(nameOrPrefix, rhs, _constant) { + return this._def(scope_1.varKinds.let, nameOrPrefix, rhs, _constant); + } + // `var` declaration with optional assignment + var(nameOrPrefix, rhs, _constant) { + return this._def(scope_1.varKinds.var, nameOrPrefix, rhs, _constant); + } + // assignment code + assign(lhs, rhs, sideEffects) { + return this._leafNode(new Assign(lhs, rhs, sideEffects)); + } + // `+=` code + add(lhs, rhs) { + return this._leafNode(new AssignOp(lhs, exports.operators.ADD, rhs)); + } + // appends passed SafeExpr to code or executes Block + code(c) { + if (typeof c == "function") + c(); + else if (c !== code_1.nil) + this._leafNode(new AnyCode(c)); + return this; + } + // returns code for object literal for the passed argument list of key-value pairs + object(...keyValues) { + const code = ["{"]; + for (const [key, value] of keyValues) { + if (code.length > 1) + code.push(","); + code.push(key); + if (key !== value || this.opts.es5) { + code.push(":"); + (0, code_1.addCodeArg)(code, value); + } + } + code.push("}"); + return new code_1._Code(code); + } + // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed) + if(condition, thenBody, elseBody) { + this._blockNode(new If(condition)); + if (thenBody && elseBody) { + this.code(thenBody).else().code(elseBody).endIf(); + } + else if (thenBody) { + this.code(thenBody).endIf(); + } + else if (elseBody) { + throw new Error('CodeGen: "else" body without "then" body'); + } + return this; + } + // `else if` clause - invalid without `if` or after `else` clauses + elseIf(condition) { + return this._elseNode(new If(condition)); + } + // `else` clause - only valid after `if` or `else if` clauses + else() { + return this._elseNode(new Else()); + } + // end `if` statement (needed if gen.if was used only with condition) + endIf() { + return this._endBlockNode(If, Else); + } + _for(node, forBody) { + this._blockNode(node); + if (forBody) + this.code(forBody).endFor(); + return this; + } + // a generic `for` clause (or statement if `forBody` is passed) + for(iteration, forBody) { + return this._for(new ForLoop(iteration), forBody); + } + // `for` statement for a range of values + forRange(nameOrPrefix, from, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) { + const name = this._scope.toName(nameOrPrefix); + return this._for(new ForRange(varKind, name, from, to), () => forBody(name)); + } + // `for-of` statement (in es5 mode replace with a normal for loop) + forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) { + const name = this._scope.toName(nameOrPrefix); + if (this.opts.es5) { + const arr = iterable instanceof code_1.Name ? iterable : this.var("_arr", iterable); + return this.forRange("_i", 0, (0, code_1._) `${arr}.length`, (i) => { + this.var(name, (0, code_1._) `${arr}[${i}]`); + forBody(name); + }); + } + return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name)); + } + // `for-in` statement. + // With option `ownProperties` replaced with a `for-of` loop for object keys + forIn(nameOrPrefix, obj, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.const) { + if (this.opts.ownProperties) { + return this.forOf(nameOrPrefix, (0, code_1._) `Object.keys(${obj})`, forBody); + } + const name = this._scope.toName(nameOrPrefix); + return this._for(new ForIter("in", varKind, name, obj), () => forBody(name)); + } + // end `for` loop + endFor() { + return this._endBlockNode(For); + } + // `label` statement + label(label) { + return this._leafNode(new Label(label)); + } + // `break` statement + break(label) { + return this._leafNode(new Break(label)); + } + // `return` statement + return(value) { + const node = new Return(); + this._blockNode(node); + this.code(value); + if (node.nodes.length !== 1) + throw new Error('CodeGen: "return" should have one node'); + return this._endBlockNode(Return); + } + // `try` statement + try(tryBody, catchCode, finallyCode) { + if (!catchCode && !finallyCode) + throw new Error('CodeGen: "try" without "catch" and "finally"'); + const node = new Try(); + this._blockNode(node); + this.code(tryBody); + if (catchCode) { + const error = this.name("e"); + this._currNode = node.catch = new Catch(error); + catchCode(error); + } + if (finallyCode) { + this._currNode = node.finally = new Finally(); + this.code(finallyCode); + } + return this._endBlockNode(Catch, Finally); + } + // `throw` statement + throw(error) { + return this._leafNode(new Throw(error)); + } + // start self-balancing block + block(body, nodeCount) { + this._blockStarts.push(this._nodes.length); + if (body) + this.code(body).endBlock(nodeCount); + return this; + } + // end the current self-balancing block + endBlock(nodeCount) { + const len = this._blockStarts.pop(); + if (len === undefined) + throw new Error("CodeGen: not in self-balancing block"); + const toClose = this._nodes.length - len; + if (toClose < 0 || (nodeCount !== undefined && toClose !== nodeCount)) { + throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`); + } + this._nodes.length = len; + return this; + } + // `function` heading (or definition if funcBody is passed) + func(name, args = code_1.nil, async, funcBody) { + this._blockNode(new Func(name, args, async)); + if (funcBody) + this.code(funcBody).endFunc(); + return this; + } + // end function definition + endFunc() { + return this._endBlockNode(Func); + } + optimize(n = 1) { + while (n-- > 0) { + this._root.optimizeNodes(); + this._root.optimizeNames(this._root.names, this._constants); + } + } + _leafNode(node) { + this._currNode.nodes.push(node); + return this; + } + _blockNode(node) { + this._currNode.nodes.push(node); + this._nodes.push(node); + } + _endBlockNode(N1, N2) { + const n = this._currNode; + if (n instanceof N1 || (N2 && n instanceof N2)) { + this._nodes.pop(); + return this; + } + throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`); + } + _elseNode(node) { + const n = this._currNode; + if (!(n instanceof If)) { + throw new Error('CodeGen: "else" without "if"'); + } + this._currNode = n.else = node; + return this; + } + get _root() { + return this._nodes[0]; + } + get _currNode() { + const ns = this._nodes; + return ns[ns.length - 1]; + } + set _currNode(node) { + const ns = this._nodes; + ns[ns.length - 1] = node; + } +} +exports.CodeGen = CodeGen; +function addNames(names, from) { + for (const n in from) + names[n] = (names[n] || 0) + (from[n] || 0); + return names; +} +function addExprNames(names, from) { + return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names; +} +function optimizeExpr(expr, names, constants) { + if (expr instanceof code_1.Name) + return replaceName(expr); + if (!canOptimize(expr)) + return expr; + return new code_1._Code(expr._items.reduce((items, c) => { + if (c instanceof code_1.Name) + c = replaceName(c); + if (c instanceof code_1._Code) + items.push(...c._items); + else + items.push(c); + return items; + }, [])); + function replaceName(n) { + const c = constants[n.str]; + if (c === undefined || names[n.str] !== 1) + return n; + delete names[n.str]; + return c; + } + function canOptimize(e) { + return (e instanceof code_1._Code && + e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants[c.str] !== undefined)); + } +} +function subtractNames(names, from) { + for (const n in from) + names[n] = (names[n] || 0) - (from[n] || 0); +} +function not(x) { + return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._) `!${par(x)}`; +} +exports.not = not; +const andCode = mappend(exports.operators.AND); +// boolean AND (&&) expression with the passed arguments +function and(...args) { + return args.reduce(andCode); +} +exports.and = and; +const orCode = mappend(exports.operators.OR); +// boolean OR (||) expression with the passed arguments +function or(...args) { + return args.reduce(orCode); +} +exports.or = or; +function mappend(op) { + return (x, y) => (x === code_1.nil ? y : y === code_1.nil ? x : (0, code_1._) `${par(x)} ${op} ${par(y)}`); +} +function par(x) { + return x instanceof code_1.Name ? x : (0, code_1._) `(${x})`; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/index.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/index.js.map new file mode 100644 index 000000000..f3826d283 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/compile/codegen/index.ts"],"names":[],"mappings":";;;AACA,iCAA8F;AAC9F,mCAAuC;AAEvC,+BAA6F;AAArF,yFAAA,CAAC,OAAA;AAAE,2FAAA,GAAG,OAAA;AAAE,iGAAA,SAAS,OAAA;AAAE,2FAAA,GAAG,OAAA;AAAE,mGAAA,WAAW,OAAA;AAAE,iGAAA,SAAS,OAAA;AAAE,kGAAA,UAAU,OAAA;AAAE,4FAAA,IAAI,OAAA;AACxE,iCAA+F;AAAvF,8FAAA,KAAK,OAAA;AAAc,mGAAA,UAAU,OAAA;AAAE,uGAAA,cAAc,OAAA;AAAkB,iGAAA,QAAQ,OAAA;AAQlE,QAAA,SAAS,GAAG;IACvB,EAAE,EAAE,IAAI,YAAK,CAAC,GAAG,CAAC;IAClB,GAAG,EAAE,IAAI,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AC,CAAC,CAAC,IAAA,QAAC,EAAA,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;AACjF,CAAC;AAED,SAAS,GAAG,CAAC,CAAO;IAClB,OAAO,CAAC,YAAY,WAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,QAAC,EAAA,IAAI,CAAC,GAAG,CAAA;AAC1C,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/scope.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/scope.d.ts new file mode 100644 index 000000000..3c351bb63 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/scope.d.ts @@ -0,0 +1,79 @@ +import { Code, Name } from "./code"; +interface NameGroup { + prefix: string; + index: number; +} +export interface NameValue { + ref: ValueReference; + key?: unknown; + code?: Code; +} +export declare type ValueReference = unknown; +interface ScopeOptions { + prefixes?: Set; + parent?: Scope; +} +interface ValueScopeOptions extends ScopeOptions { + scope: ScopeStore; + es5?: boolean; + lines?: boolean; +} +export declare type ScopeStore = Record; +declare type ScopeValues = { + [Prefix in string]?: Map; +}; +export declare type ScopeValueSets = { + [Prefix in string]?: Set; +}; +export declare enum UsedValueState { + Started = 0, + Completed = 1 +} +export declare type UsedScopeValues = { + [Prefix in string]?: Map; +}; +export declare const varKinds: { + const: Name; + let: Name; + var: Name; +}; +export declare class Scope { + protected readonly _names: { + [Prefix in string]?: NameGroup; + }; + protected readonly _prefixes?: Set; + protected readonly _parent?: Scope; + constructor({ prefixes, parent }?: ScopeOptions); + toName(nameOrPrefix: Name | string): Name; + name(prefix: string): Name; + protected _newName(prefix: string): string; + private _nameGroup; +} +interface ScopePath { + property: string; + itemIndex: number; +} +export declare class ValueScopeName extends Name { + readonly prefix: string; + value?: NameValue; + scopePath?: Code; + constructor(prefix: string, nameStr: string); + setValue(value: NameValue, { property, itemIndex }: ScopePath): void; +} +interface VSOptions extends ValueScopeOptions { + _n: Code; +} +export declare class ValueScope extends Scope { + protected readonly _values: ScopeValues; + protected readonly _scope: ScopeStore; + readonly opts: VSOptions; + constructor(opts: ValueScopeOptions); + get(): ScopeStore; + name(prefix: string): ValueScopeName; + value(nameOrPrefix: ValueScopeName | string, value: NameValue): ValueScopeName; + getValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined; + scopeRefs(scopeName: Name, values?: ScopeValues | ScopeValueSets): Code; + scopeCode(values?: ScopeValues | ScopeValueSets, usedValues?: UsedScopeValues, getCode?: (n: ValueScopeName) => Code | undefined): Code; + private _reduceValues; +} +export {}; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/scope.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/scope.js new file mode 100644 index 000000000..acc5f7626 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/scope.js @@ -0,0 +1,143 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0; +const code_1 = require("./code"); +class ValueError extends Error { + constructor(name) { + super(`CodeGen: "code" for ${name} not defined`); + this.value = name.value; + } +} +var UsedValueState; +(function (UsedValueState) { + UsedValueState[UsedValueState["Started"] = 0] = "Started"; + UsedValueState[UsedValueState["Completed"] = 1] = "Completed"; +})(UsedValueState = exports.UsedValueState || (exports.UsedValueState = {})); +exports.varKinds = { + const: new code_1.Name("const"), + let: new code_1.Name("let"), + var: new code_1.Name("var"), +}; +class Scope { + constructor({ prefixes, parent } = {}) { + this._names = {}; + this._prefixes = prefixes; + this._parent = parent; + } + toName(nameOrPrefix) { + return nameOrPrefix instanceof code_1.Name ? nameOrPrefix : this.name(nameOrPrefix); + } + name(prefix) { + return new code_1.Name(this._newName(prefix)); + } + _newName(prefix) { + const ng = this._names[prefix] || this._nameGroup(prefix); + return `${prefix}${ng.index++}`; + } + _nameGroup(prefix) { + var _a, _b; + if (((_b = (_a = this._parent) === null || _a === void 0 ? void 0 : _a._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || (this._prefixes && !this._prefixes.has(prefix))) { + throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`); + } + return (this._names[prefix] = { prefix, index: 0 }); + } +} +exports.Scope = Scope; +class ValueScopeName extends code_1.Name { + constructor(prefix, nameStr) { + super(nameStr); + this.prefix = prefix; + } + setValue(value, { property, itemIndex }) { + this.value = value; + this.scopePath = (0, code_1._) `.${new code_1.Name(property)}[${itemIndex}]`; + } +} +exports.ValueScopeName = ValueScopeName; +const line = (0, code_1._) `\n`; +class ValueScope extends Scope { + constructor(opts) { + super(opts); + this._values = {}; + this._scope = opts.scope; + this.opts = { ...opts, _n: opts.lines ? line : code_1.nil }; + } + get() { + return this._scope; + } + name(prefix) { + return new ValueScopeName(prefix, this._newName(prefix)); + } + value(nameOrPrefix, value) { + var _a; + if (value.ref === undefined) + throw new Error("CodeGen: ref must be passed in value"); + const name = this.toName(nameOrPrefix); + const { prefix } = name; + const valueKey = (_a = value.key) !== null && _a !== void 0 ? _a : value.ref; + let vs = this._values[prefix]; + if (vs) { + const _name = vs.get(valueKey); + if (_name) + return _name; + } + else { + vs = this._values[prefix] = new Map(); + } + vs.set(valueKey, name); + const s = this._scope[prefix] || (this._scope[prefix] = []); + const itemIndex = s.length; + s[itemIndex] = value.ref; + name.setValue(value, { property: prefix, itemIndex }); + return name; + } + getValue(prefix, keyOrRef) { + const vs = this._values[prefix]; + if (!vs) + return; + return vs.get(keyOrRef); + } + scopeRefs(scopeName, values = this._values) { + return this._reduceValues(values, (name) => { + if (name.scopePath === undefined) + throw new Error(`CodeGen: name "${name}" has no value`); + return (0, code_1._) `${scopeName}${name.scopePath}`; + }); + } + scopeCode(values = this._values, usedValues, getCode) { + return this._reduceValues(values, (name) => { + if (name.value === undefined) + throw new Error(`CodeGen: name "${name}" has no value`); + return name.value.code; + }, usedValues, getCode); + } + _reduceValues(values, valueCode, usedValues = {}, getCode) { + let code = code_1.nil; + for (const prefix in values) { + const vs = values[prefix]; + if (!vs) + continue; + const nameSet = (usedValues[prefix] = usedValues[prefix] || new Map()); + vs.forEach((name) => { + if (nameSet.has(name)) + return; + nameSet.set(name, UsedValueState.Started); + let c = valueCode(name); + if (c) { + const def = this.opts.es5 ? exports.varKinds.var : exports.varKinds.const; + code = (0, code_1._) `${code}${def} ${name} = ${c};${this.opts._n}`; + } + else if ((c = getCode === null || getCode === void 0 ? void 0 : getCode(name))) { + code = (0, code_1._) `${code}${c}${this.opts._n}`; + } + else { + throw new ValueError(name); + } + nameSet.set(name, UsedValueState.Completed); + }); + } + return code; + } +} +exports.ValueScope = ValueScope; +//# sourceMappingURL=scope.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/scope.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/scope.js.map new file mode 100644 index 000000000..7afde1060 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/codegen/scope.js.map @@ -0,0 +1 @@ +{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../../lib/compile/codegen/scope.ts"],"names":[],"mappings":";;;AAAA,iCAAyC;AAezC,MAAM,UAAW,SAAQ,KAAK;IAE5B,YAAY,IAAoB;QAC9B,KAAK,CAAC,uBAAuB,IAAI,cAAc,CAAC,CAAA;QAChD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;IACzB,CAAC;CACF;AAuBD,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yDAAO,CAAA;IACP,6DAAS,CAAA;AACX,CAAC,EAHW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAGzB;AAMY,QAAA,QAAQ,GAAG;IACtB,KAAK,EAAE,IAAI,WAAI,CAAC,OAAO,CAAC;IACxB,GAAG,EAAE,IAAI,WAAI,CAAC,KAAK,CAAC;IACpB,GAAG,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AAG,IAAI,GAAG,GAAG,IAAI,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAA;iBACvD;qBAAM,IAAI,CAAC,CAAC,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,IAAI,CAAC,CAAC,EAAE;oBAChC,IAAI,GAAG,IAAA,QAAC,EAAA,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAA;iBACrC;qBAAM;oBACL,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,CAAA;iBAC3B;gBACD,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;YAC7C,CAAC,CAAC,CAAA;SACH;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAjGD,gCAiGC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/errors.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/errors.d.ts new file mode 100644 index 000000000..74eef7e21 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/errors.d.ts @@ -0,0 +1,13 @@ +import type { KeywordErrorCxt, KeywordErrorDefinition } from "../types"; +import { CodeGen, Code, Name } from "./codegen"; +export declare const keywordError: KeywordErrorDefinition; +export declare const keyword$DataError: KeywordErrorDefinition; +export interface ErrorPaths { + instancePath?: Code; + schemaPath?: string; + parentSchema?: boolean; +} +export declare function reportError(cxt: KeywordErrorCxt, error?: KeywordErrorDefinition, errorPaths?: ErrorPaths, overrideAllErrors?: boolean): void; +export declare function reportExtraError(cxt: KeywordErrorCxt, error?: KeywordErrorDefinition, errorPaths?: ErrorPaths): void; +export declare function resetErrorsCount(gen: CodeGen, errsCount: Name): void; +export declare function extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }: KeywordErrorCxt): void; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/errors.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/errors.js new file mode 100644 index 000000000..e2aca7b93 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/errors.js @@ -0,0 +1,123 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0; +const codegen_1 = require("./codegen"); +const util_1 = require("./util"); +const names_1 = require("./names"); +exports.keywordError = { + message: ({ keyword }) => (0, codegen_1.str) `must pass "${keyword}" keyword validation`, +}; +exports.keyword$DataError = { + message: ({ keyword, schemaType }) => schemaType + ? (0, codegen_1.str) `"${keyword}" keyword must be ${schemaType} ($data)` + : (0, codegen_1.str) `"${keyword}" keyword is invalid ($data)`, +}; +function reportError(cxt, error = exports.keywordError, errorPaths, overrideAllErrors) { + const { it } = cxt; + const { gen, compositeRule, allErrors } = it; + const errObj = errorObjectCode(cxt, error, errorPaths); + if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : (compositeRule || allErrors)) { + addError(gen, errObj); + } + else { + returnErrors(it, (0, codegen_1._) `[${errObj}]`); + } +} +exports.reportError = reportError; +function reportExtraError(cxt, error = exports.keywordError, errorPaths) { + const { it } = cxt; + const { gen, compositeRule, allErrors } = it; + const errObj = errorObjectCode(cxt, error, errorPaths); + addError(gen, errObj); + if (!(compositeRule || allErrors)) { + returnErrors(it, names_1.default.vErrors); + } +} +exports.reportExtraError = reportExtraError; +function resetErrorsCount(gen, errsCount) { + gen.assign(names_1.default.errors, errsCount); + gen.if((0, codegen_1._) `${names_1.default.vErrors} !== null`, () => gen.if(errsCount, () => gen.assign((0, codegen_1._) `${names_1.default.vErrors}.length`, errsCount), () => gen.assign(names_1.default.vErrors, null))); +} +exports.resetErrorsCount = resetErrorsCount; +function extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }) { + /* istanbul ignore if */ + if (errsCount === undefined) + throw new Error("ajv implementation error"); + const err = gen.name("err"); + gen.forRange("i", errsCount, names_1.default.errors, (i) => { + gen.const(err, (0, codegen_1._) `${names_1.default.vErrors}[${i}]`); + gen.if((0, codegen_1._) `${err}.instancePath === undefined`, () => gen.assign((0, codegen_1._) `${err}.instancePath`, (0, codegen_1.strConcat)(names_1.default.instancePath, it.errorPath))); + gen.assign((0, codegen_1._) `${err}.schemaPath`, (0, codegen_1.str) `${it.errSchemaPath}/${keyword}`); + if (it.opts.verbose) { + gen.assign((0, codegen_1._) `${err}.schema`, schemaValue); + gen.assign((0, codegen_1._) `${err}.data`, data); + } + }); +} +exports.extendErrors = extendErrors; +function addError(gen, errObj) { + const err = gen.const("err", errObj); + gen.if((0, codegen_1._) `${names_1.default.vErrors} === null`, () => gen.assign(names_1.default.vErrors, (0, codegen_1._) `[${err}]`), (0, codegen_1._) `${names_1.default.vErrors}.push(${err})`); + gen.code((0, codegen_1._) `${names_1.default.errors}++`); +} +function returnErrors(it, errs) { + const { gen, validateName, schemaEnv } = it; + if (schemaEnv.$async) { + gen.throw((0, codegen_1._) `new ${it.ValidationError}(${errs})`); + } + else { + gen.assign((0, codegen_1._) `${validateName}.errors`, errs); + gen.return(false); + } +} +const E = { + keyword: new codegen_1.Name("keyword"), + schemaPath: new codegen_1.Name("schemaPath"), + params: new codegen_1.Name("params"), + propertyName: new codegen_1.Name("propertyName"), + message: new codegen_1.Name("message"), + schema: new codegen_1.Name("schema"), + parentSchema: new codegen_1.Name("parentSchema"), +}; +function errorObjectCode(cxt, error, errorPaths) { + const { createErrors } = cxt.it; + if (createErrors === false) + return (0, codegen_1._) `{}`; + return errorObject(cxt, error, errorPaths); +} +function errorObject(cxt, error, errorPaths = {}) { + const { gen, it } = cxt; + const keyValues = [ + errorInstancePath(it, errorPaths), + errorSchemaPath(cxt, errorPaths), + ]; + extraErrorProps(cxt, error, keyValues); + return gen.object(...keyValues); +} +function errorInstancePath({ errorPath }, { instancePath }) { + const instPath = instancePath + ? (0, codegen_1.str) `${errorPath}${(0, util_1.getErrorPath)(instancePath, util_1.Type.Str)}` + : errorPath; + return [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, instPath)]; +} +function errorSchemaPath({ keyword, it: { errSchemaPath } }, { schemaPath, parentSchema }) { + let schPath = parentSchema ? errSchemaPath : (0, codegen_1.str) `${errSchemaPath}/${keyword}`; + if (schemaPath) { + schPath = (0, codegen_1.str) `${schPath}${(0, util_1.getErrorPath)(schemaPath, util_1.Type.Str)}`; + } + return [E.schemaPath, schPath]; +} +function extraErrorProps(cxt, { params, message }, keyValues) { + const { keyword, data, schemaValue, it } = cxt; + const { opts, propertyName, topSchemaRef, schemaPath } = it; + keyValues.push([E.keyword, keyword], [E.params, typeof params == "function" ? params(cxt) : params || (0, codegen_1._) `{}`]); + if (opts.messages) { + keyValues.push([E.message, typeof message == "function" ? message(cxt) : message]); + } + if (opts.verbose) { + keyValues.push([E.schema, schemaValue], [E.parentSchema, (0, codegen_1._) `${topSchemaRef}${schemaPath}`], [names_1.default.data, data]); + } + if (propertyName) + keyValues.push([E.propertyName, propertyName]); +} +//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/errors.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/errors.js.map new file mode 100644 index 000000000..662089108 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/errors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../lib/compile/errors.ts"],"names":[],"mappings":";;;AAEA,uCAAgE;AAEhE,iCAAyC;AACzC,mCAAuB;AAEV,QAAA,YAAY,GAA2B;IAClD,OAAO,EAAE,CAAC,EAAC,OAAO,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,cAAc,OAAO,sBAAsB;CACvE,CAAA;AAEY,QAAA,iBAAiB,GAA2B;IACvD,OAAO,EAAE,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC,EAAE,EAAE,CACjC,UAAU;QACR,CAA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AO,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;KACnF;IACD,IAAI,IAAI,CAAC,OAAO,EAAE;QAChB,SAAS,CAAC,IAAI,CACZ,CAAC,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,EACvB,CAAC,CAAC,CAAC,YAAY,EAAE,IAAA,WAAC,EAAA,GAAG,YAAY,GAAG,UAAU,EAAE,CAAC,EACjD,CAAC,eAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CACf,CAAA;KACF;IACD,IAAI,YAAY;QAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAA;AAClE,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.d.ts new file mode 100644 index 000000000..ca8920ab4 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.d.ts @@ -0,0 +1,80 @@ +import type { AnySchema, AnySchemaObject, AnyValidateFunction, EvaluatedProperties, EvaluatedItems } from "../types"; +import type Ajv from "../core"; +import type { InstanceOptions } from "../core"; +import { CodeGen, Name, Code, ValueScopeName } from "./codegen"; +import { LocalRefs } from "./resolve"; +import { JSONType } from "./rules"; +export declare type SchemaRefs = { + [Ref in string]?: SchemaEnv | AnySchema; +}; +export interface SchemaCxt { + readonly gen: CodeGen; + readonly allErrors?: boolean; + readonly data: Name; + readonly parentData: Name; + readonly parentDataProperty: Code | number; + readonly dataNames: Name[]; + readonly dataPathArr: (Code | number)[]; + readonly dataLevel: number; + dataTypes: JSONType[]; + definedProperties: Set; + readonly topSchemaRef: Code; + readonly validateName: Name; + evaluated?: Name; + readonly ValidationError?: Name; + readonly schema: AnySchema; + readonly schemaEnv: SchemaEnv; + readonly rootId: string; + baseId: string; + readonly schemaPath: Code; + readonly errSchemaPath: string; + readonly errorPath: Code; + readonly propertyName?: Name; + readonly compositeRule?: boolean; + props?: EvaluatedProperties | Name; + items?: EvaluatedItems | Name; + jtdDiscriminator?: string; + jtdMetadata?: boolean; + readonly createErrors?: boolean; + readonly opts: InstanceOptions; + readonly self: Ajv; +} +export interface SchemaObjCxt extends SchemaCxt { + readonly schema: AnySchemaObject; +} +interface SchemaEnvArgs { + readonly schema: AnySchema; + readonly schemaId?: "$id" | "id"; + readonly root?: SchemaEnv; + readonly baseId?: string; + readonly schemaPath?: string; + readonly localRefs?: LocalRefs; + readonly meta?: boolean; +} +export declare class SchemaEnv implements SchemaEnvArgs { + readonly schema: AnySchema; + readonly schemaId?: "$id" | "id"; + readonly root: SchemaEnv; + baseId: string; + schemaPath?: string; + localRefs?: LocalRefs; + readonly meta?: boolean; + readonly $async?: boolean; + readonly refs: SchemaRefs; + readonly dynamicAnchors: { + [Ref in string]?: true; + }; + validate?: AnyValidateFunction; + validateName?: ValueScopeName; + serialize?: (data: unknown) => string; + serializeName?: ValueScopeName; + parse?: (data: string) => unknown; + parseName?: ValueScopeName; + constructor(env: SchemaEnvArgs); +} +export declare function compileSchema(this: Ajv, sch: SchemaEnv): SchemaEnv; +export declare function resolveRef(this: Ajv, root: SchemaEnv, baseId: string, ref: string): AnySchema | SchemaEnv | undefined; +export declare function getCompilingSchema(this: Ajv, schEnv: SchemaEnv): SchemaEnv | void; +export declare function resolveSchema(this: Ajv, root: SchemaEnv, // root object with properties schema, refs TODO below SchemaEnv is assigned to it +ref: string): SchemaEnv | undefined; +export {}; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.js new file mode 100644 index 000000000..b125ecd02 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.js @@ -0,0 +1,242 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.resolveSchema = exports.getCompilingSchema = exports.resolveRef = exports.compileSchema = exports.SchemaEnv = void 0; +const codegen_1 = require("./codegen"); +const validation_error_1 = require("../runtime/validation_error"); +const names_1 = require("./names"); +const resolve_1 = require("./resolve"); +const util_1 = require("./util"); +const validate_1 = require("./validate"); +class SchemaEnv { + constructor(env) { + var _a; + this.refs = {}; + this.dynamicAnchors = {}; + let schema; + if (typeof env.schema == "object") + schema = env.schema; + this.schema = env.schema; + this.schemaId = env.schemaId; + this.root = env.root || this; + this.baseId = (_a = env.baseId) !== null && _a !== void 0 ? _a : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]); + this.schemaPath = env.schemaPath; + this.localRefs = env.localRefs; + this.meta = env.meta; + this.$async = schema === null || schema === void 0 ? void 0 : schema.$async; + this.refs = {}; + } +} +exports.SchemaEnv = SchemaEnv; +// let codeSize = 0 +// let nodeCount = 0 +// Compiles schema in SchemaEnv +function compileSchema(sch) { + // TODO refactor - remove compilations + const _sch = getCompilingSchema.call(this, sch); + if (_sch) + return _sch; + const rootId = (0, resolve_1.getFullPath)(this.opts.uriResolver, sch.root.baseId); // TODO if getFullPath removed 1 tests fails + const { es5, lines } = this.opts.code; + const { ownProperties } = this.opts; + const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties }); + let _ValidationError; + if (sch.$async) { + _ValidationError = gen.scopeValue("Error", { + ref: validation_error_1.default, + code: (0, codegen_1._) `require("ajv/dist/runtime/validation_error").default`, + }); + } + const validateName = gen.scopeName("validate"); + sch.validateName = validateName; + const schemaCxt = { + gen, + allErrors: this.opts.allErrors, + data: names_1.default.data, + parentData: names_1.default.parentData, + parentDataProperty: names_1.default.parentDataProperty, + dataNames: [names_1.default.data], + dataPathArr: [codegen_1.nil], + dataLevel: 0, + dataTypes: [], + definedProperties: new Set(), + topSchemaRef: gen.scopeValue("schema", this.opts.code.source === true + ? { ref: sch.schema, code: (0, codegen_1.stringify)(sch.schema) } + : { ref: sch.schema }), + validateName, + ValidationError: _ValidationError, + schema: sch.schema, + schemaEnv: sch, + rootId, + baseId: sch.baseId || rootId, + schemaPath: codegen_1.nil, + errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"), + errorPath: (0, codegen_1._) `""`, + opts: this.opts, + self: this, + }; + let sourceCode; + try { + this._compilations.add(sch); + (0, validate_1.validateFunctionCode)(schemaCxt); + gen.optimize(this.opts.code.optimize); + // gen.optimize(1) + const validateCode = gen.toString(); + sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${validateCode}`; + // console.log((codeSize += sourceCode.length), (nodeCount += gen.nodeCount)) + if (this.opts.code.process) + sourceCode = this.opts.code.process(sourceCode, sch); + // console.log("\n\n\n *** \n", sourceCode) + const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode); + const validate = makeValidate(this, this.scope.get()); + this.scope.value(validateName, { ref: validate }); + validate.errors = null; + validate.schema = sch.schema; + validate.schemaEnv = sch; + if (sch.$async) + validate.$async = true; + if (this.opts.code.source === true) { + validate.source = { validateName, validateCode, scopeValues: gen._values }; + } + if (this.opts.unevaluated) { + const { props, items } = schemaCxt; + validate.evaluated = { + props: props instanceof codegen_1.Name ? undefined : props, + items: items instanceof codegen_1.Name ? undefined : items, + dynamicProps: props instanceof codegen_1.Name, + dynamicItems: items instanceof codegen_1.Name, + }; + if (validate.source) + validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated); + } + sch.validate = validate; + return sch; + } + catch (e) { + delete sch.validate; + delete sch.validateName; + if (sourceCode) + this.logger.error("Error compiling schema, function code:", sourceCode); + // console.log("\n\n\n *** \n", sourceCode, this.opts) + throw e; + } + finally { + this._compilations.delete(sch); + } +} +exports.compileSchema = compileSchema; +function resolveRef(root, baseId, ref) { + var _a; + ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref); + const schOrFunc = root.refs[ref]; + if (schOrFunc) + return schOrFunc; + let _sch = resolve.call(this, root, ref); + if (_sch === undefined) { + const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv + const { schemaId } = this.opts; + if (schema) + _sch = new SchemaEnv({ schema, schemaId, root, baseId }); + } + if (_sch === undefined) + return; + return (root.refs[ref] = inlineOrCompile.call(this, _sch)); +} +exports.resolveRef = resolveRef; +function inlineOrCompile(sch) { + if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs)) + return sch.schema; + return sch.validate ? sch : compileSchema.call(this, sch); +} +// Index of schema compilation in the currently compiled list +function getCompilingSchema(schEnv) { + for (const sch of this._compilations) { + if (sameSchemaEnv(sch, schEnv)) + return sch; + } +} +exports.getCompilingSchema = getCompilingSchema; +function sameSchemaEnv(s1, s2) { + return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId; +} +// resolve and compile the references ($ref) +// TODO returns AnySchemaObject (if the schema can be inlined) or validation function +function resolve(root, // information about the root schema for the current schema +ref // reference to resolve +) { + let sch; + while (typeof (sch = this.refs[ref]) == "string") + ref = sch; + return sch || this.schemas[ref] || resolveSchema.call(this, root, ref); +} +// Resolve schema, its root and baseId +function resolveSchema(root, // root object with properties schema, refs TODO below SchemaEnv is assigned to it +ref // reference to resolve +) { + const p = this.opts.uriResolver.parse(ref); + const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p); + let baseId = (0, resolve_1.getFullPath)(this.opts.uriResolver, root.baseId, undefined); + // TODO `Object.keys(root.schema).length > 0` should not be needed - but removing breaks 2 tests + if (Object.keys(root.schema).length > 0 && refPath === baseId) { + return getJsonPointer.call(this, p, root); + } + const id = (0, resolve_1.normalizeId)(refPath); + const schOrRef = this.refs[id] || this.schemas[id]; + if (typeof schOrRef == "string") { + const sch = resolveSchema.call(this, root, schOrRef); + if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== "object") + return; + return getJsonPointer.call(this, p, sch); + } + if (typeof (schOrRef === null || schOrRef === void 0 ? void 0 : schOrRef.schema) !== "object") + return; + if (!schOrRef.validate) + compileSchema.call(this, schOrRef); + if (id === (0, resolve_1.normalizeId)(ref)) { + const { schema } = schOrRef; + const { schemaId } = this.opts; + const schId = schema[schemaId]; + if (schId) + baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId); + return new SchemaEnv({ schema, schemaId, root, baseId }); + } + return getJsonPointer.call(this, p, schOrRef); +} +exports.resolveSchema = resolveSchema; +const PREVENT_SCOPE_CHANGE = new Set([ + "properties", + "patternProperties", + "enum", + "dependencies", + "definitions", +]); +function getJsonPointer(parsedRef, { baseId, schema, root }) { + var _a; + if (((_a = parsedRef.fragment) === null || _a === void 0 ? void 0 : _a[0]) !== "/") + return; + for (const part of parsedRef.fragment.slice(1).split("/")) { + if (typeof schema === "boolean") + return; + const partSchema = schema[(0, util_1.unescapeFragment)(part)]; + if (partSchema === undefined) + return; + schema = partSchema; + // TODO PREVENT_SCOPE_CHANGE could be defined in keyword def? + const schId = typeof schema === "object" && schema[this.opts.schemaId]; + if (!PREVENT_SCOPE_CHANGE.has(part) && schId) { + baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId); + } + } + let env; + if (typeof schema != "boolean" && schema.$ref && !(0, util_1.schemaHasRulesButRef)(schema, this.RULES)) { + const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema.$ref); + env = resolveSchema.call(this, root, $ref); + } + // even though resolution failed we need to return SchemaEnv to throw exception + // so that compileAsync loads missing schema. + const { schemaId } = this.opts; + env = env || new SchemaEnv({ schema, schemaId, root, baseId }); + if (env.schema !== env.root.schema) + return env; + return undefined; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.js.map new file mode 100644 index 000000000..3fd890e67 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/compile/index.ts"],"names":[],"mappings":";;;A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,CAAC,IAAI,CAAC,IAAI,KAAK,EAAE;YAC5C,MAAM,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;SAC1D;KACF;IACD,IAAI,GAA0B,CAAA;IAC9B,IAAI,OAAO,MAAM,IAAI,SAAS,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,IAAA,2BAAoB,EAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE;QAC1F,MAAM,IAAI,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;QACnE,GAAG,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;KAC3C;IACD,+EAA+E;IAC/E,6CAA6C;IAC7C,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;IAC5B,GAAG,GAAG,GAAG,IAAI,IAAI,SAAS,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC,CAAA;IAC5D,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,MAAM;QAAE,OAAO,GAAG,CAAA;IAC9C,OAAO,SAAS,CAAA;AAClB,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/parse.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/parse.d.ts new file mode 100644 index 000000000..618c64aea --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/parse.d.ts @@ -0,0 +1,4 @@ +import type Ajv from "../../core"; +import { SchemaObjectMap } from "./types"; +import { SchemaEnv } from ".."; +export default function compileParser(this: Ajv, sch: SchemaEnv, definitions: SchemaObjectMap): SchemaEnv; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/parse.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/parse.js new file mode 100644 index 000000000..8fc94fd0e --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/parse.js @@ -0,0 +1,350 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const types_1 = require("./types"); +const __1 = require(".."); +const codegen_1 = require("../codegen"); +const ref_error_1 = require("../ref_error"); +const names_1 = require("../names"); +const code_1 = require("../../vocabularies/code"); +const ref_1 = require("../../vocabularies/jtd/ref"); +const type_1 = require("../../vocabularies/jtd/type"); +const parseJson_1 = require("../../runtime/parseJson"); +const util_1 = require("../util"); +const timestamp_1 = require("../../runtime/timestamp"); +const genParse = { + elements: parseElements, + values: parseValues, + discriminator: parseDiscriminator, + properties: parseProperties, + optionalProperties: parseProperties, + enum: parseEnum, + type: parseType, + ref: parseRef, +}; +function compileParser(sch, definitions) { + const _sch = __1.getCompilingSchema.call(this, sch); + if (_sch) + return _sch; + const { es5, lines } = this.opts.code; + const { ownProperties } = this.opts; + const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties }); + const parseName = gen.scopeName("parse"); + const cxt = { + self: this, + gen, + schema: sch.schema, + schemaEnv: sch, + definitions, + data: names_1.default.data, + parseName, + char: gen.name("c"), + }; + let sourceCode; + try { + this._compilations.add(sch); + sch.parseName = parseName; + parserFunction(cxt); + gen.optimize(this.opts.code.optimize); + const parseFuncCode = gen.toString(); + sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${parseFuncCode}`; + const makeParse = new Function(`${names_1.default.scope}`, sourceCode); + const parse = makeParse(this.scope.get()); + this.scope.value(parseName, { ref: parse }); + sch.parse = parse; + } + catch (e) { + if (sourceCode) + this.logger.error("Error compiling parser, function code:", sourceCode); + delete sch.parse; + delete sch.parseName; + throw e; + } + finally { + this._compilations.delete(sch); + } + return sch; +} +exports.default = compileParser; +const undef = (0, codegen_1._) `undefined`; +function parserFunction(cxt) { + const { gen, parseName, char } = cxt; + gen.func(parseName, (0, codegen_1._) `${names_1.default.json}, ${names_1.default.jsonPos}, ${names_1.default.jsonPart}`, false, () => { + gen.let(names_1.default.data); + gen.let(char); + gen.assign((0, codegen_1._) `${parseName}.message`, undef); + gen.assign((0, codegen_1._) `${parseName}.position`, undef); + gen.assign(names_1.default.jsonPos, (0, codegen_1._) `${names_1.default.jsonPos} || 0`); + gen.const(names_1.default.jsonLen, (0, codegen_1._) `${names_1.default.json}.length`); + parseCode(cxt); + skipWhitespace(cxt); + gen.if(names_1.default.jsonPart, () => { + gen.assign((0, codegen_1._) `${parseName}.position`, names_1.default.jsonPos); + gen.return(names_1.default.data); + }); + gen.if((0, codegen_1._) `${names_1.default.jsonPos} === ${names_1.default.jsonLen}`, () => gen.return(names_1.default.data)); + jsonSyntaxError(cxt); + }); +} +function parseCode(cxt) { + let form; + for (const key of types_1.jtdForms) { + if (key in cxt.schema) { + form = key; + break; + } + } + if (form) + parseNullable(cxt, genParse[form]); + else + parseEmpty(cxt); +} +const parseBoolean = parseBooleanToken(true, parseBooleanToken(false, jsonSyntaxError)); +function parseNullable(cxt, parseForm) { + const { gen, schema, data } = cxt; + if (!schema.nullable) + return parseForm(cxt); + tryParseToken(cxt, "null", parseForm, () => gen.assign(data, null)); +} +function parseElements(cxt) { + const { gen, schema, data } = cxt; + parseToken(cxt, "["); + const ix = gen.let("i", 0); + gen.assign(data, (0, codegen_1._) `[]`); + parseItems(cxt, "]", () => { + const el = gen.let("el"); + parseCode({ ...cxt, schema: schema.elements, data: el }); + gen.assign((0, codegen_1._) `${data}[${ix}++]`, el); + }); +} +function parseValues(cxt) { + const { gen, schema, data } = cxt; + parseToken(cxt, "{"); + gen.assign(data, (0, codegen_1._) `{}`); + parseItems(cxt, "}", () => parseKeyValue(cxt, schema.values)); +} +function parseItems(cxt, endToken, block) { + tryParseItems(cxt, endToken, block); + parseToken(cxt, endToken); +} +function tryParseItems(cxt, endToken, block) { + const { gen } = cxt; + gen.for((0, codegen_1._) `;${names_1.default.jsonPos}<${names_1.default.jsonLen} && ${jsonSlice(1)}!==${endToken};`, () => { + block(); + tryParseToken(cxt, ",", () => gen.break(), hasItem); + }); + function hasItem() { + tryParseToken(cxt, endToken, () => { }, jsonSyntaxError); + } +} +function parseKeyValue(cxt, schema) { + const { gen } = cxt; + const key = gen.let("key"); + parseString({ ...cxt, data: key }); + parseToken(cxt, ":"); + parsePropertyValue(cxt, key, schema); +} +function parseDiscriminator(cxt) { + const { gen, data, schema } = cxt; + const { discriminator, mapping } = schema; + parseToken(cxt, "{"); + gen.assign(data, (0, codegen_1._) `{}`); + const startPos = gen.const("pos", names_1.default.jsonPos); + const value = gen.let("value"); + const tag = gen.let("tag"); + tryParseItems(cxt, "}", () => { + const key = gen.let("key"); + parseString({ ...cxt, data: key }); + parseToken(cxt, ":"); + gen.if((0, codegen_1._) `${key} === ${discriminator}`, () => { + parseString({ ...cxt, data: tag }); + gen.assign((0, codegen_1._) `${data}[${key}]`, tag); + gen.break(); + }, () => parseEmpty({ ...cxt, data: value }) // can be discarded/skipped + ); + }); + gen.assign(names_1.default.jsonPos, startPos); + gen.if((0, codegen_1._) `${tag} === undefined`); + parsingError(cxt, (0, codegen_1.str) `discriminator tag not found`); + for (const tagValue in mapping) { + gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`); + parseSchemaProperties({ ...cxt, schema: mapping[tagValue] }, discriminator); + } + gen.else(); + parsingError(cxt, (0, codegen_1.str) `discriminator value not in schema`); + gen.endIf(); +} +function parseProperties(cxt) { + const { gen, data } = cxt; + parseToken(cxt, "{"); + gen.assign(data, (0, codegen_1._) `{}`); + parseSchemaProperties(cxt); +} +function parseSchemaProperties(cxt, discriminator) { + const { gen, schema, data } = cxt; + const { properties, optionalProperties, additionalProperties } = schema; + parseItems(cxt, "}", () => { + const key = gen.let("key"); + parseString({ ...cxt, data: key }); + parseToken(cxt, ":"); + gen.if(false); + parseDefinedProperty(cxt, key, properties); + parseDefinedProperty(cxt, key, optionalProperties); + if (discriminator) { + gen.elseIf((0, codegen_1._) `${key} === ${discriminator}`); + const tag = gen.let("tag"); + parseString({ ...cxt, data: tag }); // can be discarded, it is already assigned + } + gen.else(); + if (additionalProperties) { + parseEmpty({ ...cxt, data: (0, codegen_1._) `${data}[${key}]` }); + } + else { + parsingError(cxt, (0, codegen_1.str) `property ${key} not allowed`); + } + gen.endIf(); + }); + if (properties) { + const hasProp = (0, code_1.hasPropFunc)(gen); + const allProps = (0, codegen_1.and)(...Object.keys(properties).map((p) => (0, codegen_1._) `${hasProp}.call(${data}, ${p})`)); + gen.if((0, codegen_1.not)(allProps), () => parsingError(cxt, (0, codegen_1.str) `missing required properties`)); + } +} +function parseDefinedProperty(cxt, key, schemas = {}) { + const { gen } = cxt; + for (const prop in schemas) { + gen.elseIf((0, codegen_1._) `${key} === ${prop}`); + parsePropertyValue(cxt, key, schemas[prop]); + } +} +function parsePropertyValue(cxt, key, schema) { + parseCode({ ...cxt, schema, data: (0, codegen_1._) `${cxt.data}[${key}]` }); +} +function parseType(cxt) { + const { gen, schema, data, self } = cxt; + switch (schema.type) { + case "boolean": + parseBoolean(cxt); + break; + case "string": + parseString(cxt); + break; + case "timestamp": { + parseString(cxt); + const vts = (0, util_1.useFunc)(gen, timestamp_1.default); + const { allowDate, parseDate } = self.opts; + const notValid = allowDate ? (0, codegen_1._) `!${vts}(${data}, true)` : (0, codegen_1._) `!${vts}(${data})`; + const fail = parseDate + ? (0, codegen_1.or)(notValid, (0, codegen_1._) `(${data} = new Date(${data}), false)`, (0, codegen_1._) `isNaN(${data}.valueOf())`) + : notValid; + gen.if(fail, () => parsingError(cxt, (0, codegen_1.str) `invalid timestamp`)); + break; + } + case "float32": + case "float64": + parseNumber(cxt); + break; + default: { + const t = schema.type; + if (!self.opts.int32range && (t === "int32" || t === "uint32")) { + parseNumber(cxt, 16); // 2 ** 53 - max safe integer + if (t === "uint32") { + gen.if((0, codegen_1._) `${data} < 0`, () => parsingError(cxt, (0, codegen_1.str) `integer out of range`)); + } + } + else { + const [min, max, maxDigits] = type_1.intRange[t]; + parseNumber(cxt, maxDigits); + gen.if((0, codegen_1._) `${data} < ${min} || ${data} > ${max}`, () => parsingError(cxt, (0, codegen_1.str) `integer out of range`)); + } + } + } +} +function parseString(cxt) { + parseToken(cxt, '"'); + parseWith(cxt, parseJson_1.parseJsonString); +} +function parseEnum(cxt) { + const { gen, data, schema } = cxt; + const enumSch = schema.enum; + parseToken(cxt, '"'); + // TODO loopEnum + gen.if(false); + for (const value of enumSch) { + const valueStr = JSON.stringify(value).slice(1); // remove starting quote + gen.elseIf((0, codegen_1._) `${jsonSlice(valueStr.length)} === ${valueStr}`); + gen.assign(data, (0, codegen_1.str) `${value}`); + gen.add(names_1.default.jsonPos, valueStr.length); + } + gen.else(); + jsonSyntaxError(cxt); + gen.endIf(); +} +function parseNumber(cxt, maxDigits) { + const { gen } = cxt; + skipWhitespace(cxt); + gen.if((0, codegen_1._) `"-0123456789".indexOf(${jsonSlice(1)}) < 0`, () => jsonSyntaxError(cxt), () => parseWith(cxt, parseJson_1.parseJsonNumber, maxDigits)); +} +function parseBooleanToken(bool, fail) { + return (cxt) => { + const { gen, data } = cxt; + tryParseToken(cxt, `${bool}`, () => fail(cxt), () => gen.assign(data, bool)); + }; +} +function parseRef(cxt) { + const { gen, self, definitions, schema, schemaEnv } = cxt; + const { ref } = schema; + const refSchema = definitions[ref]; + if (!refSchema) + throw new ref_error_1.default(self.opts.uriResolver, "", ref, `No definition ${ref}`); + if (!(0, ref_1.hasRef)(refSchema)) + return parseCode({ ...cxt, schema: refSchema }); + const { root } = schemaEnv; + const sch = compileParser.call(self, new __1.SchemaEnv({ schema: refSchema, root }), definitions); + partialParse(cxt, getParser(gen, sch), true); +} +function getParser(gen, sch) { + return sch.parse + ? gen.scopeValue("parse", { ref: sch.parse }) + : (0, codegen_1._) `${gen.scopeValue("wrapper", { ref: sch })}.parse`; +} +function parseEmpty(cxt) { + parseWith(cxt, parseJson_1.parseJson); +} +function parseWith(cxt, parseFunc, args) { + partialParse(cxt, (0, util_1.useFunc)(cxt.gen, parseFunc), args); +} +function partialParse(cxt, parseFunc, args) { + const { gen, data } = cxt; + gen.assign(data, (0, codegen_1._) `${parseFunc}(${names_1.default.json}, ${names_1.default.jsonPos}${args ? (0, codegen_1._) `, ${args}` : codegen_1.nil})`); + gen.assign(names_1.default.jsonPos, (0, codegen_1._) `${parseFunc}.position`); + gen.if((0, codegen_1._) `${data} === undefined`, () => parsingError(cxt, (0, codegen_1._) `${parseFunc}.message`)); +} +function parseToken(cxt, tok) { + tryParseToken(cxt, tok, jsonSyntaxError); +} +function tryParseToken(cxt, tok, fail, success) { + const { gen } = cxt; + const n = tok.length; + skipWhitespace(cxt); + gen.if((0, codegen_1._) `${jsonSlice(n)} === ${tok}`, () => { + gen.add(names_1.default.jsonPos, n); + success === null || success === void 0 ? void 0 : success(cxt); + }, () => fail(cxt)); +} +function skipWhitespace({ gen, char: c }) { + gen.code((0, codegen_1._) `while((${c}=${names_1.default.json}[${names_1.default.jsonPos}],${c}===" "||${c}==="\\n"||${c}==="\\r"||${c}==="\\t"))${names_1.default.jsonPos}++;`); +} +function jsonSlice(len) { + return len === 1 + ? (0, codegen_1._) `${names_1.default.json}[${names_1.default.jsonPos}]` + : (0, codegen_1._) `${names_1.default.json}.slice(${names_1.default.jsonPos}, ${names_1.default.jsonPos}+${len})`; +} +function jsonSyntaxError(cxt) { + parsingError(cxt, (0, codegen_1._) `"unexpected token " + ${names_1.default.json}[${names_1.default.jsonPos}]`); +} +function parsingError({ gen, parseName }, msg) { + gen.assign((0, codegen_1._) `${parseName}.message`, msg); + gen.assign((0, codegen_1._) `${parseName}.position`, names_1.default.jsonPos); + gen.return(undef); +} +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/parse.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/parse.js.map new file mode 100644 index 000000000..a1e86279d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/parse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../lib/compile/jtd/parse.ts"],"names":[],"mappings":";;AAEA,mCAA0D;AAC1D,0BAAgD;AAChD,wCAAmF;AACnF,4CAA0C;AAC1C,oCAAwB;AACxB,kDAAmD;AACnD,oDAAiD;AACjD,sDAA6D;AAC7D,uDAAmF;AACnF,kCAA+B;AAC/B,uDAAoD;AAIpD,MAAM,QAAQ,GAA+B;IAC3C,QAAQ,EAAE,aAAa;IACvB,MAAM,EAAE,WAAW;IACnB,aAAa,EAAE,kBAAkB;IACjC,UAAU,EAAE,eAAe;IAC3B,kBAAkB,EAAE,eAAe;IACnC,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,QAAQ;CACd,CAAA;AAaD,SAAwB,aAAa,CAEnC,GAAc,EACd,WAA4B;IAE5B,MAAM,IAAI,GAAG,sBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC/C,IAAI,IAAI;QAAE,OAAO,IAAI,CAAA;IACrB,MAAM,EAAC,GAAG,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;IACnC,MAAM,EAAC,aAAa,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;IACjC,MAAM,GAAG,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAC,GAAG,EAAE,KAAK,EAAE,aAAa,EAAC,CAAC,CAAA;IAChE,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;IACxC,MAAM,GAAG,GAAa;QACpB,IAAI,EAAE,IAAI;QACV,GAAG;QACH,MAAM,EAAE,GAAG,CAAC,MAAsB;QAClC,SAAS,EAAE,GAAG;QACd,WAAW;QACX,IAAI,EAAE,eAAC,CAAC,IAAI;QACZ,SAAS;QACT,IAAI,E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/ajv/dist/compile/jtd/serialize.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/serialize.d.ts new file mode 100644 index 000000000..b0413d716 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/serialize.d.ts @@ -0,0 +1,4 @@ +import type Ajv from "../../core"; +import { SchemaObjectMap } from "./types"; +import { SchemaEnv } from ".."; +export default function compileSerializer(this: Ajv, sch: SchemaEnv, definitions: SchemaObjectMap): SchemaEnv; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/serialize.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/serialize.js new file mode 100644 index 000000000..29bf234c8 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/serialize.js @@ -0,0 +1,218 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const types_1 = require("./types"); +const __1 = require(".."); +const codegen_1 = require("../codegen"); +const ref_error_1 = require("../ref_error"); +const names_1 = require("../names"); +const code_1 = require("../../vocabularies/code"); +const ref_1 = require("../../vocabularies/jtd/ref"); +const util_1 = require("../util"); +const quote_1 = require("../../runtime/quote"); +const genSerialize = { + elements: serializeElements, + values: serializeValues, + discriminator: serializeDiscriminator, + properties: serializeProperties, + optionalProperties: serializeProperties, + enum: serializeString, + type: serializeType, + ref: serializeRef, +}; +function compileSerializer(sch, definitions) { + const _sch = __1.getCompilingSchema.call(this, sch); + if (_sch) + return _sch; + const { es5, lines } = this.opts.code; + const { ownProperties } = this.opts; + const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties }); + const serializeName = gen.scopeName("serialize"); + const cxt = { + self: this, + gen, + schema: sch.schema, + schemaEnv: sch, + definitions, + data: names_1.default.data, + }; + let sourceCode; + try { + this._compilations.add(sch); + sch.serializeName = serializeName; + gen.func(serializeName, names_1.default.data, false, () => { + gen.let(names_1.default.json, (0, codegen_1.str) ``); + serializeCode(cxt); + gen.return(names_1.default.json); + }); + gen.optimize(this.opts.code.optimize); + const serializeFuncCode = gen.toString(); + sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${serializeFuncCode}`; + const makeSerialize = new Function(`${names_1.default.scope}`, sourceCode); + const serialize = makeSerialize(this.scope.get()); + this.scope.value(serializeName, { ref: serialize }); + sch.serialize = serialize; + } + catch (e) { + if (sourceCode) + this.logger.error("Error compiling serializer, function code:", sourceCode); + delete sch.serialize; + delete sch.serializeName; + throw e; + } + finally { + this._compilations.delete(sch); + } + return sch; +} +exports.default = compileSerializer; +function serializeCode(cxt) { + let form; + for (const key of types_1.jtdForms) { + if (key in cxt.schema) { + form = key; + break; + } + } + serializeNullable(cxt, form ? genSerialize[form] : serializeEmpty); +} +function serializeNullable(cxt, serializeForm) { + const { gen, schema, data } = cxt; + if (!schema.nullable) + return serializeForm(cxt); + gen.if((0, codegen_1._) `${data} === undefined || ${data} === null`, () => gen.add(names_1.default.json, (0, codegen_1._) `"null"`), () => serializeForm(cxt)); +} +function serializeElements(cxt) { + const { gen, schema, data } = cxt; + gen.add(names_1.default.json, (0, codegen_1.str) `[`); + const first = gen.let("first", true); + gen.forOf("el", data, (el) => { + addComma(cxt, first); + serializeCode({ ...cxt, schema: schema.elements, data: el }); + }); + gen.add(names_1.default.json, (0, codegen_1.str) `]`); +} +function serializeValues(cxt) { + const { gen, schema, data } = cxt; + gen.add(names_1.default.json, (0, codegen_1.str) `{`); + const first = gen.let("first", true); + gen.forIn("key", data, (key) => serializeKeyValue(cxt, key, schema.values, first)); + gen.add(names_1.default.json, (0, codegen_1.str) `}`); +} +function serializeKeyValue(cxt, key, schema, first) { + const { gen, data } = cxt; + addComma(cxt, first); + serializeString({ ...cxt, data: key }); + gen.add(names_1.default.json, (0, codegen_1.str) `:`); + const value = gen.const("value", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(key)}`); + serializeCode({ ...cxt, schema, data: value }); +} +function serializeDiscriminator(cxt) { + const { gen, schema, data } = cxt; + const { discriminator } = schema; + gen.add(names_1.default.json, (0, codegen_1.str) `{${JSON.stringify(discriminator)}:`); + const tag = gen.const("tag", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(discriminator)}`); + serializeString({ ...cxt, data: tag }); + gen.if(false); + for (const tagValue in schema.mapping) { + gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`); + const sch = schema.mapping[tagValue]; + serializeSchemaProperties({ ...cxt, schema: sch }, discriminator); + } + gen.endIf(); + gen.add(names_1.default.json, (0, codegen_1.str) `}`); +} +function serializeProperties(cxt) { + const { gen } = cxt; + gen.add(names_1.default.json, (0, codegen_1.str) `{`); + serializeSchemaProperties(cxt); + gen.add(names_1.default.json, (0, codegen_1.str) `}`); +} +function serializeSchemaProperties(cxt, discriminator) { + const { gen, schema, data } = cxt; + const { properties, optionalProperties } = schema; + const props = keys(properties); + const optProps = keys(optionalProperties); + const allProps = allProperties(props.concat(optProps)); + let first = !discriminator; + for (const key of props) { + serializeProperty(key, properties[key], keyValue(key)); + } + for (const key of optProps) { + const value = keyValue(key); + gen.if((0, codegen_1.and)((0, codegen_1._) `${value} !== undefined`, (0, code_1.isOwnProperty)(gen, data, key)), () => serializeProperty(key, optionalProperties[key], value)); + } + if (schema.additionalProperties) { + gen.forIn("key", data, (key) => gen.if(isAdditional(key, allProps), () => serializeKeyValue(cxt, key, {}, gen.let("first", first)))); + } + function keys(ps) { + return ps ? Object.keys(ps) : []; + } + function allProperties(ps) { + if (discriminator) + ps.push(discriminator); + if (new Set(ps).size !== ps.length) { + throw new Error("JTD: properties/optionalProperties/disciminator overlap"); + } + return ps; + } + function keyValue(key) { + return gen.const("value", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(key)}`); + } + function serializeProperty(key, propSchema, value) { + if (first) + first = false; + else + gen.add(names_1.default.json, (0, codegen_1.str) `,`); + gen.add(names_1.default.json, (0, codegen_1.str) `${JSON.stringify(key)}:`); + serializeCode({ ...cxt, schema: propSchema, data: value }); + } + function isAdditional(key, ps) { + return ps.length ? (0, codegen_1.and)(...ps.map((p) => (0, codegen_1._) `${key} !== ${p}`)) : true; + } +} +function serializeType(cxt) { + const { gen, schema, data } = cxt; + switch (schema.type) { + case "boolean": + gen.add(names_1.default.json, (0, codegen_1._) `${data} ? "true" : "false"`); + break; + case "string": + serializeString(cxt); + break; + case "timestamp": + gen.if((0, codegen_1._) `${data} instanceof Date`, () => gen.add(names_1.default.json, (0, codegen_1._) `'"' + ${data}.toISOString() + '"'`), () => serializeString(cxt)); + break; + default: + serializeNumber(cxt); + } +} +function serializeString({ gen, data }) { + gen.add(names_1.default.json, (0, codegen_1._) `${(0, util_1.useFunc)(gen, quote_1.default)}(${data})`); +} +function serializeNumber({ gen, data }) { + gen.add(names_1.default.json, (0, codegen_1._) `"" + ${data}`); +} +function serializeRef(cxt) { + const { gen, self, data, definitions, schema, schemaEnv } = cxt; + const { ref } = schema; + const refSchema = definitions[ref]; + if (!refSchema) + throw new ref_error_1.default(self.opts.uriResolver, "", ref, `No definition ${ref}`); + if (!(0, ref_1.hasRef)(refSchema)) + return serializeCode({ ...cxt, schema: refSchema }); + const { root } = schemaEnv; + const sch = compileSerializer.call(self, new __1.SchemaEnv({ schema: refSchema, root }), definitions); + gen.add(names_1.default.json, (0, codegen_1._) `${getSerialize(gen, sch)}(${data})`); +} +function getSerialize(gen, sch) { + return sch.serialize + ? gen.scopeValue("serialize", { ref: sch.serialize }) + : (0, codegen_1._) `${gen.scopeValue("wrapper", { ref: sch })}.serialize`; +} +function serializeEmpty({ gen, data }) { + gen.add(names_1.default.json, (0, codegen_1._) `JSON.stringify(${data})`); +} +function addComma({ gen }, first) { + gen.if(first, () => gen.assign(first, false), () => gen.add(names_1.default.json, (0, codegen_1.str) `,`)); +} +//# sourceMappingURL=serialize.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/serialize.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/serialize.js.map new file mode 100644 index 000000000..10c6ed125 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/serialize.js.map @@ -0,0 +1 @@ +{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../../lib/compile/jtd/serialize.ts"],"names":[],"mappings":";;AAEA,mCAA0D;AAC1D,0BAAgD;AAChD,wCAAwE;AACxE,4CAA0C;AAC1C,oCAAwB;AACxB,kDAAqD;AACrD,oDAAiD;AACjD,kCAA+B;AAC/B,+CAAuC;AAEvC,MAAM,YAAY,GAAkD;IAClE,QAAQ,EAAE,iBAAiB;IAC3B,MAAM,EAAE,eAAe;IACvB,aAAa,EAAE,sBAAsB;IACrC,UAAU,EAAE,mBAAmB;IAC/B,kBAAkB,EAAE,mBAAmB;IACvC,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,aAAa;IACnB,GAAG,EAAE,YAAY;CAClB,CAAA;AAWD,SAAwB,iBAAiB,CAEvC,GAAc,EACd,WAA4B;IAE5B,MAAM,IAAI,GAAG,sBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC/C,IAAI,IAAI;QAAE,OAAO,IAAI,CAAA;IACrB,MAAM,EAAC,GAAG,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAA;IACnC,MAAM,EAAC,aAAa,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;IACjC,MAAM,GAAG,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,KAAK,EAAE,EAAC,GAAG,EAAE,KAAK,EAAE,aAAa,EAAC,CAAC,CAAA;IAChE,MAAM,aAAa,GAAG,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC,CAAA;IAChD,MAAM,GAAG,GAAiB;QACxB,IAAI,EAAE,IAAI;QACV,GAAG;QACH,MAAM,EAAE,GAAG,CAAC,MAAsB;QAClC,SAAS,EAAE,GAAG;QACd,WAAW;QACX,IAAI,EAAE,eAAC,CAAC,IAAI;KACb,CAAA;IAED,IAAI,UAA8B,CAAA;IAClC,IAAI;Q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U,CAAC,WAAW,EAAE,EAAC,GAAG,EAAE,GAAG,CAAC,SAAS,EAAC,CAAC;QACnD,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE,EAAC,GAAG,EAAE,GAAG,EAAC,CAAC,YAAY,CAAA;AAC3D,CAAC;AAED,SAAS,cAAc,CAAC,EAAC,GAAG,EAAE,IAAI,EAAe;IAC/C,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,kBAAkB,IAAI,GAAG,CAAC,CAAA;AAC7C,CAAC;AAED,SAAS,QAAQ,CAAC,EAAC,GAAG,EAAe,EAAE,KAAW;IAChD,GAAG,CAAC,EAAE,CACJ,KAAK,EACL,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAC9B,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,GAAG,CAAC,CAC9B,CAAA;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/types.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/types.d.ts new file mode 100644 index 000000000..38c8bea7f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/types.d.ts @@ -0,0 +1,6 @@ +import type { SchemaObject } from "../../types"; +export declare type SchemaObjectMap = { + [Ref in string]?: SchemaObject; +}; +export declare const jtdForms: readonly ["elements", "values", "discriminator", "properties", "optionalProperties", "enum", "type", "ref"]; +export declare type JTDForm = typeof jtdForms[number]; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/types.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/types.js new file mode 100644 index 000000000..b9c60a90f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/types.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.jtdForms = void 0; +exports.jtdForms = [ + "elements", + "values", + "discriminator", + "properties", + "optionalProperties", + "enum", + "type", + "ref", +]; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/types.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/types.js.map new file mode 100644 index 000000000..53439e002 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/jtd/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/compile/jtd/types.ts"],"names":[],"mappings":";;;AAIa,QAAA,QAAQ,GAAG;IACtB,UAAU;IACV,QAAQ;IACR,eAAe;IACf,YAAY;IACZ,oBAAoB;IACpB,MAAM;IACN,MAAM;IACN,KAAK;CACG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/names.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/names.d.ts new file mode 100644 index 000000000..5740e82c6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/names.d.ts @@ -0,0 +1,20 @@ +import { Name } from "./codegen"; +declare const names: { + data: Name; + valCxt: Name; + instancePath: Name; + parentData: Name; + parentDataProperty: Name; + rootData: Name; + dynamicAnchors: Name; + vErrors: Name; + errors: Name; + this: Name; + self: Name; + scope: Name; + json: Name; + jsonPos: Name; + jsonLen: Name; + jsonPart: Name; +}; +export default names; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/names.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/names.js new file mode 100644 index 000000000..015334bd5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/names.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("./codegen"); +const names = { + // validation function arguments + data: new codegen_1.Name("data"), + // args passed from referencing schema + valCxt: new codegen_1.Name("valCxt"), + instancePath: new codegen_1.Name("instancePath"), + parentData: new codegen_1.Name("parentData"), + parentDataProperty: new codegen_1.Name("parentDataProperty"), + rootData: new codegen_1.Name("rootData"), + dynamicAnchors: new codegen_1.Name("dynamicAnchors"), + // function scoped variables + vErrors: new codegen_1.Name("vErrors"), + errors: new codegen_1.Name("errors"), + this: new codegen_1.Name("this"), + // "globals" + self: new codegen_1.Name("self"), + scope: new codegen_1.Name("scope"), + // JTD serialize/parse name for JSON string and position + json: new codegen_1.Name("json"), + jsonPos: new codegen_1.Name("jsonPos"), + jsonLen: new codegen_1.Name("jsonLen"), + jsonPart: new codegen_1.Name("jsonPart"), +}; +exports.default = names; +//# sourceMappingURL=names.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/names.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/names.js.map new file mode 100644 index 000000000..9bbe8e275 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/names.js.map @@ -0,0 +1 @@ +{"version":3,"file":"names.js","sourceRoot":"","sources":["../../lib/compile/names.ts"],"names":[],"mappings":";;AAAA,uCAA8B;AAE9B,MAAM,KAAK,GAAG;IACZ,gCAAgC;IAChC,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,sCAAsC;IACtC,MAAM,EAAE,IAAI,cAAI,CAAC,QAAQ,CAAC;IAC1B,YAAY,EAAE,IAAI,cAAI,CAAC,cAAc,CAAC;IACtC,UAAU,EAAE,IAAI,cAAI,CAAC,YAAY,CAAC;IAClC,kBAAkB,EAAE,IAAI,cAAI,CAAC,oBAAoB,CAAC;IAClD,QAAQ,EAAE,IAAI,cAAI,CAAC,UAAU,CAAC;IAC9B,cAAc,EAAE,IAAI,cAAI,CAAC,gBAAgB,CAAC;IAC1C,4BAA4B;IAC5B,OAAO,EAAE,IAAI,cAAI,CAAC,SAAS,CAAC;IAC5B,MAAM,EAAE,IAAI,cAAI,CAAC,QAAQ,CAAC;IAC1B,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,YAAY;IACZ,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,KAAK,EAAE,IAAI,cAAI,CAAC,OAAO,CAAC;IACxB,wDAAwD;IACxD,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,OAAO,EAAE,IAAI,cAAI,CAAC,SAAS,CAAC;IAC5B,OAAO,EAAE,IAAI,cAAI,CAAC,SAAS,CAAC;IAC5B,QAAQ,EAAE,IAAI,cAAI,CAAC,UAAU,CAAC;CAC/B,CAAA;AAED,kBAAe,KAAK,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/ref_error.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/ref_error.d.ts new file mode 100644 index 000000000..43374439e --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/ref_error.d.ts @@ -0,0 +1,6 @@ +import type { UriResolver } from "../types"; +export default class MissingRefError extends Error { + readonly missingRef: string; + readonly missingSchema: string; + constructor(resolver: UriResolver, baseId: string, ref: string, msg?: string); +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/ref_error.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/ref_error.js new file mode 100644 index 000000000..3916dec8a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/ref_error.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const resolve_1 = require("./resolve"); +class MissingRefError extends Error { + constructor(resolver, baseId, ref, msg) { + super(msg || `can't resolve reference ${ref} from id ${baseId}`); + this.missingRef = (0, resolve_1.resolveUrl)(resolver, baseId, ref); + this.missingSchema = (0, resolve_1.normalizeId)((0, resolve_1.getFullPath)(resolver, this.missingRef)); + } +} +exports.default = MissingRefError; +//# sourceMappingURL=ref_error.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/ref_error.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/ref_error.js.map new file mode 100644 index 000000000..d13f5f2dd --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/ref_error.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ref_error.js","sourceRoot":"","sources":["../../lib/compile/ref_error.ts"],"names":[],"mappings":";;AAAA,uCAA8D;AAG9D,MAAqB,eAAgB,SAAQ,KAAK;IAIhD,YAAY,QAAqB,EAAE,MAAc,EAAE,GAAW,EAAE,GAAY;QAC1E,KAAK,CAAC,GAAG,IAAI,2BAA2B,GAAG,YAAY,MAAM,EAAE,CAAC,CAAA;QAChE,IAAI,CAAC,UAAU,GAAG,IAAA,oBAAU,EAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;QACnD,IAAI,CAAC,aAAa,GAAG,IAAA,qBAAW,EAAC,IAAA,qBAAW,EAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAA;IAC1E,CAAC;CACF;AATD,kCASC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.d.ts new file mode 100644 index 000000000..745eaeb42 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.d.ts @@ -0,0 +1,12 @@ +import type { AnySchema, AnySchemaObject, UriResolver } from "../types"; +import type Ajv from "../ajv"; +import type { URIComponents } from "uri-js"; +export declare type LocalRefs = { + [Ref in string]?: AnySchemaObject; +}; +export declare function inlineRef(schema: AnySchema, limit?: boolean | number): boolean; +export declare function getFullPath(resolver: UriResolver, id?: string, normalize?: boolean): string; +export declare function _getFullPath(resolver: UriResolver, p: URIComponents): string; +export declare function normalizeId(id: string | undefined): string; +export declare function resolveUrl(resolver: UriResolver, baseId: string, id: string): string; +export declare function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): LocalRefs; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.js new file mode 100644 index 000000000..8b51a20e6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.js @@ -0,0 +1,155 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getSchemaRefs = exports.resolveUrl = exports.normalizeId = exports._getFullPath = exports.getFullPath = exports.inlineRef = void 0; +const util_1 = require("./util"); +const equal = require("fast-deep-equal"); +const traverse = require("json-schema-traverse"); +// TODO refactor to use keyword definitions +const SIMPLE_INLINED = new Set([ + "type", + "format", + "pattern", + "maxLength", + "minLength", + "maxProperties", + "minProperties", + "maxItems", + "minItems", + "maximum", + "minimum", + "uniqueItems", + "multipleOf", + "required", + "enum", + "const", +]); +function inlineRef(schema, limit = true) { + if (typeof schema == "boolean") + return true; + if (limit === true) + return !hasRef(schema); + if (!limit) + return false; + return countKeys(schema) <= limit; +} +exports.inlineRef = inlineRef; +const REF_KEYWORDS = new Set([ + "$ref", + "$recursiveRef", + "$recursiveAnchor", + "$dynamicRef", + "$dynamicAnchor", +]); +function hasRef(schema) { + for (const key in schema) { + if (REF_KEYWORDS.has(key)) + return true; + const sch = schema[key]; + if (Array.isArray(sch) && sch.some(hasRef)) + return true; + if (typeof sch == "object" && hasRef(sch)) + return true; + } + return false; +} +function countKeys(schema) { + let count = 0; + for (const key in schema) { + if (key === "$ref") + return Infinity; + count++; + if (SIMPLE_INLINED.has(key)) + continue; + if (typeof schema[key] == "object") { + (0, util_1.eachItem)(schema[key], (sch) => (count += countKeys(sch))); + } + if (count === Infinity) + return Infinity; + } + return count; +} +function getFullPath(resolver, id = "", normalize) { + if (normalize !== false) + id = normalizeId(id); + const p = resolver.parse(id); + return _getFullPath(resolver, p); +} +exports.getFullPath = getFullPath; +function _getFullPath(resolver, p) { + const serialized = resolver.serialize(p); + return serialized.split("#")[0] + "#"; +} +exports._getFullPath = _getFullPath; +const TRAILING_SLASH_HASH = /#\/?$/; +function normalizeId(id) { + return id ? id.replace(TRAILING_SLASH_HASH, "") : ""; +} +exports.normalizeId = normalizeId; +function resolveUrl(resolver, baseId, id) { + id = normalizeId(id); + return resolver.resolve(baseId, id); +} +exports.resolveUrl = resolveUrl; +const ANCHOR = /^[a-z_][-a-z0-9._]*$/i; +function getSchemaRefs(schema, baseId) { + if (typeof schema == "boolean") + return {}; + const { schemaId, uriResolver } = this.opts; + const schId = normalizeId(schema[schemaId] || baseId); + const baseIds = { "": schId }; + const pathPrefix = getFullPath(uriResolver, schId, false); + const localRefs = {}; + const schemaRefs = new Set(); + traverse(schema, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => { + if (parentJsonPtr === undefined) + return; + const fullPath = pathPrefix + jsonPtr; + let baseId = baseIds[parentJsonPtr]; + if (typeof sch[schemaId] == "string") + baseId = addRef.call(this, sch[schemaId]); + addAnchor.call(this, sch.$anchor); + addAnchor.call(this, sch.$dynamicAnchor); + baseIds[jsonPtr] = baseId; + function addRef(ref) { + // eslint-disable-next-line @typescript-eslint/unbound-method + const _resolve = this.opts.uriResolver.resolve; + ref = normalizeId(baseId ? _resolve(baseId, ref) : ref); + if (schemaRefs.has(ref)) + throw ambiguos(ref); + schemaRefs.add(ref); + let schOrRef = this.refs[ref]; + if (typeof schOrRef == "string") + schOrRef = this.refs[schOrRef]; + if (typeof schOrRef == "object") { + checkAmbiguosRef(sch, schOrRef.schema, ref); + } + else if (ref !== normalizeId(fullPath)) { + if (ref[0] === "#") { + checkAmbiguosRef(sch, localRefs[ref], ref); + localRefs[ref] = sch; + } + else { + this.refs[ref] = fullPath; + } + } + return ref; + } + function addAnchor(anchor) { + if (typeof anchor == "string") { + if (!ANCHOR.test(anchor)) + throw new Error(`invalid anchor "${anchor}"`); + addRef.call(this, `#${anchor}`); + } + } + }); + return localRefs; + function checkAmbiguosRef(sch1, sch2, ref) { + if (sch2 !== undefined && !equal(sch1, sch2)) + throw ambiguos(ref); + } + function ambiguos(ref) { + return new Error(`reference "${ref}" resolves to more than one schema`); + } +} +exports.getSchemaRefs = getSchemaRefs; +//# sourceMappingURL=resolve.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.js.map new file mode 100644 index 000000000..81f08b0c3 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/resolve.js.map @@ -0,0 +1 @@ +{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../lib/compile/resolve.ts"],"names":[],"mappings":";;;AAGA,iCAA+B;AAC/B,yCAAwC;AACxC,iDAAgD;AAKhD,2CAA2C;AAC3C,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,MAAM;IACN,QAAQ;IACR,SAAS;IACT,WAAW;IACX,WAAW;IACX,eAAe;IACf,eAAe;IACf,UAAU;IACV,UAAU;IACV,SAAS;IACT,SAAS;IACT,aAAa;IACb,YAAY;IACZ,UAAU;IACV,MAAM;IACN,OAAO;CACR,CAAC,CAAA;AAEF,SAAgB,SAAS,CAAC,MAAiB,EAAE,QAA0B,IAAI;IACzE,IAAI,OAAO,MAAM,IAAI,SAAS;QAAE,OAAO,IAAI,CAAA;IAC3C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC1C,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAA;IACxB,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,KAAK,CAAA;AACnC,CAAC;AALD,8BAKC;AAED,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,MAAM;IACN,eAAe;IACf,kBAAkB;IAClB,aAAa;IACb,gBAAgB;CACjB,CAAC,CAAA;AAEF,SAAS,MAAM,CAAC,MAAuB;IACrC,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;QACxB,IAAI,YAAY,CAAC,GAAG,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CAAC,QAAQ,CAAC,EAAE;gBACxC,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE;oBAClB,gBAAgB,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAA;oBAC1C,SAAS,CAAC,GAAG,CAAC,GAAG,GAAG,CAAA;iBACrB;qBAAM;oBACL,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAA;iBAC1B;aACF;YACD,OAAO,GAAG,CAAA;QACZ,CAAC;QAED,SAAS,SAAS,CAAY,MAAe;YAC3C,IAAI,OAAO,MAAM,IAAI,QAAQ,EAAE;gBAC7B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;oBAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,GAAG,CAAC,CAAA;gBACvE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC,CAAA;aAChC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,SAAS,CAAA;IAEhB,SAAS,gBAAgB,CAAC,IAAe,EAAE,IAA2B,EAAE,GAAW;QACjF,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;YAAE,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAA;IACnE,CAAC;IAED,SAAS,QAAQ,CAAC,GAAW;QAC3B,OAAO,IAAI,KAAK,CAAC,cAAc,GAAG,oCAAoC,CAAC,CAAA;IACzE,CAAC;AACH,CAAC;AAxDD,sCAwDC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/rules.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/rules.d.ts new file mode 100644 index 000000000..7def4b5a3 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/rules.d.ts @@ -0,0 +1,28 @@ +import type { AddedKeywordDefinition } from "../types"; +declare const _jsonTypes: readonly ["string", "number", "integer", "boolean", "null", "object", "array"]; +export declare type JSONType = typeof _jsonTypes[number]; +export declare function isJSONType(x: unknown): x is JSONType; +declare type ValidationTypes = { + [K in JSONType]: boolean | RuleGroup | undefined; +}; +export interface ValidationRules { + rules: RuleGroup[]; + post: RuleGroup; + all: { + [Key in string]?: boolean | Rule; + }; + keywords: { + [Key in string]?: boolean; + }; + types: ValidationTypes; +} +export interface RuleGroup { + type?: JSONType; + rules: Rule[]; +} +export interface Rule { + keyword: string; + definition: AddedKeywordDefinition; +} +export declare function getRules(): ValidationRules; +export {}; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/rules.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/rules.js new file mode 100644 index 000000000..82a591ff4 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/rules.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getRules = exports.isJSONType = void 0; +const _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array"]; +const jsonTypes = new Set(_jsonTypes); +function isJSONType(x) { + return typeof x == "string" && jsonTypes.has(x); +} +exports.isJSONType = isJSONType; +function getRules() { + const groups = { + number: { type: "number", rules: [] }, + string: { type: "string", rules: [] }, + array: { type: "array", rules: [] }, + object: { type: "object", rules: [] }, + }; + return { + types: { ...groups, integer: true, boolean: true, null: true }, + rules: [{ rules: [] }, groups.number, groups.string, groups.array, groups.object], + post: { rules: [] }, + all: {}, + keywords: {}, + }; +} +exports.getRules = getRules; +//# sourceMappingURL=rules.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/rules.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/rules.js.map new file mode 100644 index 000000000..084c70f82 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/rules.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../lib/compile/rules.ts"],"names":[],"mappings":";;;AAEA,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAA;AAIjG,MAAM,SAAS,GAAgB,IAAI,GAAG,CAAC,UAAU,CAAC,CAAA;AAElD,SAAgB,UAAU,CAAC,CAAU;IACnC,OAAO,OAAO,CAAC,IAAI,QAAQ,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AACjD,CAAC;AAFD,gCAEC;AAyBD,SAAgB,QAAQ;IACtB,MAAM,MAAM,GAAgE;QAC1E,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC;QACnC,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC;QACnC,KAAK,EAAE,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAC;QACjC,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC;KACpC,CAAA;IACD,OAAO;QACL,KAAK,EAAE,EAAC,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC;QAC5D,KAAK,EAAE,CAAC,EAAC,KAAK,EAAE,EAAE,EAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;QAC/E,IAAI,EAAE,EAAC,KAAK,EAAE,EAAE,EAAC;QACjB,GAAG,EAAE,EAAE;QACP,QAAQ,EAAE,EAAE;KACb,CAAA;AACH,CAAC;AAdD,4BAcC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/util.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/util.d.ts new file mode 100644 index 000000000..17042cf0e --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/util.d.ts @@ -0,0 +1,40 @@ +import type { AnySchema, EvaluatedProperties, EvaluatedItems } from "../types"; +import type { SchemaCxt, SchemaObjCxt } from "."; +import { Code, Name, CodeGen } from "./codegen"; +import type { Rule, ValidationRules } from "./rules"; +export declare function toHash(arr: T[]): { + [K in T]?: true; +}; +export declare function alwaysValidSchema(it: SchemaCxt, schema: AnySchema): boolean | void; +export declare function checkUnknownRules(it: SchemaCxt, schema?: AnySchema): void; +export declare function schemaHasRules(schema: AnySchema, rules: { + [Key in string]?: boolean | Rule; +}): boolean; +export declare function schemaHasRulesButRef(schema: AnySchema, RULES: ValidationRules): boolean; +export declare function schemaRefOrVal({ topSchemaRef, schemaPath }: SchemaObjCxt, schema: unknown, keyword: string, $data?: string | false): Code | number | boolean; +export declare function unescapeFragment(str: string): string; +export declare function escapeFragment(str: string | number): string; +export declare function escapeJsonPointer(str: string | number): string; +export declare function unescapeJsonPointer(str: string): string; +export declare function eachItem(xs: T | T[], f: (x: T) => void): void; +declare type SomeEvaluated = EvaluatedProperties | EvaluatedItems; +declare type MergeEvaluatedFunc = (gen: CodeGen, from: Name | T, to: Name | Exclude | undefined, toName?: typeof Name) => Name | T; +interface MergeEvaluated { + props: MergeEvaluatedFunc; + items: MergeEvaluatedFunc; +} +export declare const mergeEvaluated: MergeEvaluated; +export declare function evaluatedPropsToName(gen: CodeGen, ps?: EvaluatedProperties): Name; +export declare function setEvaluated(gen: CodeGen, props: Name, ps: { + [K in string]?: true; +}): void; +export declare function useFunc(gen: CodeGen, f: { + code: string; +}): Name; +export declare enum Type { + Num = 0, + Str = 1 +} +export declare function getErrorPath(dataProp: Name | string | number, dataPropType?: Type, jsPropertySyntax?: boolean): Code | string; +export declare function checkStrictMode(it: SchemaCxt, msg: string, mode?: boolean | "log"): void; +export {}; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/util.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/util.js new file mode 100644 index 000000000..091ad4c0d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/util.js @@ -0,0 +1,178 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.checkStrictMode = exports.getErrorPath = exports.Type = exports.useFunc = exports.setEvaluated = exports.evaluatedPropsToName = exports.mergeEvaluated = exports.eachItem = exports.unescapeJsonPointer = exports.escapeJsonPointer = exports.escapeFragment = exports.unescapeFragment = exports.schemaRefOrVal = exports.schemaHasRulesButRef = exports.schemaHasRules = exports.checkUnknownRules = exports.alwaysValidSchema = exports.toHash = void 0; +const codegen_1 = require("./codegen"); +const code_1 = require("./codegen/code"); +// TODO refactor to use Set +function toHash(arr) { + const hash = {}; + for (const item of arr) + hash[item] = true; + return hash; +} +exports.toHash = toHash; +function alwaysValidSchema(it, schema) { + if (typeof schema == "boolean") + return schema; + if (Object.keys(schema).length === 0) + return true; + checkUnknownRules(it, schema); + return !schemaHasRules(schema, it.self.RULES.all); +} +exports.alwaysValidSchema = alwaysValidSchema; +function checkUnknownRules(it, schema = it.schema) { + const { opts, self } = it; + if (!opts.strictSchema) + return; + if (typeof schema === "boolean") + return; + const rules = self.RULES.keywords; + for (const key in schema) { + if (!rules[key]) + checkStrictMode(it, `unknown keyword: "${key}"`); + } +} +exports.checkUnknownRules = checkUnknownRules; +function schemaHasRules(schema, rules) { + if (typeof schema == "boolean") + return !schema; + for (const key in schema) + if (rules[key]) + return true; + return false; +} +exports.schemaHasRules = schemaHasRules; +function schemaHasRulesButRef(schema, RULES) { + if (typeof schema == "boolean") + return !schema; + for (const key in schema) + if (key !== "$ref" && RULES.all[key]) + return true; + return false; +} +exports.schemaHasRulesButRef = schemaHasRulesButRef; +function schemaRefOrVal({ topSchemaRef, schemaPath }, schema, keyword, $data) { + if (!$data) { + if (typeof schema == "number" || typeof schema == "boolean") + return schema; + if (typeof schema == "string") + return (0, codegen_1._) `${schema}`; + } + return (0, codegen_1._) `${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`; +} +exports.schemaRefOrVal = schemaRefOrVal; +function unescapeFragment(str) { + return unescapeJsonPointer(decodeURIComponent(str)); +} +exports.unescapeFragment = unescapeFragment; +function escapeFragment(str) { + return encodeURIComponent(escapeJsonPointer(str)); +} +exports.escapeFragment = escapeFragment; +function escapeJsonPointer(str) { + if (typeof str == "number") + return `${str}`; + return str.replace(/~/g, "~0").replace(/\//g, "~1"); +} +exports.escapeJsonPointer = escapeJsonPointer; +function unescapeJsonPointer(str) { + return str.replace(/~1/g, "/").replace(/~0/g, "~"); +} +exports.unescapeJsonPointer = unescapeJsonPointer; +function eachItem(xs, f) { + if (Array.isArray(xs)) { + for (const x of xs) + f(x); + } + else { + f(xs); + } +} +exports.eachItem = eachItem; +function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues, resultToName, }) { + return (gen, from, to, toName) => { + const res = to === undefined + ? from + : to instanceof codegen_1.Name + ? (from instanceof codegen_1.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) + : from instanceof codegen_1.Name + ? (mergeToName(gen, to, from), from) + : mergeValues(from, to); + return toName === codegen_1.Name && !(res instanceof codegen_1.Name) ? resultToName(gen, res) : res; + }; +} +exports.mergeEvaluated = { + props: makeMergeEvaluated({ + mergeNames: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true && ${from} !== undefined`, () => { + gen.if((0, codegen_1._) `${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1._) `${to} || {}`).code((0, codegen_1._) `Object.assign(${to}, ${from})`)); + }), + mergeToName: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true`, () => { + if (from === true) { + gen.assign(to, true); + } + else { + gen.assign(to, (0, codegen_1._) `${to} || {}`); + setEvaluated(gen, to, from); + } + }), + mergeValues: (from, to) => (from === true ? true : { ...from, ...to }), + resultToName: evaluatedPropsToName, + }), + items: makeMergeEvaluated({ + mergeNames: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1._) `${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)), + mergeToName: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1._) `${to} > ${from} ? ${to} : ${from}`)), + mergeValues: (from, to) => (from === true ? true : Math.max(from, to)), + resultToName: (gen, items) => gen.var("items", items), + }), +}; +function evaluatedPropsToName(gen, ps) { + if (ps === true) + return gen.var("props", true); + const props = gen.var("props", (0, codegen_1._) `{}`); + if (ps !== undefined) + setEvaluated(gen, props, ps); + return props; +} +exports.evaluatedPropsToName = evaluatedPropsToName; +function setEvaluated(gen, props, ps) { + Object.keys(ps).forEach((p) => gen.assign((0, codegen_1._) `${props}${(0, codegen_1.getProperty)(p)}`, true)); +} +exports.setEvaluated = setEvaluated; +const snippets = {}; +function useFunc(gen, f) { + return gen.scopeValue("func", { + ref: f, + code: snippets[f.code] || (snippets[f.code] = new code_1._Code(f.code)), + }); +} +exports.useFunc = useFunc; +var Type; +(function (Type) { + Type[Type["Num"] = 0] = "Num"; + Type[Type["Str"] = 1] = "Str"; +})(Type = exports.Type || (exports.Type = {})); +function getErrorPath(dataProp, dataPropType, jsPropertySyntax) { + // let path + if (dataProp instanceof codegen_1.Name) { + const isNumber = dataPropType === Type.Num; + return jsPropertySyntax + ? isNumber + ? (0, codegen_1._) `"[" + ${dataProp} + "]"` + : (0, codegen_1._) `"['" + ${dataProp} + "']"` + : isNumber + ? (0, codegen_1._) `"/" + ${dataProp}` + : (0, codegen_1._) `"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`; // TODO maybe use global escapePointer + } + return jsPropertySyntax ? (0, codegen_1.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp); +} +exports.getErrorPath = getErrorPath; +function checkStrictMode(it, msg, mode = it.opts.strictSchema) { + if (!mode) + return; + msg = `strict mode: ${msg}`; + if (mode === true) + throw new Error(msg); + it.self.logger.warn(msg); +} +exports.checkStrictMode = checkStrictMode; +//# sourceMappingURL=util.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/util.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/util.js.map new file mode 100644 index 000000000..a2128fc39 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/util.js.map @@ -0,0 +1 @@ +{"version":3,"file":"util.js","sourceRoot":"","sources":["../../lib/compile/util.ts"],"names":[],"mappings":";;;AAEA,uCAA6D;AAC7D,yCAAoC;AAGpC,2BAA2B;AAC3B,SAAgB,MAAM,CAA4B,GAAQ;IACxD,MAAM,IAAI,GAAsB,EAAE,CAAA;IAClC,KAAK,MAAM,IAAI,IAAI,GAAG;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;IACzC,OAAO,IAAI,CAAA;AACb,CAAC;AAJD,wBAIC;AAED,SAAgB,iBAAiB,CAAC,EAAa,EAAE,MAAiB;IAChE,IAAI,OAAO,MAAM,IAAI,SAAS;QAAE,OAAO,MAAM,CAAA;IAC7C,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAA;IACjD,iBAAiB,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;IAC7B,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;AACnD,CAAC;AALD,8CAKC;AAED,SAAgB,iBAAiB,CAAC,EAAa,EAAE,SAAoB,EAAE,CAAC,MAAM;IAC5E,MAAM,EAAC,IAAI,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IACvB,IAAI,CAAC,IAAI,CAAC,YAAY;QAAE,OAAM;IAC9B,IAAI,OAAO,MAAM,KAAK,SAAS;QAAE,OAAM;IACvC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAA;IACjC,KAAK,M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AAI;IACd,6BAAG,CAAA;IACH,6BAAG,CAAA;AACL,CAAC,EAHW,IAAI,GAAJ,YAAI,KAAJ,YAAI,QAGf;AAED,SAAgB,YAAY,CAC1B,QAAgC,EAChC,YAAmB,EACnB,gBAA0B;IAE1B,WAAW;IACX,IAAI,QAAQ,YAAY,cAAI,EAAE;QAC5B,MAAM,QAAQ,GAAG,YAAY,KAAK,IAAI,CAAC,GAAG,CAAA;QAC1C,OAAO,gBAAgB;YACrB,CAAC,CAAC,QAAQ;gBACR,CAAC,CAAC,IAAA,WAAC,EAAA,SAAS,QAAQ,QAAQ;gBAC5B,CAAC,CAAC,IAAA,WAAC,EAAA,UAAU,QAAQ,SAAS;YAChC,CAAC,CAAC,QAAQ;gBACV,CAAC,CAAC,IAAA,WAAC,EAAA,SAAS,QAAQ,EAAE;gBACtB,CAAC,CAAC,IAAA,WAAC,EAAA,SAAS,QAAQ,4CAA4C,CAAA,CAAC,sCAAsC;KAC1G;IACD,OAAO,gBAAgB,CAAC,CAAC,CAAC,IAAA,qBAAW,EAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAA;AAChG,CAAC;AAjBD,oCAiBC;AAED,SAAgB,eAAe,CAC7B,EAAa,EACb,GAAW,EACX,OAAwB,EAAE,CAAC,IAAI,CAAC,YAAY;IAE5C,IAAI,CAAC,IAAI;QAAE,OAAM;IACjB,GAAG,GAAG,gBAAgB,GAAG,EAAE,CAAA;IAC3B,IAAI,IAAI,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;IACvC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,CAAC;AATD,0CASC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/applicability.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/applicability.d.ts new file mode 100644 index 000000000..165d375dc --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/applicability.d.ts @@ -0,0 +1,6 @@ +import type { AnySchemaObject } from "../../types"; +import type { SchemaObjCxt } from ".."; +import type { JSONType, RuleGroup, Rule } from "../rules"; +export declare function schemaHasRulesForType({ schema, self }: SchemaObjCxt, type: JSONType): boolean | undefined; +export declare function shouldUseGroup(schema: AnySchemaObject, group: RuleGroup): boolean; +export declare function shouldUseRule(schema: AnySchemaObject, rule: Rule): boolean | undefined; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/applicability.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/applicability.js new file mode 100644 index 000000000..6187dbbee --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/applicability.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = void 0; +function schemaHasRulesForType({ schema, self }, type) { + const group = self.RULES.types[type]; + return group && group !== true && shouldUseGroup(schema, group); +} +exports.schemaHasRulesForType = schemaHasRulesForType; +function shouldUseGroup(schema, group) { + return group.rules.some((rule) => shouldUseRule(schema, rule)); +} +exports.shouldUseGroup = shouldUseGroup; +function shouldUseRule(schema, rule) { + var _a; + return (schema[rule.keyword] !== undefined || + ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== undefined))); +} +exports.shouldUseRule = shouldUseRule; +//# sourceMappingURL=applicability.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/applicability.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/applicability.js.map new file mode 100644 index 000000000..450cfe75a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/applicability.js.map @@ -0,0 +1 @@ +{"version":3,"file":"applicability.js","sourceRoot":"","sources":["../../../lib/compile/validate/applicability.ts"],"names":[],"mappings":";;;AAIA,SAAgB,qBAAqB,CACnC,EAAC,MAAM,EAAE,IAAI,EAAe,EAC5B,IAAc;IAEd,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACpC,OAAO,KAAK,IAAI,KAAK,KAAK,IAAI,IAAI,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AACjE,CAAC;AAND,sDAMC;AAED,SAAgB,cAAc,CAAC,MAAuB,EAAE,KAAgB;IACtE,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;AAChE,CAAC;AAFD,wCAEC;AAED,SAAgB,aAAa,CAAC,MAAuB,EAAE,IAAU;;IAC/D,OAAO,CACL,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,SAAS;SAClC,MAAA,IAAI,CAAC,UAAU,CAAC,UAAU,0CAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAA,CACrE,CAAA;AACH,CAAC;AALD,sCAKC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/boolSchema.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/boolSchema.d.ts new file mode 100644 index 000000000..0ce795201 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/boolSchema.d.ts @@ -0,0 +1,4 @@ +import type { SchemaCxt } from ".."; +import { Name } from "../codegen"; +export declare function topBoolOrEmptySchema(it: SchemaCxt): void; +export declare function boolOrEmptySchema(it: SchemaCxt, valid: Name): void; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/boolSchema.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/boolSchema.js new file mode 100644 index 000000000..8eeb7b5ee --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/boolSchema.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = void 0; +const errors_1 = require("../errors"); +const codegen_1 = require("../codegen"); +const names_1 = require("../names"); +const boolError = { + message: "boolean schema is false", +}; +function topBoolOrEmptySchema(it) { + const { gen, schema, validateName } = it; + if (schema === false) { + falseSchemaError(it, false); + } + else if (typeof schema == "object" && schema.$async === true) { + gen.return(names_1.default.data); + } + else { + gen.assign((0, codegen_1._) `${validateName}.errors`, null); + gen.return(true); + } +} +exports.topBoolOrEmptySchema = topBoolOrEmptySchema; +function boolOrEmptySchema(it, valid) { + const { gen, schema } = it; + if (schema === false) { + gen.var(valid, false); // TODO var + falseSchemaError(it); + } + else { + gen.var(valid, true); // TODO var + } +} +exports.boolOrEmptySchema = boolOrEmptySchema; +function falseSchemaError(it, overrideAllErrors) { + const { gen, data } = it; + // TODO maybe some other interface should be used for non-keyword validation errors... + const cxt = { + gen, + keyword: "false schema", + data, + schema: false, + schemaCode: false, + schemaValue: false, + params: {}, + it, + }; + (0, errors_1.reportError)(cxt, boolError, undefined, overrideAllErrors); +} +//# sourceMappingURL=boolSchema.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/boolSchema.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/boolSchema.js.map new file mode 100644 index 000000000..4aa6c99a6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/boolSchema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"boolSchema.js","sourceRoot":"","sources":["../../../lib/compile/validate/boolSchema.ts"],"names":[],"mappings":";;;AAEA,sCAAqC;AACrC,wCAAkC;AAClC,oCAAwB;AAExB,MAAM,SAAS,GAA2B;IACxC,OAAO,EAAE,yBAAyB;CACnC,CAAA;AAED,SAAgB,oBAAoB,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E,iBAAiB,CAAC,CAAA;AAC3D,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/dataType.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/dataType.d.ts new file mode 100644 index 000000000..65c1268ec --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/dataType.d.ts @@ -0,0 +1,17 @@ +import type { ErrorObject, AnySchemaObject } from "../../types"; +import type { SchemaObjCxt } from ".."; +import { JSONType } from "../rules"; +import { Code, Name } from "../codegen"; +export declare enum DataType { + Correct = 0, + Wrong = 1 +} +export declare function getSchemaTypes(schema: AnySchemaObject): JSONType[]; +export declare function getJSONTypes(ts: unknown | unknown[]): JSONType[]; +export declare function coerceAndCheckDataType(it: SchemaObjCxt, types: JSONType[]): boolean; +export declare function checkDataType(dataType: JSONType, data: Name, strictNums?: boolean | "log", correct?: DataType): Code; +export declare function checkDataTypes(dataTypes: JSONType[], data: Name, strictNums?: boolean | "log", correct?: DataType): Code; +export declare type TypeError = ErrorObject<"type", { + type: string; +}>; +export declare function reportTypeError(it: SchemaObjCxt): void; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/dataType.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/dataType.js new file mode 100644 index 000000000..1732d4666 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/dataType.js @@ -0,0 +1,202 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = void 0; +const rules_1 = require("../rules"); +const applicability_1 = require("./applicability"); +const errors_1 = require("../errors"); +const codegen_1 = require("../codegen"); +const util_1 = require("../util"); +var DataType; +(function (DataType) { + DataType[DataType["Correct"] = 0] = "Correct"; + DataType[DataType["Wrong"] = 1] = "Wrong"; +})(DataType = exports.DataType || (exports.DataType = {})); +function getSchemaTypes(schema) { + const types = getJSONTypes(schema.type); + const hasNull = types.includes("null"); + if (hasNull) { + if (schema.nullable === false) + throw new Error("type: null contradicts nullable: false"); + } + else { + if (!types.length && schema.nullable !== undefined) { + throw new Error('"nullable" cannot be used without "type"'); + } + if (schema.nullable === true) + types.push("null"); + } + return types; +} +exports.getSchemaTypes = getSchemaTypes; +function getJSONTypes(ts) { + const types = Array.isArray(ts) ? ts : ts ? [ts] : []; + if (types.every(rules_1.isJSONType)) + return types; + throw new Error("type must be JSONType or JSONType[]: " + types.join(",")); +} +exports.getJSONTypes = getJSONTypes; +function coerceAndCheckDataType(it, types) { + const { gen, data, opts } = it; + const coerceTo = coerceToTypes(types, opts.coerceTypes); + const checkTypes = types.length > 0 && + !(coerceTo.length === 0 && types.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types[0])); + if (checkTypes) { + const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong); + gen.if(wrongType, () => { + if (coerceTo.length) + coerceData(it, types, coerceTo); + else + reportTypeError(it); + }); + } + return checkTypes; +} +exports.coerceAndCheckDataType = coerceAndCheckDataType; +const COERCIBLE = new Set(["string", "number", "integer", "boolean", "null"]); +function coerceToTypes(types, coerceTypes) { + return coerceTypes + ? types.filter((t) => COERCIBLE.has(t) || (coerceTypes === "array" && t === "array")) + : []; +} +function coerceData(it, types, coerceTo) { + const { gen, data, opts } = it; + const dataType = gen.let("dataType", (0, codegen_1._) `typeof ${data}`); + const coerced = gen.let("coerced", (0, codegen_1._) `undefined`); + if (opts.coerceTypes === "array") { + gen.if((0, codegen_1._) `${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen + .assign(data, (0, codegen_1._) `${data}[0]`) + .assign(dataType, (0, codegen_1._) `typeof ${data}`) + .if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data))); + } + gen.if((0, codegen_1._) `${coerced} !== undefined`); + for (const t of coerceTo) { + if (COERCIBLE.has(t) || (t === "array" && opts.coerceTypes === "array")) { + coerceSpecificType(t); + } + } + gen.else(); + reportTypeError(it); + gen.endIf(); + gen.if((0, codegen_1._) `${coerced} !== undefined`, () => { + gen.assign(data, coerced); + assignParentData(it, coerced); + }); + function coerceSpecificType(t) { + switch (t) { + case "string": + gen + .elseIf((0, codegen_1._) `${dataType} == "number" || ${dataType} == "boolean"`) + .assign(coerced, (0, codegen_1._) `"" + ${data}`) + .elseIf((0, codegen_1._) `${data} === null`) + .assign(coerced, (0, codegen_1._) `""`); + return; + case "number": + gen + .elseIf((0, codegen_1._) `${dataType} == "boolean" || ${data} === null + || (${dataType} == "string" && ${data} && ${data} == +${data})`) + .assign(coerced, (0, codegen_1._) `+${data}`); + return; + case "integer": + gen + .elseIf((0, codegen_1._) `${dataType} === "boolean" || ${data} === null + || (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`) + .assign(coerced, (0, codegen_1._) `+${data}`); + return; + case "boolean": + gen + .elseIf((0, codegen_1._) `${data} === "false" || ${data} === 0 || ${data} === null`) + .assign(coerced, false) + .elseIf((0, codegen_1._) `${data} === "true" || ${data} === 1`) + .assign(coerced, true); + return; + case "null": + gen.elseIf((0, codegen_1._) `${data} === "" || ${data} === 0 || ${data} === false`); + gen.assign(coerced, null); + return; + case "array": + gen + .elseIf((0, codegen_1._) `${dataType} === "string" || ${dataType} === "number" + || ${dataType} === "boolean" || ${data} === null`) + .assign(coerced, (0, codegen_1._) `[${data}]`); + } + } +} +function assignParentData({ gen, parentData, parentDataProperty }, expr) { + // TODO use gen.property + gen.if((0, codegen_1._) `${parentData} !== undefined`, () => gen.assign((0, codegen_1._) `${parentData}[${parentDataProperty}]`, expr)); +} +function checkDataType(dataType, data, strictNums, correct = DataType.Correct) { + const EQ = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ; + let cond; + switch (dataType) { + case "null": + return (0, codegen_1._) `${data} ${EQ} null`; + case "array": + cond = (0, codegen_1._) `Array.isArray(${data})`; + break; + case "object": + cond = (0, codegen_1._) `${data} && typeof ${data} == "object" && !Array.isArray(${data})`; + break; + case "integer": + cond = numCond((0, codegen_1._) `!(${data} % 1) && !isNaN(${data})`); + break; + case "number": + cond = numCond(); + break; + default: + return (0, codegen_1._) `typeof ${data} ${EQ} ${dataType}`; + } + return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond); + function numCond(_cond = codegen_1.nil) { + return (0, codegen_1.and)((0, codegen_1._) `typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1._) `isFinite(${data})` : codegen_1.nil); + } +} +exports.checkDataType = checkDataType; +function checkDataTypes(dataTypes, data, strictNums, correct) { + if (dataTypes.length === 1) { + return checkDataType(dataTypes[0], data, strictNums, correct); + } + let cond; + const types = (0, util_1.toHash)(dataTypes); + if (types.array && types.object) { + const notObj = (0, codegen_1._) `typeof ${data} != "object"`; + cond = types.null ? notObj : (0, codegen_1._) `!${data} || ${notObj}`; + delete types.null; + delete types.array; + delete types.object; + } + else { + cond = codegen_1.nil; + } + if (types.number) + delete types.integer; + for (const t in types) + cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct)); + return cond; +} +exports.checkDataTypes = checkDataTypes; +const typeError = { + message: ({ schema }) => `must be ${schema}`, + params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1._) `{type: ${schema}}` : (0, codegen_1._) `{type: ${schemaValue}}`, +}; +function reportTypeError(it) { + const cxt = getTypeErrorContext(it); + (0, errors_1.reportError)(cxt, typeError); +} +exports.reportTypeError = reportTypeError; +function getTypeErrorContext(it) { + const { gen, data, schema } = it; + const schemaCode = (0, util_1.schemaRefOrVal)(it, schema, "type"); + return { + gen, + keyword: "type", + data, + schema: schema.type, + schemaCode, + schemaValue: schemaCode, + parentSchema: schema, + params: {}, + it, + }; +} +//# sourceMappingURL=dataType.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/dataType.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/dataType.js.map new file mode 100644 index 000000000..f19c40bc9 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/dataType.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dataType.js","sourceRoot":"","sources":["../../../lib/compile/validate/dataType.ts"],"names":[],"mappings":";;;AAOA,oCAA6C;AAC7C,mDAAqD;AACrD,sCAAqC;AACrC,wCAAkE;AAClE,kCAA8C;AAE9C,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,6CAAO,CAAA;IACP,yCAAK,CAAA;AACP,CAAC,EAHW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAGnB;AAED,SAAgB,cAAc,CAAC,MAAuB;IACpD,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACvC,MAAM,OAAO,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;IACtC,IAAI,OAAO,EAAE;QACX,IAAI,MAAM,CAAC,QAAQ,KAAK,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;KACzF;SAAM;QACL,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC,QAAQ,KAAK,SAAS,EAAE;YAClD,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;SAC5D;QACD,IAAI,MAAM,CAAC,QAAQ,KAAK,IAAI;YAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;KACjD;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAZD,wCAYC;AAED,SAAgB,YAAY,CAAC,EAAuB;IAClD,MAAM,KAAK,GAAc,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IAChE,IAAI,KAAK,CAAC,KAAK,CAAC,kBAAU,CAAC;QAAE,OAAO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nC,IAAA,oBAAW,EAAC,GAAG,EAAE,SAAS,CAAC,CAAA;AAC7B,CAAC;AAHD,0CAGC;AAED,SAAS,mBAAmB,CAAC,EAAgB;IAC3C,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAC,GAAG,EAAE,CAAA;IAC9B,MAAM,UAAU,GAAG,IAAA,qBAAc,EAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IACrD,OAAO;QACL,GAAG;QACH,OAAO,EAAE,MAAM;QACf,IAAI;QACJ,MAAM,EAAE,MAAM,CAAC,IAAI;QACnB,UAAU;QACV,WAAW,EAAE,UAAU;QACvB,YAAY,EAAE,MAAM;QACpB,MAAM,EAAE,EAAE;QACV,EAAE;KACH,CAAA;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/defaults.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/defaults.d.ts new file mode 100644 index 000000000..02ba453b2 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/defaults.d.ts @@ -0,0 +1,2 @@ +import type { SchemaObjCxt } from ".."; +export declare function assignDefaults(it: SchemaObjCxt, ty?: string): void; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/defaults.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/defaults.js new file mode 100644 index 000000000..cd9c42d9a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/defaults.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.assignDefaults = void 0; +const codegen_1 = require("../codegen"); +const util_1 = require("../util"); +function assignDefaults(it, ty) { + const { properties, items } = it.schema; + if (ty === "object" && properties) { + for (const key in properties) { + assignDefault(it, key, properties[key].default); + } + } + else if (ty === "array" && Array.isArray(items)) { + items.forEach((sch, i) => assignDefault(it, i, sch.default)); + } +} +exports.assignDefaults = assignDefaults; +function assignDefault(it, prop, defaultValue) { + const { gen, compositeRule, data, opts } = it; + if (defaultValue === undefined) + return; + const childData = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(prop)}`; + if (compositeRule) { + (0, util_1.checkStrictMode)(it, `default is ignored for: ${childData}`); + return; + } + let condition = (0, codegen_1._) `${childData} === undefined`; + if (opts.useDefaults === "empty") { + condition = (0, codegen_1._) `${condition} || ${childData} === null || ${childData} === ""`; + } + // `${childData} === undefined` + + // (opts.useDefaults === "empty" ? ` || ${childData} === null || ${childData} === ""` : "") + gen.if(condition, (0, codegen_1._) `${childData} = ${(0, codegen_1.stringify)(defaultValue)}`); +} +//# sourceMappingURL=defaults.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/defaults.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/defaults.js.map new file mode 100644 index 000000000..c435d0578 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/defaults.js.map @@ -0,0 +1 @@ +{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../lib/compile/validate/defaults.ts"],"names":[],"mappings":";;;AACA,wCAAoD;AACpD,kCAAuC;AAEvC,SAAgB,cAAc,CAAC,EAAgB,EAAE,EAAW;IAC1D,MAAM,EAAC,UAAU,EAAE,KAAK,EAAC,GAAG,EAAE,CAAC,MAAM,CAAA;IACrC,IAAI,EAAE,KAAK,QAAQ,IAAI,UAAU,EAAE;QACjC,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE;YAC5B,aAAa,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAA;SAChD;KACF;SAAM,IAAI,EAAE,KAAK,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAS,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;KACrE;AACH,CAAC;AATD,wCASC;AAED,SAAS,aAAa,CAAC,EAAgB,EAAE,IAAqB,EAAE,YAAqB;IACnF,MAAM,EAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IAC3C,IAAI,YAAY,KAAK,SAAS;QAAE,OAAM;IACtC,MAAM,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,GAAG,IAAA,qBAAW,EAAC,IAAI,CAAC,EAAE,CAAA;IAChD,IAAI,aAAa,EAAE;QACjB,IAAA,sBAAe,EAAC,EAAE,EAAE,2BAA2B,SAAS,EAAE,CAAC,CAAA;QAC3D,OAAM;KACP;IAED,IAAI,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,SAAS,gBAAgB,CAAA;IAC7C,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO,EAAE;QAChC,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,SAAS,OAAO,SAAS,gBAAgB,SAAS,SAAS,CAAA;KAC5E;IACD,iCAAiC;IACjC,2FAA2F;IAC3F,GAAG,CAAC,EAAE,CAAC,SAAS,EAAE,IAAA,WAAC,EAAA,GAAG,SAAS,MAAM,IAAA,mBAAS,EAAC,YAAY,CAAC,EAAE,CAAC,CAAA;AACjE,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/index.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/index.d.ts new file mode 100644 index 000000000..6c533ed72 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/index.d.ts @@ -0,0 +1,42 @@ +import type { AddedKeywordDefinition, AnySchemaObject, KeywordErrorCxt, KeywordCxtParams } from "../../types"; +import type { SchemaCxt, SchemaObjCxt } from ".."; +import { SubschemaArgs } from "./subschema"; +import { Code, Name, CodeGen } from "../codegen"; +import type { JSONType } from "../rules"; +import { ErrorPaths } from "../errors"; +export declare function validateFunctionCode(it: SchemaCxt): void; +export declare class KeywordCxt implements KeywordErrorCxt { + readonly gen: CodeGen; + readonly allErrors?: boolean; + readonly keyword: string; + readonly data: Name; + readonly $data?: string | false; + schema: any; + readonly schemaValue: Code | number | boolean; + readonly schemaCode: Code | number | boolean; + readonly schemaType: JSONType[]; + readonly parentSchema: AnySchemaObject; + readonly errsCount?: Name; + params: KeywordCxtParams; + readonly it: SchemaObjCxt; + readonly def: AddedKeywordDefinition; + constructor(it: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string); + result(condition: Code, successAction?: () => void, failAction?: () => void): void; + failResult(condition: Code, successAction?: () => void, failAction?: () => void): void; + pass(condition: Code, failAction?: () => void): void; + fail(condition?: Code): void; + fail$data(condition: Code): void; + error(append?: boolean, errorParams?: KeywordCxtParams, errorPaths?: ErrorPaths): void; + private _error; + $dataError(): void; + reset(): void; + ok(cond: Code | boolean): void; + setParams(obj: KeywordCxtParams, assign?: true): void; + block$data(valid: Name, codeBlock: () => void, $dataValid?: Code): void; + check$data(valid?: Name, $dataValid?: Code): void; + invalid$data(): Code; + subschema(appl: SubschemaArgs, valid: Name): SchemaCxt; + mergeEvaluated(schemaCxt: SchemaCxt, toName?: typeof Name): void; + mergeValidEvaluated(schemaCxt: SchemaCxt, valid: Name): boolean | void; +} +export declare function getData($data: string, { dataLevel, dataNames, dataPathArr }: SchemaCxt): Code | number; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/index.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/index.js new file mode 100644 index 000000000..fffcd5f0c --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/index.js @@ -0,0 +1,510 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getData = exports.KeywordCxt = exports.validateFunctionCode = void 0; +const boolSchema_1 = require("./boolSchema"); +const dataType_1 = require("./dataType"); +const applicability_1 = require("./applicability"); +const dataType_2 = require("./dataType"); +const defaults_1 = require("./defaults"); +const keyword_1 = require("./keyword"); +const subschema_1 = require("./subschema"); +const codegen_1 = require("../codegen"); +const names_1 = require("../names"); +const resolve_1 = require("../resolve"); +const util_1 = require("../util"); +const errors_1 = require("../errors"); +// schema compilation - generates validation function, subschemaCode (below) is used for subschemas +function validateFunctionCode(it) { + if (isSchemaObj(it)) { + checkKeywords(it); + if (schemaCxtHasRules(it)) { + topSchemaObjCode(it); + return; + } + } + validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it)); +} +exports.validateFunctionCode = validateFunctionCode; +function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) { + if (opts.code.es5) { + gen.func(validateName, (0, codegen_1._) `${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => { + gen.code((0, codegen_1._) `"use strict"; ${funcSourceUrl(schema, opts)}`); + destructureValCxtES5(gen, opts); + gen.code(body); + }); + } + else { + gen.func(validateName, (0, codegen_1._) `${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body)); + } +} +function destructureValCxt(opts) { + return (0, codegen_1._) `{${names_1.default.instancePath}="", ${names_1.default.parentData}, ${names_1.default.parentDataProperty}, ${names_1.default.rootData}=${names_1.default.data}${opts.dynamicRef ? (0, codegen_1._) `, ${names_1.default.dynamicAnchors}={}` : codegen_1.nil}}={}`; +} +function destructureValCxtES5(gen, opts) { + gen.if(names_1.default.valCxt, () => { + gen.var(names_1.default.instancePath, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.instancePath}`); + gen.var(names_1.default.parentData, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.parentData}`); + gen.var(names_1.default.parentDataProperty, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.parentDataProperty}`); + gen.var(names_1.default.rootData, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.rootData}`); + if (opts.dynamicRef) + gen.var(names_1.default.dynamicAnchors, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.dynamicAnchors}`); + }, () => { + gen.var(names_1.default.instancePath, (0, codegen_1._) `""`); + gen.var(names_1.default.parentData, (0, codegen_1._) `undefined`); + gen.var(names_1.default.parentDataProperty, (0, codegen_1._) `undefined`); + gen.var(names_1.default.rootData, names_1.default.data); + if (opts.dynamicRef) + gen.var(names_1.default.dynamicAnchors, (0, codegen_1._) `{}`); + }); +} +function topSchemaObjCode(it) { + const { schema, opts, gen } = it; + validateFunction(it, () => { + if (opts.$comment && schema.$comment) + commentKeyword(it); + checkNoDefault(it); + gen.let(names_1.default.vErrors, null); + gen.let(names_1.default.errors, 0); + if (opts.unevaluated) + resetEvaluated(it); + typeAndKeywords(it); + returnResults(it); + }); + return; +} +function resetEvaluated(it) { + // TODO maybe some hook to execute it in the end to check whether props/items are Name, as in assignEvaluated + const { gen, validateName } = it; + it.evaluated = gen.const("evaluated", (0, codegen_1._) `${validateName}.evaluated`); + gen.if((0, codegen_1._) `${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1._) `${it.evaluated}.props`, (0, codegen_1._) `undefined`)); + gen.if((0, codegen_1._) `${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1._) `${it.evaluated}.items`, (0, codegen_1._) `undefined`)); +} +function funcSourceUrl(schema, opts) { + const schId = typeof schema == "object" && schema[opts.schemaId]; + return schId && (opts.code.source || opts.code.process) ? (0, codegen_1._) `/*# sourceURL=${schId} */` : codegen_1.nil; +} +// schema compilation - this function is used recursively to generate code for sub-schemas +function subschemaCode(it, valid) { + if (isSchemaObj(it)) { + checkKeywords(it); + if (schemaCxtHasRules(it)) { + subSchemaObjCode(it, valid); + return; + } + } + (0, boolSchema_1.boolOrEmptySchema)(it, valid); +} +function schemaCxtHasRules({ schema, self }) { + if (typeof schema == "boolean") + return !schema; + for (const key in schema) + if (self.RULES.all[key]) + return true; + return false; +} +function isSchemaObj(it) { + return typeof it.schema != "boolean"; +} +function subSchemaObjCode(it, valid) { + const { schema, gen, opts } = it; + if (opts.$comment && schema.$comment) + commentKeyword(it); + updateContext(it); + checkAsyncSchema(it); + const errsCount = gen.const("_errs", names_1.default.errors); + typeAndKeywords(it, errsCount); + // TODO var + gen.var(valid, (0, codegen_1._) `${errsCount} === ${names_1.default.errors}`); +} +function checkKeywords(it) { + (0, util_1.checkUnknownRules)(it); + checkRefsAndKeywords(it); +} +function typeAndKeywords(it, errsCount) { + if (it.opts.jtd) + return schemaKeywords(it, [], false, errsCount); + const types = (0, dataType_1.getSchemaTypes)(it.schema); + const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it, types); + schemaKeywords(it, types, !checkedTypes, errsCount); +} +function checkRefsAndKeywords(it) { + const { schema, errSchemaPath, opts, self } = it; + if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema, self.RULES)) { + self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`); + } +} +function checkNoDefault(it) { + const { schema, opts } = it; + if (schema.default !== undefined && opts.useDefaults && opts.strictSchema) { + (0, util_1.checkStrictMode)(it, "default is ignored in the schema root"); + } +} +function updateContext(it) { + const schId = it.schema[it.opts.schemaId]; + if (schId) + it.baseId = (0, resolve_1.resolveUrl)(it.opts.uriResolver, it.baseId, schId); +} +function checkAsyncSchema(it) { + if (it.schema.$async && !it.schemaEnv.$async) + throw new Error("async schema in sync schema"); +} +function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) { + const msg = schema.$comment; + if (opts.$comment === true) { + gen.code((0, codegen_1._) `${names_1.default.self}.logger.log(${msg})`); + } + else if (typeof opts.$comment == "function") { + const schemaPath = (0, codegen_1.str) `${errSchemaPath}/$comment`; + const rootName = gen.scopeValue("root", { ref: schemaEnv.root }); + gen.code((0, codegen_1._) `${names_1.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`); + } +} +function returnResults(it) { + const { gen, schemaEnv, validateName, ValidationError, opts } = it; + if (schemaEnv.$async) { + // TODO assign unevaluated + gen.if((0, codegen_1._) `${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._) `new ${ValidationError}(${names_1.default.vErrors})`)); + } + else { + gen.assign((0, codegen_1._) `${validateName}.errors`, names_1.default.vErrors); + if (opts.unevaluated) + assignEvaluated(it); + gen.return((0, codegen_1._) `${names_1.default.errors} === 0`); + } +} +function assignEvaluated({ gen, evaluated, props, items }) { + if (props instanceof codegen_1.Name) + gen.assign((0, codegen_1._) `${evaluated}.props`, props); + if (items instanceof codegen_1.Name) + gen.assign((0, codegen_1._) `${evaluated}.items`, items); +} +function schemaKeywords(it, types, typeErrors, errsCount) { + const { gen, schema, data, allErrors, opts, self } = it; + const { RULES } = self; + if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema, RULES))) { + gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition)); // TODO typecast + return; + } + if (!opts.jtd) + checkStrictTypes(it, types); + gen.block(() => { + for (const group of RULES.rules) + groupKeywords(group); + groupKeywords(RULES.post); + }); + function groupKeywords(group) { + if (!(0, applicability_1.shouldUseGroup)(schema, group)) + return; + if (group.type) { + gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers)); + iterateKeywords(it, group); + if (types.length === 1 && types[0] === group.type && typeErrors) { + gen.else(); + (0, dataType_2.reportTypeError)(it); + } + gen.endIf(); + } + else { + iterateKeywords(it, group); + } + // TODO make it "ok" call? + if (!allErrors) + gen.if((0, codegen_1._) `${names_1.default.errors} === ${errsCount || 0}`); + } +} +function iterateKeywords(it, group) { + const { gen, schema, opts: { useDefaults }, } = it; + if (useDefaults) + (0, defaults_1.assignDefaults)(it, group.type); + gen.block(() => { + for (const rule of group.rules) { + if ((0, applicability_1.shouldUseRule)(schema, rule)) { + keywordCode(it, rule.keyword, rule.definition, group.type); + } + } + }); +} +function checkStrictTypes(it, types) { + if (it.schemaEnv.meta || !it.opts.strictTypes) + return; + checkContextTypes(it, types); + if (!it.opts.allowUnionTypes) + checkMultipleTypes(it, types); + checkKeywordTypes(it, it.dataTypes); +} +function checkContextTypes(it, types) { + if (!types.length) + return; + if (!it.dataTypes.length) { + it.dataTypes = types; + return; + } + types.forEach((t) => { + if (!includesType(it.dataTypes, t)) { + strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`); + } + }); + it.dataTypes = it.dataTypes.filter((t) => includesType(types, t)); +} +function checkMultipleTypes(it, ts) { + if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) { + strictTypesError(it, "use allowUnionTypes to allow union type keyword"); + } +} +function checkKeywordTypes(it, ts) { + const rules = it.self.RULES.all; + for (const keyword in rules) { + const rule = rules[keyword]; + if (typeof rule == "object" && (0, applicability_1.shouldUseRule)(it.schema, rule)) { + const { type } = rule.definition; + if (type.length && !type.some((t) => hasApplicableType(ts, t))) { + strictTypesError(it, `missing type "${type.join(",")}" for keyword "${keyword}"`); + } + } + } +} +function hasApplicableType(schTs, kwdT) { + return schTs.includes(kwdT) || (kwdT === "number" && schTs.includes("integer")); +} +function includesType(ts, t) { + return ts.includes(t) || (t === "integer" && ts.includes("number")); +} +function strictTypesError(it, msg) { + const schemaPath = it.schemaEnv.baseId + it.errSchemaPath; + msg += ` at "${schemaPath}" (strictTypes)`; + (0, util_1.checkStrictMode)(it, msg, it.opts.strictTypes); +} +class KeywordCxt { + constructor(it, def, keyword) { + (0, keyword_1.validateKeywordUsage)(it, def, keyword); + this.gen = it.gen; + this.allErrors = it.allErrors; + this.keyword = keyword; + this.data = it.data; + this.schema = it.schema[keyword]; + this.$data = def.$data && it.opts.$data && this.schema && this.schema.$data; + this.schemaValue = (0, util_1.schemaRefOrVal)(it, this.schema, keyword, this.$data); + this.schemaType = def.schemaType; + this.parentSchema = it.schema; + this.params = {}; + this.it = it; + this.def = def; + if (this.$data) { + this.schemaCode = it.gen.const("vSchema", getData(this.$data, it)); + } + else { + this.schemaCode = this.schemaValue; + if (!(0, keyword_1.validSchemaType)(this.schema, def.schemaType, def.allowUndefined)) { + throw new Error(`${keyword} value must be ${JSON.stringify(def.schemaType)}`); + } + } + if ("code" in def ? def.trackErrors : def.errors !== false) { + this.errsCount = it.gen.const("_errs", names_1.default.errors); + } + } + result(condition, successAction, failAction) { + this.failResult((0, codegen_1.not)(condition), successAction, failAction); + } + failResult(condition, successAction, failAction) { + this.gen.if(condition); + if (failAction) + failAction(); + else + this.error(); + if (successAction) { + this.gen.else(); + successAction(); + if (this.allErrors) + this.gen.endIf(); + } + else { + if (this.allErrors) + this.gen.endIf(); + else + this.gen.else(); + } + } + pass(condition, failAction) { + this.failResult((0, codegen_1.not)(condition), undefined, failAction); + } + fail(condition) { + if (condition === undefined) { + this.error(); + if (!this.allErrors) + this.gen.if(false); // this branch will be removed by gen.optimize + return; + } + this.gen.if(condition); + this.error(); + if (this.allErrors) + this.gen.endIf(); + else + this.gen.else(); + } + fail$data(condition) { + if (!this.$data) + return this.fail(condition); + const { schemaCode } = this; + this.fail((0, codegen_1._) `${schemaCode} !== undefined && (${(0, codegen_1.or)(this.invalid$data(), condition)})`); + } + error(append, errorParams, errorPaths) { + if (errorParams) { + this.setParams(errorParams); + this._error(append, errorPaths); + this.setParams({}); + return; + } + this._error(append, errorPaths); + } + _error(append, errorPaths) { + ; + (append ? errors_1.reportExtraError : errors_1.reportError)(this, this.def.error, errorPaths); + } + $dataError() { + (0, errors_1.reportError)(this, this.def.$dataError || errors_1.keyword$DataError); + } + reset() { + if (this.errsCount === undefined) + throw new Error('add "trackErrors" to keyword definition'); + (0, errors_1.resetErrorsCount)(this.gen, this.errsCount); + } + ok(cond) { + if (!this.allErrors) + this.gen.if(cond); + } + setParams(obj, assign) { + if (assign) + Object.assign(this.params, obj); + else + this.params = obj; + } + block$data(valid, codeBlock, $dataValid = codegen_1.nil) { + this.gen.block(() => { + this.check$data(valid, $dataValid); + codeBlock(); + }); + } + check$data(valid = codegen_1.nil, $dataValid = codegen_1.nil) { + if (!this.$data) + return; + const { gen, schemaCode, schemaType, def } = this; + gen.if((0, codegen_1.or)((0, codegen_1._) `${schemaCode} === undefined`, $dataValid)); + if (valid !== codegen_1.nil) + gen.assign(valid, true); + if (schemaType.length || def.validateSchema) { + gen.elseIf(this.invalid$data()); + this.$dataError(); + if (valid !== codegen_1.nil) + gen.assign(valid, false); + } + gen.else(); + } + invalid$data() { + const { gen, schemaCode, schemaType, def, it } = this; + return (0, codegen_1.or)(wrong$DataType(), invalid$DataSchema()); + function wrong$DataType() { + if (schemaType.length) { + /* istanbul ignore if */ + if (!(schemaCode instanceof codegen_1.Name)) + throw new Error("ajv implementation error"); + const st = Array.isArray(schemaType) ? schemaType : [schemaType]; + return (0, codegen_1._) `${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`; + } + return codegen_1.nil; + } + function invalid$DataSchema() { + if (def.validateSchema) { + const validateSchemaRef = gen.scopeValue("validate$data", { ref: def.validateSchema }); // TODO value.code for standalone + return (0, codegen_1._) `!${validateSchemaRef}(${schemaCode})`; + } + return codegen_1.nil; + } + } + subschema(appl, valid) { + const subschema = (0, subschema_1.getSubschema)(this.it, appl); + (0, subschema_1.extendSubschemaData)(subschema, this.it, appl); + (0, subschema_1.extendSubschemaMode)(subschema, appl); + const nextContext = { ...this.it, ...subschema, items: undefined, props: undefined }; + subschemaCode(nextContext, valid); + return nextContext; + } + mergeEvaluated(schemaCxt, toName) { + const { it, gen } = this; + if (!it.opts.unevaluated) + return; + if (it.props !== true && schemaCxt.props !== undefined) { + it.props = util_1.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName); + } + if (it.items !== true && schemaCxt.items !== undefined) { + it.items = util_1.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName); + } + } + mergeValidEvaluated(schemaCxt, valid) { + const { it, gen } = this; + if (it.opts.unevaluated && (it.props !== true || it.items !== true)) { + gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_1.Name)); + return true; + } + } +} +exports.KeywordCxt = KeywordCxt; +function keywordCode(it, keyword, def, ruleType) { + const cxt = new KeywordCxt(it, def, keyword); + if ("code" in def) { + def.code(cxt, ruleType); + } + else if (cxt.$data && def.validate) { + (0, keyword_1.funcKeywordCode)(cxt, def); + } + else if ("macro" in def) { + (0, keyword_1.macroKeywordCode)(cxt, def); + } + else if (def.compile || def.validate) { + (0, keyword_1.funcKeywordCode)(cxt, def); + } +} +const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/; +const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; +function getData($data, { dataLevel, dataNames, dataPathArr }) { + let jsonPointer; + let data; + if ($data === "") + return names_1.default.rootData; + if ($data[0] === "/") { + if (!JSON_POINTER.test($data)) + throw new Error(`Invalid JSON-pointer: ${$data}`); + jsonPointer = $data; + data = names_1.default.rootData; + } + else { + const matches = RELATIVE_JSON_POINTER.exec($data); + if (!matches) + throw new Error(`Invalid JSON-pointer: ${$data}`); + const up = +matches[1]; + jsonPointer = matches[2]; + if (jsonPointer === "#") { + if (up >= dataLevel) + throw new Error(errorMsg("property/index", up)); + return dataPathArr[dataLevel - up]; + } + if (up > dataLevel) + throw new Error(errorMsg("data", up)); + data = dataNames[dataLevel - up]; + if (!jsonPointer) + return data; + } + let expr = data; + const segments = jsonPointer.split("/"); + for (const segment of segments) { + if (segment) { + data = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)((0, util_1.unescapeJsonPointer)(segment))}`; + expr = (0, codegen_1._) `${expr} && ${data}`; + } + } + return expr; + function errorMsg(pointerType, up) { + return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`; + } +} +exports.getData = getData; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/index.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/index.js.map new file mode 100644 index 000000000..b9ed9428e --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/index.js.map @@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AC,CAAA;QACxB,IAAI,WAAW,KAAK,GAAG,EAAE;YACvB,IAAI,EAAE,IAAI,SAAS;gBAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC,CAAA;YACpE,OAAO,WAAW,CAAC,SAAS,GAAG,EAAE,CAAC,CAAA;SACnC;QACD,IAAI,EAAE,GAAG,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAA;QACzD,IAAI,GAAG,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC,CAAA;QAChC,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAA;KAC9B;IAED,IAAI,IAAI,GAAG,IAAI,CAAA;IACf,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACvC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC9B,IAAI,OAAO,EAAE;YACX,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,GAAG,IAAA,qBAAW,EAAC,IAAA,0BAAmB,EAAC,OAAO,CAAC,CAAC,EAAE,CAAA;YAC7D,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,OAAO,IAAI,EAAE,CAAA;SAC7B;KACF;IACD,OAAO,IAAI,CAAA;IAEX,SAAS,QAAQ,CAAC,WAAmB,EAAE,EAAU;QAC/C,OAAO,iBAAiB,WAAW,IAAI,EAAE,gCAAgC,SAAS,EAAE,CAAA;IACtF,CAAC;AACH,CAAC;AAtCD,0BAsCC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/keyword.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/keyword.d.ts new file mode 100644 index 000000000..d15cee878 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/keyword.d.ts @@ -0,0 +1,8 @@ +import type { KeywordCxt } from "."; +import type { AddedKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition } from "../../types"; +import type { SchemaObjCxt } from ".."; +import type { JSONType } from "../rules"; +export declare function macroKeywordCode(cxt: KeywordCxt, def: MacroKeywordDefinition): void; +export declare function funcKeywordCode(cxt: KeywordCxt, def: FuncKeywordDefinition): void; +export declare function validSchemaType(schema: unknown, schemaType: JSONType[], allowUndefined?: boolean): boolean; +export declare function validateKeywordUsage({ schema, opts, self, errSchemaPath }: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string): void; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/keyword.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/keyword.js new file mode 100644 index 000000000..1109d3a45 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/keyword.js @@ -0,0 +1,124 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateKeywordUsage = exports.validSchemaType = exports.funcKeywordCode = exports.macroKeywordCode = void 0; +const codegen_1 = require("../codegen"); +const names_1 = require("../names"); +const code_1 = require("../../vocabularies/code"); +const errors_1 = require("../errors"); +function macroKeywordCode(cxt, def) { + const { gen, keyword, schema, parentSchema, it } = cxt; + const macroSchema = def.macro.call(it.self, schema, parentSchema, it); + const schemaRef = useKeyword(gen, keyword, macroSchema); + if (it.opts.validateSchema !== false) + it.self.validateSchema(macroSchema, true); + const valid = gen.name("valid"); + cxt.subschema({ + schema: macroSchema, + schemaPath: codegen_1.nil, + errSchemaPath: `${it.errSchemaPath}/${keyword}`, + topSchemaRef: schemaRef, + compositeRule: true, + }, valid); + cxt.pass(valid, () => cxt.error(true)); +} +exports.macroKeywordCode = macroKeywordCode; +function funcKeywordCode(cxt, def) { + var _a; + const { gen, keyword, schema, parentSchema, $data, it } = cxt; + checkAsyncKeyword(it, def); + const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate; + const validateRef = useKeyword(gen, keyword, validate); + const valid = gen.let("valid"); + cxt.block$data(valid, validateKeyword); + cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid); + function validateKeyword() { + if (def.errors === false) { + assignValid(); + if (def.modifying) + modifyData(cxt); + reportErrs(() => cxt.error()); + } + else { + const ruleErrs = def.async ? validateAsync() : validateSync(); + if (def.modifying) + modifyData(cxt); + reportErrs(() => addErrs(cxt, ruleErrs)); + } + } + function validateAsync() { + const ruleErrs = gen.let("ruleErrs", null); + gen.try(() => assignValid((0, codegen_1._) `await `), (e) => gen.assign(valid, false).if((0, codegen_1._) `${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_1._) `${e}.errors`), () => gen.throw(e))); + return ruleErrs; + } + function validateSync() { + const validateErrs = (0, codegen_1._) `${validateRef}.errors`; + gen.assign(validateErrs, null); + assignValid(codegen_1.nil); + return validateErrs; + } + function assignValid(_await = def.async ? (0, codegen_1._) `await ` : codegen_1.nil) { + const passCxt = it.opts.passContext ? names_1.default.this : names_1.default.self; + const passSchema = !(("compile" in def && !$data) || def.schema === false); + gen.assign(valid, (0, codegen_1._) `${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying); + } + function reportErrs(errors) { + var _a; + gen.if((0, codegen_1.not)((_a = def.valid) !== null && _a !== void 0 ? _a : valid), errors); + } +} +exports.funcKeywordCode = funcKeywordCode; +function modifyData(cxt) { + const { gen, data, it } = cxt; + gen.if(it.parentData, () => gen.assign(data, (0, codegen_1._) `${it.parentData}[${it.parentDataProperty}]`)); +} +function addErrs(cxt, errs) { + const { gen } = cxt; + gen.if((0, codegen_1._) `Array.isArray(${errs})`, () => { + gen + .assign(names_1.default.vErrors, (0, codegen_1._) `${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`) + .assign(names_1.default.errors, (0, codegen_1._) `${names_1.default.vErrors}.length`); + (0, errors_1.extendErrors)(cxt); + }, () => cxt.error()); +} +function checkAsyncKeyword({ schemaEnv }, def) { + if (def.async && !schemaEnv.$async) + throw new Error("async keyword in sync schema"); +} +function useKeyword(gen, keyword, result) { + if (result === undefined) + throw new Error(`keyword "${keyword}" failed to compile`); + return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_1.stringify)(result) }); +} +function validSchemaType(schema, schemaType, allowUndefined = false) { + // TODO add tests + return (!schemaType.length || + schemaType.some((st) => st === "array" + ? Array.isArray(schema) + : st === "object" + ? schema && typeof schema == "object" && !Array.isArray(schema) + : typeof schema == st || (allowUndefined && typeof schema == "undefined"))); +} +exports.validSchemaType = validSchemaType; +function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def, keyword) { + /* istanbul ignore if */ + if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) { + throw new Error("ajv implementation error"); + } + const deps = def.dependencies; + if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) { + throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`); + } + if (def.validateSchema) { + const valid = def.validateSchema(schema[keyword]); + if (!valid) { + const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + + self.errorsText(def.validateSchema.errors); + if (opts.validateSchema === "log") + self.logger.error(msg); + else + throw new Error(msg); + } + } +} +exports.validateKeywordUsage = validateKeywordUsage; +//# sourceMappingURL=keyword.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/keyword.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/keyword.js.map new file mode 100644 index 000000000..10d716d7e --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/keyword.js.map @@ -0,0 +1 @@ +{"version":3,"file":"keyword.js","sourceRoot":"","sources":["../../../lib/compile/validate/keyword.ts"],"names":[],"mappings":";;;AAUA,wCAAsE;AACtE,oCAAwB;AAExB,kDAAwD;AACxD,sCAAsC;AAItC,SAAgB,gBAAgB,CAAC,GA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AS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE;QAC3E,MAAM,IAAI,KAAK,CAAC,2CAA2C,OAAO,KAAK,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;KACzF;IAED,IAAI,GAAG,CAAC,cAAc,EAAE;QACtB,MAAM,KAAK,GAAG,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAA;QACjD,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,GAAG,GACP,YAAY,OAAO,+BAA+B,aAAa,KAAK;gBACpE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;YAC5C,IAAI,IAAI,CAAC,cAAc,KAAK,KAAK;gBAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;;gBACpD,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;SAC1B;KACF;AACH,CAAC;AAzBD,oDAyBC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/subschema.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/subschema.d.ts new file mode 100644 index 000000000..8544271ab --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/subschema.d.ts @@ -0,0 +1,47 @@ +import type { AnySchema } from "../../types"; +import type { SchemaObjCxt } from ".."; +import { Code, Name } from "../codegen"; +import { Type } from "../util"; +import type { JSONType } from "../rules"; +export interface SubschemaContext { + schema: AnySchema; + schemaPath: Code; + errSchemaPath: string; + topSchemaRef?: Code; + errorPath?: Code; + dataLevel?: number; + dataTypes?: JSONType[]; + data?: Name; + parentData?: Name; + parentDataProperty?: Code | number; + dataNames?: Name[]; + dataPathArr?: (Code | number)[]; + propertyName?: Name; + jtdDiscriminator?: string; + jtdMetadata?: boolean; + compositeRule?: true; + createErrors?: boolean; + allErrors?: boolean; +} +export declare type SubschemaArgs = Partial<{ + keyword: string; + schemaProp: string | number; + schema: AnySchema; + schemaPath: Code; + errSchemaPath: string; + topSchemaRef: Code; + data: Name | Code; + dataProp: Code | string | number; + dataTypes: JSONType[]; + definedProperties: Set; + propertyName: Name; + dataPropType: Type; + jtdDiscriminator: string; + jtdMetadata: boolean; + compositeRule: true; + createErrors: boolean; + allErrors: boolean; +}>; +export declare function getSubschema(it: SchemaObjCxt, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }: SubschemaArgs): SubschemaContext; +export declare function extendSubschemaData(subschema: SubschemaContext, it: SchemaObjCxt, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }: SubschemaArgs): void; +export declare function extendSubschemaMode(subschema: SubschemaContext, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }: SubschemaArgs): void; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/subschema.js b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/subschema.js new file mode 100644 index 000000000..9de282869 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/subschema.js @@ -0,0 +1,81 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.extendSubschemaMode = exports.extendSubschemaData = exports.getSubschema = void 0; +const codegen_1 = require("../codegen"); +const util_1 = require("../util"); +function getSubschema(it, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) { + if (keyword !== undefined && schema !== undefined) { + throw new Error('both "keyword" and "schema" passed, only one allowed'); + } + if (keyword !== undefined) { + const sch = it.schema[keyword]; + return schemaProp === undefined + ? { + schema: sch, + schemaPath: (0, codegen_1._) `${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}`, + } + : { + schema: sch[schemaProp], + schemaPath: (0, codegen_1._) `${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}${(0, codegen_1.getProperty)(schemaProp)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}/${(0, util_1.escapeFragment)(schemaProp)}`, + }; + } + if (schema !== undefined) { + if (schemaPath === undefined || errSchemaPath === undefined || topSchemaRef === undefined) { + throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"'); + } + return { + schema, + schemaPath, + topSchemaRef, + errSchemaPath, + }; + } + throw new Error('either "keyword" or "schema" must be passed'); +} +exports.getSubschema = getSubschema; +function extendSubschemaData(subschema, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) { + if (data !== undefined && dataProp !== undefined) { + throw new Error('both "data" and "dataProp" passed, only one allowed'); + } + const { gen } = it; + if (dataProp !== undefined) { + const { errorPath, dataPathArr, opts } = it; + const nextData = gen.let("data", (0, codegen_1._) `${it.data}${(0, codegen_1.getProperty)(dataProp)}`, true); + dataContextProps(nextData); + subschema.errorPath = (0, codegen_1.str) `${errorPath}${(0, util_1.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`; + subschema.parentDataProperty = (0, codegen_1._) `${dataProp}`; + subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty]; + } + if (data !== undefined) { + const nextData = data instanceof codegen_1.Name ? data : gen.let("data", data, true); // replaceable if used once? + dataContextProps(nextData); + if (propertyName !== undefined) + subschema.propertyName = propertyName; + // TODO something is possibly wrong here with not changing parentDataProperty and not appending dataPathArr + } + if (dataTypes) + subschema.dataTypes = dataTypes; + function dataContextProps(_nextData) { + subschema.data = _nextData; + subschema.dataLevel = it.dataLevel + 1; + subschema.dataTypes = []; + it.definedProperties = new Set(); + subschema.parentData = it.data; + subschema.dataNames = [...it.dataNames, _nextData]; + } +} +exports.extendSubschemaData = extendSubschemaData; +function extendSubschemaMode(subschema, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) { + if (compositeRule !== undefined) + subschema.compositeRule = compositeRule; + if (createErrors !== undefined) + subschema.createErrors = createErrors; + if (allErrors !== undefined) + subschema.allErrors = allErrors; + subschema.jtdDiscriminator = jtdDiscriminator; // not inherited + subschema.jtdMetadata = jtdMetadata; // not inherited +} +exports.extendSubschemaMode = extendSubschemaMode; +//# sourceMappingURL=subschema.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/subschema.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/subschema.js.map new file mode 100644 index 000000000..a1b84d378 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/compile/validate/subschema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"subschema.js","sourceRoot":"","sources":["../../../lib/compile/validate/subschema.ts"],"names":[],"mappings":";;;AAEA,wCAA0D;AAC1D,kCAA0D;AA6C1D,SAAgB,YAAY,CAC1B,EAAgB,EAChB,EAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAAE,YAAY,EAAgB;IAErF,IAAI,OAAO,KAAK,SAAS,IAAI,MAAM,KAAK,SAAS,EAAE;QACjD,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;KACxE;IAED,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,MAAM,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAC9B,OAAO,UAAU,KAAK,SAAS;YAC7B,CAAC,CAAC;gBACE,MAAM,EAAE,GAAG;gBACX,UAAU,EAAE,IAAA,WAAC,EAAA,GAAG,EAAE,CAAC,UAAU,GAAG,IAAA,qBAAW,EAAC,OAAO,CAAC,EAAE;gBACtD,aAAa,EAAE,GAAG,EAAE,CAAC,aAAa,IAAI,OAAO,EAAE;aAChD;YACH,CAAC,CAAC;gBACE,MAAM,EAAE,GAAG,CAAC,UAAU,CAAC;gBACvB,UAAU,EAAE,IAAA,WAAC,EAAA,GAAG,EAAE,CAAC,UAAU,GAAG,IAAA,qBAAW,EAAC,OAAO,CAAC,GAAG,IAAA,qBAAW,EAAC,UAAU,CAAC,EAAE;gBAChF,aAAa,EAAE,GAAG,EA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,SAAS,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5D,SAAS,CAAC,gBAAgB,GAAG,gBAAgB,CAAA,CAAC,gBAAgB;IAC9D,SAAS,CAAC,WAAW,GAAG,WAAW,CAAA,CAAC,gBAAgB;AACtD,CAAC;AATD,kDASC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/core.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/core.d.ts new file mode 100644 index 000000000..ac3979922 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/core.d.ts @@ -0,0 +1,173 @@ +export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, AnyValidateFunction, ErrorObject, ErrorNoParams, } from "./types"; +export { SchemaCxt, SchemaObjCxt } from "./compile"; +export interface Plugin { + (ajv: Ajv, options?: Opts): Ajv; + [prop: string]: any; +} +export { KeywordCxt } from "./compile/validate"; +export { DefinedError } from "./vocabularies/errors"; +export { JSONType } from "./compile/rules"; +export { JSONSchemaType } from "./types/json-schema"; +export { JTDSchemaType, SomeJTDSchemaType, JTDDataType } from "./types/jtd-schema"; +export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; +import type { Schema, AnySchema, AnySchemaObject, SchemaObject, AsyncSchema, Vocabulary, KeywordDefinition, AddedKeywordDefinition, AnyValidateFunction, ValidateFunction, AsyncValidateFunction, ErrorObject, Format, AddedFormat, RegExpEngine, UriResolver } from "./types"; +import type { JSONSchemaType } from "./types/json-schema"; +import type { JTDSchemaType, SomeJTDSchemaType, JTDDataType } from "./types/jtd-schema"; +import ValidationError from "./runtime/validation_error"; +import MissingRefError from "./compile/ref_error"; +import { ValidationRules } from "./compile/rules"; +import { SchemaEnv } from "./compile"; +import { Code, ValueScope } from "./compile/codegen"; +export declare type Options = CurrentOptions & DeprecatedOptions; +export interface CurrentOptions { + strict?: boolean | "log"; + strictSchema?: boolean | "log"; + strictNumbers?: boolean | "log"; + strictTypes?: boolean | "log"; + strictTuples?: boolean | "log"; + strictRequired?: boolean | "log"; + allowMatchingProperties?: boolean; + allowUnionTypes?: boolean; + validateFormats?: boolean; + $data?: boolean; + allErrors?: boolean; + verbose?: boolean; + discriminator?: boolean; + unicodeRegExp?: boolean; + timestamp?: "string" | "date"; + parseDate?: boolean; + allowDate?: boolean; + $comment?: true | ((comment: string, schemaPath?: string, rootSchema?: AnySchemaObject) => unknown); + formats?: { + [Name in string]?: Format; + }; + keywords?: Vocabulary; + schemas?: AnySchema[] | { + [Key in string]?: AnySchema; + }; + logger?: Logger | false; + loadSchema?: (uri: string) => Promise; + removeAdditional?: boolean | "all" | "failing"; + useDefaults?: boolean | "empty"; + coerceTypes?: boolean | "array"; + next?: boolean; + unevaluated?: boolean; + dynamicRef?: boolean; + schemaId?: "id" | "$id"; + jtd?: boolean; + meta?: SchemaObject | boolean; + defaultMeta?: string | AnySchemaObject; + validateSchema?: boolean | "log"; + addUsedSchema?: boolean; + inlineRefs?: boolean | number; + passContext?: boolean; + loopRequired?: number; + loopEnum?: number; + ownProperties?: boolean; + multipleOfPrecision?: number; + int32range?: boolean; + messages?: boolean; + code?: CodeOptions; + uriResolver?: UriResolver; +} +export interface CodeOptions { + es5?: boolean; + esm?: boolean; + lines?: boolean; + optimize?: boolean | number; + formats?: Code; + source?: boolean; + process?: (code: string, schema?: SchemaEnv) => string; + regExp?: RegExpEngine; +} +interface InstanceCodeOptions extends CodeOptions { + regExp: RegExpEngine; + optimize: number; +} +interface DeprecatedOptions { + /** @deprecated */ + ignoreKeywordsWithRef?: boolean; + /** @deprecated */ + jsPropertySyntax?: boolean; + /** @deprecated */ + unicode?: boolean; +} +declare type RequiredInstanceOptions = { + [K in "strictSchema" | "strictNumbers" | "strictTypes" | "strictTuples" | "strictRequired" | "inlineRefs" | "loopRequired" | "loopEnum" | "meta" | "messages" | "schemaId" | "addUsedSchema" | "validateSchema" | "validateFormats" | "int32range" | "unicodeRegExp" | "uriResolver"]: NonNullable; +} & { + code: InstanceCodeOptions; +}; +export declare type InstanceOptions = Options & RequiredInstanceOptions; +export interface Logger { + log(...args: unknown[]): unknown; + warn(...args: unknown[]): unknown; + error(...args: unknown[]): unknown; +} +export default class Ajv { + opts: InstanceOptions; + errors?: ErrorObject[] | null; + logger: Logger; + readonly scope: ValueScope; + readonly schemas: { + [Key in string]?: SchemaEnv; + }; + readonly refs: { + [Ref in string]?: SchemaEnv | string; + }; + readonly formats: { + [Name in string]?: AddedFormat; + }; + readonly RULES: ValidationRules; + readonly _compilations: Set; + private readonly _loading; + private readonly _cache; + private readonly _metaOpts; + static ValidationError: typeof ValidationError; + static MissingRefError: typeof MissingRefError; + constructor(opts?: Options); + _addVocabularies(): void; + _addDefaultMetaSchema(): void; + defaultMeta(): string | AnySchemaObject | undefined; + validate(schema: Schema | string, data: unknown): boolean; + validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise; + validate(schema: Schema | JSONSchemaType | string, data: unknown): data is T; + validate(schema: JTDSchemaType, data: unknown): data is T; + validate(schema: T, data: unknown): data is JTDDataType; + validate(schema: AsyncSchema, data: unknown | T): Promise; + validate(schemaKeyRef: AnySchema | string, data: unknown): data is T | Promise; + compile(schema: Schema | JSONSchemaType, _meta?: boolean): ValidateFunction; + compile(schema: JTDSchemaType, _meta?: boolean): ValidateFunction; + compile(schema: T, _meta?: boolean): ValidateFunction>; + compile(schema: AsyncSchema, _meta?: boolean): AsyncValidateFunction; + compile(schema: AnySchema, _meta?: boolean): AnyValidateFunction; + compileAsync(schema: SchemaObject | JSONSchemaType, _meta?: boolean): Promise>; + compileAsync(schema: JTDSchemaType, _meta?: boolean): Promise>; + compileAsync(schema: AsyncSchema, meta?: boolean): Promise>; + compileAsync(schema: AnySchemaObject, meta?: boolean): Promise>; + addSchema(schema: AnySchema | AnySchema[], // If array is passed, `key` will be ignored + key?: string, // Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. + _meta?: boolean, // true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. + _validateSchema?: boolean | "log"): Ajv; + addMetaSchema(schema: AnySchemaObject, key?: string, // schema key + _validateSchema?: boolean | "log"): Ajv; + validateSchema(schema: AnySchema, throwOrLogError?: boolean): boolean | Promise; + getSchema(keyRef: string): AnyValidateFunction | undefined; + removeSchema(schemaKeyRef?: AnySchema | string | RegExp): Ajv; + addVocabulary(definitions: Vocabulary): Ajv; + addKeyword(kwdOrDef: string | KeywordDefinition, def?: KeywordDefinition): Ajv; + getKeyword(keyword: string): AddedKeywordDefinition | boolean; + removeKeyword(keyword: string): Ajv; + addFormat(name: string, format: Format): Ajv; + errorsText(errors?: ErrorObject[] | null | undefined, // optional array of validation errors + { separator, dataVar }?: ErrorsTextOptions): string; + $dataMetaSchema(metaSchema: AnySchemaObject, keywordsJsonPointers: string[]): AnySchemaObject; + private _removeAllSchemas; + _addSchema(schema: AnySchema, meta?: boolean, baseId?: string, validateSchema?: boolean | "log", addSchema?: boolean): SchemaEnv; + private _checkUnique; + private _compileSchemaEnv; + private _compileMetaSchema; +} +export interface ErrorsTextOptions { + separator?: string; + dataVar?: string; +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/core.js b/node_modules/ajv-formats/node_modules/ajv/dist/core.js new file mode 100644 index 000000000..84911161f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/core.js @@ -0,0 +1,617 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0; +var validate_1 = require("./compile/validate"); +Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +const validation_error_1 = require("./runtime/validation_error"); +const ref_error_1 = require("./compile/ref_error"); +const rules_1 = require("./compile/rules"); +const compile_1 = require("./compile"); +const codegen_2 = require("./compile/codegen"); +const resolve_1 = require("./compile/resolve"); +const dataType_1 = require("./compile/validate/dataType"); +const util_1 = require("./compile/util"); +const $dataRefSchema = require("./refs/data.json"); +const uri_1 = require("./runtime/uri"); +const defaultRegExp = (str, flags) => new RegExp(str, flags); +defaultRegExp.code = "new RegExp"; +const META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"]; +const EXT_SCOPE_NAMES = new Set([ + "validate", + "serialize", + "parse", + "wrapper", + "root", + "schema", + "keyword", + "pattern", + "formats", + "validate$data", + "func", + "obj", + "Error", +]); +const removedOptions = { + errorDataPath: "", + format: "`validateFormats: false` can be used instead.", + nullable: '"nullable" keyword is supported by default.', + jsonPointers: "Deprecated jsPropertySyntax can be used instead.", + extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.", + missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.", + processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`", + sourceCode: "Use option `code: {source: true}`", + strictDefaults: "It is default now, see option `strict`.", + strictKeywords: "It is default now, see option `strict`.", + uniqueItems: '"uniqueItems" keyword is always validated.', + unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).", + cache: "Map is used as cache, schema object as key.", + serialize: "Map is used as cache, schema object as key.", + ajvErrors: "It is default now.", +}; +const deprecatedOptions = { + ignoreKeywordsWithRef: "", + jsPropertySyntax: "", + unicode: '"minLength"/"maxLength" account for unicode characters by default.', +}; +const MAX_EXPRESSION = 200; +// eslint-disable-next-line complexity +function requiredOptions(o) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0; + const s = o.strict; + const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize; + const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0; + const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp; + const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default; + return { + strictSchema: (_f = (_e = o.strictSchema) !== null && _e !== void 0 ? _e : s) !== null && _f !== void 0 ? _f : true, + strictNumbers: (_h = (_g = o.strictNumbers) !== null && _g !== void 0 ? _g : s) !== null && _h !== void 0 ? _h : true, + strictTypes: (_k = (_j = o.strictTypes) !== null && _j !== void 0 ? _j : s) !== null && _k !== void 0 ? _k : "log", + strictTuples: (_m = (_l = o.strictTuples) !== null && _l !== void 0 ? _l : s) !== null && _m !== void 0 ? _m : "log", + strictRequired: (_p = (_o = o.strictRequired) !== null && _o !== void 0 ? _o : s) !== null && _p !== void 0 ? _p : false, + code: o.code ? { ...o.code, optimize, regExp } : { optimize, regExp }, + loopRequired: (_q = o.loopRequired) !== null && _q !== void 0 ? _q : MAX_EXPRESSION, + loopEnum: (_r = o.loopEnum) !== null && _r !== void 0 ? _r : MAX_EXPRESSION, + meta: (_s = o.meta) !== null && _s !== void 0 ? _s : true, + messages: (_t = o.messages) !== null && _t !== void 0 ? _t : true, + inlineRefs: (_u = o.inlineRefs) !== null && _u !== void 0 ? _u : true, + schemaId: (_v = o.schemaId) !== null && _v !== void 0 ? _v : "$id", + addUsedSchema: (_w = o.addUsedSchema) !== null && _w !== void 0 ? _w : true, + validateSchema: (_x = o.validateSchema) !== null && _x !== void 0 ? _x : true, + validateFormats: (_y = o.validateFormats) !== null && _y !== void 0 ? _y : true, + unicodeRegExp: (_z = o.unicodeRegExp) !== null && _z !== void 0 ? _z : true, + int32range: (_0 = o.int32range) !== null && _0 !== void 0 ? _0 : true, + uriResolver: uriResolver, + }; +} +class Ajv { + constructor(opts = {}) { + this.schemas = {}; + this.refs = {}; + this.formats = {}; + this._compilations = new Set(); + this._loading = {}; + this._cache = new Map(); + opts = this.opts = { ...opts, ...requiredOptions(opts) }; + const { es5, lines } = this.opts.code; + this.scope = new codegen_2.ValueScope({ scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines }); + this.logger = getLogger(opts.logger); + const formatOpt = opts.validateFormats; + opts.validateFormats = false; + this.RULES = (0, rules_1.getRules)(); + checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED"); + checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn"); + this._metaOpts = getMetaSchemaOptions.call(this); + if (opts.formats) + addInitialFormats.call(this); + this._addVocabularies(); + this._addDefaultMetaSchema(); + if (opts.keywords) + addInitialKeywords.call(this, opts.keywords); + if (typeof opts.meta == "object") + this.addMetaSchema(opts.meta); + addInitialSchemas.call(this); + opts.validateFormats = formatOpt; + } + _addVocabularies() { + this.addKeyword("$async"); + } + _addDefaultMetaSchema() { + const { $data, meta, schemaId } = this.opts; + let _dataRefSchema = $dataRefSchema; + if (schemaId === "id") { + _dataRefSchema = { ...$dataRefSchema }; + _dataRefSchema.id = _dataRefSchema.$id; + delete _dataRefSchema.$id; + } + if (meta && $data) + this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false); + } + defaultMeta() { + const { meta, schemaId } = this.opts; + return (this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : undefined); + } + validate(schemaKeyRef, // key, ref or schema object + data // to be validated + ) { + let v; + if (typeof schemaKeyRef == "string") { + v = this.getSchema(schemaKeyRef); + if (!v) + throw new Error(`no schema with key or ref "${schemaKeyRef}"`); + } + else { + v = this.compile(schemaKeyRef); + } + const valid = v(data); + if (!("$async" in v)) + this.errors = v.errors; + return valid; + } + compile(schema, _meta) { + const sch = this._addSchema(schema, _meta); + return (sch.validate || this._compileSchemaEnv(sch)); + } + compileAsync(schema, meta) { + if (typeof this.opts.loadSchema != "function") { + throw new Error("options.loadSchema should be a function"); + } + const { loadSchema } = this.opts; + return runCompileAsync.call(this, schema, meta); + async function runCompileAsync(_schema, _meta) { + await loadMetaSchema.call(this, _schema.$schema); + const sch = this._addSchema(_schema, _meta); + return sch.validate || _compileAsync.call(this, sch); + } + async function loadMetaSchema($ref) { + if ($ref && !this.getSchema($ref)) { + await runCompileAsync.call(this, { $ref }, true); + } + } + async function _compileAsync(sch) { + try { + return this._compileSchemaEnv(sch); + } + catch (e) { + if (!(e instanceof ref_error_1.default)) + throw e; + checkLoaded.call(this, e); + await loadMissingSchema.call(this, e.missingSchema); + return _compileAsync.call(this, sch); + } + } + function checkLoaded({ missingSchema: ref, missingRef }) { + if (this.refs[ref]) { + throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`); + } + } + async function loadMissingSchema(ref) { + const _schema = await _loadSchema.call(this, ref); + if (!this.refs[ref]) + await loadMetaSchema.call(this, _schema.$schema); + if (!this.refs[ref]) + this.addSchema(_schema, ref, meta); + } + async function _loadSchema(ref) { + const p = this._loading[ref]; + if (p) + return p; + try { + return await (this._loading[ref] = loadSchema(ref)); + } + finally { + delete this._loading[ref]; + } + } + } + // Adds schema to the instance + addSchema(schema, // If array is passed, `key` will be ignored + key, // Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. + _meta, // true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. + _validateSchema = this.opts.validateSchema // false to skip schema validation. Used internally, option validateSchema should be used instead. + ) { + if (Array.isArray(schema)) { + for (const sch of schema) + this.addSchema(sch, undefined, _meta, _validateSchema); + return this; + } + let id; + if (typeof schema === "object") { + const { schemaId } = this.opts; + id = schema[schemaId]; + if (id !== undefined && typeof id != "string") { + throw new Error(`schema ${schemaId} must be string`); + } + } + key = (0, resolve_1.normalizeId)(key || id); + this._checkUnique(key); + this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true); + return this; + } + // Add schema that will be used to validate other schemas + // options in META_IGNORE_OPTIONS are alway set to false + addMetaSchema(schema, key, // schema key + _validateSchema = this.opts.validateSchema // false to skip schema validation, can be used to override validateSchema option for meta-schema + ) { + this.addSchema(schema, key, true, _validateSchema); + return this; + } + // Validate schema against its meta-schema + validateSchema(schema, throwOrLogError) { + if (typeof schema == "boolean") + return true; + let $schema; + $schema = schema.$schema; + if ($schema !== undefined && typeof $schema != "string") { + throw new Error("$schema must be a string"); + } + $schema = $schema || this.opts.defaultMeta || this.defaultMeta(); + if (!$schema) { + this.logger.warn("meta-schema not available"); + this.errors = null; + return true; + } + const valid = this.validate($schema, schema); + if (!valid && throwOrLogError) { + const message = "schema is invalid: " + this.errorsText(); + if (this.opts.validateSchema === "log") + this.logger.error(message); + else + throw new Error(message); + } + return valid; + } + // Get compiled schema by `key` or `ref`. + // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id) + getSchema(keyRef) { + let sch; + while (typeof (sch = getSchEnv.call(this, keyRef)) == "string") + keyRef = sch; + if (sch === undefined) { + const { schemaId } = this.opts; + const root = new compile_1.SchemaEnv({ schema: {}, schemaId }); + sch = compile_1.resolveSchema.call(this, root, keyRef); + if (!sch) + return; + this.refs[keyRef] = sch; + } + return (sch.validate || this._compileSchemaEnv(sch)); + } + // Remove cached schema(s). + // If no parameter is passed all schemas but meta-schemas are removed. + // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. + // Even if schema is referenced by other schemas it still can be removed as other schemas have local references. + removeSchema(schemaKeyRef) { + if (schemaKeyRef instanceof RegExp) { + this._removeAllSchemas(this.schemas, schemaKeyRef); + this._removeAllSchemas(this.refs, schemaKeyRef); + return this; + } + switch (typeof schemaKeyRef) { + case "undefined": + this._removeAllSchemas(this.schemas); + this._removeAllSchemas(this.refs); + this._cache.clear(); + return this; + case "string": { + const sch = getSchEnv.call(this, schemaKeyRef); + if (typeof sch == "object") + this._cache.delete(sch.schema); + delete this.schemas[schemaKeyRef]; + delete this.refs[schemaKeyRef]; + return this; + } + case "object": { + const cacheKey = schemaKeyRef; + this._cache.delete(cacheKey); + let id = schemaKeyRef[this.opts.schemaId]; + if (id) { + id = (0, resolve_1.normalizeId)(id); + delete this.schemas[id]; + delete this.refs[id]; + } + return this; + } + default: + throw new Error("ajv.removeSchema: invalid parameter"); + } + } + // add "vocabulary" - a collection of keywords + addVocabulary(definitions) { + for (const def of definitions) + this.addKeyword(def); + return this; + } + addKeyword(kwdOrDef, def // deprecated + ) { + let keyword; + if (typeof kwdOrDef == "string") { + keyword = kwdOrDef; + if (typeof def == "object") { + this.logger.warn("these parameters are deprecated, see docs for addKeyword"); + def.keyword = keyword; + } + } + else if (typeof kwdOrDef == "object" && def === undefined) { + def = kwdOrDef; + keyword = def.keyword; + if (Array.isArray(keyword) && !keyword.length) { + throw new Error("addKeywords: keyword must be string or non-empty array"); + } + } + else { + throw new Error("invalid addKeywords parameters"); + } + checkKeyword.call(this, keyword, def); + if (!def) { + (0, util_1.eachItem)(keyword, (kwd) => addRule.call(this, kwd)); + return this; + } + keywordMetaschema.call(this, def); + const definition = { + ...def, + type: (0, dataType_1.getJSONTypes)(def.type), + schemaType: (0, dataType_1.getJSONTypes)(def.schemaType), + }; + (0, util_1.eachItem)(keyword, definition.type.length === 0 + ? (k) => addRule.call(this, k, definition) + : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t))); + return this; + } + getKeyword(keyword) { + const rule = this.RULES.all[keyword]; + return typeof rule == "object" ? rule.definition : !!rule; + } + // Remove keyword + removeKeyword(keyword) { + // TODO return type should be Ajv + const { RULES } = this; + delete RULES.keywords[keyword]; + delete RULES.all[keyword]; + for (const group of RULES.rules) { + const i = group.rules.findIndex((rule) => rule.keyword === keyword); + if (i >= 0) + group.rules.splice(i, 1); + } + return this; + } + // Add format + addFormat(name, format) { + if (typeof format == "string") + format = new RegExp(format); + this.formats[name] = format; + return this; + } + errorsText(errors = this.errors, // optional array of validation errors + { separator = ", ", dataVar = "data" } = {} // optional options with properties `separator` and `dataVar` + ) { + if (!errors || errors.length === 0) + return "No errors"; + return errors + .map((e) => `${dataVar}${e.instancePath} ${e.message}`) + .reduce((text, msg) => text + separator + msg); + } + $dataMetaSchema(metaSchema, keywordsJsonPointers) { + const rules = this.RULES.all; + metaSchema = JSON.parse(JSON.stringify(metaSchema)); + for (const jsonPointer of keywordsJsonPointers) { + const segments = jsonPointer.split("/").slice(1); // first segment is an empty string + let keywords = metaSchema; + for (const seg of segments) + keywords = keywords[seg]; + for (const key in rules) { + const rule = rules[key]; + if (typeof rule != "object") + continue; + const { $data } = rule.definition; + const schema = keywords[key]; + if ($data && schema) + keywords[key] = schemaOrData(schema); + } + } + return metaSchema; + } + _removeAllSchemas(schemas, regex) { + for (const keyRef in schemas) { + const sch = schemas[keyRef]; + if (!regex || regex.test(keyRef)) { + if (typeof sch == "string") { + delete schemas[keyRef]; + } + else if (sch && !sch.meta) { + this._cache.delete(sch.schema); + delete schemas[keyRef]; + } + } + } + } + _addSchema(schema, meta, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) { + let id; + const { schemaId } = this.opts; + if (typeof schema == "object") { + id = schema[schemaId]; + } + else { + if (this.opts.jtd) + throw new Error("schema must be object"); + else if (typeof schema != "boolean") + throw new Error("schema must be object or boolean"); + } + let sch = this._cache.get(schema); + if (sch !== undefined) + return sch; + baseId = (0, resolve_1.normalizeId)(id || baseId); + const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId); + sch = new compile_1.SchemaEnv({ schema, schemaId, meta, baseId, localRefs }); + this._cache.set(sch.schema, sch); + if (addSchema && !baseId.startsWith("#")) { + // TODO atm it is allowed to overwrite schemas without id (instead of not adding them) + if (baseId) + this._checkUnique(baseId); + this.refs[baseId] = sch; + } + if (validateSchema) + this.validateSchema(schema, true); + return sch; + } + _checkUnique(id) { + if (this.schemas[id] || this.refs[id]) { + throw new Error(`schema with key or id "${id}" already exists`); + } + } + _compileSchemaEnv(sch) { + if (sch.meta) + this._compileMetaSchema(sch); + else + compile_1.compileSchema.call(this, sch); + /* istanbul ignore if */ + if (!sch.validate) + throw new Error("ajv implementation error"); + return sch.validate; + } + _compileMetaSchema(sch) { + const currentOpts = this.opts; + this.opts = this._metaOpts; + try { + compile_1.compileSchema.call(this, sch); + } + finally { + this.opts = currentOpts; + } + } +} +exports.default = Ajv; +Ajv.ValidationError = validation_error_1.default; +Ajv.MissingRefError = ref_error_1.default; +function checkOptions(checkOpts, options, msg, log = "error") { + for (const key in checkOpts) { + const opt = key; + if (opt in options) + this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`); + } +} +function getSchEnv(keyRef) { + keyRef = (0, resolve_1.normalizeId)(keyRef); // TODO tests fail without this line + return this.schemas[keyRef] || this.refs[keyRef]; +} +function addInitialSchemas() { + const optsSchemas = this.opts.schemas; + if (!optsSchemas) + return; + if (Array.isArray(optsSchemas)) + this.addSchema(optsSchemas); + else + for (const key in optsSchemas) + this.addSchema(optsSchemas[key], key); +} +function addInitialFormats() { + for (const name in this.opts.formats) { + const format = this.opts.formats[name]; + if (format) + this.addFormat(name, format); + } +} +function addInitialKeywords(defs) { + if (Array.isArray(defs)) { + this.addVocabulary(defs); + return; + } + this.logger.warn("keywords option as map is deprecated, pass array"); + for (const keyword in defs) { + const def = defs[keyword]; + if (!def.keyword) + def.keyword = keyword; + this.addKeyword(def); + } +} +function getMetaSchemaOptions() { + const metaOpts = { ...this.opts }; + for (const opt of META_IGNORE_OPTIONS) + delete metaOpts[opt]; + return metaOpts; +} +const noLogs = { log() { }, warn() { }, error() { } }; +function getLogger(logger) { + if (logger === false) + return noLogs; + if (logger === undefined) + return console; + if (logger.log && logger.warn && logger.error) + return logger; + throw new Error("logger must implement log, warn and error methods"); +} +const KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i; +function checkKeyword(keyword, def) { + const { RULES } = this; + (0, util_1.eachItem)(keyword, (kwd) => { + if (RULES.keywords[kwd]) + throw new Error(`Keyword ${kwd} is already defined`); + if (!KEYWORD_NAME.test(kwd)) + throw new Error(`Keyword ${kwd} has invalid name`); + }); + if (!def) + return; + if (def.$data && !("code" in def || "validate" in def)) { + throw new Error('$data keyword must have "code" or "validate" function'); + } +} +function addRule(keyword, definition, dataType) { + var _a; + const post = definition === null || definition === void 0 ? void 0 : definition.post; + if (dataType && post) + throw new Error('keyword with "post" flag cannot have "type"'); + const { RULES } = this; + let ruleGroup = post ? RULES.post : RULES.rules.find(({ type: t }) => t === dataType); + if (!ruleGroup) { + ruleGroup = { type: dataType, rules: [] }; + RULES.rules.push(ruleGroup); + } + RULES.keywords[keyword] = true; + if (!definition) + return; + const rule = { + keyword, + definition: { + ...definition, + type: (0, dataType_1.getJSONTypes)(definition.type), + schemaType: (0, dataType_1.getJSONTypes)(definition.schemaType), + }, + }; + if (definition.before) + addBeforeRule.call(this, ruleGroup, rule, definition.before); + else + ruleGroup.rules.push(rule); + RULES.all[keyword] = rule; + (_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd)); +} +function addBeforeRule(ruleGroup, rule, before) { + const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before); + if (i >= 0) { + ruleGroup.rules.splice(i, 0, rule); + } + else { + ruleGroup.rules.push(rule); + this.logger.warn(`rule ${before} is not defined`); + } +} +function keywordMetaschema(def) { + let { metaSchema } = def; + if (metaSchema === undefined) + return; + if (def.$data && this.opts.$data) + metaSchema = schemaOrData(metaSchema); + def.validateSchema = this.compile(metaSchema, true); +} +const $dataRef = { + $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", +}; +function schemaOrData(schema) { + return { anyOf: [schema, $dataRef] }; +} +//# sourceMappingURL=core.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/core.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/core.js.map new file mode 100644 index 000000000..c39cd6b53 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/core.js.map @@ -0,0 +1 @@ +{"version":3,"file":"core.js","sourceRoot":"","sources":["../lib/core.ts"],"names":[],"mappings":";;;AA4BA,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAKlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA;AAsBnD,iEAAwD;AACxD,mDAAiD;AACjD,2CAAoF;AACpF,uCAAiE;AACjE,+CAAkD;AAClD,+CAA4D;AAC5D,0DAAwD;AACxD,yCAAuC;AACvC,mDAAkD;AAElD,uCAA8C;AAE9C,MAAM,aAAa,GAAiB,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;AAC1E,aAAa,CAAC,IAAI,GAAG,YAAY,CAAA;AAEjC,MAAM,mBAAmB,GAAsB,CAAC,kBAAkB,EAAE,aAAa,EAAE,aAAa,CAAC,CAAA;AACjG,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,UAAU;IACV,WAAW;IACX,OAAO;IACP,SAAS;IACT,MAAM;IACN,QAAQ;IACR,SAAS;IACT,SAAS;IACT,SAAS;IACT,eAAe;IACf,MAAM;IACN,KAAK;IACL,OAAO;CACR,CAAC,CAAA;AAyGF,MAAM,cAAc,GAAgC;IAClD,aAAa,EAAE,EAAE;IACjB,MAAM,EAAE,+CAA+C;IACvD,QAAQ,EAAE,6CAA6C;IACvD,YAAY,EAAE,kDAAkD;IAChE,UAAU,EAAE,uDAAuD;IACnE,WAAW,EAAE,qEAAqE;IAClF,WAAW,EAAE,mEAAmE;IAChF,UAAU,EAAE,mCAAmC;IAC/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,UAAU,KAAK,SAAS;QAAE,OAAM;IACpC,IAAI,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK;QAAE,UAAU,GAAG,YAAY,CAAC,UAAU,CAAC,CAAA;IACvE,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,IAAI,CAAC,CAAA;AACrD,CAAC;AAED,MAAM,QAAQ,GAAG;IACf,IAAI,EAAE,gFAAgF;CACvF,CAAA;AAED,SAAS,YAAY,CAAC,MAAiB;IACrC,OAAO,EAAC,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAC,CAAA;AACpC,CAAC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/jtd.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/jtd.d.ts new file mode 100644 index 000000000..0caf84b60 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/jtd.d.ts @@ -0,0 +1,45 @@ +import type { AnySchemaObject, SchemaObject, JTDParser } from "./types"; +import type { JTDSchemaType, SomeJTDSchemaType, JTDDataType } from "./types/jtd-schema"; +import AjvCore, { CurrentOptions } from "./core"; +declare type JTDOptions = CurrentOptions & { + strict?: never; + allowMatchingProperties?: never; + allowUnionTypes?: never; + validateFormats?: never; + $data?: never; + verbose?: boolean; + $comment?: never; + formats?: never; + loadSchema?: never; + useDefaults?: never; + coerceTypes?: never; + next?: never; + unevaluated?: never; + dynamicRef?: never; + meta?: boolean; + defaultMeta?: never; + inlineRefs?: boolean; + loopRequired?: never; + multipleOfPrecision?: never; +}; +declare class Ajv extends AjvCore { + constructor(opts?: JTDOptions); + _addVocabularies(): void; + _addDefaultMetaSchema(): void; + defaultMeta(): string | AnySchemaObject | undefined; + compileSerializer(schema: SchemaObject): (data: T) => string; + compileSerializer(schema: JTDSchemaType): (data: T) => string; + compileParser(schema: SchemaObject): JTDParser; + compileParser(schema: JTDSchemaType): JTDParser; + private _compileSerializer; + private _compileParser; +} +export default Ajv; +export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, ErrorNoParams, JTDParser, } from "./types"; +export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core"; +export { SchemaCxt, SchemaObjCxt } from "./compile"; +export { KeywordCxt } from "./compile/validate"; +export { JTDErrorObject } from "./vocabularies/jtd"; +export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; +export { JTDSchemaType, SomeJTDSchemaType, JTDDataType }; +export { JTDOptions }; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/jtd.js b/node_modules/ajv-formats/node_modules/ajv/dist/jtd.js new file mode 100644 index 000000000..dfb34ddd5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/jtd.js @@ -0,0 +1,66 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0; +const core_1 = require("./core"); +const jtd_1 = require("./vocabularies/jtd"); +const jtd_schema_1 = require("./refs/jtd-schema"); +const serialize_1 = require("./compile/jtd/serialize"); +const parse_1 = require("./compile/jtd/parse"); +const META_SCHEMA_ID = "JTD-meta-schema"; +class Ajv extends core_1.default { + constructor(opts = {}) { + super({ + ...opts, + jtd: true, + }); + } + _addVocabularies() { + super._addVocabularies(); + this.addVocabulary(jtd_1.default); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + if (!this.opts.meta) + return; + this.addMetaSchema(jtd_schema_1.default, META_SCHEMA_ID, false); + } + defaultMeta() { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); + } + compileSerializer(schema) { + const sch = this._addSchema(schema); + return sch.serialize || this._compileSerializer(sch); + } + compileParser(schema) { + const sch = this._addSchema(schema); + return (sch.parse || this._compileParser(sch)); + } + _compileSerializer(sch) { + serialize_1.default.call(this, sch, sch.schema.definitions || {}); + /* istanbul ignore if */ + if (!sch.serialize) + throw new Error("ajv implementation error"); + return sch.serialize; + } + _compileParser(sch) { + parse_1.default.call(this, sch, sch.schema.definitions || {}); + /* istanbul ignore if */ + if (!sch.parse) + throw new Error("ajv implementation error"); + return sch.parse; + } +} +module.exports = exports = Ajv; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = Ajv; +var validate_1 = require("./compile/validate"); +Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +//# sourceMappingURL=jtd.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/jtd.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/jtd.js.map new file mode 100644 index 000000000..6f253789f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/jtd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jtd.js","sourceRoot":"","sources":["../lib/jtd.ts"],"names":[],"mappings":";;;AAEA,iCAA8C;AAC9C,4CAA8C;AAC9C,kDAA6C;AAC7C,uDAAuD;AACvD,+CAA+C;AAG/C,MAAM,cAAc,GAAG,iBAAiB,CAAA;AA4BxC,MAAM,GAAI,SAAQ,cAAO;IAC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AK,CAAC,0BAA0B,CAAC,CAAA;QAC/D,OAAO,GAAG,CAAC,SAAS,CAAA;IACtB,CAAC;IAEO,cAAc,CAAC,GAAc;QACnC,eAAa,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,EAAG,GAAG,CAAC,MAA0B,CAAC,WAAW,IAAI,EAAE,CAAC,CAAA;QAChF,wBAAwB;QACxB,IAAI,CAAC,GAAG,CAAC,KAAK;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC3D,OAAO,GAAG,CAAC,KAAK,CAAA;IAClB,CAAC;CACF;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,GAAG,CAAA;AAC9B,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,GAAG,CAAA;AA0BlB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAElB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/data.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/data.json new file mode 100644 index 000000000..9ffc9f5ce --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/data.json @@ -0,0 +1,13 @@ +{ + "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", + "description": "Meta-schema for $data reference (JSON AnySchema extension proposal)", + "type": "object", + "required": ["$data"], + "properties": { + "$data": { + "type": "string", + "anyOf": [{"format": "relative-json-pointer"}, {"format": "json-pointer"}] + } + }, + "additionalProperties": false +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts new file mode 100644 index 000000000..cf008331f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts @@ -0,0 +1,2 @@ +import type Ajv from "../../core"; +export default function addMetaSchema2019(this: Ajv, $data?: boolean): Ajv; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/index.js b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/index.js new file mode 100644 index 000000000..e86496282 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/index.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const metaSchema = require("./schema.json"); +const applicator = require("./meta/applicator.json"); +const content = require("./meta/content.json"); +const core = require("./meta/core.json"); +const format = require("./meta/format.json"); +const metadata = require("./meta/meta-data.json"); +const validation = require("./meta/validation.json"); +const META_SUPPORT_DATA = ["/properties"]; +function addMetaSchema2019($data) { + ; + [ + metaSchema, + applicator, + content, + core, + with$data(this, format), + metadata, + with$data(this, validation), + ].forEach((sch) => this.addMetaSchema(sch, undefined, false)); + return this; + function with$data(ajv, sch) { + return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch; + } +} +exports.default = addMetaSchema2019; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map new file mode 100644 index 000000000..9b8a36d61 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/refs/json-schema-2019-09/index.ts"],"names":[],"mappings":";;AAEA,4CAA2C;AAC3C,qDAAoD;AACpD,+CAA8C;AAC9C,yCAAwC;AACxC,6CAA4C;AAC5C,kDAAiD;AACjD,qDAAoD;AAEpD,MAAM,iBAAiB,GAAG,CAAC,aAAa,CAAC,CAAA;AAEzC,SAAwB,iBAAiB,CAAY,KAAe;IAClE,CAAC;IAAA;QACC,UAAU;QACV,UAAU;QACV,OAAO;QACP,IAAI;QACJ,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;QACvB,QAAQ;QACR,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC;KAC5B,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAA;IAC7D,OAAO,IAAI,CAAA;IAEX,SAAS,SAAS,CAAC,GAAQ,EAAE,GAAoB;QAC/C,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IAClE,CAAC;AACH,CAAC;AAfD,oCAeC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json new file mode 100644 index 000000000..c5e91cf2a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json @@ -0,0 +1,53 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/applicator", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/applicator": true + }, + "$recursiveAnchor": true, + + "title": "Applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "additionalItems": {"$recursiveRef": "#"}, + "unevaluatedItems": {"$recursiveRef": "#"}, + "items": { + "anyOf": [{"$recursiveRef": "#"}, {"$ref": "#/$defs/schemaArray"}] + }, + "contains": {"$recursiveRef": "#"}, + "additionalProperties": {"$recursiveRef": "#"}, + "unevaluatedProperties": {"$recursiveRef": "#"}, + "properties": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependentSchemas": { + "type": "object", + "additionalProperties": { + "$recursiveRef": "#" + } + }, + "propertyNames": {"$recursiveRef": "#"}, + "if": {"$recursiveRef": "#"}, + "then": {"$recursiveRef": "#"}, + "else": {"$recursiveRef": "#"}, + "allOf": {"$ref": "#/$defs/schemaArray"}, + "anyOf": {"$ref": "#/$defs/schemaArray"}, + "oneOf": {"$ref": "#/$defs/schemaArray"}, + "not": {"$recursiveRef": "#"} + }, + "$defs": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$recursiveRef": "#"} + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json new file mode 100644 index 000000000..b8f637343 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/content", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + "$recursiveAnchor": true, + + "title": "Content vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "contentMediaType": {"type": "string"}, + "contentEncoding": {"type": "string"}, + "contentSchema": {"$recursiveRef": "#"} + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json new file mode 100644 index 000000000..f71adbff0 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/core", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true + }, + "$recursiveAnchor": true, + + "title": "Core vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference", + "$comment": "Non-empty fragments not allowed.", + "pattern": "^[^#]*#?$" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$anchor": { + "type": "string", + "pattern": "^[A-Za-z][-A-Za-z0-9.:_]*$" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$recursiveRef": { + "type": "string", + "format": "uri-reference" + }, + "$recursiveAnchor": { + "type": "boolean", + "default": false + }, + "$vocabulary": { + "type": "object", + "propertyNames": { + "type": "string", + "format": "uri" + }, + "additionalProperties": { + "type": "boolean" + } + }, + "$comment": { + "type": "string" + }, + "$defs": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json new file mode 100644 index 000000000..03ccfce26 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/format", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/format": true + }, + "$recursiveAnchor": true, + + "title": "Format vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "format": {"type": "string"} + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json new file mode 100644 index 000000000..0e194326f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/meta-data", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/meta-data": true + }, + "$recursiveAnchor": true, + + "title": "Meta-data vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "deprecated": { + "type": "boolean", + "default": false + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json new file mode 100644 index 000000000..7027a1279 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/validation", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/validation": true + }, + "$recursiveAnchor": true, + + "title": "Validation vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, + "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, + "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, + "minContains": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 1 + }, + "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, + "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/$defs/stringArray"}, + "dependentRequired": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + }, + "const": true, + "enum": { + "type": "array", + "items": true + }, + "type": { + "anyOf": [ + {"$ref": "#/$defs/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/$defs/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + } + }, + "$defs": { + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 0 + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json new file mode 100644 index 000000000..54eb7157a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/schema", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true, + "https://json-schema.org/draft/2019-09/vocab/applicator": true, + "https://json-schema.org/draft/2019-09/vocab/validation": true, + "https://json-schema.org/draft/2019-09/vocab/meta-data": true, + "https://json-schema.org/draft/2019-09/vocab/format": false, + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + "$recursiveAnchor": true, + + "title": "Core and Validation specifications meta-schema", + "allOf": [ + {"$ref": "meta/core"}, + {"$ref": "meta/applicator"}, + {"$ref": "meta/validation"}, + {"$ref": "meta/meta-data"}, + {"$ref": "meta/format"}, + {"$ref": "meta/content"} + ], + "type": ["object", "boolean"], + "properties": { + "definitions": { + "$comment": "While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.", + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + }, + "dependencies": { + "$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"dependentSchemas\" and \"dependentRequired\"", + "type": "object", + "additionalProperties": { + "anyOf": [{"$recursiveRef": "#"}, {"$ref": "meta/validation#/$defs/stringArray"}] + } + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts new file mode 100644 index 000000000..c232ab05c --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts @@ -0,0 +1,2 @@ +import type Ajv from "../../core"; +export default function addMetaSchema2020(this: Ajv, $data?: boolean): Ajv; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/index.js b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/index.js new file mode 100644 index 000000000..d92567564 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/index.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const metaSchema = require("./schema.json"); +const applicator = require("./meta/applicator.json"); +const unevaluated = require("./meta/unevaluated.json"); +const content = require("./meta/content.json"); +const core = require("./meta/core.json"); +const format = require("./meta/format-annotation.json"); +const metadata = require("./meta/meta-data.json"); +const validation = require("./meta/validation.json"); +const META_SUPPORT_DATA = ["/properties"]; +function addMetaSchema2020($data) { + ; + [ + metaSchema, + applicator, + unevaluated, + content, + core, + with$data(this, format), + metadata, + with$data(this, validation), + ].forEach((sch) => this.addMetaSchema(sch, undefined, false)); + return this; + function with$data(ajv, sch) { + return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch; + } +} +exports.default = addMetaSchema2020; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map new file mode 100644 index 000000000..eb90027dd --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/refs/json-schema-2020-12/index.ts"],"names":[],"mappings":";;AAEA,4CAA2C;AAC3C,qDAAoD;AACpD,uDAAsD;AACtD,+CAA8C;AAC9C,yCAAwC;AACxC,wDAAuD;AACvD,kDAAiD;AACjD,qDAAoD;AAEpD,MAAM,iBAAiB,GAAG,CAAC,aAAa,CAAC,CAAA;AAEzC,SAAwB,iBAAiB,CAAY,KAAe;IAClE,CAAC;IAAA;QACC,UAAU;QACV,UAAU;QACV,WAAW;QACX,OAAO;QACP,IAAI;QACJ,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;QACvB,QAAQ;QACR,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC;KAC5B,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAA;IAC7D,OAAO,IAAI,CAAA;IAEX,SAAS,SAAS,CAAC,GAAQ,EAAE,GAAoB;QAC/C,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IAClE,CAAC;AACH,CAAC;AAhBD,oCAgBC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json new file mode 100644 index 000000000..674c913da --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json @@ -0,0 +1,48 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/applicator", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/applicator": true + }, + "$dynamicAnchor": "meta", + + "title": "Applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "prefixItems": {"$ref": "#/$defs/schemaArray"}, + "items": {"$dynamicRef": "#meta"}, + "contains": {"$dynamicRef": "#meta"}, + "additionalProperties": {"$dynamicRef": "#meta"}, + "properties": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependentSchemas": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "default": {} + }, + "propertyNames": {"$dynamicRef": "#meta"}, + "if": {"$dynamicRef": "#meta"}, + "then": {"$dynamicRef": "#meta"}, + "else": {"$dynamicRef": "#meta"}, + "allOf": {"$ref": "#/$defs/schemaArray"}, + "anyOf": {"$ref": "#/$defs/schemaArray"}, + "oneOf": {"$ref": "#/$defs/schemaArray"}, + "not": {"$dynamicRef": "#meta"} + }, + "$defs": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$dynamicRef": "#meta"} + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json new file mode 100644 index 000000000..2ae23ddb5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/content", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/content": true + }, + "$dynamicAnchor": "meta", + + "title": "Content vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "contentEncoding": {"type": "string"}, + "contentMediaType": {"type": "string"}, + "contentSchema": {"$dynamicRef": "#meta"} + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json new file mode 100644 index 000000000..4c8e5cb61 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json @@ -0,0 +1,51 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/core", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/core": true + }, + "$dynamicAnchor": "meta", + + "title": "Core vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "$id": { + "$ref": "#/$defs/uriReferenceString", + "$comment": "Non-empty fragments not allowed.", + "pattern": "^[^#]*#?$" + }, + "$schema": {"$ref": "#/$defs/uriString"}, + "$ref": {"$ref": "#/$defs/uriReferenceString"}, + "$anchor": {"$ref": "#/$defs/anchorString"}, + "$dynamicRef": {"$ref": "#/$defs/uriReferenceString"}, + "$dynamicAnchor": {"$ref": "#/$defs/anchorString"}, + "$vocabulary": { + "type": "object", + "propertyNames": {"$ref": "#/$defs/uriString"}, + "additionalProperties": { + "type": "boolean" + } + }, + "$comment": { + "type": "string" + }, + "$defs": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"} + } + }, + "$defs": { + "anchorString": { + "type": "string", + "pattern": "^[A-Za-z_][-A-Za-z0-9._]*$" + }, + "uriString": { + "type": "string", + "format": "uri" + }, + "uriReferenceString": { + "type": "string", + "format": "uri-reference" + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json new file mode 100644 index 000000000..83c26e35f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/format-annotation", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/format-annotation": true + }, + "$dynamicAnchor": "meta", + + "title": "Format vocabulary meta-schema for annotation results", + "type": ["object", "boolean"], + "properties": { + "format": {"type": "string"} + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json new file mode 100644 index 000000000..11946fb50 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/meta-data", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/meta-data": true + }, + "$dynamicAnchor": "meta", + + "title": "Meta-data vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "deprecated": { + "type": "boolean", + "default": false + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json new file mode 100644 index 000000000..5e4b203b2 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/unevaluated", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/unevaluated": true + }, + "$dynamicAnchor": "meta", + + "title": "Unevaluated applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "unevaluatedItems": {"$dynamicRef": "#meta"}, + "unevaluatedProperties": {"$dynamicRef": "#meta"} + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json new file mode 100644 index 000000000..e0ae13d9d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/validation", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/validation": true + }, + "$dynamicAnchor": "meta", + + "title": "Validation vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "type": { + "anyOf": [ + {"$ref": "#/$defs/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/$defs/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "const": true, + "enum": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, + "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, + "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, + "minContains": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 1 + }, + "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, + "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/$defs/stringArray"}, + "dependentRequired": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + } + }, + "$defs": { + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 0 + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json new file mode 100644 index 000000000..1c68270fd --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json @@ -0,0 +1,55 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/schema", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/core": true, + "https://json-schema.org/draft/2020-12/vocab/applicator": true, + "https://json-schema.org/draft/2020-12/vocab/unevaluated": true, + "https://json-schema.org/draft/2020-12/vocab/validation": true, + "https://json-schema.org/draft/2020-12/vocab/meta-data": true, + "https://json-schema.org/draft/2020-12/vocab/format-annotation": true, + "https://json-schema.org/draft/2020-12/vocab/content": true + }, + "$dynamicAnchor": "meta", + + "title": "Core and Validation specifications meta-schema", + "allOf": [ + {"$ref": "meta/core"}, + {"$ref": "meta/applicator"}, + {"$ref": "meta/unevaluated"}, + {"$ref": "meta/validation"}, + {"$ref": "meta/meta-data"}, + {"$ref": "meta/format-annotation"}, + {"$ref": "meta/content"} + ], + "type": ["object", "boolean"], + "$comment": "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.", + "properties": { + "definitions": { + "$comment": "\"definitions\" has been replaced by \"$defs\".", + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "deprecated": true, + "default": {} + }, + "dependencies": { + "$comment": "\"dependencies\" has been split and replaced by \"dependentSchemas\" and \"dependentRequired\" in order to serve their differing semantics.", + "type": "object", + "additionalProperties": { + "anyOf": [{"$dynamicRef": "#meta"}, {"$ref": "meta/validation#/$defs/stringArray"}] + }, + "deprecated": true, + "default": {} + }, + "$recursiveAnchor": { + "$comment": "\"$recursiveAnchor\" has been replaced by \"$dynamicAnchor\".", + "$ref": "meta/core#/$defs/anchorString", + "deprecated": true + }, + "$recursiveRef": { + "$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".", + "$ref": "meta/core#/$defs/uriReferenceString", + "deprecated": true + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-draft-06.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-draft-06.json new file mode 100644 index 000000000..5410064ba --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-draft-06.json @@ -0,0 +1,137 @@ +{ + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "http://json-schema.org/draft-06/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "examples": { + "type": "array", + "items": {} + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, + "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": {"$ref": "#"}, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], + "default": {} + }, + "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, + "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": {"$ref": "#"}, + "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, + "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/definitions/stringArray"}, + "additionalProperties": {"$ref": "#"}, + "definitions": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] + } + }, + "propertyNames": {"$ref": "#"}, + "const": {}, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + {"$ref": "#/definitions/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/definitions/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": {"type": "string"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"} + }, + "default": {} +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-draft-07.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-draft-07.json new file mode 100644 index 000000000..6a7485104 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-draft-07.json @@ -0,0 +1,151 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, + "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": {"$ref": "#"}, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], + "default": true + }, + "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, + "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": {"$ref": "#"}, + "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, + "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/definitions/stringArray"}, + "additionalProperties": {"$ref": "#"}, + "definitions": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] + } + }, + "propertyNames": {"$ref": "#"}, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + {"$ref": "#/definitions/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/definitions/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": {"type": "string"}, + "contentMediaType": {"type": "string"}, + "contentEncoding": {"type": "string"}, + "if": {"$ref": "#"}, + "then": {"$ref": "#"}, + "else": {"$ref": "#"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"} + }, + "default": true +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-secure.json b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-secure.json new file mode 100644 index 000000000..3968abd5d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/json-schema-secure.json @@ -0,0 +1,88 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/json-schema-secure.json#", + "title": "Meta-schema for the security assessment of JSON Schemas", + "description": "If a JSON AnySchema fails validation against this meta-schema, it may be unsafe to validate untrusted data", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + } + }, + "dependencies": { + "patternProperties": { + "description": "prevent slow validation of large property names", + "required": ["propertyNames"], + "properties": { + "propertyNames": { + "required": ["maxLength"] + } + } + }, + "uniqueItems": { + "description": "prevent slow validation of large non-scalar arrays", + "if": { + "properties": { + "uniqueItems": {"const": true}, + "items": { + "properties": { + "type": { + "anyOf": [ + { + "enum": ["object", "array"] + }, + { + "type": "array", + "contains": {"enum": ["object", "array"]} + } + ] + } + } + } + } + }, + "then": { + "required": ["maxItems"] + } + }, + "pattern": { + "description": "prevent slow pattern matching of large strings", + "required": ["maxLength"] + }, + "format": { + "description": "prevent slow format validation of large strings", + "required": ["maxLength"] + } + }, + "properties": { + "additionalItems": {"$ref": "#"}, + "additionalProperties": {"$ref": "#"}, + "dependencies": { + "additionalProperties": { + "anyOf": [{"type": "array"}, {"$ref": "#"}] + } + }, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}] + }, + "definitions": { + "additionalProperties": {"$ref": "#"} + }, + "patternProperties": { + "additionalProperties": {"$ref": "#"} + }, + "properties": { + "additionalProperties": {"$ref": "#"} + }, + "if": {"$ref": "#"}, + "then": {"$ref": "#"}, + "else": {"$ref": "#"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"}, + "contains": {"$ref": "#"}, + "propertyNames": {"$ref": "#"} + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/jtd-schema.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/refs/jtd-schema.d.ts new file mode 100644 index 000000000..932797a38 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/jtd-schema.d.ts @@ -0,0 +1,3 @@ +import { SchemaObject } from "../types"; +declare const jtdMetaSchema: SchemaObject; +export default jtdMetaSchema; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/jtd-schema.js b/node_modules/ajv-formats/node_modules/ajv/dist/refs/jtd-schema.js new file mode 100644 index 000000000..1ee940afb --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/jtd-schema.js @@ -0,0 +1,118 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const shared = (root) => { + const sch = { + nullable: { type: "boolean" }, + metadata: { + optionalProperties: { + union: { elements: { ref: "schema" } }, + }, + additionalProperties: true, + }, + }; + if (root) + sch.definitions = { values: { ref: "schema" } }; + return sch; +}; +const emptyForm = (root) => ({ + optionalProperties: shared(root), +}); +const refForm = (root) => ({ + properties: { + ref: { type: "string" }, + }, + optionalProperties: shared(root), +}); +const typeForm = (root) => ({ + properties: { + type: { + enum: [ + "boolean", + "timestamp", + "string", + "float32", + "float64", + "int8", + "uint8", + "int16", + "uint16", + "int32", + "uint32", + ], + }, + }, + optionalProperties: shared(root), +}); +const enumForm = (root) => ({ + properties: { + enum: { elements: { type: "string" } }, + }, + optionalProperties: shared(root), +}); +const elementsForm = (root) => ({ + properties: { + elements: { ref: "schema" }, + }, + optionalProperties: shared(root), +}); +const propertiesForm = (root) => ({ + properties: { + properties: { values: { ref: "schema" } }, + }, + optionalProperties: { + optionalProperties: { values: { ref: "schema" } }, + additionalProperties: { type: "boolean" }, + ...shared(root), + }, +}); +const optionalPropertiesForm = (root) => ({ + properties: { + optionalProperties: { values: { ref: "schema" } }, + }, + optionalProperties: { + additionalProperties: { type: "boolean" }, + ...shared(root), + }, +}); +const discriminatorForm = (root) => ({ + properties: { + discriminator: { type: "string" }, + mapping: { + values: { + metadata: { + union: [propertiesForm(false), optionalPropertiesForm(false)], + }, + }, + }, + }, + optionalProperties: shared(root), +}); +const valuesForm = (root) => ({ + properties: { + values: { ref: "schema" }, + }, + optionalProperties: shared(root), +}); +const schema = (root) => ({ + metadata: { + union: [ + emptyForm, + refForm, + typeForm, + enumForm, + elementsForm, + propertiesForm, + optionalPropertiesForm, + discriminatorForm, + valuesForm, + ].map((s) => s(root)), + }, +}); +const jtdMetaSchema = { + definitions: { + schema: schema(false), + }, + ...schema(true), +}; +exports.default = jtdMetaSchema; +//# sourceMappingURL=jtd-schema.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/refs/jtd-schema.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/refs/jtd-schema.js.map new file mode 100644 index 000000000..d46755b21 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/refs/jtd-schema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jtd-schema.js","sourceRoot":"","sources":["../../lib/refs/jtd-schema.ts"],"names":[],"mappings":";;AAIA,MAAM,MAAM,GAAe,CAAC,IAAI,EAAE,EAAE;IAClC,MAAM,GAAG,GAAiB;QACxB,QAAQ,EAAE,EAAC,IAAI,EAAE,SAAS,EAAC;QAC3B,QAAQ,EAAE;YACR,kBAAkB,EAAE;gBAClB,KAAK,EAAE,EAAC,QAAQ,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC,EAAC;aACnC;YACD,oBAAoB,EAAE,IAAI;SAC3B;KACF,CAAA;IACD,IAAI,IAAI;QAAE,GAAG,CAAC,WAAW,GAAG,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC,EAAC,CAAA;IACrD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,MAAM,SAAS,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACvC,kBAAkB,EAAE,MAAM,CAAC,IAAI,CAAC;CACjC,CAAC,CAAA;AAEF,MAAM,OAAO,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACrC,UAAU,EAAE;QACV,GAAG,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;KACtB;IACD,kBAAkB,EAAE,MAAM,CAAC,IAAI,CAAC;CACjC,CAAC,CAAA;AAEF,MAAM,QAAQ,GAAe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ules/ajv-formats/node_modules/ajv/dist/runtime/equal.d.ts new file mode 100644 index 000000000..56149ea2e --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/equal.d.ts @@ -0,0 +1,6 @@ +import * as equal from "fast-deep-equal"; +declare type Equal = typeof equal & { + code: string; +}; +declare const _default: Equal; +export default _default; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/equal.js b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/equal.js new file mode 100644 index 000000000..774bba05a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/equal.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// https://github.com/ajv-validator/ajv/issues/889 +const equal = require("fast-deep-equal"); +equal.code = 'require("ajv/dist/runtime/equal").default'; +exports.default = equal; +//# sourceMappingURL=equal.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/equal.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/equal.js.map new file mode 100644 index 000000000..0e17901c3 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/equal.js.map @@ -0,0 +1 @@ +{"version":3,"file":"equal.js","sourceRoot":"","sources":["../../lib/runtime/equal.ts"],"names":[],"mappings":";;AAAA,kDAAkD;AAClD,yCAAwC;AAGtC,KAAe,CAAC,IAAI,GAAG,2CAA2C,CAAA;AAEpE,kBAAe,KAAc,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/parseJson.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/parseJson.d.ts new file mode 100644 index 000000000..85f1d5670 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/parseJson.d.ts @@ -0,0 +1,18 @@ +export declare function parseJson(s: string, pos: number): unknown; +export declare namespace parseJson { + var message: string | undefined; + var position: number; + var code: string; +} +export declare function parseJsonNumber(s: string, pos: number, maxDigits?: number): number | undefined; +export declare namespace parseJsonNumber { + var message: string | undefined; + var position: number; + var code: string; +} +export declare function parseJsonString(s: string, pos: number): string | undefined; +export declare namespace parseJsonString { + var message: string | undefined; + var position: number; + var code: string; +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/parseJson.js b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/parseJson.js new file mode 100644 index 000000000..7ebbc1bfc --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/parseJson.js @@ -0,0 +1,184 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseJsonString = exports.parseJsonNumber = exports.parseJson = void 0; +const rxParseJson = /position\s(\d+)$/; +function parseJson(s, pos) { + let endPos; + parseJson.message = undefined; + let matches; + if (pos) + s = s.slice(pos); + try { + parseJson.position = pos + s.length; + return JSON.parse(s); + } + catch (e) { + matches = rxParseJson.exec(e.message); + if (!matches) { + parseJson.message = "unexpected end"; + return undefined; + } + endPos = +matches[1]; + const c = s[endPos]; + s = s.slice(0, endPos); + parseJson.position = pos + endPos; + try { + return JSON.parse(s); + } + catch (e1) { + parseJson.message = `unexpected token ${c}`; + return undefined; + } + } +} +exports.parseJson = parseJson; +parseJson.message = undefined; +parseJson.position = 0; +parseJson.code = 'require("ajv/dist/runtime/parseJson").parseJson'; +function parseJsonNumber(s, pos, maxDigits) { + let numStr = ""; + let c; + parseJsonNumber.message = undefined; + if (s[pos] === "-") { + numStr += "-"; + pos++; + } + if (s[pos] === "0") { + numStr += "0"; + pos++; + } + else { + if (!parseDigits(maxDigits)) { + errorMessage(); + return undefined; + } + } + if (maxDigits) { + parseJsonNumber.position = pos; + return +numStr; + } + if (s[pos] === ".") { + numStr += "."; + pos++; + if (!parseDigits()) { + errorMessage(); + return undefined; + } + } + if (((c = s[pos]), c === "e" || c === "E")) { + numStr += "e"; + pos++; + if (((c = s[pos]), c === "+" || c === "-")) { + numStr += c; + pos++; + } + if (!parseDigits()) { + errorMessage(); + return undefined; + } + } + parseJsonNumber.position = pos; + return +numStr; + function parseDigits(maxLen) { + let digit = false; + while (((c = s[pos]), c >= "0" && c <= "9" && (maxLen === undefined || maxLen-- > 0))) { + digit = true; + numStr += c; + pos++; + } + return digit; + } + function errorMessage() { + parseJsonNumber.position = pos; + parseJsonNumber.message = pos < s.length ? `unexpected token ${s[pos]}` : "unexpected end"; + } +} +exports.parseJsonNumber = parseJsonNumber; +parseJsonNumber.message = undefined; +parseJsonNumber.position = 0; +parseJsonNumber.code = 'require("ajv/dist/runtime/parseJson").parseJsonNumber'; +const escapedChars = { + b: "\b", + f: "\f", + n: "\n", + r: "\r", + t: "\t", + '"': '"', + "/": "/", + "\\": "\\", +}; +const CODE_A = "a".charCodeAt(0); +const CODE_0 = "0".charCodeAt(0); +function parseJsonString(s, pos) { + let str = ""; + let c; + parseJsonString.message = undefined; + // eslint-disable-next-line no-constant-condition, @typescript-eslint/no-unnecessary-condition + while (true) { + c = s[pos++]; + if (c === '"') + break; + if (c === "\\") { + c = s[pos]; + if (c in escapedChars) { + str += escapedChars[c]; + pos++; + } + else if (c === "u") { + pos++; + let count = 4; + let code = 0; + while (count--) { + code <<= 4; + c = s[pos]; + if (c === undefined) { + errorMessage("unexpected end"); + return undefined; + } + c = c.toLowerCase(); + if (c >= "a" && c <= "f") { + code += c.charCodeAt(0) - CODE_A + 10; + } + else if (c >= "0" && c <= "9") { + code += c.charCodeAt(0) - CODE_0; + } + else { + errorMessage(`unexpected token ${c}`); + return undefined; + } + pos++; + } + str += String.fromCharCode(code); + } + else { + errorMessage(`unexpected token ${c}`); + return undefined; + } + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + } + else if (c === undefined) { + errorMessage("unexpected end"); + return undefined; + } + else { + if (c.charCodeAt(0) >= 0x20) { + str += c; + } + else { + errorMessage(`unexpected token ${c}`); + return undefined; + } + } + } + parseJsonString.position = pos; + return str; + function errorMessage(msg) { + parseJsonString.position = pos; + parseJsonString.message = msg; + } +} +exports.parseJsonString = parseJsonString; +parseJsonString.message = undefined; +parseJsonString.position = 0; +parseJsonString.code = 'require("ajv/dist/runtime/parseJson").parseJsonString'; +//# sourceMappingURL=parseJson.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/parseJson.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/parseJson.js.map new file mode 100644 index 000000000..7f239fb71 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/parseJson.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parseJson.js","sourceRoot":"","sources":["../../lib/runtime/parseJson.ts"],"names":[],"mappings":";;;AAAA,MAAM,WAAW,GAAG,kBAAkB,CAAA;AAEtC,SAAgB,SAAS,CAAC,CAAS,EAAE,GAAW;IAC9C,IAAI,MAA0B,CAAA;IAC9B,SAAS,CAAC,OAAO,GAAG,SAAS,CAAA;IAC7B,IAAI,OAA+B,CAAA;IACnC,IAAI,GAAG;QAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACzB,IAAI;QACF,SAAS,CAAC,QAAQ,GAAG,GAAG,GAAG,CAAC,CAAC,MAAM,CAAA;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;KACrB;IAAC,OAAO,CAAC,EAAE;QACV,OAAO,GAAG,WAAW,CAAC,IAAI,CAAE,CAAW,CAAC,OAAO,CAAC,CAAA;QAChD,IAAI,CAAC,OAAO,EAAE;YACZ,SAAS,CAAC,OAAO,GAAG,gBAAgB,CAAA;YACpC,OAAO,SAAS,CAAA;SACjB;QACD,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;QACpB,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAA;QACnB,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;QACtB,SAAS,CAAC,QAAQ,GAAG,GAAG,GAAG,MAAM,CAAA;QACjC,IA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/node_modules/ajv-formats/node_modules/ajv/dist/runtime/quote.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/quote.d.ts new file mode 100644 index 000000000..0579dd3c6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/quote.d.ts @@ -0,0 +1,5 @@ +declare function quote(s: string): string; +declare namespace quote { + var code: string; +} +export default quote; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/quote.js b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/quote.js new file mode 100644 index 000000000..ebf78f70d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/quote.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const rxEscapable = +// eslint-disable-next-line no-control-regex, no-misleading-character-class +/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; +const escaped = { + "\b": "\\b", + "\t": "\\t", + "\n": "\\n", + "\f": "\\f", + "\r": "\\r", + '"': '\\"', + "\\": "\\\\", +}; +function quote(s) { + rxEscapable.lastIndex = 0; + return ('"' + + (rxEscapable.test(s) + ? s.replace(rxEscapable, (a) => { + const c = escaped[a]; + return typeof c === "string" + ? c + : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4); + }) + : s) + + '"'); +} +exports.default = quote; +quote.code = 'require("ajv/dist/runtime/quote").default'; +//# sourceMappingURL=quote.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/quote.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/quote.js.map new file mode 100644 index 000000000..4d226252d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/quote.js.map @@ -0,0 +1 @@ +{"version":3,"file":"quote.js","sourceRoot":"","sources":["../../lib/runtime/quote.ts"],"names":[],"mappings":";;AAAA,MAAM,WAAW;AACf,2EAA2E;AAC3E,iIAAiI,CAAA;AAEnI,MAAM,OAAO,GAA6B;IACxC,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACb,CAAA;AAED,SAAwB,KAAK,CAAC,CAAS;IACrC,WAAW,CAAC,SAAS,GAAG,CAAC,CAAA;IACzB,OAAO,CACL,GAAG;QACH,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE;gBAC3B,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;gBACpB,OAAO,OAAO,CAAC,KAAK,QAAQ;oBAC1B,CAAC,CAAC,CAAC;oBACH,CAAC,CAAC,KAAK,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YAC/D,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC,CAAC;QACN,GAAG,CACJ,CAAA;AACH,CAAC;AAdD,wBAcC;AAED,KAAK,CAAC,IAAI,GAAG,2CAA2C,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/re2.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/re2.d.ts new file mode 100644 index 000000000..b49306ff3 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/re2.d.ts @@ -0,0 +1,6 @@ +import * as re2 from "re2"; +declare type Re2 = typeof re2 & { + code: string; +}; +declare const _default: Re2; +export default _default; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/re2.js b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/re2.js new file mode 100644 index 000000000..4b1ee2537 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/re2.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const re2 = require("re2"); +re2.code = 'require("ajv/dist/runtime/re2").default'; +exports.default = re2; +//# sourceMappingURL=re2.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/re2.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/re2.js.map new file mode 100644 index 000000000..bb938a2c4 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/re2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"re2.js","sourceRoot":"","sources":["../../lib/runtime/re2.ts"],"names":[],"mappings":";;AAAA,2BAA0B;AAGxB,GAAW,CAAC,IAAI,GAAG,yCAAyC,CAAA;AAE9D,kBAAe,GAAU,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/timestamp.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/timestamp.d.ts new file mode 100644 index 000000000..cd4832688 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/timestamp.d.ts @@ -0,0 +1,5 @@ +declare function validTimestamp(str: string, allowDate: boolean): boolean; +declare namespace validTimestamp { + var code: string; +} +export default validTimestamp; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/timestamp.js b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/timestamp.js new file mode 100644 index 000000000..5e0f06564 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/timestamp.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const DT_SEPARATOR = /t|\s/i; +const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/; +const TIME = /^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:z|([+-]\d\d)(?::?(\d\d))?)$/i; +const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; +function validTimestamp(str, allowDate) { + // http://tools.ietf.org/html/rfc3339#section-5.6 + const dt = str.split(DT_SEPARATOR); + return ((dt.length === 2 && validDate(dt[0]) && validTime(dt[1])) || + (allowDate && dt.length === 1 && validDate(dt[0]))); +} +exports.default = validTimestamp; +function validDate(str) { + const matches = DATE.exec(str); + if (!matches) + return false; + const y = +matches[1]; + const m = +matches[2]; + const d = +matches[3]; + return (m >= 1 && + m <= 12 && + d >= 1 && + (d <= DAYS[m] || + // leap year: https://tools.ietf.org/html/rfc3339#appendix-C + (m === 2 && d === 29 && (y % 100 === 0 ? y % 400 === 0 : y % 4 === 0)))); +} +function validTime(str) { + const matches = TIME.exec(str); + if (!matches) + return false; + const hr = +matches[1]; + const min = +matches[2]; + const sec = +matches[3]; + const tzH = +(matches[4] || 0); + const tzM = +(matches[5] || 0); + return ((hr <= 23 && min <= 59 && sec <= 59) || + // leap second + (hr - tzH === 23 && min - tzM === 59 && sec === 60)); +} +validTimestamp.code = 'require("ajv/dist/runtime/timestamp").default'; +//# sourceMappingURL=timestamp.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/timestamp.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/timestamp.js.map new file mode 100644 index 000000000..6b0eee039 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/timestamp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"timestamp.js","sourceRoot":"","sources":["../../lib/runtime/timestamp.ts"],"names":[],"mappings":";;AAAA,MAAM,YAAY,GAAG,OAAO,CAAA;AAC5B,MAAM,IAAI,GAAG,4BAA4B,CAAA;AACzC,MAAM,IAAI,GAAG,gEAAgE,CAAA;AAC7E,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE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CAAC,GAAW;IAC5B,MAAM,OAAO,GAAoB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAC/C,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAA;IAC1B,MAAM,EAAE,GAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC9B,MAAM,GAAG,GAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC/B,MAAM,GAAG,GAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAC/B,MAAM,GAAG,GAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IACtC,MAAM,GAAG,GAAW,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;IACtC,OAAO,CACL,CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,CAAC;QACpC,cAAc;QACd,CAAC,EAAE,GAAG,GAAG,KAAK,EAAE,IAAI,GAAG,GAAG,GAAG,KAAK,EAAE,IAAI,GAAG,KAAK,EAAE,CAAC,CACpD,CAAA;AACH,CAAC;AAED,cAAc,CAAC,IAAI,GAAG,+CAA+C,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/ucs2length.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/ucs2length.d.ts new file mode 100644 index 000000000..ecbee69c5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/ucs2length.d.ts @@ -0,0 +1,5 @@ +declare function ucs2length(str: string): number; +declare namespace ucs2length { + var code: string; +} +export default ucs2length; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/ucs2length.js b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/ucs2length.js new file mode 100644 index 000000000..92ea0c08a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/ucs2length.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// https://mathiasbynens.be/notes/javascript-encoding +// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode +function ucs2length(str) { + const len = str.length; + let length = 0; + let pos = 0; + let value; + while (pos < len) { + length++; + value = str.charCodeAt(pos++); + if (value >= 0xd800 && value <= 0xdbff && pos < len) { + // high surrogate, and there is a next character + value = str.charCodeAt(pos); + if ((value & 0xfc00) === 0xdc00) + pos++; // low surrogate + } + } + return length; +} +exports.default = ucs2length; +ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default'; +//# sourceMappingURL=ucs2length.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/ucs2length.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/ucs2length.js.map new file mode 100644 index 000000000..7c7f78865 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/ucs2length.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ucs2length.js","sourceRoot":"","sources":["../../lib/runtime/ucs2length.ts"],"names":[],"mappings":";;AAAA,qDAAqD;AACrD,iEAAiE;AACjE,SAAwB,UAAU,CAAC,GAAW;IAC5C,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAA;IACtB,IAAI,MAAM,GAAG,CAAC,CAAA;IACd,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,IAAI,KAAa,CAAA;IACjB,OAAO,GAAG,GAAG,GAAG,EAAE;QAChB,MAAM,EAAE,CAAA;QACR,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,CAAA;QAC7B,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,MAAM,IAAI,GAAG,GAAG,GAAG,EAAE;YACnD,gDAAgD;YAChD,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;YAC3B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,MAAM;gBAAE,GAAG,EAAE,CAAA,CAAC,gBAAgB;SACxD;KACF;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAfD,6BAeC;AAED,UAAU,CAAC,IAAI,GAAG,gDAAgD,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.d.ts new file mode 100644 index 000000000..83b169f6b --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.d.ts @@ -0,0 +1,6 @@ +import * as uri from "uri-js"; +declare type URI = typeof uri & { + code: string; +}; +declare const _default: URI; +export default _default; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.js b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.js new file mode 100644 index 000000000..fbd38151f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const uri = require("uri-js"); +uri.code = 'require("ajv/dist/runtime/uri").default'; +exports.default = uri; +//# sourceMappingURL=uri.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.js.map new file mode 100644 index 000000000..701bed950 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/uri.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uri.js","sourceRoot":"","sources":["../../lib/runtime/uri.ts"],"names":[],"mappings":";;AAAA,8BAA6B;AAG3B,GAAW,CAAC,IAAI,GAAG,yCAAyC,CAAA;AAE9D,kBAAe,GAAU,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/validation_error.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/validation_error.d.ts new file mode 100644 index 000000000..b0ee9698f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/validation_error.d.ts @@ -0,0 +1,7 @@ +import type { ErrorObject } from "../types"; +export default class ValidationError extends Error { + readonly errors: Partial[]; + readonly ajv: true; + readonly validation: true; + constructor(errors: Partial[]); +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/validation_error.js b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/validation_error.js new file mode 100644 index 000000000..353502c08 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/validation_error.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class ValidationError extends Error { + constructor(errors) { + super("validation failed"); + this.errors = errors; + this.ajv = this.validation = true; + } +} +exports.default = ValidationError; +//# sourceMappingURL=validation_error.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/runtime/validation_error.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/validation_error.js.map new file mode 100644 index 000000000..70206fbc1 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/runtime/validation_error.js.map @@ -0,0 +1 @@ +{"version":3,"file":"validation_error.js","sourceRoot":"","sources":["../../lib/runtime/validation_error.ts"],"names":[],"mappings":";;AAEA,MAAqB,eAAgB,SAAQ,KAAK;IAKhD,YAAY,MAA8B;QACxC,KAAK,CAAC,mBAAmB,CAAC,CAAA;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;IACnC,CAAC;CACF;AAVD,kCAUC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/standalone/index.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/standalone/index.d.ts new file mode 100644 index 000000000..a9141c3d2 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/standalone/index.d.ts @@ -0,0 +1,6 @@ +import type AjvCore from "../core"; +import type { AnyValidateFunction } from "../types"; +declare function standaloneCode(ajv: AjvCore, refsOrFunc?: { + [K in string]?: string; +} | AnyValidateFunction): string; +export default standaloneCode; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/standalone/index.js b/node_modules/ajv-formats/node_modules/ajv/dist/standalone/index.js new file mode 100644 index 000000000..b44bb5db5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/standalone/index.js @@ -0,0 +1,90 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const scope_1 = require("../compile/codegen/scope"); +const code_1 = require("../compile/codegen/code"); +function standaloneCode(ajv, refsOrFunc) { + if (!ajv.opts.code.source) { + throw new Error("moduleCode: ajv instance must have code.source option"); + } + const { _n } = ajv.scope.opts; + return typeof refsOrFunc == "function" + ? funcExportCode(refsOrFunc.source) + : refsOrFunc !== undefined + ? multiExportsCode(refsOrFunc, getValidate) + : multiExportsCode(ajv.schemas, (sch) => sch.meta ? undefined : ajv.compile(sch.schema)); + function getValidate(id) { + const v = ajv.getSchema(id); + if (!v) + throw new Error(`moduleCode: no schema with id ${id}`); + return v; + } + function funcExportCode(source) { + const usedValues = {}; + const n = source === null || source === void 0 ? void 0 : source.validateName; + const vCode = validateCode(usedValues, source); + if (ajv.opts.code.esm) { + // Always do named export as `validate` rather than the variable `n` which is `validateXX` for known export value + return `"use strict";${_n}export const validate = ${n};${_n}export default ${n};${_n}${vCode}`; + } + return `"use strict";${_n}module.exports = ${n};${_n}module.exports.default = ${n};${_n}${vCode}`; + } + function multiExportsCode(schemas, getValidateFunc) { + var _a; + const usedValues = {}; + let code = (0, code_1._) `"use strict";`; + for (const name in schemas) { + const v = getValidateFunc(schemas[name]); + if (v) { + const vCode = validateCode(usedValues, v.source); + const exportSyntax = ajv.opts.code.esm + ? (0, code_1._) `export const ${(0, code_1.getEsmExportName)(name)}` + : (0, code_1._) `exports${(0, code_1.getProperty)(name)}`; + code = (0, code_1._) `${code}${_n}${exportSyntax} = ${(_a = v.source) === null || _a === void 0 ? void 0 : _a.validateName};${_n}${vCode}`; + } + } + return `${code}`; + } + function validateCode(usedValues, s) { + if (!s) + throw new Error('moduleCode: function does not have "source" property'); + if (usedState(s.validateName) === scope_1.UsedValueState.Completed) + return code_1.nil; + setUsedState(s.validateName, scope_1.UsedValueState.Started); + const scopeCode = ajv.scope.scopeCode(s.scopeValues, usedValues, refValidateCode); + const code = new code_1._Code(`${scopeCode}${_n}${s.validateCode}`); + return s.evaluated ? (0, code_1._) `${code}${s.validateName}.evaluated = ${s.evaluated};${_n}` : code; + function refValidateCode(n) { + var _a; + const vRef = (_a = n.value) === null || _a === void 0 ? void 0 : _a.ref; + if (n.prefix === "validate" && typeof vRef == "function") { + const v = vRef; + return validateCode(usedValues, v.source); + } + else if ((n.prefix === "root" || n.prefix === "wrapper") && typeof vRef == "object") { + const { validate, validateName } = vRef; + if (!validateName) + throw new Error("ajv internal error"); + const def = ajv.opts.code.es5 ? scope_1.varKinds.var : scope_1.varKinds.const; + const wrapper = (0, code_1._) `${def} ${n} = {validate: ${validateName}};`; + if (usedState(validateName) === scope_1.UsedValueState.Started) + return wrapper; + const vCode = validateCode(usedValues, validate === null || validate === void 0 ? void 0 : validate.source); + return (0, code_1._) `${wrapper}${_n}${vCode}`; + } + return undefined; + } + function usedState(name) { + var _a; + return (_a = usedValues[name.prefix]) === null || _a === void 0 ? void 0 : _a.get(name); + } + function setUsedState(name, state) { + const { prefix } = name; + const names = (usedValues[prefix] = usedValues[prefix] || new Map()); + names.set(name, state); + } + } +} +module.exports = exports = standaloneCode; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = standaloneCode; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/standalone/index.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/standalone/index.js.map new file mode 100644 index 000000000..11864d36e --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/standalone/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/standalone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C,iBAAiB,YAAY,IAAI,CAAA;gBAC7D,IAAI,SAAS,CAAC,YAAY,CAAC,KAAK,sBAAc,CAAC,OAAO;oBAAE,OAAO,OAAO,CAAA;gBACtE,MAAM,KAAK,GAAG,YAAY,CAAC,UAAU,EAAE,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,MAAM,CAAC,CAAA;gBACxD,OAAO,IAAA,QAAC,EAAA,GAAG,OAAO,GAAG,EAAE,GAAG,KAAK,EAAE,CAAA;aAClC;YACD,OAAO,SAAS,CAAA;QAClB,CAAC;QAED,SAAS,SAAS,CAAC,IAAoB;;YACrC,OAAO,MAAA,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,0CAAE,GAAG,CAAC,IAAI,CAAC,CAAA;QAC3C,CAAC;QAED,SAAS,YAAY,CAAC,IAAoB,EAAE,KAAqB;YAC/D,MAAM,EAAC,MAAM,EAAC,GAAG,IAAI,CAAA;YACrB,MAAM,KAAK,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC,CAAA;YACpE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACxB,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,cAAc,CAAA;AACzC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,cAAc,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/standalone/instance.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/standalone/instance.d.ts new file mode 100644 index 000000000..156ac3226 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/standalone/instance.d.ts @@ -0,0 +1,12 @@ +import Ajv, { AnySchema, AnyValidateFunction, ErrorObject } from "../core"; +export default class AjvPack { + readonly ajv: Ajv; + errors?: ErrorObject[] | null; + constructor(ajv: Ajv); + validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise; + compile(schema: AnySchema, meta?: boolean): AnyValidateFunction; + getSchema(keyRef: string): AnyValidateFunction | undefined; + private getStandalone; + addSchema(...args: Parameters): AjvPack; + addKeyword(...args: Parameters): AjvPack; +} diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/standalone/instance.js b/node_modules/ajv-formats/node_modules/ajv/dist/standalone/instance.js new file mode 100644 index 000000000..35e5c9925 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/standalone/instance.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const core_1 = require("../core"); +const _1 = require("."); +const requireFromString = require("require-from-string"); +class AjvPack { + constructor(ajv) { + this.ajv = ajv; + } + validate(schemaKeyRef, data) { + return core_1.default.prototype.validate.call(this, schemaKeyRef, data); + } + compile(schema, meta) { + return this.getStandalone(this.ajv.compile(schema, meta)); + } + getSchema(keyRef) { + const v = this.ajv.getSchema(keyRef); + if (!v) + return undefined; + return this.getStandalone(v); + } + getStandalone(v) { + return requireFromString((0, _1.default)(this.ajv, v)); + } + addSchema(...args) { + this.ajv.addSchema.call(this.ajv, ...args); + return this; + } + addKeyword(...args) { + this.ajv.addKeyword.call(this.ajv, ...args); + return this; + } +} +exports.default = AjvPack; +//# sourceMappingURL=instance.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/standalone/instance.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/standalone/instance.js.map new file mode 100644 index 000000000..6ac33b114 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/standalone/instance.js.map @@ -0,0 +1 @@ +{"version":3,"file":"instance.js","sourceRoot":"","sources":["../../lib/standalone/instance.ts"],"names":[],"mappings":";;AAAA,kCAAwE;AACxE,wBAA8B;AAC9B,yDAAwD;AAExD,MAAqB,OAAO;IAE1B,YAAqB,GAAQ;QAAR,QAAG,GAAH,GAAG,CAAK;IAAG,CAAC;IAEjC,QAAQ,CAAC,YAAgC,EAAE,IAAa;QACtD,OAAO,cAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,CAAA;IAC9D,CAAC;IAED,OAAO,CAAc,MAAiB,EAAE,IAAc;QACpD,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAI,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED,SAAS,CAAc,MAAc;QACnC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAI,MAAM,CAAC,CAAA;QACvC,IAAI,CAAC,CAAC;YAAE,OAAO,SAAS,CAAA;QACxB,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAA;IAC9B,CAAC;IAEO,aAAa,CAAc,CAAyB;QAC1D,OAAO,iBAAiB,CAAC,IAAA,UAAc,EAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAA2B,CAAA;IACjF,CAAC;IAED,SAAS,CAAC,GAAG,IAAgD;QAC3D,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;QAC1C,OAAO,IAAI,CAAA;IACb,CAAC;IAED,UAAU,CAAC,GAAG,IAAiD;QAC7D,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;QAC3C,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA/BD,0BA+BC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/types/index.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/types/index.d.ts new file mode 100644 index 000000000..065261e9f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/types/index.d.ts @@ -0,0 +1,183 @@ +import * as URI from "uri-js"; +import type { CodeGen, Code, Name, ScopeValueSets, ValueScopeName } from "../compile/codegen"; +import type { SchemaEnv, SchemaCxt, SchemaObjCxt } from "../compile"; +import type { JSONType } from "../compile/rules"; +import type { KeywordCxt } from "../compile/validate"; +import type Ajv from "../core"; +interface _SchemaObject { + id?: string; + $id?: string; + $schema?: string; + [x: string]: any; +} +export interface SchemaObject extends _SchemaObject { + id?: string; + $id?: string; + $schema?: string; + $async?: false; + [x: string]: any; +} +export interface AsyncSchema extends _SchemaObject { + $async: true; +} +export declare type AnySchemaObject = SchemaObject | AsyncSchema; +export declare type Schema = SchemaObject | boolean; +export declare type AnySchema = Schema | AsyncSchema; +export declare type SchemaMap = { + [Key in string]?: AnySchema; +}; +export interface SourceCode { + validateName: ValueScopeName; + validateCode: string; + scopeValues: ScopeValueSets; + evaluated?: Code; +} +export interface DataValidationCxt { + instancePath: string; + parentData: { + [K in T]: any; + }; + parentDataProperty: T; + rootData: Record | any[]; + dynamicAnchors: { + [Ref in string]?: ValidateFunction; + }; +} +export interface ValidateFunction { + (this: Ajv | any, data: any, dataCxt?: DataValidationCxt): data is T; + errors?: null | ErrorObject[]; + evaluated?: Evaluated; + schema: AnySchema; + schemaEnv: SchemaEnv; + source?: SourceCode; +} +export interface JTDParser { + (json: string): T | undefined; + message?: string; + position?: number; +} +export declare type EvaluatedProperties = { + [K in string]?: true; +} | true; +export declare type EvaluatedItems = number | true; +export interface Evaluated { + props?: EvaluatedProperties; + items?: EvaluatedItems; + dynamicProps: boolean; + dynamicItems: boolean; +} +export interface AsyncValidateFunction extends ValidateFunction { + (...args: Parameters>): Promise; + $async: true; +} +export declare type AnyValidateFunction = ValidateFunction | AsyncValidateFunction; +export interface ErrorObject, S = unknown> { + keyword: K; + instancePath: string; + schemaPath: string; + params: P; + propertyName?: string; + message?: string; + schema?: S; + parentSchema?: AnySchemaObject; + data?: unknown; +} +export declare type ErrorNoParams = ErrorObject, S>; +interface _KeywordDef { + keyword: string | string[]; + type?: JSONType | JSONType[]; + schemaType?: JSONType | JSONType[]; + allowUndefined?: boolean; + $data?: boolean; + implements?: string[]; + before?: string; + post?: boolean; + metaSchema?: AnySchemaObject; + validateSchema?: AnyValidateFunction; + dependencies?: string[]; + error?: KeywordErrorDefinition; + $dataError?: KeywordErrorDefinition; +} +export interface CodeKeywordDefinition extends _KeywordDef { + code: (cxt: KeywordCxt, ruleType?: string) => void; + trackErrors?: boolean; +} +export declare type MacroKeywordFunc = (schema: any, parentSchema: AnySchemaObject, it: SchemaCxt) => AnySchema; +export declare type CompileKeywordFunc = (schema: any, parentSchema: AnySchemaObject, it: SchemaObjCxt) => DataValidateFunction; +export interface DataValidateFunction { + (...args: Parameters): boolean | Promise; + errors?: Partial[]; +} +export interface SchemaValidateFunction { + (schema: any, data: any, parentSchema?: AnySchemaObject, dataCxt?: DataValidationCxt): boolean | Promise; + errors?: Partial[]; +} +export interface FuncKeywordDefinition extends _KeywordDef { + validate?: SchemaValidateFunction | DataValidateFunction; + compile?: CompileKeywordFunc; + schema?: boolean; + modifying?: boolean; + async?: boolean; + valid?: boolean; + errors?: boolean | "full"; +} +export interface MacroKeywordDefinition extends FuncKeywordDefinition { + macro: MacroKeywordFunc; +} +export declare type KeywordDefinition = CodeKeywordDefinition | FuncKeywordDefinition | MacroKeywordDefinition; +export declare type AddedKeywordDefinition = KeywordDefinition & { + type: JSONType[]; + schemaType: JSONType[]; +}; +export interface KeywordErrorDefinition { + message: string | Code | ((cxt: KeywordErrorCxt) => string | Code); + params?: Code | ((cxt: KeywordErrorCxt) => Code); +} +export declare type Vocabulary = (KeywordDefinition | string)[]; +export interface KeywordErrorCxt { + gen: CodeGen; + keyword: string; + data: Name; + $data?: string | false; + schema: any; + parentSchema?: AnySchemaObject; + schemaCode: Code | number | boolean; + schemaValue: Code | number | boolean; + schemaType?: JSONType[]; + errsCount?: Name; + params: KeywordCxtParams; + it: SchemaCxt; +} +export declare type KeywordCxtParams = { + [P in string]?: Code | string | number; +}; +export declare type FormatValidator = (data: T) => boolean; +export declare type FormatCompare = (data1: T, data2: T) => number | undefined; +export declare type AsyncFormatValidator = (data: T) => Promise; +export interface FormatDefinition { + type?: T extends string ? "string" | undefined : "number"; + validate: FormatValidator | (T extends string ? string | RegExp : never); + async?: false | undefined; + compare?: FormatCompare; +} +export interface AsyncFormatDefinition { + type?: T extends string ? "string" | undefined : "number"; + validate: AsyncFormatValidator; + async: true; + compare?: FormatCompare; +} +export declare type AddedFormat = true | RegExp | FormatValidator | FormatDefinition | FormatDefinition | AsyncFormatDefinition | AsyncFormatDefinition; +export declare type Format = AddedFormat | string; +export interface RegExpEngine { + (pattern: string, u: string): RegExpLike; + code: string; +} +export interface RegExpLike { + test: (s: string) => boolean; +} +export interface UriResolver { + parse(uri: string): URI.URIComponents; + resolve(base: string, path: string): string; + serialize(component: URI.URIComponents): string; +} +export {}; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/types/index.js b/node_modules/ajv-formats/node_modules/ajv/dist/types/index.js new file mode 100644 index 000000000..aa219d8f2 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/types/index.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/types/index.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/types/index.js.map new file mode 100644 index 000000000..1f80f85ec --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/types/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/types/index.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/types/json-schema.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/types/json-schema.d.ts new file mode 100644 index 000000000..78ec842fa --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/types/json-schema.d.ts @@ -0,0 +1,124 @@ +declare type StrictNullChecksWrapper = undefined extends null ? `strictNullChecks must be true in tsconfig to use ${Name}` : Type; +declare type UnionToIntersection = (U extends any ? (_: U) => void : never) extends (_: infer I) => void ? I : never; +export declare type SomeJSONSchema = UncheckedJSONSchemaType; +declare type UncheckedPartialSchema = Partial>; +export declare type PartialSchema = StrictNullChecksWrapper<"PartialSchema", UncheckedPartialSchema>; +declare type JSONType = IsPartial extends true ? T | undefined : T; +interface NumberKeywords { + minimum?: number; + maximum?: number; + exclusiveMinimum?: number; + exclusiveMaximum?: number; + multipleOf?: number; + format?: string; +} +interface StringKeywords { + minLength?: number; + maxLength?: number; + pattern?: string; + format?: string; +} +declare type UncheckedJSONSchemaType = (// these two unions allow arbitrary unions of types +{ + anyOf: readonly UncheckedJSONSchemaType[]; +} | { + oneOf: readonly UncheckedJSONSchemaType[]; +} | ({ + type: readonly (T extends number ? JSONType<"number" | "integer", IsPartial> : T extends string ? JSONType<"string", IsPartial> : T extends boolean ? JSONType<"boolean", IsPartial> : never)[]; +} & UnionToIntersection) | ((T extends number ? { + type: JSONType<"number" | "integer", IsPartial>; +} & NumberKeywords : T extends string ? { + type: JSONType<"string", IsPartial>; +} & StringKeywords : T extends boolean ? { + type: JSONType<"boolean", IsPartial>; +} : T extends readonly [any, ...any[]] ? { + type: JSONType<"array", IsPartial>; + items: { + readonly [K in keyof T]-?: UncheckedJSONSchemaType & Nullable; + } & { + length: T["length"]; + }; + minItems: T["length"]; +} & ({ + maxItems: T["length"]; +} | { + additionalItems: false; +}) : T extends readonly any[] ? { + type: JSONType<"array", IsPartial>; + items: UncheckedJSONSchemaType; + contains?: UncheckedPartialSchema; + minItems?: number; + maxItems?: number; + minContains?: number; + maxContains?: number; + uniqueItems?: true; + additionalItems?: never; +} : T extends Record ? { + type: JSONType<"object", IsPartial>; + additionalProperties?: boolean | UncheckedJSONSchemaType; + unevaluatedProperties?: boolean | UncheckedJSONSchemaType; + properties?: IsPartial extends true ? Partial> : UncheckedPropertiesSchema; + patternProperties?: Record>; + propertyNames?: Omit, "type"> & { + type?: "string"; + }; + dependencies?: { + [K in keyof T]?: Readonly<(keyof T)[]> | UncheckedPartialSchema; + }; + dependentRequired?: { + [K in keyof T]?: Readonly<(keyof T)[]>; + }; + dependentSchemas?: { + [K in keyof T]?: UncheckedPartialSchema; + }; + minProperties?: number; + maxProperties?: number; +} & (IsPartial extends true ? { + required: Readonly<(keyof T)[]>; +} : [UncheckedRequiredMembers] extends [never] ? { + required?: Readonly[]>; +} : { + required: Readonly[]>; +}) : T extends null ? { + type: JSONType<"null", IsPartial>; + nullable: true; +} : never) & { + allOf?: Readonly[]>; + anyOf?: Readonly[]>; + oneOf?: Readonly[]>; + if?: UncheckedPartialSchema; + then?: UncheckedPartialSchema; + else?: UncheckedPartialSchema; + not?: UncheckedPartialSchema; +})) & { + [keyword: string]: any; + $id?: string; + $ref?: string; + $defs?: Record>; + definitions?: Record>; +}; +export declare type JSONSchemaType = StrictNullChecksWrapper<"JSONSchemaType", UncheckedJSONSchemaType>; +declare type Known = { + [key: string]: Known; +} | [Known, ...Known[]] | Known[] | number | string | boolean | null; +declare type UncheckedPropertiesSchema = { + [K in keyof T]-?: (UncheckedJSONSchemaType & Nullable) | { + $ref: string; + }; +}; +export declare type PropertiesSchema = StrictNullChecksWrapper<"PropertiesSchema", UncheckedPropertiesSchema>; +declare type UncheckedRequiredMembers = { + [K in keyof T]-?: undefined extends T[K] ? never : K; +}[keyof T]; +export declare type RequiredMembers = StrictNullChecksWrapper<"RequiredMembers", UncheckedRequiredMembers>; +declare type Nullable = undefined extends T ? { + nullable: true; + const?: null; + enum?: Readonly<(T | null)[]>; + default?: T | null; +} : { + const?: T; + enum?: Readonly; + default?: T; +}; +export {}; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/types/json-schema.js b/node_modules/ajv-formats/node_modules/ajv/dist/types/json-schema.js new file mode 100644 index 000000000..2d8f98dc5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/types/json-schema.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=json-schema.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/types/json-schema.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/types/json-schema.js.map new file mode 100644 index 000000000..ae6b4d0fe --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/types/json-schema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json-schema.js","sourceRoot":"","sources":["../../lib/types/json-schema.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/types/jtd-schema.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/types/jtd-schema.d.ts new file mode 100644 index 000000000..3004e5e5b --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/types/jtd-schema.d.ts @@ -0,0 +1,169 @@ +/** numeric strings */ +declare type NumberType = "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32"; +/** string strings */ +declare type StringType = "string" | "timestamp"; +/** Generic JTD Schema without inference of the represented type */ +export declare type SomeJTDSchemaType = (// ref +{ + ref: string; +} | { + type: NumberType | StringType | "boolean"; +} | { + enum: string[]; +} | { + elements: SomeJTDSchemaType; +} | { + values: SomeJTDSchemaType; +} | { + properties: Record; + optionalProperties?: Record; + additionalProperties?: boolean; +} | { + properties?: Record; + optionalProperties: Record; + additionalProperties?: boolean; +} | { + discriminator: string; + mapping: Record; +} | {}) & { + nullable?: boolean; + metadata?: Record; + definitions?: Record; +}; +/** required keys of an object, not undefined */ +declare type RequiredKeys = { + [K in keyof T]-?: undefined extends T[K] ? never : K; +}[keyof T]; +/** optional or undifined-able keys of an object */ +declare type OptionalKeys = { + [K in keyof T]-?: undefined extends T[K] ? K : never; +}[keyof T]; +/** type is true if T is a union type */ +declare type IsUnion_ = false extends (T extends unknown ? ([U] extends [T] ? false : true) : never) ? false : true; +declare type IsUnion = IsUnion_; +/** type is true if T is identically E */ +declare type TypeEquality = [T] extends [E] ? ([E] extends [T] ? true : false) : false; +/** type is true if T or null is identically E or null*/ +declare type NullTypeEquality = TypeEquality; +/** gets only the string literals of a type or null if a type isn't a string literal */ +declare type EnumString = [T] extends [never] ? null : T extends string ? string extends T ? null : T : null; +/** true if type is a union of string literals */ +declare type IsEnum = null extends EnumString> ? false : true; +/** true only if all types are array types (not tuples) */ +declare type IsElements = false extends IsUnion ? [T] extends [readonly unknown[]] ? undefined extends T[0.5] ? false : true : false : false; +/** true if the the type is a values type */ +declare type IsValues = false extends IsUnion> ? TypeEquality, string> : false; +/** true if type is a proeprties type and Union is false, or type is a discriminator type and Union is true */ +declare type IsRecord = Union extends IsUnion> ? null extends EnumString> ? false : true : false; +/** actual schema */ +export declare type JTDSchemaType = Record> = (// refs - where null wasn't specified, must match exactly +(null extends EnumString ? never : ({ + [K in keyof D]: [T] extends [D[K]] ? { + ref: K; + } : never; +}[keyof D] & { + nullable?: false; +}) | (null extends T ? { + [K in keyof D]: [Exclude] extends [Exclude] ? { + ref: K; + } : never; +}[keyof D] & { + nullable: true; +} : never)) | (unknown extends T ? { + nullable?: boolean; +} : never) | ((true extends NullTypeEquality ? { + type: NumberType; +} : true extends NullTypeEquality ? { + type: "boolean"; +} : true extends NullTypeEquality ? { + type: StringType; +} : true extends NullTypeEquality ? { + type: "timestamp"; +} : true extends IsEnum ? { + enum: EnumString>[]; +} : true extends IsElements> ? T extends readonly (infer E)[] ? { + elements: JTDSchemaType; +} : never : true extends IsValues ? T extends Record ? { + values: JTDSchemaType; +} : never : true extends IsRecord ? ([RequiredKeys>] extends [never] ? { + properties?: Record; +} : { + properties: { + [K in RequiredKeys]: JTDSchemaType; + }; +}) & ([OptionalKeys>] extends [never] ? { + optionalProperties?: Record; +} : { + optionalProperties: { + [K in OptionalKeys]: JTDSchemaType, D>; + }; +}) & { + additionalProperties?: boolean; +} : true extends IsRecord ? { + [K in keyof Exclude]-?: Exclude[K] extends string ? { + discriminator: K; + mapping: { + [M in Exclude[K]]: JTDSchemaType, D>; + }; + } : never; +}[keyof Exclude] : never) & (null extends T ? { + nullable: true; +} : { + nullable?: false; +}))) & { + metadata?: Record; + definitions?: { + [K in keyof D]: JTDSchemaType; + }; +}; +declare type JTDDataDef> = // ref +(S extends { + ref: string; +} ? D extends { + [K in S["ref"]]: infer V; +} ? JTDDataDef : never : S extends { + type: NumberType; +} ? number : S extends { + type: "boolean"; +} ? boolean : S extends { + type: "string"; +} ? string : S extends { + type: "timestamp"; +} ? string | Date : S extends { + enum: readonly (infer E)[]; +} ? string extends E ? never : [E] extends [string] ? E : never : S extends { + elements: infer E; +} ? JTDDataDef[] : S extends { + properties: Record; + optionalProperties?: Record; + additionalProperties?: boolean; +} ? { + -readonly [K in keyof S["properties"]]-?: JTDDataDef; +} & { + -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef; +} & ([S["additionalProperties"]] extends [true] ? Record : unknown) : S extends { + properties?: Record; + optionalProperties: Record; + additionalProperties?: boolean; +} ? { + -readonly [K in keyof S["properties"]]-?: JTDDataDef; +} & { + -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef; +} & ([S["additionalProperties"]] extends [true] ? Record : unknown) : S extends { + values: infer V; +} ? Record> : S extends { + discriminator: infer M; + mapping: Record; +} ? [M] extends [string] ? { + [K in keyof S["mapping"]]: JTDDataDef & { + [KM in M]: K; + }; +}[keyof S["mapping"]] : never : unknown) | (S extends { + nullable: true; +} ? null : never); +export declare type JTDDataType = S extends { + definitions: Record; +} ? JTDDataDef : JTDDataDef>; +export {}; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/types/jtd-schema.js b/node_modules/ajv-formats/node_modules/ajv/dist/types/jtd-schema.js new file mode 100644 index 000000000..11338aa8a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/types/jtd-schema.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=jtd-schema.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/types/jtd-schema.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/types/jtd-schema.js.map new file mode 100644 index 000000000..add89bd77 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/types/jtd-schema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jtd-schema.js","sourceRoot":"","sources":["../../lib/types/jtd-schema.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts new file mode 100644 index 000000000..89a73f8dd --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +export declare type AdditionalItemsError = ErrorObject<"additionalItems", { + limit: number; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export declare function validateAdditionalItems(cxt: KeywordCxt, items: AnySchema[]): void; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js new file mode 100644 index 000000000..608d51eb6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js @@ -0,0 +1,49 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateAdditionalItems = void 0; +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params: { len } }) => (0, codegen_1.str) `must NOT have more than ${len} items`, + params: ({ params: { len } }) => (0, codegen_1._) `{limit: ${len}}`, +}; +const def = { + keyword: "additionalItems", + type: "array", + schemaType: ["boolean", "object"], + before: "uniqueItems", + error, + code(cxt) { + const { parentSchema, it } = cxt; + const { items } = parentSchema; + if (!Array.isArray(items)) { + (0, util_1.checkStrictMode)(it, '"additionalItems" is ignored when "items" is not an array of schemas'); + return; + } + validateAdditionalItems(cxt, items); + }, +}; +function validateAdditionalItems(cxt, items) { + const { gen, schema, data, keyword, it } = cxt; + it.items = true; + const len = gen.const("len", (0, codegen_1._) `${data}.length`); + if (schema === false) { + cxt.setParams({ len: items.length }); + cxt.pass((0, codegen_1._) `${len} <= ${items.length}`); + } + else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) { + const valid = gen.var("valid", (0, codegen_1._) `${len} <= ${items.length}`); // TODO var + gen.if((0, codegen_1.not)(valid), () => validateItems(valid)); + cxt.ok(valid); + } + function validateItems(valid) { + gen.forRange("i", items.length, len, (i) => { + cxt.subschema({ keyword, dataProp: i, dataPropType: util_1.Type.Num }, valid); + if (!it.allErrors) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + }); + } +} +exports.validateAdditionalItems = validateAdditionalItems; +exports.default = def; +//# sourceMappingURL=additionalItems.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map new file mode 100644 index 000000000..b3d1479c2 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map @@ -0,0 +1 @@ +{"version":3,"file":"additionalItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/additionalItems.ts"],"names":[],"mappings":";;;AAOA,mDAAuD;AACvD,6CAA2E;AAI3E,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,2BAA2B,GAAG,QAAQ;IACvE,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,E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AC,GAAG,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,GAAG,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC,CAAA,CAAC,WAAW;QACxE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAA;QAC9C,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;KACd;IAED,SAAS,aAAa,CAAC,KAAW;QAChC,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE;YACzC,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,YAAY,EAAE,WAAI,CAAC,GAAG,EAAC,EAAE,KAAK,CAAC,CAAA;YACpE,IAAI,CAAC,EAAE,CAAC,SAAS;gBAAE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;QAC1D,CAAC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC;AAnBD,0DAmBC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts new file mode 100644 index 000000000..f24ba3f5f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, AddedKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export declare type AdditionalPropertiesError = ErrorObject<"additionalProperties", { + additionalProperty: string; +}, AnySchema>; +declare const def: CodeKeywordDefinition & AddedKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js new file mode 100644 index 000000000..1d3374bb7 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js @@ -0,0 +1,106 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const names_1 = require("../../compile/names"); +const util_1 = require("../../compile/util"); +const error = { + message: "must NOT have additional properties", + params: ({ params }) => (0, codegen_1._) `{additionalProperty: ${params.additionalProperty}}`, +}; +const def = { + keyword: "additionalProperties", + type: ["object"], + schemaType: ["boolean", "object"], + allowUndefined: true, + trackErrors: true, + error, + code(cxt) { + const { gen, schema, parentSchema, data, errsCount, it } = cxt; + /* istanbul ignore if */ + if (!errsCount) + throw new Error("ajv implementation error"); + const { allErrors, opts } = it; + it.props = true; + if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it, schema)) + return; + const props = (0, code_1.allSchemaProperties)(parentSchema.properties); + const patProps = (0, code_1.allSchemaProperties)(parentSchema.patternProperties); + checkAdditionalProperties(); + cxt.ok((0, codegen_1._) `${errsCount} === ${names_1.default.errors}`); + function checkAdditionalProperties() { + gen.forIn("key", data, (key) => { + if (!props.length && !patProps.length) + additionalPropertyCode(key); + else + gen.if(isAdditional(key), () => additionalPropertyCode(key)); + }); + } + function isAdditional(key) { + let definedProp; + if (props.length > 8) { + // TODO maybe an option instead of hard-coded 8? + const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema.properties, "properties"); + definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key); + } + else if (props.length) { + definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._) `${key} === ${p}`)); + } + else { + definedProp = codegen_1.nil; + } + if (patProps.length) { + definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._) `${(0, code_1.usePattern)(cxt, p)}.test(${key})`)); + } + return (0, codegen_1.not)(definedProp); + } + function deleteAdditional(key) { + gen.code((0, codegen_1._) `delete ${data}[${key}]`); + } + function additionalPropertyCode(key) { + if (opts.removeAdditional === "all" || (opts.removeAdditional && schema === false)) { + deleteAdditional(key); + return; + } + if (schema === false) { + cxt.setParams({ additionalProperty: key }); + cxt.error(); + if (!allErrors) + gen.break(); + return; + } + if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) { + const valid = gen.name("valid"); + if (opts.removeAdditional === "failing") { + applyAdditionalSchema(key, valid, false); + gen.if((0, codegen_1.not)(valid), () => { + cxt.reset(); + deleteAdditional(key); + }); + } + else { + applyAdditionalSchema(key, valid); + if (!allErrors) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + } + } + } + function applyAdditionalSchema(key, valid, errors) { + const subschema = { + keyword: "additionalProperties", + dataProp: key, + dataPropType: util_1.Type.Str, + }; + if (errors === false) { + Object.assign(subschema, { + compositeRule: true, + createErrors: false, + allErrors: false, + }); + } + cxt.subschema(subschema, valid); + } + }, +}; +exports.default = def; +//# sourceMappingURL=additionalProperties.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map new file mode 100644 index 000000000..d2f249f6f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"additionalProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/additionalProperties.ts"],"names":[],"mappings":";;AAOA,kCAAsE;AACtE,mDAAiE;AACjE,+CAAmC;AAEnC,6CAA0E;AAQ1E,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,qCAAqC;IAC9C,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,wBAAwB,MAAM,CAAC,kB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,SAAS,EAAE;oBACvB,aAAa,EAAE,IAAI;oBACnB,YAAY,EAAE,KAAK;oBACnB,SAAS,EAAE,KAAK;iBACjB,CAAC,CAAA;aACH;YACD,GAAG,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QACjC,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/allOf.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/allOf.js new file mode 100644 index 000000000..1b1ae7376 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/allOf.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const def = { + keyword: "allOf", + schemaType: "array", + code(cxt) { + const { gen, schema, it } = cxt; + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + const valid = gen.name("valid"); + schema.forEach((sch, i) => { + if ((0, util_1.alwaysValidSchema)(it, sch)) + return; + const schCxt = cxt.subschema({ keyword: "allOf", schemaProp: i }, valid); + cxt.ok(valid); + cxt.mergeEvaluated(schCxt); + }); + }, +}; +exports.default = def; +//# sourceMappingURL=allOf.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map new file mode 100644 index 000000000..d119d0eae --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"allOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/allOf.ts"],"names":[],"mappings":";;AAEA,6CAAoD;AAEpD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC7B,wBAAwB;QACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QACvE,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,MAAM,CAAC,OAAO,CAAC,CAAC,GAAc,EAAE,CAAS,EAAE,EAAE;YAC3C,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,GAAG,CAAC;gBAAE,OAAM;YACtC,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAAC,EAAE,KAAK,CAAC,CAAA;YACtE,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;YACb,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;QAC5B,CAAC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts new file mode 100644 index 000000000..db3fc0e28 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts @@ -0,0 +1,4 @@ +import type { CodeKeywordDefinition, ErrorNoParams, AnySchema } from "../../types"; +export declare type AnyOfError = ErrorNoParams<"anyOf", AnySchema[]>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/anyOf.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/anyOf.js new file mode 100644 index 000000000..66cfce2cc --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/anyOf.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const def = { + keyword: "anyOf", + schemaType: "array", + trackErrors: true, + code: code_1.validateUnion, + error: { message: "must match a schema in anyOf" }, +}; +exports.default = def; +//# sourceMappingURL=anyOf.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map new file mode 100644 index 000000000..537ffcbeb --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"anyOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/anyOf.ts"],"names":[],"mappings":";;AACA,kCAAqC;AAIrC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,IAAI;IACjB,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE,EAAC,OAAO,EAAE,8BAA8B,EAAC;CACjD,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts new file mode 100644 index 000000000..7e4e96a0e --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts @@ -0,0 +1,7 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export declare type ContainsError = ErrorObject<"contains", { + minContains: number; + maxContains?: number; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/contains.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/contains.js new file mode 100644 index 000000000..6c5473f5d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/contains.js @@ -0,0 +1,95 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params: { min, max } }) => max === undefined + ? (0, codegen_1.str) `must contain at least ${min} valid item(s)` + : (0, codegen_1.str) `must contain at least ${min} and no more than ${max} valid item(s)`, + params: ({ params: { min, max } }) => max === undefined ? (0, codegen_1._) `{minContains: ${min}}` : (0, codegen_1._) `{minContains: ${min}, maxContains: ${max}}`, +}; +const def = { + keyword: "contains", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + trackErrors: true, + error, + code(cxt) { + const { gen, schema, parentSchema, data, it } = cxt; + let min; + let max; + const { minContains, maxContains } = parentSchema; + if (it.opts.next) { + min = minContains === undefined ? 1 : minContains; + max = maxContains; + } + else { + min = 1; + } + const len = gen.const("len", (0, codegen_1._) `${data}.length`); + cxt.setParams({ min, max }); + if (max === undefined && min === 0) { + (0, util_1.checkStrictMode)(it, `"minContains" == 0 without "maxContains": "contains" keyword ignored`); + return; + } + if (max !== undefined && min > max) { + (0, util_1.checkStrictMode)(it, `"minContains" > "maxContains" is always invalid`); + cxt.fail(); + return; + } + if ((0, util_1.alwaysValidSchema)(it, schema)) { + let cond = (0, codegen_1._) `${len} >= ${min}`; + if (max !== undefined) + cond = (0, codegen_1._) `${cond} && ${len} <= ${max}`; + cxt.pass(cond); + return; + } + it.items = true; + const valid = gen.name("valid"); + if (max === undefined && min === 1) { + validateItems(valid, () => gen.if(valid, () => gen.break())); + } + else if (min === 0) { + gen.let(valid, true); + if (max !== undefined) + gen.if((0, codegen_1._) `${data}.length > 0`, validateItemsWithCount); + } + else { + gen.let(valid, false); + validateItemsWithCount(); + } + cxt.result(valid, () => cxt.reset()); + function validateItemsWithCount() { + const schValid = gen.name("_valid"); + const count = gen.let("count", 0); + validateItems(schValid, () => gen.if(schValid, () => checkLimits(count))); + } + function validateItems(_valid, block) { + gen.forRange("i", 0, len, (i) => { + cxt.subschema({ + keyword: "contains", + dataProp: i, + dataPropType: util_1.Type.Num, + compositeRule: true, + }, _valid); + block(); + }); + } + function checkLimits(count) { + gen.code((0, codegen_1._) `${count}++`); + if (max === undefined) { + gen.if((0, codegen_1._) `${count} >= ${min}`, () => gen.assign(valid, true).break()); + } + else { + gen.if((0, codegen_1._) `${count} > ${max}`, () => gen.assign(valid, false).break()); + if (min === 1) + gen.assign(valid, true); + else + gen.if((0, codegen_1._) `${count} >= ${min}`, () => gen.assign(valid, true)); + } + } + }, +}; +exports.default = def; +//# sourceMappingURL=contains.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/contains.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/contains.js.map new file mode 100644 index 000000000..6a0bd39cb --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/contains.js.map @@ -0,0 +1 @@ +{"version":3,"file":"contains.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/contains.ts"],"names":[],"mappings":";;AAOA,mDAAkD;AAClD,6CAA2E;AAQ3E,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,GAAG,EAAC,EAAC,EAAE,EAAE,CAChC,GAAG,KAAK,SAAS;QACf,CAAC,CAAC,IAAA,aAAG,EAAA,yBAAyB,GAAG,gBAAgB;QACjD,CAAC,CAAC,IAAA,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,IAAI,GAAG,KAAK,CAAC;oBAAE,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;;oBACjC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,OAAO,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;aAClE;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts new file mode 100644 index 000000000..b28cfe421 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts @@ -0,0 +1,21 @@ +import type { CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition, SchemaMap, AnySchema } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +export declare type PropertyDependencies = { + [K in string]?: string[]; +}; +export interface DependenciesErrorParams { + property: string; + missingProperty: string; + depsCount: number; + deps: string; +} +export declare type DependenciesError = ErrorObject<"dependencies", DependenciesErrorParams, { + [K in string]?: string[] | AnySchema; +}>; +export declare const error: KeywordErrorDefinition; +declare const def: CodeKeywordDefinition; +export declare function validatePropertyDeps(cxt: KeywordCxt, propertyDeps?: { + [K in string]?: string[]; +}): void; +export declare function validateSchemaDeps(cxt: KeywordCxt, schemaDeps?: SchemaMap): void; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependencies.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependencies.js new file mode 100644 index 000000000..e81f86d1d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependencies.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0; +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const code_1 = require("../code"); +exports.error = { + message: ({ params: { property, depsCount, deps } }) => { + const property_ies = depsCount === 1 ? "property" : "properties"; + return (0, codegen_1.str) `must have ${property_ies} ${deps} when property ${property} is present`; + }, + params: ({ params: { property, depsCount, deps, missingProperty } }) => (0, codegen_1._) `{property: ${property}, + missingProperty: ${missingProperty}, + depsCount: ${depsCount}, + deps: ${deps}}`, // TODO change to reference +}; +const def = { + keyword: "dependencies", + type: "object", + schemaType: "object", + error: exports.error, + code(cxt) { + const [propDeps, schDeps] = splitDependencies(cxt); + validatePropertyDeps(cxt, propDeps); + validateSchemaDeps(cxt, schDeps); + }, +}; +function splitDependencies({ schema }) { + const propertyDeps = {}; + const schemaDeps = {}; + for (const key in schema) { + if (key === "__proto__") + continue; + const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps; + deps[key] = schema[key]; + } + return [propertyDeps, schemaDeps]; +} +function validatePropertyDeps(cxt, propertyDeps = cxt.schema) { + const { gen, data, it } = cxt; + if (Object.keys(propertyDeps).length === 0) + return; + const missing = gen.let("missing"); + for (const prop in propertyDeps) { + const deps = propertyDeps[prop]; + if (deps.length === 0) + continue; + const hasProperty = (0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties); + cxt.setParams({ + property: prop, + depsCount: deps.length, + deps: deps.join(", "), + }); + if (it.allErrors) { + gen.if(hasProperty, () => { + for (const depProp of deps) { + (0, code_1.checkReportMissingProp)(cxt, depProp); + } + }); + } + else { + gen.if((0, codegen_1._) `${hasProperty} && (${(0, code_1.checkMissingProp)(cxt, deps, missing)})`); + (0, code_1.reportMissingProp)(cxt, missing); + gen.else(); + } + } +} +exports.validatePropertyDeps = validatePropertyDeps; +function validateSchemaDeps(cxt, schemaDeps = cxt.schema) { + const { gen, data, keyword, it } = cxt; + const valid = gen.name("valid"); + for (const prop in schemaDeps) { + if ((0, util_1.alwaysValidSchema)(it, schemaDeps[prop])) + continue; + gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties), () => { + const schCxt = cxt.subschema({ keyword, schemaProp: prop }, valid); + cxt.mergeValidEvaluated(schCxt, valid); + }, () => gen.var(valid, true) // TODO var + ); + cxt.ok(valid); + } +} +exports.validateSchemaDeps = validateSchemaDeps; +exports.default = def; +//# sourceMappingURL=dependencies.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map new file mode 100644 index 000000000..dafffd16b --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/dependencies.ts"],"names":[],"mappings":";;;AAQA,mDAA4C;AAC5C,6CAAoD;AACpD,kCAAmG;AAmBtF,QAAA,KAAK,GAA2B;IAC3C,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAC,EAAC,EAAE,EAAE;QACjD,MAAM,YAAY,GAAG,SAAS,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,CAAA;QAChE,OAAO,IAAA,aAAG,EAAA,aAAa,YAAY,IAAI,IAAI,kBAAkB,QAAQ,aAAa,CAAA;IACpF,CAAC;IACD,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAC,EAAC,EAAE,EAAE,CACjE,IAAA,WAAC,EAAA,cAAc,QAAQ;uBACJ,eAAe;iBACrB,SAAS;YACd,IAAI,GAAG,EAAE,2BAA2B;CAC/C,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,cAAc;IACvB,IAAI,EAAE,QAAQ;IAC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,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;YAChE,GAAG,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACxC,CAAC,EACD,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,WAAW;SACvC,CAAA;QACD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;KACd;AACH,CAAC;AAfD,gDAeC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js new file mode 100644 index 000000000..66ef2e843 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dependencies_1 = require("./dependencies"); +const def = { + keyword: "dependentSchemas", + type: "object", + schemaType: "object", + code: (cxt) => (0, dependencies_1.validateSchemaDeps)(cxt), +}; +exports.default = def; +//# sourceMappingURL=dependentSchemas.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map new file mode 100644 index 000000000..17712e6fb --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dependentSchemas.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/dependentSchemas.ts"],"names":[],"mappings":";;AACA,iDAAiD;AAEjD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,iCAAkB,EAAC,GAAG,CAAC;CACvC,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/if.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/if.d.ts new file mode 100644 index 000000000..3c3e78dd6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/if.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export declare type IfKeywordError = ErrorObject<"if", { + failingKeyword: string; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/if.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/if.js new file mode 100644 index 000000000..2c42a3e9c --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/if.js @@ -0,0 +1,66 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params }) => (0, codegen_1.str) `must match "${params.ifClause}" schema`, + params: ({ params }) => (0, codegen_1._) `{failingKeyword: ${params.ifClause}}`, +}; +const def = { + keyword: "if", + schemaType: ["object", "boolean"], + trackErrors: true, + error, + code(cxt) { + const { gen, parentSchema, it } = cxt; + if (parentSchema.then === undefined && parentSchema.else === undefined) { + (0, util_1.checkStrictMode)(it, '"if" without "then" and "else" is ignored'); + } + const hasThen = hasSchema(it, "then"); + const hasElse = hasSchema(it, "else"); + if (!hasThen && !hasElse) + return; + const valid = gen.let("valid", true); + const schValid = gen.name("_valid"); + validateIf(); + cxt.reset(); + if (hasThen && hasElse) { + const ifClause = gen.let("ifClause"); + cxt.setParams({ ifClause }); + gen.if(schValid, validateClause("then", ifClause), validateClause("else", ifClause)); + } + else if (hasThen) { + gen.if(schValid, validateClause("then")); + } + else { + gen.if((0, codegen_1.not)(schValid), validateClause("else")); + } + cxt.pass(valid, () => cxt.error(true)); + function validateIf() { + const schCxt = cxt.subschema({ + keyword: "if", + compositeRule: true, + createErrors: false, + allErrors: false, + }, schValid); + cxt.mergeEvaluated(schCxt); + } + function validateClause(keyword, ifClause) { + return () => { + const schCxt = cxt.subschema({ keyword }, schValid); + gen.assign(valid, schValid); + cxt.mergeValidEvaluated(schCxt, valid); + if (ifClause) + gen.assign(ifClause, (0, codegen_1._) `${keyword}`); + else + cxt.setParams({ ifClause: keyword }); + }; + } + }, +}; +function hasSchema(it, keyword) { + const schema = it.schema[keyword]; + return schema !== undefined && !(0, util_1.alwaysValidSchema)(it, schema); +} +exports.default = def; +//# sourceMappingURL=if.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/if.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/if.js.map new file mode 100644 index 000000000..34b3a5539 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/if.js.map @@ -0,0 +1 @@ +{"version":3,"file":"if.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/if.ts"],"names":[],"mappings":";;AAQA,mDAAuD;AACvD,6CAAqE;AAIrE,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAA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AA;IACjC,OAAO,MAAM,KAAK,SAAS,IAAI,CAAC,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,CAAA;AAC/D,CAAC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/index.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/index.d.ts new file mode 100644 index 000000000..f45239bd5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/index.d.ts @@ -0,0 +1,13 @@ +import type { ErrorNoParams, Vocabulary } from "../../types"; +import { AdditionalItemsError } from "./additionalItems"; +import { ItemsError } from "./items2020"; +import { ContainsError } from "./contains"; +import { DependenciesError } from "./dependencies"; +import { PropertyNamesError } from "./propertyNames"; +import { AdditionalPropertiesError } from "./additionalProperties"; +import { NotKeywordError } from "./not"; +import { AnyOfError } from "./anyOf"; +import { OneOfError } from "./oneOf"; +import { IfKeywordError } from "./if"; +export default function getApplicator(draft2020?: boolean): Vocabulary; +export declare type ApplicatorKeywordError = ErrorNoParams<"false schema"> | AdditionalItemsError | ItemsError | ContainsError | AdditionalPropertiesError | DependenciesError | IfKeywordError | AnyOfError | OneOfError | NotKeywordError | PropertyNamesError; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/index.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/index.js new file mode 100644 index 000000000..cf592f279 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/index.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const additionalItems_1 = require("./additionalItems"); +const prefixItems_1 = require("./prefixItems"); +const items_1 = require("./items"); +const items2020_1 = require("./items2020"); +const contains_1 = require("./contains"); +const dependencies_1 = require("./dependencies"); +const propertyNames_1 = require("./propertyNames"); +const additionalProperties_1 = require("./additionalProperties"); +const properties_1 = require("./properties"); +const patternProperties_1 = require("./patternProperties"); +const not_1 = require("./not"); +const anyOf_1 = require("./anyOf"); +const oneOf_1 = require("./oneOf"); +const allOf_1 = require("./allOf"); +const if_1 = require("./if"); +const thenElse_1 = require("./thenElse"); +function getApplicator(draft2020 = false) { + const applicator = [ + // any + not_1.default, + anyOf_1.default, + oneOf_1.default, + allOf_1.default, + if_1.default, + thenElse_1.default, + // object + propertyNames_1.default, + additionalProperties_1.default, + dependencies_1.default, + properties_1.default, + patternProperties_1.default, + ]; + // array + if (draft2020) + applicator.push(prefixItems_1.default, items2020_1.default); + else + applicator.push(additionalItems_1.default, items_1.default); + applicator.push(contains_1.default); + return applicator; +} +exports.default = getApplicator; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/index.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/index.js.map new file mode 100644 index 000000000..ebcb8534d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/index.ts"],"names":[],"mappings":";;AACA,uDAAuE;AACvE,+CAAuC;AACvC,mCAA2B;AAC3B,2CAAiD;AACjD,yCAAkD;AAClD,iDAA8D;AAC9D,mDAAiE;AACjE,iEAAsF;AACtF,6CAAqC;AACrC,2DAAmD;AACnD,+BAAiD;AACjD,mCAAyC;AACzC,mCAAyC;AACzC,mCAA2B;AAC3B,6BAA8C;AAC9C,yCAAiC;AAEjC,SAAwB,aAAa,CAAC,SAAS,GAAG,KAAK;IACrD,MAAM,UAAU,GAAG;QACjB,MAAM;QACN,aAAU;QACV,eAAK;QACL,eAAK;QACL,eAAK;QACL,YAAS;QACT,kBAAQ;QACR,SAAS;QACT,uBAAa;QACb,8BAAoB;QACpB,sBAAY;QACZ,oBAAU;QACV,2BAAiB;KAClB,CAAA;IACD,QAAQ;IACR,IAAI,SAAS;QAAE,UAAU,CAAC,IAAI,CAAC,qBAAW,EAAE,mBAAS,CAAC,CAAA;;QACjD,UAAU,CAAC,IAAI,CAAC,yBAAe,EAAE,eAAK,CAAC,CAAA;IAC5C,UAAU,CAAC,IAAI,CAAC,kBAAQ,CAAC,CAAA;IACzB,OAAO,UAAU,CAAA;AACnB,CAAC;AArBD,gCAqBC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items.d.ts new file mode 100644 index 000000000..8e608ca9c --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition, AnySchema } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +declare const def: CodeKeywordDefinition; +export declare function validateTuple(cxt: KeywordCxt, extraItems: string, schArr?: AnySchema[]): void; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items.js new file mode 100644 index 000000000..26f527bc6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateTuple = void 0; +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const code_1 = require("../code"); +const def = { + keyword: "items", + type: "array", + schemaType: ["object", "array", "boolean"], + before: "uniqueItems", + code(cxt) { + const { schema, it } = cxt; + if (Array.isArray(schema)) + return validateTuple(cxt, "additionalItems", schema); + it.items = true; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + cxt.ok((0, code_1.validateArray)(cxt)); + }, +}; +function validateTuple(cxt, extraItems, schArr = cxt.schema) { + const { gen, parentSchema, data, keyword, it } = cxt; + checkStrictTuple(parentSchema); + if (it.opts.unevaluated && schArr.length && it.items !== true) { + it.items = util_1.mergeEvaluated.items(gen, schArr.length, it.items); + } + const valid = gen.name("valid"); + const len = gen.const("len", (0, codegen_1._) `${data}.length`); + schArr.forEach((sch, i) => { + if ((0, util_1.alwaysValidSchema)(it, sch)) + return; + gen.if((0, codegen_1._) `${len} > ${i}`, () => cxt.subschema({ + keyword, + schemaProp: i, + dataProp: i, + }, valid)); + cxt.ok(valid); + }); + function checkStrictTuple(sch) { + const { opts, errSchemaPath } = it; + const l = schArr.length; + const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false); + if (opts.strictTuples && !fullTuple) { + const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"`; + (0, util_1.checkStrictMode)(it, msg, opts.strictTuples); + } + } +} +exports.validateTuple = validateTuple; +exports.default = def; +//# sourceMappingURL=items.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items.js.map new file mode 100644 index 000000000..3c4ce614c --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items.js.map @@ -0,0 +1 @@ +{"version":3,"file":"items.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/items.ts"],"names":[],"mappings":";;;AAEA,mDAAuC;AACvC,6CAAqF;AACrF,kCAAqC;AAErC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;IAC1C,MAAM,EAAE,aAAa;IACrB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACxB,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,OAAO,aAAa,CAAC,GAAG,EAAE,iBAAiB,EAAE,MAA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AK,CAAC,CAAA;IACf,CAAC,CAAC,CAAA;IAEF,SAAS,gBAAgB,CAAC,GAAoB;QAC5C,MAAM,EAAC,IAAI,EAAE,aAAa,EAAC,GAAG,EAAE,CAAA;QAChC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAA;QACvB,MAAM,SAAS,GAAG,CAAC,KAAK,GAAG,CAAC,QAAQ,IAAI,CAAC,CAAC,KAAK,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,UAAU,CAAC,KAAK,KAAK,CAAC,CAAA;QACzF,IAAI,IAAI,CAAC,YAAY,IAAI,CAAC,SAAS,EAAE;YACnC,MAAM,GAAG,GAAG,IAAI,OAAO,QAAQ,CAAC,oCAAoC,UAAU,4CAA4C,aAAa,GAAG,CAAA;YAC1I,IAAA,sBAAe,EAAC,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,CAAA;SAC5C;IACH,CAAC;AACH,CAAC;AApCD,sCAoCC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts new file mode 100644 index 000000000..4168c7f96 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export declare type ItemsError = ErrorObject<"items", { + limit: number; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items2020.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items2020.js new file mode 100644 index 000000000..f2387d7d2 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items2020.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const code_1 = require("../code"); +const additionalItems_1 = require("./additionalItems"); +const error = { + message: ({ params: { len } }) => (0, codegen_1.str) `must NOT have more than ${len} items`, + params: ({ params: { len } }) => (0, codegen_1._) `{limit: ${len}}`, +}; +const def = { + keyword: "items", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + error, + code(cxt) { + const { schema, parentSchema, it } = cxt; + const { prefixItems } = parentSchema; + it.items = true; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + if (prefixItems) + (0, additionalItems_1.validateAdditionalItems)(cxt, prefixItems); + else + cxt.ok((0, code_1.validateArray)(cxt)); + }, +}; +exports.default = def; +//# sourceMappingURL=items2020.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map new file mode 100644 index 000000000..5034acda6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map @@ -0,0 +1 @@ +{"version":3,"file":"items2020.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/items2020.ts"],"names":[],"mappings":";;AAOA,mDAA4C;AAC5C,6CAAoD;AACpD,kCAAqC;AACrC,uDAAyD;AAIzD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,2BAA2B,GAAG,QAAQ;IACvE,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,GAAG,GAAG;CAChD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,MAAM,EAAE,aAAa;IACrB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,MAAM,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACtC,MAAM,EAAC,WAAW,EAAC,GAAG,YAAY,CAAA;QAClC,EAAE,CAAC,KAAK,GAAG,IAAI,CAAA;QACf,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,IAAI,WAAW;YAAE,IAAA,yCAAuB,EAAC,GAAG,EAAE,WAAW,CAAC,CAAA;;YACrD,GAAG,CAAC,EAAE,CAAC,IAAA,oBAAa,EAAC,GAAG,CAAC,CAAC,CAAA;IACjC,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/not.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/not.d.ts new file mode 100644 index 000000000..b8c37cab6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/not.d.ts @@ -0,0 +1,4 @@ +import type { CodeKeywordDefinition, ErrorNoParams, AnySchema } from "../../types"; +export declare type NotKeywordError = ErrorNoParams<"not", AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/not.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/not.js new file mode 100644 index 000000000..89f6fddac --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/not.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const def = { + keyword: "not", + schemaType: ["object", "boolean"], + trackErrors: true, + code(cxt) { + const { gen, schema, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) { + cxt.fail(); + return; + } + const valid = gen.name("valid"); + cxt.subschema({ + keyword: "not", + compositeRule: true, + createErrors: false, + allErrors: false, + }, valid); + cxt.failResult(valid, () => cxt.reset(), () => cxt.error()); + }, + error: { message: "must NOT be valid" }, +}; +exports.default = def; +//# sourceMappingURL=not.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/not.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/not.js.map new file mode 100644 index 000000000..5e2a1ca11 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/not.js.map @@ -0,0 +1 @@ +{"version":3,"file":"not.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/not.ts"],"names":[],"mappings":";;AAEA,6CAAoD;AAIpD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,WAAW,EAAE,IAAI;IACjB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC7B,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,EAAE;YACjC,GAAG,CAAC,IAAI,EAAE,CAAA;YACV,OAAM;SACP;QAED,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,GAAG,CAAC,SAAS,CACX;YACE,OAAO,EAAE,KAAK;YACd,aAAa,EAAE,IAAI;YACnB,YAAY,EAAE,KAAK;YACnB,SAAS,EAAE,KAAK;SACjB,EACD,KAAK,CACN,CAAA;QAED,GAAG,CAAC,UAAU,CACZ,KAAK,EACL,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,EACjB,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAClB,CAAA;IACH,CAAC;IACD,KAAK,EAAE,EAAC,OAAO,EAAE,mBAAmB,EAAC;CACtC,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts new file mode 100644 index 000000000..01df87ab4 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export declare type OneOfError = ErrorObject<"oneOf", { + passingSchemas: [number, number] | null; +}, AnySchema[]>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/oneOf.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/oneOf.js new file mode 100644 index 000000000..441db2ac0 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/oneOf.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: "must match exactly one schema in oneOf", + params: ({ params }) => (0, codegen_1._) `{passingSchemas: ${params.passing}}`, +}; +const def = { + keyword: "oneOf", + schemaType: "array", + trackErrors: true, + error, + code(cxt) { + const { gen, schema, parentSchema, it } = cxt; + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + if (it.opts.discriminator && parentSchema.discriminator) + return; + const schArr = schema; + const valid = gen.let("valid", false); + const passing = gen.let("passing", null); + const schValid = gen.name("_valid"); + cxt.setParams({ passing }); + // TODO possibly fail straight away (with warning or exception) if there are two empty always valid schemas + gen.block(validateOneOf); + cxt.result(valid, () => cxt.reset(), () => cxt.error(true)); + function validateOneOf() { + schArr.forEach((sch, i) => { + let schCxt; + if ((0, util_1.alwaysValidSchema)(it, sch)) { + gen.var(schValid, true); + } + else { + schCxt = cxt.subschema({ + keyword: "oneOf", + schemaProp: i, + compositeRule: true, + }, schValid); + } + if (i > 0) { + gen + .if((0, codegen_1._) `${schValid} && ${valid}`) + .assign(valid, false) + .assign(passing, (0, codegen_1._) `[${passing}, ${i}]`) + .else(); + } + gen.if(schValid, () => { + gen.assign(valid, true); + gen.assign(passing, i); + if (schCxt) + cxt.mergeEvaluated(schCxt, codegen_1.Name); + }); + }); + } + }, +}; +exports.default = def; +//# sourceMappingURL=oneOf.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map new file mode 100644 index 000000000..6cc54de65 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"oneOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/oneOf.ts"],"names":[],"mappings":";;AAOA,mDAA6C;AAC7C,6CAAoD;AASpD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,wCAAwC;IACjD,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,oBAAoB,MAAM,CAAC,OAAO,GAAG;CAC7D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,IAAI;IACjB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC3C,wBAAwB;QACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QACvE,IAAI,EAAE,CAAC,IAAI,CAAC,aAAa,IAAI,YAAY,CAAC,aAAa;YAAE,OAAM;QAC/D,MAAM,MAAM,GAAgB,MAAM,CAAA;Q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GAAG,EAAE;oBACpB,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;oBACvB,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;oBACtB,IAAI,MAAM;wBAAE,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,cAAI,CAAC,CAAA;gBAC9C,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js new file mode 100644 index 000000000..48501c6e3 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js @@ -0,0 +1,75 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const util_2 = require("../../compile/util"); +const def = { + keyword: "patternProperties", + type: "object", + schemaType: "object", + code(cxt) { + const { gen, schema, data, parentSchema, it } = cxt; + const { opts } = it; + const patterns = (0, code_1.allSchemaProperties)(schema); + const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it, schema[p])); + if (patterns.length === 0 || + (alwaysValidPatterns.length === patterns.length && + (!it.opts.unevaluated || it.props === true))) { + return; + } + const checkProperties = opts.strictSchema && !opts.allowMatchingProperties && parentSchema.properties; + const valid = gen.name("valid"); + if (it.props !== true && !(it.props instanceof codegen_1.Name)) { + it.props = (0, util_2.evaluatedPropsToName)(gen, it.props); + } + const { props } = it; + validatePatternProperties(); + function validatePatternProperties() { + for (const pat of patterns) { + if (checkProperties) + checkMatchingProperties(pat); + if (it.allErrors) { + validateProperties(pat); + } + else { + gen.var(valid, true); // TODO var + validateProperties(pat); + gen.if(valid); + } + } + } + function checkMatchingProperties(pat) { + for (const prop in checkProperties) { + if (new RegExp(pat).test(prop)) { + (0, util_1.checkStrictMode)(it, `property ${prop} matches pattern ${pat} (use allowMatchingProperties)`); + } + } + } + function validateProperties(pat) { + gen.forIn("key", data, (key) => { + gen.if((0, codegen_1._) `${(0, code_1.usePattern)(cxt, pat)}.test(${key})`, () => { + const alwaysValid = alwaysValidPatterns.includes(pat); + if (!alwaysValid) { + cxt.subschema({ + keyword: "patternProperties", + schemaProp: pat, + dataProp: key, + dataPropType: util_2.Type.Str, + }, valid); + } + if (it.opts.unevaluated && props !== true) { + gen.assign((0, codegen_1._) `${props}[${key}]`, true); + } + else if (!alwaysValid && !it.allErrors) { + // can short-circuit if `unevaluatedProperties` is not supported (opts.next === false) + // or if all properties were evaluated (props === true) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + } + }); + }); + } + }, +}; +exports.default = def; +//# sourceMappingURL=patternProperties.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map new file mode 100644 index 000000000..2a60b74a5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"patternProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/patternProperties.ts"],"names":[],"mappings":";;AAEA,kCAAuD;AACvD,mDAAkD;AAClD,6CAAqE;AACrE,6CAA6D;AAG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A,GAAG,KAAK,IAAI,GAAG,GAAG,EAAE,IAAI,CAAC,CAAA;qBACtC;yBAAM,IAAI,CAAC,WAAW,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE;wBACxC,sFAAsF;wBACtF,uDAAuD;wBACvD,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;qBACtC;gBACH,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js new file mode 100644 index 000000000..727bc23ce --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const items_1 = require("./items"); +const def = { + keyword: "prefixItems", + type: "array", + schemaType: ["array"], + before: "uniqueItems", + code: (cxt) => (0, items_1.validateTuple)(cxt, "items"), +}; +exports.default = def; +//# sourceMappingURL=prefixItems.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map new file mode 100644 index 000000000..deef718e6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map @@ -0,0 +1 @@ +{"version":3,"file":"prefixItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/prefixItems.ts"],"names":[],"mappings":";;AACA,mCAAqC;AAErC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,OAAO,CAAC;IACrB,MAAM,EAAE,aAAa;IACrB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,qBAAa,EAAC,GAAG,EAAE,OAAO,CAAC;CAC3C,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/properties.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/properties.js new file mode 100644 index 000000000..7347358e2 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/properties.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const validate_1 = require("../../compile/validate"); +const code_1 = require("../code"); +const util_1 = require("../../compile/util"); +const additionalProperties_1 = require("./additionalProperties"); +const def = { + keyword: "properties", + type: "object", + schemaType: "object", + code(cxt) { + const { gen, schema, parentSchema, data, it } = cxt; + if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === undefined) { + additionalProperties_1.default.code(new validate_1.KeywordCxt(it, additionalProperties_1.default, "additionalProperties")); + } + const allProps = (0, code_1.allSchemaProperties)(schema); + for (const prop of allProps) { + it.definedProperties.add(prop); + } + if (it.opts.unevaluated && allProps.length && it.props !== true) { + it.props = util_1.mergeEvaluated.props(gen, (0, util_1.toHash)(allProps), it.props); + } + const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p])); + if (properties.length === 0) + return; + const valid = gen.name("valid"); + for (const prop of properties) { + if (hasDefault(prop)) { + applyPropertySchema(prop); + } + else { + gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties)); + applyPropertySchema(prop); + if (!it.allErrors) + gen.else().var(valid, true); + gen.endIf(); + } + cxt.it.definedProperties.add(prop); + cxt.ok(valid); + } + function hasDefault(prop) { + return it.opts.useDefaults && !it.compositeRule && schema[prop].default !== undefined; + } + function applyPropertySchema(prop) { + cxt.subschema({ + keyword: "properties", + schemaProp: prop, + dataProp: prop, + }, valid); + } + }, +}; +exports.default = def; +//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/properties.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/properties.js.map new file mode 100644 index 000000000..27f8148cf --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/properties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/properties.ts"],"names":[],"mappings":";;AACA,qDAAiD;AACjD,kCAA2D;AAC3D,6CAA4E;AAC5E,iEAA0C;AAE1C,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,YAAY;IACrB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACjD,IAAI,EAAE,CAAC,IAAI,CAAC,gBAAgB,KAAK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AG,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;gBAC9C,GAAG,CAAC,KAAK,EAAE,CAAA;aACZ;YACD,GAAG,CAAC,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YAClC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;SACd;QAED,SAAS,UAAU,CAAC,IAAY;YAC9B,OAAO,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,EAAE,CAAC,aAAa,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,SAAS,CAAA;QACvF,CAAC;QAED,SAAS,mBAAmB,CAAC,IAAY;YACvC,GAAG,CAAC,SAAS,CACX;gBACE,OAAO,EAAE,YAAY;gBACrB,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE,IAAI;aACf,EACD,KAAK,CACN,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts new file mode 100644 index 000000000..90f7ad5b2 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export declare type PropertyNamesError = ErrorObject<"propertyNames", { + propertyName: string; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js new file mode 100644 index 000000000..f3871152d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: "property name must be valid", + params: ({ params }) => (0, codegen_1._) `{propertyName: ${params.propertyName}}`, +}; +const def = { + keyword: "propertyNames", + type: "object", + schemaType: ["object", "boolean"], + error, + code(cxt) { + const { gen, schema, data, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + const valid = gen.name("valid"); + gen.forIn("key", data, (key) => { + cxt.setParams({ propertyName: key }); + cxt.subschema({ + keyword: "propertyNames", + data: key, + dataTypes: ["string"], + propertyName: key, + compositeRule: true, + }, valid); + gen.if((0, codegen_1.not)(valid), () => { + cxt.error(true); + if (!it.allErrors) + gen.break(); + }); + }); + cxt.ok(valid); + }, +}; +exports.default = def; +//# sourceMappingURL=propertyNames.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map new file mode 100644 index 000000000..835b2bb13 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map @@ -0,0 +1 @@ +{"version":3,"file":"propertyNames.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/propertyNames.ts"],"names":[],"mappings":";;AAOA,mDAA4C;AAC5C,6CAAoD;AAIpD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,6BAA6B;IACtC,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,kBAAkB,MAAM,CAAC,YAAY,GAAG;CAChE,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,eAAe;IACxB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAE/B,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;YAC7B,GAAG,CAAC,SAAS,CAAC,EAAC,YAAY,EAAE,GAAG,EAAC,CAAC,CAAA;YAClC,GAAG,CAAC,SAAS,CACX;gBACE,OAAO,EAAE,eAAe;gBACxB,IAAI,EAAE,GAAG;gBACT,SAAS,EAAE,CAAC,QAAQ,CAAC;gBACrB,YAAY,EAAE,GAAG;gBACjB,aAAa,EAAE,IAAI;aACpB,EACD,KAAK,CACN,CAAA;YACD,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE;gBACtB,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;gBACf,IAAI,CAAC,EAAE,CAAC,SAAS;oBAAE,GAAG,CAAC,KAAK,EAAE,CAAA;YAChC,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;QAEF,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/thenElse.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/thenElse.js new file mode 100644 index 000000000..1ae639021 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/thenElse.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const def = { + keyword: ["then", "else"], + schemaType: ["object", "boolean"], + code({ keyword, parentSchema, it }) { + if (parentSchema.if === undefined) + (0, util_1.checkStrictMode)(it, `"${keyword}" without "if" is ignored`); + }, +}; +exports.default = def; +//# sourceMappingURL=thenElse.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map new file mode 100644 index 000000000..2629f4fce --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"thenElse.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/thenElse.ts"],"names":[],"mappings":";;AAEA,6CAAkD;AAElD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,IAAI,CAAC,EAAC,OAAO,EAAE,YAAY,EAAE,EAAE,EAAa;QAC1C,IAAI,YAAY,CAAC,EAAE,KAAK,SAAS;YAAE,IAAA,sBAAe,EAAC,EAAE,EAAE,IAAI,OAAO,2BAA2B,CAAC,CAAA;IAChG,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/code.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/code.d.ts new file mode 100644 index 000000000..f914baca5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/code.d.ts @@ -0,0 +1,17 @@ +import type { SchemaMap } from "../types"; +import type { SchemaCxt } from "../compile"; +import type { KeywordCxt } from "../compile/validate"; +import { CodeGen, Code, Name } from "../compile/codegen"; +export declare function checkReportMissingProp(cxt: KeywordCxt, prop: string): void; +export declare function checkMissingProp({ gen, data, it: { opts } }: KeywordCxt, properties: string[], missing: Name): Code; +export declare function reportMissingProp(cxt: KeywordCxt, missing: Name): void; +export declare function hasPropFunc(gen: CodeGen): Name; +export declare function isOwnProperty(gen: CodeGen, data: Name, property: Name | string): Code; +export declare function propertyInData(gen: CodeGen, data: Name, property: Name | string, ownProperties?: boolean): Code; +export declare function noPropertyInData(gen: CodeGen, data: Name, property: Name | string, ownProperties?: boolean): Code; +export declare function allSchemaProperties(schemaMap?: SchemaMap): string[]; +export declare function schemaProperties(it: SchemaCxt, schemaMap: SchemaMap): string[]; +export declare function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }: KeywordCxt, func: Code, context: Code, passSchema?: boolean): Code; +export declare function usePattern({ gen, it: { opts } }: KeywordCxt, pattern: string): Name; +export declare function validateArray(cxt: KeywordCxt): Name; +export declare function validateUnion(cxt: KeywordCxt): void; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/code.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/code.js new file mode 100644 index 000000000..8cb899324 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/code.js @@ -0,0 +1,131 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateUnion = exports.validateArray = exports.usePattern = exports.callValidateCode = exports.schemaProperties = exports.allSchemaProperties = exports.noPropertyInData = exports.propertyInData = exports.isOwnProperty = exports.hasPropFunc = exports.reportMissingProp = exports.checkMissingProp = exports.checkReportMissingProp = void 0; +const codegen_1 = require("../compile/codegen"); +const util_1 = require("../compile/util"); +const names_1 = require("../compile/names"); +const util_2 = require("../compile/util"); +function checkReportMissingProp(cxt, prop) { + const { gen, data, it } = cxt; + gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => { + cxt.setParams({ missingProperty: (0, codegen_1._) `${prop}` }, true); + cxt.error(); + }); +} +exports.checkReportMissingProp = checkReportMissingProp; +function checkMissingProp({ gen, data, it: { opts } }, properties, missing) { + return (0, codegen_1.or)(...properties.map((prop) => (0, codegen_1.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1._) `${missing} = ${prop}`))); +} +exports.checkMissingProp = checkMissingProp; +function reportMissingProp(cxt, missing) { + cxt.setParams({ missingProperty: missing }, true); + cxt.error(); +} +exports.reportMissingProp = reportMissingProp; +function hasPropFunc(gen) { + return gen.scopeValue("func", { + // eslint-disable-next-line @typescript-eslint/unbound-method + ref: Object.prototype.hasOwnProperty, + code: (0, codegen_1._) `Object.prototype.hasOwnProperty`, + }); +} +exports.hasPropFunc = hasPropFunc; +function isOwnProperty(gen, data, property) { + return (0, codegen_1._) `${hasPropFunc(gen)}.call(${data}, ${property})`; +} +exports.isOwnProperty = isOwnProperty; +function propertyInData(gen, data, property, ownProperties) { + const cond = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(property)} !== undefined`; + return ownProperties ? (0, codegen_1._) `${cond} && ${isOwnProperty(gen, data, property)}` : cond; +} +exports.propertyInData = propertyInData; +function noPropertyInData(gen, data, property, ownProperties) { + const cond = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(property)} === undefined`; + return ownProperties ? (0, codegen_1.or)(cond, (0, codegen_1.not)(isOwnProperty(gen, data, property))) : cond; +} +exports.noPropertyInData = noPropertyInData; +function allSchemaProperties(schemaMap) { + return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : []; +} +exports.allSchemaProperties = allSchemaProperties; +function schemaProperties(it, schemaMap) { + return allSchemaProperties(schemaMap).filter((p) => !(0, util_1.alwaysValidSchema)(it, schemaMap[p])); +} +exports.schemaProperties = schemaProperties; +function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) { + const dataAndSchema = passSchema ? (0, codegen_1._) `${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data; + const valCxt = [ + [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, errorPath)], + [names_1.default.parentData, it.parentData], + [names_1.default.parentDataProperty, it.parentDataProperty], + [names_1.default.rootData, names_1.default.rootData], + ]; + if (it.opts.dynamicRef) + valCxt.push([names_1.default.dynamicAnchors, names_1.default.dynamicAnchors]); + const args = (0, codegen_1._) `${dataAndSchema}, ${gen.object(...valCxt)}`; + return context !== codegen_1.nil ? (0, codegen_1._) `${func}.call(${context}, ${args})` : (0, codegen_1._) `${func}(${args})`; +} +exports.callValidateCode = callValidateCode; +const newRegExp = (0, codegen_1._) `new RegExp`; +function usePattern({ gen, it: { opts } }, pattern) { + const u = opts.unicodeRegExp ? "u" : ""; + const { regExp } = opts.code; + const rx = regExp(pattern, u); + return gen.scopeValue("pattern", { + key: rx.toString(), + ref: rx, + code: (0, codegen_1._) `${regExp.code === "new RegExp" ? newRegExp : (0, util_2.useFunc)(gen, regExp)}(${pattern}, ${u})`, + }); +} +exports.usePattern = usePattern; +function validateArray(cxt) { + const { gen, data, keyword, it } = cxt; + const valid = gen.name("valid"); + if (it.allErrors) { + const validArr = gen.let("valid", true); + validateItems(() => gen.assign(validArr, false)); + return validArr; + } + gen.var(valid, true); + validateItems(() => gen.break()); + return valid; + function validateItems(notValid) { + const len = gen.const("len", (0, codegen_1._) `${data}.length`); + gen.forRange("i", 0, len, (i) => { + cxt.subschema({ + keyword, + dataProp: i, + dataPropType: util_1.Type.Num, + }, valid); + gen.if((0, codegen_1.not)(valid), notValid); + }); + } +} +exports.validateArray = validateArray; +function validateUnion(cxt) { + const { gen, schema, keyword, it } = cxt; + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + const alwaysValid = schema.some((sch) => (0, util_1.alwaysValidSchema)(it, sch)); + if (alwaysValid && !it.opts.unevaluated) + return; + const valid = gen.let("valid", false); + const schValid = gen.name("_valid"); + gen.block(() => schema.forEach((_sch, i) => { + const schCxt = cxt.subschema({ + keyword, + schemaProp: i, + compositeRule: true, + }, schValid); + gen.assign(valid, (0, codegen_1._) `${valid} || ${schValid}`); + const merged = cxt.mergeValidEvaluated(schCxt, schValid); + // can short-circuit if `unevaluatedProperties/Items` not supported (opts.unevaluated !== true) + // or if all properties and items were evaluated (it.props === true && it.items === true) + if (!merged) + gen.if((0, codegen_1.not)(valid)); + })); + cxt.result(valid, () => cxt.reset(), () => cxt.error(true)); +} +exports.validateUnion = validateUnion; +//# sourceMappingURL=code.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/code.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/code.js.map new file mode 100644 index 000000000..62d7ee121 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/code.js.map @@ -0,0 +1 @@ +{"version":3,"file":"code.js","sourceRoot":"","sources":["../../lib/vocabularies/code.ts"],"names":[],"mappings":";;;AAGA,gDAAoG;AACpG,0CAAuD;AACvD,4CAAgC;AAChC,0CAAuC;AACvC,SAAgB,sBAAsB,CAAC,GAAe,EAAE,IAAY;IAClE,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAC3B,GAAG,CAAC,EAAE,CAAC,gBAAgB,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,EAAE,GAAG,EAAE;QACpE,GAAG,CAAC,SAAS,CAAC,EAAC,eAAe,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,EAAE,EAAC,EAAE,IAAI,CAAC,CAAA;QAClD,GAAG,CAAC,KAAK,EAAE,CAAA;IACb,CAAC,CAAC,CAAA;AACJ,CAAC;AAND,wDAMC;AAED,SAAgB,gBAAgB,CAC9B,EAAC,GAAG,EAAE,IA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,MAAM;YAAE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,CAAC,CAAA;IACjC,CAAC,CAAC,CACH,CAAA;IAED,GAAG,CAAC,MAAM,CACR,KAAK,EACL,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,EACjB,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CACtB,CAAA;AACH,CAAC;AAjCD,sCAiCC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/id.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/id.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/id.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/id.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/id.js new file mode 100644 index 000000000..313598aab --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/id.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const def = { + keyword: "id", + code() { + throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID'); + }, +}; +exports.default = def; +//# sourceMappingURL=id.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/id.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/id.js.map new file mode 100644 index 000000000..4eb27eb33 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/id.js.map @@ -0,0 +1 @@ +{"version":3,"file":"id.js","sourceRoot":"","sources":["../../../lib/vocabularies/core/id.ts"],"names":[],"mappings":";;AAEA,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,IAAI;IACb,IAAI;QACF,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACzE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/index.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/index.d.ts new file mode 100644 index 000000000..f2e34ee36 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/index.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../../types"; +declare const core: Vocabulary; +export default core; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/index.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/index.js new file mode 100644 index 000000000..87656d743 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/index.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const id_1 = require("./id"); +const ref_1 = require("./ref"); +const core = [ + "$schema", + "$id", + "$defs", + "$vocabulary", + { keyword: "$comment" }, + "definitions", + id_1.default, + ref_1.default, +]; +exports.default = core; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/index.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/index.js.map new file mode 100644 index 000000000..5bf65f941 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/core/index.ts"],"names":[],"mappings":";;AACA,6BAA4B;AAC5B,+BAA8B;AAE9B,MAAM,IAAI,GAAe;IACvB,SAAS;IACT,KAAK;IACL,OAAO;IACP,aAAa;IACb,EAAC,OAAO,EAAE,UAAU,EAAC;IACrB,aAAa;IACb,YAAS;IACT,aAAU;CACX,CAAA;AAED,kBAAe,IAAI,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/ref.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/ref.d.ts new file mode 100644 index 000000000..6a0967d15 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/ref.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +import { Code } from "../../compile/codegen"; +import { SchemaEnv } from "../../compile"; +declare const def: CodeKeywordDefinition; +export declare function getValidate(cxt: KeywordCxt, sch: SchemaEnv): Code; +export declare function callRef(cxt: KeywordCxt, v: Code, sch?: SchemaEnv, $async?: boolean): void; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/ref.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/ref.js new file mode 100644 index 000000000..bac1ae853 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/ref.js @@ -0,0 +1,122 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.callRef = exports.getValidate = void 0; +const ref_error_1 = require("../../compile/ref_error"); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const names_1 = require("../../compile/names"); +const compile_1 = require("../../compile"); +const util_1 = require("../../compile/util"); +const def = { + keyword: "$ref", + schemaType: "string", + code(cxt) { + const { gen, schema: $ref, it } = cxt; + const { baseId, schemaEnv: env, validateName, opts, self } = it; + const { root } = env; + if (($ref === "#" || $ref === "#/") && baseId === root.baseId) + return callRootRef(); + const schOrEnv = compile_1.resolveRef.call(self, root, baseId, $ref); + if (schOrEnv === undefined) + throw new ref_error_1.default(it.opts.uriResolver, baseId, $ref); + if (schOrEnv instanceof compile_1.SchemaEnv) + return callValidate(schOrEnv); + return inlineRefSchema(schOrEnv); + function callRootRef() { + if (env === root) + return callRef(cxt, validateName, env, env.$async); + const rootName = gen.scopeValue("root", { ref: root }); + return callRef(cxt, (0, codegen_1._) `${rootName}.validate`, root, root.$async); + } + function callValidate(sch) { + const v = getValidate(cxt, sch); + callRef(cxt, v, sch, sch.$async); + } + function inlineRefSchema(sch) { + const schName = gen.scopeValue("schema", opts.code.source === true ? { ref: sch, code: (0, codegen_1.stringify)(sch) } : { ref: sch }); + const valid = gen.name("valid"); + const schCxt = cxt.subschema({ + schema: sch, + dataTypes: [], + schemaPath: codegen_1.nil, + topSchemaRef: schName, + errSchemaPath: $ref, + }, valid); + cxt.mergeEvaluated(schCxt); + cxt.ok(valid); + } + }, +}; +function getValidate(cxt, sch) { + const { gen } = cxt; + return sch.validate + ? gen.scopeValue("validate", { ref: sch.validate }) + : (0, codegen_1._) `${gen.scopeValue("wrapper", { ref: sch })}.validate`; +} +exports.getValidate = getValidate; +function callRef(cxt, v, sch, $async) { + const { gen, it } = cxt; + const { allErrors, schemaEnv: env, opts } = it; + const passCxt = opts.passContext ? names_1.default.this : codegen_1.nil; + if ($async) + callAsyncRef(); + else + callSyncRef(); + function callAsyncRef() { + if (!env.$async) + throw new Error("async schema referenced by sync schema"); + const valid = gen.let("valid"); + gen.try(() => { + gen.code((0, codegen_1._) `await ${(0, code_1.callValidateCode)(cxt, v, passCxt)}`); + addEvaluatedFrom(v); // TODO will not work with async, it has to be returned with the result + if (!allErrors) + gen.assign(valid, true); + }, (e) => { + gen.if((0, codegen_1._) `!(${e} instanceof ${it.ValidationError})`, () => gen.throw(e)); + addErrorsFrom(e); + if (!allErrors) + gen.assign(valid, false); + }); + cxt.ok(valid); + } + function callSyncRef() { + cxt.result((0, code_1.callValidateCode)(cxt, v, passCxt), () => addEvaluatedFrom(v), () => addErrorsFrom(v)); + } + function addErrorsFrom(source) { + const errs = (0, codegen_1._) `${source}.errors`; + gen.assign(names_1.default.vErrors, (0, codegen_1._) `${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`); // TODO tagged + gen.assign(names_1.default.errors, (0, codegen_1._) `${names_1.default.vErrors}.length`); + } + function addEvaluatedFrom(source) { + var _a; + if (!it.opts.unevaluated) + return; + const schEvaluated = (_a = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a === void 0 ? void 0 : _a.evaluated; + // TODO refactor + if (it.props !== true) { + if (schEvaluated && !schEvaluated.dynamicProps) { + if (schEvaluated.props !== undefined) { + it.props = util_1.mergeEvaluated.props(gen, schEvaluated.props, it.props); + } + } + else { + const props = gen.var("props", (0, codegen_1._) `${source}.evaluated.props`); + it.props = util_1.mergeEvaluated.props(gen, props, it.props, codegen_1.Name); + } + } + if (it.items !== true) { + if (schEvaluated && !schEvaluated.dynamicItems) { + if (schEvaluated.items !== undefined) { + it.items = util_1.mergeEvaluated.items(gen, schEvaluated.items, it.items); + } + } + else { + const items = gen.var("items", (0, codegen_1._) `${source}.evaluated.items`); + it.items = util_1.mergeEvaluated.items(gen, items, it.items, codegen_1.Name); + } + } + } +} +exports.callRef = callRef; +exports.default = def; +//# sourceMappingURL=ref.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/ref.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/ref.js.map new file mode 100644 index 000000000..88ac106af --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/core/ref.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ref.js","sourceRoot":"","sources":["../../../lib/vocabularies/core/ref.ts"],"names":[],"mappings":";;;AAEA,uDAAqD;AACrD,kCAAwC;AACxC,mDAAmE;AACnE,+CAAmC;AACnC,2CAAmD;AACnD,6CAAiD;AAEjD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,MAAM,EAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,YAAY,EAAE,I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,YAAY,CAAC,YAAY,EAAE;gBAC9C,IAAI,YAAY,CAAC,KAAK,KAAK,SAAS,EAAE;oBACpC,EAAE,CAAC,KAAK,GAAG,qBAAc,CAAC,KAAK,CAAC,GAAG,EAAE,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAA;iBACnE;aACF;iBAAM;gBACL,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,MAAM,kBAAkB,CAAC,CAAA;gBAC5D,EAAE,CAAC,KAAK,GAAG,qBAAc,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,cAAI,CAAC,CAAA;aAC5D;SACF;IACH,CAAC;AACH,CAAC;AAhED,0BAgEC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts new file mode 100644 index 000000000..656b2da52 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition } from "../../types"; +import { DiscrError, DiscrErrorObj } from "../discriminator/types"; +export declare type DiscriminatorError = DiscrErrorObj | DiscrErrorObj; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.js new file mode 100644 index 000000000..ccdb340b2 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.js @@ -0,0 +1,100 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const types_1 = require("../discriminator/types"); +const compile_1 = require("../../compile"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag + ? `tag "${tagName}" must be string` + : `value of tag "${tagName}" must be in oneOf`, + params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._) `{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`, +}; +const def = { + keyword: "discriminator", + type: "object", + schemaType: "object", + error, + code(cxt) { + const { gen, data, schema, parentSchema, it } = cxt; + const { oneOf } = parentSchema; + if (!it.opts.discriminator) { + throw new Error("discriminator: requires discriminator option"); + } + const tagName = schema.propertyName; + if (typeof tagName != "string") + throw new Error("discriminator: requires propertyName"); + if (schema.mapping) + throw new Error("discriminator: mapping is not supported"); + if (!oneOf) + throw new Error("discriminator: requires oneOf keyword"); + const valid = gen.let("valid", false); + const tag = gen.const("tag", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(tagName)}`); + gen.if((0, codegen_1._) `typeof ${tag} == "string"`, () => validateMapping(), () => cxt.error(false, { discrError: types_1.DiscrError.Tag, tag, tagName })); + cxt.ok(valid); + function validateMapping() { + const mapping = getMapping(); + gen.if(false); + for (const tagValue in mapping) { + gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`); + gen.assign(valid, applyTagSchema(mapping[tagValue])); + } + gen.else(); + cxt.error(false, { discrError: types_1.DiscrError.Mapping, tag, tagName }); + gen.endIf(); + } + function applyTagSchema(schemaProp) { + const _valid = gen.name("valid"); + const schCxt = cxt.subschema({ keyword: "oneOf", schemaProp }, _valid); + cxt.mergeEvaluated(schCxt, codegen_1.Name); + return _valid; + } + function getMapping() { + var _a; + const oneOfMapping = {}; + const topRequired = hasRequired(parentSchema); + let tagRequired = true; + for (let i = 0; i < oneOf.length; i++) { + let sch = oneOf[i]; + if ((sch === null || sch === void 0 ? void 0 : sch.$ref) && !(0, util_1.schemaHasRulesButRef)(sch, it.self.RULES)) { + sch = compile_1.resolveRef.call(it.self, it.schemaEnv.root, it.baseId, sch === null || sch === void 0 ? void 0 : sch.$ref); + if (sch instanceof compile_1.SchemaEnv) + sch = sch.schema; + } + const propSch = (_a = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a === void 0 ? void 0 : _a[tagName]; + if (typeof propSch != "object") { + throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`); + } + tagRequired = tagRequired && (topRequired || hasRequired(sch)); + addMappings(propSch, i); + } + if (!tagRequired) + throw new Error(`discriminator: "${tagName}" must be required`); + return oneOfMapping; + function hasRequired({ required }) { + return Array.isArray(required) && required.includes(tagName); + } + function addMappings(sch, i) { + if (sch.const) { + addMapping(sch.const, i); + } + else if (sch.enum) { + for (const tagValue of sch.enum) { + addMapping(tagValue, i); + } + } + else { + throw new Error(`discriminator: "properties/${tagName}" must have "const" or "enum"`); + } + } + function addMapping(tagValue, i) { + if (typeof tagValue != "string" || tagValue in oneOfMapping) { + throw new Error(`discriminator: "${tagName}" values must be unique strings`); + } + oneOfMapping[tagValue] = i; + } + } + }, +}; +exports.default = def; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.js.map new file mode 100644 index 000000000..8057a4edc --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/discriminator/index.ts"],"names":[],"mappings":";;AAEA,mDAA0D;AAC1D,kDAAgE;AAChE,2CAAmD;AACnD,6CAAuD;AAIvD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,UAAU,EAAE,OAAO,EAAC,EAAC,EAAE,EAAE,CAC3C,UAAU,KAAK,kBAAU,CAAC,GAAG;QAC3B,CAAC,CAAC,QAAQ,OAAO,kBAAkB;QACnC,CAAC,CAAC,iBAAiB,OAAO,oBAAoB;IAClD,MAAM,EAAE,CAAC,EAA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,CAAA;iBACzB;qBAAM,IAAI,GAAG,CAAC,IAAI,EAAE;oBACnB,KAAK,MAAM,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE;wBAC/B,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;qBACxB;iBACF;qBAAM;oBACL,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,+BAA+B,CAAC,CAAA;iBACtF;YACH,CAAC;YAED,SAAS,UAAU,CAAC,QAAiB,EAAE,CAAS;gBAC9C,IAAI,OAAO,QAAQ,IAAI,QAAQ,IAAI,QAAQ,IAAI,YAAY,EAAE;oBAC3D,MAAM,IAAI,KAAK,CAAC,mBAAmB,OAAO,iCAAiC,CAAC,CAAA;iBAC7E;gBACD,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;YAC5B,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts new file mode 100644 index 000000000..6cf5ea51f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts @@ -0,0 +1,10 @@ +import type { ErrorObject } from "../../types"; +export declare enum DiscrError { + Tag = "tag", + Mapping = "mapping" +} +export declare type DiscrErrorObj = ErrorObject<"discriminator", { + error: E; + tag: string; + tagValue: unknown; +}, string>; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/types.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/types.js new file mode 100644 index 000000000..d538f0cee --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/types.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DiscrError = void 0; +var DiscrError; +(function (DiscrError) { + DiscrError["Tag"] = "tag"; + DiscrError["Mapping"] = "mapping"; +})(DiscrError = exports.DiscrError || (exports.DiscrError = {})); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/types.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/types.js.map new file mode 100644 index 000000000..4908a4e9d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/discriminator/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/vocabularies/discriminator/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,iCAAmB,CAAA;AACrB,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft2020.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft2020.d.ts new file mode 100644 index 000000000..d65752c63 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft2020.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../types"; +declare const draft2020Vocabularies: Vocabulary[]; +export default draft2020Vocabularies; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft2020.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft2020.js new file mode 100644 index 000000000..23d244aed --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft2020.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const core_1 = require("./core"); +const validation_1 = require("./validation"); +const applicator_1 = require("./applicator"); +const dynamic_1 = require("./dynamic"); +const next_1 = require("./next"); +const unevaluated_1 = require("./unevaluated"); +const format_1 = require("./format"); +const metadata_1 = require("./metadata"); +const draft2020Vocabularies = [ + dynamic_1.default, + core_1.default, + validation_1.default, + (0, applicator_1.default)(true), + format_1.default, + metadata_1.metadataVocabulary, + metadata_1.contentVocabulary, + next_1.default, + unevaluated_1.default, +]; +exports.default = draft2020Vocabularies; +//# sourceMappingURL=draft2020.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft2020.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft2020.js.map new file mode 100644 index 000000000..ae1a4d833 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft2020.js.map @@ -0,0 +1 @@ +{"version":3,"file":"draft2020.js","sourceRoot":"","sources":["../../lib/vocabularies/draft2020.ts"],"names":[],"mappings":";;AACA,iCAAmC;AACnC,6CAA+C;AAC/C,6CAAkD;AAClD,uCAAyC;AACzC,iCAAmC;AACnC,+CAAiD;AACjD,qCAAuC;AACvC,yCAAgE;AAEhE,MAAM,qBAAqB,GAAiB;IAC1C,iBAAiB;IACjB,cAAc;IACd,oBAAoB;IACpB,IAAA,oBAAuB,EAAC,IAAI,CAAC;IAC7B,gBAAgB;IAChB,6BAAkB;IAClB,4BAAiB;IACjB,cAAc;IACd,qBAAqB;CACtB,CAAA;AAED,kBAAe,qBAAqB,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft7.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft7.d.ts new file mode 100644 index 000000000..469fb8444 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft7.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../types"; +declare const draft7Vocabularies: Vocabulary[]; +export default draft7Vocabularies; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft7.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft7.js new file mode 100644 index 000000000..1e993de0e --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft7.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const core_1 = require("./core"); +const validation_1 = require("./validation"); +const applicator_1 = require("./applicator"); +const format_1 = require("./format"); +const metadata_1 = require("./metadata"); +const draft7Vocabularies = [ + core_1.default, + validation_1.default, + (0, applicator_1.default)(), + format_1.default, + metadata_1.metadataVocabulary, + metadata_1.contentVocabulary, +]; +exports.default = draft7Vocabularies; +//# sourceMappingURL=draft7.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft7.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft7.js.map new file mode 100644 index 000000000..bc7389c67 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/draft7.js.map @@ -0,0 +1 @@ +{"version":3,"file":"draft7.js","sourceRoot":"","sources":["../../lib/vocabularies/draft7.ts"],"names":[],"mappings":";;AACA,iCAAmC;AACnC,6CAA+C;AAC/C,6CAAkD;AAClD,qCAAuC;AACvC,yCAAgE;AAEhE,MAAM,kBAAkB,GAAiB;IACvC,cAAc;IACd,oBAAoB;IACpB,IAAA,oBAAuB,GAAE;IACzB,gBAAgB;IAChB,6BAAkB;IAClB,4BAAiB;CAClB,CAAA;AAED,kBAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts new file mode 100644 index 000000000..562121399 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +declare const def: CodeKeywordDefinition; +export declare function dynamicAnchor(cxt: KeywordCxt, anchor: string): void; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js new file mode 100644 index 000000000..972dc35c4 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.dynamicAnchor = void 0; +const codegen_1 = require("../../compile/codegen"); +const names_1 = require("../../compile/names"); +const compile_1 = require("../../compile"); +const ref_1 = require("../core/ref"); +const def = { + keyword: "$dynamicAnchor", + schemaType: "string", + code: (cxt) => dynamicAnchor(cxt, cxt.schema), +}; +function dynamicAnchor(cxt, anchor) { + const { gen, it } = cxt; + it.schemaEnv.root.dynamicAnchors[anchor] = true; + const v = (0, codegen_1._) `${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`; + const validate = it.errSchemaPath === "#" ? it.validateName : _getValidate(cxt); + gen.if((0, codegen_1._) `!${v}`, () => gen.assign(v, validate)); +} +exports.dynamicAnchor = dynamicAnchor; +function _getValidate(cxt) { + const { schemaEnv, schema, self } = cxt.it; + const { root, baseId, localRefs, meta } = schemaEnv.root; + const { schemaId } = self.opts; + const sch = new compile_1.SchemaEnv({ schema, schemaId, root, baseId, localRefs, meta }); + compile_1.compileSchema.call(self, sch); + return (0, ref_1.getValidate)(cxt, sch); +} +exports.default = def; +//# sourceMappingURL=dynamicAnchor.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map new file mode 100644 index 000000000..e70afe30f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamicAnchor.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/dynamicAnchor.ts"],"names":[],"mappings":";;;AAEA,mDAA0D;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AE,IAAI,EAAC,CAAC,CAAA;IAC5E,uBAAa,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC7B,OAAO,IAAA,iBAAW,EAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAC9B,CAAC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts new file mode 100644 index 000000000..fa2f2b81d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +declare const def: CodeKeywordDefinition; +export declare function dynamicRef(cxt: KeywordCxt, ref: string): void; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js new file mode 100644 index 000000000..9f010a0df --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.dynamicRef = void 0; +const codegen_1 = require("../../compile/codegen"); +const names_1 = require("../../compile/names"); +const ref_1 = require("../core/ref"); +const def = { + keyword: "$dynamicRef", + schemaType: "string", + code: (cxt) => dynamicRef(cxt, cxt.schema), +}; +function dynamicRef(cxt, ref) { + const { gen, keyword, it } = cxt; + if (ref[0] !== "#") + throw new Error(`"${keyword}" only supports hash fragment reference`); + const anchor = ref.slice(1); + if (it.allErrors) { + _dynamicRef(); + } + else { + const valid = gen.let("valid", false); + _dynamicRef(valid); + cxt.ok(valid); + } + function _dynamicRef(valid) { + // TODO the assumption here is that `recursiveRef: #` always points to the root + // of the schema object, which is not correct, because there may be $id that + // makes # point to it, and the target schema may not contain dynamic/recursiveAnchor. + // Because of that 2 tests in recursiveRef.json fail. + // This is a similar problem to #815 (`$id` doesn't alter resolution scope for `{ "$ref": "#" }`). + // (This problem is not tested in JSON-Schema-Test-Suite) + if (it.schemaEnv.root.dynamicAnchors[anchor]) { + const v = gen.let("_v", (0, codegen_1._) `${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`); + gen.if(v, _callRef(v, valid), _callRef(it.validateName, valid)); + } + else { + _callRef(it.validateName, valid)(); + } + } + function _callRef(validate, valid) { + return valid + ? () => gen.block(() => { + (0, ref_1.callRef)(cxt, validate); + gen.let(valid, true); + }) + : () => (0, ref_1.callRef)(cxt, validate); + } +} +exports.dynamicRef = dynamicRef; +exports.default = def; +//# sourceMappingURL=dynamicRef.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map new file mode 100644 index 000000000..921c893f7 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamicRef.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/dynamicRef.ts"],"names":[],"mappings":";;;AAEA,mDAAgE;AAChE,+CAAmC;AACnC,qCAAmC;AAEnC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,aAAa;IACtB,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;CAC3C,CAAA;AAED,SAAgB,UAAU,CAAC,GAAe,EAAE,GAAW;IACrD,MAAM,EAAC,GAAG,EAAE,OAAO,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAC9B,IAAI,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG;QAAE,MAA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CAAC,GAAG,EAAE,CAAC,IAAA,aAAO,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAClC,CAAC;AACH,CAAC;AApCD,gCAoCC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts new file mode 100644 index 000000000..0c751d93f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../../types"; +declare const dynamic: Vocabulary; +export default dynamic; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/index.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/index.js new file mode 100644 index 000000000..f2388a757 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/index.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dynamicAnchor_1 = require("./dynamicAnchor"); +const dynamicRef_1 = require("./dynamicRef"); +const recursiveAnchor_1 = require("./recursiveAnchor"); +const recursiveRef_1 = require("./recursiveRef"); +const dynamic = [dynamicAnchor_1.default, dynamicRef_1.default, recursiveAnchor_1.default, recursiveRef_1.default]; +exports.default = dynamic; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/index.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/index.js.map new file mode 100644 index 000000000..f96ba76dd --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/index.ts"],"names":[],"mappings":";;AACA,mDAA2C;AAC3C,6CAAqC;AACrC,uDAA+C;AAC/C,iDAAyC;AAEzC,MAAM,OAAO,GAAe,CAAC,uBAAa,EAAE,oBAAU,EAAE,yBAAe,EAAE,sBAAY,CAAC,CAAA;AAEtF,kBAAe,OAAO,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js new file mode 100644 index 000000000..9fd832353 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dynamicAnchor_1 = require("./dynamicAnchor"); +const util_1 = require("../../compile/util"); +const def = { + keyword: "$recursiveAnchor", + schemaType: "boolean", + code(cxt) { + if (cxt.schema) + (0, dynamicAnchor_1.dynamicAnchor)(cxt, ""); + else + (0, util_1.checkStrictMode)(cxt.it, "$recursiveAnchor: false is ignored"); + }, +}; +exports.default = def; +//# sourceMappingURL=recursiveAnchor.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map new file mode 100644 index 000000000..5d5e381b0 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"recursiveAnchor.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/recursiveAnchor.ts"],"names":[],"mappings":";;AACA,mDAA6C;AAC7C,6CAAkD;AAElD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,kBAAkB;IAC3B,UAAU,EAAE,SAAS;IACrB,IAAI,CAAC,GAAG;QACN,IAAI,GAAG,CAAC,MAAM;YAAE,IAAA,6BAAa,EAAC,GAAG,EAAE,EAAE,CAAC,CAAA;;YACjC,IAAA,sBAAe,EAAC,GAAG,CAAC,EAAE,EAAE,oCAAoC,CAAC,CAAA;IACpE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js new file mode 100644 index 000000000..8cd5c6969 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dynamicRef_1 = require("./dynamicRef"); +const def = { + keyword: "$recursiveRef", + schemaType: "string", + code: (cxt) => (0, dynamicRef_1.dynamicRef)(cxt, cxt.schema), +}; +exports.default = def; +//# sourceMappingURL=recursiveRef.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map new file mode 100644 index 000000000..f81380446 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map @@ -0,0 +1 @@ +{"version":3,"file":"recursiveRef.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/recursiveRef.ts"],"names":[],"mappings":";;AACA,6CAAuC;AAEvC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,eAAe;IACxB,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,uBAAU,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;CAC3C,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/errors.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/errors.d.ts new file mode 100644 index 000000000..221aae0e3 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/errors.d.ts @@ -0,0 +1,9 @@ +import type { TypeError } from "../compile/validate/dataType"; +import type { ApplicatorKeywordError } from "./applicator"; +import type { ValidationKeywordError } from "./validation"; +import type { FormatError } from "./format/format"; +import type { UnevaluatedPropertiesError } from "./unevaluated/unevaluatedProperties"; +import type { UnevaluatedItemsError } from "./unevaluated/unevaluatedItems"; +import type { DependentRequiredError } from "./validation/dependentRequired"; +import type { DiscriminatorError } from "./discriminator"; +export declare type DefinedError = TypeError | ApplicatorKeywordError | ValidationKeywordError | FormatError | UnevaluatedPropertiesError | UnevaluatedItemsError | DependentRequiredError | DiscriminatorError; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/errors.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/errors.js new file mode 100644 index 000000000..d4d3fba00 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/errors.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/errors.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/errors.js.map new file mode 100644 index 000000000..56bad7362 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/errors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../lib/vocabularies/errors.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/format.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/format.d.ts new file mode 100644 index 000000000..855d0a2a1 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/format.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export declare type FormatError = ErrorObject<"format", { + format: string; +}, string | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/format.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/format.js new file mode 100644 index 000000000..aa667c1ef --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/format.js @@ -0,0 +1,92 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const error = { + message: ({ schemaCode }) => (0, codegen_1.str) `must match format "${schemaCode}"`, + params: ({ schemaCode }) => (0, codegen_1._) `{format: ${schemaCode}}`, +}; +const def = { + keyword: "format", + type: ["number", "string"], + schemaType: "string", + $data: true, + error, + code(cxt, ruleType) { + const { gen, data, $data, schema, schemaCode, it } = cxt; + const { opts, errSchemaPath, schemaEnv, self } = it; + if (!opts.validateFormats) + return; + if ($data) + validate$DataFormat(); + else + validateFormat(); + function validate$DataFormat() { + const fmts = gen.scopeValue("formats", { + ref: self.formats, + code: opts.code.formats, + }); + const fDef = gen.const("fDef", (0, codegen_1._) `${fmts}[${schemaCode}]`); + const fType = gen.let("fType"); + const format = gen.let("format"); + // TODO simplify + gen.if((0, codegen_1._) `typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._) `${fDef}.type || "string"`).assign(format, (0, codegen_1._) `${fDef}.validate`), () => gen.assign(fType, (0, codegen_1._) `"string"`).assign(format, fDef)); + cxt.fail$data((0, codegen_1.or)(unknownFmt(), invalidFmt())); + function unknownFmt() { + if (opts.strictSchema === false) + return codegen_1.nil; + return (0, codegen_1._) `${schemaCode} && !${format}`; + } + function invalidFmt() { + const callFormat = schemaEnv.$async + ? (0, codegen_1._) `(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))` + : (0, codegen_1._) `${format}(${data})`; + const validData = (0, codegen_1._) `(typeof ${format} == "function" ? ${callFormat} : ${format}.test(${data}))`; + return (0, codegen_1._) `${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}`; + } + } + function validateFormat() { + const formatDef = self.formats[schema]; + if (!formatDef) { + unknownFormat(); + return; + } + if (formatDef === true) + return; + const [fmtType, format, fmtRef] = getFormat(formatDef); + if (fmtType === ruleType) + cxt.pass(validCondition()); + function unknownFormat() { + if (opts.strictSchema === false) { + self.logger.warn(unknownMsg()); + return; + } + throw new Error(unknownMsg()); + function unknownMsg() { + return `unknown format "${schema}" ignored in schema at path "${errSchemaPath}"`; + } + } + function getFormat(fmtDef) { + const code = fmtDef instanceof RegExp + ? (0, codegen_1.regexpCode)(fmtDef) + : opts.code.formats + ? (0, codegen_1._) `${opts.code.formats}${(0, codegen_1.getProperty)(schema)}` + : undefined; + const fmt = gen.scopeValue("formats", { key: schema, ref: fmtDef, code }); + if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) { + return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._) `${fmt}.validate`]; + } + return ["string", fmtDef, fmt]; + } + function validCondition() { + if (typeof formatDef == "object" && !(formatDef instanceof RegExp) && formatDef.async) { + if (!schemaEnv.$async) + throw new Error("async format in sync schema"); + return (0, codegen_1._) `await ${fmtRef}(${data})`; + } + return typeof format == "function" ? (0, codegen_1._) `${fmtRef}(${data})` : (0, codegen_1._) `${fmtRef}.test(${data})`; + } + } + }, +}; +exports.default = def; +//# sourceMappingURL=format.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/format.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/format.js.map new file mode 100644 index 000000000..897d9ded5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/format.js.map @@ -0,0 +1 @@ +{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../lib/vocabularies/format/format.ts"],"names":[],"mappings":";;AASA,mDAAoF;AAapF,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,sBAAsB,UAAU,GAAG;IACjE,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,YAAY,UAAU,GAAG;CACrD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,QAAQ;IACjB,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC1B,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe,EAAE,QAAiB;QACrC,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACtD,MAAM,EAAC,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;QACjD,IAAI,CAAC,IAAI,CAAC,eAAe;YAAE,OAAM;QAEjC,IAAI,KAAK;YAAE,mBAAmB,EAAE,CAAA;;YAC3B,cAA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/vocabularies/format/index.d.ts new file mode 100644 index 000000000..c8019c9d6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/index.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../../types"; +declare const format: Vocabulary; +export default format; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/index.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/index.js new file mode 100644 index 000000000..d19023d24 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/index.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const format_1 = require("./format"); +const format = [format_1.default]; +exports.default = format; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/index.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/index.js.map new file mode 100644 index 000000000..6315bfe1f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/format/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/format/index.ts"],"names":[],"mappings":";;AACA,qCAAoC;AAEpC,MAAM,MAAM,GAAe,CAAC,gBAAa,CAAC,CAAA;AAE1C,kBAAe,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts new file mode 100644 index 000000000..fa27fb771 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition } from "../../types"; +import { _JTDTypeError } from "./error"; +import { DiscrError, DiscrErrorObj } from "../discriminator/types"; +export declare type JTDDiscriminatorError = _JTDTypeError<"discriminator", "object", string> | DiscrErrorObj | DiscrErrorObj; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/discriminator.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/discriminator.js new file mode 100644 index 000000000..e7074d279 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/discriminator.js @@ -0,0 +1,71 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const metadata_1 = require("./metadata"); +const nullable_1 = require("./nullable"); +const error_1 = require("./error"); +const types_1 = require("../discriminator/types"); +const error = { + message: (cxt) => { + const { schema, params } = cxt; + return params.discrError + ? params.discrError === types_1.DiscrError.Tag + ? `tag "${schema}" must be string` + : `value of tag "${schema}" must be in mapping` + : (0, error_1.typeErrorMessage)(cxt, "object"); + }, + params: (cxt) => { + const { schema, params } = cxt; + return params.discrError + ? (0, codegen_1._) `{error: ${params.discrError}, tag: ${schema}, tagValue: ${params.tag}}` + : (0, error_1.typeErrorParams)(cxt, "object"); + }, +}; +const def = { + keyword: "discriminator", + schemaType: "string", + implements: ["mapping"], + error, + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, schema, parentSchema } = cxt; + const [valid, cond] = (0, nullable_1.checkNullableObject)(cxt, data); + gen.if(cond); + validateDiscriminator(); + gen.elseIf((0, codegen_1.not)(valid)); + cxt.error(); + gen.endIf(); + cxt.ok(valid); + function validateDiscriminator() { + const tag = gen.const("tag", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(schema)}`); + gen.if((0, codegen_1._) `${tag} === undefined`); + cxt.error(false, { discrError: types_1.DiscrError.Tag, tag }); + gen.elseIf((0, codegen_1._) `typeof ${tag} == "string"`); + validateMapping(tag); + gen.else(); + cxt.error(false, { discrError: types_1.DiscrError.Tag, tag }, { instancePath: schema }); + gen.endIf(); + } + function validateMapping(tag) { + gen.if(false); + for (const tagValue in parentSchema.mapping) { + gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`); + gen.assign(valid, applyTagSchema(tagValue)); + } + gen.else(); + cxt.error(false, { discrError: types_1.DiscrError.Mapping, tag }, { instancePath: schema, schemaPath: "mapping", parentSchema: true }); + gen.endIf(); + } + function applyTagSchema(schemaProp) { + const _valid = gen.name("valid"); + cxt.subschema({ + keyword: "mapping", + schemaProp, + jtdDiscriminator: schema, + }, _valid); + return _valid; + } + }, +}; +exports.default = def; +//# sourceMappingURL=discriminator.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map new file mode 100644 index 000000000..53cb717b6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"discriminator.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/discriminator.ts"],"names":[],"mappings":";;AAEA,mDAA+D;AAC/D,yCAAwC;AACxC,yCAA8C;AAC9C,mCAAwE;AACxE,kDAAgE;AAOhE,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACf,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;QAC5B,OAAO,MAAM,CAAC,UAAU;YACtB,CAAC,CAAC,MAAM,CAAC,UAAU,KAAK,kBAAU,CAAC,GAAG;gBACpC,CAAC,CAAC,QAAQ,MAAM,kBAAkB;gBAClC,CAAC,CAAC,iBAAiB,MAAM,sBAAsB;YACjD,CAAC,CAAC,IAAA,wBAAgB,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IACrC,CAAC;IACD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;QACd,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;QAC5B,OAAO,MAAM,CAAC,UAAU;YACtB,CAAC,CAAC,IAAA,WAAC,EAAA,WAAW,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C,eAAe,CAAC,GAAG,CAAC,CAAA;YACpB,GAAG,CAAC,IAAI,EAAE,CAAA;YACV,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,EAAC,UAAU,EAAE,kBAAU,CAAC,GAAG,EAAE,GAAG,EAAC,EAAE,EAAC,YAAY,EAAE,MAAM,EAAC,CAAC,CAAA;YAC3E,GAAG,CAAC,KAAK,EAAE,CAAA;QACb,CAAC;QAED,SAAS,eAAe,CAAC,GAAS;YAChC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;YACb,KAAK,MAAM,QAAQ,IAAI,YAAY,CAAC,OAAO,EAAE;gBAC3C,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,QAAQ,EAAE,CAAC,CAAA;gBACrC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAA;aAC5C;YACD,GAAG,CAAC,IAAI,EAAE,CAAA;YACV,GAAG,CAAC,KAAK,CACP,KAAK,EACL,EAAC,UAAU,EAAE,kBAAU,CAAC,OAAO,EAAE,GAAG,EAAC,EACrC,EAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAC,CAClE,CAAA;YACD,GAAG,CAAC,KAAK,EAAE,CAAA;QACb,CAAC;QAED,SAAS,cAAc,CAAC,UAAkB;YACxC,MAAM,MAAM,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAChC,GAAG,CAAC,SAAS,CACX;gBACE,OAAO,EAAE,SAAS;gBAClB,UAAU;gBACV,gBAAgB,EAAE,MAAM;aACzB,EACD,MAAM,CACP,CAAA;YACD,OAAO,MAAM,CAAA;QACf,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts new file mode 100644 index 000000000..0a1587119 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition, SchemaObject } from "../../types"; +import { _JTDTypeError } from "./error"; +export declare type JTDElementsError = _JTDTypeError<"elements", "array", SchemaObject>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/elements.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/elements.js new file mode 100644 index 000000000..9b8fb548a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/elements.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const metadata_1 = require("./metadata"); +const nullable_1 = require("./nullable"); +const error_1 = require("./error"); +const def = { + keyword: "elements", + schemaType: "object", + error: (0, error_1.typeError)("array"), + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, schema, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + const [valid] = (0, nullable_1.checkNullable)(cxt); + gen.if((0, codegen_1.not)(valid), () => gen.if((0, codegen_1._) `Array.isArray(${data})`, () => gen.assign(valid, (0, code_1.validateArray)(cxt)), () => cxt.error())); + cxt.ok(valid); + }, +}; +exports.default = def; +//# sourceMappingURL=elements.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/elements.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/elements.js.map new file mode 100644 index 000000000..38fe3a129 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/elements.js.map @@ -0,0 +1 @@ +{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/elements.ts"],"names":[],"mappings":";;AAEA,6CAAoD;AACpD,kCAAqC;AACrC,mDAA4C;AAC5C,yCAAwC;AACxC,yCAAwC;AACxC,mCAAgD;AAIhD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAA,iBAAS,EAAC,OAAO,CAAC;IACzB,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClC,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CACtB,GAAG,CAAC,EAAE,CACJ,IAAA,WAAC,EAAA,iBAAiB,IAAI,GAAG,EACzB,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAA,oBAAa,EAAC,GAAG,CAAC,CAAC,EAC3C,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAClB,CACF,CAAA;QACD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts new file mode 100644 index 000000000..8df949c06 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export declare type JTDEnumError = ErrorObject<"enum", { + allowedValues: string[]; +}, string[]>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/enum.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/enum.js new file mode 100644 index 000000000..78b01ee37 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/enum.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const metadata_1 = require("./metadata"); +const nullable_1 = require("./nullable"); +const error = { + message: "must be equal to one of the allowed values", + params: ({ schemaCode }) => (0, codegen_1._) `{allowedValues: ${schemaCode}}`, +}; +const def = { + keyword: "enum", + schemaType: "array", + error, + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, schema, schemaValue, parentSchema, it } = cxt; + if (schema.length === 0) + throw new Error("enum must have non-empty array"); + if (schema.length !== new Set(schema).size) + throw new Error("enum items must be unique"); + let valid; + const isString = (0, codegen_1._) `typeof ${data} == "string"`; + if (schema.length >= it.opts.loopEnum) { + let cond; + [valid, cond] = (0, nullable_1.checkNullable)(cxt, isString); + gen.if(cond, loopEnum); + } + else { + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + valid = (0, codegen_1.and)(isString, (0, codegen_1.or)(...schema.map((value) => (0, codegen_1._) `${data} === ${value}`))); + if (parentSchema.nullable) + valid = (0, codegen_1.or)((0, codegen_1._) `${data} === null`, valid); + } + cxt.pass(valid); + function loopEnum() { + gen.forOf("v", schemaValue, (v) => gen.if((0, codegen_1._) `${valid} = ${data} === ${v}`, () => gen.break())); + } + }, +}; +exports.default = def; +//# sourceMappingURL=enum.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/enum.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/enum.js.map new file mode 100644 index 000000000..663cc7c5d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/enum.js.map @@ -0,0 +1 @@ +{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/enum.ts"],"names":[],"mappings":";;AAEA,mDAAsD;AACtD,yCAAwC;AACxC,yCAAwC;AAIxC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,4CAA4C;IACrD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,mBAAmB,UAAU,GAAG;CAC5D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,OAAO;IACnB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC9D,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QAC1E,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;QACxF,IAAI,KAAW,CAAA;QACf,MAAM,QAAQ,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,cAAc,CAAA;QAC9C,IAAI,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE;YACrC,IAAI,IAAU,CACb;YAAA,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,IAAA,wBAAa,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YAC7C,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;SACvB;aAAM;YACL,wBAAwB;YACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;YACvE,KAAK,GAAG,IAAA,aAAG,EAAC,QAAQ,EAAE,IAAA,YAAE,EAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;YACpF,IAAI,YAAY,CAAC,QAAQ;gBAAE,KAAK,GAAG,IAAA,YAAE,EAAC,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,EAAE,KAAK,CAAC,CAAA;SAClE;QACD,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAEf,SAAS,QAAQ;YACf,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,WAAmB,EAAE,CAAC,CAAC,EAAE,EAAE,CACxC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,MAAM,IAAI,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAC1D,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/error.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/error.d.ts new file mode 100644 index 000000000..0a1e68f97 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/error.d.ts @@ -0,0 +1,9 @@ +import type { KeywordErrorDefinition, KeywordErrorCxt, ErrorObject } from "../../types"; +import { Code } from "../../compile/codegen"; +export declare type _JTDTypeError = ErrorObject; +export declare function typeError(t: string): KeywordErrorDefinition; +export declare function typeErrorMessage({ parentSchema }: KeywordErrorCxt, t: string): string; +export declare function typeErrorParams({ parentSchema }: KeywordErrorCxt, t: string): Code; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/error.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/error.js new file mode 100644 index 000000000..1a3920a7e --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/error.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.typeErrorParams = exports.typeErrorMessage = exports.typeError = void 0; +const codegen_1 = require("../../compile/codegen"); +function typeError(t) { + return { + message: (cxt) => typeErrorMessage(cxt, t), + params: (cxt) => typeErrorParams(cxt, t), + }; +} +exports.typeError = typeError; +function typeErrorMessage({ parentSchema }, t) { + return (parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.nullable) ? `must be ${t} or null` : `must be ${t}`; +} +exports.typeErrorMessage = typeErrorMessage; +function typeErrorParams({ parentSchema }, t) { + return (0, codegen_1._) `{type: ${t}, nullable: ${!!(parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.nullable)}}`; +} +exports.typeErrorParams = typeErrorParams; +//# sourceMappingURL=error.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/error.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/error.js.map new file mode 100644 index 000000000..db5596787 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/error.js.map @@ -0,0 +1 @@ +{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/error.ts"],"names":[],"mappings":";;;AACA,mDAA6C;AAQ7C,SAAgB,SAAS,CAAC,CAAS;IACjC,OAAO;QACL,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC,CAAC;QAC1C,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,CAAC;KACzC,CAAA;AACH,CAAC;AALD,8BAKC;AAED,SAAgB,gBAAgB,CAAC,EAAC,YAAY,EAAkB,EAAE,CAAS;IACzE,OAAO,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,EAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAA;AACzE,CAAC;AAFD,4CAEC;AAED,SAAgB,eAAe,CAAC,EAAC,YAAY,EAAkB,EAAE,CAAS;IACxE,OAAO,IAAA,WAAC,EAAA,UAAU,CAAC,eAAe,CAAC,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,CAAA,GAAG,CAAA;AAC/D,CAAC;AAFD,0CAEC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/index.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/index.d.ts new file mode 100644 index 000000000..f9b7fb9d4 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/index.d.ts @@ -0,0 +1,10 @@ +import type { Vocabulary } from "../../types"; +import { JTDTypeError } from "./type"; +import { JTDEnumError } from "./enum"; +import { JTDElementsError } from "./elements"; +import { JTDPropertiesError } from "./properties"; +import { JTDDiscriminatorError } from "./discriminator"; +import { JTDValuesError } from "./values"; +declare const jtdVocabulary: Vocabulary; +export default jtdVocabulary; +export declare type JTDErrorObject = JTDTypeError | JTDEnumError | JTDElementsError | JTDPropertiesError | JTDDiscriminatorError | JTDValuesError; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/index.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/index.js new file mode 100644 index 000000000..18f40ab7a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/index.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ref_1 = require("./ref"); +const type_1 = require("./type"); +const enum_1 = require("./enum"); +const elements_1 = require("./elements"); +const properties_1 = require("./properties"); +const optionalProperties_1 = require("./optionalProperties"); +const discriminator_1 = require("./discriminator"); +const values_1 = require("./values"); +const union_1 = require("./union"); +const metadata_1 = require("./metadata"); +const jtdVocabulary = [ + "definitions", + ref_1.default, + type_1.default, + enum_1.default, + elements_1.default, + properties_1.default, + optionalProperties_1.default, + discriminator_1.default, + values_1.default, + union_1.default, + metadata_1.default, + { keyword: "additionalProperties", schemaType: "boolean" }, + { keyword: "nullable", schemaType: "boolean" }, +]; +exports.default = jtdVocabulary; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/index.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/index.js.map new file mode 100644 index 000000000..713a1875b --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/index.ts"],"names":[],"mappings":";;AACA,+BAA8B;AAC9B,iCAAgD;AAChD,iCAAgD;AAChD,yCAAqD;AACrD,6CAA2D;AAC3D,6DAAqD;AACrD,mDAAoE;AACpE,qCAA+C;AAC/C,mCAA2B;AAC3B,yCAAiC;AAEjC,MAAM,aAAa,GAAe;IAChC,aAAa;IACb,aAAU;IACV,cAAW;IACX,cAAW;IACX,kBAAQ;IACR,oBAAU;IACV,4BAAkB;IAClB,uBAAa;IACb,gBAAM;IACN,eAAK;IACL,kBAAQ;IACR,EAAC,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,SAAS,EAAC;IACxD,EAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAC;CAC7C,CAAA;AAED,kBAAe,aAAa,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts new file mode 100644 index 000000000..86e15a8ed --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts @@ -0,0 +1,5 @@ +import { KeywordCxt } from "../../ajv"; +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export declare function checkMetadata({ it, keyword }: KeywordCxt, metadata?: boolean): void; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/metadata.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/metadata.js new file mode 100644 index 000000000..eeb3c91cd --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/metadata.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.checkMetadata = void 0; +const util_1 = require("../../compile/util"); +const def = { + keyword: "metadata", + schemaType: "object", + code(cxt) { + checkMetadata(cxt); + const { gen, schema, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + const valid = gen.name("valid"); + cxt.subschema({ keyword: "metadata", jtdMetadata: true }, valid); + cxt.ok(valid); + }, +}; +function checkMetadata({ it, keyword }, metadata) { + if (it.jtdMetadata !== metadata) { + throw new Error(`JTD: "${keyword}" cannot be used in this schema location`); + } +} +exports.checkMetadata = checkMetadata; +exports.default = def; +//# sourceMappingURL=metadata.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map new file mode 100644 index 000000000..c22e73ada --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/metadata.ts"],"names":[],"mappings":";;;AAEA,6CAAoD;AAEpD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,GAAe;QAClB,aAAa,CAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC7B,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;QAC9D,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;CACF,CAAA;AAED,SAAgB,aAAa,CAAC,EAAC,EAAE,EAAE,OAAO,EAAa,EAAE,QAAkB;IACzE,IAAI,EAAE,CAAC,WAAW,KAAK,QAAQ,EAAE;QAC/B,MAAM,IAAI,KAAK,CAAC,SAAS,OAAO,0CAA0C,CAAC,CAAA;KAC5E;AACH,CAAC;AAJD,sCAIC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts new file mode 100644 index 000000000..254f76023 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts @@ -0,0 +1,4 @@ +import type { KeywordCxt } from "../../compile/validate"; +import { Code, Name } from "../../compile/codegen"; +export declare function checkNullable({ gen, data, parentSchema }: KeywordCxt, cond?: Code): [Name, Code]; +export declare function checkNullableObject(cxt: KeywordCxt, cond: Code): [Name, Code]; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/nullable.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/nullable.js new file mode 100644 index 000000000..8c92d2cde --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/nullable.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.checkNullableObject = exports.checkNullable = void 0; +const codegen_1 = require("../../compile/codegen"); +function checkNullable({ gen, data, parentSchema }, cond = codegen_1.nil) { + const valid = gen.name("valid"); + if (parentSchema.nullable) { + gen.let(valid, (0, codegen_1._) `${data} === null`); + cond = (0, codegen_1.not)(valid); + } + else { + gen.let(valid, false); + } + return [valid, cond]; +} +exports.checkNullable = checkNullable; +function checkNullableObject(cxt, cond) { + const [valid, cond_] = checkNullable(cxt, cond); + return [valid, (0, codegen_1._) `${cond_} && typeof ${cxt.data} == "object" && !Array.isArray(${cxt.data})`]; +} +exports.checkNullableObject = checkNullableObject; +//# sourceMappingURL=nullable.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map new file mode 100644 index 000000000..5bfaf3279 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map @@ -0,0 +1 @@ +{"version":3,"file":"nullable.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/nullable.ts"],"names":[],"mappings":";;;AACA,mDAA6D;AAE7D,SAAgB,aAAa,CAC3B,EAAC,GAAG,EAAE,IAAI,EAAE,YAAY,EAAa,EACrC,OAAa,aAAG;IAEhB,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/B,IAAI,YAAY,CAAC,QAAQ,EAAE;QACzB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,CAAC,CAAA;QACnC,IAAI,GAAG,IAAA,aAAG,EAAC,KAAK,CAAC,CAAA;KAClB;SAAM;QACL,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;KACtB;IACD,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAZD,sCAYC;AAED,SAAgB,mBAAmB,CAAC,GAAe,EAAE,IAAU;IAC7D,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC/C,OAAO,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,KAAK,cAAc,GAAG,CAAC,IAAI,kCAAkC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAA;AAC9F,CAAC;AAHD,kDAGC"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js new file mode 100644 index 000000000..fe272758f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const properties_1 = require("./properties"); +const def = { + keyword: "optionalProperties", + schemaType: "object", + error: properties_1.error, + code(cxt) { + if (cxt.parentSchema.properties) + return; + (0, properties_1.validateProperties)(cxt); + }, +}; +exports.default = def; +//# sourceMappingURL=optionalProperties.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map new file mode 100644 index 000000000..21e5f0d47 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"optionalProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/optionalProperties.ts"],"names":[],"mappings":";;AAEA,6CAAsD;AAEtD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,oBAAoB;IAC7B,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAL,kBAAK;IACL,IAAI,CAAC,GAAe;QAClB,IAAI,GAAG,CAAC,YAAY,CAAC,UAAU;YAAE,OAAM;QACvC,IAAA,+BAAkB,EAAC,GAAG,CAAC,CAAA;IACzB,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts new file mode 100644 index 000000000..a1a2219f9 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts @@ -0,0 +1,22 @@ +import type { CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition, SchemaObject } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +import { _JTDTypeError } from "./error"; +declare enum PropError { + Additional = "additional", + Missing = "missing" +} +declare type PropKeyword = "properties" | "optionalProperties"; +declare type PropSchema = { + [P in string]?: SchemaObject; +}; +export declare type JTDPropertiesError = _JTDTypeError | ErrorObject | ErrorObject; +export declare const error: KeywordErrorDefinition; +declare const def: CodeKeywordDefinition; +export declare function validateProperties(cxt: KeywordCxt): void; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/properties.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/properties.js new file mode 100644 index 000000000..eccb066ec --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/properties.js @@ -0,0 +1,146 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateProperties = exports.error = void 0; +const code_1 = require("../code"); +const util_1 = require("../../compile/util"); +const codegen_1 = require("../../compile/codegen"); +const metadata_1 = require("./metadata"); +const nullable_1 = require("./nullable"); +const error_1 = require("./error"); +var PropError; +(function (PropError) { + PropError["Additional"] = "additional"; + PropError["Missing"] = "missing"; +})(PropError || (PropError = {})); +exports.error = { + message: (cxt) => { + const { params } = cxt; + return params.propError + ? params.propError === PropError.Additional + ? "must NOT have additional properties" + : `must have property '${params.missingProperty}'` + : (0, error_1.typeErrorMessage)(cxt, "object"); + }, + params: (cxt) => { + const { params } = cxt; + return params.propError + ? params.propError === PropError.Additional + ? (0, codegen_1._) `{error: ${params.propError}, additionalProperty: ${params.additionalProperty}}` + : (0, codegen_1._) `{error: ${params.propError}, missingProperty: ${params.missingProperty}}` + : (0, error_1.typeErrorParams)(cxt, "object"); + }, +}; +const def = { + keyword: "properties", + schemaType: "object", + error: exports.error, + code: validateProperties, +}; +// const error: KeywordErrorDefinition = { +// message: "should NOT have additional properties", +// params: ({params}) => _`{additionalProperty: ${params.additionalProperty}}`, +// } +function validateProperties(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, parentSchema, it } = cxt; + const { additionalProperties, nullable } = parentSchema; + if (it.jtdDiscriminator && nullable) + throw new Error("JTD: nullable inside discriminator mapping"); + if (commonProperties()) { + throw new Error("JTD: properties and optionalProperties have common members"); + } + const [allProps, properties] = schemaProperties("properties"); + const [allOptProps, optProperties] = schemaProperties("optionalProperties"); + if (properties.length === 0 && optProperties.length === 0 && additionalProperties) { + return; + } + const [valid, cond] = it.jtdDiscriminator === undefined + ? (0, nullable_1.checkNullableObject)(cxt, data) + : [gen.let("valid", false), true]; + gen.if(cond, () => gen.assign(valid, true).block(() => { + validateProps(properties, "properties", true); + validateProps(optProperties, "optionalProperties"); + if (!additionalProperties) + validateAdditional(); + })); + cxt.pass(valid); + function commonProperties() { + const props = parentSchema.properties; + const optProps = parentSchema.optionalProperties; + if (!(props && optProps)) + return false; + for (const p in props) { + if (Object.prototype.hasOwnProperty.call(optProps, p)) + return true; + } + return false; + } + function schemaProperties(keyword) { + const schema = parentSchema[keyword]; + const allPs = schema ? (0, code_1.allSchemaProperties)(schema) : []; + if (it.jtdDiscriminator && allPs.some((p) => p === it.jtdDiscriminator)) { + throw new Error(`JTD: discriminator tag used in ${keyword}`); + } + const ps = allPs.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p])); + return [allPs, ps]; + } + function validateProps(props, keyword, required) { + const _valid = gen.var("valid"); + for (const prop of props) { + gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties), () => applyPropertySchema(prop, keyword, _valid), () => missingProperty(prop)); + cxt.ok(_valid); + } + function missingProperty(prop) { + if (required) { + gen.assign(_valid, false); + cxt.error(false, { propError: PropError.Missing, missingProperty: prop }, { schemaPath: prop }); + } + else { + gen.assign(_valid, true); + } + } + } + function applyPropertySchema(prop, keyword, _valid) { + cxt.subschema({ + keyword, + schemaProp: prop, + dataProp: prop, + }, _valid); + } + function validateAdditional() { + gen.forIn("key", data, (key) => { + const _allProps = it.jtdDiscriminator === undefined ? allProps : [it.jtdDiscriminator].concat(allProps); + const addProp = isAdditional(key, _allProps, "properties"); + const addOptProp = isAdditional(key, allOptProps, "optionalProperties"); + const extra = addProp === true ? addOptProp : addOptProp === true ? addProp : (0, codegen_1.and)(addProp, addOptProp); + gen.if(extra, () => { + if (it.opts.removeAdditional) { + gen.code((0, codegen_1._) `delete ${data}[${key}]`); + } + else { + cxt.error(false, { propError: PropError.Additional, additionalProperty: key }, { instancePath: key, parentSchema: true }); + if (!it.opts.allErrors) + gen.break(); + } + }); + }); + } + function isAdditional(key, props, keyword) { + let additional; + if (props.length > 8) { + // TODO maybe an option instead of hard-coded 8? + const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema[keyword], keyword); + additional = (0, codegen_1.not)((0, code_1.isOwnProperty)(gen, propsSchema, key)); + } + else if (props.length) { + additional = (0, codegen_1.and)(...props.map((p) => (0, codegen_1._) `${key} !== ${p}`)); + } + else { + additional = true; + } + return additional; + } +} +exports.validateProperties = validateProperties; +exports.default = def; +//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/properties.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/properties.js.map new file mode 100644 index 000000000..8a28a9e6a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/properties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/properties.ts"],"names":[],"mappings":";;;AAOA,kCAA0E;AAC1E,6CAAoE;AACpE,mDAA6D;AAC7D,yCAAwC;AACxC,yCAA8C;AAC9C,mCAAwE;AAExE,IAAK,SAGJ;AAHD,WAAK,SAAS;IACZ,sCAAyB,CAAA;IACzB,gCAAmB,CAAA;AACrB,CAAC,EAHI,SAAS,KAAT,SAAS,QAGb;AAWY,QAAA,KAAK,GAA2B;IAC3C,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACf,MAAM,EAAC,MAAM,EAAC,GAAG,GAAG,CAAA;QACpB,OAAO,MAAM,CAAC,SAAS;YACrB,CAAC,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,UAAU;gBACzC,CAAC,CAAC,qCAAqC;gBACvC,CAAC,CAAC,uBAAuB,MAAM,CAAC,eAAe,GAAG;YACpD,CAAC,CAAC,IAAA,wBAAgB,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IACrC,CAAC;IACD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE;QACd,MAAM,EAAC,MAAM,EAAC,GAAG,GAAG,CAAA;QACpB,OAAO,MAAM,CAAC,SAAS;YACrB,CAAC,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,UAAU;g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ACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,SAAS,YAAY,CAAC,GAAS,EAAE,KAAe,EAAE,OAAe;QAC/D,IAAI,UAA0B,CAAA;QAC9B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;YACpB,gDAAgD;YAChD,MAAM,WAAW,GAAG,IAAA,qBAAc,EAAC,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAA;YACtE,UAAU,GAAG,IAAA,aAAG,EAAC,IAAA,oBAAa,EAAC,GAAG,EAAE,WAAmB,EAAE,GAAG,CAAC,CAAC,CAAA;SAC/D;aAAM,IAAI,KAAK,CAAC,MAAM,EAAE;YACvB,UAAU,GAAG,IAAA,aAAG,EAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;SAC1D;aAAM;YACL,UAAU,GAAG,IAAI,CAAA;SAClB;QACD,OAAO,UAAU,CAAA;IACnB,CAAC;AACH,CAAC;AAnHD,gDAmHC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts new file mode 100644 index 000000000..ccdf84c0b --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts @@ -0,0 +1,4 @@ +import type { CodeKeywordDefinition, AnySchemaObject } from "../../types"; +declare const def: CodeKeywordDefinition; +export declare function hasRef(schema: AnySchemaObject): boolean; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/ref.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/ref.js new file mode 100644 index 000000000..b7c6b02d7 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/ref.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.hasRef = void 0; +const compile_1 = require("../../compile"); +const codegen_1 = require("../../compile/codegen"); +const ref_error_1 = require("../../compile/ref_error"); +const names_1 = require("../../compile/names"); +const ref_1 = require("../core/ref"); +const metadata_1 = require("./metadata"); +const def = { + keyword: "ref", + schemaType: "string", + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, schema: ref, parentSchema, it } = cxt; + const { schemaEnv: { root }, } = it; + const valid = gen.name("valid"); + if (parentSchema.nullable) { + gen.var(valid, (0, codegen_1._) `${data} === null`); + gen.if((0, codegen_1.not)(valid), validateJtdRef); + } + else { + gen.var(valid, false); + validateJtdRef(); + } + cxt.ok(valid); + function validateJtdRef() { + var _a; + const refSchema = (_a = root.schema.definitions) === null || _a === void 0 ? void 0 : _a[ref]; + if (!refSchema) { + throw new ref_error_1.default(it.opts.uriResolver, "", ref, `No definition ${ref}`); + } + if (hasRef(refSchema) || !it.opts.inlineRefs) + callValidate(refSchema); + else + inlineRefSchema(refSchema); + } + function callValidate(schema) { + const sch = compile_1.compileSchema.call(it.self, new compile_1.SchemaEnv({ schema, root, schemaPath: `/definitions/${ref}` })); + const v = (0, ref_1.getValidate)(cxt, sch); + const errsCount = gen.const("_errs", names_1.default.errors); + (0, ref_1.callRef)(cxt, v, sch, sch.$async); + gen.assign(valid, (0, codegen_1._) `${errsCount} === ${names_1.default.errors}`); + } + function inlineRefSchema(schema) { + const schName = gen.scopeValue("schema", it.opts.code.source === true ? { ref: schema, code: (0, codegen_1.stringify)(schema) } : { ref: schema }); + cxt.subschema({ + schema, + dataTypes: [], + schemaPath: codegen_1.nil, + topSchemaRef: schName, + errSchemaPath: `/definitions/${ref}`, + }, valid); + } + }, +}; +function hasRef(schema) { + for (const key in schema) { + let sch; + if (key === "ref" || (typeof (sch = schema[key]) == "object" && hasRef(sch))) + return true; + } + return false; +} +exports.hasRef = hasRef; +exports.default = def; +//# sourceMappingURL=ref.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/ref.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/ref.js.map new file mode 100644 index 000000000..c11c45c1f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/ref.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ref.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/ref.ts"],"names":[],"mappings":";;;AAEA,2CAAsD;AACtD,mDAA4D;AAC5D,uDAAqD;AACrD,+CAAmC;AACnC,qCAAgD;AAChD,yCAAwC;AAExC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACtD,MAAM,EACJ,SAAS,EAAE,EAAC,IAAI,EAAC,GAClB,GAAG,EAAE,CAAA;QACN,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,IAAI,YAAY,CAAC,QAAQ,EAAE;YACzB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,CAAC,CAAA;YACnC,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,cAAc,CAAC,CAAA;SACnC;aAAM;YACL,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;YACrB,cAAc,EAAE,CAAA;SACjB;QACD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;QAEb,SAAS,cAAc;;YACrB,MAAM,SAAS,GAAG,MAAC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CAAC,EAAC,GAAG,EAAE,MAAM,EAAC,CACtF,CAAA;YACD,GAAG,CAAC,SAAS,CACX;gBACE,MAAM;gBACN,SAAS,EAAE,EAAE;gBACb,UAAU,EAAE,aAAG;gBACf,YAAY,EAAE,OAAO;gBACrB,aAAa,EAAE,gBAAgB,GAAG,EAAE;aACrC,EACD,KAAK,CACN,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,SAAgB,MAAM,CAAC,MAAuB;IAC5C,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;QACxB,IAAI,GAAoB,CAAA;QACxB,IAAI,GAAG,KAAK,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC;YAAE,OAAO,IAAI,CAAA;KAC1F;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAND,wBAMC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/type.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/type.d.ts new file mode 100644 index 000000000..321f9aad1 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/type.d.ts @@ -0,0 +1,10 @@ +import type { CodeKeywordDefinition } from "../../types"; +import { _JTDTypeError } from "./error"; +export declare type JTDTypeError = _JTDTypeError<"type", JTDType, JTDType>; +export declare type IntType = "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32"; +export declare const intRange: { + [T in IntType]: [number, number, number]; +}; +export declare type JTDType = "boolean" | "string" | "timestamp" | "float32" | "float64" | IntType; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/type.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/type.js new file mode 100644 index 000000000..17a0b5107 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/type.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.intRange = void 0; +const codegen_1 = require("../../compile/codegen"); +const timestamp_1 = require("../../runtime/timestamp"); +const util_1 = require("../../compile/util"); +const metadata_1 = require("./metadata"); +const error_1 = require("./error"); +exports.intRange = { + int8: [-128, 127, 3], + uint8: [0, 255, 3], + int16: [-32768, 32767, 5], + uint16: [0, 65535, 5], + int32: [-2147483648, 2147483647, 10], + uint32: [0, 4294967295, 10], +}; +const error = { + message: (cxt) => (0, error_1.typeErrorMessage)(cxt, cxt.schema), + params: (cxt) => (0, error_1.typeErrorParams)(cxt, cxt.schema), +}; +function timestampCode(cxt) { + const { gen, data, it } = cxt; + const { timestamp, allowDate } = it.opts; + if (timestamp === "date") + return (0, codegen_1._) `${data} instanceof Date `; + const vts = (0, util_1.useFunc)(gen, timestamp_1.default); + const allowDateArg = allowDate ? (0, codegen_1._) `, true` : codegen_1.nil; + const validString = (0, codegen_1._) `typeof ${data} == "string" && ${vts}(${data}${allowDateArg})`; + return timestamp === "string" ? validString : (0, codegen_1.or)((0, codegen_1._) `${data} instanceof Date`, validString); +} +const def = { + keyword: "type", + schemaType: "string", + error, + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { data, schema, parentSchema, it } = cxt; + let cond; + switch (schema) { + case "boolean": + case "string": + cond = (0, codegen_1._) `typeof ${data} == ${schema}`; + break; + case "timestamp": { + cond = timestampCode(cxt); + break; + } + case "float32": + case "float64": + cond = (0, codegen_1._) `typeof ${data} == "number"`; + break; + default: { + const sch = schema; + cond = (0, codegen_1._) `typeof ${data} == "number" && isFinite(${data}) && !(${data} % 1)`; + if (!it.opts.int32range && (sch === "int32" || sch === "uint32")) { + if (sch === "uint32") + cond = (0, codegen_1._) `${cond} && ${data} >= 0`; + } + else { + const [min, max] = exports.intRange[sch]; + cond = (0, codegen_1._) `${cond} && ${data} >= ${min} && ${data} <= ${max}`; + } + } + } + cxt.pass(parentSchema.nullable ? (0, codegen_1.or)((0, codegen_1._) `${data} === null`, cond) : cond); + }, +}; +exports.default = def; +//# sourceMappingURL=type.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/type.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/type.js.map new file mode 100644 index 000000000..9d3393907 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/type.ts"],"names":[],"mappings":";;;AAEA,mDAAsD;AACtD,uDAAoD;AACpD,6CAA0C;AAC1C,yCAAwC;AACxC,mCAAwE;AAM3D,QAAA,QAAQ,GAA+C;IAClE,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IACpB,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAClB,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACzB,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACrB,KAAK,EAAE,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC;IACpC,MAAM,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,CAAC;CAC5B,CAAA;AAID,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,wBAAgB,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;IACnD,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,uBAAe,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;CAClD,CAAA;AAED,SAAS,aAAa,CAAC,GAAe;IACpC,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,EAAE,EAAC,GA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;gBACpC,MAAK;YACP,OAAO,CAAC,CAAC;gBACP,MAAM,GAAG,GAAG,MAAiB,CAAA;gBAC7B,IAAI,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,4BAA4B,IAAI,UAAU,IAAI,OAAO,CAAA;gBAC3E,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,QAAQ,CAAC,EAAE;oBAChE,IAAI,GAAG,KAAK,QAAQ;wBAAE,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,OAAO,IAAI,OAAO,CAAA;iBACxD;qBAAM;oBACL,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,gBAAQ,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,OAAO,IAAI,OAAO,GAAG,OAAO,IAAI,OAAO,GAAG,EAAE,CAAA;iBAC5D;aACF;SACF;QACD,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAA,YAAE,EAAC,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACxE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/union.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/union.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/union.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/union.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/union.js new file mode 100644 index 000000000..01a943994 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/union.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const def = { + keyword: "union", + schemaType: "array", + trackErrors: true, + code: code_1.validateUnion, + error: { message: "must match a schema in union" }, +}; +exports.default = def; +//# sourceMappingURL=union.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/union.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/union.js.map new file mode 100644 index 000000000..4d6eb4119 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/union.js.map @@ -0,0 +1 @@ +{"version":3,"file":"union.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/union.ts"],"names":[],"mappings":";;AACA,kCAAqC;AAErC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,IAAI;IACjB,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE,EAAC,OAAO,EAAE,8BAA8B,EAAC;CACjD,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/values.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/values.d.ts new file mode 100644 index 000000000..1ff367dfb --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/values.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition, SchemaObject } from "../../types"; +import { _JTDTypeError } from "./error"; +export declare type JTDValuesError = _JTDTypeError<"values", "object", SchemaObject>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/values.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/values.js new file mode 100644 index 000000000..e464c0be8 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/values.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const codegen_1 = require("../../compile/codegen"); +const metadata_1 = require("./metadata"); +const nullable_1 = require("./nullable"); +const error_1 = require("./error"); +const def = { + keyword: "values", + schemaType: "object", + error: (0, error_1.typeError)("object"), + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, schema, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + const [valid, cond] = (0, nullable_1.checkNullableObject)(cxt, data); + gen.if(cond); + gen.assign(valid, validateMap()); + gen.elseIf((0, codegen_1.not)(valid)); + cxt.error(); + gen.endIf(); + cxt.ok(valid); + function validateMap() { + const _valid = gen.name("valid"); + if (it.allErrors) { + const validMap = gen.let("valid", true); + validateValues(() => gen.assign(validMap, false)); + return validMap; + } + gen.var(_valid, true); + validateValues(() => gen.break()); + return _valid; + function validateValues(notValid) { + gen.forIn("key", data, (key) => { + cxt.subschema({ + keyword: "values", + dataProp: key, + dataPropType: util_1.Type.Str, + }, _valid); + gen.if((0, codegen_1.not)(_valid), notValid); + }); + } + } + }, +}; +exports.default = def; +//# sourceMappingURL=values.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/values.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/values.js.map new file mode 100644 index 000000000..8905b41c2 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/jtd/values.js.map @@ -0,0 +1 @@ +{"version":3,"file":"values.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/values.ts"],"names":[],"mappings":";;AAEA,6CAA0D;AAC1D,mDAA+C;AAC/C,yCAAwC;AACxC,yCAA8C;AAC9C,mCAAgD;AAIhD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,QAAQ;IACjB,UAAU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K,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;oBAC7B,GAAG,CAAC,SAAS,CACX;wBACE,OAAO,EAAE,QAAQ;wBACjB,QAAQ,EAAE,GAAG;wBACb,YAAY,EAAE,WAAI,CAAC,GAAG;qBACvB,EACD,MAAM,CACP,CAAA;oBACD,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAA;gBAC/B,CAAC,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/metadata.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/metadata.d.ts new file mode 100644 index 000000000..df9cc07ca --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/metadata.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../types"; +export declare const metadataVocabulary: Vocabulary; +export declare const contentVocabulary: Vocabulary; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/metadata.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/metadata.js new file mode 100644 index 000000000..f07bf28b5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/metadata.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.contentVocabulary = exports.metadataVocabulary = void 0; +exports.metadataVocabulary = [ + "title", + "description", + "default", + "deprecated", + "readOnly", + "writeOnly", + "examples", +]; +exports.contentVocabulary = [ + "contentMediaType", + "contentEncoding", + "contentSchema", +]; +//# sourceMappingURL=metadata.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/metadata.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/metadata.js.map new file mode 100644 index 000000000..0d61f0831 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/metadata.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../lib/vocabularies/metadata.ts"],"names":[],"mappings":";;;AAEa,QAAA,kBAAkB,GAAe;IAC5C,OAAO;IACP,aAAa;IACb,SAAS;IACT,YAAY;IACZ,UAAU;IACV,WAAW;IACX,UAAU;CACX,CAAA;AAEY,QAAA,iBAAiB,GAAe;IAC3C,kBAAkB;IAClB,iBAAiB;IACjB,eAAe;CAChB,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/next.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/next.d.ts new file mode 100644 index 000000000..7fd5c644b --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/next.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../types"; +declare const next: Vocabulary; +export default next; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/next.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/next.js new file mode 100644 index 000000000..c861b3243 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/next.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dependentRequired_1 = require("./validation/dependentRequired"); +const dependentSchemas_1 = require("./applicator/dependentSchemas"); +const limitContains_1 = require("./validation/limitContains"); +const next = [dependentRequired_1.default, dependentSchemas_1.default, limitContains_1.default]; +exports.default = next; +//# sourceMappingURL=next.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/next.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/next.js.map new file mode 100644 index 000000000..474a6d4e7 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/next.js.map @@ -0,0 +1 @@ +{"version":3,"file":"next.js","sourceRoot":"","sources":["../../lib/vocabularies/next.ts"],"names":[],"mappings":";;AACA,sEAA8D;AAC9D,oEAA4D;AAC5D,8DAAsD;AAEtD,MAAM,IAAI,GAAe,CAAC,2BAAiB,EAAE,0BAAgB,EAAE,uBAAa,CAAC,CAAA;AAE7E,kBAAe,IAAI,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts new file mode 100644 index 000000000..ec67e63ea --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../../types"; +declare const unevaluated: Vocabulary; +export default unevaluated; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/index.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/index.js new file mode 100644 index 000000000..30e316748 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/index.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const unevaluatedProperties_1 = require("./unevaluatedProperties"); +const unevaluatedItems_1 = require("./unevaluatedItems"); +const unevaluated = [unevaluatedProperties_1.default, unevaluatedItems_1.default]; +exports.default = unevaluated; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map new file mode 100644 index 000000000..a4872ea43 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/unevaluated/index.ts"],"names":[],"mappings":";;AACA,mEAA2D;AAC3D,yDAAiD;AAEjD,MAAM,WAAW,GAAe,CAAC,+BAAqB,EAAE,0BAAgB,CAAC,CAAA;AAEzE,kBAAe,WAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts new file mode 100644 index 000000000..f108b6e4e --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export declare type UnevaluatedItemsError = ErrorObject<"unevaluatedItems", { + limit: number; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js new file mode 100644 index 000000000..0a0cd3aa4 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params: { len } }) => (0, codegen_1.str) `must NOT have more than ${len} items`, + params: ({ params: { len } }) => (0, codegen_1._) `{limit: ${len}}`, +}; +const def = { + keyword: "unevaluatedItems", + type: "array", + schemaType: ["boolean", "object"], + error, + code(cxt) { + const { gen, schema, data, it } = cxt; + const items = it.items || 0; + if (items === true) + return; + const len = gen.const("len", (0, codegen_1._) `${data}.length`); + if (schema === false) { + cxt.setParams({ len: items }); + cxt.fail((0, codegen_1._) `${len} > ${items}`); + } + else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) { + const valid = gen.var("valid", (0, codegen_1._) `${len} <= ${items}`); + gen.if((0, codegen_1.not)(valid), () => validateItems(valid, items)); + cxt.ok(valid); + } + it.items = true; + function validateItems(valid, from) { + gen.forRange("i", from, len, (i) => { + cxt.subschema({ keyword: "unevaluatedItems", dataProp: i, dataPropType: util_1.Type.Num }, valid); + if (!it.allErrors) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + }); + } + }, +}; +exports.default = def; +//# sourceMappingURL=unevaluatedItems.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map new file mode 100644 index 000000000..a8268f031 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map @@ -0,0 +1 @@ +{"version":3,"file":"unevaluatedItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/unevaluated/unevaluatedItems.ts"],"names":[],"mappings":";;AAOA,mDAAuD;AACvD,6CAA0D;AAI1D,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,2BAA2B,GAAG,QAAQ;IACvE,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,GAAG,GAAG;CAChD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;IACjC,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK,IAAI,CAAC,CAAA;QAC3B,IAAI,KAAK,KAAK,IAAI;YAAE,OAAM;QAC1B,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CA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GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts new file mode 100644 index 000000000..0a041ff75 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export declare type UnevaluatedPropertiesError = ErrorObject<"unevaluatedProperties", { + unevaluatedProperty: string; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js new file mode 100644 index 000000000..ad298499f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js @@ -0,0 +1,65 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const names_1 = require("../../compile/names"); +const error = { + message: "must NOT have unevaluated properties", + params: ({ params }) => (0, codegen_1._) `{unevaluatedProperty: ${params.unevaluatedProperty}}`, +}; +const def = { + keyword: "unevaluatedProperties", + type: "object", + schemaType: ["boolean", "object"], + trackErrors: true, + error, + code(cxt) { + const { gen, schema, data, errsCount, it } = cxt; + /* istanbul ignore if */ + if (!errsCount) + throw new Error("ajv implementation error"); + const { allErrors, props } = it; + if (props instanceof codegen_1.Name) { + gen.if((0, codegen_1._) `${props} !== true`, () => gen.forIn("key", data, (key) => gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key)))); + } + else if (props !== true) { + gen.forIn("key", data, (key) => props === undefined + ? unevaluatedPropCode(key) + : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key))); + } + it.props = true; + cxt.ok((0, codegen_1._) `${errsCount} === ${names_1.default.errors}`); + function unevaluatedPropCode(key) { + if (schema === false) { + cxt.setParams({ unevaluatedProperty: key }); + cxt.error(); + if (!allErrors) + gen.break(); + return; + } + if (!(0, util_1.alwaysValidSchema)(it, schema)) { + const valid = gen.name("valid"); + cxt.subschema({ + keyword: "unevaluatedProperties", + dataProp: key, + dataPropType: util_1.Type.Str, + }, valid); + if (!allErrors) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + } + } + function unevaluatedDynamic(evaluatedProps, key) { + return (0, codegen_1._) `!${evaluatedProps} || !${evaluatedProps}[${key}]`; + } + function unevaluatedStatic(evaluatedProps, key) { + const ps = []; + for (const p in evaluatedProps) { + if (evaluatedProps[p] === true) + ps.push((0, codegen_1._) `${key} !== ${p}`); + } + return (0, codegen_1.and)(...ps); + } + }, +}; +exports.default = def; +//# sourceMappingURL=unevaluatedProperties.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map new file mode 100644 index 000000000..f415251ee --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"unevaluatedProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/unevaluated/unevaluatedProperties.ts"],"names":[],"mappings":";;AAMA,mDAA6D;AAC7D,6CAA0D;AAC1D,+CAAmC;AAQnC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,sCAAsC;IAC/C,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,yBAAyB,MAAM,CAAC,mBAAmB,GAAG;CAC9E,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,uBAAuB;IAChC,IAAI,EAAE,QAAQ;IACd,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ularies/validation/const.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/const.d.ts new file mode 100644 index 000000000..85e11ce52 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/const.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export declare type ConstError = ErrorObject<"const", { + allowedValue: any; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/const.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/const.js new file mode 100644 index 000000000..9564496a6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/const.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const equal_1 = require("../../runtime/equal"); +const error = { + message: "must be equal to constant", + params: ({ schemaCode }) => (0, codegen_1._) `{allowedValue: ${schemaCode}}`, +}; +const def = { + keyword: "const", + $data: true, + error, + code(cxt) { + const { gen, data, $data, schemaCode, schema } = cxt; + if ($data || (schema && typeof schema == "object")) { + cxt.fail$data((0, codegen_1._) `!${(0, util_1.useFunc)(gen, equal_1.default)}(${data}, ${schemaCode})`); + } + else { + cxt.fail((0, codegen_1._) `${schema} !== ${data}`); + } + }, +}; +exports.default = def; +//# sourceMappingURL=const.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/const.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/const.js.map new file mode 100644 index 000000000..0cf6cd14c --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/const.js.map @@ -0,0 +1 @@ +{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/const.ts"],"names":[],"mappings":";;AAEA,mDAAuC;AACvC,6CAA0C;AAC1C,+CAAuC;AAIvC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,2BAA2B;IACpC,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,kBAAkB,UAAU,GAAG;CAC3D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;QAClD,IAAI,KAAK,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,IAAI,QAAQ,CAAC,EAAE;YAClD,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,IAAI,IAAA,cAAO,EAAC,GAAG,EAAE,eAAK,CAAC,IAAI,IAAI,KAAK,UAAU,GAAG,CAAC,CAAA;SAClE;aAAM;YACL,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,MAAM,QAAQ,IAAI,EAAE,CAAC,CAAA;SACnC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts new file mode 100644 index 000000000..2e25408e6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +import { DependenciesErrorParams, PropertyDependencies } from "../applicator/dependencies"; +export declare type DependentRequiredError = ErrorObject<"dependentRequired", DependenciesErrorParams, PropertyDependencies>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js new file mode 100644 index 000000000..09e59639f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dependencies_1 = require("../applicator/dependencies"); +const def = { + keyword: "dependentRequired", + type: "object", + schemaType: "object", + error: dependencies_1.error, + code: (cxt) => (0, dependencies_1.validatePropertyDeps)(cxt), +}; +exports.default = def; +//# sourceMappingURL=dependentRequired.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map new file mode 100644 index 000000000..c7e88f885 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dependentRequired.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/dependentRequired.ts"],"names":[],"mappings":";;AACA,6DAKmC;AAQnC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,mBAAmB;IAC5B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAL,oBAAK;IACL,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,mCAAoB,EAAC,GAAG,CAAC;CACzC,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/enum.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/enum.d.ts new file mode 100644 index 000000000..dce653b56 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/enum.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export declare type EnumError = ErrorObject<"enum", { + allowedValues: any[]; +}, any[] | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/enum.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/enum.js new file mode 100644 index 000000000..eab6487e9 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/enum.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const equal_1 = require("../../runtime/equal"); +const error = { + message: "must be equal to one of the allowed values", + params: ({ schemaCode }) => (0, codegen_1._) `{allowedValues: ${schemaCode}}`, +}; +const def = { + keyword: "enum", + schemaType: "array", + $data: true, + error, + code(cxt) { + const { gen, data, $data, schema, schemaCode, it } = cxt; + if (!$data && schema.length === 0) + throw new Error("enum must have non-empty array"); + const useLoop = schema.length >= it.opts.loopEnum; + let eql; + const getEql = () => (eql !== null && eql !== void 0 ? eql : (eql = (0, util_1.useFunc)(gen, equal_1.default))); + let valid; + if (useLoop || $data) { + valid = gen.let("valid"); + cxt.block$data(valid, loopEnum); + } + else { + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + const vSchema = gen.const("vSchema", schemaCode); + valid = (0, codegen_1.or)(...schema.map((_x, i) => equalCode(vSchema, i))); + } + cxt.pass(valid); + function loopEnum() { + gen.assign(valid, false); + gen.forOf("v", schemaCode, (v) => gen.if((0, codegen_1._) `${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break())); + } + function equalCode(vSchema, i) { + const sch = schema[i]; + return typeof sch === "object" && sch !== null + ? (0, codegen_1._) `${getEql()}(${data}, ${vSchema}[${i}])` + : (0, codegen_1._) `${data} === ${sch}`; + } + }, +}; +exports.default = def; +//# sourceMappingURL=enum.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/enum.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/enum.js.map new file mode 100644 index 000000000..7b4e1eda9 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/enum.js.map @@ -0,0 +1 @@ +{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/enum.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AACvD,6CAA0C;AAC1C,+CAAuC;AAIvC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,4CAA4C;IACrD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,mBAAmB,UAAU,GAAG;CAC5D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,OAAO;IACnB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACtD,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QACpF,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAA;QACjD,IAAI,GAAqB,CAAA;QACzB,MAAM,MAAM,GAAG,GAAS,EAAE,CAAC,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,IAAH,GAAG,GAAK,IAAA,cAAO,EAAC,GAAG,EAAE,eAAK,CAAC,EAAC,CAAA;QAExD,IAAI,KAAW,CAAA;QACf,IAAI,OAAO,IAAI,KAAK,EAAE;YACpB,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YACxB,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;SAChC;aAAM;YACL,wBAAwB;YACxB,IAAI,CAAC,K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ules/ajv/dist/vocabularies/validation/index.d.ts new file mode 100644 index 000000000..08cd22396 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/index.d.ts @@ -0,0 +1,16 @@ +import type { ErrorObject, Vocabulary } from "../../types"; +import { LimitNumberError } from "./limitNumber"; +import { MultipleOfError } from "./multipleOf"; +import { PatternError } from "./pattern"; +import { RequiredError } from "./required"; +import { UniqueItemsError } from "./uniqueItems"; +import { ConstError } from "./const"; +import { EnumError } from "./enum"; +declare const validation: Vocabulary; +export default validation; +declare type LimitError = ErrorObject<"maxItems" | "minItems" | "minProperties" | "maxProperties" | "minLength" | "maxLength", { + limit: number; +}, number | { + $data: string; +}>; +export declare type ValidationKeywordError = LimitError | LimitNumberError | MultipleOfError | PatternError | RequiredError | UniqueItemsError | ConstError | EnumError; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/index.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/index.js new file mode 100644 index 000000000..7b56b4e45 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/index.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const limitNumber_1 = require("./limitNumber"); +const multipleOf_1 = require("./multipleOf"); +const limitLength_1 = require("./limitLength"); +const pattern_1 = require("./pattern"); +const limitProperties_1 = require("./limitProperties"); +const required_1 = require("./required"); +const limitItems_1 = require("./limitItems"); +const uniqueItems_1 = require("./uniqueItems"); +const const_1 = require("./const"); +const enum_1 = require("./enum"); +const validation = [ + // number + limitNumber_1.default, + multipleOf_1.default, + // string + limitLength_1.default, + pattern_1.default, + // object + limitProperties_1.default, + required_1.default, + // array + limitItems_1.default, + uniqueItems_1.default, + // any + { keyword: "type", schemaType: ["string", "array"] }, + { keyword: "nullable", schemaType: "boolean" }, + const_1.default, + enum_1.default, +]; +exports.default = validation; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/index.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/index.js.map new file mode 100644 index 000000000..69436fb32 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/index.ts"],"names":[],"mappings":";;AACA,+CAA2D;AAC3D,6CAAwD;AACxD,+CAAuC;AACvC,uCAA+C;AAC/C,uDAA+C;AAC/C,yCAAkD;AAClD,6CAAqC;AACrC,+CAA2D;AAC3D,mCAAgD;AAChD,iCAA6C;AAE7C,MAAM,UAAU,GAAe;IAC7B,SAAS;IACT,qBAAW;IACX,oBAAU;IACV,SAAS;IACT,qBAAW;IACX,iBAAO;IACP,SAAS;IACT,yBAAe;IACf,kBAAQ;IACR,QAAQ;IACR,oBAAU;IACV,qBAAW;IACX,MAAM;IACN,EAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAC;IAClD,EAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAC;IAC5C,eAAY;IACZ,cAAW;CACZ,CAAA;AAED,kBAAe,UAAU,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitContains.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitContains.js new file mode 100644 index 000000000..c884dae4b --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitContains.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const def = { + keyword: ["maxContains", "minContains"], + type: "array", + schemaType: "number", + code({ keyword, parentSchema, it }) { + if (parentSchema.contains === undefined) { + (0, util_1.checkStrictMode)(it, `"${keyword}" without "contains" is ignored`); + } + }, +}; +exports.default = def; +//# sourceMappingURL=limitContains.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map new file mode 100644 index 000000000..788010aa9 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map @@ -0,0 +1 @@ +{"version":3,"file":"limitContains.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitContains.ts"],"names":[],"mappings":";;AAEA,6CAAkD;AAElD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,aAAa,EAAE,aAAa,CAAC;IACvC,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,EAAC,OAAO,EAAE,YAAY,EAAE,EAAE,EAAa;QAC1C,IAAI,YAAY,CAAC,QAAQ,KAAK,SAAS,EAAE;YACvC,IAAA,sBAAe,EAAC,EAAE,EAAE,IAAI,OAAO,iCAAiC,CAAC,CAAA;SAClE;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitItems.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitItems.js new file mode 100644 index 000000000..e1386f887 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitItems.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const error = { + message({ keyword, schemaCode }) { + const comp = keyword === "maxItems" ? "more" : "fewer"; + return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} items`; + }, + params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`, +}; +const def = { + keyword: ["maxItems", "minItems"], + type: "array", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT; + cxt.fail$data((0, codegen_1._) `${data}.length ${op} ${schemaCode}`); + }, +}; +exports.default = def; +//# sourceMappingURL=limitItems.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map new file mode 100644 index 000000000..690c73456 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map @@ -0,0 +1 @@ +{"version":3,"file":"limitItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitItems.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AAEvD,MAAM,KAAK,GAA2B;IACpC,OAAO,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;QACtD,OAAO,IAAA,aAAG,EAAA,iBAAiB,IAAI,SAAS,UAAU,QAAQ,CAAA;IAC5D,CAAC;IACD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,UAAU,GAAG;CACpD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC;IACjC,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAC,GAAG,GAAG,CAAA;QACvC,MAAM,EAAE,GAAG,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAA;QAC/D,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,EAAE,IAAI,UAAU,EAAE,CAAC,CAAA;IACtD,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitLength.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitLength.js new file mode 100644 index 000000000..6ae5f92e6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitLength.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const ucs2length_1 = require("../../runtime/ucs2length"); +const error = { + message({ keyword, schemaCode }) { + const comp = keyword === "maxLength" ? "more" : "fewer"; + return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} characters`; + }, + params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`, +}; +const def = { + keyword: ["maxLength", "minLength"], + type: "string", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode, it } = cxt; + const op = keyword === "maxLength" ? codegen_1.operators.GT : codegen_1.operators.LT; + const len = it.opts.unicode === false ? (0, codegen_1._) `${data}.length` : (0, codegen_1._) `${(0, util_1.useFunc)(cxt.gen, ucs2length_1.default)}(${data})`; + cxt.fail$data((0, codegen_1._) `${len} ${op} ${schemaCode}`); + }, +}; +exports.default = def; +//# sourceMappingURL=limitLength.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map new file mode 100644 index 000000000..f09c35e54 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map @@ -0,0 +1 @@ +{"version":3,"file":"limitLength.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitLength.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AACvD,6CAA0C;AAC1C,yDAAiD;AAEjD,MAAM,KAAK,GAA2B;IACpC,OAAO,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;QACvD,OAAO,IAAA,aAAG,EAAA,iBAAiB,IAAI,SAAS,UAAU,aAAa,CAAA;IACjE,CAAC;IACD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,UAAU,GAAG;CACpD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC;IACnC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC3C,MAAM,EAAE,GAAG,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAA;QAChE,MAAM,GAAG,GACP,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,IAAA,cAAO,EAAC,GAAG,CAAC,GAAG,EAAE,oBAAU,CAAC,IAAI,IAAI,GAAG,CAAA;QAC7F,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,IAAI,EAAE,IAAI,UAAU,EAAE,CAAC,CAAA;IAC9C,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts new file mode 100644 index 000000000..2d3890855 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts @@ -0,0 +1,11 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +declare type Kwd = "maximum" | "minimum" | "exclusiveMaximum" | "exclusiveMinimum"; +declare type Comparison = "<=" | ">=" | "<" | ">"; +export declare type LimitNumberError = ErrorObject; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitNumber.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitNumber.js new file mode 100644 index 000000000..a97c0eb9d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitNumber.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const ops = codegen_1.operators; +const KWDs = { + maximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT }, + minimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT }, + exclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE }, + exclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }, +}; +const error = { + message: ({ keyword, schemaCode }) => (0, codegen_1.str) `must be ${KWDs[keyword].okStr} ${schemaCode}`, + params: ({ keyword, schemaCode }) => (0, codegen_1._) `{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`, +}; +const def = { + keyword: Object.keys(KWDs), + type: "number", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + cxt.fail$data((0, codegen_1._) `${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`); + }, +}; +exports.default = def; +//# sourceMappingURL=limitNumber.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map new file mode 100644 index 000000000..18a365337 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map @@ -0,0 +1 @@ +{"version":3,"file":"limitNumber.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitNumber.ts"],"names":[],"mappings":";;AAEA,mDAA6D;AAE7D,MAAM,GAAG,GAAG,mBAAS,CAAA;AAMrB,MAAM,IAAI,GAA4D;IACpE,OAAO,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,G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 No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitProperties.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitProperties.js new file mode 100644 index 000000000..e6fc40cc6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitProperties.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const error = { + message({ keyword, schemaCode }) { + const comp = keyword === "maxProperties" ? "more" : "fewer"; + return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} properties`; + }, + params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`, +}; +const def = { + keyword: ["maxProperties", "minProperties"], + type: "object", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + const op = keyword === "maxProperties" ? codegen_1.operators.GT : codegen_1.operators.LT; + cxt.fail$data((0, codegen_1._) `Object.keys(${data}).length ${op} ${schemaCode}`); + }, +}; +exports.default = def; +//# sourceMappingURL=limitProperties.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map new file mode 100644 index 000000000..a695943a9 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"limitProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitProperties.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AAEvD,MAAM,KAAK,GAA2B;IACpC,OAAO,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;QAC3D,OAAO,IAAA,aAAG,EAAA,iBAAiB,IAAI,SAAS,UAAU,aAAa,CAAA;IACjE,CAAC;IACD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,UAAU,GAAG;CACpD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;IAC3C,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAC,GAAG,GAAG,CAAA;QACvC,MAAM,EAAE,GAAG,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAA;QACpE,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,eAAe,IAAI,YAAY,EAAE,IAAI,UAAU,EAAE,CAAC,CAAA;IACnE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts new file mode 100644 index 000000000..afa29d357 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export declare type MultipleOfError = ErrorObject<"multipleOf", { + multipleOf: number; +}, number | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/multipleOf.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/multipleOf.js new file mode 100644 index 000000000..43cf67b77 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/multipleOf.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const error = { + message: ({ schemaCode }) => (0, codegen_1.str) `must be multiple of ${schemaCode}`, + params: ({ schemaCode }) => (0, codegen_1._) `{multipleOf: ${schemaCode}}`, +}; +const def = { + keyword: "multipleOf", + type: "number", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { gen, data, schemaCode, it } = cxt; + // const bdt = bad$DataType(schemaCode, def.schemaType, $data) + const prec = it.opts.multipleOfPrecision; + const res = gen.let("res"); + const invalid = prec + ? (0, codegen_1._) `Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` + : (0, codegen_1._) `${res} !== parseInt(${res})`; + cxt.fail$data((0, codegen_1._) `(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid}))`); + }, +}; +exports.default = def; +//# sourceMappingURL=multipleOf.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map new file mode 100644 index 000000000..9ef825b74 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"multipleOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/multipleOf.ts"],"names":[],"mappings":";;AAEA,mDAA4C;AAQ5C,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,uBAAuB,UAAU,EAAE;IACjE,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,gBAAgB,UAAU,GAAG;CACzD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,YAAY;IACrB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACvC,sEAAsE;QACtE,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAA;QACxC,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAC1B,MAAM,OAAO,GAAG,IAAI;YAClB,CAAC,CAAC,IAAA,WAAC,EAAA,uBAAuB,GAAG,OAAO,GAAG,UAAU,IAAI,EAAE;YACvD,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,iBAAiB,GAAG,GAAG,CAAA;QAClC,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,IAAI,UAAU,cAAc,GAAG,MAAM,IAAI,IAAI,UAAU,KAAK,OAAO,IAAI,CAAC,CAAA;IACzF,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts new file mode 100644 index 000000000..bf232ffc6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export declare type PatternError = ErrorObject<"pattern", { + pattern: string; +}, string | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/pattern.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/pattern.js new file mode 100644 index 000000000..f8ccdf295 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/pattern.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const error = { + message: ({ schemaCode }) => (0, codegen_1.str) `must match pattern "${schemaCode}"`, + params: ({ schemaCode }) => (0, codegen_1._) `{pattern: ${schemaCode}}`, +}; +const def = { + keyword: "pattern", + type: "string", + schemaType: "string", + $data: true, + error, + code(cxt) { + const { data, $data, schema, schemaCode, it } = cxt; + // TODO regexp should be wrapped in try/catchs + const u = it.opts.unicodeRegExp ? "u" : ""; + const regExp = $data ? (0, codegen_1._) `(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema); + cxt.fail$data((0, codegen_1._) `!${regExp}.test(${data})`); + }, +}; +exports.default = def; +//# sourceMappingURL=pattern.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/pattern.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/pattern.js.map new file mode 100644 index 000000000..82fa5d74c --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/pattern.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pattern.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/pattern.ts"],"names":[],"mappings":";;AAEA,kCAAkC;AAClC,mDAA4C;AAI5C,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,uBAAuB,UAAU,GAAG;IAClE,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,aAAa,UAAU,GAAG;CACtD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACjD,8CAA8C;QAC9C,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;QAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,eAAe,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,iBAAU,EAAC,GAAG,EAAE,MAAM,CAAC,CAAA;QACrF,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,IAAI,MAAM,SAAS,IAAI,GAAG,CAAC,CAAA;IAC5C,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/required.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/required.d.ts new file mode 100644 index 000000000..fe94d04ae --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/required.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export declare type RequiredError = ErrorObject<"required", { + missingProperty: string; +}, string[] | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/required.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/required.js new file mode 100644 index 000000000..1d8e29263 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/required.js @@ -0,0 +1,79 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params: { missingProperty } }) => (0, codegen_1.str) `must have required property '${missingProperty}'`, + params: ({ params: { missingProperty } }) => (0, codegen_1._) `{missingProperty: ${missingProperty}}`, +}; +const def = { + keyword: "required", + type: "object", + schemaType: "array", + $data: true, + error, + code(cxt) { + const { gen, schema, schemaCode, data, $data, it } = cxt; + const { opts } = it; + if (!$data && schema.length === 0) + return; + const useLoop = schema.length >= opts.loopRequired; + if (it.allErrors) + allErrorsMode(); + else + exitOnErrorMode(); + if (opts.strictRequired) { + const props = cxt.parentSchema.properties; + const { definedProperties } = cxt.it; + for (const requiredKey of schema) { + if ((props === null || props === void 0 ? void 0 : props[requiredKey]) === undefined && !definedProperties.has(requiredKey)) { + const schemaPath = it.schemaEnv.baseId + it.errSchemaPath; + const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)`; + (0, util_1.checkStrictMode)(it, msg, it.opts.strictRequired); + } + } + } + function allErrorsMode() { + if (useLoop || $data) { + cxt.block$data(codegen_1.nil, loopAllRequired); + } + else { + for (const prop of schema) { + (0, code_1.checkReportMissingProp)(cxt, prop); + } + } + } + function exitOnErrorMode() { + const missing = gen.let("missing"); + if (useLoop || $data) { + const valid = gen.let("valid", true); + cxt.block$data(valid, () => loopUntilMissing(missing, valid)); + cxt.ok(valid); + } + else { + gen.if((0, code_1.checkMissingProp)(cxt, schema, missing)); + (0, code_1.reportMissingProp)(cxt, missing); + gen.else(); + } + } + function loopAllRequired() { + gen.forOf("prop", schemaCode, (prop) => { + cxt.setParams({ missingProperty: prop }); + gen.if((0, code_1.noPropertyInData)(gen, data, prop, opts.ownProperties), () => cxt.error()); + }); + } + function loopUntilMissing(missing, valid) { + cxt.setParams({ missingProperty: missing }); + gen.forOf(missing, schemaCode, () => { + gen.assign(valid, (0, code_1.propertyInData)(gen, data, missing, opts.ownProperties)); + gen.if((0, codegen_1.not)(valid), () => { + cxt.error(); + gen.break(); + }); + }, codegen_1.nil); + } + }, +}; +exports.default = def; +//# sourceMappingURL=required.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/required.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/required.js.map new file mode 100644 index 000000000..0fcbee588 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/required.js.map @@ -0,0 +1 @@ +{"version":3,"file":"required.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/required.ts"],"names":[],"mappings":";;AAEA,kCAMgB;AAChB,mDAAkE;AAClE,6CAAkD;AAQlD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,eAAe,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,gCAAgC,eAAe,GAAG;IAC/F,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,eAAe,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,qBAAqB,eAAe,GAAG;CAClF,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,OAAO;IACnB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACtD,MAAM,EAAC,IAAI,EAAC,GAAG,EAAE,CAAA;QACjB,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAM;QACzC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,YAAY,CAAA;QAClD,IAAI,EAA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"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts new file mode 100644 index 000000000..c4f4b4ca7 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts @@ -0,0 +1,9 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export declare type UniqueItemsError = ErrorObject<"uniqueItems", { + i: number; + j: number; +}, boolean | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js new file mode 100644 index 000000000..cdbecea12 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dataType_1 = require("../../compile/validate/dataType"); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const equal_1 = require("../../runtime/equal"); +const error = { + message: ({ params: { i, j } }) => (0, codegen_1.str) `must NOT have duplicate items (items ## ${j} and ${i} are identical)`, + params: ({ params: { i, j } }) => (0, codegen_1._) `{i: ${i}, j: ${j}}`, +}; +const def = { + keyword: "uniqueItems", + type: "array", + schemaType: "boolean", + $data: true, + error, + code(cxt) { + const { gen, data, $data, schema, parentSchema, schemaCode, it } = cxt; + if (!$data && !schema) + return; + const valid = gen.let("valid"); + const itemTypes = parentSchema.items ? (0, dataType_1.getSchemaTypes)(parentSchema.items) : []; + cxt.block$data(valid, validateUniqueItems, (0, codegen_1._) `${schemaCode} === false`); + cxt.ok(valid); + function validateUniqueItems() { + const i = gen.let("i", (0, codegen_1._) `${data}.length`); + const j = gen.let("j"); + cxt.setParams({ i, j }); + gen.assign(valid, true); + gen.if((0, codegen_1._) `${i} > 1`, () => (canOptimize() ? loopN : loopN2)(i, j)); + } + function canOptimize() { + return itemTypes.length > 0 && !itemTypes.some((t) => t === "object" || t === "array"); + } + function loopN(i, j) { + const item = gen.name("item"); + const wrongType = (0, dataType_1.checkDataTypes)(itemTypes, item, it.opts.strictNumbers, dataType_1.DataType.Wrong); + const indices = gen.const("indices", (0, codegen_1._) `{}`); + gen.for((0, codegen_1._) `;${i}--;`, () => { + gen.let(item, (0, codegen_1._) `${data}[${i}]`); + gen.if(wrongType, (0, codegen_1._) `continue`); + if (itemTypes.length > 1) + gen.if((0, codegen_1._) `typeof ${item} == "string"`, (0, codegen_1._) `${item} += "_"`); + gen + .if((0, codegen_1._) `typeof ${indices}[${item}] == "number"`, () => { + gen.assign(j, (0, codegen_1._) `${indices}[${item}]`); + cxt.error(); + gen.assign(valid, false).break(); + }) + .code((0, codegen_1._) `${indices}[${item}] = ${i}`); + }); + } + function loopN2(i, j) { + const eql = (0, util_1.useFunc)(gen, equal_1.default); + const outer = gen.name("outer"); + gen.label(outer).for((0, codegen_1._) `;${i}--;`, () => gen.for((0, codegen_1._) `${j} = ${i}; ${j}--;`, () => gen.if((0, codegen_1._) `${eql}(${data}[${i}], ${data}[${j}])`, () => { + cxt.error(); + gen.assign(valid, false).break(outer); + }))); + } + }, +}; +exports.default = def; +//# sourceMappingURL=uniqueItems.js.map \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map new file mode 100644 index 000000000..46eb7a2a0 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uniqueItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/uniqueItems.ts"],"names":[],"mappings":";;AAEA,8DAAwF;AACxF,mDAAkD;AAClD,6CAA0C;AAC1C,+CAAuC;AAQvC,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AC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/2019.ts b/node_modules/ajv-formats/node_modules/ajv/lib/2019.ts new file mode 100644 index 000000000..0311c4d09 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/2019.ts @@ -0,0 +1,78 @@ +import type {AnySchemaObject} from "./types" +import AjvCore, {Options} from "./core" + +import draft7Vocabularies from "./vocabularies/draft7" +import dynamicVocabulary from "./vocabularies/dynamic" +import nextVocabulary from "./vocabularies/next" +import unevaluatedVocabulary from "./vocabularies/unevaluated" +import discriminator from "./vocabularies/discriminator" +import addMetaSchema2019 from "./refs/json-schema-2019-09" + +const META_SCHEMA_ID = "https://json-schema.org/draft/2019-09/schema" + +class Ajv2019 extends AjvCore { + constructor(opts: Options = {}) { + super({ + ...opts, + dynamicRef: true, + next: true, + unevaluated: true, + }) + } + + _addVocabularies(): void { + super._addVocabularies() + this.addVocabulary(dynamicVocabulary) + draft7Vocabularies.forEach((v) => this.addVocabulary(v)) + this.addVocabulary(nextVocabulary) + this.addVocabulary(unevaluatedVocabulary) + if (this.opts.discriminator) this.addKeyword(discriminator) + } + + _addDefaultMetaSchema(): void { + super._addDefaultMetaSchema() + const {$data, meta} = this.opts + if (!meta) return + addMetaSchema2019.call(this, $data) + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID + } + + defaultMeta(): string | AnySchemaObject | undefined { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)) + } +} + +module.exports = exports = Ajv2019 +Object.defineProperty(exports, "__esModule", {value: true}) + +export default Ajv2019 + +export { + Format, + FormatDefinition, + AsyncFormatDefinition, + KeywordDefinition, + KeywordErrorDefinition, + CodeKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, + Vocabulary, + Schema, + SchemaObject, + AnySchemaObject, + AsyncSchema, + AnySchema, + ValidateFunction, + AsyncValidateFunction, + ErrorObject, + ErrorNoParams, +} from "./types" + +export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core" +export {SchemaCxt, SchemaObjCxt} from "./compile" +export {KeywordCxt} from "./compile/validate" +export {DefinedError} from "./vocabularies/errors" +export {JSONType} from "./compile/rules" +export {JSONSchemaType} from "./types/json-schema" +export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/2020.ts b/node_modules/ajv-formats/node_modules/ajv/lib/2020.ts new file mode 100644 index 000000000..beff5c7bd --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/2020.ts @@ -0,0 +1,72 @@ +import type {AnySchemaObject} from "./types" +import AjvCore, {Options} from "./core" + +import draft2020Vocabularies from "./vocabularies/draft2020" +import discriminator from "./vocabularies/discriminator" +import addMetaSchema2020 from "./refs/json-schema-2020-12" + +const META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema" + +class Ajv2020 extends AjvCore { + constructor(opts: Options = {}) { + super({ + ...opts, + dynamicRef: true, + next: true, + unevaluated: true, + }) + } + + _addVocabularies(): void { + super._addVocabularies() + draft2020Vocabularies.forEach((v) => this.addVocabulary(v)) + if (this.opts.discriminator) this.addKeyword(discriminator) + } + + _addDefaultMetaSchema(): void { + super._addDefaultMetaSchema() + const {$data, meta} = this.opts + if (!meta) return + addMetaSchema2020.call(this, $data) + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID + } + + defaultMeta(): string | AnySchemaObject | undefined { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)) + } +} + +module.exports = exports = Ajv2020 +Object.defineProperty(exports, "__esModule", {value: true}) + +export default Ajv2020 + +export { + Format, + FormatDefinition, + AsyncFormatDefinition, + KeywordDefinition, + KeywordErrorDefinition, + CodeKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, + Vocabulary, + Schema, + SchemaObject, + AnySchemaObject, + AsyncSchema, + AnySchema, + ValidateFunction, + AsyncValidateFunction, + ErrorObject, + ErrorNoParams, +} from "./types" + +export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core" +export {SchemaCxt, SchemaObjCxt} from "./compile" +export {KeywordCxt} from "./compile/validate" +export {DefinedError} from "./vocabularies/errors" +export {JSONType} from "./compile/rules" +export {JSONSchemaType} from "./types/json-schema" +export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/ajv.ts b/node_modules/ajv-formats/node_modules/ajv/lib/ajv.ts new file mode 100644 index 000000000..bbfa5a4e5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/ajv.ts @@ -0,0 +1,67 @@ +import type {AnySchemaObject} from "./types" +import AjvCore from "./core" +import draft7Vocabularies from "./vocabularies/draft7" +import discriminator from "./vocabularies/discriminator" +import * as draft7MetaSchema from "./refs/json-schema-draft-07.json" + +const META_SUPPORT_DATA = ["/properties"] + +const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema" + +class Ajv extends AjvCore { + _addVocabularies(): void { + super._addVocabularies() + draft7Vocabularies.forEach((v) => this.addVocabulary(v)) + if (this.opts.discriminator) this.addKeyword(discriminator) + } + + _addDefaultMetaSchema(): void { + super._addDefaultMetaSchema() + if (!this.opts.meta) return + const metaSchema = this.opts.$data + ? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA) + : draft7MetaSchema + this.addMetaSchema(metaSchema, META_SCHEMA_ID, false) + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID + } + + defaultMeta(): string | AnySchemaObject | undefined { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)) + } +} + +module.exports = exports = Ajv +Object.defineProperty(exports, "__esModule", {value: true}) + +export default Ajv + +export { + Format, + FormatDefinition, + AsyncFormatDefinition, + KeywordDefinition, + KeywordErrorDefinition, + CodeKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, + Vocabulary, + Schema, + SchemaObject, + AnySchemaObject, + AsyncSchema, + AnySchema, + ValidateFunction, + AsyncValidateFunction, + SchemaValidateFunction, + ErrorObject, + ErrorNoParams, +} from "./types" + +export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core" +export {SchemaCxt, SchemaObjCxt} from "./compile" +export {KeywordCxt} from "./compile/validate" +export {DefinedError} from "./vocabularies/errors" +export {JSONType} from "./compile/rules" +export {JSONSchemaType} from "./types/json-schema" +export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/codegen/code.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/codegen/code.ts new file mode 100644 index 000000000..b17701973 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/codegen/code.ts @@ -0,0 +1,168 @@ +export abstract class _CodeOrName { + abstract readonly str: string + abstract readonly names: UsedNames + abstract toString(): string + abstract emptyStr(): boolean +} + +export const IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i + +export class Name extends _CodeOrName { + readonly str: string + constructor(s: string) { + super() + if (!IDENTIFIER.test(s)) throw new Error("CodeGen: name must be a valid identifier") + this.str = s + } + + toString(): string { + return this.str + } + + emptyStr(): boolean { + return false + } + + get names(): UsedNames { + return {[this.str]: 1} + } +} + +export class _Code extends _CodeOrName { + readonly _items: readonly CodeItem[] + private _str?: string + private _names?: UsedNames + + constructor(code: string | readonly CodeItem[]) { + super() + this._items = typeof code === "string" ? [code] : code + } + + toString(): string { + return this.str + } + + emptyStr(): boolean { + if (this._items.length > 1) return false + const item = this._items[0] + return item === "" || item === '""' + } + + get str(): string { + return (this._str ??= this._items.reduce((s: string, c: CodeItem) => `${s}${c}`, "")) + } + + get names(): UsedNames { + return (this._names ??= this._items.reduce((names: UsedNames, c) => { + if (c instanceof Name) names[c.str] = (names[c.str] || 0) + 1 + return names + }, {})) + } +} + +export type CodeItem = Name | string | number | boolean | null + +export type UsedNames = Record + +export type Code = _Code | Name + +export type SafeExpr = Code | number | boolean | null + +export const nil = new _Code("") + +type CodeArg = SafeExpr | string | undefined + +export function _(strs: TemplateStringsArray, ...args: CodeArg[]): _Code { + const code: CodeItem[] = [strs[0]] + let i = 0 + while (i < args.length) { + addCodeArg(code, args[i]) + code.push(strs[++i]) + } + return new _Code(code) +} + +const plus = new _Code("+") + +export function str(strs: TemplateStringsArray, ...args: (CodeArg | string[])[]): _Code { + const expr: CodeItem[] = [safeStringify(strs[0])] + let i = 0 + while (i < args.length) { + expr.push(plus) + addCodeArg(expr, args[i]) + expr.push(plus, safeStringify(strs[++i])) + } + optimize(expr) + return new _Code(expr) +} + +export function addCodeArg(code: CodeItem[], arg: CodeArg | string[]): void { + if (arg instanceof _Code) code.push(...arg._items) + else if (arg instanceof Name) code.push(arg) + else code.push(interpolate(arg)) +} + +function optimize(expr: CodeItem[]): void { + let i = 1 + while (i < expr.length - 1) { + if (expr[i] === plus) { + const res = mergeExprItems(expr[i - 1], expr[i + 1]) + if (res !== undefined) { + expr.splice(i - 1, 3, res) + continue + } + expr[i++] = "+" + } + i++ + } +} + +function mergeExprItems(a: CodeItem, b: CodeItem): CodeItem | undefined { + if (b === '""') return a + if (a === '""') return b + if (typeof a == "string") { + if (b instanceof Name || a[a.length - 1] !== '"') return + if (typeof b != "string") return `${a.slice(0, -1)}${b}"` + if (b[0] === '"') return a.slice(0, -1) + b.slice(1) + return + } + if (typeof b == "string" && b[0] === '"' && !(a instanceof Name)) return `"${a}${b.slice(1)}` + return +} + +export function strConcat(c1: Code, c2: Code): Code { + return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str`${c1}${c2}` +} + +// TODO do not allow arrays here +function interpolate(x?: string | string[] | number | boolean | null): SafeExpr | string { + return typeof x == "number" || typeof x == "boolean" || x === null + ? x + : safeStringify(Array.isArray(x) ? x.join(",") : x) +} + +export function stringify(x: unknown): Code { + return new _Code(safeStringify(x)) +} + +export function safeStringify(x: unknown): string { + return JSON.stringify(x) + .replace(/\u2028/g, "\\u2028") + .replace(/\u2029/g, "\\u2029") +} + +export function getProperty(key: Code | string | number): Code { + return typeof key == "string" && IDENTIFIER.test(key) ? new _Code(`.${key}`) : _`[${key}]` +} + +//Does best effort to format the name properly +export function getEsmExportName(key: Code | string | number): Code { + if (typeof key == "string" && IDENTIFIER.test(key)) { + return new _Code(`${key}`) + } + throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`) +} + +export function regexpCode(rx: RegExp): Code { + return new _Code(rx.toString()) +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/codegen/index.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/codegen/index.ts new file mode 100644 index 000000000..9d29055dc --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/codegen/index.ts @@ -0,0 +1,832 @@ +import type {ScopeValueSets, NameValue, ValueScope, ValueScopeName} from "./scope" +import {_, nil, _Code, Code, Name, UsedNames, CodeItem, addCodeArg, _CodeOrName} from "./code" +import {Scope, varKinds} from "./scope" + +export {_, str, strConcat, nil, getProperty, stringify, regexpCode, Name, Code} from "./code" +export {Scope, ScopeStore, ValueScope, ValueScopeName, ScopeValueSets, varKinds} from "./scope" + +// type for expressions that can be safely inserted in code without quotes +export type SafeExpr = Code | number | boolean | null + +// type that is either Code of function that adds code to CodeGen instance using its methods +export type Block = Code | (() => void) + +export const operators = { + GT: new _Code(">"), + GTE: new _Code(">="), + LT: new _Code("<"), + LTE: new _Code("<="), + EQ: new _Code("==="), + NEQ: new _Code("!=="), + NOT: new _Code("!"), + OR: new _Code("||"), + AND: new _Code("&&"), + ADD: new _Code("+"), +} + +abstract class Node { + abstract readonly names: UsedNames + + optimizeNodes(): this | ChildNode | ChildNode[] | undefined { + return this + } + + optimizeNames(_names: UsedNames, _constants: Constants): this | undefined { + return this + } + + // get count(): number { + // return 1 + // } +} + +class Def extends Node { + constructor(private readonly varKind: Name, private readonly name: Name, private rhs?: SafeExpr) { + super() + } + + render({es5, _n}: CGOptions): string { + const varKind = es5 ? varKinds.var : this.varKind + const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}` + return `${varKind} ${this.name}${rhs};` + _n + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + if (!names[this.name.str]) return + if (this.rhs) this.rhs = optimizeExpr(this.rhs, names, constants) + return this + } + + get names(): UsedNames { + return this.rhs instanceof _CodeOrName ? this.rhs.names : {} + } +} + +class Assign extends Node { + constructor(readonly lhs: Code, public rhs: SafeExpr, private readonly sideEffects?: boolean) { + super() + } + + render({_n}: CGOptions): string { + return `${this.lhs} = ${this.rhs};` + _n + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + if (this.lhs instanceof Name && !names[this.lhs.str] && !this.sideEffects) return + this.rhs = optimizeExpr(this.rhs, names, constants) + return this + } + + get names(): UsedNames { + const names = this.lhs instanceof Name ? {} : {...this.lhs.names} + return addExprNames(names, this.rhs) + } +} + +class AssignOp extends Assign { + constructor(lhs: Code, private readonly op: Code, rhs: SafeExpr, sideEffects?: boolean) { + super(lhs, rhs, sideEffects) + } + + render({_n}: CGOptions): string { + return `${this.lhs} ${this.op}= ${this.rhs};` + _n + } +} + +class Label extends Node { + readonly names: UsedNames = {} + constructor(readonly label: Name) { + super() + } + + render({_n}: CGOptions): string { + return `${this.label}:` + _n + } +} + +class Break extends Node { + readonly names: UsedNames = {} + constructor(readonly label?: Code) { + super() + } + + render({_n}: CGOptions): string { + const label = this.label ? ` ${this.label}` : "" + return `break${label};` + _n + } +} + +class Throw extends Node { + constructor(readonly error: Code) { + super() + } + + render({_n}: CGOptions): string { + return `throw ${this.error};` + _n + } + + get names(): UsedNames { + return this.error.names + } +} + +class AnyCode extends Node { + constructor(private code: SafeExpr) { + super() + } + + render({_n}: CGOptions): string { + return `${this.code};` + _n + } + + optimizeNodes(): this | undefined { + return `${this.code}` ? this : undefined + } + + optimizeNames(names: UsedNames, constants: Constants): this { + this.code = optimizeExpr(this.code, names, constants) + return this + } + + get names(): UsedNames { + return this.code instanceof _CodeOrName ? this.code.names : {} + } +} + +abstract class ParentNode extends Node { + constructor(readonly nodes: ChildNode[] = []) { + super() + } + + render(opts: CGOptions): string { + return this.nodes.reduce((code, n) => code + n.render(opts), "") + } + + optimizeNodes(): this | ChildNode | ChildNode[] | undefined { + const {nodes} = this + let i = nodes.length + while (i--) { + const n = nodes[i].optimizeNodes() + if (Array.isArray(n)) nodes.splice(i, 1, ...n) + else if (n) nodes[i] = n + else nodes.splice(i, 1) + } + return nodes.length > 0 ? this : undefined + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + const {nodes} = this + let i = nodes.length + while (i--) { + // iterating backwards improves 1-pass optimization + const n = nodes[i] + if (n.optimizeNames(names, constants)) continue + subtractNames(names, n.names) + nodes.splice(i, 1) + } + return nodes.length > 0 ? this : undefined + } + + get names(): UsedNames { + return this.nodes.reduce((names: UsedNames, n) => addNames(names, n.names), {}) + } + + // get count(): number { + // return this.nodes.reduce((c, n) => c + n.count, 1) + // } +} + +abstract class BlockNode extends ParentNode { + render(opts: CGOptions): string { + return "{" + opts._n + super.render(opts) + "}" + opts._n + } +} + +class Root extends ParentNode {} + +class Else extends BlockNode { + static readonly kind = "else" +} + +class If extends BlockNode { + static readonly kind = "if" + else?: If | Else + constructor(private condition: Code | boolean, nodes?: ChildNode[]) { + super(nodes) + } + + render(opts: CGOptions): string { + let code = `if(${this.condition})` + super.render(opts) + if (this.else) code += "else " + this.else.render(opts) + return code + } + + optimizeNodes(): If | ChildNode[] | undefined { + super.optimizeNodes() + const cond = this.condition + if (cond === true) return this.nodes // else is ignored here + let e = this.else + if (e) { + const ns = e.optimizeNodes() + e = this.else = Array.isArray(ns) ? new Else(ns) : (ns as Else | undefined) + } + if (e) { + if (cond === false) return e instanceof If ? e : e.nodes + if (this.nodes.length) return this + return new If(not(cond), e instanceof If ? [e] : e.nodes) + } + if (cond === false || !this.nodes.length) return undefined + return this + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + this.else = this.else?.optimizeNames(names, constants) + if (!(super.optimizeNames(names, constants) || this.else)) return + this.condition = optimizeExpr(this.condition, names, constants) + return this + } + + get names(): UsedNames { + const names = super.names + addExprNames(names, this.condition) + if (this.else) addNames(names, this.else.names) + return names + } + + // get count(): number { + // return super.count + (this.else?.count || 0) + // } +} + +abstract class For extends BlockNode { + static readonly kind = "for" +} + +class ForLoop extends For { + constructor(private iteration: Code) { + super() + } + + render(opts: CGOptions): string { + return `for(${this.iteration})` + super.render(opts) + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + if (!super.optimizeNames(names, constants)) return + this.iteration = optimizeExpr(this.iteration, names, constants) + return this + } + + get names(): UsedNames { + return addNames(super.names, this.iteration.names) + } +} + +class ForRange extends For { + constructor( + private readonly varKind: Name, + private readonly name: Name, + private readonly from: SafeExpr, + private readonly to: SafeExpr + ) { + super() + } + + render(opts: CGOptions): string { + const varKind = opts.es5 ? varKinds.var : this.varKind + const {name, from, to} = this + return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts) + } + + get names(): UsedNames { + const names = addExprNames(super.names, this.from) + return addExprNames(names, this.to) + } +} + +class ForIter extends For { + constructor( + private readonly loop: "of" | "in", + private readonly varKind: Name, + private readonly name: Name, + private iterable: Code + ) { + super() + } + + render(opts: CGOptions): string { + return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts) + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + if (!super.optimizeNames(names, constants)) return + this.iterable = optimizeExpr(this.iterable, names, constants) + return this + } + + get names(): UsedNames { + return addNames(super.names, this.iterable.names) + } +} + +class Func extends BlockNode { + static readonly kind = "func" + constructor(public name: Name, public args: Code, public async?: boolean) { + super() + } + + render(opts: CGOptions): string { + const _async = this.async ? "async " : "" + return `${_async}function ${this.name}(${this.args})` + super.render(opts) + } +} + +class Return extends ParentNode { + static readonly kind = "return" + + render(opts: CGOptions): string { + return "return " + super.render(opts) + } +} + +class Try extends BlockNode { + catch?: Catch + finally?: Finally + + render(opts: CGOptions): string { + let code = "try" + super.render(opts) + if (this.catch) code += this.catch.render(opts) + if (this.finally) code += this.finally.render(opts) + return code + } + + optimizeNodes(): this { + super.optimizeNodes() + this.catch?.optimizeNodes() as Catch | undefined + this.finally?.optimizeNodes() as Finally | undefined + return this + } + + optimizeNames(names: UsedNames, constants: Constants): this { + super.optimizeNames(names, constants) + this.catch?.optimizeNames(names, constants) + this.finally?.optimizeNames(names, constants) + return this + } + + get names(): UsedNames { + const names = super.names + if (this.catch) addNames(names, this.catch.names) + if (this.finally) addNames(names, this.finally.names) + return names + } + + // get count(): number { + // return super.count + (this.catch?.count || 0) + (this.finally?.count || 0) + // } +} + +class Catch extends BlockNode { + static readonly kind = "catch" + constructor(readonly error: Name) { + super() + } + + render(opts: CGOptions): string { + return `catch(${this.error})` + super.render(opts) + } +} + +class Finally extends BlockNode { + static readonly kind = "finally" + render(opts: CGOptions): string { + return "finally" + super.render(opts) + } +} + +type StartBlockNode = If | For | Func | Return | Try + +type LeafNode = Def | Assign | Label | Break | Throw | AnyCode + +type ChildNode = StartBlockNode | LeafNode + +type EndBlockNodeType = + | typeof If + | typeof Else + | typeof For + | typeof Func + | typeof Return + | typeof Catch + | typeof Finally + +type Constants = Record + +export interface CodeGenOptions { + es5?: boolean + lines?: boolean + ownProperties?: boolean +} + +interface CGOptions extends CodeGenOptions { + _n: "\n" | "" +} + +export class CodeGen { + readonly _scope: Scope + readonly _extScope: ValueScope + readonly _values: ScopeValueSets = {} + private readonly _nodes: ParentNode[] + private readonly _blockStarts: number[] = [] + private readonly _constants: Constants = {} + private readonly opts: CGOptions + + constructor(extScope: ValueScope, opts: CodeGenOptions = {}) { + this.opts = {...opts, _n: opts.lines ? "\n" : ""} + this._extScope = extScope + this._scope = new Scope({parent: extScope}) + this._nodes = [new Root()] + } + + toString(): string { + return this._root.render(this.opts) + } + + // returns unique name in the internal scope + name(prefix: string): Name { + return this._scope.name(prefix) + } + + // reserves unique name in the external scope + scopeName(prefix: string): ValueScopeName { + return this._extScope.name(prefix) + } + + // reserves unique name in the external scope and assigns value to it + scopeValue(prefixOrName: ValueScopeName | string, value: NameValue): Name { + const name = this._extScope.value(prefixOrName, value) + const vs = this._values[name.prefix] || (this._values[name.prefix] = new Set()) + vs.add(name) + return name + } + + getScopeValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined { + return this._extScope.getValue(prefix, keyOrRef) + } + + // return code that assigns values in the external scope to the names that are used internally + // (same names that were returned by gen.scopeName or gen.scopeValue) + scopeRefs(scopeName: Name): Code { + return this._extScope.scopeRefs(scopeName, this._values) + } + + scopeCode(): Code { + return this._extScope.scopeCode(this._values) + } + + private _def( + varKind: Name, + nameOrPrefix: Name | string, + rhs?: SafeExpr, + constant?: boolean + ): Name { + const name = this._scope.toName(nameOrPrefix) + if (rhs !== undefined && constant) this._constants[name.str] = rhs + this._leafNode(new Def(varKind, name, rhs)) + return name + } + + // `const` declaration (`var` in es5 mode) + const(nameOrPrefix: Name | string, rhs: SafeExpr, _constant?: boolean): Name { + return this._def(varKinds.const, nameOrPrefix, rhs, _constant) + } + + // `let` declaration with optional assignment (`var` in es5 mode) + let(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name { + return this._def(varKinds.let, nameOrPrefix, rhs, _constant) + } + + // `var` declaration with optional assignment + var(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name { + return this._def(varKinds.var, nameOrPrefix, rhs, _constant) + } + + // assignment code + assign(lhs: Code, rhs: SafeExpr, sideEffects?: boolean): CodeGen { + return this._leafNode(new Assign(lhs, rhs, sideEffects)) + } + + // `+=` code + add(lhs: Code, rhs: SafeExpr): CodeGen { + return this._leafNode(new AssignOp(lhs, operators.ADD, rhs)) + } + + // appends passed SafeExpr to code or executes Block + code(c: Block | SafeExpr): CodeGen { + if (typeof c == "function") c() + else if (c !== nil) this._leafNode(new AnyCode(c)) + return this + } + + // returns code for object literal for the passed argument list of key-value pairs + object(...keyValues: [Name | string, SafeExpr | string][]): _Code { + const code: CodeItem[] = ["{"] + for (const [key, value] of keyValues) { + if (code.length > 1) code.push(",") + code.push(key) + if (key !== value || this.opts.es5) { + code.push(":") + addCodeArg(code, value) + } + } + code.push("}") + return new _Code(code) + } + + // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed) + if(condition: Code | boolean, thenBody?: Block, elseBody?: Block): CodeGen { + this._blockNode(new If(condition)) + + if (thenBody && elseBody) { + this.code(thenBody).else().code(elseBody).endIf() + } else if (thenBody) { + this.code(thenBody).endIf() + } else if (elseBody) { + throw new Error('CodeGen: "else" body without "then" body') + } + return this + } + + // `else if` clause - invalid without `if` or after `else` clauses + elseIf(condition: Code | boolean): CodeGen { + return this._elseNode(new If(condition)) + } + + // `else` clause - only valid after `if` or `else if` clauses + else(): CodeGen { + return this._elseNode(new Else()) + } + + // end `if` statement (needed if gen.if was used only with condition) + endIf(): CodeGen { + return this._endBlockNode(If, Else) + } + + private _for(node: For, forBody?: Block): CodeGen { + this._blockNode(node) + if (forBody) this.code(forBody).endFor() + return this + } + + // a generic `for` clause (or statement if `forBody` is passed) + for(iteration: Code, forBody?: Block): CodeGen { + return this._for(new ForLoop(iteration), forBody) + } + + // `for` statement for a range of values + forRange( + nameOrPrefix: Name | string, + from: SafeExpr, + to: SafeExpr, + forBody: (index: Name) => void, + varKind: Code = this.opts.es5 ? varKinds.var : varKinds.let + ): CodeGen { + const name = this._scope.toName(nameOrPrefix) + return this._for(new ForRange(varKind, name, from, to), () => forBody(name)) + } + + // `for-of` statement (in es5 mode replace with a normal for loop) + forOf( + nameOrPrefix: Name | string, + iterable: Code, + forBody: (item: Name) => void, + varKind: Code = varKinds.const + ): CodeGen { + const name = this._scope.toName(nameOrPrefix) + if (this.opts.es5) { + const arr = iterable instanceof Name ? iterable : this.var("_arr", iterable) + return this.forRange("_i", 0, _`${arr}.length`, (i) => { + this.var(name, _`${arr}[${i}]`) + forBody(name) + }) + } + return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name)) + } + + // `for-in` statement. + // With option `ownProperties` replaced with a `for-of` loop for object keys + forIn( + nameOrPrefix: Name | string, + obj: Code, + forBody: (item: Name) => void, + varKind: Code = this.opts.es5 ? varKinds.var : varKinds.const + ): CodeGen { + if (this.opts.ownProperties) { + return this.forOf(nameOrPrefix, _`Object.keys(${obj})`, forBody) + } + const name = this._scope.toName(nameOrPrefix) + return this._for(new ForIter("in", varKind, name, obj), () => forBody(name)) + } + + // end `for` loop + endFor(): CodeGen { + return this._endBlockNode(For) + } + + // `label` statement + label(label: Name): CodeGen { + return this._leafNode(new Label(label)) + } + + // `break` statement + break(label?: Code): CodeGen { + return this._leafNode(new Break(label)) + } + + // `return` statement + return(value: Block | SafeExpr): CodeGen { + const node = new Return() + this._blockNode(node) + this.code(value) + if (node.nodes.length !== 1) throw new Error('CodeGen: "return" should have one node') + return this._endBlockNode(Return) + } + + // `try` statement + try(tryBody: Block, catchCode?: (e: Name) => void, finallyCode?: Block): CodeGen { + if (!catchCode && !finallyCode) throw new Error('CodeGen: "try" without "catch" and "finally"') + const node = new Try() + this._blockNode(node) + this.code(tryBody) + if (catchCode) { + const error = this.name("e") + this._currNode = node.catch = new Catch(error) + catchCode(error) + } + if (finallyCode) { + this._currNode = node.finally = new Finally() + this.code(finallyCode) + } + return this._endBlockNode(Catch, Finally) + } + + // `throw` statement + throw(error: Code): CodeGen { + return this._leafNode(new Throw(error)) + } + + // start self-balancing block + block(body?: Block, nodeCount?: number): CodeGen { + this._blockStarts.push(this._nodes.length) + if (body) this.code(body).endBlock(nodeCount) + return this + } + + // end the current self-balancing block + endBlock(nodeCount?: number): CodeGen { + const len = this._blockStarts.pop() + if (len === undefined) throw new Error("CodeGen: not in self-balancing block") + const toClose = this._nodes.length - len + if (toClose < 0 || (nodeCount !== undefined && toClose !== nodeCount)) { + throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`) + } + this._nodes.length = len + return this + } + + // `function` heading (or definition if funcBody is passed) + func(name: Name, args: Code = nil, async?: boolean, funcBody?: Block): CodeGen { + this._blockNode(new Func(name, args, async)) + if (funcBody) this.code(funcBody).endFunc() + return this + } + + // end function definition + endFunc(): CodeGen { + return this._endBlockNode(Func) + } + + optimize(n = 1): void { + while (n-- > 0) { + this._root.optimizeNodes() + this._root.optimizeNames(this._root.names, this._constants) + } + } + + private _leafNode(node: LeafNode): CodeGen { + this._currNode.nodes.push(node) + return this + } + + private _blockNode(node: StartBlockNode): void { + this._currNode.nodes.push(node) + this._nodes.push(node) + } + + private _endBlockNode(N1: EndBlockNodeType, N2?: EndBlockNodeType): CodeGen { + const n = this._currNode + if (n instanceof N1 || (N2 && n instanceof N2)) { + this._nodes.pop() + return this + } + throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`) + } + + private _elseNode(node: If | Else): CodeGen { + const n = this._currNode + if (!(n instanceof If)) { + throw new Error('CodeGen: "else" without "if"') + } + this._currNode = n.else = node + return this + } + + private get _root(): Root { + return this._nodes[0] as Root + } + + private get _currNode(): ParentNode { + const ns = this._nodes + return ns[ns.length - 1] + } + + private set _currNode(node: ParentNode) { + const ns = this._nodes + ns[ns.length - 1] = node + } + + // get nodeCount(): number { + // return this._root.count + // } +} + +function addNames(names: UsedNames, from: UsedNames): UsedNames { + for (const n in from) names[n] = (names[n] || 0) + (from[n] || 0) + return names +} + +function addExprNames(names: UsedNames, from: SafeExpr): UsedNames { + return from instanceof _CodeOrName ? addNames(names, from.names) : names +} + +function optimizeExpr(expr: T, names: UsedNames, constants: Constants): T +function optimizeExpr(expr: SafeExpr, names: UsedNames, constants: Constants): SafeExpr { + if (expr instanceof Name) return replaceName(expr) + if (!canOptimize(expr)) return expr + return new _Code( + expr._items.reduce((items: CodeItem[], c: SafeExpr | string) => { + if (c instanceof Name) c = replaceName(c) + if (c instanceof _Code) items.push(...c._items) + else items.push(c) + return items + }, []) + ) + + function replaceName(n: Name): SafeExpr { + const c = constants[n.str] + if (c === undefined || names[n.str] !== 1) return n + delete names[n.str] + return c + } + + function canOptimize(e: SafeExpr): e is _Code { + return ( + e instanceof _Code && + e._items.some( + (c) => c instanceof Name && names[c.str] === 1 && constants[c.str] !== undefined + ) + ) + } +} + +function subtractNames(names: UsedNames, from: UsedNames): void { + for (const n in from) names[n] = (names[n] || 0) - (from[n] || 0) +} + +export function not(x: T): T +export function not(x: Code | SafeExpr): Code | SafeExpr { + return typeof x == "boolean" || typeof x == "number" || x === null ? !x : _`!${par(x)}` +} + +const andCode = mappend(operators.AND) + +// boolean AND (&&) expression with the passed arguments +export function and(...args: Code[]): Code { + return args.reduce(andCode) +} + +const orCode = mappend(operators.OR) + +// boolean OR (||) expression with the passed arguments +export function or(...args: Code[]): Code { + return args.reduce(orCode) +} + +type MAppend = (x: Code, y: Code) => Code + +function mappend(op: Code): MAppend { + return (x, y) => (x === nil ? y : y === nil ? x : _`${par(x)} ${op} ${par(y)}`) +} + +function par(x: Code): Code { + return x instanceof Name ? x : _`(${x})` +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/codegen/scope.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/codegen/scope.ts new file mode 100644 index 000000000..511992297 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/codegen/scope.ts @@ -0,0 +1,215 @@ +import {_, nil, Code, Name} from "./code" + +interface NameGroup { + prefix: string + index: number +} + +export interface NameValue { + ref: ValueReference // this is the reference to any value that can be referred to from generated code via `globals` var in the closure + key?: unknown // any key to identify a global to avoid duplicates, if not passed ref is used + code?: Code // this is the code creating the value needed for standalone code wit_out closure - can be a primitive value, function or import (`require`) +} + +export type ValueReference = unknown // possibly make CodeGen parameterized type on this type + +class ValueError extends Error { + readonly value?: NameValue + constructor(name: ValueScopeName) { + super(`CodeGen: "code" for ${name} not defined`) + this.value = name.value + } +} + +interface ScopeOptions { + prefixes?: Set + parent?: Scope +} + +interface ValueScopeOptions extends ScopeOptions { + scope: ScopeStore + es5?: boolean + lines?: boolean +} + +export type ScopeStore = Record + +type ScopeValues = { + [Prefix in string]?: Map +} + +export type ScopeValueSets = { + [Prefix in string]?: Set +} + +export enum UsedValueState { + Started, + Completed, +} + +export type UsedScopeValues = { + [Prefix in string]?: Map +} + +export const varKinds = { + const: new Name("const"), + let: new Name("let"), + var: new Name("var"), +} + +export class Scope { + protected readonly _names: {[Prefix in string]?: NameGroup} = {} + protected readonly _prefixes?: Set + protected readonly _parent?: Scope + + constructor({prefixes, parent}: ScopeOptions = {}) { + this._prefixes = prefixes + this._parent = parent + } + + toName(nameOrPrefix: Name | string): Name { + return nameOrPrefix instanceof Name ? nameOrPrefix : this.name(nameOrPrefix) + } + + name(prefix: string): Name { + return new Name(this._newName(prefix)) + } + + protected _newName(prefix: string): string { + const ng = this._names[prefix] || this._nameGroup(prefix) + return `${prefix}${ng.index++}` + } + + private _nameGroup(prefix: string): NameGroup { + if (this._parent?._prefixes?.has(prefix) || (this._prefixes && !this._prefixes.has(prefix))) { + throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`) + } + return (this._names[prefix] = {prefix, index: 0}) + } +} + +interface ScopePath { + property: string + itemIndex: number +} + +export class ValueScopeName extends Name { + readonly prefix: string + value?: NameValue + scopePath?: Code + + constructor(prefix: string, nameStr: string) { + super(nameStr) + this.prefix = prefix + } + + setValue(value: NameValue, {property, itemIndex}: ScopePath): void { + this.value = value + this.scopePath = _`.${new Name(property)}[${itemIndex}]` + } +} + +interface VSOptions extends ValueScopeOptions { + _n: Code +} + +const line = _`\n` + +export class ValueScope extends Scope { + protected readonly _values: ScopeValues = {} + protected readonly _scope: ScopeStore + readonly opts: VSOptions + + constructor(opts: ValueScopeOptions) { + super(opts) + this._scope = opts.scope + this.opts = {...opts, _n: opts.lines ? line : nil} + } + + get(): ScopeStore { + return this._scope + } + + name(prefix: string): ValueScopeName { + return new ValueScopeName(prefix, this._newName(prefix)) + } + + value(nameOrPrefix: ValueScopeName | string, value: NameValue): ValueScopeName { + if (value.ref === undefined) throw new Error("CodeGen: ref must be passed in value") + const name = this.toName(nameOrPrefix) as ValueScopeName + const {prefix} = name + const valueKey = value.key ?? value.ref + let vs = this._values[prefix] + if (vs) { + const _name = vs.get(valueKey) + if (_name) return _name + } else { + vs = this._values[prefix] = new Map() + } + vs.set(valueKey, name) + + const s = this._scope[prefix] || (this._scope[prefix] = []) + const itemIndex = s.length + s[itemIndex] = value.ref + name.setValue(value, {property: prefix, itemIndex}) + return name + } + + getValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined { + const vs = this._values[prefix] + if (!vs) return + return vs.get(keyOrRef) + } + + scopeRefs(scopeName: Name, values: ScopeValues | ScopeValueSets = this._values): Code { + return this._reduceValues(values, (name: ValueScopeName) => { + if (name.scopePath === undefined) throw new Error(`CodeGen: name "${name}" has no value`) + return _`${scopeName}${name.scopePath}` + }) + } + + scopeCode( + values: ScopeValues | ScopeValueSets = this._values, + usedValues?: UsedScopeValues, + getCode?: (n: ValueScopeName) => Code | undefined + ): Code { + return this._reduceValues( + values, + (name: ValueScopeName) => { + if (name.value === undefined) throw new Error(`CodeGen: name "${name}" has no value`) + return name.value.code + }, + usedValues, + getCode + ) + } + + private _reduceValues( + values: ScopeValues | ScopeValueSets, + valueCode: (n: ValueScopeName) => Code | undefined, + usedValues: UsedScopeValues = {}, + getCode?: (n: ValueScopeName) => Code | undefined + ): Code { + let code: Code = nil + for (const prefix in values) { + const vs = values[prefix] + if (!vs) continue + const nameSet = (usedValues[prefix] = usedValues[prefix] || new Map()) + vs.forEach((name: ValueScopeName) => { + if (nameSet.has(name)) return + nameSet.set(name, UsedValueState.Started) + let c = valueCode(name) + if (c) { + const def = this.opts.es5 ? varKinds.var : varKinds.const + code = _`${code}${def} ${name} = ${c};${this.opts._n}` + } else if ((c = getCode?.(name))) { + code = _`${code}${c}${this.opts._n}` + } else { + throw new ValueError(name) + } + nameSet.set(name, UsedValueState.Completed) + }) + } + return code + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/errors.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/errors.ts new file mode 100644 index 000000000..18424a0fc --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/errors.ts @@ -0,0 +1,184 @@ +import type {KeywordErrorCxt, KeywordErrorDefinition} from "../types" +import type {SchemaCxt} from "./index" +import {CodeGen, _, str, strConcat, Code, Name} from "./codegen" +import {SafeExpr} from "./codegen/code" +import {getErrorPath, Type} from "./util" +import N from "./names" + +export const keywordError: KeywordErrorDefinition = { + message: ({keyword}) => str`must pass "${keyword}" keyword validation`, +} + +export const keyword$DataError: KeywordErrorDefinition = { + message: ({keyword, schemaType}) => + schemaType + ? str`"${keyword}" keyword must be ${schemaType} ($data)` + : str`"${keyword}" keyword is invalid ($data)`, +} + +export interface ErrorPaths { + instancePath?: Code + schemaPath?: string + parentSchema?: boolean +} + +export function reportError( + cxt: KeywordErrorCxt, + error: KeywordErrorDefinition = keywordError, + errorPaths?: ErrorPaths, + overrideAllErrors?: boolean +): void { + const {it} = cxt + const {gen, compositeRule, allErrors} = it + const errObj = errorObjectCode(cxt, error, errorPaths) + if (overrideAllErrors ?? (compositeRule || allErrors)) { + addError(gen, errObj) + } else { + returnErrors(it, _`[${errObj}]`) + } +} + +export function reportExtraError( + cxt: KeywordErrorCxt, + error: KeywordErrorDefinition = keywordError, + errorPaths?: ErrorPaths +): void { + const {it} = cxt + const {gen, compositeRule, allErrors} = it + const errObj = errorObjectCode(cxt, error, errorPaths) + addError(gen, errObj) + if (!(compositeRule || allErrors)) { + returnErrors(it, N.vErrors) + } +} + +export function resetErrorsCount(gen: CodeGen, errsCount: Name): void { + gen.assign(N.errors, errsCount) + gen.if(_`${N.vErrors} !== null`, () => + gen.if( + errsCount, + () => gen.assign(_`${N.vErrors}.length`, errsCount), + () => gen.assign(N.vErrors, null) + ) + ) +} + +export function extendErrors({ + gen, + keyword, + schemaValue, + data, + errsCount, + it, +}: KeywordErrorCxt): void { + /* istanbul ignore if */ + if (errsCount === undefined) throw new Error("ajv implementation error") + const err = gen.name("err") + gen.forRange("i", errsCount, N.errors, (i) => { + gen.const(err, _`${N.vErrors}[${i}]`) + gen.if(_`${err}.instancePath === undefined`, () => + gen.assign(_`${err}.instancePath`, strConcat(N.instancePath, it.errorPath)) + ) + gen.assign(_`${err}.schemaPath`, str`${it.errSchemaPath}/${keyword}`) + if (it.opts.verbose) { + gen.assign(_`${err}.schema`, schemaValue) + gen.assign(_`${err}.data`, data) + } + }) +} + +function addError(gen: CodeGen, errObj: Code): void { + const err = gen.const("err", errObj) + gen.if( + _`${N.vErrors} === null`, + () => gen.assign(N.vErrors, _`[${err}]`), + _`${N.vErrors}.push(${err})` + ) + gen.code(_`${N.errors}++`) +} + +function returnErrors(it: SchemaCxt, errs: Code): void { + const {gen, validateName, schemaEnv} = it + if (schemaEnv.$async) { + gen.throw(_`new ${it.ValidationError as Name}(${errs})`) + } else { + gen.assign(_`${validateName}.errors`, errs) + gen.return(false) + } +} + +const E = { + keyword: new Name("keyword"), + schemaPath: new Name("schemaPath"), // also used in JTD errors + params: new Name("params"), + propertyName: new Name("propertyName"), + message: new Name("message"), + schema: new Name("schema"), + parentSchema: new Name("parentSchema"), +} + +function errorObjectCode( + cxt: KeywordErrorCxt, + error: KeywordErrorDefinition, + errorPaths?: ErrorPaths +): Code { + const {createErrors} = cxt.it + if (createErrors === false) return _`{}` + return errorObject(cxt, error, errorPaths) +} + +function errorObject( + cxt: KeywordErrorCxt, + error: KeywordErrorDefinition, + errorPaths: ErrorPaths = {} +): Code { + const {gen, it} = cxt + const keyValues: [Name, SafeExpr | string][] = [ + errorInstancePath(it, errorPaths), + errorSchemaPath(cxt, errorPaths), + ] + extraErrorProps(cxt, error, keyValues) + return gen.object(...keyValues) +} + +function errorInstancePath({errorPath}: SchemaCxt, {instancePath}: ErrorPaths): [Name, Code] { + const instPath = instancePath + ? str`${errorPath}${getErrorPath(instancePath, Type.Str)}` + : errorPath + return [N.instancePath, strConcat(N.instancePath, instPath)] +} + +function errorSchemaPath( + {keyword, it: {errSchemaPath}}: KeywordErrorCxt, + {schemaPath, parentSchema}: ErrorPaths +): [Name, string | Code] { + let schPath = parentSchema ? errSchemaPath : str`${errSchemaPath}/${keyword}` + if (schemaPath) { + schPath = str`${schPath}${getErrorPath(schemaPath, Type.Str)}` + } + return [E.schemaPath, schPath] +} + +function extraErrorProps( + cxt: KeywordErrorCxt, + {params, message}: KeywordErrorDefinition, + keyValues: [Name, SafeExpr | string][] +): void { + const {keyword, data, schemaValue, it} = cxt + const {opts, propertyName, topSchemaRef, schemaPath} = it + keyValues.push( + [E.keyword, keyword], + [E.params, typeof params == "function" ? params(cxt) : params || _`{}`] + ) + if (opts.messages) { + keyValues.push([E.message, typeof message == "function" ? message(cxt) : message]) + } + if (opts.verbose) { + keyValues.push( + [E.schema, schemaValue], + [E.parentSchema, _`${topSchemaRef}${schemaPath}`], + [N.data, data] + ) + } + if (propertyName) keyValues.push([E.propertyName, propertyName]) +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/index.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/index.ts new file mode 100644 index 000000000..3dac2699b --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/index.ts @@ -0,0 +1,324 @@ +import type { + AnySchema, + AnySchemaObject, + AnyValidateFunction, + AsyncValidateFunction, + EvaluatedProperties, + EvaluatedItems, +} from "../types" +import type Ajv from "../core" +import type {InstanceOptions} from "../core" +import {CodeGen, _, nil, stringify, Name, Code, ValueScopeName} from "./codegen" +import ValidationError from "../runtime/validation_error" +import N from "./names" +import {LocalRefs, getFullPath, _getFullPath, inlineRef, normalizeId, resolveUrl} from "./resolve" +import {schemaHasRulesButRef, unescapeFragment} from "./util" +import {validateFunctionCode} from "./validate" +import * as URI from "uri-js" +import {JSONType} from "./rules" + +export type SchemaRefs = { + [Ref in string]?: SchemaEnv | AnySchema +} + +export interface SchemaCxt { + readonly gen: CodeGen + readonly allErrors?: boolean // validation mode - whether to collect all errors or break on error + readonly data: Name // Name with reference to the current part of data instance + readonly parentData: Name // should be used in keywords modifying data + readonly parentDataProperty: Code | number // should be used in keywords modifying data + readonly dataNames: Name[] + readonly dataPathArr: (Code | number)[] + readonly dataLevel: number // the level of the currently validated data, + // it can be used to access both the property names and the data on all levels from the top. + dataTypes: JSONType[] // data types applied to the current part of data instance + definedProperties: Set // set of properties to keep track of for required checks + readonly topSchemaRef: Code + readonly validateName: Name + evaluated?: Name + readonly ValidationError?: Name + readonly schema: AnySchema // current schema object - equal to parentSchema passed via KeywordCxt + readonly schemaEnv: SchemaEnv + readonly rootId: string + baseId: string // the current schema base URI that should be used as the base for resolving URIs in references (\$ref) + readonly schemaPath: Code // the run-time expression that evaluates to the property name of the current schema + readonly errSchemaPath: string // this is actual string, should not be changed to Code + readonly errorPath: Code + readonly propertyName?: Name + readonly compositeRule?: boolean // true indicates that the current schema is inside the compound keyword, + // where failing some rule doesn't mean validation failure (`anyOf`, `oneOf`, `not`, `if`). + // This flag is used to determine whether you can return validation result immediately after any error in case the option `allErrors` is not `true. + // You only need to use it if you have many steps in your keywords and potentially can define multiple errors. + props?: EvaluatedProperties | Name // properties evaluated by this schema - used by parent schema or assigned to validation function + items?: EvaluatedItems | Name // last item evaluated by this schema - used by parent schema or assigned to validation function + jtdDiscriminator?: string + jtdMetadata?: boolean + readonly createErrors?: boolean + readonly opts: InstanceOptions // Ajv instance option. + readonly self: Ajv // current Ajv instance +} + +export interface SchemaObjCxt extends SchemaCxt { + readonly schema: AnySchemaObject +} +interface SchemaEnvArgs { + readonly schema: AnySchema + readonly schemaId?: "$id" | "id" + readonly root?: SchemaEnv + readonly baseId?: string + readonly schemaPath?: string + readonly localRefs?: LocalRefs + readonly meta?: boolean +} + +export class SchemaEnv implements SchemaEnvArgs { + readonly schema: AnySchema + readonly schemaId?: "$id" | "id" + readonly root: SchemaEnv + baseId: string // TODO possibly, it should be readonly + schemaPath?: string + localRefs?: LocalRefs + readonly meta?: boolean + readonly $async?: boolean // true if the current schema is asynchronous. + readonly refs: SchemaRefs = {} + readonly dynamicAnchors: {[Ref in string]?: true} = {} + validate?: AnyValidateFunction + validateName?: ValueScopeName + serialize?: (data: unknown) => string + serializeName?: ValueScopeName + parse?: (data: string) => unknown + parseName?: ValueScopeName + + constructor(env: SchemaEnvArgs) { + let schema: AnySchemaObject | undefined + if (typeof env.schema == "object") schema = env.schema + this.schema = env.schema + this.schemaId = env.schemaId + this.root = env.root || this + this.baseId = env.baseId ?? normalizeId(schema?.[env.schemaId || "$id"]) + this.schemaPath = env.schemaPath + this.localRefs = env.localRefs + this.meta = env.meta + this.$async = schema?.$async + this.refs = {} + } +} + +// let codeSize = 0 +// let nodeCount = 0 + +// Compiles schema in SchemaEnv +export function compileSchema(this: Ajv, sch: SchemaEnv): SchemaEnv { + // TODO refactor - remove compilations + const _sch = getCompilingSchema.call(this, sch) + if (_sch) return _sch + const rootId = getFullPath(this.opts.uriResolver, sch.root.baseId) // TODO if getFullPath removed 1 tests fails + const {es5, lines} = this.opts.code + const {ownProperties} = this.opts + const gen = new CodeGen(this.scope, {es5, lines, ownProperties}) + let _ValidationError + if (sch.$async) { + _ValidationError = gen.scopeValue("Error", { + ref: ValidationError, + code: _`require("ajv/dist/runtime/validation_error").default`, + }) + } + + const validateName = gen.scopeName("validate") + sch.validateName = validateName + + const schemaCxt: SchemaCxt = { + gen, + allErrors: this.opts.allErrors, + data: N.data, + parentData: N.parentData, + parentDataProperty: N.parentDataProperty, + dataNames: [N.data], + dataPathArr: [nil], // TODO can its length be used as dataLevel if nil is removed? + dataLevel: 0, + dataTypes: [], + definedProperties: new Set(), + topSchemaRef: gen.scopeValue( + "schema", + this.opts.code.source === true + ? {ref: sch.schema, code: stringify(sch.schema)} + : {ref: sch.schema} + ), + validateName, + ValidationError: _ValidationError, + schema: sch.schema, + schemaEnv: sch, + rootId, + baseId: sch.baseId || rootId, + schemaPath: nil, + errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"), + errorPath: _`""`, + opts: this.opts, + self: this, + } + + let sourceCode: string | undefined + try { + this._compilations.add(sch) + validateFunctionCode(schemaCxt) + gen.optimize(this.opts.code.optimize) + // gen.optimize(1) + const validateCode = gen.toString() + sourceCode = `${gen.scopeRefs(N.scope)}return ${validateCode}` + // console.log((codeSize += sourceCode.length), (nodeCount += gen.nodeCount)) + if (this.opts.code.process) sourceCode = this.opts.code.process(sourceCode, sch) + // console.log("\n\n\n *** \n", sourceCode) + const makeValidate = new Function(`${N.self}`, `${N.scope}`, sourceCode) + const validate: AnyValidateFunction = makeValidate(this, this.scope.get()) + this.scope.value(validateName, {ref: validate}) + + validate.errors = null + validate.schema = sch.schema + validate.schemaEnv = sch + if (sch.$async) (validate as AsyncValidateFunction).$async = true + if (this.opts.code.source === true) { + validate.source = {validateName, validateCode, scopeValues: gen._values} + } + if (this.opts.unevaluated) { + const {props, items} = schemaCxt + validate.evaluated = { + props: props instanceof Name ? undefined : props, + items: items instanceof Name ? undefined : items, + dynamicProps: props instanceof Name, + dynamicItems: items instanceof Name, + } + if (validate.source) validate.source.evaluated = stringify(validate.evaluated) + } + sch.validate = validate + return sch + } catch (e) { + delete sch.validate + delete sch.validateName + if (sourceCode) this.logger.error("Error compiling schema, function code:", sourceCode) + // console.log("\n\n\n *** \n", sourceCode, this.opts) + throw e + } finally { + this._compilations.delete(sch) + } +} + +export function resolveRef( + this: Ajv, + root: SchemaEnv, + baseId: string, + ref: string +): AnySchema | SchemaEnv | undefined { + ref = resolveUrl(this.opts.uriResolver, baseId, ref) + const schOrFunc = root.refs[ref] + if (schOrFunc) return schOrFunc + + let _sch = resolve.call(this, root, ref) + if (_sch === undefined) { + const schema = root.localRefs?.[ref] // TODO maybe localRefs should hold SchemaEnv + const {schemaId} = this.opts + if (schema) _sch = new SchemaEnv({schema, schemaId, root, baseId}) + } + + if (_sch === undefined) return + return (root.refs[ref] = inlineOrCompile.call(this, _sch)) +} + +function inlineOrCompile(this: Ajv, sch: SchemaEnv): AnySchema | SchemaEnv { + if (inlineRef(sch.schema, this.opts.inlineRefs)) return sch.schema + return sch.validate ? sch : compileSchema.call(this, sch) +} + +// Index of schema compilation in the currently compiled list +export function getCompilingSchema(this: Ajv, schEnv: SchemaEnv): SchemaEnv | void { + for (const sch of this._compilations) { + if (sameSchemaEnv(sch, schEnv)) return sch + } +} + +function sameSchemaEnv(s1: SchemaEnv, s2: SchemaEnv): boolean { + return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId +} + +// resolve and compile the references ($ref) +// TODO returns AnySchemaObject (if the schema can be inlined) or validation function +function resolve( + this: Ajv, + root: SchemaEnv, // information about the root schema for the current schema + ref: string // reference to resolve +): SchemaEnv | undefined { + let sch + while (typeof (sch = this.refs[ref]) == "string") ref = sch + return sch || this.schemas[ref] || resolveSchema.call(this, root, ref) +} + +// Resolve schema, its root and baseId +export function resolveSchema( + this: Ajv, + root: SchemaEnv, // root object with properties schema, refs TODO below SchemaEnv is assigned to it + ref: string // reference to resolve +): SchemaEnv | undefined { + const p = this.opts.uriResolver.parse(ref) + const refPath = _getFullPath(this.opts.uriResolver, p) + let baseId = getFullPath(this.opts.uriResolver, root.baseId, undefined) + // TODO `Object.keys(root.schema).length > 0` should not be needed - but removing breaks 2 tests + if (Object.keys(root.schema).length > 0 && refPath === baseId) { + return getJsonPointer.call(this, p, root) + } + + const id = normalizeId(refPath) + const schOrRef = this.refs[id] || this.schemas[id] + if (typeof schOrRef == "string") { + const sch = resolveSchema.call(this, root, schOrRef) + if (typeof sch?.schema !== "object") return + return getJsonPointer.call(this, p, sch) + } + + if (typeof schOrRef?.schema !== "object") return + if (!schOrRef.validate) compileSchema.call(this, schOrRef) + if (id === normalizeId(ref)) { + const {schema} = schOrRef + const {schemaId} = this.opts + const schId = schema[schemaId] + if (schId) baseId = resolveUrl(this.opts.uriResolver, baseId, schId) + return new SchemaEnv({schema, schemaId, root, baseId}) + } + return getJsonPointer.call(this, p, schOrRef) +} + +const PREVENT_SCOPE_CHANGE = new Set([ + "properties", + "patternProperties", + "enum", + "dependencies", + "definitions", +]) + +function getJsonPointer( + this: Ajv, + parsedRef: URI.URIComponents, + {baseId, schema, root}: SchemaEnv +): SchemaEnv | undefined { + if (parsedRef.fragment?.[0] !== "/") return + for (const part of parsedRef.fragment.slice(1).split("/")) { + if (typeof schema === "boolean") return + const partSchema = schema[unescapeFragment(part)] + if (partSchema === undefined) return + schema = partSchema + // TODO PREVENT_SCOPE_CHANGE could be defined in keyword def? + const schId = typeof schema === "object" && schema[this.opts.schemaId] + if (!PREVENT_SCOPE_CHANGE.has(part) && schId) { + baseId = resolveUrl(this.opts.uriResolver, baseId, schId) + } + } + let env: SchemaEnv | undefined + if (typeof schema != "boolean" && schema.$ref && !schemaHasRulesButRef(schema, this.RULES)) { + const $ref = resolveUrl(this.opts.uriResolver, baseId, schema.$ref) + env = resolveSchema.call(this, root, $ref) + } + // even though resolution failed we need to return SchemaEnv to throw exception + // so that compileAsync loads missing schema. + const {schemaId} = this.opts + env = env || new SchemaEnv({schema, schemaId, root, baseId}) + if (env.schema !== env.root.schema) return env + return undefined +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/jtd/parse.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/jtd/parse.ts new file mode 100644 index 000000000..a0141c770 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/jtd/parse.ts @@ -0,0 +1,411 @@ +import type Ajv from "../../core" +import type {SchemaObject} from "../../types" +import {jtdForms, JTDForm, SchemaObjectMap} from "./types" +import {SchemaEnv, getCompilingSchema} from ".." +import {_, str, and, or, nil, not, CodeGen, Code, Name, SafeExpr} from "../codegen" +import MissingRefError from "../ref_error" +import N from "../names" +import {hasPropFunc} from "../../vocabularies/code" +import {hasRef} from "../../vocabularies/jtd/ref" +import {intRange, IntType} from "../../vocabularies/jtd/type" +import {parseJson, parseJsonNumber, parseJsonString} from "../../runtime/parseJson" +import {useFunc} from "../util" +import validTimestamp from "../../runtime/timestamp" + +type GenParse = (cxt: ParseCxt) => void + +const genParse: {[F in JTDForm]: GenParse} = { + elements: parseElements, + values: parseValues, + discriminator: parseDiscriminator, + properties: parseProperties, + optionalProperties: parseProperties, + enum: parseEnum, + type: parseType, + ref: parseRef, +} + +interface ParseCxt { + readonly gen: CodeGen + readonly self: Ajv // current Ajv instance + readonly schemaEnv: SchemaEnv + readonly definitions: SchemaObjectMap + schema: SchemaObject + data: Code + parseName: Name + char: Name +} + +export default function compileParser( + this: Ajv, + sch: SchemaEnv, + definitions: SchemaObjectMap +): SchemaEnv { + const _sch = getCompilingSchema.call(this, sch) + if (_sch) return _sch + const {es5, lines} = this.opts.code + const {ownProperties} = this.opts + const gen = new CodeGen(this.scope, {es5, lines, ownProperties}) + const parseName = gen.scopeName("parse") + const cxt: ParseCxt = { + self: this, + gen, + schema: sch.schema as SchemaObject, + schemaEnv: sch, + definitions, + data: N.data, + parseName, + char: gen.name("c"), + } + + let sourceCode: string | undefined + try { + this._compilations.add(sch) + sch.parseName = parseName + parserFunction(cxt) + gen.optimize(this.opts.code.optimize) + const parseFuncCode = gen.toString() + sourceCode = `${gen.scopeRefs(N.scope)}return ${parseFuncCode}` + const makeParse = new Function(`${N.scope}`, sourceCode) + const parse: (json: string) => unknown = makeParse(this.scope.get()) + this.scope.value(parseName, {ref: parse}) + sch.parse = parse + } catch (e) { + if (sourceCode) this.logger.error("Error compiling parser, function code:", sourceCode) + delete sch.parse + delete sch.parseName + throw e + } finally { + this._compilations.delete(sch) + } + return sch +} + +const undef = _`undefined` + +function parserFunction(cxt: ParseCxt): void { + const {gen, parseName, char} = cxt + gen.func(parseName, _`${N.json}, ${N.jsonPos}, ${N.jsonPart}`, false, () => { + gen.let(N.data) + gen.let(char) + gen.assign(_`${parseName}.message`, undef) + gen.assign(_`${parseName}.position`, undef) + gen.assign(N.jsonPos, _`${N.jsonPos} || 0`) + gen.const(N.jsonLen, _`${N.json}.length`) + parseCode(cxt) + skipWhitespace(cxt) + gen.if(N.jsonPart, () => { + gen.assign(_`${parseName}.position`, N.jsonPos) + gen.return(N.data) + }) + gen.if(_`${N.jsonPos} === ${N.jsonLen}`, () => gen.return(N.data)) + jsonSyntaxError(cxt) + }) +} + +function parseCode(cxt: ParseCxt): void { + let form: JTDForm | undefined + for (const key of jtdForms) { + if (key in cxt.schema) { + form = key + break + } + } + if (form) parseNullable(cxt, genParse[form]) + else parseEmpty(cxt) +} + +const parseBoolean = parseBooleanToken(true, parseBooleanToken(false, jsonSyntaxError)) + +function parseNullable(cxt: ParseCxt, parseForm: GenParse): void { + const {gen, schema, data} = cxt + if (!schema.nullable) return parseForm(cxt) + tryParseToken(cxt, "null", parseForm, () => gen.assign(data, null)) +} + +function parseElements(cxt: ParseCxt): void { + const {gen, schema, data} = cxt + parseToken(cxt, "[") + const ix = gen.let("i", 0) + gen.assign(data, _`[]`) + parseItems(cxt, "]", () => { + const el = gen.let("el") + parseCode({...cxt, schema: schema.elements, data: el}) + gen.assign(_`${data}[${ix}++]`, el) + }) +} + +function parseValues(cxt: ParseCxt): void { + const {gen, schema, data} = cxt + parseToken(cxt, "{") + gen.assign(data, _`{}`) + parseItems(cxt, "}", () => parseKeyValue(cxt, schema.values)) +} + +function parseItems(cxt: ParseCxt, endToken: string, block: () => void): void { + tryParseItems(cxt, endToken, block) + parseToken(cxt, endToken) +} + +function tryParseItems(cxt: ParseCxt, endToken: string, block: () => void): void { + const {gen} = cxt + gen.for(_`;${N.jsonPos}<${N.jsonLen} && ${jsonSlice(1)}!==${endToken};`, () => { + block() + tryParseToken(cxt, ",", () => gen.break(), hasItem) + }) + + function hasItem(): void { + tryParseToken(cxt, endToken, () => {}, jsonSyntaxError) + } +} + +function parseKeyValue(cxt: ParseCxt, schema: SchemaObject): void { + const {gen} = cxt + const key = gen.let("key") + parseString({...cxt, data: key}) + parseToken(cxt, ":") + parsePropertyValue(cxt, key, schema) +} + +function parseDiscriminator(cxt: ParseCxt): void { + const {gen, data, schema} = cxt + const {discriminator, mapping} = schema + parseToken(cxt, "{") + gen.assign(data, _`{}`) + const startPos = gen.const("pos", N.jsonPos) + const value = gen.let("value") + const tag = gen.let("tag") + tryParseItems(cxt, "}", () => { + const key = gen.let("key") + parseString({...cxt, data: key}) + parseToken(cxt, ":") + gen.if( + _`${key} === ${discriminator}`, + () => { + parseString({...cxt, data: tag}) + gen.assign(_`${data}[${key}]`, tag) + gen.break() + }, + () => parseEmpty({...cxt, data: value}) // can be discarded/skipped + ) + }) + gen.assign(N.jsonPos, startPos) + gen.if(_`${tag} === undefined`) + parsingError(cxt, str`discriminator tag not found`) + for (const tagValue in mapping) { + gen.elseIf(_`${tag} === ${tagValue}`) + parseSchemaProperties({...cxt, schema: mapping[tagValue]}, discriminator) + } + gen.else() + parsingError(cxt, str`discriminator value not in schema`) + gen.endIf() +} + +function parseProperties(cxt: ParseCxt): void { + const {gen, data} = cxt + parseToken(cxt, "{") + gen.assign(data, _`{}`) + parseSchemaProperties(cxt) +} + +function parseSchemaProperties(cxt: ParseCxt, discriminator?: string): void { + const {gen, schema, data} = cxt + const {properties, optionalProperties, additionalProperties} = schema + parseItems(cxt, "}", () => { + const key = gen.let("key") + parseString({...cxt, data: key}) + parseToken(cxt, ":") + gen.if(false) + parseDefinedProperty(cxt, key, properties) + parseDefinedProperty(cxt, key, optionalProperties) + if (discriminator) { + gen.elseIf(_`${key} === ${discriminator}`) + const tag = gen.let("tag") + parseString({...cxt, data: tag}) // can be discarded, it is already assigned + } + gen.else() + if (additionalProperties) { + parseEmpty({...cxt, data: _`${data}[${key}]`}) + } else { + parsingError(cxt, str`property ${key} not allowed`) + } + gen.endIf() + }) + if (properties) { + const hasProp = hasPropFunc(gen) + const allProps: Code = and( + ...Object.keys(properties).map((p): Code => _`${hasProp}.call(${data}, ${p})`) + ) + gen.if(not(allProps), () => parsingError(cxt, str`missing required properties`)) + } +} + +function parseDefinedProperty(cxt: ParseCxt, key: Name, schemas: SchemaObjectMap = {}): void { + const {gen} = cxt + for (const prop in schemas) { + gen.elseIf(_`${key} === ${prop}`) + parsePropertyValue(cxt, key, schemas[prop] as SchemaObject) + } +} + +function parsePropertyValue(cxt: ParseCxt, key: Name, schema: SchemaObject): void { + parseCode({...cxt, schema, data: _`${cxt.data}[${key}]`}) +} + +function parseType(cxt: ParseCxt): void { + const {gen, schema, data, self} = cxt + switch (schema.type) { + case "boolean": + parseBoolean(cxt) + break + case "string": + parseString(cxt) + break + case "timestamp": { + parseString(cxt) + const vts = useFunc(gen, validTimestamp) + const {allowDate, parseDate} = self.opts + const notValid = allowDate ? _`!${vts}(${data}, true)` : _`!${vts}(${data})` + const fail: Code = parseDate + ? or(notValid, _`(${data} = new Date(${data}), false)`, _`isNaN(${data}.valueOf())`) + : notValid + gen.if(fail, () => parsingError(cxt, str`invalid timestamp`)) + break + } + case "float32": + case "float64": + parseNumber(cxt) + break + default: { + const t = schema.type as IntType + if (!self.opts.int32range && (t === "int32" || t === "uint32")) { + parseNumber(cxt, 16) // 2 ** 53 - max safe integer + if (t === "uint32") { + gen.if(_`${data} < 0`, () => parsingError(cxt, str`integer out of range`)) + } + } else { + const [min, max, maxDigits] = intRange[t] + parseNumber(cxt, maxDigits) + gen.if(_`${data} < ${min} || ${data} > ${max}`, () => + parsingError(cxt, str`integer out of range`) + ) + } + } + } +} + +function parseString(cxt: ParseCxt): void { + parseToken(cxt, '"') + parseWith(cxt, parseJsonString) +} + +function parseEnum(cxt: ParseCxt): void { + const {gen, data, schema} = cxt + const enumSch = schema.enum + parseToken(cxt, '"') + // TODO loopEnum + gen.if(false) + for (const value of enumSch) { + const valueStr = JSON.stringify(value).slice(1) // remove starting quote + gen.elseIf(_`${jsonSlice(valueStr.length)} === ${valueStr}`) + gen.assign(data, str`${value}`) + gen.add(N.jsonPos, valueStr.length) + } + gen.else() + jsonSyntaxError(cxt) + gen.endIf() +} + +function parseNumber(cxt: ParseCxt, maxDigits?: number): void { + const {gen} = cxt + skipWhitespace(cxt) + gen.if( + _`"-0123456789".indexOf(${jsonSlice(1)}) < 0`, + () => jsonSyntaxError(cxt), + () => parseWith(cxt, parseJsonNumber, maxDigits) + ) +} + +function parseBooleanToken(bool: boolean, fail: GenParse): GenParse { + return (cxt) => { + const {gen, data} = cxt + tryParseToken( + cxt, + `${bool}`, + () => fail(cxt), + () => gen.assign(data, bool) + ) + } +} + +function parseRef(cxt: ParseCxt): void { + const {gen, self, definitions, schema, schemaEnv} = cxt + const {ref} = schema + const refSchema = definitions[ref] + if (!refSchema) throw new MissingRefError(self.opts.uriResolver, "", ref, `No definition ${ref}`) + if (!hasRef(refSchema)) return parseCode({...cxt, schema: refSchema}) + const {root} = schemaEnv + const sch = compileParser.call(self, new SchemaEnv({schema: refSchema, root}), definitions) + partialParse(cxt, getParser(gen, sch), true) +} + +function getParser(gen: CodeGen, sch: SchemaEnv): Code { + return sch.parse + ? gen.scopeValue("parse", {ref: sch.parse}) + : _`${gen.scopeValue("wrapper", {ref: sch})}.parse` +} + +function parseEmpty(cxt: ParseCxt): void { + parseWith(cxt, parseJson) +} + +function parseWith(cxt: ParseCxt, parseFunc: {code: string}, args?: SafeExpr): void { + partialParse(cxt, useFunc(cxt.gen, parseFunc), args) +} + +function partialParse(cxt: ParseCxt, parseFunc: Name, args?: SafeExpr): void { + const {gen, data} = cxt + gen.assign(data, _`${parseFunc}(${N.json}, ${N.jsonPos}${args ? _`, ${args}` : nil})`) + gen.assign(N.jsonPos, _`${parseFunc}.position`) + gen.if(_`${data} === undefined`, () => parsingError(cxt, _`${parseFunc}.message`)) +} + +function parseToken(cxt: ParseCxt, tok: string): void { + tryParseToken(cxt, tok, jsonSyntaxError) +} + +function tryParseToken(cxt: ParseCxt, tok: string, fail: GenParse, success?: GenParse): void { + const {gen} = cxt + const n = tok.length + skipWhitespace(cxt) + gen.if( + _`${jsonSlice(n)} === ${tok}`, + () => { + gen.add(N.jsonPos, n) + success?.(cxt) + }, + () => fail(cxt) + ) +} + +function skipWhitespace({gen, char: c}: ParseCxt): void { + gen.code( + _`while((${c}=${N.json}[${N.jsonPos}],${c}===" "||${c}==="\\n"||${c}==="\\r"||${c}==="\\t"))${N.jsonPos}++;` + ) +} + +function jsonSlice(len: number | Name): Code { + return len === 1 + ? _`${N.json}[${N.jsonPos}]` + : _`${N.json}.slice(${N.jsonPos}, ${N.jsonPos}+${len})` +} + +function jsonSyntaxError(cxt: ParseCxt): void { + parsingError(cxt, _`"unexpected token " + ${N.json}[${N.jsonPos}]`) +} + +function parsingError({gen, parseName}: ParseCxt, msg: Code): void { + gen.assign(_`${parseName}.message`, msg) + gen.assign(_`${parseName}.position`, N.jsonPos) + gen.return(undef) +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/jtd/serialize.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/jtd/serialize.ts new file mode 100644 index 000000000..7ebd26acb --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/jtd/serialize.ts @@ -0,0 +1,260 @@ +import type Ajv from "../../core" +import type {SchemaObject} from "../../types" +import {jtdForms, JTDForm, SchemaObjectMap} from "./types" +import {SchemaEnv, getCompilingSchema} from ".." +import {_, str, and, getProperty, CodeGen, Code, Name} from "../codegen" +import MissingRefError from "../ref_error" +import N from "../names" +import {isOwnProperty} from "../../vocabularies/code" +import {hasRef} from "../../vocabularies/jtd/ref" +import {useFunc} from "../util" +import quote from "../../runtime/quote" + +const genSerialize: {[F in JTDForm]: (cxt: SerializeCxt) => void} = { + elements: serializeElements, + values: serializeValues, + discriminator: serializeDiscriminator, + properties: serializeProperties, + optionalProperties: serializeProperties, + enum: serializeString, + type: serializeType, + ref: serializeRef, +} + +interface SerializeCxt { + readonly gen: CodeGen + readonly self: Ajv // current Ajv instance + readonly schemaEnv: SchemaEnv + readonly definitions: SchemaObjectMap + schema: SchemaObject + data: Code +} + +export default function compileSerializer( + this: Ajv, + sch: SchemaEnv, + definitions: SchemaObjectMap +): SchemaEnv { + const _sch = getCompilingSchema.call(this, sch) + if (_sch) return _sch + const {es5, lines} = this.opts.code + const {ownProperties} = this.opts + const gen = new CodeGen(this.scope, {es5, lines, ownProperties}) + const serializeName = gen.scopeName("serialize") + const cxt: SerializeCxt = { + self: this, + gen, + schema: sch.schema as SchemaObject, + schemaEnv: sch, + definitions, + data: N.data, + } + + let sourceCode: string | undefined + try { + this._compilations.add(sch) + sch.serializeName = serializeName + gen.func(serializeName, N.data, false, () => { + gen.let(N.json, str``) + serializeCode(cxt) + gen.return(N.json) + }) + gen.optimize(this.opts.code.optimize) + const serializeFuncCode = gen.toString() + sourceCode = `${gen.scopeRefs(N.scope)}return ${serializeFuncCode}` + const makeSerialize = new Function(`${N.scope}`, sourceCode) + const serialize: (data: unknown) => string = makeSerialize(this.scope.get()) + this.scope.value(serializeName, {ref: serialize}) + sch.serialize = serialize + } catch (e) { + if (sourceCode) this.logger.error("Error compiling serializer, function code:", sourceCode) + delete sch.serialize + delete sch.serializeName + throw e + } finally { + this._compilations.delete(sch) + } + return sch +} + +function serializeCode(cxt: SerializeCxt): void { + let form: JTDForm | undefined + for (const key of jtdForms) { + if (key in cxt.schema) { + form = key + break + } + } + serializeNullable(cxt, form ? genSerialize[form] : serializeEmpty) +} + +function serializeNullable(cxt: SerializeCxt, serializeForm: (_cxt: SerializeCxt) => void): void { + const {gen, schema, data} = cxt + if (!schema.nullable) return serializeForm(cxt) + gen.if( + _`${data} === undefined || ${data} === null`, + () => gen.add(N.json, _`"null"`), + () => serializeForm(cxt) + ) +} + +function serializeElements(cxt: SerializeCxt): void { + const {gen, schema, data} = cxt + gen.add(N.json, str`[`) + const first = gen.let("first", true) + gen.forOf("el", data, (el) => { + addComma(cxt, first) + serializeCode({...cxt, schema: schema.elements, data: el}) + }) + gen.add(N.json, str`]`) +} + +function serializeValues(cxt: SerializeCxt): void { + const {gen, schema, data} = cxt + gen.add(N.json, str`{`) + const first = gen.let("first", true) + gen.forIn("key", data, (key) => serializeKeyValue(cxt, key, schema.values, first)) + gen.add(N.json, str`}`) +} + +function serializeKeyValue(cxt: SerializeCxt, key: Name, schema: SchemaObject, first: Name): void { + const {gen, data} = cxt + addComma(cxt, first) + serializeString({...cxt, data: key}) + gen.add(N.json, str`:`) + const value = gen.const("value", _`${data}${getProperty(key)}`) + serializeCode({...cxt, schema, data: value}) +} + +function serializeDiscriminator(cxt: SerializeCxt): void { + const {gen, schema, data} = cxt + const {discriminator} = schema + gen.add(N.json, str`{${JSON.stringify(discriminator)}:`) + const tag = gen.const("tag", _`${data}${getProperty(discriminator)}`) + serializeString({...cxt, data: tag}) + gen.if(false) + for (const tagValue in schema.mapping) { + gen.elseIf(_`${tag} === ${tagValue}`) + const sch = schema.mapping[tagValue] + serializeSchemaProperties({...cxt, schema: sch}, discriminator) + } + gen.endIf() + gen.add(N.json, str`}`) +} + +function serializeProperties(cxt: SerializeCxt): void { + const {gen} = cxt + gen.add(N.json, str`{`) + serializeSchemaProperties(cxt) + gen.add(N.json, str`}`) +} + +function serializeSchemaProperties(cxt: SerializeCxt, discriminator?: string): void { + const {gen, schema, data} = cxt + const {properties, optionalProperties} = schema + const props = keys(properties) + const optProps = keys(optionalProperties) + const allProps = allProperties(props.concat(optProps)) + let first = !discriminator + for (const key of props) { + serializeProperty(key, properties[key], keyValue(key)) + } + for (const key of optProps) { + const value = keyValue(key) + gen.if(and(_`${value} !== undefined`, isOwnProperty(gen, data, key)), () => + serializeProperty(key, optionalProperties[key], value) + ) + } + if (schema.additionalProperties) { + gen.forIn("key", data, (key) => + gen.if(isAdditional(key, allProps), () => + serializeKeyValue(cxt, key, {}, gen.let("first", first)) + ) + ) + } + + function keys(ps?: SchemaObjectMap): string[] { + return ps ? Object.keys(ps) : [] + } + + function allProperties(ps: string[]): string[] { + if (discriminator) ps.push(discriminator) + if (new Set(ps).size !== ps.length) { + throw new Error("JTD: properties/optionalProperties/disciminator overlap") + } + return ps + } + + function keyValue(key: string): Name { + return gen.const("value", _`${data}${getProperty(key)}`) + } + + function serializeProperty(key: string, propSchema: SchemaObject, value: Name): void { + if (first) first = false + else gen.add(N.json, str`,`) + gen.add(N.json, str`${JSON.stringify(key)}:`) + serializeCode({...cxt, schema: propSchema, data: value}) + } + + function isAdditional(key: Name, ps: string[]): Code | true { + return ps.length ? and(...ps.map((p) => _`${key} !== ${p}`)) : true + } +} + +function serializeType(cxt: SerializeCxt): void { + const {gen, schema, data} = cxt + switch (schema.type) { + case "boolean": + gen.add(N.json, _`${data} ? "true" : "false"`) + break + case "string": + serializeString(cxt) + break + case "timestamp": + gen.if( + _`${data} instanceof Date`, + () => gen.add(N.json, _`'"' + ${data}.toISOString() + '"'`), + () => serializeString(cxt) + ) + break + default: + serializeNumber(cxt) + } +} + +function serializeString({gen, data}: SerializeCxt): void { + gen.add(N.json, _`${useFunc(gen, quote)}(${data})`) +} + +function serializeNumber({gen, data}: SerializeCxt): void { + gen.add(N.json, _`"" + ${data}`) +} + +function serializeRef(cxt: SerializeCxt): void { + const {gen, self, data, definitions, schema, schemaEnv} = cxt + const {ref} = schema + const refSchema = definitions[ref] + if (!refSchema) throw new MissingRefError(self.opts.uriResolver, "", ref, `No definition ${ref}`) + if (!hasRef(refSchema)) return serializeCode({...cxt, schema: refSchema}) + const {root} = schemaEnv + const sch = compileSerializer.call(self, new SchemaEnv({schema: refSchema, root}), definitions) + gen.add(N.json, _`${getSerialize(gen, sch)}(${data})`) +} + +function getSerialize(gen: CodeGen, sch: SchemaEnv): Code { + return sch.serialize + ? gen.scopeValue("serialize", {ref: sch.serialize}) + : _`${gen.scopeValue("wrapper", {ref: sch})}.serialize` +} + +function serializeEmpty({gen, data}: SerializeCxt): void { + gen.add(N.json, _`JSON.stringify(${data})`) +} + +function addComma({gen}: SerializeCxt, first: Name): void { + gen.if( + first, + () => gen.assign(first, false), + () => gen.add(N.json, str`,`) + ) +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/jtd/types.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/jtd/types.ts new file mode 100644 index 000000000..7f3619576 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/jtd/types.ts @@ -0,0 +1,16 @@ +import type {SchemaObject} from "../../types" + +export type SchemaObjectMap = {[Ref in string]?: SchemaObject} + +export const jtdForms = [ + "elements", + "values", + "discriminator", + "properties", + "optionalProperties", + "enum", + "type", + "ref", +] as const + +export type JTDForm = typeof jtdForms[number] diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/names.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/names.ts new file mode 100644 index 000000000..b4b242e17 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/names.ts @@ -0,0 +1,27 @@ +import {Name} from "./codegen" + +const names = { + // validation function arguments + data: new Name("data"), // data passed to validation function + // args passed from referencing schema + valCxt: new Name("valCxt"), // validation/data context - should not be used directly, it is destructured to the names below + instancePath: new Name("instancePath"), + parentData: new Name("parentData"), + parentDataProperty: new Name("parentDataProperty"), + rootData: new Name("rootData"), // root data - same as the data passed to the first/top validation function + dynamicAnchors: new Name("dynamicAnchors"), // used to support recursiveRef and dynamicRef + // function scoped variables + vErrors: new Name("vErrors"), // null or array of validation errors + errors: new Name("errors"), // counter of validation errors + this: new Name("this"), + // "globals" + self: new Name("self"), + scope: new Name("scope"), + // JTD serialize/parse name for JSON string and position + json: new Name("json"), + jsonPos: new Name("jsonPos"), + jsonLen: new Name("jsonLen"), + jsonPart: new Name("jsonPart"), +} + +export default names diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/ref_error.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/ref_error.ts new file mode 100644 index 000000000..386bf0499 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/ref_error.ts @@ -0,0 +1,13 @@ +import {resolveUrl, normalizeId, getFullPath} from "./resolve" +import type {UriResolver} from "../types" + +export default class MissingRefError extends Error { + readonly missingRef: string + readonly missingSchema: string + + constructor(resolver: UriResolver, baseId: string, ref: string, msg?: string) { + super(msg || `can't resolve reference ${ref} from id ${baseId}`) + this.missingRef = resolveUrl(resolver, baseId, ref) + this.missingSchema = normalizeId(getFullPath(resolver, this.missingRef)) + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/resolve.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/resolve.ts new file mode 100644 index 000000000..4360eab06 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/resolve.ts @@ -0,0 +1,149 @@ +import type {AnySchema, AnySchemaObject, UriResolver} from "../types" +import type Ajv from "../ajv" +import type {URIComponents} from "uri-js" +import {eachItem} from "./util" +import * as equal from "fast-deep-equal" +import * as traverse from "json-schema-traverse" + +// the hash of local references inside the schema (created by getSchemaRefs), used for inline resolution +export type LocalRefs = {[Ref in string]?: AnySchemaObject} + +// TODO refactor to use keyword definitions +const SIMPLE_INLINED = new Set([ + "type", + "format", + "pattern", + "maxLength", + "minLength", + "maxProperties", + "minProperties", + "maxItems", + "minItems", + "maximum", + "minimum", + "uniqueItems", + "multipleOf", + "required", + "enum", + "const", +]) + +export function inlineRef(schema: AnySchema, limit: boolean | number = true): boolean { + if (typeof schema == "boolean") return true + if (limit === true) return !hasRef(schema) + if (!limit) return false + return countKeys(schema) <= limit +} + +const REF_KEYWORDS = new Set([ + "$ref", + "$recursiveRef", + "$recursiveAnchor", + "$dynamicRef", + "$dynamicAnchor", +]) + +function hasRef(schema: AnySchemaObject): boolean { + for (const key in schema) { + if (REF_KEYWORDS.has(key)) return true + const sch = schema[key] + if (Array.isArray(sch) && sch.some(hasRef)) return true + if (typeof sch == "object" && hasRef(sch)) return true + } + return false +} + +function countKeys(schema: AnySchemaObject): number { + let count = 0 + for (const key in schema) { + if (key === "$ref") return Infinity + count++ + if (SIMPLE_INLINED.has(key)) continue + if (typeof schema[key] == "object") { + eachItem(schema[key], (sch) => (count += countKeys(sch))) + } + if (count === Infinity) return Infinity + } + return count +} + +export function getFullPath(resolver: UriResolver, id = "", normalize?: boolean): string { + if (normalize !== false) id = normalizeId(id) + const p = resolver.parse(id) + return _getFullPath(resolver, p) +} + +export function _getFullPath(resolver: UriResolver, p: URIComponents): string { + const serialized = resolver.serialize(p) + return serialized.split("#")[0] + "#" +} + +const TRAILING_SLASH_HASH = /#\/?$/ +export function normalizeId(id: string | undefined): string { + return id ? id.replace(TRAILING_SLASH_HASH, "") : "" +} + +export function resolveUrl(resolver: UriResolver, baseId: string, id: string): string { + id = normalizeId(id) + return resolver.resolve(baseId, id) +} + +const ANCHOR = /^[a-z_][-a-z0-9._]*$/i + +export function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): LocalRefs { + if (typeof schema == "boolean") return {} + const {schemaId, uriResolver} = this.opts + const schId = normalizeId(schema[schemaId] || baseId) + const baseIds: {[JsonPtr in string]?: string} = {"": schId} + const pathPrefix = getFullPath(uriResolver, schId, false) + const localRefs: LocalRefs = {} + const schemaRefs: Set = new Set() + + traverse(schema, {allKeys: true}, (sch, jsonPtr, _, parentJsonPtr) => { + if (parentJsonPtr === undefined) return + const fullPath = pathPrefix + jsonPtr + let baseId = baseIds[parentJsonPtr] + if (typeof sch[schemaId] == "string") baseId = addRef.call(this, sch[schemaId]) + addAnchor.call(this, sch.$anchor) + addAnchor.call(this, sch.$dynamicAnchor) + baseIds[jsonPtr] = baseId + + function addRef(this: Ajv, ref: string): string { + // eslint-disable-next-line @typescript-eslint/unbound-method + const _resolve = this.opts.uriResolver.resolve + ref = normalizeId(baseId ? _resolve(baseId, ref) : ref) + if (schemaRefs.has(ref)) throw ambiguos(ref) + schemaRefs.add(ref) + let schOrRef = this.refs[ref] + if (typeof schOrRef == "string") schOrRef = this.refs[schOrRef] + if (typeof schOrRef == "object") { + checkAmbiguosRef(sch, schOrRef.schema, ref) + } else if (ref !== normalizeId(fullPath)) { + if (ref[0] === "#") { + checkAmbiguosRef(sch, localRefs[ref], ref) + localRefs[ref] = sch + } else { + this.refs[ref] = fullPath + } + } + return ref + } + + function addAnchor(this: Ajv, anchor: unknown): void { + if (typeof anchor == "string") { + if (!ANCHOR.test(anchor)) throw new Error(`invalid anchor "${anchor}"`) + addRef.call(this, `#${anchor}`) + } + } + }) + + return localRefs + + function checkAmbiguosRef(sch1: AnySchema, sch2: AnySchema | undefined, ref: string): void { + if (sch2 !== undefined && !equal(sch1, sch2)) throw ambiguos(ref) + } + + function ambiguos(ref: string): Error { + return new Error(`reference "${ref}" resolves to more than one schema`) + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/rules.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/rules.ts new file mode 100644 index 000000000..ea65074f9 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/rules.ts @@ -0,0 +1,50 @@ +import type {AddedKeywordDefinition} from "../types" + +const _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array"] as const + +export type JSONType = typeof _jsonTypes[number] + +const jsonTypes: Set = new Set(_jsonTypes) + +export function isJSONType(x: unknown): x is JSONType { + return typeof x == "string" && jsonTypes.has(x) +} + +type ValidationTypes = { + [K in JSONType]: boolean | RuleGroup | undefined +} + +export interface ValidationRules { + rules: RuleGroup[] + post: RuleGroup + all: {[Key in string]?: boolean | Rule} // rules that have to be validated + keywords: {[Key in string]?: boolean} // all known keywords (superset of "all") + types: ValidationTypes +} + +export interface RuleGroup { + type?: JSONType + rules: Rule[] +} + +// This interface wraps KeywordDefinition because definition can have multiple keywords +export interface Rule { + keyword: string + definition: AddedKeywordDefinition +} + +export function getRules(): ValidationRules { + const groups: Record<"number" | "string" | "array" | "object", RuleGroup> = { + number: {type: "number", rules: []}, + string: {type: "string", rules: []}, + array: {type: "array", rules: []}, + object: {type: "object", rules: []}, + } + return { + types: {...groups, integer: true, boolean: true, null: true}, + rules: [{rules: []}, groups.number, groups.string, groups.array, groups.object], + post: {rules: []}, + all: {}, + keywords: {}, + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/util.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/util.ts new file mode 100644 index 000000000..cefae51c2 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/util.ts @@ -0,0 +1,213 @@ +import type {AnySchema, EvaluatedProperties, EvaluatedItems} from "../types" +import type {SchemaCxt, SchemaObjCxt} from "." +import {_, getProperty, Code, Name, CodeGen} from "./codegen" +import {_Code} from "./codegen/code" +import type {Rule, ValidationRules} from "./rules" + +// TODO refactor to use Set +export function toHash(arr: T[]): {[K in T]?: true} { + const hash: {[K in T]?: true} = {} + for (const item of arr) hash[item] = true + return hash +} + +export function alwaysValidSchema(it: SchemaCxt, schema: AnySchema): boolean | void { + if (typeof schema == "boolean") return schema + if (Object.keys(schema).length === 0) return true + checkUnknownRules(it, schema) + return !schemaHasRules(schema, it.self.RULES.all) +} + +export function checkUnknownRules(it: SchemaCxt, schema: AnySchema = it.schema): void { + const {opts, self} = it + if (!opts.strictSchema) return + if (typeof schema === "boolean") return + const rules = self.RULES.keywords + for (const key in schema) { + if (!rules[key]) checkStrictMode(it, `unknown keyword: "${key}"`) + } +} + +export function schemaHasRules( + schema: AnySchema, + rules: {[Key in string]?: boolean | Rule} +): boolean { + if (typeof schema == "boolean") return !schema + for (const key in schema) if (rules[key]) return true + return false +} + +export function schemaHasRulesButRef(schema: AnySchema, RULES: ValidationRules): boolean { + if (typeof schema == "boolean") return !schema + for (const key in schema) if (key !== "$ref" && RULES.all[key]) return true + return false +} + +export function schemaRefOrVal( + {topSchemaRef, schemaPath}: SchemaObjCxt, + schema: unknown, + keyword: string, + $data?: string | false +): Code | number | boolean { + if (!$data) { + if (typeof schema == "number" || typeof schema == "boolean") return schema + if (typeof schema == "string") return _`${schema}` + } + return _`${topSchemaRef}${schemaPath}${getProperty(keyword)}` +} + +export function unescapeFragment(str: string): string { + return unescapeJsonPointer(decodeURIComponent(str)) +} + +export function escapeFragment(str: string | number): string { + return encodeURIComponent(escapeJsonPointer(str)) +} + +export function escapeJsonPointer(str: string | number): string { + if (typeof str == "number") return `${str}` + return str.replace(/~/g, "~0").replace(/\//g, "~1") +} + +export function unescapeJsonPointer(str: string): string { + return str.replace(/~1/g, "/").replace(/~0/g, "~") +} + +export function eachItem(xs: T | T[], f: (x: T) => void): void { + if (Array.isArray(xs)) { + for (const x of xs) f(x) + } else { + f(xs) + } +} + +type SomeEvaluated = EvaluatedProperties | EvaluatedItems + +type MergeEvaluatedFunc = ( + gen: CodeGen, + from: Name | T, + to: Name | Exclude | undefined, + toName?: typeof Name +) => Name | T + +interface MakeMergeFuncArgs { + mergeNames: (gen: CodeGen, from: Name, to: Name) => void + mergeToName: (gen: CodeGen, from: T, to: Name) => void + mergeValues: (from: T, to: Exclude) => T + resultToName: (gen: CodeGen, res?: T) => Name +} + +function makeMergeEvaluated({ + mergeNames, + mergeToName, + mergeValues, + resultToName, +}: MakeMergeFuncArgs): MergeEvaluatedFunc { + return (gen, from, to, toName) => { + const res = + to === undefined + ? from + : to instanceof Name + ? (from instanceof Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) + : from instanceof Name + ? (mergeToName(gen, to, from), from) + : mergeValues(from, to) + return toName === Name && !(res instanceof Name) ? resultToName(gen, res) : res + } +} + +interface MergeEvaluated { + props: MergeEvaluatedFunc + items: MergeEvaluatedFunc +} + +export const mergeEvaluated: MergeEvaluated = { + props: makeMergeEvaluated({ + mergeNames: (gen, from, to) => + gen.if(_`${to} !== true && ${from} !== undefined`, () => { + gen.if( + _`${from} === true`, + () => gen.assign(to, true), + () => gen.assign(to, _`${to} || {}`).code(_`Object.assign(${to}, ${from})`) + ) + }), + mergeToName: (gen, from, to) => + gen.if(_`${to} !== true`, () => { + if (from === true) { + gen.assign(to, true) + } else { + gen.assign(to, _`${to} || {}`) + setEvaluated(gen, to, from) + } + }), + mergeValues: (from, to) => (from === true ? true : {...from, ...to}), + resultToName: evaluatedPropsToName, + }), + items: makeMergeEvaluated({ + mergeNames: (gen, from, to) => + gen.if(_`${to} !== true && ${from} !== undefined`, () => + gen.assign(to, _`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`) + ), + mergeToName: (gen, from, to) => + gen.if(_`${to} !== true`, () => + gen.assign(to, from === true ? true : _`${to} > ${from} ? ${to} : ${from}`) + ), + mergeValues: (from, to) => (from === true ? true : Math.max(from, to)), + resultToName: (gen, items) => gen.var("items", items), + }), +} + +export function evaluatedPropsToName(gen: CodeGen, ps?: EvaluatedProperties): Name { + if (ps === true) return gen.var("props", true) + const props = gen.var("props", _`{}`) + if (ps !== undefined) setEvaluated(gen, props, ps) + return props +} + +export function setEvaluated(gen: CodeGen, props: Name, ps: {[K in string]?: true}): void { + Object.keys(ps).forEach((p) => gen.assign(_`${props}${getProperty(p)}`, true)) +} + +const snippets: {[S in string]?: _Code} = {} + +export function useFunc(gen: CodeGen, f: {code: string}): Name { + return gen.scopeValue("func", { + ref: f, + code: snippets[f.code] || (snippets[f.code] = new _Code(f.code)), + }) +} + +export enum Type { + Num, + Str, +} + +export function getErrorPath( + dataProp: Name | string | number, + dataPropType?: Type, + jsPropertySyntax?: boolean +): Code | string { + // let path + if (dataProp instanceof Name) { + const isNumber = dataPropType === Type.Num + return jsPropertySyntax + ? isNumber + ? _`"[" + ${dataProp} + "]"` + : _`"['" + ${dataProp} + "']"` + : isNumber + ? _`"/" + ${dataProp}` + : _`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")` // TODO maybe use global escapePointer + } + return jsPropertySyntax ? getProperty(dataProp).toString() : "/" + escapeJsonPointer(dataProp) +} + +export function checkStrictMode( + it: SchemaCxt, + msg: string, + mode: boolean | "log" = it.opts.strictSchema +): void { + if (!mode) return + msg = `strict mode: ${msg}` + if (mode === true) throw new Error(msg) + it.self.logger.warn(msg) +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/applicability.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/applicability.ts new file mode 100644 index 000000000..478b704ac --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/applicability.ts @@ -0,0 +1,22 @@ +import type {AnySchemaObject} from "../../types" +import type {SchemaObjCxt} from ".." +import type {JSONType, RuleGroup, Rule} from "../rules" + +export function schemaHasRulesForType( + {schema, self}: SchemaObjCxt, + type: JSONType +): boolean | undefined { + const group = self.RULES.types[type] + return group && group !== true && shouldUseGroup(schema, group) +} + +export function shouldUseGroup(schema: AnySchemaObject, group: RuleGroup): boolean { + return group.rules.some((rule) => shouldUseRule(schema, rule)) +} + +export function shouldUseRule(schema: AnySchemaObject, rule: Rule): boolean | undefined { + return ( + schema[rule.keyword] !== undefined || + rule.definition.implements?.some((kwd) => schema[kwd] !== undefined) + ) +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/boolSchema.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/boolSchema.ts new file mode 100644 index 000000000..156355016 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/boolSchema.ts @@ -0,0 +1,47 @@ +import type {KeywordErrorDefinition, KeywordErrorCxt} from "../../types" +import type {SchemaCxt} from ".." +import {reportError} from "../errors" +import {_, Name} from "../codegen" +import N from "../names" + +const boolError: KeywordErrorDefinition = { + message: "boolean schema is false", +} + +export function topBoolOrEmptySchema(it: SchemaCxt): void { + const {gen, schema, validateName} = it + if (schema === false) { + falseSchemaError(it, false) + } else if (typeof schema == "object" && schema.$async === true) { + gen.return(N.data) + } else { + gen.assign(_`${validateName}.errors`, null) + gen.return(true) + } +} + +export function boolOrEmptySchema(it: SchemaCxt, valid: Name): void { + const {gen, schema} = it + if (schema === false) { + gen.var(valid, false) // TODO var + falseSchemaError(it) + } else { + gen.var(valid, true) // TODO var + } +} + +function falseSchemaError(it: SchemaCxt, overrideAllErrors?: boolean): void { + const {gen, data} = it + // TODO maybe some other interface should be used for non-keyword validation errors... + const cxt: KeywordErrorCxt = { + gen, + keyword: "false schema", + data, + schema: false, + schemaCode: false, + schemaValue: false, + params: {}, + it, + } + reportError(cxt, boolError, undefined, overrideAllErrors) +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/dataType.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/dataType.ts new file mode 100644 index 000000000..b315c2ce9 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/dataType.ts @@ -0,0 +1,229 @@ +import type { + KeywordErrorDefinition, + KeywordErrorCxt, + ErrorObject, + AnySchemaObject, +} from "../../types" +import type {SchemaObjCxt} from ".." +import {isJSONType, JSONType} from "../rules" +import {schemaHasRulesForType} from "./applicability" +import {reportError} from "../errors" +import {_, nil, and, not, operators, Code, Name} from "../codegen" +import {toHash, schemaRefOrVal} from "../util" + +export enum DataType { + Correct, + Wrong, +} + +export function getSchemaTypes(schema: AnySchemaObject): JSONType[] { + const types = getJSONTypes(schema.type) + const hasNull = types.includes("null") + if (hasNull) { + if (schema.nullable === false) throw new Error("type: null contradicts nullable: false") + } else { + if (!types.length && schema.nullable !== undefined) { + throw new Error('"nullable" cannot be used without "type"') + } + if (schema.nullable === true) types.push("null") + } + return types +} + +export function getJSONTypes(ts: unknown | unknown[]): JSONType[] { + const types: unknown[] = Array.isArray(ts) ? ts : ts ? [ts] : [] + if (types.every(isJSONType)) return types + throw new Error("type must be JSONType or JSONType[]: " + types.join(",")) +} + +export function coerceAndCheckDataType(it: SchemaObjCxt, types: JSONType[]): boolean { + const {gen, data, opts} = it + const coerceTo = coerceToTypes(types, opts.coerceTypes) + const checkTypes = + types.length > 0 && + !(coerceTo.length === 0 && types.length === 1 && schemaHasRulesForType(it, types[0])) + if (checkTypes) { + const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong) + gen.if(wrongType, () => { + if (coerceTo.length) coerceData(it, types, coerceTo) + else reportTypeError(it) + }) + } + return checkTypes +} + +const COERCIBLE: Set = new Set(["string", "number", "integer", "boolean", "null"]) +function coerceToTypes(types: JSONType[], coerceTypes?: boolean | "array"): JSONType[] { + return coerceTypes + ? types.filter((t) => COERCIBLE.has(t) || (coerceTypes === "array" && t === "array")) + : [] +} + +function coerceData(it: SchemaObjCxt, types: JSONType[], coerceTo: JSONType[]): void { + const {gen, data, opts} = it + const dataType = gen.let("dataType", _`typeof ${data}`) + const coerced = gen.let("coerced", _`undefined`) + if (opts.coerceTypes === "array") { + gen.if(_`${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => + gen + .assign(data, _`${data}[0]`) + .assign(dataType, _`typeof ${data}`) + .if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data)) + ) + } + gen.if(_`${coerced} !== undefined`) + for (const t of coerceTo) { + if (COERCIBLE.has(t) || (t === "array" && opts.coerceTypes === "array")) { + coerceSpecificType(t) + } + } + gen.else() + reportTypeError(it) + gen.endIf() + + gen.if(_`${coerced} !== undefined`, () => { + gen.assign(data, coerced) + assignParentData(it, coerced) + }) + + function coerceSpecificType(t: string): void { + switch (t) { + case "string": + gen + .elseIf(_`${dataType} == "number" || ${dataType} == "boolean"`) + .assign(coerced, _`"" + ${data}`) + .elseIf(_`${data} === null`) + .assign(coerced, _`""`) + return + case "number": + gen + .elseIf( + _`${dataType} == "boolean" || ${data} === null + || (${dataType} == "string" && ${data} && ${data} == +${data})` + ) + .assign(coerced, _`+${data}`) + return + case "integer": + gen + .elseIf( + _`${dataType} === "boolean" || ${data} === null + || (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))` + ) + .assign(coerced, _`+${data}`) + return + case "boolean": + gen + .elseIf(_`${data} === "false" || ${data} === 0 || ${data} === null`) + .assign(coerced, false) + .elseIf(_`${data} === "true" || ${data} === 1`) + .assign(coerced, true) + return + case "null": + gen.elseIf(_`${data} === "" || ${data} === 0 || ${data} === false`) + gen.assign(coerced, null) + return + + case "array": + gen + .elseIf( + _`${dataType} === "string" || ${dataType} === "number" + || ${dataType} === "boolean" || ${data} === null` + ) + .assign(coerced, _`[${data}]`) + } + } +} + +function assignParentData({gen, parentData, parentDataProperty}: SchemaObjCxt, expr: Name): void { + // TODO use gen.property + gen.if(_`${parentData} !== undefined`, () => + gen.assign(_`${parentData}[${parentDataProperty}]`, expr) + ) +} + +export function checkDataType( + dataType: JSONType, + data: Name, + strictNums?: boolean | "log", + correct = DataType.Correct +): Code { + const EQ = correct === DataType.Correct ? operators.EQ : operators.NEQ + let cond: Code + switch (dataType) { + case "null": + return _`${data} ${EQ} null` + case "array": + cond = _`Array.isArray(${data})` + break + case "object": + cond = _`${data} && typeof ${data} == "object" && !Array.isArray(${data})` + break + case "integer": + cond = numCond(_`!(${data} % 1) && !isNaN(${data})`) + break + case "number": + cond = numCond() + break + default: + return _`typeof ${data} ${EQ} ${dataType}` + } + return correct === DataType.Correct ? cond : not(cond) + + function numCond(_cond: Code = nil): Code { + return and(_`typeof ${data} == "number"`, _cond, strictNums ? _`isFinite(${data})` : nil) + } +} + +export function checkDataTypes( + dataTypes: JSONType[], + data: Name, + strictNums?: boolean | "log", + correct?: DataType +): Code { + if (dataTypes.length === 1) { + return checkDataType(dataTypes[0], data, strictNums, correct) + } + let cond: Code + const types = toHash(dataTypes) + if (types.array && types.object) { + const notObj = _`typeof ${data} != "object"` + cond = types.null ? notObj : _`!${data} || ${notObj}` + delete types.null + delete types.array + delete types.object + } else { + cond = nil + } + if (types.number) delete types.integer + for (const t in types) cond = and(cond, checkDataType(t as JSONType, data, strictNums, correct)) + return cond +} + +export type TypeError = ErrorObject<"type", {type: string}> + +const typeError: KeywordErrorDefinition = { + message: ({schema}) => `must be ${schema}`, + params: ({schema, schemaValue}) => + typeof schema == "string" ? _`{type: ${schema}}` : _`{type: ${schemaValue}}`, +} + +export function reportTypeError(it: SchemaObjCxt): void { + const cxt = getTypeErrorContext(it) + reportError(cxt, typeError) +} + +function getTypeErrorContext(it: SchemaObjCxt): KeywordErrorCxt { + const {gen, data, schema} = it + const schemaCode = schemaRefOrVal(it, schema, "type") + return { + gen, + keyword: "type", + data, + schema: schema.type, + schemaCode, + schemaValue: schemaCode, + parentSchema: schema, + params: {}, + it, + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/defaults.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/defaults.ts new file mode 100644 index 000000000..2ad3d4df8 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/defaults.ts @@ -0,0 +1,32 @@ +import type {SchemaObjCxt} from ".." +import {_, getProperty, stringify} from "../codegen" +import {checkStrictMode} from "../util" + +export function assignDefaults(it: SchemaObjCxt, ty?: string): void { + const {properties, items} = it.schema + if (ty === "object" && properties) { + for (const key in properties) { + assignDefault(it, key, properties[key].default) + } + } else if (ty === "array" && Array.isArray(items)) { + items.forEach((sch, i: number) => assignDefault(it, i, sch.default)) + } +} + +function assignDefault(it: SchemaObjCxt, prop: string | number, defaultValue: unknown): void { + const {gen, compositeRule, data, opts} = it + if (defaultValue === undefined) return + const childData = _`${data}${getProperty(prop)}` + if (compositeRule) { + checkStrictMode(it, `default is ignored for: ${childData}`) + return + } + + let condition = _`${childData} === undefined` + if (opts.useDefaults === "empty") { + condition = _`${condition} || ${childData} === null || ${childData} === ""` + } + // `${childData} === undefined` + + // (opts.useDefaults === "empty" ? ` || ${childData} === null || ${childData} === ""` : "") + gen.if(condition, _`${childData} = ${stringify(defaultValue)}`) +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/index.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/index.ts new file mode 100644 index 000000000..f5910c3a3 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/index.ts @@ -0,0 +1,573 @@ +import type { + AddedKeywordDefinition, + AnySchema, + AnySchemaObject, + KeywordErrorCxt, + KeywordCxtParams, +} from "../../types" +import type {SchemaCxt, SchemaObjCxt} from ".." +import type {InstanceOptions} from "../../core" +import {boolOrEmptySchema, topBoolOrEmptySchema} from "./boolSchema" +import {coerceAndCheckDataType, getSchemaTypes} from "./dataType" +import {shouldUseGroup, shouldUseRule} from "./applicability" +import {checkDataType, checkDataTypes, reportTypeError, DataType} from "./dataType" +import {assignDefaults} from "./defaults" +import {funcKeywordCode, macroKeywordCode, validateKeywordUsage, validSchemaType} from "./keyword" +import {getSubschema, extendSubschemaData, SubschemaArgs, extendSubschemaMode} from "./subschema" +import {_, nil, str, or, not, getProperty, Block, Code, Name, CodeGen} from "../codegen" +import N from "../names" +import {resolveUrl} from "../resolve" +import { + schemaRefOrVal, + schemaHasRulesButRef, + checkUnknownRules, + checkStrictMode, + unescapeJsonPointer, + mergeEvaluated, +} from "../util" +import type {JSONType, Rule, RuleGroup} from "../rules" +import { + ErrorPaths, + reportError, + reportExtraError, + resetErrorsCount, + keyword$DataError, +} from "../errors" + +// schema compilation - generates validation function, subschemaCode (below) is used for subschemas +export function validateFunctionCode(it: SchemaCxt): void { + if (isSchemaObj(it)) { + checkKeywords(it) + if (schemaCxtHasRules(it)) { + topSchemaObjCode(it) + return + } + } + validateFunction(it, () => topBoolOrEmptySchema(it)) +} + +function validateFunction( + {gen, validateName, schema, schemaEnv, opts}: SchemaCxt, + body: Block +): void { + if (opts.code.es5) { + gen.func(validateName, _`${N.data}, ${N.valCxt}`, schemaEnv.$async, () => { + gen.code(_`"use strict"; ${funcSourceUrl(schema, opts)}`) + destructureValCxtES5(gen, opts) + gen.code(body) + }) + } else { + gen.func(validateName, _`${N.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => + gen.code(funcSourceUrl(schema, opts)).code(body) + ) + } +} + +function destructureValCxt(opts: InstanceOptions): Code { + return _`{${N.instancePath}="", ${N.parentData}, ${N.parentDataProperty}, ${N.rootData}=${ + N.data + }${opts.dynamicRef ? _`, ${N.dynamicAnchors}={}` : nil}}={}` +} + +function destructureValCxtES5(gen: CodeGen, opts: InstanceOptions): void { + gen.if( + N.valCxt, + () => { + gen.var(N.instancePath, _`${N.valCxt}.${N.instancePath}`) + gen.var(N.parentData, _`${N.valCxt}.${N.parentData}`) + gen.var(N.parentDataProperty, _`${N.valCxt}.${N.parentDataProperty}`) + gen.var(N.rootData, _`${N.valCxt}.${N.rootData}`) + if (opts.dynamicRef) gen.var(N.dynamicAnchors, _`${N.valCxt}.${N.dynamicAnchors}`) + }, + () => { + gen.var(N.instancePath, _`""`) + gen.var(N.parentData, _`undefined`) + gen.var(N.parentDataProperty, _`undefined`) + gen.var(N.rootData, N.data) + if (opts.dynamicRef) gen.var(N.dynamicAnchors, _`{}`) + } + ) +} + +function topSchemaObjCode(it: SchemaObjCxt): void { + const {schema, opts, gen} = it + validateFunction(it, () => { + if (opts.$comment && schema.$comment) commentKeyword(it) + checkNoDefault(it) + gen.let(N.vErrors, null) + gen.let(N.errors, 0) + if (opts.unevaluated) resetEvaluated(it) + typeAndKeywords(it) + returnResults(it) + }) + return +} + +function resetEvaluated(it: SchemaObjCxt): void { + // TODO maybe some hook to execute it in the end to check whether props/items are Name, as in assignEvaluated + const {gen, validateName} = it + it.evaluated = gen.const("evaluated", _`${validateName}.evaluated`) + gen.if(_`${it.evaluated}.dynamicProps`, () => gen.assign(_`${it.evaluated}.props`, _`undefined`)) + gen.if(_`${it.evaluated}.dynamicItems`, () => gen.assign(_`${it.evaluated}.items`, _`undefined`)) +} + +function funcSourceUrl(schema: AnySchema, opts: InstanceOptions): Code { + const schId = typeof schema == "object" && schema[opts.schemaId] + return schId && (opts.code.source || opts.code.process) ? _`/*# sourceURL=${schId} */` : nil +} + +// schema compilation - this function is used recursively to generate code for sub-schemas +function subschemaCode(it: SchemaCxt, valid: Name): void { + if (isSchemaObj(it)) { + checkKeywords(it) + if (schemaCxtHasRules(it)) { + subSchemaObjCode(it, valid) + return + } + } + boolOrEmptySchema(it, valid) +} + +function schemaCxtHasRules({schema, self}: SchemaCxt): boolean { + if (typeof schema == "boolean") return !schema + for (const key in schema) if (self.RULES.all[key]) return true + return false +} + +function isSchemaObj(it: SchemaCxt): it is SchemaObjCxt { + return typeof it.schema != "boolean" +} + +function subSchemaObjCode(it: SchemaObjCxt, valid: Name): void { + const {schema, gen, opts} = it + if (opts.$comment && schema.$comment) commentKeyword(it) + updateContext(it) + checkAsyncSchema(it) + const errsCount = gen.const("_errs", N.errors) + typeAndKeywords(it, errsCount) + // TODO var + gen.var(valid, _`${errsCount} === ${N.errors}`) +} + +function checkKeywords(it: SchemaObjCxt): void { + checkUnknownRules(it) + checkRefsAndKeywords(it) +} + +function typeAndKeywords(it: SchemaObjCxt, errsCount?: Name): void { + if (it.opts.jtd) return schemaKeywords(it, [], false, errsCount) + const types = getSchemaTypes(it.schema) + const checkedTypes = coerceAndCheckDataType(it, types) + schemaKeywords(it, types, !checkedTypes, errsCount) +} + +function checkRefsAndKeywords(it: SchemaObjCxt): void { + const {schema, errSchemaPath, opts, self} = it + if (schema.$ref && opts.ignoreKeywordsWithRef && schemaHasRulesButRef(schema, self.RULES)) { + self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`) + } +} + +function checkNoDefault(it: SchemaObjCxt): void { + const {schema, opts} = it + if (schema.default !== undefined && opts.useDefaults && opts.strictSchema) { + checkStrictMode(it, "default is ignored in the schema root") + } +} + +function updateContext(it: SchemaObjCxt): void { + const schId = it.schema[it.opts.schemaId] + if (schId) it.baseId = resolveUrl(it.opts.uriResolver, it.baseId, schId) +} + +function checkAsyncSchema(it: SchemaObjCxt): void { + if (it.schema.$async && !it.schemaEnv.$async) throw new Error("async schema in sync schema") +} + +function commentKeyword({gen, schemaEnv, schema, errSchemaPath, opts}: SchemaObjCxt): void { + const msg = schema.$comment + if (opts.$comment === true) { + gen.code(_`${N.self}.logger.log(${msg})`) + } else if (typeof opts.$comment == "function") { + const schemaPath = str`${errSchemaPath}/$comment` + const rootName = gen.scopeValue("root", {ref: schemaEnv.root}) + gen.code(_`${N.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`) + } +} + +function returnResults(it: SchemaCxt): void { + const {gen, schemaEnv, validateName, ValidationError, opts} = it + if (schemaEnv.$async) { + // TODO assign unevaluated + gen.if( + _`${N.errors} === 0`, + () => gen.return(N.data), + () => gen.throw(_`new ${ValidationError as Name}(${N.vErrors})`) + ) + } else { + gen.assign(_`${validateName}.errors`, N.vErrors) + if (opts.unevaluated) assignEvaluated(it) + gen.return(_`${N.errors} === 0`) + } +} + +function assignEvaluated({gen, evaluated, props, items}: SchemaCxt): void { + if (props instanceof Name) gen.assign(_`${evaluated}.props`, props) + if (items instanceof Name) gen.assign(_`${evaluated}.items`, items) +} + +function schemaKeywords( + it: SchemaObjCxt, + types: JSONType[], + typeErrors: boolean, + errsCount?: Name +): void { + const {gen, schema, data, allErrors, opts, self} = it + const {RULES} = self + if (schema.$ref && (opts.ignoreKeywordsWithRef || !schemaHasRulesButRef(schema, RULES))) { + gen.block(() => keywordCode(it, "$ref", (RULES.all.$ref as Rule).definition)) // TODO typecast + return + } + if (!opts.jtd) checkStrictTypes(it, types) + gen.block(() => { + for (const group of RULES.rules) groupKeywords(group) + groupKeywords(RULES.post) + }) + + function groupKeywords(group: RuleGroup): void { + if (!shouldUseGroup(schema, group)) return + if (group.type) { + gen.if(checkDataType(group.type, data, opts.strictNumbers)) + iterateKeywords(it, group) + if (types.length === 1 && types[0] === group.type && typeErrors) { + gen.else() + reportTypeError(it) + } + gen.endIf() + } else { + iterateKeywords(it, group) + } + // TODO make it "ok" call? + if (!allErrors) gen.if(_`${N.errors} === ${errsCount || 0}`) + } +} + +function iterateKeywords(it: SchemaObjCxt, group: RuleGroup): void { + const { + gen, + schema, + opts: {useDefaults}, + } = it + if (useDefaults) assignDefaults(it, group.type) + gen.block(() => { + for (const rule of group.rules) { + if (shouldUseRule(schema, rule)) { + keywordCode(it, rule.keyword, rule.definition, group.type) + } + } + }) +} + +function checkStrictTypes(it: SchemaObjCxt, types: JSONType[]): void { + if (it.schemaEnv.meta || !it.opts.strictTypes) return + checkContextTypes(it, types) + if (!it.opts.allowUnionTypes) checkMultipleTypes(it, types) + checkKeywordTypes(it, it.dataTypes) +} + +function checkContextTypes(it: SchemaObjCxt, types: JSONType[]): void { + if (!types.length) return + if (!it.dataTypes.length) { + it.dataTypes = types + return + } + types.forEach((t) => { + if (!includesType(it.dataTypes, t)) { + strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`) + } + }) + it.dataTypes = it.dataTypes.filter((t) => includesType(types, t)) +} + +function checkMultipleTypes(it: SchemaObjCxt, ts: JSONType[]): void { + if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) { + strictTypesError(it, "use allowUnionTypes to allow union type keyword") + } +} + +function checkKeywordTypes(it: SchemaObjCxt, ts: JSONType[]): void { + const rules = it.self.RULES.all + for (const keyword in rules) { + const rule = rules[keyword] + if (typeof rule == "object" && shouldUseRule(it.schema, rule)) { + const {type} = rule.definition + if (type.length && !type.some((t) => hasApplicableType(ts, t))) { + strictTypesError(it, `missing type "${type.join(",")}" for keyword "${keyword}"`) + } + } + } +} + +function hasApplicableType(schTs: JSONType[], kwdT: JSONType): boolean { + return schTs.includes(kwdT) || (kwdT === "number" && schTs.includes("integer")) +} + +function includesType(ts: JSONType[], t: JSONType): boolean { + return ts.includes(t) || (t === "integer" && ts.includes("number")) +} + +function strictTypesError(it: SchemaObjCxt, msg: string): void { + const schemaPath = it.schemaEnv.baseId + it.errSchemaPath + msg += ` at "${schemaPath}" (strictTypes)` + checkStrictMode(it, msg, it.opts.strictTypes) +} + +export class KeywordCxt implements KeywordErrorCxt { + readonly gen: CodeGen + readonly allErrors?: boolean + readonly keyword: string + readonly data: Name // Name referencing the current level of the data instance + readonly $data?: string | false + schema: any // keyword value in the schema + readonly schemaValue: Code | number | boolean // Code reference to keyword schema value or primitive value + readonly schemaCode: Code | number | boolean // Code reference to resolved schema value (different if schema is $data) + readonly schemaType: JSONType[] // allowed type(s) of keyword value in the schema + readonly parentSchema: AnySchemaObject + readonly errsCount?: Name // Name reference to the number of validation errors collected before this keyword, + // requires option trackErrors in keyword definition + params: KeywordCxtParams // object to pass parameters to error messages from keyword code + readonly it: SchemaObjCxt // schema compilation context (schema is guaranteed to be an object, not boolean) + readonly def: AddedKeywordDefinition + + constructor(it: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string) { + validateKeywordUsage(it, def, keyword) + this.gen = it.gen + this.allErrors = it.allErrors + this.keyword = keyword + this.data = it.data + this.schema = it.schema[keyword] + this.$data = def.$data && it.opts.$data && this.schema && this.schema.$data + this.schemaValue = schemaRefOrVal(it, this.schema, keyword, this.$data) + this.schemaType = def.schemaType + this.parentSchema = it.schema + this.params = {} + this.it = it + this.def = def + + if (this.$data) { + this.schemaCode = it.gen.const("vSchema", getData(this.$data, it)) + } else { + this.schemaCode = this.schemaValue + if (!validSchemaType(this.schema, def.schemaType, def.allowUndefined)) { + throw new Error(`${keyword} value must be ${JSON.stringify(def.schemaType)}`) + } + } + + if ("code" in def ? def.trackErrors : def.errors !== false) { + this.errsCount = it.gen.const("_errs", N.errors) + } + } + + result(condition: Code, successAction?: () => void, failAction?: () => void): void { + this.failResult(not(condition), successAction, failAction) + } + + failResult(condition: Code, successAction?: () => void, failAction?: () => void): void { + this.gen.if(condition) + if (failAction) failAction() + else this.error() + if (successAction) { + this.gen.else() + successAction() + if (this.allErrors) this.gen.endIf() + } else { + if (this.allErrors) this.gen.endIf() + else this.gen.else() + } + } + + pass(condition: Code, failAction?: () => void): void { + this.failResult(not(condition), undefined, failAction) + } + + fail(condition?: Code): void { + if (condition === undefined) { + this.error() + if (!this.allErrors) this.gen.if(false) // this branch will be removed by gen.optimize + return + } + this.gen.if(condition) + this.error() + if (this.allErrors) this.gen.endIf() + else this.gen.else() + } + + fail$data(condition: Code): void { + if (!this.$data) return this.fail(condition) + const {schemaCode} = this + this.fail(_`${schemaCode} !== undefined && (${or(this.invalid$data(), condition)})`) + } + + error(append?: boolean, errorParams?: KeywordCxtParams, errorPaths?: ErrorPaths): void { + if (errorParams) { + this.setParams(errorParams) + this._error(append, errorPaths) + this.setParams({}) + return + } + this._error(append, errorPaths) + } + + private _error(append?: boolean, errorPaths?: ErrorPaths): void { + ;(append ? reportExtraError : reportError)(this, this.def.error, errorPaths) + } + + $dataError(): void { + reportError(this, this.def.$dataError || keyword$DataError) + } + + reset(): void { + if (this.errsCount === undefined) throw new Error('add "trackErrors" to keyword definition') + resetErrorsCount(this.gen, this.errsCount) + } + + ok(cond: Code | boolean): void { + if (!this.allErrors) this.gen.if(cond) + } + + setParams(obj: KeywordCxtParams, assign?: true): void { + if (assign) Object.assign(this.params, obj) + else this.params = obj + } + + block$data(valid: Name, codeBlock: () => void, $dataValid: Code = nil): void { + this.gen.block(() => { + this.check$data(valid, $dataValid) + codeBlock() + }) + } + + check$data(valid: Name = nil, $dataValid: Code = nil): void { + if (!this.$data) return + const {gen, schemaCode, schemaType, def} = this + gen.if(or(_`${schemaCode} === undefined`, $dataValid)) + if (valid !== nil) gen.assign(valid, true) + if (schemaType.length || def.validateSchema) { + gen.elseIf(this.invalid$data()) + this.$dataError() + if (valid !== nil) gen.assign(valid, false) + } + gen.else() + } + + invalid$data(): Code { + const {gen, schemaCode, schemaType, def, it} = this + return or(wrong$DataType(), invalid$DataSchema()) + + function wrong$DataType(): Code { + if (schemaType.length) { + /* istanbul ignore if */ + if (!(schemaCode instanceof Name)) throw new Error("ajv implementation error") + const st = Array.isArray(schemaType) ? schemaType : [schemaType] + return _`${checkDataTypes(st, schemaCode, it.opts.strictNumbers, DataType.Wrong)}` + } + return nil + } + + function invalid$DataSchema(): Code { + if (def.validateSchema) { + const validateSchemaRef = gen.scopeValue("validate$data", {ref: def.validateSchema}) // TODO value.code for standalone + return _`!${validateSchemaRef}(${schemaCode})` + } + return nil + } + } + + subschema(appl: SubschemaArgs, valid: Name): SchemaCxt { + const subschema = getSubschema(this.it, appl) + extendSubschemaData(subschema, this.it, appl) + extendSubschemaMode(subschema, appl) + const nextContext = {...this.it, ...subschema, items: undefined, props: undefined} + subschemaCode(nextContext, valid) + return nextContext + } + + mergeEvaluated(schemaCxt: SchemaCxt, toName?: typeof Name): void { + const {it, gen} = this + if (!it.opts.unevaluated) return + if (it.props !== true && schemaCxt.props !== undefined) { + it.props = mergeEvaluated.props(gen, schemaCxt.props, it.props, toName) + } + if (it.items !== true && schemaCxt.items !== undefined) { + it.items = mergeEvaluated.items(gen, schemaCxt.items, it.items, toName) + } + } + + mergeValidEvaluated(schemaCxt: SchemaCxt, valid: Name): boolean | void { + const {it, gen} = this + if (it.opts.unevaluated && (it.props !== true || it.items !== true)) { + gen.if(valid, () => this.mergeEvaluated(schemaCxt, Name)) + return true + } + } +} + +function keywordCode( + it: SchemaObjCxt, + keyword: string, + def: AddedKeywordDefinition, + ruleType?: JSONType +): void { + const cxt = new KeywordCxt(it, def, keyword) + if ("code" in def) { + def.code(cxt, ruleType) + } else if (cxt.$data && def.validate) { + funcKeywordCode(cxt, def) + } else if ("macro" in def) { + macroKeywordCode(cxt, def) + } else if (def.compile || def.validate) { + funcKeywordCode(cxt, def) + } +} + +const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/ +const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/ +export function getData( + $data: string, + {dataLevel, dataNames, dataPathArr}: SchemaCxt +): Code | number { + let jsonPointer + let data: Code + if ($data === "") return N.rootData + if ($data[0] === "/") { + if (!JSON_POINTER.test($data)) throw new Error(`Invalid JSON-pointer: ${$data}`) + jsonPointer = $data + data = N.rootData + } else { + const matches = RELATIVE_JSON_POINTER.exec($data) + if (!matches) throw new Error(`Invalid JSON-pointer: ${$data}`) + const up: number = +matches[1] + jsonPointer = matches[2] + if (jsonPointer === "#") { + if (up >= dataLevel) throw new Error(errorMsg("property/index", up)) + return dataPathArr[dataLevel - up] + } + if (up > dataLevel) throw new Error(errorMsg("data", up)) + data = dataNames[dataLevel - up] + if (!jsonPointer) return data + } + + let expr = data + const segments = jsonPointer.split("/") + for (const segment of segments) { + if (segment) { + data = _`${data}${getProperty(unescapeJsonPointer(segment))}` + expr = _`${expr} && ${data}` + } + } + return expr + + function errorMsg(pointerType: string, up: number): string { + return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}` + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/keyword.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/keyword.ts new file mode 100644 index 000000000..f854aa710 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/keyword.ts @@ -0,0 +1,171 @@ +import type {KeywordCxt} from "." +import type { + AnySchema, + SchemaValidateFunction, + AnyValidateFunction, + AddedKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, +} from "../../types" +import type {SchemaObjCxt} from ".." +import {_, nil, not, stringify, Code, Name, CodeGen} from "../codegen" +import N from "../names" +import type {JSONType} from "../rules" +import {callValidateCode} from "../../vocabularies/code" +import {extendErrors} from "../errors" + +type KeywordCompilationResult = AnySchema | SchemaValidateFunction | AnyValidateFunction + +export function macroKeywordCode(cxt: KeywordCxt, def: MacroKeywordDefinition): void { + const {gen, keyword, schema, parentSchema, it} = cxt + const macroSchema = def.macro.call(it.self, schema, parentSchema, it) + const schemaRef = useKeyword(gen, keyword, macroSchema) + if (it.opts.validateSchema !== false) it.self.validateSchema(macroSchema, true) + + const valid = gen.name("valid") + cxt.subschema( + { + schema: macroSchema, + schemaPath: nil, + errSchemaPath: `${it.errSchemaPath}/${keyword}`, + topSchemaRef: schemaRef, + compositeRule: true, + }, + valid + ) + cxt.pass(valid, () => cxt.error(true)) +} + +export function funcKeywordCode(cxt: KeywordCxt, def: FuncKeywordDefinition): void { + const {gen, keyword, schema, parentSchema, $data, it} = cxt + checkAsyncKeyword(it, def) + const validate = + !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate + const validateRef = useKeyword(gen, keyword, validate) + const valid = gen.let("valid") + cxt.block$data(valid, validateKeyword) + cxt.ok(def.valid ?? valid) + + function validateKeyword(): void { + if (def.errors === false) { + assignValid() + if (def.modifying) modifyData(cxt) + reportErrs(() => cxt.error()) + } else { + const ruleErrs = def.async ? validateAsync() : validateSync() + if (def.modifying) modifyData(cxt) + reportErrs(() => addErrs(cxt, ruleErrs)) + } + } + + function validateAsync(): Name { + const ruleErrs = gen.let("ruleErrs", null) + gen.try( + () => assignValid(_`await `), + (e) => + gen.assign(valid, false).if( + _`${e} instanceof ${it.ValidationError as Name}`, + () => gen.assign(ruleErrs, _`${e}.errors`), + () => gen.throw(e) + ) + ) + return ruleErrs + } + + function validateSync(): Code { + const validateErrs = _`${validateRef}.errors` + gen.assign(validateErrs, null) + assignValid(nil) + return validateErrs + } + + function assignValid(_await: Code = def.async ? _`await ` : nil): void { + const passCxt = it.opts.passContext ? N.this : N.self + const passSchema = !(("compile" in def && !$data) || def.schema === false) + gen.assign( + valid, + _`${_await}${callValidateCode(cxt, validateRef, passCxt, passSchema)}`, + def.modifying + ) + } + + function reportErrs(errors: () => void): void { + gen.if(not(def.valid ?? valid), errors) + } +} + +function modifyData(cxt: KeywordCxt): void { + const {gen, data, it} = cxt + gen.if(it.parentData, () => gen.assign(data, _`${it.parentData}[${it.parentDataProperty}]`)) +} + +function addErrs(cxt: KeywordCxt, errs: Code): void { + const {gen} = cxt + gen.if( + _`Array.isArray(${errs})`, + () => { + gen + .assign(N.vErrors, _`${N.vErrors} === null ? ${errs} : ${N.vErrors}.concat(${errs})`) + .assign(N.errors, _`${N.vErrors}.length`) + extendErrors(cxt) + }, + () => cxt.error() + ) +} + +function checkAsyncKeyword({schemaEnv}: SchemaObjCxt, def: FuncKeywordDefinition): void { + if (def.async && !schemaEnv.$async) throw new Error("async keyword in sync schema") +} + +function useKeyword(gen: CodeGen, keyword: string, result?: KeywordCompilationResult): Name { + if (result === undefined) throw new Error(`keyword "${keyword}" failed to compile`) + return gen.scopeValue( + "keyword", + typeof result == "function" ? {ref: result} : {ref: result, code: stringify(result)} + ) +} + +export function validSchemaType( + schema: unknown, + schemaType: JSONType[], + allowUndefined = false +): boolean { + // TODO add tests + return ( + !schemaType.length || + schemaType.some((st) => + st === "array" + ? Array.isArray(schema) + : st === "object" + ? schema && typeof schema == "object" && !Array.isArray(schema) + : typeof schema == st || (allowUndefined && typeof schema == "undefined") + ) + ) +} + +export function validateKeywordUsage( + {schema, opts, self, errSchemaPath}: SchemaObjCxt, + def: AddedKeywordDefinition, + keyword: string +): void { + /* istanbul ignore if */ + if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) { + throw new Error("ajv implementation error") + } + + const deps = def.dependencies + if (deps?.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) { + throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`) + } + + if (def.validateSchema) { + const valid = def.validateSchema(schema[keyword]) + if (!valid) { + const msg = + `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + + self.errorsText(def.validateSchema.errors) + if (opts.validateSchema === "log") self.logger.error(msg) + else throw new Error(msg) + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/subschema.ts b/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/subschema.ts new file mode 100644 index 000000000..9072ed774 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/compile/validate/subschema.ts @@ -0,0 +1,135 @@ +import type {AnySchema} from "../../types" +import type {SchemaObjCxt} from ".." +import {_, str, getProperty, Code, Name} from "../codegen" +import {escapeFragment, getErrorPath, Type} from "../util" +import type {JSONType} from "../rules" + +export interface SubschemaContext { + // TODO use Optional? align with SchemCxt property types + schema: AnySchema + schemaPath: Code + errSchemaPath: string + topSchemaRef?: Code + errorPath?: Code + dataLevel?: number + dataTypes?: JSONType[] + data?: Name + parentData?: Name + parentDataProperty?: Code | number + dataNames?: Name[] + dataPathArr?: (Code | number)[] + propertyName?: Name + jtdDiscriminator?: string + jtdMetadata?: boolean + compositeRule?: true + createErrors?: boolean + allErrors?: boolean +} + +export type SubschemaArgs = Partial<{ + keyword: string + schemaProp: string | number + schema: AnySchema + schemaPath: Code + errSchemaPath: string + topSchemaRef: Code + data: Name | Code + dataProp: Code | string | number + dataTypes: JSONType[] + definedProperties: Set + propertyName: Name + dataPropType: Type + jtdDiscriminator: string + jtdMetadata: boolean + compositeRule: true + createErrors: boolean + allErrors: boolean +}> + +export function getSubschema( + it: SchemaObjCxt, + {keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef}: SubschemaArgs +): SubschemaContext { + if (keyword !== undefined && schema !== undefined) { + throw new Error('both "keyword" and "schema" passed, only one allowed') + } + + if (keyword !== undefined) { + const sch = it.schema[keyword] + return schemaProp === undefined + ? { + schema: sch, + schemaPath: _`${it.schemaPath}${getProperty(keyword)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}`, + } + : { + schema: sch[schemaProp], + schemaPath: _`${it.schemaPath}${getProperty(keyword)}${getProperty(schemaProp)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}/${escapeFragment(schemaProp)}`, + } + } + + if (schema !== undefined) { + if (schemaPath === undefined || errSchemaPath === undefined || topSchemaRef === undefined) { + throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"') + } + return { + schema, + schemaPath, + topSchemaRef, + errSchemaPath, + } + } + + throw new Error('either "keyword" or "schema" must be passed') +} + +export function extendSubschemaData( + subschema: SubschemaContext, + it: SchemaObjCxt, + {dataProp, dataPropType: dpType, data, dataTypes, propertyName}: SubschemaArgs +): void { + if (data !== undefined && dataProp !== undefined) { + throw new Error('both "data" and "dataProp" passed, only one allowed') + } + + const {gen} = it + + if (dataProp !== undefined) { + const {errorPath, dataPathArr, opts} = it + const nextData = gen.let("data", _`${it.data}${getProperty(dataProp)}`, true) + dataContextProps(nextData) + subschema.errorPath = str`${errorPath}${getErrorPath(dataProp, dpType, opts.jsPropertySyntax)}` + subschema.parentDataProperty = _`${dataProp}` + subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty] + } + + if (data !== undefined) { + const nextData = data instanceof Name ? data : gen.let("data", data, true) // replaceable if used once? + dataContextProps(nextData) + if (propertyName !== undefined) subschema.propertyName = propertyName + // TODO something is possibly wrong here with not changing parentDataProperty and not appending dataPathArr + } + + if (dataTypes) subschema.dataTypes = dataTypes + + function dataContextProps(_nextData: Name): void { + subschema.data = _nextData + subschema.dataLevel = it.dataLevel + 1 + subschema.dataTypes = [] + it.definedProperties = new Set() + subschema.parentData = it.data + subschema.dataNames = [...it.dataNames, _nextData] + } +} + +export function extendSubschemaMode( + subschema: SubschemaContext, + {jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors}: SubschemaArgs +): void { + if (compositeRule !== undefined) subschema.compositeRule = compositeRule + if (createErrors !== undefined) subschema.createErrors = createErrors + if (allErrors !== undefined) subschema.allErrors = allErrors + subschema.jtdDiscriminator = jtdDiscriminator // not inherited + subschema.jtdMetadata = jtdMetadata // not inherited +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/core.ts b/node_modules/ajv-formats/node_modules/ajv/lib/core.ts new file mode 100644 index 000000000..3686ffe76 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/core.ts @@ -0,0 +1,887 @@ +export { + Format, + FormatDefinition, + AsyncFormatDefinition, + KeywordDefinition, + KeywordErrorDefinition, + CodeKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, + Vocabulary, + Schema, + SchemaObject, + AnySchemaObject, + AsyncSchema, + AnySchema, + ValidateFunction, + AsyncValidateFunction, + AnyValidateFunction, + ErrorObject, + ErrorNoParams, +} from "./types" + +export {SchemaCxt, SchemaObjCxt} from "./compile" +export interface Plugin { + (ajv: Ajv, options?: Opts): Ajv + [prop: string]: any +} + +export {KeywordCxt} from "./compile/validate" +export {DefinedError} from "./vocabularies/errors" +export {JSONType} from "./compile/rules" +export {JSONSchemaType} from "./types/json-schema" +export {JTDSchemaType, SomeJTDSchemaType, JTDDataType} from "./types/jtd-schema" +export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" + +import type { + Schema, + AnySchema, + AnySchemaObject, + SchemaObject, + AsyncSchema, + Vocabulary, + KeywordDefinition, + AddedKeywordDefinition, + AnyValidateFunction, + ValidateFunction, + AsyncValidateFunction, + ErrorObject, + Format, + AddedFormat, + RegExpEngine, + UriResolver, +} from "./types" +import type {JSONSchemaType} from "./types/json-schema" +import type {JTDSchemaType, SomeJTDSchemaType, JTDDataType} from "./types/jtd-schema" +import ValidationError from "./runtime/validation_error" +import MissingRefError from "./compile/ref_error" +import {getRules, ValidationRules, Rule, RuleGroup, JSONType} from "./compile/rules" +import {SchemaEnv, compileSchema, resolveSchema} from "./compile" +import {Code, ValueScope} from "./compile/codegen" +import {normalizeId, getSchemaRefs} from "./compile/resolve" +import {getJSONTypes} from "./compile/validate/dataType" +import {eachItem} from "./compile/util" +import * as $dataRefSchema from "./refs/data.json" + +import DefaultUriResolver from "./runtime/uri" + +const defaultRegExp: RegExpEngine = (str, flags) => new RegExp(str, flags) +defaultRegExp.code = "new RegExp" + +const META_IGNORE_OPTIONS: (keyof Options)[] = ["removeAdditional", "useDefaults", "coerceTypes"] +const EXT_SCOPE_NAMES = new Set([ + "validate", + "serialize", + "parse", + "wrapper", + "root", + "schema", + "keyword", + "pattern", + "formats", + "validate$data", + "func", + "obj", + "Error", +]) + +export type Options = CurrentOptions & DeprecatedOptions + +export interface CurrentOptions { + // strict mode options (NEW) + strict?: boolean | "log" + strictSchema?: boolean | "log" + strictNumbers?: boolean | "log" + strictTypes?: boolean | "log" + strictTuples?: boolean | "log" + strictRequired?: boolean | "log" + allowMatchingProperties?: boolean // disables a strict mode restriction + allowUnionTypes?: boolean + validateFormats?: boolean + // validation and reporting options: + $data?: boolean + allErrors?: boolean + verbose?: boolean + discriminator?: boolean + unicodeRegExp?: boolean + timestamp?: "string" | "date" // JTD only + parseDate?: boolean // JTD only + allowDate?: boolean // JTD only + $comment?: + | true + | ((comment: string, schemaPath?: string, rootSchema?: AnySchemaObject) => unknown) + formats?: {[Name in string]?: Format} + keywords?: Vocabulary + schemas?: AnySchema[] | {[Key in string]?: AnySchema} + logger?: Logger | false + loadSchema?: (uri: string) => Promise + // options to modify validated data: + removeAdditional?: boolean | "all" | "failing" + useDefaults?: boolean | "empty" + coerceTypes?: boolean | "array" + // advanced options: + next?: boolean // NEW + unevaluated?: boolean // NEW + dynamicRef?: boolean // NEW + schemaId?: "id" | "$id" + jtd?: boolean // NEW + meta?: SchemaObject | boolean + defaultMeta?: string | AnySchemaObject + validateSchema?: boolean | "log" + addUsedSchema?: boolean + inlineRefs?: boolean | number + passContext?: boolean + loopRequired?: number + loopEnum?: number // NEW + ownProperties?: boolean + multipleOfPrecision?: number + int32range?: boolean // JTD only + messages?: boolean + code?: CodeOptions // NEW + uriResolver?: UriResolver +} + +export interface CodeOptions { + es5?: boolean + esm?: boolean + lines?: boolean + optimize?: boolean | number + formats?: Code // code to require (or construct) map of available formats - for standalone code + source?: boolean + process?: (code: string, schema?: SchemaEnv) => string + regExp?: RegExpEngine +} + +interface InstanceCodeOptions extends CodeOptions { + regExp: RegExpEngine + optimize: number +} + +interface DeprecatedOptions { + /** @deprecated */ + ignoreKeywordsWithRef?: boolean + /** @deprecated */ + jsPropertySyntax?: boolean // added instead of jsonPointers + /** @deprecated */ + unicode?: boolean +} + +interface RemovedOptions { + format?: boolean + errorDataPath?: "object" | "property" + nullable?: boolean // "nullable" keyword is supported by default + jsonPointers?: boolean + extendRefs?: true | "ignore" | "fail" + missingRefs?: true | "ignore" | "fail" + processCode?: (code: string, schema?: SchemaEnv) => string + sourceCode?: boolean + strictDefaults?: boolean + strictKeywords?: boolean + uniqueItems?: boolean + unknownFormats?: true | string[] | "ignore" + cache?: any + serialize?: (schema: AnySchema) => unknown + ajvErrors?: boolean +} + +type OptionsInfo = { + [K in keyof T]-?: string | undefined +} + +const removedOptions: OptionsInfo = { + errorDataPath: "", + format: "`validateFormats: false` can be used instead.", + nullable: '"nullable" keyword is supported by default.', + jsonPointers: "Deprecated jsPropertySyntax can be used instead.", + extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.", + missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.", + processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`", + sourceCode: "Use option `code: {source: true}`", + strictDefaults: "It is default now, see option `strict`.", + strictKeywords: "It is default now, see option `strict`.", + uniqueItems: '"uniqueItems" keyword is always validated.', + unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).", + cache: "Map is used as cache, schema object as key.", + serialize: "Map is used as cache, schema object as key.", + ajvErrors: "It is default now.", +} + +const deprecatedOptions: OptionsInfo = { + ignoreKeywordsWithRef: "", + jsPropertySyntax: "", + unicode: '"minLength"/"maxLength" account for unicode characters by default.', +} + +type RequiredInstanceOptions = { + [K in + | "strictSchema" + | "strictNumbers" + | "strictTypes" + | "strictTuples" + | "strictRequired" + | "inlineRefs" + | "loopRequired" + | "loopEnum" + | "meta" + | "messages" + | "schemaId" + | "addUsedSchema" + | "validateSchema" + | "validateFormats" + | "int32range" + | "unicodeRegExp" + | "uriResolver"]: NonNullable +} & {code: InstanceCodeOptions} + +export type InstanceOptions = Options & RequiredInstanceOptions + +const MAX_EXPRESSION = 200 + +// eslint-disable-next-line complexity +function requiredOptions(o: Options): RequiredInstanceOptions { + const s = o.strict + const _optz = o.code?.optimize + const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0 + const regExp = o.code?.regExp ?? defaultRegExp + const uriResolver = o.uriResolver ?? DefaultUriResolver + return { + strictSchema: o.strictSchema ?? s ?? true, + strictNumbers: o.strictNumbers ?? s ?? true, + strictTypes: o.strictTypes ?? s ?? "log", + strictTuples: o.strictTuples ?? s ?? "log", + strictRequired: o.strictRequired ?? s ?? false, + code: o.code ? {...o.code, optimize, regExp} : {optimize, regExp}, + loopRequired: o.loopRequired ?? MAX_EXPRESSION, + loopEnum: o.loopEnum ?? MAX_EXPRESSION, + meta: o.meta ?? true, + messages: o.messages ?? true, + inlineRefs: o.inlineRefs ?? true, + schemaId: o.schemaId ?? "$id", + addUsedSchema: o.addUsedSchema ?? true, + validateSchema: o.validateSchema ?? true, + validateFormats: o.validateFormats ?? true, + unicodeRegExp: o.unicodeRegExp ?? true, + int32range: o.int32range ?? true, + uriResolver: uriResolver, + } +} + +export interface Logger { + log(...args: unknown[]): unknown + warn(...args: unknown[]): unknown + error(...args: unknown[]): unknown +} + +export default class Ajv { + opts: InstanceOptions + errors?: ErrorObject[] | null // errors from the last validation + logger: Logger + // shared external scope values for compiled functions + readonly scope: ValueScope + readonly schemas: {[Key in string]?: SchemaEnv} = {} + readonly refs: {[Ref in string]?: SchemaEnv | string} = {} + readonly formats: {[Name in string]?: AddedFormat} = {} + readonly RULES: ValidationRules + readonly _compilations: Set = new Set() + private readonly _loading: {[Ref in string]?: Promise} = {} + private readonly _cache: Map = new Map() + private readonly _metaOpts: InstanceOptions + + static ValidationError = ValidationError + static MissingRefError = MissingRefError + + constructor(opts: Options = {}) { + opts = this.opts = {...opts, ...requiredOptions(opts)} + const {es5, lines} = this.opts.code + + this.scope = new ValueScope({scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines}) + this.logger = getLogger(opts.logger) + const formatOpt = opts.validateFormats + opts.validateFormats = false + + this.RULES = getRules() + checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED") + checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn") + this._metaOpts = getMetaSchemaOptions.call(this) + + if (opts.formats) addInitialFormats.call(this) + this._addVocabularies() + this._addDefaultMetaSchema() + if (opts.keywords) addInitialKeywords.call(this, opts.keywords) + if (typeof opts.meta == "object") this.addMetaSchema(opts.meta) + addInitialSchemas.call(this) + opts.validateFormats = formatOpt + } + + _addVocabularies(): void { + this.addKeyword("$async") + } + + _addDefaultMetaSchema(): void { + const {$data, meta, schemaId} = this.opts + let _dataRefSchema: SchemaObject = $dataRefSchema + if (schemaId === "id") { + _dataRefSchema = {...$dataRefSchema} + _dataRefSchema.id = _dataRefSchema.$id + delete _dataRefSchema.$id + } + if (meta && $data) this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false) + } + + defaultMeta(): string | AnySchemaObject | undefined { + const {meta, schemaId} = this.opts + return (this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : undefined) + } + + // Validate data using schema + // AnySchema will be compiled and cached using schema itself as a key for Map + validate(schema: Schema | string, data: unknown): boolean + validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise + validate(schema: Schema | JSONSchemaType | string, data: unknown): data is T + // Separated for type inference to work + // eslint-disable-next-line @typescript-eslint/unified-signatures + validate(schema: JTDSchemaType, data: unknown): data is T + // This overload is only intended for typescript inference, the first + // argument prevents manual type annotation from matching this overload + validate( + schema: T, + data: unknown + ): data is JTDDataType + validate(schema: AsyncSchema, data: unknown | T): Promise + validate(schemaKeyRef: AnySchema | string, data: unknown): data is T | Promise + validate( + schemaKeyRef: AnySchema | string, // key, ref or schema object + data: unknown | T // to be validated + ): boolean | Promise { + let v: AnyValidateFunction | undefined + if (typeof schemaKeyRef == "string") { + v = this.getSchema(schemaKeyRef) + if (!v) throw new Error(`no schema with key or ref "${schemaKeyRef}"`) + } else { + v = this.compile(schemaKeyRef) + } + + const valid = v(data) + if (!("$async" in v)) this.errors = v.errors + return valid + } + + // Create validation function for passed schema + // _meta: true if schema is a meta-schema. Used internally to compile meta schemas of user-defined keywords. + compile(schema: Schema | JSONSchemaType, _meta?: boolean): ValidateFunction + // Separated for type inference to work + // eslint-disable-next-line @typescript-eslint/unified-signatures + compile(schema: JTDSchemaType, _meta?: boolean): ValidateFunction + // This overload is only intended for typescript inference, the first + // argument prevents manual type annotation from matching this overload + compile( + schema: T, + _meta?: boolean + ): ValidateFunction> + compile(schema: AsyncSchema, _meta?: boolean): AsyncValidateFunction + compile(schema: AnySchema, _meta?: boolean): AnyValidateFunction + compile(schema: AnySchema, _meta?: boolean): AnyValidateFunction { + const sch = this._addSchema(schema, _meta) + return (sch.validate || this._compileSchemaEnv(sch)) as AnyValidateFunction + } + + // Creates validating function for passed schema with asynchronous loading of missing schemas. + // `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema. + // TODO allow passing schema URI + // meta - optional true to compile meta-schema + compileAsync( + schema: SchemaObject | JSONSchemaType, + _meta?: boolean + ): Promise> + // Separated for type inference to work + // eslint-disable-next-line @typescript-eslint/unified-signatures + compileAsync(schema: JTDSchemaType, _meta?: boolean): Promise> + compileAsync(schema: AsyncSchema, meta?: boolean): Promise> + // eslint-disable-next-line @typescript-eslint/unified-signatures + compileAsync( + schema: AnySchemaObject, + meta?: boolean + ): Promise> + compileAsync( + schema: AnySchemaObject, + meta?: boolean + ): Promise> { + if (typeof this.opts.loadSchema != "function") { + throw new Error("options.loadSchema should be a function") + } + const {loadSchema} = this.opts + return runCompileAsync.call(this, schema, meta) + + async function runCompileAsync( + this: Ajv, + _schema: AnySchemaObject, + _meta?: boolean + ): Promise { + await loadMetaSchema.call(this, _schema.$schema) + const sch = this._addSchema(_schema, _meta) + return sch.validate || _compileAsync.call(this, sch) + } + + async function loadMetaSchema(this: Ajv, $ref?: string): Promise { + if ($ref && !this.getSchema($ref)) { + await runCompileAsync.call(this, {$ref}, true) + } + } + + async function _compileAsync(this: Ajv, sch: SchemaEnv): Promise { + try { + return this._compileSchemaEnv(sch) + } catch (e) { + if (!(e instanceof MissingRefError)) throw e + checkLoaded.call(this, e) + await loadMissingSchema.call(this, e.missingSchema) + return _compileAsync.call(this, sch) + } + } + + function checkLoaded(this: Ajv, {missingSchema: ref, missingRef}: MissingRefError): void { + if (this.refs[ref]) { + throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`) + } + } + + async function loadMissingSchema(this: Ajv, ref: string): Promise { + const _schema = await _loadSchema.call(this, ref) + if (!this.refs[ref]) await loadMetaSchema.call(this, _schema.$schema) + if (!this.refs[ref]) this.addSchema(_schema, ref, meta) + } + + async function _loadSchema(this: Ajv, ref: string): Promise { + const p = this._loading[ref] + if (p) return p + try { + return await (this._loading[ref] = loadSchema(ref)) + } finally { + delete this._loading[ref] + } + } + } + + // Adds schema to the instance + addSchema( + schema: AnySchema | AnySchema[], // If array is passed, `key` will be ignored + key?: string, // Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. + _meta?: boolean, // true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. + _validateSchema = this.opts.validateSchema // false to skip schema validation. Used internally, option validateSchema should be used instead. + ): Ajv { + if (Array.isArray(schema)) { + for (const sch of schema) this.addSchema(sch, undefined, _meta, _validateSchema) + return this + } + let id: string | undefined + if (typeof schema === "object") { + const {schemaId} = this.opts + id = schema[schemaId] + if (id !== undefined && typeof id != "string") { + throw new Error(`schema ${schemaId} must be string`) + } + } + key = normalizeId(key || id) + this._checkUnique(key) + this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true) + return this + } + + // Add schema that will be used to validate other schemas + // options in META_IGNORE_OPTIONS are alway set to false + addMetaSchema( + schema: AnySchemaObject, + key?: string, // schema key + _validateSchema = this.opts.validateSchema // false to skip schema validation, can be used to override validateSchema option for meta-schema + ): Ajv { + this.addSchema(schema, key, true, _validateSchema) + return this + } + + // Validate schema against its meta-schema + validateSchema(schema: AnySchema, throwOrLogError?: boolean): boolean | Promise { + if (typeof schema == "boolean") return true + let $schema: string | AnySchemaObject | undefined + $schema = schema.$schema + if ($schema !== undefined && typeof $schema != "string") { + throw new Error("$schema must be a string") + } + $schema = $schema || this.opts.defaultMeta || this.defaultMeta() + if (!$schema) { + this.logger.warn("meta-schema not available") + this.errors = null + return true + } + const valid = this.validate($schema, schema) + if (!valid && throwOrLogError) { + const message = "schema is invalid: " + this.errorsText() + if (this.opts.validateSchema === "log") this.logger.error(message) + else throw new Error(message) + } + return valid + } + + // Get compiled schema by `key` or `ref`. + // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id) + getSchema(keyRef: string): AnyValidateFunction | undefined { + let sch + while (typeof (sch = getSchEnv.call(this, keyRef)) == "string") keyRef = sch + if (sch === undefined) { + const {schemaId} = this.opts + const root = new SchemaEnv({schema: {}, schemaId}) + sch = resolveSchema.call(this, root, keyRef) + if (!sch) return + this.refs[keyRef] = sch + } + return (sch.validate || this._compileSchemaEnv(sch)) as AnyValidateFunction | undefined + } + + // Remove cached schema(s). + // If no parameter is passed all schemas but meta-schemas are removed. + // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. + // Even if schema is referenced by other schemas it still can be removed as other schemas have local references. + removeSchema(schemaKeyRef?: AnySchema | string | RegExp): Ajv { + if (schemaKeyRef instanceof RegExp) { + this._removeAllSchemas(this.schemas, schemaKeyRef) + this._removeAllSchemas(this.refs, schemaKeyRef) + return this + } + switch (typeof schemaKeyRef) { + case "undefined": + this._removeAllSchemas(this.schemas) + this._removeAllSchemas(this.refs) + this._cache.clear() + return this + case "string": { + const sch = getSchEnv.call(this, schemaKeyRef) + if (typeof sch == "object") this._cache.delete(sch.schema) + delete this.schemas[schemaKeyRef] + delete this.refs[schemaKeyRef] + return this + } + case "object": { + const cacheKey = schemaKeyRef + this._cache.delete(cacheKey) + let id = schemaKeyRef[this.opts.schemaId] + if (id) { + id = normalizeId(id) + delete this.schemas[id] + delete this.refs[id] + } + return this + } + default: + throw new Error("ajv.removeSchema: invalid parameter") + } + } + + // add "vocabulary" - a collection of keywords + addVocabulary(definitions: Vocabulary): Ajv { + for (const def of definitions) this.addKeyword(def) + return this + } + + addKeyword( + kwdOrDef: string | KeywordDefinition, + def?: KeywordDefinition // deprecated + ): Ajv { + let keyword: string | string[] + if (typeof kwdOrDef == "string") { + keyword = kwdOrDef + if (typeof def == "object") { + this.logger.warn("these parameters are deprecated, see docs for addKeyword") + def.keyword = keyword + } + } else if (typeof kwdOrDef == "object" && def === undefined) { + def = kwdOrDef + keyword = def.keyword + if (Array.isArray(keyword) && !keyword.length) { + throw new Error("addKeywords: keyword must be string or non-empty array") + } + } else { + throw new Error("invalid addKeywords parameters") + } + + checkKeyword.call(this, keyword, def) + if (!def) { + eachItem(keyword, (kwd) => addRule.call(this, kwd)) + return this + } + keywordMetaschema.call(this, def) + const definition: AddedKeywordDefinition = { + ...def, + type: getJSONTypes(def.type), + schemaType: getJSONTypes(def.schemaType), + } + eachItem( + keyword, + definition.type.length === 0 + ? (k) => addRule.call(this, k, definition) + : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t)) + ) + return this + } + + getKeyword(keyword: string): AddedKeywordDefinition | boolean { + const rule = this.RULES.all[keyword] + return typeof rule == "object" ? rule.definition : !!rule + } + + // Remove keyword + removeKeyword(keyword: string): Ajv { + // TODO return type should be Ajv + const {RULES} = this + delete RULES.keywords[keyword] + delete RULES.all[keyword] + for (const group of RULES.rules) { + const i = group.rules.findIndex((rule) => rule.keyword === keyword) + if (i >= 0) group.rules.splice(i, 1) + } + return this + } + + // Add format + addFormat(name: string, format: Format): Ajv { + if (typeof format == "string") format = new RegExp(format) + this.formats[name] = format + return this + } + + errorsText( + errors: ErrorObject[] | null | undefined = this.errors, // optional array of validation errors + {separator = ", ", dataVar = "data"}: ErrorsTextOptions = {} // optional options with properties `separator` and `dataVar` + ): string { + if (!errors || errors.length === 0) return "No errors" + return errors + .map((e) => `${dataVar}${e.instancePath} ${e.message}`) + .reduce((text, msg) => text + separator + msg) + } + + $dataMetaSchema(metaSchema: AnySchemaObject, keywordsJsonPointers: string[]): AnySchemaObject { + const rules = this.RULES.all + metaSchema = JSON.parse(JSON.stringify(metaSchema)) + for (const jsonPointer of keywordsJsonPointers) { + const segments = jsonPointer.split("/").slice(1) // first segment is an empty string + let keywords = metaSchema + for (const seg of segments) keywords = keywords[seg] as AnySchemaObject + + for (const key in rules) { + const rule = rules[key] + if (typeof rule != "object") continue + const {$data} = rule.definition + const schema = keywords[key] as AnySchemaObject | undefined + if ($data && schema) keywords[key] = schemaOrData(schema) + } + } + + return metaSchema + } + + private _removeAllSchemas(schemas: {[Ref in string]?: SchemaEnv | string}, regex?: RegExp): void { + for (const keyRef in schemas) { + const sch = schemas[keyRef] + if (!regex || regex.test(keyRef)) { + if (typeof sch == "string") { + delete schemas[keyRef] + } else if (sch && !sch.meta) { + this._cache.delete(sch.schema) + delete schemas[keyRef] + } + } + } + } + + _addSchema( + schema: AnySchema, + meta?: boolean, + baseId?: string, + validateSchema = this.opts.validateSchema, + addSchema = this.opts.addUsedSchema + ): SchemaEnv { + let id: string | undefined + const {schemaId} = this.opts + if (typeof schema == "object") { + id = schema[schemaId] + } else { + if (this.opts.jtd) throw new Error("schema must be object") + else if (typeof schema != "boolean") throw new Error("schema must be object or boolean") + } + let sch = this._cache.get(schema) + if (sch !== undefined) return sch + + baseId = normalizeId(id || baseId) + const localRefs = getSchemaRefs.call(this, schema, baseId) + sch = new SchemaEnv({schema, schemaId, meta, baseId, localRefs}) + this._cache.set(sch.schema, sch) + if (addSchema && !baseId.startsWith("#")) { + // TODO atm it is allowed to overwrite schemas without id (instead of not adding them) + if (baseId) this._checkUnique(baseId) + this.refs[baseId] = sch + } + if (validateSchema) this.validateSchema(schema, true) + return sch + } + + private _checkUnique(id: string): void { + if (this.schemas[id] || this.refs[id]) { + throw new Error(`schema with key or id "${id}" already exists`) + } + } + + private _compileSchemaEnv(sch: SchemaEnv): AnyValidateFunction { + if (sch.meta) this._compileMetaSchema(sch) + else compileSchema.call(this, sch) + + /* istanbul ignore if */ + if (!sch.validate) throw new Error("ajv implementation error") + return sch.validate + } + + private _compileMetaSchema(sch: SchemaEnv): void { + const currentOpts = this.opts + this.opts = this._metaOpts + try { + compileSchema.call(this, sch) + } finally { + this.opts = currentOpts + } + } +} + +export interface ErrorsTextOptions { + separator?: string + dataVar?: string +} + +function checkOptions( + this: Ajv, + checkOpts: OptionsInfo, + options: Options & RemovedOptions, + msg: string, + log: "warn" | "error" = "error" +): void { + for (const key in checkOpts) { + const opt = key as keyof typeof checkOpts + if (opt in options) this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`) + } +} + +function getSchEnv(this: Ajv, keyRef: string): SchemaEnv | string | undefined { + keyRef = normalizeId(keyRef) // TODO tests fail without this line + return this.schemas[keyRef] || this.refs[keyRef] +} + +function addInitialSchemas(this: Ajv): void { + const optsSchemas = this.opts.schemas + if (!optsSchemas) return + if (Array.isArray(optsSchemas)) this.addSchema(optsSchemas) + else for (const key in optsSchemas) this.addSchema(optsSchemas[key] as AnySchema, key) +} + +function addInitialFormats(this: Ajv): void { + for (const name in this.opts.formats) { + const format = this.opts.formats[name] + if (format) this.addFormat(name, format) + } +} + +function addInitialKeywords( + this: Ajv, + defs: Vocabulary | {[K in string]?: KeywordDefinition} +): void { + if (Array.isArray(defs)) { + this.addVocabulary(defs) + return + } + this.logger.warn("keywords option as map is deprecated, pass array") + for (const keyword in defs) { + const def = defs[keyword] as KeywordDefinition + if (!def.keyword) def.keyword = keyword + this.addKeyword(def) + } +} + +function getMetaSchemaOptions(this: Ajv): InstanceOptions { + const metaOpts = {...this.opts} + for (const opt of META_IGNORE_OPTIONS) delete metaOpts[opt] + return metaOpts +} + +const noLogs = {log() {}, warn() {}, error() {}} + +function getLogger(logger?: Partial | false): Logger { + if (logger === false) return noLogs + if (logger === undefined) return console + if (logger.log && logger.warn && logger.error) return logger as Logger + throw new Error("logger must implement log, warn and error methods") +} + +const KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i + +function checkKeyword(this: Ajv, keyword: string | string[], def?: KeywordDefinition): void { + const {RULES} = this + eachItem(keyword, (kwd) => { + if (RULES.keywords[kwd]) throw new Error(`Keyword ${kwd} is already defined`) + if (!KEYWORD_NAME.test(kwd)) throw new Error(`Keyword ${kwd} has invalid name`) + }) + if (!def) return + if (def.$data && !("code" in def || "validate" in def)) { + throw new Error('$data keyword must have "code" or "validate" function') + } +} + +function addRule( + this: Ajv, + keyword: string, + definition?: AddedKeywordDefinition, + dataType?: JSONType +): void { + const post = definition?.post + if (dataType && post) throw new Error('keyword with "post" flag cannot have "type"') + const {RULES} = this + let ruleGroup = post ? RULES.post : RULES.rules.find(({type: t}) => t === dataType) + if (!ruleGroup) { + ruleGroup = {type: dataType, rules: []} + RULES.rules.push(ruleGroup) + } + RULES.keywords[keyword] = true + if (!definition) return + + const rule: Rule = { + keyword, + definition: { + ...definition, + type: getJSONTypes(definition.type), + schemaType: getJSONTypes(definition.schemaType), + }, + } + if (definition.before) addBeforeRule.call(this, ruleGroup, rule, definition.before) + else ruleGroup.rules.push(rule) + RULES.all[keyword] = rule + definition.implements?.forEach((kwd) => this.addKeyword(kwd)) +} + +function addBeforeRule(this: Ajv, ruleGroup: RuleGroup, rule: Rule, before: string): void { + const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before) + if (i >= 0) { + ruleGroup.rules.splice(i, 0, rule) + } else { + ruleGroup.rules.push(rule) + this.logger.warn(`rule ${before} is not defined`) + } +} + +function keywordMetaschema(this: Ajv, def: KeywordDefinition): void { + let {metaSchema} = def + if (metaSchema === undefined) return + if (def.$data && this.opts.$data) metaSchema = schemaOrData(metaSchema) + def.validateSchema = this.compile(metaSchema, true) +} + +const $dataRef = { + $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", +} + +function schemaOrData(schema: AnySchema): AnySchemaObject { + return {anyOf: [schema, $dataRef]} +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/jtd.ts b/node_modules/ajv-formats/node_modules/ajv/lib/jtd.ts new file mode 100644 index 000000000..b53749ba4 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/jtd.ts @@ -0,0 +1,129 @@ +import type {AnySchemaObject, SchemaObject, JTDParser} from "./types" +import type {JTDSchemaType, SomeJTDSchemaType, JTDDataType} from "./types/jtd-schema" +import AjvCore, {CurrentOptions} from "./core" +import jtdVocabulary from "./vocabularies/jtd" +import jtdMetaSchema from "./refs/jtd-schema" +import compileSerializer from "./compile/jtd/serialize" +import compileParser from "./compile/jtd/parse" +import {SchemaEnv} from "./compile" + +const META_SCHEMA_ID = "JTD-meta-schema" + +type JTDOptions = CurrentOptions & { + // strict mode options not supported with JTD: + strict?: never + allowMatchingProperties?: never + allowUnionTypes?: never + validateFormats?: never + // validation and reporting options not supported with JTD: + $data?: never + verbose?: boolean + $comment?: never + formats?: never + loadSchema?: never + // options to modify validated data: + useDefaults?: never + coerceTypes?: never + // advanced options: + next?: never + unevaluated?: never + dynamicRef?: never + meta?: boolean + defaultMeta?: never + inlineRefs?: boolean + loopRequired?: never + multipleOfPrecision?: never +} + +class Ajv extends AjvCore { + constructor(opts: JTDOptions = {}) { + super({ + ...opts, + jtd: true, + }) + } + + _addVocabularies(): void { + super._addVocabularies() + this.addVocabulary(jtdVocabulary) + } + + _addDefaultMetaSchema(): void { + super._addDefaultMetaSchema() + if (!this.opts.meta) return + this.addMetaSchema(jtdMetaSchema, META_SCHEMA_ID, false) + } + + defaultMeta(): string | AnySchemaObject | undefined { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)) + } + + compileSerializer(schema: SchemaObject): (data: T) => string + // Separated for type inference to work + // eslint-disable-next-line @typescript-eslint/unified-signatures + compileSerializer(schema: JTDSchemaType): (data: T) => string + compileSerializer(schema: SchemaObject): (data: T) => string { + const sch = this._addSchema(schema) + return sch.serialize || this._compileSerializer(sch) + } + + compileParser(schema: SchemaObject): JTDParser + // Separated for type inference to work + // eslint-disable-next-line @typescript-eslint/unified-signatures + compileParser(schema: JTDSchemaType): JTDParser + compileParser(schema: SchemaObject): JTDParser { + const sch = this._addSchema(schema) + return (sch.parse || this._compileParser(sch)) as JTDParser + } + + private _compileSerializer(sch: SchemaEnv): (data: T) => string { + compileSerializer.call(this, sch, (sch.schema as AnySchemaObject).definitions || {}) + /* istanbul ignore if */ + if (!sch.serialize) throw new Error("ajv implementation error") + return sch.serialize + } + + private _compileParser(sch: SchemaEnv): JTDParser { + compileParser.call(this, sch, (sch.schema as AnySchemaObject).definitions || {}) + /* istanbul ignore if */ + if (!sch.parse) throw new Error("ajv implementation error") + return sch.parse + } +} + +module.exports = exports = Ajv +Object.defineProperty(exports, "__esModule", {value: true}) + +export default Ajv + +export { + Format, + FormatDefinition, + AsyncFormatDefinition, + KeywordDefinition, + KeywordErrorDefinition, + CodeKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, + Vocabulary, + Schema, + SchemaObject, + AnySchemaObject, + AsyncSchema, + AnySchema, + ValidateFunction, + AsyncValidateFunction, + ErrorObject, + ErrorNoParams, + JTDParser, +} from "./types" + +export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core" +export {SchemaCxt, SchemaObjCxt} from "./compile" +export {KeywordCxt} from "./compile/validate" +export {JTDErrorObject} from "./vocabularies/jtd" +export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" + +export {JTDSchemaType, SomeJTDSchemaType, JTDDataType} +export {JTDOptions} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/data.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/data.json new file mode 100644 index 000000000..9ffc9f5ce --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/data.json @@ -0,0 +1,13 @@ +{ + "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", + "description": "Meta-schema for $data reference (JSON AnySchema extension proposal)", + "type": "object", + "required": ["$data"], + "properties": { + "$data": { + "type": "string", + "anyOf": [{"format": "relative-json-pointer"}, {"format": "json-pointer"}] + } + }, + "additionalProperties": false +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts new file mode 100644 index 000000000..b6ea7195f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts @@ -0,0 +1,28 @@ +import type Ajv from "../../core" +import type {AnySchemaObject} from "../../types" +import * as metaSchema from "./schema.json" +import * as applicator from "./meta/applicator.json" +import * as content from "./meta/content.json" +import * as core from "./meta/core.json" +import * as format from "./meta/format.json" +import * as metadata from "./meta/meta-data.json" +import * as validation from "./meta/validation.json" + +const META_SUPPORT_DATA = ["/properties"] + +export default function addMetaSchema2019(this: Ajv, $data?: boolean): Ajv { + ;[ + metaSchema, + applicator, + content, + core, + with$data(this, format), + metadata, + with$data(this, validation), + ].forEach((sch) => this.addMetaSchema(sch, undefined, false)) + return this + + function with$data(ajv: Ajv, sch: AnySchemaObject): AnySchemaObject { + return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json new file mode 100644 index 000000000..c5e91cf2a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json @@ -0,0 +1,53 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/applicator", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/applicator": true + }, + "$recursiveAnchor": true, + + "title": "Applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "additionalItems": {"$recursiveRef": "#"}, + "unevaluatedItems": {"$recursiveRef": "#"}, + "items": { + "anyOf": [{"$recursiveRef": "#"}, {"$ref": "#/$defs/schemaArray"}] + }, + "contains": {"$recursiveRef": "#"}, + "additionalProperties": {"$recursiveRef": "#"}, + "unevaluatedProperties": {"$recursiveRef": "#"}, + "properties": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependentSchemas": { + "type": "object", + "additionalProperties": { + "$recursiveRef": "#" + } + }, + "propertyNames": {"$recursiveRef": "#"}, + "if": {"$recursiveRef": "#"}, + "then": {"$recursiveRef": "#"}, + "else": {"$recursiveRef": "#"}, + "allOf": {"$ref": "#/$defs/schemaArray"}, + "anyOf": {"$ref": "#/$defs/schemaArray"}, + "oneOf": {"$ref": "#/$defs/schemaArray"}, + "not": {"$recursiveRef": "#"} + }, + "$defs": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$recursiveRef": "#"} + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json new file mode 100644 index 000000000..b8f637343 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/content", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + "$recursiveAnchor": true, + + "title": "Content vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "contentMediaType": {"type": "string"}, + "contentEncoding": {"type": "string"}, + "contentSchema": {"$recursiveRef": "#"} + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json new file mode 100644 index 000000000..f71adbff0 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/core", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true + }, + "$recursiveAnchor": true, + + "title": "Core vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference", + "$comment": "Non-empty fragments not allowed.", + "pattern": "^[^#]*#?$" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$anchor": { + "type": "string", + "pattern": "^[A-Za-z][-A-Za-z0-9.:_]*$" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$recursiveRef": { + "type": "string", + "format": "uri-reference" + }, + "$recursiveAnchor": { + "type": "boolean", + "default": false + }, + "$vocabulary": { + "type": "object", + "propertyNames": { + "type": "string", + "format": "uri" + }, + "additionalProperties": { + "type": "boolean" + } + }, + "$comment": { + "type": "string" + }, + "$defs": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json new file mode 100644 index 000000000..03ccfce26 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/format", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/format": true + }, + "$recursiveAnchor": true, + + "title": "Format vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "format": {"type": "string"} + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json new file mode 100644 index 000000000..0e194326f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/meta-data", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/meta-data": true + }, + "$recursiveAnchor": true, + + "title": "Meta-data vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "deprecated": { + "type": "boolean", + "default": false + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json new file mode 100644 index 000000000..7027a1279 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/validation", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/validation": true + }, + "$recursiveAnchor": true, + + "title": "Validation vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, + "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, + "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, + "minContains": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 1 + }, + "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, + "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/$defs/stringArray"}, + "dependentRequired": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + }, + "const": true, + "enum": { + "type": "array", + "items": true + }, + "type": { + "anyOf": [ + {"$ref": "#/$defs/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/$defs/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + } + }, + "$defs": { + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 0 + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json new file mode 100644 index 000000000..54eb7157a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/schema", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true, + "https://json-schema.org/draft/2019-09/vocab/applicator": true, + "https://json-schema.org/draft/2019-09/vocab/validation": true, + "https://json-schema.org/draft/2019-09/vocab/meta-data": true, + "https://json-schema.org/draft/2019-09/vocab/format": false, + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + "$recursiveAnchor": true, + + "title": "Core and Validation specifications meta-schema", + "allOf": [ + {"$ref": "meta/core"}, + {"$ref": "meta/applicator"}, + {"$ref": "meta/validation"}, + {"$ref": "meta/meta-data"}, + {"$ref": "meta/format"}, + {"$ref": "meta/content"} + ], + "type": ["object", "boolean"], + "properties": { + "definitions": { + "$comment": "While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.", + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + }, + "dependencies": { + "$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"dependentSchemas\" and \"dependentRequired\"", + "type": "object", + "additionalProperties": { + "anyOf": [{"$recursiveRef": "#"}, {"$ref": "meta/validation#/$defs/stringArray"}] + } + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts new file mode 100644 index 000000000..8e850d08b --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts @@ -0,0 +1,30 @@ +import type Ajv from "../../core" +import type {AnySchemaObject} from "../../types" +import * as metaSchema from "./schema.json" +import * as applicator from "./meta/applicator.json" +import * as unevaluated from "./meta/unevaluated.json" +import * as content from "./meta/content.json" +import * as core from "./meta/core.json" +import * as format from "./meta/format-annotation.json" +import * as metadata from "./meta/meta-data.json" +import * as validation from "./meta/validation.json" + +const META_SUPPORT_DATA = ["/properties"] + +export default function addMetaSchema2020(this: Ajv, $data?: boolean): Ajv { + ;[ + metaSchema, + applicator, + unevaluated, + content, + core, + with$data(this, format), + metadata, + with$data(this, validation), + ].forEach((sch) => this.addMetaSchema(sch, undefined, false)) + return this + + function with$data(ajv: Ajv, sch: AnySchemaObject): AnySchemaObject { + return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json new file mode 100644 index 000000000..674c913da --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json @@ -0,0 +1,48 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/applicator", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/applicator": true + }, + "$dynamicAnchor": "meta", + + "title": "Applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "prefixItems": {"$ref": "#/$defs/schemaArray"}, + "items": {"$dynamicRef": "#meta"}, + "contains": {"$dynamicRef": "#meta"}, + "additionalProperties": {"$dynamicRef": "#meta"}, + "properties": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependentSchemas": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "default": {} + }, + "propertyNames": {"$dynamicRef": "#meta"}, + "if": {"$dynamicRef": "#meta"}, + "then": {"$dynamicRef": "#meta"}, + "else": {"$dynamicRef": "#meta"}, + "allOf": {"$ref": "#/$defs/schemaArray"}, + "anyOf": {"$ref": "#/$defs/schemaArray"}, + "oneOf": {"$ref": "#/$defs/schemaArray"}, + "not": {"$dynamicRef": "#meta"} + }, + "$defs": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$dynamicRef": "#meta"} + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json new file mode 100644 index 000000000..2ae23ddb5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/content", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/content": true + }, + "$dynamicAnchor": "meta", + + "title": "Content vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "contentEncoding": {"type": "string"}, + "contentMediaType": {"type": "string"}, + "contentSchema": {"$dynamicRef": "#meta"} + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json new file mode 100644 index 000000000..4c8e5cb61 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json @@ -0,0 +1,51 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/core", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/core": true + }, + "$dynamicAnchor": "meta", + + "title": "Core vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "$id": { + "$ref": "#/$defs/uriReferenceString", + "$comment": "Non-empty fragments not allowed.", + "pattern": "^[^#]*#?$" + }, + "$schema": {"$ref": "#/$defs/uriString"}, + "$ref": {"$ref": "#/$defs/uriReferenceString"}, + "$anchor": {"$ref": "#/$defs/anchorString"}, + "$dynamicRef": {"$ref": "#/$defs/uriReferenceString"}, + "$dynamicAnchor": {"$ref": "#/$defs/anchorString"}, + "$vocabulary": { + "type": "object", + "propertyNames": {"$ref": "#/$defs/uriString"}, + "additionalProperties": { + "type": "boolean" + } + }, + "$comment": { + "type": "string" + }, + "$defs": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"} + } + }, + "$defs": { + "anchorString": { + "type": "string", + "pattern": "^[A-Za-z_][-A-Za-z0-9._]*$" + }, + "uriString": { + "type": "string", + "format": "uri" + }, + "uriReferenceString": { + "type": "string", + "format": "uri-reference" + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json new file mode 100644 index 000000000..83c26e35f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/format-annotation", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/format-annotation": true + }, + "$dynamicAnchor": "meta", + + "title": "Format vocabulary meta-schema for annotation results", + "type": ["object", "boolean"], + "properties": { + "format": {"type": "string"} + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json new file mode 100644 index 000000000..11946fb50 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/meta-data", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/meta-data": true + }, + "$dynamicAnchor": "meta", + + "title": "Meta-data vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "deprecated": { + "type": "boolean", + "default": false + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json new file mode 100644 index 000000000..5e4b203b2 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/unevaluated", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/unevaluated": true + }, + "$dynamicAnchor": "meta", + + "title": "Unevaluated applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "unevaluatedItems": {"$dynamicRef": "#meta"}, + "unevaluatedProperties": {"$dynamicRef": "#meta"} + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json new file mode 100644 index 000000000..e0ae13d9d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/validation", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/validation": true + }, + "$dynamicAnchor": "meta", + + "title": "Validation vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "type": { + "anyOf": [ + {"$ref": "#/$defs/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/$defs/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "const": true, + "enum": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, + "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, + "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, + "minContains": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 1 + }, + "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, + "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/$defs/stringArray"}, + "dependentRequired": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + } + }, + "$defs": { + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 0 + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json new file mode 100644 index 000000000..1c68270fd --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json @@ -0,0 +1,55 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/schema", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/core": true, + "https://json-schema.org/draft/2020-12/vocab/applicator": true, + "https://json-schema.org/draft/2020-12/vocab/unevaluated": true, + "https://json-schema.org/draft/2020-12/vocab/validation": true, + "https://json-schema.org/draft/2020-12/vocab/meta-data": true, + "https://json-schema.org/draft/2020-12/vocab/format-annotation": true, + "https://json-schema.org/draft/2020-12/vocab/content": true + }, + "$dynamicAnchor": "meta", + + "title": "Core and Validation specifications meta-schema", + "allOf": [ + {"$ref": "meta/core"}, + {"$ref": "meta/applicator"}, + {"$ref": "meta/unevaluated"}, + {"$ref": "meta/validation"}, + {"$ref": "meta/meta-data"}, + {"$ref": "meta/format-annotation"}, + {"$ref": "meta/content"} + ], + "type": ["object", "boolean"], + "$comment": "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.", + "properties": { + "definitions": { + "$comment": "\"definitions\" has been replaced by \"$defs\".", + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "deprecated": true, + "default": {} + }, + "dependencies": { + "$comment": "\"dependencies\" has been split and replaced by \"dependentSchemas\" and \"dependentRequired\" in order to serve their differing semantics.", + "type": "object", + "additionalProperties": { + "anyOf": [{"$dynamicRef": "#meta"}, {"$ref": "meta/validation#/$defs/stringArray"}] + }, + "deprecated": true, + "default": {} + }, + "$recursiveAnchor": { + "$comment": "\"$recursiveAnchor\" has been replaced by \"$dynamicAnchor\".", + "$ref": "meta/core#/$defs/anchorString", + "deprecated": true + }, + "$recursiveRef": { + "$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".", + "$ref": "meta/core#/$defs/uriReferenceString", + "deprecated": true + } + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-draft-06.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-draft-06.json new file mode 100644 index 000000000..5410064ba --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-draft-06.json @@ -0,0 +1,137 @@ +{ + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "http://json-schema.org/draft-06/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "examples": { + "type": "array", + "items": {} + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, + "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": {"$ref": "#"}, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], + "default": {} + }, + "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, + "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": {"$ref": "#"}, + "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, + "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/definitions/stringArray"}, + "additionalProperties": {"$ref": "#"}, + "definitions": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] + } + }, + "propertyNames": {"$ref": "#"}, + "const": {}, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + {"$ref": "#/definitions/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/definitions/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": {"type": "string"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"} + }, + "default": {} +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-draft-07.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-draft-07.json new file mode 100644 index 000000000..6a7485104 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-draft-07.json @@ -0,0 +1,151 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, + "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": {"$ref": "#"}, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], + "default": true + }, + "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, + "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": {"$ref": "#"}, + "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, + "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/definitions/stringArray"}, + "additionalProperties": {"$ref": "#"}, + "definitions": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] + } + }, + "propertyNames": {"$ref": "#"}, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + {"$ref": "#/definitions/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/definitions/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": {"type": "string"}, + "contentMediaType": {"type": "string"}, + "contentEncoding": {"type": "string"}, + "if": {"$ref": "#"}, + "then": {"$ref": "#"}, + "else": {"$ref": "#"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"} + }, + "default": true +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-secure.json b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-secure.json new file mode 100644 index 000000000..3968abd5d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/json-schema-secure.json @@ -0,0 +1,88 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/json-schema-secure.json#", + "title": "Meta-schema for the security assessment of JSON Schemas", + "description": "If a JSON AnySchema fails validation against this meta-schema, it may be unsafe to validate untrusted data", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + } + }, + "dependencies": { + "patternProperties": { + "description": "prevent slow validation of large property names", + "required": ["propertyNames"], + "properties": { + "propertyNames": { + "required": ["maxLength"] + } + } + }, + "uniqueItems": { + "description": "prevent slow validation of large non-scalar arrays", + "if": { + "properties": { + "uniqueItems": {"const": true}, + "items": { + "properties": { + "type": { + "anyOf": [ + { + "enum": ["object", "array"] + }, + { + "type": "array", + "contains": {"enum": ["object", "array"]} + } + ] + } + } + } + } + }, + "then": { + "required": ["maxItems"] + } + }, + "pattern": { + "description": "prevent slow pattern matching of large strings", + "required": ["maxLength"] + }, + "format": { + "description": "prevent slow format validation of large strings", + "required": ["maxLength"] + } + }, + "properties": { + "additionalItems": {"$ref": "#"}, + "additionalProperties": {"$ref": "#"}, + "dependencies": { + "additionalProperties": { + "anyOf": [{"type": "array"}, {"$ref": "#"}] + } + }, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}] + }, + "definitions": { + "additionalProperties": {"$ref": "#"} + }, + "patternProperties": { + "additionalProperties": {"$ref": "#"} + }, + "properties": { + "additionalProperties": {"$ref": "#"} + }, + "if": {"$ref": "#"}, + "then": {"$ref": "#"}, + "else": {"$ref": "#"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"}, + "contains": {"$ref": "#"}, + "propertyNames": {"$ref": "#"} + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/refs/jtd-schema.ts b/node_modules/ajv-formats/node_modules/ajv/lib/refs/jtd-schema.ts new file mode 100644 index 000000000..c01981289 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/refs/jtd-schema.ts @@ -0,0 +1,130 @@ +import {SchemaObject} from "../types" + +type MetaSchema = (root: boolean) => SchemaObject + +const shared: MetaSchema = (root) => { + const sch: SchemaObject = { + nullable: {type: "boolean"}, + metadata: { + optionalProperties: { + union: {elements: {ref: "schema"}}, + }, + additionalProperties: true, + }, + } + if (root) sch.definitions = {values: {ref: "schema"}} + return sch +} + +const emptyForm: MetaSchema = (root) => ({ + optionalProperties: shared(root), +}) + +const refForm: MetaSchema = (root) => ({ + properties: { + ref: {type: "string"}, + }, + optionalProperties: shared(root), +}) + +const typeForm: MetaSchema = (root) => ({ + properties: { + type: { + enum: [ + "boolean", + "timestamp", + "string", + "float32", + "float64", + "int8", + "uint8", + "int16", + "uint16", + "int32", + "uint32", + ], + }, + }, + optionalProperties: shared(root), +}) + +const enumForm: MetaSchema = (root) => ({ + properties: { + enum: {elements: {type: "string"}}, + }, + optionalProperties: shared(root), +}) + +const elementsForm: MetaSchema = (root) => ({ + properties: { + elements: {ref: "schema"}, + }, + optionalProperties: shared(root), +}) + +const propertiesForm: MetaSchema = (root) => ({ + properties: { + properties: {values: {ref: "schema"}}, + }, + optionalProperties: { + optionalProperties: {values: {ref: "schema"}}, + additionalProperties: {type: "boolean"}, + ...shared(root), + }, +}) + +const optionalPropertiesForm: MetaSchema = (root) => ({ + properties: { + optionalProperties: {values: {ref: "schema"}}, + }, + optionalProperties: { + additionalProperties: {type: "boolean"}, + ...shared(root), + }, +}) + +const discriminatorForm: MetaSchema = (root) => ({ + properties: { + discriminator: {type: "string"}, + mapping: { + values: { + metadata: { + union: [propertiesForm(false), optionalPropertiesForm(false)], + }, + }, + }, + }, + optionalProperties: shared(root), +}) + +const valuesForm: MetaSchema = (root) => ({ + properties: { + values: {ref: "schema"}, + }, + optionalProperties: shared(root), +}) + +const schema: MetaSchema = (root) => ({ + metadata: { + union: [ + emptyForm, + refForm, + typeForm, + enumForm, + elementsForm, + propertiesForm, + optionalPropertiesForm, + discriminatorForm, + valuesForm, + ].map((s) => s(root)), + }, +}) + +const jtdMetaSchema: SchemaObject = { + definitions: { + schema: schema(false), + }, + ...schema(true), +} + +export default jtdMetaSchema diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/runtime/equal.ts b/node_modules/ajv-formats/node_modules/ajv/lib/runtime/equal.ts new file mode 100644 index 000000000..3cb00631a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/runtime/equal.ts @@ -0,0 +1,7 @@ +// https://github.com/ajv-validator/ajv/issues/889 +import * as equal from "fast-deep-equal" + +type Equal = typeof equal & {code: string} +;(equal as Equal).code = 'require("ajv/dist/runtime/equal").default' + +export default equal as Equal diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/runtime/parseJson.ts b/node_modules/ajv-formats/node_modules/ajv/lib/runtime/parseJson.ts new file mode 100644 index 000000000..92579afeb --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/runtime/parseJson.ts @@ -0,0 +1,176 @@ +const rxParseJson = /position\s(\d+)$/ + +export function parseJson(s: string, pos: number): unknown { + let endPos: number | undefined + parseJson.message = undefined + let matches: RegExpExecArray | null + if (pos) s = s.slice(pos) + try { + parseJson.position = pos + s.length + return JSON.parse(s) + } catch (e) { + matches = rxParseJson.exec((e as Error).message) + if (!matches) { + parseJson.message = "unexpected end" + return undefined + } + endPos = +matches[1] + const c = s[endPos] + s = s.slice(0, endPos) + parseJson.position = pos + endPos + try { + return JSON.parse(s) + } catch (e1) { + parseJson.message = `unexpected token ${c}` + return undefined + } + } +} + +parseJson.message = undefined as string | undefined +parseJson.position = 0 as number +parseJson.code = 'require("ajv/dist/runtime/parseJson").parseJson' + +export function parseJsonNumber(s: string, pos: number, maxDigits?: number): number | undefined { + let numStr = "" + let c: string + parseJsonNumber.message = undefined + if (s[pos] === "-") { + numStr += "-" + pos++ + } + if (s[pos] === "0") { + numStr += "0" + pos++ + } else { + if (!parseDigits(maxDigits)) { + errorMessage() + return undefined + } + } + if (maxDigits) { + parseJsonNumber.position = pos + return +numStr + } + if (s[pos] === ".") { + numStr += "." + pos++ + if (!parseDigits()) { + errorMessage() + return undefined + } + } + if (((c = s[pos]), c === "e" || c === "E")) { + numStr += "e" + pos++ + if (((c = s[pos]), c === "+" || c === "-")) { + numStr += c + pos++ + } + if (!parseDigits()) { + errorMessage() + return undefined + } + } + parseJsonNumber.position = pos + return +numStr + + function parseDigits(maxLen?: number): boolean { + let digit = false + while (((c = s[pos]), c >= "0" && c <= "9" && (maxLen === undefined || maxLen-- > 0))) { + digit = true + numStr += c + pos++ + } + return digit + } + + function errorMessage(): void { + parseJsonNumber.position = pos + parseJsonNumber.message = pos < s.length ? `unexpected token ${s[pos]}` : "unexpected end" + } +} + +parseJsonNumber.message = undefined as string | undefined +parseJsonNumber.position = 0 as number +parseJsonNumber.code = 'require("ajv/dist/runtime/parseJson").parseJsonNumber' + +const escapedChars: {[X in string]?: string} = { + b: "\b", + f: "\f", + n: "\n", + r: "\r", + t: "\t", + '"': '"', + "/": "/", + "\\": "\\", +} + +const CODE_A: number = "a".charCodeAt(0) +const CODE_0: number = "0".charCodeAt(0) + +export function parseJsonString(s: string, pos: number): string | undefined { + let str = "" + let c: string | undefined + parseJsonString.message = undefined + // eslint-disable-next-line no-constant-condition, @typescript-eslint/no-unnecessary-condition + while (true) { + c = s[pos++] + if (c === '"') break + if (c === "\\") { + c = s[pos] + if (c in escapedChars) { + str += escapedChars[c] + pos++ + } else if (c === "u") { + pos++ + let count = 4 + let code = 0 + while (count--) { + code <<= 4 + c = s[pos] + if (c === undefined) { + errorMessage("unexpected end") + return undefined + } + c = c.toLowerCase() + if (c >= "a" && c <= "f") { + code += c.charCodeAt(0) - CODE_A + 10 + } else if (c >= "0" && c <= "9") { + code += c.charCodeAt(0) - CODE_0 + } else { + errorMessage(`unexpected token ${c}`) + return undefined + } + pos++ + } + str += String.fromCharCode(code) + } else { + errorMessage(`unexpected token ${c}`) + return undefined + } + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + } else if (c === undefined) { + errorMessage("unexpected end") + return undefined + } else { + if (c.charCodeAt(0) >= 0x20) { + str += c + } else { + errorMessage(`unexpected token ${c}`) + return undefined + } + } + } + parseJsonString.position = pos + return str + + function errorMessage(msg: string): void { + parseJsonString.position = pos + parseJsonString.message = msg + } +} + +parseJsonString.message = undefined as string | undefined +parseJsonString.position = 0 as number +parseJsonString.code = 'require("ajv/dist/runtime/parseJson").parseJsonString' diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/runtime/quote.ts b/node_modules/ajv-formats/node_modules/ajv/lib/runtime/quote.ts new file mode 100644 index 000000000..1160e6a23 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/runtime/quote.ts @@ -0,0 +1,31 @@ +const rxEscapable = + // eslint-disable-next-line no-control-regex, no-misleading-character-class + /[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g + +const escaped: {[K in string]?: string} = { + "\b": "\\b", + "\t": "\\t", + "\n": "\\n", + "\f": "\\f", + "\r": "\\r", + '"': '\\"', + "\\": "\\\\", +} + +export default function quote(s: string): string { + rxEscapable.lastIndex = 0 + return ( + '"' + + (rxEscapable.test(s) + ? s.replace(rxEscapable, (a) => { + const c = escaped[a] + return typeof c === "string" + ? c + : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4) + }) + : s) + + '"' + ) +} + +quote.code = 'require("ajv/dist/runtime/quote").default' diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/runtime/re2.ts b/node_modules/ajv-formats/node_modules/ajv/lib/runtime/re2.ts new file mode 100644 index 000000000..0c769bc7a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/runtime/re2.ts @@ -0,0 +1,6 @@ +import * as re2 from "re2" + +type Re2 = typeof re2 & {code: string} +;(re2 as Re2).code = 'require("ajv/dist/runtime/re2").default' + +export default re2 as Re2 diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/runtime/timestamp.ts b/node_modules/ajv-formats/node_modules/ajv/lib/runtime/timestamp.ts new file mode 100644 index 000000000..1625f9a40 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/runtime/timestamp.ts @@ -0,0 +1,46 @@ +const DT_SEPARATOR = /t|\s/i +const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/ +const TIME = /^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:z|([+-]\d\d)(?::?(\d\d))?)$/i +const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] + +export default function validTimestamp(str: string, allowDate: boolean): boolean { + // http://tools.ietf.org/html/rfc3339#section-5.6 + const dt: string[] = str.split(DT_SEPARATOR) + return ( + (dt.length === 2 && validDate(dt[0]) && validTime(dt[1])) || + (allowDate && dt.length === 1 && validDate(dt[0])) + ) +} + +function validDate(str: string): boolean { + const matches: string[] | null = DATE.exec(str) + if (!matches) return false + const y: number = +matches[1] + const m: number = +matches[2] + const d: number = +matches[3] + return ( + m >= 1 && + m <= 12 && + d >= 1 && + (d <= DAYS[m] || + // leap year: https://tools.ietf.org/html/rfc3339#appendix-C + (m === 2 && d === 29 && (y % 100 === 0 ? y % 400 === 0 : y % 4 === 0))) + ) +} + +function validTime(str: string): boolean { + const matches: string[] | null = TIME.exec(str) + if (!matches) return false + const hr: number = +matches[1] + const min: number = +matches[2] + const sec: number = +matches[3] + const tzH: number = +(matches[4] || 0) + const tzM: number = +(matches[5] || 0) + return ( + (hr <= 23 && min <= 59 && sec <= 59) || + // leap second + (hr - tzH === 23 && min - tzM === 59 && sec === 60) + ) +} + +validTimestamp.code = 'require("ajv/dist/runtime/timestamp").default' diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/runtime/ucs2length.ts b/node_modules/ajv-formats/node_modules/ajv/lib/runtime/ucs2length.ts new file mode 100644 index 000000000..47d8292b8 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/runtime/ucs2length.ts @@ -0,0 +1,20 @@ +// https://mathiasbynens.be/notes/javascript-encoding +// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode +export default function ucs2length(str: string): number { + const len = str.length + let length = 0 + let pos = 0 + let value: number + while (pos < len) { + length++ + value = str.charCodeAt(pos++) + if (value >= 0xd800 && value <= 0xdbff && pos < len) { + // high surrogate, and there is a next character + value = str.charCodeAt(pos) + if ((value & 0xfc00) === 0xdc00) pos++ // low surrogate + } + } + return length +} + +ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default' diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/runtime/uri.ts b/node_modules/ajv-formats/node_modules/ajv/lib/runtime/uri.ts new file mode 100644 index 000000000..7dd35f9d1 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/runtime/uri.ts @@ -0,0 +1,6 @@ +import * as uri from "uri-js" + +type URI = typeof uri & {code: string} +;(uri as URI).code = 'require("ajv/dist/runtime/uri").default' + +export default uri as URI diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/runtime/validation_error.ts b/node_modules/ajv-formats/node_modules/ajv/lib/runtime/validation_error.ts new file mode 100644 index 000000000..2d19a46a2 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/runtime/validation_error.ts @@ -0,0 +1,13 @@ +import type {ErrorObject} from "../types" + +export default class ValidationError extends Error { + readonly errors: Partial[] + readonly ajv: true + readonly validation: true + + constructor(errors: Partial[]) { + super("validation failed") + this.errors = errors + this.ajv = this.validation = true + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/standalone/index.ts b/node_modules/ajv-formats/node_modules/ajv/lib/standalone/index.ts new file mode 100644 index 000000000..b6129ce9e --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/standalone/index.ts @@ -0,0 +1,100 @@ +import type AjvCore from "../core" +import type {AnyValidateFunction, SourceCode} from "../types" +import type {SchemaEnv} from "../compile" +import {UsedScopeValues, UsedValueState, ValueScopeName, varKinds} from "../compile/codegen/scope" +import {_, nil, _Code, Code, getProperty, getEsmExportName} from "../compile/codegen/code" + +function standaloneCode( + ajv: AjvCore, + refsOrFunc?: {[K in string]?: string} | AnyValidateFunction +): string { + if (!ajv.opts.code.source) { + throw new Error("moduleCode: ajv instance must have code.source option") + } + const {_n} = ajv.scope.opts + return typeof refsOrFunc == "function" + ? funcExportCode(refsOrFunc.source) + : refsOrFunc !== undefined + ? multiExportsCode(refsOrFunc, getValidate) + : multiExportsCode(ajv.schemas, (sch) => + sch.meta ? undefined : ajv.compile(sch.schema) + ) + + function getValidate(id: string): AnyValidateFunction { + const v = ajv.getSchema(id) + if (!v) throw new Error(`moduleCode: no schema with id ${id}`) + return v + } + + function funcExportCode(source?: SourceCode): string { + const usedValues: UsedScopeValues = {} + const n = source?.validateName + const vCode = validateCode(usedValues, source) + if (ajv.opts.code.esm) { + // Always do named export as `validate` rather than the variable `n` which is `validateXX` for known export value + return `"use strict";${_n}export const validate = ${n};${_n}export default ${n};${_n}${vCode}` + } + return `"use strict";${_n}module.exports = ${n};${_n}module.exports.default = ${n};${_n}${vCode}` + } + + function multiExportsCode( + schemas: {[K in string]?: T}, + getValidateFunc: (schOrId: T) => AnyValidateFunction | undefined + ): string { + const usedValues: UsedScopeValues = {} + let code = _`"use strict";` + for (const name in schemas) { + const v = getValidateFunc(schemas[name] as T) + if (v) { + const vCode = validateCode(usedValues, v.source) + const exportSyntax = ajv.opts.code.esm + ? _`export const ${getEsmExportName(name)}` + : _`exports${getProperty(name)}` + code = _`${code}${_n}${exportSyntax} = ${v.source?.validateName};${_n}${vCode}` + } + } + return `${code}` + } + + function validateCode(usedValues: UsedScopeValues, s?: SourceCode): Code { + if (!s) throw new Error('moduleCode: function does not have "source" property') + if (usedState(s.validateName) === UsedValueState.Completed) return nil + setUsedState(s.validateName, UsedValueState.Started) + + const scopeCode = ajv.scope.scopeCode(s.scopeValues, usedValues, refValidateCode) + const code = new _Code(`${scopeCode}${_n}${s.validateCode}`) + return s.evaluated ? _`${code}${s.validateName}.evaluated = ${s.evaluated};${_n}` : code + + function refValidateCode(n: ValueScopeName): Code | undefined { + const vRef = n.value?.ref + if (n.prefix === "validate" && typeof vRef == "function") { + const v = vRef as AnyValidateFunction + return validateCode(usedValues, v.source) + } else if ((n.prefix === "root" || n.prefix === "wrapper") && typeof vRef == "object") { + const {validate, validateName} = vRef as SchemaEnv + if (!validateName) throw new Error("ajv internal error") + const def = ajv.opts.code.es5 ? varKinds.var : varKinds.const + const wrapper = _`${def} ${n} = {validate: ${validateName}};` + if (usedState(validateName) === UsedValueState.Started) return wrapper + const vCode = validateCode(usedValues, validate?.source) + return _`${wrapper}${_n}${vCode}` + } + return undefined + } + + function usedState(name: ValueScopeName): UsedValueState | undefined { + return usedValues[name.prefix]?.get(name) + } + + function setUsedState(name: ValueScopeName, state: UsedValueState): void { + const {prefix} = name + const names = (usedValues[prefix] = usedValues[prefix] || new Map()) + names.set(name, state) + } + } +} + +module.exports = exports = standaloneCode +Object.defineProperty(exports, "__esModule", {value: true}) + +export default standaloneCode diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/standalone/instance.ts b/node_modules/ajv-formats/node_modules/ajv/lib/standalone/instance.ts new file mode 100644 index 000000000..c4b2c30b5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/standalone/instance.ts @@ -0,0 +1,36 @@ +import Ajv, {AnySchema, AnyValidateFunction, ErrorObject} from "../core" +import standaloneCode from "." +import * as requireFromString from "require-from-string" + +export default class AjvPack { + errors?: ErrorObject[] | null // errors from the last validation + constructor(readonly ajv: Ajv) {} + + validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise { + return Ajv.prototype.validate.call(this, schemaKeyRef, data) + } + + compile(schema: AnySchema, meta?: boolean): AnyValidateFunction { + return this.getStandalone(this.ajv.compile(schema, meta)) + } + + getSchema(keyRef: string): AnyValidateFunction | undefined { + const v = this.ajv.getSchema(keyRef) + if (!v) return undefined + return this.getStandalone(v) + } + + private getStandalone(v: AnyValidateFunction): AnyValidateFunction { + return requireFromString(standaloneCode(this.ajv, v)) as AnyValidateFunction + } + + addSchema(...args: Parameters): AjvPack { + this.ajv.addSchema.call(this.ajv, ...args) + return this + } + + addKeyword(...args: Parameters): AjvPack { + this.ajv.addKeyword.call(this.ajv, ...args) + return this + } +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/types/index.ts b/node_modules/ajv-formats/node_modules/ajv/lib/types/index.ts new file mode 100644 index 000000000..123d9df16 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/types/index.ts @@ -0,0 +1,240 @@ +import * as URI from "uri-js" +import type {CodeGen, Code, Name, ScopeValueSets, ValueScopeName} from "../compile/codegen" +import type {SchemaEnv, SchemaCxt, SchemaObjCxt} from "../compile" +import type {JSONType} from "../compile/rules" +import type {KeywordCxt} from "../compile/validate" +import type Ajv from "../core" + +interface _SchemaObject { + id?: string + $id?: string + $schema?: string + [x: string]: any // TODO +} + +export interface SchemaObject extends _SchemaObject { + id?: string + $id?: string + $schema?: string + $async?: false + [x: string]: any // TODO +} + +export interface AsyncSchema extends _SchemaObject { + $async: true +} + +export type AnySchemaObject = SchemaObject | AsyncSchema + +export type Schema = SchemaObject | boolean + +export type AnySchema = Schema | AsyncSchema + +export type SchemaMap = {[Key in string]?: AnySchema} + +export interface SourceCode { + validateName: ValueScopeName + validateCode: string + scopeValues: ScopeValueSets + evaluated?: Code +} + +export interface DataValidationCxt { + instancePath: string + parentData: {[K in T]: any} // object or array + parentDataProperty: T // string or number + rootData: Record | any[] + dynamicAnchors: {[Ref in string]?: ValidateFunction} +} + +export interface ValidateFunction { + (this: Ajv | any, data: any, dataCxt?: DataValidationCxt): data is T + errors?: null | ErrorObject[] + evaluated?: Evaluated + schema: AnySchema + schemaEnv: SchemaEnv + source?: SourceCode +} + +export interface JTDParser { + (json: string): T | undefined + message?: string + position?: number +} + +export type EvaluatedProperties = {[K in string]?: true} | true + +export type EvaluatedItems = number | true + +export interface Evaluated { + // determined at compile time if staticProps/Items is true + props?: EvaluatedProperties + items?: EvaluatedItems + // whether props/items determined at compile time + dynamicProps: boolean + dynamicItems: boolean +} + +export interface AsyncValidateFunction extends ValidateFunction { + (...args: Parameters>): Promise + $async: true +} + +export type AnyValidateFunction = ValidateFunction | AsyncValidateFunction + +export interface ErrorObject, S = unknown> { + keyword: K + instancePath: string + schemaPath: string + params: P + // Added to validation errors of "propertyNames" keyword schema + propertyName?: string + // Excluded if option `messages` set to false. + message?: string + // These are added with the `verbose` option. + schema?: S + parentSchema?: AnySchemaObject + data?: unknown +} + +export type ErrorNoParams = ErrorObject, S> + +interface _KeywordDef { + keyword: string | string[] + type?: JSONType | JSONType[] // data types that keyword applies to + schemaType?: JSONType | JSONType[] // allowed type(s) of keyword value in the schema + allowUndefined?: boolean // used for keywords that can be invoked by other keywords, not being present in the schema + $data?: boolean // keyword supports [$data reference](../../docs/guide/combining-schemas.md#data-reference) + implements?: string[] // other schema keywords that this keyword implements + before?: string // keyword should be executed before this keyword (should be applicable to the same type) + post?: boolean // keyword should be executed after other keywords without post flag + metaSchema?: AnySchemaObject // meta-schema for keyword schema value - it is better to use schemaType where applicable + validateSchema?: AnyValidateFunction // compiled keyword metaSchema - should not be passed + dependencies?: string[] // keywords that must be present in the same schema + error?: KeywordErrorDefinition + $dataError?: KeywordErrorDefinition +} + +export interface CodeKeywordDefinition extends _KeywordDef { + code: (cxt: KeywordCxt, ruleType?: string) => void + trackErrors?: boolean +} + +export type MacroKeywordFunc = ( + schema: any, + parentSchema: AnySchemaObject, + it: SchemaCxt +) => AnySchema + +export type CompileKeywordFunc = ( + schema: any, + parentSchema: AnySchemaObject, + it: SchemaObjCxt +) => DataValidateFunction + +export interface DataValidateFunction { + (...args: Parameters): boolean | Promise + errors?: Partial[] +} + +export interface SchemaValidateFunction { + (schema: any, data: any, parentSchema?: AnySchemaObject, dataCxt?: DataValidationCxt): + | boolean + | Promise + errors?: Partial[] +} + +export interface FuncKeywordDefinition extends _KeywordDef { + validate?: SchemaValidateFunction | DataValidateFunction + compile?: CompileKeywordFunc + // schema: false makes validate not to expect schema (DataValidateFunction) + schema?: boolean // requires "validate" + modifying?: boolean + async?: boolean + valid?: boolean + errors?: boolean | "full" +} + +export interface MacroKeywordDefinition extends FuncKeywordDefinition { + macro: MacroKeywordFunc +} + +export type KeywordDefinition = + | CodeKeywordDefinition + | FuncKeywordDefinition + | MacroKeywordDefinition + +export type AddedKeywordDefinition = KeywordDefinition & { + type: JSONType[] + schemaType: JSONType[] +} + +export interface KeywordErrorDefinition { + message: string | Code | ((cxt: KeywordErrorCxt) => string | Code) + params?: Code | ((cxt: KeywordErrorCxt) => Code) +} + +export type Vocabulary = (KeywordDefinition | string)[] + +export interface KeywordErrorCxt { + gen: CodeGen + keyword: string + data: Name + $data?: string | false + schema: any // TODO + parentSchema?: AnySchemaObject + schemaCode: Code | number | boolean + schemaValue: Code | number | boolean + schemaType?: JSONType[] + errsCount?: Name + params: KeywordCxtParams + it: SchemaCxt +} + +export type KeywordCxtParams = {[P in string]?: Code | string | number} + +export type FormatValidator = (data: T) => boolean + +export type FormatCompare = (data1: T, data2: T) => number | undefined + +export type AsyncFormatValidator = (data: T) => Promise + +export interface FormatDefinition { + type?: T extends string ? "string" | undefined : "number" + validate: FormatValidator | (T extends string ? string | RegExp : never) + async?: false | undefined + compare?: FormatCompare +} + +export interface AsyncFormatDefinition { + type?: T extends string ? "string" | undefined : "number" + validate: AsyncFormatValidator + async: true + compare?: FormatCompare +} + +export type AddedFormat = + | true + | RegExp + | FormatValidator + | FormatDefinition + | FormatDefinition + | AsyncFormatDefinition + | AsyncFormatDefinition + +export type Format = AddedFormat | string + +export interface RegExpEngine { + (pattern: string, u: string): RegExpLike + code: string +} + +export interface RegExpLike { + test: (s: string) => boolean +} + +export interface UriResolver { + parse(uri: string): URI.URIComponents + resolve(base: string, path: string): string + serialize(component: URI.URIComponents): string +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/types/json-schema.ts b/node_modules/ajv-formats/node_modules/ajv/lib/types/json-schema.ts new file mode 100644 index 000000000..698e29116 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/types/json-schema.ts @@ -0,0 +1,186 @@ +/* eslint-disable @typescript-eslint/no-empty-interface */ +type StrictNullChecksWrapper = undefined extends null + ? `strictNullChecks must be true in tsconfig to use ${Name}` + : Type + +type UnionToIntersection = (U extends any ? (_: U) => void : never) extends (_: infer I) => void + ? I + : never + +export type SomeJSONSchema = UncheckedJSONSchemaType + +type UncheckedPartialSchema = Partial> + +export type PartialSchema = StrictNullChecksWrapper<"PartialSchema", UncheckedPartialSchema> + +type JSONType = IsPartial extends true + ? T | undefined + : T + +interface NumberKeywords { + minimum?: number + maximum?: number + exclusiveMinimum?: number + exclusiveMaximum?: number + multipleOf?: number + format?: string +} + +interface StringKeywords { + minLength?: number + maxLength?: number + pattern?: string + format?: string +} + +type UncheckedJSONSchemaType = ( + | // these two unions allow arbitrary unions of types + { + anyOf: readonly UncheckedJSONSchemaType[] + } + | { + oneOf: readonly UncheckedJSONSchemaType[] + } + // this union allows for { type: (primitive)[] } style schemas + | ({ + type: readonly (T extends number + ? JSONType<"number" | "integer", IsPartial> + : T extends string + ? JSONType<"string", IsPartial> + : T extends boolean + ? JSONType<"boolean", IsPartial> + : never)[] + } & UnionToIntersection< + T extends number + ? NumberKeywords + : T extends string + ? StringKeywords + : T extends boolean + ? // eslint-disable-next-line @typescript-eslint/ban-types + {} + : never + >) + // this covers "normal" types; it's last so typescript looks to it first for errors + | ((T extends number + ? { + type: JSONType<"number" | "integer", IsPartial> + } & NumberKeywords + : T extends string + ? { + type: JSONType<"string", IsPartial> + } & StringKeywords + : T extends boolean + ? { + type: JSONType<"boolean", IsPartial> + } + : T extends readonly [any, ...any[]] + ? { + // JSON AnySchema for tuple + type: JSONType<"array", IsPartial> + items: { + readonly [K in keyof T]-?: UncheckedJSONSchemaType & Nullable + } & {length: T["length"]} + minItems: T["length"] + } & ({maxItems: T["length"]} | {additionalItems: false}) + : T extends readonly any[] + ? { + type: JSONType<"array", IsPartial> + items: UncheckedJSONSchemaType + contains?: UncheckedPartialSchema + minItems?: number + maxItems?: number + minContains?: number + maxContains?: number + uniqueItems?: true + additionalItems?: never + } + : T extends Record + ? { + // JSON AnySchema for records and dictionaries + // "required" is not optional because it is often forgotten + // "properties" are optional for more concise dictionary schemas + // "patternProperties" and can be only used with interfaces that have string index + type: JSONType<"object", IsPartial> + additionalProperties?: boolean | UncheckedJSONSchemaType + unevaluatedProperties?: boolean | UncheckedJSONSchemaType + properties?: IsPartial extends true + ? Partial> + : UncheckedPropertiesSchema + patternProperties?: Record> + propertyNames?: Omit, "type"> & {type?: "string"} + dependencies?: {[K in keyof T]?: Readonly<(keyof T)[]> | UncheckedPartialSchema} + dependentRequired?: {[K in keyof T]?: Readonly<(keyof T)[]>} + dependentSchemas?: {[K in keyof T]?: UncheckedPartialSchema} + minProperties?: number + maxProperties?: number + } & (IsPartial extends true // "required" is not necessary if it's a non-partial type with no required keys // are listed it only asserts that optional cannot be listed. // "required" type does not guarantee that all required properties + ? {required: Readonly<(keyof T)[]>} + : [UncheckedRequiredMembers] extends [never] + ? {required?: Readonly[]>} + : {required: Readonly[]>}) + : T extends null + ? { + type: JSONType<"null", IsPartial> + nullable: true + } + : never) & { + allOf?: Readonly[]> + anyOf?: Readonly[]> + oneOf?: Readonly[]> + if?: UncheckedPartialSchema + then?: UncheckedPartialSchema + else?: UncheckedPartialSchema + not?: UncheckedPartialSchema + }) +) & { + [keyword: string]: any + $id?: string + $ref?: string + $defs?: Record> + definitions?: Record> +} + +export type JSONSchemaType = StrictNullChecksWrapper< + "JSONSchemaType", + UncheckedJSONSchemaType +> + +type Known = + | {[key: string]: Known} + | [Known, ...Known[]] + | Known[] + | number + | string + | boolean + | null + +type UncheckedPropertiesSchema = { + [K in keyof T]-?: (UncheckedJSONSchemaType & Nullable) | {$ref: string} +} + +export type PropertiesSchema = StrictNullChecksWrapper< + "PropertiesSchema", + UncheckedPropertiesSchema +> + +type UncheckedRequiredMembers = { + [K in keyof T]-?: undefined extends T[K] ? never : K +}[keyof T] + +export type RequiredMembers = StrictNullChecksWrapper< + "RequiredMembers", + UncheckedRequiredMembers +> + +type Nullable = undefined extends T + ? { + nullable: true + const?: null // any non-null value would fail `const: null`, `null` would fail any other value in const + enum?: Readonly<(T | null)[]> // `null` must be explicitly included in "enum" for `null` to pass + default?: T | null + } + : { + const?: T + enum?: Readonly + default?: T + } diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/types/jtd-schema.ts b/node_modules/ajv-formats/node_modules/ajv/lib/types/jtd-schema.ts new file mode 100644 index 000000000..3d5ae4ac9 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/types/jtd-schema.ts @@ -0,0 +1,263 @@ +/** numeric strings */ +type NumberType = "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32" + +/** string strings */ +type StringType = "string" | "timestamp" + +/** Generic JTD Schema without inference of the represented type */ +export type SomeJTDSchemaType = ( + | // ref + {ref: string} + // primitives + | {type: NumberType | StringType | "boolean"} + // enum + | {enum: string[]} + // elements + | {elements: SomeJTDSchemaType} + // values + | {values: SomeJTDSchemaType} + // properties + | { + properties: Record + optionalProperties?: Record + additionalProperties?: boolean + } + | { + properties?: Record + optionalProperties: Record + additionalProperties?: boolean + } + // discriminator + | {discriminator: string; mapping: Record} + // empty + // NOTE see the end of + // https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-675156492 + // eslint-disable-next-line @typescript-eslint/ban-types + | {} +) & { + nullable?: boolean + metadata?: Record + definitions?: Record +} + +/** required keys of an object, not undefined */ +type RequiredKeys = { + [K in keyof T]-?: undefined extends T[K] ? never : K +}[keyof T] + +/** optional or undifined-able keys of an object */ +type OptionalKeys = { + [K in keyof T]-?: undefined extends T[K] ? K : never +}[keyof T] + +/** type is true if T is a union type */ +type IsUnion_ = false extends ( + T extends unknown ? ([U] extends [T] ? false : true) : never +) + ? false + : true +type IsUnion = IsUnion_ + +/** type is true if T is identically E */ +type TypeEquality = [T] extends [E] ? ([E] extends [T] ? true : false) : false + +/** type is true if T or null is identically E or null*/ +type NullTypeEquality = TypeEquality + +/** gets only the string literals of a type or null if a type isn't a string literal */ +type EnumString = [T] extends [never] + ? null + : T extends string + ? string extends T + ? null + : T + : null + +/** true if type is a union of string literals */ +type IsEnum = null extends EnumString> ? false : true + +/** true only if all types are array types (not tuples) */ +// NOTE relies on the fact that tuples don't have an index at 0.5, but arrays +// have an index at every number +type IsElements = false extends IsUnion + ? [T] extends [readonly unknown[]] + ? undefined extends T[0.5] + ? false + : true + : false + : false + +/** true if the the type is a values type */ +type IsValues = false extends IsUnion> + ? TypeEquality, string> + : false + +/** true if type is a proeprties type and Union is false, or type is a discriminator type and Union is true */ +type IsRecord = Union extends IsUnion> + ? null extends EnumString> + ? false + : true + : false + +/** actual schema */ +export type JTDSchemaType = Record> = ( + | // refs - where null wasn't specified, must match exactly + (null extends EnumString + ? never + : + | ({[K in keyof D]: [T] extends [D[K]] ? {ref: K} : never}[keyof D] & {nullable?: false}) + // nulled refs - if ref is nullable and nullable is specified, then it can + // match either null or non-null definitions + | (null extends T + ? { + [K in keyof D]: [Exclude] extends [Exclude] + ? {ref: K} + : never + }[keyof D] & {nullable: true} + : never)) + // empty - empty schemas also treat nullable differently in that it's now fully ignored + | (unknown extends T ? {nullable?: boolean} : never) + // all other types // numbers - only accepts the type number + | ((true extends NullTypeEquality + ? {type: NumberType} + : // booleans - accepts the type boolean + true extends NullTypeEquality + ? {type: "boolean"} + : // strings - only accepts the type string + true extends NullTypeEquality + ? {type: StringType} + : // strings - only accepts the type Date + true extends NullTypeEquality + ? {type: "timestamp"} + : // enums - only accepts union of string literals + // TODO we can't actually check that everything in the union was specified + true extends IsEnum + ? {enum: EnumString>[]} + : // arrays - only accepts arrays, could be array of unions to be resolved later + true extends IsElements> + ? T extends readonly (infer E)[] + ? { + elements: JTDSchemaType + } + : never + : // values + true extends IsValues + ? T extends Record + ? { + values: JTDSchemaType + } + : never + : // properties + true extends IsRecord + ? ([RequiredKeys>] extends [never] + ? { + properties?: Record + } + : { + properties: {[K in RequiredKeys]: JTDSchemaType} + }) & + ([OptionalKeys>] extends [never] + ? { + optionalProperties?: Record + } + : { + optionalProperties: { + [K in OptionalKeys]: JTDSchemaType, D> + } + }) & { + additionalProperties?: boolean + } + : // discriminator + true extends IsRecord + ? { + [K in keyof Exclude]-?: Exclude[K] extends string + ? { + discriminator: K + mapping: { + // TODO currently allows descriminator to be present in schema + [M in Exclude[K]]: JTDSchemaType< + Omit, + D + > + } + } + : never + }[keyof Exclude] + : never) & + (null extends T + ? { + nullable: true + } + : {nullable?: false})) +) & { + // extra properties + metadata?: Record + // TODO these should only be allowed at the top level + definitions?: {[K in keyof D]: JTDSchemaType} +} + +type JTDDataDef> = + | // ref + (S extends {ref: string} + ? D extends {[K in S["ref"]]: infer V} + ? JTDDataDef + : never + : // type + S extends {type: NumberType} + ? number + : S extends {type: "boolean"} + ? boolean + : S extends {type: "string"} + ? string + : S extends {type: "timestamp"} + ? string | Date + : // enum + S extends {enum: readonly (infer E)[]} + ? string extends E + ? never + : [E] extends [string] + ? E + : never + : // elements + S extends {elements: infer E} + ? JTDDataDef[] + : // properties + S extends { + properties: Record + optionalProperties?: Record + additionalProperties?: boolean + } + ? {-readonly [K in keyof S["properties"]]-?: JTDDataDef} & { + -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef< + S["optionalProperties"][K], + D + > + } & ([S["additionalProperties"]] extends [true] ? Record : unknown) + : S extends { + properties?: Record + optionalProperties: Record + additionalProperties?: boolean + } + ? {-readonly [K in keyof S["properties"]]-?: JTDDataDef} & { + -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef< + S["optionalProperties"][K], + D + > + } & ([S["additionalProperties"]] extends [true] ? Record : unknown) + : // values + S extends {values: infer V} + ? Record> + : // discriminator + S extends {discriminator: infer M; mapping: Record} + ? [M] extends [string] + ? { + [K in keyof S["mapping"]]: JTDDataDef & {[KM in M]: K} + }[keyof S["mapping"]] + : never + : // empty + unknown) + | (S extends {nullable: true} ? null : never) + +export type JTDDataType = S extends {definitions: Record} + ? JTDDataDef + : JTDDataDef> diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts new file mode 100644 index 000000000..755e5b3da --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts @@ -0,0 +1,56 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, not, Name} from "../../compile/codegen" +import {alwaysValidSchema, checkStrictMode, Type} from "../../compile/util" + +export type AdditionalItemsError = ErrorObject<"additionalItems", {limit: number}, AnySchema> + +const error: KeywordErrorDefinition = { + message: ({params: {len}}) => str`must NOT have more than ${len} items`, + params: ({params: {len}}) => _`{limit: ${len}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "additionalItems" as const, + type: "array", + schemaType: ["boolean", "object"], + before: "uniqueItems", + error, + code(cxt: KeywordCxt) { + const {parentSchema, it} = cxt + const {items} = parentSchema + if (!Array.isArray(items)) { + checkStrictMode(it, '"additionalItems" is ignored when "items" is not an array of schemas') + return + } + validateAdditionalItems(cxt, items) + }, +} + +export function validateAdditionalItems(cxt: KeywordCxt, items: AnySchema[]): void { + const {gen, schema, data, keyword, it} = cxt + it.items = true + const len = gen.const("len", _`${data}.length`) + if (schema === false) { + cxt.setParams({len: items.length}) + cxt.pass(_`${len} <= ${items.length}`) + } else if (typeof schema == "object" && !alwaysValidSchema(it, schema)) { + const valid = gen.var("valid", _`${len} <= ${items.length}`) // TODO var + gen.if(not(valid), () => validateItems(valid)) + cxt.ok(valid) + } + + function validateItems(valid: Name): void { + gen.forRange("i", items.length, len, (i) => { + cxt.subschema({keyword, dataProp: i, dataPropType: Type.Num}, valid) + if (!it.allErrors) gen.if(not(valid), () => gen.break()) + }) + } +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts new file mode 100644 index 000000000..bfb511ce5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts @@ -0,0 +1,118 @@ +import type { + CodeKeywordDefinition, + AddedKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import {allSchemaProperties, usePattern, isOwnProperty} from "../code" +import {_, nil, or, not, Code, Name} from "../../compile/codegen" +import N from "../../compile/names" +import type {SubschemaArgs} from "../../compile/validate/subschema" +import {alwaysValidSchema, schemaRefOrVal, Type} from "../../compile/util" + +export type AdditionalPropertiesError = ErrorObject< + "additionalProperties", + {additionalProperty: string}, + AnySchema +> + +const error: KeywordErrorDefinition = { + message: "must NOT have additional properties", + params: ({params}) => _`{additionalProperty: ${params.additionalProperty}}`, +} + +const def: CodeKeywordDefinition & AddedKeywordDefinition = { + keyword: "additionalProperties", + type: ["object"], + schemaType: ["boolean", "object"], + allowUndefined: true, + trackErrors: true, + error, + code(cxt) { + const {gen, schema, parentSchema, data, errsCount, it} = cxt + /* istanbul ignore if */ + if (!errsCount) throw new Error("ajv implementation error") + const {allErrors, opts} = it + it.props = true + if (opts.removeAdditional !== "all" && alwaysValidSchema(it, schema)) return + const props = allSchemaProperties(parentSchema.properties) + const patProps = allSchemaProperties(parentSchema.patternProperties) + checkAdditionalProperties() + cxt.ok(_`${errsCount} === ${N.errors}`) + + function checkAdditionalProperties(): void { + gen.forIn("key", data, (key: Name) => { + if (!props.length && !patProps.length) additionalPropertyCode(key) + else gen.if(isAdditional(key), () => additionalPropertyCode(key)) + }) + } + + function isAdditional(key: Name): Code { + let definedProp: Code + if (props.length > 8) { + // TODO maybe an option instead of hard-coded 8? + const propsSchema = schemaRefOrVal(it, parentSchema.properties, "properties") + definedProp = isOwnProperty(gen, propsSchema as Code, key) + } else if (props.length) { + definedProp = or(...props.map((p) => _`${key} === ${p}`)) + } else { + definedProp = nil + } + if (patProps.length) { + definedProp = or(definedProp, ...patProps.map((p) => _`${usePattern(cxt, p)}.test(${key})`)) + } + return not(definedProp) + } + + function deleteAdditional(key: Name): void { + gen.code(_`delete ${data}[${key}]`) + } + + function additionalPropertyCode(key: Name): void { + if (opts.removeAdditional === "all" || (opts.removeAdditional && schema === false)) { + deleteAdditional(key) + return + } + + if (schema === false) { + cxt.setParams({additionalProperty: key}) + cxt.error() + if (!allErrors) gen.break() + return + } + + if (typeof schema == "object" && !alwaysValidSchema(it, schema)) { + const valid = gen.name("valid") + if (opts.removeAdditional === "failing") { + applyAdditionalSchema(key, valid, false) + gen.if(not(valid), () => { + cxt.reset() + deleteAdditional(key) + }) + } else { + applyAdditionalSchema(key, valid) + if (!allErrors) gen.if(not(valid), () => gen.break()) + } + } + } + + function applyAdditionalSchema(key: Name, valid: Name, errors?: false): void { + const subschema: SubschemaArgs = { + keyword: "additionalProperties", + dataProp: key, + dataPropType: Type.Str, + } + if (errors === false) { + Object.assign(subschema, { + compositeRule: true, + createErrors: false, + allErrors: false, + }) + } + cxt.subschema(subschema, valid) + } + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/allOf.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/allOf.ts new file mode 100644 index 000000000..cdfa86ff4 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/allOf.ts @@ -0,0 +1,22 @@ +import type {CodeKeywordDefinition, AnySchema} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {alwaysValidSchema} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: "allOf", + schemaType: "array", + code(cxt: KeywordCxt) { + const {gen, schema, it} = cxt + /* istanbul ignore if */ + if (!Array.isArray(schema)) throw new Error("ajv implementation error") + const valid = gen.name("valid") + schema.forEach((sch: AnySchema, i: number) => { + if (alwaysValidSchema(it, sch)) return + const schCxt = cxt.subschema({keyword: "allOf", schemaProp: i}, valid) + cxt.ok(valid) + cxt.mergeEvaluated(schCxt) + }) + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts new file mode 100644 index 000000000..bd331b5ae --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts @@ -0,0 +1,14 @@ +import type {CodeKeywordDefinition, ErrorNoParams, AnySchema} from "../../types" +import {validateUnion} from "../code" + +export type AnyOfError = ErrorNoParams<"anyOf", AnySchema[]> + +const def: CodeKeywordDefinition = { + keyword: "anyOf", + schemaType: "array", + trackErrors: true, + code: validateUnion, + error: {message: "must match a schema in anyOf"}, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/contains.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/contains.ts new file mode 100644 index 000000000..d88675c6c --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/contains.ts @@ -0,0 +1,109 @@ +import type { + CodeKeywordDefinition, + KeywordErrorDefinition, + ErrorObject, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, Name} from "../../compile/codegen" +import {alwaysValidSchema, checkStrictMode, Type} from "../../compile/util" + +export type ContainsError = ErrorObject< + "contains", + {minContains: number; maxContains?: number}, + AnySchema +> + +const error: KeywordErrorDefinition = { + message: ({params: {min, max}}) => + max === undefined + ? str`must contain at least ${min} valid item(s)` + : str`must contain at least ${min} and no more than ${max} valid item(s)`, + params: ({params: {min, max}}) => + max === undefined ? _`{minContains: ${min}}` : _`{minContains: ${min}, maxContains: ${max}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "contains", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + trackErrors: true, + error, + code(cxt: KeywordCxt) { + const {gen, schema, parentSchema, data, it} = cxt + let min: number + let max: number | undefined + const {minContains, maxContains} = parentSchema + if (it.opts.next) { + min = minContains === undefined ? 1 : minContains + max = maxContains + } else { + min = 1 + } + const len = gen.const("len", _`${data}.length`) + cxt.setParams({min, max}) + if (max === undefined && min === 0) { + checkStrictMode(it, `"minContains" == 0 without "maxContains": "contains" keyword ignored`) + return + } + if (max !== undefined && min > max) { + checkStrictMode(it, `"minContains" > "maxContains" is always invalid`) + cxt.fail() + return + } + if (alwaysValidSchema(it, schema)) { + let cond = _`${len} >= ${min}` + if (max !== undefined) cond = _`${cond} && ${len} <= ${max}` + cxt.pass(cond) + return + } + + it.items = true + const valid = gen.name("valid") + if (max === undefined && min === 1) { + validateItems(valid, () => gen.if(valid, () => gen.break())) + } else if (min === 0) { + gen.let(valid, true) + if (max !== undefined) gen.if(_`${data}.length > 0`, validateItemsWithCount) + } else { + gen.let(valid, false) + validateItemsWithCount() + } + cxt.result(valid, () => cxt.reset()) + + function validateItemsWithCount(): void { + const schValid = gen.name("_valid") + const count = gen.let("count", 0) + validateItems(schValid, () => gen.if(schValid, () => checkLimits(count))) + } + + function validateItems(_valid: Name, block: () => void): void { + gen.forRange("i", 0, len, (i) => { + cxt.subschema( + { + keyword: "contains", + dataProp: i, + dataPropType: Type.Num, + compositeRule: true, + }, + _valid + ) + block() + }) + } + + function checkLimits(count: Name): void { + gen.code(_`${count}++`) + if (max === undefined) { + gen.if(_`${count} >= ${min}`, () => gen.assign(valid, true).break()) + } else { + gen.if(_`${count} > ${max}`, () => gen.assign(valid, false).break()) + if (min === 1) gen.assign(valid, true) + else gen.if(_`${count} >= ${min}`, () => gen.assign(valid, true)) + } + } + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts new file mode 100644 index 000000000..f67611286 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts @@ -0,0 +1,112 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + SchemaMap, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str} from "../../compile/codegen" +import {alwaysValidSchema} from "../../compile/util" +import {checkReportMissingProp, checkMissingProp, reportMissingProp, propertyInData} from "../code" + +export type PropertyDependencies = {[K in string]?: string[]} + +export interface DependenciesErrorParams { + property: string + missingProperty: string + depsCount: number + deps: string // TODO change to string[] +} + +type SchemaDependencies = SchemaMap + +export type DependenciesError = ErrorObject< + "dependencies", + DependenciesErrorParams, + {[K in string]?: string[] | AnySchema} +> + +export const error: KeywordErrorDefinition = { + message: ({params: {property, depsCount, deps}}) => { + const property_ies = depsCount === 1 ? "property" : "properties" + return str`must have ${property_ies} ${deps} when property ${property} is present` + }, + params: ({params: {property, depsCount, deps, missingProperty}}) => + _`{property: ${property}, + missingProperty: ${missingProperty}, + depsCount: ${depsCount}, + deps: ${deps}}`, // TODO change to reference +} + +const def: CodeKeywordDefinition = { + keyword: "dependencies", + type: "object", + schemaType: "object", + error, + code(cxt: KeywordCxt) { + const [propDeps, schDeps] = splitDependencies(cxt) + validatePropertyDeps(cxt, propDeps) + validateSchemaDeps(cxt, schDeps) + }, +} + +function splitDependencies({schema}: KeywordCxt): [PropertyDependencies, SchemaDependencies] { + const propertyDeps: PropertyDependencies = {} + const schemaDeps: SchemaDependencies = {} + for (const key in schema) { + if (key === "__proto__") continue + const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps + deps[key] = schema[key] + } + return [propertyDeps, schemaDeps] +} + +export function validatePropertyDeps( + cxt: KeywordCxt, + propertyDeps: {[K in string]?: string[]} = cxt.schema +): void { + const {gen, data, it} = cxt + if (Object.keys(propertyDeps).length === 0) return + const missing = gen.let("missing") + for (const prop in propertyDeps) { + const deps = propertyDeps[prop] as string[] + if (deps.length === 0) continue + const hasProperty = propertyInData(gen, data, prop, it.opts.ownProperties) + cxt.setParams({ + property: prop, + depsCount: deps.length, + deps: deps.join(", "), + }) + if (it.allErrors) { + gen.if(hasProperty, () => { + for (const depProp of deps) { + checkReportMissingProp(cxt, depProp) + } + }) + } else { + gen.if(_`${hasProperty} && (${checkMissingProp(cxt, deps, missing)})`) + reportMissingProp(cxt, missing) + gen.else() + } + } +} + +export function validateSchemaDeps(cxt: KeywordCxt, schemaDeps: SchemaMap = cxt.schema): void { + const {gen, data, keyword, it} = cxt + const valid = gen.name("valid") + for (const prop in schemaDeps) { + if (alwaysValidSchema(it, schemaDeps[prop] as AnySchema)) continue + gen.if( + propertyInData(gen, data, prop, it.opts.ownProperties), + () => { + const schCxt = cxt.subschema({keyword, schemaProp: prop}, valid) + cxt.mergeValidEvaluated(schCxt, valid) + }, + () => gen.var(valid, true) // TODO var + ) + cxt.ok(valid) + } +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts new file mode 100644 index 000000000..dbd3ae45c --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts @@ -0,0 +1,11 @@ +import type {CodeKeywordDefinition} from "../../types" +import {validateSchemaDeps} from "./dependencies" + +const def: CodeKeywordDefinition = { + keyword: "dependentSchemas", + type: "object", + schemaType: "object", + code: (cxt) => validateSchemaDeps(cxt), +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/if.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/if.ts new file mode 100644 index 000000000..5a40d5e3a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/if.ts @@ -0,0 +1,80 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import type {SchemaObjCxt} from "../../compile" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, not, Name} from "../../compile/codegen" +import {alwaysValidSchema, checkStrictMode} from "../../compile/util" + +export type IfKeywordError = ErrorObject<"if", {failingKeyword: string}, AnySchema> + +const error: KeywordErrorDefinition = { + message: ({params}) => str`must match "${params.ifClause}" schema`, + params: ({params}) => _`{failingKeyword: ${params.ifClause}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "if", + schemaType: ["object", "boolean"], + trackErrors: true, + error, + code(cxt: KeywordCxt) { + const {gen, parentSchema, it} = cxt + if (parentSchema.then === undefined && parentSchema.else === undefined) { + checkStrictMode(it, '"if" without "then" and "else" is ignored') + } + const hasThen = hasSchema(it, "then") + const hasElse = hasSchema(it, "else") + if (!hasThen && !hasElse) return + + const valid = gen.let("valid", true) + const schValid = gen.name("_valid") + validateIf() + cxt.reset() + + if (hasThen && hasElse) { + const ifClause = gen.let("ifClause") + cxt.setParams({ifClause}) + gen.if(schValid, validateClause("then", ifClause), validateClause("else", ifClause)) + } else if (hasThen) { + gen.if(schValid, validateClause("then")) + } else { + gen.if(not(schValid), validateClause("else")) + } + + cxt.pass(valid, () => cxt.error(true)) + + function validateIf(): void { + const schCxt = cxt.subschema( + { + keyword: "if", + compositeRule: true, + createErrors: false, + allErrors: false, + }, + schValid + ) + cxt.mergeEvaluated(schCxt) + } + + function validateClause(keyword: string, ifClause?: Name): () => void { + return () => { + const schCxt = cxt.subschema({keyword}, schValid) + gen.assign(valid, schValid) + cxt.mergeValidEvaluated(schCxt, valid) + if (ifClause) gen.assign(ifClause, _`${keyword}`) + else cxt.setParams({ifClause: keyword}) + } + } + }, +} + +function hasSchema(it: SchemaObjCxt, keyword: string): boolean { + const schema = it.schema[keyword] + return schema !== undefined && !alwaysValidSchema(it, schema) +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/index.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/index.ts new file mode 100644 index 000000000..fc5271699 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/index.ts @@ -0,0 +1,53 @@ +import type {ErrorNoParams, Vocabulary} from "../../types" +import additionalItems, {AdditionalItemsError} from "./additionalItems" +import prefixItems from "./prefixItems" +import items from "./items" +import items2020, {ItemsError} from "./items2020" +import contains, {ContainsError} from "./contains" +import dependencies, {DependenciesError} from "./dependencies" +import propertyNames, {PropertyNamesError} from "./propertyNames" +import additionalProperties, {AdditionalPropertiesError} from "./additionalProperties" +import properties from "./properties" +import patternProperties from "./patternProperties" +import notKeyword, {NotKeywordError} from "./not" +import anyOf, {AnyOfError} from "./anyOf" +import oneOf, {OneOfError} from "./oneOf" +import allOf from "./allOf" +import ifKeyword, {IfKeywordError} from "./if" +import thenElse from "./thenElse" + +export default function getApplicator(draft2020 = false): Vocabulary { + const applicator = [ + // any + notKeyword, + anyOf, + oneOf, + allOf, + ifKeyword, + thenElse, + // object + propertyNames, + additionalProperties, + dependencies, + properties, + patternProperties, + ] + // array + if (draft2020) applicator.push(prefixItems, items2020) + else applicator.push(additionalItems, items) + applicator.push(contains) + return applicator +} + +export type ApplicatorKeywordError = + | ErrorNoParams<"false schema"> + | AdditionalItemsError + | ItemsError + | ContainsError + | AdditionalPropertiesError + | DependenciesError + | IfKeywordError + | AnyOfError + | OneOfError + | NotKeywordError + | PropertyNamesError diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/items.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/items.ts new file mode 100644 index 000000000..033cb3977 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/items.ts @@ -0,0 +1,59 @@ +import type {CodeKeywordDefinition, AnySchema, AnySchemaObject} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_} from "../../compile/codegen" +import {alwaysValidSchema, mergeEvaluated, checkStrictMode} from "../../compile/util" +import {validateArray} from "../code" + +const def: CodeKeywordDefinition = { + keyword: "items", + type: "array", + schemaType: ["object", "array", "boolean"], + before: "uniqueItems", + code(cxt: KeywordCxt) { + const {schema, it} = cxt + if (Array.isArray(schema)) return validateTuple(cxt, "additionalItems", schema) + it.items = true + if (alwaysValidSchema(it, schema)) return + cxt.ok(validateArray(cxt)) + }, +} + +export function validateTuple( + cxt: KeywordCxt, + extraItems: string, + schArr: AnySchema[] = cxt.schema +): void { + const {gen, parentSchema, data, keyword, it} = cxt + checkStrictTuple(parentSchema) + if (it.opts.unevaluated && schArr.length && it.items !== true) { + it.items = mergeEvaluated.items(gen, schArr.length, it.items) + } + const valid = gen.name("valid") + const len = gen.const("len", _`${data}.length`) + schArr.forEach((sch: AnySchema, i: number) => { + if (alwaysValidSchema(it, sch)) return + gen.if(_`${len} > ${i}`, () => + cxt.subschema( + { + keyword, + schemaProp: i, + dataProp: i, + }, + valid + ) + ) + cxt.ok(valid) + }) + + function checkStrictTuple(sch: AnySchemaObject): void { + const {opts, errSchemaPath} = it + const l = schArr.length + const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false) + if (opts.strictTuples && !fullTuple) { + const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"` + checkStrictMode(it, msg, opts.strictTuples) + } + } +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/items2020.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/items2020.ts new file mode 100644 index 000000000..2a99b08d5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/items2020.ts @@ -0,0 +1,36 @@ +import type { + CodeKeywordDefinition, + KeywordErrorDefinition, + ErrorObject, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str} from "../../compile/codegen" +import {alwaysValidSchema} from "../../compile/util" +import {validateArray} from "../code" +import {validateAdditionalItems} from "./additionalItems" + +export type ItemsError = ErrorObject<"items", {limit: number}, AnySchema> + +const error: KeywordErrorDefinition = { + message: ({params: {len}}) => str`must NOT have more than ${len} items`, + params: ({params: {len}}) => _`{limit: ${len}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "items", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + error, + code(cxt: KeywordCxt) { + const {schema, parentSchema, it} = cxt + const {prefixItems} = parentSchema + it.items = true + if (alwaysValidSchema(it, schema)) return + if (prefixItems) validateAdditionalItems(cxt, prefixItems) + else cxt.ok(validateArray(cxt)) + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/not.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/not.ts new file mode 100644 index 000000000..8691db0bf --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/not.ts @@ -0,0 +1,38 @@ +import type {CodeKeywordDefinition, ErrorNoParams, AnySchema} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {alwaysValidSchema} from "../../compile/util" + +export type NotKeywordError = ErrorNoParams<"not", AnySchema> + +const def: CodeKeywordDefinition = { + keyword: "not", + schemaType: ["object", "boolean"], + trackErrors: true, + code(cxt: KeywordCxt) { + const {gen, schema, it} = cxt + if (alwaysValidSchema(it, schema)) { + cxt.fail() + return + } + + const valid = gen.name("valid") + cxt.subschema( + { + keyword: "not", + compositeRule: true, + createErrors: false, + allErrors: false, + }, + valid + ) + + cxt.failResult( + valid, + () => cxt.reset(), + () => cxt.error() + ) + }, + error: {message: "must NOT be valid"}, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts new file mode 100644 index 000000000..c25353ffd --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts @@ -0,0 +1,82 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, Name} from "../../compile/codegen" +import {alwaysValidSchema} from "../../compile/util" +import {SchemaCxt} from "../../compile" + +export type OneOfError = ErrorObject< + "oneOf", + {passingSchemas: [number, number] | null}, + AnySchema[] +> + +const error: KeywordErrorDefinition = { + message: "must match exactly one schema in oneOf", + params: ({params}) => _`{passingSchemas: ${params.passing}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "oneOf", + schemaType: "array", + trackErrors: true, + error, + code(cxt: KeywordCxt) { + const {gen, schema, parentSchema, it} = cxt + /* istanbul ignore if */ + if (!Array.isArray(schema)) throw new Error("ajv implementation error") + if (it.opts.discriminator && parentSchema.discriminator) return + const schArr: AnySchema[] = schema + const valid = gen.let("valid", false) + const passing = gen.let("passing", null) + const schValid = gen.name("_valid") + cxt.setParams({passing}) + // TODO possibly fail straight away (with warning or exception) if there are two empty always valid schemas + + gen.block(validateOneOf) + + cxt.result( + valid, + () => cxt.reset(), + () => cxt.error(true) + ) + + function validateOneOf(): void { + schArr.forEach((sch: AnySchema, i: number) => { + let schCxt: SchemaCxt | undefined + if (alwaysValidSchema(it, sch)) { + gen.var(schValid, true) + } else { + schCxt = cxt.subschema( + { + keyword: "oneOf", + schemaProp: i, + compositeRule: true, + }, + schValid + ) + } + + if (i > 0) { + gen + .if(_`${schValid} && ${valid}`) + .assign(valid, false) + .assign(passing, _`[${passing}, ${i}]`) + .else() + } + + gen.if(schValid, () => { + gen.assign(valid, true) + gen.assign(passing, i) + if (schCxt) cxt.mergeEvaluated(schCxt, Name) + }) + }) + } + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts new file mode 100644 index 000000000..ea624e230 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts @@ -0,0 +1,91 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {allSchemaProperties, usePattern} from "../code" +import {_, not, Name} from "../../compile/codegen" +import {alwaysValidSchema, checkStrictMode} from "../../compile/util" +import {evaluatedPropsToName, Type} from "../../compile/util" +import {AnySchema} from "../../types" + +const def: CodeKeywordDefinition = { + keyword: "patternProperties", + type: "object", + schemaType: "object", + code(cxt: KeywordCxt) { + const {gen, schema, data, parentSchema, it} = cxt + const {opts} = it + const patterns = allSchemaProperties(schema) + const alwaysValidPatterns = patterns.filter((p) => + alwaysValidSchema(it, schema[p] as AnySchema) + ) + + if ( + patterns.length === 0 || + (alwaysValidPatterns.length === patterns.length && + (!it.opts.unevaluated || it.props === true)) + ) { + return + } + + const checkProperties = + opts.strictSchema && !opts.allowMatchingProperties && parentSchema.properties + const valid = gen.name("valid") + if (it.props !== true && !(it.props instanceof Name)) { + it.props = evaluatedPropsToName(gen, it.props) + } + const {props} = it + validatePatternProperties() + + function validatePatternProperties(): void { + for (const pat of patterns) { + if (checkProperties) checkMatchingProperties(pat) + if (it.allErrors) { + validateProperties(pat) + } else { + gen.var(valid, true) // TODO var + validateProperties(pat) + gen.if(valid) + } + } + } + + function checkMatchingProperties(pat: string): void { + for (const prop in checkProperties) { + if (new RegExp(pat).test(prop)) { + checkStrictMode( + it, + `property ${prop} matches pattern ${pat} (use allowMatchingProperties)` + ) + } + } + } + + function validateProperties(pat: string): void { + gen.forIn("key", data, (key) => { + gen.if(_`${usePattern(cxt, pat)}.test(${key})`, () => { + const alwaysValid = alwaysValidPatterns.includes(pat) + if (!alwaysValid) { + cxt.subschema( + { + keyword: "patternProperties", + schemaProp: pat, + dataProp: key, + dataPropType: Type.Str, + }, + valid + ) + } + + if (it.opts.unevaluated && props !== true) { + gen.assign(_`${props}[${key}]`, true) + } else if (!alwaysValid && !it.allErrors) { + // can short-circuit if `unevaluatedProperties` is not supported (opts.next === false) + // or if all properties were evaluated (props === true) + gen.if(not(valid), () => gen.break()) + } + }) + }) + } + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts new file mode 100644 index 000000000..008fb2db1 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts @@ -0,0 +1,12 @@ +import type {CodeKeywordDefinition} from "../../types" +import {validateTuple} from "./items" + +const def: CodeKeywordDefinition = { + keyword: "prefixItems", + type: "array", + schemaType: ["array"], + before: "uniqueItems", + code: (cxt) => validateTuple(cxt, "items"), +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/properties.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/properties.ts new file mode 100644 index 000000000..a55b19ce5 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/properties.ts @@ -0,0 +1,57 @@ +import type {CodeKeywordDefinition} from "../../types" +import {KeywordCxt} from "../../compile/validate" +import {propertyInData, allSchemaProperties} from "../code" +import {alwaysValidSchema, toHash, mergeEvaluated} from "../../compile/util" +import apDef from "./additionalProperties" + +const def: CodeKeywordDefinition = { + keyword: "properties", + type: "object", + schemaType: "object", + code(cxt: KeywordCxt) { + const {gen, schema, parentSchema, data, it} = cxt + if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === undefined) { + apDef.code(new KeywordCxt(it, apDef, "additionalProperties")) + } + const allProps = allSchemaProperties(schema) + for (const prop of allProps) { + it.definedProperties.add(prop) + } + if (it.opts.unevaluated && allProps.length && it.props !== true) { + it.props = mergeEvaluated.props(gen, toHash(allProps), it.props) + } + const properties = allProps.filter((p) => !alwaysValidSchema(it, schema[p])) + if (properties.length === 0) return + const valid = gen.name("valid") + + for (const prop of properties) { + if (hasDefault(prop)) { + applyPropertySchema(prop) + } else { + gen.if(propertyInData(gen, data, prop, it.opts.ownProperties)) + applyPropertySchema(prop) + if (!it.allErrors) gen.else().var(valid, true) + gen.endIf() + } + cxt.it.definedProperties.add(prop) + cxt.ok(valid) + } + + function hasDefault(prop: string): boolean | undefined { + return it.opts.useDefaults && !it.compositeRule && schema[prop].default !== undefined + } + + function applyPropertySchema(prop: string): void { + cxt.subschema( + { + keyword: "properties", + schemaProp: prop, + dataProp: prop, + }, + valid + ) + } + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts new file mode 100644 index 000000000..1c54d6052 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts @@ -0,0 +1,50 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, not} from "../../compile/codegen" +import {alwaysValidSchema} from "../../compile/util" + +export type PropertyNamesError = ErrorObject<"propertyNames", {propertyName: string}, AnySchema> + +const error: KeywordErrorDefinition = { + message: "property name must be valid", + params: ({params}) => _`{propertyName: ${params.propertyName}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "propertyNames", + type: "object", + schemaType: ["object", "boolean"], + error, + code(cxt: KeywordCxt) { + const {gen, schema, data, it} = cxt + if (alwaysValidSchema(it, schema)) return + const valid = gen.name("valid") + + gen.forIn("key", data, (key) => { + cxt.setParams({propertyName: key}) + cxt.subschema( + { + keyword: "propertyNames", + data: key, + dataTypes: ["string"], + propertyName: key, + compositeRule: true, + }, + valid + ) + gen.if(not(valid), () => { + cxt.error(true) + if (!it.allErrors) gen.break() + }) + }) + + cxt.ok(valid) + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts new file mode 100644 index 000000000..5055182e8 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts @@ -0,0 +1,13 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {checkStrictMode} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: ["then", "else"], + schemaType: ["object", "boolean"], + code({keyword, parentSchema, it}: KeywordCxt) { + if (parentSchema.if === undefined) checkStrictMode(it, `"${keyword}" without "if" is ignored`) + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/code.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/code.ts new file mode 100644 index 000000000..92cdd5b04 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/code.ts @@ -0,0 +1,168 @@ +import type {AnySchema, SchemaMap} from "../types" +import type {SchemaCxt} from "../compile" +import type {KeywordCxt} from "../compile/validate" +import {CodeGen, _, and, or, not, nil, strConcat, getProperty, Code, Name} from "../compile/codegen" +import {alwaysValidSchema, Type} from "../compile/util" +import N from "../compile/names" +import {useFunc} from "../compile/util" +export function checkReportMissingProp(cxt: KeywordCxt, prop: string): void { + const {gen, data, it} = cxt + gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => { + cxt.setParams({missingProperty: _`${prop}`}, true) + cxt.error() + }) +} + +export function checkMissingProp( + {gen, data, it: {opts}}: KeywordCxt, + properties: string[], + missing: Name +): Code { + return or( + ...properties.map((prop) => + and(noPropertyInData(gen, data, prop, opts.ownProperties), _`${missing} = ${prop}`) + ) + ) +} + +export function reportMissingProp(cxt: KeywordCxt, missing: Name): void { + cxt.setParams({missingProperty: missing}, true) + cxt.error() +} + +export function hasPropFunc(gen: CodeGen): Name { + return gen.scopeValue("func", { + // eslint-disable-next-line @typescript-eslint/unbound-method + ref: Object.prototype.hasOwnProperty, + code: _`Object.prototype.hasOwnProperty`, + }) +} + +export function isOwnProperty(gen: CodeGen, data: Name, property: Name | string): Code { + return _`${hasPropFunc(gen)}.call(${data}, ${property})` +} + +export function propertyInData( + gen: CodeGen, + data: Name, + property: Name | string, + ownProperties?: boolean +): Code { + const cond = _`${data}${getProperty(property)} !== undefined` + return ownProperties ? _`${cond} && ${isOwnProperty(gen, data, property)}` : cond +} + +export function noPropertyInData( + gen: CodeGen, + data: Name, + property: Name | string, + ownProperties?: boolean +): Code { + const cond = _`${data}${getProperty(property)} === undefined` + return ownProperties ? or(cond, not(isOwnProperty(gen, data, property))) : cond +} + +export function allSchemaProperties(schemaMap?: SchemaMap): string[] { + return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : [] +} + +export function schemaProperties(it: SchemaCxt, schemaMap: SchemaMap): string[] { + return allSchemaProperties(schemaMap).filter( + (p) => !alwaysValidSchema(it, schemaMap[p] as AnySchema) + ) +} + +export function callValidateCode( + {schemaCode, data, it: {gen, topSchemaRef, schemaPath, errorPath}, it}: KeywordCxt, + func: Code, + context: Code, + passSchema?: boolean +): Code { + const dataAndSchema = passSchema ? _`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data + const valCxt: [Name, Code | number][] = [ + [N.instancePath, strConcat(N.instancePath, errorPath)], + [N.parentData, it.parentData], + [N.parentDataProperty, it.parentDataProperty], + [N.rootData, N.rootData], + ] + if (it.opts.dynamicRef) valCxt.push([N.dynamicAnchors, N.dynamicAnchors]) + const args = _`${dataAndSchema}, ${gen.object(...valCxt)}` + return context !== nil ? _`${func}.call(${context}, ${args})` : _`${func}(${args})` +} + +const newRegExp = _`new RegExp` + +export function usePattern({gen, it: {opts}}: KeywordCxt, pattern: string): Name { + const u = opts.unicodeRegExp ? "u" : "" + const {regExp} = opts.code + const rx = regExp(pattern, u) + + return gen.scopeValue("pattern", { + key: rx.toString(), + ref: rx, + code: _`${regExp.code === "new RegExp" ? newRegExp : useFunc(gen, regExp)}(${pattern}, ${u})`, + }) +} + +export function validateArray(cxt: KeywordCxt): Name { + const {gen, data, keyword, it} = cxt + const valid = gen.name("valid") + if (it.allErrors) { + const validArr = gen.let("valid", true) + validateItems(() => gen.assign(validArr, false)) + return validArr + } + gen.var(valid, true) + validateItems(() => gen.break()) + return valid + + function validateItems(notValid: () => void): void { + const len = gen.const("len", _`${data}.length`) + gen.forRange("i", 0, len, (i) => { + cxt.subschema( + { + keyword, + dataProp: i, + dataPropType: Type.Num, + }, + valid + ) + gen.if(not(valid), notValid) + }) + } +} + +export function validateUnion(cxt: KeywordCxt): void { + const {gen, schema, keyword, it} = cxt + /* istanbul ignore if */ + if (!Array.isArray(schema)) throw new Error("ajv implementation error") + const alwaysValid = schema.some((sch: AnySchema) => alwaysValidSchema(it, sch)) + if (alwaysValid && !it.opts.unevaluated) return + + const valid = gen.let("valid", false) + const schValid = gen.name("_valid") + + gen.block(() => + schema.forEach((_sch: AnySchema, i: number) => { + const schCxt = cxt.subschema( + { + keyword, + schemaProp: i, + compositeRule: true, + }, + schValid + ) + gen.assign(valid, _`${valid} || ${schValid}`) + const merged = cxt.mergeValidEvaluated(schCxt, schValid) + // can short-circuit if `unevaluatedProperties/Items` not supported (opts.unevaluated !== true) + // or if all properties and items were evaluated (it.props === true && it.items === true) + if (!merged) gen.if(not(valid)) + }) + ) + + cxt.result( + valid, + () => cxt.reset(), + () => cxt.error(true) + ) +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/core/id.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/core/id.ts new file mode 100644 index 000000000..aa36c4bb2 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/core/id.ts @@ -0,0 +1,10 @@ +import type {CodeKeywordDefinition} from "../../types" + +const def: CodeKeywordDefinition = { + keyword: "id", + code() { + throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID') + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/core/index.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/core/index.ts new file mode 100644 index 000000000..e63e2895d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/core/index.ts @@ -0,0 +1,16 @@ +import type {Vocabulary} from "../../types" +import idKeyword from "./id" +import refKeyword from "./ref" + +const core: Vocabulary = [ + "$schema", + "$id", + "$defs", + "$vocabulary", + {keyword: "$comment"}, + "definitions", + idKeyword, + refKeyword, +] + +export default core diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/core/ref.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/core/ref.ts new file mode 100644 index 000000000..5d59fbcb2 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/core/ref.ts @@ -0,0 +1,129 @@ +import type {CodeKeywordDefinition, AnySchema} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import MissingRefError from "../../compile/ref_error" +import {callValidateCode} from "../code" +import {_, nil, stringify, Code, Name} from "../../compile/codegen" +import N from "../../compile/names" +import {SchemaEnv, resolveRef} from "../../compile" +import {mergeEvaluated} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: "$ref", + schemaType: "string", + code(cxt: KeywordCxt): void { + const {gen, schema: $ref, it} = cxt + const {baseId, schemaEnv: env, validateName, opts, self} = it + const {root} = env + if (($ref === "#" || $ref === "#/") && baseId === root.baseId) return callRootRef() + const schOrEnv = resolveRef.call(self, root, baseId, $ref) + if (schOrEnv === undefined) throw new MissingRefError(it.opts.uriResolver, baseId, $ref) + if (schOrEnv instanceof SchemaEnv) return callValidate(schOrEnv) + return inlineRefSchema(schOrEnv) + + function callRootRef(): void { + if (env === root) return callRef(cxt, validateName, env, env.$async) + const rootName = gen.scopeValue("root", {ref: root}) + return callRef(cxt, _`${rootName}.validate`, root, root.$async) + } + + function callValidate(sch: SchemaEnv): void { + const v = getValidate(cxt, sch) + callRef(cxt, v, sch, sch.$async) + } + + function inlineRefSchema(sch: AnySchema): void { + const schName = gen.scopeValue( + "schema", + opts.code.source === true ? {ref: sch, code: stringify(sch)} : {ref: sch} + ) + const valid = gen.name("valid") + const schCxt = cxt.subschema( + { + schema: sch, + dataTypes: [], + schemaPath: nil, + topSchemaRef: schName, + errSchemaPath: $ref, + }, + valid + ) + cxt.mergeEvaluated(schCxt) + cxt.ok(valid) + } + }, +} + +export function getValidate(cxt: KeywordCxt, sch: SchemaEnv): Code { + const {gen} = cxt + return sch.validate + ? gen.scopeValue("validate", {ref: sch.validate}) + : _`${gen.scopeValue("wrapper", {ref: sch})}.validate` +} + +export function callRef(cxt: KeywordCxt, v: Code, sch?: SchemaEnv, $async?: boolean): void { + const {gen, it} = cxt + const {allErrors, schemaEnv: env, opts} = it + const passCxt = opts.passContext ? N.this : nil + if ($async) callAsyncRef() + else callSyncRef() + + function callAsyncRef(): void { + if (!env.$async) throw new Error("async schema referenced by sync schema") + const valid = gen.let("valid") + gen.try( + () => { + gen.code(_`await ${callValidateCode(cxt, v, passCxt)}`) + addEvaluatedFrom(v) // TODO will not work with async, it has to be returned with the result + if (!allErrors) gen.assign(valid, true) + }, + (e) => { + gen.if(_`!(${e} instanceof ${it.ValidationError as Name})`, () => gen.throw(e)) + addErrorsFrom(e) + if (!allErrors) gen.assign(valid, false) + } + ) + cxt.ok(valid) + } + + function callSyncRef(): void { + cxt.result( + callValidateCode(cxt, v, passCxt), + () => addEvaluatedFrom(v), + () => addErrorsFrom(v) + ) + } + + function addErrorsFrom(source: Code): void { + const errs = _`${source}.errors` + gen.assign(N.vErrors, _`${N.vErrors} === null ? ${errs} : ${N.vErrors}.concat(${errs})`) // TODO tagged + gen.assign(N.errors, _`${N.vErrors}.length`) + } + + function addEvaluatedFrom(source: Code): void { + if (!it.opts.unevaluated) return + const schEvaluated = sch?.validate?.evaluated + // TODO refactor + if (it.props !== true) { + if (schEvaluated && !schEvaluated.dynamicProps) { + if (schEvaluated.props !== undefined) { + it.props = mergeEvaluated.props(gen, schEvaluated.props, it.props) + } + } else { + const props = gen.var("props", _`${source}.evaluated.props`) + it.props = mergeEvaluated.props(gen, props, it.props, Name) + } + } + if (it.items !== true) { + if (schEvaluated && !schEvaluated.dynamicItems) { + if (schEvaluated.items !== undefined) { + it.items = mergeEvaluated.items(gen, schEvaluated.items, it.items) + } + } else { + const items = gen.var("items", _`${source}.evaluated.items`) + it.items = mergeEvaluated.items(gen, items, it.items, Name) + } + } + } +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/discriminator/index.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/discriminator/index.ts new file mode 100644 index 000000000..98f0f8cfb --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/discriminator/index.ts @@ -0,0 +1,110 @@ +import type {CodeKeywordDefinition, AnySchemaObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, getProperty, Name} from "../../compile/codegen" +import {DiscrError, DiscrErrorObj} from "../discriminator/types" +import {resolveRef, SchemaEnv} from "../../compile" +import {schemaHasRulesButRef} from "../../compile/util" + +export type DiscriminatorError = DiscrErrorObj | DiscrErrorObj + +const error: KeywordErrorDefinition = { + message: ({params: {discrError, tagName}}) => + discrError === DiscrError.Tag + ? `tag "${tagName}" must be string` + : `value of tag "${tagName}" must be in oneOf`, + params: ({params: {discrError, tag, tagName}}) => + _`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "discriminator", + type: "object", + schemaType: "object", + error, + code(cxt: KeywordCxt) { + const {gen, data, schema, parentSchema, it} = cxt + const {oneOf} = parentSchema + if (!it.opts.discriminator) { + throw new Error("discriminator: requires discriminator option") + } + const tagName = schema.propertyName + if (typeof tagName != "string") throw new Error("discriminator: requires propertyName") + if (schema.mapping) throw new Error("discriminator: mapping is not supported") + if (!oneOf) throw new Error("discriminator: requires oneOf keyword") + const valid = gen.let("valid", false) + const tag = gen.const("tag", _`${data}${getProperty(tagName)}`) + gen.if( + _`typeof ${tag} == "string"`, + () => validateMapping(), + () => cxt.error(false, {discrError: DiscrError.Tag, tag, tagName}) + ) + cxt.ok(valid) + + function validateMapping(): void { + const mapping = getMapping() + gen.if(false) + for (const tagValue in mapping) { + gen.elseIf(_`${tag} === ${tagValue}`) + gen.assign(valid, applyTagSchema(mapping[tagValue])) + } + gen.else() + cxt.error(false, {discrError: DiscrError.Mapping, tag, tagName}) + gen.endIf() + } + + function applyTagSchema(schemaProp?: number): Name { + const _valid = gen.name("valid") + const schCxt = cxt.subschema({keyword: "oneOf", schemaProp}, _valid) + cxt.mergeEvaluated(schCxt, Name) + return _valid + } + + function getMapping(): {[T in string]?: number} { + const oneOfMapping: {[T in string]?: number} = {} + const topRequired = hasRequired(parentSchema) + let tagRequired = true + for (let i = 0; i < oneOf.length; i++) { + let sch = oneOf[i] + if (sch?.$ref && !schemaHasRulesButRef(sch, it.self.RULES)) { + sch = resolveRef.call(it.self, it.schemaEnv.root, it.baseId, sch?.$ref) + if (sch instanceof SchemaEnv) sch = sch.schema + } + const propSch = sch?.properties?.[tagName] + if (typeof propSch != "object") { + throw new Error( + `discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"` + ) + } + tagRequired = tagRequired && (topRequired || hasRequired(sch)) + addMappings(propSch, i) + } + if (!tagRequired) throw new Error(`discriminator: "${tagName}" must be required`) + return oneOfMapping + + function hasRequired({required}: AnySchemaObject): boolean { + return Array.isArray(required) && required.includes(tagName) + } + + function addMappings(sch: AnySchemaObject, i: number): void { + if (sch.const) { + addMapping(sch.const, i) + } else if (sch.enum) { + for (const tagValue of sch.enum) { + addMapping(tagValue, i) + } + } else { + throw new Error(`discriminator: "properties/${tagName}" must have "const" or "enum"`) + } + } + + function addMapping(tagValue: unknown, i: number): void { + if (typeof tagValue != "string" || tagValue in oneOfMapping) { + throw new Error(`discriminator: "${tagName}" values must be unique strings`) + } + oneOfMapping[tagValue] = i + } + } + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/discriminator/types.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/discriminator/types.ts new file mode 100644 index 000000000..bee5a2785 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/discriminator/types.ts @@ -0,0 +1,12 @@ +import type {ErrorObject} from "../../types" + +export enum DiscrError { + Tag = "tag", + Mapping = "mapping", +} + +export type DiscrErrorObj = ErrorObject< + "discriminator", + {error: E; tag: string; tagValue: unknown}, + string +> diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/draft2020.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/draft2020.ts new file mode 100644 index 000000000..47fbf0ee6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/draft2020.ts @@ -0,0 +1,23 @@ +import type {Vocabulary} from "../types" +import coreVocabulary from "./core" +import validationVocabulary from "./validation" +import getApplicatorVocabulary from "./applicator" +import dynamicVocabulary from "./dynamic" +import nextVocabulary from "./next" +import unevaluatedVocabulary from "./unevaluated" +import formatVocabulary from "./format" +import {metadataVocabulary, contentVocabulary} from "./metadata" + +const draft2020Vocabularies: Vocabulary[] = [ + dynamicVocabulary, + coreVocabulary, + validationVocabulary, + getApplicatorVocabulary(true), + formatVocabulary, + metadataVocabulary, + contentVocabulary, + nextVocabulary, + unevaluatedVocabulary, +] + +export default draft2020Vocabularies diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/draft7.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/draft7.ts new file mode 100644 index 000000000..226a644aa --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/draft7.ts @@ -0,0 +1,17 @@ +import type {Vocabulary} from "../types" +import coreVocabulary from "./core" +import validationVocabulary from "./validation" +import getApplicatorVocabulary from "./applicator" +import formatVocabulary from "./format" +import {metadataVocabulary, contentVocabulary} from "./metadata" + +const draft7Vocabularies: Vocabulary[] = [ + coreVocabulary, + validationVocabulary, + getApplicatorVocabulary(), + formatVocabulary, + metadataVocabulary, + contentVocabulary, +] + +export default draft7Vocabularies diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts new file mode 100644 index 000000000..ca1adb912 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts @@ -0,0 +1,31 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, getProperty, Code} from "../../compile/codegen" +import N from "../../compile/names" +import {SchemaEnv, compileSchema} from "../../compile" +import {getValidate} from "../core/ref" + +const def: CodeKeywordDefinition = { + keyword: "$dynamicAnchor", + schemaType: "string", + code: (cxt) => dynamicAnchor(cxt, cxt.schema), +} + +export function dynamicAnchor(cxt: KeywordCxt, anchor: string): void { + const {gen, it} = cxt + it.schemaEnv.root.dynamicAnchors[anchor] = true + const v = _`${N.dynamicAnchors}${getProperty(anchor)}` + const validate = it.errSchemaPath === "#" ? it.validateName : _getValidate(cxt) + gen.if(_`!${v}`, () => gen.assign(v, validate)) +} + +function _getValidate(cxt: KeywordCxt): Code { + const {schemaEnv, schema, self} = cxt.it + const {root, baseId, localRefs, meta} = schemaEnv.root + const {schemaId} = self.opts + const sch = new SchemaEnv({schema, schemaId, root, baseId, localRefs, meta}) + compileSchema.call(self, sch) + return getValidate(cxt, sch) +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts new file mode 100644 index 000000000..6a573f330 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts @@ -0,0 +1,51 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, getProperty, Code, Name} from "../../compile/codegen" +import N from "../../compile/names" +import {callRef} from "../core/ref" + +const def: CodeKeywordDefinition = { + keyword: "$dynamicRef", + schemaType: "string", + code: (cxt) => dynamicRef(cxt, cxt.schema), +} + +export function dynamicRef(cxt: KeywordCxt, ref: string): void { + const {gen, keyword, it} = cxt + if (ref[0] !== "#") throw new Error(`"${keyword}" only supports hash fragment reference`) + const anchor = ref.slice(1) + if (it.allErrors) { + _dynamicRef() + } else { + const valid = gen.let("valid", false) + _dynamicRef(valid) + cxt.ok(valid) + } + + function _dynamicRef(valid?: Name): void { + // TODO the assumption here is that `recursiveRef: #` always points to the root + // of the schema object, which is not correct, because there may be $id that + // makes # point to it, and the target schema may not contain dynamic/recursiveAnchor. + // Because of that 2 tests in recursiveRef.json fail. + // This is a similar problem to #815 (`$id` doesn't alter resolution scope for `{ "$ref": "#" }`). + // (This problem is not tested in JSON-Schema-Test-Suite) + if (it.schemaEnv.root.dynamicAnchors[anchor]) { + const v = gen.let("_v", _`${N.dynamicAnchors}${getProperty(anchor)}`) + gen.if(v, _callRef(v, valid), _callRef(it.validateName, valid)) + } else { + _callRef(it.validateName, valid)() + } + } + + function _callRef(validate: Code, valid?: Name): () => void { + return valid + ? () => + gen.block(() => { + callRef(cxt, validate) + gen.let(valid, true) + }) + : () => callRef(cxt, validate) + } +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/dynamic/index.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/dynamic/index.ts new file mode 100644 index 000000000..6d521db66 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/dynamic/index.ts @@ -0,0 +1,9 @@ +import type {Vocabulary} from "../../types" +import dynamicAnchor from "./dynamicAnchor" +import dynamicRef from "./dynamicRef" +import recursiveAnchor from "./recursiveAnchor" +import recursiveRef from "./recursiveRef" + +const dynamic: Vocabulary = [dynamicAnchor, dynamicRef, recursiveAnchor, recursiveRef] + +export default dynamic diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts new file mode 100644 index 000000000..25f3db96b --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts @@ -0,0 +1,14 @@ +import type {CodeKeywordDefinition} from "../../types" +import {dynamicAnchor} from "./dynamicAnchor" +import {checkStrictMode} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: "$recursiveAnchor", + schemaType: "boolean", + code(cxt) { + if (cxt.schema) dynamicAnchor(cxt, "") + else checkStrictMode(cxt.it, "$recursiveAnchor: false is ignored") + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts new file mode 100644 index 000000000..c84af0f05 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts @@ -0,0 +1,10 @@ +import type {CodeKeywordDefinition} from "../../types" +import {dynamicRef} from "./dynamicRef" + +const def: CodeKeywordDefinition = { + keyword: "$recursiveRef", + schemaType: "string", + code: (cxt) => dynamicRef(cxt, cxt.schema), +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/errors.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/errors.ts new file mode 100644 index 000000000..c9ca3f02f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/errors.ts @@ -0,0 +1,18 @@ +import type {TypeError} from "../compile/validate/dataType" +import type {ApplicatorKeywordError} from "./applicator" +import type {ValidationKeywordError} from "./validation" +import type {FormatError} from "./format/format" +import type {UnevaluatedPropertiesError} from "./unevaluated/unevaluatedProperties" +import type {UnevaluatedItemsError} from "./unevaluated/unevaluatedItems" +import type {DependentRequiredError} from "./validation/dependentRequired" +import type {DiscriminatorError} from "./discriminator" + +export type DefinedError = + | TypeError + | ApplicatorKeywordError + | ValidationKeywordError + | FormatError + | UnevaluatedPropertiesError + | UnevaluatedItemsError + | DependentRequiredError + | DiscriminatorError diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/format/format.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/format/format.ts new file mode 100644 index 000000000..4b1c13e76 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/format/format.ts @@ -0,0 +1,120 @@ +import type { + AddedFormat, + FormatValidator, + AsyncFormatValidator, + CodeKeywordDefinition, + KeywordErrorDefinition, + ErrorObject, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, nil, or, Code, getProperty, regexpCode} from "../../compile/codegen" + +type FormatValidate = + | FormatValidator + | FormatValidator + | AsyncFormatValidator + | AsyncFormatValidator + | RegExp + | string + | true + +export type FormatError = ErrorObject<"format", {format: string}, string | {$data: string}> + +const error: KeywordErrorDefinition = { + message: ({schemaCode}) => str`must match format "${schemaCode}"`, + params: ({schemaCode}) => _`{format: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "format", + type: ["number", "string"], + schemaType: "string", + $data: true, + error, + code(cxt: KeywordCxt, ruleType?: string) { + const {gen, data, $data, schema, schemaCode, it} = cxt + const {opts, errSchemaPath, schemaEnv, self} = it + if (!opts.validateFormats) return + + if ($data) validate$DataFormat() + else validateFormat() + + function validate$DataFormat(): void { + const fmts = gen.scopeValue("formats", { + ref: self.formats, + code: opts.code.formats, + }) + const fDef = gen.const("fDef", _`${fmts}[${schemaCode}]`) + const fType = gen.let("fType") + const format = gen.let("format") + // TODO simplify + gen.if( + _`typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, + () => gen.assign(fType, _`${fDef}.type || "string"`).assign(format, _`${fDef}.validate`), + () => gen.assign(fType, _`"string"`).assign(format, fDef) + ) + cxt.fail$data(or(unknownFmt(), invalidFmt())) + + function unknownFmt(): Code { + if (opts.strictSchema === false) return nil + return _`${schemaCode} && !${format}` + } + + function invalidFmt(): Code { + const callFormat = schemaEnv.$async + ? _`(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))` + : _`${format}(${data})` + const validData = _`(typeof ${format} == "function" ? ${callFormat} : ${format}.test(${data}))` + return _`${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}` + } + } + + function validateFormat(): void { + const formatDef: AddedFormat | undefined = self.formats[schema] + if (!formatDef) { + unknownFormat() + return + } + if (formatDef === true) return + const [fmtType, format, fmtRef] = getFormat(formatDef) + if (fmtType === ruleType) cxt.pass(validCondition()) + + function unknownFormat(): void { + if (opts.strictSchema === false) { + self.logger.warn(unknownMsg()) + return + } + throw new Error(unknownMsg()) + + function unknownMsg(): string { + return `unknown format "${schema as string}" ignored in schema at path "${errSchemaPath}"` + } + } + + function getFormat(fmtDef: AddedFormat): [string, FormatValidate, Code] { + const code = + fmtDef instanceof RegExp + ? regexpCode(fmtDef) + : opts.code.formats + ? _`${opts.code.formats}${getProperty(schema)}` + : undefined + const fmt = gen.scopeValue("formats", {key: schema, ref: fmtDef, code}) + if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) { + return [fmtDef.type || "string", fmtDef.validate, _`${fmt}.validate`] + } + + return ["string", fmtDef, fmt] + } + + function validCondition(): Code { + if (typeof formatDef == "object" && !(formatDef instanceof RegExp) && formatDef.async) { + if (!schemaEnv.$async) throw new Error("async format in sync schema") + return _`await ${fmtRef}(${data})` + } + return typeof format == "function" ? _`${fmtRef}(${data})` : _`${fmtRef}.test(${data})` + } + } + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/format/index.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/format/index.ts new file mode 100644 index 000000000..bca2f5b3d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/format/index.ts @@ -0,0 +1,6 @@ +import type {Vocabulary} from "../../types" +import formatKeyword from "./format" + +const format: Vocabulary = [formatKeyword] + +export default format diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts new file mode 100644 index 000000000..f487c97f8 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts @@ -0,0 +1,89 @@ +import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, not, getProperty, Name} from "../../compile/codegen" +import {checkMetadata} from "./metadata" +import {checkNullableObject} from "./nullable" +import {typeErrorMessage, typeErrorParams, _JTDTypeError} from "./error" +import {DiscrError, DiscrErrorObj} from "../discriminator/types" + +export type JTDDiscriminatorError = + | _JTDTypeError<"discriminator", "object", string> + | DiscrErrorObj + | DiscrErrorObj + +const error: KeywordErrorDefinition = { + message: (cxt) => { + const {schema, params} = cxt + return params.discrError + ? params.discrError === DiscrError.Tag + ? `tag "${schema}" must be string` + : `value of tag "${schema}" must be in mapping` + : typeErrorMessage(cxt, "object") + }, + params: (cxt) => { + const {schema, params} = cxt + return params.discrError + ? _`{error: ${params.discrError}, tag: ${schema}, tagValue: ${params.tag}}` + : typeErrorParams(cxt, "object") + }, +} + +const def: CodeKeywordDefinition = { + keyword: "discriminator", + schemaType: "string", + implements: ["mapping"], + error, + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, data, schema, parentSchema} = cxt + const [valid, cond] = checkNullableObject(cxt, data) + + gen.if(cond) + validateDiscriminator() + gen.elseIf(not(valid)) + cxt.error() + gen.endIf() + cxt.ok(valid) + + function validateDiscriminator(): void { + const tag = gen.const("tag", _`${data}${getProperty(schema)}`) + gen.if(_`${tag} === undefined`) + cxt.error(false, {discrError: DiscrError.Tag, tag}) + gen.elseIf(_`typeof ${tag} == "string"`) + validateMapping(tag) + gen.else() + cxt.error(false, {discrError: DiscrError.Tag, tag}, {instancePath: schema}) + gen.endIf() + } + + function validateMapping(tag: Name): void { + gen.if(false) + for (const tagValue in parentSchema.mapping) { + gen.elseIf(_`${tag} === ${tagValue}`) + gen.assign(valid, applyTagSchema(tagValue)) + } + gen.else() + cxt.error( + false, + {discrError: DiscrError.Mapping, tag}, + {instancePath: schema, schemaPath: "mapping", parentSchema: true} + ) + gen.endIf() + } + + function applyTagSchema(schemaProp: string): Name { + const _valid = gen.name("valid") + cxt.subschema( + { + keyword: "mapping", + schemaProp, + jtdDiscriminator: schema, + }, + _valid + ) + return _valid + } + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/elements.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/elements.ts new file mode 100644 index 000000000..983af7c02 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/elements.ts @@ -0,0 +1,32 @@ +import type {CodeKeywordDefinition, SchemaObject} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {alwaysValidSchema} from "../../compile/util" +import {validateArray} from "../code" +import {_, not} from "../../compile/codegen" +import {checkMetadata} from "./metadata" +import {checkNullable} from "./nullable" +import {typeError, _JTDTypeError} from "./error" + +export type JTDElementsError = _JTDTypeError<"elements", "array", SchemaObject> + +const def: CodeKeywordDefinition = { + keyword: "elements", + schemaType: "object", + error: typeError("array"), + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, data, schema, it} = cxt + if (alwaysValidSchema(it, schema)) return + const [valid] = checkNullable(cxt) + gen.if(not(valid), () => + gen.if( + _`Array.isArray(${data})`, + () => gen.assign(valid, validateArray(cxt)), + () => cxt.error() + ) + ) + cxt.ok(valid) + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/enum.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/enum.ts new file mode 100644 index 000000000..75464ff8e --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/enum.ts @@ -0,0 +1,45 @@ +import type {CodeKeywordDefinition, KeywordErrorDefinition, ErrorObject} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, or, and, Code} from "../../compile/codegen" +import {checkMetadata} from "./metadata" +import {checkNullable} from "./nullable" + +export type JTDEnumError = ErrorObject<"enum", {allowedValues: string[]}, string[]> + +const error: KeywordErrorDefinition = { + message: "must be equal to one of the allowed values", + params: ({schemaCode}) => _`{allowedValues: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "enum", + schemaType: "array", + error, + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, data, schema, schemaValue, parentSchema, it} = cxt + if (schema.length === 0) throw new Error("enum must have non-empty array") + if (schema.length !== new Set(schema).size) throw new Error("enum items must be unique") + let valid: Code + const isString = _`typeof ${data} == "string"` + if (schema.length >= it.opts.loopEnum) { + let cond: Code + ;[valid, cond] = checkNullable(cxt, isString) + gen.if(cond, loopEnum) + } else { + /* istanbul ignore if */ + if (!Array.isArray(schema)) throw new Error("ajv implementation error") + valid = and(isString, or(...schema.map((value: string) => _`${data} === ${value}`))) + if (parentSchema.nullable) valid = or(_`${data} === null`, valid) + } + cxt.pass(valid) + + function loopEnum(): void { + gen.forOf("v", schemaValue as Code, (v) => + gen.if(_`${valid} = ${data} === ${v}`, () => gen.break()) + ) + } + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/error.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/error.ts new file mode 100644 index 000000000..506932258 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/error.ts @@ -0,0 +1,23 @@ +import type {KeywordErrorDefinition, KeywordErrorCxt, ErrorObject} from "../../types" +import {_, Code} from "../../compile/codegen" + +export type _JTDTypeError = ErrorObject< + K, + {type: T; nullable: boolean}, + S +> + +export function typeError(t: string): KeywordErrorDefinition { + return { + message: (cxt) => typeErrorMessage(cxt, t), + params: (cxt) => typeErrorParams(cxt, t), + } +} + +export function typeErrorMessage({parentSchema}: KeywordErrorCxt, t: string): string { + return parentSchema?.nullable ? `must be ${t} or null` : `must be ${t}` +} + +export function typeErrorParams({parentSchema}: KeywordErrorCxt, t: string): Code { + return _`{type: ${t}, nullable: ${!!parentSchema?.nullable}}` +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/index.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/index.ts new file mode 100644 index 000000000..f7baebc30 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/index.ts @@ -0,0 +1,37 @@ +import type {Vocabulary} from "../../types" +import refKeyword from "./ref" +import typeKeyword, {JTDTypeError} from "./type" +import enumKeyword, {JTDEnumError} from "./enum" +import elements, {JTDElementsError} from "./elements" +import properties, {JTDPropertiesError} from "./properties" +import optionalProperties from "./optionalProperties" +import discriminator, {JTDDiscriminatorError} from "./discriminator" +import values, {JTDValuesError} from "./values" +import union from "./union" +import metadata from "./metadata" + +const jtdVocabulary: Vocabulary = [ + "definitions", + refKeyword, + typeKeyword, + enumKeyword, + elements, + properties, + optionalProperties, + discriminator, + values, + union, + metadata, + {keyword: "additionalProperties", schemaType: "boolean"}, + {keyword: "nullable", schemaType: "boolean"}, +] + +export default jtdVocabulary + +export type JTDErrorObject = + | JTDTypeError + | JTDEnumError + | JTDElementsError + | JTDPropertiesError + | JTDDiscriminatorError + | JTDValuesError diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/metadata.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/metadata.ts new file mode 100644 index 000000000..19eeb8c7d --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/metadata.ts @@ -0,0 +1,24 @@ +import {KeywordCxt} from "../../ajv" +import type {CodeKeywordDefinition} from "../../types" +import {alwaysValidSchema} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: "metadata", + schemaType: "object", + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, schema, it} = cxt + if (alwaysValidSchema(it, schema)) return + const valid = gen.name("valid") + cxt.subschema({keyword: "metadata", jtdMetadata: true}, valid) + cxt.ok(valid) + }, +} + +export function checkMetadata({it, keyword}: KeywordCxt, metadata?: boolean): void { + if (it.jtdMetadata !== metadata) { + throw new Error(`JTD: "${keyword}" cannot be used in this schema location`) + } +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/nullable.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/nullable.ts new file mode 100644 index 000000000..c74b05da7 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/nullable.ts @@ -0,0 +1,21 @@ +import type {KeywordCxt} from "../../compile/validate" +import {_, not, nil, Code, Name} from "../../compile/codegen" + +export function checkNullable( + {gen, data, parentSchema}: KeywordCxt, + cond: Code = nil +): [Name, Code] { + const valid = gen.name("valid") + if (parentSchema.nullable) { + gen.let(valid, _`${data} === null`) + cond = not(valid) + } else { + gen.let(valid, false) + } + return [valid, cond] +} + +export function checkNullableObject(cxt: KeywordCxt, cond: Code): [Name, Code] { + const [valid, cond_] = checkNullable(cxt, cond) + return [valid, _`${cond_} && typeof ${cxt.data} == "object" && !Array.isArray(${cxt.data})`] +} diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts new file mode 100644 index 000000000..8e91c8d91 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts @@ -0,0 +1,15 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {validateProperties, error} from "./properties" + +const def: CodeKeywordDefinition = { + keyword: "optionalProperties", + schemaType: "object", + error, + code(cxt: KeywordCxt) { + if (cxt.parentSchema.properties) return + validateProperties(cxt) + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/properties.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/properties.ts new file mode 100644 index 000000000..728c0b92c --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/properties.ts @@ -0,0 +1,177 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + SchemaObject, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {propertyInData, allSchemaProperties, isOwnProperty} from "../code" +import {alwaysValidSchema, schemaRefOrVal} from "../../compile/util" +import {_, and, not, Code, Name} from "../../compile/codegen" +import {checkMetadata} from "./metadata" +import {checkNullableObject} from "./nullable" +import {typeErrorMessage, typeErrorParams, _JTDTypeError} from "./error" + +enum PropError { + Additional = "additional", + Missing = "missing", +} + +type PropKeyword = "properties" | "optionalProperties" + +type PropSchema = {[P in string]?: SchemaObject} + +export type JTDPropertiesError = + | _JTDTypeError + | ErrorObject + | ErrorObject + +export const error: KeywordErrorDefinition = { + message: (cxt) => { + const {params} = cxt + return params.propError + ? params.propError === PropError.Additional + ? "must NOT have additional properties" + : `must have property '${params.missingProperty}'` + : typeErrorMessage(cxt, "object") + }, + params: (cxt) => { + const {params} = cxt + return params.propError + ? params.propError === PropError.Additional + ? _`{error: ${params.propError}, additionalProperty: ${params.additionalProperty}}` + : _`{error: ${params.propError}, missingProperty: ${params.missingProperty}}` + : typeErrorParams(cxt, "object") + }, +} + +const def: CodeKeywordDefinition = { + keyword: "properties", + schemaType: "object", + error, + code: validateProperties, +} + +// const error: KeywordErrorDefinition = { +// message: "should NOT have additional properties", +// params: ({params}) => _`{additionalProperty: ${params.additionalProperty}}`, +// } + +export function validateProperties(cxt: KeywordCxt): void { + checkMetadata(cxt) + const {gen, data, parentSchema, it} = cxt + const {additionalProperties, nullable} = parentSchema + if (it.jtdDiscriminator && nullable) throw new Error("JTD: nullable inside discriminator mapping") + if (commonProperties()) { + throw new Error("JTD: properties and optionalProperties have common members") + } + const [allProps, properties] = schemaProperties("properties") + const [allOptProps, optProperties] = schemaProperties("optionalProperties") + if (properties.length === 0 && optProperties.length === 0 && additionalProperties) { + return + } + + const [valid, cond] = + it.jtdDiscriminator === undefined + ? checkNullableObject(cxt, data) + : [gen.let("valid", false), true] + gen.if(cond, () => + gen.assign(valid, true).block(() => { + validateProps(properties, "properties", true) + validateProps(optProperties, "optionalProperties") + if (!additionalProperties) validateAdditional() + }) + ) + cxt.pass(valid) + + function commonProperties(): boolean { + const props = parentSchema.properties as Record | undefined + const optProps = parentSchema.optionalProperties as Record | undefined + if (!(props && optProps)) return false + for (const p in props) { + if (Object.prototype.hasOwnProperty.call(optProps, p)) return true + } + return false + } + + function schemaProperties(keyword: string): [string[], string[]] { + const schema = parentSchema[keyword] + const allPs = schema ? allSchemaProperties(schema) : [] + if (it.jtdDiscriminator && allPs.some((p) => p === it.jtdDiscriminator)) { + throw new Error(`JTD: discriminator tag used in ${keyword}`) + } + const ps = allPs.filter((p) => !alwaysValidSchema(it, schema[p])) + return [allPs, ps] + } + + function validateProps(props: string[], keyword: string, required?: boolean): void { + const _valid = gen.var("valid") + for (const prop of props) { + gen.if( + propertyInData(gen, data, prop, it.opts.ownProperties), + () => applyPropertySchema(prop, keyword, _valid), + () => missingProperty(prop) + ) + cxt.ok(_valid) + } + + function missingProperty(prop: string): void { + if (required) { + gen.assign(_valid, false) + cxt.error(false, {propError: PropError.Missing, missingProperty: prop}, {schemaPath: prop}) + } else { + gen.assign(_valid, true) + } + } + } + + function applyPropertySchema(prop: string, keyword: string, _valid: Name): void { + cxt.subschema( + { + keyword, + schemaProp: prop, + dataProp: prop, + }, + _valid + ) + } + + function validateAdditional(): void { + gen.forIn("key", data, (key: Name) => { + const _allProps = + it.jtdDiscriminator === undefined ? allProps : [it.jtdDiscriminator].concat(allProps) + const addProp = isAdditional(key, _allProps, "properties") + const addOptProp = isAdditional(key, allOptProps, "optionalProperties") + const extra = + addProp === true ? addOptProp : addOptProp === true ? addProp : and(addProp, addOptProp) + gen.if(extra, () => { + if (it.opts.removeAdditional) { + gen.code(_`delete ${data}[${key}]`) + } else { + cxt.error( + false, + {propError: PropError.Additional, additionalProperty: key}, + {instancePath: key, parentSchema: true} + ) + if (!it.opts.allErrors) gen.break() + } + }) + }) + } + + function isAdditional(key: Name, props: string[], keyword: string): Code | true { + let additional: Code | boolean + if (props.length > 8) { + // TODO maybe an option instead of hard-coded 8? + const propsSchema = schemaRefOrVal(it, parentSchema[keyword], keyword) + additional = not(isOwnProperty(gen, propsSchema as Code, key)) + } else if (props.length) { + additional = and(...props.map((p) => _`${key} !== ${p}`)) + } else { + additional = true + } + return additional + } +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/ref.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/ref.ts new file mode 100644 index 000000000..97646ee1b --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/ref.ts @@ -0,0 +1,76 @@ +import type {CodeKeywordDefinition, AnySchemaObject} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {compileSchema, SchemaEnv} from "../../compile" +import {_, not, nil, stringify} from "../../compile/codegen" +import MissingRefError from "../../compile/ref_error" +import N from "../../compile/names" +import {getValidate, callRef} from "../core/ref" +import {checkMetadata} from "./metadata" + +const def: CodeKeywordDefinition = { + keyword: "ref", + schemaType: "string", + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, data, schema: ref, parentSchema, it} = cxt + const { + schemaEnv: {root}, + } = it + const valid = gen.name("valid") + if (parentSchema.nullable) { + gen.var(valid, _`${data} === null`) + gen.if(not(valid), validateJtdRef) + } else { + gen.var(valid, false) + validateJtdRef() + } + cxt.ok(valid) + + function validateJtdRef(): void { + const refSchema = (root.schema as AnySchemaObject).definitions?.[ref] + if (!refSchema) { + throw new MissingRefError(it.opts.uriResolver, "", ref, `No definition ${ref}`) + } + if (hasRef(refSchema) || !it.opts.inlineRefs) callValidate(refSchema) + else inlineRefSchema(refSchema) + } + + function callValidate(schema: AnySchemaObject): void { + const sch = compileSchema.call( + it.self, + new SchemaEnv({schema, root, schemaPath: `/definitions/${ref}`}) + ) + const v = getValidate(cxt, sch) + const errsCount = gen.const("_errs", N.errors) + callRef(cxt, v, sch, sch.$async) + gen.assign(valid, _`${errsCount} === ${N.errors}`) + } + + function inlineRefSchema(schema: AnySchemaObject): void { + const schName = gen.scopeValue( + "schema", + it.opts.code.source === true ? {ref: schema, code: stringify(schema)} : {ref: schema} + ) + cxt.subschema( + { + schema, + dataTypes: [], + schemaPath: nil, + topSchemaRef: schName, + errSchemaPath: `/definitions/${ref}`, + }, + valid + ) + } + }, +} + +export function hasRef(schema: AnySchemaObject): boolean { + for (const key in schema) { + let sch: AnySchemaObject + if (key === "ref" || (typeof (sch = schema[key]) == "object" && hasRef(sch))) return true + } + return false +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/type.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/type.ts new file mode 100644 index 000000000..17274300b --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/type.ts @@ -0,0 +1,75 @@ +import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, nil, or, Code} from "../../compile/codegen" +import validTimestamp from "../../runtime/timestamp" +import {useFunc} from "../../compile/util" +import {checkMetadata} from "./metadata" +import {typeErrorMessage, typeErrorParams, _JTDTypeError} from "./error" + +export type JTDTypeError = _JTDTypeError<"type", JTDType, JTDType> + +export type IntType = "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32" + +export const intRange: {[T in IntType]: [number, number, number]} = { + int8: [-128, 127, 3], + uint8: [0, 255, 3], + int16: [-32768, 32767, 5], + uint16: [0, 65535, 5], + int32: [-2147483648, 2147483647, 10], + uint32: [0, 4294967295, 10], +} + +export type JTDType = "boolean" | "string" | "timestamp" | "float32" | "float64" | IntType + +const error: KeywordErrorDefinition = { + message: (cxt) => typeErrorMessage(cxt, cxt.schema), + params: (cxt) => typeErrorParams(cxt, cxt.schema), +} + +function timestampCode(cxt: KeywordCxt): Code { + const {gen, data, it} = cxt + const {timestamp, allowDate} = it.opts + if (timestamp === "date") return _`${data} instanceof Date ` + const vts = useFunc(gen, validTimestamp) + const allowDateArg = allowDate ? _`, true` : nil + const validString = _`typeof ${data} == "string" && ${vts}(${data}${allowDateArg})` + return timestamp === "string" ? validString : or(_`${data} instanceof Date`, validString) +} + +const def: CodeKeywordDefinition = { + keyword: "type", + schemaType: "string", + error, + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {data, schema, parentSchema, it} = cxt + let cond: Code + switch (schema) { + case "boolean": + case "string": + cond = _`typeof ${data} == ${schema}` + break + case "timestamp": { + cond = timestampCode(cxt) + break + } + case "float32": + case "float64": + cond = _`typeof ${data} == "number"` + break + default: { + const sch = schema as IntType + cond = _`typeof ${data} == "number" && isFinite(${data}) && !(${data} % 1)` + if (!it.opts.int32range && (sch === "int32" || sch === "uint32")) { + if (sch === "uint32") cond = _`${cond} && ${data} >= 0` + } else { + const [min, max] = intRange[sch] + cond = _`${cond} && ${data} >= ${min} && ${data} <= ${max}` + } + } + } + cxt.pass(parentSchema.nullable ? or(_`${data} === null`, cond) : cond) + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/union.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/union.ts new file mode 100644 index 000000000..588f07ab4 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/union.ts @@ -0,0 +1,12 @@ +import type {CodeKeywordDefinition} from "../../types" +import {validateUnion} from "../code" + +const def: CodeKeywordDefinition = { + keyword: "union", + schemaType: "array", + trackErrors: true, + code: validateUnion, + error: {message: "must match a schema in union"}, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/values.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/values.ts new file mode 100644 index 000000000..86091b8ce --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/jtd/values.ts @@ -0,0 +1,55 @@ +import type {CodeKeywordDefinition, SchemaObject} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {alwaysValidSchema, Type} from "../../compile/util" +import {not, Name} from "../../compile/codegen" +import {checkMetadata} from "./metadata" +import {checkNullableObject} from "./nullable" +import {typeError, _JTDTypeError} from "./error" + +export type JTDValuesError = _JTDTypeError<"values", "object", SchemaObject> + +const def: CodeKeywordDefinition = { + keyword: "values", + schemaType: "object", + error: typeError("object"), + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, data, schema, it} = cxt + if (alwaysValidSchema(it, schema)) return + const [valid, cond] = checkNullableObject(cxt, data) + gen.if(cond) + gen.assign(valid, validateMap()) + gen.elseIf(not(valid)) + cxt.error() + gen.endIf() + cxt.ok(valid) + + function validateMap(): Name | boolean { + const _valid = gen.name("valid") + if (it.allErrors) { + const validMap = gen.let("valid", true) + validateValues(() => gen.assign(validMap, false)) + return validMap + } + gen.var(_valid, true) + validateValues(() => gen.break()) + return _valid + + function validateValues(notValid: () => void): void { + gen.forIn("key", data, (key) => { + cxt.subschema( + { + keyword: "values", + dataProp: key, + dataPropType: Type.Str, + }, + _valid + ) + gen.if(not(_valid), notValid) + }) + } + } + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/metadata.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/metadata.ts new file mode 100644 index 000000000..b9d5af85f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/metadata.ts @@ -0,0 +1,17 @@ +import type {Vocabulary} from "../types" + +export const metadataVocabulary: Vocabulary = [ + "title", + "description", + "default", + "deprecated", + "readOnly", + "writeOnly", + "examples", +] + +export const contentVocabulary: Vocabulary = [ + "contentMediaType", + "contentEncoding", + "contentSchema", +] diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/next.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/next.ts new file mode 100644 index 000000000..1e987ad21 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/next.ts @@ -0,0 +1,8 @@ +import type {Vocabulary} from "../types" +import dependentRequired from "./validation/dependentRequired" +import dependentSchemas from "./applicator/dependentSchemas" +import limitContains from "./validation/limitContains" + +const next: Vocabulary = [dependentRequired, dependentSchemas, limitContains] + +export default next diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/unevaluated/index.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/unevaluated/index.ts new file mode 100644 index 000000000..f7f0815db --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/unevaluated/index.ts @@ -0,0 +1,7 @@ +import type {Vocabulary} from "../../types" +import unevaluatedProperties from "./unevaluatedProperties" +import unevaluatedItems from "./unevaluatedItems" + +const unevaluated: Vocabulary = [unevaluatedProperties, unevaluatedItems] + +export default unevaluated diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts new file mode 100644 index 000000000..50bf0e7c1 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts @@ -0,0 +1,47 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, not, Name} from "../../compile/codegen" +import {alwaysValidSchema, Type} from "../../compile/util" + +export type UnevaluatedItemsError = ErrorObject<"unevaluatedItems", {limit: number}, AnySchema> + +const error: KeywordErrorDefinition = { + message: ({params: {len}}) => str`must NOT have more than ${len} items`, + params: ({params: {len}}) => _`{limit: ${len}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "unevaluatedItems", + type: "array", + schemaType: ["boolean", "object"], + error, + code(cxt: KeywordCxt) { + const {gen, schema, data, it} = cxt + const items = it.items || 0 + if (items === true) return + const len = gen.const("len", _`${data}.length`) + if (schema === false) { + cxt.setParams({len: items}) + cxt.fail(_`${len} > ${items}`) + } else if (typeof schema == "object" && !alwaysValidSchema(it, schema)) { + const valid = gen.var("valid", _`${len} <= ${items}`) + gen.if(not(valid), () => validateItems(valid, items)) + cxt.ok(valid) + } + it.items = true + + function validateItems(valid: Name, from: Name | number): void { + gen.forRange("i", from, len, (i) => { + cxt.subschema({keyword: "unevaluatedItems", dataProp: i, dataPropType: Type.Num}, valid) + if (!it.allErrors) gen.if(not(valid), () => gen.break()) + }) + } + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts new file mode 100644 index 000000000..0e6868fa3 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts @@ -0,0 +1,85 @@ +import type { + CodeKeywordDefinition, + KeywordErrorDefinition, + ErrorObject, + AnySchema, +} from "../../types" +import {_, not, and, Name, Code} from "../../compile/codegen" +import {alwaysValidSchema, Type} from "../../compile/util" +import N from "../../compile/names" + +export type UnevaluatedPropertiesError = ErrorObject< + "unevaluatedProperties", + {unevaluatedProperty: string}, + AnySchema +> + +const error: KeywordErrorDefinition = { + message: "must NOT have unevaluated properties", + params: ({params}) => _`{unevaluatedProperty: ${params.unevaluatedProperty}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "unevaluatedProperties", + type: "object", + schemaType: ["boolean", "object"], + trackErrors: true, + error, + code(cxt) { + const {gen, schema, data, errsCount, it} = cxt + /* istanbul ignore if */ + if (!errsCount) throw new Error("ajv implementation error") + const {allErrors, props} = it + if (props instanceof Name) { + gen.if(_`${props} !== true`, () => + gen.forIn("key", data, (key: Name) => + gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key)) + ) + ) + } else if (props !== true) { + gen.forIn("key", data, (key: Name) => + props === undefined + ? unevaluatedPropCode(key) + : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key)) + ) + } + it.props = true + cxt.ok(_`${errsCount} === ${N.errors}`) + + function unevaluatedPropCode(key: Name): void { + if (schema === false) { + cxt.setParams({unevaluatedProperty: key}) + cxt.error() + if (!allErrors) gen.break() + return + } + + if (!alwaysValidSchema(it, schema)) { + const valid = gen.name("valid") + cxt.subschema( + { + keyword: "unevaluatedProperties", + dataProp: key, + dataPropType: Type.Str, + }, + valid + ) + if (!allErrors) gen.if(not(valid), () => gen.break()) + } + } + + function unevaluatedDynamic(evaluatedProps: Name, key: Name): Code { + return _`!${evaluatedProps} || !${evaluatedProps}[${key}]` + } + + function unevaluatedStatic(evaluatedProps: {[K in string]?: true}, key: Name): Code { + const ps: Code[] = [] + for (const p in evaluatedProps) { + if (evaluatedProps[p] === true) ps.push(_`${key} !== ${p}`) + } + return and(...ps) + } + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/const.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/const.ts new file mode 100644 index 000000000..a3b94a5dc --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/const.ts @@ -0,0 +1,28 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_} from "../../compile/codegen" +import {useFunc} from "../../compile/util" +import equal from "../../runtime/equal" + +export type ConstError = ErrorObject<"const", {allowedValue: any}> + +const error: KeywordErrorDefinition = { + message: "must be equal to constant", + params: ({schemaCode}) => _`{allowedValue: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "const", + $data: true, + error, + code(cxt: KeywordCxt) { + const {gen, data, $data, schemaCode, schema} = cxt + if ($data || (schema && typeof schema == "object")) { + cxt.fail$data(_`!${useFunc(gen, equal)}(${data}, ${schemaCode})`) + } else { + cxt.fail(_`${schema} !== ${data}`) + } + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts new file mode 100644 index 000000000..4c616cfa9 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts @@ -0,0 +1,23 @@ +import type {CodeKeywordDefinition, ErrorObject} from "../../types" +import { + validatePropertyDeps, + error, + DependenciesErrorParams, + PropertyDependencies, +} from "../applicator/dependencies" + +export type DependentRequiredError = ErrorObject< + "dependentRequired", + DependenciesErrorParams, + PropertyDependencies +> + +const def: CodeKeywordDefinition = { + keyword: "dependentRequired", + type: "object", + schemaType: "object", + error, + code: (cxt) => validatePropertyDeps(cxt), +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/enum.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/enum.ts new file mode 100644 index 000000000..76377fb02 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/enum.ts @@ -0,0 +1,54 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, or, Name, Code} from "../../compile/codegen" +import {useFunc} from "../../compile/util" +import equal from "../../runtime/equal" + +export type EnumError = ErrorObject<"enum", {allowedValues: any[]}, any[] | {$data: string}> + +const error: KeywordErrorDefinition = { + message: "must be equal to one of the allowed values", + params: ({schemaCode}) => _`{allowedValues: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "enum", + schemaType: "array", + $data: true, + error, + code(cxt: KeywordCxt) { + const {gen, data, $data, schema, schemaCode, it} = cxt + if (!$data && schema.length === 0) throw new Error("enum must have non-empty array") + const useLoop = schema.length >= it.opts.loopEnum + let eql: Name | undefined + const getEql = (): Name => (eql ??= useFunc(gen, equal)) + + let valid: Code + if (useLoop || $data) { + valid = gen.let("valid") + cxt.block$data(valid, loopEnum) + } else { + /* istanbul ignore if */ + if (!Array.isArray(schema)) throw new Error("ajv implementation error") + const vSchema = gen.const("vSchema", schemaCode) + valid = or(...schema.map((_x: unknown, i: number) => equalCode(vSchema, i))) + } + cxt.pass(valid) + + function loopEnum(): void { + gen.assign(valid, false) + gen.forOf("v", schemaCode as Code, (v) => + gen.if(_`${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break()) + ) + } + + function equalCode(vSchema: Name, i: number): Code { + const sch = schema[i] + return typeof sch === "object" && sch !== null + ? _`${getEql()}(${data}, ${vSchema}[${i}])` + : _`${data} === ${sch}` + } + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/index.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/index.ts new file mode 100644 index 000000000..3531b1962 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/index.ts @@ -0,0 +1,49 @@ +import type {ErrorObject, Vocabulary} from "../../types" +import limitNumber, {LimitNumberError} from "./limitNumber" +import multipleOf, {MultipleOfError} from "./multipleOf" +import limitLength from "./limitLength" +import pattern, {PatternError} from "./pattern" +import limitProperties from "./limitProperties" +import required, {RequiredError} from "./required" +import limitItems from "./limitItems" +import uniqueItems, {UniqueItemsError} from "./uniqueItems" +import constKeyword, {ConstError} from "./const" +import enumKeyword, {EnumError} from "./enum" + +const validation: Vocabulary = [ + // number + limitNumber, + multipleOf, + // string + limitLength, + pattern, + // object + limitProperties, + required, + // array + limitItems, + uniqueItems, + // any + {keyword: "type", schemaType: ["string", "array"]}, + {keyword: "nullable", schemaType: "boolean"}, + constKeyword, + enumKeyword, +] + +export default validation + +type LimitError = ErrorObject< + "maxItems" | "minItems" | "minProperties" | "maxProperties" | "minLength" | "maxLength", + {limit: number}, + number | {$data: string} +> + +export type ValidationKeywordError = + | LimitError + | LimitNumberError + | MultipleOfError + | PatternError + | RequiredError + | UniqueItemsError + | ConstError + | EnumError diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/limitContains.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/limitContains.ts new file mode 100644 index 000000000..8bb43c1a4 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/limitContains.ts @@ -0,0 +1,16 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {checkStrictMode} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: ["maxContains", "minContains"], + type: "array", + schemaType: "number", + code({keyword, parentSchema, it}: KeywordCxt) { + if (parentSchema.contains === undefined) { + checkStrictMode(it, `"${keyword}" without "contains" is ignored`) + } + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/limitItems.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/limitItems.ts new file mode 100644 index 000000000..566de8588 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/limitItems.ts @@ -0,0 +1,26 @@ +import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, operators} from "../../compile/codegen" + +const error: KeywordErrorDefinition = { + message({keyword, schemaCode}) { + const comp = keyword === "maxItems" ? "more" : "fewer" + return str`must NOT have ${comp} than ${schemaCode} items` + }, + params: ({schemaCode}) => _`{limit: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: ["maxItems", "minItems"], + type: "array", + schemaType: "number", + $data: true, + error, + code(cxt: KeywordCxt) { + const {keyword, data, schemaCode} = cxt + const op = keyword === "maxItems" ? operators.GT : operators.LT + cxt.fail$data(_`${data}.length ${op} ${schemaCode}`) + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/limitLength.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/limitLength.ts new file mode 100644 index 000000000..f4f947259 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/limitLength.ts @@ -0,0 +1,30 @@ +import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, operators} from "../../compile/codegen" +import {useFunc} from "../../compile/util" +import ucs2length from "../../runtime/ucs2length" + +const error: KeywordErrorDefinition = { + message({keyword, schemaCode}) { + const comp = keyword === "maxLength" ? "more" : "fewer" + return str`must NOT have ${comp} than ${schemaCode} characters` + }, + params: ({schemaCode}) => _`{limit: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: ["maxLength", "minLength"], + type: "string", + schemaType: "number", + $data: true, + error, + code(cxt: KeywordCxt) { + const {keyword, data, schemaCode, it} = cxt + const op = keyword === "maxLength" ? operators.GT : operators.LT + const len = + it.opts.unicode === false ? _`${data}.length` : _`${useFunc(cxt.gen, ucs2length)}(${data})` + cxt.fail$data(_`${len} ${op} ${schemaCode}`) + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts new file mode 100644 index 000000000..5499202ef --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts @@ -0,0 +1,42 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, operators, Code} from "../../compile/codegen" + +const ops = operators + +type Kwd = "maximum" | "minimum" | "exclusiveMaximum" | "exclusiveMinimum" + +type Comparison = "<=" | ">=" | "<" | ">" + +const KWDs: {[K in Kwd]: {okStr: Comparison; ok: Code; fail: Code}} = { + maximum: {okStr: "<=", ok: ops.LTE, fail: ops.GT}, + minimum: {okStr: ">=", ok: ops.GTE, fail: ops.LT}, + exclusiveMaximum: {okStr: "<", ok: ops.LT, fail: ops.GTE}, + exclusiveMinimum: {okStr: ">", ok: ops.GT, fail: ops.LTE}, +} + +export type LimitNumberError = ErrorObject< + Kwd, + {limit: number; comparison: Comparison}, + number | {$data: string} +> + +const error: KeywordErrorDefinition = { + message: ({keyword, schemaCode}) => str`must be ${KWDs[keyword as Kwd].okStr} ${schemaCode}`, + params: ({keyword, schemaCode}) => + _`{comparison: ${KWDs[keyword as Kwd].okStr}, limit: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: Object.keys(KWDs), + type: "number", + schemaType: "number", + $data: true, + error, + code(cxt: KeywordCxt) { + const {keyword, data, schemaCode} = cxt + cxt.fail$data(_`${data} ${KWDs[keyword as Kwd].fail} ${schemaCode} || isNaN(${data})`) + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts new file mode 100644 index 000000000..07fffa8b3 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts @@ -0,0 +1,26 @@ +import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, operators} from "../../compile/codegen" + +const error: KeywordErrorDefinition = { + message({keyword, schemaCode}) { + const comp = keyword === "maxProperties" ? "more" : "fewer" + return str`must NOT have ${comp} than ${schemaCode} properties` + }, + params: ({schemaCode}) => _`{limit: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: ["maxProperties", "minProperties"], + type: "object", + schemaType: "number", + $data: true, + error, + code(cxt: KeywordCxt) { + const {keyword, data, schemaCode} = cxt + const op = keyword === "maxProperties" ? operators.GT : operators.LT + cxt.fail$data(_`Object.keys(${data}).length ${op} ${schemaCode}`) + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts new file mode 100644 index 000000000..1fd79abbd --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts @@ -0,0 +1,34 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str} from "../../compile/codegen" + +export type MultipleOfError = ErrorObject< + "multipleOf", + {multipleOf: number}, + number | {$data: string} +> + +const error: KeywordErrorDefinition = { + message: ({schemaCode}) => str`must be multiple of ${schemaCode}`, + params: ({schemaCode}) => _`{multipleOf: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "multipleOf", + type: "number", + schemaType: "number", + $data: true, + error, + code(cxt: KeywordCxt) { + const {gen, data, schemaCode, it} = cxt + // const bdt = bad$DataType(schemaCode, def.schemaType, $data) + const prec = it.opts.multipleOfPrecision + const res = gen.let("res") + const invalid = prec + ? _`Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` + : _`${res} !== parseInt(${res})` + cxt.fail$data(_`(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid}))`) + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/pattern.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/pattern.ts new file mode 100644 index 000000000..7b27b7d3c --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/pattern.ts @@ -0,0 +1,28 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {usePattern} from "../code" +import {_, str} from "../../compile/codegen" + +export type PatternError = ErrorObject<"pattern", {pattern: string}, string | {$data: string}> + +const error: KeywordErrorDefinition = { + message: ({schemaCode}) => str`must match pattern "${schemaCode}"`, + params: ({schemaCode}) => _`{pattern: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "pattern", + type: "string", + schemaType: "string", + $data: true, + error, + code(cxt: KeywordCxt) { + const {data, $data, schema, schemaCode, it} = cxt + // TODO regexp should be wrapped in try/catchs + const u = it.opts.unicodeRegExp ? "u" : "" + const regExp = $data ? _`(new RegExp(${schemaCode}, ${u}))` : usePattern(cxt, schema) + cxt.fail$data(_`!${regExp}.test(${data})`) + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/required.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/required.ts new file mode 100644 index 000000000..fea7367ed --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/required.ts @@ -0,0 +1,98 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import { + checkReportMissingProp, + checkMissingProp, + reportMissingProp, + propertyInData, + noPropertyInData, +} from "../code" +import {_, str, nil, not, Name, Code} from "../../compile/codegen" +import {checkStrictMode} from "../../compile/util" + +export type RequiredError = ErrorObject< + "required", + {missingProperty: string}, + string[] | {$data: string} +> + +const error: KeywordErrorDefinition = { + message: ({params: {missingProperty}}) => str`must have required property '${missingProperty}'`, + params: ({params: {missingProperty}}) => _`{missingProperty: ${missingProperty}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "required", + type: "object", + schemaType: "array", + $data: true, + error, + code(cxt: KeywordCxt) { + const {gen, schema, schemaCode, data, $data, it} = cxt + const {opts} = it + if (!$data && schema.length === 0) return + const useLoop = schema.length >= opts.loopRequired + if (it.allErrors) allErrorsMode() + else exitOnErrorMode() + + if (opts.strictRequired) { + const props = cxt.parentSchema.properties + const {definedProperties} = cxt.it + for (const requiredKey of schema) { + if (props?.[requiredKey] === undefined && !definedProperties.has(requiredKey)) { + const schemaPath = it.schemaEnv.baseId + it.errSchemaPath + const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)` + checkStrictMode(it, msg, it.opts.strictRequired) + } + } + } + + function allErrorsMode(): void { + if (useLoop || $data) { + cxt.block$data(nil, loopAllRequired) + } else { + for (const prop of schema) { + checkReportMissingProp(cxt, prop) + } + } + } + + function exitOnErrorMode(): void { + const missing = gen.let("missing") + if (useLoop || $data) { + const valid = gen.let("valid", true) + cxt.block$data(valid, () => loopUntilMissing(missing, valid)) + cxt.ok(valid) + } else { + gen.if(checkMissingProp(cxt, schema, missing)) + reportMissingProp(cxt, missing) + gen.else() + } + } + + function loopAllRequired(): void { + gen.forOf("prop", schemaCode as Code, (prop) => { + cxt.setParams({missingProperty: prop}) + gen.if(noPropertyInData(gen, data, prop, opts.ownProperties), () => cxt.error()) + }) + } + + function loopUntilMissing(missing: Name, valid: Name): void { + cxt.setParams({missingProperty: missing}) + gen.forOf( + missing, + schemaCode as Code, + () => { + gen.assign(valid, propertyInData(gen, data, missing, opts.ownProperties)) + gen.if(not(valid), () => { + cxt.error() + gen.break() + }) + }, + nil + ) + } + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts new file mode 100644 index 000000000..765c4d04f --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts @@ -0,0 +1,79 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {checkDataTypes, getSchemaTypes, DataType} from "../../compile/validate/dataType" +import {_, str, Name} from "../../compile/codegen" +import {useFunc} from "../../compile/util" +import equal from "../../runtime/equal" + +export type UniqueItemsError = ErrorObject< + "uniqueItems", + {i: number; j: number}, + boolean | {$data: string} +> + +const error: KeywordErrorDefinition = { + message: ({params: {i, j}}) => + str`must NOT have duplicate items (items ## ${j} and ${i} are identical)`, + params: ({params: {i, j}}) => _`{i: ${i}, j: ${j}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "uniqueItems", + type: "array", + schemaType: "boolean", + $data: true, + error, + code(cxt: KeywordCxt) { + const {gen, data, $data, schema, parentSchema, schemaCode, it} = cxt + if (!$data && !schema) return + const valid = gen.let("valid") + const itemTypes = parentSchema.items ? getSchemaTypes(parentSchema.items) : [] + cxt.block$data(valid, validateUniqueItems, _`${schemaCode} === false`) + cxt.ok(valid) + + function validateUniqueItems(): void { + const i = gen.let("i", _`${data}.length`) + const j = gen.let("j") + cxt.setParams({i, j}) + gen.assign(valid, true) + gen.if(_`${i} > 1`, () => (canOptimize() ? loopN : loopN2)(i, j)) + } + + function canOptimize(): boolean { + return itemTypes.length > 0 && !itemTypes.some((t) => t === "object" || t === "array") + } + + function loopN(i: Name, j: Name): void { + const item = gen.name("item") + const wrongType = checkDataTypes(itemTypes, item, it.opts.strictNumbers, DataType.Wrong) + const indices = gen.const("indices", _`{}`) + gen.for(_`;${i}--;`, () => { + gen.let(item, _`${data}[${i}]`) + gen.if(wrongType, _`continue`) + if (itemTypes.length > 1) gen.if(_`typeof ${item} == "string"`, _`${item} += "_"`) + gen + .if(_`typeof ${indices}[${item}] == "number"`, () => { + gen.assign(j, _`${indices}[${item}]`) + cxt.error() + gen.assign(valid, false).break() + }) + .code(_`${indices}[${item}] = ${i}`) + }) + } + + function loopN2(i: Name, j: Name): void { + const eql = useFunc(gen, equal) + const outer = gen.name("outer") + gen.label(outer).for(_`;${i}--;`, () => + gen.for(_`${j} = ${i}; ${j}--;`, () => + gen.if(_`${eql}(${data}[${i}], ${data}[${j}])`, () => { + cxt.error() + gen.assign(valid, false).break(outer) + }) + ) + ) + } + }, +} + +export default def diff --git a/node_modules/ajv-formats/node_modules/ajv/package.json b/node_modules/ajv-formats/node_modules/ajv/package.json new file mode 100644 index 000000000..c277d94d6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/ajv/package.json @@ -0,0 +1,126 @@ +{ + "name": "ajv", + "version": "8.11.0", + "description": "Another JSON Schema Validator", + "main": "dist/ajv.js", + "types": "dist/ajv.d.ts", + "files": [ + "lib/", + "dist/", + ".runkit_example.js" + ], + "scripts": { + "eslint": "eslint \"lib/**/*.ts\" \"spec/**/*.*s\" --ignore-pattern spec/JSON-Schema-Test-Suite", + "prettier:write": "prettier --write \"./**/*.{json,yaml,js,ts}\"", + "prettier:check": "prettier --list-different \"./**/*.{json,yaml,js,ts}\"", + "test-spec": "cross-env TS_NODE_PROJECT=spec/tsconfig.json mocha -r ts-node/register \"spec/**/*.spec.{ts,js}\" -R dot", + "test-codegen": "nyc cross-env TS_NODE_PROJECT=spec/tsconfig.json mocha -r ts-node/register 'spec/codegen.spec.ts' -R spec", + "test-debug": "npm run test-spec -- --inspect-brk", + "test-cov": "nyc npm run test-spec", + "rollup": "rm -rf bundle && rollup -c", + "bundle": "rm -rf bundle && node ./scripts/bundle.js ajv ajv7 ajv7 && node ./scripts/bundle.js 2019 ajv2019 ajv2019 && node ./scripts/bundle.js 2020 ajv2020 ajv2020 && node ./scripts/bundle.js jtd ajvJTD ajvJTD", + "build": "rm -rf dist && tsc && cp -r lib/refs dist && rm dist/refs/json-schema-2019-09/index.ts && rm dist/refs/json-schema-2020-12/index.ts && rm dist/refs/jtd-schema.ts", + "json-tests": "rm -rf spec/_json/*.js && node scripts/jsontests", + "test-karma": "karma start", + "test-browser": "rm -rf .browser && npm run bundle && scripts/prepare-tests && karma start", + "test-all": "npm run test-cov && if-node-version 12 npm run test-browser", + "test": "npm run json-tests && npm run prettier:check && npm run eslint && npm link && npm link --legacy-peer-deps ajv && npm run test-cov", + "test-ci": "AJV_FULL_TEST=true npm test", + "prepublish": "npm run build", + "benchmark": "npm i && npm run build && npm link && cd ./benchmark && npm link --legacy-peer-deps ajv && npm i && node ./jtd", + "docs:dev": "./scripts/prepare-site && vuepress dev docs", + "docs:build": "./scripts/prepare-site && vuepress build docs" + }, + "nyc": { + "exclude": [ + "**/spec/**", + "node_modules" + ], + "reporter": [ + "lcov", + "text-summary" + ] + }, + "repository": "ajv-validator/ajv", + "keywords": [ + "JSON", + "schema", + "validator", + "validation", + "jsonschema", + "json-schema", + "json-schema-validator", + "json-schema-validation" + ], + "author": "Evgeny Poberezkin", + "license": "MIT", + "bugs": "https://github.com/ajv-validator/ajv/issues", + "homepage": "https://ajv.js.org", + "runkitExampleFilename": ".runkit_example.js", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "devDependencies": { + "@ajv-validator/config": "^0.3.0", + "@rollup/plugin-commonjs": "^21.0.0", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.0.0", + "@rollup/plugin-typescript": "^8.2.1", + "@types/chai": "^4.2.12", + "@types/mocha": "^9.0.0", + "@types/node": "^17.0.0", + "@types/require-from-string": "^1.2.0", + "@typescript-eslint/eslint-plugin": "^3.8.0", + "@typescript-eslint/parser": "^3.8.0", + "ajv-formats": "^3.0.0-rc.0", + "browserify": "^17.0.0", + "chai": "^4.0.1", + "cross-env": "^7.0.2", + "dayjs": "^1.10.4", + "dayjs-plugin-utc": "^0.1.2", + "eslint": "^7.8.1", + "eslint-config-prettier": "^7.0.0", + "fast-uri": "^1.0.0", + "glob": "^7.0.0", + "husky": "^7.0.1", + "if-node-version": "^1.0.0", + "jimp": "^0.16.1", + "js-beautify": "^1.7.3", + "json-schema-test": "^2.0.0", + "karma": "^6.0.0", + "karma-chrome-launcher": "^3.0.0", + "karma-mocha": "^2.0.0", + "lint-staged": "^12.1.1", + "mocha": "^9.0.2", + "module-from-string": "^3.1.3", + "node-fetch": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.3.1", + "re2": "^1.16.0", + "rollup": "^2.44.0", + "rollup-plugin-terser": "^7.0.2", + "ts-node": "^10.0.0", + "tsify": "^5.0.2", + "typescript": "^4.2.0" + }, + "collective": { + "type": "opencollective", + "url": "https://opencollective.com/ajv" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + }, + "prettier": "@ajv-validator/config/prettierrc.json", + "husky": { + "hooks": { + "pre-commit": "lint-staged && npm test" + } + }, + "lint-staged": { + "*.{json,yaml,js,ts}": "prettier --write" + } +} diff --git a/node_modules/ajv-formats/node_modules/json-schema-traverse/.eslintrc.yml b/node_modules/ajv-formats/node_modules/json-schema-traverse/.eslintrc.yml new file mode 100644 index 000000000..618559ab6 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/json-schema-traverse/.eslintrc.yml @@ -0,0 +1,27 @@ +extends: eslint:recommended +env: + node: true + browser: true +rules: + block-scoped-var: 2 + complexity: [2, 15] + curly: [2, multi-or-nest, consistent] + dot-location: [2, property] + dot-notation: 2 + indent: [2, 2, SwitchCase: 1] + linebreak-style: [2, unix] + new-cap: 2 + no-console: [2, allow: [warn, error]] + no-else-return: 2 + no-eq-null: 2 + no-fallthrough: 2 + no-invalid-this: 2 + no-return-assign: 2 + no-shadow: 1 + no-trailing-spaces: 2 + no-use-before-define: [2, nofunc] + quotes: [2, single, avoid-escape] + semi: [2, always] + strict: [2, global] + valid-jsdoc: [2, requireReturn: false] + no-control-regex: 0 diff --git a/node_modules/ajv-formats/node_modules/json-schema-traverse/.github/FUNDING.yml b/node_modules/ajv-formats/node_modules/json-schema-traverse/.github/FUNDING.yml new file mode 100644 index 000000000..44f80f417 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/json-schema-traverse/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: epoberezkin +tidelift: "npm/json-schema-traverse" diff --git a/node_modules/ajv-formats/node_modules/json-schema-traverse/.github/workflows/build.yml b/node_modules/ajv-formats/node_modules/json-schema-traverse/.github/workflows/build.yml new file mode 100644 index 000000000..f8ef5ba80 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/json-schema-traverse/.github/workflows/build.yml @@ -0,0 +1,28 @@ +name: build + +on: + push: + branches: [master] + pull_request: + branches: ["*"] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [10.x, 12.x, 14.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm test + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/node_modules/ajv-formats/node_modules/json-schema-traverse/.github/workflows/publish.yml b/node_modules/ajv-formats/node_modules/json-schema-traverse/.github/workflows/publish.yml new file mode 100644 index 000000000..924825b12 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/json-schema-traverse/.github/workflows/publish.yml @@ -0,0 +1,27 @@ +name: publish + +on: + release: + types: [published] + +jobs: + publish-npm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 14 + registry-url: https://registry.npmjs.org/ + - run: npm install + - run: npm test + - name: Publish beta version to npm + if: "github.event.release.prerelease" + run: npm publish --tag beta + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Publish to npm + if: "!github.event.release.prerelease" + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/node_modules/ajv-formats/node_modules/json-schema-traverse/LICENSE b/node_modules/ajv-formats/node_modules/json-schema-traverse/LICENSE new file mode 100644 index 000000000..7f1543566 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/json-schema-traverse/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/ajv-formats/node_modules/json-schema-traverse/README.md b/node_modules/ajv-formats/node_modules/json-schema-traverse/README.md new file mode 100644 index 000000000..f3e60073a --- /dev/null +++ b/node_modules/ajv-formats/node_modules/json-schema-traverse/README.md @@ -0,0 +1,95 @@ +# json-schema-traverse +Traverse JSON Schema passing each schema object to callback + +[![build](https://github.com/epoberezkin/json-schema-traverse/workflows/build/badge.svg)](https://github.com/epoberezkin/json-schema-traverse/actions?query=workflow%3Abuild) +[![npm](https://img.shields.io/npm/v/json-schema-traverse)](https://www.npmjs.com/package/json-schema-traverse) +[![coverage](https://coveralls.io/repos/github/epoberezkin/json-schema-traverse/badge.svg?branch=master)](https://coveralls.io/github/epoberezkin/json-schema-traverse?branch=master) + + +## Install + +``` +npm install json-schema-traverse +``` + + +## Usage + +```javascript +const traverse = require('json-schema-traverse'); +const schema = { + properties: { + foo: {type: 'string'}, + bar: {type: 'integer'} + } +}; + +traverse(schema, {cb}); +// cb is called 3 times with: +// 1. root schema +// 2. {type: 'string'} +// 3. {type: 'integer'} + +// Or: + +traverse(schema, {cb: {pre, post}}); +// pre is called 3 times with: +// 1. root schema +// 2. {type: 'string'} +// 3. {type: 'integer'} +// +// post is called 3 times with: +// 1. {type: 'string'} +// 2. {type: 'integer'} +// 3. root schema + +``` + +Callback function `cb` is called for each schema object (not including draft-06 boolean schemas), including the root schema, in pre-order traversal. Schema references ($ref) are not resolved, they are passed as is. Alternatively, you can pass a `{pre, post}` object as `cb`, and then `pre` will be called before traversing child elements, and `post` will be called after all child elements have been traversed. + +Callback is passed these parameters: + +- _schema_: the current schema object +- _JSON pointer_: from the root schema to the current schema object +- _root schema_: the schema passed to `traverse` object +- _parent JSON pointer_: from the root schema to the parent schema object (see below) +- _parent keyword_: the keyword inside which this schema appears (e.g. `properties`, `anyOf`, etc.) +- _parent schema_: not necessarily parent object/array; in the example above the parent schema for `{type: 'string'}` is the root schema +- _index/property_: index or property name in the array/object containing multiple schemas; in the example above for `{type: 'string'}` the property name is `'foo'` + + +## Traverse objects in all unknown keywords + +```javascript +const traverse = require('json-schema-traverse'); +const schema = { + mySchema: { + minimum: 1, + maximum: 2 + } +}; + +traverse(schema, {allKeys: true, cb}); +// cb is called 2 times with: +// 1. root schema +// 2. mySchema +``` + +Without option `allKeys: true` callback will be called only with root schema. + + +## Enterprise support + +json-schema-traverse package is a part of [Tidelift enterprise subscription](https://tidelift.com/subscription/pkg/npm-json-schema-traverse?utm_source=npm-json-schema-traverse&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - it provides a centralised commercial support to open-source software users, in addition to the support provided by software maintainers. + + +## Security contact + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerability via GitHub issues. + + +## License + +[MIT](https://github.com/epoberezkin/json-schema-traverse/blob/master/LICENSE) diff --git a/node_modules/ajv-formats/node_modules/json-schema-traverse/index.d.ts b/node_modules/ajv-formats/node_modules/json-schema-traverse/index.d.ts new file mode 100644 index 000000000..0772daedb --- /dev/null +++ b/node_modules/ajv-formats/node_modules/json-schema-traverse/index.d.ts @@ -0,0 +1,40 @@ +declare function traverse( + schema: traverse.SchemaObject, + opts: traverse.Options, + cb?: traverse.Callback +): void; + +declare function traverse( + schema: traverse.SchemaObject, + cb: traverse.Callback +): void; + +declare namespace traverse { + interface SchemaObject { + $id?: string; + $schema?: string; + [x: string]: any; + } + + type Callback = ( + schema: SchemaObject, + jsonPtr: string, + rootSchema: SchemaObject, + parentJsonPtr?: string, + parentKeyword?: string, + parentSchema?: SchemaObject, + keyIndex?: string | number + ) => void; + + interface Options { + allKeys?: boolean; + cb?: + | Callback + | { + pre?: Callback; + post?: Callback; + }; + } +} + +export = traverse; diff --git a/node_modules/ajv-formats/node_modules/json-schema-traverse/index.js b/node_modules/ajv-formats/node_modules/json-schema-traverse/index.js new file mode 100644 index 000000000..e521bfa85 --- /dev/null +++ b/node_modules/ajv-formats/node_modules/json-schema-traverse/index.js @@ -0,0 +1,93 @@ +'use strict'; + +var traverse = module.exports = function (schema, opts, cb) { + // Legacy support for v0.3.1 and earlier. + if (typeof opts == 'function') { + cb = opts; + opts = {}; + } + + cb = opts.cb || cb; + var pre = (typeof cb == 'function') ? cb : cb.pre || function() {}; + var post = cb.post || function() {}; + + _traverse(opts, pre, post, schema, '', schema); +}; + + +traverse.keywords = { + additionalItems: true, + items: true, + contains: true, + additionalProperties: true, + propertyNames: true, + not: true, + if: true, + then: true, + else: true +}; + +traverse.arrayKeywords = { + items: true, + allOf: true, + anyOf: true, + oneOf: true +}; + +traverse.propsKeywords = { + $defs: true, + definitions: true, + properties: true, + patternProperties: true, + dependencies: true +}; + +traverse.skipKeywords = { + default: true, + enum: true, + const: true, + required: true, + maximum: true, + minimum: true, + exclusiveMaximum: true, + exclusiveMinimum: true, + multipleOf: true, + maxLength: true, + minLength: true, + pattern: true, + format: true, + maxItems: true, + minItems: true, + uniqueItems: true, + maxProperties: true, + minProperties: true +}; + + +function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { + if (schema && typeof schema == 'object' && !Array.isArray(schema)) { + pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex); + for (var key in schema) { + var sch = schema[key]; + if (Array.isArray(sch)) { + if (key in traverse.arrayKeywords) { + for (var i=0; i, + compare: FormatCompare +): FormatDefinition { + return {validate, compare} +} + +export const fullFormats: DefinedFormats = { + // date: http://tools.ietf.org/html/rfc3339#section-5.6 + date: fmtDef(date, compareDate), + // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 + time: fmtDef(time, compareTime), + "date-time": fmtDef(date_time, compareDateTime), + // duration: https://tools.ietf.org/html/rfc3339#appendix-A + duration: /^P(?!$)((\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?|(\d+W)?)$/, + uri, + "uri-reference": + /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i, + // uri-template: https://tools.ietf.org/html/rfc6570 + "uri-template": + /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i, + // For the source: https://gist.github.com/dperini/729294 + // For test cases: https://mathiasbynens.be/demo/url-regex + url: /^(?:https?|ftp):\/\/(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)(?:\.(?:[a-z0-9\u{00a1}-\u{ffff}]+-)*[a-z0-9\u{00a1}-\u{ffff}]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu, + email: + /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, + hostname: + /^(?=.{1,253}\.?$)[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*\.?$/i, + // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html + ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, + ipv6: /^((([0-9a-f]{1,4}:){7}([0-9a-f]{1,4}|:))|(([0-9a-f]{1,4}:){6}(:[0-9a-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){5}(((:[0-9a-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9a-f]{1,4}:){4}(((:[0-9a-f]{1,4}){1,3})|((:[0-9a-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){3}(((:[0-9a-f]{1,4}){1,4})|((:[0-9a-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){2}(((:[0-9a-f]{1,4}){1,5})|((:[0-9a-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9a-f]{1,4}:){1}(((:[0-9a-f]{1,4}){1,6})|((:[0-9a-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9a-f]{1,4}){1,7})|((:[0-9a-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))$/i, + regex, + // uuid: http://tools.ietf.org/html/rfc4122 + uuid: /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i, + // JSON-pointer: https://tools.ietf.org/html/rfc6901 + // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A + "json-pointer": /^(?:\/(?:[^~/]|~0|~1)*)*$/, + "json-pointer-uri-fragment": /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i, + // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00 + "relative-json-pointer": /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/, + // the following formats are used by the openapi specification: https://spec.openapis.org/oas/v3.0.0#data-types + // byte: https://github.com/miguelmota/is-base64 + byte, + // signed 32 bit integer + int32: {type: "number", validate: validateInt32}, + // signed 64 bit integer + int64: {type: "number", validate: validateInt64}, + // C-type float + float: {type: "number", validate: validateNumber}, + // C-type double + double: {type: "number", validate: validateNumber}, + // hint to the UI to hide input strings + password: true, + // unchecked string payload + binary: true, +} + +export const fastFormats: DefinedFormats = { + ...fullFormats, + date: fmtDef(/^\d\d\d\d-[0-1]\d-[0-3]\d$/, compareDate), + time: fmtDef( + /^(?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)?$/i, + compareTime + ), + "date-time": fmtDef( + /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s](?:[0-2]\d:[0-5]\d:[0-5]\d|23:59:60)(?:\.\d+)?(?:z|[+-]\d\d(?::?\d\d)?)$/i, + compareDateTime + ), + // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js + uri: /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/)?[^\s]*$/i, + "uri-reference": /^(?:(?:[a-z][a-z0-9+\-.]*:)?\/?\/)?(?:[^\\\s#][^\s#]*)?(?:#[^\\\s]*)?$/i, + // email (sources from jsen validator): + // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363 + // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'wilful violation') + email: + /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i, +} + +export const formatNames = Object.keys(fullFormats) as FormatName[] + +function isLeapYear(year: number): boolean { + // https://tools.ietf.org/html/rfc3339#appendix-C + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0) +} + +const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/ +const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] + +function date(str: string): boolean { + // full-date from http://tools.ietf.org/html/rfc3339#section-5.6 + const matches: string[] | null = DATE.exec(str) + if (!matches) return false + const year: number = +matches[1] + const month: number = +matches[2] + const day: number = +matches[3] + return ( + month >= 1 && + month <= 12 && + day >= 1 && + day <= (month === 2 && isLeapYear(year) ? 29 : DAYS[month]) + ) +} + +function compareDate(d1: string, d2: string): number | undefined { + if (!(d1 && d2)) return undefined + if (d1 > d2) return 1 + if (d1 < d2) return -1 + return 0 +} + +const TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d(?::?\d\d)?)?$/i + +function time(str: string, withTimeZone?: boolean): boolean { + const matches: string[] | null = TIME.exec(str) + if (!matches) return false + + const hour: number = +matches[1] + const minute: number = +matches[2] + const second: number = +matches[3] + const timeZone: string = matches[5] + return ( + ((hour <= 23 && minute <= 59 && second <= 59) || + (hour === 23 && minute === 59 && second === 60)) && + (!withTimeZone || timeZone !== "") + ) +} + +function compareTime(t1: string, t2: string): number | undefined { + if (!(t1 && t2)) return undefined + const a1 = TIME.exec(t1) + const a2 = TIME.exec(t2) + if (!(a1 && a2)) return undefined + t1 = a1[1] + a1[2] + a1[3] + (a1[4] || "") + t2 = a2[1] + a2[2] + a2[3] + (a2[4] || "") + if (t1 > t2) return 1 + if (t1 < t2) return -1 + return 0 +} + +const DATE_TIME_SEPARATOR = /t|\s/i +function date_time(str: string): boolean { + // http://tools.ietf.org/html/rfc3339#section-5.6 + const dateTime: string[] = str.split(DATE_TIME_SEPARATOR) + return dateTime.length === 2 && date(dateTime[0]) && time(dateTime[1], true) +} + +function compareDateTime(dt1: string, dt2: string): number | undefined { + if (!(dt1 && dt2)) return undefined + const [d1, t1] = dt1.split(DATE_TIME_SEPARATOR) + const [d2, t2] = dt2.split(DATE_TIME_SEPARATOR) + const res = compareDate(d1, d2) + if (res === undefined) return undefined + return res || compareTime(t1, t2) +} + +const NOT_URI_FRAGMENT = /\/|:/ +const URI = + /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i + +function uri(str: string): boolean { + // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "." + return NOT_URI_FRAGMENT.test(str) && URI.test(str) +} + +const BYTE = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/gm + +function byte(str: string): boolean { + BYTE.lastIndex = 0 + return BYTE.test(str) +} + +const MIN_INT32 = -(2 ** 31) +const MAX_INT32 = 2 ** 31 - 1 + +function validateInt32(value: number): boolean { + return Number.isInteger(value) && value <= MAX_INT32 && value >= MIN_INT32 +} + +function validateInt64(value: number): boolean { + // JSON and javascript max Int is 2**53, so any int that passes isInteger is valid for Int64 + return Number.isInteger(value) +} + +function validateNumber(): boolean { + return true +} + +const Z_ANCHOR = /[^\\]\\Z/ +function regex(str: string): boolean { + if (Z_ANCHOR.test(str)) return false + try { + new RegExp(str) + return true + } catch (e) { + return false + } +} diff --git a/node_modules/ajv-formats/src/index.ts b/node_modules/ajv-formats/src/index.ts new file mode 100644 index 000000000..8fd944a09 --- /dev/null +++ b/node_modules/ajv-formats/src/index.ts @@ -0,0 +1,62 @@ +import { + DefinedFormats, + FormatMode, + FormatName, + formatNames, + fastFormats, + fullFormats, +} from "./formats" +import formatLimit from "./limit" +import type Ajv from "ajv" +import type {Plugin, Format} from "ajv" +import {_, Name} from "ajv/dist/compile/codegen" + +export {FormatMode, FormatName} from "./formats" +export {LimitFormatError} from "./limit" +export interface FormatOptions { + mode?: FormatMode + formats?: FormatName[] + keywords?: boolean +} + +export type FormatsPluginOptions = FormatName[] | FormatOptions + +export interface FormatsPlugin extends Plugin { + get: (format: FormatName, mode?: FormatMode) => Format +} + +const fullName = new Name("fullFormats") +const fastName = new Name("fastFormats") + +const formatsPlugin: FormatsPlugin = ( + ajv: Ajv, + opts: FormatsPluginOptions = {keywords: true} +): Ajv => { + if (Array.isArray(opts)) { + addFormats(ajv, opts, fullFormats, fullName) + return ajv + } + const [formats, exportName] = + opts.mode === "fast" ? [fastFormats, fastName] : [fullFormats, fullName] + const list = opts.formats || formatNames + addFormats(ajv, list, formats, exportName) + if (opts.keywords) formatLimit(ajv) + return ajv +} + +formatsPlugin.get = (name: FormatName, mode: FormatMode = "full"): Format => { + const formats = mode === "fast" ? fastFormats : fullFormats + const f = formats[name] + if (!f) throw new Error(`Unknown format "${name}"`) + return f +} + +function addFormats(ajv: Ajv, list: FormatName[], fs: DefinedFormats, exportName: Name): void { + ajv.opts.code.formats ??= _`require("ajv-formats/dist/formats").${exportName}` + for (const f of list) ajv.addFormat(f, fs[f]) +} + +module.exports = exports = formatsPlugin +Object.defineProperty(exports, "__esModule", {value: true}) + +export default formatsPlugin diff --git a/node_modules/ajv-formats/src/limit.ts b/node_modules/ajv-formats/src/limit.ts new file mode 100644 index 000000000..bf6a57cb9 --- /dev/null +++ b/node_modules/ajv-formats/src/limit.ts @@ -0,0 +1,99 @@ +import type Ajv from "ajv" +import type { + Plugin, + CodeKeywordDefinition, + KeywordErrorDefinition, + Code, + Name, + ErrorObject, +} from "ajv" +import type {AddedFormat} from "ajv/dist/types" +import type {Rule} from "ajv/dist/compile/rules" +import {KeywordCxt} from "ajv" +import {_, str, or, getProperty, operators} from "ajv/dist/compile/codegen" + +type Kwd = "formatMaximum" | "formatMinimum" | "formatExclusiveMaximum" | "formatExclusiveMinimum" + +type Comparison = "<=" | ">=" | "<" | ">" + +const ops = operators + +const KWDs: {[K in Kwd]: {okStr: Comparison; ok: Code; fail: Code}} = { + formatMaximum: {okStr: "<=", ok: ops.LTE, fail: ops.GT}, + formatMinimum: {okStr: ">=", ok: ops.GTE, fail: ops.LT}, + formatExclusiveMaximum: {okStr: "<", ok: ops.LT, fail: ops.GTE}, + formatExclusiveMinimum: {okStr: ">", ok: ops.GT, fail: ops.LTE}, +} + +export type LimitFormatError = ErrorObject + +const error: KeywordErrorDefinition = { + message: ({keyword, schemaCode}) => str`should be ${KWDs[keyword as Kwd].okStr} ${schemaCode}`, + params: ({keyword, schemaCode}) => + _`{comparison: ${KWDs[keyword as Kwd].okStr}, limit: ${schemaCode}}`, +} + +export const formatLimitDefinition: CodeKeywordDefinition = { + keyword: Object.keys(KWDs), + type: "string", + schemaType: "string", + $data: true, + error, + code(cxt) { + const {gen, data, schemaCode, keyword, it} = cxt + const {opts, self} = it + if (!opts.validateFormats) return + + const fCxt = new KeywordCxt(it, (self.RULES.all.format as Rule).definition, "format") + if (fCxt.$data) validate$DataFormat() + else validateFormat() + + function validate$DataFormat(): void { + const fmts = gen.scopeValue("formats", { + ref: self.formats, + code: opts.code.formats, + }) + const fmt = gen.const("fmt", _`${fmts}[${fCxt.schemaCode}]`) + cxt.fail$data( + or( + _`typeof ${fmt} != "object"`, + _`${fmt} instanceof RegExp`, + _`typeof ${fmt}.compare != "function"`, + compareCode(fmt) + ) + ) + } + + function validateFormat(): void { + const format = fCxt.schema as string + const fmtDef: AddedFormat | undefined = self.formats[format] + if (!fmtDef || fmtDef === true) return + if ( + typeof fmtDef != "object" || + fmtDef instanceof RegExp || + typeof fmtDef.compare != "function" + ) { + throw new Error(`"${keyword}": format "${format}" does not define "compare" function`) + } + const fmt = gen.scopeValue("formats", { + key: format, + ref: fmtDef, + code: opts.code.formats ? _`${opts.code.formats}${getProperty(format)}` : undefined, + }) + + cxt.fail$data(compareCode(fmt)) + } + + function compareCode(fmt: Name): Code { + return _`${fmt}.compare(${data}, ${schemaCode}) ${KWDs[keyword as Kwd].fail} 0` + } + }, + dependencies: ["format"], +} + +const formatLimitPlugin: Plugin = (ajv: Ajv): Ajv => { + ajv.addKeyword(formatLimitDefinition) + return ajv +} + +export default formatLimitPlugin diff --git a/node_modules/array-union/index.d.ts b/node_modules/array-union/index.d.ts deleted file mode 100644 index 379fc1d2f..000000000 --- a/node_modules/array-union/index.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** -Create an array of unique values, in order, from the input arrays. - -@example -``` -import arrayUnion = require('array-union'); - -arrayUnion([1, 1, 2, 3], [2, 3]); -//=> [1, 2, 3] - -arrayUnion(['foo', 'foo', 'bar']); -//=> ['foo', 'bar'] - -arrayUnion(['🐱', '🦄', '🐻'], ['🦄', '🌈']); -//=> ['🐱', '🦄', '🐻', '🌈'] - -arrayUnion(['🐱', '🦄'], ['🐻', '🦄'], ['🐶', '🌈', '🌈']); -//=> ['🐱', '🦄', '🐻', '🐶', '🌈'] -``` -*/ -declare function arrayUnion( - ...arguments: readonly ArgumentsType[] -): ArgumentsType; - -export = arrayUnion; diff --git a/node_modules/array-union/index.js b/node_modules/array-union/index.js deleted file mode 100644 index 7f85d3d19..000000000 --- a/node_modules/array-union/index.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -module.exports = (...arguments_) => { - return [...new Set([].concat(...arguments_))]; -}; diff --git a/node_modules/array-union/package.json b/node_modules/array-union/package.json deleted file mode 100644 index 5ad5afa71..000000000 --- a/node_modules/array-union/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "array-union", - "version": "2.1.0", - "description": "Create an array of unique values, in order, from the input arrays", - "license": "MIT", - "repository": "sindresorhus/array-union", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "array", - "set", - "uniq", - "unique", - "duplicate", - "remove", - "union", - "combine", - "merge" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } -} diff --git a/node_modules/array-union/readme.md b/node_modules/array-union/readme.md deleted file mode 100644 index 2474a1aed..000000000 --- a/node_modules/array-union/readme.md +++ /dev/null @@ -1,34 +0,0 @@ -# array-union [![Build Status](https://travis-ci.org/sindresorhus/array-union.svg?branch=master)](https://travis-ci.org/sindresorhus/array-union) - -> Create an array of unique values, in order, from the input arrays - - -## Install - -``` -$ npm install array-union -``` - - -## Usage - -```js -const arrayUnion = require('array-union'); - -arrayUnion([1, 1, 2, 3], [2, 3]); -//=> [1, 2, 3] - -arrayUnion(['foo', 'foo', 'bar']); -//=> ['foo', 'bar'] - -arrayUnion(['🐱', '🦄', '🐻'], ['🦄', '🌈']); -//=> ['🐱', '🦄', '🐻', '🌈'] - -arrayUnion(['🐱', '🦄'], ['🐻', '🦄'], ['🐶', '🌈', '🌈']); -//=> ['🐱', '🦄', '🐻', '🐶', '🌈'] -``` - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/babel-loader/README.md b/node_modules/babel-loader/README.md index 33ebb7e61..975c52748 100644 --- a/node_modules/babel-loader/README.md +++ b/node_modules/babel-loader/README.md @@ -1,4 +1,4 @@ -> This README is for babel-loader v8 + Babel v7 +> This README is for babel-loader v8/v9 with Babel v7 > If you are using legacy Babel v6, see the [7.x branch](https://github.com/babel/babel-loader/tree/7.x) docs [![NPM Status](https://img.shields.io/npm/v/babel-loader.svg?style=flat)](https://www.npmjs.com/package/babel-loader) @@ -21,7 +21,11 @@ This package allows transpiling JavaScript files using [Babel](https://github.co

Install

-> webpack `4.x || 5.x` | babel-loader 8.x | babel 7.x +> | babel-loader | supported webpack versions | supported Babel versions | supported Node.js versions | +> |:-:|:-:|:-:|:-:| +> | 8.x | 4.x or 5.x | 7.x | >= 8.9 | +> | 9.x | 5.x | ^7.12.0 | >= 14.15.0 | + ```bash npm install -D babel-loader @babel/core @babel/preset-env webpack diff --git a/node_modules/babel-loader/lib/Error.js b/node_modules/babel-loader/lib/Error.js index 02b3fbc40..be6e1266c 100644 --- a/node_modules/babel-loader/lib/Error.js +++ b/node_modules/babel-loader/lib/Error.js @@ -1,7 +1,6 @@ "use strict"; const STRIP_FILENAME_RE = /^[^:]+: /; - const format = err => { if (err instanceof SyntaxError) { err.name = "SyntaxError"; @@ -12,10 +11,8 @@ const format = err => { err.message = err.message.replace(STRIP_FILENAME_RE, ""); err.hideStack = true; } - return err; }; - class LoaderError extends Error { constructor(err) { super(); @@ -30,7 +27,5 @@ class LoaderError extends Error { this.hideStack = hideStack; Error.captureStackTrace(this, this.constructor); } - } - module.exports = LoaderError; \ No newline at end of file diff --git a/node_modules/babel-loader/lib/cache.js b/node_modules/babel-loader/lib/cache.js index 92958ba5d..4d94b0484 100644 --- a/node_modules/babel-loader/lib/cache.js +++ b/node_modules/babel-loader/lib/cache.js @@ -1,9 +1,5 @@ "use strict"; -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - /** * Filesystem Cache * @@ -13,40 +9,32 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar * @see https://github.com/babel/babel-loader/issues/34 * @see https://github.com/babel/babel-loader/pull/41 */ -const fs = require("fs"); - const os = require("os"); - const path = require("path"); - const zlib = require("zlib"); - const crypto = require("crypto"); - const findCacheDir = require("find-cache-dir"); - const { promisify } = require("util"); - -const transform = require("./transform"); // Lazily instantiated when needed - - +const { + readFile, + writeFile, + mkdir +} = require("fs/promises"); +const transform = require("./transform"); +// Lazily instantiated when needed let defaultCacheDirectory = null; -let hashType = "md4"; // use md5 hashing if md4 is not available - +let hashType = "sha256"; +// use md5 hashing if sha256 is not available try { crypto.createHash(hashType); } catch (err) { hashType = "md5"; } - -const readFile = promisify(fs.readFile); -const writeFile = promisify(fs.writeFile); const gunzip = promisify(zlib.gunzip); const gzip = promisify(zlib.gzip); -const makeDir = require("make-dir"); /** * Read the contents from the compressed file. * @@ -54,19 +42,12 @@ const makeDir = require("make-dir"); * @params {String} filename * @params {Boolean} compress */ +const read = async function (filename, compress) { + const data = await readFile(filename + (compress ? ".gz" : "")); + const content = compress ? await gunzip(data) : data; + return JSON.parse(content.toString()); +}; - -const read = /*#__PURE__*/function () { - var _ref = _asyncToGenerator(function* (filename, compress) { - const data = yield readFile(filename + (compress ? ".gz" : "")); - const content = compress ? yield gunzip(data) : data; - return JSON.parse(content.toString()); - }); - - return function read(_x, _x2) { - return _ref.apply(this, arguments); - }; -}(); /** * Write contents into a compressed file. * @@ -75,19 +56,12 @@ const read = /*#__PURE__*/function () { * @params {Boolean} compress * @params {String} result */ +const write = async function (filename, compress, result) { + const content = JSON.stringify(result); + const data = compress ? await gzip(content) : content; + return await writeFile(filename + (compress ? ".gz" : ""), data); +}; - -const write = /*#__PURE__*/function () { - var _ref2 = _asyncToGenerator(function* (filename, compress, result) { - const content = JSON.stringify(result); - const data = compress ? yield gzip(content) : content; - return yield writeFile(filename + (compress ? ".gz" : ""), data); - }); - - return function write(_x3, _x4, _x5) { - return _ref2.apply(this, arguments); - }; -}(); /** * Build the filename for the cached file * @@ -96,8 +70,6 @@ const write = /*#__PURE__*/function () { * * @return {String} */ - - const filename = function (source, identifier, options) { const hash = crypto.createHash(hashType); const contents = JSON.stringify({ @@ -108,65 +80,62 @@ const filename = function (source, identifier, options) { hash.update(contents); return hash.digest("hex") + ".json"; }; + /** * Handle the cache * * @params {String} directory * @params {Object} params */ +const handleCache = async function (directory, params) { + const { + source, + options = {}, + cacheIdentifier, + cacheDirectory, + cacheCompression + } = params; + const file = path.join(directory, filename(source, cacheIdentifier, options)); + try { + // No errors mean that the file was previously cached + // we just need to return it + return await read(file, cacheCompression); + } catch (err) {} + const fallback = typeof cacheDirectory !== "string" && directory !== os.tmpdir(); + + // Make sure the directory exists. + try { + // overwrite directory if exists + await mkdir(directory, { + recursive: true + }); + } catch (err) { + if (fallback) { + return handleCache(os.tmpdir(), params); + } + throw err; + } + // Otherwise just transform the file + // return it to the user asap and write it in cache + const result = await transform(source, options); -const handleCache = /*#__PURE__*/function () { - var _ref3 = _asyncToGenerator(function* (directory, params) { - const { - source, - options = {}, - cacheIdentifier, - cacheDirectory, - cacheCompression - } = params; - const file = path.join(directory, filename(source, cacheIdentifier, options)); - - try { - // No errors mean that the file was previously cached - // we just need to return it - return yield read(file, cacheCompression); - } catch (err) {} - - const fallback = typeof cacheDirectory !== "string" && directory !== os.tmpdir(); // Make sure the directory exists. - - try { - yield makeDir(directory); - } catch (err) { - if (fallback) { - return handleCache(os.tmpdir(), params); - } - - throw err; - } // Otherwise just transform the file - // return it to the user asap and write it in cache - - - const result = yield transform(source, options); - + // Do not cache if there are external dependencies, + // since they might change and we cannot control it. + if (!result.externalDependencies.length) { try { - yield write(file, cacheCompression, result); + await write(file, cacheCompression, result); } catch (err) { if (fallback) { // Fallback to tmpdir if node_modules folder not writable return handleCache(os.tmpdir(), params); } - throw err; } + } + return result; +}; - return result; - }); - - return function handleCache(_x6, _x7) { - return _ref3.apply(this, arguments); - }; -}(); /** * Retrieve file from cache, or create a new one for future reads * @@ -192,27 +161,17 @@ const handleCache = /*#__PURE__*/function () { * }); */ - -module.exports = /*#__PURE__*/function () { - var _ref4 = _asyncToGenerator(function* (params) { - let directory; - - if (typeof params.cacheDirectory === "string") { - directory = params.cacheDirectory; - } else { - if (defaultCacheDirectory === null) { - defaultCacheDirectory = findCacheDir({ - name: "babel-loader" - }) || os.tmpdir(); - } - - directory = defaultCacheDirectory; +module.exports = async function (params) { + let directory; + if (typeof params.cacheDirectory === "string") { + directory = params.cacheDirectory; + } else { + if (defaultCacheDirectory === null) { + defaultCacheDirectory = findCacheDir({ + name: "babel-loader" + }) || os.tmpdir(); } - - return yield handleCache(directory, params); - }); - - return function (_x8) { - return _ref4.apply(this, arguments); - }; -}(); \ No newline at end of file + directory = defaultCacheDirectory; + } + return await handleCache(directory, params); +}; \ No newline at end of file diff --git a/node_modules/babel-loader/lib/index.js b/node_modules/babel-loader/lib/index.js index 6a3fd4496..2702d2ebe 100644 --- a/node_modules/babel-loader/lib/index.js +++ b/node_modules/babel-loader/lib/index.js @@ -1,56 +1,38 @@ "use strict"; -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - let babel; - try { babel = require("@babel/core"); } catch (err) { if (err.code === "MODULE_NOT_FOUND") { - err.message += "\n babel-loader@8 requires Babel 7.x (the package '@babel/core'). " + "If you'd like to use Babel 6.x ('babel-core'), you should install 'babel-loader@7'."; + err.message += "\n babel-loader@9 requires Babel 7.12+ (the package '@babel/core'). " + "If you'd like to use Babel 6.x ('babel-core'), you should install 'babel-loader@7'."; } - throw err; -} // Since we've got the reverse bridge package at @babel/core@6.x, give -// people useful feedback if they try to use it alongside babel-loader. - +} +// Since we've got the reverse bridge package at @babel/core@6.x, give +// people useful feedback if they try to use it alongside babel-loader. if (/^6\./.test(babel.version)) { - throw new Error("\n babel-loader@8 will not work with the '@babel/core@6' bridge package. " + "If you want to use Babel 6.x, install 'babel-loader@7'."); + throw new Error("\n babel-loader@9 will not work with the '@babel/core@6' bridge package. " + "If you want to use Babel 6.x, install 'babel-loader@7'."); } - const { version } = require("../package.json"); - const cache = require("./cache"); - const transform = require("./transform"); - const injectCaller = require("./injectCaller"); - const schema = require("./schema"); - const { isAbsolute } = require("path"); - -const loaderUtils = require("loader-utils"); - -const validateOptions = require("schema-utils"); - +const validateOptions = require("schema-utils").validate; function subscribe(subscriber, metadata, context) { if (context[subscriber]) { context[subscriber](metadata); } } - module.exports = makeLoader(); module.exports.custom = makeLoader; - function makeLoader(callback) { const overrides = callback ? callback(babel) : undefined; return function (source, inputSourceMap) { @@ -59,188 +41,140 @@ function makeLoader(callback) { loader.call(this, source, inputSourceMap, overrides).then(args => callback(null, ...args), err => callback(err)); }; } - -function loader(_x, _x2, _x3) { - return _loader.apply(this, arguments); -} - -function _loader() { - _loader = _asyncToGenerator(function* (source, inputSourceMap, overrides) { - const filename = this.resourcePath; - let loaderOptions = loaderUtils.getOptions(this); - validateOptions(schema, loaderOptions, { - name: "Babel loader" - }); - - if (loaderOptions.customize != null) { - if (typeof loaderOptions.customize !== "string") { - throw new Error("Customized loaders must be implemented as standalone modules."); - } - - if (!isAbsolute(loaderOptions.customize)) { - throw new Error("Customized loaders must be passed as absolute paths, since " + "babel-loader has no way to know what they would be relative to."); - } - - if (overrides) { - throw new Error("babel-loader's 'customize' option is not available when already " + "using a customized babel-loader wrapper."); - } - - let override = require(loaderOptions.customize); - - if (override.__esModule) override = override.default; - - if (typeof override !== "function") { - throw new Error("Custom overrides must be functions."); - } - - overrides = override(babel); +async function loader(source, inputSourceMap, overrides) { + const filename = this.resourcePath; + let loaderOptions = this.getOptions(); + validateOptions(schema, loaderOptions, { + name: "Babel loader" + }); + if (loaderOptions.customize != null) { + if (typeof loaderOptions.customize !== "string") { + throw new Error("Customized loaders must be implemented as standalone modules."); + } + if (!isAbsolute(loaderOptions.customize)) { + throw new Error("Customized loaders must be passed as absolute paths, since " + "babel-loader has no way to know what they would be relative to."); } + if (overrides) { + throw new Error("babel-loader's 'customize' option is not available when already " + "using a customized babel-loader wrapper."); + } + let override = require(loaderOptions.customize); + if (override.__esModule) override = override.default; + if (typeof override !== "function") { + throw new Error("Custom overrides must be functions."); + } + overrides = override(babel); + } + let customOptions; + if (overrides && overrides.customOptions) { + const result = await overrides.customOptions.call(this, loaderOptions, { + source, + map: inputSourceMap + }); + customOptions = result.custom; + loaderOptions = result.loader; + } - let customOptions; + // Deprecation handling + if ("forceEnv" in loaderOptions) { + console.warn("The option `forceEnv` has been removed in favor of `envName` in Babel 7."); + } + if (typeof loaderOptions.babelrc === "string") { + console.warn("The option `babelrc` should not be set to a string anymore in the babel-loader config. " + "Please update your configuration and set `babelrc` to true or false.\n" + "If you want to specify a specific babel config file to inherit config from " + "please use the `extends` option.\nFor more information about this options see " + "https://babeljs.io/docs/core-packages/#options"); + } - if (overrides && overrides.customOptions) { - const result = yield overrides.customOptions.call(this, loaderOptions, { + // Standardize on 'sourceMaps' as the key passed through to Webpack, so that + // users may safely use either one alongside our default use of + // 'this.sourceMap' below without getting error about conflicting aliases. + if (Object.prototype.hasOwnProperty.call(loaderOptions, "sourceMap") && !Object.prototype.hasOwnProperty.call(loaderOptions, "sourceMaps")) { + loaderOptions = Object.assign({}, loaderOptions, { + sourceMaps: loaderOptions.sourceMap + }); + delete loaderOptions.sourceMap; + } + const programmaticOptions = Object.assign({}, loaderOptions, { + filename, + inputSourceMap: inputSourceMap || loaderOptions.inputSourceMap, + // Set the default sourcemap behavior based on Webpack's mapping flag, + // but allow users to override if they want. + sourceMaps: loaderOptions.sourceMaps === undefined ? this.sourceMap : loaderOptions.sourceMaps, + // Ensure that Webpack will get a full absolute path in the sourcemap + // so that it can properly map the module back to its internal cached + // modules. + sourceFileName: filename + }); + // Remove loader related options + delete programmaticOptions.customize; + delete programmaticOptions.cacheDirectory; + delete programmaticOptions.cacheIdentifier; + delete programmaticOptions.cacheCompression; + delete programmaticOptions.metadataSubscribers; + const config = await babel.loadPartialConfigAsync(injectCaller(programmaticOptions, this.target)); + if (config) { + let options = config.options; + if (overrides && overrides.config) { + options = await overrides.config.call(this, config, { source, - map: inputSourceMap + map: inputSourceMap, + customOptions }); - customOptions = result.custom; - loaderOptions = result.loader; - } // Deprecation handling - - - if ("forceEnv" in loaderOptions) { - console.warn("The option `forceEnv` has been removed in favor of `envName` in Babel 7."); } - - if (typeof loaderOptions.babelrc === "string") { - console.warn("The option `babelrc` should not be set to a string anymore in the babel-loader config. " + "Please update your configuration and set `babelrc` to true or false.\n" + "If you want to specify a specific babel config file to inherit config from " + "please use the `extends` option.\nFor more information about this options see " + "https://babeljs.io/docs/core-packages/#options"); - } // Standardize on 'sourceMaps' as the key passed through to Webpack, so that - // users may safely use either one alongside our default use of - // 'this.sourceMap' below without getting error about conflicting aliases. - - - if (Object.prototype.hasOwnProperty.call(loaderOptions, "sourceMap") && !Object.prototype.hasOwnProperty.call(loaderOptions, "sourceMaps")) { - loaderOptions = Object.assign({}, loaderOptions, { - sourceMaps: loaderOptions.sourceMap - }); - delete loaderOptions.sourceMap; + if (options.sourceMaps === "inline") { + // Babel has this weird behavior where if you set "inline", we + // inline the sourcemap, and set 'result.map = null'. This results + // in bad behavior from Babel since the maps get put into the code, + // which Webpack does not expect, and because the map we return to + // Webpack is null, which is also bad. To avoid that, we override the + // behavior here so "inline" just behaves like 'true'. + options.sourceMaps = true; } - - const programmaticOptions = Object.assign({}, loaderOptions, { - filename, - inputSourceMap: inputSourceMap || loaderOptions.inputSourceMap, - // Set the default sourcemap behavior based on Webpack's mapping flag, - // but allow users to override if they want. - sourceMaps: loaderOptions.sourceMaps === undefined ? this.sourceMap : loaderOptions.sourceMaps, - // Ensure that Webpack will get a full absolute path in the sourcemap - // so that it can properly map the module back to its internal cached - // modules. - sourceFileName: filename - }); // Remove loader related options - - delete programmaticOptions.customize; - delete programmaticOptions.cacheDirectory; - delete programmaticOptions.cacheIdentifier; - delete programmaticOptions.cacheCompression; - delete programmaticOptions.metadataSubscribers; - - if (!babel.loadPartialConfig) { - throw new Error(`babel-loader ^8.0.0-beta.3 requires @babel/core@7.0.0-beta.41, but ` + `you appear to be using "${babel.version}". Either update your ` + `@babel/core version, or pin you babel-loader version to 8.0.0-beta.2`); - } // babel.loadPartialConfigAsync is available in v7.8.0+ - - const { - loadPartialConfigAsync = babel.loadPartialConfig - } = babel; - const config = yield loadPartialConfigAsync(injectCaller(programmaticOptions, this.target)); - - if (config) { - let options = config.options; - - if (overrides && overrides.config) { - options = yield overrides.config.call(this, config, { + cacheDirectory = null, + cacheIdentifier = JSON.stringify({ + options, + "@babel/core": transform.version, + "@babel/loader": version + }), + cacheCompression = true, + metadataSubscribers = [] + } = loaderOptions; + let result; + if (cacheDirectory) { + result = await cache({ + source, + options, + transform, + cacheDirectory, + cacheIdentifier, + cacheCompression + }); + } else { + result = await transform(source, options); + } + config.files.forEach(configFile => this.addDependency(configFile)); + if (result) { + if (overrides && overrides.result) { + result = await overrides.result.call(this, result, { source, map: inputSourceMap, - customOptions + customOptions, + config, + options }); } - - if (options.sourceMaps === "inline") { - // Babel has this weird behavior where if you set "inline", we - // inline the sourcemap, and set 'result.map = null'. This results - // in bad behavior from Babel since the maps get put into the code, - // which Webpack does not expect, and because the map we return to - // Webpack is null, which is also bad. To avoid that, we override the - // behavior here so "inline" just behaves like 'true'. - options.sourceMaps = true; - } - const { - cacheDirectory = null, - cacheIdentifier = JSON.stringify({ - options, - "@babel/core": transform.version, - "@babel/loader": version - }), - cacheCompression = true, - metadataSubscribers = [] - } = loaderOptions; - let result; - - if (cacheDirectory) { - result = yield cache({ - source, - options, - transform, - cacheDirectory, - cacheIdentifier, - cacheCompression - }); - } else { - result = yield transform(source, options); - } // Availabe since Babel 7.12 - // https://github.com/babel/babel/pull/11907 - - - if (config.files) { - config.files.forEach(configFile => this.addDependency(configFile)); - } else { - // .babelrc.json - if (typeof config.babelrc === "string") { - this.addDependency(config.babelrc); - } // babel.config.js - - - if (config.config) { - this.addDependency(config.config); - } - } - - if (result) { - if (overrides && overrides.result) { - result = yield overrides.result.call(this, result, { - source, - map: inputSourceMap, - customOptions, - config, - options - }); - } - - const { - code, - map, - metadata - } = result; - metadataSubscribers.forEach(subscriber => { - subscribe(subscriber, metadata, this); - }); - return [code, map]; - } - } // If the file was ignored, pass through the original content. - + code, + map, + metadata, + externalDependencies + } = result; + externalDependencies == null ? void 0 : externalDependencies.forEach(dep => this.addDependency(dep)); + metadataSubscribers.forEach(subscriber => { + subscribe(subscriber, metadata, this); + }); + return [code, map]; + } + } - return [source, inputSourceMap]; - }); - return _loader.apply(this, arguments); + // If the file was ignored, pass through the original content. + return [source, inputSourceMap]; } \ No newline at end of file diff --git a/node_modules/babel-loader/lib/injectCaller.js b/node_modules/babel-loader/lib/injectCaller.js index e74528b60..877fb85f0 100644 --- a/node_modules/babel-loader/lib/injectCaller.js +++ b/node_modules/babel-loader/lib/injectCaller.js @@ -1,7 +1,6 @@ "use strict"; const babel = require("@babel/core"); - module.exports = function injectCaller(opts, target) { if (!supportsCallerOption()) return opts; return Object.assign({}, opts, { @@ -19,13 +18,12 @@ module.exports = function injectCaller(opts, target) { supportsTopLevelAwait: true }, opts.caller) }); -}; // TODO: We can remove this eventually, I'm just adding it so that people have +}; + +// TODO: We can remove this eventually, I'm just adding it so that people have // a little time to migrate to the newer RCs of @babel/core without getting // hard-to-diagnose errors about unknown 'caller' options. - - let supportsCallerOptionFlag = undefined; - function supportsCallerOption() { if (supportsCallerOptionFlag === undefined) { try { @@ -41,6 +39,5 @@ function supportsCallerOption() { supportsCallerOptionFlag = false; } } - return supportsCallerOptionFlag; } \ No newline at end of file diff --git a/node_modules/babel-loader/lib/transform.js b/node_modules/babel-loader/lib/transform.js index af0ed9286..ea75e6e51 100644 --- a/node_modules/babel-loader/lib/transform.js +++ b/node_modules/babel-loader/lib/transform.js @@ -1,59 +1,44 @@ "use strict"; -function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } - -function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } - const babel = require("@babel/core"); - const { promisify } = require("util"); - const LoaderError = require("./Error"); - const transform = promisify(babel.transform); - -module.exports = /*#__PURE__*/function () { - var _ref = _asyncToGenerator(function* (source, options) { - let result; - - try { - result = yield transform(source, options); - } catch (err) { - throw err.message && err.codeFrame ? new LoaderError(err) : err; - } - - if (!result) return null; // We don't return the full result here because some entries are not - // really serializable. For a full list of properties see here: - // https://github.com/babel/babel/blob/main/packages/babel-core/src/transformation/index.js - // For discussion on this topic see here: - // https://github.com/babel/babel-loader/pull/629 - - const { - ast, - code, - map, - metadata, - sourceType - } = result; - - if (map && (!map.sourcesContent || !map.sourcesContent.length)) { - map.sourcesContent = [source]; - } - - return { - ast, - code, - map, - metadata, - sourceType - }; - }); - - return function (_x, _x2) { - return _ref.apply(this, arguments); +module.exports = async function (source, options) { + let result; + try { + result = await transform(source, options); + } catch (err) { + throw err.message && err.codeFrame ? new LoaderError(err) : err; + } + if (!result) return null; + + // We don't return the full result here because some entries are not + // really serializable. For a full list of properties see here: + // https://github.com/babel/babel/blob/main/packages/babel-core/src/transformation/index.js + // For discussion on this topic see here: + // https://github.com/babel/babel-loader/pull/629 + const { + ast, + code, + map, + metadata, + sourceType, + externalDependencies + } = result; + if (map && (!map.sourcesContent || !map.sourcesContent.length)) { + map.sourcesContent = [source]; + } + return { + ast, + code, + map, + metadata, + sourceType, + // Convert it from a Set to an Array to make it JSON-serializable. + externalDependencies: Array.from(externalDependencies || []) }; -}(); - +}; module.exports.version = babel.version; \ No newline at end of file diff --git a/node_modules/babel-loader/node_modules/schema-utils/CHANGELOG.md b/node_modules/babel-loader/node_modules/schema-utils/CHANGELOG.md deleted file mode 100644 index d0751666a..000000000 --- a/node_modules/babel-loader/node_modules/schema-utils/CHANGELOG.md +++ /dev/null @@ -1,286 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. - -### [2.7.1](https://github.com/webpack/schema-utils/compare/v2.7.0...v2.7.1) (2020-08-31) - - -### Bug Fixes - -* remove esModuleInterop from tsconfig ([#110](https://github.com/webpack/schema-utils/issues/110)) ([#111](https://github.com/webpack/schema-utils/issues/111)) ([2f40154](https://github.com/webpack/schema-utils/commit/2f40154b91e45b393258ae9dd8f10cc3b8590b7d)) - -## [2.7.0](https://github.com/webpack/schema-utils/compare/v2.6.6...v2.7.0) (2020-05-29) - - -### Features - -* improve hints ([a36e535](https://github.com/webpack/schema-utils/commit/a36e535faca1b01e27c3bfa3c8bee9227c3f836c)) -* smart not case ([#101](https://github.com/webpack/schema-utils/issues/101)) ([698d8b0](https://github.com/webpack/schema-utils/commit/698d8b05462d86aadb217e25a45c7b953a79a52e)) - - -### Bug Fixes - -* move @types/json-schema from devDependencies to dependencies ([#97](https://github.com/webpack/schema-utils/issues/97)) ([#98](https://github.com/webpack/schema-utils/issues/98)) ([945e67d](https://github.com/webpack/schema-utils/commit/945e67db5e19baf7ec7df72813b0739dd56f950d)) - -### [2.6.6](https://github.com/webpack/schema-utils/compare/v2.6.5...v2.6.6) (2020-04-17) - - -### Bug Fixes - -* improve perf - -### [2.6.5](https://github.com/webpack/schema-utils/compare/v2.6.4...v2.6.5) (2020-03-11) - - -### Bug Fixes - -* correct dots at end of sentence ([7284beb](https://github.com/webpack/schema-utils/commit/7284bebe00cd570f1bef2c15951a07b9794038e6)) - -### [2.6.4](https://github.com/webpack/schema-utils/compare/v2.6.3...v2.6.4) (2020-01-17) - - -### Bug Fixes - -* change `initialised` to `initialized` ([#87](https://github.com/webpack/schema-utils/issues/87)) ([70f12d3](https://github.com/webpack/schema-utils/commit/70f12d33a8eaa27249bc9c1a27f886724cf91ea7)) - -### [2.6.3](https://github.com/webpack/schema-utils/compare/v2.6.2...v2.6.3) (2020-01-17) - - -### Bug Fixes - -* prefer the `baseDataPath` option from arguments ([#86](https://github.com/webpack/schema-utils/issues/86)) ([e236859](https://github.com/webpack/schema-utils/commit/e236859e85b28e35e1294f86fc1ff596a5031cea)) - -### [2.6.2](https://github.com/webpack/schema-utils/compare/v2.6.1...v2.6.2) (2020-01-14) - - -### Bug Fixes - -* better handle Windows absolute paths ([#85](https://github.com/webpack/schema-utils/issues/85)) ([1fa2930](https://github.com/webpack/schema-utils/commit/1fa2930a161e907b9fc53a7233d605910afdb883)) - -### [2.6.1](https://github.com/webpack/schema-utils/compare/v2.6.0...v2.6.1) (2019-11-28) - - -### Bug Fixes - -* typescript declarations ([#84](https://github.com/webpack/schema-utils/issues/84)) ([89d55a9](https://github.com/webpack/schema-utils/commit/89d55a9a8edfa6a8ac8b112f226bb3154e260319)) - -## [2.6.0](https://github.com/webpack/schema-utils/compare/v2.5.0...v2.6.0) (2019-11-27) - - -### Features - -* support configuration via title ([#81](https://github.com/webpack/schema-utils/issues/81)) ([afddc10](https://github.com/webpack/schema-utils/commit/afddc109f6891cd37a9f1835d50862d119a072bf)) - - -### Bug Fixes - -* typescript definitions ([#70](https://github.com/webpack/schema-utils/issues/70)) ([f38158d](https://github.com/webpack/schema-utils/commit/f38158d6d040e2c701622778ae8122fb26a4f990)) - -## [2.5.0](https://github.com/webpack/schema-utils/compare/v2.4.1...v2.5.0) (2019-10-15) - - -### Bug Fixes - -* rework format for maxLength, minLength ([#67](https://github.com/webpack/schema-utils/issues/67)) ([0d12259](https://github.com/webpack/schema-utils/commit/0d12259)) -* support all cases with one number in range ([#64](https://github.com/webpack/schema-utils/issues/64)) ([7fc8069](https://github.com/webpack/schema-utils/commit/7fc8069)) -* typescript definition and export naming ([#69](https://github.com/webpack/schema-utils/issues/69)) ([a435b79](https://github.com/webpack/schema-utils/commit/a435b79)) - - -### Features - -* "smart" numbers range ([62fb107](https://github.com/webpack/schema-utils/commit/62fb107)) - -### [2.4.1](https://github.com/webpack/schema-utils/compare/v2.4.0...v2.4.1) (2019-09-27) - - -### Bug Fixes - -* publish definitions ([#58](https://github.com/webpack/schema-utils/issues/58)) ([1885faa](https://github.com/webpack/schema-utils/commit/1885faa)) - -## [2.4.0](https://github.com/webpack/schema-utils/compare/v2.3.0...v2.4.0) (2019-09-26) - - -### Features - -* better errors when the `type` keyword doesn't exist ([0988be2](https://github.com/webpack/schema-utils/commit/0988be2)) -* support $data reference ([#56](https://github.com/webpack/schema-utils/issues/56)) ([d2f11d6](https://github.com/webpack/schema-utils/commit/d2f11d6)) -* types definitions ([#52](https://github.com/webpack/schema-utils/issues/52)) ([facb431](https://github.com/webpack/schema-utils/commit/facb431)) - -## [2.3.0](https://github.com/webpack/schema-utils/compare/v2.2.0...v2.3.0) (2019-09-26) - - -### Features - -* support `not` keyword ([#53](https://github.com/webpack/schema-utils/issues/53)) ([765f458](https://github.com/webpack/schema-utils/commit/765f458)) - -## [2.2.0](https://github.com/webpack/schema-utils/compare/v2.1.0...v2.2.0) (2019-09-02) - - -### Features - -* better error output for `oneOf` and `anyOf` ([#48](https://github.com/webpack/schema-utils/issues/48)) ([#50](https://github.com/webpack/schema-utils/issues/50)) ([332242f](https://github.com/webpack/schema-utils/commit/332242f)) - -## [2.1.0](https://github.com/webpack-contrib/schema-utils/compare/v2.0.1...v2.1.0) (2019-08-07) - - -### Bug Fixes - -* throw error on sparse arrays ([#47](https://github.com/webpack-contrib/schema-utils/issues/47)) ([b85ac38](https://github.com/webpack-contrib/schema-utils/commit/b85ac38)) - - -### Features - -* export `ValidateError` ([#46](https://github.com/webpack-contrib/schema-utils/issues/46)) ([ff781d7](https://github.com/webpack-contrib/schema-utils/commit/ff781d7)) - - - -### [2.0.1](https://github.com/webpack-contrib/schema-utils/compare/v2.0.0...v2.0.1) (2019-07-18) - - -### Bug Fixes - -* error message for empty object ([#44](https://github.com/webpack-contrib/schema-utils/issues/44)) ([0b4b4a2](https://github.com/webpack-contrib/schema-utils/commit/0b4b4a2)) - - - -### [2.0.0](https://github.com/webpack-contrib/schema-utils/compare/v1.0.0...v2.0.0) (2019-07-17) - - -### BREAKING CHANGES - -* drop support for Node.js < 8.9.0 -* drop support `errorMessage`, please use `description` for links. -* api was changed, please look documentation. -* error messages was fully rewritten. - - - -# [1.0.0](https://github.com/webpack-contrib/schema-utils/compare/v0.4.7...v1.0.0) (2018-08-07) - - -### Features - -* **src:** add support for custom error messages ([#33](https://github.com/webpack-contrib/schema-utils/issues/33)) ([1cbe4ef](https://github.com/webpack-contrib/schema-utils/commit/1cbe4ef)) - - - - -## [0.4.7](https://github.com/webpack-contrib/schema-utils/compare/v0.4.6...v0.4.7) (2018-08-07) - - -### Bug Fixes - -* **src:** `node >= v4.0.0` support ([#32](https://github.com/webpack-contrib/schema-utils/issues/32)) ([cb13dd4](https://github.com/webpack-contrib/schema-utils/commit/cb13dd4)) - - - - -## [0.4.6](https://github.com/webpack-contrib/schema-utils/compare/v0.4.5...v0.4.6) (2018-08-06) - - -### Bug Fixes - -* **package:** remove lockfile ([#28](https://github.com/webpack-contrib/schema-utils/issues/28)) ([69f1a81](https://github.com/webpack-contrib/schema-utils/commit/69f1a81)) -* **package:** remove unnecessary `webpack` dependency ([#26](https://github.com/webpack-contrib/schema-utils/issues/26)) ([532eaa5](https://github.com/webpack-contrib/schema-utils/commit/532eaa5)) - - - - -## [0.4.5](https://github.com/webpack-contrib/schema-utils/compare/v0.4.4...v0.4.5) (2018-02-13) - - -### Bug Fixes - -* **CHANGELOG:** update broken links ([4483b9f](https://github.com/webpack-contrib/schema-utils/commit/4483b9f)) -* **package:** update broken links ([f2494ba](https://github.com/webpack-contrib/schema-utils/commit/f2494ba)) - - - - -## [0.4.4](https://github.com/webpack-contrib/schema-utils/compare/v0.4.3...v0.4.4) (2018-02-13) - - -### Bug Fixes - -* **package:** update `dependencies` ([#22](https://github.com/webpack-contrib/schema-utils/issues/22)) ([3aecac6](https://github.com/webpack-contrib/schema-utils/commit/3aecac6)) - - - - -## [0.4.3](https://github.com/webpack-contrib/schema-utils/compare/v0.4.2...v0.4.3) (2017-12-14) - - -### Bug Fixes - -* **validateOptions:** throw `err` instead of `process.exit(1)` ([#17](https://github.com/webpack-contrib/schema-utils/issues/17)) ([c595eda](https://github.com/webpack-contrib/schema-utils/commit/c595eda)) -* **ValidationError:** never return `this` in the ctor ([#16](https://github.com/webpack-contrib/schema-utils/issues/16)) ([c723791](https://github.com/webpack-contrib/schema-utils/commit/c723791)) - - - - -## [0.4.2](https://github.com/webpack-contrib/schema-utils/compare/v0.4.1...v0.4.2) (2017-11-09) - - -### Bug Fixes - -* **validateOptions:** catch `ValidationError` and handle it internally ([#15](https://github.com/webpack-contrib/schema-utils/issues/15)) ([9c5ef5e](https://github.com/webpack-contrib/schema-utils/commit/9c5ef5e)) - - - - -## [0.4.1](https://github.com/webpack-contrib/schema-utils/compare/v0.4.0...v0.4.1) (2017-11-03) - - -### Bug Fixes - -* **ValidationError:** use `Error.captureStackTrace` for `err.stack` handling ([#14](https://github.com/webpack-contrib/schema-utils/issues/14)) ([a6fb974](https://github.com/webpack-contrib/schema-utils/commit/a6fb974)) - - - - -# [0.4.0](https://github.com/webpack-contrib/schema-utils/compare/v0.3.0...v0.4.0) (2017-10-28) - - -### Features - -* add support for `typeof`, `instanceof` (`{Function\|RegExp}`) ([#10](https://github.com/webpack-contrib/schema-utils/issues/10)) ([9f01816](https://github.com/webpack-contrib/schema-utils/commit/9f01816)) - - - - -# [0.3.0](https://github.com/webpack-contrib/schema-utils/compare/v0.2.1...v0.3.0) (2017-04-29) - - -### Features - -* add ValidationError ([#8](https://github.com/webpack-contrib/schema-utils/issues/8)) ([d48f0fb](https://github.com/webpack-contrib/schema-utils/commit/d48f0fb)) - - - - -## [0.2.1](https://github.com/webpack-contrib/schema-utils/compare/v0.2.0...v0.2.1) (2017-03-13) - - -### Bug Fixes - -* Include .babelrc to `files` ([28f0363](https://github.com/webpack-contrib/schema-utils/commit/28f0363)) -* Include source to `files` ([43b0f2f](https://github.com/webpack-contrib/schema-utils/commit/43b0f2f)) - - - - -# [0.2.0](https://github.com/webpack-contrib/schema-utils/compare/v0.1.0...v0.2.0) (2017-03-12) - - -# 0.1.0 (2017-03-07) - - -### Features - -* **validations:** add validateOptions module ([ae9b47b](https://github.com/webpack-contrib/schema-utils/commit/ae9b47b)) - - - -# Change Log - -All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. diff --git a/node_modules/babel-loader/node_modules/schema-utils/README.md b/node_modules/babel-loader/node_modules/schema-utils/README.md deleted file mode 100644 index a0150e4cd..000000000 --- a/node_modules/babel-loader/node_modules/schema-utils/README.md +++ /dev/null @@ -1,276 +0,0 @@ - - -[![npm][npm]][npm-url] -[![node][node]][node-url] -[![deps][deps]][deps-url] -[![tests][tests]][tests-url] -[![coverage][cover]][cover-url] -[![chat][chat]][chat-url] -[![size][size]][size-url] - -# schema-utils - -Package for validate options in loaders and plugins. - -## Getting Started - -To begin, you'll need to install `schema-utils`: - -```console -npm install schema-utils -``` - -## API - -**schema.json** - -```json -{ - "type": "object", - "properties": { - "option": { - "type": "boolean" - } - }, - "additionalProperties": false -} -``` - -```js -import schema from './path/to/schema.json'; -import validate from 'schema-utils'; - -const options = { option: true }; -const configuration = { name: 'Loader Name/Plugin Name/Name' }; - -validate(schema, options, configuration); -``` - -### `schema` - -Type: `String` - -JSON schema. - -Simple example of schema: - -```json -{ - "type": "object", - "properties": { - "name": { - "description": "This is description of option.", - "type": "string" - } - }, - "additionalProperties": false -} -``` - -### `options` - -Type: `Object` - -Object with options. - -```js -validate( - schema, - { - name: 123, - }, - { name: 'MyPlugin' } -); -``` - -### `configuration` - -Allow to configure validator. - -There is an alternative method to configure the `name` and`baseDataPath` options via the `title` property in the schema. -For example: - -```json -{ - "title": "My Loader options", - "type": "object", - "properties": { - "name": { - "description": "This is description of option.", - "type": "string" - } - }, - "additionalProperties": false -} -``` - -The last word used for the `baseDataPath` option, other words used for the `name` option. -Based on the example above the `name` option equals `My Loader`, the `baseDataPath` option equals `options`. - -#### `name` - -Type: `Object` -Default: `"Object"` - -Allow to setup name in validation errors. - -```js -validate(schema, options, { name: 'MyPlugin' }); -``` - -```shell -Invalid configuration object. MyPlugin has been initialised using a configuration object that does not match the API schema. - - configuration.optionName should be a integer. -``` - -#### `baseDataPath` - -Type: `String` -Default: `"configuration"` - -Allow to setup base data path in validation errors. - -```js -validate(schema, options, { name: 'MyPlugin', baseDataPath: 'options' }); -``` - -```shell -Invalid options object. MyPlugin has been initialised using an options object that does not match the API schema. - - options.optionName should be a integer. -``` - -#### `postFormatter` - -Type: `Function` -Default: `undefined` - -Allow to reformat errors. - -```js -validate(schema, options, { - name: 'MyPlugin', - postFormatter: (formattedError, error) => { - if (error.keyword === 'type') { - return `${formattedError}\nAdditional Information.`; - } - - return formattedError; - }, -}); -``` - -```shell -Invalid options object. MyPlugin has been initialized using an options object that does not match the API schema. - - options.optionName should be a integer. - Additional Information. -``` - -## Examples - -**schema.json** - -```json -{ - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "test": { - "anyOf": [ - { "type": "array" }, - { "type": "string" }, - { "instanceof": "RegExp" } - ] - }, - "transform": { - "instanceof": "Function" - }, - "sourceMap": { - "type": "boolean" - } - }, - "additionalProperties": false -} -``` - -### `Loader` - -```js -import { getOptions } from 'loader-utils'; -import validateOptions from 'schema-utils'; - -import schema from 'path/to/schema.json'; - -function loader(src, map) { - const options = getOptions(this) || {}; - - validateOptions(schema, options, { - name: 'Loader Name', - baseDataPath: 'options', - }); - - // Code... -} - -export default loader; -``` - -### `Plugin` - -```js -import validateOptions from 'schema-utils'; - -import schema from 'path/to/schema.json'; - -class Plugin { - constructor(options) { - validateOptions(schema, options, { - name: 'Plugin Name', - baseDataPath: 'options', - }); - - this.options = options; - } - - apply(compiler) { - // Code... - } -} - -export default Plugin; -``` - -## Contributing - -Please take a moment to read our contributing guidelines if you haven't yet done so. - -[CONTRIBUTING](./.github/CONTRIBUTING.md) - -## License - -[MIT](./LICENSE) - -[npm]: https://img.shields.io/npm/v/schema-utils.svg -[npm-url]: https://npmjs.com/package/schema-utils -[node]: https://img.shields.io/node/v/schema-utils.svg -[node-url]: https://nodejs.org -[deps]: https://david-dm.org/webpack/schema-utils.svg -[deps-url]: https://david-dm.org/webpack/schema-utils -[tests]: https://github.com/webpack/schema-utils/workflows/schema-utils/badge.svg -[tests-url]: https://github.com/webpack/schema-utils/actions -[cover]: https://codecov.io/gh/webpack/schema-utils/branch/master/graph/badge.svg -[cover-url]: https://codecov.io/gh/webpack/schema-utils -[chat]: https://badges.gitter.im/webpack/webpack.svg -[chat-url]: https://gitter.im/webpack/webpack -[size]: https://packagephobia.com/badge?p=schema-utils -[size-url]: https://packagephobia.com/result?p=schema-utils diff --git a/node_modules/babel-loader/node_modules/schema-utils/declarations/ValidationError.d.ts b/node_modules/babel-loader/node_modules/schema-utils/declarations/ValidationError.d.ts deleted file mode 100644 index 1b53f70fe..000000000 --- a/node_modules/babel-loader/node_modules/schema-utils/declarations/ValidationError.d.ts +++ /dev/null @@ -1,88 +0,0 @@ -export default ValidationError; -export type JSONSchema6 = import('json-schema').JSONSchema6; -export type JSONSchema7 = import('json-schema').JSONSchema7; -export type Schema = - | (import('json-schema').JSONSchema4 & import('./validate').Extend) - | (import('json-schema').JSONSchema6 & import('./validate').Extend) - | (import('json-schema').JSONSchema7 & import('./validate').Extend); -export type ValidationErrorConfiguration = { - name?: string | undefined; - baseDataPath?: string | undefined; - postFormatter?: import('./validate').PostFormatter | undefined; -}; -export type PostFormatter = ( - formattedError: string, - error: import('ajv').ErrorObject & { - children?: import('ajv').ErrorObject[] | undefined; - } -) => string; -export type SchemaUtilErrorObject = import('ajv').ErrorObject & { - children?: import('ajv').ErrorObject[] | undefined; -}; -export type SPECIFICITY = number; -declare class ValidationError extends Error { - /** - * @param {Array} errors - * @param {Schema} schema - * @param {ValidationErrorConfiguration} configuration - */ - constructor( - errors: Array, - schema: Schema, - configuration?: ValidationErrorConfiguration - ); - /** @type {Array} */ - errors: Array; - /** @type {Schema} */ - schema: Schema; - /** @type {string} */ - headerName: string; - /** @type {string} */ - baseDataPath: string; - /** @type {PostFormatter | null} */ - postFormatter: PostFormatter | null; - /** - * @param {string} path - * @returns {Schema} - */ - getSchemaPart(path: string): Schema; - /** - * @param {Schema} schema - * @param {boolean} logic - * @param {Array} prevSchemas - * @returns {string} - */ - formatSchema( - schema: Schema, - logic?: boolean, - prevSchemas?: Array - ): string; - /** - * @param {Schema=} schemaPart - * @param {(boolean | Array)=} additionalPath - * @param {boolean=} needDot - * @param {boolean=} logic - * @returns {string} - */ - getSchemaPartText( - schemaPart?: Schema | undefined, - additionalPath?: (boolean | Array) | undefined, - needDot?: boolean | undefined, - logic?: boolean | undefined - ): string; - /** - * @param {Schema=} schemaPart - * @returns {string} - */ - getSchemaPartDescription(schemaPart?: Schema | undefined): string; - /** - * @param {SchemaUtilErrorObject} error - * @returns {string} - */ - formatValidationError(error: SchemaUtilErrorObject): string; - /** - * @param {Array} errors - * @returns {string} - */ - formatValidationErrors(errors: Array): string; -} diff --git a/node_modules/babel-loader/node_modules/schema-utils/declarations/index.d.ts b/node_modules/babel-loader/node_modules/schema-utils/declarations/index.d.ts deleted file mode 100644 index 2ee7d9e93..000000000 --- a/node_modules/babel-loader/node_modules/schema-utils/declarations/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const _exports: typeof import('./validate').default; -export = _exports; diff --git a/node_modules/babel-loader/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts b/node_modules/babel-loader/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts deleted file mode 100644 index 6843dd638..000000000 --- a/node_modules/babel-loader/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -export default addAbsolutePathKeyword; -export type Ajv = import('ajv').Ajv; -export type ValidateFunction = import('ajv').ValidateFunction; -export type SchemaUtilErrorObject = import('ajv').ErrorObject & { - children?: import('ajv').ErrorObject[] | undefined; -}; -/** - * - * @param {Ajv} ajv - * @returns {Ajv} - */ -declare function addAbsolutePathKeyword(ajv: Ajv): Ajv; diff --git a/node_modules/babel-loader/node_modules/schema-utils/declarations/util/hints.d.ts b/node_modules/babel-loader/node_modules/schema-utils/declarations/util/hints.d.ts deleted file mode 100644 index 39412aa59..000000000 --- a/node_modules/babel-loader/node_modules/schema-utils/declarations/util/hints.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -export function stringHints(schema: Schema, logic: boolean): string[]; -export function numberHints(schema: Schema, logic: boolean): string[]; -export type Schema = - | (import('json-schema').JSONSchema4 & import('../validate').Extend) - | (import('json-schema').JSONSchema6 & import('../validate').Extend) - | (import('json-schema').JSONSchema7 & import('../validate').Extend); diff --git a/node_modules/babel-loader/node_modules/schema-utils/declarations/validate.d.ts b/node_modules/babel-loader/node_modules/schema-utils/declarations/validate.d.ts deleted file mode 100644 index 6a3a5b8ad..000000000 --- a/node_modules/babel-loader/node_modules/schema-utils/declarations/validate.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -export default validate; -export type JSONSchema4 = import('json-schema').JSONSchema4; -export type JSONSchema6 = import('json-schema').JSONSchema6; -export type JSONSchema7 = import('json-schema').JSONSchema7; -export type ErrorObject = import('ajv').ErrorObject; -export type Extend = { - formatMinimum?: number | undefined; - formatMaximum?: number | undefined; - formatExclusiveMinimum?: boolean | undefined; - formatExclusiveMaximum?: boolean | undefined; -}; -export type Schema = - | (import('json-schema').JSONSchema4 & Extend) - | (import('json-schema').JSONSchema6 & Extend) - | (import('json-schema').JSONSchema7 & Extend); -export type SchemaUtilErrorObject = import('ajv').ErrorObject & { - children?: import('ajv').ErrorObject[] | undefined; -}; -export type PostFormatter = ( - formattedError: string, - error: SchemaUtilErrorObject -) => string; -export type ValidationErrorConfiguration = { - name?: string | undefined; - baseDataPath?: string | undefined; - postFormatter?: PostFormatter | undefined; -}; -/** - * @param {Schema} schema - * @param {Array | object} options - * @param {ValidationErrorConfiguration=} configuration - * @returns {void} - */ -declare function validate( - schema: Schema, - options: Array | object, - configuration?: ValidationErrorConfiguration | undefined -): void; -declare namespace validate { - export { ValidationError }; - export { ValidationError as ValidateError }; -} -import ValidationError from './ValidationError'; diff --git a/node_modules/babel-loader/node_modules/schema-utils/dist/ValidationError.js b/node_modules/babel-loader/node_modules/schema-utils/dist/ValidationError.js deleted file mode 100644 index ae5bd94c8..000000000 --- a/node_modules/babel-loader/node_modules/schema-utils/dist/ValidationError.js +++ /dev/null @@ -1,1261 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = void 0; - -const { - stringHints, - numberHints -} = require('./util/hints'); -/** @typedef {import("json-schema").JSONSchema6} JSONSchema6 */ - -/** @typedef {import("json-schema").JSONSchema7} JSONSchema7 */ - -/** @typedef {import("./validate").Schema} Schema */ - -/** @typedef {import("./validate").ValidationErrorConfiguration} ValidationErrorConfiguration */ - -/** @typedef {import("./validate").PostFormatter} PostFormatter */ - -/** @typedef {import("./validate").SchemaUtilErrorObject} SchemaUtilErrorObject */ - -/** @enum {number} */ - - -const SPECIFICITY = { - type: 1, - not: 1, - oneOf: 1, - anyOf: 1, - if: 1, - enum: 1, - const: 1, - instanceof: 1, - required: 2, - pattern: 2, - patternRequired: 2, - format: 2, - formatMinimum: 2, - formatMaximum: 2, - minimum: 2, - exclusiveMinimum: 2, - maximum: 2, - exclusiveMaximum: 2, - multipleOf: 2, - uniqueItems: 2, - contains: 2, - minLength: 2, - maxLength: 2, - minItems: 2, - maxItems: 2, - minProperties: 2, - maxProperties: 2, - dependencies: 2, - propertyNames: 2, - additionalItems: 2, - additionalProperties: 2, - absolutePath: 2 -}; -/** - * - * @param {Array} array - * @param {(item: SchemaUtilErrorObject) => number} fn - * @returns {Array} - */ - -function filterMax(array, fn) { - const evaluatedMax = array.reduce((max, item) => Math.max(max, fn(item)), 0); - return array.filter(item => fn(item) === evaluatedMax); -} -/** - * - * @param {Array} children - * @returns {Array} - */ - - -function filterChildren(children) { - let newChildren = children; - newChildren = filterMax(newChildren, - /** - * - * @param {SchemaUtilErrorObject} error - * @returns {number} - */ - error => error.dataPath ? error.dataPath.length : 0); - newChildren = filterMax(newChildren, - /** - * @param {SchemaUtilErrorObject} error - * @returns {number} - */ - error => SPECIFICITY[ - /** @type {keyof typeof SPECIFICITY} */ - error.keyword] || 2); - return newChildren; -} -/** - * Find all children errors - * @param {Array} children - * @param {Array} schemaPaths - * @return {number} returns index of first child - */ - - -function findAllChildren(children, schemaPaths) { - let i = children.length - 1; - - const predicate = - /** - * @param {string} schemaPath - * @returns {boolean} - */ - schemaPath => children[i].schemaPath.indexOf(schemaPath) !== 0; - - while (i > -1 && !schemaPaths.every(predicate)) { - if (children[i].keyword === 'anyOf' || children[i].keyword === 'oneOf') { - const refs = extractRefs(children[i]); - const childrenStart = findAllChildren(children.slice(0, i), refs.concat(children[i].schemaPath)); - i = childrenStart - 1; - } else { - i -= 1; - } - } - - return i + 1; -} -/** - * Extracts all refs from schema - * @param {SchemaUtilErrorObject} error - * @return {Array} - */ - - -function extractRefs(error) { - const { - schema - } = error; - - if (!Array.isArray(schema)) { - return []; - } - - return schema.map(({ - $ref - }) => $ref).filter(s => s); -} -/** - * Groups children by their first level parent (assuming that error is root) - * @param {Array} children - * @return {Array} - */ - - -function groupChildrenByFirstChild(children) { - const result = []; - let i = children.length - 1; - - while (i > 0) { - const child = children[i]; - - if (child.keyword === 'anyOf' || child.keyword === 'oneOf') { - const refs = extractRefs(child); - const childrenStart = findAllChildren(children.slice(0, i), refs.concat(child.schemaPath)); - - if (childrenStart !== i) { - result.push(Object.assign({}, child, { - children: children.slice(childrenStart, i) - })); - i = childrenStart; - } else { - result.push(child); - } - } else { - result.push(child); - } - - i -= 1; - } - - if (i === 0) { - result.push(children[i]); - } - - return result.reverse(); -} -/** - * @param {string} str - * @param {string} prefix - * @returns {string} - */ - - -function indent(str, prefix) { - return str.replace(/\n(?!$)/g, `\n${prefix}`); -} -/** - * @param {Schema} schema - * @returns {schema is (Schema & {not: Schema})} - */ - - -function hasNotInSchema(schema) { - return !!schema.not; -} -/** - * @param {Schema} schema - * @return {Schema} - */ - - -function findFirstTypedSchema(schema) { - if (hasNotInSchema(schema)) { - return findFirstTypedSchema(schema.not); - } - - return schema; -} -/** - * @param {Schema} schema - * @return {boolean} - */ - - -function canApplyNot(schema) { - const typedSchema = findFirstTypedSchema(schema); - return likeNumber(typedSchema) || likeInteger(typedSchema) || likeString(typedSchema) || likeNull(typedSchema) || likeBoolean(typedSchema); -} -/** - * @param {any} maybeObj - * @returns {boolean} - */ - - -function isObject(maybeObj) { - return typeof maybeObj === 'object' && maybeObj !== null; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeNumber(schema) { - return schema.type === 'number' || typeof schema.minimum !== 'undefined' || typeof schema.exclusiveMinimum !== 'undefined' || typeof schema.maximum !== 'undefined' || typeof schema.exclusiveMaximum !== 'undefined' || typeof schema.multipleOf !== 'undefined'; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeInteger(schema) { - return schema.type === 'integer' || typeof schema.minimum !== 'undefined' || typeof schema.exclusiveMinimum !== 'undefined' || typeof schema.maximum !== 'undefined' || typeof schema.exclusiveMaximum !== 'undefined' || typeof schema.multipleOf !== 'undefined'; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeString(schema) { - return schema.type === 'string' || typeof schema.minLength !== 'undefined' || typeof schema.maxLength !== 'undefined' || typeof schema.pattern !== 'undefined' || typeof schema.format !== 'undefined' || typeof schema.formatMinimum !== 'undefined' || typeof schema.formatMaximum !== 'undefined'; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeBoolean(schema) { - return schema.type === 'boolean'; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeArray(schema) { - return schema.type === 'array' || typeof schema.minItems === 'number' || typeof schema.maxItems === 'number' || typeof schema.uniqueItems !== 'undefined' || typeof schema.items !== 'undefined' || typeof schema.additionalItems !== 'undefined' || typeof schema.contains !== 'undefined'; -} -/** - * @param {Schema & {patternRequired?: Array}} schema - * @returns {boolean} - */ - - -function likeObject(schema) { - return schema.type === 'object' || typeof schema.minProperties !== 'undefined' || typeof schema.maxProperties !== 'undefined' || typeof schema.required !== 'undefined' || typeof schema.properties !== 'undefined' || typeof schema.patternProperties !== 'undefined' || typeof schema.additionalProperties !== 'undefined' || typeof schema.dependencies !== 'undefined' || typeof schema.propertyNames !== 'undefined' || typeof schema.patternRequired !== 'undefined'; -} -/** - * @param {Schema} schema - * @returns {boolean} - */ - - -function likeNull(schema) { - return schema.type === 'null'; -} -/** - * @param {string} type - * @returns {string} - */ - - -function getArticle(type) { - if (/^[aeiou]/i.test(type)) { - return 'an'; - } - - return 'a'; -} -/** - * @param {Schema=} schema - * @returns {string} - */ - - -function getSchemaNonTypes(schema) { - if (!schema) { - return ''; - } - - if (!schema.type) { - if (likeNumber(schema) || likeInteger(schema)) { - return ' | should be any non-number'; - } - - if (likeString(schema)) { - return ' | should be any non-string'; - } - - if (likeArray(schema)) { - return ' | should be any non-array'; - } - - if (likeObject(schema)) { - return ' | should be any non-object'; - } - } - - return ''; -} -/** - * @param {Array} hints - * @returns {string} - */ - - -function formatHints(hints) { - return hints.length > 0 ? `(${hints.join(', ')})` : ''; -} -/** - * @param {Schema} schema - * @param {boolean} logic - * @returns {string[]} - */ - - -function getHints(schema, logic) { - if (likeNumber(schema) || likeInteger(schema)) { - return numberHints(schema, logic); - } else if (likeString(schema)) { - return stringHints(schema, logic); - } - - return []; -} - -class ValidationError extends Error { - /** - * @param {Array} errors - * @param {Schema} schema - * @param {ValidationErrorConfiguration} configuration - */ - constructor(errors, schema, configuration = {}) { - super(); - /** @type {string} */ - - this.name = 'ValidationError'; - /** @type {Array} */ - - this.errors = errors; - /** @type {Schema} */ - - this.schema = schema; - let headerNameFromSchema; - let baseDataPathFromSchema; - - if (schema.title && (!configuration.name || !configuration.baseDataPath)) { - const splittedTitleFromSchema = schema.title.match(/^(.+) (.+)$/); - - if (splittedTitleFromSchema) { - if (!configuration.name) { - [, headerNameFromSchema] = splittedTitleFromSchema; - } - - if (!configuration.baseDataPath) { - [,, baseDataPathFromSchema] = splittedTitleFromSchema; - } - } - } - /** @type {string} */ - - - this.headerName = configuration.name || headerNameFromSchema || 'Object'; - /** @type {string} */ - - this.baseDataPath = configuration.baseDataPath || baseDataPathFromSchema || 'configuration'; - /** @type {PostFormatter | null} */ - - this.postFormatter = configuration.postFormatter || null; - const header = `Invalid ${this.baseDataPath} object. ${this.headerName} has been initialized using ${getArticle(this.baseDataPath)} ${this.baseDataPath} object that does not match the API schema.\n`; - /** @type {string} */ - - this.message = `${header}${this.formatValidationErrors(errors)}`; - Error.captureStackTrace(this, this.constructor); - } - /** - * @param {string} path - * @returns {Schema} - */ - - - getSchemaPart(path) { - const newPath = path.split('/'); - let schemaPart = this.schema; - - for (let i = 1; i < newPath.length; i++) { - const inner = schemaPart[ - /** @type {keyof Schema} */ - newPath[i]]; - - if (!inner) { - break; - } - - schemaPart = inner; - } - - return schemaPart; - } - /** - * @param {Schema} schema - * @param {boolean} logic - * @param {Array} prevSchemas - * @returns {string} - */ - - - formatSchema(schema, logic = true, prevSchemas = []) { - let newLogic = logic; - - const formatInnerSchema = - /** - * - * @param {Object} innerSchema - * @param {boolean=} addSelf - * @returns {string} - */ - (innerSchema, addSelf) => { - if (!addSelf) { - return this.formatSchema(innerSchema, newLogic, prevSchemas); - } - - if (prevSchemas.includes(innerSchema)) { - return '(recursive)'; - } - - return this.formatSchema(innerSchema, newLogic, prevSchemas.concat(schema)); - }; - - if (hasNotInSchema(schema) && !likeObject(schema)) { - if (canApplyNot(schema.not)) { - newLogic = !logic; - return formatInnerSchema(schema.not); - } - - const needApplyLogicHere = !schema.not.not; - const prefix = logic ? '' : 'non '; - newLogic = !logic; - return needApplyLogicHere ? prefix + formatInnerSchema(schema.not) : formatInnerSchema(schema.not); - } - - if ( - /** @type {Schema & {instanceof: string | Array}} */ - schema.instanceof) { - const { - instanceof: value - } = - /** @type {Schema & {instanceof: string | Array}} */ - schema; - const values = !Array.isArray(value) ? [value] : value; - return values.map( - /** - * @param {string} item - * @returns {string} - */ - item => item === 'Function' ? 'function' : item).join(' | '); - } - - if (schema.enum) { - return ( - /** @type {Array} */ - schema.enum.map(item => JSON.stringify(item)).join(' | ') - ); - } - - if (typeof schema.const !== 'undefined') { - return JSON.stringify(schema.const); - } - - if (schema.oneOf) { - return ( - /** @type {Array} */ - schema.oneOf.map(item => formatInnerSchema(item, true)).join(' | ') - ); - } - - if (schema.anyOf) { - return ( - /** @type {Array} */ - schema.anyOf.map(item => formatInnerSchema(item, true)).join(' | ') - ); - } - - if (schema.allOf) { - return ( - /** @type {Array} */ - schema.allOf.map(item => formatInnerSchema(item, true)).join(' & ') - ); - } - - if ( - /** @type {JSONSchema7} */ - schema.if) { - const { - if: ifValue, - then: thenValue, - else: elseValue - } = - /** @type {JSONSchema7} */ - schema; - return `${ifValue ? `if ${formatInnerSchema(ifValue)}` : ''}${thenValue ? ` then ${formatInnerSchema(thenValue)}` : ''}${elseValue ? ` else ${formatInnerSchema(elseValue)}` : ''}`; - } - - if (schema.$ref) { - return formatInnerSchema(this.getSchemaPart(schema.$ref), true); - } - - if (likeNumber(schema) || likeInteger(schema)) { - const [type, ...hints] = getHints(schema, logic); - const str = `${type}${hints.length > 0 ? ` ${formatHints(hints)}` : ''}`; - return logic ? str : hints.length > 0 ? `non-${type} | ${str}` : `non-${type}`; - } - - if (likeString(schema)) { - const [type, ...hints] = getHints(schema, logic); - const str = `${type}${hints.length > 0 ? ` ${formatHints(hints)}` : ''}`; - return logic ? str : str === 'string' ? 'non-string' : `non-string | ${str}`; - } - - if (likeBoolean(schema)) { - return `${logic ? '' : 'non-'}boolean`; - } - - if (likeArray(schema)) { - // not logic already applied in formatValidationError - newLogic = true; - const hints = []; - - if (typeof schema.minItems === 'number') { - hints.push(`should not have fewer than ${schema.minItems} item${schema.minItems > 1 ? 's' : ''}`); - } - - if (typeof schema.maxItems === 'number') { - hints.push(`should not have more than ${schema.maxItems} item${schema.maxItems > 1 ? 's' : ''}`); - } - - if (schema.uniqueItems) { - hints.push('should not have duplicate items'); - } - - const hasAdditionalItems = typeof schema.additionalItems === 'undefined' || Boolean(schema.additionalItems); - let items = ''; - - if (schema.items) { - if (Array.isArray(schema.items) && schema.items.length > 0) { - items = `${ - /** @type {Array} */ - schema.items.map(item => formatInnerSchema(item)).join(', ')}`; - - if (hasAdditionalItems) { - if (schema.additionalItems && isObject(schema.additionalItems) && Object.keys(schema.additionalItems).length > 0) { - hints.push(`additional items should be ${formatInnerSchema(schema.additionalItems)}`); - } - } - } else if (schema.items && Object.keys(schema.items).length > 0) { - // "additionalItems" is ignored - items = `${formatInnerSchema(schema.items)}`; - } else { - // Fallback for empty `items` value - items = 'any'; - } - } else { - // "additionalItems" is ignored - items = 'any'; - } - - if (schema.contains && Object.keys(schema.contains).length > 0) { - hints.push(`should contains at least one ${this.formatSchema(schema.contains)} item`); - } - - return `[${items}${hasAdditionalItems ? ', ...' : ''}]${hints.length > 0 ? ` (${hints.join(', ')})` : ''}`; - } - - if (likeObject(schema)) { - // not logic already applied in formatValidationError - newLogic = true; - const hints = []; - - if (typeof schema.minProperties === 'number') { - hints.push(`should not have fewer than ${schema.minProperties} ${schema.minProperties > 1 ? 'properties' : 'property'}`); - } - - if (typeof schema.maxProperties === 'number') { - hints.push(`should not have more than ${schema.maxProperties} ${schema.minProperties && schema.minProperties > 1 ? 'properties' : 'property'}`); - } - - if (schema.patternProperties && Object.keys(schema.patternProperties).length > 0) { - const patternProperties = Object.keys(schema.patternProperties); - hints.push(`additional property names should match pattern${patternProperties.length > 1 ? 's' : ''} ${patternProperties.map(pattern => JSON.stringify(pattern)).join(' | ')}`); - } - - const properties = schema.properties ? Object.keys(schema.properties) : []; - const required = schema.required ? schema.required : []; - const allProperties = [...new Set( - /** @type {Array} */ - [].concat(required).concat(properties))]; - const objectStructure = allProperties.map(property => { - const isRequired = required.includes(property); // Some properties need quotes, maybe we should add check - // Maybe we should output type of property (`foo: string`), but it is looks very unreadable - - return `${property}${isRequired ? '' : '?'}`; - }).concat(typeof schema.additionalProperties === 'undefined' || Boolean(schema.additionalProperties) ? schema.additionalProperties && isObject(schema.additionalProperties) ? [`: ${formatInnerSchema(schema.additionalProperties)}`] : ['…'] : []).join(', '); - const { - dependencies, - propertyNames, - patternRequired - } = - /** @type {Schema & {patternRequired?: Array;}} */ - schema; - - if (dependencies) { - Object.keys(dependencies).forEach(dependencyName => { - const dependency = dependencies[dependencyName]; - - if (Array.isArray(dependency)) { - hints.push(`should have ${dependency.length > 1 ? 'properties' : 'property'} ${dependency.map(dep => `'${dep}'`).join(', ')} when property '${dependencyName}' is present`); - } else { - hints.push(`should be valid according to the schema ${formatInnerSchema(dependency)} when property '${dependencyName}' is present`); - } - }); - } - - if (propertyNames && Object.keys(propertyNames).length > 0) { - hints.push(`each property name should match format ${JSON.stringify(schema.propertyNames.format)}`); - } - - if (patternRequired && patternRequired.length > 0) { - hints.push(`should have property matching pattern ${patternRequired.map( - /** - * @param {string} item - * @returns {string} - */ - item => JSON.stringify(item))}`); - } - - return `object {${objectStructure ? ` ${objectStructure} ` : ''}}${hints.length > 0 ? ` (${hints.join(', ')})` : ''}`; - } - - if (likeNull(schema)) { - return `${logic ? '' : 'non-'}null`; - } - - if (Array.isArray(schema.type)) { - // not logic already applied in formatValidationError - return `${schema.type.join(' | ')}`; - } // Fallback for unknown keywords - // not logic already applied in formatValidationError - - /* istanbul ignore next */ - - - return JSON.stringify(schema, null, 2); - } - /** - * @param {Schema=} schemaPart - * @param {(boolean | Array)=} additionalPath - * @param {boolean=} needDot - * @param {boolean=} logic - * @returns {string} - */ - - - getSchemaPartText(schemaPart, additionalPath, needDot = false, logic = true) { - if (!schemaPart) { - return ''; - } - - if (Array.isArray(additionalPath)) { - for (let i = 0; i < additionalPath.length; i++) { - /** @type {Schema | undefined} */ - const inner = schemaPart[ - /** @type {keyof Schema} */ - additionalPath[i]]; - - if (inner) { - // eslint-disable-next-line no-param-reassign - schemaPart = inner; - } else { - break; - } - } - } - - while (schemaPart.$ref) { - // eslint-disable-next-line no-param-reassign - schemaPart = this.getSchemaPart(schemaPart.$ref); - } - - let schemaText = `${this.formatSchema(schemaPart, logic)}${needDot ? '.' : ''}`; - - if (schemaPart.description) { - schemaText += `\n-> ${schemaPart.description}`; - } - - return schemaText; - } - /** - * @param {Schema=} schemaPart - * @returns {string} - */ - - - getSchemaPartDescription(schemaPart) { - if (!schemaPart) { - return ''; - } - - while (schemaPart.$ref) { - // eslint-disable-next-line no-param-reassign - schemaPart = this.getSchemaPart(schemaPart.$ref); - } - - if (schemaPart.description) { - return `\n-> ${schemaPart.description}`; - } - - return ''; - } - /** - * @param {SchemaUtilErrorObject} error - * @returns {string} - */ - - - formatValidationError(error) { - const { - keyword, - dataPath: errorDataPath - } = error; - const dataPath = `${this.baseDataPath}${errorDataPath}`; - - switch (keyword) { - case 'type': - { - const { - parentSchema, - params - } = error; // eslint-disable-next-line default-case - - switch ( - /** @type {import("ajv").TypeParams} */ - params.type) { - case 'number': - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - - case 'integer': - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - - case 'string': - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - - case 'boolean': - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - - case 'array': - return `${dataPath} should be an array:\n${this.getSchemaPartText(parentSchema)}`; - - case 'object': - return `${dataPath} should be an object:\n${this.getSchemaPartText(parentSchema)}`; - - case 'null': - return `${dataPath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; - - default: - return `${dataPath} should be:\n${this.getSchemaPartText(parentSchema)}`; - } - } - - case 'instanceof': - { - const { - parentSchema - } = error; - return `${dataPath} should be an instance of ${this.getSchemaPartText(parentSchema, false, true)}`; - } - - case 'pattern': - { - const { - params, - parentSchema - } = error; - const { - pattern - } = - /** @type {import("ajv").PatternParams} */ - params; - return `${dataPath} should match pattern ${JSON.stringify(pattern)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case 'format': - { - const { - params, - parentSchema - } = error; - const { - format - } = - /** @type {import("ajv").FormatParams} */ - params; - return `${dataPath} should match format ${JSON.stringify(format)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case 'formatMinimum': - case 'formatMaximum': - { - const { - params, - parentSchema - } = error; - const { - comparison, - limit - } = - /** @type {import("ajv").ComparisonParams} */ - params; - return `${dataPath} should be ${comparison} ${JSON.stringify(limit)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case 'minimum': - case 'maximum': - case 'exclusiveMinimum': - case 'exclusiveMaximum': - { - const { - parentSchema, - params - } = error; - const { - comparison, - limit - } = - /** @type {import("ajv").ComparisonParams} */ - params; - const [, ...hints] = getHints( - /** @type {Schema} */ - parentSchema, true); - - if (hints.length === 0) { - hints.push(`should be ${comparison} ${limit}`); - } - - return `${dataPath} ${hints.join(' ')}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case 'multipleOf': - { - const { - params, - parentSchema - } = error; - const { - multipleOf - } = - /** @type {import("ajv").MultipleOfParams} */ - params; - return `${dataPath} should be multiple of ${multipleOf}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case 'patternRequired': - { - const { - params, - parentSchema - } = error; - const { - missingPattern - } = - /** @type {import("ajv").PatternRequiredParams} */ - params; - return `${dataPath} should have property matching pattern ${JSON.stringify(missingPattern)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case 'minLength': - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - - if (limit === 1) { - return `${dataPath} should be an non-empty string${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - const length = limit - 1; - return `${dataPath} should be longer than ${length} character${length > 1 ? 's' : ''}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case 'minItems': - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - - if (limit === 1) { - return `${dataPath} should be an non-empty array${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - return `${dataPath} should not have fewer than ${limit} items${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case 'minProperties': - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - - if (limit === 1) { - return `${dataPath} should be an non-empty object${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - return `${dataPath} should not have fewer than ${limit} properties${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case 'maxLength': - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - const max = limit + 1; - return `${dataPath} should be shorter than ${max} character${max > 1 ? 's' : ''}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case 'maxItems': - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - return `${dataPath} should not have more than ${limit} items${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case 'maxProperties': - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - return `${dataPath} should not have more than ${limit} properties${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case 'uniqueItems': - { - const { - params, - parentSchema - } = error; - const { - i - } = - /** @type {import("ajv").UniqueItemsParams} */ - params; - return `${dataPath} should not contain the item '${error.data[i]}' twice${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case 'additionalItems': - { - const { - params, - parentSchema - } = error; - const { - limit - } = - /** @type {import("ajv").LimitParams} */ - params; - return `${dataPath} should not have more than ${limit} items${getSchemaNonTypes(parentSchema)}. These items are valid:\n${this.getSchemaPartText(parentSchema)}`; - } - - case 'contains': - { - const { - parentSchema - } = error; - return `${dataPath} should contains at least one ${this.getSchemaPartText(parentSchema, ['contains'])} item${getSchemaNonTypes(parentSchema)}.`; - } - - case 'required': - { - const { - parentSchema, - params - } = error; - const missingProperty = - /** @type {import("ajv").DependenciesParams} */ - params.missingProperty.replace(/^\./, ''); - const hasProperty = parentSchema && Boolean( - /** @type {Schema} */ - parentSchema.properties && - /** @type {Schema} */ - parentSchema.properties[missingProperty]); - return `${dataPath} misses the property '${missingProperty}'${getSchemaNonTypes(parentSchema)}.${hasProperty ? ` Should be:\n${this.getSchemaPartText(parentSchema, ['properties', missingProperty])}` : this.getSchemaPartDescription(parentSchema)}`; - } - - case 'additionalProperties': - { - const { - params, - parentSchema - } = error; - const { - additionalProperty - } = - /** @type {import("ajv").AdditionalPropertiesParams} */ - params; - return `${dataPath} has an unknown property '${additionalProperty}'${getSchemaNonTypes(parentSchema)}. These properties are valid:\n${this.getSchemaPartText(parentSchema)}`; - } - - case 'dependencies': - { - const { - params, - parentSchema - } = error; - const { - property, - deps - } = - /** @type {import("ajv").DependenciesParams} */ - params; - const dependencies = deps.split(',').map( - /** - * @param {string} dep - * @returns {string} - */ - dep => `'${dep.trim()}'`).join(', '); - return `${dataPath} should have properties ${dependencies} when property '${property}' is present${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case 'propertyNames': - { - const { - params, - parentSchema, - schema - } = error; - const { - propertyName - } = - /** @type {import("ajv").PropertyNamesParams} */ - params; - return `${dataPath} property name '${propertyName}' is invalid${getSchemaNonTypes(parentSchema)}. Property names should be match format ${JSON.stringify(schema.format)}.${this.getSchemaPartDescription(parentSchema)}`; - } - - case 'enum': - { - const { - parentSchema - } = error; - - if (parentSchema && - /** @type {Schema} */ - parentSchema.enum && - /** @type {Schema} */ - parentSchema.enum.length === 1) { - return `${dataPath} should be ${this.getSchemaPartText(parentSchema, false, true)}`; - } - - return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}`; - } - - case 'const': - { - const { - parentSchema - } = error; - return `${dataPath} should be equal to constant ${this.getSchemaPartText(parentSchema, false, true)}`; - } - - case 'not': - { - const postfix = likeObject( - /** @type {Schema} */ - error.parentSchema) ? `\n${this.getSchemaPartText(error.parentSchema)}` : ''; - const schemaOutput = this.getSchemaPartText(error.schema, false, false, false); - - if (canApplyNot(error.schema)) { - return `${dataPath} should be any ${schemaOutput}${postfix}.`; - } - - const { - schema, - parentSchema - } = error; - return `${dataPath} should not be ${this.getSchemaPartText(schema, false, true)}${parentSchema && likeObject(parentSchema) ? `\n${this.getSchemaPartText(parentSchema)}` : ''}`; - } - - case 'oneOf': - case 'anyOf': - { - const { - parentSchema, - children - } = error; - - if (children && children.length > 0) { - if (error.schema.length === 1) { - const lastChild = children[children.length - 1]; - const remainingChildren = children.slice(0, children.length - 1); - return this.formatValidationError(Object.assign({}, lastChild, { - children: remainingChildren, - parentSchema: Object.assign({}, parentSchema, lastChild.parentSchema) - })); - } - - let filteredChildren = filterChildren(children); - - if (filteredChildren.length === 1) { - return this.formatValidationError(filteredChildren[0]); - } - - filteredChildren = groupChildrenByFirstChild(filteredChildren); - return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}\nDetails:\n${filteredChildren.map( - /** - * @param {SchemaUtilErrorObject} nestedError - * @returns {string} - */ - nestedError => ` * ${indent(this.formatValidationError(nestedError), ' ')}`).join('\n')}`; - } - - return `${dataPath} should be one of these:\n${this.getSchemaPartText(parentSchema)}`; - } - - case 'if': - { - const { - params, - parentSchema - } = error; - const { - failingKeyword - } = - /** @type {import("ajv").IfParams} */ - params; - return `${dataPath} should match "${failingKeyword}" schema:\n${this.getSchemaPartText(parentSchema, [failingKeyword])}`; - } - - case 'absolutePath': - { - const { - message, - parentSchema - } = error; - return `${dataPath}: ${message}${this.getSchemaPartDescription(parentSchema)}`; - } - - /* istanbul ignore next */ - - default: - { - const { - message, - parentSchema - } = error; - const ErrorInJSON = JSON.stringify(error, null, 2); // For `custom`, `false schema`, `$ref` keywords - // Fallback for unknown keywords - - return `${dataPath} ${message} (${ErrorInJSON}).\n${this.getSchemaPartText(parentSchema, false)}`; - } - } - } - /** - * @param {Array} errors - * @returns {string} - */ - - - formatValidationErrors(errors) { - return errors.map(error => { - let formattedError = this.formatValidationError(error); - - if (this.postFormatter) { - formattedError = this.postFormatter(formattedError, error); - } - - return ` - ${indent(formattedError, ' ')}`; - }).join('\n'); - } - -} - -var _default = ValidationError; -exports.default = _default; \ No newline at end of file diff --git a/node_modules/babel-loader/node_modules/schema-utils/dist/index.js b/node_modules/babel-loader/node_modules/schema-utils/dist/index.js deleted file mode 100644 index e7c679174..000000000 --- a/node_modules/babel-loader/node_modules/schema-utils/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; - -const validate = require('./validate'); - -module.exports = validate.default; \ No newline at end of file diff --git a/node_modules/babel-loader/node_modules/schema-utils/dist/util/hints.js b/node_modules/babel-loader/node_modules/schema-utils/dist/util/hints.js deleted file mode 100644 index afa00d543..000000000 --- a/node_modules/babel-loader/node_modules/schema-utils/dist/util/hints.js +++ /dev/null @@ -1,105 +0,0 @@ -"use strict"; - -const Range = require('./Range'); -/** @typedef {import("../validate").Schema} Schema */ - -/** - * @param {Schema} schema - * @param {boolean} logic - * @return {string[]} - */ - - -module.exports.stringHints = function stringHints(schema, logic) { - const hints = []; - let type = 'string'; - const currentSchema = { ...schema - }; - - if (!logic) { - const tmpLength = currentSchema.minLength; - const tmpFormat = currentSchema.formatMinimum; - const tmpExclusive = currentSchema.formatExclusiveMaximum; - currentSchema.minLength = currentSchema.maxLength; - currentSchema.maxLength = tmpLength; - currentSchema.formatMinimum = currentSchema.formatMaximum; - currentSchema.formatMaximum = tmpFormat; - currentSchema.formatExclusiveMaximum = !currentSchema.formatExclusiveMinimum; - currentSchema.formatExclusiveMinimum = !tmpExclusive; - } - - if (typeof currentSchema.minLength === 'number') { - if (currentSchema.minLength === 1) { - type = 'non-empty string'; - } else { - const length = Math.max(currentSchema.minLength - 1, 0); - hints.push(`should be longer than ${length} character${length > 1 ? 's' : ''}`); - } - } - - if (typeof currentSchema.maxLength === 'number') { - if (currentSchema.maxLength === 0) { - type = 'empty string'; - } else { - const length = currentSchema.maxLength + 1; - hints.push(`should be shorter than ${length} character${length > 1 ? 's' : ''}`); - } - } - - if (currentSchema.pattern) { - hints.push(`should${logic ? '' : ' not'} match pattern ${JSON.stringify(currentSchema.pattern)}`); - } - - if (currentSchema.format) { - hints.push(`should${logic ? '' : ' not'} match format ${JSON.stringify(currentSchema.format)}`); - } - - if (currentSchema.formatMinimum) { - hints.push(`should be ${currentSchema.formatExclusiveMinimum ? '>' : '>='} ${JSON.stringify(currentSchema.formatMinimum)}`); - } - - if (currentSchema.formatMaximum) { - hints.push(`should be ${currentSchema.formatExclusiveMaximum ? '<' : '<='} ${JSON.stringify(currentSchema.formatMaximum)}`); - } - - return [type].concat(hints); -}; -/** - * @param {Schema} schema - * @param {boolean} logic - * @return {string[]} - */ - - -module.exports.numberHints = function numberHints(schema, logic) { - const hints = [schema.type === 'integer' ? 'integer' : 'number']; - const range = new Range(); - - if (typeof schema.minimum === 'number') { - range.left(schema.minimum); - } - - if (typeof schema.exclusiveMinimum === 'number') { - range.left(schema.exclusiveMinimum, true); - } - - if (typeof schema.maximum === 'number') { - range.right(schema.maximum); - } - - if (typeof schema.exclusiveMaximum === 'number') { - range.right(schema.exclusiveMaximum, true); - } - - const rangeFormat = range.format(logic); - - if (rangeFormat) { - hints.push(rangeFormat); - } - - if (typeof schema.multipleOf === 'number') { - hints.push(`should${logic ? '' : ' not'} be multiple of ${schema.multipleOf}`); - } - - return hints; -}; \ No newline at end of file diff --git a/node_modules/babel-loader/node_modules/schema-utils/package.json b/node_modules/babel-loader/node_modules/schema-utils/package.json deleted file mode 100644 index 009d5349d..000000000 --- a/node_modules/babel-loader/node_modules/schema-utils/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "schema-utils", - "version": "2.7.1", - "description": "webpack Validation Utils", - "license": "MIT", - "repository": "webpack/schema-utils", - "author": "webpack Contrib (https://github.com/webpack-contrib)", - "homepage": "https://github.com/webpack/schema-utils", - "bugs": "https://github.com/webpack/schema-utils/issues", - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - }, - "main": "dist/index.js", - "types": "declarations/index.d.ts", - "engines": { - "node": ">= 8.9.0" - }, - "scripts": { - "start": "npm run build -- -w", - "clean": "del-cli dist declarations", - "prebuild": "npm run clean", - "build:types": "tsc --declaration --emitDeclarationOnly --outDir declarations && prettier \"declarations/**/*.ts\" --write", - "build:code": "cross-env NODE_ENV=production babel src -d dist --copy-files", - "build": "npm-run-all -p \"build:**\"", - "commitlint": "commitlint --from=master", - "security": "npm audit", - "lint:prettier": "prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different", - "lint:js": "eslint --cache .", - "lint:types": "tsc --pretty --noEmit", - "lint": "npm-run-all -l -p \"lint:**\"", - "test:only": "cross-env NODE_ENV=test jest", - "test:watch": "npm run test:only -- --watch", - "test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage", - "pretest": "npm run lint", - "test": "npm run test:coverage", - "prepare": "npm run build", - "release": "standard-version", - "defaults": "webpack-defaults" - }, - "files": [ - "dist", - "declarations" - ], - "dependencies": { - "ajv": "^6.12.4", - "ajv-keywords": "^3.5.2", - "@types/json-schema": "^7.0.5" - }, - "devDependencies": { - "@babel/cli": "^7.10.5", - "@babel/core": "^7.11.4", - "@babel/preset-env": "^7.11.0", - "@commitlint/cli": "^10.0.0", - "@commitlint/config-conventional": "^10.0.0", - "@webpack-contrib/defaults": "^6.3.0", - "@webpack-contrib/eslint-config-webpack": "^3.0.0", - "babel-jest": "^25.5.1", - "cross-env": "^6.0.3", - "del": "^5.1.0", - "del-cli": "^3.0.1", - "eslint": "^7.7.0", - "eslint-config-prettier": "^6.11.0", - "eslint-plugin-import": "^2.22.0", - "husky": "^4.2.5", - "jest": "^25.5.4", - "lint-staged": "^10.2.13", - "npm-run-all": "^4.1.5", - "prettier": "^1.19.1", - "standard-version": "^9.0.0", - "typescript": "^4.0.2" - }, - "keywords": [ - "webpack" - ] -} diff --git a/node_modules/babel-loader/package.json b/node_modules/babel-loader/package.json index 8bad0a5d3..c7d6c5e4d 100644 --- a/node_modules/babel-loader/package.json +++ b/node_modules/babel-loader/package.json @@ -1,33 +1,31 @@ { "name": "babel-loader", - "version": "8.2.5", + "version": "9.1.0", "description": "babel module loader for webpack", "files": [ "lib" ], "main": "lib/index.js", "engines": { - "node": ">= 8.9" + "node": ">= 14.15.0" }, "dependencies": { - "find-cache-dir": "^3.3.1", - "loader-utils": "^2.0.0", - "make-dir": "^3.1.0", - "schema-utils": "^2.6.5" + "find-cache-dir": "^3.3.2", + "schema-utils": "^4.0.0" }, "peerDependencies": { - "@babel/core": "^7.0.0", - "webpack": ">=2" + "@babel/core": "^7.12.0", + "webpack": ">=5" }, "devDependencies": { "@ava/babel": "^1.0.1", - "@babel/cli": "^7.12.1", - "@babel/core": "^7.12.3", - "@babel/preset-env": "^7.12.1", + "@babel/cli": "^7.19.3", + "@babel/core": "^7.19.6", + "@babel/preset-env": "^7.19.4", "ava": "^3.13.0", - "babel-eslint": "^10.0.1", - "babel-plugin-istanbul": "^6.0.0", - "babel-plugin-react-intl": "^8.2.15", + "babel-eslint": "^10.1.0", + "babel-plugin-istanbul": "^6.1.1", + "babel-plugin-react-intl": "^8.2.25", "cross-env": "^7.0.2", "eslint": "^7.13.0", "eslint-config-babel": "^9.0.0", @@ -44,7 +42,7 @@ "react-intl-webpack-plugin": "^0.3.0", "rimraf": "^3.0.0", "semver": "7.3.2", - "webpack": "^5.34.0" + "webpack": "^5.74.0" }, "scripts": { "clean": "rimraf lib/", @@ -120,5 +118,8 @@ "node ./scripts/yarn-install.js", "git add yarn.lock" ] + }, + "resolutions": { + "nyc/node-preload": "0.2.0" } } \ No newline at end of file diff --git a/node_modules/babel-plugin-dynamic-import-node/.babelrc b/node_modules/babel-plugin-dynamic-import-node/.babelrc deleted file mode 100644 index e68723477..000000000 --- a/node_modules/babel-plugin-dynamic-import-node/.babelrc +++ /dev/null @@ -1,9 +0,0 @@ -{ - "presets": [ - "airbnb" - ], - "plugins": [ - "add-module-exports", - ["transform-replace-object-assign", { "moduleSpecifier": "object.assign" }], - ], -} diff --git a/node_modules/babel-plugin-dynamic-import-node/.eslintignore b/node_modules/babel-plugin-dynamic-import-node/.eslintignore deleted file mode 100644 index 051cd482a..000000000 --- a/node_modules/babel-plugin-dynamic-import-node/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -test/fixtures -lib/ diff --git a/node_modules/babel-plugin-dynamic-import-node/.eslintrc b/node_modules/babel-plugin-dynamic-import-node/.eslintrc deleted file mode 100644 index 391ada0a8..000000000 --- a/node_modules/babel-plugin-dynamic-import-node/.eslintrc +++ /dev/null @@ -1,5 +0,0 @@ -{ - "parser": "babel-eslint", - "extends": "airbnb-base", - "root": true -} diff --git a/node_modules/babel-plugin-dynamic-import-node/.travis.yml b/node_modules/babel-plugin-dynamic-import-node/.travis.yml deleted file mode 100644 index 087e932a2..000000000 --- a/node_modules/babel-plugin-dynamic-import-node/.travis.yml +++ /dev/null @@ -1,38 +0,0 @@ -language: node_js -node_js: - - "13" - - "12" - - "11" - - "10" - - "9" - - "8" - - "7" - - "6" - - "5" - - "4" - - "iojs-v3" - - "iojs-v2" - - "iojs-v1" - - "0.12" -import: - - ljharb/travis-ci:node/latest-npm.yml - - ljharb/travis-ci:node/greenkeeper.yml - - ljharb/travis-ci:node/dependabot.yml -script: 'npm run tests-only' -sudo: false -env: - - TEST=true -matrix: - fast_finish: true - include: - - node_js: "lts/*" - env: PRETEST=true - script: 'npm run pretest' - allow_failures: - - node_js: "9" - - node_js: "7" - - node_js: "5" - - node_js: "iojs-v3" - - node_js: "iojs-v2" - - node_js: "iojs-v1" - - env: TEST=true ALLOW_FAILURE=true diff --git a/node_modules/babel-plugin-dynamic-import-node/CHANGELOG.md b/node_modules/babel-plugin-dynamic-import-node/CHANGELOG.md deleted file mode 100644 index 4cba133ab..000000000 --- a/node_modules/babel-plugin-dynamic-import-node/CHANGELOG.md +++ /dev/null @@ -1,64 +0,0 @@ -## Unreleased - -## v2.3.3 -- [Fix] Generate webpack-compatible output with static string arg (#84) -- [Fix] Handle visiting the same path gracefully (#71) - -## v2.3.2 -- [Fix] avoid using reserved param name in babel 7 templates -- [Dev Deps] update `airbnb-js-shims` - -## v2.3.1 -- [Fix] Evaluate `import()` argument synchronously (#85) -- [Dev Deps] update `eslint`, `eslint-config-airbnb-base`, `in-publish`, `rimraf`, `safe-publish-latest`, `tape` - -## v2.3.0 -- [New] expose createDynamicImportTransform and getImportSource (#75) -- [Docs] Document noInterop option (#70) - -## v2.2.0 -- [Refactor] remove dependency on babel-plugin-syntax-dynamic-import -- [Dev Deps] update `airbnb-js-shims`, `babel-preset-airbnb`, `eslint` - -## v2.1.0 -- [New] add `noInterop` option (#57) -- [Docs] Fix typo "correct" -> "correctly" in readme (#55) -- [Dev Deps] update `airbnb-js-shims`, `babel-eslint`, `babel-preset-airbnb`, `eslint`, `eslint-config-airbnb-base`, `eslint-plugin-import`, `safe-publish-latest` - -## v2.0.0 -- [Breaking] always return a module namespace object (#52, #47) -- [Breaking] remove `.default` on entry points (#27) -- [Docs] removed $ before npm command (#35) -- [Docs] Improve README.md with a code example (#41) -- [Dev Deps] update `airbnb-js-shims`, `babel-core`, `babel-eslint`, `eslint`, `eslint-plugin-import` -- [Tests] switch from mocha to tape, so we can support older nodes - -## v1.2.0 -- [New] support comments (#37) -- [Refactor] Use template and types from the babel object (#32) -- [Tests] on `node` `v9`; pin included builds to LTS -- [Dev Deps] update `eslint`, `eslint-config-airbnb-base`, `mocha`, `rimraf` - -## v1.1.0 -- Visit Import nodes instead of CallExpressions (#30) -- [Deps] update `babel-template`, `babel-types` -- [Dev Deps] update `airbnb-js-shims`, `babel-cli`, `babel-core`, `babel-preset-airbnb`, `babel-register`, `chai`, `eslint`, `eslint-config-airbnb-base`, `eslint-plugin-import`, `mocha` -- [Tests] on `node` `v8` -- [Tests] use `nvm install-latest-npm` so newer npm doesn’t break older node - -## v1.0.2 -- [Fix] Ensure it works with the ES2015 preset too (#12, #16) -- [Deps] update `babel-template`, `babel-types` -- [Dev Deps] update `babel-cli`, `babel-core`, `babel-eslint`, `babel-register`, `eslint`, `eslint-config-airbnb-base`, `mocha` - -## v1.0.1 -- [Fix] Move `in-publish` to devDeps (#11) -- [Fix] ensure dynamic `import()` input is properly stringified (#2) -- [Fix] async timing of dynamic import to match spec (#3) -- [Fix] Remove spaces in template strings and update Babel (#10) -- [Deps] update `babel-template`, `babel-types` -- [Deps] update `babel-types` (#4, #5, #6) -- [Dev Deps] update `babel-cli`, `babel-core`, `babel-eslint`, `babel-register`, `eslint`, `eslint-config-airbnb-base`, `eslint-plugin-import`, `mocha`, `rimraf` - -## v1.0.0 -- Initial full release. diff --git a/node_modules/babel-plugin-dynamic-import-node/LICENSE b/node_modules/babel-plugin-dynamic-import-node/LICENSE deleted file mode 100644 index 87081c133..000000000 --- a/node_modules/babel-plugin-dynamic-import-node/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2016 Airbnb - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/babel-plugin-dynamic-import-node/README.md b/node_modules/babel-plugin-dynamic-import-node/README.md deleted file mode 100644 index 2f2a21641..000000000 --- a/node_modules/babel-plugin-dynamic-import-node/README.md +++ /dev/null @@ -1,63 +0,0 @@ -# babel-plugin-dynamic-import-node - -Babel plugin to transpile `import()` to a deferred `require()`, for node. Matches the [proposed spec](https://github.com/domenic/proposal-import-function). - -**NOTE:** Babylon >= v6.12.0 is required to correctly parse dynamic imports. - -## Installation - -```sh -npm install babel-plugin-dynamic-import-node --save-dev -``` - -## Usage - -### Via `.babelrc` (Recommended) - -**.babelrc** - -```json -{ - "plugins": ["dynamic-import-node"] -} -``` - -#### Options - -- *`noInterop`* - A boolean value, that if true will not interop the require calls. Useful to avoid using `require('module').default` on commonjs modules. - -```json -{ - "plugins": [ - ["dynamic-import-node", { "noInterop": true }] - ] -} -``` - -### Via CLI - -```sh -$ babel --plugins dynamic-import-node script.js -``` - -### Via Node API - -```javascript -require('babel-core').transform('code', { - plugins: ['dynamic-import-node'] -}); -``` - -### Code Example -```javascript -Promise.all([ - import('./lib/import1'), - import('./lib/import2') - ]).then(([ - Import1, - Import2 - ]) => { - console.log(Import1); - /* CODE HERE*/ - }); -``` diff --git a/node_modules/babel-plugin-dynamic-import-node/lib/index.js b/node_modules/babel-plugin-dynamic-import-node/lib/index.js deleted file mode 100644 index a46654b56..000000000 --- a/node_modules/babel-plugin-dynamic-import-node/lib/index.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -exports['default'] = function (api) { - var transformImport = (0, _utils.createDynamicImportTransform)(api); - - return { - // NOTE: Once we drop support for Babel <= v6 we should - // update this to import from @babel/plugin-syntax-dynamic-import. - // https://www.npmjs.com/package/@babel/plugin-syntax-dynamic-import - manipulateOptions: function () { - function manipulateOptions(opts, parserOpts) { - parserOpts.plugins.push('dynamicImport'); - } - - return manipulateOptions; - }(), - - - visitor: { - Import: function () { - function Import(path) { - transformImport(this, path); - } - - return Import; - }() - } - }; -}; - -var _utils = require('./utils'); - -module.exports = exports['default']; \ No newline at end of file diff --git a/node_modules/babel-plugin-dynamic-import-node/lib/utils.js b/node_modules/babel-plugin-dynamic-import-node/lib/utils.js deleted file mode 100644 index 832a247c3..000000000 --- a/node_modules/babel-plugin-dynamic-import-node/lib/utils.js +++ /dev/null @@ -1,63 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); - -exports.getImportSource = getImportSource; -exports.createDynamicImportTransform = createDynamicImportTransform; -function getImportSource(t, callNode) { - var importArguments = callNode.arguments; - - var _importArguments = _slicedToArray(importArguments, 1), - importPath = _importArguments[0]; - - var isString = t.isStringLiteral(importPath) || t.isTemplateLiteral(importPath); - if (isString) { - t.removeComments(importPath); - return importPath; - } - - return t.templateLiteral([t.templateElement({ raw: '', cooked: '' }), t.templateElement({ raw: '', cooked: '' }, true)], importArguments); -} - -function createDynamicImportTransform(_ref) { - var template = _ref.template, - t = _ref.types; - - var builders = { - 'static': { - interop: template('Promise.resolve().then(() => INTEROP(require(SOURCE)))'), - noInterop: template('Promise.resolve().then(() => require(SOURCE))') - }, - dynamic: { - interop: template('Promise.resolve(SOURCE).then(s => INTEROP(require(s)))'), - noInterop: template('Promise.resolve(SOURCE).then(s => require(s))') - } - }; - - var visited = typeof WeakSet === 'function' && new WeakSet(); - - var isString = function isString(node) { - return t.isStringLiteral(node) || t.isTemplateLiteral(node) && node.expressions.length === 0; - }; - - return function (context, path) { - if (visited) { - if (visited.has(path)) { - return; - } - visited.add(path); - } - - var SOURCE = getImportSource(t, path.parent); - - var builder = isString(SOURCE) ? builders['static'] : builders.dynamic; - - var newImport = context.opts.noInterop ? builder.noInterop({ SOURCE: SOURCE }) : builder.interop({ SOURCE: SOURCE, INTEROP: context.addHelper('interopRequireWildcard') }); - - path.parentPath.replaceWith(newImport); - }; -} \ No newline at end of file diff --git a/node_modules/babel-plugin-dynamic-import-node/package.json b/node_modules/babel-plugin-dynamic-import-node/package.json deleted file mode 100644 index 4182c0e8d..000000000 --- a/node_modules/babel-plugin-dynamic-import-node/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "babel-plugin-dynamic-import-node", - "version": "2.3.3", - "description": "Babel plugin to transpile import() to a deferred require(), for node", - "main": "lib/index.js", - "directories": { - "test": "test" - }, - "scripts": { - "clean": "rimraf lib", - "prebuild": "npm run clean", - "build": "babel src --out-dir lib", - "pretest": "npm run lint", - "test": "npm run tests-only", - "tests-only": "tape --require airbnb-js-shims --require babel-register test", - "lint": "eslint .", - "prepublish": "not-in-publish || (safe-publish-latest && npm run build)", - "check-changelog": "expr $(git status --porcelain 2>/dev/null| grep \"^\\s*M.*CHANGELOG.md\" | wc -l) >/dev/null || (echo 'Please edit CHANGELOG.md' && exit 1)", - "check-only-changelog-changed": "(expr $(git status --porcelain 2>/dev/null| grep -v \"CHANGELOG.md\" | wc -l) >/dev/null && echo 'Only CHANGELOG.md may have uncommitted changes' && exit 1) || exit 0", - "version:major": "npm --no-git-tag-version version major", - "version:minor": "npm --no-git-tag-version version minor", - "version:patch": "npm --no-git-tag-version version patch", - "postversion": "git commit package.json CHANGELOG.md -m \"v$npm_package_version\" && npm run tag && git push && git push --tags", - "preversion": "npm run test && npm run check-changelog && npm run check-only-changelog-changed", - "tag": "git tag v$npm_package_version" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/airbnb/babel-plugin-dynamic-import-node.git" - }, - "keywords": [ - "babel", - "plugin", - "dynamic", - "import", - "node" - ], - "author": "Jordan Gensler ", - "license": "MIT", - "bugs": { - "url": "https://github.com/airbnb/babel-plugin-dynamic-import-node/issues" - }, - "homepage": "https://github.com/airbnb/babel-plugin-dynamic-import-node#readme", - "devDependencies": { - "@babel/core": "^7.9.0", - "@babel/plugin-external-helpers": "^7.8.3", - "@babel/plugin-transform-template-literals": "^7.8.3", - "@babel/preset-env": "^7.9.5", - "airbnb-js-shims": "^2.2.1", - "babel-cli": "^6.26.0", - "babel-core": "^6.26.3", - "babel-eslint": "^9.0.0", - "babel-plugin-add-module-exports": "^0.2.1", - "babel-plugin-external-helpers": "^6.22.0", - "babel-plugin-transform-es2015-template-literals": "^6.22.0", - "babel-plugin-transform-replace-object-assign": "^1.0.0", - "babel-preset-airbnb": "^2.6.0", - "babel-preset-es2015": "^6.24.1", - "babel-register": "^6.26.0", - "eslint": "^6.8.0", - "eslint-config-airbnb-base": "^14.1.0", - "eslint-plugin-import": "^2.20.2", - "in-publish": "^2.0.1", - "rimraf": "^2.7.1", - "safe-publish-latest": "^1.1.4", - "tape": "^5.0.0-next.5" - }, - "dependencies": { - "object.assign": "^4.1.0" - } -} diff --git a/node_modules/babel-plugin-dynamic-import-node/utils.js b/node_modules/babel-plugin-dynamic-import-node/utils.js deleted file mode 100644 index 1dc2e6cca..000000000 --- a/node_modules/babel-plugin-dynamic-import-node/utils.js +++ /dev/null @@ -1,6 +0,0 @@ -// Re-export lib/utils, so that consumers can import -// babel-plugin-dynamic-import-node/utils instead of -// babel-plugin-dynamic-import-node/lib/utils - -// eslint-disable-next-line import/no-unresolved -module.exports = require('./lib/utils'); diff --git a/node_modules/big.js/CHANGELOG.md b/node_modules/big.js/CHANGELOG.md deleted file mode 100644 index 86262555f..000000000 --- a/node_modules/big.js/CHANGELOG.md +++ /dev/null @@ -1,146 +0,0 @@ -#### 5.2.2 - -* 18/10/18 -* #109 Remove opencollective dependency. - -#### 5.2.1 - -* Delete *bower.json*. - -#### 5.2.0 - -* 09/10/18 -* #63 Allow negative argument for `round`. -* #107 `sqrt` of large number. - -#### 5.1.2 - -* 24/05/18 -* #95 Add `browser` field to *package.json*. -* Restore named export to enable `import {Big}`. - -#### 5.1.1 - -* 22/05/18 -* #95 Remove named export. - -#### 5.1.0 - -* 22/05/18 -* Amend *.mjs* exports. -* Remove extension from `main` field in *package.json*. - -#### 5.0.3 - -* 23/10/17 -* #89 Optimisation of internal `round` function. - -#### 5.0.2 - -* 13/10/17 -* Update *README.md*. - -#### 5.0.1 - -* 13/10/17 -* Correct `Big.version` number. - -#### 5.0.0 - -* 13/10/17 -* Return `-0` from `valueOf` for negative zero. -* Refactor the methods which return a string. -* Amend error messaging. -* Update API document and change its colour scheme. -* Add `Big.version`. -* Remove bitcoin address. - -#### 4.0.2 - -* 28/09/17 -* Add *big.mjs* for use with Node.js with `--experimental-modules` flag. - -#### 4.0.0 - -* 27/09/17 -* Rename `Big.E_POS` to `Big.PE`, `Big.E_NEG` to `Big.NE`. -* Refactor error messaging. -* Throw if `null` is passed to `toFixed` etc. - -#### 3.2.0 - -* 14/09/17 Aid ES6 import. - -#### 3.1.3 - -* Minor documentation updates. - -#### 3.1.2 - -* README typo. - -#### 3.1.1 - -* API documentation update, including FAQ additions. - -#### 3.1.0 - -* Renamed and exposed `TO_EXP_NEG` and `TO_EXP_POS` as `Big.E_NEG` and `Big.E_POS`. - -#### 3.0.2 - -* Remove *.npmignore*, use `files` field in *package.json* instead. - -#### 3.0.1 - -* Added `sub`, `add` and `mul` aliases. -* Clean-up after lint. - -#### 3.0.0 - -* 10/12/14 Added [multiple constructor functionality](http://mikemcl.github.io/big.js/#faq). -* No breaking changes or other additions, but a major code reorganisation, so *v3* seemed appropiate. - -#### 2.5.2 - -* 1/11/14 Added bower.json. - -#### 2.5.1 - -* 8/06/14 Amend README requires. - -#### 2.5.0 - -* 26/01/14 Added `toJSON` method so serialization uses `toString`. - -#### 2.4.1 - -* 17/10/13 Conform signed zero to IEEEE 754 (2008). - -#### 2.4.0 - -* 19/09/13 Throw instances of `Error`. - -#### 2.3.0 - -* 16/09/13 Added `cmp` method. - -#### 2.2.0 - -* 11/07/13 Added 'round up' mode. - -#### 2.1.0 - -* 26/06/13 Allow e.g. `.1` and `2.`. - -#### 2.0.0 - -* 12/05/13 Added `abs` method and replaced `cmp` with `eq`, `gt`, `gte`, `lt`, and `lte` methods. - -#### 1.0.1 - -* Changed default value of MAX_DP to 1E6 - -#### 1.0.0 - -* 7/11/2012 Initial release diff --git a/node_modules/big.js/LICENCE b/node_modules/big.js/LICENCE deleted file mode 100644 index f7e12c838..000000000 --- a/node_modules/big.js/LICENCE +++ /dev/null @@ -1,23 +0,0 @@ -The MIT Licence (Expat). - -Copyright (c) 2018 Michael Mclaughlin - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - diff --git a/node_modules/big.js/README.md b/node_modules/big.js/README.md deleted file mode 100644 index 8d103e6f9..000000000 --- a/node_modules/big.js/README.md +++ /dev/null @@ -1,201 +0,0 @@ -# big.js - -**A small, fast JavaScript library for arbitrary-precision decimal arithmetic.** - -The little sister to [bignumber.js](https://github.com/MikeMcl/bignumber.js/) and [decimal.js](https://github.com/MikeMcl/decimal.js/). See [here](https://github.com/MikeMcl/big.js/wiki) for some notes on the difference between them. - -## Features - - - Faster, smaller and easier-to-use than JavaScript versions of Java's BigDecimal - - Only 5.9 KB minified and 2.7 KB gzipped - - Simple API - - Replicates the `toExponential`, `toFixed` and `toPrecision` methods of JavaScript's Number type - - Includes a `sqrt` method - - Stores values in an accessible decimal floating point format - - No dependencies - - Comprehensive [documentation](http://mikemcl.github.io/big.js/) and test set - -## Set up - -The library is the single JavaScript file *big.js* (or *big.min.js*, which is *big.js* minified). - -Browser: - -```html - -``` - -[Node.js](http://nodejs.org): - -```bash -$ npm install big.js -``` - -```javascript -const Big = require('big.js'); -``` - -ES6 module: - -```javascript -import Big from 'big.mjs'; -``` -## Use - -*In all examples below, `var`, semicolons and `toString` calls are not shown. If a commented-out value is in quotes it means `toString` has been called on the preceding expression.* - -The library exports a single function, `Big`, the constructor of Big number instances. -It accepts a value of type number, string or Big number object. - - x = new Big(123.4567) - y = Big('123456.7e-3') // 'new' is optional - z = new Big(x) - x.eq(y) && x.eq(z) && y.eq(z) // true - -A Big number is immutable in the sense that it is not changed by its methods. - - 0.3 - 0.1 // 0.19999999999999998 - x = new Big(0.3) - x.minus(0.1) // "0.2" - x // "0.3" - -The methods that return a Big number can be chained. - - x.div(y).plus(z).times(9).minus('1.234567801234567e+8').plus(976.54321).div('2598.11772') - x.sqrt().div(y).pow(3).gt(y.mod(z)) // true - -Like JavaScript's Number type, there are `toExponential`, `toFixed` and `toPrecision` methods. - - x = new Big(255.5) - x.toExponential(5) // "2.55500e+2" - x.toFixed(5) // "255.50000" - x.toPrecision(5) // "255.50" - -The arithmetic methods always return the exact result except `div`, `sqrt` and `pow` -(with negative exponent), as these methods involve division. - -The maximum number of decimal places and the rounding mode used to round the results of these methods is determined by the value of the `DP` and `RM` properties of the `Big` number constructor. - - Big.DP = 10 - Big.RM = 1 - - x = new Big(2); - y = new Big(3); - z = x.div(y) // "0.6666666667" - z.sqrt() // "0.8164965809" - z.pow(-3) // "3.3749999995" - z.times(z) // "0.44444444448888888889" - z.times(z).round(10) // "0.4444444445" - -Multiple Big number constructors can be created, each with an independent configuration. - -The value of a Big number is stored in a decimal floating point format in terms of a coefficient, exponent and sign. - - x = new Big(-123.456); - x.c // [1,2,3,4,5,6] coefficient (i.e. significand) - x.e // 2 exponent - x.s // -1 sign - -For further information see the [API](http://mikemcl.github.io/big.js/) reference from the *doc* folder. - -## Test - -The *test* directory contains the test scripts for each Big number method. - -The tests can be run with Node.js or a browser. - -To run all the tests - - $ npm test - -To test a single method - - $ node test/toFixed - -For the browser, see *single-test.html* and *every-test.html* in the *test/browser* directory. - -*big-vs-number.html* is a simple application that enables some of the methods of big.js to be compared with those of JavaScript's Number type. - -## Performance - -The *perf* directory contains two legacy applications and a *lib* directory containing the BigDecimal libraries used by both. - -*big-vs-bigdecimal.html* tests the performance of big.js against the JavaScript translations of two versions of BigDecimal, its use should be more or less self-explanatory. - -* [GWT: java.math.BigDecimal](https://github.com/iriscouch/bigdecimal.js) -* [ICU4J: com.ibm.icu.math.BigDecimal](https://github.com/dtrebbien/BigDecimal.js) - -The BigDecimal in the npm registry is the GWT version. It has some bugs, see the Node.js script *perf/lib/bigdecimal_GWT/bugs.js* for examples of flaws in its *remainder*, *divide* and *compareTo* methods. - -*bigtime.js* is a Node.js command-line application which tests the performance of big.js against the GWT version of -BigDecimal from the npm registry. - -For example, to compare the time taken by the big.js `plus` method and the BigDecimal `add` method - - $ node bigtime plus 10000 40 - -This will time 10000 calls to each, using operands of up to 40 random digits and will check that the results match. - -For help - - $ node bigtime -h - -## Build - -If [uglify-js](https://github.com/mishoo/UglifyJS2) is installed globally - - $ npm install uglify-js -g - -then - - $ npm run build - -will create *big.min.js*. - -## TypeScript - -The [DefinitelyTyped](https://github.com/borisyankov/DefinitelyTyped) project has a Typescript type definitions file for big.js. - - $ npm install @types/big.js - -Any questions about the TypeScript type definitions file should be addressed to the DefinitelyTyped project. - -## Feedback - -Bugs/comments/questions? - -Open an issue, or email Michael - -## Licence - -[MIT](LICENCE) - -## Contributors - -This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)]. - - - -## Backers - -Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/bigjs#backer)] - - - - -## Sponsors - -Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/bigjs#sponsor)] - - - - - - - - - - - - - diff --git a/node_modules/big.js/big.js b/node_modules/big.js/big.js deleted file mode 100644 index a2f201a63..000000000 --- a/node_modules/big.js/big.js +++ /dev/null @@ -1,941 +0,0 @@ -/* - * big.js v5.2.2 - * A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic. - * Copyright (c) 2018 Michael Mclaughlin - * https://github.com/MikeMcl/big.js/LICENCE - */ -;(function (GLOBAL) { - 'use strict'; - var Big, - - -/************************************** EDITABLE DEFAULTS *****************************************/ - - - // The default values below must be integers within the stated ranges. - - /* - * The maximum number of decimal places (DP) of the results of operations involving division: - * div and sqrt, and pow with negative exponents. - */ - DP = 20, // 0 to MAX_DP - - /* - * The rounding mode (RM) used when rounding to the above decimal places. - * - * 0 Towards zero (i.e. truncate, no rounding). (ROUND_DOWN) - * 1 To nearest neighbour. If equidistant, round up. (ROUND_HALF_UP) - * 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN) - * 3 Away from zero. (ROUND_UP) - */ - RM = 1, // 0, 1, 2 or 3 - - // The maximum value of DP and Big.DP. - MAX_DP = 1E6, // 0 to 1000000 - - // The maximum magnitude of the exponent argument to the pow method. - MAX_POWER = 1E6, // 1 to 1000000 - - /* - * The negative exponent (NE) at and beneath which toString returns exponential notation. - * (JavaScript numbers: -7) - * -1000000 is the minimum recommended exponent value of a Big. - */ - NE = -7, // 0 to -1000000 - - /* - * The positive exponent (PE) at and above which toString returns exponential notation. - * (JavaScript numbers: 21) - * 1000000 is the maximum recommended exponent value of a Big. - * (This limit is not enforced or checked.) - */ - PE = 21, // 0 to 1000000 - - -/**************************************************************************************************/ - - - // Error messages. - NAME = '[big.js] ', - INVALID = NAME + 'Invalid ', - INVALID_DP = INVALID + 'decimal places', - INVALID_RM = INVALID + 'rounding mode', - DIV_BY_ZERO = NAME + 'Division by zero', - - // The shared prototype object. - P = {}, - UNDEFINED = void 0, - NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; - - - /* - * Create and return a Big constructor. - * - */ - function _Big_() { - - /* - * The Big constructor and exported function. - * Create and return a new instance of a Big number object. - * - * n {number|string|Big} A numeric value. - */ - function Big(n) { - var x = this; - - // Enable constructor usage without new. - if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n); - - // Duplicate. - if (n instanceof Big) { - x.s = n.s; - x.e = n.e; - x.c = n.c.slice(); - } else { - parse(x, n); - } - - /* - * Retain a reference to this Big constructor, and shadow Big.prototype.constructor which - * points to Object. - */ - x.constructor = Big; - } - - Big.prototype = P; - Big.DP = DP; - Big.RM = RM; - Big.NE = NE; - Big.PE = PE; - Big.version = '5.2.2'; - - return Big; - } - - - /* - * Parse the number or string value passed to a Big constructor. - * - * x {Big} A Big number instance. - * n {number|string} A numeric value. - */ - function parse(x, n) { - var e, i, nl; - - // Minus zero? - if (n === 0 && 1 / n < 0) n = '-0'; - else if (!NUMERIC.test(n += '')) throw Error(INVALID + 'number'); - - // Determine sign. - x.s = n.charAt(0) == '-' ? (n = n.slice(1), -1) : 1; - - // Decimal point? - if ((e = n.indexOf('.')) > -1) n = n.replace('.', ''); - - // Exponential form? - if ((i = n.search(/e/i)) > 0) { - - // Determine exponent. - if (e < 0) e = i; - e += +n.slice(i + 1); - n = n.substring(0, i); - } else if (e < 0) { - - // Integer. - e = n.length; - } - - nl = n.length; - - // Determine leading zeros. - for (i = 0; i < nl && n.charAt(i) == '0';) ++i; - - if (i == nl) { - - // Zero. - x.c = [x.e = 0]; - } else { - - // Determine trailing zeros. - for (; nl > 0 && n.charAt(--nl) == '0';); - x.e = e - i - 1; - x.c = []; - - // Convert string to array of digits without leading/trailing zeros. - for (e = 0; i <= nl;) x.c[e++] = +n.charAt(i++); - } - - return x; - } - - - /* - * Round Big x to a maximum of dp decimal places using rounding mode rm. - * Called by stringify, P.div, P.round and P.sqrt. - * - * x {Big} The Big to round. - * dp {number} Integer, 0 to MAX_DP inclusive. - * rm {number} 0, 1, 2 or 3 (DOWN, HALF_UP, HALF_EVEN, UP) - * [more] {boolean} Whether the result of division was truncated. - */ - function round(x, dp, rm, more) { - var xc = x.c, - i = x.e + dp + 1; - - if (i < xc.length) { - if (rm === 1) { - - // xc[i] is the digit after the digit that may be rounded up. - more = xc[i] >= 5; - } else if (rm === 2) { - more = xc[i] > 5 || xc[i] == 5 && - (more || i < 0 || xc[i + 1] !== UNDEFINED || xc[i - 1] & 1); - } else if (rm === 3) { - more = more || !!xc[0]; - } else { - more = false; - if (rm !== 0) throw Error(INVALID_RM); - } - - if (i < 1) { - xc.length = 1; - - if (more) { - - // 1, 0.1, 0.01, 0.001, 0.0001 etc. - x.e = -dp; - xc[0] = 1; - } else { - - // Zero. - xc[0] = x.e = 0; - } - } else { - - // Remove any digits after the required decimal places. - xc.length = i--; - - // Round up? - if (more) { - - // Rounding up may mean the previous digit has to be rounded up. - for (; ++xc[i] > 9;) { - xc[i] = 0; - if (!i--) { - ++x.e; - xc.unshift(1); - } - } - } - - // Remove trailing zeros. - for (i = xc.length; !xc[--i];) xc.pop(); - } - } else if (rm < 0 || rm > 3 || rm !== ~~rm) { - throw Error(INVALID_RM); - } - - return x; - } - - - /* - * Return a string representing the value of Big x in normal or exponential notation. - * Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf. - * - * x {Big} - * id? {number} Caller id. - * 1 toExponential - * 2 toFixed - * 3 toPrecision - * 4 valueOf - * n? {number|undefined} Caller's argument. - * k? {number|undefined} - */ - function stringify(x, id, n, k) { - var e, s, - Big = x.constructor, - z = !x.c[0]; - - if (n !== UNDEFINED) { - if (n !== ~~n || n < (id == 3) || n > MAX_DP) { - throw Error(id == 3 ? INVALID + 'precision' : INVALID_DP); - } - - x = new Big(x); - - // The index of the digit that may be rounded up. - n = k - x.e; - - // Round? - if (x.c.length > ++k) round(x, n, Big.RM); - - // toFixed: recalculate k as x.e may have changed if value rounded up. - if (id == 2) k = x.e + n + 1; - - // Append zeros? - for (; x.c.length < k;) x.c.push(0); - } - - e = x.e; - s = x.c.join(''); - n = s.length; - - // Exponential notation? - if (id != 2 && (id == 1 || id == 3 && k <= e || e <= Big.NE || e >= Big.PE)) { - s = s.charAt(0) + (n > 1 ? '.' + s.slice(1) : '') + (e < 0 ? 'e' : 'e+') + e; - - // Normal notation. - } else if (e < 0) { - for (; ++e;) s = '0' + s; - s = '0.' + s; - } else if (e > 0) { - if (++e > n) for (e -= n; e--;) s += '0'; - else if (e < n) s = s.slice(0, e) + '.' + s.slice(e); - } else if (n > 1) { - s = s.charAt(0) + '.' + s.slice(1); - } - - return x.s < 0 && (!z || id == 4) ? '-' + s : s; - } - - - // Prototype/instance methods - - - /* - * Return a new Big whose value is the absolute value of this Big. - */ - P.abs = function () { - var x = new this.constructor(this); - x.s = 1; - return x; - }; - - - /* - * Return 1 if the value of this Big is greater than the value of Big y, - * -1 if the value of this Big is less than the value of Big y, or - * 0 if they have the same value. - */ - P.cmp = function (y) { - var isneg, - x = this, - xc = x.c, - yc = (y = new x.constructor(y)).c, - i = x.s, - j = y.s, - k = x.e, - l = y.e; - - // Either zero? - if (!xc[0] || !yc[0]) return !xc[0] ? !yc[0] ? 0 : -j : i; - - // Signs differ? - if (i != j) return i; - - isneg = i < 0; - - // Compare exponents. - if (k != l) return k > l ^ isneg ? 1 : -1; - - j = (k = xc.length) < (l = yc.length) ? k : l; - - // Compare digit by digit. - for (i = -1; ++i < j;) { - if (xc[i] != yc[i]) return xc[i] > yc[i] ^ isneg ? 1 : -1; - } - - // Compare lengths. - return k == l ? 0 : k > l ^ isneg ? 1 : -1; - }; - - - /* - * Return a new Big whose value is the value of this Big divided by the value of Big y, rounded, - * if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM. - */ - P.div = function (y) { - var x = this, - Big = x.constructor, - a = x.c, // dividend - b = (y = new Big(y)).c, // divisor - k = x.s == y.s ? 1 : -1, - dp = Big.DP; - - if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(INVALID_DP); - - // Divisor is zero? - if (!b[0]) throw Error(DIV_BY_ZERO); - - // Dividend is 0? Return +-0. - if (!a[0]) return new Big(k * 0); - - var bl, bt, n, cmp, ri, - bz = b.slice(), - ai = bl = b.length, - al = a.length, - r = a.slice(0, bl), // remainder - rl = r.length, - q = y, // quotient - qc = q.c = [], - qi = 0, - d = dp + (q.e = x.e - y.e) + 1; // number of digits of the result - - q.s = k; - k = d < 0 ? 0 : d; - - // Create version of divisor with leading zero. - bz.unshift(0); - - // Add zeros to make remainder as long as divisor. - for (; rl++ < bl;) r.push(0); - - do { - - // n is how many times the divisor goes into current remainder. - for (n = 0; n < 10; n++) { - - // Compare divisor and remainder. - if (bl != (rl = r.length)) { - cmp = bl > rl ? 1 : -1; - } else { - for (ri = -1, cmp = 0; ++ri < bl;) { - if (b[ri] != r[ri]) { - cmp = b[ri] > r[ri] ? 1 : -1; - break; - } - } - } - - // If divisor < remainder, subtract divisor from remainder. - if (cmp < 0) { - - // Remainder can't be more than 1 digit longer than divisor. - // Equalise lengths using divisor with extra leading zero? - for (bt = rl == bl ? b : bz; rl;) { - if (r[--rl] < bt[rl]) { - ri = rl; - for (; ri && !r[--ri];) r[ri] = 9; - --r[ri]; - r[rl] += 10; - } - r[rl] -= bt[rl]; - } - - for (; !r[0];) r.shift(); - } else { - break; - } - } - - // Add the digit n to the result array. - qc[qi++] = cmp ? n : ++n; - - // Update the remainder. - if (r[0] && cmp) r[rl] = a[ai] || 0; - else r = [a[ai]]; - - } while ((ai++ < al || r[0] !== UNDEFINED) && k--); - - // Leading zero? Do not remove if result is simply zero (qi == 1). - if (!qc[0] && qi != 1) { - - // There can't be more than one zero. - qc.shift(); - q.e--; - } - - // Round? - if (qi > d) round(q, dp, Big.RM, r[0] !== UNDEFINED); - - return q; - }; - - - /* - * Return true if the value of this Big is equal to the value of Big y, otherwise return false. - */ - P.eq = function (y) { - return !this.cmp(y); - }; - - - /* - * Return true if the value of this Big is greater than the value of Big y, otherwise return - * false. - */ - P.gt = function (y) { - return this.cmp(y) > 0; - }; - - - /* - * Return true if the value of this Big is greater than or equal to the value of Big y, otherwise - * return false. - */ - P.gte = function (y) { - return this.cmp(y) > -1; - }; - - - /* - * Return true if the value of this Big is less than the value of Big y, otherwise return false. - */ - P.lt = function (y) { - return this.cmp(y) < 0; - }; - - - /* - * Return true if the value of this Big is less than or equal to the value of Big y, otherwise - * return false. - */ - P.lte = function (y) { - return this.cmp(y) < 1; - }; - - - /* - * Return a new Big whose value is the value of this Big minus the value of Big y. - */ - P.minus = P.sub = function (y) { - var i, j, t, xlty, - x = this, - Big = x.constructor, - a = x.s, - b = (y = new Big(y)).s; - - // Signs differ? - if (a != b) { - y.s = -b; - return x.plus(y); - } - - var xc = x.c.slice(), - xe = x.e, - yc = y.c, - ye = y.e; - - // Either zero? - if (!xc[0] || !yc[0]) { - - // y is non-zero? x is non-zero? Or both are zero. - return yc[0] ? (y.s = -b, y) : new Big(xc[0] ? x : 0); - } - - // Determine which is the bigger number. Prepend zeros to equalise exponents. - if (a = xe - ye) { - - if (xlty = a < 0) { - a = -a; - t = xc; - } else { - ye = xe; - t = yc; - } - - t.reverse(); - for (b = a; b--;) t.push(0); - t.reverse(); - } else { - - // Exponents equal. Check digit by digit. - j = ((xlty = xc.length < yc.length) ? xc : yc).length; - - for (a = b = 0; b < j; b++) { - if (xc[b] != yc[b]) { - xlty = xc[b] < yc[b]; - break; - } - } - } - - // x < y? Point xc to the array of the bigger number. - if (xlty) { - t = xc; - xc = yc; - yc = t; - y.s = -y.s; - } - - /* - * Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only - * needs to start at yc.length. - */ - if ((b = (j = yc.length) - (i = xc.length)) > 0) for (; b--;) xc[i++] = 0; - - // Subtract yc from xc. - for (b = i; j > a;) { - if (xc[--j] < yc[j]) { - for (i = j; i && !xc[--i];) xc[i] = 9; - --xc[i]; - xc[j] += 10; - } - - xc[j] -= yc[j]; - } - - // Remove trailing zeros. - for (; xc[--b] === 0;) xc.pop(); - - // Remove leading zeros and adjust exponent accordingly. - for (; xc[0] === 0;) { - xc.shift(); - --ye; - } - - if (!xc[0]) { - - // n - n = +0 - y.s = 1; - - // Result must be zero. - xc = [ye = 0]; - } - - y.c = xc; - y.e = ye; - - return y; - }; - - - /* - * Return a new Big whose value is the value of this Big modulo the value of Big y. - */ - P.mod = function (y) { - var ygtx, - x = this, - Big = x.constructor, - a = x.s, - b = (y = new Big(y)).s; - - if (!y.c[0]) throw Error(DIV_BY_ZERO); - - x.s = y.s = 1; - ygtx = y.cmp(x) == 1; - x.s = a; - y.s = b; - - if (ygtx) return new Big(x); - - a = Big.DP; - b = Big.RM; - Big.DP = Big.RM = 0; - x = x.div(y); - Big.DP = a; - Big.RM = b; - - return this.minus(x.times(y)); - }; - - - /* - * Return a new Big whose value is the value of this Big plus the value of Big y. - */ - P.plus = P.add = function (y) { - var t, - x = this, - Big = x.constructor, - a = x.s, - b = (y = new Big(y)).s; - - // Signs differ? - if (a != b) { - y.s = -b; - return x.minus(y); - } - - var xe = x.e, - xc = x.c, - ye = y.e, - yc = y.c; - - // Either zero? y is non-zero? x is non-zero? Or both are zero. - if (!xc[0] || !yc[0]) return yc[0] ? y : new Big(xc[0] ? x : a * 0); - - xc = xc.slice(); - - // Prepend zeros to equalise exponents. - // Note: reverse faster than unshifts. - if (a = xe - ye) { - if (a > 0) { - ye = xe; - t = yc; - } else { - a = -a; - t = xc; - } - - t.reverse(); - for (; a--;) t.push(0); - t.reverse(); - } - - // Point xc to the longer array. - if (xc.length - yc.length < 0) { - t = yc; - yc = xc; - xc = t; - } - - a = yc.length; - - // Only start adding at yc.length - 1 as the further digits of xc can be left as they are. - for (b = 0; a; xc[a] %= 10) b = (xc[--a] = xc[a] + yc[a] + b) / 10 | 0; - - // No need to check for zero, as +x + +y != 0 && -x + -y != 0 - - if (b) { - xc.unshift(b); - ++ye; - } - - // Remove trailing zeros. - for (a = xc.length; xc[--a] === 0;) xc.pop(); - - y.c = xc; - y.e = ye; - - return y; - }; - - - /* - * Return a Big whose value is the value of this Big raised to the power n. - * If n is negative, round to a maximum of Big.DP decimal places using rounding - * mode Big.RM. - * - * n {number} Integer, -MAX_POWER to MAX_POWER inclusive. - */ - P.pow = function (n) { - var x = this, - one = new x.constructor(1), - y = one, - isneg = n < 0; - - if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) throw Error(INVALID + 'exponent'); - if (isneg) n = -n; - - for (;;) { - if (n & 1) y = y.times(x); - n >>= 1; - if (!n) break; - x = x.times(x); - } - - return isneg ? one.div(y) : y; - }; - - - /* - * Return a new Big whose value is the value of this Big rounded using rounding mode rm - * to a maximum of dp decimal places, or, if dp is negative, to an integer which is a - * multiple of 10**-dp. - * If dp is not specified, round to 0 decimal places. - * If rm is not specified, use Big.RM. - * - * dp? {number} Integer, -MAX_DP to MAX_DP inclusive. - * rm? 0, 1, 2 or 3 (ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP) - */ - P.round = function (dp, rm) { - var Big = this.constructor; - if (dp === UNDEFINED) dp = 0; - else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) throw Error(INVALID_DP); - return round(new Big(this), dp, rm === UNDEFINED ? Big.RM : rm); - }; - - - /* - * Return a new Big whose value is the square root of the value of this Big, rounded, if - * necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM. - */ - P.sqrt = function () { - var r, c, t, - x = this, - Big = x.constructor, - s = x.s, - e = x.e, - half = new Big(0.5); - - // Zero? - if (!x.c[0]) return new Big(x); - - // Negative? - if (s < 0) throw Error(NAME + 'No square root'); - - // Estimate. - s = Math.sqrt(x + ''); - - // Math.sqrt underflow/overflow? - // Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent. - if (s === 0 || s === 1 / 0) { - c = x.c.join(''); - if (!(c.length + e & 1)) c += '0'; - s = Math.sqrt(c); - e = ((e + 1) / 2 | 0) - (e < 0 || e & 1); - r = new Big((s == 1 / 0 ? '1e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e); - } else { - r = new Big(s); - } - - e = r.e + (Big.DP += 4); - - // Newton-Raphson iteration. - do { - t = r; - r = half.times(t.plus(x.div(t))); - } while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join('')); - - return round(r, Big.DP -= 4, Big.RM); - }; - - - /* - * Return a new Big whose value is the value of this Big times the value of Big y. - */ - P.times = P.mul = function (y) { - var c, - x = this, - Big = x.constructor, - xc = x.c, - yc = (y = new Big(y)).c, - a = xc.length, - b = yc.length, - i = x.e, - j = y.e; - - // Determine sign of result. - y.s = x.s == y.s ? 1 : -1; - - // Return signed 0 if either 0. - if (!xc[0] || !yc[0]) return new Big(y.s * 0); - - // Initialise exponent of result as x.e + y.e. - y.e = i + j; - - // If array xc has fewer digits than yc, swap xc and yc, and lengths. - if (a < b) { - c = xc; - xc = yc; - yc = c; - j = a; - a = b; - b = j; - } - - // Initialise coefficient array of result with zeros. - for (c = new Array(j = a + b); j--;) c[j] = 0; - - // Multiply. - - // i is initially xc.length. - for (i = b; i--;) { - b = 0; - - // a is yc.length. - for (j = a + i; j > i;) { - - // Current sum of products at this digit position, plus carry. - b = c[j] + yc[i] * xc[j - i - 1] + b; - c[j--] = b % 10; - - // carry - b = b / 10 | 0; - } - - c[j] = (c[j] + b) % 10; - } - - // Increment result exponent if there is a final carry, otherwise remove leading zero. - if (b) ++y.e; - else c.shift(); - - // Remove trailing zeros. - for (i = c.length; !c[--i];) c.pop(); - y.c = c; - - return y; - }; - - - /* - * Return a string representing the value of this Big in exponential notation to dp fixed decimal - * places and rounded using Big.RM. - * - * dp? {number} Integer, 0 to MAX_DP inclusive. - */ - P.toExponential = function (dp) { - return stringify(this, 1, dp, dp); - }; - - - /* - * Return a string representing the value of this Big in normal notation to dp fixed decimal - * places and rounded using Big.RM. - * - * dp? {number} Integer, 0 to MAX_DP inclusive. - * - * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'. - * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'. - */ - P.toFixed = function (dp) { - return stringify(this, 2, dp, this.e + dp); - }; - - - /* - * Return a string representing the value of this Big rounded to sd significant digits using - * Big.RM. Use exponential notation if sd is less than the number of digits necessary to represent - * the integer part of the value in normal notation. - * - * sd {number} Integer, 1 to MAX_DP inclusive. - */ - P.toPrecision = function (sd) { - return stringify(this, 3, sd, sd - 1); - }; - - - /* - * Return a string representing the value of this Big. - * Return exponential notation if this Big has a positive exponent equal to or greater than - * Big.PE, or a negative exponent equal to or less than Big.NE. - * Omit the sign for negative zero. - */ - P.toString = function () { - return stringify(this); - }; - - - /* - * Return a string representing the value of this Big. - * Return exponential notation if this Big has a positive exponent equal to or greater than - * Big.PE, or a negative exponent equal to or less than Big.NE. - * Include the sign for negative zero. - */ - P.valueOf = P.toJSON = function () { - return stringify(this, 4); - }; - - - // Export - - - Big = _Big_(); - - Big['default'] = Big.Big = Big; - - //AMD. - if (typeof define === 'function' && define.amd) { - define(function () { return Big; }); - - // Node and other CommonJS-like environments that support module.exports. - } else if (typeof module !== 'undefined' && module.exports) { - module.exports = Big; - - //Browser. - } else { - GLOBAL.Big = Big; - } -})(this); diff --git a/node_modules/big.js/big.min.js b/node_modules/big.js/big.min.js deleted file mode 100644 index 0fb1b68f7..000000000 --- a/node_modules/big.js/big.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/* big.js v5.2.2 https://github.com/MikeMcl/big.js/LICENCE */ -!function(e){"use strict";var r,i=20,s=1,P=1e6,o=-7,f=21,c="[big.js] ",u=c+"Invalid ",b=u+"decimal places",h=u+"rounding mode",x=c+"Division by zero",l={},D=void 0,a=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function R(e,r,t,n){var i=e.c,s=e.e+r+1;if(s++n&&R(e,t,o.RM),2==r&&(n=e.e+t+1);e.c.length=o.PE))s=s.charAt(0)+(1t)for(i-=t;i--;)s+="0";else ii[s]^r?1:-1;return f==c?0:cw[l]?1:-1;break}if(!(h<0))break;for(c=d==f?i:a;d;){if(w[--d]>=1;)r=r.times(r);return i?t.div(n):n},l.round=function(e,r){var t=this.constructor;if(e===D)e=0;else if(e!==~~e||e<-P||P - * https://github.com/MikeMcl/big.js/LICENCE - */ - - -/************************************** EDITABLE DEFAULTS *****************************************/ - - - // The default values below must be integers within the stated ranges. - - /* - * The maximum number of decimal places (DP) of the results of operations involving division: - * div and sqrt, and pow with negative exponents. - */ -var DP = 20, // 0 to MAX_DP - - /* - * The rounding mode (RM) used when rounding to the above decimal places. - * - * 0 Towards zero (i.e. truncate, no rounding). (ROUND_DOWN) - * 1 To nearest neighbour. If equidistant, round up. (ROUND_HALF_UP) - * 2 To nearest neighbour. If equidistant, to even. (ROUND_HALF_EVEN) - * 3 Away from zero. (ROUND_UP) - */ - RM = 1, // 0, 1, 2 or 3 - - // The maximum value of DP and Big.DP. - MAX_DP = 1E6, // 0 to 1000000 - - // The maximum magnitude of the exponent argument to the pow method. - MAX_POWER = 1E6, // 1 to 1000000 - - /* - * The negative exponent (NE) at and beneath which toString returns exponential notation. - * (JavaScript numbers: -7) - * -1000000 is the minimum recommended exponent value of a Big. - */ - NE = -7, // 0 to -1000000 - - /* - * The positive exponent (PE) at and above which toString returns exponential notation. - * (JavaScript numbers: 21) - * 1000000 is the maximum recommended exponent value of a Big. - * (This limit is not enforced or checked.) - */ - PE = 21, // 0 to 1000000 - - -/**************************************************************************************************/ - - - // Error messages. - NAME = '[big.js] ', - INVALID = NAME + 'Invalid ', - INVALID_DP = INVALID + 'decimal places', - INVALID_RM = INVALID + 'rounding mode', - DIV_BY_ZERO = NAME + 'Division by zero', - - // The shared prototype object. - P = {}, - UNDEFINED = void 0, - NUMERIC = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i; - - -/* - * Create and return a Big constructor. - * - */ -function _Big_() { - - /* - * The Big constructor and exported function. - * Create and return a new instance of a Big number object. - * - * n {number|string|Big} A numeric value. - */ - function Big(n) { - var x = this; - - // Enable constructor usage without new. - if (!(x instanceof Big)) return n === UNDEFINED ? _Big_() : new Big(n); - - // Duplicate. - if (n instanceof Big) { - x.s = n.s; - x.e = n.e; - x.c = n.c.slice(); - } else { - parse(x, n); - } - - /* - * Retain a reference to this Big constructor, and shadow Big.prototype.constructor which - * points to Object. - */ - x.constructor = Big; - } - - Big.prototype = P; - Big.DP = DP; - Big.RM = RM; - Big.NE = NE; - Big.PE = PE; - Big.version = '5.2.2'; - - return Big; -} - - -/* - * Parse the number or string value passed to a Big constructor. - * - * x {Big} A Big number instance. - * n {number|string} A numeric value. - */ -function parse(x, n) { - var e, i, nl; - - // Minus zero? - if (n === 0 && 1 / n < 0) n = '-0'; - else if (!NUMERIC.test(n += '')) throw Error(INVALID + 'number'); - - // Determine sign. - x.s = n.charAt(0) == '-' ? (n = n.slice(1), -1) : 1; - - // Decimal point? - if ((e = n.indexOf('.')) > -1) n = n.replace('.', ''); - - // Exponential form? - if ((i = n.search(/e/i)) > 0) { - - // Determine exponent. - if (e < 0) e = i; - e += +n.slice(i + 1); - n = n.substring(0, i); - } else if (e < 0) { - - // Integer. - e = n.length; - } - - nl = n.length; - - // Determine leading zeros. - for (i = 0; i < nl && n.charAt(i) == '0';) ++i; - - if (i == nl) { - - // Zero. - x.c = [x.e = 0]; - } else { - - // Determine trailing zeros. - for (; nl > 0 && n.charAt(--nl) == '0';); - x.e = e - i - 1; - x.c = []; - - // Convert string to array of digits without leading/trailing zeros. - for (e = 0; i <= nl;) x.c[e++] = +n.charAt(i++); - } - - return x; -} - - -/* - * Round Big x to a maximum of dp decimal places using rounding mode rm. - * Called by stringify, P.div, P.round and P.sqrt. - * - * x {Big} The Big to round. - * dp {number} Integer, 0 to MAX_DP inclusive. - * rm {number} 0, 1, 2 or 3 (DOWN, HALF_UP, HALF_EVEN, UP) - * [more] {boolean} Whether the result of division was truncated. - */ -function round(x, dp, rm, more) { - var xc = x.c, - i = x.e + dp + 1; - - if (i < xc.length) { - if (rm === 1) { - - // xc[i] is the digit after the digit that may be rounded up. - more = xc[i] >= 5; - } else if (rm === 2) { - more = xc[i] > 5 || xc[i] == 5 && - (more || i < 0 || xc[i + 1] !== UNDEFINED || xc[i - 1] & 1); - } else if (rm === 3) { - more = more || !!xc[0]; - } else { - more = false; - if (rm !== 0) throw Error(INVALID_RM); - } - - if (i < 1) { - xc.length = 1; - - if (more) { - - // 1, 0.1, 0.01, 0.001, 0.0001 etc. - x.e = -dp; - xc[0] = 1; - } else { - - // Zero. - xc[0] = x.e = 0; - } - } else { - - // Remove any digits after the required decimal places. - xc.length = i--; - - // Round up? - if (more) { - - // Rounding up may mean the previous digit has to be rounded up. - for (; ++xc[i] > 9;) { - xc[i] = 0; - if (!i--) { - ++x.e; - xc.unshift(1); - } - } - } - - // Remove trailing zeros. - for (i = xc.length; !xc[--i];) xc.pop(); - } - } else if (rm < 0 || rm > 3 || rm !== ~~rm) { - throw Error(INVALID_RM); - } - - return x; -} - - -/* - * Return a string representing the value of Big x in normal or exponential notation. - * Handles P.toExponential, P.toFixed, P.toJSON, P.toPrecision, P.toString and P.valueOf. - * - * x {Big} - * id? {number} Caller id. - * 1 toExponential - * 2 toFixed - * 3 toPrecision - * 4 valueOf - * n? {number|undefined} Caller's argument. - * k? {number|undefined} - */ -function stringify(x, id, n, k) { - var e, s, - Big = x.constructor, - z = !x.c[0]; - - if (n !== UNDEFINED) { - if (n !== ~~n || n < (id == 3) || n > MAX_DP) { - throw Error(id == 3 ? INVALID + 'precision' : INVALID_DP); - } - - x = new Big(x); - - // The index of the digit that may be rounded up. - n = k - x.e; - - // Round? - if (x.c.length > ++k) round(x, n, Big.RM); - - // toFixed: recalculate k as x.e may have changed if value rounded up. - if (id == 2) k = x.e + n + 1; - - // Append zeros? - for (; x.c.length < k;) x.c.push(0); - } - - e = x.e; - s = x.c.join(''); - n = s.length; - - // Exponential notation? - if (id != 2 && (id == 1 || id == 3 && k <= e || e <= Big.NE || e >= Big.PE)) { - s = s.charAt(0) + (n > 1 ? '.' + s.slice(1) : '') + (e < 0 ? 'e' : 'e+') + e; - - // Normal notation. - } else if (e < 0) { - for (; ++e;) s = '0' + s; - s = '0.' + s; - } else if (e > 0) { - if (++e > n) for (e -= n; e--;) s += '0'; - else if (e < n) s = s.slice(0, e) + '.' + s.slice(e); - } else if (n > 1) { - s = s.charAt(0) + '.' + s.slice(1); - } - - return x.s < 0 && (!z || id == 4) ? '-' + s : s; -} - - -// Prototype/instance methods - - -/* - * Return a new Big whose value is the absolute value of this Big. - */ -P.abs = function () { - var x = new this.constructor(this); - x.s = 1; - return x; -}; - - -/* - * Return 1 if the value of this Big is greater than the value of Big y, - * -1 if the value of this Big is less than the value of Big y, or - * 0 if they have the same value. -*/ -P.cmp = function (y) { - var isneg, - x = this, - xc = x.c, - yc = (y = new x.constructor(y)).c, - i = x.s, - j = y.s, - k = x.e, - l = y.e; - - // Either zero? - if (!xc[0] || !yc[0]) return !xc[0] ? !yc[0] ? 0 : -j : i; - - // Signs differ? - if (i != j) return i; - - isneg = i < 0; - - // Compare exponents. - if (k != l) return k > l ^ isneg ? 1 : -1; - - j = (k = xc.length) < (l = yc.length) ? k : l; - - // Compare digit by digit. - for (i = -1; ++i < j;) { - if (xc[i] != yc[i]) return xc[i] > yc[i] ^ isneg ? 1 : -1; - } - - // Compare lengths. - return k == l ? 0 : k > l ^ isneg ? 1 : -1; -}; - - -/* - * Return a new Big whose value is the value of this Big divided by the value of Big y, rounded, - * if necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM. - */ -P.div = function (y) { - var x = this, - Big = x.constructor, - a = x.c, // dividend - b = (y = new Big(y)).c, // divisor - k = x.s == y.s ? 1 : -1, - dp = Big.DP; - - if (dp !== ~~dp || dp < 0 || dp > MAX_DP) throw Error(INVALID_DP); - - // Divisor is zero? - if (!b[0]) throw Error(DIV_BY_ZERO); - - // Dividend is 0? Return +-0. - if (!a[0]) return new Big(k * 0); - - var bl, bt, n, cmp, ri, - bz = b.slice(), - ai = bl = b.length, - al = a.length, - r = a.slice(0, bl), // remainder - rl = r.length, - q = y, // quotient - qc = q.c = [], - qi = 0, - d = dp + (q.e = x.e - y.e) + 1; // number of digits of the result - - q.s = k; - k = d < 0 ? 0 : d; - - // Create version of divisor with leading zero. - bz.unshift(0); - - // Add zeros to make remainder as long as divisor. - for (; rl++ < bl;) r.push(0); - - do { - - // n is how many times the divisor goes into current remainder. - for (n = 0; n < 10; n++) { - - // Compare divisor and remainder. - if (bl != (rl = r.length)) { - cmp = bl > rl ? 1 : -1; - } else { - for (ri = -1, cmp = 0; ++ri < bl;) { - if (b[ri] != r[ri]) { - cmp = b[ri] > r[ri] ? 1 : -1; - break; - } - } - } - - // If divisor < remainder, subtract divisor from remainder. - if (cmp < 0) { - - // Remainder can't be more than 1 digit longer than divisor. - // Equalise lengths using divisor with extra leading zero? - for (bt = rl == bl ? b : bz; rl;) { - if (r[--rl] < bt[rl]) { - ri = rl; - for (; ri && !r[--ri];) r[ri] = 9; - --r[ri]; - r[rl] += 10; - } - r[rl] -= bt[rl]; - } - - for (; !r[0];) r.shift(); - } else { - break; - } - } - - // Add the digit n to the result array. - qc[qi++] = cmp ? n : ++n; - - // Update the remainder. - if (r[0] && cmp) r[rl] = a[ai] || 0; - else r = [a[ai]]; - - } while ((ai++ < al || r[0] !== UNDEFINED) && k--); - - // Leading zero? Do not remove if result is simply zero (qi == 1). - if (!qc[0] && qi != 1) { - - // There can't be more than one zero. - qc.shift(); - q.e--; - } - - // Round? - if (qi > d) round(q, dp, Big.RM, r[0] !== UNDEFINED); - - return q; -}; - - -/* - * Return true if the value of this Big is equal to the value of Big y, otherwise return false. - */ -P.eq = function (y) { - return !this.cmp(y); -}; - - -/* - * Return true if the value of this Big is greater than the value of Big y, otherwise return - * false. - */ -P.gt = function (y) { - return this.cmp(y) > 0; -}; - - -/* - * Return true if the value of this Big is greater than or equal to the value of Big y, otherwise - * return false. - */ -P.gte = function (y) { - return this.cmp(y) > -1; -}; - - -/* - * Return true if the value of this Big is less than the value of Big y, otherwise return false. - */ -P.lt = function (y) { - return this.cmp(y) < 0; -}; - - -/* - * Return true if the value of this Big is less than or equal to the value of Big y, otherwise - * return false. - */ -P.lte = function (y) { - return this.cmp(y) < 1; -}; - - -/* - * Return a new Big whose value is the value of this Big minus the value of Big y. - */ -P.minus = P.sub = function (y) { - var i, j, t, xlty, - x = this, - Big = x.constructor, - a = x.s, - b = (y = new Big(y)).s; - - // Signs differ? - if (a != b) { - y.s = -b; - return x.plus(y); - } - - var xc = x.c.slice(), - xe = x.e, - yc = y.c, - ye = y.e; - - // Either zero? - if (!xc[0] || !yc[0]) { - - // y is non-zero? x is non-zero? Or both are zero. - return yc[0] ? (y.s = -b, y) : new Big(xc[0] ? x : 0); - } - - // Determine which is the bigger number. Prepend zeros to equalise exponents. - if (a = xe - ye) { - - if (xlty = a < 0) { - a = -a; - t = xc; - } else { - ye = xe; - t = yc; - } - - t.reverse(); - for (b = a; b--;) t.push(0); - t.reverse(); - } else { - - // Exponents equal. Check digit by digit. - j = ((xlty = xc.length < yc.length) ? xc : yc).length; - - for (a = b = 0; b < j; b++) { - if (xc[b] != yc[b]) { - xlty = xc[b] < yc[b]; - break; - } - } - } - - // x < y? Point xc to the array of the bigger number. - if (xlty) { - t = xc; - xc = yc; - yc = t; - y.s = -y.s; - } - - /* - * Append zeros to xc if shorter. No need to add zeros to yc if shorter as subtraction only - * needs to start at yc.length. - */ - if ((b = (j = yc.length) - (i = xc.length)) > 0) for (; b--;) xc[i++] = 0; - - // Subtract yc from xc. - for (b = i; j > a;) { - if (xc[--j] < yc[j]) { - for (i = j; i && !xc[--i];) xc[i] = 9; - --xc[i]; - xc[j] += 10; - } - - xc[j] -= yc[j]; - } - - // Remove trailing zeros. - for (; xc[--b] === 0;) xc.pop(); - - // Remove leading zeros and adjust exponent accordingly. - for (; xc[0] === 0;) { - xc.shift(); - --ye; - } - - if (!xc[0]) { - - // n - n = +0 - y.s = 1; - - // Result must be zero. - xc = [ye = 0]; - } - - y.c = xc; - y.e = ye; - - return y; -}; - - -/* - * Return a new Big whose value is the value of this Big modulo the value of Big y. - */ -P.mod = function (y) { - var ygtx, - x = this, - Big = x.constructor, - a = x.s, - b = (y = new Big(y)).s; - - if (!y.c[0]) throw Error(DIV_BY_ZERO); - - x.s = y.s = 1; - ygtx = y.cmp(x) == 1; - x.s = a; - y.s = b; - - if (ygtx) return new Big(x); - - a = Big.DP; - b = Big.RM; - Big.DP = Big.RM = 0; - x = x.div(y); - Big.DP = a; - Big.RM = b; - - return this.minus(x.times(y)); -}; - - -/* - * Return a new Big whose value is the value of this Big plus the value of Big y. - */ -P.plus = P.add = function (y) { - var t, - x = this, - Big = x.constructor, - a = x.s, - b = (y = new Big(y)).s; - - // Signs differ? - if (a != b) { - y.s = -b; - return x.minus(y); - } - - var xe = x.e, - xc = x.c, - ye = y.e, - yc = y.c; - - // Either zero? y is non-zero? x is non-zero? Or both are zero. - if (!xc[0] || !yc[0]) return yc[0] ? y : new Big(xc[0] ? x : a * 0); - - xc = xc.slice(); - - // Prepend zeros to equalise exponents. - // Note: reverse faster than unshifts. - if (a = xe - ye) { - if (a > 0) { - ye = xe; - t = yc; - } else { - a = -a; - t = xc; - } - - t.reverse(); - for (; a--;) t.push(0); - t.reverse(); - } - - // Point xc to the longer array. - if (xc.length - yc.length < 0) { - t = yc; - yc = xc; - xc = t; - } - - a = yc.length; - - // Only start adding at yc.length - 1 as the further digits of xc can be left as they are. - for (b = 0; a; xc[a] %= 10) b = (xc[--a] = xc[a] + yc[a] + b) / 10 | 0; - - // No need to check for zero, as +x + +y != 0 && -x + -y != 0 - - if (b) { - xc.unshift(b); - ++ye; - } - - // Remove trailing zeros. - for (a = xc.length; xc[--a] === 0;) xc.pop(); - - y.c = xc; - y.e = ye; - - return y; -}; - - -/* - * Return a Big whose value is the value of this Big raised to the power n. - * If n is negative, round to a maximum of Big.DP decimal places using rounding - * mode Big.RM. - * - * n {number} Integer, -MAX_POWER to MAX_POWER inclusive. - */ -P.pow = function (n) { - var x = this, - one = new x.constructor(1), - y = one, - isneg = n < 0; - - if (n !== ~~n || n < -MAX_POWER || n > MAX_POWER) throw Error(INVALID + 'exponent'); - if (isneg) n = -n; - - for (;;) { - if (n & 1) y = y.times(x); - n >>= 1; - if (!n) break; - x = x.times(x); - } - - return isneg ? one.div(y) : y; -}; - - -/* - * Return a new Big whose value is the value of this Big rounded using rounding mode rm - * to a maximum of dp decimal places, or, if dp is negative, to an integer which is a - * multiple of 10**-dp. - * If dp is not specified, round to 0 decimal places. - * If rm is not specified, use Big.RM. - * - * dp? {number} Integer, -MAX_DP to MAX_DP inclusive. - * rm? 0, 1, 2 or 3 (ROUND_DOWN, ROUND_HALF_UP, ROUND_HALF_EVEN, ROUND_UP) - */ -P.round = function (dp, rm) { - var Big = this.constructor; - if (dp === UNDEFINED) dp = 0; - else if (dp !== ~~dp || dp < -MAX_DP || dp > MAX_DP) throw Error(INVALID_DP); - return round(new Big(this), dp, rm === UNDEFINED ? Big.RM : rm); -}; - - -/* - * Return a new Big whose value is the square root of the value of this Big, rounded, if - * necessary, to a maximum of Big.DP decimal places using rounding mode Big.RM. - */ -P.sqrt = function () { - var r, c, t, - x = this, - Big = x.constructor, - s = x.s, - e = x.e, - half = new Big(0.5); - - // Zero? - if (!x.c[0]) return new Big(x); - - // Negative? - if (s < 0) throw Error(NAME + 'No square root'); - - // Estimate. - s = Math.sqrt(x + ''); - - // Math.sqrt underflow/overflow? - // Re-estimate: pass x coefficient to Math.sqrt as integer, then adjust the result exponent. - if (s === 0 || s === 1 / 0) { - c = x.c.join(''); - if (!(c.length + e & 1)) c += '0'; - s = Math.sqrt(c); - e = ((e + 1) / 2 | 0) - (e < 0 || e & 1); - r = new Big((s == 1 / 0 ? '1e' : (s = s.toExponential()).slice(0, s.indexOf('e') + 1)) + e); - } else { - r = new Big(s); - } - - e = r.e + (Big.DP += 4); - - // Newton-Raphson iteration. - do { - t = r; - r = half.times(t.plus(x.div(t))); - } while (t.c.slice(0, e).join('') !== r.c.slice(0, e).join('')); - - return round(r, Big.DP -= 4, Big.RM); -}; - - -/* - * Return a new Big whose value is the value of this Big times the value of Big y. - */ -P.times = P.mul = function (y) { - var c, - x = this, - Big = x.constructor, - xc = x.c, - yc = (y = new Big(y)).c, - a = xc.length, - b = yc.length, - i = x.e, - j = y.e; - - // Determine sign of result. - y.s = x.s == y.s ? 1 : -1; - - // Return signed 0 if either 0. - if (!xc[0] || !yc[0]) return new Big(y.s * 0); - - // Initialise exponent of result as x.e + y.e. - y.e = i + j; - - // If array xc has fewer digits than yc, swap xc and yc, and lengths. - if (a < b) { - c = xc; - xc = yc; - yc = c; - j = a; - a = b; - b = j; - } - - // Initialise coefficient array of result with zeros. - for (c = new Array(j = a + b); j--;) c[j] = 0; - - // Multiply. - - // i is initially xc.length. - for (i = b; i--;) { - b = 0; - - // a is yc.length. - for (j = a + i; j > i;) { - - // Current sum of products at this digit position, plus carry. - b = c[j] + yc[i] * xc[j - i - 1] + b; - c[j--] = b % 10; - - // carry - b = b / 10 | 0; - } - - c[j] = (c[j] + b) % 10; - } - - // Increment result exponent if there is a final carry, otherwise remove leading zero. - if (b) ++y.e; - else c.shift(); - - // Remove trailing zeros. - for (i = c.length; !c[--i];) c.pop(); - y.c = c; - - return y; -}; - - -/* - * Return a string representing the value of this Big in exponential notation to dp fixed decimal - * places and rounded using Big.RM. - * - * dp? {number} Integer, 0 to MAX_DP inclusive. - */ -P.toExponential = function (dp) { - return stringify(this, 1, dp, dp); -}; - - -/* - * Return a string representing the value of this Big in normal notation to dp fixed decimal - * places and rounded using Big.RM. - * - * dp? {number} Integer, 0 to MAX_DP inclusive. - * - * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'. - * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'. - */ -P.toFixed = function (dp) { - return stringify(this, 2, dp, this.e + dp); -}; - - -/* - * Return a string representing the value of this Big rounded to sd significant digits using - * Big.RM. Use exponential notation if sd is less than the number of digits necessary to represent - * the integer part of the value in normal notation. - * - * sd {number} Integer, 1 to MAX_DP inclusive. - */ -P.toPrecision = function (sd) { - return stringify(this, 3, sd, sd - 1); -}; - - -/* - * Return a string representing the value of this Big. - * Return exponential notation if this Big has a positive exponent equal to or greater than - * Big.PE, or a negative exponent equal to or less than Big.NE. - * Omit the sign for negative zero. - */ -P.toString = function () { - return stringify(this); -}; - - -/* - * Return a string representing the value of this Big. - * Return exponential notation if this Big has a positive exponent equal to or greater than - * Big.PE, or a negative exponent equal to or less than Big.NE. - * Include the sign for negative zero. - */ -P.valueOf = P.toJSON = function () { - return stringify(this, 4); -}; - - -// Export - - -export var Big = _Big_(); - -export default Big; diff --git a/node_modules/big.js/package.json b/node_modules/big.js/package.json deleted file mode 100644 index 92eafe49d..000000000 --- a/node_modules/big.js/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "big.js", - "description": "A small, fast, easy-to-use library for arbitrary-precision decimal arithmetic", - "version": "5.2.2", - "keywords": [ - "arbitrary", - "precision", - "arithmetic", - "big", - "number", - "decimal", - "float", - "biginteger", - "bigdecimal", - "bignumber", - "bigint", - "bignum" - ], - "repository": { - "type": "git", - "url": "https://github.com/MikeMcl/big.js.git" - }, - "main": "big", - "browser": "big.js", - "module": "big.mjs", - "author": { - "name": "Michael Mclaughlin", - "email": "M8ch88l@gmail.com" - }, - "bugs": { - "url": "https://github.com/MikeMcl/big.js/issues" - }, - "engines": { - "node": "*" - }, - "license": "MIT", - "scripts": { - "test": "node ./test/every-test.js", - "build": "uglifyjs big.js --source-map -c -m -o big.min.js" - }, - "files": [ - "big.js", - "big.mjs", - "big.min.js" - ], - "collective": { - "type": "opencollective", - "url": "https://opencollective.com/bigjs" - } -} \ No newline at end of file diff --git a/node_modules/commander/CHANGELOG.md b/node_modules/commander/CHANGELOG.md deleted file mode 100644 index 0b55881b5..000000000 --- a/node_modules/commander/CHANGELOG.md +++ /dev/null @@ -1,440 +0,0 @@ -# Changelog - -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) -and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). (Format adopted after v3.0.0.) - - - - -## [7.2.0] (2021-03-26) - -### Added - -- TypeScript typing for `parent` property on `Command` ([#1475]) -- TypeScript typing for `.attributeName()` on `Option` ([#1483]) -- support information in package ([#1477]) - -### Changed - -- improvements to error messages, README, and tests -- update dependencies - -## [7.1.0] (2021-02-15) - -### Added - -- support for named imports from ECMAScript modules ([#1440]) -- add `.cjs` to list of expected script file extensions ([#1449]) -- allow using option choices and variadic together ([#1454]) - -### Fixed - -- replace use of deprecated `process.mainModule` ([#1448]) -- regression for legacy `command('*')` and call when command line includes options ([#1464]) -- regression for `on('command:*', ...)` and call when command line includes unknown options ([#1464]) -- display best error for combination of unknown command and unknown option (i.e. unknown command) ([#1464]) - -### Changed - -- make TypeScript typings tests stricter ([#1453]) -- improvements to README and tests - -## [7.0.0] (2021-01-15) - -### Added - -- `.enablePositionalOptions()` to let program and subcommand reuse same option ([#1427]) -- `.passThroughOptions()` to pass options through to other programs without needing `--` ([#1427]) -- `.allowExcessArguments(false)` to show an error message if there are too many command-arguments on command line for the action handler ([#1409]) -- `.configureOutput()` to modify use of stdout and stderr or customise display of errors ([#1387]) -- use `.addHelpText()` to add text before or after the built-in help, for just current command or also for all subcommands ([#1296]) -- enhance Option class ([#1331]) - - allow hiding options from help - - allow restricting option arguments to a list of choices - - allow setting how default value is shown in help -- `.createOption()` to support subclassing of automatically created options (like `.createCommand()`) ([#1380]) -- refactor the code generating the help into a separate public Help class ([#1365]) - - support sorting subcommands and options in help - - support specifying wrap width (columns) - - allow subclassing Help class - - allow configuring Help class without subclassing - -### Changed - -- *Breaking:* options are stored safely by default, not as properties on the command ([#1409]) - - this especially affects accessing options on program, use `program.opts()` - - revert behaviour with `.storeOptionsAsProperties()` -- *Breaking:* action handlers are passed options and command separately ([#1409]) -- deprecated callback parameter to `.help()` and `.outputHelp()` (removed from README) ([#1296]) -- *Breaking:* errors now displayed using `process.stderr.write()` instead of `console.error()` -- deprecate `.on('--help')` (removed from README) ([#1296]) -- initialise the command description to empty string (previously undefined) ([#1365]) -- document and annotate deprecated routines ([#1349]) - -### Fixed - -- wrapping bugs in help ([#1365]) - - first line of command description was wrapping two characters early - - pad width calculation was not including help option and help command - - pad width calculation was including hidden options and commands -- improve backwards compatibility for custom command event listeners ([#1403]) - -### Deleted - -- *Breaking:* `.passCommandToAction()` ([#1409]) - - no longer needed as action handler is passed options and command -- *Breaking:* "extra arguments" parameter to action handler ([#1409]) - - if being used to detect excess arguments, there is now an error available by setting `.allowExcessArguments(false)` - -### Migration Tips - -The biggest change is the parsed option values. Previously the options were stored by default as properties on the command object, and now the options are stored separately. - -If you wish to restore the old behaviour and get running quickly you can call `.storeOptionsAsProperties()`. -To allow you to move to the new code patterns incrementally, the action handler will be passed the command _twice_, -to match the new "options" and "command" parameters (see below). - -**program options** - -Use the `.opts()` method to access the options. This is available on any command but is used most with the program. - -```js -program.option('-d, --debug'); -program.parse(); -// Old code before Commander 7 -if (program.debug) console.log(`Program name is ${program.name()}`); -``` - -```js -// New code -const options = program.opts(); -if (options.debug) console.log(`Program name is ${program.name()}`); -``` - -**action handler** - -The action handler gets passed a parameter for each command-argument you declared. Previously by default the next parameter was the command object with the options as properties. Now the next two parameters are instead the options and the command. If you -only accessed the options there may be no code changes required. - -```js -program - .command('compress ') - .option('-t, --trace') - // Old code before Commander 7 - .action((filename, cmd)) => { - if (cmd.trace) console.log(`Command name is ${cmd.name()}`); - }); -``` - -```js - // New code - .action((filename, options, command)) => { - if (options.trace) console.log(`Command name is ${command.name()}`); - }); -``` - -If you already set `.storeOptionsAsProperties(false)` you may still need to adjust your code. - -```js -program - .command('compress ') - .storeOptionsAsProperties(false) - .option('-t, --trace') - // Old code before Commander 7 - .action((filename, command)) => { - if (command.opts().trace) console.log(`Command name is ${command.name()}`); - }); -``` - -```js - // New code - .action((filename, options, command)) => { - if (command.opts().trace) console.log(`Command name is ${command.name()}`); - }); -``` - -## [7.0.0-2] (2020-12-14) - -(Released in 7.0.0) - -## [7.0.0-1] (2020-11-21) - -(Released in 7.0.0) - -## [7.0.0-0] (2020-10-25) - -(Released in 7.0.0) - -## [6.2.1] (2020-12-13) - -### Fixed - -- some tests failed if directory path included a space ([1390]) - -## [6.2.0] (2020-10-25) - -### Added - -- added 'tsx' file extension for stand-alone executable subcommands ([#1368]) -- documented second parameter to `.description()` to describe command arguments ([#1353]) -- documentation of special cases with options taking varying numbers of option-arguments ([#1332]) -- documentation for terminology ([#1361]) - -### Fixed - -- add missing TypeScript definition for `.addHelpCommand()' ([#1375]) -- removed blank line after "Arguments:" in help, to match "Options:" and "Commands:" ([#1360]) - -### Changed - -- update dependencies - -## [6.1.0] (2020-08-28) - -### Added - -- include URL to relevant section of README for error for potential conflict between Command properties and option values ([#1306]) -- `.combineFlagAndOptionalValue(false)` to ease upgrade path from older versions of Commander ([#1326]) -- allow disabling the built-in help option using `.helpOption(false)` ([#1325]) -- allow just some arguments in `argumentDescription` to `.description()` ([#1323]) - -### Changed - -- tidy async test and remove lint override ([#1312]) - -### Fixed - -- executable subcommand launching when script path not known ([#1322]) - -## [6.0.0] (2020-07-21) - -### Added - -- add support for variadic options ([#1250]) -- allow options to be added with just a short flag ([#1256]) - - *Breaking* the option property has same case as flag. e.g. flag `-n` accessed as `opts().n` (previously uppercase) -- *Breaking* throw an error if there might be a clash between option name and a Command property, with advice on how to resolve ([#1275]) - -### Fixed - -- Options which contain -no- in the middle of the option flag should not be treated as negatable. ([#1301]) - -## [6.0.0-0] (2020-06-20) - -(Released in 6.0.0) - -## [5.1.0] (2020-04-25) - -### Added - -- support for multiple command aliases, the first of which is shown in the auto-generated help ([#531], [#1236]) -- configuration support in `addCommand()` for `hidden` and `isDefault` ([#1232]) - -### Fixed - -- omit masked help flags from the displayed help ([#645], [#1247]) -- remove old short help flag when change help flags using `helpOption` ([#1248]) - -### Changed - -- remove use of `arguments` to improve auto-generated help in editors ([#1235]) -- rename `.command()` configuration `noHelp` to `hidden` (but not remove old support) ([#1232]) -- improvements to documentation -- update dependencies -- update tested versions of node -- eliminate lint errors in TypeScript ([#1208]) - -## [5.0.0] (2020-03-14) - -### Added - -* support for nested commands with action-handlers ([#1] [#764] [#1149]) -* `.addCommand()` for adding a separately configured command ([#764] [#1149]) -* allow a non-executable to be set as the default command ([#742] [#1149]) -* implicit help command when there are subcommands (previously only if executables) ([#1149]) -* customise implicit help command with `.addHelpCommand()` ([#1149]) -* display error message for unknown subcommand, by default ([#432] [#1088] [#1149]) -* display help for missing subcommand, by default ([#1088] [#1149]) -* combined short options as single argument may include boolean flags and value flag and value (e.g. `-a -b -p 80` can be written as `-abp80`) ([#1145]) -* `.parseOption()` includes short flag and long flag expansions ([#1145]) -* `.helpInformation()` returns help text as a string, previously a private routine ([#1169]) -* `.parse()` implicitly uses `process.argv` if arguments not specified ([#1172]) -* optionally specify where `.parse()` arguments "from", if not following node conventions ([#512] [#1172]) -* suggest help option along with unknown command error ([#1179]) -* TypeScript definition for `commands` property of `Command` ([#1184]) -* export `program` property ([#1195]) -* `createCommand` factory method to simplify subclassing ([#1191]) - -### Fixed - -* preserve argument order in subcommands ([#508] [#962] [#1138]) -* do not emit `command:*` for executable subcommands ([#809] [#1149]) -* action handler called whether or not there are non-option arguments ([#1062] [#1149]) -* combining option short flag and value in single argument now works for subcommands ([#1145]) -* only add implicit help command when it will not conflict with other uses of argument ([#1153] [#1149]) -* implicit help command works with command aliases ([#948] [#1149]) -* options are validated whether or not there is an action handler ([#1149]) - -### Changed - -* *Breaking* `.args` contains command arguments with just recognised options removed ([#1032] [#1138]) -* *Breaking* display error if required argument for command is missing ([#995] [#1149]) -* tighten TypeScript definition of custom option processing function passed to `.option()` ([#1119]) -* *Breaking* `.allowUnknownOption()` ([#802] [#1138]) - * unknown options included in arguments passed to command action handler - * unknown options included in `.args` -* only recognised option short flags and long flags are expanded (e.g. `-ab` or `--foo=bar`) ([#1145]) -* *Breaking* `.parseOptions()` ([#1138]) - * `args` in returned result renamed `operands` and does not include anything after first unknown option - * `unknown` in returned result has arguments after first unknown option including operands, not just options and values -* *Breaking* `.on('command:*', callback)` and other command events passed (changed) results from `.parseOptions`, i.e. operands and unknown ([#1138]) -* refactor Option from prototype to class ([#1133]) -* refactor Command from prototype to class ([#1159]) -* changes to error handling ([#1165]) - * throw for author error, not just display message - * preflight for variadic error - * add tips to missing subcommand executable -* TypeScript fluent return types changed to be more subclass friendly, return `this` rather than `Command` ([#1180]) -* `.parseAsync` returns `Promise` to be consistent with `.parse()` ([#1180]) -* update dependencies - -### Removed - -* removed EventEmitter from TypeScript definition for Command, eliminating implicit peer dependency on `@types/node` ([#1146]) -* removed private function `normalize` (the functionality has been integrated into `parseOptions`) ([#1145]) -* `parseExpectedArgs` is now private ([#1149]) - -### Migration Tips - -If you use `.on('command:*')` or more complicated tests to detect an unrecognised subcommand, you may be able to delete the code and rely on the default behaviour. - -If you use `program.args` or more complicated tests to detect a missing subcommand, you may be able to delete the code and rely on the default behaviour. - -If you use `.command('*')` to add a default command, you may be be able to switch to `isDefault:true` with a named command. - -If you want to continue combining short options with optional values as though they were boolean flags, set `combineFlagAndOptionalValue(false)` -to expand `-fb` to `-f -b` rather than `-f b`. - -## [5.0.0-4] (2020-03-03) - -(Released in 5.0.0) - -## [5.0.0-3] (2020-02-20) - -(Released in 5.0.0) - -## [5.0.0-2] (2020-02-10) - -(Released in 5.0.0) - -## [5.0.0-1] (2020-02-08) - -(Released in 5.0.0) - -## [5.0.0-0] (2020-02-02) - -(Released in 5.0.0) - -## Older versions - -* [4.x](./changelogs/CHANGELOG-4.md) -* [3.x](./changelogs/CHANGELOG-3.md) -* [2.x](./changelogs/CHANGELOG-2.md) -* [1.x](./changelogs/CHANGELOG-1.md) -* [0.x](./changelogs/CHANGELOG-0.md) - -[#1]: https://github.com/tj/commander.js/issues/1 -[#432]: https://github.com/tj/commander.js/issues/432 -[#508]: https://github.com/tj/commander.js/issues/508 -[#512]: https://github.com/tj/commander.js/issues/512 -[#531]: https://github.com/tj/commander.js/issues/531 -[#645]: https://github.com/tj/commander.js/issues/645 -[#742]: https://github.com/tj/commander.js/issues/742 -[#764]: https://github.com/tj/commander.js/issues/764 -[#802]: https://github.com/tj/commander.js/issues/802 -[#809]: https://github.com/tj/commander.js/issues/809 -[#948]: https://github.com/tj/commander.js/issues/948 -[#962]: https://github.com/tj/commander.js/issues/962 -[#995]: https://github.com/tj/commander.js/issues/995 -[#1032]: https://github.com/tj/commander.js/issues/1032 -[#1062]: https://github.com/tj/commander.js/pull/1062 -[#1088]: https://github.com/tj/commander.js/issues/1088 -[#1119]: https://github.com/tj/commander.js/pull/1119 -[#1133]: https://github.com/tj/commander.js/pull/1133 -[#1138]: https://github.com/tj/commander.js/pull/1138 -[#1145]: https://github.com/tj/commander.js/pull/1145 -[#1146]: https://github.com/tj/commander.js/pull/1146 -[#1149]: https://github.com/tj/commander.js/pull/1149 -[#1153]: https://github.com/tj/commander.js/issues/1153 -[#1159]: https://github.com/tj/commander.js/pull/1159 -[#1165]: https://github.com/tj/commander.js/pull/1165 -[#1169]: https://github.com/tj/commander.js/pull/1169 -[#1172]: https://github.com/tj/commander.js/pull/1172 -[#1179]: https://github.com/tj/commander.js/pull/1179 -[#1180]: https://github.com/tj/commander.js/pull/1180 -[#1184]: https://github.com/tj/commander.js/pull/1184 -[#1191]: https://github.com/tj/commander.js/pull/1191 -[#1195]: https://github.com/tj/commander.js/pull/1195 -[#1208]: https://github.com/tj/commander.js/pull/1208 -[#1232]: https://github.com/tj/commander.js/pull/1232 -[#1235]: https://github.com/tj/commander.js/pull/1235 -[#1236]: https://github.com/tj/commander.js/pull/1236 -[#1247]: https://github.com/tj/commander.js/pull/1247 -[#1248]: https://github.com/tj/commander.js/pull/1248 -[#1250]: https://github.com/tj/commander.js/pull/1250 -[#1256]: https://github.com/tj/commander.js/pull/1256 -[#1275]: https://github.com/tj/commander.js/pull/1275 -[#1296]: https://github.com/tj/commander.js/pull/1296 -[#1301]: https://github.com/tj/commander.js/issues/1301 -[#1306]: https://github.com/tj/commander.js/pull/1306 -[#1312]: https://github.com/tj/commander.js/pull/1312 -[#1322]: https://github.com/tj/commander.js/pull/1322 -[#1323]: https://github.com/tj/commander.js/pull/1323 -[#1325]: https://github.com/tj/commander.js/pull/1325 -[#1326]: https://github.com/tj/commander.js/pull/1326 -[#1331]: https://github.com/tj/commander.js/pull/1331 -[#1332]: https://github.com/tj/commander.js/pull/1332 -[#1349]: https://github.com/tj/commander.js/pull/1349 -[#1353]: https://github.com/tj/commander.js/pull/1353 -[#1360]: https://github.com/tj/commander.js/pull/1360 -[#1361]: https://github.com/tj/commander.js/pull/1361 -[#1365]: https://github.com/tj/commander.js/pull/1365 -[#1368]: https://github.com/tj/commander.js/pull/1368 -[#1375]: https://github.com/tj/commander.js/pull/1375 -[#1380]: https://github.com/tj/commander.js/pull/1380 -[#1387]: https://github.com/tj/commander.js/pull/1387 -[#1390]: https://github.com/tj/commander.js/pull/1390 -[#1403]: https://github.com/tj/commander.js/pull/1403 -[#1409]: https://github.com/tj/commander.js/pull/1409 -[#1427]: https://github.com/tj/commander.js/pull/1427 -[#1440]: https://github.com/tj/commander.js/pull/1440 -[#1448]: https://github.com/tj/commander.js/pull/1448 -[#1449]: https://github.com/tj/commander.js/pull/1449 -[#1453]: https://github.com/tj/commander.js/pull/1453 -[#1454]: https://github.com/tj/commander.js/pull/1454 -[#1464]: https://github.com/tj/commander.js/pull/1464 -[#1475]: https://github.com/tj/commander.js/pull/1475 -[#1477]: https://github.com/tj/commander.js/pull/1477 -[#1483]: https://github.com/tj/commander.js/pull/1483 - -[Unreleased]: https://github.com/tj/commander.js/compare/master...develop -[7.2.0]: https://github.com/tj/commander.js/compare/v7.1.0...v7.2.0 -[7.1.0]: https://github.com/tj/commander.js/compare/v7.0.0...v7.1.0 -[7.0.0]: https://github.com/tj/commander.js/compare/v6.2.1...v7.0.0 -[7.0.0-2]: https://github.com/tj/commander.js/compare/v7.0.0-1...v7.0.0-2 -[7.0.0-1]: https://github.com/tj/commander.js/compare/v7.0.0-0...v7.0.0-1 -[7.0.0-0]: https://github.com/tj/commander.js/compare/v6.2.0...v7.0.0-0 -[6.2.1]: https://github.com/tj/commander.js/compare/v6.2.0..v6.2.1 -[6.2.0]: https://github.com/tj/commander.js/compare/v6.1.0..v6.2.0 -[6.1.0]: https://github.com/tj/commander.js/compare/v6.0.0..v6.1.0 -[6.0.0]: https://github.com/tj/commander.js/compare/v5.1.0..v6.0.0 -[6.0.0-0]: https://github.com/tj/commander.js/compare/v5.1.0..v6.0.0-0 -[5.1.0]: https://github.com/tj/commander.js/compare/v5.0.0..v5.1.0 -[5.0.0]: https://github.com/tj/commander.js/compare/v4.1.1..v5.0.0 -[5.0.0-4]: https://github.com/tj/commander.js/compare/v5.0.0-3..v5.0.0-4 -[5.0.0-3]: https://github.com/tj/commander.js/compare/v5.0.0-2..v5.0.0-3 -[5.0.0-2]: https://github.com/tj/commander.js/compare/v5.0.0-1..v5.0.0-2 -[5.0.0-1]: https://github.com/tj/commander.js/compare/v5.0.0-0..v5.0.0-1 -[5.0.0-0]: https://github.com/tj/commander.js/compare/v4.1.1..v5.0.0-0 diff --git a/node_modules/commander/Readme.md b/node_modules/commander/Readme.md index d2a88a7b2..39c248b04 100644 --- a/node_modules/commander/Readme.md +++ b/node_modules/commander/Readme.md @@ -11,6 +11,7 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md) - [Commander.js](#commanderjs) - [Installation](#installation) + - [Quick Start](#quick-start) - [Declaring _program_ variable](#declaring-program-variable) - [Options](#options) - [Common option types, boolean and value](#common-option-types-boolean-and-value) @@ -22,16 +23,22 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md) - [More configuration](#more-configuration) - [Custom option processing](#custom-option-processing) - [Commands](#commands) - - [Specify the argument syntax](#specify-the-argument-syntax) + - [Command-arguments](#command-arguments) + - [More configuration](#more-configuration-1) + - [Custom argument processing](#custom-argument-processing) - [Action handler](#action-handler) - [Stand-alone executable (sub)commands](#stand-alone-executable-subcommands) + - [Life cycle hooks](#life-cycle-hooks) - [Automated help](#automated-help) - [Custom help](#custom-help) + - [Display help after errors](#display-help-after-errors) - [Display help from code](#display-help-from-code) - - [.usage and .name](#usage-and-name) + - [.name](#name) + - [.usage](#usage) + - [.description and .summary](#description-and-summary) - [.helpOption(flags, description)](#helpoptionflags-description) - [.addHelpCommand()](#addhelpcommand) - - [More configuration](#more-configuration-1) + - [More configuration](#more-configuration-2) - [Custom event listeners](#custom-event-listeners) - [Bits and pieces](#bits-and-pieces) - [.parse() and .parseAsync()](#parse-and-parseasync) @@ -41,9 +48,9 @@ Read this in other languages: English | [简体中文](./Readme_zh-CN.md) - [createCommand()](#createcommand) - [Node options such as `--harmony`](#node-options-such-as---harmony) - [Debugging stand-alone executable subcommands](#debugging-stand-alone-executable-subcommands) + - [Display error](#display-error) - [Override exit and output handling](#override-exit-and-output-handling) - [Additional documentation](#additional-documentation) - - [Examples](#examples) - [Support](#support) - [Commander for enterprise](#commander-for-enterprise) @@ -51,62 +58,150 @@ For information about terms used in this document see: [terminology](./docs/term ## Installation -```bash +```sh npm install commander ``` +## Quick Start + +You write code to describe your command line interface. +Commander looks after parsing the arguments into options and command-arguments, +displays usage errors for problems, and implements a help system. + +Commander is strict and displays an error for unrecognised options. +The two most used option types are a boolean option, and an option which takes its value from the following argument. + +Example file: [split.js](./examples/split.js) + +```js +const { program } = require('commander'); + +program + .option('--first') + .option('-s, --separator '); + +program.parse(); + +const options = program.opts(); +const limit = options.first ? 1 : undefined; +console.log(program.args[0].split(options.separator, limit)); +``` + +```console +$ node split.js -s / --fits a/b/c +error: unknown option '--fits' +(Did you mean --first?) +$ node split.js -s / --first a/b/c +[ 'a' ] +``` + +Here is a more complete program using a subcommand and with descriptions for the help. In a multi-command program, you have an action handler for each command (or stand-alone executables for the commands). + +Example file: [string-util.js](./examples/string-util.js) + +```js +const { Command } = require('commander'); +const program = new Command(); + +program + .name('string-util') + .description('CLI to some JavaScript string utilities') + .version('0.8.0'); + +program.command('split') + .description('Split a string into substrings and display as an array') + .argument('', 'string to split') + .option('--first', 'display just the first substring') + .option('-s, --separator ', 'separator character', ',') + .action((str, options) => { + const limit = options.first ? 1 : undefined; + console.log(str.split(options.separator, limit)); + }); + +program.parse(); +``` + +```console +$ node string-util.js help split +Usage: string-util split [options] + +Split a string into substrings and display as an array. + +Arguments: + string string to split + +Options: + --first display just the first substring + -s, --separator separator character (default: ",") + -h, --help display help for command + +$ node string-util.js split --separator=/ a/b/c +[ 'a', 'b', 'c' ] +``` + +More samples can be found in the [examples](https://github.com/tj/commander.js/tree/master/examples) directory. + ## Declaring _program_ variable Commander exports a global object which is convenient for quick programs. This is used in the examples in this README for brevity. ```js +// CommonJS (.cjs) const { program } = require('commander'); -program.version('0.0.1'); ``` For larger programs which may use commander in multiple ways, including unit testing, it is better to create a local Command object to use. ```js +// CommonJS (.cjs) const { Command } = require('commander'); const program = new Command(); -program.version('0.0.1'); ``` -For named imports in ECMAScript modules, import from `commander/esm.mjs`. - ```js -// index.mjs -import { Command } from 'commander/esm.mjs'; +// ECMAScript (.mjs) +import { Command } from 'commander'; const program = new Command(); ``` -And in TypeScript: - ```ts -// index.ts +// TypeScript (.ts) import { Command } from 'commander'; const program = new Command(); ``` - ## Options Options are defined with the `.option()` method, also serving as documentation for the options. Each option can have a short flag (single character) and a long name, separated by a comma or space or vertical bar ('|'). -The parsed options can be accessed by calling `.opts()` on a `Command` object, and are passed to the action handler. Multi-word options such as "--template-engine" are camel-cased, becoming `program.opts().templateEngine` etc. +The parsed options can be accessed by calling `.opts()` on a `Command` object, and are passed to the action handler. + +Multi-word options such as "--template-engine" are camel-cased, becoming `program.opts().templateEngine` etc. -Multiple short flags may optionally be combined in a single argument following the dash: boolean flags, followed by a single option taking a value (possibly followed by the value). -For example `-a -b -p 80` may be written as `-ab -p80` or even `-abp80`. +An option and its option-argument can be separated by a space, or combined into the same argument. The option-argument can follow the short option directly or follow an `=` for a long option. + +```sh +serve -p 80 +serve -p80 +serve --port 80 +serve --port=80 +``` You can use `--` to indicate the end of the options, and any remaining arguments will be used without being interpreted. By default options on the command line are not positional, and can be specified before or after other arguments. +There are additional related routines for when `.opts()` is not enough: + +- `.optsWithGlobals()` returns merged local and global option values +- `.getOptionValue()` and `.setOptionValue()` work with a single option value +- `.getOptionValueSource()` and `.setOptionValueWithSource()` include where the option value came from + ### Common option types, boolean and value The two most used option types are a boolean option, and an option which takes its value -from the following argument (declared with angle brackets like `--expect `). Both are `undefined` unless specified on command line. +from the following argument (declared with angle brackets like `--expect `). Both are `undefined` unless specified on command line. Example file: [options-common.js](./examples/options-common.js) @@ -125,13 +220,10 @@ if (options.small) console.log('- small pizza size'); if (options.pizzaType) console.log(`- ${options.pizzaType}`); ``` -```bash -$ pizza-options -d -{ debug: true, small: undefined, pizzaType: undefined } -pizza details: +```console $ pizza-options -p error: option '-p, --pizza-type ' argument missing -$ pizza-options -ds -p vegetarian +$ pizza-options -d -s -p vegetarian { debug: true, small: true, pizzaType: 'vegetarian' } pizza details: - small pizza size @@ -141,11 +233,17 @@ pizza details: - cheese ``` +Multiple boolean short options may be combined together following the dash, and may be followed by a single short option taking a value. +For example `-d -s -p cheese` may be written as `-ds -p cheese` or even `-dsp cheese`. + +Options with an expected option-argument are greedy and will consume the following argument whatever the value. +So `--id -xyz` reads `-xyz` as the option-argument. + `program.parse(arguments)` processes the arguments, leaving any args not consumed by the program options in the `program.args` array. The parameter is optional and defaults to `process.argv`. ### Default option value -You can specify a default value for an option which takes a value. +You can specify a default value for an option. Example file: [options-defaults.js](./examples/options-defaults.js) @@ -158,7 +256,7 @@ program.parse(); console.log(`cheese: ${program.opts().cheese}`); ``` -```bash +```console $ pizza-options cheese: blue $ pizza-options --cheese stilton @@ -171,7 +269,7 @@ You can define a boolean option long name with a leading `no-` to set the option Defined alone this also makes the option true by default. If you define `--foo` first, adding `--no-foo` does not change the default value from what it would -otherwise be. You can specify a default boolean value for a boolean option and it can be overridden on command line. +otherwise be. Example file: [options-negatable.js](./examples/options-negatable.js) @@ -188,7 +286,7 @@ const cheeseStr = (options.cheese === false) ? 'no cheese' : `${options.cheese} console.log(`You ordered a pizza with ${sauceStr} and ${cheeseStr}`); ``` -```bash +```console $ pizza-options You ordered a pizza with sauce and mozzarella cheese $ pizza-options --sauce @@ -216,7 +314,7 @@ else if (options.cheese === true) console.log('add cheese'); else console.log(`add cheese type ${options.cheese}`); ``` -```bash +```console $ pizza-options no cheese $ pizza-options --cheese @@ -225,11 +323,14 @@ $ pizza-options --cheese mozzarella add cheese type mozzarella ``` +Options with an optional option-argument are not greedy and will ignore arguments starting with a dash. +So `id` behaves as a boolean option for `--id -5`, but you can use a combined form if needed like `--id=-5`. + For information about possible ambiguous cases, see [options taking varying arguments](./docs/options-taking-varying-arguments.md). ### Required option -You may specify a required (mandatory) option using `.requiredOption`. The option must have a value after parsing, usually specified on the command line, or perhaps from a default value (say from environment). The method is otherwise the same as `.option` in format, taking flags and description, and optional default value or custom processing. +You may specify a required (mandatory) option using `.requiredOption()`. The option must have a value after parsing, usually specified on the command line, or perhaps from a default value (say from environment). The method is otherwise the same as `.option()` in format, taking flags and description, and optional default value or custom processing. Example file: [options-required.js](./examples/options-required.js) @@ -240,7 +341,7 @@ program program.parse(); ``` -```bash +```console $ pizza error: required option '-c, --cheese ' not specified ``` @@ -265,7 +366,7 @@ console.log('Options: ', program.opts()); console.log('Remaining arguments: ', program.args); ``` -```bash +```console $ collect -n 1 2 3 --letter a b c Options: { number: [ '1', '2', '3' ], letter: [ 'a', 'b', 'c' ] } Remaining arguments: [] @@ -287,7 +388,7 @@ The optional `version` method adds handling for displaying the command version. program.version('0.0.1'); ``` -```bash +```console $ ./examples/pizza -V 0.0.1 ``` @@ -304,28 +405,44 @@ program.version('0.0.1', '-v, --vers', 'output the current version'); You can add most options using the `.option()` method, but there are some additional features available by constructing an `Option` explicitly for less common cases. -Example file: [options-extra.js](./examples/options-extra.js) +Example files: [options-extra.js](./examples/options-extra.js), [options-env.js](./examples/options-env.js), [options-conflicts.js](./examples/options-conflicts.js), [options-implies.js](./examples/options-implies.js) ```js program .addOption(new Option('-s, --secret').hideHelp()) .addOption(new Option('-t, --timeout ', 'timeout in seconds').default(60, 'one minute')) - .addOption(new Option('-d, --drink ', 'drink size').choices(['small', 'medium', 'large'])); + .addOption(new Option('-d, --drink ', 'drink size').choices(['small', 'medium', 'large'])) + .addOption(new Option('-p, --port ', 'port number').env('PORT')) + .addOption(new Option('--donate [amount]', 'optional donation in dollars').preset('20').argParser(parseFloat)) + .addOption(new Option('--disable-server', 'disables the server').conflicts('port')) + .addOption(new Option('--free-drink', 'small drink included free ').implies({ drink: 'small' })); ``` -```bash +```console $ extra --help Usage: help [options] Options: -t, --timeout timeout in seconds (default: one minute) -d, --drink drink cup size (choices: "small", "medium", "large") + -p, --port port number (env: PORT) + --donate [amount] optional donation in dollars (preset: "20") + --disable-server disables the server + --free-drink small drink included free -h, --help display help for command $ extra --drink huge error: option '-d, --drink ' argument 'huge' is invalid. Allowed choices are small, medium, large. + +$ PORT=80 extra --donate --free-drink +Options: { timeout: 60, donate: 20, port: '80', freeDrink: true, drink: 'small' } + +$ extra --disable-server --port 8000 +error: option '--disable-server' cannot be used with option '-p, --port ' ``` +Specify a required (mandatory) option using the `Option` method `.makeOptionMandatory()`. This matches the `Command` method [.requiredOption()](#required-option). + ### Custom option processing You may specify a function to do custom processing of option-arguments. The callback function receives two parameters, @@ -342,7 +459,7 @@ function myParseInt(value, dummyPrevious) { // parseInt takes a string and a radix const parsedValue = parseInt(value, 10); if (isNaN(parsedValue)) { - throw new commander.InvalidOptionArgumentError('Not a number.'); + throw new commander.InvalidArgumentError('Not a number.'); } return parsedValue; } @@ -377,7 +494,7 @@ if (options.collect.length > 0) console.log(options.collect); if (options.list !== undefined) console.log(options.list); ``` -```bash +```console $ custom -f 1e2 float: 100 $ custom --integer 2 @@ -394,7 +511,7 @@ $ custom --list x,y,z You can specify (sub)commands using `.command()` or `.addCommand()`. There are two ways these can be implemented: using an action handler attached to the command, or as a stand-alone executable file (described in more detail later). The subcommands may be nested ([example](./examples/nestedCommands.js)). -In the first parameter to `.command()` you specify the command name and any command-arguments. The arguments may be `` or `[optional]`, and the last argument may also be `variadic...`. +In the first parameter to `.command()` you specify the command name. You may append the command-arguments after the command name, or specify them separately using `.argument()`. The arguments may be `` or `[optional]`, and the last argument may also be `variadic...`. You can use `.addCommand()` to add an already configured subcommand to the program. @@ -410,7 +527,7 @@ program console.log('clone command called'); }); -// Command implemented using stand-alone executable file (description is second parameter to `.command`) +// Command implemented using stand-alone executable file, indicated by adding description as second parameter to `.command`. // Returns `this` for adding more commands. program .command('start ', 'start named service') @@ -422,40 +539,43 @@ program .addCommand(build.makeBuildCommand()); ``` -Configuration options can be passed with the call to `.command()` and `.addCommand()`. Specifying `hidden: true` will +Configuration options can be passed with the call to `.command()` and `.addCommand()`. Specifying `hidden: true` will remove the command from the generated help output. Specifying `isDefault: true` will run the subcommand if no other subcommand is specified ([example](./examples/defaultCommand.js)). -### Specify the argument syntax +For safety, `.addCommand()` does not automatically copy the inherited settings from the parent command. There is a helper routine `.copyInheritedSettings()` for copying the settings when they are wanted. + +### Command-arguments + +For subcommands, you can specify the argument syntax in the call to `.command()` (as shown above). This +is the only method usable for subcommands implemented using a stand-alone executable, but for other subcommands +you can instead use the following method. -You use `.arguments` to specify the expected command-arguments for the top-level command, and for subcommands they are usually -included in the `.command` call. Angled brackets (e.g. ``) indicate required command-arguments. -Square brackets (e.g. `[optional]`) indicate optional command-arguments. -You can optionally describe the arguments in the help by supplying a hash as second parameter to `.description()`. +To configure a command, you can use `.argument()` to specify each expected command-argument. +You supply the argument name and an optional description. The argument may be `` or `[optional]`. +You can specify a default value for an optional command-argument. -Example file: [arguments.js](./examples/arguments.js) +Example file: [argument.js](./examples/argument.js) ```js program .version('0.1.0') - .arguments(' [password]') - .description('test command', { - username: 'user to login', - password: 'password for user, if required' - }) + .argument('', 'user to login') + .argument('[password]', 'password for user, if required', 'no password given') .action((username, password) => { console.log('username:', username); - console.log('environment:', password || 'no password given'); + console.log('password:', password); }); ``` The last argument of a command can be variadic, and only the last argument. To make an argument variadic you - append `...` to the argument name. For example: + append `...` to the argument name. A variadic argument is passed to the action handler as an array. For example: ```js program .version('0.1.0') - .command('rmdir ') + .command('rmdir') + .argument('') .action(function (dirs) { dirs.forEach((dir) => { console.log('rmdir %s', dir); @@ -463,18 +583,58 @@ program }); ``` -The variadic argument is passed to the action handler as an array. +There is a convenience method to add multiple arguments at once, but without descriptions: + +```js +program + .arguments(' '); +``` + +#### More configuration + +There are some additional features available by constructing an `Argument` explicitly for less common cases. + +Example file: [arguments-extra.js](./examples/arguments-extra.js) + +```js +program + .addArgument(new commander.Argument('', 'drink cup size').choices(['small', 'medium', 'large'])) + .addArgument(new commander.Argument('[timeout]', 'timeout in seconds').default(60, 'one minute')) +``` + +#### Custom argument processing + +You may specify a function to do custom processing of command-arguments (like for option-arguments). +The callback function receives two parameters, the user specified command-argument and the previous value for the argument. +It returns the new value for the argument. + +The processed argument values are passed to the action handler, and saved as `.processedArgs`. + +You can optionally specify the default/starting value for the argument after the function parameter. + +Example file: [arguments-custom-processing.js](./examples/arguments-custom-processing.js) + +```js +program + .command('add') + .argument('', 'integer argument', myParseInt) + .argument('[second]', 'integer argument', myParseInt, 1000) + .action((first, second) => { + console.log(`${first} + ${second} = ${first + second}`); + }) +; +``` ### Action handler The action handler gets passed a parameter for each command-argument you declared, and two additional parameters -which are the parsed options and the command object itself. +which are the parsed options and the command object itself. Example file: [thank.js](./examples/thank.js) ```js program - .arguments('') + .argument('') .option('-t, --title ', 'title to use before name') .option('-d, --debug', 'display some debugging') .action((name, options, command) => { @@ -486,6 +646,20 @@ program }); ``` +If you prefer, you can work with the command directly and skip declaring the parameters for the action handler. The `this` keyword is set to the running command and can be used from a function expression (but not from an arrow function). + +Example file: [action-this.js](./examples/action-this.js) + +```js +program + .command('serve') + .argument(' -``` - -This will create a global `JSON5` variable. - -## API -The JSON5 API is compatible with the [JSON API]. - -[JSON API]: -https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON - -### JSON5.parse() -Parses a JSON5 string, constructing the JavaScript value or object described by -the string. An optional reviver function can be provided to perform a -transformation on the resulting object before it is returned. - -#### Syntax - JSON5.parse(text[, reviver]) - -#### Parameters -- `text`: The string to parse as JSON5. -- `reviver`: If a function, this prescribes how the value originally produced by - parsing is transformed, before being returned. - -#### Return value -The object corresponding to the given JSON5 text. - -### JSON5.stringify() -Converts a JavaScript value to a JSON5 string, optionally replacing values if a -replacer function is specified, or optionally including only the specified -properties if a replacer array is specified. - -#### Syntax - JSON5.stringify(value[, replacer[, space]]) - JSON5.stringify(value[, options]) - -#### Parameters -- `value`: The value to convert to a JSON5 string. -- `replacer`: A function that alters the behavior of the stringification - process, or an array of String and Number objects that serve as a whitelist - for selecting/filtering the properties of the value object to be included in - the JSON5 string. If this value is null or not provided, all properties of the - object are included in the resulting JSON5 string. -- `space`: A String or Number object that's used to insert white space into the - output JSON5 string for readability purposes. If this is a Number, it - indicates the number of space characters to use as white space; this number is - capped at 10 (if it is greater, the value is just 10). Values less than 1 - indicate that no space should be used. If this is a String, the string (or the - first 10 characters of the string, if it's longer than that) is used as white - space. If this parameter is not provided (or is null), no white space is used. - If white space is used, trailing commas will be used in objects and arrays. -- `options`: An object with the following properties: - - `replacer`: Same as the `replacer` parameter. - - `space`: Same as the `space` parameter. - - `quote`: A String representing the quote character to use when serializing - strings. - -#### Return value -A JSON5 string representing the value. - -### Node.js `require()` JSON5 files -When using Node.js, you can `require()` JSON5 files by adding the following -statement. - -```js -require('json5/lib/register') -``` - -Then you can load a JSON5 file with a Node.js `require()` statement. For -example: - -```js -const config = require('./config.json5') -``` - -## CLI -Since JSON is more widely used than JSON5, this package includes a CLI for -converting JSON5 to JSON and for validating the syntax of JSON5 documents. - -### Installation -```sh -npm install --global json5 -``` - -### Usage -```sh -json5 [options] -``` - -If `` is not provided, then STDIN is used. - -#### Options: -- `-s`, `--space`: The number of spaces to indent or `t` for tabs -- `-o`, `--out-file [file]`: Output to the specified file, otherwise STDOUT -- `-v`, `--validate`: Validate JSON5 but do not output JSON -- `-V`, `--version`: Output the version number -- `-h`, `--help`: Output usage information - -## Contributing -### Development -```sh -git clone https://github.com/json5/json5 -cd json5 -npm install -``` - -When contributing code, please write relevant tests and run `npm test` and `npm -run lint` before submitting pull requests. Please use an editor that supports -[EditorConfig](http://editorconfig.org/). - -### Issues -To report bugs or request features regarding the JSON5 data format, please -submit an issue to the [official specification -repository](https://github.com/json5/json5-spec). - -To report bugs or request features regarding the JavaScript implementation of -JSON5, please submit an issue to this repository. - -## License -MIT. See [LICENSE.md](./LICENSE.md) for details. - -## Credits -[Assem Kishore](https://github.com/aseemk) founded this project. - -[Michael Bolin](http://bolinfest.com/) independently arrived at and published -some of these same ideas with awesome explanations and detail. Recommended -reading: [Suggested Improvements to JSON](http://bolinfest.com/essays/json.html) - -[Douglas Crockford](http://www.crockford.com/) of course designed and built -JSON, but his state machine diagrams on the [JSON website](http://json.org/), as -cheesy as it may sound, gave us motivation and confidence that building a new -parser to implement these ideas was within reach! The original -implementation of JSON5 was also modeled directly off of Doug’s open-source -[json_parse.js] parser. We’re grateful for that clean and well-documented -code. - -[json_parse.js]: -https://github.com/douglascrockford/JSON-js/blob/03157639c7a7cddd2e9f032537f346f1a87c0f6d/json_parse.js - -[Max Nanasy](https://github.com/MaxNanasy) has been an early and prolific -supporter, contributing multiple patches and ideas. - -[Andrew Eisenberg](https://github.com/aeisenberg) contributed the original -`stringify` method. - -[Jordan Tucker](https://github.com/jordanbtucker) has aligned JSON5 more closely -with ES5, wrote the official JSON5 specification, completely rewrote the -codebase from the ground up, and is actively maintaining this project. diff --git a/node_modules/loader-utils/node_modules/json5/dist/index.js b/node_modules/loader-utils/node_modules/json5/dist/index.js deleted file mode 100644 index 9f98eb39d..000000000 --- a/node_modules/loader-utils/node_modules/json5/dist/index.js +++ /dev/null @@ -1,1710 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : - typeof define === 'function' && define.amd ? define(factory) : - (global.JSON5 = factory()); -}(this, (function () { 'use strict'; - - function createCommonjsModule(fn, module) { - return module = { exports: {} }, fn(module, module.exports), module.exports; - } - - var _global = createCommonjsModule(function (module) { - // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 - var global = module.exports = typeof window != 'undefined' && window.Math == Math - ? window : typeof self != 'undefined' && self.Math == Math ? self - // eslint-disable-next-line no-new-func - : Function('return this')(); - if (typeof __g == 'number') { __g = global; } // eslint-disable-line no-undef - }); - - var _core = createCommonjsModule(function (module) { - var core = module.exports = { version: '2.6.5' }; - if (typeof __e == 'number') { __e = core; } // eslint-disable-line no-undef - }); - var _core_1 = _core.version; - - var _isObject = function (it) { - return typeof it === 'object' ? it !== null : typeof it === 'function'; - }; - - var _anObject = function (it) { - if (!_isObject(it)) { throw TypeError(it + ' is not an object!'); } - return it; - }; - - var _fails = function (exec) { - try { - return !!exec(); - } catch (e) { - return true; - } - }; - - // Thank's IE8 for his funny defineProperty - var _descriptors = !_fails(function () { - return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; - }); - - var document = _global.document; - // typeof document.createElement is 'object' in old IE - var is = _isObject(document) && _isObject(document.createElement); - var _domCreate = function (it) { - return is ? document.createElement(it) : {}; - }; - - var _ie8DomDefine = !_descriptors && !_fails(function () { - return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7; - }); - - // 7.1.1 ToPrimitive(input [, PreferredType]) - - // instead of the ES6 spec version, we didn't implement @@toPrimitive case - // and the second argument - flag - preferred type is a string - var _toPrimitive = function (it, S) { - if (!_isObject(it)) { return it; } - var fn, val; - if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; } - if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) { return val; } - if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) { return val; } - throw TypeError("Can't convert object to primitive value"); - }; - - var dP = Object.defineProperty; - - var f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) { - _anObject(O); - P = _toPrimitive(P, true); - _anObject(Attributes); - if (_ie8DomDefine) { try { - return dP(O, P, Attributes); - } catch (e) { /* empty */ } } - if ('get' in Attributes || 'set' in Attributes) { throw TypeError('Accessors not supported!'); } - if ('value' in Attributes) { O[P] = Attributes.value; } - return O; - }; - - var _objectDp = { - f: f - }; - - var _propertyDesc = function (bitmap, value) { - return { - enumerable: !(bitmap & 1), - configurable: !(bitmap & 2), - writable: !(bitmap & 4), - value: value - }; - }; - - var _hide = _descriptors ? function (object, key, value) { - return _objectDp.f(object, key, _propertyDesc(1, value)); - } : function (object, key, value) { - object[key] = value; - return object; - }; - - var hasOwnProperty = {}.hasOwnProperty; - var _has = function (it, key) { - return hasOwnProperty.call(it, key); - }; - - var id = 0; - var px = Math.random(); - var _uid = function (key) { - return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); - }; - - var _library = false; - - var _shared = createCommonjsModule(function (module) { - var SHARED = '__core-js_shared__'; - var store = _global[SHARED] || (_global[SHARED] = {}); - - (module.exports = function (key, value) { - return store[key] || (store[key] = value !== undefined ? value : {}); - })('versions', []).push({ - version: _core.version, - mode: _library ? 'pure' : 'global', - copyright: '© 2019 Denis Pushkarev (zloirock.ru)' - }); - }); - - var _functionToString = _shared('native-function-to-string', Function.toString); - - var _redefine = createCommonjsModule(function (module) { - var SRC = _uid('src'); - - var TO_STRING = 'toString'; - var TPL = ('' + _functionToString).split(TO_STRING); - - _core.inspectSource = function (it) { - return _functionToString.call(it); - }; - - (module.exports = function (O, key, val, safe) { - var isFunction = typeof val == 'function'; - if (isFunction) { _has(val, 'name') || _hide(val, 'name', key); } - if (O[key] === val) { return; } - if (isFunction) { _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); } - if (O === _global) { - O[key] = val; - } else if (!safe) { - delete O[key]; - _hide(O, key, val); - } else if (O[key]) { - O[key] = val; - } else { - _hide(O, key, val); - } - // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative - })(Function.prototype, TO_STRING, function toString() { - return typeof this == 'function' && this[SRC] || _functionToString.call(this); - }); - }); - - var _aFunction = function (it) { - if (typeof it != 'function') { throw TypeError(it + ' is not a function!'); } - return it; - }; - - // optional / simple context binding - - var _ctx = function (fn, that, length) { - _aFunction(fn); - if (that === undefined) { return fn; } - switch (length) { - case 1: return function (a) { - return fn.call(that, a); - }; - case 2: return function (a, b) { - return fn.call(that, a, b); - }; - case 3: return function (a, b, c) { - return fn.call(that, a, b, c); - }; - } - return function (/* ...args */) { - return fn.apply(that, arguments); - }; - }; - - var PROTOTYPE = 'prototype'; - - var $export = function (type, name, source) { - var IS_FORCED = type & $export.F; - var IS_GLOBAL = type & $export.G; - var IS_STATIC = type & $export.S; - var IS_PROTO = type & $export.P; - var IS_BIND = type & $export.B; - var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE]; - var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {}); - var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); - var key, own, out, exp; - if (IS_GLOBAL) { source = name; } - for (key in source) { - // contains in native - own = !IS_FORCED && target && target[key] !== undefined; - // export native or passed - out = (own ? target : source)[key]; - // bind timers to global for call from export context - exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out; - // extend global - if (target) { _redefine(target, key, out, type & $export.U); } - // export - if (exports[key] != out) { _hide(exports, key, exp); } - if (IS_PROTO && expProto[key] != out) { expProto[key] = out; } - } - }; - _global.core = _core; - // type bitmap - $export.F = 1; // forced - $export.G = 2; // global - $export.S = 4; // static - $export.P = 8; // proto - $export.B = 16; // bind - $export.W = 32; // wrap - $export.U = 64; // safe - $export.R = 128; // real proto method for `library` - var _export = $export; - - // 7.1.4 ToInteger - var ceil = Math.ceil; - var floor = Math.floor; - var _toInteger = function (it) { - return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); - }; - - // 7.2.1 RequireObjectCoercible(argument) - var _defined = function (it) { - if (it == undefined) { throw TypeError("Can't call method on " + it); } - return it; - }; - - // true -> String#at - // false -> String#codePointAt - var _stringAt = function (TO_STRING) { - return function (that, pos) { - var s = String(_defined(that)); - var i = _toInteger(pos); - var l = s.length; - var a, b; - if (i < 0 || i >= l) { return TO_STRING ? '' : undefined; } - a = s.charCodeAt(i); - return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff - ? TO_STRING ? s.charAt(i) : a - : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; - }; - }; - - var $at = _stringAt(false); - _export(_export.P, 'String', { - // 21.1.3.3 String.prototype.codePointAt(pos) - codePointAt: function codePointAt(pos) { - return $at(this, pos); - } - }); - - var codePointAt = _core.String.codePointAt; - - var max = Math.max; - var min = Math.min; - var _toAbsoluteIndex = function (index, length) { - index = _toInteger(index); - return index < 0 ? max(index + length, 0) : min(index, length); - }; - - var fromCharCode = String.fromCharCode; - var $fromCodePoint = String.fromCodePoint; - - // length should be 1, old FF problem - _export(_export.S + _export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', { - // 21.1.2.2 String.fromCodePoint(...codePoints) - fromCodePoint: function fromCodePoint(x) { - var arguments$1 = arguments; - // eslint-disable-line no-unused-vars - var res = []; - var aLen = arguments.length; - var i = 0; - var code; - while (aLen > i) { - code = +arguments$1[i++]; - if (_toAbsoluteIndex(code, 0x10ffff) !== code) { throw RangeError(code + ' is not a valid code point'); } - res.push(code < 0x10000 - ? fromCharCode(code) - : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00) - ); - } return res.join(''); - } - }); - - var fromCodePoint = _core.String.fromCodePoint; - - // This is a generated file. Do not edit. - var Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/; - var ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/; - var ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\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40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76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uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/; - - var unicode = { - Space_Separator: Space_Separator, - ID_Start: ID_Start, - ID_Continue: ID_Continue - }; - - var util = { - isSpaceSeparator: function isSpaceSeparator (c) { - return typeof c === 'string' && unicode.Space_Separator.test(c) - }, - - isIdStartChar: function isIdStartChar (c) { - return typeof c === 'string' && ( - (c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || - (c === '$') || (c === '_') || - unicode.ID_Start.test(c) - ) - }, - - isIdContinueChar: function isIdContinueChar (c) { - return typeof c === 'string' && ( - (c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || - (c >= '0' && c <= '9') || - (c === '$') || (c === '_') || - (c === '\u200C') || (c === '\u200D') || - unicode.ID_Continue.test(c) - ) - }, - - isDigit: function isDigit (c) { - return typeof c === 'string' && /[0-9]/.test(c) - }, - - isHexDigit: function isHexDigit (c) { - return typeof c === 'string' && /[0-9A-Fa-f]/.test(c) - }, - }; - - var source; - var parseState; - var stack; - var pos; - var line; - var column; - var token; - var key; - var root; - - var parse = function parse (text, reviver) { - source = String(text); - parseState = 'start'; - stack = []; - pos = 0; - line = 1; - column = 0; - token = undefined; - key = undefined; - root = undefined; - - do { - token = lex(); - - // This code is unreachable. - // if (!parseStates[parseState]) { - // throw invalidParseState() - // } - - parseStates[parseState](); - } while (token.type !== 'eof') - - if (typeof reviver === 'function') { - return internalize({'': root}, '', reviver) - } - - return root - }; - - function internalize (holder, name, reviver) { - var value = holder[name]; - if (value != null && typeof value === 'object') { - for (var key in value) { - var replacement = internalize(value, key, reviver); - if (replacement === undefined) { - delete value[key]; - } else { - value[key] = replacement; - } - } - } - - return reviver.call(holder, name, value) - } - - var lexState; - var buffer; - var doubleQuote; - var sign; - var c; - - function lex () { - lexState = 'default'; - buffer = ''; - doubleQuote = false; - sign = 1; - - for (;;) { - c = peek(); - - // This code is unreachable. - // if (!lexStates[lexState]) { - // throw invalidLexState(lexState) - // } - - var token = lexStates[lexState](); - if (token) { - return token - } - } - } - - function peek () { - if (source[pos]) { - return String.fromCodePoint(source.codePointAt(pos)) - } - } - - function read () { - var c = peek(); - - if (c === '\n') { - line++; - column = 0; - } else if (c) { - column += c.length; - } else { - column++; - } - - if (c) { - pos += c.length; - } - - return c - } - - var lexStates = { - default: function default$1 () { - switch (c) { - case '\t': - case '\v': - case '\f': - case ' ': - case '\u00A0': - case '\uFEFF': - case '\n': - case '\r': - case '\u2028': - case '\u2029': - read(); - return - - case '/': - read(); - lexState = 'comment'; - return - - case undefined: - read(); - return newToken('eof') - } - - if (util.isSpaceSeparator(c)) { - read(); - return - } - - // This code is unreachable. - // if (!lexStates[parseState]) { - // throw invalidLexState(parseState) - // } - - return lexStates[parseState]() - }, - - comment: function comment () { - switch (c) { - case '*': - read(); - lexState = 'multiLineComment'; - return - - case '/': - read(); - lexState = 'singleLineComment'; - return - } - - throw invalidChar(read()) - }, - - multiLineComment: function multiLineComment () { - switch (c) { - case '*': - read(); - lexState = 'multiLineCommentAsterisk'; - return - - case undefined: - throw invalidChar(read()) - } - - read(); - }, - - multiLineCommentAsterisk: function multiLineCommentAsterisk () { - switch (c) { - case '*': - read(); - return - - case '/': - read(); - lexState = 'default'; - return - - case undefined: - throw invalidChar(read()) - } - - read(); - lexState = 'multiLineComment'; - }, - - singleLineComment: function singleLineComment () { - switch (c) { - case '\n': - case '\r': - case '\u2028': - case '\u2029': - read(); - lexState = 'default'; - return - - case undefined: - read(); - return newToken('eof') - } - - read(); - }, - - value: function value () { - switch (c) { - case '{': - case '[': - return newToken('punctuator', read()) - - case 'n': - read(); - literal('ull'); - return newToken('null', null) - - case 't': - read(); - literal('rue'); - return newToken('boolean', true) - - case 'f': - read(); - literal('alse'); - return newToken('boolean', false) - - case '-': - case '+': - if (read() === '-') { - sign = -1; - } - - lexState = 'sign'; - return - - case '.': - buffer = read(); - lexState = 'decimalPointLeading'; - return - - case '0': - buffer = read(); - lexState = 'zero'; - return - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - buffer = read(); - lexState = 'decimalInteger'; - return - - case 'I': - read(); - literal('nfinity'); - return newToken('numeric', Infinity) - - case 'N': - read(); - literal('aN'); - return newToken('numeric', NaN) - - case '"': - case "'": - doubleQuote = (read() === '"'); - buffer = ''; - lexState = 'string'; - return - } - - throw invalidChar(read()) - }, - - identifierNameStartEscape: function identifierNameStartEscape () { - if (c !== 'u') { - throw invalidChar(read()) - } - - read(); - var u = unicodeEscape(); - switch (u) { - case '$': - case '_': - break - - default: - if (!util.isIdStartChar(u)) { - throw invalidIdentifier() - } - - break - } - - buffer += u; - lexState = 'identifierName'; - }, - - identifierName: function identifierName () { - switch (c) { - case '$': - case '_': - case '\u200C': - case '\u200D': - buffer += read(); - return - - case '\\': - read(); - lexState = 'identifierNameEscape'; - return - } - - if (util.isIdContinueChar(c)) { - buffer += read(); - return - } - - return newToken('identifier', buffer) - }, - - identifierNameEscape: function identifierNameEscape () { - if (c !== 'u') { - throw invalidChar(read()) - } - - read(); - var u = unicodeEscape(); - switch (u) { - case '$': - case '_': - case '\u200C': - case '\u200D': - break - - default: - if (!util.isIdContinueChar(u)) { - throw invalidIdentifier() - } - - break - } - - buffer += u; - lexState = 'identifierName'; - }, - - sign: function sign$1 () { - switch (c) { - case '.': - buffer = read(); - lexState = 'decimalPointLeading'; - return - - case '0': - buffer = read(); - lexState = 'zero'; - return - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - buffer = read(); - lexState = 'decimalInteger'; - return - - case 'I': - read(); - literal('nfinity'); - return newToken('numeric', sign * Infinity) - - case 'N': - read(); - literal('aN'); - return newToken('numeric', NaN) - } - - throw invalidChar(read()) - }, - - zero: function zero () { - switch (c) { - case '.': - buffer += read(); - lexState = 'decimalPoint'; - return - - case 'e': - case 'E': - buffer += read(); - lexState = 'decimalExponent'; - return - - case 'x': - case 'X': - buffer += read(); - lexState = 'hexadecimal'; - return - } - - return newToken('numeric', sign * 0) - }, - - decimalInteger: function decimalInteger () { - switch (c) { - case '.': - buffer += read(); - lexState = 'decimalPoint'; - return - - case 'e': - case 'E': - buffer += read(); - lexState = 'decimalExponent'; - return - } - - if (util.isDigit(c)) { - buffer += read(); - return - } - - return newToken('numeric', sign * Number(buffer)) - }, - - decimalPointLeading: function decimalPointLeading () { - if (util.isDigit(c)) { - buffer += read(); - lexState = 'decimalFraction'; - return - } - - throw invalidChar(read()) - }, - - decimalPoint: function decimalPoint () { - switch (c) { - case 'e': - case 'E': - buffer += read(); - lexState = 'decimalExponent'; - return - } - - if (util.isDigit(c)) { - buffer += read(); - lexState = 'decimalFraction'; - return - } - - return newToken('numeric', sign * Number(buffer)) - }, - - decimalFraction: function decimalFraction () { - switch (c) { - case 'e': - case 'E': - buffer += read(); - lexState = 'decimalExponent'; - return - } - - if (util.isDigit(c)) { - buffer += read(); - return - } - - return newToken('numeric', sign * Number(buffer)) - }, - - decimalExponent: function decimalExponent () { - switch (c) { - case '+': - case '-': - buffer += read(); - lexState = 'decimalExponentSign'; - return - } - - if (util.isDigit(c)) { - buffer += read(); - lexState = 'decimalExponentInteger'; - return - } - - throw invalidChar(read()) - }, - - decimalExponentSign: function decimalExponentSign () { - if (util.isDigit(c)) { - buffer += read(); - lexState = 'decimalExponentInteger'; - return - } - - throw invalidChar(read()) - }, - - decimalExponentInteger: function decimalExponentInteger () { - if (util.isDigit(c)) { - buffer += read(); - return - } - - return newToken('numeric', sign * Number(buffer)) - }, - - hexadecimal: function hexadecimal () { - if (util.isHexDigit(c)) { - buffer += read(); - lexState = 'hexadecimalInteger'; - return - } - - throw invalidChar(read()) - }, - - hexadecimalInteger: function hexadecimalInteger () { - if (util.isHexDigit(c)) { - buffer += read(); - return - } - - return newToken('numeric', sign * Number(buffer)) - }, - - string: function string () { - switch (c) { - case '\\': - read(); - buffer += escape(); - return - - case '"': - if (doubleQuote) { - read(); - return newToken('string', buffer) - } - - buffer += read(); - return - - case "'": - if (!doubleQuote) { - read(); - return newToken('string', buffer) - } - - buffer += read(); - return - - case '\n': - case '\r': - throw invalidChar(read()) - - case '\u2028': - case '\u2029': - separatorChar(c); - break - - case undefined: - throw invalidChar(read()) - } - - buffer += read(); - }, - - start: function start () { - switch (c) { - case '{': - case '[': - return newToken('punctuator', read()) - - // This code is unreachable since the default lexState handles eof. - // case undefined: - // return newToken('eof') - } - - lexState = 'value'; - }, - - beforePropertyName: function beforePropertyName () { - switch (c) { - case '$': - case '_': - buffer = read(); - lexState = 'identifierName'; - return - - case '\\': - read(); - lexState = 'identifierNameStartEscape'; - return - - case '}': - return newToken('punctuator', read()) - - case '"': - case "'": - doubleQuote = (read() === '"'); - lexState = 'string'; - return - } - - if (util.isIdStartChar(c)) { - buffer += read(); - lexState = 'identifierName'; - return - } - - throw invalidChar(read()) - }, - - afterPropertyName: function afterPropertyName () { - if (c === ':') { - return newToken('punctuator', read()) - } - - throw invalidChar(read()) - }, - - beforePropertyValue: function beforePropertyValue () { - lexState = 'value'; - }, - - afterPropertyValue: function afterPropertyValue () { - switch (c) { - case ',': - case '}': - return newToken('punctuator', read()) - } - - throw invalidChar(read()) - }, - - beforeArrayValue: function beforeArrayValue () { - if (c === ']') { - return newToken('punctuator', read()) - } - - lexState = 'value'; - }, - - afterArrayValue: function afterArrayValue () { - switch (c) { - case ',': - case ']': - return newToken('punctuator', read()) - } - - throw invalidChar(read()) - }, - - end: function end () { - // This code is unreachable since it's handled by the default lexState. - // if (c === undefined) { - // read() - // return newToken('eof') - // } - - throw invalidChar(read()) - }, - }; - - function newToken (type, value) { - return { - type: type, - value: value, - line: line, - column: column, - } - } - - function literal (s) { - for (var i = 0, list = s; i < list.length; i += 1) { - var c = list[i]; - - var p = peek(); - - if (p !== c) { - throw invalidChar(read()) - } - - read(); - } - } - - function escape () { - var c = peek(); - switch (c) { - case 'b': - read(); - return '\b' - - case 'f': - read(); - return '\f' - - case 'n': - read(); - return '\n' - - case 'r': - read(); - return '\r' - - case 't': - read(); - return '\t' - - case 'v': - read(); - return '\v' - - case '0': - read(); - if (util.isDigit(peek())) { - throw invalidChar(read()) - } - - return '\0' - - case 'x': - read(); - return hexEscape() - - case 'u': - read(); - return unicodeEscape() - - case '\n': - case '\u2028': - case '\u2029': - read(); - return '' - - case '\r': - read(); - if (peek() === '\n') { - read(); - } - - return '' - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - throw invalidChar(read()) - - case undefined: - throw invalidChar(read()) - } - - return read() - } - - function hexEscape () { - var buffer = ''; - var c = peek(); - - if (!util.isHexDigit(c)) { - throw invalidChar(read()) - } - - buffer += read(); - - c = peek(); - if (!util.isHexDigit(c)) { - throw invalidChar(read()) - } - - buffer += read(); - - return String.fromCodePoint(parseInt(buffer, 16)) - } - - function unicodeEscape () { - var buffer = ''; - var count = 4; - - while (count-- > 0) { - var c = peek(); - if (!util.isHexDigit(c)) { - throw invalidChar(read()) - } - - buffer += read(); - } - - return String.fromCodePoint(parseInt(buffer, 16)) - } - - var parseStates = { - start: function start () { - if (token.type === 'eof') { - throw invalidEOF() - } - - push(); - }, - - beforePropertyName: function beforePropertyName () { - switch (token.type) { - case 'identifier': - case 'string': - key = token.value; - parseState = 'afterPropertyName'; - return - - case 'punctuator': - // This code is unreachable since it's handled by the lexState. - // if (token.value !== '}') { - // throw invalidToken() - // } - - pop(); - return - - case 'eof': - throw invalidEOF() - } - - // This code is unreachable since it's handled by the lexState. - // throw invalidToken() - }, - - afterPropertyName: function afterPropertyName () { - // This code is unreachable since it's handled by the lexState. - // if (token.type !== 'punctuator' || token.value !== ':') { - // throw invalidToken() - // } - - if (token.type === 'eof') { - throw invalidEOF() - } - - parseState = 'beforePropertyValue'; - }, - - beforePropertyValue: function beforePropertyValue () { - if (token.type === 'eof') { - throw invalidEOF() - } - - push(); - }, - - beforeArrayValue: function beforeArrayValue () { - if (token.type === 'eof') { - throw invalidEOF() - } - - if (token.type === 'punctuator' && token.value === ']') { - pop(); - return - } - - push(); - }, - - afterPropertyValue: function afterPropertyValue () { - // This code is unreachable since it's handled by the lexState. - // if (token.type !== 'punctuator') { - // throw invalidToken() - // } - - if (token.type === 'eof') { - throw invalidEOF() - } - - switch (token.value) { - case ',': - parseState = 'beforePropertyName'; - return - - case '}': - pop(); - } - - // This code is unreachable since it's handled by the lexState. - // throw invalidToken() - }, - - afterArrayValue: function afterArrayValue () { - // This code is unreachable since it's handled by the lexState. - // if (token.type !== 'punctuator') { - // throw invalidToken() - // } - - if (token.type === 'eof') { - throw invalidEOF() - } - - switch (token.value) { - case ',': - parseState = 'beforeArrayValue'; - return - - case ']': - pop(); - } - - // This code is unreachable since it's handled by the lexState. - // throw invalidToken() - }, - - end: function end () { - // This code is unreachable since it's handled by the lexState. - // if (token.type !== 'eof') { - // throw invalidToken() - // } - }, - }; - - function push () { - var value; - - switch (token.type) { - case 'punctuator': - switch (token.value) { - case '{': - value = {}; - break - - case '[': - value = []; - break - } - - break - - case 'null': - case 'boolean': - case 'numeric': - case 'string': - value = token.value; - break - - // This code is unreachable. - // default: - // throw invalidToken() - } - - if (root === undefined) { - root = value; - } else { - var parent = stack[stack.length - 1]; - if (Array.isArray(parent)) { - parent.push(value); - } else { - parent[key] = value; - } - } - - if (value !== null && typeof value === 'object') { - stack.push(value); - - if (Array.isArray(value)) { - parseState = 'beforeArrayValue'; - } else { - parseState = 'beforePropertyName'; - } - } else { - var current = stack[stack.length - 1]; - if (current == null) { - parseState = 'end'; - } else if (Array.isArray(current)) { - parseState = 'afterArrayValue'; - } else { - parseState = 'afterPropertyValue'; - } - } - } - - function pop () { - stack.pop(); - - var current = stack[stack.length - 1]; - if (current == null) { - parseState = 'end'; - } else if (Array.isArray(current)) { - parseState = 'afterArrayValue'; - } else { - parseState = 'afterPropertyValue'; - } - } - - // This code is unreachable. - // function invalidParseState () { - // return new Error(`JSON5: invalid parse state '${parseState}'`) - // } - - // This code is unreachable. - // function invalidLexState (state) { - // return new Error(`JSON5: invalid lex state '${state}'`) - // } - - function invalidChar (c) { - if (c === undefined) { - return syntaxError(("JSON5: invalid end of input at " + line + ":" + column)) - } - - return syntaxError(("JSON5: invalid character '" + (formatChar(c)) + "' at " + line + ":" + column)) - } - - function invalidEOF () { - return syntaxError(("JSON5: invalid end of input at " + line + ":" + column)) - } - - // This code is unreachable. - // function invalidToken () { - // if (token.type === 'eof') { - // return syntaxError(`JSON5: invalid end of input at ${line}:${column}`) - // } - - // const c = String.fromCodePoint(token.value.codePointAt(0)) - // return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`) - // } - - function invalidIdentifier () { - column -= 5; - return syntaxError(("JSON5: invalid identifier character at " + line + ":" + column)) - } - - function separatorChar (c) { - console.warn(("JSON5: '" + (formatChar(c)) + "' in strings is not valid ECMAScript; consider escaping")); - } - - function formatChar (c) { - var replacements = { - "'": "\\'", - '"': '\\"', - '\\': '\\\\', - '\b': '\\b', - '\f': '\\f', - '\n': '\\n', - '\r': '\\r', - '\t': '\\t', - '\v': '\\v', - '\0': '\\0', - '\u2028': '\\u2028', - '\u2029': '\\u2029', - }; - - if (replacements[c]) { - return replacements[c] - } - - if (c < ' ') { - var hexString = c.charCodeAt(0).toString(16); - return '\\x' + ('00' + hexString).substring(hexString.length) - } - - return c - } - - function syntaxError (message) { - var err = new SyntaxError(message); - err.lineNumber = line; - err.columnNumber = column; - return err - } - - var stringify = function stringify (value, replacer, space) { - var stack = []; - var indent = ''; - var propertyList; - var replacerFunc; - var gap = ''; - var quote; - - if ( - replacer != null && - typeof replacer === 'object' && - !Array.isArray(replacer) - ) { - space = replacer.space; - quote = replacer.quote; - replacer = replacer.replacer; - } - - if (typeof replacer === 'function') { - replacerFunc = replacer; - } else if (Array.isArray(replacer)) { - propertyList = []; - for (var i = 0, list = replacer; i < list.length; i += 1) { - var v = list[i]; - - var item = (void 0); - - if (typeof v === 'string') { - item = v; - } else if ( - typeof v === 'number' || - v instanceof String || - v instanceof Number - ) { - item = String(v); - } - - if (item !== undefined && propertyList.indexOf(item) < 0) { - propertyList.push(item); - } - } - } - - if (space instanceof Number) { - space = Number(space); - } else if (space instanceof String) { - space = String(space); - } - - if (typeof space === 'number') { - if (space > 0) { - space = Math.min(10, Math.floor(space)); - gap = ' '.substr(0, space); - } - } else if (typeof space === 'string') { - gap = space.substr(0, 10); - } - - return serializeProperty('', {'': value}) - - function serializeProperty (key, holder) { - var value = holder[key]; - if (value != null) { - if (typeof value.toJSON5 === 'function') { - value = value.toJSON5(key); - } else if (typeof value.toJSON === 'function') { - value = value.toJSON(key); - } - } - - if (replacerFunc) { - value = replacerFunc.call(holder, key, value); - } - - if (value instanceof Number) { - value = Number(value); - } else if (value instanceof String) { - value = String(value); - } else if (value instanceof Boolean) { - value = value.valueOf(); - } - - switch (value) { - case null: return 'null' - case true: return 'true' - case false: return 'false' - } - - if (typeof value === 'string') { - return quoteString(value, false) - } - - if (typeof value === 'number') { - return String(value) - } - - if (typeof value === 'object') { - return Array.isArray(value) ? serializeArray(value) : serializeObject(value) - } - - return undefined - } - - function quoteString (value) { - var quotes = { - "'": 0.1, - '"': 0.2, - }; - - var replacements = { - "'": "\\'", - '"': '\\"', - '\\': '\\\\', - '\b': '\\b', - '\f': '\\f', - '\n': '\\n', - '\r': '\\r', - '\t': '\\t', - '\v': '\\v', - '\0': '\\0', - '\u2028': '\\u2028', - '\u2029': '\\u2029', - }; - - var product = ''; - - for (var i = 0; i < value.length; i++) { - var c = value[i]; - switch (c) { - case "'": - case '"': - quotes[c]++; - product += c; - continue - - case '\0': - if (util.isDigit(value[i + 1])) { - product += '\\x00'; - continue - } - } - - if (replacements[c]) { - product += replacements[c]; - continue - } - - if (c < ' ') { - var hexString = c.charCodeAt(0).toString(16); - product += '\\x' + ('00' + hexString).substring(hexString.length); - continue - } - - product += c; - } - - var quoteChar = quote || Object.keys(quotes).reduce(function (a, b) { return (quotes[a] < quotes[b]) ? a : b; }); - - product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]); - - return quoteChar + product + quoteChar - } - - function serializeObject (value) { - if (stack.indexOf(value) >= 0) { - throw TypeError('Converting circular structure to JSON5') - } - - stack.push(value); - - var stepback = indent; - indent = indent + gap; - - var keys = propertyList || Object.keys(value); - var partial = []; - for (var i = 0, list = keys; i < list.length; i += 1) { - var key = list[i]; - - var propertyString = serializeProperty(key, value); - if (propertyString !== undefined) { - var member = serializeKey(key) + ':'; - if (gap !== '') { - member += ' '; - } - member += propertyString; - partial.push(member); - } - } - - var final; - if (partial.length === 0) { - final = '{}'; - } else { - var properties; - if (gap === '') { - properties = partial.join(','); - final = '{' + properties + '}'; - } else { - var separator = ',\n' + indent; - properties = partial.join(separator); - final = '{\n' + indent + properties + ',\n' + stepback + '}'; - } - } - - stack.pop(); - indent = stepback; - return final - } - - function serializeKey (key) { - if (key.length === 0) { - return quoteString(key, true) - } - - var firstChar = String.fromCodePoint(key.codePointAt(0)); - if (!util.isIdStartChar(firstChar)) { - return quoteString(key, true) - } - - for (var i = firstChar.length; i < key.length; i++) { - if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) { - return quoteString(key, true) - } - } - - return key - } - - function serializeArray (value) { - if (stack.indexOf(value) >= 0) { - throw TypeError('Converting circular structure to JSON5') - } - - stack.push(value); - - var stepback = indent; - indent = indent + gap; - - var partial = []; - for (var i = 0; i < value.length; i++) { - var propertyString = serializeProperty(String(i), value); - partial.push((propertyString !== undefined) ? propertyString : 'null'); - } - - var final; - if (partial.length === 0) { - final = '[]'; - } else { - if (gap === '') { - var properties = partial.join(','); - final = '[' + properties + ']'; - } else { - var separator = ',\n' + indent; - var properties$1 = partial.join(separator); - final = '[\n' + indent + properties$1 + ',\n' + stepback + ']'; - } - } - - stack.pop(); - indent = stepback; - return final - } - }; - - var JSON5 = { - parse: parse, - stringify: stringify, - }; - - var lib = JSON5; - - var es5 = lib; - - return es5; - -}))); diff --git a/node_modules/loader-utils/node_modules/json5/dist/index.min.js b/node_modules/loader-utils/node_modules/json5/dist/index.min.js deleted file mode 100644 index da63a9da3..000000000 --- a/node_modules/loader-utils/node_modules/json5/dist/index.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(u,D){"object"==typeof exports&&"undefined"!=typeof module?module.exports=D():"function"==typeof define&&define.amd?define(D):u.JSON5=D()}(this,function(){"use strict";function u(u,D){return u(D={exports:{}},D.exports),D.exports}var D=u(function(u){var D=u.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=D)}),e=u(function(u){var D=u.exports={version:"2.6.5"};"number"==typeof __e&&(__e=D)}),t=(e.version,function(u){return"object"==typeof u?null!==u:"function"==typeof u}),r=function(u){if(!t(u))throw TypeError(u+" is not an object!");return u},F=function(u){try{return!!u()}catch(u){return!0}},n=!F(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),C=D.document,A=t(C)&&t(C.createElement),i=!n&&!F(function(){return 7!=Object.defineProperty((u="div",A?C.createElement(u):{}),"a",{get:function(){return 7}}).a;var u}),E=Object.defineProperty,o={f:n?Object.defineProperty:function(u,D,e){if(r(u),D=function(u,D){if(!t(u))return u;var e,r;if(D&&"function"==typeof(e=u.toString)&&!t(r=e.call(u)))return r;if("function"==typeof(e=u.valueOf)&&!t(r=e.call(u)))return r;if(!D&&"function"==typeof(e=u.toString)&&!t(r=e.call(u)))return r;throw TypeError("Can't convert object to primitive value")}(D,!0),r(e),i)try{return E(u,D,e)}catch(u){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(u[D]=e.value),u}},a=n?function(u,D,e){return o.f(u,D,function(u,D){return{enumerable:!(1&u),configurable:!(2&u),writable:!(4&u),value:D}}(1,e))}:function(u,D,e){return u[D]=e,u},c={}.hasOwnProperty,B=function(u,D){return c.call(u,D)},s=0,f=Math.random(),l=u(function(u){var t=D["__core-js_shared__"]||(D["__core-js_shared__"]={});(u.exports=function(u,D){return t[u]||(t[u]=void 0!==D?D:{})})("versions",[]).push({version:e.version,mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})})("native-function-to-string",Function.toString),d=u(function(u){var t,r="Symbol(".concat(void 0===(t="src")?"":t,")_",(++s+f).toString(36)),F=(""+l).split("toString");e.inspectSource=function(u){return l.call(u)},(u.exports=function(u,e,t,n){var C="function"==typeof t;C&&(B(t,"name")||a(t,"name",e)),u[e]!==t&&(C&&(B(t,r)||a(t,r,u[e]?""+u[e]:F.join(String(e)))),u===D?u[e]=t:n?u[e]?u[e]=t:a(u,e,t):(delete u[e],a(u,e,t)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[r]||l.call(this)})}),v=function(u,D,e){if(function(u){if("function"!=typeof u)throw TypeError(u+" is not a function!")}(u),void 0===D)return u;switch(e){case 1:return function(e){return u.call(D,e)};case 2:return function(e,t){return u.call(D,e,t)};case 3:return function(e,t,r){return u.call(D,e,t,r)}}return function(){return u.apply(D,arguments)}},p=function(u,t,r){var F,n,C,A,i=u&p.F,E=u&p.G,o=u&p.S,c=u&p.P,B=u&p.B,s=E?D:o?D[t]||(D[t]={}):(D[t]||{}).prototype,f=E?e:e[t]||(e[t]={}),l=f.prototype||(f.prototype={});for(F in E&&(r=t),r)C=((n=!i&&s&&void 0!==s[F])?s:r)[F],A=B&&n?v(C,D):c&&"function"==typeof C?v(Function.call,C):C,s&&d(s,F,C,u&p.U),f[F]!=C&&a(f,F,A),c&&l[F]!=C&&(l[F]=C)};D.core=e,p.F=1,p.G=2,p.S=4,p.P=8,p.B=16,p.W=32,p.U=64,p.R=128;var h,m=p,g=Math.ceil,y=Math.floor,w=function(u){return isNaN(u=+u)?0:(u>0?y:g)(u)},S=(h=!1,function(u,D){var e,t,r=String(function(u){if(null==u)throw TypeError("Can't call method on "+u);return u}(u)),F=w(D),n=r.length;return F<0||F>=n?h?"":void 0:(e=r.charCodeAt(F))<55296||e>56319||F+1===n||(t=r.charCodeAt(F+1))<56320||t>57343?h?r.charAt(F):e:h?r.slice(F,F+2):t-56320+(e-55296<<10)+65536});m(m.P,"String",{codePointAt:function(u){return S(this,u)}});e.String.codePointAt;var b=Math.max,x=Math.min,N=String.fromCharCode,P=String.fromCodePoint;m(m.S+m.F*(!!P&&1!=P.length),"String",{fromCodePoint:function(u){for(var D,e,t,r=arguments,F=[],n=arguments.length,C=0;n>C;){if(D=+r[C++],t=1114111,((e=w(e=D))<0?b(e+t,0):x(e,t))!==D)throw RangeError(D+" is not a valid code point");F.push(D<65536?N(D):N(55296+((D-=65536)>>10),D%1024+56320))}return F.join("")}});e.String.fromCodePoint;var _,I,O,j,V,J,M,k,L,T,z,H,$,R,G={Space_Separator:/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,ID_Start:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\u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E7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\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E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B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C\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\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DD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50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\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},U={isSpaceSeparator:function(u){return"string"==typeof u&&G.Space_Separator.test(u)},isIdStartChar:function(u){return"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||"$"===u||"_"===u||G.ID_Start.test(u))},isIdContinueChar:function(u){return"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||u>="0"&&u<="9"||"$"===u||"_"===u||"‌"===u||"‍"===u||G.ID_Continue.test(u))},isDigit:function(u){return"string"==typeof u&&/[0-9]/.test(u)},isHexDigit:function(u){return"string"==typeof u&&/[0-9A-Fa-f]/.test(u)}};function Z(){for(T="default",z="",H=!1,$=1;;){R=q();var u=X[T]();if(u)return u}}function q(){if(_[j])return String.fromCodePoint(_.codePointAt(j))}function W(){var u=q();return"\n"===u?(V++,J=0):u?J+=u.length:J++,u&&(j+=u.length),u}var X={default:function(){switch(R){case"\t":case"\v":case"\f":case" ":case" ":case"\ufeff":case"\n":case"\r":case"\u2028":case"\u2029":return void W();case"/":return W(),void(T="comment");case void 0:return W(),K("eof")}if(!U.isSpaceSeparator(R))return X[I]();W()},comment:function(){switch(R){case"*":return W(),void(T="multiLineComment");case"/":return W(),void(T="singleLineComment")}throw tu(W())},multiLineComment:function(){switch(R){case"*":return W(),void(T="multiLineCommentAsterisk");case void 0:throw tu(W())}W()},multiLineCommentAsterisk:function(){switch(R){case"*":return void W();case"/":return W(),void(T="default");case void 0:throw tu(W())}W(),T="multiLineComment"},singleLineComment:function(){switch(R){case"\n":case"\r":case"\u2028":case"\u2029":return W(),void(T="default");case void 0:return W(),K("eof")}W()},value:function(){switch(R){case"{":case"[":return K("punctuator",W());case"n":return W(),Q("ull"),K("null",null);case"t":return W(),Q("rue"),K("boolean",!0);case"f":return W(),Q("alse"),K("boolean",!1);case"-":case"+":return"-"===W()&&($=-1),void(T="sign");case".":return z=W(),void(T="decimalPointLeading");case"0":return z=W(),void(T="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return z=W(),void(T="decimalInteger");case"I":return W(),Q("nfinity"),K("numeric",1/0);case"N":return W(),Q("aN"),K("numeric",NaN);case'"':case"'":return H='"'===W(),z="",void(T="string")}throw tu(W())},identifierNameStartEscape:function(){if("u"!==R)throw tu(W());W();var u=Y();switch(u){case"$":case"_":break;default:if(!U.isIdStartChar(u))throw Fu()}z+=u,T="identifierName"},identifierName:function(){switch(R){case"$":case"_":case"‌":case"‍":return void(z+=W());case"\\":return W(),void(T="identifierNameEscape")}if(!U.isIdContinueChar(R))return K("identifier",z);z+=W()},identifierNameEscape:function(){if("u"!==R)throw tu(W());W();var u=Y();switch(u){case"$":case"_":case"‌":case"‍":break;default:if(!U.isIdContinueChar(u))throw Fu()}z+=u,T="identifierName"},sign:function(){switch(R){case".":return z=W(),void(T="decimalPointLeading");case"0":return z=W(),void(T="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return z=W(),void(T="decimalInteger");case"I":return W(),Q("nfinity"),K("numeric",$*(1/0));case"N":return W(),Q("aN"),K("numeric",NaN)}throw tu(W())},zero:function(){switch(R){case".":return z+=W(),void(T="decimalPoint");case"e":case"E":return z+=W(),void(T="decimalExponent");case"x":case"X":return z+=W(),void(T="hexadecimal")}return K("numeric",0*$)},decimalInteger:function(){switch(R){case".":return z+=W(),void(T="decimalPoint");case"e":case"E":return z+=W(),void(T="decimalExponent")}if(!U.isDigit(R))return K("numeric",$*Number(z));z+=W()},decimalPointLeading:function(){if(U.isDigit(R))return z+=W(),void(T="decimalFraction");throw tu(W())},decimalPoint:function(){switch(R){case"e":case"E":return z+=W(),void(T="decimalExponent")}return U.isDigit(R)?(z+=W(),void(T="decimalFraction")):K("numeric",$*Number(z))},decimalFraction:function(){switch(R){case"e":case"E":return z+=W(),void(T="decimalExponent")}if(!U.isDigit(R))return K("numeric",$*Number(z));z+=W()},decimalExponent:function(){switch(R){case"+":case"-":return z+=W(),void(T="decimalExponentSign")}if(U.isDigit(R))return z+=W(),void(T="decimalExponentInteger");throw tu(W())},decimalExponentSign:function(){if(U.isDigit(R))return z+=W(),void(T="decimalExponentInteger");throw tu(W())},decimalExponentInteger:function(){if(!U.isDigit(R))return K("numeric",$*Number(z));z+=W()},hexadecimal:function(){if(U.isHexDigit(R))return z+=W(),void(T="hexadecimalInteger");throw tu(W())},hexadecimalInteger:function(){if(!U.isHexDigit(R))return K("numeric",$*Number(z));z+=W()},string:function(){switch(R){case"\\":return W(),void(z+=function(){switch(q()){case"b":return W(),"\b";case"f":return W(),"\f";case"n":return W(),"\n";case"r":return W(),"\r";case"t":return W(),"\t";case"v":return W(),"\v";case"0":if(W(),U.isDigit(q()))throw tu(W());return"\0";case"x":return W(),function(){var u="",D=q();if(!U.isHexDigit(D))throw tu(W());if(u+=W(),D=q(),!U.isHexDigit(D))throw tu(W());return u+=W(),String.fromCodePoint(parseInt(u,16))}();case"u":return W(),Y();case"\n":case"\u2028":case"\u2029":return W(),"";case"\r":return W(),"\n"===q()&&W(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case void 0:throw tu(W())}return W()}());case'"':return H?(W(),K("string",z)):void(z+=W());case"'":return H?void(z+=W()):(W(),K("string",z));case"\n":case"\r":throw tu(W());case"\u2028":case"\u2029":!function(u){console.warn("JSON5: '"+nu(u)+"' in strings is not valid ECMAScript; consider escaping")}(R);break;case void 0:throw tu(W())}z+=W()},start:function(){switch(R){case"{":case"[":return K("punctuator",W())}T="value"},beforePropertyName:function(){switch(R){case"$":case"_":return z=W(),void(T="identifierName");case"\\":return W(),void(T="identifierNameStartEscape");case"}":return K("punctuator",W());case'"':case"'":return H='"'===W(),void(T="string")}if(U.isIdStartChar(R))return z+=W(),void(T="identifierName");throw tu(W())},afterPropertyName:function(){if(":"===R)return K("punctuator",W());throw tu(W())},beforePropertyValue:function(){T="value"},afterPropertyValue:function(){switch(R){case",":case"}":return K("punctuator",W())}throw tu(W())},beforeArrayValue:function(){if("]"===R)return K("punctuator",W());T="value"},afterArrayValue:function(){switch(R){case",":case"]":return K("punctuator",W())}throw tu(W())},end:function(){throw tu(W())}};function K(u,D){return{type:u,value:D,line:V,column:J}}function Q(u){for(var D=0,e=u;D0;){var e=q();if(!U.isHexDigit(e))throw tu(W());u+=W()}return String.fromCodePoint(parseInt(u,16))}var uu={start:function(){if("eof"===M.type)throw ru();Du()},beforePropertyName:function(){switch(M.type){case"identifier":case"string":return k=M.value,void(I="afterPropertyName");case"punctuator":return void eu();case"eof":throw ru()}},afterPropertyName:function(){if("eof"===M.type)throw ru();I="beforePropertyValue"},beforePropertyValue:function(){if("eof"===M.type)throw ru();Du()},beforeArrayValue:function(){if("eof"===M.type)throw ru();"punctuator"!==M.type||"]"!==M.value?Du():eu()},afterPropertyValue:function(){if("eof"===M.type)throw ru();switch(M.value){case",":return void(I="beforePropertyName");case"}":eu()}},afterArrayValue:function(){if("eof"===M.type)throw ru();switch(M.value){case",":return void(I="beforeArrayValue");case"]":eu()}},end:function(){}};function Du(){var u;switch(M.type){case"punctuator":switch(M.value){case"{":u={};break;case"[":u=[]}break;case"null":case"boolean":case"numeric":case"string":u=M.value}if(void 0===L)L=u;else{var D=O[O.length-1];Array.isArray(D)?D.push(u):D[k]=u}if(null!==u&&"object"==typeof u)O.push(u),I=Array.isArray(u)?"beforeArrayValue":"beforePropertyName";else{var e=O[O.length-1];I=null==e?"end":Array.isArray(e)?"afterArrayValue":"afterPropertyValue"}}function eu(){O.pop();var u=O[O.length-1];I=null==u?"end":Array.isArray(u)?"afterArrayValue":"afterPropertyValue"}function tu(u){return Cu(void 0===u?"JSON5: invalid end of input at "+V+":"+J:"JSON5: invalid character '"+nu(u)+"' at "+V+":"+J)}function ru(){return Cu("JSON5: invalid end of input at "+V+":"+J)}function Fu(){return Cu("JSON5: invalid identifier character at "+V+":"+(J-=5))}function nu(u){var D={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(D[u])return D[u];if(u<" "){var e=u.charCodeAt(0).toString(16);return"\\x"+("00"+e).substring(e.length)}return u}function Cu(u){var D=new SyntaxError(u);return D.lineNumber=V,D.columnNumber=J,D}return{parse:function(u,D){_=String(u),I="start",O=[],j=0,V=1,J=0,M=void 0,k=void 0,L=void 0;do{M=Z(),uu[I]()}while("eof"!==M.type);return"function"==typeof D?function u(D,e,t){var r=D[e];if(null!=r&&"object"==typeof r)for(var F in r){var n=u(r,F,t);void 0===n?delete r[F]:r[F]=n}return t.call(D,e,r)}({"":L},"",D):L},stringify:function(u,D,e){var t,r,F,n=[],C="",A="";if(null==D||"object"!=typeof D||Array.isArray(D)||(e=D.space,F=D.quote,D=D.replacer),"function"==typeof D)r=D;else if(Array.isArray(D)){t=[];for(var i=0,E=D;i0&&(e=Math.min(10,Math.floor(e)),A=" ".substr(0,e)):"string"==typeof e&&(A=e.substr(0,10)),c("",{"":u});function c(u,D){var e=D[u];switch(null!=e&&("function"==typeof e.toJSON5?e=e.toJSON5(u):"function"==typeof e.toJSON&&(e=e.toJSON(u))),r&&(e=r.call(D,u,e)),e instanceof Number?e=Number(e):e instanceof String?e=String(e):e instanceof Boolean&&(e=e.valueOf()),e){case null:return"null";case!0:return"true";case!1:return"false"}return"string"==typeof e?B(e):"number"==typeof e?String(e):"object"==typeof e?Array.isArray(e)?function(u){if(n.indexOf(u)>=0)throw TypeError("Converting circular structure to JSON5");n.push(u);var D=C;C+=A;for(var e,t=[],r=0;r=0)throw TypeError("Converting circular structure to JSON5");n.push(u);var D=C;C+=A;for(var e,r,F=t||Object.keys(u),i=[],E=0,o=F;E"string"==typeof u&&unicode.Space_Separator.test(u),isIdStartChar:u=>"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||"$"===u||"_"===u||unicode.ID_Start.test(u)),isIdContinueChar:u=>"string"==typeof u&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||u>="0"&&u<="9"||"$"===u||"_"===u||"‌"===u||"‍"===u||unicode.ID_Continue.test(u)),isDigit:u=>"string"==typeof u&&/[0-9]/.test(u),isHexDigit:u=>"string"==typeof u&&/[0-9A-Fa-f]/.test(u)};let source,parseState,stack,pos,line,column,token,key,root;var parse=function(u,D){source=String(u),parseState="start",stack=[],pos=0,line=1,column=0,token=void 0,key=void 0,root=void 0;do{token=lex(),parseStates[parseState]()}while("eof"!==token.type);return"function"==typeof D?internalize({"":root},"",D):root};function internalize(u,D,e){const r=u[D];if(null!=r&&"object"==typeof r)for(const u in r){const D=internalize(r,u,e);void 0===D?delete r[u]:r[u]=D}return e.call(u,D,r)}let lexState,buffer,doubleQuote,sign,c;function lex(){for(lexState="default",buffer="",doubleQuote=!1,sign=1;;){c=peek();const u=lexStates[lexState]();if(u)return u}}function peek(){if(source[pos])return String.fromCodePoint(source.codePointAt(pos))}function read(){const u=peek();return"\n"===u?(line++,column=0):u?column+=u.length:column++,u&&(pos+=u.length),u}const lexStates={default(){switch(c){case"\t":case"\v":case"\f":case" ":case" ":case"\ufeff":case"\n":case"\r":case"\u2028":case"\u2029":return void read();case"/":return read(),void(lexState="comment");case void 0:return read(),newToken("eof")}if(!util.isSpaceSeparator(c))return lexStates[parseState]();read()},comment(){switch(c){case"*":return read(),void(lexState="multiLineComment");case"/":return read(),void(lexState="singleLineComment")}throw invalidChar(read())},multiLineComment(){switch(c){case"*":return read(),void(lexState="multiLineCommentAsterisk");case void 0:throw invalidChar(read())}read()},multiLineCommentAsterisk(){switch(c){case"*":return void read();case"/":return read(),void(lexState="default");case void 0:throw invalidChar(read())}read(),lexState="multiLineComment"},singleLineComment(){switch(c){case"\n":case"\r":case"\u2028":case"\u2029":return read(),void(lexState="default");case void 0:return read(),newToken("eof")}read()},value(){switch(c){case"{":case"[":return newToken("punctuator",read());case"n":return read(),literal("ull"),newToken("null",null);case"t":return read(),literal("rue"),newToken("boolean",!0);case"f":return read(),literal("alse"),newToken("boolean",!1);case"-":case"+":return"-"===read()&&(sign=-1),void(lexState="sign");case".":return buffer=read(),void(lexState="decimalPointLeading");case"0":return buffer=read(),void(lexState="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return buffer=read(),void(lexState="decimalInteger");case"I":return read(),literal("nfinity"),newToken("numeric",1/0);case"N":return read(),literal("aN"),newToken("numeric",NaN);case'"':case"'":return doubleQuote='"'===read(),buffer="",void(lexState="string")}throw invalidChar(read())},identifierNameStartEscape(){if("u"!==c)throw invalidChar(read());read();const u=unicodeEscape();switch(u){case"$":case"_":break;default:if(!util.isIdStartChar(u))throw invalidIdentifier()}buffer+=u,lexState="identifierName"},identifierName(){switch(c){case"$":case"_":case"‌":case"‍":return void(buffer+=read());case"\\":return read(),void(lexState="identifierNameEscape")}if(!util.isIdContinueChar(c))return newToken("identifier",buffer);buffer+=read()},identifierNameEscape(){if("u"!==c)throw invalidChar(read());read();const u=unicodeEscape();switch(u){case"$":case"_":case"‌":case"‍":break;default:if(!util.isIdContinueChar(u))throw invalidIdentifier()}buffer+=u,lexState="identifierName"},sign(){switch(c){case".":return buffer=read(),void(lexState="decimalPointLeading");case"0":return buffer=read(),void(lexState="zero");case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return buffer=read(),void(lexState="decimalInteger");case"I":return read(),literal("nfinity"),newToken("numeric",sign*(1/0));case"N":return read(),literal("aN"),newToken("numeric",NaN)}throw invalidChar(read())},zero(){switch(c){case".":return buffer+=read(),void(lexState="decimalPoint");case"e":case"E":return buffer+=read(),void(lexState="decimalExponent");case"x":case"X":return buffer+=read(),void(lexState="hexadecimal")}return newToken("numeric",0*sign)},decimalInteger(){switch(c){case".":return buffer+=read(),void(lexState="decimalPoint");case"e":case"E":return buffer+=read(),void(lexState="decimalExponent")}if(!util.isDigit(c))return newToken("numeric",sign*Number(buffer));buffer+=read()},decimalPointLeading(){if(util.isDigit(c))return buffer+=read(),void(lexState="decimalFraction");throw invalidChar(read())},decimalPoint(){switch(c){case"e":case"E":return buffer+=read(),void(lexState="decimalExponent")}return util.isDigit(c)?(buffer+=read(),void(lexState="decimalFraction")):newToken("numeric",sign*Number(buffer))},decimalFraction(){switch(c){case"e":case"E":return buffer+=read(),void(lexState="decimalExponent")}if(!util.isDigit(c))return newToken("numeric",sign*Number(buffer));buffer+=read()},decimalExponent(){switch(c){case"+":case"-":return buffer+=read(),void(lexState="decimalExponentSign")}if(util.isDigit(c))return buffer+=read(),void(lexState="decimalExponentInteger");throw invalidChar(read())},decimalExponentSign(){if(util.isDigit(c))return buffer+=read(),void(lexState="decimalExponentInteger");throw invalidChar(read())},decimalExponentInteger(){if(!util.isDigit(c))return newToken("numeric",sign*Number(buffer));buffer+=read()},hexadecimal(){if(util.isHexDigit(c))return buffer+=read(),void(lexState="hexadecimalInteger");throw invalidChar(read())},hexadecimalInteger(){if(!util.isHexDigit(c))return newToken("numeric",sign*Number(buffer));buffer+=read()},string(){switch(c){case"\\":return read(),void(buffer+=escape());case'"':return doubleQuote?(read(),newToken("string",buffer)):void(buffer+=read());case"'":return doubleQuote?void(buffer+=read()):(read(),newToken("string",buffer));case"\n":case"\r":throw invalidChar(read());case"\u2028":case"\u2029":separatorChar(c);break;case void 0:throw invalidChar(read())}buffer+=read()},start(){switch(c){case"{":case"[":return newToken("punctuator",read())}lexState="value"},beforePropertyName(){switch(c){case"$":case"_":return buffer=read(),void(lexState="identifierName");case"\\":return read(),void(lexState="identifierNameStartEscape");case"}":return newToken("punctuator",read());case'"':case"'":return doubleQuote='"'===read(),void(lexState="string")}if(util.isIdStartChar(c))return buffer+=read(),void(lexState="identifierName");throw invalidChar(read())},afterPropertyName(){if(":"===c)return newToken("punctuator",read());throw invalidChar(read())},beforePropertyValue(){lexState="value"},afterPropertyValue(){switch(c){case",":case"}":return newToken("punctuator",read())}throw invalidChar(read())},beforeArrayValue(){if("]"===c)return newToken("punctuator",read());lexState="value"},afterArrayValue(){switch(c){case",":case"]":return newToken("punctuator",read())}throw invalidChar(read())},end(){throw invalidChar(read())}};function newToken(u,D){return{type:u,value:D,line:line,column:column}}function literal(u){for(const D of u){if(peek()!==D)throw invalidChar(read());read()}}function escape(){switch(peek()){case"b":return read(),"\b";case"f":return read(),"\f";case"n":return read(),"\n";case"r":return read(),"\r";case"t":return read(),"\t";case"v":return read(),"\v";case"0":if(read(),util.isDigit(peek()))throw invalidChar(read());return"\0";case"x":return read(),hexEscape();case"u":return read(),unicodeEscape();case"\n":case"\u2028":case"\u2029":return read(),"";case"\r":return read(),"\n"===peek()&&read(),"";case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case void 0:throw invalidChar(read())}return read()}function hexEscape(){let u="",D=peek();if(!util.isHexDigit(D))throw invalidChar(read());if(u+=read(),D=peek(),!util.isHexDigit(D))throw invalidChar(read());return u+=read(),String.fromCodePoint(parseInt(u,16))}function unicodeEscape(){let u="",D=4;for(;D-- >0;){const D=peek();if(!util.isHexDigit(D))throw invalidChar(read());u+=read()}return String.fromCodePoint(parseInt(u,16))}const parseStates={start(){if("eof"===token.type)throw invalidEOF();push()},beforePropertyName(){switch(token.type){case"identifier":case"string":return key=token.value,void(parseState="afterPropertyName");case"punctuator":return void pop();case"eof":throw invalidEOF()}},afterPropertyName(){if("eof"===token.type)throw invalidEOF();parseState="beforePropertyValue"},beforePropertyValue(){if("eof"===token.type)throw invalidEOF();push()},beforeArrayValue(){if("eof"===token.type)throw invalidEOF();"punctuator"!==token.type||"]"!==token.value?push():pop()},afterPropertyValue(){if("eof"===token.type)throw invalidEOF();switch(token.value){case",":return void(parseState="beforePropertyName");case"}":pop()}},afterArrayValue(){if("eof"===token.type)throw invalidEOF();switch(token.value){case",":return void(parseState="beforeArrayValue");case"]":pop()}},end(){}};function push(){let u;switch(token.type){case"punctuator":switch(token.value){case"{":u={};break;case"[":u=[]}break;case"null":case"boolean":case"numeric":case"string":u=token.value}if(void 0===root)root=u;else{const D=stack[stack.length-1];Array.isArray(D)?D.push(u):D[key]=u}if(null!==u&&"object"==typeof u)stack.push(u),parseState=Array.isArray(u)?"beforeArrayValue":"beforePropertyName";else{const u=stack[stack.length-1];parseState=null==u?"end":Array.isArray(u)?"afterArrayValue":"afterPropertyValue"}}function pop(){stack.pop();const u=stack[stack.length-1];parseState=null==u?"end":Array.isArray(u)?"afterArrayValue":"afterPropertyValue"}function invalidChar(u){return syntaxError(void 0===u?`JSON5: invalid end of input at ${line}:${column}`:`JSON5: invalid character '${formatChar(u)}' at ${line}:${column}`)}function invalidEOF(){return syntaxError(`JSON5: invalid end of input at ${line}:${column}`)}function invalidIdentifier(){return syntaxError(`JSON5: invalid identifier character at ${line}:${column-=5}`)}function separatorChar(u){console.warn(`JSON5: '${formatChar(u)}' in strings is not valid ECMAScript; consider escaping`)}function formatChar(u){const D={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(D[u])return D[u];if(u<" "){const D=u.charCodeAt(0).toString(16);return"\\x"+("00"+D).substring(D.length)}return u}function syntaxError(u){const D=new SyntaxError(u);return D.lineNumber=line,D.columnNumber=column,D}var stringify=function(u,D,e){const r=[];let t,F,C,a="",A="";if(null==D||"object"!=typeof D||Array.isArray(D)||(e=D.space,C=D.quote,D=D.replacer),"function"==typeof D)F=D;else if(Array.isArray(D)){t=[];for(const u of D){let D;"string"==typeof u?D=u:("number"==typeof u||u instanceof String||u instanceof Number)&&(D=String(u)),void 0!==D&&t.indexOf(D)<0&&t.push(D)}}return e instanceof Number?e=Number(e):e instanceof String&&(e=String(e)),"number"==typeof e?e>0&&(e=Math.min(10,Math.floor(e)),A=" ".substr(0,e)):"string"==typeof e&&(A=e.substr(0,10)),E("",{"":u});function E(u,D){let e=D[u];switch(null!=e&&("function"==typeof e.toJSON5?e=e.toJSON5(u):"function"==typeof e.toJSON&&(e=e.toJSON(u))),F&&(e=F.call(D,u,e)),e instanceof Number?e=Number(e):e instanceof String?e=String(e):e instanceof Boolean&&(e=e.valueOf()),e){case null:return"null";case!0:return"true";case!1:return"false"}return"string"==typeof e?n(e):"number"==typeof e?String(e):"object"==typeof e?Array.isArray(e)?function(u){if(r.indexOf(u)>=0)throw TypeError("Converting circular structure to JSON5");r.push(u);let D=a;a+=A;let e,t=[];for(let D=0;D=0)throw TypeError("Converting circular structure to JSON5");r.push(u);let D=a;a+=A;let e,F=t||Object.keys(u),C=[];for(const D of F){const e=E(D,u);if(void 0!==e){let u=i(D)+":";""!==A&&(u+=" "),u+=e,C.push(u)}}if(0===C.length)e="{}";else{let u;if(""===A)u=C.join(","),e="{"+u+"}";else{let r=",\n"+a;u=C.join(r),e="{\n"+a+u+",\n"+D+"}"}}return r.pop(),a=D,e}(e):void 0}function n(u){const D={"'":.1,'"':.2},e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};let r="";for(let t=0;tD[u]= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || - (c === '$') || (c === '_') || - unicode.ID_Start.test(c) - ) - }, - - isIdContinueChar (c) { - return typeof c === 'string' && ( - (c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || - (c >= '0' && c <= '9') || - (c === '$') || (c === '_') || - (c === '\u200C') || (c === '\u200D') || - unicode.ID_Continue.test(c) - ) - }, - - isDigit (c) { - return typeof c === 'string' && /[0-9]/.test(c) - }, - - isHexDigit (c) { - return typeof c === 'string' && /[0-9A-Fa-f]/.test(c) - }, -}; - -let source; -let parseState; -let stack; -let pos; -let line; -let column; -let token; -let key; -let root; - -var parse = function parse (text, reviver) { - source = String(text); - parseState = 'start'; - stack = []; - pos = 0; - line = 1; - column = 0; - token = undefined; - key = undefined; - root = undefined; - - do { - token = lex(); - - // This code is unreachable. - // if (!parseStates[parseState]) { - // throw invalidParseState() - // } - - parseStates[parseState](); - } while (token.type !== 'eof') - - if (typeof reviver === 'function') { - return internalize({'': root}, '', reviver) - } - - return root -}; - -function internalize (holder, name, reviver) { - const value = holder[name]; - if (value != null && typeof value === 'object') { - for (const key in value) { - const replacement = internalize(value, key, reviver); - if (replacement === undefined) { - delete value[key]; - } else { - value[key] = replacement; - } - } - } - - return reviver.call(holder, name, value) -} - -let lexState; -let buffer; -let doubleQuote; -let sign; -let c; - -function lex () { - lexState = 'default'; - buffer = ''; - doubleQuote = false; - sign = 1; - - for (;;) { - c = peek(); - - // This code is unreachable. - // if (!lexStates[lexState]) { - // throw invalidLexState(lexState) - // } - - const token = lexStates[lexState](); - if (token) { - return token - } - } -} - -function peek () { - if (source[pos]) { - return String.fromCodePoint(source.codePointAt(pos)) - } -} - -function read () { - const c = peek(); - - if (c === '\n') { - line++; - column = 0; - } else if (c) { - column += c.length; - } else { - column++; - } - - if (c) { - pos += c.length; - } - - return c -} - -const lexStates = { - default () { - switch (c) { - case '\t': - case '\v': - case '\f': - case ' ': - case '\u00A0': - case '\uFEFF': - case '\n': - case '\r': - case '\u2028': - case '\u2029': - read(); - return - - case '/': - read(); - lexState = 'comment'; - return - - case undefined: - read(); - return newToken('eof') - } - - if (util.isSpaceSeparator(c)) { - read(); - return - } - - // This code is unreachable. - // if (!lexStates[parseState]) { - // throw invalidLexState(parseState) - // } - - return lexStates[parseState]() - }, - - comment () { - switch (c) { - case '*': - read(); - lexState = 'multiLineComment'; - return - - case '/': - read(); - lexState = 'singleLineComment'; - return - } - - throw invalidChar(read()) - }, - - multiLineComment () { - switch (c) { - case '*': - read(); - lexState = 'multiLineCommentAsterisk'; - return - - case undefined: - throw invalidChar(read()) - } - - read(); - }, - - multiLineCommentAsterisk () { - switch (c) { - case '*': - read(); - return - - case '/': - read(); - lexState = 'default'; - return - - case undefined: - throw invalidChar(read()) - } - - read(); - lexState = 'multiLineComment'; - }, - - singleLineComment () { - switch (c) { - case '\n': - case '\r': - case '\u2028': - case '\u2029': - read(); - lexState = 'default'; - return - - case undefined: - read(); - return newToken('eof') - } - - read(); - }, - - value () { - switch (c) { - case '{': - case '[': - return newToken('punctuator', read()) - - case 'n': - read(); - literal('ull'); - return newToken('null', null) - - case 't': - read(); - literal('rue'); - return newToken('boolean', true) - - case 'f': - read(); - literal('alse'); - return newToken('boolean', false) - - case '-': - case '+': - if (read() === '-') { - sign = -1; - } - - lexState = 'sign'; - return - - case '.': - buffer = read(); - lexState = 'decimalPointLeading'; - return - - case '0': - buffer = read(); - lexState = 'zero'; - return - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - buffer = read(); - lexState = 'decimalInteger'; - return - - case 'I': - read(); - literal('nfinity'); - return newToken('numeric', Infinity) - - case 'N': - read(); - literal('aN'); - return newToken('numeric', NaN) - - case '"': - case "'": - doubleQuote = (read() === '"'); - buffer = ''; - lexState = 'string'; - return - } - - throw invalidChar(read()) - }, - - identifierNameStartEscape () { - if (c !== 'u') { - throw invalidChar(read()) - } - - read(); - const u = unicodeEscape(); - switch (u) { - case '$': - case '_': - break - - default: - if (!util.isIdStartChar(u)) { - throw invalidIdentifier() - } - - break - } - - buffer += u; - lexState = 'identifierName'; - }, - - identifierName () { - switch (c) { - case '$': - case '_': - case '\u200C': - case '\u200D': - buffer += read(); - return - - case '\\': - read(); - lexState = 'identifierNameEscape'; - return - } - - if (util.isIdContinueChar(c)) { - buffer += read(); - return - } - - return newToken('identifier', buffer) - }, - - identifierNameEscape () { - if (c !== 'u') { - throw invalidChar(read()) - } - - read(); - const u = unicodeEscape(); - switch (u) { - case '$': - case '_': - case '\u200C': - case '\u200D': - break - - default: - if (!util.isIdContinueChar(u)) { - throw invalidIdentifier() - } - - break - } - - buffer += u; - lexState = 'identifierName'; - }, - - sign () { - switch (c) { - case '.': - buffer = read(); - lexState = 'decimalPointLeading'; - return - - case '0': - buffer = read(); - lexState = 'zero'; - return - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - buffer = read(); - lexState = 'decimalInteger'; - return - - case 'I': - read(); - literal('nfinity'); - return newToken('numeric', sign * Infinity) - - case 'N': - read(); - literal('aN'); - return newToken('numeric', NaN) - } - - throw invalidChar(read()) - }, - - zero () { - switch (c) { - case '.': - buffer += read(); - lexState = 'decimalPoint'; - return - - case 'e': - case 'E': - buffer += read(); - lexState = 'decimalExponent'; - return - - case 'x': - case 'X': - buffer += read(); - lexState = 'hexadecimal'; - return - } - - return newToken('numeric', sign * 0) - }, - - decimalInteger () { - switch (c) { - case '.': - buffer += read(); - lexState = 'decimalPoint'; - return - - case 'e': - case 'E': - buffer += read(); - lexState = 'decimalExponent'; - return - } - - if (util.isDigit(c)) { - buffer += read(); - return - } - - return newToken('numeric', sign * Number(buffer)) - }, - - decimalPointLeading () { - if (util.isDigit(c)) { - buffer += read(); - lexState = 'decimalFraction'; - return - } - - throw invalidChar(read()) - }, - - decimalPoint () { - switch (c) { - case 'e': - case 'E': - buffer += read(); - lexState = 'decimalExponent'; - return - } - - if (util.isDigit(c)) { - buffer += read(); - lexState = 'decimalFraction'; - return - } - - return newToken('numeric', sign * Number(buffer)) - }, - - decimalFraction () { - switch (c) { - case 'e': - case 'E': - buffer += read(); - lexState = 'decimalExponent'; - return - } - - if (util.isDigit(c)) { - buffer += read(); - return - } - - return newToken('numeric', sign * Number(buffer)) - }, - - decimalExponent () { - switch (c) { - case '+': - case '-': - buffer += read(); - lexState = 'decimalExponentSign'; - return - } - - if (util.isDigit(c)) { - buffer += read(); - lexState = 'decimalExponentInteger'; - return - } - - throw invalidChar(read()) - }, - - decimalExponentSign () { - if (util.isDigit(c)) { - buffer += read(); - lexState = 'decimalExponentInteger'; - return - } - - throw invalidChar(read()) - }, - - decimalExponentInteger () { - if (util.isDigit(c)) { - buffer += read(); - return - } - - return newToken('numeric', sign * Number(buffer)) - }, - - hexadecimal () { - if (util.isHexDigit(c)) { - buffer += read(); - lexState = 'hexadecimalInteger'; - return - } - - throw invalidChar(read()) - }, - - hexadecimalInteger () { - if (util.isHexDigit(c)) { - buffer += read(); - return - } - - return newToken('numeric', sign * Number(buffer)) - }, - - string () { - switch (c) { - case '\\': - read(); - buffer += escape(); - return - - case '"': - if (doubleQuote) { - read(); - return newToken('string', buffer) - } - - buffer += read(); - return - - case "'": - if (!doubleQuote) { - read(); - return newToken('string', buffer) - } - - buffer += read(); - return - - case '\n': - case '\r': - throw invalidChar(read()) - - case '\u2028': - case '\u2029': - separatorChar(c); - break - - case undefined: - throw invalidChar(read()) - } - - buffer += read(); - }, - - start () { - switch (c) { - case '{': - case '[': - return newToken('punctuator', read()) - - // This code is unreachable since the default lexState handles eof. - // case undefined: - // return newToken('eof') - } - - lexState = 'value'; - }, - - beforePropertyName () { - switch (c) { - case '$': - case '_': - buffer = read(); - lexState = 'identifierName'; - return - - case '\\': - read(); - lexState = 'identifierNameStartEscape'; - return - - case '}': - return newToken('punctuator', read()) - - case '"': - case "'": - doubleQuote = (read() === '"'); - lexState = 'string'; - return - } - - if (util.isIdStartChar(c)) { - buffer += read(); - lexState = 'identifierName'; - return - } - - throw invalidChar(read()) - }, - - afterPropertyName () { - if (c === ':') { - return newToken('punctuator', read()) - } - - throw invalidChar(read()) - }, - - beforePropertyValue () { - lexState = 'value'; - }, - - afterPropertyValue () { - switch (c) { - case ',': - case '}': - return newToken('punctuator', read()) - } - - throw invalidChar(read()) - }, - - beforeArrayValue () { - if (c === ']') { - return newToken('punctuator', read()) - } - - lexState = 'value'; - }, - - afterArrayValue () { - switch (c) { - case ',': - case ']': - return newToken('punctuator', read()) - } - - throw invalidChar(read()) - }, - - end () { - // This code is unreachable since it's handled by the default lexState. - // if (c === undefined) { - // read() - // return newToken('eof') - // } - - throw invalidChar(read()) - }, -}; - -function newToken (type, value) { - return { - type, - value, - line, - column, - } -} - -function literal (s) { - for (const c of s) { - const p = peek(); - - if (p !== c) { - throw invalidChar(read()) - } - - read(); - } -} - -function escape () { - const c = peek(); - switch (c) { - case 'b': - read(); - return '\b' - - case 'f': - read(); - return '\f' - - case 'n': - read(); - return '\n' - - case 'r': - read(); - return '\r' - - case 't': - read(); - return '\t' - - case 'v': - read(); - return '\v' - - case '0': - read(); - if (util.isDigit(peek())) { - throw invalidChar(read()) - } - - return '\0' - - case 'x': - read(); - return hexEscape() - - case 'u': - read(); - return unicodeEscape() - - case '\n': - case '\u2028': - case '\u2029': - read(); - return '' - - case '\r': - read(); - if (peek() === '\n') { - read(); - } - - return '' - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - throw invalidChar(read()) - - case undefined: - throw invalidChar(read()) - } - - return read() -} - -function hexEscape () { - let buffer = ''; - let c = peek(); - - if (!util.isHexDigit(c)) { - throw invalidChar(read()) - } - - buffer += read(); - - c = peek(); - if (!util.isHexDigit(c)) { - throw invalidChar(read()) - } - - buffer += read(); - - return String.fromCodePoint(parseInt(buffer, 16)) -} - -function unicodeEscape () { - let buffer = ''; - let count = 4; - - while (count-- > 0) { - const c = peek(); - if (!util.isHexDigit(c)) { - throw invalidChar(read()) - } - - buffer += read(); - } - - return String.fromCodePoint(parseInt(buffer, 16)) -} - -const parseStates = { - start () { - if (token.type === 'eof') { - throw invalidEOF() - } - - push(); - }, - - beforePropertyName () { - switch (token.type) { - case 'identifier': - case 'string': - key = token.value; - parseState = 'afterPropertyName'; - return - - case 'punctuator': - // This code is unreachable since it's handled by the lexState. - // if (token.value !== '}') { - // throw invalidToken() - // } - - pop(); - return - - case 'eof': - throw invalidEOF() - } - - // This code is unreachable since it's handled by the lexState. - // throw invalidToken() - }, - - afterPropertyName () { - // This code is unreachable since it's handled by the lexState. - // if (token.type !== 'punctuator' || token.value !== ':') { - // throw invalidToken() - // } - - if (token.type === 'eof') { - throw invalidEOF() - } - - parseState = 'beforePropertyValue'; - }, - - beforePropertyValue () { - if (token.type === 'eof') { - throw invalidEOF() - } - - push(); - }, - - beforeArrayValue () { - if (token.type === 'eof') { - throw invalidEOF() - } - - if (token.type === 'punctuator' && token.value === ']') { - pop(); - return - } - - push(); - }, - - afterPropertyValue () { - // This code is unreachable since it's handled by the lexState. - // if (token.type !== 'punctuator') { - // throw invalidToken() - // } - - if (token.type === 'eof') { - throw invalidEOF() - } - - switch (token.value) { - case ',': - parseState = 'beforePropertyName'; - return - - case '}': - pop(); - } - - // This code is unreachable since it's handled by the lexState. - // throw invalidToken() - }, - - afterArrayValue () { - // This code is unreachable since it's handled by the lexState. - // if (token.type !== 'punctuator') { - // throw invalidToken() - // } - - if (token.type === 'eof') { - throw invalidEOF() - } - - switch (token.value) { - case ',': - parseState = 'beforeArrayValue'; - return - - case ']': - pop(); - } - - // This code is unreachable since it's handled by the lexState. - // throw invalidToken() - }, - - end () { - // This code is unreachable since it's handled by the lexState. - // if (token.type !== 'eof') { - // throw invalidToken() - // } - }, -}; - -function push () { - let value; - - switch (token.type) { - case 'punctuator': - switch (token.value) { - case '{': - value = {}; - break - - case '[': - value = []; - break - } - - break - - case 'null': - case 'boolean': - case 'numeric': - case 'string': - value = token.value; - break - - // This code is unreachable. - // default: - // throw invalidToken() - } - - if (root === undefined) { - root = value; - } else { - const parent = stack[stack.length - 1]; - if (Array.isArray(parent)) { - parent.push(value); - } else { - parent[key] = value; - } - } - - if (value !== null && typeof value === 'object') { - stack.push(value); - - if (Array.isArray(value)) { - parseState = 'beforeArrayValue'; - } else { - parseState = 'beforePropertyName'; - } - } else { - const current = stack[stack.length - 1]; - if (current == null) { - parseState = 'end'; - } else if (Array.isArray(current)) { - parseState = 'afterArrayValue'; - } else { - parseState = 'afterPropertyValue'; - } - } -} - -function pop () { - stack.pop(); - - const current = stack[stack.length - 1]; - if (current == null) { - parseState = 'end'; - } else if (Array.isArray(current)) { - parseState = 'afterArrayValue'; - } else { - parseState = 'afterPropertyValue'; - } -} - -// This code is unreachable. -// function invalidParseState () { -// return new Error(`JSON5: invalid parse state '${parseState}'`) -// } - -// This code is unreachable. -// function invalidLexState (state) { -// return new Error(`JSON5: invalid lex state '${state}'`) -// } - -function invalidChar (c) { - if (c === undefined) { - return syntaxError(`JSON5: invalid end of input at ${line}:${column}`) - } - - return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`) -} - -function invalidEOF () { - return syntaxError(`JSON5: invalid end of input at ${line}:${column}`) -} - -// This code is unreachable. -// function invalidToken () { -// if (token.type === 'eof') { -// return syntaxError(`JSON5: invalid end of input at ${line}:${column}`) -// } - -// const c = String.fromCodePoint(token.value.codePointAt(0)) -// return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`) -// } - -function invalidIdentifier () { - column -= 5; - return syntaxError(`JSON5: invalid identifier character at ${line}:${column}`) -} - -function separatorChar (c) { - console.warn(`JSON5: '${formatChar(c)}' in strings is not valid ECMAScript; consider escaping`); -} - -function formatChar (c) { - const replacements = { - "'": "\\'", - '"': '\\"', - '\\': '\\\\', - '\b': '\\b', - '\f': '\\f', - '\n': '\\n', - '\r': '\\r', - '\t': '\\t', - '\v': '\\v', - '\0': '\\0', - '\u2028': '\\u2028', - '\u2029': '\\u2029', - }; - - if (replacements[c]) { - return replacements[c] - } - - if (c < ' ') { - const hexString = c.charCodeAt(0).toString(16); - return '\\x' + ('00' + hexString).substring(hexString.length) - } - - return c -} - -function syntaxError (message) { - const err = new SyntaxError(message); - err.lineNumber = line; - err.columnNumber = column; - return err -} - -var stringify = function stringify (value, replacer, space) { - const stack = []; - let indent = ''; - let propertyList; - let replacerFunc; - let gap = ''; - let quote; - - if ( - replacer != null && - typeof replacer === 'object' && - !Array.isArray(replacer) - ) { - space = replacer.space; - quote = replacer.quote; - replacer = replacer.replacer; - } - - if (typeof replacer === 'function') { - replacerFunc = replacer; - } else if (Array.isArray(replacer)) { - propertyList = []; - for (const v of replacer) { - let item; - - if (typeof v === 'string') { - item = v; - } else if ( - typeof v === 'number' || - v instanceof String || - v instanceof Number - ) { - item = String(v); - } - - if (item !== undefined && propertyList.indexOf(item) < 0) { - propertyList.push(item); - } - } - } - - if (space instanceof Number) { - space = Number(space); - } else if (space instanceof String) { - space = String(space); - } - - if (typeof space === 'number') { - if (space > 0) { - space = Math.min(10, Math.floor(space)); - gap = ' '.substr(0, space); - } - } else if (typeof space === 'string') { - gap = space.substr(0, 10); - } - - return serializeProperty('', {'': value}) - - function serializeProperty (key, holder) { - let value = holder[key]; - if (value != null) { - if (typeof value.toJSON5 === 'function') { - value = value.toJSON5(key); - } else if (typeof value.toJSON === 'function') { - value = value.toJSON(key); - } - } - - if (replacerFunc) { - value = replacerFunc.call(holder, key, value); - } - - if (value instanceof Number) { - value = Number(value); - } else if (value instanceof String) { - value = String(value); - } else if (value instanceof Boolean) { - value = value.valueOf(); - } - - switch (value) { - case null: return 'null' - case true: return 'true' - case false: return 'false' - } - - if (typeof value === 'string') { - return quoteString(value, false) - } - - if (typeof value === 'number') { - return String(value) - } - - if (typeof value === 'object') { - return Array.isArray(value) ? serializeArray(value) : serializeObject(value) - } - - return undefined - } - - function quoteString (value) { - const quotes = { - "'": 0.1, - '"': 0.2, - }; - - const replacements = { - "'": "\\'", - '"': '\\"', - '\\': '\\\\', - '\b': '\\b', - '\f': '\\f', - '\n': '\\n', - '\r': '\\r', - '\t': '\\t', - '\v': '\\v', - '\0': '\\0', - '\u2028': '\\u2028', - '\u2029': '\\u2029', - }; - - let product = ''; - - for (let i = 0; i < value.length; i++) { - const c = value[i]; - switch (c) { - case "'": - case '"': - quotes[c]++; - product += c; - continue - - case '\0': - if (util.isDigit(value[i + 1])) { - product += '\\x00'; - continue - } - } - - if (replacements[c]) { - product += replacements[c]; - continue - } - - if (c < ' ') { - let hexString = c.charCodeAt(0).toString(16); - product += '\\x' + ('00' + hexString).substring(hexString.length); - continue - } - - product += c; - } - - const quoteChar = quote || Object.keys(quotes).reduce((a, b) => (quotes[a] < quotes[b]) ? a : b); - - product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]); - - return quoteChar + product + quoteChar - } - - function serializeObject (value) { - if (stack.indexOf(value) >= 0) { - throw TypeError('Converting circular structure to JSON5') - } - - stack.push(value); - - let stepback = indent; - indent = indent + gap; - - let keys = propertyList || Object.keys(value); - let partial = []; - for (const key of keys) { - const propertyString = serializeProperty(key, value); - if (propertyString !== undefined) { - let member = serializeKey(key) + ':'; - if (gap !== '') { - member += ' '; - } - member += propertyString; - partial.push(member); - } - } - - let final; - if (partial.length === 0) { - final = '{}'; - } else { - let properties; - if (gap === '') { - properties = partial.join(','); - final = '{' + properties + '}'; - } else { - let separator = ',\n' + indent; - properties = partial.join(separator); - final = '{\n' + indent + properties + ',\n' + stepback + '}'; - } - } - - stack.pop(); - indent = stepback; - return final - } - - function serializeKey (key) { - if (key.length === 0) { - return quoteString(key, true) - } - - const firstChar = String.fromCodePoint(key.codePointAt(0)); - if (!util.isIdStartChar(firstChar)) { - return quoteString(key, true) - } - - for (let i = firstChar.length; i < key.length; i++) { - if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) { - return quoteString(key, true) - } - } - - return key - } - - function serializeArray (value) { - if (stack.indexOf(value) >= 0) { - throw TypeError('Converting circular structure to JSON5') - } - - stack.push(value); - - let stepback = indent; - indent = indent + gap; - - let partial = []; - for (let i = 0; i < value.length; i++) { - const propertyString = serializeProperty(String(i), value); - partial.push((propertyString !== undefined) ? propertyString : 'null'); - } - - let final; - if (partial.length === 0) { - final = '[]'; - } else { - if (gap === '') { - let properties = partial.join(','); - final = '[' + properties + ']'; - } else { - let separator = ',\n' + indent; - let properties = partial.join(separator); - final = '[\n' + indent + properties + ',\n' + stepback + ']'; - } - } - - stack.pop(); - indent = stepback; - return final - } -}; - -const JSON5 = { - parse, - stringify, -}; - -var lib = JSON5; - -export default lib; diff --git a/node_modules/loader-utils/node_modules/json5/lib/cli.js b/node_modules/loader-utils/node_modules/json5/lib/cli.js deleted file mode 100755 index 93cb80921..000000000 --- a/node_modules/loader-utils/node_modules/json5/lib/cli.js +++ /dev/null @@ -1,152 +0,0 @@ -#!/usr/bin/env node - -const fs = require('fs') -const path = require('path') -const pkg = require('../package.json') -const JSON5 = require('./') - -const argv = parseArgs() - -if (argv.version) { - version() -} else if (argv.help) { - usage() -} else { - const inFilename = argv.defaults[0] - - let readStream - if (inFilename) { - readStream = fs.createReadStream(inFilename) - } else { - readStream = process.stdin - } - - let json5 = '' - readStream.on('data', data => { - json5 += data - }) - - readStream.on('end', () => { - let space - if (argv.space === 't' || argv.space === 'tab') { - space = '\t' - } else { - space = Number(argv.space) - } - - let value - try { - value = JSON5.parse(json5) - if (!argv.validate) { - const json = JSON.stringify(value, null, space) - - let writeStream - - // --convert is for backward compatibility with v0.5.1. If - // specified with and not --out-file, then a file with - // the same name but with a .json extension will be written. - if (argv.convert && inFilename && !argv.outFile) { - const parsedFilename = path.parse(inFilename) - const outFilename = path.format( - Object.assign( - parsedFilename, - {base: path.basename(parsedFilename.base, parsedFilename.ext) + '.json'} - ) - ) - - writeStream = fs.createWriteStream(outFilename) - } else if (argv.outFile) { - writeStream = fs.createWriteStream(argv.outFile) - } else { - writeStream = process.stdout - } - - writeStream.write(json) - } - } catch (err) { - console.error(err.message) - process.exit(1) - } - }) -} - -function parseArgs () { - let convert - let space - let validate - let outFile - let version - let help - const defaults = [] - - const args = process.argv.slice(2) - for (let i = 0; i < args.length; i++) { - const arg = args[i] - switch (arg) { - case '--convert': - case '-c': - convert = true - break - - case '--space': - case '-s': - space = args[++i] - break - - case '--validate': - case '-v': - validate = true - break - - case '--out-file': - case '-o': - outFile = args[++i] - break - - case '--version': - case '-V': - version = true - break - - case '--help': - case '-h': - help = true - break - - default: - defaults.push(arg) - break - } - } - - return { - convert, - space, - validate, - outFile, - version, - help, - defaults, - } -} - -function version () { - console.log(pkg.version) -} - -function usage () { - console.log( - ` - Usage: json5 [options] - - If is not provided, then STDIN is used. - - Options: - - -s, --space The number of spaces to indent or 't' for tabs - -o, --out-file [file] Output to the specified file, otherwise STDOUT - -v, --validate Validate JSON5 but do not output JSON - -V, --version Output the version number - -h, --help Output usage information` - ) -} diff --git a/node_modules/loader-utils/node_modules/json5/lib/index.d.ts b/node_modules/loader-utils/node_modules/json5/lib/index.d.ts deleted file mode 100644 index 1c45bca58..000000000 --- a/node_modules/loader-utils/node_modules/json5/lib/index.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -import parse = require('./parse') -import stringify = require('./stringify') - -export {parse, stringify} diff --git a/node_modules/loader-utils/node_modules/json5/lib/index.js b/node_modules/loader-utils/node_modules/json5/lib/index.js deleted file mode 100644 index 367963888..000000000 --- a/node_modules/loader-utils/node_modules/json5/lib/index.js +++ /dev/null @@ -1,9 +0,0 @@ -const parse = require('./parse') -const stringify = require('./stringify') - -const JSON5 = { - parse, - stringify, -} - -module.exports = JSON5 diff --git a/node_modules/loader-utils/node_modules/json5/lib/parse.d.ts b/node_modules/loader-utils/node_modules/json5/lib/parse.d.ts deleted file mode 100644 index 8c8d883a2..000000000 --- a/node_modules/loader-utils/node_modules/json5/lib/parse.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Parses a JSON5 string, constructing the JavaScript value or object described - * by the string. - * @template T The type of the return value. - * @param text The string to parse as JSON5. - * @param reviver A function that prescribes how the value originally produced - * by parsing is transformed before being returned. - * @returns The JavaScript value converted from the JSON5 string. - */ -declare function parse( - text: string, - reviver?: ((this: any, key: string, value: any) => any) | null, -): T - -export = parse diff --git a/node_modules/loader-utils/node_modules/json5/lib/parse.js b/node_modules/loader-utils/node_modules/json5/lib/parse.js deleted file mode 100644 index c01646fc3..000000000 --- a/node_modules/loader-utils/node_modules/json5/lib/parse.js +++ /dev/null @@ -1,1087 +0,0 @@ -const util = require('./util') - -let source -let parseState -let stack -let pos -let line -let column -let token -let key -let root - -module.exports = function parse (text, reviver) { - source = String(text) - parseState = 'start' - stack = [] - pos = 0 - line = 1 - column = 0 - token = undefined - key = undefined - root = undefined - - do { - token = lex() - - // This code is unreachable. - // if (!parseStates[parseState]) { - // throw invalidParseState() - // } - - parseStates[parseState]() - } while (token.type !== 'eof') - - if (typeof reviver === 'function') { - return internalize({'': root}, '', reviver) - } - - return root -} - -function internalize (holder, name, reviver) { - const value = holder[name] - if (value != null && typeof value === 'object') { - for (const key in value) { - const replacement = internalize(value, key, reviver) - if (replacement === undefined) { - delete value[key] - } else { - value[key] = replacement - } - } - } - - return reviver.call(holder, name, value) -} - -let lexState -let buffer -let doubleQuote -let sign -let c - -function lex () { - lexState = 'default' - buffer = '' - doubleQuote = false - sign = 1 - - for (;;) { - c = peek() - - // This code is unreachable. - // if (!lexStates[lexState]) { - // throw invalidLexState(lexState) - // } - - const token = lexStates[lexState]() - if (token) { - return token - } - } -} - -function peek () { - if (source[pos]) { - return String.fromCodePoint(source.codePointAt(pos)) - } -} - -function read () { - const c = peek() - - if (c === '\n') { - line++ - column = 0 - } else if (c) { - column += c.length - } else { - column++ - } - - if (c) { - pos += c.length - } - - return c -} - -const lexStates = { - default () { - switch (c) { - case '\t': - case '\v': - case '\f': - case ' ': - case '\u00A0': - case '\uFEFF': - case '\n': - case '\r': - case '\u2028': - case '\u2029': - read() - return - - case '/': - read() - lexState = 'comment' - return - - case undefined: - read() - return newToken('eof') - } - - if (util.isSpaceSeparator(c)) { - read() - return - } - - // This code is unreachable. - // if (!lexStates[parseState]) { - // throw invalidLexState(parseState) - // } - - return lexStates[parseState]() - }, - - comment () { - switch (c) { - case '*': - read() - lexState = 'multiLineComment' - return - - case '/': - read() - lexState = 'singleLineComment' - return - } - - throw invalidChar(read()) - }, - - multiLineComment () { - switch (c) { - case '*': - read() - lexState = 'multiLineCommentAsterisk' - return - - case undefined: - throw invalidChar(read()) - } - - read() - }, - - multiLineCommentAsterisk () { - switch (c) { - case '*': - read() - return - - case '/': - read() - lexState = 'default' - return - - case undefined: - throw invalidChar(read()) - } - - read() - lexState = 'multiLineComment' - }, - - singleLineComment () { - switch (c) { - case '\n': - case '\r': - case '\u2028': - case '\u2029': - read() - lexState = 'default' - return - - case undefined: - read() - return newToken('eof') - } - - read() - }, - - value () { - switch (c) { - case '{': - case '[': - return newToken('punctuator', read()) - - case 'n': - read() - literal('ull') - return newToken('null', null) - - case 't': - read() - literal('rue') - return newToken('boolean', true) - - case 'f': - read() - literal('alse') - return newToken('boolean', false) - - case '-': - case '+': - if (read() === '-') { - sign = -1 - } - - lexState = 'sign' - return - - case '.': - buffer = read() - lexState = 'decimalPointLeading' - return - - case '0': - buffer = read() - lexState = 'zero' - return - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - buffer = read() - lexState = 'decimalInteger' - return - - case 'I': - read() - literal('nfinity') - return newToken('numeric', Infinity) - - case 'N': - read() - literal('aN') - return newToken('numeric', NaN) - - case '"': - case "'": - doubleQuote = (read() === '"') - buffer = '' - lexState = 'string' - return - } - - throw invalidChar(read()) - }, - - identifierNameStartEscape () { - if (c !== 'u') { - throw invalidChar(read()) - } - - read() - const u = unicodeEscape() - switch (u) { - case '$': - case '_': - break - - default: - if (!util.isIdStartChar(u)) { - throw invalidIdentifier() - } - - break - } - - buffer += u - lexState = 'identifierName' - }, - - identifierName () { - switch (c) { - case '$': - case '_': - case '\u200C': - case '\u200D': - buffer += read() - return - - case '\\': - read() - lexState = 'identifierNameEscape' - return - } - - if (util.isIdContinueChar(c)) { - buffer += read() - return - } - - return newToken('identifier', buffer) - }, - - identifierNameEscape () { - if (c !== 'u') { - throw invalidChar(read()) - } - - read() - const u = unicodeEscape() - switch (u) { - case '$': - case '_': - case '\u200C': - case '\u200D': - break - - default: - if (!util.isIdContinueChar(u)) { - throw invalidIdentifier() - } - - break - } - - buffer += u - lexState = 'identifierName' - }, - - sign () { - switch (c) { - case '.': - buffer = read() - lexState = 'decimalPointLeading' - return - - case '0': - buffer = read() - lexState = 'zero' - return - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - buffer = read() - lexState = 'decimalInteger' - return - - case 'I': - read() - literal('nfinity') - return newToken('numeric', sign * Infinity) - - case 'N': - read() - literal('aN') - return newToken('numeric', NaN) - } - - throw invalidChar(read()) - }, - - zero () { - switch (c) { - case '.': - buffer += read() - lexState = 'decimalPoint' - return - - case 'e': - case 'E': - buffer += read() - lexState = 'decimalExponent' - return - - case 'x': - case 'X': - buffer += read() - lexState = 'hexadecimal' - return - } - - return newToken('numeric', sign * 0) - }, - - decimalInteger () { - switch (c) { - case '.': - buffer += read() - lexState = 'decimalPoint' - return - - case 'e': - case 'E': - buffer += read() - lexState = 'decimalExponent' - return - } - - if (util.isDigit(c)) { - buffer += read() - return - } - - return newToken('numeric', sign * Number(buffer)) - }, - - decimalPointLeading () { - if (util.isDigit(c)) { - buffer += read() - lexState = 'decimalFraction' - return - } - - throw invalidChar(read()) - }, - - decimalPoint () { - switch (c) { - case 'e': - case 'E': - buffer += read() - lexState = 'decimalExponent' - return - } - - if (util.isDigit(c)) { - buffer += read() - lexState = 'decimalFraction' - return - } - - return newToken('numeric', sign * Number(buffer)) - }, - - decimalFraction () { - switch (c) { - case 'e': - case 'E': - buffer += read() - lexState = 'decimalExponent' - return - } - - if (util.isDigit(c)) { - buffer += read() - return - } - - return newToken('numeric', sign * Number(buffer)) - }, - - decimalExponent () { - switch (c) { - case '+': - case '-': - buffer += read() - lexState = 'decimalExponentSign' - return - } - - if (util.isDigit(c)) { - buffer += read() - lexState = 'decimalExponentInteger' - return - } - - throw invalidChar(read()) - }, - - decimalExponentSign () { - if (util.isDigit(c)) { - buffer += read() - lexState = 'decimalExponentInteger' - return - } - - throw invalidChar(read()) - }, - - decimalExponentInteger () { - if (util.isDigit(c)) { - buffer += read() - return - } - - return newToken('numeric', sign * Number(buffer)) - }, - - hexadecimal () { - if (util.isHexDigit(c)) { - buffer += read() - lexState = 'hexadecimalInteger' - return - } - - throw invalidChar(read()) - }, - - hexadecimalInteger () { - if (util.isHexDigit(c)) { - buffer += read() - return - } - - return newToken('numeric', sign * Number(buffer)) - }, - - string () { - switch (c) { - case '\\': - read() - buffer += escape() - return - - case '"': - if (doubleQuote) { - read() - return newToken('string', buffer) - } - - buffer += read() - return - - case "'": - if (!doubleQuote) { - read() - return newToken('string', buffer) - } - - buffer += read() - return - - case '\n': - case '\r': - throw invalidChar(read()) - - case '\u2028': - case '\u2029': - separatorChar(c) - break - - case undefined: - throw invalidChar(read()) - } - - buffer += read() - }, - - start () { - switch (c) { - case '{': - case '[': - return newToken('punctuator', read()) - - // This code is unreachable since the default lexState handles eof. - // case undefined: - // return newToken('eof') - } - - lexState = 'value' - }, - - beforePropertyName () { - switch (c) { - case '$': - case '_': - buffer = read() - lexState = 'identifierName' - return - - case '\\': - read() - lexState = 'identifierNameStartEscape' - return - - case '}': - return newToken('punctuator', read()) - - case '"': - case "'": - doubleQuote = (read() === '"') - lexState = 'string' - return - } - - if (util.isIdStartChar(c)) { - buffer += read() - lexState = 'identifierName' - return - } - - throw invalidChar(read()) - }, - - afterPropertyName () { - if (c === ':') { - return newToken('punctuator', read()) - } - - throw invalidChar(read()) - }, - - beforePropertyValue () { - lexState = 'value' - }, - - afterPropertyValue () { - switch (c) { - case ',': - case '}': - return newToken('punctuator', read()) - } - - throw invalidChar(read()) - }, - - beforeArrayValue () { - if (c === ']') { - return newToken('punctuator', read()) - } - - lexState = 'value' - }, - - afterArrayValue () { - switch (c) { - case ',': - case ']': - return newToken('punctuator', read()) - } - - throw invalidChar(read()) - }, - - end () { - // This code is unreachable since it's handled by the default lexState. - // if (c === undefined) { - // read() - // return newToken('eof') - // } - - throw invalidChar(read()) - }, -} - -function newToken (type, value) { - return { - type, - value, - line, - column, - } -} - -function literal (s) { - for (const c of s) { - const p = peek() - - if (p !== c) { - throw invalidChar(read()) - } - - read() - } -} - -function escape () { - const c = peek() - switch (c) { - case 'b': - read() - return '\b' - - case 'f': - read() - return '\f' - - case 'n': - read() - return '\n' - - case 'r': - read() - return '\r' - - case 't': - read() - return '\t' - - case 'v': - read() - return '\v' - - case '0': - read() - if (util.isDigit(peek())) { - throw invalidChar(read()) - } - - return '\0' - - case 'x': - read() - return hexEscape() - - case 'u': - read() - return unicodeEscape() - - case '\n': - case '\u2028': - case '\u2029': - read() - return '' - - case '\r': - read() - if (peek() === '\n') { - read() - } - - return '' - - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - throw invalidChar(read()) - - case undefined: - throw invalidChar(read()) - } - - return read() -} - -function hexEscape () { - let buffer = '' - let c = peek() - - if (!util.isHexDigit(c)) { - throw invalidChar(read()) - } - - buffer += read() - - c = peek() - if (!util.isHexDigit(c)) { - throw invalidChar(read()) - } - - buffer += read() - - return String.fromCodePoint(parseInt(buffer, 16)) -} - -function unicodeEscape () { - let buffer = '' - let count = 4 - - while (count-- > 0) { - const c = peek() - if (!util.isHexDigit(c)) { - throw invalidChar(read()) - } - - buffer += read() - } - - return String.fromCodePoint(parseInt(buffer, 16)) -} - -const parseStates = { - start () { - if (token.type === 'eof') { - throw invalidEOF() - } - - push() - }, - - beforePropertyName () { - switch (token.type) { - case 'identifier': - case 'string': - key = token.value - parseState = 'afterPropertyName' - return - - case 'punctuator': - // This code is unreachable since it's handled by the lexState. - // if (token.value !== '}') { - // throw invalidToken() - // } - - pop() - return - - case 'eof': - throw invalidEOF() - } - - // This code is unreachable since it's handled by the lexState. - // throw invalidToken() - }, - - afterPropertyName () { - // This code is unreachable since it's handled by the lexState. - // if (token.type !== 'punctuator' || token.value !== ':') { - // throw invalidToken() - // } - - if (token.type === 'eof') { - throw invalidEOF() - } - - parseState = 'beforePropertyValue' - }, - - beforePropertyValue () { - if (token.type === 'eof') { - throw invalidEOF() - } - - push() - }, - - beforeArrayValue () { - if (token.type === 'eof') { - throw invalidEOF() - } - - if (token.type === 'punctuator' && token.value === ']') { - pop() - return - } - - push() - }, - - afterPropertyValue () { - // This code is unreachable since it's handled by the lexState. - // if (token.type !== 'punctuator') { - // throw invalidToken() - // } - - if (token.type === 'eof') { - throw invalidEOF() - } - - switch (token.value) { - case ',': - parseState = 'beforePropertyName' - return - - case '}': - pop() - } - - // This code is unreachable since it's handled by the lexState. - // throw invalidToken() - }, - - afterArrayValue () { - // This code is unreachable since it's handled by the lexState. - // if (token.type !== 'punctuator') { - // throw invalidToken() - // } - - if (token.type === 'eof') { - throw invalidEOF() - } - - switch (token.value) { - case ',': - parseState = 'beforeArrayValue' - return - - case ']': - pop() - } - - // This code is unreachable since it's handled by the lexState. - // throw invalidToken() - }, - - end () { - // This code is unreachable since it's handled by the lexState. - // if (token.type !== 'eof') { - // throw invalidToken() - // } - }, -} - -function push () { - let value - - switch (token.type) { - case 'punctuator': - switch (token.value) { - case '{': - value = {} - break - - case '[': - value = [] - break - } - - break - - case 'null': - case 'boolean': - case 'numeric': - case 'string': - value = token.value - break - - // This code is unreachable. - // default: - // throw invalidToken() - } - - if (root === undefined) { - root = value - } else { - const parent = stack[stack.length - 1] - if (Array.isArray(parent)) { - parent.push(value) - } else { - parent[key] = value - } - } - - if (value !== null && typeof value === 'object') { - stack.push(value) - - if (Array.isArray(value)) { - parseState = 'beforeArrayValue' - } else { - parseState = 'beforePropertyName' - } - } else { - const current = stack[stack.length - 1] - if (current == null) { - parseState = 'end' - } else if (Array.isArray(current)) { - parseState = 'afterArrayValue' - } else { - parseState = 'afterPropertyValue' - } - } -} - -function pop () { - stack.pop() - - const current = stack[stack.length - 1] - if (current == null) { - parseState = 'end' - } else if (Array.isArray(current)) { - parseState = 'afterArrayValue' - } else { - parseState = 'afterPropertyValue' - } -} - -// This code is unreachable. -// function invalidParseState () { -// return new Error(`JSON5: invalid parse state '${parseState}'`) -// } - -// This code is unreachable. -// function invalidLexState (state) { -// return new Error(`JSON5: invalid lex state '${state}'`) -// } - -function invalidChar (c) { - if (c === undefined) { - return syntaxError(`JSON5: invalid end of input at ${line}:${column}`) - } - - return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`) -} - -function invalidEOF () { - return syntaxError(`JSON5: invalid end of input at ${line}:${column}`) -} - -// This code is unreachable. -// function invalidToken () { -// if (token.type === 'eof') { -// return syntaxError(`JSON5: invalid end of input at ${line}:${column}`) -// } - -// const c = String.fromCodePoint(token.value.codePointAt(0)) -// return syntaxError(`JSON5: invalid character '${formatChar(c)}' at ${line}:${column}`) -// } - -function invalidIdentifier () { - column -= 5 - return syntaxError(`JSON5: invalid identifier character at ${line}:${column}`) -} - -function separatorChar (c) { - console.warn(`JSON5: '${formatChar(c)}' in strings is not valid ECMAScript; consider escaping`) -} - -function formatChar (c) { - const replacements = { - "'": "\\'", - '"': '\\"', - '\\': '\\\\', - '\b': '\\b', - '\f': '\\f', - '\n': '\\n', - '\r': '\\r', - '\t': '\\t', - '\v': '\\v', - '\0': '\\0', - '\u2028': '\\u2028', - '\u2029': '\\u2029', - } - - if (replacements[c]) { - return replacements[c] - } - - if (c < ' ') { - const hexString = c.charCodeAt(0).toString(16) - return '\\x' + ('00' + hexString).substring(hexString.length) - } - - return c -} - -function syntaxError (message) { - const err = new SyntaxError(message) - err.lineNumber = line - err.columnNumber = column - return err -} diff --git a/node_modules/loader-utils/node_modules/json5/lib/register.js b/node_modules/loader-utils/node_modules/json5/lib/register.js deleted file mode 100644 index 935cdbafb..000000000 --- a/node_modules/loader-utils/node_modules/json5/lib/register.js +++ /dev/null @@ -1,13 +0,0 @@ -const fs = require('fs') -const JSON5 = require('./') - -// eslint-disable-next-line node/no-deprecated-api -require.extensions['.json5'] = function (module, filename) { - const content = fs.readFileSync(filename, 'utf8') - try { - module.exports = JSON5.parse(content) - } catch (err) { - err.message = filename + ': ' + err.message - throw err - } -} diff --git a/node_modules/loader-utils/node_modules/json5/lib/require.js b/node_modules/loader-utils/node_modules/json5/lib/require.js deleted file mode 100644 index 3aa29bee0..000000000 --- a/node_modules/loader-utils/node_modules/json5/lib/require.js +++ /dev/null @@ -1,4 +0,0 @@ -// This file is for backward compatibility with v0.5.1. -require('./register') - -console.warn("'json5/require' is deprecated. Please use 'json5/register' instead.") diff --git a/node_modules/loader-utils/node_modules/json5/lib/stringify.d.ts b/node_modules/loader-utils/node_modules/json5/lib/stringify.d.ts deleted file mode 100644 index 3c348389e..000000000 --- a/node_modules/loader-utils/node_modules/json5/lib/stringify.d.ts +++ /dev/null @@ -1,89 +0,0 @@ -declare type StringifyOptions = { - /** - * A function that alters the behavior of the stringification process, or an - * array of String and Number objects that serve as a allowlist for - * selecting/filtering the properties of the value object to be included in - * the JSON5 string. If this value is null or not provided, all properties - * of the object are included in the resulting JSON5 string. - */ - replacer?: - | ((this: any, key: string, value: any) => any) - | (string | number)[] - | null - - /** - * A String or Number object that's used to insert white space into the - * output JSON5 string for readability purposes. If this is a Number, it - * indicates the number of space characters to use as white space; this - * number is capped at 10 (if it is greater, the value is just 10). Values - * less than 1 indicate that no space should be used. If this is a String, - * the string (or the first 10 characters of the string, if it's longer than - * that) is used as white space. If this parameter is not provided (or is - * null), no white space is used. If white space is used, trailing commas - * will be used in objects and arrays. - */ - space?: string | number | null - - /** - * A String representing the quote character to use when serializing - * strings. - */ - quote?: string | null -} - -/** - * Converts a JavaScript value to a JSON5 string. - * @param value The value to convert to a JSON5 string. - * @param replacer A function that alters the behavior of the stringification - * process. If this value is null or not provided, all properties of the object - * are included in the resulting JSON5 string. - * @param space A String or Number object that's used to insert white space into - * the output JSON5 string for readability purposes. If this is a Number, it - * indicates the number of space characters to use as white space; this number - * is capped at 10 (if it is greater, the value is just 10). Values less than 1 - * indicate that no space should be used. If this is a String, the string (or - * the first 10 characters of the string, if it's longer than that) is used as - * white space. If this parameter is not provided (or is null), no white space - * is used. If white space is used, trailing commas will be used in objects and - * arrays. - * @returns The JSON5 string converted from the JavaScript value. - */ -declare function stringify( - value: any, - replacer?: ((this: any, key: string, value: any) => any) | null, - space?: string | number | null, -): string - -/** - * Converts a JavaScript value to a JSON5 string. - * @param value The value to convert to a JSON5 string. - * @param replacer An array of String and Number objects that serve as a - * allowlist for selecting/filtering the properties of the value object to be - * included in the JSON5 string. If this value is null or not provided, all - * properties of the object are included in the resulting JSON5 string. - * @param space A String or Number object that's used to insert white space into - * the output JSON5 string for readability purposes. If this is a Number, it - * indicates the number of space characters to use as white space; this number - * is capped at 10 (if it is greater, the value is just 10). Values less than 1 - * indicate that no space should be used. If this is a String, the string (or - * the first 10 characters of the string, if it's longer than that) is used as - * white space. If this parameter is not provided (or is null), no white space - * is used. If white space is used, trailing commas will be used in objects and - * arrays. - * @returns The JSON5 string converted from the JavaScript value. - */ -declare function stringify( - value: any, - replacer: (string | number)[], - space?: string | number | null, -): string - -/** - * Converts a JavaScript value to a JSON5 string. - * @param value The value to convert to a JSON5 string. - * @param options An object specifying options. - * @returns The JSON5 string converted from the JavaScript value. - */ -declare function stringify(value: any, options: StringifyOptions): string - -export = stringify diff --git a/node_modules/loader-utils/node_modules/json5/lib/stringify.js b/node_modules/loader-utils/node_modules/json5/lib/stringify.js deleted file mode 100644 index 7cb3b0e10..000000000 --- a/node_modules/loader-utils/node_modules/json5/lib/stringify.js +++ /dev/null @@ -1,261 +0,0 @@ -const util = require('./util') - -module.exports = function stringify (value, replacer, space) { - const stack = [] - let indent = '' - let propertyList - let replacerFunc - let gap = '' - let quote - - if ( - replacer != null && - typeof replacer === 'object' && - !Array.isArray(replacer) - ) { - space = replacer.space - quote = replacer.quote - replacer = replacer.replacer - } - - if (typeof replacer === 'function') { - replacerFunc = replacer - } else if (Array.isArray(replacer)) { - propertyList = [] - for (const v of replacer) { - let item - - if (typeof v === 'string') { - item = v - } else if ( - typeof v === 'number' || - v instanceof String || - v instanceof Number - ) { - item = String(v) - } - - if (item !== undefined && propertyList.indexOf(item) < 0) { - propertyList.push(item) - } - } - } - - if (space instanceof Number) { - space = Number(space) - } else if (space instanceof String) { - space = String(space) - } - - if (typeof space === 'number') { - if (space > 0) { - space = Math.min(10, Math.floor(space)) - gap = ' '.substr(0, space) - } - } else if (typeof space === 'string') { - gap = space.substr(0, 10) - } - - return serializeProperty('', {'': value}) - - function serializeProperty (key, holder) { - let value = holder[key] - if (value != null) { - if (typeof value.toJSON5 === 'function') { - value = value.toJSON5(key) - } else if (typeof value.toJSON === 'function') { - value = value.toJSON(key) - } - } - - if (replacerFunc) { - value = replacerFunc.call(holder, key, value) - } - - if (value instanceof Number) { - value = Number(value) - } else if (value instanceof String) { - value = String(value) - } else if (value instanceof Boolean) { - value = value.valueOf() - } - - switch (value) { - case null: return 'null' - case true: return 'true' - case false: return 'false' - } - - if (typeof value === 'string') { - return quoteString(value, false) - } - - if (typeof value === 'number') { - return String(value) - } - - if (typeof value === 'object') { - return Array.isArray(value) ? serializeArray(value) : serializeObject(value) - } - - return undefined - } - - function quoteString (value) { - const quotes = { - "'": 0.1, - '"': 0.2, - } - - const replacements = { - "'": "\\'", - '"': '\\"', - '\\': '\\\\', - '\b': '\\b', - '\f': '\\f', - '\n': '\\n', - '\r': '\\r', - '\t': '\\t', - '\v': '\\v', - '\0': '\\0', - '\u2028': '\\u2028', - '\u2029': '\\u2029', - } - - let product = '' - - for (let i = 0; i < value.length; i++) { - const c = value[i] - switch (c) { - case "'": - case '"': - quotes[c]++ - product += c - continue - - case '\0': - if (util.isDigit(value[i + 1])) { - product += '\\x00' - continue - } - } - - if (replacements[c]) { - product += replacements[c] - continue - } - - if (c < ' ') { - let hexString = c.charCodeAt(0).toString(16) - product += '\\x' + ('00' + hexString).substring(hexString.length) - continue - } - - product += c - } - - const quoteChar = quote || Object.keys(quotes).reduce((a, b) => (quotes[a] < quotes[b]) ? a : b) - - product = product.replace(new RegExp(quoteChar, 'g'), replacements[quoteChar]) - - return quoteChar + product + quoteChar - } - - function serializeObject (value) { - if (stack.indexOf(value) >= 0) { - throw TypeError('Converting circular structure to JSON5') - } - - stack.push(value) - - let stepback = indent - indent = indent + gap - - let keys = propertyList || Object.keys(value) - let partial = [] - for (const key of keys) { - const propertyString = serializeProperty(key, value) - if (propertyString !== undefined) { - let member = serializeKey(key) + ':' - if (gap !== '') { - member += ' ' - } - member += propertyString - partial.push(member) - } - } - - let final - if (partial.length === 0) { - final = '{}' - } else { - let properties - if (gap === '') { - properties = partial.join(',') - final = '{' + properties + '}' - } else { - let separator = ',\n' + indent - properties = partial.join(separator) - final = '{\n' + indent + properties + ',\n' + stepback + '}' - } - } - - stack.pop() - indent = stepback - return final - } - - function serializeKey (key) { - if (key.length === 0) { - return quoteString(key, true) - } - - const firstChar = String.fromCodePoint(key.codePointAt(0)) - if (!util.isIdStartChar(firstChar)) { - return quoteString(key, true) - } - - for (let i = firstChar.length; i < key.length; i++) { - if (!util.isIdContinueChar(String.fromCodePoint(key.codePointAt(i)))) { - return quoteString(key, true) - } - } - - return key - } - - function serializeArray (value) { - if (stack.indexOf(value) >= 0) { - throw TypeError('Converting circular structure to JSON5') - } - - stack.push(value) - - let stepback = indent - indent = indent + gap - - let partial = [] - for (let i = 0; i < value.length; i++) { - const propertyString = serializeProperty(String(i), value) - partial.push((propertyString !== undefined) ? propertyString : 'null') - } - - let final - if (partial.length === 0) { - final = '[]' - } else { - if (gap === '') { - let properties = partial.join(',') - final = '[' + properties + ']' - } else { - let separator = ',\n' + indent - let properties = partial.join(separator) - final = '[\n' + indent + properties + ',\n' + stepback + ']' - } - } - - stack.pop() - indent = stepback - return final - } -} diff --git a/node_modules/loader-utils/node_modules/json5/lib/unicode.d.ts b/node_modules/loader-utils/node_modules/json5/lib/unicode.d.ts deleted file mode 100644 index 610f8057a..000000000 --- a/node_modules/loader-utils/node_modules/json5/lib/unicode.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -export declare const Space_Separator: RegExp -export declare const ID_Start: RegExp -export declare const ID_Continue: RegExp diff --git a/node_modules/loader-utils/node_modules/json5/lib/unicode.js b/node_modules/loader-utils/node_modules/json5/lib/unicode.js deleted file mode 100644 index 215ccd843..000000000 --- a/node_modules/loader-utils/node_modules/json5/lib/unicode.js +++ /dev/null @@ -1,4 +0,0 @@ -// This is a generated file. Do not edit. -module.exports.Space_Separator = /[\u1680\u2000-\u200A\u202F\u205F\u3000]/ -module.exports.ID_Start = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\u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B\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/ -module.exports.ID_Continue = /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u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E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\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05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/ diff --git a/node_modules/loader-utils/node_modules/json5/lib/util.d.ts b/node_modules/loader-utils/node_modules/json5/lib/util.d.ts deleted file mode 100644 index a940ceadb..000000000 --- a/node_modules/loader-utils/node_modules/json5/lib/util.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -export declare function isSpaceSeparator(c?: string): boolean -export declare function isIdStartChar(c?: string): boolean -export declare function isIdContinueChar(c?: string): boolean -export declare function isDigit(c?: string): boolean -export declare function isHexDigit(c?: string): boolean diff --git a/node_modules/loader-utils/node_modules/json5/lib/util.js b/node_modules/loader-utils/node_modules/json5/lib/util.js deleted file mode 100644 index 40bfe2fa6..000000000 --- a/node_modules/loader-utils/node_modules/json5/lib/util.js +++ /dev/null @@ -1,35 +0,0 @@ -const unicode = require('../lib/unicode') - -module.exports = { - isSpaceSeparator (c) { - return typeof c === 'string' && unicode.Space_Separator.test(c) - }, - - isIdStartChar (c) { - return typeof c === 'string' && ( - (c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || - (c === '$') || (c === '_') || - unicode.ID_Start.test(c) - ) - }, - - isIdContinueChar (c) { - return typeof c === 'string' && ( - (c >= 'a' && c <= 'z') || - (c >= 'A' && c <= 'Z') || - (c >= '0' && c <= '9') || - (c === '$') || (c === '_') || - (c === '\u200C') || (c === '\u200D') || - unicode.ID_Continue.test(c) - ) - }, - - isDigit (c) { - return typeof c === 'string' && /[0-9]/.test(c) - }, - - isHexDigit (c) { - return typeof c === 'string' && /[0-9A-Fa-f]/.test(c) - }, -} diff --git a/node_modules/loader-utils/node_modules/json5/package.json b/node_modules/loader-utils/node_modules/json5/package.json deleted file mode 100644 index ec68d1c58..000000000 --- a/node_modules/loader-utils/node_modules/json5/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "json5", - "version": "2.2.1", - "description": "JSON for humans.", - "main": "lib/index.js", - "module": "dist/index.mjs", - "bin": "lib/cli.js", - "browser": "dist/index.js", - "types": "lib/index.d.ts", - "files": [ - "lib/", - "dist/" - ], - "engines": { - "node": ">=6" - }, - "scripts": { - "build": "rollup -c", - "build-package": "node build/package.js", - "build-unicode": "node build/unicode.js", - "coverage": "tap --coverage-report html test", - "lint": "eslint --fix .", - "prepublishOnly": "npm run production", - "preversion": "npm run production", - "production": "npm run lint && npm test && npm run build", - "test": "tap -Rspec --100 test", - "version": "npm run build-package && git add package.json5" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/json5/json5.git" - }, - "keywords": [ - "json", - "json5", - "es5", - "es2015", - "ecmascript" - ], - "author": "Aseem Kishore ", - "contributors": [ - "Max Nanasy ", - "Andrew Eisenberg ", - "Jordan Tucker " - ], - "license": "MIT", - "bugs": { - "url": "https://github.com/json5/json5/issues" - }, - "homepage": "http://json5.org/", - "devDependencies": { - "core-js": "^2.6.5", - "eslint": "^5.15.3", - "eslint-config-standard": "^12.0.0", - "eslint-plugin-import": "^2.16.0", - "eslint-plugin-node": "^8.0.1", - "eslint-plugin-promise": "^4.0.1", - "eslint-plugin-standard": "^4.0.0", - "regenerate": "^1.4.0", - "rollup": "^0.64.1", - "rollup-plugin-buble": "^0.19.6", - "rollup-plugin-commonjs": "^9.2.1", - "rollup-plugin-node-resolve": "^3.4.0", - "rollup-plugin-terser": "^1.0.1", - "sinon": "^6.3.5", - "tap": "^12.6.0", - "unicode-10.0.0": "^0.7.5" - } -} diff --git a/node_modules/loader-utils/package.json b/node_modules/loader-utils/package.json deleted file mode 100644 index 7c357c9dc..000000000 --- a/node_modules/loader-utils/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "loader-utils", - "version": "2.0.2", - "author": "Tobias Koppers @sokra", - "description": "utils for webpack loaders", - "dependencies": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - }, - "scripts": { - "lint": "eslint lib test", - "pretest": "yarn lint", - "test": "jest", - "test:ci": "jest --coverage", - "release": "yarn test && standard-version" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/webpack/loader-utils.git" - }, - "engines": { - "node": ">=8.9.0" - }, - "devDependencies": { - "coveralls": "^3.0.9", - "eslint": "^6.8.0", - "eslint-plugin-node": "^11.0.0", - "eslint-plugin-prettier": "^3.1.2", - "jest": "^25.1.0", - "prettier": "^1.19.1", - "standard-version": "^7.1.0" - }, - "main": "lib/index.js", - "files": [ - "lib" - ] -} diff --git a/node_modules/merge2/LICENSE b/node_modules/merge2/LICENSE deleted file mode 100644 index 31dd9c722..000000000 --- a/node_modules/merge2/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014-2020 Teambition - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/node_modules/merge2/README.md b/node_modules/merge2/README.md deleted file mode 100644 index 27f8eb99a..000000000 --- a/node_modules/merge2/README.md +++ /dev/null @@ -1,144 +0,0 @@ -# merge2 - -Merge multiple streams into one stream in sequence or parallel. - -[![NPM version][npm-image]][npm-url] -[![Build Status][travis-image]][travis-url] -[![Downloads][downloads-image]][downloads-url] - -## Install - -Install with [npm](https://npmjs.org/package/merge2) - -```sh -npm install merge2 -``` - -## Usage - -```js -const gulp = require('gulp') -const merge2 = require('merge2') -const concat = require('gulp-concat') -const minifyHtml = require('gulp-minify-html') -const ngtemplate = require('gulp-ngtemplate') - -gulp.task('app-js', function () { - return merge2( - gulp.src('static/src/tpl/*.html') - .pipe(minifyHtml({empty: true})) - .pipe(ngtemplate({ - module: 'genTemplates', - standalone: true - }) - ), gulp.src([ - 'static/src/js/app.js', - 'static/src/js/locale_zh-cn.js', - 'static/src/js/router.js', - 'static/src/js/tools.js', - 'static/src/js/services.js', - 'static/src/js/filters.js', - 'static/src/js/directives.js', - 'static/src/js/controllers.js' - ]) - ) - .pipe(concat('app.js')) - .pipe(gulp.dest('static/dist/js/')) -}) -``` - -```js -const stream = merge2([stream1, stream2], stream3, {end: false}) -//... -stream.add(stream4, stream5) -//.. -stream.end() -``` - -```js -// equal to merge2([stream1, stream2], stream3) -const stream = merge2() -stream.add([stream1, stream2]) -stream.add(stream3) -``` - -```js -// merge order: -// 1. merge `stream1`; -// 2. merge `stream2` and `stream3` in parallel after `stream1` merged; -// 3. merge 'stream4' after `stream2` and `stream3` merged; -const stream = merge2(stream1, [stream2, stream3], stream4) - -// merge order: -// 1. merge `stream5` and `stream6` in parallel after `stream4` merged; -// 2. merge 'stream7' after `stream5` and `stream6` merged; -stream.add([stream5, stream6], stream7) -``` - -```js -// nest merge -// equal to merge2(stream1, stream2, stream6, stream3, [stream4, stream5]); -const streamA = merge2(stream1, stream2) -const streamB = merge2(stream3, [stream4, stream5]) -const stream = merge2(streamA, streamB) -streamA.add(stream6) -``` - -## API - -```js -const merge2 = require('merge2') -``` - -### merge2() - -### merge2(options) - -### merge2(stream1, stream2, ..., streamN) - -### merge2(stream1, stream2, ..., streamN, options) - -### merge2(stream1, [stream2, stream3, ...], streamN, options) - -return a duplex stream (mergedStream). streams in array will be merged in parallel. - -### mergedStream.add(stream) - -### mergedStream.add(stream1, [stream2, stream3, ...], ...) - -return the mergedStream. - -### mergedStream.on('queueDrain', function() {}) - -It will emit 'queueDrain' when all streams merged. If you set `end === false` in options, this event give you a notice that should add more streams to merge or end the mergedStream. - -#### stream - -*option* -Type: `Readable` or `Duplex` or `Transform` stream. - -#### options - -*option* -Type: `Object`. - -* **end** - `Boolean` - if `end === false` then mergedStream will not be auto ended, you should end by yourself. **Default:** `undefined` - -* **pipeError** - `Boolean` - if `pipeError === true` then mergedStream will emit `error` event from source streams. **Default:** `undefined` - -* **objectMode** - `Boolean` . **Default:** `true` - -`objectMode` and other options(`highWaterMark`, `defaultEncoding` ...) is same as Node.js `Stream`. - -## License - -MIT © [Teambition](https://www.teambition.com) - -[npm-url]: https://npmjs.org/package/merge2 -[npm-image]: http://img.shields.io/npm/v/merge2.svg - -[travis-url]: https://travis-ci.org/teambition/merge2 -[travis-image]: http://img.shields.io/travis/teambition/merge2.svg - -[downloads-url]: https://npmjs.org/package/merge2 -[downloads-image]: http://img.shields.io/npm/dm/merge2.svg?style=flat-square diff --git a/node_modules/merge2/index.js b/node_modules/merge2/index.js deleted file mode 100644 index 78a61edf0..000000000 --- a/node_modules/merge2/index.js +++ /dev/null @@ -1,144 +0,0 @@ -'use strict' -/* - * merge2 - * https://github.com/teambition/merge2 - * - * Copyright (c) 2014-2020 Teambition - * Licensed under the MIT license. - */ -const Stream = require('stream') -const PassThrough = Stream.PassThrough -const slice = Array.prototype.slice - -module.exports = merge2 - -function merge2 () { - const streamsQueue = [] - const args = slice.call(arguments) - let merging = false - let options = args[args.length - 1] - - if (options && !Array.isArray(options) && options.pipe == null) { - args.pop() - } else { - options = {} - } - - const doEnd = options.end !== false - const doPipeError = options.pipeError === true - if (options.objectMode == null) { - options.objectMode = true - } - if (options.highWaterMark == null) { - options.highWaterMark = 64 * 1024 - } - const mergedStream = PassThrough(options) - - function addStream () { - for (let i = 0, len = arguments.length; i < len; i++) { - streamsQueue.push(pauseStreams(arguments[i], options)) - } - mergeStream() - return this - } - - function mergeStream () { - if (merging) { - return - } - merging = true - - let streams = streamsQueue.shift() - if (!streams) { - process.nextTick(endStream) - return - } - if (!Array.isArray(streams)) { - streams = [streams] - } - - let pipesCount = streams.length + 1 - - function next () { - if (--pipesCount > 0) { - return - } - merging = false - mergeStream() - } - - function pipe (stream) { - function onend () { - stream.removeListener('merge2UnpipeEnd', onend) - stream.removeListener('end', onend) - if (doPipeError) { - stream.removeListener('error', onerror) - } - next() - } - function onerror (err) { - mergedStream.emit('error', err) - } - // skip ended stream - if (stream._readableState.endEmitted) { - return next() - } - - stream.on('merge2UnpipeEnd', onend) - stream.on('end', onend) - - if (doPipeError) { - stream.on('error', onerror) - } - - stream.pipe(mergedStream, { end: false }) - // compatible for old stream - stream.resume() - } - - for (let i = 0; i < streams.length; i++) { - pipe(streams[i]) - } - - next() - } - - function endStream () { - merging = false - // emit 'queueDrain' when all streams merged. - mergedStream.emit('queueDrain') - if (doEnd) { - mergedStream.end() - } - } - - mergedStream.setMaxListeners(0) - mergedStream.add = addStream - mergedStream.on('unpipe', function (stream) { - stream.emit('merge2UnpipeEnd') - }) - - if (args.length) { - addStream.apply(null, args) - } - return mergedStream -} - -// check and pause streams for pipe. -function pauseStreams (streams, options) { - if (!Array.isArray(streams)) { - // Backwards-compat with old-style streams - if (!streams._readableState && streams.pipe) { - streams = streams.pipe(PassThrough(options)) - } - if (!streams._readableState || !streams.pause || !streams.pipe) { - throw new Error('Only readable stream can be merged.') - } - streams.pause() - } else { - for (let i = 0, len = streams.length; i < len; i++) { - streams[i] = pauseStreams(streams[i], options) - } - } - return streams -} diff --git a/node_modules/merge2/package.json b/node_modules/merge2/package.json deleted file mode 100644 index 7777307fd..000000000 --- a/node_modules/merge2/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "merge2", - "description": "Merge multiple streams into one stream in sequence or parallel.", - "authors": [ - "Yan Qing " - ], - "license": "MIT", - "version": "1.4.1", - "main": "./index.js", - "repository": { - "type": "git", - "url": "git@github.com:teambition/merge2.git" - }, - "homepage": "https://github.com/teambition/merge2", - "keywords": [ - "merge2", - "multiple", - "sequence", - "parallel", - "merge", - "stream", - "merge stream", - "sync" - ], - "engines": { - "node": ">= 8" - }, - "dependencies": {}, - "devDependencies": { - "standard": "^14.3.4", - "through2": "^3.0.1", - "thunks": "^4.9.6", - "tman": "^1.10.0", - "to-through": "^2.0.0" - }, - "scripts": { - "test": "standard && tman" - }, - "files": [ - "README.md", - "index.js" - ] -} diff --git a/node_modules/rechoir/CHANGELOG.md b/node_modules/rechoir/CHANGELOG.md new file mode 100644 index 000000000..79d18d780 --- /dev/null +++ b/node_modules/rechoir/CHANGELOG.md @@ -0,0 +1,12 @@ +# Changelog + +## [0.8.0](https://www.github.com/gulpjs/rechoir/compare/v0.7.1...v0.8.0) (2021-07-24) + + +### ⚠ BREAKING CHANGES + +* Normalize repository, dropping node <10.13 support (#40) + +### Miscellaneous Chores + +* Normalize repository, dropping node <10.13 support ([#40](https://www.github.com/gulpjs/rechoir/issues/40)) ([00f5968](https://www.github.com/gulpjs/rechoir/commit/00f59689d0eb9668d939a85e06428a0906587a6f)) diff --git a/node_modules/rechoir/LICENSE b/node_modules/rechoir/LICENSE index 41ed30030..4f9252379 100644 --- a/node_modules/rechoir/LICENSE +++ b/node_modules/rechoir/LICENSE @@ -1,24 +1,21 @@ The MIT License (MIT) -Copyright (c) 2014-2019 Tyler Kellen , Blaine Bublitz , and Eric Schoffstall +Copyright (c) 2014-2019, 2021 Tyler Kellen , Blaine Bublitz , and Eric Schoffstall -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/rechoir/README.md b/node_modules/rechoir/README.md index cf96e4f78..6e65abbd4 100644 --- a/node_modules/rechoir/README.md +++ b/node_modules/rechoir/README.md @@ -6,24 +6,16 @@ # rechoir -[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Travis Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url] +[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][ci-image]][ci-url] [![Coveralls Status][coveralls-image]][coveralls-url] Prepare a node environment to require files with different extensions. ## What is it? -This module, in conjunction with [interpret]-like objects, can register any filetype the npm ecosystem has a module loader for. This library is a dependency of [Liftoff]. +This module, in conjunction with [interpret]-like objects, can register any filetype the npm ecosystem has a module loader for. This library is a dependency of [liftoff]. **Note:** While `rechoir` will automatically load and register transpilers like `coffee-script`, you must provide a local installation. The transpilers are **not** bundled with this module. - -## rechoir for enterprise - -Available as part of the Tidelift Subscription - -The maintainers of rechoir and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-rechoir?utm_source=npm-rechoir&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - - ## Usage ```js @@ -42,13 +34,13 @@ console.log(require('./test/fixtures/test.toml')); ### `prepare(config, filepath, [cwd], [noThrow])` -Look for a module loader associated with the provided file and attempt require it. If necessary, run any setup required to inject it into [require.extensions](http://nodejs.org/api/globals.html#globals_require_extensions). +Look for a module loader associated with the provided file and attempt require it. If necessary, run any setup required to inject it into [require.extensions]. `config` An [interpret]-like configuration object. `filepath` A file whose type you'd like to register a module loader for. -`cwd` An optional path to start searching for the module required to load the requested file. Defaults to the directory of `filepath`. +`cwd` An optional path to start searching for the module required to load the requested file. Defaults to the directory of `filepath`. `noThrow` An optional boolean indicating if the method should avoid throwing. @@ -62,22 +54,20 @@ If a loader is already registered, this will simply return `true`. MIT -[interpret]: http://github.com/gulpjs/interpret -[Liftoff]: http://github.com/gulpjs/liftoff - -[downloads-image]: http://img.shields.io/npm/dm/rechoir.svg + +[downloads-image]: https://img.shields.io/npm/dm/rechoir.svg?style=flat-square [npm-url]: https://www.npmjs.com/package/rechoir -[npm-image]: http://img.shields.io/npm/v/rechoir.svg - -[travis-url]: https://travis-ci.org/gulpjs/rechoir -[travis-image]: http://img.shields.io/travis/gulpjs/rechoir.svg?label=travis-ci +[npm-image]: https://img.shields.io/npm/v/rechoir.svg?style=flat-square -[appveyor-url]: https://ci.appveyor.com/project/gulpjs/rechoir -[appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/rechoir.svg?label=appveyor +[ci-url]: https://github.com/gulpjs/rechoir/actions?query=workflow:dev +[ci-image]: https://img.shields.io/github/workflow/status/gulpjs/rechoir/dev?style=flat-square [coveralls-url]: https://coveralls.io/r/gulpjs/rechoir -[coveralls-image]: http://img.shields.io/coveralls/gulpjs/rechoir/master.svg - -[gitter-url]: https://gitter.im/gulpjs/gulp -[gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg - +[coveralls-image]: https://img.shields.io/coveralls/gulpjs/rechoir/master.svg + + + +[interpret]: https://github.com/gulpjs/interpret +[require.extensions]: https://nodejs.org/api/modules.html#modules_require_extensions +[liftoff]: https://github.com/js-cli/js-liftoff + diff --git a/node_modules/rechoir/index.js b/node_modules/rechoir/index.js index eb9ec7056..cc76ae310 100644 --- a/node_modules/rechoir/index.js +++ b/node_modules/rechoir/index.js @@ -4,14 +4,14 @@ var extension = require('./lib/extension'); var normalize = require('./lib/normalize'); var register = require('./lib/register'); -exports.prepare = function(extensions, filepath, cwd, nothrow) { +exports.prepare = function (extensions, filepath, cwd, nothrow) { var config, usedExtension, err, option, attempt, error; var attempts = []; var onlyErrors = true; var exts = extension(filepath); if (exts) { - exts.some(function(ext) { + exts.some(function (ext) { usedExtension = ext; config = normalize(extensions[ext]); return !!config; @@ -40,7 +40,7 @@ exports.prepare = function(extensions, filepath, cwd, nothrow) { for (var i in config) { option = config[i]; attempt = register(cwd, option.module, option.register); - error = (attempt instanceof Error) ? attempt : null; + error = attempt instanceof Error ? attempt : null; if (error) { attempt = null; } @@ -55,7 +55,9 @@ exports.prepare = function(extensions, filepath, cwd, nothrow) { } } if (onlyErrors) { - err = new Error('Unable to use specified module loaders for "' + usedExtension + '".'); + err = new Error( + 'Unable to use specified module loaders for "' + usedExtension + '".' + ); err.failures = attempts; if (nothrow) { return err; diff --git a/node_modules/rechoir/lib/extension.js b/node_modules/rechoir/lib/extension.js index cc8070d95..6fe5613b9 100644 --- a/node_modules/rechoir/lib/extension.js +++ b/node_modules/rechoir/lib/extension.js @@ -7,7 +7,7 @@ function getLongExtension(basename) { return null; } - var startIndex = (basename[0] === '.') ? 1 : 0; + var startIndex = basename[0] === '.' ? 1 : 0; var dotIndex = basename.indexOf('.', startIndex); if (dotIndex <= startIndex) { @@ -34,7 +34,7 @@ function getPossibleExtensions(longExtension) { return arr; } -module.exports = function(input) { +module.exports = function (input) { var basename = path.basename(input); var longExtension = getLongExtension(basename); if (!longExtension) { diff --git a/node_modules/rechoir/lib/normalize.js b/node_modules/rechoir/lib/normalize.js index 7e974f6dd..af1122f11 100644 --- a/node_modules/rechoir/lib/normalize.js +++ b/node_modules/rechoir/lib/normalize.js @@ -5,7 +5,7 @@ function normalizer(config) { return config; } -module.exports = function(config) { +module.exports = function (config) { if (Array.isArray(config)) { return config.map(normalizer); } diff --git a/node_modules/rechoir/lib/register.js b/node_modules/rechoir/lib/register.js index f5d233659..843e8ad6d 100644 --- a/node_modules/rechoir/lib/register.js +++ b/node_modules/rechoir/lib/register.js @@ -1,6 +1,6 @@ var resolve = require('resolve'); -module.exports = function(cwd, moduleName, register) { +module.exports = function (cwd, moduleName, register) { var result; try { var modulePath = resolve.sync(moduleName, { basedir: cwd }); diff --git a/node_modules/rechoir/package.json b/node_modules/rechoir/package.json index 00d125c63..9dad49e22 100644 --- a/node_modules/rechoir/package.json +++ b/node_modules/rechoir/package.json @@ -1,6 +1,6 @@ { "name": "rechoir", - "version": "0.7.1", + "version": "0.8.0", "description": "Prepare a node environment to require files with different extensions.", "author": "Gulp Team (http://gulpjs.com/)", "contributors": [ @@ -10,7 +10,7 @@ "repository": "gulpjs/rechoir", "license": "MIT", "engines": { - "node": ">= 0.10" + "node": ">= 10.13.0" }, "main": "index.js", "files": [ @@ -21,20 +21,26 @@ "scripts": { "lint": "eslint .", "pretest": "rm -rf tmp/ && npm run lint", - "test": "mocha --async-only test test/lib", - "cover": "istanbul cover _mocha --report lcovonly test test/lib", - "coveralls": "npm run cover && istanbul-coveralls" + "test": "nyc mocha --async-only" }, "dependencies": { - "resolve": "^1.9.0" + "resolve": "^1.20.0" }, "devDependencies": { - "eslint": "^2.13.0", - "eslint-config-gulp": "^3.0.1", - "expect": "^1.20.2", - "istanbul": "^0.4.3", - "istanbul-coveralls": "^1.0.3", - "mocha": "^3.5.3" + "eslint": "^7.21.0", + "eslint-config-gulp": "^5.0.1", + "expect": "^27.0.0", + "mocha": "^8.3.0", + "nyc": "^15.1.0" + }, + "nyc": { + "reporter": [ + "lcov", + "text-summary" + ] + }, + "prettier": { + "singleQuote": true }, "keywords": [ "require", diff --git a/node_modules/require-from-string/index.js b/node_modules/require-from-string/index.js new file mode 100644 index 000000000..cb5595fde --- /dev/null +++ b/node_modules/require-from-string/index.js @@ -0,0 +1,34 @@ +'use strict'; + +var Module = require('module'); +var path = require('path'); + +module.exports = function requireFromString(code, filename, opts) { + if (typeof filename === 'object') { + opts = filename; + filename = undefined; + } + + opts = opts || {}; + filename = filename || ''; + + opts.appendPaths = opts.appendPaths || []; + opts.prependPaths = opts.prependPaths || []; + + if (typeof code !== 'string') { + throw new Error('code must be a string, not ' + typeof code); + } + + var paths = Module._nodeModulePaths(path.dirname(filename)); + + var parent = module.parent; + var m = new Module(filename, parent); + m.filename = filename; + m.paths = [].concat(opts.prependPaths).concat(paths).concat(opts.appendPaths); + m._compile(code, filename); + + var exports = m.exports; + parent && parent.children && parent.children.splice(parent.children.indexOf(m), 1); + + return exports; +}; diff --git a/node_modules/require-from-string/license b/node_modules/require-from-string/license new file mode 100644 index 000000000..1aeb74fd2 --- /dev/null +++ b/node_modules/require-from-string/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Vsevolod Strukchinsky (github.com/floatdrop) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/require-from-string/package.json b/node_modules/require-from-string/package.json new file mode 100644 index 000000000..800d46efc --- /dev/null +++ b/node_modules/require-from-string/package.json @@ -0,0 +1,28 @@ +{ + "name": "require-from-string", + "version": "2.0.2", + "description": "Require module from string", + "license": "MIT", + "repository": "floatdrop/require-from-string", + "author": { + "name": "Vsevolod Strukchinsky", + "email": "floatdrop@gmail.com", + "url": "github.com/floatdrop" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "" + ], + "dependencies": {}, + "devDependencies": { + "mocha": "*" + } +} diff --git a/node_modules/require-from-string/readme.md b/node_modules/require-from-string/readme.md new file mode 100644 index 000000000..88b3236f8 --- /dev/null +++ b/node_modules/require-from-string/readme.md @@ -0,0 +1,56 @@ +# require-from-string [![Build Status](https://travis-ci.org/floatdrop/require-from-string.svg?branch=master)](https://travis-ci.org/floatdrop/require-from-string) + +Load module from string in Node. + +## Install + +``` +$ npm install --save require-from-string +``` + + +## Usage + +```js +var requireFromString = require('require-from-string'); + +requireFromString('module.exports = 1'); +//=> 1 +``` + + +## API + +### requireFromString(code, [filename], [options]) + +#### code + +*Required* +Type: `string` + +Module code. + +#### filename +Type: `string` +Default: `''` + +Optional filename. + + +#### options +Type: `object` + +##### appendPaths +Type: `Array` + +List of `paths`, that will be appended to module `paths`. Useful, when you want +to be able require modules from these paths. + +##### prependPaths +Type: `Array` + +Same as `appendPaths`, but paths will be prepended. + +## License + +MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop) diff --git a/node_modules/babel-loader/node_modules/schema-utils/LICENSE b/node_modules/schema-utils/LICENSE similarity index 100% rename from node_modules/babel-loader/node_modules/schema-utils/LICENSE rename to node_modules/schema-utils/LICENSE diff --git a/node_modules/schema-utils/README.md b/node_modules/schema-utils/README.md new file mode 100644 index 000000000..b56ab0201 --- /dev/null +++ b/node_modules/schema-utils/README.md @@ -0,0 +1,290 @@ + + +[![npm][npm]][npm-url] +[![node][node]][node-url] +[![deps][deps]][deps-url] +[![tests][tests]][tests-url] +[![coverage][cover]][cover-url] +[![chat][chat]][chat-url] +[![size][size]][size-url] + +# schema-utils + +Package for validate options in loaders and plugins. + +## Getting Started + +To begin, you'll need to install `schema-utils`: + +```console +npm install schema-utils +``` + +## API + +**schema.json** + +```json +{ + "type": "object", + "properties": { + "option": { + "type": "boolean" + } + }, + "additionalProperties": false +} +``` + +```js +import schema from "./path/to/schema.json"; +import { validate } from "schema-utils"; + +const options = { option: true }; +const configuration = { name: "Loader Name/Plugin Name/Name" }; + +validate(schema, options, configuration); +``` + +### `schema` + +Type: `String` + +JSON schema. + +Simple example of schema: + +```json +{ + "type": "object", + "properties": { + "name": { + "description": "This is description of option.", + "type": "string" + } + }, + "additionalProperties": false +} +``` + +### `options` + +Type: `Object` + +Object with options. + +```js +import schema from "./path/to/schema.json"; +import { validate } from "schema-utils"; + +const options = { foo: "bar" }; + +validate(schema, { name: 123 }, { name: "MyPlugin" }); +``` + +### `configuration` + +Allow to configure validator. + +There is an alternative method to configure the `name` and`baseDataPath` options via the `title` property in the schema. +For example: + +```json +{ + "title": "My Loader options", + "type": "object", + "properties": { + "name": { + "description": "This is description of option.", + "type": "string" + } + }, + "additionalProperties": false +} +``` + +The last word used for the `baseDataPath` option, other words used for the `name` option. +Based on the example above the `name` option equals `My Loader`, the `baseDataPath` option equals `options`. + +#### `name` + +Type: `Object` +Default: `"Object"` + +Allow to setup name in validation errors. + +```js +import schema from "./path/to/schema.json"; +import { validate } from "schema-utils"; + +const options = { foo: "bar" }; + +validate(schema, options, { name: "MyPlugin" }); +``` + +```shell +Invalid configuration object. MyPlugin has been initialised using a configuration object that does not match the API schema. + - configuration.optionName should be a integer. +``` + +#### `baseDataPath` + +Type: `String` +Default: `"configuration"` + +Allow to setup base data path in validation errors. + +```js +import schema from "./path/to/schema.json"; +import { validate } from "schema-utils"; + +const options = { foo: "bar" }; + +validate(schema, options, { name: "MyPlugin", baseDataPath: "options" }); +``` + +```shell +Invalid options object. MyPlugin has been initialised using an options object that does not match the API schema. + - options.optionName should be a integer. +``` + +#### `postFormatter` + +Type: `Function` +Default: `undefined` + +Allow to reformat errors. + +```js +import schema from "./path/to/schema.json"; +import { validate } from "schema-utils"; + +const options = { foo: "bar" }; + +validate(schema, options, { + name: "MyPlugin", + postFormatter: (formattedError, error) => { + if (error.keyword === "type") { + return `${formattedError}\nAdditional Information.`; + } + + return formattedError; + }, +}); +``` + +```shell +Invalid options object. MyPlugin has been initialized using an options object that does not match the API schema. + - options.optionName should be a integer. + Additional Information. +``` + +## Examples + +**schema.json** + +```json +{ + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "test": { + "anyOf": [ + { "type": "array" }, + { "type": "string" }, + { "instanceof": "RegExp" } + ] + }, + "transform": { + "instanceof": "Function" + }, + "sourceMap": { + "type": "boolean" + } + }, + "additionalProperties": false +} +``` + +### `Loader` + +```js +import { getOptions } from "loader-utils"; +import { validate } from "schema-utils"; + +import schema from "path/to/schema.json"; + +function loader(src, map) { + const options = getOptions(this); + + validate(schema, options, { + name: "Loader Name", + baseDataPath: "options", + }); + + // Code... +} + +export default loader; +``` + +### `Plugin` + +```js +import { validate } from "schema-utils"; + +import schema from "path/to/schema.json"; + +class Plugin { + constructor(options) { + validate(schema, options, { + name: "Plugin Name", + baseDataPath: "options", + }); + + this.options = options; + } + + apply(compiler) { + // Code... + } +} + +export default Plugin; +``` + +## Contributing + +Please take a moment to read our contributing guidelines if you haven't yet done so. + +[CONTRIBUTING](./.github/CONTRIBUTING.md) + +## License + +[MIT](./LICENSE) + +[npm]: https://img.shields.io/npm/v/schema-utils.svg +[npm-url]: https://npmjs.com/package/schema-utils +[node]: https://img.shields.io/node/v/schema-utils.svg +[node-url]: https://nodejs.org +[deps]: https://david-dm.org/webpack/schema-utils.svg +[deps-url]: https://david-dm.org/webpack/schema-utils +[tests]: https://github.com/webpack/schema-utils/workflows/schema-utils/badge.svg +[tests-url]: https://github.com/webpack/schema-utils/actions +[cover]: https://codecov.io/gh/webpack/schema-utils/branch/master/graph/badge.svg +[cover-url]: https://codecov.io/gh/webpack/schema-utils +[chat]: https://badges.gitter.im/webpack/webpack.svg +[chat-url]: https://gitter.im/webpack/webpack +[size]: https://packagephobia.com/badge?p=schema-utils +[size-url]: https://packagephobia.com/result?p=schema-utils diff --git a/node_modules/schema-utils/declarations/ValidationError.d.ts b/node_modules/schema-utils/declarations/ValidationError.d.ts new file mode 100644 index 000000000..55a8a9a19 --- /dev/null +++ b/node_modules/schema-utils/declarations/ValidationError.d.ts @@ -0,0 +1,74 @@ +export default ValidationError; +export type JSONSchema6 = import("json-schema").JSONSchema6; +export type JSONSchema7 = import("json-schema").JSONSchema7; +export type Schema = import("./validate").Schema; +export type ValidationErrorConfiguration = + import("./validate").ValidationErrorConfiguration; +export type PostFormatter = import("./validate").PostFormatter; +export type SchemaUtilErrorObject = import("./validate").SchemaUtilErrorObject; +declare class ValidationError extends Error { + /** + * @param {Array} errors + * @param {Schema} schema + * @param {ValidationErrorConfiguration} configuration + */ + constructor( + errors: Array, + schema: Schema, + configuration?: ValidationErrorConfiguration + ); + /** @type {Array} */ + errors: Array; + /** @type {Schema} */ + schema: Schema; + /** @type {string} */ + headerName: string; + /** @type {string} */ + baseDataPath: string; + /** @type {PostFormatter | null} */ + postFormatter: PostFormatter | null; + /** + * @param {string} path + * @returns {Schema} + */ + getSchemaPart(path: string): Schema; + /** + * @param {Schema} schema + * @param {boolean} logic + * @param {Array} prevSchemas + * @returns {string} + */ + formatSchema( + schema: Schema, + logic?: boolean, + prevSchemas?: Array + ): string; + /** + * @param {Schema=} schemaPart + * @param {(boolean | Array)=} additionalPath + * @param {boolean=} needDot + * @param {boolean=} logic + * @returns {string} + */ + getSchemaPartText( + schemaPart?: Schema | undefined, + additionalPath?: (boolean | Array) | undefined, + needDot?: boolean | undefined, + logic?: boolean | undefined + ): string; + /** + * @param {Schema=} schemaPart + * @returns {string} + */ + getSchemaPartDescription(schemaPart?: Schema | undefined): string; + /** + * @param {SchemaUtilErrorObject} error + * @returns {string} + */ + formatValidationError(error: SchemaUtilErrorObject): string; + /** + * @param {Array} errors + * @returns {string} + */ + formatValidationErrors(errors: Array): string; +} diff --git a/node_modules/schema-utils/declarations/index.d.ts b/node_modules/schema-utils/declarations/index.d.ts new file mode 100644 index 000000000..df5ec27c0 --- /dev/null +++ b/node_modules/schema-utils/declarations/index.d.ts @@ -0,0 +1,3 @@ +import { validate } from "./validate"; +import { ValidationError } from "./validate"; +export { validate, ValidationError }; diff --git a/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts b/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts new file mode 100644 index 000000000..41a54c087 --- /dev/null +++ b/node_modules/schema-utils/declarations/keywords/absolutePath.d.ts @@ -0,0 +1,11 @@ +export default addAbsolutePathKeyword; +export type Ajv = import("ajv").default; +export type SchemaValidateFunction = import("ajv").SchemaValidateFunction; +export type AnySchemaObject = import("ajv").AnySchemaObject; +export type SchemaUtilErrorObject = import("../validate").SchemaUtilErrorObject; +/** + * + * @param {Ajv} ajv + * @returns {Ajv} + */ +declare function addAbsolutePathKeyword(ajv: Ajv): Ajv; diff --git a/node_modules/babel-loader/node_modules/schema-utils/declarations/util/Range.d.ts b/node_modules/schema-utils/declarations/util/Range.d.ts similarity index 87% rename from node_modules/babel-loader/node_modules/schema-utils/declarations/util/Range.d.ts rename to node_modules/schema-utils/declarations/util/Range.d.ts index d28de3837..2ba97fc1a 100644 --- a/node_modules/babel-loader/node_modules/schema-utils/declarations/util/Range.d.ts +++ b/node_modules/schema-utils/declarations/util/Range.d.ts @@ -14,9 +14,9 @@ declare class Range { * @returns {">" | ">=" | "<" | "<="} */ static getOperator( - side: 'left' | 'right', + side: "left" | "right", exclusive: boolean - ): '>' | '>=' | '<' | '<='; + ): ">" | ">=" | "<" | "<="; /** * @param {number} value * @param {boolean} logic is not logic applied @@ -51,14 +51,11 @@ declare class Range { * @param {boolean} logic is not logic applied * @return {RangeValue} computed value and it's exclusive flag */ - static getRangeValue( - values: Array<[number, boolean]>, - logic: boolean - ): [number, boolean]; + static getRangeValue(values: Array, logic: boolean): RangeValue; /** @type {Array} */ - _left: Array<[number, boolean]>; + _left: Array; /** @type {Array} */ - _right: Array<[number, boolean]>; + _right: Array; /** * @param {number} value * @param {boolean=} exclusive @@ -79,4 +76,4 @@ declare namespace Range { export { RangeValue, RangeValueCallback }; } type RangeValue = [number, boolean]; -type RangeValueCallback = (rangeValue: [number, boolean]) => boolean; +type RangeValueCallback = (rangeValue: RangeValue) => boolean; diff --git a/node_modules/schema-utils/declarations/util/hints.d.ts b/node_modules/schema-utils/declarations/util/hints.d.ts new file mode 100644 index 000000000..e43e32a22 --- /dev/null +++ b/node_modules/schema-utils/declarations/util/hints.d.ts @@ -0,0 +1,3 @@ +export function stringHints(schema: Schema, logic: boolean): string[]; +export function numberHints(schema: Schema, logic: boolean): string[]; +export type Schema = import("../validate").Schema; diff --git a/node_modules/schema-utils/declarations/validate.d.ts b/node_modules/schema-utils/declarations/validate.d.ts new file mode 100644 index 000000000..70cc5d4b6 --- /dev/null +++ b/node_modules/schema-utils/declarations/validate.d.ts @@ -0,0 +1,37 @@ +export type JSONSchema4 = import("json-schema").JSONSchema4; +export type JSONSchema6 = import("json-schema").JSONSchema6; +export type JSONSchema7 = import("json-schema").JSONSchema7; +export type ErrorObject = import("ajv").ErrorObject; +export type Extend = { + formatMinimum?: string | undefined; + formatMaximum?: string | undefined; + formatExclusiveMinimum?: string | undefined; + formatExclusiveMaximum?: string | undefined; + link?: string | undefined; +}; +export type Schema = (JSONSchema4 | JSONSchema6 | JSONSchema7) & Extend; +export type SchemaUtilErrorObject = ErrorObject & { + children?: Array; +}; +export type PostFormatter = ( + formattedError: string, + error: SchemaUtilErrorObject +) => string; +export type ValidationErrorConfiguration = { + name?: string | undefined; + baseDataPath?: string | undefined; + postFormatter?: PostFormatter | undefined; +}; +/** + * @param {Schema} schema + * @param {Array | object} options + * @param {ValidationErrorConfiguration=} configuration + * @returns {void} + */ +export function validate( + schema: Schema, + options: Array | object, + configuration?: ValidationErrorConfiguration | undefined +): void; +import ValidationError from "./ValidationError"; +export { ValidationError }; diff --git a/node_modules/schema-utils/dist/ValidationError.js b/node_modules/schema-utils/dist/ValidationError.js new file mode 100644 index 000000000..e3d2413b5 --- /dev/null +++ b/node_modules/schema-utils/dist/ValidationError.js @@ -0,0 +1,1267 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = void 0; + +const { + stringHints, + numberHints +} = require("./util/hints"); +/** @typedef {import("json-schema").JSONSchema6} JSONSchema6 */ + +/** @typedef {import("json-schema").JSONSchema7} JSONSchema7 */ + +/** @typedef {import("./validate").Schema} Schema */ + +/** @typedef {import("./validate").ValidationErrorConfiguration} ValidationErrorConfiguration */ + +/** @typedef {import("./validate").PostFormatter} PostFormatter */ + +/** @typedef {import("./validate").SchemaUtilErrorObject} SchemaUtilErrorObject */ + +/** @enum {number} */ + + +const SPECIFICITY = { + type: 1, + not: 1, + oneOf: 1, + anyOf: 1, + if: 1, + enum: 1, + const: 1, + instanceof: 1, + required: 2, + pattern: 2, + patternRequired: 2, + format: 2, + formatMinimum: 2, + formatMaximum: 2, + minimum: 2, + exclusiveMinimum: 2, + maximum: 2, + exclusiveMaximum: 2, + multipleOf: 2, + uniqueItems: 2, + contains: 2, + minLength: 2, + maxLength: 2, + minItems: 2, + maxItems: 2, + minProperties: 2, + maxProperties: 2, + dependencies: 2, + propertyNames: 2, + additionalItems: 2, + additionalProperties: 2, + absolutePath: 2 +}; +/** + * @param {string} value + * @returns {value is number} + */ + +function isNumeric(value) { + return /^-?\d+$/.test(value); +} +/** + * + * @param {Array} array + * @param {(item: SchemaUtilErrorObject) => number} fn + * @returns {Array} + */ + + +function filterMax(array, fn) { + const evaluatedMax = array.reduce((max, item) => Math.max(max, fn(item)), 0); + return array.filter(item => fn(item) === evaluatedMax); +} +/** + * + * @param {Array} children + * @returns {Array} + */ + + +function filterChildren(children) { + let newChildren = children; + newChildren = filterMax(newChildren, + /** + * + * @param {SchemaUtilErrorObject} error + * @returns {number} + */ + error => error.instancePath ? error.instancePath.length : 0); + newChildren = filterMax(newChildren, + /** + * @param {SchemaUtilErrorObject} error + * @returns {number} + */ + error => SPECIFICITY[ + /** @type {keyof typeof SPECIFICITY} */ + error.keyword] || 2); + return newChildren; +} +/** + * Find all children errors + * @param {Array} children + * @param {Array} schemaPaths + * @return {number} returns index of first child + */ + + +function findAllChildren(children, schemaPaths) { + let i = children.length - 1; + + const predicate = + /** + * @param {string} schemaPath + * @returns {boolean} + */ + schemaPath => children[i].schemaPath.indexOf(schemaPath) !== 0; + + while (i > -1 && !schemaPaths.every(predicate)) { + if (children[i].keyword === "anyOf" || children[i].keyword === "oneOf") { + const refs = extractRefs(children[i]); + const childrenStart = findAllChildren(children.slice(0, i), refs.concat(children[i].schemaPath)); + i = childrenStart - 1; + } else { + i -= 1; + } + } + + return i + 1; +} +/** + * Extracts all refs from schema + * @param {SchemaUtilErrorObject} error + * @return {Array} + */ + + +function extractRefs(error) { + const { + schema + } = error; + + if (!Array.isArray(schema)) { + return []; + } + + return schema.map(({ + $ref + }) => $ref).filter(s => s); +} +/** + * Groups children by their first level parent (assuming that error is root) + * @param {Array} children + * @return {Array} + */ + + +function groupChildrenByFirstChild(children) { + const result = []; + let i = children.length - 1; + + while (i > 0) { + const child = children[i]; + + if (child.keyword === "anyOf" || child.keyword === "oneOf") { + const refs = extractRefs(child); + const childrenStart = findAllChildren(children.slice(0, i), refs.concat(child.schemaPath)); + + if (childrenStart !== i) { + result.push(Object.assign({}, child, { + children: children.slice(childrenStart, i) + })); + i = childrenStart; + } else { + result.push(child); + } + } else { + result.push(child); + } + + i -= 1; + } + + if (i === 0) { + result.push(children[i]); + } + + return result.reverse(); +} +/** + * @param {string} str + * @param {string} prefix + * @returns {string} + */ + + +function indent(str, prefix) { + return str.replace(/\n(?!$)/g, `\n${prefix}`); +} +/** + * @param {Schema} schema + * @returns {schema is (Schema & {not: Schema})} + */ + + +function hasNotInSchema(schema) { + return !!schema.not; +} +/** + * @param {Schema} schema + * @return {Schema} + */ + + +function findFirstTypedSchema(schema) { + if (hasNotInSchema(schema)) { + return findFirstTypedSchema(schema.not); + } + + return schema; +} +/** + * @param {Schema} schema + * @return {boolean} + */ + + +function canApplyNot(schema) { + const typedSchema = findFirstTypedSchema(schema); + return likeNumber(typedSchema) || likeInteger(typedSchema) || likeString(typedSchema) || likeNull(typedSchema) || likeBoolean(typedSchema); +} +/** + * @param {any} maybeObj + * @returns {boolean} + */ + + +function isObject(maybeObj) { + return typeof maybeObj === "object" && maybeObj !== null; +} +/** + * @param {Schema} schema + * @returns {boolean} + */ + + +function likeNumber(schema) { + return schema.type === "number" || typeof schema.minimum !== "undefined" || typeof schema.exclusiveMinimum !== "undefined" || typeof schema.maximum !== "undefined" || typeof schema.exclusiveMaximum !== "undefined" || typeof schema.multipleOf !== "undefined"; +} +/** + * @param {Schema} schema + * @returns {boolean} + */ + + +function likeInteger(schema) { + return schema.type === "integer" || typeof schema.minimum !== "undefined" || typeof schema.exclusiveMinimum !== "undefined" || typeof schema.maximum !== "undefined" || typeof schema.exclusiveMaximum !== "undefined" || typeof schema.multipleOf !== "undefined"; +} +/** + * @param {Schema} schema + * @returns {boolean} + */ + + +function likeString(schema) { + return schema.type === "string" || typeof schema.minLength !== "undefined" || typeof schema.maxLength !== "undefined" || typeof schema.pattern !== "undefined" || typeof schema.format !== "undefined" || typeof schema.formatMinimum !== "undefined" || typeof schema.formatMaximum !== "undefined"; +} +/** + * @param {Schema} schema + * @returns {boolean} + */ + + +function likeBoolean(schema) { + return schema.type === "boolean"; +} +/** + * @param {Schema} schema + * @returns {boolean} + */ + + +function likeArray(schema) { + return schema.type === "array" || typeof schema.minItems === "number" || typeof schema.maxItems === "number" || typeof schema.uniqueItems !== "undefined" || typeof schema.items !== "undefined" || typeof schema.additionalItems !== "undefined" || typeof schema.contains !== "undefined"; +} +/** + * @param {Schema & {patternRequired?: Array}} schema + * @returns {boolean} + */ + + +function likeObject(schema) { + return schema.type === "object" || typeof schema.minProperties !== "undefined" || typeof schema.maxProperties !== "undefined" || typeof schema.required !== "undefined" || typeof schema.properties !== "undefined" || typeof schema.patternProperties !== "undefined" || typeof schema.additionalProperties !== "undefined" || typeof schema.dependencies !== "undefined" || typeof schema.propertyNames !== "undefined" || typeof schema.patternRequired !== "undefined"; +} +/** + * @param {Schema} schema + * @returns {boolean} + */ + + +function likeNull(schema) { + return schema.type === "null"; +} +/** + * @param {string} type + * @returns {string} + */ + + +function getArticle(type) { + if (/^[aeiou]/i.test(type)) { + return "an"; + } + + return "a"; +} +/** + * @param {Schema=} schema + * @returns {string} + */ + + +function getSchemaNonTypes(schema) { + if (!schema) { + return ""; + } + + if (!schema.type) { + if (likeNumber(schema) || likeInteger(schema)) { + return " | should be any non-number"; + } + + if (likeString(schema)) { + return " | should be any non-string"; + } + + if (likeArray(schema)) { + return " | should be any non-array"; + } + + if (likeObject(schema)) { + return " | should be any non-object"; + } + } + + return ""; +} +/** + * @param {Array} hints + * @returns {string} + */ + + +function formatHints(hints) { + return hints.length > 0 ? `(${hints.join(", ")})` : ""; +} +/** + * @param {Schema} schema + * @param {boolean} logic + * @returns {string[]} + */ + + +function getHints(schema, logic) { + if (likeNumber(schema) || likeInteger(schema)) { + return numberHints(schema, logic); + } else if (likeString(schema)) { + return stringHints(schema, logic); + } + + return []; +} + +class ValidationError extends Error { + /** + * @param {Array} errors + * @param {Schema} schema + * @param {ValidationErrorConfiguration} configuration + */ + constructor(errors, schema, configuration = {}) { + super(); + /** @type {string} */ + + this.name = "ValidationError"; + /** @type {Array} */ + + this.errors = errors; + /** @type {Schema} */ + + this.schema = schema; + let headerNameFromSchema; + let baseDataPathFromSchema; + + if (schema.title && (!configuration.name || !configuration.baseDataPath)) { + const splittedTitleFromSchema = schema.title.match(/^(.+) (.+)$/); + + if (splittedTitleFromSchema) { + if (!configuration.name) { + [, headerNameFromSchema] = splittedTitleFromSchema; + } + + if (!configuration.baseDataPath) { + [,, baseDataPathFromSchema] = splittedTitleFromSchema; + } + } + } + /** @type {string} */ + + + this.headerName = configuration.name || headerNameFromSchema || "Object"; + /** @type {string} */ + + this.baseDataPath = configuration.baseDataPath || baseDataPathFromSchema || "configuration"; + /** @type {PostFormatter | null} */ + + this.postFormatter = configuration.postFormatter || null; + const header = `Invalid ${this.baseDataPath} object. ${this.headerName} has been initialized using ${getArticle(this.baseDataPath)} ${this.baseDataPath} object that does not match the API schema.\n`; + /** @type {string} */ + + this.message = `${header}${this.formatValidationErrors(errors)}`; + Error.captureStackTrace(this, this.constructor); + } + /** + * @param {string} path + * @returns {Schema} + */ + + + getSchemaPart(path) { + const newPath = path.split("/"); + let schemaPart = this.schema; + + for (let i = 1; i < newPath.length; i++) { + const inner = schemaPart[ + /** @type {keyof Schema} */ + newPath[i]]; + + if (!inner) { + break; + } + + schemaPart = inner; + } + + return schemaPart; + } + /** + * @param {Schema} schema + * @param {boolean} logic + * @param {Array} prevSchemas + * @returns {string} + */ + + + formatSchema(schema, logic = true, prevSchemas = []) { + let newLogic = logic; + + const formatInnerSchema = + /** + * + * @param {Object} innerSchema + * @param {boolean=} addSelf + * @returns {string} + */ + (innerSchema, addSelf) => { + if (!addSelf) { + return this.formatSchema(innerSchema, newLogic, prevSchemas); + } + + if (prevSchemas.includes(innerSchema)) { + return "(recursive)"; + } + + return this.formatSchema(innerSchema, newLogic, prevSchemas.concat(schema)); + }; + + if (hasNotInSchema(schema) && !likeObject(schema)) { + if (canApplyNot(schema.not)) { + newLogic = !logic; + return formatInnerSchema(schema.not); + } + + const needApplyLogicHere = !schema.not.not; + const prefix = logic ? "" : "non "; + newLogic = !logic; + return needApplyLogicHere ? prefix + formatInnerSchema(schema.not) : formatInnerSchema(schema.not); + } + + if ( + /** @type {Schema & {instanceof: string | Array}} */ + schema.instanceof) { + const { + instanceof: value + } = + /** @type {Schema & {instanceof: string | Array}} */ + schema; + const values = !Array.isArray(value) ? [value] : value; + return values.map( + /** + * @param {string} item + * @returns {string} + */ + item => item === "Function" ? "function" : item).join(" | "); + } + + if (schema.enum) { + return ( + /** @type {Array} */ + schema.enum.map(item => JSON.stringify(item)).join(" | ") + ); + } + + if (typeof schema.const !== "undefined") { + return JSON.stringify(schema.const); + } + + if (schema.oneOf) { + return ( + /** @type {Array} */ + schema.oneOf.map(item => formatInnerSchema(item, true)).join(" | ") + ); + } + + if (schema.anyOf) { + return ( + /** @type {Array} */ + schema.anyOf.map(item => formatInnerSchema(item, true)).join(" | ") + ); + } + + if (schema.allOf) { + return ( + /** @type {Array} */ + schema.allOf.map(item => formatInnerSchema(item, true)).join(" & ") + ); + } + + if ( + /** @type {JSONSchema7} */ + schema.if) { + const { + if: ifValue, + then: thenValue, + else: elseValue + } = + /** @type {JSONSchema7} */ + schema; + return `${ifValue ? `if ${formatInnerSchema(ifValue)}` : ""}${thenValue ? ` then ${formatInnerSchema(thenValue)}` : ""}${elseValue ? ` else ${formatInnerSchema(elseValue)}` : ""}`; + } + + if (schema.$ref) { + return formatInnerSchema(this.getSchemaPart(schema.$ref), true); + } + + if (likeNumber(schema) || likeInteger(schema)) { + const [type, ...hints] = getHints(schema, logic); + const str = `${type}${hints.length > 0 ? ` ${formatHints(hints)}` : ""}`; + return logic ? str : hints.length > 0 ? `non-${type} | ${str}` : `non-${type}`; + } + + if (likeString(schema)) { + const [type, ...hints] = getHints(schema, logic); + const str = `${type}${hints.length > 0 ? ` ${formatHints(hints)}` : ""}`; + return logic ? str : str === "string" ? "non-string" : `non-string | ${str}`; + } + + if (likeBoolean(schema)) { + return `${logic ? "" : "non-"}boolean`; + } + + if (likeArray(schema)) { + // not logic already applied in formatValidationError + newLogic = true; + const hints = []; + + if (typeof schema.minItems === "number") { + hints.push(`should not have fewer than ${schema.minItems} item${schema.minItems > 1 ? "s" : ""}`); + } + + if (typeof schema.maxItems === "number") { + hints.push(`should not have more than ${schema.maxItems} item${schema.maxItems > 1 ? "s" : ""}`); + } + + if (schema.uniqueItems) { + hints.push("should not have duplicate items"); + } + + const hasAdditionalItems = typeof schema.additionalItems === "undefined" || Boolean(schema.additionalItems); + let items = ""; + + if (schema.items) { + if (Array.isArray(schema.items) && schema.items.length > 0) { + items = `${ + /** @type {Array} */ + schema.items.map(item => formatInnerSchema(item)).join(", ")}`; + + if (hasAdditionalItems) { + if (schema.additionalItems && isObject(schema.additionalItems) && Object.keys(schema.additionalItems).length > 0) { + hints.push(`additional items should be ${formatInnerSchema(schema.additionalItems)}`); + } + } + } else if (schema.items && Object.keys(schema.items).length > 0) { + // "additionalItems" is ignored + items = `${formatInnerSchema(schema.items)}`; + } else { + // Fallback for empty `items` value + items = "any"; + } + } else { + // "additionalItems" is ignored + items = "any"; + } + + if (schema.contains && Object.keys(schema.contains).length > 0) { + hints.push(`should contains at least one ${this.formatSchema(schema.contains)} item`); + } + + return `[${items}${hasAdditionalItems ? ", ..." : ""}]${hints.length > 0 ? ` (${hints.join(", ")})` : ""}`; + } + + if (likeObject(schema)) { + // not logic already applied in formatValidationError + newLogic = true; + const hints = []; + + if (typeof schema.minProperties === "number") { + hints.push(`should not have fewer than ${schema.minProperties} ${schema.minProperties > 1 ? "properties" : "property"}`); + } + + if (typeof schema.maxProperties === "number") { + hints.push(`should not have more than ${schema.maxProperties} ${schema.minProperties && schema.minProperties > 1 ? "properties" : "property"}`); + } + + if (schema.patternProperties && Object.keys(schema.patternProperties).length > 0) { + const patternProperties = Object.keys(schema.patternProperties); + hints.push(`additional property names should match pattern${patternProperties.length > 1 ? "s" : ""} ${patternProperties.map(pattern => JSON.stringify(pattern)).join(" | ")}`); + } + + const properties = schema.properties ? Object.keys(schema.properties) : []; + /** @type {Array} */ + // @ts-ignore + + const required = schema.required ? schema.required : []; + const allProperties = [...new Set( + /** @type {Array} */ + [].concat(required).concat(properties))]; + const objectStructure = allProperties.map(property => { + const isRequired = required.includes(property); // Some properties need quotes, maybe we should add check + // Maybe we should output type of property (`foo: string`), but it is looks very unreadable + + return `${property}${isRequired ? "" : "?"}`; + }).concat(typeof schema.additionalProperties === "undefined" || Boolean(schema.additionalProperties) ? schema.additionalProperties && isObject(schema.additionalProperties) ? [`: ${formatInnerSchema(schema.additionalProperties)}`] : ["…"] : []).join(", "); + const { + dependencies, + propertyNames, + patternRequired + } = + /** @type {Schema & {patternRequired?: Array;}} */ + schema; + + if (dependencies) { + Object.keys(dependencies).forEach(dependencyName => { + const dependency = dependencies[dependencyName]; + + if (Array.isArray(dependency)) { + hints.push(`should have ${dependency.length > 1 ? "properties" : "property"} ${dependency.map(dep => `'${dep}'`).join(", ")} when property '${dependencyName}' is present`); + } else { + hints.push(`should be valid according to the schema ${formatInnerSchema(dependency)} when property '${dependencyName}' is present`); + } + }); + } + + if (propertyNames && Object.keys(propertyNames).length > 0) { + hints.push(`each property name should match format ${JSON.stringify(schema.propertyNames.format)}`); + } + + if (patternRequired && patternRequired.length > 0) { + hints.push(`should have property matching pattern ${patternRequired.map( + /** + * @param {string} item + * @returns {string} + */ + item => JSON.stringify(item))}`); + } + + return `object {${objectStructure ? ` ${objectStructure} ` : ""}}${hints.length > 0 ? ` (${hints.join(", ")})` : ""}`; + } + + if (likeNull(schema)) { + return `${logic ? "" : "non-"}null`; + } + + if (Array.isArray(schema.type)) { + // not logic already applied in formatValidationError + return `${schema.type.join(" | ")}`; + } // Fallback for unknown keywords + // not logic already applied in formatValidationError + + /* istanbul ignore next */ + + + return JSON.stringify(schema, null, 2); + } + /** + * @param {Schema=} schemaPart + * @param {(boolean | Array)=} additionalPath + * @param {boolean=} needDot + * @param {boolean=} logic + * @returns {string} + */ + + + getSchemaPartText(schemaPart, additionalPath, needDot = false, logic = true) { + if (!schemaPart) { + return ""; + } + + if (Array.isArray(additionalPath)) { + for (let i = 0; i < additionalPath.length; i++) { + /** @type {Schema | undefined} */ + const inner = schemaPart[ + /** @type {keyof Schema} */ + additionalPath[i]]; + + if (inner) { + // eslint-disable-next-line no-param-reassign + schemaPart = inner; + } else { + break; + } + } + } + + while (schemaPart.$ref) { + // eslint-disable-next-line no-param-reassign + schemaPart = this.getSchemaPart(schemaPart.$ref); + } + + let schemaText = `${this.formatSchema(schemaPart, logic)}${needDot ? "." : ""}`; + + if (schemaPart.description) { + schemaText += `\n-> ${schemaPart.description}`; + } + + if (schemaPart.link) { + schemaText += `\n-> Read more at ${schemaPart.link}`; + } + + return schemaText; + } + /** + * @param {Schema=} schemaPart + * @returns {string} + */ + + + getSchemaPartDescription(schemaPart) { + if (!schemaPart) { + return ""; + } + + while (schemaPart.$ref) { + // eslint-disable-next-line no-param-reassign + schemaPart = this.getSchemaPart(schemaPart.$ref); + } + + let schemaText = ""; + + if (schemaPart.description) { + schemaText += `\n-> ${schemaPart.description}`; + } + + if (schemaPart.link) { + schemaText += `\n-> Read more at ${schemaPart.link}`; + } + + return schemaText; + } + /** + * @param {SchemaUtilErrorObject} error + * @returns {string} + */ + + + formatValidationError(error) { + const { + keyword, + instancePath: errorInstancePath + } = error; + const splittedInstancePath = errorInstancePath.split("/"); + /** + * @type {Array} + */ + + const defaultValue = []; + const prettyInstancePath = splittedInstancePath.reduce((acc, val) => { + if (val.length > 0) { + if (isNumeric(val)) { + acc.push(`[${val}]`); + } else if (/^\[/.test(val)) { + acc.push(val); + } else { + acc.push(`.${val}`); + } + } + + return acc; + }, defaultValue).join(""); + const instancePath = `${this.baseDataPath}${prettyInstancePath}`; // const { keyword, instancePath: errorInstancePath } = error; + // const instancePath = `${this.baseDataPath}${errorInstancePath.replace(/\//g, '.')}`; + + switch (keyword) { + case "type": + { + const { + parentSchema, + params + } = error; // eslint-disable-next-line default-case + + switch (params.type) { + case "number": + return `${instancePath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; + + case "integer": + return `${instancePath} should be an ${this.getSchemaPartText(parentSchema, false, true)}`; + + case "string": + return `${instancePath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; + + case "boolean": + return `${instancePath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; + + case "array": + return `${instancePath} should be an array:\n${this.getSchemaPartText(parentSchema)}`; + + case "object": + return `${instancePath} should be an object:\n${this.getSchemaPartText(parentSchema)}`; + + case "null": + return `${instancePath} should be a ${this.getSchemaPartText(parentSchema, false, true)}`; + + default: + return `${instancePath} should be:\n${this.getSchemaPartText(parentSchema)}`; + } + } + + case "instanceof": + { + const { + parentSchema + } = error; + return `${instancePath} should be an instance of ${this.getSchemaPartText(parentSchema, false, true)}`; + } + + case "pattern": + { + const { + params, + parentSchema + } = error; + const { + pattern + } = params; + return `${instancePath} should match pattern ${JSON.stringify(pattern)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + case "format": + { + const { + params, + parentSchema + } = error; + const { + format + } = params; + return `${instancePath} should match format ${JSON.stringify(format)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + case "formatMinimum": + case "formatExclusiveMinimum": + case "formatMaximum": + case "formatExclusiveMaximum": + { + const { + params, + parentSchema + } = error; + const { + comparison, + limit + } = params; + return `${instancePath} should be ${comparison} ${JSON.stringify(limit)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + case "minimum": + case "maximum": + case "exclusiveMinimum": + case "exclusiveMaximum": + { + const { + parentSchema, + params + } = error; + const { + comparison, + limit + } = params; + const [, ...hints] = getHints( + /** @type {Schema} */ + parentSchema, true); + + if (hints.length === 0) { + hints.push(`should be ${comparison} ${limit}`); + } + + return `${instancePath} ${hints.join(" ")}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + case "multipleOf": + { + const { + params, + parentSchema + } = error; + const { + multipleOf + } = params; + return `${instancePath} should be multiple of ${multipleOf}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + case "patternRequired": + { + const { + params, + parentSchema + } = error; + const { + missingPattern + } = params; + return `${instancePath} should have property matching pattern ${JSON.stringify(missingPattern)}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + case "minLength": + { + const { + params, + parentSchema + } = error; + const { + limit + } = params; + + if (limit === 1) { + return `${instancePath} should be a non-empty string${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + const length = limit - 1; + return `${instancePath} should be longer than ${length} character${length > 1 ? "s" : ""}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + case "minItems": + { + const { + params, + parentSchema + } = error; + const { + limit + } = params; + + if (limit === 1) { + return `${instancePath} should be a non-empty array${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + return `${instancePath} should not have fewer than ${limit} items${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + case "minProperties": + { + const { + params, + parentSchema + } = error; + const { + limit + } = params; + + if (limit === 1) { + return `${instancePath} should be a non-empty object${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + return `${instancePath} should not have fewer than ${limit} properties${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + case "maxLength": + { + const { + params, + parentSchema + } = error; + const { + limit + } = params; + const max = limit + 1; + return `${instancePath} should be shorter than ${max} character${max > 1 ? "s" : ""}${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + case "maxItems": + { + const { + params, + parentSchema + } = error; + const { + limit + } = params; + return `${instancePath} should not have more than ${limit} items${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + case "maxProperties": + { + const { + params, + parentSchema + } = error; + const { + limit + } = params; + return `${instancePath} should not have more than ${limit} properties${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + case "uniqueItems": + { + const { + params, + parentSchema + } = error; + const { + i + } = params; + return `${instancePath} should not contain the item '${ + /** @type {{ data: Array }} **/ + error.data[i]}' twice${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + case "additionalItems": + { + const { + params, + parentSchema + } = error; + const { + limit + } = params; + return `${instancePath} should not have more than ${limit} items${getSchemaNonTypes(parentSchema)}. These items are valid:\n${this.getSchemaPartText(parentSchema)}`; + } + + case "contains": + { + const { + parentSchema + } = error; + return `${instancePath} should contains at least one ${this.getSchemaPartText(parentSchema, ["contains"])} item${getSchemaNonTypes(parentSchema)}.`; + } + + case "required": + { + const { + parentSchema, + params + } = error; + const missingProperty = params.missingProperty.replace(/^\./, ""); + const hasProperty = parentSchema && Boolean( + /** @type {Schema} */ + parentSchema.properties && + /** @type {Schema} */ + parentSchema.properties[missingProperty]); + return `${instancePath} misses the property '${missingProperty}'${getSchemaNonTypes(parentSchema)}.${hasProperty ? ` Should be:\n${this.getSchemaPartText(parentSchema, ["properties", missingProperty])}` : this.getSchemaPartDescription(parentSchema)}`; + } + + case "additionalProperties": + { + const { + params, + parentSchema + } = error; + const { + additionalProperty + } = params; + return `${instancePath} has an unknown property '${additionalProperty}'${getSchemaNonTypes(parentSchema)}. These properties are valid:\n${this.getSchemaPartText(parentSchema)}`; + } + + case "dependencies": + { + const { + params, + parentSchema + } = error; + const { + property, + deps + } = params; + const dependencies = deps.split(",").map( + /** + * @param {string} dep + * @returns {string} + */ + dep => `'${dep.trim()}'`).join(", "); + return `${instancePath} should have properties ${dependencies} when property '${property}' is present${getSchemaNonTypes(parentSchema)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + case "propertyNames": + { + const { + params, + parentSchema, + schema + } = error; + const { + propertyName + } = params; + return `${instancePath} property name '${propertyName}' is invalid${getSchemaNonTypes(parentSchema)}. Property names should be match format ${JSON.stringify(schema.format)}.${this.getSchemaPartDescription(parentSchema)}`; + } + + case "enum": + { + const { + parentSchema + } = error; + + if (parentSchema && + /** @type {Schema} */ + parentSchema.enum && + /** @type {Schema} */ + parentSchema.enum.length === 1) { + return `${instancePath} should be ${this.getSchemaPartText(parentSchema, false, true)}`; + } + + return `${instancePath} should be one of these:\n${this.getSchemaPartText(parentSchema)}`; + } + + case "const": + { + const { + parentSchema + } = error; + return `${instancePath} should be equal to constant ${this.getSchemaPartText(parentSchema, false, true)}`; + } + + case "not": + { + const postfix = likeObject( + /** @type {Schema} */ + error.parentSchema) ? `\n${this.getSchemaPartText(error.parentSchema)}` : ""; + const schemaOutput = this.getSchemaPartText(error.schema, false, false, false); + + if (canApplyNot(error.schema)) { + return `${instancePath} should be any ${schemaOutput}${postfix}.`; + } + + const { + schema, + parentSchema + } = error; + return `${instancePath} should not be ${this.getSchemaPartText(schema, false, true)}${parentSchema && likeObject(parentSchema) ? `\n${this.getSchemaPartText(parentSchema)}` : ""}`; + } + + case "oneOf": + case "anyOf": + { + const { + parentSchema, + children + } = error; + + if (children && children.length > 0) { + if (error.schema.length === 1) { + const lastChild = children[children.length - 1]; + const remainingChildren = children.slice(0, children.length - 1); + return this.formatValidationError(Object.assign({}, lastChild, { + children: remainingChildren, + parentSchema: Object.assign({}, parentSchema, lastChild.parentSchema) + })); + } + + let filteredChildren = filterChildren(children); + + if (filteredChildren.length === 1) { + return this.formatValidationError(filteredChildren[0]); + } + + filteredChildren = groupChildrenByFirstChild(filteredChildren); + return `${instancePath} should be one of these:\n${this.getSchemaPartText(parentSchema)}\nDetails:\n${filteredChildren.map( + /** + * @param {SchemaUtilErrorObject} nestedError + * @returns {string} + */ + nestedError => ` * ${indent(this.formatValidationError(nestedError), " ")}`).join("\n")}`; + } + + return `${instancePath} should be one of these:\n${this.getSchemaPartText(parentSchema)}`; + } + + case "if": + { + const { + params, + parentSchema + } = error; + const { + failingKeyword + } = params; + return `${instancePath} should match "${failingKeyword}" schema:\n${this.getSchemaPartText(parentSchema, [failingKeyword])}`; + } + + case "absolutePath": + { + const { + message, + parentSchema + } = error; + return `${instancePath}: ${message}${this.getSchemaPartDescription(parentSchema)}`; + } + + /* istanbul ignore next */ + + default: + { + const { + message, + parentSchema + } = error; + const ErrorInJSON = JSON.stringify(error, null, 2); // For `custom`, `false schema`, `$ref` keywords + // Fallback for unknown keywords + + return `${instancePath} ${message} (${ErrorInJSON}).\n${this.getSchemaPartText(parentSchema, false)}`; + } + } + } + /** + * @param {Array} errors + * @returns {string} + */ + + + formatValidationErrors(errors) { + return errors.map(error => { + let formattedError = this.formatValidationError(error); + + if (this.postFormatter) { + formattedError = this.postFormatter(formattedError, error); + } + + return ` - ${indent(formattedError, " ")}`; + }).join("\n"); + } + +} + +var _default = ValidationError; +exports.default = _default; \ No newline at end of file diff --git a/node_modules/schema-utils/dist/index.js b/node_modules/schema-utils/dist/index.js new file mode 100644 index 000000000..47f434532 --- /dev/null +++ b/node_modules/schema-utils/dist/index.js @@ -0,0 +1,11 @@ +"use strict"; + +const { + validate, + ValidationError +} = require("./validate"); + +module.exports = { + validate, + ValidationError +}; \ No newline at end of file diff --git a/node_modules/babel-loader/node_modules/schema-utils/dist/keywords/absolutePath.js b/node_modules/schema-utils/dist/keywords/absolutePath.js similarity index 80% rename from node_modules/babel-loader/node_modules/schema-utils/dist/keywords/absolutePath.js rename to node_modules/schema-utils/dist/keywords/absolutePath.js index 1ff958f25..ff53363a2 100644 --- a/node_modules/babel-loader/node_modules/schema-utils/dist/keywords/absolutePath.js +++ b/node_modules/schema-utils/dist/keywords/absolutePath.js @@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", { }); exports.default = void 0; -/** @typedef {import("ajv").Ajv} Ajv */ +/** @typedef {import("ajv").default} Ajv */ -/** @typedef {import("ajv").ValidateFunction} ValidateFunction */ +/** @typedef {import("ajv").SchemaValidateFunction} SchemaValidateFunction */ + +/** @typedef {import("ajv").AnySchemaObject} AnySchemaObject */ /** @typedef {import("../validate").SchemaUtilErrorObject} SchemaUtilErrorObject */ @@ -25,7 +27,7 @@ function errorMessage(message, schema, data) { // @ts-ignore // eslint-disable-next-line no-undefined schemaPath: undefined, - keyword: 'absolutePath', + keyword: "absolutePath", params: { absolutePath: data }, @@ -53,15 +55,21 @@ function getErrorFor(shouldBeAbsolute, schema, data) { function addAbsolutePathKeyword(ajv) { - ajv.addKeyword('absolutePath', { + ajv.addKeyword({ + keyword: "absolutePath", + type: "string", errors: true, - type: 'string', + /** + * @param {boolean} schema + * @param {AnySchemaObject} parentSchema + * @returns {SchemaValidateFunction} + */ compile(schema, parentSchema) { - /** @type {ValidateFunction} */ + /** @type {SchemaValidateFunction} */ const callback = data => { let passes = true; - const isExclamationMarkPresent = data.includes('!'); + const isExclamationMarkPresent = data.includes("!"); if (isExclamationMarkPresent) { callback.errors = [errorMessage(`The provided value ${JSON.stringify(data)} contains exclamation mark (!) which is not allowed because it's reserved for loader syntax.`, parentSchema, data)]; diff --git a/node_modules/babel-loader/node_modules/schema-utils/dist/util/Range.js b/node_modules/schema-utils/dist/util/Range.js similarity index 87% rename from node_modules/babel-loader/node_modules/schema-utils/dist/util/Range.js rename to node_modules/schema-utils/dist/util/Range.js index 74bb05724..14b243198 100644 --- a/node_modules/babel-loader/node_modules/schema-utils/dist/util/Range.js +++ b/node_modules/schema-utils/dist/util/Range.js @@ -16,11 +16,11 @@ class Range { * @returns {">" | ">=" | "<" | "<="} */ static getOperator(side, exclusive) { - if (side === 'left') { - return exclusive ? '>' : '>='; + if (side === "left") { + return exclusive ? ">" : ">="; } - return exclusive ? '<' : '<='; + return exclusive ? "<" : "<="; } /** * @param {number} value @@ -35,7 +35,7 @@ class Range { return Range.formatLeft(value, !logic, !exclusive); } - return `should be ${Range.getOperator('right', exclusive)} ${value}`; + return `should be ${Range.getOperator("right", exclusive)} ${value}`; } /** * @param {number} value @@ -50,7 +50,7 @@ class Range { return Range.formatRight(value, !logic, !exclusive); } - return `should be ${Range.getOperator('left', exclusive)} ${value}`; + return `should be ${Range.getOperator("left", exclusive)} ${value}`; } /** * @param {number} start left side value @@ -63,10 +63,10 @@ class Range { static formatRange(start, end, startExclusive, endExclusive, logic) { - let result = 'should be'; - result += ` ${Range.getOperator(logic ? 'left' : 'right', logic ? startExclusive : !startExclusive)} ${start} `; - result += logic ? 'and' : 'or'; - result += ` ${Range.getOperator(logic ? 'right' : 'left', logic ? endExclusive : !endExclusive)} ${end}`; + let result = "should be"; + result += ` ${Range.getOperator(logic ? "left" : "right", logic ? startExclusive : !startExclusive)} ${start} `; + result += logic ? "and" : "or"; + result += ` ${Range.getOperator(logic ? "right" : "left", logic ? endExclusive : !endExclusive)} ${end}`; return result; } /** @@ -135,14 +135,14 @@ class Range { const [end, rightExclusive] = Range.getRangeValue(this._right, !logic); if (!Number.isFinite(start) && !Number.isFinite(end)) { - return ''; + return ""; } const realStart = leftExclusive ? start + 1 : start; const realEnd = rightExclusive ? end - 1 : end; // e.g. 5 < x < 7, 5 < x <= 6, 6 <= x <= 6 if (realStart === realEnd) { - return `should be ${logic ? '' : '!'}= ${realStart}`; + return `should be ${logic ? "" : "!"}= ${realStart}`; } // e.g. 4 < x < ∞ diff --git a/node_modules/schema-utils/dist/util/hints.js b/node_modules/schema-utils/dist/util/hints.js new file mode 100644 index 000000000..480bcbbc6 --- /dev/null +++ b/node_modules/schema-utils/dist/util/hints.js @@ -0,0 +1,102 @@ +"use strict"; + +const Range = require("./Range"); +/** @typedef {import("../validate").Schema} Schema */ + +/** + * @param {Schema} schema + * @param {boolean} logic + * @return {string[]} + */ + + +module.exports.stringHints = function stringHints(schema, logic) { + const hints = []; + let type = "string"; + const currentSchema = { ...schema + }; + + if (!logic) { + const tmpLength = currentSchema.minLength; + const tmpFormat = currentSchema.formatMinimum; + currentSchema.minLength = currentSchema.maxLength; + currentSchema.maxLength = tmpLength; + currentSchema.formatMinimum = currentSchema.formatMaximum; + currentSchema.formatMaximum = tmpFormat; + } + + if (typeof currentSchema.minLength === "number") { + if (currentSchema.minLength === 1) { + type = "non-empty string"; + } else { + const length = Math.max(currentSchema.minLength - 1, 0); + hints.push(`should be longer than ${length} character${length > 1 ? "s" : ""}`); + } + } + + if (typeof currentSchema.maxLength === "number") { + if (currentSchema.maxLength === 0) { + type = "empty string"; + } else { + const length = currentSchema.maxLength + 1; + hints.push(`should be shorter than ${length} character${length > 1 ? "s" : ""}`); + } + } + + if (currentSchema.pattern) { + hints.push(`should${logic ? "" : " not"} match pattern ${JSON.stringify(currentSchema.pattern)}`); + } + + if (currentSchema.format) { + hints.push(`should${logic ? "" : " not"} match format ${JSON.stringify(currentSchema.format)}`); + } + + if (currentSchema.formatMinimum) { + hints.push(`should be ${currentSchema.formatExclusiveMinimum ? ">" : ">="} ${JSON.stringify(currentSchema.formatMinimum)}`); + } + + if (currentSchema.formatMaximum) { + hints.push(`should be ${currentSchema.formatExclusiveMaximum ? "<" : "<="} ${JSON.stringify(currentSchema.formatMaximum)}`); + } + + return [type].concat(hints); +}; +/** + * @param {Schema} schema + * @param {boolean} logic + * @return {string[]} + */ + + +module.exports.numberHints = function numberHints(schema, logic) { + const hints = [schema.type === "integer" ? "integer" : "number"]; + const range = new Range(); + + if (typeof schema.minimum === "number") { + range.left(schema.minimum); + } + + if (typeof schema.exclusiveMinimum === "number") { + range.left(schema.exclusiveMinimum, true); + } + + if (typeof schema.maximum === "number") { + range.right(schema.maximum); + } + + if (typeof schema.exclusiveMaximum === "number") { + range.right(schema.exclusiveMaximum, true); + } + + const rangeFormat = range.format(logic); + + if (rangeFormat) { + hints.push(rangeFormat); + } + + if (typeof schema.multipleOf === "number") { + hints.push(`should${logic ? "" : " not"} be multiple of ${schema.multipleOf}`); + } + + return hints; +}; \ No newline at end of file diff --git a/node_modules/babel-loader/node_modules/schema-utils/dist/validate.js b/node_modules/schema-utils/dist/validate.js similarity index 81% rename from node_modules/babel-loader/node_modules/schema-utils/dist/validate.js rename to node_modules/schema-utils/dist/validate.js index c7ea5eeb8..01932609a 100644 --- a/node_modules/babel-loader/node_modules/schema-utils/dist/validate.js +++ b/node_modules/schema-utils/dist/validate.js @@ -3,7 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = void 0; +Object.defineProperty(exports, "ValidationError", { + enumerable: true, + get: function () { + return _ValidationError.default; + } +}); +exports.validate = validate; var _absolutePath = _interopRequireDefault(require("./keywords/absolutePath")); @@ -12,9 +18,11 @@ var _ValidationError = _interopRequireDefault(require("./ValidationError")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // Use CommonJS require for ajv libs so TypeScript consumers aren't locked into esModuleInterop (see #110). -const Ajv = require('ajv'); +const Ajv = require("ajv").default; -const ajvKeywords = require('ajv-keywords'); +const ajvKeywords = require("ajv-keywords").default; + +const addFormats = require("ajv-formats").default; /** @typedef {import("json-schema").JSONSchema4} JSONSchema4 */ /** @typedef {import("json-schema").JSONSchema6} JSONSchema6 */ @@ -25,10 +33,11 @@ const ajvKeywords = require('ajv-keywords'); /** * @typedef {Object} Extend - * @property {number=} formatMinimum - * @property {number=} formatMaximum - * @property {boolean=} formatExclusiveMinimum - * @property {boolean=} formatExclusiveMaximum + * @property {string=} formatMinimum + * @property {string=} formatMaximum + * @property {string=} formatExclusiveMinimum + * @property {string=} formatExclusiveMaximum + * @property {string=} link */ /** @typedef {(JSONSchema4 | JSONSchema6 | JSONSchema7) & Extend} Schema */ @@ -49,13 +58,21 @@ const ajvKeywords = require('ajv-keywords'); * @property {PostFormatter=} postFormatter */ +/** + * @type {Ajv} + */ + const ajv = new Ajv({ + strict: false, allErrors: true, verbose: true, $data: true }); -ajvKeywords(ajv, ['instanceof', 'formatMinimum', 'formatMaximum', 'patternRequired']); // Custom keywords +ajvKeywords(ajv, ["instanceof", "patternRequired"]); +addFormats(ajv, { + keywords: true +}); // Custom keywords (0, _absolutePath.default)(ajv); /** @@ -77,7 +94,7 @@ function validate(schema, options, configuration) { */ error => { // eslint-disable-next-line no-param-reassign - error.dataPath = `[${idx}]${error.dataPath}`; + error.instancePath = `[${idx}]${error.instancePath}`; if (error.children) { error.children.forEach(applyPrefix); @@ -125,13 +142,13 @@ function filterErrors(errors) { /** @type {Array} */ errors) { const { - dataPath + instancePath } = error; /** @type {Array} */ let children = []; newErrors = newErrors.filter(oldError => { - if (oldError.dataPath.includes(dataPath)) { + if (oldError.instancePath.includes(instancePath)) { if (oldError.children) { children = children.concat(oldError.children.slice(0)); } // eslint-disable-next-line no-undefined, no-param-reassign @@ -153,10 +170,4 @@ function filterErrors(errors) { } return newErrors; -} // TODO change after resolve https://github.com/microsoft/TypeScript/issues/34994 - - -validate.ValidationError = _ValidationError.default; -validate.ValidateError = _ValidationError.default; -var _default = validate; -exports.default = _default; \ No newline at end of file +} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/LICENSE b/node_modules/schema-utils/node_modules/ajv-keywords/LICENSE new file mode 100644 index 000000000..90139aa74 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/README.md b/node_modules/schema-utils/node_modules/ajv-keywords/README.md new file mode 100644 index 000000000..63e784fa5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/README.md @@ -0,0 +1,745 @@ +# ajv-keywords + +Custom JSON-Schema keywords for [Ajv](https://github.com/epoberezkin/ajv) validator + +[![build](https://github.com/ajv-validator/ajv-keywords/workflows/build/badge.svg)](https://github.com/ajv-validator/ajv-keywords/actions?query=workflow%3Abuild) +[![npm](https://img.shields.io/npm/v/ajv-keywords.svg)](https://www.npmjs.com/package/ajv-keywords) +[![npm downloads](https://img.shields.io/npm/dm/ajv-keywords.svg)](https://www.npmjs.com/package/ajv-keywords) +[![coverage](https://coveralls.io/repos/github/ajv-validator/ajv-keywords/badge.svg?branch=master)](https://coveralls.io/github/ajv-validator/ajv-keywords?branch=master) +[![gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv) + +**Please note**: This readme file is for [ajv-keywords v5.0.0](https://github.com/ajv-validator/ajv-keywords/releases/tag/v5.0.0) that should be used with [ajv v8](https://github.com/ajv-validator/ajv). + +[ajv-keywords v3](https://github.com/ajv-validator/ajv-keywords/tree/v3) should be used with [ajv v6](https://github.com/ajv-validator/ajv/tree/v6). + +## Contents + +- [Install](#install) +- [Usage](#usage) +- [Keywords](#keywords) + - [Types](#types) + - [typeof](#typeof) + - [instanceof](#instanceof)\+ + - [Keywords for numbers](#keywords-for-numbers) + - [range and exclusiveRange](#range-and-exclusiverange) + - [Keywords for strings](#keywords-for-strings) + - [regexp](#regexp) + - [transform](#transform)\* + - [Keywords for arrays](#keywords-for-arrays) + - [uniqueItemProperties](#uniqueitemproperties)\+ + - [Keywords for objects](#keywords-for-objects) + - [allRequired](#allrequired) + - [anyRequired](#anyrequired) + - [oneRequired](#onerequired) + - [patternRequired](#patternrequired) + - [prohibited](#prohibited) + - [deepProperties](#deepproperties) + - [deepRequired](#deeprequired) + - [dynamicDefaults](#dynamicdefaults)\*\+ + - [Keywords for all types](#keywords-for-all-types) + - [select/selectCases/selectDefault](#selectselectcasesselectdefault) +- [Security contact](#security-contact) +- [Open-source software support](#open-source-software-support) +- [License](#license) + +\* - keywords that modify data +\+ - keywords that are not supported in [standalone validation code](https://github.com/ajv-validator/ajv/blob/master/docs/standalone.md) + +## Install + +To install version 4 to use with [Ajv v7](https://github.com/ajv-validator/ajv): + +``` +npm install ajv-keywords +``` + +## Usage + +To add all available keywords: + +```javascript +const Ajv = require("ajv") +const ajv = new Ajv() +require("ajv-keywords")(ajv) + +ajv.validate({instanceof: "RegExp"}, /.*/) // true +ajv.validate({instanceof: "RegExp"}, ".*") // false +``` + +To add a single keyword: + +```javascript +require("ajv-keywords")(ajv, "instanceof") +``` + +To add multiple keywords: + +```javascript +require("ajv-keywords")(ajv, ["typeof", "instanceof"]) +``` + +To add a single keyword directly (to avoid adding unused code): + +```javascript +require("ajv-keywords/dist/keywords/select")(ajv, opts) +``` + +To add all keywords via Ajv options: + +```javascript +const ajv = new Ajv({keywords: require("ajv-keywords/dist/definitions")(opts)}) +``` + +To add one or several keywords via options: + +```javascript +const ajv = new Ajv({ + keywords: [ + require("ajv-keywords/dist/definitions/typeof")(), + require("ajv-keywords/dist/definitions/instanceof")(), + // select exports an array of 3 definitions - see "select" in docs + ...require("ajv-keywords/dist/definitions/select")(opts), + ], +}) +``` + +`opts` is an optional object with a property `defaultMeta` - URI of meta-schema to use for keywords that use subschemas (`select` and `deepProperties`). The default is `"http://json-schema.org/schema"`. + +## Keywords + +### Types + +#### `typeof` + +Based on JavaScript `typeof` operation. + +The value of the keyword should be a string (`"undefined"`, `"string"`, `"number"`, `"object"`, `"function"`, `"boolean"` or `"symbol"`) or an array of strings. + +To pass validation the result of `typeof` operation on the value should be equal to the string (or one of the strings in the array). + +```javascript +ajv.validate({typeof: "undefined"}, undefined) // true +ajv.validate({typeof: "undefined"}, null) // false +ajv.validate({typeof: ["undefined", "object"]}, null) // true +``` + +#### `instanceof` + +Based on JavaScript `instanceof` operation. + +The value of the keyword should be a string (`"Object"`, `"Array"`, `"Function"`, `"Number"`, `"String"`, `"Date"`, `"RegExp"` or `"Promise"`) or an array of strings. + +To pass validation the result of `data instanceof ...` operation on the value should be true: + +```javascript +ajv.validate({instanceof: "Array"}, []) // true +ajv.validate({instanceof: "Array"}, {}) // false +ajv.validate({instanceof: ["Array", "Function"]}, function () {}) // true +``` + +You can add your own constructor function to be recognised by this keyword: + +```javascript +class MyClass {} +const instanceofDef = require("ajv-keywords/dist/definitions/instanceof") +instanceofDef.CONSTRUCTORS.MyClass = MyClass +ajv.validate({instanceof: "MyClass"}, new MyClass()) // true +``` + +**Please note**: currently `instanceof` is not supported in [standalone validation code](https://github.com/ajv-validator/ajv/blob/master/docs/standalone.md) - it has to be implemented as [`code` keyword](https://github.com/ajv-validator/ajv/blob/master/docs/keywords.md#define-keyword-with-code-generation-function) to support it (PR is welcome). + +### Keywords for numbers + +#### `range` and `exclusiveRange` + +Syntax sugar for the combination of minimum and maximum keywords (or exclusiveMinimum and exclusiveMaximum), also fails schema compilation if there are no numbers in the range. + +The value of these keywords must be an array consisting of two numbers, the second must be greater or equal than the first one. + +If the validated value is not a number the validation passes, otherwise to pass validation the value should be greater (or equal) than the first number and smaller (or equal) than the second number in the array. + +```javascript +const schema = {type: "number", range: [1, 3]} +ajv.validate(schema, 1) // true +ajv.validate(schema, 2) // true +ajv.validate(schema, 3) // true +ajv.validate(schema, 0.99) // false +ajv.validate(schema, 3.01) // false + +const schema = {type: "number", exclusiveRange: [1, 3]} +ajv.validate(schema, 1.01) // true +ajv.validate(schema, 2) // true +ajv.validate(schema, 2.99) // true +ajv.validate(schema, 1) // false +ajv.validate(schema, 3) // false +``` + +### Keywords for strings + +#### `regexp` + +This keyword allows to use regular expressions with flags in schemas, and also without `"u"` flag when needed (the standard `pattern` keyword does not support flags and implies the presence of `"u"` flag). + +This keyword applies only to strings. If the data is not a string, the validation succeeds. + +The value of this keyword can be either a string (the result of `regexp.toString()`) or an object with the properties `pattern` and `flags` (the same strings that should be passed to RegExp constructor). + +```javascript +const schema = { + type: "object", + properties: { + foo: {type: "string", regexp: "/foo/i"}, + bar: {type: "string", regexp: {pattern: "bar", flags: "i"}}, + }, +} + +const validData = { + foo: "Food", + bar: "Barmen", +} + +const invalidData = { + foo: "fog", + bar: "bad", +} +``` + +#### `transform` + +This keyword allows a string to be modified during validation. + +This keyword applies only to strings. If the data is not a string, the `transform` keyword is ignored. + +A standalone string cannot be modified, i.e. `data = 'a'; ajv.validate(schema, data);`, because strings are passed by value + +**Supported transformations:** + +- `trim`: remove whitespace from start and end +- `trimStart`/`trimLeft`: remove whitespace from start +- `trimEnd`/`trimRight`: remove whitespace from end +- `toLowerCase`: convert to lower case +- `toUpperCase`: convert to upper case +- `toEnumCase`: change string case to be equal to one of `enum` values in the schema + +Transformations are applied in the order they are listed. + +Note: `toEnumCase` requires that all allowed values are unique when case insensitive. + +**Example: multiple transformations** + +```javascript +require("ajv-keywords")(ajv, "transform") + +const schema = { + type: "array", + items: { + type: "string", + transform: ["trim", "toLowerCase"], + }, +} + +const data = [" MixCase "] +ajv.validate(schema, data) +console.log(data) // ['mixcase'] +``` + +**Example: `enumcase`** + +```javascript +require("ajv-keywords")(ajv, ["transform"]) + +const schema = { + type: "array", + items: { + type: "string", + transform: ["trim", "toEnumCase"], + enum: ["pH"], + }, +} + +const data = ["ph", " Ph", "PH", "pH "] +ajv.validate(schema, data) +console.log(data) // ['pH','pH','pH','pH'] +``` + +### Keywords for arrays + +#### `uniqueItemProperties` + +The keyword allows to check that some properties in array items are unique. + +This keyword applies only to arrays. If the data is not an array, the validation succeeds. + +The value of this keyword must be an array of strings - property names that should have unique values across all items. + +```javascript +const schema = { + type: "array", + uniqueItemProperties: ["id", "name"], +} + +const validData = [{id: 1}, {id: 2}, {id: 3}] + +const invalidData1 = [ + {id: 1}, + {id: 1}, // duplicate "id" + {id: 3}, +] + +const invalidData2 = [ + {id: 1, name: "taco"}, + {id: 2, name: "taco"}, // duplicate "name" + {id: 3, name: "salsa"}, +] +``` + +This keyword is contributed by [@blainesch](https://github.com/blainesch). + +**Please note**: currently `uniqueItemProperties` is not supported in [standalone validation code](https://github.com/ajv-validator/ajv/blob/master/docs/standalone.md) - it has to be implemented as [`code` keyword](https://github.com/ajv-validator/ajv/blob/master/docs/keywords.md#define-keyword-with-code-generation-function) to support it (PR is welcome). + +### Keywords for objects + +#### `allRequired` + +This keyword allows to require the presence of all properties used in `properties` keyword in the same schema object. + +This keyword applies only to objects. If the data is not an object, the validation succeeds. + +The value of this keyword must be boolean. + +If the value of the keyword is `false`, the validation succeeds. + +If the value of the keyword is `true`, the validation succeeds if the data contains all properties defined in `properties` keyword (in the same schema object). + +If the `properties` keyword is not present in the same schema object, schema compilation will throw exception. + +```javascript +const schema = { + type: "object", + properties: { + foo: {type: "number"}, + bar: {type: "number"}, + }, + allRequired: true, +} + +const validData = {foo: 1, bar: 2} +const alsoValidData = {foo: 1, bar: 2, baz: 3} + +const invalidDataList = [{}, {foo: 1}, {bar: 2}] +``` + +#### `anyRequired` + +This keyword allows to require the presence of any (at least one) property from the list. + +This keyword applies only to objects. If the data is not an object, the validation succeeds. + +The value of this keyword must be an array of strings, each string being a property name. For data object to be valid at least one of the properties in this array should be present in the object. + +```javascript +const schema = { + type: "object", + anyRequired: ["foo", "bar"], +} + +const validData = {foo: 1} +const alsoValidData = {foo: 1, bar: 2} + +const invalidDataList = [{}, {baz: 3}] +``` + +#### `oneRequired` + +This keyword allows to require the presence of only one property from the list. + +This keyword applies only to objects. If the data is not an object, the validation succeeds. + +The value of this keyword must be an array of strings, each string being a property name. For data object to be valid exactly one of the properties in this array should be present in the object. + +```javascript +const schema = { + type: "object", + oneRequired: ["foo", "bar"], +} + +const validData = {foo: 1} +const alsoValidData = {bar: 2, baz: 3} + +const invalidDataList = [{}, {baz: 3}, {foo: 1, bar: 2}] +``` + +#### `patternRequired` + +This keyword allows to require the presence of properties that match some pattern(s). + +This keyword applies only to objects. If the data is not an object, the validation succeeds. + +The value of this keyword should be an array of strings, each string being a regular expression. For data object to be valid each regular expression in this array should match at least one property name in the data object. + +If the array contains multiple regular expressions, more than one expression can match the same property name. + +```javascript +const schema = { + type: "object", + patternRequired: ["f.*o", "b.*r"], +} + +const validData = {foo: 1, bar: 2} +const alsoValidData = {foobar: 3} + +const invalidDataList = [{}, {foo: 1}, {bar: 2}] +``` + +#### `prohibited` + +This keyword allows to prohibit that any of the properties in the list is present in the object. + +This keyword applies only to objects. If the data is not an object, the validation succeeds. + +The value of this keyword should be an array of strings, each string being a property name. For data object to be valid none of the properties in this array should be present in the object. + +```javascript +const schema = { + type: "object", + prohibited: ["foo", "bar"], +} + +const validData = {baz: 1} +const alsoValidData = {} + +const invalidDataList = [{foo: 1}, {bar: 2}, {foo: 1, bar: 2}] +``` + +**Please note**: `{prohibited: ['foo', 'bar']}` is equivalent to `{not: {anyRequired: ['foo', 'bar']}}` (i.e. it has the same validation result for any data). + +#### `deepProperties` + +This keyword allows to validate deep properties (identified by JSON pointers). + +This keyword applies only to objects. If the data is not an object, the validation succeeds. + +The value should be an object, where keys are JSON pointers to the data, starting from the current position in data, and the values are JSON schemas. For data object to be valid the value of each JSON pointer should be valid according to the corresponding schema. + +```javascript +const schema = { + type: "object", + deepProperties: { + "/users/1/role": {enum: ["admin"]}, + }, +} + +const validData = { + users: [ + {}, + { + id: 123, + role: "admin", + }, + ], +} + +const alsoValidData = { + users: { + 1: { + id: 123, + role: "admin", + }, + }, +} + +const invalidData = { + users: [ + {}, + { + id: 123, + role: "user", + }, + ], +} + +const alsoInvalidData = { + users: { + 1: { + id: 123, + role: "user", + }, + }, +} +``` + +#### `deepRequired` + +This keyword allows to check that some deep properties (identified by JSON pointers) are available. + +This keyword applies only to objects. If the data is not an object, the validation succeeds. + +The value should be an array of JSON pointers to the data, starting from the current position in data. For data object to be valid each JSON pointer should be some existing part of the data. + +```javascript +const schema = { + type: "object", + deepRequired: ["/users/1/role"], +} + +const validData = { + users: [ + {}, + { + id: 123, + role: "admin", + }, + ], +} + +const invalidData = { + users: [ + {}, + { + id: 123, + }, + ], +} +``` + +See [json-schema-org/json-schema-spec#203](https://github.com/json-schema-org/json-schema-spec/issues/203#issue-197211916) for an example of the equivalent schema without `deepRequired` keyword. + +### Keywords for all types + +#### `select`/`selectCases`/`selectDefault` + +**Please note**: these keywords are deprecated. It is recommended to use OpenAPI [discriminator](https://ajv.js.org/json-schema.html#discriminator) keyword supported by Ajv v8 instead of `select`. + +These keywords allow to choose the schema to validate the data based on the value of some property in the validated data. + +These keywords must be present in the same schema object (`selectDefault` is optional). + +The value of `select` keyword should be a [\$data reference](https://github.com/ajv-validator/ajv/blob/master/docs/validation.md#data-reference) that points to any primitive JSON type (string, number, boolean or null) in the data that is validated. You can also use a constant of primitive type as the value of this keyword (e.g., for debugging purposes). + +The value of `selectCases` keyword must be an object where each property name is a possible string representation of the value of `select` keyword and each property value is a corresponding schema (from draft-06 it can be boolean) that must be used to validate the data. + +The value of `selectDefault` keyword is a schema (also can be boolean) that must be used to validate the data in case `selectCases` has no key equal to the stringified value of `select` keyword. + +The validation succeeds in one of the following cases: + +- the validation of data using selected schema succeeds, +- none of the schemas is selected for validation, +- the value of select is undefined (no property in the data that the data reference points to). + +If `select` value (in data) is not a primitive type the validation fails. + +This keyword correctly tracks evaluated properties and items to work with `unevaluatedProperties` and `unevaluatedItems` keywords - only properties and items from the subschema that was used (one of `selectCases` subschemas or `selectDefault` subschema) are marked as evaluated. + +**Please note**: these keywords require Ajv `$data` option to support [\$data reference](https://github.com/ajv-validator/ajv/blob/master/docs/validation.md#data-reference). + +```javascript +require("ajv-keywords")(ajv, "select") + +const schema = { + type: "object", + required: ["kind"], + properties: { + kind: {type: "string"}, + }, + select: {$data: "0/kind"}, + selectCases: { + foo: { + required: ["foo"], + properties: { + kind: {}, + foo: {type: "string"}, + }, + additionalProperties: false, + }, + bar: { + required: ["bar"], + properties: { + kind: {}, + bar: {type: "number"}, + }, + additionalProperties: false, + }, + }, + selectDefault: { + propertyNames: { + not: {enum: ["foo", "bar"]}, + }, + }, +} + +const validDataList = [ + {kind: "foo", foo: "any"}, + {kind: "bar", bar: 1}, + {kind: "anything_else", not_bar_or_foo: "any value"}, +] + +const invalidDataList = [ + {kind: "foo"}, // no property foo + {kind: "bar"}, // no property bar + {kind: "foo", foo: "any", another: "any value"}, // additional property + {kind: "bar", bar: 1, another: "any value"}, // additional property + {kind: "anything_else", foo: "any"}, // property foo not allowed + {kind: "anything_else", bar: 1}, // property bar not allowed +] +``` + +#### `dynamicDefaults` + +This keyword allows to assign dynamic defaults to properties, such as timestamps, unique IDs etc. + +This keyword only works if `useDefaults` options is used and not inside `anyOf` keywords etc., in the same way as [default keyword treated by Ajv](https://github.com/epoberezkin/ajv#assigning-defaults). + +The keyword should be added on the object level. Its value should be an object with each property corresponding to a property name, in the same way as in standard `properties` keyword. The value of each property can be: + +- an identifier of dynamic default function (a string) +- an object with properties `func` (an identifier) and `args` (an object with parameters that will be passed to this function during schema compilation - see examples). + +The properties used in `dynamicDefaults` should not be added to `required` keyword in the same schema (or validation will fail), because unlike `default` this keyword is processed after validation. + +There are several predefined dynamic default functions: + +- `"timestamp"` - current timestamp in milliseconds +- `"datetime"` - current date and time as string (ISO, valid according to `date-time` format) +- `"date"` - current date as string (ISO, valid according to `date` format) +- `"time"` - current time as string (ISO, valid according to `time` format) +- `"random"` - pseudo-random number in [0, 1) interval +- `"randomint"` - pseudo-random integer number. If string is used as a property value, the function will randomly return 0 or 1. If object `{ func: 'randomint', args: { max: N } }` is used then the default will be an integer number in [0, N) interval. +- `"seq"` - sequential integer number starting from 0. If string is used as a property value, the default sequence will be used. If object `{ func: 'seq', args: { name: 'foo'} }` is used then the sequence with name `"foo"` will be used. Sequences are global, even if different ajv instances are used. + +```javascript +const schema = { + type: "object", + dynamicDefaults: { + ts: "datetime", + r: {func: "randomint", args: {max: 100}}, + id: {func: "seq", args: {name: "id"}}, + }, + properties: { + ts: { + type: "string", + format: "date-time", + }, + r: { + type: "integer", + minimum: 0, + exclusiveMaximum: 100, + }, + id: { + type: "integer", + minimum: 0, + }, + }, +} + +const data = {} +ajv.validate(data) // true +data // { ts: '2016-12-01T22:07:28.829Z', r: 25, id: 0 } + +const data1 = {} +ajv.validate(data1) // true +data1 // { ts: '2016-12-01T22:07:29.832Z', r: 68, id: 1 } + +ajv.validate(data1) // true +data1 // didn't change, as all properties were defined +``` + +When using the `useDefaults` option value `"empty"`, properties and items equal to `null` or `""` (empty string) will be considered missing and assigned defaults. Use `allOf` [compound keyword](https://github.com/epoberezkin/ajv/blob/master/KEYWORDS.md#compound-keywords) to execute `dynamicDefaults` before validation. + +```javascript +const schema = { + type: "object", + allOf: [ + { + dynamicDefaults: { + ts: "datetime", + r: {func: "randomint", args: {min: 5, max: 100}}, + id: {func: "seq", args: {name: "id"}}, + }, + }, + { + properties: { + ts: { + type: "string", + }, + r: { + type: "number", + minimum: 5, + exclusiveMaximum: 100, + }, + id: { + type: "integer", + minimum: 0, + }, + }, + }, + ], +} + +const data = {ts: "", r: null} +ajv.validate(data) // true +data // { ts: '2016-12-01T22:07:28.829Z', r: 25, id: 0 } +``` + +You can add your own dynamic default function to be recognised by this keyword: + +```javascript +const uuid = require("uuid") + +const def = require("ajv-keywords/dist/definitions/dynamicDefaults") +def.DEFAULTS.uuid = () => uuid.v4 + +const schema = { + dynamicDefaults: {id: "uuid"}, + properties: {id: {type: "string", format: "uuid"}}, +} + +const data = {} +ajv.validate(schema, data) // true +data // { id: 'a1183fbe-697b-4030-9bcc-cfeb282a9150' }; + +const data1 = {} +ajv.validate(schema, data1) // true +data1 // { id: '5b008de7-1669-467a-a5c6-70fa244d7209' } +``` + +You also can define dynamic default that accept parameters, e.g. version of uuid: + +```javascript +const uuid = require("uuid") + +function getUuid(args) { + const version = "v" + ((arvs && args.v) || "4") + return uuid[version] +} + +const def = require("ajv-keywords/dist/definitions/dynamicDefaults") +def.DEFAULTS.uuid = getUuid + +const schema = { + dynamicDefaults: { + id1: "uuid", // v4 + id2: {func: "uuid", v: 4}, // v4 + id3: {func: "uuid", v: 1}, // v1 + }, +} +``` + +**Please note**: dynamic default functions are differentiated by the number of parameters they have (`function.length`). Functions that do not expect default must have one non-optional argument so that `function.length` > 0. + +`dynamicDefaults` is not supported in [standalone validation code](https://github.com/ajv-validator/ajv/blob/master/docs/standalone.md). + +## Security contact + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. + +Please do NOT report security vulnerabilities via GitHub issues. + +## Open-source software support + +Ajv-keywords is a part of [Tidelift subscription](https://tidelift.com/subscription/pkg/npm-ajv-keywords?utm_source=npm-ajv-keywords&utm_medium=referral&utm_campaign=readme) - it provides a centralised support to open-source software users, in addition to the support provided by software maintainers. + +## License + +[MIT](https://github.com/epoberezkin/ajv-keywords/blob/master/LICENSE) diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_range.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_range.d.ts new file mode 100644 index 000000000..f10667819 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_range.d.ts @@ -0,0 +1,5 @@ +import type { MacroKeywordDefinition } from "ajv"; +import type { GetDefinition } from "./_types"; +declare type RangeKwd = "range" | "exclusiveRange"; +export default function getRangeDef(keyword: RangeKwd): GetDefinition; +export {}; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_range.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_range.js new file mode 100644 index 000000000..21d4aa468 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_range.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +function getRangeDef(keyword) { + return () => ({ + keyword, + type: "number", + schemaType: "array", + macro: function ([min, max]) { + validateRangeSchema(min, max); + return keyword === "range" + ? { minimum: min, maximum: max } + : { exclusiveMinimum: min, exclusiveMaximum: max }; + }, + metaSchema: { + type: "array", + minItems: 2, + maxItems: 2, + items: { type: "number" }, + }, + }); + function validateRangeSchema(min, max) { + if (min > max || (keyword === "exclusiveRange" && min === max)) { + throw new Error("There are no numbers in range"); + } + } +} +exports.default = getRangeDef; +//# sourceMappingURL=_range.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_range.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_range.js.map new file mode 100644 index 000000000..132c83d54 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_range.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_range.js","sourceRoot":"","sources":["../../src/definitions/_range.ts"],"names":[],"mappings":";;AAKA,SAAwB,WAAW,CAAC,OAAiB;IACnD,OAAO,GAAG,EAAE,CAAC,CAAC;QACZ,OAAO;QACP,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,OAAO;QACnB,KAAK,EAAE,UAAU,CAAC,GAAG,EAAE,GAAG,CAAmB;YAC3C,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;YAC7B,OAAO,OAAO,KAAK,OAAO;gBACxB,CAAC,CAAC,EAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAC;gBAC9B,CAAC,CAAC,EAAC,gBAAgB,EAAE,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAC,CAAA;QACpD,CAAC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,CAAC;YACX,QAAQ,EAAE,CAAC;YACX,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;SACxB;KACF,CAAC,CAAA;IAEF,SAAS,mBAAmB,CAAC,GAAW,EAAE,GAAW;QACnD,IAAI,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,KAAK,gBAAgB,IAAI,GAAG,KAAK,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAA;SACjD;IACH,CAAC;AACH,CAAC;AAxBD,8BAwBC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_required.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_required.d.ts new file mode 100644 index 000000000..cac6e5eb1 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_required.d.ts @@ -0,0 +1,5 @@ +import type { MacroKeywordDefinition } from "ajv"; +import type { GetDefinition } from "./_types"; +declare type RequiredKwd = "anyRequired" | "oneRequired"; +export default function getRequiredDef(keyword: RequiredKwd): GetDefinition; +export {}; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_required.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_required.js new file mode 100644 index 000000000..27dd2ffbf --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_required.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +function getRequiredDef(keyword) { + return () => ({ + keyword, + type: "object", + schemaType: "array", + macro(schema) { + if (schema.length === 0) + return true; + if (schema.length === 1) + return { required: schema }; + const comb = keyword === "anyRequired" ? "anyOf" : "oneOf"; + return { [comb]: schema.map((p) => ({ required: [p] })) }; + }, + metaSchema: { + type: "array", + items: { type: "string" }, + }, + }); +} +exports.default = getRequiredDef; +//# sourceMappingURL=_required.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_required.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_required.js.map new file mode 100644 index 000000000..94211e7a1 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_required.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_required.js","sourceRoot":"","sources":["../../src/definitions/_required.ts"],"names":[],"mappings":";;AAKA,SAAwB,cAAc,CACpC,OAAoB;IAEpB,OAAO,GAAG,EAAE,CAAC,CAAC;QACZ,OAAO;QACP,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,OAAO;QACnB,KAAK,CAAC,MAAgB;YACpB,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAA;YACpC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,EAAC,QAAQ,EAAE,MAAM,EAAC,CAAA;YAClD,MAAM,IAAI,GAAG,OAAO,KAAK,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAA;YAC1D,OAAO,EAAC,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAC,CAAA;QACvD,CAAC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;SACxB;KACF,CAAC,CAAA;AACJ,CAAC;AAlBD,iCAkBC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_types.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_types.d.ts new file mode 100644 index 000000000..7c36a04cd --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_types.d.ts @@ -0,0 +1,5 @@ +import type { KeywordDefinition } from "ajv"; +export interface DefinitionOptions { + defaultMeta?: string | boolean; +} +export declare type GetDefinition = (opts?: DefinitionOptions) => T; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_types.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_types.js new file mode 100644 index 000000000..6e5dd982b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_types.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=_types.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_types.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_types.js.map new file mode 100644 index 000000000..31f2faccd --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_types.js","sourceRoot":"","sources":["../../src/definitions/_types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_util.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_util.d.ts new file mode 100644 index 000000000..b0d91dd2c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_util.d.ts @@ -0,0 +1,4 @@ +import type { DefinitionOptions } from "./_types"; +import type { SchemaObject, KeywordCxt, Name } from "ajv"; +export declare function metaSchemaRef({ defaultMeta }?: DefinitionOptions): SchemaObject; +export declare function usePattern({ gen, it: { opts } }: KeywordCxt, pattern: string, flags?: string): Name; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_util.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_util.js new file mode 100644 index 000000000..f8d1045cc --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_util.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.usePattern = exports.metaSchemaRef = void 0; +const codegen_1 = require("ajv/dist/compile/codegen"); +const META_SCHEMA_ID = "http://json-schema.org/schema"; +function metaSchemaRef({ defaultMeta } = {}) { + return defaultMeta === false ? {} : { $ref: defaultMeta || META_SCHEMA_ID }; +} +exports.metaSchemaRef = metaSchemaRef; +function usePattern({ gen, it: { opts } }, pattern, flags = opts.unicodeRegExp ? "u" : "") { + const rx = new RegExp(pattern, flags); + return gen.scopeValue("pattern", { + key: rx.toString(), + ref: rx, + code: (0, codegen_1._) `new RegExp(${pattern}, ${flags})`, + }); +} +exports.usePattern = usePattern; +//# sourceMappingURL=_util.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_util.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_util.js.map new file mode 100644 index 000000000..c9e310bd7 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/_util.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_util.js","sourceRoot":"","sources":["../../src/definitions/_util.ts"],"names":[],"mappings":";;;AAEA,sDAA0C;AAE1C,MAAM,cAAc,GAAG,+BAA+B,CAAA;AAEtD,SAAgB,aAAa,CAAC,EAAC,WAAW,KAAuB,EAAE;IACjE,OAAO,WAAW,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,WAAW,IAAI,cAAc,EAAC,CAAA;AAC3E,CAAC;AAFD,sCAEC;AAED,SAAgB,UAAU,CACxB,EAAC,GAAG,EAAE,EAAE,EAAE,EAAC,IAAI,EAAC,EAAa,EAC7B,OAAe,EACf,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;IAErC,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IACrC,OAAO,GAAG,CAAC,UAAU,CAAC,SAAS,EAAE;QAC/B,GAAG,EAAE,EAAE,CAAC,QAAQ,EAAE;QAClB,GAAG,EAAE,EAAE;QACP,IAAI,EAAE,IAAA,WAAC,EAAA,cAAc,OAAO,KAAK,KAAK,GAAG;KAC1C,CAAC,CAAA;AACJ,CAAC;AAXD,gCAWC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/allRequired.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/allRequired.d.ts new file mode 100644 index 000000000..ac709be9e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/allRequired.d.ts @@ -0,0 +1,2 @@ +import type { MacroKeywordDefinition } from "ajv"; +export default function getDef(): MacroKeywordDefinition; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/allRequired.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/allRequired.js new file mode 100644 index 000000000..c2a6803fa --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/allRequired.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +function getDef() { + return { + keyword: "allRequired", + type: "object", + schemaType: "boolean", + macro(schema, parentSchema) { + if (!schema) + return true; + const required = Object.keys(parentSchema.properties); + if (required.length === 0) + return true; + return { required }; + }, + dependencies: ["properties"], + }; +} +exports.default = getDef; +module.exports = getDef; +//# sourceMappingURL=allRequired.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/allRequired.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/allRequired.js.map new file mode 100644 index 000000000..ff7006b34 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/allRequired.js.map @@ -0,0 +1 @@ +{"version":3,"file":"allRequired.js","sourceRoot":"","sources":["../../src/definitions/allRequired.ts"],"names":[],"mappings":";;AAEA,SAAwB,MAAM;IAC5B,OAAO;QACL,OAAO,EAAE,aAAa;QACtB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,SAAS;QACrB,KAAK,CAAC,MAAe,EAAE,YAAY;YACjC,IAAI,CAAC,MAAM;gBAAE,OAAO,IAAI,CAAA;YACxB,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAA;YACrD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAA;YACtC,OAAO,EAAC,QAAQ,EAAC,CAAA;QACnB,CAAC;QACD,YAAY,EAAE,CAAC,YAAY,CAAC;KAC7B,CAAA;AACH,CAAC;AAbD,yBAaC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/anyRequired.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/anyRequired.d.ts new file mode 100644 index 000000000..a14c2cf7c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/anyRequired.d.ts @@ -0,0 +1,4 @@ +import type { MacroKeywordDefinition } from "ajv"; +import type { GetDefinition } from "./_types"; +declare const getDef: GetDefinition; +export default getDef; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/anyRequired.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/anyRequired.js new file mode 100644 index 000000000..0870ce39e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/anyRequired.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const _required_1 = __importDefault(require("./_required")); +const getDef = (0, _required_1.default)("anyRequired"); +exports.default = getDef; +module.exports = getDef; +//# sourceMappingURL=anyRequired.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/anyRequired.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/anyRequired.js.map new file mode 100644 index 000000000..af1a67bff --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/anyRequired.js.map @@ -0,0 +1 @@ +{"version":3,"file":"anyRequired.js","sourceRoot":"","sources":["../../src/definitions/anyRequired.ts"],"names":[],"mappings":";;;;;AAEA,4DAAwC;AAExC,MAAM,MAAM,GAA0C,IAAA,mBAAc,EAAC,aAAa,CAAC,CAAA;AAEnF,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepProperties.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepProperties.d.ts new file mode 100644 index 000000000..ed185656f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepProperties.d.ts @@ -0,0 +1,3 @@ +import type { MacroKeywordDefinition } from "ajv"; +import type { DefinitionOptions } from "./_types"; +export default function getDef(opts?: DefinitionOptions): MacroKeywordDefinition; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepProperties.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepProperties.js new file mode 100644 index 000000000..a567d7b91 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepProperties.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const _util_1 = require("./_util"); +function getDef(opts) { + return { + keyword: "deepProperties", + type: "object", + schemaType: "object", + macro: function (schema) { + const allOf = []; + for (const pointer in schema) + allOf.push(getSchema(pointer, schema[pointer])); + return { allOf }; + }, + metaSchema: { + type: "object", + propertyNames: { type: "string", format: "json-pointer" }, + additionalProperties: (0, _util_1.metaSchemaRef)(opts), + }, + }; +} +exports.default = getDef; +function getSchema(jsonPointer, schema) { + const segments = jsonPointer.split("/"); + const rootSchema = {}; + let pointerSchema = rootSchema; + for (let i = 1; i < segments.length; i++) { + let segment = segments[i]; + const isLast = i === segments.length - 1; + segment = unescapeJsonPointer(segment); + const properties = (pointerSchema.properties = {}); + let items; + if (/[0-9]+/.test(segment)) { + let count = +segment; + items = pointerSchema.items = []; + pointerSchema.type = ["object", "array"]; + while (count--) + items.push({}); + } + else { + pointerSchema.type = "object"; + } + pointerSchema = isLast ? schema : {}; + properties[segment] = pointerSchema; + if (items) + items.push(pointerSchema); + } + return rootSchema; +} +function unescapeJsonPointer(str) { + return str.replace(/~1/g, "/").replace(/~0/g, "~"); +} +module.exports = getDef; +//# sourceMappingURL=deepProperties.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepProperties.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepProperties.js.map new file mode 100644 index 000000000..782bd04aa --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"deepProperties.js","sourceRoot":"","sources":["../../src/definitions/deepProperties.ts"],"names":[],"mappings":";;AAEA,mCAAqC;AAErC,SAAwB,MAAM,CAAC,IAAwB;IACrD,OAAO;QACL,OAAO,EAAE,gBAAgB;QACzB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,QAAQ;QACpB,KAAK,EAAE,UAAU,MAAoC;YACnD,MAAM,KAAK,GAAG,EAAE,CAAA;YAChB,KAAK,MAAM,OAAO,IAAI,MAAM;gBAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;YAC7E,OAAO,EAAC,KAAK,EAAC,CAAA;QAChB,CAAC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAC;YACvD,oBAAoB,EAAE,IAAA,qBAAa,EAAC,IAAI,CAAC;SAC1C;KACF,CAAA;AACH,CAAC;AAhBD,yBAgBC;AAED,SAAS,SAAS,CAAC,WAAmB,EAAE,MAAoB;IAC1D,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACvC,MAAM,UAAU,GAAiB,EAAE,CAAA;IACnC,IAAI,aAAa,GAAiB,UAAU,CAAA;IAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACxC,IAAI,OAAO,GAAW,QAAQ,CAAC,CAAC,CAAC,CAAA;QACjC,MAAM,MAAM,GAAG,CAAC,KAAK,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAA;QACxC,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAA;QACtC,MAAM,UAAU,GAA2B,CAAC,aAAa,CAAC,UAAU,GAAG,EAAE,CAAC,CAAA;QAC1E,IAAI,KAAiC,CAAA;QACrC,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YAC1B,IAAI,KAAK,GAAG,CAAC,OAAO,CAAA;YACpB,KAAK,GAAG,aAAa,CAAC,KAAK,GAAG,EAAE,CAAA;YAChC,aAAa,CAAC,IAAI,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;YACxC,OAAO,KAAK,EAAE;gBAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;SAC/B;aAAM;YACL,aAAa,CAAC,IAAI,GAAG,QAAQ,CAAA;SAC9B;QACD,aAAa,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAA;QACpC,UAAU,CAAC,OAAO,CAAC,GAAG,aAAa,CAAA;QACnC,IAAI,KAAK;YAAE,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;KACrC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AAED,SAAS,mBAAmB,CAAC,GAAW;IACtC,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AACpD,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepRequired.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepRequired.d.ts new file mode 100644 index 000000000..79993ed83 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepRequired.d.ts @@ -0,0 +1,2 @@ +import type { CodeKeywordDefinition } from "ajv"; +export default function getDef(): CodeKeywordDefinition; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepRequired.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepRequired.js new file mode 100644 index 000000000..2aa8bbfc8 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepRequired.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("ajv/dist/compile/codegen"); +function getDef() { + return { + keyword: "deepRequired", + type: "object", + schemaType: "array", + code(ctx) { + const { schema, data } = ctx; + const props = schema.map((jp) => (0, codegen_1._) `(${getData(jp)}) === undefined`); + ctx.fail((0, codegen_1.or)(...props)); + function getData(jsonPointer) { + if (jsonPointer === "") + throw new Error("empty JSON pointer not allowed"); + const segments = jsonPointer.split("/"); + let x = data; + const xs = segments.map((s, i) => i ? (x = (0, codegen_1._) `${x}${(0, codegen_1.getProperty)(unescapeJPSegment(s))}`) : x); + return (0, codegen_1.and)(...xs); + } + }, + metaSchema: { + type: "array", + items: { type: "string", format: "json-pointer" }, + }, + }; +} +exports.default = getDef; +function unescapeJPSegment(s) { + return s.replace(/~1/g, "/").replace(/~0/g, "~"); +} +module.exports = getDef; +//# sourceMappingURL=deepRequired.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepRequired.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepRequired.js.map new file mode 100644 index 000000000..a632916ca --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/deepRequired.js.map @@ -0,0 +1 @@ +{"version":3,"file":"deepRequired.js","sourceRoot":"","sources":["../../src/definitions/deepRequired.ts"],"names":[],"mappings":";;AACA,sDAAsE;AAEtE,SAAwB,MAAM;IAC5B,OAAO;QACL,OAAO,EAAE,cAAc;QACvB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,OAAO;QACnB,IAAI,CAAC,GAAe;YAClB,MAAM,EAAC,MAAM,EAAE,IAAI,EAAC,GAAG,GAAG,CAAA;YAC1B,MAAM,KAAK,GAAI,MAAmB,CAAC,GAAG,CAAC,CAAC,EAAU,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,IAAI,OAAO,CAAC,EAAE,CAAC,iBAAiB,CAAC,CAAA;YACzF,GAAG,CAAC,IAAI,CAAC,IAAA,YAAE,EAAC,GAAG,KAAK,CAAC,CAAC,CAAA;YAEtB,SAAS,OAAO,CAAC,WAAmB;gBAClC,IAAI,WAAW,KAAK,EAAE;oBAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;gBACzE,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;gBACvC,IAAI,CAAC,GAAS,IAAI,CAAA;gBAClB,MAAM,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC/B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAA,WAAC,EAAA,GAAG,CAAC,GAAG,IAAA,qBAAW,EAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAC1D,CAAA;gBACD,OAAO,IAAA,aAAG,EAAC,GAAG,EAAE,CAAC,CAAA;YACnB,CAAC;QACH,CAAC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAC;SAChD;KACF,CAAA;AACH,CAAC;AAzBD,yBAyBC;AAED,SAAS,iBAAiB,CAAC,CAAS;IAClC,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AAClD,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.d.ts new file mode 100644 index 000000000..702fb0abd --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.d.ts @@ -0,0 +1,7 @@ +import type { FuncKeywordDefinition } from "ajv"; +export declare type DynamicDefaultFunc = (args?: Record) => () => any; +declare const DEFAULTS: Record; +declare const getDef: (() => FuncKeywordDefinition) & { + DEFAULTS: typeof DEFAULTS; +}; +export default getDef; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.js new file mode 100644 index 000000000..eada65ef9 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.js @@ -0,0 +1,84 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const sequences = {}; +const DEFAULTS = { + timestamp: () => () => Date.now(), + datetime: () => () => new Date().toISOString(), + date: () => () => new Date().toISOString().slice(0, 10), + time: () => () => new Date().toISOString().slice(11), + random: () => () => Math.random(), + randomint: (args) => { + var _a; + const max = (_a = args === null || args === void 0 ? void 0 : args.max) !== null && _a !== void 0 ? _a : 2; + return () => Math.floor(Math.random() * max); + }, + seq: (args) => { + var _a; + const name = (_a = args === null || args === void 0 ? void 0 : args.name) !== null && _a !== void 0 ? _a : ""; + sequences[name] || (sequences[name] = 0); + return () => sequences[name]++; + }, +}; +const getDef = Object.assign(_getDef, { DEFAULTS }); +function _getDef() { + return { + keyword: "dynamicDefaults", + type: "object", + schemaType: ["string", "object"], + modifying: true, + valid: true, + compile(schema, _parentSchema, it) { + if (!it.opts.useDefaults || it.compositeRule) + return () => true; + const fs = {}; + for (const key in schema) + fs[key] = getDefault(schema[key]); + const empty = it.opts.useDefaults === "empty"; + return (data) => { + for (const prop in schema) { + if (data[prop] === undefined || (empty && (data[prop] === null || data[prop] === ""))) { + data[prop] = fs[prop](); + } + } + return true; + }; + }, + metaSchema: { + type: "object", + additionalProperties: { + anyOf: [ + { type: "string" }, + { + type: "object", + additionalProperties: false, + required: ["func", "args"], + properties: { + func: { type: "string" }, + args: { type: "object" }, + }, + }, + ], + }, + }, + }; +} +function getDefault(d) { + return typeof d == "object" ? getObjDefault(d) : getStrDefault(d); +} +function getObjDefault({ func, args }) { + const def = DEFAULTS[func]; + assertDefined(func, def); + return def(args); +} +function getStrDefault(d = "") { + const def = DEFAULTS[d]; + assertDefined(d, def); + return def(); +} +function assertDefined(name, def) { + if (!def) + throw new Error(`invalid "dynamicDefaults" keyword property value: ${name}`); +} +exports.default = getDef; +module.exports = getDef; +//# sourceMappingURL=dynamicDefaults.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.js.map new file mode 100644 index 000000000..95e8170e6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/dynamicDefaults.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamicDefaults.js","sourceRoot":"","sources":["../../src/definitions/dynamicDefaults.ts"],"names":[],"mappings":";;AAEA,MAAM,SAAS,GAAuC,EAAE,CAAA;AAIxD,MAAM,QAAQ,GAAmD;IAC/D,SAAS,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;IACjC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;IAC9C,IAAI,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;IACvD,IAAI,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC;IACpD,MAAM,EAAE,GAAG,EAAE,CAAC,GAA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AAG,EAAE;IAC3B,MAAM,GAAG,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAA;IACvB,aAAa,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;IACrB,OAAO,GAAG,EAAE,CAAA;AACd,CAAC;AAED,SAAS,aAAa,CAAC,IAAY,EAAE,GAAwB;IAC3D,IAAI,CAAC,GAAG;QAAE,MAAM,IAAI,KAAK,CAAC,qDAAqD,IAAI,EAAE,CAAC,CAAA;AACxF,CAAC;AAED,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/exclusiveRange.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/exclusiveRange.d.ts new file mode 100644 index 000000000..a14c2cf7c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/exclusiveRange.d.ts @@ -0,0 +1,4 @@ +import type { MacroKeywordDefinition } from "ajv"; +import type { GetDefinition } from "./_types"; +declare const getDef: GetDefinition; +export default getDef; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/exclusiveRange.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/exclusiveRange.js new file mode 100644 index 000000000..cee3febb9 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/exclusiveRange.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const _range_1 = __importDefault(require("./_range")); +const getDef = (0, _range_1.default)("exclusiveRange"); +exports.default = getDef; +module.exports = getDef; +//# sourceMappingURL=exclusiveRange.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/exclusiveRange.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/exclusiveRange.js.map new file mode 100644 index 000000000..aa43025a4 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/exclusiveRange.js.map @@ -0,0 +1 @@ +{"version":3,"file":"exclusiveRange.js","sourceRoot":"","sources":["../../src/definitions/exclusiveRange.ts"],"names":[],"mappings":";;;;;AAEA,sDAAkC;AAElC,MAAM,MAAM,GAA0C,IAAA,gBAAW,EAAC,gBAAgB,CAAC,CAAA;AAEnF,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/index.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/index.d.ts new file mode 100644 index 000000000..326d6847e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/index.d.ts @@ -0,0 +1,6 @@ +import type { Vocabulary, ErrorNoParams } from "ajv"; +import type { DefinitionOptions } from "./_types"; +import { PatternRequiredError } from "./patternRequired"; +import { SelectError } from "./select"; +export default function ajvKeywords(opts?: DefinitionOptions): Vocabulary; +export declare type AjvKeywordsError = PatternRequiredError | SelectError | ErrorNoParams<"range" | "exclusiveRange" | "anyRequired" | "oneRequired" | "allRequired" | "deepProperties" | "deepRequired" | "dynamicDefaults" | "instanceof" | "prohibited" | "regexp" | "transform" | "uniqueItemProperties">; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/index.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/index.js new file mode 100644 index 000000000..94ae44e8c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/index.js @@ -0,0 +1,44 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const typeof_1 = __importDefault(require("./typeof")); +const instanceof_1 = __importDefault(require("./instanceof")); +const range_1 = __importDefault(require("./range")); +const exclusiveRange_1 = __importDefault(require("./exclusiveRange")); +const regexp_1 = __importDefault(require("./regexp")); +const transform_1 = __importDefault(require("./transform")); +const uniqueItemProperties_1 = __importDefault(require("./uniqueItemProperties")); +const allRequired_1 = __importDefault(require("./allRequired")); +const anyRequired_1 = __importDefault(require("./anyRequired")); +const oneRequired_1 = __importDefault(require("./oneRequired")); +const patternRequired_1 = __importDefault(require("./patternRequired")); +const prohibited_1 = __importDefault(require("./prohibited")); +const deepProperties_1 = __importDefault(require("./deepProperties")); +const deepRequired_1 = __importDefault(require("./deepRequired")); +const dynamicDefaults_1 = __importDefault(require("./dynamicDefaults")); +const select_1 = __importDefault(require("./select")); +const definitions = [ + typeof_1.default, + instanceof_1.default, + range_1.default, + exclusiveRange_1.default, + regexp_1.default, + transform_1.default, + uniqueItemProperties_1.default, + allRequired_1.default, + anyRequired_1.default, + oneRequired_1.default, + patternRequired_1.default, + prohibited_1.default, + deepProperties_1.default, + deepRequired_1.default, + dynamicDefaults_1.default, +]; +function ajvKeywords(opts) { + return definitions.map((d) => d(opts)).concat((0, select_1.default)(opts)); +} +exports.default = ajvKeywords; +module.exports = ajvKeywords; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/index.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/index.js.map new file mode 100644 index 000000000..07d353026 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definitions/index.ts"],"names":[],"mappings":";;;;;AAEA,sDAAgC;AAChC,8DAAwC;AACxC,oDAA2B;AAC3B,sEAA6C;AAC7C,sDAA6B;AAC7B,4DAAmC;AACnC,kFAAyD;AACzD,gEAAuC;AACvC,gEAAuC;AACvC,gEAAuC;AACvC,wEAAuE;AACvE,8DAAqC;AACrC,sEAA6C;AAC7C,kEAAyC;AACzC,wEAA+C;AAC/C,sDAA+C;AAE/C,MAAM,WAAW,GAAuC;IACtD,gBAAS;IACT,oBAAa;IACb,eAAK;IACL,wBAAc;IACd,gBAAM;IACN,mBAAS;IACT,8BAAoB;IACpB,qBAAW;IACX,qBAAW;IACX,qBAAW;IACX,yBAAe;IACf,oBAAU;IACV,wBAAc;IACd,sBAAY;IACZ,yBAAe;CAChB,CAAA;AAED,SAAwB,WAAW,CAAC,IAAwB;IAC1D,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAA,gBAAS,EAAC,IAAI,CAAC,CAAC,CAAA;AAChE,CAAC;AAFD,8BAEC;AAqBD,MAAM,CAAC,OAAO,GAAG,WAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/instanceof.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/instanceof.d.ts new file mode 100644 index 000000000..05726f1f7 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/instanceof.d.ts @@ -0,0 +1,7 @@ +import type { FuncKeywordDefinition } from "ajv"; +declare type Constructor = new (...args: any[]) => any; +declare const CONSTRUCTORS: Record; +declare const getDef: (() => FuncKeywordDefinition) & { + CONSTRUCTORS: typeof CONSTRUCTORS; +}; +export default getDef; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/instanceof.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/instanceof.js new file mode 100644 index 000000000..034fb6419 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/instanceof.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const CONSTRUCTORS = { + Object, + Array, + Function, + Number, + String, + Date, + RegExp, +}; +/* istanbul ignore else */ +if (typeof Buffer != "undefined") + CONSTRUCTORS.Buffer = Buffer; +/* istanbul ignore else */ +if (typeof Promise != "undefined") + CONSTRUCTORS.Promise = Promise; +const getDef = Object.assign(_getDef, { CONSTRUCTORS }); +function _getDef() { + return { + keyword: "instanceof", + schemaType: ["string", "array"], + compile(schema) { + if (typeof schema == "string") { + const C = getConstructor(schema); + return (data) => data instanceof C; + } + if (Array.isArray(schema)) { + const constructors = schema.map(getConstructor); + return (data) => { + for (const C of constructors) { + if (data instanceof C) + return true; + } + return false; + }; + } + /* istanbul ignore next */ + throw new Error("ajv implementation error"); + }, + metaSchema: { + anyOf: [{ type: "string" }, { type: "array", items: { type: "string" } }], + }, + }; +} +function getConstructor(c) { + const C = CONSTRUCTORS[c]; + if (C) + return C; + throw new Error(`invalid "instanceof" keyword value ${c}`); +} +exports.default = getDef; +module.exports = getDef; +//# sourceMappingURL=instanceof.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/instanceof.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/instanceof.js.map new file mode 100644 index 000000000..d401cd777 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/instanceof.js.map @@ -0,0 +1 @@ +{"version":3,"file":"instanceof.js","sourceRoot":"","sources":["../../src/definitions/instanceof.ts"],"names":[],"mappings":";;AAIA,MAAM,YAAY,GAA4C;IAC5D,MAAM;IACN,KAAK;IACL,QAAQ;IACR,MAAM;IACN,MAAM;IACN,IAAI;IACJ,MAAM;CACP,CAAA;AAED,0BAA0B;AAC1B,IAAI,OAAO,MAAM,IAAI,WAAW;IAAE,YAAY,CAAC,MAAM,GAAG,MAAM,CAAA;AAE9D,0BAA0B;AAC1B,IAAI,OAAO,OAAO,IAAI,WAAW;IAAE,YAAY,CAAC,OAAO,GAAG,OAAO,CAAA;AAEjE,MAAM,MAAM,GAER,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAC,YAAY,EAAC,CAAC,CAAA;AAE1C,SAAS,OAAO;IACd,OAAO;QACL,OAAO,EAAE,YAAY;QACrB,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;QAC/B,OAAO,CAAC,MAAyB;YAC/B,IAAI,OAAO,MAAM,IAAI,QAAQ,EAAE;gBAC7B,MAAM,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAA;gBAChC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,YAAY,CAAC,CAAA;aACnC;YAED,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;gBACzB,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;gBAC/C,OAAO,CAAC,IAAI,EAAE,EAAE;oBACd,KAAK,MAAM,CAAC,IAAI,YAAY,EAAE;wBAC5B,IAAI,IAAI,YAAY,CAAC;4BAAE,OAAO,IAAI,CAAA;qBACnC;oBACD,OAAO,KAAK,CAAA;gBACd,CAAC,CAAA;aACF;YAED,0BAA0B;YAC1B,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC7C,CAAC;QACD,UAAU,EAAE;YACV,KAAK,EAAE,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAE,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAC,CAAC;SACpE;KACF,CAAA;AACH,CAAC;AAED,SAAS,cAAc,CAAC,CAAS;IAC/B,MAAM,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;IACzB,IAAI,CAAC;QAAE,OAAO,CAAC,CAAA;IACf,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,EAAE,CAAC,CAAA;AAC5D,CAAC;AAED,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/oneRequired.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/oneRequired.d.ts new file mode 100644 index 000000000..a14c2cf7c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/oneRequired.d.ts @@ -0,0 +1,4 @@ +import type { MacroKeywordDefinition } from "ajv"; +import type { GetDefinition } from "./_types"; +declare const getDef: GetDefinition; +export default getDef; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/oneRequired.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/oneRequired.js new file mode 100644 index 000000000..ae46c30cc --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/oneRequired.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const _required_1 = __importDefault(require("./_required")); +const getDef = (0, _required_1.default)("oneRequired"); +exports.default = getDef; +module.exports = getDef; +//# sourceMappingURL=oneRequired.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/oneRequired.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/oneRequired.js.map new file mode 100644 index 000000000..134a1d934 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/oneRequired.js.map @@ -0,0 +1 @@ +{"version":3,"file":"oneRequired.js","sourceRoot":"","sources":["../../src/definitions/oneRequired.ts"],"names":[],"mappings":";;;;;AAEA,4DAAwC;AAExC,MAAM,MAAM,GAA0C,IAAA,mBAAc,EAAC,aAAa,CAAC,CAAA;AAEnF,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/patternRequired.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/patternRequired.d.ts new file mode 100644 index 000000000..95b8eb525 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/patternRequired.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition, ErrorObject } from "ajv"; +export declare type PatternRequiredError = ErrorObject<"patternRequired", { + missingPattern: string; +}>; +export default function getDef(): CodeKeywordDefinition; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/patternRequired.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/patternRequired.js new file mode 100644 index 000000000..ca24e642f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/patternRequired.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("ajv/dist/compile/codegen"); +const _util_1 = require("./_util"); +const error = { + message: ({ params: { missingPattern } }) => (0, codegen_1.str) `should have property matching pattern '${missingPattern}'`, + params: ({ params: { missingPattern } }) => (0, codegen_1._) `{missingPattern: ${missingPattern}}`, +}; +function getDef() { + return { + keyword: "patternRequired", + type: "object", + schemaType: "array", + error, + code(cxt) { + const { gen, schema, data } = cxt; + if (schema.length === 0) + return; + const valid = gen.let("valid", true); + for (const pat of schema) + validateProperties(pat); + function validateProperties(pattern) { + const matched = gen.let("matched", false); + gen.forIn("key", data, (key) => { + gen.assign(matched, (0, codegen_1._) `${(0, _util_1.usePattern)(cxt, pattern)}.test(${key})`); + gen.if(matched, () => gen.break()); + }); + cxt.setParams({ missingPattern: pattern }); + gen.assign(valid, (0, codegen_1.and)(valid, matched)); + cxt.pass(valid); + } + }, + metaSchema: { + type: "array", + items: { type: "string", format: "regex" }, + uniqueItems: true, + }, + }; +} +exports.default = getDef; +module.exports = getDef; +//# sourceMappingURL=patternRequired.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/patternRequired.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/patternRequired.js.map new file mode 100644 index 000000000..17b095f81 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/patternRequired.js.map @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AAC,KAAK,EAAE,CAAC,CAAA;gBACpC,CAAC,CAAC,CAAA;gBAEF,GAAG,CAAC,SAAS,CAAC,EAAC,cAAc,EAAE,OAAO,EAAC,CAAC,CAAA;gBACxC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAA,aAAG,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAA;gBACtC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACjB,CAAC;QACH,CAAC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAC;YACxC,WAAW,EAAE,IAAI;SAClB;KACF,CAAA;AACH,CAAC;AA/BD,yBA+BC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/prohibited.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/prohibited.d.ts new file mode 100644 index 000000000..ac709be9e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/prohibited.d.ts @@ -0,0 +1,2 @@ +import type { MacroKeywordDefinition } from "ajv"; +export default function getDef(): MacroKeywordDefinition; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/prohibited.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/prohibited.js new file mode 100644 index 000000000..9a497460d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/prohibited.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +function getDef() { + return { + keyword: "prohibited", + type: "object", + schemaType: "array", + macro: function (schema) { + if (schema.length === 0) + return true; + if (schema.length === 1) + return { not: { required: schema } }; + return { not: { anyOf: schema.map((p) => ({ required: [p] })) } }; + }, + metaSchema: { + type: "array", + items: { type: "string" }, + }, + }; +} +exports.default = getDef; +module.exports = getDef; +//# sourceMappingURL=prohibited.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/prohibited.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/prohibited.js.map new file mode 100644 index 000000000..1a2deec1e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/prohibited.js.map @@ -0,0 +1 @@ +{"version":3,"file":"prohibited.js","sourceRoot":"","sources":["../../src/definitions/prohibited.ts"],"names":[],"mappings":";;AAEA,SAAwB,MAAM;IAC5B,OAAO;QACL,OAAO,EAAE,YAAY;QACrB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,OAAO;QACnB,KAAK,EAAE,UAAU,MAAgB;YAC/B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,IAAI,CAAA;YACpC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,EAAC,GAAG,EAAE,EAAC,QAAQ,EAAE,MAAM,EAAC,EAAC,CAAA;YACzD,OAAO,EAAC,GAAG,EAAE,EAAC,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC,EAAC,EAAC,CAAA;QAC7D,CAAC;QACD,UAAU,EAAE;YACV,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;SACxB;KACF,CAAA;AACH,CAAC;AAfD,yBAeC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/range.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/range.d.ts new file mode 100644 index 000000000..a14c2cf7c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/range.d.ts @@ -0,0 +1,4 @@ +import type { MacroKeywordDefinition } from "ajv"; +import type { GetDefinition } from "./_types"; +declare const getDef: GetDefinition; +export default getDef; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/range.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/range.js new file mode 100644 index 000000000..aa75c51b9 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/range.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const _range_1 = __importDefault(require("./_range")); +const getDef = (0, _range_1.default)("range"); +exports.default = getDef; +module.exports = getDef; +//# sourceMappingURL=range.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/range.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/range.js.map new file mode 100644 index 000000000..7d9dd5877 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/range.js.map @@ -0,0 +1 @@ +{"version":3,"file":"range.js","sourceRoot":"","sources":["../../src/definitions/range.ts"],"names":[],"mappings":";;;;;AAEA,sDAAkC;AAElC,MAAM,MAAM,GAA0C,IAAA,gBAAW,EAAC,OAAO,CAAC,CAAA;AAE1E,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/regexp.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/regexp.d.ts new file mode 100644 index 000000000..79993ed83 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/regexp.d.ts @@ -0,0 +1,2 @@ +import type { CodeKeywordDefinition } from "ajv"; +export default function getDef(): CodeKeywordDefinition; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/regexp.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/regexp.js new file mode 100644 index 000000000..b3c5a7cc1 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/regexp.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("ajv/dist/compile/codegen"); +const _util_1 = require("./_util"); +const regexpMetaSchema = { + type: "object", + properties: { + pattern: { type: "string" }, + flags: { type: "string", nullable: true }, + }, + required: ["pattern"], + additionalProperties: false, +}; +const metaRegexp = /^\/(.*)\/([gimuy]*)$/; +function getDef() { + return { + keyword: "regexp", + type: "string", + schemaType: ["string", "object"], + code(cxt) { + const { data, schema } = cxt; + const regx = getRegExp(schema); + cxt.pass((0, codegen_1._) `${regx}.test(${data})`); + function getRegExp(sch) { + if (typeof sch == "object") + return (0, _util_1.usePattern)(cxt, sch.pattern, sch.flags); + const rx = metaRegexp.exec(sch); + if (rx) + return (0, _util_1.usePattern)(cxt, rx[1], rx[2]); + throw new Error("cannot parse string into RegExp"); + } + }, + metaSchema: { + anyOf: [{ type: "string" }, regexpMetaSchema], + }, + }; +} +exports.default = getDef; +module.exports = getDef; +//# sourceMappingURL=regexp.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/regexp.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/regexp.js.map new file mode 100644 index 000000000..d389e474d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/regexp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"regexp.js","sourceRoot":"","sources":["../../src/definitions/regexp.ts"],"names":[],"mappings":";;AACA,sDAA0C;AAC1C,mCAAkC;AAOlC,MAAM,gBAAgB,GAAiC;IACrD,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,OAAO,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAC;QACzB,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAC;KACxC;IACD,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrB,oBAAoB,EAAE,KAAK;CAC5B,CAAA;AAED,MAAM,UAAU,GAAG,sBAAsB,CAAA;AAEzC,SAAwB,MAAM;IAC5B,OAAO;QACL,OAAO,EAAE,QAAQ;QACjB,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAChC,IAAI,CAAC,GAAe;YAClB,MAAM,EAAC,IAAI,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;YAC1B,MAAM,IAAI,GAAG,SAAS,CAAC,MAAM,CAAC,CAAA;YAC9B,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,SAAS,IAAI,GAAG,CAAC,CAAA;YAElC,SAAS,SAAS,CAAC,GAA0B;gBAC3C,IAAI,OAAO,GAAG,IAAI,QAAQ;oBAAE,OAAO,IAAA,kBAAU,EAAC,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,CAAA;gBAC1E,MAAM,EAAE,GAAG,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;gBAC/B,IAAI,EAAE;oBAAE,OAAO,IAAA,kBAAU,EAAC,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;gBAC5C,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAA;YACpD,CAAC;QACH,CAAC;QACD,UAAU,EAAE;YACV,KAAK,EAAE,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAE,gBAAgB,CAAC;SAC5C;KACF,CAAA;AACH,CAAC;AArBD,yBAqBC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/select.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/select.d.ts new file mode 100644 index 000000000..d12fc65d1 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/select.d.ts @@ -0,0 +1,7 @@ +import type { KeywordDefinition, ErrorObject } from "ajv"; +import type { DefinitionOptions } from "./_types"; +export declare type SelectError = ErrorObject<"select", { + failingCase?: string; + failingDefault?: true; +}>; +export default function getDef(opts?: DefinitionOptions): KeywordDefinition[]; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/select.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/select.js new file mode 100644 index 000000000..bce677bf8 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/select.js @@ -0,0 +1,63 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("ajv/dist/compile/codegen"); +const _util_1 = require("./_util"); +const error = { + message: ({ params: { schemaProp } }) => schemaProp + ? (0, codegen_1.str) `should match case "${schemaProp}" schema` + : (0, codegen_1.str) `should match default case schema`, + params: ({ params: { schemaProp } }) => schemaProp ? (0, codegen_1._) `{failingCase: ${schemaProp}}` : (0, codegen_1._) `{failingDefault: true}`, +}; +function getDef(opts) { + const metaSchema = (0, _util_1.metaSchemaRef)(opts); + return [ + { + keyword: "select", + schemaType: ["string", "number", "boolean", "null"], + $data: true, + error, + dependencies: ["selectCases"], + code(cxt) { + const { gen, schemaCode, parentSchema } = cxt; + cxt.block$data(codegen_1.nil, () => { + const valid = gen.let("valid", true); + const schValid = gen.name("_valid"); + const value = gen.const("value", (0, codegen_1._) `${schemaCode} === null ? "null" : ${schemaCode}`); + gen.if(false); // optimizer should remove it from generated code + for (const schemaProp in parentSchema.selectCases) { + cxt.setParams({ schemaProp }); + gen.elseIf((0, codegen_1._) `"" + ${value} == ${schemaProp}`); // intentional ==, to match numbers and booleans + const schCxt = cxt.subschema({ keyword: "selectCases", schemaProp }, schValid); + cxt.mergeEvaluated(schCxt, codegen_1.Name); + gen.assign(valid, schValid); + } + gen.else(); + if (parentSchema.selectDefault !== undefined) { + cxt.setParams({ schemaProp: undefined }); + const schCxt = cxt.subschema({ keyword: "selectDefault" }, schValid); + cxt.mergeEvaluated(schCxt, codegen_1.Name); + gen.assign(valid, schValid); + } + gen.endIf(); + cxt.pass(valid); + }); + }, + }, + { + keyword: "selectCases", + dependencies: ["select"], + metaSchema: { + type: "object", + additionalProperties: metaSchema, + }, + }, + { + keyword: "selectDefault", + dependencies: ["select", "selectCases"], + metaSchema, + }, + ]; +} +exports.default = getDef; +module.exports = getDef; +//# sourceMappingURL=select.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/select.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/select.js.map new file mode 100644 index 000000000..1e5a03551 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/select.js.map @@ -0,0 +1 @@ +{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/definitions/select.ts"],"names":[],"mappings":";;AACA,sDAA0D;AAE1D,mCAAqC;AAIrC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,UAAU,EAAC,EAAC,EAAE,EAAE,CAClC,UAAU;QACR,CAAC,CAAC,IAAA,aAAG,EAAA,sBAAsB,UAAU,UAAU;QAC/C,CAAC,CAAC,IAAA,aAAG,EAAA,kCAAkC;IAC3C,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,UAAU,EAAC,EAAC,EAAE,EAAE,CACjC,UAAU,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,iBAAiB,UAAU,GAAG,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,wBAAwB;CAC3E,CAAA;AAED,SAAwB,MAAM,CAAC,IAAwB;IACrD,MAAM,UAAU,GAAG,IAAA,qBAAa,EAAC,IAAI,CAAC,CAAA;IAEtC,OAAO;QACL;YACE,OAAO,EAAE,QAAQ;YACjB,UAAU,EAAE,CAAC,QAAQ,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AC,CAAA;wBACtC,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,eAAe,EAAC,EAAE,QAAQ,CAAC,CAAA;wBAClE,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,cAAI,CAAC,CAAA;wBAChC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;qBAC5B;oBACD,GAAG,CAAC,KAAK,EAAE,CAAA;oBACX,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;gBACjB,CAAC,CAAC,CAAA;YACJ,CAAC;SACF;QACD;YACE,OAAO,EAAE,aAAa;YACtB,YAAY,EAAE,CAAC,QAAQ,CAAC;YACxB,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,oBAAoB,EAAE,UAAU;aACjC;SACF;QACD;YACE,OAAO,EAAE,eAAe;YACxB,YAAY,EAAE,CAAC,QAAQ,EAAE,aAAa,CAAC;YACvC,UAAU;SACX;KACF,CAAA;AACH,CAAC;AAlDD,yBAkDC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/transform.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/transform.d.ts new file mode 100644 index 000000000..551c46eaa --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/transform.d.ts @@ -0,0 +1,13 @@ +import type { CodeKeywordDefinition } from "ajv"; +declare type TransformName = "trimStart" | "trimEnd" | "trimLeft" | "trimRight" | "trim" | "toLowerCase" | "toUpperCase" | "toEnumCase"; +interface TransformConfig { + hash: Record; +} +declare type Transform = (s: string, cfg?: TransformConfig) => string; +declare const transform: { + [key in TransformName]: Transform; +}; +declare const getDef: (() => CodeKeywordDefinition) & { + transform: typeof transform; +}; +export default getDef; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/transform.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/transform.js new file mode 100644 index 000000000..17128de40 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/transform.js @@ -0,0 +1,78 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("ajv/dist/compile/codegen"); +const transform = { + trimStart: (s) => s.trimStart(), + trimEnd: (s) => s.trimEnd(), + trimLeft: (s) => s.trimStart(), + trimRight: (s) => s.trimEnd(), + trim: (s) => s.trim(), + toLowerCase: (s) => s.toLowerCase(), + toUpperCase: (s) => s.toUpperCase(), + toEnumCase: (s, cfg) => (cfg === null || cfg === void 0 ? void 0 : cfg.hash[configKey(s)]) || s, +}; +const getDef = Object.assign(_getDef, { transform }); +function _getDef() { + return { + keyword: "transform", + schemaType: "array", + before: "enum", + code(cxt) { + const { gen, data, schema, parentSchema, it } = cxt; + const { parentData, parentDataProperty } = it; + const tNames = schema; + if (!tNames.length) + return; + let cfg; + if (tNames.includes("toEnumCase")) { + const config = getEnumCaseCfg(parentSchema); + cfg = gen.scopeValue("obj", { ref: config, code: (0, codegen_1.stringify)(config) }); + } + gen.if((0, codegen_1._) `typeof ${data} == "string" && ${parentData} !== undefined`, () => { + gen.assign(data, transformExpr(tNames.slice())); + gen.assign((0, codegen_1._) `${parentData}[${parentDataProperty}]`, data); + }); + function transformExpr(ts) { + if (!ts.length) + return data; + const t = ts.pop(); + if (!(t in transform)) + throw new Error(`transform: unknown transformation ${t}`); + const func = gen.scopeValue("func", { + ref: transform[t], + code: (0, codegen_1._) `require("ajv-keywords/dist/definitions/transform").transform${(0, codegen_1.getProperty)(t)}`, + }); + const arg = transformExpr(ts); + return cfg && t === "toEnumCase" ? (0, codegen_1._) `${func}(${arg}, ${cfg})` : (0, codegen_1._) `${func}(${arg})`; + } + }, + metaSchema: { + type: "array", + items: { type: "string", enum: Object.keys(transform) }, + }, + }; +} +function getEnumCaseCfg(parentSchema) { + // build hash table to enum values + const cfg = { hash: {} }; + // requires `enum` in the same schema as transform + if (!parentSchema.enum) + throw new Error('transform: "toEnumCase" requires "enum"'); + for (const v of parentSchema.enum) { + if (typeof v !== "string") + continue; + const k = configKey(v); + // requires all `enum` values have unique keys + if (cfg.hash[k]) { + throw new Error('transform: "toEnumCase" requires all lowercased "enum" values to be unique'); + } + cfg.hash[k] = v; + } + return cfg; +} +function configKey(s) { + return s.toLowerCase(); +} +exports.default = getDef; +module.exports = getDef; +//# sourceMappingURL=transform.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/transform.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/transform.js.map new file mode 100644 index 000000000..82220dcff --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/transform.js.map @@ -0,0 +1 @@ +{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../src/definitions/transform.ts"],"names":[],"mappings":";;AACA,sDAAkE;AAkBlE,MAAM,SAAS,GAAwC;IACrD,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE;IAC/B,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE;IAC3B,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE;IAC9B,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE;IAC7B,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE;IACrB,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE;IACnC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE;IACnC,UAAU,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,CAAA,GAAG,aAAH,GAAG,uBAAH,GAAG,CAAE,IAAI,CAAC,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,CAAC,CAAC,EAAE;YACf,MAAM,IAAI,KAAK,CAAC,4EAA4E,CAAC,CAAA;SAC9F;QACD,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;KAChB;IAED,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,SAAS,SAAS,CAAC,CAAS;IAC1B,OAAO,CAAC,CAAC,WAAW,EAAE,CAAA;AACxB,CAAC;AAED,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/typeof.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/typeof.d.ts new file mode 100644 index 000000000..79993ed83 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/typeof.d.ts @@ -0,0 +1,2 @@ +import type { CodeKeywordDefinition } from "ajv"; +export default function getDef(): CodeKeywordDefinition; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/typeof.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/typeof.js new file mode 100644 index 000000000..5bb2b0202 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/typeof.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("ajv/dist/compile/codegen"); +const TYPES = ["undefined", "string", "number", "object", "function", "boolean", "symbol"]; +function getDef() { + return { + keyword: "typeof", + schemaType: ["string", "array"], + code(cxt) { + const { data, schema, schemaValue } = cxt; + cxt.fail(typeof schema == "string" + ? (0, codegen_1._) `typeof ${data} != ${schema}` + : (0, codegen_1._) `${schemaValue}.indexOf(typeof ${data}) < 0`); + }, + metaSchema: { + anyOf: [ + { type: "string", enum: TYPES }, + { type: "array", items: { type: "string", enum: TYPES } }, + ], + }, + }; +} +exports.default = getDef; +module.exports = getDef; +//# sourceMappingURL=typeof.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/typeof.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/typeof.js.map new file mode 100644 index 000000000..918d3ff1e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/typeof.js.map @@ -0,0 +1 @@ +{"version":3,"file":"typeof.js","sourceRoot":"","sources":["../../src/definitions/typeof.ts"],"names":[],"mappings":";;AACA,sDAA0C;AAE1C,MAAM,KAAK,GAAG,CAAC,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAA;AAE1F,SAAwB,MAAM;IAC5B,OAAO;QACL,OAAO,EAAE,QAAQ;QACjB,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;QAC/B,IAAI,CAAC,GAAe;YAClB,MAAM,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAC,GAAG,GAAG,CAAA;YACvC,GAAG,CAAC,IAAI,CACN,OAAO,MAAM,IAAI,QAAQ;gBACvB,CAAC,CAAC,IAAA,WAAC,EAAA,UAAU,IAAI,OAAO,MAAM,EAAE;gBAChC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,WAAW,mBAAmB,IAAI,OAAO,CAClD,CAAA;QACH,CAAC;QACD,UAAU,EAAE;YACV,KAAK,EAAE;gBACL,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAC;gBAC7B,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAC,EAAC;aACtD;SACF;KACF,CAAA;AACH,CAAC;AAnBD,yBAmBC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.d.ts new file mode 100644 index 000000000..d83655951 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.d.ts @@ -0,0 +1,2 @@ +import type { FuncKeywordDefinition } from "ajv"; +export default function getDef(): FuncKeywordDefinition; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.js new file mode 100644 index 000000000..1758209a7 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.js @@ -0,0 +1,65 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const equal = require("fast-deep-equal"); +const SCALAR_TYPES = ["number", "integer", "string", "boolean", "null"]; +function getDef() { + return { + keyword: "uniqueItemProperties", + type: "array", + schemaType: "array", + compile(keys, parentSchema) { + const scalar = getScalarKeys(keys, parentSchema); + return (data) => { + if (data.length <= 1) + return true; + for (let k = 0; k < keys.length; k++) { + const key = keys[k]; + if (scalar[k]) { + const hash = {}; + for (const x of data) { + if (!x || typeof x != "object") + continue; + let p = x[key]; + if (p && typeof p == "object") + continue; + if (typeof p == "string") + p = '"' + p; + if (hash[p]) + return false; + hash[p] = true; + } + } + else { + for (let i = data.length; i--;) { + const x = data[i]; + if (!x || typeof x != "object") + continue; + for (let j = i; j--;) { + const y = data[j]; + if (y && typeof y == "object" && equal(x[key], y[key])) + return false; + } + } + } + } + return true; + }; + }, + metaSchema: { + type: "array", + items: { type: "string" }, + }, + }; +} +exports.default = getDef; +function getScalarKeys(keys, schema) { + return keys.map((key) => { + var _a, _b, _c; + const t = (_c = (_b = (_a = schema.items) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b[key]) === null || _c === void 0 ? void 0 : _c.type; + return Array.isArray(t) + ? !t.includes("object") && !t.includes("array") + : SCALAR_TYPES.includes(t); + }); +} +module.exports = getDef; +//# sourceMappingURL=uniqueItemProperties.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.js.map new file mode 100644 index 000000000..c0619c26b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/definitions/uniqueItemProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uniqueItemProperties.js","sourceRoot":"","sources":["../../src/definitions/uniqueItemProperties.ts"],"names":[],"mappings":";;AACA,yCAAyC;AAEzC,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,CAAA;AAEvE,SAAwB,MAAM;IAC5B,OAAO;QACL,OAAO,EAAE,sBAAsB;QAC/B,IAAI,EAAE,OAAO;QACb,UAAU,EAAE,OAAO;QACnB,OAAO,CAAC,IAAc,EAAE,YAA6B;YACnD,MAAM,MAAM,GAAG,aAAa,CAAC,IAAI,EAAE,YAAY,CAAC,CAAA;YAEhD,OAAO,CAAC,IAAI,EAAE,EAAE;gBACd,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC;oBAAE,OAAO,IAAI,CAAA;gBACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACpC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;oBACnB,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE;wBACb,MAAM,IAAI,GAAwB,EAAE,CAAA;wBACpC,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE;4BACpB,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,IAAI,QAAQ;gCAAE,SAAQ;4BACxC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;4BACd,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,QAAQ;gCAAE,S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CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC;YAC/C,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC9B,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/index.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/index.d.ts new file mode 100644 index 000000000..fc5b7a943 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/index.d.ts @@ -0,0 +1,4 @@ +import type { Plugin } from "ajv"; +export { AjvKeywordsError } from "./definitions"; +declare const ajvKeywords: Plugin; +export default ajvKeywords; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/index.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/index.js new file mode 100644 index 000000000..d0d3d8b2b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/index.js @@ -0,0 +1,32 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const keywords_1 = __importDefault(require("./keywords")); +const ajvKeywords = (ajv, keyword) => { + if (Array.isArray(keyword)) { + for (const k of keyword) + get(k)(ajv); + return ajv; + } + if (keyword) { + get(keyword)(ajv); + return ajv; + } + for (keyword in keywords_1.default) + get(keyword)(ajv); + return ajv; +}; +ajvKeywords.get = get; +function get(keyword) { + const defFunc = keywords_1.default[keyword]; + if (!defFunc) + throw new Error("Unknown keyword " + keyword); + return defFunc; +} +exports.default = ajvKeywords; +module.exports = ajvKeywords; +// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access +module.exports.default = ajvKeywords; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/index.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/index.js.map new file mode 100644 index 000000000..2f472f1e3 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAEA,0DAAgC;AAIhC,MAAM,WAAW,GAA8B,CAAC,GAAQ,EAAE,OAA2B,EAAO,EAAE;IAC5F,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QAC1B,KAAK,MAAM,CAAC,IAAI,OAAO;YAAE,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAA;QACpC,OAAO,GAAG,CAAA;KACX;IACD,IAAI,OAAO,EAAE;QACX,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAA;QACjB,OAAO,GAAG,CAAA;KACX;IACD,KAAK,OAAO,IAAI,kBAAO;QAAE,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAA;IAC1C,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,WAAW,CAAC,GAAG,GAAG,GAAG,CAAA;AAErB,SAAS,GAAG,CAAC,OAAe;IAC1B,MAAM,OAAO,GAAG,kBAAO,CAAC,OAAO,CAAC,CAAA;IAChC,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,GAAG,OAAO,CAAC,CAAA;IAC3D,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,kBAAe,WAAW,CAAA;AAC1B,MAAM,CAAC,OAAO,GAAG,WAAW,CAAA;AAE5B,sEAAsE;AACtE,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,WAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/allRequired.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/allRequired.d.ts new file mode 100644 index 000000000..97dd12137 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/allRequired.d.ts @@ -0,0 +1,3 @@ +import type { Plugin } from "ajv"; +declare const allRequired: Plugin; +export default allRequired; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/allRequired.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/allRequired.js new file mode 100644 index 000000000..aaf656377 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/allRequired.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const allRequired_1 = __importDefault(require("../definitions/allRequired")); +const allRequired = (ajv) => ajv.addKeyword((0, allRequired_1.default)()); +exports.default = allRequired; +module.exports = allRequired; +//# sourceMappingURL=allRequired.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/allRequired.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/allRequired.js.map new file mode 100644 index 000000000..e19effd33 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/allRequired.js.map @@ -0,0 +1 @@ +{"version":3,"file":"allRequired.js","sourceRoot":"","sources":["../../src/keywords/allRequired.ts"],"names":[],"mappings":";;;;;AACA,6EAA+C;AAE/C,MAAM,WAAW,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,qBAAM,GAAE,CAAC,CAAA;AAExE,kBAAe,WAAW,CAAA;AAC1B,MAAM,CAAC,OAAO,GAAG,WAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/anyRequired.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/anyRequired.d.ts new file mode 100644 index 000000000..55e0fb1f2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/anyRequired.d.ts @@ -0,0 +1,3 @@ +import type { Plugin } from "ajv"; +declare const anyRequired: Plugin; +export default anyRequired; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/anyRequired.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/anyRequired.js new file mode 100644 index 000000000..700dc0daa --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/anyRequired.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const anyRequired_1 = __importDefault(require("../definitions/anyRequired")); +const anyRequired = (ajv) => ajv.addKeyword((0, anyRequired_1.default)()); +exports.default = anyRequired; +module.exports = anyRequired; +//# sourceMappingURL=anyRequired.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/anyRequired.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/anyRequired.js.map new file mode 100644 index 000000000..e1986e053 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/anyRequired.js.map @@ -0,0 +1 @@ +{"version":3,"file":"anyRequired.js","sourceRoot":"","sources":["../../src/keywords/anyRequired.ts"],"names":[],"mappings":";;;;;AACA,6EAA+C;AAE/C,MAAM,WAAW,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,qBAAM,GAAE,CAAC,CAAA;AAExE,kBAAe,WAAW,CAAA;AAC1B,MAAM,CAAC,OAAO,GAAG,WAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepProperties.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepProperties.d.ts new file mode 100644 index 000000000..b8209c8d1 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepProperties.d.ts @@ -0,0 +1,4 @@ +import type { Plugin } from "ajv"; +import type { DefinitionOptions } from "../definitions/_types"; +declare const deepProperties: Plugin; +export default deepProperties; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepProperties.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepProperties.js new file mode 100644 index 000000000..bd207d8bb --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepProperties.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const deepProperties_1 = __importDefault(require("../definitions/deepProperties")); +const deepProperties = (ajv, opts) => ajv.addKeyword((0, deepProperties_1.default)(opts)); +exports.default = deepProperties; +module.exports = deepProperties; +//# sourceMappingURL=deepProperties.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepProperties.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepProperties.js.map new file mode 100644 index 000000000..23ee8f3d6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"deepProperties.js","sourceRoot":"","sources":["../../src/keywords/deepProperties.ts"],"names":[],"mappings":";;;;;AACA,mFAAkD;AAGlD,MAAM,cAAc,GAA8B,CAAC,GAAG,EAAE,IAAwB,EAAE,EAAE,CAClF,GAAG,CAAC,UAAU,CAAC,IAAA,wBAAM,EAAC,IAAI,CAAC,CAAC,CAAA;AAE9B,kBAAe,cAAc,CAAA;AAC7B,MAAM,CAAC,OAAO,GAAG,cAAc,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepRequired.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepRequired.d.ts new file mode 100644 index 000000000..113062bae --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepRequired.d.ts @@ -0,0 +1,3 @@ +import type { Plugin } from "ajv"; +declare const deepRequired: Plugin; +export default deepRequired; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepRequired.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepRequired.js new file mode 100644 index 000000000..207783164 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepRequired.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const deepRequired_1 = __importDefault(require("../definitions/deepRequired")); +const deepRequired = (ajv) => ajv.addKeyword((0, deepRequired_1.default)()); +exports.default = deepRequired; +module.exports = deepRequired; +//# sourceMappingURL=deepRequired.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepRequired.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepRequired.js.map new file mode 100644 index 000000000..4b808c1c8 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/deepRequired.js.map @@ -0,0 +1 @@ +{"version":3,"file":"deepRequired.js","sourceRoot":"","sources":["../../src/keywords/deepRequired.ts"],"names":[],"mappings":";;;;;AACA,+EAAgD;AAEhD,MAAM,YAAY,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,sBAAM,GAAE,CAAC,CAAA;AAEzE,kBAAe,YAAY,CAAA;AAC3B,MAAM,CAAC,OAAO,GAAG,YAAY,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.d.ts new file mode 100644 index 000000000..b5e84757d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.d.ts @@ -0,0 +1,3 @@ +import type { Plugin } from "ajv"; +declare const dynamicDefaults: Plugin; +export default dynamicDefaults; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.js new file mode 100644 index 000000000..3df22076c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const dynamicDefaults_1 = __importDefault(require("../definitions/dynamicDefaults")); +const dynamicDefaults = (ajv) => ajv.addKeyword((0, dynamicDefaults_1.default)()); +exports.default = dynamicDefaults; +module.exports = dynamicDefaults; +//# sourceMappingURL=dynamicDefaults.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.js.map new file mode 100644 index 000000000..f87302ae3 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/dynamicDefaults.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamicDefaults.js","sourceRoot":"","sources":["../../src/keywords/dynamicDefaults.ts"],"names":[],"mappings":";;;;;AACA,qFAAmD;AAEnD,MAAM,eAAe,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,yBAAM,GAAE,CAAC,CAAA;AAE5E,kBAAe,eAAe,CAAA;AAC9B,MAAM,CAAC,OAAO,GAAG,eAAe,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/exclusiveRange.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/exclusiveRange.d.ts new file mode 100644 index 000000000..23ca1acbc --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/exclusiveRange.d.ts @@ -0,0 +1,3 @@ +import type { Plugin } from "ajv"; +declare const exclusiveRange: Plugin; +export default exclusiveRange; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/exclusiveRange.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/exclusiveRange.js new file mode 100644 index 000000000..5788996fe --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/exclusiveRange.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const exclusiveRange_1 = __importDefault(require("../definitions/exclusiveRange")); +const exclusiveRange = (ajv) => ajv.addKeyword((0, exclusiveRange_1.default)()); +exports.default = exclusiveRange; +module.exports = exclusiveRange; +//# sourceMappingURL=exclusiveRange.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/exclusiveRange.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/exclusiveRange.js.map new file mode 100644 index 000000000..a12321b7a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/exclusiveRange.js.map @@ -0,0 +1 @@ +{"version":3,"file":"exclusiveRange.js","sourceRoot":"","sources":["../../src/keywords/exclusiveRange.ts"],"names":[],"mappings":";;;;;AACA,mFAAkD;AAElD,MAAM,cAAc,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,wBAAM,GAAE,CAAC,CAAA;AAE3E,kBAAe,cAAc,CAAA;AAC7B,MAAM,CAAC,OAAO,GAAG,cAAc,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/index.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/index.d.ts new file mode 100644 index 000000000..98fd14ec5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/index.d.ts @@ -0,0 +1,3 @@ +import type { Plugin } from "ajv"; +declare const ajvKeywords: Record | undefined>; +export default ajvKeywords; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/index.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/index.js new file mode 100644 index 000000000..d2b7d86a9 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/index.js @@ -0,0 +1,43 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const typeof_1 = __importDefault(require("./typeof")); +const instanceof_1 = __importDefault(require("./instanceof")); +const range_1 = __importDefault(require("./range")); +const exclusiveRange_1 = __importDefault(require("./exclusiveRange")); +const regexp_1 = __importDefault(require("./regexp")); +const transform_1 = __importDefault(require("./transform")); +const uniqueItemProperties_1 = __importDefault(require("./uniqueItemProperties")); +const allRequired_1 = __importDefault(require("./allRequired")); +const anyRequired_1 = __importDefault(require("./anyRequired")); +const oneRequired_1 = __importDefault(require("./oneRequired")); +const patternRequired_1 = __importDefault(require("./patternRequired")); +const prohibited_1 = __importDefault(require("./prohibited")); +const deepProperties_1 = __importDefault(require("./deepProperties")); +const deepRequired_1 = __importDefault(require("./deepRequired")); +const dynamicDefaults_1 = __importDefault(require("./dynamicDefaults")); +const select_1 = __importDefault(require("./select")); +// TODO type +const ajvKeywords = { + typeof: typeof_1.default, + instanceof: instanceof_1.default, + range: range_1.default, + exclusiveRange: exclusiveRange_1.default, + regexp: regexp_1.default, + transform: transform_1.default, + uniqueItemProperties: uniqueItemProperties_1.default, + allRequired: allRequired_1.default, + anyRequired: anyRequired_1.default, + oneRequired: oneRequired_1.default, + patternRequired: patternRequired_1.default, + prohibited: prohibited_1.default, + deepProperties: deepProperties_1.default, + deepRequired: deepRequired_1.default, + dynamicDefaults: dynamicDefaults_1.default, + select: select_1.default, +}; +exports.default = ajvKeywords; +module.exports = ajvKeywords; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/index.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/index.js.map new file mode 100644 index 000000000..b91d99ec4 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/keywords/index.ts"],"names":[],"mappings":";;;;;AACA,sDAAmC;AACnC,8DAA2C;AAC3C,oDAA2B;AAC3B,sEAA6C;AAC7C,sDAA6B;AAC7B,4DAAmC;AACnC,kFAAyD;AACzD,gEAAuC;AACvC,gEAAuC;AACvC,gEAAuC;AACvC,wEAA+C;AAC/C,8DAAqC;AACrC,sEAA6C;AAC7C,kEAAyC;AACzC,wEAA+C;AAC/C,sDAA6B;AAE7B,YAAY;AACZ,MAAM,WAAW,GAA4C;IAC3D,MAAM,EAAE,gBAAY;IACpB,UAAU,EAAE,oBAAgB;IAC5B,KAAK,EAAL,eAAK;IACL,cAAc,EAAd,wBAAc;IACd,MAAM,EAAN,gBAAM;IACN,SAAS,EAAT,mBAAS;IACT,oBAAoB,EAApB,8BAAoB;IACpB,WAAW,EAAX,qBAAW;IACX,WAAW,EAAX,qBAAW;IACX,WAAW,EAAX,qBAAW;IACX,eAAe,EAAf,yBAAe;IACf,UAAU,EAAV,oBAAU;IACV,cAAc,EAAd,wBAAc;IACd,YAAY,EAAZ,sBAAY;IACZ,eAAe,EAAf,yBAAe;IACf,MAAM,EAAN,gBAAM;CACP,CAAA;AAED,kBAAe,WAAW,CAAA;AAC1B,MAAM,CAAC,OAAO,GAAG,WAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/instanceof.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/instanceof.d.ts new file mode 100644 index 000000000..2fa300cf9 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/instanceof.d.ts @@ -0,0 +1,3 @@ +import type { Plugin } from "ajv"; +declare const instanceofPlugin: Plugin; +export default instanceofPlugin; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/instanceof.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/instanceof.js new file mode 100644 index 000000000..e5e2784d7 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/instanceof.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const instanceof_1 = __importDefault(require("../definitions/instanceof")); +const instanceofPlugin = (ajv) => ajv.addKeyword((0, instanceof_1.default)()); +exports.default = instanceofPlugin; +module.exports = instanceofPlugin; +//# sourceMappingURL=instanceof.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/instanceof.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/instanceof.js.map new file mode 100644 index 000000000..b33b11547 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/instanceof.js.map @@ -0,0 +1 @@ +{"version":3,"file":"instanceof.js","sourceRoot":"","sources":["../../src/keywords/instanceof.ts"],"names":[],"mappings":";;;;;AACA,2EAA8C;AAE9C,MAAM,gBAAgB,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,oBAAM,GAAE,CAAC,CAAA;AAE7E,kBAAe,gBAAgB,CAAA;AAC/B,MAAM,CAAC,OAAO,GAAG,gBAAgB,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/oneRequired.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/oneRequired.d.ts new file mode 100644 index 000000000..2aaa0f56f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/oneRequired.d.ts @@ -0,0 +1,3 @@ +import type { Plugin } from "ajv"; +declare const oneRequired: Plugin; +export default oneRequired; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/oneRequired.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/oneRequired.js new file mode 100644 index 000000000..c62e1ebdb --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/oneRequired.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const oneRequired_1 = __importDefault(require("../definitions/oneRequired")); +const oneRequired = (ajv) => ajv.addKeyword((0, oneRequired_1.default)()); +exports.default = oneRequired; +module.exports = oneRequired; +//# sourceMappingURL=oneRequired.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/oneRequired.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/oneRequired.js.map new file mode 100644 index 000000000..9dc8aa0cd --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/oneRequired.js.map @@ -0,0 +1 @@ +{"version":3,"file":"oneRequired.js","sourceRoot":"","sources":["../../src/keywords/oneRequired.ts"],"names":[],"mappings":";;;;;AACA,6EAA+C;AAE/C,MAAM,WAAW,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,qBAAM,GAAE,CAAC,CAAA;AAExE,kBAAe,WAAW,CAAA;AAC1B,MAAM,CAAC,OAAO,GAAG,WAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/patternRequired.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/patternRequired.d.ts new file mode 100644 index 000000000..565f5c09c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/patternRequired.d.ts @@ -0,0 +1,3 @@ +import type { Plugin } from "ajv"; +declare const patternRequired: Plugin; +export default patternRequired; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/patternRequired.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/patternRequired.js new file mode 100644 index 000000000..fc6a1ab6e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/patternRequired.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const patternRequired_1 = __importDefault(require("../definitions/patternRequired")); +const patternRequired = (ajv) => ajv.addKeyword((0, patternRequired_1.default)()); +exports.default = patternRequired; +module.exports = patternRequired; +//# sourceMappingURL=patternRequired.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/patternRequired.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/patternRequired.js.map new file mode 100644 index 000000000..c446c4dcd --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/patternRequired.js.map @@ -0,0 +1 @@ +{"version":3,"file":"patternRequired.js","sourceRoot":"","sources":["../../src/keywords/patternRequired.ts"],"names":[],"mappings":";;;;;AACA,qFAAmD;AAEnD,MAAM,eAAe,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,yBAAM,GAAE,CAAC,CAAA;AAE5E,kBAAe,eAAe,CAAA;AAC9B,MAAM,CAAC,OAAO,GAAG,eAAe,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/prohibited.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/prohibited.d.ts new file mode 100644 index 000000000..19f2ccb1c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/prohibited.d.ts @@ -0,0 +1,3 @@ +import type { Plugin } from "ajv"; +declare const prohibited: Plugin; +export default prohibited; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/prohibited.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/prohibited.js new file mode 100644 index 000000000..08414f917 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/prohibited.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const prohibited_1 = __importDefault(require("../definitions/prohibited")); +const prohibited = (ajv) => ajv.addKeyword((0, prohibited_1.default)()); +exports.default = prohibited; +module.exports = prohibited; +//# sourceMappingURL=prohibited.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/prohibited.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/prohibited.js.map new file mode 100644 index 000000000..5c2b190e5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/prohibited.js.map @@ -0,0 +1 @@ +{"version":3,"file":"prohibited.js","sourceRoot":"","sources":["../../src/keywords/prohibited.ts"],"names":[],"mappings":";;;;;AACA,2EAA8C;AAE9C,MAAM,UAAU,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,oBAAM,GAAE,CAAC,CAAA;AAEvE,kBAAe,UAAU,CAAA;AACzB,MAAM,CAAC,OAAO,GAAG,UAAU,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/range.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/range.d.ts new file mode 100644 index 000000000..5e9bd230e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/range.d.ts @@ -0,0 +1,3 @@ +import type { Plugin } from "ajv"; +declare const range: Plugin; +export default range; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/range.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/range.js new file mode 100644 index 000000000..915f28d9e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/range.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const range_1 = __importDefault(require("../definitions/range")); +const range = (ajv) => ajv.addKeyword((0, range_1.default)()); +exports.default = range; +module.exports = range; +//# sourceMappingURL=range.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/range.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/range.js.map new file mode 100644 index 000000000..b07eb26b1 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/range.js.map @@ -0,0 +1 @@ +{"version":3,"file":"range.js","sourceRoot":"","sources":["../../src/keywords/range.ts"],"names":[],"mappings":";;;;;AACA,iEAAyC;AAEzC,MAAM,KAAK,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,eAAM,GAAE,CAAC,CAAA;AAElE,kBAAe,KAAK,CAAA;AACpB,MAAM,CAAC,OAAO,GAAG,KAAK,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/regexp.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/regexp.d.ts new file mode 100644 index 000000000..4c64f089e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/regexp.d.ts @@ -0,0 +1,3 @@ +import type { Plugin } from "ajv"; +declare const regexp: Plugin; +export default regexp; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/regexp.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/regexp.js new file mode 100644 index 000000000..7eb75832f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/regexp.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const regexp_1 = __importDefault(require("../definitions/regexp")); +const regexp = (ajv) => ajv.addKeyword((0, regexp_1.default)()); +exports.default = regexp; +module.exports = regexp; +//# sourceMappingURL=regexp.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/regexp.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/regexp.js.map new file mode 100644 index 000000000..a004f5e8e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/regexp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"regexp.js","sourceRoot":"","sources":["../../src/keywords/regexp.ts"],"names":[],"mappings":";;;;;AACA,mEAA0C;AAE1C,MAAM,MAAM,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,gBAAM,GAAE,CAAC,CAAA;AAEnE,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/select.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/select.d.ts new file mode 100644 index 000000000..f7f9abaa2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/select.d.ts @@ -0,0 +1,4 @@ +import type { Plugin } from "ajv"; +import type { DefinitionOptions } from "../definitions/_types"; +declare const select: Plugin; +export default select; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/select.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/select.js new file mode 100644 index 000000000..eff7205ca --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/select.js @@ -0,0 +1,13 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const select_1 = __importDefault(require("../definitions/select")); +const select = (ajv, opts) => { + (0, select_1.default)(opts).forEach((d) => ajv.addKeyword(d)); + return ajv; +}; +exports.default = select; +module.exports = select; +//# sourceMappingURL=select.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/select.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/select.js.map new file mode 100644 index 000000000..55b294c9c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/select.js.map @@ -0,0 +1 @@ +{"version":3,"file":"select.js","sourceRoot":"","sources":["../../src/keywords/select.ts"],"names":[],"mappings":";;;;;AACA,mEAA2C;AAG3C,MAAM,MAAM,GAA8B,CAAC,GAAG,EAAE,IAAwB,EAAE,EAAE;IAC1E,IAAA,gBAAO,EAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;IAC/C,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAED,kBAAe,MAAM,CAAA;AACrB,MAAM,CAAC,OAAO,GAAG,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/transform.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/transform.d.ts new file mode 100644 index 000000000..8734ed08f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/transform.d.ts @@ -0,0 +1,3 @@ +import type { Plugin } from "ajv"; +declare const transform: Plugin; +export default transform; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/transform.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/transform.js new file mode 100644 index 000000000..bdf9ef1d8 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/transform.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const transform_1 = __importDefault(require("../definitions/transform")); +const transform = (ajv) => ajv.addKeyword((0, transform_1.default)()); +exports.default = transform; +module.exports = transform; +//# sourceMappingURL=transform.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/transform.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/transform.js.map new file mode 100644 index 000000000..ef0e67509 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/transform.js.map @@ -0,0 +1 @@ +{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../src/keywords/transform.ts"],"names":[],"mappings":";;;;;AACA,yEAA6C;AAE7C,MAAM,SAAS,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,mBAAM,GAAE,CAAC,CAAA;AAEtE,kBAAe,SAAS,CAAA;AACxB,MAAM,CAAC,OAAO,GAAG,SAAS,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/typeof.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/typeof.d.ts new file mode 100644 index 000000000..57aff4b92 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/typeof.d.ts @@ -0,0 +1,3 @@ +import type { Plugin } from "ajv"; +declare const typeofPlugin: Plugin; +export default typeofPlugin; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/typeof.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/typeof.js new file mode 100644 index 000000000..6cabc3aff --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/typeof.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const typeof_1 = __importDefault(require("../definitions/typeof")); +const typeofPlugin = (ajv) => ajv.addKeyword((0, typeof_1.default)()); +exports.default = typeofPlugin; +module.exports = typeofPlugin; +//# sourceMappingURL=typeof.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/typeof.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/typeof.js.map new file mode 100644 index 000000000..ec7062218 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/typeof.js.map @@ -0,0 +1 @@ +{"version":3,"file":"typeof.js","sourceRoot":"","sources":["../../src/keywords/typeof.ts"],"names":[],"mappings":";;;;;AACA,mEAA0C;AAE1C,MAAM,YAAY,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,gBAAM,GAAE,CAAC,CAAA;AAEzE,kBAAe,YAAY,CAAA;AAC3B,MAAM,CAAC,OAAO,GAAG,YAAY,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.d.ts b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.d.ts new file mode 100644 index 000000000..ff06feacc --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.d.ts @@ -0,0 +1,3 @@ +import type { Plugin } from "ajv"; +declare const uniqueItemProperties: Plugin; +export default uniqueItemProperties; diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.js b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.js new file mode 100644 index 000000000..a638fcc48 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.js @@ -0,0 +1,10 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const uniqueItemProperties_1 = __importDefault(require("../definitions/uniqueItemProperties")); +const uniqueItemProperties = (ajv) => ajv.addKeyword((0, uniqueItemProperties_1.default)()); +exports.default = uniqueItemProperties; +module.exports = uniqueItemProperties; +//# sourceMappingURL=uniqueItemProperties.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.js.map b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.js.map new file mode 100644 index 000000000..b62fdd2fb --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/dist/keywords/uniqueItemProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uniqueItemProperties.js","sourceRoot":"","sources":["../../src/keywords/uniqueItemProperties.ts"],"names":[],"mappings":";;;;;AACA,+FAAwD;AAExD,MAAM,oBAAoB,GAAsB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,IAAA,8BAAM,GAAE,CAAC,CAAA;AAEjF,kBAAe,oBAAoB,CAAA;AACnC,MAAM,CAAC,OAAO,GAAG,oBAAoB,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/package.json b/node_modules/schema-utils/node_modules/ajv-keywords/package.json new file mode 100644 index 000000000..515f58379 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/package.json @@ -0,0 +1,74 @@ +{ + "name": "ajv-keywords", + "version": "5.1.0", + "description": "Additional JSON-Schema keywords for Ajv JSON validator", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "scripts": { + "build": "rm -rf dist && tsc", + "prepublish": "npm run build", + "prettier:write": "prettier --write \"./**/*.{md,json,yaml,js,ts}\"", + "prettier:check": "prettier --list-different \"./**/*.{md,json,yaml,js,ts}\"", + "test": "npm link && npm link ajv-keywords && npm run eslint && npm run test-cov", + "eslint": "eslint \"src/**/*.*s\" \"spec/**/*.*s\"", + "test-spec": "jest spec/*.ts", + "test-cov": "jest spec/*.ts --coverage" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/epoberezkin/ajv-keywords.git" + }, + "keywords": [ + "JSON-Schema", + "ajv", + "keywords" + ], + "files": [ + "src", + "dist", + "ajv-keywords.d.ts" + ], + "author": "Evgeny Poberezkin", + "license": "MIT", + "bugs": { + "url": "https://github.com/epoberezkin/ajv-keywords/issues" + }, + "homepage": "https://github.com/epoberezkin/ajv-keywords#readme", + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + }, + "devDependencies": { + "@ajv-validator/config": "^0.2.3", + "@types/chai": "^4.2.14", + "@types/jest": "^26.0.14", + "@types/node": "^16.4.10", + "@types/uuid": "^8.3.0", + "@typescript-eslint/eslint-plugin": "^4.4.1", + "@typescript-eslint/parser": "^4.4.1", + "ajv": "^8.8.2", + "ajv-formats": "^2.0.0", + "chai": "^4.2.0", + "eslint": "^7.2.0", + "eslint-config-prettier": "^7.0.0", + "husky": "^7.0.1", + "jest": "^26.5.3", + "json-schema-test": "^2.0.0", + "lint-staged": "^11.1.1", + "prettier": "^2.1.2", + "ts-jest": "^26.4.1", + "typescript": "^4.2.0", + "uuid": "^8.1.0" + }, + "prettier": "@ajv-validator/config/prettierrc.json", + "husky": { + "hooks": { + "pre-commit": "lint-staged && npm test" + } + }, + "lint-staged": { + "*.{md,json,yaml,js,ts}": "prettier --write" + } +} diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/_range.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/_range.ts new file mode 100644 index 000000000..38cb9a0d4 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/_range.ts @@ -0,0 +1,30 @@ +import type {MacroKeywordDefinition} from "ajv" +import type {GetDefinition} from "./_types" + +type RangeKwd = "range" | "exclusiveRange" + +export default function getRangeDef(keyword: RangeKwd): GetDefinition { + return () => ({ + keyword, + type: "number", + schemaType: "array", + macro: function ([min, max]: [number, number]) { + validateRangeSchema(min, max) + return keyword === "range" + ? {minimum: min, maximum: max} + : {exclusiveMinimum: min, exclusiveMaximum: max} + }, + metaSchema: { + type: "array", + minItems: 2, + maxItems: 2, + items: {type: "number"}, + }, + }) + + function validateRangeSchema(min: number, max: number): void { + if (min > max || (keyword === "exclusiveRange" && min === max)) { + throw new Error("There are no numbers in range") + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/_required.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/_required.ts new file mode 100644 index 000000000..ddf939542 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/_required.ts @@ -0,0 +1,24 @@ +import type {MacroKeywordDefinition} from "ajv" +import type {GetDefinition} from "./_types" + +type RequiredKwd = "anyRequired" | "oneRequired" + +export default function getRequiredDef( + keyword: RequiredKwd +): GetDefinition { + return () => ({ + keyword, + type: "object", + schemaType: "array", + macro(schema: string[]) { + if (schema.length === 0) return true + if (schema.length === 1) return {required: schema} + const comb = keyword === "anyRequired" ? "anyOf" : "oneOf" + return {[comb]: schema.map((p) => ({required: [p]}))} + }, + metaSchema: { + type: "array", + items: {type: "string"}, + }, + }) +} diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/_types.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/_types.ts new file mode 100644 index 000000000..c3f54248e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/_types.ts @@ -0,0 +1,7 @@ +import type {KeywordDefinition} from "ajv" + +export interface DefinitionOptions { + defaultMeta?: string | boolean +} + +export type GetDefinition = (opts?: DefinitionOptions) => T diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/_util.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/_util.ts new file mode 100644 index 000000000..68bcc01b2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/_util.ts @@ -0,0 +1,22 @@ +import type {DefinitionOptions} from "./_types" +import type {SchemaObject, KeywordCxt, Name} from "ajv" +import {_} from "ajv/dist/compile/codegen" + +const META_SCHEMA_ID = "http://json-schema.org/schema" + +export function metaSchemaRef({defaultMeta}: DefinitionOptions = {}): SchemaObject { + return defaultMeta === false ? {} : {$ref: defaultMeta || META_SCHEMA_ID} +} + +export function usePattern( + {gen, it: {opts}}: KeywordCxt, + pattern: string, + flags = opts.unicodeRegExp ? "u" : "" +): Name { + const rx = new RegExp(pattern, flags) + return gen.scopeValue("pattern", { + key: rx.toString(), + ref: rx, + code: _`new RegExp(${pattern}, ${flags})`, + }) +} diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/allRequired.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/allRequired.ts new file mode 100644 index 000000000..821558f27 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/allRequired.ts @@ -0,0 +1,18 @@ +import type {MacroKeywordDefinition} from "ajv" + +export default function getDef(): MacroKeywordDefinition { + return { + keyword: "allRequired", + type: "object", + schemaType: "boolean", + macro(schema: boolean, parentSchema) { + if (!schema) return true + const required = Object.keys(parentSchema.properties) + if (required.length === 0) return true + return {required} + }, + dependencies: ["properties"], + } +} + +module.exports = getDef diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/anyRequired.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/anyRequired.ts new file mode 100644 index 000000000..7f715367d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/anyRequired.ts @@ -0,0 +1,8 @@ +import type {MacroKeywordDefinition} from "ajv" +import type {GetDefinition} from "./_types" +import getRequiredDef from "./_required" + +const getDef: GetDefinition = getRequiredDef("anyRequired") + +export default getDef +module.exports = getDef diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/deepProperties.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/deepProperties.ts new file mode 100644 index 000000000..be294106b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/deepProperties.ts @@ -0,0 +1,52 @@ +import type {MacroKeywordDefinition, SchemaObject, Schema} from "ajv" +import type {DefinitionOptions} from "./_types" +import {metaSchemaRef} from "./_util" + +export default function getDef(opts?: DefinitionOptions): MacroKeywordDefinition { + return { + keyword: "deepProperties", + type: "object", + schemaType: "object", + macro: function (schema: Record) { + const allOf = [] + for (const pointer in schema) allOf.push(getSchema(pointer, schema[pointer])) + return {allOf} + }, + metaSchema: { + type: "object", + propertyNames: {type: "string", format: "json-pointer"}, + additionalProperties: metaSchemaRef(opts), + }, + } +} + +function getSchema(jsonPointer: string, schema: SchemaObject): SchemaObject { + const segments = jsonPointer.split("/") + const rootSchema: SchemaObject = {} + let pointerSchema: SchemaObject = rootSchema + for (let i = 1; i < segments.length; i++) { + let segment: string = segments[i] + const isLast = i === segments.length - 1 + segment = unescapeJsonPointer(segment) + const properties: Record = (pointerSchema.properties = {}) + let items: SchemaObject[] | undefined + if (/[0-9]+/.test(segment)) { + let count = +segment + items = pointerSchema.items = [] + pointerSchema.type = ["object", "array"] + while (count--) items.push({}) + } else { + pointerSchema.type = "object" + } + pointerSchema = isLast ? schema : {} + properties[segment] = pointerSchema + if (items) items.push(pointerSchema) + } + return rootSchema +} + +function unescapeJsonPointer(str: string): string { + return str.replace(/~1/g, "/").replace(/~0/g, "~") +} + +module.exports = getDef diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/deepRequired.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/deepRequired.ts new file mode 100644 index 000000000..c01b70267 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/deepRequired.ts @@ -0,0 +1,35 @@ +import type {CodeKeywordDefinition, KeywordCxt} from "ajv" +import {_, or, and, getProperty, Code} from "ajv/dist/compile/codegen" + +export default function getDef(): CodeKeywordDefinition { + return { + keyword: "deepRequired", + type: "object", + schemaType: "array", + code(ctx: KeywordCxt) { + const {schema, data} = ctx + const props = (schema as string[]).map((jp: string) => _`(${getData(jp)}) === undefined`) + ctx.fail(or(...props)) + + function getData(jsonPointer: string): Code { + if (jsonPointer === "") throw new Error("empty JSON pointer not allowed") + const segments = jsonPointer.split("/") + let x: Code = data + const xs = segments.map((s, i) => + i ? (x = _`${x}${getProperty(unescapeJPSegment(s))}`) : x + ) + return and(...xs) + } + }, + metaSchema: { + type: "array", + items: {type: "string", format: "json-pointer"}, + }, + } +} + +function unescapeJPSegment(s: string): string { + return s.replace(/~1/g, "/").replace(/~0/g, "~") +} + +module.exports = getDef diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/dynamicDefaults.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/dynamicDefaults.ts new file mode 100644 index 000000000..84cd0c372 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/dynamicDefaults.ts @@ -0,0 +1,98 @@ +import type {FuncKeywordDefinition, SchemaCxt} from "ajv" + +const sequences: Record = {} + +export type DynamicDefaultFunc = (args?: Record) => () => any + +const DEFAULTS: Record = { + timestamp: () => () => Date.now(), + datetime: () => () => new Date().toISOString(), + date: () => () => new Date().toISOString().slice(0, 10), + time: () => () => new Date().toISOString().slice(11), + random: () => () => Math.random(), + randomint: (args?: {max?: number}) => { + const max = args?.max ?? 2 + return () => Math.floor(Math.random() * max) + }, + seq: (args?: {name?: string}) => { + const name = args?.name ?? "" + sequences[name] ||= 0 + return () => (sequences[name] as number)++ + }, +} + +interface PropertyDefaultSchema { + func: string + args: Record +} + +type DefaultSchema = Record + +const getDef: (() => FuncKeywordDefinition) & { + DEFAULTS: typeof DEFAULTS +} = Object.assign(_getDef, {DEFAULTS}) + +function _getDef(): FuncKeywordDefinition { + return { + keyword: "dynamicDefaults", + type: "object", + schemaType: ["string", "object"], + modifying: true, + valid: true, + compile(schema: DefaultSchema, _parentSchema, it: SchemaCxt) { + if (!it.opts.useDefaults || it.compositeRule) return () => true + const fs: Record any> = {} + for (const key in schema) fs[key] = getDefault(schema[key]) + const empty = it.opts.useDefaults === "empty" + + return (data: Record) => { + for (const prop in schema) { + if (data[prop] === undefined || (empty && (data[prop] === null || data[prop] === ""))) { + data[prop] = fs[prop]() + } + } + return true + } + }, + metaSchema: { + type: "object", + additionalProperties: { + anyOf: [ + {type: "string"}, + { + type: "object", + additionalProperties: false, + required: ["func", "args"], + properties: { + func: {type: "string"}, + args: {type: "object"}, + }, + }, + ], + }, + }, + } +} + +function getDefault(d: string | PropertyDefaultSchema | undefined): () => any { + return typeof d == "object" ? getObjDefault(d) : getStrDefault(d) +} + +function getObjDefault({func, args}: PropertyDefaultSchema): () => any { + const def = DEFAULTS[func] + assertDefined(func, def) + return def(args) +} + +function getStrDefault(d = ""): () => any { + const def = DEFAULTS[d] + assertDefined(d, def) + return def() +} + +function assertDefined(name: string, def?: DynamicDefaultFunc): asserts def is DynamicDefaultFunc { + if (!def) throw new Error(`invalid "dynamicDefaults" keyword property value: ${name}`) +} + +export default getDef +module.exports = getDef diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/exclusiveRange.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/exclusiveRange.ts new file mode 100644 index 000000000..7a4f7361f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/exclusiveRange.ts @@ -0,0 +1,8 @@ +import type {MacroKeywordDefinition} from "ajv" +import type {GetDefinition} from "./_types" +import getRangeDef from "./_range" + +const getDef: GetDefinition = getRangeDef("exclusiveRange") + +export default getDef +module.exports = getDef diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/index.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/index.ts new file mode 100644 index 000000000..eb0a4af77 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/index.ts @@ -0,0 +1,61 @@ +import type {Vocabulary, KeywordDefinition, ErrorNoParams} from "ajv" +import type {DefinitionOptions, GetDefinition} from "./_types" +import typeofDef from "./typeof" +import instanceofDef from "./instanceof" +import range from "./range" +import exclusiveRange from "./exclusiveRange" +import regexp from "./regexp" +import transform from "./transform" +import uniqueItemProperties from "./uniqueItemProperties" +import allRequired from "./allRequired" +import anyRequired from "./anyRequired" +import oneRequired from "./oneRequired" +import patternRequired, {PatternRequiredError} from "./patternRequired" +import prohibited from "./prohibited" +import deepProperties from "./deepProperties" +import deepRequired from "./deepRequired" +import dynamicDefaults from "./dynamicDefaults" +import selectDef, {SelectError} from "./select" + +const definitions: GetDefinition[] = [ + typeofDef, + instanceofDef, + range, + exclusiveRange, + regexp, + transform, + uniqueItemProperties, + allRequired, + anyRequired, + oneRequired, + patternRequired, + prohibited, + deepProperties, + deepRequired, + dynamicDefaults, +] + +export default function ajvKeywords(opts?: DefinitionOptions): Vocabulary { + return definitions.map((d) => d(opts)).concat(selectDef(opts)) +} + +export type AjvKeywordsError = + | PatternRequiredError + | SelectError + | ErrorNoParams< + | "range" + | "exclusiveRange" + | "anyRequired" + | "oneRequired" + | "allRequired" + | "deepProperties" + | "deepRequired" + | "dynamicDefaults" + | "instanceof" + | "prohibited" + | "regexp" + | "transform" + | "uniqueItemProperties" + > + +module.exports = ajvKeywords diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/instanceof.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/instanceof.ts new file mode 100644 index 000000000..2f1c54f57 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/instanceof.ts @@ -0,0 +1,61 @@ +import type {FuncKeywordDefinition} from "ajv" + +type Constructor = new (...args: any[]) => any + +const CONSTRUCTORS: Record = { + Object, + Array, + Function, + Number, + String, + Date, + RegExp, +} + +/* istanbul ignore else */ +if (typeof Buffer != "undefined") CONSTRUCTORS.Buffer = Buffer + +/* istanbul ignore else */ +if (typeof Promise != "undefined") CONSTRUCTORS.Promise = Promise + +const getDef: (() => FuncKeywordDefinition) & { + CONSTRUCTORS: typeof CONSTRUCTORS +} = Object.assign(_getDef, {CONSTRUCTORS}) + +function _getDef(): FuncKeywordDefinition { + return { + keyword: "instanceof", + schemaType: ["string", "array"], + compile(schema: string | string[]) { + if (typeof schema == "string") { + const C = getConstructor(schema) + return (data) => data instanceof C + } + + if (Array.isArray(schema)) { + const constructors = schema.map(getConstructor) + return (data) => { + for (const C of constructors) { + if (data instanceof C) return true + } + return false + } + } + + /* istanbul ignore next */ + throw new Error("ajv implementation error") + }, + metaSchema: { + anyOf: [{type: "string"}, {type: "array", items: {type: "string"}}], + }, + } +} + +function getConstructor(c: string): Constructor { + const C = CONSTRUCTORS[c] + if (C) return C + throw new Error(`invalid "instanceof" keyword value ${c}`) +} + +export default getDef +module.exports = getDef diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/oneRequired.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/oneRequired.ts new file mode 100644 index 000000000..79c44c97a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/oneRequired.ts @@ -0,0 +1,8 @@ +import type {MacroKeywordDefinition} from "ajv" +import type {GetDefinition} from "./_types" +import getRequiredDef from "./_required" + +const getDef: GetDefinition = getRequiredDef("oneRequired") + +export default getDef +module.exports = getDef diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/patternRequired.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/patternRequired.ts new file mode 100644 index 000000000..63235c524 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/patternRequired.ts @@ -0,0 +1,46 @@ +import type {CodeKeywordDefinition, KeywordCxt, KeywordErrorDefinition, ErrorObject} from "ajv" +import {_, str, and} from "ajv/dist/compile/codegen" +import {usePattern} from "./_util" + +export type PatternRequiredError = ErrorObject<"patternRequired", {missingPattern: string}> + +const error: KeywordErrorDefinition = { + message: ({params: {missingPattern}}) => + str`should have property matching pattern '${missingPattern}'`, + params: ({params: {missingPattern}}) => _`{missingPattern: ${missingPattern}}`, +} + +export default function getDef(): CodeKeywordDefinition { + return { + keyword: "patternRequired", + type: "object", + schemaType: "array", + error, + code(cxt: KeywordCxt) { + const {gen, schema, data} = cxt + if (schema.length === 0) return + const valid = gen.let("valid", true) + for (const pat of schema) validateProperties(pat) + + function validateProperties(pattern: string): void { + const matched = gen.let("matched", false) + + gen.forIn("key", data, (key) => { + gen.assign(matched, _`${usePattern(cxt, pattern)}.test(${key})`) + gen.if(matched, () => gen.break()) + }) + + cxt.setParams({missingPattern: pattern}) + gen.assign(valid, and(valid, matched)) + cxt.pass(valid) + } + }, + metaSchema: { + type: "array", + items: {type: "string", format: "regex"}, + uniqueItems: true, + }, + } +} + +module.exports = getDef diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/prohibited.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/prohibited.ts new file mode 100644 index 000000000..659fdda1e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/prohibited.ts @@ -0,0 +1,20 @@ +import type {MacroKeywordDefinition} from "ajv" + +export default function getDef(): MacroKeywordDefinition { + return { + keyword: "prohibited", + type: "object", + schemaType: "array", + macro: function (schema: string[]) { + if (schema.length === 0) return true + if (schema.length === 1) return {not: {required: schema}} + return {not: {anyOf: schema.map((p) => ({required: [p]}))}} + }, + metaSchema: { + type: "array", + items: {type: "string"}, + }, + } +} + +module.exports = getDef diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/range.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/range.ts new file mode 100644 index 000000000..c867b7d1d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/range.ts @@ -0,0 +1,8 @@ +import type {MacroKeywordDefinition} from "ajv" +import type {GetDefinition} from "./_types" +import getRangeDef from "./_range" + +const getDef: GetDefinition = getRangeDef("range") + +export default getDef +module.exports = getDef diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/regexp.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/regexp.ts new file mode 100644 index 000000000..68ddef830 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/regexp.ts @@ -0,0 +1,45 @@ +import type {CodeKeywordDefinition, KeywordCxt, JSONSchemaType, Name} from "ajv" +import {_} from "ajv/dist/compile/codegen" +import {usePattern} from "./_util" + +interface RegexpSchema { + pattern: string + flags?: string +} + +const regexpMetaSchema: JSONSchemaType = { + type: "object", + properties: { + pattern: {type: "string"}, + flags: {type: "string", nullable: true}, + }, + required: ["pattern"], + additionalProperties: false, +} + +const metaRegexp = /^\/(.*)\/([gimuy]*)$/ + +export default function getDef(): CodeKeywordDefinition { + return { + keyword: "regexp", + type: "string", + schemaType: ["string", "object"], + code(cxt: KeywordCxt) { + const {data, schema} = cxt + const regx = getRegExp(schema) + cxt.pass(_`${regx}.test(${data})`) + + function getRegExp(sch: string | RegexpSchema): Name { + if (typeof sch == "object") return usePattern(cxt, sch.pattern, sch.flags) + const rx = metaRegexp.exec(sch) + if (rx) return usePattern(cxt, rx[1], rx[2]) + throw new Error("cannot parse string into RegExp") + } + }, + metaSchema: { + anyOf: [{type: "string"}, regexpMetaSchema], + }, + } +} + +module.exports = getDef diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/select.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/select.ts new file mode 100644 index 000000000..f5cc19f55 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/select.ts @@ -0,0 +1,69 @@ +import type {KeywordDefinition, KeywordErrorDefinition, KeywordCxt, ErrorObject} from "ajv" +import {_, str, nil, Name} from "ajv/dist/compile/codegen" +import type {DefinitionOptions} from "./_types" +import {metaSchemaRef} from "./_util" + +export type SelectError = ErrorObject<"select", {failingCase?: string; failingDefault?: true}> + +const error: KeywordErrorDefinition = { + message: ({params: {schemaProp}}) => + schemaProp + ? str`should match case "${schemaProp}" schema` + : str`should match default case schema`, + params: ({params: {schemaProp}}) => + schemaProp ? _`{failingCase: ${schemaProp}}` : _`{failingDefault: true}`, +} + +export default function getDef(opts?: DefinitionOptions): KeywordDefinition[] { + const metaSchema = metaSchemaRef(opts) + + return [ + { + keyword: "select", + schemaType: ["string", "number", "boolean", "null"], + $data: true, + error, + dependencies: ["selectCases"], + code(cxt: KeywordCxt) { + const {gen, schemaCode, parentSchema} = cxt + cxt.block$data(nil, () => { + const valid = gen.let("valid", true) + const schValid = gen.name("_valid") + const value = gen.const("value", _`${schemaCode} === null ? "null" : ${schemaCode}`) + gen.if(false) // optimizer should remove it from generated code + for (const schemaProp in parentSchema.selectCases) { + cxt.setParams({schemaProp}) + gen.elseIf(_`"" + ${value} == ${schemaProp}`) // intentional ==, to match numbers and booleans + const schCxt = cxt.subschema({keyword: "selectCases", schemaProp}, schValid) + cxt.mergeEvaluated(schCxt, Name) + gen.assign(valid, schValid) + } + gen.else() + if (parentSchema.selectDefault !== undefined) { + cxt.setParams({schemaProp: undefined}) + const schCxt = cxt.subschema({keyword: "selectDefault"}, schValid) + cxt.mergeEvaluated(schCxt, Name) + gen.assign(valid, schValid) + } + gen.endIf() + cxt.pass(valid) + }) + }, + }, + { + keyword: "selectCases", + dependencies: ["select"], + metaSchema: { + type: "object", + additionalProperties: metaSchema, + }, + }, + { + keyword: "selectDefault", + dependencies: ["select", "selectCases"], + metaSchema, + }, + ] +} + +module.exports = getDef diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/transform.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/transform.ts new file mode 100644 index 000000000..af4ae291b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/transform.ts @@ -0,0 +1,98 @@ +import type {CodeKeywordDefinition, AnySchemaObject, KeywordCxt, Code, Name} from "ajv" +import {_, stringify, getProperty} from "ajv/dist/compile/codegen" + +type TransformName = + | "trimStart" + | "trimEnd" + | "trimLeft" + | "trimRight" + | "trim" + | "toLowerCase" + | "toUpperCase" + | "toEnumCase" + +interface TransformConfig { + hash: Record +} + +type Transform = (s: string, cfg?: TransformConfig) => string + +const transform: {[key in TransformName]: Transform} = { + trimStart: (s) => s.trimStart(), + trimEnd: (s) => s.trimEnd(), + trimLeft: (s) => s.trimStart(), + trimRight: (s) => s.trimEnd(), + trim: (s) => s.trim(), + toLowerCase: (s) => s.toLowerCase(), + toUpperCase: (s) => s.toUpperCase(), + toEnumCase: (s, cfg) => cfg?.hash[configKey(s)] || s, +} + +const getDef: (() => CodeKeywordDefinition) & { + transform: typeof transform +} = Object.assign(_getDef, {transform}) + +function _getDef(): CodeKeywordDefinition { + return { + keyword: "transform", + schemaType: "array", + before: "enum", + code(cxt: KeywordCxt) { + const {gen, data, schema, parentSchema, it} = cxt + const {parentData, parentDataProperty} = it + const tNames: string[] = schema + if (!tNames.length) return + let cfg: Name | undefined + if (tNames.includes("toEnumCase")) { + const config = getEnumCaseCfg(parentSchema) + cfg = gen.scopeValue("obj", {ref: config, code: stringify(config)}) + } + gen.if(_`typeof ${data} == "string" && ${parentData} !== undefined`, () => { + gen.assign(data, transformExpr(tNames.slice())) + gen.assign(_`${parentData}[${parentDataProperty}]`, data) + }) + + function transformExpr(ts: string[]): Code { + if (!ts.length) return data + const t = ts.pop() as string + if (!(t in transform)) throw new Error(`transform: unknown transformation ${t}`) + const func = gen.scopeValue("func", { + ref: transform[t as TransformName], + code: _`require("ajv-keywords/dist/definitions/transform").transform${getProperty(t)}`, + }) + const arg = transformExpr(ts) + return cfg && t === "toEnumCase" ? _`${func}(${arg}, ${cfg})` : _`${func}(${arg})` + } + }, + metaSchema: { + type: "array", + items: {type: "string", enum: Object.keys(transform)}, + }, + } +} + +function getEnumCaseCfg(parentSchema: AnySchemaObject): TransformConfig { + // build hash table to enum values + const cfg: TransformConfig = {hash: {}} + + // requires `enum` in the same schema as transform + if (!parentSchema.enum) throw new Error('transform: "toEnumCase" requires "enum"') + for (const v of parentSchema.enum) { + if (typeof v !== "string") continue + const k = configKey(v) + // requires all `enum` values have unique keys + if (cfg.hash[k]) { + throw new Error('transform: "toEnumCase" requires all lowercased "enum" values to be unique') + } + cfg.hash[k] = v + } + + return cfg +} + +function configKey(s: string): string { + return s.toLowerCase() +} + +export default getDef +module.exports = getDef diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/typeof.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/typeof.ts new file mode 100644 index 000000000..a8b39fbfe --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/typeof.ts @@ -0,0 +1,27 @@ +import type {CodeKeywordDefinition, KeywordCxt} from "ajv" +import {_} from "ajv/dist/compile/codegen" + +const TYPES = ["undefined", "string", "number", "object", "function", "boolean", "symbol"] + +export default function getDef(): CodeKeywordDefinition { + return { + keyword: "typeof", + schemaType: ["string", "array"], + code(cxt: KeywordCxt) { + const {data, schema, schemaValue} = cxt + cxt.fail( + typeof schema == "string" + ? _`typeof ${data} != ${schema}` + : _`${schemaValue}.indexOf(typeof ${data}) < 0` + ) + }, + metaSchema: { + anyOf: [ + {type: "string", enum: TYPES}, + {type: "array", items: {type: "string", enum: TYPES}}, + ], + }, + } +} + +module.exports = getDef diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/uniqueItemProperties.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/uniqueItemProperties.ts new file mode 100644 index 000000000..8b2c6f945 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/definitions/uniqueItemProperties.ts @@ -0,0 +1,58 @@ +import type {FuncKeywordDefinition, AnySchemaObject} from "ajv" +import equal = require("fast-deep-equal") + +const SCALAR_TYPES = ["number", "integer", "string", "boolean", "null"] + +export default function getDef(): FuncKeywordDefinition { + return { + keyword: "uniqueItemProperties", + type: "array", + schemaType: "array", + compile(keys: string[], parentSchema: AnySchemaObject) { + const scalar = getScalarKeys(keys, parentSchema) + + return (data) => { + if (data.length <= 1) return true + for (let k = 0; k < keys.length; k++) { + const key = keys[k] + if (scalar[k]) { + const hash: Record = {} + for (const x of data) { + if (!x || typeof x != "object") continue + let p = x[key] + if (p && typeof p == "object") continue + if (typeof p == "string") p = '"' + p + if (hash[p]) return false + hash[p] = true + } + } else { + for (let i = data.length; i--; ) { + const x = data[i] + if (!x || typeof x != "object") continue + for (let j = i; j--; ) { + const y = data[j] + if (y && typeof y == "object" && equal(x[key], y[key])) return false + } + } + } + } + return true + } + }, + metaSchema: { + type: "array", + items: {type: "string"}, + }, + } +} + +function getScalarKeys(keys: string[], schema: AnySchemaObject): boolean[] { + return keys.map((key) => { + const t = schema.items?.properties?.[key]?.type + return Array.isArray(t) + ? !t.includes("object") && !t.includes("array") + : SCALAR_TYPES.includes(t) + }) +} + +module.exports = getDef diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/index.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/index.ts new file mode 100644 index 000000000..bb580fb3a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/index.ts @@ -0,0 +1,32 @@ +import type Ajv from "ajv" +import type {Plugin} from "ajv" +import plugins from "./keywords" + +export {AjvKeywordsError} from "./definitions" + +const ajvKeywords: Plugin = (ajv: Ajv, keyword?: string | string[]): Ajv => { + if (Array.isArray(keyword)) { + for (const k of keyword) get(k)(ajv) + return ajv + } + if (keyword) { + get(keyword)(ajv) + return ajv + } + for (keyword in plugins) get(keyword)(ajv) + return ajv +} + +ajvKeywords.get = get + +function get(keyword: string): Plugin { + const defFunc = plugins[keyword] + if (!defFunc) throw new Error("Unknown keyword " + keyword) + return defFunc +} + +export default ajvKeywords +module.exports = ajvKeywords + +// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access +module.exports.default = ajvKeywords diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/allRequired.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/allRequired.ts new file mode 100644 index 000000000..30cce4371 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/allRequired.ts @@ -0,0 +1,7 @@ +import type {Plugin} from "ajv" +import getDef from "../definitions/allRequired" + +const allRequired: Plugin = (ajv) => ajv.addKeyword(getDef()) + +export default allRequired +module.exports = allRequired diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/anyRequired.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/anyRequired.ts new file mode 100644 index 000000000..b55b817ef --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/anyRequired.ts @@ -0,0 +1,7 @@ +import type {Plugin} from "ajv" +import getDef from "../definitions/anyRequired" + +const anyRequired: Plugin = (ajv) => ajv.addKeyword(getDef()) + +export default anyRequired +module.exports = anyRequired diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/deepProperties.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/deepProperties.ts new file mode 100644 index 000000000..e035531e2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/deepProperties.ts @@ -0,0 +1,9 @@ +import type {Plugin} from "ajv" +import getDef from "../definitions/deepProperties" +import type {DefinitionOptions} from "../definitions/_types" + +const deepProperties: Plugin = (ajv, opts?: DefinitionOptions) => + ajv.addKeyword(getDef(opts)) + +export default deepProperties +module.exports = deepProperties diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/deepRequired.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/deepRequired.ts new file mode 100644 index 000000000..44b19ae2d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/deepRequired.ts @@ -0,0 +1,7 @@ +import type {Plugin} from "ajv" +import getDef from "../definitions/deepRequired" + +const deepRequired: Plugin = (ajv) => ajv.addKeyword(getDef()) + +export default deepRequired +module.exports = deepRequired diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/dynamicDefaults.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/dynamicDefaults.ts new file mode 100644 index 000000000..f8f820537 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/dynamicDefaults.ts @@ -0,0 +1,7 @@ +import type {Plugin} from "ajv" +import getDef from "../definitions/dynamicDefaults" + +const dynamicDefaults: Plugin = (ajv) => ajv.addKeyword(getDef()) + +export default dynamicDefaults +module.exports = dynamicDefaults diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/exclusiveRange.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/exclusiveRange.ts new file mode 100644 index 000000000..407a374e6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/exclusiveRange.ts @@ -0,0 +1,7 @@ +import type {Plugin} from "ajv" +import getDef from "../definitions/exclusiveRange" + +const exclusiveRange: Plugin = (ajv) => ajv.addKeyword(getDef()) + +export default exclusiveRange +module.exports = exclusiveRange diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/index.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/index.ts new file mode 100644 index 000000000..edf99963b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/index.ts @@ -0,0 +1,40 @@ +import type {Plugin} from "ajv" +import typeofPlugin from "./typeof" +import instanceofPlugin from "./instanceof" +import range from "./range" +import exclusiveRange from "./exclusiveRange" +import regexp from "./regexp" +import transform from "./transform" +import uniqueItemProperties from "./uniqueItemProperties" +import allRequired from "./allRequired" +import anyRequired from "./anyRequired" +import oneRequired from "./oneRequired" +import patternRequired from "./patternRequired" +import prohibited from "./prohibited" +import deepProperties from "./deepProperties" +import deepRequired from "./deepRequired" +import dynamicDefaults from "./dynamicDefaults" +import select from "./select" + +// TODO type +const ajvKeywords: Record | undefined> = { + typeof: typeofPlugin, + instanceof: instanceofPlugin, + range, + exclusiveRange, + regexp, + transform, + uniqueItemProperties, + allRequired, + anyRequired, + oneRequired, + patternRequired, + prohibited, + deepProperties, + deepRequired, + dynamicDefaults, + select, +} + +export default ajvKeywords +module.exports = ajvKeywords diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/instanceof.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/instanceof.ts new file mode 100644 index 000000000..98a2463dd --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/instanceof.ts @@ -0,0 +1,7 @@ +import type {Plugin} from "ajv" +import getDef from "../definitions/instanceof" + +const instanceofPlugin: Plugin = (ajv) => ajv.addKeyword(getDef()) + +export default instanceofPlugin +module.exports = instanceofPlugin diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/oneRequired.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/oneRequired.ts new file mode 100644 index 000000000..452bb244f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/oneRequired.ts @@ -0,0 +1,7 @@ +import type {Plugin} from "ajv" +import getDef from "../definitions/oneRequired" + +const oneRequired: Plugin = (ajv) => ajv.addKeyword(getDef()) + +export default oneRequired +module.exports = oneRequired diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/patternRequired.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/patternRequired.ts new file mode 100644 index 000000000..f9e4e50c9 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/patternRequired.ts @@ -0,0 +1,7 @@ +import type {Plugin} from "ajv" +import getDef from "../definitions/patternRequired" + +const patternRequired: Plugin = (ajv) => ajv.addKeyword(getDef()) + +export default patternRequired +module.exports = patternRequired diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/prohibited.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/prohibited.ts new file mode 100644 index 000000000..c4f057647 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/prohibited.ts @@ -0,0 +1,7 @@ +import type {Plugin} from "ajv" +import getDef from "../definitions/prohibited" + +const prohibited: Plugin = (ajv) => ajv.addKeyword(getDef()) + +export default prohibited +module.exports = prohibited diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/range.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/range.ts new file mode 100644 index 000000000..1fd28ce09 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/range.ts @@ -0,0 +1,7 @@ +import type {Plugin} from "ajv" +import getDef from "../definitions/range" + +const range: Plugin = (ajv) => ajv.addKeyword(getDef()) + +export default range +module.exports = range diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/regexp.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/regexp.ts new file mode 100644 index 000000000..48c461cba --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/regexp.ts @@ -0,0 +1,7 @@ +import type {Plugin} from "ajv" +import getDef from "../definitions/regexp" + +const regexp: Plugin = (ajv) => ajv.addKeyword(getDef()) + +export default regexp +module.exports = regexp diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/select.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/select.ts new file mode 100644 index 000000000..dc3bd8162 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/select.ts @@ -0,0 +1,11 @@ +import type {Plugin} from "ajv" +import getDefs from "../definitions/select" +import type {DefinitionOptions} from "../definitions/_types" + +const select: Plugin = (ajv, opts?: DefinitionOptions) => { + getDefs(opts).forEach((d) => ajv.addKeyword(d)) + return ajv +} + +export default select +module.exports = select diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/transform.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/transform.ts new file mode 100644 index 000000000..d6335ec40 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/transform.ts @@ -0,0 +1,7 @@ +import type {Plugin} from "ajv" +import getDef from "../definitions/transform" + +const transform: Plugin = (ajv) => ajv.addKeyword(getDef()) + +export default transform +module.exports = transform diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/typeof.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/typeof.ts new file mode 100644 index 000000000..a171c5072 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/typeof.ts @@ -0,0 +1,7 @@ +import type {Plugin} from "ajv" +import getDef from "../definitions/typeof" + +const typeofPlugin: Plugin = (ajv) => ajv.addKeyword(getDef()) + +export default typeofPlugin +module.exports = typeofPlugin diff --git a/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/uniqueItemProperties.ts b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/uniqueItemProperties.ts new file mode 100644 index 000000000..1dc5fe3e8 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv-keywords/src/keywords/uniqueItemProperties.ts @@ -0,0 +1,7 @@ +import type {Plugin} from "ajv" +import getDef from "../definitions/uniqueItemProperties" + +const uniqueItemProperties: Plugin = (ajv) => ajv.addKeyword(getDef()) + +export default uniqueItemProperties +module.exports = uniqueItemProperties diff --git a/node_modules/schema-utils/node_modules/ajv/.runkit_example.js b/node_modules/schema-utils/node_modules/ajv/.runkit_example.js new file mode 100644 index 000000000..0d578d5d5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/.runkit_example.js @@ -0,0 +1,23 @@ +const Ajv = require("ajv") +const ajv = new Ajv({allErrors: true}) + +const schema = { + type: "object", + properties: { + foo: {type: "string"}, + bar: {type: "number", maximum: 3}, + }, + required: ["foo", "bar"], + additionalProperties: false, +} + +const validate = ajv.compile(schema) + +test({foo: "abc", bar: 2}) +test({foo: 2, bar: 4}) + +function test(data) { + const valid = validate(data) + if (valid) console.log("Valid!") + else console.log("Invalid: " + ajv.errorsText(validate.errors)) +} diff --git a/node_modules/schema-utils/node_modules/ajv/LICENSE b/node_modules/schema-utils/node_modules/ajv/LICENSE new file mode 100644 index 000000000..139162ad2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015-2021 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/node_modules/schema-utils/node_modules/ajv/README.md b/node_modules/schema-utils/node_modules/ajv/README.md new file mode 100644 index 000000000..aa3baaab5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/README.md @@ -0,0 +1,193 @@ +Ajv logo + +  + +# Ajv JSON schema validator + +The fastest JSON validator for Node.js and browser. + +Supports JSON Schema draft-04/06/07/2019-09/2020-12 ([draft-04 support](https://ajv.js.org/json-schema.html#draft-04) requires ajv-draft-04 package) and JSON Type Definition [RFC8927](https://datatracker.ietf.org/doc/rfc8927/). + +[![build](https://github.com/ajv-validator/ajv/workflows/build/badge.svg)](https://github.com/ajv-validator/ajv/actions?query=workflow%3Abuild) +[![npm](https://img.shields.io/npm/v/ajv.svg)](https://www.npmjs.com/package/ajv) +[![npm downloads](https://img.shields.io/npm/dm/ajv.svg)](https://www.npmjs.com/package/ajv) +[![Coverage Status](https://coveralls.io/repos/github/ajv-validator/ajv/badge.svg?branch=master)](https://coveralls.io/github/ajv-validator/ajv?branch=master) +[![SimpleX](https://img.shields.io/badge/chat-on%20SimpleX-%2307b4b9)](https://simplex.chat/contact#/?v=1&smp=smp%3A%2F%2Fu2dS9sG8nMNURyZwqASV4yROM28Er0luVTx5X1CsMrU%3D%40smp4.simplex.im%2Fap4lMFzfXF8Hzmh-Vz0WNxp_1jKiOa-h%23MCowBQYDK2VuAyEAcdefddRvDfI8iAuBpztm_J3qFucj8MDZoVs_2EcMTzU%3D) +[![Gitter](https://img.shields.io/gitter/room/ajv-validator/ajv.svg)](https://gitter.im/ajv-validator/ajv) +[![GitHub Sponsors](https://img.shields.io/badge/$-sponsors-brightgreen)](https://github.com/sponsors/epoberezkin) + +## Ajv sponsors + +[Mozilla](https://www.mozilla.org)[](https://opencollective.com/ajv) + +[Microsoft](https://opensource.microsoft.com)[](https://opencollective.com/ajv)[](https://opencollective.com/ajv) + +[Retool](https://retool.com/?utm_source=sponsor&utm_campaign=ajv)[Tidelift](https://tidelift.com/subscription/pkg/npm-ajv?utm_source=npm-ajv&utm_medium=referral&utm_campaign=enterprise)[SimpleX](https://github.com/simplex-chat/simplex-chat)[](https://opencollective.com/ajv) + +## Contributing + +More than 100 people contributed to Ajv, and we would love to have you join the development. We welcome implementing new features that will benefit many users and ideas to improve our documentation. + +Please review [Contributing guidelines](./CONTRIBUTING.md) and [Code components](https://ajv.js.org/components.html). + +## Documentation + +All documentation is available on the [Ajv website](https://ajv.js.org). + +Some useful site links: +- [Getting started](https://ajv.js.org/guide/getting-started.html) +- [JSON Schema vs JSON Type Definition](https://ajv.js.org/guide/schema-language.html) +- [API reference](https://ajv.js.org/api.html) +- [Strict mode](https://ajv.js.org/strict-mode.html) +- [Standalone validation code](https://ajv.js.org/standalone.html) +- [Security considerations](https://ajv.js.org/security.html) +- [Command line interface](https://ajv.js.org/packages/ajv-cli.html) +- [Frequently Asked Questions](https://ajv.js.org/faq.html) + +## Please [sponsor Ajv development](https://github.com/sponsors/epoberezkin) + +Since I asked to support Ajv development 40 people and 6 organizations contributed via GitHub and OpenCollective - this support helped receiving the MOSS grant! + +Your continuing support is very important - the funds will be used to develop and maintain Ajv once the next major version is released. + +Please sponsor Ajv via: + +- [GitHub sponsors page](https://github.com/sponsors/epoberezkin) (GitHub will match it) +- [Ajv Open Collective️](https://opencollective.com/ajv) + +Thank you. + +#### Open Collective sponsors + + + + + + + + + + + + + + + + +## Performance + +Ajv generates code to turn JSON Schemas into super-fast validation functions that are efficient for v8 optimization. + +Currently Ajv is the fastest and the most standard compliant validator according to these benchmarks: + +- [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark) - 50% faster than the second place +- [jsck benchmark](https://github.com/pandastrike/jsck#benchmarks) - 20-190% faster +- [z-schema benchmark](https://rawgit.com/zaggino/z-schema/master/benchmark/results.html) +- [themis benchmark](https://cdn.rawgit.com/playlyfe/themis/master/benchmark/results.html) + +Performance of different validators by [json-schema-benchmark](https://github.com/ebdrup/json-schema-benchmark): + +[![performance](https://chart.googleapis.com/chart?chxt=x,y&cht=bhs&chco=76A4FB&chls=2.0&chbh=62,4,1&chs=600x416&chxl=-1:|ajv|@exodus/schemasafe|is-my-json-valid|djv|@cfworker/json-schema|jsonschema&chd=t:100,69.2,51.5,13.1,5.1,1.2)](https://github.com/ebdrup/json-schema-benchmark/blob/master/README.md#performance) + +## Features + +- Ajv implements JSON Schema [draft-06/07/2019-09/2020-12](http://json-schema.org/) standards (draft-04 is supported in v6): + - all validation keywords (see [JSON Schema validation keywords](https://ajv.js.org/json-schema.html)) + - [OpenAPI](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md) extensions: + - NEW: keyword [discriminator](https://ajv.js.org/json-schema.html#discriminator). + - keyword [nullable](https://ajv.js.org/json-schema.html#nullable). + - full support of remote references (remote schemas have to be added with `addSchema` or compiled to be available) + - support of recursive references between schemas + - correct string lengths for strings with unicode pairs + - JSON Schema [formats](https://ajv.js.org/guide/formats.html) (with [ajv-formats](https://github.com/ajv-validator/ajv-formats) plugin). + - [validates schemas against meta-schema](https://ajv.js.org/api.html#api-validateschema) +- NEW: supports [JSON Type Definition](https://datatracker.ietf.org/doc/rfc8927/): + - all keywords (see [JSON Type Definition schema forms](https://ajv.js.org/json-type-definition.html)) + - meta-schema for JTD schemas + - "union" keyword and user-defined keywords (can be used inside "metadata" member of the schema) +- supports [browsers](https://ajv.js.org/guide/environments.html#browsers) and Node.js 10.x - current +- [asynchronous loading](https://ajv.js.org/guide/managing-schemas.html#asynchronous-schema-loading) of referenced schemas during compilation +- "All errors" validation mode with [option allErrors](https://ajv.js.org/options.html#allerrors) +- [error messages with parameters](https://ajv.js.org/api.html#validation-errors) describing error reasons to allow error message generation +- i18n error messages support with [ajv-i18n](https://github.com/ajv-validator/ajv-i18n) package +- [removing-additional-properties](https://ajv.js.org/guide/modifying-data.html#removing-additional-properties) +- [assigning defaults](https://ajv.js.org/guide/modifying-data.html#assigning-defaults) to missing properties and items +- [coercing data](https://ajv.js.org/guide/modifying-data.html#coercing-data-types) to the types specified in `type` keywords +- [user-defined keywords](https://ajv.js.org/guide/user-keywords.html) +- additional extension keywords with [ajv-keywords](https://github.com/ajv-validator/ajv-keywords) package +- [\$data reference](https://ajv.js.org/guide/combining-schemas.html#data-reference) to use values from the validated data as values for the schema keywords +- [asynchronous validation](https://ajv.js.org/guide/async-validation.html) of user-defined formats and keywords + +## Install + +To install version 8: + +``` +npm install ajv +``` + +## Getting started + +Try it in the Node.js REPL: https://runkit.com/npm/ajv + +In JavaScript: + +```javascript +// or ESM/TypeScript import +import Ajv from "ajv" +// Node.js require: +const Ajv = require("ajv") + +const ajv = new Ajv() // options can be passed, e.g. {allErrors: true} + +const schema = { + type: "object", + properties: { + foo: {type: "integer"}, + bar: {type: "string"} + }, + required: ["foo"], + additionalProperties: false, +} + +const data = { + foo: 1, + bar: "abc" +} + +const validate = ajv.compile(schema) +const valid = validate(data) +if (!valid) console.log(validate.errors) +``` + +Learn how to use Ajv and see more examples in the [Guide: getting started](https://ajv.js.org/guide/getting-started.html) + +## Changes history + +See [https://github.com/ajv-validator/ajv/releases](https://github.com/ajv-validator/ajv/releases) + +**Please note**: [Changes in version 8.0.0](https://github.com/ajv-validator/ajv/releases/tag/v8.0.0) + +[Version 7.0.0](https://github.com/ajv-validator/ajv/releases/tag/v7.0.0) + +[Version 6.0.0](https://github.com/ajv-validator/ajv/releases/tag/v6.0.0). + +## Code of conduct + +Please review and follow the [Code of conduct](./CODE_OF_CONDUCT.md). + +Please report any unacceptable behaviour to ajv.validator@gmail.com - it will be reviewed by the project team. + +## Security contact + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerabilities via GitHub issues. + +## Open-source software support + +Ajv is a part of [Tidelift subscription](https://tidelift.com/subscription/pkg/npm-ajv?utm_source=npm-ajv&utm_medium=referral&utm_campaign=readme) - it provides a centralised support to open-source software users, in addition to the support provided by software maintainers. + +## License + +[MIT](./LICENSE) diff --git a/node_modules/schema-utils/node_modules/ajv/dist/2019.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/2019.d.ts new file mode 100644 index 000000000..5a391dd6e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/2019.d.ts @@ -0,0 +1,17 @@ +import type { AnySchemaObject } from "./types"; +import AjvCore, { Options } from "./core"; +declare class Ajv2019 extends AjvCore { + constructor(opts?: Options); + _addVocabularies(): void; + _addDefaultMetaSchema(): void; + defaultMeta(): string | AnySchemaObject | undefined; +} +export default Ajv2019; +export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, ErrorNoParams, } from "./types"; +export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core"; +export { SchemaCxt, SchemaObjCxt } from "./compile"; +export { KeywordCxt } from "./compile/validate"; +export { DefinedError } from "./vocabularies/errors"; +export { JSONType } from "./compile/rules"; +export { JSONSchemaType } from "./types/json-schema"; +export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/2019.js b/node_modules/schema-utils/node_modules/ajv/dist/2019.js new file mode 100644 index 000000000..89d78532f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/2019.js @@ -0,0 +1,55 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0; +const core_1 = require("./core"); +const draft7_1 = require("./vocabularies/draft7"); +const dynamic_1 = require("./vocabularies/dynamic"); +const next_1 = require("./vocabularies/next"); +const unevaluated_1 = require("./vocabularies/unevaluated"); +const discriminator_1 = require("./vocabularies/discriminator"); +const json_schema_2019_09_1 = require("./refs/json-schema-2019-09"); +const META_SCHEMA_ID = "https://json-schema.org/draft/2019-09/schema"; +class Ajv2019 extends core_1.default { + constructor(opts = {}) { + super({ + ...opts, + dynamicRef: true, + next: true, + unevaluated: true, + }); + } + _addVocabularies() { + super._addVocabularies(); + this.addVocabulary(dynamic_1.default); + draft7_1.default.forEach((v) => this.addVocabulary(v)); + this.addVocabulary(next_1.default); + this.addVocabulary(unevaluated_1.default); + if (this.opts.discriminator) + this.addKeyword(discriminator_1.default); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + const { $data, meta } = this.opts; + if (!meta) + return; + json_schema_2019_09_1.default.call(this, $data); + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID; + } + defaultMeta() { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); + } +} +module.exports = exports = Ajv2019; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = Ajv2019; +var validate_1 = require("./compile/validate"); +Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +//# sourceMappingURL=2019.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/2019.js.map b/node_modules/schema-utils/node_modules/ajv/dist/2019.js.map new file mode 100644 index 000000000..8e4e87cae --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/2019.js.map @@ -0,0 +1 @@ +{"version":3,"file":"2019.js","sourceRoot":"","sources":["../lib/2019.ts"],"names":[],"mappings":";;;AACA,iCAAuC;AAEvC,kDAAsD;AACtD,oDAAsD;AACtD,8CAAgD;AAChD,4DAA8D;AAC9D,gEAAwD;AACxD,oEAA0D;AAE1D,MAAM,cAAc,GAAG,8CAA8C,CAAA;AAErE,MAAM,OAAQ,SAAQ,cAAO;IAC3B,YAAY,OAAgB,EAAE;QAC5B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,UAAU,EAAE,IAAI;YAChB,IAAI,EAAE,IAAI;YACV,WAAW,EA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A;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/2020.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/2020.d.ts new file mode 100644 index 000000000..21bae8f60 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/2020.d.ts @@ -0,0 +1,17 @@ +import type { AnySchemaObject } from "./types"; +import AjvCore, { Options } from "./core"; +declare class Ajv2020 extends AjvCore { + constructor(opts?: Options); + _addVocabularies(): void; + _addDefaultMetaSchema(): void; + defaultMeta(): string | AnySchemaObject | undefined; +} +export default Ajv2020; +export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, ErrorNoParams, } from "./types"; +export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core"; +export { SchemaCxt, SchemaObjCxt } from "./compile"; +export { KeywordCxt } from "./compile/validate"; +export { DefinedError } from "./vocabularies/errors"; +export { JSONType } from "./compile/rules"; +export { JSONSchemaType } from "./types/json-schema"; +export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/2020.js b/node_modules/schema-utils/node_modules/ajv/dist/2020.js new file mode 100644 index 000000000..bdd1dd69d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/2020.js @@ -0,0 +1,49 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0; +const core_1 = require("./core"); +const draft2020_1 = require("./vocabularies/draft2020"); +const discriminator_1 = require("./vocabularies/discriminator"); +const json_schema_2020_12_1 = require("./refs/json-schema-2020-12"); +const META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema"; +class Ajv2020 extends core_1.default { + constructor(opts = {}) { + super({ + ...opts, + dynamicRef: true, + next: true, + unevaluated: true, + }); + } + _addVocabularies() { + super._addVocabularies(); + draft2020_1.default.forEach((v) => this.addVocabulary(v)); + if (this.opts.discriminator) + this.addKeyword(discriminator_1.default); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + const { $data, meta } = this.opts; + if (!meta) + return; + json_schema_2020_12_1.default.call(this, $data); + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID; + } + defaultMeta() { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); + } +} +module.exports = exports = Ajv2020; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = Ajv2020; +var validate_1 = require("./compile/validate"); +Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +//# sourceMappingURL=2020.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/2020.js.map b/node_modules/schema-utils/node_modules/ajv/dist/2020.js.map new file mode 100644 index 000000000..922393521 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/2020.js.map @@ -0,0 +1 @@ +{"version":3,"file":"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Y,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,OAAO,CAAA;AAyBtB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAIlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/ajv.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/ajv.d.ts new file mode 100644 index 000000000..ce43bbf2e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/ajv.d.ts @@ -0,0 +1,16 @@ +import type { AnySchemaObject } from "./types"; +import AjvCore from "./core"; +declare class Ajv extends AjvCore { + _addVocabularies(): void; + _addDefaultMetaSchema(): void; + defaultMeta(): string | AnySchemaObject | undefined; +} +export default Ajv; +export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, SchemaValidateFunction, ErrorObject, ErrorNoParams, } from "./types"; +export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core"; +export { SchemaCxt, SchemaObjCxt } from "./compile"; +export { KeywordCxt } from "./compile/validate"; +export { DefinedError } from "./vocabularies/errors"; +export { JSONType } from "./compile/rules"; +export { JSONSchemaType } from "./types/json-schema"; +export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/ajv.js b/node_modules/schema-utils/node_modules/ajv/dist/ajv.js new file mode 100644 index 000000000..219bcf0da --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/ajv.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0; +const core_1 = require("./core"); +const draft7_1 = require("./vocabularies/draft7"); +const discriminator_1 = require("./vocabularies/discriminator"); +const draft7MetaSchema = require("./refs/json-schema-draft-07.json"); +const META_SUPPORT_DATA = ["/properties"]; +const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema"; +class Ajv extends core_1.default { + _addVocabularies() { + super._addVocabularies(); + draft7_1.default.forEach((v) => this.addVocabulary(v)); + if (this.opts.discriminator) + this.addKeyword(discriminator_1.default); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + if (!this.opts.meta) + return; + const metaSchema = this.opts.$data + ? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA) + : draft7MetaSchema; + this.addMetaSchema(metaSchema, META_SCHEMA_ID, false); + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID; + } + defaultMeta() { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); + } +} +module.exports = exports = Ajv; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = Ajv; +var validate_1 = require("./compile/validate"); +Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +//# sourceMappingURL=ajv.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/ajv.js.map b/node_modules/schema-utils/node_modules/ajv/dist/ajv.js.map new file mode 100644 index 000000000..18006d4b7 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/ajv.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ajv.js","sourceRoot":"","sources":["../lib/ajv.ts"],"names":[],"mappings":";;;AACA,iCAA4B;AAC5B,kDAAsD;AACtD,gEAAwD;AACxD,qEAAoE;AAEpE,MAAM,iBAAiB,GAAG,CAAC,aAAa,CAAC,CAAA;AAEzC,MAAM,cAAc,GAAG,wCAAwC,CAAA;AAE/D,MAAM,GAAI,SAAQ,cAAO;IACvB,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,gBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAA;QACxD,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa;YAAE,IAAI,CAAC,UAAU,CAAC,uBAAa,CAAC,CAAA;IAC7D,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAM;QAC3B,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK;YAChC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,gBAAgB,EAAE,iBAAiB,CAAC;YAC3D,CAAC,CAAC,gBAAgB,CAAA;QACpB,IAAI,CAAC,aAAa,CAAC,UAAU,EAAE,cAAc,EAAE,KAAK,CAAC,CAAA;QACrD,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,GAAG,cAAc,CAAA;IAC7D,CAAC;IAED,WAAW;QACT,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW;YAC3B,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAA;IACzF,CAAC;CACF;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,GAAG,CAAA;AAC9B,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,GAAG,CAAA;AA0BlB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAIlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/code.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/code.d.ts new file mode 100644 index 000000000..8023c1817 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/code.d.ts @@ -0,0 +1,40 @@ +export declare abstract class _CodeOrName { + abstract readonly str: string; + abstract readonly names: UsedNames; + abstract toString(): string; + abstract emptyStr(): boolean; +} +export declare const IDENTIFIER: RegExp; +export declare class Name extends _CodeOrName { + readonly str: string; + constructor(s: string); + toString(): string; + emptyStr(): boolean; + get names(): UsedNames; +} +export declare class _Code extends _CodeOrName { + readonly _items: readonly CodeItem[]; + private _str?; + private _names?; + constructor(code: string | readonly CodeItem[]); + toString(): string; + emptyStr(): boolean; + get str(): string; + get names(): UsedNames; +} +export declare type CodeItem = Name | string | number | boolean | null; +export declare type UsedNames = Record; +export declare type Code = _Code | Name; +export declare type SafeExpr = Code | number | boolean | null; +export declare const nil: _Code; +declare type CodeArg = SafeExpr | string | undefined; +export declare function _(strs: TemplateStringsArray, ...args: CodeArg[]): _Code; +export declare function str(strs: TemplateStringsArray, ...args: (CodeArg | string[])[]): _Code; +export declare function addCodeArg(code: CodeItem[], arg: CodeArg | string[]): void; +export declare function strConcat(c1: Code, c2: Code): Code; +export declare function stringify(x: unknown): Code; +export declare function safeStringify(x: unknown): string; +export declare function getProperty(key: Code | string | number): Code; +export declare function getEsmExportName(key: Code | string | number): Code; +export declare function regexpCode(rx: RegExp): Code; +export {}; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/code.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/code.js new file mode 100644 index 000000000..f8268838a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/code.js @@ -0,0 +1,155 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = void 0; +class _CodeOrName { +} +exports._CodeOrName = _CodeOrName; +exports.IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; +class Name extends _CodeOrName { + constructor(s) { + super(); + if (!exports.IDENTIFIER.test(s)) + throw new Error("CodeGen: name must be a valid identifier"); + this.str = s; + } + toString() { + return this.str; + } + emptyStr() { + return false; + } + get names() { + return { [this.str]: 1 }; + } +} +exports.Name = Name; +class _Code extends _CodeOrName { + constructor(code) { + super(); + this._items = typeof code === "string" ? [code] : code; + } + toString() { + return this.str; + } + emptyStr() { + if (this._items.length > 1) + return false; + const item = this._items[0]; + return item === "" || item === '""'; + } + get str() { + var _a; + return ((_a = this._str) !== null && _a !== void 0 ? _a : (this._str = this._items.reduce((s, c) => `${s}${c}`, ""))); + } + get names() { + var _a; + return ((_a = this._names) !== null && _a !== void 0 ? _a : (this._names = this._items.reduce((names, c) => { + if (c instanceof Name) + names[c.str] = (names[c.str] || 0) + 1; + return names; + }, {}))); + } +} +exports._Code = _Code; +exports.nil = new _Code(""); +function _(strs, ...args) { + const code = [strs[0]]; + let i = 0; + while (i < args.length) { + addCodeArg(code, args[i]); + code.push(strs[++i]); + } + return new _Code(code); +} +exports._ = _; +const plus = new _Code("+"); +function str(strs, ...args) { + const expr = [safeStringify(strs[0])]; + let i = 0; + while (i < args.length) { + expr.push(plus); + addCodeArg(expr, args[i]); + expr.push(plus, safeStringify(strs[++i])); + } + optimize(expr); + return new _Code(expr); +} +exports.str = str; +function addCodeArg(code, arg) { + if (arg instanceof _Code) + code.push(...arg._items); + else if (arg instanceof Name) + code.push(arg); + else + code.push(interpolate(arg)); +} +exports.addCodeArg = addCodeArg; +function optimize(expr) { + let i = 1; + while (i < expr.length - 1) { + if (expr[i] === plus) { + const res = mergeExprItems(expr[i - 1], expr[i + 1]); + if (res !== undefined) { + expr.splice(i - 1, 3, res); + continue; + } + expr[i++] = "+"; + } + i++; + } +} +function mergeExprItems(a, b) { + if (b === '""') + return a; + if (a === '""') + return b; + if (typeof a == "string") { + if (b instanceof Name || a[a.length - 1] !== '"') + return; + if (typeof b != "string") + return `${a.slice(0, -1)}${b}"`; + if (b[0] === '"') + return a.slice(0, -1) + b.slice(1); + return; + } + if (typeof b == "string" && b[0] === '"' && !(a instanceof Name)) + return `"${a}${b.slice(1)}`; + return; +} +function strConcat(c1, c2) { + return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str `${c1}${c2}`; +} +exports.strConcat = strConcat; +// TODO do not allow arrays here +function interpolate(x) { + return typeof x == "number" || typeof x == "boolean" || x === null + ? x + : safeStringify(Array.isArray(x) ? x.join(",") : x); +} +function stringify(x) { + return new _Code(safeStringify(x)); +} +exports.stringify = stringify; +function safeStringify(x) { + return JSON.stringify(x) + .replace(/\u2028/g, "\\u2028") + .replace(/\u2029/g, "\\u2029"); +} +exports.safeStringify = safeStringify; +function getProperty(key) { + return typeof key == "string" && exports.IDENTIFIER.test(key) ? new _Code(`.${key}`) : _ `[${key}]`; +} +exports.getProperty = getProperty; +//Does best effort to format the name properly +function getEsmExportName(key) { + if (typeof key == "string" && exports.IDENTIFIER.test(key)) { + return new _Code(`${key}`); + } + throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`); +} +exports.getEsmExportName = getEsmExportName; +function regexpCode(rx) { + return new _Code(rx.toString()); +} +exports.regexpCode = regexpCode; +//# sourceMappingURL=code.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/code.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/code.js.map new file mode 100644 index 000000000..c5c7a3961 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/code.js.map @@ -0,0 +1 @@ +{"version":3,"file":"code.js","sourceRoot":"","sources":["../../../lib/compile/codegen/code.ts"],"names":[],"mappings":";;;AAAA,MAAsB,WAAW;CAKhC;AALD,kCAKC;AAEY,QAAA,UAAU,GAAG,uBAAuB,CAAA;AAEjD,MAAa,IAAK,SAAQ,WAAW;IAEnC,YAAY,CAAS;QACnB,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,kBAAU,CAAC,IAAI,CAAC,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAA;QACpF,IAAI,CAAC,GAAG,GAAG,CAAC,CAAA;IACd,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,GAAG,CAAA;IACjB,CAAC;IAED,QAAQ;QACN,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,KAAK;QACP,OAAO,EAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,EAAC,CAAA;IACxB,CAAC;CACF;AAnBD,oBAmBC;AAED,MAAa,KAAM,SAAQ,WAAW;IAKpC,YAAY,IAAkC;QAC5C,KAAK,EAAE,CAAA;QACP,IAAI,CAAC,MAAM,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACxD,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CA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AAI,QAAQ,IAAI,kBAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAClD,OAAO,IAAI,KAAK,CAAC,GAAG,GAAG,EAAE,CAAC,CAAA;KAC3B;IACD,MAAM,IAAI,KAAK,CAAC,iCAAiC,GAAG,iCAAiC,CAAC,CAAA;AACxF,CAAC;AALD,4CAKC;AAED,SAAgB,UAAU,CAAC,EAAU;IACnC,OAAO,IAAI,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAA;AACjC,CAAC;AAFD,gCAEC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/index.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/index.d.ts new file mode 100644 index 000000000..db9101ddb --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/index.d.ts @@ -0,0 +1,79 @@ +import type { ScopeValueSets, NameValue, ValueScope, ValueScopeName } from "./scope"; +import { _Code, Code, Name } from "./code"; +import { Scope } from "./scope"; +export { _, str, strConcat, nil, getProperty, stringify, regexpCode, Name, Code } from "./code"; +export { Scope, ScopeStore, ValueScope, ValueScopeName, ScopeValueSets, varKinds } from "./scope"; +export declare type SafeExpr = Code | number | boolean | null; +export declare type Block = Code | (() => void); +export declare const operators: { + GT: _Code; + GTE: _Code; + LT: _Code; + LTE: _Code; + EQ: _Code; + NEQ: _Code; + NOT: _Code; + OR: _Code; + AND: _Code; + ADD: _Code; +}; +export interface CodeGenOptions { + es5?: boolean; + lines?: boolean; + ownProperties?: boolean; +} +export declare class CodeGen { + readonly _scope: Scope; + readonly _extScope: ValueScope; + readonly _values: ScopeValueSets; + private readonly _nodes; + private readonly _blockStarts; + private readonly _constants; + private readonly opts; + constructor(extScope: ValueScope, opts?: CodeGenOptions); + toString(): string; + name(prefix: string): Name; + scopeName(prefix: string): ValueScopeName; + scopeValue(prefixOrName: ValueScopeName | string, value: NameValue): Name; + getScopeValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined; + scopeRefs(scopeName: Name): Code; + scopeCode(): Code; + private _def; + const(nameOrPrefix: Name | string, rhs: SafeExpr, _constant?: boolean): Name; + let(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name; + var(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name; + assign(lhs: Code, rhs: SafeExpr, sideEffects?: boolean): CodeGen; + add(lhs: Code, rhs: SafeExpr): CodeGen; + code(c: Block | SafeExpr): CodeGen; + object(...keyValues: [Name | string, SafeExpr | string][]): _Code; + if(condition: Code | boolean, thenBody?: Block, elseBody?: Block): CodeGen; + elseIf(condition: Code | boolean): CodeGen; + else(): CodeGen; + endIf(): CodeGen; + private _for; + for(iteration: Code, forBody?: Block): CodeGen; + forRange(nameOrPrefix: Name | string, from: SafeExpr, to: SafeExpr, forBody: (index: Name) => void, varKind?: Code): CodeGen; + forOf(nameOrPrefix: Name | string, iterable: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen; + forIn(nameOrPrefix: Name | string, obj: Code, forBody: (item: Name) => void, varKind?: Code): CodeGen; + endFor(): CodeGen; + label(label: Name): CodeGen; + break(label?: Code): CodeGen; + return(value: Block | SafeExpr): CodeGen; + try(tryBody: Block, catchCode?: (e: Name) => void, finallyCode?: Block): CodeGen; + throw(error: Code): CodeGen; + block(body?: Block, nodeCount?: number): CodeGen; + endBlock(nodeCount?: number): CodeGen; + func(name: Name, args?: Code, async?: boolean, funcBody?: Block): CodeGen; + endFunc(): CodeGen; + optimize(n?: number): void; + private _leafNode; + private _blockNode; + private _endBlockNode; + private _elseNode; + private get _root(); + private get _currNode(); + private set _currNode(value); +} +export declare function not(x: T): T; +export declare function and(...args: Code[]): Code; +export declare function or(...args: Code[]): Code; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/index.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/index.js new file mode 100644 index 000000000..a6c805af1 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/index.js @@ -0,0 +1,697 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = void 0; +const code_1 = require("./code"); +const scope_1 = require("./scope"); +var code_2 = require("./code"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return code_2._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return code_2.str; } }); +Object.defineProperty(exports, "strConcat", { enumerable: true, get: function () { return code_2.strConcat; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return code_2.nil; } }); +Object.defineProperty(exports, "getProperty", { enumerable: true, get: function () { return code_2.getProperty; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return code_2.stringify; } }); +Object.defineProperty(exports, "regexpCode", { enumerable: true, get: function () { return code_2.regexpCode; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return code_2.Name; } }); +var scope_2 = require("./scope"); +Object.defineProperty(exports, "Scope", { enumerable: true, get: function () { return scope_2.Scope; } }); +Object.defineProperty(exports, "ValueScope", { enumerable: true, get: function () { return scope_2.ValueScope; } }); +Object.defineProperty(exports, "ValueScopeName", { enumerable: true, get: function () { return scope_2.ValueScopeName; } }); +Object.defineProperty(exports, "varKinds", { enumerable: true, get: function () { return scope_2.varKinds; } }); +exports.operators = { + GT: new code_1._Code(">"), + GTE: new code_1._Code(">="), + LT: new code_1._Code("<"), + LTE: new code_1._Code("<="), + EQ: new code_1._Code("==="), + NEQ: new code_1._Code("!=="), + NOT: new code_1._Code("!"), + OR: new code_1._Code("||"), + AND: new code_1._Code("&&"), + ADD: new code_1._Code("+"), +}; +class Node { + optimizeNodes() { + return this; + } + optimizeNames(_names, _constants) { + return this; + } +} +class Def extends Node { + constructor(varKind, name, rhs) { + super(); + this.varKind = varKind; + this.name = name; + this.rhs = rhs; + } + render({ es5, _n }) { + const varKind = es5 ? scope_1.varKinds.var : this.varKind; + const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}`; + return `${varKind} ${this.name}${rhs};` + _n; + } + optimizeNames(names, constants) { + if (!names[this.name.str]) + return; + if (this.rhs) + this.rhs = optimizeExpr(this.rhs, names, constants); + return this; + } + get names() { + return this.rhs instanceof code_1._CodeOrName ? this.rhs.names : {}; + } +} +class Assign extends Node { + constructor(lhs, rhs, sideEffects) { + super(); + this.lhs = lhs; + this.rhs = rhs; + this.sideEffects = sideEffects; + } + render({ _n }) { + return `${this.lhs} = ${this.rhs};` + _n; + } + optimizeNames(names, constants) { + if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects) + return; + this.rhs = optimizeExpr(this.rhs, names, constants); + return this; + } + get names() { + const names = this.lhs instanceof code_1.Name ? {} : { ...this.lhs.names }; + return addExprNames(names, this.rhs); + } +} +class AssignOp extends Assign { + constructor(lhs, op, rhs, sideEffects) { + super(lhs, rhs, sideEffects); + this.op = op; + } + render({ _n }) { + return `${this.lhs} ${this.op}= ${this.rhs};` + _n; + } +} +class Label extends Node { + constructor(label) { + super(); + this.label = label; + this.names = {}; + } + render({ _n }) { + return `${this.label}:` + _n; + } +} +class Break extends Node { + constructor(label) { + super(); + this.label = label; + this.names = {}; + } + render({ _n }) { + const label = this.label ? ` ${this.label}` : ""; + return `break${label};` + _n; + } +} +class Throw extends Node { + constructor(error) { + super(); + this.error = error; + } + render({ _n }) { + return `throw ${this.error};` + _n; + } + get names() { + return this.error.names; + } +} +class AnyCode extends Node { + constructor(code) { + super(); + this.code = code; + } + render({ _n }) { + return `${this.code};` + _n; + } + optimizeNodes() { + return `${this.code}` ? this : undefined; + } + optimizeNames(names, constants) { + this.code = optimizeExpr(this.code, names, constants); + return this; + } + get names() { + return this.code instanceof code_1._CodeOrName ? this.code.names : {}; + } +} +class ParentNode extends Node { + constructor(nodes = []) { + super(); + this.nodes = nodes; + } + render(opts) { + return this.nodes.reduce((code, n) => code + n.render(opts), ""); + } + optimizeNodes() { + const { nodes } = this; + let i = nodes.length; + while (i--) { + const n = nodes[i].optimizeNodes(); + if (Array.isArray(n)) + nodes.splice(i, 1, ...n); + else if (n) + nodes[i] = n; + else + nodes.splice(i, 1); + } + return nodes.length > 0 ? this : undefined; + } + optimizeNames(names, constants) { + const { nodes } = this; + let i = nodes.length; + while (i--) { + // iterating backwards improves 1-pass optimization + const n = nodes[i]; + if (n.optimizeNames(names, constants)) + continue; + subtractNames(names, n.names); + nodes.splice(i, 1); + } + return nodes.length > 0 ? this : undefined; + } + get names() { + return this.nodes.reduce((names, n) => addNames(names, n.names), {}); + } +} +class BlockNode extends ParentNode { + render(opts) { + return "{" + opts._n + super.render(opts) + "}" + opts._n; + } +} +class Root extends ParentNode { +} +class Else extends BlockNode { +} +Else.kind = "else"; +class If extends BlockNode { + constructor(condition, nodes) { + super(nodes); + this.condition = condition; + } + render(opts) { + let code = `if(${this.condition})` + super.render(opts); + if (this.else) + code += "else " + this.else.render(opts); + return code; + } + optimizeNodes() { + super.optimizeNodes(); + const cond = this.condition; + if (cond === true) + return this.nodes; // else is ignored here + let e = this.else; + if (e) { + const ns = e.optimizeNodes(); + e = this.else = Array.isArray(ns) ? new Else(ns) : ns; + } + if (e) { + if (cond === false) + return e instanceof If ? e : e.nodes; + if (this.nodes.length) + return this; + return new If(not(cond), e instanceof If ? [e] : e.nodes); + } + if (cond === false || !this.nodes.length) + return undefined; + return this; + } + optimizeNames(names, constants) { + var _a; + this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants); + if (!(super.optimizeNames(names, constants) || this.else)) + return; + this.condition = optimizeExpr(this.condition, names, constants); + return this; + } + get names() { + const names = super.names; + addExprNames(names, this.condition); + if (this.else) + addNames(names, this.else.names); + return names; + } +} +If.kind = "if"; +class For extends BlockNode { +} +For.kind = "for"; +class ForLoop extends For { + constructor(iteration) { + super(); + this.iteration = iteration; + } + render(opts) { + return `for(${this.iteration})` + super.render(opts); + } + optimizeNames(names, constants) { + if (!super.optimizeNames(names, constants)) + return; + this.iteration = optimizeExpr(this.iteration, names, constants); + return this; + } + get names() { + return addNames(super.names, this.iteration.names); + } +} +class ForRange extends For { + constructor(varKind, name, from, to) { + super(); + this.varKind = varKind; + this.name = name; + this.from = from; + this.to = to; + } + render(opts) { + const varKind = opts.es5 ? scope_1.varKinds.var : this.varKind; + const { name, from, to } = this; + return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts); + } + get names() { + const names = addExprNames(super.names, this.from); + return addExprNames(names, this.to); + } +} +class ForIter extends For { + constructor(loop, varKind, name, iterable) { + super(); + this.loop = loop; + this.varKind = varKind; + this.name = name; + this.iterable = iterable; + } + render(opts) { + return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts); + } + optimizeNames(names, constants) { + if (!super.optimizeNames(names, constants)) + return; + this.iterable = optimizeExpr(this.iterable, names, constants); + return this; + } + get names() { + return addNames(super.names, this.iterable.names); + } +} +class Func extends BlockNode { + constructor(name, args, async) { + super(); + this.name = name; + this.args = args; + this.async = async; + } + render(opts) { + const _async = this.async ? "async " : ""; + return `${_async}function ${this.name}(${this.args})` + super.render(opts); + } +} +Func.kind = "func"; +class Return extends ParentNode { + render(opts) { + return "return " + super.render(opts); + } +} +Return.kind = "return"; +class Try extends BlockNode { + render(opts) { + let code = "try" + super.render(opts); + if (this.catch) + code += this.catch.render(opts); + if (this.finally) + code += this.finally.render(opts); + return code; + } + optimizeNodes() { + var _a, _b; + super.optimizeNodes(); + (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNodes(); + (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes(); + return this; + } + optimizeNames(names, constants) { + var _a, _b; + super.optimizeNames(names, constants); + (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants); + (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants); + return this; + } + get names() { + const names = super.names; + if (this.catch) + addNames(names, this.catch.names); + if (this.finally) + addNames(names, this.finally.names); + return names; + } +} +class Catch extends BlockNode { + constructor(error) { + super(); + this.error = error; + } + render(opts) { + return `catch(${this.error})` + super.render(opts); + } +} +Catch.kind = "catch"; +class Finally extends BlockNode { + render(opts) { + return "finally" + super.render(opts); + } +} +Finally.kind = "finally"; +class CodeGen { + constructor(extScope, opts = {}) { + this._values = {}; + this._blockStarts = []; + this._constants = {}; + this.opts = { ...opts, _n: opts.lines ? "\n" : "" }; + this._extScope = extScope; + this._scope = new scope_1.Scope({ parent: extScope }); + this._nodes = [new Root()]; + } + toString() { + return this._root.render(this.opts); + } + // returns unique name in the internal scope + name(prefix) { + return this._scope.name(prefix); + } + // reserves unique name in the external scope + scopeName(prefix) { + return this._extScope.name(prefix); + } + // reserves unique name in the external scope and assigns value to it + scopeValue(prefixOrName, value) { + const name = this._extScope.value(prefixOrName, value); + const vs = this._values[name.prefix] || (this._values[name.prefix] = new Set()); + vs.add(name); + return name; + } + getScopeValue(prefix, keyOrRef) { + return this._extScope.getValue(prefix, keyOrRef); + } + // return code that assigns values in the external scope to the names that are used internally + // (same names that were returned by gen.scopeName or gen.scopeValue) + scopeRefs(scopeName) { + return this._extScope.scopeRefs(scopeName, this._values); + } + scopeCode() { + return this._extScope.scopeCode(this._values); + } + _def(varKind, nameOrPrefix, rhs, constant) { + const name = this._scope.toName(nameOrPrefix); + if (rhs !== undefined && constant) + this._constants[name.str] = rhs; + this._leafNode(new Def(varKind, name, rhs)); + return name; + } + // `const` declaration (`var` in es5 mode) + const(nameOrPrefix, rhs, _constant) { + return this._def(scope_1.varKinds.const, nameOrPrefix, rhs, _constant); + } + // `let` declaration with optional assignment (`var` in es5 mode) + let(nameOrPrefix, rhs, _constant) { + return this._def(scope_1.varKinds.let, nameOrPrefix, rhs, _constant); + } + // `var` declaration with optional assignment + var(nameOrPrefix, rhs, _constant) { + return this._def(scope_1.varKinds.var, nameOrPrefix, rhs, _constant); + } + // assignment code + assign(lhs, rhs, sideEffects) { + return this._leafNode(new Assign(lhs, rhs, sideEffects)); + } + // `+=` code + add(lhs, rhs) { + return this._leafNode(new AssignOp(lhs, exports.operators.ADD, rhs)); + } + // appends passed SafeExpr to code or executes Block + code(c) { + if (typeof c == "function") + c(); + else if (c !== code_1.nil) + this._leafNode(new AnyCode(c)); + return this; + } + // returns code for object literal for the passed argument list of key-value pairs + object(...keyValues) { + const code = ["{"]; + for (const [key, value] of keyValues) { + if (code.length > 1) + code.push(","); + code.push(key); + if (key !== value || this.opts.es5) { + code.push(":"); + (0, code_1.addCodeArg)(code, value); + } + } + code.push("}"); + return new code_1._Code(code); + } + // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed) + if(condition, thenBody, elseBody) { + this._blockNode(new If(condition)); + if (thenBody && elseBody) { + this.code(thenBody).else().code(elseBody).endIf(); + } + else if (thenBody) { + this.code(thenBody).endIf(); + } + else if (elseBody) { + throw new Error('CodeGen: "else" body without "then" body'); + } + return this; + } + // `else if` clause - invalid without `if` or after `else` clauses + elseIf(condition) { + return this._elseNode(new If(condition)); + } + // `else` clause - only valid after `if` or `else if` clauses + else() { + return this._elseNode(new Else()); + } + // end `if` statement (needed if gen.if was used only with condition) + endIf() { + return this._endBlockNode(If, Else); + } + _for(node, forBody) { + this._blockNode(node); + if (forBody) + this.code(forBody).endFor(); + return this; + } + // a generic `for` clause (or statement if `forBody` is passed) + for(iteration, forBody) { + return this._for(new ForLoop(iteration), forBody); + } + // `for` statement for a range of values + forRange(nameOrPrefix, from, to, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.let) { + const name = this._scope.toName(nameOrPrefix); + return this._for(new ForRange(varKind, name, from, to), () => forBody(name)); + } + // `for-of` statement (in es5 mode replace with a normal for loop) + forOf(nameOrPrefix, iterable, forBody, varKind = scope_1.varKinds.const) { + const name = this._scope.toName(nameOrPrefix); + if (this.opts.es5) { + const arr = iterable instanceof code_1.Name ? iterable : this.var("_arr", iterable); + return this.forRange("_i", 0, (0, code_1._) `${arr}.length`, (i) => { + this.var(name, (0, code_1._) `${arr}[${i}]`); + forBody(name); + }); + } + return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name)); + } + // `for-in` statement. + // With option `ownProperties` replaced with a `for-of` loop for object keys + forIn(nameOrPrefix, obj, forBody, varKind = this.opts.es5 ? scope_1.varKinds.var : scope_1.varKinds.const) { + if (this.opts.ownProperties) { + return this.forOf(nameOrPrefix, (0, code_1._) `Object.keys(${obj})`, forBody); + } + const name = this._scope.toName(nameOrPrefix); + return this._for(new ForIter("in", varKind, name, obj), () => forBody(name)); + } + // end `for` loop + endFor() { + return this._endBlockNode(For); + } + // `label` statement + label(label) { + return this._leafNode(new Label(label)); + } + // `break` statement + break(label) { + return this._leafNode(new Break(label)); + } + // `return` statement + return(value) { + const node = new Return(); + this._blockNode(node); + this.code(value); + if (node.nodes.length !== 1) + throw new Error('CodeGen: "return" should have one node'); + return this._endBlockNode(Return); + } + // `try` statement + try(tryBody, catchCode, finallyCode) { + if (!catchCode && !finallyCode) + throw new Error('CodeGen: "try" without "catch" and "finally"'); + const node = new Try(); + this._blockNode(node); + this.code(tryBody); + if (catchCode) { + const error = this.name("e"); + this._currNode = node.catch = new Catch(error); + catchCode(error); + } + if (finallyCode) { + this._currNode = node.finally = new Finally(); + this.code(finallyCode); + } + return this._endBlockNode(Catch, Finally); + } + // `throw` statement + throw(error) { + return this._leafNode(new Throw(error)); + } + // start self-balancing block + block(body, nodeCount) { + this._blockStarts.push(this._nodes.length); + if (body) + this.code(body).endBlock(nodeCount); + return this; + } + // end the current self-balancing block + endBlock(nodeCount) { + const len = this._blockStarts.pop(); + if (len === undefined) + throw new Error("CodeGen: not in self-balancing block"); + const toClose = this._nodes.length - len; + if (toClose < 0 || (nodeCount !== undefined && toClose !== nodeCount)) { + throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`); + } + this._nodes.length = len; + return this; + } + // `function` heading (or definition if funcBody is passed) + func(name, args = code_1.nil, async, funcBody) { + this._blockNode(new Func(name, args, async)); + if (funcBody) + this.code(funcBody).endFunc(); + return this; + } + // end function definition + endFunc() { + return this._endBlockNode(Func); + } + optimize(n = 1) { + while (n-- > 0) { + this._root.optimizeNodes(); + this._root.optimizeNames(this._root.names, this._constants); + } + } + _leafNode(node) { + this._currNode.nodes.push(node); + return this; + } + _blockNode(node) { + this._currNode.nodes.push(node); + this._nodes.push(node); + } + _endBlockNode(N1, N2) { + const n = this._currNode; + if (n instanceof N1 || (N2 && n instanceof N2)) { + this._nodes.pop(); + return this; + } + throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`); + } + _elseNode(node) { + const n = this._currNode; + if (!(n instanceof If)) { + throw new Error('CodeGen: "else" without "if"'); + } + this._currNode = n.else = node; + return this; + } + get _root() { + return this._nodes[0]; + } + get _currNode() { + const ns = this._nodes; + return ns[ns.length - 1]; + } + set _currNode(node) { + const ns = this._nodes; + ns[ns.length - 1] = node; + } +} +exports.CodeGen = CodeGen; +function addNames(names, from) { + for (const n in from) + names[n] = (names[n] || 0) + (from[n] || 0); + return names; +} +function addExprNames(names, from) { + return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names; +} +function optimizeExpr(expr, names, constants) { + if (expr instanceof code_1.Name) + return replaceName(expr); + if (!canOptimize(expr)) + return expr; + return new code_1._Code(expr._items.reduce((items, c) => { + if (c instanceof code_1.Name) + c = replaceName(c); + if (c instanceof code_1._Code) + items.push(...c._items); + else + items.push(c); + return items; + }, [])); + function replaceName(n) { + const c = constants[n.str]; + if (c === undefined || names[n.str] !== 1) + return n; + delete names[n.str]; + return c; + } + function canOptimize(e) { + return (e instanceof code_1._Code && + e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants[c.str] !== undefined)); + } +} +function subtractNames(names, from) { + for (const n in from) + names[n] = (names[n] || 0) - (from[n] || 0); +} +function not(x) { + return typeof x == "boolean" || typeof x == "number" || x === null ? !x : (0, code_1._) `!${par(x)}`; +} +exports.not = not; +const andCode = mappend(exports.operators.AND); +// boolean AND (&&) expression with the passed arguments +function and(...args) { + return args.reduce(andCode); +} +exports.and = and; +const orCode = mappend(exports.operators.OR); +// boolean OR (||) expression with the passed arguments +function or(...args) { + return args.reduce(orCode); +} +exports.or = or; +function mappend(op) { + return (x, y) => (x === code_1.nil ? y : y === code_1.nil ? x : (0, code_1._) `${par(x)} ${op} ${par(y)}`); +} +function par(x) { + return x instanceof code_1.Name ? x : (0, code_1._) `(${x})`; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/index.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/index.js.map new file mode 100644 index 000000000..f3826d283 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/compile/codegen/index.ts"],"names":[],"mappings":";;;AACA,iCAA8F;AAC9F,mCAAuC;AAEvC,+BAA6F;AAArF,yFAAA,CAAC,OAAA;AAAE,2FAAA,GAAG,OAAA;AAAE,iGAAA,SAAS,OAAA;AAAE,2FAAA,GAAG,OAAA;AAAE,mGAAA,WAAW,OAAA;AAAE,iGAAA,SAAS,OAAA;AAAE,kGAAA,UAAU,OAAA;AAAE,4FAAA,IAAI,OAAA;AACxE,iCAA+F;AAAvF,8FAAA,KAAK,OAAA;AAAc,mGAAA,UAAU,OAAA;AAAE,uGAAA,cAAc,OAAA;AAAkB,iGAAA,QAAQ,OAAA;AAQlE,QAAA,SAAS,GAAG;IACvB,EAAE,EAAE,IAAI,YAAK,CAAC,GAAG,CAAC;IAClB,GAAG,EAAE,IAAI,YAAK,CAAC,IAAI,CAAC;IACpB,EAAE,EAAE,IAAI,YAAK,CAAC,GAAG,CAAC;IAClB,GAAG,EAAE,IAAI,YAAK,CAAC,IAAI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AAC,CAAA;AACjF,CAAC;AAED,SAAS,GAAG,CAAC,CAAO;IAClB,OAAO,CAAC,YAAY,WAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,QAAC,EAAA,IAAI,CAAC,GAAG,CAAA;AAC1C,CAAC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/scope.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/scope.d.ts new file mode 100644 index 000000000..3c351bb63 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/scope.d.ts @@ -0,0 +1,79 @@ +import { Code, Name } from "./code"; +interface NameGroup { + prefix: string; + index: number; +} +export interface NameValue { + ref: ValueReference; + key?: unknown; + code?: Code; +} +export declare type ValueReference = unknown; +interface ScopeOptions { + prefixes?: Set; + parent?: Scope; +} +interface ValueScopeOptions extends ScopeOptions { + scope: ScopeStore; + es5?: boolean; + lines?: boolean; +} +export declare type ScopeStore = Record; +declare type ScopeValues = { + [Prefix in string]?: Map; +}; +export declare type ScopeValueSets = { + [Prefix in string]?: Set; +}; +export declare enum UsedValueState { + Started = 0, + Completed = 1 +} +export declare type UsedScopeValues = { + [Prefix in string]?: Map; +}; +export declare const varKinds: { + const: Name; + let: Name; + var: Name; +}; +export declare class Scope { + protected readonly _names: { + [Prefix in string]?: NameGroup; + }; + protected readonly _prefixes?: Set; + protected readonly _parent?: Scope; + constructor({ prefixes, parent }?: ScopeOptions); + toName(nameOrPrefix: Name | string): Name; + name(prefix: string): Name; + protected _newName(prefix: string): string; + private _nameGroup; +} +interface ScopePath { + property: string; + itemIndex: number; +} +export declare class ValueScopeName extends Name { + readonly prefix: string; + value?: NameValue; + scopePath?: Code; + constructor(prefix: string, nameStr: string); + setValue(value: NameValue, { property, itemIndex }: ScopePath): void; +} +interface VSOptions extends ValueScopeOptions { + _n: Code; +} +export declare class ValueScope extends Scope { + protected readonly _values: ScopeValues; + protected readonly _scope: ScopeStore; + readonly opts: VSOptions; + constructor(opts: ValueScopeOptions); + get(): ScopeStore; + name(prefix: string): ValueScopeName; + value(nameOrPrefix: ValueScopeName | string, value: NameValue): ValueScopeName; + getValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined; + scopeRefs(scopeName: Name, values?: ScopeValues | ScopeValueSets): Code; + scopeCode(values?: ScopeValues | ScopeValueSets, usedValues?: UsedScopeValues, getCode?: (n: ValueScopeName) => Code | undefined): Code; + private _reduceValues; +} +export {}; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/scope.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/scope.js new file mode 100644 index 000000000..acc5f7626 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/scope.js @@ -0,0 +1,143 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = void 0; +const code_1 = require("./code"); +class ValueError extends Error { + constructor(name) { + super(`CodeGen: "code" for ${name} not defined`); + this.value = name.value; + } +} +var UsedValueState; +(function (UsedValueState) { + UsedValueState[UsedValueState["Started"] = 0] = "Started"; + UsedValueState[UsedValueState["Completed"] = 1] = "Completed"; +})(UsedValueState = exports.UsedValueState || (exports.UsedValueState = {})); +exports.varKinds = { + const: new code_1.Name("const"), + let: new code_1.Name("let"), + var: new code_1.Name("var"), +}; +class Scope { + constructor({ prefixes, parent } = {}) { + this._names = {}; + this._prefixes = prefixes; + this._parent = parent; + } + toName(nameOrPrefix) { + return nameOrPrefix instanceof code_1.Name ? nameOrPrefix : this.name(nameOrPrefix); + } + name(prefix) { + return new code_1.Name(this._newName(prefix)); + } + _newName(prefix) { + const ng = this._names[prefix] || this._nameGroup(prefix); + return `${prefix}${ng.index++}`; + } + _nameGroup(prefix) { + var _a, _b; + if (((_b = (_a = this._parent) === null || _a === void 0 ? void 0 : _a._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || (this._prefixes && !this._prefixes.has(prefix))) { + throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`); + } + return (this._names[prefix] = { prefix, index: 0 }); + } +} +exports.Scope = Scope; +class ValueScopeName extends code_1.Name { + constructor(prefix, nameStr) { + super(nameStr); + this.prefix = prefix; + } + setValue(value, { property, itemIndex }) { + this.value = value; + this.scopePath = (0, code_1._) `.${new code_1.Name(property)}[${itemIndex}]`; + } +} +exports.ValueScopeName = ValueScopeName; +const line = (0, code_1._) `\n`; +class ValueScope extends Scope { + constructor(opts) { + super(opts); + this._values = {}; + this._scope = opts.scope; + this.opts = { ...opts, _n: opts.lines ? line : code_1.nil }; + } + get() { + return this._scope; + } + name(prefix) { + return new ValueScopeName(prefix, this._newName(prefix)); + } + value(nameOrPrefix, value) { + var _a; + if (value.ref === undefined) + throw new Error("CodeGen: ref must be passed in value"); + const name = this.toName(nameOrPrefix); + const { prefix } = name; + const valueKey = (_a = value.key) !== null && _a !== void 0 ? _a : value.ref; + let vs = this._values[prefix]; + if (vs) { + const _name = vs.get(valueKey); + if (_name) + return _name; + } + else { + vs = this._values[prefix] = new Map(); + } + vs.set(valueKey, name); + const s = this._scope[prefix] || (this._scope[prefix] = []); + const itemIndex = s.length; + s[itemIndex] = value.ref; + name.setValue(value, { property: prefix, itemIndex }); + return name; + } + getValue(prefix, keyOrRef) { + const vs = this._values[prefix]; + if (!vs) + return; + return vs.get(keyOrRef); + } + scopeRefs(scopeName, values = this._values) { + return this._reduceValues(values, (name) => { + if (name.scopePath === undefined) + throw new Error(`CodeGen: name "${name}" has no value`); + return (0, code_1._) `${scopeName}${name.scopePath}`; + }); + } + scopeCode(values = this._values, usedValues, getCode) { + return this._reduceValues(values, (name) => { + if (name.value === undefined) + throw new Error(`CodeGen: name "${name}" has no value`); + return name.value.code; + }, usedValues, getCode); + } + _reduceValues(values, valueCode, usedValues = {}, getCode) { + let code = code_1.nil; + for (const prefix in values) { + const vs = values[prefix]; + if (!vs) + continue; + const nameSet = (usedValues[prefix] = usedValues[prefix] || new Map()); + vs.forEach((name) => { + if (nameSet.has(name)) + return; + nameSet.set(name, UsedValueState.Started); + let c = valueCode(name); + if (c) { + const def = this.opts.es5 ? exports.varKinds.var : exports.varKinds.const; + code = (0, code_1._) `${code}${def} ${name} = ${c};${this.opts._n}`; + } + else if ((c = getCode === null || getCode === void 0 ? void 0 : getCode(name))) { + code = (0, code_1._) `${code}${c}${this.opts._n}`; + } + else { + throw new ValueError(name); + } + nameSet.set(name, UsedValueState.Completed); + }); + } + return code; + } +} +exports.ValueScope = ValueScope; +//# sourceMappingURL=scope.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/scope.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/scope.js.map new file mode 100644 index 000000000..7afde1060 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/codegen/scope.js.map @@ -0,0 +1 @@ +{"version":3,"file":"scope.js","sourceRoot":"","sources":["../../../lib/compile/codegen/scope.ts"],"names":[],"mappings":";;;AAAA,iCAAyC;AAezC,MAAM,UAAW,SAAQ,KAAK;IAE5B,YAAY,IAAoB;QAC9B,KAAK,CAAC,uBAAuB,IAAI,cAAc,CAAC,CAAA;QAChD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAA;IACzB,CAAC;CACF;AAuBD,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,yDAAO,CAAA;IACP,6DAAS,CAAA;AACX,CAAC,EAHW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAGzB;AAMY,QAAA,QAAQ,GAAG;IACtB,KAAK,EAAE,IAAI,WAAI,CAAC,OAAO,CAAC;IACxB,GAAG,EAAE,IAAI,WAAI,CAAC,KAAK,CAAC;IACpB,GAAG,EAAE,IAAI,WAAI,CAAC,KAAK,CAAC;CACrB,CAAA;AAED,MAAa,KAAK;IAKhB,YAAY,EAAC,QAAQ,EAAE,MAAM,KAAkB,EAAE;QAJ9B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AC,GAAG,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,IAAI,CAAC,CAAC,EAAE;oBAChC,IAAI,GAAG,IAAA,QAAC,EAAA,GAAG,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAA;iBACrC;qBAAM;oBACL,MAAM,IAAI,UAAU,CAAC,IAAI,CAAC,CAAA;iBAC3B;gBACD,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;YAC7C,CAAC,CAAC,CAAA;SACH;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAjGD,gCAiGC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/errors.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/errors.d.ts new file mode 100644 index 000000000..74eef7e21 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/errors.d.ts @@ -0,0 +1,13 @@ +import type { KeywordErrorCxt, KeywordErrorDefinition } from "../types"; +import { CodeGen, Code, Name } from "./codegen"; +export declare const keywordError: KeywordErrorDefinition; +export declare const keyword$DataError: KeywordErrorDefinition; +export interface ErrorPaths { + instancePath?: Code; + schemaPath?: string; + parentSchema?: boolean; +} +export declare function reportError(cxt: KeywordErrorCxt, error?: KeywordErrorDefinition, errorPaths?: ErrorPaths, overrideAllErrors?: boolean): void; +export declare function reportExtraError(cxt: KeywordErrorCxt, error?: KeywordErrorDefinition, errorPaths?: ErrorPaths): void; +export declare function resetErrorsCount(gen: CodeGen, errsCount: Name): void; +export declare function extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }: KeywordErrorCxt): void; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/errors.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/errors.js new file mode 100644 index 000000000..e2aca7b93 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/errors.js @@ -0,0 +1,123 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = void 0; +const codegen_1 = require("./codegen"); +const util_1 = require("./util"); +const names_1 = require("./names"); +exports.keywordError = { + message: ({ keyword }) => (0, codegen_1.str) `must pass "${keyword}" keyword validation`, +}; +exports.keyword$DataError = { + message: ({ keyword, schemaType }) => schemaType + ? (0, codegen_1.str) `"${keyword}" keyword must be ${schemaType} ($data)` + : (0, codegen_1.str) `"${keyword}" keyword is invalid ($data)`, +}; +function reportError(cxt, error = exports.keywordError, errorPaths, overrideAllErrors) { + const { it } = cxt; + const { gen, compositeRule, allErrors } = it; + const errObj = errorObjectCode(cxt, error, errorPaths); + if (overrideAllErrors !== null && overrideAllErrors !== void 0 ? overrideAllErrors : (compositeRule || allErrors)) { + addError(gen, errObj); + } + else { + returnErrors(it, (0, codegen_1._) `[${errObj}]`); + } +} +exports.reportError = reportError; +function reportExtraError(cxt, error = exports.keywordError, errorPaths) { + const { it } = cxt; + const { gen, compositeRule, allErrors } = it; + const errObj = errorObjectCode(cxt, error, errorPaths); + addError(gen, errObj); + if (!(compositeRule || allErrors)) { + returnErrors(it, names_1.default.vErrors); + } +} +exports.reportExtraError = reportExtraError; +function resetErrorsCount(gen, errsCount) { + gen.assign(names_1.default.errors, errsCount); + gen.if((0, codegen_1._) `${names_1.default.vErrors} !== null`, () => gen.if(errsCount, () => gen.assign((0, codegen_1._) `${names_1.default.vErrors}.length`, errsCount), () => gen.assign(names_1.default.vErrors, null))); +} +exports.resetErrorsCount = resetErrorsCount; +function extendErrors({ gen, keyword, schemaValue, data, errsCount, it, }) { + /* istanbul ignore if */ + if (errsCount === undefined) + throw new Error("ajv implementation error"); + const err = gen.name("err"); + gen.forRange("i", errsCount, names_1.default.errors, (i) => { + gen.const(err, (0, codegen_1._) `${names_1.default.vErrors}[${i}]`); + gen.if((0, codegen_1._) `${err}.instancePath === undefined`, () => gen.assign((0, codegen_1._) `${err}.instancePath`, (0, codegen_1.strConcat)(names_1.default.instancePath, it.errorPath))); + gen.assign((0, codegen_1._) `${err}.schemaPath`, (0, codegen_1.str) `${it.errSchemaPath}/${keyword}`); + if (it.opts.verbose) { + gen.assign((0, codegen_1._) `${err}.schema`, schemaValue); + gen.assign((0, codegen_1._) `${err}.data`, data); + } + }); +} +exports.extendErrors = extendErrors; +function addError(gen, errObj) { + const err = gen.const("err", errObj); + gen.if((0, codegen_1._) `${names_1.default.vErrors} === null`, () => gen.assign(names_1.default.vErrors, (0, codegen_1._) `[${err}]`), (0, codegen_1._) `${names_1.default.vErrors}.push(${err})`); + gen.code((0, codegen_1._) `${names_1.default.errors}++`); +} +function returnErrors(it, errs) { + const { gen, validateName, schemaEnv } = it; + if (schemaEnv.$async) { + gen.throw((0, codegen_1._) `new ${it.ValidationError}(${errs})`); + } + else { + gen.assign((0, codegen_1._) `${validateName}.errors`, errs); + gen.return(false); + } +} +const E = { + keyword: new codegen_1.Name("keyword"), + schemaPath: new codegen_1.Name("schemaPath"), + params: new codegen_1.Name("params"), + propertyName: new codegen_1.Name("propertyName"), + message: new codegen_1.Name("message"), + schema: new codegen_1.Name("schema"), + parentSchema: new codegen_1.Name("parentSchema"), +}; +function errorObjectCode(cxt, error, errorPaths) { + const { createErrors } = cxt.it; + if (createErrors === false) + return (0, codegen_1._) `{}`; + return errorObject(cxt, error, errorPaths); +} +function errorObject(cxt, error, errorPaths = {}) { + const { gen, it } = cxt; + const keyValues = [ + errorInstancePath(it, errorPaths), + errorSchemaPath(cxt, errorPaths), + ]; + extraErrorProps(cxt, error, keyValues); + return gen.object(...keyValues); +} +function errorInstancePath({ errorPath }, { instancePath }) { + const instPath = instancePath + ? (0, codegen_1.str) `${errorPath}${(0, util_1.getErrorPath)(instancePath, util_1.Type.Str)}` + : errorPath; + return [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, instPath)]; +} +function errorSchemaPath({ keyword, it: { errSchemaPath } }, { schemaPath, parentSchema }) { + let schPath = parentSchema ? errSchemaPath : (0, codegen_1.str) `${errSchemaPath}/${keyword}`; + if (schemaPath) { + schPath = (0, codegen_1.str) `${schPath}${(0, util_1.getErrorPath)(schemaPath, util_1.Type.Str)}`; + } + return [E.schemaPath, schPath]; +} +function extraErrorProps(cxt, { params, message }, keyValues) { + const { keyword, data, schemaValue, it } = cxt; + const { opts, propertyName, topSchemaRef, schemaPath } = it; + keyValues.push([E.keyword, keyword], [E.params, typeof params == "function" ? params(cxt) : params || (0, codegen_1._) `{}`]); + if (opts.messages) { + keyValues.push([E.message, typeof message == "function" ? message(cxt) : message]); + } + if (opts.verbose) { + keyValues.push([E.schema, schemaValue], [E.parentSchema, (0, codegen_1._) `${topSchemaRef}${schemaPath}`], [names_1.default.data, data]); + } + if (propertyName) + keyValues.push([E.propertyName, propertyName]); +} +//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/errors.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/errors.js.map new file mode 100644 index 000000000..662089108 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/errors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../lib/compile/errors.ts"],"names":[],"mappings":";;;AAEA,uCAAgE;AAEhE,iCAAyC;AACzC,mCAAuB;AAEV,QAAA,YAAY,GAA2B;IAClD,OAAO,EAAE,CAAC,EAAC,OAAO,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,cAAc,OAAO,sBAAsB;CACvE,CAAA;AAEY,QAAA,iBAAiB,GAA2B;IACvD,OAAO,EAAE,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC,EAAE,EAAE,CACjC,UAAU;QACR,CAAC,CAAC,IAAA,aAAG,EAAA,IAAI,OAAO,qBAAqB,UAAU,UAAU;QACzD,CAAC,CAAC,IAAA,aAAG,EAAA,IAAI,OAAO,8BAA8B;CACnD,CAAA;AAQD,S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OAAO,EAAE;QAChB,SAAS,CAAC,IAAI,CACZ,CAAC,CAAC,CAAC,MAAM,EAAE,WAAW,CAAC,EACvB,CAAC,CAAC,CAAC,YAAY,EAAE,IAAA,WAAC,EAAA,GAAG,YAAY,GAAG,UAAU,EAAE,CAAC,EACjD,CAAC,eAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CACf,CAAA;KACF;IACD,IAAI,YAAY;QAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAA;AAClE,CAAC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/index.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/index.d.ts new file mode 100644 index 000000000..ca8920ab4 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/index.d.ts @@ -0,0 +1,80 @@ +import type { AnySchema, AnySchemaObject, AnyValidateFunction, EvaluatedProperties, EvaluatedItems } from "../types"; +import type Ajv from "../core"; +import type { InstanceOptions } from "../core"; +import { CodeGen, Name, Code, ValueScopeName } from "./codegen"; +import { LocalRefs } from "./resolve"; +import { JSONType } from "./rules"; +export declare type SchemaRefs = { + [Ref in string]?: SchemaEnv | AnySchema; +}; +export interface SchemaCxt { + readonly gen: CodeGen; + readonly allErrors?: boolean; + readonly data: Name; + readonly parentData: Name; + readonly parentDataProperty: Code | number; + readonly dataNames: Name[]; + readonly dataPathArr: (Code | number)[]; + readonly dataLevel: number; + dataTypes: JSONType[]; + definedProperties: Set; + readonly topSchemaRef: Code; + readonly validateName: Name; + evaluated?: Name; + readonly ValidationError?: Name; + readonly schema: AnySchema; + readonly schemaEnv: SchemaEnv; + readonly rootId: string; + baseId: string; + readonly schemaPath: Code; + readonly errSchemaPath: string; + readonly errorPath: Code; + readonly propertyName?: Name; + readonly compositeRule?: boolean; + props?: EvaluatedProperties | Name; + items?: EvaluatedItems | Name; + jtdDiscriminator?: string; + jtdMetadata?: boolean; + readonly createErrors?: boolean; + readonly opts: InstanceOptions; + readonly self: Ajv; +} +export interface SchemaObjCxt extends SchemaCxt { + readonly schema: AnySchemaObject; +} +interface SchemaEnvArgs { + readonly schema: AnySchema; + readonly schemaId?: "$id" | "id"; + readonly root?: SchemaEnv; + readonly baseId?: string; + readonly schemaPath?: string; + readonly localRefs?: LocalRefs; + readonly meta?: boolean; +} +export declare class SchemaEnv implements SchemaEnvArgs { + readonly schema: AnySchema; + readonly schemaId?: "$id" | "id"; + readonly root: SchemaEnv; + baseId: string; + schemaPath?: string; + localRefs?: LocalRefs; + readonly meta?: boolean; + readonly $async?: boolean; + readonly refs: SchemaRefs; + readonly dynamicAnchors: { + [Ref in string]?: true; + }; + validate?: AnyValidateFunction; + validateName?: ValueScopeName; + serialize?: (data: unknown) => string; + serializeName?: ValueScopeName; + parse?: (data: string) => unknown; + parseName?: ValueScopeName; + constructor(env: SchemaEnvArgs); +} +export declare function compileSchema(this: Ajv, sch: SchemaEnv): SchemaEnv; +export declare function resolveRef(this: Ajv, root: SchemaEnv, baseId: string, ref: string): AnySchema | SchemaEnv | undefined; +export declare function getCompilingSchema(this: Ajv, schEnv: SchemaEnv): SchemaEnv | void; +export declare function resolveSchema(this: Ajv, root: SchemaEnv, // root object with properties schema, refs TODO below SchemaEnv is assigned to it +ref: string): SchemaEnv | undefined; +export {}; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/index.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/index.js new file mode 100644 index 000000000..b125ecd02 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/index.js @@ -0,0 +1,242 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.resolveSchema = exports.getCompilingSchema = exports.resolveRef = exports.compileSchema = exports.SchemaEnv = void 0; +const codegen_1 = require("./codegen"); +const validation_error_1 = require("../runtime/validation_error"); +const names_1 = require("./names"); +const resolve_1 = require("./resolve"); +const util_1 = require("./util"); +const validate_1 = require("./validate"); +class SchemaEnv { + constructor(env) { + var _a; + this.refs = {}; + this.dynamicAnchors = {}; + let schema; + if (typeof env.schema == "object") + schema = env.schema; + this.schema = env.schema; + this.schemaId = env.schemaId; + this.root = env.root || this; + this.baseId = (_a = env.baseId) !== null && _a !== void 0 ? _a : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]); + this.schemaPath = env.schemaPath; + this.localRefs = env.localRefs; + this.meta = env.meta; + this.$async = schema === null || schema === void 0 ? void 0 : schema.$async; + this.refs = {}; + } +} +exports.SchemaEnv = SchemaEnv; +// let codeSize = 0 +// let nodeCount = 0 +// Compiles schema in SchemaEnv +function compileSchema(sch) { + // TODO refactor - remove compilations + const _sch = getCompilingSchema.call(this, sch); + if (_sch) + return _sch; + const rootId = (0, resolve_1.getFullPath)(this.opts.uriResolver, sch.root.baseId); // TODO if getFullPath removed 1 tests fails + const { es5, lines } = this.opts.code; + const { ownProperties } = this.opts; + const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties }); + let _ValidationError; + if (sch.$async) { + _ValidationError = gen.scopeValue("Error", { + ref: validation_error_1.default, + code: (0, codegen_1._) `require("ajv/dist/runtime/validation_error").default`, + }); + } + const validateName = gen.scopeName("validate"); + sch.validateName = validateName; + const schemaCxt = { + gen, + allErrors: this.opts.allErrors, + data: names_1.default.data, + parentData: names_1.default.parentData, + parentDataProperty: names_1.default.parentDataProperty, + dataNames: [names_1.default.data], + dataPathArr: [codegen_1.nil], + dataLevel: 0, + dataTypes: [], + definedProperties: new Set(), + topSchemaRef: gen.scopeValue("schema", this.opts.code.source === true + ? { ref: sch.schema, code: (0, codegen_1.stringify)(sch.schema) } + : { ref: sch.schema }), + validateName, + ValidationError: _ValidationError, + schema: sch.schema, + schemaEnv: sch, + rootId, + baseId: sch.baseId || rootId, + schemaPath: codegen_1.nil, + errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"), + errorPath: (0, codegen_1._) `""`, + opts: this.opts, + self: this, + }; + let sourceCode; + try { + this._compilations.add(sch); + (0, validate_1.validateFunctionCode)(schemaCxt); + gen.optimize(this.opts.code.optimize); + // gen.optimize(1) + const validateCode = gen.toString(); + sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${validateCode}`; + // console.log((codeSize += sourceCode.length), (nodeCount += gen.nodeCount)) + if (this.opts.code.process) + sourceCode = this.opts.code.process(sourceCode, sch); + // console.log("\n\n\n *** \n", sourceCode) + const makeValidate = new Function(`${names_1.default.self}`, `${names_1.default.scope}`, sourceCode); + const validate = makeValidate(this, this.scope.get()); + this.scope.value(validateName, { ref: validate }); + validate.errors = null; + validate.schema = sch.schema; + validate.schemaEnv = sch; + if (sch.$async) + validate.$async = true; + if (this.opts.code.source === true) { + validate.source = { validateName, validateCode, scopeValues: gen._values }; + } + if (this.opts.unevaluated) { + const { props, items } = schemaCxt; + validate.evaluated = { + props: props instanceof codegen_1.Name ? undefined : props, + items: items instanceof codegen_1.Name ? undefined : items, + dynamicProps: props instanceof codegen_1.Name, + dynamicItems: items instanceof codegen_1.Name, + }; + if (validate.source) + validate.source.evaluated = (0, codegen_1.stringify)(validate.evaluated); + } + sch.validate = validate; + return sch; + } + catch (e) { + delete sch.validate; + delete sch.validateName; + if (sourceCode) + this.logger.error("Error compiling schema, function code:", sourceCode); + // console.log("\n\n\n *** \n", sourceCode, this.opts) + throw e; + } + finally { + this._compilations.delete(sch); + } +} +exports.compileSchema = compileSchema; +function resolveRef(root, baseId, ref) { + var _a; + ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref); + const schOrFunc = root.refs[ref]; + if (schOrFunc) + return schOrFunc; + let _sch = resolve.call(this, root, ref); + if (_sch === undefined) { + const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref]; // TODO maybe localRefs should hold SchemaEnv + const { schemaId } = this.opts; + if (schema) + _sch = new SchemaEnv({ schema, schemaId, root, baseId }); + } + if (_sch === undefined) + return; + return (root.refs[ref] = inlineOrCompile.call(this, _sch)); +} +exports.resolveRef = resolveRef; +function inlineOrCompile(sch) { + if ((0, resolve_1.inlineRef)(sch.schema, this.opts.inlineRefs)) + return sch.schema; + return sch.validate ? sch : compileSchema.call(this, sch); +} +// Index of schema compilation in the currently compiled list +function getCompilingSchema(schEnv) { + for (const sch of this._compilations) { + if (sameSchemaEnv(sch, schEnv)) + return sch; + } +} +exports.getCompilingSchema = getCompilingSchema; +function sameSchemaEnv(s1, s2) { + return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId; +} +// resolve and compile the references ($ref) +// TODO returns AnySchemaObject (if the schema can be inlined) or validation function +function resolve(root, // information about the root schema for the current schema +ref // reference to resolve +) { + let sch; + while (typeof (sch = this.refs[ref]) == "string") + ref = sch; + return sch || this.schemas[ref] || resolveSchema.call(this, root, ref); +} +// Resolve schema, its root and baseId +function resolveSchema(root, // root object with properties schema, refs TODO below SchemaEnv is assigned to it +ref // reference to resolve +) { + const p = this.opts.uriResolver.parse(ref); + const refPath = (0, resolve_1._getFullPath)(this.opts.uriResolver, p); + let baseId = (0, resolve_1.getFullPath)(this.opts.uriResolver, root.baseId, undefined); + // TODO `Object.keys(root.schema).length > 0` should not be needed - but removing breaks 2 tests + if (Object.keys(root.schema).length > 0 && refPath === baseId) { + return getJsonPointer.call(this, p, root); + } + const id = (0, resolve_1.normalizeId)(refPath); + const schOrRef = this.refs[id] || this.schemas[id]; + if (typeof schOrRef == "string") { + const sch = resolveSchema.call(this, root, schOrRef); + if (typeof (sch === null || sch === void 0 ? void 0 : sch.schema) !== "object") + return; + return getJsonPointer.call(this, p, sch); + } + if (typeof (schOrRef === null || schOrRef === void 0 ? void 0 : schOrRef.schema) !== "object") + return; + if (!schOrRef.validate) + compileSchema.call(this, schOrRef); + if (id === (0, resolve_1.normalizeId)(ref)) { + const { schema } = schOrRef; + const { schemaId } = this.opts; + const schId = schema[schemaId]; + if (schId) + baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId); + return new SchemaEnv({ schema, schemaId, root, baseId }); + } + return getJsonPointer.call(this, p, schOrRef); +} +exports.resolveSchema = resolveSchema; +const PREVENT_SCOPE_CHANGE = new Set([ + "properties", + "patternProperties", + "enum", + "dependencies", + "definitions", +]); +function getJsonPointer(parsedRef, { baseId, schema, root }) { + var _a; + if (((_a = parsedRef.fragment) === null || _a === void 0 ? void 0 : _a[0]) !== "/") + return; + for (const part of parsedRef.fragment.slice(1).split("/")) { + if (typeof schema === "boolean") + return; + const partSchema = schema[(0, util_1.unescapeFragment)(part)]; + if (partSchema === undefined) + return; + schema = partSchema; + // TODO PREVENT_SCOPE_CHANGE could be defined in keyword def? + const schId = typeof schema === "object" && schema[this.opts.schemaId]; + if (!PREVENT_SCOPE_CHANGE.has(part) && schId) { + baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId); + } + } + let env; + if (typeof schema != "boolean" && schema.$ref && !(0, util_1.schemaHasRulesButRef)(schema, this.RULES)) { + const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema.$ref); + env = resolveSchema.call(this, root, $ref); + } + // even though resolution failed we need to return SchemaEnv to throw exception + // so that compileAsync loads missing schema. + const { schemaId } = this.opts; + env = env || new SchemaEnv({ schema, schemaId, root, baseId }); + if (env.schema !== env.root.schema) + return env; + return undefined; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/index.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/index.js.map new file mode 100644 index 000000000..3fd890e67 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/compile/index.ts"],"names":[],"mappings":";;;AAUA,uCAAgF;AAChF,kEAAyD;AACzD,mCAAuB;AACvB,uCAAkG;AAClG,iCAA6D;AAC7D,yCAA+C;AA0D/C,MAAa,SAAS;IAkBpB,YAAY,GAAkB;;QATrB,SAAI,GAA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1D;KACF;IACD,IAAI,GAA0B,CAAA;IAC9B,IAAI,OAAO,MAAM,IAAI,SAAS,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,IAAA,2BAAoB,EAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE;QAC1F,MAAM,IAAI,GAAG,IAAA,oBAAU,EAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAA;QACnE,GAAG,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;KAC3C;IACD,+EAA+E;IAC/E,6CAA6C;IAC7C,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;IAC5B,GAAG,GAAG,GAAG,IAAI,IAAI,SAAS,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC,CAAA;IAC5D,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,CAAC,IAAI,CAAC,MAAM;QAAE,OAAO,GAAG,CAAA;IAC9C,OAAO,SAAS,CAAA;AAClB,CAAC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/parse.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/parse.d.ts new file mode 100644 index 000000000..618c64aea --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/parse.d.ts @@ -0,0 +1,4 @@ +import type Ajv from "../../core"; +import { SchemaObjectMap } from "./types"; +import { SchemaEnv } from ".."; +export default function compileParser(this: Ajv, sch: SchemaEnv, definitions: SchemaObjectMap): SchemaEnv; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/parse.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/parse.js new file mode 100644 index 000000000..8fc94fd0e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/parse.js @@ -0,0 +1,350 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const types_1 = require("./types"); +const __1 = require(".."); +const codegen_1 = require("../codegen"); +const ref_error_1 = require("../ref_error"); +const names_1 = require("../names"); +const code_1 = require("../../vocabularies/code"); +const ref_1 = require("../../vocabularies/jtd/ref"); +const type_1 = require("../../vocabularies/jtd/type"); +const parseJson_1 = require("../../runtime/parseJson"); +const util_1 = require("../util"); +const timestamp_1 = require("../../runtime/timestamp"); +const genParse = { + elements: parseElements, + values: parseValues, + discriminator: parseDiscriminator, + properties: parseProperties, + optionalProperties: parseProperties, + enum: parseEnum, + type: parseType, + ref: parseRef, +}; +function compileParser(sch, definitions) { + const _sch = __1.getCompilingSchema.call(this, sch); + if (_sch) + return _sch; + const { es5, lines } = this.opts.code; + const { ownProperties } = this.opts; + const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties }); + const parseName = gen.scopeName("parse"); + const cxt = { + self: this, + gen, + schema: sch.schema, + schemaEnv: sch, + definitions, + data: names_1.default.data, + parseName, + char: gen.name("c"), + }; + let sourceCode; + try { + this._compilations.add(sch); + sch.parseName = parseName; + parserFunction(cxt); + gen.optimize(this.opts.code.optimize); + const parseFuncCode = gen.toString(); + sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${parseFuncCode}`; + const makeParse = new Function(`${names_1.default.scope}`, sourceCode); + const parse = makeParse(this.scope.get()); + this.scope.value(parseName, { ref: parse }); + sch.parse = parse; + } + catch (e) { + if (sourceCode) + this.logger.error("Error compiling parser, function code:", sourceCode); + delete sch.parse; + delete sch.parseName; + throw e; + } + finally { + this._compilations.delete(sch); + } + return sch; +} +exports.default = compileParser; +const undef = (0, codegen_1._) `undefined`; +function parserFunction(cxt) { + const { gen, parseName, char } = cxt; + gen.func(parseName, (0, codegen_1._) `${names_1.default.json}, ${names_1.default.jsonPos}, ${names_1.default.jsonPart}`, false, () => { + gen.let(names_1.default.data); + gen.let(char); + gen.assign((0, codegen_1._) `${parseName}.message`, undef); + gen.assign((0, codegen_1._) `${parseName}.position`, undef); + gen.assign(names_1.default.jsonPos, (0, codegen_1._) `${names_1.default.jsonPos} || 0`); + gen.const(names_1.default.jsonLen, (0, codegen_1._) `${names_1.default.json}.length`); + parseCode(cxt); + skipWhitespace(cxt); + gen.if(names_1.default.jsonPart, () => { + gen.assign((0, codegen_1._) `${parseName}.position`, names_1.default.jsonPos); + gen.return(names_1.default.data); + }); + gen.if((0, codegen_1._) `${names_1.default.jsonPos} === ${names_1.default.jsonLen}`, () => gen.return(names_1.default.data)); + jsonSyntaxError(cxt); + }); +} +function parseCode(cxt) { + let form; + for (const key of types_1.jtdForms) { + if (key in cxt.schema) { + form = key; + break; + } + } + if (form) + parseNullable(cxt, genParse[form]); + else + parseEmpty(cxt); +} +const parseBoolean = parseBooleanToken(true, parseBooleanToken(false, jsonSyntaxError)); +function parseNullable(cxt, parseForm) { + const { gen, schema, data } = cxt; + if (!schema.nullable) + return parseForm(cxt); + tryParseToken(cxt, "null", parseForm, () => gen.assign(data, null)); +} +function parseElements(cxt) { + const { gen, schema, data } = cxt; + parseToken(cxt, "["); + const ix = gen.let("i", 0); + gen.assign(data, (0, codegen_1._) `[]`); + parseItems(cxt, "]", () => { + const el = gen.let("el"); + parseCode({ ...cxt, schema: schema.elements, data: el }); + gen.assign((0, codegen_1._) `${data}[${ix}++]`, el); + }); +} +function parseValues(cxt) { + const { gen, schema, data } = cxt; + parseToken(cxt, "{"); + gen.assign(data, (0, codegen_1._) `{}`); + parseItems(cxt, "}", () => parseKeyValue(cxt, schema.values)); +} +function parseItems(cxt, endToken, block) { + tryParseItems(cxt, endToken, block); + parseToken(cxt, endToken); +} +function tryParseItems(cxt, endToken, block) { + const { gen } = cxt; + gen.for((0, codegen_1._) `;${names_1.default.jsonPos}<${names_1.default.jsonLen} && ${jsonSlice(1)}!==${endToken};`, () => { + block(); + tryParseToken(cxt, ",", () => gen.break(), hasItem); + }); + function hasItem() { + tryParseToken(cxt, endToken, () => { }, jsonSyntaxError); + } +} +function parseKeyValue(cxt, schema) { + const { gen } = cxt; + const key = gen.let("key"); + parseString({ ...cxt, data: key }); + parseToken(cxt, ":"); + parsePropertyValue(cxt, key, schema); +} +function parseDiscriminator(cxt) { + const { gen, data, schema } = cxt; + const { discriminator, mapping } = schema; + parseToken(cxt, "{"); + gen.assign(data, (0, codegen_1._) `{}`); + const startPos = gen.const("pos", names_1.default.jsonPos); + const value = gen.let("value"); + const tag = gen.let("tag"); + tryParseItems(cxt, "}", () => { + const key = gen.let("key"); + parseString({ ...cxt, data: key }); + parseToken(cxt, ":"); + gen.if((0, codegen_1._) `${key} === ${discriminator}`, () => { + parseString({ ...cxt, data: tag }); + gen.assign((0, codegen_1._) `${data}[${key}]`, tag); + gen.break(); + }, () => parseEmpty({ ...cxt, data: value }) // can be discarded/skipped + ); + }); + gen.assign(names_1.default.jsonPos, startPos); + gen.if((0, codegen_1._) `${tag} === undefined`); + parsingError(cxt, (0, codegen_1.str) `discriminator tag not found`); + for (const tagValue in mapping) { + gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`); + parseSchemaProperties({ ...cxt, schema: mapping[tagValue] }, discriminator); + } + gen.else(); + parsingError(cxt, (0, codegen_1.str) `discriminator value not in schema`); + gen.endIf(); +} +function parseProperties(cxt) { + const { gen, data } = cxt; + parseToken(cxt, "{"); + gen.assign(data, (0, codegen_1._) `{}`); + parseSchemaProperties(cxt); +} +function parseSchemaProperties(cxt, discriminator) { + const { gen, schema, data } = cxt; + const { properties, optionalProperties, additionalProperties } = schema; + parseItems(cxt, "}", () => { + const key = gen.let("key"); + parseString({ ...cxt, data: key }); + parseToken(cxt, ":"); + gen.if(false); + parseDefinedProperty(cxt, key, properties); + parseDefinedProperty(cxt, key, optionalProperties); + if (discriminator) { + gen.elseIf((0, codegen_1._) `${key} === ${discriminator}`); + const tag = gen.let("tag"); + parseString({ ...cxt, data: tag }); // can be discarded, it is already assigned + } + gen.else(); + if (additionalProperties) { + parseEmpty({ ...cxt, data: (0, codegen_1._) `${data}[${key}]` }); + } + else { + parsingError(cxt, (0, codegen_1.str) `property ${key} not allowed`); + } + gen.endIf(); + }); + if (properties) { + const hasProp = (0, code_1.hasPropFunc)(gen); + const allProps = (0, codegen_1.and)(...Object.keys(properties).map((p) => (0, codegen_1._) `${hasProp}.call(${data}, ${p})`)); + gen.if((0, codegen_1.not)(allProps), () => parsingError(cxt, (0, codegen_1.str) `missing required properties`)); + } +} +function parseDefinedProperty(cxt, key, schemas = {}) { + const { gen } = cxt; + for (const prop in schemas) { + gen.elseIf((0, codegen_1._) `${key} === ${prop}`); + parsePropertyValue(cxt, key, schemas[prop]); + } +} +function parsePropertyValue(cxt, key, schema) { + parseCode({ ...cxt, schema, data: (0, codegen_1._) `${cxt.data}[${key}]` }); +} +function parseType(cxt) { + const { gen, schema, data, self } = cxt; + switch (schema.type) { + case "boolean": + parseBoolean(cxt); + break; + case "string": + parseString(cxt); + break; + case "timestamp": { + parseString(cxt); + const vts = (0, util_1.useFunc)(gen, timestamp_1.default); + const { allowDate, parseDate } = self.opts; + const notValid = allowDate ? (0, codegen_1._) `!${vts}(${data}, true)` : (0, codegen_1._) `!${vts}(${data})`; + const fail = parseDate + ? (0, codegen_1.or)(notValid, (0, codegen_1._) `(${data} = new Date(${data}), false)`, (0, codegen_1._) `isNaN(${data}.valueOf())`) + : notValid; + gen.if(fail, () => parsingError(cxt, (0, codegen_1.str) `invalid timestamp`)); + break; + } + case "float32": + case "float64": + parseNumber(cxt); + break; + default: { + const t = schema.type; + if (!self.opts.int32range && (t === "int32" || t === "uint32")) { + parseNumber(cxt, 16); // 2 ** 53 - max safe integer + if (t === "uint32") { + gen.if((0, codegen_1._) `${data} < 0`, () => parsingError(cxt, (0, codegen_1.str) `integer out of range`)); + } + } + else { + const [min, max, maxDigits] = type_1.intRange[t]; + parseNumber(cxt, maxDigits); + gen.if((0, codegen_1._) `${data} < ${min} || ${data} > ${max}`, () => parsingError(cxt, (0, codegen_1.str) `integer out of range`)); + } + } + } +} +function parseString(cxt) { + parseToken(cxt, '"'); + parseWith(cxt, parseJson_1.parseJsonString); +} +function parseEnum(cxt) { + const { gen, data, schema } = cxt; + const enumSch = schema.enum; + parseToken(cxt, '"'); + // TODO loopEnum + gen.if(false); + for (const value of enumSch) { + const valueStr = JSON.stringify(value).slice(1); // remove starting quote + gen.elseIf((0, codegen_1._) `${jsonSlice(valueStr.length)} === ${valueStr}`); + gen.assign(data, (0, codegen_1.str) `${value}`); + gen.add(names_1.default.jsonPos, valueStr.length); + } + gen.else(); + jsonSyntaxError(cxt); + gen.endIf(); +} +function parseNumber(cxt, maxDigits) { + const { gen } = cxt; + skipWhitespace(cxt); + gen.if((0, codegen_1._) `"-0123456789".indexOf(${jsonSlice(1)}) < 0`, () => jsonSyntaxError(cxt), () => parseWith(cxt, parseJson_1.parseJsonNumber, maxDigits)); +} +function parseBooleanToken(bool, fail) { + return (cxt) => { + const { gen, data } = cxt; + tryParseToken(cxt, `${bool}`, () => fail(cxt), () => gen.assign(data, bool)); + }; +} +function parseRef(cxt) { + const { gen, self, definitions, schema, schemaEnv } = cxt; + const { ref } = schema; + const refSchema = definitions[ref]; + if (!refSchema) + throw new ref_error_1.default(self.opts.uriResolver, "", ref, `No definition ${ref}`); + if (!(0, ref_1.hasRef)(refSchema)) + return parseCode({ ...cxt, schema: refSchema }); + const { root } = schemaEnv; + const sch = compileParser.call(self, new __1.SchemaEnv({ schema: refSchema, root }), definitions); + partialParse(cxt, getParser(gen, sch), true); +} +function getParser(gen, sch) { + return sch.parse + ? gen.scopeValue("parse", { ref: sch.parse }) + : (0, codegen_1._) `${gen.scopeValue("wrapper", { ref: sch })}.parse`; +} +function parseEmpty(cxt) { + parseWith(cxt, parseJson_1.parseJson); +} +function parseWith(cxt, parseFunc, args) { + partialParse(cxt, (0, util_1.useFunc)(cxt.gen, parseFunc), args); +} +function partialParse(cxt, parseFunc, args) { + const { gen, data } = cxt; + gen.assign(data, (0, codegen_1._) `${parseFunc}(${names_1.default.json}, ${names_1.default.jsonPos}${args ? (0, codegen_1._) `, ${args}` : codegen_1.nil})`); + gen.assign(names_1.default.jsonPos, (0, codegen_1._) `${parseFunc}.position`); + gen.if((0, codegen_1._) `${data} === undefined`, () => parsingError(cxt, (0, codegen_1._) `${parseFunc}.message`)); +} +function parseToken(cxt, tok) { + tryParseToken(cxt, tok, jsonSyntaxError); +} +function tryParseToken(cxt, tok, fail, success) { + const { gen } = cxt; + const n = tok.length; + skipWhitespace(cxt); + gen.if((0, codegen_1._) `${jsonSlice(n)} === ${tok}`, () => { + gen.add(names_1.default.jsonPos, n); + success === null || success === void 0 ? void 0 : success(cxt); + }, () => fail(cxt)); +} +function skipWhitespace({ gen, char: c }) { + gen.code((0, codegen_1._) `while((${c}=${names_1.default.json}[${names_1.default.jsonPos}],${c}===" "||${c}==="\\n"||${c}==="\\r"||${c}==="\\t"))${names_1.default.jsonPos}++;`); +} +function jsonSlice(len) { + return len === 1 + ? (0, codegen_1._) `${names_1.default.json}[${names_1.default.jsonPos}]` + : (0, codegen_1._) `${names_1.default.json}.slice(${names_1.default.jsonPos}, ${names_1.default.jsonPos}+${len})`; +} +function jsonSyntaxError(cxt) { + parsingError(cxt, (0, codegen_1._) `"unexpected token " + ${names_1.default.json}[${names_1.default.jsonPos}]`); +} +function parsingError({ gen, parseName }, msg) { + gen.assign((0, codegen_1._) `${parseName}.message`, msg); + gen.assign((0, codegen_1._) `${parseName}.position`, names_1.default.jsonPos); + gen.return(undef); +} +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/parse.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/parse.js.map new file mode 100644 index 000000000..a1e86279d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/parse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../lib/compile/jtd/parse.ts"],"names":[],"mappings":";;AAEA,mCAA0D;AA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cAAc,CAAC,EAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAW;IAC9C,GAAG,CAAC,IAAI,CACN,IAAA,WAAC,EAAA,UAAU,CAAC,IAAI,eAAC,CAAC,IAAI,IAAI,eAAC,CAAC,OAAO,KAAK,CAAC,WAAW,CAAC,aAAa,CAAC,aAAa,CAAC,aAAa,eAAC,CAAC,OAAO,KAAK,CAC7G,CAAA;AACH,CAAC;AAED,SAAS,SAAS,CAAC,GAAkB;IACnC,OAAO,GAAG,KAAK,CAAC;QACd,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,IAAI,IAAI,eAAC,CAAC,OAAO,GAAG;QAC5B,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,IAAI,UAAU,eAAC,CAAC,OAAO,KAAK,eAAC,CAAC,OAAO,IAAI,GAAG,GAAG,CAAA;AAC3D,CAAC;AAED,SAAS,eAAe,CAAC,GAAa;IACpC,YAAY,CAAC,GAAG,EAAE,IAAA,WAAC,EAAA,yBAAyB,eAAC,CAAC,IAAI,IAAI,eAAC,CAAC,OAAO,GAAG,CAAC,CAAA;AACrE,CAAC;AAED,SAAS,YAAY,CAAC,EAAC,GAAG,EAAE,SAAS,EAAW,EAAE,GAAS;IACzD,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,SAAS,UAAU,EAAE,GAAG,CAAC,CAAA;IACxC,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,SAAS,WAAW,EAAE,eAAC,CAAC,OAAO,CAAC,CAAA;IAC/C,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACnB,CAAC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/serialize.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/serialize.d.ts new file mode 100644 index 000000000..b0413d716 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/serialize.d.ts @@ -0,0 +1,4 @@ +import type Ajv from "../../core"; +import { SchemaObjectMap } from "./types"; +import { SchemaEnv } from ".."; +export default function compileSerializer(this: Ajv, sch: SchemaEnv, definitions: SchemaObjectMap): SchemaEnv; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/serialize.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/serialize.js new file mode 100644 index 000000000..29bf234c8 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/serialize.js @@ -0,0 +1,218 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const types_1 = require("./types"); +const __1 = require(".."); +const codegen_1 = require("../codegen"); +const ref_error_1 = require("../ref_error"); +const names_1 = require("../names"); +const code_1 = require("../../vocabularies/code"); +const ref_1 = require("../../vocabularies/jtd/ref"); +const util_1 = require("../util"); +const quote_1 = require("../../runtime/quote"); +const genSerialize = { + elements: serializeElements, + values: serializeValues, + discriminator: serializeDiscriminator, + properties: serializeProperties, + optionalProperties: serializeProperties, + enum: serializeString, + type: serializeType, + ref: serializeRef, +}; +function compileSerializer(sch, definitions) { + const _sch = __1.getCompilingSchema.call(this, sch); + if (_sch) + return _sch; + const { es5, lines } = this.opts.code; + const { ownProperties } = this.opts; + const gen = new codegen_1.CodeGen(this.scope, { es5, lines, ownProperties }); + const serializeName = gen.scopeName("serialize"); + const cxt = { + self: this, + gen, + schema: sch.schema, + schemaEnv: sch, + definitions, + data: names_1.default.data, + }; + let sourceCode; + try { + this._compilations.add(sch); + sch.serializeName = serializeName; + gen.func(serializeName, names_1.default.data, false, () => { + gen.let(names_1.default.json, (0, codegen_1.str) ``); + serializeCode(cxt); + gen.return(names_1.default.json); + }); + gen.optimize(this.opts.code.optimize); + const serializeFuncCode = gen.toString(); + sourceCode = `${gen.scopeRefs(names_1.default.scope)}return ${serializeFuncCode}`; + const makeSerialize = new Function(`${names_1.default.scope}`, sourceCode); + const serialize = makeSerialize(this.scope.get()); + this.scope.value(serializeName, { ref: serialize }); + sch.serialize = serialize; + } + catch (e) { + if (sourceCode) + this.logger.error("Error compiling serializer, function code:", sourceCode); + delete sch.serialize; + delete sch.serializeName; + throw e; + } + finally { + this._compilations.delete(sch); + } + return sch; +} +exports.default = compileSerializer; +function serializeCode(cxt) { + let form; + for (const key of types_1.jtdForms) { + if (key in cxt.schema) { + form = key; + break; + } + } + serializeNullable(cxt, form ? genSerialize[form] : serializeEmpty); +} +function serializeNullable(cxt, serializeForm) { + const { gen, schema, data } = cxt; + if (!schema.nullable) + return serializeForm(cxt); + gen.if((0, codegen_1._) `${data} === undefined || ${data} === null`, () => gen.add(names_1.default.json, (0, codegen_1._) `"null"`), () => serializeForm(cxt)); +} +function serializeElements(cxt) { + const { gen, schema, data } = cxt; + gen.add(names_1.default.json, (0, codegen_1.str) `[`); + const first = gen.let("first", true); + gen.forOf("el", data, (el) => { + addComma(cxt, first); + serializeCode({ ...cxt, schema: schema.elements, data: el }); + }); + gen.add(names_1.default.json, (0, codegen_1.str) `]`); +} +function serializeValues(cxt) { + const { gen, schema, data } = cxt; + gen.add(names_1.default.json, (0, codegen_1.str) `{`); + const first = gen.let("first", true); + gen.forIn("key", data, (key) => serializeKeyValue(cxt, key, schema.values, first)); + gen.add(names_1.default.json, (0, codegen_1.str) `}`); +} +function serializeKeyValue(cxt, key, schema, first) { + const { gen, data } = cxt; + addComma(cxt, first); + serializeString({ ...cxt, data: key }); + gen.add(names_1.default.json, (0, codegen_1.str) `:`); + const value = gen.const("value", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(key)}`); + serializeCode({ ...cxt, schema, data: value }); +} +function serializeDiscriminator(cxt) { + const { gen, schema, data } = cxt; + const { discriminator } = schema; + gen.add(names_1.default.json, (0, codegen_1.str) `{${JSON.stringify(discriminator)}:`); + const tag = gen.const("tag", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(discriminator)}`); + serializeString({ ...cxt, data: tag }); + gen.if(false); + for (const tagValue in schema.mapping) { + gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`); + const sch = schema.mapping[tagValue]; + serializeSchemaProperties({ ...cxt, schema: sch }, discriminator); + } + gen.endIf(); + gen.add(names_1.default.json, (0, codegen_1.str) `}`); +} +function serializeProperties(cxt) { + const { gen } = cxt; + gen.add(names_1.default.json, (0, codegen_1.str) `{`); + serializeSchemaProperties(cxt); + gen.add(names_1.default.json, (0, codegen_1.str) `}`); +} +function serializeSchemaProperties(cxt, discriminator) { + const { gen, schema, data } = cxt; + const { properties, optionalProperties } = schema; + const props = keys(properties); + const optProps = keys(optionalProperties); + const allProps = allProperties(props.concat(optProps)); + let first = !discriminator; + for (const key of props) { + serializeProperty(key, properties[key], keyValue(key)); + } + for (const key of optProps) { + const value = keyValue(key); + gen.if((0, codegen_1.and)((0, codegen_1._) `${value} !== undefined`, (0, code_1.isOwnProperty)(gen, data, key)), () => serializeProperty(key, optionalProperties[key], value)); + } + if (schema.additionalProperties) { + gen.forIn("key", data, (key) => gen.if(isAdditional(key, allProps), () => serializeKeyValue(cxt, key, {}, gen.let("first", first)))); + } + function keys(ps) { + return ps ? Object.keys(ps) : []; + } + function allProperties(ps) { + if (discriminator) + ps.push(discriminator); + if (new Set(ps).size !== ps.length) { + throw new Error("JTD: properties/optionalProperties/disciminator overlap"); + } + return ps; + } + function keyValue(key) { + return gen.const("value", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(key)}`); + } + function serializeProperty(key, propSchema, value) { + if (first) + first = false; + else + gen.add(names_1.default.json, (0, codegen_1.str) `,`); + gen.add(names_1.default.json, (0, codegen_1.str) `${JSON.stringify(key)}:`); + serializeCode({ ...cxt, schema: propSchema, data: value }); + } + function isAdditional(key, ps) { + return ps.length ? (0, codegen_1.and)(...ps.map((p) => (0, codegen_1._) `${key} !== ${p}`)) : true; + } +} +function serializeType(cxt) { + const { gen, schema, data } = cxt; + switch (schema.type) { + case "boolean": + gen.add(names_1.default.json, (0, codegen_1._) `${data} ? "true" : "false"`); + break; + case "string": + serializeString(cxt); + break; + case "timestamp": + gen.if((0, codegen_1._) `${data} instanceof Date`, () => gen.add(names_1.default.json, (0, codegen_1._) `'"' + ${data}.toISOString() + '"'`), () => serializeString(cxt)); + break; + default: + serializeNumber(cxt); + } +} +function serializeString({ gen, data }) { + gen.add(names_1.default.json, (0, codegen_1._) `${(0, util_1.useFunc)(gen, quote_1.default)}(${data})`); +} +function serializeNumber({ gen, data }) { + gen.add(names_1.default.json, (0, codegen_1._) `"" + ${data}`); +} +function serializeRef(cxt) { + const { gen, self, data, definitions, schema, schemaEnv } = cxt; + const { ref } = schema; + const refSchema = definitions[ref]; + if (!refSchema) + throw new ref_error_1.default(self.opts.uriResolver, "", ref, `No definition ${ref}`); + if (!(0, ref_1.hasRef)(refSchema)) + return serializeCode({ ...cxt, schema: refSchema }); + const { root } = schemaEnv; + const sch = compileSerializer.call(self, new __1.SchemaEnv({ schema: refSchema, root }), definitions); + gen.add(names_1.default.json, (0, codegen_1._) `${getSerialize(gen, sch)}(${data})`); +} +function getSerialize(gen, sch) { + return sch.serialize + ? gen.scopeValue("serialize", { ref: sch.serialize }) + : (0, codegen_1._) `${gen.scopeValue("wrapper", { ref: sch })}.serialize`; +} +function serializeEmpty({ gen, data }) { + gen.add(names_1.default.json, (0, codegen_1._) `JSON.stringify(${data})`); +} +function addComma({ gen }, first) { + gen.if(first, () => gen.assign(first, false), () => gen.add(names_1.default.json, (0, codegen_1.str) `,`)); +} +//# sourceMappingURL=serialize.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/serialize.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/serialize.js.map new file mode 100644 index 000000000..10c6ed125 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/serialize.js.map @@ -0,0 +1 @@ +{"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../../lib/compile/jtd/serialize.ts"],"names":[],"mappings":";;AAEA,mCAA0D;AAC1D,0BAAgD;AACh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AG,EAAC,CAAC,YAAY,CAAA;AAC3D,CAAC;AAED,SAAS,cAAc,CAAC,EAAC,GAAG,EAAE,IAAI,EAAe;IAC/C,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,WAAC,EAAA,kBAAkB,IAAI,GAAG,CAAC,CAAA;AAC7C,CAAC;AAED,SAAS,QAAQ,CAAC,EAAC,GAAG,EAAe,EAAE,KAAW;IAChD,GAAG,CAAC,EAAE,CACJ,KAAK,EACL,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,EAC9B,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,eAAC,CAAC,IAAI,EAAE,IAAA,aAAG,EAAA,GAAG,CAAC,CAC9B,CAAA;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/types.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/types.d.ts new file mode 100644 index 000000000..38c8bea7f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/types.d.ts @@ -0,0 +1,6 @@ +import type { SchemaObject } from "../../types"; +export declare type SchemaObjectMap = { + [Ref in string]?: SchemaObject; +}; +export declare const jtdForms: readonly ["elements", "values", "discriminator", "properties", "optionalProperties", "enum", "type", "ref"]; +export declare type JTDForm = typeof jtdForms[number]; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/types.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/types.js new file mode 100644 index 000000000..b9c60a90f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/types.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.jtdForms = void 0; +exports.jtdForms = [ + "elements", + "values", + "discriminator", + "properties", + "optionalProperties", + "enum", + "type", + "ref", +]; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/types.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/types.js.map new file mode 100644 index 000000000..53439e002 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/jtd/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/compile/jtd/types.ts"],"names":[],"mappings":";;;AAIa,QAAA,QAAQ,GAAG;IACtB,UAAU;IACV,QAAQ;IACR,eAAe;IACf,YAAY;IACZ,oBAAoB;IACpB,MAAM;IACN,MAAM;IACN,KAAK;CACG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/names.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/names.d.ts new file mode 100644 index 000000000..5740e82c6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/names.d.ts @@ -0,0 +1,20 @@ +import { Name } from "./codegen"; +declare const names: { + data: Name; + valCxt: Name; + instancePath: Name; + parentData: Name; + parentDataProperty: Name; + rootData: Name; + dynamicAnchors: Name; + vErrors: Name; + errors: Name; + this: Name; + self: Name; + scope: Name; + json: Name; + jsonPos: Name; + jsonLen: Name; + jsonPart: Name; +}; +export default names; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/names.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/names.js new file mode 100644 index 000000000..015334bd5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/names.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("./codegen"); +const names = { + // validation function arguments + data: new codegen_1.Name("data"), + // args passed from referencing schema + valCxt: new codegen_1.Name("valCxt"), + instancePath: new codegen_1.Name("instancePath"), + parentData: new codegen_1.Name("parentData"), + parentDataProperty: new codegen_1.Name("parentDataProperty"), + rootData: new codegen_1.Name("rootData"), + dynamicAnchors: new codegen_1.Name("dynamicAnchors"), + // function scoped variables + vErrors: new codegen_1.Name("vErrors"), + errors: new codegen_1.Name("errors"), + this: new codegen_1.Name("this"), + // "globals" + self: new codegen_1.Name("self"), + scope: new codegen_1.Name("scope"), + // JTD serialize/parse name for JSON string and position + json: new codegen_1.Name("json"), + jsonPos: new codegen_1.Name("jsonPos"), + jsonLen: new codegen_1.Name("jsonLen"), + jsonPart: new codegen_1.Name("jsonPart"), +}; +exports.default = names; +//# sourceMappingURL=names.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/names.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/names.js.map new file mode 100644 index 000000000..9bbe8e275 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/names.js.map @@ -0,0 +1 @@ +{"version":3,"file":"names.js","sourceRoot":"","sources":["../../lib/compile/names.ts"],"names":[],"mappings":";;AAAA,uCAA8B;AAE9B,MAAM,KAAK,GAAG;IACZ,gCAAgC;IAChC,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,sCAAsC;IACtC,MAAM,EAAE,IAAI,cAAI,CAAC,QAAQ,CAAC;IAC1B,YAAY,EAAE,IAAI,cAAI,CAAC,cAAc,CAAC;IACtC,UAAU,EAAE,IAAI,cAAI,CAAC,YAAY,CAAC;IAClC,kBAAkB,EAAE,IAAI,cAAI,CAAC,oBAAoB,CAAC;IAClD,QAAQ,EAAE,IAAI,cAAI,CAAC,UAAU,CAAC;IAC9B,cAAc,EAAE,IAAI,cAAI,CAAC,gBAAgB,CAAC;IAC1C,4BAA4B;IAC5B,OAAO,EAAE,IAAI,cAAI,CAAC,SAAS,CAAC;IAC5B,MAAM,EAAE,IAAI,cAAI,CAAC,QAAQ,CAAC;IAC1B,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,YAAY;IACZ,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,KAAK,EAAE,IAAI,cAAI,CAAC,OAAO,CAAC;IACxB,wDAAwD;IACxD,IAAI,EAAE,IAAI,cAAI,CAAC,MAAM,CAAC;IACtB,OAAO,EAAE,IAAI,cAAI,CAAC,SAAS,CAAC;IAC5B,OAAO,EAAE,IAAI,cAAI,CAAC,SAAS,CAAC;IAC5B,QAAQ,EAAE,IAAI,cAAI,CAAC,UAAU,CAAC;CAC/B,CAAA;AAED,kBAAe,KAAK,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/ref_error.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/ref_error.d.ts new file mode 100644 index 000000000..43374439e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/ref_error.d.ts @@ -0,0 +1,6 @@ +import type { UriResolver } from "../types"; +export default class MissingRefError extends Error { + readonly missingRef: string; + readonly missingSchema: string; + constructor(resolver: UriResolver, baseId: string, ref: string, msg?: string); +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/ref_error.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/ref_error.js new file mode 100644 index 000000000..3916dec8a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/ref_error.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const resolve_1 = require("./resolve"); +class MissingRefError extends Error { + constructor(resolver, baseId, ref, msg) { + super(msg || `can't resolve reference ${ref} from id ${baseId}`); + this.missingRef = (0, resolve_1.resolveUrl)(resolver, baseId, ref); + this.missingSchema = (0, resolve_1.normalizeId)((0, resolve_1.getFullPath)(resolver, this.missingRef)); + } +} +exports.default = MissingRefError; +//# sourceMappingURL=ref_error.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/ref_error.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/ref_error.js.map new file mode 100644 index 000000000..d13f5f2dd --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/ref_error.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ref_error.js","sourceRoot":"","sources":["../../lib/compile/ref_error.ts"],"names":[],"mappings":";;AAAA,uCAA8D;AAG9D,MAAqB,eAAgB,SAAQ,KAAK;IAIhD,YAAY,QAAqB,EAAE,MAAc,EAAE,GAAW,EAAE,GAAY;QAC1E,KAAK,CAAC,GAAG,IAAI,2BAA2B,GAAG,YAAY,MAAM,EAAE,CAAC,CAAA;QAChE,IAAI,CAAC,UAAU,GAAG,IAAA,oBAAU,EAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA;QACnD,IAAI,CAAC,aAAa,GAAG,IAAA,qBAAW,EAAC,IAAA,qBAAW,EAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAA;IAC1E,CAAC;CACF;AATD,kCASC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/resolve.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/resolve.d.ts new file mode 100644 index 000000000..745eaeb42 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/resolve.d.ts @@ -0,0 +1,12 @@ +import type { AnySchema, AnySchemaObject, UriResolver } from "../types"; +import type Ajv from "../ajv"; +import type { URIComponents } from "uri-js"; +export declare type LocalRefs = { + [Ref in string]?: AnySchemaObject; +}; +export declare function inlineRef(schema: AnySchema, limit?: boolean | number): boolean; +export declare function getFullPath(resolver: UriResolver, id?: string, normalize?: boolean): string; +export declare function _getFullPath(resolver: UriResolver, p: URIComponents): string; +export declare function normalizeId(id: string | undefined): string; +export declare function resolveUrl(resolver: UriResolver, baseId: string, id: string): string; +export declare function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): LocalRefs; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/resolve.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/resolve.js new file mode 100644 index 000000000..8b51a20e6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/resolve.js @@ -0,0 +1,155 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getSchemaRefs = exports.resolveUrl = exports.normalizeId = exports._getFullPath = exports.getFullPath = exports.inlineRef = void 0; +const util_1 = require("./util"); +const equal = require("fast-deep-equal"); +const traverse = require("json-schema-traverse"); +// TODO refactor to use keyword definitions +const SIMPLE_INLINED = new Set([ + "type", + "format", + "pattern", + "maxLength", + "minLength", + "maxProperties", + "minProperties", + "maxItems", + "minItems", + "maximum", + "minimum", + "uniqueItems", + "multipleOf", + "required", + "enum", + "const", +]); +function inlineRef(schema, limit = true) { + if (typeof schema == "boolean") + return true; + if (limit === true) + return !hasRef(schema); + if (!limit) + return false; + return countKeys(schema) <= limit; +} +exports.inlineRef = inlineRef; +const REF_KEYWORDS = new Set([ + "$ref", + "$recursiveRef", + "$recursiveAnchor", + "$dynamicRef", + "$dynamicAnchor", +]); +function hasRef(schema) { + for (const key in schema) { + if (REF_KEYWORDS.has(key)) + return true; + const sch = schema[key]; + if (Array.isArray(sch) && sch.some(hasRef)) + return true; + if (typeof sch == "object" && hasRef(sch)) + return true; + } + return false; +} +function countKeys(schema) { + let count = 0; + for (const key in schema) { + if (key === "$ref") + return Infinity; + count++; + if (SIMPLE_INLINED.has(key)) + continue; + if (typeof schema[key] == "object") { + (0, util_1.eachItem)(schema[key], (sch) => (count += countKeys(sch))); + } + if (count === Infinity) + return Infinity; + } + return count; +} +function getFullPath(resolver, id = "", normalize) { + if (normalize !== false) + id = normalizeId(id); + const p = resolver.parse(id); + return _getFullPath(resolver, p); +} +exports.getFullPath = getFullPath; +function _getFullPath(resolver, p) { + const serialized = resolver.serialize(p); + return serialized.split("#")[0] + "#"; +} +exports._getFullPath = _getFullPath; +const TRAILING_SLASH_HASH = /#\/?$/; +function normalizeId(id) { + return id ? id.replace(TRAILING_SLASH_HASH, "") : ""; +} +exports.normalizeId = normalizeId; +function resolveUrl(resolver, baseId, id) { + id = normalizeId(id); + return resolver.resolve(baseId, id); +} +exports.resolveUrl = resolveUrl; +const ANCHOR = /^[a-z_][-a-z0-9._]*$/i; +function getSchemaRefs(schema, baseId) { + if (typeof schema == "boolean") + return {}; + const { schemaId, uriResolver } = this.opts; + const schId = normalizeId(schema[schemaId] || baseId); + const baseIds = { "": schId }; + const pathPrefix = getFullPath(uriResolver, schId, false); + const localRefs = {}; + const schemaRefs = new Set(); + traverse(schema, { allKeys: true }, (sch, jsonPtr, _, parentJsonPtr) => { + if (parentJsonPtr === undefined) + return; + const fullPath = pathPrefix + jsonPtr; + let baseId = baseIds[parentJsonPtr]; + if (typeof sch[schemaId] == "string") + baseId = addRef.call(this, sch[schemaId]); + addAnchor.call(this, sch.$anchor); + addAnchor.call(this, sch.$dynamicAnchor); + baseIds[jsonPtr] = baseId; + function addRef(ref) { + // eslint-disable-next-line @typescript-eslint/unbound-method + const _resolve = this.opts.uriResolver.resolve; + ref = normalizeId(baseId ? _resolve(baseId, ref) : ref); + if (schemaRefs.has(ref)) + throw ambiguos(ref); + schemaRefs.add(ref); + let schOrRef = this.refs[ref]; + if (typeof schOrRef == "string") + schOrRef = this.refs[schOrRef]; + if (typeof schOrRef == "object") { + checkAmbiguosRef(sch, schOrRef.schema, ref); + } + else if (ref !== normalizeId(fullPath)) { + if (ref[0] === "#") { + checkAmbiguosRef(sch, localRefs[ref], ref); + localRefs[ref] = sch; + } + else { + this.refs[ref] = fullPath; + } + } + return ref; + } + function addAnchor(anchor) { + if (typeof anchor == "string") { + if (!ANCHOR.test(anchor)) + throw new Error(`invalid anchor "${anchor}"`); + addRef.call(this, `#${anchor}`); + } + } + }); + return localRefs; + function checkAmbiguosRef(sch1, sch2, ref) { + if (sch2 !== undefined && !equal(sch1, sch2)) + throw ambiguos(ref); + } + function ambiguos(ref) { + return new Error(`reference "${ref}" resolves to more than one schema`); + } +} +exports.getSchemaRefs = getSchemaRefs; +//# sourceMappingURL=resolve.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/resolve.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/resolve.js.map new file mode 100644 index 000000000..81f08b0c3 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/resolve.js.map @@ -0,0 +1 @@ +{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../lib/compile/resolve.ts"],"names":[],"mappings":";;;AAGA,iCAA+B;AAC/B,yCAAwC;AACxC,iDAAgD;AAKhD,2CAA2C;AAC3C,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC;IAC7B,MAAM;IACN,QAAQ;IACR,SAAS;IACT,WAAW;IACX,WAAW;IACX,eAAe;IACf,eAAe;IACf,UAAU;IACV,UAAU;IACV,SAAS;IACT,SAAS;IACT,aAAa;IACb,YAAY;IACZ,UAAU;IACV,MAAM;IACN,OAAO;CACR,CAAC,CAAA;AAEF,SAAgB,SAAS,CAAC,MAAiB,EAAE,QAA0B,IAAI;IACzE,IAAI,OAAO,MAAM,IAAI,SAAS;QAAE,OAAO,IAAI,CAAA;IAC3C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC1C,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAA;IACxB,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,KAAK,CAAA;AACnC,CAAC;AALD,8BAKC;AAED,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC;IAC3B,MAAM;IACN,eAAe;IACf,kBAAkB;IAClB,aAAa;IACb,gBAAgB;CACjB,CAAC,CAAA;AAEF,SAAS,MAAM,CAAC,MAAuB;IACrC,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;QACxB,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAA;QACtC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;QACvB,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,CAAA;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A;iBACrB;qBAAM;oBACL,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAA;iBAC1B;aACF;YACD,OAAO,GAAG,CAAA;QACZ,CAAC;QAED,SAAS,SAAS,CAAY,MAAe;YAC3C,IAAI,OAAO,MAAM,IAAI,QAAQ,EAAE;gBAC7B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;oBAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,MAAM,GAAG,CAAC,CAAA;gBACvE,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC,CAAA;aAChC;QACH,CAAC;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,SAAS,CAAA;IAEhB,SAAS,gBAAgB,CAAC,IAAe,EAAE,IAA2B,EAAE,GAAW;QACjF,IAAI,IAAI,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC;YAAE,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAA;IACnE,CAAC;IAED,SAAS,QAAQ,CAAC,GAAW;QAC3B,OAAO,IAAI,KAAK,CAAC,cAAc,GAAG,oCAAoC,CAAC,CAAA;IACzE,CAAC;AACH,CAAC;AAxDD,sCAwDC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/rules.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/rules.d.ts new file mode 100644 index 000000000..7def4b5a3 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/rules.d.ts @@ -0,0 +1,28 @@ +import type { AddedKeywordDefinition } from "../types"; +declare const _jsonTypes: readonly ["string", "number", "integer", "boolean", "null", "object", "array"]; +export declare type JSONType = typeof _jsonTypes[number]; +export declare function isJSONType(x: unknown): x is JSONType; +declare type ValidationTypes = { + [K in JSONType]: boolean | RuleGroup | undefined; +}; +export interface ValidationRules { + rules: RuleGroup[]; + post: RuleGroup; + all: { + [Key in string]?: boolean | Rule; + }; + keywords: { + [Key in string]?: boolean; + }; + types: ValidationTypes; +} +export interface RuleGroup { + type?: JSONType; + rules: Rule[]; +} +export interface Rule { + keyword: string; + definition: AddedKeywordDefinition; +} +export declare function getRules(): ValidationRules; +export {}; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/rules.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/rules.js new file mode 100644 index 000000000..82a591ff4 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/rules.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getRules = exports.isJSONType = void 0; +const _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array"]; +const jsonTypes = new Set(_jsonTypes); +function isJSONType(x) { + return typeof x == "string" && jsonTypes.has(x); +} +exports.isJSONType = isJSONType; +function getRules() { + const groups = { + number: { type: "number", rules: [] }, + string: { type: "string", rules: [] }, + array: { type: "array", rules: [] }, + object: { type: "object", rules: [] }, + }; + return { + types: { ...groups, integer: true, boolean: true, null: true }, + rules: [{ rules: [] }, groups.number, groups.string, groups.array, groups.object], + post: { rules: [] }, + all: {}, + keywords: {}, + }; +} +exports.getRules = getRules; +//# sourceMappingURL=rules.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/rules.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/rules.js.map new file mode 100644 index 000000000..084c70f82 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/rules.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rules.js","sourceRoot":"","sources":["../../lib/compile/rules.ts"],"names":[],"mappings":";;;AAEA,MAAM,UAAU,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAA;AAIjG,MAAM,SAAS,GAAgB,IAAI,GAAG,CAAC,UAAU,CAAC,CAAA;AAElD,SAAgB,UAAU,CAAC,CAAU;IACnC,OAAO,OAAO,CAAC,IAAI,QAAQ,IAAI,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AACjD,CAAC;AAFD,gCAEC;AAyBD,SAAgB,QAAQ;IACtB,MAAM,MAAM,GAAgE;QAC1E,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC;QACnC,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC;QACnC,KAAK,EAAE,EAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAC;QACjC,MAAM,EAAE,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAC;KACpC,CAAA;IACD,OAAO;QACL,KAAK,EAAE,EAAC,GAAG,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC;QAC5D,KAAK,EAAE,CAAC,EAAC,KAAK,EAAE,EAAE,EAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC;QAC/E,IAAI,EAAE,EAAC,KAAK,EAAE,EAAE,EAAC;QACjB,GAAG,EAAE,EAAE;QACP,QAAQ,EAAE,EAAE;KACb,CAAA;AACH,CAAC;AAdD,4BAcC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/util.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/util.d.ts new file mode 100644 index 000000000..17042cf0e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/util.d.ts @@ -0,0 +1,40 @@ +import type { AnySchema, EvaluatedProperties, EvaluatedItems } from "../types"; +import type { SchemaCxt, SchemaObjCxt } from "."; +import { Code, Name, CodeGen } from "./codegen"; +import type { Rule, ValidationRules } from "./rules"; +export declare function toHash(arr: T[]): { + [K in T]?: true; +}; +export declare function alwaysValidSchema(it: SchemaCxt, schema: AnySchema): boolean | void; +export declare function checkUnknownRules(it: SchemaCxt, schema?: AnySchema): void; +export declare function schemaHasRules(schema: AnySchema, rules: { + [Key in string]?: boolean | Rule; +}): boolean; +export declare function schemaHasRulesButRef(schema: AnySchema, RULES: ValidationRules): boolean; +export declare function schemaRefOrVal({ topSchemaRef, schemaPath }: SchemaObjCxt, schema: unknown, keyword: string, $data?: string | false): Code | number | boolean; +export declare function unescapeFragment(str: string): string; +export declare function escapeFragment(str: string | number): string; +export declare function escapeJsonPointer(str: string | number): string; +export declare function unescapeJsonPointer(str: string): string; +export declare function eachItem(xs: T | T[], f: (x: T) => void): void; +declare type SomeEvaluated = EvaluatedProperties | EvaluatedItems; +declare type MergeEvaluatedFunc = (gen: CodeGen, from: Name | T, to: Name | Exclude | undefined, toName?: typeof Name) => Name | T; +interface MergeEvaluated { + props: MergeEvaluatedFunc; + items: MergeEvaluatedFunc; +} +export declare const mergeEvaluated: MergeEvaluated; +export declare function evaluatedPropsToName(gen: CodeGen, ps?: EvaluatedProperties): Name; +export declare function setEvaluated(gen: CodeGen, props: Name, ps: { + [K in string]?: true; +}): void; +export declare function useFunc(gen: CodeGen, f: { + code: string; +}): Name; +export declare enum Type { + Num = 0, + Str = 1 +} +export declare function getErrorPath(dataProp: Name | string | number, dataPropType?: Type, jsPropertySyntax?: boolean): Code | string; +export declare function checkStrictMode(it: SchemaCxt, msg: string, mode?: boolean | "log"): void; +export {}; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/util.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/util.js new file mode 100644 index 000000000..091ad4c0d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/util.js @@ -0,0 +1,178 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.checkStrictMode = exports.getErrorPath = exports.Type = exports.useFunc = exports.setEvaluated = exports.evaluatedPropsToName = exports.mergeEvaluated = exports.eachItem = exports.unescapeJsonPointer = exports.escapeJsonPointer = exports.escapeFragment = exports.unescapeFragment = exports.schemaRefOrVal = exports.schemaHasRulesButRef = exports.schemaHasRules = exports.checkUnknownRules = exports.alwaysValidSchema = exports.toHash = void 0; +const codegen_1 = require("./codegen"); +const code_1 = require("./codegen/code"); +// TODO refactor to use Set +function toHash(arr) { + const hash = {}; + for (const item of arr) + hash[item] = true; + return hash; +} +exports.toHash = toHash; +function alwaysValidSchema(it, schema) { + if (typeof schema == "boolean") + return schema; + if (Object.keys(schema).length === 0) + return true; + checkUnknownRules(it, schema); + return !schemaHasRules(schema, it.self.RULES.all); +} +exports.alwaysValidSchema = alwaysValidSchema; +function checkUnknownRules(it, schema = it.schema) { + const { opts, self } = it; + if (!opts.strictSchema) + return; + if (typeof schema === "boolean") + return; + const rules = self.RULES.keywords; + for (const key in schema) { + if (!rules[key]) + checkStrictMode(it, `unknown keyword: "${key}"`); + } +} +exports.checkUnknownRules = checkUnknownRules; +function schemaHasRules(schema, rules) { + if (typeof schema == "boolean") + return !schema; + for (const key in schema) + if (rules[key]) + return true; + return false; +} +exports.schemaHasRules = schemaHasRules; +function schemaHasRulesButRef(schema, RULES) { + if (typeof schema == "boolean") + return !schema; + for (const key in schema) + if (key !== "$ref" && RULES.all[key]) + return true; + return false; +} +exports.schemaHasRulesButRef = schemaHasRulesButRef; +function schemaRefOrVal({ topSchemaRef, schemaPath }, schema, keyword, $data) { + if (!$data) { + if (typeof schema == "number" || typeof schema == "boolean") + return schema; + if (typeof schema == "string") + return (0, codegen_1._) `${schema}`; + } + return (0, codegen_1._) `${topSchemaRef}${schemaPath}${(0, codegen_1.getProperty)(keyword)}`; +} +exports.schemaRefOrVal = schemaRefOrVal; +function unescapeFragment(str) { + return unescapeJsonPointer(decodeURIComponent(str)); +} +exports.unescapeFragment = unescapeFragment; +function escapeFragment(str) { + return encodeURIComponent(escapeJsonPointer(str)); +} +exports.escapeFragment = escapeFragment; +function escapeJsonPointer(str) { + if (typeof str == "number") + return `${str}`; + return str.replace(/~/g, "~0").replace(/\//g, "~1"); +} +exports.escapeJsonPointer = escapeJsonPointer; +function unescapeJsonPointer(str) { + return str.replace(/~1/g, "/").replace(/~0/g, "~"); +} +exports.unescapeJsonPointer = unescapeJsonPointer; +function eachItem(xs, f) { + if (Array.isArray(xs)) { + for (const x of xs) + f(x); + } + else { + f(xs); + } +} +exports.eachItem = eachItem; +function makeMergeEvaluated({ mergeNames, mergeToName, mergeValues, resultToName, }) { + return (gen, from, to, toName) => { + const res = to === undefined + ? from + : to instanceof codegen_1.Name + ? (from instanceof codegen_1.Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) + : from instanceof codegen_1.Name + ? (mergeToName(gen, to, from), from) + : mergeValues(from, to); + return toName === codegen_1.Name && !(res instanceof codegen_1.Name) ? resultToName(gen, res) : res; + }; +} +exports.mergeEvaluated = { + props: makeMergeEvaluated({ + mergeNames: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true && ${from} !== undefined`, () => { + gen.if((0, codegen_1._) `${from} === true`, () => gen.assign(to, true), () => gen.assign(to, (0, codegen_1._) `${to} || {}`).code((0, codegen_1._) `Object.assign(${to}, ${from})`)); + }), + mergeToName: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true`, () => { + if (from === true) { + gen.assign(to, true); + } + else { + gen.assign(to, (0, codegen_1._) `${to} || {}`); + setEvaluated(gen, to, from); + } + }), + mergeValues: (from, to) => (from === true ? true : { ...from, ...to }), + resultToName: evaluatedPropsToName, + }), + items: makeMergeEvaluated({ + mergeNames: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true && ${from} !== undefined`, () => gen.assign(to, (0, codegen_1._) `${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`)), + mergeToName: (gen, from, to) => gen.if((0, codegen_1._) `${to} !== true`, () => gen.assign(to, from === true ? true : (0, codegen_1._) `${to} > ${from} ? ${to} : ${from}`)), + mergeValues: (from, to) => (from === true ? true : Math.max(from, to)), + resultToName: (gen, items) => gen.var("items", items), + }), +}; +function evaluatedPropsToName(gen, ps) { + if (ps === true) + return gen.var("props", true); + const props = gen.var("props", (0, codegen_1._) `{}`); + if (ps !== undefined) + setEvaluated(gen, props, ps); + return props; +} +exports.evaluatedPropsToName = evaluatedPropsToName; +function setEvaluated(gen, props, ps) { + Object.keys(ps).forEach((p) => gen.assign((0, codegen_1._) `${props}${(0, codegen_1.getProperty)(p)}`, true)); +} +exports.setEvaluated = setEvaluated; +const snippets = {}; +function useFunc(gen, f) { + return gen.scopeValue("func", { + ref: f, + code: snippets[f.code] || (snippets[f.code] = new code_1._Code(f.code)), + }); +} +exports.useFunc = useFunc; +var Type; +(function (Type) { + Type[Type["Num"] = 0] = "Num"; + Type[Type["Str"] = 1] = "Str"; +})(Type = exports.Type || (exports.Type = {})); +function getErrorPath(dataProp, dataPropType, jsPropertySyntax) { + // let path + if (dataProp instanceof codegen_1.Name) { + const isNumber = dataPropType === Type.Num; + return jsPropertySyntax + ? isNumber + ? (0, codegen_1._) `"[" + ${dataProp} + "]"` + : (0, codegen_1._) `"['" + ${dataProp} + "']"` + : isNumber + ? (0, codegen_1._) `"/" + ${dataProp}` + : (0, codegen_1._) `"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")`; // TODO maybe use global escapePointer + } + return jsPropertySyntax ? (0, codegen_1.getProperty)(dataProp).toString() : "/" + escapeJsonPointer(dataProp); +} +exports.getErrorPath = getErrorPath; +function checkStrictMode(it, msg, mode = it.opts.strictSchema) { + if (!mode) + return; + msg = `strict mode: ${msg}`; + if (mode === true) + throw new Error(msg); + it.self.logger.warn(msg); +} +exports.checkStrictMode = checkStrictMode; +//# sourceMappingURL=util.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/util.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/util.js.map new file mode 100644 index 000000000..a2128fc39 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/util.js.map @@ -0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YAAY,KAAK,IAAI,CAAC,GAAG,CAAA;QAC1C,OAAO,gBAAgB;YACrB,CAAC,CAAC,QAAQ;gBACR,CAAC,CAAC,IAAA,WAAC,EAAA,SAAS,QAAQ,QAAQ;gBAC5B,CAAC,CAAC,IAAA,WAAC,EAAA,UAAU,QAAQ,SAAS;YAChC,CAAC,CAAC,QAAQ;gBACV,CAAC,CAAC,IAAA,WAAC,EAAA,SAAS,QAAQ,EAAE;gBACtB,CAAC,CAAC,IAAA,WAAC,EAAA,SAAS,QAAQ,4CAA4C,CAAA,CAAC,sCAAsC;KAC1G;IACD,OAAO,gBAAgB,CAAC,CAAC,CAAC,IAAA,qBAAW,EAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAA;AAChG,CAAC;AAjBD,oCAiBC;AAED,SAAgB,eAAe,CAC7B,EAAa,EACb,GAAW,EACX,OAAwB,EAAE,CAAC,IAAI,CAAC,YAAY;IAE5C,IAAI,CAAC,IAAI;QAAE,OAAM;IACjB,GAAG,GAAG,gBAAgB,GAAG,EAAE,CAAA;IAC3B,IAAI,IAAI,KAAK,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;IACvC,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1B,CAAC;AATD,0CASC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/applicability.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/applicability.d.ts new file mode 100644 index 000000000..165d375dc --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/applicability.d.ts @@ -0,0 +1,6 @@ +import type { AnySchemaObject } from "../../types"; +import type { SchemaObjCxt } from ".."; +import type { JSONType, RuleGroup, Rule } from "../rules"; +export declare function schemaHasRulesForType({ schema, self }: SchemaObjCxt, type: JSONType): boolean | undefined; +export declare function shouldUseGroup(schema: AnySchemaObject, group: RuleGroup): boolean; +export declare function shouldUseRule(schema: AnySchemaObject, rule: Rule): boolean | undefined; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/applicability.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/applicability.js new file mode 100644 index 000000000..6187dbbee --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/applicability.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = void 0; +function schemaHasRulesForType({ schema, self }, type) { + const group = self.RULES.types[type]; + return group && group !== true && shouldUseGroup(schema, group); +} +exports.schemaHasRulesForType = schemaHasRulesForType; +function shouldUseGroup(schema, group) { + return group.rules.some((rule) => shouldUseRule(schema, rule)); +} +exports.shouldUseGroup = shouldUseGroup; +function shouldUseRule(schema, rule) { + var _a; + return (schema[rule.keyword] !== undefined || + ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== undefined))); +} +exports.shouldUseRule = shouldUseRule; +//# sourceMappingURL=applicability.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/applicability.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/applicability.js.map new file mode 100644 index 000000000..450cfe75a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/applicability.js.map @@ -0,0 +1 @@ +{"version":3,"file":"applicability.js","sourceRoot":"","sources":["../../../lib/compile/validate/applicability.ts"],"names":[],"mappings":";;;AAIA,SAAgB,qBAAqB,CACnC,EAAC,MAAM,EAAE,IAAI,EAAe,EAC5B,IAAc;IAEd,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACpC,OAAO,KAAK,IAAI,KAAK,KAAK,IAAI,IAAI,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;AACjE,CAAC;AAND,sDAMC;AAED,SAAgB,cAAc,CAAC,MAAuB,EAAE,KAAgB;IACtE,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;AAChE,CAAC;AAFD,wCAEC;AAED,SAAgB,aAAa,CAAC,MAAuB,EAAE,IAAU;;IAC/D,OAAO,CACL,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,SAAS;SAClC,MAAA,IAAI,CAAC,UAAU,CAAC,UAAU,0CAAE,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,SAAS,CAAC,CAAA,CACrE,CAAA;AACH,CAAC;AALD,sCAKC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/boolSchema.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/boolSchema.d.ts new file mode 100644 index 000000000..0ce795201 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/boolSchema.d.ts @@ -0,0 +1,4 @@ +import type { SchemaCxt } from ".."; +import { Name } from "../codegen"; +export declare function topBoolOrEmptySchema(it: SchemaCxt): void; +export declare function boolOrEmptySchema(it: SchemaCxt, valid: Name): void; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/boolSchema.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/boolSchema.js new file mode 100644 index 000000000..8eeb7b5ee --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/boolSchema.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = void 0; +const errors_1 = require("../errors"); +const codegen_1 = require("../codegen"); +const names_1 = require("../names"); +const boolError = { + message: "boolean schema is false", +}; +function topBoolOrEmptySchema(it) { + const { gen, schema, validateName } = it; + if (schema === false) { + falseSchemaError(it, false); + } + else if (typeof schema == "object" && schema.$async === true) { + gen.return(names_1.default.data); + } + else { + gen.assign((0, codegen_1._) `${validateName}.errors`, null); + gen.return(true); + } +} +exports.topBoolOrEmptySchema = topBoolOrEmptySchema; +function boolOrEmptySchema(it, valid) { + const { gen, schema } = it; + if (schema === false) { + gen.var(valid, false); // TODO var + falseSchemaError(it); + } + else { + gen.var(valid, true); // TODO var + } +} +exports.boolOrEmptySchema = boolOrEmptySchema; +function falseSchemaError(it, overrideAllErrors) { + const { gen, data } = it; + // TODO maybe some other interface should be used for non-keyword validation errors... + const cxt = { + gen, + keyword: "false schema", + data, + schema: false, + schemaCode: false, + schemaValue: false, + params: {}, + it, + }; + (0, errors_1.reportError)(cxt, boolError, undefined, overrideAllErrors); +} +//# sourceMappingURL=boolSchema.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/boolSchema.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/boolSchema.js.map new file mode 100644 index 000000000..4aa6c99a6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/boolSchema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"boolSchema.js","sourceRoot":"","sources":["../../../lib/compile/validate/boolSchema.ts"],"names":[],"mappings":";;;AAEA,sCAAqC;AACrC,wCAAkC;AAClC,oCAAwB;AAExB,MAAM,SAAS,GAA2B;IACxC,OAAO,EAAE,yBAAyB;CACnC,CAAA;AAED,SAAgB,oBAAoB,CAAC,EAAa;IAChD,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAC,GAAG,EAAE,CAAA;IACtC,IAAI,MAAM,KAAK,KAAK,EAAE;QACpB,gBAAgB,CAAC,EAAE,EAAE,KAAK,CAAC,CAAA;KAC5B;SAAM,IAAI,OAAO,MAAM,IAAI,QAAQ,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,EAAE;QAC9D,GAAG,CAAC,MAAM,CAAC,eAAC,CAAC,IAAI,CAAC,CAAA;KACnB;SAAM;QACL,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,YAAY,SAAS,EAAE,IAAI,CAAC,CAAA;QAC3C,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;KACjB;AACH,CAAC;AAVD,oDAUC;AAED,SAAgB,iBAAiB,CAAC,EAAa,EAAE,KAAW;IAC1D,MAAM,EAAC,GAAG,EAAE,MAAM,EAAC,GAAG,EAAE,CAAA;IACxB,IAAI,MAAM,KAAK,KAAK,EAAE;QACpB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA,CAAC,WAAW;QACjC,gBAAgB,CAAC,EAAE,CAAC,CAAA;KACrB;SAAM;QACL,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA,CAAC,WAAW;KACjC;AACH,CAAC;AARD,8CAQC;AAED,SAAS,gBAAgB,CAAC,EAAa,EAAE,iBAA2B;IAClE,MAAM,EAAC,GAAG,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IACtB,sFAAsF;IACtF,MAAM,GAAG,GAAoB;QAC3B,GAAG;QACH,OAAO,EAAE,cAAc;QACvB,IAAI;QACJ,MAAM,EAAE,KAAK;QACb,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,KAAK;QAClB,MAAM,EAAE,EAAE;QACV,EAAE;KACH,CAAA;IACD,IAAA,oBAAW,EAAC,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAiB,CAAC,CAAA;AAC3D,CAAC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/dataType.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/dataType.d.ts new file mode 100644 index 000000000..65c1268ec --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/dataType.d.ts @@ -0,0 +1,17 @@ +import type { ErrorObject, AnySchemaObject } from "../../types"; +import type { SchemaObjCxt } from ".."; +import { JSONType } from "../rules"; +import { Code, Name } from "../codegen"; +export declare enum DataType { + Correct = 0, + Wrong = 1 +} +export declare function getSchemaTypes(schema: AnySchemaObject): JSONType[]; +export declare function getJSONTypes(ts: unknown | unknown[]): JSONType[]; +export declare function coerceAndCheckDataType(it: SchemaObjCxt, types: JSONType[]): boolean; +export declare function checkDataType(dataType: JSONType, data: Name, strictNums?: boolean | "log", correct?: DataType): Code; +export declare function checkDataTypes(dataTypes: JSONType[], data: Name, strictNums?: boolean | "log", correct?: DataType): Code; +export declare type TypeError = ErrorObject<"type", { + type: string; +}>; +export declare function reportTypeError(it: SchemaObjCxt): void; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/dataType.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/dataType.js new file mode 100644 index 000000000..1732d4666 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/dataType.js @@ -0,0 +1,202 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = void 0; +const rules_1 = require("../rules"); +const applicability_1 = require("./applicability"); +const errors_1 = require("../errors"); +const codegen_1 = require("../codegen"); +const util_1 = require("../util"); +var DataType; +(function (DataType) { + DataType[DataType["Correct"] = 0] = "Correct"; + DataType[DataType["Wrong"] = 1] = "Wrong"; +})(DataType = exports.DataType || (exports.DataType = {})); +function getSchemaTypes(schema) { + const types = getJSONTypes(schema.type); + const hasNull = types.includes("null"); + if (hasNull) { + if (schema.nullable === false) + throw new Error("type: null contradicts nullable: false"); + } + else { + if (!types.length && schema.nullable !== undefined) { + throw new Error('"nullable" cannot be used without "type"'); + } + if (schema.nullable === true) + types.push("null"); + } + return types; +} +exports.getSchemaTypes = getSchemaTypes; +function getJSONTypes(ts) { + const types = Array.isArray(ts) ? ts : ts ? [ts] : []; + if (types.every(rules_1.isJSONType)) + return types; + throw new Error("type must be JSONType or JSONType[]: " + types.join(",")); +} +exports.getJSONTypes = getJSONTypes; +function coerceAndCheckDataType(it, types) { + const { gen, data, opts } = it; + const coerceTo = coerceToTypes(types, opts.coerceTypes); + const checkTypes = types.length > 0 && + !(coerceTo.length === 0 && types.length === 1 && (0, applicability_1.schemaHasRulesForType)(it, types[0])); + if (checkTypes) { + const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong); + gen.if(wrongType, () => { + if (coerceTo.length) + coerceData(it, types, coerceTo); + else + reportTypeError(it); + }); + } + return checkTypes; +} +exports.coerceAndCheckDataType = coerceAndCheckDataType; +const COERCIBLE = new Set(["string", "number", "integer", "boolean", "null"]); +function coerceToTypes(types, coerceTypes) { + return coerceTypes + ? types.filter((t) => COERCIBLE.has(t) || (coerceTypes === "array" && t === "array")) + : []; +} +function coerceData(it, types, coerceTo) { + const { gen, data, opts } = it; + const dataType = gen.let("dataType", (0, codegen_1._) `typeof ${data}`); + const coerced = gen.let("coerced", (0, codegen_1._) `undefined`); + if (opts.coerceTypes === "array") { + gen.if((0, codegen_1._) `${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => gen + .assign(data, (0, codegen_1._) `${data}[0]`) + .assign(dataType, (0, codegen_1._) `typeof ${data}`) + .if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data))); + } + gen.if((0, codegen_1._) `${coerced} !== undefined`); + for (const t of coerceTo) { + if (COERCIBLE.has(t) || (t === "array" && opts.coerceTypes === "array")) { + coerceSpecificType(t); + } + } + gen.else(); + reportTypeError(it); + gen.endIf(); + gen.if((0, codegen_1._) `${coerced} !== undefined`, () => { + gen.assign(data, coerced); + assignParentData(it, coerced); + }); + function coerceSpecificType(t) { + switch (t) { + case "string": + gen + .elseIf((0, codegen_1._) `${dataType} == "number" || ${dataType} == "boolean"`) + .assign(coerced, (0, codegen_1._) `"" + ${data}`) + .elseIf((0, codegen_1._) `${data} === null`) + .assign(coerced, (0, codegen_1._) `""`); + return; + case "number": + gen + .elseIf((0, codegen_1._) `${dataType} == "boolean" || ${data} === null + || (${dataType} == "string" && ${data} && ${data} == +${data})`) + .assign(coerced, (0, codegen_1._) `+${data}`); + return; + case "integer": + gen + .elseIf((0, codegen_1._) `${dataType} === "boolean" || ${data} === null + || (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))`) + .assign(coerced, (0, codegen_1._) `+${data}`); + return; + case "boolean": + gen + .elseIf((0, codegen_1._) `${data} === "false" || ${data} === 0 || ${data} === null`) + .assign(coerced, false) + .elseIf((0, codegen_1._) `${data} === "true" || ${data} === 1`) + .assign(coerced, true); + return; + case "null": + gen.elseIf((0, codegen_1._) `${data} === "" || ${data} === 0 || ${data} === false`); + gen.assign(coerced, null); + return; + case "array": + gen + .elseIf((0, codegen_1._) `${dataType} === "string" || ${dataType} === "number" + || ${dataType} === "boolean" || ${data} === null`) + .assign(coerced, (0, codegen_1._) `[${data}]`); + } + } +} +function assignParentData({ gen, parentData, parentDataProperty }, expr) { + // TODO use gen.property + gen.if((0, codegen_1._) `${parentData} !== undefined`, () => gen.assign((0, codegen_1._) `${parentData}[${parentDataProperty}]`, expr)); +} +function checkDataType(dataType, data, strictNums, correct = DataType.Correct) { + const EQ = correct === DataType.Correct ? codegen_1.operators.EQ : codegen_1.operators.NEQ; + let cond; + switch (dataType) { + case "null": + return (0, codegen_1._) `${data} ${EQ} null`; + case "array": + cond = (0, codegen_1._) `Array.isArray(${data})`; + break; + case "object": + cond = (0, codegen_1._) `${data} && typeof ${data} == "object" && !Array.isArray(${data})`; + break; + case "integer": + cond = numCond((0, codegen_1._) `!(${data} % 1) && !isNaN(${data})`); + break; + case "number": + cond = numCond(); + break; + default: + return (0, codegen_1._) `typeof ${data} ${EQ} ${dataType}`; + } + return correct === DataType.Correct ? cond : (0, codegen_1.not)(cond); + function numCond(_cond = codegen_1.nil) { + return (0, codegen_1.and)((0, codegen_1._) `typeof ${data} == "number"`, _cond, strictNums ? (0, codegen_1._) `isFinite(${data})` : codegen_1.nil); + } +} +exports.checkDataType = checkDataType; +function checkDataTypes(dataTypes, data, strictNums, correct) { + if (dataTypes.length === 1) { + return checkDataType(dataTypes[0], data, strictNums, correct); + } + let cond; + const types = (0, util_1.toHash)(dataTypes); + if (types.array && types.object) { + const notObj = (0, codegen_1._) `typeof ${data} != "object"`; + cond = types.null ? notObj : (0, codegen_1._) `!${data} || ${notObj}`; + delete types.null; + delete types.array; + delete types.object; + } + else { + cond = codegen_1.nil; + } + if (types.number) + delete types.integer; + for (const t in types) + cond = (0, codegen_1.and)(cond, checkDataType(t, data, strictNums, correct)); + return cond; +} +exports.checkDataTypes = checkDataTypes; +const typeError = { + message: ({ schema }) => `must be ${schema}`, + params: ({ schema, schemaValue }) => typeof schema == "string" ? (0, codegen_1._) `{type: ${schema}}` : (0, codegen_1._) `{type: ${schemaValue}}`, +}; +function reportTypeError(it) { + const cxt = getTypeErrorContext(it); + (0, errors_1.reportError)(cxt, typeError); +} +exports.reportTypeError = reportTypeError; +function getTypeErrorContext(it) { + const { gen, data, schema } = it; + const schemaCode = (0, util_1.schemaRefOrVal)(it, schema, "type"); + return { + gen, + keyword: "type", + data, + schema: schema.type, + schemaCode, + schemaValue: schemaCode, + parentSchema: schema, + params: {}, + it, + }; +} +//# sourceMappingURL=dataType.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/dataType.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/dataType.js.map new file mode 100644 index 000000000..f19c40bc9 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/dataType.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dataType.js","sourceRoot":"","sources":["../../../lib/compile/validate/dataType.ts"],"names":[],"mappings":";;;AAOA,oCAA6C;AAC7C,mDAAqD;AACrD,sCAAqC;AACrC,wCAAkE;AAClE,kCAA8C;AAE9C,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,CAAA;IACrD,OAAO;QACL,GAAG;QACH,OAAO,EAAE,MAAM;QACf,IAAI;QACJ,MAAM,EAAE,MAAM,CAAC,IAAI;QACnB,UAAU;QACV,WAAW,EAAE,UAAU;QACvB,YAAY,EAAE,MAAM;QACpB,MAAM,EAAE,EAAE;QACV,EAAE;KACH,CAAA;AACH,CAAC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/defaults.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/defaults.d.ts new file mode 100644 index 000000000..02ba453b2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/defaults.d.ts @@ -0,0 +1,2 @@ +import type { SchemaObjCxt } from ".."; +export declare function assignDefaults(it: SchemaObjCxt, ty?: string): void; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/defaults.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/defaults.js new file mode 100644 index 000000000..cd9c42d9a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/defaults.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.assignDefaults = void 0; +const codegen_1 = require("../codegen"); +const util_1 = require("../util"); +function assignDefaults(it, ty) { + const { properties, items } = it.schema; + if (ty === "object" && properties) { + for (const key in properties) { + assignDefault(it, key, properties[key].default); + } + } + else if (ty === "array" && Array.isArray(items)) { + items.forEach((sch, i) => assignDefault(it, i, sch.default)); + } +} +exports.assignDefaults = assignDefaults; +function assignDefault(it, prop, defaultValue) { + const { gen, compositeRule, data, opts } = it; + if (defaultValue === undefined) + return; + const childData = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(prop)}`; + if (compositeRule) { + (0, util_1.checkStrictMode)(it, `default is ignored for: ${childData}`); + return; + } + let condition = (0, codegen_1._) `${childData} === undefined`; + if (opts.useDefaults === "empty") { + condition = (0, codegen_1._) `${condition} || ${childData} === null || ${childData} === ""`; + } + // `${childData} === undefined` + + // (opts.useDefaults === "empty" ? ` || ${childData} === null || ${childData} === ""` : "") + gen.if(condition, (0, codegen_1._) `${childData} = ${(0, codegen_1.stringify)(defaultValue)}`); +} +//# sourceMappingURL=defaults.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/defaults.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/defaults.js.map new file mode 100644 index 000000000..c435d0578 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/defaults.js.map @@ -0,0 +1 @@ +{"version":3,"file":"defaults.js","sourceRoot":"","sources":["../../../lib/compile/validate/defaults.ts"],"names":[],"mappings":";;;AACA,wCAAoD;AACpD,kCAAuC;AAEvC,SAAgB,cAAc,CAAC,EAAgB,EAAE,EAAW;IAC1D,MAAM,EAAC,UAAU,EAAE,KAAK,EAAC,GAAG,EAAE,CAAC,MAAM,CAAA;IACrC,IAAI,EAAE,KAAK,QAAQ,IAAI,UAAU,EAAE;QACjC,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE;YAC5B,aAAa,CAAC,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAA;SAChD;KACF;SAAM,IAAI,EAAE,KAAK,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAS,EAAE,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;KACrE;AACH,CAAC;AATD,wCASC;AAED,SAAS,aAAa,CAAC,EAAgB,EAAE,IAAqB,EAAE,YAAqB;IACnF,MAAM,EAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;IAC3C,IAAI,YAAY,KAAK,SAAS;QAAE,OAAM;IACtC,MAAM,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,GAAG,IAAA,qBAAW,EAAC,IAAI,CAAC,EAAE,CAAA;IAChD,IAAI,aAAa,EAAE;QACjB,IAAA,sBAAe,EAAC,EAAE,EAAE,2BAA2B,SAAS,EAAE,CAAC,CAAA;QAC3D,OAAM;KACP;IAED,IAAI,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,SAAS,gBAAgB,CAAA;IAC7C,IAAI,IAAI,CAAC,WAAW,KAAK,OAAO,EAAE;QAChC,SAAS,GAAG,IAAA,WAAC,EAAA,GAAG,SAAS,OAAO,SAAS,gBAAgB,SAAS,SAAS,CAAA;KAC5E;IACD,iCAAiC;IACjC,2FAA2F;IAC3F,GAAG,CAAC,EAAE,CAAC,SAAS,EAAE,IAAA,WAAC,EAAA,GAAG,SAAS,MAAM,IAAA,mBAAS,EAAC,YAAY,CAAC,EAAE,CAAC,CAAA;AACjE,CAAC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/index.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/index.d.ts new file mode 100644 index 000000000..6c533ed72 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/index.d.ts @@ -0,0 +1,42 @@ +import type { AddedKeywordDefinition, AnySchemaObject, KeywordErrorCxt, KeywordCxtParams } from "../../types"; +import type { SchemaCxt, SchemaObjCxt } from ".."; +import { SubschemaArgs } from "./subschema"; +import { Code, Name, CodeGen } from "../codegen"; +import type { JSONType } from "../rules"; +import { ErrorPaths } from "../errors"; +export declare function validateFunctionCode(it: SchemaCxt): void; +export declare class KeywordCxt implements KeywordErrorCxt { + readonly gen: CodeGen; + readonly allErrors?: boolean; + readonly keyword: string; + readonly data: Name; + readonly $data?: string | false; + schema: any; + readonly schemaValue: Code | number | boolean; + readonly schemaCode: Code | number | boolean; + readonly schemaType: JSONType[]; + readonly parentSchema: AnySchemaObject; + readonly errsCount?: Name; + params: KeywordCxtParams; + readonly it: SchemaObjCxt; + readonly def: AddedKeywordDefinition; + constructor(it: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string); + result(condition: Code, successAction?: () => void, failAction?: () => void): void; + failResult(condition: Code, successAction?: () => void, failAction?: () => void): void; + pass(condition: Code, failAction?: () => void): void; + fail(condition?: Code): void; + fail$data(condition: Code): void; + error(append?: boolean, errorParams?: KeywordCxtParams, errorPaths?: ErrorPaths): void; + private _error; + $dataError(): void; + reset(): void; + ok(cond: Code | boolean): void; + setParams(obj: KeywordCxtParams, assign?: true): void; + block$data(valid: Name, codeBlock: () => void, $dataValid?: Code): void; + check$data(valid?: Name, $dataValid?: Code): void; + invalid$data(): Code; + subschema(appl: SubschemaArgs, valid: Name): SchemaCxt; + mergeEvaluated(schemaCxt: SchemaCxt, toName?: typeof Name): void; + mergeValidEvaluated(schemaCxt: SchemaCxt, valid: Name): boolean | void; +} +export declare function getData($data: string, { dataLevel, dataNames, dataPathArr }: SchemaCxt): Code | number; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/index.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/index.js new file mode 100644 index 000000000..fffcd5f0c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/index.js @@ -0,0 +1,510 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getData = exports.KeywordCxt = exports.validateFunctionCode = void 0; +const boolSchema_1 = require("./boolSchema"); +const dataType_1 = require("./dataType"); +const applicability_1 = require("./applicability"); +const dataType_2 = require("./dataType"); +const defaults_1 = require("./defaults"); +const keyword_1 = require("./keyword"); +const subschema_1 = require("./subschema"); +const codegen_1 = require("../codegen"); +const names_1 = require("../names"); +const resolve_1 = require("../resolve"); +const util_1 = require("../util"); +const errors_1 = require("../errors"); +// schema compilation - generates validation function, subschemaCode (below) is used for subschemas +function validateFunctionCode(it) { + if (isSchemaObj(it)) { + checkKeywords(it); + if (schemaCxtHasRules(it)) { + topSchemaObjCode(it); + return; + } + } + validateFunction(it, () => (0, boolSchema_1.topBoolOrEmptySchema)(it)); +} +exports.validateFunctionCode = validateFunctionCode; +function validateFunction({ gen, validateName, schema, schemaEnv, opts }, body) { + if (opts.code.es5) { + gen.func(validateName, (0, codegen_1._) `${names_1.default.data}, ${names_1.default.valCxt}`, schemaEnv.$async, () => { + gen.code((0, codegen_1._) `"use strict"; ${funcSourceUrl(schema, opts)}`); + destructureValCxtES5(gen, opts); + gen.code(body); + }); + } + else { + gen.func(validateName, (0, codegen_1._) `${names_1.default.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => gen.code(funcSourceUrl(schema, opts)).code(body)); + } +} +function destructureValCxt(opts) { + return (0, codegen_1._) `{${names_1.default.instancePath}="", ${names_1.default.parentData}, ${names_1.default.parentDataProperty}, ${names_1.default.rootData}=${names_1.default.data}${opts.dynamicRef ? (0, codegen_1._) `, ${names_1.default.dynamicAnchors}={}` : codegen_1.nil}}={}`; +} +function destructureValCxtES5(gen, opts) { + gen.if(names_1.default.valCxt, () => { + gen.var(names_1.default.instancePath, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.instancePath}`); + gen.var(names_1.default.parentData, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.parentData}`); + gen.var(names_1.default.parentDataProperty, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.parentDataProperty}`); + gen.var(names_1.default.rootData, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.rootData}`); + if (opts.dynamicRef) + gen.var(names_1.default.dynamicAnchors, (0, codegen_1._) `${names_1.default.valCxt}.${names_1.default.dynamicAnchors}`); + }, () => { + gen.var(names_1.default.instancePath, (0, codegen_1._) `""`); + gen.var(names_1.default.parentData, (0, codegen_1._) `undefined`); + gen.var(names_1.default.parentDataProperty, (0, codegen_1._) `undefined`); + gen.var(names_1.default.rootData, names_1.default.data); + if (opts.dynamicRef) + gen.var(names_1.default.dynamicAnchors, (0, codegen_1._) `{}`); + }); +} +function topSchemaObjCode(it) { + const { schema, opts, gen } = it; + validateFunction(it, () => { + if (opts.$comment && schema.$comment) + commentKeyword(it); + checkNoDefault(it); + gen.let(names_1.default.vErrors, null); + gen.let(names_1.default.errors, 0); + if (opts.unevaluated) + resetEvaluated(it); + typeAndKeywords(it); + returnResults(it); + }); + return; +} +function resetEvaluated(it) { + // TODO maybe some hook to execute it in the end to check whether props/items are Name, as in assignEvaluated + const { gen, validateName } = it; + it.evaluated = gen.const("evaluated", (0, codegen_1._) `${validateName}.evaluated`); + gen.if((0, codegen_1._) `${it.evaluated}.dynamicProps`, () => gen.assign((0, codegen_1._) `${it.evaluated}.props`, (0, codegen_1._) `undefined`)); + gen.if((0, codegen_1._) `${it.evaluated}.dynamicItems`, () => gen.assign((0, codegen_1._) `${it.evaluated}.items`, (0, codegen_1._) `undefined`)); +} +function funcSourceUrl(schema, opts) { + const schId = typeof schema == "object" && schema[opts.schemaId]; + return schId && (opts.code.source || opts.code.process) ? (0, codegen_1._) `/*# sourceURL=${schId} */` : codegen_1.nil; +} +// schema compilation - this function is used recursively to generate code for sub-schemas +function subschemaCode(it, valid) { + if (isSchemaObj(it)) { + checkKeywords(it); + if (schemaCxtHasRules(it)) { + subSchemaObjCode(it, valid); + return; + } + } + (0, boolSchema_1.boolOrEmptySchema)(it, valid); +} +function schemaCxtHasRules({ schema, self }) { + if (typeof schema == "boolean") + return !schema; + for (const key in schema) + if (self.RULES.all[key]) + return true; + return false; +} +function isSchemaObj(it) { + return typeof it.schema != "boolean"; +} +function subSchemaObjCode(it, valid) { + const { schema, gen, opts } = it; + if (opts.$comment && schema.$comment) + commentKeyword(it); + updateContext(it); + checkAsyncSchema(it); + const errsCount = gen.const("_errs", names_1.default.errors); + typeAndKeywords(it, errsCount); + // TODO var + gen.var(valid, (0, codegen_1._) `${errsCount} === ${names_1.default.errors}`); +} +function checkKeywords(it) { + (0, util_1.checkUnknownRules)(it); + checkRefsAndKeywords(it); +} +function typeAndKeywords(it, errsCount) { + if (it.opts.jtd) + return schemaKeywords(it, [], false, errsCount); + const types = (0, dataType_1.getSchemaTypes)(it.schema); + const checkedTypes = (0, dataType_1.coerceAndCheckDataType)(it, types); + schemaKeywords(it, types, !checkedTypes, errsCount); +} +function checkRefsAndKeywords(it) { + const { schema, errSchemaPath, opts, self } = it; + if (schema.$ref && opts.ignoreKeywordsWithRef && (0, util_1.schemaHasRulesButRef)(schema, self.RULES)) { + self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`); + } +} +function checkNoDefault(it) { + const { schema, opts } = it; + if (schema.default !== undefined && opts.useDefaults && opts.strictSchema) { + (0, util_1.checkStrictMode)(it, "default is ignored in the schema root"); + } +} +function updateContext(it) { + const schId = it.schema[it.opts.schemaId]; + if (schId) + it.baseId = (0, resolve_1.resolveUrl)(it.opts.uriResolver, it.baseId, schId); +} +function checkAsyncSchema(it) { + if (it.schema.$async && !it.schemaEnv.$async) + throw new Error("async schema in sync schema"); +} +function commentKeyword({ gen, schemaEnv, schema, errSchemaPath, opts }) { + const msg = schema.$comment; + if (opts.$comment === true) { + gen.code((0, codegen_1._) `${names_1.default.self}.logger.log(${msg})`); + } + else if (typeof opts.$comment == "function") { + const schemaPath = (0, codegen_1.str) `${errSchemaPath}/$comment`; + const rootName = gen.scopeValue("root", { ref: schemaEnv.root }); + gen.code((0, codegen_1._) `${names_1.default.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`); + } +} +function returnResults(it) { + const { gen, schemaEnv, validateName, ValidationError, opts } = it; + if (schemaEnv.$async) { + // TODO assign unevaluated + gen.if((0, codegen_1._) `${names_1.default.errors} === 0`, () => gen.return(names_1.default.data), () => gen.throw((0, codegen_1._) `new ${ValidationError}(${names_1.default.vErrors})`)); + } + else { + gen.assign((0, codegen_1._) `${validateName}.errors`, names_1.default.vErrors); + if (opts.unevaluated) + assignEvaluated(it); + gen.return((0, codegen_1._) `${names_1.default.errors} === 0`); + } +} +function assignEvaluated({ gen, evaluated, props, items }) { + if (props instanceof codegen_1.Name) + gen.assign((0, codegen_1._) `${evaluated}.props`, props); + if (items instanceof codegen_1.Name) + gen.assign((0, codegen_1._) `${evaluated}.items`, items); +} +function schemaKeywords(it, types, typeErrors, errsCount) { + const { gen, schema, data, allErrors, opts, self } = it; + const { RULES } = self; + if (schema.$ref && (opts.ignoreKeywordsWithRef || !(0, util_1.schemaHasRulesButRef)(schema, RULES))) { + gen.block(() => keywordCode(it, "$ref", RULES.all.$ref.definition)); // TODO typecast + return; + } + if (!opts.jtd) + checkStrictTypes(it, types); + gen.block(() => { + for (const group of RULES.rules) + groupKeywords(group); + groupKeywords(RULES.post); + }); + function groupKeywords(group) { + if (!(0, applicability_1.shouldUseGroup)(schema, group)) + return; + if (group.type) { + gen.if((0, dataType_2.checkDataType)(group.type, data, opts.strictNumbers)); + iterateKeywords(it, group); + if (types.length === 1 && types[0] === group.type && typeErrors) { + gen.else(); + (0, dataType_2.reportTypeError)(it); + } + gen.endIf(); + } + else { + iterateKeywords(it, group); + } + // TODO make it "ok" call? + if (!allErrors) + gen.if((0, codegen_1._) `${names_1.default.errors} === ${errsCount || 0}`); + } +} +function iterateKeywords(it, group) { + const { gen, schema, opts: { useDefaults }, } = it; + if (useDefaults) + (0, defaults_1.assignDefaults)(it, group.type); + gen.block(() => { + for (const rule of group.rules) { + if ((0, applicability_1.shouldUseRule)(schema, rule)) { + keywordCode(it, rule.keyword, rule.definition, group.type); + } + } + }); +} +function checkStrictTypes(it, types) { + if (it.schemaEnv.meta || !it.opts.strictTypes) + return; + checkContextTypes(it, types); + if (!it.opts.allowUnionTypes) + checkMultipleTypes(it, types); + checkKeywordTypes(it, it.dataTypes); +} +function checkContextTypes(it, types) { + if (!types.length) + return; + if (!it.dataTypes.length) { + it.dataTypes = types; + return; + } + types.forEach((t) => { + if (!includesType(it.dataTypes, t)) { + strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`); + } + }); + it.dataTypes = it.dataTypes.filter((t) => includesType(types, t)); +} +function checkMultipleTypes(it, ts) { + if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) { + strictTypesError(it, "use allowUnionTypes to allow union type keyword"); + } +} +function checkKeywordTypes(it, ts) { + const rules = it.self.RULES.all; + for (const keyword in rules) { + const rule = rules[keyword]; + if (typeof rule == "object" && (0, applicability_1.shouldUseRule)(it.schema, rule)) { + const { type } = rule.definition; + if (type.length && !type.some((t) => hasApplicableType(ts, t))) { + strictTypesError(it, `missing type "${type.join(",")}" for keyword "${keyword}"`); + } + } + } +} +function hasApplicableType(schTs, kwdT) { + return schTs.includes(kwdT) || (kwdT === "number" && schTs.includes("integer")); +} +function includesType(ts, t) { + return ts.includes(t) || (t === "integer" && ts.includes("number")); +} +function strictTypesError(it, msg) { + const schemaPath = it.schemaEnv.baseId + it.errSchemaPath; + msg += ` at "${schemaPath}" (strictTypes)`; + (0, util_1.checkStrictMode)(it, msg, it.opts.strictTypes); +} +class KeywordCxt { + constructor(it, def, keyword) { + (0, keyword_1.validateKeywordUsage)(it, def, keyword); + this.gen = it.gen; + this.allErrors = it.allErrors; + this.keyword = keyword; + this.data = it.data; + this.schema = it.schema[keyword]; + this.$data = def.$data && it.opts.$data && this.schema && this.schema.$data; + this.schemaValue = (0, util_1.schemaRefOrVal)(it, this.schema, keyword, this.$data); + this.schemaType = def.schemaType; + this.parentSchema = it.schema; + this.params = {}; + this.it = it; + this.def = def; + if (this.$data) { + this.schemaCode = it.gen.const("vSchema", getData(this.$data, it)); + } + else { + this.schemaCode = this.schemaValue; + if (!(0, keyword_1.validSchemaType)(this.schema, def.schemaType, def.allowUndefined)) { + throw new Error(`${keyword} value must be ${JSON.stringify(def.schemaType)}`); + } + } + if ("code" in def ? def.trackErrors : def.errors !== false) { + this.errsCount = it.gen.const("_errs", names_1.default.errors); + } + } + result(condition, successAction, failAction) { + this.failResult((0, codegen_1.not)(condition), successAction, failAction); + } + failResult(condition, successAction, failAction) { + this.gen.if(condition); + if (failAction) + failAction(); + else + this.error(); + if (successAction) { + this.gen.else(); + successAction(); + if (this.allErrors) + this.gen.endIf(); + } + else { + if (this.allErrors) + this.gen.endIf(); + else + this.gen.else(); + } + } + pass(condition, failAction) { + this.failResult((0, codegen_1.not)(condition), undefined, failAction); + } + fail(condition) { + if (condition === undefined) { + this.error(); + if (!this.allErrors) + this.gen.if(false); // this branch will be removed by gen.optimize + return; + } + this.gen.if(condition); + this.error(); + if (this.allErrors) + this.gen.endIf(); + else + this.gen.else(); + } + fail$data(condition) { + if (!this.$data) + return this.fail(condition); + const { schemaCode } = this; + this.fail((0, codegen_1._) `${schemaCode} !== undefined && (${(0, codegen_1.or)(this.invalid$data(), condition)})`); + } + error(append, errorParams, errorPaths) { + if (errorParams) { + this.setParams(errorParams); + this._error(append, errorPaths); + this.setParams({}); + return; + } + this._error(append, errorPaths); + } + _error(append, errorPaths) { + ; + (append ? errors_1.reportExtraError : errors_1.reportError)(this, this.def.error, errorPaths); + } + $dataError() { + (0, errors_1.reportError)(this, this.def.$dataError || errors_1.keyword$DataError); + } + reset() { + if (this.errsCount === undefined) + throw new Error('add "trackErrors" to keyword definition'); + (0, errors_1.resetErrorsCount)(this.gen, this.errsCount); + } + ok(cond) { + if (!this.allErrors) + this.gen.if(cond); + } + setParams(obj, assign) { + if (assign) + Object.assign(this.params, obj); + else + this.params = obj; + } + block$data(valid, codeBlock, $dataValid = codegen_1.nil) { + this.gen.block(() => { + this.check$data(valid, $dataValid); + codeBlock(); + }); + } + check$data(valid = codegen_1.nil, $dataValid = codegen_1.nil) { + if (!this.$data) + return; + const { gen, schemaCode, schemaType, def } = this; + gen.if((0, codegen_1.or)((0, codegen_1._) `${schemaCode} === undefined`, $dataValid)); + if (valid !== codegen_1.nil) + gen.assign(valid, true); + if (schemaType.length || def.validateSchema) { + gen.elseIf(this.invalid$data()); + this.$dataError(); + if (valid !== codegen_1.nil) + gen.assign(valid, false); + } + gen.else(); + } + invalid$data() { + const { gen, schemaCode, schemaType, def, it } = this; + return (0, codegen_1.or)(wrong$DataType(), invalid$DataSchema()); + function wrong$DataType() { + if (schemaType.length) { + /* istanbul ignore if */ + if (!(schemaCode instanceof codegen_1.Name)) + throw new Error("ajv implementation error"); + const st = Array.isArray(schemaType) ? schemaType : [schemaType]; + return (0, codegen_1._) `${(0, dataType_2.checkDataTypes)(st, schemaCode, it.opts.strictNumbers, dataType_2.DataType.Wrong)}`; + } + return codegen_1.nil; + } + function invalid$DataSchema() { + if (def.validateSchema) { + const validateSchemaRef = gen.scopeValue("validate$data", { ref: def.validateSchema }); // TODO value.code for standalone + return (0, codegen_1._) `!${validateSchemaRef}(${schemaCode})`; + } + return codegen_1.nil; + } + } + subschema(appl, valid) { + const subschema = (0, subschema_1.getSubschema)(this.it, appl); + (0, subschema_1.extendSubschemaData)(subschema, this.it, appl); + (0, subschema_1.extendSubschemaMode)(subschema, appl); + const nextContext = { ...this.it, ...subschema, items: undefined, props: undefined }; + subschemaCode(nextContext, valid); + return nextContext; + } + mergeEvaluated(schemaCxt, toName) { + const { it, gen } = this; + if (!it.opts.unevaluated) + return; + if (it.props !== true && schemaCxt.props !== undefined) { + it.props = util_1.mergeEvaluated.props(gen, schemaCxt.props, it.props, toName); + } + if (it.items !== true && schemaCxt.items !== undefined) { + it.items = util_1.mergeEvaluated.items(gen, schemaCxt.items, it.items, toName); + } + } + mergeValidEvaluated(schemaCxt, valid) { + const { it, gen } = this; + if (it.opts.unevaluated && (it.props !== true || it.items !== true)) { + gen.if(valid, () => this.mergeEvaluated(schemaCxt, codegen_1.Name)); + return true; + } + } +} +exports.KeywordCxt = KeywordCxt; +function keywordCode(it, keyword, def, ruleType) { + const cxt = new KeywordCxt(it, def, keyword); + if ("code" in def) { + def.code(cxt, ruleType); + } + else if (cxt.$data && def.validate) { + (0, keyword_1.funcKeywordCode)(cxt, def); + } + else if ("macro" in def) { + (0, keyword_1.macroKeywordCode)(cxt, def); + } + else if (def.compile || def.validate) { + (0, keyword_1.funcKeywordCode)(cxt, def); + } +} +const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/; +const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; +function getData($data, { dataLevel, dataNames, dataPathArr }) { + let jsonPointer; + let data; + if ($data === "") + return names_1.default.rootData; + if ($data[0] === "/") { + if (!JSON_POINTER.test($data)) + throw new Error(`Invalid JSON-pointer: ${$data}`); + jsonPointer = $data; + data = names_1.default.rootData; + } + else { + const matches = RELATIVE_JSON_POINTER.exec($data); + if (!matches) + throw new Error(`Invalid JSON-pointer: ${$data}`); + const up = +matches[1]; + jsonPointer = matches[2]; + if (jsonPointer === "#") { + if (up >= dataLevel) + throw new Error(errorMsg("property/index", up)); + return dataPathArr[dataLevel - up]; + } + if (up > dataLevel) + throw new Error(errorMsg("data", up)); + data = dataNames[dataLevel - up]; + if (!jsonPointer) + return data; + } + let expr = data; + const segments = jsonPointer.split("/"); + for (const segment of segments) { + if (segment) { + data = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)((0, util_1.unescapeJsonPointer)(segment))}`; + expr = (0, codegen_1._) `${expr} && ${data}`; + } + } + return expr; + function errorMsg(pointerType, up) { + return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}`; + } +} +exports.getData = getData; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/index.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/index.js.map new file mode 100644 index 000000000..b9ed9428e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/compile/validate/index.ts"],"names":[],"mappings":";;;AASA,6CAAoE;AACpE,yCAAiE;AACjE,mDAA6D;AAC7D,yCAAmF;AACnF,yCAAyC;AACzC,uCAAkG;AAClG,2CAAiG;AACjG,wCAAwF;AACxF,oCAAwB;AACxB,wCAAqC;AACrC,kCAOgB;AAEhB,sCAMkB;AAElB,mGAAmG;AACnG,SAAgB,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AAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAA;QACzD,IAAI,GAAG,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC,CAAA;QAChC,IAAI,CAAC,WAAW;YAAE,OAAO,IAAI,CAAA;KAC9B;IAED,IAAI,IAAI,GAAG,IAAI,CAAA;IACf,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACvC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;QAC9B,IAAI,OAAO,EAAE;YACX,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,GAAG,IAAA,qBAAW,EAAC,IAAA,0BAAmB,EAAC,OAAO,CAAC,CAAC,EAAE,CAAA;YAC7D,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,OAAO,IAAI,EAAE,CAAA;SAC7B;KACF;IACD,OAAO,IAAI,CAAA;IAEX,SAAS,QAAQ,CAAC,WAAmB,EAAE,EAAU;QAC/C,OAAO,iBAAiB,WAAW,IAAI,EAAE,gCAAgC,SAAS,EAAE,CAAA;IACtF,CAAC;AACH,CAAC;AAtCD,0BAsCC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/keyword.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/keyword.d.ts new file mode 100644 index 000000000..d15cee878 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/keyword.d.ts @@ -0,0 +1,8 @@ +import type { KeywordCxt } from "."; +import type { AddedKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition } from "../../types"; +import type { SchemaObjCxt } from ".."; +import type { JSONType } from "../rules"; +export declare function macroKeywordCode(cxt: KeywordCxt, def: MacroKeywordDefinition): void; +export declare function funcKeywordCode(cxt: KeywordCxt, def: FuncKeywordDefinition): void; +export declare function validSchemaType(schema: unknown, schemaType: JSONType[], allowUndefined?: boolean): boolean; +export declare function validateKeywordUsage({ schema, opts, self, errSchemaPath }: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string): void; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/keyword.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/keyword.js new file mode 100644 index 000000000..1109d3a45 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/keyword.js @@ -0,0 +1,124 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateKeywordUsage = exports.validSchemaType = exports.funcKeywordCode = exports.macroKeywordCode = void 0; +const codegen_1 = require("../codegen"); +const names_1 = require("../names"); +const code_1 = require("../../vocabularies/code"); +const errors_1 = require("../errors"); +function macroKeywordCode(cxt, def) { + const { gen, keyword, schema, parentSchema, it } = cxt; + const macroSchema = def.macro.call(it.self, schema, parentSchema, it); + const schemaRef = useKeyword(gen, keyword, macroSchema); + if (it.opts.validateSchema !== false) + it.self.validateSchema(macroSchema, true); + const valid = gen.name("valid"); + cxt.subschema({ + schema: macroSchema, + schemaPath: codegen_1.nil, + errSchemaPath: `${it.errSchemaPath}/${keyword}`, + topSchemaRef: schemaRef, + compositeRule: true, + }, valid); + cxt.pass(valid, () => cxt.error(true)); +} +exports.macroKeywordCode = macroKeywordCode; +function funcKeywordCode(cxt, def) { + var _a; + const { gen, keyword, schema, parentSchema, $data, it } = cxt; + checkAsyncKeyword(it, def); + const validate = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate; + const validateRef = useKeyword(gen, keyword, validate); + const valid = gen.let("valid"); + cxt.block$data(valid, validateKeyword); + cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid); + function validateKeyword() { + if (def.errors === false) { + assignValid(); + if (def.modifying) + modifyData(cxt); + reportErrs(() => cxt.error()); + } + else { + const ruleErrs = def.async ? validateAsync() : validateSync(); + if (def.modifying) + modifyData(cxt); + reportErrs(() => addErrs(cxt, ruleErrs)); + } + } + function validateAsync() { + const ruleErrs = gen.let("ruleErrs", null); + gen.try(() => assignValid((0, codegen_1._) `await `), (e) => gen.assign(valid, false).if((0, codegen_1._) `${e} instanceof ${it.ValidationError}`, () => gen.assign(ruleErrs, (0, codegen_1._) `${e}.errors`), () => gen.throw(e))); + return ruleErrs; + } + function validateSync() { + const validateErrs = (0, codegen_1._) `${validateRef}.errors`; + gen.assign(validateErrs, null); + assignValid(codegen_1.nil); + return validateErrs; + } + function assignValid(_await = def.async ? (0, codegen_1._) `await ` : codegen_1.nil) { + const passCxt = it.opts.passContext ? names_1.default.this : names_1.default.self; + const passSchema = !(("compile" in def && !$data) || def.schema === false); + gen.assign(valid, (0, codegen_1._) `${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying); + } + function reportErrs(errors) { + var _a; + gen.if((0, codegen_1.not)((_a = def.valid) !== null && _a !== void 0 ? _a : valid), errors); + } +} +exports.funcKeywordCode = funcKeywordCode; +function modifyData(cxt) { + const { gen, data, it } = cxt; + gen.if(it.parentData, () => gen.assign(data, (0, codegen_1._) `${it.parentData}[${it.parentDataProperty}]`)); +} +function addErrs(cxt, errs) { + const { gen } = cxt; + gen.if((0, codegen_1._) `Array.isArray(${errs})`, () => { + gen + .assign(names_1.default.vErrors, (0, codegen_1._) `${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`) + .assign(names_1.default.errors, (0, codegen_1._) `${names_1.default.vErrors}.length`); + (0, errors_1.extendErrors)(cxt); + }, () => cxt.error()); +} +function checkAsyncKeyword({ schemaEnv }, def) { + if (def.async && !schemaEnv.$async) + throw new Error("async keyword in sync schema"); +} +function useKeyword(gen, keyword, result) { + if (result === undefined) + throw new Error(`keyword "${keyword}" failed to compile`); + return gen.scopeValue("keyword", typeof result == "function" ? { ref: result } : { ref: result, code: (0, codegen_1.stringify)(result) }); +} +function validSchemaType(schema, schemaType, allowUndefined = false) { + // TODO add tests + return (!schemaType.length || + schemaType.some((st) => st === "array" + ? Array.isArray(schema) + : st === "object" + ? schema && typeof schema == "object" && !Array.isArray(schema) + : typeof schema == st || (allowUndefined && typeof schema == "undefined"))); +} +exports.validSchemaType = validSchemaType; +function validateKeywordUsage({ schema, opts, self, errSchemaPath }, def, keyword) { + /* istanbul ignore if */ + if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) { + throw new Error("ajv implementation error"); + } + const deps = def.dependencies; + if (deps === null || deps === void 0 ? void 0 : deps.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) { + throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`); + } + if (def.validateSchema) { + const valid = def.validateSchema(schema[keyword]); + if (!valid) { + const msg = `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + + self.errorsText(def.validateSchema.errors); + if (opts.validateSchema === "log") + self.logger.error(msg); + else + throw new Error(msg); + } + } +} +exports.validateKeywordUsage = validateKeywordUsage; +//# sourceMappingURL=keyword.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/keyword.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/keyword.js.map new file mode 100644 index 000000000..10d716d7e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/keyword.js.map @@ -0,0 +1 @@ +{"version":3,"file":"keyword.js","sourceRoot":"","sources":["../../../lib/compile/validate/keyword.ts"],"names":[],"mappings":";;;AAUA,wCAAsE;AACtE,oCAAwB;AAExB,kDAAwD;AACxD,sCAAsC;AAItC,SAAgB,gBAAgB,CAAC,GAAe,EAAE,GAA2B;IAC3E,MAAM,EAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IACpD,MAAM,WAAW,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,CAAC,CAAA;IACrE,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,EAAE,OAAO,EA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AA;QACjD,IAAI,CAAC,KAAK,EAAE;YACV,MAAM,GAAG,GACP,YAAY,OAAO,+BAA+B,aAAa,KAAK;gBACpE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;YAC5C,IAAI,IAAI,CAAC,cAAc,KAAK,KAAK;gBAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;;gBACpD,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAA;SAC1B;KACF;AACH,CAAC;AAzBD,oDAyBC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/subschema.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/subschema.d.ts new file mode 100644 index 000000000..8544271ab --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/subschema.d.ts @@ -0,0 +1,47 @@ +import type { AnySchema } from "../../types"; +import type { SchemaObjCxt } from ".."; +import { Code, Name } from "../codegen"; +import { Type } from "../util"; +import type { JSONType } from "../rules"; +export interface SubschemaContext { + schema: AnySchema; + schemaPath: Code; + errSchemaPath: string; + topSchemaRef?: Code; + errorPath?: Code; + dataLevel?: number; + dataTypes?: JSONType[]; + data?: Name; + parentData?: Name; + parentDataProperty?: Code | number; + dataNames?: Name[]; + dataPathArr?: (Code | number)[]; + propertyName?: Name; + jtdDiscriminator?: string; + jtdMetadata?: boolean; + compositeRule?: true; + createErrors?: boolean; + allErrors?: boolean; +} +export declare type SubschemaArgs = Partial<{ + keyword: string; + schemaProp: string | number; + schema: AnySchema; + schemaPath: Code; + errSchemaPath: string; + topSchemaRef: Code; + data: Name | Code; + dataProp: Code | string | number; + dataTypes: JSONType[]; + definedProperties: Set; + propertyName: Name; + dataPropType: Type; + jtdDiscriminator: string; + jtdMetadata: boolean; + compositeRule: true; + createErrors: boolean; + allErrors: boolean; +}>; +export declare function getSubschema(it: SchemaObjCxt, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }: SubschemaArgs): SubschemaContext; +export declare function extendSubschemaData(subschema: SubschemaContext, it: SchemaObjCxt, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }: SubschemaArgs): void; +export declare function extendSubschemaMode(subschema: SubschemaContext, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }: SubschemaArgs): void; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/subschema.js b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/subschema.js new file mode 100644 index 000000000..9de282869 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/subschema.js @@ -0,0 +1,81 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.extendSubschemaMode = exports.extendSubschemaData = exports.getSubschema = void 0; +const codegen_1 = require("../codegen"); +const util_1 = require("../util"); +function getSubschema(it, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }) { + if (keyword !== undefined && schema !== undefined) { + throw new Error('both "keyword" and "schema" passed, only one allowed'); + } + if (keyword !== undefined) { + const sch = it.schema[keyword]; + return schemaProp === undefined + ? { + schema: sch, + schemaPath: (0, codegen_1._) `${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}`, + } + : { + schema: sch[schemaProp], + schemaPath: (0, codegen_1._) `${it.schemaPath}${(0, codegen_1.getProperty)(keyword)}${(0, codegen_1.getProperty)(schemaProp)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}/${(0, util_1.escapeFragment)(schemaProp)}`, + }; + } + if (schema !== undefined) { + if (schemaPath === undefined || errSchemaPath === undefined || topSchemaRef === undefined) { + throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"'); + } + return { + schema, + schemaPath, + topSchemaRef, + errSchemaPath, + }; + } + throw new Error('either "keyword" or "schema" must be passed'); +} +exports.getSubschema = getSubschema; +function extendSubschemaData(subschema, it, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }) { + if (data !== undefined && dataProp !== undefined) { + throw new Error('both "data" and "dataProp" passed, only one allowed'); + } + const { gen } = it; + if (dataProp !== undefined) { + const { errorPath, dataPathArr, opts } = it; + const nextData = gen.let("data", (0, codegen_1._) `${it.data}${(0, codegen_1.getProperty)(dataProp)}`, true); + dataContextProps(nextData); + subschema.errorPath = (0, codegen_1.str) `${errorPath}${(0, util_1.getErrorPath)(dataProp, dpType, opts.jsPropertySyntax)}`; + subschema.parentDataProperty = (0, codegen_1._) `${dataProp}`; + subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty]; + } + if (data !== undefined) { + const nextData = data instanceof codegen_1.Name ? data : gen.let("data", data, true); // replaceable if used once? + dataContextProps(nextData); + if (propertyName !== undefined) + subschema.propertyName = propertyName; + // TODO something is possibly wrong here with not changing parentDataProperty and not appending dataPathArr + } + if (dataTypes) + subschema.dataTypes = dataTypes; + function dataContextProps(_nextData) { + subschema.data = _nextData; + subschema.dataLevel = it.dataLevel + 1; + subschema.dataTypes = []; + it.definedProperties = new Set(); + subschema.parentData = it.data; + subschema.dataNames = [...it.dataNames, _nextData]; + } +} +exports.extendSubschemaData = extendSubschemaData; +function extendSubschemaMode(subschema, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }) { + if (compositeRule !== undefined) + subschema.compositeRule = compositeRule; + if (createErrors !== undefined) + subschema.createErrors = createErrors; + if (allErrors !== undefined) + subschema.allErrors = allErrors; + subschema.jtdDiscriminator = jtdDiscriminator; // not inherited + subschema.jtdMetadata = jtdMetadata; // not inherited +} +exports.extendSubschemaMode = extendSubschemaMode; +//# sourceMappingURL=subschema.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/subschema.js.map b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/subschema.js.map new file mode 100644 index 000000000..a1b84d378 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/compile/validate/subschema.js.map @@ -0,0 +1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CAAA,CAAC,4BAA4B;QACvG,gBAAgB,CAAC,QAAQ,CAAC,CAAA;QAC1B,IAAI,YAAY,KAAK,SAAS;YAAE,SAAS,CAAC,YAAY,GAAG,YAAY,CAAA;QACrE,2GAA2G;KAC5G;IAED,IAAI,SAAS;QAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAA;IAE9C,SAAS,gBAAgB,CAAC,SAAe;QACvC,SAAS,CAAC,IAAI,GAAG,SAAS,CAAA;QAC1B,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC,SAAS,GAAG,CAAC,CAAA;QACtC,SAAS,CAAC,SAAS,GAAG,EAAE,CAAA;QACxB,EAAE,CAAC,iBAAiB,GAAG,IAAI,GAAG,EAAU,CAAA;QACxC,SAAS,CAAC,UAAU,GAAG,EAAE,CAAC,IAAI,CAAA;QAC9B,SAAS,CAAC,SAAS,GAAG,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;IACpD,CAAC;AACH,CAAC;AArCD,kDAqCC;AAED,SAAgB,mBAAmB,CACjC,SAA2B,EAC3B,EAAC,gBAAgB,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAgB;IAEtF,IAAI,aAAa,KAAK,SAAS;QAAE,SAAS,CAAC,aAAa,GAAG,aAAa,CAAA;IACxE,IAAI,YAAY,KAAK,SAAS;QAAE,SAAS,CAAC,YAAY,GAAG,YAAY,CAAA;IACrE,IAAI,SAAS,KAAK,SAAS;QAAE,SAAS,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5D,SAAS,CAAC,gBAAgB,GAAG,gBAAgB,CAAA,CAAC,gBAAgB;IAC9D,SAAS,CAAC,WAAW,GAAG,WAAW,CAAA,CAAC,gBAAgB;AACtD,CAAC;AATD,kDASC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/core.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/core.d.ts new file mode 100644 index 000000000..ac3979922 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/core.d.ts @@ -0,0 +1,173 @@ +export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, AnyValidateFunction, ErrorObject, ErrorNoParams, } from "./types"; +export { SchemaCxt, SchemaObjCxt } from "./compile"; +export interface Plugin { + (ajv: Ajv, options?: Opts): Ajv; + [prop: string]: any; +} +export { KeywordCxt } from "./compile/validate"; +export { DefinedError } from "./vocabularies/errors"; +export { JSONType } from "./compile/rules"; +export { JSONSchemaType } from "./types/json-schema"; +export { JTDSchemaType, SomeJTDSchemaType, JTDDataType } from "./types/jtd-schema"; +export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; +import type { Schema, AnySchema, AnySchemaObject, SchemaObject, AsyncSchema, Vocabulary, KeywordDefinition, AddedKeywordDefinition, AnyValidateFunction, ValidateFunction, AsyncValidateFunction, ErrorObject, Format, AddedFormat, RegExpEngine, UriResolver } from "./types"; +import type { JSONSchemaType } from "./types/json-schema"; +import type { JTDSchemaType, SomeJTDSchemaType, JTDDataType } from "./types/jtd-schema"; +import ValidationError from "./runtime/validation_error"; +import MissingRefError from "./compile/ref_error"; +import { ValidationRules } from "./compile/rules"; +import { SchemaEnv } from "./compile"; +import { Code, ValueScope } from "./compile/codegen"; +export declare type Options = CurrentOptions & DeprecatedOptions; +export interface CurrentOptions { + strict?: boolean | "log"; + strictSchema?: boolean | "log"; + strictNumbers?: boolean | "log"; + strictTypes?: boolean | "log"; + strictTuples?: boolean | "log"; + strictRequired?: boolean | "log"; + allowMatchingProperties?: boolean; + allowUnionTypes?: boolean; + validateFormats?: boolean; + $data?: boolean; + allErrors?: boolean; + verbose?: boolean; + discriminator?: boolean; + unicodeRegExp?: boolean; + timestamp?: "string" | "date"; + parseDate?: boolean; + allowDate?: boolean; + $comment?: true | ((comment: string, schemaPath?: string, rootSchema?: AnySchemaObject) => unknown); + formats?: { + [Name in string]?: Format; + }; + keywords?: Vocabulary; + schemas?: AnySchema[] | { + [Key in string]?: AnySchema; + }; + logger?: Logger | false; + loadSchema?: (uri: string) => Promise; + removeAdditional?: boolean | "all" | "failing"; + useDefaults?: boolean | "empty"; + coerceTypes?: boolean | "array"; + next?: boolean; + unevaluated?: boolean; + dynamicRef?: boolean; + schemaId?: "id" | "$id"; + jtd?: boolean; + meta?: SchemaObject | boolean; + defaultMeta?: string | AnySchemaObject; + validateSchema?: boolean | "log"; + addUsedSchema?: boolean; + inlineRefs?: boolean | number; + passContext?: boolean; + loopRequired?: number; + loopEnum?: number; + ownProperties?: boolean; + multipleOfPrecision?: number; + int32range?: boolean; + messages?: boolean; + code?: CodeOptions; + uriResolver?: UriResolver; +} +export interface CodeOptions { + es5?: boolean; + esm?: boolean; + lines?: boolean; + optimize?: boolean | number; + formats?: Code; + source?: boolean; + process?: (code: string, schema?: SchemaEnv) => string; + regExp?: RegExpEngine; +} +interface InstanceCodeOptions extends CodeOptions { + regExp: RegExpEngine; + optimize: number; +} +interface DeprecatedOptions { + /** @deprecated */ + ignoreKeywordsWithRef?: boolean; + /** @deprecated */ + jsPropertySyntax?: boolean; + /** @deprecated */ + unicode?: boolean; +} +declare type RequiredInstanceOptions = { + [K in "strictSchema" | "strictNumbers" | "strictTypes" | "strictTuples" | "strictRequired" | "inlineRefs" | "loopRequired" | "loopEnum" | "meta" | "messages" | "schemaId" | "addUsedSchema" | "validateSchema" | "validateFormats" | "int32range" | "unicodeRegExp" | "uriResolver"]: NonNullable; +} & { + code: InstanceCodeOptions; +}; +export declare type InstanceOptions = Options & RequiredInstanceOptions; +export interface Logger { + log(...args: unknown[]): unknown; + warn(...args: unknown[]): unknown; + error(...args: unknown[]): unknown; +} +export default class Ajv { + opts: InstanceOptions; + errors?: ErrorObject[] | null; + logger: Logger; + readonly scope: ValueScope; + readonly schemas: { + [Key in string]?: SchemaEnv; + }; + readonly refs: { + [Ref in string]?: SchemaEnv | string; + }; + readonly formats: { + [Name in string]?: AddedFormat; + }; + readonly RULES: ValidationRules; + readonly _compilations: Set; + private readonly _loading; + private readonly _cache; + private readonly _metaOpts; + static ValidationError: typeof ValidationError; + static MissingRefError: typeof MissingRefError; + constructor(opts?: Options); + _addVocabularies(): void; + _addDefaultMetaSchema(): void; + defaultMeta(): string | AnySchemaObject | undefined; + validate(schema: Schema | string, data: unknown): boolean; + validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise; + validate(schema: Schema | JSONSchemaType | string, data: unknown): data is T; + validate(schema: JTDSchemaType, data: unknown): data is T; + validate(schema: T, data: unknown): data is JTDDataType; + validate(schema: AsyncSchema, data: unknown | T): Promise; + validate(schemaKeyRef: AnySchema | string, data: unknown): data is T | Promise; + compile(schema: Schema | JSONSchemaType, _meta?: boolean): ValidateFunction; + compile(schema: JTDSchemaType, _meta?: boolean): ValidateFunction; + compile(schema: T, _meta?: boolean): ValidateFunction>; + compile(schema: AsyncSchema, _meta?: boolean): AsyncValidateFunction; + compile(schema: AnySchema, _meta?: boolean): AnyValidateFunction; + compileAsync(schema: SchemaObject | JSONSchemaType, _meta?: boolean): Promise>; + compileAsync(schema: JTDSchemaType, _meta?: boolean): Promise>; + compileAsync(schema: AsyncSchema, meta?: boolean): Promise>; + compileAsync(schema: AnySchemaObject, meta?: boolean): Promise>; + addSchema(schema: AnySchema | AnySchema[], // If array is passed, `key` will be ignored + key?: string, // Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. + _meta?: boolean, // true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. + _validateSchema?: boolean | "log"): Ajv; + addMetaSchema(schema: AnySchemaObject, key?: string, // schema key + _validateSchema?: boolean | "log"): Ajv; + validateSchema(schema: AnySchema, throwOrLogError?: boolean): boolean | Promise; + getSchema(keyRef: string): AnyValidateFunction | undefined; + removeSchema(schemaKeyRef?: AnySchema | string | RegExp): Ajv; + addVocabulary(definitions: Vocabulary): Ajv; + addKeyword(kwdOrDef: string | KeywordDefinition, def?: KeywordDefinition): Ajv; + getKeyword(keyword: string): AddedKeywordDefinition | boolean; + removeKeyword(keyword: string): Ajv; + addFormat(name: string, format: Format): Ajv; + errorsText(errors?: ErrorObject[] | null | undefined, // optional array of validation errors + { separator, dataVar }?: ErrorsTextOptions): string; + $dataMetaSchema(metaSchema: AnySchemaObject, keywordsJsonPointers: string[]): AnySchemaObject; + private _removeAllSchemas; + _addSchema(schema: AnySchema, meta?: boolean, baseId?: string, validateSchema?: boolean | "log", addSchema?: boolean): SchemaEnv; + private _checkUnique; + private _compileSchemaEnv; + private _compileMetaSchema; +} +export interface ErrorsTextOptions { + separator?: string; + dataVar?: string; +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/core.js b/node_modules/schema-utils/node_modules/ajv/dist/core.js new file mode 100644 index 000000000..84911161f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/core.js @@ -0,0 +1,617 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0; +var validate_1 = require("./compile/validate"); +Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +const validation_error_1 = require("./runtime/validation_error"); +const ref_error_1 = require("./compile/ref_error"); +const rules_1 = require("./compile/rules"); +const compile_1 = require("./compile"); +const codegen_2 = require("./compile/codegen"); +const resolve_1 = require("./compile/resolve"); +const dataType_1 = require("./compile/validate/dataType"); +const util_1 = require("./compile/util"); +const $dataRefSchema = require("./refs/data.json"); +const uri_1 = require("./runtime/uri"); +const defaultRegExp = (str, flags) => new RegExp(str, flags); +defaultRegExp.code = "new RegExp"; +const META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"]; +const EXT_SCOPE_NAMES = new Set([ + "validate", + "serialize", + "parse", + "wrapper", + "root", + "schema", + "keyword", + "pattern", + "formats", + "validate$data", + "func", + "obj", + "Error", +]); +const removedOptions = { + errorDataPath: "", + format: "`validateFormats: false` can be used instead.", + nullable: '"nullable" keyword is supported by default.', + jsonPointers: "Deprecated jsPropertySyntax can be used instead.", + extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.", + missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.", + processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`", + sourceCode: "Use option `code: {source: true}`", + strictDefaults: "It is default now, see option `strict`.", + strictKeywords: "It is default now, see option `strict`.", + uniqueItems: '"uniqueItems" keyword is always validated.', + unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).", + cache: "Map is used as cache, schema object as key.", + serialize: "Map is used as cache, schema object as key.", + ajvErrors: "It is default now.", +}; +const deprecatedOptions = { + ignoreKeywordsWithRef: "", + jsPropertySyntax: "", + unicode: '"minLength"/"maxLength" account for unicode characters by default.', +}; +const MAX_EXPRESSION = 200; +// eslint-disable-next-line complexity +function requiredOptions(o) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0; + const s = o.strict; + const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize; + const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0; + const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp; + const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default; + return { + strictSchema: (_f = (_e = o.strictSchema) !== null && _e !== void 0 ? _e : s) !== null && _f !== void 0 ? _f : true, + strictNumbers: (_h = (_g = o.strictNumbers) !== null && _g !== void 0 ? _g : s) !== null && _h !== void 0 ? _h : true, + strictTypes: (_k = (_j = o.strictTypes) !== null && _j !== void 0 ? _j : s) !== null && _k !== void 0 ? _k : "log", + strictTuples: (_m = (_l = o.strictTuples) !== null && _l !== void 0 ? _l : s) !== null && _m !== void 0 ? _m : "log", + strictRequired: (_p = (_o = o.strictRequired) !== null && _o !== void 0 ? _o : s) !== null && _p !== void 0 ? _p : false, + code: o.code ? { ...o.code, optimize, regExp } : { optimize, regExp }, + loopRequired: (_q = o.loopRequired) !== null && _q !== void 0 ? _q : MAX_EXPRESSION, + loopEnum: (_r = o.loopEnum) !== null && _r !== void 0 ? _r : MAX_EXPRESSION, + meta: (_s = o.meta) !== null && _s !== void 0 ? _s : true, + messages: (_t = o.messages) !== null && _t !== void 0 ? _t : true, + inlineRefs: (_u = o.inlineRefs) !== null && _u !== void 0 ? _u : true, + schemaId: (_v = o.schemaId) !== null && _v !== void 0 ? _v : "$id", + addUsedSchema: (_w = o.addUsedSchema) !== null && _w !== void 0 ? _w : true, + validateSchema: (_x = o.validateSchema) !== null && _x !== void 0 ? _x : true, + validateFormats: (_y = o.validateFormats) !== null && _y !== void 0 ? _y : true, + unicodeRegExp: (_z = o.unicodeRegExp) !== null && _z !== void 0 ? _z : true, + int32range: (_0 = o.int32range) !== null && _0 !== void 0 ? _0 : true, + uriResolver: uriResolver, + }; +} +class Ajv { + constructor(opts = {}) { + this.schemas = {}; + this.refs = {}; + this.formats = {}; + this._compilations = new Set(); + this._loading = {}; + this._cache = new Map(); + opts = this.opts = { ...opts, ...requiredOptions(opts) }; + const { es5, lines } = this.opts.code; + this.scope = new codegen_2.ValueScope({ scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines }); + this.logger = getLogger(opts.logger); + const formatOpt = opts.validateFormats; + opts.validateFormats = false; + this.RULES = (0, rules_1.getRules)(); + checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED"); + checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn"); + this._metaOpts = getMetaSchemaOptions.call(this); + if (opts.formats) + addInitialFormats.call(this); + this._addVocabularies(); + this._addDefaultMetaSchema(); + if (opts.keywords) + addInitialKeywords.call(this, opts.keywords); + if (typeof opts.meta == "object") + this.addMetaSchema(opts.meta); + addInitialSchemas.call(this); + opts.validateFormats = formatOpt; + } + _addVocabularies() { + this.addKeyword("$async"); + } + _addDefaultMetaSchema() { + const { $data, meta, schemaId } = this.opts; + let _dataRefSchema = $dataRefSchema; + if (schemaId === "id") { + _dataRefSchema = { ...$dataRefSchema }; + _dataRefSchema.id = _dataRefSchema.$id; + delete _dataRefSchema.$id; + } + if (meta && $data) + this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false); + } + defaultMeta() { + const { meta, schemaId } = this.opts; + return (this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : undefined); + } + validate(schemaKeyRef, // key, ref or schema object + data // to be validated + ) { + let v; + if (typeof schemaKeyRef == "string") { + v = this.getSchema(schemaKeyRef); + if (!v) + throw new Error(`no schema with key or ref "${schemaKeyRef}"`); + } + else { + v = this.compile(schemaKeyRef); + } + const valid = v(data); + if (!("$async" in v)) + this.errors = v.errors; + return valid; + } + compile(schema, _meta) { + const sch = this._addSchema(schema, _meta); + return (sch.validate || this._compileSchemaEnv(sch)); + } + compileAsync(schema, meta) { + if (typeof this.opts.loadSchema != "function") { + throw new Error("options.loadSchema should be a function"); + } + const { loadSchema } = this.opts; + return runCompileAsync.call(this, schema, meta); + async function runCompileAsync(_schema, _meta) { + await loadMetaSchema.call(this, _schema.$schema); + const sch = this._addSchema(_schema, _meta); + return sch.validate || _compileAsync.call(this, sch); + } + async function loadMetaSchema($ref) { + if ($ref && !this.getSchema($ref)) { + await runCompileAsync.call(this, { $ref }, true); + } + } + async function _compileAsync(sch) { + try { + return this._compileSchemaEnv(sch); + } + catch (e) { + if (!(e instanceof ref_error_1.default)) + throw e; + checkLoaded.call(this, e); + await loadMissingSchema.call(this, e.missingSchema); + return _compileAsync.call(this, sch); + } + } + function checkLoaded({ missingSchema: ref, missingRef }) { + if (this.refs[ref]) { + throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`); + } + } + async function loadMissingSchema(ref) { + const _schema = await _loadSchema.call(this, ref); + if (!this.refs[ref]) + await loadMetaSchema.call(this, _schema.$schema); + if (!this.refs[ref]) + this.addSchema(_schema, ref, meta); + } + async function _loadSchema(ref) { + const p = this._loading[ref]; + if (p) + return p; + try { + return await (this._loading[ref] = loadSchema(ref)); + } + finally { + delete this._loading[ref]; + } + } + } + // Adds schema to the instance + addSchema(schema, // If array is passed, `key` will be ignored + key, // Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. + _meta, // true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. + _validateSchema = this.opts.validateSchema // false to skip schema validation. Used internally, option validateSchema should be used instead. + ) { + if (Array.isArray(schema)) { + for (const sch of schema) + this.addSchema(sch, undefined, _meta, _validateSchema); + return this; + } + let id; + if (typeof schema === "object") { + const { schemaId } = this.opts; + id = schema[schemaId]; + if (id !== undefined && typeof id != "string") { + throw new Error(`schema ${schemaId} must be string`); + } + } + key = (0, resolve_1.normalizeId)(key || id); + this._checkUnique(key); + this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true); + return this; + } + // Add schema that will be used to validate other schemas + // options in META_IGNORE_OPTIONS are alway set to false + addMetaSchema(schema, key, // schema key + _validateSchema = this.opts.validateSchema // false to skip schema validation, can be used to override validateSchema option for meta-schema + ) { + this.addSchema(schema, key, true, _validateSchema); + return this; + } + // Validate schema against its meta-schema + validateSchema(schema, throwOrLogError) { + if (typeof schema == "boolean") + return true; + let $schema; + $schema = schema.$schema; + if ($schema !== undefined && typeof $schema != "string") { + throw new Error("$schema must be a string"); + } + $schema = $schema || this.opts.defaultMeta || this.defaultMeta(); + if (!$schema) { + this.logger.warn("meta-schema not available"); + this.errors = null; + return true; + } + const valid = this.validate($schema, schema); + if (!valid && throwOrLogError) { + const message = "schema is invalid: " + this.errorsText(); + if (this.opts.validateSchema === "log") + this.logger.error(message); + else + throw new Error(message); + } + return valid; + } + // Get compiled schema by `key` or `ref`. + // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id) + getSchema(keyRef) { + let sch; + while (typeof (sch = getSchEnv.call(this, keyRef)) == "string") + keyRef = sch; + if (sch === undefined) { + const { schemaId } = this.opts; + const root = new compile_1.SchemaEnv({ schema: {}, schemaId }); + sch = compile_1.resolveSchema.call(this, root, keyRef); + if (!sch) + return; + this.refs[keyRef] = sch; + } + return (sch.validate || this._compileSchemaEnv(sch)); + } + // Remove cached schema(s). + // If no parameter is passed all schemas but meta-schemas are removed. + // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. + // Even if schema is referenced by other schemas it still can be removed as other schemas have local references. + removeSchema(schemaKeyRef) { + if (schemaKeyRef instanceof RegExp) { + this._removeAllSchemas(this.schemas, schemaKeyRef); + this._removeAllSchemas(this.refs, schemaKeyRef); + return this; + } + switch (typeof schemaKeyRef) { + case "undefined": + this._removeAllSchemas(this.schemas); + this._removeAllSchemas(this.refs); + this._cache.clear(); + return this; + case "string": { + const sch = getSchEnv.call(this, schemaKeyRef); + if (typeof sch == "object") + this._cache.delete(sch.schema); + delete this.schemas[schemaKeyRef]; + delete this.refs[schemaKeyRef]; + return this; + } + case "object": { + const cacheKey = schemaKeyRef; + this._cache.delete(cacheKey); + let id = schemaKeyRef[this.opts.schemaId]; + if (id) { + id = (0, resolve_1.normalizeId)(id); + delete this.schemas[id]; + delete this.refs[id]; + } + return this; + } + default: + throw new Error("ajv.removeSchema: invalid parameter"); + } + } + // add "vocabulary" - a collection of keywords + addVocabulary(definitions) { + for (const def of definitions) + this.addKeyword(def); + return this; + } + addKeyword(kwdOrDef, def // deprecated + ) { + let keyword; + if (typeof kwdOrDef == "string") { + keyword = kwdOrDef; + if (typeof def == "object") { + this.logger.warn("these parameters are deprecated, see docs for addKeyword"); + def.keyword = keyword; + } + } + else if (typeof kwdOrDef == "object" && def === undefined) { + def = kwdOrDef; + keyword = def.keyword; + if (Array.isArray(keyword) && !keyword.length) { + throw new Error("addKeywords: keyword must be string or non-empty array"); + } + } + else { + throw new Error("invalid addKeywords parameters"); + } + checkKeyword.call(this, keyword, def); + if (!def) { + (0, util_1.eachItem)(keyword, (kwd) => addRule.call(this, kwd)); + return this; + } + keywordMetaschema.call(this, def); + const definition = { + ...def, + type: (0, dataType_1.getJSONTypes)(def.type), + schemaType: (0, dataType_1.getJSONTypes)(def.schemaType), + }; + (0, util_1.eachItem)(keyword, definition.type.length === 0 + ? (k) => addRule.call(this, k, definition) + : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t))); + return this; + } + getKeyword(keyword) { + const rule = this.RULES.all[keyword]; + return typeof rule == "object" ? rule.definition : !!rule; + } + // Remove keyword + removeKeyword(keyword) { + // TODO return type should be Ajv + const { RULES } = this; + delete RULES.keywords[keyword]; + delete RULES.all[keyword]; + for (const group of RULES.rules) { + const i = group.rules.findIndex((rule) => rule.keyword === keyword); + if (i >= 0) + group.rules.splice(i, 1); + } + return this; + } + // Add format + addFormat(name, format) { + if (typeof format == "string") + format = new RegExp(format); + this.formats[name] = format; + return this; + } + errorsText(errors = this.errors, // optional array of validation errors + { separator = ", ", dataVar = "data" } = {} // optional options with properties `separator` and `dataVar` + ) { + if (!errors || errors.length === 0) + return "No errors"; + return errors + .map((e) => `${dataVar}${e.instancePath} ${e.message}`) + .reduce((text, msg) => text + separator + msg); + } + $dataMetaSchema(metaSchema, keywordsJsonPointers) { + const rules = this.RULES.all; + metaSchema = JSON.parse(JSON.stringify(metaSchema)); + for (const jsonPointer of keywordsJsonPointers) { + const segments = jsonPointer.split("/").slice(1); // first segment is an empty string + let keywords = metaSchema; + for (const seg of segments) + keywords = keywords[seg]; + for (const key in rules) { + const rule = rules[key]; + if (typeof rule != "object") + continue; + const { $data } = rule.definition; + const schema = keywords[key]; + if ($data && schema) + keywords[key] = schemaOrData(schema); + } + } + return metaSchema; + } + _removeAllSchemas(schemas, regex) { + for (const keyRef in schemas) { + const sch = schemas[keyRef]; + if (!regex || regex.test(keyRef)) { + if (typeof sch == "string") { + delete schemas[keyRef]; + } + else if (sch && !sch.meta) { + this._cache.delete(sch.schema); + delete schemas[keyRef]; + } + } + } + } + _addSchema(schema, meta, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) { + let id; + const { schemaId } = this.opts; + if (typeof schema == "object") { + id = schema[schemaId]; + } + else { + if (this.opts.jtd) + throw new Error("schema must be object"); + else if (typeof schema != "boolean") + throw new Error("schema must be object or boolean"); + } + let sch = this._cache.get(schema); + if (sch !== undefined) + return sch; + baseId = (0, resolve_1.normalizeId)(id || baseId); + const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId); + sch = new compile_1.SchemaEnv({ schema, schemaId, meta, baseId, localRefs }); + this._cache.set(sch.schema, sch); + if (addSchema && !baseId.startsWith("#")) { + // TODO atm it is allowed to overwrite schemas without id (instead of not adding them) + if (baseId) + this._checkUnique(baseId); + this.refs[baseId] = sch; + } + if (validateSchema) + this.validateSchema(schema, true); + return sch; + } + _checkUnique(id) { + if (this.schemas[id] || this.refs[id]) { + throw new Error(`schema with key or id "${id}" already exists`); + } + } + _compileSchemaEnv(sch) { + if (sch.meta) + this._compileMetaSchema(sch); + else + compile_1.compileSchema.call(this, sch); + /* istanbul ignore if */ + if (!sch.validate) + throw new Error("ajv implementation error"); + return sch.validate; + } + _compileMetaSchema(sch) { + const currentOpts = this.opts; + this.opts = this._metaOpts; + try { + compile_1.compileSchema.call(this, sch); + } + finally { + this.opts = currentOpts; + } + } +} +exports.default = Ajv; +Ajv.ValidationError = validation_error_1.default; +Ajv.MissingRefError = ref_error_1.default; +function checkOptions(checkOpts, options, msg, log = "error") { + for (const key in checkOpts) { + const opt = key; + if (opt in options) + this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`); + } +} +function getSchEnv(keyRef) { + keyRef = (0, resolve_1.normalizeId)(keyRef); // TODO tests fail without this line + return this.schemas[keyRef] || this.refs[keyRef]; +} +function addInitialSchemas() { + const optsSchemas = this.opts.schemas; + if (!optsSchemas) + return; + if (Array.isArray(optsSchemas)) + this.addSchema(optsSchemas); + else + for (const key in optsSchemas) + this.addSchema(optsSchemas[key], key); +} +function addInitialFormats() { + for (const name in this.opts.formats) { + const format = this.opts.formats[name]; + if (format) + this.addFormat(name, format); + } +} +function addInitialKeywords(defs) { + if (Array.isArray(defs)) { + this.addVocabulary(defs); + return; + } + this.logger.warn("keywords option as map is deprecated, pass array"); + for (const keyword in defs) { + const def = defs[keyword]; + if (!def.keyword) + def.keyword = keyword; + this.addKeyword(def); + } +} +function getMetaSchemaOptions() { + const metaOpts = { ...this.opts }; + for (const opt of META_IGNORE_OPTIONS) + delete metaOpts[opt]; + return metaOpts; +} +const noLogs = { log() { }, warn() { }, error() { } }; +function getLogger(logger) { + if (logger === false) + return noLogs; + if (logger === undefined) + return console; + if (logger.log && logger.warn && logger.error) + return logger; + throw new Error("logger must implement log, warn and error methods"); +} +const KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i; +function checkKeyword(keyword, def) { + const { RULES } = this; + (0, util_1.eachItem)(keyword, (kwd) => { + if (RULES.keywords[kwd]) + throw new Error(`Keyword ${kwd} is already defined`); + if (!KEYWORD_NAME.test(kwd)) + throw new Error(`Keyword ${kwd} has invalid name`); + }); + if (!def) + return; + if (def.$data && !("code" in def || "validate" in def)) { + throw new Error('$data keyword must have "code" or "validate" function'); + } +} +function addRule(keyword, definition, dataType) { + var _a; + const post = definition === null || definition === void 0 ? void 0 : definition.post; + if (dataType && post) + throw new Error('keyword with "post" flag cannot have "type"'); + const { RULES } = this; + let ruleGroup = post ? RULES.post : RULES.rules.find(({ type: t }) => t === dataType); + if (!ruleGroup) { + ruleGroup = { type: dataType, rules: [] }; + RULES.rules.push(ruleGroup); + } + RULES.keywords[keyword] = true; + if (!definition) + return; + const rule = { + keyword, + definition: { + ...definition, + type: (0, dataType_1.getJSONTypes)(definition.type), + schemaType: (0, dataType_1.getJSONTypes)(definition.schemaType), + }, + }; + if (definition.before) + addBeforeRule.call(this, ruleGroup, rule, definition.before); + else + ruleGroup.rules.push(rule); + RULES.all[keyword] = rule; + (_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd)); +} +function addBeforeRule(ruleGroup, rule, before) { + const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before); + if (i >= 0) { + ruleGroup.rules.splice(i, 0, rule); + } + else { + ruleGroup.rules.push(rule); + this.logger.warn(`rule ${before} is not defined`); + } +} +function keywordMetaschema(def) { + let { metaSchema } = def; + if (metaSchema === undefined) + return; + if (def.$data && this.opts.$data) + metaSchema = schemaOrData(metaSchema); + def.validateSchema = this.compile(metaSchema, true); +} +const $dataRef = { + $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", +}; +function schemaOrData(schema) { + return { anyOf: [schema, $dataRef] }; +} +//# sourceMappingURL=core.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/core.js.map b/node_modules/schema-utils/node_modules/ajv/dist/core.js.map new file mode 100644 index 000000000..c39cd6b53 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/core.js.map @@ -0,0 +1 @@ +{"version":3,"file":"core.js","sourceRoot":"","sources":["../lib/core.ts"],"names":[],"mappings":";;;AA4BA,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAKlB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OA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,CAAC,MAAiB;IACrC,OAAO,EAAC,KAAK,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC,EAAC,CAAA;AACpC,CAAC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/jtd.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/jtd.d.ts new file mode 100644 index 000000000..0caf84b60 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/jtd.d.ts @@ -0,0 +1,45 @@ +import type { AnySchemaObject, SchemaObject, JTDParser } from "./types"; +import type { JTDSchemaType, SomeJTDSchemaType, JTDDataType } from "./types/jtd-schema"; +import AjvCore, { CurrentOptions } from "./core"; +declare type JTDOptions = CurrentOptions & { + strict?: never; + allowMatchingProperties?: never; + allowUnionTypes?: never; + validateFormats?: never; + $data?: never; + verbose?: boolean; + $comment?: never; + formats?: never; + loadSchema?: never; + useDefaults?: never; + coerceTypes?: never; + next?: never; + unevaluated?: never; + dynamicRef?: never; + meta?: boolean; + defaultMeta?: never; + inlineRefs?: boolean; + loopRequired?: never; + multipleOfPrecision?: never; +}; +declare class Ajv extends AjvCore { + constructor(opts?: JTDOptions); + _addVocabularies(): void; + _addDefaultMetaSchema(): void; + defaultMeta(): string | AnySchemaObject | undefined; + compileSerializer(schema: SchemaObject): (data: T) => string; + compileSerializer(schema: JTDSchemaType): (data: T) => string; + compileParser(schema: SchemaObject): JTDParser; + compileParser(schema: JTDSchemaType): JTDParser; + private _compileSerializer; + private _compileParser; +} +export default Ajv; +export { Format, FormatDefinition, AsyncFormatDefinition, KeywordDefinition, KeywordErrorDefinition, CodeKeywordDefinition, MacroKeywordDefinition, FuncKeywordDefinition, Vocabulary, Schema, SchemaObject, AnySchemaObject, AsyncSchema, AnySchema, ValidateFunction, AsyncValidateFunction, ErrorObject, ErrorNoParams, JTDParser, } from "./types"; +export { Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions } from "./core"; +export { SchemaCxt, SchemaObjCxt } from "./compile"; +export { KeywordCxt } from "./compile/validate"; +export { JTDErrorObject } from "./vocabularies/jtd"; +export { _, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions } from "./compile/codegen"; +export { JTDSchemaType, SomeJTDSchemaType, JTDDataType }; +export { JTDOptions }; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/jtd.js b/node_modules/schema-utils/node_modules/ajv/dist/jtd.js new file mode 100644 index 000000000..dfb34ddd5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/jtd.js @@ -0,0 +1,66 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = void 0; +const core_1 = require("./core"); +const jtd_1 = require("./vocabularies/jtd"); +const jtd_schema_1 = require("./refs/jtd-schema"); +const serialize_1 = require("./compile/jtd/serialize"); +const parse_1 = require("./compile/jtd/parse"); +const META_SCHEMA_ID = "JTD-meta-schema"; +class Ajv extends core_1.default { + constructor(opts = {}) { + super({ + ...opts, + jtd: true, + }); + } + _addVocabularies() { + super._addVocabularies(); + this.addVocabulary(jtd_1.default); + } + _addDefaultMetaSchema() { + super._addDefaultMetaSchema(); + if (!this.opts.meta) + return; + this.addMetaSchema(jtd_schema_1.default, META_SCHEMA_ID, false); + } + defaultMeta() { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)); + } + compileSerializer(schema) { + const sch = this._addSchema(schema); + return sch.serialize || this._compileSerializer(sch); + } + compileParser(schema) { + const sch = this._addSchema(schema); + return (sch.parse || this._compileParser(sch)); + } + _compileSerializer(sch) { + serialize_1.default.call(this, sch, sch.schema.definitions || {}); + /* istanbul ignore if */ + if (!sch.serialize) + throw new Error("ajv implementation error"); + return sch.serialize; + } + _compileParser(sch) { + parse_1.default.call(this, sch, sch.schema.definitions || {}); + /* istanbul ignore if */ + if (!sch.parse) + throw new Error("ajv implementation error"); + return sch.parse; + } +} +module.exports = exports = Ajv; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = Ajv; +var validate_1 = require("./compile/validate"); +Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function () { return validate_1.KeywordCxt; } }); +var codegen_1 = require("./compile/codegen"); +Object.defineProperty(exports, "_", { enumerable: true, get: function () { return codegen_1._; } }); +Object.defineProperty(exports, "str", { enumerable: true, get: function () { return codegen_1.str; } }); +Object.defineProperty(exports, "stringify", { enumerable: true, get: function () { return codegen_1.stringify; } }); +Object.defineProperty(exports, "nil", { enumerable: true, get: function () { return codegen_1.nil; } }); +Object.defineProperty(exports, "Name", { enumerable: true, get: function () { return codegen_1.Name; } }); +Object.defineProperty(exports, "CodeGen", { enumerable: true, get: function () { return codegen_1.CodeGen; } }); +//# sourceMappingURL=jtd.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/jtd.js.map b/node_modules/schema-utils/node_modules/ajv/dist/jtd.js.map new file mode 100644 index 000000000..6f253789f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/jtd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jtd.js","sourceRoot":"","sources":["../lib/jtd.ts"],"names":[],"mappings":";;;AAEA,iCAA8C;AAC9C,4CAA8C;AAC9C,kDAA6C;AAC7C,uDAAuD;AACvD,+CAA+C;AAG/C,MAAM,cAAc,GAAG,iBAAiB,CAAA;AA4BxC,MAAM,GAAI,SAAQ,cAAO;IACvB,YAAY,OAAmB,EAAE;QAC/B,KAAK,CAAC;YACJ,GAAG,IAAI;YACP,GAAG,EAAE,IAAI;SACV,CAAC,CAAA;IACJ,CAAC;IAED,gBAAgB;QACd,KAAK,CAAC,gBAAgB,EAAE,CAAA;QACxB,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAA;IACnC,CAAC;IAED,qBAAqB;QACnB,KAAK,CAAC,qBAAqB,EAAE,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,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AG,CAAC,KAAK,CAAA;IAClB,CAAC;CACF;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,GAAG,CAAA;AAC9B,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,GAAG,CAAA;AA0BlB,+CAA6C;AAArC,sGAAA,UAAU,OAAA;AAElB,6CAA6F;AAArF,4FAAA,CAAC,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,oGAAA,SAAS,OAAA;AAAE,8FAAA,GAAG,OAAA;AAAE,+FAAA,IAAI,OAAA;AAAQ,kGAAA,OAAO,OAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/data.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/data.json new file mode 100644 index 000000000..9ffc9f5ce --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/data.json @@ -0,0 +1,13 @@ +{ + "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", + "description": "Meta-schema for $data reference (JSON AnySchema extension proposal)", + "type": "object", + "required": ["$data"], + "properties": { + "$data": { + "type": "string", + "anyOf": [{"format": "relative-json-pointer"}, {"format": "json-pointer"}] + } + }, + "additionalProperties": false +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts new file mode 100644 index 000000000..cf008331f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/index.d.ts @@ -0,0 +1,2 @@ +import type Ajv from "../../core"; +export default function addMetaSchema2019(this: Ajv, $data?: boolean): Ajv; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/index.js b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/index.js new file mode 100644 index 000000000..e86496282 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/index.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const metaSchema = require("./schema.json"); +const applicator = require("./meta/applicator.json"); +const content = require("./meta/content.json"); +const core = require("./meta/core.json"); +const format = require("./meta/format.json"); +const metadata = require("./meta/meta-data.json"); +const validation = require("./meta/validation.json"); +const META_SUPPORT_DATA = ["/properties"]; +function addMetaSchema2019($data) { + ; + [ + metaSchema, + applicator, + content, + core, + with$data(this, format), + metadata, + with$data(this, validation), + ].forEach((sch) => this.addMetaSchema(sch, undefined, false)); + return this; + function with$data(ajv, sch) { + return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch; + } +} +exports.default = addMetaSchema2019; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map new file mode 100644 index 000000000..9b8a36d61 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/refs/json-schema-2019-09/index.ts"],"names":[],"mappings":";;AAEA,4CAA2C;AAC3C,qDAAoD;AACpD,+CAA8C;AAC9C,yCAAwC;AACxC,6CAA4C;AAC5C,kDAAiD;AACjD,qDAAoD;AAEpD,MAAM,iBAAiB,GAAG,CAAC,aAAa,CAAC,CAAA;AAEzC,SAAwB,iBAAiB,CAAY,KAAe;IAClE,CAAC;IAAA;QACC,UAAU;QACV,UAAU;QACV,OAAO;QACP,IAAI;QACJ,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;QACvB,QAAQ;QACR,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC;KAC5B,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAA;IAC7D,OAAO,IAAI,CAAA;IAEX,SAAS,SAAS,CAAC,GAAQ,EAAE,GAAoB;QAC/C,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IAClE,CAAC;AACH,CAAC;AAfD,oCAeC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json new file mode 100644 index 000000000..c5e91cf2a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/applicator.json @@ -0,0 +1,53 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/applicator", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/applicator": true + }, + "$recursiveAnchor": true, + + "title": "Applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "additionalItems": {"$recursiveRef": "#"}, + "unevaluatedItems": {"$recursiveRef": "#"}, + "items": { + "anyOf": [{"$recursiveRef": "#"}, {"$ref": "#/$defs/schemaArray"}] + }, + "contains": {"$recursiveRef": "#"}, + "additionalProperties": {"$recursiveRef": "#"}, + "unevaluatedProperties": {"$recursiveRef": "#"}, + "properties": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependentSchemas": { + "type": "object", + "additionalProperties": { + "$recursiveRef": "#" + } + }, + "propertyNames": {"$recursiveRef": "#"}, + "if": {"$recursiveRef": "#"}, + "then": {"$recursiveRef": "#"}, + "else": {"$recursiveRef": "#"}, + "allOf": {"$ref": "#/$defs/schemaArray"}, + "anyOf": {"$ref": "#/$defs/schemaArray"}, + "oneOf": {"$ref": "#/$defs/schemaArray"}, + "not": {"$recursiveRef": "#"} + }, + "$defs": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$recursiveRef": "#"} + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json new file mode 100644 index 000000000..b8f637343 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/content.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/content", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + "$recursiveAnchor": true, + + "title": "Content vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "contentMediaType": {"type": "string"}, + "contentEncoding": {"type": "string"}, + "contentSchema": {"$recursiveRef": "#"} + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json new file mode 100644 index 000000000..f71adbff0 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/core.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/core", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true + }, + "$recursiveAnchor": true, + + "title": "Core vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference", + "$comment": "Non-empty fragments not allowed.", + "pattern": "^[^#]*#?$" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$anchor": { + "type": "string", + "pattern": "^[A-Za-z][-A-Za-z0-9.:_]*$" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$recursiveRef": { + "type": "string", + "format": "uri-reference" + }, + "$recursiveAnchor": { + "type": "boolean", + "default": false + }, + "$vocabulary": { + "type": "object", + "propertyNames": { + "type": "string", + "format": "uri" + }, + "additionalProperties": { + "type": "boolean" + } + }, + "$comment": { + "type": "string" + }, + "$defs": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json new file mode 100644 index 000000000..03ccfce26 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/format.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/format", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/format": true + }, + "$recursiveAnchor": true, + + "title": "Format vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "format": {"type": "string"} + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json new file mode 100644 index 000000000..0e194326f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/meta-data.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/meta-data", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/meta-data": true + }, + "$recursiveAnchor": true, + + "title": "Meta-data vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "deprecated": { + "type": "boolean", + "default": false + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json new file mode 100644 index 000000000..7027a1279 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/meta/validation.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/validation", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/validation": true + }, + "$recursiveAnchor": true, + + "title": "Validation vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, + "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, + "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, + "minContains": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 1 + }, + "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, + "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/$defs/stringArray"}, + "dependentRequired": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + }, + "const": true, + "enum": { + "type": "array", + "items": true + }, + "type": { + "anyOf": [ + {"$ref": "#/$defs/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/$defs/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + } + }, + "$defs": { + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 0 + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json new file mode 100644 index 000000000..54eb7157a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2019-09/schema.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/schema", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true, + "https://json-schema.org/draft/2019-09/vocab/applicator": true, + "https://json-schema.org/draft/2019-09/vocab/validation": true, + "https://json-schema.org/draft/2019-09/vocab/meta-data": true, + "https://json-schema.org/draft/2019-09/vocab/format": false, + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + "$recursiveAnchor": true, + + "title": "Core and Validation specifications meta-schema", + "allOf": [ + {"$ref": "meta/core"}, + {"$ref": "meta/applicator"}, + {"$ref": "meta/validation"}, + {"$ref": "meta/meta-data"}, + {"$ref": "meta/format"}, + {"$ref": "meta/content"} + ], + "type": ["object", "boolean"], + "properties": { + "definitions": { + "$comment": "While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.", + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + }, + "dependencies": { + "$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"dependentSchemas\" and \"dependentRequired\"", + "type": "object", + "additionalProperties": { + "anyOf": [{"$recursiveRef": "#"}, {"$ref": "meta/validation#/$defs/stringArray"}] + } + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts new file mode 100644 index 000000000..c232ab05c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/index.d.ts @@ -0,0 +1,2 @@ +import type Ajv from "../../core"; +export default function addMetaSchema2020(this: Ajv, $data?: boolean): Ajv; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/index.js b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/index.js new file mode 100644 index 000000000..d92567564 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/index.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const metaSchema = require("./schema.json"); +const applicator = require("./meta/applicator.json"); +const unevaluated = require("./meta/unevaluated.json"); +const content = require("./meta/content.json"); +const core = require("./meta/core.json"); +const format = require("./meta/format-annotation.json"); +const metadata = require("./meta/meta-data.json"); +const validation = require("./meta/validation.json"); +const META_SUPPORT_DATA = ["/properties"]; +function addMetaSchema2020($data) { + ; + [ + metaSchema, + applicator, + unevaluated, + content, + core, + with$data(this, format), + metadata, + with$data(this, validation), + ].forEach((sch) => this.addMetaSchema(sch, undefined, false)); + return this; + function with$data(ajv, sch) { + return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch; + } +} +exports.default = addMetaSchema2020; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map new file mode 100644 index 000000000..eb90027dd --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/refs/json-schema-2020-12/index.ts"],"names":[],"mappings":";;AAEA,4CAA2C;AAC3C,qDAAoD;AACpD,uDAAsD;AACtD,+CAA8C;AAC9C,yCAAwC;AACxC,wDAAuD;AACvD,kDAAiD;AACjD,qDAAoD;AAEpD,MAAM,iBAAiB,GAAG,CAAC,aAAa,CAAC,CAAA;AAEzC,SAAwB,iBAAiB,CAAY,KAAe;IAClE,CAAC;IAAA;QACC,UAAU;QACV,UAAU;QACV,WAAW;QACX,OAAO;QACP,IAAI;QACJ,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;QACvB,QAAQ;QACR,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC;KAC5B,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC,CAAA;IAC7D,OAAO,IAAI,CAAA;IAEX,SAAS,SAAS,CAAC,GAAQ,EAAE,GAAoB;QAC/C,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,GAAG,EAAE,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;IAClE,CAAC;AACH,CAAC;AAhBD,oCAgBC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json new file mode 100644 index 000000000..674c913da --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/applicator.json @@ -0,0 +1,48 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/applicator", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/applicator": true + }, + "$dynamicAnchor": "meta", + + "title": "Applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "prefixItems": {"$ref": "#/$defs/schemaArray"}, + "items": {"$dynamicRef": "#meta"}, + "contains": {"$dynamicRef": "#meta"}, + "additionalProperties": {"$dynamicRef": "#meta"}, + "properties": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependentSchemas": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "default": {} + }, + "propertyNames": {"$dynamicRef": "#meta"}, + "if": {"$dynamicRef": "#meta"}, + "then": {"$dynamicRef": "#meta"}, + "else": {"$dynamicRef": "#meta"}, + "allOf": {"$ref": "#/$defs/schemaArray"}, + "anyOf": {"$ref": "#/$defs/schemaArray"}, + "oneOf": {"$ref": "#/$defs/schemaArray"}, + "not": {"$dynamicRef": "#meta"} + }, + "$defs": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$dynamicRef": "#meta"} + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json new file mode 100644 index 000000000..2ae23ddb5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/content.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/content", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/content": true + }, + "$dynamicAnchor": "meta", + + "title": "Content vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "contentEncoding": {"type": "string"}, + "contentMediaType": {"type": "string"}, + "contentSchema": {"$dynamicRef": "#meta"} + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json new file mode 100644 index 000000000..4c8e5cb61 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/core.json @@ -0,0 +1,51 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/core", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/core": true + }, + "$dynamicAnchor": "meta", + + "title": "Core vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "$id": { + "$ref": "#/$defs/uriReferenceString", + "$comment": "Non-empty fragments not allowed.", + "pattern": "^[^#]*#?$" + }, + "$schema": {"$ref": "#/$defs/uriString"}, + "$ref": {"$ref": "#/$defs/uriReferenceString"}, + "$anchor": {"$ref": "#/$defs/anchorString"}, + "$dynamicRef": {"$ref": "#/$defs/uriReferenceString"}, + "$dynamicAnchor": {"$ref": "#/$defs/anchorString"}, + "$vocabulary": { + "type": "object", + "propertyNames": {"$ref": "#/$defs/uriString"}, + "additionalProperties": { + "type": "boolean" + } + }, + "$comment": { + "type": "string" + }, + "$defs": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"} + } + }, + "$defs": { + "anchorString": { + "type": "string", + "pattern": "^[A-Za-z_][-A-Za-z0-9._]*$" + }, + "uriString": { + "type": "string", + "format": "uri" + }, + "uriReferenceString": { + "type": "string", + "format": "uri-reference" + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json new file mode 100644 index 000000000..83c26e35f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/format-annotation.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/format-annotation", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/format-annotation": true + }, + "$dynamicAnchor": "meta", + + "title": "Format vocabulary meta-schema for annotation results", + "type": ["object", "boolean"], + "properties": { + "format": {"type": "string"} + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json new file mode 100644 index 000000000..11946fb50 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/meta-data.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/meta-data", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/meta-data": true + }, + "$dynamicAnchor": "meta", + + "title": "Meta-data vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "deprecated": { + "type": "boolean", + "default": false + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json new file mode 100644 index 000000000..5e4b203b2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/unevaluated.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/unevaluated", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/unevaluated": true + }, + "$dynamicAnchor": "meta", + + "title": "Unevaluated applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "unevaluatedItems": {"$dynamicRef": "#meta"}, + "unevaluatedProperties": {"$dynamicRef": "#meta"} + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json new file mode 100644 index 000000000..e0ae13d9d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/meta/validation.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/validation", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/validation": true + }, + "$dynamicAnchor": "meta", + + "title": "Validation vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "type": { + "anyOf": [ + {"$ref": "#/$defs/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/$defs/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "const": true, + "enum": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, + "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, + "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, + "minContains": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 1 + }, + "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, + "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/$defs/stringArray"}, + "dependentRequired": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + } + }, + "$defs": { + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 0 + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json new file mode 100644 index 000000000..1c68270fd --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-2020-12/schema.json @@ -0,0 +1,55 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/schema", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/core": true, + "https://json-schema.org/draft/2020-12/vocab/applicator": true, + "https://json-schema.org/draft/2020-12/vocab/unevaluated": true, + "https://json-schema.org/draft/2020-12/vocab/validation": true, + "https://json-schema.org/draft/2020-12/vocab/meta-data": true, + "https://json-schema.org/draft/2020-12/vocab/format-annotation": true, + "https://json-schema.org/draft/2020-12/vocab/content": true + }, + "$dynamicAnchor": "meta", + + "title": "Core and Validation specifications meta-schema", + "allOf": [ + {"$ref": "meta/core"}, + {"$ref": "meta/applicator"}, + {"$ref": "meta/unevaluated"}, + {"$ref": "meta/validation"}, + {"$ref": "meta/meta-data"}, + {"$ref": "meta/format-annotation"}, + {"$ref": "meta/content"} + ], + "type": ["object", "boolean"], + "$comment": "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.", + "properties": { + "definitions": { + "$comment": "\"definitions\" has been replaced by \"$defs\".", + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "deprecated": true, + "default": {} + }, + "dependencies": { + "$comment": "\"dependencies\" has been split and replaced by \"dependentSchemas\" and \"dependentRequired\" in order to serve their differing semantics.", + "type": "object", + "additionalProperties": { + "anyOf": [{"$dynamicRef": "#meta"}, {"$ref": "meta/validation#/$defs/stringArray"}] + }, + "deprecated": true, + "default": {} + }, + "$recursiveAnchor": { + "$comment": "\"$recursiveAnchor\" has been replaced by \"$dynamicAnchor\".", + "$ref": "meta/core#/$defs/anchorString", + "deprecated": true + }, + "$recursiveRef": { + "$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".", + "$ref": "meta/core#/$defs/uriReferenceString", + "deprecated": true + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-draft-06.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-draft-06.json new file mode 100644 index 000000000..5410064ba --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-draft-06.json @@ -0,0 +1,137 @@ +{ + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "http://json-schema.org/draft-06/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "examples": { + "type": "array", + "items": {} + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, + "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": {"$ref": "#"}, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], + "default": {} + }, + "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, + "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": {"$ref": "#"}, + "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, + "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/definitions/stringArray"}, + "additionalProperties": {"$ref": "#"}, + "definitions": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] + } + }, + "propertyNames": {"$ref": "#"}, + "const": {}, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + {"$ref": "#/definitions/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/definitions/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": {"type": "string"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"} + }, + "default": {} +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-draft-07.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-draft-07.json new file mode 100644 index 000000000..6a7485104 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-draft-07.json @@ -0,0 +1,151 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, + "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": {"$ref": "#"}, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], + "default": true + }, + "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, + "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": {"$ref": "#"}, + "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, + "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/definitions/stringArray"}, + "additionalProperties": {"$ref": "#"}, + "definitions": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] + } + }, + "propertyNames": {"$ref": "#"}, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + {"$ref": "#/definitions/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/definitions/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": {"type": "string"}, + "contentMediaType": {"type": "string"}, + "contentEncoding": {"type": "string"}, + "if": {"$ref": "#"}, + "then": {"$ref": "#"}, + "else": {"$ref": "#"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"} + }, + "default": true +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-secure.json b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-secure.json new file mode 100644 index 000000000..3968abd5d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/json-schema-secure.json @@ -0,0 +1,88 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/json-schema-secure.json#", + "title": "Meta-schema for the security assessment of JSON Schemas", + "description": "If a JSON AnySchema fails validation against this meta-schema, it may be unsafe to validate untrusted data", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + } + }, + "dependencies": { + "patternProperties": { + "description": "prevent slow validation of large property names", + "required": ["propertyNames"], + "properties": { + "propertyNames": { + "required": ["maxLength"] + } + } + }, + "uniqueItems": { + "description": "prevent slow validation of large non-scalar arrays", + "if": { + "properties": { + "uniqueItems": {"const": true}, + "items": { + "properties": { + "type": { + "anyOf": [ + { + "enum": ["object", "array"] + }, + { + "type": "array", + "contains": {"enum": ["object", "array"]} + } + ] + } + } + } + } + }, + "then": { + "required": ["maxItems"] + } + }, + "pattern": { + "description": "prevent slow pattern matching of large strings", + "required": ["maxLength"] + }, + "format": { + "description": "prevent slow format validation of large strings", + "required": ["maxLength"] + } + }, + "properties": { + "additionalItems": {"$ref": "#"}, + "additionalProperties": {"$ref": "#"}, + "dependencies": { + "additionalProperties": { + "anyOf": [{"type": "array"}, {"$ref": "#"}] + } + }, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}] + }, + "definitions": { + "additionalProperties": {"$ref": "#"} + }, + "patternProperties": { + "additionalProperties": {"$ref": "#"} + }, + "properties": { + "additionalProperties": {"$ref": "#"} + }, + "if": {"$ref": "#"}, + "then": {"$ref": "#"}, + "else": {"$ref": "#"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"}, + "contains": {"$ref": "#"}, + "propertyNames": {"$ref": "#"} + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/jtd-schema.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/refs/jtd-schema.d.ts new file mode 100644 index 000000000..932797a38 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/jtd-schema.d.ts @@ -0,0 +1,3 @@ +import { SchemaObject } from "../types"; +declare const jtdMetaSchema: SchemaObject; +export default jtdMetaSchema; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/jtd-schema.js b/node_modules/schema-utils/node_modules/ajv/dist/refs/jtd-schema.js new file mode 100644 index 000000000..1ee940afb --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/jtd-schema.js @@ -0,0 +1,118 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const shared = (root) => { + const sch = { + nullable: { type: "boolean" }, + metadata: { + optionalProperties: { + union: { elements: { ref: "schema" } }, + }, + additionalProperties: true, + }, + }; + if (root) + sch.definitions = { values: { ref: "schema" } }; + return sch; +}; +const emptyForm = (root) => ({ + optionalProperties: shared(root), +}); +const refForm = (root) => ({ + properties: { + ref: { type: "string" }, + }, + optionalProperties: shared(root), +}); +const typeForm = (root) => ({ + properties: { + type: { + enum: [ + "boolean", + "timestamp", + "string", + "float32", + "float64", + "int8", + "uint8", + "int16", + "uint16", + "int32", + "uint32", + ], + }, + }, + optionalProperties: shared(root), +}); +const enumForm = (root) => ({ + properties: { + enum: { elements: { type: "string" } }, + }, + optionalProperties: shared(root), +}); +const elementsForm = (root) => ({ + properties: { + elements: { ref: "schema" }, + }, + optionalProperties: shared(root), +}); +const propertiesForm = (root) => ({ + properties: { + properties: { values: { ref: "schema" } }, + }, + optionalProperties: { + optionalProperties: { values: { ref: "schema" } }, + additionalProperties: { type: "boolean" }, + ...shared(root), + }, +}); +const optionalPropertiesForm = (root) => ({ + properties: { + optionalProperties: { values: { ref: "schema" } }, + }, + optionalProperties: { + additionalProperties: { type: "boolean" }, + ...shared(root), + }, +}); +const discriminatorForm = (root) => ({ + properties: { + discriminator: { type: "string" }, + mapping: { + values: { + metadata: { + union: [propertiesForm(false), optionalPropertiesForm(false)], + }, + }, + }, + }, + optionalProperties: shared(root), +}); +const valuesForm = (root) => ({ + properties: { + values: { ref: "schema" }, + }, + optionalProperties: shared(root), +}); +const schema = (root) => ({ + metadata: { + union: [ + emptyForm, + refForm, + typeForm, + enumForm, + elementsForm, + propertiesForm, + optionalPropertiesForm, + discriminatorForm, + valuesForm, + ].map((s) => s(root)), + }, +}); +const jtdMetaSchema = { + definitions: { + schema: schema(false), + }, + ...schema(true), +}; +exports.default = jtdMetaSchema; +//# sourceMappingURL=jtd-schema.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/refs/jtd-schema.js.map b/node_modules/schema-utils/node_modules/ajv/dist/refs/jtd-schema.js.map new file mode 100644 index 000000000..d46755b21 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/refs/jtd-schema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jtd-schema.js","sourceRoot":"","sources":["../../lib/refs/jtd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F;KACF;IACD,kBAAkB,EAAE,MAAM,CAAC,IAAI,CAAC;CACjC,CAAC,CAAA;AAEF,MAAM,UAAU,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACxC,UAAU,EAAE;QACV,MAAM,EAAE,EAAC,GAAG,EAAE,QAAQ,EAAC;KACxB;IACD,kBAAkB,EAAE,MAAM,CAAC,IAAI,CAAC;CACjC,CAAC,CAAA;AAEF,MAAM,MAAM,GAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACpC,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,SAAS;YACT,OAAO;YACP,QAAQ;YACR,QAAQ;YACR,YAAY;YACZ,cAAc;YACd,sBAAsB;YACtB,iBAAiB;YACjB,UAAU;SACX,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;KACtB;CACF,CAAC,CAAA;AAEF,MAAM,aAAa,GAAiB;IAClC,WAAW,EAAE;QACX,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC;KACtB;IACD,GAAG,MAAM,CAAC,IAAI,CAAC;CAChB,CAAA;AAED,kBAAe,aAAa,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/equal.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/runtime/equal.d.ts new file mode 100644 index 000000000..56149ea2e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/equal.d.ts @@ -0,0 +1,6 @@ +import * as equal from "fast-deep-equal"; +declare type Equal = typeof equal & { + code: string; +}; +declare const _default: Equal; +export default _default; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/equal.js b/node_modules/schema-utils/node_modules/ajv/dist/runtime/equal.js new file mode 100644 index 000000000..774bba05a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/equal.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// https://github.com/ajv-validator/ajv/issues/889 +const equal = require("fast-deep-equal"); +equal.code = 'require("ajv/dist/runtime/equal").default'; +exports.default = equal; +//# sourceMappingURL=equal.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/equal.js.map b/node_modules/schema-utils/node_modules/ajv/dist/runtime/equal.js.map new file mode 100644 index 000000000..0e17901c3 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/equal.js.map @@ -0,0 +1 @@ +{"version":3,"file":"equal.js","sourceRoot":"","sources":["../../lib/runtime/equal.ts"],"names":[],"mappings":";;AAAA,kDAAkD;AAClD,yCAAwC;AAGtC,KAAe,CAAC,IAAI,GAAG,2CAA2C,CAAA;AAEpE,kBAAe,KAAc,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/parseJson.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/runtime/parseJson.d.ts new file mode 100644 index 000000000..85f1d5670 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/parseJson.d.ts @@ -0,0 +1,18 @@ +export declare function parseJson(s: string, pos: number): unknown; +export declare namespace parseJson { + var message: string | undefined; + var position: number; + var code: string; +} +export declare function parseJsonNumber(s: string, pos: number, maxDigits?: number): number | undefined; +export declare namespace parseJsonNumber { + var message: string | undefined; + var position: number; + var code: string; +} +export declare function parseJsonString(s: string, pos: number): string | undefined; +export declare namespace parseJsonString { + var message: string | undefined; + var position: number; + var code: string; +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/parseJson.js b/node_modules/schema-utils/node_modules/ajv/dist/runtime/parseJson.js new file mode 100644 index 000000000..7ebbc1bfc --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/parseJson.js @@ -0,0 +1,184 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseJsonString = exports.parseJsonNumber = exports.parseJson = void 0; +const rxParseJson = /position\s(\d+)$/; +function parseJson(s, pos) { + let endPos; + parseJson.message = undefined; + let matches; + if (pos) + s = s.slice(pos); + try { + parseJson.position = pos + s.length; + return JSON.parse(s); + } + catch (e) { + matches = rxParseJson.exec(e.message); + if (!matches) { + parseJson.message = "unexpected end"; + return undefined; + } + endPos = +matches[1]; + const c = s[endPos]; + s = s.slice(0, endPos); + parseJson.position = pos + endPos; + try { + return JSON.parse(s); + } + catch (e1) { + parseJson.message = `unexpected token ${c}`; + return undefined; + } + } +} +exports.parseJson = parseJson; +parseJson.message = undefined; +parseJson.position = 0; +parseJson.code = 'require("ajv/dist/runtime/parseJson").parseJson'; +function parseJsonNumber(s, pos, maxDigits) { + let numStr = ""; + let c; + parseJsonNumber.message = undefined; + if (s[pos] === "-") { + numStr += "-"; + pos++; + } + if (s[pos] === "0") { + numStr += "0"; + pos++; + } + else { + if (!parseDigits(maxDigits)) { + errorMessage(); + return undefined; + } + } + if (maxDigits) { + parseJsonNumber.position = pos; + return +numStr; + } + if (s[pos] === ".") { + numStr += "."; + pos++; + if (!parseDigits()) { + errorMessage(); + return undefined; + } + } + if (((c = s[pos]), c === "e" || c === "E")) { + numStr += "e"; + pos++; + if (((c = s[pos]), c === "+" || c === "-")) { + numStr += c; + pos++; + } + if (!parseDigits()) { + errorMessage(); + return undefined; + } + } + parseJsonNumber.position = pos; + return +numStr; + function parseDigits(maxLen) { + let digit = false; + while (((c = s[pos]), c >= "0" && c <= "9" && (maxLen === undefined || maxLen-- > 0))) { + digit = true; + numStr += c; + pos++; + } + return digit; + } + function errorMessage() { + parseJsonNumber.position = pos; + parseJsonNumber.message = pos < s.length ? `unexpected token ${s[pos]}` : "unexpected end"; + } +} +exports.parseJsonNumber = parseJsonNumber; +parseJsonNumber.message = undefined; +parseJsonNumber.position = 0; +parseJsonNumber.code = 'require("ajv/dist/runtime/parseJson").parseJsonNumber'; +const escapedChars = { + b: "\b", + f: "\f", + n: "\n", + r: "\r", + t: "\t", + '"': '"', + "/": "/", + "\\": "\\", +}; +const CODE_A = "a".charCodeAt(0); +const CODE_0 = "0".charCodeAt(0); +function parseJsonString(s, pos) { + let str = ""; + let c; + parseJsonString.message = undefined; + // eslint-disable-next-line no-constant-condition, @typescript-eslint/no-unnecessary-condition + while (true) { + c = s[pos++]; + if (c === '"') + break; + if (c === "\\") { + c = s[pos]; + if (c in escapedChars) { + str += escapedChars[c]; + pos++; + } + else if (c === "u") { + pos++; + let count = 4; + let code = 0; + while (count--) { + code <<= 4; + c = s[pos]; + if (c === undefined) { + errorMessage("unexpected end"); + return undefined; + } + c = c.toLowerCase(); + if (c >= "a" && c <= "f") { + code += c.charCodeAt(0) - CODE_A + 10; + } + else if (c >= "0" && c <= "9") { + code += c.charCodeAt(0) - CODE_0; + } + else { + errorMessage(`unexpected token ${c}`); + return undefined; + } + pos++; + } + str += String.fromCharCode(code); + } + else { + errorMessage(`unexpected token ${c}`); + return undefined; + } + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + } + else if (c === undefined) { + errorMessage("unexpected end"); + return undefined; + } + else { + if (c.charCodeAt(0) >= 0x20) { + str += c; + } + else { + errorMessage(`unexpected token ${c}`); + return undefined; + } + } + } + parseJsonString.position = pos; + return str; + function errorMessage(msg) { + parseJsonString.position = pos; + parseJsonString.message = msg; + } +} +exports.parseJsonString = parseJsonString; +parseJsonString.message = undefined; +parseJsonString.position = 0; +parseJsonString.code = 'require("ajv/dist/runtime/parseJson").parseJsonString'; +//# sourceMappingURL=parseJson.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/parseJson.js.map b/node_modules/schema-utils/node_modules/ajv/dist/runtime/parseJson.js.map new file mode 100644 index 000000000..7f239fb71 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/parseJson.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parseJson.js","sourceRoot":"","sources":["../../lib/runtime/parseJson.ts"],"names":[],"mappings":";;;AAAA,MAAM,WAAW,GAAG,kBAAkB,CAAA;AAEtC,SAAgB,SAAS,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AY,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAA;gBACrC,OAAO,SAAS,CAAA;aACjB;YACD,uEAAuE;SACxE;aAAM,IAAI,CAAC,KAAK,SAAS,EAAE;YAC1B,YAAY,CAAC,gBAAgB,CAAC,CAAA;YAC9B,OAAO,SAAS,CAAA;SACjB;aAAM;YACL,IAAI,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE;gBAC3B,GAAG,IAAI,CAAC,CAAA;aACT;iBAAM;gBACL,YAAY,CAAC,oBAAoB,CAAC,EAAE,CAAC,CAAA;gBACrC,OAAO,SAAS,CAAA;aACjB;SACF;KACF;IACD,eAAe,CAAC,QAAQ,GAAG,GAAG,CAAA;IAC9B,OAAO,GAAG,CAAA;IAEV,SAAS,YAAY,CAAC,GAAW;QAC/B,eAAe,CAAC,QAAQ,GAAG,GAAG,CAAA;QAC9B,eAAe,CAAC,OAAO,GAAG,GAAG,CAAA;IAC/B,CAAC;AACH,CAAC;AA5DD,0CA4DC;AAED,eAAe,CAAC,OAAO,GAAG,SAA+B,CAAA;AACzD,eAAe,CAAC,QAAQ,GAAG,CAAW,CAAA;AACtC,eAAe,CAAC,IAAI,GAAG,uDAAuD,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/quote.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/runtime/quote.d.ts new file mode 100644 index 000000000..0579dd3c6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/quote.d.ts @@ -0,0 +1,5 @@ +declare function quote(s: string): string; +declare namespace quote { + var code: string; +} +export default quote; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/quote.js b/node_modules/schema-utils/node_modules/ajv/dist/runtime/quote.js new file mode 100644 index 000000000..ebf78f70d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/quote.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const rxEscapable = +// eslint-disable-next-line no-control-regex, no-misleading-character-class +/[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; +const escaped = { + "\b": "\\b", + "\t": "\\t", + "\n": "\\n", + "\f": "\\f", + "\r": "\\r", + '"': '\\"', + "\\": "\\\\", +}; +function quote(s) { + rxEscapable.lastIndex = 0; + return ('"' + + (rxEscapable.test(s) + ? s.replace(rxEscapable, (a) => { + const c = escaped[a]; + return typeof c === "string" + ? c + : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4); + }) + : s) + + '"'); +} +exports.default = quote; +quote.code = 'require("ajv/dist/runtime/quote").default'; +//# sourceMappingURL=quote.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/quote.js.map b/node_modules/schema-utils/node_modules/ajv/dist/runtime/quote.js.map new file mode 100644 index 000000000..4d226252d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/quote.js.map @@ -0,0 +1 @@ +{"version":3,"file":"quote.js","sourceRoot":"","sources":["../../lib/runtime/quote.ts"],"names":[],"mappings":";;AAAA,MAAM,WAAW;AACf,2EAA2E;AAC3E,iIAAiI,CAAA;AAEnI,MAAM,OAAO,GAA6B;IACxC,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,IAAI,EAAE,KAAK;IACX,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACb,CAAA;AAED,SAAwB,KAAK,CAAC,CAAS;IACrC,WAAW,CAAC,SAAS,GAAG,CAAC,CAAA;IACzB,OAAO,CACL,GAAG;QACH,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE;gBAC3B,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;gBACpB,OAAO,OAAO,CAAC,KAAK,QAAQ;oBAC1B,CAAC,CAAC,CAAC;oBACH,CAAC,CAAC,KAAK,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;YAC/D,CAAC,CAAC;YACJ,CAAC,CAAC,CAAC,CAAC;QACN,GAAG,CACJ,CAAA;AACH,CAAC;AAdD,wBAcC;AAED,KAAK,CAAC,IAAI,GAAG,2CAA2C,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/re2.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/runtime/re2.d.ts new file mode 100644 index 000000000..b49306ff3 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/re2.d.ts @@ -0,0 +1,6 @@ +import * as re2 from "re2"; +declare type Re2 = typeof re2 & { + code: string; +}; +declare const _default: Re2; +export default _default; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/re2.js b/node_modules/schema-utils/node_modules/ajv/dist/runtime/re2.js new file mode 100644 index 000000000..4b1ee2537 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/re2.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const re2 = require("re2"); +re2.code = 'require("ajv/dist/runtime/re2").default'; +exports.default = re2; +//# sourceMappingURL=re2.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/re2.js.map b/node_modules/schema-utils/node_modules/ajv/dist/runtime/re2.js.map new file mode 100644 index 000000000..bb938a2c4 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/re2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"re2.js","sourceRoot":"","sources":["../../lib/runtime/re2.ts"],"names":[],"mappings":";;AAAA,2BAA0B;AAGxB,GAAW,CAAC,IAAI,GAAG,yCAAyC,CAAA;AAE9D,kBAAe,GAAU,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/timestamp.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/runtime/timestamp.d.ts new file mode 100644 index 000000000..cd4832688 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/timestamp.d.ts @@ -0,0 +1,5 @@ +declare function validTimestamp(str: string, allowDate: boolean): boolean; +declare namespace validTimestamp { + var code: string; +} +export default validTimestamp; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/timestamp.js b/node_modules/schema-utils/node_modules/ajv/dist/runtime/timestamp.js new file mode 100644 index 000000000..5e0f06564 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/timestamp.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const DT_SEPARATOR = /t|\s/i; +const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/; +const TIME = /^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:z|([+-]\d\d)(?::?(\d\d))?)$/i; +const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; +function validTimestamp(str, allowDate) { + // http://tools.ietf.org/html/rfc3339#section-5.6 + const dt = str.split(DT_SEPARATOR); + return ((dt.length === 2 && validDate(dt[0]) && validTime(dt[1])) || + (allowDate && dt.length === 1 && validDate(dt[0]))); +} +exports.default = validTimestamp; +function validDate(str) { + const matches = DATE.exec(str); + if (!matches) + return false; + const y = +matches[1]; + const m = +matches[2]; + const d = +matches[3]; + return (m >= 1 && + m <= 12 && + d >= 1 && + (d <= DAYS[m] || + // leap year: https://tools.ietf.org/html/rfc3339#appendix-C + (m === 2 && d === 29 && (y % 100 === 0 ? y % 400 === 0 : y % 4 === 0)))); +} +function validTime(str) { + const matches = TIME.exec(str); + if (!matches) + return false; + const hr = +matches[1]; + const min = +matches[2]; + const sec = +matches[3]; + const tzH = +(matches[4] || 0); + const tzM = +(matches[5] || 0); + return ((hr <= 23 && min <= 59 && sec <= 59) || + // leap second + (hr - tzH === 23 && min - tzM === 59 && sec === 60)); +} +validTimestamp.code = 'require("ajv/dist/runtime/timestamp").default'; +//# sourceMappingURL=timestamp.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/timestamp.js.map b/node_modules/schema-utils/node_modules/ajv/dist/runtime/timestamp.js.map new file mode 100644 index 000000000..6b0eee039 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/timestamp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"timestamp.js","sourceRoot":"","sources":["../../lib/runtime/timestamp.ts"],"names":[],"mappings":";;AAAA,MAAM,YAAY,GAAG,OAAO,CAAA;AAC5B,MAAM,IAAI,GAAG,4BAA4B,CAAA;AACzC,MAAM,IAAI,GAAG,gEAAgE,CAAA;AAC7E,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;AAEhE,SAAwB,cAAc,CAAC,GAAW,EAAE,SAAkB;IACpE,iDAAiD;IACjD,MAAM,EAAE,GAAa,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAA;IAC5C,OAAO,CACL,CAAC,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACzD,CAAC,SAAS,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CACnD,CAAA;AAC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ACtC,OAAO,CACL,CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,IAAI,GAAG,IAAI,EAAE,CAAC;QACpC,cAAc;QACd,CAAC,EAAE,GAAG,GAAG,KAAK,EAAE,IAAI,GAAG,GAAG,GAAG,KAAK,EAAE,IAAI,GAAG,KAAK,EAAE,CAAC,CACpD,CAAA;AACH,CAAC;AAED,cAAc,CAAC,IAAI,GAAG,+CAA+C,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/ucs2length.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/runtime/ucs2length.d.ts new file mode 100644 index 000000000..ecbee69c5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/ucs2length.d.ts @@ -0,0 +1,5 @@ +declare function ucs2length(str: string): number; +declare namespace ucs2length { + var code: string; +} +export default ucs2length; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/ucs2length.js b/node_modules/schema-utils/node_modules/ajv/dist/runtime/ucs2length.js new file mode 100644 index 000000000..92ea0c08a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/ucs2length.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// https://mathiasbynens.be/notes/javascript-encoding +// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode +function ucs2length(str) { + const len = str.length; + let length = 0; + let pos = 0; + let value; + while (pos < len) { + length++; + value = str.charCodeAt(pos++); + if (value >= 0xd800 && value <= 0xdbff && pos < len) { + // high surrogate, and there is a next character + value = str.charCodeAt(pos); + if ((value & 0xfc00) === 0xdc00) + pos++; // low surrogate + } + } + return length; +} +exports.default = ucs2length; +ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default'; +//# sourceMappingURL=ucs2length.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/ucs2length.js.map b/node_modules/schema-utils/node_modules/ajv/dist/runtime/ucs2length.js.map new file mode 100644 index 000000000..7c7f78865 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/ucs2length.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ucs2length.js","sourceRoot":"","sources":["../../lib/runtime/ucs2length.ts"],"names":[],"mappings":";;AAAA,qDAAqD;AACrD,iEAAiE;AACjE,SAAwB,UAAU,CAAC,GAAW;IAC5C,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAA;IACtB,IAAI,MAAM,GAAG,CAAC,CAAA;IACd,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,IAAI,KAAa,CAAA;IACjB,OAAO,GAAG,GAAG,GAAG,EAAE;QAChB,MAAM,EAAE,CAAA;QACR,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE,CAAC,CAAA;QAC7B,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,MAAM,IAAI,GAAG,GAAG,GAAG,EAAE;YACnD,gDAAgD;YAChD,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;YAC3B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,MAAM;gBAAE,GAAG,EAAE,CAAA,CAAC,gBAAgB;SACxD;KACF;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAfD,6BAeC;AAED,UAAU,CAAC,IAAI,GAAG,gDAAgD,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/uri.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/runtime/uri.d.ts new file mode 100644 index 000000000..83b169f6b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/uri.d.ts @@ -0,0 +1,6 @@ +import * as uri from "uri-js"; +declare type URI = typeof uri & { + code: string; +}; +declare const _default: URI; +export default _default; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/uri.js b/node_modules/schema-utils/node_modules/ajv/dist/runtime/uri.js new file mode 100644 index 000000000..fbd38151f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/uri.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const uri = require("uri-js"); +uri.code = 'require("ajv/dist/runtime/uri").default'; +exports.default = uri; +//# sourceMappingURL=uri.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/uri.js.map b/node_modules/schema-utils/node_modules/ajv/dist/runtime/uri.js.map new file mode 100644 index 000000000..701bed950 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/uri.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uri.js","sourceRoot":"","sources":["../../lib/runtime/uri.ts"],"names":[],"mappings":";;AAAA,8BAA6B;AAG3B,GAAW,CAAC,IAAI,GAAG,yCAAyC,CAAA;AAE9D,kBAAe,GAAU,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/validation_error.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/runtime/validation_error.d.ts new file mode 100644 index 000000000..b0ee9698f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/validation_error.d.ts @@ -0,0 +1,7 @@ +import type { ErrorObject } from "../types"; +export default class ValidationError extends Error { + readonly errors: Partial[]; + readonly ajv: true; + readonly validation: true; + constructor(errors: Partial[]); +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/validation_error.js b/node_modules/schema-utils/node_modules/ajv/dist/runtime/validation_error.js new file mode 100644 index 000000000..353502c08 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/validation_error.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +class ValidationError extends Error { + constructor(errors) { + super("validation failed"); + this.errors = errors; + this.ajv = this.validation = true; + } +} +exports.default = ValidationError; +//# sourceMappingURL=validation_error.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/runtime/validation_error.js.map b/node_modules/schema-utils/node_modules/ajv/dist/runtime/validation_error.js.map new file mode 100644 index 000000000..70206fbc1 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/runtime/validation_error.js.map @@ -0,0 +1 @@ +{"version":3,"file":"validation_error.js","sourceRoot":"","sources":["../../lib/runtime/validation_error.ts"],"names":[],"mappings":";;AAEA,MAAqB,eAAgB,SAAQ,KAAK;IAKhD,YAAY,MAA8B;QACxC,KAAK,CAAC,mBAAmB,CAAC,CAAA;QAC1B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAA;IACnC,CAAC;CACF;AAVD,kCAUC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/standalone/index.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/standalone/index.d.ts new file mode 100644 index 000000000..a9141c3d2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/standalone/index.d.ts @@ -0,0 +1,6 @@ +import type AjvCore from "../core"; +import type { AnyValidateFunction } from "../types"; +declare function standaloneCode(ajv: AjvCore, refsOrFunc?: { + [K in string]?: string; +} | AnyValidateFunction): string; +export default standaloneCode; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/standalone/index.js b/node_modules/schema-utils/node_modules/ajv/dist/standalone/index.js new file mode 100644 index 000000000..b44bb5db5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/standalone/index.js @@ -0,0 +1,90 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const scope_1 = require("../compile/codegen/scope"); +const code_1 = require("../compile/codegen/code"); +function standaloneCode(ajv, refsOrFunc) { + if (!ajv.opts.code.source) { + throw new Error("moduleCode: ajv instance must have code.source option"); + } + const { _n } = ajv.scope.opts; + return typeof refsOrFunc == "function" + ? funcExportCode(refsOrFunc.source) + : refsOrFunc !== undefined + ? multiExportsCode(refsOrFunc, getValidate) + : multiExportsCode(ajv.schemas, (sch) => sch.meta ? undefined : ajv.compile(sch.schema)); + function getValidate(id) { + const v = ajv.getSchema(id); + if (!v) + throw new Error(`moduleCode: no schema with id ${id}`); + return v; + } + function funcExportCode(source) { + const usedValues = {}; + const n = source === null || source === void 0 ? void 0 : source.validateName; + const vCode = validateCode(usedValues, source); + if (ajv.opts.code.esm) { + // Always do named export as `validate` rather than the variable `n` which is `validateXX` for known export value + return `"use strict";${_n}export const validate = ${n};${_n}export default ${n};${_n}${vCode}`; + } + return `"use strict";${_n}module.exports = ${n};${_n}module.exports.default = ${n};${_n}${vCode}`; + } + function multiExportsCode(schemas, getValidateFunc) { + var _a; + const usedValues = {}; + let code = (0, code_1._) `"use strict";`; + for (const name in schemas) { + const v = getValidateFunc(schemas[name]); + if (v) { + const vCode = validateCode(usedValues, v.source); + const exportSyntax = ajv.opts.code.esm + ? (0, code_1._) `export const ${(0, code_1.getEsmExportName)(name)}` + : (0, code_1._) `exports${(0, code_1.getProperty)(name)}`; + code = (0, code_1._) `${code}${_n}${exportSyntax} = ${(_a = v.source) === null || _a === void 0 ? void 0 : _a.validateName};${_n}${vCode}`; + } + } + return `${code}`; + } + function validateCode(usedValues, s) { + if (!s) + throw new Error('moduleCode: function does not have "source" property'); + if (usedState(s.validateName) === scope_1.UsedValueState.Completed) + return code_1.nil; + setUsedState(s.validateName, scope_1.UsedValueState.Started); + const scopeCode = ajv.scope.scopeCode(s.scopeValues, usedValues, refValidateCode); + const code = new code_1._Code(`${scopeCode}${_n}${s.validateCode}`); + return s.evaluated ? (0, code_1._) `${code}${s.validateName}.evaluated = ${s.evaluated};${_n}` : code; + function refValidateCode(n) { + var _a; + const vRef = (_a = n.value) === null || _a === void 0 ? void 0 : _a.ref; + if (n.prefix === "validate" && typeof vRef == "function") { + const v = vRef; + return validateCode(usedValues, v.source); + } + else if ((n.prefix === "root" || n.prefix === "wrapper") && typeof vRef == "object") { + const { validate, validateName } = vRef; + if (!validateName) + throw new Error("ajv internal error"); + const def = ajv.opts.code.es5 ? scope_1.varKinds.var : scope_1.varKinds.const; + const wrapper = (0, code_1._) `${def} ${n} = {validate: ${validateName}};`; + if (usedState(validateName) === scope_1.UsedValueState.Started) + return wrapper; + const vCode = validateCode(usedValues, validate === null || validate === void 0 ? void 0 : validate.source); + return (0, code_1._) `${wrapper}${_n}${vCode}`; + } + return undefined; + } + function usedState(name) { + var _a; + return (_a = usedValues[name.prefix]) === null || _a === void 0 ? void 0 : _a.get(name); + } + function setUsedState(name, state) { + const { prefix } = name; + const names = (usedValues[prefix] = usedValues[prefix] || new Map()); + names.set(name, state); + } + } +} +module.exports = exports = standaloneCode; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.default = standaloneCode; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/standalone/index.js.map b/node_modules/schema-utils/node_modules/ajv/dist/standalone/index.js.map new file mode 100644 index 000000000..11864d36e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/standalone/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/standalone/index.ts"],"names":[],"mappings":";;AAGA,oDAAkG;AAClG,kDAA0F;AAE1F,SAAS,cAAc,CACrB,GAAY,EACZ,UAA2D;IAE3D,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;QACzB,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAA;KACzE;IACD,MAAM,EAAC,EAAE,EAAC,GAAG,GAAG,CAAC,KAAK,CAAC,IAAI,CAAA;IAC3B,OAAO,OAAO,UAAU,IAAI,UAAU;QACpC,CAAC,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC;QACnC,CAAC,CAAC,UAAU,KAAK,SAAS;YAC1B,CAAC,CAAC,gBAAgB,CAAS,UAAU,EAAE,WAAW,CAAC;YACnD,CAAC,CAAC,gBAAgB,CAAY,GAAG,CAAC,OAAO,E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C/D,MAAM,EAAC,MAAM,EAAC,GAAG,IAAI,CAAA;YACrB,MAAM,KAAK,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC,CAAA;YACpE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;QACxB,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,OAAO,GAAG,OAAO,GAAG,cAAc,CAAA;AACzC,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC,CAAA;AAE3D,kBAAe,cAAc,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/standalone/instance.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/standalone/instance.d.ts new file mode 100644 index 000000000..156ac3226 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/standalone/instance.d.ts @@ -0,0 +1,12 @@ +import Ajv, { AnySchema, AnyValidateFunction, ErrorObject } from "../core"; +export default class AjvPack { + readonly ajv: Ajv; + errors?: ErrorObject[] | null; + constructor(ajv: Ajv); + validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise; + compile(schema: AnySchema, meta?: boolean): AnyValidateFunction; + getSchema(keyRef: string): AnyValidateFunction | undefined; + private getStandalone; + addSchema(...args: Parameters): AjvPack; + addKeyword(...args: Parameters): AjvPack; +} diff --git a/node_modules/schema-utils/node_modules/ajv/dist/standalone/instance.js b/node_modules/schema-utils/node_modules/ajv/dist/standalone/instance.js new file mode 100644 index 000000000..35e5c9925 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/standalone/instance.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const core_1 = require("../core"); +const _1 = require("."); +const requireFromString = require("require-from-string"); +class AjvPack { + constructor(ajv) { + this.ajv = ajv; + } + validate(schemaKeyRef, data) { + return core_1.default.prototype.validate.call(this, schemaKeyRef, data); + } + compile(schema, meta) { + return this.getStandalone(this.ajv.compile(schema, meta)); + } + getSchema(keyRef) { + const v = this.ajv.getSchema(keyRef); + if (!v) + return undefined; + return this.getStandalone(v); + } + getStandalone(v) { + return requireFromString((0, _1.default)(this.ajv, v)); + } + addSchema(...args) { + this.ajv.addSchema.call(this.ajv, ...args); + return this; + } + addKeyword(...args) { + this.ajv.addKeyword.call(this.ajv, ...args); + return this; + } +} +exports.default = AjvPack; +//# sourceMappingURL=instance.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/standalone/instance.js.map b/node_modules/schema-utils/node_modules/ajv/dist/standalone/instance.js.map new file mode 100644 index 000000000..6ac33b114 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/standalone/instance.js.map @@ -0,0 +1 @@ +{"version":3,"file":"instance.js","sourceRoot":"","sources":["../../lib/standalone/instance.ts"],"names":[],"mappings":";;AAAA,kCAAwE;AACxE,wBAA8B;AAC9B,yDAAwD;AAExD,MAAqB,OAAO;IAE1B,YAAqB,GAAQ;QAAR,QAAG,GAAH,GAAG,CAAK;IAAG,CAAC;IAEjC,QAAQ,CAAC,YAAgC,EAAE,IAAa;QACtD,OAAO,cAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,CAAC,CAAA;IAC9D,CAAC;IAED,OAAO,CAAc,MAAiB,EAAE,IAAc;QACpD,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAI,MAAM,EAAE,IAAI,CAAC,CAAC,CAAA;IAC9D,CAAC;IAED,SAAS,CAAc,MAAc;QACnC,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAI,MAAM,CAAC,CAAA;QACvC,IAAI,CAAC,CAAC;YAAE,OAAO,SAAS,CAAA;QACxB,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAA;IAC9B,CAAC;IAEO,aAAa,CAAc,CAAyB;QAC1D,OAAO,iBAAiB,CAAC,IAAA,UAAc,EAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAA2B,CAAA;IACjF,CAAC;IAED,SAAS,CAAC,GAAG,IAAgD;QAC3D,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;QAC1C,OAAO,IAAI,CAAA;IACb,CAAC;IAED,UAAU,CAAC,GAAG,IAAiD;QAC7D,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAA;QAC3C,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA/BD,0BA+BC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/types/index.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/types/index.d.ts new file mode 100644 index 000000000..065261e9f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/types/index.d.ts @@ -0,0 +1,183 @@ +import * as URI from "uri-js"; +import type { CodeGen, Code, Name, ScopeValueSets, ValueScopeName } from "../compile/codegen"; +import type { SchemaEnv, SchemaCxt, SchemaObjCxt } from "../compile"; +import type { JSONType } from "../compile/rules"; +import type { KeywordCxt } from "../compile/validate"; +import type Ajv from "../core"; +interface _SchemaObject { + id?: string; + $id?: string; + $schema?: string; + [x: string]: any; +} +export interface SchemaObject extends _SchemaObject { + id?: string; + $id?: string; + $schema?: string; + $async?: false; + [x: string]: any; +} +export interface AsyncSchema extends _SchemaObject { + $async: true; +} +export declare type AnySchemaObject = SchemaObject | AsyncSchema; +export declare type Schema = SchemaObject | boolean; +export declare type AnySchema = Schema | AsyncSchema; +export declare type SchemaMap = { + [Key in string]?: AnySchema; +}; +export interface SourceCode { + validateName: ValueScopeName; + validateCode: string; + scopeValues: ScopeValueSets; + evaluated?: Code; +} +export interface DataValidationCxt { + instancePath: string; + parentData: { + [K in T]: any; + }; + parentDataProperty: T; + rootData: Record | any[]; + dynamicAnchors: { + [Ref in string]?: ValidateFunction; + }; +} +export interface ValidateFunction { + (this: Ajv | any, data: any, dataCxt?: DataValidationCxt): data is T; + errors?: null | ErrorObject[]; + evaluated?: Evaluated; + schema: AnySchema; + schemaEnv: SchemaEnv; + source?: SourceCode; +} +export interface JTDParser { + (json: string): T | undefined; + message?: string; + position?: number; +} +export declare type EvaluatedProperties = { + [K in string]?: true; +} | true; +export declare type EvaluatedItems = number | true; +export interface Evaluated { + props?: EvaluatedProperties; + items?: EvaluatedItems; + dynamicProps: boolean; + dynamicItems: boolean; +} +export interface AsyncValidateFunction extends ValidateFunction { + (...args: Parameters>): Promise; + $async: true; +} +export declare type AnyValidateFunction = ValidateFunction | AsyncValidateFunction; +export interface ErrorObject, S = unknown> { + keyword: K; + instancePath: string; + schemaPath: string; + params: P; + propertyName?: string; + message?: string; + schema?: S; + parentSchema?: AnySchemaObject; + data?: unknown; +} +export declare type ErrorNoParams = ErrorObject, S>; +interface _KeywordDef { + keyword: string | string[]; + type?: JSONType | JSONType[]; + schemaType?: JSONType | JSONType[]; + allowUndefined?: boolean; + $data?: boolean; + implements?: string[]; + before?: string; + post?: boolean; + metaSchema?: AnySchemaObject; + validateSchema?: AnyValidateFunction; + dependencies?: string[]; + error?: KeywordErrorDefinition; + $dataError?: KeywordErrorDefinition; +} +export interface CodeKeywordDefinition extends _KeywordDef { + code: (cxt: KeywordCxt, ruleType?: string) => void; + trackErrors?: boolean; +} +export declare type MacroKeywordFunc = (schema: any, parentSchema: AnySchemaObject, it: SchemaCxt) => AnySchema; +export declare type CompileKeywordFunc = (schema: any, parentSchema: AnySchemaObject, it: SchemaObjCxt) => DataValidateFunction; +export interface DataValidateFunction { + (...args: Parameters): boolean | Promise; + errors?: Partial[]; +} +export interface SchemaValidateFunction { + (schema: any, data: any, parentSchema?: AnySchemaObject, dataCxt?: DataValidationCxt): boolean | Promise; + errors?: Partial[]; +} +export interface FuncKeywordDefinition extends _KeywordDef { + validate?: SchemaValidateFunction | DataValidateFunction; + compile?: CompileKeywordFunc; + schema?: boolean; + modifying?: boolean; + async?: boolean; + valid?: boolean; + errors?: boolean | "full"; +} +export interface MacroKeywordDefinition extends FuncKeywordDefinition { + macro: MacroKeywordFunc; +} +export declare type KeywordDefinition = CodeKeywordDefinition | FuncKeywordDefinition | MacroKeywordDefinition; +export declare type AddedKeywordDefinition = KeywordDefinition & { + type: JSONType[]; + schemaType: JSONType[]; +}; +export interface KeywordErrorDefinition { + message: string | Code | ((cxt: KeywordErrorCxt) => string | Code); + params?: Code | ((cxt: KeywordErrorCxt) => Code); +} +export declare type Vocabulary = (KeywordDefinition | string)[]; +export interface KeywordErrorCxt { + gen: CodeGen; + keyword: string; + data: Name; + $data?: string | false; + schema: any; + parentSchema?: AnySchemaObject; + schemaCode: Code | number | boolean; + schemaValue: Code | number | boolean; + schemaType?: JSONType[]; + errsCount?: Name; + params: KeywordCxtParams; + it: SchemaCxt; +} +export declare type KeywordCxtParams = { + [P in string]?: Code | string | number; +}; +export declare type FormatValidator = (data: T) => boolean; +export declare type FormatCompare = (data1: T, data2: T) => number | undefined; +export declare type AsyncFormatValidator = (data: T) => Promise; +export interface FormatDefinition { + type?: T extends string ? "string" | undefined : "number"; + validate: FormatValidator | (T extends string ? string | RegExp : never); + async?: false | undefined; + compare?: FormatCompare; +} +export interface AsyncFormatDefinition { + type?: T extends string ? "string" | undefined : "number"; + validate: AsyncFormatValidator; + async: true; + compare?: FormatCompare; +} +export declare type AddedFormat = true | RegExp | FormatValidator | FormatDefinition | FormatDefinition | AsyncFormatDefinition | AsyncFormatDefinition; +export declare type Format = AddedFormat | string; +export interface RegExpEngine { + (pattern: string, u: string): RegExpLike; + code: string; +} +export interface RegExpLike { + test: (s: string) => boolean; +} +export interface UriResolver { + parse(uri: string): URI.URIComponents; + resolve(base: string, path: string): string; + serialize(component: URI.URIComponents): string; +} +export {}; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/types/index.js b/node_modules/schema-utils/node_modules/ajv/dist/types/index.js new file mode 100644 index 000000000..aa219d8f2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/types/index.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/types/index.js.map b/node_modules/schema-utils/node_modules/ajv/dist/types/index.js.map new file mode 100644 index 000000000..1f80f85ec --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/types/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/types/index.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/types/json-schema.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/types/json-schema.d.ts new file mode 100644 index 000000000..78ec842fa --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/types/json-schema.d.ts @@ -0,0 +1,124 @@ +declare type StrictNullChecksWrapper = undefined extends null ? `strictNullChecks must be true in tsconfig to use ${Name}` : Type; +declare type UnionToIntersection = (U extends any ? (_: U) => void : never) extends (_: infer I) => void ? I : never; +export declare type SomeJSONSchema = UncheckedJSONSchemaType; +declare type UncheckedPartialSchema = Partial>; +export declare type PartialSchema = StrictNullChecksWrapper<"PartialSchema", UncheckedPartialSchema>; +declare type JSONType = IsPartial extends true ? T | undefined : T; +interface NumberKeywords { + minimum?: number; + maximum?: number; + exclusiveMinimum?: number; + exclusiveMaximum?: number; + multipleOf?: number; + format?: string; +} +interface StringKeywords { + minLength?: number; + maxLength?: number; + pattern?: string; + format?: string; +} +declare type UncheckedJSONSchemaType = (// these two unions allow arbitrary unions of types +{ + anyOf: readonly UncheckedJSONSchemaType[]; +} | { + oneOf: readonly UncheckedJSONSchemaType[]; +} | ({ + type: readonly (T extends number ? JSONType<"number" | "integer", IsPartial> : T extends string ? JSONType<"string", IsPartial> : T extends boolean ? JSONType<"boolean", IsPartial> : never)[]; +} & UnionToIntersection) | ((T extends number ? { + type: JSONType<"number" | "integer", IsPartial>; +} & NumberKeywords : T extends string ? { + type: JSONType<"string", IsPartial>; +} & StringKeywords : T extends boolean ? { + type: JSONType<"boolean", IsPartial>; +} : T extends readonly [any, ...any[]] ? { + type: JSONType<"array", IsPartial>; + items: { + readonly [K in keyof T]-?: UncheckedJSONSchemaType & Nullable; + } & { + length: T["length"]; + }; + minItems: T["length"]; +} & ({ + maxItems: T["length"]; +} | { + additionalItems: false; +}) : T extends readonly any[] ? { + type: JSONType<"array", IsPartial>; + items: UncheckedJSONSchemaType; + contains?: UncheckedPartialSchema; + minItems?: number; + maxItems?: number; + minContains?: number; + maxContains?: number; + uniqueItems?: true; + additionalItems?: never; +} : T extends Record ? { + type: JSONType<"object", IsPartial>; + additionalProperties?: boolean | UncheckedJSONSchemaType; + unevaluatedProperties?: boolean | UncheckedJSONSchemaType; + properties?: IsPartial extends true ? Partial> : UncheckedPropertiesSchema; + patternProperties?: Record>; + propertyNames?: Omit, "type"> & { + type?: "string"; + }; + dependencies?: { + [K in keyof T]?: Readonly<(keyof T)[]> | UncheckedPartialSchema; + }; + dependentRequired?: { + [K in keyof T]?: Readonly<(keyof T)[]>; + }; + dependentSchemas?: { + [K in keyof T]?: UncheckedPartialSchema; + }; + minProperties?: number; + maxProperties?: number; +} & (IsPartial extends true ? { + required: Readonly<(keyof T)[]>; +} : [UncheckedRequiredMembers] extends [never] ? { + required?: Readonly[]>; +} : { + required: Readonly[]>; +}) : T extends null ? { + type: JSONType<"null", IsPartial>; + nullable: true; +} : never) & { + allOf?: Readonly[]>; + anyOf?: Readonly[]>; + oneOf?: Readonly[]>; + if?: UncheckedPartialSchema; + then?: UncheckedPartialSchema; + else?: UncheckedPartialSchema; + not?: UncheckedPartialSchema; +})) & { + [keyword: string]: any; + $id?: string; + $ref?: string; + $defs?: Record>; + definitions?: Record>; +}; +export declare type JSONSchemaType = StrictNullChecksWrapper<"JSONSchemaType", UncheckedJSONSchemaType>; +declare type Known = { + [key: string]: Known; +} | [Known, ...Known[]] | Known[] | number | string | boolean | null; +declare type UncheckedPropertiesSchema = { + [K in keyof T]-?: (UncheckedJSONSchemaType & Nullable) | { + $ref: string; + }; +}; +export declare type PropertiesSchema = StrictNullChecksWrapper<"PropertiesSchema", UncheckedPropertiesSchema>; +declare type UncheckedRequiredMembers = { + [K in keyof T]-?: undefined extends T[K] ? never : K; +}[keyof T]; +export declare type RequiredMembers = StrictNullChecksWrapper<"RequiredMembers", UncheckedRequiredMembers>; +declare type Nullable = undefined extends T ? { + nullable: true; + const?: null; + enum?: Readonly<(T | null)[]>; + default?: T | null; +} : { + const?: T; + enum?: Readonly; + default?: T; +}; +export {}; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/types/json-schema.js b/node_modules/schema-utils/node_modules/ajv/dist/types/json-schema.js new file mode 100644 index 000000000..2d8f98dc5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/types/json-schema.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=json-schema.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/types/json-schema.js.map b/node_modules/schema-utils/node_modules/ajv/dist/types/json-schema.js.map new file mode 100644 index 000000000..ae6b4d0fe --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/types/json-schema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json-schema.js","sourceRoot":"","sources":["../../lib/types/json-schema.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/types/jtd-schema.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/types/jtd-schema.d.ts new file mode 100644 index 000000000..3004e5e5b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/types/jtd-schema.d.ts @@ -0,0 +1,169 @@ +/** numeric strings */ +declare type NumberType = "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32"; +/** string strings */ +declare type StringType = "string" | "timestamp"; +/** Generic JTD Schema without inference of the represented type */ +export declare type SomeJTDSchemaType = (// ref +{ + ref: string; +} | { + type: NumberType | StringType | "boolean"; +} | { + enum: string[]; +} | { + elements: SomeJTDSchemaType; +} | { + values: SomeJTDSchemaType; +} | { + properties: Record; + optionalProperties?: Record; + additionalProperties?: boolean; +} | { + properties?: Record; + optionalProperties: Record; + additionalProperties?: boolean; +} | { + discriminator: string; + mapping: Record; +} | {}) & { + nullable?: boolean; + metadata?: Record; + definitions?: Record; +}; +/** required keys of an object, not undefined */ +declare type RequiredKeys = { + [K in keyof T]-?: undefined extends T[K] ? never : K; +}[keyof T]; +/** optional or undifined-able keys of an object */ +declare type OptionalKeys = { + [K in keyof T]-?: undefined extends T[K] ? K : never; +}[keyof T]; +/** type is true if T is a union type */ +declare type IsUnion_ = false extends (T extends unknown ? ([U] extends [T] ? false : true) : never) ? false : true; +declare type IsUnion = IsUnion_; +/** type is true if T is identically E */ +declare type TypeEquality = [T] extends [E] ? ([E] extends [T] ? true : false) : false; +/** type is true if T or null is identically E or null*/ +declare type NullTypeEquality = TypeEquality; +/** gets only the string literals of a type or null if a type isn't a string literal */ +declare type EnumString = [T] extends [never] ? null : T extends string ? string extends T ? null : T : null; +/** true if type is a union of string literals */ +declare type IsEnum = null extends EnumString> ? false : true; +/** true only if all types are array types (not tuples) */ +declare type IsElements = false extends IsUnion ? [T] extends [readonly unknown[]] ? undefined extends T[0.5] ? false : true : false : false; +/** true if the the type is a values type */ +declare type IsValues = false extends IsUnion> ? TypeEquality, string> : false; +/** true if type is a proeprties type and Union is false, or type is a discriminator type and Union is true */ +declare type IsRecord = Union extends IsUnion> ? null extends EnumString> ? false : true : false; +/** actual schema */ +export declare type JTDSchemaType = Record> = (// refs - where null wasn't specified, must match exactly +(null extends EnumString ? never : ({ + [K in keyof D]: [T] extends [D[K]] ? { + ref: K; + } : never; +}[keyof D] & { + nullable?: false; +}) | (null extends T ? { + [K in keyof D]: [Exclude] extends [Exclude] ? { + ref: K; + } : never; +}[keyof D] & { + nullable: true; +} : never)) | (unknown extends T ? { + nullable?: boolean; +} : never) | ((true extends NullTypeEquality ? { + type: NumberType; +} : true extends NullTypeEquality ? { + type: "boolean"; +} : true extends NullTypeEquality ? { + type: StringType; +} : true extends NullTypeEquality ? { + type: "timestamp"; +} : true extends IsEnum ? { + enum: EnumString>[]; +} : true extends IsElements> ? T extends readonly (infer E)[] ? { + elements: JTDSchemaType; +} : never : true extends IsValues ? T extends Record ? { + values: JTDSchemaType; +} : never : true extends IsRecord ? ([RequiredKeys>] extends [never] ? { + properties?: Record; +} : { + properties: { + [K in RequiredKeys]: JTDSchemaType; + }; +}) & ([OptionalKeys>] extends [never] ? { + optionalProperties?: Record; +} : { + optionalProperties: { + [K in OptionalKeys]: JTDSchemaType, D>; + }; +}) & { + additionalProperties?: boolean; +} : true extends IsRecord ? { + [K in keyof Exclude]-?: Exclude[K] extends string ? { + discriminator: K; + mapping: { + [M in Exclude[K]]: JTDSchemaType, D>; + }; + } : never; +}[keyof Exclude] : never) & (null extends T ? { + nullable: true; +} : { + nullable?: false; +}))) & { + metadata?: Record; + definitions?: { + [K in keyof D]: JTDSchemaType; + }; +}; +declare type JTDDataDef> = // ref +(S extends { + ref: string; +} ? D extends { + [K in S["ref"]]: infer V; +} ? JTDDataDef : never : S extends { + type: NumberType; +} ? number : S extends { + type: "boolean"; +} ? boolean : S extends { + type: "string"; +} ? string : S extends { + type: "timestamp"; +} ? string | Date : S extends { + enum: readonly (infer E)[]; +} ? string extends E ? never : [E] extends [string] ? E : never : S extends { + elements: infer E; +} ? JTDDataDef[] : S extends { + properties: Record; + optionalProperties?: Record; + additionalProperties?: boolean; +} ? { + -readonly [K in keyof S["properties"]]-?: JTDDataDef; +} & { + -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef; +} & ([S["additionalProperties"]] extends [true] ? Record : unknown) : S extends { + properties?: Record; + optionalProperties: Record; + additionalProperties?: boolean; +} ? { + -readonly [K in keyof S["properties"]]-?: JTDDataDef; +} & { + -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef; +} & ([S["additionalProperties"]] extends [true] ? Record : unknown) : S extends { + values: infer V; +} ? Record> : S extends { + discriminator: infer M; + mapping: Record; +} ? [M] extends [string] ? { + [K in keyof S["mapping"]]: JTDDataDef & { + [KM in M]: K; + }; +}[keyof S["mapping"]] : never : unknown) | (S extends { + nullable: true; +} ? null : never); +export declare type JTDDataType = S extends { + definitions: Record; +} ? JTDDataDef : JTDDataDef>; +export {}; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/types/jtd-schema.js b/node_modules/schema-utils/node_modules/ajv/dist/types/jtd-schema.js new file mode 100644 index 000000000..11338aa8a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/types/jtd-schema.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=jtd-schema.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/types/jtd-schema.js.map b/node_modules/schema-utils/node_modules/ajv/dist/types/jtd-schema.js.map new file mode 100644 index 000000000..add89bd77 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/types/jtd-schema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"jtd-schema.js","sourceRoot":"","sources":["../../lib/types/jtd-schema.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts new file mode 100644 index 000000000..89a73f8dd --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalItems.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +export declare type AdditionalItemsError = ErrorObject<"additionalItems", { + limit: number; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export declare function validateAdditionalItems(cxt: KeywordCxt, items: AnySchema[]): void; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js new file mode 100644 index 000000000..608d51eb6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js @@ -0,0 +1,49 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateAdditionalItems = void 0; +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params: { len } }) => (0, codegen_1.str) `must NOT have more than ${len} items`, + params: ({ params: { len } }) => (0, codegen_1._) `{limit: ${len}}`, +}; +const def = { + keyword: "additionalItems", + type: "array", + schemaType: ["boolean", "object"], + before: "uniqueItems", + error, + code(cxt) { + const { parentSchema, it } = cxt; + const { items } = parentSchema; + if (!Array.isArray(items)) { + (0, util_1.checkStrictMode)(it, '"additionalItems" is ignored when "items" is not an array of schemas'); + return; + } + validateAdditionalItems(cxt, items); + }, +}; +function validateAdditionalItems(cxt, items) { + const { gen, schema, data, keyword, it } = cxt; + it.items = true; + const len = gen.const("len", (0, codegen_1._) `${data}.length`); + if (schema === false) { + cxt.setParams({ len: items.length }); + cxt.pass((0, codegen_1._) `${len} <= ${items.length}`); + } + else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) { + const valid = gen.var("valid", (0, codegen_1._) `${len} <= ${items.length}`); // TODO var + gen.if((0, codegen_1.not)(valid), () => validateItems(valid)); + cxt.ok(valid); + } + function validateItems(valid) { + gen.forRange("i", items.length, len, (i) => { + cxt.subschema({ keyword, dataProp: i, dataPropType: util_1.Type.Num }, valid); + if (!it.allErrors) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + }); + } +} +exports.validateAdditionalItems = validateAdditionalItems; +exports.default = def; +//# sourceMappingURL=additionalItems.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map new file mode 100644 index 000000000..b3d1479c2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map @@ -0,0 +1 @@ +{"version":3,"file":"additionalItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/additionalItems.ts"],"names":[],"mappings":";;;AAOA,mDAAuD;AACvD,6CAA2E;AAI3E,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,2BAA2B,GAAG,QAAQ;IACvE,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,GAAG,GAAG;CAChD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,iBAA0B;IACnC,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;IACjC,MAAM,EAAE,aAAa;IACrB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC9B,MAAM,EAAC,KAAK,EAAC,GAAG,YAAY,CAAA;QAC5B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YACzB,IAAA,sBAAe,EAAC,EAAE,EAAE,sEAAsE,CAAC,CAAA;YAC3F,OAAM;SACP;QACD,uBAAuB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;IACrC,CAAC;CACF,CAAA;AAED,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SAAS;gBAAE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;QAC1D,CAAC,CAAC,CAAA;IACJ,CAAC;AACH,CAAC;AAnBD,0DAmBC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts new file mode 100644 index 000000000..f24ba3f5f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, AddedKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export declare type AdditionalPropertiesError = ErrorObject<"additionalProperties", { + additionalProperty: string; +}, AnySchema>; +declare const def: CodeKeywordDefinition & AddedKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js new file mode 100644 index 000000000..1d3374bb7 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js @@ -0,0 +1,106 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const names_1 = require("../../compile/names"); +const util_1 = require("../../compile/util"); +const error = { + message: "must NOT have additional properties", + params: ({ params }) => (0, codegen_1._) `{additionalProperty: ${params.additionalProperty}}`, +}; +const def = { + keyword: "additionalProperties", + type: ["object"], + schemaType: ["boolean", "object"], + allowUndefined: true, + trackErrors: true, + error, + code(cxt) { + const { gen, schema, parentSchema, data, errsCount, it } = cxt; + /* istanbul ignore if */ + if (!errsCount) + throw new Error("ajv implementation error"); + const { allErrors, opts } = it; + it.props = true; + if (opts.removeAdditional !== "all" && (0, util_1.alwaysValidSchema)(it, schema)) + return; + const props = (0, code_1.allSchemaProperties)(parentSchema.properties); + const patProps = (0, code_1.allSchemaProperties)(parentSchema.patternProperties); + checkAdditionalProperties(); + cxt.ok((0, codegen_1._) `${errsCount} === ${names_1.default.errors}`); + function checkAdditionalProperties() { + gen.forIn("key", data, (key) => { + if (!props.length && !patProps.length) + additionalPropertyCode(key); + else + gen.if(isAdditional(key), () => additionalPropertyCode(key)); + }); + } + function isAdditional(key) { + let definedProp; + if (props.length > 8) { + // TODO maybe an option instead of hard-coded 8? + const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema.properties, "properties"); + definedProp = (0, code_1.isOwnProperty)(gen, propsSchema, key); + } + else if (props.length) { + definedProp = (0, codegen_1.or)(...props.map((p) => (0, codegen_1._) `${key} === ${p}`)); + } + else { + definedProp = codegen_1.nil; + } + if (patProps.length) { + definedProp = (0, codegen_1.or)(definedProp, ...patProps.map((p) => (0, codegen_1._) `${(0, code_1.usePattern)(cxt, p)}.test(${key})`)); + } + return (0, codegen_1.not)(definedProp); + } + function deleteAdditional(key) { + gen.code((0, codegen_1._) `delete ${data}[${key}]`); + } + function additionalPropertyCode(key) { + if (opts.removeAdditional === "all" || (opts.removeAdditional && schema === false)) { + deleteAdditional(key); + return; + } + if (schema === false) { + cxt.setParams({ additionalProperty: key }); + cxt.error(); + if (!allErrors) + gen.break(); + return; + } + if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) { + const valid = gen.name("valid"); + if (opts.removeAdditional === "failing") { + applyAdditionalSchema(key, valid, false); + gen.if((0, codegen_1.not)(valid), () => { + cxt.reset(); + deleteAdditional(key); + }); + } + else { + applyAdditionalSchema(key, valid); + if (!allErrors) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + } + } + } + function applyAdditionalSchema(key, valid, errors) { + const subschema = { + keyword: "additionalProperties", + dataProp: key, + dataPropType: util_1.Type.Str, + }; + if (errors === false) { + Object.assign(subschema, { + compositeRule: true, + createErrors: false, + allErrors: false, + }); + } + cxt.subschema(subschema, valid); + } + }, +}; +exports.default = def; +//# sourceMappingURL=additionalProperties.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map new file mode 100644 index 000000000..d2f249f6f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"additionalProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/additionalProperties.ts"],"names":[],"mappings":";;AAOA,kCAAsE;AACtE,mDAAiE;AACjE,+CAAmC;AAEnC,6CAA0E;AAQ1E,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,qCAAqC;IAC9C,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,wBAAwB,MAAM,CAAC,kBAAkB,GAAG;CAC5E,CAAA;AAED,MAAM,GAAG,GAAmD;IAC1D,OAAO,EAAE,sBAAsB;IAC/B,IAAI,EAAE,CAAC,QAAQ,CAAC;IAChB,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;IACjC,cAAc,EAAE,IAAI;IACpB,WAAW,EAAE,IAAI;IACjB,KAAK;IACL,IAAI,CAAC,GAAG;QACN,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC5D,wBAAwB;QACxB,IAAI,CAAC,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QAC3D,MAAM,EAAC,SAAS,EAAE,IAAI,EAAC,GAAG,EAAE,CAAA;QAC5B,EAAE,CAAC,KAAK,GAAG,IAAI,CAAA;QACf,IAAI,IAAI,CAAC,gBAAgB,KAAK,KAAK,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CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE;wBACtB,GAAG,CAAC,KAAK,EAAE,CAAA;wBACX,gBAAgB,CAAC,GAAG,CAAC,CAAA;oBACvB,CAAC,CAAC,CAAA;iBACH;qBAAM;oBACL,qBAAqB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;oBACjC,IAAI,CAAC,SAAS;wBAAE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;iBACtD;aACF;QACH,CAAC;QAED,SAAS,qBAAqB,CAAC,GAAS,EAAE,KAAW,EAAE,MAAc;YACnE,MAAM,SAAS,GAAkB;gBAC/B,OAAO,EAAE,sBAAsB;gBAC/B,QAAQ,EAAE,GAAG;gBACb,YAAY,EAAE,WAAI,CAAC,GAAG;aACvB,CAAA;YACD,IAAI,MAAM,KAAK,KAAK,EAAE;gBACpB,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE;oBACvB,aAAa,EAAE,IAAI;oBACnB,YAAY,EAAE,KAAK;oBACnB,SAAS,EAAE,KAAK;iBACjB,CAAC,CAAA;aACH;YACD,GAAG,CAAC,SAAS,CAAC,SAAS,EAAE,KAAK,CAAC,CAAA;QACjC,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/allOf.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/allOf.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/allOf.js new file mode 100644 index 000000000..1b1ae7376 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/allOf.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const def = { + keyword: "allOf", + schemaType: "array", + code(cxt) { + const { gen, schema, it } = cxt; + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + const valid = gen.name("valid"); + schema.forEach((sch, i) => { + if ((0, util_1.alwaysValidSchema)(it, sch)) + return; + const schCxt = cxt.subschema({ keyword: "allOf", schemaProp: i }, valid); + cxt.ok(valid); + cxt.mergeEvaluated(schCxt); + }); + }, +}; +exports.default = def; +//# sourceMappingURL=allOf.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map new file mode 100644 index 000000000..d119d0eae --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"allOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/allOf.ts"],"names":[],"mappings":";;AAEA,6CAAoD;AAEpD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC7B,wBAAwB;QACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;QACvE,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,MAAM,CAAC,OAAO,CAAC,CAAC,GAAc,EAAE,CAAS,EAAE,EAAE;YAC3C,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,GAAG,CAAC;gBAAE,OAAM;YACtC,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAAC,EAAE,KAAK,CAAC,CAAA;YACtE,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;YACb,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;QAC5B,CAAC,CAAC,CAAA;IACJ,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts new file mode 100644 index 000000000..db3fc0e28 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/anyOf.d.ts @@ -0,0 +1,4 @@ +import type { CodeKeywordDefinition, ErrorNoParams, AnySchema } from "../../types"; +export declare type AnyOfError = ErrorNoParams<"anyOf", AnySchema[]>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/anyOf.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/anyOf.js new file mode 100644 index 000000000..66cfce2cc --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/anyOf.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const def = { + keyword: "anyOf", + schemaType: "array", + trackErrors: true, + code: code_1.validateUnion, + error: { message: "must match a schema in anyOf" }, +}; +exports.default = def; +//# sourceMappingURL=anyOf.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map new file mode 100644 index 000000000..537ffcbeb --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"anyOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/anyOf.ts"],"names":[],"mappings":";;AACA,kCAAqC;AAIrC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,IAAI;IACjB,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE,EAAC,OAAO,EAAE,8BAA8B,EAAC;CACjD,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts new file mode 100644 index 000000000..7e4e96a0e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/contains.d.ts @@ -0,0 +1,7 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export declare type ContainsError = ErrorObject<"contains", { + minContains: number; + maxContains?: number; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/contains.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/contains.js new file mode 100644 index 000000000..6c5473f5d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/contains.js @@ -0,0 +1,95 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params: { min, max } }) => max === undefined + ? (0, codegen_1.str) `must contain at least ${min} valid item(s)` + : (0, codegen_1.str) `must contain at least ${min} and no more than ${max} valid item(s)`, + params: ({ params: { min, max } }) => max === undefined ? (0, codegen_1._) `{minContains: ${min}}` : (0, codegen_1._) `{minContains: ${min}, maxContains: ${max}}`, +}; +const def = { + keyword: "contains", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + trackErrors: true, + error, + code(cxt) { + const { gen, schema, parentSchema, data, it } = cxt; + let min; + let max; + const { minContains, maxContains } = parentSchema; + if (it.opts.next) { + min = minContains === undefined ? 1 : minContains; + max = maxContains; + } + else { + min = 1; + } + const len = gen.const("len", (0, codegen_1._) `${data}.length`); + cxt.setParams({ min, max }); + if (max === undefined && min === 0) { + (0, util_1.checkStrictMode)(it, `"minContains" == 0 without "maxContains": "contains" keyword ignored`); + return; + } + if (max !== undefined && min > max) { + (0, util_1.checkStrictMode)(it, `"minContains" > "maxContains" is always invalid`); + cxt.fail(); + return; + } + if ((0, util_1.alwaysValidSchema)(it, schema)) { + let cond = (0, codegen_1._) `${len} >= ${min}`; + if (max !== undefined) + cond = (0, codegen_1._) `${cond} && ${len} <= ${max}`; + cxt.pass(cond); + return; + } + it.items = true; + const valid = gen.name("valid"); + if (max === undefined && min === 1) { + validateItems(valid, () => gen.if(valid, () => gen.break())); + } + else if (min === 0) { + gen.let(valid, true); + if (max !== undefined) + gen.if((0, codegen_1._) `${data}.length > 0`, validateItemsWithCount); + } + else { + gen.let(valid, false); + validateItemsWithCount(); + } + cxt.result(valid, () => cxt.reset()); + function validateItemsWithCount() { + const schValid = gen.name("_valid"); + const count = gen.let("count", 0); + validateItems(schValid, () => gen.if(schValid, () => checkLimits(count))); + } + function validateItems(_valid, block) { + gen.forRange("i", 0, len, (i) => { + cxt.subschema({ + keyword: "contains", + dataProp: i, + dataPropType: util_1.Type.Num, + compositeRule: true, + }, _valid); + block(); + }); + } + function checkLimits(count) { + gen.code((0, codegen_1._) `${count}++`); + if (max === undefined) { + gen.if((0, codegen_1._) `${count} >= ${min}`, () => gen.assign(valid, true).break()); + } + else { + gen.if((0, codegen_1._) `${count} > ${max}`, () => gen.assign(valid, false).break()); + if (min === 1) + gen.assign(valid, true); + else + gen.if((0, codegen_1._) `${count} >= ${min}`, () => gen.assign(valid, true)); + } + } + }, +}; +exports.default = def; +//# sourceMappingURL=contains.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/contains.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/contains.js.map new file mode 100644 index 000000000..6a0bd39cb --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/contains.js.map @@ -0,0 +1 @@ +{"version":3,"file":"contains.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/contains.ts"],"names":[],"mappings":";;AAOA,mDAAkD;AAClD,6CAA2E;AAQ3E,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,GAAG,EAAC,EAAC,EAAE,EAAE,CAChC,GAAG,KAAK,SAAS;QACf,CAAC,CAAC,IAAA,aAAG,EAAA,yBAAyB,GAAG,gBAAgB;QACjD,CAAC,CAAC,IAAA,aAAG,EAAA,yBAAyB,GAAG,qBAAqB,GAAG,gBAAgB;IAC7E,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAE,GAAG,EAAC,EAAC,EAAE,EAAE,CAC/B,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,iBAAiB,GAAG,GAAG,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,iBAAiB,GAAG,kBAAkB,GAAG,GAAG;CAC/F,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,MAAM,EAAE,aAAa;IACrB,WAAW,EAAE,IAAI;IACjB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACjD,IAAI,GAAW,C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EACD,MAAM,CACP,CAAA;gBACD,KAAK,EAAE,CAAA;YACT,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,SAAS,WAAW,CAAC,KAAW;YAC9B,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,IAAI,CAAC,CAAA;YACvB,IAAI,GAAG,KAAK,SAAS,EAAE;gBACrB,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,OAAO,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;aACrE;iBAAM;gBACL,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,MAAM,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;gBACpE,IAAI,GAAG,KAAK,CAAC;oBAAE,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;;oBACjC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,OAAO,GAAG,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAA;aAClE;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts new file mode 100644 index 000000000..b28cfe421 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependencies.d.ts @@ -0,0 +1,21 @@ +import type { CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition, SchemaMap, AnySchema } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +export declare type PropertyDependencies = { + [K in string]?: string[]; +}; +export interface DependenciesErrorParams { + property: string; + missingProperty: string; + depsCount: number; + deps: string; +} +export declare type DependenciesError = ErrorObject<"dependencies", DependenciesErrorParams, { + [K in string]?: string[] | AnySchema; +}>; +export declare const error: KeywordErrorDefinition; +declare const def: CodeKeywordDefinition; +export declare function validatePropertyDeps(cxt: KeywordCxt, propertyDeps?: { + [K in string]?: string[]; +}): void; +export declare function validateSchemaDeps(cxt: KeywordCxt, schemaDeps?: SchemaMap): void; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependencies.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependencies.js new file mode 100644 index 000000000..e81f86d1d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependencies.js @@ -0,0 +1,85 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = void 0; +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const code_1 = require("../code"); +exports.error = { + message: ({ params: { property, depsCount, deps } }) => { + const property_ies = depsCount === 1 ? "property" : "properties"; + return (0, codegen_1.str) `must have ${property_ies} ${deps} when property ${property} is present`; + }, + params: ({ params: { property, depsCount, deps, missingProperty } }) => (0, codegen_1._) `{property: ${property}, + missingProperty: ${missingProperty}, + depsCount: ${depsCount}, + deps: ${deps}}`, // TODO change to reference +}; +const def = { + keyword: "dependencies", + type: "object", + schemaType: "object", + error: exports.error, + code(cxt) { + const [propDeps, schDeps] = splitDependencies(cxt); + validatePropertyDeps(cxt, propDeps); + validateSchemaDeps(cxt, schDeps); + }, +}; +function splitDependencies({ schema }) { + const propertyDeps = {}; + const schemaDeps = {}; + for (const key in schema) { + if (key === "__proto__") + continue; + const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps; + deps[key] = schema[key]; + } + return [propertyDeps, schemaDeps]; +} +function validatePropertyDeps(cxt, propertyDeps = cxt.schema) { + const { gen, data, it } = cxt; + if (Object.keys(propertyDeps).length === 0) + return; + const missing = gen.let("missing"); + for (const prop in propertyDeps) { + const deps = propertyDeps[prop]; + if (deps.length === 0) + continue; + const hasProperty = (0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties); + cxt.setParams({ + property: prop, + depsCount: deps.length, + deps: deps.join(", "), + }); + if (it.allErrors) { + gen.if(hasProperty, () => { + for (const depProp of deps) { + (0, code_1.checkReportMissingProp)(cxt, depProp); + } + }); + } + else { + gen.if((0, codegen_1._) `${hasProperty} && (${(0, code_1.checkMissingProp)(cxt, deps, missing)})`); + (0, code_1.reportMissingProp)(cxt, missing); + gen.else(); + } + } +} +exports.validatePropertyDeps = validatePropertyDeps; +function validateSchemaDeps(cxt, schemaDeps = cxt.schema) { + const { gen, data, keyword, it } = cxt; + const valid = gen.name("valid"); + for (const prop in schemaDeps) { + if ((0, util_1.alwaysValidSchema)(it, schemaDeps[prop])) + continue; + gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties), () => { + const schCxt = cxt.subschema({ keyword, schemaProp: prop }, valid); + cxt.mergeValidEvaluated(schCxt, valid); + }, () => gen.var(valid, true) // TODO var + ); + cxt.ok(valid); + } +} +exports.validateSchemaDeps = validateSchemaDeps; +exports.default = def; +//# sourceMappingURL=dependencies.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map new file mode 100644 index 000000000..dafffd16b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/dependencies.ts"],"names":[],"mappings":";;;AAQA,mDAA4C;AAC5C,6CAAoD;AACpD,kCAAmG;AAmBtF,QAAA,KAAK,GAA2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C,GAAG,EAAE,OAAO,CAAC,CAAA;YAC/B,GAAG,CAAC,IAAI,EAAE,CAAA;SACX;KACF;AACH,CAAC;AA5BD,oDA4BC;AAED,SAAgB,kBAAkB,CAAC,GAAe,EAAE,aAAwB,GAAG,CAAC,MAAM;IACpF,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IACpC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/B,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE;QAC7B,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,UAAU,CAAC,IAAI,CAAc,CAAC;YAAE,SAAQ;QAClE,GAAG,CAAC,EAAE,CACJ,IAAA,qBAAc,EAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,EACtD,GAAG,EAAE;YACH,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,UAAU,EAAE,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;YAChE,GAAG,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;QACxC,CAAC,EACD,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,WAAW;SACvC,CAAA;QACD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;KACd;AACH,CAAC;AAfD,gDAeC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js new file mode 100644 index 000000000..66ef2e843 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dependencies_1 = require("./dependencies"); +const def = { + keyword: "dependentSchemas", + type: "object", + schemaType: "object", + code: (cxt) => (0, dependencies_1.validateSchemaDeps)(cxt), +}; +exports.default = def; +//# sourceMappingURL=dependentSchemas.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map new file mode 100644 index 000000000..17712e6fb --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/dependentSchemas.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dependentSchemas.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/dependentSchemas.ts"],"names":[],"mappings":";;AACA,iDAAiD;AAEjD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,iCAAkB,EAAC,GAAG,CAAC;CACvC,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/if.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/if.d.ts new file mode 100644 index 000000000..3c3e78dd6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/if.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export declare type IfKeywordError = ErrorObject<"if", { + failingKeyword: string; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/if.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/if.js new file mode 100644 index 000000000..2c42a3e9c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/if.js @@ -0,0 +1,66 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params }) => (0, codegen_1.str) `must match "${params.ifClause}" schema`, + params: ({ params }) => (0, codegen_1._) `{failingKeyword: ${params.ifClause}}`, +}; +const def = { + keyword: "if", + schemaType: ["object", "boolean"], + trackErrors: true, + error, + code(cxt) { + const { gen, parentSchema, it } = cxt; + if (parentSchema.then === undefined && parentSchema.else === undefined) { + (0, util_1.checkStrictMode)(it, '"if" without "then" and "else" is ignored'); + } + const hasThen = hasSchema(it, "then"); + const hasElse = hasSchema(it, "else"); + if (!hasThen && !hasElse) + return; + const valid = gen.let("valid", true); + const schValid = gen.name("_valid"); + validateIf(); + cxt.reset(); + if (hasThen && hasElse) { + const ifClause = gen.let("ifClause"); + cxt.setParams({ ifClause }); + gen.if(schValid, validateClause("then", ifClause), validateClause("else", ifClause)); + } + else if (hasThen) { + gen.if(schValid, validateClause("then")); + } + else { + gen.if((0, codegen_1.not)(schValid), validateClause("else")); + } + cxt.pass(valid, () => cxt.error(true)); + function validateIf() { + const schCxt = cxt.subschema({ + keyword: "if", + compositeRule: true, + createErrors: false, + allErrors: false, + }, schValid); + cxt.mergeEvaluated(schCxt); + } + function validateClause(keyword, ifClause) { + return () => { + const schCxt = cxt.subschema({ keyword }, schValid); + gen.assign(valid, schValid); + cxt.mergeValidEvaluated(schCxt, valid); + if (ifClause) + gen.assign(ifClause, (0, codegen_1._) `${keyword}`); + else + cxt.setParams({ ifClause: keyword }); + }; + } + }, +}; +function hasSchema(it, keyword) { + const schema = it.schema[keyword]; + return schema !== undefined && !(0, util_1.alwaysValidSchema)(it, schema); +} +exports.default = def; +//# sourceMappingURL=if.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/if.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/if.js.map new file mode 100644 index 000000000..34b3a5539 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/if.js.map @@ -0,0 +1 @@ +{"version":3,"file":"if.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/if.ts"],"names":[],"mappings":";;AAQA,mDAAuD;AACvD,6CAAqE;AAIrE,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,eAAe,MAAM,CAAC,QAAQ,UAAU;IAClE,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,oBAAoB,MAAM,CAAC,QAAQ,GAAG;CAC9D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,WAAW,EAAE,IAAI;IACjB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,IAAI,YAAY,CAAC,IAAI,KAAK,SAAS,IAAI,YAAY,CAAC,IAAI,KAAK,SAAS,EAAE;YACtE,IAAA,sBAAe,EAAC,EAAE,EAAE,2CAA2C,CAAC,CAAA;SACjE;QACD,MAAM,OAAO,GAAG,SAAS,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;QACrC,MAAM,OAAO,GAAG,SAAS,CAAC,EAAE,EAAE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AG,EAAE;gBACV,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAC,EAAE,QAAQ,CAAC,CAAA;gBACjD,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;gBAC3B,GAAG,CAAC,mBAAmB,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;gBACtC,IAAI,QAAQ;oBAAE,GAAG,CAAC,MAAM,CAAC,QAAQ,EAAE,IAAA,WAAC,EAAA,GAAG,OAAO,EAAE,CAAC,CAAA;;oBAC5C,GAAG,CAAC,SAAS,CAAC,EAAC,QAAQ,EAAE,OAAO,EAAC,CAAC,CAAA;YACzC,CAAC,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,SAAS,SAAS,CAAC,EAAgB,EAAE,OAAe;IAClD,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IACjC,OAAO,MAAM,KAAK,SAAS,IAAI,CAAC,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,CAAA;AAC/D,CAAC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/index.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/index.d.ts new file mode 100644 index 000000000..f45239bd5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/index.d.ts @@ -0,0 +1,13 @@ +import type { ErrorNoParams, Vocabulary } from "../../types"; +import { AdditionalItemsError } from "./additionalItems"; +import { ItemsError } from "./items2020"; +import { ContainsError } from "./contains"; +import { DependenciesError } from "./dependencies"; +import { PropertyNamesError } from "./propertyNames"; +import { AdditionalPropertiesError } from "./additionalProperties"; +import { NotKeywordError } from "./not"; +import { AnyOfError } from "./anyOf"; +import { OneOfError } from "./oneOf"; +import { IfKeywordError } from "./if"; +export default function getApplicator(draft2020?: boolean): Vocabulary; +export declare type ApplicatorKeywordError = ErrorNoParams<"false schema"> | AdditionalItemsError | ItemsError | ContainsError | AdditionalPropertiesError | DependenciesError | IfKeywordError | AnyOfError | OneOfError | NotKeywordError | PropertyNamesError; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/index.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/index.js new file mode 100644 index 000000000..cf592f279 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/index.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const additionalItems_1 = require("./additionalItems"); +const prefixItems_1 = require("./prefixItems"); +const items_1 = require("./items"); +const items2020_1 = require("./items2020"); +const contains_1 = require("./contains"); +const dependencies_1 = require("./dependencies"); +const propertyNames_1 = require("./propertyNames"); +const additionalProperties_1 = require("./additionalProperties"); +const properties_1 = require("./properties"); +const patternProperties_1 = require("./patternProperties"); +const not_1 = require("./not"); +const anyOf_1 = require("./anyOf"); +const oneOf_1 = require("./oneOf"); +const allOf_1 = require("./allOf"); +const if_1 = require("./if"); +const thenElse_1 = require("./thenElse"); +function getApplicator(draft2020 = false) { + const applicator = [ + // any + not_1.default, + anyOf_1.default, + oneOf_1.default, + allOf_1.default, + if_1.default, + thenElse_1.default, + // object + propertyNames_1.default, + additionalProperties_1.default, + dependencies_1.default, + properties_1.default, + patternProperties_1.default, + ]; + // array + if (draft2020) + applicator.push(prefixItems_1.default, items2020_1.default); + else + applicator.push(additionalItems_1.default, items_1.default); + applicator.push(contains_1.default); + return applicator; +} +exports.default = getApplicator; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/index.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/index.js.map new file mode 100644 index 000000000..ebcb8534d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/index.ts"],"names":[],"mappings":";;AACA,uDAAuE;AACvE,+CAAuC;AACvC,mCAA2B;AAC3B,2CAAiD;AACjD,yCAAkD;AAClD,iDAA8D;AAC9D,mDAAiE;AACjE,iEAAsF;AACtF,6CAAqC;AACrC,2DAAmD;AACnD,+BAAiD;AACjD,mCAAyC;AACzC,mCAAyC;AACzC,mCAA2B;AAC3B,6BAA8C;AAC9C,yCAAiC;AAEjC,SAAwB,aAAa,CAAC,SAAS,GAAG,KAAK;IACrD,MAAM,UAAU,GAAG;QACjB,MAAM;QACN,aAAU;QACV,eAAK;QACL,eAAK;QACL,eAAK;QACL,YAAS;QACT,kBAAQ;QACR,SAAS;QACT,uBAAa;QACb,8BAAoB;QACpB,sBAAY;QACZ,oBAAU;QACV,2BAAiB;KAClB,CAAA;IACD,QAAQ;IACR,IAAI,SAAS;QAAE,UAAU,CAAC,IAAI,CAAC,qBAAW,EAAE,mBAAS,CAAC,CAAA;;QACjD,UAAU,CAAC,IAAI,CAAC,yBAAe,EAAE,eAAK,CAAC,CAAA;IAC5C,UAAU,CAAC,IAAI,CAAC,kBAAQ,CAAC,CAAA;IACzB,OAAO,UAAU,CAAA;AACnB,CAAC;AArBD,gCAqBC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/items.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/items.d.ts new file mode 100644 index 000000000..8e608ca9c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/items.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition, AnySchema } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +declare const def: CodeKeywordDefinition; +export declare function validateTuple(cxt: KeywordCxt, extraItems: string, schArr?: AnySchema[]): void; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/items.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/items.js new file mode 100644 index 000000000..26f527bc6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/items.js @@ -0,0 +1,52 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateTuple = void 0; +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const code_1 = require("../code"); +const def = { + keyword: "items", + type: "array", + schemaType: ["object", "array", "boolean"], + before: "uniqueItems", + code(cxt) { + const { schema, it } = cxt; + if (Array.isArray(schema)) + return validateTuple(cxt, "additionalItems", schema); + it.items = true; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + cxt.ok((0, code_1.validateArray)(cxt)); + }, +}; +function validateTuple(cxt, extraItems, schArr = cxt.schema) { + const { gen, parentSchema, data, keyword, it } = cxt; + checkStrictTuple(parentSchema); + if (it.opts.unevaluated && schArr.length && it.items !== true) { + it.items = util_1.mergeEvaluated.items(gen, schArr.length, it.items); + } + const valid = gen.name("valid"); + const len = gen.const("len", (0, codegen_1._) `${data}.length`); + schArr.forEach((sch, i) => { + if ((0, util_1.alwaysValidSchema)(it, sch)) + return; + gen.if((0, codegen_1._) `${len} > ${i}`, () => cxt.subschema({ + keyword, + schemaProp: i, + dataProp: i, + }, valid)); + cxt.ok(valid); + }); + function checkStrictTuple(sch) { + const { opts, errSchemaPath } = it; + const l = schArr.length; + const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false); + if (opts.strictTuples && !fullTuple) { + const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"`; + (0, util_1.checkStrictMode)(it, msg, opts.strictTuples); + } + } +} +exports.validateTuple = validateTuple; +exports.default = def; +//# sourceMappingURL=items.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/items.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/items.js.map new file mode 100644 index 000000000..3c4ce614c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/items.js.map @@ -0,0 +1 @@ +{"version":3,"file":"items.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/items.ts"],"names":[],"mappings":";;;AAEA,mDAAuC;AACvC,6CAAqF;AACrF,kCAAqC;AAErC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;IAC1C,MAAM,EAAE,aAAa;IACrB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACxB,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;YAAE,OAAO,aAAa,CAAC,GAAG,EAAE,iBAAiB,EAAE,MAAM,CAAC,CAAA;QAC/E,EAAE,CAAC,KAAK,GAAG,IAAI,CAAA;QACf,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,GAAG,CAAC,EAAE,CAAC,IAAA,oBAAa,EAAC,GAAG,CAAC,CAAC,CAAA;IAC5B,CAAC;CACF,CAAA;AAED,SAAgB,aAAa,CAC3B,GAAe,EACf,UAAkB,EAClB,SAAsB,GAAG,CAAC,MAAM;IAEhC,MAAM,EAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IAClD,gBAAgB,CAAC,YAAY,CAAC,CAAA;IAC9B,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,EAAE;QAC7D,EAAE,CAAC,KAAK,GAAG,qBAAc,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,CAAA;KAC9D;IACD,MA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/applicator/items2020.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts new file mode 100644 index 000000000..4168c7f96 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/items2020.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export declare type ItemsError = ErrorObject<"items", { + limit: number; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/items2020.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/items2020.js new file mode 100644 index 000000000..f2387d7d2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/items2020.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const code_1 = require("../code"); +const additionalItems_1 = require("./additionalItems"); +const error = { + message: ({ params: { len } }) => (0, codegen_1.str) `must NOT have more than ${len} items`, + params: ({ params: { len } }) => (0, codegen_1._) `{limit: ${len}}`, +}; +const def = { + keyword: "items", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + error, + code(cxt) { + const { schema, parentSchema, it } = cxt; + const { prefixItems } = parentSchema; + it.items = true; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + if (prefixItems) + (0, additionalItems_1.validateAdditionalItems)(cxt, prefixItems); + else + cxt.ok((0, code_1.validateArray)(cxt)); + }, +}; +exports.default = def; +//# sourceMappingURL=items2020.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map new file mode 100644 index 000000000..5034acda6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map @@ -0,0 +1 @@ +{"version":3,"file":"items2020.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/items2020.ts"],"names":[],"mappings":";;AAOA,mDAA4C;AAC5C,6CAAoD;AACpD,kCAAqC;AACrC,uDAAyD;AAIzD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,2BAA2B,GAAG,QAAQ;IACvE,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,GAAG,GAAG;CAChD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,MAAM,EAAE,aAAa;IACrB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,MAAM,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACtC,MAAM,EAAC,WAAW,EAAC,GAAG,YAAY,CAAA;QAClC,EAAE,CAAC,KAAK,GAAG,IAAI,CAAA;QACf,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,IAAI,WAAW;YAAE,IAAA,yCAAuB,EAAC,GAAG,EAAE,WAAW,CAAC,CAAA;;YACrD,GAAG,CAAC,EAAE,CAAC,IAAA,oBAAa,EAAC,GAAG,CAAC,CAAC,CAAA;IACjC,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/not.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/not.d.ts new file mode 100644 index 000000000..b8c37cab6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/not.d.ts @@ -0,0 +1,4 @@ +import type { CodeKeywordDefinition, ErrorNoParams, AnySchema } from "../../types"; +export declare type NotKeywordError = ErrorNoParams<"not", AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/not.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/not.js new file mode 100644 index 000000000..89f6fddac --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/not.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const def = { + keyword: "not", + schemaType: ["object", "boolean"], + trackErrors: true, + code(cxt) { + const { gen, schema, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) { + cxt.fail(); + return; + } + const valid = gen.name("valid"); + cxt.subschema({ + keyword: "not", + compositeRule: true, + createErrors: false, + allErrors: false, + }, valid); + cxt.failResult(valid, () => cxt.reset(), () => cxt.error()); + }, + error: { message: "must NOT be valid" }, +}; +exports.default = def; +//# sourceMappingURL=not.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/not.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/not.js.map new file mode 100644 index 000000000..5e2a1ca11 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/not.js.map @@ -0,0 +1 @@ +{"version":3,"file":"not.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/not.ts"],"names":[],"mappings":";;AAEA,6CAAoD;AAIpD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,WAAW,EAAE,IAAI;IACjB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC7B,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,EAAE;YACjC,GAAG,CAAC,IAAI,EAAE,CAAA;YACV,OAAM;SACP;QAED,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,GAAG,CAAC,SAAS,CACX;YACE,OAAO,EAAE,KAAK;YACd,aAAa,EAAE,IAAI;YACnB,YAAY,EAAE,KAAK;YACnB,SAAS,EAAE,KAAK;SACjB,EACD,KAAK,CACN,CAAA;QAED,GAAG,CAAC,UAAU,CACZ,KAAK,EACL,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,EACjB,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAClB,CAAA;IACH,CAAC;IACD,KAAK,EAAE,EAAC,OAAO,EAAE,mBAAmB,EAAC;CACtC,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts new file mode 100644 index 000000000..01df87ab4 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/oneOf.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export declare type OneOfError = ErrorObject<"oneOf", { + passingSchemas: [number, number] | null; +}, AnySchema[]>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/oneOf.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/oneOf.js new file mode 100644 index 000000000..441db2ac0 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/oneOf.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: "must match exactly one schema in oneOf", + params: ({ params }) => (0, codegen_1._) `{passingSchemas: ${params.passing}}`, +}; +const def = { + keyword: "oneOf", + schemaType: "array", + trackErrors: true, + error, + code(cxt) { + const { gen, schema, parentSchema, it } = cxt; + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + if (it.opts.discriminator && parentSchema.discriminator) + return; + const schArr = schema; + const valid = gen.let("valid", false); + const passing = gen.let("passing", null); + const schValid = gen.name("_valid"); + cxt.setParams({ passing }); + // TODO possibly fail straight away (with warning or exception) if there are two empty always valid schemas + gen.block(validateOneOf); + cxt.result(valid, () => cxt.reset(), () => cxt.error(true)); + function validateOneOf() { + schArr.forEach((sch, i) => { + let schCxt; + if ((0, util_1.alwaysValidSchema)(it, sch)) { + gen.var(schValid, true); + } + else { + schCxt = cxt.subschema({ + keyword: "oneOf", + schemaProp: i, + compositeRule: true, + }, schValid); + } + if (i > 0) { + gen + .if((0, codegen_1._) `${schValid} && ${valid}`) + .assign(valid, false) + .assign(passing, (0, codegen_1._) `[${passing}, ${i}]`) + .else(); + } + gen.if(schValid, () => { + gen.assign(valid, true); + gen.assign(passing, i); + if (schCxt) + cxt.mergeEvaluated(schCxt, codegen_1.Name); + }); + }); + } + }, +}; +exports.default = def; +//# sourceMappingURL=oneOf.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map new file mode 100644 index 000000000..6cc54de65 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"oneOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/oneOf.ts"],"names":[],"mappings":";;AAOA,mDAA6C;AAC7C,6CAAoD;AASpD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,wCAAwC;IACjD,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAA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Q,EAAE,IAAI,CAAC,CAAA;iBACxB;qBAAM;oBACL,MAAM,GAAG,GAAG,CAAC,SAAS,CACpB;wBACE,OAAO,EAAE,OAAO;wBAChB,UAAU,EAAE,CAAC;wBACb,aAAa,EAAE,IAAI;qBACpB,EACD,QAAQ,CACT,CAAA;iBACF;gBAED,IAAI,CAAC,GAAG,CAAC,EAAE;oBACT,GAAG;yBACA,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,QAAQ,OAAO,KAAK,EAAE,CAAC;yBAC9B,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC;yBACpB,MAAM,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,IAAI,OAAO,KAAK,CAAC,GAAG,CAAC;yBACtC,IAAI,EAAE,CAAA;iBACV;gBAED,GAAG,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;oBACpB,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;oBACvB,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;oBACtB,IAAI,MAAM;wBAAE,GAAG,CAAC,cAAc,CAAC,MAAM,EAAE,cAAI,CAAC,CAAA;gBAC9C,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/patternProperties.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js new file mode 100644 index 000000000..48501c6e3 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js @@ -0,0 +1,75 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const util_2 = require("../../compile/util"); +const def = { + keyword: "patternProperties", + type: "object", + schemaType: "object", + code(cxt) { + const { gen, schema, data, parentSchema, it } = cxt; + const { opts } = it; + const patterns = (0, code_1.allSchemaProperties)(schema); + const alwaysValidPatterns = patterns.filter((p) => (0, util_1.alwaysValidSchema)(it, schema[p])); + if (patterns.length === 0 || + (alwaysValidPatterns.length === patterns.length && + (!it.opts.unevaluated || it.props === true))) { + return; + } + const checkProperties = opts.strictSchema && !opts.allowMatchingProperties && parentSchema.properties; + const valid = gen.name("valid"); + if (it.props !== true && !(it.props instanceof codegen_1.Name)) { + it.props = (0, util_2.evaluatedPropsToName)(gen, it.props); + } + const { props } = it; + validatePatternProperties(); + function validatePatternProperties() { + for (const pat of patterns) { + if (checkProperties) + checkMatchingProperties(pat); + if (it.allErrors) { + validateProperties(pat); + } + else { + gen.var(valid, true); // TODO var + validateProperties(pat); + gen.if(valid); + } + } + } + function checkMatchingProperties(pat) { + for (const prop in checkProperties) { + if (new RegExp(pat).test(prop)) { + (0, util_1.checkStrictMode)(it, `property ${prop} matches pattern ${pat} (use allowMatchingProperties)`); + } + } + } + function validateProperties(pat) { + gen.forIn("key", data, (key) => { + gen.if((0, codegen_1._) `${(0, code_1.usePattern)(cxt, pat)}.test(${key})`, () => { + const alwaysValid = alwaysValidPatterns.includes(pat); + if (!alwaysValid) { + cxt.subschema({ + keyword: "patternProperties", + schemaProp: pat, + dataProp: key, + dataPropType: util_2.Type.Str, + }, valid); + } + if (it.opts.unevaluated && props !== true) { + gen.assign((0, codegen_1._) `${props}[${key}]`, true); + } + else if (!alwaysValid && !it.allErrors) { + // can short-circuit if `unevaluatedProperties` is not supported (opts.next === false) + // or if all properties were evaluated (props === true) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + } + }); + }); + } + }, +}; +exports.default = def; +//# sourceMappingURL=patternProperties.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map new file mode 100644 index 000000000..2a60b74a5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"patternProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/patternProperties.ts"],"names":[],"mappings":";;AAEA,kCAAuD;AACvD,mDAAkD;AAClD,6CAAqE;AACrE,6CAA6D;AAG7D,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,mBAAmB;IAC5B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACjD,MAAM,EAAC,IAAI,EAAC,GAAG,EAAE,CAAA;QACjB,MAAM,QAAQ,GAAG,IAAA,0BAAmB,EAAC,MAAM,CAAC,CAAA;QAC5C,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAChD,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAc,CAAC,CAC9C,CAAA;QAED,IACE,QAAQ,CAAC,MAAM,KAAK,CAAC;YACrB,CAAC,mBAAmB,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM;gBAC7C,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC,EAC9C;YACA,OAAM;SACP;QAED,MAAM,e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AAC,IAAA,WAAC,EAAA,GAAG,IAAA,iBAAU,EAAC,GAAG,EAAE,GAAG,CAAC,SAAS,GAAG,GAAG,EAAE,GAAG,EAAE;oBACnD,MAAM,WAAW,GAAG,mBAAmB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;oBACrD,IAAI,CAAC,WAAW,EAAE;wBAChB,GAAG,CAAC,SAAS,CACX;4BACE,OAAO,EAAE,mBAAmB;4BAC5B,UAAU,EAAE,GAAG;4BACf,QAAQ,EAAE,GAAG;4BACb,YAAY,EAAE,WAAI,CAAC,GAAG;yBACvB,EACD,KAAK,CACN,CAAA;qBACF;oBAED,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,KAAK,KAAK,IAAI,EAAE;wBACzC,GAAG,CAAC,MAAM,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,IAAI,GAAG,GAAG,EAAE,IAAI,CAAC,CAAA;qBACtC;yBAAM,IAAI,CAAC,WAAW,IAAI,CAAC,EAAE,CAAC,SAAS,EAAE;wBACxC,sFAAsF;wBACtF,uDAAuD;wBACvD,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;qBACtC;gBACH,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/prefixItems.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js new file mode 100644 index 000000000..727bc23ce --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const items_1 = require("./items"); +const def = { + keyword: "prefixItems", + type: "array", + schemaType: ["array"], + before: "uniqueItems", + code: (cxt) => (0, items_1.validateTuple)(cxt, "items"), +}; +exports.default = def; +//# sourceMappingURL=prefixItems.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map new file mode 100644 index 000000000..deef718e6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map @@ -0,0 +1 @@ +{"version":3,"file":"prefixItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/prefixItems.ts"],"names":[],"mappings":";;AACA,mCAAqC;AAErC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,OAAO,CAAC;IACrB,MAAM,EAAE,aAAa;IACrB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,qBAAa,EAAC,GAAG,EAAE,OAAO,CAAC;CAC3C,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/properties.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/properties.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/properties.js new file mode 100644 index 000000000..7347358e2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/properties.js @@ -0,0 +1,54 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const validate_1 = require("../../compile/validate"); +const code_1 = require("../code"); +const util_1 = require("../../compile/util"); +const additionalProperties_1 = require("./additionalProperties"); +const def = { + keyword: "properties", + type: "object", + schemaType: "object", + code(cxt) { + const { gen, schema, parentSchema, data, it } = cxt; + if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === undefined) { + additionalProperties_1.default.code(new validate_1.KeywordCxt(it, additionalProperties_1.default, "additionalProperties")); + } + const allProps = (0, code_1.allSchemaProperties)(schema); + for (const prop of allProps) { + it.definedProperties.add(prop); + } + if (it.opts.unevaluated && allProps.length && it.props !== true) { + it.props = util_1.mergeEvaluated.props(gen, (0, util_1.toHash)(allProps), it.props); + } + const properties = allProps.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p])); + if (properties.length === 0) + return; + const valid = gen.name("valid"); + for (const prop of properties) { + if (hasDefault(prop)) { + applyPropertySchema(prop); + } + else { + gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties)); + applyPropertySchema(prop); + if (!it.allErrors) + gen.else().var(valid, true); + gen.endIf(); + } + cxt.it.definedProperties.add(prop); + cxt.ok(valid); + } + function hasDefault(prop) { + return it.opts.useDefaults && !it.compositeRule && schema[prop].default !== undefined; + } + function applyPropertySchema(prop) { + cxt.subschema({ + keyword: "properties", + schemaProp: prop, + dataProp: prop, + }, valid); + } + }, +}; +exports.default = def; +//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/properties.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/properties.js.map new file mode 100644 index 000000000..27f8148cf --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/properties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/properties.ts"],"names":[],"mappings":";;AACA,qDAAiD;AACjD,kCAA2D;AAC3D,6CAA4E;AAC5E,iEAA0C;AAE1C,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,YAAY;IACrB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACjD,IAAI,EAAE,CAAC,IAAI,CAAC,gBAAgB,KAAK,KAAK,IAAI,YAAY,CAAC,oBAAoB,KAAK,SAAS,EAAE;YACzF,8BAAK,CAAC,IAAI,CAAC,IAAI,qBAAU,CAAC,EAAE,EAAE,8BAAK,EAAE,sBAAsB,CAAC,CAAC,CAAA;SAC9D;QACD,MAAM,QAAQ,GAAG,IAAA,0BAAmB,EAAC,MAAM,CAAC,CAAA;QAC5C,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE;YAC3B,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;SAC/B;QACD,IAAI,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,QAAQ,CAAC,MAAM,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,EAAE;YAC/D,EAAE,CAAC,KAAK,GAAG,qBAAc,CAAC,KAAK,CAAC,GAAG,EAAE,IAAA,aAAM,EAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAA;SACjE;QACD,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC5E,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC;YAAE,OAAM;QACnC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAE/B,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE;YAC7B,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;gBACpB,mBAAmB,CAAC,IAAI,CAAC,CAAA;aAC1B;iBAAM;gBACL,GAAG,CAAC,EAAE,CAAC,IAAA,qBAAc,EAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAA;gBAC9D,mBAAmB,CAAC,IAAI,CAAC,CAAA;gBACzB,IAAI,CAAC,EAAE,CAAC,SAAS;oBAAE,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;gBAC9C,GAAG,CAAC,KAAK,EAAE,CAAA;aACZ;YACD,GAAG,CAAC,EAAE,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;YAClC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;SACd;QAED,SAAS,UAAU,CAAC,IAAY;YAC9B,OAAO,EAAE,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,EAAE,CAAC,aAAa,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,SAAS,CAAA;QACvF,CAAC;QAED,SAAS,mBAAmB,CAAC,IAAY;YACvC,GAAG,CAAC,SAAS,CACX;gBACE,OAAO,EAAE,YAAY;gBACrB,UAAU,EAAE,IAAI;gBAChB,QAAQ,EAAE,IAAI;aACf,EACD,KAAK,CACN,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts new file mode 100644 index 000000000..90f7ad5b2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/propertyNames.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export declare type PropertyNamesError = ErrorObject<"propertyNames", { + propertyName: string; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js new file mode 100644 index 000000000..f3871152d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: "property name must be valid", + params: ({ params }) => (0, codegen_1._) `{propertyName: ${params.propertyName}}`, +}; +const def = { + keyword: "propertyNames", + type: "object", + schemaType: ["object", "boolean"], + error, + code(cxt) { + const { gen, schema, data, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + const valid = gen.name("valid"); + gen.forIn("key", data, (key) => { + cxt.setParams({ propertyName: key }); + cxt.subschema({ + keyword: "propertyNames", + data: key, + dataTypes: ["string"], + propertyName: key, + compositeRule: true, + }, valid); + gen.if((0, codegen_1.not)(valid), () => { + cxt.error(true); + if (!it.allErrors) + gen.break(); + }); + }); + cxt.ok(valid); + }, +}; +exports.default = def; +//# sourceMappingURL=propertyNames.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map new file mode 100644 index 000000000..835b2bb13 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map @@ -0,0 +1 @@ +{"version":3,"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CAAC,CAAC,CAAA;QAEF,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/thenElse.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/thenElse.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/thenElse.js new file mode 100644 index 000000000..1ae639021 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/thenElse.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const def = { + keyword: ["then", "else"], + schemaType: ["object", "boolean"], + code({ keyword, parentSchema, it }) { + if (parentSchema.if === undefined) + (0, util_1.checkStrictMode)(it, `"${keyword}" without "if" is ignored`); + }, +}; +exports.default = def; +//# sourceMappingURL=thenElse.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map new file mode 100644 index 000000000..2629f4fce --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"thenElse.js","sourceRoot":"","sources":["../../../lib/vocabularies/applicator/thenElse.ts"],"names":[],"mappings":";;AAEA,6CAAkD;AAElD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;IACjC,IAAI,CAAC,EAAC,OAAO,EAAE,YAAY,EAAE,EAAE,EAAa;QAC1C,IAAI,YAAY,CAAC,EAAE,KAAK,SAAS;YAAE,IAAA,sBAAe,EAAC,EAAE,EAAE,IAAI,OAAO,2BAA2B,CAAC,CAAA;IAChG,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/code.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/code.d.ts new file mode 100644 index 000000000..f914baca5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/code.d.ts @@ -0,0 +1,17 @@ +import type { SchemaMap } from "../types"; +import type { SchemaCxt } from "../compile"; +import type { KeywordCxt } from "../compile/validate"; +import { CodeGen, Code, Name } from "../compile/codegen"; +export declare function checkReportMissingProp(cxt: KeywordCxt, prop: string): void; +export declare function checkMissingProp({ gen, data, it: { opts } }: KeywordCxt, properties: string[], missing: Name): Code; +export declare function reportMissingProp(cxt: KeywordCxt, missing: Name): void; +export declare function hasPropFunc(gen: CodeGen): Name; +export declare function isOwnProperty(gen: CodeGen, data: Name, property: Name | string): Code; +export declare function propertyInData(gen: CodeGen, data: Name, property: Name | string, ownProperties?: boolean): Code; +export declare function noPropertyInData(gen: CodeGen, data: Name, property: Name | string, ownProperties?: boolean): Code; +export declare function allSchemaProperties(schemaMap?: SchemaMap): string[]; +export declare function schemaProperties(it: SchemaCxt, schemaMap: SchemaMap): string[]; +export declare function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }: KeywordCxt, func: Code, context: Code, passSchema?: boolean): Code; +export declare function usePattern({ gen, it: { opts } }: KeywordCxt, pattern: string): Name; +export declare function validateArray(cxt: KeywordCxt): Name; +export declare function validateUnion(cxt: KeywordCxt): void; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/code.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/code.js new file mode 100644 index 000000000..8cb899324 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/code.js @@ -0,0 +1,131 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateUnion = exports.validateArray = exports.usePattern = exports.callValidateCode = exports.schemaProperties = exports.allSchemaProperties = exports.noPropertyInData = exports.propertyInData = exports.isOwnProperty = exports.hasPropFunc = exports.reportMissingProp = exports.checkMissingProp = exports.checkReportMissingProp = void 0; +const codegen_1 = require("../compile/codegen"); +const util_1 = require("../compile/util"); +const names_1 = require("../compile/names"); +const util_2 = require("../compile/util"); +function checkReportMissingProp(cxt, prop) { + const { gen, data, it } = cxt; + gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => { + cxt.setParams({ missingProperty: (0, codegen_1._) `${prop}` }, true); + cxt.error(); + }); +} +exports.checkReportMissingProp = checkReportMissingProp; +function checkMissingProp({ gen, data, it: { opts } }, properties, missing) { + return (0, codegen_1.or)(...properties.map((prop) => (0, codegen_1.and)(noPropertyInData(gen, data, prop, opts.ownProperties), (0, codegen_1._) `${missing} = ${prop}`))); +} +exports.checkMissingProp = checkMissingProp; +function reportMissingProp(cxt, missing) { + cxt.setParams({ missingProperty: missing }, true); + cxt.error(); +} +exports.reportMissingProp = reportMissingProp; +function hasPropFunc(gen) { + return gen.scopeValue("func", { + // eslint-disable-next-line @typescript-eslint/unbound-method + ref: Object.prototype.hasOwnProperty, + code: (0, codegen_1._) `Object.prototype.hasOwnProperty`, + }); +} +exports.hasPropFunc = hasPropFunc; +function isOwnProperty(gen, data, property) { + return (0, codegen_1._) `${hasPropFunc(gen)}.call(${data}, ${property})`; +} +exports.isOwnProperty = isOwnProperty; +function propertyInData(gen, data, property, ownProperties) { + const cond = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(property)} !== undefined`; + return ownProperties ? (0, codegen_1._) `${cond} && ${isOwnProperty(gen, data, property)}` : cond; +} +exports.propertyInData = propertyInData; +function noPropertyInData(gen, data, property, ownProperties) { + const cond = (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(property)} === undefined`; + return ownProperties ? (0, codegen_1.or)(cond, (0, codegen_1.not)(isOwnProperty(gen, data, property))) : cond; +} +exports.noPropertyInData = noPropertyInData; +function allSchemaProperties(schemaMap) { + return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : []; +} +exports.allSchemaProperties = allSchemaProperties; +function schemaProperties(it, schemaMap) { + return allSchemaProperties(schemaMap).filter((p) => !(0, util_1.alwaysValidSchema)(it, schemaMap[p])); +} +exports.schemaProperties = schemaProperties; +function callValidateCode({ schemaCode, data, it: { gen, topSchemaRef, schemaPath, errorPath }, it }, func, context, passSchema) { + const dataAndSchema = passSchema ? (0, codegen_1._) `${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data; + const valCxt = [ + [names_1.default.instancePath, (0, codegen_1.strConcat)(names_1.default.instancePath, errorPath)], + [names_1.default.parentData, it.parentData], + [names_1.default.parentDataProperty, it.parentDataProperty], + [names_1.default.rootData, names_1.default.rootData], + ]; + if (it.opts.dynamicRef) + valCxt.push([names_1.default.dynamicAnchors, names_1.default.dynamicAnchors]); + const args = (0, codegen_1._) `${dataAndSchema}, ${gen.object(...valCxt)}`; + return context !== codegen_1.nil ? (0, codegen_1._) `${func}.call(${context}, ${args})` : (0, codegen_1._) `${func}(${args})`; +} +exports.callValidateCode = callValidateCode; +const newRegExp = (0, codegen_1._) `new RegExp`; +function usePattern({ gen, it: { opts } }, pattern) { + const u = opts.unicodeRegExp ? "u" : ""; + const { regExp } = opts.code; + const rx = regExp(pattern, u); + return gen.scopeValue("pattern", { + key: rx.toString(), + ref: rx, + code: (0, codegen_1._) `${regExp.code === "new RegExp" ? newRegExp : (0, util_2.useFunc)(gen, regExp)}(${pattern}, ${u})`, + }); +} +exports.usePattern = usePattern; +function validateArray(cxt) { + const { gen, data, keyword, it } = cxt; + const valid = gen.name("valid"); + if (it.allErrors) { + const validArr = gen.let("valid", true); + validateItems(() => gen.assign(validArr, false)); + return validArr; + } + gen.var(valid, true); + validateItems(() => gen.break()); + return valid; + function validateItems(notValid) { + const len = gen.const("len", (0, codegen_1._) `${data}.length`); + gen.forRange("i", 0, len, (i) => { + cxt.subschema({ + keyword, + dataProp: i, + dataPropType: util_1.Type.Num, + }, valid); + gen.if((0, codegen_1.not)(valid), notValid); + }); + } +} +exports.validateArray = validateArray; +function validateUnion(cxt) { + const { gen, schema, keyword, it } = cxt; + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + const alwaysValid = schema.some((sch) => (0, util_1.alwaysValidSchema)(it, sch)); + if (alwaysValid && !it.opts.unevaluated) + return; + const valid = gen.let("valid", false); + const schValid = gen.name("_valid"); + gen.block(() => schema.forEach((_sch, i) => { + const schCxt = cxt.subschema({ + keyword, + schemaProp: i, + compositeRule: true, + }, schValid); + gen.assign(valid, (0, codegen_1._) `${valid} || ${schValid}`); + const merged = cxt.mergeValidEvaluated(schCxt, schValid); + // can short-circuit if `unevaluatedProperties/Items` not supported (opts.unevaluated !== true) + // or if all properties and items were evaluated (it.props === true && it.items === true) + if (!merged) + gen.if((0, codegen_1.not)(valid)); + })); + cxt.result(valid, () => cxt.reset(), () => cxt.error(true)); +} +exports.validateUnion = validateUnion; +//# sourceMappingURL=code.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/code.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/code.js.map new file mode 100644 index 000000000..62d7ee121 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/code.js.map @@ -0,0 +1 @@ +{"version":3,"file":"code.js","sourceRoot":"","sources":["../../lib/vocabularies/code.ts"],"names":[],"mappings":";;;AAGA,gDAAoG;AACpG,0CAAuD;AACvD,4CAAgC;AAChC,0CAAuC;AACvC,SAAgB,sBAAsB,CAAC,GAAe,EAAE,IAAY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AK,CAAC,GAAG,EAAE,CACb,MAAM,CAAC,OAAO,CAAC,CAAC,IAAe,EAAE,CAAS,EAAE,EAAE;QAC5C,MAAM,MAAM,GAAG,GAAG,CAAC,SAAS,CAC1B;YACE,OAAO;YACP,UAAU,EAAE,CAAC;YACb,aAAa,EAAE,IAAI;SACpB,EACD,QAAQ,CACT,CAAA;QACD,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,KAAK,OAAO,QAAQ,EAAE,CAAC,CAAA;QAC7C,MAAM,MAAM,GAAG,GAAG,CAAC,mBAAmB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAA;QACxD,+FAA+F;QAC/F,yFAAyF;QACzF,IAAI,CAAC,MAAM;YAAE,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,CAAC,CAAA;IACjC,CAAC,CAAC,CACH,CAAA;IAED,GAAG,CAAC,MAAM,CACR,KAAK,EACL,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,EACjB,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CACtB,CAAA;AACH,CAAC;AAjCD,sCAiCC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/id.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/id.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/id.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/id.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/id.js new file mode 100644 index 000000000..313598aab --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/id.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const def = { + keyword: "id", + code() { + throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID'); + }, +}; +exports.default = def; +//# sourceMappingURL=id.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/id.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/id.js.map new file mode 100644 index 000000000..4eb27eb33 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/id.js.map @@ -0,0 +1 @@ +{"version":3,"file":"id.js","sourceRoot":"","sources":["../../../lib/vocabularies/core/id.ts"],"names":[],"mappings":";;AAEA,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,IAAI;IACb,IAAI;QACF,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;IACzE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/index.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/index.d.ts new file mode 100644 index 000000000..f2e34ee36 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/index.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../../types"; +declare const core: Vocabulary; +export default core; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/index.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/index.js new file mode 100644 index 000000000..87656d743 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/index.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const id_1 = require("./id"); +const ref_1 = require("./ref"); +const core = [ + "$schema", + "$id", + "$defs", + "$vocabulary", + { keyword: "$comment" }, + "definitions", + id_1.default, + ref_1.default, +]; +exports.default = core; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/index.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/index.js.map new file mode 100644 index 000000000..5bf65f941 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/core/index.ts"],"names":[],"mappings":";;AACA,6BAA4B;AAC5B,+BAA8B;AAE9B,MAAM,IAAI,GAAe;IACvB,SAAS;IACT,KAAK;IACL,OAAO;IACP,aAAa;IACb,EAAC,OAAO,EAAE,UAAU,EAAC;IACrB,aAAa;IACb,YAAS;IACT,aAAU;CACX,CAAA;AAED,kBAAe,IAAI,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/ref.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/ref.d.ts new file mode 100644 index 000000000..6a0967d15 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/ref.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +import { Code } from "../../compile/codegen"; +import { SchemaEnv } from "../../compile"; +declare const def: CodeKeywordDefinition; +export declare function getValidate(cxt: KeywordCxt, sch: SchemaEnv): Code; +export declare function callRef(cxt: KeywordCxt, v: Code, sch?: SchemaEnv, $async?: boolean): void; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/ref.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/ref.js new file mode 100644 index 000000000..bac1ae853 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/ref.js @@ -0,0 +1,122 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.callRef = exports.getValidate = void 0; +const ref_error_1 = require("../../compile/ref_error"); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const names_1 = require("../../compile/names"); +const compile_1 = require("../../compile"); +const util_1 = require("../../compile/util"); +const def = { + keyword: "$ref", + schemaType: "string", + code(cxt) { + const { gen, schema: $ref, it } = cxt; + const { baseId, schemaEnv: env, validateName, opts, self } = it; + const { root } = env; + if (($ref === "#" || $ref === "#/") && baseId === root.baseId) + return callRootRef(); + const schOrEnv = compile_1.resolveRef.call(self, root, baseId, $ref); + if (schOrEnv === undefined) + throw new ref_error_1.default(it.opts.uriResolver, baseId, $ref); + if (schOrEnv instanceof compile_1.SchemaEnv) + return callValidate(schOrEnv); + return inlineRefSchema(schOrEnv); + function callRootRef() { + if (env === root) + return callRef(cxt, validateName, env, env.$async); + const rootName = gen.scopeValue("root", { ref: root }); + return callRef(cxt, (0, codegen_1._) `${rootName}.validate`, root, root.$async); + } + function callValidate(sch) { + const v = getValidate(cxt, sch); + callRef(cxt, v, sch, sch.$async); + } + function inlineRefSchema(sch) { + const schName = gen.scopeValue("schema", opts.code.source === true ? { ref: sch, code: (0, codegen_1.stringify)(sch) } : { ref: sch }); + const valid = gen.name("valid"); + const schCxt = cxt.subschema({ + schema: sch, + dataTypes: [], + schemaPath: codegen_1.nil, + topSchemaRef: schName, + errSchemaPath: $ref, + }, valid); + cxt.mergeEvaluated(schCxt); + cxt.ok(valid); + } + }, +}; +function getValidate(cxt, sch) { + const { gen } = cxt; + return sch.validate + ? gen.scopeValue("validate", { ref: sch.validate }) + : (0, codegen_1._) `${gen.scopeValue("wrapper", { ref: sch })}.validate`; +} +exports.getValidate = getValidate; +function callRef(cxt, v, sch, $async) { + const { gen, it } = cxt; + const { allErrors, schemaEnv: env, opts } = it; + const passCxt = opts.passContext ? names_1.default.this : codegen_1.nil; + if ($async) + callAsyncRef(); + else + callSyncRef(); + function callAsyncRef() { + if (!env.$async) + throw new Error("async schema referenced by sync schema"); + const valid = gen.let("valid"); + gen.try(() => { + gen.code((0, codegen_1._) `await ${(0, code_1.callValidateCode)(cxt, v, passCxt)}`); + addEvaluatedFrom(v); // TODO will not work with async, it has to be returned with the result + if (!allErrors) + gen.assign(valid, true); + }, (e) => { + gen.if((0, codegen_1._) `!(${e} instanceof ${it.ValidationError})`, () => gen.throw(e)); + addErrorsFrom(e); + if (!allErrors) + gen.assign(valid, false); + }); + cxt.ok(valid); + } + function callSyncRef() { + cxt.result((0, code_1.callValidateCode)(cxt, v, passCxt), () => addEvaluatedFrom(v), () => addErrorsFrom(v)); + } + function addErrorsFrom(source) { + const errs = (0, codegen_1._) `${source}.errors`; + gen.assign(names_1.default.vErrors, (0, codegen_1._) `${names_1.default.vErrors} === null ? ${errs} : ${names_1.default.vErrors}.concat(${errs})`); // TODO tagged + gen.assign(names_1.default.errors, (0, codegen_1._) `${names_1.default.vErrors}.length`); + } + function addEvaluatedFrom(source) { + var _a; + if (!it.opts.unevaluated) + return; + const schEvaluated = (_a = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a === void 0 ? void 0 : _a.evaluated; + // TODO refactor + if (it.props !== true) { + if (schEvaluated && !schEvaluated.dynamicProps) { + if (schEvaluated.props !== undefined) { + it.props = util_1.mergeEvaluated.props(gen, schEvaluated.props, it.props); + } + } + else { + const props = gen.var("props", (0, codegen_1._) `${source}.evaluated.props`); + it.props = util_1.mergeEvaluated.props(gen, props, it.props, codegen_1.Name); + } + } + if (it.items !== true) { + if (schEvaluated && !schEvaluated.dynamicItems) { + if (schEvaluated.items !== undefined) { + it.items = util_1.mergeEvaluated.items(gen, schEvaluated.items, it.items); + } + } + else { + const items = gen.var("items", (0, codegen_1._) `${source}.evaluated.items`); + it.items = util_1.mergeEvaluated.items(gen, items, it.items, codegen_1.Name); + } + } + } +} +exports.callRef = callRef; +exports.default = def; +//# sourceMappingURL=ref.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/ref.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/ref.js.map new file mode 100644 index 000000000..88ac106af --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/core/ref.js.map @@ -0,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C,KAAK,CAAC,GAAG,EAAE,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAA;iBACnE;aACF;iBAAM;gBACL,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,MAAM,kBAAkB,CAAC,CAAA;gBAC5D,EAAE,CAAC,KAAK,GAAG,qBAAc,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,cAAI,CAAC,CAAA;aAC5D;SACF;QACD,IAAI,EAAE,CAAC,KAAK,KAAK,IAAI,EAAE;YACrB,IAAI,YAAY,IAAI,CAAC,YAAY,CAAC,YAAY,EAAE;gBAC9C,IAAI,YAAY,CAAC,KAAK,KAAK,SAAS,EAAE;oBACpC,EAAE,CAAC,KAAK,GAAG,qBAAc,CAAC,KAAK,CAAC,GAAG,EAAE,YAAY,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,CAAA;iBACnE;aACF;iBAAM;gBACL,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,EAAE,IAAA,WAAC,EAAA,GAAG,MAAM,kBAAkB,CAAC,CAAA;gBAC5D,EAAE,CAAC,KAAK,GAAG,qBAAc,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,cAAI,CAAC,CAAA;aAC5D;SACF;IACH,CAAC;AACH,CAAC;AAhED,0BAgEC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts new file mode 100644 index 000000000..656b2da52 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/index.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition } from "../../types"; +import { DiscrError, DiscrErrorObj } from "../discriminator/types"; +export declare type DiscriminatorError = DiscrErrorObj | DiscrErrorObj; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/index.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/index.js new file mode 100644 index 000000000..ccdb340b2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/index.js @@ -0,0 +1,100 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const types_1 = require("../discriminator/types"); +const compile_1 = require("../../compile"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params: { discrError, tagName } }) => discrError === types_1.DiscrError.Tag + ? `tag "${tagName}" must be string` + : `value of tag "${tagName}" must be in oneOf`, + params: ({ params: { discrError, tag, tagName } }) => (0, codegen_1._) `{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`, +}; +const def = { + keyword: "discriminator", + type: "object", + schemaType: "object", + error, + code(cxt) { + const { gen, data, schema, parentSchema, it } = cxt; + const { oneOf } = parentSchema; + if (!it.opts.discriminator) { + throw new Error("discriminator: requires discriminator option"); + } + const tagName = schema.propertyName; + if (typeof tagName != "string") + throw new Error("discriminator: requires propertyName"); + if (schema.mapping) + throw new Error("discriminator: mapping is not supported"); + if (!oneOf) + throw new Error("discriminator: requires oneOf keyword"); + const valid = gen.let("valid", false); + const tag = gen.const("tag", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(tagName)}`); + gen.if((0, codegen_1._) `typeof ${tag} == "string"`, () => validateMapping(), () => cxt.error(false, { discrError: types_1.DiscrError.Tag, tag, tagName })); + cxt.ok(valid); + function validateMapping() { + const mapping = getMapping(); + gen.if(false); + for (const tagValue in mapping) { + gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`); + gen.assign(valid, applyTagSchema(mapping[tagValue])); + } + gen.else(); + cxt.error(false, { discrError: types_1.DiscrError.Mapping, tag, tagName }); + gen.endIf(); + } + function applyTagSchema(schemaProp) { + const _valid = gen.name("valid"); + const schCxt = cxt.subschema({ keyword: "oneOf", schemaProp }, _valid); + cxt.mergeEvaluated(schCxt, codegen_1.Name); + return _valid; + } + function getMapping() { + var _a; + const oneOfMapping = {}; + const topRequired = hasRequired(parentSchema); + let tagRequired = true; + for (let i = 0; i < oneOf.length; i++) { + let sch = oneOf[i]; + if ((sch === null || sch === void 0 ? void 0 : sch.$ref) && !(0, util_1.schemaHasRulesButRef)(sch, it.self.RULES)) { + sch = compile_1.resolveRef.call(it.self, it.schemaEnv.root, it.baseId, sch === null || sch === void 0 ? void 0 : sch.$ref); + if (sch instanceof compile_1.SchemaEnv) + sch = sch.schema; + } + const propSch = (_a = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a === void 0 ? void 0 : _a[tagName]; + if (typeof propSch != "object") { + throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`); + } + tagRequired = tagRequired && (topRequired || hasRequired(sch)); + addMappings(propSch, i); + } + if (!tagRequired) + throw new Error(`discriminator: "${tagName}" must be required`); + return oneOfMapping; + function hasRequired({ required }) { + return Array.isArray(required) && required.includes(tagName); + } + function addMappings(sch, i) { + if (sch.const) { + addMapping(sch.const, i); + } + else if (sch.enum) { + for (const tagValue of sch.enum) { + addMapping(tagValue, i); + } + } + else { + throw new Error(`discriminator: "properties/${tagName}" must have "const" or "enum"`); + } + } + function addMapping(tagValue, i) { + if (typeof tagValue != "string" || tagValue in oneOfMapping) { + throw new Error(`discriminator: "${tagName}" values must be unique strings`); + } + oneOfMapping[tagValue] = i; + } + } + }, +}; +exports.default = def; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/index.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/index.js.map new file mode 100644 index 000000000..8057a4edc --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/index.js.map @@ -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ACxB;YACD,IAAI,CAAC,WAAW;gBAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,OAAO,oBAAoB,CAAC,CAAA;YACjF,OAAO,YAAY,CAAA;YAEnB,SAAS,WAAW,CAAC,EAAC,QAAQ,EAAkB;gBAC9C,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;YAC9D,CAAC;YAED,SAAS,WAAW,CAAC,GAAoB,EAAE,CAAS;gBAClD,IAAI,GAAG,CAAC,KAAK,EAAE;oBACb,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAA;iBACzB;qBAAM,IAAI,GAAG,CAAC,IAAI,EAAE;oBACnB,KAAK,MAAM,QAAQ,IAAI,GAAG,CAAC,IAAI,EAAE;wBAC/B,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAA;qBACxB;iBACF;qBAAM;oBACL,MAAM,IAAI,KAAK,CAAC,8BAA8B,OAAO,+BAA+B,CAAC,CAAA;iBACtF;YACH,CAAC;YAED,SAAS,UAAU,CAAC,QAAiB,EAAE,CAAS;gBAC9C,IAAI,OAAO,QAAQ,IAAI,QAAQ,IAAI,QAAQ,IAAI,YAAY,EAAE;oBAC3D,MAAM,IAAI,KAAK,CAAC,mBAAmB,OAAO,iCAAiC,CAAC,CAAA;iBAC7E;gBACD,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;YAC5B,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts new file mode 100644 index 000000000..6cf5ea51f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/types.d.ts @@ -0,0 +1,10 @@ +import type { ErrorObject } from "../../types"; +export declare enum DiscrError { + Tag = "tag", + Mapping = "mapping" +} +export declare type DiscrErrorObj = ErrorObject<"discriminator", { + error: E; + tag: string; + tagValue: unknown; +}, string>; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/types.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/types.js new file mode 100644 index 000000000..d538f0cee --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/types.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.DiscrError = void 0; +var DiscrError; +(function (DiscrError) { + DiscrError["Tag"] = "tag"; + DiscrError["Mapping"] = "mapping"; +})(DiscrError = exports.DiscrError || (exports.DiscrError = {})); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/types.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/types.js.map new file mode 100644 index 000000000..4908a4e9d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/discriminator/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../lib/vocabularies/discriminator/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,UAGX;AAHD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,iCAAmB,CAAA;AACrB,CAAC,EAHW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAGrB"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft2020.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft2020.d.ts new file mode 100644 index 000000000..d65752c63 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft2020.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../types"; +declare const draft2020Vocabularies: Vocabulary[]; +export default draft2020Vocabularies; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft2020.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft2020.js new file mode 100644 index 000000000..23d244aed --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft2020.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const core_1 = require("./core"); +const validation_1 = require("./validation"); +const applicator_1 = require("./applicator"); +const dynamic_1 = require("./dynamic"); +const next_1 = require("./next"); +const unevaluated_1 = require("./unevaluated"); +const format_1 = require("./format"); +const metadata_1 = require("./metadata"); +const draft2020Vocabularies = [ + dynamic_1.default, + core_1.default, + validation_1.default, + (0, applicator_1.default)(true), + format_1.default, + metadata_1.metadataVocabulary, + metadata_1.contentVocabulary, + next_1.default, + unevaluated_1.default, +]; +exports.default = draft2020Vocabularies; +//# sourceMappingURL=draft2020.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft2020.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft2020.js.map new file mode 100644 index 000000000..ae1a4d833 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft2020.js.map @@ -0,0 +1 @@ +{"version":3,"file":"draft2020.js","sourceRoot":"","sources":["../../lib/vocabularies/draft2020.ts"],"names":[],"mappings":";;AACA,iCAAmC;AACnC,6CAA+C;AAC/C,6CAAkD;AAClD,uCAAyC;AACzC,iCAAmC;AACnC,+CAAiD;AACjD,qCAAuC;AACvC,yCAAgE;AAEhE,MAAM,qBAAqB,GAAiB;IAC1C,iBAAiB;IACjB,cAAc;IACd,oBAAoB;IACpB,IAAA,oBAAuB,EAAC,IAAI,CAAC;IAC7B,gBAAgB;IAChB,6BAAkB;IAClB,4BAAiB;IACjB,cAAc;IACd,qBAAqB;CACtB,CAAA;AAED,kBAAe,qBAAqB,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft7.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft7.d.ts new file mode 100644 index 000000000..469fb8444 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft7.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../types"; +declare const draft7Vocabularies: Vocabulary[]; +export default draft7Vocabularies; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft7.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft7.js new file mode 100644 index 000000000..1e993de0e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft7.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const core_1 = require("./core"); +const validation_1 = require("./validation"); +const applicator_1 = require("./applicator"); +const format_1 = require("./format"); +const metadata_1 = require("./metadata"); +const draft7Vocabularies = [ + core_1.default, + validation_1.default, + (0, applicator_1.default)(), + format_1.default, + metadata_1.metadataVocabulary, + metadata_1.contentVocabulary, +]; +exports.default = draft7Vocabularies; +//# sourceMappingURL=draft7.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft7.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft7.js.map new file mode 100644 index 000000000..bc7389c67 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/draft7.js.map @@ -0,0 +1 @@ +{"version":3,"file":"draft7.js","sourceRoot":"","sources":["../../lib/vocabularies/draft7.ts"],"names":[],"mappings":";;AACA,iCAAmC;AACnC,6CAA+C;AAC/C,6CAAkD;AAClD,qCAAuC;AACvC,yCAAgE;AAEhE,MAAM,kBAAkB,GAAiB;IACvC,cAAc;IACd,oBAAoB;IACpB,IAAA,oBAAuB,GAAE;IACzB,gBAAgB;IAChB,6BAAkB;IAClB,4BAAiB;CAClB,CAAA;AAED,kBAAe,kBAAkB,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts new file mode 100644 index 000000000..562121399 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +declare const def: CodeKeywordDefinition; +export declare function dynamicAnchor(cxt: KeywordCxt, anchor: string): void; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js new file mode 100644 index 000000000..972dc35c4 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.dynamicAnchor = void 0; +const codegen_1 = require("../../compile/codegen"); +const names_1 = require("../../compile/names"); +const compile_1 = require("../../compile"); +const ref_1 = require("../core/ref"); +const def = { + keyword: "$dynamicAnchor", + schemaType: "string", + code: (cxt) => dynamicAnchor(cxt, cxt.schema), +}; +function dynamicAnchor(cxt, anchor) { + const { gen, it } = cxt; + it.schemaEnv.root.dynamicAnchors[anchor] = true; + const v = (0, codegen_1._) `${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`; + const validate = it.errSchemaPath === "#" ? it.validateName : _getValidate(cxt); + gen.if((0, codegen_1._) `!${v}`, () => gen.assign(v, validate)); +} +exports.dynamicAnchor = dynamicAnchor; +function _getValidate(cxt) { + const { schemaEnv, schema, self } = cxt.it; + const { root, baseId, localRefs, meta } = schemaEnv.root; + const { schemaId } = self.opts; + const sch = new compile_1.SchemaEnv({ schema, schemaId, root, baseId, localRefs, meta }); + compile_1.compileSchema.call(self, sch); + return (0, ref_1.getValidate)(cxt, sch); +} +exports.default = def; +//# sourceMappingURL=dynamicAnchor.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map new file mode 100644 index 000000000..e70afe30f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicAnchor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamicAnchor.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/dynamicAnchor.ts"],"names":[],"mappings":";;;AAEA,mDAA0D;AAC1D,+CAAmC;AACnC,2CAAsD;AACtD,qCAAuC;AAEvC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,gBAAgB;IACzB,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;CAC9C,CAAA;AAED,SAAgB,aAAa,CAAC,GAAe,EAAE,MAAc;IAC3D,MAAM,EAAC,GAAG,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;IACrB,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,CAAA;IAC/C,MAAM,CAAC,GAAG,IAAA,WAAC,EAAA,GAAG,eAAC,CAAC,cAAc,GAAG,IAAA,qBAAW,EAAC,MAAM,CAAC,EAAE,CAAA;IACtD,MAAM,QAAQ,GAAG,EAAE,CAAC,aAAa,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IAC/E,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAA;AACjD,CAAC;AAND,sCAMC;AAED,SAAS,YAAY,CAAC,GAAe;IACnC,MAAM,EAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAC,GAAG,GAAG,CAAC,EAAE,CAAA;IACxC,MAAM,EAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAC,GAAG,SAAS,CAAC,IAAI,CAAA;IACtD,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC,IAAI,CAAA;IAC5B,MAAM,GAAG,GAAG,IAAI,mBAAS,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAC,CAAC,CAAA;IAC5E,uBAAa,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAC7B,OAAO,IAAA,iBAAW,EAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAC9B,CAAC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts new file mode 100644 index 000000000..fa2f2b81d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +declare const def: CodeKeywordDefinition; +export declare function dynamicRef(cxt: KeywordCxt, ref: string): void; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js new file mode 100644 index 000000000..9f010a0df --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.dynamicRef = void 0; +const codegen_1 = require("../../compile/codegen"); +const names_1 = require("../../compile/names"); +const ref_1 = require("../core/ref"); +const def = { + keyword: "$dynamicRef", + schemaType: "string", + code: (cxt) => dynamicRef(cxt, cxt.schema), +}; +function dynamicRef(cxt, ref) { + const { gen, keyword, it } = cxt; + if (ref[0] !== "#") + throw new Error(`"${keyword}" only supports hash fragment reference`); + const anchor = ref.slice(1); + if (it.allErrors) { + _dynamicRef(); + } + else { + const valid = gen.let("valid", false); + _dynamicRef(valid); + cxt.ok(valid); + } + function _dynamicRef(valid) { + // TODO the assumption here is that `recursiveRef: #` always points to the root + // of the schema object, which is not correct, because there may be $id that + // makes # point to it, and the target schema may not contain dynamic/recursiveAnchor. + // Because of that 2 tests in recursiveRef.json fail. + // This is a similar problem to #815 (`$id` doesn't alter resolution scope for `{ "$ref": "#" }`). + // (This problem is not tested in JSON-Schema-Test-Suite) + if (it.schemaEnv.root.dynamicAnchors[anchor]) { + const v = gen.let("_v", (0, codegen_1._) `${names_1.default.dynamicAnchors}${(0, codegen_1.getProperty)(anchor)}`); + gen.if(v, _callRef(v, valid), _callRef(it.validateName, valid)); + } + else { + _callRef(it.validateName, valid)(); + } + } + function _callRef(validate, valid) { + return valid + ? () => gen.block(() => { + (0, ref_1.callRef)(cxt, validate); + gen.let(valid, true); + }) + : () => (0, ref_1.callRef)(cxt, validate); + } +} +exports.dynamicRef = dynamicRef; +exports.default = def; +//# sourceMappingURL=dynamicRef.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map new file mode 100644 index 000000000..921c893f7 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/dynamicRef.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamicRef.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/dynamicRef.ts"],"names":[],"mappings":";;;AAEA,mDAAgE;AAChE,+CAAmC;AACnC,qCAAmC;A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L,QAAQ,CAAC,EAAE,CAAC,YAAY,EAAE,KAAK,CAAC,EAAE,CAAA;SACnC;IACH,CAAC;IAED,SAAS,QAAQ,CAAC,QAAc,EAAE,KAAY;QAC5C,OAAO,KAAK;YACV,CAAC,CAAC,GAAG,EAAE,CACH,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE;gBACb,IAAA,aAAO,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;gBACtB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;YACtB,CAAC,CAAC;YACN,CAAC,CAAC,GAAG,EAAE,CAAC,IAAA,aAAO,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAClC,CAAC;AACH,CAAC;AApCD,gCAoCC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts new file mode 100644 index 000000000..0c751d93f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/index.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../../types"; +declare const dynamic: Vocabulary; +export default dynamic; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/index.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/index.js new file mode 100644 index 000000000..f2388a757 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/index.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dynamicAnchor_1 = require("./dynamicAnchor"); +const dynamicRef_1 = require("./dynamicRef"); +const recursiveAnchor_1 = require("./recursiveAnchor"); +const recursiveRef_1 = require("./recursiveRef"); +const dynamic = [dynamicAnchor_1.default, dynamicRef_1.default, recursiveAnchor_1.default, recursiveRef_1.default]; +exports.default = dynamic; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/index.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/index.js.map new file mode 100644 index 000000000..f96ba76dd --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/index.ts"],"names":[],"mappings":";;AACA,mDAA2C;AAC3C,6CAAqC;AACrC,uDAA+C;AAC/C,iDAAyC;AAEzC,MAAM,OAAO,GAAe,CAAC,uBAAa,EAAE,oBAAU,EAAE,yBAAe,EAAE,sBAAY,CAAC,CAAA;AAEtF,kBAAe,OAAO,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js new file mode 100644 index 000000000..9fd832353 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dynamicAnchor_1 = require("./dynamicAnchor"); +const util_1 = require("../../compile/util"); +const def = { + keyword: "$recursiveAnchor", + schemaType: "boolean", + code(cxt) { + if (cxt.schema) + (0, dynamicAnchor_1.dynamicAnchor)(cxt, ""); + else + (0, util_1.checkStrictMode)(cxt.it, "$recursiveAnchor: false is ignored"); + }, +}; +exports.default = def; +//# sourceMappingURL=recursiveAnchor.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map new file mode 100644 index 000000000..5d5e381b0 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveAnchor.js.map @@ -0,0 +1 @@ +{"version":3,"file":"recursiveAnchor.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/recursiveAnchor.ts"],"names":[],"mappings":";;AACA,mDAA6C;AAC7C,6CAAkD;AAElD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,kBAAkB;IAC3B,UAAU,EAAE,SAAS;IACrB,IAAI,CAAC,GAAG;QACN,IAAI,GAAG,CAAC,MAAM;YAAE,IAAA,6BAAa,EAAC,GAAG,EAAE,EAAE,CAAC,CAAA;;YACjC,IAAA,sBAAe,EAAC,GAAG,CAAC,EAAE,EAAE,oCAAoC,CAAC,CAAA;IACpE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js new file mode 100644 index 000000000..8cd5c6969 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dynamicRef_1 = require("./dynamicRef"); +const def = { + keyword: "$recursiveRef", + schemaType: "string", + code: (cxt) => (0, dynamicRef_1.dynamicRef)(cxt, cxt.schema), +}; +exports.default = def; +//# sourceMappingURL=recursiveRef.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map new file mode 100644 index 000000000..f81380446 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/dynamic/recursiveRef.js.map @@ -0,0 +1 @@ +{"version":3,"file":"recursiveRef.js","sourceRoot":"","sources":["../../../lib/vocabularies/dynamic/recursiveRef.ts"],"names":[],"mappings":";;AACA,6CAAuC;AAEvC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,eAAe;IACxB,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,uBAAU,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;CAC3C,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/errors.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/errors.d.ts new file mode 100644 index 000000000..221aae0e3 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/errors.d.ts @@ -0,0 +1,9 @@ +import type { TypeError } from "../compile/validate/dataType"; +import type { ApplicatorKeywordError } from "./applicator"; +import type { ValidationKeywordError } from "./validation"; +import type { FormatError } from "./format/format"; +import type { UnevaluatedPropertiesError } from "./unevaluated/unevaluatedProperties"; +import type { UnevaluatedItemsError } from "./unevaluated/unevaluatedItems"; +import type { DependentRequiredError } from "./validation/dependentRequired"; +import type { DiscriminatorError } from "./discriminator"; +export declare type DefinedError = TypeError | ApplicatorKeywordError | ValidationKeywordError | FormatError | UnevaluatedPropertiesError | UnevaluatedItemsError | DependentRequiredError | DiscriminatorError; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/errors.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/errors.js new file mode 100644 index 000000000..d4d3fba00 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/errors.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/errors.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/errors.js.map new file mode 100644 index 000000000..56bad7362 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/errors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../lib/vocabularies/errors.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/format.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/format.d.ts new file mode 100644 index 000000000..855d0a2a1 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/format.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export declare type FormatError = ErrorObject<"format", { + format: string; +}, string | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/format.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/format.js new file mode 100644 index 000000000..aa667c1ef --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/format.js @@ -0,0 +1,92 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const error = { + message: ({ schemaCode }) => (0, codegen_1.str) `must match format "${schemaCode}"`, + params: ({ schemaCode }) => (0, codegen_1._) `{format: ${schemaCode}}`, +}; +const def = { + keyword: "format", + type: ["number", "string"], + schemaType: "string", + $data: true, + error, + code(cxt, ruleType) { + const { gen, data, $data, schema, schemaCode, it } = cxt; + const { opts, errSchemaPath, schemaEnv, self } = it; + if (!opts.validateFormats) + return; + if ($data) + validate$DataFormat(); + else + validateFormat(); + function validate$DataFormat() { + const fmts = gen.scopeValue("formats", { + ref: self.formats, + code: opts.code.formats, + }); + const fDef = gen.const("fDef", (0, codegen_1._) `${fmts}[${schemaCode}]`); + const fType = gen.let("fType"); + const format = gen.let("format"); + // TODO simplify + gen.if((0, codegen_1._) `typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._) `${fDef}.type || "string"`).assign(format, (0, codegen_1._) `${fDef}.validate`), () => gen.assign(fType, (0, codegen_1._) `"string"`).assign(format, fDef)); + cxt.fail$data((0, codegen_1.or)(unknownFmt(), invalidFmt())); + function unknownFmt() { + if (opts.strictSchema === false) + return codegen_1.nil; + return (0, codegen_1._) `${schemaCode} && !${format}`; + } + function invalidFmt() { + const callFormat = schemaEnv.$async + ? (0, codegen_1._) `(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))` + : (0, codegen_1._) `${format}(${data})`; + const validData = (0, codegen_1._) `(typeof ${format} == "function" ? ${callFormat} : ${format}.test(${data}))`; + return (0, codegen_1._) `${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}`; + } + } + function validateFormat() { + const formatDef = self.formats[schema]; + if (!formatDef) { + unknownFormat(); + return; + } + if (formatDef === true) + return; + const [fmtType, format, fmtRef] = getFormat(formatDef); + if (fmtType === ruleType) + cxt.pass(validCondition()); + function unknownFormat() { + if (opts.strictSchema === false) { + self.logger.warn(unknownMsg()); + return; + } + throw new Error(unknownMsg()); + function unknownMsg() { + return `unknown format "${schema}" ignored in schema at path "${errSchemaPath}"`; + } + } + function getFormat(fmtDef) { + const code = fmtDef instanceof RegExp + ? (0, codegen_1.regexpCode)(fmtDef) + : opts.code.formats + ? (0, codegen_1._) `${opts.code.formats}${(0, codegen_1.getProperty)(schema)}` + : undefined; + const fmt = gen.scopeValue("formats", { key: schema, ref: fmtDef, code }); + if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) { + return [fmtDef.type || "string", fmtDef.validate, (0, codegen_1._) `${fmt}.validate`]; + } + return ["string", fmtDef, fmt]; + } + function validCondition() { + if (typeof formatDef == "object" && !(formatDef instanceof RegExp) && formatDef.async) { + if (!schemaEnv.$async) + throw new Error("async format in sync schema"); + return (0, codegen_1._) `await ${fmtRef}(${data})`; + } + return typeof format == "function" ? (0, codegen_1._) `${fmtRef}(${data})` : (0, codegen_1._) `${fmtRef}.test(${data})`; + } + } + }, +}; +exports.default = def; +//# sourceMappingURL=format.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/format.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/format.js.map new file mode 100644 index 000000000..897d9ded5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/format.js.map @@ -0,0 +1 @@ +{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../lib/vocabularies/format/format.ts"],"names":[],"mappings":";;AASA,mDAAoF;AAapF,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,sBAAsB,UAAU,GAAG;IACjE,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,YAAY,UAAU,GAAG;CACrD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,QAAQ;IACjB,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC1B,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe,EAAE,QA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,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,MAAM,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,MAAM,SAAS,IAAI,GAAG,CAAA;YACzF,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/index.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/index.d.ts new file mode 100644 index 000000000..c8019c9d6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/index.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../../types"; +declare const format: Vocabulary; +export default format; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/index.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/index.js new file mode 100644 index 000000000..d19023d24 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/index.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const format_1 = require("./format"); +const format = [format_1.default]; +exports.default = format; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/index.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/index.js.map new file mode 100644 index 000000000..6315bfe1f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/format/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/format/index.ts"],"names":[],"mappings":";;AACA,qCAAoC;AAEpC,MAAM,MAAM,GAAe,CAAC,gBAAa,CAAC,CAAA;AAE1C,kBAAe,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts new file mode 100644 index 000000000..fa27fb771 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/discriminator.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition } from "../../types"; +import { _JTDTypeError } from "./error"; +import { DiscrError, DiscrErrorObj } from "../discriminator/types"; +export declare type JTDDiscriminatorError = _JTDTypeError<"discriminator", "object", string> | DiscrErrorObj | DiscrErrorObj; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/discriminator.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/discriminator.js new file mode 100644 index 000000000..e7074d279 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/discriminator.js @@ -0,0 +1,71 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const metadata_1 = require("./metadata"); +const nullable_1 = require("./nullable"); +const error_1 = require("./error"); +const types_1 = require("../discriminator/types"); +const error = { + message: (cxt) => { + const { schema, params } = cxt; + return params.discrError + ? params.discrError === types_1.DiscrError.Tag + ? `tag "${schema}" must be string` + : `value of tag "${schema}" must be in mapping` + : (0, error_1.typeErrorMessage)(cxt, "object"); + }, + params: (cxt) => { + const { schema, params } = cxt; + return params.discrError + ? (0, codegen_1._) `{error: ${params.discrError}, tag: ${schema}, tagValue: ${params.tag}}` + : (0, error_1.typeErrorParams)(cxt, "object"); + }, +}; +const def = { + keyword: "discriminator", + schemaType: "string", + implements: ["mapping"], + error, + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, schema, parentSchema } = cxt; + const [valid, cond] = (0, nullable_1.checkNullableObject)(cxt, data); + gen.if(cond); + validateDiscriminator(); + gen.elseIf((0, codegen_1.not)(valid)); + cxt.error(); + gen.endIf(); + cxt.ok(valid); + function validateDiscriminator() { + const tag = gen.const("tag", (0, codegen_1._) `${data}${(0, codegen_1.getProperty)(schema)}`); + gen.if((0, codegen_1._) `${tag} === undefined`); + cxt.error(false, { discrError: types_1.DiscrError.Tag, tag }); + gen.elseIf((0, codegen_1._) `typeof ${tag} == "string"`); + validateMapping(tag); + gen.else(); + cxt.error(false, { discrError: types_1.DiscrError.Tag, tag }, { instancePath: schema }); + gen.endIf(); + } + function validateMapping(tag) { + gen.if(false); + for (const tagValue in parentSchema.mapping) { + gen.elseIf((0, codegen_1._) `${tag} === ${tagValue}`); + gen.assign(valid, applyTagSchema(tagValue)); + } + gen.else(); + cxt.error(false, { discrError: types_1.DiscrError.Mapping, tag }, { instancePath: schema, schemaPath: "mapping", parentSchema: true }); + gen.endIf(); + } + function applyTagSchema(schemaProp) { + const _valid = gen.name("valid"); + cxt.subschema({ + keyword: "mapping", + schemaProp, + jtdDiscriminator: schema, + }, _valid); + return _valid; + } + }, +}; +exports.default = def; +//# sourceMappingURL=discriminator.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map new file mode 100644 index 000000000..53cb717b6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/discriminator.js.map @@ -0,0 +1 @@ +{"version":3,"file":"discriminator.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/discriminator.ts"],"names":[],"mappings":";;AAEA,mDAA+D;AAC/D,yCAAwC;AACxC,yCAA8C;AAC9C,mCAAwE;AACxE,kDAAgE;AAOhE,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACf,MAAM,EAAC,MAAM,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;QAC5B,OAAO,MAAM,CAAC,UAAU;YACtB,CAAC,CAAC,MAAM,CAAC,UAAU,KAAK,kBAAU,CAAC,GAAG;gBACpC,CAAC,CAAC,QAAQ,MAAM,kBAAkB;gBAClC,CAAC,CA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AG,CAAC,SAAS,CACX;gBACE,OAAO,EAAE,SAAS;gBAClB,UAAU;gBACV,gBAAgB,EAAE,MAAM;aACzB,EACD,MAAM,CACP,CAAA;YACD,OAAO,MAAM,CAAA;QACf,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts new file mode 100644 index 000000000..0a1587119 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/elements.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition, SchemaObject } from "../../types"; +import { _JTDTypeError } from "./error"; +export declare type JTDElementsError = _JTDTypeError<"elements", "array", SchemaObject>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/elements.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/elements.js new file mode 100644 index 000000000..9b8fb548a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/elements.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const metadata_1 = require("./metadata"); +const nullable_1 = require("./nullable"); +const error_1 = require("./error"); +const def = { + keyword: "elements", + schemaType: "object", + error: (0, error_1.typeError)("array"), + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, schema, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + const [valid] = (0, nullable_1.checkNullable)(cxt); + gen.if((0, codegen_1.not)(valid), () => gen.if((0, codegen_1._) `Array.isArray(${data})`, () => gen.assign(valid, (0, code_1.validateArray)(cxt)), () => cxt.error())); + cxt.ok(valid); + }, +}; +exports.default = def; +//# sourceMappingURL=elements.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/elements.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/elements.js.map new file mode 100644 index 000000000..38fe3a129 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/elements.js.map @@ -0,0 +1 @@ +{"version":3,"file":"elements.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/elements.ts"],"names":[],"mappings":";;AAEA,6CAAoD;AACpD,kCAAqC;AACrC,mDAA4C;AAC5C,yCAAwC;AACxC,yCAAwC;AACxC,mCAAgD;AAIhD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAA,iBAAS,EAAC,OAAO,CAAC;IACzB,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClC,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CACtB,GAAG,CAAC,EAAE,CACJ,IAAA,WAAC,EAAA,iBAAiB,IAAI,GAAG,EACzB,GAAG,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,IAAA,oBAAa,EAAC,GAAG,CAAC,CAAC,EAC3C,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAClB,CACF,CAAA;QACD,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts new file mode 100644 index 000000000..8df949c06 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/enum.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export declare type JTDEnumError = ErrorObject<"enum", { + allowedValues: string[]; +}, string[]>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/enum.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/enum.js new file mode 100644 index 000000000..78b01ee37 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/enum.js @@ -0,0 +1,43 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const metadata_1 = require("./metadata"); +const nullable_1 = require("./nullable"); +const error = { + message: "must be equal to one of the allowed values", + params: ({ schemaCode }) => (0, codegen_1._) `{allowedValues: ${schemaCode}}`, +}; +const def = { + keyword: "enum", + schemaType: "array", + error, + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, schema, schemaValue, parentSchema, it } = cxt; + if (schema.length === 0) + throw new Error("enum must have non-empty array"); + if (schema.length !== new Set(schema).size) + throw new Error("enum items must be unique"); + let valid; + const isString = (0, codegen_1._) `typeof ${data} == "string"`; + if (schema.length >= it.opts.loopEnum) { + let cond; + [valid, cond] = (0, nullable_1.checkNullable)(cxt, isString); + gen.if(cond, loopEnum); + } + else { + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + valid = (0, codegen_1.and)(isString, (0, codegen_1.or)(...schema.map((value) => (0, codegen_1._) `${data} === ${value}`))); + if (parentSchema.nullable) + valid = (0, codegen_1.or)((0, codegen_1._) `${data} === null`, valid); + } + cxt.pass(valid); + function loopEnum() { + gen.forOf("v", schemaValue, (v) => gen.if((0, codegen_1._) `${valid} = ${data} === ${v}`, () => gen.break())); + } + }, +}; +exports.default = def; +//# sourceMappingURL=enum.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/enum.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/enum.js.map new file mode 100644 index 000000000..663cc7c5d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/enum.js.map @@ -0,0 +1 @@ +{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/enum.ts"],"names":[],"mappings":";;AAEA,mDAAsD;AACtD,yCAAwC;AACxC,yCAAwC;AAIxC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,4CAA4C;IACrD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,mBAAmB,UAAU,GAAG;CAC5D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,OAAO;IACnB,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC9D,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QAC1E,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI;YAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAA;QACxF,IAAI,KAAW,CAAA;QACf,MAAM,QAAQ,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,cAAc,CAAA;QAC9C,IAAI,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE;YACrC,IAAI,IAAU,CACb;YAAA,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,IAAA,wBAAa,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;YAC7C,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;SACvB;aAAM;YACL,wBAAwB;YACxB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA;YACvE,KAAK,GAAG,IAAA,aAAG,EAAC,QAAQ,EAAE,IAAA,YAAE,EAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAa,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,CAAA;YACpF,IAAI,YAAY,CAAC,QAAQ;gBAAE,KAAK,GAAG,IAAA,YAAE,EAAC,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,EAAE,KAAK,CAAC,CAAA;SAClE;QACD,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAEf,SAAS,QAAQ;YACf,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,WAAmB,EAAE,CAAC,CAAC,EAAE,EAAE,CACxC,GAAG,CAAC,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,KAAK,MAAM,IAAI,QAAQ,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAC1D,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/error.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/error.d.ts new file mode 100644 index 000000000..0a1e68f97 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/error.d.ts @@ -0,0 +1,9 @@ +import type { KeywordErrorDefinition, KeywordErrorCxt, ErrorObject } from "../../types"; +import { Code } from "../../compile/codegen"; +export declare type _JTDTypeError = ErrorObject; +export declare function typeError(t: string): KeywordErrorDefinition; +export declare function typeErrorMessage({ parentSchema }: KeywordErrorCxt, t: string): string; +export declare function typeErrorParams({ parentSchema }: KeywordErrorCxt, t: string): Code; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/error.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/error.js new file mode 100644 index 000000000..1a3920a7e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/error.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.typeErrorParams = exports.typeErrorMessage = exports.typeError = void 0; +const codegen_1 = require("../../compile/codegen"); +function typeError(t) { + return { + message: (cxt) => typeErrorMessage(cxt, t), + params: (cxt) => typeErrorParams(cxt, t), + }; +} +exports.typeError = typeError; +function typeErrorMessage({ parentSchema }, t) { + return (parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.nullable) ? `must be ${t} or null` : `must be ${t}`; +} +exports.typeErrorMessage = typeErrorMessage; +function typeErrorParams({ parentSchema }, t) { + return (0, codegen_1._) `{type: ${t}, nullable: ${!!(parentSchema === null || parentSchema === void 0 ? void 0 : parentSchema.nullable)}}`; +} +exports.typeErrorParams = typeErrorParams; +//# sourceMappingURL=error.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/error.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/error.js.map new file mode 100644 index 000000000..db5596787 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/error.js.map @@ -0,0 +1 @@ +{"version":3,"file":"error.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/error.ts"],"names":[],"mappings":";;;AACA,mDAA6C;AAQ7C,SAAgB,SAAS,CAAC,CAAS;IACjC,OAAO;QACL,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,EAAE,CAAC,CAAC;QAC1C,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,eAAe,CAAC,GAAG,EAAE,CAAC,CAAC;KACzC,CAAA;AACH,CAAC;AALD,8BAKC;AAED,SAAgB,gBAAgB,CAAC,EAAC,YAAY,EAAkB,EAAE,CAAS;IACzE,OAAO,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,EAAC,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAA;AACzE,CAAC;AAFD,4CAEC;AAED,SAAgB,eAAe,CAAC,EAAC,YAAY,EAAkB,EAAE,CAAS;IACxE,OAAO,IAAA,WAAC,EAAA,UAAU,CAAC,eAAe,CAAC,CAAC,CAAA,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,QAAQ,CAAA,GAAG,CAAA;AAC/D,CAAC;AAFD,0CAEC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/index.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/index.d.ts new file mode 100644 index 000000000..f9b7fb9d4 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/index.d.ts @@ -0,0 +1,10 @@ +import type { Vocabulary } from "../../types"; +import { JTDTypeError } from "./type"; +import { JTDEnumError } from "./enum"; +import { JTDElementsError } from "./elements"; +import { JTDPropertiesError } from "./properties"; +import { JTDDiscriminatorError } from "./discriminator"; +import { JTDValuesError } from "./values"; +declare const jtdVocabulary: Vocabulary; +export default jtdVocabulary; +export declare type JTDErrorObject = JTDTypeError | JTDEnumError | JTDElementsError | JTDPropertiesError | JTDDiscriminatorError | JTDValuesError; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/index.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/index.js new file mode 100644 index 000000000..18f40ab7a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/index.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ref_1 = require("./ref"); +const type_1 = require("./type"); +const enum_1 = require("./enum"); +const elements_1 = require("./elements"); +const properties_1 = require("./properties"); +const optionalProperties_1 = require("./optionalProperties"); +const discriminator_1 = require("./discriminator"); +const values_1 = require("./values"); +const union_1 = require("./union"); +const metadata_1 = require("./metadata"); +const jtdVocabulary = [ + "definitions", + ref_1.default, + type_1.default, + enum_1.default, + elements_1.default, + properties_1.default, + optionalProperties_1.default, + discriminator_1.default, + values_1.default, + union_1.default, + metadata_1.default, + { keyword: "additionalProperties", schemaType: "boolean" }, + { keyword: "nullable", schemaType: "boolean" }, +]; +exports.default = jtdVocabulary; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/index.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/index.js.map new file mode 100644 index 000000000..713a1875b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/index.ts"],"names":[],"mappings":";;AACA,+BAA8B;AAC9B,iCAAgD;AAChD,iCAAgD;AAChD,yCAAqD;AACrD,6CAA2D;AAC3D,6DAAqD;AACrD,mDAAoE;AACpE,qCAA+C;AAC/C,mCAA2B;AAC3B,yCAAiC;AAEjC,MAAM,aAAa,GAAe;IAChC,aAAa;IACb,aAAU;IACV,cAAW;IACX,cAAW;IACX,kBAAQ;IACR,oBAAU;IACV,4BAAkB;IAClB,uBAAa;IACb,gBAAM;IACN,eAAK;IACL,kBAAQ;IACR,EAAC,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,SAAS,EAAC;IACxD,EAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAC;CAC7C,CAAA;AAED,kBAAe,aAAa,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts new file mode 100644 index 000000000..86e15a8ed --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/metadata.d.ts @@ -0,0 +1,5 @@ +import { KeywordCxt } from "../../ajv"; +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export declare function checkMetadata({ it, keyword }: KeywordCxt, metadata?: boolean): void; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/metadata.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/metadata.js new file mode 100644 index 000000000..eeb3c91cd --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/metadata.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.checkMetadata = void 0; +const util_1 = require("../../compile/util"); +const def = { + keyword: "metadata", + schemaType: "object", + code(cxt) { + checkMetadata(cxt); + const { gen, schema, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + const valid = gen.name("valid"); + cxt.subschema({ keyword: "metadata", jtdMetadata: true }, valid); + cxt.ok(valid); + }, +}; +function checkMetadata({ it, keyword }, metadata) { + if (it.jtdMetadata !== metadata) { + throw new Error(`JTD: "${keyword}" cannot be used in this schema location`); + } +} +exports.checkMetadata = checkMetadata; +exports.default = def; +//# sourceMappingURL=metadata.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map new file mode 100644 index 000000000..c22e73ada --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/metadata.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/metadata.ts"],"names":[],"mappings":";;;AAEA,6CAAoD;AAEpD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,GAAe;QAClB,aAAa,CAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC7B,IAAI,IAAA,wBAAiB,EAAC,EAAE,EAAE,MAAM,CAAC;YAAE,OAAM;QACzC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,GAAG,CAAC,SAAS,CAAC,EAAC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,IAAI,EAAC,EAAE,KAAK,CAAC,CAAA;QAC9D,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;IACf,CAAC;CACF,CAAA;AAED,SAAgB,aAAa,CAAC,EAAC,EAAE,EAAE,OAAO,EAAa,EAAE,QAAkB;IACzE,IAAI,EAAE,CAAC,WAAW,KAAK,QAAQ,EAAE;QAC/B,MAAM,IAAI,KAAK,CAAC,SAAS,OAAO,0CAA0C,CAAC,CAAA;KAC5E;AACH,CAAC;AAJD,sCAIC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts new file mode 100644 index 000000000..254f76023 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/nullable.d.ts @@ -0,0 +1,4 @@ +import type { KeywordCxt } from "../../compile/validate"; +import { Code, Name } from "../../compile/codegen"; +export declare function checkNullable({ gen, data, parentSchema }: KeywordCxt, cond?: Code): [Name, Code]; +export declare function checkNullableObject(cxt: KeywordCxt, cond: Code): [Name, Code]; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/nullable.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/nullable.js new file mode 100644 index 000000000..8c92d2cde --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/nullable.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.checkNullableObject = exports.checkNullable = void 0; +const codegen_1 = require("../../compile/codegen"); +function checkNullable({ gen, data, parentSchema }, cond = codegen_1.nil) { + const valid = gen.name("valid"); + if (parentSchema.nullable) { + gen.let(valid, (0, codegen_1._) `${data} === null`); + cond = (0, codegen_1.not)(valid); + } + else { + gen.let(valid, false); + } + return [valid, cond]; +} +exports.checkNullable = checkNullable; +function checkNullableObject(cxt, cond) { + const [valid, cond_] = checkNullable(cxt, cond); + return [valid, (0, codegen_1._) `${cond_} && typeof ${cxt.data} == "object" && !Array.isArray(${cxt.data})`]; +} +exports.checkNullableObject = checkNullableObject; +//# sourceMappingURL=nullable.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map new file mode 100644 index 000000000..5bfaf3279 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/nullable.js.map @@ -0,0 +1 @@ +{"version":3,"file":"nullable.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/nullable.ts"],"names":[],"mappings":";;;AACA,mDAA6D;AAE7D,SAAgB,aAAa,CAC3B,EAAC,GAAG,EAAE,IAAI,EAAE,YAAY,EAAa,EACrC,OAAa,aAAG;IAEhB,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/B,IAAI,YAAY,CAAC,QAAQ,EAAE;QACzB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,CAAC,CAAA;QACnC,IAAI,GAAG,IAAA,aAAG,EAAC,KAAK,CAAC,CAAA;KAClB;SAAM;QACL,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;KACtB;IACD,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAZD,sCAYC;AAED,SAAgB,mBAAmB,CAAC,GAAe,EAAE,IAAU;IAC7D,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,aAAa,CAAC,GAAG,EAAE,IAAI,CAAC,CAAA;IAC/C,OAAO,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,KAAK,cAAc,GAAG,CAAC,IAAI,kCAAkC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAA;AAC9F,CAAC;AAHD,kDAGC"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js new file mode 100644 index 000000000..fe272758f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const properties_1 = require("./properties"); +const def = { + keyword: "optionalProperties", + schemaType: "object", + error: properties_1.error, + code(cxt) { + if (cxt.parentSchema.properties) + return; + (0, properties_1.validateProperties)(cxt); + }, +}; +exports.default = def; +//# sourceMappingURL=optionalProperties.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map new file mode 100644 index 000000000..21e5f0d47 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/optionalProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"optionalProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/optionalProperties.ts"],"names":[],"mappings":";;AAEA,6CAAsD;AAEtD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,oBAAoB;IAC7B,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAL,kBAAK;IACL,IAAI,CAAC,GAAe;QAClB,IAAI,GAAG,CAAC,YAAY,CAAC,UAAU;YAAE,OAAM;QACvC,IAAA,+BAAkB,EAAC,GAAG,CAAC,CAAA;IACzB,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts new file mode 100644 index 000000000..a1a2219f9 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/properties.d.ts @@ -0,0 +1,22 @@ +import type { CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition, SchemaObject } from "../../types"; +import type { KeywordCxt } from "../../compile/validate"; +import { _JTDTypeError } from "./error"; +declare enum PropError { + Additional = "additional", + Missing = "missing" +} +declare type PropKeyword = "properties" | "optionalProperties"; +declare type PropSchema = { + [P in string]?: SchemaObject; +}; +export declare type JTDPropertiesError = _JTDTypeError | ErrorObject | ErrorObject; +export declare const error: KeywordErrorDefinition; +declare const def: CodeKeywordDefinition; +export declare function validateProperties(cxt: KeywordCxt): void; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/properties.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/properties.js new file mode 100644 index 000000000..eccb066ec --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/properties.js @@ -0,0 +1,146 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateProperties = exports.error = void 0; +const code_1 = require("../code"); +const util_1 = require("../../compile/util"); +const codegen_1 = require("../../compile/codegen"); +const metadata_1 = require("./metadata"); +const nullable_1 = require("./nullable"); +const error_1 = require("./error"); +var PropError; +(function (PropError) { + PropError["Additional"] = "additional"; + PropError["Missing"] = "missing"; +})(PropError || (PropError = {})); +exports.error = { + message: (cxt) => { + const { params } = cxt; + return params.propError + ? params.propError === PropError.Additional + ? "must NOT have additional properties" + : `must have property '${params.missingProperty}'` + : (0, error_1.typeErrorMessage)(cxt, "object"); + }, + params: (cxt) => { + const { params } = cxt; + return params.propError + ? params.propError === PropError.Additional + ? (0, codegen_1._) `{error: ${params.propError}, additionalProperty: ${params.additionalProperty}}` + : (0, codegen_1._) `{error: ${params.propError}, missingProperty: ${params.missingProperty}}` + : (0, error_1.typeErrorParams)(cxt, "object"); + }, +}; +const def = { + keyword: "properties", + schemaType: "object", + error: exports.error, + code: validateProperties, +}; +// const error: KeywordErrorDefinition = { +// message: "should NOT have additional properties", +// params: ({params}) => _`{additionalProperty: ${params.additionalProperty}}`, +// } +function validateProperties(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, parentSchema, it } = cxt; + const { additionalProperties, nullable } = parentSchema; + if (it.jtdDiscriminator && nullable) + throw new Error("JTD: nullable inside discriminator mapping"); + if (commonProperties()) { + throw new Error("JTD: properties and optionalProperties have common members"); + } + const [allProps, properties] = schemaProperties("properties"); + const [allOptProps, optProperties] = schemaProperties("optionalProperties"); + if (properties.length === 0 && optProperties.length === 0 && additionalProperties) { + return; + } + const [valid, cond] = it.jtdDiscriminator === undefined + ? (0, nullable_1.checkNullableObject)(cxt, data) + : [gen.let("valid", false), true]; + gen.if(cond, () => gen.assign(valid, true).block(() => { + validateProps(properties, "properties", true); + validateProps(optProperties, "optionalProperties"); + if (!additionalProperties) + validateAdditional(); + })); + cxt.pass(valid); + function commonProperties() { + const props = parentSchema.properties; + const optProps = parentSchema.optionalProperties; + if (!(props && optProps)) + return false; + for (const p in props) { + if (Object.prototype.hasOwnProperty.call(optProps, p)) + return true; + } + return false; + } + function schemaProperties(keyword) { + const schema = parentSchema[keyword]; + const allPs = schema ? (0, code_1.allSchemaProperties)(schema) : []; + if (it.jtdDiscriminator && allPs.some((p) => p === it.jtdDiscriminator)) { + throw new Error(`JTD: discriminator tag used in ${keyword}`); + } + const ps = allPs.filter((p) => !(0, util_1.alwaysValidSchema)(it, schema[p])); + return [allPs, ps]; + } + function validateProps(props, keyword, required) { + const _valid = gen.var("valid"); + for (const prop of props) { + gen.if((0, code_1.propertyInData)(gen, data, prop, it.opts.ownProperties), () => applyPropertySchema(prop, keyword, _valid), () => missingProperty(prop)); + cxt.ok(_valid); + } + function missingProperty(prop) { + if (required) { + gen.assign(_valid, false); + cxt.error(false, { propError: PropError.Missing, missingProperty: prop }, { schemaPath: prop }); + } + else { + gen.assign(_valid, true); + } + } + } + function applyPropertySchema(prop, keyword, _valid) { + cxt.subschema({ + keyword, + schemaProp: prop, + dataProp: prop, + }, _valid); + } + function validateAdditional() { + gen.forIn("key", data, (key) => { + const _allProps = it.jtdDiscriminator === undefined ? allProps : [it.jtdDiscriminator].concat(allProps); + const addProp = isAdditional(key, _allProps, "properties"); + const addOptProp = isAdditional(key, allOptProps, "optionalProperties"); + const extra = addProp === true ? addOptProp : addOptProp === true ? addProp : (0, codegen_1.and)(addProp, addOptProp); + gen.if(extra, () => { + if (it.opts.removeAdditional) { + gen.code((0, codegen_1._) `delete ${data}[${key}]`); + } + else { + cxt.error(false, { propError: PropError.Additional, additionalProperty: key }, { instancePath: key, parentSchema: true }); + if (!it.opts.allErrors) + gen.break(); + } + }); + }); + } + function isAdditional(key, props, keyword) { + let additional; + if (props.length > 8) { + // TODO maybe an option instead of hard-coded 8? + const propsSchema = (0, util_1.schemaRefOrVal)(it, parentSchema[keyword], keyword); + additional = (0, codegen_1.not)((0, code_1.isOwnProperty)(gen, propsSchema, key)); + } + else if (props.length) { + additional = (0, codegen_1.and)(...props.map((p) => (0, codegen_1._) `${key} !== ${p}`)); + } + else { + additional = true; + } + return additional; + } +} +exports.validateProperties = validateProperties; +exports.default = def; +//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/properties.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/properties.js.map new file mode 100644 index 000000000..8a28a9e6a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/properties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/properties.ts"],"names":[],"mappings":";;;AAOA,kCAA0E;AAC1E,6CAAoE;AACpE,mDAA6D;AAC7D,yCAAwC;AACxC,yCAA8C;AAC9C,mCAAwE;AAExE,IAAK,SAGJ;AAHD,WAAK,SAAS;IACZ,sCAAyB,CAAA;IACzB,gCAAmB,CAAA;AACrB,CAAC,EAHI,SAAS,KAAT,SAAS,QAGb;AAWY,QAAA,KAAK,GAA2B;IAC3C,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACf,MAAM,EAAC,MAAM,EAAC,GAAG,GAAG,CAAA;QACpB,OAAO,MAAM,CAAC,SAAS;YACrB,CAAC,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,CAAC,UAAU;gBACzC,CAAC,CAAC,qCAAqC;gBACvC,CAAC,CAAC,uBAAuB,MAAM,CAAC,eAAe,GAAG;YACpD,CAAC,CAAC,IAAA,wBAAgB,EAAC,GAAG,EAAE,QAAQ,CAAC,CA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,kBAAkB,EAAE,GAAG,EAAC,EAC1D,EAAC,YAAY,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAC,CACxC,CAAA;oBACD,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS;wBAAE,GAAG,CAAC,KAAK,EAAE,CAAA;iBACpC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,SAAS,YAAY,CAAC,GAAS,EAAE,KAAe,EAAE,OAAe;QAC/D,IAAI,UAA0B,CAAA;QAC9B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;YACpB,gDAAgD;YAChD,MAAM,WAAW,GAAG,IAAA,qBAAc,EAAC,EAAE,EAAE,YAAY,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAA;YACtE,UAAU,GAAG,IAAA,aAAG,EAAC,IAAA,oBAAa,EAAC,GAAG,EAAE,WAAmB,EAAE,GAAG,CAAC,CAAC,CAAA;SAC/D;aAAM,IAAI,KAAK,CAAC,MAAM,EAAE;YACvB,UAAU,GAAG,IAAA,aAAG,EAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;SAC1D;aAAM;YACL,UAAU,GAAG,IAAI,CAAA;SAClB;QACD,OAAO,UAAU,CAAA;IACnB,CAAC;AACH,CAAC;AAnHD,gDAmHC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts new file mode 100644 index 000000000..ccdf84c0b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/ref.d.ts @@ -0,0 +1,4 @@ +import type { CodeKeywordDefinition, AnySchemaObject } from "../../types"; +declare const def: CodeKeywordDefinition; +export declare function hasRef(schema: AnySchemaObject): boolean; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/ref.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/ref.js new file mode 100644 index 000000000..b7c6b02d7 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/ref.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.hasRef = void 0; +const compile_1 = require("../../compile"); +const codegen_1 = require("../../compile/codegen"); +const ref_error_1 = require("../../compile/ref_error"); +const names_1 = require("../../compile/names"); +const ref_1 = require("../core/ref"); +const metadata_1 = require("./metadata"); +const def = { + keyword: "ref", + schemaType: "string", + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, schema: ref, parentSchema, it } = cxt; + const { schemaEnv: { root }, } = it; + const valid = gen.name("valid"); + if (parentSchema.nullable) { + gen.var(valid, (0, codegen_1._) `${data} === null`); + gen.if((0, codegen_1.not)(valid), validateJtdRef); + } + else { + gen.var(valid, false); + validateJtdRef(); + } + cxt.ok(valid); + function validateJtdRef() { + var _a; + const refSchema = (_a = root.schema.definitions) === null || _a === void 0 ? void 0 : _a[ref]; + if (!refSchema) { + throw new ref_error_1.default(it.opts.uriResolver, "", ref, `No definition ${ref}`); + } + if (hasRef(refSchema) || !it.opts.inlineRefs) + callValidate(refSchema); + else + inlineRefSchema(refSchema); + } + function callValidate(schema) { + const sch = compile_1.compileSchema.call(it.self, new compile_1.SchemaEnv({ schema, root, schemaPath: `/definitions/${ref}` })); + const v = (0, ref_1.getValidate)(cxt, sch); + const errsCount = gen.const("_errs", names_1.default.errors); + (0, ref_1.callRef)(cxt, v, sch, sch.$async); + gen.assign(valid, (0, codegen_1._) `${errsCount} === ${names_1.default.errors}`); + } + function inlineRefSchema(schema) { + const schName = gen.scopeValue("schema", it.opts.code.source === true ? { ref: schema, code: (0, codegen_1.stringify)(schema) } : { ref: schema }); + cxt.subschema({ + schema, + dataTypes: [], + schemaPath: codegen_1.nil, + topSchemaRef: schName, + errSchemaPath: `/definitions/${ref}`, + }, valid); + } + }, +}; +function hasRef(schema) { + for (const key in schema) { + let sch; + if (key === "ref" || (typeof (sch = schema[key]) == "object" && hasRef(sch))) + return true; + } + return false; +} +exports.hasRef = hasRef; +exports.default = def; +//# sourceMappingURL=ref.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/ref.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/ref.js.map new file mode 100644 index 000000000..c11c45c1f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/ref.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ref.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/ref.ts"],"names":[],"mappings":";;;AAEA,2CAAsD;AACtD,mDAA4D;AAC5D,uDAAqD;AACrD,+CAAmC;AACnC,qCAAgD;AAChD,yCAAwC;AAExC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,KAAK;IACd,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,GAAe;QAClB,IAAA,wBAAa,EAAC,GAAG,CAAC,CAAA;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACtD,MAAM,EACJ,SAAS,EAAE,EAAC,IAAI,EAAC,GAClB,GAAG,EAAE,CAAA;QACN,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QAC/B,IAAI,YAAY,CAAC,QAAQ,EAAE;YACzB,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,CAAC,CAAA;YACnC,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,KAAK,CAAC,EAAE,cAAc,CAAC,CAAA;SACnC;aAAM;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,CAC5B,QAAQ,EACR,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAA,mBAAS,EAAC,MAAM,CAAC,EAAC,CAAC,CAAC,CAAC,EAAC,GAAG,EAAE,MAAM,EAAC,CACtF,CAAA;YACD,GAAG,CAAC,SAAS,CACX;gBACE,MAAM;gBACN,SAAS,EAAE,EAAE;gBACb,UAAU,EAAE,aAAG;gBACf,YAAY,EAAE,OAAO;gBACrB,aAAa,EAAE,gBAAgB,GAAG,EAAE;aACrC,EACD,KAAK,CACN,CAAA;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,SAAgB,MAAM,CAAC,MAAuB;IAC5C,KAAK,MAAM,GAAG,IAAI,MAAM,EAAE;QACxB,IAAI,GAAoB,CAAA;QACxB,IAAI,GAAG,KAAK,KAAK,IAAI,CAAC,OAAO,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC;YAAE,OAAO,IAAI,CAAA;KAC1F;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAND,wBAMC;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/type.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/type.d.ts new file mode 100644 index 000000000..321f9aad1 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/type.d.ts @@ -0,0 +1,10 @@ +import type { CodeKeywordDefinition } from "../../types"; +import { _JTDTypeError } from "./error"; +export declare type JTDTypeError = _JTDTypeError<"type", JTDType, JTDType>; +export declare type IntType = "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32"; +export declare const intRange: { + [T in IntType]: [number, number, number]; +}; +export declare type JTDType = "boolean" | "string" | "timestamp" | "float32" | "float64" | IntType; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/type.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/type.js new file mode 100644 index 000000000..17a0b5107 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/type.js @@ -0,0 +1,69 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.intRange = void 0; +const codegen_1 = require("../../compile/codegen"); +const timestamp_1 = require("../../runtime/timestamp"); +const util_1 = require("../../compile/util"); +const metadata_1 = require("./metadata"); +const error_1 = require("./error"); +exports.intRange = { + int8: [-128, 127, 3], + uint8: [0, 255, 3], + int16: [-32768, 32767, 5], + uint16: [0, 65535, 5], + int32: [-2147483648, 2147483647, 10], + uint32: [0, 4294967295, 10], +}; +const error = { + message: (cxt) => (0, error_1.typeErrorMessage)(cxt, cxt.schema), + params: (cxt) => (0, error_1.typeErrorParams)(cxt, cxt.schema), +}; +function timestampCode(cxt) { + const { gen, data, it } = cxt; + const { timestamp, allowDate } = it.opts; + if (timestamp === "date") + return (0, codegen_1._) `${data} instanceof Date `; + const vts = (0, util_1.useFunc)(gen, timestamp_1.default); + const allowDateArg = allowDate ? (0, codegen_1._) `, true` : codegen_1.nil; + const validString = (0, codegen_1._) `typeof ${data} == "string" && ${vts}(${data}${allowDateArg})`; + return timestamp === "string" ? validString : (0, codegen_1.or)((0, codegen_1._) `${data} instanceof Date`, validString); +} +const def = { + keyword: "type", + schemaType: "string", + error, + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { data, schema, parentSchema, it } = cxt; + let cond; + switch (schema) { + case "boolean": + case "string": + cond = (0, codegen_1._) `typeof ${data} == ${schema}`; + break; + case "timestamp": { + cond = timestampCode(cxt); + break; + } + case "float32": + case "float64": + cond = (0, codegen_1._) `typeof ${data} == "number"`; + break; + default: { + const sch = schema; + cond = (0, codegen_1._) `typeof ${data} == "number" && isFinite(${data}) && !(${data} % 1)`; + if (!it.opts.int32range && (sch === "int32" || sch === "uint32")) { + if (sch === "uint32") + cond = (0, codegen_1._) `${cond} && ${data} >= 0`; + } + else { + const [min, max] = exports.intRange[sch]; + cond = (0, codegen_1._) `${cond} && ${data} >= ${min} && ${data} <= ${max}`; + } + } + } + cxt.pass(parentSchema.nullable ? (0, codegen_1.or)((0, codegen_1._) `${data} === null`, cond) : cond); + }, +}; +exports.default = def; +//# sourceMappingURL=type.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/type.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/type.js.map new file mode 100644 index 000000000..9d3393907 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/type.ts"],"names":[],"mappings":";;;AAEA,mDAAsD;AACtD,uDAAoD;AACpD,6CAA0C;AAC1C,yCAAwC;AACxC,mCAAwE;AAM3D,QAAA,QAAQ,GAA+C;IAClE,IAAI,EAAE,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC;IACpB,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;IAClB,KAAK,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACzB,MAAM,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IACrB,KAAK,EAAE,CAAC,CAAC,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC;IACpC,MAAM,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,CAAC;CAC5B,CAAA;AAID,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,wBAAgB,EAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC;IACnD,MAAM,EAAE,CAAC,GAA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CAAC;gBAChB,IAAI,GAAG,aAAa,CAAC,GAAG,CAAC,CAAA;gBACzB,MAAK;aACN;YACD,KAAK,SAAS,CAAC;YACf,KAAK,SAAS;gBACZ,IAAI,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,cAAc,CAAA;gBACpC,MAAK;YACP,OAAO,CAAC,CAAC;gBACP,MAAM,GAAG,GAAG,MAAiB,CAAA;gBAC7B,IAAI,GAAG,IAAA,WAAC,EAAA,UAAU,IAAI,4BAA4B,IAAI,UAAU,IAAI,OAAO,CAAA;gBAC3E,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,QAAQ,CAAC,EAAE;oBAChE,IAAI,GAAG,KAAK,QAAQ;wBAAE,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,OAAO,IAAI,OAAO,CAAA;iBACxD;qBAAM;oBACL,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,gBAAQ,CAAC,GAAG,CAAC,CAAA;oBAChC,IAAI,GAAG,IAAA,WAAC,EAAA,GAAG,IAAI,OAAO,IAAI,OAAO,GAAG,OAAO,IAAI,OAAO,GAAG,EAAE,CAAA;iBAC5D;aACF;SACF;QACD,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAA,YAAE,EAAC,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;IACxE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/union.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/union.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/union.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/union.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/union.js new file mode 100644 index 000000000..01a943994 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/union.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const def = { + keyword: "union", + schemaType: "array", + trackErrors: true, + code: code_1.validateUnion, + error: { message: "must match a schema in union" }, +}; +exports.default = def; +//# sourceMappingURL=union.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/union.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/union.js.map new file mode 100644 index 000000000..4d6eb4119 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/union.js.map @@ -0,0 +1 @@ +{"version":3,"file":"union.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/union.ts"],"names":[],"mappings":";;AACA,kCAAqC;AAErC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,IAAI;IACjB,IAAI,EAAE,oBAAa;IACnB,KAAK,EAAE,EAAC,OAAO,EAAE,8BAA8B,EAAC;CACjD,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/values.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/values.d.ts new file mode 100644 index 000000000..1ff367dfb --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/values.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition, SchemaObject } from "../../types"; +import { _JTDTypeError } from "./error"; +export declare type JTDValuesError = _JTDTypeError<"values", "object", SchemaObject>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/values.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/values.js new file mode 100644 index 000000000..e464c0be8 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/values.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const codegen_1 = require("../../compile/codegen"); +const metadata_1 = require("./metadata"); +const nullable_1 = require("./nullable"); +const error_1 = require("./error"); +const def = { + keyword: "values", + schemaType: "object", + error: (0, error_1.typeError)("object"), + code(cxt) { + (0, metadata_1.checkMetadata)(cxt); + const { gen, data, schema, it } = cxt; + if ((0, util_1.alwaysValidSchema)(it, schema)) + return; + const [valid, cond] = (0, nullable_1.checkNullableObject)(cxt, data); + gen.if(cond); + gen.assign(valid, validateMap()); + gen.elseIf((0, codegen_1.not)(valid)); + cxt.error(); + gen.endIf(); + cxt.ok(valid); + function validateMap() { + const _valid = gen.name("valid"); + if (it.allErrors) { + const validMap = gen.let("valid", true); + validateValues(() => gen.assign(validMap, false)); + return validMap; + } + gen.var(_valid, true); + validateValues(() => gen.break()); + return _valid; + function validateValues(notValid) { + gen.forIn("key", data, (key) => { + cxt.subschema({ + keyword: "values", + dataProp: key, + dataPropType: util_1.Type.Str, + }, _valid); + gen.if((0, codegen_1.not)(_valid), notValid); + }); + } + } + }, +}; +exports.default = def; +//# sourceMappingURL=values.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/values.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/values.js.map new file mode 100644 index 000000000..8905b41c2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/jtd/values.js.map @@ -0,0 +1 @@ +{"version":3,"file":"values.js","sourceRoot":"","sources":["../../../lib/vocabularies/jtd/values.ts"],"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YACrB,cAAc,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;YACjC,OAAO,MAAM,CAAA;YAEb,SAAS,cAAc,CAAC,QAAoB;gBAC1C,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE;oBAC7B,GAAG,CAAC,SAAS,CACX;wBACE,OAAO,EAAE,QAAQ;wBACjB,QAAQ,EAAE,GAAG;wBACb,YAAY,EAAE,WAAI,CAAC,GAAG;qBACvB,EACD,MAAM,CACP,CAAA;oBACD,GAAG,CAAC,EAAE,CAAC,IAAA,aAAG,EAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAA;gBAC/B,CAAC,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/metadata.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/metadata.d.ts new file mode 100644 index 000000000..df9cc07ca --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/metadata.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../types"; +export declare const metadataVocabulary: Vocabulary; +export declare const contentVocabulary: Vocabulary; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/metadata.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/metadata.js new file mode 100644 index 000000000..f07bf28b5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/metadata.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.contentVocabulary = exports.metadataVocabulary = void 0; +exports.metadataVocabulary = [ + "title", + "description", + "default", + "deprecated", + "readOnly", + "writeOnly", + "examples", +]; +exports.contentVocabulary = [ + "contentMediaType", + "contentEncoding", + "contentSchema", +]; +//# sourceMappingURL=metadata.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/metadata.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/metadata.js.map new file mode 100644 index 000000000..0d61f0831 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/metadata.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../lib/vocabularies/metadata.ts"],"names":[],"mappings":";;;AAEa,QAAA,kBAAkB,GAAe;IAC5C,OAAO;IACP,aAAa;IACb,SAAS;IACT,YAAY;IACZ,UAAU;IACV,WAAW;IACX,UAAU;CACX,CAAA;AAEY,QAAA,iBAAiB,GAAe;IAC3C,kBAAkB;IAClB,iBAAiB;IACjB,eAAe;CAChB,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/next.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/next.d.ts new file mode 100644 index 000000000..7fd5c644b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/next.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../types"; +declare const next: Vocabulary; +export default next; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/next.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/next.js new file mode 100644 index 000000000..c861b3243 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/next.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dependentRequired_1 = require("./validation/dependentRequired"); +const dependentSchemas_1 = require("./applicator/dependentSchemas"); +const limitContains_1 = require("./validation/limitContains"); +const next = [dependentRequired_1.default, dependentSchemas_1.default, limitContains_1.default]; +exports.default = next; +//# sourceMappingURL=next.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/next.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/next.js.map new file mode 100644 index 000000000..474a6d4e7 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/next.js.map @@ -0,0 +1 @@ +{"version":3,"file":"next.js","sourceRoot":"","sources":["../../lib/vocabularies/next.ts"],"names":[],"mappings":";;AACA,sEAA8D;AAC9D,oEAA4D;AAC5D,8DAAsD;AAEtD,MAAM,IAAI,GAAe,CAAC,2BAAiB,EAAE,0BAAgB,EAAE,uBAAa,CAAC,CAAA;AAE7E,kBAAe,IAAI,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts new file mode 100644 index 000000000..ec67e63ea --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/index.d.ts @@ -0,0 +1,3 @@ +import type { Vocabulary } from "../../types"; +declare const unevaluated: Vocabulary; +export default unevaluated; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/index.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/index.js new file mode 100644 index 000000000..30e316748 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/index.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const unevaluatedProperties_1 = require("./unevaluatedProperties"); +const unevaluatedItems_1 = require("./unevaluatedItems"); +const unevaluated = [unevaluatedProperties_1.default, unevaluatedItems_1.default]; +exports.default = unevaluated; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map new file mode 100644 index 000000000..a4872ea43 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/unevaluated/index.ts"],"names":[],"mappings":";;AACA,mEAA2D;AAC3D,yDAAiD;AAEjD,MAAM,WAAW,GAAe,CAAC,+BAAqB,EAAE,0BAAgB,CAAC,CAAA;AAEzE,kBAAe,WAAW,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts new file mode 100644 index 000000000..f108b6e4e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export declare type UnevaluatedItemsError = ErrorObject<"unevaluatedItems", { + limit: number; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js new file mode 100644 index 000000000..0a0cd3aa4 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js @@ -0,0 +1,40 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params: { len } }) => (0, codegen_1.str) `must NOT have more than ${len} items`, + params: ({ params: { len } }) => (0, codegen_1._) `{limit: ${len}}`, +}; +const def = { + keyword: "unevaluatedItems", + type: "array", + schemaType: ["boolean", "object"], + error, + code(cxt) { + const { gen, schema, data, it } = cxt; + const items = it.items || 0; + if (items === true) + return; + const len = gen.const("len", (0, codegen_1._) `${data}.length`); + if (schema === false) { + cxt.setParams({ len: items }); + cxt.fail((0, codegen_1._) `${len} > ${items}`); + } + else if (typeof schema == "object" && !(0, util_1.alwaysValidSchema)(it, schema)) { + const valid = gen.var("valid", (0, codegen_1._) `${len} <= ${items}`); + gen.if((0, codegen_1.not)(valid), () => validateItems(valid, items)); + cxt.ok(valid); + } + it.items = true; + function validateItems(valid, from) { + gen.forRange("i", from, len, (i) => { + cxt.subschema({ keyword: "unevaluatedItems", dataProp: i, dataPropType: util_1.Type.Num }, valid); + if (!it.allErrors) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + }); + } + }, +}; +exports.default = def; +//# sourceMappingURL=unevaluatedItems.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map new file mode 100644 index 000000000..a8268f031 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedItems.js.map @@ -0,0 +1 @@ +{"version":3,"file":"unevaluatedItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/unevaluated/unevaluatedItems.ts"],"names":[],"mappings":";;AAOA,mDAAuD;AACvD,6CAA0D;AAI1D,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,2BAA2B,GAAG,QAAQ;IACvE,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,GAAG,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,GAAG,GAAG;CAChD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;IACjC,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACnC,MAAM,KAAK,GAAG,EAAE,CAAC,KAAK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,GAAG,CAAC,KAAK,EAAE,CAAC,CAAA;YAC1D,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts new file mode 100644 index 000000000..0a041ff75 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject, AnySchema } from "../../types"; +export declare type UnevaluatedPropertiesError = ErrorObject<"unevaluatedProperties", { + unevaluatedProperty: string; +}, AnySchema>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js new file mode 100644 index 000000000..ad298499f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js @@ -0,0 +1,65 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const names_1 = require("../../compile/names"); +const error = { + message: "must NOT have unevaluated properties", + params: ({ params }) => (0, codegen_1._) `{unevaluatedProperty: ${params.unevaluatedProperty}}`, +}; +const def = { + keyword: "unevaluatedProperties", + type: "object", + schemaType: ["boolean", "object"], + trackErrors: true, + error, + code(cxt) { + const { gen, schema, data, errsCount, it } = cxt; + /* istanbul ignore if */ + if (!errsCount) + throw new Error("ajv implementation error"); + const { allErrors, props } = it; + if (props instanceof codegen_1.Name) { + gen.if((0, codegen_1._) `${props} !== true`, () => gen.forIn("key", data, (key) => gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key)))); + } + else if (props !== true) { + gen.forIn("key", data, (key) => props === undefined + ? unevaluatedPropCode(key) + : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key))); + } + it.props = true; + cxt.ok((0, codegen_1._) `${errsCount} === ${names_1.default.errors}`); + function unevaluatedPropCode(key) { + if (schema === false) { + cxt.setParams({ unevaluatedProperty: key }); + cxt.error(); + if (!allErrors) + gen.break(); + return; + } + if (!(0, util_1.alwaysValidSchema)(it, schema)) { + const valid = gen.name("valid"); + cxt.subschema({ + keyword: "unevaluatedProperties", + dataProp: key, + dataPropType: util_1.Type.Str, + }, valid); + if (!allErrors) + gen.if((0, codegen_1.not)(valid), () => gen.break()); + } + } + function unevaluatedDynamic(evaluatedProps, key) { + return (0, codegen_1._) `!${evaluatedProps} || !${evaluatedProps}[${key}]`; + } + function unevaluatedStatic(evaluatedProps, key) { + const ps = []; + for (const p in evaluatedProps) { + if (evaluatedProps[p] === true) + ps.push((0, codegen_1._) `${key} !== ${p}`); + } + return (0, codegen_1.and)(...ps); + } + }, +}; +exports.default = def; +//# sourceMappingURL=unevaluatedProperties.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map new file mode 100644 index 000000000..f415251ee --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/unevaluated/unevaluatedProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"unevaluatedProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/unevaluated/unevaluatedProperties.ts"],"names":[],"mappings":";;AAMA,mDAA6D;AAC7D,6CAA0D;AAC1D,+CAAmC;AAQnC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,sCAAsC;IAC/C,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,yBAAyB,MAAM,CAAC,mBAAmB,GA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IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/const.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/const.d.ts new file mode 100644 index 000000000..85e11ce52 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/const.d.ts @@ -0,0 +1,6 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export declare type ConstError = ErrorObject<"const", { + allowedValue: any; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/const.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/const.js new file mode 100644 index 000000000..9564496a6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/const.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const equal_1 = require("../../runtime/equal"); +const error = { + message: "must be equal to constant", + params: ({ schemaCode }) => (0, codegen_1._) `{allowedValue: ${schemaCode}}`, +}; +const def = { + keyword: "const", + $data: true, + error, + code(cxt) { + const { gen, data, $data, schemaCode, schema } = cxt; + if ($data || (schema && typeof schema == "object")) { + cxt.fail$data((0, codegen_1._) `!${(0, util_1.useFunc)(gen, equal_1.default)}(${data}, ${schemaCode})`); + } + else { + cxt.fail((0, codegen_1._) `${schema} !== ${data}`); + } + }, +}; +exports.default = def; +//# sourceMappingURL=const.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/const.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/const.js.map new file mode 100644 index 000000000..0cf6cd14c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/const.js.map @@ -0,0 +1 @@ +{"version":3,"file":"const.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/const.ts"],"names":[],"mappings":";;AAEA,mDAAuC;AACvC,6CAA0C;AAC1C,+CAAuC;AAIvC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,2BAA2B;IACpC,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,kBAAkB,UAAU,GAAG;CAC3D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,OAAO;IAChB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAC,GAAG,GAAG,CAAA;QAClD,IAAI,KAAK,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,IAAI,QAAQ,CAAC,EAAE;YAClD,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,IAAI,IAAA,cAAO,EAAC,GAAG,EAAE,eAAK,CAAC,IAAI,IAAI,KAAK,UAAU,GAAG,CAAC,CAAA;SAClE;aAAM;YACL,GAAG,CAAC,IAAI,CAAC,IAAA,WAAC,EAAA,GAAG,MAAM,QAAQ,IAAI,EAAE,CAAC,CAAA;SACnC;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts new file mode 100644 index 000000000..2e25408e6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/dependentRequired.d.ts @@ -0,0 +1,5 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +import { DependenciesErrorParams, PropertyDependencies } from "../applicator/dependencies"; +export declare type DependentRequiredError = ErrorObject<"dependentRequired", DependenciesErrorParams, PropertyDependencies>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js new file mode 100644 index 000000000..09e59639f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dependencies_1 = require("../applicator/dependencies"); +const def = { + keyword: "dependentRequired", + type: "object", + schemaType: "object", + error: dependencies_1.error, + code: (cxt) => (0, dependencies_1.validatePropertyDeps)(cxt), +}; +exports.default = def; +//# sourceMappingURL=dependentRequired.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map new file mode 100644 index 000000000..c7e88f885 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/dependentRequired.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dependentRequired.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/dependentRequired.ts"],"names":[],"mappings":";;AACA,6DAKmC;AAQnC,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,mBAAmB;IAC5B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAL,oBAAK;IACL,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,mCAAoB,EAAC,GAAG,CAAC;CACzC,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/enum.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/enum.d.ts new file mode 100644 index 000000000..dce653b56 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/enum.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export declare type EnumError = ErrorObject<"enum", { + allowedValues: any[]; +}, any[] | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/enum.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/enum.js new file mode 100644 index 000000000..eab6487e9 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/enum.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const equal_1 = require("../../runtime/equal"); +const error = { + message: "must be equal to one of the allowed values", + params: ({ schemaCode }) => (0, codegen_1._) `{allowedValues: ${schemaCode}}`, +}; +const def = { + keyword: "enum", + schemaType: "array", + $data: true, + error, + code(cxt) { + const { gen, data, $data, schema, schemaCode, it } = cxt; + if (!$data && schema.length === 0) + throw new Error("enum must have non-empty array"); + const useLoop = schema.length >= it.opts.loopEnum; + let eql; + const getEql = () => (eql !== null && eql !== void 0 ? eql : (eql = (0, util_1.useFunc)(gen, equal_1.default))); + let valid; + if (useLoop || $data) { + valid = gen.let("valid"); + cxt.block$data(valid, loopEnum); + } + else { + /* istanbul ignore if */ + if (!Array.isArray(schema)) + throw new Error("ajv implementation error"); + const vSchema = gen.const("vSchema", schemaCode); + valid = (0, codegen_1.or)(...schema.map((_x, i) => equalCode(vSchema, i))); + } + cxt.pass(valid); + function loopEnum() { + gen.assign(valid, false); + gen.forOf("v", schemaCode, (v) => gen.if((0, codegen_1._) `${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break())); + } + function equalCode(vSchema, i) { + const sch = schema[i]; + return typeof sch === "object" && sch !== null + ? (0, codegen_1._) `${getEql()}(${data}, ${vSchema}[${i}])` + : (0, codegen_1._) `${data} === ${sch}`; + } + }, +}; +exports.default = def; +//# sourceMappingURL=enum.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/enum.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/enum.js.map new file mode 100644 index 000000000..7b4e1eda9 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/enum.js.map @@ -0,0 +1 @@ +{"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/enum.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AACvD,6CAA0C;AAC1C,+CAAuC;AAIvC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,4CAA4C;IACrD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,mBAAmB,UAAU,GAAG;CAC5D,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,MAAM;IACf,UAAU,EAAE,OAAO;IACnB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACtD,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QACpF,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAA;QACjD,IAAI,GAAqB,CAAA;QACzB,MAAM,MAAM,GAAG,GAAS,EAAE,CAAC,CAAC,GAAG,aAAH,GAAG,cAAH,GAAG,IAAH,GAAG,GAAK,IAAA,cAAO,EAAC,GAAG,EAAE,eAAK,CAAC,EAAC,CAAA;QAExD,IAAI,KAAW,CAAA;QACf,IAAI,OAAO,IAAI,KAAK,EAAE;YACpB,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;YACxB,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE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modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/index.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/index.d.ts new file mode 100644 index 000000000..08cd22396 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/index.d.ts @@ -0,0 +1,16 @@ +import type { ErrorObject, Vocabulary } from "../../types"; +import { LimitNumberError } from "./limitNumber"; +import { MultipleOfError } from "./multipleOf"; +import { PatternError } from "./pattern"; +import { RequiredError } from "./required"; +import { UniqueItemsError } from "./uniqueItems"; +import { ConstError } from "./const"; +import { EnumError } from "./enum"; +declare const validation: Vocabulary; +export default validation; +declare type LimitError = ErrorObject<"maxItems" | "minItems" | "minProperties" | "maxProperties" | "minLength" | "maxLength", { + limit: number; +}, number | { + $data: string; +}>; +export declare type ValidationKeywordError = LimitError | LimitNumberError | MultipleOfError | PatternError | RequiredError | UniqueItemsError | ConstError | EnumError; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/index.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/index.js new file mode 100644 index 000000000..7b56b4e45 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/index.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const limitNumber_1 = require("./limitNumber"); +const multipleOf_1 = require("./multipleOf"); +const limitLength_1 = require("./limitLength"); +const pattern_1 = require("./pattern"); +const limitProperties_1 = require("./limitProperties"); +const required_1 = require("./required"); +const limitItems_1 = require("./limitItems"); +const uniqueItems_1 = require("./uniqueItems"); +const const_1 = require("./const"); +const enum_1 = require("./enum"); +const validation = [ + // number + limitNumber_1.default, + multipleOf_1.default, + // string + limitLength_1.default, + pattern_1.default, + // object + limitProperties_1.default, + required_1.default, + // array + limitItems_1.default, + uniqueItems_1.default, + // any + { keyword: "type", schemaType: ["string", "array"] }, + { keyword: "nullable", schemaType: "boolean" }, + const_1.default, + enum_1.default, +]; +exports.default = validation; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/index.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/index.js.map new file mode 100644 index 000000000..69436fb32 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/index.ts"],"names":[],"mappings":";;AACA,+CAA2D;AAC3D,6CAAwD;AACxD,+CAAuC;AACvC,uCAA+C;AAC/C,uDAA+C;AAC/C,yCAAkD;AAClD,6CAAqC;AACrC,+CAA2D;AAC3D,mCAAgD;AAChD,iCAA6C;AAE7C,MAAM,UAAU,GAAe;IAC7B,SAAS;IACT,qBAAW;IACX,oBAAU;IACV,SAAS;IACT,qBAAW;IACX,iBAAO;IACP,SAAS;IACT,yBAAe;IACf,kBAAQ;IACR,QAAQ;IACR,oBAAU;IACV,qBAAW;IACX,MAAM;IACN,EAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAC;IAClD,EAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAC;IAC5C,eAAY;IACZ,cAAW;CACZ,CAAA;AAED,kBAAe,UAAU,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitContains.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitContains.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitContains.js new file mode 100644 index 000000000..c884dae4b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitContains.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const util_1 = require("../../compile/util"); +const def = { + keyword: ["maxContains", "minContains"], + type: "array", + schemaType: "number", + code({ keyword, parentSchema, it }) { + if (parentSchema.contains === undefined) { + (0, util_1.checkStrictMode)(it, `"${keyword}" without "contains" is ignored`); + } + }, +}; +exports.default = def; +//# sourceMappingURL=limitContains.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map new file mode 100644 index 000000000..788010aa9 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitContains.js.map @@ -0,0 +1 @@ +{"version":3,"file":"limitContains.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitContains.ts"],"names":[],"mappings":";;AAEA,6CAAkD;AAElD,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,aAAa,EAAE,aAAa,CAAC;IACvC,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,QAAQ;IACpB,IAAI,CAAC,EAAC,OAAO,EAAE,YAAY,EAAE,EAAE,EAAa;QAC1C,IAAI,YAAY,CAAC,QAAQ,KAAK,SAAS,EAAE;YACvC,IAAA,sBAAe,EAAC,EAAE,EAAE,IAAI,OAAO,iCAAiC,CAAC,CAAA;SAClE;IACH,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitItems.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitItems.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitItems.js new file mode 100644 index 000000000..e1386f887 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitItems.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const error = { + message({ keyword, schemaCode }) { + const comp = keyword === "maxItems" ? "more" : "fewer"; + return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} items`; + }, + params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`, +}; +const def = { + keyword: ["maxItems", "minItems"], + type: "array", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + const op = keyword === "maxItems" ? codegen_1.operators.GT : codegen_1.operators.LT; + cxt.fail$data((0, codegen_1._) `${data}.length ${op} ${schemaCode}`); + }, +}; +exports.default = def; +//# sourceMappingURL=limitItems.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map new file mode 100644 index 000000000..690c73456 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map @@ -0,0 +1 @@ +{"version":3,"file":"limitItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitItems.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AAEvD,MAAM,KAAK,GAA2B;IACpC,OAAO,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;QACtD,OAAO,IAAA,aAAG,EAAA,iBAAiB,IAAI,SAAS,UAAU,QAAQ,CAAA;IAC5D,CAAC;IACD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,UAAU,GAAG;CACpD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC;IACjC,IAAI,EAAE,OAAO;IACb,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAC,GAAG,GAAG,CAAA;QACvC,MAAM,EAAE,GAAG,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAA;QAC/D,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,WAAW,EAAE,IAAI,UAAU,EAAE,CAAC,CAAA;IACtD,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitLength.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitLength.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitLength.js new file mode 100644 index 000000000..6ae5f92e6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitLength.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const ucs2length_1 = require("../../runtime/ucs2length"); +const error = { + message({ keyword, schemaCode }) { + const comp = keyword === "maxLength" ? "more" : "fewer"; + return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} characters`; + }, + params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`, +}; +const def = { + keyword: ["maxLength", "minLength"], + type: "string", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode, it } = cxt; + const op = keyword === "maxLength" ? codegen_1.operators.GT : codegen_1.operators.LT; + const len = it.opts.unicode === false ? (0, codegen_1._) `${data}.length` : (0, codegen_1._) `${(0, util_1.useFunc)(cxt.gen, ucs2length_1.default)}(${data})`; + cxt.fail$data((0, codegen_1._) `${len} ${op} ${schemaCode}`); + }, +}; +exports.default = def; +//# sourceMappingURL=limitLength.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map new file mode 100644 index 000000000..f09c35e54 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map @@ -0,0 +1 @@ +{"version":3,"file":"limitLength.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitLength.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AACvD,6CAA0C;AAC1C,yDAAiD;AAEjD,MAAM,KAAK,GAA2B;IACpC,OAAO,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;QACvD,OAAO,IAAA,aAAG,EAAA,iBAAiB,IAAI,SAAS,UAAU,aAAa,CAAA;IACjE,CAAC;IACD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,UAAU,GAAG;CACpD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC;IACnC,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QAC3C,MAAM,EAAE,GAAG,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAA;QAChE,MAAM,GAAG,GACP,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,IAAA,cAAO,EAAC,GAAG,CAAC,GAAG,EAAE,oBAAU,CAAC,IAAI,IAAI,GAAG,CAAA;QAC7F,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,IAAI,EAAE,IAAI,UAAU,EAAE,CAAC,CAAA;IAC9C,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts new file mode 100644 index 000000000..2d3890855 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitNumber.d.ts @@ -0,0 +1,11 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +declare type Kwd = "maximum" | "minimum" | "exclusiveMaximum" | "exclusiveMinimum"; +declare type Comparison = "<=" | ">=" | "<" | ">"; +export declare type LimitNumberError = ErrorObject; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitNumber.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitNumber.js new file mode 100644 index 000000000..a97c0eb9d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitNumber.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const ops = codegen_1.operators; +const KWDs = { + maximum: { okStr: "<=", ok: ops.LTE, fail: ops.GT }, + minimum: { okStr: ">=", ok: ops.GTE, fail: ops.LT }, + exclusiveMaximum: { okStr: "<", ok: ops.LT, fail: ops.GTE }, + exclusiveMinimum: { okStr: ">", ok: ops.GT, fail: ops.LTE }, +}; +const error = { + message: ({ keyword, schemaCode }) => (0, codegen_1.str) `must be ${KWDs[keyword].okStr} ${schemaCode}`, + params: ({ keyword, schemaCode }) => (0, codegen_1._) `{comparison: ${KWDs[keyword].okStr}, limit: ${schemaCode}}`, +}; +const def = { + keyword: Object.keys(KWDs), + type: "number", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + cxt.fail$data((0, codegen_1._) `${data} ${KWDs[keyword].fail} ${schemaCode} || isNaN(${data})`); + }, +}; +exports.default = def; +//# sourceMappingURL=limitNumber.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map new file mode 100644 index 000000000..18a365337 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map @@ -0,0 +1 @@ +{"version":3,"file":"limitNumber.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitNumber.ts"],"names":[],"mappings":";;AAEA,mDAA6D;AAE7D,MAAM,GAAG,GAAG,mBAAS,CAAA;AAMrB,MAAM,IAAI,GAA4D;IACpE,OAAO,EAAE,EAAC,KAAK,EAAE,IAAI,EAAE,EA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G,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts new file mode 100644 index 000000000..cde2aa270 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitProperties.d.ts @@ -0,0 +1,3 @@ +import type { CodeKeywordDefinition } from "../../types"; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitProperties.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitProperties.js new file mode 100644 index 000000000..e6fc40cc6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitProperties.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const error = { + message({ keyword, schemaCode }) { + const comp = keyword === "maxProperties" ? "more" : "fewer"; + return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} properties`; + }, + params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`, +}; +const def = { + keyword: ["maxProperties", "minProperties"], + type: "object", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { keyword, data, schemaCode } = cxt; + const op = keyword === "maxProperties" ? codegen_1.operators.GT : codegen_1.operators.LT; + cxt.fail$data((0, codegen_1._) `Object.keys(${data}).length ${op} ${schemaCode}`); + }, +}; +exports.default = def; +//# sourceMappingURL=limitProperties.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map new file mode 100644 index 000000000..a695943a9 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"limitProperties.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/limitProperties.ts"],"names":[],"mappings":";;AAEA,mDAAuD;AAEvD,MAAM,KAAK,GAA2B;IACpC,OAAO,CAAC,EAAC,OAAO,EAAE,UAAU,EAAC;QAC3B,MAAM,IAAI,GAAG,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAA;QAC3D,OAAO,IAAA,aAAG,EAAA,iBAAiB,IAAI,SAAS,UAAU,aAAa,CAAA;IACjE,CAAC;IACD,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,WAAW,UAAU,GAAG;CACpD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC;IAC3C,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAC,GAAG,GAAG,CAAA;QACvC,MAAM,EAAE,GAAG,OAAO,KAAK,eAAe,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAC,CAAC,CAAC,mBAAS,CAAC,EAAE,CAAA;QACpE,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,eAAe,IAAI,YAAY,EAAE,IAAI,UAAU,EAAE,CAAC,CAAA;IACnE,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts new file mode 100644 index 000000000..afa29d357 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/multipleOf.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export declare type MultipleOfError = ErrorObject<"multipleOf", { + multipleOf: number; +}, number | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/multipleOf.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/multipleOf.js new file mode 100644 index 000000000..43cf67b77 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/multipleOf.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const codegen_1 = require("../../compile/codegen"); +const error = { + message: ({ schemaCode }) => (0, codegen_1.str) `must be multiple of ${schemaCode}`, + params: ({ schemaCode }) => (0, codegen_1._) `{multipleOf: ${schemaCode}}`, +}; +const def = { + keyword: "multipleOf", + type: "number", + schemaType: "number", + $data: true, + error, + code(cxt) { + const { gen, data, schemaCode, it } = cxt; + // const bdt = bad$DataType(schemaCode, def.schemaType, $data) + const prec = it.opts.multipleOfPrecision; + const res = gen.let("res"); + const invalid = prec + ? (0, codegen_1._) `Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` + : (0, codegen_1._) `${res} !== parseInt(${res})`; + cxt.fail$data((0, codegen_1._) `(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid}))`); + }, +}; +exports.default = def; +//# sourceMappingURL=multipleOf.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map new file mode 100644 index 000000000..9ef825b74 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map @@ -0,0 +1 @@ +{"version":3,"file":"multipleOf.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/multipleOf.ts"],"names":[],"mappings":";;AAEA,mDAA4C;AAQ5C,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,uBAAuB,UAAU,EAAE;IACjE,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,gBAAgB,UAAU,GAAG;CACzD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,YAAY;IACrB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACvC,sEAAsE;QACtE,MAAM,IAAI,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,CAAA;QACxC,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAC1B,MAAM,OAAO,GAAG,IAAI;YAClB,CAAC,CAAC,IAAA,WAAC,EAAA,uBAAuB,GAAG,OAAO,GAAG,UAAU,IAAI,EAAE;YACvD,CAAC,CAAC,IAAA,WAAC,EAAA,GAAG,GAAG,iBAAiB,GAAG,GAAG,CAAA;QAClC,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,IAAI,UAAU,cAAc,GAAG,MAAM,IAAI,IAAI,UAAU,KAAK,OAAO,IAAI,CAAC,CAAA;IACzF,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts new file mode 100644 index 000000000..bf232ffc6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/pattern.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export declare type PatternError = ErrorObject<"pattern", { + pattern: string; +}, string | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/pattern.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/pattern.js new file mode 100644 index 000000000..f8ccdf295 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/pattern.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const error = { + message: ({ schemaCode }) => (0, codegen_1.str) `must match pattern "${schemaCode}"`, + params: ({ schemaCode }) => (0, codegen_1._) `{pattern: ${schemaCode}}`, +}; +const def = { + keyword: "pattern", + type: "string", + schemaType: "string", + $data: true, + error, + code(cxt) { + const { data, $data, schema, schemaCode, it } = cxt; + // TODO regexp should be wrapped in try/catchs + const u = it.opts.unicodeRegExp ? "u" : ""; + const regExp = $data ? (0, codegen_1._) `(new RegExp(${schemaCode}, ${u}))` : (0, code_1.usePattern)(cxt, schema); + cxt.fail$data((0, codegen_1._) `!${regExp}.test(${data})`); + }, +}; +exports.default = def; +//# sourceMappingURL=pattern.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/pattern.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/pattern.js.map new file mode 100644 index 000000000..82fa5d74c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/pattern.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pattern.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/pattern.ts"],"names":[],"mappings":";;AAEA,kCAAkC;AAClC,mDAA4C;AAI5C,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,uBAAuB,UAAU,GAAG;IAClE,MAAM,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,aAAa,UAAU,GAAG;CACtD,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,QAAQ;IACpB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACjD,8CAA8C;QAC9C,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;QAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,IAAA,WAAC,EAAA,eAAe,UAAU,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,iBAAU,EAAC,GAAG,EAAE,MAAM,CAAC,CAAA;QACrF,GAAG,CAAC,SAAS,CAAC,IAAA,WAAC,EAAA,IAAI,MAAM,SAAS,IAAI,GAAG,CAAC,CAAA;IAC5C,CAAC;CACF,CAAA;AAED,kBAAe,GAAG,CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/required.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/required.d.ts new file mode 100644 index 000000000..fe94d04ae --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/required.d.ts @@ -0,0 +1,8 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export declare type RequiredError = ErrorObject<"required", { + missingProperty: string; +}, string[] | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/required.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/required.js new file mode 100644 index 000000000..1d8e29263 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/required.js @@ -0,0 +1,79 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const code_1 = require("../code"); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const error = { + message: ({ params: { missingProperty } }) => (0, codegen_1.str) `must have required property '${missingProperty}'`, + params: ({ params: { missingProperty } }) => (0, codegen_1._) `{missingProperty: ${missingProperty}}`, +}; +const def = { + keyword: "required", + type: "object", + schemaType: "array", + $data: true, + error, + code(cxt) { + const { gen, schema, schemaCode, data, $data, it } = cxt; + const { opts } = it; + if (!$data && schema.length === 0) + return; + const useLoop = schema.length >= opts.loopRequired; + if (it.allErrors) + allErrorsMode(); + else + exitOnErrorMode(); + if (opts.strictRequired) { + const props = cxt.parentSchema.properties; + const { definedProperties } = cxt.it; + for (const requiredKey of schema) { + if ((props === null || props === void 0 ? void 0 : props[requiredKey]) === undefined && !definedProperties.has(requiredKey)) { + const schemaPath = it.schemaEnv.baseId + it.errSchemaPath; + const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)`; + (0, util_1.checkStrictMode)(it, msg, it.opts.strictRequired); + } + } + } + function allErrorsMode() { + if (useLoop || $data) { + cxt.block$data(codegen_1.nil, loopAllRequired); + } + else { + for (const prop of schema) { + (0, code_1.checkReportMissingProp)(cxt, prop); + } + } + } + function exitOnErrorMode() { + const missing = gen.let("missing"); + if (useLoop || $data) { + const valid = gen.let("valid", true); + cxt.block$data(valid, () => loopUntilMissing(missing, valid)); + cxt.ok(valid); + } + else { + gen.if((0, code_1.checkMissingProp)(cxt, schema, missing)); + (0, code_1.reportMissingProp)(cxt, missing); + gen.else(); + } + } + function loopAllRequired() { + gen.forOf("prop", schemaCode, (prop) => { + cxt.setParams({ missingProperty: prop }); + gen.if((0, code_1.noPropertyInData)(gen, data, prop, opts.ownProperties), () => cxt.error()); + }); + } + function loopUntilMissing(missing, valid) { + cxt.setParams({ missingProperty: missing }); + gen.forOf(missing, schemaCode, () => { + gen.assign(valid, (0, code_1.propertyInData)(gen, data, missing, opts.ownProperties)); + gen.if((0, codegen_1.not)(valid), () => { + cxt.error(); + gen.break(); + }); + }, codegen_1.nil); + } + }, +}; +exports.default = def; +//# sourceMappingURL=required.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/required.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/required.js.map new file mode 100644 index 000000000..0fcbee588 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/required.js.map @@ -0,0 +1 @@ +{"version":3,"file":"required.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/required.ts"],"names":[],"mappings":";;AAEA,kCAMgB;AAChB,mDAAkE;AAClE,6CAAkD;AAQlD,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,eAAe,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,aAAG,EAAA,gCAAgC,eAAe,GAAG;IAC/F,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,EAAC,eAAe,EAAC,EAAC,EAAE,EAAE,CAAC,IAAA,WAAC,EAAA,qBAAqB,eAAe,GAAG;CAClF,CAAA;AAED,MAAM,GAAG,GAA0B;IACjC,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE,OAAO;IACnB,KAAK,EAAE,IAAI;IACX,KAAK;IACL,IAAI,CAAC,GAAe;QAClB,MAAM,EAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAC,GAAG,GAAG,CAAA;QACtD,MAAM,EAAC,IAAI,EAAC,GAAG,EAAE,CAAA;QACjB,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAM;QACzC,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,IAAI,IAAI,CAAC,YAAY,CAAA;QAClD,IAAI,EAAE,CAAC,SAAS;YAAE,aAAa,EAAE,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/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts new file mode 100644 index 000000000..c4f4b4ca7 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/uniqueItems.d.ts @@ -0,0 +1,9 @@ +import type { CodeKeywordDefinition, ErrorObject } from "../../types"; +export declare type UniqueItemsError = ErrorObject<"uniqueItems", { + i: number; + j: number; +}, boolean | { + $data: string; +}>; +declare const def: CodeKeywordDefinition; +export default def; diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js new file mode 100644 index 000000000..cdbecea12 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const dataType_1 = require("../../compile/validate/dataType"); +const codegen_1 = require("../../compile/codegen"); +const util_1 = require("../../compile/util"); +const equal_1 = require("../../runtime/equal"); +const error = { + message: ({ params: { i, j } }) => (0, codegen_1.str) `must NOT have duplicate items (items ## ${j} and ${i} are identical)`, + params: ({ params: { i, j } }) => (0, codegen_1._) `{i: ${i}, j: ${j}}`, +}; +const def = { + keyword: "uniqueItems", + type: "array", + schemaType: "boolean", + $data: true, + error, + code(cxt) { + const { gen, data, $data, schema, parentSchema, schemaCode, it } = cxt; + if (!$data && !schema) + return; + const valid = gen.let("valid"); + const itemTypes = parentSchema.items ? (0, dataType_1.getSchemaTypes)(parentSchema.items) : []; + cxt.block$data(valid, validateUniqueItems, (0, codegen_1._) `${schemaCode} === false`); + cxt.ok(valid); + function validateUniqueItems() { + const i = gen.let("i", (0, codegen_1._) `${data}.length`); + const j = gen.let("j"); + cxt.setParams({ i, j }); + gen.assign(valid, true); + gen.if((0, codegen_1._) `${i} > 1`, () => (canOptimize() ? loopN : loopN2)(i, j)); + } + function canOptimize() { + return itemTypes.length > 0 && !itemTypes.some((t) => t === "object" || t === "array"); + } + function loopN(i, j) { + const item = gen.name("item"); + const wrongType = (0, dataType_1.checkDataTypes)(itemTypes, item, it.opts.strictNumbers, dataType_1.DataType.Wrong); + const indices = gen.const("indices", (0, codegen_1._) `{}`); + gen.for((0, codegen_1._) `;${i}--;`, () => { + gen.let(item, (0, codegen_1._) `${data}[${i}]`); + gen.if(wrongType, (0, codegen_1._) `continue`); + if (itemTypes.length > 1) + gen.if((0, codegen_1._) `typeof ${item} == "string"`, (0, codegen_1._) `${item} += "_"`); + gen + .if((0, codegen_1._) `typeof ${indices}[${item}] == "number"`, () => { + gen.assign(j, (0, codegen_1._) `${indices}[${item}]`); + cxt.error(); + gen.assign(valid, false).break(); + }) + .code((0, codegen_1._) `${indices}[${item}] = ${i}`); + }); + } + function loopN2(i, j) { + const eql = (0, util_1.useFunc)(gen, equal_1.default); + const outer = gen.name("outer"); + gen.label(outer).for((0, codegen_1._) `;${i}--;`, () => gen.for((0, codegen_1._) `${j} = ${i}; ${j}--;`, () => gen.if((0, codegen_1._) `${eql}(${data}[${i}], ${data}[${j}])`, () => { + cxt.error(); + gen.assign(valid, false).break(outer); + }))); + } + }, +}; +exports.default = def; +//# sourceMappingURL=uniqueItems.js.map \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map new file mode 100644 index 000000000..46eb7a2a0 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uniqueItems.js","sourceRoot":"","sources":["../../../lib/vocabularies/validation/uniqueItems.ts"],"names":[],"mappings":";;AAEA,8DAAwF;AACxF,mDAAkD;AAClD,6CAA0C;AAC1C,+CAAuC;AAQvC,MAAM,KAAK,GAA2B;IACpC,OAAO,EAAE,CAAC,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CAAA"} \ No newline at end of file diff --git a/node_modules/schema-utils/node_modules/ajv/lib/2019.ts b/node_modules/schema-utils/node_modules/ajv/lib/2019.ts new file mode 100644 index 000000000..0311c4d09 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/2019.ts @@ -0,0 +1,78 @@ +import type {AnySchemaObject} from "./types" +import AjvCore, {Options} from "./core" + +import draft7Vocabularies from "./vocabularies/draft7" +import dynamicVocabulary from "./vocabularies/dynamic" +import nextVocabulary from "./vocabularies/next" +import unevaluatedVocabulary from "./vocabularies/unevaluated" +import discriminator from "./vocabularies/discriminator" +import addMetaSchema2019 from "./refs/json-schema-2019-09" + +const META_SCHEMA_ID = "https://json-schema.org/draft/2019-09/schema" + +class Ajv2019 extends AjvCore { + constructor(opts: Options = {}) { + super({ + ...opts, + dynamicRef: true, + next: true, + unevaluated: true, + }) + } + + _addVocabularies(): void { + super._addVocabularies() + this.addVocabulary(dynamicVocabulary) + draft7Vocabularies.forEach((v) => this.addVocabulary(v)) + this.addVocabulary(nextVocabulary) + this.addVocabulary(unevaluatedVocabulary) + if (this.opts.discriminator) this.addKeyword(discriminator) + } + + _addDefaultMetaSchema(): void { + super._addDefaultMetaSchema() + const {$data, meta} = this.opts + if (!meta) return + addMetaSchema2019.call(this, $data) + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID + } + + defaultMeta(): string | AnySchemaObject | undefined { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)) + } +} + +module.exports = exports = Ajv2019 +Object.defineProperty(exports, "__esModule", {value: true}) + +export default Ajv2019 + +export { + Format, + FormatDefinition, + AsyncFormatDefinition, + KeywordDefinition, + KeywordErrorDefinition, + CodeKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, + Vocabulary, + Schema, + SchemaObject, + AnySchemaObject, + AsyncSchema, + AnySchema, + ValidateFunction, + AsyncValidateFunction, + ErrorObject, + ErrorNoParams, +} from "./types" + +export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core" +export {SchemaCxt, SchemaObjCxt} from "./compile" +export {KeywordCxt} from "./compile/validate" +export {DefinedError} from "./vocabularies/errors" +export {JSONType} from "./compile/rules" +export {JSONSchemaType} from "./types/json-schema" +export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" diff --git a/node_modules/schema-utils/node_modules/ajv/lib/2020.ts b/node_modules/schema-utils/node_modules/ajv/lib/2020.ts new file mode 100644 index 000000000..beff5c7bd --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/2020.ts @@ -0,0 +1,72 @@ +import type {AnySchemaObject} from "./types" +import AjvCore, {Options} from "./core" + +import draft2020Vocabularies from "./vocabularies/draft2020" +import discriminator from "./vocabularies/discriminator" +import addMetaSchema2020 from "./refs/json-schema-2020-12" + +const META_SCHEMA_ID = "https://json-schema.org/draft/2020-12/schema" + +class Ajv2020 extends AjvCore { + constructor(opts: Options = {}) { + super({ + ...opts, + dynamicRef: true, + next: true, + unevaluated: true, + }) + } + + _addVocabularies(): void { + super._addVocabularies() + draft2020Vocabularies.forEach((v) => this.addVocabulary(v)) + if (this.opts.discriminator) this.addKeyword(discriminator) + } + + _addDefaultMetaSchema(): void { + super._addDefaultMetaSchema() + const {$data, meta} = this.opts + if (!meta) return + addMetaSchema2020.call(this, $data) + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID + } + + defaultMeta(): string | AnySchemaObject | undefined { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)) + } +} + +module.exports = exports = Ajv2020 +Object.defineProperty(exports, "__esModule", {value: true}) + +export default Ajv2020 + +export { + Format, + FormatDefinition, + AsyncFormatDefinition, + KeywordDefinition, + KeywordErrorDefinition, + CodeKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, + Vocabulary, + Schema, + SchemaObject, + AnySchemaObject, + AsyncSchema, + AnySchema, + ValidateFunction, + AsyncValidateFunction, + ErrorObject, + ErrorNoParams, +} from "./types" + +export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core" +export {SchemaCxt, SchemaObjCxt} from "./compile" +export {KeywordCxt} from "./compile/validate" +export {DefinedError} from "./vocabularies/errors" +export {JSONType} from "./compile/rules" +export {JSONSchemaType} from "./types/json-schema" +export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" diff --git a/node_modules/schema-utils/node_modules/ajv/lib/ajv.ts b/node_modules/schema-utils/node_modules/ajv/lib/ajv.ts new file mode 100644 index 000000000..bbfa5a4e5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/ajv.ts @@ -0,0 +1,67 @@ +import type {AnySchemaObject} from "./types" +import AjvCore from "./core" +import draft7Vocabularies from "./vocabularies/draft7" +import discriminator from "./vocabularies/discriminator" +import * as draft7MetaSchema from "./refs/json-schema-draft-07.json" + +const META_SUPPORT_DATA = ["/properties"] + +const META_SCHEMA_ID = "http://json-schema.org/draft-07/schema" + +class Ajv extends AjvCore { + _addVocabularies(): void { + super._addVocabularies() + draft7Vocabularies.forEach((v) => this.addVocabulary(v)) + if (this.opts.discriminator) this.addKeyword(discriminator) + } + + _addDefaultMetaSchema(): void { + super._addDefaultMetaSchema() + if (!this.opts.meta) return + const metaSchema = this.opts.$data + ? this.$dataMetaSchema(draft7MetaSchema, META_SUPPORT_DATA) + : draft7MetaSchema + this.addMetaSchema(metaSchema, META_SCHEMA_ID, false) + this.refs["http://json-schema.org/schema"] = META_SCHEMA_ID + } + + defaultMeta(): string | AnySchemaObject | undefined { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)) + } +} + +module.exports = exports = Ajv +Object.defineProperty(exports, "__esModule", {value: true}) + +export default Ajv + +export { + Format, + FormatDefinition, + AsyncFormatDefinition, + KeywordDefinition, + KeywordErrorDefinition, + CodeKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, + Vocabulary, + Schema, + SchemaObject, + AnySchemaObject, + AsyncSchema, + AnySchema, + ValidateFunction, + AsyncValidateFunction, + SchemaValidateFunction, + ErrorObject, + ErrorNoParams, +} from "./types" + +export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core" +export {SchemaCxt, SchemaObjCxt} from "./compile" +export {KeywordCxt} from "./compile/validate" +export {DefinedError} from "./vocabularies/errors" +export {JSONType} from "./compile/rules" +export {JSONSchemaType} from "./types/json-schema" +export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/codegen/code.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/codegen/code.ts new file mode 100644 index 000000000..b17701973 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/codegen/code.ts @@ -0,0 +1,168 @@ +export abstract class _CodeOrName { + abstract readonly str: string + abstract readonly names: UsedNames + abstract toString(): string + abstract emptyStr(): boolean +} + +export const IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i + +export class Name extends _CodeOrName { + readonly str: string + constructor(s: string) { + super() + if (!IDENTIFIER.test(s)) throw new Error("CodeGen: name must be a valid identifier") + this.str = s + } + + toString(): string { + return this.str + } + + emptyStr(): boolean { + return false + } + + get names(): UsedNames { + return {[this.str]: 1} + } +} + +export class _Code extends _CodeOrName { + readonly _items: readonly CodeItem[] + private _str?: string + private _names?: UsedNames + + constructor(code: string | readonly CodeItem[]) { + super() + this._items = typeof code === "string" ? [code] : code + } + + toString(): string { + return this.str + } + + emptyStr(): boolean { + if (this._items.length > 1) return false + const item = this._items[0] + return item === "" || item === '""' + } + + get str(): string { + return (this._str ??= this._items.reduce((s: string, c: CodeItem) => `${s}${c}`, "")) + } + + get names(): UsedNames { + return (this._names ??= this._items.reduce((names: UsedNames, c) => { + if (c instanceof Name) names[c.str] = (names[c.str] || 0) + 1 + return names + }, {})) + } +} + +export type CodeItem = Name | string | number | boolean | null + +export type UsedNames = Record + +export type Code = _Code | Name + +export type SafeExpr = Code | number | boolean | null + +export const nil = new _Code("") + +type CodeArg = SafeExpr | string | undefined + +export function _(strs: TemplateStringsArray, ...args: CodeArg[]): _Code { + const code: CodeItem[] = [strs[0]] + let i = 0 + while (i < args.length) { + addCodeArg(code, args[i]) + code.push(strs[++i]) + } + return new _Code(code) +} + +const plus = new _Code("+") + +export function str(strs: TemplateStringsArray, ...args: (CodeArg | string[])[]): _Code { + const expr: CodeItem[] = [safeStringify(strs[0])] + let i = 0 + while (i < args.length) { + expr.push(plus) + addCodeArg(expr, args[i]) + expr.push(plus, safeStringify(strs[++i])) + } + optimize(expr) + return new _Code(expr) +} + +export function addCodeArg(code: CodeItem[], arg: CodeArg | string[]): void { + if (arg instanceof _Code) code.push(...arg._items) + else if (arg instanceof Name) code.push(arg) + else code.push(interpolate(arg)) +} + +function optimize(expr: CodeItem[]): void { + let i = 1 + while (i < expr.length - 1) { + if (expr[i] === plus) { + const res = mergeExprItems(expr[i - 1], expr[i + 1]) + if (res !== undefined) { + expr.splice(i - 1, 3, res) + continue + } + expr[i++] = "+" + } + i++ + } +} + +function mergeExprItems(a: CodeItem, b: CodeItem): CodeItem | undefined { + if (b === '""') return a + if (a === '""') return b + if (typeof a == "string") { + if (b instanceof Name || a[a.length - 1] !== '"') return + if (typeof b != "string") return `${a.slice(0, -1)}${b}"` + if (b[0] === '"') return a.slice(0, -1) + b.slice(1) + return + } + if (typeof b == "string" && b[0] === '"' && !(a instanceof Name)) return `"${a}${b.slice(1)}` + return +} + +export function strConcat(c1: Code, c2: Code): Code { + return c2.emptyStr() ? c1 : c1.emptyStr() ? c2 : str`${c1}${c2}` +} + +// TODO do not allow arrays here +function interpolate(x?: string | string[] | number | boolean | null): SafeExpr | string { + return typeof x == "number" || typeof x == "boolean" || x === null + ? x + : safeStringify(Array.isArray(x) ? x.join(",") : x) +} + +export function stringify(x: unknown): Code { + return new _Code(safeStringify(x)) +} + +export function safeStringify(x: unknown): string { + return JSON.stringify(x) + .replace(/\u2028/g, "\\u2028") + .replace(/\u2029/g, "\\u2029") +} + +export function getProperty(key: Code | string | number): Code { + return typeof key == "string" && IDENTIFIER.test(key) ? new _Code(`.${key}`) : _`[${key}]` +} + +//Does best effort to format the name properly +export function getEsmExportName(key: Code | string | number): Code { + if (typeof key == "string" && IDENTIFIER.test(key)) { + return new _Code(`${key}`) + } + throw new Error(`CodeGen: invalid export name: ${key}, use explicit $id name mapping`) +} + +export function regexpCode(rx: RegExp): Code { + return new _Code(rx.toString()) +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/codegen/index.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/codegen/index.ts new file mode 100644 index 000000000..9d29055dc --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/codegen/index.ts @@ -0,0 +1,832 @@ +import type {ScopeValueSets, NameValue, ValueScope, ValueScopeName} from "./scope" +import {_, nil, _Code, Code, Name, UsedNames, CodeItem, addCodeArg, _CodeOrName} from "./code" +import {Scope, varKinds} from "./scope" + +export {_, str, strConcat, nil, getProperty, stringify, regexpCode, Name, Code} from "./code" +export {Scope, ScopeStore, ValueScope, ValueScopeName, ScopeValueSets, varKinds} from "./scope" + +// type for expressions that can be safely inserted in code without quotes +export type SafeExpr = Code | number | boolean | null + +// type that is either Code of function that adds code to CodeGen instance using its methods +export type Block = Code | (() => void) + +export const operators = { + GT: new _Code(">"), + GTE: new _Code(">="), + LT: new _Code("<"), + LTE: new _Code("<="), + EQ: new _Code("==="), + NEQ: new _Code("!=="), + NOT: new _Code("!"), + OR: new _Code("||"), + AND: new _Code("&&"), + ADD: new _Code("+"), +} + +abstract class Node { + abstract readonly names: UsedNames + + optimizeNodes(): this | ChildNode | ChildNode[] | undefined { + return this + } + + optimizeNames(_names: UsedNames, _constants: Constants): this | undefined { + return this + } + + // get count(): number { + // return 1 + // } +} + +class Def extends Node { + constructor(private readonly varKind: Name, private readonly name: Name, private rhs?: SafeExpr) { + super() + } + + render({es5, _n}: CGOptions): string { + const varKind = es5 ? varKinds.var : this.varKind + const rhs = this.rhs === undefined ? "" : ` = ${this.rhs}` + return `${varKind} ${this.name}${rhs};` + _n + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + if (!names[this.name.str]) return + if (this.rhs) this.rhs = optimizeExpr(this.rhs, names, constants) + return this + } + + get names(): UsedNames { + return this.rhs instanceof _CodeOrName ? this.rhs.names : {} + } +} + +class Assign extends Node { + constructor(readonly lhs: Code, public rhs: SafeExpr, private readonly sideEffects?: boolean) { + super() + } + + render({_n}: CGOptions): string { + return `${this.lhs} = ${this.rhs};` + _n + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + if (this.lhs instanceof Name && !names[this.lhs.str] && !this.sideEffects) return + this.rhs = optimizeExpr(this.rhs, names, constants) + return this + } + + get names(): UsedNames { + const names = this.lhs instanceof Name ? {} : {...this.lhs.names} + return addExprNames(names, this.rhs) + } +} + +class AssignOp extends Assign { + constructor(lhs: Code, private readonly op: Code, rhs: SafeExpr, sideEffects?: boolean) { + super(lhs, rhs, sideEffects) + } + + render({_n}: CGOptions): string { + return `${this.lhs} ${this.op}= ${this.rhs};` + _n + } +} + +class Label extends Node { + readonly names: UsedNames = {} + constructor(readonly label: Name) { + super() + } + + render({_n}: CGOptions): string { + return `${this.label}:` + _n + } +} + +class Break extends Node { + readonly names: UsedNames = {} + constructor(readonly label?: Code) { + super() + } + + render({_n}: CGOptions): string { + const label = this.label ? ` ${this.label}` : "" + return `break${label};` + _n + } +} + +class Throw extends Node { + constructor(readonly error: Code) { + super() + } + + render({_n}: CGOptions): string { + return `throw ${this.error};` + _n + } + + get names(): UsedNames { + return this.error.names + } +} + +class AnyCode extends Node { + constructor(private code: SafeExpr) { + super() + } + + render({_n}: CGOptions): string { + return `${this.code};` + _n + } + + optimizeNodes(): this | undefined { + return `${this.code}` ? this : undefined + } + + optimizeNames(names: UsedNames, constants: Constants): this { + this.code = optimizeExpr(this.code, names, constants) + return this + } + + get names(): UsedNames { + return this.code instanceof _CodeOrName ? this.code.names : {} + } +} + +abstract class ParentNode extends Node { + constructor(readonly nodes: ChildNode[] = []) { + super() + } + + render(opts: CGOptions): string { + return this.nodes.reduce((code, n) => code + n.render(opts), "") + } + + optimizeNodes(): this | ChildNode | ChildNode[] | undefined { + const {nodes} = this + let i = nodes.length + while (i--) { + const n = nodes[i].optimizeNodes() + if (Array.isArray(n)) nodes.splice(i, 1, ...n) + else if (n) nodes[i] = n + else nodes.splice(i, 1) + } + return nodes.length > 0 ? this : undefined + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + const {nodes} = this + let i = nodes.length + while (i--) { + // iterating backwards improves 1-pass optimization + const n = nodes[i] + if (n.optimizeNames(names, constants)) continue + subtractNames(names, n.names) + nodes.splice(i, 1) + } + return nodes.length > 0 ? this : undefined + } + + get names(): UsedNames { + return this.nodes.reduce((names: UsedNames, n) => addNames(names, n.names), {}) + } + + // get count(): number { + // return this.nodes.reduce((c, n) => c + n.count, 1) + // } +} + +abstract class BlockNode extends ParentNode { + render(opts: CGOptions): string { + return "{" + opts._n + super.render(opts) + "}" + opts._n + } +} + +class Root extends ParentNode {} + +class Else extends BlockNode { + static readonly kind = "else" +} + +class If extends BlockNode { + static readonly kind = "if" + else?: If | Else + constructor(private condition: Code | boolean, nodes?: ChildNode[]) { + super(nodes) + } + + render(opts: CGOptions): string { + let code = `if(${this.condition})` + super.render(opts) + if (this.else) code += "else " + this.else.render(opts) + return code + } + + optimizeNodes(): If | ChildNode[] | undefined { + super.optimizeNodes() + const cond = this.condition + if (cond === true) return this.nodes // else is ignored here + let e = this.else + if (e) { + const ns = e.optimizeNodes() + e = this.else = Array.isArray(ns) ? new Else(ns) : (ns as Else | undefined) + } + if (e) { + if (cond === false) return e instanceof If ? e : e.nodes + if (this.nodes.length) return this + return new If(not(cond), e instanceof If ? [e] : e.nodes) + } + if (cond === false || !this.nodes.length) return undefined + return this + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + this.else = this.else?.optimizeNames(names, constants) + if (!(super.optimizeNames(names, constants) || this.else)) return + this.condition = optimizeExpr(this.condition, names, constants) + return this + } + + get names(): UsedNames { + const names = super.names + addExprNames(names, this.condition) + if (this.else) addNames(names, this.else.names) + return names + } + + // get count(): number { + // return super.count + (this.else?.count || 0) + // } +} + +abstract class For extends BlockNode { + static readonly kind = "for" +} + +class ForLoop extends For { + constructor(private iteration: Code) { + super() + } + + render(opts: CGOptions): string { + return `for(${this.iteration})` + super.render(opts) + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + if (!super.optimizeNames(names, constants)) return + this.iteration = optimizeExpr(this.iteration, names, constants) + return this + } + + get names(): UsedNames { + return addNames(super.names, this.iteration.names) + } +} + +class ForRange extends For { + constructor( + private readonly varKind: Name, + private readonly name: Name, + private readonly from: SafeExpr, + private readonly to: SafeExpr + ) { + super() + } + + render(opts: CGOptions): string { + const varKind = opts.es5 ? varKinds.var : this.varKind + const {name, from, to} = this + return `for(${varKind} ${name}=${from}; ${name}<${to}; ${name}++)` + super.render(opts) + } + + get names(): UsedNames { + const names = addExprNames(super.names, this.from) + return addExprNames(names, this.to) + } +} + +class ForIter extends For { + constructor( + private readonly loop: "of" | "in", + private readonly varKind: Name, + private readonly name: Name, + private iterable: Code + ) { + super() + } + + render(opts: CGOptions): string { + return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts) + } + + optimizeNames(names: UsedNames, constants: Constants): this | undefined { + if (!super.optimizeNames(names, constants)) return + this.iterable = optimizeExpr(this.iterable, names, constants) + return this + } + + get names(): UsedNames { + return addNames(super.names, this.iterable.names) + } +} + +class Func extends BlockNode { + static readonly kind = "func" + constructor(public name: Name, public args: Code, public async?: boolean) { + super() + } + + render(opts: CGOptions): string { + const _async = this.async ? "async " : "" + return `${_async}function ${this.name}(${this.args})` + super.render(opts) + } +} + +class Return extends ParentNode { + static readonly kind = "return" + + render(opts: CGOptions): string { + return "return " + super.render(opts) + } +} + +class Try extends BlockNode { + catch?: Catch + finally?: Finally + + render(opts: CGOptions): string { + let code = "try" + super.render(opts) + if (this.catch) code += this.catch.render(opts) + if (this.finally) code += this.finally.render(opts) + return code + } + + optimizeNodes(): this { + super.optimizeNodes() + this.catch?.optimizeNodes() as Catch | undefined + this.finally?.optimizeNodes() as Finally | undefined + return this + } + + optimizeNames(names: UsedNames, constants: Constants): this { + super.optimizeNames(names, constants) + this.catch?.optimizeNames(names, constants) + this.finally?.optimizeNames(names, constants) + return this + } + + get names(): UsedNames { + const names = super.names + if (this.catch) addNames(names, this.catch.names) + if (this.finally) addNames(names, this.finally.names) + return names + } + + // get count(): number { + // return super.count + (this.catch?.count || 0) + (this.finally?.count || 0) + // } +} + +class Catch extends BlockNode { + static readonly kind = "catch" + constructor(readonly error: Name) { + super() + } + + render(opts: CGOptions): string { + return `catch(${this.error})` + super.render(opts) + } +} + +class Finally extends BlockNode { + static readonly kind = "finally" + render(opts: CGOptions): string { + return "finally" + super.render(opts) + } +} + +type StartBlockNode = If | For | Func | Return | Try + +type LeafNode = Def | Assign | Label | Break | Throw | AnyCode + +type ChildNode = StartBlockNode | LeafNode + +type EndBlockNodeType = + | typeof If + | typeof Else + | typeof For + | typeof Func + | typeof Return + | typeof Catch + | typeof Finally + +type Constants = Record + +export interface CodeGenOptions { + es5?: boolean + lines?: boolean + ownProperties?: boolean +} + +interface CGOptions extends CodeGenOptions { + _n: "\n" | "" +} + +export class CodeGen { + readonly _scope: Scope + readonly _extScope: ValueScope + readonly _values: ScopeValueSets = {} + private readonly _nodes: ParentNode[] + private readonly _blockStarts: number[] = [] + private readonly _constants: Constants = {} + private readonly opts: CGOptions + + constructor(extScope: ValueScope, opts: CodeGenOptions = {}) { + this.opts = {...opts, _n: opts.lines ? "\n" : ""} + this._extScope = extScope + this._scope = new Scope({parent: extScope}) + this._nodes = [new Root()] + } + + toString(): string { + return this._root.render(this.opts) + } + + // returns unique name in the internal scope + name(prefix: string): Name { + return this._scope.name(prefix) + } + + // reserves unique name in the external scope + scopeName(prefix: string): ValueScopeName { + return this._extScope.name(prefix) + } + + // reserves unique name in the external scope and assigns value to it + scopeValue(prefixOrName: ValueScopeName | string, value: NameValue): Name { + const name = this._extScope.value(prefixOrName, value) + const vs = this._values[name.prefix] || (this._values[name.prefix] = new Set()) + vs.add(name) + return name + } + + getScopeValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined { + return this._extScope.getValue(prefix, keyOrRef) + } + + // return code that assigns values in the external scope to the names that are used internally + // (same names that were returned by gen.scopeName or gen.scopeValue) + scopeRefs(scopeName: Name): Code { + return this._extScope.scopeRefs(scopeName, this._values) + } + + scopeCode(): Code { + return this._extScope.scopeCode(this._values) + } + + private _def( + varKind: Name, + nameOrPrefix: Name | string, + rhs?: SafeExpr, + constant?: boolean + ): Name { + const name = this._scope.toName(nameOrPrefix) + if (rhs !== undefined && constant) this._constants[name.str] = rhs + this._leafNode(new Def(varKind, name, rhs)) + return name + } + + // `const` declaration (`var` in es5 mode) + const(nameOrPrefix: Name | string, rhs: SafeExpr, _constant?: boolean): Name { + return this._def(varKinds.const, nameOrPrefix, rhs, _constant) + } + + // `let` declaration with optional assignment (`var` in es5 mode) + let(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name { + return this._def(varKinds.let, nameOrPrefix, rhs, _constant) + } + + // `var` declaration with optional assignment + var(nameOrPrefix: Name | string, rhs?: SafeExpr, _constant?: boolean): Name { + return this._def(varKinds.var, nameOrPrefix, rhs, _constant) + } + + // assignment code + assign(lhs: Code, rhs: SafeExpr, sideEffects?: boolean): CodeGen { + return this._leafNode(new Assign(lhs, rhs, sideEffects)) + } + + // `+=` code + add(lhs: Code, rhs: SafeExpr): CodeGen { + return this._leafNode(new AssignOp(lhs, operators.ADD, rhs)) + } + + // appends passed SafeExpr to code or executes Block + code(c: Block | SafeExpr): CodeGen { + if (typeof c == "function") c() + else if (c !== nil) this._leafNode(new AnyCode(c)) + return this + } + + // returns code for object literal for the passed argument list of key-value pairs + object(...keyValues: [Name | string, SafeExpr | string][]): _Code { + const code: CodeItem[] = ["{"] + for (const [key, value] of keyValues) { + if (code.length > 1) code.push(",") + code.push(key) + if (key !== value || this.opts.es5) { + code.push(":") + addCodeArg(code, value) + } + } + code.push("}") + return new _Code(code) + } + + // `if` clause (or statement if `thenBody` and, optionally, `elseBody` are passed) + if(condition: Code | boolean, thenBody?: Block, elseBody?: Block): CodeGen { + this._blockNode(new If(condition)) + + if (thenBody && elseBody) { + this.code(thenBody).else().code(elseBody).endIf() + } else if (thenBody) { + this.code(thenBody).endIf() + } else if (elseBody) { + throw new Error('CodeGen: "else" body without "then" body') + } + return this + } + + // `else if` clause - invalid without `if` or after `else` clauses + elseIf(condition: Code | boolean): CodeGen { + return this._elseNode(new If(condition)) + } + + // `else` clause - only valid after `if` or `else if` clauses + else(): CodeGen { + return this._elseNode(new Else()) + } + + // end `if` statement (needed if gen.if was used only with condition) + endIf(): CodeGen { + return this._endBlockNode(If, Else) + } + + private _for(node: For, forBody?: Block): CodeGen { + this._blockNode(node) + if (forBody) this.code(forBody).endFor() + return this + } + + // a generic `for` clause (or statement if `forBody` is passed) + for(iteration: Code, forBody?: Block): CodeGen { + return this._for(new ForLoop(iteration), forBody) + } + + // `for` statement for a range of values + forRange( + nameOrPrefix: Name | string, + from: SafeExpr, + to: SafeExpr, + forBody: (index: Name) => void, + varKind: Code = this.opts.es5 ? varKinds.var : varKinds.let + ): CodeGen { + const name = this._scope.toName(nameOrPrefix) + return this._for(new ForRange(varKind, name, from, to), () => forBody(name)) + } + + // `for-of` statement (in es5 mode replace with a normal for loop) + forOf( + nameOrPrefix: Name | string, + iterable: Code, + forBody: (item: Name) => void, + varKind: Code = varKinds.const + ): CodeGen { + const name = this._scope.toName(nameOrPrefix) + if (this.opts.es5) { + const arr = iterable instanceof Name ? iterable : this.var("_arr", iterable) + return this.forRange("_i", 0, _`${arr}.length`, (i) => { + this.var(name, _`${arr}[${i}]`) + forBody(name) + }) + } + return this._for(new ForIter("of", varKind, name, iterable), () => forBody(name)) + } + + // `for-in` statement. + // With option `ownProperties` replaced with a `for-of` loop for object keys + forIn( + nameOrPrefix: Name | string, + obj: Code, + forBody: (item: Name) => void, + varKind: Code = this.opts.es5 ? varKinds.var : varKinds.const + ): CodeGen { + if (this.opts.ownProperties) { + return this.forOf(nameOrPrefix, _`Object.keys(${obj})`, forBody) + } + const name = this._scope.toName(nameOrPrefix) + return this._for(new ForIter("in", varKind, name, obj), () => forBody(name)) + } + + // end `for` loop + endFor(): CodeGen { + return this._endBlockNode(For) + } + + // `label` statement + label(label: Name): CodeGen { + return this._leafNode(new Label(label)) + } + + // `break` statement + break(label?: Code): CodeGen { + return this._leafNode(new Break(label)) + } + + // `return` statement + return(value: Block | SafeExpr): CodeGen { + const node = new Return() + this._blockNode(node) + this.code(value) + if (node.nodes.length !== 1) throw new Error('CodeGen: "return" should have one node') + return this._endBlockNode(Return) + } + + // `try` statement + try(tryBody: Block, catchCode?: (e: Name) => void, finallyCode?: Block): CodeGen { + if (!catchCode && !finallyCode) throw new Error('CodeGen: "try" without "catch" and "finally"') + const node = new Try() + this._blockNode(node) + this.code(tryBody) + if (catchCode) { + const error = this.name("e") + this._currNode = node.catch = new Catch(error) + catchCode(error) + } + if (finallyCode) { + this._currNode = node.finally = new Finally() + this.code(finallyCode) + } + return this._endBlockNode(Catch, Finally) + } + + // `throw` statement + throw(error: Code): CodeGen { + return this._leafNode(new Throw(error)) + } + + // start self-balancing block + block(body?: Block, nodeCount?: number): CodeGen { + this._blockStarts.push(this._nodes.length) + if (body) this.code(body).endBlock(nodeCount) + return this + } + + // end the current self-balancing block + endBlock(nodeCount?: number): CodeGen { + const len = this._blockStarts.pop() + if (len === undefined) throw new Error("CodeGen: not in self-balancing block") + const toClose = this._nodes.length - len + if (toClose < 0 || (nodeCount !== undefined && toClose !== nodeCount)) { + throw new Error(`CodeGen: wrong number of nodes: ${toClose} vs ${nodeCount} expected`) + } + this._nodes.length = len + return this + } + + // `function` heading (or definition if funcBody is passed) + func(name: Name, args: Code = nil, async?: boolean, funcBody?: Block): CodeGen { + this._blockNode(new Func(name, args, async)) + if (funcBody) this.code(funcBody).endFunc() + return this + } + + // end function definition + endFunc(): CodeGen { + return this._endBlockNode(Func) + } + + optimize(n = 1): void { + while (n-- > 0) { + this._root.optimizeNodes() + this._root.optimizeNames(this._root.names, this._constants) + } + } + + private _leafNode(node: LeafNode): CodeGen { + this._currNode.nodes.push(node) + return this + } + + private _blockNode(node: StartBlockNode): void { + this._currNode.nodes.push(node) + this._nodes.push(node) + } + + private _endBlockNode(N1: EndBlockNodeType, N2?: EndBlockNodeType): CodeGen { + const n = this._currNode + if (n instanceof N1 || (N2 && n instanceof N2)) { + this._nodes.pop() + return this + } + throw new Error(`CodeGen: not in block "${N2 ? `${N1.kind}/${N2.kind}` : N1.kind}"`) + } + + private _elseNode(node: If | Else): CodeGen { + const n = this._currNode + if (!(n instanceof If)) { + throw new Error('CodeGen: "else" without "if"') + } + this._currNode = n.else = node + return this + } + + private get _root(): Root { + return this._nodes[0] as Root + } + + private get _currNode(): ParentNode { + const ns = this._nodes + return ns[ns.length - 1] + } + + private set _currNode(node: ParentNode) { + const ns = this._nodes + ns[ns.length - 1] = node + } + + // get nodeCount(): number { + // return this._root.count + // } +} + +function addNames(names: UsedNames, from: UsedNames): UsedNames { + for (const n in from) names[n] = (names[n] || 0) + (from[n] || 0) + return names +} + +function addExprNames(names: UsedNames, from: SafeExpr): UsedNames { + return from instanceof _CodeOrName ? addNames(names, from.names) : names +} + +function optimizeExpr(expr: T, names: UsedNames, constants: Constants): T +function optimizeExpr(expr: SafeExpr, names: UsedNames, constants: Constants): SafeExpr { + if (expr instanceof Name) return replaceName(expr) + if (!canOptimize(expr)) return expr + return new _Code( + expr._items.reduce((items: CodeItem[], c: SafeExpr | string) => { + if (c instanceof Name) c = replaceName(c) + if (c instanceof _Code) items.push(...c._items) + else items.push(c) + return items + }, []) + ) + + function replaceName(n: Name): SafeExpr { + const c = constants[n.str] + if (c === undefined || names[n.str] !== 1) return n + delete names[n.str] + return c + } + + function canOptimize(e: SafeExpr): e is _Code { + return ( + e instanceof _Code && + e._items.some( + (c) => c instanceof Name && names[c.str] === 1 && constants[c.str] !== undefined + ) + ) + } +} + +function subtractNames(names: UsedNames, from: UsedNames): void { + for (const n in from) names[n] = (names[n] || 0) - (from[n] || 0) +} + +export function not(x: T): T +export function not(x: Code | SafeExpr): Code | SafeExpr { + return typeof x == "boolean" || typeof x == "number" || x === null ? !x : _`!${par(x)}` +} + +const andCode = mappend(operators.AND) + +// boolean AND (&&) expression with the passed arguments +export function and(...args: Code[]): Code { + return args.reduce(andCode) +} + +const orCode = mappend(operators.OR) + +// boolean OR (||) expression with the passed arguments +export function or(...args: Code[]): Code { + return args.reduce(orCode) +} + +type MAppend = (x: Code, y: Code) => Code + +function mappend(op: Code): MAppend { + return (x, y) => (x === nil ? y : y === nil ? x : _`${par(x)} ${op} ${par(y)}`) +} + +function par(x: Code): Code { + return x instanceof Name ? x : _`(${x})` +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/codegen/scope.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/codegen/scope.ts new file mode 100644 index 000000000..511992297 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/codegen/scope.ts @@ -0,0 +1,215 @@ +import {_, nil, Code, Name} from "./code" + +interface NameGroup { + prefix: string + index: number +} + +export interface NameValue { + ref: ValueReference // this is the reference to any value that can be referred to from generated code via `globals` var in the closure + key?: unknown // any key to identify a global to avoid duplicates, if not passed ref is used + code?: Code // this is the code creating the value needed for standalone code wit_out closure - can be a primitive value, function or import (`require`) +} + +export type ValueReference = unknown // possibly make CodeGen parameterized type on this type + +class ValueError extends Error { + readonly value?: NameValue + constructor(name: ValueScopeName) { + super(`CodeGen: "code" for ${name} not defined`) + this.value = name.value + } +} + +interface ScopeOptions { + prefixes?: Set + parent?: Scope +} + +interface ValueScopeOptions extends ScopeOptions { + scope: ScopeStore + es5?: boolean + lines?: boolean +} + +export type ScopeStore = Record + +type ScopeValues = { + [Prefix in string]?: Map +} + +export type ScopeValueSets = { + [Prefix in string]?: Set +} + +export enum UsedValueState { + Started, + Completed, +} + +export type UsedScopeValues = { + [Prefix in string]?: Map +} + +export const varKinds = { + const: new Name("const"), + let: new Name("let"), + var: new Name("var"), +} + +export class Scope { + protected readonly _names: {[Prefix in string]?: NameGroup} = {} + protected readonly _prefixes?: Set + protected readonly _parent?: Scope + + constructor({prefixes, parent}: ScopeOptions = {}) { + this._prefixes = prefixes + this._parent = parent + } + + toName(nameOrPrefix: Name | string): Name { + return nameOrPrefix instanceof Name ? nameOrPrefix : this.name(nameOrPrefix) + } + + name(prefix: string): Name { + return new Name(this._newName(prefix)) + } + + protected _newName(prefix: string): string { + const ng = this._names[prefix] || this._nameGroup(prefix) + return `${prefix}${ng.index++}` + } + + private _nameGroup(prefix: string): NameGroup { + if (this._parent?._prefixes?.has(prefix) || (this._prefixes && !this._prefixes.has(prefix))) { + throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`) + } + return (this._names[prefix] = {prefix, index: 0}) + } +} + +interface ScopePath { + property: string + itemIndex: number +} + +export class ValueScopeName extends Name { + readonly prefix: string + value?: NameValue + scopePath?: Code + + constructor(prefix: string, nameStr: string) { + super(nameStr) + this.prefix = prefix + } + + setValue(value: NameValue, {property, itemIndex}: ScopePath): void { + this.value = value + this.scopePath = _`.${new Name(property)}[${itemIndex}]` + } +} + +interface VSOptions extends ValueScopeOptions { + _n: Code +} + +const line = _`\n` + +export class ValueScope extends Scope { + protected readonly _values: ScopeValues = {} + protected readonly _scope: ScopeStore + readonly opts: VSOptions + + constructor(opts: ValueScopeOptions) { + super(opts) + this._scope = opts.scope + this.opts = {...opts, _n: opts.lines ? line : nil} + } + + get(): ScopeStore { + return this._scope + } + + name(prefix: string): ValueScopeName { + return new ValueScopeName(prefix, this._newName(prefix)) + } + + value(nameOrPrefix: ValueScopeName | string, value: NameValue): ValueScopeName { + if (value.ref === undefined) throw new Error("CodeGen: ref must be passed in value") + const name = this.toName(nameOrPrefix) as ValueScopeName + const {prefix} = name + const valueKey = value.key ?? value.ref + let vs = this._values[prefix] + if (vs) { + const _name = vs.get(valueKey) + if (_name) return _name + } else { + vs = this._values[prefix] = new Map() + } + vs.set(valueKey, name) + + const s = this._scope[prefix] || (this._scope[prefix] = []) + const itemIndex = s.length + s[itemIndex] = value.ref + name.setValue(value, {property: prefix, itemIndex}) + return name + } + + getValue(prefix: string, keyOrRef: unknown): ValueScopeName | undefined { + const vs = this._values[prefix] + if (!vs) return + return vs.get(keyOrRef) + } + + scopeRefs(scopeName: Name, values: ScopeValues | ScopeValueSets = this._values): Code { + return this._reduceValues(values, (name: ValueScopeName) => { + if (name.scopePath === undefined) throw new Error(`CodeGen: name "${name}" has no value`) + return _`${scopeName}${name.scopePath}` + }) + } + + scopeCode( + values: ScopeValues | ScopeValueSets = this._values, + usedValues?: UsedScopeValues, + getCode?: (n: ValueScopeName) => Code | undefined + ): Code { + return this._reduceValues( + values, + (name: ValueScopeName) => { + if (name.value === undefined) throw new Error(`CodeGen: name "${name}" has no value`) + return name.value.code + }, + usedValues, + getCode + ) + } + + private _reduceValues( + values: ScopeValues | ScopeValueSets, + valueCode: (n: ValueScopeName) => Code | undefined, + usedValues: UsedScopeValues = {}, + getCode?: (n: ValueScopeName) => Code | undefined + ): Code { + let code: Code = nil + for (const prefix in values) { + const vs = values[prefix] + if (!vs) continue + const nameSet = (usedValues[prefix] = usedValues[prefix] || new Map()) + vs.forEach((name: ValueScopeName) => { + if (nameSet.has(name)) return + nameSet.set(name, UsedValueState.Started) + let c = valueCode(name) + if (c) { + const def = this.opts.es5 ? varKinds.var : varKinds.const + code = _`${code}${def} ${name} = ${c};${this.opts._n}` + } else if ((c = getCode?.(name))) { + code = _`${code}${c}${this.opts._n}` + } else { + throw new ValueError(name) + } + nameSet.set(name, UsedValueState.Completed) + }) + } + return code + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/errors.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/errors.ts new file mode 100644 index 000000000..18424a0fc --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/errors.ts @@ -0,0 +1,184 @@ +import type {KeywordErrorCxt, KeywordErrorDefinition} from "../types" +import type {SchemaCxt} from "./index" +import {CodeGen, _, str, strConcat, Code, Name} from "./codegen" +import {SafeExpr} from "./codegen/code" +import {getErrorPath, Type} from "./util" +import N from "./names" + +export const keywordError: KeywordErrorDefinition = { + message: ({keyword}) => str`must pass "${keyword}" keyword validation`, +} + +export const keyword$DataError: KeywordErrorDefinition = { + message: ({keyword, schemaType}) => + schemaType + ? str`"${keyword}" keyword must be ${schemaType} ($data)` + : str`"${keyword}" keyword is invalid ($data)`, +} + +export interface ErrorPaths { + instancePath?: Code + schemaPath?: string + parentSchema?: boolean +} + +export function reportError( + cxt: KeywordErrorCxt, + error: KeywordErrorDefinition = keywordError, + errorPaths?: ErrorPaths, + overrideAllErrors?: boolean +): void { + const {it} = cxt + const {gen, compositeRule, allErrors} = it + const errObj = errorObjectCode(cxt, error, errorPaths) + if (overrideAllErrors ?? (compositeRule || allErrors)) { + addError(gen, errObj) + } else { + returnErrors(it, _`[${errObj}]`) + } +} + +export function reportExtraError( + cxt: KeywordErrorCxt, + error: KeywordErrorDefinition = keywordError, + errorPaths?: ErrorPaths +): void { + const {it} = cxt + const {gen, compositeRule, allErrors} = it + const errObj = errorObjectCode(cxt, error, errorPaths) + addError(gen, errObj) + if (!(compositeRule || allErrors)) { + returnErrors(it, N.vErrors) + } +} + +export function resetErrorsCount(gen: CodeGen, errsCount: Name): void { + gen.assign(N.errors, errsCount) + gen.if(_`${N.vErrors} !== null`, () => + gen.if( + errsCount, + () => gen.assign(_`${N.vErrors}.length`, errsCount), + () => gen.assign(N.vErrors, null) + ) + ) +} + +export function extendErrors({ + gen, + keyword, + schemaValue, + data, + errsCount, + it, +}: KeywordErrorCxt): void { + /* istanbul ignore if */ + if (errsCount === undefined) throw new Error("ajv implementation error") + const err = gen.name("err") + gen.forRange("i", errsCount, N.errors, (i) => { + gen.const(err, _`${N.vErrors}[${i}]`) + gen.if(_`${err}.instancePath === undefined`, () => + gen.assign(_`${err}.instancePath`, strConcat(N.instancePath, it.errorPath)) + ) + gen.assign(_`${err}.schemaPath`, str`${it.errSchemaPath}/${keyword}`) + if (it.opts.verbose) { + gen.assign(_`${err}.schema`, schemaValue) + gen.assign(_`${err}.data`, data) + } + }) +} + +function addError(gen: CodeGen, errObj: Code): void { + const err = gen.const("err", errObj) + gen.if( + _`${N.vErrors} === null`, + () => gen.assign(N.vErrors, _`[${err}]`), + _`${N.vErrors}.push(${err})` + ) + gen.code(_`${N.errors}++`) +} + +function returnErrors(it: SchemaCxt, errs: Code): void { + const {gen, validateName, schemaEnv} = it + if (schemaEnv.$async) { + gen.throw(_`new ${it.ValidationError as Name}(${errs})`) + } else { + gen.assign(_`${validateName}.errors`, errs) + gen.return(false) + } +} + +const E = { + keyword: new Name("keyword"), + schemaPath: new Name("schemaPath"), // also used in JTD errors + params: new Name("params"), + propertyName: new Name("propertyName"), + message: new Name("message"), + schema: new Name("schema"), + parentSchema: new Name("parentSchema"), +} + +function errorObjectCode( + cxt: KeywordErrorCxt, + error: KeywordErrorDefinition, + errorPaths?: ErrorPaths +): Code { + const {createErrors} = cxt.it + if (createErrors === false) return _`{}` + return errorObject(cxt, error, errorPaths) +} + +function errorObject( + cxt: KeywordErrorCxt, + error: KeywordErrorDefinition, + errorPaths: ErrorPaths = {} +): Code { + const {gen, it} = cxt + const keyValues: [Name, SafeExpr | string][] = [ + errorInstancePath(it, errorPaths), + errorSchemaPath(cxt, errorPaths), + ] + extraErrorProps(cxt, error, keyValues) + return gen.object(...keyValues) +} + +function errorInstancePath({errorPath}: SchemaCxt, {instancePath}: ErrorPaths): [Name, Code] { + const instPath = instancePath + ? str`${errorPath}${getErrorPath(instancePath, Type.Str)}` + : errorPath + return [N.instancePath, strConcat(N.instancePath, instPath)] +} + +function errorSchemaPath( + {keyword, it: {errSchemaPath}}: KeywordErrorCxt, + {schemaPath, parentSchema}: ErrorPaths +): [Name, string | Code] { + let schPath = parentSchema ? errSchemaPath : str`${errSchemaPath}/${keyword}` + if (schemaPath) { + schPath = str`${schPath}${getErrorPath(schemaPath, Type.Str)}` + } + return [E.schemaPath, schPath] +} + +function extraErrorProps( + cxt: KeywordErrorCxt, + {params, message}: KeywordErrorDefinition, + keyValues: [Name, SafeExpr | string][] +): void { + const {keyword, data, schemaValue, it} = cxt + const {opts, propertyName, topSchemaRef, schemaPath} = it + keyValues.push( + [E.keyword, keyword], + [E.params, typeof params == "function" ? params(cxt) : params || _`{}`] + ) + if (opts.messages) { + keyValues.push([E.message, typeof message == "function" ? message(cxt) : message]) + } + if (opts.verbose) { + keyValues.push( + [E.schema, schemaValue], + [E.parentSchema, _`${topSchemaRef}${schemaPath}`], + [N.data, data] + ) + } + if (propertyName) keyValues.push([E.propertyName, propertyName]) +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/index.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/index.ts new file mode 100644 index 000000000..3dac2699b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/index.ts @@ -0,0 +1,324 @@ +import type { + AnySchema, + AnySchemaObject, + AnyValidateFunction, + AsyncValidateFunction, + EvaluatedProperties, + EvaluatedItems, +} from "../types" +import type Ajv from "../core" +import type {InstanceOptions} from "../core" +import {CodeGen, _, nil, stringify, Name, Code, ValueScopeName} from "./codegen" +import ValidationError from "../runtime/validation_error" +import N from "./names" +import {LocalRefs, getFullPath, _getFullPath, inlineRef, normalizeId, resolveUrl} from "./resolve" +import {schemaHasRulesButRef, unescapeFragment} from "./util" +import {validateFunctionCode} from "./validate" +import * as URI from "uri-js" +import {JSONType} from "./rules" + +export type SchemaRefs = { + [Ref in string]?: SchemaEnv | AnySchema +} + +export interface SchemaCxt { + readonly gen: CodeGen + readonly allErrors?: boolean // validation mode - whether to collect all errors or break on error + readonly data: Name // Name with reference to the current part of data instance + readonly parentData: Name // should be used in keywords modifying data + readonly parentDataProperty: Code | number // should be used in keywords modifying data + readonly dataNames: Name[] + readonly dataPathArr: (Code | number)[] + readonly dataLevel: number // the level of the currently validated data, + // it can be used to access both the property names and the data on all levels from the top. + dataTypes: JSONType[] // data types applied to the current part of data instance + definedProperties: Set // set of properties to keep track of for required checks + readonly topSchemaRef: Code + readonly validateName: Name + evaluated?: Name + readonly ValidationError?: Name + readonly schema: AnySchema // current schema object - equal to parentSchema passed via KeywordCxt + readonly schemaEnv: SchemaEnv + readonly rootId: string + baseId: string // the current schema base URI that should be used as the base for resolving URIs in references (\$ref) + readonly schemaPath: Code // the run-time expression that evaluates to the property name of the current schema + readonly errSchemaPath: string // this is actual string, should not be changed to Code + readonly errorPath: Code + readonly propertyName?: Name + readonly compositeRule?: boolean // true indicates that the current schema is inside the compound keyword, + // where failing some rule doesn't mean validation failure (`anyOf`, `oneOf`, `not`, `if`). + // This flag is used to determine whether you can return validation result immediately after any error in case the option `allErrors` is not `true. + // You only need to use it if you have many steps in your keywords and potentially can define multiple errors. + props?: EvaluatedProperties | Name // properties evaluated by this schema - used by parent schema or assigned to validation function + items?: EvaluatedItems | Name // last item evaluated by this schema - used by parent schema or assigned to validation function + jtdDiscriminator?: string + jtdMetadata?: boolean + readonly createErrors?: boolean + readonly opts: InstanceOptions // Ajv instance option. + readonly self: Ajv // current Ajv instance +} + +export interface SchemaObjCxt extends SchemaCxt { + readonly schema: AnySchemaObject +} +interface SchemaEnvArgs { + readonly schema: AnySchema + readonly schemaId?: "$id" | "id" + readonly root?: SchemaEnv + readonly baseId?: string + readonly schemaPath?: string + readonly localRefs?: LocalRefs + readonly meta?: boolean +} + +export class SchemaEnv implements SchemaEnvArgs { + readonly schema: AnySchema + readonly schemaId?: "$id" | "id" + readonly root: SchemaEnv + baseId: string // TODO possibly, it should be readonly + schemaPath?: string + localRefs?: LocalRefs + readonly meta?: boolean + readonly $async?: boolean // true if the current schema is asynchronous. + readonly refs: SchemaRefs = {} + readonly dynamicAnchors: {[Ref in string]?: true} = {} + validate?: AnyValidateFunction + validateName?: ValueScopeName + serialize?: (data: unknown) => string + serializeName?: ValueScopeName + parse?: (data: string) => unknown + parseName?: ValueScopeName + + constructor(env: SchemaEnvArgs) { + let schema: AnySchemaObject | undefined + if (typeof env.schema == "object") schema = env.schema + this.schema = env.schema + this.schemaId = env.schemaId + this.root = env.root || this + this.baseId = env.baseId ?? normalizeId(schema?.[env.schemaId || "$id"]) + this.schemaPath = env.schemaPath + this.localRefs = env.localRefs + this.meta = env.meta + this.$async = schema?.$async + this.refs = {} + } +} + +// let codeSize = 0 +// let nodeCount = 0 + +// Compiles schema in SchemaEnv +export function compileSchema(this: Ajv, sch: SchemaEnv): SchemaEnv { + // TODO refactor - remove compilations + const _sch = getCompilingSchema.call(this, sch) + if (_sch) return _sch + const rootId = getFullPath(this.opts.uriResolver, sch.root.baseId) // TODO if getFullPath removed 1 tests fails + const {es5, lines} = this.opts.code + const {ownProperties} = this.opts + const gen = new CodeGen(this.scope, {es5, lines, ownProperties}) + let _ValidationError + if (sch.$async) { + _ValidationError = gen.scopeValue("Error", { + ref: ValidationError, + code: _`require("ajv/dist/runtime/validation_error").default`, + }) + } + + const validateName = gen.scopeName("validate") + sch.validateName = validateName + + const schemaCxt: SchemaCxt = { + gen, + allErrors: this.opts.allErrors, + data: N.data, + parentData: N.parentData, + parentDataProperty: N.parentDataProperty, + dataNames: [N.data], + dataPathArr: [nil], // TODO can its length be used as dataLevel if nil is removed? + dataLevel: 0, + dataTypes: [], + definedProperties: new Set(), + topSchemaRef: gen.scopeValue( + "schema", + this.opts.code.source === true + ? {ref: sch.schema, code: stringify(sch.schema)} + : {ref: sch.schema} + ), + validateName, + ValidationError: _ValidationError, + schema: sch.schema, + schemaEnv: sch, + rootId, + baseId: sch.baseId || rootId, + schemaPath: nil, + errSchemaPath: sch.schemaPath || (this.opts.jtd ? "" : "#"), + errorPath: _`""`, + opts: this.opts, + self: this, + } + + let sourceCode: string | undefined + try { + this._compilations.add(sch) + validateFunctionCode(schemaCxt) + gen.optimize(this.opts.code.optimize) + // gen.optimize(1) + const validateCode = gen.toString() + sourceCode = `${gen.scopeRefs(N.scope)}return ${validateCode}` + // console.log((codeSize += sourceCode.length), (nodeCount += gen.nodeCount)) + if (this.opts.code.process) sourceCode = this.opts.code.process(sourceCode, sch) + // console.log("\n\n\n *** \n", sourceCode) + const makeValidate = new Function(`${N.self}`, `${N.scope}`, sourceCode) + const validate: AnyValidateFunction = makeValidate(this, this.scope.get()) + this.scope.value(validateName, {ref: validate}) + + validate.errors = null + validate.schema = sch.schema + validate.schemaEnv = sch + if (sch.$async) (validate as AsyncValidateFunction).$async = true + if (this.opts.code.source === true) { + validate.source = {validateName, validateCode, scopeValues: gen._values} + } + if (this.opts.unevaluated) { + const {props, items} = schemaCxt + validate.evaluated = { + props: props instanceof Name ? undefined : props, + items: items instanceof Name ? undefined : items, + dynamicProps: props instanceof Name, + dynamicItems: items instanceof Name, + } + if (validate.source) validate.source.evaluated = stringify(validate.evaluated) + } + sch.validate = validate + return sch + } catch (e) { + delete sch.validate + delete sch.validateName + if (sourceCode) this.logger.error("Error compiling schema, function code:", sourceCode) + // console.log("\n\n\n *** \n", sourceCode, this.opts) + throw e + } finally { + this._compilations.delete(sch) + } +} + +export function resolveRef( + this: Ajv, + root: SchemaEnv, + baseId: string, + ref: string +): AnySchema | SchemaEnv | undefined { + ref = resolveUrl(this.opts.uriResolver, baseId, ref) + const schOrFunc = root.refs[ref] + if (schOrFunc) return schOrFunc + + let _sch = resolve.call(this, root, ref) + if (_sch === undefined) { + const schema = root.localRefs?.[ref] // TODO maybe localRefs should hold SchemaEnv + const {schemaId} = this.opts + if (schema) _sch = new SchemaEnv({schema, schemaId, root, baseId}) + } + + if (_sch === undefined) return + return (root.refs[ref] = inlineOrCompile.call(this, _sch)) +} + +function inlineOrCompile(this: Ajv, sch: SchemaEnv): AnySchema | SchemaEnv { + if (inlineRef(sch.schema, this.opts.inlineRefs)) return sch.schema + return sch.validate ? sch : compileSchema.call(this, sch) +} + +// Index of schema compilation in the currently compiled list +export function getCompilingSchema(this: Ajv, schEnv: SchemaEnv): SchemaEnv | void { + for (const sch of this._compilations) { + if (sameSchemaEnv(sch, schEnv)) return sch + } +} + +function sameSchemaEnv(s1: SchemaEnv, s2: SchemaEnv): boolean { + return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId +} + +// resolve and compile the references ($ref) +// TODO returns AnySchemaObject (if the schema can be inlined) or validation function +function resolve( + this: Ajv, + root: SchemaEnv, // information about the root schema for the current schema + ref: string // reference to resolve +): SchemaEnv | undefined { + let sch + while (typeof (sch = this.refs[ref]) == "string") ref = sch + return sch || this.schemas[ref] || resolveSchema.call(this, root, ref) +} + +// Resolve schema, its root and baseId +export function resolveSchema( + this: Ajv, + root: SchemaEnv, // root object with properties schema, refs TODO below SchemaEnv is assigned to it + ref: string // reference to resolve +): SchemaEnv | undefined { + const p = this.opts.uriResolver.parse(ref) + const refPath = _getFullPath(this.opts.uriResolver, p) + let baseId = getFullPath(this.opts.uriResolver, root.baseId, undefined) + // TODO `Object.keys(root.schema).length > 0` should not be needed - but removing breaks 2 tests + if (Object.keys(root.schema).length > 0 && refPath === baseId) { + return getJsonPointer.call(this, p, root) + } + + const id = normalizeId(refPath) + const schOrRef = this.refs[id] || this.schemas[id] + if (typeof schOrRef == "string") { + const sch = resolveSchema.call(this, root, schOrRef) + if (typeof sch?.schema !== "object") return + return getJsonPointer.call(this, p, sch) + } + + if (typeof schOrRef?.schema !== "object") return + if (!schOrRef.validate) compileSchema.call(this, schOrRef) + if (id === normalizeId(ref)) { + const {schema} = schOrRef + const {schemaId} = this.opts + const schId = schema[schemaId] + if (schId) baseId = resolveUrl(this.opts.uriResolver, baseId, schId) + return new SchemaEnv({schema, schemaId, root, baseId}) + } + return getJsonPointer.call(this, p, schOrRef) +} + +const PREVENT_SCOPE_CHANGE = new Set([ + "properties", + "patternProperties", + "enum", + "dependencies", + "definitions", +]) + +function getJsonPointer( + this: Ajv, + parsedRef: URI.URIComponents, + {baseId, schema, root}: SchemaEnv +): SchemaEnv | undefined { + if (parsedRef.fragment?.[0] !== "/") return + for (const part of parsedRef.fragment.slice(1).split("/")) { + if (typeof schema === "boolean") return + const partSchema = schema[unescapeFragment(part)] + if (partSchema === undefined) return + schema = partSchema + // TODO PREVENT_SCOPE_CHANGE could be defined in keyword def? + const schId = typeof schema === "object" && schema[this.opts.schemaId] + if (!PREVENT_SCOPE_CHANGE.has(part) && schId) { + baseId = resolveUrl(this.opts.uriResolver, baseId, schId) + } + } + let env: SchemaEnv | undefined + if (typeof schema != "boolean" && schema.$ref && !schemaHasRulesButRef(schema, this.RULES)) { + const $ref = resolveUrl(this.opts.uriResolver, baseId, schema.$ref) + env = resolveSchema.call(this, root, $ref) + } + // even though resolution failed we need to return SchemaEnv to throw exception + // so that compileAsync loads missing schema. + const {schemaId} = this.opts + env = env || new SchemaEnv({schema, schemaId, root, baseId}) + if (env.schema !== env.root.schema) return env + return undefined +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/jtd/parse.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/jtd/parse.ts new file mode 100644 index 000000000..a0141c770 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/jtd/parse.ts @@ -0,0 +1,411 @@ +import type Ajv from "../../core" +import type {SchemaObject} from "../../types" +import {jtdForms, JTDForm, SchemaObjectMap} from "./types" +import {SchemaEnv, getCompilingSchema} from ".." +import {_, str, and, or, nil, not, CodeGen, Code, Name, SafeExpr} from "../codegen" +import MissingRefError from "../ref_error" +import N from "../names" +import {hasPropFunc} from "../../vocabularies/code" +import {hasRef} from "../../vocabularies/jtd/ref" +import {intRange, IntType} from "../../vocabularies/jtd/type" +import {parseJson, parseJsonNumber, parseJsonString} from "../../runtime/parseJson" +import {useFunc} from "../util" +import validTimestamp from "../../runtime/timestamp" + +type GenParse = (cxt: ParseCxt) => void + +const genParse: {[F in JTDForm]: GenParse} = { + elements: parseElements, + values: parseValues, + discriminator: parseDiscriminator, + properties: parseProperties, + optionalProperties: parseProperties, + enum: parseEnum, + type: parseType, + ref: parseRef, +} + +interface ParseCxt { + readonly gen: CodeGen + readonly self: Ajv // current Ajv instance + readonly schemaEnv: SchemaEnv + readonly definitions: SchemaObjectMap + schema: SchemaObject + data: Code + parseName: Name + char: Name +} + +export default function compileParser( + this: Ajv, + sch: SchemaEnv, + definitions: SchemaObjectMap +): SchemaEnv { + const _sch = getCompilingSchema.call(this, sch) + if (_sch) return _sch + const {es5, lines} = this.opts.code + const {ownProperties} = this.opts + const gen = new CodeGen(this.scope, {es5, lines, ownProperties}) + const parseName = gen.scopeName("parse") + const cxt: ParseCxt = { + self: this, + gen, + schema: sch.schema as SchemaObject, + schemaEnv: sch, + definitions, + data: N.data, + parseName, + char: gen.name("c"), + } + + let sourceCode: string | undefined + try { + this._compilations.add(sch) + sch.parseName = parseName + parserFunction(cxt) + gen.optimize(this.opts.code.optimize) + const parseFuncCode = gen.toString() + sourceCode = `${gen.scopeRefs(N.scope)}return ${parseFuncCode}` + const makeParse = new Function(`${N.scope}`, sourceCode) + const parse: (json: string) => unknown = makeParse(this.scope.get()) + this.scope.value(parseName, {ref: parse}) + sch.parse = parse + } catch (e) { + if (sourceCode) this.logger.error("Error compiling parser, function code:", sourceCode) + delete sch.parse + delete sch.parseName + throw e + } finally { + this._compilations.delete(sch) + } + return sch +} + +const undef = _`undefined` + +function parserFunction(cxt: ParseCxt): void { + const {gen, parseName, char} = cxt + gen.func(parseName, _`${N.json}, ${N.jsonPos}, ${N.jsonPart}`, false, () => { + gen.let(N.data) + gen.let(char) + gen.assign(_`${parseName}.message`, undef) + gen.assign(_`${parseName}.position`, undef) + gen.assign(N.jsonPos, _`${N.jsonPos} || 0`) + gen.const(N.jsonLen, _`${N.json}.length`) + parseCode(cxt) + skipWhitespace(cxt) + gen.if(N.jsonPart, () => { + gen.assign(_`${parseName}.position`, N.jsonPos) + gen.return(N.data) + }) + gen.if(_`${N.jsonPos} === ${N.jsonLen}`, () => gen.return(N.data)) + jsonSyntaxError(cxt) + }) +} + +function parseCode(cxt: ParseCxt): void { + let form: JTDForm | undefined + for (const key of jtdForms) { + if (key in cxt.schema) { + form = key + break + } + } + if (form) parseNullable(cxt, genParse[form]) + else parseEmpty(cxt) +} + +const parseBoolean = parseBooleanToken(true, parseBooleanToken(false, jsonSyntaxError)) + +function parseNullable(cxt: ParseCxt, parseForm: GenParse): void { + const {gen, schema, data} = cxt + if (!schema.nullable) return parseForm(cxt) + tryParseToken(cxt, "null", parseForm, () => gen.assign(data, null)) +} + +function parseElements(cxt: ParseCxt): void { + const {gen, schema, data} = cxt + parseToken(cxt, "[") + const ix = gen.let("i", 0) + gen.assign(data, _`[]`) + parseItems(cxt, "]", () => { + const el = gen.let("el") + parseCode({...cxt, schema: schema.elements, data: el}) + gen.assign(_`${data}[${ix}++]`, el) + }) +} + +function parseValues(cxt: ParseCxt): void { + const {gen, schema, data} = cxt + parseToken(cxt, "{") + gen.assign(data, _`{}`) + parseItems(cxt, "}", () => parseKeyValue(cxt, schema.values)) +} + +function parseItems(cxt: ParseCxt, endToken: string, block: () => void): void { + tryParseItems(cxt, endToken, block) + parseToken(cxt, endToken) +} + +function tryParseItems(cxt: ParseCxt, endToken: string, block: () => void): void { + const {gen} = cxt + gen.for(_`;${N.jsonPos}<${N.jsonLen} && ${jsonSlice(1)}!==${endToken};`, () => { + block() + tryParseToken(cxt, ",", () => gen.break(), hasItem) + }) + + function hasItem(): void { + tryParseToken(cxt, endToken, () => {}, jsonSyntaxError) + } +} + +function parseKeyValue(cxt: ParseCxt, schema: SchemaObject): void { + const {gen} = cxt + const key = gen.let("key") + parseString({...cxt, data: key}) + parseToken(cxt, ":") + parsePropertyValue(cxt, key, schema) +} + +function parseDiscriminator(cxt: ParseCxt): void { + const {gen, data, schema} = cxt + const {discriminator, mapping} = schema + parseToken(cxt, "{") + gen.assign(data, _`{}`) + const startPos = gen.const("pos", N.jsonPos) + const value = gen.let("value") + const tag = gen.let("tag") + tryParseItems(cxt, "}", () => { + const key = gen.let("key") + parseString({...cxt, data: key}) + parseToken(cxt, ":") + gen.if( + _`${key} === ${discriminator}`, + () => { + parseString({...cxt, data: tag}) + gen.assign(_`${data}[${key}]`, tag) + gen.break() + }, + () => parseEmpty({...cxt, data: value}) // can be discarded/skipped + ) + }) + gen.assign(N.jsonPos, startPos) + gen.if(_`${tag} === undefined`) + parsingError(cxt, str`discriminator tag not found`) + for (const tagValue in mapping) { + gen.elseIf(_`${tag} === ${tagValue}`) + parseSchemaProperties({...cxt, schema: mapping[tagValue]}, discriminator) + } + gen.else() + parsingError(cxt, str`discriminator value not in schema`) + gen.endIf() +} + +function parseProperties(cxt: ParseCxt): void { + const {gen, data} = cxt + parseToken(cxt, "{") + gen.assign(data, _`{}`) + parseSchemaProperties(cxt) +} + +function parseSchemaProperties(cxt: ParseCxt, discriminator?: string): void { + const {gen, schema, data} = cxt + const {properties, optionalProperties, additionalProperties} = schema + parseItems(cxt, "}", () => { + const key = gen.let("key") + parseString({...cxt, data: key}) + parseToken(cxt, ":") + gen.if(false) + parseDefinedProperty(cxt, key, properties) + parseDefinedProperty(cxt, key, optionalProperties) + if (discriminator) { + gen.elseIf(_`${key} === ${discriminator}`) + const tag = gen.let("tag") + parseString({...cxt, data: tag}) // can be discarded, it is already assigned + } + gen.else() + if (additionalProperties) { + parseEmpty({...cxt, data: _`${data}[${key}]`}) + } else { + parsingError(cxt, str`property ${key} not allowed`) + } + gen.endIf() + }) + if (properties) { + const hasProp = hasPropFunc(gen) + const allProps: Code = and( + ...Object.keys(properties).map((p): Code => _`${hasProp}.call(${data}, ${p})`) + ) + gen.if(not(allProps), () => parsingError(cxt, str`missing required properties`)) + } +} + +function parseDefinedProperty(cxt: ParseCxt, key: Name, schemas: SchemaObjectMap = {}): void { + const {gen} = cxt + for (const prop in schemas) { + gen.elseIf(_`${key} === ${prop}`) + parsePropertyValue(cxt, key, schemas[prop] as SchemaObject) + } +} + +function parsePropertyValue(cxt: ParseCxt, key: Name, schema: SchemaObject): void { + parseCode({...cxt, schema, data: _`${cxt.data}[${key}]`}) +} + +function parseType(cxt: ParseCxt): void { + const {gen, schema, data, self} = cxt + switch (schema.type) { + case "boolean": + parseBoolean(cxt) + break + case "string": + parseString(cxt) + break + case "timestamp": { + parseString(cxt) + const vts = useFunc(gen, validTimestamp) + const {allowDate, parseDate} = self.opts + const notValid = allowDate ? _`!${vts}(${data}, true)` : _`!${vts}(${data})` + const fail: Code = parseDate + ? or(notValid, _`(${data} = new Date(${data}), false)`, _`isNaN(${data}.valueOf())`) + : notValid + gen.if(fail, () => parsingError(cxt, str`invalid timestamp`)) + break + } + case "float32": + case "float64": + parseNumber(cxt) + break + default: { + const t = schema.type as IntType + if (!self.opts.int32range && (t === "int32" || t === "uint32")) { + parseNumber(cxt, 16) // 2 ** 53 - max safe integer + if (t === "uint32") { + gen.if(_`${data} < 0`, () => parsingError(cxt, str`integer out of range`)) + } + } else { + const [min, max, maxDigits] = intRange[t] + parseNumber(cxt, maxDigits) + gen.if(_`${data} < ${min} || ${data} > ${max}`, () => + parsingError(cxt, str`integer out of range`) + ) + } + } + } +} + +function parseString(cxt: ParseCxt): void { + parseToken(cxt, '"') + parseWith(cxt, parseJsonString) +} + +function parseEnum(cxt: ParseCxt): void { + const {gen, data, schema} = cxt + const enumSch = schema.enum + parseToken(cxt, '"') + // TODO loopEnum + gen.if(false) + for (const value of enumSch) { + const valueStr = JSON.stringify(value).slice(1) // remove starting quote + gen.elseIf(_`${jsonSlice(valueStr.length)} === ${valueStr}`) + gen.assign(data, str`${value}`) + gen.add(N.jsonPos, valueStr.length) + } + gen.else() + jsonSyntaxError(cxt) + gen.endIf() +} + +function parseNumber(cxt: ParseCxt, maxDigits?: number): void { + const {gen} = cxt + skipWhitespace(cxt) + gen.if( + _`"-0123456789".indexOf(${jsonSlice(1)}) < 0`, + () => jsonSyntaxError(cxt), + () => parseWith(cxt, parseJsonNumber, maxDigits) + ) +} + +function parseBooleanToken(bool: boolean, fail: GenParse): GenParse { + return (cxt) => { + const {gen, data} = cxt + tryParseToken( + cxt, + `${bool}`, + () => fail(cxt), + () => gen.assign(data, bool) + ) + } +} + +function parseRef(cxt: ParseCxt): void { + const {gen, self, definitions, schema, schemaEnv} = cxt + const {ref} = schema + const refSchema = definitions[ref] + if (!refSchema) throw new MissingRefError(self.opts.uriResolver, "", ref, `No definition ${ref}`) + if (!hasRef(refSchema)) return parseCode({...cxt, schema: refSchema}) + const {root} = schemaEnv + const sch = compileParser.call(self, new SchemaEnv({schema: refSchema, root}), definitions) + partialParse(cxt, getParser(gen, sch), true) +} + +function getParser(gen: CodeGen, sch: SchemaEnv): Code { + return sch.parse + ? gen.scopeValue("parse", {ref: sch.parse}) + : _`${gen.scopeValue("wrapper", {ref: sch})}.parse` +} + +function parseEmpty(cxt: ParseCxt): void { + parseWith(cxt, parseJson) +} + +function parseWith(cxt: ParseCxt, parseFunc: {code: string}, args?: SafeExpr): void { + partialParse(cxt, useFunc(cxt.gen, parseFunc), args) +} + +function partialParse(cxt: ParseCxt, parseFunc: Name, args?: SafeExpr): void { + const {gen, data} = cxt + gen.assign(data, _`${parseFunc}(${N.json}, ${N.jsonPos}${args ? _`, ${args}` : nil})`) + gen.assign(N.jsonPos, _`${parseFunc}.position`) + gen.if(_`${data} === undefined`, () => parsingError(cxt, _`${parseFunc}.message`)) +} + +function parseToken(cxt: ParseCxt, tok: string): void { + tryParseToken(cxt, tok, jsonSyntaxError) +} + +function tryParseToken(cxt: ParseCxt, tok: string, fail: GenParse, success?: GenParse): void { + const {gen} = cxt + const n = tok.length + skipWhitespace(cxt) + gen.if( + _`${jsonSlice(n)} === ${tok}`, + () => { + gen.add(N.jsonPos, n) + success?.(cxt) + }, + () => fail(cxt) + ) +} + +function skipWhitespace({gen, char: c}: ParseCxt): void { + gen.code( + _`while((${c}=${N.json}[${N.jsonPos}],${c}===" "||${c}==="\\n"||${c}==="\\r"||${c}==="\\t"))${N.jsonPos}++;` + ) +} + +function jsonSlice(len: number | Name): Code { + return len === 1 + ? _`${N.json}[${N.jsonPos}]` + : _`${N.json}.slice(${N.jsonPos}, ${N.jsonPos}+${len})` +} + +function jsonSyntaxError(cxt: ParseCxt): void { + parsingError(cxt, _`"unexpected token " + ${N.json}[${N.jsonPos}]`) +} + +function parsingError({gen, parseName}: ParseCxt, msg: Code): void { + gen.assign(_`${parseName}.message`, msg) + gen.assign(_`${parseName}.position`, N.jsonPos) + gen.return(undef) +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/jtd/serialize.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/jtd/serialize.ts new file mode 100644 index 000000000..7ebd26acb --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/jtd/serialize.ts @@ -0,0 +1,260 @@ +import type Ajv from "../../core" +import type {SchemaObject} from "../../types" +import {jtdForms, JTDForm, SchemaObjectMap} from "./types" +import {SchemaEnv, getCompilingSchema} from ".." +import {_, str, and, getProperty, CodeGen, Code, Name} from "../codegen" +import MissingRefError from "../ref_error" +import N from "../names" +import {isOwnProperty} from "../../vocabularies/code" +import {hasRef} from "../../vocabularies/jtd/ref" +import {useFunc} from "../util" +import quote from "../../runtime/quote" + +const genSerialize: {[F in JTDForm]: (cxt: SerializeCxt) => void} = { + elements: serializeElements, + values: serializeValues, + discriminator: serializeDiscriminator, + properties: serializeProperties, + optionalProperties: serializeProperties, + enum: serializeString, + type: serializeType, + ref: serializeRef, +} + +interface SerializeCxt { + readonly gen: CodeGen + readonly self: Ajv // current Ajv instance + readonly schemaEnv: SchemaEnv + readonly definitions: SchemaObjectMap + schema: SchemaObject + data: Code +} + +export default function compileSerializer( + this: Ajv, + sch: SchemaEnv, + definitions: SchemaObjectMap +): SchemaEnv { + const _sch = getCompilingSchema.call(this, sch) + if (_sch) return _sch + const {es5, lines} = this.opts.code + const {ownProperties} = this.opts + const gen = new CodeGen(this.scope, {es5, lines, ownProperties}) + const serializeName = gen.scopeName("serialize") + const cxt: SerializeCxt = { + self: this, + gen, + schema: sch.schema as SchemaObject, + schemaEnv: sch, + definitions, + data: N.data, + } + + let sourceCode: string | undefined + try { + this._compilations.add(sch) + sch.serializeName = serializeName + gen.func(serializeName, N.data, false, () => { + gen.let(N.json, str``) + serializeCode(cxt) + gen.return(N.json) + }) + gen.optimize(this.opts.code.optimize) + const serializeFuncCode = gen.toString() + sourceCode = `${gen.scopeRefs(N.scope)}return ${serializeFuncCode}` + const makeSerialize = new Function(`${N.scope}`, sourceCode) + const serialize: (data: unknown) => string = makeSerialize(this.scope.get()) + this.scope.value(serializeName, {ref: serialize}) + sch.serialize = serialize + } catch (e) { + if (sourceCode) this.logger.error("Error compiling serializer, function code:", sourceCode) + delete sch.serialize + delete sch.serializeName + throw e + } finally { + this._compilations.delete(sch) + } + return sch +} + +function serializeCode(cxt: SerializeCxt): void { + let form: JTDForm | undefined + for (const key of jtdForms) { + if (key in cxt.schema) { + form = key + break + } + } + serializeNullable(cxt, form ? genSerialize[form] : serializeEmpty) +} + +function serializeNullable(cxt: SerializeCxt, serializeForm: (_cxt: SerializeCxt) => void): void { + const {gen, schema, data} = cxt + if (!schema.nullable) return serializeForm(cxt) + gen.if( + _`${data} === undefined || ${data} === null`, + () => gen.add(N.json, _`"null"`), + () => serializeForm(cxt) + ) +} + +function serializeElements(cxt: SerializeCxt): void { + const {gen, schema, data} = cxt + gen.add(N.json, str`[`) + const first = gen.let("first", true) + gen.forOf("el", data, (el) => { + addComma(cxt, first) + serializeCode({...cxt, schema: schema.elements, data: el}) + }) + gen.add(N.json, str`]`) +} + +function serializeValues(cxt: SerializeCxt): void { + const {gen, schema, data} = cxt + gen.add(N.json, str`{`) + const first = gen.let("first", true) + gen.forIn("key", data, (key) => serializeKeyValue(cxt, key, schema.values, first)) + gen.add(N.json, str`}`) +} + +function serializeKeyValue(cxt: SerializeCxt, key: Name, schema: SchemaObject, first: Name): void { + const {gen, data} = cxt + addComma(cxt, first) + serializeString({...cxt, data: key}) + gen.add(N.json, str`:`) + const value = gen.const("value", _`${data}${getProperty(key)}`) + serializeCode({...cxt, schema, data: value}) +} + +function serializeDiscriminator(cxt: SerializeCxt): void { + const {gen, schema, data} = cxt + const {discriminator} = schema + gen.add(N.json, str`{${JSON.stringify(discriminator)}:`) + const tag = gen.const("tag", _`${data}${getProperty(discriminator)}`) + serializeString({...cxt, data: tag}) + gen.if(false) + for (const tagValue in schema.mapping) { + gen.elseIf(_`${tag} === ${tagValue}`) + const sch = schema.mapping[tagValue] + serializeSchemaProperties({...cxt, schema: sch}, discriminator) + } + gen.endIf() + gen.add(N.json, str`}`) +} + +function serializeProperties(cxt: SerializeCxt): void { + const {gen} = cxt + gen.add(N.json, str`{`) + serializeSchemaProperties(cxt) + gen.add(N.json, str`}`) +} + +function serializeSchemaProperties(cxt: SerializeCxt, discriminator?: string): void { + const {gen, schema, data} = cxt + const {properties, optionalProperties} = schema + const props = keys(properties) + const optProps = keys(optionalProperties) + const allProps = allProperties(props.concat(optProps)) + let first = !discriminator + for (const key of props) { + serializeProperty(key, properties[key], keyValue(key)) + } + for (const key of optProps) { + const value = keyValue(key) + gen.if(and(_`${value} !== undefined`, isOwnProperty(gen, data, key)), () => + serializeProperty(key, optionalProperties[key], value) + ) + } + if (schema.additionalProperties) { + gen.forIn("key", data, (key) => + gen.if(isAdditional(key, allProps), () => + serializeKeyValue(cxt, key, {}, gen.let("first", first)) + ) + ) + } + + function keys(ps?: SchemaObjectMap): string[] { + return ps ? Object.keys(ps) : [] + } + + function allProperties(ps: string[]): string[] { + if (discriminator) ps.push(discriminator) + if (new Set(ps).size !== ps.length) { + throw new Error("JTD: properties/optionalProperties/disciminator overlap") + } + return ps + } + + function keyValue(key: string): Name { + return gen.const("value", _`${data}${getProperty(key)}`) + } + + function serializeProperty(key: string, propSchema: SchemaObject, value: Name): void { + if (first) first = false + else gen.add(N.json, str`,`) + gen.add(N.json, str`${JSON.stringify(key)}:`) + serializeCode({...cxt, schema: propSchema, data: value}) + } + + function isAdditional(key: Name, ps: string[]): Code | true { + return ps.length ? and(...ps.map((p) => _`${key} !== ${p}`)) : true + } +} + +function serializeType(cxt: SerializeCxt): void { + const {gen, schema, data} = cxt + switch (schema.type) { + case "boolean": + gen.add(N.json, _`${data} ? "true" : "false"`) + break + case "string": + serializeString(cxt) + break + case "timestamp": + gen.if( + _`${data} instanceof Date`, + () => gen.add(N.json, _`'"' + ${data}.toISOString() + '"'`), + () => serializeString(cxt) + ) + break + default: + serializeNumber(cxt) + } +} + +function serializeString({gen, data}: SerializeCxt): void { + gen.add(N.json, _`${useFunc(gen, quote)}(${data})`) +} + +function serializeNumber({gen, data}: SerializeCxt): void { + gen.add(N.json, _`"" + ${data}`) +} + +function serializeRef(cxt: SerializeCxt): void { + const {gen, self, data, definitions, schema, schemaEnv} = cxt + const {ref} = schema + const refSchema = definitions[ref] + if (!refSchema) throw new MissingRefError(self.opts.uriResolver, "", ref, `No definition ${ref}`) + if (!hasRef(refSchema)) return serializeCode({...cxt, schema: refSchema}) + const {root} = schemaEnv + const sch = compileSerializer.call(self, new SchemaEnv({schema: refSchema, root}), definitions) + gen.add(N.json, _`${getSerialize(gen, sch)}(${data})`) +} + +function getSerialize(gen: CodeGen, sch: SchemaEnv): Code { + return sch.serialize + ? gen.scopeValue("serialize", {ref: sch.serialize}) + : _`${gen.scopeValue("wrapper", {ref: sch})}.serialize` +} + +function serializeEmpty({gen, data}: SerializeCxt): void { + gen.add(N.json, _`JSON.stringify(${data})`) +} + +function addComma({gen}: SerializeCxt, first: Name): void { + gen.if( + first, + () => gen.assign(first, false), + () => gen.add(N.json, str`,`) + ) +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/jtd/types.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/jtd/types.ts new file mode 100644 index 000000000..7f3619576 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/jtd/types.ts @@ -0,0 +1,16 @@ +import type {SchemaObject} from "../../types" + +export type SchemaObjectMap = {[Ref in string]?: SchemaObject} + +export const jtdForms = [ + "elements", + "values", + "discriminator", + "properties", + "optionalProperties", + "enum", + "type", + "ref", +] as const + +export type JTDForm = typeof jtdForms[number] diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/names.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/names.ts new file mode 100644 index 000000000..b4b242e17 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/names.ts @@ -0,0 +1,27 @@ +import {Name} from "./codegen" + +const names = { + // validation function arguments + data: new Name("data"), // data passed to validation function + // args passed from referencing schema + valCxt: new Name("valCxt"), // validation/data context - should not be used directly, it is destructured to the names below + instancePath: new Name("instancePath"), + parentData: new Name("parentData"), + parentDataProperty: new Name("parentDataProperty"), + rootData: new Name("rootData"), // root data - same as the data passed to the first/top validation function + dynamicAnchors: new Name("dynamicAnchors"), // used to support recursiveRef and dynamicRef + // function scoped variables + vErrors: new Name("vErrors"), // null or array of validation errors + errors: new Name("errors"), // counter of validation errors + this: new Name("this"), + // "globals" + self: new Name("self"), + scope: new Name("scope"), + // JTD serialize/parse name for JSON string and position + json: new Name("json"), + jsonPos: new Name("jsonPos"), + jsonLen: new Name("jsonLen"), + jsonPart: new Name("jsonPart"), +} + +export default names diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/ref_error.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/ref_error.ts new file mode 100644 index 000000000..386bf0499 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/ref_error.ts @@ -0,0 +1,13 @@ +import {resolveUrl, normalizeId, getFullPath} from "./resolve" +import type {UriResolver} from "../types" + +export default class MissingRefError extends Error { + readonly missingRef: string + readonly missingSchema: string + + constructor(resolver: UriResolver, baseId: string, ref: string, msg?: string) { + super(msg || `can't resolve reference ${ref} from id ${baseId}`) + this.missingRef = resolveUrl(resolver, baseId, ref) + this.missingSchema = normalizeId(getFullPath(resolver, this.missingRef)) + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/resolve.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/resolve.ts new file mode 100644 index 000000000..4360eab06 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/resolve.ts @@ -0,0 +1,149 @@ +import type {AnySchema, AnySchemaObject, UriResolver} from "../types" +import type Ajv from "../ajv" +import type {URIComponents} from "uri-js" +import {eachItem} from "./util" +import * as equal from "fast-deep-equal" +import * as traverse from "json-schema-traverse" + +// the hash of local references inside the schema (created by getSchemaRefs), used for inline resolution +export type LocalRefs = {[Ref in string]?: AnySchemaObject} + +// TODO refactor to use keyword definitions +const SIMPLE_INLINED = new Set([ + "type", + "format", + "pattern", + "maxLength", + "minLength", + "maxProperties", + "minProperties", + "maxItems", + "minItems", + "maximum", + "minimum", + "uniqueItems", + "multipleOf", + "required", + "enum", + "const", +]) + +export function inlineRef(schema: AnySchema, limit: boolean | number = true): boolean { + if (typeof schema == "boolean") return true + if (limit === true) return !hasRef(schema) + if (!limit) return false + return countKeys(schema) <= limit +} + +const REF_KEYWORDS = new Set([ + "$ref", + "$recursiveRef", + "$recursiveAnchor", + "$dynamicRef", + "$dynamicAnchor", +]) + +function hasRef(schema: AnySchemaObject): boolean { + for (const key in schema) { + if (REF_KEYWORDS.has(key)) return true + const sch = schema[key] + if (Array.isArray(sch) && sch.some(hasRef)) return true + if (typeof sch == "object" && hasRef(sch)) return true + } + return false +} + +function countKeys(schema: AnySchemaObject): number { + let count = 0 + for (const key in schema) { + if (key === "$ref") return Infinity + count++ + if (SIMPLE_INLINED.has(key)) continue + if (typeof schema[key] == "object") { + eachItem(schema[key], (sch) => (count += countKeys(sch))) + } + if (count === Infinity) return Infinity + } + return count +} + +export function getFullPath(resolver: UriResolver, id = "", normalize?: boolean): string { + if (normalize !== false) id = normalizeId(id) + const p = resolver.parse(id) + return _getFullPath(resolver, p) +} + +export function _getFullPath(resolver: UriResolver, p: URIComponents): string { + const serialized = resolver.serialize(p) + return serialized.split("#")[0] + "#" +} + +const TRAILING_SLASH_HASH = /#\/?$/ +export function normalizeId(id: string | undefined): string { + return id ? id.replace(TRAILING_SLASH_HASH, "") : "" +} + +export function resolveUrl(resolver: UriResolver, baseId: string, id: string): string { + id = normalizeId(id) + return resolver.resolve(baseId, id) +} + +const ANCHOR = /^[a-z_][-a-z0-9._]*$/i + +export function getSchemaRefs(this: Ajv, schema: AnySchema, baseId: string): LocalRefs { + if (typeof schema == "boolean") return {} + const {schemaId, uriResolver} = this.opts + const schId = normalizeId(schema[schemaId] || baseId) + const baseIds: {[JsonPtr in string]?: string} = {"": schId} + const pathPrefix = getFullPath(uriResolver, schId, false) + const localRefs: LocalRefs = {} + const schemaRefs: Set = new Set() + + traverse(schema, {allKeys: true}, (sch, jsonPtr, _, parentJsonPtr) => { + if (parentJsonPtr === undefined) return + const fullPath = pathPrefix + jsonPtr + let baseId = baseIds[parentJsonPtr] + if (typeof sch[schemaId] == "string") baseId = addRef.call(this, sch[schemaId]) + addAnchor.call(this, sch.$anchor) + addAnchor.call(this, sch.$dynamicAnchor) + baseIds[jsonPtr] = baseId + + function addRef(this: Ajv, ref: string): string { + // eslint-disable-next-line @typescript-eslint/unbound-method + const _resolve = this.opts.uriResolver.resolve + ref = normalizeId(baseId ? _resolve(baseId, ref) : ref) + if (schemaRefs.has(ref)) throw ambiguos(ref) + schemaRefs.add(ref) + let schOrRef = this.refs[ref] + if (typeof schOrRef == "string") schOrRef = this.refs[schOrRef] + if (typeof schOrRef == "object") { + checkAmbiguosRef(sch, schOrRef.schema, ref) + } else if (ref !== normalizeId(fullPath)) { + if (ref[0] === "#") { + checkAmbiguosRef(sch, localRefs[ref], ref) + localRefs[ref] = sch + } else { + this.refs[ref] = fullPath + } + } + return ref + } + + function addAnchor(this: Ajv, anchor: unknown): void { + if (typeof anchor == "string") { + if (!ANCHOR.test(anchor)) throw new Error(`invalid anchor "${anchor}"`) + addRef.call(this, `#${anchor}`) + } + } + }) + + return localRefs + + function checkAmbiguosRef(sch1: AnySchema, sch2: AnySchema | undefined, ref: string): void { + if (sch2 !== undefined && !equal(sch1, sch2)) throw ambiguos(ref) + } + + function ambiguos(ref: string): Error { + return new Error(`reference "${ref}" resolves to more than one schema`) + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/rules.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/rules.ts new file mode 100644 index 000000000..ea65074f9 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/rules.ts @@ -0,0 +1,50 @@ +import type {AddedKeywordDefinition} from "../types" + +const _jsonTypes = ["string", "number", "integer", "boolean", "null", "object", "array"] as const + +export type JSONType = typeof _jsonTypes[number] + +const jsonTypes: Set = new Set(_jsonTypes) + +export function isJSONType(x: unknown): x is JSONType { + return typeof x == "string" && jsonTypes.has(x) +} + +type ValidationTypes = { + [K in JSONType]: boolean | RuleGroup | undefined +} + +export interface ValidationRules { + rules: RuleGroup[] + post: RuleGroup + all: {[Key in string]?: boolean | Rule} // rules that have to be validated + keywords: {[Key in string]?: boolean} // all known keywords (superset of "all") + types: ValidationTypes +} + +export interface RuleGroup { + type?: JSONType + rules: Rule[] +} + +// This interface wraps KeywordDefinition because definition can have multiple keywords +export interface Rule { + keyword: string + definition: AddedKeywordDefinition +} + +export function getRules(): ValidationRules { + const groups: Record<"number" | "string" | "array" | "object", RuleGroup> = { + number: {type: "number", rules: []}, + string: {type: "string", rules: []}, + array: {type: "array", rules: []}, + object: {type: "object", rules: []}, + } + return { + types: {...groups, integer: true, boolean: true, null: true}, + rules: [{rules: []}, groups.number, groups.string, groups.array, groups.object], + post: {rules: []}, + all: {}, + keywords: {}, + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/util.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/util.ts new file mode 100644 index 000000000..cefae51c2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/util.ts @@ -0,0 +1,213 @@ +import type {AnySchema, EvaluatedProperties, EvaluatedItems} from "../types" +import type {SchemaCxt, SchemaObjCxt} from "." +import {_, getProperty, Code, Name, CodeGen} from "./codegen" +import {_Code} from "./codegen/code" +import type {Rule, ValidationRules} from "./rules" + +// TODO refactor to use Set +export function toHash(arr: T[]): {[K in T]?: true} { + const hash: {[K in T]?: true} = {} + for (const item of arr) hash[item] = true + return hash +} + +export function alwaysValidSchema(it: SchemaCxt, schema: AnySchema): boolean | void { + if (typeof schema == "boolean") return schema + if (Object.keys(schema).length === 0) return true + checkUnknownRules(it, schema) + return !schemaHasRules(schema, it.self.RULES.all) +} + +export function checkUnknownRules(it: SchemaCxt, schema: AnySchema = it.schema): void { + const {opts, self} = it + if (!opts.strictSchema) return + if (typeof schema === "boolean") return + const rules = self.RULES.keywords + for (const key in schema) { + if (!rules[key]) checkStrictMode(it, `unknown keyword: "${key}"`) + } +} + +export function schemaHasRules( + schema: AnySchema, + rules: {[Key in string]?: boolean | Rule} +): boolean { + if (typeof schema == "boolean") return !schema + for (const key in schema) if (rules[key]) return true + return false +} + +export function schemaHasRulesButRef(schema: AnySchema, RULES: ValidationRules): boolean { + if (typeof schema == "boolean") return !schema + for (const key in schema) if (key !== "$ref" && RULES.all[key]) return true + return false +} + +export function schemaRefOrVal( + {topSchemaRef, schemaPath}: SchemaObjCxt, + schema: unknown, + keyword: string, + $data?: string | false +): Code | number | boolean { + if (!$data) { + if (typeof schema == "number" || typeof schema == "boolean") return schema + if (typeof schema == "string") return _`${schema}` + } + return _`${topSchemaRef}${schemaPath}${getProperty(keyword)}` +} + +export function unescapeFragment(str: string): string { + return unescapeJsonPointer(decodeURIComponent(str)) +} + +export function escapeFragment(str: string | number): string { + return encodeURIComponent(escapeJsonPointer(str)) +} + +export function escapeJsonPointer(str: string | number): string { + if (typeof str == "number") return `${str}` + return str.replace(/~/g, "~0").replace(/\//g, "~1") +} + +export function unescapeJsonPointer(str: string): string { + return str.replace(/~1/g, "/").replace(/~0/g, "~") +} + +export function eachItem(xs: T | T[], f: (x: T) => void): void { + if (Array.isArray(xs)) { + for (const x of xs) f(x) + } else { + f(xs) + } +} + +type SomeEvaluated = EvaluatedProperties | EvaluatedItems + +type MergeEvaluatedFunc = ( + gen: CodeGen, + from: Name | T, + to: Name | Exclude | undefined, + toName?: typeof Name +) => Name | T + +interface MakeMergeFuncArgs { + mergeNames: (gen: CodeGen, from: Name, to: Name) => void + mergeToName: (gen: CodeGen, from: T, to: Name) => void + mergeValues: (from: T, to: Exclude) => T + resultToName: (gen: CodeGen, res?: T) => Name +} + +function makeMergeEvaluated({ + mergeNames, + mergeToName, + mergeValues, + resultToName, +}: MakeMergeFuncArgs): MergeEvaluatedFunc { + return (gen, from, to, toName) => { + const res = + to === undefined + ? from + : to instanceof Name + ? (from instanceof Name ? mergeNames(gen, from, to) : mergeToName(gen, from, to), to) + : from instanceof Name + ? (mergeToName(gen, to, from), from) + : mergeValues(from, to) + return toName === Name && !(res instanceof Name) ? resultToName(gen, res) : res + } +} + +interface MergeEvaluated { + props: MergeEvaluatedFunc + items: MergeEvaluatedFunc +} + +export const mergeEvaluated: MergeEvaluated = { + props: makeMergeEvaluated({ + mergeNames: (gen, from, to) => + gen.if(_`${to} !== true && ${from} !== undefined`, () => { + gen.if( + _`${from} === true`, + () => gen.assign(to, true), + () => gen.assign(to, _`${to} || {}`).code(_`Object.assign(${to}, ${from})`) + ) + }), + mergeToName: (gen, from, to) => + gen.if(_`${to} !== true`, () => { + if (from === true) { + gen.assign(to, true) + } else { + gen.assign(to, _`${to} || {}`) + setEvaluated(gen, to, from) + } + }), + mergeValues: (from, to) => (from === true ? true : {...from, ...to}), + resultToName: evaluatedPropsToName, + }), + items: makeMergeEvaluated({ + mergeNames: (gen, from, to) => + gen.if(_`${to} !== true && ${from} !== undefined`, () => + gen.assign(to, _`${from} === true ? true : ${to} > ${from} ? ${to} : ${from}`) + ), + mergeToName: (gen, from, to) => + gen.if(_`${to} !== true`, () => + gen.assign(to, from === true ? true : _`${to} > ${from} ? ${to} : ${from}`) + ), + mergeValues: (from, to) => (from === true ? true : Math.max(from, to)), + resultToName: (gen, items) => gen.var("items", items), + }), +} + +export function evaluatedPropsToName(gen: CodeGen, ps?: EvaluatedProperties): Name { + if (ps === true) return gen.var("props", true) + const props = gen.var("props", _`{}`) + if (ps !== undefined) setEvaluated(gen, props, ps) + return props +} + +export function setEvaluated(gen: CodeGen, props: Name, ps: {[K in string]?: true}): void { + Object.keys(ps).forEach((p) => gen.assign(_`${props}${getProperty(p)}`, true)) +} + +const snippets: {[S in string]?: _Code} = {} + +export function useFunc(gen: CodeGen, f: {code: string}): Name { + return gen.scopeValue("func", { + ref: f, + code: snippets[f.code] || (snippets[f.code] = new _Code(f.code)), + }) +} + +export enum Type { + Num, + Str, +} + +export function getErrorPath( + dataProp: Name | string | number, + dataPropType?: Type, + jsPropertySyntax?: boolean +): Code | string { + // let path + if (dataProp instanceof Name) { + const isNumber = dataPropType === Type.Num + return jsPropertySyntax + ? isNumber + ? _`"[" + ${dataProp} + "]"` + : _`"['" + ${dataProp} + "']"` + : isNumber + ? _`"/" + ${dataProp}` + : _`"/" + ${dataProp}.replace(/~/g, "~0").replace(/\\//g, "~1")` // TODO maybe use global escapePointer + } + return jsPropertySyntax ? getProperty(dataProp).toString() : "/" + escapeJsonPointer(dataProp) +} + +export function checkStrictMode( + it: SchemaCxt, + msg: string, + mode: boolean | "log" = it.opts.strictSchema +): void { + if (!mode) return + msg = `strict mode: ${msg}` + if (mode === true) throw new Error(msg) + it.self.logger.warn(msg) +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/applicability.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/applicability.ts new file mode 100644 index 000000000..478b704ac --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/applicability.ts @@ -0,0 +1,22 @@ +import type {AnySchemaObject} from "../../types" +import type {SchemaObjCxt} from ".." +import type {JSONType, RuleGroup, Rule} from "../rules" + +export function schemaHasRulesForType( + {schema, self}: SchemaObjCxt, + type: JSONType +): boolean | undefined { + const group = self.RULES.types[type] + return group && group !== true && shouldUseGroup(schema, group) +} + +export function shouldUseGroup(schema: AnySchemaObject, group: RuleGroup): boolean { + return group.rules.some((rule) => shouldUseRule(schema, rule)) +} + +export function shouldUseRule(schema: AnySchemaObject, rule: Rule): boolean | undefined { + return ( + schema[rule.keyword] !== undefined || + rule.definition.implements?.some((kwd) => schema[kwd] !== undefined) + ) +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/boolSchema.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/boolSchema.ts new file mode 100644 index 000000000..156355016 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/boolSchema.ts @@ -0,0 +1,47 @@ +import type {KeywordErrorDefinition, KeywordErrorCxt} from "../../types" +import type {SchemaCxt} from ".." +import {reportError} from "../errors" +import {_, Name} from "../codegen" +import N from "../names" + +const boolError: KeywordErrorDefinition = { + message: "boolean schema is false", +} + +export function topBoolOrEmptySchema(it: SchemaCxt): void { + const {gen, schema, validateName} = it + if (schema === false) { + falseSchemaError(it, false) + } else if (typeof schema == "object" && schema.$async === true) { + gen.return(N.data) + } else { + gen.assign(_`${validateName}.errors`, null) + gen.return(true) + } +} + +export function boolOrEmptySchema(it: SchemaCxt, valid: Name): void { + const {gen, schema} = it + if (schema === false) { + gen.var(valid, false) // TODO var + falseSchemaError(it) + } else { + gen.var(valid, true) // TODO var + } +} + +function falseSchemaError(it: SchemaCxt, overrideAllErrors?: boolean): void { + const {gen, data} = it + // TODO maybe some other interface should be used for non-keyword validation errors... + const cxt: KeywordErrorCxt = { + gen, + keyword: "false schema", + data, + schema: false, + schemaCode: false, + schemaValue: false, + params: {}, + it, + } + reportError(cxt, boolError, undefined, overrideAllErrors) +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/dataType.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/dataType.ts new file mode 100644 index 000000000..b315c2ce9 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/dataType.ts @@ -0,0 +1,229 @@ +import type { + KeywordErrorDefinition, + KeywordErrorCxt, + ErrorObject, + AnySchemaObject, +} from "../../types" +import type {SchemaObjCxt} from ".." +import {isJSONType, JSONType} from "../rules" +import {schemaHasRulesForType} from "./applicability" +import {reportError} from "../errors" +import {_, nil, and, not, operators, Code, Name} from "../codegen" +import {toHash, schemaRefOrVal} from "../util" + +export enum DataType { + Correct, + Wrong, +} + +export function getSchemaTypes(schema: AnySchemaObject): JSONType[] { + const types = getJSONTypes(schema.type) + const hasNull = types.includes("null") + if (hasNull) { + if (schema.nullable === false) throw new Error("type: null contradicts nullable: false") + } else { + if (!types.length && schema.nullable !== undefined) { + throw new Error('"nullable" cannot be used without "type"') + } + if (schema.nullable === true) types.push("null") + } + return types +} + +export function getJSONTypes(ts: unknown | unknown[]): JSONType[] { + const types: unknown[] = Array.isArray(ts) ? ts : ts ? [ts] : [] + if (types.every(isJSONType)) return types + throw new Error("type must be JSONType or JSONType[]: " + types.join(",")) +} + +export function coerceAndCheckDataType(it: SchemaObjCxt, types: JSONType[]): boolean { + const {gen, data, opts} = it + const coerceTo = coerceToTypes(types, opts.coerceTypes) + const checkTypes = + types.length > 0 && + !(coerceTo.length === 0 && types.length === 1 && schemaHasRulesForType(it, types[0])) + if (checkTypes) { + const wrongType = checkDataTypes(types, data, opts.strictNumbers, DataType.Wrong) + gen.if(wrongType, () => { + if (coerceTo.length) coerceData(it, types, coerceTo) + else reportTypeError(it) + }) + } + return checkTypes +} + +const COERCIBLE: Set = new Set(["string", "number", "integer", "boolean", "null"]) +function coerceToTypes(types: JSONType[], coerceTypes?: boolean | "array"): JSONType[] { + return coerceTypes + ? types.filter((t) => COERCIBLE.has(t) || (coerceTypes === "array" && t === "array")) + : [] +} + +function coerceData(it: SchemaObjCxt, types: JSONType[], coerceTo: JSONType[]): void { + const {gen, data, opts} = it + const dataType = gen.let("dataType", _`typeof ${data}`) + const coerced = gen.let("coerced", _`undefined`) + if (opts.coerceTypes === "array") { + gen.if(_`${dataType} == 'object' && Array.isArray(${data}) && ${data}.length == 1`, () => + gen + .assign(data, _`${data}[0]`) + .assign(dataType, _`typeof ${data}`) + .if(checkDataTypes(types, data, opts.strictNumbers), () => gen.assign(coerced, data)) + ) + } + gen.if(_`${coerced} !== undefined`) + for (const t of coerceTo) { + if (COERCIBLE.has(t) || (t === "array" && opts.coerceTypes === "array")) { + coerceSpecificType(t) + } + } + gen.else() + reportTypeError(it) + gen.endIf() + + gen.if(_`${coerced} !== undefined`, () => { + gen.assign(data, coerced) + assignParentData(it, coerced) + }) + + function coerceSpecificType(t: string): void { + switch (t) { + case "string": + gen + .elseIf(_`${dataType} == "number" || ${dataType} == "boolean"`) + .assign(coerced, _`"" + ${data}`) + .elseIf(_`${data} === null`) + .assign(coerced, _`""`) + return + case "number": + gen + .elseIf( + _`${dataType} == "boolean" || ${data} === null + || (${dataType} == "string" && ${data} && ${data} == +${data})` + ) + .assign(coerced, _`+${data}`) + return + case "integer": + gen + .elseIf( + _`${dataType} === "boolean" || ${data} === null + || (${dataType} === "string" && ${data} && ${data} == +${data} && !(${data} % 1))` + ) + .assign(coerced, _`+${data}`) + return + case "boolean": + gen + .elseIf(_`${data} === "false" || ${data} === 0 || ${data} === null`) + .assign(coerced, false) + .elseIf(_`${data} === "true" || ${data} === 1`) + .assign(coerced, true) + return + case "null": + gen.elseIf(_`${data} === "" || ${data} === 0 || ${data} === false`) + gen.assign(coerced, null) + return + + case "array": + gen + .elseIf( + _`${dataType} === "string" || ${dataType} === "number" + || ${dataType} === "boolean" || ${data} === null` + ) + .assign(coerced, _`[${data}]`) + } + } +} + +function assignParentData({gen, parentData, parentDataProperty}: SchemaObjCxt, expr: Name): void { + // TODO use gen.property + gen.if(_`${parentData} !== undefined`, () => + gen.assign(_`${parentData}[${parentDataProperty}]`, expr) + ) +} + +export function checkDataType( + dataType: JSONType, + data: Name, + strictNums?: boolean | "log", + correct = DataType.Correct +): Code { + const EQ = correct === DataType.Correct ? operators.EQ : operators.NEQ + let cond: Code + switch (dataType) { + case "null": + return _`${data} ${EQ} null` + case "array": + cond = _`Array.isArray(${data})` + break + case "object": + cond = _`${data} && typeof ${data} == "object" && !Array.isArray(${data})` + break + case "integer": + cond = numCond(_`!(${data} % 1) && !isNaN(${data})`) + break + case "number": + cond = numCond() + break + default: + return _`typeof ${data} ${EQ} ${dataType}` + } + return correct === DataType.Correct ? cond : not(cond) + + function numCond(_cond: Code = nil): Code { + return and(_`typeof ${data} == "number"`, _cond, strictNums ? _`isFinite(${data})` : nil) + } +} + +export function checkDataTypes( + dataTypes: JSONType[], + data: Name, + strictNums?: boolean | "log", + correct?: DataType +): Code { + if (dataTypes.length === 1) { + return checkDataType(dataTypes[0], data, strictNums, correct) + } + let cond: Code + const types = toHash(dataTypes) + if (types.array && types.object) { + const notObj = _`typeof ${data} != "object"` + cond = types.null ? notObj : _`!${data} || ${notObj}` + delete types.null + delete types.array + delete types.object + } else { + cond = nil + } + if (types.number) delete types.integer + for (const t in types) cond = and(cond, checkDataType(t as JSONType, data, strictNums, correct)) + return cond +} + +export type TypeError = ErrorObject<"type", {type: string}> + +const typeError: KeywordErrorDefinition = { + message: ({schema}) => `must be ${schema}`, + params: ({schema, schemaValue}) => + typeof schema == "string" ? _`{type: ${schema}}` : _`{type: ${schemaValue}}`, +} + +export function reportTypeError(it: SchemaObjCxt): void { + const cxt = getTypeErrorContext(it) + reportError(cxt, typeError) +} + +function getTypeErrorContext(it: SchemaObjCxt): KeywordErrorCxt { + const {gen, data, schema} = it + const schemaCode = schemaRefOrVal(it, schema, "type") + return { + gen, + keyword: "type", + data, + schema: schema.type, + schemaCode, + schemaValue: schemaCode, + parentSchema: schema, + params: {}, + it, + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/defaults.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/defaults.ts new file mode 100644 index 000000000..2ad3d4df8 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/defaults.ts @@ -0,0 +1,32 @@ +import type {SchemaObjCxt} from ".." +import {_, getProperty, stringify} from "../codegen" +import {checkStrictMode} from "../util" + +export function assignDefaults(it: SchemaObjCxt, ty?: string): void { + const {properties, items} = it.schema + if (ty === "object" && properties) { + for (const key in properties) { + assignDefault(it, key, properties[key].default) + } + } else if (ty === "array" && Array.isArray(items)) { + items.forEach((sch, i: number) => assignDefault(it, i, sch.default)) + } +} + +function assignDefault(it: SchemaObjCxt, prop: string | number, defaultValue: unknown): void { + const {gen, compositeRule, data, opts} = it + if (defaultValue === undefined) return + const childData = _`${data}${getProperty(prop)}` + if (compositeRule) { + checkStrictMode(it, `default is ignored for: ${childData}`) + return + } + + let condition = _`${childData} === undefined` + if (opts.useDefaults === "empty") { + condition = _`${condition} || ${childData} === null || ${childData} === ""` + } + // `${childData} === undefined` + + // (opts.useDefaults === "empty" ? ` || ${childData} === null || ${childData} === ""` : "") + gen.if(condition, _`${childData} = ${stringify(defaultValue)}`) +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/index.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/index.ts new file mode 100644 index 000000000..f5910c3a3 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/index.ts @@ -0,0 +1,573 @@ +import type { + AddedKeywordDefinition, + AnySchema, + AnySchemaObject, + KeywordErrorCxt, + KeywordCxtParams, +} from "../../types" +import type {SchemaCxt, SchemaObjCxt} from ".." +import type {InstanceOptions} from "../../core" +import {boolOrEmptySchema, topBoolOrEmptySchema} from "./boolSchema" +import {coerceAndCheckDataType, getSchemaTypes} from "./dataType" +import {shouldUseGroup, shouldUseRule} from "./applicability" +import {checkDataType, checkDataTypes, reportTypeError, DataType} from "./dataType" +import {assignDefaults} from "./defaults" +import {funcKeywordCode, macroKeywordCode, validateKeywordUsage, validSchemaType} from "./keyword" +import {getSubschema, extendSubschemaData, SubschemaArgs, extendSubschemaMode} from "./subschema" +import {_, nil, str, or, not, getProperty, Block, Code, Name, CodeGen} from "../codegen" +import N from "../names" +import {resolveUrl} from "../resolve" +import { + schemaRefOrVal, + schemaHasRulesButRef, + checkUnknownRules, + checkStrictMode, + unescapeJsonPointer, + mergeEvaluated, +} from "../util" +import type {JSONType, Rule, RuleGroup} from "../rules" +import { + ErrorPaths, + reportError, + reportExtraError, + resetErrorsCount, + keyword$DataError, +} from "../errors" + +// schema compilation - generates validation function, subschemaCode (below) is used for subschemas +export function validateFunctionCode(it: SchemaCxt): void { + if (isSchemaObj(it)) { + checkKeywords(it) + if (schemaCxtHasRules(it)) { + topSchemaObjCode(it) + return + } + } + validateFunction(it, () => topBoolOrEmptySchema(it)) +} + +function validateFunction( + {gen, validateName, schema, schemaEnv, opts}: SchemaCxt, + body: Block +): void { + if (opts.code.es5) { + gen.func(validateName, _`${N.data}, ${N.valCxt}`, schemaEnv.$async, () => { + gen.code(_`"use strict"; ${funcSourceUrl(schema, opts)}`) + destructureValCxtES5(gen, opts) + gen.code(body) + }) + } else { + gen.func(validateName, _`${N.data}, ${destructureValCxt(opts)}`, schemaEnv.$async, () => + gen.code(funcSourceUrl(schema, opts)).code(body) + ) + } +} + +function destructureValCxt(opts: InstanceOptions): Code { + return _`{${N.instancePath}="", ${N.parentData}, ${N.parentDataProperty}, ${N.rootData}=${ + N.data + }${opts.dynamicRef ? _`, ${N.dynamicAnchors}={}` : nil}}={}` +} + +function destructureValCxtES5(gen: CodeGen, opts: InstanceOptions): void { + gen.if( + N.valCxt, + () => { + gen.var(N.instancePath, _`${N.valCxt}.${N.instancePath}`) + gen.var(N.parentData, _`${N.valCxt}.${N.parentData}`) + gen.var(N.parentDataProperty, _`${N.valCxt}.${N.parentDataProperty}`) + gen.var(N.rootData, _`${N.valCxt}.${N.rootData}`) + if (opts.dynamicRef) gen.var(N.dynamicAnchors, _`${N.valCxt}.${N.dynamicAnchors}`) + }, + () => { + gen.var(N.instancePath, _`""`) + gen.var(N.parentData, _`undefined`) + gen.var(N.parentDataProperty, _`undefined`) + gen.var(N.rootData, N.data) + if (opts.dynamicRef) gen.var(N.dynamicAnchors, _`{}`) + } + ) +} + +function topSchemaObjCode(it: SchemaObjCxt): void { + const {schema, opts, gen} = it + validateFunction(it, () => { + if (opts.$comment && schema.$comment) commentKeyword(it) + checkNoDefault(it) + gen.let(N.vErrors, null) + gen.let(N.errors, 0) + if (opts.unevaluated) resetEvaluated(it) + typeAndKeywords(it) + returnResults(it) + }) + return +} + +function resetEvaluated(it: SchemaObjCxt): void { + // TODO maybe some hook to execute it in the end to check whether props/items are Name, as in assignEvaluated + const {gen, validateName} = it + it.evaluated = gen.const("evaluated", _`${validateName}.evaluated`) + gen.if(_`${it.evaluated}.dynamicProps`, () => gen.assign(_`${it.evaluated}.props`, _`undefined`)) + gen.if(_`${it.evaluated}.dynamicItems`, () => gen.assign(_`${it.evaluated}.items`, _`undefined`)) +} + +function funcSourceUrl(schema: AnySchema, opts: InstanceOptions): Code { + const schId = typeof schema == "object" && schema[opts.schemaId] + return schId && (opts.code.source || opts.code.process) ? _`/*# sourceURL=${schId} */` : nil +} + +// schema compilation - this function is used recursively to generate code for sub-schemas +function subschemaCode(it: SchemaCxt, valid: Name): void { + if (isSchemaObj(it)) { + checkKeywords(it) + if (schemaCxtHasRules(it)) { + subSchemaObjCode(it, valid) + return + } + } + boolOrEmptySchema(it, valid) +} + +function schemaCxtHasRules({schema, self}: SchemaCxt): boolean { + if (typeof schema == "boolean") return !schema + for (const key in schema) if (self.RULES.all[key]) return true + return false +} + +function isSchemaObj(it: SchemaCxt): it is SchemaObjCxt { + return typeof it.schema != "boolean" +} + +function subSchemaObjCode(it: SchemaObjCxt, valid: Name): void { + const {schema, gen, opts} = it + if (opts.$comment && schema.$comment) commentKeyword(it) + updateContext(it) + checkAsyncSchema(it) + const errsCount = gen.const("_errs", N.errors) + typeAndKeywords(it, errsCount) + // TODO var + gen.var(valid, _`${errsCount} === ${N.errors}`) +} + +function checkKeywords(it: SchemaObjCxt): void { + checkUnknownRules(it) + checkRefsAndKeywords(it) +} + +function typeAndKeywords(it: SchemaObjCxt, errsCount?: Name): void { + if (it.opts.jtd) return schemaKeywords(it, [], false, errsCount) + const types = getSchemaTypes(it.schema) + const checkedTypes = coerceAndCheckDataType(it, types) + schemaKeywords(it, types, !checkedTypes, errsCount) +} + +function checkRefsAndKeywords(it: SchemaObjCxt): void { + const {schema, errSchemaPath, opts, self} = it + if (schema.$ref && opts.ignoreKeywordsWithRef && schemaHasRulesButRef(schema, self.RULES)) { + self.logger.warn(`$ref: keywords ignored in schema at path "${errSchemaPath}"`) + } +} + +function checkNoDefault(it: SchemaObjCxt): void { + const {schema, opts} = it + if (schema.default !== undefined && opts.useDefaults && opts.strictSchema) { + checkStrictMode(it, "default is ignored in the schema root") + } +} + +function updateContext(it: SchemaObjCxt): void { + const schId = it.schema[it.opts.schemaId] + if (schId) it.baseId = resolveUrl(it.opts.uriResolver, it.baseId, schId) +} + +function checkAsyncSchema(it: SchemaObjCxt): void { + if (it.schema.$async && !it.schemaEnv.$async) throw new Error("async schema in sync schema") +} + +function commentKeyword({gen, schemaEnv, schema, errSchemaPath, opts}: SchemaObjCxt): void { + const msg = schema.$comment + if (opts.$comment === true) { + gen.code(_`${N.self}.logger.log(${msg})`) + } else if (typeof opts.$comment == "function") { + const schemaPath = str`${errSchemaPath}/$comment` + const rootName = gen.scopeValue("root", {ref: schemaEnv.root}) + gen.code(_`${N.self}.opts.$comment(${msg}, ${schemaPath}, ${rootName}.schema)`) + } +} + +function returnResults(it: SchemaCxt): void { + const {gen, schemaEnv, validateName, ValidationError, opts} = it + if (schemaEnv.$async) { + // TODO assign unevaluated + gen.if( + _`${N.errors} === 0`, + () => gen.return(N.data), + () => gen.throw(_`new ${ValidationError as Name}(${N.vErrors})`) + ) + } else { + gen.assign(_`${validateName}.errors`, N.vErrors) + if (opts.unevaluated) assignEvaluated(it) + gen.return(_`${N.errors} === 0`) + } +} + +function assignEvaluated({gen, evaluated, props, items}: SchemaCxt): void { + if (props instanceof Name) gen.assign(_`${evaluated}.props`, props) + if (items instanceof Name) gen.assign(_`${evaluated}.items`, items) +} + +function schemaKeywords( + it: SchemaObjCxt, + types: JSONType[], + typeErrors: boolean, + errsCount?: Name +): void { + const {gen, schema, data, allErrors, opts, self} = it + const {RULES} = self + if (schema.$ref && (opts.ignoreKeywordsWithRef || !schemaHasRulesButRef(schema, RULES))) { + gen.block(() => keywordCode(it, "$ref", (RULES.all.$ref as Rule).definition)) // TODO typecast + return + } + if (!opts.jtd) checkStrictTypes(it, types) + gen.block(() => { + for (const group of RULES.rules) groupKeywords(group) + groupKeywords(RULES.post) + }) + + function groupKeywords(group: RuleGroup): void { + if (!shouldUseGroup(schema, group)) return + if (group.type) { + gen.if(checkDataType(group.type, data, opts.strictNumbers)) + iterateKeywords(it, group) + if (types.length === 1 && types[0] === group.type && typeErrors) { + gen.else() + reportTypeError(it) + } + gen.endIf() + } else { + iterateKeywords(it, group) + } + // TODO make it "ok" call? + if (!allErrors) gen.if(_`${N.errors} === ${errsCount || 0}`) + } +} + +function iterateKeywords(it: SchemaObjCxt, group: RuleGroup): void { + const { + gen, + schema, + opts: {useDefaults}, + } = it + if (useDefaults) assignDefaults(it, group.type) + gen.block(() => { + for (const rule of group.rules) { + if (shouldUseRule(schema, rule)) { + keywordCode(it, rule.keyword, rule.definition, group.type) + } + } + }) +} + +function checkStrictTypes(it: SchemaObjCxt, types: JSONType[]): void { + if (it.schemaEnv.meta || !it.opts.strictTypes) return + checkContextTypes(it, types) + if (!it.opts.allowUnionTypes) checkMultipleTypes(it, types) + checkKeywordTypes(it, it.dataTypes) +} + +function checkContextTypes(it: SchemaObjCxt, types: JSONType[]): void { + if (!types.length) return + if (!it.dataTypes.length) { + it.dataTypes = types + return + } + types.forEach((t) => { + if (!includesType(it.dataTypes, t)) { + strictTypesError(it, `type "${t}" not allowed by context "${it.dataTypes.join(",")}"`) + } + }) + it.dataTypes = it.dataTypes.filter((t) => includesType(types, t)) +} + +function checkMultipleTypes(it: SchemaObjCxt, ts: JSONType[]): void { + if (ts.length > 1 && !(ts.length === 2 && ts.includes("null"))) { + strictTypesError(it, "use allowUnionTypes to allow union type keyword") + } +} + +function checkKeywordTypes(it: SchemaObjCxt, ts: JSONType[]): void { + const rules = it.self.RULES.all + for (const keyword in rules) { + const rule = rules[keyword] + if (typeof rule == "object" && shouldUseRule(it.schema, rule)) { + const {type} = rule.definition + if (type.length && !type.some((t) => hasApplicableType(ts, t))) { + strictTypesError(it, `missing type "${type.join(",")}" for keyword "${keyword}"`) + } + } + } +} + +function hasApplicableType(schTs: JSONType[], kwdT: JSONType): boolean { + return schTs.includes(kwdT) || (kwdT === "number" && schTs.includes("integer")) +} + +function includesType(ts: JSONType[], t: JSONType): boolean { + return ts.includes(t) || (t === "integer" && ts.includes("number")) +} + +function strictTypesError(it: SchemaObjCxt, msg: string): void { + const schemaPath = it.schemaEnv.baseId + it.errSchemaPath + msg += ` at "${schemaPath}" (strictTypes)` + checkStrictMode(it, msg, it.opts.strictTypes) +} + +export class KeywordCxt implements KeywordErrorCxt { + readonly gen: CodeGen + readonly allErrors?: boolean + readonly keyword: string + readonly data: Name // Name referencing the current level of the data instance + readonly $data?: string | false + schema: any // keyword value in the schema + readonly schemaValue: Code | number | boolean // Code reference to keyword schema value or primitive value + readonly schemaCode: Code | number | boolean // Code reference to resolved schema value (different if schema is $data) + readonly schemaType: JSONType[] // allowed type(s) of keyword value in the schema + readonly parentSchema: AnySchemaObject + readonly errsCount?: Name // Name reference to the number of validation errors collected before this keyword, + // requires option trackErrors in keyword definition + params: KeywordCxtParams // object to pass parameters to error messages from keyword code + readonly it: SchemaObjCxt // schema compilation context (schema is guaranteed to be an object, not boolean) + readonly def: AddedKeywordDefinition + + constructor(it: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string) { + validateKeywordUsage(it, def, keyword) + this.gen = it.gen + this.allErrors = it.allErrors + this.keyword = keyword + this.data = it.data + this.schema = it.schema[keyword] + this.$data = def.$data && it.opts.$data && this.schema && this.schema.$data + this.schemaValue = schemaRefOrVal(it, this.schema, keyword, this.$data) + this.schemaType = def.schemaType + this.parentSchema = it.schema + this.params = {} + this.it = it + this.def = def + + if (this.$data) { + this.schemaCode = it.gen.const("vSchema", getData(this.$data, it)) + } else { + this.schemaCode = this.schemaValue + if (!validSchemaType(this.schema, def.schemaType, def.allowUndefined)) { + throw new Error(`${keyword} value must be ${JSON.stringify(def.schemaType)}`) + } + } + + if ("code" in def ? def.trackErrors : def.errors !== false) { + this.errsCount = it.gen.const("_errs", N.errors) + } + } + + result(condition: Code, successAction?: () => void, failAction?: () => void): void { + this.failResult(not(condition), successAction, failAction) + } + + failResult(condition: Code, successAction?: () => void, failAction?: () => void): void { + this.gen.if(condition) + if (failAction) failAction() + else this.error() + if (successAction) { + this.gen.else() + successAction() + if (this.allErrors) this.gen.endIf() + } else { + if (this.allErrors) this.gen.endIf() + else this.gen.else() + } + } + + pass(condition: Code, failAction?: () => void): void { + this.failResult(not(condition), undefined, failAction) + } + + fail(condition?: Code): void { + if (condition === undefined) { + this.error() + if (!this.allErrors) this.gen.if(false) // this branch will be removed by gen.optimize + return + } + this.gen.if(condition) + this.error() + if (this.allErrors) this.gen.endIf() + else this.gen.else() + } + + fail$data(condition: Code): void { + if (!this.$data) return this.fail(condition) + const {schemaCode} = this + this.fail(_`${schemaCode} !== undefined && (${or(this.invalid$data(), condition)})`) + } + + error(append?: boolean, errorParams?: KeywordCxtParams, errorPaths?: ErrorPaths): void { + if (errorParams) { + this.setParams(errorParams) + this._error(append, errorPaths) + this.setParams({}) + return + } + this._error(append, errorPaths) + } + + private _error(append?: boolean, errorPaths?: ErrorPaths): void { + ;(append ? reportExtraError : reportError)(this, this.def.error, errorPaths) + } + + $dataError(): void { + reportError(this, this.def.$dataError || keyword$DataError) + } + + reset(): void { + if (this.errsCount === undefined) throw new Error('add "trackErrors" to keyword definition') + resetErrorsCount(this.gen, this.errsCount) + } + + ok(cond: Code | boolean): void { + if (!this.allErrors) this.gen.if(cond) + } + + setParams(obj: KeywordCxtParams, assign?: true): void { + if (assign) Object.assign(this.params, obj) + else this.params = obj + } + + block$data(valid: Name, codeBlock: () => void, $dataValid: Code = nil): void { + this.gen.block(() => { + this.check$data(valid, $dataValid) + codeBlock() + }) + } + + check$data(valid: Name = nil, $dataValid: Code = nil): void { + if (!this.$data) return + const {gen, schemaCode, schemaType, def} = this + gen.if(or(_`${schemaCode} === undefined`, $dataValid)) + if (valid !== nil) gen.assign(valid, true) + if (schemaType.length || def.validateSchema) { + gen.elseIf(this.invalid$data()) + this.$dataError() + if (valid !== nil) gen.assign(valid, false) + } + gen.else() + } + + invalid$data(): Code { + const {gen, schemaCode, schemaType, def, it} = this + return or(wrong$DataType(), invalid$DataSchema()) + + function wrong$DataType(): Code { + if (schemaType.length) { + /* istanbul ignore if */ + if (!(schemaCode instanceof Name)) throw new Error("ajv implementation error") + const st = Array.isArray(schemaType) ? schemaType : [schemaType] + return _`${checkDataTypes(st, schemaCode, it.opts.strictNumbers, DataType.Wrong)}` + } + return nil + } + + function invalid$DataSchema(): Code { + if (def.validateSchema) { + const validateSchemaRef = gen.scopeValue("validate$data", {ref: def.validateSchema}) // TODO value.code for standalone + return _`!${validateSchemaRef}(${schemaCode})` + } + return nil + } + } + + subschema(appl: SubschemaArgs, valid: Name): SchemaCxt { + const subschema = getSubschema(this.it, appl) + extendSubschemaData(subschema, this.it, appl) + extendSubschemaMode(subschema, appl) + const nextContext = {...this.it, ...subschema, items: undefined, props: undefined} + subschemaCode(nextContext, valid) + return nextContext + } + + mergeEvaluated(schemaCxt: SchemaCxt, toName?: typeof Name): void { + const {it, gen} = this + if (!it.opts.unevaluated) return + if (it.props !== true && schemaCxt.props !== undefined) { + it.props = mergeEvaluated.props(gen, schemaCxt.props, it.props, toName) + } + if (it.items !== true && schemaCxt.items !== undefined) { + it.items = mergeEvaluated.items(gen, schemaCxt.items, it.items, toName) + } + } + + mergeValidEvaluated(schemaCxt: SchemaCxt, valid: Name): boolean | void { + const {it, gen} = this + if (it.opts.unevaluated && (it.props !== true || it.items !== true)) { + gen.if(valid, () => this.mergeEvaluated(schemaCxt, Name)) + return true + } + } +} + +function keywordCode( + it: SchemaObjCxt, + keyword: string, + def: AddedKeywordDefinition, + ruleType?: JSONType +): void { + const cxt = new KeywordCxt(it, def, keyword) + if ("code" in def) { + def.code(cxt, ruleType) + } else if (cxt.$data && def.validate) { + funcKeywordCode(cxt, def) + } else if ("macro" in def) { + macroKeywordCode(cxt, def) + } else if (def.compile || def.validate) { + funcKeywordCode(cxt, def) + } +} + +const JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/ +const RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/ +export function getData( + $data: string, + {dataLevel, dataNames, dataPathArr}: SchemaCxt +): Code | number { + let jsonPointer + let data: Code + if ($data === "") return N.rootData + if ($data[0] === "/") { + if (!JSON_POINTER.test($data)) throw new Error(`Invalid JSON-pointer: ${$data}`) + jsonPointer = $data + data = N.rootData + } else { + const matches = RELATIVE_JSON_POINTER.exec($data) + if (!matches) throw new Error(`Invalid JSON-pointer: ${$data}`) + const up: number = +matches[1] + jsonPointer = matches[2] + if (jsonPointer === "#") { + if (up >= dataLevel) throw new Error(errorMsg("property/index", up)) + return dataPathArr[dataLevel - up] + } + if (up > dataLevel) throw new Error(errorMsg("data", up)) + data = dataNames[dataLevel - up] + if (!jsonPointer) return data + } + + let expr = data + const segments = jsonPointer.split("/") + for (const segment of segments) { + if (segment) { + data = _`${data}${getProperty(unescapeJsonPointer(segment))}` + expr = _`${expr} && ${data}` + } + } + return expr + + function errorMsg(pointerType: string, up: number): string { + return `Cannot access ${pointerType} ${up} levels up, current level is ${dataLevel}` + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/keyword.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/keyword.ts new file mode 100644 index 000000000..f854aa710 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/keyword.ts @@ -0,0 +1,171 @@ +import type {KeywordCxt} from "." +import type { + AnySchema, + SchemaValidateFunction, + AnyValidateFunction, + AddedKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, +} from "../../types" +import type {SchemaObjCxt} from ".." +import {_, nil, not, stringify, Code, Name, CodeGen} from "../codegen" +import N from "../names" +import type {JSONType} from "../rules" +import {callValidateCode} from "../../vocabularies/code" +import {extendErrors} from "../errors" + +type KeywordCompilationResult = AnySchema | SchemaValidateFunction | AnyValidateFunction + +export function macroKeywordCode(cxt: KeywordCxt, def: MacroKeywordDefinition): void { + const {gen, keyword, schema, parentSchema, it} = cxt + const macroSchema = def.macro.call(it.self, schema, parentSchema, it) + const schemaRef = useKeyword(gen, keyword, macroSchema) + if (it.opts.validateSchema !== false) it.self.validateSchema(macroSchema, true) + + const valid = gen.name("valid") + cxt.subschema( + { + schema: macroSchema, + schemaPath: nil, + errSchemaPath: `${it.errSchemaPath}/${keyword}`, + topSchemaRef: schemaRef, + compositeRule: true, + }, + valid + ) + cxt.pass(valid, () => cxt.error(true)) +} + +export function funcKeywordCode(cxt: KeywordCxt, def: FuncKeywordDefinition): void { + const {gen, keyword, schema, parentSchema, $data, it} = cxt + checkAsyncKeyword(it, def) + const validate = + !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate + const validateRef = useKeyword(gen, keyword, validate) + const valid = gen.let("valid") + cxt.block$data(valid, validateKeyword) + cxt.ok(def.valid ?? valid) + + function validateKeyword(): void { + if (def.errors === false) { + assignValid() + if (def.modifying) modifyData(cxt) + reportErrs(() => cxt.error()) + } else { + const ruleErrs = def.async ? validateAsync() : validateSync() + if (def.modifying) modifyData(cxt) + reportErrs(() => addErrs(cxt, ruleErrs)) + } + } + + function validateAsync(): Name { + const ruleErrs = gen.let("ruleErrs", null) + gen.try( + () => assignValid(_`await `), + (e) => + gen.assign(valid, false).if( + _`${e} instanceof ${it.ValidationError as Name}`, + () => gen.assign(ruleErrs, _`${e}.errors`), + () => gen.throw(e) + ) + ) + return ruleErrs + } + + function validateSync(): Code { + const validateErrs = _`${validateRef}.errors` + gen.assign(validateErrs, null) + assignValid(nil) + return validateErrs + } + + function assignValid(_await: Code = def.async ? _`await ` : nil): void { + const passCxt = it.opts.passContext ? N.this : N.self + const passSchema = !(("compile" in def && !$data) || def.schema === false) + gen.assign( + valid, + _`${_await}${callValidateCode(cxt, validateRef, passCxt, passSchema)}`, + def.modifying + ) + } + + function reportErrs(errors: () => void): void { + gen.if(not(def.valid ?? valid), errors) + } +} + +function modifyData(cxt: KeywordCxt): void { + const {gen, data, it} = cxt + gen.if(it.parentData, () => gen.assign(data, _`${it.parentData}[${it.parentDataProperty}]`)) +} + +function addErrs(cxt: KeywordCxt, errs: Code): void { + const {gen} = cxt + gen.if( + _`Array.isArray(${errs})`, + () => { + gen + .assign(N.vErrors, _`${N.vErrors} === null ? ${errs} : ${N.vErrors}.concat(${errs})`) + .assign(N.errors, _`${N.vErrors}.length`) + extendErrors(cxt) + }, + () => cxt.error() + ) +} + +function checkAsyncKeyword({schemaEnv}: SchemaObjCxt, def: FuncKeywordDefinition): void { + if (def.async && !schemaEnv.$async) throw new Error("async keyword in sync schema") +} + +function useKeyword(gen: CodeGen, keyword: string, result?: KeywordCompilationResult): Name { + if (result === undefined) throw new Error(`keyword "${keyword}" failed to compile`) + return gen.scopeValue( + "keyword", + typeof result == "function" ? {ref: result} : {ref: result, code: stringify(result)} + ) +} + +export function validSchemaType( + schema: unknown, + schemaType: JSONType[], + allowUndefined = false +): boolean { + // TODO add tests + return ( + !schemaType.length || + schemaType.some((st) => + st === "array" + ? Array.isArray(schema) + : st === "object" + ? schema && typeof schema == "object" && !Array.isArray(schema) + : typeof schema == st || (allowUndefined && typeof schema == "undefined") + ) + ) +} + +export function validateKeywordUsage( + {schema, opts, self, errSchemaPath}: SchemaObjCxt, + def: AddedKeywordDefinition, + keyword: string +): void { + /* istanbul ignore if */ + if (Array.isArray(def.keyword) ? !def.keyword.includes(keyword) : def.keyword !== keyword) { + throw new Error("ajv implementation error") + } + + const deps = def.dependencies + if (deps?.some((kwd) => !Object.prototype.hasOwnProperty.call(schema, kwd))) { + throw new Error(`parent schema must have dependencies of ${keyword}: ${deps.join(",")}`) + } + + if (def.validateSchema) { + const valid = def.validateSchema(schema[keyword]) + if (!valid) { + const msg = + `keyword "${keyword}" value is invalid at path "${errSchemaPath}": ` + + self.errorsText(def.validateSchema.errors) + if (opts.validateSchema === "log") self.logger.error(msg) + else throw new Error(msg) + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/subschema.ts b/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/subschema.ts new file mode 100644 index 000000000..9072ed774 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/compile/validate/subschema.ts @@ -0,0 +1,135 @@ +import type {AnySchema} from "../../types" +import type {SchemaObjCxt} from ".." +import {_, str, getProperty, Code, Name} from "../codegen" +import {escapeFragment, getErrorPath, Type} from "../util" +import type {JSONType} from "../rules" + +export interface SubschemaContext { + // TODO use Optional? align with SchemCxt property types + schema: AnySchema + schemaPath: Code + errSchemaPath: string + topSchemaRef?: Code + errorPath?: Code + dataLevel?: number + dataTypes?: JSONType[] + data?: Name + parentData?: Name + parentDataProperty?: Code | number + dataNames?: Name[] + dataPathArr?: (Code | number)[] + propertyName?: Name + jtdDiscriminator?: string + jtdMetadata?: boolean + compositeRule?: true + createErrors?: boolean + allErrors?: boolean +} + +export type SubschemaArgs = Partial<{ + keyword: string + schemaProp: string | number + schema: AnySchema + schemaPath: Code + errSchemaPath: string + topSchemaRef: Code + data: Name | Code + dataProp: Code | string | number + dataTypes: JSONType[] + definedProperties: Set + propertyName: Name + dataPropType: Type + jtdDiscriminator: string + jtdMetadata: boolean + compositeRule: true + createErrors: boolean + allErrors: boolean +}> + +export function getSubschema( + it: SchemaObjCxt, + {keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef}: SubschemaArgs +): SubschemaContext { + if (keyword !== undefined && schema !== undefined) { + throw new Error('both "keyword" and "schema" passed, only one allowed') + } + + if (keyword !== undefined) { + const sch = it.schema[keyword] + return schemaProp === undefined + ? { + schema: sch, + schemaPath: _`${it.schemaPath}${getProperty(keyword)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}`, + } + : { + schema: sch[schemaProp], + schemaPath: _`${it.schemaPath}${getProperty(keyword)}${getProperty(schemaProp)}`, + errSchemaPath: `${it.errSchemaPath}/${keyword}/${escapeFragment(schemaProp)}`, + } + } + + if (schema !== undefined) { + if (schemaPath === undefined || errSchemaPath === undefined || topSchemaRef === undefined) { + throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"') + } + return { + schema, + schemaPath, + topSchemaRef, + errSchemaPath, + } + } + + throw new Error('either "keyword" or "schema" must be passed') +} + +export function extendSubschemaData( + subschema: SubschemaContext, + it: SchemaObjCxt, + {dataProp, dataPropType: dpType, data, dataTypes, propertyName}: SubschemaArgs +): void { + if (data !== undefined && dataProp !== undefined) { + throw new Error('both "data" and "dataProp" passed, only one allowed') + } + + const {gen} = it + + if (dataProp !== undefined) { + const {errorPath, dataPathArr, opts} = it + const nextData = gen.let("data", _`${it.data}${getProperty(dataProp)}`, true) + dataContextProps(nextData) + subschema.errorPath = str`${errorPath}${getErrorPath(dataProp, dpType, opts.jsPropertySyntax)}` + subschema.parentDataProperty = _`${dataProp}` + subschema.dataPathArr = [...dataPathArr, subschema.parentDataProperty] + } + + if (data !== undefined) { + const nextData = data instanceof Name ? data : gen.let("data", data, true) // replaceable if used once? + dataContextProps(nextData) + if (propertyName !== undefined) subschema.propertyName = propertyName + // TODO something is possibly wrong here with not changing parentDataProperty and not appending dataPathArr + } + + if (dataTypes) subschema.dataTypes = dataTypes + + function dataContextProps(_nextData: Name): void { + subschema.data = _nextData + subschema.dataLevel = it.dataLevel + 1 + subschema.dataTypes = [] + it.definedProperties = new Set() + subschema.parentData = it.data + subschema.dataNames = [...it.dataNames, _nextData] + } +} + +export function extendSubschemaMode( + subschema: SubschemaContext, + {jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors}: SubschemaArgs +): void { + if (compositeRule !== undefined) subschema.compositeRule = compositeRule + if (createErrors !== undefined) subschema.createErrors = createErrors + if (allErrors !== undefined) subschema.allErrors = allErrors + subschema.jtdDiscriminator = jtdDiscriminator // not inherited + subschema.jtdMetadata = jtdMetadata // not inherited +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/core.ts b/node_modules/schema-utils/node_modules/ajv/lib/core.ts new file mode 100644 index 000000000..3686ffe76 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/core.ts @@ -0,0 +1,887 @@ +export { + Format, + FormatDefinition, + AsyncFormatDefinition, + KeywordDefinition, + KeywordErrorDefinition, + CodeKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, + Vocabulary, + Schema, + SchemaObject, + AnySchemaObject, + AsyncSchema, + AnySchema, + ValidateFunction, + AsyncValidateFunction, + AnyValidateFunction, + ErrorObject, + ErrorNoParams, +} from "./types" + +export {SchemaCxt, SchemaObjCxt} from "./compile" +export interface Plugin { + (ajv: Ajv, options?: Opts): Ajv + [prop: string]: any +} + +export {KeywordCxt} from "./compile/validate" +export {DefinedError} from "./vocabularies/errors" +export {JSONType} from "./compile/rules" +export {JSONSchemaType} from "./types/json-schema" +export {JTDSchemaType, SomeJTDSchemaType, JTDDataType} from "./types/jtd-schema" +export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" + +import type { + Schema, + AnySchema, + AnySchemaObject, + SchemaObject, + AsyncSchema, + Vocabulary, + KeywordDefinition, + AddedKeywordDefinition, + AnyValidateFunction, + ValidateFunction, + AsyncValidateFunction, + ErrorObject, + Format, + AddedFormat, + RegExpEngine, + UriResolver, +} from "./types" +import type {JSONSchemaType} from "./types/json-schema" +import type {JTDSchemaType, SomeJTDSchemaType, JTDDataType} from "./types/jtd-schema" +import ValidationError from "./runtime/validation_error" +import MissingRefError from "./compile/ref_error" +import {getRules, ValidationRules, Rule, RuleGroup, JSONType} from "./compile/rules" +import {SchemaEnv, compileSchema, resolveSchema} from "./compile" +import {Code, ValueScope} from "./compile/codegen" +import {normalizeId, getSchemaRefs} from "./compile/resolve" +import {getJSONTypes} from "./compile/validate/dataType" +import {eachItem} from "./compile/util" +import * as $dataRefSchema from "./refs/data.json" + +import DefaultUriResolver from "./runtime/uri" + +const defaultRegExp: RegExpEngine = (str, flags) => new RegExp(str, flags) +defaultRegExp.code = "new RegExp" + +const META_IGNORE_OPTIONS: (keyof Options)[] = ["removeAdditional", "useDefaults", "coerceTypes"] +const EXT_SCOPE_NAMES = new Set([ + "validate", + "serialize", + "parse", + "wrapper", + "root", + "schema", + "keyword", + "pattern", + "formats", + "validate$data", + "func", + "obj", + "Error", +]) + +export type Options = CurrentOptions & DeprecatedOptions + +export interface CurrentOptions { + // strict mode options (NEW) + strict?: boolean | "log" + strictSchema?: boolean | "log" + strictNumbers?: boolean | "log" + strictTypes?: boolean | "log" + strictTuples?: boolean | "log" + strictRequired?: boolean | "log" + allowMatchingProperties?: boolean // disables a strict mode restriction + allowUnionTypes?: boolean + validateFormats?: boolean + // validation and reporting options: + $data?: boolean + allErrors?: boolean + verbose?: boolean + discriminator?: boolean + unicodeRegExp?: boolean + timestamp?: "string" | "date" // JTD only + parseDate?: boolean // JTD only + allowDate?: boolean // JTD only + $comment?: + | true + | ((comment: string, schemaPath?: string, rootSchema?: AnySchemaObject) => unknown) + formats?: {[Name in string]?: Format} + keywords?: Vocabulary + schemas?: AnySchema[] | {[Key in string]?: AnySchema} + logger?: Logger | false + loadSchema?: (uri: string) => Promise + // options to modify validated data: + removeAdditional?: boolean | "all" | "failing" + useDefaults?: boolean | "empty" + coerceTypes?: boolean | "array" + // advanced options: + next?: boolean // NEW + unevaluated?: boolean // NEW + dynamicRef?: boolean // NEW + schemaId?: "id" | "$id" + jtd?: boolean // NEW + meta?: SchemaObject | boolean + defaultMeta?: string | AnySchemaObject + validateSchema?: boolean | "log" + addUsedSchema?: boolean + inlineRefs?: boolean | number + passContext?: boolean + loopRequired?: number + loopEnum?: number // NEW + ownProperties?: boolean + multipleOfPrecision?: number + int32range?: boolean // JTD only + messages?: boolean + code?: CodeOptions // NEW + uriResolver?: UriResolver +} + +export interface CodeOptions { + es5?: boolean + esm?: boolean + lines?: boolean + optimize?: boolean | number + formats?: Code // code to require (or construct) map of available formats - for standalone code + source?: boolean + process?: (code: string, schema?: SchemaEnv) => string + regExp?: RegExpEngine +} + +interface InstanceCodeOptions extends CodeOptions { + regExp: RegExpEngine + optimize: number +} + +interface DeprecatedOptions { + /** @deprecated */ + ignoreKeywordsWithRef?: boolean + /** @deprecated */ + jsPropertySyntax?: boolean // added instead of jsonPointers + /** @deprecated */ + unicode?: boolean +} + +interface RemovedOptions { + format?: boolean + errorDataPath?: "object" | "property" + nullable?: boolean // "nullable" keyword is supported by default + jsonPointers?: boolean + extendRefs?: true | "ignore" | "fail" + missingRefs?: true | "ignore" | "fail" + processCode?: (code: string, schema?: SchemaEnv) => string + sourceCode?: boolean + strictDefaults?: boolean + strictKeywords?: boolean + uniqueItems?: boolean + unknownFormats?: true | string[] | "ignore" + cache?: any + serialize?: (schema: AnySchema) => unknown + ajvErrors?: boolean +} + +type OptionsInfo = { + [K in keyof T]-?: string | undefined +} + +const removedOptions: OptionsInfo = { + errorDataPath: "", + format: "`validateFormats: false` can be used instead.", + nullable: '"nullable" keyword is supported by default.', + jsonPointers: "Deprecated jsPropertySyntax can be used instead.", + extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.", + missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.", + processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`", + sourceCode: "Use option `code: {source: true}`", + strictDefaults: "It is default now, see option `strict`.", + strictKeywords: "It is default now, see option `strict`.", + uniqueItems: '"uniqueItems" keyword is always validated.', + unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).", + cache: "Map is used as cache, schema object as key.", + serialize: "Map is used as cache, schema object as key.", + ajvErrors: "It is default now.", +} + +const deprecatedOptions: OptionsInfo = { + ignoreKeywordsWithRef: "", + jsPropertySyntax: "", + unicode: '"minLength"/"maxLength" account for unicode characters by default.', +} + +type RequiredInstanceOptions = { + [K in + | "strictSchema" + | "strictNumbers" + | "strictTypes" + | "strictTuples" + | "strictRequired" + | "inlineRefs" + | "loopRequired" + | "loopEnum" + | "meta" + | "messages" + | "schemaId" + | "addUsedSchema" + | "validateSchema" + | "validateFormats" + | "int32range" + | "unicodeRegExp" + | "uriResolver"]: NonNullable +} & {code: InstanceCodeOptions} + +export type InstanceOptions = Options & RequiredInstanceOptions + +const MAX_EXPRESSION = 200 + +// eslint-disable-next-line complexity +function requiredOptions(o: Options): RequiredInstanceOptions { + const s = o.strict + const _optz = o.code?.optimize + const optimize = _optz === true || _optz === undefined ? 1 : _optz || 0 + const regExp = o.code?.regExp ?? defaultRegExp + const uriResolver = o.uriResolver ?? DefaultUriResolver + return { + strictSchema: o.strictSchema ?? s ?? true, + strictNumbers: o.strictNumbers ?? s ?? true, + strictTypes: o.strictTypes ?? s ?? "log", + strictTuples: o.strictTuples ?? s ?? "log", + strictRequired: o.strictRequired ?? s ?? false, + code: o.code ? {...o.code, optimize, regExp} : {optimize, regExp}, + loopRequired: o.loopRequired ?? MAX_EXPRESSION, + loopEnum: o.loopEnum ?? MAX_EXPRESSION, + meta: o.meta ?? true, + messages: o.messages ?? true, + inlineRefs: o.inlineRefs ?? true, + schemaId: o.schemaId ?? "$id", + addUsedSchema: o.addUsedSchema ?? true, + validateSchema: o.validateSchema ?? true, + validateFormats: o.validateFormats ?? true, + unicodeRegExp: o.unicodeRegExp ?? true, + int32range: o.int32range ?? true, + uriResolver: uriResolver, + } +} + +export interface Logger { + log(...args: unknown[]): unknown + warn(...args: unknown[]): unknown + error(...args: unknown[]): unknown +} + +export default class Ajv { + opts: InstanceOptions + errors?: ErrorObject[] | null // errors from the last validation + logger: Logger + // shared external scope values for compiled functions + readonly scope: ValueScope + readonly schemas: {[Key in string]?: SchemaEnv} = {} + readonly refs: {[Ref in string]?: SchemaEnv | string} = {} + readonly formats: {[Name in string]?: AddedFormat} = {} + readonly RULES: ValidationRules + readonly _compilations: Set = new Set() + private readonly _loading: {[Ref in string]?: Promise} = {} + private readonly _cache: Map = new Map() + private readonly _metaOpts: InstanceOptions + + static ValidationError = ValidationError + static MissingRefError = MissingRefError + + constructor(opts: Options = {}) { + opts = this.opts = {...opts, ...requiredOptions(opts)} + const {es5, lines} = this.opts.code + + this.scope = new ValueScope({scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines}) + this.logger = getLogger(opts.logger) + const formatOpt = opts.validateFormats + opts.validateFormats = false + + this.RULES = getRules() + checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED") + checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn") + this._metaOpts = getMetaSchemaOptions.call(this) + + if (opts.formats) addInitialFormats.call(this) + this._addVocabularies() + this._addDefaultMetaSchema() + if (opts.keywords) addInitialKeywords.call(this, opts.keywords) + if (typeof opts.meta == "object") this.addMetaSchema(opts.meta) + addInitialSchemas.call(this) + opts.validateFormats = formatOpt + } + + _addVocabularies(): void { + this.addKeyword("$async") + } + + _addDefaultMetaSchema(): void { + const {$data, meta, schemaId} = this.opts + let _dataRefSchema: SchemaObject = $dataRefSchema + if (schemaId === "id") { + _dataRefSchema = {...$dataRefSchema} + _dataRefSchema.id = _dataRefSchema.$id + delete _dataRefSchema.$id + } + if (meta && $data) this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false) + } + + defaultMeta(): string | AnySchemaObject | undefined { + const {meta, schemaId} = this.opts + return (this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : undefined) + } + + // Validate data using schema + // AnySchema will be compiled and cached using schema itself as a key for Map + validate(schema: Schema | string, data: unknown): boolean + validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise + validate(schema: Schema | JSONSchemaType | string, data: unknown): data is T + // Separated for type inference to work + // eslint-disable-next-line @typescript-eslint/unified-signatures + validate(schema: JTDSchemaType, data: unknown): data is T + // This overload is only intended for typescript inference, the first + // argument prevents manual type annotation from matching this overload + validate( + schema: T, + data: unknown + ): data is JTDDataType + validate(schema: AsyncSchema, data: unknown | T): Promise + validate(schemaKeyRef: AnySchema | string, data: unknown): data is T | Promise + validate( + schemaKeyRef: AnySchema | string, // key, ref or schema object + data: unknown | T // to be validated + ): boolean | Promise { + let v: AnyValidateFunction | undefined + if (typeof schemaKeyRef == "string") { + v = this.getSchema(schemaKeyRef) + if (!v) throw new Error(`no schema with key or ref "${schemaKeyRef}"`) + } else { + v = this.compile(schemaKeyRef) + } + + const valid = v(data) + if (!("$async" in v)) this.errors = v.errors + return valid + } + + // Create validation function for passed schema + // _meta: true if schema is a meta-schema. Used internally to compile meta schemas of user-defined keywords. + compile(schema: Schema | JSONSchemaType, _meta?: boolean): ValidateFunction + // Separated for type inference to work + // eslint-disable-next-line @typescript-eslint/unified-signatures + compile(schema: JTDSchemaType, _meta?: boolean): ValidateFunction + // This overload is only intended for typescript inference, the first + // argument prevents manual type annotation from matching this overload + compile( + schema: T, + _meta?: boolean + ): ValidateFunction> + compile(schema: AsyncSchema, _meta?: boolean): AsyncValidateFunction + compile(schema: AnySchema, _meta?: boolean): AnyValidateFunction + compile(schema: AnySchema, _meta?: boolean): AnyValidateFunction { + const sch = this._addSchema(schema, _meta) + return (sch.validate || this._compileSchemaEnv(sch)) as AnyValidateFunction + } + + // Creates validating function for passed schema with asynchronous loading of missing schemas. + // `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema. + // TODO allow passing schema URI + // meta - optional true to compile meta-schema + compileAsync( + schema: SchemaObject | JSONSchemaType, + _meta?: boolean + ): Promise> + // Separated for type inference to work + // eslint-disable-next-line @typescript-eslint/unified-signatures + compileAsync(schema: JTDSchemaType, _meta?: boolean): Promise> + compileAsync(schema: AsyncSchema, meta?: boolean): Promise> + // eslint-disable-next-line @typescript-eslint/unified-signatures + compileAsync( + schema: AnySchemaObject, + meta?: boolean + ): Promise> + compileAsync( + schema: AnySchemaObject, + meta?: boolean + ): Promise> { + if (typeof this.opts.loadSchema != "function") { + throw new Error("options.loadSchema should be a function") + } + const {loadSchema} = this.opts + return runCompileAsync.call(this, schema, meta) + + async function runCompileAsync( + this: Ajv, + _schema: AnySchemaObject, + _meta?: boolean + ): Promise { + await loadMetaSchema.call(this, _schema.$schema) + const sch = this._addSchema(_schema, _meta) + return sch.validate || _compileAsync.call(this, sch) + } + + async function loadMetaSchema(this: Ajv, $ref?: string): Promise { + if ($ref && !this.getSchema($ref)) { + await runCompileAsync.call(this, {$ref}, true) + } + } + + async function _compileAsync(this: Ajv, sch: SchemaEnv): Promise { + try { + return this._compileSchemaEnv(sch) + } catch (e) { + if (!(e instanceof MissingRefError)) throw e + checkLoaded.call(this, e) + await loadMissingSchema.call(this, e.missingSchema) + return _compileAsync.call(this, sch) + } + } + + function checkLoaded(this: Ajv, {missingSchema: ref, missingRef}: MissingRefError): void { + if (this.refs[ref]) { + throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`) + } + } + + async function loadMissingSchema(this: Ajv, ref: string): Promise { + const _schema = await _loadSchema.call(this, ref) + if (!this.refs[ref]) await loadMetaSchema.call(this, _schema.$schema) + if (!this.refs[ref]) this.addSchema(_schema, ref, meta) + } + + async function _loadSchema(this: Ajv, ref: string): Promise { + const p = this._loading[ref] + if (p) return p + try { + return await (this._loading[ref] = loadSchema(ref)) + } finally { + delete this._loading[ref] + } + } + } + + // Adds schema to the instance + addSchema( + schema: AnySchema | AnySchema[], // If array is passed, `key` will be ignored + key?: string, // Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. + _meta?: boolean, // true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. + _validateSchema = this.opts.validateSchema // false to skip schema validation. Used internally, option validateSchema should be used instead. + ): Ajv { + if (Array.isArray(schema)) { + for (const sch of schema) this.addSchema(sch, undefined, _meta, _validateSchema) + return this + } + let id: string | undefined + if (typeof schema === "object") { + const {schemaId} = this.opts + id = schema[schemaId] + if (id !== undefined && typeof id != "string") { + throw new Error(`schema ${schemaId} must be string`) + } + } + key = normalizeId(key || id) + this._checkUnique(key) + this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true) + return this + } + + // Add schema that will be used to validate other schemas + // options in META_IGNORE_OPTIONS are alway set to false + addMetaSchema( + schema: AnySchemaObject, + key?: string, // schema key + _validateSchema = this.opts.validateSchema // false to skip schema validation, can be used to override validateSchema option for meta-schema + ): Ajv { + this.addSchema(schema, key, true, _validateSchema) + return this + } + + // Validate schema against its meta-schema + validateSchema(schema: AnySchema, throwOrLogError?: boolean): boolean | Promise { + if (typeof schema == "boolean") return true + let $schema: string | AnySchemaObject | undefined + $schema = schema.$schema + if ($schema !== undefined && typeof $schema != "string") { + throw new Error("$schema must be a string") + } + $schema = $schema || this.opts.defaultMeta || this.defaultMeta() + if (!$schema) { + this.logger.warn("meta-schema not available") + this.errors = null + return true + } + const valid = this.validate($schema, schema) + if (!valid && throwOrLogError) { + const message = "schema is invalid: " + this.errorsText() + if (this.opts.validateSchema === "log") this.logger.error(message) + else throw new Error(message) + } + return valid + } + + // Get compiled schema by `key` or `ref`. + // (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id) + getSchema(keyRef: string): AnyValidateFunction | undefined { + let sch + while (typeof (sch = getSchEnv.call(this, keyRef)) == "string") keyRef = sch + if (sch === undefined) { + const {schemaId} = this.opts + const root = new SchemaEnv({schema: {}, schemaId}) + sch = resolveSchema.call(this, root, keyRef) + if (!sch) return + this.refs[keyRef] = sch + } + return (sch.validate || this._compileSchemaEnv(sch)) as AnyValidateFunction | undefined + } + + // Remove cached schema(s). + // If no parameter is passed all schemas but meta-schemas are removed. + // If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. + // Even if schema is referenced by other schemas it still can be removed as other schemas have local references. + removeSchema(schemaKeyRef?: AnySchema | string | RegExp): Ajv { + if (schemaKeyRef instanceof RegExp) { + this._removeAllSchemas(this.schemas, schemaKeyRef) + this._removeAllSchemas(this.refs, schemaKeyRef) + return this + } + switch (typeof schemaKeyRef) { + case "undefined": + this._removeAllSchemas(this.schemas) + this._removeAllSchemas(this.refs) + this._cache.clear() + return this + case "string": { + const sch = getSchEnv.call(this, schemaKeyRef) + if (typeof sch == "object") this._cache.delete(sch.schema) + delete this.schemas[schemaKeyRef] + delete this.refs[schemaKeyRef] + return this + } + case "object": { + const cacheKey = schemaKeyRef + this._cache.delete(cacheKey) + let id = schemaKeyRef[this.opts.schemaId] + if (id) { + id = normalizeId(id) + delete this.schemas[id] + delete this.refs[id] + } + return this + } + default: + throw new Error("ajv.removeSchema: invalid parameter") + } + } + + // add "vocabulary" - a collection of keywords + addVocabulary(definitions: Vocabulary): Ajv { + for (const def of definitions) this.addKeyword(def) + return this + } + + addKeyword( + kwdOrDef: string | KeywordDefinition, + def?: KeywordDefinition // deprecated + ): Ajv { + let keyword: string | string[] + if (typeof kwdOrDef == "string") { + keyword = kwdOrDef + if (typeof def == "object") { + this.logger.warn("these parameters are deprecated, see docs for addKeyword") + def.keyword = keyword + } + } else if (typeof kwdOrDef == "object" && def === undefined) { + def = kwdOrDef + keyword = def.keyword + if (Array.isArray(keyword) && !keyword.length) { + throw new Error("addKeywords: keyword must be string or non-empty array") + } + } else { + throw new Error("invalid addKeywords parameters") + } + + checkKeyword.call(this, keyword, def) + if (!def) { + eachItem(keyword, (kwd) => addRule.call(this, kwd)) + return this + } + keywordMetaschema.call(this, def) + const definition: AddedKeywordDefinition = { + ...def, + type: getJSONTypes(def.type), + schemaType: getJSONTypes(def.schemaType), + } + eachItem( + keyword, + definition.type.length === 0 + ? (k) => addRule.call(this, k, definition) + : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t)) + ) + return this + } + + getKeyword(keyword: string): AddedKeywordDefinition | boolean { + const rule = this.RULES.all[keyword] + return typeof rule == "object" ? rule.definition : !!rule + } + + // Remove keyword + removeKeyword(keyword: string): Ajv { + // TODO return type should be Ajv + const {RULES} = this + delete RULES.keywords[keyword] + delete RULES.all[keyword] + for (const group of RULES.rules) { + const i = group.rules.findIndex((rule) => rule.keyword === keyword) + if (i >= 0) group.rules.splice(i, 1) + } + return this + } + + // Add format + addFormat(name: string, format: Format): Ajv { + if (typeof format == "string") format = new RegExp(format) + this.formats[name] = format + return this + } + + errorsText( + errors: ErrorObject[] | null | undefined = this.errors, // optional array of validation errors + {separator = ", ", dataVar = "data"}: ErrorsTextOptions = {} // optional options with properties `separator` and `dataVar` + ): string { + if (!errors || errors.length === 0) return "No errors" + return errors + .map((e) => `${dataVar}${e.instancePath} ${e.message}`) + .reduce((text, msg) => text + separator + msg) + } + + $dataMetaSchema(metaSchema: AnySchemaObject, keywordsJsonPointers: string[]): AnySchemaObject { + const rules = this.RULES.all + metaSchema = JSON.parse(JSON.stringify(metaSchema)) + for (const jsonPointer of keywordsJsonPointers) { + const segments = jsonPointer.split("/").slice(1) // first segment is an empty string + let keywords = metaSchema + for (const seg of segments) keywords = keywords[seg] as AnySchemaObject + + for (const key in rules) { + const rule = rules[key] + if (typeof rule != "object") continue + const {$data} = rule.definition + const schema = keywords[key] as AnySchemaObject | undefined + if ($data && schema) keywords[key] = schemaOrData(schema) + } + } + + return metaSchema + } + + private _removeAllSchemas(schemas: {[Ref in string]?: SchemaEnv | string}, regex?: RegExp): void { + for (const keyRef in schemas) { + const sch = schemas[keyRef] + if (!regex || regex.test(keyRef)) { + if (typeof sch == "string") { + delete schemas[keyRef] + } else if (sch && !sch.meta) { + this._cache.delete(sch.schema) + delete schemas[keyRef] + } + } + } + } + + _addSchema( + schema: AnySchema, + meta?: boolean, + baseId?: string, + validateSchema = this.opts.validateSchema, + addSchema = this.opts.addUsedSchema + ): SchemaEnv { + let id: string | undefined + const {schemaId} = this.opts + if (typeof schema == "object") { + id = schema[schemaId] + } else { + if (this.opts.jtd) throw new Error("schema must be object") + else if (typeof schema != "boolean") throw new Error("schema must be object or boolean") + } + let sch = this._cache.get(schema) + if (sch !== undefined) return sch + + baseId = normalizeId(id || baseId) + const localRefs = getSchemaRefs.call(this, schema, baseId) + sch = new SchemaEnv({schema, schemaId, meta, baseId, localRefs}) + this._cache.set(sch.schema, sch) + if (addSchema && !baseId.startsWith("#")) { + // TODO atm it is allowed to overwrite schemas without id (instead of not adding them) + if (baseId) this._checkUnique(baseId) + this.refs[baseId] = sch + } + if (validateSchema) this.validateSchema(schema, true) + return sch + } + + private _checkUnique(id: string): void { + if (this.schemas[id] || this.refs[id]) { + throw new Error(`schema with key or id "${id}" already exists`) + } + } + + private _compileSchemaEnv(sch: SchemaEnv): AnyValidateFunction { + if (sch.meta) this._compileMetaSchema(sch) + else compileSchema.call(this, sch) + + /* istanbul ignore if */ + if (!sch.validate) throw new Error("ajv implementation error") + return sch.validate + } + + private _compileMetaSchema(sch: SchemaEnv): void { + const currentOpts = this.opts + this.opts = this._metaOpts + try { + compileSchema.call(this, sch) + } finally { + this.opts = currentOpts + } + } +} + +export interface ErrorsTextOptions { + separator?: string + dataVar?: string +} + +function checkOptions( + this: Ajv, + checkOpts: OptionsInfo, + options: Options & RemovedOptions, + msg: string, + log: "warn" | "error" = "error" +): void { + for (const key in checkOpts) { + const opt = key as keyof typeof checkOpts + if (opt in options) this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`) + } +} + +function getSchEnv(this: Ajv, keyRef: string): SchemaEnv | string | undefined { + keyRef = normalizeId(keyRef) // TODO tests fail without this line + return this.schemas[keyRef] || this.refs[keyRef] +} + +function addInitialSchemas(this: Ajv): void { + const optsSchemas = this.opts.schemas + if (!optsSchemas) return + if (Array.isArray(optsSchemas)) this.addSchema(optsSchemas) + else for (const key in optsSchemas) this.addSchema(optsSchemas[key] as AnySchema, key) +} + +function addInitialFormats(this: Ajv): void { + for (const name in this.opts.formats) { + const format = this.opts.formats[name] + if (format) this.addFormat(name, format) + } +} + +function addInitialKeywords( + this: Ajv, + defs: Vocabulary | {[K in string]?: KeywordDefinition} +): void { + if (Array.isArray(defs)) { + this.addVocabulary(defs) + return + } + this.logger.warn("keywords option as map is deprecated, pass array") + for (const keyword in defs) { + const def = defs[keyword] as KeywordDefinition + if (!def.keyword) def.keyword = keyword + this.addKeyword(def) + } +} + +function getMetaSchemaOptions(this: Ajv): InstanceOptions { + const metaOpts = {...this.opts} + for (const opt of META_IGNORE_OPTIONS) delete metaOpts[opt] + return metaOpts +} + +const noLogs = {log() {}, warn() {}, error() {}} + +function getLogger(logger?: Partial | false): Logger { + if (logger === false) return noLogs + if (logger === undefined) return console + if (logger.log && logger.warn && logger.error) return logger as Logger + throw new Error("logger must implement log, warn and error methods") +} + +const KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i + +function checkKeyword(this: Ajv, keyword: string | string[], def?: KeywordDefinition): void { + const {RULES} = this + eachItem(keyword, (kwd) => { + if (RULES.keywords[kwd]) throw new Error(`Keyword ${kwd} is already defined`) + if (!KEYWORD_NAME.test(kwd)) throw new Error(`Keyword ${kwd} has invalid name`) + }) + if (!def) return + if (def.$data && !("code" in def || "validate" in def)) { + throw new Error('$data keyword must have "code" or "validate" function') + } +} + +function addRule( + this: Ajv, + keyword: string, + definition?: AddedKeywordDefinition, + dataType?: JSONType +): void { + const post = definition?.post + if (dataType && post) throw new Error('keyword with "post" flag cannot have "type"') + const {RULES} = this + let ruleGroup = post ? RULES.post : RULES.rules.find(({type: t}) => t === dataType) + if (!ruleGroup) { + ruleGroup = {type: dataType, rules: []} + RULES.rules.push(ruleGroup) + } + RULES.keywords[keyword] = true + if (!definition) return + + const rule: Rule = { + keyword, + definition: { + ...definition, + type: getJSONTypes(definition.type), + schemaType: getJSONTypes(definition.schemaType), + }, + } + if (definition.before) addBeforeRule.call(this, ruleGroup, rule, definition.before) + else ruleGroup.rules.push(rule) + RULES.all[keyword] = rule + definition.implements?.forEach((kwd) => this.addKeyword(kwd)) +} + +function addBeforeRule(this: Ajv, ruleGroup: RuleGroup, rule: Rule, before: string): void { + const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before) + if (i >= 0) { + ruleGroup.rules.splice(i, 0, rule) + } else { + ruleGroup.rules.push(rule) + this.logger.warn(`rule ${before} is not defined`) + } +} + +function keywordMetaschema(this: Ajv, def: KeywordDefinition): void { + let {metaSchema} = def + if (metaSchema === undefined) return + if (def.$data && this.opts.$data) metaSchema = schemaOrData(metaSchema) + def.validateSchema = this.compile(metaSchema, true) +} + +const $dataRef = { + $ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", +} + +function schemaOrData(schema: AnySchema): AnySchemaObject { + return {anyOf: [schema, $dataRef]} +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/jtd.ts b/node_modules/schema-utils/node_modules/ajv/lib/jtd.ts new file mode 100644 index 000000000..b53749ba4 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/jtd.ts @@ -0,0 +1,129 @@ +import type {AnySchemaObject, SchemaObject, JTDParser} from "./types" +import type {JTDSchemaType, SomeJTDSchemaType, JTDDataType} from "./types/jtd-schema" +import AjvCore, {CurrentOptions} from "./core" +import jtdVocabulary from "./vocabularies/jtd" +import jtdMetaSchema from "./refs/jtd-schema" +import compileSerializer from "./compile/jtd/serialize" +import compileParser from "./compile/jtd/parse" +import {SchemaEnv} from "./compile" + +const META_SCHEMA_ID = "JTD-meta-schema" + +type JTDOptions = CurrentOptions & { + // strict mode options not supported with JTD: + strict?: never + allowMatchingProperties?: never + allowUnionTypes?: never + validateFormats?: never + // validation and reporting options not supported with JTD: + $data?: never + verbose?: boolean + $comment?: never + formats?: never + loadSchema?: never + // options to modify validated data: + useDefaults?: never + coerceTypes?: never + // advanced options: + next?: never + unevaluated?: never + dynamicRef?: never + meta?: boolean + defaultMeta?: never + inlineRefs?: boolean + loopRequired?: never + multipleOfPrecision?: never +} + +class Ajv extends AjvCore { + constructor(opts: JTDOptions = {}) { + super({ + ...opts, + jtd: true, + }) + } + + _addVocabularies(): void { + super._addVocabularies() + this.addVocabulary(jtdVocabulary) + } + + _addDefaultMetaSchema(): void { + super._addDefaultMetaSchema() + if (!this.opts.meta) return + this.addMetaSchema(jtdMetaSchema, META_SCHEMA_ID, false) + } + + defaultMeta(): string | AnySchemaObject | undefined { + return (this.opts.defaultMeta = + super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined)) + } + + compileSerializer(schema: SchemaObject): (data: T) => string + // Separated for type inference to work + // eslint-disable-next-line @typescript-eslint/unified-signatures + compileSerializer(schema: JTDSchemaType): (data: T) => string + compileSerializer(schema: SchemaObject): (data: T) => string { + const sch = this._addSchema(schema) + return sch.serialize || this._compileSerializer(sch) + } + + compileParser(schema: SchemaObject): JTDParser + // Separated for type inference to work + // eslint-disable-next-line @typescript-eslint/unified-signatures + compileParser(schema: JTDSchemaType): JTDParser + compileParser(schema: SchemaObject): JTDParser { + const sch = this._addSchema(schema) + return (sch.parse || this._compileParser(sch)) as JTDParser + } + + private _compileSerializer(sch: SchemaEnv): (data: T) => string { + compileSerializer.call(this, sch, (sch.schema as AnySchemaObject).definitions || {}) + /* istanbul ignore if */ + if (!sch.serialize) throw new Error("ajv implementation error") + return sch.serialize + } + + private _compileParser(sch: SchemaEnv): JTDParser { + compileParser.call(this, sch, (sch.schema as AnySchemaObject).definitions || {}) + /* istanbul ignore if */ + if (!sch.parse) throw new Error("ajv implementation error") + return sch.parse + } +} + +module.exports = exports = Ajv +Object.defineProperty(exports, "__esModule", {value: true}) + +export default Ajv + +export { + Format, + FormatDefinition, + AsyncFormatDefinition, + KeywordDefinition, + KeywordErrorDefinition, + CodeKeywordDefinition, + MacroKeywordDefinition, + FuncKeywordDefinition, + Vocabulary, + Schema, + SchemaObject, + AnySchemaObject, + AsyncSchema, + AnySchema, + ValidateFunction, + AsyncValidateFunction, + ErrorObject, + ErrorNoParams, + JTDParser, +} from "./types" + +export {Plugin, Options, CodeOptions, InstanceOptions, Logger, ErrorsTextOptions} from "./core" +export {SchemaCxt, SchemaObjCxt} from "./compile" +export {KeywordCxt} from "./compile/validate" +export {JTDErrorObject} from "./vocabularies/jtd" +export {_, str, stringify, nil, Name, Code, CodeGen, CodeGenOptions} from "./compile/codegen" + +export {JTDSchemaType, SomeJTDSchemaType, JTDDataType} +export {JTDOptions} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/data.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/data.json new file mode 100644 index 000000000..9ffc9f5ce --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/data.json @@ -0,0 +1,13 @@ +{ + "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#", + "description": "Meta-schema for $data reference (JSON AnySchema extension proposal)", + "type": "object", + "required": ["$data"], + "properties": { + "$data": { + "type": "string", + "anyOf": [{"format": "relative-json-pointer"}, {"format": "json-pointer"}] + } + }, + "additionalProperties": false +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts new file mode 100644 index 000000000..b6ea7195f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/index.ts @@ -0,0 +1,28 @@ +import type Ajv from "../../core" +import type {AnySchemaObject} from "../../types" +import * as metaSchema from "./schema.json" +import * as applicator from "./meta/applicator.json" +import * as content from "./meta/content.json" +import * as core from "./meta/core.json" +import * as format from "./meta/format.json" +import * as metadata from "./meta/meta-data.json" +import * as validation from "./meta/validation.json" + +const META_SUPPORT_DATA = ["/properties"] + +export default function addMetaSchema2019(this: Ajv, $data?: boolean): Ajv { + ;[ + metaSchema, + applicator, + content, + core, + with$data(this, format), + metadata, + with$data(this, validation), + ].forEach((sch) => this.addMetaSchema(sch, undefined, false)) + return this + + function with$data(ajv: Ajv, sch: AnySchemaObject): AnySchemaObject { + return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json new file mode 100644 index 000000000..c5e91cf2a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/applicator.json @@ -0,0 +1,53 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/applicator", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/applicator": true + }, + "$recursiveAnchor": true, + + "title": "Applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "additionalItems": {"$recursiveRef": "#"}, + "unevaluatedItems": {"$recursiveRef": "#"}, + "items": { + "anyOf": [{"$recursiveRef": "#"}, {"$ref": "#/$defs/schemaArray"}] + }, + "contains": {"$recursiveRef": "#"}, + "additionalProperties": {"$recursiveRef": "#"}, + "unevaluatedProperties": {"$recursiveRef": "#"}, + "properties": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependentSchemas": { + "type": "object", + "additionalProperties": { + "$recursiveRef": "#" + } + }, + "propertyNames": {"$recursiveRef": "#"}, + "if": {"$recursiveRef": "#"}, + "then": {"$recursiveRef": "#"}, + "else": {"$recursiveRef": "#"}, + "allOf": {"$ref": "#/$defs/schemaArray"}, + "anyOf": {"$ref": "#/$defs/schemaArray"}, + "oneOf": {"$ref": "#/$defs/schemaArray"}, + "not": {"$recursiveRef": "#"} + }, + "$defs": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$recursiveRef": "#"} + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json new file mode 100644 index 000000000..b8f637343 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/content.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/content", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + "$recursiveAnchor": true, + + "title": "Content vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "contentMediaType": {"type": "string"}, + "contentEncoding": {"type": "string"}, + "contentSchema": {"$recursiveRef": "#"} + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json new file mode 100644 index 000000000..f71adbff0 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/core.json @@ -0,0 +1,57 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/core", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true + }, + "$recursiveAnchor": true, + + "title": "Core vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference", + "$comment": "Non-empty fragments not allowed.", + "pattern": "^[^#]*#?$" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$anchor": { + "type": "string", + "pattern": "^[A-Za-z][-A-Za-z0-9.:_]*$" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$recursiveRef": { + "type": "string", + "format": "uri-reference" + }, + "$recursiveAnchor": { + "type": "boolean", + "default": false + }, + "$vocabulary": { + "type": "object", + "propertyNames": { + "type": "string", + "format": "uri" + }, + "additionalProperties": { + "type": "boolean" + } + }, + "$comment": { + "type": "string" + }, + "$defs": { + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json new file mode 100644 index 000000000..03ccfce26 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/format.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/format", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/format": true + }, + "$recursiveAnchor": true, + + "title": "Format vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "format": {"type": "string"} + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json new file mode 100644 index 000000000..0e194326f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/meta-data.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/meta-data", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/meta-data": true + }, + "$recursiveAnchor": true, + + "title": "Meta-data vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "deprecated": { + "type": "boolean", + "default": false + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json new file mode 100644 index 000000000..7027a1279 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/meta/validation.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/meta/validation", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/validation": true + }, + "$recursiveAnchor": true, + + "title": "Validation vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, + "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, + "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, + "minContains": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 1 + }, + "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, + "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/$defs/stringArray"}, + "dependentRequired": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + }, + "const": true, + "enum": { + "type": "array", + "items": true + }, + "type": { + "anyOf": [ + {"$ref": "#/$defs/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/$defs/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + } + }, + "$defs": { + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 0 + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json new file mode 100644 index 000000000..54eb7157a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2019-09/schema.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://json-schema.org/draft/2019-09/schema", + "$id": "https://json-schema.org/draft/2019-09/schema", + "$vocabulary": { + "https://json-schema.org/draft/2019-09/vocab/core": true, + "https://json-schema.org/draft/2019-09/vocab/applicator": true, + "https://json-schema.org/draft/2019-09/vocab/validation": true, + "https://json-schema.org/draft/2019-09/vocab/meta-data": true, + "https://json-schema.org/draft/2019-09/vocab/format": false, + "https://json-schema.org/draft/2019-09/vocab/content": true + }, + "$recursiveAnchor": true, + + "title": "Core and Validation specifications meta-schema", + "allOf": [ + {"$ref": "meta/core"}, + {"$ref": "meta/applicator"}, + {"$ref": "meta/validation"}, + {"$ref": "meta/meta-data"}, + {"$ref": "meta/format"}, + {"$ref": "meta/content"} + ], + "type": ["object", "boolean"], + "properties": { + "definitions": { + "$comment": "While no longer an official keyword as it is replaced by $defs, this keyword is retained in the meta-schema to prevent incompatible extensions as it remains in common use.", + "type": "object", + "additionalProperties": {"$recursiveRef": "#"}, + "default": {} + }, + "dependencies": { + "$comment": "\"dependencies\" is no longer a keyword, but schema authors should avoid redefining it to facilitate a smooth transition to \"dependentSchemas\" and \"dependentRequired\"", + "type": "object", + "additionalProperties": { + "anyOf": [{"$recursiveRef": "#"}, {"$ref": "meta/validation#/$defs/stringArray"}] + } + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts new file mode 100644 index 000000000..8e850d08b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/index.ts @@ -0,0 +1,30 @@ +import type Ajv from "../../core" +import type {AnySchemaObject} from "../../types" +import * as metaSchema from "./schema.json" +import * as applicator from "./meta/applicator.json" +import * as unevaluated from "./meta/unevaluated.json" +import * as content from "./meta/content.json" +import * as core from "./meta/core.json" +import * as format from "./meta/format-annotation.json" +import * as metadata from "./meta/meta-data.json" +import * as validation from "./meta/validation.json" + +const META_SUPPORT_DATA = ["/properties"] + +export default function addMetaSchema2020(this: Ajv, $data?: boolean): Ajv { + ;[ + metaSchema, + applicator, + unevaluated, + content, + core, + with$data(this, format), + metadata, + with$data(this, validation), + ].forEach((sch) => this.addMetaSchema(sch, undefined, false)) + return this + + function with$data(ajv: Ajv, sch: AnySchemaObject): AnySchemaObject { + return $data ? ajv.$dataMetaSchema(sch, META_SUPPORT_DATA) : sch + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json new file mode 100644 index 000000000..674c913da --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/applicator.json @@ -0,0 +1,48 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/applicator", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/applicator": true + }, + "$dynamicAnchor": "meta", + + "title": "Applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "prefixItems": {"$ref": "#/$defs/schemaArray"}, + "items": {"$dynamicRef": "#meta"}, + "contains": {"$dynamicRef": "#meta"}, + "additionalProperties": {"$dynamicRef": "#meta"}, + "properties": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependentSchemas": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "default": {} + }, + "propertyNames": {"$dynamicRef": "#meta"}, + "if": {"$dynamicRef": "#meta"}, + "then": {"$dynamicRef": "#meta"}, + "else": {"$dynamicRef": "#meta"}, + "allOf": {"$ref": "#/$defs/schemaArray"}, + "anyOf": {"$ref": "#/$defs/schemaArray"}, + "oneOf": {"$ref": "#/$defs/schemaArray"}, + "not": {"$dynamicRef": "#meta"} + }, + "$defs": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$dynamicRef": "#meta"} + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json new file mode 100644 index 000000000..2ae23ddb5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/content.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/content", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/content": true + }, + "$dynamicAnchor": "meta", + + "title": "Content vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "contentEncoding": {"type": "string"}, + "contentMediaType": {"type": "string"}, + "contentSchema": {"$dynamicRef": "#meta"} + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json new file mode 100644 index 000000000..4c8e5cb61 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/core.json @@ -0,0 +1,51 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/core", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/core": true + }, + "$dynamicAnchor": "meta", + + "title": "Core vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "$id": { + "$ref": "#/$defs/uriReferenceString", + "$comment": "Non-empty fragments not allowed.", + "pattern": "^[^#]*#?$" + }, + "$schema": {"$ref": "#/$defs/uriString"}, + "$ref": {"$ref": "#/$defs/uriReferenceString"}, + "$anchor": {"$ref": "#/$defs/anchorString"}, + "$dynamicRef": {"$ref": "#/$defs/uriReferenceString"}, + "$dynamicAnchor": {"$ref": "#/$defs/anchorString"}, + "$vocabulary": { + "type": "object", + "propertyNames": {"$ref": "#/$defs/uriString"}, + "additionalProperties": { + "type": "boolean" + } + }, + "$comment": { + "type": "string" + }, + "$defs": { + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"} + } + }, + "$defs": { + "anchorString": { + "type": "string", + "pattern": "^[A-Za-z_][-A-Za-z0-9._]*$" + }, + "uriString": { + "type": "string", + "format": "uri" + }, + "uriReferenceString": { + "type": "string", + "format": "uri-reference" + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json new file mode 100644 index 000000000..83c26e35f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/format-annotation.json @@ -0,0 +1,14 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/format-annotation", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/format-annotation": true + }, + "$dynamicAnchor": "meta", + + "title": "Format vocabulary meta-schema for annotation results", + "type": ["object", "boolean"], + "properties": { + "format": {"type": "string"} + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json new file mode 100644 index 000000000..11946fb50 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/meta-data.json @@ -0,0 +1,37 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/meta-data", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/meta-data": true + }, + "$dynamicAnchor": "meta", + + "title": "Meta-data vocabulary meta-schema", + + "type": ["object", "boolean"], + "properties": { + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "deprecated": { + "type": "boolean", + "default": false + }, + "readOnly": { + "type": "boolean", + "default": false + }, + "writeOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json new file mode 100644 index 000000000..5e4b203b2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/unevaluated.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/unevaluated", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/unevaluated": true + }, + "$dynamicAnchor": "meta", + + "title": "Unevaluated applicator vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "unevaluatedItems": {"$dynamicRef": "#meta"}, + "unevaluatedProperties": {"$dynamicRef": "#meta"} + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json new file mode 100644 index 000000000..e0ae13d9d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/meta/validation.json @@ -0,0 +1,90 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/meta/validation", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/validation": true + }, + "$dynamicAnchor": "meta", + + "title": "Validation vocabulary meta-schema", + "type": ["object", "boolean"], + "properties": { + "type": { + "anyOf": [ + {"$ref": "#/$defs/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/$defs/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "const": true, + "enum": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/$defs/nonNegativeInteger"}, + "minLength": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "maxItems": {"$ref": "#/$defs/nonNegativeInteger"}, + "minItems": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "maxContains": {"$ref": "#/$defs/nonNegativeInteger"}, + "minContains": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 1 + }, + "maxProperties": {"$ref": "#/$defs/nonNegativeInteger"}, + "minProperties": {"$ref": "#/$defs/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/$defs/stringArray"}, + "dependentRequired": { + "type": "object", + "additionalProperties": { + "$ref": "#/$defs/stringArray" + } + } + }, + "$defs": { + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "$ref": "#/$defs/nonNegativeInteger", + "default": 0 + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json new file mode 100644 index 000000000..1c68270fd --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-2020-12/schema.json @@ -0,0 +1,55 @@ +{ + "$schema": "https://json-schema.org/draft/2020-12/schema", + "$id": "https://json-schema.org/draft/2020-12/schema", + "$vocabulary": { + "https://json-schema.org/draft/2020-12/vocab/core": true, + "https://json-schema.org/draft/2020-12/vocab/applicator": true, + "https://json-schema.org/draft/2020-12/vocab/unevaluated": true, + "https://json-schema.org/draft/2020-12/vocab/validation": true, + "https://json-schema.org/draft/2020-12/vocab/meta-data": true, + "https://json-schema.org/draft/2020-12/vocab/format-annotation": true, + "https://json-schema.org/draft/2020-12/vocab/content": true + }, + "$dynamicAnchor": "meta", + + "title": "Core and Validation specifications meta-schema", + "allOf": [ + {"$ref": "meta/core"}, + {"$ref": "meta/applicator"}, + {"$ref": "meta/unevaluated"}, + {"$ref": "meta/validation"}, + {"$ref": "meta/meta-data"}, + {"$ref": "meta/format-annotation"}, + {"$ref": "meta/content"} + ], + "type": ["object", "boolean"], + "$comment": "This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.", + "properties": { + "definitions": { + "$comment": "\"definitions\" has been replaced by \"$defs\".", + "type": "object", + "additionalProperties": {"$dynamicRef": "#meta"}, + "deprecated": true, + "default": {} + }, + "dependencies": { + "$comment": "\"dependencies\" has been split and replaced by \"dependentSchemas\" and \"dependentRequired\" in order to serve their differing semantics.", + "type": "object", + "additionalProperties": { + "anyOf": [{"$dynamicRef": "#meta"}, {"$ref": "meta/validation#/$defs/stringArray"}] + }, + "deprecated": true, + "default": {} + }, + "$recursiveAnchor": { + "$comment": "\"$recursiveAnchor\" has been replaced by \"$dynamicAnchor\".", + "$ref": "meta/core#/$defs/anchorString", + "deprecated": true + }, + "$recursiveRef": { + "$comment": "\"$recursiveRef\" has been replaced by \"$dynamicRef\".", + "$ref": "meta/core#/$defs/uriReferenceString", + "deprecated": true + } + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-draft-06.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-draft-06.json new file mode 100644 index 000000000..5410064ba --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-draft-06.json @@ -0,0 +1,137 @@ +{ + "$schema": "http://json-schema.org/draft-06/schema#", + "$id": "http://json-schema.org/draft-06/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": {}, + "examples": { + "type": "array", + "items": {} + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, + "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": {"$ref": "#"}, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], + "default": {} + }, + "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, + "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": {"$ref": "#"}, + "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, + "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/definitions/stringArray"}, + "additionalProperties": {"$ref": "#"}, + "definitions": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] + } + }, + "propertyNames": {"$ref": "#"}, + "const": {}, + "enum": { + "type": "array", + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + {"$ref": "#/definitions/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/definitions/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": {"type": "string"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"} + }, + "default": {} +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-draft-07.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-draft-07.json new file mode 100644 index 000000000..6a7485104 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-draft-07.json @@ -0,0 +1,151 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "http://json-schema.org/draft-07/schema#", + "title": "Core schema meta-schema", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + }, + "nonNegativeInteger": { + "type": "integer", + "minimum": 0 + }, + "nonNegativeIntegerDefault0": { + "allOf": [{"$ref": "#/definitions/nonNegativeInteger"}, {"default": 0}] + }, + "simpleTypes": { + "enum": ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + "stringArray": { + "type": "array", + "items": {"type": "string"}, + "uniqueItems": true, + "default": [] + } + }, + "type": ["object", "boolean"], + "properties": { + "$id": { + "type": "string", + "format": "uri-reference" + }, + "$schema": { + "type": "string", + "format": "uri" + }, + "$ref": { + "type": "string", + "format": "uri-reference" + }, + "$comment": { + "type": "string" + }, + "title": { + "type": "string" + }, + "description": { + "type": "string" + }, + "default": true, + "readOnly": { + "type": "boolean", + "default": false + }, + "examples": { + "type": "array", + "items": true + }, + "multipleOf": { + "type": "number", + "exclusiveMinimum": 0 + }, + "maximum": { + "type": "number" + }, + "exclusiveMaximum": { + "type": "number" + }, + "minimum": { + "type": "number" + }, + "exclusiveMinimum": { + "type": "number" + }, + "maxLength": {"$ref": "#/definitions/nonNegativeInteger"}, + "minLength": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "pattern": { + "type": "string", + "format": "regex" + }, + "additionalItems": {"$ref": "#"}, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}], + "default": true + }, + "maxItems": {"$ref": "#/definitions/nonNegativeInteger"}, + "minItems": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "uniqueItems": { + "type": "boolean", + "default": false + }, + "contains": {"$ref": "#"}, + "maxProperties": {"$ref": "#/definitions/nonNegativeInteger"}, + "minProperties": {"$ref": "#/definitions/nonNegativeIntegerDefault0"}, + "required": {"$ref": "#/definitions/stringArray"}, + "additionalProperties": {"$ref": "#"}, + "definitions": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "properties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "default": {} + }, + "patternProperties": { + "type": "object", + "additionalProperties": {"$ref": "#"}, + "propertyNames": {"format": "regex"}, + "default": {} + }, + "dependencies": { + "type": "object", + "additionalProperties": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/stringArray"}] + } + }, + "propertyNames": {"$ref": "#"}, + "const": true, + "enum": { + "type": "array", + "items": true, + "minItems": 1, + "uniqueItems": true + }, + "type": { + "anyOf": [ + {"$ref": "#/definitions/simpleTypes"}, + { + "type": "array", + "items": {"$ref": "#/definitions/simpleTypes"}, + "minItems": 1, + "uniqueItems": true + } + ] + }, + "format": {"type": "string"}, + "contentMediaType": {"type": "string"}, + "contentEncoding": {"type": "string"}, + "if": {"$ref": "#"}, + "then": {"$ref": "#"}, + "else": {"$ref": "#"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"} + }, + "default": true +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-secure.json b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-secure.json new file mode 100644 index 000000000..3968abd5d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/json-schema-secure.json @@ -0,0 +1,88 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/json-schema-secure.json#", + "title": "Meta-schema for the security assessment of JSON Schemas", + "description": "If a JSON AnySchema fails validation against this meta-schema, it may be unsafe to validate untrusted data", + "definitions": { + "schemaArray": { + "type": "array", + "minItems": 1, + "items": {"$ref": "#"} + } + }, + "dependencies": { + "patternProperties": { + "description": "prevent slow validation of large property names", + "required": ["propertyNames"], + "properties": { + "propertyNames": { + "required": ["maxLength"] + } + } + }, + "uniqueItems": { + "description": "prevent slow validation of large non-scalar arrays", + "if": { + "properties": { + "uniqueItems": {"const": true}, + "items": { + "properties": { + "type": { + "anyOf": [ + { + "enum": ["object", "array"] + }, + { + "type": "array", + "contains": {"enum": ["object", "array"]} + } + ] + } + } + } + } + }, + "then": { + "required": ["maxItems"] + } + }, + "pattern": { + "description": "prevent slow pattern matching of large strings", + "required": ["maxLength"] + }, + "format": { + "description": "prevent slow format validation of large strings", + "required": ["maxLength"] + } + }, + "properties": { + "additionalItems": {"$ref": "#"}, + "additionalProperties": {"$ref": "#"}, + "dependencies": { + "additionalProperties": { + "anyOf": [{"type": "array"}, {"$ref": "#"}] + } + }, + "items": { + "anyOf": [{"$ref": "#"}, {"$ref": "#/definitions/schemaArray"}] + }, + "definitions": { + "additionalProperties": {"$ref": "#"} + }, + "patternProperties": { + "additionalProperties": {"$ref": "#"} + }, + "properties": { + "additionalProperties": {"$ref": "#"} + }, + "if": {"$ref": "#"}, + "then": {"$ref": "#"}, + "else": {"$ref": "#"}, + "allOf": {"$ref": "#/definitions/schemaArray"}, + "anyOf": {"$ref": "#/definitions/schemaArray"}, + "oneOf": {"$ref": "#/definitions/schemaArray"}, + "not": {"$ref": "#"}, + "contains": {"$ref": "#"}, + "propertyNames": {"$ref": "#"} + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/refs/jtd-schema.ts b/node_modules/schema-utils/node_modules/ajv/lib/refs/jtd-schema.ts new file mode 100644 index 000000000..c01981289 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/refs/jtd-schema.ts @@ -0,0 +1,130 @@ +import {SchemaObject} from "../types" + +type MetaSchema = (root: boolean) => SchemaObject + +const shared: MetaSchema = (root) => { + const sch: SchemaObject = { + nullable: {type: "boolean"}, + metadata: { + optionalProperties: { + union: {elements: {ref: "schema"}}, + }, + additionalProperties: true, + }, + } + if (root) sch.definitions = {values: {ref: "schema"}} + return sch +} + +const emptyForm: MetaSchema = (root) => ({ + optionalProperties: shared(root), +}) + +const refForm: MetaSchema = (root) => ({ + properties: { + ref: {type: "string"}, + }, + optionalProperties: shared(root), +}) + +const typeForm: MetaSchema = (root) => ({ + properties: { + type: { + enum: [ + "boolean", + "timestamp", + "string", + "float32", + "float64", + "int8", + "uint8", + "int16", + "uint16", + "int32", + "uint32", + ], + }, + }, + optionalProperties: shared(root), +}) + +const enumForm: MetaSchema = (root) => ({ + properties: { + enum: {elements: {type: "string"}}, + }, + optionalProperties: shared(root), +}) + +const elementsForm: MetaSchema = (root) => ({ + properties: { + elements: {ref: "schema"}, + }, + optionalProperties: shared(root), +}) + +const propertiesForm: MetaSchema = (root) => ({ + properties: { + properties: {values: {ref: "schema"}}, + }, + optionalProperties: { + optionalProperties: {values: {ref: "schema"}}, + additionalProperties: {type: "boolean"}, + ...shared(root), + }, +}) + +const optionalPropertiesForm: MetaSchema = (root) => ({ + properties: { + optionalProperties: {values: {ref: "schema"}}, + }, + optionalProperties: { + additionalProperties: {type: "boolean"}, + ...shared(root), + }, +}) + +const discriminatorForm: MetaSchema = (root) => ({ + properties: { + discriminator: {type: "string"}, + mapping: { + values: { + metadata: { + union: [propertiesForm(false), optionalPropertiesForm(false)], + }, + }, + }, + }, + optionalProperties: shared(root), +}) + +const valuesForm: MetaSchema = (root) => ({ + properties: { + values: {ref: "schema"}, + }, + optionalProperties: shared(root), +}) + +const schema: MetaSchema = (root) => ({ + metadata: { + union: [ + emptyForm, + refForm, + typeForm, + enumForm, + elementsForm, + propertiesForm, + optionalPropertiesForm, + discriminatorForm, + valuesForm, + ].map((s) => s(root)), + }, +}) + +const jtdMetaSchema: SchemaObject = { + definitions: { + schema: schema(false), + }, + ...schema(true), +} + +export default jtdMetaSchema diff --git a/node_modules/schema-utils/node_modules/ajv/lib/runtime/equal.ts b/node_modules/schema-utils/node_modules/ajv/lib/runtime/equal.ts new file mode 100644 index 000000000..3cb00631a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/runtime/equal.ts @@ -0,0 +1,7 @@ +// https://github.com/ajv-validator/ajv/issues/889 +import * as equal from "fast-deep-equal" + +type Equal = typeof equal & {code: string} +;(equal as Equal).code = 'require("ajv/dist/runtime/equal").default' + +export default equal as Equal diff --git a/node_modules/schema-utils/node_modules/ajv/lib/runtime/parseJson.ts b/node_modules/schema-utils/node_modules/ajv/lib/runtime/parseJson.ts new file mode 100644 index 000000000..92579afeb --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/runtime/parseJson.ts @@ -0,0 +1,176 @@ +const rxParseJson = /position\s(\d+)$/ + +export function parseJson(s: string, pos: number): unknown { + let endPos: number | undefined + parseJson.message = undefined + let matches: RegExpExecArray | null + if (pos) s = s.slice(pos) + try { + parseJson.position = pos + s.length + return JSON.parse(s) + } catch (e) { + matches = rxParseJson.exec((e as Error).message) + if (!matches) { + parseJson.message = "unexpected end" + return undefined + } + endPos = +matches[1] + const c = s[endPos] + s = s.slice(0, endPos) + parseJson.position = pos + endPos + try { + return JSON.parse(s) + } catch (e1) { + parseJson.message = `unexpected token ${c}` + return undefined + } + } +} + +parseJson.message = undefined as string | undefined +parseJson.position = 0 as number +parseJson.code = 'require("ajv/dist/runtime/parseJson").parseJson' + +export function parseJsonNumber(s: string, pos: number, maxDigits?: number): number | undefined { + let numStr = "" + let c: string + parseJsonNumber.message = undefined + if (s[pos] === "-") { + numStr += "-" + pos++ + } + if (s[pos] === "0") { + numStr += "0" + pos++ + } else { + if (!parseDigits(maxDigits)) { + errorMessage() + return undefined + } + } + if (maxDigits) { + parseJsonNumber.position = pos + return +numStr + } + if (s[pos] === ".") { + numStr += "." + pos++ + if (!parseDigits()) { + errorMessage() + return undefined + } + } + if (((c = s[pos]), c === "e" || c === "E")) { + numStr += "e" + pos++ + if (((c = s[pos]), c === "+" || c === "-")) { + numStr += c + pos++ + } + if (!parseDigits()) { + errorMessage() + return undefined + } + } + parseJsonNumber.position = pos + return +numStr + + function parseDigits(maxLen?: number): boolean { + let digit = false + while (((c = s[pos]), c >= "0" && c <= "9" && (maxLen === undefined || maxLen-- > 0))) { + digit = true + numStr += c + pos++ + } + return digit + } + + function errorMessage(): void { + parseJsonNumber.position = pos + parseJsonNumber.message = pos < s.length ? `unexpected token ${s[pos]}` : "unexpected end" + } +} + +parseJsonNumber.message = undefined as string | undefined +parseJsonNumber.position = 0 as number +parseJsonNumber.code = 'require("ajv/dist/runtime/parseJson").parseJsonNumber' + +const escapedChars: {[X in string]?: string} = { + b: "\b", + f: "\f", + n: "\n", + r: "\r", + t: "\t", + '"': '"', + "/": "/", + "\\": "\\", +} + +const CODE_A: number = "a".charCodeAt(0) +const CODE_0: number = "0".charCodeAt(0) + +export function parseJsonString(s: string, pos: number): string | undefined { + let str = "" + let c: string | undefined + parseJsonString.message = undefined + // eslint-disable-next-line no-constant-condition, @typescript-eslint/no-unnecessary-condition + while (true) { + c = s[pos++] + if (c === '"') break + if (c === "\\") { + c = s[pos] + if (c in escapedChars) { + str += escapedChars[c] + pos++ + } else if (c === "u") { + pos++ + let count = 4 + let code = 0 + while (count--) { + code <<= 4 + c = s[pos] + if (c === undefined) { + errorMessage("unexpected end") + return undefined + } + c = c.toLowerCase() + if (c >= "a" && c <= "f") { + code += c.charCodeAt(0) - CODE_A + 10 + } else if (c >= "0" && c <= "9") { + code += c.charCodeAt(0) - CODE_0 + } else { + errorMessage(`unexpected token ${c}`) + return undefined + } + pos++ + } + str += String.fromCharCode(code) + } else { + errorMessage(`unexpected token ${c}`) + return undefined + } + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + } else if (c === undefined) { + errorMessage("unexpected end") + return undefined + } else { + if (c.charCodeAt(0) >= 0x20) { + str += c + } else { + errorMessage(`unexpected token ${c}`) + return undefined + } + } + } + parseJsonString.position = pos + return str + + function errorMessage(msg: string): void { + parseJsonString.position = pos + parseJsonString.message = msg + } +} + +parseJsonString.message = undefined as string | undefined +parseJsonString.position = 0 as number +parseJsonString.code = 'require("ajv/dist/runtime/parseJson").parseJsonString' diff --git a/node_modules/schema-utils/node_modules/ajv/lib/runtime/quote.ts b/node_modules/schema-utils/node_modules/ajv/lib/runtime/quote.ts new file mode 100644 index 000000000..1160e6a23 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/runtime/quote.ts @@ -0,0 +1,31 @@ +const rxEscapable = + // eslint-disable-next-line no-control-regex, no-misleading-character-class + /[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g + +const escaped: {[K in string]?: string} = { + "\b": "\\b", + "\t": "\\t", + "\n": "\\n", + "\f": "\\f", + "\r": "\\r", + '"': '\\"', + "\\": "\\\\", +} + +export default function quote(s: string): string { + rxEscapable.lastIndex = 0 + return ( + '"' + + (rxEscapable.test(s) + ? s.replace(rxEscapable, (a) => { + const c = escaped[a] + return typeof c === "string" + ? c + : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4) + }) + : s) + + '"' + ) +} + +quote.code = 'require("ajv/dist/runtime/quote").default' diff --git a/node_modules/schema-utils/node_modules/ajv/lib/runtime/re2.ts b/node_modules/schema-utils/node_modules/ajv/lib/runtime/re2.ts new file mode 100644 index 000000000..0c769bc7a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/runtime/re2.ts @@ -0,0 +1,6 @@ +import * as re2 from "re2" + +type Re2 = typeof re2 & {code: string} +;(re2 as Re2).code = 'require("ajv/dist/runtime/re2").default' + +export default re2 as Re2 diff --git a/node_modules/schema-utils/node_modules/ajv/lib/runtime/timestamp.ts b/node_modules/schema-utils/node_modules/ajv/lib/runtime/timestamp.ts new file mode 100644 index 000000000..1625f9a40 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/runtime/timestamp.ts @@ -0,0 +1,46 @@ +const DT_SEPARATOR = /t|\s/i +const DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/ +const TIME = /^(\d\d):(\d\d):(\d\d)(?:\.\d+)?(?:z|([+-]\d\d)(?::?(\d\d))?)$/i +const DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] + +export default function validTimestamp(str: string, allowDate: boolean): boolean { + // http://tools.ietf.org/html/rfc3339#section-5.6 + const dt: string[] = str.split(DT_SEPARATOR) + return ( + (dt.length === 2 && validDate(dt[0]) && validTime(dt[1])) || + (allowDate && dt.length === 1 && validDate(dt[0])) + ) +} + +function validDate(str: string): boolean { + const matches: string[] | null = DATE.exec(str) + if (!matches) return false + const y: number = +matches[1] + const m: number = +matches[2] + const d: number = +matches[3] + return ( + m >= 1 && + m <= 12 && + d >= 1 && + (d <= DAYS[m] || + // leap year: https://tools.ietf.org/html/rfc3339#appendix-C + (m === 2 && d === 29 && (y % 100 === 0 ? y % 400 === 0 : y % 4 === 0))) + ) +} + +function validTime(str: string): boolean { + const matches: string[] | null = TIME.exec(str) + if (!matches) return false + const hr: number = +matches[1] + const min: number = +matches[2] + const sec: number = +matches[3] + const tzH: number = +(matches[4] || 0) + const tzM: number = +(matches[5] || 0) + return ( + (hr <= 23 && min <= 59 && sec <= 59) || + // leap second + (hr - tzH === 23 && min - tzM === 59 && sec === 60) + ) +} + +validTimestamp.code = 'require("ajv/dist/runtime/timestamp").default' diff --git a/node_modules/schema-utils/node_modules/ajv/lib/runtime/ucs2length.ts b/node_modules/schema-utils/node_modules/ajv/lib/runtime/ucs2length.ts new file mode 100644 index 000000000..47d8292b8 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/runtime/ucs2length.ts @@ -0,0 +1,20 @@ +// https://mathiasbynens.be/notes/javascript-encoding +// https://github.com/bestiejs/punycode.js - punycode.ucs2.decode +export default function ucs2length(str: string): number { + const len = str.length + let length = 0 + let pos = 0 + let value: number + while (pos < len) { + length++ + value = str.charCodeAt(pos++) + if (value >= 0xd800 && value <= 0xdbff && pos < len) { + // high surrogate, and there is a next character + value = str.charCodeAt(pos) + if ((value & 0xfc00) === 0xdc00) pos++ // low surrogate + } + } + return length +} + +ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default' diff --git a/node_modules/schema-utils/node_modules/ajv/lib/runtime/uri.ts b/node_modules/schema-utils/node_modules/ajv/lib/runtime/uri.ts new file mode 100644 index 000000000..7dd35f9d1 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/runtime/uri.ts @@ -0,0 +1,6 @@ +import * as uri from "uri-js" + +type URI = typeof uri & {code: string} +;(uri as URI).code = 'require("ajv/dist/runtime/uri").default' + +export default uri as URI diff --git a/node_modules/schema-utils/node_modules/ajv/lib/runtime/validation_error.ts b/node_modules/schema-utils/node_modules/ajv/lib/runtime/validation_error.ts new file mode 100644 index 000000000..2d19a46a2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/runtime/validation_error.ts @@ -0,0 +1,13 @@ +import type {ErrorObject} from "../types" + +export default class ValidationError extends Error { + readonly errors: Partial[] + readonly ajv: true + readonly validation: true + + constructor(errors: Partial[]) { + super("validation failed") + this.errors = errors + this.ajv = this.validation = true + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/standalone/index.ts b/node_modules/schema-utils/node_modules/ajv/lib/standalone/index.ts new file mode 100644 index 000000000..b6129ce9e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/standalone/index.ts @@ -0,0 +1,100 @@ +import type AjvCore from "../core" +import type {AnyValidateFunction, SourceCode} from "../types" +import type {SchemaEnv} from "../compile" +import {UsedScopeValues, UsedValueState, ValueScopeName, varKinds} from "../compile/codegen/scope" +import {_, nil, _Code, Code, getProperty, getEsmExportName} from "../compile/codegen/code" + +function standaloneCode( + ajv: AjvCore, + refsOrFunc?: {[K in string]?: string} | AnyValidateFunction +): string { + if (!ajv.opts.code.source) { + throw new Error("moduleCode: ajv instance must have code.source option") + } + const {_n} = ajv.scope.opts + return typeof refsOrFunc == "function" + ? funcExportCode(refsOrFunc.source) + : refsOrFunc !== undefined + ? multiExportsCode(refsOrFunc, getValidate) + : multiExportsCode(ajv.schemas, (sch) => + sch.meta ? undefined : ajv.compile(sch.schema) + ) + + function getValidate(id: string): AnyValidateFunction { + const v = ajv.getSchema(id) + if (!v) throw new Error(`moduleCode: no schema with id ${id}`) + return v + } + + function funcExportCode(source?: SourceCode): string { + const usedValues: UsedScopeValues = {} + const n = source?.validateName + const vCode = validateCode(usedValues, source) + if (ajv.opts.code.esm) { + // Always do named export as `validate` rather than the variable `n` which is `validateXX` for known export value + return `"use strict";${_n}export const validate = ${n};${_n}export default ${n};${_n}${vCode}` + } + return `"use strict";${_n}module.exports = ${n};${_n}module.exports.default = ${n};${_n}${vCode}` + } + + function multiExportsCode( + schemas: {[K in string]?: T}, + getValidateFunc: (schOrId: T) => AnyValidateFunction | undefined + ): string { + const usedValues: UsedScopeValues = {} + let code = _`"use strict";` + for (const name in schemas) { + const v = getValidateFunc(schemas[name] as T) + if (v) { + const vCode = validateCode(usedValues, v.source) + const exportSyntax = ajv.opts.code.esm + ? _`export const ${getEsmExportName(name)}` + : _`exports${getProperty(name)}` + code = _`${code}${_n}${exportSyntax} = ${v.source?.validateName};${_n}${vCode}` + } + } + return `${code}` + } + + function validateCode(usedValues: UsedScopeValues, s?: SourceCode): Code { + if (!s) throw new Error('moduleCode: function does not have "source" property') + if (usedState(s.validateName) === UsedValueState.Completed) return nil + setUsedState(s.validateName, UsedValueState.Started) + + const scopeCode = ajv.scope.scopeCode(s.scopeValues, usedValues, refValidateCode) + const code = new _Code(`${scopeCode}${_n}${s.validateCode}`) + return s.evaluated ? _`${code}${s.validateName}.evaluated = ${s.evaluated};${_n}` : code + + function refValidateCode(n: ValueScopeName): Code | undefined { + const vRef = n.value?.ref + if (n.prefix === "validate" && typeof vRef == "function") { + const v = vRef as AnyValidateFunction + return validateCode(usedValues, v.source) + } else if ((n.prefix === "root" || n.prefix === "wrapper") && typeof vRef == "object") { + const {validate, validateName} = vRef as SchemaEnv + if (!validateName) throw new Error("ajv internal error") + const def = ajv.opts.code.es5 ? varKinds.var : varKinds.const + const wrapper = _`${def} ${n} = {validate: ${validateName}};` + if (usedState(validateName) === UsedValueState.Started) return wrapper + const vCode = validateCode(usedValues, validate?.source) + return _`${wrapper}${_n}${vCode}` + } + return undefined + } + + function usedState(name: ValueScopeName): UsedValueState | undefined { + return usedValues[name.prefix]?.get(name) + } + + function setUsedState(name: ValueScopeName, state: UsedValueState): void { + const {prefix} = name + const names = (usedValues[prefix] = usedValues[prefix] || new Map()) + names.set(name, state) + } + } +} + +module.exports = exports = standaloneCode +Object.defineProperty(exports, "__esModule", {value: true}) + +export default standaloneCode diff --git a/node_modules/schema-utils/node_modules/ajv/lib/standalone/instance.ts b/node_modules/schema-utils/node_modules/ajv/lib/standalone/instance.ts new file mode 100644 index 000000000..c4b2c30b5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/standalone/instance.ts @@ -0,0 +1,36 @@ +import Ajv, {AnySchema, AnyValidateFunction, ErrorObject} from "../core" +import standaloneCode from "." +import * as requireFromString from "require-from-string" + +export default class AjvPack { + errors?: ErrorObject[] | null // errors from the last validation + constructor(readonly ajv: Ajv) {} + + validate(schemaKeyRef: AnySchema | string, data: unknown): boolean | Promise { + return Ajv.prototype.validate.call(this, schemaKeyRef, data) + } + + compile(schema: AnySchema, meta?: boolean): AnyValidateFunction { + return this.getStandalone(this.ajv.compile(schema, meta)) + } + + getSchema(keyRef: string): AnyValidateFunction | undefined { + const v = this.ajv.getSchema(keyRef) + if (!v) return undefined + return this.getStandalone(v) + } + + private getStandalone(v: AnyValidateFunction): AnyValidateFunction { + return requireFromString(standaloneCode(this.ajv, v)) as AnyValidateFunction + } + + addSchema(...args: Parameters): AjvPack { + this.ajv.addSchema.call(this.ajv, ...args) + return this + } + + addKeyword(...args: Parameters): AjvPack { + this.ajv.addKeyword.call(this.ajv, ...args) + return this + } +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/types/index.ts b/node_modules/schema-utils/node_modules/ajv/lib/types/index.ts new file mode 100644 index 000000000..123d9df16 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/types/index.ts @@ -0,0 +1,240 @@ +import * as URI from "uri-js" +import type {CodeGen, Code, Name, ScopeValueSets, ValueScopeName} from "../compile/codegen" +import type {SchemaEnv, SchemaCxt, SchemaObjCxt} from "../compile" +import type {JSONType} from "../compile/rules" +import type {KeywordCxt} from "../compile/validate" +import type Ajv from "../core" + +interface _SchemaObject { + id?: string + $id?: string + $schema?: string + [x: string]: any // TODO +} + +export interface SchemaObject extends _SchemaObject { + id?: string + $id?: string + $schema?: string + $async?: false + [x: string]: any // TODO +} + +export interface AsyncSchema extends _SchemaObject { + $async: true +} + +export type AnySchemaObject = SchemaObject | AsyncSchema + +export type Schema = SchemaObject | boolean + +export type AnySchema = Schema | AsyncSchema + +export type SchemaMap = {[Key in string]?: AnySchema} + +export interface SourceCode { + validateName: ValueScopeName + validateCode: string + scopeValues: ScopeValueSets + evaluated?: Code +} + +export interface DataValidationCxt { + instancePath: string + parentData: {[K in T]: any} // object or array + parentDataProperty: T // string or number + rootData: Record | any[] + dynamicAnchors: {[Ref in string]?: ValidateFunction} +} + +export interface ValidateFunction { + (this: Ajv | any, data: any, dataCxt?: DataValidationCxt): data is T + errors?: null | ErrorObject[] + evaluated?: Evaluated + schema: AnySchema + schemaEnv: SchemaEnv + source?: SourceCode +} + +export interface JTDParser { + (json: string): T | undefined + message?: string + position?: number +} + +export type EvaluatedProperties = {[K in string]?: true} | true + +export type EvaluatedItems = number | true + +export interface Evaluated { + // determined at compile time if staticProps/Items is true + props?: EvaluatedProperties + items?: EvaluatedItems + // whether props/items determined at compile time + dynamicProps: boolean + dynamicItems: boolean +} + +export interface AsyncValidateFunction extends ValidateFunction { + (...args: Parameters>): Promise + $async: true +} + +export type AnyValidateFunction = ValidateFunction | AsyncValidateFunction + +export interface ErrorObject, S = unknown> { + keyword: K + instancePath: string + schemaPath: string + params: P + // Added to validation errors of "propertyNames" keyword schema + propertyName?: string + // Excluded if option `messages` set to false. + message?: string + // These are added with the `verbose` option. + schema?: S + parentSchema?: AnySchemaObject + data?: unknown +} + +export type ErrorNoParams = ErrorObject, S> + +interface _KeywordDef { + keyword: string | string[] + type?: JSONType | JSONType[] // data types that keyword applies to + schemaType?: JSONType | JSONType[] // allowed type(s) of keyword value in the schema + allowUndefined?: boolean // used for keywords that can be invoked by other keywords, not being present in the schema + $data?: boolean // keyword supports [$data reference](../../docs/guide/combining-schemas.md#data-reference) + implements?: string[] // other schema keywords that this keyword implements + before?: string // keyword should be executed before this keyword (should be applicable to the same type) + post?: boolean // keyword should be executed after other keywords without post flag + metaSchema?: AnySchemaObject // meta-schema for keyword schema value - it is better to use schemaType where applicable + validateSchema?: AnyValidateFunction // compiled keyword metaSchema - should not be passed + dependencies?: string[] // keywords that must be present in the same schema + error?: KeywordErrorDefinition + $dataError?: KeywordErrorDefinition +} + +export interface CodeKeywordDefinition extends _KeywordDef { + code: (cxt: KeywordCxt, ruleType?: string) => void + trackErrors?: boolean +} + +export type MacroKeywordFunc = ( + schema: any, + parentSchema: AnySchemaObject, + it: SchemaCxt +) => AnySchema + +export type CompileKeywordFunc = ( + schema: any, + parentSchema: AnySchemaObject, + it: SchemaObjCxt +) => DataValidateFunction + +export interface DataValidateFunction { + (...args: Parameters): boolean | Promise + errors?: Partial[] +} + +export interface SchemaValidateFunction { + (schema: any, data: any, parentSchema?: AnySchemaObject, dataCxt?: DataValidationCxt): + | boolean + | Promise + errors?: Partial[] +} + +export interface FuncKeywordDefinition extends _KeywordDef { + validate?: SchemaValidateFunction | DataValidateFunction + compile?: CompileKeywordFunc + // schema: false makes validate not to expect schema (DataValidateFunction) + schema?: boolean // requires "validate" + modifying?: boolean + async?: boolean + valid?: boolean + errors?: boolean | "full" +} + +export interface MacroKeywordDefinition extends FuncKeywordDefinition { + macro: MacroKeywordFunc +} + +export type KeywordDefinition = + | CodeKeywordDefinition + | FuncKeywordDefinition + | MacroKeywordDefinition + +export type AddedKeywordDefinition = KeywordDefinition & { + type: JSONType[] + schemaType: JSONType[] +} + +export interface KeywordErrorDefinition { + message: string | Code | ((cxt: KeywordErrorCxt) => string | Code) + params?: Code | ((cxt: KeywordErrorCxt) => Code) +} + +export type Vocabulary = (KeywordDefinition | string)[] + +export interface KeywordErrorCxt { + gen: CodeGen + keyword: string + data: Name + $data?: string | false + schema: any // TODO + parentSchema?: AnySchemaObject + schemaCode: Code | number | boolean + schemaValue: Code | number | boolean + schemaType?: JSONType[] + errsCount?: Name + params: KeywordCxtParams + it: SchemaCxt +} + +export type KeywordCxtParams = {[P in string]?: Code | string | number} + +export type FormatValidator = (data: T) => boolean + +export type FormatCompare = (data1: T, data2: T) => number | undefined + +export type AsyncFormatValidator = (data: T) => Promise + +export interface FormatDefinition { + type?: T extends string ? "string" | undefined : "number" + validate: FormatValidator | (T extends string ? string | RegExp : never) + async?: false | undefined + compare?: FormatCompare +} + +export interface AsyncFormatDefinition { + type?: T extends string ? "string" | undefined : "number" + validate: AsyncFormatValidator + async: true + compare?: FormatCompare +} + +export type AddedFormat = + | true + | RegExp + | FormatValidator + | FormatDefinition + | FormatDefinition + | AsyncFormatDefinition + | AsyncFormatDefinition + +export type Format = AddedFormat | string + +export interface RegExpEngine { + (pattern: string, u: string): RegExpLike + code: string +} + +export interface RegExpLike { + test: (s: string) => boolean +} + +export interface UriResolver { + parse(uri: string): URI.URIComponents + resolve(base: string, path: string): string + serialize(component: URI.URIComponents): string +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/types/json-schema.ts b/node_modules/schema-utils/node_modules/ajv/lib/types/json-schema.ts new file mode 100644 index 000000000..698e29116 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/types/json-schema.ts @@ -0,0 +1,186 @@ +/* eslint-disable @typescript-eslint/no-empty-interface */ +type StrictNullChecksWrapper = undefined extends null + ? `strictNullChecks must be true in tsconfig to use ${Name}` + : Type + +type UnionToIntersection = (U extends any ? (_: U) => void : never) extends (_: infer I) => void + ? I + : never + +export type SomeJSONSchema = UncheckedJSONSchemaType + +type UncheckedPartialSchema = Partial> + +export type PartialSchema = StrictNullChecksWrapper<"PartialSchema", UncheckedPartialSchema> + +type JSONType = IsPartial extends true + ? T | undefined + : T + +interface NumberKeywords { + minimum?: number + maximum?: number + exclusiveMinimum?: number + exclusiveMaximum?: number + multipleOf?: number + format?: string +} + +interface StringKeywords { + minLength?: number + maxLength?: number + pattern?: string + format?: string +} + +type UncheckedJSONSchemaType = ( + | // these two unions allow arbitrary unions of types + { + anyOf: readonly UncheckedJSONSchemaType[] + } + | { + oneOf: readonly UncheckedJSONSchemaType[] + } + // this union allows for { type: (primitive)[] } style schemas + | ({ + type: readonly (T extends number + ? JSONType<"number" | "integer", IsPartial> + : T extends string + ? JSONType<"string", IsPartial> + : T extends boolean + ? JSONType<"boolean", IsPartial> + : never)[] + } & UnionToIntersection< + T extends number + ? NumberKeywords + : T extends string + ? StringKeywords + : T extends boolean + ? // eslint-disable-next-line @typescript-eslint/ban-types + {} + : never + >) + // this covers "normal" types; it's last so typescript looks to it first for errors + | ((T extends number + ? { + type: JSONType<"number" | "integer", IsPartial> + } & NumberKeywords + : T extends string + ? { + type: JSONType<"string", IsPartial> + } & StringKeywords + : T extends boolean + ? { + type: JSONType<"boolean", IsPartial> + } + : T extends readonly [any, ...any[]] + ? { + // JSON AnySchema for tuple + type: JSONType<"array", IsPartial> + items: { + readonly [K in keyof T]-?: UncheckedJSONSchemaType & Nullable + } & {length: T["length"]} + minItems: T["length"] + } & ({maxItems: T["length"]} | {additionalItems: false}) + : T extends readonly any[] + ? { + type: JSONType<"array", IsPartial> + items: UncheckedJSONSchemaType + contains?: UncheckedPartialSchema + minItems?: number + maxItems?: number + minContains?: number + maxContains?: number + uniqueItems?: true + additionalItems?: never + } + : T extends Record + ? { + // JSON AnySchema for records and dictionaries + // "required" is not optional because it is often forgotten + // "properties" are optional for more concise dictionary schemas + // "patternProperties" and can be only used with interfaces that have string index + type: JSONType<"object", IsPartial> + additionalProperties?: boolean | UncheckedJSONSchemaType + unevaluatedProperties?: boolean | UncheckedJSONSchemaType + properties?: IsPartial extends true + ? Partial> + : UncheckedPropertiesSchema + patternProperties?: Record> + propertyNames?: Omit, "type"> & {type?: "string"} + dependencies?: {[K in keyof T]?: Readonly<(keyof T)[]> | UncheckedPartialSchema} + dependentRequired?: {[K in keyof T]?: Readonly<(keyof T)[]>} + dependentSchemas?: {[K in keyof T]?: UncheckedPartialSchema} + minProperties?: number + maxProperties?: number + } & (IsPartial extends true // "required" is not necessary if it's a non-partial type with no required keys // are listed it only asserts that optional cannot be listed. // "required" type does not guarantee that all required properties + ? {required: Readonly<(keyof T)[]>} + : [UncheckedRequiredMembers] extends [never] + ? {required?: Readonly[]>} + : {required: Readonly[]>}) + : T extends null + ? { + type: JSONType<"null", IsPartial> + nullable: true + } + : never) & { + allOf?: Readonly[]> + anyOf?: Readonly[]> + oneOf?: Readonly[]> + if?: UncheckedPartialSchema + then?: UncheckedPartialSchema + else?: UncheckedPartialSchema + not?: UncheckedPartialSchema + }) +) & { + [keyword: string]: any + $id?: string + $ref?: string + $defs?: Record> + definitions?: Record> +} + +export type JSONSchemaType = StrictNullChecksWrapper< + "JSONSchemaType", + UncheckedJSONSchemaType +> + +type Known = + | {[key: string]: Known} + | [Known, ...Known[]] + | Known[] + | number + | string + | boolean + | null + +type UncheckedPropertiesSchema = { + [K in keyof T]-?: (UncheckedJSONSchemaType & Nullable) | {$ref: string} +} + +export type PropertiesSchema = StrictNullChecksWrapper< + "PropertiesSchema", + UncheckedPropertiesSchema +> + +type UncheckedRequiredMembers = { + [K in keyof T]-?: undefined extends T[K] ? never : K +}[keyof T] + +export type RequiredMembers = StrictNullChecksWrapper< + "RequiredMembers", + UncheckedRequiredMembers +> + +type Nullable = undefined extends T + ? { + nullable: true + const?: null // any non-null value would fail `const: null`, `null` would fail any other value in const + enum?: Readonly<(T | null)[]> // `null` must be explicitly included in "enum" for `null` to pass + default?: T | null + } + : { + const?: T + enum?: Readonly + default?: T + } diff --git a/node_modules/schema-utils/node_modules/ajv/lib/types/jtd-schema.ts b/node_modules/schema-utils/node_modules/ajv/lib/types/jtd-schema.ts new file mode 100644 index 000000000..3d5ae4ac9 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/types/jtd-schema.ts @@ -0,0 +1,263 @@ +/** numeric strings */ +type NumberType = "float32" | "float64" | "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32" + +/** string strings */ +type StringType = "string" | "timestamp" + +/** Generic JTD Schema without inference of the represented type */ +export type SomeJTDSchemaType = ( + | // ref + {ref: string} + // primitives + | {type: NumberType | StringType | "boolean"} + // enum + | {enum: string[]} + // elements + | {elements: SomeJTDSchemaType} + // values + | {values: SomeJTDSchemaType} + // properties + | { + properties: Record + optionalProperties?: Record + additionalProperties?: boolean + } + | { + properties?: Record + optionalProperties: Record + additionalProperties?: boolean + } + // discriminator + | {discriminator: string; mapping: Record} + // empty + // NOTE see the end of + // https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-675156492 + // eslint-disable-next-line @typescript-eslint/ban-types + | {} +) & { + nullable?: boolean + metadata?: Record + definitions?: Record +} + +/** required keys of an object, not undefined */ +type RequiredKeys = { + [K in keyof T]-?: undefined extends T[K] ? never : K +}[keyof T] + +/** optional or undifined-able keys of an object */ +type OptionalKeys = { + [K in keyof T]-?: undefined extends T[K] ? K : never +}[keyof T] + +/** type is true if T is a union type */ +type IsUnion_ = false extends ( + T extends unknown ? ([U] extends [T] ? false : true) : never +) + ? false + : true +type IsUnion = IsUnion_ + +/** type is true if T is identically E */ +type TypeEquality = [T] extends [E] ? ([E] extends [T] ? true : false) : false + +/** type is true if T or null is identically E or null*/ +type NullTypeEquality = TypeEquality + +/** gets only the string literals of a type or null if a type isn't a string literal */ +type EnumString = [T] extends [never] + ? null + : T extends string + ? string extends T + ? null + : T + : null + +/** true if type is a union of string literals */ +type IsEnum = null extends EnumString> ? false : true + +/** true only if all types are array types (not tuples) */ +// NOTE relies on the fact that tuples don't have an index at 0.5, but arrays +// have an index at every number +type IsElements = false extends IsUnion + ? [T] extends [readonly unknown[]] + ? undefined extends T[0.5] + ? false + : true + : false + : false + +/** true if the the type is a values type */ +type IsValues = false extends IsUnion> + ? TypeEquality, string> + : false + +/** true if type is a proeprties type and Union is false, or type is a discriminator type and Union is true */ +type IsRecord = Union extends IsUnion> + ? null extends EnumString> + ? false + : true + : false + +/** actual schema */ +export type JTDSchemaType = Record> = ( + | // refs - where null wasn't specified, must match exactly + (null extends EnumString + ? never + : + | ({[K in keyof D]: [T] extends [D[K]] ? {ref: K} : never}[keyof D] & {nullable?: false}) + // nulled refs - if ref is nullable and nullable is specified, then it can + // match either null or non-null definitions + | (null extends T + ? { + [K in keyof D]: [Exclude] extends [Exclude] + ? {ref: K} + : never + }[keyof D] & {nullable: true} + : never)) + // empty - empty schemas also treat nullable differently in that it's now fully ignored + | (unknown extends T ? {nullable?: boolean} : never) + // all other types // numbers - only accepts the type number + | ((true extends NullTypeEquality + ? {type: NumberType} + : // booleans - accepts the type boolean + true extends NullTypeEquality + ? {type: "boolean"} + : // strings - only accepts the type string + true extends NullTypeEquality + ? {type: StringType} + : // strings - only accepts the type Date + true extends NullTypeEquality + ? {type: "timestamp"} + : // enums - only accepts union of string literals + // TODO we can't actually check that everything in the union was specified + true extends IsEnum + ? {enum: EnumString>[]} + : // arrays - only accepts arrays, could be array of unions to be resolved later + true extends IsElements> + ? T extends readonly (infer E)[] + ? { + elements: JTDSchemaType + } + : never + : // values + true extends IsValues + ? T extends Record + ? { + values: JTDSchemaType + } + : never + : // properties + true extends IsRecord + ? ([RequiredKeys>] extends [never] + ? { + properties?: Record + } + : { + properties: {[K in RequiredKeys]: JTDSchemaType} + }) & + ([OptionalKeys>] extends [never] + ? { + optionalProperties?: Record + } + : { + optionalProperties: { + [K in OptionalKeys]: JTDSchemaType, D> + } + }) & { + additionalProperties?: boolean + } + : // discriminator + true extends IsRecord + ? { + [K in keyof Exclude]-?: Exclude[K] extends string + ? { + discriminator: K + mapping: { + // TODO currently allows descriminator to be present in schema + [M in Exclude[K]]: JTDSchemaType< + Omit, + D + > + } + } + : never + }[keyof Exclude] + : never) & + (null extends T + ? { + nullable: true + } + : {nullable?: false})) +) & { + // extra properties + metadata?: Record + // TODO these should only be allowed at the top level + definitions?: {[K in keyof D]: JTDSchemaType} +} + +type JTDDataDef> = + | // ref + (S extends {ref: string} + ? D extends {[K in S["ref"]]: infer V} + ? JTDDataDef + : never + : // type + S extends {type: NumberType} + ? number + : S extends {type: "boolean"} + ? boolean + : S extends {type: "string"} + ? string + : S extends {type: "timestamp"} + ? string | Date + : // enum + S extends {enum: readonly (infer E)[]} + ? string extends E + ? never + : [E] extends [string] + ? E + : never + : // elements + S extends {elements: infer E} + ? JTDDataDef[] + : // properties + S extends { + properties: Record + optionalProperties?: Record + additionalProperties?: boolean + } + ? {-readonly [K in keyof S["properties"]]-?: JTDDataDef} & { + -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef< + S["optionalProperties"][K], + D + > + } & ([S["additionalProperties"]] extends [true] ? Record : unknown) + : S extends { + properties?: Record + optionalProperties: Record + additionalProperties?: boolean + } + ? {-readonly [K in keyof S["properties"]]-?: JTDDataDef} & { + -readonly [K in keyof S["optionalProperties"]]+?: JTDDataDef< + S["optionalProperties"][K], + D + > + } & ([S["additionalProperties"]] extends [true] ? Record : unknown) + : // values + S extends {values: infer V} + ? Record> + : // discriminator + S extends {discriminator: infer M; mapping: Record} + ? [M] extends [string] + ? { + [K in keyof S["mapping"]]: JTDDataDef & {[KM in M]: K} + }[keyof S["mapping"]] + : never + : // empty + unknown) + | (S extends {nullable: true} ? null : never) + +export type JTDDataType = S extends {definitions: Record} + ? JTDDataDef + : JTDDataDef> diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts new file mode 100644 index 000000000..755e5b3da --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/additionalItems.ts @@ -0,0 +1,56 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, not, Name} from "../../compile/codegen" +import {alwaysValidSchema, checkStrictMode, Type} from "../../compile/util" + +export type AdditionalItemsError = ErrorObject<"additionalItems", {limit: number}, AnySchema> + +const error: KeywordErrorDefinition = { + message: ({params: {len}}) => str`must NOT have more than ${len} items`, + params: ({params: {len}}) => _`{limit: ${len}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "additionalItems" as const, + type: "array", + schemaType: ["boolean", "object"], + before: "uniqueItems", + error, + code(cxt: KeywordCxt) { + const {parentSchema, it} = cxt + const {items} = parentSchema + if (!Array.isArray(items)) { + checkStrictMode(it, '"additionalItems" is ignored when "items" is not an array of schemas') + return + } + validateAdditionalItems(cxt, items) + }, +} + +export function validateAdditionalItems(cxt: KeywordCxt, items: AnySchema[]): void { + const {gen, schema, data, keyword, it} = cxt + it.items = true + const len = gen.const("len", _`${data}.length`) + if (schema === false) { + cxt.setParams({len: items.length}) + cxt.pass(_`${len} <= ${items.length}`) + } else if (typeof schema == "object" && !alwaysValidSchema(it, schema)) { + const valid = gen.var("valid", _`${len} <= ${items.length}`) // TODO var + gen.if(not(valid), () => validateItems(valid)) + cxt.ok(valid) + } + + function validateItems(valid: Name): void { + gen.forRange("i", items.length, len, (i) => { + cxt.subschema({keyword, dataProp: i, dataPropType: Type.Num}, valid) + if (!it.allErrors) gen.if(not(valid), () => gen.break()) + }) + } +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts new file mode 100644 index 000000000..bfb511ce5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/additionalProperties.ts @@ -0,0 +1,118 @@ +import type { + CodeKeywordDefinition, + AddedKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import {allSchemaProperties, usePattern, isOwnProperty} from "../code" +import {_, nil, or, not, Code, Name} from "../../compile/codegen" +import N from "../../compile/names" +import type {SubschemaArgs} from "../../compile/validate/subschema" +import {alwaysValidSchema, schemaRefOrVal, Type} from "../../compile/util" + +export type AdditionalPropertiesError = ErrorObject< + "additionalProperties", + {additionalProperty: string}, + AnySchema +> + +const error: KeywordErrorDefinition = { + message: "must NOT have additional properties", + params: ({params}) => _`{additionalProperty: ${params.additionalProperty}}`, +} + +const def: CodeKeywordDefinition & AddedKeywordDefinition = { + keyword: "additionalProperties", + type: ["object"], + schemaType: ["boolean", "object"], + allowUndefined: true, + trackErrors: true, + error, + code(cxt) { + const {gen, schema, parentSchema, data, errsCount, it} = cxt + /* istanbul ignore if */ + if (!errsCount) throw new Error("ajv implementation error") + const {allErrors, opts} = it + it.props = true + if (opts.removeAdditional !== "all" && alwaysValidSchema(it, schema)) return + const props = allSchemaProperties(parentSchema.properties) + const patProps = allSchemaProperties(parentSchema.patternProperties) + checkAdditionalProperties() + cxt.ok(_`${errsCount} === ${N.errors}`) + + function checkAdditionalProperties(): void { + gen.forIn("key", data, (key: Name) => { + if (!props.length && !patProps.length) additionalPropertyCode(key) + else gen.if(isAdditional(key), () => additionalPropertyCode(key)) + }) + } + + function isAdditional(key: Name): Code { + let definedProp: Code + if (props.length > 8) { + // TODO maybe an option instead of hard-coded 8? + const propsSchema = schemaRefOrVal(it, parentSchema.properties, "properties") + definedProp = isOwnProperty(gen, propsSchema as Code, key) + } else if (props.length) { + definedProp = or(...props.map((p) => _`${key} === ${p}`)) + } else { + definedProp = nil + } + if (patProps.length) { + definedProp = or(definedProp, ...patProps.map((p) => _`${usePattern(cxt, p)}.test(${key})`)) + } + return not(definedProp) + } + + function deleteAdditional(key: Name): void { + gen.code(_`delete ${data}[${key}]`) + } + + function additionalPropertyCode(key: Name): void { + if (opts.removeAdditional === "all" || (opts.removeAdditional && schema === false)) { + deleteAdditional(key) + return + } + + if (schema === false) { + cxt.setParams({additionalProperty: key}) + cxt.error() + if (!allErrors) gen.break() + return + } + + if (typeof schema == "object" && !alwaysValidSchema(it, schema)) { + const valid = gen.name("valid") + if (opts.removeAdditional === "failing") { + applyAdditionalSchema(key, valid, false) + gen.if(not(valid), () => { + cxt.reset() + deleteAdditional(key) + }) + } else { + applyAdditionalSchema(key, valid) + if (!allErrors) gen.if(not(valid), () => gen.break()) + } + } + } + + function applyAdditionalSchema(key: Name, valid: Name, errors?: false): void { + const subschema: SubschemaArgs = { + keyword: "additionalProperties", + dataProp: key, + dataPropType: Type.Str, + } + if (errors === false) { + Object.assign(subschema, { + compositeRule: true, + createErrors: false, + allErrors: false, + }) + } + cxt.subschema(subschema, valid) + } + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/allOf.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/allOf.ts new file mode 100644 index 000000000..cdfa86ff4 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/allOf.ts @@ -0,0 +1,22 @@ +import type {CodeKeywordDefinition, AnySchema} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {alwaysValidSchema} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: "allOf", + schemaType: "array", + code(cxt: KeywordCxt) { + const {gen, schema, it} = cxt + /* istanbul ignore if */ + if (!Array.isArray(schema)) throw new Error("ajv implementation error") + const valid = gen.name("valid") + schema.forEach((sch: AnySchema, i: number) => { + if (alwaysValidSchema(it, sch)) return + const schCxt = cxt.subschema({keyword: "allOf", schemaProp: i}, valid) + cxt.ok(valid) + cxt.mergeEvaluated(schCxt) + }) + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts new file mode 100644 index 000000000..bd331b5ae --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/anyOf.ts @@ -0,0 +1,14 @@ +import type {CodeKeywordDefinition, ErrorNoParams, AnySchema} from "../../types" +import {validateUnion} from "../code" + +export type AnyOfError = ErrorNoParams<"anyOf", AnySchema[]> + +const def: CodeKeywordDefinition = { + keyword: "anyOf", + schemaType: "array", + trackErrors: true, + code: validateUnion, + error: {message: "must match a schema in anyOf"}, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/contains.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/contains.ts new file mode 100644 index 000000000..d88675c6c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/contains.ts @@ -0,0 +1,109 @@ +import type { + CodeKeywordDefinition, + KeywordErrorDefinition, + ErrorObject, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, Name} from "../../compile/codegen" +import {alwaysValidSchema, checkStrictMode, Type} from "../../compile/util" + +export type ContainsError = ErrorObject< + "contains", + {minContains: number; maxContains?: number}, + AnySchema +> + +const error: KeywordErrorDefinition = { + message: ({params: {min, max}}) => + max === undefined + ? str`must contain at least ${min} valid item(s)` + : str`must contain at least ${min} and no more than ${max} valid item(s)`, + params: ({params: {min, max}}) => + max === undefined ? _`{minContains: ${min}}` : _`{minContains: ${min}, maxContains: ${max}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "contains", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + trackErrors: true, + error, + code(cxt: KeywordCxt) { + const {gen, schema, parentSchema, data, it} = cxt + let min: number + let max: number | undefined + const {minContains, maxContains} = parentSchema + if (it.opts.next) { + min = minContains === undefined ? 1 : minContains + max = maxContains + } else { + min = 1 + } + const len = gen.const("len", _`${data}.length`) + cxt.setParams({min, max}) + if (max === undefined && min === 0) { + checkStrictMode(it, `"minContains" == 0 without "maxContains": "contains" keyword ignored`) + return + } + if (max !== undefined && min > max) { + checkStrictMode(it, `"minContains" > "maxContains" is always invalid`) + cxt.fail() + return + } + if (alwaysValidSchema(it, schema)) { + let cond = _`${len} >= ${min}` + if (max !== undefined) cond = _`${cond} && ${len} <= ${max}` + cxt.pass(cond) + return + } + + it.items = true + const valid = gen.name("valid") + if (max === undefined && min === 1) { + validateItems(valid, () => gen.if(valid, () => gen.break())) + } else if (min === 0) { + gen.let(valid, true) + if (max !== undefined) gen.if(_`${data}.length > 0`, validateItemsWithCount) + } else { + gen.let(valid, false) + validateItemsWithCount() + } + cxt.result(valid, () => cxt.reset()) + + function validateItemsWithCount(): void { + const schValid = gen.name("_valid") + const count = gen.let("count", 0) + validateItems(schValid, () => gen.if(schValid, () => checkLimits(count))) + } + + function validateItems(_valid: Name, block: () => void): void { + gen.forRange("i", 0, len, (i) => { + cxt.subschema( + { + keyword: "contains", + dataProp: i, + dataPropType: Type.Num, + compositeRule: true, + }, + _valid + ) + block() + }) + } + + function checkLimits(count: Name): void { + gen.code(_`${count}++`) + if (max === undefined) { + gen.if(_`${count} >= ${min}`, () => gen.assign(valid, true).break()) + } else { + gen.if(_`${count} > ${max}`, () => gen.assign(valid, false).break()) + if (min === 1) gen.assign(valid, true) + else gen.if(_`${count} >= ${min}`, () => gen.assign(valid, true)) + } + } + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts new file mode 100644 index 000000000..f67611286 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/dependencies.ts @@ -0,0 +1,112 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + SchemaMap, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str} from "../../compile/codegen" +import {alwaysValidSchema} from "../../compile/util" +import {checkReportMissingProp, checkMissingProp, reportMissingProp, propertyInData} from "../code" + +export type PropertyDependencies = {[K in string]?: string[]} + +export interface DependenciesErrorParams { + property: string + missingProperty: string + depsCount: number + deps: string // TODO change to string[] +} + +type SchemaDependencies = SchemaMap + +export type DependenciesError = ErrorObject< + "dependencies", + DependenciesErrorParams, + {[K in string]?: string[] | AnySchema} +> + +export const error: KeywordErrorDefinition = { + message: ({params: {property, depsCount, deps}}) => { + const property_ies = depsCount === 1 ? "property" : "properties" + return str`must have ${property_ies} ${deps} when property ${property} is present` + }, + params: ({params: {property, depsCount, deps, missingProperty}}) => + _`{property: ${property}, + missingProperty: ${missingProperty}, + depsCount: ${depsCount}, + deps: ${deps}}`, // TODO change to reference +} + +const def: CodeKeywordDefinition = { + keyword: "dependencies", + type: "object", + schemaType: "object", + error, + code(cxt: KeywordCxt) { + const [propDeps, schDeps] = splitDependencies(cxt) + validatePropertyDeps(cxt, propDeps) + validateSchemaDeps(cxt, schDeps) + }, +} + +function splitDependencies({schema}: KeywordCxt): [PropertyDependencies, SchemaDependencies] { + const propertyDeps: PropertyDependencies = {} + const schemaDeps: SchemaDependencies = {} + for (const key in schema) { + if (key === "__proto__") continue + const deps = Array.isArray(schema[key]) ? propertyDeps : schemaDeps + deps[key] = schema[key] + } + return [propertyDeps, schemaDeps] +} + +export function validatePropertyDeps( + cxt: KeywordCxt, + propertyDeps: {[K in string]?: string[]} = cxt.schema +): void { + const {gen, data, it} = cxt + if (Object.keys(propertyDeps).length === 0) return + const missing = gen.let("missing") + for (const prop in propertyDeps) { + const deps = propertyDeps[prop] as string[] + if (deps.length === 0) continue + const hasProperty = propertyInData(gen, data, prop, it.opts.ownProperties) + cxt.setParams({ + property: prop, + depsCount: deps.length, + deps: deps.join(", "), + }) + if (it.allErrors) { + gen.if(hasProperty, () => { + for (const depProp of deps) { + checkReportMissingProp(cxt, depProp) + } + }) + } else { + gen.if(_`${hasProperty} && (${checkMissingProp(cxt, deps, missing)})`) + reportMissingProp(cxt, missing) + gen.else() + } + } +} + +export function validateSchemaDeps(cxt: KeywordCxt, schemaDeps: SchemaMap = cxt.schema): void { + const {gen, data, keyword, it} = cxt + const valid = gen.name("valid") + for (const prop in schemaDeps) { + if (alwaysValidSchema(it, schemaDeps[prop] as AnySchema)) continue + gen.if( + propertyInData(gen, data, prop, it.opts.ownProperties), + () => { + const schCxt = cxt.subschema({keyword, schemaProp: prop}, valid) + cxt.mergeValidEvaluated(schCxt, valid) + }, + () => gen.var(valid, true) // TODO var + ) + cxt.ok(valid) + } +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts new file mode 100644 index 000000000..dbd3ae45c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/dependentSchemas.ts @@ -0,0 +1,11 @@ +import type {CodeKeywordDefinition} from "../../types" +import {validateSchemaDeps} from "./dependencies" + +const def: CodeKeywordDefinition = { + keyword: "dependentSchemas", + type: "object", + schemaType: "object", + code: (cxt) => validateSchemaDeps(cxt), +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/if.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/if.ts new file mode 100644 index 000000000..5a40d5e3a --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/if.ts @@ -0,0 +1,80 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import type {SchemaObjCxt} from "../../compile" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, not, Name} from "../../compile/codegen" +import {alwaysValidSchema, checkStrictMode} from "../../compile/util" + +export type IfKeywordError = ErrorObject<"if", {failingKeyword: string}, AnySchema> + +const error: KeywordErrorDefinition = { + message: ({params}) => str`must match "${params.ifClause}" schema`, + params: ({params}) => _`{failingKeyword: ${params.ifClause}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "if", + schemaType: ["object", "boolean"], + trackErrors: true, + error, + code(cxt: KeywordCxt) { + const {gen, parentSchema, it} = cxt + if (parentSchema.then === undefined && parentSchema.else === undefined) { + checkStrictMode(it, '"if" without "then" and "else" is ignored') + } + const hasThen = hasSchema(it, "then") + const hasElse = hasSchema(it, "else") + if (!hasThen && !hasElse) return + + const valid = gen.let("valid", true) + const schValid = gen.name("_valid") + validateIf() + cxt.reset() + + if (hasThen && hasElse) { + const ifClause = gen.let("ifClause") + cxt.setParams({ifClause}) + gen.if(schValid, validateClause("then", ifClause), validateClause("else", ifClause)) + } else if (hasThen) { + gen.if(schValid, validateClause("then")) + } else { + gen.if(not(schValid), validateClause("else")) + } + + cxt.pass(valid, () => cxt.error(true)) + + function validateIf(): void { + const schCxt = cxt.subschema( + { + keyword: "if", + compositeRule: true, + createErrors: false, + allErrors: false, + }, + schValid + ) + cxt.mergeEvaluated(schCxt) + } + + function validateClause(keyword: string, ifClause?: Name): () => void { + return () => { + const schCxt = cxt.subschema({keyword}, schValid) + gen.assign(valid, schValid) + cxt.mergeValidEvaluated(schCxt, valid) + if (ifClause) gen.assign(ifClause, _`${keyword}`) + else cxt.setParams({ifClause: keyword}) + } + } + }, +} + +function hasSchema(it: SchemaObjCxt, keyword: string): boolean { + const schema = it.schema[keyword] + return schema !== undefined && !alwaysValidSchema(it, schema) +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/index.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/index.ts new file mode 100644 index 000000000..fc5271699 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/index.ts @@ -0,0 +1,53 @@ +import type {ErrorNoParams, Vocabulary} from "../../types" +import additionalItems, {AdditionalItemsError} from "./additionalItems" +import prefixItems from "./prefixItems" +import items from "./items" +import items2020, {ItemsError} from "./items2020" +import contains, {ContainsError} from "./contains" +import dependencies, {DependenciesError} from "./dependencies" +import propertyNames, {PropertyNamesError} from "./propertyNames" +import additionalProperties, {AdditionalPropertiesError} from "./additionalProperties" +import properties from "./properties" +import patternProperties from "./patternProperties" +import notKeyword, {NotKeywordError} from "./not" +import anyOf, {AnyOfError} from "./anyOf" +import oneOf, {OneOfError} from "./oneOf" +import allOf from "./allOf" +import ifKeyword, {IfKeywordError} from "./if" +import thenElse from "./thenElse" + +export default function getApplicator(draft2020 = false): Vocabulary { + const applicator = [ + // any + notKeyword, + anyOf, + oneOf, + allOf, + ifKeyword, + thenElse, + // object + propertyNames, + additionalProperties, + dependencies, + properties, + patternProperties, + ] + // array + if (draft2020) applicator.push(prefixItems, items2020) + else applicator.push(additionalItems, items) + applicator.push(contains) + return applicator +} + +export type ApplicatorKeywordError = + | ErrorNoParams<"false schema"> + | AdditionalItemsError + | ItemsError + | ContainsError + | AdditionalPropertiesError + | DependenciesError + | IfKeywordError + | AnyOfError + | OneOfError + | NotKeywordError + | PropertyNamesError diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/items.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/items.ts new file mode 100644 index 000000000..033cb3977 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/items.ts @@ -0,0 +1,59 @@ +import type {CodeKeywordDefinition, AnySchema, AnySchemaObject} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_} from "../../compile/codegen" +import {alwaysValidSchema, mergeEvaluated, checkStrictMode} from "../../compile/util" +import {validateArray} from "../code" + +const def: CodeKeywordDefinition = { + keyword: "items", + type: "array", + schemaType: ["object", "array", "boolean"], + before: "uniqueItems", + code(cxt: KeywordCxt) { + const {schema, it} = cxt + if (Array.isArray(schema)) return validateTuple(cxt, "additionalItems", schema) + it.items = true + if (alwaysValidSchema(it, schema)) return + cxt.ok(validateArray(cxt)) + }, +} + +export function validateTuple( + cxt: KeywordCxt, + extraItems: string, + schArr: AnySchema[] = cxt.schema +): void { + const {gen, parentSchema, data, keyword, it} = cxt + checkStrictTuple(parentSchema) + if (it.opts.unevaluated && schArr.length && it.items !== true) { + it.items = mergeEvaluated.items(gen, schArr.length, it.items) + } + const valid = gen.name("valid") + const len = gen.const("len", _`${data}.length`) + schArr.forEach((sch: AnySchema, i: number) => { + if (alwaysValidSchema(it, sch)) return + gen.if(_`${len} > ${i}`, () => + cxt.subschema( + { + keyword, + schemaProp: i, + dataProp: i, + }, + valid + ) + ) + cxt.ok(valid) + }) + + function checkStrictTuple(sch: AnySchemaObject): void { + const {opts, errSchemaPath} = it + const l = schArr.length + const fullTuple = l === sch.minItems && (l === sch.maxItems || sch[extraItems] === false) + if (opts.strictTuples && !fullTuple) { + const msg = `"${keyword}" is ${l}-tuple, but minItems or maxItems/${extraItems} are not specified or different at path "${errSchemaPath}"` + checkStrictMode(it, msg, opts.strictTuples) + } + } +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/items2020.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/items2020.ts new file mode 100644 index 000000000..2a99b08d5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/items2020.ts @@ -0,0 +1,36 @@ +import type { + CodeKeywordDefinition, + KeywordErrorDefinition, + ErrorObject, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str} from "../../compile/codegen" +import {alwaysValidSchema} from "../../compile/util" +import {validateArray} from "../code" +import {validateAdditionalItems} from "./additionalItems" + +export type ItemsError = ErrorObject<"items", {limit: number}, AnySchema> + +const error: KeywordErrorDefinition = { + message: ({params: {len}}) => str`must NOT have more than ${len} items`, + params: ({params: {len}}) => _`{limit: ${len}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "items", + type: "array", + schemaType: ["object", "boolean"], + before: "uniqueItems", + error, + code(cxt: KeywordCxt) { + const {schema, parentSchema, it} = cxt + const {prefixItems} = parentSchema + it.items = true + if (alwaysValidSchema(it, schema)) return + if (prefixItems) validateAdditionalItems(cxt, prefixItems) + else cxt.ok(validateArray(cxt)) + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/not.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/not.ts new file mode 100644 index 000000000..8691db0bf --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/not.ts @@ -0,0 +1,38 @@ +import type {CodeKeywordDefinition, ErrorNoParams, AnySchema} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {alwaysValidSchema} from "../../compile/util" + +export type NotKeywordError = ErrorNoParams<"not", AnySchema> + +const def: CodeKeywordDefinition = { + keyword: "not", + schemaType: ["object", "boolean"], + trackErrors: true, + code(cxt: KeywordCxt) { + const {gen, schema, it} = cxt + if (alwaysValidSchema(it, schema)) { + cxt.fail() + return + } + + const valid = gen.name("valid") + cxt.subschema( + { + keyword: "not", + compositeRule: true, + createErrors: false, + allErrors: false, + }, + valid + ) + + cxt.failResult( + valid, + () => cxt.reset(), + () => cxt.error() + ) + }, + error: {message: "must NOT be valid"}, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts new file mode 100644 index 000000000..c25353ffd --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/oneOf.ts @@ -0,0 +1,82 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, Name} from "../../compile/codegen" +import {alwaysValidSchema} from "../../compile/util" +import {SchemaCxt} from "../../compile" + +export type OneOfError = ErrorObject< + "oneOf", + {passingSchemas: [number, number] | null}, + AnySchema[] +> + +const error: KeywordErrorDefinition = { + message: "must match exactly one schema in oneOf", + params: ({params}) => _`{passingSchemas: ${params.passing}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "oneOf", + schemaType: "array", + trackErrors: true, + error, + code(cxt: KeywordCxt) { + const {gen, schema, parentSchema, it} = cxt + /* istanbul ignore if */ + if (!Array.isArray(schema)) throw new Error("ajv implementation error") + if (it.opts.discriminator && parentSchema.discriminator) return + const schArr: AnySchema[] = schema + const valid = gen.let("valid", false) + const passing = gen.let("passing", null) + const schValid = gen.name("_valid") + cxt.setParams({passing}) + // TODO possibly fail straight away (with warning or exception) if there are two empty always valid schemas + + gen.block(validateOneOf) + + cxt.result( + valid, + () => cxt.reset(), + () => cxt.error(true) + ) + + function validateOneOf(): void { + schArr.forEach((sch: AnySchema, i: number) => { + let schCxt: SchemaCxt | undefined + if (alwaysValidSchema(it, sch)) { + gen.var(schValid, true) + } else { + schCxt = cxt.subschema( + { + keyword: "oneOf", + schemaProp: i, + compositeRule: true, + }, + schValid + ) + } + + if (i > 0) { + gen + .if(_`${schValid} && ${valid}`) + .assign(valid, false) + .assign(passing, _`[${passing}, ${i}]`) + .else() + } + + gen.if(schValid, () => { + gen.assign(valid, true) + gen.assign(passing, i) + if (schCxt) cxt.mergeEvaluated(schCxt, Name) + }) + }) + } + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts new file mode 100644 index 000000000..ea624e230 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/patternProperties.ts @@ -0,0 +1,91 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {allSchemaProperties, usePattern} from "../code" +import {_, not, Name} from "../../compile/codegen" +import {alwaysValidSchema, checkStrictMode} from "../../compile/util" +import {evaluatedPropsToName, Type} from "../../compile/util" +import {AnySchema} from "../../types" + +const def: CodeKeywordDefinition = { + keyword: "patternProperties", + type: "object", + schemaType: "object", + code(cxt: KeywordCxt) { + const {gen, schema, data, parentSchema, it} = cxt + const {opts} = it + const patterns = allSchemaProperties(schema) + const alwaysValidPatterns = patterns.filter((p) => + alwaysValidSchema(it, schema[p] as AnySchema) + ) + + if ( + patterns.length === 0 || + (alwaysValidPatterns.length === patterns.length && + (!it.opts.unevaluated || it.props === true)) + ) { + return + } + + const checkProperties = + opts.strictSchema && !opts.allowMatchingProperties && parentSchema.properties + const valid = gen.name("valid") + if (it.props !== true && !(it.props instanceof Name)) { + it.props = evaluatedPropsToName(gen, it.props) + } + const {props} = it + validatePatternProperties() + + function validatePatternProperties(): void { + for (const pat of patterns) { + if (checkProperties) checkMatchingProperties(pat) + if (it.allErrors) { + validateProperties(pat) + } else { + gen.var(valid, true) // TODO var + validateProperties(pat) + gen.if(valid) + } + } + } + + function checkMatchingProperties(pat: string): void { + for (const prop in checkProperties) { + if (new RegExp(pat).test(prop)) { + checkStrictMode( + it, + `property ${prop} matches pattern ${pat} (use allowMatchingProperties)` + ) + } + } + } + + function validateProperties(pat: string): void { + gen.forIn("key", data, (key) => { + gen.if(_`${usePattern(cxt, pat)}.test(${key})`, () => { + const alwaysValid = alwaysValidPatterns.includes(pat) + if (!alwaysValid) { + cxt.subschema( + { + keyword: "patternProperties", + schemaProp: pat, + dataProp: key, + dataPropType: Type.Str, + }, + valid + ) + } + + if (it.opts.unevaluated && props !== true) { + gen.assign(_`${props}[${key}]`, true) + } else if (!alwaysValid && !it.allErrors) { + // can short-circuit if `unevaluatedProperties` is not supported (opts.next === false) + // or if all properties were evaluated (props === true) + gen.if(not(valid), () => gen.break()) + } + }) + }) + } + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts new file mode 100644 index 000000000..008fb2db1 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/prefixItems.ts @@ -0,0 +1,12 @@ +import type {CodeKeywordDefinition} from "../../types" +import {validateTuple} from "./items" + +const def: CodeKeywordDefinition = { + keyword: "prefixItems", + type: "array", + schemaType: ["array"], + before: "uniqueItems", + code: (cxt) => validateTuple(cxt, "items"), +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/properties.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/properties.ts new file mode 100644 index 000000000..a55b19ce5 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/properties.ts @@ -0,0 +1,57 @@ +import type {CodeKeywordDefinition} from "../../types" +import {KeywordCxt} from "../../compile/validate" +import {propertyInData, allSchemaProperties} from "../code" +import {alwaysValidSchema, toHash, mergeEvaluated} from "../../compile/util" +import apDef from "./additionalProperties" + +const def: CodeKeywordDefinition = { + keyword: "properties", + type: "object", + schemaType: "object", + code(cxt: KeywordCxt) { + const {gen, schema, parentSchema, data, it} = cxt + if (it.opts.removeAdditional === "all" && parentSchema.additionalProperties === undefined) { + apDef.code(new KeywordCxt(it, apDef, "additionalProperties")) + } + const allProps = allSchemaProperties(schema) + for (const prop of allProps) { + it.definedProperties.add(prop) + } + if (it.opts.unevaluated && allProps.length && it.props !== true) { + it.props = mergeEvaluated.props(gen, toHash(allProps), it.props) + } + const properties = allProps.filter((p) => !alwaysValidSchema(it, schema[p])) + if (properties.length === 0) return + const valid = gen.name("valid") + + for (const prop of properties) { + if (hasDefault(prop)) { + applyPropertySchema(prop) + } else { + gen.if(propertyInData(gen, data, prop, it.opts.ownProperties)) + applyPropertySchema(prop) + if (!it.allErrors) gen.else().var(valid, true) + gen.endIf() + } + cxt.it.definedProperties.add(prop) + cxt.ok(valid) + } + + function hasDefault(prop: string): boolean | undefined { + return it.opts.useDefaults && !it.compositeRule && schema[prop].default !== undefined + } + + function applyPropertySchema(prop: string): void { + cxt.subschema( + { + keyword: "properties", + schemaProp: prop, + dataProp: prop, + }, + valid + ) + } + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts new file mode 100644 index 000000000..1c54d6052 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/propertyNames.ts @@ -0,0 +1,50 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, not} from "../../compile/codegen" +import {alwaysValidSchema} from "../../compile/util" + +export type PropertyNamesError = ErrorObject<"propertyNames", {propertyName: string}, AnySchema> + +const error: KeywordErrorDefinition = { + message: "property name must be valid", + params: ({params}) => _`{propertyName: ${params.propertyName}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "propertyNames", + type: "object", + schemaType: ["object", "boolean"], + error, + code(cxt: KeywordCxt) { + const {gen, schema, data, it} = cxt + if (alwaysValidSchema(it, schema)) return + const valid = gen.name("valid") + + gen.forIn("key", data, (key) => { + cxt.setParams({propertyName: key}) + cxt.subschema( + { + keyword: "propertyNames", + data: key, + dataTypes: ["string"], + propertyName: key, + compositeRule: true, + }, + valid + ) + gen.if(not(valid), () => { + cxt.error(true) + if (!it.allErrors) gen.break() + }) + }) + + cxt.ok(valid) + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts new file mode 100644 index 000000000..5055182e8 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/applicator/thenElse.ts @@ -0,0 +1,13 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {checkStrictMode} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: ["then", "else"], + schemaType: ["object", "boolean"], + code({keyword, parentSchema, it}: KeywordCxt) { + if (parentSchema.if === undefined) checkStrictMode(it, `"${keyword}" without "if" is ignored`) + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/code.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/code.ts new file mode 100644 index 000000000..92cdd5b04 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/code.ts @@ -0,0 +1,168 @@ +import type {AnySchema, SchemaMap} from "../types" +import type {SchemaCxt} from "../compile" +import type {KeywordCxt} from "../compile/validate" +import {CodeGen, _, and, or, not, nil, strConcat, getProperty, Code, Name} from "../compile/codegen" +import {alwaysValidSchema, Type} from "../compile/util" +import N from "../compile/names" +import {useFunc} from "../compile/util" +export function checkReportMissingProp(cxt: KeywordCxt, prop: string): void { + const {gen, data, it} = cxt + gen.if(noPropertyInData(gen, data, prop, it.opts.ownProperties), () => { + cxt.setParams({missingProperty: _`${prop}`}, true) + cxt.error() + }) +} + +export function checkMissingProp( + {gen, data, it: {opts}}: KeywordCxt, + properties: string[], + missing: Name +): Code { + return or( + ...properties.map((prop) => + and(noPropertyInData(gen, data, prop, opts.ownProperties), _`${missing} = ${prop}`) + ) + ) +} + +export function reportMissingProp(cxt: KeywordCxt, missing: Name): void { + cxt.setParams({missingProperty: missing}, true) + cxt.error() +} + +export function hasPropFunc(gen: CodeGen): Name { + return gen.scopeValue("func", { + // eslint-disable-next-line @typescript-eslint/unbound-method + ref: Object.prototype.hasOwnProperty, + code: _`Object.prototype.hasOwnProperty`, + }) +} + +export function isOwnProperty(gen: CodeGen, data: Name, property: Name | string): Code { + return _`${hasPropFunc(gen)}.call(${data}, ${property})` +} + +export function propertyInData( + gen: CodeGen, + data: Name, + property: Name | string, + ownProperties?: boolean +): Code { + const cond = _`${data}${getProperty(property)} !== undefined` + return ownProperties ? _`${cond} && ${isOwnProperty(gen, data, property)}` : cond +} + +export function noPropertyInData( + gen: CodeGen, + data: Name, + property: Name | string, + ownProperties?: boolean +): Code { + const cond = _`${data}${getProperty(property)} === undefined` + return ownProperties ? or(cond, not(isOwnProperty(gen, data, property))) : cond +} + +export function allSchemaProperties(schemaMap?: SchemaMap): string[] { + return schemaMap ? Object.keys(schemaMap).filter((p) => p !== "__proto__") : [] +} + +export function schemaProperties(it: SchemaCxt, schemaMap: SchemaMap): string[] { + return allSchemaProperties(schemaMap).filter( + (p) => !alwaysValidSchema(it, schemaMap[p] as AnySchema) + ) +} + +export function callValidateCode( + {schemaCode, data, it: {gen, topSchemaRef, schemaPath, errorPath}, it}: KeywordCxt, + func: Code, + context: Code, + passSchema?: boolean +): Code { + const dataAndSchema = passSchema ? _`${schemaCode}, ${data}, ${topSchemaRef}${schemaPath}` : data + const valCxt: [Name, Code | number][] = [ + [N.instancePath, strConcat(N.instancePath, errorPath)], + [N.parentData, it.parentData], + [N.parentDataProperty, it.parentDataProperty], + [N.rootData, N.rootData], + ] + if (it.opts.dynamicRef) valCxt.push([N.dynamicAnchors, N.dynamicAnchors]) + const args = _`${dataAndSchema}, ${gen.object(...valCxt)}` + return context !== nil ? _`${func}.call(${context}, ${args})` : _`${func}(${args})` +} + +const newRegExp = _`new RegExp` + +export function usePattern({gen, it: {opts}}: KeywordCxt, pattern: string): Name { + const u = opts.unicodeRegExp ? "u" : "" + const {regExp} = opts.code + const rx = regExp(pattern, u) + + return gen.scopeValue("pattern", { + key: rx.toString(), + ref: rx, + code: _`${regExp.code === "new RegExp" ? newRegExp : useFunc(gen, regExp)}(${pattern}, ${u})`, + }) +} + +export function validateArray(cxt: KeywordCxt): Name { + const {gen, data, keyword, it} = cxt + const valid = gen.name("valid") + if (it.allErrors) { + const validArr = gen.let("valid", true) + validateItems(() => gen.assign(validArr, false)) + return validArr + } + gen.var(valid, true) + validateItems(() => gen.break()) + return valid + + function validateItems(notValid: () => void): void { + const len = gen.const("len", _`${data}.length`) + gen.forRange("i", 0, len, (i) => { + cxt.subschema( + { + keyword, + dataProp: i, + dataPropType: Type.Num, + }, + valid + ) + gen.if(not(valid), notValid) + }) + } +} + +export function validateUnion(cxt: KeywordCxt): void { + const {gen, schema, keyword, it} = cxt + /* istanbul ignore if */ + if (!Array.isArray(schema)) throw new Error("ajv implementation error") + const alwaysValid = schema.some((sch: AnySchema) => alwaysValidSchema(it, sch)) + if (alwaysValid && !it.opts.unevaluated) return + + const valid = gen.let("valid", false) + const schValid = gen.name("_valid") + + gen.block(() => + schema.forEach((_sch: AnySchema, i: number) => { + const schCxt = cxt.subschema( + { + keyword, + schemaProp: i, + compositeRule: true, + }, + schValid + ) + gen.assign(valid, _`${valid} || ${schValid}`) + const merged = cxt.mergeValidEvaluated(schCxt, schValid) + // can short-circuit if `unevaluatedProperties/Items` not supported (opts.unevaluated !== true) + // or if all properties and items were evaluated (it.props === true && it.items === true) + if (!merged) gen.if(not(valid)) + }) + ) + + cxt.result( + valid, + () => cxt.reset(), + () => cxt.error(true) + ) +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/core/id.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/core/id.ts new file mode 100644 index 000000000..aa36c4bb2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/core/id.ts @@ -0,0 +1,10 @@ +import type {CodeKeywordDefinition} from "../../types" + +const def: CodeKeywordDefinition = { + keyword: "id", + code() { + throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID') + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/core/index.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/core/index.ts new file mode 100644 index 000000000..e63e2895d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/core/index.ts @@ -0,0 +1,16 @@ +import type {Vocabulary} from "../../types" +import idKeyword from "./id" +import refKeyword from "./ref" + +const core: Vocabulary = [ + "$schema", + "$id", + "$defs", + "$vocabulary", + {keyword: "$comment"}, + "definitions", + idKeyword, + refKeyword, +] + +export default core diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/core/ref.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/core/ref.ts new file mode 100644 index 000000000..5d59fbcb2 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/core/ref.ts @@ -0,0 +1,129 @@ +import type {CodeKeywordDefinition, AnySchema} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import MissingRefError from "../../compile/ref_error" +import {callValidateCode} from "../code" +import {_, nil, stringify, Code, Name} from "../../compile/codegen" +import N from "../../compile/names" +import {SchemaEnv, resolveRef} from "../../compile" +import {mergeEvaluated} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: "$ref", + schemaType: "string", + code(cxt: KeywordCxt): void { + const {gen, schema: $ref, it} = cxt + const {baseId, schemaEnv: env, validateName, opts, self} = it + const {root} = env + if (($ref === "#" || $ref === "#/") && baseId === root.baseId) return callRootRef() + const schOrEnv = resolveRef.call(self, root, baseId, $ref) + if (schOrEnv === undefined) throw new MissingRefError(it.opts.uriResolver, baseId, $ref) + if (schOrEnv instanceof SchemaEnv) return callValidate(schOrEnv) + return inlineRefSchema(schOrEnv) + + function callRootRef(): void { + if (env === root) return callRef(cxt, validateName, env, env.$async) + const rootName = gen.scopeValue("root", {ref: root}) + return callRef(cxt, _`${rootName}.validate`, root, root.$async) + } + + function callValidate(sch: SchemaEnv): void { + const v = getValidate(cxt, sch) + callRef(cxt, v, sch, sch.$async) + } + + function inlineRefSchema(sch: AnySchema): void { + const schName = gen.scopeValue( + "schema", + opts.code.source === true ? {ref: sch, code: stringify(sch)} : {ref: sch} + ) + const valid = gen.name("valid") + const schCxt = cxt.subschema( + { + schema: sch, + dataTypes: [], + schemaPath: nil, + topSchemaRef: schName, + errSchemaPath: $ref, + }, + valid + ) + cxt.mergeEvaluated(schCxt) + cxt.ok(valid) + } + }, +} + +export function getValidate(cxt: KeywordCxt, sch: SchemaEnv): Code { + const {gen} = cxt + return sch.validate + ? gen.scopeValue("validate", {ref: sch.validate}) + : _`${gen.scopeValue("wrapper", {ref: sch})}.validate` +} + +export function callRef(cxt: KeywordCxt, v: Code, sch?: SchemaEnv, $async?: boolean): void { + const {gen, it} = cxt + const {allErrors, schemaEnv: env, opts} = it + const passCxt = opts.passContext ? N.this : nil + if ($async) callAsyncRef() + else callSyncRef() + + function callAsyncRef(): void { + if (!env.$async) throw new Error("async schema referenced by sync schema") + const valid = gen.let("valid") + gen.try( + () => { + gen.code(_`await ${callValidateCode(cxt, v, passCxt)}`) + addEvaluatedFrom(v) // TODO will not work with async, it has to be returned with the result + if (!allErrors) gen.assign(valid, true) + }, + (e) => { + gen.if(_`!(${e} instanceof ${it.ValidationError as Name})`, () => gen.throw(e)) + addErrorsFrom(e) + if (!allErrors) gen.assign(valid, false) + } + ) + cxt.ok(valid) + } + + function callSyncRef(): void { + cxt.result( + callValidateCode(cxt, v, passCxt), + () => addEvaluatedFrom(v), + () => addErrorsFrom(v) + ) + } + + function addErrorsFrom(source: Code): void { + const errs = _`${source}.errors` + gen.assign(N.vErrors, _`${N.vErrors} === null ? ${errs} : ${N.vErrors}.concat(${errs})`) // TODO tagged + gen.assign(N.errors, _`${N.vErrors}.length`) + } + + function addEvaluatedFrom(source: Code): void { + if (!it.opts.unevaluated) return + const schEvaluated = sch?.validate?.evaluated + // TODO refactor + if (it.props !== true) { + if (schEvaluated && !schEvaluated.dynamicProps) { + if (schEvaluated.props !== undefined) { + it.props = mergeEvaluated.props(gen, schEvaluated.props, it.props) + } + } else { + const props = gen.var("props", _`${source}.evaluated.props`) + it.props = mergeEvaluated.props(gen, props, it.props, Name) + } + } + if (it.items !== true) { + if (schEvaluated && !schEvaluated.dynamicItems) { + if (schEvaluated.items !== undefined) { + it.items = mergeEvaluated.items(gen, schEvaluated.items, it.items) + } + } else { + const items = gen.var("items", _`${source}.evaluated.items`) + it.items = mergeEvaluated.items(gen, items, it.items, Name) + } + } + } +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/discriminator/index.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/discriminator/index.ts new file mode 100644 index 000000000..98f0f8cfb --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/discriminator/index.ts @@ -0,0 +1,110 @@ +import type {CodeKeywordDefinition, AnySchemaObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, getProperty, Name} from "../../compile/codegen" +import {DiscrError, DiscrErrorObj} from "../discriminator/types" +import {resolveRef, SchemaEnv} from "../../compile" +import {schemaHasRulesButRef} from "../../compile/util" + +export type DiscriminatorError = DiscrErrorObj | DiscrErrorObj + +const error: KeywordErrorDefinition = { + message: ({params: {discrError, tagName}}) => + discrError === DiscrError.Tag + ? `tag "${tagName}" must be string` + : `value of tag "${tagName}" must be in oneOf`, + params: ({params: {discrError, tag, tagName}}) => + _`{error: ${discrError}, tag: ${tagName}, tagValue: ${tag}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "discriminator", + type: "object", + schemaType: "object", + error, + code(cxt: KeywordCxt) { + const {gen, data, schema, parentSchema, it} = cxt + const {oneOf} = parentSchema + if (!it.opts.discriminator) { + throw new Error("discriminator: requires discriminator option") + } + const tagName = schema.propertyName + if (typeof tagName != "string") throw new Error("discriminator: requires propertyName") + if (schema.mapping) throw new Error("discriminator: mapping is not supported") + if (!oneOf) throw new Error("discriminator: requires oneOf keyword") + const valid = gen.let("valid", false) + const tag = gen.const("tag", _`${data}${getProperty(tagName)}`) + gen.if( + _`typeof ${tag} == "string"`, + () => validateMapping(), + () => cxt.error(false, {discrError: DiscrError.Tag, tag, tagName}) + ) + cxt.ok(valid) + + function validateMapping(): void { + const mapping = getMapping() + gen.if(false) + for (const tagValue in mapping) { + gen.elseIf(_`${tag} === ${tagValue}`) + gen.assign(valid, applyTagSchema(mapping[tagValue])) + } + gen.else() + cxt.error(false, {discrError: DiscrError.Mapping, tag, tagName}) + gen.endIf() + } + + function applyTagSchema(schemaProp?: number): Name { + const _valid = gen.name("valid") + const schCxt = cxt.subschema({keyword: "oneOf", schemaProp}, _valid) + cxt.mergeEvaluated(schCxt, Name) + return _valid + } + + function getMapping(): {[T in string]?: number} { + const oneOfMapping: {[T in string]?: number} = {} + const topRequired = hasRequired(parentSchema) + let tagRequired = true + for (let i = 0; i < oneOf.length; i++) { + let sch = oneOf[i] + if (sch?.$ref && !schemaHasRulesButRef(sch, it.self.RULES)) { + sch = resolveRef.call(it.self, it.schemaEnv.root, it.baseId, sch?.$ref) + if (sch instanceof SchemaEnv) sch = sch.schema + } + const propSch = sch?.properties?.[tagName] + if (typeof propSch != "object") { + throw new Error( + `discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"` + ) + } + tagRequired = tagRequired && (topRequired || hasRequired(sch)) + addMappings(propSch, i) + } + if (!tagRequired) throw new Error(`discriminator: "${tagName}" must be required`) + return oneOfMapping + + function hasRequired({required}: AnySchemaObject): boolean { + return Array.isArray(required) && required.includes(tagName) + } + + function addMappings(sch: AnySchemaObject, i: number): void { + if (sch.const) { + addMapping(sch.const, i) + } else if (sch.enum) { + for (const tagValue of sch.enum) { + addMapping(tagValue, i) + } + } else { + throw new Error(`discriminator: "properties/${tagName}" must have "const" or "enum"`) + } + } + + function addMapping(tagValue: unknown, i: number): void { + if (typeof tagValue != "string" || tagValue in oneOfMapping) { + throw new Error(`discriminator: "${tagName}" values must be unique strings`) + } + oneOfMapping[tagValue] = i + } + } + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/discriminator/types.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/discriminator/types.ts new file mode 100644 index 000000000..bee5a2785 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/discriminator/types.ts @@ -0,0 +1,12 @@ +import type {ErrorObject} from "../../types" + +export enum DiscrError { + Tag = "tag", + Mapping = "mapping", +} + +export type DiscrErrorObj = ErrorObject< + "discriminator", + {error: E; tag: string; tagValue: unknown}, + string +> diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/draft2020.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/draft2020.ts new file mode 100644 index 000000000..47fbf0ee6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/draft2020.ts @@ -0,0 +1,23 @@ +import type {Vocabulary} from "../types" +import coreVocabulary from "./core" +import validationVocabulary from "./validation" +import getApplicatorVocabulary from "./applicator" +import dynamicVocabulary from "./dynamic" +import nextVocabulary from "./next" +import unevaluatedVocabulary from "./unevaluated" +import formatVocabulary from "./format" +import {metadataVocabulary, contentVocabulary} from "./metadata" + +const draft2020Vocabularies: Vocabulary[] = [ + dynamicVocabulary, + coreVocabulary, + validationVocabulary, + getApplicatorVocabulary(true), + formatVocabulary, + metadataVocabulary, + contentVocabulary, + nextVocabulary, + unevaluatedVocabulary, +] + +export default draft2020Vocabularies diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/draft7.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/draft7.ts new file mode 100644 index 000000000..226a644aa --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/draft7.ts @@ -0,0 +1,17 @@ +import type {Vocabulary} from "../types" +import coreVocabulary from "./core" +import validationVocabulary from "./validation" +import getApplicatorVocabulary from "./applicator" +import formatVocabulary from "./format" +import {metadataVocabulary, contentVocabulary} from "./metadata" + +const draft7Vocabularies: Vocabulary[] = [ + coreVocabulary, + validationVocabulary, + getApplicatorVocabulary(), + formatVocabulary, + metadataVocabulary, + contentVocabulary, +] + +export default draft7Vocabularies diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts new file mode 100644 index 000000000..ca1adb912 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/dynamic/dynamicAnchor.ts @@ -0,0 +1,31 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, getProperty, Code} from "../../compile/codegen" +import N from "../../compile/names" +import {SchemaEnv, compileSchema} from "../../compile" +import {getValidate} from "../core/ref" + +const def: CodeKeywordDefinition = { + keyword: "$dynamicAnchor", + schemaType: "string", + code: (cxt) => dynamicAnchor(cxt, cxt.schema), +} + +export function dynamicAnchor(cxt: KeywordCxt, anchor: string): void { + const {gen, it} = cxt + it.schemaEnv.root.dynamicAnchors[anchor] = true + const v = _`${N.dynamicAnchors}${getProperty(anchor)}` + const validate = it.errSchemaPath === "#" ? it.validateName : _getValidate(cxt) + gen.if(_`!${v}`, () => gen.assign(v, validate)) +} + +function _getValidate(cxt: KeywordCxt): Code { + const {schemaEnv, schema, self} = cxt.it + const {root, baseId, localRefs, meta} = schemaEnv.root + const {schemaId} = self.opts + const sch = new SchemaEnv({schema, schemaId, root, baseId, localRefs, meta}) + compileSchema.call(self, sch) + return getValidate(cxt, sch) +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts new file mode 100644 index 000000000..6a573f330 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/dynamic/dynamicRef.ts @@ -0,0 +1,51 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, getProperty, Code, Name} from "../../compile/codegen" +import N from "../../compile/names" +import {callRef} from "../core/ref" + +const def: CodeKeywordDefinition = { + keyword: "$dynamicRef", + schemaType: "string", + code: (cxt) => dynamicRef(cxt, cxt.schema), +} + +export function dynamicRef(cxt: KeywordCxt, ref: string): void { + const {gen, keyword, it} = cxt + if (ref[0] !== "#") throw new Error(`"${keyword}" only supports hash fragment reference`) + const anchor = ref.slice(1) + if (it.allErrors) { + _dynamicRef() + } else { + const valid = gen.let("valid", false) + _dynamicRef(valid) + cxt.ok(valid) + } + + function _dynamicRef(valid?: Name): void { + // TODO the assumption here is that `recursiveRef: #` always points to the root + // of the schema object, which is not correct, because there may be $id that + // makes # point to it, and the target schema may not contain dynamic/recursiveAnchor. + // Because of that 2 tests in recursiveRef.json fail. + // This is a similar problem to #815 (`$id` doesn't alter resolution scope for `{ "$ref": "#" }`). + // (This problem is not tested in JSON-Schema-Test-Suite) + if (it.schemaEnv.root.dynamicAnchors[anchor]) { + const v = gen.let("_v", _`${N.dynamicAnchors}${getProperty(anchor)}`) + gen.if(v, _callRef(v, valid), _callRef(it.validateName, valid)) + } else { + _callRef(it.validateName, valid)() + } + } + + function _callRef(validate: Code, valid?: Name): () => void { + return valid + ? () => + gen.block(() => { + callRef(cxt, validate) + gen.let(valid, true) + }) + : () => callRef(cxt, validate) + } +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/dynamic/index.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/dynamic/index.ts new file mode 100644 index 000000000..6d521db66 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/dynamic/index.ts @@ -0,0 +1,9 @@ +import type {Vocabulary} from "../../types" +import dynamicAnchor from "./dynamicAnchor" +import dynamicRef from "./dynamicRef" +import recursiveAnchor from "./recursiveAnchor" +import recursiveRef from "./recursiveRef" + +const dynamic: Vocabulary = [dynamicAnchor, dynamicRef, recursiveAnchor, recursiveRef] + +export default dynamic diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts new file mode 100644 index 000000000..25f3db96b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/dynamic/recursiveAnchor.ts @@ -0,0 +1,14 @@ +import type {CodeKeywordDefinition} from "../../types" +import {dynamicAnchor} from "./dynamicAnchor" +import {checkStrictMode} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: "$recursiveAnchor", + schemaType: "boolean", + code(cxt) { + if (cxt.schema) dynamicAnchor(cxt, "") + else checkStrictMode(cxt.it, "$recursiveAnchor: false is ignored") + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts new file mode 100644 index 000000000..c84af0f05 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/dynamic/recursiveRef.ts @@ -0,0 +1,10 @@ +import type {CodeKeywordDefinition} from "../../types" +import {dynamicRef} from "./dynamicRef" + +const def: CodeKeywordDefinition = { + keyword: "$recursiveRef", + schemaType: "string", + code: (cxt) => dynamicRef(cxt, cxt.schema), +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/errors.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/errors.ts new file mode 100644 index 000000000..c9ca3f02f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/errors.ts @@ -0,0 +1,18 @@ +import type {TypeError} from "../compile/validate/dataType" +import type {ApplicatorKeywordError} from "./applicator" +import type {ValidationKeywordError} from "./validation" +import type {FormatError} from "./format/format" +import type {UnevaluatedPropertiesError} from "./unevaluated/unevaluatedProperties" +import type {UnevaluatedItemsError} from "./unevaluated/unevaluatedItems" +import type {DependentRequiredError} from "./validation/dependentRequired" +import type {DiscriminatorError} from "./discriminator" + +export type DefinedError = + | TypeError + | ApplicatorKeywordError + | ValidationKeywordError + | FormatError + | UnevaluatedPropertiesError + | UnevaluatedItemsError + | DependentRequiredError + | DiscriminatorError diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/format/format.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/format/format.ts new file mode 100644 index 000000000..4b1c13e76 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/format/format.ts @@ -0,0 +1,120 @@ +import type { + AddedFormat, + FormatValidator, + AsyncFormatValidator, + CodeKeywordDefinition, + KeywordErrorDefinition, + ErrorObject, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, nil, or, Code, getProperty, regexpCode} from "../../compile/codegen" + +type FormatValidate = + | FormatValidator + | FormatValidator + | AsyncFormatValidator + | AsyncFormatValidator + | RegExp + | string + | true + +export type FormatError = ErrorObject<"format", {format: string}, string | {$data: string}> + +const error: KeywordErrorDefinition = { + message: ({schemaCode}) => str`must match format "${schemaCode}"`, + params: ({schemaCode}) => _`{format: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "format", + type: ["number", "string"], + schemaType: "string", + $data: true, + error, + code(cxt: KeywordCxt, ruleType?: string) { + const {gen, data, $data, schema, schemaCode, it} = cxt + const {opts, errSchemaPath, schemaEnv, self} = it + if (!opts.validateFormats) return + + if ($data) validate$DataFormat() + else validateFormat() + + function validate$DataFormat(): void { + const fmts = gen.scopeValue("formats", { + ref: self.formats, + code: opts.code.formats, + }) + const fDef = gen.const("fDef", _`${fmts}[${schemaCode}]`) + const fType = gen.let("fType") + const format = gen.let("format") + // TODO simplify + gen.if( + _`typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, + () => gen.assign(fType, _`${fDef}.type || "string"`).assign(format, _`${fDef}.validate`), + () => gen.assign(fType, _`"string"`).assign(format, fDef) + ) + cxt.fail$data(or(unknownFmt(), invalidFmt())) + + function unknownFmt(): Code { + if (opts.strictSchema === false) return nil + return _`${schemaCode} && !${format}` + } + + function invalidFmt(): Code { + const callFormat = schemaEnv.$async + ? _`(${fDef}.async ? await ${format}(${data}) : ${format}(${data}))` + : _`${format}(${data})` + const validData = _`(typeof ${format} == "function" ? ${callFormat} : ${format}.test(${data}))` + return _`${format} && ${format} !== true && ${fType} === ${ruleType} && !${validData}` + } + } + + function validateFormat(): void { + const formatDef: AddedFormat | undefined = self.formats[schema] + if (!formatDef) { + unknownFormat() + return + } + if (formatDef === true) return + const [fmtType, format, fmtRef] = getFormat(formatDef) + if (fmtType === ruleType) cxt.pass(validCondition()) + + function unknownFormat(): void { + if (opts.strictSchema === false) { + self.logger.warn(unknownMsg()) + return + } + throw new Error(unknownMsg()) + + function unknownMsg(): string { + return `unknown format "${schema as string}" ignored in schema at path "${errSchemaPath}"` + } + } + + function getFormat(fmtDef: AddedFormat): [string, FormatValidate, Code] { + const code = + fmtDef instanceof RegExp + ? regexpCode(fmtDef) + : opts.code.formats + ? _`${opts.code.formats}${getProperty(schema)}` + : undefined + const fmt = gen.scopeValue("formats", {key: schema, ref: fmtDef, code}) + if (typeof fmtDef == "object" && !(fmtDef instanceof RegExp)) { + return [fmtDef.type || "string", fmtDef.validate, _`${fmt}.validate`] + } + + return ["string", fmtDef, fmt] + } + + function validCondition(): Code { + if (typeof formatDef == "object" && !(formatDef instanceof RegExp) && formatDef.async) { + if (!schemaEnv.$async) throw new Error("async format in sync schema") + return _`await ${fmtRef}(${data})` + } + return typeof format == "function" ? _`${fmtRef}(${data})` : _`${fmtRef}.test(${data})` + } + } + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/format/index.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/format/index.ts new file mode 100644 index 000000000..bca2f5b3d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/format/index.ts @@ -0,0 +1,6 @@ +import type {Vocabulary} from "../../types" +import formatKeyword from "./format" + +const format: Vocabulary = [formatKeyword] + +export default format diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts new file mode 100644 index 000000000..f487c97f8 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/discriminator.ts @@ -0,0 +1,89 @@ +import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, not, getProperty, Name} from "../../compile/codegen" +import {checkMetadata} from "./metadata" +import {checkNullableObject} from "./nullable" +import {typeErrorMessage, typeErrorParams, _JTDTypeError} from "./error" +import {DiscrError, DiscrErrorObj} from "../discriminator/types" + +export type JTDDiscriminatorError = + | _JTDTypeError<"discriminator", "object", string> + | DiscrErrorObj + | DiscrErrorObj + +const error: KeywordErrorDefinition = { + message: (cxt) => { + const {schema, params} = cxt + return params.discrError + ? params.discrError === DiscrError.Tag + ? `tag "${schema}" must be string` + : `value of tag "${schema}" must be in mapping` + : typeErrorMessage(cxt, "object") + }, + params: (cxt) => { + const {schema, params} = cxt + return params.discrError + ? _`{error: ${params.discrError}, tag: ${schema}, tagValue: ${params.tag}}` + : typeErrorParams(cxt, "object") + }, +} + +const def: CodeKeywordDefinition = { + keyword: "discriminator", + schemaType: "string", + implements: ["mapping"], + error, + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, data, schema, parentSchema} = cxt + const [valid, cond] = checkNullableObject(cxt, data) + + gen.if(cond) + validateDiscriminator() + gen.elseIf(not(valid)) + cxt.error() + gen.endIf() + cxt.ok(valid) + + function validateDiscriminator(): void { + const tag = gen.const("tag", _`${data}${getProperty(schema)}`) + gen.if(_`${tag} === undefined`) + cxt.error(false, {discrError: DiscrError.Tag, tag}) + gen.elseIf(_`typeof ${tag} == "string"`) + validateMapping(tag) + gen.else() + cxt.error(false, {discrError: DiscrError.Tag, tag}, {instancePath: schema}) + gen.endIf() + } + + function validateMapping(tag: Name): void { + gen.if(false) + for (const tagValue in parentSchema.mapping) { + gen.elseIf(_`${tag} === ${tagValue}`) + gen.assign(valid, applyTagSchema(tagValue)) + } + gen.else() + cxt.error( + false, + {discrError: DiscrError.Mapping, tag}, + {instancePath: schema, schemaPath: "mapping", parentSchema: true} + ) + gen.endIf() + } + + function applyTagSchema(schemaProp: string): Name { + const _valid = gen.name("valid") + cxt.subschema( + { + keyword: "mapping", + schemaProp, + jtdDiscriminator: schema, + }, + _valid + ) + return _valid + } + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/elements.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/elements.ts new file mode 100644 index 000000000..983af7c02 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/elements.ts @@ -0,0 +1,32 @@ +import type {CodeKeywordDefinition, SchemaObject} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {alwaysValidSchema} from "../../compile/util" +import {validateArray} from "../code" +import {_, not} from "../../compile/codegen" +import {checkMetadata} from "./metadata" +import {checkNullable} from "./nullable" +import {typeError, _JTDTypeError} from "./error" + +export type JTDElementsError = _JTDTypeError<"elements", "array", SchemaObject> + +const def: CodeKeywordDefinition = { + keyword: "elements", + schemaType: "object", + error: typeError("array"), + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, data, schema, it} = cxt + if (alwaysValidSchema(it, schema)) return + const [valid] = checkNullable(cxt) + gen.if(not(valid), () => + gen.if( + _`Array.isArray(${data})`, + () => gen.assign(valid, validateArray(cxt)), + () => cxt.error() + ) + ) + cxt.ok(valid) + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/enum.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/enum.ts new file mode 100644 index 000000000..75464ff8e --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/enum.ts @@ -0,0 +1,45 @@ +import type {CodeKeywordDefinition, KeywordErrorDefinition, ErrorObject} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, or, and, Code} from "../../compile/codegen" +import {checkMetadata} from "./metadata" +import {checkNullable} from "./nullable" + +export type JTDEnumError = ErrorObject<"enum", {allowedValues: string[]}, string[]> + +const error: KeywordErrorDefinition = { + message: "must be equal to one of the allowed values", + params: ({schemaCode}) => _`{allowedValues: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "enum", + schemaType: "array", + error, + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, data, schema, schemaValue, parentSchema, it} = cxt + if (schema.length === 0) throw new Error("enum must have non-empty array") + if (schema.length !== new Set(schema).size) throw new Error("enum items must be unique") + let valid: Code + const isString = _`typeof ${data} == "string"` + if (schema.length >= it.opts.loopEnum) { + let cond: Code + ;[valid, cond] = checkNullable(cxt, isString) + gen.if(cond, loopEnum) + } else { + /* istanbul ignore if */ + if (!Array.isArray(schema)) throw new Error("ajv implementation error") + valid = and(isString, or(...schema.map((value: string) => _`${data} === ${value}`))) + if (parentSchema.nullable) valid = or(_`${data} === null`, valid) + } + cxt.pass(valid) + + function loopEnum(): void { + gen.forOf("v", schemaValue as Code, (v) => + gen.if(_`${valid} = ${data} === ${v}`, () => gen.break()) + ) + } + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/error.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/error.ts new file mode 100644 index 000000000..506932258 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/error.ts @@ -0,0 +1,23 @@ +import type {KeywordErrorDefinition, KeywordErrorCxt, ErrorObject} from "../../types" +import {_, Code} from "../../compile/codegen" + +export type _JTDTypeError = ErrorObject< + K, + {type: T; nullable: boolean}, + S +> + +export function typeError(t: string): KeywordErrorDefinition { + return { + message: (cxt) => typeErrorMessage(cxt, t), + params: (cxt) => typeErrorParams(cxt, t), + } +} + +export function typeErrorMessage({parentSchema}: KeywordErrorCxt, t: string): string { + return parentSchema?.nullable ? `must be ${t} or null` : `must be ${t}` +} + +export function typeErrorParams({parentSchema}: KeywordErrorCxt, t: string): Code { + return _`{type: ${t}, nullable: ${!!parentSchema?.nullable}}` +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/index.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/index.ts new file mode 100644 index 000000000..f7baebc30 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/index.ts @@ -0,0 +1,37 @@ +import type {Vocabulary} from "../../types" +import refKeyword from "./ref" +import typeKeyword, {JTDTypeError} from "./type" +import enumKeyword, {JTDEnumError} from "./enum" +import elements, {JTDElementsError} from "./elements" +import properties, {JTDPropertiesError} from "./properties" +import optionalProperties from "./optionalProperties" +import discriminator, {JTDDiscriminatorError} from "./discriminator" +import values, {JTDValuesError} from "./values" +import union from "./union" +import metadata from "./metadata" + +const jtdVocabulary: Vocabulary = [ + "definitions", + refKeyword, + typeKeyword, + enumKeyword, + elements, + properties, + optionalProperties, + discriminator, + values, + union, + metadata, + {keyword: "additionalProperties", schemaType: "boolean"}, + {keyword: "nullable", schemaType: "boolean"}, +] + +export default jtdVocabulary + +export type JTDErrorObject = + | JTDTypeError + | JTDEnumError + | JTDElementsError + | JTDPropertiesError + | JTDDiscriminatorError + | JTDValuesError diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/metadata.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/metadata.ts new file mode 100644 index 000000000..19eeb8c7d --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/metadata.ts @@ -0,0 +1,24 @@ +import {KeywordCxt} from "../../ajv" +import type {CodeKeywordDefinition} from "../../types" +import {alwaysValidSchema} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: "metadata", + schemaType: "object", + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, schema, it} = cxt + if (alwaysValidSchema(it, schema)) return + const valid = gen.name("valid") + cxt.subschema({keyword: "metadata", jtdMetadata: true}, valid) + cxt.ok(valid) + }, +} + +export function checkMetadata({it, keyword}: KeywordCxt, metadata?: boolean): void { + if (it.jtdMetadata !== metadata) { + throw new Error(`JTD: "${keyword}" cannot be used in this schema location`) + } +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/nullable.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/nullable.ts new file mode 100644 index 000000000..c74b05da7 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/nullable.ts @@ -0,0 +1,21 @@ +import type {KeywordCxt} from "../../compile/validate" +import {_, not, nil, Code, Name} from "../../compile/codegen" + +export function checkNullable( + {gen, data, parentSchema}: KeywordCxt, + cond: Code = nil +): [Name, Code] { + const valid = gen.name("valid") + if (parentSchema.nullable) { + gen.let(valid, _`${data} === null`) + cond = not(valid) + } else { + gen.let(valid, false) + } + return [valid, cond] +} + +export function checkNullableObject(cxt: KeywordCxt, cond: Code): [Name, Code] { + const [valid, cond_] = checkNullable(cxt, cond) + return [valid, _`${cond_} && typeof ${cxt.data} == "object" && !Array.isArray(${cxt.data})`] +} diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts new file mode 100644 index 000000000..8e91c8d91 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/optionalProperties.ts @@ -0,0 +1,15 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {validateProperties, error} from "./properties" + +const def: CodeKeywordDefinition = { + keyword: "optionalProperties", + schemaType: "object", + error, + code(cxt: KeywordCxt) { + if (cxt.parentSchema.properties) return + validateProperties(cxt) + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/properties.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/properties.ts new file mode 100644 index 000000000..728c0b92c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/properties.ts @@ -0,0 +1,177 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + SchemaObject, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {propertyInData, allSchemaProperties, isOwnProperty} from "../code" +import {alwaysValidSchema, schemaRefOrVal} from "../../compile/util" +import {_, and, not, Code, Name} from "../../compile/codegen" +import {checkMetadata} from "./metadata" +import {checkNullableObject} from "./nullable" +import {typeErrorMessage, typeErrorParams, _JTDTypeError} from "./error" + +enum PropError { + Additional = "additional", + Missing = "missing", +} + +type PropKeyword = "properties" | "optionalProperties" + +type PropSchema = {[P in string]?: SchemaObject} + +export type JTDPropertiesError = + | _JTDTypeError + | ErrorObject + | ErrorObject + +export const error: KeywordErrorDefinition = { + message: (cxt) => { + const {params} = cxt + return params.propError + ? params.propError === PropError.Additional + ? "must NOT have additional properties" + : `must have property '${params.missingProperty}'` + : typeErrorMessage(cxt, "object") + }, + params: (cxt) => { + const {params} = cxt + return params.propError + ? params.propError === PropError.Additional + ? _`{error: ${params.propError}, additionalProperty: ${params.additionalProperty}}` + : _`{error: ${params.propError}, missingProperty: ${params.missingProperty}}` + : typeErrorParams(cxt, "object") + }, +} + +const def: CodeKeywordDefinition = { + keyword: "properties", + schemaType: "object", + error, + code: validateProperties, +} + +// const error: KeywordErrorDefinition = { +// message: "should NOT have additional properties", +// params: ({params}) => _`{additionalProperty: ${params.additionalProperty}}`, +// } + +export function validateProperties(cxt: KeywordCxt): void { + checkMetadata(cxt) + const {gen, data, parentSchema, it} = cxt + const {additionalProperties, nullable} = parentSchema + if (it.jtdDiscriminator && nullable) throw new Error("JTD: nullable inside discriminator mapping") + if (commonProperties()) { + throw new Error("JTD: properties and optionalProperties have common members") + } + const [allProps, properties] = schemaProperties("properties") + const [allOptProps, optProperties] = schemaProperties("optionalProperties") + if (properties.length === 0 && optProperties.length === 0 && additionalProperties) { + return + } + + const [valid, cond] = + it.jtdDiscriminator === undefined + ? checkNullableObject(cxt, data) + : [gen.let("valid", false), true] + gen.if(cond, () => + gen.assign(valid, true).block(() => { + validateProps(properties, "properties", true) + validateProps(optProperties, "optionalProperties") + if (!additionalProperties) validateAdditional() + }) + ) + cxt.pass(valid) + + function commonProperties(): boolean { + const props = parentSchema.properties as Record | undefined + const optProps = parentSchema.optionalProperties as Record | undefined + if (!(props && optProps)) return false + for (const p in props) { + if (Object.prototype.hasOwnProperty.call(optProps, p)) return true + } + return false + } + + function schemaProperties(keyword: string): [string[], string[]] { + const schema = parentSchema[keyword] + const allPs = schema ? allSchemaProperties(schema) : [] + if (it.jtdDiscriminator && allPs.some((p) => p === it.jtdDiscriminator)) { + throw new Error(`JTD: discriminator tag used in ${keyword}`) + } + const ps = allPs.filter((p) => !alwaysValidSchema(it, schema[p])) + return [allPs, ps] + } + + function validateProps(props: string[], keyword: string, required?: boolean): void { + const _valid = gen.var("valid") + for (const prop of props) { + gen.if( + propertyInData(gen, data, prop, it.opts.ownProperties), + () => applyPropertySchema(prop, keyword, _valid), + () => missingProperty(prop) + ) + cxt.ok(_valid) + } + + function missingProperty(prop: string): void { + if (required) { + gen.assign(_valid, false) + cxt.error(false, {propError: PropError.Missing, missingProperty: prop}, {schemaPath: prop}) + } else { + gen.assign(_valid, true) + } + } + } + + function applyPropertySchema(prop: string, keyword: string, _valid: Name): void { + cxt.subschema( + { + keyword, + schemaProp: prop, + dataProp: prop, + }, + _valid + ) + } + + function validateAdditional(): void { + gen.forIn("key", data, (key: Name) => { + const _allProps = + it.jtdDiscriminator === undefined ? allProps : [it.jtdDiscriminator].concat(allProps) + const addProp = isAdditional(key, _allProps, "properties") + const addOptProp = isAdditional(key, allOptProps, "optionalProperties") + const extra = + addProp === true ? addOptProp : addOptProp === true ? addProp : and(addProp, addOptProp) + gen.if(extra, () => { + if (it.opts.removeAdditional) { + gen.code(_`delete ${data}[${key}]`) + } else { + cxt.error( + false, + {propError: PropError.Additional, additionalProperty: key}, + {instancePath: key, parentSchema: true} + ) + if (!it.opts.allErrors) gen.break() + } + }) + }) + } + + function isAdditional(key: Name, props: string[], keyword: string): Code | true { + let additional: Code | boolean + if (props.length > 8) { + // TODO maybe an option instead of hard-coded 8? + const propsSchema = schemaRefOrVal(it, parentSchema[keyword], keyword) + additional = not(isOwnProperty(gen, propsSchema as Code, key)) + } else if (props.length) { + additional = and(...props.map((p) => _`${key} !== ${p}`)) + } else { + additional = true + } + return additional + } +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/ref.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/ref.ts new file mode 100644 index 000000000..97646ee1b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/ref.ts @@ -0,0 +1,76 @@ +import type {CodeKeywordDefinition, AnySchemaObject} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {compileSchema, SchemaEnv} from "../../compile" +import {_, not, nil, stringify} from "../../compile/codegen" +import MissingRefError from "../../compile/ref_error" +import N from "../../compile/names" +import {getValidate, callRef} from "../core/ref" +import {checkMetadata} from "./metadata" + +const def: CodeKeywordDefinition = { + keyword: "ref", + schemaType: "string", + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, data, schema: ref, parentSchema, it} = cxt + const { + schemaEnv: {root}, + } = it + const valid = gen.name("valid") + if (parentSchema.nullable) { + gen.var(valid, _`${data} === null`) + gen.if(not(valid), validateJtdRef) + } else { + gen.var(valid, false) + validateJtdRef() + } + cxt.ok(valid) + + function validateJtdRef(): void { + const refSchema = (root.schema as AnySchemaObject).definitions?.[ref] + if (!refSchema) { + throw new MissingRefError(it.opts.uriResolver, "", ref, `No definition ${ref}`) + } + if (hasRef(refSchema) || !it.opts.inlineRefs) callValidate(refSchema) + else inlineRefSchema(refSchema) + } + + function callValidate(schema: AnySchemaObject): void { + const sch = compileSchema.call( + it.self, + new SchemaEnv({schema, root, schemaPath: `/definitions/${ref}`}) + ) + const v = getValidate(cxt, sch) + const errsCount = gen.const("_errs", N.errors) + callRef(cxt, v, sch, sch.$async) + gen.assign(valid, _`${errsCount} === ${N.errors}`) + } + + function inlineRefSchema(schema: AnySchemaObject): void { + const schName = gen.scopeValue( + "schema", + it.opts.code.source === true ? {ref: schema, code: stringify(schema)} : {ref: schema} + ) + cxt.subschema( + { + schema, + dataTypes: [], + schemaPath: nil, + topSchemaRef: schName, + errSchemaPath: `/definitions/${ref}`, + }, + valid + ) + } + }, +} + +export function hasRef(schema: AnySchemaObject): boolean { + for (const key in schema) { + let sch: AnySchemaObject + if (key === "ref" || (typeof (sch = schema[key]) == "object" && hasRef(sch))) return true + } + return false +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/type.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/type.ts new file mode 100644 index 000000000..17274300b --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/type.ts @@ -0,0 +1,75 @@ +import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, nil, or, Code} from "../../compile/codegen" +import validTimestamp from "../../runtime/timestamp" +import {useFunc} from "../../compile/util" +import {checkMetadata} from "./metadata" +import {typeErrorMessage, typeErrorParams, _JTDTypeError} from "./error" + +export type JTDTypeError = _JTDTypeError<"type", JTDType, JTDType> + +export type IntType = "int8" | "uint8" | "int16" | "uint16" | "int32" | "uint32" + +export const intRange: {[T in IntType]: [number, number, number]} = { + int8: [-128, 127, 3], + uint8: [0, 255, 3], + int16: [-32768, 32767, 5], + uint16: [0, 65535, 5], + int32: [-2147483648, 2147483647, 10], + uint32: [0, 4294967295, 10], +} + +export type JTDType = "boolean" | "string" | "timestamp" | "float32" | "float64" | IntType + +const error: KeywordErrorDefinition = { + message: (cxt) => typeErrorMessage(cxt, cxt.schema), + params: (cxt) => typeErrorParams(cxt, cxt.schema), +} + +function timestampCode(cxt: KeywordCxt): Code { + const {gen, data, it} = cxt + const {timestamp, allowDate} = it.opts + if (timestamp === "date") return _`${data} instanceof Date ` + const vts = useFunc(gen, validTimestamp) + const allowDateArg = allowDate ? _`, true` : nil + const validString = _`typeof ${data} == "string" && ${vts}(${data}${allowDateArg})` + return timestamp === "string" ? validString : or(_`${data} instanceof Date`, validString) +} + +const def: CodeKeywordDefinition = { + keyword: "type", + schemaType: "string", + error, + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {data, schema, parentSchema, it} = cxt + let cond: Code + switch (schema) { + case "boolean": + case "string": + cond = _`typeof ${data} == ${schema}` + break + case "timestamp": { + cond = timestampCode(cxt) + break + } + case "float32": + case "float64": + cond = _`typeof ${data} == "number"` + break + default: { + const sch = schema as IntType + cond = _`typeof ${data} == "number" && isFinite(${data}) && !(${data} % 1)` + if (!it.opts.int32range && (sch === "int32" || sch === "uint32")) { + if (sch === "uint32") cond = _`${cond} && ${data} >= 0` + } else { + const [min, max] = intRange[sch] + cond = _`${cond} && ${data} >= ${min} && ${data} <= ${max}` + } + } + } + cxt.pass(parentSchema.nullable ? or(_`${data} === null`, cond) : cond) + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/union.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/union.ts new file mode 100644 index 000000000..588f07ab4 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/union.ts @@ -0,0 +1,12 @@ +import type {CodeKeywordDefinition} from "../../types" +import {validateUnion} from "../code" + +const def: CodeKeywordDefinition = { + keyword: "union", + schemaType: "array", + trackErrors: true, + code: validateUnion, + error: {message: "must match a schema in union"}, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/values.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/values.ts new file mode 100644 index 000000000..86091b8ce --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/jtd/values.ts @@ -0,0 +1,55 @@ +import type {CodeKeywordDefinition, SchemaObject} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {alwaysValidSchema, Type} from "../../compile/util" +import {not, Name} from "../../compile/codegen" +import {checkMetadata} from "./metadata" +import {checkNullableObject} from "./nullable" +import {typeError, _JTDTypeError} from "./error" + +export type JTDValuesError = _JTDTypeError<"values", "object", SchemaObject> + +const def: CodeKeywordDefinition = { + keyword: "values", + schemaType: "object", + error: typeError("object"), + code(cxt: KeywordCxt) { + checkMetadata(cxt) + const {gen, data, schema, it} = cxt + if (alwaysValidSchema(it, schema)) return + const [valid, cond] = checkNullableObject(cxt, data) + gen.if(cond) + gen.assign(valid, validateMap()) + gen.elseIf(not(valid)) + cxt.error() + gen.endIf() + cxt.ok(valid) + + function validateMap(): Name | boolean { + const _valid = gen.name("valid") + if (it.allErrors) { + const validMap = gen.let("valid", true) + validateValues(() => gen.assign(validMap, false)) + return validMap + } + gen.var(_valid, true) + validateValues(() => gen.break()) + return _valid + + function validateValues(notValid: () => void): void { + gen.forIn("key", data, (key) => { + cxt.subschema( + { + keyword: "values", + dataProp: key, + dataPropType: Type.Str, + }, + _valid + ) + gen.if(not(_valid), notValid) + }) + } + } + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/metadata.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/metadata.ts new file mode 100644 index 000000000..b9d5af85f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/metadata.ts @@ -0,0 +1,17 @@ +import type {Vocabulary} from "../types" + +export const metadataVocabulary: Vocabulary = [ + "title", + "description", + "default", + "deprecated", + "readOnly", + "writeOnly", + "examples", +] + +export const contentVocabulary: Vocabulary = [ + "contentMediaType", + "contentEncoding", + "contentSchema", +] diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/next.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/next.ts new file mode 100644 index 000000000..1e987ad21 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/next.ts @@ -0,0 +1,8 @@ +import type {Vocabulary} from "../types" +import dependentRequired from "./validation/dependentRequired" +import dependentSchemas from "./applicator/dependentSchemas" +import limitContains from "./validation/limitContains" + +const next: Vocabulary = [dependentRequired, dependentSchemas, limitContains] + +export default next diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/unevaluated/index.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/unevaluated/index.ts new file mode 100644 index 000000000..f7f0815db --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/unevaluated/index.ts @@ -0,0 +1,7 @@ +import type {Vocabulary} from "../../types" +import unevaluatedProperties from "./unevaluatedProperties" +import unevaluatedItems from "./unevaluatedItems" + +const unevaluated: Vocabulary = [unevaluatedProperties, unevaluatedItems] + +export default unevaluated diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts new file mode 100644 index 000000000..50bf0e7c1 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedItems.ts @@ -0,0 +1,47 @@ +import type { + CodeKeywordDefinition, + ErrorObject, + KeywordErrorDefinition, + AnySchema, +} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, not, Name} from "../../compile/codegen" +import {alwaysValidSchema, Type} from "../../compile/util" + +export type UnevaluatedItemsError = ErrorObject<"unevaluatedItems", {limit: number}, AnySchema> + +const error: KeywordErrorDefinition = { + message: ({params: {len}}) => str`must NOT have more than ${len} items`, + params: ({params: {len}}) => _`{limit: ${len}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "unevaluatedItems", + type: "array", + schemaType: ["boolean", "object"], + error, + code(cxt: KeywordCxt) { + const {gen, schema, data, it} = cxt + const items = it.items || 0 + if (items === true) return + const len = gen.const("len", _`${data}.length`) + if (schema === false) { + cxt.setParams({len: items}) + cxt.fail(_`${len} > ${items}`) + } else if (typeof schema == "object" && !alwaysValidSchema(it, schema)) { + const valid = gen.var("valid", _`${len} <= ${items}`) + gen.if(not(valid), () => validateItems(valid, items)) + cxt.ok(valid) + } + it.items = true + + function validateItems(valid: Name, from: Name | number): void { + gen.forRange("i", from, len, (i) => { + cxt.subschema({keyword: "unevaluatedItems", dataProp: i, dataPropType: Type.Num}, valid) + if (!it.allErrors) gen.if(not(valid), () => gen.break()) + }) + } + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts new file mode 100644 index 000000000..0e6868fa3 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/unevaluated/unevaluatedProperties.ts @@ -0,0 +1,85 @@ +import type { + CodeKeywordDefinition, + KeywordErrorDefinition, + ErrorObject, + AnySchema, +} from "../../types" +import {_, not, and, Name, Code} from "../../compile/codegen" +import {alwaysValidSchema, Type} from "../../compile/util" +import N from "../../compile/names" + +export type UnevaluatedPropertiesError = ErrorObject< + "unevaluatedProperties", + {unevaluatedProperty: string}, + AnySchema +> + +const error: KeywordErrorDefinition = { + message: "must NOT have unevaluated properties", + params: ({params}) => _`{unevaluatedProperty: ${params.unevaluatedProperty}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "unevaluatedProperties", + type: "object", + schemaType: ["boolean", "object"], + trackErrors: true, + error, + code(cxt) { + const {gen, schema, data, errsCount, it} = cxt + /* istanbul ignore if */ + if (!errsCount) throw new Error("ajv implementation error") + const {allErrors, props} = it + if (props instanceof Name) { + gen.if(_`${props} !== true`, () => + gen.forIn("key", data, (key: Name) => + gen.if(unevaluatedDynamic(props, key), () => unevaluatedPropCode(key)) + ) + ) + } else if (props !== true) { + gen.forIn("key", data, (key: Name) => + props === undefined + ? unevaluatedPropCode(key) + : gen.if(unevaluatedStatic(props, key), () => unevaluatedPropCode(key)) + ) + } + it.props = true + cxt.ok(_`${errsCount} === ${N.errors}`) + + function unevaluatedPropCode(key: Name): void { + if (schema === false) { + cxt.setParams({unevaluatedProperty: key}) + cxt.error() + if (!allErrors) gen.break() + return + } + + if (!alwaysValidSchema(it, schema)) { + const valid = gen.name("valid") + cxt.subschema( + { + keyword: "unevaluatedProperties", + dataProp: key, + dataPropType: Type.Str, + }, + valid + ) + if (!allErrors) gen.if(not(valid), () => gen.break()) + } + } + + function unevaluatedDynamic(evaluatedProps: Name, key: Name): Code { + return _`!${evaluatedProps} || !${evaluatedProps}[${key}]` + } + + function unevaluatedStatic(evaluatedProps: {[K in string]?: true}, key: Name): Code { + const ps: Code[] = [] + for (const p in evaluatedProps) { + if (evaluatedProps[p] === true) ps.push(_`${key} !== ${p}`) + } + return and(...ps) + } + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/const.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/const.ts new file mode 100644 index 000000000..a3b94a5dc --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/const.ts @@ -0,0 +1,28 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_} from "../../compile/codegen" +import {useFunc} from "../../compile/util" +import equal from "../../runtime/equal" + +export type ConstError = ErrorObject<"const", {allowedValue: any}> + +const error: KeywordErrorDefinition = { + message: "must be equal to constant", + params: ({schemaCode}) => _`{allowedValue: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "const", + $data: true, + error, + code(cxt: KeywordCxt) { + const {gen, data, $data, schemaCode, schema} = cxt + if ($data || (schema && typeof schema == "object")) { + cxt.fail$data(_`!${useFunc(gen, equal)}(${data}, ${schemaCode})`) + } else { + cxt.fail(_`${schema} !== ${data}`) + } + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts new file mode 100644 index 000000000..4c616cfa9 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/dependentRequired.ts @@ -0,0 +1,23 @@ +import type {CodeKeywordDefinition, ErrorObject} from "../../types" +import { + validatePropertyDeps, + error, + DependenciesErrorParams, + PropertyDependencies, +} from "../applicator/dependencies" + +export type DependentRequiredError = ErrorObject< + "dependentRequired", + DependenciesErrorParams, + PropertyDependencies +> + +const def: CodeKeywordDefinition = { + keyword: "dependentRequired", + type: "object", + schemaType: "object", + error, + code: (cxt) => validatePropertyDeps(cxt), +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/enum.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/enum.ts new file mode 100644 index 000000000..76377fb02 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/enum.ts @@ -0,0 +1,54 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, or, Name, Code} from "../../compile/codegen" +import {useFunc} from "../../compile/util" +import equal from "../../runtime/equal" + +export type EnumError = ErrorObject<"enum", {allowedValues: any[]}, any[] | {$data: string}> + +const error: KeywordErrorDefinition = { + message: "must be equal to one of the allowed values", + params: ({schemaCode}) => _`{allowedValues: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "enum", + schemaType: "array", + $data: true, + error, + code(cxt: KeywordCxt) { + const {gen, data, $data, schema, schemaCode, it} = cxt + if (!$data && schema.length === 0) throw new Error("enum must have non-empty array") + const useLoop = schema.length >= it.opts.loopEnum + let eql: Name | undefined + const getEql = (): Name => (eql ??= useFunc(gen, equal)) + + let valid: Code + if (useLoop || $data) { + valid = gen.let("valid") + cxt.block$data(valid, loopEnum) + } else { + /* istanbul ignore if */ + if (!Array.isArray(schema)) throw new Error("ajv implementation error") + const vSchema = gen.const("vSchema", schemaCode) + valid = or(...schema.map((_x: unknown, i: number) => equalCode(vSchema, i))) + } + cxt.pass(valid) + + function loopEnum(): void { + gen.assign(valid, false) + gen.forOf("v", schemaCode as Code, (v) => + gen.if(_`${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break()) + ) + } + + function equalCode(vSchema: Name, i: number): Code { + const sch = schema[i] + return typeof sch === "object" && sch !== null + ? _`${getEql()}(${data}, ${vSchema}[${i}])` + : _`${data} === ${sch}` + } + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/index.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/index.ts new file mode 100644 index 000000000..3531b1962 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/index.ts @@ -0,0 +1,49 @@ +import type {ErrorObject, Vocabulary} from "../../types" +import limitNumber, {LimitNumberError} from "./limitNumber" +import multipleOf, {MultipleOfError} from "./multipleOf" +import limitLength from "./limitLength" +import pattern, {PatternError} from "./pattern" +import limitProperties from "./limitProperties" +import required, {RequiredError} from "./required" +import limitItems from "./limitItems" +import uniqueItems, {UniqueItemsError} from "./uniqueItems" +import constKeyword, {ConstError} from "./const" +import enumKeyword, {EnumError} from "./enum" + +const validation: Vocabulary = [ + // number + limitNumber, + multipleOf, + // string + limitLength, + pattern, + // object + limitProperties, + required, + // array + limitItems, + uniqueItems, + // any + {keyword: "type", schemaType: ["string", "array"]}, + {keyword: "nullable", schemaType: "boolean"}, + constKeyword, + enumKeyword, +] + +export default validation + +type LimitError = ErrorObject< + "maxItems" | "minItems" | "minProperties" | "maxProperties" | "minLength" | "maxLength", + {limit: number}, + number | {$data: string} +> + +export type ValidationKeywordError = + | LimitError + | LimitNumberError + | MultipleOfError + | PatternError + | RequiredError + | UniqueItemsError + | ConstError + | EnumError diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/limitContains.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/limitContains.ts new file mode 100644 index 000000000..8bb43c1a4 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/limitContains.ts @@ -0,0 +1,16 @@ +import type {CodeKeywordDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {checkStrictMode} from "../../compile/util" + +const def: CodeKeywordDefinition = { + keyword: ["maxContains", "minContains"], + type: "array", + schemaType: "number", + code({keyword, parentSchema, it}: KeywordCxt) { + if (parentSchema.contains === undefined) { + checkStrictMode(it, `"${keyword}" without "contains" is ignored`) + } + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/limitItems.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/limitItems.ts new file mode 100644 index 000000000..566de8588 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/limitItems.ts @@ -0,0 +1,26 @@ +import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, operators} from "../../compile/codegen" + +const error: KeywordErrorDefinition = { + message({keyword, schemaCode}) { + const comp = keyword === "maxItems" ? "more" : "fewer" + return str`must NOT have ${comp} than ${schemaCode} items` + }, + params: ({schemaCode}) => _`{limit: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: ["maxItems", "minItems"], + type: "array", + schemaType: "number", + $data: true, + error, + code(cxt: KeywordCxt) { + const {keyword, data, schemaCode} = cxt + const op = keyword === "maxItems" ? operators.GT : operators.LT + cxt.fail$data(_`${data}.length ${op} ${schemaCode}`) + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/limitLength.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/limitLength.ts new file mode 100644 index 000000000..f4f947259 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/limitLength.ts @@ -0,0 +1,30 @@ +import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, operators} from "../../compile/codegen" +import {useFunc} from "../../compile/util" +import ucs2length from "../../runtime/ucs2length" + +const error: KeywordErrorDefinition = { + message({keyword, schemaCode}) { + const comp = keyword === "maxLength" ? "more" : "fewer" + return str`must NOT have ${comp} than ${schemaCode} characters` + }, + params: ({schemaCode}) => _`{limit: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: ["maxLength", "minLength"], + type: "string", + schemaType: "number", + $data: true, + error, + code(cxt: KeywordCxt) { + const {keyword, data, schemaCode, it} = cxt + const op = keyword === "maxLength" ? operators.GT : operators.LT + const len = + it.opts.unicode === false ? _`${data}.length` : _`${useFunc(cxt.gen, ucs2length)}(${data})` + cxt.fail$data(_`${len} ${op} ${schemaCode}`) + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts new file mode 100644 index 000000000..5499202ef --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/limitNumber.ts @@ -0,0 +1,42 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, operators, Code} from "../../compile/codegen" + +const ops = operators + +type Kwd = "maximum" | "minimum" | "exclusiveMaximum" | "exclusiveMinimum" + +type Comparison = "<=" | ">=" | "<" | ">" + +const KWDs: {[K in Kwd]: {okStr: Comparison; ok: Code; fail: Code}} = { + maximum: {okStr: "<=", ok: ops.LTE, fail: ops.GT}, + minimum: {okStr: ">=", ok: ops.GTE, fail: ops.LT}, + exclusiveMaximum: {okStr: "<", ok: ops.LT, fail: ops.GTE}, + exclusiveMinimum: {okStr: ">", ok: ops.GT, fail: ops.LTE}, +} + +export type LimitNumberError = ErrorObject< + Kwd, + {limit: number; comparison: Comparison}, + number | {$data: string} +> + +const error: KeywordErrorDefinition = { + message: ({keyword, schemaCode}) => str`must be ${KWDs[keyword as Kwd].okStr} ${schemaCode}`, + params: ({keyword, schemaCode}) => + _`{comparison: ${KWDs[keyword as Kwd].okStr}, limit: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: Object.keys(KWDs), + type: "number", + schemaType: "number", + $data: true, + error, + code(cxt: KeywordCxt) { + const {keyword, data, schemaCode} = cxt + cxt.fail$data(_`${data} ${KWDs[keyword as Kwd].fail} ${schemaCode} || isNaN(${data})`) + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts new file mode 100644 index 000000000..07fffa8b3 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/limitProperties.ts @@ -0,0 +1,26 @@ +import type {CodeKeywordDefinition, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str, operators} from "../../compile/codegen" + +const error: KeywordErrorDefinition = { + message({keyword, schemaCode}) { + const comp = keyword === "maxProperties" ? "more" : "fewer" + return str`must NOT have ${comp} than ${schemaCode} properties` + }, + params: ({schemaCode}) => _`{limit: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: ["maxProperties", "minProperties"], + type: "object", + schemaType: "number", + $data: true, + error, + code(cxt: KeywordCxt) { + const {keyword, data, schemaCode} = cxt + const op = keyword === "maxProperties" ? operators.GT : operators.LT + cxt.fail$data(_`Object.keys(${data}).length ${op} ${schemaCode}`) + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts new file mode 100644 index 000000000..1fd79abbd --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/multipleOf.ts @@ -0,0 +1,34 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {_, str} from "../../compile/codegen" + +export type MultipleOfError = ErrorObject< + "multipleOf", + {multipleOf: number}, + number | {$data: string} +> + +const error: KeywordErrorDefinition = { + message: ({schemaCode}) => str`must be multiple of ${schemaCode}`, + params: ({schemaCode}) => _`{multipleOf: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "multipleOf", + type: "number", + schemaType: "number", + $data: true, + error, + code(cxt: KeywordCxt) { + const {gen, data, schemaCode, it} = cxt + // const bdt = bad$DataType(schemaCode, def.schemaType, $data) + const prec = it.opts.multipleOfPrecision + const res = gen.let("res") + const invalid = prec + ? _`Math.abs(Math.round(${res}) - ${res}) > 1e-${prec}` + : _`${res} !== parseInt(${res})` + cxt.fail$data(_`(${schemaCode} === 0 || (${res} = ${data}/${schemaCode}, ${invalid}))`) + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/pattern.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/pattern.ts new file mode 100644 index 000000000..7b27b7d3c --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/pattern.ts @@ -0,0 +1,28 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {usePattern} from "../code" +import {_, str} from "../../compile/codegen" + +export type PatternError = ErrorObject<"pattern", {pattern: string}, string | {$data: string}> + +const error: KeywordErrorDefinition = { + message: ({schemaCode}) => str`must match pattern "${schemaCode}"`, + params: ({schemaCode}) => _`{pattern: ${schemaCode}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "pattern", + type: "string", + schemaType: "string", + $data: true, + error, + code(cxt: KeywordCxt) { + const {data, $data, schema, schemaCode, it} = cxt + // TODO regexp should be wrapped in try/catchs + const u = it.opts.unicodeRegExp ? "u" : "" + const regExp = $data ? _`(new RegExp(${schemaCode}, ${u}))` : usePattern(cxt, schema) + cxt.fail$data(_`!${regExp}.test(${data})`) + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/required.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/required.ts new file mode 100644 index 000000000..fea7367ed --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/required.ts @@ -0,0 +1,98 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import { + checkReportMissingProp, + checkMissingProp, + reportMissingProp, + propertyInData, + noPropertyInData, +} from "../code" +import {_, str, nil, not, Name, Code} from "../../compile/codegen" +import {checkStrictMode} from "../../compile/util" + +export type RequiredError = ErrorObject< + "required", + {missingProperty: string}, + string[] | {$data: string} +> + +const error: KeywordErrorDefinition = { + message: ({params: {missingProperty}}) => str`must have required property '${missingProperty}'`, + params: ({params: {missingProperty}}) => _`{missingProperty: ${missingProperty}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "required", + type: "object", + schemaType: "array", + $data: true, + error, + code(cxt: KeywordCxt) { + const {gen, schema, schemaCode, data, $data, it} = cxt + const {opts} = it + if (!$data && schema.length === 0) return + const useLoop = schema.length >= opts.loopRequired + if (it.allErrors) allErrorsMode() + else exitOnErrorMode() + + if (opts.strictRequired) { + const props = cxt.parentSchema.properties + const {definedProperties} = cxt.it + for (const requiredKey of schema) { + if (props?.[requiredKey] === undefined && !definedProperties.has(requiredKey)) { + const schemaPath = it.schemaEnv.baseId + it.errSchemaPath + const msg = `required property "${requiredKey}" is not defined at "${schemaPath}" (strictRequired)` + checkStrictMode(it, msg, it.opts.strictRequired) + } + } + } + + function allErrorsMode(): void { + if (useLoop || $data) { + cxt.block$data(nil, loopAllRequired) + } else { + for (const prop of schema) { + checkReportMissingProp(cxt, prop) + } + } + } + + function exitOnErrorMode(): void { + const missing = gen.let("missing") + if (useLoop || $data) { + const valid = gen.let("valid", true) + cxt.block$data(valid, () => loopUntilMissing(missing, valid)) + cxt.ok(valid) + } else { + gen.if(checkMissingProp(cxt, schema, missing)) + reportMissingProp(cxt, missing) + gen.else() + } + } + + function loopAllRequired(): void { + gen.forOf("prop", schemaCode as Code, (prop) => { + cxt.setParams({missingProperty: prop}) + gen.if(noPropertyInData(gen, data, prop, opts.ownProperties), () => cxt.error()) + }) + } + + function loopUntilMissing(missing: Name, valid: Name): void { + cxt.setParams({missingProperty: missing}) + gen.forOf( + missing, + schemaCode as Code, + () => { + gen.assign(valid, propertyInData(gen, data, missing, opts.ownProperties)) + gen.if(not(valid), () => { + cxt.error() + gen.break() + }) + }, + nil + ) + } + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts new file mode 100644 index 000000000..765c4d04f --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/lib/vocabularies/validation/uniqueItems.ts @@ -0,0 +1,79 @@ +import type {CodeKeywordDefinition, ErrorObject, KeywordErrorDefinition} from "../../types" +import type {KeywordCxt} from "../../compile/validate" +import {checkDataTypes, getSchemaTypes, DataType} from "../../compile/validate/dataType" +import {_, str, Name} from "../../compile/codegen" +import {useFunc} from "../../compile/util" +import equal from "../../runtime/equal" + +export type UniqueItemsError = ErrorObject< + "uniqueItems", + {i: number; j: number}, + boolean | {$data: string} +> + +const error: KeywordErrorDefinition = { + message: ({params: {i, j}}) => + str`must NOT have duplicate items (items ## ${j} and ${i} are identical)`, + params: ({params: {i, j}}) => _`{i: ${i}, j: ${j}}`, +} + +const def: CodeKeywordDefinition = { + keyword: "uniqueItems", + type: "array", + schemaType: "boolean", + $data: true, + error, + code(cxt: KeywordCxt) { + const {gen, data, $data, schema, parentSchema, schemaCode, it} = cxt + if (!$data && !schema) return + const valid = gen.let("valid") + const itemTypes = parentSchema.items ? getSchemaTypes(parentSchema.items) : [] + cxt.block$data(valid, validateUniqueItems, _`${schemaCode} === false`) + cxt.ok(valid) + + function validateUniqueItems(): void { + const i = gen.let("i", _`${data}.length`) + const j = gen.let("j") + cxt.setParams({i, j}) + gen.assign(valid, true) + gen.if(_`${i} > 1`, () => (canOptimize() ? loopN : loopN2)(i, j)) + } + + function canOptimize(): boolean { + return itemTypes.length > 0 && !itemTypes.some((t) => t === "object" || t === "array") + } + + function loopN(i: Name, j: Name): void { + const item = gen.name("item") + const wrongType = checkDataTypes(itemTypes, item, it.opts.strictNumbers, DataType.Wrong) + const indices = gen.const("indices", _`{}`) + gen.for(_`;${i}--;`, () => { + gen.let(item, _`${data}[${i}]`) + gen.if(wrongType, _`continue`) + if (itemTypes.length > 1) gen.if(_`typeof ${item} == "string"`, _`${item} += "_"`) + gen + .if(_`typeof ${indices}[${item}] == "number"`, () => { + gen.assign(j, _`${indices}[${item}]`) + cxt.error() + gen.assign(valid, false).break() + }) + .code(_`${indices}[${item}] = ${i}`) + }) + } + + function loopN2(i: Name, j: Name): void { + const eql = useFunc(gen, equal) + const outer = gen.name("outer") + gen.label(outer).for(_`;${i}--;`, () => + gen.for(_`${j} = ${i}; ${j}--;`, () => + gen.if(_`${eql}(${data}[${i}], ${data}[${j}])`, () => { + cxt.error() + gen.assign(valid, false).break(outer) + }) + ) + ) + } + }, +} + +export default def diff --git a/node_modules/schema-utils/node_modules/ajv/package.json b/node_modules/schema-utils/node_modules/ajv/package.json new file mode 100644 index 000000000..c277d94d6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/ajv/package.json @@ -0,0 +1,126 @@ +{ + "name": "ajv", + "version": "8.11.0", + "description": "Another JSON Schema Validator", + "main": "dist/ajv.js", + "types": "dist/ajv.d.ts", + "files": [ + "lib/", + "dist/", + ".runkit_example.js" + ], + "scripts": { + "eslint": "eslint \"lib/**/*.ts\" \"spec/**/*.*s\" --ignore-pattern spec/JSON-Schema-Test-Suite", + "prettier:write": "prettier --write \"./**/*.{json,yaml,js,ts}\"", + "prettier:check": "prettier --list-different \"./**/*.{json,yaml,js,ts}\"", + "test-spec": "cross-env TS_NODE_PROJECT=spec/tsconfig.json mocha -r ts-node/register \"spec/**/*.spec.{ts,js}\" -R dot", + "test-codegen": "nyc cross-env TS_NODE_PROJECT=spec/tsconfig.json mocha -r ts-node/register 'spec/codegen.spec.ts' -R spec", + "test-debug": "npm run test-spec -- --inspect-brk", + "test-cov": "nyc npm run test-spec", + "rollup": "rm -rf bundle && rollup -c", + "bundle": "rm -rf bundle && node ./scripts/bundle.js ajv ajv7 ajv7 && node ./scripts/bundle.js 2019 ajv2019 ajv2019 && node ./scripts/bundle.js 2020 ajv2020 ajv2020 && node ./scripts/bundle.js jtd ajvJTD ajvJTD", + "build": "rm -rf dist && tsc && cp -r lib/refs dist && rm dist/refs/json-schema-2019-09/index.ts && rm dist/refs/json-schema-2020-12/index.ts && rm dist/refs/jtd-schema.ts", + "json-tests": "rm -rf spec/_json/*.js && node scripts/jsontests", + "test-karma": "karma start", + "test-browser": "rm -rf .browser && npm run bundle && scripts/prepare-tests && karma start", + "test-all": "npm run test-cov && if-node-version 12 npm run test-browser", + "test": "npm run json-tests && npm run prettier:check && npm run eslint && npm link && npm link --legacy-peer-deps ajv && npm run test-cov", + "test-ci": "AJV_FULL_TEST=true npm test", + "prepublish": "npm run build", + "benchmark": "npm i && npm run build && npm link && cd ./benchmark && npm link --legacy-peer-deps ajv && npm i && node ./jtd", + "docs:dev": "./scripts/prepare-site && vuepress dev docs", + "docs:build": "./scripts/prepare-site && vuepress build docs" + }, + "nyc": { + "exclude": [ + "**/spec/**", + "node_modules" + ], + "reporter": [ + "lcov", + "text-summary" + ] + }, + "repository": "ajv-validator/ajv", + "keywords": [ + "JSON", + "schema", + "validator", + "validation", + "jsonschema", + "json-schema", + "json-schema-validator", + "json-schema-validation" + ], + "author": "Evgeny Poberezkin", + "license": "MIT", + "bugs": "https://github.com/ajv-validator/ajv/issues", + "homepage": "https://ajv.js.org", + "runkitExampleFilename": ".runkit_example.js", + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "devDependencies": { + "@ajv-validator/config": "^0.3.0", + "@rollup/plugin-commonjs": "^21.0.0", + "@rollup/plugin-json": "^4.1.0", + "@rollup/plugin-node-resolve": "^13.0.0", + "@rollup/plugin-typescript": "^8.2.1", + "@types/chai": "^4.2.12", + "@types/mocha": "^9.0.0", + "@types/node": "^17.0.0", + "@types/require-from-string": "^1.2.0", + "@typescript-eslint/eslint-plugin": "^3.8.0", + "@typescript-eslint/parser": "^3.8.0", + "ajv-formats": "^3.0.0-rc.0", + "browserify": "^17.0.0", + "chai": "^4.0.1", + "cross-env": "^7.0.2", + "dayjs": "^1.10.4", + "dayjs-plugin-utc": "^0.1.2", + "eslint": "^7.8.1", + "eslint-config-prettier": "^7.0.0", + "fast-uri": "^1.0.0", + "glob": "^7.0.0", + "husky": "^7.0.1", + "if-node-version": "^1.0.0", + "jimp": "^0.16.1", + "js-beautify": "^1.7.3", + "json-schema-test": "^2.0.0", + "karma": "^6.0.0", + "karma-chrome-launcher": "^3.0.0", + "karma-mocha": "^2.0.0", + "lint-staged": "^12.1.1", + "mocha": "^9.0.2", + "module-from-string": "^3.1.3", + "node-fetch": "^3.0.0", + "nyc": "^15.0.0", + "prettier": "^2.3.1", + "re2": "^1.16.0", + "rollup": "^2.44.0", + "rollup-plugin-terser": "^7.0.2", + "ts-node": "^10.0.0", + "tsify": "^5.0.2", + "typescript": "^4.2.0" + }, + "collective": { + "type": "opencollective", + "url": "https://opencollective.com/ajv" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + }, + "prettier": "@ajv-validator/config/prettierrc.json", + "husky": { + "hooks": { + "pre-commit": "lint-staged && npm test" + } + }, + "lint-staged": { + "*.{json,yaml,js,ts}": "prettier --write" + } +} diff --git a/node_modules/schema-utils/node_modules/json-schema-traverse/.eslintrc.yml b/node_modules/schema-utils/node_modules/json-schema-traverse/.eslintrc.yml new file mode 100644 index 000000000..618559ab6 --- /dev/null +++ b/node_modules/schema-utils/node_modules/json-schema-traverse/.eslintrc.yml @@ -0,0 +1,27 @@ +extends: eslint:recommended +env: + node: true + browser: true +rules: + block-scoped-var: 2 + complexity: [2, 15] + curly: [2, multi-or-nest, consistent] + dot-location: [2, property] + dot-notation: 2 + indent: [2, 2, SwitchCase: 1] + linebreak-style: [2, unix] + new-cap: 2 + no-console: [2, allow: [warn, error]] + no-else-return: 2 + no-eq-null: 2 + no-fallthrough: 2 + no-invalid-this: 2 + no-return-assign: 2 + no-shadow: 1 + no-trailing-spaces: 2 + no-use-before-define: [2, nofunc] + quotes: [2, single, avoid-escape] + semi: [2, always] + strict: [2, global] + valid-jsdoc: [2, requireReturn: false] + no-control-regex: 0 diff --git a/node_modules/schema-utils/node_modules/json-schema-traverse/.github/FUNDING.yml b/node_modules/schema-utils/node_modules/json-schema-traverse/.github/FUNDING.yml new file mode 100644 index 000000000..44f80f417 --- /dev/null +++ b/node_modules/schema-utils/node_modules/json-schema-traverse/.github/FUNDING.yml @@ -0,0 +1,2 @@ +github: epoberezkin +tidelift: "npm/json-schema-traverse" diff --git a/node_modules/schema-utils/node_modules/json-schema-traverse/.github/workflows/build.yml b/node_modules/schema-utils/node_modules/json-schema-traverse/.github/workflows/build.yml new file mode 100644 index 000000000..f8ef5ba80 --- /dev/null +++ b/node_modules/schema-utils/node_modules/json-schema-traverse/.github/workflows/build.yml @@ -0,0 +1,28 @@ +name: build + +on: + push: + branches: [master] + pull_request: + branches: ["*"] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [10.x, 12.x, 14.x] + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + - run: npm install + - run: npm test + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/node_modules/schema-utils/node_modules/json-schema-traverse/.github/workflows/publish.yml b/node_modules/schema-utils/node_modules/json-schema-traverse/.github/workflows/publish.yml new file mode 100644 index 000000000..924825b12 --- /dev/null +++ b/node_modules/schema-utils/node_modules/json-schema-traverse/.github/workflows/publish.yml @@ -0,0 +1,27 @@ +name: publish + +on: + release: + types: [published] + +jobs: + publish-npm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v1 + with: + node-version: 14 + registry-url: https://registry.npmjs.org/ + - run: npm install + - run: npm test + - name: Publish beta version to npm + if: "github.event.release.prerelease" + run: npm publish --tag beta + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Publish to npm + if: "!github.event.release.prerelease" + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/node_modules/schema-utils/node_modules/json-schema-traverse/LICENSE b/node_modules/schema-utils/node_modules/json-schema-traverse/LICENSE new file mode 100644 index 000000000..7f1543566 --- /dev/null +++ b/node_modules/schema-utils/node_modules/json-schema-traverse/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Evgeny Poberezkin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/schema-utils/node_modules/json-schema-traverse/README.md b/node_modules/schema-utils/node_modules/json-schema-traverse/README.md new file mode 100644 index 000000000..f3e60073a --- /dev/null +++ b/node_modules/schema-utils/node_modules/json-schema-traverse/README.md @@ -0,0 +1,95 @@ +# json-schema-traverse +Traverse JSON Schema passing each schema object to callback + +[![build](https://github.com/epoberezkin/json-schema-traverse/workflows/build/badge.svg)](https://github.com/epoberezkin/json-schema-traverse/actions?query=workflow%3Abuild) +[![npm](https://img.shields.io/npm/v/json-schema-traverse)](https://www.npmjs.com/package/json-schema-traverse) +[![coverage](https://coveralls.io/repos/github/epoberezkin/json-schema-traverse/badge.svg?branch=master)](https://coveralls.io/github/epoberezkin/json-schema-traverse?branch=master) + + +## Install + +``` +npm install json-schema-traverse +``` + + +## Usage + +```javascript +const traverse = require('json-schema-traverse'); +const schema = { + properties: { + foo: {type: 'string'}, + bar: {type: 'integer'} + } +}; + +traverse(schema, {cb}); +// cb is called 3 times with: +// 1. root schema +// 2. {type: 'string'} +// 3. {type: 'integer'} + +// Or: + +traverse(schema, {cb: {pre, post}}); +// pre is called 3 times with: +// 1. root schema +// 2. {type: 'string'} +// 3. {type: 'integer'} +// +// post is called 3 times with: +// 1. {type: 'string'} +// 2. {type: 'integer'} +// 3. root schema + +``` + +Callback function `cb` is called for each schema object (not including draft-06 boolean schemas), including the root schema, in pre-order traversal. Schema references ($ref) are not resolved, they are passed as is. Alternatively, you can pass a `{pre, post}` object as `cb`, and then `pre` will be called before traversing child elements, and `post` will be called after all child elements have been traversed. + +Callback is passed these parameters: + +- _schema_: the current schema object +- _JSON pointer_: from the root schema to the current schema object +- _root schema_: the schema passed to `traverse` object +- _parent JSON pointer_: from the root schema to the parent schema object (see below) +- _parent keyword_: the keyword inside which this schema appears (e.g. `properties`, `anyOf`, etc.) +- _parent schema_: not necessarily parent object/array; in the example above the parent schema for `{type: 'string'}` is the root schema +- _index/property_: index or property name in the array/object containing multiple schemas; in the example above for `{type: 'string'}` the property name is `'foo'` + + +## Traverse objects in all unknown keywords + +```javascript +const traverse = require('json-schema-traverse'); +const schema = { + mySchema: { + minimum: 1, + maximum: 2 + } +}; + +traverse(schema, {allKeys: true, cb}); +// cb is called 2 times with: +// 1. root schema +// 2. mySchema +``` + +Without option `allKeys: true` callback will be called only with root schema. + + +## Enterprise support + +json-schema-traverse package is a part of [Tidelift enterprise subscription](https://tidelift.com/subscription/pkg/npm-json-schema-traverse?utm_source=npm-json-schema-traverse&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - it provides a centralised commercial support to open-source software users, in addition to the support provided by software maintainers. + + +## Security contact + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerability via GitHub issues. + + +## License + +[MIT](https://github.com/epoberezkin/json-schema-traverse/blob/master/LICENSE) diff --git a/node_modules/schema-utils/node_modules/json-schema-traverse/index.d.ts b/node_modules/schema-utils/node_modules/json-schema-traverse/index.d.ts new file mode 100644 index 000000000..0772daedb --- /dev/null +++ b/node_modules/schema-utils/node_modules/json-schema-traverse/index.d.ts @@ -0,0 +1,40 @@ +declare function traverse( + schema: traverse.SchemaObject, + opts: traverse.Options, + cb?: traverse.Callback +): void; + +declare function traverse( + schema: traverse.SchemaObject, + cb: traverse.Callback +): void; + +declare namespace traverse { + interface SchemaObject { + $id?: string; + $schema?: string; + [x: string]: any; + } + + type Callback = ( + schema: SchemaObject, + jsonPtr: string, + rootSchema: SchemaObject, + parentJsonPtr?: string, + parentKeyword?: string, + parentSchema?: SchemaObject, + keyIndex?: string | number + ) => void; + + interface Options { + allKeys?: boolean; + cb?: + | Callback + | { + pre?: Callback; + post?: Callback; + }; + } +} + +export = traverse; diff --git a/node_modules/schema-utils/node_modules/json-schema-traverse/index.js b/node_modules/schema-utils/node_modules/json-schema-traverse/index.js new file mode 100644 index 000000000..e521bfa85 --- /dev/null +++ b/node_modules/schema-utils/node_modules/json-schema-traverse/index.js @@ -0,0 +1,93 @@ +'use strict'; + +var traverse = module.exports = function (schema, opts, cb) { + // Legacy support for v0.3.1 and earlier. + if (typeof opts == 'function') { + cb = opts; + opts = {}; + } + + cb = opts.cb || cb; + var pre = (typeof cb == 'function') ? cb : cb.pre || function() {}; + var post = cb.post || function() {}; + + _traverse(opts, pre, post, schema, '', schema); +}; + + +traverse.keywords = { + additionalItems: true, + items: true, + contains: true, + additionalProperties: true, + propertyNames: true, + not: true, + if: true, + then: true, + else: true +}; + +traverse.arrayKeywords = { + items: true, + allOf: true, + anyOf: true, + oneOf: true +}; + +traverse.propsKeywords = { + $defs: true, + definitions: true, + properties: true, + patternProperties: true, + dependencies: true +}; + +traverse.skipKeywords = { + default: true, + enum: true, + const: true, + required: true, + maximum: true, + minimum: true, + exclusiveMaximum: true, + exclusiveMinimum: true, + multipleOf: true, + maxLength: true, + minLength: true, + pattern: true, + format: true, + maxItems: true, + minItems: true, + uniqueItems: true, + maxProperties: true, + minProperties: true +}; + + +function _traverse(opts, pre, post, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { + if (schema && typeof schema == 'object' && !Array.isArray(schema)) { + pre(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex); + for (var key in schema) { + var sch = schema[key]; + if (Array.isArray(sch)) { + if (key in traverse.arrayKeywords) { + for (var i=0; i= 12.13.0" + }, + "scripts": { + "start": "npm run build -- -w", + "clean": "del-cli dist declarations", + "prebuild": "npm run clean", + "build:types": "tsc --declaration --emitDeclarationOnly --outDir declarations && prettier \"declarations/**/*.ts\" --write", + "build:code": "cross-env NODE_ENV=production babel src -d dist --copy-files", + "build": "npm-run-all -p \"build:**\"", + "commitlint": "commitlint --from=master", + "security": "npm audit --production", + "fmt:check": "prettier \"{**/*,*}.{js,json,md,yml,css,ts}\" --list-different", + "lint:js": "eslint --cache .", + "lint:types": "tsc --pretty --noEmit", + "lint": "npm-run-all lint:js lint:types fmt:check", + "fmt": "npm run fmt:check -- --write", + "fix:js": "npm run lint:js -- --fix", + "fix": "npm-run-all fix:js fmt", + "test:only": "cross-env NODE_ENV=test jest", + "test:watch": "npm run test:only -- --watch", + "test:coverage": "npm run test:only -- --collectCoverageFrom=\"src/**/*.js\" --coverage", + "pretest": "npm run lint", + "test": "npm run test:coverage", + "prepare": "npm run build && husky install", + "release": "standard-version" + }, + "files": [ + "dist", + "declarations" + ], + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.8.0", + "ajv-keywords": "^5.0.0", + "ajv-formats": "^2.1.1" + }, + "devDependencies": { + "@babel/cli": "^7.16.0", + "@babel/core": "^7.16.0", + "@babel/preset-env": "^7.16.0", + "@commitlint/cli": "^14.1.0", + "@commitlint/config-conventional": "^14.1.0", + "@webpack-contrib/eslint-config-webpack": "^3.0.0", + "babel-jest": "^27.3.1", + "cross-env": "^7.0.3", + "del": "^6.0.0", + "del-cli": "^4.0.1", + "eslint": "^8.0.1", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-import": "^2.25.3", + "husky": "^7.0.4", + "jest": "^27.3.1", + "lint-staged": "^12.0.2", + "npm-run-all": "^4.1.5", + "prettier": "^2.4.1", + "standard-version": "^9.3.2", + "typescript": "^4.3.5", + "webpack": "^5.64.1" + }, + "keywords": [ + "webpack" + ] +} diff --git a/node_modules/slash/index.d.ts b/node_modules/slash/index.d.ts deleted file mode 100644 index f9d07d11e..000000000 --- a/node_modules/slash/index.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -/** -Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar`. - -[Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths and don't contain any non-ascii characters. - -@param path - A Windows backslash path. -@returns A path with forward slashes. - -@example -``` -import * as path from 'path'; -import slash = require('slash'); - -const string = path.join('foo', 'bar'); -// Unix => foo/bar -// Windows => foo\\bar - -slash(string); -// Unix => foo/bar -// Windows => foo/bar -``` -*/ -declare function slash(path: string): string; - -export = slash; diff --git a/node_modules/slash/index.js b/node_modules/slash/index.js deleted file mode 100644 index 103fbea97..000000000 --- a/node_modules/slash/index.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; -module.exports = path => { - const isExtendedLengthPath = /^\\\\\?\\/.test(path); - const hasNonAscii = /[^\u0000-\u0080]+/.test(path); // eslint-disable-line no-control-regex - - if (isExtendedLengthPath || hasNonAscii) { - return path; - } - - return path.replace(/\\/g, '/'); -}; diff --git a/node_modules/slash/license b/node_modules/slash/license deleted file mode 100644 index e7af2f771..000000000 --- a/node_modules/slash/license +++ /dev/null @@ -1,9 +0,0 @@ -MIT License - -Copyright (c) Sindre Sorhus (sindresorhus.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/slash/package.json b/node_modules/slash/package.json deleted file mode 100644 index c88fcc712..000000000 --- a/node_modules/slash/package.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "name": "slash", - "version": "3.0.0", - "description": "Convert Windows backslash paths to slash paths", - "license": "MIT", - "repository": "sindresorhus/slash", - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" - }, - "engines": { - "node": ">=8" - }, - "scripts": { - "test": "xo && ava && tsd" - }, - "files": [ - "index.js", - "index.d.ts" - ], - "keywords": [ - "path", - "seperator", - "slash", - "backslash", - "windows", - "convert" - ], - "devDependencies": { - "ava": "^1.4.1", - "tsd": "^0.7.2", - "xo": "^0.24.0" - } -} diff --git a/node_modules/slash/readme.md b/node_modules/slash/readme.md deleted file mode 100644 index f0ef4acbd..000000000 --- a/node_modules/slash/readme.md +++ /dev/null @@ -1,44 +0,0 @@ -# slash [![Build Status](https://travis-ci.org/sindresorhus/slash.svg?branch=master)](https://travis-ci.org/sindresorhus/slash) - -> Convert Windows backslash paths to slash paths: `foo\\bar` ➔ `foo/bar` - -[Forward-slash paths can be used in Windows](http://superuser.com/a/176395/6877) as long as they're not extended-length paths and don't contain any non-ascii characters. - -This was created since the `path` methods in Node.js outputs `\\` paths on Windows. - - -## Install - -``` -$ npm install slash -``` - - -## Usage - -```js -const path = require('path'); -const slash = require('slash'); - -const string = path.join('foo', 'bar'); -// Unix => foo/bar -// Windows => foo\\bar - -slash(string); -// Unix => foo/bar -// Windows => foo/bar -``` - - -## API - -### slash(path) - -Type: `string` - -Accepts a Windows backslash path and returns a path with forward slashes. - - -## License - -MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/superstruct/Changelog.md b/node_modules/superstruct/Changelog.md deleted file mode 100644 index 141b0b0a6..000000000 --- a/node_modules/superstruct/Changelog.md +++ /dev/null @@ -1,472 +0,0 @@ -# Changelog - -This document maintains a list of changes to the `superstruct` package with each new version. Until `1.0.0` is released, breaking changes will be added as minor version bumps, and smaller changes and fixes won't be detailed. - -### `0.16.0` — June 6, 2022 - -###### BREAKING - -**Refinement functions are now called with valid, but potentially unrefined values.** Previously the functions passed in to `refine` would always be called with sub-elements (eg. when using objects or arrays) that were completely valid **and** refined. However, this prevented collecting all the refinement errors from subelements in a validation in one go, which is common when validating forms. _Note: this should not have any affect on almost all use cases, so you're safe to upgrade._ - -### `0.15.0` — March 25, 2021 - -###### FIXED - -**Unions can now be coerced.** Previously unions created a barrier in coercion such that structs nested inside unions would not have their coercion logic triggered, but this has been fixed. - -**Assigning preserves `type` structs.** Previously using the `assign` helper would implicitly convert `type` structs into `object` structs which wasn't expected and confusing, but this has been fixed. - -### `0.14.0` — January 26, 2021 - -###### BREAKING - -**The `mask` helper now works for nested objects.** Previously it would only mask the properties at the top-level of a struct, however now it acts deeply. You can use it to define object structs once, but use them either strictly or loosely. - -**The `masked` coercion has been removed.** This previously allowed you to mix in masking to a specific struct, but the `mask` helper is a more robust way to do this, and it doesn't force you to maintain two separate structs. - -### `0.13.0` — December 11, 2020 - -###### NEW - -**Structs can now define an `entries` iterator for nested values.** Previously iterating through nested values was defined in a one-off manner inside certain structs, but this led to non-uniform support. Now, any struct can define an `entries` iterator that will cause nested values to be automatically coerced and validated. - -**Coercion receives `context` objects and supports nested values.** Previously context objects were only passed to the validations and refinements. But now the same context is passed to coercions too so you can implement more complex logic. And coercions are automatically applied to nested values thanks to the addition of `entries`. - -**Iteration logic has gotten simpler, and more performant.** The addition of the `entries` logic has enabled us to only ever iterate through a tree of values one time for coercion and validation, instead of once each. This should speed up most standard use cases. - -###### BREAKING - -**The `ctx.fail()` function has been removed.** Previously you'd use it to return more information about a failure inside a struct. Now you can simply return a partial failure object. - -**The `ctx.check()` function has been removed.** Previously you'd use it to validate nested objects in more complex struct shapes. Now you can use the new `entries` property for this instead. - -**The `context.struct` and `context.value` properties have been removed.** These properties were previously available, but unnecessary since anywhere you have the context object you will also know the `value` and the specific struct that is being validated. Keeping them around required extra unnecessary plumbing in the library that made composing structs much more difficult so they were removed. - -### `0.12.0` — November 24, 2020 - -###### NEW - -**New `Describe` utility type.** This new utility lets you define a struct from an existing TypeScript type and ensure that the struct's validation matches it, otherwise TypeScript's compiler will error. For example: - -```ts -type User = { - id: number - name: string -} - -const User: Describe = object({ - id: string(), // This mistake will fail to pass type checking! - name: string(), -}) -``` - -###### BREAKING - -**The `coerce` helper has changed to be more type-safe!** Previously `coerce` functions were called with `value: unknown` because they ran before all validation. However, now they take a new second argument that is another struct to narrow the cases where coercions occurs. This means the `value` for coercion will now be type-safe. - -```ts -// Previously -const MyNumber = coerce(number(), (value) => { - return typeof value === 'string' ? parseFloat(value) : value -}) - -// Now -const MyNumber = coerce(number(), string(), (value) => { - return parseFloat(value) -}) -``` - -### `0.11.0` — November 20, 2020 - -###### NEW - -**New `assign`, `pick`, and `omit` object utilities.** These utilities make composing object structs together possible, which should make re-using structs in your codebase easier. - -```ts -// Combine two structs with `assign`: -const a = object({ id: number() }) -const b = object({ name: string() }) -const c = assign([a, b]) - -// Pick out specific properties with `pick`: -const a2 = pick(c, ['id']) - -// Omit specific properties with `omit`: -const a3 = omit(c, ['name']) -``` - -**New `unknown` struct.** This is the same as the existing `any` struct, but it will ensure that in TypeScript the value is of the more restrictive `unknown` type so it encourages better type safety. - -```ts -const Shape = type({ - id: number(), - name: string(), - other: unknown(), -}) -``` - -**New `integer`, `regexp`, and `func` structs.** These are just simple additions for common use cases of ensuring a value is an integer, a regular expression object (not a string!), or a function. - -```ts -const Shape = type({ - id: integer(), - matches: regexp(), - send: func(), -}) -``` - -**New `max/min` refinements.** For refining `number` (or `integer`) or `date` structs to ensure they are greater than or less than a specific threshold. The third argument can indicate whether to make the threshold exclusive (instead of the default inclusive). - -```ts -const Index = min(number(), 0) -const PastOrPresent = max(date(), new Date()) -const Past = max(date(), new Date(), { exclusive: true }) -``` - -**Even more information on errors.** Errors now expose the `error.refinement` property when the failure originated in a refinement validation. And they also now have an `error.key` property which is the key for the failure in the case of complex values like arrays/objects. (Previously the key was retrievable by checking `error.path`, but this will make the 90% case easier.) - -###### BREAKING - -**The `coerce` helper has been renamed to `create`.** This will hopefully make it more clear that it's fully coercing and validating a value against a struct, throwing errors if the value was invalid. This has caused confusion for people who though it would just coerce the value and return the unvalidated-but-coerced version. - -```ts -// Previously -const user = coerce(data, User) - -// Now -const user = create(data, User) -``` - -**The `struct`, `refinement` and `coercion` factories have been renamed.** This renaming is purely for keeping things slightly cleaner and easier to understand. The new names are `define`, `refine`, and `coerce`. Separating them slightly from the noun-based names used for the types themselves. - -```ts -// Previously -const Email = struct('email', isEmail) -const Positive = refinement('positive', number(), n => n > 0) -const Trimmed = coercion(string(), s => s.trim() - -// Now -const Email = define('email', isEmail) -const Positive = refine(number(), 'positive', n => n > 0) -const Trimmed = coerce(string(), s => s.trim()) -``` - -_Note that the order of `refine` arguments has changed to be slightly more natural, and encourage scoped refinement names._ - -**The `length` refinement has been renamed to `size`.** This is to match with the expansion of it's abilities from purely strings and arrays to also now include numbers, maps, and sets. In addition you can also omit the `max` argument to specify an exact size: - -```ts -// Previously -const Name = length(string(), 1, 100) -const MyArray = length(array(string()), 3, 3) - -// Now -const Name = size(string(), 1, 100) -const MyArray = size(array(string()), 3) -const Id = size(integer(), 1, Infinity) -const MySet = size(set(), 1, 9) -``` - -**The `StructType` inferring helper has been renamed to `Infer`.** This just makes it slightly easier to read what's going on when you're inferring a type. - -```ts -// Previously -type User = StructType - -// Now -type User = Infer -``` - -**The `error.type` property has been standardized.** Previously it was a human-readable description that sort of incorporated the schema. Now it is simple the plain lowercase name of the struct in question, making it something you can use programmatically when formatting errors. - -```ts -// Previously -'Array' -'[string,number]' -'Map' - -// Now -'array' -'tuple' -'map' -``` - -### `0.10.0` — June 6, 2020 - -The `0.10` version is a complete overhaul with the goal of making Superstruct much simpler and easier to understand, and with complete support for runtime type signatures TypeScript. - -This makes it much more powerful, however the core architecture has had to change to make it happen. It will still look very similar, but migrating between the versions _will be more work than usual_. There's no requirement to upgrade, although if you're using Superstruct in concert with TypeScript you will have a much better experience. - -###### BREAKING - -**All types are created from factories.** Previously depending on whether the type was a complex type or a scalar type they'd be defined different. Complex types used factories, whereas scalars used strings. Now all types are exposed as factories. - -For example, previously: - -```ts -import { struct } from 'superstruct' - -const User = struct.object({ - name: 'string', - age: 'number', -}) -``` - -Now becomes: - -```ts -import { object, string, number } from 'superstruct' - -const User = object({ - name: string(), - age: number(), -}) -``` - -**Custom scalars are no longer pre-defined as strings.** Previously, you would define all of your "custom" types in a single place in your codebase and then refer to them in structs later on with a string value. This worked, but added a layer of unnecessary indirection, and made it impossible to accomodate runtime type signatures. - -In the new version, custom types are defined extremely similarly to non-custom types. And this has the added benefit that you can easily trace the custom type definitions by just following `import` statements. - -Here's how it used to work: - -```ts -import { superstruct } from 'superstruct' -import isEmail from 'is-email' - -const struct = superstruct({ - types: { - email: isEmail, - }, -}) - -const Email = struct('email') -``` - -And here's what it would look like now: - -```ts -import { struct } from 'superstruct' -import isEmail from 'is-email' - -const Email = struct('email', isEmail) -``` - -**Validation logic has been moved to helper functions.** Previously the `assert` and `is` helpers lived on the struct objects themselves. Now, these functions have been extracted into separate helpers. This was unfortunately necessary to work around limitations in TypeScript's `asserts` keyword. - -For example, before: - -```ts -User.assert(data) -``` - -Now would be: - -```ts -import { assert } from 'superstruct' - -assert(data, User) -``` - -**Coercion is now separate from validation.** Previously there was native logic for handling default values for structs when validating them. This has been abstracted into the ability to define _any_ custom coercion logic for structs, and it has been separate from validation to make it very clear when data can change and when it cannot. - -For example, previously: - -```ts -const output = User.assert(input) -``` - -Would now be: - -```ts -const input = coerce(input, User) -``` - -The `coerce` step is the only time that data will be transformed at all by coercion logic, and the `assert` step no longer needs to return any values. This makes it easy to do things like: - -```ts -if (is(input, User)) { - // ... -} -``` - -**Validation context is now a dictionary of properties.** Previously when performing complex validation logic that was dependent on other properties on the root object, you could use the second `branch` argument to the validation function. This argument has been changed to be a `context` dictionary with more information. The same branch argument can now be accessed as `context.branch`, along with the new information. - -**Unknown properties of objects now have a `'never'` type.** Previously unknown properties would throw errors with `type === null`, however the newly introduced `'never'` type is now used instead. - -**Defaults are now defined with a separate coercion helper.** Previously all structs took a second argument that defined the default value to use if an `undefined` value was present. This has been pulled out into a separate helper now to clearly distinguish coercion logic. - -For example, previously you'd do: - -```ts -const Article = struct.object( - { - title: 'string', - }, - { - title: 'Untitled', - } -) -``` - -Whereas now you'd do: - -```ts -const Article = defaulted( - object({ - title: string(), - }), - { - title: 'Untitled', - } -) -``` - -**Optional arguments are now defined with a seperate factory.** Similarly to defaults, there is a new `optional` factory for defined values that can also be `undefined`. - -Previously you'd do: - -```ts -const Flag = struct('string?') -``` - -Now you'd do: - -```ts -const Flag = optional(string()) -``` - -**Several structs have been renamed.** This was necessary because structs are now exposed directly as variables, which runs afoul of reserved words. So the following renames have been applied: - -- `interface` -> `type` -- `enum` -> `enums` -- `function` -> `func` - -### `0.8.0` — October 8, 2019 - -###### BREAKING - -**Several structs have been renamed!** Superstruct tries to mimic established naming schemes whenever possible for its API, and TypeScript is one of our main comparisons. To make things easier for people, we've renamed a few structs to more closely match their TypeScript counterparts: - -- The `list` struct is now called `array`. -- The `partial` struct is now called `pick`. -- The `dict` struct is now called `record`. - -Hopefully this will make them easier to understand at a glance! - -**The `enums` struct has been removed!** This was special-cased in the API previously, but you can get the exact same behavior by creating an using the `array` and `enum` structs: - -```js -struct.array(struct.enum(['red', 'blue', 'green'])) -``` - -**The `any` struct has been removed! (Not the scalar though.)** Previously `struct.any()` was exposed that did the same thing as `struct()`, allowing you to use shorthands for common structs. But this was confusingly named because it has nothing to do with the `'any'` scalar type. And since it was redundant it has been removed. - -**The `interface` struct now returns the original, unaltered value!** In an effort to make things more familiar, the `interface` struct now always returns the object that it is called with when it passes validation. So if the object was a function, a function will be returned. This makes it match more closely with the idea of "structural typing" that TypeScript and other typing systems are based on. \_If you want the old behavior, use the `pick` struct. - -**Computed values function signatures have changed!** Previously a computed value would be called with a signature of `(value, root)` in some cases and `(value, parent)` in others. This was confusing, and the cause for the inconsistency was complex. This logic has been simplified, and now computed values are called with `(value, branch, path)` in all cases. - -```js -struct.dynamic((value, branch, path) => { - value === branch[branch.length - 1] // you can get the value... - const parent = branch[branch.length - 2] // ...and the parent... - const key = path[path.length - 1] // ...and the key... - value === parent[key] - const root = branch[0] // ...and the root! -}) -``` - -The `path` is an array of keys representing the nested value's location in the root value. And the `branch` is an array of all of the sub values along the path to get to the current one. This allows you to always be able to receive both the **parent** and the **root** values from any location—as well as any value in between. - -**The `error.errors` property has been renamed `error.failures`, and isn't cyclical.** It being cyclical caused lots of issues whenever an `StructError` object was attempted to be serialized. And the `errors` property was slightly confusing because the elements of the array weren't full error objects. The new structure is easier to understand and work with. - -**The `error.reason` property is no longer special-cased.** Previously you could return a "reason" string from validator functions and it would be added to error objects. However, now you must return an error properties object (with a `reason` property if you'd like), and all of the properties will be added to the error object. This makes Superstruct even more flexible as far as custom error details go. - -**The `type` property of structs have been rewritten to be more clear.** This is an implementation mostly, but the `struct.type` string which shows up in error messages have been tweaked to be slightly more clear exactly what type they are checking for. - -###### NEW - -**Superstruct is now written in TypeScript.** It was rewritten from the ground up to make use of types, and to have better inline documented if you use a TypeScript-compatible IDE. There are probably improvements that can be made, so if you'd like to contribute please do! - -**A new `partial` struct mimics TypeScript's `Partial` utility.** The new struct validates that its input partially matches an object defined as a set of properties with associated types. All of the properties of the object are optional. - -**A new `size` struct allows validating array and string lengths.** The new struct validates that its input has a certain size, by checking its `length` property. This works strings or arrays. - -**You can now provide a custom `Error` setting.** By passing in your own constructor when configuring Superstruct you can have complete control over the exact errors that are generated by structs that fail validation. - -### `0.7.0` — September 21, 2019 - -###### BREAKING - -- **The build process now outputs ES5 code.** Previously it was outputting ES6 code, which posed problems for some builders. This change shouldn't really affect anyone negatively, but it's being released as a breaking version just in case. - ---- - -### `0.6.0` — September 13, 2018 - -###### BREAKING - -- **Invalid `Date` objects are now considered invalid.** Previously using the built-in `'date'` validator would only check that the object was a `Date` instance, and not that it was a valid one. This has been fixed, and although it is technically a breaking change, most everyone would have expected this behavior to begin with. - ---- - -### `0.5.0` — December 21, 2017 - -###### BREAKING - -- **Validators must now return `true`, `false` or an error reason string.** Previously any truthy value would be considered valid. Now you can provide more information for the thrown errors by providing a string which will be attached as `error.reason`. However, this means that truthy string values now equate to invalid, not valid. - -- **Property validators now receive `data` as their second argument.** Previously you only had access to the property `value`, but now you also have access to the entire object's `data`. - -###### NEW - -- **Errors can now contain reason information.** Validator functions can now return string instead of a boolean, denoting the reason a value was invalid. This can then be used to create more helpful error messages. - ---- - -### `0.4.0` — December 1, 2017 - -###### BREAKING - -- **`object` structs are no longer optional-ish.** Previously object struct types would not throw if `undefined` was passed and no properties were required. This was not only confusing, but complex to maintain. Now if you want an object struct to be optional, use the `struct.optional(...)` helper. - -- **Removed the `Struct.default` method.** If you need to get the default value, use the `Struct.validate` or `Struct.assert` methods's return value instead. - -###### NEW - -- **Added the `dict`, `enum`, `intersection`, `union` and `tuple` structs.** These are all available as `struct.dict`, `struct.enum`, etc. - ---- - -### `0.3.0` — November 30, 2017 - -###### BREAKING - -- **The `validate()` method now returns `[ error, result ]`.** Previously it only had a single return value, which necessitated extra type checking to see if the value was an error or a result. Now you can just destructure the array to get either return value, for easier coding. - -- **Errors have been simplified, removing "codes".** Previously there were multiple types of errors that were thrown and you could differentiate between them with the `error.code` property. But the other properties of the error already let you infer the code, so having multiple types of errors made for a larger API surface without much benefit. - ---- - -### `0.2.0` — November 30, 2017 - -###### BREAKING - -- **Structs are now functions again.** :smile: They are built on the same underlying schema classes underneath though, since that helps the code structure. But to allow for the `struct = Struct({ ... })` syntax the structs themselves have changed to be function. - -###### NEW - -- **The basic case is now `Struct(data)`.** Previously you had to use `Struct.assert(data)`. Although the `assert` method (and others) are still there, the basic case is a bit terser and more similar to the struct-initializing APIs in other languages. - ---- - -### `0.1.0` — November 29, 2017 - -###### BREAKING - -- **Structs are now classes instead of functions.** This is better in terms of the API being a bit less magic-y. It's also useful so that we can add other helpful methods to structs besides the `assert` method. What was previously `struct(data)` is now `struct.assert(data)`. - ---- - -### `0.0.0` — November 24, 2017 - -:tada: diff --git a/node_modules/superstruct/dist/error.d.ts b/node_modules/superstruct/dist/error.d.ts new file mode 100644 index 000000000..bd76ed63b --- /dev/null +++ b/node_modules/superstruct/dist/error.d.ts @@ -0,0 +1,33 @@ +/** + * A `StructFailure` represents a single specific failure in validation. + */ +export declare type Failure = { + value: any; + key: any; + type: string; + refinement: string | undefined; + message: string; + explanation?: string; + branch: Array; + path: Array; +}; +/** + * `StructError` objects are thrown (or returned) when validation fails. + * + * Validation logic is design to exit early for maximum performance. The error + * represents the first error encountered during validation. For more detail, + * the `error.failures` property is a generator function that can be run to + * continue validation and receive all the failures in the data. + */ +export declare class StructError extends TypeError { + value: any; + key: any; + type: string; + refinement: string | undefined; + path: Array; + branch: Array; + failures: () => Array; + [x: string]: any; + constructor(failure: Failure, failures: () => Generator); +} +//# sourceMappingURL=error.d.ts.map \ No newline at end of file diff --git a/node_modules/superstruct/dist/error.d.ts.map b/node_modules/superstruct/dist/error.d.ts.map new file mode 100644 index 000000000..b001ae2bc --- /dev/null +++ b/node_modules/superstruct/dist/error.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,oBAAY,OAAO,GAAG;IACpB,KAAK,EAAE,GAAG,CAAA;IACV,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IAClB,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;CACjB,CAAA;AAED;;;;;;;GAOG;AAEH,qBAAa,WAAY,SAAQ,SAAS;IACxC,KAAK,EAAE,GAAG,CAAA;IACV,GAAG,EAAG,GAAG,CAAA;IACT,IAAI,EAAG,MAAM,CAAA;IACb,UAAU,EAAG,MAAM,GAAG,SAAS,CAAA;IAC/B,IAAI,EAAG,KAAK,CAAC,GAAG,CAAC,CAAA;IACjB,MAAM,EAAG,KAAK,CAAC,GAAG,CAAC,CAAA;IACnB,QAAQ,EAAE,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;gBAEJ,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC,OAAO,CAAC;CAcjE"} \ No newline at end of file diff --git a/node_modules/superstruct/dist/index.cjs b/node_modules/superstruct/dist/index.cjs new file mode 100644 index 000000000..b96e73e9c --- /dev/null +++ b/node_modules/superstruct/dist/index.cjs @@ -0,0 +1,1052 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Superstruct = {})); +})(this, (function (exports) { 'use strict'; + + /** + * A `StructFailure` represents a single specific failure in validation. + */ + /** + * `StructError` objects are thrown (or returned) when validation fails. + * + * Validation logic is design to exit early for maximum performance. The error + * represents the first error encountered during validation. For more detail, + * the `error.failures` property is a generator function that can be run to + * continue validation and receive all the failures in the data. + */ + class StructError extends TypeError { + constructor(failure, failures) { + let cached; + const { message, explanation, ...rest } = failure; + const { path } = failure; + const msg = path.length === 0 ? message : `At path: ${path.join('.')} -- ${message}`; + super(explanation ?? msg); + if (explanation != null) + this.cause = msg; + Object.assign(this, rest); + this.name = this.constructor.name; + this.failures = () => { + return (cached ?? (cached = [failure, ...failures()])); + }; + } + } + + /** + * Check if a value is an iterator. + */ + function isIterable(x) { + return isObject(x) && typeof x[Symbol.iterator] === 'function'; + } + /** + * Check if a value is a plain object. + */ + function isObject(x) { + return typeof x === 'object' && x != null; + } + /** + * Check if a value is a plain object. + */ + function isPlainObject(x) { + if (Object.prototype.toString.call(x) !== '[object Object]') { + return false; + } + const prototype = Object.getPrototypeOf(x); + return prototype === null || prototype === Object.prototype; + } + /** + * Return a value as a printable string. + */ + function print(value) { + if (typeof value === 'symbol') { + return value.toString(); + } + return typeof value === 'string' ? JSON.stringify(value) : `${value}`; + } + /** + * Shifts (removes and returns) the first value from the `input` iterator. + * Like `Array.prototype.shift()` but for an `Iterator`. + */ + function shiftIterator(input) { + const { done, value } = input.next(); + return done ? undefined : value; + } + /** + * Convert a single validation result to a failure. + */ + function toFailure(result, context, struct, value) { + if (result === true) { + return; + } + else if (result === false) { + result = {}; + } + else if (typeof result === 'string') { + result = { message: result }; + } + const { path, branch } = context; + const { type } = struct; + const { refinement, message = `Expected a value of type \`${type}\`${refinement ? ` with refinement \`${refinement}\`` : ''}, but received: \`${print(value)}\``, } = result; + return { + value, + type, + refinement, + key: path[path.length - 1], + path, + branch, + ...result, + message, + }; + } + /** + * Convert a validation result to an iterable of failures. + */ + function* toFailures(result, context, struct, value) { + if (!isIterable(result)) { + result = [result]; + } + for (const r of result) { + const failure = toFailure(r, context, struct, value); + if (failure) { + yield failure; + } + } + } + /** + * Check a value against a struct, traversing deeply into nested values, and + * returning an iterator of failures or success. + */ + function* run(value, struct, options = {}) { + const { path = [], branch = [value], coerce = false, mask = false } = options; + const ctx = { path, branch }; + if (coerce) { + value = struct.coercer(value, ctx); + if (mask && + struct.type !== 'type' && + isObject(struct.schema) && + isObject(value) && + !Array.isArray(value)) { + for (const key in value) { + if (struct.schema[key] === undefined) { + delete value[key]; + } + } + } + } + let status = 'valid'; + for (const failure of struct.validator(value, ctx)) { + failure.explanation = options.message; + status = 'not_valid'; + yield [failure, undefined]; + } + for (let [k, v, s] of struct.entries(value, ctx)) { + const ts = run(v, s, { + path: k === undefined ? path : [...path, k], + branch: k === undefined ? branch : [...branch, v], + coerce, + mask, + message: options.message, + }); + for (const t of ts) { + if (t[0]) { + status = t[0].refinement != null ? 'not_refined' : 'not_valid'; + yield [t[0], undefined]; + } + else if (coerce) { + v = t[1]; + if (k === undefined) { + value = v; + } + else if (value instanceof Map) { + value.set(k, v); + } + else if (value instanceof Set) { + value.add(v); + } + else if (isObject(value)) { + if (v !== undefined || k in value) + value[k] = v; + } + } + } + } + if (status !== 'not_valid') { + for (const failure of struct.refiner(value, ctx)) { + failure.explanation = options.message; + status = 'not_refined'; + yield [failure, undefined]; + } + } + if (status === 'valid') { + yield [undefined, value]; + } + } + + /** + * `Struct` objects encapsulate the validation logic for a specific type of + * values. Once constructed, you use the `assert`, `is` or `validate` helpers to + * validate unknown input data against the struct. + */ + class Struct { + constructor(props) { + const { type, schema, validator, refiner, coercer = (value) => value, entries = function* () { }, } = props; + this.type = type; + this.schema = schema; + this.entries = entries; + this.coercer = coercer; + if (validator) { + this.validator = (value, context) => { + const result = validator(value, context); + return toFailures(result, context, this, value); + }; + } + else { + this.validator = () => []; + } + if (refiner) { + this.refiner = (value, context) => { + const result = refiner(value, context); + return toFailures(result, context, this, value); + }; + } + else { + this.refiner = () => []; + } + } + /** + * Assert that a value passes the struct's validation, throwing if it doesn't. + */ + assert(value, message) { + return assert(value, this, message); + } + /** + * Create a value with the struct's coercion logic, then validate it. + */ + create(value, message) { + return create(value, this, message); + } + /** + * Check if a value passes the struct's validation. + */ + is(value) { + return is(value, this); + } + /** + * Mask a value, coercing and validating it, but returning only the subset of + * properties defined by the struct's schema. + */ + mask(value, message) { + return mask(value, this, message); + } + /** + * Validate a value with the struct's validation logic, returning a tuple + * representing the result. + * + * You may optionally pass `true` for the `withCoercion` argument to coerce + * the value before attempting to validate it. If you do, the result will + * contain the coerced result when successful. + */ + validate(value, options = {}) { + return validate(value, this, options); + } + } + /** + * Assert that a value passes a struct, throwing if it doesn't. + */ + function assert(value, struct, message) { + const result = validate(value, struct, { message }); + if (result[0]) { + throw result[0]; + } + } + /** + * Create a value with the coercion logic of struct and validate it. + */ + function create(value, struct, message) { + const result = validate(value, struct, { coerce: true, message }); + if (result[0]) { + throw result[0]; + } + else { + return result[1]; + } + } + /** + * Mask a value, returning only the subset of properties defined by a struct. + */ + function mask(value, struct, message) { + const result = validate(value, struct, { coerce: true, mask: true, message }); + if (result[0]) { + throw result[0]; + } + else { + return result[1]; + } + } + /** + * Check if a value passes a struct. + */ + function is(value, struct) { + const result = validate(value, struct); + return !result[0]; + } + /** + * Validate a value against a struct, returning an error if invalid, or the + * value (with potential coercion) if valid. + */ + function validate(value, struct, options = {}) { + const tuples = run(value, struct, options); + const tuple = shiftIterator(tuples); + if (tuple[0]) { + const error = new StructError(tuple[0], function* () { + for (const t of tuples) { + if (t[0]) { + yield t[0]; + } + } + }); + return [error, undefined]; + } + else { + const v = tuple[1]; + return [undefined, v]; + } + } + + function assign(...Structs) { + const isType = Structs[0].type === 'type'; + const schemas = Structs.map((s) => s.schema); + const schema = Object.assign({}, ...schemas); + return isType ? type(schema) : object(schema); + } + /** + * Define a new struct type with a custom validation function. + */ + function define(name, validator) { + return new Struct({ type: name, schema: null, validator }); + } + /** + * Create a new struct based on an existing struct, but the value is allowed to + * be `undefined`. `log` will be called if the value is not `undefined`. + */ + function deprecated(struct, log) { + return new Struct({ + ...struct, + refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx), + validator(value, ctx) { + if (value === undefined) { + return true; + } + else { + log(value, ctx); + return struct.validator(value, ctx); + } + }, + }); + } + /** + * Create a struct with dynamic validation logic. + * + * The callback will receive the value currently being validated, and must + * return a struct object to validate it with. This can be useful to model + * validation logic that changes based on its input. + */ + function dynamic(fn) { + return new Struct({ + type: 'dynamic', + schema: null, + *entries(value, ctx) { + const struct = fn(value, ctx); + yield* struct.entries(value, ctx); + }, + validator(value, ctx) { + const struct = fn(value, ctx); + return struct.validator(value, ctx); + }, + coercer(value, ctx) { + const struct = fn(value, ctx); + return struct.coercer(value, ctx); + }, + refiner(value, ctx) { + const struct = fn(value, ctx); + return struct.refiner(value, ctx); + }, + }); + } + /** + * Create a struct with lazily evaluated validation logic. + * + * The first time validation is run with the struct, the callback will be called + * and must return a struct object to use. This is useful for cases where you + * want to have self-referential structs for nested data structures to avoid a + * circular definition problem. + */ + function lazy(fn) { + let struct; + return new Struct({ + type: 'lazy', + schema: null, + *entries(value, ctx) { + struct ?? (struct = fn()); + yield* struct.entries(value, ctx); + }, + validator(value, ctx) { + struct ?? (struct = fn()); + return struct.validator(value, ctx); + }, + coercer(value, ctx) { + struct ?? (struct = fn()); + return struct.coercer(value, ctx); + }, + refiner(value, ctx) { + struct ?? (struct = fn()); + return struct.refiner(value, ctx); + }, + }); + } + /** + * Create a new struct based on an existing object struct, but excluding + * specific properties. + * + * Like TypeScript's `Omit` utility. + */ + function omit(struct, keys) { + const { schema } = struct; + const subschema = { ...schema }; + for (const key of keys) { + delete subschema[key]; + } + switch (struct.type) { + case 'type': + return type(subschema); + default: + return object(subschema); + } + } + /** + * Create a new struct based on an existing object struct, but with all of its + * properties allowed to be `undefined`. + * + * Like TypeScript's `Partial` utility. + */ + function partial(struct) { + const schema = struct instanceof Struct ? { ...struct.schema } : { ...struct }; + for (const key in schema) { + schema[key] = optional(schema[key]); + } + return object(schema); + } + /** + * Create a new struct based on an existing object struct, but only including + * specific properties. + * + * Like TypeScript's `Pick` utility. + */ + function pick(struct, keys) { + const { schema } = struct; + const subschema = {}; + for (const key of keys) { + subschema[key] = schema[key]; + } + return object(subschema); + } + /** + * Define a new struct type with a custom validation function. + * + * @deprecated This function has been renamed to `define`. + */ + function struct(name, validator) { + console.warn('superstruct@0.11 - The `struct` helper has been renamed to `define`.'); + return define(name, validator); + } + + /** + * Ensure that any value passes validation. + */ + function any() { + return define('any', () => true); + } + function array(Element) { + return new Struct({ + type: 'array', + schema: Element, + *entries(value) { + if (Element && Array.isArray(value)) { + for (const [i, v] of value.entries()) { + yield [i, v, Element]; + } + } + }, + coercer(value) { + return Array.isArray(value) ? value.slice() : value; + }, + validator(value) { + return (Array.isArray(value) || + `Expected an array value, but received: ${print(value)}`); + }, + }); + } + /** + * Ensure that a value is a bigint. + */ + function bigint() { + return define('bigint', (value) => { + return typeof value === 'bigint'; + }); + } + /** + * Ensure that a value is a boolean. + */ + function boolean() { + return define('boolean', (value) => { + return typeof value === 'boolean'; + }); + } + /** + * Ensure that a value is a valid `Date`. + * + * Note: this also ensures that the value is *not* an invalid `Date` object, + * which can occur when parsing a date fails but still returns a `Date`. + */ + function date() { + return define('date', (value) => { + return ((value instanceof Date && !isNaN(value.getTime())) || + `Expected a valid \`Date\` object, but received: ${print(value)}`); + }); + } + function enums(values) { + const schema = {}; + const description = values.map((v) => print(v)).join(); + for (const key of values) { + schema[key] = key; + } + return new Struct({ + type: 'enums', + schema, + validator(value) { + return (values.includes(value) || + `Expected one of \`${description}\`, but received: ${print(value)}`); + }, + }); + } + /** + * Ensure that a value is a function. + */ + function func() { + return define('func', (value) => { + return (typeof value === 'function' || + `Expected a function, but received: ${print(value)}`); + }); + } + /** + * Ensure that a value is an instance of a specific class. + */ + function instance(Class) { + return define('instance', (value) => { + return (value instanceof Class || + `Expected a \`${Class.name}\` instance, but received: ${print(value)}`); + }); + } + /** + * Ensure that a value is an integer. + */ + function integer() { + return define('integer', (value) => { + return ((typeof value === 'number' && !isNaN(value) && Number.isInteger(value)) || + `Expected an integer, but received: ${print(value)}`); + }); + } + /** + * Ensure that a value matches all of a set of types. + */ + function intersection(Structs) { + return new Struct({ + type: 'intersection', + schema: null, + *entries(value, ctx) { + for (const S of Structs) { + yield* S.entries(value, ctx); + } + }, + *validator(value, ctx) { + for (const S of Structs) { + yield* S.validator(value, ctx); + } + }, + *refiner(value, ctx) { + for (const S of Structs) { + yield* S.refiner(value, ctx); + } + }, + }); + } + function literal(constant) { + const description = print(constant); + const t = typeof constant; + return new Struct({ + type: 'literal', + schema: t === 'string' || t === 'number' || t === 'boolean' ? constant : null, + validator(value) { + return (value === constant || + `Expected the literal \`${description}\`, but received: ${print(value)}`); + }, + }); + } + function map(Key, Value) { + return new Struct({ + type: 'map', + schema: null, + *entries(value) { + if (Key && Value && value instanceof Map) { + for (const [k, v] of value.entries()) { + yield [k, k, Key]; + yield [k, v, Value]; + } + } + }, + coercer(value) { + return value instanceof Map ? new Map(value) : value; + }, + validator(value) { + return (value instanceof Map || + `Expected a \`Map\` object, but received: ${print(value)}`); + }, + }); + } + /** + * Ensure that no value ever passes validation. + */ + function never() { + return define('never', () => false); + } + /** + * Augment an existing struct to allow `null` values. + */ + function nullable(struct) { + return new Struct({ + ...struct, + validator: (value, ctx) => value === null || struct.validator(value, ctx), + refiner: (value, ctx) => value === null || struct.refiner(value, ctx), + }); + } + /** + * Ensure that a value is a number. + */ + function number() { + return define('number', (value) => { + return ((typeof value === 'number' && !isNaN(value)) || + `Expected a number, but received: ${print(value)}`); + }); + } + function object(schema) { + const knowns = schema ? Object.keys(schema) : []; + const Never = never(); + return new Struct({ + type: 'object', + schema: schema ? schema : null, + *entries(value) { + if (schema && isObject(value)) { + const unknowns = new Set(Object.keys(value)); + for (const key of knowns) { + unknowns.delete(key); + yield [key, value[key], schema[key]]; + } + for (const key of unknowns) { + yield [key, value[key], Never]; + } + } + }, + validator(value) { + return (isObject(value) || `Expected an object, but received: ${print(value)}`); + }, + coercer(value) { + return isObject(value) ? { ...value } : value; + }, + }); + } + /** + * Augment a struct to allow `undefined` values. + */ + function optional(struct) { + return new Struct({ + ...struct, + validator: (value, ctx) => value === undefined || struct.validator(value, ctx), + refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx), + }); + } + /** + * Ensure that a value is an object with keys and values of specific types, but + * without ensuring any specific shape of properties. + * + * Like TypeScript's `Record` utility. + */ + function record(Key, Value) { + return new Struct({ + type: 'record', + schema: null, + *entries(value) { + if (isObject(value)) { + for (const k in value) { + const v = value[k]; + yield [k, k, Key]; + yield [k, v, Value]; + } + } + }, + validator(value) { + return (isObject(value) || `Expected an object, but received: ${print(value)}`); + }, + }); + } + /** + * Ensure that a value is a `RegExp`. + * + * Note: this does not test the value against the regular expression! For that + * you need to use the `pattern()` refinement. + */ + function regexp() { + return define('regexp', (value) => { + return value instanceof RegExp; + }); + } + function set(Element) { + return new Struct({ + type: 'set', + schema: null, + *entries(value) { + if (Element && value instanceof Set) { + for (const v of value) { + yield [v, v, Element]; + } + } + }, + coercer(value) { + return value instanceof Set ? new Set(value) : value; + }, + validator(value) { + return (value instanceof Set || + `Expected a \`Set\` object, but received: ${print(value)}`); + }, + }); + } + /** + * Ensure that a value is a string. + */ + function string() { + return define('string', (value) => { + return (typeof value === 'string' || + `Expected a string, but received: ${print(value)}`); + }); + } + /** + * Ensure that a value is a tuple of a specific length, and that each of its + * elements is of a specific type. + */ + function tuple(Structs) { + const Never = never(); + return new Struct({ + type: 'tuple', + schema: null, + *entries(value) { + if (Array.isArray(value)) { + const length = Math.max(Structs.length, value.length); + for (let i = 0; i < length; i++) { + yield [i, value[i], Structs[i] || Never]; + } + } + }, + validator(value) { + return (Array.isArray(value) || + `Expected an array, but received: ${print(value)}`); + }, + }); + } + /** + * Ensure that a value has a set of known properties of specific types. + * + * Note: Unrecognized properties are allowed and untouched. This is similar to + * how TypeScript's structural typing works. + */ + function type(schema) { + const keys = Object.keys(schema); + return new Struct({ + type: 'type', + schema, + *entries(value) { + if (isObject(value)) { + for (const k of keys) { + yield [k, value[k], schema[k]]; + } + } + }, + validator(value) { + return (isObject(value) || `Expected an object, but received: ${print(value)}`); + }, + coercer(value) { + return isObject(value) ? { ...value } : value; + }, + }); + } + /** + * Ensure that a value matches one of a set of types. + */ + function union(Structs) { + const description = Structs.map((s) => s.type).join(' | '); + return new Struct({ + type: 'union', + schema: null, + coercer(value) { + for (const S of Structs) { + const [error, coerced] = S.validate(value, { coerce: true }); + if (!error) { + return coerced; + } + } + return value; + }, + validator(value, ctx) { + const failures = []; + for (const S of Structs) { + const [...tuples] = run(value, S, ctx); + const [first] = tuples; + if (!first[0]) { + return []; + } + else { + for (const [failure] of tuples) { + if (failure) { + failures.push(failure); + } + } + } + } + return [ + `Expected the value to satisfy a union of \`${description}\`, but received: ${print(value)}`, + ...failures, + ]; + }, + }); + } + /** + * Ensure that any value passes validation, without widening its type to `any`. + */ + function unknown() { + return define('unknown', () => true); + } + + /** + * Augment a `Struct` to add an additional coercion step to its input. + * + * This allows you to transform input data before validating it, to increase the + * likelihood that it passes validation—for example for default values, parsing + * different formats, etc. + * + * Note: You must use `create(value, Struct)` on the value to have the coercion + * take effect! Using simply `assert()` or `is()` will not use coercion. + */ + function coerce(struct, condition, coercer) { + return new Struct({ + ...struct, + coercer: (value, ctx) => { + return is(value, condition) + ? struct.coercer(coercer(value, ctx), ctx) + : struct.coercer(value, ctx); + }, + }); + } + /** + * Augment a struct to replace `undefined` values with a default. + * + * Note: You must use `create(value, Struct)` on the value to have the coercion + * take effect! Using simply `assert()` or `is()` will not use coercion. + */ + function defaulted(struct, fallback, options = {}) { + return coerce(struct, unknown(), (x) => { + const f = typeof fallback === 'function' ? fallback() : fallback; + if (x === undefined) { + return f; + } + if (!options.strict && isPlainObject(x) && isPlainObject(f)) { + const ret = { ...x }; + let changed = false; + for (const key in f) { + if (ret[key] === undefined) { + ret[key] = f[key]; + changed = true; + } + } + if (changed) { + return ret; + } + } + return x; + }); + } + /** + * Augment a struct to trim string inputs. + * + * Note: You must use `create(value, Struct)` on the value to have the coercion + * take effect! Using simply `assert()` or `is()` will not use coercion. + */ + function trimmed(struct) { + return coerce(struct, string(), (x) => x.trim()); + } + + /** + * Ensure that a string, array, map, or set is empty. + */ + function empty(struct) { + return refine(struct, 'empty', (value) => { + const size = getSize(value); + return (size === 0 || + `Expected an empty ${struct.type} but received one with a size of \`${size}\``); + }); + } + function getSize(value) { + if (value instanceof Map || value instanceof Set) { + return value.size; + } + else { + return value.length; + } + } + /** + * Ensure that a number or date is below a threshold. + */ + function max(struct, threshold, options = {}) { + const { exclusive } = options; + return refine(struct, 'max', (value) => { + return exclusive + ? value < threshold + : value <= threshold || + `Expected a ${struct.type} less than ${exclusive ? '' : 'or equal to '}${threshold} but received \`${value}\``; + }); + } + /** + * Ensure that a number or date is above a threshold. + */ + function min(struct, threshold, options = {}) { + const { exclusive } = options; + return refine(struct, 'min', (value) => { + return exclusive + ? value > threshold + : value >= threshold || + `Expected a ${struct.type} greater than ${exclusive ? '' : 'or equal to '}${threshold} but received \`${value}\``; + }); + } + /** + * Ensure that a string, array, map or set is not empty. + */ + function nonempty(struct) { + return refine(struct, 'nonempty', (value) => { + const size = getSize(value); + return (size > 0 || `Expected a nonempty ${struct.type} but received an empty one`); + }); + } + /** + * Ensure that a string matches a regular expression. + */ + function pattern(struct, regexp) { + return refine(struct, 'pattern', (value) => { + return (regexp.test(value) || + `Expected a ${struct.type} matching \`/${regexp.source}/\` but received "${value}"`); + }); + } + /** + * Ensure that a string, array, number, date, map, or set has a size (or length, or time) between `min` and `max`. + */ + function size(struct, min, max = min) { + const expected = `Expected a ${struct.type}`; + const of = min === max ? `of \`${min}\`` : `between \`${min}\` and \`${max}\``; + return refine(struct, 'size', (value) => { + if (typeof value === 'number' || value instanceof Date) { + return ((min <= value && value <= max) || + `${expected} ${of} but received \`${value}\``); + } + else if (value instanceof Map || value instanceof Set) { + const { size } = value; + return ((min <= size && size <= max) || + `${expected} with a size ${of} but received one with a size of \`${size}\``); + } + else { + const { length } = value; + return ((min <= length && length <= max) || + `${expected} with a length ${of} but received one with a length of \`${length}\``); + } + }); + } + /** + * Augment a `Struct` to add an additional refinement to the validation. + * + * The refiner function is guaranteed to receive a value of the struct's type, + * because the struct's existing validation will already have passed. This + * allows you to layer additional validation on top of existing structs. + */ + function refine(struct, name, refiner) { + return new Struct({ + ...struct, + *refiner(value, ctx) { + yield* struct.refiner(value, ctx); + const result = refiner(value, ctx); + const failures = toFailures(result, ctx, struct, value); + for (const failure of failures) { + yield { ...failure, refinement: name }; + } + }, + }); + } + + exports.Struct = Struct; + exports.StructError = StructError; + exports.any = any; + exports.array = array; + exports.assert = assert; + exports.assign = assign; + exports.bigint = bigint; + exports.boolean = boolean; + exports.coerce = coerce; + exports.create = create; + exports.date = date; + exports.defaulted = defaulted; + exports.define = define; + exports.deprecated = deprecated; + exports.dynamic = dynamic; + exports.empty = empty; + exports.enums = enums; + exports.func = func; + exports.instance = instance; + exports.integer = integer; + exports.intersection = intersection; + exports.is = is; + exports.lazy = lazy; + exports.literal = literal; + exports.map = map; + exports.mask = mask; + exports.max = max; + exports.min = min; + exports.never = never; + exports.nonempty = nonempty; + exports.nullable = nullable; + exports.number = number; + exports.object = object; + exports.omit = omit; + exports.optional = optional; + exports.partial = partial; + exports.pattern = pattern; + exports.pick = pick; + exports.record = record; + exports.refine = refine; + exports.regexp = regexp; + exports.set = set; + exports.size = size; + exports.string = string; + exports.struct = struct; + exports.trimmed = trimmed; + exports.tuple = tuple; + exports.type = type; + exports.union = union; + exports.unknown = unknown; + exports.validate = validate; + +})); +//# sourceMappingURL=index.cjs.map diff --git a/node_modules/superstruct/dist/index.cjs.map b/node_modules/superstruct/dist/index.cjs.map new file mode 100644 index 000000000..4569869fd --- /dev/null +++ b/node_modules/superstruct/dist/index.cjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.cjs","sources":["../src/error.ts","../src/utils.ts","../src/struct.ts","../src/structs/utilities.ts","../src/structs/types.ts","../src/structs/coercions.ts","../src/structs/refinements.ts"],"sourcesContent":[null,null,null,null,null,null,null],"names":[],"mappings":";;;;;;IAAA;;IAEG;IAaH;;;;;;;IAOG;IAEG,MAAO,WAAY,SAAQ,SAAS,CAAA;QAUxC,WAAY,CAAA,OAAgB,EAAE,QAAkC,EAAA;IAC9D,QAAA,IAAI,MAAkC,CAA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MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAA;gBACtB,QACE,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,GAAG;IAC3B,gBAAA,CAAA,EAAG,QAAQ,CAAgB,aAAA,EAAA,EAAE,sCAAsC,IAAI,CAAA,EAAA,CAAI,EAC5E;IACF,SAAA;IAAM,aAAA;IACL,YAAA,MAAM,EAAE,MAAM,EAAE,GAAG,KAAuB,CAAA;gBAC1C,QACE,CAAC,GAAG,IAAI,MAAM,IAAI,MAAM,IAAI,GAAG;IAC/B,gBAAA,CAAA,EAAG,QAAQ,CAAkB,eAAA,EAAA,EAAE,wCAAwC,MAAM,CAAA,EAAA,CAAI,EAClF;IACF,SAAA;IACH,KAAC,CAAC,CAAA;IACJ,CAAC;IAED;;;;;;IAMG;aAEa,MAAM,CACpB,MAAoB,EACpB,IAAY,EACZ,OAAmB,EAAA;QAEnB,OAAO,IAAI,MAAM,CAAC;IAChB,QAAA,GAAG,MAAM;IACT,QAAA,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAA;gBACjB,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;gBACjC,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;IAClC,YAAA,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;IAEvD,YAAA,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;oBAC9B,MAAM,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAA;IACvC,aAAA;aACF;IACF,KAAA,CAAC,CAAA;IACJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/superstruct/lib/index.d.ts b/node_modules/superstruct/dist/index.d.ts similarity index 100% rename from node_modules/superstruct/lib/index.d.ts rename to node_modules/superstruct/dist/index.d.ts diff --git a/node_modules/superstruct/lib/index.d.ts.map b/node_modules/superstruct/dist/index.d.ts.map similarity index 100% rename from node_modules/superstruct/lib/index.d.ts.map rename to node_modules/superstruct/dist/index.d.ts.map diff --git a/node_modules/superstruct/dist/index.mjs b/node_modules/superstruct/dist/index.mjs new file mode 100644 index 000000000..a9a172f86 --- /dev/null +++ b/node_modules/superstruct/dist/index.mjs @@ -0,0 +1,994 @@ +/** + * A `StructFailure` represents a single specific failure in validation. + */ +/** + * `StructError` objects are thrown (or returned) when validation fails. + * + * Validation logic is design to exit early for maximum performance. The error + * represents the first error encountered during validation. For more detail, + * the `error.failures` property is a generator function that can be run to + * continue validation and receive all the failures in the data. + */ +class StructError extends TypeError { + constructor(failure, failures) { + let cached; + const { message, explanation, ...rest } = failure; + const { path } = failure; + const msg = path.length === 0 ? message : `At path: ${path.join('.')} -- ${message}`; + super(explanation ?? msg); + if (explanation != null) + this.cause = msg; + Object.assign(this, rest); + this.name = this.constructor.name; + this.failures = () => { + return (cached ?? (cached = [failure, ...failures()])); + }; + } +} + +/** + * Check if a value is an iterator. + */ +function isIterable(x) { + return isObject(x) && typeof x[Symbol.iterator] === 'function'; +} +/** + * Check if a value is a plain object. + */ +function isObject(x) { + return typeof x === 'object' && x != null; +} +/** + * Check if a value is a plain object. + */ +function isPlainObject(x) { + if (Object.prototype.toString.call(x) !== '[object Object]') { + return false; + } + const prototype = Object.getPrototypeOf(x); + return prototype === null || prototype === Object.prototype; +} +/** + * Return a value as a printable string. + */ +function print(value) { + if (typeof value === 'symbol') { + return value.toString(); + } + return typeof value === 'string' ? JSON.stringify(value) : `${value}`; +} +/** + * Shifts (removes and returns) the first value from the `input` iterator. + * Like `Array.prototype.shift()` but for an `Iterator`. + */ +function shiftIterator(input) { + const { done, value } = input.next(); + return done ? undefined : value; +} +/** + * Convert a single validation result to a failure. + */ +function toFailure(result, context, struct, value) { + if (result === true) { + return; + } + else if (result === false) { + result = {}; + } + else if (typeof result === 'string') { + result = { message: result }; + } + const { path, branch } = context; + const { type } = struct; + const { refinement, message = `Expected a value of type \`${type}\`${refinement ? ` with refinement \`${refinement}\`` : ''}, but received: \`${print(value)}\``, } = result; + return { + value, + type, + refinement, + key: path[path.length - 1], + path, + branch, + ...result, + message, + }; +} +/** + * Convert a validation result to an iterable of failures. + */ +function* toFailures(result, context, struct, value) { + if (!isIterable(result)) { + result = [result]; + } + for (const r of result) { + const failure = toFailure(r, context, struct, value); + if (failure) { + yield failure; + } + } +} +/** + * Check a value against a struct, traversing deeply into nested values, and + * returning an iterator of failures or success. + */ +function* run(value, struct, options = {}) { + const { path = [], branch = [value], coerce = false, mask = false } = options; + const ctx = { path, branch }; + if (coerce) { + value = struct.coercer(value, ctx); + if (mask && + struct.type !== 'type' && + isObject(struct.schema) && + isObject(value) && + !Array.isArray(value)) { + for (const key in value) { + if (struct.schema[key] === undefined) { + delete value[key]; + } + } + } + } + let status = 'valid'; + for (const failure of struct.validator(value, ctx)) { + failure.explanation = options.message; + status = 'not_valid'; + yield [failure, undefined]; + } + for (let [k, v, s] of struct.entries(value, ctx)) { + const ts = run(v, s, { + path: k === undefined ? path : [...path, k], + branch: k === undefined ? branch : [...branch, v], + coerce, + mask, + message: options.message, + }); + for (const t of ts) { + if (t[0]) { + status = t[0].refinement != null ? 'not_refined' : 'not_valid'; + yield [t[0], undefined]; + } + else if (coerce) { + v = t[1]; + if (k === undefined) { + value = v; + } + else if (value instanceof Map) { + value.set(k, v); + } + else if (value instanceof Set) { + value.add(v); + } + else if (isObject(value)) { + if (v !== undefined || k in value) + value[k] = v; + } + } + } + } + if (status !== 'not_valid') { + for (const failure of struct.refiner(value, ctx)) { + failure.explanation = options.message; + status = 'not_refined'; + yield [failure, undefined]; + } + } + if (status === 'valid') { + yield [undefined, value]; + } +} + +/** + * `Struct` objects encapsulate the validation logic for a specific type of + * values. Once constructed, you use the `assert`, `is` or `validate` helpers to + * validate unknown input data against the struct. + */ +class Struct { + constructor(props) { + const { type, schema, validator, refiner, coercer = (value) => value, entries = function* () { }, } = props; + this.type = type; + this.schema = schema; + this.entries = entries; + this.coercer = coercer; + if (validator) { + this.validator = (value, context) => { + const result = validator(value, context); + return toFailures(result, context, this, value); + }; + } + else { + this.validator = () => []; + } + if (refiner) { + this.refiner = (value, context) => { + const result = refiner(value, context); + return toFailures(result, context, this, value); + }; + } + else { + this.refiner = () => []; + } + } + /** + * Assert that a value passes the struct's validation, throwing if it doesn't. + */ + assert(value, message) { + return assert(value, this, message); + } + /** + * Create a value with the struct's coercion logic, then validate it. + */ + create(value, message) { + return create(value, this, message); + } + /** + * Check if a value passes the struct's validation. + */ + is(value) { + return is(value, this); + } + /** + * Mask a value, coercing and validating it, but returning only the subset of + * properties defined by the struct's schema. + */ + mask(value, message) { + return mask(value, this, message); + } + /** + * Validate a value with the struct's validation logic, returning a tuple + * representing the result. + * + * You may optionally pass `true` for the `withCoercion` argument to coerce + * the value before attempting to validate it. If you do, the result will + * contain the coerced result when successful. + */ + validate(value, options = {}) { + return validate(value, this, options); + } +} +/** + * Assert that a value passes a struct, throwing if it doesn't. + */ +function assert(value, struct, message) { + const result = validate(value, struct, { message }); + if (result[0]) { + throw result[0]; + } +} +/** + * Create a value with the coercion logic of struct and validate it. + */ +function create(value, struct, message) { + const result = validate(value, struct, { coerce: true, message }); + if (result[0]) { + throw result[0]; + } + else { + return result[1]; + } +} +/** + * Mask a value, returning only the subset of properties defined by a struct. + */ +function mask(value, struct, message) { + const result = validate(value, struct, { coerce: true, mask: true, message }); + if (result[0]) { + throw result[0]; + } + else { + return result[1]; + } +} +/** + * Check if a value passes a struct. + */ +function is(value, struct) { + const result = validate(value, struct); + return !result[0]; +} +/** + * Validate a value against a struct, returning an error if invalid, or the + * value (with potential coercion) if valid. + */ +function validate(value, struct, options = {}) { + const tuples = run(value, struct, options); + const tuple = shiftIterator(tuples); + if (tuple[0]) { + const error = new StructError(tuple[0], function* () { + for (const t of tuples) { + if (t[0]) { + yield t[0]; + } + } + }); + return [error, undefined]; + } + else { + const v = tuple[1]; + return [undefined, v]; + } +} + +function assign(...Structs) { + const isType = Structs[0].type === 'type'; + const schemas = Structs.map((s) => s.schema); + const schema = Object.assign({}, ...schemas); + return isType ? type(schema) : object(schema); +} +/** + * Define a new struct type with a custom validation function. + */ +function define(name, validator) { + return new Struct({ type: name, schema: null, validator }); +} +/** + * Create a new struct based on an existing struct, but the value is allowed to + * be `undefined`. `log` will be called if the value is not `undefined`. + */ +function deprecated(struct, log) { + return new Struct({ + ...struct, + refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx), + validator(value, ctx) { + if (value === undefined) { + return true; + } + else { + log(value, ctx); + return struct.validator(value, ctx); + } + }, + }); +} +/** + * Create a struct with dynamic validation logic. + * + * The callback will receive the value currently being validated, and must + * return a struct object to validate it with. This can be useful to model + * validation logic that changes based on its input. + */ +function dynamic(fn) { + return new Struct({ + type: 'dynamic', + schema: null, + *entries(value, ctx) { + const struct = fn(value, ctx); + yield* struct.entries(value, ctx); + }, + validator(value, ctx) { + const struct = fn(value, ctx); + return struct.validator(value, ctx); + }, + coercer(value, ctx) { + const struct = fn(value, ctx); + return struct.coercer(value, ctx); + }, + refiner(value, ctx) { + const struct = fn(value, ctx); + return struct.refiner(value, ctx); + }, + }); +} +/** + * Create a struct with lazily evaluated validation logic. + * + * The first time validation is run with the struct, the callback will be called + * and must return a struct object to use. This is useful for cases where you + * want to have self-referential structs for nested data structures to avoid a + * circular definition problem. + */ +function lazy(fn) { + let struct; + return new Struct({ + type: 'lazy', + schema: null, + *entries(value, ctx) { + struct ?? (struct = fn()); + yield* struct.entries(value, ctx); + }, + validator(value, ctx) { + struct ?? (struct = fn()); + return struct.validator(value, ctx); + }, + coercer(value, ctx) { + struct ?? (struct = fn()); + return struct.coercer(value, ctx); + }, + refiner(value, ctx) { + struct ?? (struct = fn()); + return struct.refiner(value, ctx); + }, + }); +} +/** + * Create a new struct based on an existing object struct, but excluding + * specific properties. + * + * Like TypeScript's `Omit` utility. + */ +function omit(struct, keys) { + const { schema } = struct; + const subschema = { ...schema }; + for (const key of keys) { + delete subschema[key]; + } + switch (struct.type) { + case 'type': + return type(subschema); + default: + return object(subschema); + } +} +/** + * Create a new struct based on an existing object struct, but with all of its + * properties allowed to be `undefined`. + * + * Like TypeScript's `Partial` utility. + */ +function partial(struct) { + const schema = struct instanceof Struct ? { ...struct.schema } : { ...struct }; + for (const key in schema) { + schema[key] = optional(schema[key]); + } + return object(schema); +} +/** + * Create a new struct based on an existing object struct, but only including + * specific properties. + * + * Like TypeScript's `Pick` utility. + */ +function pick(struct, keys) { + const { schema } = struct; + const subschema = {}; + for (const key of keys) { + subschema[key] = schema[key]; + } + return object(subschema); +} +/** + * Define a new struct type with a custom validation function. + * + * @deprecated This function has been renamed to `define`. + */ +function struct(name, validator) { + console.warn('superstruct@0.11 - The `struct` helper has been renamed to `define`.'); + return define(name, validator); +} + +/** + * Ensure that any value passes validation. + */ +function any() { + return define('any', () => true); +} +function array(Element) { + return new Struct({ + type: 'array', + schema: Element, + *entries(value) { + if (Element && Array.isArray(value)) { + for (const [i, v] of value.entries()) { + yield [i, v, Element]; + } + } + }, + coercer(value) { + return Array.isArray(value) ? value.slice() : value; + }, + validator(value) { + return (Array.isArray(value) || + `Expected an array value, but received: ${print(value)}`); + }, + }); +} +/** + * Ensure that a value is a bigint. + */ +function bigint() { + return define('bigint', (value) => { + return typeof value === 'bigint'; + }); +} +/** + * Ensure that a value is a boolean. + */ +function boolean() { + return define('boolean', (value) => { + return typeof value === 'boolean'; + }); +} +/** + * Ensure that a value is a valid `Date`. + * + * Note: this also ensures that the value is *not* an invalid `Date` object, + * which can occur when parsing a date fails but still returns a `Date`. + */ +function date() { + return define('date', (value) => { + return ((value instanceof Date && !isNaN(value.getTime())) || + `Expected a valid \`Date\` object, but received: ${print(value)}`); + }); +} +function enums(values) { + const schema = {}; + const description = values.map((v) => print(v)).join(); + for (const key of values) { + schema[key] = key; + } + return new Struct({ + type: 'enums', + schema, + validator(value) { + return (values.includes(value) || + `Expected one of \`${description}\`, but received: ${print(value)}`); + }, + }); +} +/** + * Ensure that a value is a function. + */ +function func() { + return define('func', (value) => { + return (typeof value === 'function' || + `Expected a function, but received: ${print(value)}`); + }); +} +/** + * Ensure that a value is an instance of a specific class. + */ +function instance(Class) { + return define('instance', (value) => { + return (value instanceof Class || + `Expected a \`${Class.name}\` instance, but received: ${print(value)}`); + }); +} +/** + * Ensure that a value is an integer. + */ +function integer() { + return define('integer', (value) => { + return ((typeof value === 'number' && !isNaN(value) && Number.isInteger(value)) || + `Expected an integer, but received: ${print(value)}`); + }); +} +/** + * Ensure that a value matches all of a set of types. + */ +function intersection(Structs) { + return new Struct({ + type: 'intersection', + schema: null, + *entries(value, ctx) { + for (const S of Structs) { + yield* S.entries(value, ctx); + } + }, + *validator(value, ctx) { + for (const S of Structs) { + yield* S.validator(value, ctx); + } + }, + *refiner(value, ctx) { + for (const S of Structs) { + yield* S.refiner(value, ctx); + } + }, + }); +} +function literal(constant) { + const description = print(constant); + const t = typeof constant; + return new Struct({ + type: 'literal', + schema: t === 'string' || t === 'number' || t === 'boolean' ? constant : null, + validator(value) { + return (value === constant || + `Expected the literal \`${description}\`, but received: ${print(value)}`); + }, + }); +} +function map(Key, Value) { + return new Struct({ + type: 'map', + schema: null, + *entries(value) { + if (Key && Value && value instanceof Map) { + for (const [k, v] of value.entries()) { + yield [k, k, Key]; + yield [k, v, Value]; + } + } + }, + coercer(value) { + return value instanceof Map ? new Map(value) : value; + }, + validator(value) { + return (value instanceof Map || + `Expected a \`Map\` object, but received: ${print(value)}`); + }, + }); +} +/** + * Ensure that no value ever passes validation. + */ +function never() { + return define('never', () => false); +} +/** + * Augment an existing struct to allow `null` values. + */ +function nullable(struct) { + return new Struct({ + ...struct, + validator: (value, ctx) => value === null || struct.validator(value, ctx), + refiner: (value, ctx) => value === null || struct.refiner(value, ctx), + }); +} +/** + * Ensure that a value is a number. + */ +function number() { + return define('number', (value) => { + return ((typeof value === 'number' && !isNaN(value)) || + `Expected a number, but received: ${print(value)}`); + }); +} +function object(schema) { + const knowns = schema ? Object.keys(schema) : []; + const Never = never(); + return new Struct({ + type: 'object', + schema: schema ? schema : null, + *entries(value) { + if (schema && isObject(value)) { + const unknowns = new Set(Object.keys(value)); + for (const key of knowns) { + unknowns.delete(key); + yield [key, value[key], schema[key]]; + } + for (const key of unknowns) { + yield [key, value[key], Never]; + } + } + }, + validator(value) { + return (isObject(value) || `Expected an object, but received: ${print(value)}`); + }, + coercer(value) { + return isObject(value) ? { ...value } : value; + }, + }); +} +/** + * Augment a struct to allow `undefined` values. + */ +function optional(struct) { + return new Struct({ + ...struct, + validator: (value, ctx) => value === undefined || struct.validator(value, ctx), + refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx), + }); +} +/** + * Ensure that a value is an object with keys and values of specific types, but + * without ensuring any specific shape of properties. + * + * Like TypeScript's `Record` utility. + */ +function record(Key, Value) { + return new Struct({ + type: 'record', + schema: null, + *entries(value) { + if (isObject(value)) { + for (const k in value) { + const v = value[k]; + yield [k, k, Key]; + yield [k, v, Value]; + } + } + }, + validator(value) { + return (isObject(value) || `Expected an object, but received: ${print(value)}`); + }, + }); +} +/** + * Ensure that a value is a `RegExp`. + * + * Note: this does not test the value against the regular expression! For that + * you need to use the `pattern()` refinement. + */ +function regexp() { + return define('regexp', (value) => { + return value instanceof RegExp; + }); +} +function set(Element) { + return new Struct({ + type: 'set', + schema: null, + *entries(value) { + if (Element && value instanceof Set) { + for (const v of value) { + yield [v, v, Element]; + } + } + }, + coercer(value) { + return value instanceof Set ? new Set(value) : value; + }, + validator(value) { + return (value instanceof Set || + `Expected a \`Set\` object, but received: ${print(value)}`); + }, + }); +} +/** + * Ensure that a value is a string. + */ +function string() { + return define('string', (value) => { + return (typeof value === 'string' || + `Expected a string, but received: ${print(value)}`); + }); +} +/** + * Ensure that a value is a tuple of a specific length, and that each of its + * elements is of a specific type. + */ +function tuple(Structs) { + const Never = never(); + return new Struct({ + type: 'tuple', + schema: null, + *entries(value) { + if (Array.isArray(value)) { + const length = Math.max(Structs.length, value.length); + for (let i = 0; i < length; i++) { + yield [i, value[i], Structs[i] || Never]; + } + } + }, + validator(value) { + return (Array.isArray(value) || + `Expected an array, but received: ${print(value)}`); + }, + }); +} +/** + * Ensure that a value has a set of known properties of specific types. + * + * Note: Unrecognized properties are allowed and untouched. This is similar to + * how TypeScript's structural typing works. + */ +function type(schema) { + const keys = Object.keys(schema); + return new Struct({ + type: 'type', + schema, + *entries(value) { + if (isObject(value)) { + for (const k of keys) { + yield [k, value[k], schema[k]]; + } + } + }, + validator(value) { + return (isObject(value) || `Expected an object, but received: ${print(value)}`); + }, + coercer(value) { + return isObject(value) ? { ...value } : value; + }, + }); +} +/** + * Ensure that a value matches one of a set of types. + */ +function union(Structs) { + const description = Structs.map((s) => s.type).join(' | '); + return new Struct({ + type: 'union', + schema: null, + coercer(value) { + for (const S of Structs) { + const [error, coerced] = S.validate(value, { coerce: true }); + if (!error) { + return coerced; + } + } + return value; + }, + validator(value, ctx) { + const failures = []; + for (const S of Structs) { + const [...tuples] = run(value, S, ctx); + const [first] = tuples; + if (!first[0]) { + return []; + } + else { + for (const [failure] of tuples) { + if (failure) { + failures.push(failure); + } + } + } + } + return [ + `Expected the value to satisfy a union of \`${description}\`, but received: ${print(value)}`, + ...failures, + ]; + }, + }); +} +/** + * Ensure that any value passes validation, without widening its type to `any`. + */ +function unknown() { + return define('unknown', () => true); +} + +/** + * Augment a `Struct` to add an additional coercion step to its input. + * + * This allows you to transform input data before validating it, to increase the + * likelihood that it passes validation—for example for default values, parsing + * different formats, etc. + * + * Note: You must use `create(value, Struct)` on the value to have the coercion + * take effect! Using simply `assert()` or `is()` will not use coercion. + */ +function coerce(struct, condition, coercer) { + return new Struct({ + ...struct, + coercer: (value, ctx) => { + return is(value, condition) + ? struct.coercer(coercer(value, ctx), ctx) + : struct.coercer(value, ctx); + }, + }); +} +/** + * Augment a struct to replace `undefined` values with a default. + * + * Note: You must use `create(value, Struct)` on the value to have the coercion + * take effect! Using simply `assert()` or `is()` will not use coercion. + */ +function defaulted(struct, fallback, options = {}) { + return coerce(struct, unknown(), (x) => { + const f = typeof fallback === 'function' ? fallback() : fallback; + if (x === undefined) { + return f; + } + if (!options.strict && isPlainObject(x) && isPlainObject(f)) { + const ret = { ...x }; + let changed = false; + for (const key in f) { + if (ret[key] === undefined) { + ret[key] = f[key]; + changed = true; + } + } + if (changed) { + return ret; + } + } + return x; + }); +} +/** + * Augment a struct to trim string inputs. + * + * Note: You must use `create(value, Struct)` on the value to have the coercion + * take effect! Using simply `assert()` or `is()` will not use coercion. + */ +function trimmed(struct) { + return coerce(struct, string(), (x) => x.trim()); +} + +/** + * Ensure that a string, array, map, or set is empty. + */ +function empty(struct) { + return refine(struct, 'empty', (value) => { + const size = getSize(value); + return (size === 0 || + `Expected an empty ${struct.type} but received one with a size of \`${size}\``); + }); +} +function getSize(value) { + if (value instanceof Map || value instanceof Set) { + return value.size; + } + else { + return value.length; + } +} +/** + * Ensure that a number or date is below a threshold. + */ +function max(struct, threshold, options = {}) { + const { exclusive } = options; + return refine(struct, 'max', (value) => { + return exclusive + ? value < threshold + : value <= threshold || + `Expected a ${struct.type} less than ${exclusive ? '' : 'or equal to '}${threshold} but received \`${value}\``; + }); +} +/** + * Ensure that a number or date is above a threshold. + */ +function min(struct, threshold, options = {}) { + const { exclusive } = options; + return refine(struct, 'min', (value) => { + return exclusive + ? value > threshold + : value >= threshold || + `Expected a ${struct.type} greater than ${exclusive ? '' : 'or equal to '}${threshold} but received \`${value}\``; + }); +} +/** + * Ensure that a string, array, map or set is not empty. + */ +function nonempty(struct) { + return refine(struct, 'nonempty', (value) => { + const size = getSize(value); + return (size > 0 || `Expected a nonempty ${struct.type} but received an empty one`); + }); +} +/** + * Ensure that a string matches a regular expression. + */ +function pattern(struct, regexp) { + return refine(struct, 'pattern', (value) => { + return (regexp.test(value) || + `Expected a ${struct.type} matching \`/${regexp.source}/\` but received "${value}"`); + }); +} +/** + * Ensure that a string, array, number, date, map, or set has a size (or length, or time) between `min` and `max`. + */ +function size(struct, min, max = min) { + const expected = `Expected a ${struct.type}`; + const of = min === max ? `of \`${min}\`` : `between \`${min}\` and \`${max}\``; + return refine(struct, 'size', (value) => { + if (typeof value === 'number' || value instanceof Date) { + return ((min <= value && value <= max) || + `${expected} ${of} but received \`${value}\``); + } + else if (value instanceof Map || value instanceof Set) { + const { size } = value; + return ((min <= size && size <= max) || + `${expected} with a size ${of} but received one with a size of \`${size}\``); + } + else { + const { length } = value; + return ((min <= length && length <= max) || + `${expected} with a length ${of} but received one with a length of \`${length}\``); + } + }); +} +/** + * Augment a `Struct` to add an additional refinement to the validation. + * + * The refiner function is guaranteed to receive a value of the struct's type, + * because the struct's existing validation will already have passed. This + * allows you to layer additional validation on top of existing structs. + */ +function refine(struct, name, refiner) { + return new Struct({ + ...struct, + *refiner(value, ctx) { + yield* struct.refiner(value, ctx); + const result = refiner(value, ctx); + const failures = toFailures(result, ctx, struct, value); + for (const failure of failures) { + yield { ...failure, refinement: name }; + } + }, + }); +} + +export { Struct, StructError, any, array, assert, assign, bigint, boolean, coerce, create, date, defaulted, define, deprecated, dynamic, empty, enums, func, instance, integer, intersection, is, lazy, literal, map, mask, max, min, never, nonempty, nullable, number, object, omit, optional, partial, pattern, pick, record, refine, regexp, set, size, string, struct, trimmed, tuple, type, union, unknown, validate }; +//# sourceMappingURL=index.mjs.map diff --git a/node_modules/superstruct/dist/index.mjs.map b/node_modules/superstruct/dist/index.mjs.map new file mode 100644 index 000000000..9cfcb0ab7 --- /dev/null +++ b/node_modules/superstruct/dist/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../src/error.ts","../src/utils.ts","../src/struct.ts","../src/structs/utilities.ts","../src/structs/types.ts","../src/structs/coercions.ts","../src/structs/refinements.ts"],"sourcesContent":[null,null,null,null,null,null,null],"names":[],"mappings":"AAAA;;AAEG;AAaH;;;;;;;AAOG;AAEG,MAA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KAAK,YAAY,GAAG,IAAI,KAAK,YAAY,GAAG,EAAE;AACvD,YAAA,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAA;YACtB,QACE,CAAC,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,GAAG;AAC3B,gBAAA,CAAA,EAAG,QAAQ,CAAgB,aAAA,EAAA,EAAE,sCAAsC,IAAI,CAAA,EAAA,CAAI,EAC5E;AACF,SAAA;AAAM,aAAA;AACL,YAAA,MAAM,EAAE,MAAM,EAAE,GAAG,KAAuB,CAAA;YAC1C,QACE,CAAC,GAAG,IAAI,MAAM,IAAI,MAAM,IAAI,GAAG;AAC/B,gBAAA,CAAA,EAAG,QAAQ,CAAkB,eAAA,EAAA,EAAE,wCAAwC,MAAM,CAAA,EAAA,CAAI,EAClF;AACF,SAAA;AACH,KAAC,CAAC,CAAA;AACJ,CAAC;AAED;;;;;;AAMG;SAEa,MAAM,CACpB,MAAoB,EACpB,IAAY,EACZ,OAAmB,EAAA;IAEnB,OAAO,IAAI,MAAM,CAAC;AAChB,QAAA,GAAG,MAAM;AACT,QAAA,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAA;YACjB,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;YACjC,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAA;AAClC,YAAA,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,CAAA;AAEvD,YAAA,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;gBAC9B,MAAM,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAA;AACvC,aAAA;SACF;AACF,KAAA,CAAC,CAAA;AACJ;;;;"} \ No newline at end of file diff --git a/node_modules/superstruct/lib/struct.d.ts b/node_modules/superstruct/dist/struct.d.ts similarity index 92% rename from node_modules/superstruct/lib/struct.d.ts rename to node_modules/superstruct/dist/struct.d.ts index 0db8c46cb..80be1899f 100644 --- a/node_modules/superstruct/lib/struct.d.ts +++ b/node_modules/superstruct/dist/struct.d.ts @@ -24,11 +24,11 @@ export declare class Struct { /** * Assert that a value passes the struct's validation, throwing if it doesn't. */ - assert(value: unknown): asserts value is T; + assert(value: unknown, message?: string): asserts value is T; /** * Create a value with the struct's coercion logic, then validate it. */ - create(value: unknown): T; + create(value: unknown, message?: string): T; /** * Check if a value passes the struct's validation. */ @@ -37,7 +37,7 @@ export declare class Struct { * Mask a value, coercing and validating it, but returning only the subset of * properties defined by the struct's schema. */ - mask(value: unknown): T; + mask(value: unknown, message?: string): T; /** * Validate a value with the struct's validation logic, returning a tuple * representing the result. @@ -48,20 +48,21 @@ export declare class Struct { */ validate(value: unknown, options?: { coerce?: boolean; + message?: string; }): [StructError, undefined] | [undefined, T]; } /** * Assert that a value passes a struct, throwing if it doesn't. */ -export declare function assert(value: unknown, struct: Struct): asserts value is T; +export declare function assert(value: unknown, struct: Struct, message?: string): asserts value is T; /** * Create a value with the coercion logic of struct and validate it. */ -export declare function create(value: unknown, struct: Struct): T; +export declare function create(value: unknown, struct: Struct, message?: string): T; /** * Mask a value, returning only the subset of properties defined by a struct. */ -export declare function mask(value: unknown, struct: Struct): T; +export declare function mask(value: unknown, struct: Struct, message?: string): T; /** * Check if a value passes a struct. */ @@ -73,6 +74,7 @@ export declare function is(value: unknown, struct: Struct): value is export declare function validate(value: unknown, struct: Struct, options?: { coerce?: boolean; mask?: boolean; + message?: string; }): [StructError, undefined] | [undefined, T]; /** * A `Context` contains information about the current location of the diff --git a/node_modules/superstruct/dist/struct.d.ts.map b/node_modules/superstruct/dist/struct.d.ts.map new file mode 100644 index 000000000..eec328f5d --- /dev/null +++ b/node_modules/superstruct/dist/struct.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"struct.d.ts","sourceRoot":"","sources":["../src/struct.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,YAAY,EAAO,MA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dist/structs/coercions.d.ts similarity index 100% rename from node_modules/superstruct/lib/structs/coercions.d.ts rename to node_modules/superstruct/dist/structs/coercions.d.ts diff --git a/node_modules/superstruct/lib/structs/coercions.d.ts.map b/node_modules/superstruct/dist/structs/coercions.d.ts.map similarity index 100% rename from node_modules/superstruct/lib/structs/coercions.d.ts.map rename to node_modules/superstruct/dist/structs/coercions.d.ts.map diff --git a/node_modules/superstruct/lib/structs/refinements.d.ts b/node_modules/superstruct/dist/structs/refinements.d.ts similarity index 100% rename from node_modules/superstruct/lib/structs/refinements.d.ts rename to node_modules/superstruct/dist/structs/refinements.d.ts diff --git a/node_modules/superstruct/lib/structs/refinements.d.ts.map b/node_modules/superstruct/dist/structs/refinements.d.ts.map similarity index 100% rename from node_modules/superstruct/lib/structs/refinements.d.ts.map rename to node_modules/superstruct/dist/structs/refinements.d.ts.map diff --git a/node_modules/superstruct/lib/structs/types.d.ts b/node_modules/superstruct/dist/structs/types.d.ts similarity index 100% rename from node_modules/superstruct/lib/structs/types.d.ts rename to node_modules/superstruct/dist/structs/types.d.ts diff --git a/node_modules/superstruct/lib/structs/types.d.ts.map b/node_modules/superstruct/dist/structs/types.d.ts.map similarity index 96% rename from node_modules/superstruct/lib/structs/types.d.ts.map rename to node_modules/superstruct/dist/structs/types.d.ts.map index 295be93c2..0528ca1f5 100644 --- a/node_modules/superstruct/lib/structs/types.d.ts.map +++ b/node_modules/superstruct/dist/structs/types.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/structs/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EACL,YAAY,EACZ,UAAU,EAIV,SAAS,EACT,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,UAAU,CAAA;AAEjB;;GAEG;AAEH,wBAAgB,GAAG,IAAI,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAEvC;AAED;;;;;;G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AAI,CAAC,CAAA;AAwBhE;;GAEG;AAEH,wBAAgB,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAO7C;AAED;;;GAGG;AAEH,wBAAgB,KAAK,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,EAAE,EAC9D,OAAO,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GACjB,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAsBlD;AAED;;;;;GAKG;AAEH,wBAAgB,IAAI,CAAC,CAAC,SAAS,YAAY,EACzC,MAAM,EAAE,CAAC,GACR,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAqB1B;AAED;;GAEG;AAEH,wBAAgB,KAAK,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,SAAS,EAAE,EAC9D,OAAO,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GACjB,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAyCtD;AAED;;GAEG;AAEH,wBAAgB,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAE/C"} \ No newline at end of file diff --git a/node_modules/superstruct/lib/structs/utilities.d.ts b/node_modules/superstruct/dist/structs/utilities.d.ts similarity index 100% rename from node_modules/superstruct/lib/structs/utilities.d.ts rename to node_modules/superstruct/dist/structs/utilities.d.ts diff --git a/node_modules/superstruct/lib/structs/utilities.d.ts.map b/node_modules/superstruct/dist/structs/utilities.d.ts.map similarity index 100% rename from node_modules/superstruct/lib/structs/utilities.d.ts.map rename to node_modules/superstruct/dist/structs/utilities.d.ts.map diff --git a/node_modules/superstruct/lib/utils.d.ts b/node_modules/superstruct/dist/utils.d.ts similarity index 88% rename from node_modules/superstruct/lib/utils.d.ts rename to node_modules/superstruct/dist/utils.d.ts index 60422d7b4..c463a3bb8 100644 --- a/node_modules/superstruct/lib/utils.d.ts +++ b/node_modules/superstruct/dist/utils.d.ts @@ -36,6 +36,7 @@ export declare function run(value: unknown, struct: Struct, options? branch?: any[]; coerce?: boolean; mask?: boolean; + message?: string; }): IterableIterator<[Failure, undefined] | [undefined, T]>; /** * Convert a union of type to an intersection. @@ -48,7 +49,7 @@ export declare type Assign = Simplify>; /** * A schema for enum structs. */ -export declare type EnumSchema = { +export declare type EnumSchema = { [K in NonNullable]: K; }; /** @@ -114,7 +115,7 @@ export declare type If = B extends true ? Then : /** * A schema for any type of struct. */ -export declare type StructSchema = [T] extends [string | undefined] ? [T] extends [IsMatch] ? null : [T] extends [IsUnion] ? EnumSchema : T : [T] extends [number | undefined] ? [T] extends [IsMatch] ? null : [T] extends [IsUnion] ? EnumSchema : T : [T] extends [boolean] ? [T] extends [IsExactMatch] ? null : T : T extends bigint | symbol | undefined | null | Function | Date | Error | RegExp | Map | WeakMap | Set | WeakSet | Promise ? null : T extends Array ? T extends IsTuple ? null : Struct : T extends object ? T extends IsRecord ? null : { +export declare type StructSchema = [T] extends [string | undefined | null] ? [T] extends [IsMatch] ? null : [T] extends [IsUnion] ? EnumSchema : T : [T] extends [number | undefined | null] ? [T] extends [IsMatch] ? null : [T] extends [IsUnion] ? EnumSchema : T : [T] extends [boolean] ? [T] extends [IsExactMatch] ? null : T : T extends bigint | symbol | undefined | null | Function | Date | Error | RegExp | Map | WeakMap | Set | WeakSet | Promise ? null : T extends Array ? T extends IsTuple ? null : Struct : T extends object ? T extends IsRecord ? null : { [K in keyof T]: Describe; } : null; /** diff --git a/node_modules/superstruct/dist/utils.d.ts.map b/node_modules/superstruct/dist/utils.d.ts.map new file mode 100644 index 000000000..817853799 --- /dev/null +++ b/node_modules/superstruct/dist/utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../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AM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,CAAA;AAE7D;;GAEG;AAEH,oBAAY,SAAS,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAExC;;;;;GAKG;AAEH,oBAAY,gBAAgB,CAC1B,KAAK,SAAS,SAAS,EAAE,EACzB,MAAM,SAAS,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,IACrC,MAAM,SAAS,MAAM,GACrB,MAAM,SAAS,MAAM,GACnB,KAAK,GACL,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,GAChC,KAAK,CAAA;AACT,aAAK,WAAW,CACd,KAAK,SAAS,SAAS,EAAE,EACzB,MAAM,SAAS,MAAM,EACrB,WAAW,SAAS,OAAO,EAAE,EAC7B,KAAK,SAAS,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC,IAC1C,KAAK,SAAS,MAAM,GACpB,WAAW,GACX,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/superstruct/lib/error.d.ts b/node_modules/superstruct/lib/error.d.ts deleted file mode 100644 index 9145c6657..000000000 --- a/node_modules/superstruct/lib/error.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * A `StructFailure` represents a single specific failure in validation. - */ -export declare type Failure = { - value: any; - key: any; - type: string; - refinement: string | undefined; - message: string; - branch: Array; - path: Array; -}; -/** - * `StructError` objects are thrown (or returned) when validation fails. - * - * Validation logic is design to exit early for maximum performance. The error - * represents the first error encountered during validation. For more detail, - * the `error.failures` property is a generator function that can be run to - * continue validation and receive all the failures in the data. - */ -export declare class StructError extends TypeError { - value: any; - key: any; - type: string; - refinement: string | undefined; - path: Array; - branch: Array; - failures: () => Array; - [x: string]: any; - constructor(failure: Failure, failures: () => Generator); -} -//# sourceMappingURL=error.d.ts.map \ No newline at end of file diff --git a/node_modules/superstruct/lib/error.d.ts.map b/node_modules/superstruct/lib/error.d.ts.map deleted file mode 100644 index 5c93f0c5f..000000000 --- a/node_modules/superstruct/lib/error.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,oBAAY,OAAO,GAAG;IACpB,KAAK,EAAE,GAAG,CAAA;IACV,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;IAClB,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;CACjB,CAAA;AAED;;;;;;;GAOG;AAEH,qBAAa,WAAY,SAAQ,SAAS;IACxC,KAAK,EAAE,GAAG,CAAA;IACV,GAAG,EAAG,GAAG,CAAA;IACT,IAAI,EAAG,MAAM,CAAA;IACb,UAAU,EAAG,MAAM,GAAG,SAAS,CAAA;IAC/B,IAAI,EAAG,KAAK,CAAC,GAAG,CAAC,CAAA;IACjB,MAAM,EAAG,KAAK,CAAC,GAAG,CAAC,CAAA;IACnB,QAAQ,EAAE,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;gBAEJ,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC,OAAO,CAAC;CAajE"} \ No newline at end of file diff --git a/node_modules/superstruct/lib/index.cjs b/node_modules/superstruct/lib/index.cjs deleted file mode 100644 index 2a8b0da12..000000000 --- a/node_modules/superstruct/lib/index.cjs +++ /dev/null @@ -1,1247 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -/** - * A `StructFailure` represents a single specific failure in validation. - */ - -/** - * `StructError` objects are thrown (or returned) when validation fails. - * - * Validation logic is design to exit early for maximum performance. The error - * represents the first error encountered during validation. For more detail, - * the `error.failures` property is a generator function that can be run to - * continue validation and receive all the failures in the data. - */ -class StructError extends TypeError { - constructor(failure, failures) { - let cached; - const { - message, - ...rest - } = failure; - const { - path - } = failure; - const msg = path.length === 0 ? message : `At path: ${path.join('.')} -- ${message}`; - super(msg); - this.value = void 0; - this.key = void 0; - this.type = void 0; - this.refinement = void 0; - this.path = void 0; - this.branch = void 0; - this.failures = void 0; - Object.assign(this, rest); - this.name = this.constructor.name; - - this.failures = () => { - return cached ?? (cached = [failure, ...failures()]); - }; - } - -} - -/** - * Check if a value is an iterator. - */ -function isIterable(x) { - return isObject(x) && typeof x[Symbol.iterator] === 'function'; -} -/** - * Check if a value is a plain object. - */ - - -function isObject(x) { - return typeof x === 'object' && x != null; -} -/** - * Check if a value is a plain object. - */ - -function isPlainObject(x) { - if (Object.prototype.toString.call(x) !== '[object Object]') { - return false; - } - - const prototype = Object.getPrototypeOf(x); - return prototype === null || prototype === Object.prototype; -} -/** - * Return a value as a printable string. - */ - -function print(value) { - return typeof value === 'string' ? JSON.stringify(value) : `${value}`; -} -/** - * Shifts (removes and returns) the first value from the `input` iterator. - * Like `Array.prototype.shift()` but for an `Iterator`. - */ - -function shiftIterator(input) { - const { - done, - value - } = input.next(); - return done ? undefined : value; -} -/** - * Convert a single validation result to a failure. - */ - -function toFailure(result, context, struct, value) { - if (result === true) { - return; - } else if (result === false) { - result = {}; - } else if (typeof result === 'string') { - result = { - message: result - }; - } - - const { - path, - branch - } = context; - const { - type - } = struct; - const { - refinement, - message = `Expected a value of type \`${type}\`${refinement ? ` with refinement \`${refinement}\`` : ''}, but received: \`${print(value)}\`` - } = result; - return { - value, - type, - refinement, - key: path[path.length - 1], - path, - branch, - ...result, - message - }; -} -/** - * Convert a validation result to an iterable of failures. - */ - -function* toFailures(result, context, struct, value) { - if (!isIterable(result)) { - result = [result]; - } - - for (const r of result) { - const failure = toFailure(r, context, struct, value); - - if (failure) { - yield failure; - } - } -} -/** - * Check a value against a struct, traversing deeply into nested values, and - * returning an iterator of failures or success. - */ - -function* run(value, struct, options) { - if (options === void 0) { - options = {}; - } - - const { - path = [], - branch = [value], - coerce = false, - mask = false - } = options; - const ctx = { - path, - branch - }; - - if (coerce) { - value = struct.coercer(value, ctx); - - if (mask && struct.type !== 'type' && isObject(struct.schema) && isObject(value) && !Array.isArray(value)) { - for (const key in value) { - if (struct.schema[key] === undefined) { - delete value[key]; - } - } - } - } - - let status = 'valid'; - - for (const failure of struct.validator(value, ctx)) { - status = 'not_valid'; - yield [failure, undefined]; - } - - for (let [k, v, s] of struct.entries(value, ctx)) { - const ts = run(v, s, { - path: k === undefined ? path : [...path, k], - branch: k === undefined ? branch : [...branch, v], - coerce, - mask - }); - - for (const t of ts) { - if (t[0]) { - status = t[0].refinement != null ? 'not_refined' : 'not_valid'; - yield [t[0], undefined]; - } else if (coerce) { - v = t[1]; - - if (k === undefined) { - value = v; - } else if (value instanceof Map) { - value.set(k, v); - } else if (value instanceof Set) { - value.add(v); - } else if (isObject(value)) { - if (v !== undefined) value[k] = v; - } - } - } - } - - if (status !== 'not_valid') { - for (const failure of struct.refiner(value, ctx)) { - status = 'not_refined'; - yield [failure, undefined]; - } - } - - if (status === 'valid') { - yield [undefined, value]; - } -} - -/** - * `Struct` objects encapsulate the validation logic for a specific type of - * values. Once constructed, you use the `assert`, `is` or `validate` helpers to - * validate unknown input data against the struct. - */ - -class Struct { - constructor(props) { - this.TYPE = void 0; - this.type = void 0; - this.schema = void 0; - this.coercer = void 0; - this.validator = void 0; - this.refiner = void 0; - this.entries = void 0; - const { - type, - schema, - validator, - refiner, - coercer = value => value, - entries = function* () {} - } = props; - this.type = type; - this.schema = schema; - this.entries = entries; - this.coercer = coercer; - - if (validator) { - this.validator = (value, context) => { - const result = validator(value, context); - return toFailures(result, context, this, value); - }; - } else { - this.validator = () => []; - } - - if (refiner) { - this.refiner = (value, context) => { - const result = refiner(value, context); - return toFailures(result, context, this, value); - }; - } else { - this.refiner = () => []; - } - } - /** - * Assert that a value passes the struct's validation, throwing if it doesn't. - */ - - - assert(value) { - return assert(value, this); - } - /** - * Create a value with the struct's coercion logic, then validate it. - */ - - - create(value) { - return create(value, this); - } - /** - * Check if a value passes the struct's validation. - */ - - - is(value) { - return is(value, this); - } - /** - * Mask a value, coercing and validating it, but returning only the subset of - * properties defined by the struct's schema. - */ - - - mask(value) { - return mask(value, this); - } - /** - * Validate a value with the struct's validation logic, returning a tuple - * representing the result. - * - * You may optionally pass `true` for the `withCoercion` argument to coerce - * the value before attempting to validate it. If you do, the result will - * contain the coerced result when successful. - */ - - - validate(value, options) { - if (options === void 0) { - options = {}; - } - - return validate(value, this, options); - } - -} -/** - * Assert that a value passes a struct, throwing if it doesn't. - */ - -function assert(value, struct) { - const result = validate(value, struct); - - if (result[0]) { - throw result[0]; - } -} -/** - * Create a value with the coercion logic of struct and validate it. - */ - -function create(value, struct) { - const result = validate(value, struct, { - coerce: true - }); - - if (result[0]) { - throw result[0]; - } else { - return result[1]; - } -} -/** - * Mask a value, returning only the subset of properties defined by a struct. - */ - -function mask(value, struct) { - const result = validate(value, struct, { - coerce: true, - mask: true - }); - - if (result[0]) { - throw result[0]; - } else { - return result[1]; - } -} -/** - * Check if a value passes a struct. - */ - -function is(value, struct) { - const result = validate(value, struct); - return !result[0]; -} -/** - * Validate a value against a struct, returning an error if invalid, or the - * value (with potential coercion) if valid. - */ - -function validate(value, struct, options) { - if (options === void 0) { - options = {}; - } - - const tuples = run(value, struct, options); - const tuple = shiftIterator(tuples); - - if (tuple[0]) { - const error = new StructError(tuple[0], function* () { - for (const t of tuples) { - if (t[0]) { - yield t[0]; - } - } - }); - return [error, undefined]; - } else { - const v = tuple[1]; - return [undefined, v]; - } -} - -function assign() { - for (var _len = arguments.length, Structs = new Array(_len), _key = 0; _key < _len; _key++) { - Structs[_key] = arguments[_key]; - } - - const isType = Structs[0].type === 'type'; - const schemas = Structs.map(s => s.schema); - const schema = Object.assign({}, ...schemas); - return isType ? type(schema) : object(schema); -} -/** - * Define a new struct type with a custom validation function. - */ - -function define(name, validator) { - return new Struct({ - type: name, - schema: null, - validator - }); -} -/** - * Create a new struct based on an existing struct, but the value is allowed to - * be `undefined`. `log` will be called if the value is not `undefined`. - */ - -function deprecated(struct, log) { - return new Struct({ ...struct, - refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx), - - validator(value, ctx) { - if (value === undefined) { - return true; - } else { - log(value, ctx); - return struct.validator(value, ctx); - } - } - - }); -} -/** - * Create a struct with dynamic validation logic. - * - * The callback will receive the value currently being validated, and must - * return a struct object to validate it with. This can be useful to model - * validation logic that changes based on its input. - */ - -function dynamic(fn) { - return new Struct({ - type: 'dynamic', - schema: null, - - *entries(value, ctx) { - const struct = fn(value, ctx); - yield* struct.entries(value, ctx); - }, - - validator(value, ctx) { - const struct = fn(value, ctx); - return struct.validator(value, ctx); - }, - - coercer(value, ctx) { - const struct = fn(value, ctx); - return struct.coercer(value, ctx); - }, - - refiner(value, ctx) { - const struct = fn(value, ctx); - return struct.refiner(value, ctx); - } - - }); -} -/** - * Create a struct with lazily evaluated validation logic. - * - * The first time validation is run with the struct, the callback will be called - * and must return a struct object to use. This is useful for cases where you - * want to have self-referential structs for nested data structures to avoid a - * circular definition problem. - */ - -function lazy(fn) { - let struct; - return new Struct({ - type: 'lazy', - schema: null, - - *entries(value, ctx) { - struct ?? (struct = fn()); - yield* struct.entries(value, ctx); - }, - - validator(value, ctx) { - struct ?? (struct = fn()); - return struct.validator(value, ctx); - }, - - coercer(value, ctx) { - struct ?? (struct = fn()); - return struct.coercer(value, ctx); - }, - - refiner(value, ctx) { - struct ?? (struct = fn()); - return struct.refiner(value, ctx); - } - - }); -} -/** - * Create a new struct based on an existing object struct, but excluding - * specific properties. - * - * Like TypeScript's `Omit` utility. - */ - -function omit(struct, keys) { - const { - schema - } = struct; - const subschema = { ...schema - }; - - for (const key of keys) { - delete subschema[key]; - } - - switch (struct.type) { - case 'type': - return type(subschema); - - default: - return object(subschema); - } -} -/** - * Create a new struct based on an existing object struct, but with all of its - * properties allowed to be `undefined`. - * - * Like TypeScript's `Partial` utility. - */ - -function partial(struct) { - const schema = struct instanceof Struct ? { ...struct.schema - } : { ...struct - }; - - for (const key in schema) { - schema[key] = optional(schema[key]); - } - - return object(schema); -} -/** - * Create a new struct based on an existing object struct, but only including - * specific properties. - * - * Like TypeScript's `Pick` utility. - */ - -function pick(struct, keys) { - const { - schema - } = struct; - const subschema = {}; - - for (const key of keys) { - subschema[key] = schema[key]; - } - - return object(subschema); -} -/** - * Define a new struct type with a custom validation function. - * - * @deprecated This function has been renamed to `define`. - */ - -function struct(name, validator) { - console.warn('superstruct@0.11 - The `struct` helper has been renamed to `define`.'); - return define(name, validator); -} - -/** - * Ensure that any value passes validation. - */ - -function any() { - return define('any', () => true); -} -function array(Element) { - return new Struct({ - type: 'array', - schema: Element, - - *entries(value) { - if (Element && Array.isArray(value)) { - for (const [i, v] of value.entries()) { - yield [i, v, Element]; - } - } - }, - - coercer(value) { - return Array.isArray(value) ? value.slice() : value; - }, - - validator(value) { - return Array.isArray(value) || `Expected an array value, but received: ${print(value)}`; - } - - }); -} -/** - * Ensure that a value is a bigint. - */ - -function bigint() { - return define('bigint', value => { - return typeof value === 'bigint'; - }); -} -/** - * Ensure that a value is a boolean. - */ - -function boolean() { - return define('boolean', value => { - return typeof value === 'boolean'; - }); -} -/** - * Ensure that a value is a valid `Date`. - * - * Note: this also ensures that the value is *not* an invalid `Date` object, - * which can occur when parsing a date fails but still returns a `Date`. - */ - -function date() { - return define('date', value => { - return value instanceof Date && !isNaN(value.getTime()) || `Expected a valid \`Date\` object, but received: ${print(value)}`; - }); -} -function enums(values) { - const schema = {}; - const description = values.map(v => print(v)).join(); - - for (const key of values) { - schema[key] = key; - } - - return new Struct({ - type: 'enums', - schema, - - validator(value) { - return values.includes(value) || `Expected one of \`${description}\`, but received: ${print(value)}`; - } - - }); -} -/** - * Ensure that a value is a function. - */ - -function func() { - return define('func', value => { - return typeof value === 'function' || `Expected a function, but received: ${print(value)}`; - }); -} -/** - * Ensure that a value is an instance of a specific class. - */ - -function instance(Class) { - return define('instance', value => { - return value instanceof Class || `Expected a \`${Class.name}\` instance, but received: ${print(value)}`; - }); -} -/** - * Ensure that a value is an integer. - */ - -function integer() { - return define('integer', value => { - return typeof value === 'number' && !isNaN(value) && Number.isInteger(value) || `Expected an integer, but received: ${print(value)}`; - }); -} -/** - * Ensure that a value matches all of a set of types. - */ - -function intersection(Structs) { - return new Struct({ - type: 'intersection', - schema: null, - - *entries(value, ctx) { - for (const S of Structs) { - yield* S.entries(value, ctx); - } - }, - - *validator(value, ctx) { - for (const S of Structs) { - yield* S.validator(value, ctx); - } - }, - - *refiner(value, ctx) { - for (const S of Structs) { - yield* S.refiner(value, ctx); - } - } - - }); -} -function literal(constant) { - const description = print(constant); - const t = typeof constant; - return new Struct({ - type: 'literal', - schema: t === 'string' || t === 'number' || t === 'boolean' ? constant : null, - - validator(value) { - return value === constant || `Expected the literal \`${description}\`, but received: ${print(value)}`; - } - - }); -} -function map(Key, Value) { - return new Struct({ - type: 'map', - schema: null, - - *entries(value) { - if (Key && Value && value instanceof Map) { - for (const [k, v] of value.entries()) { - yield [k, k, Key]; - yield [k, v, Value]; - } - } - }, - - coercer(value) { - return value instanceof Map ? new Map(value) : value; - }, - - validator(value) { - return value instanceof Map || `Expected a \`Map\` object, but received: ${print(value)}`; - } - - }); -} -/** - * Ensure that no value ever passes validation. - */ - -function never() { - return define('never', () => false); -} -/** - * Augment an existing struct to allow `null` values. - */ - -function nullable(struct) { - return new Struct({ ...struct, - validator: (value, ctx) => value === null || struct.validator(value, ctx), - refiner: (value, ctx) => value === null || struct.refiner(value, ctx) - }); -} -/** - * Ensure that a value is a number. - */ - -function number() { - return define('number', value => { - return typeof value === 'number' && !isNaN(value) || `Expected a number, but received: ${print(value)}`; - }); -} -function object(schema) { - const knowns = schema ? Object.keys(schema) : []; - const Never = never(); - return new Struct({ - type: 'object', - schema: schema ? schema : null, - - *entries(value) { - if (schema && isObject(value)) { - const unknowns = new Set(Object.keys(value)); - - for (const key of knowns) { - unknowns.delete(key); - yield [key, value[key], schema[key]]; - } - - for (const key of unknowns) { - yield [key, value[key], Never]; - } - } - }, - - validator(value) { - return isObject(value) || `Expected an object, but received: ${print(value)}`; - }, - - coercer(value) { - return isObject(value) ? { ...value - } : value; - } - - }); -} -/** - * Augment a struct to allow `undefined` values. - */ - -function optional(struct) { - return new Struct({ ...struct, - validator: (value, ctx) => value === undefined || struct.validator(value, ctx), - refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx) - }); -} -/** - * Ensure that a value is an object with keys and values of specific types, but - * without ensuring any specific shape of properties. - * - * Like TypeScript's `Record` utility. - */ - -function record(Key, Value) { - return new Struct({ - type: 'record', - schema: null, - - *entries(value) { - if (isObject(value)) { - for (const k in value) { - const v = value[k]; - yield [k, k, Key]; - yield [k, v, Value]; - } - } - }, - - validator(value) { - return isObject(value) || `Expected an object, but received: ${print(value)}`; - } - - }); -} -/** - * Ensure that a value is a `RegExp`. - * - * Note: this does not test the value against the regular expression! For that - * you need to use the `pattern()` refinement. - */ - -function regexp() { - return define('regexp', value => { - return value instanceof RegExp; - }); -} -function set(Element) { - return new Struct({ - type: 'set', - schema: null, - - *entries(value) { - if (Element && value instanceof Set) { - for (const v of value) { - yield [v, v, Element]; - } - } - }, - - coercer(value) { - return value instanceof Set ? new Set(value) : value; - }, - - validator(value) { - return value instanceof Set || `Expected a \`Set\` object, but received: ${print(value)}`; - } - - }); -} -/** - * Ensure that a value is a string. - */ - -function string() { - return define('string', value => { - return typeof value === 'string' || `Expected a string, but received: ${print(value)}`; - }); -} -/** - * Ensure that a value is a tuple of a specific length, and that each of its - * elements is of a specific type. - */ - -function tuple(Structs) { - const Never = never(); - return new Struct({ - type: 'tuple', - schema: null, - - *entries(value) { - if (Array.isArray(value)) { - const length = Math.max(Structs.length, value.length); - - for (let i = 0; i < length; i++) { - yield [i, value[i], Structs[i] || Never]; - } - } - }, - - validator(value) { - return Array.isArray(value) || `Expected an array, but received: ${print(value)}`; - } - - }); -} -/** - * Ensure that a value has a set of known properties of specific types. - * - * Note: Unrecognized properties are allowed and untouched. This is similar to - * how TypeScript's structural typing works. - */ - -function type(schema) { - const keys = Object.keys(schema); - return new Struct({ - type: 'type', - schema, - - *entries(value) { - if (isObject(value)) { - for (const k of keys) { - yield [k, value[k], schema[k]]; - } - } - }, - - validator(value) { - return isObject(value) || `Expected an object, but received: ${print(value)}`; - } - - }); -} -/** - * Ensure that a value matches one of a set of types. - */ - -function union(Structs) { - const description = Structs.map(s => s.type).join(' | '); - return new Struct({ - type: 'union', - schema: null, - - coercer(value, ctx) { - const firstMatch = Structs.find(s => { - const [e] = s.validate(value, { - coerce: true - }); - return !e; - }) || unknown(); - return firstMatch.coercer(value, ctx); - }, - - validator(value, ctx) { - const failures = []; - - for (const S of Structs) { - const [...tuples] = run(value, S, ctx); - const [first] = tuples; - - if (!first[0]) { - return []; - } else { - for (const [failure] of tuples) { - if (failure) { - failures.push(failure); - } - } - } - } - - return [`Expected the value to satisfy a union of \`${description}\`, but received: ${print(value)}`, ...failures]; - } - - }); -} -/** - * Ensure that any value passes validation, without widening its type to `any`. - */ - -function unknown() { - return define('unknown', () => true); -} - -/** - * Augment a `Struct` to add an additional coercion step to its input. - * - * This allows you to transform input data before validating it, to increase the - * likelihood that it passes validation—for example for default values, parsing - * different formats, etc. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ - -function coerce(struct, condition, coercer) { - return new Struct({ ...struct, - coercer: (value, ctx) => { - return is(value, condition) ? struct.coercer(coercer(value, ctx), ctx) : struct.coercer(value, ctx); - } - }); -} -/** - * Augment a struct to replace `undefined` values with a default. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ - -function defaulted(struct, fallback, options) { - if (options === void 0) { - options = {}; - } - - return coerce(struct, unknown(), x => { - const f = typeof fallback === 'function' ? fallback() : fallback; - - if (x === undefined) { - return f; - } - - if (!options.strict && isPlainObject(x) && isPlainObject(f)) { - const ret = { ...x - }; - let changed = false; - - for (const key in f) { - if (ret[key] === undefined) { - ret[key] = f[key]; - changed = true; - } - } - - if (changed) { - return ret; - } - } - - return x; - }); -} -/** - * Augment a struct to trim string inputs. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ - -function trimmed(struct) { - return coerce(struct, string(), x => x.trim()); -} - -/** - * Ensure that a string, array, map, or set is empty. - */ - -function empty(struct) { - return refine(struct, 'empty', value => { - const size = getSize(value); - return size === 0 || `Expected an empty ${struct.type} but received one with a size of \`${size}\``; - }); -} - -function getSize(value) { - if (value instanceof Map || value instanceof Set) { - return value.size; - } else { - return value.length; - } -} -/** - * Ensure that a number or date is below a threshold. - */ - - -function max(struct, threshold, options) { - if (options === void 0) { - options = {}; - } - - const { - exclusive - } = options; - return refine(struct, 'max', value => { - return exclusive ? value < threshold : value <= threshold || `Expected a ${struct.type} less than ${exclusive ? '' : 'or equal to '}${threshold} but received \`${value}\``; - }); -} -/** - * Ensure that a number or date is above a threshold. - */ - -function min(struct, threshold, options) { - if (options === void 0) { - options = {}; - } - - const { - exclusive - } = options; - return refine(struct, 'min', value => { - return exclusive ? value > threshold : value >= threshold || `Expected a ${struct.type} greater than ${exclusive ? '' : 'or equal to '}${threshold} but received \`${value}\``; - }); -} -/** - * Ensure that a string, array, map or set is not empty. - */ - -function nonempty(struct) { - return refine(struct, 'nonempty', value => { - const size = getSize(value); - return size > 0 || `Expected a nonempty ${struct.type} but received an empty one`; - }); -} -/** - * Ensure that a string matches a regular expression. - */ - -function pattern(struct, regexp) { - return refine(struct, 'pattern', value => { - return regexp.test(value) || `Expected a ${struct.type} matching \`/${regexp.source}/\` but received "${value}"`; - }); -} -/** - * Ensure that a string, array, number, date, map, or set has a size (or length, or time) between `min` and `max`. - */ - -function size(struct, min, max) { - if (max === void 0) { - max = min; - } - - const expected = `Expected a ${struct.type}`; - const of = min === max ? `of \`${min}\`` : `between \`${min}\` and \`${max}\``; - return refine(struct, 'size', value => { - if (typeof value === 'number' || value instanceof Date) { - return min <= value && value <= max || `${expected} ${of} but received \`${value}\``; - } else if (value instanceof Map || value instanceof Set) { - const { - size - } = value; - return min <= size && size <= max || `${expected} with a size ${of} but received one with a size of \`${size}\``; - } else { - const { - length - } = value; - return min <= length && length <= max || `${expected} with a length ${of} but received one with a length of \`${length}\``; - } - }); -} -/** - * Augment a `Struct` to add an additional refinement to the validation. - * - * The refiner function is guaranteed to receive a value of the struct's type, - * because the struct's existing validation will already have passed. This - * allows you to layer additional validation on top of existing structs. - */ - -function refine(struct, name, refiner) { - return new Struct({ ...struct, - - *refiner(value, ctx) { - yield* struct.refiner(value, ctx); - const result = refiner(value, ctx); - const failures = toFailures(result, ctx, struct, value); - - for (const failure of failures) { - yield { ...failure, - refinement: name - }; - } - } - - }); -} - -exports.Struct = Struct; -exports.StructError = StructError; -exports.any = any; -exports.array = array; -exports.assert = assert; -exports.assign = assign; -exports.bigint = bigint; -exports.boolean = boolean; -exports.coerce = coerce; -exports.create = create; -exports.date = date; -exports.defaulted = defaulted; -exports.define = define; -exports.deprecated = deprecated; -exports.dynamic = dynamic; -exports.empty = empty; -exports.enums = enums; -exports.func = func; -exports.instance = instance; -exports.integer = integer; -exports.intersection = intersection; -exports.is = is; -exports.lazy = lazy; -exports.literal = literal; -exports.map = map; -exports.mask = mask; -exports.max = max; -exports.min = min; -exports.never = never; -exports.nonempty = nonempty; -exports.nullable = nullable; -exports.number = number; -exports.object = object; -exports.omit = omit; -exports.optional = optional; -exports.partial = partial; -exports.pattern = pattern; -exports.pick = pick; -exports.record = record; -exports.refine = refine; -exports.regexp = regexp; -exports.set = set; -exports.size = size; -exports.string = string; -exports.struct = struct; -exports.trimmed = trimmed; -exports.tuple = tuple; -exports.type = type; -exports.union = union; -exports.unknown = unknown; -exports.validate = validate; -//# sourceMappingURL=index.cjs.map diff --git a/node_modules/superstruct/lib/index.cjs.map b/node_modules/superstruct/lib/index.cjs.map deleted file mode 100644 index 0ccff1727..000000000 --- a/node_modules/superstruct/lib/index.cjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.cjs","sources":["../src/error.ts","../src/utils.ts","../src/struct.ts","../src/structs/utilities.ts","../src/structs/types.ts","../src/structs/coercions.ts","../src/structs/refinements.ts"],"sourcesContent":["/**\n * A `StructFailure` represents a single specific failure in validation.\n */\n\nexport type Failure = {\n value: any\n key: any\n type: string\n refinement: string | undefined\n message: string\n branch: Array\n path: Array\n}\n\n/**\n * `StructError` objects are thrown (or returned) when validation fails.\n *\n * Validation logic is design to exit early for maximum performance. The error\n * represents the first error encountered during validation. For more detail,\n * the `error.failures` property is a generator function that can be run to\n * continue validation and receive all the failures in the data.\n */\n\nexport class StructError extends TypeError {\n value: any\n key!: any\n type!: string\n refinement!: string | undefined\n path!: Array\n branch!: Array\n failures: () => Array;\n [x: string]: any\n\n constructor(failure: Failure, failures: () => Generator) {\n let cached: Array | undefined\n const { message, ...rest } = failure\n const { path } = failure\n const msg =\n path.length === 0 ? message : `At path: ${path.join('.')} -- ${message}`\n super(msg)\n Object.assign(this, rest)\n this.name = this.constructor.name\n this.failures = () => {\n return (cached ??= [failure, ...failures()])\n }\n }\n}\n","import { Struct, Infer, Result, Context, Describe } from './struct'\nimport { Failure } from './error'\n\n/**\n * Check if a value is an iterator.\n */\n\nfunction isIterable(x: unknown): x is Iterable {\n return isObject(x) && typeof x[Symbol.iterator] === 'function'\n}\n\n/**\n * Check if a value is a plain object.\n */\n\nexport function isObject(x: unknown): x is object {\n return typeof x === 'object' && x != null\n}\n\n/**\n * Check if a value is a plain object.\n */\n\nexport function isPlainObject(x: unknown): x is { [key: string]: any } {\n if (Object.prototype.toString.call(x) !== '[object Object]') {\n return false\n }\n\n const prototype = Object.getPrototypeOf(x)\n return prototype === null || prototype === Object.prototype\n}\n\n/**\n * Return a value as a printable string.\n */\n\nexport function print(value: any): string {\n return typeof value === 'string' ? JSON.stringify(value) : `${value}`\n}\n\n/**\n * Shifts (removes and returns) the first value from the `input` iterator.\n * Like `Array.prototype.shift()` but for an `Iterator`.\n */\n\nexport function shiftIterator(input: Iterator): T | undefined {\n const { done, value } = input.next()\n return done ? undefined : value\n}\n\n/**\n * Convert a single validation result to a failure.\n */\n\nexport function toFailure(\n result: string | boolean | Partial,\n context: Context,\n struct: Struct,\n value: any\n): Failure | undefined {\n if (result === true) {\n return\n } else if (result === false) {\n result = {}\n } else if (typeof result === 'string') {\n result = { message: result }\n }\n\n const { path, branch } = context\n const { type } = struct\n const {\n refinement,\n message = `Expected a value of type \\`${type}\\`${\n refinement ? ` with refinement \\`${refinement}\\`` : ''\n }, but received: \\`${print(value)}\\``,\n } = result\n\n return {\n value,\n type,\n refinement,\n key: path[path.length - 1],\n path,\n branch,\n ...result,\n message,\n }\n}\n\n/**\n * Convert a validation result to an iterable of failures.\n */\n\nexport function* toFailures(\n result: Result,\n context: Context,\n struct: Struct,\n value: any\n): IterableIterator {\n if (!isIterable(result)) {\n result = [result]\n }\n\n for (const r of result) {\n const failure = toFailure(r, context, struct, value)\n\n if (failure) {\n yield failure\n }\n }\n}\n\n/**\n * Check a value against a struct, traversing deeply into nested values, and\n * returning an iterator of failures or success.\n */\n\nexport function* run(\n value: unknown,\n struct: Struct,\n options: {\n path?: any[]\n branch?: any[]\n coerce?: boolean\n mask?: boolean\n } = {}\n): IterableIterator<[Failure, undefined] | [undefined, T]> {\n const { path = [], branch = [value], coerce = false, mask = false } = options\n const ctx: Context = { path, branch }\n\n if (coerce) {\n value = struct.coercer(value, ctx)\n\n if (\n mask &&\n struct.type !== 'type' &&\n isObject(struct.schema) &&\n isObject(value) &&\n !Array.isArray(value)\n ) {\n for (const key in value) {\n if (struct.schema[key] === undefined) {\n delete value[key]\n }\n }\n }\n }\n\n let status: 'valid' | 'not_refined' | 'not_valid' = 'valid'\n\n for (const failure of struct.validator(value, ctx)) {\n status = 'not_valid'\n yield [failure, undefined]\n }\n\n for (let [k, v, s] of struct.entries(value, ctx)) {\n const ts = run(v, s as Struct, {\n path: k === undefined ? path : [...path, k],\n branch: k === undefined ? branch : [...branch, v],\n coerce,\n mask,\n })\n\n for (const t of ts) {\n if (t[0]) {\n status = t[0].refinement != null ? 'not_refined' : 'not_valid'\n yield [t[0], undefined]\n } else if (coerce) {\n v = t[1]\n\n if (k === undefined) {\n value = v\n } else if (value instanceof Map) {\n value.set(k, v)\n } else if (value instanceof Set) {\n value.add(v)\n } else if (isObject(value)) {\n if (v !== undefined) value[k] = v\n }\n }\n }\n }\n\n if (status !== 'not_valid') {\n for (const failure of struct.refiner(value as T, ctx)) {\n status = 'not_refined'\n yield [failure, undefined]\n }\n }\n\n if (status === 'valid') {\n yield [undefined, value as T]\n }\n}\n\n/**\n * Convert a union of type to an intersection.\n */\n\nexport type UnionToIntersection = (\n U extends any ? (arg: U) => any : never\n) extends (arg: infer I) => void\n ? I\n : never\n\n/**\n * Assign properties from one type to another, overwriting existing.\n */\n\nexport type Assign = Simplify>\n\n/**\n * A schema for enum structs.\n */\n\nexport type EnumSchema = {\n [K in NonNullable]: K\n}\n\n/**\n * Check if a type is a match for another whilst treating overlapping\n * unions as a match.\n */\n\nexport type IsMatch = T extends G ? (G extends T ? T : never) : never\n\n/**\n * Check if a type is an exact match.\n */\n\nexport type IsExactMatch = (() => G extends T ? 1 : 2) extends <\n G\n>() => G extends U ? 1 : 2\n ? T\n : never\n\n/**\n * Check if a type is a record type.\n */\n\nexport type IsRecord = T extends object\n ? string extends keyof T\n ? T\n : never\n : never\n/**\n * Check if a type is a tuple.\n */\n\nexport type IsTuple = T extends [any]\n ? T\n : T extends [any, any]\n ? T\n : T extends [any, any, any]\n ? T\n : T extends [any, any, any, any]\n ? T\n : T extends [any, any, any, any, any]\n ? T\n : never\n\n/**\n * Check if a type is a union.\n */\n\nexport type IsUnion = (\n T extends any ? (U extends T ? false : true) : false\n) extends false\n ? never\n : T\n\n/**\n * A schema for object structs.\n */\n\nexport type ObjectSchema = Record>\n\n/**\n * Infer a type from an object struct schema.\n */\n\nexport type ObjectType = Simplify<\n Optionalize<{ [K in keyof S]: Infer }>\n>\n\n/**\n * Omit properties from a type that extend from a specific type.\n */\n\nexport type OmitBy = Omit<\n T,\n { [K in keyof T]: V extends Extract ? K : never }[keyof T]\n>\n\n/**\n * Normalize properties of a type that allow `undefined` to make them optional.\n */\n\nexport type Optionalize = OmitBy &\n Partial>\n\n/**\n * Transform an object schema type to represent a partial.\n */\n\nexport type PartialObjectSchema = {\n [K in keyof S]: Struct | undefined>\n}\n\n/**\n * Pick properties from a type that extend from a specific type.\n */\n\nexport type PickBy = Pick<\n T,\n { [K in keyof T]: V extends Extract ? K : never }[keyof T]\n>\n\n/**\n * Simplifies a type definition to its most basic representation.\n */\n\nexport type Simplify = T extends any[] | Date\n ? T\n : { [K in keyof T]: T[K] } & {}\n\nexport type If = B extends true ? Then : Else\n\n/**\n * A schema for any type of struct.\n */\n\nexport type StructSchema = [T] extends [string | undefined]\n ? [T] extends [IsMatch]\n ? null\n : [T] extends [IsUnion]\n ? EnumSchema\n : T\n : [T] extends [number | undefined]\n ? [T] extends [IsMatch]\n ? null\n : [T] extends [IsUnion]\n ? EnumSchema\n : T\n : [T] extends [boolean]\n ? [T] extends [IsExactMatch]\n ? null\n : T\n : T extends\n | bigint\n | symbol\n | undefined\n | null\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : T extends Array\n ? T extends IsTuple\n ? null\n : Struct\n : T extends object\n ? T extends IsRecord\n ? null\n : { [K in keyof T]: Describe }\n : null\n\n/**\n * A schema for tuple structs.\n */\n\nexport type TupleSchema = { [K in keyof T]: Struct }\n\n/**\n * Shorthand type for matching any `Struct`.\n */\n\nexport type AnyStruct = Struct\n\n/**\n * Infer a tuple of types from a tuple of `Struct`s.\n *\n * This is used to recursively retrieve the type from `union` `intersection` and\n * `tuple` structs.\n */\n\nexport type InferStructTuple<\n Tuple extends AnyStruct[],\n Length extends number = Tuple['length']\n> = Length extends Length\n ? number extends Length\n ? Tuple\n : _InferTuple\n : never\ntype _InferTuple<\n Tuple extends AnyStruct[],\n Length extends number,\n Accumulated extends unknown[],\n Index extends number = Accumulated['length']\n> = Index extends Length\n ? Accumulated\n : _InferTuple]>\n","import { toFailures, shiftIterator, StructSchema, run } from './utils'\nimport { StructError, Failure } from './error'\n\n/**\n * `Struct` objects encapsulate the validation logic for a specific type of\n * values. Once constructed, you use the `assert`, `is` or `validate` helpers to\n * validate unknown input data against the struct.\n */\n\nexport class Struct {\n readonly TYPE!: T\n type: string\n schema: S\n coercer: (value: unknown, context: Context) => unknown\n validator: (value: unknown, context: Context) => Iterable\n refiner: (value: T, context: Context) => Iterable\n entries: (\n value: unknown,\n context: Context\n ) => Iterable<[string | number, unknown, Struct | Struct]>\n\n constructor(props: {\n type: string\n schema: S\n coercer?: Coercer\n validator?: Validator\n refiner?: Refiner\n entries?: Struct['entries']\n }) {\n const {\n type,\n schema,\n validator,\n refiner,\n coercer = (value: unknown) => value,\n entries = function* () {},\n } = props\n\n this.type = type\n this.schema = schema\n this.entries = entries\n this.coercer = coercer\n\n if (validator) {\n this.validator = (value, context) => {\n const result = validator(value, context)\n return toFailures(result, context, this, value)\n }\n } else {\n this.validator = () => []\n }\n\n if (refiner) {\n this.refiner = (value, context) => {\n const result = refiner(value, context)\n return toFailures(result, context, this, value)\n }\n } else {\n this.refiner = () => []\n }\n }\n\n /**\n * Assert that a value passes the struct's validation, throwing if it doesn't.\n */\n\n assert(value: unknown): asserts value is T {\n return assert(value, this)\n }\n\n /**\n * Create a value with the struct's coercion logic, then validate it.\n */\n\n create(value: unknown): T {\n return create(value, this)\n }\n\n /**\n * Check if a value passes the struct's validation.\n */\n\n is(value: unknown): value is T {\n return is(value, this)\n }\n\n /**\n * Mask a value, coercing and validating it, but returning only the subset of\n * properties defined by the struct's schema.\n */\n\n mask(value: unknown): T {\n return mask(value, this)\n }\n\n /**\n * Validate a value with the struct's validation logic, returning a tuple\n * representing the result.\n *\n * You may optionally pass `true` for the `withCoercion` argument to coerce\n * the value before attempting to validate it. If you do, the result will\n * contain the coerced result when successful.\n */\n\n validate(\n value: unknown,\n options: {\n coerce?: boolean\n } = {}\n ): [StructError, undefined] | [undefined, T] {\n return validate(value, this, options)\n }\n}\n\n/**\n * Assert that a value passes a struct, throwing if it doesn't.\n */\n\nexport function assert(\n value: unknown,\n struct: Struct\n): asserts value is T {\n const result = validate(value, struct)\n\n if (result[0]) {\n throw result[0]\n }\n}\n\n/**\n * Create a value with the coercion logic of struct and validate it.\n */\n\nexport function create(value: unknown, struct: Struct): T {\n const result = validate(value, struct, { coerce: true })\n\n if (result[0]) {\n throw result[0]\n } else {\n return result[1]\n }\n}\n\n/**\n * Mask a value, returning only the subset of properties defined by a struct.\n */\n\nexport function mask(value: unknown, struct: Struct): T {\n const result = validate(value, struct, { coerce: true, mask: true })\n\n if (result[0]) {\n throw result[0]\n } else {\n return result[1]\n }\n}\n\n/**\n * Check if a value passes a struct.\n */\n\nexport function is(value: unknown, struct: Struct): value is T {\n const result = validate(value, struct)\n return !result[0]\n}\n\n/**\n * Validate a value against a struct, returning an error if invalid, or the\n * value (with potential coercion) if valid.\n */\n\nexport function validate(\n value: unknown,\n struct: Struct,\n options: {\n coerce?: boolean\n mask?: boolean\n } = {}\n): [StructError, undefined] | [undefined, T] {\n const tuples = run(value, struct, options)\n const tuple = shiftIterator(tuples)!\n\n if (tuple[0]) {\n const error = new StructError(tuple[0], function* () {\n for (const t of tuples) {\n if (t[0]) {\n yield t[0]\n }\n }\n })\n\n return [error, undefined]\n } else {\n const v = tuple[1]\n return [undefined, v]\n }\n}\n\n/**\n * A `Context` contains information about the current location of the\n * validation inside the initial input value.\n */\n\nexport type Context = {\n branch: Array\n path: Array\n}\n\n/**\n * A type utility to extract the type from a `Struct` class.\n */\n\nexport type Infer> = T['TYPE']\n\n/**\n * A type utility to describe that a struct represents a TypeScript type.\n */\n\nexport type Describe = Struct>\n\n/**\n * A `Result` is returned from validation functions.\n */\n\nexport type Result =\n | boolean\n | string\n | Partial\n | Iterable>\n\n/**\n * A `Coercer` takes an unknown value and optionally coerces it.\n */\n\nexport type Coercer = (value: T, context: Context) => unknown\n\n/**\n * A `Validator` takes an unknown value and validates it.\n */\n\nexport type Validator = (value: unknown, context: Context) => Result\n\n/**\n * A `Refiner` takes a value of a known type and validates it against a further\n * constraint.\n */\n\nexport type Refiner = (value: T, context: Context) => Result\n","import { Struct, Context, Validator } from '../struct'\nimport { object, optional, type } from './types'\nimport { ObjectSchema, Assign, ObjectType, PartialObjectSchema } from '../utils'\n\n/**\n * Create a new struct that combines the properties properties from multiple\n * object or type structs. Its return type will match the first parameter's type.\n *\n * Like JavaScript's `Object.assign` utility.\n */\n\nexport function assign(\n A: Struct, A>,\n B: Struct, B>\n): Struct>, Assign>\nexport function assign<\n A extends ObjectSchema,\n B extends ObjectSchema,\n C extends ObjectSchema\n>(\n A: Struct, A>,\n B: Struct, B>,\n C: Struct, C>\n): Struct, C>>, Assign, C>>\nexport function assign<\n A extends ObjectSchema,\n B extends ObjectSchema,\n C extends ObjectSchema,\n D extends ObjectSchema\n>(\n A: Struct, A>,\n B: Struct, B>,\n C: Struct, C>,\n D: Struct, D>\n): Struct<\n ObjectType, C>, D>>,\n Assign, C>, D>\n>\nexport function assign<\n A extends ObjectSchema,\n B extends ObjectSchema,\n C extends ObjectSchema,\n D extends ObjectSchema,\n E extends ObjectSchema\n>(\n A: Struct, A>,\n B: Struct, B>,\n C: Struct, C>,\n D: Struct, D>,\n E: Struct, E>\n): Struct<\n ObjectType, C>, D>, E>>,\n Assign, C>, D>, E>\n>\nexport function assign(...Structs: Struct[]): any {\n const isType = Structs[0].type === 'type'\n const schemas = Structs.map((s) => s.schema)\n const schema = Object.assign({}, ...schemas)\n return isType ? type(schema) : object(schema)\n}\n\n/**\n * Define a new struct type with a custom validation function.\n */\n\nexport function define(name: string, validator: Validator): Struct {\n return new Struct({ type: name, schema: null, validator })\n}\n\n/**\n * Create a new struct based on an existing struct, but the value is allowed to\n * be `undefined`. `log` will be called if the value is not `undefined`.\n */\n\nexport function deprecated(\n struct: Struct,\n log: (value: unknown, ctx: Context) => void\n): Struct {\n return new Struct({\n ...struct,\n refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx),\n validator(value, ctx) {\n if (value === undefined) {\n return true\n } else {\n log(value, ctx)\n return struct.validator(value, ctx)\n }\n },\n })\n}\n\n/**\n * Create a struct with dynamic validation logic.\n *\n * The callback will receive the value currently being validated, and must\n * return a struct object to validate it with. This can be useful to model\n * validation logic that changes based on its input.\n */\n\nexport function dynamic(\n fn: (value: unknown, ctx: Context) => Struct\n): Struct {\n return new Struct({\n type: 'dynamic',\n schema: null,\n *entries(value, ctx) {\n const struct = fn(value, ctx)\n yield* struct.entries(value, ctx)\n },\n validator(value, ctx) {\n const struct = fn(value, ctx)\n return struct.validator(value, ctx)\n },\n coercer(value, ctx) {\n const struct = fn(value, ctx)\n return struct.coercer(value, ctx)\n },\n refiner(value, ctx) {\n const struct = fn(value, ctx)\n return struct.refiner(value, ctx)\n },\n })\n}\n\n/**\n * Create a struct with lazily evaluated validation logic.\n *\n * The first time validation is run with the struct, the callback will be called\n * and must return a struct object to use. This is useful for cases where you\n * want to have self-referential structs for nested data structures to avoid a\n * circular definition problem.\n */\n\nexport function lazy(fn: () => Struct): Struct {\n let struct: Struct | undefined\n return new Struct({\n type: 'lazy',\n schema: null,\n *entries(value, ctx) {\n struct ??= fn()\n yield* struct.entries(value, ctx)\n },\n validator(value, ctx) {\n struct ??= fn()\n return struct.validator(value, ctx)\n },\n coercer(value, ctx) {\n struct ??= fn()\n return struct.coercer(value, ctx)\n },\n refiner(value, ctx) {\n struct ??= fn()\n return struct.refiner(value, ctx)\n },\n })\n}\n\n/**\n * Create a new struct based on an existing object struct, but excluding\n * specific properties.\n *\n * Like TypeScript's `Omit` utility.\n */\n\nexport function omit(\n struct: Struct, S>,\n keys: K[]\n): Struct>, Omit> {\n const { schema } = struct\n const subschema: any = { ...schema }\n\n for (const key of keys) {\n delete subschema[key]\n }\n\n switch (struct.type) {\n case 'type':\n return type(subschema as Omit)\n default:\n return object(subschema as Omit)\n }\n}\n\n/**\n * Create a new struct based on an existing object struct, but with all of its\n * properties allowed to be `undefined`.\n *\n * Like TypeScript's `Partial` utility.\n */\n\nexport function partial(\n struct: Struct, S> | S\n): Struct>, PartialObjectSchema> {\n const schema: any =\n struct instanceof Struct ? { ...struct.schema } : { ...struct }\n\n for (const key in schema) {\n schema[key] = optional(schema[key])\n }\n\n return object(schema) as any\n}\n\n/**\n * Create a new struct based on an existing object struct, but only including\n * specific properties.\n *\n * Like TypeScript's `Pick` utility.\n */\n\nexport function pick(\n struct: Struct, S>,\n keys: K[]\n): Struct>, Pick> {\n const { schema } = struct\n const subschema: any = {}\n\n for (const key of keys) {\n subschema[key] = schema[key]\n }\n\n return object(subschema as Pick)\n}\n\n/**\n * Define a new struct type with a custom validation function.\n *\n * @deprecated This function has been renamed to `define`.\n */\n\nexport function struct(name: string, validator: Validator): Struct {\n console.warn(\n 'superstruct@0.11 - The `struct` helper has been renamed to `define`.'\n )\n\n return define(name, validator)\n}\n","import { Infer, Struct } from '../struct'\nimport { define } from './utilities'\nimport {\n ObjectSchema,\n ObjectType,\n print,\n run,\n isObject,\n AnyStruct,\n InferStructTuple,\n UnionToIntersection,\n} from '../utils'\n\n/**\n * Ensure that any value passes validation.\n */\n\nexport function any(): Struct {\n return define('any', () => true)\n}\n\n/**\n * Ensure that a value is an array and that its elements are of a specific type.\n *\n * Note: If you omit the element struct, the arrays elements will not be\n * iterated at all. This can be helpful for cases where performance is critical,\n * and it is preferred to using `array(any())`.\n */\n\nexport function array>(Element: T): Struct[], T>\nexport function array(): Struct\nexport function array>(Element?: T): any {\n return new Struct({\n type: 'array',\n schema: Element,\n *entries(value) {\n if (Element && Array.isArray(value)) {\n for (const [i, v] of value.entries()) {\n yield [i, v, Element]\n }\n }\n },\n coercer(value) {\n return Array.isArray(value) ? value.slice() : value\n },\n validator(value) {\n return (\n Array.isArray(value) ||\n `Expected an array value, but received: ${print(value)}`\n )\n },\n })\n}\n\n/**\n * Ensure that a value is a bigint.\n */\n\nexport function bigint(): Struct {\n return define('bigint', (value) => {\n return typeof value === 'bigint'\n })\n}\n\n/**\n * Ensure that a value is a boolean.\n */\n\nexport function boolean(): Struct {\n return define('boolean', (value) => {\n return typeof value === 'boolean'\n })\n}\n\n/**\n * Ensure that a value is a valid `Date`.\n *\n * Note: this also ensures that the value is *not* an invalid `Date` object,\n * which can occur when parsing a date fails but still returns a `Date`.\n */\n\nexport function date(): Struct {\n return define('date', (value) => {\n return (\n (value instanceof Date && !isNaN(value.getTime())) ||\n `Expected a valid \\`Date\\` object, but received: ${print(value)}`\n )\n })\n}\n\n/**\n * Ensure that a value is one of a set of potential values.\n *\n * Note: after creating the struct, you can access the definition of the\n * potential values as `struct.schema`.\n */\n\nexport function enums(\n values: T\n): Struct\nexport function enums(\n values: T\n): Struct\nexport function enums(\n values: T\n): any {\n const schema: any = {}\n const description = values.map((v) => print(v)).join()\n\n for (const key of values) {\n schema[key] = key\n }\n\n return new Struct({\n type: 'enums',\n schema,\n validator(value) {\n return (\n values.includes(value as any) ||\n `Expected one of \\`${description}\\`, but received: ${print(value)}`\n )\n },\n })\n}\n\n/**\n * Ensure that a value is a function.\n */\n\nexport function func(): Struct {\n return define('func', (value) => {\n return (\n typeof value === 'function' ||\n `Expected a function, but received: ${print(value)}`\n )\n })\n}\n\n/**\n * Ensure that a value is an instance of a specific class.\n */\n\nexport function instance(\n Class: T\n): Struct, null> {\n return define('instance', (value) => {\n return (\n value instanceof Class ||\n `Expected a \\`${Class.name}\\` instance, but received: ${print(value)}`\n )\n })\n}\n\n/**\n * Ensure that a value is an integer.\n */\n\nexport function integer(): Struct {\n return define('integer', (value) => {\n return (\n (typeof value === 'number' && !isNaN(value) && Number.isInteger(value)) ||\n `Expected an integer, but received: ${print(value)}`\n )\n })\n}\n\n/**\n * Ensure that a value matches all of a set of types.\n */\n\nexport function intersection(\n Structs: [A, ...B]\n): Struct & UnionToIntersection[number]>, null> {\n return new Struct({\n type: 'intersection',\n schema: null,\n *entries(value, ctx) {\n for (const S of Structs) {\n yield* S.entries(value, ctx)\n }\n },\n *validator(value, ctx) {\n for (const S of Structs) {\n yield* S.validator(value, ctx)\n }\n },\n *refiner(value, ctx) {\n for (const S of Structs) {\n yield* S.refiner(value, ctx)\n }\n },\n })\n}\n\n/**\n * Ensure that a value is an exact value, using `===` for comparison.\n */\n\nexport function literal(constant: T): Struct\nexport function literal(constant: T): Struct\nexport function literal(constant: T): Struct\nexport function literal(constant: T): Struct\nexport function literal(constant: T): any {\n const description = print(constant)\n const t = typeof constant\n return new Struct({\n type: 'literal',\n schema:\n t === 'string' || t === 'number' || t === 'boolean' ? constant : null,\n validator(value) {\n return (\n value === constant ||\n `Expected the literal \\`${description}\\`, but received: ${print(value)}`\n )\n },\n })\n}\n\n/**\n * Ensure that a value is a `Map` object, and that its keys and values are of\n * specific types.\n */\n\nexport function map(): Struct, null>\nexport function map(\n Key: Struct,\n Value: Struct\n): Struct, null>\nexport function map(Key?: Struct, Value?: Struct): any {\n return new Struct({\n type: 'map',\n schema: null,\n *entries(value) {\n if (Key && Value && value instanceof Map) {\n for (const [k, v] of value.entries()) {\n yield [k as string, k, Key]\n yield [k as string, v, Value]\n }\n }\n },\n coercer(value) {\n return value instanceof Map ? new Map(value) : value\n },\n validator(value) {\n return (\n value instanceof Map ||\n `Expected a \\`Map\\` object, but received: ${print(value)}`\n )\n },\n })\n}\n\n/**\n * Ensure that no value ever passes validation.\n */\n\nexport function never(): Struct {\n return define('never', () => false)\n}\n\n/**\n * Augment an existing struct to allow `null` values.\n */\n\nexport function nullable(struct: Struct): Struct {\n return new Struct({\n ...struct,\n validator: (value, ctx) => value === null || struct.validator(value, ctx),\n refiner: (value, ctx) => value === null || struct.refiner(value, ctx),\n })\n}\n\n/**\n * Ensure that a value is a number.\n */\n\nexport function number(): Struct {\n return define('number', (value) => {\n return (\n (typeof value === 'number' && !isNaN(value)) ||\n `Expected a number, but received: ${print(value)}`\n )\n })\n}\n\n/**\n * Ensure that a value is an object, that is has a known set of properties,\n * and that its properties are of specific types.\n *\n * Note: Unrecognized properties will fail validation.\n */\n\nexport function object(): Struct, null>\nexport function object(\n schema: S\n): Struct, S>\nexport function object(schema?: S): any {\n const knowns = schema ? Object.keys(schema) : []\n const Never = never()\n return new Struct({\n type: 'object',\n schema: schema ? schema : null,\n *entries(value) {\n if (schema && isObject(value)) {\n const unknowns = new Set(Object.keys(value))\n\n for (const key of knowns) {\n unknowns.delete(key)\n yield [key, value[key], schema[key]]\n }\n\n for (const key of unknowns) {\n yield [key, value[key], Never]\n }\n }\n },\n validator(value) {\n return (\n isObject(value) || `Expected an object, but received: ${print(value)}`\n )\n },\n coercer(value) {\n return isObject(value) ? { ...value } : value\n },\n })\n}\n\n/**\n * Augment a struct to allow `undefined` values.\n */\n\nexport function optional(struct: Struct): Struct {\n return new Struct({\n ...struct,\n validator: (value, ctx) =>\n value === undefined || struct.validator(value, ctx),\n refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx),\n })\n}\n\n/**\n * Ensure that a value is an object with keys and values of specific types, but\n * without ensuring any specific shape of properties.\n *\n * Like TypeScript's `Record` utility.\n */\n\nexport function record(\n Key: Struct,\n Value: Struct\n): Struct, null> {\n return new Struct({\n type: 'record',\n schema: null,\n *entries(value) {\n if (isObject(value)) {\n for (const k in value) {\n const v = value[k]\n yield [k, k, Key]\n yield [k, v, Value]\n }\n }\n },\n validator(value) {\n return (\n isObject(value) || `Expected an object, but received: ${print(value)}`\n )\n },\n })\n}\n\n/**\n * Ensure that a value is a `RegExp`.\n *\n * Note: this does not test the value against the regular expression! For that\n * you need to use the `pattern()` refinement.\n */\n\nexport function regexp(): Struct {\n return define('regexp', (value) => {\n return value instanceof RegExp\n })\n}\n\n/**\n * Ensure that a value is a `Set` object, and that its elements are of a\n * specific type.\n */\n\nexport function set(): Struct, null>\nexport function set(Element: Struct): Struct, null>\nexport function set(Element?: Struct): any {\n return new Struct({\n type: 'set',\n schema: null,\n *entries(value) {\n if (Element && value instanceof Set) {\n for (const v of value) {\n yield [v as string, v, Element]\n }\n }\n },\n coercer(value) {\n return value instanceof Set ? new Set(value) : value\n },\n validator(value) {\n return (\n value instanceof Set ||\n `Expected a \\`Set\\` object, but received: ${print(value)}`\n )\n },\n })\n}\n\n/**\n * Ensure that a value is a string.\n */\n\nexport function string(): Struct {\n return define('string', (value) => {\n return (\n typeof value === 'string' ||\n `Expected a string, but received: ${print(value)}`\n )\n })\n}\n\n/**\n * Ensure that a value is a tuple of a specific length, and that each of its\n * elements is of a specific type.\n */\n\nexport function tuple(\n Structs: [A, ...B]\n): Struct<[Infer, ...InferStructTuple], null> {\n const Never = never()\n\n return new Struct({\n type: 'tuple',\n schema: null,\n *entries(value) {\n if (Array.isArray(value)) {\n const length = Math.max(Structs.length, value.length)\n\n for (let i = 0; i < length; i++) {\n yield [i, value[i], Structs[i] || Never]\n }\n }\n },\n validator(value) {\n return (\n Array.isArray(value) ||\n `Expected an array, but received: ${print(value)}`\n )\n },\n })\n}\n\n/**\n * Ensure that a value has a set of known properties of specific types.\n *\n * Note: Unrecognized properties are allowed and untouched. This is similar to\n * how TypeScript's structural typing works.\n */\n\nexport function type(\n schema: S\n): Struct, S> {\n const keys = Object.keys(schema)\n return new Struct({\n type: 'type',\n schema,\n *entries(value) {\n if (isObject(value)) {\n for (const k of keys) {\n yield [k, value[k], schema[k]]\n }\n }\n },\n validator(value) {\n return (\n isObject(value) || `Expected an object, but received: ${print(value)}`\n )\n },\n })\n}\n\n/**\n * Ensure that a value matches one of a set of types.\n */\n\nexport function union(\n Structs: [A, ...B]\n): Struct | InferStructTuple[number], null> {\n const description = Structs.map((s) => s.type).join(' | ')\n return new Struct({\n type: 'union',\n schema: null,\n coercer(value, ctx) {\n const firstMatch =\n Structs.find((s) => {\n const [e] = s.validate(value, { coerce: true })\n return !e\n }) || unknown()\n return firstMatch.coercer(value, ctx)\n },\n validator(value, ctx) {\n const failures = []\n\n for (const S of Structs) {\n const [...tuples] = run(value, S, ctx)\n const [first] = tuples\n\n if (!first[0]) {\n return []\n } else {\n for (const [failure] of tuples) {\n if (failure) {\n failures.push(failure)\n }\n }\n }\n }\n\n return [\n `Expected the value to satisfy a union of \\`${description}\\`, but received: ${print(\n value\n )}`,\n ...failures,\n ]\n },\n })\n}\n\n/**\n * Ensure that any value passes validation, without widening its type to `any`.\n */\n\nexport function unknown(): Struct {\n return define('unknown', () => true)\n}\n","import { Struct, is, Coercer } from '../struct'\nimport { isPlainObject } from '../utils'\nimport { string, unknown } from './types'\n\n/**\n * Augment a `Struct` to add an additional coercion step to its input.\n *\n * This allows you to transform input data before validating it, to increase the\n * likelihood that it passes validation—for example for default values, parsing\n * different formats, etc.\n *\n * Note: You must use `create(value, Struct)` on the value to have the coercion\n * take effect! Using simply `assert()` or `is()` will not use coercion.\n */\n\nexport function coerce(\n struct: Struct,\n condition: Struct,\n coercer: Coercer\n): Struct {\n return new Struct({\n ...struct,\n coercer: (value, ctx) => {\n return is(value, condition)\n ? struct.coercer(coercer(value, ctx), ctx)\n : struct.coercer(value, ctx)\n },\n })\n}\n\n/**\n * Augment a struct to replace `undefined` values with a default.\n *\n * Note: You must use `create(value, Struct)` on the value to have the coercion\n * take effect! Using simply `assert()` or `is()` will not use coercion.\n */\n\nexport function defaulted(\n struct: Struct,\n fallback: any,\n options: {\n strict?: boolean\n } = {}\n): Struct {\n return coerce(struct, unknown(), (x) => {\n const f = typeof fallback === 'function' ? fallback() : fallback\n\n if (x === undefined) {\n return f\n }\n\n if (!options.strict && isPlainObject(x) && isPlainObject(f)) {\n const ret = { ...x }\n let changed = false\n\n for (const key in f) {\n if (ret[key] === undefined) {\n ret[key] = f[key]\n changed = true\n }\n }\n\n if (changed) {\n return ret\n }\n }\n\n return x\n })\n}\n\n/**\n * Augment a struct to trim string inputs.\n *\n * Note: You must use `create(value, Struct)` on the value to have the coercion\n * take effect! Using simply `assert()` or `is()` will not use coercion.\n */\n\nexport function trimmed(struct: Struct): Struct {\n return coerce(struct, string(), (x) => x.trim())\n}\n","import { Struct, Refiner } from '../struct'\nimport { toFailures } from '../utils'\n\n/**\n * Ensure that a string, array, map, or set is empty.\n */\n\nexport function empty<\n T extends string | any[] | Map | Set,\n S extends any\n>(struct: Struct): Struct {\n return refine(struct, 'empty', (value) => {\n const size = getSize(value)\n return (\n size === 0 ||\n `Expected an empty ${struct.type} but received one with a size of \\`${size}\\``\n )\n })\n}\n\nfunction getSize(value: string | any[] | Map | Set): number {\n if (value instanceof Map || value instanceof Set) {\n return value.size\n } else {\n return value.length\n }\n}\n\n/**\n * Ensure that a number or date is below a threshold.\n */\n\nexport function max(\n struct: Struct,\n threshold: T,\n options: {\n exclusive?: boolean\n } = {}\n): Struct {\n const { exclusive } = options\n return refine(struct, 'max', (value) => {\n return exclusive\n ? value < threshold\n : value <= threshold ||\n `Expected a ${struct.type} less than ${\n exclusive ? '' : 'or equal to '\n }${threshold} but received \\`${value}\\``\n })\n}\n\n/**\n * Ensure that a number or date is above a threshold.\n */\n\nexport function min(\n struct: Struct,\n threshold: T,\n options: {\n exclusive?: boolean\n } = {}\n): Struct {\n const { exclusive } = options\n return refine(struct, 'min', (value) => {\n return exclusive\n ? value > threshold\n : value >= threshold ||\n `Expected a ${struct.type} greater than ${\n exclusive ? '' : 'or equal to '\n }${threshold} but received \\`${value}\\``\n })\n}\n\n/**\n * Ensure that a string, array, map or set is not empty.\n */\n\nexport function nonempty<\n T extends string | any[] | Map | Set,\n S extends any\n>(struct: Struct): Struct {\n return refine(struct, 'nonempty', (value) => {\n const size = getSize(value)\n return (\n size > 0 || `Expected a nonempty ${struct.type} but received an empty one`\n )\n })\n}\n\n/**\n * Ensure that a string matches a regular expression.\n */\n\nexport function pattern(\n struct: Struct,\n regexp: RegExp\n): Struct {\n return refine(struct, 'pattern', (value) => {\n return (\n regexp.test(value) ||\n `Expected a ${struct.type} matching \\`/${regexp.source}/\\` but received \"${value}\"`\n )\n })\n}\n\n/**\n * Ensure that a string, array, number, date, map, or set has a size (or length, or time) between `min` and `max`.\n */\n\nexport function size<\n T extends string | number | Date | any[] | Map | Set,\n S extends any\n>(struct: Struct, min: number, max: number = min): Struct {\n const expected = `Expected a ${struct.type}`\n const of = min === max ? `of \\`${min}\\`` : `between \\`${min}\\` and \\`${max}\\``\n\n return refine(struct, 'size', (value) => {\n if (typeof value === 'number' || value instanceof Date) {\n return (\n (min <= value && value <= max) ||\n `${expected} ${of} but received \\`${value}\\``\n )\n } else if (value instanceof Map || value instanceof Set) {\n const { size } = value\n return (\n (min <= size && size <= max) ||\n `${expected} with a size ${of} but received one with a size of \\`${size}\\``\n )\n } else {\n const { length } = value as string | any[]\n return (\n (min <= length && length <= max) ||\n `${expected} with a length ${of} but received one with a length of \\`${length}\\``\n )\n }\n })\n}\n\n/**\n * Augment a `Struct` to add an additional refinement to the validation.\n *\n * The refiner function is guaranteed to receive a value of the struct's type,\n * because the struct's existing validation will already have passed. This\n * allows you to layer additional validation on top of existing structs.\n */\n\nexport function refine(\n struct: Struct,\n name: string,\n refiner: Refiner\n): Struct {\n return new Struct({\n ...struct,\n *refiner(value, ctx) {\n yield* struct.refiner(value, ctx)\n const result = refiner(value, ctx)\n const failures = toFailures(result, ctx, struct, value)\n\n for (const failure of failures) {\n yield { ...failure, refinement: name }\n }\n },\n })\n}\n"],"names":["StructError","TypeError","constructor","failure","failures","cached","message","rest","path","msg","length","join","value","key","type","refinement","branch","Object","assign","name","isIterable","x","isObject","Symbol","iterator","isPlainObject","prototype","toString","call","getPrototypeOf","print","JSON","stringify","shiftIterator","input","done","next","undefined","toFailure","result","context","struct","toFailures","r","run","options","coerce","mask","ctx","coercer","schema","Array","isArray","status","validator","k","v","s","entries","ts","t","Map","set","Set","add","refiner","Struct","props","TYPE","assert","create","is","validate","tuples","tuple","error","Structs","isType","schemas","map","object","define","deprecated","log","dynamic","fn","lazy","omit","keys","subschema","partial","optional","pick","console","warn","any","array","Element","i","slice","bigint","boolean","date","Date","isNaN","getTime","enums","values","description","includes","func","instance","Class","integer","Number","isInteger","intersection","S","literal","constant","Key","Value","never","nullable","number","knowns","Never","unknowns","delete","record","regexp","RegExp","string","Math","max","union","firstMatch","find","e","unknown","first","push","condition","defaulted","fallback","f","strict","ret","changed","trimmed","trim","empty","refine","size","getSize","threshold","exclusive","min","nonempty","pattern","test","source","expected","of"],"mappings":";;;;AAAA;;AAEG;;AAYH;;;;;;;AAOG;AAEG,MAAOA,WAAP,SAA2BC,SAA3B,CAAoC;AAUxCC,EAAAA,WAAY,CAAAC,OAAA,EAAkBC,QAAlB,EAAoD;AAC9D,IAAA,IAAIC,MAAJ,CAAA;IACA,MAAM;MAAEC,OAAF;MAAW,GAAGC,IAAAA;AAAd,KAAA,GAAuBJ,OAA7B,CAAA;IACA,MAAM;AAAEK,MAAAA,IAAAA;AAAF,KAAA,GAAWL,OAAjB,CAAA;AACA,IAAA,MAAMM,GAAG,GACPD,IAAI,CAACE,MAAL,KAAgB,CAAhB,GAAoBJ,OAApB,GAA8B,CAAYE,SAAAA,EAAAA,IAAI,CAACG,IAAL,CAAU,GAAV,CAAc,CAAA,IAAA,EAAOL,OAAO,CADxE,CAAA,CAAA;AAEA,IAAA,KAAA,CAAMG,GAAN,CAAA,CAAA;AAN8D,IAAA,IAAA,CAThEG,KASgE,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CARhEC,GAQgE,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CAPhEC,IAOgE,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CANhEC,UAMgE,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA,CALhEP,IAKgE,GAAA,KAAA,CAAA,CAAA;AAAA,IAAA,IAAA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rD,KAAT,EAAgBoC,GAAhB,EAAmB;AACjB,MAAA,OAAOP,MAAM,CAACwB,OAAP,CAAerD,KAAf,EAAsBoC,GAAtB,CAAP,CAAA;AACA,MAAA,MAAMT,MAAM,GAAG0B,OAAO,CAACrD,KAAD,EAAQoC,GAAR,CAAtB,CAAA;MACA,MAAM5C,QAAQ,GAAGsC,UAAU,CAACH,MAAD,EAASS,GAAT,EAAcP,MAAd,EAAsB7B,KAAtB,CAA3B,CAAA;;AAEA,MAAA,KAAK,MAAMT,OAAX,IAAsBC,QAAtB,EAAgC;QAC9B,MAAM,EAAE,GAAGD,OAAL;AAAcY,UAAAA,UAAU,EAAEI,IAAAA;SAAhC,CAAA;AACD,OAAA;AACF,KAAA;;AAVe,GAAX,CAAP,CAAA;AAYD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/node_modules/superstruct/lib/index.d.cts b/node_modules/superstruct/lib/index.d.cts deleted file mode 100644 index 47dce3dff..000000000 --- a/node_modules/superstruct/lib/index.d.cts +++ /dev/null @@ -1,579 +0,0 @@ -/** - * A `StructFailure` represents a single specific failure in validation. - */ -type Failure = { - value: any; - key: any; - type: string; - refinement: string | undefined; - message: string; - branch: Array; - path: Array; -}; -/** - * `StructError` objects are thrown (or returned) when validation fails. - * - * Validation logic is design to exit early for maximum performance. The error - * represents the first error encountered during validation. For more detail, - * the `error.failures` property is a generator function that can be run to - * continue validation and receive all the failures in the data. - */ -declare class StructError extends TypeError { - value: any; - key: any; - type: string; - refinement: string | undefined; - path: Array; - branch: Array; - failures: () => Array; - [x: string]: any; - constructor(failure: Failure, failures: () => Generator); -} -/** - * Convert a union of type to an intersection. - */ -type UnionToIntersection = (U extends any ? (arg: U) => any : never) extends (arg: infer I) => void ? I : never; -/** - * Assign properties from one type to another, overwriting existing. - */ -type Assign = Simplify>; -/** - * A schema for enum structs. - */ -type EnumSchema = { - [K in NonNullable]: K; -}; -/** - * Check if a type is a match for another whilst treating overlapping - * unions as a match. - */ -type IsMatch = T extends G ? (G extends T ? T : never) : never; -/** - * Check if a type is an exact match. - */ -type IsExactMatch = (() => G extends T ? 1 : 2) extends () => G extends U ? 1 : 2 ? T : never; -/** - * Check if a type is a record type. - */ -type IsRecord = T extends object ? string extends keyof T ? T : never : never; -/** - * Check if a type is a tuple. - */ -type IsTuple = T extends [ - any -] ? T : T extends [ - any, - any -] ? T : T extends [ - any, - any, - any -] ? T : T extends [ - any, - any, - any, - any -] ? T : T extends [ - any, - any, - any, - any, - any -] ? T : never; -/** - * Check if a type is a union. - */ -type IsUnion = (T extends any ? (U extends T ? false : true) : false) extends false ? never : T; -/** - * A schema for object structs. - */ -type ObjectSchema = Record>; -/** - * Infer a type from an object struct schema. - */ -type ObjectType = Simplify; -}>>; -/** - * Omit properties from a type that extend from a specific type. - */ -type OmitBy = Omit ? K : never; -}[keyof T]>; -/** - * Normalize properties of a type that allow `undefined` to make them optional. - */ -type Optionalize = OmitBy & Partial>; -/** - * Transform an object schema type to represent a partial. - */ -type PartialObjectSchema = { - [K in keyof S]: Struct | undefined>; -}; -/** - * Pick properties from a type that extend from a specific type. - */ -type PickBy = Pick ? K : never; -}[keyof T]>; -/** - * Simplifies a type definition to its most basic representation. - */ -type Simplify = T extends any[] | Date ? T : { - [K in keyof T]: T[K]; -} & {}; -/** - * A schema for any type of struct. - */ -type StructSchema = [ - T -] extends [ - string | undefined -] ? [ - T -] extends [ - IsMatch -] ? null : [ - T -] extends [ - IsUnion -] ? EnumSchema : T : [ - T -] extends [ - number | undefined -] ? [ - T -] extends [ - IsMatch -] ? null : [ - T -] extends [ - IsUnion -] ? EnumSchema : T : [ - T -] extends [ - boolean -] ? [ - T -] extends [ - IsExactMatch -] ? null : T : T extends bigint | symbol | undefined | null | Function | Date | Error | RegExp | Map | WeakMap | Set | WeakSet | Promise ? null : T extends Array ? T extends IsTuple ? null : Struct : T extends object ? T extends IsRecord ? null : { - [K in keyof T]: Describe; -} : null; -/** - * Shorthand type for matching any `Struct`. - */ -type AnyStruct = Struct; -/** - * Infer a tuple of types from a tuple of `Struct`s. - * - * This is used to recursively retrieve the type from `union` `intersection` and - * `tuple` structs. - */ -type InferStructTuple = Length extends Length ? number extends Length ? Tuple : _InferTuple : never; -type _InferTuple = Index extends Length ? Accumulated : _InferTuple -]>; -/** - * `Struct` objects encapsulate the validation logic for a specific type of - * values. Once constructed, you use the `assert`, `is` or `validate` helpers to - * validate unknown input data against the struct. - */ -declare class Struct { - readonly TYPE: T; - type: string; - schema: S; - coercer: (value: unknown, context: Context) => unknown; - validator: (value: unknown, context: Context) => Iterable; - refiner: (value: T, context: Context) => Iterable; - entries: (value: unknown, context: Context) => Iterable<[ - string | number, - unknown, - Struct | Struct - ]>; - constructor(props: { - type: string; - schema: S; - coercer?: Coercer; - validator?: Validator; - refiner?: Refiner; - entries?: Struct["entries"]; - }); - /** - * Assert that a value passes the struct's validation, throwing if it doesn't. - */ - assert(value: unknown): asserts value is T; - /** - * Create a value with the struct's coercion logic, then validate it. - */ - create(value: unknown): T; - /** - * Check if a value passes the struct's validation. - */ - is(value: unknown): value is T; - /** - * Mask a value, coercing and validating it, but returning only the subset of - * properties defined by the struct's schema. - */ - mask(value: unknown): T; - /** - * Validate a value with the struct's validation logic, returning a tuple - * representing the result. - * - * You may optionally pass `true` for the `withCoercion` argument to coerce - * the value before attempting to validate it. If you do, the result will - * contain the coerced result when successful. - */ - validate(value: unknown, options?: { - coerce?: boolean; - }): [ - StructError, - undefined - ] | [ - undefined, - T - ]; -} -/** - * Assert that a value passes a struct, throwing if it doesn't. - */ -declare function assert(value: unknown, struct: Struct): asserts value is T; -/** - * Create a value with the coercion logic of struct and validate it. - */ -declare function create(value: unknown, struct: Struct): T; -/** - * Mask a value, returning only the subset of properties defined by a struct. - */ -declare function mask(value: unknown, struct: Struct): T; -/** - * Check if a value passes a struct. - */ -declare function is(value: unknown, struct: Struct): value is T; -/** - * Validate a value against a struct, returning an error if invalid, or the - * value (with potential coercion) if valid. - */ -declare function validate(value: unknown, struct: Struct, options?: { - coerce?: boolean; - mask?: boolean; -}): [ - StructError, - undefined -] | [ - undefined, - T -]; -/** - * A `Context` contains information about the current location of the - * validation inside the initial input value. - */ -type Context = { - branch: Array; - path: Array; -}; -/** - * A type utility to extract the type from a `Struct` class. - */ -type Infer> = T["TYPE"]; -/** - * A type utility to describe that a struct represents a TypeScript type. - */ -type Describe = Struct>; -/** - * A `Result` is returned from validation functions. - */ -type Result = boolean | string | Partial | Iterable>; -/** - * A `Coercer` takes an unknown value and optionally coerces it. - */ -type Coercer = (value: T, context: Context) => unknown; -/** - * A `Validator` takes an unknown value and validates it. - */ -type Validator = (value: unknown, context: Context) => Result; -/** - * A `Refiner` takes a value of a known type and validates it against a further - * constraint. - */ -type Refiner = (value: T, context: Context) => Result; -/** - * Augment a `Struct` to add an additional coercion step to its input. - * - * This allows you to transform input data before validating it, to increase the - * likelihood that it passes validation—for example for default values, parsing - * different formats, etc. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ -declare function coerce(struct: Struct, condition: Struct, coercer: Coercer): Struct; -/** - * Augment a struct to replace `undefined` values with a default. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ -declare function defaulted(struct: Struct, fallback: any, options?: { - strict?: boolean; -}): Struct; -/** - * Augment a struct to trim string inputs. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ -declare function trimmed(struct: Struct): Struct; -/** - * Ensure that a string, array, map, or set is empty. - */ -declare function empty | Set, S extends any>(struct: Struct): Struct; -/** - * Ensure that a number or date is below a threshold. - */ -declare function max(struct: Struct, threshold: T, options?: { - exclusive?: boolean; -}): Struct; -/** - * Ensure that a number or date is above a threshold. - */ -declare function min(struct: Struct, threshold: T, options?: { - exclusive?: boolean; -}): Struct; -/** - * Ensure that a string, array, map or set is not empty. - */ -declare function nonempty | Set, S extends any>(struct: Struct): Struct; -/** - * Ensure that a string matches a regular expression. - */ -declare function pattern(struct: Struct, regexp: RegExp): Struct; -/** - * Ensure that a string, array, number, date, map, or set has a size (or length, or time) between `min` and `max`. - */ -declare function size | Set, S extends any>(struct: Struct, min: number, max?: number): Struct; -/** - * Augment a `Struct` to add an additional refinement to the validation. - * - * The refiner function is guaranteed to receive a value of the struct's type, - * because the struct's existing validation will already have passed. This - * allows you to layer additional validation on top of existing structs. - */ -declare function refine(struct: Struct, name: string, refiner: Refiner): Struct; -/** - * Ensure that any value passes validation. - */ -declare function any(): Struct; -/** - * Ensure that a value is an array and that its elements are of a specific type. - * - * Note: If you omit the element struct, the arrays elements will not be - * iterated at all. This can be helpful for cases where performance is critical, - * and it is preferred to using `array(any())`. - */ -declare function array>(Element: T): Struct[], T>; -declare function array(): Struct; -/** - * Ensure that a value is a bigint. - */ -declare function bigint(): Struct; -/** - * Ensure that a value is a boolean. - */ -declare function boolean(): Struct; -/** - * Ensure that a value is a valid `Date`. - * - * Note: this also ensures that the value is *not* an invalid `Date` object, - * which can occur when parsing a date fails but still returns a `Date`. - */ -declare function date(): Struct; -/** - * Ensure that a value is one of a set of potential values. - * - * Note: after creating the struct, you can access the definition of the - * potential values as `struct.schema`. - */ -declare function enums(values: T): Struct; -declare function enums(values: T): Struct; -/** - * Ensure that a value is a function. - */ -declare function func(): Struct; -/** - * Ensure that a value is an instance of a specific class. - */ -declare function instance(Class: T): Struct, null>; -/** - * Ensure that a value is an integer. - */ -declare function integer(): Struct; -/** - * Ensure that a value matches all of a set of types. - */ -declare function intersection(Structs: [ - A, - ...B -]): Struct & UnionToIntersection[number]>, null>; -/** - * Ensure that a value is an exact value, using `===` for comparison. - */ -declare function literal(constant: T): Struct; -declare function literal(constant: T): Struct; -declare function literal(constant: T): Struct; -declare function literal(constant: T): Struct; -/** - * Ensure that a value is a `Map` object, and that its keys and values are of - * specific types. - */ -declare function map(): Struct, null>; -declare function map(Key: Struct, Value: Struct): Struct, null>; -/** - * Ensure that no value ever passes validation. - */ -declare function never(): Struct; -/** - * Augment an existing struct to allow `null` values. - */ -declare function nullable(struct: Struct): Struct; -/** - * Ensure that a value is a number. - */ -declare function number(): Struct; -/** - * Ensure that a value is an object, that is has a known set of properties, - * and that its properties are of specific types. - * - * Note: Unrecognized properties will fail validation. - */ -declare function object(): Struct, null>; -declare function object(schema: S): Struct, S>; -/** - * Augment a struct to allow `undefined` values. - */ -declare function optional(struct: Struct): Struct; -/** - * Ensure that a value is an object with keys and values of specific types, but - * without ensuring any specific shape of properties. - * - * Like TypeScript's `Record` utility. - */ -declare function record(Key: Struct, Value: Struct): Struct, null>; -/** - * Ensure that a value is a `RegExp`. - * - * Note: this does not test the value against the regular expression! For that - * you need to use the `pattern()` refinement. - */ -declare function regexp(): Struct; -/** - * Ensure that a value is a `Set` object, and that its elements are of a - * specific type. - */ -declare function set(): Struct, null>; -declare function set(Element: Struct): Struct, null>; -/** - * Ensure that a value is a string. - */ -declare function string(): Struct; -/** - * Ensure that a value is a tuple of a specific length, and that each of its - * elements is of a specific type. - */ -declare function tuple(Structs: [ - A, - ...B -]): Struct<[ - Infer, - ...InferStructTuple -], null>; -/** - * Ensure that a value has a set of known properties of specific types. - * - * Note: Unrecognized properties are allowed and untouched. This is similar to - * how TypeScript's structural typing works. - */ -declare function type(schema: S): Struct, S>; -/** - * Ensure that a value matches one of a set of types. - */ -declare function union(Structs: [ - A, - ...B -]): Struct | InferStructTuple[number], null>; -/** - * Ensure that any value passes validation, without widening its type to `any`. - */ -declare function unknown(): Struct; -/** - * Create a new struct that combines the properties properties from multiple - * object or type structs. Its return type will match the first parameter's type. - * - * Like JavaScript's `Object.assign` utility. - */ -declare function assign(A: Struct, A>, B: Struct, B>): Struct>, Assign>; -declare function assign(A: Struct, A>, B: Struct, B>, C: Struct, C>): Struct, C>>, Assign, C>>; -declare function assign(A: Struct, A>, B: Struct, B>, C: Struct, C>, D: Struct, D>): Struct, C>, D>>, Assign, C>, D>>; -declare function assign(A: Struct, A>, B: Struct, B>, C: Struct, C>, D: Struct, D>, E: Struct, E>): Struct, C>, D>, E>>, Assign, C>, D>, E>>; -/** - * Define a new struct type with a custom validation function. - */ -declare function define(name: string, validator: Validator): Struct; -/** - * Create a new struct based on an existing struct, but the value is allowed to - * be `undefined`. `log` will be called if the value is not `undefined`. - */ -declare function deprecated(struct: Struct, log: (value: unknown, ctx: Context) => void): Struct; -/** - * Create a struct with dynamic validation logic. - * - * The callback will receive the value currently being validated, and must - * return a struct object to validate it with. This can be useful to model - * validation logic that changes based on its input. - */ -declare function dynamic(fn: (value: unknown, ctx: Context) => Struct): Struct; -/** - * Create a struct with lazily evaluated validation logic. - * - * The first time validation is run with the struct, the callback will be called - * and must return a struct object to use. This is useful for cases where you - * want to have self-referential structs for nested data structures to avoid a - * circular definition problem. - */ -declare function lazy(fn: () => Struct): Struct; -/** - * Create a new struct based on an existing object struct, but excluding - * specific properties. - * - * Like TypeScript's `Omit` utility. - */ -declare function omit(struct: Struct, S>, keys: K[]): Struct>, Omit>; -/** - * Create a new struct based on an existing object struct, but with all of its - * properties allowed to be `undefined`. - * - * Like TypeScript's `Partial` utility. - */ -declare function partial(struct: Struct, S> | S): Struct>, PartialObjectSchema>; -/** - * Create a new struct based on an existing object struct, but only including - * specific properties. - * - * Like TypeScript's `Pick` utility. - */ -declare function pick(struct: Struct, S>, keys: K[]): Struct>, Pick>; -/** - * Define a new struct type with a custom validation function. - * - * @deprecated This function has been renamed to `define`. - */ -declare function struct(name: string, validator: Validator): Struct; -export { Failure, StructError, Struct, assert, create, mask, is, validate, Context, Infer, Describe, Result, Coercer, Validator, Refiner, coerce, defaulted, trimmed, empty, max, min, nonempty, pattern, size, refine, any, array, bigint, boolean, date, enums, func, instance, integer, intersection, literal, map, never, nullable, number, object, optional, record, regexp, set, string, tuple, type, union, unknown, assign, define, deprecated, dynamic, lazy, omit, partial, pick, struct }; diff --git a/node_modules/superstruct/lib/index.d.mts b/node_modules/superstruct/lib/index.d.mts deleted file mode 100644 index 47dce3dff..000000000 --- a/node_modules/superstruct/lib/index.d.mts +++ /dev/null @@ -1,579 +0,0 @@ -/** - * A `StructFailure` represents a single specific failure in validation. - */ -type Failure = { - value: any; - key: any; - type: string; - refinement: string | undefined; - message: string; - branch: Array; - path: Array; -}; -/** - * `StructError` objects are thrown (or returned) when validation fails. - * - * Validation logic is design to exit early for maximum performance. The error - * represents the first error encountered during validation. For more detail, - * the `error.failures` property is a generator function that can be run to - * continue validation and receive all the failures in the data. - */ -declare class StructError extends TypeError { - value: any; - key: any; - type: string; - refinement: string | undefined; - path: Array; - branch: Array; - failures: () => Array; - [x: string]: any; - constructor(failure: Failure, failures: () => Generator); -} -/** - * Convert a union of type to an intersection. - */ -type UnionToIntersection = (U extends any ? (arg: U) => any : never) extends (arg: infer I) => void ? I : never; -/** - * Assign properties from one type to another, overwriting existing. - */ -type Assign = Simplify>; -/** - * A schema for enum structs. - */ -type EnumSchema = { - [K in NonNullable]: K; -}; -/** - * Check if a type is a match for another whilst treating overlapping - * unions as a match. - */ -type IsMatch = T extends G ? (G extends T ? T : never) : never; -/** - * Check if a type is an exact match. - */ -type IsExactMatch = (() => G extends T ? 1 : 2) extends () => G extends U ? 1 : 2 ? T : never; -/** - * Check if a type is a record type. - */ -type IsRecord = T extends object ? string extends keyof T ? T : never : never; -/** - * Check if a type is a tuple. - */ -type IsTuple = T extends [ - any -] ? T : T extends [ - any, - any -] ? T : T extends [ - any, - any, - any -] ? T : T extends [ - any, - any, - any, - any -] ? T : T extends [ - any, - any, - any, - any, - any -] ? T : never; -/** - * Check if a type is a union. - */ -type IsUnion = (T extends any ? (U extends T ? false : true) : false) extends false ? never : T; -/** - * A schema for object structs. - */ -type ObjectSchema = Record>; -/** - * Infer a type from an object struct schema. - */ -type ObjectType = Simplify; -}>>; -/** - * Omit properties from a type that extend from a specific type. - */ -type OmitBy = Omit ? K : never; -}[keyof T]>; -/** - * Normalize properties of a type that allow `undefined` to make them optional. - */ -type Optionalize = OmitBy & Partial>; -/** - * Transform an object schema type to represent a partial. - */ -type PartialObjectSchema = { - [K in keyof S]: Struct | undefined>; -}; -/** - * Pick properties from a type that extend from a specific type. - */ -type PickBy = Pick ? K : never; -}[keyof T]>; -/** - * Simplifies a type definition to its most basic representation. - */ -type Simplify = T extends any[] | Date ? T : { - [K in keyof T]: T[K]; -} & {}; -/** - * A schema for any type of struct. - */ -type StructSchema = [ - T -] extends [ - string | undefined -] ? [ - T -] extends [ - IsMatch -] ? null : [ - T -] extends [ - IsUnion -] ? EnumSchema : T : [ - T -] extends [ - number | undefined -] ? [ - T -] extends [ - IsMatch -] ? null : [ - T -] extends [ - IsUnion -] ? EnumSchema : T : [ - T -] extends [ - boolean -] ? [ - T -] extends [ - IsExactMatch -] ? null : T : T extends bigint | symbol | undefined | null | Function | Date | Error | RegExp | Map | WeakMap | Set | WeakSet | Promise ? null : T extends Array ? T extends IsTuple ? null : Struct : T extends object ? T extends IsRecord ? null : { - [K in keyof T]: Describe; -} : null; -/** - * Shorthand type for matching any `Struct`. - */ -type AnyStruct = Struct; -/** - * Infer a tuple of types from a tuple of `Struct`s. - * - * This is used to recursively retrieve the type from `union` `intersection` and - * `tuple` structs. - */ -type InferStructTuple = Length extends Length ? number extends Length ? Tuple : _InferTuple : never; -type _InferTuple = Index extends Length ? Accumulated : _InferTuple -]>; -/** - * `Struct` objects encapsulate the validation logic for a specific type of - * values. Once constructed, you use the `assert`, `is` or `validate` helpers to - * validate unknown input data against the struct. - */ -declare class Struct { - readonly TYPE: T; - type: string; - schema: S; - coercer: (value: unknown, context: Context) => unknown; - validator: (value: unknown, context: Context) => Iterable; - refiner: (value: T, context: Context) => Iterable; - entries: (value: unknown, context: Context) => Iterable<[ - string | number, - unknown, - Struct | Struct - ]>; - constructor(props: { - type: string; - schema: S; - coercer?: Coercer; - validator?: Validator; - refiner?: Refiner; - entries?: Struct["entries"]; - }); - /** - * Assert that a value passes the struct's validation, throwing if it doesn't. - */ - assert(value: unknown): asserts value is T; - /** - * Create a value with the struct's coercion logic, then validate it. - */ - create(value: unknown): T; - /** - * Check if a value passes the struct's validation. - */ - is(value: unknown): value is T; - /** - * Mask a value, coercing and validating it, but returning only the subset of - * properties defined by the struct's schema. - */ - mask(value: unknown): T; - /** - * Validate a value with the struct's validation logic, returning a tuple - * representing the result. - * - * You may optionally pass `true` for the `withCoercion` argument to coerce - * the value before attempting to validate it. If you do, the result will - * contain the coerced result when successful. - */ - validate(value: unknown, options?: { - coerce?: boolean; - }): [ - StructError, - undefined - ] | [ - undefined, - T - ]; -} -/** - * Assert that a value passes a struct, throwing if it doesn't. - */ -declare function assert(value: unknown, struct: Struct): asserts value is T; -/** - * Create a value with the coercion logic of struct and validate it. - */ -declare function create(value: unknown, struct: Struct): T; -/** - * Mask a value, returning only the subset of properties defined by a struct. - */ -declare function mask(value: unknown, struct: Struct): T; -/** - * Check if a value passes a struct. - */ -declare function is(value: unknown, struct: Struct): value is T; -/** - * Validate a value against a struct, returning an error if invalid, or the - * value (with potential coercion) if valid. - */ -declare function validate(value: unknown, struct: Struct, options?: { - coerce?: boolean; - mask?: boolean; -}): [ - StructError, - undefined -] | [ - undefined, - T -]; -/** - * A `Context` contains information about the current location of the - * validation inside the initial input value. - */ -type Context = { - branch: Array; - path: Array; -}; -/** - * A type utility to extract the type from a `Struct` class. - */ -type Infer> = T["TYPE"]; -/** - * A type utility to describe that a struct represents a TypeScript type. - */ -type Describe = Struct>; -/** - * A `Result` is returned from validation functions. - */ -type Result = boolean | string | Partial | Iterable>; -/** - * A `Coercer` takes an unknown value and optionally coerces it. - */ -type Coercer = (value: T, context: Context) => unknown; -/** - * A `Validator` takes an unknown value and validates it. - */ -type Validator = (value: unknown, context: Context) => Result; -/** - * A `Refiner` takes a value of a known type and validates it against a further - * constraint. - */ -type Refiner = (value: T, context: Context) => Result; -/** - * Augment a `Struct` to add an additional coercion step to its input. - * - * This allows you to transform input data before validating it, to increase the - * likelihood that it passes validation—for example for default values, parsing - * different formats, etc. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ -declare function coerce(struct: Struct, condition: Struct, coercer: Coercer): Struct; -/** - * Augment a struct to replace `undefined` values with a default. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ -declare function defaulted(struct: Struct, fallback: any, options?: { - strict?: boolean; -}): Struct; -/** - * Augment a struct to trim string inputs. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ -declare function trimmed(struct: Struct): Struct; -/** - * Ensure that a string, array, map, or set is empty. - */ -declare function empty | Set, S extends any>(struct: Struct): Struct; -/** - * Ensure that a number or date is below a threshold. - */ -declare function max(struct: Struct, threshold: T, options?: { - exclusive?: boolean; -}): Struct; -/** - * Ensure that a number or date is above a threshold. - */ -declare function min(struct: Struct, threshold: T, options?: { - exclusive?: boolean; -}): Struct; -/** - * Ensure that a string, array, map or set is not empty. - */ -declare function nonempty | Set, S extends any>(struct: Struct): Struct; -/** - * Ensure that a string matches a regular expression. - */ -declare function pattern(struct: Struct, regexp: RegExp): Struct; -/** - * Ensure that a string, array, number, date, map, or set has a size (or length, or time) between `min` and `max`. - */ -declare function size | Set, S extends any>(struct: Struct, min: number, max?: number): Struct; -/** - * Augment a `Struct` to add an additional refinement to the validation. - * - * The refiner function is guaranteed to receive a value of the struct's type, - * because the struct's existing validation will already have passed. This - * allows you to layer additional validation on top of existing structs. - */ -declare function refine(struct: Struct, name: string, refiner: Refiner): Struct; -/** - * Ensure that any value passes validation. - */ -declare function any(): Struct; -/** - * Ensure that a value is an array and that its elements are of a specific type. - * - * Note: If you omit the element struct, the arrays elements will not be - * iterated at all. This can be helpful for cases where performance is critical, - * and it is preferred to using `array(any())`. - */ -declare function array>(Element: T): Struct[], T>; -declare function array(): Struct; -/** - * Ensure that a value is a bigint. - */ -declare function bigint(): Struct; -/** - * Ensure that a value is a boolean. - */ -declare function boolean(): Struct; -/** - * Ensure that a value is a valid `Date`. - * - * Note: this also ensures that the value is *not* an invalid `Date` object, - * which can occur when parsing a date fails but still returns a `Date`. - */ -declare function date(): Struct; -/** - * Ensure that a value is one of a set of potential values. - * - * Note: after creating the struct, you can access the definition of the - * potential values as `struct.schema`. - */ -declare function enums(values: T): Struct; -declare function enums(values: T): Struct; -/** - * Ensure that a value is a function. - */ -declare function func(): Struct; -/** - * Ensure that a value is an instance of a specific class. - */ -declare function instance(Class: T): Struct, null>; -/** - * Ensure that a value is an integer. - */ -declare function integer(): Struct; -/** - * Ensure that a value matches all of a set of types. - */ -declare function intersection(Structs: [ - A, - ...B -]): Struct & UnionToIntersection[number]>, null>; -/** - * Ensure that a value is an exact value, using `===` for comparison. - */ -declare function literal(constant: T): Struct; -declare function literal(constant: T): Struct; -declare function literal(constant: T): Struct; -declare function literal(constant: T): Struct; -/** - * Ensure that a value is a `Map` object, and that its keys and values are of - * specific types. - */ -declare function map(): Struct, null>; -declare function map(Key: Struct, Value: Struct): Struct, null>; -/** - * Ensure that no value ever passes validation. - */ -declare function never(): Struct; -/** - * Augment an existing struct to allow `null` values. - */ -declare function nullable(struct: Struct): Struct; -/** - * Ensure that a value is a number. - */ -declare function number(): Struct; -/** - * Ensure that a value is an object, that is has a known set of properties, - * and that its properties are of specific types. - * - * Note: Unrecognized properties will fail validation. - */ -declare function object(): Struct, null>; -declare function object(schema: S): Struct, S>; -/** - * Augment a struct to allow `undefined` values. - */ -declare function optional(struct: Struct): Struct; -/** - * Ensure that a value is an object with keys and values of specific types, but - * without ensuring any specific shape of properties. - * - * Like TypeScript's `Record` utility. - */ -declare function record(Key: Struct, Value: Struct): Struct, null>; -/** - * Ensure that a value is a `RegExp`. - * - * Note: this does not test the value against the regular expression! For that - * you need to use the `pattern()` refinement. - */ -declare function regexp(): Struct; -/** - * Ensure that a value is a `Set` object, and that its elements are of a - * specific type. - */ -declare function set(): Struct, null>; -declare function set(Element: Struct): Struct, null>; -/** - * Ensure that a value is a string. - */ -declare function string(): Struct; -/** - * Ensure that a value is a tuple of a specific length, and that each of its - * elements is of a specific type. - */ -declare function tuple(Structs: [ - A, - ...B -]): Struct<[ - Infer, - ...InferStructTuple -], null>; -/** - * Ensure that a value has a set of known properties of specific types. - * - * Note: Unrecognized properties are allowed and untouched. This is similar to - * how TypeScript's structural typing works. - */ -declare function type(schema: S): Struct, S>; -/** - * Ensure that a value matches one of a set of types. - */ -declare function union(Structs: [ - A, - ...B -]): Struct | InferStructTuple[number], null>; -/** - * Ensure that any value passes validation, without widening its type to `any`. - */ -declare function unknown(): Struct; -/** - * Create a new struct that combines the properties properties from multiple - * object or type structs. Its return type will match the first parameter's type. - * - * Like JavaScript's `Object.assign` utility. - */ -declare function assign(A: Struct, A>, B: Struct, B>): Struct>, Assign>; -declare function assign(A: Struct, A>, B: Struct, B>, C: Struct, C>): Struct, C>>, Assign, C>>; -declare function assign(A: Struct, A>, B: Struct, B>, C: Struct, C>, D: Struct, D>): Struct, C>, D>>, Assign, C>, D>>; -declare function assign(A: Struct, A>, B: Struct, B>, C: Struct, C>, D: Struct, D>, E: Struct, E>): Struct, C>, D>, E>>, Assign, C>, D>, E>>; -/** - * Define a new struct type with a custom validation function. - */ -declare function define(name: string, validator: Validator): Struct; -/** - * Create a new struct based on an existing struct, but the value is allowed to - * be `undefined`. `log` will be called if the value is not `undefined`. - */ -declare function deprecated(struct: Struct, log: (value: unknown, ctx: Context) => void): Struct; -/** - * Create a struct with dynamic validation logic. - * - * The callback will receive the value currently being validated, and must - * return a struct object to validate it with. This can be useful to model - * validation logic that changes based on its input. - */ -declare function dynamic(fn: (value: unknown, ctx: Context) => Struct): Struct; -/** - * Create a struct with lazily evaluated validation logic. - * - * The first time validation is run with the struct, the callback will be called - * and must return a struct object to use. This is useful for cases where you - * want to have self-referential structs for nested data structures to avoid a - * circular definition problem. - */ -declare function lazy(fn: () => Struct): Struct; -/** - * Create a new struct based on an existing object struct, but excluding - * specific properties. - * - * Like TypeScript's `Omit` utility. - */ -declare function omit(struct: Struct, S>, keys: K[]): Struct>, Omit>; -/** - * Create a new struct based on an existing object struct, but with all of its - * properties allowed to be `undefined`. - * - * Like TypeScript's `Partial` utility. - */ -declare function partial(struct: Struct, S> | S): Struct>, PartialObjectSchema>; -/** - * Create a new struct based on an existing object struct, but only including - * specific properties. - * - * Like TypeScript's `Pick` utility. - */ -declare function pick(struct: Struct, S>, keys: K[]): Struct>, Pick>; -/** - * Define a new struct type with a custom validation function. - * - * @deprecated This function has been renamed to `define`. - */ -declare function struct(name: string, validator: Validator): Struct; -export { Failure, StructError, Struct, assert, create, mask, is, validate, Context, Infer, Describe, Result, Coercer, Validator, Refiner, coerce, defaulted, trimmed, empty, max, min, nonempty, pattern, size, refine, any, array, bigint, boolean, date, enums, func, instance, integer, intersection, literal, map, never, nullable, number, object, optional, record, regexp, set, string, tuple, type, union, unknown, assign, define, deprecated, dynamic, lazy, omit, partial, pick, struct }; diff --git a/node_modules/superstruct/lib/index.mjs b/node_modules/superstruct/lib/index.mjs deleted file mode 100644 index 83032e92e..000000000 --- a/node_modules/superstruct/lib/index.mjs +++ /dev/null @@ -1,1193 +0,0 @@ -/** - * A `StructFailure` represents a single specific failure in validation. - */ - -/** - * `StructError` objects are thrown (or returned) when validation fails. - * - * Validation logic is design to exit early for maximum performance. The error - * represents the first error encountered during validation. For more detail, - * the `error.failures` property is a generator function that can be run to - * continue validation and receive all the failures in the data. - */ -class StructError extends TypeError { - constructor(failure, failures) { - let cached; - const { - message, - ...rest - } = failure; - const { - path - } = failure; - const msg = path.length === 0 ? message : `At path: ${path.join('.')} -- ${message}`; - super(msg); - this.value = void 0; - this.key = void 0; - this.type = void 0; - this.refinement = void 0; - this.path = void 0; - this.branch = void 0; - this.failures = void 0; - Object.assign(this, rest); - this.name = this.constructor.name; - - this.failures = () => { - return cached ?? (cached = [failure, ...failures()]); - }; - } - -} - -/** - * Check if a value is an iterator. - */ -function isIterable(x) { - return isObject(x) && typeof x[Symbol.iterator] === 'function'; -} -/** - * Check if a value is a plain object. - */ - - -function isObject(x) { - return typeof x === 'object' && x != null; -} -/** - * Check if a value is a plain object. - */ - -function isPlainObject(x) { - if (Object.prototype.toString.call(x) !== '[object Object]') { - return false; - } - - const prototype = Object.getPrototypeOf(x); - return prototype === null || prototype === Object.prototype; -} -/** - * Return a value as a printable string. - */ - -function print(value) { - return typeof value === 'string' ? JSON.stringify(value) : `${value}`; -} -/** - * Shifts (removes and returns) the first value from the `input` iterator. - * Like `Array.prototype.shift()` but for an `Iterator`. - */ - -function shiftIterator(input) { - const { - done, - value - } = input.next(); - return done ? undefined : value; -} -/** - * Convert a single validation result to a failure. - */ - -function toFailure(result, context, struct, value) { - if (result === true) { - return; - } else if (result === false) { - result = {}; - } else if (typeof result === 'string') { - result = { - message: result - }; - } - - const { - path, - branch - } = context; - const { - type - } = struct; - const { - refinement, - message = `Expected a value of type \`${type}\`${refinement ? ` with refinement \`${refinement}\`` : ''}, but received: \`${print(value)}\`` - } = result; - return { - value, - type, - refinement, - key: path[path.length - 1], - path, - branch, - ...result, - message - }; -} -/** - * Convert a validation result to an iterable of failures. - */ - -function* toFailures(result, context, struct, value) { - if (!isIterable(result)) { - result = [result]; - } - - for (const r of result) { - const failure = toFailure(r, context, struct, value); - - if (failure) { - yield failure; - } - } -} -/** - * Check a value against a struct, traversing deeply into nested values, and - * returning an iterator of failures or success. - */ - -function* run(value, struct, options) { - if (options === void 0) { - options = {}; - } - - const { - path = [], - branch = [value], - coerce = false, - mask = false - } = options; - const ctx = { - path, - branch - }; - - if (coerce) { - value = struct.coercer(value, ctx); - - if (mask && struct.type !== 'type' && isObject(struct.schema) && isObject(value) && !Array.isArray(value)) { - for (const key in value) { - if (struct.schema[key] === undefined) { - delete value[key]; - } - } - } - } - - let status = 'valid'; - - for (const failure of struct.validator(value, ctx)) { - status = 'not_valid'; - yield [failure, undefined]; - } - - for (let [k, v, s] of struct.entries(value, ctx)) { - const ts = run(v, s, { - path: k === undefined ? path : [...path, k], - branch: k === undefined ? branch : [...branch, v], - coerce, - mask - }); - - for (const t of ts) { - if (t[0]) { - status = t[0].refinement != null ? 'not_refined' : 'not_valid'; - yield [t[0], undefined]; - } else if (coerce) { - v = t[1]; - - if (k === undefined) { - value = v; - } else if (value instanceof Map) { - value.set(k, v); - } else if (value instanceof Set) { - value.add(v); - } else if (isObject(value)) { - if (v !== undefined) value[k] = v; - } - } - } - } - - if (status !== 'not_valid') { - for (const failure of struct.refiner(value, ctx)) { - status = 'not_refined'; - yield [failure, undefined]; - } - } - - if (status === 'valid') { - yield [undefined, value]; - } -} - -/** - * `Struct` objects encapsulate the validation logic for a specific type of - * values. Once constructed, you use the `assert`, `is` or `validate` helpers to - * validate unknown input data against the struct. - */ - -class Struct { - constructor(props) { - this.TYPE = void 0; - this.type = void 0; - this.schema = void 0; - this.coercer = void 0; - this.validator = void 0; - this.refiner = void 0; - this.entries = void 0; - const { - type, - schema, - validator, - refiner, - coercer = value => value, - entries = function* () {} - } = props; - this.type = type; - this.schema = schema; - this.entries = entries; - this.coercer = coercer; - - if (validator) { - this.validator = (value, context) => { - const result = validator(value, context); - return toFailures(result, context, this, value); - }; - } else { - this.validator = () => []; - } - - if (refiner) { - this.refiner = (value, context) => { - const result = refiner(value, context); - return toFailures(result, context, this, value); - }; - } else { - this.refiner = () => []; - } - } - /** - * Assert that a value passes the struct's validation, throwing if it doesn't. - */ - - - assert(value) { - return assert(value, this); - } - /** - * Create a value with the struct's coercion logic, then validate it. - */ - - - create(value) { - return create(value, this); - } - /** - * Check if a value passes the struct's validation. - */ - - - is(value) { - return is(value, this); - } - /** - * Mask a value, coercing and validating it, but returning only the subset of - * properties defined by the struct's schema. - */ - - - mask(value) { - return mask(value, this); - } - /** - * Validate a value with the struct's validation logic, returning a tuple - * representing the result. - * - * You may optionally pass `true` for the `withCoercion` argument to coerce - * the value before attempting to validate it. If you do, the result will - * contain the coerced result when successful. - */ - - - validate(value, options) { - if (options === void 0) { - options = {}; - } - - return validate(value, this, options); - } - -} -/** - * Assert that a value passes a struct, throwing if it doesn't. - */ - -function assert(value, struct) { - const result = validate(value, struct); - - if (result[0]) { - throw result[0]; - } -} -/** - * Create a value with the coercion logic of struct and validate it. - */ - -function create(value, struct) { - const result = validate(value, struct, { - coerce: true - }); - - if (result[0]) { - throw result[0]; - } else { - return result[1]; - } -} -/** - * Mask a value, returning only the subset of properties defined by a struct. - */ - -function mask(value, struct) { - const result = validate(value, struct, { - coerce: true, - mask: true - }); - - if (result[0]) { - throw result[0]; - } else { - return result[1]; - } -} -/** - * Check if a value passes a struct. - */ - -function is(value, struct) { - const result = validate(value, struct); - return !result[0]; -} -/** - * Validate a value against a struct, returning an error if invalid, or the - * value (with potential coercion) if valid. - */ - -function validate(value, struct, options) { - if (options === void 0) { - options = {}; - } - - const tuples = run(value, struct, options); - const tuple = shiftIterator(tuples); - - if (tuple[0]) { - const error = new StructError(tuple[0], function* () { - for (const t of tuples) { - if (t[0]) { - yield t[0]; - } - } - }); - return [error, undefined]; - } else { - const v = tuple[1]; - return [undefined, v]; - } -} - -function assign() { - for (var _len = arguments.length, Structs = new Array(_len), _key = 0; _key < _len; _key++) { - Structs[_key] = arguments[_key]; - } - - const isType = Structs[0].type === 'type'; - const schemas = Structs.map(s => s.schema); - const schema = Object.assign({}, ...schemas); - return isType ? type(schema) : object(schema); -} -/** - * Define a new struct type with a custom validation function. - */ - -function define(name, validator) { - return new Struct({ - type: name, - schema: null, - validator - }); -} -/** - * Create a new struct based on an existing struct, but the value is allowed to - * be `undefined`. `log` will be called if the value is not `undefined`. - */ - -function deprecated(struct, log) { - return new Struct({ ...struct, - refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx), - - validator(value, ctx) { - if (value === undefined) { - return true; - } else { - log(value, ctx); - return struct.validator(value, ctx); - } - } - - }); -} -/** - * Create a struct with dynamic validation logic. - * - * The callback will receive the value currently being validated, and must - * return a struct object to validate it with. This can be useful to model - * validation logic that changes based on its input. - */ - -function dynamic(fn) { - return new Struct({ - type: 'dynamic', - schema: null, - - *entries(value, ctx) { - const struct = fn(value, ctx); - yield* struct.entries(value, ctx); - }, - - validator(value, ctx) { - const struct = fn(value, ctx); - return struct.validator(value, ctx); - }, - - coercer(value, ctx) { - const struct = fn(value, ctx); - return struct.coercer(value, ctx); - }, - - refiner(value, ctx) { - const struct = fn(value, ctx); - return struct.refiner(value, ctx); - } - - }); -} -/** - * Create a struct with lazily evaluated validation logic. - * - * The first time validation is run with the struct, the callback will be called - * and must return a struct object to use. This is useful for cases where you - * want to have self-referential structs for nested data structures to avoid a - * circular definition problem. - */ - -function lazy(fn) { - let struct; - return new Struct({ - type: 'lazy', - schema: null, - - *entries(value, ctx) { - struct ?? (struct = fn()); - yield* struct.entries(value, ctx); - }, - - validator(value, ctx) { - struct ?? (struct = fn()); - return struct.validator(value, ctx); - }, - - coercer(value, ctx) { - struct ?? (struct = fn()); - return struct.coercer(value, ctx); - }, - - refiner(value, ctx) { - struct ?? (struct = fn()); - return struct.refiner(value, ctx); - } - - }); -} -/** - * Create a new struct based on an existing object struct, but excluding - * specific properties. - * - * Like TypeScript's `Omit` utility. - */ - -function omit(struct, keys) { - const { - schema - } = struct; - const subschema = { ...schema - }; - - for (const key of keys) { - delete subschema[key]; - } - - switch (struct.type) { - case 'type': - return type(subschema); - - default: - return object(subschema); - } -} -/** - * Create a new struct based on an existing object struct, but with all of its - * properties allowed to be `undefined`. - * - * Like TypeScript's `Partial` utility. - */ - -function partial(struct) { - const schema = struct instanceof Struct ? { ...struct.schema - } : { ...struct - }; - - for (const key in schema) { - schema[key] = optional(schema[key]); - } - - return object(schema); -} -/** - * Create a new struct based on an existing object struct, but only including - * specific properties. - * - * Like TypeScript's `Pick` utility. - */ - -function pick(struct, keys) { - const { - schema - } = struct; - const subschema = {}; - - for (const key of keys) { - subschema[key] = schema[key]; - } - - return object(subschema); -} -/** - * Define a new struct type with a custom validation function. - * - * @deprecated This function has been renamed to `define`. - */ - -function struct(name, validator) { - console.warn('superstruct@0.11 - The `struct` helper has been renamed to `define`.'); - return define(name, validator); -} - -/** - * Ensure that any value passes validation. - */ - -function any() { - return define('any', () => true); -} -function array(Element) { - return new Struct({ - type: 'array', - schema: Element, - - *entries(value) { - if (Element && Array.isArray(value)) { - for (const [i, v] of value.entries()) { - yield [i, v, Element]; - } - } - }, - - coercer(value) { - return Array.isArray(value) ? value.slice() : value; - }, - - validator(value) { - return Array.isArray(value) || `Expected an array value, but received: ${print(value)}`; - } - - }); -} -/** - * Ensure that a value is a bigint. - */ - -function bigint() { - return define('bigint', value => { - return typeof value === 'bigint'; - }); -} -/** - * Ensure that a value is a boolean. - */ - -function boolean() { - return define('boolean', value => { - return typeof value === 'boolean'; - }); -} -/** - * Ensure that a value is a valid `Date`. - * - * Note: this also ensures that the value is *not* an invalid `Date` object, - * which can occur when parsing a date fails but still returns a `Date`. - */ - -function date() { - return define('date', value => { - return value instanceof Date && !isNaN(value.getTime()) || `Expected a valid \`Date\` object, but received: ${print(value)}`; - }); -} -function enums(values) { - const schema = {}; - const description = values.map(v => print(v)).join(); - - for (const key of values) { - schema[key] = key; - } - - return new Struct({ - type: 'enums', - schema, - - validator(value) { - return values.includes(value) || `Expected one of \`${description}\`, but received: ${print(value)}`; - } - - }); -} -/** - * Ensure that a value is a function. - */ - -function func() { - return define('func', value => { - return typeof value === 'function' || `Expected a function, but received: ${print(value)}`; - }); -} -/** - * Ensure that a value is an instance of a specific class. - */ - -function instance(Class) { - return define('instance', value => { - return value instanceof Class || `Expected a \`${Class.name}\` instance, but received: ${print(value)}`; - }); -} -/** - * Ensure that a value is an integer. - */ - -function integer() { - return define('integer', value => { - return typeof value === 'number' && !isNaN(value) && Number.isInteger(value) || `Expected an integer, but received: ${print(value)}`; - }); -} -/** - * Ensure that a value matches all of a set of types. - */ - -function intersection(Structs) { - return new Struct({ - type: 'intersection', - schema: null, - - *entries(value, ctx) { - for (const S of Structs) { - yield* S.entries(value, ctx); - } - }, - - *validator(value, ctx) { - for (const S of Structs) { - yield* S.validator(value, ctx); - } - }, - - *refiner(value, ctx) { - for (const S of Structs) { - yield* S.refiner(value, ctx); - } - } - - }); -} -function literal(constant) { - const description = print(constant); - const t = typeof constant; - return new Struct({ - type: 'literal', - schema: t === 'string' || t === 'number' || t === 'boolean' ? constant : null, - - validator(value) { - return value === constant || `Expected the literal \`${description}\`, but received: ${print(value)}`; - } - - }); -} -function map(Key, Value) { - return new Struct({ - type: 'map', - schema: null, - - *entries(value) { - if (Key && Value && value instanceof Map) { - for (const [k, v] of value.entries()) { - yield [k, k, Key]; - yield [k, v, Value]; - } - } - }, - - coercer(value) { - return value instanceof Map ? new Map(value) : value; - }, - - validator(value) { - return value instanceof Map || `Expected a \`Map\` object, but received: ${print(value)}`; - } - - }); -} -/** - * Ensure that no value ever passes validation. - */ - -function never() { - return define('never', () => false); -} -/** - * Augment an existing struct to allow `null` values. - */ - -function nullable(struct) { - return new Struct({ ...struct, - validator: (value, ctx) => value === null || struct.validator(value, ctx), - refiner: (value, ctx) => value === null || struct.refiner(value, ctx) - }); -} -/** - * Ensure that a value is a number. - */ - -function number() { - return define('number', value => { - return typeof value === 'number' && !isNaN(value) || `Expected a number, but received: ${print(value)}`; - }); -} -function object(schema) { - const knowns = schema ? Object.keys(schema) : []; - const Never = never(); - return new Struct({ - type: 'object', - schema: schema ? schema : null, - - *entries(value) { - if (schema && isObject(value)) { - const unknowns = new Set(Object.keys(value)); - - for (const key of knowns) { - unknowns.delete(key); - yield [key, value[key], schema[key]]; - } - - for (const key of unknowns) { - yield [key, value[key], Never]; - } - } - }, - - validator(value) { - return isObject(value) || `Expected an object, but received: ${print(value)}`; - }, - - coercer(value) { - return isObject(value) ? { ...value - } : value; - } - - }); -} -/** - * Augment a struct to allow `undefined` values. - */ - -function optional(struct) { - return new Struct({ ...struct, - validator: (value, ctx) => value === undefined || struct.validator(value, ctx), - refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx) - }); -} -/** - * Ensure that a value is an object with keys and values of specific types, but - * without ensuring any specific shape of properties. - * - * Like TypeScript's `Record` utility. - */ - -function record(Key, Value) { - return new Struct({ - type: 'record', - schema: null, - - *entries(value) { - if (isObject(value)) { - for (const k in value) { - const v = value[k]; - yield [k, k, Key]; - yield [k, v, Value]; - } - } - }, - - validator(value) { - return isObject(value) || `Expected an object, but received: ${print(value)}`; - } - - }); -} -/** - * Ensure that a value is a `RegExp`. - * - * Note: this does not test the value against the regular expression! For that - * you need to use the `pattern()` refinement. - */ - -function regexp() { - return define('regexp', value => { - return value instanceof RegExp; - }); -} -function set(Element) { - return new Struct({ - type: 'set', - schema: null, - - *entries(value) { - if (Element && value instanceof Set) { - for (const v of value) { - yield [v, v, Element]; - } - } - }, - - coercer(value) { - return value instanceof Set ? new Set(value) : value; - }, - - validator(value) { - return value instanceof Set || `Expected a \`Set\` object, but received: ${print(value)}`; - } - - }); -} -/** - * Ensure that a value is a string. - */ - -function string() { - return define('string', value => { - return typeof value === 'string' || `Expected a string, but received: ${print(value)}`; - }); -} -/** - * Ensure that a value is a tuple of a specific length, and that each of its - * elements is of a specific type. - */ - -function tuple(Structs) { - const Never = never(); - return new Struct({ - type: 'tuple', - schema: null, - - *entries(value) { - if (Array.isArray(value)) { - const length = Math.max(Structs.length, value.length); - - for (let i = 0; i < length; i++) { - yield [i, value[i], Structs[i] || Never]; - } - } - }, - - validator(value) { - return Array.isArray(value) || `Expected an array, but received: ${print(value)}`; - } - - }); -} -/** - * Ensure that a value has a set of known properties of specific types. - * - * Note: Unrecognized properties are allowed and untouched. This is similar to - * how TypeScript's structural typing works. - */ - -function type(schema) { - const keys = Object.keys(schema); - return new Struct({ - type: 'type', - schema, - - *entries(value) { - if (isObject(value)) { - for (const k of keys) { - yield [k, value[k], schema[k]]; - } - } - }, - - validator(value) { - return isObject(value) || `Expected an object, but received: ${print(value)}`; - } - - }); -} -/** - * Ensure that a value matches one of a set of types. - */ - -function union(Structs) { - const description = Structs.map(s => s.type).join(' | '); - return new Struct({ - type: 'union', - schema: null, - - coercer(value, ctx) { - const firstMatch = Structs.find(s => { - const [e] = s.validate(value, { - coerce: true - }); - return !e; - }) || unknown(); - return firstMatch.coercer(value, ctx); - }, - - validator(value, ctx) { - const failures = []; - - for (const S of Structs) { - const [...tuples] = run(value, S, ctx); - const [first] = tuples; - - if (!first[0]) { - return []; - } else { - for (const [failure] of tuples) { - if (failure) { - failures.push(failure); - } - } - } - } - - return [`Expected the value to satisfy a union of \`${description}\`, but received: ${print(value)}`, ...failures]; - } - - }); -} -/** - * Ensure that any value passes validation, without widening its type to `any`. - */ - -function unknown() { - return define('unknown', () => true); -} - -/** - * Augment a `Struct` to add an additional coercion step to its input. - * - * This allows you to transform input data before validating it, to increase the - * likelihood that it passes validation—for example for default values, parsing - * different formats, etc. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ - -function coerce(struct, condition, coercer) { - return new Struct({ ...struct, - coercer: (value, ctx) => { - return is(value, condition) ? struct.coercer(coercer(value, ctx), ctx) : struct.coercer(value, ctx); - } - }); -} -/** - * Augment a struct to replace `undefined` values with a default. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ - -function defaulted(struct, fallback, options) { - if (options === void 0) { - options = {}; - } - - return coerce(struct, unknown(), x => { - const f = typeof fallback === 'function' ? fallback() : fallback; - - if (x === undefined) { - return f; - } - - if (!options.strict && isPlainObject(x) && isPlainObject(f)) { - const ret = { ...x - }; - let changed = false; - - for (const key in f) { - if (ret[key] === undefined) { - ret[key] = f[key]; - changed = true; - } - } - - if (changed) { - return ret; - } - } - - return x; - }); -} -/** - * Augment a struct to trim string inputs. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ - -function trimmed(struct) { - return coerce(struct, string(), x => x.trim()); -} - -/** - * Ensure that a string, array, map, or set is empty. - */ - -function empty(struct) { - return refine(struct, 'empty', value => { - const size = getSize(value); - return size === 0 || `Expected an empty ${struct.type} but received one with a size of \`${size}\``; - }); -} - -function getSize(value) { - if (value instanceof Map || value instanceof Set) { - return value.size; - } else { - return value.length; - } -} -/** - * Ensure that a number or date is below a threshold. - */ - - -function max(struct, threshold, options) { - if (options === void 0) { - options = {}; - } - - const { - exclusive - } = options; - return refine(struct, 'max', value => { - return exclusive ? value < threshold : value <= threshold || `Expected a ${struct.type} less than ${exclusive ? '' : 'or equal to '}${threshold} but received \`${value}\``; - }); -} -/** - * Ensure that a number or date is above a threshold. - */ - -function min(struct, threshold, options) { - if (options === void 0) { - options = {}; - } - - const { - exclusive - } = options; - return refine(struct, 'min', value => { - return exclusive ? value > threshold : value >= threshold || `Expected a ${struct.type} greater than ${exclusive ? '' : 'or equal to '}${threshold} but received \`${value}\``; - }); -} -/** - * Ensure that a string, array, map or set is not empty. - */ - -function nonempty(struct) { - return refine(struct, 'nonempty', value => { - const size = getSize(value); - return size > 0 || `Expected a nonempty ${struct.type} but received an empty one`; - }); -} -/** - * Ensure that a string matches a regular expression. - */ - -function pattern(struct, regexp) { - return refine(struct, 'pattern', value => { - return regexp.test(value) || `Expected a ${struct.type} matching \`/${regexp.source}/\` but received "${value}"`; - }); -} -/** - * Ensure that a string, array, number, date, map, or set has a size (or length, or time) between `min` and `max`. - */ - -function size(struct, min, max) { - if (max === void 0) { - max = min; - } - - const expected = `Expected a ${struct.type}`; - const of = min === max ? `of \`${min}\`` : `between \`${min}\` and \`${max}\``; - return refine(struct, 'size', value => { - if (typeof value === 'number' || value instanceof Date) { - return min <= value && value <= max || `${expected} ${of} but received \`${value}\``; - } else if (value instanceof Map || value instanceof Set) { - const { - size - } = value; - return min <= size && size <= max || `${expected} with a size ${of} but received one with a size of \`${size}\``; - } else { - const { - length - } = value; - return min <= length && length <= max || `${expected} with a length ${of} but received one with a length of \`${length}\``; - } - }); -} -/** - * Augment a `Struct` to add an additional refinement to the validation. - * - * The refiner function is guaranteed to receive a value of the struct's type, - * because the struct's existing validation will already have passed. This - * allows you to layer additional validation on top of existing structs. - */ - -function refine(struct, name, refiner) { - return new Struct({ ...struct, - - *refiner(value, ctx) { - yield* struct.refiner(value, ctx); - const result = refiner(value, ctx); - const failures = toFailures(result, ctx, struct, value); - - for (const failure of failures) { - yield { ...failure, - refinement: name - }; - } - } - - }); -} - -export { Struct, StructError, any, array, assert, assign, bigint, boolean, coerce, create, date, defaulted, define, deprecated, dynamic, empty, enums, func, instance, integer, intersection, is, lazy, literal, map, mask, max, min, never, nonempty, nullable, number, object, omit, optional, partial, pattern, pick, record, refine, regexp, set, size, string, struct, trimmed, tuple, type, union, unknown, validate }; -//# sourceMappingURL=index.mjs.map diff --git a/node_modules/superstruct/lib/index.mjs.map b/node_modules/superstruct/lib/index.mjs.map deleted file mode 100644 index 19e7d3eb1..000000000 --- a/node_modules/superstruct/lib/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../src/error.ts","../src/utils.ts","../src/struct.ts","../src/structs/utilities.ts","../src/structs/types.ts","../src/structs/coercions.ts","../src/structs/refinements.ts"],"sourcesContent":["/**\n * A `StructFailure` represents a single specific failure in validation.\n */\n\nexport type Failure = {\n value: any\n key: any\n type: string\n refinement: string | undefined\n message: string\n branch: Array\n path: Array\n}\n\n/**\n * `StructError` objects are thrown (or returned) when validation fails.\n *\n * Validation logic is design to exit early for maximum performance. The error\n * represents the first error encountered during validation. For more detail,\n * the `error.failures` property is a generator function that can be run to\n * continue validation and receive all the failures in the data.\n */\n\nexport class StructError extends TypeError {\n value: any\n key!: any\n type!: string\n refinement!: string | undefined\n path!: Array\n branch!: Array\n failures: () => Array;\n [x: string]: any\n\n constructor(failure: Failure, failures: () => Generator) {\n let cached: Array | undefined\n const { message, ...rest } = failure\n const { path } = failure\n const msg =\n path.length === 0 ? message : `At path: ${path.join('.')} -- ${message}`\n super(msg)\n Object.assign(this, rest)\n this.name = this.constructor.name\n this.failures = () => {\n return (cached ??= [failure, ...failures()])\n }\n }\n}\n","import { Struct, Infer, Result, Context, Describe } from './struct'\nimport { Failure } from './error'\n\n/**\n * Check if a value is an iterator.\n */\n\nfunction isIterable(x: unknown): x is Iterable {\n return isObject(x) && typeof x[Symbol.iterator] === 'function'\n}\n\n/**\n * Check if a value is a plain object.\n */\n\nexport function isObject(x: unknown): x is object {\n return typeof x === 'object' && x != null\n}\n\n/**\n * Check if a value is a plain object.\n */\n\nexport function isPlainObject(x: unknown): x is { [key: string]: any } {\n if (Object.prototype.toString.call(x) !== '[object Object]') {\n return false\n }\n\n const prototype = Object.getPrototypeOf(x)\n return prototype === null || prototype === Object.prototype\n}\n\n/**\n * Return a value as a printable string.\n */\n\nexport function print(value: any): string {\n return typeof value === 'string' ? JSON.stringify(value) : `${value}`\n}\n\n/**\n * Shifts (removes and returns) the first value from the `input` iterator.\n * Like `Array.prototype.shift()` but for an `Iterator`.\n */\n\nexport function shiftIterator(input: Iterator): T | undefined {\n const { done, value } = input.next()\n return done ? undefined : value\n}\n\n/**\n * Convert a single validation result to a failure.\n */\n\nexport function toFailure(\n result: string | boolean | Partial,\n context: Context,\n struct: Struct,\n value: any\n): Failure | undefined {\n if (result === true) {\n return\n } else if (result === false) {\n result = {}\n } else if (typeof result === 'string') {\n result = { message: result }\n }\n\n const { path, branch } = context\n const { type } = struct\n const {\n refinement,\n message = `Expected a value of type \\`${type}\\`${\n refinement ? ` with refinement \\`${refinement}\\`` : ''\n }, but received: \\`${print(value)}\\``,\n } = result\n\n return {\n value,\n type,\n refinement,\n key: path[path.length - 1],\n path,\n branch,\n ...result,\n message,\n }\n}\n\n/**\n * Convert a validation result to an iterable of failures.\n */\n\nexport function* toFailures(\n result: Result,\n context: Context,\n struct: Struct,\n value: any\n): IterableIterator {\n if (!isIterable(result)) {\n result = [result]\n }\n\n for (const r of result) {\n const failure = toFailure(r, context, struct, value)\n\n if (failure) {\n yield failure\n }\n }\n}\n\n/**\n * Check a value against a struct, traversing deeply into nested values, and\n * returning an iterator of failures or success.\n */\n\nexport function* run(\n value: unknown,\n struct: Struct,\n options: {\n path?: any[]\n branch?: any[]\n coerce?: boolean\n mask?: boolean\n } = {}\n): IterableIterator<[Failure, undefined] | [undefined, T]> {\n const { path = [], branch = [value], coerce = false, mask = false } = options\n const ctx: Context = { path, branch }\n\n if (coerce) {\n value = struct.coercer(value, ctx)\n\n if (\n mask &&\n struct.type !== 'type' &&\n isObject(struct.schema) &&\n isObject(value) &&\n !Array.isArray(value)\n ) {\n for (const key in value) {\n if (struct.schema[key] === undefined) {\n delete value[key]\n }\n }\n }\n }\n\n let status: 'valid' | 'not_refined' | 'not_valid' = 'valid'\n\n for (const failure of struct.validator(value, ctx)) {\n status = 'not_valid'\n yield [failure, undefined]\n }\n\n for (let [k, v, s] of struct.entries(value, ctx)) {\n const ts = run(v, s as Struct, {\n path: k === undefined ? path : [...path, k],\n branch: k === undefined ? branch : [...branch, v],\n coerce,\n mask,\n })\n\n for (const t of ts) {\n if (t[0]) {\n status = t[0].refinement != null ? 'not_refined' : 'not_valid'\n yield [t[0], undefined]\n } else if (coerce) {\n v = t[1]\n\n if (k === undefined) {\n value = v\n } else if (value instanceof Map) {\n value.set(k, v)\n } else if (value instanceof Set) {\n value.add(v)\n } else if (isObject(value)) {\n if (v !== undefined) value[k] = v\n }\n }\n }\n }\n\n if (status !== 'not_valid') {\n for (const failure of struct.refiner(value as T, ctx)) {\n status = 'not_refined'\n yield [failure, undefined]\n }\n }\n\n if (status === 'valid') {\n yield [undefined, value as T]\n }\n}\n\n/**\n * Convert a union of type to an intersection.\n */\n\nexport type UnionToIntersection = (\n U extends any ? (arg: U) => any : never\n) extends (arg: infer I) => void\n ? I\n : never\n\n/**\n * Assign properties from one type to another, overwriting existing.\n */\n\nexport type Assign = Simplify>\n\n/**\n * A schema for enum structs.\n */\n\nexport type EnumSchema = {\n [K in NonNullable]: K\n}\n\n/**\n * Check if a type is a match for another whilst treating overlapping\n * unions as a match.\n */\n\nexport type IsMatch = T extends G ? (G extends T ? T : never) : never\n\n/**\n * Check if a type is an exact match.\n */\n\nexport type IsExactMatch = (() => G extends T ? 1 : 2) extends <\n G\n>() => G extends U ? 1 : 2\n ? T\n : never\n\n/**\n * Check if a type is a record type.\n */\n\nexport type IsRecord = T extends object\n ? string extends keyof T\n ? T\n : never\n : never\n/**\n * Check if a type is a tuple.\n */\n\nexport type IsTuple = T extends [any]\n ? T\n : T extends [any, any]\n ? T\n : T extends [any, any, any]\n ? T\n : T extends [any, any, any, any]\n ? T\n : T extends [any, any, any, any, any]\n ? T\n : never\n\n/**\n * Check if a type is a union.\n */\n\nexport type IsUnion = (\n T extends any ? (U extends T ? false : true) : false\n) extends false\n ? never\n : T\n\n/**\n * A schema for object structs.\n */\n\nexport type ObjectSchema = Record>\n\n/**\n * Infer a type from an object struct schema.\n */\n\nexport type ObjectType = Simplify<\n Optionalize<{ [K in keyof S]: Infer }>\n>\n\n/**\n * Omit properties from a type that extend from a specific type.\n */\n\nexport type OmitBy = Omit<\n T,\n { [K in keyof T]: V extends Extract ? K : never }[keyof T]\n>\n\n/**\n * Normalize properties of a type that allow `undefined` to make them optional.\n */\n\nexport type Optionalize = OmitBy &\n Partial>\n\n/**\n * Transform an object schema type to represent a partial.\n */\n\nexport type PartialObjectSchema = {\n [K in keyof S]: Struct | undefined>\n}\n\n/**\n * Pick properties from a type that extend from a specific type.\n */\n\nexport type PickBy = Pick<\n T,\n { [K in keyof T]: V extends Extract ? K : never }[keyof T]\n>\n\n/**\n * Simplifies a type definition to its most basic representation.\n */\n\nexport type Simplify = T extends any[] | Date\n ? T\n : { [K in keyof T]: T[K] } & {}\n\nexport type If = B extends true ? Then : Else\n\n/**\n * A schema for any type of struct.\n */\n\nexport type StructSchema = [T] extends [string | undefined]\n ? [T] extends [IsMatch]\n ? null\n : [T] extends [IsUnion]\n ? EnumSchema\n : T\n : [T] extends [number | undefined]\n ? [T] extends [IsMatch]\n ? null\n : [T] extends [IsUnion]\n ? EnumSchema\n : T\n : [T] extends [boolean]\n ? [T] extends [IsExactMatch]\n ? null\n : T\n : T extends\n | bigint\n | symbol\n | undefined\n | null\n | Function\n | Date\n | Error\n | RegExp\n | Map\n | WeakMap\n | Set\n | WeakSet\n | Promise\n ? null\n : T extends Array\n ? T extends IsTuple\n ? null\n : Struct\n : T extends object\n ? T extends IsRecord\n ? null\n : { [K in keyof T]: Describe }\n : null\n\n/**\n * A schema for tuple structs.\n */\n\nexport type TupleSchema = { [K in keyof T]: Struct }\n\n/**\n * Shorthand type for matching any `Struct`.\n */\n\nexport type AnyStruct = Struct\n\n/**\n * Infer a tuple of types from a tuple of `Struct`s.\n *\n * This is used to recursively retrieve the type from `union` `intersection` and\n * `tuple` structs.\n */\n\nexport type InferStructTuple<\n Tuple extends AnyStruct[],\n Length extends number = Tuple['length']\n> = Length extends Length\n ? number extends Length\n ? Tuple\n : _InferTuple\n : never\ntype _InferTuple<\n Tuple extends AnyStruct[],\n Length extends number,\n Accumulated extends unknown[],\n Index extends number = Accumulated['length']\n> = Index extends Length\n ? Accumulated\n : _InferTuple]>\n","import { toFailures, shiftIterator, StructSchema, run } from './utils'\nimport { StructError, Failure } from './error'\n\n/**\n * `Struct` objects encapsulate the validation logic for a specific type of\n * values. Once constructed, you use the `assert`, `is` or `validate` helpers to\n * validate unknown input data against the struct.\n */\n\nexport class Struct {\n readonly TYPE!: T\n type: string\n schema: S\n coercer: (value: unknown, context: Context) => unknown\n validator: (value: unknown, context: Context) => Iterable\n refiner: (value: T, context: Context) => Iterable\n entries: (\n value: unknown,\n context: Context\n ) => Iterable<[string | number, unknown, Struct | Struct]>\n\n constructor(props: {\n type: string\n schema: S\n coercer?: Coercer\n validator?: Validator\n refiner?: Refiner\n entries?: Struct['entries']\n }) {\n const {\n type,\n schema,\n validator,\n refiner,\n coercer = (value: unknown) => value,\n entries = function* () {},\n } = props\n\n this.type = type\n this.schema = schema\n this.entries = entries\n this.coercer = coercer\n\n if (validator) {\n this.validator = (value, context) => {\n const result = validator(value, context)\n return toFailures(result, context, this, value)\n }\n } else {\n this.validator = () => []\n }\n\n if (refiner) {\n this.refiner = (value, context) => {\n const result = refiner(value, context)\n return toFailures(result, context, this, value)\n }\n } else {\n this.refiner = () => []\n }\n }\n\n /**\n * Assert that a value passes the struct's validation, throwing if it doesn't.\n */\n\n assert(value: unknown): asserts value is T {\n return assert(value, this)\n }\n\n /**\n * Create a value with the struct's coercion logic, then validate it.\n */\n\n create(value: unknown): T {\n return create(value, this)\n }\n\n /**\n * Check if a value passes the struct's validation.\n */\n\n is(value: unknown): value is T {\n return is(value, this)\n }\n\n /**\n * Mask a value, coercing and validating it, but returning only the subset of\n * properties defined by the struct's schema.\n */\n\n mask(value: unknown): T {\n return mask(value, this)\n }\n\n /**\n * Validate a value with the struct's validation logic, returning a tuple\n * representing the result.\n *\n * You may optionally pass `true` for the `withCoercion` argument to coerce\n * the value before attempting to validate it. If you do, the result will\n * contain the coerced result when successful.\n */\n\n validate(\n value: unknown,\n options: {\n coerce?: boolean\n } = {}\n ): [StructError, undefined] | [undefined, T] {\n return validate(value, this, options)\n }\n}\n\n/**\n * Assert that a value passes a struct, throwing if it doesn't.\n */\n\nexport function assert(\n value: unknown,\n struct: Struct\n): asserts value is T {\n const result = validate(value, struct)\n\n if (result[0]) {\n throw result[0]\n }\n}\n\n/**\n * Create a value with the coercion logic of struct and validate it.\n */\n\nexport function create(value: unknown, struct: Struct): T {\n const result = validate(value, struct, { coerce: true })\n\n if (result[0]) {\n throw result[0]\n } else {\n return result[1]\n }\n}\n\n/**\n * Mask a value, returning only the subset of properties defined by a struct.\n */\n\nexport function mask(value: unknown, struct: Struct): T {\n const result = validate(value, struct, { coerce: true, mask: true })\n\n if (result[0]) {\n throw result[0]\n } else {\n return result[1]\n }\n}\n\n/**\n * Check if a value passes a struct.\n */\n\nexport function is(value: unknown, struct: Struct): value is T {\n const result = validate(value, struct)\n return !result[0]\n}\n\n/**\n * Validate a value against a struct, returning an error if invalid, or the\n * value (with potential coercion) if valid.\n */\n\nexport function validate(\n value: unknown,\n struct: Struct,\n options: {\n coerce?: boolean\n mask?: boolean\n } = {}\n): [StructError, undefined] | [undefined, T] {\n const tuples = run(value, struct, options)\n const tuple = shiftIterator(tuples)!\n\n if (tuple[0]) {\n const error = new StructError(tuple[0], function* () {\n for (const t of tuples) {\n if (t[0]) {\n yield t[0]\n }\n }\n })\n\n return [error, undefined]\n } else {\n const v = tuple[1]\n return [undefined, v]\n }\n}\n\n/**\n * A `Context` contains information about the current location of the\n * validation inside the initial input value.\n */\n\nexport type Context = {\n branch: Array\n path: Array\n}\n\n/**\n * A type utility to extract the type from a `Struct` class.\n */\n\nexport type Infer> = T['TYPE']\n\n/**\n * A type utility to describe that a struct represents a TypeScript type.\n */\n\nexport type Describe = Struct>\n\n/**\n * A `Result` is returned from validation functions.\n */\n\nexport type Result =\n | boolean\n | string\n | Partial\n | Iterable>\n\n/**\n * A `Coercer` takes an unknown value and optionally coerces it.\n */\n\nexport type Coercer = (value: T, context: Context) => unknown\n\n/**\n * A `Validator` takes an unknown value and validates it.\n */\n\nexport type Validator = (value: unknown, context: Context) => Result\n\n/**\n * A `Refiner` takes a value of a known type and validates it against a further\n * constraint.\n */\n\nexport type Refiner = (value: T, context: Context) => Result\n","import { Struct, Context, Validator } from '../struct'\nimport { object, optional, type } from './types'\nimport { ObjectSchema, Assign, ObjectType, PartialObjectSchema } from '../utils'\n\n/**\n * Create a new struct that combines the properties properties from multiple\n * object or type structs. Its return type will match the first parameter's type.\n *\n * Like JavaScript's `Object.assign` utility.\n */\n\nexport function assign(\n A: Struct, A>,\n B: Struct, B>\n): Struct>, Assign>\nexport function assign<\n A extends ObjectSchema,\n B extends ObjectSchema,\n C extends ObjectSchema\n>(\n A: Struct, A>,\n B: Struct, B>,\n C: Struct, C>\n): Struct, C>>, Assign, C>>\nexport function assign<\n A extends ObjectSchema,\n B extends ObjectSchema,\n C extends ObjectSchema,\n D extends ObjectSchema\n>(\n A: Struct, A>,\n B: Struct, B>,\n C: Struct, C>,\n D: Struct, D>\n): Struct<\n ObjectType, C>, D>>,\n Assign, C>, D>\n>\nexport function assign<\n A extends ObjectSchema,\n B extends ObjectSchema,\n C extends ObjectSchema,\n D extends ObjectSchema,\n E extends ObjectSchema\n>(\n A: Struct, A>,\n B: Struct, B>,\n C: Struct, C>,\n D: Struct, D>,\n E: Struct, E>\n): Struct<\n ObjectType, C>, D>, E>>,\n Assign, C>, D>, E>\n>\nexport function assign(...Structs: Struct[]): any {\n const isType = Structs[0].type === 'type'\n const schemas = Structs.map((s) => s.schema)\n const schema = Object.assign({}, ...schemas)\n return isType ? type(schema) : object(schema)\n}\n\n/**\n * Define a new struct type with a custom validation function.\n */\n\nexport function define(name: string, validator: Validator): Struct {\n return new Struct({ type: name, schema: null, validator })\n}\n\n/**\n * Create a new struct based on an existing struct, but the value is allowed to\n * be `undefined`. `log` will be called if the value is not `undefined`.\n */\n\nexport function deprecated(\n struct: Struct,\n log: (value: unknown, ctx: Context) => void\n): Struct {\n return new Struct({\n ...struct,\n refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx),\n validator(value, ctx) {\n if (value === undefined) {\n return true\n } else {\n log(value, ctx)\n return struct.validator(value, ctx)\n }\n },\n })\n}\n\n/**\n * Create a struct with dynamic validation logic.\n *\n * The callback will receive the value currently being validated, and must\n * return a struct object to validate it with. This can be useful to model\n * validation logic that changes based on its input.\n */\n\nexport function dynamic(\n fn: (value: unknown, ctx: Context) => Struct\n): Struct {\n return new Struct({\n type: 'dynamic',\n schema: null,\n *entries(value, ctx) {\n const struct = fn(value, ctx)\n yield* struct.entries(value, ctx)\n },\n validator(value, ctx) {\n const struct = fn(value, ctx)\n return struct.validator(value, ctx)\n },\n coercer(value, ctx) {\n const struct = fn(value, ctx)\n return struct.coercer(value, ctx)\n },\n refiner(value, ctx) {\n const struct = fn(value, ctx)\n return struct.refiner(value, ctx)\n },\n })\n}\n\n/**\n * Create a struct with lazily evaluated validation logic.\n *\n * The first time validation is run with the struct, the callback will be called\n * and must return a struct object to use. This is useful for cases where you\n * want to have self-referential structs for nested data structures to avoid a\n * circular definition problem.\n */\n\nexport function lazy(fn: () => Struct): Struct {\n let struct: Struct | undefined\n return new Struct({\n type: 'lazy',\n schema: null,\n *entries(value, ctx) {\n struct ??= fn()\n yield* struct.entries(value, ctx)\n },\n validator(value, ctx) {\n struct ??= fn()\n return struct.validator(value, ctx)\n },\n coercer(value, ctx) {\n struct ??= fn()\n return struct.coercer(value, ctx)\n },\n refiner(value, ctx) {\n struct ??= fn()\n return struct.refiner(value, ctx)\n },\n })\n}\n\n/**\n * Create a new struct based on an existing object struct, but excluding\n * specific properties.\n *\n * Like TypeScript's `Omit` utility.\n */\n\nexport function omit(\n struct: Struct, S>,\n keys: K[]\n): Struct>, Omit> {\n const { schema } = struct\n const subschema: any = { ...schema }\n\n for (const key of keys) {\n delete subschema[key]\n }\n\n switch (struct.type) {\n case 'type':\n return type(subschema as Omit)\n default:\n return object(subschema as Omit)\n }\n}\n\n/**\n * Create a new struct based on an existing object struct, but with all of its\n * properties allowed to be `undefined`.\n *\n * Like TypeScript's `Partial` utility.\n */\n\nexport function partial(\n struct: Struct, S> | S\n): Struct>, PartialObjectSchema> {\n const schema: any =\n struct instanceof Struct ? { ...struct.schema } : { ...struct }\n\n for (const key in schema) {\n schema[key] = optional(schema[key])\n }\n\n return object(schema) as any\n}\n\n/**\n * Create a new struct based on an existing object struct, but only including\n * specific properties.\n *\n * Like TypeScript's `Pick` utility.\n */\n\nexport function pick(\n struct: Struct, S>,\n keys: K[]\n): Struct>, Pick> {\n const { schema } = struct\n const subschema: any = {}\n\n for (const key of keys) {\n subschema[key] = schema[key]\n }\n\n return object(subschema as Pick)\n}\n\n/**\n * Define a new struct type with a custom validation function.\n *\n * @deprecated This function has been renamed to `define`.\n */\n\nexport function struct(name: string, validator: Validator): Struct {\n console.warn(\n 'superstruct@0.11 - The `struct` helper has been renamed to `define`.'\n )\n\n return define(name, validator)\n}\n","import { Infer, Struct } from '../struct'\nimport { define } from './utilities'\nimport {\n ObjectSchema,\n ObjectType,\n print,\n run,\n isObject,\n AnyStruct,\n InferStructTuple,\n UnionToIntersection,\n} from '../utils'\n\n/**\n * Ensure that any value passes validation.\n */\n\nexport function any(): Struct {\n return define('any', () => true)\n}\n\n/**\n * Ensure that a value is an array and that its elements are of a specific type.\n *\n * Note: If you omit the element struct, the arrays elements will not be\n * iterated at all. This can be helpful for cases where performance is critical,\n * and it is preferred to using `array(any())`.\n */\n\nexport function array>(Element: T): Struct[], T>\nexport function array(): Struct\nexport function array>(Element?: T): any {\n return new Struct({\n type: 'array',\n schema: Element,\n *entries(value) {\n if (Element && Array.isArray(value)) {\n for (const [i, v] of value.entries()) {\n yield [i, v, Element]\n }\n }\n },\n coercer(value) {\n return Array.isArray(value) ? value.slice() : value\n },\n validator(value) {\n return (\n Array.isArray(value) ||\n `Expected an array value, but received: ${print(value)}`\n )\n },\n })\n}\n\n/**\n * Ensure that a value is a bigint.\n */\n\nexport function bigint(): Struct {\n return define('bigint', (value) => {\n return typeof value === 'bigint'\n })\n}\n\n/**\n * Ensure that a value is a boolean.\n */\n\nexport function boolean(): Struct {\n return define('boolean', (value) => {\n return typeof value === 'boolean'\n })\n}\n\n/**\n * Ensure that a value is a valid `Date`.\n *\n * Note: this also ensures that the value is *not* an invalid `Date` object,\n * which can occur when parsing a date fails but still returns a `Date`.\n */\n\nexport function date(): Struct {\n return define('date', (value) => {\n return (\n (value instanceof Date && !isNaN(value.getTime())) ||\n `Expected a valid \\`Date\\` object, but received: ${print(value)}`\n )\n })\n}\n\n/**\n * Ensure that a value is one of a set of potential values.\n *\n * Note: after creating the struct, you can access the definition of the\n * potential values as `struct.schema`.\n */\n\nexport function enums(\n values: T\n): Struct\nexport function enums(\n values: T\n): Struct\nexport function enums(\n values: T\n): any {\n const schema: any = {}\n const description = values.map((v) => print(v)).join()\n\n for (const key of values) {\n schema[key] = key\n }\n\n return new Struct({\n type: 'enums',\n schema,\n validator(value) {\n return (\n values.includes(value as any) ||\n `Expected one of \\`${description}\\`, but received: ${print(value)}`\n )\n },\n })\n}\n\n/**\n * Ensure that a value is a function.\n */\n\nexport function func(): Struct {\n return define('func', (value) => {\n return (\n typeof value === 'function' ||\n `Expected a function, but received: ${print(value)}`\n )\n })\n}\n\n/**\n * Ensure that a value is an instance of a specific class.\n */\n\nexport function instance(\n Class: T\n): Struct, null> {\n return define('instance', (value) => {\n return (\n value instanceof Class ||\n `Expected a \\`${Class.name}\\` instance, but received: ${print(value)}`\n )\n })\n}\n\n/**\n * Ensure that a value is an integer.\n */\n\nexport function integer(): Struct {\n return define('integer', (value) => {\n return (\n (typeof value === 'number' && !isNaN(value) && Number.isInteger(value)) ||\n `Expected an integer, but received: ${print(value)}`\n )\n })\n}\n\n/**\n * Ensure that a value matches all of a set of types.\n */\n\nexport function intersection(\n Structs: [A, ...B]\n): Struct & UnionToIntersection[number]>, null> {\n return new Struct({\n type: 'intersection',\n schema: null,\n *entries(value, ctx) {\n for (const S of Structs) {\n yield* S.entries(value, ctx)\n }\n },\n *validator(value, ctx) {\n for (const S of Structs) {\n yield* S.validator(value, ctx)\n }\n },\n *refiner(value, ctx) {\n for (const S of Structs) {\n yield* S.refiner(value, ctx)\n }\n },\n })\n}\n\n/**\n * Ensure that a value is an exact value, using `===` for comparison.\n */\n\nexport function literal(constant: T): Struct\nexport function literal(constant: T): Struct\nexport function literal(constant: T): Struct\nexport function literal(constant: T): Struct\nexport function literal(constant: T): any {\n const description = print(constant)\n const t = typeof constant\n return new Struct({\n type: 'literal',\n schema:\n t === 'string' || t === 'number' || t === 'boolean' ? constant : null,\n validator(value) {\n return (\n value === constant ||\n `Expected the literal \\`${description}\\`, but received: ${print(value)}`\n )\n },\n })\n}\n\n/**\n * Ensure that a value is a `Map` object, and that its keys and values are of\n * specific types.\n */\n\nexport function map(): Struct, null>\nexport function map(\n Key: Struct,\n Value: Struct\n): Struct, null>\nexport function map(Key?: Struct, Value?: Struct): any {\n return new Struct({\n type: 'map',\n schema: null,\n *entries(value) {\n if (Key && Value && value instanceof Map) {\n for (const [k, v] of value.entries()) {\n yield [k as string, k, Key]\n yield [k as string, v, Value]\n }\n }\n },\n coercer(value) {\n return value instanceof Map ? new Map(value) : value\n },\n validator(value) {\n return (\n value instanceof Map ||\n `Expected a \\`Map\\` object, but received: ${print(value)}`\n )\n },\n })\n}\n\n/**\n * Ensure that no value ever passes validation.\n */\n\nexport function never(): Struct {\n return define('never', () => false)\n}\n\n/**\n * Augment an existing struct to allow `null` values.\n */\n\nexport function nullable(struct: Struct): Struct {\n return new Struct({\n ...struct,\n validator: (value, ctx) => value === null || struct.validator(value, ctx),\n refiner: (value, ctx) => value === null || struct.refiner(value, ctx),\n })\n}\n\n/**\n * Ensure that a value is a number.\n */\n\nexport function number(): Struct {\n return define('number', (value) => {\n return (\n (typeof value === 'number' && !isNaN(value)) ||\n `Expected a number, but received: ${print(value)}`\n )\n })\n}\n\n/**\n * Ensure that a value is an object, that is has a known set of properties,\n * and that its properties are of specific types.\n *\n * Note: Unrecognized properties will fail validation.\n */\n\nexport function object(): Struct, null>\nexport function object(\n schema: S\n): Struct, S>\nexport function object(schema?: S): any {\n const knowns = schema ? Object.keys(schema) : []\n const Never = never()\n return new Struct({\n type: 'object',\n schema: schema ? schema : null,\n *entries(value) {\n if (schema && isObject(value)) {\n const unknowns = new Set(Object.keys(value))\n\n for (const key of knowns) {\n unknowns.delete(key)\n yield [key, value[key], schema[key]]\n }\n\n for (const key of unknowns) {\n yield [key, value[key], Never]\n }\n }\n },\n validator(value) {\n return (\n isObject(value) || `Expected an object, but received: ${print(value)}`\n )\n },\n coercer(value) {\n return isObject(value) ? { ...value } : value\n },\n })\n}\n\n/**\n * Augment a struct to allow `undefined` values.\n */\n\nexport function optional(struct: Struct): Struct {\n return new Struct({\n ...struct,\n validator: (value, ctx) =>\n value === undefined || struct.validator(value, ctx),\n refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx),\n })\n}\n\n/**\n * Ensure that a value is an object with keys and values of specific types, but\n * without ensuring any specific shape of properties.\n *\n * Like TypeScript's `Record` utility.\n */\n\nexport function record(\n Key: Struct,\n Value: Struct\n): Struct, null> {\n return new Struct({\n type: 'record',\n schema: null,\n *entries(value) {\n if (isObject(value)) {\n for (const k in value) {\n const v = value[k]\n yield [k, k, Key]\n yield [k, v, Value]\n }\n }\n },\n validator(value) {\n return (\n isObject(value) || `Expected an object, but received: ${print(value)}`\n )\n },\n })\n}\n\n/**\n * Ensure that a value is a `RegExp`.\n *\n * Note: this does not test the value against the regular expression! For that\n * you need to use the `pattern()` refinement.\n */\n\nexport function regexp(): Struct {\n return define('regexp', (value) => {\n return value instanceof RegExp\n })\n}\n\n/**\n * Ensure that a value is a `Set` object, and that its elements are of a\n * specific type.\n */\n\nexport function set(): Struct, null>\nexport function set(Element: Struct): Struct, null>\nexport function set(Element?: Struct): any {\n return new Struct({\n type: 'set',\n schema: null,\n *entries(value) {\n if (Element && value instanceof Set) {\n for (const v of value) {\n yield [v as string, v, Element]\n }\n }\n },\n coercer(value) {\n return value instanceof Set ? new Set(value) : value\n },\n validator(value) {\n return (\n value instanceof Set ||\n `Expected a \\`Set\\` object, but received: ${print(value)}`\n )\n },\n })\n}\n\n/**\n * Ensure that a value is a string.\n */\n\nexport function string(): Struct {\n return define('string', (value) => {\n return (\n typeof value === 'string' ||\n `Expected a string, but received: ${print(value)}`\n )\n })\n}\n\n/**\n * Ensure that a value is a tuple of a specific length, and that each of its\n * elements is of a specific type.\n */\n\nexport function tuple(\n Structs: [A, ...B]\n): Struct<[Infer, ...InferStructTuple], null> {\n const Never = never()\n\n return new Struct({\n type: 'tuple',\n schema: null,\n *entries(value) {\n if (Array.isArray(value)) {\n const length = Math.max(Structs.length, value.length)\n\n for (let i = 0; i < length; i++) {\n yield [i, value[i], Structs[i] || Never]\n }\n }\n },\n validator(value) {\n return (\n Array.isArray(value) ||\n `Expected an array, but received: ${print(value)}`\n )\n },\n })\n}\n\n/**\n * Ensure that a value has a set of known properties of specific types.\n *\n * Note: Unrecognized properties are allowed and untouched. This is similar to\n * how TypeScript's structural typing works.\n */\n\nexport function type(\n schema: S\n): Struct, S> {\n const keys = Object.keys(schema)\n return new Struct({\n type: 'type',\n schema,\n *entries(value) {\n if (isObject(value)) {\n for (const k of keys) {\n yield [k, value[k], schema[k]]\n }\n }\n },\n validator(value) {\n return (\n isObject(value) || `Expected an object, but received: ${print(value)}`\n )\n },\n })\n}\n\n/**\n * Ensure that a value matches one of a set of types.\n */\n\nexport function union(\n Structs: [A, ...B]\n): Struct | InferStructTuple[number], null> {\n const description = Structs.map((s) => s.type).join(' | ')\n return new Struct({\n type: 'union',\n schema: null,\n coercer(value, ctx) {\n const firstMatch =\n Structs.find((s) => {\n const [e] = s.validate(value, { coerce: true })\n return !e\n }) || unknown()\n return firstMatch.coercer(value, ctx)\n },\n validator(value, ctx) {\n const failures = []\n\n for (const S of Structs) {\n const [...tuples] = run(value, S, ctx)\n const [first] = tuples\n\n if (!first[0]) {\n return []\n } else {\n for (const [failure] of tuples) {\n if (failure) {\n failures.push(failure)\n }\n }\n }\n }\n\n return [\n `Expected the value to satisfy a union of \\`${description}\\`, but received: ${print(\n value\n )}`,\n ...failures,\n ]\n },\n })\n}\n\n/**\n * Ensure that any value passes validation, without widening its type to `any`.\n */\n\nexport function unknown(): Struct {\n return define('unknown', () => true)\n}\n","import { Struct, is, Coercer } from '../struct'\nimport { isPlainObject } from '../utils'\nimport { string, unknown } from './types'\n\n/**\n * Augment a `Struct` to add an additional coercion step to its input.\n *\n * This allows you to transform input data before validating it, to increase the\n * likelihood that it passes validation—for example for default values, parsing\n * different formats, etc.\n *\n * Note: You must use `create(value, Struct)` on the value to have the coercion\n * take effect! Using simply `assert()` or `is()` will not use coercion.\n */\n\nexport function coerce(\n struct: Struct,\n condition: Struct,\n coercer: Coercer\n): Struct {\n return new Struct({\n ...struct,\n coercer: (value, ctx) => {\n return is(value, condition)\n ? struct.coercer(coercer(value, ctx), ctx)\n : struct.coercer(value, ctx)\n },\n })\n}\n\n/**\n * Augment a struct to replace `undefined` values with a default.\n *\n * Note: You must use `create(value, Struct)` on the value to have the coercion\n * take effect! Using simply `assert()` or `is()` will not use coercion.\n */\n\nexport function defaulted(\n struct: Struct,\n fallback: any,\n options: {\n strict?: boolean\n } = {}\n): Struct {\n return coerce(struct, unknown(), (x) => {\n const f = typeof fallback === 'function' ? fallback() : fallback\n\n if (x === undefined) {\n return f\n }\n\n if (!options.strict && isPlainObject(x) && isPlainObject(f)) {\n const ret = { ...x }\n let changed = false\n\n for (const key in f) {\n if (ret[key] === undefined) {\n ret[key] = f[key]\n changed = true\n }\n }\n\n if (changed) {\n return ret\n }\n }\n\n return x\n })\n}\n\n/**\n * Augment a struct to trim string inputs.\n *\n * Note: You must use `create(value, Struct)` on the value to have the coercion\n * take effect! Using simply `assert()` or `is()` will not use coercion.\n */\n\nexport function trimmed(struct: Struct): Struct {\n return coerce(struct, string(), (x) => x.trim())\n}\n","import { Struct, Refiner } from '../struct'\nimport { toFailures } from '../utils'\n\n/**\n * Ensure that a string, array, map, or set is empty.\n */\n\nexport function empty<\n T extends string | any[] | Map | Set,\n S extends any\n>(struct: Struct): Struct {\n return refine(struct, 'empty', (value) => {\n const size = getSize(value)\n return (\n size === 0 ||\n `Expected an empty ${struct.type} but received one with a size of \\`${size}\\``\n )\n })\n}\n\nfunction getSize(value: string | any[] | Map | Set): number {\n if (value instanceof Map || value instanceof Set) {\n return value.size\n } else {\n return value.length\n }\n}\n\n/**\n * Ensure that a number or date is below a threshold.\n */\n\nexport function max(\n struct: Struct,\n threshold: T,\n options: {\n exclusive?: boolean\n } = {}\n): Struct {\n const { exclusive } = options\n return refine(struct, 'max', (value) => {\n return exclusive\n ? value < threshold\n : value <= threshold ||\n `Expected a ${struct.type} less than ${\n exclusive ? '' : 'or equal to '\n }${threshold} but received \\`${value}\\``\n })\n}\n\n/**\n * Ensure that a number or date is above a threshold.\n */\n\nexport function min(\n struct: Struct,\n threshold: T,\n options: {\n exclusive?: boolean\n } = {}\n): Struct {\n const { exclusive } = options\n return refine(struct, 'min', (value) => {\n return exclusive\n ? value > threshold\n : value >= threshold ||\n `Expected a ${struct.type} greater than ${\n exclusive ? '' : 'or equal to '\n }${threshold} but received \\`${value}\\``\n })\n}\n\n/**\n * Ensure that a string, array, map or set is not empty.\n */\n\nexport function nonempty<\n T extends string | any[] | Map | Set,\n S extends any\n>(struct: Struct): Struct {\n return refine(struct, 'nonempty', (value) => {\n const size = getSize(value)\n return (\n size > 0 || `Expected a nonempty ${struct.type} but received an empty one`\n )\n })\n}\n\n/**\n * Ensure that a string matches a regular expression.\n */\n\nexport function pattern(\n struct: Struct,\n regexp: RegExp\n): Struct {\n return refine(struct, 'pattern', (value) => {\n return (\n regexp.test(value) ||\n `Expected a ${struct.type} matching \\`/${regexp.source}/\\` but received \"${value}\"`\n )\n })\n}\n\n/**\n * Ensure that a string, array, number, date, map, or set has a size (or length, or time) between `min` and `max`.\n */\n\nexport function size<\n T extends string | number | Date | any[] | Map | Set,\n S extends any\n>(struct: Struct, min: number, max: number = min): Struct {\n const expected = `Expected a ${struct.type}`\n const of = min === max ? `of \\`${min}\\`` : `between \\`${min}\\` and \\`${max}\\``\n\n return refine(struct, 'size', (value) => {\n if (typeof value === 'number' || value instanceof Date) {\n return (\n (min <= value && value <= max) ||\n `${expected} ${of} but received \\`${value}\\``\n )\n } else if (value instanceof Map || value instanceof Set) {\n const { size } = value\n return (\n (min <= size && size <= max) ||\n `${expected} with a size ${of} but received one with a size of \\`${size}\\``\n )\n } else {\n const { length } = value as string | any[]\n return (\n (min <= length && length <= max) ||\n `${expected} with a length ${of} but received one with a length of \\`${length}\\``\n )\n }\n })\n}\n\n/**\n * Augment a `Struct` to add an additional refinement to the validation.\n *\n * The refiner function is guaranteed to receive a value of the struct's type,\n * because the struct's existing validation will already have passed. This\n * allows you to layer additional validation on top of existing structs.\n */\n\nexport function refine(\n struct: Struct,\n name: string,\n refiner: Refiner\n): Struct {\n return new Struct({\n ...struct,\n *refiner(value, ctx) {\n yield* struct.refiner(value, ctx)\n const result = refiner(value, ctx)\n const failures = toFailures(result, ctx, struct, value)\n\n for (const failure of failures) {\n yield { ...failure, refinement: name }\n }\n },\n })\n}\n"],"names":["StructError","TypeError","constructor","failure","failures","cached","message","rest","path","msg","length","join","value","key","type","refinement","branch","Object","assign","name","isIterable","x","isObject","Symbol","iterator","isPlainObject","prototype","toString","call","getPrototypeOf","print","JSON","stringify","shiftIterator","input","done","next","undefined","toFailure","result","context","struct","toFailures","r","run","options","coerce","mask","ctx","coercer","schema","Array","isArray","status","validator","k","v","s","entries","ts","t","Map","set","Set","add","refiner","Struct","props","TYPE","assert","create","is","validate","tuples","tuple","error","Structs","isType","schemas","map","object","define","deprecated","log","dynamic","fn","lazy","omit","keys","subschema","partial","optional","pick","console","warn","any","array","Element","i","slice","bigint","boolean","date","Date","isNaN","getTime","enums","values","description","includes","func","instance","Class","integer","Number","isInteger","intersection","S","literal","constant","Key","Value","never","nullable","number","knowns","Never","unknowns","delete","record","regexp","RegExp","string","Math","max","union","firstMatch","find","e","unknown","first","push","condition","defaulted","fallback","f","strict","ret","changed","trimmed","trim","empty","refine","size","getSize","threshold","exclusive","min","nonempty","pattern","test","source","expected","of"],"mappings":"AAAA;;AAEG;;AAYH;;;;;;;AAOG;AAEG,MAAOA,WAAP,SAA2BC,SAA3B,CAAoC;AAUxCC,EAAAA,WAAY,CAAAC,OAAA,EAAkBC,QAAlB,EAAoD;AAC9D,IAAA,IAAIC,MAAJ,CAAA;IACA,MAAM;MAAEC,OAAF;MAAW,GAAGC,IAAAA;AAAd,KAAA,GAAuBJ,OAA7B,CAAA;IACA,MAAM;AAAEK,MAAAA,IAAAA;AAAF,KAAA,GAAWL,OAAjB,CAAA;AACA,IAAA,MAAMM,GAAG,GACPD,IAAI,CAACE,MAAL,KAAgB,CAAhB,GAAoBJ,OAApB,GAA8B,CAAYE,SAAAA,EAAAA,IAAI,CAACG,IAAL,CAAU,GAAV,CAAc,CAAA,IAAA,EA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GAAaE,KAAnB,CAAA;AACA,MAAA,OACGiJ,GAAG,IAAInJ,MAAP,IAAiBA,MAAM,IAAI4H,GAA5B,IACA,CAAA,EAAG4B,QAA0B,CAAA,eAAA,EAAAC,0CAA0CzJ,MAAM,CAF/E,EAAA,CAAA,CAAA;AAID,KAAA;AACF,GAnBY,CAAb,CAAA;AAoBD,CAAA;AAED;;;;;;AAMG;;SAEa8I,OACd/G,QACAtB,MACA8C,SAAmB;AAEnB,EAAA,OAAO,IAAIC,MAAJ,CAAW,EAChB,GAAGzB,MADa;;AAEhB,IAAA,CAACwB,OAAD,CAASrD,KAAT,EAAgBoC,GAAhB,EAAmB;AACjB,MAAA,OAAOP,MAAM,CAACwB,OAAP,CAAerD,KAAf,EAAsBoC,GAAtB,CAAP,CAAA;AACA,MAAA,MAAMT,MAAM,GAAG0B,OAAO,CAACrD,KAAD,EAAQoC,GAAR,CAAtB,CAAA;MACA,MAAM5C,QAAQ,GAAGsC,UAAU,CAACH,MAAD,EAASS,GAAT,EAAcP,MAAd,EAAsB7B,KAAtB,CAA3B,CAAA;;AAEA,MAAA,KAAK,MAAMT,OAAX,IAAsBC,QAAtB,EAAgC;QAC9B,MAAM,EAAE,GAAGD,OAAL;AAAcY,UAAAA,UAAU,EAAEI,IAAAA;SAAhC,CAAA;AACD,OAAA;AACF,KAAA;;AAVe,GAAX,CAAP,CAAA;AAYD;;;;"} \ No newline at end of file diff --git a/node_modules/superstruct/lib/struct.d.ts.map b/node_modules/superstruct/lib/struct.d.ts.map deleted file mode 100644 index 9a6247bf9..000000000 --- a/node_modules/superstruct/lib/struct.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"struct.d.ts","sourceRoot":"","sources":["../src/struct.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,YAAY,EAAO,MAAM,SAAS,CAAA;AACtE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAE9C;;;;GAIG;AAEH,qBAAa,MAAM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;IAClB,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;CACjB,CAAA;AAED;;GAEG;AAEH,oBAAY,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAA;AAEzD;;GAEG;AAEH,oBAAY,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAA;AAEpD;;GAEG;AAEH,oBAAY,MAAM,GACd,OAAO,GACP,MAAM,GACN,OAAO,CAAC,OAAO,CAAC,GAChB,QAAQ,CAAC,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;AAEjD;;GAEG;AAEH,oBAAY,OAAO,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,KAAK,OAAO,CAAA;AAE1E;;GAEG;AAEH,oBAAY,SAAS,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,KAAK,MAAM,CAAA;AAEpE;;;GAGG;AAEH,oBAAY,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,KAAK,MAAM,CAAA"} \ No newline at end of file diff --git a/node_modules/superstruct/lib/utils.d.ts.map b/node_modules/superstruct/lib/utils.d.ts.map deleted file mode 100644 index 24e22f836..000000000 --- a/node_modules/superstruct/lib/utils.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAUjC;;GAEG;AAEH,wBAAgB,QAAQ,CAAC,CAAC,E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,KAAK,GACL,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,GAChC,KAAK,CAAA;AACT,aAAK,WAAW,CACd,KAAK,SAAS,SAAS,EAAE,EACzB,MAAM,SAAS,MAAM,EACrB,WAAW,SAAS,OAAO,EAAE,EAC7B,KAAK,SAAS,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC,IAC1C,KAAK,SAAS,MAAM,GACpB,WAAW,GACX,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC,GAAG,WAAW,EAAE,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/node_modules/superstruct/package.json b/node_modules/superstruct/package.json index a1ffb992b..84598ac66 100644 --- a/node_modules/superstruct/package.json +++ b/node_modules/superstruct/package.json @@ -1,39 +1,37 @@ { "name": "superstruct", - "type": "module", "description": "A simple and composable way to validate data in JavaScript (and TypeScript).", - "version": "0.16.5", + "version": "1.0.3", "license": "MIT", "repository": "git://github.com/ianstormtaylor/superstruct.git", - "source": "./src/index.ts", - "types": "./lib/index.d.ts", - "main": "./lib/index.cjs", - "module": "./lib/index.mjs", - "exports": { - "import": "./lib/index.mjs", - "require": "./lib/index.cjs" - }, + "type": "module", + "main": "./dist/index.cjs", + "module": "./dist/index.mjs", + "types": "./dist/index.d.ts", "sideEffects": false, "files": [ - "umd", - "lib" + "dist" ], "publishConfig": { "registry": "https://registry.npmjs.org" }, + "engines": { + "node": ">=14.0.0" + }, "devDependencies": { "@babel/cli": "^7.6.3", "@babel/core": "^7.6.3", "@babel/plugin-transform-modules-commonjs": "^7.12.1", - "@babel/preset-env": "^7.6.3", + "@babel/preset-env": "^7.20.2", "@babel/preset-typescript": "^7.6.0", "@babel/register": "^7.6.2", + "@rollup/plugin-typescript": "^9.0.2", "@types/expect": "^24.3.0", "@types/lodash": "^4.14.144", - "@types/mocha": "^9.1.1", + "@types/mocha": "^10.0.0", "@types/node": "^18.7.14", - "@typescript-eslint/eslint-plugin": "^4.33.0", - "@typescript-eslint/parser": "^4.33.0", + "@typescript-eslint/eslint-plugin": "^5.43.0", + "@typescript-eslint/parser": "^5.43.0", "babel-eslint": "^10.0.3", "eslint": "^7.14.0", "eslint-config-prettier": "^7.2.0", @@ -44,37 +42,25 @@ "is-uuid": "^1.0.2", "lodash": "^4.17.15", "mocha": "^10.0.0", - "np": "^7.0.0", + "np": "^7.6.2", "prettier": "^2.0.5", - "rollup": "^2.12.0", - "rollup-plugin-babel": "^4.3.3", - "rollup-plugin-commonjs": "^10.1.0", - "rollup-plugin-node-resolve": "^5.2.0", - "rollup-plugin-replace": "^2.2.0", - "rollup-plugin-terser": "^7.0.2", - "rollup-plugin-ts": "^3.0.1", + "rollup": "^3.3.0", "typescript": "^4.8.3" }, "scripts": { - "build": "rm -rf ./{lib,umd} && yarn build:types && yarn build:mjs && yarn build:cjs && yarn build:umd && yarn build:umd-min", - "build:cjs": "rollup --config ./config/rollup-cjs.js", - "build:mjs": "rollup --config ./config/rollup.js", - "build:umd": "rollup --config ./config/rollup-umd.js", - "build:umd-min": "rollup --config ./config/rollup-umd-min.js", - "build:types": "tsc --emitDeclarationOnly --declarationMap --outDir ./lib", - "clean": "rm -rf ./{lib,umd,node_modules}", - "fix": "yarn fix:eslint && yarn fix:prettier", - "fix:eslint": "yarn lint:eslint --fix", - "fix:prettier": "yarn lint:prettier --write", - "lint": "yarn lint:eslint && yarn lint:prettier", + "build": "rm -rf ./{dist} && rollup --config ./rollup.config.js", + "clean": "rm -rf ./{dist,node_modules}", + "fix": "npm run fix:eslint && npm run fix:prettier", + "fix:eslint": "npm run lint:eslint --fix", + "fix:prettier": "npm run lint:prettier --write", + "lint": "npm run lint:eslint && npm run lint:prettier", "lint:eslint": "eslint '{src,test}/*.{js,ts}'", "lint:prettier": "prettier --list-different '**/*.{js,json,ts}'", - "release": "yarn build && yarn lint && np", - "test": "yarn build:types && yarn test:types && yarn build:cjs && yarn test:mocha", + "release": "npm run build && npm run lint && np", + "test": "npm run build && npm run test:types && npm run test:mocha", "test:mocha": "mocha --require ./test/register.cjs --require source-map-support/register ./test/index.ts", "test:types": "tsc --noEmit && tsc --project ./test/tsconfig.json --noEmit", - "watch": "yarn build:cjs --watch", - "watch:types": "yarn build:types --watch" + "watch": "npm run build -- --watch" }, "keywords": [ "api", @@ -106,9 +92,5 @@ "validate", "validation", "validator" - ], - "dependencies": {}, - "engines": { - "node": ">=14.0.0" - } + ] } diff --git a/node_modules/superstruct/umd/superstruct.d.ts b/node_modules/superstruct/umd/superstruct.d.ts deleted file mode 100644 index 47dce3dff..000000000 --- a/node_modules/superstruct/umd/superstruct.d.ts +++ /dev/null @@ -1,579 +0,0 @@ -/** - * A `StructFailure` represents a single specific failure in validation. - */ -type Failure = { - value: any; - key: any; - type: string; - refinement: string | undefined; - message: string; - branch: Array; - path: Array; -}; -/** - * `StructError` objects are thrown (or returned) when validation fails. - * - * Validation logic is design to exit early for maximum performance. The error - * represents the first error encountered during validation. For more detail, - * the `error.failures` property is a generator function that can be run to - * continue validation and receive all the failures in the data. - */ -declare class StructError extends TypeError { - value: any; - key: any; - type: string; - refinement: string | undefined; - path: Array; - branch: Array; - failures: () => Array; - [x: string]: any; - constructor(failure: Failure, failures: () => Generator); -} -/** - * Convert a union of type to an intersection. - */ -type UnionToIntersection = (U extends any ? (arg: U) => any : never) extends (arg: infer I) => void ? I : never; -/** - * Assign properties from one type to another, overwriting existing. - */ -type Assign = Simplify>; -/** - * A schema for enum structs. - */ -type EnumSchema = { - [K in NonNullable]: K; -}; -/** - * Check if a type is a match for another whilst treating overlapping - * unions as a match. - */ -type IsMatch = T extends G ? (G extends T ? T : never) : never; -/** - * Check if a type is an exact match. - */ -type IsExactMatch = (() => G extends T ? 1 : 2) extends () => G extends U ? 1 : 2 ? T : never; -/** - * Check if a type is a record type. - */ -type IsRecord = T extends object ? string extends keyof T ? T : never : never; -/** - * Check if a type is a tuple. - */ -type IsTuple = T extends [ - any -] ? T : T extends [ - any, - any -] ? T : T extends [ - any, - any, - any -] ? T : T extends [ - any, - any, - any, - any -] ? T : T extends [ - any, - any, - any, - any, - any -] ? T : never; -/** - * Check if a type is a union. - */ -type IsUnion = (T extends any ? (U extends T ? false : true) : false) extends false ? never : T; -/** - * A schema for object structs. - */ -type ObjectSchema = Record>; -/** - * Infer a type from an object struct schema. - */ -type ObjectType = Simplify; -}>>; -/** - * Omit properties from a type that extend from a specific type. - */ -type OmitBy = Omit ? K : never; -}[keyof T]>; -/** - * Normalize properties of a type that allow `undefined` to make them optional. - */ -type Optionalize = OmitBy & Partial>; -/** - * Transform an object schema type to represent a partial. - */ -type PartialObjectSchema = { - [K in keyof S]: Struct | undefined>; -}; -/** - * Pick properties from a type that extend from a specific type. - */ -type PickBy = Pick ? K : never; -}[keyof T]>; -/** - * Simplifies a type definition to its most basic representation. - */ -type Simplify = T extends any[] | Date ? T : { - [K in keyof T]: T[K]; -} & {}; -/** - * A schema for any type of struct. - */ -type StructSchema = [ - T -] extends [ - string | undefined -] ? [ - T -] extends [ - IsMatch -] ? null : [ - T -] extends [ - IsUnion -] ? EnumSchema : T : [ - T -] extends [ - number | undefined -] ? [ - T -] extends [ - IsMatch -] ? null : [ - T -] extends [ - IsUnion -] ? EnumSchema : T : [ - T -] extends [ - boolean -] ? [ - T -] extends [ - IsExactMatch -] ? null : T : T extends bigint | symbol | undefined | null | Function | Date | Error | RegExp | Map | WeakMap | Set | WeakSet | Promise ? null : T extends Array ? T extends IsTuple ? null : Struct : T extends object ? T extends IsRecord ? null : { - [K in keyof T]: Describe; -} : null; -/** - * Shorthand type for matching any `Struct`. - */ -type AnyStruct = Struct; -/** - * Infer a tuple of types from a tuple of `Struct`s. - * - * This is used to recursively retrieve the type from `union` `intersection` and - * `tuple` structs. - */ -type InferStructTuple = Length extends Length ? number extends Length ? Tuple : _InferTuple : never; -type _InferTuple = Index extends Length ? Accumulated : _InferTuple -]>; -/** - * `Struct` objects encapsulate the validation logic for a specific type of - * values. Once constructed, you use the `assert`, `is` or `validate` helpers to - * validate unknown input data against the struct. - */ -declare class Struct { - readonly TYPE: T; - type: string; - schema: S; - coercer: (value: unknown, context: Context) => unknown; - validator: (value: unknown, context: Context) => Iterable; - refiner: (value: T, context: Context) => Iterable; - entries: (value: unknown, context: Context) => Iterable<[ - string | number, - unknown, - Struct | Struct - ]>; - constructor(props: { - type: string; - schema: S; - coercer?: Coercer; - validator?: Validator; - refiner?: Refiner; - entries?: Struct["entries"]; - }); - /** - * Assert that a value passes the struct's validation, throwing if it doesn't. - */ - assert(value: unknown): asserts value is T; - /** - * Create a value with the struct's coercion logic, then validate it. - */ - create(value: unknown): T; - /** - * Check if a value passes the struct's validation. - */ - is(value: unknown): value is T; - /** - * Mask a value, coercing and validating it, but returning only the subset of - * properties defined by the struct's schema. - */ - mask(value: unknown): T; - /** - * Validate a value with the struct's validation logic, returning a tuple - * representing the result. - * - * You may optionally pass `true` for the `withCoercion` argument to coerce - * the value before attempting to validate it. If you do, the result will - * contain the coerced result when successful. - */ - validate(value: unknown, options?: { - coerce?: boolean; - }): [ - StructError, - undefined - ] | [ - undefined, - T - ]; -} -/** - * Assert that a value passes a struct, throwing if it doesn't. - */ -declare function assert(value: unknown, struct: Struct): asserts value is T; -/** - * Create a value with the coercion logic of struct and validate it. - */ -declare function create(value: unknown, struct: Struct): T; -/** - * Mask a value, returning only the subset of properties defined by a struct. - */ -declare function mask(value: unknown, struct: Struct): T; -/** - * Check if a value passes a struct. - */ -declare function is(value: unknown, struct: Struct): value is T; -/** - * Validate a value against a struct, returning an error if invalid, or the - * value (with potential coercion) if valid. - */ -declare function validate(value: unknown, struct: Struct, options?: { - coerce?: boolean; - mask?: boolean; -}): [ - StructError, - undefined -] | [ - undefined, - T -]; -/** - * A `Context` contains information about the current location of the - * validation inside the initial input value. - */ -type Context = { - branch: Array; - path: Array; -}; -/** - * A type utility to extract the type from a `Struct` class. - */ -type Infer> = T["TYPE"]; -/** - * A type utility to describe that a struct represents a TypeScript type. - */ -type Describe = Struct>; -/** - * A `Result` is returned from validation functions. - */ -type Result = boolean | string | Partial | Iterable>; -/** - * A `Coercer` takes an unknown value and optionally coerces it. - */ -type Coercer = (value: T, context: Context) => unknown; -/** - * A `Validator` takes an unknown value and validates it. - */ -type Validator = (value: unknown, context: Context) => Result; -/** - * A `Refiner` takes a value of a known type and validates it against a further - * constraint. - */ -type Refiner = (value: T, context: Context) => Result; -/** - * Augment a `Struct` to add an additional coercion step to its input. - * - * This allows you to transform input data before validating it, to increase the - * likelihood that it passes validation—for example for default values, parsing - * different formats, etc. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ -declare function coerce(struct: Struct, condition: Struct, coercer: Coercer): Struct; -/** - * Augment a struct to replace `undefined` values with a default. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ -declare function defaulted(struct: Struct, fallback: any, options?: { - strict?: boolean; -}): Struct; -/** - * Augment a struct to trim string inputs. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ -declare function trimmed(struct: Struct): Struct; -/** - * Ensure that a string, array, map, or set is empty. - */ -declare function empty | Set, S extends any>(struct: Struct): Struct; -/** - * Ensure that a number or date is below a threshold. - */ -declare function max(struct: Struct, threshold: T, options?: { - exclusive?: boolean; -}): Struct; -/** - * Ensure that a number or date is above a threshold. - */ -declare function min(struct: Struct, threshold: T, options?: { - exclusive?: boolean; -}): Struct; -/** - * Ensure that a string, array, map or set is not empty. - */ -declare function nonempty | Set, S extends any>(struct: Struct): Struct; -/** - * Ensure that a string matches a regular expression. - */ -declare function pattern(struct: Struct, regexp: RegExp): Struct; -/** - * Ensure that a string, array, number, date, map, or set has a size (or length, or time) between `min` and `max`. - */ -declare function size | Set, S extends any>(struct: Struct, min: number, max?: number): Struct; -/** - * Augment a `Struct` to add an additional refinement to the validation. - * - * The refiner function is guaranteed to receive a value of the struct's type, - * because the struct's existing validation will already have passed. This - * allows you to layer additional validation on top of existing structs. - */ -declare function refine(struct: Struct, name: string, refiner: Refiner): Struct; -/** - * Ensure that any value passes validation. - */ -declare function any(): Struct; -/** - * Ensure that a value is an array and that its elements are of a specific type. - * - * Note: If you omit the element struct, the arrays elements will not be - * iterated at all. This can be helpful for cases where performance is critical, - * and it is preferred to using `array(any())`. - */ -declare function array>(Element: T): Struct[], T>; -declare function array(): Struct; -/** - * Ensure that a value is a bigint. - */ -declare function bigint(): Struct; -/** - * Ensure that a value is a boolean. - */ -declare function boolean(): Struct; -/** - * Ensure that a value is a valid `Date`. - * - * Note: this also ensures that the value is *not* an invalid `Date` object, - * which can occur when parsing a date fails but still returns a `Date`. - */ -declare function date(): Struct; -/** - * Ensure that a value is one of a set of potential values. - * - * Note: after creating the struct, you can access the definition of the - * potential values as `struct.schema`. - */ -declare function enums(values: T): Struct; -declare function enums(values: T): Struct; -/** - * Ensure that a value is a function. - */ -declare function func(): Struct; -/** - * Ensure that a value is an instance of a specific class. - */ -declare function instance(Class: T): Struct, null>; -/** - * Ensure that a value is an integer. - */ -declare function integer(): Struct; -/** - * Ensure that a value matches all of a set of types. - */ -declare function intersection(Structs: [ - A, - ...B -]): Struct & UnionToIntersection[number]>, null>; -/** - * Ensure that a value is an exact value, using `===` for comparison. - */ -declare function literal(constant: T): Struct; -declare function literal(constant: T): Struct; -declare function literal(constant: T): Struct; -declare function literal(constant: T): Struct; -/** - * Ensure that a value is a `Map` object, and that its keys and values are of - * specific types. - */ -declare function map(): Struct, null>; -declare function map(Key: Struct, Value: Struct): Struct, null>; -/** - * Ensure that no value ever passes validation. - */ -declare function never(): Struct; -/** - * Augment an existing struct to allow `null` values. - */ -declare function nullable(struct: Struct): Struct; -/** - * Ensure that a value is a number. - */ -declare function number(): Struct; -/** - * Ensure that a value is an object, that is has a known set of properties, - * and that its properties are of specific types. - * - * Note: Unrecognized properties will fail validation. - */ -declare function object(): Struct, null>; -declare function object(schema: S): Struct, S>; -/** - * Augment a struct to allow `undefined` values. - */ -declare function optional(struct: Struct): Struct; -/** - * Ensure that a value is an object with keys and values of specific types, but - * without ensuring any specific shape of properties. - * - * Like TypeScript's `Record` utility. - */ -declare function record(Key: Struct, Value: Struct): Struct, null>; -/** - * Ensure that a value is a `RegExp`. - * - * Note: this does not test the value against the regular expression! For that - * you need to use the `pattern()` refinement. - */ -declare function regexp(): Struct; -/** - * Ensure that a value is a `Set` object, and that its elements are of a - * specific type. - */ -declare function set(): Struct, null>; -declare function set(Element: Struct): Struct, null>; -/** - * Ensure that a value is a string. - */ -declare function string(): Struct; -/** - * Ensure that a value is a tuple of a specific length, and that each of its - * elements is of a specific type. - */ -declare function tuple(Structs: [ - A, - ...B -]): Struct<[ - Infer, - ...InferStructTuple -], null>; -/** - * Ensure that a value has a set of known properties of specific types. - * - * Note: Unrecognized properties are allowed and untouched. This is similar to - * how TypeScript's structural typing works. - */ -declare function type(schema: S): Struct, S>; -/** - * Ensure that a value matches one of a set of types. - */ -declare function union(Structs: [ - A, - ...B -]): Struct | InferStructTuple[number], null>; -/** - * Ensure that any value passes validation, without widening its type to `any`. - */ -declare function unknown(): Struct; -/** - * Create a new struct that combines the properties properties from multiple - * object or type structs. Its return type will match the first parameter's type. - * - * Like JavaScript's `Object.assign` utility. - */ -declare function assign(A: Struct, A>, B: Struct, B>): Struct>, Assign>; -declare function assign(A: Struct, A>, B: Struct, B>, C: Struct, C>): Struct, C>>, Assign, C>>; -declare function assign(A: Struct, A>, B: Struct, B>, C: Struct, C>, D: Struct, D>): Struct, C>, D>>, Assign, C>, D>>; -declare function assign(A: Struct, A>, B: Struct, B>, C: Struct, C>, D: Struct, D>, E: Struct, E>): Struct, C>, D>, E>>, Assign, C>, D>, E>>; -/** - * Define a new struct type with a custom validation function. - */ -declare function define(name: string, validator: Validator): Struct; -/** - * Create a new struct based on an existing struct, but the value is allowed to - * be `undefined`. `log` will be called if the value is not `undefined`. - */ -declare function deprecated(struct: Struct, log: (value: unknown, ctx: Context) => void): Struct; -/** - * Create a struct with dynamic validation logic. - * - * The callback will receive the value currently being validated, and must - * return a struct object to validate it with. This can be useful to model - * validation logic that changes based on its input. - */ -declare function dynamic(fn: (value: unknown, ctx: Context) => Struct): Struct; -/** - * Create a struct with lazily evaluated validation logic. - * - * The first time validation is run with the struct, the callback will be called - * and must return a struct object to use. This is useful for cases where you - * want to have self-referential structs for nested data structures to avoid a - * circular definition problem. - */ -declare function lazy(fn: () => Struct): Struct; -/** - * Create a new struct based on an existing object struct, but excluding - * specific properties. - * - * Like TypeScript's `Omit` utility. - */ -declare function omit(struct: Struct, S>, keys: K[]): Struct>, Omit>; -/** - * Create a new struct based on an existing object struct, but with all of its - * properties allowed to be `undefined`. - * - * Like TypeScript's `Partial` utility. - */ -declare function partial(struct: Struct, S> | S): Struct>, PartialObjectSchema>; -/** - * Create a new struct based on an existing object struct, but only including - * specific properties. - * - * Like TypeScript's `Pick` utility. - */ -declare function pick(struct: Struct, S>, keys: K[]): Struct>, Pick>; -/** - * Define a new struct type with a custom validation function. - * - * @deprecated This function has been renamed to `define`. - */ -declare function struct(name: string, validator: Validator): Struct; -export { Failure, StructError, Struct, assert, create, mask, is, validate, Context, Infer, Describe, Result, Coercer, Validator, Refiner, coerce, defaulted, trimmed, empty, max, min, nonempty, pattern, size, refine, any, array, bigint, boolean, date, enums, func, instance, integer, intersection, literal, map, never, nullable, number, object, optional, record, regexp, set, string, tuple, type, union, unknown, assign, define, deprecated, dynamic, lazy, omit, partial, pick, struct }; diff --git a/node_modules/superstruct/umd/superstruct.js b/node_modules/superstruct/umd/superstruct.js deleted file mode 100644 index ace968357..000000000 --- a/node_modules/superstruct/umd/superstruct.js +++ /dev/null @@ -1,1252 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Superstruct = {})); -})(this, (function (exports) { 'use strict'; - - /** - * A `StructFailure` represents a single specific failure in validation. - */ - - /** - * `StructError` objects are thrown (or returned) when validation fails. - * - * Validation logic is design to exit early for maximum performance. The error - * represents the first error encountered during validation. For more detail, - * the `error.failures` property is a generator function that can be run to - * continue validation and receive all the failures in the data. - */ - class StructError extends TypeError { - constructor(failure, failures) { - let cached; - const { - message, - ...rest - } = failure; - const { - path - } = failure; - const msg = path.length === 0 ? message : `At path: ${path.join('.')} -- ${message}`; - super(msg); - this.value = void 0; - this.key = void 0; - this.type = void 0; - this.refinement = void 0; - this.path = void 0; - this.branch = void 0; - this.failures = void 0; - Object.assign(this, rest); - this.name = this.constructor.name; - - this.failures = () => { - return cached ?? (cached = [failure, ...failures()]); - }; - } - - } - - /** - * Check if a value is an iterator. - */ - function isIterable(x) { - return isObject(x) && typeof x[Symbol.iterator] === 'function'; - } - /** - * Check if a value is a plain object. - */ - - - function isObject(x) { - return typeof x === 'object' && x != null; - } - /** - * Check if a value is a plain object. - */ - - function isPlainObject(x) { - if (Object.prototype.toString.call(x) !== '[object Object]') { - return false; - } - - const prototype = Object.getPrototypeOf(x); - return prototype === null || prototype === Object.prototype; - } - /** - * Return a value as a printable string. - */ - - function print(value) { - return typeof value === 'string' ? JSON.stringify(value) : `${value}`; - } - /** - * Shifts (removes and returns) the first value from the `input` iterator. - * Like `Array.prototype.shift()` but for an `Iterator`. - */ - - function shiftIterator(input) { - const { - done, - value - } = input.next(); - return done ? undefined : value; - } - /** - * Convert a single validation result to a failure. - */ - - function toFailure(result, context, struct, value) { - if (result === true) { - return; - } else if (result === false) { - result = {}; - } else if (typeof result === 'string') { - result = { - message: result - }; - } - - const { - path, - branch - } = context; - const { - type - } = struct; - const { - refinement, - message = `Expected a value of type \`${type}\`${refinement ? ` with refinement \`${refinement}\`` : ''}, but received: \`${print(value)}\`` - } = result; - return { - value, - type, - refinement, - key: path[path.length - 1], - path, - branch, - ...result, - message - }; - } - /** - * Convert a validation result to an iterable of failures. - */ - - function* toFailures(result, context, struct, value) { - if (!isIterable(result)) { - result = [result]; - } - - for (const r of result) { - const failure = toFailure(r, context, struct, value); - - if (failure) { - yield failure; - } - } - } - /** - * Check a value against a struct, traversing deeply into nested values, and - * returning an iterator of failures or success. - */ - - function* run(value, struct, options) { - if (options === void 0) { - options = {}; - } - - const { - path = [], - branch = [value], - coerce = false, - mask = false - } = options; - const ctx = { - path, - branch - }; - - if (coerce) { - value = struct.coercer(value, ctx); - - if (mask && struct.type !== 'type' && isObject(struct.schema) && isObject(value) && !Array.isArray(value)) { - for (const key in value) { - if (struct.schema[key] === undefined) { - delete value[key]; - } - } - } - } - - let status = 'valid'; - - for (const failure of struct.validator(value, ctx)) { - status = 'not_valid'; - yield [failure, undefined]; - } - - for (let [k, v, s] of struct.entries(value, ctx)) { - const ts = run(v, s, { - path: k === undefined ? path : [...path, k], - branch: k === undefined ? branch : [...branch, v], - coerce, - mask - }); - - for (const t of ts) { - if (t[0]) { - status = t[0].refinement != null ? 'not_refined' : 'not_valid'; - yield [t[0], undefined]; - } else if (coerce) { - v = t[1]; - - if (k === undefined) { - value = v; - } else if (value instanceof Map) { - value.set(k, v); - } else if (value instanceof Set) { - value.add(v); - } else if (isObject(value)) { - if (v !== undefined) value[k] = v; - } - } - } - } - - if (status !== 'not_valid') { - for (const failure of struct.refiner(value, ctx)) { - status = 'not_refined'; - yield [failure, undefined]; - } - } - - if (status === 'valid') { - yield [undefined, value]; - } - } - - /** - * `Struct` objects encapsulate the validation logic for a specific type of - * values. Once constructed, you use the `assert`, `is` or `validate` helpers to - * validate unknown input data against the struct. - */ - - class Struct { - constructor(props) { - this.TYPE = void 0; - this.type = void 0; - this.schema = void 0; - this.coercer = void 0; - this.validator = void 0; - this.refiner = void 0; - this.entries = void 0; - const { - type, - schema, - validator, - refiner, - coercer = value => value, - entries = function* () {} - } = props; - this.type = type; - this.schema = schema; - this.entries = entries; - this.coercer = coercer; - - if (validator) { - this.validator = (value, context) => { - const result = validator(value, context); - return toFailures(result, context, this, value); - }; - } else { - this.validator = () => []; - } - - if (refiner) { - this.refiner = (value, context) => { - const result = refiner(value, context); - return toFailures(result, context, this, value); - }; - } else { - this.refiner = () => []; - } - } - /** - * Assert that a value passes the struct's validation, throwing if it doesn't. - */ - - - assert(value) { - return assert(value, this); - } - /** - * Create a value with the struct's coercion logic, then validate it. - */ - - - create(value) { - return create(value, this); - } - /** - * Check if a value passes the struct's validation. - */ - - - is(value) { - return is(value, this); - } - /** - * Mask a value, coercing and validating it, but returning only the subset of - * properties defined by the struct's schema. - */ - - - mask(value) { - return mask(value, this); - } - /** - * Validate a value with the struct's validation logic, returning a tuple - * representing the result. - * - * You may optionally pass `true` for the `withCoercion` argument to coerce - * the value before attempting to validate it. If you do, the result will - * contain the coerced result when successful. - */ - - - validate(value, options) { - if (options === void 0) { - options = {}; - } - - return validate(value, this, options); - } - - } - /** - * Assert that a value passes a struct, throwing if it doesn't. - */ - - function assert(value, struct) { - const result = validate(value, struct); - - if (result[0]) { - throw result[0]; - } - } - /** - * Create a value with the coercion logic of struct and validate it. - */ - - function create(value, struct) { - const result = validate(value, struct, { - coerce: true - }); - - if (result[0]) { - throw result[0]; - } else { - return result[1]; - } - } - /** - * Mask a value, returning only the subset of properties defined by a struct. - */ - - function mask(value, struct) { - const result = validate(value, struct, { - coerce: true, - mask: true - }); - - if (result[0]) { - throw result[0]; - } else { - return result[1]; - } - } - /** - * Check if a value passes a struct. - */ - - function is(value, struct) { - const result = validate(value, struct); - return !result[0]; - } - /** - * Validate a value against a struct, returning an error if invalid, or the - * value (with potential coercion) if valid. - */ - - function validate(value, struct, options) { - if (options === void 0) { - options = {}; - } - - const tuples = run(value, struct, options); - const tuple = shiftIterator(tuples); - - if (tuple[0]) { - const error = new StructError(tuple[0], function* () { - for (const t of tuples) { - if (t[0]) { - yield t[0]; - } - } - }); - return [error, undefined]; - } else { - const v = tuple[1]; - return [undefined, v]; - } - } - - function assign() { - for (var _len = arguments.length, Structs = new Array(_len), _key = 0; _key < _len; _key++) { - Structs[_key] = arguments[_key]; - } - - const isType = Structs[0].type === 'type'; - const schemas = Structs.map(s => s.schema); - const schema = Object.assign({}, ...schemas); - return isType ? type(schema) : object(schema); - } - /** - * Define a new struct type with a custom validation function. - */ - - function define(name, validator) { - return new Struct({ - type: name, - schema: null, - validator - }); - } - /** - * Create a new struct based on an existing struct, but the value is allowed to - * be `undefined`. `log` will be called if the value is not `undefined`. - */ - - function deprecated(struct, log) { - return new Struct({ ...struct, - refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx), - - validator(value, ctx) { - if (value === undefined) { - return true; - } else { - log(value, ctx); - return struct.validator(value, ctx); - } - } - - }); - } - /** - * Create a struct with dynamic validation logic. - * - * The callback will receive the value currently being validated, and must - * return a struct object to validate it with. This can be useful to model - * validation logic that changes based on its input. - */ - - function dynamic(fn) { - return new Struct({ - type: 'dynamic', - schema: null, - - *entries(value, ctx) { - const struct = fn(value, ctx); - yield* struct.entries(value, ctx); - }, - - validator(value, ctx) { - const struct = fn(value, ctx); - return struct.validator(value, ctx); - }, - - coercer(value, ctx) { - const struct = fn(value, ctx); - return struct.coercer(value, ctx); - }, - - refiner(value, ctx) { - const struct = fn(value, ctx); - return struct.refiner(value, ctx); - } - - }); - } - /** - * Create a struct with lazily evaluated validation logic. - * - * The first time validation is run with the struct, the callback will be called - * and must return a struct object to use. This is useful for cases where you - * want to have self-referential structs for nested data structures to avoid a - * circular definition problem. - */ - - function lazy(fn) { - let struct; - return new Struct({ - type: 'lazy', - schema: null, - - *entries(value, ctx) { - struct ?? (struct = fn()); - yield* struct.entries(value, ctx); - }, - - validator(value, ctx) { - struct ?? (struct = fn()); - return struct.validator(value, ctx); - }, - - coercer(value, ctx) { - struct ?? (struct = fn()); - return struct.coercer(value, ctx); - }, - - refiner(value, ctx) { - struct ?? (struct = fn()); - return struct.refiner(value, ctx); - } - - }); - } - /** - * Create a new struct based on an existing object struct, but excluding - * specific properties. - * - * Like TypeScript's `Omit` utility. - */ - - function omit(struct, keys) { - const { - schema - } = struct; - const subschema = { ...schema - }; - - for (const key of keys) { - delete subschema[key]; - } - - switch (struct.type) { - case 'type': - return type(subschema); - - default: - return object(subschema); - } - } - /** - * Create a new struct based on an existing object struct, but with all of its - * properties allowed to be `undefined`. - * - * Like TypeScript's `Partial` utility. - */ - - function partial(struct) { - const schema = struct instanceof Struct ? { ...struct.schema - } : { ...struct - }; - - for (const key in schema) { - schema[key] = optional(schema[key]); - } - - return object(schema); - } - /** - * Create a new struct based on an existing object struct, but only including - * specific properties. - * - * Like TypeScript's `Pick` utility. - */ - - function pick(struct, keys) { - const { - schema - } = struct; - const subschema = {}; - - for (const key of keys) { - subschema[key] = schema[key]; - } - - return object(subschema); - } - /** - * Define a new struct type with a custom validation function. - * - * @deprecated This function has been renamed to `define`. - */ - - function struct(name, validator) { - console.warn('superstruct@0.11 - The `struct` helper has been renamed to `define`.'); - return define(name, validator); - } - - /** - * Ensure that any value passes validation. - */ - - function any() { - return define('any', () => true); - } - function array(Element) { - return new Struct({ - type: 'array', - schema: Element, - - *entries(value) { - if (Element && Array.isArray(value)) { - for (const [i, v] of value.entries()) { - yield [i, v, Element]; - } - } - }, - - coercer(value) { - return Array.isArray(value) ? value.slice() : value; - }, - - validator(value) { - return Array.isArray(value) || `Expected an array value, but received: ${print(value)}`; - } - - }); - } - /** - * Ensure that a value is a bigint. - */ - - function bigint() { - return define('bigint', value => { - return typeof value === 'bigint'; - }); - } - /** - * Ensure that a value is a boolean. - */ - - function boolean() { - return define('boolean', value => { - return typeof value === 'boolean'; - }); - } - /** - * Ensure that a value is a valid `Date`. - * - * Note: this also ensures that the value is *not* an invalid `Date` object, - * which can occur when parsing a date fails but still returns a `Date`. - */ - - function date() { - return define('date', value => { - return value instanceof Date && !isNaN(value.getTime()) || `Expected a valid \`Date\` object, but received: ${print(value)}`; - }); - } - function enums(values) { - const schema = {}; - const description = values.map(v => print(v)).join(); - - for (const key of values) { - schema[key] = key; - } - - return new Struct({ - type: 'enums', - schema, - - validator(value) { - return values.includes(value) || `Expected one of \`${description}\`, but received: ${print(value)}`; - } - - }); - } - /** - * Ensure that a value is a function. - */ - - function func() { - return define('func', value => { - return typeof value === 'function' || `Expected a function, but received: ${print(value)}`; - }); - } - /** - * Ensure that a value is an instance of a specific class. - */ - - function instance(Class) { - return define('instance', value => { - return value instanceof Class || `Expected a \`${Class.name}\` instance, but received: ${print(value)}`; - }); - } - /** - * Ensure that a value is an integer. - */ - - function integer() { - return define('integer', value => { - return typeof value === 'number' && !isNaN(value) && Number.isInteger(value) || `Expected an integer, but received: ${print(value)}`; - }); - } - /** - * Ensure that a value matches all of a set of types. - */ - - function intersection(Structs) { - return new Struct({ - type: 'intersection', - schema: null, - - *entries(value, ctx) { - for (const S of Structs) { - yield* S.entries(value, ctx); - } - }, - - *validator(value, ctx) { - for (const S of Structs) { - yield* S.validator(value, ctx); - } - }, - - *refiner(value, ctx) { - for (const S of Structs) { - yield* S.refiner(value, ctx); - } - } - - }); - } - function literal(constant) { - const description = print(constant); - const t = typeof constant; - return new Struct({ - type: 'literal', - schema: t === 'string' || t === 'number' || t === 'boolean' ? constant : null, - - validator(value) { - return value === constant || `Expected the literal \`${description}\`, but received: ${print(value)}`; - } - - }); - } - function map(Key, Value) { - return new Struct({ - type: 'map', - schema: null, - - *entries(value) { - if (Key && Value && value instanceof Map) { - for (const [k, v] of value.entries()) { - yield [k, k, Key]; - yield [k, v, Value]; - } - } - }, - - coercer(value) { - return value instanceof Map ? new Map(value) : value; - }, - - validator(value) { - return value instanceof Map || `Expected a \`Map\` object, but received: ${print(value)}`; - } - - }); - } - /** - * Ensure that no value ever passes validation. - */ - - function never() { - return define('never', () => false); - } - /** - * Augment an existing struct to allow `null` values. - */ - - function nullable(struct) { - return new Struct({ ...struct, - validator: (value, ctx) => value === null || struct.validator(value, ctx), - refiner: (value, ctx) => value === null || struct.refiner(value, ctx) - }); - } - /** - * Ensure that a value is a number. - */ - - function number() { - return define('number', value => { - return typeof value === 'number' && !isNaN(value) || `Expected a number, but received: ${print(value)}`; - }); - } - function object(schema) { - const knowns = schema ? Object.keys(schema) : []; - const Never = never(); - return new Struct({ - type: 'object', - schema: schema ? schema : null, - - *entries(value) { - if (schema && isObject(value)) { - const unknowns = new Set(Object.keys(value)); - - for (const key of knowns) { - unknowns.delete(key); - yield [key, value[key], schema[key]]; - } - - for (const key of unknowns) { - yield [key, value[key], Never]; - } - } - }, - - validator(value) { - return isObject(value) || `Expected an object, but received: ${print(value)}`; - }, - - coercer(value) { - return isObject(value) ? { ...value - } : value; - } - - }); - } - /** - * Augment a struct to allow `undefined` values. - */ - - function optional(struct) { - return new Struct({ ...struct, - validator: (value, ctx) => value === undefined || struct.validator(value, ctx), - refiner: (value, ctx) => value === undefined || struct.refiner(value, ctx) - }); - } - /** - * Ensure that a value is an object with keys and values of specific types, but - * without ensuring any specific shape of properties. - * - * Like TypeScript's `Record` utility. - */ - - function record(Key, Value) { - return new Struct({ - type: 'record', - schema: null, - - *entries(value) { - if (isObject(value)) { - for (const k in value) { - const v = value[k]; - yield [k, k, Key]; - yield [k, v, Value]; - } - } - }, - - validator(value) { - return isObject(value) || `Expected an object, but received: ${print(value)}`; - } - - }); - } - /** - * Ensure that a value is a `RegExp`. - * - * Note: this does not test the value against the regular expression! For that - * you need to use the `pattern()` refinement. - */ - - function regexp() { - return define('regexp', value => { - return value instanceof RegExp; - }); - } - function set(Element) { - return new Struct({ - type: 'set', - schema: null, - - *entries(value) { - if (Element && value instanceof Set) { - for (const v of value) { - yield [v, v, Element]; - } - } - }, - - coercer(value) { - return value instanceof Set ? new Set(value) : value; - }, - - validator(value) { - return value instanceof Set || `Expected a \`Set\` object, but received: ${print(value)}`; - } - - }); - } - /** - * Ensure that a value is a string. - */ - - function string() { - return define('string', value => { - return typeof value === 'string' || `Expected a string, but received: ${print(value)}`; - }); - } - /** - * Ensure that a value is a tuple of a specific length, and that each of its - * elements is of a specific type. - */ - - function tuple(Structs) { - const Never = never(); - return new Struct({ - type: 'tuple', - schema: null, - - *entries(value) { - if (Array.isArray(value)) { - const length = Math.max(Structs.length, value.length); - - for (let i = 0; i < length; i++) { - yield [i, value[i], Structs[i] || Never]; - } - } - }, - - validator(value) { - return Array.isArray(value) || `Expected an array, but received: ${print(value)}`; - } - - }); - } - /** - * Ensure that a value has a set of known properties of specific types. - * - * Note: Unrecognized properties are allowed and untouched. This is similar to - * how TypeScript's structural typing works. - */ - - function type(schema) { - const keys = Object.keys(schema); - return new Struct({ - type: 'type', - schema, - - *entries(value) { - if (isObject(value)) { - for (const k of keys) { - yield [k, value[k], schema[k]]; - } - } - }, - - validator(value) { - return isObject(value) || `Expected an object, but received: ${print(value)}`; - } - - }); - } - /** - * Ensure that a value matches one of a set of types. - */ - - function union(Structs) { - const description = Structs.map(s => s.type).join(' | '); - return new Struct({ - type: 'union', - schema: null, - - coercer(value, ctx) { - const firstMatch = Structs.find(s => { - const [e] = s.validate(value, { - coerce: true - }); - return !e; - }) || unknown(); - return firstMatch.coercer(value, ctx); - }, - - validator(value, ctx) { - const failures = []; - - for (const S of Structs) { - const [...tuples] = run(value, S, ctx); - const [first] = tuples; - - if (!first[0]) { - return []; - } else { - for (const [failure] of tuples) { - if (failure) { - failures.push(failure); - } - } - } - } - - return [`Expected the value to satisfy a union of \`${description}\`, but received: ${print(value)}`, ...failures]; - } - - }); - } - /** - * Ensure that any value passes validation, without widening its type to `any`. - */ - - function unknown() { - return define('unknown', () => true); - } - - /** - * Augment a `Struct` to add an additional coercion step to its input. - * - * This allows you to transform input data before validating it, to increase the - * likelihood that it passes validation—for example for default values, parsing - * different formats, etc. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ - - function coerce(struct, condition, coercer) { - return new Struct({ ...struct, - coercer: (value, ctx) => { - return is(value, condition) ? struct.coercer(coercer(value, ctx), ctx) : struct.coercer(value, ctx); - } - }); - } - /** - * Augment a struct to replace `undefined` values with a default. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ - - function defaulted(struct, fallback, options) { - if (options === void 0) { - options = {}; - } - - return coerce(struct, unknown(), x => { - const f = typeof fallback === 'function' ? fallback() : fallback; - - if (x === undefined) { - return f; - } - - if (!options.strict && isPlainObject(x) && isPlainObject(f)) { - const ret = { ...x - }; - let changed = false; - - for (const key in f) { - if (ret[key] === undefined) { - ret[key] = f[key]; - changed = true; - } - } - - if (changed) { - return ret; - } - } - - return x; - }); - } - /** - * Augment a struct to trim string inputs. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ - - function trimmed(struct) { - return coerce(struct, string(), x => x.trim()); - } - - /** - * Ensure that a string, array, map, or set is empty. - */ - - function empty(struct) { - return refine(struct, 'empty', value => { - const size = getSize(value); - return size === 0 || `Expected an empty ${struct.type} but received one with a size of \`${size}\``; - }); - } - - function getSize(value) { - if (value instanceof Map || value instanceof Set) { - return value.size; - } else { - return value.length; - } - } - /** - * Ensure that a number or date is below a threshold. - */ - - - function max(struct, threshold, options) { - if (options === void 0) { - options = {}; - } - - const { - exclusive - } = options; - return refine(struct, 'max', value => { - return exclusive ? value < threshold : value <= threshold || `Expected a ${struct.type} less than ${exclusive ? '' : 'or equal to '}${threshold} but received \`${value}\``; - }); - } - /** - * Ensure that a number or date is above a threshold. - */ - - function min(struct, threshold, options) { - if (options === void 0) { - options = {}; - } - - const { - exclusive - } = options; - return refine(struct, 'min', value => { - return exclusive ? value > threshold : value >= threshold || `Expected a ${struct.type} greater than ${exclusive ? '' : 'or equal to '}${threshold} but received \`${value}\``; - }); - } - /** - * Ensure that a string, array, map or set is not empty. - */ - - function nonempty(struct) { - return refine(struct, 'nonempty', value => { - const size = getSize(value); - return size > 0 || `Expected a nonempty ${struct.type} but received an empty one`; - }); - } - /** - * Ensure that a string matches a regular expression. - */ - - function pattern(struct, regexp) { - return refine(struct, 'pattern', value => { - return regexp.test(value) || `Expected a ${struct.type} matching \`/${regexp.source}/\` but received "${value}"`; - }); - } - /** - * Ensure that a string, array, number, date, map, or set has a size (or length, or time) between `min` and `max`. - */ - - function size(struct, min, max) { - if (max === void 0) { - max = min; - } - - const expected = `Expected a ${struct.type}`; - const of = min === max ? `of \`${min}\`` : `between \`${min}\` and \`${max}\``; - return refine(struct, 'size', value => { - if (typeof value === 'number' || value instanceof Date) { - return min <= value && value <= max || `${expected} ${of} but received \`${value}\``; - } else if (value instanceof Map || value instanceof Set) { - const { - size - } = value; - return min <= size && size <= max || `${expected} with a size ${of} but received one with a size of \`${size}\``; - } else { - const { - length - } = value; - return min <= length && length <= max || `${expected} with a length ${of} but received one with a length of \`${length}\``; - } - }); - } - /** - * Augment a `Struct` to add an additional refinement to the validation. - * - * The refiner function is guaranteed to receive a value of the struct's type, - * because the struct's existing validation will already have passed. This - * allows you to layer additional validation on top of existing structs. - */ - - function refine(struct, name, refiner) { - return new Struct({ ...struct, - - *refiner(value, ctx) { - yield* struct.refiner(value, ctx); - const result = refiner(value, ctx); - const failures = toFailures(result, ctx, struct, value); - - for (const failure of failures) { - yield { ...failure, - refinement: name - }; - } - } - - }); - } - - exports.Struct = Struct; - exports.StructError = StructError; - exports.any = any; - exports.array = array; - exports.assert = assert; - exports.assign = assign; - exports.bigint = bigint; - exports.boolean = boolean; - exports.coerce = coerce; - exports.create = create; - exports.date = date; - exports.defaulted = defaulted; - exports.define = define; - exports.deprecated = deprecated; - exports.dynamic = dynamic; - exports.empty = empty; - exports.enums = enums; - exports.func = func; - exports.instance = instance; - exports.integer = integer; - exports.intersection = intersection; - exports.is = is; - exports.lazy = lazy; - exports.literal = literal; - exports.map = map; - exports.mask = mask; - exports.max = max; - exports.min = min; - exports.never = never; - exports.nonempty = nonempty; - exports.nullable = nullable; - exports.number = number; - exports.object = object; - exports.omit = omit; - exports.optional = optional; - exports.partial = partial; - exports.pattern = pattern; - exports.pick = pick; - exports.record = record; - exports.refine = refine; - exports.regexp = regexp; - exports.set = set; - exports.size = size; - exports.string = string; - exports.struct = struct; - exports.trimmed = trimmed; - exports.tuple = tuple; - exports.type = type; - exports.union = union; - exports.unknown = unknown; - exports.validate = validate; - - Object.defineProperty(exports, '__esModule', { value: true }); - -})); diff --git a/node_modules/superstruct/umd/superstruct.min.d.ts b/node_modules/superstruct/umd/superstruct.min.d.ts deleted file mode 100644 index 47dce3dff..000000000 --- a/node_modules/superstruct/umd/superstruct.min.d.ts +++ /dev/null @@ -1,579 +0,0 @@ -/** - * A `StructFailure` represents a single specific failure in validation. - */ -type Failure = { - value: any; - key: any; - type: string; - refinement: string | undefined; - message: string; - branch: Array; - path: Array; -}; -/** - * `StructError` objects are thrown (or returned) when validation fails. - * - * Validation logic is design to exit early for maximum performance. The error - * represents the first error encountered during validation. For more detail, - * the `error.failures` property is a generator function that can be run to - * continue validation and receive all the failures in the data. - */ -declare class StructError extends TypeError { - value: any; - key: any; - type: string; - refinement: string | undefined; - path: Array; - branch: Array; - failures: () => Array; - [x: string]: any; - constructor(failure: Failure, failures: () => Generator); -} -/** - * Convert a union of type to an intersection. - */ -type UnionToIntersection = (U extends any ? (arg: U) => any : never) extends (arg: infer I) => void ? I : never; -/** - * Assign properties from one type to another, overwriting existing. - */ -type Assign = Simplify>; -/** - * A schema for enum structs. - */ -type EnumSchema = { - [K in NonNullable]: K; -}; -/** - * Check if a type is a match for another whilst treating overlapping - * unions as a match. - */ -type IsMatch = T extends G ? (G extends T ? T : never) : never; -/** - * Check if a type is an exact match. - */ -type IsExactMatch = (() => G extends T ? 1 : 2) extends () => G extends U ? 1 : 2 ? T : never; -/** - * Check if a type is a record type. - */ -type IsRecord = T extends object ? string extends keyof T ? T : never : never; -/** - * Check if a type is a tuple. - */ -type IsTuple = T extends [ - any -] ? T : T extends [ - any, - any -] ? T : T extends [ - any, - any, - any -] ? T : T extends [ - any, - any, - any, - any -] ? T : T extends [ - any, - any, - any, - any, - any -] ? T : never; -/** - * Check if a type is a union. - */ -type IsUnion = (T extends any ? (U extends T ? false : true) : false) extends false ? never : T; -/** - * A schema for object structs. - */ -type ObjectSchema = Record>; -/** - * Infer a type from an object struct schema. - */ -type ObjectType = Simplify; -}>>; -/** - * Omit properties from a type that extend from a specific type. - */ -type OmitBy = Omit ? K : never; -}[keyof T]>; -/** - * Normalize properties of a type that allow `undefined` to make them optional. - */ -type Optionalize = OmitBy & Partial>; -/** - * Transform an object schema type to represent a partial. - */ -type PartialObjectSchema = { - [K in keyof S]: Struct | undefined>; -}; -/** - * Pick properties from a type that extend from a specific type. - */ -type PickBy = Pick ? K : never; -}[keyof T]>; -/** - * Simplifies a type definition to its most basic representation. - */ -type Simplify = T extends any[] | Date ? T : { - [K in keyof T]: T[K]; -} & {}; -/** - * A schema for any type of struct. - */ -type StructSchema = [ - T -] extends [ - string | undefined -] ? [ - T -] extends [ - IsMatch -] ? null : [ - T -] extends [ - IsUnion -] ? EnumSchema : T : [ - T -] extends [ - number | undefined -] ? [ - T -] extends [ - IsMatch -] ? null : [ - T -] extends [ - IsUnion -] ? EnumSchema : T : [ - T -] extends [ - boolean -] ? [ - T -] extends [ - IsExactMatch -] ? null : T : T extends bigint | symbol | undefined | null | Function | Date | Error | RegExp | Map | WeakMap | Set | WeakSet | Promise ? null : T extends Array ? T extends IsTuple ? null : Struct : T extends object ? T extends IsRecord ? null : { - [K in keyof T]: Describe; -} : null; -/** - * Shorthand type for matching any `Struct`. - */ -type AnyStruct = Struct; -/** - * Infer a tuple of types from a tuple of `Struct`s. - * - * This is used to recursively retrieve the type from `union` `intersection` and - * `tuple` structs. - */ -type InferStructTuple = Length extends Length ? number extends Length ? Tuple : _InferTuple : never; -type _InferTuple = Index extends Length ? Accumulated : _InferTuple -]>; -/** - * `Struct` objects encapsulate the validation logic for a specific type of - * values. Once constructed, you use the `assert`, `is` or `validate` helpers to - * validate unknown input data against the struct. - */ -declare class Struct { - readonly TYPE: T; - type: string; - schema: S; - coercer: (value: unknown, context: Context) => unknown; - validator: (value: unknown, context: Context) => Iterable; - refiner: (value: T, context: Context) => Iterable; - entries: (value: unknown, context: Context) => Iterable<[ - string | number, - unknown, - Struct | Struct - ]>; - constructor(props: { - type: string; - schema: S; - coercer?: Coercer; - validator?: Validator; - refiner?: Refiner; - entries?: Struct["entries"]; - }); - /** - * Assert that a value passes the struct's validation, throwing if it doesn't. - */ - assert(value: unknown): asserts value is T; - /** - * Create a value with the struct's coercion logic, then validate it. - */ - create(value: unknown): T; - /** - * Check if a value passes the struct's validation. - */ - is(value: unknown): value is T; - /** - * Mask a value, coercing and validating it, but returning only the subset of - * properties defined by the struct's schema. - */ - mask(value: unknown): T; - /** - * Validate a value with the struct's validation logic, returning a tuple - * representing the result. - * - * You may optionally pass `true` for the `withCoercion` argument to coerce - * the value before attempting to validate it. If you do, the result will - * contain the coerced result when successful. - */ - validate(value: unknown, options?: { - coerce?: boolean; - }): [ - StructError, - undefined - ] | [ - undefined, - T - ]; -} -/** - * Assert that a value passes a struct, throwing if it doesn't. - */ -declare function assert(value: unknown, struct: Struct): asserts value is T; -/** - * Create a value with the coercion logic of struct and validate it. - */ -declare function create(value: unknown, struct: Struct): T; -/** - * Mask a value, returning only the subset of properties defined by a struct. - */ -declare function mask(value: unknown, struct: Struct): T; -/** - * Check if a value passes a struct. - */ -declare function is(value: unknown, struct: Struct): value is T; -/** - * Validate a value against a struct, returning an error if invalid, or the - * value (with potential coercion) if valid. - */ -declare function validate(value: unknown, struct: Struct, options?: { - coerce?: boolean; - mask?: boolean; -}): [ - StructError, - undefined -] | [ - undefined, - T -]; -/** - * A `Context` contains information about the current location of the - * validation inside the initial input value. - */ -type Context = { - branch: Array; - path: Array; -}; -/** - * A type utility to extract the type from a `Struct` class. - */ -type Infer> = T["TYPE"]; -/** - * A type utility to describe that a struct represents a TypeScript type. - */ -type Describe = Struct>; -/** - * A `Result` is returned from validation functions. - */ -type Result = boolean | string | Partial | Iterable>; -/** - * A `Coercer` takes an unknown value and optionally coerces it. - */ -type Coercer = (value: T, context: Context) => unknown; -/** - * A `Validator` takes an unknown value and validates it. - */ -type Validator = (value: unknown, context: Context) => Result; -/** - * A `Refiner` takes a value of a known type and validates it against a further - * constraint. - */ -type Refiner = (value: T, context: Context) => Result; -/** - * Augment a `Struct` to add an additional coercion step to its input. - * - * This allows you to transform input data before validating it, to increase the - * likelihood that it passes validation—for example for default values, parsing - * different formats, etc. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ -declare function coerce(struct: Struct, condition: Struct, coercer: Coercer): Struct; -/** - * Augment a struct to replace `undefined` values with a default. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ -declare function defaulted(struct: Struct, fallback: any, options?: { - strict?: boolean; -}): Struct; -/** - * Augment a struct to trim string inputs. - * - * Note: You must use `create(value, Struct)` on the value to have the coercion - * take effect! Using simply `assert()` or `is()` will not use coercion. - */ -declare function trimmed(struct: Struct): Struct; -/** - * Ensure that a string, array, map, or set is empty. - */ -declare function empty | Set, S extends any>(struct: Struct): Struct; -/** - * Ensure that a number or date is below a threshold. - */ -declare function max(struct: Struct, threshold: T, options?: { - exclusive?: boolean; -}): Struct; -/** - * Ensure that a number or date is above a threshold. - */ -declare function min(struct: Struct, threshold: T, options?: { - exclusive?: boolean; -}): Struct; -/** - * Ensure that a string, array, map or set is not empty. - */ -declare function nonempty | Set, S extends any>(struct: Struct): Struct; -/** - * Ensure that a string matches a regular expression. - */ -declare function pattern(struct: Struct, regexp: RegExp): Struct; -/** - * Ensure that a string, array, number, date, map, or set has a size (or length, or time) between `min` and `max`. - */ -declare function size | Set, S extends any>(struct: Struct, min: number, max?: number): Struct; -/** - * Augment a `Struct` to add an additional refinement to the validation. - * - * The refiner function is guaranteed to receive a value of the struct's type, - * because the struct's existing validation will already have passed. This - * allows you to layer additional validation on top of existing structs. - */ -declare function refine(struct: Struct, name: string, refiner: Refiner): Struct; -/** - * Ensure that any value passes validation. - */ -declare function any(): Struct; -/** - * Ensure that a value is an array and that its elements are of a specific type. - * - * Note: If you omit the element struct, the arrays elements will not be - * iterated at all. This can be helpful for cases where performance is critical, - * and it is preferred to using `array(any())`. - */ -declare function array>(Element: T): Struct[], T>; -declare function array(): Struct; -/** - * Ensure that a value is a bigint. - */ -declare function bigint(): Struct; -/** - * Ensure that a value is a boolean. - */ -declare function boolean(): Struct; -/** - * Ensure that a value is a valid `Date`. - * - * Note: this also ensures that the value is *not* an invalid `Date` object, - * which can occur when parsing a date fails but still returns a `Date`. - */ -declare function date(): Struct; -/** - * Ensure that a value is one of a set of potential values. - * - * Note: after creating the struct, you can access the definition of the - * potential values as `struct.schema`. - */ -declare function enums(values: T): Struct; -declare function enums(values: T): Struct; -/** - * Ensure that a value is a function. - */ -declare function func(): Struct; -/** - * Ensure that a value is an instance of a specific class. - */ -declare function instance(Class: T): Struct, null>; -/** - * Ensure that a value is an integer. - */ -declare function integer(): Struct; -/** - * Ensure that a value matches all of a set of types. - */ -declare function intersection(Structs: [ - A, - ...B -]): Struct & UnionToIntersection[number]>, null>; -/** - * Ensure that a value is an exact value, using `===` for comparison. - */ -declare function literal(constant: T): Struct; -declare function literal(constant: T): Struct; -declare function literal(constant: T): Struct; -declare function literal(constant: T): Struct; -/** - * Ensure that a value is a `Map` object, and that its keys and values are of - * specific types. - */ -declare function map(): Struct, null>; -declare function map(Key: Struct, Value: Struct): Struct, null>; -/** - * Ensure that no value ever passes validation. - */ -declare function never(): Struct; -/** - * Augment an existing struct to allow `null` values. - */ -declare function nullable(struct: Struct): Struct; -/** - * Ensure that a value is a number. - */ -declare function number(): Struct; -/** - * Ensure that a value is an object, that is has a known set of properties, - * and that its properties are of specific types. - * - * Note: Unrecognized properties will fail validation. - */ -declare function object(): Struct, null>; -declare function object(schema: S): Struct, S>; -/** - * Augment a struct to allow `undefined` values. - */ -declare function optional(struct: Struct): Struct; -/** - * Ensure that a value is an object with keys and values of specific types, but - * without ensuring any specific shape of properties. - * - * Like TypeScript's `Record` utility. - */ -declare function record(Key: Struct, Value: Struct): Struct, null>; -/** - * Ensure that a value is a `RegExp`. - * - * Note: this does not test the value against the regular expression! For that - * you need to use the `pattern()` refinement. - */ -declare function regexp(): Struct; -/** - * Ensure that a value is a `Set` object, and that its elements are of a - * specific type. - */ -declare function set(): Struct, null>; -declare function set(Element: Struct): Struct, null>; -/** - * Ensure that a value is a string. - */ -declare function string(): Struct; -/** - * Ensure that a value is a tuple of a specific length, and that each of its - * elements is of a specific type. - */ -declare function tuple(Structs: [ - A, - ...B -]): Struct<[ - Infer, - ...InferStructTuple -], null>; -/** - * Ensure that a value has a set of known properties of specific types. - * - * Note: Unrecognized properties are allowed and untouched. This is similar to - * how TypeScript's structural typing works. - */ -declare function type(schema: S): Struct, S>; -/** - * Ensure that a value matches one of a set of types. - */ -declare function union(Structs: [ - A, - ...B -]): Struct | InferStructTuple[number], null>; -/** - * Ensure that any value passes validation, without widening its type to `any`. - */ -declare function unknown(): Struct; -/** - * Create a new struct that combines the properties properties from multiple - * object or type structs. Its return type will match the first parameter's type. - * - * Like JavaScript's `Object.assign` utility. - */ -declare function assign(A: Struct, A>, B: Struct, B>): Struct>, Assign>; -declare function assign(A: Struct, A>, B: Struct, B>, C: Struct, C>): Struct, C>>, Assign, C>>; -declare function assign(A: Struct, A>, B: Struct, B>, C: Struct, C>, D: Struct, D>): Struct, C>, D>>, Assign, C>, D>>; -declare function assign(A: Struct, A>, B: Struct, B>, C: Struct, C>, D: Struct, D>, E: Struct, E>): Struct, C>, D>, E>>, Assign, C>, D>, E>>; -/** - * Define a new struct type with a custom validation function. - */ -declare function define(name: string, validator: Validator): Struct; -/** - * Create a new struct based on an existing struct, but the value is allowed to - * be `undefined`. `log` will be called if the value is not `undefined`. - */ -declare function deprecated(struct: Struct, log: (value: unknown, ctx: Context) => void): Struct; -/** - * Create a struct with dynamic validation logic. - * - * The callback will receive the value currently being validated, and must - * return a struct object to validate it with. This can be useful to model - * validation logic that changes based on its input. - */ -declare function dynamic(fn: (value: unknown, ctx: Context) => Struct): Struct; -/** - * Create a struct with lazily evaluated validation logic. - * - * The first time validation is run with the struct, the callback will be called - * and must return a struct object to use. This is useful for cases where you - * want to have self-referential structs for nested data structures to avoid a - * circular definition problem. - */ -declare function lazy(fn: () => Struct): Struct; -/** - * Create a new struct based on an existing object struct, but excluding - * specific properties. - * - * Like TypeScript's `Omit` utility. - */ -declare function omit(struct: Struct, S>, keys: K[]): Struct>, Omit>; -/** - * Create a new struct based on an existing object struct, but with all of its - * properties allowed to be `undefined`. - * - * Like TypeScript's `Partial` utility. - */ -declare function partial(struct: Struct, S> | S): Struct>, PartialObjectSchema>; -/** - * Create a new struct based on an existing object struct, but only including - * specific properties. - * - * Like TypeScript's `Pick` utility. - */ -declare function pick(struct: Struct, S>, keys: K[]): Struct>, Pick>; -/** - * Define a new struct type with a custom validation function. - * - * @deprecated This function has been renamed to `define`. - */ -declare function struct(name: string, validator: Validator): Struct; -export { Failure, StructError, Struct, assert, create, mask, is, validate, Context, Infer, Describe, Result, Coercer, Validator, Refiner, coerce, defaulted, trimmed, empty, max, min, nonempty, pattern, size, refine, any, array, bigint, boolean, date, enums, func, instance, integer, intersection, literal, map, never, nullable, number, object, optional, record, regexp, set, string, tuple, type, union, unknown, assign, define, deprecated, dynamic, lazy, omit, partial, pick, struct }; diff --git a/node_modules/superstruct/umd/superstruct.min.js b/node_modules/superstruct/umd/superstruct.min.js deleted file mode 100644 index dab110773..000000000 --- a/node_modules/superstruct/umd/superstruct.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Superstruct={})}(this,(function(e){"use strict";class t extends TypeError{constructor(e,t){let n;const{message:r,...i}=e,{path:o}=e;super(0===o.length?r:`At path: ${o.join(".")} -- ${r}`),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>n??=[e,...t()]}}function n(e){return"object"==typeof e&&null!=e}function r(e){if("[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function i(e){return"string"==typeof e?JSON.stringify(e):`${e}`}function o(e,t,n,r){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});const{path:o,branch:c}=t,{type:a}=n,{refinement:s,message:u=`Expected a value of type \`${a}\`${s?` with refinement \`${s}\``:""}, but received: \`${i(r)}\``}=e;return{value:r,type:a,refinement:s,key:o[o.length-1],path:o,branch:c,...e,message:u}}function*c(e,t,r,i){var c;n(c=e)&&"function"==typeof c[Symbol.iterator]||(e=[e]);for(const n of e){const e=o(n,t,r,i);e&&(yield e)}}function*a(e,t,r){void 0===r&&(r={});const{path:i=[],branch:o=[e],coerce:c=!1,mask:s=!1}=r,u={path:i,branch:o};if(c&&(e=t.coercer(e,u),s&&"type"!==t.type&&n(t.schema)&&n(e)&&!Array.isArray(e)))for(const n in e)void 0===t.schema[n]&&delete e[n];let f="valid";for(const n of t.validator(e,u))f="not_valid",yield[n,void 0];for(let[r,d,l]of t.entries(e,u)){const t=a(d,l,{path:void 0===r?i:[...i,r],branch:void 0===r?o:[...o,d],coerce:c,mask:s});for(const i of t)i[0]?(f=null!=i[0].refinement?"not_refined":"not_valid",yield[i[0],void 0]):c&&(d=i[1],void 0===r?e=d:e instanceof Map?e.set(r,d):e instanceof Set?e.add(d):n(e)&&void 0!==d&&(e[r]=d))}if("not_valid"!==f)for(const n of t.refiner(e,u))f="not_refined",yield[n,void 0];"valid"===f&&(yield[void 0,e])}class s{constructor(e){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:t,schema:n,validator:r,refiner:i,coercer:o=(e=>e),entries:a=function*(){}}=e;this.type=t,this.schema=n,this.entries=a,this.coercer=o,this.validator=r?(e,t)=>c(r(e,t),t,this,e):()=>[],this.refiner=i?(e,t)=>c(i(e,t),t,this,e):()=>[]}assert(e){return u(e,this)}create(e){return f(e,this)}is(e){return l(e,this)}mask(e){return d(e,this)}validate(e,t){return void 0===t&&(t={}),p(e,this,t)}}function u(e,t){const n=p(e,t);if(n[0])throw n[0]}function f(e,t){const n=p(e,t,{coerce:!0});if(n[0])throw n[0];return n[1]}function d(e,t){const n=p(e,t,{coerce:!0,mask:!0});if(n[0])throw n[0];return n[1]}function l(e,t){return!p(e,t)[0]}function p(e,n,r){void 0===r&&(r={});const i=a(e,n,r),o=function(e){const{done:t,value:n}=e.next();return t?void 0:n}(i);if(o[0]){return[new t(o[0],(function*(){for(const e of i)e[0]&&(yield e[0])})),void 0]}return[void 0,o[1]]}function y(e,t){return new s({type:e,schema:null,validator:t})}function v(){return y("never",(()=>!1))}function h(e){const t=e?Object.keys(e):[],r=v();return new s({type:"object",schema:e||null,*entries(i){if(e&&n(i)){const n=new Set(Object.keys(i));for(const r of t)n.delete(r),yield[r,i[r],e[r]];for(const e of n)yield[e,i[e],r]}},validator:e=>n(e)||`Expected an object, but received: ${i(e)}`,coercer:e=>n(e)?{...e}:e})}function m(e){return new s({...e,validator:(t,n)=>void 0===t||e.validator(t,n),refiner:(t,n)=>void 0===t||e.refiner(t,n)})}function b(){return y("string",(e=>"string"==typeof e||`Expected a string, but received: ${i(e)}`))}function $(e){const t=Object.keys(e);return new s({type:"type",schema:e,*entries(r){if(n(r))for(const n of t)yield[n,r[n],e[n]]},validator:e=>n(e)||`Expected an object, but received: ${i(e)}`})}function g(){return y("unknown",(()=>!0))}function w(e,t,n){return new s({...e,coercer:(r,i)=>l(r,t)?e.coercer(n(r,i),i):e.coercer(r,i)})}function x(e){return e instanceof Map||e instanceof Set?e.size:e.length}function E(e,t,n){return new s({...e,*refiner(r,i){yield*e.refiner(r,i);const o=c(n(r,i),i,e,r);for(const e of o)yield{...e,refinement:t}}})}e.Struct=s,e.StructError=t,e.any=function(){return y("any",(()=>!0))},e.array=function(e){return new s({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[n,r]of t.entries())yield[n,r,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${i(e)}`})},e.assert=u,e.assign=function(){for(var e=arguments.length,t=new Array(e),n=0;ne.schema)),o=Object.assign({},...i);return r?$(o):h(o)},e.bigint=function(){return y("bigint",(e=>"bigint"==typeof e))},e.boolean=function(){return y("boolean",(e=>"boolean"==typeof e))},e.coerce=w,e.create=f,e.date=function(){return y("date",(e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${i(e)}`))},e.defaulted=function(e,t,n){return void 0===n&&(n={}),w(e,g(),(e=>{const i="function"==typeof t?t():t;if(void 0===e)return i;if(!n.strict&&r(e)&&r(i)){const t={...e};let n=!1;for(const e in i)void 0===t[e]&&(t[e]=i[e],n=!0);if(n)return t}return e}))},e.define=y,e.deprecated=function(e,t){return new s({...e,refiner:(t,n)=>void 0===t||e.refiner(t,n),validator:(n,r)=>void 0===n||(t(n,r),e.validator(n,r))})},e.dynamic=function(e){return new s({type:"dynamic",schema:null,*entries(t,n){const r=e(t,n);yield*r.entries(t,n)},validator:(t,n)=>e(t,n).validator(t,n),coercer:(t,n)=>e(t,n).coercer(t,n),refiner:(t,n)=>e(t,n).refiner(t,n)})},e.empty=function(e){return E(e,"empty",(t=>{const n=x(t);return 0===n||`Expected an empty ${e.type} but received one with a size of \`${n}\``}))},e.enums=function(e){const t={},n=e.map((e=>i(e))).join();for(const n of e)t[n]=n;return new s({type:"enums",schema:t,validator:t=>e.includes(t)||`Expected one of \`${n}\`, but received: ${i(t)}`})},e.func=function(){return y("func",(e=>"function"==typeof e||`Expected a function, but received: ${i(e)}`))},e.instance=function(e){return y("instance",(t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${i(t)}`))},e.integer=function(){return y("integer",(e=>"number"==typeof e&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${i(e)}`))},e.intersection=function(e){return new s({type:"intersection",schema:null,*entries(t,n){for(const r of e)yield*r.entries(t,n)},*validator(t,n){for(const r of e)yield*r.validator(t,n)},*refiner(t,n){for(const r of e)yield*r.refiner(t,n)}})},e.is=l,e.lazy=function(e){let t;return new s({type:"lazy",schema:null,*entries(n,r){t??=e(),yield*t.entries(n,r)},validator:(n,r)=>(t??=e(),t.validator(n,r)),coercer:(n,r)=>(t??=e(),t.coercer(n,r)),refiner:(n,r)=>(t??=e(),t.refiner(n,r))})},e.literal=function(e){const t=i(e),n=typeof e;return new s({type:"literal",schema:"string"===n||"number"===n||"boolean"===n?e:null,validator:n=>n===e||`Expected the literal \`${t}\`, but received: ${i(n)}`})},e.map=function(e,t){return new s({type:"map",schema:null,*entries(n){if(e&&t&&n instanceof Map)for(const[r,i]of n.entries())yield[r,r,e],yield[r,i,t]},coercer:e=>e instanceof Map?new Map(e):e,validator:e=>e instanceof Map||`Expected a \`Map\` object, but received: ${i(e)}`})},e.mask=d,e.max=function(e,t,n){void 0===n&&(n={});const{exclusive:r}=n;return E(e,"max",(n=>r?nr?n>t:n>=t||`Expected a ${e.type} greater than ${r?"":"or equal to "}${t} but received \`${n}\``))},e.never=v,e.nonempty=function(e){return E(e,"nonempty",(t=>x(t)>0||`Expected a nonempty ${e.type} but received an empty one`))},e.nullable=function(e){return new s({...e,validator:(t,n)=>null===t||e.validator(t,n),refiner:(t,n)=>null===t||e.refiner(t,n)})},e.number=function(){return y("number",(e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${i(e)}`))},e.object=h,e.omit=function(e,t){const{schema:n}=e,r={...n};for(const e of t)delete r[e];return"type"===e.type?$(r):h(r)},e.optional=m,e.partial=function(e){const t=e instanceof s?{...e.schema}:{...e};for(const e in t)t[e]=m(t[e]);return h(t)},e.pattern=function(e,t){return E(e,"pattern",(n=>t.test(n)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${n}"`))},e.pick=function(e,t){const{schema:n}=e,r={};for(const e of t)r[e]=n[e];return h(r)},e.record=function(e,t){return new s({type:"record",schema:null,*entries(r){if(n(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator:e=>n(e)||`Expected an object, but received: ${i(e)}`})},e.refine=E,e.regexp=function(){return y("regexp",(e=>e instanceof RegExp))},e.set=function(e){return new s({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const n of t)yield[n,n,e]},coercer:e=>e instanceof Set?new Set(e):e,validator:e=>e instanceof Set||`Expected a \`Set\` object, but received: ${i(e)}`})},e.size=function(e,t,n){void 0===n&&(n=t);const r=`Expected a ${e.type}`,i=t===n?`of \`${t}\``:`between \`${t}\` and \`${n}\``;return E(e,"size",(e=>{if("number"==typeof e||e instanceof Date)return t<=e&&e<=n||`${r} ${i} but received \`${e}\``;if(e instanceof Map||e instanceof Set){const{size:o}=e;return t<=o&&o<=n||`${r} with a size ${i} but received one with a size of \`${o}\``}{const{length:o}=e;return t<=o&&o<=n||`${r} with a length ${i} but received one with a length of \`${o}\``}}))},e.string=b,e.struct=function(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),y(e,t)},e.trimmed=function(e){return w(e,b(),(e=>e.trim()))},e.tuple=function(e){const t=v();return new s({type:"tuple",schema:null,*entries(n){if(Array.isArray(n)){const r=Math.max(e.length,n.length);for(let i=0;iArray.isArray(e)||`Expected an array, but received: ${i(e)}`})},e.type=$,e.union=function(e){const t=e.map((e=>e.type)).join(" | ");return new s({type:"union",schema:null,coercer:(t,n)=>(e.find((e=>{const[n]=e.validate(t,{coerce:!0});return!n}))||g()).coercer(t,n),validator(n,r){const o=[];for(const t of e){const[...e]=a(n,t,r),[i]=e;if(!i[0])return[];for(const[t]of e)t&&o.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${i(n)}`,...o]}})},e.unknown=g,e.validate=p,Object.defineProperty(e,"__esModule",{value:!0})})); diff --git a/node_modules/ts-loader/CHANGELOG.md b/node_modules/ts-loader/CHANGELOG.md index 91d42fcb9..4c6459029 100644 --- a/node_modules/ts-loader/CHANGELOG.md +++ b/node_modules/ts-loader/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 9.4.2 +* [Bug fix: Use custom transformer when building solution references](https://github.com/TypeStrong/ts-loader/pull/1550) [#1025] - thanks @feosuna1 + ## 9.4.1 * [Hotfix: Disable `enhanced-resolve`](https://github.com/TypeStrong/ts-loader/pull/1505) - thanks @manuth diff --git a/node_modules/ts-loader/LICENSE b/node_modules/ts-loader/LICENSE index aa8bc6f5a..3120564ec 100644 --- a/node_modules/ts-loader/LICENSE +++ b/node_modules/ts-loader/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 TypeStrong +Copyright (c) 2015-present TypeStrong Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/node_modules/ts-loader/README.md b/node_modules/ts-loader/README.md index e75d1f255..c96020e6e 100644 --- a/node_modules/ts-loader/README.md +++ b/node_modules/ts-loader/README.md @@ -33,12 +33,11 @@ * [Faster Builds](#faster-builds) * [Yarn Plug’n’Play](#yarn-plugnplay) * [Babel](#babel) - * [Parallelising Builds](#parallelising-builds) * [Compatibility](#compatibility) * [Configuration](#configuration) + [`devtool` / sourcemaps](#devtool--sourcemaps) * [Code Splitting and Loading Other Resources](#code-splitting-and-loading-other-resources) - * [Declarations (.d.ts)](#declarations-dts) + * [Declarations (.d.ts)](#declaration-files-dts) * [Failing the build on TypeScript compilation error](#failing-the-build-on-typescript-compilation-error) * [`baseUrl` / `paths` module resolution](#baseurl--paths-module-resolution) * [Options](#options) @@ -155,12 +154,18 @@ If you become aware of issues not caught by the test suite then please let us kn }, resolve: { // Add `.ts` and `.tsx` as a resolvable extension. - extensions: [".ts", ".tsx", ".js"] + extensions: [".ts", ".tsx", ".js"], + // Add support for TypeScripts fully qualified ESM imports. + extensionAlias: { + ".js": [".js", ".ts"], + ".cjs": [".cjs", ".cts"], + ".mjs": [".mjs", ".mts"] + } }, module: { rules: [ - // all files with a `.ts` or `.tsx` extension will be handled by `ts-loader` - { test: /\.tsx?$/, loader: "ts-loader" } + // all files with a `.ts`, `.cts`, `.mts` or `.tsx` extension will be handled by `ts-loader` + { test: /\.([cm]?ts|tsx)$/, loader: "ts-loader" } ] } }; @@ -730,7 +735,7 @@ Because TS will generate .js and .d.ts files, you should ignore these files, oth plugins: [ new webpack.WatchIgnorePlugin([ /\.js$/, - /\.d\.ts$/ + /\.d\.[cm]?ts$/ ]) ], @@ -739,7 +744,7 @@ plugins: [ new webpack.WatchIgnorePlugin({ paths:[ /\.js$/, - /\.d\.ts$/ + /\.d\.[cm]ts$/ ]}) ], ``` diff --git a/node_modules/ts-loader/dist/instances.d.ts b/node_modules/ts-loader/dist/instances.d.ts index e4079bcf4..c674999a9 100644 --- a/node_modules/ts-loader/dist/instances.d.ts +++ b/node_modules/ts-loader/dist/instances.d.ts @@ -13,6 +13,7 @@ export declare function getTypeScriptInstance(loaderOptions: LoaderOptions, load error?: webpack.WebpackError; }; export declare function initializeInstance(loader: webpack.LoaderContext, instance: TSInstance): void; +export declare function getCustomTransformers(loaderOptions: LoaderOptions, program: typescript.Program | undefined, getProgram: (() => typescript.Program | undefined) | undefined): any; export declare function reportTranspileErrors(instance: TSInstance, loader: webpack.LoaderContext): void; export declare function buildSolutionReferences(instance: TSInstance, loader: webpack.LoaderContext): void; export declare function forEachResolvedProjectReference(resolvedProjectReferences: readonly (typescript.ResolvedProjectReference | undefined)[] | undefined, cb: (resolvedProjectReference: typescript.ResolvedProjectReference) => T | undefined): T | undefined; diff --git a/node_modules/ts-loader/dist/instances.d.ts.map b/node_modules/ts-loader/dist/instances.d.ts.map index 134533e25..f7fa69290 100644 --- a/node_modules/ts-loader/dist/instances.d.ts.map +++ b/node_modules/ts-loader/dist/instances.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"instances.d.ts","sourceRoot":"","sources":["../src/instances.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,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wB,EAAE,UAAU,CAAC,wBAAwB,KAC1D,CAAC,GAAG,SAAS,GACjB,CAAC,GAAG,SAAS,CA8Bf;AA0ED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,UAAU,EACpB,UAAU,EAAE,UAAU,CAAC,iBAAiB,EACxC,aAAa,EAAE,MAAM,GACpB,MAAM,EAAE,CA2CV;AAED,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,UAAU,EACpB,QAAQ,EAAE,MAAM,GACf,MAAM,GAAG,SAAS,CA2BpB;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,EAAE,MAAM,uCAyD3E;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,2BAqCnE"} \ No newline at end of file diff --git a/node_modules/ts-loader/dist/instances.js b/node_modules/ts-loader/dist/instances.js index 1fc4bf9f2..173284efa 100644 --- a/node_modules/ts-loader/dist/instances.js +++ b/node_modules/ts-loader/dist/instances.js @@ -1,6 +1,6 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.getEmitOutput = exports.getEmitFromWatchHost = exports.getInputFileNameFromOutput = exports.getOutputFileNames = exports.forEachResolvedProjectReference = exports.buildSolutionReferences = exports.reportTranspileErrors = exports.initializeInstance = exports.getTypeScriptInstance = void 0; +exports.getEmitOutput = exports.getEmitFromWatchHost = exports.getInputFileNameFromOutput = exports.getOutputFileNames = exports.forEachResolvedProjectReference = exports.buildSolutionReferences = exports.reportTranspileErrors = exports.getCustomTransformers = exports.initializeInstance = exports.getTypeScriptInstance = void 0; const chalk = require("chalk"); const fs = require("fs"); const path = require("path"); @@ -216,24 +216,6 @@ function initializeInstance(loader, instance) { return; } instance.initialSetupPending = false; - // same strategy as https://github.com/s-panferov/awesome-typescript-loader/pull/531/files - let { getCustomTransformers: customerTransformers } = instance.loaderOptions; - let getCustomTransformers = Function.prototype; - if (typeof customerTransformers === 'function') { - getCustomTransformers = customerTransformers; - } - else if (typeof customerTransformers === 'string') { - try { - customerTransformers = require(customerTransformers); - } - catch (err) { - throw new Error(`Failed to load customTransformers from "${instance.loaderOptions.getCustomTransformers}": ${err instanceof Error ? err.message : 'unknown error'}`); - } - if (typeof customerTransformers !== 'function') { - throw new Error(`Custom transformers in "${instance.loaderOptions.getCustomTransformers}" should export a function, got ${typeof customerTransformers}`); - } - getCustomTransformers = customerTransformers; - } if (instance.loaderOptions.transpileOnly) { const program = (instance.program = instance.configParseResult.projectReferences !== undefined @@ -244,7 +226,7 @@ function initializeInstance(loader, instance) { }) : instance.compiler.createProgram([], instance.compilerOptions)); const getProgram = () => program; - instance.transformers = getCustomTransformers(program, getProgram); + instance.transformers = getCustomTransformers(instance.loaderOptions, program, getProgram); // Setup watch run for solution building if (instance.solutionBuilderHost) { addAssetHooks(loader, instance); @@ -265,19 +247,41 @@ function initializeInstance(loader, instance) { instance.watchOfFilesAndCompilerOptions.getProgram(); const getProgram = () => { var _a; return (_a = instance.builderProgram) === null || _a === void 0 ? void 0 : _a.getProgram(); }; instance.program = getProgram(); - instance.transformers = getCustomTransformers(instance.program, getProgram); + instance.transformers = getCustomTransformers(instance.loaderOptions, instance.program, getProgram); } else { instance.servicesHost = (0, servicesHost_1.makeServicesHost)(getScriptRegexp(instance), loader, instance, instance.configParseResult.projectReferences); instance.languageService = instance.compiler.createLanguageService(instance.servicesHost, instance.compiler.createDocumentRegistry()); const getProgram = () => instance.languageService.getProgram(); - instance.transformers = getCustomTransformers(getProgram(), getProgram); + instance.transformers = getCustomTransformers(instance.loaderOptions, getProgram(), getProgram); } addAssetHooks(loader, instance); loader._compiler.hooks.watchRun.tapAsync('ts-loader', (0, watch_run_1.makeWatchRun)(instance, loader)); } } exports.initializeInstance = initializeInstance; +function getCustomTransformers(loaderOptions, program, getProgram) { + // same strategy as https://github.com/s-panferov/awesome-typescript-loader/pull/531/files + let { getCustomTransformers: customerTransformers } = loaderOptions; + let getCustomTransformers = Function.prototype; + if (typeof customerTransformers === 'function') { + getCustomTransformers = customerTransformers; + } + else if (typeof customerTransformers === 'string') { + try { + customerTransformers = require(customerTransformers); + } + catch (err) { + throw new Error(`Failed to load customTransformers from "${loaderOptions.getCustomTransformers}": ${err instanceof Error ? err.message : 'unknown error'}`); + } + if (typeof customerTransformers !== 'function') { + throw new Error(`Custom transformers in "${loaderOptions.getCustomTransformers}" should export a function, got ${typeof customerTransformers}`); + } + getCustomTransformers = customerTransformers; + } + return getCustomTransformers(program, getProgram); +} +exports.getCustomTransformers = getCustomTransformers; function getScriptRegexp(instance) { // If resolveJsonModules is set, we should accept json files if (instance.configParseResult.options.resolveJsonModule) { diff --git a/node_modules/ts-loader/dist/interfaces.d.ts b/node_modules/ts-loader/dist/interfaces.d.ts index 054d99cd0..f099a297f 100644 --- a/node_modules/ts-loader/dist/interfaces.d.ts +++ b/node_modules/ts-loader/dist/interfaces.d.ts @@ -10,7 +10,7 @@ export interface ErrorInfo { character: number; context: string; } -export declare type FileLocation = { +export type FileLocation = { /** 1-based */ line: number; /** 1-based */ @@ -46,7 +46,7 @@ export interface WatchHost extends typescript.WatchCompilerHostOfFilesAndCompile outputFiles: Map; tsbuildinfo?: typescript.OutputFile; } -export declare type WatchCallbacks = Map = Map; @@ -65,7 +65,7 @@ export interface SolutionDiagnostics { perFile: Map; transpileErrors: [FilePathKey | undefined, typescript.Diagnostic[]][]; } -export declare type FilePathKey = string & { +export type FilePathKey = string & { __filePathKeyBrand: any; }; export interface SolutionBuilderWithWatchHost extends typescript.SolutionBuilderWithWatchHost, WatchFactory { @@ -166,12 +166,12 @@ export interface TSInstance { export interface LoaderOptionsCache { [name: string]: WeakMap; } -export declare type DependencyGraph = Map; -export declare type ReverseDependencyGraph = Map>; -export declare type LogLevel = 'INFO' | 'WARN' | 'ERROR'; -export declare type ResolveModuleName = (moduleName: string, containingFile: string, compilerOptions: typescript.CompilerOptions, moduleResolutionHost: typescript.ModuleResolutionHost) => typescript.ResolvedModuleWithFailedLookupLocations; -export declare type CustomResolveModuleName = (moduleName: string, containingFile: string, compilerOptions: typescript.CompilerOptions, moduleResolutionHost: typescript.ModuleResolutionHost, parentResolver: ResolveModuleName) => typescript.ResolvedModuleWithFailedLookupLocations; -export declare type CustomResolveTypeReferenceDirective = (typeDirectiveName: string, containingFile: string, compilerOptions: typescript.CompilerOptions, moduleResolutionHost: typescript.ModuleResolutionHost, parentResolver: typeof typescript.resolveTypeReferenceDirective) => typescript.ResolvedTypeReferenceDirectiveWithFailedLookupLocations; +export type DependencyGraph = Map; +export type ReverseDependencyGraph = Map>; +export type LogLevel = 'INFO' | 'WARN' | 'ERROR'; +export type ResolveModuleName = (moduleName: string, containingFile: string, compilerOptions: typescript.CompilerOptions, moduleResolutionHost: typescript.ModuleResolutionHost) => typescript.ResolvedModuleWithFailedLookupLocations; +export type CustomResolveModuleName = (moduleName: string, containingFile: string, compilerOptions: typescript.CompilerOptions, moduleResolutionHost: typescript.ModuleResolutionHost, parentResolver: ResolveModuleName) => typescript.ResolvedModuleWithFailedLookupLocations; +export type CustomResolveTypeReferenceDirective = (typeDirectiveName: string, containingFile: string, compilerOptions: typescript.CompilerOptions, moduleResolutionHost: typescript.ModuleResolutionHost, parentResolver: typeof typescript.resolveTypeReferenceDirective) => typescript.ResolvedTypeReferenceDirectiveWithFailedLookupLocations; export interface LoaderOptions { silent: boolean; logLevel: LogLevel; @@ -214,7 +214,7 @@ export interface TSFile { }; } /** where key is filepath */ -export declare type TSFiles = Map; +export type TSFiles = Map; export interface ResolvedModule { originalFileName: string; resolvedFileName: string; @@ -231,6 +231,6 @@ export interface TSCommon { export interface TSInternal { getModeForFileReference?: (ref: typescript.FileReference | string, containingFileMode: typescript.SourceFile['impliedNodeFormat']) => typescript.SourceFile['impliedNodeFormat']; } -export declare type Severity = 'error' | 'warning'; +export type Severity = 'error' | 'warning'; export {}; //# sourceMappingURL=interfaces.d.ts.map \ No newline at end of file diff --git a/node_modules/ts-loader/dist/interfaces.d.ts.map b/node_modules/ts-loader/dist/interfaces.d.ts.map index fb74ec8b4..0d925f771 100644 --- a/node_modules/ts-loader/dist/interfaces.d.ts.map +++ b/node_modules/ts-loader/dist/interfaces.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,UAAU,MAAM,YAAY,CAAC;AAE9C,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAC9B,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,oBAAY,YAAY,GAAG;IACzB,cAAc;IACd,IAAI,EAAE,MAAM,CAAC;IACb,cAAc;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,UAAU,CAAC,IAAI,IAAI,CAAC;IACpB,eAAe,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,oBAAoB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC5C,aAAa,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC;AAED,MAAM,WAAW,aAAc,SAAQ,kBAAkB;IACvD,UAAU,EAAE,UAAU,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;IAC1D,eAAe,EAAE,WAAW,CAC1B,UAAU,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CACnD,CAAC;IACF,QAAQ,CAAC,EAAE,UAAU,CAAC,oBAAoB,CAAC,UAAU,CAAC,CAAC;CACxD;AA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file diff --git a/node_modules/ts-loader/dist/logger.d.ts b/node_modules/ts-loader/dist/logger.d.ts index e267f958b..5f9bcf602 100644 --- a/node_modules/ts-loader/dist/logger.d.ts +++ b/node_modules/ts-loader/dist/logger.d.ts @@ -1,6 +1,6 @@ import { Chalk } from 'chalk'; import { LoaderOptions } from './interfaces'; -declare type LoggerFunc = (message: string) => void; +type LoggerFunc = (message: string) => void; export interface Logger { log: LoggerFunc; logInfo: LoggerFunc; diff --git a/node_modules/ts-loader/dist/logger.d.ts.map b/node_modules/ts-loader/dist/logger.d.ts.map index c433ef36a..4c592f799 100644 --- a/node_modules/ts-loader/dist/logger.d.ts.map +++ b/node_modules/ts-loader/dist/logger.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C,aAAK,UAAU,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAE5C,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,UAAU,CAAC;IAChB,OAAO,EAAE,UAAU,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,UAAU,CAAC;CACtB;AAED,oBAAY,QAAQ;IAClB,IAAI,IAAI;IACR,IAAI,IAAI;IACR,KAAK,IAAI;CACV;AAqDD,wBAAgB,UAAU,CACxB,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,KAAK,GACZ,MAAM,CAQR"} \ No newline at end of file +{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAI7C,KAAK,UAAU,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAE5C,MAAM,WAAW,MAAM;IACrB,GAAG,EAAE,UAAU,CAAC;IAChB,OAAO,EAAE,UAAU,CAAC;IACpB,UAAU,EAAE,UAAU,CAAC;IACvB,QAAQ,EAAE,UAAU,CAAC;CACtB;AAED,oBAAY,QAAQ;IAClB,IAAI,IAAI;IACR,IAAI,IAAI;IACR,KAAK,IAAI;CACV;AAqDD,wBAAgB,UAAU,CACxB,aAAa,EAAE,aAAa,EAC5B,MAAM,EAAE,KAAK,GACZ,MAAM,CAQR"} \ No newline at end of file diff --git a/node_modules/ts-loader/dist/resolver.d.ts b/node_modules/ts-loader/dist/resolver.d.ts index c016ff403..a6169cef5 100644 --- a/node_modules/ts-loader/dist/resolver.d.ts +++ b/node_modules/ts-loader/dist/resolver.d.ts @@ -1,6 +1,6 @@ import type * as webpack from 'webpack'; export declare function makeResolver(_options: webpack.WebpackOptionsNormalized): ResolveSync; -export declare type ResolveSync = { +export type ResolveSync = { (context: any, path: string, moduleName: string): string | false; (path: string, moduleName: string): string | false; }; diff --git a/node_modules/ts-loader/dist/resolver.d.ts.map b/node_modules/ts-loader/dist/resolver.d.ts.map index eb4a92cbf..1834519c3 100644 --- a/node_modules/ts-loader/dist/resolver.d.ts.map +++ b/node_modules/ts-loader/dist/resolver.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAIxC,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,OAAO,CAAC,wBAAwB,GACzC,WAAW,CAMb;AAED,oBAAY,WAAW,GAAG;IACxB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IACjE,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;CACpD,CAAC"} \ No newline at end of file +{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,SAAS,CAAC;AAIxC,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,OAAO,CAAC,wBAAwB,GACzC,WAAW,CAMb;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;IACjE,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;CACpD,CAAC"} \ No newline at end of file diff --git a/node_modules/ts-loader/dist/servicesHost.d.ts.map b/node_modules/ts-loader/dist/servicesHost.d.ts.map index c606cdf4f..4bdd869e0 100644 --- a/node_modules/ts-loader/dist/servicesHost.d.ts.map +++ b/node_modules/ts-loader/dist/servicesHost.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"servicesHost.d.ts","sourceRoot":"","sources":["../src/servicesHost.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,UAAU,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAInC,OAAO,EAKL,WAAW,EACX,aAAa,EAIb,8BAA8B,EAC9B,4BAA4B,EAG5B,UAAU,EAIV,SAAS,EACV,MAAM,cAAc,CAAC;AA+GtB;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,EAC5C,QAAQ,EAAE,UAAU,EACpB,iBAAiB,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,gBAAgB,CAAC,GAC7D,8BAA8B,CAiGhC;AAmND,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,UAAU,EACpB,GAAG,EAAE,WAAW,EAChB,QAAQ,EA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AAa,CAC3B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,EAC5C,QAAQ,EAAE,UAAU,EACpB,iBAAiB,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,gBAAgB,CAAC,aA6H/D;AA0DD;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,aAAa,CAAC,EAC5C,QAAQ,EAAE,UAAU,GACnB,4BAA4B,CAqe9B;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,0BAqBtE"} \ No newline at end of file diff --git a/node_modules/ts-loader/dist/servicesHost.js b/node_modules/ts-loader/dist/servicesHost.js index b54603e3a..089e42918 100644 --- a/node_modules/ts-loader/dist/servicesHost.js +++ b/node_modules/ts-loader/dist/servicesHost.js @@ -412,6 +412,9 @@ function makeSolutionBuilderHost(scriptRegex, loader, instance) { const configFileInfo = new Map(); const allWatches = []; const sysHost = compiler.createSolutionBuilderWithWatchHost(compiler.sys, compiler.createEmitAndSemanticDiagnosticsBuilderProgram, reportDiagnostic, reportSolutionBuilderStatus, reportWatchStatus); + // Keeps track of the various `typescript.CustomTransformers` for each program that is created. + const customTransformers = new Map(); + // let lastBuilderProgram: typescript.CreateProgram | undefined = undefined; const solutionBuilderHost = { ...sysHost, ...moduleResolutionHost, @@ -422,12 +425,26 @@ function makeSolutionBuilderHost(scriptRegex, loader, instance) { const result = sysHost.createProgram(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences); (_c = instance.typeReferenceResolutionCache) === null || _c === void 0 ? void 0 : _c.update(instance.compilerOptions); (_d = instance.moduleResolutionCache) === null || _d === void 0 ? void 0 : _d.update(instance.compilerOptions); + if (options) { + // The `configFilePath` is the same value that is used as the `project` parameter of + // `getCustomtransformers` below. + const project = options.configFilePath; + if (typeof project === "string") { + // Custom transformers need a reference to the `typescript.Program`, that reference is + // unavailable during the the `getCustomTransformers` callback below. + const transformers = (0, instances_1.getCustomTransformers)(instance.loaderOptions, result.getProgram(), result.getProgram); + customTransformers.set(project, transformers); + } + } return result; }, resolveModuleNames, resolveTypeReferenceDirectives, diagnostics, ...createWatchFactory(filePathKeyMapper, compiler), + getCustomTransformers: function (project) { + return customTransformers.get(project); + }, // Overrides writeFile: (name, text, writeByteOrderMark) => { var _a; diff --git a/node_modules/ts-loader/package.json b/node_modules/ts-loader/package.json index 40487d987..dc2a90287 100644 --- a/node_modules/ts-loader/package.json +++ b/node_modules/ts-loader/package.json @@ -1,6 +1,6 @@ { "name": "ts-loader", - "version": "9.4.1", + "version": "9.4.2", "description": "TypeScript loader for webpack", "main": "index.js", "types": "dist", @@ -93,9 +93,9 @@ "mocha": "^6.0.0", "prettier": "^2.0.5", "rimraf": "^2.6.2", - "typescript": "^4.8.2", - "webpack": "^5.20.0", - "webpack-cli": "^4.5.0" + "typescript": "^4.9.3", + "webpack": "^5.74.0", + "webpack-cli": "^4.10.0" }, "peerDependencies": { "typescript": "*", diff --git a/node_modules/typescript/AUTHORS.md b/node_modules/typescript/AUTHORS.md deleted file mode 100644 index e02b495d2..000000000 --- a/node_modules/typescript/AUTHORS.md +++ /dev/null @@ -1,481 +0,0 @@ -TypeScript is authored by: - - - 0verk1ll - - Abubaker Bashir - - Adam Freidin - - Adam Postma - - Adi Dahiya - - Aditya Daflapurkar - - Adnan Chowdhury - - Adrian Leonhard - - Adrien Gibrat - - Ahmad Farid - - Ajay Poshak - - Alan Agius - - Alan Pierce - - Alessandro Vergani - - Alex Chugaev - - Alex Eagle - - Alex Khomchenko - - Alex Ryan - - Alexander - - Alexander Kuvaev - - Alexander Rusakov - - Alexander Tarasyuk - - Ali Sabzevari - - Aluan Haddad - - amaksimovich2 - - Anatoly Ressin - - Anders Hejlsberg - - Anders Kaseorg - - Andre Sutherland - - Andreas Martin - - Andrej Baran - - Andrew - - Andrew Branch - - Andrew Casey - - Andrew Faulkner - - Andrew Ochsner - - Andrew Stegmaier - - Andrew Z Allen - - Andrey Roenko - - Andrii Dieiev - - András Parditka - - Andy Hanson - - Anil Anar - - Anix - - Anton Khlynovskiy - - Anton Tolmachev - - Anubha Mathur - - AnyhowStep - - Armando Aguirre - - Arnaud Tournier - - Arnav Singh - - Arpad Borsos - - Artem Tyurin - - Arthur Ozga - - Asad Saeeduddin - - Austin Cummings - - Avery Morin - - Aziz Khambati - - Basarat Ali Syed - - @begincalendar - - Ben Duffield - - Ben Lichtman - - Ben Mosher - - Benedikt Meurer - - Benjamin Bock - - Benjamin Lichtman - - Benny Neugebauer - - BigAru - - Bill Ticehurst - - Blaine Bublitz - - Blake Embrey - - @bluelovers - - @bootstraponline - - Bowden Kelly - - Bowden Kenny - - Brad Zacher - - Brandon Banks - - Brandon Bloom - - Brandon Slade - - Brendan Kenny - - Brett Mayen - - Brian Terlson - - Bryan Forbes - - Caitlin Potter - - Caleb Sander - - Cameron Taggart - - @cedvdb - - Charles - - Charles Pierce - - Charly POLY - - Chris Bubernak - - Chris Patterson - - christian - - Christophe Vidal - - Chuck Jazdzewski - - Clay Miller - - Colby Russell - - Colin Snover - - Collins Abitekaniza - - Connor Clark - - Cotton Hou - - csigs - - Cyrus Najmabadi - - Dafrok Zhang - - Dahan Gong - - Daiki Nishikawa - - Dan Corder - - Dan Freeman - - Dan Quirk - - Dan Rollo - - Daniel Gooss - - Daniel Imms - - Daniel Krom - - Daniel Król - - Daniel Lehenbauer - - Daniel Rosenwasser - - David Li - - David Sheldrick - - David Sherret - - David Souther - - David Staheli - - Denis Nedelyaev - - Derek P Sifford - - Dhruv Rajvanshi - - Dick van den Brink - - Diogo Franco (Kovensky) - - Dirk Bäumer - - Dirk Holtwick - - Dmitrijs Minajevs - - Dom Chen - - Donald Pipowitch - - Doug Ilijev - - dreamran43@gmail.com - - @e-cloud - - Ecole Keine - - Eddie Jaoude - - Edward Thomson - - EECOLOR - - Eli Barzilay - - Elizabeth Dinella - - Ely Alamillo - - Eric Grube - - Eric Tsang - - Erik Edrosa - - Erik McClenney - - Esakki Raj - - Ethan Resnick - - Ethan Rubio - - Eugene Timokhov - - Evan Cahill - - Evan Martin - - Evan Sebastian - - ExE Boss - - Eyas Sharaiha - - Fabian Cook - - @falsandtru - - Filipe Silva - - @flowmemo - - Forbes Lindesay - - Francois Hendriks - - Francois Wouts - - Frank Wallis - - František Žiacik - - Frederico Bittencourt - - fullheightcoding - - Gabe Moothart - - Gabriel Isenberg - - Gabriela Araujo Britto - - Gabriela Britto - - Gao Sheng - - gb714us - - Gilad Peleg - - Godfrey Chan - - Gorka Hernández Estomba - - Graeme Wicksted - - Guillaume Salles - - Guy Bedford - - hafiz - - Halasi Tamás - - Hendrik Liebau - - Henry Mercer - - Herrington Darkholme - - Hoang Pham - - Holger Jeromin - - Homa Wong - - Hye Sung Jung - - Iain Monro - - @IdeaHunter - - Igor Novozhilov - - Igor Oleinikov - - Ika - - iliashkolyar - - IllusionMH - - Ingvar Stepanyan - - Ingvar Stepanyan - - Isiah Meadows - - ispedals - - Ivan Enderlin - - Ivo Gabe de Wolff - - Iwata Hidetaka - - Jack Bates - - Jack Williams - - Jake Boone - - Jakub Korzeniowski - - Jakub Młokosiewicz - - James Henry - - James Keane - - James Whitney - - Jan Melcher - - Jason Freeman - - Jason Jarrett - - Jason Killian - - Jason Ramsay - - JBerger - - Jean Pierre - - Jed Mao - - Jeff Wilcox - - Jeffrey Morlan - - Jesse Schalken - - Jesse Trinity - - Jing Ma - - Jiri Tobisek - - Joe Calzaretta - - Joe Chung - - Joel Day - - Joey Watts - - Johannes Rieken - - John Doe - - John Vilk - - Jonathan Bond-Caron - - Jonathan Park - - Jonathan Toland - - Jordan Harband - - Jordi Oliveras Rovira - - Joscha Feth - - Joseph Wunderlich - - Josh Abernathy - - Josh Goldberg - - Josh Kalderimis - - Josh Soref - - Juan Luis Boya García - - Julian Williams - - Justin Bay - - Justin Johansson - - jwbay - - K. Preißer - - Kagami Sascha Rosylight - - Kanchalai Tanglertsampan - - karthikkp - - Kate Miháliková - - Keen Yee Liau - - Keith Mashinter - - Ken Howard - - Kenji Imamula - - Kerem Kat - - Kevin Donnelly - - Kevin Gibbons - - Kevin Lang - - Khải - - Kitson Kelly - - Klaus Meinhardt - - Kris Zyp - - Kyle Kelley - - Kārlis Gaņģis - - laoxiong - - Leon Aves - - Limon Monte - - Lorant Pinter - - Lucien Greathouse - - Luka Hartwig - - Lukas Elmer - - M.Yoshimura - - Maarten Sijm - - Magnus Hiie - - Magnus Kulke - - Manish Bansal - - Manish Giri - - Marcus Noble - - Marin Marinov - - Marius Schulz - - Markus Johnsson - - Markus Wolf - - Martin - - Martin Hiller - - Martin Johns - - Martin Probst - - Martin Vseticka - - Martyn Janes - - Masahiro Wakame - - Mateusz Burzyński - - Matt Bierner - - Matt McCutchen - - Matt Mitchell - - Matthew Aynalem - - Matthew Miller - - Mattias Buelens - - Max Heiber - - Maxwell Paul Brickner - - @meyer - - Micah Zoltu - - @micbou - - Michael - - Michael Crane - - Michael Henderson - - Michael Tamm - - Michael Tang - - Michal Przybys - - Mike Busyrev - - Mike Morearty - - Milosz Piechocki - - Mine Starks - - Minh Nguyen - - Mohamed Hegazy - - Mohsen Azimi - - Mukesh Prasad - - Myles Megyesi - - Nathan Day - - Nathan Fenner - - Nathan Shively-Sanders - - Nathan Yee - - ncoley - - Nicholas Yang - - Nicu Micleușanu - - @nieltg - - Nima Zahedi - - Noah Chen - - Noel Varanda - - Noel Yoo - - Noj Vek - - nrcoley - - Nuno Arruda - - Oleg Mihailik - - Oleksandr Chekhovskyi - - Omer Sheikh - - Orta Therox - - Orta Therox - - Oskar Grunning - - Oskar Segersva¨rd - - Oussama Ben Brahim - - Ozair Patel - - Patrick McCartney - - Patrick Zhong - - Paul Koerbitz - - Paul van Brenk - - @pcbro - - Pedro Maltez - - Pete Bacon Darwin - - Peter Burns - - Peter Šándor - - Philip Pesca - - Philippe Voinov - - Pi Lanningham - - Piero Cangianiello - - Pierre-Antoine Mills - - @piloopin - - Pranav Senthilnathan - - Prateek Goel - - Prateek Nayak - - Prayag Verma - - Priyantha Lankapura - - @progre - - Punya Biswal - - r7kamura - - Rado Kirov - - Raj Dosanjh - - rChaser53 - - Reiner Dolp - - Remo H. Jansen - - @rflorian - - Rhys van der Waerden - - @rhysd - - Ricardo N Feliciano - - Richard Karmazín - - Richard Knoll - - Roger Spratley - - Ron Buckton - - Rostislav Galimsky - - Rowan Wyborn - - rpgeeganage - - Ruwan Pradeep Geeganage - - Ryan Cavanaugh - - Ryan Clarke - - Ryohei Ikegami - - Salisbury, Tom - - Sam Bostock - - Sam Drugan - - Sam El-Husseini - - Sam Lanning - - Sangmin Lee - - Sanket Mishra - - Sarangan Rajamanickam - - Sasha Joseph - - Sean Barag - - Sergey Rubanov - - Sergey Shandar - - Sergey Tychinin - - Sergii Bezliudnyi - - Sergio Baidon - - Sharon Rolel - - Sheetal Nandi - - Shengping Zhong - - Sheon Han - - Shyyko Serhiy - - Siddharth Singh - - sisisin - - Slawomir Sadziak - - Solal Pirelli - - Soo Jae Hwang - - Stan Thomas - - Stanislav Iliev - - Stanislav Sysoev - - Stas Vilchik - - Stephan Ginthör - - Steve Lucco - - @styfle - - Sudheesh Singanamalla - - Suhas - - Suhas Deshpande - - superkd37 - - Sébastien Arod - - @T18970237136 - - @t_ - - Tan Li Hau - - Tapan Prakash - - Taras Mankovski - - Tarik Ozket - - Tetsuharu Ohzeki - - The Gitter Badger - - Thomas den Hollander - - Thorsten Ball - - Tien Hoanhtien - - Tim Lancina - - Tim Perry - - Tim Schaub - - Tim Suchanek - - Tim Viiding-Spader - - Tingan Ho - - Titian Cernicova-Dragomir - - tkondo - - Todd Thomson - - togru - - Tom J - - Torben Fitschen - - Toxyxer - - @TravCav - - Troy Tae - - TruongSinh Tran-Nguyen - - Tycho Grouwstra - - uhyo - - Vadi Taslim - - Vakhurin Sergey - - Valera Rozuvan - - Vilic Vane - - Vimal Raghubir - - Vladimir Kurchatkin - - Vladimir Matveev - - Vyacheslav Pukhanov - - Wenlu Wang - - Wes Souza - - Wesley Wigham - - William Orr - - Wilson Hobbs - - xiaofa - - xl1 - - Yacine Hmito - - Yang Cao - - York Yao - - @yortus - - Yoshiki Shibukawa - - Yuichi Nukiyama - - Yuval Greenfield - - Yuya Tanaka - - Z - - Zeeshan Ahmed - - Zev Spitz - - Zhengbo Li - - Zixiang Li - - @Zzzen - - 阿卡琳 diff --git a/node_modules/typescript/CODE_OF_CONDUCT.md b/node_modules/typescript/CODE_OF_CONDUCT.md deleted file mode 100644 index 65c8a42b8..000000000 --- a/node_modules/typescript/CODE_OF_CONDUCT.md +++ /dev/null @@ -1 +0,0 @@ -This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments. diff --git a/node_modules/typescript/CopyrightNotice.txt b/node_modules/typescript/CopyrightNotice.txt deleted file mode 100644 index fee4889c8..000000000 --- a/node_modules/typescript/CopyrightNotice.txt +++ /dev/null @@ -1,15 +0,0 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - diff --git a/node_modules/typescript/README.md b/node_modules/typescript/README.md index 4908b030b..338d403b9 100644 --- a/node_modules/typescript/README.md +++ b/node_modules/typescript/README.md @@ -46,59 +46,6 @@ with any additional questions or comments. * [Programming handbook](https://www.typescriptlang.org/docs/handbook/intro.html) * [Homepage](https://www.typescriptlang.org/) -## Building - -In order to build the TypeScript compiler, ensure that you have [Git](https://git-scm.com/downloads) and [Node.js](https://nodejs.org/) installed. - -Clone a copy of the repo: - -```bash -git clone https://github.com/microsoft/TypeScript.git -``` - -Change to the TypeScript directory: - -```bash -cd TypeScript -``` - -Install [Gulp](https://gulpjs.com/) tools and dev dependencies: - -```bash -npm install -g gulp -npm ci -``` - -Use one of the following to build and test: - -``` -gulp local # Build the compiler into built/local. -gulp clean # Delete the built compiler. -gulp LKG # Replace the last known good with the built one. - # Bootstrapping step to be executed when the built compiler reaches a stable state. -gulp tests # Build the test infrastructure using the built compiler. -gulp runtests # Run tests using the built compiler and test infrastructure. - # You can override the specific suite runner used or specify a test for this command. - # Use --tests= for a specific test and/or --runner= for a specific suite. - # Valid runners include conformance, compiler, fourslash, project, user, and docker - # The user and docker runners are extended test suite runners - the user runner - # works on disk in the tests/cases/user directory, while the docker runner works in containers. - # You'll need to have the docker executable in your system path for the docker runner to work. -gulp runtests-parallel # Like runtests, but split across multiple threads. Uses a number of threads equal to the system - # core count by default. Use --workers= to adjust this. -gulp baseline-accept # This replaces the baseline test results with the results obtained from gulp runtests. -gulp lint # Runs eslint on the TypeScript source. -gulp help # List the above commands. -``` - - -## Usage - -```bash -node built/local/tsc.js hello.ts -``` - - ## Roadmap For details on our planned features and future direction please refer to our [roadmap](https://github.com/microsoft/TypeScript/wiki/Roadmap). diff --git a/node_modules/typescript/lib/cs/diagnosticMessages.generated.json b/node_modules/typescript/lib/cs/diagnosticMessages.generated.json index fe4fc2822..1df80098b 100644 --- a/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +++ b/node_modules/typescript/lib/cs/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "Abstraktní přístupový objekt nemůže mít implementaci.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "Modifikátor přístupnosti se nedá použít spolu s privátním identifikátorem.", "An_accessor_cannot_have_type_parameters_1094": "Přístupový objekt nemůže obsahovat parametry typu.", + "An_accessor_property_cannot_be_declared_optional_1276": "Vlastnost accessor nejde deklarovat jako volitelnou.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Deklarace ambientního modulu je povolená jenom na nejvyšší úrovni v souboru.", "An_argument_for_0_was_not_provided_6210": "Neposkytl se argument pro {0}.", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "Neposkytl se argument, který by odpovídal tomuto vzoru vazby.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "Třída {0} nesprávně implementuje třídu {1}. Nechtěli jste rozšířit třídu {1} a dědit její členy jako podtřídu?", "Class_0_incorrectly_implements_interface_1_2420": "Třída {0} nesprávně implementuje rozhraní {1}.", "Class_0_used_before_its_declaration_2449": "Třída {0} se používá dříve, než se deklaruje.", - "Class_constructor_may_not_be_a_generator_1360": "Konstruktor třídy nemůže být generátor.", + "Class_constructor_may_not_be_a_generator_1368": "Konstruktor třídy nemůže být generátor.", "Class_constructor_may_not_be_an_accessor_1341": "Konstruktor třídy nemůže být přístupový objekt.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "Deklarace třídy nemůže implementovat seznam přetížení pro {0}.", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "Deklarace tříd nemůžou mít více než jednu značku ‚@augments‘ nebo ‚@extends‘.", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "Převod typu {0} na typ {1} může být chyba, protože ani jeden z těchto typů se s tím druhým dostatečně nepřekrývá. Pokud je to záměr, převeďte nejdříve výraz na unknown.", "Convert_0_to_1_in_0_95003": "Převést {0} na {1} v {0}", "Convert_0_to_mapped_object_type_95055": "Převést {0} na typ mapovaného objektu", + "Convert_all_const_to_let_95102": "Převést všechny const na let", "Convert_all_constructor_functions_to_classes_95045": "Převést všechny funkce konstruktoru na třídy", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Převést všechny importy, které se nepoužívají jako hodnota, na importy, při kterých se importují jen typy.", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Převést všechny neplatné znaky na kód entity HTML", @@ -658,6 +660,8 @@ "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219": "Experimentální podpora dekorátorů je funkce, která se v budoucí verzi může změnit. Toto upozornění odstraníte nastavením možnosti experimentalDecorators v tsconfig nebo jsconfig.", "Explicitly_specified_module_resolution_kind_Colon_0_6087": "Explicitně zadaný druh překladu modulu: {0}.", "Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791": "Pokud není možnost target nastavená na es2016 nebo novější, nedají se hodnoty bigint umocnit.", + "Export_0_from_module_1_90059": "Exportovat {0} z modulu {1}", + "Export_all_referenced_locals_90060": "Exportovat všechny odkazované místní hodnoty", "Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203": "Přiřazení exportu nelze použít, pokud jsou cílem moduly ECMAScript. Zkuste místo toho použít export default nebo jiný formát modulu.", "Export_assignment_is_not_supported_when_module_flag_is_system_1218": "Když má příznak --module hodnotu system, nepodporuje se přiřazení exportu.", "Export_declaration_conflicts_with_exported_declaration_of_0_2484": "Konflikty deklarace exportu s exportovanou deklarací {0}", @@ -906,6 +910,7 @@ "Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650": "Vytvořte klíč jenom ze zpětných řetězců místo z řetězců, čísel nebo symbolů (možnost ze starší verze).", "Make_super_call_the_first_statement_in_the_constructor_90002": "Nastavit volání metody super() jako první příkaz v konstruktoru", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "Typu mapovaného objektu má implicitně typ šablony any.", + "Matched_0_condition_1_6403": "Odpovídá {0} podmínce {1}", "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457": "Porovnává se ve výchozím nastavení se vzorem zahrnutí **/*.", "Matched_by_include_pattern_0_in_1_1407": "Porovnáváno podle vzoru zahrnutí {0} v {1}", "Member_0_implicitly_has_an_1_type_7008": "Člen {0} má implicitně typ {1}.", @@ -919,7 +924,7 @@ "Method_not_implemented_95158": "Metoda není implementovaná.", "Modifiers_cannot_appear_here_1184": "Tady nejde použít modifikátory.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "Modul {0} se dá importovat podle výchozího nastavení jen pomocí příznaku {1}.", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Modul {0} nejde importovat pomocí této konstrukce. Specifikátor se převede jenom na modul ES, který se nedá importovat synchronně. Místo toho použijte dynamický import.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Modul {0} nejde importovat pomocí této konstrukce. Specifikátor se převede jenom na modul ES, který se nedá importovat s příkazem require. Místo toho použijte import ECMAScript.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "Modul {0} deklaruje {1} místně, ale exportuje se jako {2}.", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "Modul {0} deklaruje {1} místně, ale neexportuje se.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "Modul {0} neodkazuje na typ, ale používá se tady jako typ. Měli jste na mysli typeof import('{0}')?", @@ -1103,6 +1108,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Projekt {0} je zastaralý, protože výstupní soubor {1} neexistuje.", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "Projekt {0} je zastaralý, protože jeho výstup se vygeneroval pomocí verze {1}, která se liší od aktuální verze {2}.", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "Projekt {0} je zastaralý, protože se změnil výstup jeho závislosti {1}.", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "Projekt {0} je zastaralý, protože při čtení souboru {1} došlo k chybě.", "Project_0_is_up_to_date_6361": "Projekt {0} je aktuální.", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "Projekt {0} je aktuální, protože nejnovější vstup {1} je starší než výstup {2}.", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "Projekt {0} je aktuální, ale musí aktualizovat časová razítka výstupních souborů, které jsou starší než vstupní soubory.", @@ -1110,6 +1116,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Odkazy projektu nemůžou tvořit cyklický graf. Zjistil se cyklus: {0}", "Projects_6255": "Projekty", "Projects_in_this_build_Colon_0_6355": "Projekty v tomto sestavení: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "Vlastnosti s modifikátorem accessor jsou k dispozici jen při cílení na ECMAScript 2015 a vyšší.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "Vlastnost {0} nemůže mít inicializátor, protože je označená jako abstraktní.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "Vlastnost {0} pochází ze signatury indexu, proto je zapotřebí k ní přistupovat pomocí ['{0}'].", "Property_0_does_not_exist_on_type_1_2339": "Vlastnost {0} v typu {1} neexistuje.", @@ -1216,6 +1223,7 @@ "Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "Překlad pro modul {0} se našel v mezipaměti umístění {1}.", "Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241": "Překlad pro direktivu odkazu na typ {0} se našel v mezipaměti umístění {1}.", "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195": "keyof překládejte jen na názvy vlastností s hodnotami typu string (ne čísla ani symboly).", + "Resolving_in_0_mode_with_conditions_1_6402": "Řešení v režimu {0} s podmínkami {1}.", "Resolving_module_0_from_1_6086": "======== Překládá se modul {0} z {1}. ========", "Resolving_module_name_0_relative_to_base_url_1_2_6094": "Překládá se název modulu {0} relativní k základní adrese URL {1}–{2}.", "Resolving_real_path_for_0_result_1_6130": "Překládá se skutečná cesta pro {0}, výsledek {1}.", @@ -1272,6 +1280,7 @@ "Root_file_specified_for_compilation_1427": "Kořenový soubor, který se zadal pro kompilaci", "STRATEGY_6039": "STRATEGIE", "Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642": "Uložte soubory .tsbuildinfo, aby byla možná přírůstková kompilace projektů.", + "Saw_non_matching_condition_0_6405": "Byla zjištěna neshodná podmínka {0}.", "Scoped_package_detected_looking_in_0_6182": "Zjištěn balíček v oboru, hledání v: {0}", "Selection_is_not_a_valid_statement_or_statements_95155": "Výběr nepředstavuje platný příkaz (platné příkazy).", "Selection_is_not_a_valid_type_node_95133": "Výběr není platným uzlem typů.", @@ -1385,6 +1394,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "Obsahující funkce šipky zachytává globální hodnotu pro this.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "Text obsahující funkce nebo modulu je pro analýzu toku řízení příliš dlouhý.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "Aktuální soubor je modul CommonJS a na nejvyšší úrovni nemůže používat await.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "Aktuální soubor je modul CommonJS, jehož importy vytvoří volání require. Odkazovaný soubor je však modul ECMAScript a nelze ho importovat pomocí příkazu require. Raději zvažte vytvoření dynamického volání import(\"{0}\").", "The_current_host_does_not_support_the_0_option_5001": "Aktuální hostitel nepodporuje možnost {0}.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "Deklarace {0}, kterou jste pravděpodobně chtěli použít, je definovaná tady.", "The_declaration_was_marked_as_deprecated_here_2798": "Deklarace se tady označila jako zastaralá.", @@ -1422,7 +1432,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "Levá strana aritmetické operace musí mít typ any, number, bigint nebo být typu výčtu.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "Levá strana výrazu přiřazení nemůže představovat přístup k nepovinné vlastnosti.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "Levá strana výrazu přiřazení musí být proměnná nebo přístup k vlastnosti.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "Levá strana výrazu in musí být privátní identifikátor nebo typu any, string, number nebo symbol.", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "Levá strana výrazu instanceof musí být typu any, typem objektu nebo parametrem typu.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "Národní prostředí, které se používá při zobrazování zpráv uživateli (třeba cs-CZ)", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "Maximální hloubka závislostí pro vyhledávání pod node_modules a načítání javascriptových souborů", @@ -1443,7 +1452,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "Návratový typ asynchronní funkce nebo metody musí být globální typ Promise. Zamýšleli jste napsat Promise<{0}>?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "Pravá strana příkazu for...in musí být typu any, typem objektu nebo parametrem typu, ale tady má typ {0}.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "Pravá strana aritmetické operace musí mít typ any, number, bigint nebo být typu výčtu.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "Pravá strana výrazu in nesmí být primitivní typ.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "Pravá strana výrazu instanceof musí mít typ any nebo typ, který se dá přiřadit k typu rozhraní Function.", "The_root_value_of_a_0_file_must_be_an_object_5092": "Kořenová hodnota souboru {0} musí být objekt.", "The_shadowing_declaration_of_0_is_defined_here_18017": "Překrývající deklarace {0} je definovaná tady.", @@ -1464,13 +1472,15 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "Typ vrácený metodou {0}() iterátoru musí obsahovat vlastnost value.", "The_types_of_0_are_incompatible_between_these_types_2200": "Typy {0} nejsou mezi těmito typy kompatibilní.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "Typy vrácené metodou {0} nejsou mezi těmito typy kompatibilní.", + "The_value_0_cannot_be_used_here_18050": "Hodnota „{0}“ se tady nedá použít.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "Deklarace proměnné příkazu for...in nemůže obsahovat inicializátor.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "Deklarace proměnné příkazu for...of nemůže obsahovat inicializátor.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "Příkaz with není podporovaný. Všechny symboly s blokem with budou typu any.", "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "Vlastnost {0} této značky JSX očekává jeden podřízený objekt typu {1}, ale poskytlo se jich více.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "Vlastnost {0} této značky JSX očekává typ {1}, který vyžaduje více podřízených objektů, ale zadal se jen jeden.", + "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "Toto porovnání se zdá být neúmyslné, protože typy {0} a {1} se nijak nepřekrývají.", + "This_condition_will_always_return_0_2845": "Tato podmínka vždy vrátí {0}.", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "Tato podmínka vždy vrátí „{0}“, protože JavaScript porovnává objekty pomocí odkazu, nikoli hodnoty.", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "Tato podmínka vždy vrátí {0}, protože typy {1} a {2} se nijak nepřekrývají.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Tato podmínka vždy vrátí hodnotu True, protože tato {0} je vždy definovaná.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "Tato podmínka vždy vrátí hodnotu True, protože tato funkce je vždy definována. Chtěli jste ji místo toho nazvat?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Tato funkce konstruktoru se může převést na deklaraci třídy.", @@ -1491,7 +1501,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Tento člen musí mít modifikátor override, protože přepisuje člen v základní třídě {0}.", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Tento člen musí mít modifikátor override, protože přepisuje abstraktní metodu, která je deklarovaná v základní třídě {0}.", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "Na tento modul je možné se pomocí importů nebo exportů ECMAScript odkazovat jen tak, že se zapne příznak {0} a odkáže se na výchozí export.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Tento modul se deklaroval pomocí export =, a když se používá příznak {0}, dá se použít jen s výchozím importem.", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Tento modul se deklaroval pomocí export =, a dá se použít jenom s výchozím importem při použití příznaku {0}.", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Tato signatura přetížení není kompatibilní se signaturou implementace.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Tento parametr se nepodporuje s direktivou use strict.", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "Tato vlastnost parametru musí mít komentář JSDoc se značkou @override, protože přepisuje člen v základní třídě {0}.", @@ -1504,6 +1514,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Tato syntaxe vyžaduje importovanou pomocnou rutinu s názvem {1} a parametry {2}, která není kompatibilní s tou v {0}. Zvažte upgrade verze {0}.", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Tento parametr typu může potřebovat omezení extends {0}.", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "Toto použití importu není platné. Volání import() se dají zapsat, ale musí mít závorky a nemůžou mít typové argumenty.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Pokud chcete tento soubor převést na modul ECMAScript, přidejte pole \"type\": \"module\" do {0}.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Pokud chcete tento soubor převést na modul ECMAScript, změňte jeho příponu na {0}\" nebo přidejte pole \"type\": \"module\" do {1}.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Pokud chcete tento soubor převést na modul ECMAScript, změňte jeho příponu na {0} nebo vytvořte místní soubor package.json s {\"type\": \"module\"}.", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Pokud chcete tento soubor převést na modul ECMAScript, vytvořte místní soubor package.json s { \"type\": \"module\" }.", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "Výrazy await nejvyšší úrovně se povolují jen v případě, že možnost module je nastavená na es2022, esnext, system, node16 nebo nodenext a možnost target je nastavená na es2017 nebo vyšší.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": "Deklarace nejvyšší úrovně v souborech .d.ts musí začínat modifikátorem declare, nebo export.", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "Smyčky for await nejvyšší úrovně se povolují jen v případě, že možnost module je nastavená na es2022, esnext, system, node16 nebo nodenext a možnost target je nastavená na es2017 nebo vyšší.", @@ -1519,6 +1533,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "Typ {0} se nedá použít jako typ indexu.", "Type_0_cannot_be_used_to_index_type_1_2536": "Typ {0} nejde použít k indexování typu {1}.", "Type_0_does_not_satisfy_the_constraint_1_2344": "Typ {0} nevyhovuje omezení {1}.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "Typ {0} nevyhovuje očekávanému typu {1}.", "Type_0_has_no_call_signatures_2757": "Typ {0} nemá žádné signatury volání.", "Type_0_has_no_construct_signatures_2761": "Typ {0} nemá žádné signatury konstruktu.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "Typ {0} nemá odpovídající signaturu indexu pro typ {1}.", @@ -1540,6 +1555,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "Typ {0} se nedá přiřadit k typu {1} s hodnotou exactOptionalPropertyTypes: true. Zvažte možnost přidat hodnotu undefined do typu cíle.", "Type_0_is_not_comparable_to_type_1_2678": "Typ {0} se nedá porovnat s typem {1}.", "Type_0_is_not_generic_2315": "Typ {0} není obecný.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "Typ {0} může představovat primitivní hodnotu, která není povolena jako pravý operand operátoru in.", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Typ {0} musí mít metodu [Symbol.asyncIterator](), která vrací asynchronní iterátor.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Typ {0} musí mít metodu [Symbol.iterator](), která vrací iterátor.", "Type_0_provides_no_match_for_the_signature_1_2658": "Typ {0} neposkytuje žádnou shodu pro podpis {1}.", @@ -1596,6 +1612,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== Direktiva odkazu na typ {0} se nepřeložila. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== Direktiva odkazu na typ {0} se úspěšně přeložila na {1}, primární: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== Direktiva odkazu na typ {0} se úspěšně přeložila na {1} s ID balíčku {2}, primární: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "Kontrolní výrazy typů se dají používat jen v typescriptových souborech.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "Typy se v deklaracích exportu v souborech JavaScriptu nemůžou vyskytovat.", "Types_have_separate_declarations_of_a_private_property_0_2442": "Typy mají samostatné deklarace privátní vlastnosti {0}.", "Types_of_construct_signatures_are_incompatible_2419": "Typy signatur konstruktorů nejsou kompatibilní.", @@ -1637,9 +1654,12 @@ "Updating_output_of_project_0_6373": "Aktualizuje se výstup projektu {0}...", "Updating_output_timestamps_of_project_0_6359": "Aktualizují se výstupní časová razítka projektu {0}...", "Updating_unchanged_output_timestamps_of_project_0_6371": "Aktualizují se nezměněná výstupní časová razítka projektu {0}...", + "Use_0_95174": "Použít {0}", + "Use_Number_isNaN_in_all_conditions_95175": "Ve všech podmínkách použijte Number.isNaN.", "Use_element_access_for_0_95145": "Použít přístup k elementům pro {0}", "Use_element_access_for_all_undeclared_properties_95146": "Použít přístup k elementům pro všechny nedeklarované vlastnosti", "Use_synthetic_default_member_95016": "Použije syntetického výchozího člena.", + "Using_0_subpath_1_with_target_2_6404": "Používá se {0} dílčí cesta {1} s cílem {2}.", "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "Použití řetězce v příkazu for...of se podporuje jenom v ECMAScript 5 nebo vyšší verzi.", "Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915": "Použití --build, -b způsobí, že se tsc bude chovat spíše jako orchestrátor sestavení než kompilátor. Pomocí této možnosti můžete aktivovat vytváření složených projektů, o kterých se můžete dozvědět více {0}", "Using_compiler_options_of_project_reference_redirect_0_6215": "Using compiler options of project reference redirect '{0}'.", @@ -1717,6 +1737,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "{0} není platnou metavlastností pro klíčové slovo {1}. Měli jste na mysli {2}?", "_0_is_not_allowed_as_a_parameter_name_1390": "{0} není povolen jako název parametru.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "{0} se nepovoluje jako název deklarace proměnné.", + "_0_is_of_type_unknown_18046": "„{0}“ je typ unknown", + "_0_is_possibly_null_18047": "„{0}“ je pravděpodobně typ null.", + "_0_is_possibly_null_or_undefined_18049": "„{0}“ je typ null nebo undefined", + "_0_is_possibly_undefined_18048": "„{0}“ je pravděpodobně typ undefined.", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "Na {0} se přímo nebo nepřímo odkazuje ve vlastním základním výrazu.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "Na {0} se odkazuje přímo nebo nepřímo v jeho vlastní anotaci typu.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "{0} se zadalo více než jednou, proto se toto použití přepíše.", @@ -1752,6 +1776,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "{0} s chybějící anotací návratového typu má implicitně návratový typ {1}.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "{0} s chybějící anotací návratového typu má implicitně typ yield {1}.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "Modifikátor abstract se může objevit jenom v deklaraci třídy, metody nebo vlastnosti.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "Modifikátor accessor se může objevit jenom v deklaraci vlastnosti.", "and_here_6204": "a tady.", "arguments_cannot_be_referenced_in_property_initializers_2815": "Na argumenty nejde odkazovat v inicializátorech vlastností.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "auto: Považovat soubory s importy, exporty, import.meta, jsx (s jsx: react-jsx) nebo formátem esm (s modulem node16+) za moduly.", diff --git a/node_modules/typescript/lib/de/diagnosticMessages.generated.json b/node_modules/typescript/lib/de/diagnosticMessages.generated.json index 5e4c01914..8aa99fe93 100644 --- a/node_modules/typescript/lib/de/diagnosticMessages.generated.json +++ b/node_modules/typescript/lib/de/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "Ein abstrakter Accessor kann keine Implementierung aufweisen.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "Ein Zugriffsmodifizierer kann nicht mit einem privaten Bezeichner verwendet werden.", "An_accessor_cannot_have_type_parameters_1094": "Eine Zugriffsmethode darf keine Typparameter aufweisen.", + "An_accessor_property_cannot_be_declared_optional_1276": "Eine Accessoreigenschaft kann nicht als optional deklariert werden.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Eine Umgebungsmoduldeklaration ist nur auf der obersten Ebene in einer Datei zulässig.", "An_argument_for_0_was_not_provided_6210": "Für \"{0}\" wurde ein Argument nicht angegeben.", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "Es wurde kein Argument angegeben, das diesem Bindungsmuster entspricht.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "Die Klasse \"{0}\" implementiert fälschlicherweise die Klasse \"{1}\". Wollten Sie \"{1}\" erweitern und ihre Member als Unterklasse vererben?", "Class_0_incorrectly_implements_interface_1_2420": "Die Klasse \"{0}\" implementiert fälschlicherweise die Schnittstelle \"{1}\".", "Class_0_used_before_its_declaration_2449": "Klasse \"{0}\", die vor der Deklaration verwendet wurde.", - "Class_constructor_may_not_be_a_generator_1360": "Der Klassenkonstruktor darf kein Generator sein.", + "Class_constructor_may_not_be_a_generator_1368": "Der Klassenkonstruktor darf kein Generator sein.", "Class_constructor_may_not_be_an_accessor_1341": "Der Klassenkonstruktor darf kein Accessor sein.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "Die Klassendeklaration kann die Überladungsliste für \"{0}\" nicht implementieren.", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "Klassendeklarationen dürfen maximal ein \"@augments\"- oder \"@extends\"-Tag aufweisen.", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "Die Konvertierung des Typs \"{0}\" in den Typ \"{1}\" kann ein Fehler sein, weil die Typen keine ausreichende Überschneidung aufweisen. Wenn dies beabsichtigt war, konvertieren Sie den Ausdruck zuerst in \"unknown\".", "Convert_0_to_1_in_0_95003": "\"{0}\" in \"{1} in {0}\" konvertieren", "Convert_0_to_mapped_object_type_95055": "\"{0}\" in zugeordneten Objekttyp konvertieren", + "Convert_all_const_to_let_95102": "Alle \"const\" in \"let\" konvertieren", "Convert_all_constructor_functions_to_classes_95045": "Alle Konstruktorfunktionen in Klassen konvertieren", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Alle nicht als Wert verwendeten Importe in reine Typenimporte konvertieren", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Alle ungültigen Zeichen in HTML-Entitätscode konvertieren", @@ -658,6 +660,8 @@ "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219": "Die experimentelle Unterstützung für decorator-Elemente ist ein Feature, das in zukünftigen Versionen Änderungen unterliegt. Legen Sie die Option \"-experimentalDecorators\" in Ihrer \"tsconfig\" oder \"jsconfig\" fest, um diese Warnung zu entfernen.", "Explicitly_specified_module_resolution_kind_Colon_0_6087": "Explizit angegebene Art der Modulauflösung: \"{0}\".", "Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791": "Die Potenzierung kann für bigint-Werte nur durchgeführt werden, wenn die Option \"target\" auf \"es2016\" oder höher festgelegt ist.", + "Export_0_from_module_1_90059": "Exportieren von \"{0}\" aus Modul \"{1}\"", + "Export_all_referenced_locals_90060": "Alle referenzierten lokalen Elemente exportieren", "Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203": "Die Exportzuweisung darf nicht verwendet werden, wenn das Ziel ECMAScript-Module sind. Verwenden Sie stattdessen ggf. \"export default\" oder ein anderes Modulformat.", "Export_assignment_is_not_supported_when_module_flag_is_system_1218": "Die Exportzuweisung wird nicht unterstützt, wenn das Flag \"-module\" den Wert \"system\" aufweist.", "Export_declaration_conflicts_with_exported_declaration_of_0_2484": "Die Exportdeklaration verursacht einen Konflikt mit der exportierten Deklaration von \"{0}\".", @@ -906,6 +910,7 @@ "Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650": "Stellen Sie ein, dass keyof nur Zeichenfolgen, anstelle von Zeichenfolgen, Zahlen oder Symbolen zurückgibt. Legacy-Option.", "Make_super_call_the_first_statement_in_the_constructor_90002": "super()-Aufruf als erste Anweisung im Konstruktor festlegen", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "Der zugeordnete Objekttyp weist implizit einen any-Vorlagentyp auf.", + "Matched_0_condition_1_6403": "Übereinstimmung mit \"{0}\" Bedingung \"{1}\".", "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457": "Standardmäßig zugeordnetes Includemuster „**/*“", "Matched_by_include_pattern_0_in_1_1407": "Abgeglichen mit dem include-Muster \"{0}\" in \"{1}\"", "Member_0_implicitly_has_an_1_type_7008": "Der Member \"{0}\" weist implizit den Typ \"{1}\" auf.", @@ -919,7 +924,7 @@ "Method_not_implemented_95158": "Die Methode ist nicht implementiert.", "Modifiers_cannot_appear_here_1184": "Modifizierer dürfen hier nicht enthalten sein.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "Das Modul \"{0}\" kann nur mit dem Flag \"{1}\" als Standard importiert werden.", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Das Modul \"{0}\" kann nicht mithilfe dieses Konstrukts importiert werden. Der Spezifizierer wird nur in ein ES-Modul aufgelöst, das nicht synchron importiert werden kann. Verwenden Sie stattdessen den dynamischen Import.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Das Modul \"{0}\" kann nicht mit diesem Konstrukt importiert werden. Der Spezifizierer wird nur in ein ES-Modul aufgelöst, das nicht mit \"require\" importiert werden kann. Verwenden Sie stattdessen einen ECMAScript-Import.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "Das Modul \"{0}\" deklariert \"{1}\" lokal, der Export erfolgt jedoch als \"{2}\".", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "Das Modul \"{0}\" deklariert \"{1}\" lokal, es erfolgt jedoch kein Export.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "Das Modul \"{0}\" verweist nicht auf einen Typ, wird hier aber als Typ verwendet. Meinten Sie \"typeof import('{0}')\"?", @@ -1103,6 +1108,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Projekt \"{0}\" ist veraltet, weil die Ausgabedatei \"{1}\" nicht vorhanden ist.", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "Das Projekt \"{0}\" ist veraltet, weil die Ausgabe für das Projekt mit Version {1} generiert wurde, die sich von der aktuellen Version {2} unterscheidet.", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "Das Projekt \"{0}\" ist veraltet, weil sich die zugehörige Abhängigkeit \"{1}\" geändert hat.", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "Das Projekt \"{0}\" ist veraltet, weil beim Lesen der Datei \"{1}\" ein Fehler aufgetreten ist.", "Project_0_is_up_to_date_6361": "Projekt \"{0}\" ist auf dem neuesten Stand.", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "Projekt \"{0}\" ist auf dem neuesten Stand, weil die neueste Eingabe \"{1}\" älter ist als die Ausgabe \"{2}\".", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "Das Projekt \"{0}\" ist aktuell, muss jedoch Zeitstempel von Ausgabedateien aktualisieren, die älter als Eingabedateien sind.", @@ -1110,6 +1116,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Projektverweise dürfen keinen kreisförmigen Graphen bilden. Zyklus erkannt: {0}", "Projects_6255": "Projekte", "Projects_in_this_build_Colon_0_6355": "Projekte in diesem Build: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "Eigenschaften mit dem Accessormodifizierer sind nur für ECMAScript 2015 und höher verfügbar.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "Die Eigenschaft \"{0}\" darf keinen Initialisierer aufweisen, weil sie als abstrakt markiert ist.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "Die Eigenschaft \"{0}\" stammt aus einer Indexsignatur. Der Zugriff muss daher mit [\"{0}\"] erfolgen.", "Property_0_does_not_exist_on_type_1_2339": "Die Eigenschaft \"{0}\" ist für den Typ \"{1}\" nicht vorhanden.", @@ -1216,6 +1223,7 @@ "Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "Die Auflösung für das Modul \"{0}\" wurde im Cache des Standorts \"{1}\" gefunden.", "Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241": "Die Auflösung für die Typreferenzanweisung \"{0}\" wurde im Cache des Standorts \"{1}\" gefunden.", "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195": "\"keyof\" darf nur in Eigenschaftennamen mit Zeichenfolgenwert aufgelöst werden (keine Ziffern oder Symbole).", + "Resolving_in_0_mode_with_conditions_1_6402": "Wird im {0}-Modus mit Bedingungen \"{1}\" aufgelöst.", "Resolving_module_0_from_1_6086": "======== Das Modul \"{0}\" aus \"{1}\" wird aufgelöst. ========", "Resolving_module_name_0_relative_to_base_url_1_2_6094": "Der Modulname \"{0}\" relativ zur Basis-URL \"{1}\"–\"{2}\" wird aufgelöst.", "Resolving_real_path_for_0_result_1_6130": "Der tatsächliche Pfad für \"{0}\" wird aufgelöst, Ergebnis \"{1}\".", @@ -1272,6 +1280,7 @@ "Root_file_specified_for_compilation_1427": "Für die Kompilierung angegebene Stammdatei", "STRATEGY_6039": "STRATEGIE", "Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642": "Speichern Sie die .tsbuildinfo-Dateien, um eine inkrementelle Kompilierung von Projekten zuzulassen.", + "Saw_non_matching_condition_0_6405": "Die nicht übereinstimmende Bedingung \"{0}\" wurde angezeigt.", "Scoped_package_detected_looking_in_0_6182": "Bereichsbezogenes Paket erkannt. In \"{0}\" wird gesucht", "Selection_is_not_a_valid_statement_or_statements_95155": "Die Auswahl umfasst keine gültigen Anweisungen.", "Selection_is_not_a_valid_type_node_95133": "Die Auswahl ist kein gültiger Typknoten.", @@ -1385,6 +1394,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "Die enthaltende Pfeilfunktion erfasst den globalen Wert von \"this\".", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "Der beinhaltende Funktions- oder Modulkörper ist zu groß für eine Ablaufsteuerungsanalyse.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "Die aktuelle Datei ist ein CommonJS-Modul und kann „await“ nicht auf der obersten Ebene verwenden.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "Die aktuelle Datei ist ein CommonJS-Modul, dessen Importe \"require\"-Aufrufe generieren. Die Datei, auf die verwiesen wird, ist jedoch ein ECMAScript-Modul und kann nicht mit \"require\" importiert werden. Erwägen Sie stattdessen, einen dynamischen 'import(\"{0}\")'-Aufruf zu schreiben.", "The_current_host_does_not_support_the_0_option_5001": "Der aktuelle Host unterstützt die Option \"{0}\" nicht.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "Die Deklaration von \"{0}\", die Sie wahrscheinlich verwenden wollten, ist hier definiert.", "The_declaration_was_marked_as_deprecated_here_2798": "Die Deklaration wurde hier als veraltet markiert.", @@ -1422,7 +1432,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "Die linke Seite einer arithmetischen Operation muss den Typ \"any\", \"number\" oder \"bigint\" aufweisen oder ein Enumerationstyp sein.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "Die linke Seite eines Zuweisungsausdrucks darf kein optionaler Eigenschaftenzugriff sein.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "Die linke Seite eines Zuweisungsausdrucks muss eine Variable oder ein Eigenschaftenzugriff sein.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "Die linke Seite eines in-Ausdrucks muss ein privater Bezeichner sein oder zum Typ \"any\", \"string\", \"number\" oder \"symbol\" gehören.", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "Die linke Seite eines instanceof-Ausdrucks muss den Typ \"any\" aufweisen oder ein Objekttyp bzw. ein Typparameter sein.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "Das beim Anzeigen von Meldungen für den Benutzer verwendete Gebietsschema (z. B. \"de-de\").", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "Die maximale Abhängigkeitstiefe, die unter \"node_modules\" durchsucht und für die JavaScript-Dateien geladen werden sollen.", @@ -1443,7 +1452,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "Der Rückgabetyp einer asynchronen Funktion oder Methode muss der globale Typ \"Promise\" sein. Wollten Sie eigentlich \"Promise<{0}>\" verwenden?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "Die rechte Seite einer for...in-Anweisung muss den Typ \"any\" aufweisen oder ein Objekttyp bzw. ein Typparameter sein. Sie weist hier jedoch den Typ \"{0}\" auf.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "Die rechte Seite einer arithmetischen Operation muss den Typ \"any\", \"number\" oder \"bigint\" aufweisen oder ein Enumerationstyp sein.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "Die rechte Seite eines in-Ausdrucks darf kein primitiver Typ sein.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "Die rechte Seite eines instanceof-Ausdrucks muss den Typ \"any\" oder einen Typ aufweisen, der dem Schnittstellentyp \"Function\" zugewiesen werden kann.", "The_root_value_of_a_0_file_must_be_an_object_5092": "Der Stammwert einer {0}-Datei muss ein Objekt sein.", "The_shadowing_declaration_of_0_is_defined_here_18017": "Die verbergende Deklaration von \"{0}\" ist hier definiert.", @@ -1464,13 +1472,15 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "Der von der {0}()-Methode eines Iterators zurückgegebene Typ muss eine value-Eigenschaft aufweisen.", "The_types_of_0_are_incompatible_between_these_types_2200": "Die Typen von \"{0}\" sind zwischen diesen Typen nicht kompatibel.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "Die von \"{0}\" zurückgegebenen Typen sind zwischen diesen Typen nicht kompatibel.", + "The_value_0_cannot_be_used_here_18050": "Der Wert \"{0}\" kann hier nicht verwendet werden.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "Die Variablendeklaration einer for...in-Anweisung darf keinen Initialisierer aufweisen.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "Die Variablendeklaration einer for...of-Anweisung darf keinen Initialisierer aufweisen.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "Die with-Anweisung wird nicht unterstützt. Alle Symbole in einem with-Block weisen den Typ \"any\" auf.", "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "Die Eigenschaft \"{0}\" für dieses JSX-Tag erwartet ein einzelnes untergeordnetes Element vom Typ \"{1}\", aber es wurden mehrere untergeordnete Elemente angegeben.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "Die Eigenschaft \"{0}\" für dieses JSX-Tag erwartet den Typ \"{1}\", der mehrere untergeordnete Elemente erfordert, aber es wurde nur ein untergeordnetes Elemente angegeben.", + "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "Dieser Vergleich scheint unbeabsichtigt zu sein, da die Typen \"{0}\" und \"{1}\" keine Überlappung aufweisen.", + "This_condition_will_always_return_0_2845": "Diese Bedingung gibt immer „{0}“ zurück.", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "Diese Bedingung gibt immer „{0}“ zurück, da JavaScript Objekte nach Verweis und nicht nach Wert vergleicht.", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "Diese Bedingung gibt immer \"{0}\" zurück, weil die Typen \"{1}\" und \"{2}\" keine Überschneidung aufweisen.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Diese Bedingung gibt immer TRUE zurück, weil diese '{0}' immer definiert ist.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "Diese Bedingung gibt immer TRUE zurück, weil diese Funktion immer definiert ist. Möchten Sie sie stattdessen aufrufen?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Diese Konstruktorfunktion kann in eine Klassendeklaration konvertiert werden.", @@ -1491,7 +1501,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Dieser Member muss einen override-Modifizierer aufweisen, weil er einen Member in der Basisklasse \"{0}\" überschreibt.", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Dieser Member muss einen override-Modifizierer aufweisen, weil er eine abstrakte Methode überschreibt, die in der Basisklasse \"{0}\" deklariert ist.", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "Auf dieses Modul kann nur mit ECMAScript-Importen/-Exporten verwiesen werden, indem das Flag \"{0}\" aktiviert und auf den Standardexport verwiesen wird.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Dieses Modul wird mit \"export =\" deklariert und kann nur bei Verwendung des Flags \"{0}\" mit einem Standardimport verwendet werden.", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Dieses Modul wird mit „export =“ deklariert und kann nur bei Verwendung des Kennzeichnens „{0}“ mit einem Standardimport verwendet werden.", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Diese Überladungssignatur ist nicht mit der zugehörigen Implementierungssignatur kompatibel.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Dieser Parameter ist mit der Direktive \"use strict\" nicht zugelassen.", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "Diese Parametereigenschaft muss über einen JSDoc-Kommentar mit einem \"@override\"-Tag verfügen, da sie ein Mitglied in der Basisklasse \"{0}\" überschreibt.", @@ -1504,6 +1514,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Diese Syntax erfordert ein importiertes Hilfsprogramm mit dem Namen \"{1}\" mit {2} Parametern, die nicht mit der in \"{0}\" kompatibel ist. Erwägen Sie ein Upgrade Ihrer Version von \"{0}\".", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Für diesen Typparameter ist möglicherweise die Einschränkung \"extends {0}\" erforderlich.", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "Diese Verwendung von „import“ ist ungültig. „import()“-Aufrufe können geschrieben werden, müssen jedoch Klammern aufweisen und dürfen keine Typargumente aufweisen.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Um diese Datei in ein ECMAScript-Modul zu konvertieren, fügen Sie das Feld \"type\": \"module\" zu \"{0}\" hinzu.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Um diese Datei in ein ECMAScript-Modul zu konvertieren, ändern Sie die Dateierweiterung in \"{0}\", oder fügen Sie das Feld ''type': 'module'' zu \"{1}\" hinzu.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Um diese Datei in ein ECMAScript-Modul zu konvertieren, ändern Sie ihre Dateierweiterung in '{0}', oder erstellen Sie eine lokale package.json-Datei mit `{ \"type\": \"module\" }`.", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Um diese Datei in ein ECMAScript-Modul zu konvertieren, erstellen Sie eine lokale package.json-Datei mit `{ \"type\": \"module\" }`.", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "'await'-Ausdrücke der obersten Ebene sind nur zulässig, wenn die 'module'-Option auf 'es2022', 'esnext', 'system', 'node16' oder 'nodenext' und die 'target'-Option auf ' es2017' oder höher.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": "Deklarationen der obersten Ebene in .d.ts-Dateien müssen entweder mit einem declare- oder einem export-Modifizierer beginnen.", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "'for await'-Schleifen der obersten Ebene sind nur erlaubt, wenn die 'module'-Option auf 'es2022', 'esnext', 'system', 'node16' oder 'nodenext' gesetzt ist und die 'target'-Option auf gesetzt ist 'es2017' oder höher.", @@ -1519,6 +1533,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "Der Typ \"{0}\" kann nicht als Indextyp verwendet werden.", "Type_0_cannot_be_used_to_index_type_1_2536": "Der Typ \"{0}\" kann nicht zum Indizieren von Typ \"{1}\" verwendet werden.", "Type_0_does_not_satisfy_the_constraint_1_2344": "Der Typ \"{0}\" erfüllt die Einschränkung \"{1}\" nicht.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "Der Typ \"{0}\" erfüllt den erwarteten Typ \"{1}\" nicht.", "Type_0_has_no_call_signatures_2757": "Der Typ \"{0}\" weist keine Aufrufsignaturen auf.", "Type_0_has_no_construct_signatures_2761": "Der Typ \"{0}\" weist keine Konstruktsignaturen auf.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "Der Typ \"{0}\" weist keine übereinstimmende Indexsignatur für den Typ \"{1}\" auf.", @@ -1540,6 +1555,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "Der Typ „{0}“ kann dem Typ „{1}“ mit „exactOptionalPropertyTypes: true“ nicht zugewiesen werden. Erwägen Sie das Hinzufügen von „undefined“ zum Typ des Ziels.", "Type_0_is_not_comparable_to_type_1_2678": "Der Typ \"{0}\" kann nicht mit dem Typ \"{1}\" verglichen werden.", "Type_0_is_not_generic_2315": "Der Typ \"{0}\" ist nicht generisch.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "Typ „{0}“ kann einen primitiven Wert darstellen, der als rechter Operand des „In“-Operators nicht zulässig ist.", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Der Typ \"{0}\" muss eine Methode \"[Symbol.asyncIterator]()\" aufweisen, die einen async-Iterator zurückgibt.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Der Typ \"{0}\" muss eine Methode \"[Symbol.iterator]()\" aufweisen, die einen Iterator zurückgibt.", "Type_0_provides_no_match_for_the_signature_1_2658": "Der Typ \"{0}\" enthält keine Entsprechung für die Signatur \"{1}\".", @@ -1596,6 +1612,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== Die Typverweisdirektive \"{0}\" wurde nicht aufgelöst. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== Die Typverweisdirektive \"{0}\" wurde erfolgreich in \"{1}\" aufgelöst. Primär: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== Die Typverweisdirektive \"{0}\" wurde erfolgreich in \"{1}\" mit Paket-ID \"{2}\" aufgelöst. Primär: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "Typerfüllungsausdrücke können nur in TypeScript-Dateien verwendet werden.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "Typen können in Exportdeklarationen in JavaScript-Dateien nicht angezeigt werden.", "Types_have_separate_declarations_of_a_private_property_0_2442": "Typen weisen separate Deklarationen einer privaten Eigenschaft \"{0}\" auf.", "Types_of_construct_signatures_are_incompatible_2419": "Die Typen der Konstruktsignaturen sind nicht kompatibel.", @@ -1637,9 +1654,12 @@ "Updating_output_of_project_0_6373": "Ausgabe von Projekt \"{0}\" wird aktualisiert...", "Updating_output_timestamps_of_project_0_6359": "Ausgabezeitstempel von Projekt \"{0}\" werden aktualisiert...", "Updating_unchanged_output_timestamps_of_project_0_6371": "Unveränderte Ausgabezeitstempel von Projekt \"{0}\" werden aktualisiert...", + "Use_0_95174": "Verwenden Sie „{0}“.", + "Use_Number_isNaN_in_all_conditions_95175": "Verwenden Sie „Number.isNaN“ unter allen Bedingungen.", "Use_element_access_for_0_95145": "Elementzugriff für \"{0}\" verwenden", "Use_element_access_for_all_undeclared_properties_95146": "Elementzugriff für alle nicht deklarierten Eigenschaften verwenden", "Use_synthetic_default_member_95016": "Verwenden Sie den synthetischen Member \"default\".", + "Using_0_subpath_1_with_target_2_6404": "Verwenden von \"{0}\" Unterpfad \"{1}\" mit Ziel \"{2}\".", "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "Das Verwenden einer Zeichenfolge in einer for...of-Anweisung wird nur in ECMAScript 5 oder höher unterstützt.", "Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915": "Bei Verwendung von --build wird tsc durch -b dazu veranlasst, sich eher wie ein Build-Orchestrator als ein Compiler zu verhalten. Damit wird der Aufbau von zusammengesetzten Projekten ausgelöst. Weitere Informationen dazu finden Sie unter {0}", "Using_compiler_options_of_project_reference_redirect_0_6215": "Compileroptionen der Projektverweisumleitung \"{0}\" werden verwendet.", @@ -1717,6 +1737,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "\"{0}\" ist keine gültige Metaeigenschaft für das Schlüsselwort \"{1}\". Meinten Sie \"{2}\"?", "_0_is_not_allowed_as_a_parameter_name_1390": "\"{0}\" ist als Parametername nicht zulässig.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "\"{0}\" ist als Name für Variablendeklarationen nicht zulässig.", + "_0_is_of_type_unknown_18046": "\"{0}\" ist vom Typ \"unbekannt\".", + "_0_is_possibly_null_18047": "\"{0}\" ist möglicherweise \"null\".", + "_0_is_possibly_null_or_undefined_18049": "\"{0}\" ist möglicherweise \"null\" oder \"nicht definiert\".", + "_0_is_possibly_undefined_18048": "\"{0}\" ist möglicherweise nicht \"nicht definiert\".", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "Auf \"{0}\" wird direkt oder indirekt im eigenen Basisausdruck verwiesen.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "Auf \"{0}\" wird direkt oder indirekt in der eigenen Typanmerkung verwiesen.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "\"{0}\" wurde mehrmals angegeben, deshalb wird dieses Vorkommen überschrieben.", @@ -1752,6 +1776,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "\"{0}\" ohne Rückgabetypanmerkung weist implizit einen Rückgabetyp \"{1}\" auf.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "\"{0}\" ohne Rückgabetypanmerkung weist implizit einen yield-Typ \"{1}\" auf.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "Der Modifizierer \"abstract\" darf nur für eine Klassen-, Methoden- oder Eigenschaftendeklaration verwendet werden.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "Der Accessormodifizierer kann nur in einer Eigenschaftendeklaration angezeigt werden.", "and_here_6204": "und hier.", "arguments_cannot_be_referenced_in_property_initializers_2815": "Auf \"arguments\" kann in Eigenschaftsinitialisierern nicht verwiesen werden.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "„auto“: Dateien mit imports, exports, import.meta, jsx (mit jsx: respond-jsx) oder esm-Format (mit module: node16+) als Module behandeln.", diff --git a/node_modules/typescript/lib/es/diagnosticMessages.generated.json b/node_modules/typescript/lib/es/diagnosticMessages.generated.json index 06fd2b618..242b20b06 100644 --- a/node_modules/typescript/lib/es/diagnosticMessages.generated.json +++ b/node_modules/typescript/lib/es/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "Un descriptor de acceso abstracto no puede tener una implementación.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "No se puede usar un modificador de accesibilidad con un identificador privado.", "An_accessor_cannot_have_type_parameters_1094": "Un descriptor de acceso no puede tener parámetros de tipo.", + "An_accessor_property_cannot_be_declared_optional_1276": "Una propiedad 'accessor' no se puede declarar como opcional.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Una declaración de módulo de ambiente solo se permite en el nivel superior de un archivo.", "An_argument_for_0_was_not_provided_6210": "No se proporcionó ningún argumento para \"{0}\".", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "No se proporcionó ningún argumento que coincida con este patrón de enlace.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "La clase \"{0}\" no implementa correctamente la clase \"{1}\". ¿Pretendía extender \"{1}\" y heredar sus miembros como una subclase?", "Class_0_incorrectly_implements_interface_1_2420": "La clase '{0}' implementa la interfaz '{1}' de forma incorrecta.", "Class_0_used_before_its_declaration_2449": "Se ha usado la clase \"{0}\" antes de declararla.", - "Class_constructor_may_not_be_a_generator_1360": "El constructor de clase no puede ser un generador.", + "Class_constructor_may_not_be_a_generator_1368": "El constructor de clase no puede ser un generador.", "Class_constructor_may_not_be_an_accessor_1341": "El constructor de clase no puede ser un descriptor de acceso.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "La declaración de clase no puede implementar la lista de sobrecarga para '{0}'.", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "Las declaraciones de clase no pueden tener más de una etiqueta \"@augments\" o \"@extends\".", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "La conversión del tipo \"{0}\" al tipo \"{1}\" puede ser un error, porque ninguno de los tipos se superpone suficientemente al otro. Si esto era intencionado, convierta primero la expresión en \"unknown\".", "Convert_0_to_1_in_0_95003": "Convertir \"{0}\" a \"{1} en \"{0}\"", "Convert_0_to_mapped_object_type_95055": "Convertir \"{0}\" en el tipo de objeto asignado", + "Convert_all_const_to_let_95102": "Convertir todo \"const\" en \"let\"", "Convert_all_constructor_functions_to_classes_95045": "Convertir todas las funciones de constructor en clases", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Convertir todas las importaciones no usadas como valor para las importaciones solo de tipo", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Convertir todos los caracteres no válidos al código de entidad HTML", @@ -658,6 +660,8 @@ "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219": "La compatibilidad experimental con los decoradores es una característica que está sujeta a cambios en una próxima versión. Establezca la opción \"experimentalDecorators\" en \"tsconfig\" o \"jsconfig\" para quitar esta advertencia.", "Explicitly_specified_module_resolution_kind_Colon_0_6087": "Tipo de resolución de módulo especificado de forma explícita: '{0}'.", "Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791": "No se puede realizar la exponenciación en los valores \"bigint\", a menos que la opción \"target\" esté establecida en \"es2016\" o posterior.", + "Export_0_from_module_1_90059": "Exportar '{0}' desde el módulo '{1}'", + "Export_all_referenced_locals_90060": "Exportar todas las variables locales a las que se hace referencia", "Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203": "No se puede usar una asignación de exportación cuando se eligen módulos de ECMAScript como destino. Considere la posibilidad de usar \"export default\" u otro formato de módulo en su lugar.", "Export_assignment_is_not_supported_when_module_flag_is_system_1218": "La asignación de exportación no es compatible cuando la marca \"--module\" es \"system\".", "Export_declaration_conflicts_with_exported_declaration_of_0_2484": "La declaración de exportación está en conflicto con la declaración exportada de \"{0}\".", @@ -906,6 +910,7 @@ "Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650": "Haga que keyof solo devuelva cadenas en lugar de cadenas, números o símbolos. Opción heredada.", "Make_super_call_the_first_statement_in_the_constructor_90002": "Hacer que la llamada a \"super()\" sea la primera instrucción del constructor", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "El tipo de objeto asignado tiene implícitamente un tipo de plantilla \"any\".", + "Matched_0_condition_1_6403": "Coincidente con '{0}' condición '{1}'.", "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457": "La coincidencia de forma predeterminada incluye el patrón '**/*'", "Matched_by_include_pattern_0_in_1_1407": "Coincidencia con el patrón de inclusión \"{0}\" en \"{1}\"", "Member_0_implicitly_has_an_1_type_7008": "El miembro '{0}' tiene un tipo '{1}' implícitamente.", @@ -919,7 +924,7 @@ "Method_not_implemented_95158": "El método no está implementado.", "Modifiers_cannot_appear_here_1184": "Los modificadores no pueden aparecer aquí.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "El módulo \"{0}\" solo puede importarse de forma predeterminada con la marca \"{1}\".", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "El módulo \"{0}\" no se puede importar usando esta construcción. El especificador solo se resuelve en un módulo ES, que no se puede importar de forma sincrónica. En su lugar, use la importación dinámica.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "El módulo \"{0}\" no se puede importar con esta construcción. El especificador solo se resuelve en un módulo ES, que no se puede importar con \"require\". En su lugar, use una importación de ECMAScript.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "El módulo \"{0}\" declara \"{1}\" localmente, pero se exporta como \"{2}\".", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "El módulo \"{0}\" declara \"{1}\" localmente, pero no se exporta.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "El módulo \"{0}\" no hace referencia a un tipo, pero aquí se usa como tipo. ¿Quiso decir \"typeof import('{0}')\"?", @@ -1103,6 +1108,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "El proyecto \"{0}\" está obsoleto porque el archivo de salida \"{1}\" no existe", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "El proyecto \"{0}\" está obsoleto porque su salida se generó con la versión \"{1}\", que es distinta a la versión actual \"{2}\".", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "El proyecto \"{0}\" está obsoleto porque la salida de su dependencia \"{1}\" ha cambiado.", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "El proyecto \"{0}\" no está actualizado porque se produjo un error al leer el archivo \"{1}\"", "Project_0_is_up_to_date_6361": "El proyecto \"{0}\" está actualizado", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "El proyecto \"{0}\" está actualizado porque la entrada más reciente \"{1}\" es anterior a la salida \"{2}\"", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "El proyecto \"{0}\" está actualizado, pero debe actualizar las marcas de tiempo de los archivos de salida anteriores a los archivos de entrada", @@ -1110,6 +1116,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Las referencias del proyecto no pueden formar un gráfico circular. Ciclo detectado: {0}", "Projects_6255": "Proyectos", "Projects_in_this_build_Colon_0_6355": "Proyectos de esta compilación: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "Las propiedades con el modificador 'accessor' solo están disponibles cuando el destino es ECMAScript 2015 y versiones posteriores.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "La propiedad '{0}' no puede tener un mediador porque se marca como abstracto.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "La propiedad \"{0}\" procede de una signatura de índice, por lo que debe accederse a ella con [\"{0}\"].", "Property_0_does_not_exist_on_type_1_2339": "La propiedad '{0}' no existe en el tipo '{1}'.", @@ -1216,6 +1223,7 @@ "Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "La resolución del módulo \"{0}\" se encontró en la memoria caché de la ubicación \"{1}\".", "Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241": "La resolución de la directiva de referencia de tipo \"{0}\" se encontró en la memoria caché de la ubicación \"{1}\".", "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195": "Resolver \"keyof\" exclusivamente como nombres de propiedad con valores de cadena (sin números ni símbolos).", + "Resolving_in_0_mode_with_conditions_1_6402": "Resolviendo en modo {0} con condiciones {1}.", "Resolving_module_0_from_1_6086": "======== Resolviendo el módulo '{0}' de '{1}'. ========", "Resolving_module_name_0_relative_to_base_url_1_2_6094": "Resolviendo el nombre de módulo '{0}' relativo a la dirección URL base '{1}' - '{2}'.", "Resolving_real_path_for_0_result_1_6130": "Resolviendo la ruta de acceso real de \"{0}\", resultado: \"{1}\".", @@ -1272,6 +1280,7 @@ "Root_file_specified_for_compilation_1427": "Archivo raíz especificado para la compilación", "STRATEGY_6039": "ESTRATEGIA", "Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642": "Guarde archivos .tsbuildinfo para permitir la compilación incremental de proyectos.", + "Saw_non_matching_condition_0_6405": "Se vio una condición no coincidente '{0}'.", "Scoped_package_detected_looking_in_0_6182": "Se detectó un paquete con ámbito al buscar en \"{0}\"", "Selection_is_not_a_valid_statement_or_statements_95155": "La selección no es una instrucción ni instrucciones válidas", "Selection_is_not_a_valid_type_node_95133": "La selección no es un nodo de tipo válido", @@ -1385,6 +1394,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "La función de flecha contenedora captura el valor global de \"this\".", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "El cuerpo de la función o del módulo contenedor es demasiado grande para realizar un análisis de flujo de control.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "El archivo actual es un módulo CommonJS y no puede usar \"await\" en el nivel superior.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "El archivo actual es un módulo CommonJS cuyas importaciones generarán llamadas \"require\"; sin embargo, el archivo al que se hace referencia es un módulo ECMAScript y no se puede importar con \"require\". Considere la posibilidad de escribir una llamada dinámica \"import(\"{0}\")\" en su lugar.", "The_current_host_does_not_support_the_0_option_5001": "El host actual no admite la opción '{0}'.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "La declaración de \"{0}\" que probablemente pretendía usar se define aquí", "The_declaration_was_marked_as_deprecated_here_2798": "La declaración se ha marcado aquí como en desuso.", @@ -1422,7 +1432,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "La parte izquierda de una operación aritmética debe ser de tipo \"any\", \"number\", \"bigint\" o un tipo de enumeración.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "La parte izquierda de una expresión de asignación no puede ser un acceso de propiedad opcional.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "La parte izquierda de una expresión de asignación debe ser una variable o el acceso a una propiedad.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "La parte izquierda de una expresión \"in\" debe ser un identificador privado o de tipo \"any\", \"string\", \"number\" o \"symbol\".", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "La parte izquierda de una expresión \"instanceof\" debe ser de tipo \"any\", un tipo de objeto o un parámetro de tipo.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "Configuración regional utilizada para mostrar los mensajes al usuario (por ejemplo, \"es-es\")", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "La profundidad máxima de dependencia para buscar en node_modules y cargar los archivos de JavaScript.", @@ -1443,7 +1452,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "El tipo de valor devuelto de una función o un método asincrónicos debe ser el tipo Promise global. ¿Pretendía escribir \"Promise<{0}>\"?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "La parte derecha de una instrucción \"for...in\" debe ser de tipo \"any\", un tipo de objeto o un parámetro de tipo, pero aquí tiene el tipo \"{0}\".", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "La parte derecha de una operación aritmética debe ser de tipo \"any\", \"number\", \"bigint\" o un tipo de enumeración.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "La parte derecha de una expresión \"in\" no debe ser un elemento primitivo.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "La parte derecha de una expresión \"instanceof\" debe ser de tipo \"any\" o un tipo que pueda asignarse al tipo de interfaz \"Function\".", "The_root_value_of_a_0_file_must_be_an_object_5092": "El valor raíz de un archivo \"{0}\" debe ser un objeto.", "The_shadowing_declaration_of_0_is_defined_here_18017": "La declaración que ensombrece a \"{0}\" se define aquí.", @@ -1464,13 +1472,15 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "El tipo devuelto por el método \"{0}()\" de un iterador debe tener una propiedad \"value\".", "The_types_of_0_are_incompatible_between_these_types_2200": "Los tipos de \"{0}\" son incompatibles entre estos tipos.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "Los tipos que \"{0}\" devuelve son incompatibles entre estos tipos.", + "The_value_0_cannot_be_used_here_18050": "El valor \"{0}\" no se puede usar aquí.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "La declaración de variable de una instrucción \"for...in\" no puede tener un inicializador.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "La declaración de variable de una instrucción \"for...of\" no puede tener un inicializador.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "No se admite la instrucción 'with'. Todos los símbolos de un bloque 'with' tendrán el tipo 'any'.", "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "La propiedad \"{0}\" de esta etiqueta de JSX espera un solo elemento secundario de tipo \"{1}\", pero se han proporcionado varios elementos secundarios.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "La propiedad \"{0}\" de esta etiqueta de JSX espera el tipo \"{1}\", que requiere varios elementos secundarios, pero solo se ha proporcionado un elemento secundario.", + "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "Esta comparación parece no intencionada porque los tipos \"{0}\" y \"{1}\" no tienen superposición.", + "This_condition_will_always_return_0_2845": "Esta condición siempre devolverá \"{0}\".", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "Esta condición siempre devolverá \"{0}\", ya que JavaScript compara objetos por referencia, no por valor.", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "Esta condición siempre devolverá \"{0}\", porque los tipos \"{1}\" y \"{2}\" no se superponen.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Esta condición devolverá siempre true porque siempre se define '{0}'.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "Esta condición siempre devolverá true, porque esta función se define siempre. ¿Pretendía llamarla en su lugar?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Esta función de constructor puede convertirse en una declaración de clase.", @@ -1491,7 +1501,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Este miembro debe tener un modificador \"override\" porque reemplaza a un miembro en la clase base \"{0}\".", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Este miembro debe tener un modificador \"override\" porque reemplaza a un método abstracto que se declara en la clase base \"{0}\".", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "Solo se puede hacer referencia a este módulo con las importaciones o exportaciones de ECMAScript mediante la activación de la marca \"{0}\" y la referencia a su exportación predeterminada.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Este módulo se declara con \"export =\" y solo se puede usar con una importación predeterminada cuando se usa la marca \"{0}\".", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Este módulo se declara con \"export =\" y solo se puede usar con una importación predeterminada cuando se usa la marca \"{0}\".", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Esta signatura de sobrecarga no es compatible con su signatura de implementación.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Este parámetro no se permite con la directiva \"use strict\".", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "Esta propiedad de parámetro debe tener un comentario JSDoc con una etiqueta '@override' porque invalida un miembro de la clase base '{0}'.", @@ -1504,6 +1514,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Esta sintaxis requiere un asistente importado denominado \"{1}\" con parámetros de {2}, que no es compatible con el de \"{0}\". Pruebe a actualizar la versión de \"{0}\".", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Este parámetro de tipo podría necesitar una restricción \"extends {0}\".", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "Este uso de \"import\" no es válido. Se pueden escribir llamadas \"import()\", pero deben tener paréntesis y no pueden tener argumentos de tipo.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Para convertir este archivo en un módulo ECMAScript, agregue el campo `\"type\": \"module\"` a \"{0}\"'.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Para convertir este archivo en un módulo ECMAScript, cambie su extensión de archivo a \"{0}\" o agregue el campo `\"type\": \"module\"` a \"{1}\".", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Para convertir este archivo en un módulo ECMAScript, cambie su extensión de archivo a \"{0}\" o cree un archivo package.json local con '{ \"type\": \"module\" }'.", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Para convertir este archivo en un módulo ECMAScript, cree un archivo package.json local con `{ \"type\": \"module\" }`.", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "Las expresiones \"await\" de nivel superior solo se permiten cuando la opción \"módulo\" está establecida en \"es2022\", \"esnext\", \"system\", \"node16\" o \"nodenext\", y la opción \"destino\" está establecida en \"es2017\" o superior.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": "Las declaraciones de nivel superior de los archivos .d.ts deben comenzar con un modificador \"declare\" o \"export\".", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "Los bucles \"for await\" de nivel superior solo se permiten cuando la opción \"módulo\" está establecida en \"es2022\", \"esnext\", \"system\", \"node16\" o \"nodenext\", y la opción \"destino\" está establecida en \"es2017\" o superior.", @@ -1519,6 +1533,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "El tipo '{0}' no se puede usar como tipo de índice.", "Type_0_cannot_be_used_to_index_type_1_2536": "El tipo '{0}' no se puede usar para indexar el tipo '{1}'.", "Type_0_does_not_satisfy_the_constraint_1_2344": "El tipo '{0}' no cumple la restricción '{1}'.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "El tipo \"{0}\" no satisface el tipo esperado \"{1}\".", "Type_0_has_no_call_signatures_2757": "El tipo \"{0}\" no tiene signaturas de llamada.", "Type_0_has_no_construct_signatures_2761": "El tipo \"{0}\" no tiene signaturas de construcción.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "El tipo '{0}' no tiene una signatura de índice correspondiente al tipo '{1}'.", @@ -1540,6 +1555,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "El tipo '{0}' no se puede asignar al tipo '{1}' con 'exactOptionalPropertyTypes: true'. Considere la posibilidad de agregar \"undefined\" al tipo del destino.", "Type_0_is_not_comparable_to_type_1_2678": "El tipo '{0}' no se puede comparar con el tipo '{1}'.", "Type_0_is_not_generic_2315": "El tipo '{0}' no es genérico.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "El tipo \"{0}\" puede representar un valor primitivo, que no se permite como operando derecho del operador \"in\".", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "El tipo \"{0}\" debe tener un método \"[Symbol.asyncIterator]()\" que devuelve un iterador de asincronía.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "El tipo \"{0}\" debe tener un método \"[Symbol.iterator]()\" que devuelve un iterador.", "Type_0_provides_no_match_for_the_signature_1_2658": "El tipo \"{0}\" no proporciona ninguna coincidencia para la signatura \"{1}\".", @@ -1596,6 +1612,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== No se resolvió la directiva de referencia de tipo '{0}'. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== La directiva de referencia de tipo '{0}' se resolvió correctamente como '{1}', principal: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== La directiva de referencia de tipo \"{0}\" se resolvió correctamente como \"{1}\" con el identificador de paquete \"{2}\", principal: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "Las expresiones de satisfacción de tipo solo se pueden usar en archivos TypeScript.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "Los tipos no pueden aparecer en declaraciones de exportación en archivos JavaScript.", "Types_have_separate_declarations_of_a_private_property_0_2442": "Los tipos tienen declaraciones independientes de una propiedad '{0}' privada.", "Types_of_construct_signatures_are_incompatible_2419": "Los tipos de signaturas de construcción son incompatibles.", @@ -1637,9 +1654,12 @@ "Updating_output_of_project_0_6373": "Actualizando la salida del proyecto \"{0}\"...", "Updating_output_timestamps_of_project_0_6359": "Actualizando las marcas de hora de salida del proyecto \"{0}\"...", "Updating_unchanged_output_timestamps_of_project_0_6371": "Actualizando las marcas de hora de salida no modificadas del proyecto \"{0}\"...", + "Use_0_95174": "Usar `{0}`.", + "Use_Number_isNaN_in_all_conditions_95175": "Use \"Number.isNaN\" en todas las condiciones.", "Use_element_access_for_0_95145": "Usar acceso de elemento para \"{0}\"", "Use_element_access_for_all_undeclared_properties_95146": "Use el acceso de elemento para todas las propiedades no declaradas.", "Use_synthetic_default_member_95016": "Use el miembro sintético \"default\".", + "Using_0_subpath_1_with_target_2_6404": "Usando '{0}' subruta '{1}' con destino '{2}'.", "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "El uso de una cadena en una instrucción \"for...of\" solo se admite en ECMAScript 5 y versiones posteriores.", "Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915": "Con --build, -b hará que tsc se comporte más como un orquestador de compilación que como un compilador. Se usa para desencadenar la compilación de proyectos compuestos, sobre los que puede obtener más información en {0}", "Using_compiler_options_of_project_reference_redirect_0_6215": "Uso de las opciones del compilador de redireccionamiento de la referencia del proyecto \"{0}\".", @@ -1717,6 +1737,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "\"{0}\" no es una propiedad Meta válida para la palabra clave \"{1}\". ¿Pretendía usar \"{2}\"?", "_0_is_not_allowed_as_a_parameter_name_1390": "No se permite “{0}” como nombre de parámetro.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "No se permite \"{0}\" como nombre de declaración de variable.", + "_0_is_of_type_unknown_18046": "\"{0}\" es de tipo \"unknown\".", + "_0_is_possibly_null_18047": "\"{0}\" es posiblemente \"null\".", + "_0_is_possibly_null_or_undefined_18049": "\"{0}\" es posiblemente \"null\" o \"undefined\".", + "_0_is_possibly_undefined_18048": "\"{0}\" es posiblemente \"undefined\".", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "Se hace referencia a '{0}' directa o indirectamente en su propia expresión base.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "Se hace referencia a '{0}' directa o indirectamente en su propia anotación de tipo.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "\"{0}\" se ha especificado más de una vez, por lo que se sobrescribirá este uso.", @@ -1752,6 +1776,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "'{0}' carece de una anotación de tipo de valor devuelto, pero tiene un tipo de valor devuelto '{1}' implícitamente.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "\"{0}\" carece de una anotación de tipo de valor devuelto, pero tiene un tipo yield \"{1}\" de forma implícita.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "El modificador 'abstract' solo puede aparecer en una declaración de propiedad, clase o método.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "El modificador 'accessor' solo puede aparecer en una declaración de propiedad.", "and_here_6204": "y aquí.", "arguments_cannot_be_referenced_in_property_initializers_2815": "no se puede hacer referencia a «arguments» en los inicializadores de propiedad.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "\"auto\": trate los archivos con importaciones, exportaciones, import.meta, jsx (con jsx: react-jsx) o formato esm (con el módulo: node16+) como módulos.", diff --git a/node_modules/typescript/lib/fr/diagnosticMessages.generated.json b/node_modules/typescript/lib/fr/diagnosticMessages.generated.json index 632cac154..b962857b7 100644 --- a/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +++ b/node_modules/typescript/lib/fr/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "Un accesseur abstrait ne peut pas avoir d'implémentation.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "Un modificateur d'accessibilité ne peut pas être utilisé avec un identificateur privé.", "An_accessor_cannot_have_type_parameters_1094": "Un accesseur ne peut pas avoir de paramètres de type.", + "An_accessor_property_cannot_be_declared_optional_1276": "Une propriété 'accessor' ne peut pas être déclarée comme facultative.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Une déclaration de module ambiant est uniquement autorisée au niveau supérieur dans un fichier.", "An_argument_for_0_was_not_provided_6210": "Aucun argument pour '{0}' n'a été fourni.", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "Aucun argument correspondant à ce modèle de liaison n'a été fourni.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "La classe '{0}' implémente de manière incorrecte la classe '{1}'. Voulez-vous vraiment étendre '{1}' et hériter de ses membres en tant que sous-classe ?", "Class_0_incorrectly_implements_interface_1_2420": "La classe '{0}' implémente de manière incorrecte l'interface '{1}'.", "Class_0_used_before_its_declaration_2449": "Classe '{0}' utilisée avant sa déclaration.", - "Class_constructor_may_not_be_a_generator_1360": "Le constructeur de classe ne peut pas être un générateur.", + "Class_constructor_may_not_be_a_generator_1368": "Le constructeur de classe ne peut pas être un générateur.", "Class_constructor_may_not_be_an_accessor_1341": "Le constructeur de la classe ne peut pas être un accesseur.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "La déclaration de classe ne peut pas implémenter la liste de surcharge pour «{0}».", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "Les déclarations de classes ne peuvent pas avoir plusieurs balises '@augments' ou '@extends'.", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "La conversion du type '{0}' en type '{1}' est peut-être une erreur, car aucun type ne chevauche suffisamment l'autre. Si cela est intentionnel, convertissez d'abord l'expression en 'unknown'.", "Convert_0_to_1_in_0_95003": "Convertir '{0}' en '{1} dans {0}'", "Convert_0_to_mapped_object_type_95055": "Convertir '{0}' en type d'objet mappé", + "Convert_all_const_to_let_95102": "Convertir tous les 'const' en 'let'", "Convert_all_constructor_functions_to_classes_95045": "Convertir toutes les fonctions de constructeur en classes", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Convertir toutes les importations non utilisées en tant que valeur en importations de types uniquement", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Convertir tous les caractères non valides en code d'entité HTML", @@ -658,6 +660,8 @@ "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219": "La prise en charge expérimentale des éléments décoratifs est une fonctionnalité susceptible de changer dans une prochaine version. Définissez l'option 'experimentalDecorators' dans votre fichier 'tsconfig' ou 'jsconfig' pour supprimer cet avertissement.", "Explicitly_specified_module_resolution_kind_Colon_0_6087": "Spécification explicite du genre de résolution de module : '{0}'.", "Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791": "Impossible d'effectuer l'élévation à une puissance sur des valeurs 'bigint' sauf si l'option 'target' a la valeur 'es2016' ou une valeur qui correspond à une version ultérieure.", + "Export_0_from_module_1_90059": "Exporter '{0}' à partir du module '{1}'", + "Export_all_referenced_locals_90060": "Exporter tous les variables locales référencées", "Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203": "Vous ne pouvez pas utiliser l'assignation d'exportation pour cibler des modules ECMAScript. Utilisez 'export default' ou un autre format de module à la place.", "Export_assignment_is_not_supported_when_module_flag_is_system_1218": "L'assignation d'exportation n'est pas prise en charge quand l'indicateur '--module' est 'system'.", "Export_declaration_conflicts_with_exported_declaration_of_0_2484": "La déclaration d'exportation est en conflit avec la déclaration exportée de '{0}'.", @@ -906,6 +910,7 @@ "Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650": "Faites en sorte que keyof retourne uniquement des chaînes au lieu de chaînes, de nombres ou de symboles. Option héritée.", "Make_super_call_the_first_statement_in_the_constructor_90002": "Faire de l'appel à 'super()' la première instruction du constructeur", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "Le type d'objet mappé a implicitement un type de modèle 'any'.", + "Matched_0_condition_1_6403": "Condition '{0}' correspondant à '{1}'.", "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457": "Mise en correspondance par défaut du modèle include '**/*'", "Matched_by_include_pattern_0_in_1_1407": "Correspond au modèle include '{0}' dans '{1}'", "Member_0_implicitly_has_an_1_type_7008": "Le membre '{0}' possède implicitement un type '{1}'.", @@ -919,7 +924,7 @@ "Method_not_implemented_95158": "Méthode non implémentée.", "Modifiers_cannot_appear_here_1184": "Les modificateurs ne peuvent pas apparaître ici.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "Le module '{0}' peut uniquement être importé par défaut à l'aide de l'indicateur '{1}'", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Vous ne pouvez pas importer le module « {0} » à l’aide de cette construction. Le spécificateur se résout uniquement en module ES, que vous ne pouvez pas importer de manière synchrone. Utilisez l’importation dynamique à la place.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Le module '{0}' ne peut pas être importé à l'aide de cette construction. Le spécificateur se résout uniquement en un module ES, qui ne peut pas être importé avec 'require'. Utilisez plutôt une importation ECMAScript.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "Le module '{0}' déclare '{1}' localement, mais il est exporté en tant que '{2}'.", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "Le module '{0}' déclare '{1}' localement, mais il n'est pas exporté.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "Le module '{0}' ne fait pas référence à un type, mais il est utilisé ici en tant que type. Est-ce que vous avez voulu utiliser 'typeof import('{0}')' ?", @@ -1103,6 +1108,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Le projet '{0}' est obsolète car le fichier de sortie '{1}' n'existe pas", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "Le projet '{0}' est obsolète, car sa sortie a été générée avec la version '{1}', qui diffère de la version actuelle '{2}'", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "Le projet '{0}' est obsolète, car la sortie de sa dépendance '{1}' a changé", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "Le projet « {0} » est obsolète car une erreur s'est produite lors de la lecture du fichier « {1} »", "Project_0_is_up_to_date_6361": "Le projet '{0}' est à jour", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "Le projet « {0} » est à jour car l'entrée la plus récente (« {1} ») est antérieure à la sortie (« {2} »)", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "Project « {0} » est à jour, mais doit mettre à jour les horodatages des fichiers de sortie plus anciens que les fichiers d’entrée", @@ -1110,6 +1116,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Les références de projet ne peuvent pas former un graphe circulaire. Cycle détecté : {0}", "Projects_6255": "Projets", "Projects_in_this_build_Colon_0_6355": "Projets dans cette build : {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "Les propriétés avec le modificateur 'accessor' ne sont disponibles que pour le ciblage d’ECMAScript 2015 et versions ultérieures.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "La propriété « {0} » ne peut pas avoir d’initialiseur, car elle est marquée comme abstraite.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "La propriété '{0}' est issue d'une signature d'index, elle doit donc faire l'objet d'un accès avec ['{0}'].", "Property_0_does_not_exist_on_type_1_2339": "La propriété '{0}' n'existe pas sur le type '{1}'.", @@ -1216,6 +1223,7 @@ "Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "La résolution du module '{0}' a été trouvée dans le cache à l'emplacement '{1}'.", "Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241": "La résolution de la directive de référence de type '{0}' a été trouvée dans le cache à l'emplacement '{1}'.", "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195": "Résoudre 'keyof' en noms de propriétés de valeur chaîne uniquement (aucun nombre ou symbole).", + "Resolving_in_0_mode_with_conditions_1_6402": "Résolution en mode {0} avec des conditions {1}.", "Resolving_module_0_from_1_6086": "======== Résolution du module '{0}' à partir de '{1}'. ========", "Resolving_module_name_0_relative_to_base_url_1_2_6094": "Résolution du nom de module '{0}' par rapport à l'URL de base '{1}' - '{2}'.", "Resolving_real_path_for_0_result_1_6130": "Résolution du chemin réel pour '{0}', résultat '{1}'.", @@ -1272,6 +1280,7 @@ "Root_file_specified_for_compilation_1427": "Fichier racine spécifié pour la compilation", "STRATEGY_6039": "STRATÉGIE", "Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642": "Enregistrez les fichiers .tsbuildinfo pour permettre la compilation incrémentielle des projets.", + "Saw_non_matching_condition_0_6405": "Condition non correspondante '{0}' visible.", "Scoped_package_detected_looking_in_0_6182": "Package de portée détecté. Recherche dans '{0}'", "Selection_is_not_a_valid_statement_or_statements_95155": "La sélection ne correspond pas à une ou des instructions valides", "Selection_is_not_a_valid_type_node_95133": "La sélection n'est pas un nœud de type valide", @@ -1385,6 +1394,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "La fonction arrow conteneur capture la valeur globale de 'this'.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "Le corps de la fonction ou du module conteneur est trop grand pour l'analyse du flux de contrôle.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "Le fichier actuel est un module CommonJS et ne peut pas utiliser 'await' au niveau supérieur.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "Le fichier actuel est un module CommonJS dont les importations produiront des appels 'require' ; cependant, le fichier référencé est un module ECMAScript et ne peut pas être importé avec 'require'. Envisagez d'écrire un appel dynamique 'import(\"{0}\")' à la place.", "The_current_host_does_not_support_the_0_option_5001": "L'hôte actuel ne prend pas en charge l'option '{0}'.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "La déclaration de '{0}' que vous aviez probablement l'intention d'utiliser est définie ici", "The_declaration_was_marked_as_deprecated_here_2798": "La déclaration a été marquée ici comme étant dépréciée.", @@ -1422,7 +1432,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "La partie gauche d'une opération arithmétique doit être de type 'any', 'number', 'bigint' ou un type enum.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "La partie gauche d'une expression d'assignation ne doit pas être un accès à une propriété facultative.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "La partie gauche d'une expression d'assignation doit être un accès à une variable ou une propriété.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "La partie gauche d'une expression 'in' doit être un identificateur privé ou de type 'any', 'string', 'number' ou 'symbol'.", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "La partie gauche d'une expression 'instanceof' doit être de type 'any', un type d'objet ou un paramètre de type.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "Paramètres régionaux utilisés pour afficher les messages à l'utilisateur (exemple : 'fr-fr')", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "Profondeur de dépendance maximale pour la recherche sous node_modules et le chargement de fichiers JavaScript.", @@ -1443,7 +1452,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "Le type de retour d'une fonction ou d'une méthode asynchrone doit être le type global Promise. Vouliez-vous vraiment écrire 'Promise<{0}>' ?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "La partie droite d'une instruction 'for...in' doit être de type 'any', un type d'objet ou un paramètre de type, mais elle a le type '{0}' ici.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "La partie droite d'une opération arithmétique doit être de type 'any', 'number', 'bigint' ou un type enum.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "La partie droite d'une expression 'in' ne doit pas être une primitive.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "La partie droite d'une expression 'instanceof' doit être de type 'any' ou d'un type pouvant être assigné au type d'interface 'Function'.", "The_root_value_of_a_0_file_must_be_an_object_5092": "La valeur racine d'un fichier '{0}' doit être un objet.", "The_shadowing_declaration_of_0_is_defined_here_18017": "La déclaration avec mise en mémoire fantôme de '{0}' est définie ici", @@ -1464,13 +1472,15 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "Le type retourné par la méthode '{0}()' d'un itérateur doit avoir une propriété 'value'.", "The_types_of_0_are_incompatible_between_these_types_2200": "Les types de '{0}' sont incompatibles entre eux.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "Les types retournés par '{0}' sont incompatibles entre eux.", + "The_value_0_cannot_be_used_here_18050": "La valeur '{0}' ne peut pas être utilisée ici.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "La déclaration de variable d'une instruction 'for...in' ne peut pas avoir d'initialiseur.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "La déclaration de variable d'une instruction 'for...of' ne peut pas avoir d'initialiseur.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "L'instruction 'with' n'est pas prise en charge. Tous les symboles d'un bloc 'with' ont le type 'any'.", "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "La propriété '{0}' de cette balise JSX attend un seul enfant de type '{1}', mais plusieurs enfants ont été fournis.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "La propriété '{0}' de cette balise JSX attend le type '{1}', qui nécessite plusieurs enfants, mais un seul enfant a été fourni.", + "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "Cette comparaison semble involontaire, car les types '{0}' et '{1}' n’ont pas de chevauchement.", + "This_condition_will_always_return_0_2845": "Cette condition retourne toujours '{0}'.", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "Cette condition retourne toujours '{0}', car JavaScript compare les objets par référence, et non par valeur.", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "Cette condition retourne toujours '{0}', car les types '{1}' et '{2}' n'ont pas de chevauchement.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Cette condition retourne toujours true, car cette « {0} » est toujours définie.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "Cette condition retourne toujours true, car cette fonction est toujours définie. Est-ce que vous avez voulu l'appeler à la place ?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Cette fonction constructeur peut être convertie en déclaration de classe.", @@ -1491,7 +1501,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Ce membre doit avoir un modificateur 'override', car il se substitue à un membre de la classe de base '{0}'.", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Ce membre doit avoir un modificateur 'override', car il se substitue à une méthode abstraite déclarée dans la classe de base '{0}'.", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "Vous pouvez référencer ce module uniquement avec les importations/exportations ECMAScript en activant l'indicateur '{0}' et en référençant son exportation par défaut.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Ce module est déclaré à l'aide de 'export =' et peut être utilisé uniquement avec une importation par défaut quand l'indicateur '{0}' est employé.", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Ce module est déclaré avec 'export =', et ne peut être utilisé qu’avec une importation par défaut lors de l’utilisation de l’indicateur '{0}'.", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Cette signature de surcharge n'est pas compatible avec sa signature d'implémentation.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Ce paramètre n'est pas autorisé avec la directive 'use strict'.", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "Cette propriété de paramètre doit avoir un commentaire JSDoc avec une balise '@override' car elle remplace un membre dans la classe de base '{0}'.", @@ -1504,6 +1514,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Cette syntaxe nécessite un composant d'assistance importé nommé '{1}' avec {2} paramètres, ce qui n'est pas compatible avec celui qui se trouve dans '{0}'. Effectuez une mise à niveau de votre version de '{0}'.", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Ce paramètre de type nécessite peut-être une contrainte « extends {0}».", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "Cette utilisation de « import » n’est pas valide. Les appels « import() » peuvent être écrits, mais ils doivent avoir des parenthèses et ne peuvent pas avoir d’arguments de type.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Pour convertir ce fichier en module ECMAScript, ajoutez le champ `\"type\" : \"module\"` à '{0}'.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Pour convertir ce fichier en module ECMAScript, changez son extension de fichier en '{0}', ou ajoutez le champ `\"type\" : \"module\"` à '{1}'.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Pour convertir ce fichier en module ECMAScript, changez son extension de fichier en '{0}' ou créez un fichier package.json local avec `{ \"type\": \"module\" }`.", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Pour convertir ce fichier en module ECMAScript, créez un fichier package.json local avec `{ \"type\": \"module\" }`.", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "Les expressions 'await' de niveau supérieur sont autorisées uniquement lorsque l’option 'module' a la valeur 'es2022', 'esnext', 'system', 'node16' ou 'nodenext' et que l’option 'target' a la valeur 'es2017' ou une valeur supérieure.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": "Les déclarations de niveau supérieur dans les fichiers .d.ts doivent commencer par un modificateur 'declare' ou 'export'.", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "Les boucles « for await » de niveau supérieur sont autorisées uniquement lorsque l’option « module » a la valeur « es2022 », « esnext », « system », « node16 » ou « nodenext », et que l’option « target » a la valeur « es2017 » ou une version ultérieure.", @@ -1519,6 +1533,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "Impossible d'utiliser le type '{0}' comme type d'index.", "Type_0_cannot_be_used_to_index_type_1_2536": "Le type '{0}' ne peut pas être utilisé pour indexer le type '{1}'.", "Type_0_does_not_satisfy_the_constraint_1_2344": "Le type '{0}' ne satisfait pas la contrainte '{1}'.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "Le type '{0}' ne satisfait pas le type attendu '{1}'.", "Type_0_has_no_call_signatures_2757": "Le type '{0}' n'a aucune signature d'appel.", "Type_0_has_no_construct_signatures_2761": "Le type '{0}' n'a aucune signature de construction.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "Le type '{0}' n'a aucune signature d'index correspondant au type '{1}'.", @@ -1540,6 +1555,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "Le type '{0}' n'est pas assignable au type '{1}' avec 'exactOptionalPropertyTypes : true'. Pensez à ajouter 'undefined' au type de la cible.", "Type_0_is_not_comparable_to_type_1_2678": "Le type '{0}' n'est pas comparable au type '{1}'.", "Type_0_is_not_generic_2315": "Le type '{0}' n'est pas générique.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "Le type '{0}' peut représenter une valeur primitive, ce qui n’est pas autorisé en tant qu’opérande droit de l’opérateur 'in'.", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Le type '{0}' doit avoir une méthode '[Symbol.asyncIterator]()' qui retourne un itérateur asynchrone.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Le type '{0}' doit avoir une méthode '[Symbol.iterator]()' qui retourne un itérateur.", "Type_0_provides_no_match_for_the_signature_1_2658": "Le type '{0}' ne fournit aucune correspondance pour la signature '{1}'.", @@ -1596,6 +1612,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== La directive de référence de type '{0}' n'a pas été résolue. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== La directive de référence de type '{0}' a été correctement résolue en '{1}', primaire : {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== La directive de référence de type '{0}' a été correctement résolue en '{1}' avec l'ID de package '{2}', primaire : {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "Les expressions de satisfaction de type peuvent uniquement être utilisées dans les fichiers TypeScript.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "Les types ne peuvent pas apparaître dans les déclarations d’exportation dans les fichiers JavaScript.", "Types_have_separate_declarations_of_a_private_property_0_2442": "Les types ont des déclarations distinctes d'une propriété privée '{0}'.", "Types_of_construct_signatures_are_incompatible_2419": "Les types de signature de construction sont incompatibles.", @@ -1637,9 +1654,12 @@ "Updating_output_of_project_0_6373": "Mise à jour de la sortie du projet '{0}'...", "Updating_output_timestamps_of_project_0_6359": "Mise à jour des horodatages de sortie du projet '{0}'...", "Updating_unchanged_output_timestamps_of_project_0_6371": "Mise à jour des horodatages de sortie inchangés du projet '{0}'...", + "Use_0_95174": "Utilisez `{0}`.", + "Use_Number_isNaN_in_all_conditions_95175": "Utilisez 'Number.isNaN' dans toutes les conditions.", "Use_element_access_for_0_95145": "Utiliser l'accès à l'élément pour '{0}'", "Use_element_access_for_all_undeclared_properties_95146": "L'accès à l'élément est utilisé pour toutes les propriétés non déclarées.", "Use_synthetic_default_member_95016": "Utilisez un membre 'default' synthétique.", + "Using_0_subpath_1_with_target_2_6404": "Utilisation de '{0}' de sous-chemin '{1}' avec la cible '{2}'.", "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "L'utilisation d'une chaîne dans une instruction 'for...of' est prise en charge uniquement dans ECMAScript 5 et version supérieure.", "Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915": "L’utilisation de--build,-b fera en sorte que tsc se comporte plus comme une build orchestrateur qu’un compilateur. Utilisé pour déclencher la génération de projets composites sur lesquels vous pouvez obtenir des informations supplémentaires sur {0}", "Using_compiler_options_of_project_reference_redirect_0_6215": "Utilisation des options de compilateur de la redirection de référence de projet : '{0}'.", @@ -1717,6 +1737,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "'{0}' n'est pas une métapropriété valide pour le mot clé '{1}'. Est-ce qu'il ne s'agit pas plutôt de '{2}' ?", "_0_is_not_allowed_as_a_parameter_name_1390": "'{0}' n'est pas autorisé comme nom de paramètre.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "'{0}' n'est pas autorisé en tant que nom de déclaration de variable.", + "_0_is_of_type_unknown_18046": "'{0}' est de type 'unknown'.", + "_0_is_possibly_null_18047": "'{0}' est peut-être 'null'.", + "_0_is_possibly_null_or_undefined_18049": "'{0}' est peut-être 'null' ou 'undefined'.", + "_0_is_possibly_undefined_18048": "'{0}' est peut-être 'non défini'.", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "'{0}' est référencé directement ou indirectement dans sa propre expression de base.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "'{0}' est référencé directement ou indirectement dans sa propre annotation de type.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "'{0}' est spécifié plusieurs fois. Cette utilisation va donc être remplacée.", @@ -1752,6 +1776,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "'{0}', qui ne dispose pas d'annotation de type de retour, possède implicitement un type de retour '{1}'.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "'{0}', qui n'a pas d'annotation de type de retour, a implicitement le type de retour '{1}'.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "Le modificateur 'abstract' peut apparaître uniquement dans une déclaration de classe, de méthode ou de propriété.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "Le modificateur 'accessor' ne peut apparaître que sur une déclaration de propriété.", "and_here_6204": "et ici.", "arguments_cannot_be_referenced_in_property_initializers_2815": "Les « arguments » ne peuvent pas être référencés dans les initialiseurs de propriété.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "« auto » : traitez les fichiers avec des importations, des exportations, import.meta, jsx (avec jsx: react-jsx) ou un format esm (avec module : node16+) en tant que modules.", diff --git a/node_modules/typescript/lib/it/diagnosticMessages.generated.json b/node_modules/typescript/lib/it/diagnosticMessages.generated.json index dff392625..2acc6530a 100644 --- a/node_modules/typescript/lib/it/diagnosticMessages.generated.json +++ b/node_modules/typescript/lib/it/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "Una funzione di accesso astratta non può contenere un'implementazione.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "Non è possibile usare un modificatore di accessibilità con un identificatore privato.", "An_accessor_cannot_have_type_parameters_1094": "Una funzione di accesso non può contenere parametri di tipo.", + "An_accessor_property_cannot_be_declared_optional_1276": "Una proprietà 'accessor' non può essere dichiarata facoltativa.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Una dichiarazione di modulo di ambiente è consentita solo al primo livello in un file.", "An_argument_for_0_was_not_provided_6210": "Non è stato specificato alcun argomento per '{0}'.", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "Non è stato specificato alcun argomento corrispondente a questo modello di associazione.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "La classe '{0}' implementa in modo errato la classe '{1}'. Si intendeva estendere '{1}' ed ereditarne i membri come sottoclasse?", "Class_0_incorrectly_implements_interface_1_2420": "La classe '{0}' implementa in modo errato l'interfaccia '{1}'.", "Class_0_used_before_its_declaration_2449": "La classe '{0}' è stata usata prima di essere stata dichiarata.", - "Class_constructor_may_not_be_a_generator_1360": "Il costruttore di classe non può essere un generatore.", + "Class_constructor_may_not_be_a_generator_1368": "Il costruttore di classe non può essere un generatore.", "Class_constructor_may_not_be_an_accessor_1341": "Il costruttore di classe non può essere una funzione di accesso.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "La dichiarazione classe non può implementare l'elenco di overload per '{0}'.", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "Le dichiarazioni di classe non possono contenere più di un tag '@augments' o '@extends'.", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "La conversione del tipo '{0}' nel tipo '{1}' può essere un errore perché nessuno dei due tipi si sovrappone sufficientemente all'altro. Se questa opzione è intenzionale, convertire prima l'espressione in 'unknown'.", "Convert_0_to_1_in_0_95003": "Convertire '{0}' in '{1} in {0}'", "Convert_0_to_mapped_object_type_95055": "Convertire '{0}' nel tipo di oggetto con mapping", + "Convert_all_const_to_let_95102": "Convertire ogni 'const' in 'let'", "Convert_all_constructor_functions_to_classes_95045": "Convertire tutte le funzioni di costruttore in classi", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Convertire tutte le importazioni non usate come valore in importazioni solo di tipi", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Convertire tutti i caratteri non validi nel codice entità HTML", @@ -658,6 +660,8 @@ "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219": "Il supporto sperimentale per gli elementi Decorator è una funzionalità soggetta a modifica nelle prossime versioni. Per rimuovere questo avviso, impostare l'opzione 'experimentalDecorators' nel file 'tsconfig' o 'jsconfig'.", "Explicitly_specified_module_resolution_kind_Colon_0_6087": "Il tipo di risoluzione del modulo '{0}' è stato specificato in modo esplicito.", "Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791": "Non è possibile usare l'elevamento a potenza su valori 'bigint' a meno che l'opzione 'target' non sia impostata su 'es2016' o versioni successive.", + "Export_0_from_module_1_90059": "Esporta '{0}' dal modulo '{1}'", + "Export_all_referenced_locals_90060": "Esporta tutte le variabili locali di riferimento", "Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203": "Non è possibile usare l'assegnazione di esportazione se destinata a moduli ECMAScript. Provare a usare 'export default' o un altro formato di modulo.", "Export_assignment_is_not_supported_when_module_flag_is_system_1218": "L'assegnazione dell'esportazione non è supportata quando il valore del flag '--module' è 'system'.", "Export_declaration_conflicts_with_exported_declaration_of_0_2484": "La dichiarazione di esportazione è in conflitto con la dichiarazione esportata di '{0}'.", @@ -906,6 +910,7 @@ "Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650": "Imposta keyof in modo che restituisca solo stringhe invece di stringhe, numeri o simboli. Opzione legacy.", "Make_super_call_the_first_statement_in_the_constructor_90002": "Impostare la chiamata a 'super()' come prima istruzione nel costruttore", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "Il tipo di oggetto con mapping contiene implicitamente un tipo di modello 'any'.", + "Matched_0_condition_1_6403": "Corrispondenza tra '{0}' condizione '{1}'.", "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457": "Corrispondente per impostazione predefinita al criterio di inclusione '**/*'", "Matched_by_include_pattern_0_in_1_1407": "Corrispondenza tramite criterio di inclusione '{0}' in '{1}'", "Member_0_implicitly_has_an_1_type_7008": "Il membro '{0}' contiene implicitamente un tipo '{1}'.", @@ -919,7 +924,7 @@ "Method_not_implemented_95158": "Metodo non implementato.", "Modifiers_cannot_appear_here_1184": "In questo punto non è possibile usare modificatori.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "Il modulo '{0}' può essere importato come predefinito solo con il flag '{1}'", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Non è possibile importare il modulo ' {0}' utilizzando questo costrutto. L'identificatore può essere solo risolto in un modulo ES, che non può essere importato in modo sincrono. Utilizzare l'importazione dinamica.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Non è possibile importare il modulo '{0}' utilizzando questo costrutto. L'identificatore può essere solo risolto in un modulo ES, che non può essere importato con 'require'. Usare invece un'importazione ECMAScript.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "Il modulo '{0}' dichiara '{1}' in locale, ma viene esportato come '{2}'.", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "Il modulo '{0}' dichiara '{1}' in locale, ma non viene esportato.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "Il modulo '{0}' non fa riferimento a un tipo, ma viene usato come tipo in questo punto. Si intendeva 'typeof import('{0}')'?", @@ -1103,6 +1108,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Il progetto '{0}' non è aggiornato perché il file di output '{1}' non esiste", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "Il progetto '{0}' non è aggiornato perché l'output per il progetto è stato generato con la versione '{1}' che non corrisponde alla versione corrente '{2}'", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "Il progetto '{0}' non è aggiornato perché l'output della relativa dipendenza '{1}' è cambiato", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "Il progetto '{0}' non è aggiornato perché si è verificato un errore durante la lettura del file '{1}'", "Project_0_is_up_to_date_6361": "Il progetto '{0}' è aggiornato", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "Il progetto '{0}' è aggiornato perché l'input più recente '{1}' è meno recente dell'output '{2}'", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "Project '{0}' è aggiornato ma deve aggiornare i timestamp dei file di output precedenti ai file di input", @@ -1110,6 +1116,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "I riferimenti al progetto non possono formare un grafico circolare. Ciclo rilevato: {0}", "Projects_6255": "Progetti", "Projects_in_this_build_Colon_0_6355": "Progetti in questa compilazione: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "Le proprietà con il modificatore 'funzione di accesso' sono disponibili solo quando la destinazione è ECMAScript 2015 e versioni successive.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "La proprietà '{0}' non può includere un inizializzatore perché è contrassegnata come astratta.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "La proprietà '{0}' deriva da una firma dell'indice, quindi è necessario accedervi con ['{0}'].", "Property_0_does_not_exist_on_type_1_2339": "La proprietà '{0}' non esiste nel tipo '{1}'.", @@ -1216,6 +1223,7 @@ "Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "La risoluzione per il modulo '{0}' è stata trovata nella cache dal percorso '{1}'.", "Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241": "La risoluzione per la direttiva '{0}' del riferimento al tipo è stata trovata nella cache dal percorso '{1}'.", "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195": "Risolvere 'keyof' solo in nomi di proprietà con valori stringa (senza numeri o simboli).", + "Resolving_in_0_mode_with_conditions_1_6402": "Risoluzione in modalità {0} con condizioni {1}.", "Resolving_module_0_from_1_6086": "======== Risoluzione del modulo '{0}' da '{1}'. ========", "Resolving_module_name_0_relative_to_base_url_1_2_6094": "Verrà eseguita la risoluzione del nome del modulo '{0}' relativo all'URL di base '{1}' - '{2}'.", "Resolving_real_path_for_0_result_1_6130": "Risoluzione del percorso reale per '{0}'. Risultato: '{1}'.", @@ -1272,6 +1280,7 @@ "Root_file_specified_for_compilation_1427": "File radice specificato per la compilazione", "STRATEGY_6039": "STRATEGIA", "Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642": "Salva i file .tsbuildinfo per consentire la compilazione incrementale dei progetti.", + "Saw_non_matching_condition_0_6405": "Visualizzata la condizione di corrispondenza '{0}'.", "Scoped_package_detected_looking_in_0_6182": "Il pacchetto con ambito è stato rilevato. Verrà eseguita una ricerca in '{0}'", "Selection_is_not_a_valid_statement_or_statements_95155": "La selezione non corrisponde a una o più istruzioni valide", "Selection_is_not_a_valid_type_node_95133": "La selezione non corrisponde a un nodo di tipo valido", @@ -1385,6 +1394,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "La funzione arrow contenitore acquisisce il valore globale di 'this'.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "Il corpo del modulo o la funzione che contiene è troppo grande per l'analisi del flusso di controllo.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "Il file corrente è un modulo CommonJS e non può usare 'await' al livello principale.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "Il file corrente è un modulo CommonJS le cui importazioni genereranno chiamate 'require'. Tuttavia, il file a cui si fa riferimento è un modulo ECMAScript e non può essere importato con 'require'. Provare a scrivere una chiamata 'import(\"{0}\")' dinamica.", "The_current_host_does_not_support_the_0_option_5001": "L'host corrente non supporta l'opzione '{0}'.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "La dichiarazione di '{0}' che probabilmente si intende usare viene definita in questo punto", "The_declaration_was_marked_as_deprecated_here_2798": "La dichiarazione è stata contrassegnata come deprecata in questo punto.", @@ -1422,7 +1432,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "La parte sinistra di un'operazione aritmetica deve essere di tipo 'any', 'number', 'bigint' o un tipo enumerazione.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "La parte sinistra di un'espressione di assegnazione non può essere un accesso a proprietà facoltativo.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "La parte sinistra di un'espressione di assegnazione deve essere una variabile o un accesso a proprietà.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "La parte sinistra di un'espressione 'in' deve essere un identificatore privato o di tipo 'any', 'string', 'number' o 'symbol'.", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "La parte sinistra di un'espressione 'instanceof' deve essere di tipo 'any' oppure essere un tipo di oggetto o un parametro di tipo.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "Impostazioni locali usate per la visualizzazione di messaggi all'utente, ad esempio 'it-it'", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "Profondità massima delle dipendenze per la ricerca in node_modules e il caricamento dei file JavaScript.", @@ -1443,7 +1452,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "Il tipo restituito di un metodo o una funzione asincrona deve essere il tipo globale Promise. Si intendeva scrivere 'Promise<{0}>'?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "La parte destra di un'istruzione 'for...in' deve essere di tipo 'any' oppure essere un tipo di oggetto o un parametro di tipo, ma in questo caso il tipo è '{0}'.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "La parte destra di un'operazione aritmetica deve essere di tipo 'any', 'number', 'bigint' o un tipo enumerazione.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "La parte destra di un'espressione 'in' non deve essere una primitiva.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "La parte destra di un'espressione 'instanceof' deve essere di tipo 'any' o di un tipo assegnabile al tipo di interfaccia 'Function'.", "The_root_value_of_a_0_file_must_be_an_object_5092": "Il valore radice di un file '{0}' deve essere un oggetto.", "The_shadowing_declaration_of_0_is_defined_here_18017": "La dichiarazione di oscuramento di '{0}' viene definita in questo punto", @@ -1464,13 +1472,15 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "Il tipo restituito dal metodo '{0}()' di un iteratore deve contenere una proprietà 'value'.", "The_types_of_0_are_incompatible_between_these_types_2200": "I tipi di '{0}' sono incompatibili tra questi tipi.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "I tipi restituiti da '{0}' sono incompatibili tra questi tipi.", + "The_value_0_cannot_be_used_here_18050": "Non è possibile usare qui il valore '{0}'.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "La dichiarazione di variabile di un'istruzione 'for...in' non può contenere un inizializzatore.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "La dichiarazione di variabile di un'istruzione 'for...of' non può contenere un inizializzatore.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "L'istruzione 'with' non è supportata. Il tipo di tutti i simboli in un blocco 'with' è 'any'.", "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "Con la proprietà '{0}' del tag JSX è previsto un singolo elemento figlio di tipo '{1}', ma sono stati specificati più elementi figlio.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "Con la proprietà '{0}' del tag JSX è previsto il tipo '{1}' che richiede più elementi figlio, ma è stato specificato un singolo elemento figlio.", + "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "Questo confronto sembra non intenzionale perché i tipi '{0}' e '{1}' non presentano alcuna sovrapposizione.", + "This_condition_will_always_return_0_2845": "Questa condizione restituirà sempre '{0}'.", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "Questa condizione restituirà sempre '{0}' perché JavaScript confronta gli oggetti per riferimento, non per valore.", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "Questa condizione restituirà sempre '{0}' perché i tipi '{1}' e '{2}' non presentano alcuna sovrapposizione.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Questa condizione restituirà sempre true perché questo elemento '{0}' è sempre definito.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "Questa condizione restituirà sempre true perché questa funzione è sempre definita. Si intendeva chiamarla?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Questa funzione del costruttore può essere convertita in una dichiarazione di classe.", @@ -1491,7 +1501,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Questo membro deve includere un modificatore 'override' perché sovrascrive un membro nella classe di base '{0}'.", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Questo membro deve includere un modificatore 'override' perché esegue l'override di un metodo astratto dichiarato nella classe di base '{0}'.", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "È possibile fare riferimento a questo modulo solo con importazioni/esportazioni ECMAScript attivando il flag '{0}' e facendo riferimento alla relativa esportazione predefinita.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Il modulo viene dichiarato con 'export =' e può essere usato solo con un'importazione predefinita quando si usa il flag '{0}'.", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Il modulo viene dichiarato con 'export =' e può essere usato solo con un'importazione predefinita quando si usa il flag '{0}'.", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Questa firma di overload non è compatibile con la relativa firma di implementazione.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Questo parametro non è consentito con la direttiva 'use strict'.", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "Questa proprietà di parametro deve avere un commento JSDoc con un tag '@override' perché sostituisce un membro nella classe di base '{0}'.", @@ -1504,6 +1514,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Con questa sintassi è richiesto un helper importato denominato '{1}' con {2} parametri, che non è compatibile con quello presente in '{0}'. Provare ad aggiornare la versione di '{0}'.", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Questo parametro di tipo potrebbe richiedere un vincolo `extends {0}`.", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "Questo uso di 'import' non è valido. le chiamate 'import()' possono essere scritte, ma devono avere parentesi e non possono avere argomenti di tipo.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Per convertire questo file in un modulo ECMAScript, aggiungere il campo '\"type\": \"module\"' a '{0}'.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Per convertire il file in un modulo ECMAScript, modificarne l'estensione in '{0}' oppure aggiungere il campo '\"type\": \"module\"' a '{1}'.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Per convertire questo file in un modulo ECMAScript, modificarne l'estensione in '{0}' o creare un file package.json locale con '{ \"type\": \"module\" }'.", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Per convertire questo file in un modulo ECMAScript, creare un file package.json locale con '{ \"type\": \"module\" }'.", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "Le espressioni 'await' di primo livello sono consentite solo quando l'opzione 'module' è impostata su 'es2022', 'esnext', 'system', 'node16', or 'nodenext', e l'opzione 'target' è impostata su 'es2017' o versione successiva.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": "Le dichiarazioni di primo livello nei file con estensione d.ts devono iniziare con un modificatore 'declare' o 'export'.", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "I cicli 'for await' di primo livello sono consentiti solo quando l'opzione 'module' è impostata su'es2022', 'esnext', 'system', 'node16', o 'nodenext' e l'opzione 'target' è impostata su 'es2017' o versione successiva.", @@ -1519,6 +1533,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "Non è possibile usare il tipo '{0}' come tipo di indice.", "Type_0_cannot_be_used_to_index_type_1_2536": "Non è possibile usare il tipo '{0}' per indicizzare il tipo '{1}'.", "Type_0_does_not_satisfy_the_constraint_1_2344": "Il tipo '{0}' non soddisfa il vincolo '{1}'.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "Il tipo '{0}' non soddisfa il tipo previsto '{1}'.", "Type_0_has_no_call_signatures_2757": "Il tipo '{0}' non contiene firme di chiamata.", "Type_0_has_no_construct_signatures_2761": "Il tipo '{0}' non contiene firme del costrutto.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "Nel tipo '{0}' non esiste alcuna firma dell'indice corrispondente per il tipo '{1}'.", @@ -1540,6 +1555,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "L'argomento di tipo '{0}' non può essere assegnato al tipo '{1}' con 'exactOptionalPropertyTypes: true'. Provare ad aggiungere 'undefined' al tipo di destinazione.", "Type_0_is_not_comparable_to_type_1_2678": "Il tipo '{0}' non è confrontabile con il tipo '{1}'.", "Type_0_is_not_generic_2315": "Il tipo '{0}' non è generico.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "Il tipo '{0}' può rappresentare un valore primitivo, che non è consentito come operando destro dell'operatore 'in'.", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Il tipo '{0}' deve contenere un metodo '[Symbol.asyncIterator]()' che restituisce un iteratore asincrono.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Il tipo '{0}' deve contenere un metodo '[Symbol.iterator]()' che restituisce un iteratore.", "Type_0_provides_no_match_for_the_signature_1_2658": "Il tipo '{0}' non fornisce corrispondenze per la firma '{1}'.", @@ -1596,6 +1612,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== La direttiva '{0}' del riferimento al tipo non è stata risolta. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== La direttiva '{0}' del riferimento al tipo è stata risolta in '{1}'. Primaria: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== La direttiva '{0}' del riferimento al tipo è stata risolta in '{1}' con ID pacchetto ID '{2}'. Primaria: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "Le espressioni di soddisfazione del tipo possono essere usate solo nei file TypeScript.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "I tipi non possono essere visualizzati nelle dichiarazioni di esportazione nei file JavaScript.", "Types_have_separate_declarations_of_a_private_property_0_2442": "I tipi contengono dichiarazioni separate di una proprietà privata '{0}'.", "Types_of_construct_signatures_are_incompatible_2419": "I tipi delle firme del costrutto sono incompatibili.", @@ -1637,9 +1654,12 @@ "Updating_output_of_project_0_6373": "Aggiornamento dell'output del progetto '{0}'...", "Updating_output_timestamps_of_project_0_6359": "Aggiornamento dei timestamp di output del progetto '{0}'...", "Updating_unchanged_output_timestamps_of_project_0_6371": "Aggiornamento dei timestamp di output non modificati del progetto '{0}'...", + "Use_0_95174": "Usa `{0}`.", + "Use_Number_isNaN_in_all_conditions_95175": "Usare 'Number.isNaN' in tutte le condizioni.", "Use_element_access_for_0_95145": "Usare l'accesso agli elementi per '{0}'", "Use_element_access_for_all_undeclared_properties_95146": "Usare l'accesso agli elementi per tutte le proprietà non dichiarate.", "Use_synthetic_default_member_95016": "Usare il membro 'default' sintetico.", + "Using_0_subpath_1_with_target_2_6404": "Utilizzo di '{0}' sottotracciato '{1}' con destinazione '{2}'.", "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "L'uso di una stringa in un'istruzione 'for...of' è supportato solo in ECMAScript 5 e versioni successive.", "Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915": "Se si usa --build, l'opzione -b modificherà il comportamento di tsc in modo che sia più simile a un agente di orchestrazione di compilazione che a un compilatore. Viene usata per attivare la compilazione di progetti compositi. Per altre informazioni, vedere {0}", "Using_compiler_options_of_project_reference_redirect_0_6215": "Using compiler options of project reference redirect '{0}'.", @@ -1717,6 +1737,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "'{0}' non è una metaproprietà valida per la parola chiave '{1}'. Si intendeva '{2}'?", "_0_is_not_allowed_as_a_parameter_name_1390": "'{0}' non è un nome di parametro consentito.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "'{0}' non è consentito come nome di una dichiarazione di variabile.", + "_0_is_of_type_unknown_18046": "'{0}' è di tipo 'unknown'.", + "_0_is_possibly_null_18047": "'{0}' è probabilmente 'null'.", + "_0_is_possibly_null_or_undefined_18049": "'{0}' è probabilmente 'null' o 'undefined'.", + "_0_is_possibly_undefined_18048": "'{0}' è probabilmente 'undefined'.", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "'{0}' viene usato come riferimento diretto o indiretto nella relativa espressione di base.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "'{0}' viene usato come riferimento diretto o indiretto nella relativa annotazione di tipo.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "'{0}' è specificato più di una volta, quindi il relativo utilizzo verrà sovrascritto.", @@ -1752,6 +1776,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "'{0}', in cui manca l'annotazione di tipo restituito, contiene implicitamente un tipo restituito '{1}'.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "'{0}', in cui manca l'annotazione di tipo restituito, contiene implicitamente un tipo yield '{1}'.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "Il modificatore 'abstract' può essere incluso solo in una dichiarazione di classe, metodo o proprietà.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "Il modificatore 'accessor' può essere visualizzato solo in una dichiarazione di proprietà.", "and_here_6204": "e in questo punto.", "arguments_cannot_be_referenced_in_property_initializers_2815": "impossibile fare riferimento agli 'argomenti' negli inizializzatori di proprietà.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "\"auto\": considera i file con importazioni, esportazioni, import.meta, jsx (con jsx: react-jsx) o il formato esm (con modulo: node16+) come moduli.", diff --git a/node_modules/typescript/lib/ja/diagnosticMessages.generated.json b/node_modules/typescript/lib/ja/diagnosticMessages.generated.json index 9841773a6..5bc780d7a 100644 --- a/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +++ b/node_modules/typescript/lib/ja/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "抽象アクセサーに実装を含めることはできません。", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "アクセシビリティ修飾子を private 識別子と共に使用することはできません。", "An_accessor_cannot_have_type_parameters_1094": "アクセサーに型パラメーターを指定することはできません。", + "An_accessor_property_cannot_be_declared_optional_1276": "'accessor' プロパティはオプションとして宣言できません。", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "アンビエント モジュール宣言は、ファイルの最上位にのみ使用できます。", "An_argument_for_0_was_not_provided_6210": "'{0}' の引数が指定されていません。", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "このバインド パターンに一致する引数が指定されていません。", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "クラス '{0}' はクラス '{1}' を正しく実装していません。'{1}' を拡張し、そのメンバーをサブクラスとして継承しますか?", "Class_0_incorrectly_implements_interface_1_2420": "クラス '{0}' はインターフェイス '{1}' を正しく実装していません。", "Class_0_used_before_its_declaration_2449": "クラス '{0}' は宣言の前に使用されました。", - "Class_constructor_may_not_be_a_generator_1360": "クラス コンストラクターをジェネレーターにすることはできません。", + "Class_constructor_may_not_be_a_generator_1368": "クラス コンストラクターをジェネレーターにすることはできません。", "Class_constructor_may_not_be_an_accessor_1341": "クラス コンストラクターをアクセサーにすることはできません。", "Class_declaration_cannot_implement_overload_list_for_0_2813": "クラスの宣言では '{0}' のオーバーロード リストを実装できません。", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "クラスの宣言で複数の '@augments' または '@extends' タグを含めることはできません。", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "型 '{0}' から型 '{1}' への変換は、互いに十分に重複できないため間違っている可能性があります。意図的にそうする場合は、まず式を 'unknown' に変換してください。", "Convert_0_to_1_in_0_95003": "'{0}' を '{0} の {1}' に変換します", "Convert_0_to_mapped_object_type_95055": "'{0}' をマップされたオブジェクト型に変換する", + "Convert_all_const_to_let_95102": "すべての 'const' を 'let' に変換する", "Convert_all_constructor_functions_to_classes_95045": "すべてのコンストラクター関数をクラスに変換します", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "値として使用されていないすべてのインポートを型のみのインポートに変換する", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "すべての無効な文字を HTML エンティティ コードに変換する", @@ -658,6 +660,8 @@ "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219": "デコレーターの実験的なサポートは将来のリリースで変更になる可能性がある機能です。'tsconfig' または 'jsconfig' に 'experimentalDecorators' オプションを設定してこの警告を削除します。", "Explicitly_specified_module_resolution_kind_Colon_0_6087": "明示的に指定されたモジュール解決の種類 '{0}'。", "Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791": "'target' オプションが 'es2016' 以降に設定されている場合を除き、'bigint' 値に対して累乗を実行することはできません。", + "Export_0_from_module_1_90059": "'{0}' をモジュール '{1}' からエクスポートする", + "Export_all_referenced_locals_90060": "参照されているすべてのローカルをエクスポートする", "Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203": "ECMAScript モジュールを対象にする場合は、エクスポート代入を使用できません。代わりに 'export default' または別のモジュール書式の使用をご検討ください。", "Export_assignment_is_not_supported_when_module_flag_is_system_1218": "代入のエクスポートは、'--module' フラグが 'system' の場合にはサポートされません。", "Export_declaration_conflicts_with_exported_declaration_of_0_2484": "エクスポート宣言が、'{0}' のエクスポートされた宣言と競合しています。", @@ -906,6 +910,7 @@ "Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650": "keyof により、文字列、数字、記号の代わりに、文字列のみが返されるようにします。レガシ オプションです。", "Make_super_call_the_first_statement_in_the_constructor_90002": "'super()' 呼び出しをコンストラクター内の最初のステートメントにする", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "マップされたオブジェクト型のテンプレートの型は暗黙的に 'any' になります。", + "Matched_0_condition_1_6403": "'{0}' 条件 '{1}' と一致しました。", "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457": "既定で一致するインクルード パターン '**/*'", "Matched_by_include_pattern_0_in_1_1407": "'{1}' のインクルード パターン '{0}' に一致しています", "Member_0_implicitly_has_an_1_type_7008": "メンバー '{0}' の型は暗黙的に '{1}' になります。", @@ -919,7 +924,7 @@ "Method_not_implemented_95158": "メソッドが実装されていません。", "Modifiers_cannot_appear_here_1184": "ここで修飾子を使用することはできません。", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "モジュール '{0}' は、'{1}' フラグを使用して既定でのみインポートできます", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "モジュール '{0}' はこのコンストラクトではインポートできません。指定子は ES モジュールに対してのみ解決されるため、同期的にインポートすることはできません。代わりに動的インポートを使用します。", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "モジュール '{0}' はこのコンストラクトではインポートできません。指定子は ES モジュールに解決されるだけであるため、'require' でインポートすることはできません。代わりに ECMAScript インポートを使用してください。", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "モジュール '{0}' は '{1}' をローカルで宣言していますが、これは '{2}' としてエクスポートされています。", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "モジュール '{0}' は '{1}' をローカルで宣言していますが、これはエクスポートされていません。", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "モジュール '{0}' は型を参照していませんが、ここでは型として使用されています。'typeof import('{0}')' を意図していましたか?", @@ -1103,6 +1108,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "プロジェクト '{0}' は出力ファイル '{1}' が存在しないため最新の状態ではありません", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "プロジェクト '{0}' の出力が現在のバージョン '{2}' と異なるバージョン '{1}' で生成されているため、このプロジェクトは最新の状態ではありません", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "依存関係 '{1}' の出力が変更されているため、プロジェクト '{0}' は最新の状態ではありません", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "ファイル '{1}' の読み取り中にエラーが発生したため、プロジェクト '{0}' は最新ではありません", "Project_0_is_up_to_date_6361": "プロジェクト '{0}' は最新の状態です", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "プロジェクト '{0}' は最新の入力 '{1}' が出力 '{2}' より古いため最新の状態です", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "プロジェクト '{0}' は最新ですが、入力ファイルよりも古い出力ファイルのタイムスタンプを更新する必要があります", @@ -1110,6 +1116,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "プロジェクト参照が円グラフを形成できません。循環が検出されました: {0}", "Projects_6255": "プロジェクト", "Projects_in_this_build_Colon_0_6355": "このビルドのプロジェクト: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "'accessor' 修飾子を持つプロパティは、ECMAScript 2015 以降を対象とする場合にのみ使用できます。", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "メソッド '{0}' は abstract に指定されているため、初期化子を含めることができません。", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "プロパティ '{0}' はインデックス シグネチャに基づいているため、['{0}'] を使用してアクセスする必要があります。", "Property_0_does_not_exist_on_type_1_2339": "プロパティ '{0}' は型 '{1}' に存在しません。", @@ -1216,6 +1223,7 @@ "Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "モジュール '{0}' の解決が場所 '{1}' のキャッシュに見つかりました。", "Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241": "種類参照指令 '{0}' の解決策は、場所 '{1}' のキャッシュには見つかりませんでした。", "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195": "'keyof' を文字列値のプロパティ名のみに解決します (数字または記号なし)。", + "Resolving_in_0_mode_with_conditions_1_6402": "条件 {1} を使用して {0} モードで解決しています。", "Resolving_module_0_from_1_6086": "======== '{1}' からモジュール '{0}' を解決しています。========", "Resolving_module_name_0_relative_to_base_url_1_2_6094": "ベース URL '{1}' - '{2}' に相対するモジュール名 '{0}' を解決しています。", "Resolving_real_path_for_0_result_1_6130": "'{0}' の実際のパスを解決しています。結果は '{1}' です。", @@ -1272,6 +1280,7 @@ "Root_file_specified_for_compilation_1427": "コンパイル用に指定されたルート ファイル", "STRATEGY_6039": "戦略", "Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642": "プロジェクトのインクリメンタル コンパイルを可能にするには、.tsbuildinfo ファイルを保存します。", + "Saw_non_matching_condition_0_6405": "一致しない条件 '{0}' がありました。", "Scoped_package_detected_looking_in_0_6182": "'{0}' 内を検索して、スコープ パッケージが検出されました", "Selection_is_not_a_valid_statement_or_statements_95155": "選択内容は有効なステートメントではありません", "Selection_is_not_a_valid_type_node_95133": "選択は有効な型ノードではありません", @@ -1385,6 +1394,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "含まれているアロー関数は、'this' のグローバル値をキャプチャします。", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "含まれている関数またはモジュールの本体は、制御フロー解析には大きすぎます。", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "現在のファイルは CommonJS モジュールであり、最上位レベルでは 'await' を使用できません。", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "現在のファイルは CommonJS モジュールであり、このインポートでは 'require' 呼び出しが生成されますが、参照ファイルは ECMAScript モジュールであるため、'require' ではインポートできません。代わりに動的な 'import(\"{0}\")' 呼び出しを記述することを検討してください。", "The_current_host_does_not_support_the_0_option_5001": "現在のホストは '{0}' オプションをサポートしていません。", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "使用するつもりだったと思われる '{0}' の宣言はここで定義されています", "The_declaration_was_marked_as_deprecated_here_2798": "この宣言はここで非推奨とマークされました。", @@ -1422,7 +1432,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "算術演算の左辺には、'any' 型、'number' 型、'bigint' 型、または列挙型を指定する必要があります。", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "代入式の左辺には、省略可能なプロパティ アクセスを指定できません。", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "代入式の左側は、変数またはプロパティ アクセスである必要があります。", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "'in' 式の左側は、プライベート識別子であるか、'any'、'string'、'number'、または 'symbol' 型である必要があります。", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "'instanceof' 式の左辺には、'any' 型、オブジェクト型、または型パラメーターを指定してください。", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "ユーザーにメッセージを表示するときに使用するロケール (例: 'en-us')", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "node_modules の下を検索して JavaScript ファイルを読み込む依存関係の最大深度です。", @@ -1443,7 +1452,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "非同期関数または非同期メソッドの戻り値の型は、グローバル Promise 型である必要があります。'Promise<{0}>' と書き込むつもりでしたか?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "'for...in' ステートメントの右側には、'any' 型、オブジェクト型、型パラメーターを指定する必要がありますが、ここでは型 '{0}' が指定されています。", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "算術演算の右辺には、'any' 型、'number' 型、'bigint' 型、または列挙型を指定する必要があります。", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "'in' 式の右辺をプリミティブにすることはできません。", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "instanceof' 式の右辺には、'any' 型、または 'Function' インターフェイス型に割り当てることができる型を指定してください。", "The_root_value_of_a_0_file_must_be_an_object_5092": "'{0}' ファイルのルート値はオブジェクトである必要があります。", "The_shadowing_declaration_of_0_is_defined_here_18017": "'{0}' のシャドウ宣言はここで定義されています", @@ -1464,13 +1472,15 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "反復子の '{0}()' メソッドによって返される型には 'value' プロパティが必要です。", "The_types_of_0_are_incompatible_between_these_types_2200": "'{0}' の型は、これらの型同士で互換性がありません。", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "'{0}' によって返された型は、これらの型同士で互換性がありません。", + "The_value_0_cannot_be_used_here_18050": "値 '{0}' はここでは使用できません。", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "'for...in' ステートメントの変数宣言に初期化子を指定することはできません。", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "'for...of' ステートメントの変数宣言に初期化子を指定することはできません。", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "'with' ステートメントはサポートされていません。'with' ブロック内のすべてのシンボルの型は 'any' になります。", "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "この JSX タグの '{0}' prop は型 '{1}' の単一の子を予期しますが、複数の子が指定されました。", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "この JSX タグの '{0}' prop は複数の子を必要とする型 '{1}' を予期しますが、単一の子が指定されました。", + "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "'{0}' 型と '{1}' 型が重複していないため、この比較は意図したとおりに表示されない可能性があります。", + "This_condition_will_always_return_0_2845": "この条件は常に '{0}' を返します。", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "JavaScript が値ではなく参照でオブジェクトを比較するため、この条件は常に '{0}' を返します。", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "型 '{1}' と '{2}' には重複がないため、この条件は常に '{0}' を返します。", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "'{0}' が常に定義されているため、この条件は常に true を返します。", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "この関数は常に定義されているため、この条件は常に true を返します。代わりにこれを呼び出すことを意図していましたか?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "このコンストラクター関数はクラス宣言に変換される可能性があります。", @@ -1491,7 +1501,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "このメンバーは、基底クラス '{0}' のメンバーをオーバーライドするため、'override' 修飾子を指定する必要があります。", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "このメンバーは、基底クラス '{0}' で宣言された抽象メソッドをオーバーライドするため、'override' 修飾子を指定する必要があります。", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "このモジュールは、'{0}' フラグをオンにして既定のエクスポートを参照することにより、ECMAScript のインポートまたはエクスポートのみを使用して参照できます。", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "このモジュールは 'export =' を使用して宣言されていて、'{0}' フラグを使用する場合は既定のインポートでのみ使用できます。", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "このモジュールは、'export =' を使用して宣言されており、'{0}' フラグを使用する場合は既定のインポートでのみ使用できます。", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "このオーバーロード シグネチャには、実装シグネチャとの互換性はありません。", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "このパラメーターは、'use strict' ディレクティブと共に使用することはできません。", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "このパラメーター プロパティには、基底クラス '{0}' のメンバーをオーバーライドするため、'@override' タグを含む JSDoc コメントが必要です。", @@ -1504,6 +1514,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "この構文には、{2} パラメーターを持つ '{1}' という名前のインポートされたヘルパーが必要ですが、'{0}' にあるものと互換性がありません。'{0}' のバージョンをアップグレードすることをご検討ください。", "This_type_parameter_might_need_an_extends_0_constraint_2208": "この型パラメーターには 'extends {0}' 制約が必要な場合があります。", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "この 'import' の使用は無効です。'import()' 呼び出しは書き込むことができますが、かっこが必要であり、型引数を指定することはできません。", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "このファイルを ECMAScript モジュールに変換するには、フィールド '\"type\": \"module\"' を '{0}' に追加します。", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "このファイルを ECMAScript モジュールに変換するには、ファイル拡張子を '{0}' に変更するか、フィールド '\"type\": \"module\"' を '{1}' に追加します。", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "このファイルを ECMAScript モジュールに変換するには、ファイル拡張子を '{0}' に変更するか、'{ \"type\": \"module\" }' を含むローカルの package.json ファイルを作成します。", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "このファイルを ECMAScript モジュールに変換するには、'{ \"type\": \"module\" }' を含むローカルの package.json ファイルを作成します。", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "トップレベルの 'await' 式は、'module' オプションが 'es2022'、'esnext'、'system'、'node16' または 'nodenext' に設定されていて、'target' オプションが 'es2017' 以上に設定されている場合にのみ使用できます。", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": ".d.ts ファイルのトップレベルの宣言は、'declare' または 'export' 修飾子で始める必要があります。", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "トップレベルの 'for await' ループは、'module' オプションが 'es2022'、'esnext'、'system'、'node16'、または 'nodenext' に設定されていて、'target' オプションが 'es2017' 以上に設定されている場合にのみ使用できます。", @@ -1519,6 +1533,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "型 '{0}' はインデックスの型として使用できません。", "Type_0_cannot_be_used_to_index_type_1_2536": "型 '{0}' はインデックスの種類 '{1}' に使用できません。", "Type_0_does_not_satisfy_the_constraint_1_2344": "型 '{0}' は制約 '{1}' を満たしていません。", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "型 '{0}' は想定された型 '{1}' を満たしていません。", "Type_0_has_no_call_signatures_2757": "型 '{0}' には呼び出しシグネチャがありません。", "Type_0_has_no_construct_signatures_2761": "型 '{0}' にはコンストラクト シグネチャがありません。", "Type_0_has_no_matching_index_signature_for_type_1_2537": "型 '{0}' には型 '{1}' と一致するインデックス シグネチャがありません。", @@ -1540,6 +1555,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "型 '{0}' を、'exactOptionalPropertyTypes: true' が指定されている型 '{1}' に割り当てることはできません。ターゲットの型に 'undefined' を追加することを検討してください。", "Type_0_is_not_comparable_to_type_1_2678": "型 '{0}' は型 '{1}' と比較できません。", "Type_0_is_not_generic_2315": "型 '{0}' はジェネリックではありません。", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "型 '{0}' は、'in' 演算子の右オペランドとして許可されていないプリミティブ値を表す場合があります。", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "型 '{0}' には、非同期反復子を返す '[Symbol.asyncIterator]()' メソッドが必要です。", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "型 '{0}' には、反復子を返す '[Symbol.iterator]()' メソッドが必要です。", "Type_0_provides_no_match_for_the_signature_1_2658": "型 '{0}' にはシグネチャ '{1}' に一致するものがありません。", @@ -1596,6 +1612,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== 型参照ディレクティブ '{0}' が解決されませんでした。========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== 型参照ディレクティブ '{0}' が正常に '{1}' に解決されました。プライマリ: {2}。========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== 型参照ディレクティブ '{0}' が正常に '{1}' に解決されました (パッケージ ID '{2}'、プライマリ: {3})。========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "型充足式は TypeScript ファイルでのみ使用できます。", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "JavaScript ファイルのエクスポート宣言に型を含めることはできません。", "Types_have_separate_declarations_of_a_private_property_0_2442": "複数の型に、プライベート プロパティ '{0}' の異なる宣言が含まれています。", "Types_of_construct_signatures_are_incompatible_2419": "コンストラクト シグネチャの型に互換性がありません。", @@ -1637,9 +1654,12 @@ "Updating_output_of_project_0_6373": "プロジェクト '{0}' の出力を更新しています...", "Updating_output_timestamps_of_project_0_6359": "プロジェクト '{0}' の出力タイムスタンプを更新しています...", "Updating_unchanged_output_timestamps_of_project_0_6371": "プロジェクト '{0}' の変更されていない出力タイムスタンプを更新しています...", + "Use_0_95174": "\"{0}\" を使用します。", + "Use_Number_isNaN_in_all_conditions_95175": "すべての条件で 'Number.isNaN' を使用します。", "Use_element_access_for_0_95145": "'{0}' に要素アクセスを使用する", "Use_element_access_for_all_undeclared_properties_95146": "宣言されていないすべてのプロパティに対して要素アクセスを使用します。", "Use_synthetic_default_member_95016": "合成 'default' メンバーを使用します。", + "Using_0_subpath_1_with_target_2_6404": "'{0}' サブパス '{1}' をターゲット '{2}' と共に使用しています。", "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "'for...of' ステートメントでの文字列の使用は ECMAScript 5 以上でのみサポートされています。", "Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915": "--build を使用すると、-b は tsc をコンパイラというよりビルド オーケストレーターのように動作させます。これは、複合プロジェクトのビルドをトリガーするために使用されます。詳細については、{0} を参照してください。", "Using_compiler_options_of_project_reference_redirect_0_6215": "Using compiler options of project reference redirect '{0}'.", @@ -1717,6 +1737,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "'{0}' はキーワード '{1}' に関するメタプロパティとして無効です。候補: '{2}'。", "_0_is_not_allowed_as_a_parameter_name_1390": "'{0}' はパラメーター名として使用できません。", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "'{0}' は変数宣言の名前として使用できません。", + "_0_is_of_type_unknown_18046": "'{0}''は 'unknown' 型です。", + "_0_is_possibly_null_18047": "'{0}' は 'null' の可能性があります。", + "_0_is_possibly_null_or_undefined_18049": "'{0}' は 'null' か 'undefined' の可能性があります。", + "_0_is_possibly_undefined_18048": "'{0}' は 'undefined' の可能性があります。", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "'{0}' はそれ自身のベース式内で直接または間接的に参照されます。", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "'{0}' はそれ自身の型の注釈内で直接または間接的に参照されます。", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "'{0}' が複数回指定されているため、ここでの使用は上書きされます。", @@ -1752,6 +1776,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "'{0}' には戻り値の型の注釈がないため、戻り値の型は暗黙的に '{1}' になります。", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "'{0}' には戻り値の型の注釈がないため、yield 型は暗黙的に '{1}' になります。", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "'abstract' 修飾子は、クラス宣言、メソッド宣言、またはプロパティ宣言のみに使用できます。", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "'accessor' 修飾子は、プロパティ宣言でのみ使用できます。", "and_here_6204": "およびここで。", "arguments_cannot_be_referenced_in_property_initializers_2815": "プロパティ初期化子で 'arguments' を参照することはできません。", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "\"auto\": インポート、エクスポート、import.meta、jsx (jsx: react-jsx を使用)、または esm 形式 (モジュール: node16+) でファイルをモジュールとして扱います。", diff --git a/node_modules/typescript/lib/ko/diagnosticMessages.generated.json b/node_modules/typescript/lib/ko/diagnosticMessages.generated.json index e60bffb9e..3fba8e28e 100644 --- a/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +++ b/node_modules/typescript/lib/ko/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "추상 접근자는 구현이 있을 수 없습니다.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "접근성 한정자는 프라이빗 식별자와 함께 사용할 수 없습니다.", "An_accessor_cannot_have_type_parameters_1094": "접근자에는 형식 매개 변수를 사용할 수 없습니다.", + "An_accessor_property_cannot_be_declared_optional_1276": "'accessor' 속성은 선택 사항으로 선언할 수 없습니다.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "앰비언트 모듈 선언은 파일의 최상위에서만 사용할 수 있습니다.", "An_argument_for_0_was_not_provided_6210": "'{0}'의 인수가 제공되지 않았습니다.", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "이 바인딩 패턴과 일치하는 인수가 제공되지 않았습니다.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "'{0}' 클래스가 '{1}' 클래스를 잘못 구현합니다. '{1}'을(를) 확장하고 이 클래스의 멤버를 하위 클래스로 상속하시겠습니까?", "Class_0_incorrectly_implements_interface_1_2420": "'{0}' 클래스가 '{1}' 인터페이스를 잘못 구현합니다.", "Class_0_used_before_its_declaration_2449": "선언 전에 사용된 '{0}' 클래스입니다.", - "Class_constructor_may_not_be_a_generator_1360": "클래스 생성자는 생성기가 아닐 수 있습니다.", + "Class_constructor_may_not_be_a_generator_1368": "클래스 생성자는 생성기가 아닐 수 있습니다.", "Class_constructor_may_not_be_an_accessor_1341": "클래스 생성자는 접근자가 아닐 수 있습니다.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "클래스 선언에서 '{0}'에 대한 오버로드 목록을 구현할 수 없습니다.", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "클래스 선언은 '@augments' 또는 '@extends' 태그를 둘 이상 가질 수 없습니다.", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "'{0}' 형식을 '{1}' 형식으로 변환한 작업은 실수일 수 있습니다. 두 형식이 서로 충분히 겹치지 않기 때문입니다. 의도적으로 변환한 경우에는 먼저 'unknown'으로 식을 변환합니다.", "Convert_0_to_1_in_0_95003": "'{0}'을(를) '{0}의 {1}'(으)로 변환", "Convert_0_to_mapped_object_type_95055": "'{0}'을(를) 매핑된 개체 형식으로 변환", + "Convert_all_const_to_let_95102": "모든 'const'를 'let'으로 변환", "Convert_all_constructor_functions_to_classes_95045": "모든 생성자 함수를 클래스로 변환", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "값으로 사용되지 않는 모든 가져오기를 형식 전용 가져오기로 변환", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "모든 잘못된 문자를 HTML 엔터티 코드로 변환", @@ -658,6 +660,8 @@ "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219": "데코레이터에 대한 실험적 지원 기능은 이후 릴리스에서 변경될 수 있습니다. 이 경고를 제거하려면 'tsconfig' 또는 'jsconfig'에서 'experimentalDecorators' 옵션을 설정합니다.", "Explicitly_specified_module_resolution_kind_Colon_0_6087": "명시적으로 지정된 모듈 확인 종류 '{0}'입니다.", "Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791": "'target' 옵션이 'es2016' 이상으로 설정되어 있지 않으면 'bigint' 값에 지수화를 수행할 수 없습니다.", + "Export_0_from_module_1_90059": "'{0}'을(를) '{1}' 모듈에서 내보냅니다.", + "Export_all_referenced_locals_90060": "참조된 모든 로컬 내보내기", "Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203": "ECMAScript 모듈을 대상으로 하는 경우 내보내기 할당을 사용할 수 없습니다. 대신 'export default'나 다른 모듈 형식의 사용을 고려하세요.", "Export_assignment_is_not_supported_when_module_flag_is_system_1218": "'--module' 플래그가 'system'이면 내보내기 할당은 지원되지 않습니다.", "Export_declaration_conflicts_with_exported_declaration_of_0_2484": "내보내기 선언이 '{0}'의 내보낸 선언과 충돌합니다.", @@ -906,6 +910,7 @@ "Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650": "keyof가 문자열, 숫자 또는 기호 대신 문자열만 반환하도록 합니다. 레거시 옵션입니다.", "Make_super_call_the_first_statement_in_the_constructor_90002": "생성자의 첫 번째 문을 'super()'로 호출", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "매핑된 개체 형식에는 'any' 템플릿 형식이 암시적으로 포함됩니다.", + "Matched_0_condition_1_6403": "'{0}' 조건 '{1}'과(와) 일치합니다.", "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457": "기본적으로 일치되는 포함 패턴 '**/*'", "Matched_by_include_pattern_0_in_1_1407": "'{1}'의 포함 패턴 '{0}'(으)로 일치되었습니다.", "Member_0_implicitly_has_an_1_type_7008": "'{0}' 멤버에는 암시적으로 '{1}' 형식이 포함됩니다.", @@ -919,7 +924,7 @@ "Method_not_implemented_95158": "메서드가 구현되지 않았습니다.", "Modifiers_cannot_appear_here_1184": "한정자를 여기에 표시할 수 없습니다.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "'{0}' 모듈은 '{1}' 플래그를 사용하는 가져온 기본값이어야만 합니다.", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "이 구성을 사용하여 모듈 '{0}'을(를) 가져올 수 없습니다. 지정자는 동기적으로 가져올 수 없는 ES 모듈로만 확인됩니다. 대신 동적 가져오기를 사용하세요.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "이 구문을 사용하여 '{0}' 모듈을 가져올 수 없습니다. 지정자는 'require'로 가져올 수 없는 ES 모듈로만 확인됩니다. ECMAScript 가져오기를 대신 사용하세요.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "'{0}' 모듈은 '{1}'을(를) 로컬로 선언하지만, 모듈을 '{2}'(으)로 내보냅니다.", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "'{0}' 모듈은 '{1}'을(를) 로컬로 선언하지만, 모듈을 내보내지 않습니다.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "모듈 '{0}'은(는) 형식을 참조하지 않지만, 여기에서 형식으로 사용됩니다. 'typeof 가져오기('{0}')'를 사용하시겠습니까?", @@ -1103,6 +1108,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "'{1}' 출력 파일이 존재하지 않기 때문에 '{0}' 프로젝트가 최신 상태가 아닙니다.", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "'{0}' 프로젝트의 출력이 현재 버전 '{2}'과(와) 다른 '{1}' 버전으로 생성되었기 때문에 이 프로젝트가 최신 상태가 아닙니다.", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "'{1}' 종속성의 출력이 변경되었기 때문에 '{0}' 프로젝트가 최신 상태가 아닙니다.", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "'{1}' 파일을 읽는 동안 오류가 발생하여 프로젝트 '{0}'이(가) 만료되었습니다.", "Project_0_is_up_to_date_6361": "'{0}' 프로젝트가 최신 상태입니다.", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "최신 입력 '{1}'이(가) 출력 '{2}'보다 오래되었기 때문에 '{0}' 프로젝트가 최신 상태입니다.", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "프로젝트 '{0}'이(가) 최신 상태이지만 입력 파일보다 오래된 출력 파일의 타임스탬프를 업데이트해야 합니다.", @@ -1110,6 +1116,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "프로젝트 참조는 순환 그래프를 형성할 수 없습니다. 순환이 발견되었습니다. {0}", "Projects_6255": "프로젝트", "Projects_in_this_build_Colon_0_6355": "이 빌드의 프로젝트: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "'accessor' 한정자가 있는 속성은 ECMAScript 2015 이상을 대상으로 하는 경우에만 사용할 수 있습니다.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "'{0}' 속성은 추상으로 표시되어 있으므로 이니셜라이저를 사용할 수 없습니다.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "'{0}' 속성은 인덱스 시그니처에서 가져오는 것이므로 ['{0}']을(를) 사용하여 액세스해야 합니다.", "Property_0_does_not_exist_on_type_1_2339": "'{1}' 형식에 '{0}' 속성이 없습니다.", @@ -1216,6 +1223,7 @@ "Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "'{0}' 모듈에 대한 해결을 '{1}' 위치의 캐시에서 찾았습니다.", "Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241": "'{1}' 위치의 캐시에서 형식 참조 지시어 '{0}'에 대한 해상도가 발견되었습니다.", "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195": "문자열 값 속성 이름에 대해서만 'keyof'를 확인합니다(숫자나 기호 아님).", + "Resolving_in_0_mode_with_conditions_1_6402": "조건이 {1}인 {0} 모드에서 확인하는 중입니다.", "Resolving_module_0_from_1_6086": "======== '{1}'에서 '{0}' 모듈을 확인하는 중입니다. ========", "Resolving_module_name_0_relative_to_base_url_1_2_6094": "기본 URL '{1}' - '{2}'을(를) 기준으로 모듈 이름 '{0}'을(를) 확인하는 중입니다.", "Resolving_real_path_for_0_result_1_6130": "'{0}'의 실제 경로를 확인하는 중입니다. 결과: '{1}'.", @@ -1272,6 +1280,7 @@ "Root_file_specified_for_compilation_1427": "컴파일을 위해 지정된 루트 파일", "STRATEGY_6039": "전략", "Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642": "프로젝트의 증분 컴파일을 허용하도록 .tsbuildinfo 파일을 저장합니다.", + "Saw_non_matching_condition_0_6405": "비일치 조건 '{0}'을(를) 확인했습니다.", "Scoped_package_detected_looking_in_0_6182": "범위가 지정된 패키지가 검색되었습니다. '{0}'에서 찾습니다.", "Selection_is_not_a_valid_statement_or_statements_95155": "선택 항목이 유효한 하나의 문 또는 여러 문이 아닙니다.", "Selection_is_not_a_valid_type_node_95133": "선택 영역이 유효한 형식 노드가 아닙니다.", @@ -1385,6 +1394,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "포함하는 화살표 함수는 'this'의 전역 값을 캡처합니다.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "제어 흐름 분석에 대해 포함된 함수 또는 모듈 본문이 너무 큽니다.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "현재 파일은 CommonJS 모듈이며 최상위 수준에서 'await'를 사용할 수 없습니다.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "현재 파일은 가져오기에서 'require' 호출을 생성하는 CommonJS 모듈입니다. 그러나 참조된 파일은 ECMAScript 모듈이며 'require'로 가져올 수 없습니다. 대신 동적 'import(\"{0}\")' 호출을 작성하는 것이 좋습니다.", "The_current_host_does_not_support_the_0_option_5001": "현재 호스트가 '{0}' 옵션을 지원하지 않습니다.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "사용하려는 '{0}'의 선언이 여기서 정의됩니다.", "The_declaration_was_marked_as_deprecated_here_2798": "선언이 여기에 사용되지 않음으로 표시되었습니다.", @@ -1422,7 +1432,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "산술 연산의 왼쪽은 'any', 'number', 'bigint' 또는 열거형 형식이어야 합니다.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "할당 식의 왼쪽은 선택적 속성 액세스일 수 없습니다.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "할당 식의 왼쪽은 변수 또는 속성 액세스여야 합니다.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "'in' 식의 왼쪽은 비공개 식별자이거나 'any', 'string', 'number' 또는 'symbol' 유형이어야 합니다.", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "'instanceof' 식 왼쪽은 'any' 형식, 개체 형식 또는 형식 매개 변수여야 합니다.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "사용자에게 메시지를 표시할 때 사용되는 로캘입니다(예: 'en-us').", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "node_modules에서 검색하고 JavaScript 파일을 로드할 최대 종속성 깊이입니다.", @@ -1443,7 +1452,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "비동기 함수 또는 메서드의 반환 형식은 전역 Promise 형식이어야 합니다. 'Promise<{0}>'을(를) 쓰려고 했습니까?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "'for...in' 문 오른쪽은 'any' 형식, 개체 형식 또는 형식 매개 변수여야 하는데, 여기에 '{0}' 형식이 있습니다.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "산술 연산 오른쪽은 'any', 'number', 'bigint' 또는 열거형 형식이어야 합니다.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "'in' 식의 오른쪽은 기본 형식이 아니어야 합니다.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "'instanceof' 식 오른쪽은 'any' 형식이거나 'Function' 인터페이스 형식에 할당할 수 있는 형식이어야 합니다.", "The_root_value_of_a_0_file_must_be_an_object_5092": "'{0}' 파일의 루트 값은 개체여야 합니다.", "The_shadowing_declaration_of_0_is_defined_here_18017": "여기서는 '{0}'의 섀도 선언이 정의됩니다.", @@ -1464,13 +1472,15 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "반복기의 '{0}()' 메서드에 의해 반환되는 형식에는 'value' 속성이 있어야 합니다.", "The_types_of_0_are_incompatible_between_these_types_2200": "'{0}'의 형식은 해당 형식 간에 호환되지 않습니다.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "'{0}'에서 반환되는 형식은 해당 형식 간에 호환되지 않습니다.", + "The_value_0_cannot_be_used_here_18050": "여기서는 '{0}' 값을 사용할 수 없습니다.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "'for...in' 문의 변수 선언에 이니셜라이저가 포함될 수 없습니다.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "'for...of' 문의 변수 선언에 이니셜라이저가 포함될 수 없습니다.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "'with' 문은 지원되지 않습니다. 'with' 블록의 모든 기호가 'any' 형식이 됩니다.", "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "이 JSX 태그의 '{0}' 속성에는 '{1}' 형식의 자식 하나가 필요하지만, 여러 자식이 제공되었습니다.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "이 JSX 태그의 '{0}' 속성에는 여러 자식이 있어야 하는 '{1}' 형식이 필요하지만, 단일 자식만 제공되었습니다.", + "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "'{0}'이(가) '{1}'과(와) 겹치지 않으므로 이 비교는 의도하지 않은 것 같습니다.", + "This_condition_will_always_return_0_2845": "이 조건은 항상 '{0}'을(를) 반환합니다.", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "JavaScript는 값이 아닌 참조로 개체를 비교하므로 이 조건은 항상 '{0}'을(를) 반환합니다.", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "'{1}' 및 '{2}' 형식에 겹침이 없기 때문에 이 조건은 항상 '{0}'을(를) 반환합니다.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "이 '{0}'(은)는 항상 정의되어 있으므로 이 조건은 항상 true를 반환합니다.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "함수가 항상 정의되므로 이 조건은 항상 true를 반환합니다. 대신 호출하시겠어요?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "이 생성자 함수는 클래스 선언으로 변환될 수 있습니다.", @@ -1491,7 +1501,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "이 멤버는 기본 클래스 '{0}'의 멤버를 재정의하므로 'override' 한정자를 포함해야 합니다.", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "이 멤버는 기본 클래스 '{0}'에 선언된 추상 메서드를 재정의하므로 'override' 한정자를 포함해야 합니다.", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "이 모듈은 '{0}' 플래그를 켜고 기본 내보내기를 참조하여 ECMAScript 가져오기/내보내기를 통해서만 참조할 수 있습니다.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "이 모듈은 'export ='를 사용하여 선언되었으며 '{0}' 플래그를 사용하는 경우에만 기본 가져오기와 함께 사용할 수 있습니다.", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "이 모듈은 'export ='를 사용하여 선언되었으며 '{0}' 플래그를 사용하는 경우에만 기본 가져오기와 함께 사용할 수 있습니다.", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "이 오버로드 시그니처는 해당 구현 시그니처와 호환되지 않습니다.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "이 매개 변수는 'use strict' 지시문에서 사용할 수 없습니다.", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "이 매개변수 속성은 기본 클래스 '{0}'의 멤버를 재정의하므로 '@override' 태그가 있는 JSDoc 주석이 있어야 합니다.", @@ -1504,6 +1514,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "이 구문에는 {2} 매개 변수가 포함된 '{1}'(이)라는 가져온 도우미가 필요하지만, 이 도우미는 '{0}'에 있는 도우미와 호환되지 않습니다. '{0}' 버전을 업그레이드하는 것이 좋습니다.", "This_type_parameter_might_need_an_extends_0_constraint_2208": "이 형식 매개 변수에는 `extends {0}` 제약 조건이 필요할 수 있습니다.", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "이 '가져오기' 사용은 유효하지 않습니다. 'import()' 호출을 작성할 수 있지만 괄호가 있어야 하며 유형 인수를 가질 수 없습니다.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "이 파일을 ECMAScript 모듈로 변환하려면 `\"type\": \"module\"` 필드를 '{0}'에 추가하세요.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "이 파일을 ECMAScript 모듈로 변환하려면 파일 확장명을 '{0}'(으)로 변경하거나 `\"type\": \"module\"` 필드를 '{1}'에 추가하세요.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "이 파일을 ECMAScript 모듈로 변환하려면 파일 확장명을 '{0}'(으)로 변경하거나 `{ \"type\": \"module\" }`을 사용하여 로컬 package.json 파일을 만드세요.", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "이 파일을 ECMAScript 모듈로 변환하려면 `{ \"type\": \"module\" }`을 사용하여 로컬 package.json 파일을 만드세요.", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "최상위 'await' 식은 'module' 옵션이 'es2022', 'esnext', 'system', 'node16' 또는 'nodenext'로 설정되고 'target' 옵션이 'es2017' 이상으로 설정된 경우에만 허용됩니다.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": ".d.ts 파일의 최상위 수준 선언은 'declare' 또는 'export' 한정자로 시작해야 합니다.", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "최상위 'for await' 루프는 'module' 옵션이 'es2022', 'esnext', 'system', 'node16' 또는 'nodenext'로 설정되고 'target' 옵션이 'es2017' 이상으로 설정된 경우에만 허용됩니다.", @@ -1519,6 +1533,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "'{0}' 형식을 인덱스 형식으로 사용할 수 없습니다.", "Type_0_cannot_be_used_to_index_type_1_2536": "'{0}' 형식을 인덱스 형식 '{1}'에 사용할 수 없습니다.", "Type_0_does_not_satisfy_the_constraint_1_2344": "'{0}' 형식이 '{1}' 제약 조건을 만족하지 않습니다.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "형식 '{0}'이(가) 필요한 형식 '{1}'을(를) 충족하지 않습니다.", "Type_0_has_no_call_signatures_2757": "'{0}' 형식에 호출 시그니처가 없습니다.", "Type_0_has_no_construct_signatures_2761": "'{0}' 형식에 구문 시그니처가 없습니다.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "'{0}' 형식에 '{1}' 형식에 대한 일치하는 인덱스 시그니처가 없습니다.", @@ -1540,6 +1555,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "'{0}' 유형은 'exactOptionalPropertyTypes: true'가 있는 '{1}' 유형에 할당할 수 없습니다. 대상 유형에 'undefined'를 추가하는 것을 고려하세요.", "Type_0_is_not_comparable_to_type_1_2678": "'{0}' 형식을 '{1}' 형식과 비교할 수 없습니다.", "Type_0_is_not_generic_2315": "'{0}' 형식이 제네릭이 아닙니다.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "형식 '{0}'은(는) 'in' 연산자의 오른쪽 피연산자로 허용되지 않는 기본 값을 나타낼 수 있습니다.", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "'{0}' 형식에는 비동기 반복기를 반환하는 '[Symbol.asyncIterator]()' 메서드가 있어야 합니다.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "'{0}' 형식에는 반복기를 반환하는 '[Symbol.iterator]()' 메서드가 있어야 합니다.", "Type_0_provides_no_match_for_the_signature_1_2658": "'{0}' 형식에서 '{1}' 시그니처에 대한 일치하는 항목을 제공하지 않습니다.", @@ -1596,6 +1612,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== 형식 참조 지시문 '{0}'이(가) 확인되지 않았습니다. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== 형식 참조 지시문 '{0}'이(가) '{1}'(으)로 확인되었습니다. 주: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== 형식 참조 지시문 '{0}'이(가) 패키지 ID가 '{2}'인 '{1}'(으)로 확인되었습니다. 주: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "형식 만족 식은 TypeScript 파일에서만 사용할 수 있습니다.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "유형은 JavaScript 파일의 내보내기 선언에 나타날 수 없습니다.", "Types_have_separate_declarations_of_a_private_property_0_2442": "형식에 별도의 프라이빗 속성 '{0}' 선언이 있습니다.", "Types_of_construct_signatures_are_incompatible_2419": "구문 시그니처 형식이 호환되지 않습니다.", @@ -1637,9 +1654,12 @@ "Updating_output_of_project_0_6373": "'{0}' 프로젝트의 출력을 업데이트하는 중...", "Updating_output_timestamps_of_project_0_6359": "'{0}' 프로젝트의 출력 타임스탬프를 업데이트하는 중...", "Updating_unchanged_output_timestamps_of_project_0_6371": "'{0}' 프로젝트의 변경되지 않은 출력 타임스탬프를 업데이트하는 중...", + "Use_0_95174": "`{0}`을(를) 사용합니다.", + "Use_Number_isNaN_in_all_conditions_95175": "모든 조건에서 'Number.isNaN'을 사용합니다.", "Use_element_access_for_0_95145": "'{0}'에 요소 액세스 사용", "Use_element_access_for_all_undeclared_properties_95146": "선언되지 않은 모든 속성에 요소 액세스를 사용합니다.", "Use_synthetic_default_member_95016": "가상 '기본' 멤버를 사용합니다.", + "Using_0_subpath_1_with_target_2_6404": "'{0}' 하위 경로 '{1}'과(와) 대상 '{2}'을(를) 사용하는 중입니다.", "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "ECMAScript 5 이상에서만 'for...of' 문에서 문자열을 사용할 수 있습니다.", "Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915": "--build를 사용하면 -b가 tsc로 하여금 컴파일러보다 빌드 오케스트레이터처럼 작동하도록 합니다. 이 항목은 {0}에서 더 자세히 알아볼 수 있는 복합 프로젝트를 구축하는 데 사용됩니다.", "Using_compiler_options_of_project_reference_redirect_0_6215": "프로젝트 참조 리디렉션 '{0}'의 컴파일러 옵션을 사용 중입니다.", @@ -1717,6 +1737,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "'{0}'은(는) '{1}' 키워드에 대한 올바른 메타 속성이 아닙니다. '{2}'을(를) 사용하시겠습니까?", "_0_is_not_allowed_as_a_parameter_name_1390": "'{0}'은(는) 매개 변수 이름으로 사용할 수 없습니다.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "'{0}'은(는) 변수 선언 이름으로 사용할 수 없습니다.", + "_0_is_of_type_unknown_18046": "'{0}'은(는) 'unknown' 형식입니다.", + "_0_is_possibly_null_18047": "'{0}'은(는) 'null'일 수 있습니다.", + "_0_is_possibly_null_or_undefined_18049": "'{0}'은(는) 'null' 또는 'undefined'일 수 있습니다.", + "_0_is_possibly_undefined_18048": "'{0}'은(는) 'undefined'일 수 있습니다.", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "'{0}'은(는) 자체 기본 식에서 직간접적으로 참조됩니다.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "'{0}'은(는) 자체 형식 주석에서 직간접적으로 참조됩니다.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "'{0}'이(가) 두 번 이상 지정되어 이 사용량을 덮어씁니다.", @@ -1752,6 +1776,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "반환 형식 주석이 없는 '{0}'에는 암시적으로 '{1}' 반환 형식이 포함됩니다.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "반환 형식 주석이 없는 '{0}'에는 암시적으로 '{1}' yield 형식이 포함됩니다.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "'abstract' 한정자는 클래스, 메서드 또는 속성 선언에만 나타날 수 있습니다.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "'accessor' 한정자는 속성 선언에만 나타날 수 있습니다.", "and_here_6204": "및 여기.", "arguments_cannot_be_referenced_in_property_initializers_2815": "'arguments'는 속성 이니셜라이저에서 참조할 수 없습니다.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "\"auto\": 가져오기, 내보내기, import.meta, jsx(jsx: react-jsx 포함) 또는 esm 형식(모듈: node16+ 포함)이 있는 파일을 모듈로 처리합니다.", diff --git a/node_modules/typescript/lib/lib.dom.d.ts b/node_modules/typescript/lib/lib.dom.d.ts index de7180107..5a4632137 100644 --- a/node_modules/typescript/lib/lib.dom.d.ts +++ b/node_modules/typescript/lib/lib.dom.d.ts @@ -136,15 +136,14 @@ interface AudioWorkletNodeOptions extends AudioNodeOptions { interface AuthenticationExtensionsClientInputs { appid?: string; - appidExclude?: string; credProps?: boolean; - uvm?: boolean; + hmacCreateSecret?: boolean; } interface AuthenticationExtensionsClientOutputs { appid?: boolean; credProps?: CredentialPropertiesOutput; - uvm?: UvmEntries; + hmacCreateSecret?: boolean; } interface AuthenticatorSelectionCriteria { @@ -373,7 +372,7 @@ interface DeviceOrientationEventInit extends EventInit { gamma?: number | null; } -interface DisplayMediaStreamConstraints { +interface DisplayMediaStreamOptions { audio?: boolean | MediaTrackConstraints; video?: boolean | MediaTrackConstraints; } @@ -806,10 +805,6 @@ interface MediaQueryListEventInit extends EventInit { media?: string; } -interface MediaRecorderErrorEventInit extends EventInit { - error: DOMException; -} - interface MediaRecorderOptions { audioBitsPerSecond?: number; bitsPerSecond?: number; @@ -819,9 +814,9 @@ interface MediaRecorderOptions { interface MediaSessionActionDetails { action: MediaSessionAction; - fastSeek?: boolean | null; - seekOffset?: number | null; - seekTime?: number | null; + fastSeek?: boolean; + seekOffset?: number; + seekTime?: number; } interface MediaStreamAudioSourceOptions { @@ -1121,6 +1116,10 @@ interface PermissionDescriptor { name: PermissionName; } +interface PictureInPictureEventInit extends EventInit { + pictureInPictureWindow: PictureInPictureWindow; +} + interface PointerEventInit extends MouseEventInit { coalescedEvents?: PointerEvent[]; height?: number; @@ -1314,6 +1313,8 @@ interface RTCIceCandidatePairStats extends RTCStats { bytesReceived?: number; bytesSent?: number; currentRoundTripTime?: number; + lastPacketReceivedTimestamp?: DOMHighResTimeStamp; + lastPacketSentTimestamp?: DOMHighResTimeStamp; localCandidateId: string; nominated?: boolean; remoteCandidateId: string; @@ -1328,18 +1329,47 @@ interface RTCIceCandidatePairStats extends RTCStats { interface RTCIceServer { credential?: string; - credentialType?: RTCIceCredentialType; urls: string | string[]; username?: string; } interface RTCInboundRtpStreamStats extends RTCReceivedRtpStreamStats { + audioLevel?: number; + bytesReceived?: number; + concealedSamples?: number; + concealmentEvents?: number; + decoderImplementation?: string; + estimatedPlayoutTimestamp?: DOMHighResTimeStamp; + fecPacketsDiscarded?: number; + fecPacketsReceived?: number; firCount?: number; + frameHeight?: number; + frameWidth?: number; framesDecoded?: number; + framesDropped?: number; + framesPerSecond?: number; + framesReceived?: number; + headerBytesReceived?: number; + insertedSamplesForDeceleration?: number; + jitterBufferDelay?: number; + jitterBufferEmittedCount?: number; + keyFramesDecoded?: number; + kind: string; + lastPacketReceivedTimestamp?: DOMHighResTimeStamp; nackCount?: number; + packetsDiscarded?: number; pliCount?: number; qpSum?: number; remoteId?: string; + removedSamplesForAcceleration?: number; + silentConcealedSamples?: number; + totalAudioEnergy?: number; + totalDecodeTime?: number; + totalInterFrameDelay?: number; + totalProcessingDelay?: number; + totalSamplesDuration?: number; + totalSamplesReceived?: number; + totalSquaredInterFrameDelay?: number; } interface RTCLocalSessionDescriptionInit { @@ -1358,11 +1388,27 @@ interface RTCOfferOptions extends RTCOfferAnswerOptions { interface RTCOutboundRtpStreamStats extends RTCSentRtpStreamStats { firCount?: number; + frameHeight?: number; + frameWidth?: number; framesEncoded?: number; + framesPerSecond?: number; + framesSent?: number; + headerBytesSent?: number; + hugeFramesSent?: number; + keyFramesEncoded?: number; + mediaSourceId?: string; nackCount?: number; pliCount?: number; qpSum?: number; + qualityLimitationResolutionChanges?: number; remoteId?: string; + retransmittedBytesSent?: number; + retransmittedPacketsSent?: number; + rid?: string; + targetBitrate?: number; + totalEncodeTime?: number; + totalEncodedBytesTarget?: number; + totalPacketSendDelay?: number; } interface RTCPeerConnectionIceErrorEventInit extends EventInit { @@ -1380,7 +1426,6 @@ interface RTCPeerConnectionIceEventInit extends EventInit { interface RTCReceivedRtpStreamStats extends RTCRtpStreamStats { jitter?: number; - packetsDiscarded?: number; packetsLost?: number; packetsReceived?: number; } @@ -1424,6 +1469,8 @@ interface RTCRtpContributingSource { interface RTCRtpEncodingParameters extends RTCRtpCodingParameters { active?: boolean; maxBitrate?: number; + maxFramerate?: number; + networkPriority?: RTCPriorityType; priority?: RTCPriorityType; scaleResolutionDownBy?: number; } @@ -1499,15 +1546,23 @@ interface RTCTransportStats extends RTCStats { dtlsState: RTCDtlsTransportState; localCertificateId?: string; remoteCertificateId?: string; - rtcpTransportStatsId?: string; selectedCandidatePairId?: string; srtpCipher?: string; tlsVersion?: string; } -interface ReadableStreamReadDoneResult { +interface ReadableStreamGetReaderOptions { + /** + * Creates a ReadableStreamBYOBReader and locks the stream to the new reader. + * + * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation. + */ + mode?: ReadableStreamReaderMode; +} + +interface ReadableStreamReadDoneResult { done: true; - value?: undefined; + value?: T; } interface ReadableStreamReadValueResult { @@ -1791,6 +1846,21 @@ interface ULongRange { min?: number; } +interface UnderlyingByteSource { + autoAllocateChunkSize?: number; + cancel?: UnderlyingSourceCancelCallback; + pull?: (controller: ReadableByteStreamController) => void | PromiseLike; + start?: (controller: ReadableByteStreamController) => any; + type: "bytes"; +} + +interface UnderlyingDefaultSource { + cancel?: UnderlyingSourceCancelCallback; + pull?: (controller: ReadableStreamDefaultController) => void | PromiseLike; + start?: (controller: ReadableStreamDefaultController) => any; + type?: undefined; +} + interface UnderlyingSink { abort?: UnderlyingSinkAbortCallback; close?: UnderlyingSinkCloseCallback; @@ -1800,10 +1870,11 @@ interface UnderlyingSink { } interface UnderlyingSource { + autoAllocateChunkSize?: number; cancel?: UnderlyingSourceCancelCallback; pull?: UnderlyingSourcePullCallback; start?: UnderlyingSourceStartCallback; - type?: undefined; + type?: ReadableStreamType; } interface ValidityStateFlags { @@ -1820,10 +1891,10 @@ interface ValidityStateFlags { } interface VideoColorSpaceInit { - fullRange?: boolean; - matrix?: VideoMatrixCoefficients; - primaries?: VideoColorPrimaries; - transfer?: VideoTransferCharacteristics; + fullRange?: boolean | null; + matrix?: VideoMatrixCoefficients | null; + primaries?: VideoColorPrimaries | null; + transfer?: VideoTransferCharacteristics | null; } interface VideoConfiguration { @@ -1838,7 +1909,7 @@ interface VideoConfiguration { width: number; } -interface VideoFrameMetadata { +interface VideoFrameCallbackMetadata { captureTime?: DOMHighResTimeStamp; expectedDisplayTime: DOMHighResTimeStamp; height: number; @@ -1931,12 +2002,14 @@ interface ARIAMixin { ariaChecked: string | null; ariaColCount: string | null; ariaColIndex: string | null; + ariaColIndexText: string | null; ariaColSpan: string | null; ariaCurrent: string | null; ariaDisabled: string | null; ariaExpanded: string | null; ariaHasPopup: string | null; ariaHidden: string | null; + ariaInvalid: string | null; ariaKeyShortcuts: string | null; ariaLabel: string | null; ariaLevel: string | null; @@ -1953,6 +2026,7 @@ interface ARIAMixin { ariaRoleDescription: string | null; ariaRowCount: string | null; ariaRowIndex: string | null; + ariaRowIndexText: string | null; ariaRowSpan: string | null; ariaSelected: string | null; ariaSetSize: string | null; @@ -1961,6 +2035,7 @@ interface ARIAMixin { ariaValueMin: string | null; ariaValueNow: string | null; ariaValueText: string | null; + role: string | null; } /** A controller object that allows you to abort one or more DOM requests as and when desired. */ @@ -1996,7 +2071,8 @@ interface AbortSignal extends EventTarget { declare var AbortSignal: { prototype: AbortSignal; new(): AbortSignal; - // abort(): AbortSignal; - To be re-added in the future + abort(reason?: any): AbortSignal; + timeout(milliseconds: number): AbortSignal; }; interface AbstractRange { @@ -2131,7 +2207,7 @@ declare var AnimationPlaybackEvent: { }; interface AnimationTimeline { - readonly currentTime: number | null; + readonly currentTime: CSSNumberish | null; } declare var AnimationTimeline: { @@ -2147,6 +2223,7 @@ interface Attr extends Node { readonly ownerDocument: Document; readonly ownerElement: Element | null; readonly prefix: string | null; + /** @deprecated */ readonly specified: boolean; value: string; } @@ -2382,6 +2459,10 @@ declare var AuthenticatorAssertionResponse: { /** Available only in secure contexts. */ interface AuthenticatorAttestationResponse extends AuthenticatorResponse { readonly attestationObject: ArrayBuffer; + getAuthenticatorData(): ArrayBuffer; + getPublicKey(): ArrayBuffer | null; + getPublicKeyAlgorithm(): COSEAlgorithmIdentifier; + getTransports(): string[]; } declare var AuthenticatorAttestationResponse: { @@ -2580,6 +2661,14 @@ declare var CSSConditionRule: { new(): CSSConditionRule; }; +interface CSSContainerRule extends CSSConditionRule { +} + +declare var CSSContainerRule: { + prototype: CSSContainerRule; + new(): CSSContainerRule; +}; + interface CSSCounterStyleRule extends CSSRule { additiveSymbols: string; fallback: string; @@ -2608,6 +2697,18 @@ declare var CSSFontFaceRule: { new(): CSSFontFaceRule; }; +interface CSSFontPaletteValuesRule extends CSSRule { + readonly basePalette: string; + readonly fontFamily: string; + readonly name: string; + readonly overrideColors: string; +} + +declare var CSSFontPaletteValuesRule: { + prototype: CSSFontPaletteValuesRule; + new(): CSSFontPaletteValuesRule; +}; + /** Any CSS at-rule that contains other rules nested within it. */ interface CSSGroupingRule extends CSSRule { readonly cssRules: CSSRuleList; @@ -2622,6 +2723,7 @@ declare var CSSGroupingRule: { interface CSSImportRule extends CSSRule { readonly href: string; + readonly layerName: string | null; readonly media: MediaList; readonly styleSheet: CSSStyleSheet; } @@ -2656,6 +2758,24 @@ declare var CSSKeyframesRule: { new(): CSSKeyframesRule; }; +interface CSSLayerBlockRule extends CSSGroupingRule { + readonly name: string; +} + +declare var CSSLayerBlockRule: { + prototype: CSSLayerBlockRule; + new(): CSSLayerBlockRule; +}; + +interface CSSLayerStatementRule extends CSSRule { + readonly nameList: ReadonlyArray; +} + +declare var CSSLayerStatementRule: { + prototype: CSSLayerStatementRule; + new(): CSSLayerStatementRule; +}; + /** A single CSS @media rule. It implements the CSSConditionRule interface, and therefore the CSSGroupingRule and the CSSRule interface with a type value of 4 (CSSRule.MEDIA_RULE). */ interface CSSMediaRule extends CSSConditionRule { readonly media: MediaList; @@ -2753,6 +2873,7 @@ interface CSSStyleDeclaration { animationTimingFunction: string; appearance: string; aspectRatio: string; + backdropFilter: string; backfaceVisibility: string; background: string; backgroundAttachment: string; @@ -2857,6 +2978,9 @@ interface CSSStyleDeclaration { columnWidth: string; columns: string; contain: string; + container: string; + containerName: string; + containerType: string; content: string; counterIncrement: string; counterReset: string; @@ -2887,6 +3011,7 @@ interface CSSStyleDeclaration { fontFeatureSettings: string; fontKerning: string; fontOpticalSizing: string; + fontPalette: string; fontSize: string; fontSizeAdjust: string; fontStretch: string; @@ -2924,6 +3049,7 @@ interface CSSStyleDeclaration { gridTemplateColumns: string; gridTemplateRows: string; height: string; + hyphenateCharacter: string; hyphens: string; /** @deprecated */ imageOrientation: string; @@ -3000,6 +3126,7 @@ interface CSSStyleDeclaration { outlineWidth: string; overflow: string; overflowAnchor: string; + overflowClipMargin: string; overflowWrap: string; overflowX: string; overflowY: string; @@ -3457,6 +3584,7 @@ interface CanvasPath { moveTo(x: number, y: number): void; quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; rect(x: number, y: number, w: number, h: number): void; + roundRect(x: number, y: number, w: number, h: number, radii?: number | DOMPointInit | (number | DOMPointInit)[]): void; } interface CanvasPathDrawingStyles { @@ -3518,6 +3646,7 @@ interface CanvasText { interface CanvasTextDrawingStyles { direction: CanvasDirection; font: string; + fontKerning: CanvasFontKerning; textAlign: CanvasTextAlign; textBaseline: CanvasTextBaseline; } @@ -4379,7 +4508,10 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad readonly documentElement: HTMLElement; /** Returns document's URL. */ readonly documentURI: string; - /** Sets or gets the security domain of the document. */ + /** + * Sets or gets the security domain of the document. + * @deprecated + */ domain: string; /** Retrieves a collection of all embed objects in the document. */ readonly embeds: HTMLCollectionOf; @@ -4533,7 +4665,6 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad createEvent(eventInterface: "MediaEncryptedEvent"): MediaEncryptedEvent; createEvent(eventInterface: "MediaKeyMessageEvent"): MediaKeyMessageEvent; createEvent(eventInterface: "MediaQueryListEvent"): MediaQueryListEvent; - createEvent(eventInterface: "MediaRecorderErrorEvent"): MediaRecorderErrorEvent; createEvent(eventInterface: "MediaStreamTrackEvent"): MediaStreamTrackEvent; createEvent(eventInterface: "MessageEvent"): MessageEvent; createEvent(eventInterface: "MouseEvent"): MouseEvent; @@ -4544,6 +4675,7 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad createEvent(eventInterface: "PageTransitionEvent"): PageTransitionEvent; createEvent(eventInterface: "PaymentMethodChangeEvent"): PaymentMethodChangeEvent; createEvent(eventInterface: "PaymentRequestUpdateEvent"): PaymentRequestUpdateEvent; + createEvent(eventInterface: "PictureInPictureEvent"): PictureInPictureEvent; createEvent(eventInterface: "PointerEvent"): PointerEvent; createEvent(eventInterface: "PopStateEvent"): PopStateEvent; createEvent(eventInterface: "ProgressEvent"): ProgressEvent; @@ -4662,6 +4794,7 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad /** * Returns a Boolean value that indicates whether the specified command is in the indeterminate state. * @param commandId String that specifies a command identifier. + * @deprecated */ queryCommandIndeterm(commandId: string): boolean; /** @@ -4679,6 +4812,7 @@ interface Document extends Node, DocumentAndElementEventHandlers, DocumentOrShad /** * Returns the current value of the document, range, or current selection for the given command. * @param commandId String that specifies a command identifier. + * @deprecated */ queryCommandValue(commandId: string): string; /** @deprecated */ @@ -4837,6 +4971,13 @@ interface EXT_sRGB { interface EXT_shader_texture_lod { } +interface EXT_texture_compression_bptc { + readonly COMPRESSED_RGBA_BPTC_UNORM_EXT: GLenum; + readonly COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: GLenum; + readonly COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: GLenum; + readonly COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: GLenum; +} + interface EXT_texture_compression_rgtc { readonly COMPRESSED_RED_GREEN_RGTC2_EXT: GLenum; readonly COMPRESSED_RED_RGTC1_EXT: GLenum; @@ -4850,6 +4991,17 @@ interface EXT_texture_filter_anisotropic { readonly TEXTURE_MAX_ANISOTROPY_EXT: GLenum; } +interface EXT_texture_norm16 { + readonly R16_EXT: GLenum; + readonly R16_SNORM_EXT: GLenum; + readonly RG16_EXT: GLenum; + readonly RG16_SNORM_EXT: GLenum; + readonly RGB16_EXT: GLenum; + readonly RGB16_SNORM_EXT: GLenum; + readonly RGBA16_EXT: GLenum; + readonly RGBA16_SNORM_EXT: GLenum; +} + interface ElementEventMap { "fullscreenchange": Event; "fullscreenerror": Event; @@ -5032,6 +5184,7 @@ declare var ErrorEvent: { interface Event { /** Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. */ readonly bubbles: boolean; + /** @deprecated */ cancelBubble: boolean; /** Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. */ readonly cancelable: boolean; @@ -5568,6 +5721,7 @@ interface GlobalEventHandlersEventMap { "auxclick": MouseEvent; "beforeinput": InputEvent; "blur": FocusEvent; + "cancel": Event; "canplay": Event; "canplaythrough": Event; "change": Event; @@ -5668,11 +5822,13 @@ interface GlobalEventHandlers { onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null; onauxclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null; + onbeforeinput: ((this: GlobalEventHandlers, ev: InputEvent) => any) | null; /** * Fires when the object loses the input focus. * @param ev The focus event. */ onblur: ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null; + oncancel: ((this: GlobalEventHandlers, ev: Event) => any) | null; /** * Occurs when playback is possible, but would require further buffering. * @param ev The event. @@ -6186,6 +6342,7 @@ interface HTMLCanvasElement extends HTMLElement { * @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image. */ toDataURL(type?: string, quality?: any): string; + transferControlToOffscreen(): OffscreenCanvas; addEventListener(type: K, listener: (this: HTMLCanvasElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: HTMLCanvasElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; @@ -8769,13 +8926,13 @@ declare var IDBObjectStore: { }; interface IDBOpenDBRequestEventMap extends IDBRequestEventMap { - "blocked": Event; + "blocked": IDBVersionChangeEvent; "upgradeneeded": IDBVersionChangeEvent; } /** Also inherits methods from its parents IDBRequest and EventTarget. */ interface IDBOpenDBRequest extends IDBRequest { - onblocked: ((this: IDBOpenDBRequest, ev: Event) => any) | null; + onblocked: ((this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any) | null; onupgradeneeded: ((this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any) | null; addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -8900,7 +9057,7 @@ declare var ImageBitmap: { interface ImageBitmapRenderingContext { /** Returns the canvas element that the context is bound to. */ - readonly canvas: HTMLCanvasElement; + readonly canvas: HTMLCanvasElement | OffscreenCanvas; /** Transfers the underlying bitmap data from imageBitmap to context, and the bitmap becomes the contents of the canvas element to which context is bound. */ transferFromImageBitmap(bitmap: ImageBitmap | null): void; } @@ -8931,6 +9088,7 @@ interface InnerHTML { innerHTML: string; } +/** Available only in secure contexts. */ interface InputDeviceInfo extends MediaDeviceInfo { } @@ -9184,7 +9342,7 @@ interface MediaDevicesEventMap { interface MediaDevices extends EventTarget { ondevicechange: ((this: MediaDevices, ev: Event) => any) | null; enumerateDevices(): Promise; - getDisplayMedia(constraints?: DisplayMediaStreamConstraints): Promise; + getDisplayMedia(options?: DisplayMediaStreamOptions): Promise; getSupportedConstraints(): MediaTrackSupportedConstraints; getUserMedia(constraints?: MediaStreamConstraints): Promise; addEventListener(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; @@ -9391,7 +9549,7 @@ declare var MediaQueryListEvent: { interface MediaRecorderEventMap { "dataavailable": BlobEvent; - "error": MediaRecorderErrorEvent; + "error": Event; "pause": Event; "resume": Event; "start": Event; @@ -9402,7 +9560,7 @@ interface MediaRecorder extends EventTarget { readonly audioBitsPerSecond: number; readonly mimeType: string; ondataavailable: ((this: MediaRecorder, ev: BlobEvent) => any) | null; - onerror: ((this: MediaRecorder, ev: MediaRecorderErrorEvent) => any) | null; + onerror: ((this: MediaRecorder, ev: Event) => any) | null; onpause: ((this: MediaRecorder, ev: Event) => any) | null; onresume: ((this: MediaRecorder, ev: Event) => any) | null; onstart: ((this: MediaRecorder, ev: Event) => any) | null; @@ -9427,15 +9585,6 @@ declare var MediaRecorder: { isTypeSupported(type: string): boolean; }; -interface MediaRecorderErrorEvent extends Event { - readonly error: DOMException; -} - -declare var MediaRecorderErrorEvent: { - prototype: MediaRecorderErrorEvent; - new(type: string, eventInitDict: MediaRecorderErrorEventInit): MediaRecorderErrorEvent; -}; - interface MediaSession { metadata: MediaMetadata | null; playbackState: MediaSessionPlaybackState; @@ -9888,12 +10037,14 @@ interface NavigatorID { readonly appName: string; /** @deprecated */ readonly appVersion: string; + /** @deprecated */ readonly platform: string; /** @deprecated */ readonly product: string; /** @deprecated */ readonly productSub: string; readonly userAgent: string; + /** @deprecated */ readonly vendor: string; /** @deprecated */ readonly vendorSub: string; @@ -10142,6 +10293,16 @@ declare var Notification: { requestPermission(deprecatedCallback?: NotificationPermissionCallback): Promise; }; +interface OES_draw_buffers_indexed { + blendEquationSeparateiOES(buf: GLuint, modeRGB: GLenum, modeAlpha: GLenum): void; + blendEquationiOES(buf: GLuint, mode: GLenum): void; + blendFuncSeparateiOES(buf: GLuint, srcRGB: GLenum, dstRGB: GLenum, srcAlpha: GLenum, dstAlpha: GLenum): void; + blendFunciOES(buf: GLuint, src: GLenum, dst: GLenum): void; + colorMaskiOES(buf: GLuint, r: GLboolean, g: GLboolean, b: GLboolean, a: GLboolean): void; + disableiOES(target: GLenum, index: GLuint): void; + enableiOES(target: GLenum, index: GLuint): void; +} + /** The OES_element_index_uint extension is part of the WebGL API and adds support for gl.UNSIGNED_INT types to WebGLRenderingContext.drawElements(). */ interface OES_element_index_uint { } @@ -10220,6 +10381,57 @@ declare var OfflineAudioContext: { new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext; }; +interface OffscreenCanvasEventMap { + "contextlost": Event; + "contextrestored": Event; +} + +interface OffscreenCanvas extends EventTarget { + /** + * These attributes return the dimensions of the OffscreenCanvas object's bitmap. + * + * They can be set, to replace the bitmap with a new, transparent black bitmap of the specified dimensions (effectively resizing it). + */ + height: number; + oncontextlost: ((this: OffscreenCanvas, ev: Event) => any) | null; + oncontextrestored: ((this: OffscreenCanvas, ev: Event) => any) | null; + /** + * These attributes return the dimensions of the OffscreenCanvas object's bitmap. + * + * They can be set, to replace the bitmap with a new, transparent black bitmap of the specified dimensions (effectively resizing it). + */ + width: number; + /** + * Returns an object that exposes an API for drawing on the OffscreenCanvas object. contextId specifies the desired API: "2d", "bitmaprenderer", "webgl", or "webgl2". options is handled by that API. + * + * This specification defines the "2d" context below, which is similar but distinct from the "2d" context that is created from a canvas element. The WebGL specifications define the "webgl" and "webgl2" contexts. [WEBGL] + * + * Returns null if the canvas has already been initialized with another context type (e.g., trying to get a "2d" context after getting a "webgl" context). + */ + getContext(contextId: OffscreenRenderingContextId, options?: any): OffscreenRenderingContext | null; + /** Returns a newly created ImageBitmap object with the image in the OffscreenCanvas object. The image in the OffscreenCanvas object is replaced with a new blank image. */ + transferToImageBitmap(): ImageBitmap; + addEventListener(type: K, listener: (this: OffscreenCanvas, ev: OffscreenCanvasEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: OffscreenCanvas, ev: OffscreenCanvasEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var OffscreenCanvas: { + prototype: OffscreenCanvas; + new(width: number, height: number): OffscreenCanvas; +}; + +interface OffscreenCanvasRenderingContext2D extends CanvasCompositing, CanvasDrawImage, CanvasDrawPath, CanvasFillStrokeStyles, CanvasFilters, CanvasImageData, CanvasImageSmoothing, CanvasPath, CanvasPathDrawingStyles, CanvasRect, CanvasShadowStyles, CanvasState, CanvasText, CanvasTextDrawingStyles, CanvasTransform { + readonly canvas: OffscreenCanvas; + commit(): void; +} + +declare var OffscreenCanvasRenderingContext2D: { + prototype: OffscreenCanvasRenderingContext2D; + new(): OffscreenCanvasRenderingContext2D; +}; + /** The OscillatorNode interface represents a periodic waveform, such as a sine wave. It is an AudioScheduledSourceNode audio-processing module that causes a specified frequency of a given wave to be created—in effect, a constant tone. */ interface OscillatorNode extends AudioScheduledSourceNode { readonly detune: AudioParam; @@ -10680,6 +10892,7 @@ interface PermissionStatusEventMap { } interface PermissionStatus extends EventTarget { + readonly name: string; onchange: ((this: PermissionStatus, ev: Event) => any) | null; readonly state: PermissionState; addEventListener(type: K, listener: (this: PermissionStatus, ev: PermissionStatusEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; @@ -10702,6 +10915,15 @@ declare var Permissions: { new(): Permissions; }; +interface PictureInPictureEvent extends Event { + readonly pictureInPictureWindow: PictureInPictureWindow; +} + +declare var PictureInPictureEvent: { + prototype: PictureInPictureEvent; + new(type: string, eventInitDict: PictureInPictureEventInit): PictureInPictureEvent; +}; + interface PictureInPictureWindowEventMap { "resize": Event; } @@ -10853,6 +11075,7 @@ declare var PromiseRejectionEvent: { /** Available only in secure contexts. */ interface PublicKeyCredential extends Credential { + readonly authenticatorAttachment: string | null; readonly rawId: ArrayBuffer; readonly response: AuthenticatorResponse; getClientExtensionResults(): AuthenticationExtensionsClientOutputs; @@ -10901,6 +11124,7 @@ declare var PushSubscription: { /** Available only in secure contexts. */ interface PushSubscriptionOptions { readonly applicationServerKey: ArrayBuffer | null; + readonly userVisibleOnly: boolean; } declare var PushSubscriptionOptions: { @@ -11385,7 +11609,9 @@ declare var ReadableByteStreamController: { interface ReadableStream { readonly locked: boolean; cancel(reason?: any): Promise; + getReader(options: { mode: "byob" }): ReadableStreamBYOBReader; getReader(): ReadableStreamDefaultReader; + getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader; pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; pipeTo(destination: WritableStream, options?: StreamPipeOptions): Promise; tee(): [ReadableStream, ReadableStream]; @@ -11393,11 +11619,13 @@ interface ReadableStream { declare var ReadableStream: { prototype: ReadableStream; + new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number }): ReadableStream; + new(underlyingSource: UnderlyingDefaultSource, strategy?: QueuingStrategy): ReadableStream; new(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; }; interface ReadableStreamBYOBReader extends ReadableStreamGenericReader { - read(view: ArrayBufferView): Promise>; + read(view: T): Promise>; releaseLock(): void; } @@ -13018,6 +13246,7 @@ interface SVGStyleElement extends SVGElement, LinkStyle { disabled: boolean; media: string; title: string; + /** @deprecated */ type: string; addEventListener(type: K, listener: (this: SVGStyleElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -13380,6 +13609,7 @@ interface Selection { empty(): void; extend(node: Node, offset?: number): void; getRangeAt(index: number): Range; + modify(alter?: string, direction?: string, granularity?: string): void; removeAllRanges(): void; removeRange(range: Range): void; selectAllChildren(node: Node): void; @@ -13778,6 +14008,7 @@ interface StorageEvent extends Event { readonly storageArea: Storage | null; /** Returns the URL of the document whose storage item changed. */ readonly url: string; + /** @deprecated */ initStorageEvent(type: string, bubbles?: boolean, cancelable?: boolean, key?: string | null, oldValue?: string | null, newValue?: string | null, url?: string | URL, storageArea?: Storage | null): void; } @@ -14560,8 +14791,8 @@ interface WEBGL_lose_context { interface WEBGL_multi_draw { multiDrawArraysInstancedWEBGL(mode: GLenum, firstsList: Int32Array | GLint[], firstsOffset: GLuint, countsList: Int32Array | GLsizei[], countsOffset: GLuint, instanceCountsList: Int32Array | GLsizei[], instanceCountsOffset: GLuint, drawcount: GLsizei): void; multiDrawArraysWEBGL(mode: GLenum, firstsList: Int32Array | GLint[], firstsOffset: GLuint, countsList: Int32Array | GLsizei[], countsOffset: GLuint, drawcount: GLsizei): void; - multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | GLint[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, instanceCountsList: Int32Array | GLsizei[], instanceCountsOffset: GLuint, drawcount: GLsizei): void; - multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | GLint[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, drawcount: GLsizei): void; + multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | GLsizei[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, instanceCountsList: Int32Array | GLsizei[], instanceCountsOffset: GLuint, drawcount: GLsizei): void; + multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | GLsizei[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, drawcount: GLsizei): void; } /** A WaveShaperNode always has exactly one input and one output. */ @@ -15911,7 +16142,7 @@ declare var WebGLRenderingContext: { }; interface WebGLRenderingContextBase { - readonly canvas: HTMLCanvasElement; + readonly canvas: HTMLCanvasElement | OffscreenCanvas; readonly drawingBufferHeight: GLsizei; readonly drawingBufferWidth: GLsizei; activeTexture(texture: GLenum): void; @@ -15971,35 +16202,39 @@ interface WebGLRenderingContextBase { getBufferParameter(target: GLenum, pname: GLenum): any; getContextAttributes(): WebGLContextAttributes | null; getError(): GLenum; + getExtension(extensionName: "ANGLE_instanced_arrays"): ANGLE_instanced_arrays | null; getExtension(extensionName: "EXT_blend_minmax"): EXT_blend_minmax | null; getExtension(extensionName: "EXT_color_buffer_float"): EXT_color_buffer_float | null; getExtension(extensionName: "EXT_color_buffer_half_float"): EXT_color_buffer_half_float | null; getExtension(extensionName: "EXT_float_blend"): EXT_float_blend | null; - getExtension(extensionName: "EXT_texture_filter_anisotropic"): EXT_texture_filter_anisotropic | null; getExtension(extensionName: "EXT_frag_depth"): EXT_frag_depth | null; - getExtension(extensionName: "EXT_shader_texture_lod"): EXT_shader_texture_lod | null; getExtension(extensionName: "EXT_sRGB"): EXT_sRGB | null; + getExtension(extensionName: "EXT_shader_texture_lod"): EXT_shader_texture_lod | null; + getExtension(extensionName: "EXT_texture_compression_bptc"): EXT_texture_compression_bptc | null; + getExtension(extensionName: "EXT_texture_compression_rgtc"): EXT_texture_compression_rgtc | null; + getExtension(extensionName: "EXT_texture_filter_anisotropic"): EXT_texture_filter_anisotropic | null; getExtension(extensionName: "KHR_parallel_shader_compile"): KHR_parallel_shader_compile | null; + getExtension(extensionName: "OES_element_index_uint"): OES_element_index_uint | null; + getExtension(extensionName: "OES_fbo_render_mipmap"): OES_fbo_render_mipmap | null; + getExtension(extensionName: "OES_standard_derivatives"): OES_standard_derivatives | null; + getExtension(extensionName: "OES_texture_float"): OES_texture_float | null; + getExtension(extensionName: "OES_texture_float_linear"): OES_texture_float_linear | null; + getExtension(extensionName: "OES_texture_half_float"): OES_texture_half_float | null; + getExtension(extensionName: "OES_texture_half_float_linear"): OES_texture_half_float_linear | null; getExtension(extensionName: "OES_vertex_array_object"): OES_vertex_array_object | null; getExtension(extensionName: "OVR_multiview2"): OVR_multiview2 | null; getExtension(extensionName: "WEBGL_color_buffer_float"): WEBGL_color_buffer_float | null; getExtension(extensionName: "WEBGL_compressed_texture_astc"): WEBGL_compressed_texture_astc | null; getExtension(extensionName: "WEBGL_compressed_texture_etc"): WEBGL_compressed_texture_etc | null; getExtension(extensionName: "WEBGL_compressed_texture_etc1"): WEBGL_compressed_texture_etc1 | null; + getExtension(extensionName: "WEBGL_compressed_texture_s3tc"): WEBGL_compressed_texture_s3tc | null; getExtension(extensionName: "WEBGL_compressed_texture_s3tc_srgb"): WEBGL_compressed_texture_s3tc_srgb | null; + getExtension(extensionName: "WEBGL_debug_renderer_info"): WEBGL_debug_renderer_info | null; getExtension(extensionName: "WEBGL_debug_shaders"): WEBGL_debug_shaders | null; + getExtension(extensionName: "WEBGL_depth_texture"): WEBGL_depth_texture | null; getExtension(extensionName: "WEBGL_draw_buffers"): WEBGL_draw_buffers | null; getExtension(extensionName: "WEBGL_lose_context"): WEBGL_lose_context | null; - getExtension(extensionName: "WEBGL_depth_texture"): WEBGL_depth_texture | null; - getExtension(extensionName: "WEBGL_debug_renderer_info"): WEBGL_debug_renderer_info | null; - getExtension(extensionName: "WEBGL_compressed_texture_s3tc"): WEBGL_compressed_texture_s3tc | null; - getExtension(extensionName: "OES_texture_half_float_linear"): OES_texture_half_float_linear | null; - getExtension(extensionName: "OES_texture_half_float"): OES_texture_half_float | null; - getExtension(extensionName: "OES_texture_float_linear"): OES_texture_float_linear | null; - getExtension(extensionName: "OES_texture_float"): OES_texture_float | null; - getExtension(extensionName: "OES_standard_derivatives"): OES_standard_derivatives | null; - getExtension(extensionName: "OES_element_index_uint"): OES_element_index_uint | null; - getExtension(extensionName: "ANGLE_instanced_arrays"): ANGLE_instanced_arrays | null; + getExtension(extensionName: "WEBGL_multi_draw"): WEBGL_multi_draw | null; getExtension(name: string): any; getFramebufferAttachmentParameter(target: GLenum, attachment: GLenum, pname: GLenum): any; getParameter(pname: GLenum): any; @@ -17385,7 +17620,7 @@ interface UnderlyingSourceStartCallback { } interface VideoFrameRequestCallback { - (now: DOMHighResTimeStamp, metadata: VideoFrameMetadata): void; + (now: DOMHighResTimeStamp, metadata: VideoFrameCallbackMetadata): void; } interface VoidFunction { @@ -17744,11 +17979,13 @@ declare var onanimationend: ((this: Window, ev: AnimationEvent) => any) | null; declare var onanimationiteration: ((this: Window, ev: AnimationEvent) => any) | null; declare var onanimationstart: ((this: Window, ev: AnimationEvent) => any) | null; declare var onauxclick: ((this: Window, ev: MouseEvent) => any) | null; +declare var onbeforeinput: ((this: Window, ev: InputEvent) => any) | null; /** * Fires when the object loses the input focus. * @param ev The focus event. */ declare var onblur: ((this: Window, ev: FocusEvent) => any) | null; +declare var oncancel: ((this: Window, ev: Event) => any) | null; /** * Occurs when playback is possible, but would require further buffering. * @param ev The event. @@ -18060,7 +18297,7 @@ type BodyInit = ReadableStream | XMLHttpRequestBodyInit; type BufferSource = ArrayBufferView | ArrayBuffer; type COSEAlgorithmIdentifier = number; type CSSNumberish = number; -type CanvasImageSource = HTMLOrSVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap; +type CanvasImageSource = HTMLOrSVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas; type ClipboardItemData = Promise; type ClipboardItems = ClipboardItem[]; type ConstrainBoolean = boolean | ConstrainBooleanParameters; @@ -18097,20 +18334,19 @@ type MediaProvider = MediaStream | MediaSource | Blob; type MessageEventSource = WindowProxy | MessagePort | ServiceWorker; type MutationRecordType = "attributes" | "characterData" | "childList"; type NamedCurve = string; +type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext; type OnBeforeUnloadEventHandler = OnBeforeUnloadEventHandlerNonNull | null; type OnErrorEventHandler = OnErrorEventHandlerNonNull | null; type PerformanceEntryList = PerformanceEntry[]; -type ReadableStreamController = ReadableStreamDefaultController; -type ReadableStreamReadResult = ReadableStreamReadValueResult | ReadableStreamReadDoneResult; -type ReadableStreamReader = ReadableStreamDefaultReader; +type ReadableStreamController = ReadableStreamDefaultController | ReadableByteStreamController; +type ReadableStreamReadResult = ReadableStreamReadValueResult | ReadableStreamReadDoneResult; +type ReadableStreamReader = ReadableStreamDefaultReader | ReadableStreamBYOBReader; type RenderingContext = CanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext; type RequestInfo = Request | string; -type TexImageSource = ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement; +type TexImageSource = ImageBitmap | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | OffscreenCanvas; type TimerHandler = string | Function; -type Transferable = ArrayBuffer | MessagePort | ImageBitmap; +type Transferable = OffscreenCanvas | ImageBitmap | MessagePort | ReadableStream | WritableStream | TransformStream | ArrayBuffer; type Uint32List = Uint32Array | GLuint[]; -type UvmEntries = UvmEntry[]; -type UvmEntry = number[]; type VibratePattern = number | number[]; type WindowProxy = Window; type XMLHttpRequestBodyInit = Blob | BufferSource | FormData | URLSearchParams | string; @@ -18122,7 +18358,7 @@ type AttestationConveyancePreference = "direct" | "enterprise" | "indirect" | "n type AudioContextLatencyCategory = "balanced" | "interactive" | "playback"; type AudioContextState = "closed" | "running" | "suspended"; type AuthenticatorAttachment = "cross-platform" | "platform"; -type AuthenticatorTransport = "ble" | "internal" | "nfc" | "usb"; +type AuthenticatorTransport = "ble" | "hybrid" | "internal" | "nfc" | "usb"; type AutoKeyword = "auto"; type AutomationRate = "a-rate" | "k-rate"; type BinaryType = "arraybuffer" | "blob"; @@ -18183,12 +18419,13 @@ type MediaKeySessionClosedReason = "closed-by-application" | "hardware-context-r type MediaKeySessionType = "persistent-license" | "temporary"; type MediaKeyStatus = "expired" | "internal-error" | "output-downscaled" | "output-restricted" | "released" | "status-pending" | "usable" | "usable-in-future"; type MediaKeysRequirement = "not-allowed" | "optional" | "required"; -type MediaSessionAction = "hangup" | "nexttrack" | "pause" | "play" | "previoustrack" | "seekbackward" | "seekforward" | "seekto" | "skipad" | "stop" | "togglecamera" | "togglemicrophone"; +type MediaSessionAction = "nexttrack" | "pause" | "play" | "previoustrack" | "seekbackward" | "seekforward" | "seekto" | "skipad" | "stop"; type MediaSessionPlaybackState = "none" | "paused" | "playing"; type MediaStreamTrackState = "ended" | "live"; type NavigationTimingType = "back_forward" | "navigate" | "prerender" | "reload"; type NotificationDirection = "auto" | "ltr" | "rtl"; type NotificationPermission = "default" | "denied" | "granted"; +type OffscreenRenderingContextId = "2d" | "bitmaprenderer" | "webgl" | "webgl2" | "webgpu"; type OrientationLockType = "any" | "landscape" | "landscape-primary" | "landscape-secondary" | "natural" | "portrait" | "portrait-primary" | "portrait-secondary"; type OrientationType = "landscape-primary" | "landscape-secondary" | "portrait-primary" | "portrait-secondary"; type OscillatorType = "custom" | "sawtooth" | "sine" | "square" | "triangle"; @@ -18213,7 +18450,6 @@ type RTCErrorDetailType = "data-channel-failure" | "dtls-failure" | "fingerprint type RTCIceCandidateType = "host" | "prflx" | "relay" | "srflx"; type RTCIceComponent = "rtcp" | "rtp"; type RTCIceConnectionState = "checking" | "closed" | "completed" | "connected" | "disconnected" | "failed" | "new"; -type RTCIceCredentialType = "password"; type RTCIceGathererState = "complete" | "gathering" | "new"; type RTCIceGatheringState = "complete" | "gathering" | "new"; type RTCIceProtocol = "tcp" | "udp"; @@ -18228,7 +18464,9 @@ type RTCSctpTransportState = "closed" | "connected" | "connecting"; type RTCSdpType = "answer" | "offer" | "pranswer" | "rollback"; type RTCSignalingState = "closed" | "have-local-offer" | "have-local-pranswer" | "have-remote-offer" | "have-remote-pranswer" | "stable"; type RTCStatsIceCandidatePairState = "failed" | "frozen" | "in-progress" | "inprogress" | "succeeded" | "waiting"; -type RTCStatsType = "candidate-pair" | "certificate" | "codec" | "csrc" | "data-channel" | "inbound-rtp" | "local-candidate" | "media-source" | "outbound-rtp" | "peer-connection" | "remote-candidate" | "remote-inbound-rtp" | "remote-outbound-rtp" | "track" | "transport"; +type RTCStatsType = "candidate-pair" | "certificate" | "codec" | "data-channel" | "inbound-rtp" | "local-candidate" | "media-source" | "outbound-rtp" | "peer-connection" | "remote-candidate" | "remote-inbound-rtp" | "remote-outbound-rtp" | "track" | "transport"; +type ReadableStreamReaderMode = "byob"; +type ReadableStreamType = "bytes"; type ReadyState = "closed" | "ended" | "open"; type RecordingState = "inactive" | "paused" | "recording"; type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"; diff --git a/node_modules/typescript/lib/lib.dom.iterable.d.ts b/node_modules/typescript/lib/lib.dom.iterable.d.ts index 4084aa2c1..2889a3a55 100644 --- a/node_modules/typescript/lib/lib.dom.iterable.d.ts +++ b/node_modules/typescript/lib/lib.dom.iterable.d.ts @@ -46,6 +46,10 @@ interface Cache { addAll(requests: Iterable): Promise; } +interface CanvasPath { + roundRect(x: number, y: number, w: number, h: number, radii?: number | DOMPointInit | Iterable): void; +} + interface CanvasPathDrawingStyles { setLineDash(segments: Iterable): void; } @@ -273,8 +277,8 @@ interface WEBGL_draw_buffers { interface WEBGL_multi_draw { multiDrawArraysInstancedWEBGL(mode: GLenum, firstsList: Int32Array | Iterable, firstsOffset: GLuint, countsList: Int32Array | Iterable, countsOffset: GLuint, instanceCountsList: Int32Array | Iterable, instanceCountsOffset: GLuint, drawcount: GLsizei): void; multiDrawArraysWEBGL(mode: GLenum, firstsList: Int32Array | Iterable, firstsOffset: GLuint, countsList: Int32Array | Iterable, countsOffset: GLuint, drawcount: GLsizei): void; - multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | Iterable, countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | Iterable, offsetsOffset: GLuint, instanceCountsList: Int32Array | Iterable, instanceCountsOffset: GLuint, drawcount: GLsizei): void; - multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | Iterable, countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | Iterable, offsetsOffset: GLuint, drawcount: GLsizei): void; + multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | Iterable, countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | Iterable, offsetsOffset: GLuint, instanceCountsList: Int32Array | Iterable, instanceCountsOffset: GLuint, drawcount: GLsizei): void; + multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | Iterable, countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | Iterable, offsetsOffset: GLuint, drawcount: GLsizei): void; } interface WebGL2RenderingContextBase { diff --git a/node_modules/typescript/lib/lib.es2015.promise.d.ts b/node_modules/typescript/lib/lib.es2015.promise.d.ts index 22ccea83d..c5aa961c3 100644 --- a/node_modules/typescript/lib/lib.es2015.promise.d.ts +++ b/node_modules/typescript/lib/lib.es2015.promise.d.ts @@ -41,7 +41,7 @@ interface PromiseConstructor { all(values: T): Promise<{ -readonly [P in keyof T]: Awaited }>; // see: lib.es2015.iterable.d.ts - // all(values: Iterable>): Promise; + // all(values: Iterable>): Promise[]>; /** * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved @@ -52,7 +52,7 @@ interface PromiseConstructor { race(values: T): Promise>; // see: lib.es2015.iterable.d.ts - // race(values: Iterable): Promise ? U : T>; + // race(values: Iterable>): Promise>; /** * Creates a new rejected promise for the provided reason. @@ -66,13 +66,18 @@ interface PromiseConstructor { * @returns A resolved promise. */ resolve(): Promise; - /** * Creates a new resolved promise for the provided value. * @param value A promise. * @returns A promise whose internal state matches the provided promise. */ - resolve(value: T | PromiseLike): Promise; + resolve(value: T): Promise>; + /** + * Creates a new resolved promise for the provided value. + * @param value A promise. + * @returns A promise whose internal state matches the provided promise. + */ + resolve(value: T | PromiseLike): Promise>; } declare var Promise: PromiseConstructor; diff --git a/node_modules/typescript/lib/lib.es2015.proxy.d.ts b/node_modules/typescript/lib/lib.es2015.proxy.d.ts index 6dbdf2443..34d6d66a3 100644 --- a/node_modules/typescript/lib/lib.es2015.proxy.d.ts +++ b/node_modules/typescript/lib/lib.es2015.proxy.d.ts @@ -98,7 +98,7 @@ interface ProxyHandler { * @param target The original object which is being proxied. * @param p The name or `Symbol` of the property to set. * @param receiver The object to which the assignment was originally directed. - * @returns `A `Boolean` indicating whether or not the property was set. + * @returns A `Boolean` indicating whether or not the property was set. */ set?(target: T, p: string | symbol, newValue: any, receiver: any): boolean; diff --git a/node_modules/typescript/lib/lib.es2015.reflect.d.ts b/node_modules/typescript/lib/lib.es2015.reflect.d.ts index 4bfce28a7..f5fe93725 100644 --- a/node_modules/typescript/lib/lib.es2015.reflect.d.ts +++ b/node_modules/typescript/lib/lib.es2015.reflect.d.ts @@ -26,6 +26,11 @@ declare namespace Reflect { * @param thisArgument The object to be used as the this object. * @param argumentsList An array of argument values to be passed to the function. */ + function apply( + target: (this: T, ...args: A) => R, + thisArgument: T, + argumentsList: Readonly, + ): R; function apply(target: Function, thisArgument: any, argumentsList: ArrayLike): any; /** @@ -35,6 +40,11 @@ declare namespace Reflect { * @param argumentsList An array of argument values to be passed to the constructor. * @param newTarget The constructor to be used as the `new.target` object. */ + function construct( + target: new (...args: A) => R, + argumentsList: Readonly, + newTarget?: new (...args: any) => any, + ): R; function construct(target: Function, argumentsList: ArrayLike, newTarget?: Function): any; /** @@ -61,7 +71,11 @@ declare namespace Reflect { * @param receiver The reference to use as the `this` value in the getter function, * if `target[propertyKey]` is an accessor property. */ - function get(target: object, propertyKey: PropertyKey, receiver?: any): any; + function get( + target: T, + propertyKey: P, + receiver?: unknown, + ): P extends keyof T ? T[P] : any; /** * Gets the own property descriptor of the specified object. @@ -69,7 +83,10 @@ declare namespace Reflect { * @param target Object that contains the property. * @param propertyKey The property name. */ - function getOwnPropertyDescriptor(target: object, propertyKey: PropertyKey): PropertyDescriptor | undefined; + function getOwnPropertyDescriptor( + target: T, + propertyKey: P, + ): TypedPropertyDescriptor

| undefined; /** * Returns the prototype of an object. @@ -111,6 +128,12 @@ declare namespace Reflect { * @param receiver The reference to use as the `this` value in the setter function, * if `target[propertyKey]` is an accessor property. */ + function set( + target: T, + propertyKey: P, + value: P extends keyof T ? T[P] : any, + receiver?: any, + ): boolean; function set(target: object, propertyKey: PropertyKey, value: any, receiver?: any): boolean; /** diff --git a/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts b/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts index 932087edd..67a26b76b 100644 --- a/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +++ b/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts @@ -239,9 +239,9 @@ interface String { match(matcher: { [Symbol.match](string: string): RegExpMatchArray | null; }): RegExpMatchArray | null; /** - * Replaces first match with string or all matches with RegExp. - * @param searchValue A string or RegExp search value. - * @param replaceValue A string containing the text to replace for match. + * Passes a string and {@linkcode replaceValue} to the `[Symbol.replace]` method on {@linkcode searchValue}. This method is expected to implement its own replacement algorithm. + * @param searchValue An object that supports searching for and replacing matches within a string. + * @param replaceValue The replacement text. */ replace(searchValue: { [Symbol.replace](string: string, replaceValue: string): string; }, replaceValue: string): string; diff --git a/node_modules/typescript/lib/lib.es2019.d.ts b/node_modules/typescript/lib/lib.es2019.d.ts index ce792fa56..822d31b30 100644 --- a/node_modules/typescript/lib/lib.es2019.d.ts +++ b/node_modules/typescript/lib/lib.es2019.d.ts @@ -23,3 +23,4 @@ and limitations under the License. /// /// /// +/// diff --git a/node_modules/typescript/lib/lib.es2019.intl.d.ts b/node_modules/typescript/lib/lib.es2019.intl.d.ts new file mode 100644 index 000000000..749de6a14 --- /dev/null +++ b/node_modules/typescript/lib/lib.es2019.intl.d.ts @@ -0,0 +1,25 @@ +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + + + +/// + + +declare namespace Intl { + interface DateTimeFormatPartTypesRegistry { + unknown: any + } +} diff --git a/node_modules/typescript/lib/lib.es2020.intl.d.ts b/node_modules/typescript/lib/lib.es2020.intl.d.ts index 1ae635b51..6172df795 100644 --- a/node_modules/typescript/lib/lib.es2020.intl.d.ts +++ b/node_modules/typescript/lib/lib.es2020.intl.d.ts @@ -103,7 +103,7 @@ declare namespace Intl { * * [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#locales_argument). */ - type LocalesArgument = UnicodeBCP47LocaleIdentifier | Locale | (UnicodeBCP47LocaleIdentifier | Locale)[] | undefined; + type LocalesArgument = UnicodeBCP47LocaleIdentifier | Locale | readonly (UnicodeBCP47LocaleIdentifier | Locale)[] | undefined; /** * An object with some or all of properties of `options` parameter diff --git a/node_modules/typescript/lib/lib.es5.d.ts b/node_modules/typescript/lib/lib.es5.d.ts index f97a75baf..4ccf6f3da 100644 --- a/node_modules/typescript/lib/lib.es5.d.ts +++ b/node_modules/typescript/lib/lib.es5.d.ts @@ -214,12 +214,6 @@ interface ObjectConstructor { */ seal(o: T): T; - /** - * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. - * @param a Object on which to lock the attributes. - */ - freeze(a: T[]): readonly T[]; - /** * Prevents the modification of existing property attributes and values, and prevents the addition of new properties. * @param f Object on which to lock the attributes. @@ -449,8 +443,8 @@ interface String { /** * Replaces text in a string, using a regular expression or search string. - * @param searchValue A string to search for. - * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + * @param searchValue A string or regular expression to search for. + * @param replaceValue A string containing the text to replace. When the {@linkcode searchValue} is a `RegExp`, all matches are replaced if the `g` flag is set (or only those matches at the beginning, if the `y` flag is also present). Otherwise, only the first match of {@linkcode searchValue} is replaced. */ replace(searchValue: string | RegExp, replaceValue: string): string; @@ -908,7 +902,17 @@ interface Date { interface DateConstructor { new(): Date; new(value: number | string): Date; - new(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; + /** + * Creates a new Date. + * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. + * @param monthIndex The month as a number between 0 and 11 (January to December). + * @param date The date as a number between 1 and 31. + * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. + * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. + * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. + * @param ms A number from 0 to 999 that specifies the milliseconds. + */ + new(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): Date; (): string; readonly prototype: Date; /** @@ -919,14 +923,15 @@ interface DateConstructor { /** * Returns the number of milliseconds between midnight, January 1, 1970 Universal Coordinated Time (UTC) (or GMT) and the specified date. * @param year The full year designation is required for cross-century date accuracy. If year is between 0 and 99 is used, then year is assumed to be 1900 + year. - * @param month The month as a number between 0 and 11 (January to December). + * @param monthIndex The month as a number between 0 and 11 (January to December). * @param date The date as a number between 1 and 31. * @param hours Must be supplied if minutes is supplied. A number from 0 to 23 (midnight to 11pm) that specifies the hour. * @param minutes Must be supplied if seconds is supplied. A number from 0 to 59 that specifies the minutes. * @param seconds Must be supplied if milliseconds is supplied. A number from 0 to 59 that specifies the seconds. * @param ms A number from 0 to 999 that specifies the milliseconds. */ - UTC(year: number, month: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + UTC(year: number, monthIndex: number, date?: number, hours?: number, minutes?: number, seconds?: number, ms?: number): number; + /** Returns the number of milliseconds elapsed since midnight, January 1, 1970 Universal Coordinated Time (UTC). */ now(): number; } @@ -941,6 +946,10 @@ interface RegExpMatchArray extends Array { * A copy of the search string. */ input?: string; + /** + * The first match. This will always be present because `null` will be returned if there are no matches. + */ + 0: string; } interface RegExpExecArray extends Array { @@ -952,6 +961,10 @@ interface RegExpExecArray extends Array { * A copy of the search string. */ input: string; + /** + * The first match. This will always be present because `null` will be returned if there are no matches. + */ + 0: string; } interface RegExp { @@ -1532,8 +1545,8 @@ interface Promise { */ type Awaited = T extends null | undefined ? T : // special case for `null | undefined` when not in `--strictNullChecks` mode - T extends object & { then(onfulfilled: infer F): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped - F extends ((value: infer V, ...args: any) => any) ? // if the argument to `then` is callable, extracts the first argument + T extends object & { then(onfulfilled: infer F, ...args: infer _): any } ? // `await` only unwraps object types with a callable `then`. Non-object types are not unwrapped + F extends ((value: infer V, ...args: infer _) => any) ? // if the argument to `then` is callable, extracts the first argument Awaited : // recursively unwrap the value never : // the argument to `then` was not callable T; // non-object or non-thenable diff --git a/node_modules/typescript/lib/lib.webworker.d.ts b/node_modules/typescript/lib/lib.webworker.d.ts index 2d7dfab96..70449930b 100644 --- a/node_modules/typescript/lib/lib.webworker.d.ts +++ b/node_modules/typescript/lib/lib.webworker.d.ts @@ -500,9 +500,18 @@ interface RTCEncodedVideoFrameMetadata { width?: number; } -interface ReadableStreamReadDoneResult { +interface ReadableStreamGetReaderOptions { + /** + * Creates a ReadableStreamBYOBReader and locks the stream to the new reader. + * + * This call behaves the same way as the no-argument variant, except that it only works on readable byte streams, i.e. streams which were constructed specifically with the ability to handle "bring your own buffer" reading. The returned BYOB reader provides the ability to directly read individual chunks from the stream via its read() method, into developer-supplied buffers, allowing more precise control over allocation. + */ + mode?: ReadableStreamReaderMode; +} + +interface ReadableStreamReadDoneResult { done: true; - value?: undefined; + value?: T; } interface ReadableStreamReadValueResult { @@ -658,6 +667,21 @@ interface Transformer { writableType?: undefined; } +interface UnderlyingByteSource { + autoAllocateChunkSize?: number; + cancel?: UnderlyingSourceCancelCallback; + pull?: (controller: ReadableByteStreamController) => void | PromiseLike; + start?: (controller: ReadableByteStreamController) => any; + type: "bytes"; +} + +interface UnderlyingDefaultSource { + cancel?: UnderlyingSourceCancelCallback; + pull?: (controller: ReadableStreamDefaultController) => void | PromiseLike; + start?: (controller: ReadableStreamDefaultController) => any; + type?: undefined; +} + interface UnderlyingSink { abort?: UnderlyingSinkAbortCallback; close?: UnderlyingSinkCloseCallback; @@ -667,17 +691,18 @@ interface UnderlyingSink { } interface UnderlyingSource { + autoAllocateChunkSize?: number; cancel?: UnderlyingSourceCancelCallback; pull?: UnderlyingSourcePullCallback; start?: UnderlyingSourceStartCallback; - type?: undefined; + type?: ReadableStreamType; } interface VideoColorSpaceInit { - fullRange?: boolean; - matrix?: VideoMatrixCoefficients; - primaries?: VideoColorPrimaries; - transfer?: VideoTransferCharacteristics; + fullRange?: boolean | null; + matrix?: VideoMatrixCoefficients | null; + primaries?: VideoColorPrimaries | null; + transfer?: VideoTransferCharacteristics | null; } interface VideoConfiguration { @@ -727,7 +752,7 @@ interface AbortController { /** Returns the AbortSignal object associated with this object. */ readonly signal: AbortSignal; /** Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. */ - // abort(): AbortSignal; - To be re-added in the future + abort(reason?: any): void; } declare var AbortController: { @@ -756,6 +781,7 @@ declare var AbortSignal: { prototype: AbortSignal; new(): AbortSignal; abort(reason?: any): AbortSignal; + timeout(milliseconds: number): AbortSignal; }; interface AbstractWorkerEventMap { @@ -872,6 +898,44 @@ declare var CacheStorage: { new(): CacheStorage; }; +interface CanvasCompositing { + globalAlpha: number; + globalCompositeOperation: GlobalCompositeOperation; +} + +interface CanvasDrawImage { + drawImage(image: CanvasImageSource, dx: number, dy: number): void; + drawImage(image: CanvasImageSource, dx: number, dy: number, dw: number, dh: number): void; + drawImage(image: CanvasImageSource, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void; +} + +interface CanvasDrawPath { + beginPath(): void; + clip(fillRule?: CanvasFillRule): void; + clip(path: Path2D, fillRule?: CanvasFillRule): void; + fill(fillRule?: CanvasFillRule): void; + fill(path: Path2D, fillRule?: CanvasFillRule): void; + isPointInPath(x: number, y: number, fillRule?: CanvasFillRule): boolean; + isPointInPath(path: Path2D, x: number, y: number, fillRule?: CanvasFillRule): boolean; + isPointInStroke(x: number, y: number): boolean; + isPointInStroke(path: Path2D, x: number, y: number): boolean; + stroke(): void; + stroke(path: Path2D): void; +} + +interface CanvasFillStrokeStyles { + fillStyle: string | CanvasGradient | CanvasPattern; + strokeStyle: string | CanvasGradient | CanvasPattern; + createConicGradient(startAngle: number, x: number, y: number): CanvasGradient; + createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient; + createPattern(image: CanvasImageSource, repetition: string | null): CanvasPattern | null; + createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient; +} + +interface CanvasFilters { + filter: string; +} + /** An opaque object describing a gradient. It is returned by the methods CanvasRenderingContext2D.createLinearGradient() or CanvasRenderingContext2D.createRadialGradient(). */ interface CanvasGradient { /** @@ -887,6 +951,19 @@ declare var CanvasGradient: { new(): CanvasGradient; }; +interface CanvasImageData { + createImageData(sw: number, sh: number, settings?: ImageDataSettings): ImageData; + createImageData(imagedata: ImageData): ImageData; + getImageData(sx: number, sy: number, sw: number, sh: number, settings?: ImageDataSettings): ImageData; + putImageData(imagedata: ImageData, dx: number, dy: number): void; + putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX: number, dirtyY: number, dirtyWidth: number, dirtyHeight: number): void; +} + +interface CanvasImageSmoothing { + imageSmoothingEnabled: boolean; + imageSmoothingQuality: ImageSmoothingQuality; +} + interface CanvasPath { arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void; arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void; @@ -897,6 +974,17 @@ interface CanvasPath { moveTo(x: number, y: number): void; quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void; rect(x: number, y: number, w: number, h: number): void; + roundRect(x: number, y: number, w: number, h: number, radii?: number | DOMPointInit | (number | DOMPointInit)[]): void; +} + +interface CanvasPathDrawingStyles { + lineCap: CanvasLineCap; + lineDashOffset: number; + lineJoin: CanvasLineJoin; + lineWidth: number; + miterLimit: number; + getLineDash(): number[]; + setLineDash(segments: number[]): void; } /** An opaque object describing a pattern, based on an image, a canvas, or a video, created by the CanvasRenderingContext2D.createPattern() method. */ @@ -910,6 +998,49 @@ declare var CanvasPattern: { new(): CanvasPattern; }; +interface CanvasRect { + clearRect(x: number, y: number, w: number, h: number): void; + fillRect(x: number, y: number, w: number, h: number): void; + strokeRect(x: number, y: number, w: number, h: number): void; +} + +interface CanvasShadowStyles { + shadowBlur: number; + shadowColor: string; + shadowOffsetX: number; + shadowOffsetY: number; +} + +interface CanvasState { + restore(): void; + save(): void; +} + +interface CanvasText { + fillText(text: string, x: number, y: number, maxWidth?: number): void; + measureText(text: string): TextMetrics; + strokeText(text: string, x: number, y: number, maxWidth?: number): void; +} + +interface CanvasTextDrawingStyles { + direction: CanvasDirection; + font: string; + fontKerning: CanvasFontKerning; + textAlign: CanvasTextAlign; + textBaseline: CanvasTextBaseline; +} + +interface CanvasTransform { + getTransform(): DOMMatrix; + resetTransform(): void; + rotate(angle: number): void; + scale(x: number, y: number): void; + setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void; + setTransform(transform?: DOMMatrix2DInit): void; + transform(a: number, b: number, c: number, d: number, e: number, f: number): void; + translate(x: number, y: number): void; +} + /** The Client interface represents an executable context such as a Worker, or a SharedWorker. Window clients are represented by the more-specific WindowClient. You can get Client/WindowClient objects from methods such as Clients.matchAll() and Clients.get(). */ interface Client { readonly frameType: FrameType; @@ -1316,6 +1447,13 @@ interface EXT_sRGB { interface EXT_shader_texture_lod { } +interface EXT_texture_compression_bptc { + readonly COMPRESSED_RGBA_BPTC_UNORM_EXT: GLenum; + readonly COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: GLenum; + readonly COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: GLenum; + readonly COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: GLenum; +} + interface EXT_texture_compression_rgtc { readonly COMPRESSED_RED_GREEN_RGTC2_EXT: GLenum; readonly COMPRESSED_RED_RGTC1_EXT: GLenum; @@ -1329,6 +1467,17 @@ interface EXT_texture_filter_anisotropic { readonly TEXTURE_MAX_ANISOTROPY_EXT: GLenum; } +interface EXT_texture_norm16 { + readonly R16_EXT: GLenum; + readonly R16_SNORM_EXT: GLenum; + readonly RG16_EXT: GLenum; + readonly RG16_SNORM_EXT: GLenum; + readonly RGB16_EXT: GLenum; + readonly RGB16_SNORM_EXT: GLenum; + readonly RGBA16_EXT: GLenum; + readonly RGBA16_SNORM_EXT: GLenum; +} + /** Events providing information related to errors in scripts or in files. */ interface ErrorEvent extends Event { readonly colno: number; @@ -1347,6 +1496,7 @@ declare var ErrorEvent: { interface Event { /** Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise. */ readonly bubbles: boolean; + /** @deprecated */ cancelBubble: boolean; /** Returns true or false depending on how event was initialized. Its return value does not always carry meaning, but true can indicate that part of the operation during which event was dispatched, can be canceled by invoking the preventDefault() method. */ readonly cancelable: boolean; @@ -2030,13 +2180,13 @@ declare var IDBObjectStore: { }; interface IDBOpenDBRequestEventMap extends IDBRequestEventMap { - "blocked": Event; + "blocked": IDBVersionChangeEvent; "upgradeneeded": IDBVersionChangeEvent; } /** Also inherits methods from its parents IDBRequest and EventTarget. */ interface IDBOpenDBRequest extends IDBRequest { - onblocked: ((this: IDBOpenDBRequest, ev: Event) => any) | null; + onblocked: ((this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any) | null; onupgradeneeded: ((this: IDBOpenDBRequest, ev: IDBVersionChangeEvent) => any) | null; addEventListener(type: K, listener: (this: IDBOpenDBRequest, ev: IDBOpenDBRequestEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; @@ -2292,6 +2442,7 @@ interface NavigatorID { readonly appName: string; /** @deprecated */ readonly appVersion: string; + /** @deprecated */ readonly platform: string; /** @deprecated */ readonly product: string; @@ -2361,6 +2512,16 @@ declare var NotificationEvent: { new(type: string, eventInitDict: NotificationEventInit): NotificationEvent; }; +interface OES_draw_buffers_indexed { + blendEquationSeparateiOES(buf: GLuint, modeRGB: GLenum, modeAlpha: GLenum): void; + blendEquationiOES(buf: GLuint, mode: GLenum): void; + blendFuncSeparateiOES(buf: GLuint, srcRGB: GLenum, dstRGB: GLenum, srcAlpha: GLenum, dstAlpha: GLenum): void; + blendFunciOES(buf: GLuint, src: GLenum, dst: GLenum): void; + colorMaskiOES(buf: GLuint, r: GLboolean, g: GLboolean, b: GLboolean, a: GLboolean): void; + disableiOES(target: GLenum, index: GLuint): void; + enableiOES(target: GLenum, index: GLuint): void; +} + /** The OES_element_index_uint extension is part of the WebGL API and adds support for gl.UNSIGNED_INT types to WebGLRenderingContext.drawElements(). */ interface OES_element_index_uint { } @@ -2406,10 +2567,57 @@ interface OVR_multiview2 { readonly MAX_VIEWS_OVR: GLenum; } -/** @deprecated this is not available in most browsers */ +interface OffscreenCanvasEventMap { + "contextlost": Event; + "contextrestored": Event; +} + interface OffscreenCanvas extends EventTarget { + /** + * These attributes return the dimensions of the OffscreenCanvas object's bitmap. + * + * They can be set, to replace the bitmap with a new, transparent black bitmap of the specified dimensions (effectively resizing it). + */ + height: number; + oncontextlost: ((this: OffscreenCanvas, ev: Event) => any) | null; + oncontextrestored: ((this: OffscreenCanvas, ev: Event) => any) | null; + /** + * These attributes return the dimensions of the OffscreenCanvas object's bitmap. + * + * They can be set, to replace the bitmap with a new, transparent black bitmap of the specified dimensions (effectively resizing it). + */ + width: number; + /** + * Returns an object that exposes an API for drawing on the OffscreenCanvas object. contextId specifies the desired API: "2d", "bitmaprenderer", "webgl", or "webgl2". options is handled by that API. + * + * This specification defines the "2d" context below, which is similar but distinct from the "2d" context that is created from a canvas element. The WebGL specifications define the "webgl" and "webgl2" contexts. [WEBGL] + * + * Returns null if the canvas has already been initialized with another context type (e.g., trying to get a "2d" context after getting a "webgl" context). + */ + getContext(contextId: OffscreenRenderingContextId, options?: any): OffscreenRenderingContext | null; + /** Returns a newly created ImageBitmap object with the image in the OffscreenCanvas object. The image in the OffscreenCanvas object is replaced with a new blank image. */ + transferToImageBitmap(): ImageBitmap; + addEventListener(type: K, listener: (this: OffscreenCanvas, ev: OffscreenCanvasEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; + addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; + removeEventListener(type: K, listener: (this: OffscreenCanvas, ev: OffscreenCanvasEventMap[K]) => any, options?: boolean | EventListenerOptions): void; + removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; +} + +declare var OffscreenCanvas: { + prototype: OffscreenCanvas; + new(width: number, height: number): OffscreenCanvas; +}; + +interface OffscreenCanvasRenderingContext2D extends CanvasCompositing, CanvasDrawImage, CanvasDrawPath, CanvasFillStrokeStyles, CanvasFilters, CanvasImageData, CanvasImageSmoothing, CanvasPath, CanvasPathDrawingStyles, CanvasRect, CanvasShadowStyles, CanvasState, CanvasText, CanvasTextDrawingStyles, CanvasTransform { + readonly canvas: OffscreenCanvas; + commit(): void; } +declare var OffscreenCanvasRenderingContext2D: { + prototype: OffscreenCanvasRenderingContext2D; + new(): OffscreenCanvasRenderingContext2D; +}; + /** This Canvas 2D API interface is used to declare a path that can then be used on a CanvasRenderingContext2D object. The path methods of the CanvasRenderingContext2D interface are also present on this interface, which gives you the convenience of being able to retain and replay your path whenever desired. */ interface Path2D extends CanvasPath { /** Adds to the path the path given by the argument. */ @@ -2553,6 +2761,7 @@ interface PermissionStatusEventMap { } interface PermissionStatus extends EventTarget { + readonly name: string; onchange: ((this: PermissionStatus, ev: Event) => any) | null; readonly state: PermissionState; addEventListener(type: K, listener: (this: PermissionStatus, ev: PermissionStatusEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; @@ -2664,6 +2873,7 @@ declare var PushSubscription: { /** Available only in secure contexts. */ interface PushSubscriptionOptions { readonly applicationServerKey: ArrayBuffer | null; + readonly userVisibleOnly: boolean; } declare var PushSubscriptionOptions: { @@ -2711,7 +2921,9 @@ declare var ReadableByteStreamController: { interface ReadableStream { readonly locked: boolean; cancel(reason?: any): Promise; + getReader(options: { mode: "byob" }): ReadableStreamBYOBReader; getReader(): ReadableStreamDefaultReader; + getReader(options?: ReadableStreamGetReaderOptions): ReadableStreamReader; pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; pipeTo(destination: WritableStream, options?: StreamPipeOptions): Promise; tee(): [ReadableStream, ReadableStream]; @@ -2719,11 +2931,13 @@ interface ReadableStream { declare var ReadableStream: { prototype: ReadableStream; + new(underlyingSource: UnderlyingByteSource, strategy?: { highWaterMark?: number }): ReadableStream; + new(underlyingSource: UnderlyingDefaultSource, strategy?: QueuingStrategy): ReadableStream; new(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; }; interface ReadableStreamBYOBReader extends ReadableStreamGenericReader { - read(view: ArrayBufferView): Promise>; + read(view: T): Promise>; releaseLock(): void; } @@ -2911,6 +3125,7 @@ interface ServiceWorkerGlobalScopeEventMap extends WorkerGlobalScopeEventMap { "notificationclick": NotificationEvent; "notificationclose": NotificationEvent; "push": PushEvent; + "pushsubscriptionchange": Event; } /** This ServiceWorker API interface represents the global execution context of a service worker. */ @@ -2924,6 +3139,7 @@ interface ServiceWorkerGlobalScope extends WorkerGlobalScope { onnotificationclick: ((this: ServiceWorkerGlobalScope, ev: NotificationEvent) => any) | null; onnotificationclose: ((this: ServiceWorkerGlobalScope, ev: NotificationEvent) => any) | null; onpush: ((this: ServiceWorkerGlobalScope, ev: PushEvent) => any) | null; + onpushsubscriptionchange: ((this: ServiceWorkerGlobalScope, ev: Event) => any) | null; readonly registration: ServiceWorkerRegistration; readonly serviceWorker: ServiceWorker; skipWaiting(): Promise; @@ -3340,8 +3556,8 @@ interface WEBGL_lose_context { interface WEBGL_multi_draw { multiDrawArraysInstancedWEBGL(mode: GLenum, firstsList: Int32Array | GLint[], firstsOffset: GLuint, countsList: Int32Array | GLsizei[], countsOffset: GLuint, instanceCountsList: Int32Array | GLsizei[], instanceCountsOffset: GLuint, drawcount: GLsizei): void; multiDrawArraysWEBGL(mode: GLenum, firstsList: Int32Array | GLint[], firstsOffset: GLuint, countsList: Int32Array | GLsizei[], countsOffset: GLuint, drawcount: GLsizei): void; - multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | GLint[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, instanceCountsList: Int32Array | GLsizei[], instanceCountsOffset: GLuint, drawcount: GLsizei): void; - multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | GLint[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, drawcount: GLsizei): void; + multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | GLsizei[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, instanceCountsList: Int32Array | GLsizei[], instanceCountsOffset: GLuint, drawcount: GLsizei): void; + multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | GLsizei[], countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | GLsizei[], offsetsOffset: GLuint, drawcount: GLsizei): void; } interface WebGL2RenderingContext extends WebGL2RenderingContextBase, WebGL2RenderingContextOverloads, WebGLRenderingContextBase { @@ -4739,35 +4955,39 @@ interface WebGLRenderingContextBase { getBufferParameter(target: GLenum, pname: GLenum): any; getContextAttributes(): WebGLContextAttributes | null; getError(): GLenum; + getExtension(extensionName: "ANGLE_instanced_arrays"): ANGLE_instanced_arrays | null; getExtension(extensionName: "EXT_blend_minmax"): EXT_blend_minmax | null; getExtension(extensionName: "EXT_color_buffer_float"): EXT_color_buffer_float | null; getExtension(extensionName: "EXT_color_buffer_half_float"): EXT_color_buffer_half_float | null; getExtension(extensionName: "EXT_float_blend"): EXT_float_blend | null; - getExtension(extensionName: "EXT_texture_filter_anisotropic"): EXT_texture_filter_anisotropic | null; getExtension(extensionName: "EXT_frag_depth"): EXT_frag_depth | null; - getExtension(extensionName: "EXT_shader_texture_lod"): EXT_shader_texture_lod | null; getExtension(extensionName: "EXT_sRGB"): EXT_sRGB | null; + getExtension(extensionName: "EXT_shader_texture_lod"): EXT_shader_texture_lod | null; + getExtension(extensionName: "EXT_texture_compression_bptc"): EXT_texture_compression_bptc | null; + getExtension(extensionName: "EXT_texture_compression_rgtc"): EXT_texture_compression_rgtc | null; + getExtension(extensionName: "EXT_texture_filter_anisotropic"): EXT_texture_filter_anisotropic | null; getExtension(extensionName: "KHR_parallel_shader_compile"): KHR_parallel_shader_compile | null; + getExtension(extensionName: "OES_element_index_uint"): OES_element_index_uint | null; + getExtension(extensionName: "OES_fbo_render_mipmap"): OES_fbo_render_mipmap | null; + getExtension(extensionName: "OES_standard_derivatives"): OES_standard_derivatives | null; + getExtension(extensionName: "OES_texture_float"): OES_texture_float | null; + getExtension(extensionName: "OES_texture_float_linear"): OES_texture_float_linear | null; + getExtension(extensionName: "OES_texture_half_float"): OES_texture_half_float | null; + getExtension(extensionName: "OES_texture_half_float_linear"): OES_texture_half_float_linear | null; getExtension(extensionName: "OES_vertex_array_object"): OES_vertex_array_object | null; getExtension(extensionName: "OVR_multiview2"): OVR_multiview2 | null; getExtension(extensionName: "WEBGL_color_buffer_float"): WEBGL_color_buffer_float | null; getExtension(extensionName: "WEBGL_compressed_texture_astc"): WEBGL_compressed_texture_astc | null; getExtension(extensionName: "WEBGL_compressed_texture_etc"): WEBGL_compressed_texture_etc | null; getExtension(extensionName: "WEBGL_compressed_texture_etc1"): WEBGL_compressed_texture_etc1 | null; + getExtension(extensionName: "WEBGL_compressed_texture_s3tc"): WEBGL_compressed_texture_s3tc | null; getExtension(extensionName: "WEBGL_compressed_texture_s3tc_srgb"): WEBGL_compressed_texture_s3tc_srgb | null; + getExtension(extensionName: "WEBGL_debug_renderer_info"): WEBGL_debug_renderer_info | null; getExtension(extensionName: "WEBGL_debug_shaders"): WEBGL_debug_shaders | null; + getExtension(extensionName: "WEBGL_depth_texture"): WEBGL_depth_texture | null; getExtension(extensionName: "WEBGL_draw_buffers"): WEBGL_draw_buffers | null; getExtension(extensionName: "WEBGL_lose_context"): WEBGL_lose_context | null; - getExtension(extensionName: "WEBGL_depth_texture"): WEBGL_depth_texture | null; - getExtension(extensionName: "WEBGL_debug_renderer_info"): WEBGL_debug_renderer_info | null; - getExtension(extensionName: "WEBGL_compressed_texture_s3tc"): WEBGL_compressed_texture_s3tc | null; - getExtension(extensionName: "OES_texture_half_float_linear"): OES_texture_half_float_linear | null; - getExtension(extensionName: "OES_texture_half_float"): OES_texture_half_float | null; - getExtension(extensionName: "OES_texture_float_linear"): OES_texture_float_linear | null; - getExtension(extensionName: "OES_texture_float"): OES_texture_float | null; - getExtension(extensionName: "OES_standard_derivatives"): OES_standard_derivatives | null; - getExtension(extensionName: "OES_element_index_uint"): OES_element_index_uint | null; - getExtension(extensionName: "ANGLE_instanced_arrays"): ANGLE_instanced_arrays | null; + getExtension(extensionName: "WEBGL_multi_draw"): WEBGL_multi_draw | null; getExtension(name: string): any; getFramebufferAttachmentParameter(target: GLenum, attachment: GLenum, pname: GLenum): any; getParameter(pname: GLenum): any; @@ -5893,20 +6113,31 @@ type ImageBitmapSource = CanvasImageSource | Blob | ImageData; type Int32List = Int32Array | GLint[]; type MessageEventSource = MessagePort | ServiceWorker; type NamedCurve = string; +type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext | WebGL2RenderingContext; type OnErrorEventHandler = OnErrorEventHandlerNonNull | null; type PerformanceEntryList = PerformanceEntry[]; type PushMessageDataInit = BufferSource | string; -type ReadableStreamController = ReadableStreamDefaultController; -type ReadableStreamReadResult = ReadableStreamReadValueResult | ReadableStreamReadDoneResult; -type ReadableStreamReader = ReadableStreamDefaultReader; +type ReadableStreamController = ReadableStreamDefaultController | ReadableByteStreamController; +type ReadableStreamReadResult = ReadableStreamReadValueResult | ReadableStreamReadDoneResult; +type ReadableStreamReader = ReadableStreamDefaultReader | ReadableStreamBYOBReader; type RequestInfo = Request | string; type TexImageSource = ImageBitmap | ImageData | OffscreenCanvas; type TimerHandler = string | Function; -type Transferable = ArrayBuffer | MessagePort | ImageBitmap; +type Transferable = OffscreenCanvas | ImageBitmap | MessagePort | ReadableStream | WritableStream | TransformStream | ArrayBuffer; type Uint32List = Uint32Array | GLuint[]; type VibratePattern = number | number[]; type XMLHttpRequestBodyInit = Blob | BufferSource | FormData | URLSearchParams | string; type BinaryType = "arraybuffer" | "blob"; +type CanvasDirection = "inherit" | "ltr" | "rtl"; +type CanvasFillRule = "evenodd" | "nonzero"; +type CanvasFontKerning = "auto" | "none" | "normal"; +type CanvasFontStretch = "condensed" | "expanded" | "extra-condensed" | "extra-expanded" | "normal" | "semi-condensed" | "semi-expanded" | "ultra-condensed" | "ultra-expanded"; +type CanvasFontVariantCaps = "all-petite-caps" | "all-small-caps" | "normal" | "petite-caps" | "small-caps" | "titling-caps" | "unicase"; +type CanvasLineCap = "butt" | "round" | "square"; +type CanvasLineJoin = "bevel" | "miter" | "round"; +type CanvasTextAlign = "center" | "end" | "left" | "right" | "start"; +type CanvasTextBaseline = "alphabetic" | "bottom" | "hanging" | "ideographic" | "middle" | "top"; +type CanvasTextRendering = "auto" | "geometricPrecision" | "optimizeLegibility" | "optimizeSpeed"; type ClientTypes = "all" | "sharedworker" | "window" | "worker"; type ColorGamut = "p3" | "rec2020" | "srgb"; type ColorSpaceConversion = "default" | "none"; @@ -5916,12 +6147,14 @@ type FileSystemHandleKind = "directory" | "file"; type FontFaceLoadStatus = "error" | "loaded" | "loading" | "unloaded"; type FontFaceSetLoadStatus = "loaded" | "loading"; type FrameType = "auxiliary" | "nested" | "none" | "top-level"; +type GlobalCompositeOperation = "color" | "color-burn" | "color-dodge" | "copy" | "darken" | "destination-atop" | "destination-in" | "destination-out" | "destination-over" | "difference" | "exclusion" | "hard-light" | "hue" | "lighten" | "lighter" | "luminosity" | "multiply" | "overlay" | "saturation" | "screen" | "soft-light" | "source-atop" | "source-in" | "source-out" | "source-over" | "xor"; type HdrMetadataType = "smpteSt2086" | "smpteSt2094-10" | "smpteSt2094-40"; type IDBCursorDirection = "next" | "nextunique" | "prev" | "prevunique"; type IDBRequestReadyState = "done" | "pending"; type IDBTransactionDurability = "default" | "relaxed" | "strict"; type IDBTransactionMode = "readonly" | "readwrite" | "versionchange"; type ImageOrientation = "flipY" | "none"; +type ImageSmoothingQuality = "high" | "low" | "medium"; type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki"; type KeyType = "private" | "public" | "secret"; type KeyUsage = "decrypt" | "deriveBits" | "deriveKey" | "encrypt" | "sign" | "unwrapKey" | "verify" | "wrapKey"; @@ -5930,12 +6163,15 @@ type MediaDecodingType = "file" | "media-source" | "webrtc"; type MediaEncodingType = "record" | "webrtc"; type NotificationDirection = "auto" | "ltr" | "rtl"; type NotificationPermission = "default" | "denied" | "granted"; +type OffscreenRenderingContextId = "2d" | "bitmaprenderer" | "webgl" | "webgl2" | "webgpu"; type PermissionName = "geolocation" | "notifications" | "persistent-storage" | "push" | "screen-wake-lock" | "xr-spatial-tracking"; type PermissionState = "denied" | "granted" | "prompt"; type PredefinedColorSpace = "display-p3" | "srgb"; type PremultiplyAlpha = "default" | "none" | "premultiply"; type PushEncryptionKeyName = "auth" | "p256dh"; type RTCEncodedVideoFrameType = "delta" | "empty" | "key"; +type ReadableStreamReaderMode = "byob"; +type ReadableStreamType = "bytes"; type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url"; type RequestCache = "default" | "force-cache" | "no-cache" | "no-store" | "only-if-cached" | "reload"; type RequestCredentials = "include" | "omit" | "same-origin"; diff --git a/node_modules/typescript/lib/lib.webworker.iterable.d.ts b/node_modules/typescript/lib/lib.webworker.iterable.d.ts index 8bd408336..d40f9e8c6 100644 --- a/node_modules/typescript/lib/lib.webworker.iterable.d.ts +++ b/node_modules/typescript/lib/lib.webworker.iterable.d.ts @@ -26,6 +26,14 @@ interface Cache { addAll(requests: Iterable): Promise; } +interface CanvasPath { + roundRect(x: number, y: number, w: number, h: number, radii?: number | DOMPointInit | Iterable): void; +} + +interface CanvasPathDrawingStyles { + setLineDash(segments: Iterable): void; +} + interface DOMStringList { [Symbol.iterator](): IterableIterator; } @@ -103,8 +111,8 @@ interface WEBGL_draw_buffers { interface WEBGL_multi_draw { multiDrawArraysInstancedWEBGL(mode: GLenum, firstsList: Int32Array | Iterable, firstsOffset: GLuint, countsList: Int32Array | Iterable, countsOffset: GLuint, instanceCountsList: Int32Array | Iterable, instanceCountsOffset: GLuint, drawcount: GLsizei): void; multiDrawArraysWEBGL(mode: GLenum, firstsList: Int32Array | Iterable, firstsOffset: GLuint, countsList: Int32Array | Iterable, countsOffset: GLuint, drawcount: GLsizei): void; - multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | Iterable, countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | Iterable, offsetsOffset: GLuint, instanceCountsList: Int32Array | Iterable, instanceCountsOffset: GLuint, drawcount: GLsizei): void; - multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | Iterable, countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | Iterable, offsetsOffset: GLuint, drawcount: GLsizei): void; + multiDrawElementsInstancedWEBGL(mode: GLenum, countsList: Int32Array | Iterable, countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | Iterable, offsetsOffset: GLuint, instanceCountsList: Int32Array | Iterable, instanceCountsOffset: GLuint, drawcount: GLsizei): void; + multiDrawElementsWEBGL(mode: GLenum, countsList: Int32Array | Iterable, countsOffset: GLuint, type: GLenum, offsetsList: Int32Array | Iterable, offsetsOffset: GLuint, drawcount: GLsizei): void; } interface WebGL2RenderingContextBase { diff --git a/node_modules/typescript/lib/pl/diagnosticMessages.generated.json b/node_modules/typescript/lib/pl/diagnosticMessages.generated.json index 8523a81e5..fc734cc2d 100644 --- a/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +++ b/node_modules/typescript/lib/pl/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "Abstrakcyjna metoda dostępu nie może mieć implementacji.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "Modyfikator dostępności nie może być używany z identyfikatorem prywatnym.", "An_accessor_cannot_have_type_parameters_1094": "Metoda dostępu nie może mieć parametrów typu.", + "An_accessor_property_cannot_be_declared_optional_1276": "Właściwość „accessor” nie może być zadeklarowana jako opcjonalna.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Deklaracja otaczającego modułu jest dozwolona tylko na najwyższym poziomie pliku.", "An_argument_for_0_was_not_provided_6210": "Nie podano argumentu dla elementu „{0}”.", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "Argument pasujący do tego wzorca powiązania nie został podany.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "Klasa „{0}” niepoprawnie implementuje klasę „{1}”. Czy chodziło o rozszerzenie „{1}” i odziedziczenie jego elementów członkowskich jako podklasy?", "Class_0_incorrectly_implements_interface_1_2420": "Klasa „{0}” zawiera niepoprawną implementację interfejsu „{1}”.", "Class_0_used_before_its_declaration_2449": "Klasa „{0}” została użyta przed zadeklarowaniem.", - "Class_constructor_may_not_be_a_generator_1360": "Konstruktor klas nie może być generatorem.", + "Class_constructor_may_not_be_a_generator_1368": "Konstruktor klas nie może być generatorem.", "Class_constructor_may_not_be_an_accessor_1341": "Konstruktor klas nie może być metodą dostępu.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "Deklaracja klasy nie może implementować listy przeciążeń dla elementu \"{0}\".", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "Deklaracje klas nie mogą mieć więcej niż jeden tag \"@augments\" lub \"@extends\".", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "Konwersja typu „{0}” na typ „{1}” może być błędem, ponieważ żaden z tych typów nie pokrywa się w wystarczającym stopniu z drugim. Jeśli było to zamierzone, najpierw przekonwertuj wyrażenie na typ „unknown”.", "Convert_0_to_1_in_0_95003": "Konwertuj element „{0}” na element „{1} w {0}”.", "Convert_0_to_mapped_object_type_95055": "Konwertuj element „{0}” na zamapowany typ obiektu", + "Convert_all_const_to_let_95102": "Konwertuj wszystkie elementy „const” na „let”", "Convert_all_constructor_functions_to_classes_95045": "Przekonwertuj wszystkie funkcje konstruktora na klasy", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Konwertuj wszystkie importy nieużywane jako wartość na importy dotyczące tylko typu", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Konwertuj wszystkie nieprawidłowe znaki na kod jednostki HTML", @@ -658,6 +660,8 @@ "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219": "Obsługa eksperymentalna dekoratorów to funkcja, która może ulec zmianie w nowszych wersjach. Ustaw opcję „experimentalDecorators” w pliku „tsconfig” lub „jsconfig”, aby usunąć to ostrzeżenie.", "Explicitly_specified_module_resolution_kind_Colon_0_6087": "Jawnie określony rodzaj rozpoznawania modułów: „{0}”.", "Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791": "Nie można wykonać potęgowania wartości typu „bigint”, chyba że opcja „target” ma wartość „es2016” lub nowszą.", + "Export_0_from_module_1_90059": "Eksportuj „{0}” z modułu „{1}”", + "Export_all_referenced_locals_90060": "Eksportuj wszystkie przywoływane zmienne lokalne", "Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203": "Nie można użyć przypisania eksportu, gdy są używane moduły języka ECMAScript. Zamiast tego rozważ użycie elementu „export default” lub innego formatu modułu.", "Export_assignment_is_not_supported_when_module_flag_is_system_1218": "Przypisanie eksportu nie jest obsługiwane, gdy flaga „--module” ma postać „system”.", "Export_declaration_conflicts_with_exported_declaration_of_0_2484": "Deklaracja eksportu powoduje konflikt z wyeksportowaną deklaracją „{0}”.", @@ -906,6 +910,7 @@ "Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650": "Określ, że element keyof ma zwracać tylko ciągi zamiast ciągów, liczb i symboli. Starsza opcja.", "Make_super_call_the_first_statement_in_the_constructor_90002": "Ustaw wywołanie „super()” jako pierwszą instrukcję w konstruktorze", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "Zmapowany typ obiektu niejawnie ma typ szablonu „any”.", + "Matched_0_condition_1_6403": "Dopasowano „{0}” warunku „{1}”.", "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457": "Dopasowywane domyślnie do wzorca dołączania „**/*”", "Matched_by_include_pattern_0_in_1_1407": "Zgodne z wzorcem dołączania „{0}” w elemencie „{1}”", "Member_0_implicitly_has_an_1_type_7008": "Dla składowej „{0}” niejawnie określono typ „{1}”.", @@ -919,7 +924,7 @@ "Method_not_implemented_95158": "Metoda nie jest zaimplementowana.", "Modifiers_cannot_appear_here_1184": "Modyfikatory nie mogą występować w tym miejscu.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "Moduł „{0}” może być importowany domyślnie tylko przy użyciu flagi „{1}”", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Nie można zaimportować modułu „{0}” przy użyciu tej konstrukcji. Specyfikator jest rozpoznawany tylko jako moduł ES, którego nie można zaimportować synchronicznie. Zamiast tego użyj importu dynamicznego.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Nie można zaimportować modułu „{0}” przy użyciu tej konstrukcji. Specyfikator jest rozpoznawany tylko jako moduł ES, którego nie można zaimportować za pomocą wywołania „require”. Zamiast tego użyj importu ECMAScript.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "Moduł „{0}” deklaruje element „{1}” lokalnie, ale jest on eksportowany jako „{2}”.", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "Moduł „{0}” deklaruje element „{1}” lokalnie, ale nie jest on eksportowany.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "Moduł „{0}” nie odwołuje się do typu, ale jest tutaj używany jako typ. Czy chodziło Ci o „typeof import(„{0}”)”?", @@ -1103,6 +1108,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Projekt „{0}” jest nieaktualny, ponieważ plik wyjściowy „{1}” nie istnieje", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "Projekt „{0}” jest nieaktualny, ponieważ jego dane wyjściowe zostały wygenerowane w wersji „{1}”, która różni się od bieżącej wersji „{2}”", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "Projekt „{0}” jest nieaktualny, ponieważ dane wyjściowe jego zależności „{1}” uległy zmianie", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "Projekt „{0}” jest nieaktualny, ponieważ wystąpił błąd podczas odczytywania pliku „{1}”", "Project_0_is_up_to_date_6361": "Projekt „{0}” jest aktualny", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "Projekt „{0}” jest aktualny, ponieważ najnowsze dane wejściowe „{1}” są starsze niż dane wyjściowe „{2}”", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "Projekt „{0}” jest aktualny, ale musi zaktualizować sygnatury czasowe plików wyjściowych, które są starsze niż pliki wejściowe", @@ -1110,6 +1116,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Odwołania do projektu nie mogą tworzyć grafu kołowego. Wykryto cykl: {0}", "Projects_6255": "Projekty", "Projects_in_this_build_Colon_0_6355": "Projekty w tej kompilacji: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "Właściwości z modyfikatorem „accessor” są dostępne tylko w przypadku określania wartości docelowej ECMAScript 2015 lub nowszej.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "Właściwości \"{0}\" nie może mieć inicjatora, ponieważ jest oznaczona jako abstrakcyjna.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "Właściwość „{0}” pochodzi z sygnatury indeksu, dlatego należy uzyskiwać do niej dostęp za pomocą elementu [„{0}”].", "Property_0_does_not_exist_on_type_1_2339": "Właściwość „{0}” nie istnieje w typie „{1}”.", @@ -1216,6 +1223,7 @@ "Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "Znaleziono rozwiązanie dla modułu „{0}” w pamięci podręcznej z lokalizacji „{1}”.", "Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241": "Znaleziono rozwiązanie dla dyrektywy odwołania do typu „{0}” w pamięci podręcznej z lokalizacji „{1}”.", "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195": "Rozwiązuj elementy „keyof” tylko do nazw właściwości mających jako wartość ciągi (nie liczby czy symbole).", + "Resolving_in_0_mode_with_conditions_1_6402": "Rozpoznawanie w trybie {0} z warunkami {1}.", "Resolving_module_0_from_1_6086": "======== Rozpoznawanie modułu „{0}” na podstawie „{1}”. ========", "Resolving_module_name_0_relative_to_base_url_1_2_6094": "Rozpoznawanie nazwy modułu „{0}” względem podstawowego adresu URL „{1}” — „{2}”.", "Resolving_real_path_for_0_result_1_6130": "Rozpoznawanie rzeczywistej ścieżki elementu ƒ„{0}”, wynik: „{1}”.", @@ -1272,6 +1280,7 @@ "Root_file_specified_for_compilation_1427": "Plik główny określony na potrzeby kompilacji", "STRATEGY_6039": "STRATEGIA", "Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642": "Zapisuj pliki tsbuildinfo, aby umożliwić przyrostową kompilację projektów.", + "Saw_non_matching_condition_0_6405": "Wyświetlono niezgodny warunek „{0}”.", "Scoped_package_detected_looking_in_0_6182": "Wykryto pakiet w zakresie, wyszukiwanie w „{0}”", "Selection_is_not_a_valid_statement_or_statements_95155": "Wybór nie jest prawidłową instrukcją ani instrukcjami", "Selection_is_not_a_valid_type_node_95133": "Wybór nie jest prawidłowym węzłem typu", @@ -1385,6 +1394,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "Zawierająca funkcja strzałki przechwytuje wartość globalną parametru „this”.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "Treść zawierającej funkcji lub modułu jest za duża do analizy przepływu sterowania.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "Bieżący plik jest modułem CommonJS i nie może używać elementu „await” na najwyższym poziomie.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "Bieżący plik jest modułem CommonJS, którego importy będą generować wywołania „require”; jednak przywoływany plik jest modułem ECMAScript i nie można go zaimportować za pomocą wywołania „require”. Zamiast tego rozważ zapisanie dynamicznego wywołania „import(\"{0}\")”.", "The_current_host_does_not_support_the_0_option_5001": "Bieżący host nie obsługuje opcji „{0}”.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "W tym miejscu zdefiniowano deklarację elementu „{0}”, której prawdopodobnie zamierzano użyć", "The_declaration_was_marked_as_deprecated_here_2798": "Deklaracja została oznaczona jako przestarzała w tym miejscu.", @@ -1422,7 +1432,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "Lewa strona operacji arytmetycznej musi być typu „any”, „number”, „bigint” lub typu wyliczeniowego.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "Lewa strona wyrażenia przypisania nie może być opcjonalnym dostępem do właściwości.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "Lewa strona wyrażenia przypisania musi być zmienną lub dostępem do właściwości.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "Lewa strona wyrażenia „in” musi być identyfikatorem prywatnym lub typem „any”, „string”, „number” lub „symbol”.", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "Lewa strona wyrażenia „instanceof” musi być typu „any”, typu obiektu lub parametrem typu.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "Ustawienia regionalne używane przy wyświetlaniu komunikatów użytkownikowi (np. „pl-pl”)", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "Maksymalna głębokość zależności na potrzeby wyszukiwania w elemencie node_modules i ładownia plików JavaScript.", @@ -1443,7 +1452,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "Zwracany typ funkcji lub metody asynchronicznej musi być globalnym typem Promise. Czy chodziło Ci o typ „Promise<{0}>”?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "Prawa strona instrukcji „for...in” musi zawierać typ „any”, typ obiektu lub parametr typu, a tutaj ma typ „{0}”.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "Prawa strona operacji arytmetycznej musi być typu „any”, „number”, „bigint” lub typu wyliczeniowego.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "Typ pierwotny nie może znajdować się po prawej stronie wyrażenia „in”.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "Prawa strona wyrażenia „instanceof” musi być typu „any” lub typu, który można przypisać do typu interfejsu „Function”.", "The_root_value_of_a_0_file_must_be_an_object_5092": "Wartość katalogu głównego pliku „{0}” musi być obiektem.", "The_shadowing_declaration_of_0_is_defined_here_18017": "Deklaracja przesłaniania „{0}” jest zdefiniowana tutaj", @@ -1464,13 +1472,15 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "Typ zwracany przez metodę „{0}()” iteratora musi mieć właściwość „value”.", "The_types_of_0_are_incompatible_between_these_types_2200": "Typy elementu „{0}” są niezgodne między tymi typami.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "Typy zwrócone przez element „{0}” są niezgodne między tymi typami.", + "The_value_0_cannot_be_used_here_18050": "W tym miejscu nie można użyć wartości „{0}”.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "Deklaracja zmiennej instrukcji „for...in” nie może mieć inicjatora.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "Deklaracja zmiennej instrukcji „for...of” nie może mieć inicjatora.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "Instrukcja „with” nie jest obsługiwana. Wszystkie symbole w bloku „with” będą mieć typ „any”.", "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "Element prop „{0}” tego tagu JSX oczekuje pojedynczego elementu podrzędnego typu „{1}”, ale podano wiele elementów podrzędnych.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "Element prop „{0}” tego tagu JSX oczekuje typu „{1}”, który wymaga wielu elementów podrzędnych, ale podano tylko jeden element podrzędny.", + "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "To porównanie wydaje się niezamierzone, ponieważ typy „{0}” i „{1}” nie nakładają się na siebie.", + "This_condition_will_always_return_0_2845": "Ten warunek będzie zawsze zwracać wartość „{0}”.", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "Ten warunek zawsze będzie zwracać wartość „{0}”, ponieważ język JavaScript porównuje obiekty według odwołania, a nie wartości.", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "Ten warunek będzie zawsze zwracał element „{0}”, ponieważ typy „{1}” i „{2}” nie nakładają się.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Ten warunek będzie zawsze zwracać wartość true, ponieważ wartość '{0}' jest zawsze prawdziwa.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "Ten warunek będzie zawsze zwracał wartość true, ponieważ funkcja jest zawsze zdefiniowana. Czy chcesz wywołać ją zamiast tego?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Ta funkcja konstruktora może zostać przekonwertowana na deklarację klasy.", @@ -1491,7 +1501,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Ten element członkowski musi mieć modyfikator „override”, ponieważ przesłania on element członkowski w klasie podstawowej „{0}”.", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Ten element członkowski musi mieć modyfikator „override”, ponieważ zastępuje metodę abstrakcyjną zadeklarowaną w klasie podstawowej „{0}”.", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "Do tego modułu można odwoływać się tylko za pomocą importów/eksportów języka ECMAScript, włączając flagę „{0}” i odwołując się do jego eksportu domyślnego.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Ten moduł jest zadeklarowany przy użyciu składni „export =” i może być używany tylko z importem domyślnym, gdy jest używana flaga „{0}”.", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Ten moduł jest zadeklarowany przy użyciu składni „export =” i może być używany tylko z importem domyślnym, gdy jest używana flaga „{0}”.", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Ta sygnatura przeciążenia nie jest zgodna z jej sygnaturą implementacji.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Ten parametr nie jest dozwolony w dyrektywie „use strict”.", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "Ta właściwość parametru musi mieć komentarz JSDoc z tagiem „@override”, ponieważ zastępuje składową w klasie bazowej „{0}”.", @@ -1504,6 +1514,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Ta składnia wymaga zaimportowanego pomocnika o nazwie „{1}” z parametrami {2}, który nie jest zgodny z tym w elemencie „{0}”. Rozważ uaktualnienie wersji elementu „{0}”.", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Ten parametr typu może wymagać ograniczenia „rozszerzeń{0}”.", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "To użycie elementu „import” jest nieprawidłowe. Wywołania „import()” mogą być zapisywane, ale muszą mieć nawiasy i nie mogą mieć argumentów typu.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Aby przekonwertować ten plik na moduł ECMAScript, dodaj pole „\"type\": \"module\"” do „{0}”.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Aby przekonwertować ten plik na moduł ECMAScript, zmień rozszerzenie jego pliku na „{0}” lub dodaj pole „\"type\": \"module\"” do „{1}”.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Aby przekonwertować ten plik na moduł ECMAScript, zmień rozszerzenie jego pliku na „{0}” lub utwórz lokalny plik package.json z polem „{ \"type\": \"module\" }\".", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Aby przekonwertować ten plik na moduł ECMAScript, utwórz lokalny plik package.json z polem „{ \"type\": \"module\" }\".", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "Wyrażenia „await” najwyższego poziomu są dozwolone tylko wtedy, gdy opcja „module” jest ustawiona na wartość „es2022”, „esnext”, „system”, „node16” lub „nodenext”, a opcja „target” jest ustawiona na wartość „es2017” lub wyższą.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": "Deklaracje najwyższego poziomu w plikach .d.ts muszą rozpoczynać się od modyfikatora „declare” lub „export”.", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "Pętle najwyższego poziomu „for await” są dozwolone tylko wtedy, gdy opcja „module” jest ustawiona na wartość „es2022”, „esnext”, „system”, „node16” lub „nodenext”, a opcja „target” jest ustawiona na wartość „es2017” lub wyższą.", @@ -1519,6 +1533,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "Typu „{0}” nie można używać jako typu indeksu.", "Type_0_cannot_be_used_to_index_type_1_2536": "Typu „{0}” nie można użyć do indeksowania typu „{1}”.", "Type_0_does_not_satisfy_the_constraint_1_2344": "Typ „{0}” nie spełnia warunków ograniczenia „{1}”.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "Typ „{0}” nie spełnia oczekiwanego typu „{1}”.", "Type_0_has_no_call_signatures_2757": "Typ „{0}” nie ma sygnatur wywołania.", "Type_0_has_no_construct_signatures_2761": "Typ „{0}” nie ma sygnatur konstrukcji.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "Typ „{0}” nie ma pasującej sygnatury indeksu dla typu „{1}”.", @@ -1540,6 +1555,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "Nie można przypisać typu \"{0}\" do typu \"{1}\" o wartości \"exactOptionalPropertyTypes: true\". Rozważ dodanie elementu \"undefined\" do typu elementu docelowego.", "Type_0_is_not_comparable_to_type_1_2678": "Typu „{0}” nie można porównać z typem „{1}”.", "Type_0_is_not_generic_2315": "Typ „{0}” nie jest ogólny.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "Typ „{0}” może reprezentować wartość pierwotną, co nie jest dozwolone jako prawy operand operatora „in”.", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Typ „{0}” musi zawierać metodę „[Symbol.asyncIterator]()” zwracającą iterator asynchroniczny.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Typ „{0}” musi zawierać metodę „[Symbol.iterator]()” zwracającą iterator.", "Type_0_provides_no_match_for_the_signature_1_2658": "Typ „{0}” nie udostępnia dopasowania dla sygnatury „{1}”.", @@ -1596,6 +1612,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== Dyrektywa odwołania do typu „{0}” nie została rozpoznana. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== Dyrektywa odwołania do typu „{0}” została pomyślnie rozpoznana jako „{1}”, podstawowe: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== Dyrektywa odwołania do typu „{0}” została pomyślnie rozpoznana jako „{1}” z identyfikatorem pakietu „{2}”, podstawowe: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "Wyrażeń asercji typu można używać tylko w plikach TypeScript.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "Typy nie mogą występować w deklaracjach eksportu w plikach JavaScript.", "Types_have_separate_declarations_of_a_private_property_0_2442": "Typy mają osobne deklaracje właściwości prywatnej „{0}”.", "Types_of_construct_signatures_are_incompatible_2419": "Typy sygnatur konstrukcji są niezgodne.", @@ -1637,9 +1654,12 @@ "Updating_output_of_project_0_6373": "Trwa aktualizowanie danych wyjściowych projektu „{0}”...", "Updating_output_timestamps_of_project_0_6359": "Trwa aktualizowanie sygnatury czasowej danych wyjściowych projektu „{0}”...", "Updating_unchanged_output_timestamps_of_project_0_6371": "Trwa aktualizowanie niezmienionych sygnatur czasowych danych wyjściowych projektu „{0}”...", + "Use_0_95174": "Użyj „{0}”.", + "Use_Number_isNaN_in_all_conditions_95175": "Użyj wartości „Number.isNaN” we wszystkich warunkach.", "Use_element_access_for_0_95145": "Użyj dostępu do elementu w przypadku elementu „{0}”", "Use_element_access_for_all_undeclared_properties_95146": "Użyj dostępu do elementu w przypadku wszystkich niezadeklarowanych właściwości.", "Use_synthetic_default_member_95016": "Użyj syntetycznej składowej „default”.", + "Using_0_subpath_1_with_target_2_6404": "Używanie „{0}” ścieżki podrzędnej „{1}” z elementem docelowym „{2}”.", "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "Używanie ciągu w instrukcji „for...of” jest obsługiwane tylko w języku ECMAScript 5 lub nowszym.", "Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915": "Użycie elementu --build, -b sprawi, że narzędzie tsc będzie zachowywało się bardziej jak orkiestrator kompilacji niż kompilator. Ta opcja jest wykorzystywana do wyzwalania kompilacji projektów złożonych, o których dowiesz się więcej na stronie {0}", "Using_compiler_options_of_project_reference_redirect_0_6215": "Using compiler options of project reference redirect '{0}'.", @@ -1717,6 +1737,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "„{0}” nie jest prawidłową metawłaściwością słowa kluczowego „{1}”. Czy miał to być element „{2}”?", "_0_is_not_allowed_as_a_parameter_name_1390": "„{0}” jest niedozwolone jako nazwa parametru.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "Element „{0}” nie jest dozwolony jako nazwa deklaracji zmiennej.", + "_0_is_of_type_unknown_18046": "Element „{0}” jest typu „nieznany”.", + "_0_is_possibly_null_18047": "Element „{0}” prawdopodobnie ma wartość „null”.", + "_0_is_possibly_null_or_undefined_18049": "Element „{0}” prawdopodobnie ma wartość „null” lub jest „niezdefiniowany”.", + "_0_is_possibly_undefined_18048": "Element „{0}” jest prawdopodobnie „niezdefiniowany”.", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "Element „{0}” jest przywoływany bezpośrednio lub pośrednio w jego własnym wyrażeniu podstawowym.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "Element „{0}” jest przywoływany bezpośrednio lub pośrednio w jego własnej adnotacji typu.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "Element „{0}” został określony więcej niż raz, dlatego to użycie zostanie przesłonięte.", @@ -1752,6 +1776,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "Dla elementu „{0}” bez adnotacji zwracanego typu niejawnie określono zwracany typ „{1}”.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "Dla elementu „{0}” bez adnotacji zwracanego typu niejawnie określono zwracany typ „{1}”.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "Modyfikator „abstract” może być stosowany jedynie w przypadku deklaracji klasy, metody lub właściwości.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "Modyfikator „accessor” może występować tylko w deklaracji właściwości.", "and_here_6204": "i tutaj.", "arguments_cannot_be_referenced_in_property_initializers_2815": "w inicjatorach właściwości nie można odwoływać się do \"arguments\".", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "„auto”: Traktuj pliki za pomocą importów, eksportów, import.meta, jsx (z jsx: react-jsx) lub formatu esm (z modułem: node16+) jako moduły.", diff --git a/node_modules/typescript/lib/protocol.d.ts b/node_modules/typescript/lib/protocol.d.ts index 44e76da50..a2a5eacbd 100644 --- a/node_modules/typescript/lib/protocol.d.ts +++ b/node_modules/typescript/lib/protocol.d.ts @@ -501,9 +501,16 @@ declare namespace ts.server.protocol { arguments: OrganizeImportsRequestArgs; } type OrganizeImportsScope = GetCombinedCodeFixScope; + const enum OrganizeImportsMode { + All = "All", + SortAndCombine = "SortAndCombine", + RemoveUnused = "RemoveUnused" + } interface OrganizeImportsRequestArgs { scope: OrganizeImportsScope; + /** @deprecated Use `mode` instead */ skipDestructiveCodeActions?: boolean; + mode?: OrganizeImportsMode; } interface OrganizeImportsResponse extends Response { body: readonly FileCodeEdits[]; @@ -853,12 +860,14 @@ declare namespace ts.server.protocol { command: CommandTypes.References; } interface ReferencesResponseItem extends FileSpanWithContext { - /** Text of line containing the reference. Including this - * with the response avoids latency of editor loading files - * to show text of reference line (the server already has - * loaded the referencing files). + /** + * Text of line containing the reference. Including this + * with the response avoids latency of editor loading files + * to show text of reference line (the server already has loaded the referencing files). + * + * If {@link UserPreferences.disableLineTextInReferences} is enabled, the property won't be filled */ - lineText: string; + lineText?: string; /** * True if reference is a write location, false otherwise. */ @@ -2704,6 +2713,10 @@ declare namespace ts.server.protocol { readonly includeInlayFunctionLikeReturnTypeHints?: boolean; readonly includeInlayEnumMemberValueHints?: boolean; readonly autoImportFileExcludePatterns?: string[]; + /** + * Indicates whether {@link ReferencesResponseItem.lineText} is supported. + */ + readonly disableLineTextInReferences?: boolean; } interface CompilerOptions { allowJs?: boolean; @@ -2924,6 +2937,8 @@ declare namespace ts.server.protocol { * interface Y { foo:number; } */ memberVariableElement = "property", + /** class X { [public|private]* accessor foo: number; } */ + memberAccessorVariableElement = "accessor", /** * class X { constructor() { } } * class X { static { } } diff --git a/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json b/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json index 269fbc9d6..cec13e7f8 100644 --- a/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +++ b/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "Um acessador abstrato não pode ter uma implementação.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "Não é possível usar um modificador de acessibilidade com um identificador privado.", "An_accessor_cannot_have_type_parameters_1094": "Um acessador não pode ter parâmetros de tipo.", + "An_accessor_property_cannot_be_declared_optional_1276": "Uma propriedade 'acessador' não pode ser declarada opcional.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Uma declaração de módulo de ambiente só é permitida no nível superior em um arquivo.", "An_argument_for_0_was_not_provided_6210": "Não foi fornecido um argumento para '{0}'.", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "Não foi fornecido um argumento correspondente a esse padrão de associação.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "A classe '{0}' implementa incorretamente a classe '{1}'. Você pretendia estender '{1}' e herdar seus membros como uma subclasse?", "Class_0_incorrectly_implements_interface_1_2420": "A classe '{0}' implementa incorretamente a interface '{1}'.", "Class_0_used_before_its_declaration_2449": "Classe '{0}' usada antes de sua declaração.", - "Class_constructor_may_not_be_a_generator_1360": "O construtor de classe não pode ser um gerador.", + "Class_constructor_may_not_be_a_generator_1368": "O construtor de classe não pode ser um gerador.", "Class_constructor_may_not_be_an_accessor_1341": "O construtor de classe não pode ser um acessador.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "A declaração da classe não pode implementar a lista de sobrecarga para '{0}'.", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "As declarações de classe não podem ter mais de uma marca '@augments' ou '@extends'.", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "A conversão do tipo '{0}' para o tipo '{1}' pode ser um erro porque nenhum tipo está suficientemente sobreposto ao outro. Se isso era intencional, converta a expressão para 'unknown' primeiro.", "Convert_0_to_1_in_0_95003": "Converter '{0}' em '{1} em {0}'", "Convert_0_to_mapped_object_type_95055": "Converter '{0}' para o tipo de objeto mapeado", + "Convert_all_const_to_let_95102": "Converta todos os 'const' para 'let'", "Convert_all_constructor_functions_to_classes_95045": "Converter todas as funções de construtor em classes", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Converter todas as importações não usadas como um valor para importações somente de tipo", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Converter todos os caracteres inválidos em código de entidade HTML", @@ -658,6 +660,8 @@ "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219": "O suporte experimental de decorador é um recurso que está sujeito a alterações em uma liberação futura. Configure a opção 'experimentalDecorators' em seu 'tsconfig' ou 'jsconfig' para remover este aviso.", "Explicitly_specified_module_resolution_kind_Colon_0_6087": "Tipo de resolução de módulo especificado explicitamente: '{0}'.", "Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791": "A exponenciação não pode ser executada nos valores 'bigint', a menos que a opção 'target' esteja definida como 'es2016' ou posterior.", + "Export_0_from_module_1_90059": "Exportar '{0}' do módulo '{1}'", + "Export_all_referenced_locals_90060": "Exportar todos os locais referenciados", "Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203": "Não é possível usar a atribuição de exportação durante o direcionamento para módulos de ECMAScript. Use a 'exportação padrão' ou outro formato de módulo em vez disso.", "Export_assignment_is_not_supported_when_module_flag_is_system_1218": "A atribuição de exportação não tem suporte quando o sinalizador '--module' é 'system'.", "Export_declaration_conflicts_with_exported_declaration_of_0_2484": "Exportar conflitos de declaração com declaração exportada de '{0}'.", @@ -906,6 +910,7 @@ "Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650": "Fazer com que o keyof retorne apenas cadeias de caracteres, números ou símbolos. Opção herdada.", "Make_super_call_the_first_statement_in_the_constructor_90002": "Tornar a chamada 'super()' a primeira instrução no construtor", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "O tipo de objeto mapeado implicitamente tem um tipo de modelo 'any'.", + "Matched_0_condition_1_6403": "'{0}' correspondente à condição '{1}'.", "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457": "Correspondido por padrão de inclusão padrão '**/*'", "Matched_by_include_pattern_0_in_1_1407": "Correspondência pelo padrão de inclusão '{0}' em '{1}'", "Member_0_implicitly_has_an_1_type_7008": "O membro '{0}' implicitamente tem um tipo '{1}'.", @@ -919,7 +924,7 @@ "Method_not_implemented_95158": "Método não implementado.", "Modifiers_cannot_appear_here_1184": "Modificadores não podem aparecer aqui.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "O módulo '{0}' só pode ser importado por padrão usando o sinalizador '{1}'", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Módulo '{0}' não pode ser importado usando esta constructo. O especificador só resolve para um módulo ES, que não pode ser importado de forma síncrona. Em vez disso, use a importação dinâmica.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "O módulo '{0}' não pode ser importado usando esta construção. O especificador resolve apenas para um módulo ES, que não pode ser importado com 'require'. Em vez disso, use uma importação ECMAScript.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "O módulo '{0}' declara '{1}' localmente, mas é exportado como '{2}'.", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "O módulo '{0}' declara '{1}' localmente, mas não é exportado.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "O módulo '{0}' não faz referência a um tipo, mas é usado como um tipo aqui. Você quis dizer 'typeof import('{0}')'?", @@ -1103,6 +1108,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "O projeto '{0}' está desatualizado porque o arquivo de saída '{1}' não existe", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "O projeto '{0}' está desatualizado porque a saída foi gerada com a versão '{1}' que difere da versão atual '{2}'", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "O projeto '{0}' está desatualizado porque a saída de sua dependência '{1}' foi alterada", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "O projeto '{0}' está desatualizado porque ocorreu um erro ao ler o arquivo '{1}'", "Project_0_is_up_to_date_6361": "O projeto '{0}' está atualizado", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "O projeto '{0}' está atualizado porque a entrada mais recente '{1}' é mais antiga que a saída '{2}'", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "O projeto '{0}' está atualizado, mas precisa atualizar os registros de data e hora dos arquivos de saída mais antigos que os arquivos de entrada", @@ -1110,6 +1116,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Referências de projeto não podem formar um gráfico circular. Ciclo detectado: {0}", "Projects_6255": "Projetos", "Projects_in_this_build_Colon_0_6355": "Projetos neste build: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "Propriedades com o modificador 'acessador' estão disponíveis somente quando o alvo é ECMAScript 2015 e superior.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "A propriedade '{0}' não pode ter um inicializador, pois está marcado como abstrato.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "A propriedade '{0}' vem de uma assinatura de índice, portanto, ela precisa ser acessada com ['{0}'].", "Property_0_does_not_exist_on_type_1_2339": "A propriedade '{0}' não existe no tipo '{1}'.", @@ -1216,6 +1223,7 @@ "Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "A resolução para o módulo '{0}' foi encontrada no cache do local '{1}'.", "Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241": "A resolução para a diretiva de referência de tipo '{0}' foi encontrada no cache a partir do local '{1}'.", "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195": "Resolva 'keyof' somente para nomes de propriedades com valores de cadeia de caracteres (sem números nem símbolos).", + "Resolving_in_0_mode_with_conditions_1_6402": "Resolvendo no modo {0} com condições {1}.", "Resolving_module_0_from_1_6086": "======== Resolvendo módulo '{0}' de '{1}'. ========", "Resolving_module_name_0_relative_to_base_url_1_2_6094": "Resolvendo nome de módulo '{0}' relativo à URL base '{1}' - '{2}'.", "Resolving_real_path_for_0_result_1_6130": "Resolvendo o caminho real de '{0}', resultado '{1}'.", @@ -1272,6 +1280,7 @@ "Root_file_specified_for_compilation_1427": "Arquivo raiz especificado para compilação", "STRATEGY_6039": "ESTRATÉGIA", "Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642": "Salvar arquivos .tsbuildinfo para permitir a compilação incremental de projetos.", + "Saw_non_matching_condition_0_6405": "Viu condição de não correspondência '{0}'.", "Scoped_package_detected_looking_in_0_6182": "Pacote com escopo detectado, procurando no '{0}'", "Selection_is_not_a_valid_statement_or_statements_95155": "A seleção não é uma instrução ou instruções válidas", "Selection_is_not_a_valid_type_node_95133": "A seleção não é um nó de tipo válido", @@ -1385,6 +1394,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "A função de seta contida captura o valor global de 'this'.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "O corpo da função ou do módulo contido é muito grande para a análise de fluxo de controle.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "O arquivo atual é um módulo CommonJS e não pode usar 'await' no nível superior.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "O arquivo atual é um módulo CommonJS cujas importações produzirão chamadas 'require'; no entanto, o arquivo referenciado é um módulo ECMAScript e não pode ser importado com 'require'. Considere escrever uma chamada 'import(\"{0}\")' dinâmica em vez disso.", "The_current_host_does_not_support_the_0_option_5001": "O host atual não dá suporte à opção '{0}'.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "A declaração de '{0}' que você provavelmente pretende usar é definida aqui", "The_declaration_was_marked_as_deprecated_here_2798": "A declaração foi marcada como preterida aqui.", @@ -1422,7 +1432,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "O lado esquerdo de uma operação aritmética deve ser do tipo 'any', 'number', 'bigint' ou um tipo enumerado.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "O lado esquerdo de uma expressão de atribuição pode não ser um acesso opcional de propriedade.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "O lado esquerdo de uma expressão de atribuição deve ser uma variável ou um acesso à propriedade.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "O lado esquerdo de uma expressão 'em' deve ser um identificador privado ou do tipo 'qualquer', 'cadeia de caracteres', 'número' ou 'símbolo'.", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "O lado esquerdo de uma expressão 'instanceof' deve ser do tipo 'any', um tipo de objeto ou um parâmetro de tipo.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "O local usado ao exibir mensagens ao usuário (por exemplo, 'en-us')", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "A profundidade máxima de dependência a ser pesquisada em arquivos node_modules e de carregamento de JavaScript.", @@ -1443,7 +1452,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "O tipo de retorno de uma função assíncrona ou método precisa ser o tipo Promise global. Você quis escrever 'Promise<{0}>'?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "O lado direito de uma instrução 'for...in' deve ser do tipo 'any', um tipo de objeto ou um parâmetro de tipo, mas aqui ele tem o tipo '{0}'.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "O lado direito de uma operação aritmética deve ser do tipo 'any', 'number', 'bigint' ou um tipo enumerado.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "O lado direito de uma expressão 'in' não pode ser um primitivo.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "O lado direito de uma expressão 'instanceof' deve ser do tipo 'any' ou de um tipo que pode ser atribuído ao tipo de interface 'Function'.", "The_root_value_of_a_0_file_must_be_an_object_5092": "O valor raiz de um arquivo '{0}' precisa ser um objeto.", "The_shadowing_declaration_of_0_is_defined_here_18017": "A declaração de sombreamento de '{0}' é definida aqui", @@ -1464,13 +1472,15 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "O tipo retornado pelo método '{0}()' de um iterador deve ter uma propriedade 'value'.", "The_types_of_0_are_incompatible_between_these_types_2200": "Os tipos de '{0}' são incompatíveis entre esses tipos.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "Os tipos retornados por '{0}' são incompatíveis entre esses tipos.", + "The_value_0_cannot_be_used_here_18050": "O valor '{0}' não pode ser usado aqui.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "A declaração de variável de uma instrução 'for...in' não pode ter um inicializador.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "A declaração de variável de uma instrução 'for...of' não pode ter um inicializador.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "A instrução \"with\" não tem suporte. Todos os símbolos em um bloco \"with\" terão o tipo \"any\".", "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "A propriedade '{0}' da marca desse JSX espera um único filho do tipo '{1}', mas vários filhos foram fornecidos.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "A propriedade '{0}' da marca desse JSX espera o tipo '{1}' que requer vários filhos, mas somente um único filho foi fornecido.", + "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "Esta comparação parece não ser intencional porque os tipos '{0}' e '{1}' não têm sobreposição.", + "This_condition_will_always_return_0_2845": "Esta condição sempre retornará '{0}'.", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "Essa condição sempre retornará '{0}', pois o JavaScript compara objetos por referência, não por valor.", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "Essa condição sempre retornará '{0}', pois os tipos '{1}' e '{2}' não têm nenhuma sobreposição.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Esta condição sempre retornará verdadeiro, já que este '{0}' está sempre definido.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "Esta condição sempre retornará verdadeira, uma vez que esta função foi sempre definida. Você pretendia chamá-la em vez disso?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Esta função de construtor pode ser convertida em uma declaração de classe.", @@ -1491,7 +1501,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Este membro precisa ter um modificador 'override' porque substitui um membro na classe base '{0}'.", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Este membro precisa ter um modificador 'override' porque substitui um método abstrato que é declarado na classe base '{0}'.", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "Esse módulo só pode ser referenciado com importações/exportações de ECMAScript ligando o sinalizador '{0}' e referenciando sua exportação padrão.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Esse módulo é declarado com o uso de 'export =' e só pode ser usado com uma importação padrão ao usar o sinalizador '{0}'.", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Este módulo é declarado com 'export =', e só pode ser usado com uma importação padrão ao usar o sinalizador '{0}'.", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Esta assinatura de sobrecarga não é compatível com sua assinatura de implementação.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Este parâmetro não é permitido com a diretiva 'use strict'.", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "Essa propriedade de parâmetro deve ter um comentário JSDoc com uma marca '@override' porque ela substitui um membro na classe base '{0}'.", @@ -1504,6 +1514,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Esta sintaxe exige um auxiliar importado nomeado como '{1}' com parâmetros {2}, o que não é compatível com o que está em '{0}'. Considere atualizar sua versão do '{0}'.", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Este parâmetro de tipo pode precisar de uma restrição `extends {0}`.", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "Este uso de 'importar' é inválido. Chamadas 'import()' podem ser escritas, mas devem ter parênteses e não podem ter argumentos de tipo.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Para converter este arquivo em um módulo ECMAScript, adicione o campo `\"type\": \"module\"` a '{0}'.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Para converter este arquivo em um módulo ECMAScript, altere sua extensão de arquivo para '{0}' ou adicione o campo `\"type\": \"module\"` para '{1}'.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Para converter este arquivo em um módulo ECMAScript, altere sua extensão de arquivo para '{0}' ou crie um arquivo package.json local com `{ \"type\": \"module\" }`.", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Para converter este arquivo em um módulo ECMAScript, crie um arquivo package.json local com `{ \"type\": \"module\" }`.", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "As expressões 'await' de nível superior só são permitidas quando a opção 'module' está definida como 'es2022', 'esnext', 'system', 'node16' ou 'nodenext' e a opção 'target' está definida como ' es2017' ou superior.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": "As declarações de nível superior em arquivos .d.ts devem começar com um modificador 'declare' ou 'export'.", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "Loops 'for await' de nível superior só são permitidos quando a opção 'module' está definida como 'es2022', 'esnext', 'system', 'node16' ou 'nodenext', e a opção 'target' está definida como 'es2017' ou superior.", @@ -1519,6 +1533,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "O tipo '{0}' não pode ser usado como um tipo de índice.", "Type_0_cannot_be_used_to_index_type_1_2536": "O tipo '{0}' não pode ser usado para indexar o tipo '{1}'.", "Type_0_does_not_satisfy_the_constraint_1_2344": "O tipo '{0}' não satisfaz a restrição '{1}'.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "O tipo '{0}' não atende ao tipo esperado '{1}'.", "Type_0_has_no_call_signatures_2757": "O tipo '{0}' não tem assinaturas de chamada.", "Type_0_has_no_construct_signatures_2761": "O tipo '{0}' não tem assinaturas de constructo.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "O tipo '{0}' não tem assinatura de índice correspondente para o tipo '{1}'.", @@ -1540,6 +1555,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "O tipo '{0}' não pode ser atribuído ao tipo '{1}' com 'exactOptionalPropertyTypes: true'. Considere adicionar 'undefined' ao tipo do destino.", "Type_0_is_not_comparable_to_type_1_2678": "O tipo '{0}' não pode ser comparável ao tipo '{1}'.", "Type_0_is_not_generic_2315": "O tipo '{0}' não é genérico.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "O tipo '{0}' pode representar um valor primitivo, que não é permitido como operando direito do operador 'in'.", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "O tipo '{0}' deve ter um método '[Symbol.asyncIterator]()' que retorna um iterador assíncrono.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "O tipo '{0}' deve ter um método '[Symbol.iterator]()' que retorna um iterador.", "Type_0_provides_no_match_for_the_signature_1_2658": "O tipo '{0}' fornece nenhuma correspondência para a assinatura '{1}'.", @@ -1596,6 +1612,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== A diretiva de referência de tipo '{0}' não foi resolvida. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== A diretiva de referência de tipo '{0}' foi resolvida com sucesso para '{1}', primário: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== A diretiva de referência de tipo '{0}' foi resolvida com sucesso para '{1}' com a ID do Pacote '{2}', primário: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "As expressões de satisfação de tipo só podem ser usadas em arquivos TypeScript.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "Os tipos não podem aparecer em declarações de exportação em arquivos JavaScript.", "Types_have_separate_declarations_of_a_private_property_0_2442": "Tipos têm declarações separadas de uma propriedade privada '{0}'.", "Types_of_construct_signatures_are_incompatible_2419": "Os tipos de assinaturas de constructo são incompatíveis.", @@ -1637,9 +1654,12 @@ "Updating_output_of_project_0_6373": "Atualizando a saída do projeto '{0}'...", "Updating_output_timestamps_of_project_0_6359": "Atualizando os carimbos de data/hora de saída do projeto '{0}'...", "Updating_unchanged_output_timestamps_of_project_0_6371": "Atualizando os carimbos de data/hora de saída inalterados do projeto '{0}'...", + "Use_0_95174": "Use `{0}`.", + "Use_Number_isNaN_in_all_conditions_95175": "Use `Number.isNaN` em todas as condições.", "Use_element_access_for_0_95145": "Usar o acesso de elemento para '{0}'", "Use_element_access_for_all_undeclared_properties_95146": "Usar o acesso de elemento para todas as propriedades não declaradas.", "Use_synthetic_default_member_95016": "Use o membro sintético 'padrão'.", + "Using_0_subpath_1_with_target_2_6404": "Usando '{0}' subcaminho '{1}' com destino '{2}'.", "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "Há suporte para o uso de uma cadeia de caracteres em uma instrução 'for...of' somente no ECMAScript 5 e superior.", "Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915": "Usar --build, -b fará com que o tsc se comporte mais como um orquestrador de build do que como um compilador. Isso é usado para acionar a construção de projetos compostos sobre os quais você pode aprender mais em {0}", "Using_compiler_options_of_project_reference_redirect_0_6215": "Usando as opções do compilador de redirecionamento de referência do projeto '{0}'.", @@ -1717,6 +1737,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "'{0}' não é uma metapropriedade para a palavra-chave '{1}'. Você quis dizer '{2}'?", "_0_is_not_allowed_as_a_parameter_name_1390": "'{0}' não é permitido como um nome de parâmetro.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "'{0}' não é permitido como um nome de declaração de variável.", + "_0_is_of_type_unknown_18046": "'{0}' é do tipo 'desconhecido'.", + "_0_is_possibly_null_18047": "'{0}' é possivelmente 'null'.", + "_0_is_possibly_null_or_undefined_18049": "'{0}' é possivelmente 'null' ou 'undefined'.", + "_0_is_possibly_undefined_18048": "'{0}' é possivelmente 'indefinido'.", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "'{0}' é referenciado direta ou indiretamente em sua própria expressão base.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "'{0}' é referenciado direta ou indiretamente em sua própria anotação de tipo.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "'{0}' foi especificado mais de uma vez, portanto esse uso será substituído.", @@ -1752,6 +1776,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "'{0}', que não tem a anotação de tipo de retorno, implicitamente tem um tipo de retorno '{1}'.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "'{0}', que não tem a anotação de tipo de retorno, implicitamente tem um tipo de rendimento '{1}'.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "O modificador 'abstract' pode aparecer somente em uma declaração de classe, método ou propriedade.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "o modificador 'acessador' só pode aparecer em uma declaração de propriedade.", "and_here_6204": "e aqui.", "arguments_cannot_be_referenced_in_property_initializers_2815": "'argumentos' não podem ser referenciados em inicializadores de propriedade.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "\"auto\": trata os arquivos com import, export, import.meta, jsx (com jsx: react-jsx) ou formato esm (com module: node16+) como módulos.", diff --git a/node_modules/typescript/lib/ru/diagnosticMessages.generated.json b/node_modules/typescript/lib/ru/diagnosticMessages.generated.json index e3d29e396..1de4b2b1c 100644 --- a/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +++ b/node_modules/typescript/lib/ru/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "У абстрактного метода доступа не может быть реализации.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "Модификатор специальных возможностей запрещено использовать с закрытым идентификатором.", "An_accessor_cannot_have_type_parameters_1094": "Метод доступа не может иметь параметры типа.", + "An_accessor_property_cannot_be_declared_optional_1276": "Невозможно объявить свойство \"accessor\" как необязательное.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Объявление окружающего модуля разрешено использовать только в рамках верхнего уровня файла.", "An_argument_for_0_was_not_provided_6210": "Не указан аргумент для \"{0}\".", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "Не указан аргумент, соответствующий этому шаблону привязки.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "Класс \"{0}\" неправильно реализует класс \"{1}\". Вы хотели расширить \"{1}\" и унаследовать его члены в виде подкласса?", "Class_0_incorrectly_implements_interface_1_2420": "Класс \"{0}\" неправильно реализует интерфейс \"{1}\".", "Class_0_used_before_its_declaration_2449": "Класс \"{0}\" использован прежде, чем объявлен.", - "Class_constructor_may_not_be_a_generator_1360": "Конструктор класса не может быть генератором.", + "Class_constructor_may_not_be_a_generator_1368": "Конструктор класса не может быть генератором.", "Class_constructor_may_not_be_an_accessor_1341": "Конструктор класса не может быть методом доступа.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "Объявление класса не может реализовать список перегрузок для \"{0}\".", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "В объявлении класса не может использоваться более одного тега \"@augments\" или \"@extends\".", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "Преобразование типа \"{0}\" в тип \"{1}\" может привести к ошибке, так как ни один из типов не перекрывается с другим в достаточной степени. Если это сделано намеренно, сначала преобразуйте выражение в \"unknown\".", "Convert_0_to_1_in_0_95003": "Преобразовать \"{0}\" в \"{1} в {0}\"", "Convert_0_to_mapped_object_type_95055": "Преобразовать \"{0}\" в тип сопоставленного объекта", + "Convert_all_const_to_let_95102": "Преобразовать все \"const\" в \"let\"", "Convert_all_constructor_functions_to_classes_95045": "Преобразовать все функции конструктора в классы", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Преобразовать все импорты, не используемые в качестве значения, в импорты, затрагивающие только тип", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Преобразовать все недопустимые символы в код сущности HTML", @@ -658,6 +660,8 @@ "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219": "Экспериментальная поддержка для декораторов — это функция, которая будет изменена в будущем выпуске. Задайте параметр \"experimentalDecorators\" в \"tsconfig\" или \"jsconfig\", чтобы удалить это предупреждение.", "Explicitly_specified_module_resolution_kind_Colon_0_6087": "Явно указанный тип разрешения модуля: \"{0}\".", "Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791": "Невозможно выполнить возведение в степень для значений \"bigint\", если для параметра \"target\" не задана версия \"es2016\" или более поздняя версия.", + "Export_0_from_module_1_90059": "Экспорт \"{0}\" из модуля \"{1}\"", + "Export_all_referenced_locals_90060": "Экспортировать все локальные объекты, на которые указывают ссылки", "Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203": "Назначение экспорта невозможно использовать при разработке для модулей ECMAScript. Попробуйте использовать \"export default\" или другой формат модуля.", "Export_assignment_is_not_supported_when_module_flag_is_system_1218": "Назначение экспорта не поддерживается, если флаг \"--module\" имеет значение \"system\".", "Export_declaration_conflicts_with_exported_declaration_of_0_2484": "Объявление экспорта конфликтует с экспортированным объявлением \"{0}\".", @@ -906,6 +910,7 @@ "Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650": "Сделать так, чтобы keyof возвращал только строки, а не строки, числа или символы. Устаревший вариант.", "Make_super_call_the_first_statement_in_the_constructor_90002": "Сделайте вызов \"super()\" первой инструкцией в конструкторе", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "Сопоставленный объект неявно имеет тип шаблона \"любой\".", + "Matched_0_condition_1_6403": "Соответствие: \"{0}\", условие: \"{1}\".", "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457": "Сопоставление по умолчанию включает шаблон '**/*'", "Matched_by_include_pattern_0_in_1_1407": "Соответствует шаблону включения \"{0}\" в \"{1}\".", "Member_0_implicitly_has_an_1_type_7008": "Элемент \"{0}\" неявно имеет тип \"{1}\".", @@ -919,7 +924,7 @@ "Method_not_implemented_95158": "Метод не реализован.", "Modifiers_cannot_appear_here_1184": "Здесь невозможно использовать модификаторы.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "Модуль \"{0}\" можно только импортировать по умолчанию с помощью флага \"{1}\"", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Не удается импортировать модуль \"{0}\" с помощью этой конструкции. Описатель разрешается только в модуль ES, который не может быть импортирован синхронно. Вместо этого используйте динамический импорт.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "Не удается импортировать модуль \"{0}\" с помощью этой конструкции. Описатель разрешается только в модуль ES, который нельзя импортировать с помощью \"require\". Вместо этого используйте импорт ECMAScript.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "Модуль \"{0}\" объявляет \"{1}\" локально, но он экспортируется как \"{2}\".", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "Модуль \"{0}\" объявляет \"{1}\" локально, но он не экспортируется.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "Модуль \"{0}\" не ссылается на тип, но используется здесь как тип. Возможно, вы хотели использовать \"typeof import('{0}')\"?", @@ -1103,6 +1108,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Проект \"{0}\" требует обновления, так как выходного файла \"{1}\" не существует", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "Проект \"{0}\" устарел, так как выходные данные для него были созданы с помощью версии \"{1}\", которая отличается от текущей версии \"{2}\"", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "Проект \"{0}\" устарел, так как изменились выходные данные его зависимости \"{1}\"", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "Проект \"{0}\" устарел из-за ошибки при чтении файла \"{1}\"", "Project_0_is_up_to_date_6361": "Проект \"{0}\" не требует обновления", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "Проект \"{0}\" актуален, так как новейшие входные данные \"{1}\" старше выходных данных \"{2}\".", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "Проект \"{0}\" актуален, но требуется обновить метки времени файлов вывода, которые старше файлов ввода.", @@ -1110,6 +1116,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Ссылки на проект не могут формировать циклический граф. Обнаружен цикл: {0}", "Projects_6255": "Проекты", "Projects_in_this_build_Colon_0_6355": "Проекты в этой сборке: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "Свойства с модификатором \"accessor\" доступны только при обращении к ECMAScript 2015 и более поздним версиям.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "Свойство \"{0}\" не может содержать инициализатор, так как оно помечено как абстрактное.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "Свойство \"{0}\" поступает из сигнатуры индекса, поэтому доступ к нему должен осуществляться с помощью [\"{0}\"].", "Property_0_does_not_exist_on_type_1_2339": "Свойство \"{0}\" не существует в типе \"{1}\".", @@ -1216,6 +1223,7 @@ "Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "Разрешение для модуля \"{0}\" найдено в кэше из расположения \"{1}\".", "Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241": "Разрешение для директивы ссылки на тип \"{0}\" обнаружено в кэше из расположения \"{1}\".", "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195": "Разрешать \"keyof\" только в имена свойств со строковым значением (не числа и не символы).", + "Resolving_in_0_mode_with_conditions_1_6402": "Разрешение в режиме {0} с условиями {1}.", "Resolving_module_0_from_1_6086": "======== Идет разрешение модуля \"{0}\" из \"{1}\". ========", "Resolving_module_name_0_relative_to_base_url_1_2_6094": "Идет разрешение имени модуля \"{0}\" относительного к базовому URL-адресу \"{1}\" — \"{2}\".", "Resolving_real_path_for_0_result_1_6130": "Разрешается реальный путь для \"{0}\"; результат: \"{1}\".", @@ -1272,6 +1280,7 @@ "Root_file_specified_for_compilation_1427": "Корневой файл, указанный для компиляции", "STRATEGY_6039": "СТРАТЕГИЯ", "Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642": "Сохраните файлы .tsbuildinfo, чтобы обеспечить возможность добавочной компиляции проектов.", + "Saw_non_matching_condition_0_6405": "Обнаружено несоответствующее условие \"{0}\".", "Scoped_package_detected_looking_in_0_6182": "Обнаружен пакет, относящийся к области; поиск в \"{0}\"", "Selection_is_not_a_valid_statement_or_statements_95155": "Выделенный фрагмент не является допустимым оператором или операторами.", "Selection_is_not_a_valid_type_node_95133": "Выбранный элемент не является допустимым узлом типа.", @@ -1385,6 +1394,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "Содержащая стрелочная функция фиксирует глобальное значение \"this\".", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "Содержащая функция или текст модуля слишком велики для анализа потока управления.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "Текущий файл является модулем CommonJS и не может использовать \"await\" на верхнем уровне.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "Текущий файл является модулем CommonJS, импорт которого приведет к вызовам \"require\"; однако файл, на который указывает ссылка, является модулем ECMAScript и не может быть импортирован с помощью \"require\". Вместо этого попробуйте написать динамический вызов \"import(\"{0}\")\".", "The_current_host_does_not_support_the_0_option_5001": "Текущий узел не поддерживает параметр \"{0}\".", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "Здесь определяется объявление объекта \"{0}\", который вы, вероятно, намеревались использовать", "The_declaration_was_marked_as_deprecated_here_2798": "Объявление было отмечено как устаревшее.", @@ -1422,7 +1432,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "Левый операнд арифметической операции должен иметь тип \"any\", \"number\", \"bigint\" или тип перечисления.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "Левая часть выражения присваивания не может быть обращением к необязательному свойству.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "В левой части выражения назначения должна быть переменная или доступ к свойству.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "Левый операнд выражения \"in\" должен быть закрытым идентификатором или иметь тип any, string, number или symbol.", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "Левый операнд выражения instanceof должен иметь тип any, тип объекта или параметр типа.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "Языковой стандарт, который используется при отображении сообщений пользователю (например, en-us)", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "Максимальная глубина зависимостей для поиска в папке node_modules и загрузки файлов JavaScript.", @@ -1443,7 +1452,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "Возвращаемое значение асинхронной функции или метода должно иметь глобальный тип Promise. Вы имели в виду \"Promise<{0}>\"?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "Правая часть оператора \"for…in\" должна иметь тип \"any\", тип объекта или быть параметром типа, однако указан тип \"{0}\".", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "Правый операнд арифметической операции должен иметь тип \"any\", \"number\", \"bigint\" или тип перечисления.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "Правый операнд выражения in не должен быть примитивом.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "Правый операнд выражения instanceof должен иметь тип any или тип, который можно назначить типу интерфейса Function.", "The_root_value_of_a_0_file_must_be_an_object_5092": "Корневое значение файла \"{0}\" должно быть объектом.", "The_shadowing_declaration_of_0_is_defined_here_18017": "Здесь определено объявление затемнения \"{0}\"", @@ -1464,13 +1472,15 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "Тип, возвращаемый методом \"{0}()\" итератора, должен содержать свойство \"value\".", "The_types_of_0_are_incompatible_between_these_types_2200": "Типы \"{0}\" несовместимы между этими типами.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "Типы, возвращаемые \"{0}\", несовместимы между этими типами.", + "The_value_0_cannot_be_used_here_18050": "Здесь нельзя использовать значение \"{0}\".", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "Объявление переменной оператора for...in не может содержать инициализатор.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "Объявление переменной оператора for...of не может содержать инициализатор.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "Оператор with не поддерживается. Все символы в блоке with получат тип any.", "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "Свойство \"{0}\" этого тега JSX ожидает один дочерний объект типа \"{1}\", однако было предоставлено несколько дочерних объектов.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "Свойство \"{0}\" этого тега JSX ожидает тип \"{1}\", требующий несколько дочерних объектов, однако был предоставлен только один дочерний объект.", + "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "Это сравнение кажется непреднамеренным, поскольку типы \"{0}\" и \"{1}\" не перекрываются.", + "This_condition_will_always_return_0_2845": "Это условие всегда возвращает \"{0}\".", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "Это условие всегда будет возвращать ''{0}'', так как JavaScript сравнивает объекты по ссылке, а не по значению.", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "Это условие всегда будет возвращать \"{0}\", так как типы \"{1}\" и \"{2}\" не перекрываются.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Это условие всегда будет возвращать значение true, поскольку функция \"{0}\" всегда определена.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "Это условие будет всегда возвращать значение true, поскольку функция всегда определена. Возможно, вы хотите вызвать ее?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Эту функцию конструктора можно преобразовать в объявление класса.", @@ -1491,7 +1501,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Этот элемент должен иметь модификатор \"override\", так как он переопределяет элемент в базовом классе \"{0}\".", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Этот элемент должен иметь модификатор \"override\", так как он переопределяет абстрактный метод, объявленный в базовом классе \"{0}\".", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "На этот модуль можно ссылаться только с помощью импортов/экспортов ECMAScript, включив флаг \"{0}\" и сославшись на его экспорт по умолчанию.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Этот модуль объявлен с помощью \"export =\" и может использоваться только с импортом по умолчанию при использовании флага \"{0}\".", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Этот модуль объявлен с помощью оператора \"export =\" и может использоваться только с импортом по умолчанию при использовании флажка \"{0}\".", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Сигнатура перегрузки несовместима с ее сигнатурой реализации.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Этот параметр запрещено использовать с директивой \"use strict\".", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "Это свойство параметра должно иметь комментарий JSDoc с тегом \"@override\", так как он переопределяет элемент в базовом классе \"{0}\".", @@ -1504,6 +1514,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Для этого синтаксиса требуется импортированный вспомогательный объект с именем \"{1}\" и параметрами ({2}), который не совместим с объектом в \"{0}\". Попробуйте обновить версию \"{0}\".", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Для этого параметра типа может потребоваться ограничение \"extends {0}\".", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "Недопустимое использование \"import\". Можно записывать вызовы \"import()\", но у них должны быть скобки и не должно быть аргументов типа.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Чтобы преобразовать этот файл в модуль ECMAScript, добавьте поле \"type\": \"module\" в \"{0}\".", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Чтобы преобразовать этот файл в модуль ECMAScript, измените его расширение на \"{0}\" или добавьте поле \"type\": \"module\" в \"{1}\".", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Чтобы преобразовать этот файл в модуль ECMAScript, измените его расширение на \"{0}\" или создайте локальный файл package.json с \"{ \"type\": \"module\" }\".", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Чтобы преобразовать этот файл в модуль ECMAScript, создайте локальный файл package.json с \"{ \"type\": \"module\" }\".", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "Выражения ожидания верхнего уровня разрешены только в том случае, если для параметра \"module\" установлено значение \"es2022\", \"esnext\", \"system\", \"node16\" или \"nodenext\", а для параметра \"цель\" установлено значение \"es2017\" или выше.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": "Объявления верхнего уровня в файлах .d.ts должны начинаться с модификатора \"declare\" или \"export\".", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "Выражения ожидания верхнего уровня разрешены, только если для параметра \"module\" установлено значение \"es2022\", \"esnext\", \"system\", \"node16\" или \"nodenext\", а для параметра \"target\" установлено значение \"es2017\" или выше.", @@ -1519,6 +1533,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "Тип \"{0}\" невозможно использовать как тип индекса.", "Type_0_cannot_be_used_to_index_type_1_2536": "Тип \"{0}\" не может использоваться для индексации типа \"{1}\".", "Type_0_does_not_satisfy_the_constraint_1_2344": "Тип \"{0}\" не удовлетворяет ограничению \"{1}\".", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "Тип \"{0}\" не соответствует ожидаемому типу \"{1}\".", "Type_0_has_no_call_signatures_2757": "Тип \"{0}\" не содержит сигнатуры вызова.", "Type_0_has_no_construct_signatures_2761": "Тип \"{0}\" не содержит сигнатуры конструкции.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "Тип \"{0}\" не содержит соответствующую сигнатуру индекса для типа \"{1}\".", @@ -1540,6 +1555,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "Невозможно назначить тип \"{0}\" типу \"{1}\", когда свойство \"exactOptionalPropertyTypes\" имеет значение \"true\". Рассмотрите возможность добавления типа \"undefined\" к типу цели.", "Type_0_is_not_comparable_to_type_1_2678": "Тип \"{0}\" невозможно сравнить с типом \"{1}\".", "Type_0_is_not_generic_2315": "Тип \"{0}\" не является универсальным.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "Тип \"{0}\" может представлять примитивное значение, не разрешенное в качестве правого операнда оператора \"in\".", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "Тип \"{0}\" должен иметь метод \"[Symbol.asyncIterator]()\", который возвращает асинхронный итератор.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "Тип \"{0}\" должен иметь метод \"[Symbol.iterator]()\", который возвращает итератор.", "Type_0_provides_no_match_for_the_signature_1_2658": "Тип \"{0}\" не предоставляет соответствия для сигнатуры \"{1}\".", @@ -1596,6 +1612,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== Директива ссылки на тип \"{0}\" не разрешена. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== Директива ссылки на тип \"{0}\" успешно разрешена в \"{1}\", первичный объект: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== Директива ссылки на тип \"{0}\" успешно разрешена в \"{1}\" с идентификатором пакета \"{2}\", первичный объект: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "Выражения соответствия типа можно использовать только в файлах TypeScript.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "Типы не могут отображаться в объявлениях экспорта в файлах JavaScript.", "Types_have_separate_declarations_of_a_private_property_0_2442": "Типы имеют раздельные объявления закрытого свойства \"{0}\".", "Types_of_construct_signatures_are_incompatible_2419": "Типы сигнатур конструкций несовместимы.", @@ -1637,9 +1654,12 @@ "Updating_output_of_project_0_6373": "Обновление выходных данных проекта \"{0}\"...", "Updating_output_timestamps_of_project_0_6359": "Обновление меток времени в выходных данных проекта \"{0}\"...", "Updating_unchanged_output_timestamps_of_project_0_6371": "Обновление меток времени в неизменившихся выходных данных проекта \"{0}\"...", + "Use_0_95174": "Использовать \"{0}\".", + "Use_Number_isNaN_in_all_conditions_95175": "Использовать \"Number.isNaN\" во всех условиях.", "Use_element_access_for_0_95145": "Использовать доступ к элементам для \"{0}\".", "Use_element_access_for_all_undeclared_properties_95146": "Использовать доступ к элементам для всех необъявленных свойств.", "Use_synthetic_default_member_95016": "Используйте искусственный элемент \"default\".", + "Using_0_subpath_1_with_target_2_6404": "Использование \"{0}\", вложенный путь: \"{1}\", целевой объект: \"{2}\".", "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "Использование строки для оператора for...of поддерживается только в ECMAScript 5 и более поздних версиях.", "Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915": "Использование --build,-b заставит TSC вести себя больше как оркестратор сборки, чем как компилятор. Это используется для запуска создания составных проектов, о которых можно узнать больше на {0}", "Using_compiler_options_of_project_reference_redirect_0_6215": "Использование параметров компилятора для перенаправления ссылки на проект \"{0}\".", @@ -1717,6 +1737,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "\"{0}\" не является допустимым метасвойством для ключевого слова \"{1}\". Вы имели в виду \"{2}\"?", "_0_is_not_allowed_as_a_parameter_name_1390": "\"{0}\" не является допустимым именем параметра.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "Использование \"{0}\" в качестве имени объявления переменной не допускается.", + "_0_is_of_type_unknown_18046": "\"{0}\" относится к типу unknown.", + "_0_is_possibly_null_18047": "Возможно, \"{0}\" имеет значение null.", + "_0_is_possibly_null_or_undefined_18049": "Возможно, \"{0}\" имеет значение null или undefined.", + "_0_is_possibly_undefined_18048": "Возможно, \"{0}\" имеет значение undefined.", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "На \"{0}\" есть прямые или непрямые ссылки в его собственном базовом выражении.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "На \"{0}\" есть прямые или непрямые ссылки в его собственной аннотации типа.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "\"{0}\" указан несколько раз, поэтому такое использование будет перезаписано.", @@ -1752,6 +1776,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "\"{0}\", у которого нет аннотации типа возвращаемого значения, неявно имеет тип возвращаемого значения \"{1}\".", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "\"{0}\", у которого нет заметки с типом возвращаемого значения, неявно имеет тип yield \"{1}\".", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "Модификатор abstract может отображаться только в объявлении класса, метода или свойства.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "Модификатор \"accessor\" может быть только в объявлении свойства.", "and_here_6204": "и здесь.", "arguments_cannot_be_referenced_in_property_initializers_2815": "Ссылка на \"arguments\" в инициализаторах свойств невозможна.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "\"auto\": обрабатывать файлы с импортом, экспортом, import.meta, jsx (с jsx: react-jsx) или форматом esm (с модулем: node16+) как файлы с модулями.", diff --git a/node_modules/typescript/lib/tr/diagnosticMessages.generated.json b/node_modules/typescript/lib/tr/diagnosticMessages.generated.json index 5297519a4..36a7594ca 100644 --- a/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +++ b/node_modules/typescript/lib/tr/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "Soyut erişimcinin uygulaması olamaz.", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "Erişilebilirlik değiştiricisi özel bir tanımlayıcıyla kullanılamıyor.", "An_accessor_cannot_have_type_parameters_1094": "Erişimci, tür parametrelerine sahip olamaz.", + "An_accessor_property_cannot_be_declared_optional_1276": "'accessor' özelliği isteğe bağlı olarak bildirilemez.", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "Çevresel modül bildirimine yalnızca bir dosyadaki en üst düzeyde izin verilir.", "An_argument_for_0_was_not_provided_6210": "'{0}' için bağımsız değişken sağlanmadı.", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "Bu bağlama deseniyle eşleşen bağımsız değişken sağlanmadı.", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "'{0}' sınıfı hatalı olarak '{1}' sınıfını uyguluyor. '{1}' sınıfını genişletip üyelerini bir alt sınıf olarak devralmak mı istiyordunuz?", "Class_0_incorrectly_implements_interface_1_2420": "'{0}' sınıfı, '{1}' arabirimini yanlış uyguluyor.", "Class_0_used_before_its_declaration_2449": "'{0}' sınıfı, bildiriminden önce kullanıldı.", - "Class_constructor_may_not_be_a_generator_1360": "Sınıf oluşturucu, program yönergeleri üreten bir oluşturucu olamaz.", + "Class_constructor_may_not_be_a_generator_1368": "Sınıf oluşturucu, program yönergeleri üreten bir oluşturucu olamaz.", "Class_constructor_may_not_be_an_accessor_1341": "Sınıf oluşturucu, bir erişimci olamaz.", "Class_declaration_cannot_implement_overload_list_for_0_2813": "Sınıf bildirimi, '{0}' için aşırı yükleme listesi uygulayamaz.", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "Sınıf bildirimlerinde birden fazla '@augments' veya '@extends' etiketi olamaz.", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "Türler birbiriyle yeterince örtüşmediğinden '{0}' türünün '{1}' türüne dönüştürülmesi bir hata olabilir. Bu bilerek yapıldıysa, ifadeyi önce 'unknown' değerine dönüştürün.", "Convert_0_to_1_in_0_95003": "'{0}' öğesini '{0} içinde {1}' öğesine dönüştür", "Convert_0_to_mapped_object_type_95055": "'{0}' öğesini eşlenen nesne türüne dönüştür", + "Convert_all_const_to_let_95102": "Tüm 'const' ifadelerini 'let' ifadesine dönüştürün", "Convert_all_constructor_functions_to_classes_95045": "Tüm oluşturucu işlevleri sınıflara dönüştür", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "Bir değer olarak kullanılmayan tüm içeri aktarmaları yalnızca tür içeri aktarmalarına dönüştürün", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "Tüm geçersiz karakterleri HTML varlık koduna dönüştür", @@ -658,6 +660,8 @@ "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219": "Dekoratörler için sunulan deneysel destek özelliği, sonraki sürümlerde değiştirilebilir. Bu uyarıyı kaldırmak için 'tsconfig' veya 'jsconfig' dosyanızdaki 'experimentalDecorators' seçeneğini ayarlayın.", "Explicitly_specified_module_resolution_kind_Colon_0_6087": "Açık olarak belirtilen modül çözümleme türü: '{0}'.", "Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791": "'target' seçeneği 'es2016' veya üzeri olarak belirlenmedikçe 'bigint' değerlerinde üs olarak gösterme yapılamaz.", + "Export_0_from_module_1_90059": "'{1}' modülünden '{0}' öğesini dışarı aktar", + "Export_all_referenced_locals_90060": "Başvurulan tüm yerel ayarları dışarı aktar", "Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203": "ECMAScript modülleri hedeflenirken dışarı aktarma ataması kullanılamaz. Bunun yerine 'export default' veya başka bir modül biçimi kullanmayı deneyin.", "Export_assignment_is_not_supported_when_module_flag_is_system_1218": "'--module' bayrağı 'system' ise dışarı aktarma ataması desteklenmez.", "Export_declaration_conflicts_with_exported_declaration_of_0_2484": "Dışarı aktarma bildirimi, dışarı aktarılan '{0}' bildirimiyle çakışıyor.", @@ -906,6 +910,7 @@ "Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650": "Dize, sayı veya simge yerine yalnızca dönüş dizelerinin anahtarını oluşturun. Eski seçenek.", "Make_super_call_the_first_statement_in_the_constructor_90002": "Oluşturucudaki ilk deyime 'super()' tarafından çağrı yapılmasını sağla", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "Eşleştirilmiş nesne türü örtük olarak 'any' şablon türüne sahip.", + "Matched_0_condition_1_6403": "'{0}' koşulu '{1}' eşleşti.", "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457": "Varsayılan '**/*' ekleme deseniyle eşleşti", "Matched_by_include_pattern_0_in_1_1407": "'{1}' içindeki '{0}' ekleme desenine göre eşleştirildi", "Member_0_implicitly_has_an_1_type_7008": "'{0}' üyesi örtük olarak '{1}' türüne sahip.", @@ -919,7 +924,7 @@ "Method_not_implemented_95158": "Metot uygulanmadı.", "Modifiers_cannot_appear_here_1184": "Değiştiriciler burada görüntülenemez.", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "'{0}' modülü yalnızca varsayılan olarak '{1}' bayrağı kullanılarak içeri aktarılabilir", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "'{0}' modülü bu yapı kullanılarak içeri aktarılamaz. Tanımlayıcı yalnızca eşzamanlı olarak içeri aktarılamayan bir ES modülüne çözümleniyor. Bunun yerine dinamik içeri aktarma kullanın.", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "'{0}' modülü bu yapı kullanılarak içe aktarılamaz. Belirtici yalnızca 'require' ile içe aktarılamayan bir ES modülüne çözümlenir. Bunun yerine bir ECMAScript içe aktarma kullanın.", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "'{0}' modülü '{1}' öğesini yerel olarak bildiriyor ancak '{2}' olarak dışarı aktarıldı.", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "'{0}' modülü '{1}' öğesini yerel olarak bildiriyor ancak dışarı aktarılmadı.", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "'{0}' modülü bir türe başvurmuyor ancak burada bir tür olarak kullanılmış. Şunu mu demek istediniz?: 'typeof import('{0}')'", @@ -1103,6 +1108,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "Çıkış dosyası '{1}' mevcut olmadığından '{0}' projesi güncel değil", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "'{0}' projesinin çıkışı geçerli '{2}' sürümünden farklı olan '{1}' sürümü ile oluşturulduğundan proje güncel değil", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "'{0}' projesinin '{1}' bağımlılığı değiştirildiğinden proje güncel değil", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "'{1}' dosyası okunurken hata oluştuğu için '{0}' projesi güncel değil", "Project_0_is_up_to_date_6361": "'{0}' projesi güncel", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "En yeni '{1}' girişi '{2}' çıkışından daha eski olduğundan '{0}' projesi güncel", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "'{0}' projesi güncel ancak giriş dosyalarından daha eski olan çıkış dosyalarına ait zaman damgalarının güncelleştirilmesi gerekiyor", @@ -1110,6 +1116,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "Proje başvuruları döngüsel bir grafik formu oluşturamaz. Döngü tespit edildi: {0}", "Projects_6255": "Projeler", "Projects_in_this_build_Colon_0_6355": "Bu derlemedeki projeler: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "'accessor' değiştiricisine sahip özellikler yalnızca ECMAScript 2015 ve üzeri hedeflendiğinde kullanılabilir.", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "'{0}' özelliği abstract olarak işaretlendiğinden bir başlatıcıya sahip olamaz.", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "'{0}' özelliği bir dizin imzasından geldiğinden ['{0}'] ile erişilmelidir.", "Property_0_does_not_exist_on_type_1_2339": "'{0}' özelliği, '{1}' türünde değil.", @@ -1216,6 +1223,7 @@ "Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "'{0}' modülünün çözümü '{1}' konumundaki önbellekte bulundu.", "Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241": "'{0}' tür başvurusu yönergesinin çözümlemesi '{1}' konumundaki önbellekte bulundu.", "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195": "'Keyof' değerini yalnızca dize değerli özellik adlarına (sayılar veya simgeler olmadan) çözümleyin.", + "Resolving_in_0_mode_with_conditions_1_6402": "{0} modunda {1} koşullarıyla çözümleniyor.", "Resolving_module_0_from_1_6086": "======== '{0}' modülü '{1}' öğesinden çözümleniyor. ========", "Resolving_module_name_0_relative_to_base_url_1_2_6094": "'{0}' modül adı, '{1}' - '{2}' temel url'sine göre çözümleniyor.", "Resolving_real_path_for_0_result_1_6130": "'{0}' için gerçek yol çözümleniyor, sonuç: '{1}'.", @@ -1272,6 +1280,7 @@ "Root_file_specified_for_compilation_1427": "Derleme için belirtilen kök dosyası", "STRATEGY_6039": "STRATEJİ", "Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642": "Projelerin artımlı derlenmesini sağlamak için .tsbuildinfo dosyalarını kaydedin.", + "Saw_non_matching_condition_0_6405": "Eşleşmeyen koşul '{0}' görüldü.", "Scoped_package_detected_looking_in_0_6182": "Kapsamlı paket algılandı, '{0}' içinde aranıyor", "Selection_is_not_a_valid_statement_or_statements_95155": "Seçim geçerli bir veya daha fazla deyim değil", "Selection_is_not_a_valid_type_node_95133": "Seçim geçerli bir tür düğümü değil", @@ -1385,6 +1394,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "Kapsayıcı ok işlevi, 'this' öğesinin genel değerini yakalar.", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "İçeren işlev veya modül gövdesi, denetim akışı analizi için çok büyük.", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "Geçerli dosya bir CommonJS modülüdür ve en üst düzeyde 'await'i kullanamaz.", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "Geçerli dosya, içe aktarma işlemlerinin 'require' çağrıları üreteceği bir CommonJS modülüdür; ancak başvurulan dosya bir ECMAScript modülüdür ve 'require' ile içe aktarılamaz. Bunun yerine dinamik bir 'import(\"{0}\")' çağrısı yazmayı deneyin.", "The_current_host_does_not_support_the_0_option_5001": "Mevcut ana bilgisayar '{0}' seçeneğini desteklemiyor.", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "Büyük olasılıkla kullanmayı amaçladığınız '{0}' bildirimi burada tanımlanır", "The_declaration_was_marked_as_deprecated_here_2798": "Bildirim burada kullanım dışı olarak işaretlendi.", @@ -1422,7 +1432,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "Aritmetik işlemin sol tarafı, 'any', 'number', 'bigint' veya bir sabit listesi türünde olmalıdır.", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "Atama ifadesinin sol tarafı, isteğe bağlı bir özellik erişimi olamaz.", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "Atama ifadesinin sol tarafında bir değişken veya özellik erişimi bulunmalıdır.", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "'in' ifadesinin sol tarafı özel bir tanımlayıcı veya 'any', 'string', 'number' ya da 'symbol' türünde olmalıdır.", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "'instanceof' ifadesinin sol tarafı 'any' türünde, bir nesne türü veya tür parametresi olmalıdır.", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "Kullanıcıya ileti görüntülenirken kullanılacak yerel ayar (örn. 'tr-tr')", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "node_modules altında arama yapmak ve JavaScript dosyalarını yüklemek için en yüksek bağımlılık derinliği.", @@ -1443,7 +1452,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "Asenkron bir işlevin ya da metodun dönüş türü, genel Promise türü olmalıdır. 'Promise<{0}>' yazmak mı istediniz?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "'for...in' deyiminin sağ tarafı 'any' türünde, bir nesne türü veya tür parametresi olmalıdır ancak burada '{0}' türüne sahip.", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "Aritmetik işlemin sağ tarafı, 'any', 'number', 'bigint' veya bir sabit listesi türünde olmalıdır.", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "'in' ifadesinin sağ tarafı basit olmamalıdır.", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "'instanceof' ifadesinin sağ tarafı 'any' türünde veya 'Function' arabirim türüne atanabilir bir türde olmalıdır.", "The_root_value_of_a_0_file_must_be_an_object_5092": "'{0}' dosyasının kök değeri bir nesne olmalıdır.", "The_shadowing_declaration_of_0_is_defined_here_18017": "'{0}' için gölgeleme bildirimi burada tanımlanır", @@ -1464,13 +1472,15 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "Bir yineleyicinin '{0}()' metodu tarafından döndürülen tür, 'value' özelliğine sahip olmalıdır.", "The_types_of_0_are_incompatible_between_these_types_2200": "'{0}' türleri bu türler arasında uyumsuz.", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "'{0}' tarafından döndürülen türler, bu türler arasında uyumsuz.", + "The_value_0_cannot_be_used_here_18050": "'{0}' değeri burada kullanılamaz.", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "'for...in' deyiminin değişken bildirimi bir başlatıcıya sahip olamaz.", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "'for...of' deyiminin değişken bildirimi bir başlatıcıya sahip olamaz.", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "'with' ifadesi desteklenmiyor. 'with' bloklarındaki tüm simgeler 'any' türüne sahip olacaktır.", "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "Bu JSX etiketinin '{0}' özelliği, '{1}' türünde tek bir alt öğe bekliyor ancak birden çok alt öğe sağlandı.", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "Bu JSX etiketinin '{0}' özelliği, birden çok alt öğe gerektiren '{1}' türünü bekliyor ancak yalnızca tek bir alt öğe sağlandı.", + "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "'{0}' ve '{1}' türlerinde çakışma olmadığından bu karşılaştırma yanlışlıkla yapılmış gibi görünüyor.", + "This_condition_will_always_return_0_2845": "Bu koşul her zaman '{0}' döndürür.", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "JavaScript nesneleri değer göre değil başvuruya göre karşılaştırdığından bu koşul her zaman '{0}' değerini döndürür.", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "'{1}' ve '{2}' türleri çakışmadığından bu koşul her zaman '{0}' döndürür.", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "Bu '{0}' her zaman tanımlandığı için bu koşul her zaman doğru olacaktır.", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "İşlev her zaman tanımlı olduğundan bu koşul her zaman true döndürür. Bunun yerine işlevi çağırmayı mı istediniz?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "Bu oluşturucu işlevi bir sınıf bildirimine dönüştürülebilir.", @@ -1491,7 +1501,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "Bu üye, '{0}' temel sınıfındaki bir üyeyi geçersiz kıldığından 'override' değiştiricisine sahip olmalıdır.", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "Bu üye, '{0}' temel sınıfında bildirilen soyut bir metodu geçersiz kıldığından 'override' değiştiricisine sahip olmalıdır.", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "Bu modüle yalnızca '{0}' bayrağını açıp modülün varsayılan dışarı aktarma işlemine başvurarak ECMAScript içeri/dışarı aktarma işlemleri ile başvurulabilir.", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "Bu modül, 'export =' kullanılarak bildirildi ve yalnızca '{0}' bayrağı kullanılırken varsayılan bir içeri aktarma ile kullanılabilir.", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "Bu modül, 'export =' ile bildirildi ve yalnızca '{0}' bayrağı kullanılırken varsayılan bir içeri aktarmayla kullanılabilir.", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "Bu aşırı yükleme imzası, uygulama imzasıyla uyumlu değil.", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "Bu parametreye 'use strict' yönergesi ile izin verilmiyor.", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "' {0}' temel sınıfındaki bir üyeyi geçersiz kıldığından, bu parametre özelliğinin '@override' etiketi olan bir JSDoc yorumu olmalıdır.", @@ -1504,6 +1514,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "Bu söz dizimi, '{0}' içindeki yardımcı ile uyumlu olmayan, {2} parametreye sahip '{1}' adlı içeri aktarılan yardımcıyı gerektiriyor. '{0}' sürümünüzü yükseltmeyi düşünün.", "This_type_parameter_might_need_an_extends_0_constraint_2208": "Bu tür parametresinin bir `extends {0}` kısıtlamasına ihtiyacı olabilir.", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "'import' çağrısının bu kullanımı geçersiz. 'import()' çağrıları yazılabilir ancak ayraç içermeleri gerekir ve tür bağımsız değişkenleri içeremezler.", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "Bu dosyayı bir ECMAScript modülüne dönüştürmek için, '{0}' dizinine `\"type\": \"module\"` alanı ekleyin.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "Bu dosyayı bir ECMAScript modülüne dönüştürmek için dosya uzantısını '{0}' olarak değiştirin veya '{1}' dizinine ''type': 'module'' alanı ekleyin.", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "Bu dosyayı bir ECMAScript modülüne dönüştürmek için dosya uzantısını '{0}' olarak değiştirin veya `{ \"type\": \"module\" }` ile yerel bir package.json dosyası oluşturun.", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "Bu dosyayı bir ECMAScript modülüne dönüştürmek için, `{ \"type\": \"module\" }` ile yerel bir package.json dosyası oluşturun.", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "Üst düzey 'await' ifadelerine yalnızca 'module' seçeneği 'es2022', 'esnext', 'system', 'node16' veya 'nodenext' olarak ayarlandığında ve 'target' seçeneği 'es2017' veya üzeri olarak ayarlandığında izin verilir.", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": ".d.ts dosyalarındaki üst düzey bildirimler bir 'declare' veya 'export' değiştiricisi ile başlamalıdır.", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "Üst düzey 'bekleme için' döngülerine yalnızca 'modül' seçeneği 'es2022', 'esnext', 'system', 'node16' veya 'nodenext' olarak ayarlandığında ve 'target' seçeneği 'es2017' veya üstü olarak ayarlandığında izin verilir.", @@ -1519,6 +1533,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "'{0}' türü, dizin türü olarak kullanılamaz.", "Type_0_cannot_be_used_to_index_type_1_2536": "'{0}' türü, '{1}' türünü dizinlemek için kullanılamaz.", "Type_0_does_not_satisfy_the_constraint_1_2344": "'{0}' türü, '{1}' kısıtlamasını karşılamıyor.", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "'{0}' türü, beklenen '{1}' türünü karşılamıyor.", "Type_0_has_no_call_signatures_2757": "'{0}' türünün çağrı imzası yok.", "Type_0_has_no_construct_signatures_2761": "'{0}' türünün oluşturma imzası yok.", "Type_0_has_no_matching_index_signature_for_type_1_2537": "'{0}' türü, '{1}' türüyle eşleşen dizin imzasına sahip değil.", @@ -1540,6 +1555,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "'{0}' türü, '{1}' türüne 'exactOptionalPropertyTypes: true' ile atanamaz. Hedef türüne 'undefined' eklemeyi deneyin.", "Type_0_is_not_comparable_to_type_1_2678": "'{0}' türü '{1}' türüyle karşılaştırılamaz.", "Type_0_is_not_generic_2315": "'{0}' türü genel değil.", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "'{0}' tipi, 'in' operatörünün doğru işleneni olarak izin verilmeyen temel bir değeri temsil edebilir.", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "'{0}' türünün, zaman uyumsuz bir yineleyici döndüren bir '[Symbol.asyncIterator]()' metoduna sahip olması gerekir.", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "'{0}' türünün, bir yineleyici döndüren '[Symbol.iterator]()' metoduna sahip olması gerekir.", "Type_0_provides_no_match_for_the_signature_1_2658": "'{0}' türü, '{1}' imzası için eşleşme sağlamıyor.", @@ -1596,6 +1612,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== '{0}' tür başvuru yönergesi çözümlenmedi. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== '{0}' tür başvuru yönergesi '{1}' olarak başarıyla çözümlendi, birincil: {2}. ========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== '{0}' tür başvuru yönergesi '{2}' Paket Kimliğine sahip '{1}' olarak başarıyla çözümlendi, birincil: {3}. ========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "Tür karşılama ifadeleri yalnızca TypeScript dosyalarında kullanılabilir.", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "Türler, JavaScript dosyalarında dışarı aktarma bildirimlerinde görünemez.", "Types_have_separate_declarations_of_a_private_property_0_2442": "Türler, '{0}' özel özelliğinin ayrı bildirimlerine sahip.", "Types_of_construct_signatures_are_incompatible_2419": "Yapı imzalarının türleri uyumsuz.", @@ -1637,9 +1654,12 @@ "Updating_output_of_project_0_6373": "'{0}' projesinin çıkışı güncelleştiriliyor...", "Updating_output_timestamps_of_project_0_6359": "'{0}' projesinin çıkış zaman damgaları güncelleştiriliyor...", "Updating_unchanged_output_timestamps_of_project_0_6371": "'{0}' projesinin değiştirilmemiş çıkış zaman damgaları güncelleştiriliyor...", + "Use_0_95174": "`{0}` kullanın.", + "Use_Number_isNaN_in_all_conditions_95175": "Tüm koşullarda `Number.isNaN` kullanın.", "Use_element_access_for_0_95145": "'{0}' için öğe erişimi kullan", "Use_element_access_for_all_undeclared_properties_95146": "Tüm bildirilmemiş özellikler için öğe erişimi kullanın.", "Use_synthetic_default_member_95016": "Yapay 'default' üyesini kullanın.", + "Using_0_subpath_1_with_target_2_6404": "Hedef '{2}' ile '{0}' alt yol '{1}' kullanılıyor.", "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "'for...of' deyiminde dize kullanma yalnızca ECMAScript 5 veya üzerinde desteklenir.", "Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915": "--build kullanarak -b, tsc’nin derleyici yerine derleme düzenleyici gibi davranmasına yol açar. Bu, kompozit projeler oluşturmayı tetiklemek için kullanılır. Daha fazla bilgi edinmek için bkz. {0}", "Using_compiler_options_of_project_reference_redirect_0_6215": "'{0}' proje başvurusu yeniden yönlendirmesinin derleyici seçenekleri kullanılıyor.", @@ -1717,6 +1737,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "'{0}', '{1}' anahtar sözcüğü için geçerli bir meta özellik değil. Bunu mu demek istediniz: '{2}'?", "_0_is_not_allowed_as_a_parameter_name_1390": "'{0}' öğesine parametre adı olarak izin verilmiyor.", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "'{0}' öğesinin değişken bildirim adı olarak kullanılmasına izin verilmiyor.", + "_0_is_of_type_unknown_18046": "'{0}' 'unknown' türünde.", + "_0_is_possibly_null_18047": "'{0}' değerinin 'null' olması olasıdır.", + "_0_is_possibly_null_or_undefined_18049": "'{0}' değerinin 'null' veya 'undefined' olması olasıdır.", + "_0_is_possibly_undefined_18048": "'{0}' değerinin 'undefined' olması olasıdır.", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "'{0}' öğesine kendi temel ifadesinde doğrudan veya dolaylı olarak başvuruluyor.", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "'{0}' öğesine kendi tür ek açıklamasında doğrudan veya dolaylı olarak başvuruluyor.", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "'{0}' birden çok kez belirtildiğinden bu kullanımın üzerine yazılacak.", @@ -1752,6 +1776,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "Dönüş türü ek açıklaması olmayan '{0}', örtük olarak '{1}' dönüş türüne sahip.", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "Dönüş türü ek açıklaması olmayan '{0}', örtük olarak '{1}' yield türüne sahip.", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "'abstract' değiştiricisi yalnızca sınıf, metot veya özellik bildiriminde görünebilir.", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "'accessor' değiştiricisi yalnızca özellik bildiriminde görünebilir.", "and_here_6204": "ve buraya.", "arguments_cannot_be_referenced_in_property_initializers_2815": "Özellik başlatıcılarda 'arguments' öğesine başvurulamaz.", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "\"auto\": İçe aktarma, dışa aktarma, import.meta, jsx (jsx: react-jsx ile) veya esm biçimi (modül: node16+ ile) içeren dosyaları modül olarak ele alın.", diff --git a/node_modules/typescript/lib/tsc.js b/node_modules/typescript/lib/tsc.js index 74c8a3733..0ac0683ff 100644 --- a/node_modules/typescript/lib/tsc.js +++ b/node_modules/typescript/lib/tsc.js @@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); - while (_) try { + while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { @@ -68,8 +68,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) { }; var ts; (function (ts) { - ts.versionMajorMinor = "4.8"; - ts.version = "4.8.4"; + ts.versionMajorMinor = "4.9"; + ts.version = "".concat(ts.versionMajorMinor, ".3"); var NativeCollections; (function (NativeCollections) { var globals = typeof globalThis !== "undefined" ? globalThis : @@ -78,24 +78,25 @@ var ts; undefined; function tryGetNativeMap() { var gMap = globals === null || globals === void 0 ? void 0 : globals.Map; - return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + if (!constructor) { + throw new Error("No compatible Map implementation found."); + } + return constructor; } NativeCollections.tryGetNativeMap = tryGetNativeMap; function tryGetNativeSet() { var gSet = globals === null || globals === void 0 ? void 0 : globals.Set; - return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + if (!constructor) { + throw new Error("No compatible Set implementation found."); + } + return constructor; } NativeCollections.tryGetNativeSet = tryGetNativeSet; })(NativeCollections || (NativeCollections = {})); - ts.Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim"); - ts.Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim"); - function getCollectionImplementation(name, nativeFactory, shimFactory) { - var _a; - var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator); - if (constructor) - return constructor; - throw new Error("TypeScript requires an environment that provides a compatible native ".concat(name, " implementation.")); - } + ts.Map = NativeCollections.tryGetNativeMap(); + ts.Set = NativeCollections.tryGetNativeSet(); })(ts || (ts = {})); var ts; (function (ts) { @@ -759,15 +760,18 @@ var ts; function insertSorted(array, insert, compare, allowDuplicates) { if (array.length === 0) { array.push(insert); - return; + return true; } var insertIndex = binarySearch(array, insert, identity, compare); if (insertIndex < 0) { array.splice(~insertIndex, 0, insert); + return true; } - else if (allowDuplicates) { + if (allowDuplicates) { array.splice(insertIndex, 0, insert); + return true; } + return false; } ts.insertSorted = insertSorted; function sortAndDeduplicate(array, comparer, equalityComparer) { @@ -1001,6 +1005,10 @@ var ts; : undefined; } ts.singleOrUndefined = singleOrUndefined; + function single(array) { + return ts.Debug.checkDefined(singleOrUndefined(array)); + } + ts.single = single; function singleOrMany(array) { return array && array.length === 1 ? array[0] @@ -1598,8 +1606,8 @@ var ts; return compareValues(a === null || a === void 0 ? void 0 : a.start, b === null || b === void 0 ? void 0 : b.start) || compareValues(a === null || a === void 0 ? void 0 : a.length, b === null || b === void 0 ? void 0 : b.length); } ts.compareTextSpans = compareTextSpans; - function min(a, b, compare) { - return compare(a, b) === -1 ? a : b; + function min(items, compare) { + return reduceLeft(items, function (x, y) { return compare(x, y) === -1 ? x : y; }); } ts.min = min; function compareStringsCaseInsensitive(a, b) { @@ -2258,7 +2266,7 @@ var ts; if (typeof func !== "function") { return ""; } - else if (func.hasOwnProperty("name")) { + else if (ts.hasProperty(func, "name")) { return func.name; } else { @@ -2556,7 +2564,7 @@ var ts; ]; for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) { var ctor = nodeConstructors_1[_i]; - if (!ctor.prototype.hasOwnProperty("__debugKind")) { + if (!ts.hasProperty(ctor.prototype, "__debugKind")) { Object.defineProperties(ctor.prototype, { __tsDebuggerDisplay: { value: function () { @@ -2736,7 +2744,9 @@ var ts; (function (ts) { var versionRegExp = /^(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\.(0|[1-9]\d*)(?:\-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i; var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-][a-z0-9-]*))*$/i; + var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i; var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i; + var buildPartRegExp = /^[a-z0-9-]+$/i; var numericIdentifierRegExp = /^(0|[1-9]\d*)$/; var Version = (function () { function Version(major, minor, patch, prerelease, build) { @@ -2751,13 +2761,15 @@ var ts; ts.Debug.assert(major >= 0, "Invalid argument: major"); ts.Debug.assert(minor >= 0, "Invalid argument: minor"); ts.Debug.assert(patch >= 0, "Invalid argument: patch"); - ts.Debug.assert(!prerelease || prereleaseRegExp.test(prerelease), "Invalid argument: prerelease"); - ts.Debug.assert(!build || buildRegExp.test(build), "Invalid argument: build"); + var prereleaseArray = prerelease ? ts.isArray(prerelease) ? prerelease : prerelease.split(".") : ts.emptyArray; + var buildArray = build ? ts.isArray(build) ? build : build.split(".") : ts.emptyArray; + ts.Debug.assert(ts.every(prereleaseArray, function (s) { return prereleasePartRegExp.test(s); }), "Invalid argument: prerelease"); + ts.Debug.assert(ts.every(buildArray, function (s) { return buildPartRegExp.test(s); }), "Invalid argument: build"); this.major = major; this.minor = minor; this.patch = patch; - this.prerelease = prerelease ? prerelease.split(".") : ts.emptyArray; - this.build = build ? build.split(".") : ts.emptyArray; + this.prerelease = prereleaseArray; + this.build = buildArray; } Version.tryParse = function (text) { var result = tryParseComponents(text); @@ -2784,6 +2796,10 @@ var ts; default: return ts.Debug.assertNever(field); } }; + Version.prototype.with = function (fields) { + var _a = fields.major, major = _a === void 0 ? this.major : _a, _b = fields.minor, minor = _b === void 0 ? this.minor : _b, _c = fields.patch, patch = _c === void 0 ? this.patch : _c, _d = fields.prerelease, prerelease = _d === void 0 ? this.prerelease : _d, _e = fields.build, build = _e === void 0 ? this.build : _e; + return new Version(major, minor, patch, prerelease, build); + }; Version.prototype.toString = function () { var result = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch); if (ts.some(this.prerelease)) @@ -2792,7 +2808,7 @@ var ts; result += "+".concat(this.build.join(".")); return result; }; - Version.zero = new Version(0, 0, 0); + Version.zero = new Version(0, 0, 0, ["0"]); return Version; }()); ts.Version = Version; @@ -2942,19 +2958,20 @@ var ts; break; case "<": case ">=": - comparators.push(createComparator(operator, version)); + comparators.push(isWildcard(minor) || isWildcard(patch) ? createComparator(operator, version.with({ prerelease: "0" })) : + createComparator(operator, version)); break; case "<=": case ">": - comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major")) : - isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor")) : + comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major").with({ prerelease: "0" })) : + isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor").with({ prerelease: "0" })) : createComparator(operator, version)); break; case "=": case undefined: if (isWildcard(minor) || isWildcard(patch)) { - comparators.push(createComparator(">=", version)); - comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor"))); + comparators.push(createComparator(">=", version.with({ prerelease: "0" }))); + comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor").with({ prerelease: "0" }))); } else { comparators.push(createComparator("=", version)); @@ -3022,6 +3039,8 @@ var ts; typeof performance.mark === "function" && typeof performance.measure === "function" && typeof performance.now === "function" && + typeof performance.clearMarks === "function" && + typeof performance.clearMeasures === "function" && typeof PerformanceObserver === "function"; } function tryGetWebPerformanceHooks() { @@ -3059,7 +3078,9 @@ var ts; if (end === "__performance.measure-fix__") { nodePerformance_1.clearMarks("__performance.measure-fix__"); } - } + }, + clearMarks: function (name) { return nodePerformance_1.clearMarks(name); }, + clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); }, }; } return { @@ -3154,6 +3175,30 @@ var ts; durations.forEach(function (duration, measureName) { return cb(measureName, duration); }); } performance.forEachMeasure = forEachMeasure; + function forEachMark(cb) { + marks.forEach(function (_time, markName) { return cb(markName); }); + } + performance.forEachMark = forEachMark; + function clearMeasures(name) { + if (name !== undefined) + durations.delete(name); + else + durations.clear(); + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name); + } + performance.clearMeasures = clearMeasures; + function clearMarks(name) { + if (name !== undefined) { + counts.delete(name); + marks.delete(name); + } + else { + counts.clear(); + marks.clear(); + } + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name); + } + performance.clearMarks = clearMarks; function isEnabled() { return enabled; } @@ -3232,7 +3277,6 @@ var ts; var typeCatalog = []; var legendPath; var legend = []; - ; function startTracing(tracingMode, traceDir, configFilePath) { ts.Debug.assert(!ts.tracing, "Tracing already started"); if (fs === undefined) { @@ -3410,7 +3454,7 @@ var ts; var substitutionType = type; substitutionProperties = { substitutionBaseType: (_o = substitutionType.baseType) === null || _o === void 0 ? void 0 : _o.id, - substituteType: (_p = substitutionType.substitute) === null || _p === void 0 ? void 0 : _p.id, + constraintType: (_p = substitutionType.constraint) === null || _p === void 0 ? void 0 : _p.id, }; } var reverseMappedProperties = {}; @@ -3697,7 +3741,6 @@ var ts; createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels); } } - ts.setCustomPollingValues = setCustomPollingValues; function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) { var definedValueCopyToIndex = pollIndex; for (var canVisit = queue.length; chunkSize && canVisit; nextPollIndex(), canVisit--) { @@ -3835,7 +3878,6 @@ var ts; pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval)); } } - ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile; function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) { var fileWatcherCallbacks = ts.createMultiMap(); var dirWatchers = new ts.Map(); @@ -3910,37 +3952,31 @@ var ts; pollScheduled = host.setTimeout(pollQueue, PollingInterval.High); } } - function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) { - var cache = new ts.Map(); - var callbacksCache = ts.createMultiMap(); + function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) { var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - return function (fileName, callback, pollingInterval, options) { - var path = toCanonicalFileName(fileName); - var existing = cache.get(path); - if (existing) { - existing.refCount++; - } - else { - cache.set(path, { - watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options), - refCount: 1 - }); + var path = toCanonicalFileName(name); + var existing = cache.get(path); + if (existing) { + existing.callbacks.push(callback); + } + else { + cache.set(path, { + watcher: createWatcher((function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })), + callbacks: [callback] + }); + } + return { + close: function () { + var watcher = cache.get(path); + if (!watcher) + return; + if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length) + return; + cache.delete(path); + ts.closeFileWatcherOf(watcher); } - callbacksCache.add(path, callback); - return { - close: function () { - var watcher = ts.Debug.checkDefined(cache.get(path)); - callbacksCache.remove(path, callback); - watcher.refCount--; - if (watcher.refCount) - return; - cache.delete(path); - ts.closeFileWatcherOf(watcher); - } - }; }; } - ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName; function onWatchedFileStat(watchedFile, modifiedTime) { var oldTime = watchedFile.mtime.getTime(); var newTime = modifiedTime.getTime(); @@ -3951,7 +3987,6 @@ var ts; } return false; } - ts.onWatchedFileStat = onWatchedFileStat; function getFileWatcherEventKind(oldTime, newTime) { return oldTime === 0 ? FileWatcherEventKind.Created @@ -4158,11 +4193,9 @@ var ts; return ts.stringContains(toCanonicalFilePath(path), searchPath); } } - ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive; function createFileWatcherCallback(callback) { return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); }; } - ts.createFileWatcherCallback = createFileWatcherCallback; function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) { return function (eventName, _relativeFileName, modifiedTime) { if (eventName === "rename") { @@ -4189,7 +4222,10 @@ var ts; }; } function createSystemWatchFunctions(_a) { - var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatches = new ts.Map(); + var fsWatches = new ts.Map(); + var fsWatchesRecursive = new ts.Map(); var dynamicPollingWatchFile; var fixedChunkSizePollingWatchFile; var nonPollingWatchFile; @@ -4245,7 +4281,7 @@ var ts; default: return useNonPollingWatchers ? generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) : - { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval }; + { watchFile: ts.WatchFileKind.UseFsEvents }; } } function generateWatchFileOptions(watchFile, fallbackPolling, options) { @@ -4310,7 +4346,13 @@ var ts; }; } } + function pollingWatchFile(fileName, callback, pollingInterval, options) { + return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); }); + } function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { + return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); }); + } + function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { var lastDirectoryPartWithDirectorySeparator; var lastDirectoryPart; if (inodeWatching) { @@ -4448,7 +4490,7 @@ var ts; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); var _b = createSystemWatchFunctions({ - pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), + pollingWatchFileWorker: fsWatchFileWorker, getModifiedTime: getModifiedTime, setTimeout: setTimeout, clearTimeout: clearTimeout, @@ -4462,7 +4504,6 @@ var ts; tscWatchFile: process.env.TSC_WATCHFILE, useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER, tscWatchDirectory: process.env.TSC_WATCHDIRECTORY, - defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); }, inodeWatching: isLinuxOrMacOs, sysLog: sysLog, }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory; @@ -5081,12 +5122,9 @@ var ts; } ts.getPathFromPathComponents = getPathFromPathComponents; function normalizeSlashes(path) { - var index = path.indexOf("\\"); - if (index === -1) { - return path; - } - backslashRegExp.lastIndex = index; - return path.replace(backslashRegExp, ts.directorySeparator); + return path.indexOf("\\") !== -1 + ? path.replace(backslashRegExp, ts.directorySeparator) + : path; } ts.normalizeSlashes = normalizeSlashes; function reducePathComponents(components) { @@ -5589,6 +5627,8 @@ var ts; A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."), _0_modifier_cannot_appear_on_a_type_parameter: diag(1273, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_parameter_1273", "'{0}' modifier cannot appear on a type parameter"), _0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"), + accessor_modifier_can_only_appear_on_a_property_declaration: diag(1275, ts.DiagnosticCategory.Error, "accessor_modifier_can_only_appear_on_a_property_declaration_1275", "'accessor' modifier can only appear on a property declaration."), + An_accessor_property_cannot_be_declared_optional: diag(1276, ts.DiagnosticCategory.Error, "An_accessor_property_cannot_be_declared_optional_1276", "An 'accessor' property cannot be declared optional."), with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."), await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."), The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."), @@ -5639,7 +5679,7 @@ var ts; An_enum_member_name_must_be_followed_by_a_or: diag(1357, ts.DiagnosticCategory.Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."), Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, ts.DiagnosticCategory.Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."), Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here: diag(1359, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."), - Class_constructor_may_not_be_a_generator: diag(1360, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1360", "Class constructor may not be a generator."), + Type_0_does_not_satisfy_the_expected_type_1: diag(1360, ts.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_expected_type_1_1360", "Type '{0}' does not satisfy the expected type '{1}'."), _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type: diag(1361, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."), _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type: diag(1362, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."), A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both: diag(1363, ts.DiagnosticCategory.Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."), @@ -5647,6 +5687,7 @@ var ts; Convert_all_re_exported_types_to_type_only_exports: diag(1365, ts.DiagnosticCategory.Message, "Convert_all_re_exported_types_to_type_only_exports_1365", "Convert all re-exported types to type-only exports"), Split_into_two_separate_import_declarations: diag(1366, ts.DiagnosticCategory.Message, "Split_into_two_separate_import_declarations_1366", "Split into two separate import declarations"), Split_all_invalid_type_only_imports: diag(1367, ts.DiagnosticCategory.Message, "Split_all_invalid_type_only_imports_1367", "Split all invalid type-only imports"), + Class_constructor_may_not_be_a_generator: diag(1368, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."), Did_you_mean_0: diag(1369, ts.DiagnosticCategory.Message, "Did_you_mean_0_1369", "Did you mean '{0}'?"), This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, ts.DiagnosticCategory.Error, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."), Convert_to_type_only_import: diag(1373, ts.DiagnosticCategory.Message, "Convert_to_type_only_import_1373", "Convert to type-only import"), @@ -5820,14 +5861,12 @@ var ts; The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."), The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."), The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."), - The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."), - The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."), The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."), Operator_0_cannot_be_applied_to_types_1_and_2: diag(2365, ts.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."), Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: diag(2366, ts.DiagnosticCategory.Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."), - This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367", "This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap."), + This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367", "This comparison appears to be unintentional because the types '{0}' and '{1}' have no overlap."), Type_parameter_name_cannot_be_0: diag(2368, ts.DiagnosticCategory.Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."), A_parameter_property_is_only_allowed_in_a_constructor_implementation: diag(2369, ts.DiagnosticCategory.Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."), A_rest_parameter_must_be_of_an_array_type: diag(2370, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."), @@ -6070,6 +6109,7 @@ var ts; Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."), Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."), Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."), + Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, ts.DiagnosticCategory.Error, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."), Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."), A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."), Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."), @@ -6250,6 +6290,7 @@ var ts; _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"), We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."), Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), + This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."), Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), @@ -6707,6 +6748,11 @@ var ts; Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."), Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"), Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"), + Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"), + Resolving_in_0_mode_with_conditions_1: diag(6402, ts.DiagnosticCategory.Message, "Resolving_in_0_mode_with_conditions_1_6402", "Resolving in {0} mode with conditions {1}."), + Matched_0_condition_1: diag(6403, ts.DiagnosticCategory.Message, "Matched_0_condition_1_6403", "Matched '{0}' condition '{1}'."), + Using_0_subpath_1_with_target_2: diag(6404, ts.DiagnosticCategory.Message, "Using_0_subpath_1_with_target_2_6404", "Using '{0}' subpath '{1}' with target '{2}'."), + Saw_non_matching_condition_0: diag(6405, ts.DiagnosticCategory.Message, "Saw_non_matching_condition_0_6405", "Saw non-matching condition '{0}'."), The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"), The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."), The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."), @@ -6949,6 +6995,7 @@ var ts; The_tag_was_first_specified_here: diag(8034, ts.DiagnosticCategory.Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."), You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."), You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."), + Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, ts.DiagnosticCategory.Error, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."), Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."), Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."), JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17000, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."), @@ -7022,6 +7069,8 @@ var ts; Remove_type_from_import_of_0_from_1: diag(90056, ts.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", "Remove 'type' from import of '{0}' from \"{1}\""), Add_import_from_0: diag(90057, ts.DiagnosticCategory.Message, "Add_import_from_0_90057", "Add import from \"{0}\""), Update_import_from_0: diag(90058, ts.DiagnosticCategory.Message, "Update_import_from_0_90058", "Update import from \"{0}\""), + Export_0_from_module_1: diag(90059, ts.DiagnosticCategory.Message, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"), + Export_all_referenced_locals: diag(90060, ts.DiagnosticCategory.Message, "Export_all_referenced_locals_90060", "Export all referenced locals"), Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"), Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"), Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"), @@ -7120,6 +7169,7 @@ var ts; Set_the_module_option_in_your_configuration_file_to_0: diag(95099, ts.DiagnosticCategory.Message, "Set_the_module_option_in_your_configuration_file_to_0_95099", "Set the 'module' option in your configuration file to '{0}'"), Convert_invalid_character_to_its_html_entity_code: diag(95100, ts.DiagnosticCategory.Message, "Convert_invalid_character_to_its_html_entity_code_95100", "Convert invalid character to its html entity code"), Convert_all_invalid_characters_to_HTML_entity_code: diag(95101, ts.DiagnosticCategory.Message, "Convert_all_invalid_characters_to_HTML_entity_code_95101", "Convert all invalid characters to HTML entity code"), + Convert_all_const_to_let: diag(95102, ts.DiagnosticCategory.Message, "Convert_all_const_to_let_95102", "Convert all 'const' to 'let'"), Convert_function_expression_0_to_arrow_function: diag(95105, ts.DiagnosticCategory.Message, "Convert_function_expression_0_to_arrow_function_95105", "Convert function expression '{0}' to arrow function"), Convert_function_declaration_0_to_arrow_function: diag(95106, ts.DiagnosticCategory.Message, "Convert_function_declaration_0_to_arrow_function_95106", "Convert function declaration '{0}' to arrow function"), Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"), @@ -7189,6 +7239,8 @@ var ts; Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"), Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"), Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"), + Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."), + Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."), No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."), Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."), JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"), @@ -7222,6 +7274,12 @@ var ts; _0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation: diag(18042, ts.DiagnosticCategory.Error, "_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation_18042", "'{0}' is a type and cannot be imported in JavaScript files. Use '{1}' in a JSDoc type annotation."), Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."), _0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."), + Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18045, ts.DiagnosticCategory.Error, "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045", "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."), + _0_is_of_type_unknown: diag(18046, ts.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."), + _0_is_possibly_null: diag(18047, ts.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."), + _0_is_possibly_undefined: diag(18048, ts.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."), + _0_is_possibly_null_or_undefined: diag(18049, ts.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."), + The_value_0_cannot_be_used_here: diag(18050, ts.DiagnosticCategory.Error, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."), }; })(ts || (ts = {})); var ts; @@ -7237,12 +7295,13 @@ var ts; ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan; ts.textToKeywordObj = (_a = { abstract: 126, - any: 130, - as: 127, - asserts: 128, - assert: 129, - bigint: 158, - boolean: 133, + accessor: 127, + any: 131, + as: 128, + asserts: 129, + assert: 130, + bigint: 160, + boolean: 134, break: 81, case: 82, catch: 83, @@ -7250,9 +7309,9 @@ var ts; continue: 86, const: 85 }, - _a["" + "constructor"] = 134, + _a["" + "constructor"] = 135, _a.debugger = 87, - _a.declare = 135, + _a.declare = 136, _a.default = 88, _a.delete = 89, _a.do = 90, @@ -7263,60 +7322,61 @@ var ts; _a.false = 95, _a.finally = 96, _a.for = 97, - _a.from = 156, + _a.from = 158, _a.function = 98, - _a.get = 136, + _a.get = 137, _a.if = 99, _a.implements = 117, _a.import = 100, _a.in = 101, - _a.infer = 137, + _a.infer = 138, _a.instanceof = 102, _a.interface = 118, - _a.intrinsic = 138, - _a.is = 139, - _a.keyof = 140, + _a.intrinsic = 139, + _a.is = 140, + _a.keyof = 141, _a.let = 119, - _a.module = 141, - _a.namespace = 142, - _a.never = 143, + _a.module = 142, + _a.namespace = 143, + _a.never = 144, _a.new = 103, _a.null = 104, - _a.number = 147, - _a.object = 148, + _a.number = 148, + _a.object = 149, _a.package = 120, _a.private = 121, _a.protected = 122, _a.public = 123, - _a.override = 159, - _a.out = 144, - _a.readonly = 145, - _a.require = 146, - _a.global = 157, + _a.override = 161, + _a.out = 145, + _a.readonly = 146, + _a.require = 147, + _a.global = 159, _a.return = 105, - _a.set = 149, + _a.satisfies = 150, + _a.set = 151, _a.static = 124, - _a.string = 150, + _a.string = 152, _a.super = 106, _a.switch = 107, - _a.symbol = 151, + _a.symbol = 153, _a.this = 108, _a.throw = 109, _a.true = 110, _a.try = 111, - _a.type = 152, + _a.type = 154, _a.typeof = 112, - _a.undefined = 153, - _a.unique = 154, - _a.unknown = 155, + _a.undefined = 155, + _a.unique = 156, + _a.unknown = 157, _a.var = 113, _a.void = 114, _a.while = 115, _a.with = 116, _a.yield = 125, - _a.async = 131, - _a.await = 132, - _a.of = 160, + _a.async = 132, + _a.await = 133, + _a.of = 162, _a); var textToKeyword = new ts.Map(ts.getEntries(ts.textToKeywordObj)); var textToToken = new ts.Map(ts.getEntries(__assign(__assign({}, ts.textToKeywordObj), { "{": 18, "}": 19, "(": 20, ")": 21, "[": 22, "]": 23, ".": 24, "...": 25, ";": 26, ",": 27, "<": 29, ">": 31, "<=": 32, ">=": 33, "==": 34, "!=": 35, "===": 36, "!==": 37, "=>": 38, "+": 39, "-": 40, "**": 42, "*": 41, "/": 43, "%": 44, "++": 45, "--": 46, "<<": 47, ">": 48, ">>>": 49, "&": 50, "|": 51, "^": 52, "!": 53, "~": 54, "&&": 55, "||": 56, "?": 57, "??": 60, "?.": 28, ":": 58, "=": 63, "+=": 64, "-=": 65, "*=": 66, "**=": 67, "/=": 68, "%=": 69, "<<=": 70, ">>=": 71, ">>>=": 72, "&=": 73, "|=": 74, "^=": 78, "||=": 75, "&&=": 76, "??=": 77, "@": 59, "#": 62, "`": 61 }))); @@ -7380,7 +7440,7 @@ var ts; } ts.stringToToken = stringToToken; function computeLineStarts(text) { - var result = new Array(); + var result = []; var pos = 0; var lineStart = 0; while (pos < text.length) { @@ -8295,7 +8355,7 @@ var ts; return -1; } function peekExtendedUnicodeEscape() { - if (languageVersion >= 2 && codePointAt(text, pos + 1) === 117 && codePointAt(text, pos + 2) === 123) { + if (codePointAt(text, pos + 1) === 117 && codePointAt(text, pos + 2) === 123) { var start_2 = pos; pos += 3; var escapedValueString = scanMinimumNumberOfHexDigits(1, false); @@ -8812,12 +8872,31 @@ var ts; pos++; return token = 0; } - if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) { + var charAfterHash = codePointAt(text, pos + 1); + if (charAfterHash === 92) { pos++; - scanIdentifier(codePointAt(text, pos), languageVersion); + var extendedCookedChar_1 = peekExtendedUnicodeEscape(); + if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) { + pos += 3; + tokenFlags |= 8; + tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts(); + return token = 80; + } + var cookedChar_1 = peekUnicodeEscape(); + if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) { + pos += 6; + tokenFlags |= 1024; + tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts(); + return token = 80; + } + pos--; + } + if (isIdentifierStart(charAfterHash, languageVersion)) { + pos++; + scanIdentifier(charAfterHash, languageVersion); } else { - tokenValue = String.fromCharCode(codePointAt(text, pos)); + tokenValue = "#"; error(ts.Diagnostics.Invalid_character, pos++, charSize(ch)); } return token = 80; @@ -9434,9 +9513,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 163) { + if (d && d.kind === 165) { for (var current = d; current; current = current.parent) { - if (isFunctionLike(current) || isClassLike(current) || current.kind === 258) { + if (isFunctionLike(current) || isClassLike(current) || current.kind === 261) { return current; } } @@ -9444,7 +9523,7 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node, parent) { - return ts.hasSyntacticModifier(node, 16476) && parent.kind === 171; + return ts.hasSyntacticModifier(node, 16476) && parent.kind === 173; } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function isEmptyBindingPattern(node) { @@ -9474,14 +9553,14 @@ var ts; node = walkUpBindingElementsAndPatterns(node); } var flags = getFlags(node); - if (node.kind === 254) { + if (node.kind === 257) { node = node.parent; } - if (node && node.kind === 255) { + if (node && node.kind === 258) { flags |= getFlags(node); node = node.parent; } - if (node && node.kind === 237) { + if (node && node.kind === 240) { flags |= getFlags(node); } return flags; @@ -9617,30 +9696,30 @@ var ts; return getDeclarationIdentifier(hostNode); } switch (hostNode.kind) { - case 237: + case 240: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } break; - case 238: + case 241: var expr = hostNode.expression; - if (expr.kind === 221 && expr.operatorToken.kind === 63) { + if (expr.kind === 223 && expr.operatorToken.kind === 63) { expr = expr.left; } switch (expr.kind) { - case 206: + case 208: return expr.name; - case 207: + case 209: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; } } break; - case 212: { + case 214: { return getDeclarationIdentifier(hostNode.expression); } - case 250: { + case 253: { if (isDeclaration(hostNode.statement) || isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -9674,16 +9753,16 @@ var ts; switch (declaration.kind) { case 79: return declaration; - case 347: - case 340: { + case 350: + case 343: { var name = declaration.name; - if (name.kind === 161) { + if (name.kind === 163) { return name.right; } break; } - case 208: - case 221: { + case 210: + case 223: { var expr_1 = declaration; switch (ts.getAssignmentDeclarationKind(expr_1)) { case 1: @@ -9699,15 +9778,15 @@ var ts; return undefined; } } - case 345: + case 348: return getNameOfJSDocTypedef(declaration); - case 339: + case 342: return nameForNamelessJSDocTypedef(declaration); - case 271: { + case 274: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } - case 207: + case 209: var expr = declaration; if (ts.isBindableStaticElementAccessExpression(expr)) { return expr.argumentExpression; @@ -9750,7 +9829,7 @@ var ts; } ts.getDecorators = getDecorators; function getModifiers(node) { - if (ts.hasSyntacticModifier(node, 125951)) { + if (ts.hasSyntacticModifier(node, 126975)) { return ts.filter(node.modifiers, isModifier); } } @@ -9937,12 +10016,12 @@ var ts; ts.getAllJSDocTagsOfKind = getAllJSDocTagsOfKind; function getTextOfJSDocComment(comment) { return typeof comment === "string" ? comment - : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 321 ? c.text : formatJSDocLink(c); }).join(""); + : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 324 ? c.text : formatJSDocLink(c); }).join(""); } ts.getTextOfJSDocComment = getTextOfJSDocComment; function formatJSDocLink(link) { - var kind = link.kind === 324 ? "link" - : link.kind === 325 ? "linkcode" + var kind = link.kind === 327 ? "link" + : link.kind === 328 ? "linkcode" : "linkplain"; var name = link.name ? ts.entityNameToString(link.name) : ""; var space = link.name && link.text.startsWith("://") ? "" : " "; @@ -9953,7 +10032,7 @@ var ts; return ts.emptyArray; } if (ts.isJSDocTypeAlias(node)) { - ts.Debug.assert(node.parent.kind === 320); + ts.Debug.assert(node.parent.kind === 323); return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; }); } if (node.typeParameters) { @@ -9986,7 +10065,7 @@ var ts; } ts.isMemberName = isMemberName; function isGetOrSetAccessorDeclaration(node) { - return node.kind === 173 || node.kind === 172; + return node.kind === 175 || node.kind === 174; } ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration; function isPropertyAccessChain(node) { @@ -10004,10 +10083,10 @@ var ts; function isOptionalChain(node) { var kind = node.kind; return !!(node.flags & 32) && - (kind === 206 - || kind === 207 - || kind === 208 - || kind === 230); + (kind === 208 + || kind === 209 + || kind === 210 + || kind === 232); } ts.isOptionalChain = isOptionalChain; function isOptionalChainRoot(node) { @@ -10025,7 +10104,7 @@ var ts; } ts.isOutermostOptionalChain = isOutermostOptionalChain; function isNullishCoalesce(node) { - return node.kind === 221 && node.operatorToken.kind === 60; + return node.kind === 223 && node.operatorToken.kind === 60; } ts.isNullishCoalesce = isNullishCoalesce; function isConstTypeReference(node) { @@ -10042,17 +10121,17 @@ var ts; } ts.isNonNullChain = isNonNullChain; function isBreakOrContinueStatement(node) { - return node.kind === 246 || node.kind === 245; + return node.kind === 249 || node.kind === 248; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isNamedExportBindings(node) { - return node.kind === 274 || node.kind === 273; + return node.kind === 277 || node.kind === 276; } ts.isNamedExportBindings = isNamedExportBindings; function isUnparsedTextLike(node) { switch (node.kind) { - case 302: - case 303: + case 305: + case 306: return true; default: return false; @@ -10061,12 +10140,12 @@ var ts; ts.isUnparsedTextLike = isUnparsedTextLike; function isUnparsedNode(node) { return isUnparsedTextLike(node) || - node.kind === 300 || - node.kind === 304; + node.kind === 303 || + node.kind === 307; } ts.isUnparsedNode = isUnparsedNode; function isJSDocPropertyLikeTag(node) { - return node.kind === 347 || node.kind === 340; + return node.kind === 350 || node.kind === 343; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; function isNode(node) { @@ -10074,11 +10153,11 @@ var ts; } ts.isNode = isNode; function isNodeKind(kind) { - return kind >= 161; + return kind >= 163; } ts.isNodeKind = isNodeKind; function isTokenKind(kind) { - return kind >= 0 && kind <= 160; + return kind >= 0 && kind <= 162; } ts.isTokenKind = isTokenKind; function isToken(n) { @@ -10086,7 +10165,7 @@ var ts; } ts.isToken = isToken; function isNodeArray(array) { - return array.hasOwnProperty("pos") && array.hasOwnProperty("end"); + return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end"); } ts.isNodeArray = isNodeArray; function isLiteralKind(kind) { @@ -10099,11 +10178,11 @@ var ts; ts.isLiteralExpression = isLiteralExpression; function isLiteralExpressionOfObject(node) { switch (node.kind) { - case 205: - case 204: + case 207: + case 206: case 13: - case 213: - case 226: + case 215: + case 228: return true; } return false; @@ -10129,13 +10208,13 @@ var ts; ts.isImportOrExportSpecifier = isImportOrExportSpecifier; function isTypeOnlyImportOrExportDeclaration(node) { switch (node.kind) { - case 270: - case 275: + case 273: + case 278: return node.isTypeOnly || node.parent.parent.isTypeOnly; - case 268: + case 271: return node.parent.isTypeOnly; - case 267: - case 265: + case 270: + case 268: return node.isTypeOnly; default: return false; @@ -10154,6 +10233,10 @@ var ts; return ts.isIdentifier(node) && (node.autoGenerateFlags & 7) > 0; } ts.isGeneratedIdentifier = isGeneratedIdentifier; + function isGeneratedPrivateIdentifier(node) { + return ts.isPrivateIdentifier(node) && (node.autoGenerateFlags & 7) > 0; + } + ts.isGeneratedPrivateIdentifier = isGeneratedPrivateIdentifier; function isPrivateIdentifierClassElementDeclaration(node) { return (ts.isPropertyDeclaration(node) || isMethodOrAccessor(node)) && ts.isPrivateIdentifier(node.name); } @@ -10165,19 +10248,20 @@ var ts; function isModifierKind(token) { switch (token) { case 126: - case 131: + case 127: + case 132: case 85: - case 135: + case 136: case 88: case 93: case 101: case 123: case 121: case 122: - case 145: + case 146: case 124: - case 144: - case 159: + case 145: + case 161: return true; } return false; @@ -10188,7 +10272,10 @@ var ts; } ts.isParameterPropertyModifier = isParameterPropertyModifier; function isClassMemberModifier(idToken) { - return isParameterPropertyModifier(idToken) || idToken === 124 || idToken === 159; + return isParameterPropertyModifier(idToken) || + idToken === 124 || + idToken === 161 || + idToken === 127; } ts.isClassMemberModifier = isClassMemberModifier; function isModifier(node) { @@ -10197,7 +10284,7 @@ var ts; ts.isModifier = isModifier; function isEntityName(node) { var kind = node.kind; - return kind === 161 + return kind === 163 || kind === 79; } ts.isEntityName = isEntityName; @@ -10207,14 +10294,14 @@ var ts; || kind === 80 || kind === 10 || kind === 8 - || kind === 162; + || kind === 164; } ts.isPropertyName = isPropertyName; function isBindingName(node) { var kind = node.kind; return kind === 79 - || kind === 201 - || kind === 202; + || kind === 203 + || kind === 204; } ts.isBindingName = isBindingName; function isFunctionLike(node) { @@ -10235,13 +10322,13 @@ var ts; ts.isBooleanLiteral = isBooleanLiteral; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 256: - case 169: + case 259: case 171: - case 172: case 173: - case 213: - case 214: + case 174: + case 175: + case 215: + case 216: return true; default: return false; @@ -10249,14 +10336,14 @@ var ts; } function isFunctionLikeKind(kind) { switch (kind) { - case 168: - case 174: - case 323: - case 175: + case 170: case 176: - case 179: - case 317: - case 180: + case 326: + case 177: + case 178: + case 181: + case 320: + case 182: return true; default: return isFunctionLikeDeclarationKind(kind); @@ -10269,48 +10356,64 @@ var ts; ts.isFunctionOrModuleBlock = isFunctionOrModuleBlock; function isClassElement(node) { var kind = node.kind; - return kind === 171 - || kind === 167 + return kind === 173 || kind === 169 + || kind === 171 + || kind === 174 + || kind === 175 + || kind === 178 || kind === 172 - || kind === 173 - || kind === 176 - || kind === 170 - || kind === 234; + || kind === 237; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 257 || node.kind === 226); + return node && (node.kind === 260 || node.kind === 228); } ts.isClassLike = isClassLike; function isAccessor(node) { - return node && (node.kind === 172 || node.kind === 173); + return node && (node.kind === 174 || node.kind === 175); } ts.isAccessor = isAccessor; + function isAutoAccessorPropertyDeclaration(node) { + return ts.isPropertyDeclaration(node) && ts.hasAccessorModifier(node); + } + ts.isAutoAccessorPropertyDeclaration = isAutoAccessorPropertyDeclaration; function isMethodOrAccessor(node) { switch (node.kind) { - case 169: - case 172: - case 173: + case 171: + case 174: + case 175: return true; default: return false; } } ts.isMethodOrAccessor = isMethodOrAccessor; + function isNamedClassElement(node) { + switch (node.kind) { + case 171: + case 174: + case 175: + case 169: + return true; + default: + return false; + } + } + ts.isNamedClassElement = isNamedClassElement; function isModifierLike(node) { return isModifier(node) || ts.isDecorator(node); } ts.isModifierLike = isModifierLike; function isTypeElement(node) { var kind = node.kind; - return kind === 175 - || kind === 174 - || kind === 166 - || kind === 168 + return kind === 177 || kind === 176 - || kind === 172 - || kind === 173; + || kind === 168 + || kind === 170 + || kind === 178 + || kind === 174 + || kind === 175; } ts.isTypeElement = isTypeElement; function isClassOrTypeElement(node) { @@ -10319,12 +10422,12 @@ var ts; ts.isClassOrTypeElement = isClassOrTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 296 - || kind === 297 - || kind === 298 - || kind === 169 - || kind === 172 - || kind === 173; + return kind === 299 + || kind === 300 + || kind === 301 + || kind === 171 + || kind === 174 + || kind === 175; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; function isTypeNode(node) { @@ -10333,8 +10436,8 @@ var ts; ts.isTypeNode = isTypeNode; function isFunctionOrConstructorTypeNode(node) { switch (node.kind) { - case 179: - case 180: + case 181: + case 182: return true; } return false; @@ -10343,29 +10446,29 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 202 - || kind === 201; + return kind === 204 + || kind === 203; } return false; } ts.isBindingPattern = isBindingPattern; function isAssignmentPattern(node) { var kind = node.kind; - return kind === 204 - || kind === 205; + return kind === 206 + || kind === 207; } ts.isAssignmentPattern = isAssignmentPattern; function isArrayBindingElement(node) { var kind = node.kind; - return kind === 203 - || kind === 227; + return kind === 205 + || kind === 229; } ts.isArrayBindingElement = isArrayBindingElement; function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 254: - case 164: - case 203: + case 257: + case 166: + case 205: return true; } return false; @@ -10378,8 +10481,8 @@ var ts; ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern; function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 201: - case 205: + case 203: + case 207: return true; } return false; @@ -10387,10 +10490,10 @@ var ts; ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern; function isObjectBindingOrAssignmentElement(node) { switch (node.kind) { - case 203: - case 296: - case 297: - case 298: + case 205: + case 299: + case 300: + case 301: return true; } return false; @@ -10398,8 +10501,8 @@ var ts; ts.isObjectBindingOrAssignmentElement = isObjectBindingOrAssignmentElement; function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 202: case 204: + case 206: return true; } return false; @@ -10407,25 +10510,25 @@ var ts; ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern; function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { var kind = node.kind; - return kind === 206 - || kind === 161 - || kind === 200; + return kind === 208 + || kind === 163 + || kind === 202; } ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 206 - || kind === 161; + return kind === 208 + || kind === 163; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { - case 280: - case 279: - case 208: - case 209: + case 283: + case 282: case 210: - case 165: + case 211: + case 212: + case 167: return true; default: return false; @@ -10433,12 +10536,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 208 || node.kind === 209; + return node.kind === 210 || node.kind === 211; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 223 + return kind === 225 || kind === 14; } ts.isTemplateLiteral = isTemplateLiteral; @@ -10448,19 +10551,19 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 206: - case 207: - case 209: case 208: - case 278: - case 279: - case 282: + case 209: + case 211: case 210: - case 204: + case 281: + case 282: + case 285: case 212: - case 205: - case 226: - case 213: + case 206: + case 214: + case 207: + case 228: + case 215: case 79: case 80: case 13: @@ -10468,15 +10571,15 @@ var ts; case 9: case 10: case 14: - case 223: + case 225: case 95: case 104: case 108: case 110: case 106: + case 232: case 230: - case 228: - case 231: + case 233: case 100: return true; default: @@ -10489,13 +10592,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 219: - case 220: - case 215: - case 216: + case 221: + case 222: case 217: case 218: - case 211: + case 219: + case 220: + case 213: return true; default: return isLeftHandSideExpressionKind(kind); @@ -10503,9 +10606,9 @@ var ts; } function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 220: + case 222: return true; - case 219: + case 221: return expr.operator === 45 || expr.operator === 46; default: @@ -10519,15 +10622,16 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 222: case 224: - case 214: - case 221: - case 225: - case 229: + case 226: + case 216: + case 223: case 227: - case 351: - case 350: + case 231: + case 229: + case 354: + case 353: + case 235: return true; default: return isUnaryExpressionKind(kind); @@ -10535,8 +10639,8 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 211 - || kind === 229; + return kind === 213 + || kind === 231; } ts.isAssertionExpression = isAssertionExpression; function isNotEmittedOrPartiallyEmittedNode(node) { @@ -10546,13 +10650,13 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 242: + case 245: + case 246: + case 247: case 243: case 244: - case 240: - case 241: return true; - case 250: + case 253: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -10575,7 +10679,7 @@ var ts; } ts.isExternalModuleIndicator = isExternalModuleIndicator; function isForInOrOfStatement(node) { - return node.kind === 243 || node.kind === 244; + return node.kind === 246 || node.kind === 247; } ts.isForInOrOfStatement = isForInOrOfStatement; function isConciseBody(node) { @@ -10594,110 +10698,110 @@ var ts; ts.isForInitializer = isForInitializer; function isModuleBody(node) { var kind = node.kind; - return kind === 262 - || kind === 261 + return kind === 265 + || kind === 264 || kind === 79; } ts.isModuleBody = isModuleBody; function isNamespaceBody(node) { var kind = node.kind; - return kind === 262 - || kind === 261; + return kind === 265 + || kind === 264; } ts.isNamespaceBody = isNamespaceBody; function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 79 - || kind === 261; + || kind === 264; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; function isNamedImportBindings(node) { var kind = node.kind; - return kind === 269 - || kind === 268; + return kind === 272 + || kind === 271; } ts.isNamedImportBindings = isNamedImportBindings; function isModuleOrEnumDeclaration(node) { - return node.kind === 261 || node.kind === 260; + return node.kind === 264 || node.kind === 263; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 214 - || kind === 203 - || kind === 257 - || kind === 226 - || kind === 170 - || kind === 171 + return kind === 216 + || kind === 205 || kind === 260 - || kind === 299 - || kind === 275 - || kind === 256 - || kind === 213 + || kind === 228 || kind === 172 - || kind === 267 - || kind === 265 + || kind === 173 + || kind === 263 + || kind === 302 + || kind === 278 + || kind === 259 + || kind === 215 + || kind === 174 || kind === 270 - || kind === 258 - || kind === 285 - || kind === 169 - || kind === 168 + || kind === 268 + || kind === 273 || kind === 261 + || kind === 288 + || kind === 171 + || kind === 170 || kind === 264 - || kind === 268 - || kind === 274 - || kind === 164 - || kind === 296 - || kind === 167 + || kind === 267 + || kind === 271 + || kind === 277 || kind === 166 - || kind === 173 - || kind === 297 - || kind === 259 - || kind === 163 - || kind === 254 - || kind === 345 - || kind === 338 - || kind === 347; + || kind === 299 + || kind === 169 + || kind === 168 + || kind === 175 + || kind === 300 + || kind === 262 + || kind === 165 + || kind === 257 + || kind === 348 + || kind === 341 + || kind === 350; } function isDeclarationStatementKind(kind) { - return kind === 256 - || kind === 276 - || kind === 257 - || kind === 258 - || kind === 259 + return kind === 259 + || kind === 279 || kind === 260 || kind === 261 - || kind === 266 - || kind === 265 - || kind === 272 - || kind === 271 - || kind === 264; + || kind === 262 + || kind === 263 + || kind === 264 + || kind === 269 + || kind === 268 + || kind === 275 + || kind === 274 + || kind === 267; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 246 + return kind === 249 + || kind === 248 + || kind === 256 + || kind === 243 + || kind === 241 + || kind === 239 + || kind === 246 + || kind === 247 || kind === 245 + || kind === 242 || kind === 253 + || kind === 250 + || kind === 252 + || kind === 254 + || kind === 255 || kind === 240 - || kind === 238 - || kind === 236 - || kind === 243 || kind === 244 - || kind === 242 - || kind === 239 - || kind === 250 - || kind === 247 - || kind === 249 || kind === 251 - || kind === 252 - || kind === 237 - || kind === 241 - || kind === 248 - || kind === 349 - || kind === 353 - || kind === 352; + || kind === 352 + || kind === 356 + || kind === 355; } function isDeclaration(node) { - if (node.kind === 163) { - return (node.parent && node.parent.kind !== 344) || ts.isInJSFile(node); + if (node.kind === 165) { + return (node.parent && node.parent.kind !== 347) || ts.isInJSFile(node); } return isDeclarationKind(node.kind); } @@ -10718,10 +10822,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 235) + if (node.kind !== 238) return false; if (node.parent !== undefined) { - if (node.parent.kind === 252 || node.parent.kind === 292) { + if (node.parent.kind === 255 || node.parent.kind === 295) { return false; } } @@ -10731,13 +10835,13 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 235; + || kind === 238; } ts.isStatementOrBlock = isStatementOrBlock; function isModuleReference(node) { var kind = node.kind; - return kind === 277 - || kind === 161 + return kind === 280 + || kind === 163 || kind === 79; } ts.isModuleReference = isModuleReference; @@ -10745,50 +10849,50 @@ var ts; var kind = node.kind; return kind === 108 || kind === 79 - || kind === 206; + || kind === 208; } ts.isJsxTagNameExpression = isJsxTagNameExpression; function isJsxChild(node) { var kind = node.kind; - return kind === 278 - || kind === 288 - || kind === 279 + return kind === 281 + || kind === 291 + || kind === 282 || kind === 11 - || kind === 282; + || kind === 285; } ts.isJsxChild = isJsxChild; function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 285 - || kind === 287; + return kind === 288 + || kind === 290; } ts.isJsxAttributeLike = isJsxAttributeLike; function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 10 - || kind === 288; + || kind === 291; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 280 - || kind === 279; + return kind === 283 + || kind === 282; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 289 - || kind === 290; + return kind === 292 + || kind === 293; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; function isJSDocNode(node) { - return node.kind >= 309 && node.kind <= 347; + return node.kind >= 312 && node.kind <= 350; } ts.isJSDocNode = isJSDocNode; function isJSDocCommentContainingNode(node) { - return node.kind === 320 - || node.kind === 319 - || node.kind === 321 + return node.kind === 323 + || node.kind === 322 + || node.kind === 324 || isJSDocLinkLike(node) || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) @@ -10796,15 +10900,15 @@ var ts; } ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode; function isJSDocTag(node) { - return node.kind >= 327 && node.kind <= 347; + return node.kind >= 330 && node.kind <= 350; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { - return node.kind === 173; + return node.kind === 175; } ts.isSetAccessor = isSetAccessor; function isGetAccessor(node) { - return node.kind === 172; + return node.kind === 174; } ts.isGetAccessor = isGetAccessor; function hasJSDocNodes(node) { @@ -10822,12 +10926,12 @@ var ts; ts.hasInitializer = hasInitializer; function hasOnlyExpressionInitializer(node) { switch (node.kind) { - case 254: - case 164: - case 203: - case 167: - case 296: + case 257: + case 166: + case 205: + case 169: case 299: + case 302: return true; default: return false; @@ -10835,11 +10939,11 @@ var ts; } ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { - return node.kind === 285 || node.kind === 287 || isObjectLiteralElementLike(node); + return node.kind === 288 || node.kind === 290 || isObjectLiteralElementLike(node); } ts.isObjectLiteralElement = isObjectLiteralElement; function isTypeReferenceType(node) { - return node.kind === 178 || node.kind === 228; + return node.kind === 180 || node.kind === 230; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -10871,7 +10975,7 @@ var ts; } ts.isStringLiteralLike = isStringLiteralLike; function isJSDocLinkLike(node) { - return node.kind === 324 || node.kind === 325 || node.kind === 326; + return node.kind === 327 || node.kind === 328 || node.kind === 329; } ts.isJSDocLinkLike = isJSDocLinkLike; function hasRestParameter(s) { @@ -10881,7 +10985,7 @@ var ts; ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type; - return node.dotDotDotToken !== undefined || !!type && type.kind === 318; + return node.dotDotDotToken !== undefined || !!type && type.kind === 321; } ts.isRestParameter = isRestParameter; })(ts || (ts = {})); @@ -11120,7 +11224,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 305) { + while (node && node.kind !== 308) { node = node.parent; } return node; @@ -11136,11 +11240,11 @@ var ts; ts.isPlainJsFile = isPlainJsFile; function isStatementWithLocals(node) { switch (node.kind) { - case 235: - case 263: - case 242: - case 243: - case 244: + case 238: + case 266: + case 245: + case 246: + case 247: return true; } return false; @@ -11290,7 +11394,7 @@ var ts; if (includeJsDoc && ts.hasJSDocNodes(node)) { return getTokenPosOfNode(node.jsDoc[0], sourceFile); } - if (node.kind === 348 && node._children.length > 0) { + if (node.kind === 351 && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, false, false, isInJSDoc(node)); @@ -11345,7 +11449,6 @@ var ts; return emitNode && emitNode.flags || 0; } ts.getEmitFlags = getEmitFlags; - ; function getScriptTargetFeatures() { return { es2015: { @@ -11502,7 +11605,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 254 && node.parent.kind === 292; + return node.kind === 257 && node.parent.kind === 295; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -11526,11 +11629,11 @@ var ts; } ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { - return !!node && node.kind === 261 && (!node.body); + return !!node && node.kind === 264 && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 305 || - node.kind === 261 || + return node.kind === 308 || + node.kind === 264 || ts.isFunctionLikeOrClassStaticBlockDeclaration(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -11544,9 +11647,9 @@ var ts; ts.isExternalModuleAugmentation = isExternalModuleAugmentation; function isModuleAugmentationExternal(node) { switch (node.parent.kind) { - case 305: + case 308: return ts.isExternalModule(node.parent); - case 262: + case 265: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -11592,26 +11695,30 @@ var ts; return false; } ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile; + function isAmbientPropertyDeclaration(node) { + return !!(node.flags & 16777216) || hasSyntacticModifier(node, 2); + } + ts.isAmbientPropertyDeclaration = isAmbientPropertyDeclaration; function isBlockScope(node, parentNode) { switch (node.kind) { - case 305: - case 263: - case 292: - case 261: - case 242: - case 243: - case 244: + case 308: + case 266: + case 295: + case 264: + case 245: + case 246: + case 247: + case 173: case 171: + case 174: + case 175: + case 259: + case 215: + case 216: case 169: case 172: - case 173: - case 256: - case 213: - case 214: - case 167: - case 170: return true; - case 235: + case 238: return !ts.isFunctionLikeOrClassStaticBlockDeclaration(parentNode); } return false; @@ -11619,9 +11726,9 @@ var ts; ts.isBlockScope = isBlockScope; function isDeclarationWithTypeParameters(node) { switch (node.kind) { - case 338: - case 345: - case 323: + case 341: + case 348: + case 326: return true; default: ts.assertType(node); @@ -11631,25 +11738,25 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isDeclarationWithTypeParameterChildren(node) { switch (node.kind) { - case 174: - case 175: - case 168: case 176: - case 179: - case 180: - case 317: - case 257: - case 226: - case 258: + case 177: + case 170: + case 178: + case 181: + case 182: + case 320: + case 260: + case 228: + case 261: + case 262: + case 347: case 259: - case 344: - case 256: - case 169: case 171: - case 172: case 173: - case 213: - case 214: + case 174: + case 175: + case 215: + case 216: return true; default: ts.assertType(node); @@ -11659,8 +11766,8 @@ var ts; ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren; function isAnyImportSyntax(node) { switch (node.kind) { - case 266: - case 265: + case 269: + case 268: return true; default: return false; @@ -11673,15 +11780,15 @@ var ts; ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire; function isLateVisibilityPaintedStatement(node) { switch (node.kind) { - case 266: - case 265: - case 237: - case 257: - case 256: - case 261: - case 259: - case 258: + case 269: + case 268: + case 240: case 260: + case 259: + case 264: + case 262: + case 261: + case 263: return true; default: return false; @@ -11717,19 +11824,19 @@ var ts; } ts.getNameFromIndexInfo = getNameFromIndexInfo; function isComputedNonLiteralName(name) { - return name.kind === 162 && !isStringOrNumericLiteralLike(name.expression); + return name.kind === 164 && !isStringOrNumericLiteralLike(name.expression); } ts.isComputedNonLiteralName = isComputedNonLiteralName; function tryGetTextOfPropertyName(name) { switch (name.kind) { case 79: case 80: - return name.escapedText; + return name.autoGenerateFlags ? undefined : name.escapedText; case 10: case 8: case 14: return ts.escapeLeadingUnderscores(name.text); - case 162: + case 164: if (isStringOrNumericLiteralLike(name.expression)) return ts.escapeLeadingUnderscores(name.expression.text); return undefined; @@ -11749,16 +11856,16 @@ var ts; case 80: case 79: return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); - case 161: + case 163: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 206: + case 208: if (ts.isIdentifier(name.name) || ts.isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { return ts.Debug.assertNever(name.name); } - case 311: + case 314: return entityNameToString(name.left) + entityNameToString(name.right); default: return ts.Debug.assertNever(name); @@ -11848,7 +11955,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 235) { + if (node.body && node.body.kind === 238) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -11860,35 +11967,35 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 305: + case 308: var pos_1 = ts.skipTrivia(sourceFile.text, 0, false); if (pos_1 === sourceFile.text.length) { return ts.createTextSpan(0, 0); } return getSpanOfTokenAtPosition(sourceFile, pos_1); - case 254: - case 203: case 257: - case 226: - case 258: - case 261: + case 205: case 260: - case 299: - case 256: - case 213: - case 169: - case 172: - case 173: + case 228: + case 261: + case 264: + case 263: + case 302: case 259: - case 167: - case 166: - case 268: + case 215: + case 171: + case 174: + case 175: + case 262: + case 169: + case 168: + case 271: errorNode = node.name; break; - case 214: + case 216: return getErrorSpanForArrowFunction(sourceFile, node); - case 289: - case 290: + case 292: + case 293: var start = ts.skipTrivia(sourceFile.text, node.pos); var end = node.statements.length > 0 ? node.statements[0].pos : node.end; return ts.createTextSpanFromBounds(start, end); @@ -11937,11 +12044,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 208 && n.expression.kind === 106; + return n.kind === 210 && n.expression.kind === 106; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 208 && n.expression.kind === 100; + return n.kind === 210 && n.expression.kind === 100; } ts.isImportCall = isImportCall; function isImportMeta(n) { @@ -11955,7 +12062,7 @@ var ts; } ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 238 + return node.kind === 241 && node.expression.kind === 10; } ts.isPrologueDirective = isPrologueDirective; @@ -11983,13 +12090,13 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 164 || - node.kind === 163 || - node.kind === 213 || + var commentRanges = (node.kind === 166 || + node.kind === 165 || + node.kind === 215 || + node.kind === 216 || node.kind === 214 || - node.kind === 212 || - node.kind === 254 || - node.kind === 275) ? + node.kind === 257 || + node.kind === 278) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); return ts.filter(commentRanges, function (comment) { @@ -12004,79 +12111,79 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (177 <= node.kind && node.kind <= 200) { + if (179 <= node.kind && node.kind <= 202) { return true; } switch (node.kind) { - case 130: - case 155: - case 147: - case 158: - case 150: - case 133: - case 151: + case 131: + case 157: case 148: + case 160: + case 152: + case 134: case 153: - case 143: + case 149: + case 155: + case 144: return true; case 114: - return node.parent.kind !== 217; - case 228: + return node.parent.kind !== 219; + case 230: return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 163: - return node.parent.kind === 195 || node.parent.kind === 190; + case 165: + return node.parent.kind === 197 || node.parent.kind === 192; case 79: - if (node.parent.kind === 161 && node.parent.right === node) { + if (node.parent.kind === 163 && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 206 && node.parent.name === node) { + else if (node.parent.kind === 208 && node.parent.name === node) { node = node.parent; } - ts.Debug.assert(node.kind === 79 || node.kind === 161 || node.kind === 206, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); - case 161: - case 206: + ts.Debug.assert(node.kind === 79 || node.kind === 163 || node.kind === 208, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + case 163: + case 208: case 108: { var parent = node.parent; - if (parent.kind === 181) { + if (parent.kind === 183) { return false; } - if (parent.kind === 200) { + if (parent.kind === 202) { return !parent.isTypeOf; } - if (177 <= parent.kind && parent.kind <= 200) { + if (179 <= parent.kind && parent.kind <= 202) { return true; } switch (parent.kind) { - case 228: + case 230: return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent); - case 163: + case 165: return node === parent.constraint; - case 344: + case 347: return node === parent.constraint; - case 167: - case 166: - case 164: - case 254: - return node === parent.type; - case 256: - case 213: - case 214: - case 171: case 169: case 168: - case 172: - case 173: + case 166: + case 257: return node === parent.type; + case 259: + case 215: + case 216: + case 173: + case 171: + case 170: case 174: case 175: + return node === parent.type; case 176: + case 177: + case 178: return node === parent.type; - case 211: + case 213: return node === parent.type; - case 208: - case 209: - return ts.contains(parent.typeArguments, node); case 210: + case 211: + return ts.contains(parent.typeArguments, node); + case 212: return false; } } @@ -12098,23 +12205,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 247: + case 250: return visitor(node); - case 263: - case 235: - case 239: - case 240: - case 241: + case 266: + case 238: case 242: case 243: case 244: - case 248: - case 249: - case 289: - case 290: - case 250: + case 245: + case 246: + case 247: + case 251: case 252: case 292: + case 293: + case 253: + case 255: + case 295: return ts.forEachChild(node, traverse); } } @@ -12124,21 +12231,21 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 224: + case 226: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 260: - case 258: + case 263: case 261: - case 259: + case 264: + case 262: return; default: if (ts.isFunctionLike(node)) { - if (node.name && node.name.kind === 162) { + if (node.name && node.name.kind === 164) { traverse(node.name.expression); return; } @@ -12151,10 +12258,10 @@ var ts; } ts.forEachYieldExpression = forEachYieldExpression; function getRestParameterElementType(node) { - if (node && node.kind === 183) { + if (node && node.kind === 185) { return node.elementType; } - else if (node && node.kind === 178) { + else if (node && node.kind === 180) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -12164,12 +12271,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { - case 258: - case 257: - case 226: - case 182: + case 261: + case 260: + case 228: + case 184: return node.members; - case 205: + case 207: return node.properties; } } @@ -12177,14 +12284,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 203: - case 299: - case 164: - case 296: - case 167: + case 205: + case 302: case 166: - case 297: - case 254: + case 299: + case 169: + case 168: + case 300: + case 257: return true; } } @@ -12196,8 +12303,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 255 - && node.parent.parent.kind === 237; + return node.parent.kind === 258 + && node.parent.parent.kind === 240; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isCommonJsExportedExpression(node) { @@ -12221,13 +12328,13 @@ var ts; ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 169: - case 168: case 171: - case 172: + case 170: case 173: - case 256: - case 213: + case 174: + case 175: + case 259: + case 215: return true; } return false; @@ -12238,7 +12345,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 250) { + if (node.statement.kind !== 253) { return node.statement; } node = node.statement; @@ -12246,17 +12353,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 235 && ts.isFunctionLike(node.parent); + return node && node.kind === 238 && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 169 && node.parent.kind === 205; + return node && node.kind === 171 && node.parent.kind === 207; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethodOrAccessor(node) { - return (node.kind === 169 || node.kind === 172 || node.kind === 173) && - (node.parent.kind === 205 || - node.parent.kind === 226); + return (node.kind === 171 || node.kind === 174 || node.kind === 175) && + (node.parent.kind === 207 || + node.parent.kind === 228); } ts.isObjectLiteralOrClassExpressionMethodOrAccessor = isObjectLiteralOrClassExpressionMethodOrAccessor; function isIdentifierTypePredicate(predicate) { @@ -12269,7 +12376,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return objectLiteral.properties.filter(function (property) { - if (property.kind === 296) { + if (property.kind === 299) { var propName = tryGetTextOfPropertyName(property.name); return key === propName || (!!key2 && key2 === propName); } @@ -12331,47 +12438,47 @@ var ts; } ts.getContainingFunctionOrClassStaticBlock = getContainingFunctionOrClassStaticBlock; function getThisContainer(node, includeArrowFunctions) { - ts.Debug.assert(node.kind !== 305); + ts.Debug.assert(node.kind !== 308); while (true) { node = node.parent; if (!node) { return ts.Debug.fail(); } switch (node.kind) { - case 162: + case 164: if (ts.isClassLike(node.parent.parent)) { return node; } node = node.parent; break; - case 165: - if (node.parent.kind === 164 && ts.isClassElement(node.parent.parent)) { + case 167: + if (node.parent.kind === 166 && ts.isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (ts.isClassElement(node.parent)) { node = node.parent; } break; - case 214: + case 216: if (!includeArrowFunctions) { continue; } - case 256: - case 213: - case 261: - case 170: - case 167: - case 166: + case 259: + case 215: + case 264: + case 172: case 169: case 168: case 171: - case 172: + case 170: case 173: case 174: case 175: case 176: - case 260: - case 305: + case 177: + case 178: + case 263: + case 308: return node; } } @@ -12379,17 +12486,17 @@ var ts; ts.getThisContainer = getThisContainer; function isThisContainerOrFunctionBlock(node) { switch (node.kind) { - case 214: - case 256: - case 213: - case 167: + case 216: + case 259: + case 215: + case 169: return true; - case 235: + case 238: switch (node.parent.kind) { - case 171: - case 169: - case 172: case 173: + case 171: + case 174: + case 175: return true; default: return false; @@ -12411,9 +12518,9 @@ var ts; var container = getThisContainer(node, false); if (container) { switch (container.kind) { - case 171: - case 256: - case 213: + case 173: + case 259: + case 215: return container; } } @@ -12427,26 +12534,26 @@ var ts; return node; } switch (node.kind) { - case 162: + case 164: node = node.parent; break; - case 256: - case 213: - case 214: + case 259: + case 215: + case 216: if (!stopOnFunctions) { continue; } - case 167: - case 166: case 169: case 168: case 171: - case 172: - case 173: case 170: + case 173: + case 174: + case 175: + case 172: return node; - case 165: - if (node.parent.kind === 164 && ts.isClassElement(node.parent.parent)) { + case 167: + if (node.parent.kind === 166 && ts.isClassElement(node.parent.parent)) { node = node.parent.parent; } else if (ts.isClassElement(node.parent)) { @@ -12458,14 +12565,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 213 || func.kind === 214) { + if (func.kind === 215 || func.kind === 216) { var prev = func; var parent = func.parent; - while (parent.kind === 212) { + while (parent.kind === 214) { prev = parent; parent = parent.parent; } - if (parent.kind === 208 && parent.expression === prev) { + if (parent.kind === 210 && parent.expression === prev) { return parent; } } @@ -12478,13 +12585,13 @@ var ts; ts.isSuperOrSuperProperty = isSuperOrSuperProperty; function isSuperProperty(node) { var kind = node.kind; - return (kind === 206 || kind === 207) + return (kind === 208 || kind === 209) && node.expression.kind === 106; } ts.isSuperProperty = isSuperProperty; function isThisProperty(node) { var kind = node.kind; - return (kind === 206 || kind === 207) + return (kind === 208 || kind === 209) && node.expression.kind === 108; } ts.isThisProperty = isThisProperty; @@ -12503,14 +12610,14 @@ var ts; ts.isThisInitializedObjectBindingExpression = isThisInitializedObjectBindingExpression; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 178: + case 180: return node.typeName; - case 228: + case 230: return isEntityNameExpression(node.expression) ? node.expression : undefined; case 79: - case 161: + case 163: return node; } return undefined; @@ -12518,10 +12625,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 210: + case 212: return node.tag; - case 280: - case 279: + case 283: + case 282: return node.tagName; default: return node.expression; @@ -12533,21 +12640,21 @@ var ts; return false; } switch (node.kind) { - case 257: + case 260: return true; - case 167: - return parent.kind === 257; - case 172: - case 173: case 169: + return parent.kind === 260; + case 174: + case 175: + case 171: return node.body !== undefined - && parent.kind === 257; - case 164: + && parent.kind === 260; + case 166: return parent.body !== undefined - && (parent.kind === 171 - || parent.kind === 169 - || parent.kind === 173) - && grandparent.kind === 257; + && (parent.kind === 173 + || parent.kind === 171 + || parent.kind === 175) + && grandparent.kind === 260; } return false; } @@ -12563,11 +12670,11 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 257: + case 260: return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); - case 169: - case 173: case 171: + case 175: + case 173: return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); default: return false; @@ -12583,9 +12690,9 @@ var ts; ts.classOrConstructorParameterIsDecorated = classOrConstructorParameterIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 280 || - parent.kind === 279 || - parent.kind === 281) { + if (parent.kind === 283 || + parent.kind === 282 || + parent.kind === 284) { return parent.tagName === node; } return false; @@ -12598,53 +12705,54 @@ var ts; case 110: case 95: case 13: - case 204: - case 205: case 206: case 207: case 208: case 209: case 210: - case 229: case 211: - case 230: case 212: + case 231: case 213: - case 226: + case 235: + case 232: case 214: - case 217: case 215: + case 228: case 216: case 219: - case 220: + case 217: + case 218: case 221: case 222: - case 225: case 223: + case 224: case 227: - case 278: - case 279: + case 225: + case 229: + case 281: case 282: - case 224: - case 218: - case 231: + case 285: + case 226: + case 220: + case 233: return true; - case 228: + case 230: return !ts.isHeritageClause(node.parent); - case 161: - while (node.parent.kind === 161) { + case 163: + while (node.parent.kind === 163) { node = node.parent; } - return node.parent.kind === 181 || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); - case 311: + return node.parent.kind === 183 || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + case 314: while (ts.isJSDocMemberName(node.parent)) { node = node.parent; } - return node.parent.kind === 181 || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + return node.parent.kind === 183 || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); case 80: return ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101; case 79: - if (node.parent.kind === 181 || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { + if (node.parent.kind === 183 || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { return true; } case 8: @@ -12661,60 +12769,62 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 254: - case 164: - case 167: + case 257: case 166: + case 169: + case 168: + case 302: case 299: - case 296: - case 203: + case 205: return parent.initializer === node; - case 238: - case 239: - case 240: case 241: - case 247: - case 248: - case 249: - case 289: + case 242: + case 243: + case 244: + case 250: case 251: + case 252: + case 292: + case 254: return parent.expression === node; - case 242: + case 245: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 255) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 258) || forStatement.condition === node || forStatement.incrementor === node; - case 243: - case 244: + case 246: + case 247: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 255) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 258) || forInStatement.expression === node; - case 211: - case 229: + case 213: + case 231: return node === parent.expression; - case 233: + case 236: return node === parent.expression; - case 162: + case 164: return node === parent.expression; - case 165: - case 288: - case 287: - case 298: + case 167: + case 291: + case 290: + case 301: return true; - case 228: + case 230: return parent.expression === node && !isPartOfTypeNode(parent); - case 297: + case 300: return parent.objectAssignmentInitializer === node; + case 235: + return node === parent.expression; default: return isExpressionNode(parent); } } ts.isInExpressionContext = isInExpressionContext; function isPartOfTypeQuery(node) { - while (node.kind === 161 || node.kind === 79) { + while (node.kind === 163 || node.kind === 79) { node = node.parent; } - return node.kind === 181; + return node.kind === 183; } ts.isPartOfTypeQuery = isPartOfTypeQuery; function isNamespaceReexportDeclaration(node) { @@ -12722,7 +12832,7 @@ var ts; } ts.isNamespaceReexportDeclaration = isNamespaceReexportDeclaration; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 && node.moduleReference.kind === 277; + return node.kind === 268 && node.moduleReference.kind === 280; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -12735,7 +12845,7 @@ var ts; } ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 && node.moduleReference.kind !== 277; + return node.kind === 268 && node.moduleReference.kind !== 280; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJS(file) { @@ -12767,11 +12877,11 @@ var ts; ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && - (node.typeArguments[0].kind === 150 || node.typeArguments[0].kind === 147); + (node.typeArguments[0].kind === 152 || node.typeArguments[0].kind === 148); } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, requireStringLiteralLikeArgument) { - if (callExpression.kind !== 208) { + if (callExpression.kind !== 210) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -12857,11 +12967,11 @@ var ts; function getExpandoInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 213 || e.kind === 214 ? initializer : undefined; + return e.kind === 215 || e.kind === 216 ? initializer : undefined; } - if (initializer.kind === 213 || - initializer.kind === 226 || - initializer.kind === 214) { + if (initializer.kind === 215 || + initializer.kind === 228 || + initializer.kind === 216) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -13072,7 +13182,7 @@ var ts; ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJSFile(expr) && - expr.parent && expr.parent.kind === 238 && + expr.parent && expr.parent.kind === 241 && (!ts.isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!ts.getJSDocTypeTag(expr.parent); } @@ -13092,17 +13202,17 @@ var ts; return false; } var decl = symbol.valueDeclaration; - return decl.kind === 256 || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); + return decl.kind === 259 || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); } ts.isFunctionSymbol = isFunctionSymbol; function tryGetModuleSpecifierFromDeclaration(node) { var _a, _b; switch (node.kind) { - case 254: + case 257: return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, true); })) === null || _a === void 0 ? void 0 : _a.arguments[0]; - case 266: + case 269: return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike); - case 265: + case 268: return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike); default: ts.Debug.assertNever(node); @@ -13115,14 +13225,14 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function tryGetImportFromModuleSpecifier(node) { switch (node.parent.kind) { - case 266: - case 272: + case 269: + case 275: return node.parent; - case 277: + case 280: return node.parent.parent; - case 208: + case 210: return isImportCall(node.parent) || isRequireCall(node.parent, false) ? node.parent : undefined; - case 196: + case 198: ts.Debug.assert(ts.isStringLiteral(node)); return ts.tryCast(node.parent.parent, ts.isImportTypeNode); default: @@ -13132,16 +13242,16 @@ var ts; ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 266: - case 272: + case 269: + case 275: return node.moduleSpecifier; - case 265: - return node.moduleReference.kind === 277 ? node.moduleReference.expression : undefined; - case 200: + case 268: + return node.moduleReference.kind === 280 ? node.moduleReference.expression : undefined; + case 202: return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; - case 208: + case 210: return node.arguments[0]; - case 261: + case 264: return node.name.kind === 10 ? node.name : undefined; default: return ts.Debug.assertNever(node); @@ -13150,11 +13260,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 266: + case 269: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 265: + case 268: return node; - case 272: + case 275: return node.exportClause && ts.tryCast(node.exportClause, ts.isNamespaceExport); default: return ts.Debug.assertNever(node); @@ -13162,7 +13272,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 266 && !!node.importClause && !!node.importClause.name; + return node.kind === 269 && !!node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function forEachImportClauseDeclaration(node, action) { @@ -13183,13 +13293,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 164: + case 166: + case 171: + case 170: + case 300: + case 299: case 169: case 168: - case 297: - case 296: - case 167: - case 166: return node.questionToken !== undefined; } } @@ -13203,7 +13313,7 @@ var ts; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function isJSDocTypeAlias(node) { - return node.kind === 345 || node.kind === 338 || node.kind === 339; + return node.kind === 348 || node.kind === 341 || node.kind === 342; } ts.isJSDocTypeAlias = isJSDocTypeAlias; function isTypeAlias(node) { @@ -13228,12 +13338,12 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 237: + case 240: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; - case 167: + case 169: return node.initializer; - case 296: + case 299: return node.initializer; } } @@ -13245,7 +13355,7 @@ var ts; function getNestedModuleDeclaration(node) { return ts.isModuleDeclaration(node) && node.body && - node.body.kind === 261 + node.body.kind === 264 ? node.body : undefined; } @@ -13259,11 +13369,11 @@ var ts; if (ts.hasJSDocNodes(node)) { result = ts.addRange(result, filterOwnedJSDocTags(hostNode, ts.last(node.jsDoc))); } - if (node.kind === 164) { + if (node.kind === 166) { result = ts.addRange(result, (noCache ? ts.getJSDocParameterTagsNoCache : ts.getJSDocParameterTags)(node)); break; } - if (node.kind === 163) { + if (node.kind === 165) { result = ts.addRange(result, (noCache ? ts.getJSDocTypeParameterTagsNoCache : ts.getJSDocTypeParameterTags)(node)); break; } @@ -13288,11 +13398,11 @@ var ts; } function getNextJSDocCommentLocation(node) { var parent = node.parent; - if (parent.kind === 296 || - parent.kind === 271 || - parent.kind === 167 || - parent.kind === 238 && node.kind === 206 || - parent.kind === 247 || + if (parent.kind === 299 || + parent.kind === 274 || + parent.kind === 169 || + parent.kind === 241 && node.kind === 208 || + parent.kind === 250 || getNestedModuleDeclaration(parent) || ts.isBinaryExpression(node) && node.operatorToken.kind === 63) { return parent; @@ -13386,34 +13496,34 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 221: + case 223: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 63 || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 : 2 : 0; - case 219: - case 220: + case 221: + case 222: var unaryOperator = parent.operator; return unaryOperator === 45 || unaryOperator === 46 ? 2 : 0; - case 243: - case 244: + case 246: + case 247: return parent.initializer === node ? 1 : 0; - case 212: - case 204: - case 225: - case 230: + case 214: + case 206: + case 227: + case 232: node = parent; break; - case 298: + case 301: node = parent.parent; break; - case 297: + case 300: if (parent.name !== node) { return 0; } node = parent.parent; break; - case 296: + case 299: if (parent.name === node) { return 0; } @@ -13432,22 +13542,22 @@ var ts; ts.isAssignmentTarget = isAssignmentTarget; function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 235: - case 237: - case 248: - case 239: - case 249: - case 263: - case 289: - case 290: - case 250: - case 242: - case 243: - case 244: + case 238: case 240: - case 241: + case 251: + case 242: case 252: + case 266: case 292: + case 293: + case 253: + case 245: + case 246: + case 247: + case 243: + case 244: + case 255: + case 295: return true; } return false; @@ -13464,16 +13574,16 @@ var ts; return node; } function walkUpParenthesizedTypes(node) { - return walkUp(node, 191); + return walkUp(node, 193); } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 212); + return walkUp(node, 214); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; function walkUpParenthesizedTypesAndGetParentAndChild(node) { var child; - while (node && node.kind === 191) { + while (node && node.kind === 193) { child = node; node = node.parent; } @@ -13494,11 +13604,11 @@ var ts; } ts.skipParentheses = skipParentheses; function isDeleteTarget(node) { - if (node.kind !== 206 && node.kind !== 207) { + if (node.kind !== 208 && node.kind !== 209) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 215; + return node && node.kind === 217; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -13548,47 +13658,47 @@ var ts; ts.getDeclarationFromName = getDeclarationFromName; function isLiteralComputedPropertyDeclarationName(node) { return isStringOrNumericLiteralLike(node) && - node.parent.kind === 162 && + node.parent.kind === 164 && ts.isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 167: - case 166: case 169: case 168: - case 172: - case 173: + case 171: + case 170: + case 174: + case 175: + case 302: case 299: - case 296: - case 206: + case 208: return parent.name === node; - case 161: + case 163: return parent.right === node; - case 203: - case 270: + case 205: + case 273: return parent.propertyName === node; - case 275: - case 285: - case 279: - case 280: - case 281: + case 278: + case 288: + case 282: + case 283: + case 284: return true; } return false; } ts.isIdentifierName = isIdentifierName; function isAliasSymbolDeclaration(node) { - if (node.kind === 265 || - node.kind === 264 || - node.kind === 267 && !!node.name || - node.kind === 268 || - node.kind === 274 || - node.kind === 270 || - node.kind === 275 || - node.kind === 271 && exportAssignmentIsAlias(node)) { + if (node.kind === 268 || + node.kind === 267 || + node.kind === 270 && !!node.name || + node.kind === 271 || + node.kind === 277 || + node.kind === 273 || + node.kind === 278 || + node.kind === 274 && exportAssignmentIsAlias(node)) { return true; } return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 && exportAssignmentIsAlias(node) || @@ -13601,18 +13711,18 @@ var ts; ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getAliasDeclarationFromName(node) { switch (node.parent.kind) { - case 267: case 270: - case 268: - case 275: + case 273: case 271: - case 265: + case 278: case 274: + case 268: + case 277: return node.parent; - case 161: + case 163: do { node = node.parent; - } while (node.parent.kind === 161); + } while (node.parent.kind === 163); return getAliasDeclarationFromName(node); } } @@ -13631,7 +13741,7 @@ var ts; } ts.getExportAssignmentExpression = getExportAssignmentExpression; function getPropertyAssignmentAliasLikeExpression(node) { - return node.kind === 297 ? node.name : node.kind === 296 ? node.initializer : + return node.kind === 300 ? node.name : node.kind === 299 ? node.initializer : node.parent.right; } ts.getPropertyAssignmentAliasLikeExpression = getPropertyAssignmentAliasLikeExpression; @@ -13695,11 +13805,11 @@ var ts; } ts.getAncestor = getAncestor; function isKeyword(token) { - return 81 <= token && token <= 160; + return 81 <= token && token <= 162; } ts.isKeyword = isKeyword; function isContextualKeyword(token) { - return 126 <= token && token <= 160; + return 126 <= token && token <= 162; } ts.isContextualKeyword = isContextualKeyword; function isNonContextualKeyword(token) { @@ -13735,14 +13845,14 @@ var ts; } var flags = 0; switch (node.kind) { - case 256: - case 213: - case 169: + case 259: + case 215: + case 171: if (node.asteriskToken) { flags |= 1; } - case 214: - if (hasSyntacticModifier(node, 256)) { + case 216: + if (hasSyntacticModifier(node, 512)) { flags |= 2; } break; @@ -13755,13 +13865,13 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 256: - case 213: - case 214: - case 169: + case 259: + case 215: + case 216: + case 171: return node.body !== undefined && node.asteriskToken === undefined - && hasSyntacticModifier(node, 256); + && hasSyntacticModifier(node, 512); } return false; } @@ -13780,7 +13890,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - if (!(name.kind === 162 || name.kind === 207)) { + if (!(name.kind === 164 || name.kind === 209)) { return false; } var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression; @@ -13796,7 +13906,7 @@ var ts; case 10: case 8: return ts.escapeLeadingUnderscores(name.text); - case 162: + case 164: var nameExpression = name.expression; if (isStringOrNumericLiteralLike(nameExpression)) { return ts.escapeLeadingUnderscores(nameExpression.text); @@ -13859,11 +13969,11 @@ var ts; ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 164; + return root.kind === 166; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 203) { + while (node.kind === 205) { node = node.parent.parent; } return node; @@ -13871,15 +13981,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 171 - || kind === 213 - || kind === 256 - || kind === 214 - || kind === 169 - || kind === 172 - || kind === 173 - || kind === 261 - || kind === 305; + return kind === 173 + || kind === 215 + || kind === 259 + || kind === 216 + || kind === 171 + || kind === 174 + || kind === 175 + || kind === 264 + || kind === 308; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -13893,23 +14003,23 @@ var ts; ts.getOriginalSourceFile = getOriginalSourceFile; function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 209: + case 211: return hasArguments ? 0 : 1; + case 221: + case 218: case 219: - case 216: case 217: - case 215: - case 218: - case 222: + case 220: case 224: + case 226: return 1; - case 221: + case 223: switch (operator) { case 42: case 63: @@ -13936,15 +14046,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 221) { + if (expression.kind === 223) { return expression.operatorToken.kind; } - else if (expression.kind === 219 || expression.kind === 220) { + else if (expression.kind === 221 || expression.kind === 222) { return expression.operator; } else { @@ -13954,15 +14064,15 @@ var ts; ts.getOperator = getOperator; function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 351: + case 354: return 0; - case 225: + case 227: return 1; - case 224: + case 226: return 2; - case 222: + case 224: return 4; - case 221: + case 223: switch (operatorKind) { case 27: return 0; @@ -13986,26 +14096,27 @@ var ts; default: return getBinaryOperatorPrecedence(operatorKind); } - case 211: - case 230: + case 213: + case 232: + case 221: + case 218: case 219: - case 216: case 217: - case 215: - case 218: - return 16; case 220: + return 16; + case 222: return 17; - case 208: + case 210: return 18; - case 209: + case 211: return hasArguments ? 19 : 18; - case 210: - case 206: - case 207: - case 231: + case 212: + case 208: + case 209: + case 233: return 19; - case 229: + case 231: + case 235: return 11; case 108: case 106: @@ -14017,19 +14128,19 @@ var ts; case 8: case 9: case 10: - case 204: - case 205: - case 213: - case 214: - case 226: + case 206: + case 207: + case 215: + case 216: + case 228: case 13: case 14: - case 223: - case 212: - case 227: - case 278: - case 279: + case 225: + case 214: + case 229: + case 281: case 282: + case 285: return 20; default: return -1; @@ -14061,7 +14172,8 @@ var ts; case 33: case 102: case 101: - case 127: + case 128: + case 150: return 11; case 47: case 48: @@ -14083,7 +14195,7 @@ var ts; function getSemanticJsxChildren(children) { return ts.filter(children, function (i) { switch (i.kind) { - case 288: + case 291: return !!i.expression; case 11: return !i.containsOnlyTriviaWhiteSpaces; @@ -14138,7 +14250,7 @@ var ts; } diagnostics = nonFileDiagnostics; } - ts.insertSorted(diagnostics, diagnostic, compareDiagnostics); + ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation); } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -14625,7 +14737,7 @@ var ts; while (ts.isQualifiedName(node.parent) && node.parent.left === node) { node = node.parent; } - return node.parent.kind === 181; + return node.parent.kind === 183; } ts.isThisInTypeQuery = isThisInTypeQuery; function identifierIsThisKeyword(id) { @@ -14639,10 +14751,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 172) { + if (accessor.kind === 174) { getAccessor = accessor; } - else if (accessor.kind === 173) { + else if (accessor.kind === 175) { setAccessor = accessor; } else { @@ -14662,10 +14774,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 172 && !getAccessor) { + if (member.kind === 174 && !getAccessor) { getAccessor = member; } - if (member.kind === 173 && !setAccessor) { + if (member.kind === 175 && !setAccessor) { setAccessor = member; } } @@ -14704,7 +14816,7 @@ var ts; } ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations; function isNonTypeAliasTemplate(tag) { - return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 320 && tag.parent.tags.some(isJSDocTypeAlias)); + return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 323 && tag.parent.tags.some(isJSDocTypeAlias)); } function getEffectiveSetAccessorTypeAnnotationNode(node) { var parameter = getSetAccessorValueParameter(node); @@ -14888,13 +15000,17 @@ var ts; } ts.hasOverrideModifier = hasOverrideModifier; function hasAbstractModifier(node) { - return hasSyntacticModifier(node, 128); + return hasSyntacticModifier(node, 256); } ts.hasAbstractModifier = hasAbstractModifier; function hasAmbientModifier(node) { return hasSyntacticModifier(node, 2); } ts.hasAmbientModifier = hasAmbientModifier; + function hasAccessorModifier(node) { + return hasSyntacticModifier(node, 128); + } + ts.hasAccessorModifier = hasAccessorModifier; function hasEffectiveReadonlyModifier(node) { return hasEffectiveModifier(node, 64); } @@ -14912,7 +15028,7 @@ var ts; } ts.getSelectedSyntacticModifierFlags = getSelectedSyntacticModifierFlags; function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) { - if (node.kind >= 0 && node.kind <= 160) { + if (node.kind >= 0 && node.kind <= 162) { return 0; } if (!(node.modifierFlagsCache & 536870912)) { @@ -14984,25 +15100,22 @@ var ts; case 123: return 4; case 122: return 16; case 121: return 8; - case 126: return 128; + case 126: return 256; + case 127: return 128; case 93: return 1; - case 135: return 2; + case 136: return 2; case 85: return 2048; - case 88: return 512; - case 131: return 256; - case 145: return 64; - case 159: return 16384; + case 88: return 1024; + case 132: return 512; + case 146: return 64; + case 161: return 16384; case 101: return 32768; - case 144: return 65536; - case 165: return 131072; + case 145: return 65536; + case 167: return 131072; } return 0; } ts.modifierToFlag = modifierToFlag; - function createModifiers(modifierFlags) { - return modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; - } - ts.createModifiers = createModifiers; function isLogicalOperator(token) { return token === 56 || token === 55 @@ -15051,8 +15164,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, true)) { var kind = node.left.kind; - return kind === 205 - || kind === 204; + return kind === 207 + || kind === 206; } return false; } @@ -15069,12 +15182,12 @@ var ts; switch (node.kind) { case 79: return node; - case 161: + case 163: do { node = node.left; } while (node.kind !== 79); return node; - case 206: + case 208: do { node = node.expression; } while (node.kind !== 79); @@ -15086,9 +15199,9 @@ var ts; return node.kind === 79 || node.kind === 108 || node.kind === 106 - || node.kind === 231 - || node.kind === 206 && isDottedName(node.expression) - || node.kind === 212 && isDottedName(node.expression); + || node.kind === 233 + || node.kind === 208 && isDottedName(node.expression) + || node.kind === 214 && isDottedName(node.expression); } ts.isDottedName = isDottedName; function isPropertyAccessEntityNameExpression(node) { @@ -15119,8 +15232,8 @@ var ts; } ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 161 && node.parent.right === node) || - (node.parent.kind === 206 && node.parent.name === node); + return (node.parent.kind === 163 && node.parent.right === node) || + (node.parent.kind === 208 && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isRightSideOfAccessExpression(node) { @@ -15135,12 +15248,12 @@ var ts; } ts.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName = isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName; function isEmptyObjectLiteral(expression) { - return expression.kind === 205 && + return expression.kind === 207 && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 204 && + return expression.kind === 206 && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -15156,7 +15269,7 @@ var ts; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function isExportDefaultSymbol(symbol) { - return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 512); + return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 1024); } function tryExtractTSExtension(fileName) { return ts.find(supportedTSExtensionsForExtractExtension, function (extension) { return ts.fileExtensionIs(fileName, extension); }); @@ -15282,20 +15395,16 @@ var ts; return getStringFromExpandedCharCodes(expandedCharCodes); } ts.base64decode = base64decode; + function readJsonOrUndefined(path, hostOrText) { + var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path); + if (!jsonText) + return undefined; + var result = ts.parseConfigFileTextToJson(path, jsonText); + return !result.error ? result.config : undefined; + } + ts.readJsonOrUndefined = readJsonOrUndefined; function readJson(path, host) { - try { - var jsonText = host.readFile(path); - if (!jsonText) - return {}; - var result = ts.parseConfigFileTextToJson(path, jsonText); - if (result.error) { - return {}; - } - return result.config; - } - catch (e) { - return {}; - } + return readJsonOrUndefined(path, host) || {}; } ts.readJson = readJson; function directoryProbablyExists(directoryName, host) { @@ -15414,8 +15523,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 260: - case 261: + case 263: + case 264: return parseNode === parseNode.parent.name; } } @@ -15430,7 +15539,7 @@ var ts; return node.initializer !== undefined; } function isWatchSet(options) { - return options.watch && options.hasOwnProperty("watch"); + return options.watch && ts.hasProperty(options, "watch"); } ts.isWatchSet = isWatchSet; function closeFileWatcher(watcher) { @@ -15484,32 +15593,32 @@ var ts; if (!parent) return 0; switch (parent.kind) { - case 212: + case 214: return accessKind(parent); - case 220: - case 219: + case 222: + case 221: var operator = parent.operator; return operator === 45 || operator === 46 ? writeOrReadWrite() : 0; - case 221: + case 223: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 ? 1 : writeOrReadWrite() : 0; - case 206: + case 208: return parent.name !== node ? 0 : accessKind(parent); - case 296: { + case 299: { var parentAccess = accessKind(parent.parent); return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess; } - case 297: + case 300: return node === parent.objectAssignmentInitializer ? 0 : accessKind(parent.parent); - case 204: + case 206: return accessKind(parent); default: return 0; } function writeOrReadWrite() { - return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 238 ? 1 : 2; + return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 241 ? 1 : 2; } } function reverseAccessKind(a) { @@ -15575,7 +15684,7 @@ var ts; function isAbstractConstructorSymbol(symbol) { if (symbol.flags & 32) { var declaration = getClassLikeDeclarationOfSymbol(symbol); - return !!declaration && hasSyntacticModifier(declaration, 128); + return !!declaration && hasSyntacticModifier(declaration, 256); } return false; } @@ -15636,37 +15745,37 @@ var ts; } ts.isObjectTypeDeclaration = isObjectTypeDeclaration; function isTypeNodeKind(kind) { - return (kind >= 177 && kind <= 200) - || kind === 130 - || kind === 155 - || kind === 147 - || kind === 158 + return (kind >= 179 && kind <= 202) + || kind === 131 + || kind === 157 || kind === 148 - || kind === 133 - || kind === 150 - || kind === 151 - || kind === 114 + || kind === 160 + || kind === 149 + || kind === 134 + || kind === 152 || kind === 153 - || kind === 143 - || kind === 228 - || kind === 312 - || kind === 313 - || kind === 314 + || kind === 114 + || kind === 155 + || kind === 144 + || kind === 230 || kind === 315 || kind === 316 || kind === 317 - || kind === 318; + || kind === 318 + || kind === 319 + || kind === 320 + || kind === 321; } ts.isTypeNodeKind = isTypeNodeKind; function isAccessExpression(node) { - return node.kind === 206 || node.kind === 207; + return node.kind === 208 || node.kind === 209; } ts.isAccessExpression = isAccessExpression; function getNameOfAccessExpression(node) { - if (node.kind === 206) { + if (node.kind === 208) { return node.name; } - ts.Debug.assert(node.kind === 207); + ts.Debug.assert(node.kind === 209); return node.argumentExpression; } ts.getNameOfAccessExpression = getNameOfAccessExpression; @@ -15681,7 +15790,7 @@ var ts; } ts.isBundleFileTextLike = isBundleFileTextLike; function isNamedImportsOrExports(node) { - return node.kind === 269 || node.kind === 273; + return node.kind === 272 || node.kind === 276; } ts.isNamedImportsOrExports = isNamedImportsOrExports; function getLeftmostAccessExpression(expr) { @@ -15696,13 +15805,13 @@ var ts; return walkAccessExpression(name.parent); } function walkAccessExpression(access) { - if (access.kind === 206) { + if (access.kind === 208) { var res = action(access.name); if (res !== undefined) { return res; } } - else if (access.kind === 207) { + else if (access.kind === 209) { if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) { var res = action(access.argumentExpression); if (res !== undefined) { @@ -15726,27 +15835,28 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 220: + case 222: node = node.operand; continue; - case 221: + case 223: node = node.left; continue; - case 222: + case 224: node = node.condition; continue; - case 210: + case 212: node = node.tag; continue; - case 208: + case 210: if (stopAtCallExpressions) { return node; } - case 229: - case 207: - case 206: - case 230: - case 350: + case 231: + case 209: + case 208: + case 232: + case 353: + case 235: node = node.expression; continue; } @@ -16860,33 +16970,33 @@ var ts; return ts.isIdentifier(useSite) && ts.isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite; } function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { - while (node.kind === 79 || node.kind === 206) { + while (node.kind === 79 || node.kind === 208) { node = node.parent; } - if (node.kind !== 162) { + if (node.kind !== 164) { return false; } - if (hasSyntacticModifier(node.parent, 128)) { + if (hasSyntacticModifier(node.parent, 256)) { return true; } var containerKind = node.parent.parent.kind; - return containerKind === 258 || containerKind === 182; + return containerKind === 261 || containerKind === 184; } function isIdentifierInNonEmittingHeritageClause(node) { if (node.kind !== 79) return false; var heritageClause = ts.findAncestor(node.parent, function (parent) { switch (parent.kind) { - case 291: + case 294: return true; - case 206: - case 228: + case 208: + case 230: return false; default: return "quit"; } }); - return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 258; + return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 261; } function isIdentifierTypeReference(node) { return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName); @@ -17016,22 +17126,22 @@ var ts; if (!node.parent) return undefined; switch (node.kind) { - case 163: + case 165: var parent_1 = node.parent; - return parent_1.kind === 190 ? undefined : parent_1.typeParameters; - case 164: + return parent_1.kind === 192 ? undefined : parent_1.typeParameters; + case 166: return node.parent.parameters; - case 199: + case 201: return node.parent.templateSpans; - case 233: + case 236: return node.parent.templateSpans; - case 165: { + case 167: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } - case 291: + case 294: return node.parent.heritageClauses; } var parent = node.parent; @@ -17039,45 +17149,45 @@ var ts; return ts.isJSDocTypeLiteral(node.parent) ? undefined : node.parent.tags; } switch (parent.kind) { - case 182: - case 258: + case 184: + case 261: return ts.isTypeElement(node) ? parent.members : undefined; - case 187: - case 188: + case 189: + case 190: return parent.types; - case 184: - case 204: - case 351: - case 269: - case 273: + case 186: + case 206: + case 354: + case 272: + case 276: return parent.elements; - case 205: - case 286: + case 207: + case 289: return parent.properties; - case 208: - case 209: + case 210: + case 211: return ts.isTypeNode(node) ? parent.typeArguments : parent.expression === node ? undefined : parent.arguments; - case 278: - case 282: + case 281: + case 285: return ts.isJsxChild(node) ? parent.children : undefined; - case 280: - case 279: + case 283: + case 282: return ts.isTypeNode(node) ? parent.typeArguments : undefined; - case 235: - case 289: - case 290: - case 262: + case 238: + case 292: + case 293: + case 265: return parent.statements; - case 263: + case 266: return parent.clauses; - case 257: - case 226: - return ts.isClassElement(node) ? parent.members : undefined; case 260: + case 228: + return ts.isClassElement(node) ? parent.members : undefined; + case 263: return ts.isEnumMember(node) ? parent.members : undefined; - case 305: + case 308: return parent.statements; } } @@ -17087,7 +17197,7 @@ var ts; if (ts.some(node.parameters, function (p) { return !getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 214) { + if (node.kind !== 216) { var parameter = ts.firstOrUndefined(node.parameters); if (!(parameter && parameterIsThisKeyword(parameter))) { return true; @@ -17102,7 +17212,7 @@ var ts; } ts.isInfinityOrNaNString = isInfinityOrNaNString; function isCatchClauseVariableDeclaration(node) { - return node.kind === 254 && node.parent.kind === 292; + return node.kind === 257 && node.parent.kind === 295; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function isParameterOrCatchClauseVariable(symbol) { @@ -17111,7 +17221,7 @@ var ts; } ts.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable; function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 213 || node.kind === 214; + return node.kind === 215 || node.kind === 216; } ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction; function escapeSnippetText(text) { @@ -17177,9 +17287,35 @@ var ts; ts.getNodeModulePathParts = getNodeModulePathParts; function getParameterTypeNode(parameter) { var _a; - return parameter.kind === 340 ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; + return parameter.kind === 343 ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; } ts.getParameterTypeNode = getParameterTypeNode; + function isTypeDeclaration(node) { + switch (node.kind) { + case 165: + case 260: + case 261: + case 262: + case 263: + case 348: + case 341: + case 342: + return true; + case 270: + return node.isTypeOnly; + case 273: + case 278: + return node.parent.parent.isTypeOnly; + default: + return false; + } + } + ts.isTypeDeclaration = isTypeDeclaration; + function canHaveExportModifier(node) { + return ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) + || ts.isInterfaceDeclaration(node) || isTypeDeclaration(node) || (ts.isModuleDeclaration(node) && !isExternalModuleAugmentation(node) && !isGlobalScopeAugmentation(node)); + } + ts.canHaveExportModifier = canHaveExportModifier; })(ts || (ts = {})); var ts; (function (ts) { @@ -17270,10 +17406,10 @@ var ts; return parenthesizerRule; } function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { - var binaryOperatorPrecedence = ts.getOperatorPrecedence(221, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(221, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(223, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(223, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); - if (!isLeftSideOfBinary && operand.kind === 214 && binaryOperatorPrecedence > 3) { + if (!isLeftSideOfBinary && operand.kind === 216 && binaryOperatorPrecedence > 3) { return true; } var operandPrecedence = ts.getExpressionPrecedence(emittedOperand); @@ -17281,7 +17417,7 @@ var ts; case -1: if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 - && operand.kind === 224) { + && operand.kind === 226) { return false; } return true; @@ -17313,14 +17449,15 @@ var ts; return binaryOperator === 41 || binaryOperator === 51 || binaryOperator === 50 - || binaryOperator === 52; + || binaryOperator === 52 + || binaryOperator === 27; } function getLiteralKindOfBinaryPlusOperand(node) { node = ts.skipPartiallyEmittedExpressions(node); if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 221 && node.operatorToken.kind === 39) { + if (node.kind === 223 && node.operatorToken.kind === 39) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -17336,7 +17473,7 @@ var ts; } function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = ts.skipPartiallyEmittedExpressions(operand); - if (skipped.kind === 212) { + if (skipped.kind === 214) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -17353,7 +17490,7 @@ var ts; return ts.isCommaSequence(expression) ? factory.createParenthesizedExpression(expression) : expression; } function parenthesizeConditionOfConditionalExpression(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(222, 57); + var conditionalPrecedence = ts.getOperatorPrecedence(224, 57); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) !== 1) { @@ -17372,8 +17509,8 @@ var ts; var needsParens = ts.isCommaSequence(check); if (!needsParens) { switch (ts.getLeftmostExpression(check, false).kind) { - case 226: - case 213: + case 228: + case 215: needsParens = true; } } @@ -17382,9 +17519,9 @@ var ts; function parenthesizeExpressionOfNew(expression) { var leftmostExpr = ts.getLeftmostExpression(expression, true); switch (leftmostExpr.kind) { - case 208: + case 210: return factory.createParenthesizedExpression(expression); - case 209: + case 211: return !leftmostExpr.arguments ? factory.createParenthesizedExpression(expression) : expression; @@ -17394,7 +17531,7 @@ var ts; function parenthesizeLeftSideOfAccess(expression, optionalChain) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 209 || emittedExpression.arguments) + && (emittedExpression.kind !== 211 || emittedExpression.arguments) && (optionalChain || !ts.isOptionalChain(emittedExpression))) { return expression; } @@ -17413,7 +17550,7 @@ var ts; function parenthesizeExpressionForDisallowedComma(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(221, 27); + var commaPrecedence = ts.getOperatorPrecedence(223, 27); return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } function parenthesizeExpressionOfExpressionStatement(expression) { @@ -17421,43 +17558,43 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 213 || kind === 214) { + if (kind === 215 || kind === 216) { var updated = factory.updateCallExpression(emittedExpression, ts.setTextRange(factory.createParenthesizedExpression(callee), callee), emittedExpression.typeArguments, emittedExpression.arguments); return factory.restoreOuterExpressions(expression, updated, 8); } } var leftmostExpressionKind = ts.getLeftmostExpression(emittedExpression, false).kind; - if (leftmostExpressionKind === 205 || leftmostExpressionKind === 213) { + if (leftmostExpressionKind === 207 || leftmostExpressionKind === 215) { return ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } return expression; } function parenthesizeConciseBodyOfArrowFunction(body) { - if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, false).kind === 205)) { + if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, false).kind === 207)) { return ts.setTextRange(factory.createParenthesizedExpression(body), body); } return body; } function parenthesizeCheckTypeOfConditionalType(checkType) { switch (checkType.kind) { - case 179: - case 180: - case 189: + case 181: + case 182: + case 191: return factory.createParenthesizedType(checkType); } return checkType; } function parenthesizeExtendsTypeOfConditionalType(extendsType) { switch (extendsType.kind) { - case 189: + case 191: return factory.createParenthesizedType(extendsType); } return extendsType; } function parenthesizeConstituentTypeOfUnionType(type) { switch (type.kind) { - case 187: - case 188: + case 189: + case 190: return factory.createParenthesizedType(type); } return parenthesizeCheckTypeOfConditionalType(type); @@ -17467,8 +17604,8 @@ var ts; } function parenthesizeConstituentTypeOfIntersectionType(type) { switch (type.kind) { - case 187: - case 188: + case 189: + case 190: return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfUnionType(type); @@ -17478,23 +17615,23 @@ var ts; } function parenthesizeOperandOfTypeOperator(type) { switch (type.kind) { - case 188: + case 190: return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfIntersectionType(type); } function parenthesizeOperandOfReadonlyTypeOperator(type) { switch (type.kind) { - case 193: + case 195: return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); } function parenthesizeNonArrayTypeOfPostfixType(type) { switch (type.kind) { - case 190: - case 193: - case 181: + case 192: + case 195: + case 183: return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -17638,11 +17775,11 @@ var ts; } function convertToAssignmentPattern(node) { switch (node.kind) { - case 202: case 204: + case 206: return convertToArrayAssignmentPattern(node); - case 201: - case 205: + case 203: + case 207: return convertToObjectAssignmentPattern(node); } } @@ -17715,6 +17852,8 @@ var ts; createUniqueName: createUniqueName, getGeneratedNameForNode: getGeneratedNameForNode, createPrivateIdentifier: createPrivateIdentifier, + createUniquePrivateName: createUniquePrivateName, + getGeneratedPrivateNameForNode: getGeneratedPrivateNameForNode, createToken: createToken, createSuper: createSuper, createThis: createThis, @@ -17877,6 +18016,8 @@ var ts; updateAsExpression: updateAsExpression, createNonNullExpression: createNonNullExpression, updateNonNullExpression: updateNonNullExpression, + createSatisfiesExpression: createSatisfiesExpression, + updateSatisfiesExpression: updateSatisfiesExpression, createNonNullChain: createNonNullChain, updateNonNullChain: updateNonNullChain, createMetaProperty: createMetaProperty, @@ -17973,18 +18114,18 @@ var ts; createMissingDeclaration: createMissingDeclaration, createExternalModuleReference: createExternalModuleReference, updateExternalModuleReference: updateExternalModuleReference, - get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312); }, - get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313); }, - get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315); }, - get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315); }, - get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314); }, - get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314); }, - get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316); }, - get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316); }, - get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318); }, - get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(318); }, - get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(319); }, - get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(319); }, + get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(315); }, + get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(316); }, + get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(318); }, + get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(318); }, + get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(317); }, + get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(317); }, + get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(319); }, + get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(319); }, + get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(321); }, + get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(321); }, + get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(322); }, + get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(322); }, createJSDocFunctionType: createJSDocFunctionType, updateJSDocFunctionType: updateJSDocFunctionType, createJSDocTypeLiteral: createJSDocTypeLiteral, @@ -18019,30 +18160,30 @@ var ts; updateJSDocLinkCode: updateJSDocLinkCode, createJSDocLinkPlain: createJSDocLinkPlain, updateJSDocLinkPlain: updateJSDocLinkPlain, - get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(343); }, - get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(343); }, - get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(341); }, - get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(341); }, - get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(342); }, - get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(342); }, - get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(339); }, - get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(339); }, - get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(330); }, - get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(330); }, - get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(332); }, - get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(332); }, - get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(333); }, - get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(333); }, - get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(334); }, - get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(334); }, - get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(335); }, - get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(335); }, - get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(336); }, - get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(336); }, - get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(337); }, - get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(337); }, - get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(331); }, - get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(331); }, + get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(346); }, + get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(346); }, + get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(344); }, + get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(344); }, + get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(345); }, + get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(345); }, + get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(342); }, + get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(342); }, + get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(333); }, + get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(333); }, + get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(335); }, + get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(335); }, + get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(336); }, + get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(336); }, + get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(337); }, + get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(337); }, + get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(338); }, + get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(338); }, + get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(339); }, + get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(339); }, + get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(340); }, + get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(340); }, + get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(334); }, + get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(334); }, createJSDocUnknownTag: createJSDocUnknownTag, updateJSDocUnknownTag: updateJSDocUnknownTag, createJSDocText: createJSDocText, @@ -18228,11 +18369,11 @@ var ts; } if (name) { switch (node.kind) { + case 171: + case 174: + case 175: case 169: - case 172: - case 173: - case 167: - case 296: + case 299: if (ts.isIdentifier(name)) { node.transformFlags |= propagateIdentifierNameFlags(name); break; @@ -18366,21 +18507,27 @@ var ts; node.escapedText = ts.escapeLeadingUnderscores(text); return node; } - function createBaseGeneratedIdentifier(text, autoGenerateFlags) { + function createBaseGeneratedIdentifier(text, autoGenerateFlags, prefix, suffix) { var node = createBaseIdentifier(text, undefined); node.autoGenerateFlags = autoGenerateFlags; node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; nextAutoGenerateId++; return node; } - function createIdentifier(text, typeArguments, originalKeywordKind) { + function createIdentifier(text, typeArguments, originalKeywordKind, hasExtendedUnicodeEscape) { var node = createBaseIdentifier(text, originalKeywordKind); if (typeArguments) { node.typeArguments = createNodeArray(typeArguments); } - if (node.originalKeywordKind === 132) { + if (node.originalKeywordKind === 133) { node.transformFlags |= 67108864; } + if (hasExtendedUnicodeEscape) { + node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape; + node.transformFlags |= 1024; + } return node; } function updateIdentifier(node, typeArguments) { @@ -18388,11 +18535,11 @@ var ts; ? update(createIdentifier(ts.idText(node), typeArguments), node) : node; } - function createTempVariable(recordTempVariable, reservedInNestedScopes) { + function createTempVariable(recordTempVariable, reservedInNestedScopes, prefix, suffix) { var flags = 1; if (reservedInNestedScopes) flags |= 8; - var name = createBaseGeneratedIdentifier("", flags); + var name = createBaseGeneratedIdentifier("", flags, prefix, suffix); if (recordTempVariable) { recordTempVariable(name); } @@ -18402,41 +18549,73 @@ var ts; var flags = 2; if (reservedInNestedScopes) flags |= 8; - return createBaseGeneratedIdentifier("", flags); + return createBaseGeneratedIdentifier("", flags, undefined, undefined); } - function createUniqueName(text, flags) { + function createUniqueName(text, flags, prefix, suffix) { if (flags === void 0) { flags = 0; } ts.Debug.assert(!(flags & 7), "Argument out of range: flags"); ts.Debug.assert((flags & (16 | 32)) !== 32, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"); - return createBaseGeneratedIdentifier(text, 3 | flags); + return createBaseGeneratedIdentifier(text, 3 | flags, prefix, suffix); } - function getGeneratedNameForNode(node, flags) { + function getGeneratedNameForNode(node, flags, prefix, suffix) { if (flags === void 0) { flags = 0; } ts.Debug.assert(!(flags & 7), "Argument out of range: flags"); - var name = createBaseGeneratedIdentifier(node && ts.isIdentifier(node) ? ts.idText(node) : "", 4 | flags); + var text = !node ? "" : + ts.isMemberName(node) ? ts.formatGeneratedName(false, prefix, node, suffix, ts.idText) : + "generated@".concat(ts.getNodeId(node)); + if (prefix || suffix) + flags |= 16; + var name = createBaseGeneratedIdentifier(text, 4 | flags, prefix, suffix); name.original = node; return name; } - function createPrivateIdentifier(text) { - if (!ts.startsWith(text, "#")) - ts.Debug.fail("First character of private identifier must be #: " + text); + function createBasePrivateIdentifier(text) { var node = baseFactory.createBasePrivateIdentifierNode(80); node.escapedText = ts.escapeLeadingUnderscores(text); node.transformFlags |= 16777216; return node; } + function createPrivateIdentifier(text) { + if (!ts.startsWith(text, "#")) + ts.Debug.fail("First character of private identifier must be #: " + text); + return createBasePrivateIdentifier(text); + } + function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags, prefix, suffix) { + var node = createBasePrivateIdentifier(text); + node.autoGenerateFlags = autoGenerateFlags; + node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; + nextAutoGenerateId++; + return node; + } + function createUniquePrivateName(text, prefix, suffix) { + if (text && !ts.startsWith(text, "#")) + ts.Debug.fail("First character of private identifier must be #: " + text); + var autoGenerateFlags = 8 | + (text ? 3 : 1); + return createBaseGeneratedPrivateIdentifier(text !== null && text !== void 0 ? text : "", autoGenerateFlags, prefix, suffix); + } + function getGeneratedPrivateNameForNode(node, prefix, suffix) { + var text = ts.isMemberName(node) ? ts.formatGeneratedName(true, prefix, node, suffix, ts.idText) : + "#generated@".concat(ts.getNodeId(node)); + var flags = prefix || suffix ? 16 : 0; + var name = createBaseGeneratedPrivateIdentifier(text, 4 | flags, prefix, suffix); + name.original = node; + return name; + } function createBaseToken(kind) { return baseFactory.createBaseTokenNode(kind); } function createToken(token) { - ts.Debug.assert(token >= 0 && token <= 160, "Invalid token"); + ts.Debug.assert(token >= 0 && token <= 162, "Invalid token"); ts.Debug.assert(token <= 14 || token >= 17, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."); ts.Debug.assert(token <= 8 || token >= 14, "Invalid token. Use 'createLiteralLikeNode' to create literals."); ts.Debug.assert(token !== 79, "Invalid token. Use 'createIdentifier' to create identifiers"); var node = createBaseToken(token); var transformFlags = 0; switch (token) { - case 131: + case 132: transformFlags = 256 | 128; @@ -18444,24 +18623,24 @@ var ts; case 123: case 121: case 122: - case 145: + case 146: case 126: - case 135: + case 136: case 85: - case 130: - case 147: - case 158: - case 143: + case 131: case 148: - case 101: + case 160: case 144: - case 159: - case 150: - case 133: - case 151: + case 149: + case 101: + case 145: + case 161: + case 152: + case 134: + case 153: case 114: + case 157: case 155: - case 153: transformFlags = 1; break; case 106: @@ -18470,6 +18649,9 @@ var ts; case 124: transformFlags = 1024; break; + case 127: + transformFlags = 16777216; + break; case 108: transformFlags = 16384; break; @@ -18502,8 +18684,8 @@ var ts; if (flags & 1) result.push(createModifier(93)); if (flags & 2) - result.push(createModifier(135)); - if (flags & 512) + result.push(createModifier(136)); + if (flags & 1024) result.push(createModifier(88)); if (flags & 2048) result.push(createModifier(85)); @@ -18513,24 +18695,26 @@ var ts; result.push(createModifier(121)); if (flags & 16) result.push(createModifier(122)); - if (flags & 128) + if (flags & 256) result.push(createModifier(126)); if (flags & 32) result.push(createModifier(124)); if (flags & 16384) - result.push(createModifier(159)); + result.push(createModifier(161)); if (flags & 64) - result.push(createModifier(145)); - if (flags & 256) - result.push(createModifier(131)); + result.push(createModifier(146)); + if (flags & 128) + result.push(createModifier(127)); + if (flags & 512) + result.push(createModifier(132)); if (flags & 32768) result.push(createModifier(101)); if (flags & 65536) - result.push(createModifier(144)); + result.push(createModifier(145)); return result.length ? result : undefined; } function createQualifiedName(left, right) { - var node = createBaseNode(161); + var node = createBaseNode(163); node.left = left; node.right = asName(right); node.transformFlags |= @@ -18545,7 +18729,7 @@ var ts; : node; } function createComputedPropertyName(expression) { - var node = createBaseNode(162); + var node = createBaseNode(164); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -18559,7 +18743,7 @@ var ts; : node; } function createTypeParameterDeclaration(modifiers, name, constraint, defaultType) { - var node = createBaseNamedDeclaration(163, modifiers, name); + var node = createBaseNamedDeclaration(165, modifiers, name); node.constraint = constraint; node.default = defaultType; node.transformFlags = 1; @@ -18574,7 +18758,7 @@ var ts; : node; } function createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(164, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + var node = createBaseVariableLikeDeclaration(166, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.dotDotDotToken = dotDotDotToken; node.questionToken = questionToken; if (ts.isThisIdentifier(node.name)) { @@ -18604,7 +18788,7 @@ var ts; : node; } function createDecorator(expression) { - var node = createBaseNode(165); + var node = createBaseNode(167); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -18619,7 +18803,7 @@ var ts; : node; } function createPropertySignature(modifiers, name, questionToken, type) { - var node = createBaseNamedDeclaration(166, modifiers, name); + var node = createBaseNamedDeclaration(168, modifiers, name); node.type = type; node.questionToken = questionToken; node.transformFlags = 1; @@ -18641,7 +18825,7 @@ var ts; return update(updated, original); } function createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(167, modifiers, name, type, initializer); + var node = createBaseVariableLikeDeclaration(169, modifiers, name, type, initializer); node.questionToken = questionOrExclamationToken && ts.isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= @@ -18667,7 +18851,7 @@ var ts; : node; } function createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(168, modifiers, name, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(170, modifiers, name, typeParameters, parameters, type); node.questionToken = questionToken; node.transformFlags = 1; return node; @@ -18683,7 +18867,7 @@ var ts; : node; } function createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(169, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(171, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.questionToken = questionToken; node.transformFlags |= @@ -18693,7 +18877,7 @@ var ts; if (questionToken) { node.transformFlags |= 1; } - if (ts.modifiersToFlags(node.modifiers) & 256) { + if (ts.modifiersToFlags(node.modifiers) & 512) { if (asteriskToken) { node.transformFlags |= 128; } @@ -18726,7 +18910,7 @@ var ts; return update(updated, original); } function createClassStaticBlockDeclaration(body) { - var node = createBaseGenericNamedDeclaration(170, undefined, undefined, undefined); + var node = createBaseGenericNamedDeclaration(172, undefined, undefined, undefined); node.body = body; node.transformFlags = propagateChildFlags(body) | 16777216; node.illegalDecorators = undefined; @@ -18746,7 +18930,7 @@ var ts; return update(updated, original); } function createConstructorDeclaration(modifiers, parameters, body) { - var node = createBaseFunctionLikeDeclaration(171, modifiers, undefined, undefined, parameters, undefined, body); + var node = createBaseFunctionLikeDeclaration(173, modifiers, undefined, undefined, parameters, undefined, body); node.transformFlags |= 1024; node.illegalDecorators = undefined; node.typeParameters = undefined; @@ -18769,7 +18953,7 @@ var ts; return finishUpdateBaseSignatureDeclaration(updated, original); } function createGetAccessorDeclaration(modifiers, name, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(172, modifiers, name, undefined, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(174, modifiers, name, undefined, parameters, type, body); node.typeParameters = undefined; return node; } @@ -18789,7 +18973,7 @@ var ts; return finishUpdateBaseSignatureDeclaration(updated, original); } function createSetAccessorDeclaration(modifiers, name, parameters, body) { - var node = createBaseFunctionLikeDeclaration(173, modifiers, name, undefined, parameters, undefined, body); + var node = createBaseFunctionLikeDeclaration(175, modifiers, name, undefined, parameters, undefined, body); node.typeParameters = undefined; node.type = undefined; return node; @@ -18810,7 +18994,7 @@ var ts; return finishUpdateBaseSignatureDeclaration(updated, original); } function createCallSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(174, undefined, undefined, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(176, undefined, undefined, typeParameters, parameters, type); node.transformFlags = 1; return node; } @@ -18822,7 +19006,7 @@ var ts; : node; } function createConstructSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(175, undefined, undefined, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(177, undefined, undefined, typeParameters, parameters, type); node.transformFlags = 1; return node; } @@ -18834,7 +19018,7 @@ var ts; : node; } function createIndexSignature(modifiers, parameters, type) { - var node = createBaseSignatureDeclaration(176, modifiers, undefined, undefined, parameters, type); + var node = createBaseSignatureDeclaration(178, modifiers, undefined, undefined, parameters, type); node.transformFlags = 1; return node; } @@ -18846,7 +19030,7 @@ var ts; : node; } function createTemplateLiteralTypeSpan(type, literal) { - var node = createBaseNode(199); + var node = createBaseNode(201); node.type = type; node.literal = literal; node.transformFlags = 1; @@ -18862,7 +19046,7 @@ var ts; return createToken(kind); } function createTypePredicateNode(assertsModifier, parameterName, type) { - var node = createBaseNode(177); + var node = createBaseNode(179); node.assertsModifier = assertsModifier; node.parameterName = asName(parameterName); node.type = type; @@ -18877,7 +19061,7 @@ var ts; : node; } function createTypeReferenceNode(typeName, typeArguments) { - var node = createBaseNode(178); + var node = createBaseNode(180); node.typeName = asName(typeName); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(createNodeArray(typeArguments)); node.transformFlags = 1; @@ -18890,7 +19074,7 @@ var ts; : node; } function createFunctionTypeNode(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(179, undefined, undefined, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(181, undefined, undefined, typeParameters, parameters, type); node.transformFlags = 1; node.modifiers = undefined; return node; @@ -18918,7 +19102,7 @@ var ts; ts.Debug.fail("Incorrect number of arguments specified."); } function createConstructorTypeNode1(modifiers, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(180, modifiers, undefined, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(182, modifiers, undefined, typeParameters, parameters, type); node.transformFlags = 1; return node; } @@ -18946,7 +19130,7 @@ var ts; return updateConstructorTypeNode1(node, node.modifiers, typeParameters, parameters, type); } function createTypeQueryNode(exprName, typeArguments) { - var node = createBaseNode(181); + var node = createBaseNode(183); node.exprName = exprName; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags = 1; @@ -18959,7 +19143,7 @@ var ts; : node; } function createTypeLiteralNode(members) { - var node = createBaseNode(182); + var node = createBaseNode(184); node.members = createNodeArray(members); node.transformFlags = 1; return node; @@ -18970,7 +19154,7 @@ var ts; : node; } function createArrayTypeNode(elementType) { - var node = createBaseNode(183); + var node = createBaseNode(185); node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType); node.transformFlags = 1; return node; @@ -18981,7 +19165,7 @@ var ts; : node; } function createTupleTypeNode(elements) { - var node = createBaseNode(184); + var node = createBaseNode(186); node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements)); node.transformFlags = 1; return node; @@ -18992,7 +19176,7 @@ var ts; : node; } function createNamedTupleMember(dotDotDotToken, name, questionToken, type) { - var node = createBaseNode(197); + var node = createBaseNode(199); node.dotDotDotToken = dotDotDotToken; node.name = name; node.questionToken = questionToken; @@ -19009,7 +19193,7 @@ var ts; : node; } function createOptionalTypeNode(type) { - var node = createBaseNode(185); + var node = createBaseNode(187); node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type); node.transformFlags = 1; return node; @@ -19020,7 +19204,7 @@ var ts; : node; } function createRestTypeNode(type) { - var node = createBaseNode(186); + var node = createBaseNode(188); node.type = type; node.transformFlags = 1; return node; @@ -19042,19 +19226,19 @@ var ts; : node; } function createUnionTypeNode(types) { - return createUnionOrIntersectionTypeNode(187, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); + return createUnionOrIntersectionTypeNode(189, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } function updateUnionTypeNode(node, types) { return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } function createIntersectionTypeNode(types) { - return createUnionOrIntersectionTypeNode(188, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); + return createUnionOrIntersectionTypeNode(190, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } function updateIntersectionTypeNode(node, types) { return updateUnionOrIntersectionTypeNode(node, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { - var node = createBaseNode(189); + var node = createBaseNode(191); node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType); node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType); node.trueType = trueType; @@ -19071,7 +19255,7 @@ var ts; : node; } function createInferTypeNode(typeParameter) { - var node = createBaseNode(190); + var node = createBaseNode(192); node.typeParameter = typeParameter; node.transformFlags = 1; return node; @@ -19082,7 +19266,7 @@ var ts; : node; } function createTemplateLiteralType(head, templateSpans) { - var node = createBaseNode(198); + var node = createBaseNode(200); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags = 1; @@ -19096,7 +19280,7 @@ var ts; } function createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf) { if (isTypeOf === void 0) { isTypeOf = false; } - var node = createBaseNode(200); + var node = createBaseNode(202); node.argument = argument; node.assertions = assertions; node.qualifier = qualifier; @@ -19116,7 +19300,7 @@ var ts; : node; } function createParenthesizedType(type) { - var node = createBaseNode(191); + var node = createBaseNode(193); node.type = type; node.transformFlags = 1; return node; @@ -19127,14 +19311,14 @@ var ts; : node; } function createThisTypeNode() { - var node = createBaseNode(192); + var node = createBaseNode(194); node.transformFlags = 1; return node; } function createTypeOperatorNode(operator, type) { - var node = createBaseNode(193); + var node = createBaseNode(195); node.operator = operator; - node.type = operator === 145 ? + node.type = operator === 146 ? parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : parenthesizerRules().parenthesizeOperandOfTypeOperator(type); node.transformFlags = 1; @@ -19146,7 +19330,7 @@ var ts; : node; } function createIndexedAccessTypeNode(objectType, indexType) { - var node = createBaseNode(194); + var node = createBaseNode(196); node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType); node.indexType = indexType; node.transformFlags = 1; @@ -19159,7 +19343,7 @@ var ts; : node; } function createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members) { - var node = createBaseNode(195); + var node = createBaseNode(197); node.readonlyToken = readonlyToken; node.typeParameter = typeParameter; node.nameType = nameType; @@ -19180,7 +19364,7 @@ var ts; : node; } function createLiteralTypeNode(literal) { - var node = createBaseNode(196); + var node = createBaseNode(198); node.literal = literal; node.transformFlags = 1; return node; @@ -19191,7 +19375,7 @@ var ts; : node; } function createObjectBindingPattern(elements) { - var node = createBaseNode(201); + var node = createBaseNode(203); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -19210,7 +19394,7 @@ var ts; : node; } function createArrayBindingPattern(elements) { - var node = createBaseNode(202); + var node = createBaseNode(204); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -19224,7 +19408,7 @@ var ts; : node; } function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createBaseBindingLikeDeclaration(203, undefined, name, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + var node = createBaseBindingLikeDeclaration(205, undefined, name, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; node.transformFlags |= @@ -19252,7 +19436,7 @@ var ts; return node; } function createArrayLiteralExpression(elements, multiLine) { - var node = createBaseExpression(204); + var node = createBaseExpression(206); var lastElement = elements && ts.lastOrUndefined(elements); var elementsArray = createNodeArray(elements, lastElement && ts.isOmittedExpression(lastElement) ? true : undefined); node.elements = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(elementsArray); @@ -19266,7 +19450,7 @@ var ts; : node; } function createObjectLiteralExpression(properties, multiLine) { - var node = createBaseExpression(205); + var node = createBaseExpression(207); node.properties = createNodeArray(properties); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.properties); @@ -19278,7 +19462,7 @@ var ts; : node; } function createPropertyAccessExpression(expression, name) { - var node = createBaseExpression(206); + var node = createBaseExpression(208); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false); node.name = asName(name); node.transformFlags = @@ -19303,7 +19487,7 @@ var ts; : node; } function createPropertyAccessChain(expression, questionDotToken, name) { - var node = createBaseExpression(206); + var node = createBaseExpression(208); node.flags |= 32; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, true); node.questionDotToken = questionDotToken; @@ -19326,7 +19510,7 @@ var ts; : node; } function createElementAccessExpression(expression, index) { - var node = createBaseExpression(207); + var node = createBaseExpression(209); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false); node.argumentExpression = asExpression(index); node.transformFlags |= @@ -19349,7 +19533,7 @@ var ts; : node; } function createElementAccessChain(expression, questionDotToken, index) { - var node = createBaseExpression(207); + var node = createBaseExpression(209); node.flags |= 32; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, true); node.questionDotToken = questionDotToken; @@ -19370,7 +19554,7 @@ var ts; : node; } function createCallExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(208); + var node = createBaseExpression(210); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false); node.typeArguments = asNodeArray(typeArguments); node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray)); @@ -19400,7 +19584,7 @@ var ts; : node; } function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) { - var node = createBaseExpression(208); + var node = createBaseExpression(210); node.flags |= 32; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, true); node.questionDotToken = questionDotToken; @@ -19430,7 +19614,7 @@ var ts; : node; } function createNewExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(209); + var node = createBaseExpression(211); node.expression = parenthesizerRules().parenthesizeExpressionOfNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(argumentsArray) : undefined; @@ -19452,7 +19636,7 @@ var ts; : node; } function createTaggedTemplateExpression(tag, typeArguments, template) { - var node = createBaseExpression(210); + var node = createBaseExpression(212); node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag, false); node.typeArguments = asNodeArray(typeArguments); node.template = template; @@ -19477,7 +19661,7 @@ var ts; : node; } function createTypeAssertion(type, expression) { - var node = createBaseExpression(211); + var node = createBaseExpression(213); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.type = type; node.transformFlags |= @@ -19493,7 +19677,7 @@ var ts; : node; } function createParenthesizedExpression(expression) { - var node = createBaseExpression(212); + var node = createBaseExpression(214); node.expression = expression; node.transformFlags = propagateChildFlags(node.expression); return node; @@ -19504,13 +19688,13 @@ var ts; : node; } function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(213, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(215, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.asteriskToken); if (node.typeParameters) { node.transformFlags |= 1; } - if (ts.modifiersToFlags(node.modifiers) & 256) { + if (ts.modifiersToFlags(node.modifiers) & 512) { if (node.asteriskToken) { node.transformFlags |= 128; } @@ -19535,12 +19719,12 @@ var ts; : node; } function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createBaseFunctionLikeDeclaration(214, modifiers, undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); + var node = createBaseFunctionLikeDeclaration(216, modifiers, undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38); node.transformFlags |= propagateChildFlags(node.equalsGreaterThanToken) | 1024; - if (ts.modifiersToFlags(node.modifiers) & 256) { + if (ts.modifiersToFlags(node.modifiers) & 512) { node.transformFlags |= 256 | 16384; } return node; @@ -19556,7 +19740,7 @@ var ts; : node; } function createDeleteExpression(expression) { - var node = createBaseExpression(215); + var node = createBaseExpression(217); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -19567,7 +19751,7 @@ var ts; : node; } function createTypeOfExpression(expression) { - var node = createBaseExpression(216); + var node = createBaseExpression(218); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -19578,7 +19762,7 @@ var ts; : node; } function createVoidExpression(expression) { - var node = createBaseExpression(217); + var node = createBaseExpression(219); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -19589,7 +19773,7 @@ var ts; : node; } function createAwaitExpression(expression) { - var node = createBaseExpression(218); + var node = createBaseExpression(220); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -19604,7 +19788,7 @@ var ts; : node; } function createPrefixUnaryExpression(operator, operand) { - var node = createBaseExpression(219); + var node = createBaseExpression(221); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -19622,7 +19806,7 @@ var ts; : node; } function createPostfixUnaryExpression(operand, operator) { - var node = createBaseExpression(220); + var node = createBaseExpression(222); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -19639,7 +19823,7 @@ var ts; : node; } function createBinaryExpression(left, operator, right) { - var node = createBaseExpression(221); + var node = createBaseExpression(223); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = parenthesizerRules().parenthesizeLeftSideOfBinary(operatorKind, left); @@ -19707,7 +19891,7 @@ var ts; : node; } function createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse) { - var node = createBaseExpression(222); + var node = createBaseExpression(224); node.condition = parenthesizerRules().parenthesizeConditionOfConditionalExpression(condition); node.questionToken = questionToken !== null && questionToken !== void 0 ? questionToken : createToken(57); node.whenTrue = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenTrue); @@ -19731,7 +19915,7 @@ var ts; : node; } function createTemplateExpression(head, templateSpans) { - var node = createBaseExpression(223); + var node = createBaseExpression(225); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= @@ -19792,7 +19976,7 @@ var ts; } function createYieldExpression(asteriskToken, expression) { ts.Debug.assert(!asteriskToken || !!expression, "A `YieldExpression` with an asteriskToken must have an expression."); - var node = createBaseExpression(224); + var node = createBaseExpression(226); node.expression = expression && parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.asteriskToken = asteriskToken; node.transformFlags |= @@ -19810,7 +19994,7 @@ var ts; : node; } function createSpreadElement(expression) { - var node = createBaseExpression(225); + var node = createBaseExpression(227); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -19824,7 +20008,7 @@ var ts; : node; } function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(226, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(228, modifiers, name, typeParameters, heritageClauses, members); node.transformFlags |= 1024; return node; } @@ -19838,10 +20022,10 @@ var ts; : node; } function createOmittedExpression() { - return createBaseExpression(227); + return createBaseExpression(229); } function createExpressionWithTypeArguments(expression, typeArguments) { - var node = createBaseNode(228); + var node = createBaseNode(230); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= @@ -19857,7 +20041,7 @@ var ts; : node; } function createAsExpression(expression, type) { - var node = createBaseExpression(229); + var node = createBaseExpression(231); node.expression = expression; node.type = type; node.transformFlags |= @@ -19873,7 +20057,7 @@ var ts; : node; } function createNonNullExpression(expression) { - var node = createBaseExpression(230); + var node = createBaseExpression(232); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -19888,8 +20072,24 @@ var ts; ? update(createNonNullExpression(expression), node) : node; } + function createSatisfiesExpression(expression, type) { + var node = createBaseExpression(235); + node.expression = expression; + node.type = type; + node.transformFlags |= + propagateChildFlags(node.expression) | + propagateChildFlags(node.type) | + 1; + return node; + } + function updateSatisfiesExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? update(createSatisfiesExpression(expression, type), node) + : node; + } function createNonNullChain(expression) { - var node = createBaseExpression(230); + var node = createBaseExpression(232); node.flags |= 32; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, true); node.transformFlags |= @@ -19904,7 +20104,7 @@ var ts; : node; } function createMetaProperty(keywordToken, name) { - var node = createBaseExpression(231); + var node = createBaseExpression(233); node.keywordToken = keywordToken; node.name = name; node.transformFlags |= propagateChildFlags(node.name); @@ -19926,7 +20126,7 @@ var ts; : node; } function createTemplateSpan(expression, literal) { - var node = createBaseNode(233); + var node = createBaseNode(236); node.expression = expression; node.literal = literal; node.transformFlags |= @@ -19942,12 +20142,12 @@ var ts; : node; } function createSemicolonClassElement() { - var node = createBaseNode(234); + var node = createBaseNode(237); node.transformFlags |= 1024; return node; } function createBlock(statements, multiLine) { - var node = createBaseNode(235); + var node = createBaseNode(238); node.statements = createNodeArray(statements); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.statements); @@ -19959,7 +20159,7 @@ var ts; : node; } function createVariableStatement(modifiers, declarationList) { - var node = createBaseDeclaration(237); + var node = createBaseDeclaration(240); node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; node.transformFlags |= @@ -19977,10 +20177,10 @@ var ts; : node; } function createEmptyStatement() { - return createBaseNode(236); + return createBaseNode(239); } function createExpressionStatement(expression) { - var node = createBaseNode(238); + var node = createBaseNode(241); node.expression = parenthesizerRules().parenthesizeExpressionOfExpressionStatement(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -19991,7 +20191,7 @@ var ts; : node; } function createIfStatement(expression, thenStatement, elseStatement) { - var node = createBaseNode(239); + var node = createBaseNode(242); node.expression = expression; node.thenStatement = asEmbeddedStatement(thenStatement); node.elseStatement = asEmbeddedStatement(elseStatement); @@ -20009,7 +20209,7 @@ var ts; : node; } function createDoStatement(statement, expression) { - var node = createBaseNode(240); + var node = createBaseNode(243); node.statement = asEmbeddedStatement(statement); node.expression = expression; node.transformFlags |= @@ -20024,7 +20224,7 @@ var ts; : node; } function createWhileStatement(expression, statement) { - var node = createBaseNode(241); + var node = createBaseNode(244); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -20039,7 +20239,7 @@ var ts; : node; } function createForStatement(initializer, condition, incrementor, statement) { - var node = createBaseNode(242); + var node = createBaseNode(245); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -20060,7 +20260,7 @@ var ts; : node; } function createForInStatement(initializer, expression, statement) { - var node = createBaseNode(243); + var node = createBaseNode(246); node.initializer = initializer; node.expression = expression; node.statement = asEmbeddedStatement(statement); @@ -20078,7 +20278,7 @@ var ts; : node; } function createForOfStatement(awaitModifier, initializer, expression, statement) { - var node = createBaseNode(244); + var node = createBaseNode(247); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); @@ -20102,7 +20302,7 @@ var ts; : node; } function createContinueStatement(label) { - var node = createBaseNode(245); + var node = createBaseNode(248); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -20115,7 +20315,7 @@ var ts; : node; } function createBreakStatement(label) { - var node = createBaseNode(246); + var node = createBaseNode(249); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -20128,7 +20328,7 @@ var ts; : node; } function createReturnStatement(expression) { - var node = createBaseNode(247); + var node = createBaseNode(250); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | @@ -20142,7 +20342,7 @@ var ts; : node; } function createWithStatement(expression, statement) { - var node = createBaseNode(248); + var node = createBaseNode(251); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -20157,7 +20357,7 @@ var ts; : node; } function createSwitchStatement(expression, caseBlock) { - var node = createBaseNode(249); + var node = createBaseNode(252); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.caseBlock = caseBlock; node.transformFlags |= @@ -20172,7 +20372,7 @@ var ts; : node; } function createLabeledStatement(label, statement) { - var node = createBaseNode(250); + var node = createBaseNode(253); node.label = asName(label); node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -20187,7 +20387,7 @@ var ts; : node; } function createThrowStatement(expression) { - var node = createBaseNode(251); + var node = createBaseNode(254); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -20198,7 +20398,7 @@ var ts; : node; } function createTryStatement(tryBlock, catchClause, finallyBlock) { - var node = createBaseNode(252); + var node = createBaseNode(255); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -20216,10 +20416,10 @@ var ts; : node; } function createDebuggerStatement() { - return createBaseNode(253); + return createBaseNode(256); } function createVariableDeclaration(name, exclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(254, undefined, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + var node = createBaseVariableLikeDeclaration(257, undefined, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.exclamationToken = exclamationToken; node.transformFlags |= propagateChildFlags(node.exclamationToken); if (exclamationToken) { @@ -20237,7 +20437,7 @@ var ts; } function createVariableDeclarationList(declarations, flags) { if (flags === void 0) { flags = 0; } - var node = createBaseNode(255); + var node = createBaseNode(258); node.flags |= flags & 3; node.declarations = createNodeArray(declarations); node.transformFlags |= @@ -20256,7 +20456,7 @@ var ts; : node; } function createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(256, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(259, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; if (!node.body || ts.modifiersToFlags(node.modifiers) & 2) { node.transformFlags = 1; @@ -20265,7 +20465,7 @@ var ts; node.transformFlags |= propagateChildFlags(node.asteriskToken) | 4194304; - if (ts.modifiersToFlags(node.modifiers) & 256) { + if (ts.modifiersToFlags(node.modifiers) & 512) { if (node.asteriskToken) { node.transformFlags |= 128; } @@ -20298,7 +20498,7 @@ var ts; return finishUpdateBaseSignatureDeclaration(updated, original); } function createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(257, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(260, modifiers, name, typeParameters, heritageClauses, members); if (ts.modifiersToFlags(node.modifiers) & 2) { node.transformFlags = 1; } @@ -20320,7 +20520,7 @@ var ts; : node; } function createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseInterfaceOrClassLikeDeclaration(258, modifiers, name, typeParameters, heritageClauses); + var node = createBaseInterfaceOrClassLikeDeclaration(261, modifiers, name, typeParameters, heritageClauses); node.members = createNodeArray(members); node.transformFlags = 1; node.illegalDecorators = undefined; @@ -20342,7 +20542,7 @@ var ts; return update(updated, original); } function createTypeAliasDeclaration(modifiers, name, typeParameters, type) { - var node = createBaseGenericNamedDeclaration(259, modifiers, name, typeParameters); + var node = createBaseGenericNamedDeclaration(262, modifiers, name, typeParameters); node.type = type; node.transformFlags = 1; node.illegalDecorators = undefined; @@ -20363,7 +20563,7 @@ var ts; return update(updated, original); } function createEnumDeclaration(modifiers, name, members) { - var node = createBaseNamedDeclaration(260, modifiers, name); + var node = createBaseNamedDeclaration(263, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= propagateChildrenFlags(node.members) | @@ -20387,7 +20587,7 @@ var ts; } function createModuleDeclaration(modifiers, name, body, flags) { if (flags === void 0) { flags = 0; } - var node = createBaseDeclaration(261); + var node = createBaseDeclaration(264); node.modifiers = asNodeArray(modifiers); node.flags |= flags & (16 | 4 | 1024); node.name = name; @@ -20420,7 +20620,7 @@ var ts; return update(updated, original); } function createModuleBlock(statements) { - var node = createBaseNode(262); + var node = createBaseNode(265); node.statements = createNodeArray(statements); node.transformFlags |= propagateChildrenFlags(node.statements); return node; @@ -20431,7 +20631,7 @@ var ts; : node; } function createCaseBlock(clauses) { - var node = createBaseNode(263); + var node = createBaseNode(266); node.clauses = createNodeArray(clauses); node.transformFlags |= propagateChildrenFlags(node.clauses); return node; @@ -20442,7 +20642,7 @@ var ts; : node; } function createNamespaceExportDeclaration(name) { - var node = createBaseNamedDeclaration(264, undefined, name); + var node = createBaseNamedDeclaration(267, undefined, name); node.transformFlags = 1; node.illegalDecorators = undefined; node.modifiers = undefined; @@ -20461,7 +20661,7 @@ var ts; return update(updated, original); } function createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference) { - var node = createBaseNamedDeclaration(265, modifiers, name); + var node = createBaseNamedDeclaration(268, modifiers, name); node.isTypeOnly = isTypeOnly; node.moduleReference = moduleReference; node.transformFlags |= propagateChildFlags(node.moduleReference); @@ -20486,7 +20686,7 @@ var ts; return update(updated, original); } function createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(266); + var node = createBaseDeclaration(269); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; @@ -20513,7 +20713,7 @@ var ts; return update(updated, original); } function createImportClause(isTypeOnly, name, namedBindings) { - var node = createBaseNode(267); + var node = createBaseNode(270); node.isTypeOnly = isTypeOnly; node.name = name; node.namedBindings = namedBindings; @@ -20534,7 +20734,7 @@ var ts; : node; } function createAssertClause(elements, multiLine) { - var node = createBaseNode(293); + var node = createBaseNode(296); node.elements = createNodeArray(elements); node.multiLine = multiLine; node.transformFlags |= 4; @@ -20547,7 +20747,7 @@ var ts; : node; } function createAssertEntry(name, value) { - var node = createBaseNode(294); + var node = createBaseNode(297); node.name = name; node.value = value; node.transformFlags |= 4; @@ -20560,7 +20760,7 @@ var ts; : node; } function createImportTypeAssertionContainer(clause, multiLine) { - var node = createBaseNode(295); + var node = createBaseNode(298); node.assertClause = clause; node.multiLine = multiLine; return node; @@ -20572,7 +20772,7 @@ var ts; : node; } function createNamespaceImport(name) { - var node = createBaseNode(268); + var node = createBaseNode(271); node.name = name; node.transformFlags |= propagateChildFlags(node.name); node.transformFlags &= ~67108864; @@ -20584,7 +20784,7 @@ var ts; : node; } function createNamespaceExport(name) { - var node = createBaseNode(274); + var node = createBaseNode(277); node.name = name; node.transformFlags |= propagateChildFlags(node.name) | @@ -20598,7 +20798,7 @@ var ts; : node; } function createNamedImports(elements) { - var node = createBaseNode(269); + var node = createBaseNode(272); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864; @@ -20610,7 +20810,7 @@ var ts; : node; } function createImportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(270); + var node = createBaseNode(273); node.isTypeOnly = isTypeOnly; node.propertyName = propertyName; node.name = name; @@ -20628,7 +20828,7 @@ var ts; : node; } function createExportAssignment(modifiers, isExportEquals, expression) { - var node = createBaseDeclaration(271); + var node = createBaseDeclaration(274); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = isExportEquals @@ -20652,7 +20852,7 @@ var ts; return update(updated, original); } function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(272); + var node = createBaseDeclaration(275); node.modifiers = asNodeArray(modifiers); node.isTypeOnly = isTypeOnly; node.exportClause = exportClause; @@ -20682,7 +20882,7 @@ var ts; return update(updated, original); } function createNamedExports(elements) { - var node = createBaseNode(273); + var node = createBaseNode(276); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864; @@ -20694,7 +20894,7 @@ var ts; : node; } function createExportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(275); + var node = createBaseNode(278); node.isTypeOnly = isTypeOnly; node.propertyName = asName(propertyName); node.name = asName(name); @@ -20712,11 +20912,11 @@ var ts; : node; } function createMissingDeclaration() { - var node = createBaseDeclaration(276); + var node = createBaseDeclaration(279); return node; } function createExternalModuleReference(expression) { - var node = createBaseNode(277); + var node = createBaseNode(280); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); node.transformFlags &= ~67108864; @@ -20752,7 +20952,7 @@ var ts; : node; } function createJSDocFunctionType(parameters, type) { - var node = createBaseSignatureDeclaration(317, undefined, undefined, undefined, parameters, type); + var node = createBaseSignatureDeclaration(320, undefined, undefined, undefined, parameters, type); return node; } function updateJSDocFunctionType(node, parameters, type) { @@ -20763,7 +20963,7 @@ var ts; } function createJSDocTypeLiteral(propertyTags, isArrayType) { if (isArrayType === void 0) { isArrayType = false; } - var node = createBaseNode(322); + var node = createBaseNode(325); node.jsDocPropertyTags = asNodeArray(propertyTags); node.isArrayType = isArrayType; return node; @@ -20775,7 +20975,7 @@ var ts; : node; } function createJSDocTypeExpression(type) { - var node = createBaseNode(309); + var node = createBaseNode(312); node.type = type; return node; } @@ -20785,7 +20985,7 @@ var ts; : node; } function createJSDocSignature(typeParameters, parameters, type) { - var node = createBaseNode(323); + var node = createBaseNode(326); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; @@ -20811,7 +21011,7 @@ var ts; return node; } function createJSDocTemplateTag(tagName, constraint, typeParameters, comment) { - var node = createBaseJSDocTag(344, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); + var node = createBaseJSDocTag(347, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); return node; @@ -20826,7 +21026,7 @@ var ts; : node; } function createJSDocTypedefTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(345, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); + var node = createBaseJSDocTag(348, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -20842,7 +21042,7 @@ var ts; : node; } function createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(340, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); + var node = createBaseJSDocTag(343, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -20861,7 +21061,7 @@ var ts; : node; } function createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(347, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); + var node = createBaseJSDocTag(350, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -20880,7 +21080,7 @@ var ts; : node; } function createJSDocCallbackTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(338, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); + var node = createBaseJSDocTag(341, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -20896,7 +21096,7 @@ var ts; : node; } function createJSDocAugmentsTag(tagName, className, comment) { - var node = createBaseJSDocTag(328, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); + var node = createBaseJSDocTag(331, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); node.class = className; return node; } @@ -20909,12 +21109,12 @@ var ts; : node; } function createJSDocImplementsTag(tagName, className, comment) { - var node = createBaseJSDocTag(329, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); + var node = createBaseJSDocTag(332, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); node.class = className; return node; } function createJSDocSeeTag(tagName, name, comment) { - var node = createBaseJSDocTag(346, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); + var node = createBaseJSDocTag(349, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); node.name = name; return node; } @@ -20926,7 +21126,7 @@ var ts; : node; } function createJSDocNameReference(name) { - var node = createBaseNode(310); + var node = createBaseNode(313); node.name = name; return node; } @@ -20936,7 +21136,7 @@ var ts; : node; } function createJSDocMemberName(left, right) { - var node = createBaseNode(311); + var node = createBaseNode(314); node.left = left; node.right = right; node.transformFlags |= @@ -20951,7 +21151,7 @@ var ts; : node; } function createJSDocLink(name, text) { - var node = createBaseNode(324); + var node = createBaseNode(327); node.name = name; node.text = text; return node; @@ -20962,7 +21162,7 @@ var ts; : node; } function createJSDocLinkCode(name, text) { - var node = createBaseNode(325); + var node = createBaseNode(328); node.name = name; node.text = text; return node; @@ -20973,7 +21173,7 @@ var ts; : node; } function createJSDocLinkPlain(name, text) { - var node = createBaseNode(326); + var node = createBaseNode(329); node.name = name; node.text = text; return node; @@ -21016,7 +21216,7 @@ var ts; : node; } function createJSDocUnknownTag(tagName, comment) { - var node = createBaseJSDocTag(327, tagName, comment); + var node = createBaseJSDocTag(330, tagName, comment); return node; } function updateJSDocUnknownTag(node, tagName, comment) { @@ -21026,7 +21226,7 @@ var ts; : node; } function createJSDocText(text) { - var node = createBaseNode(321); + var node = createBaseNode(324); node.text = text; return node; } @@ -21036,7 +21236,7 @@ var ts; : node; } function createJSDocComment(comment, tags) { - var node = createBaseNode(320); + var node = createBaseNode(323); node.comment = comment; node.tags = asNodeArray(tags); return node; @@ -21048,7 +21248,7 @@ var ts; : node; } function createJsxElement(openingElement, children, closingElement) { - var node = createBaseNode(278); + var node = createBaseNode(281); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -21067,7 +21267,7 @@ var ts; : node; } function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createBaseNode(279); + var node = createBaseNode(282); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -21089,7 +21289,7 @@ var ts; : node; } function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createBaseNode(280); + var node = createBaseNode(283); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -21111,7 +21311,7 @@ var ts; : node; } function createJsxClosingElement(tagName) { - var node = createBaseNode(281); + var node = createBaseNode(284); node.tagName = tagName; node.transformFlags |= propagateChildFlags(node.tagName) | @@ -21124,7 +21324,7 @@ var ts; : node; } function createJsxFragment(openingFragment, children, closingFragment) { - var node = createBaseNode(282); + var node = createBaseNode(285); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -21156,17 +21356,17 @@ var ts; : node; } function createJsxOpeningFragment() { - var node = createBaseNode(283); + var node = createBaseNode(286); node.transformFlags |= 2; return node; } function createJsxJsxClosingFragment() { - var node = createBaseNode(284); + var node = createBaseNode(287); node.transformFlags |= 2; return node; } function createJsxAttribute(name, initializer) { - var node = createBaseNode(285); + var node = createBaseNode(288); node.name = name; node.initializer = initializer; node.transformFlags |= @@ -21182,7 +21382,7 @@ var ts; : node; } function createJsxAttributes(properties) { - var node = createBaseNode(286); + var node = createBaseNode(289); node.properties = createNodeArray(properties); node.transformFlags |= propagateChildrenFlags(node.properties) | @@ -21195,7 +21395,7 @@ var ts; : node; } function createJsxSpreadAttribute(expression) { - var node = createBaseNode(287); + var node = createBaseNode(290); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | @@ -21208,7 +21408,7 @@ var ts; : node; } function createJsxExpression(dotDotDotToken, expression) { - var node = createBaseNode(288); + var node = createBaseNode(291); node.dotDotDotToken = dotDotDotToken; node.expression = expression; node.transformFlags |= @@ -21223,7 +21423,7 @@ var ts; : node; } function createCaseClause(expression, statements) { - var node = createBaseNode(289); + var node = createBaseNode(292); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.statements = createNodeArray(statements); node.transformFlags |= @@ -21238,7 +21438,7 @@ var ts; : node; } function createDefaultClause(statements) { - var node = createBaseNode(290); + var node = createBaseNode(293); node.statements = createNodeArray(statements); node.transformFlags = propagateChildrenFlags(node.statements); return node; @@ -21249,7 +21449,7 @@ var ts; : node; } function createHeritageClause(token, types) { - var node = createBaseNode(291); + var node = createBaseNode(294); node.token = token; node.types = createNodeArray(types); node.transformFlags |= propagateChildrenFlags(node.types); @@ -21271,7 +21471,7 @@ var ts; : node; } function createCatchClause(variableDeclaration, block) { - var node = createBaseNode(292); + var node = createBaseNode(295); if (typeof variableDeclaration === "string" || variableDeclaration && !ts.isVariableDeclaration(variableDeclaration)) { variableDeclaration = createVariableDeclaration(variableDeclaration, undefined, undefined, undefined); } @@ -21291,7 +21491,7 @@ var ts; : node; } function createPropertyAssignment(name, initializer) { - var node = createBaseNamedDeclaration(296, undefined, name); + var node = createBaseNamedDeclaration(299, undefined, name); node.initializer = parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= propagateChildFlags(node.name) | @@ -21318,7 +21518,7 @@ var ts; return update(updated, original); } function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createBaseNamedDeclaration(297, undefined, name); + var node = createBaseNamedDeclaration(300, undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= propagateChildFlags(node.objectAssignmentInitializer) | @@ -21347,7 +21547,7 @@ var ts; return update(updated, original); } function createSpreadAssignment(expression) { - var node = createBaseNode(298); + var node = createBaseNode(301); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -21361,7 +21561,7 @@ var ts; : node; } function createEnumMember(name, initializer) { - var node = createBaseNode(299); + var node = createBaseNode(302); node.name = asName(name); node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -21377,7 +21577,7 @@ var ts; : node; } function createSourceFile(statements, endOfFileToken, flags) { - var node = baseFactory.createBaseSourceFileNode(305); + var node = baseFactory.createBaseSourceFileNode(308); node.statements = createNodeArray(statements); node.endOfFileToken = endOfFileToken; node.flags |= flags; @@ -21394,7 +21594,7 @@ var ts; return node; } function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) { - var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305)); + var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(308)); for (var p in source) { if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p)) continue; @@ -21431,7 +21631,7 @@ var ts; } function createBundle(sourceFiles, prepends) { if (prepends === void 0) { prepends = ts.emptyArray; } - var node = createBaseNode(306); + var node = createBaseNode(309); node.prepends = prepends; node.sourceFiles = sourceFiles; return node; @@ -21444,7 +21644,7 @@ var ts; : node; } function createUnparsedSource(prologues, syntheticReferences, texts) { - var node = createBaseNode(307); + var node = createBaseNode(310); node.prologues = prologues; node.syntheticReferences = syntheticReferences; node.texts = texts; @@ -21461,49 +21661,49 @@ var ts; return node; } function createUnparsedPrologue(data) { - return createBaseUnparsedNode(300, data); + return createBaseUnparsedNode(303, data); } function createUnparsedPrepend(data, texts) { - var node = createBaseUnparsedNode(301, data); + var node = createBaseUnparsedNode(304, data); node.texts = texts; return node; } function createUnparsedTextLike(data, internal) { - return createBaseUnparsedNode(internal ? 303 : 302, data); + return createBaseUnparsedNode(internal ? 306 : 305, data); } function createUnparsedSyntheticReference(section) { - var node = createBaseNode(304); + var node = createBaseNode(307); node.data = section.data; node.section = section; return node; } function createInputFiles() { - var node = createBaseNode(308); + var node = createBaseNode(311); node.javascriptText = ""; node.declarationText = ""; return node; } function createSyntheticExpression(type, isSpread, tupleNameSource) { if (isSpread === void 0) { isSpread = false; } - var node = createBaseNode(232); + var node = createBaseNode(234); node.type = type; node.isSpread = isSpread; node.tupleNameSource = tupleNameSource; return node; } function createSyntaxList(children) { - var node = createBaseNode(348); + var node = createBaseNode(351); node._children = children; return node; } function createNotEmittedStatement(original) { - var node = createBaseNode(349); + var node = createBaseNode(352); node.original = original; ts.setTextRange(node, original); return node; } function createPartiallyEmittedExpression(expression, original) { - var node = createBaseNode(350); + var node = createBaseNode(353); node.expression = expression; node.original = original; node.transformFlags |= @@ -21529,7 +21729,7 @@ var ts; return node; } function createCommaListExpression(elements) { - var node = createBaseNode(351); + var node = createBaseNode(354); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); node.transformFlags |= propagateChildrenFlags(node.elements); return node; @@ -21540,19 +21740,19 @@ var ts; : node; } function createEndOfDeclarationMarker(original) { - var node = createBaseNode(353); + var node = createBaseNode(356); node.emitNode = {}; node.original = original; return node; } function createMergeDeclarationMarker(original) { - var node = createBaseNode(352); + var node = createBaseNode(355); node.emitNode = {}; node.original = original; return node; } function createSyntheticReferenceExpression(expression, thisArg) { - var node = createBaseNode(354); + var node = createBaseNode(357); node.expression = expression; node.thisArg = thisArg; node.transformFlags |= @@ -21570,7 +21770,7 @@ var ts; if (node === undefined) { return node; } - var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(305) : + var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(308) : ts.isIdentifier(node) ? baseFactory.createBaseIdentifierNode(79) : ts.isPrivateIdentifier(node) ? baseFactory.createBasePrivateIdentifierNode(80) : !ts.isNodeKind(node.kind) ? baseFactory.createBaseTokenNode(node.kind) : @@ -21579,7 +21779,7 @@ var ts; clone.transformFlags = node.transformFlags; setOriginalNode(clone, node); for (var key in node) { - if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) { continue; } clone[key] = node[key]; @@ -21661,11 +21861,12 @@ var ts; } function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 212: return updateParenthesizedExpression(outerExpression, expression); - case 211: return updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 229: return updateAsExpression(outerExpression, expression, outerExpression.type); - case 230: return updateNonNullExpression(outerExpression, expression); - case 350: return updatePartiallyEmittedExpression(outerExpression, expression); + case 214: return updateParenthesizedExpression(outerExpression, expression); + case 213: return updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 231: return updateAsExpression(outerExpression, expression, outerExpression.type); + case 235: return updateSatisfiesExpression(outerExpression, expression, outerExpression.type); + case 232: return updateNonNullExpression(outerExpression, expression); + case 353: return updatePartiallyEmittedExpression(outerExpression, expression); } } function isIgnorableParen(node) { @@ -21705,13 +21906,13 @@ var ts; case 9: case 10: return false; - case 204: + case 206: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 205: + case 207: return target.properties.length > 0; default: return true; @@ -22005,24 +22206,24 @@ var ts; } function getDefaultTagNameForKind(kind) { switch (kind) { - case 343: return "type"; - case 341: return "returns"; - case 342: return "this"; - case 339: return "enum"; - case 330: return "author"; - case 332: return "class"; - case 333: return "public"; - case 334: return "private"; - case 335: return "protected"; - case 336: return "readonly"; - case 337: return "override"; - case 344: return "template"; - case 345: return "typedef"; - case 340: return "param"; - case 347: return "prop"; - case 338: return "callback"; - case 328: return "augments"; - case 329: return "implements"; + case 346: return "type"; + case 344: return "returns"; + case 345: return "this"; + case 342: return "enum"; + case 333: return "author"; + case 335: return "class"; + case 336: return "public"; + case 337: return "private"; + case 338: return "protected"; + case 339: return "readonly"; + case 340: return "override"; + case 347: return "template"; + case 348: return "typedef"; + case 343: return "param"; + case 350: return "prop"; + case 341: return "callback"; + case 331: return "augments"; + case 332: return "implements"; default: return ts.Debug.fail("Unsupported kind: ".concat(ts.Debug.formatSyntaxKind(kind))); } @@ -22095,69 +22296,70 @@ var ts; children.transformFlags = subtreeFlags; } function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 177 && kind <= 200) { + if (kind >= 179 && kind <= 202) { return -2; } switch (kind) { - case 208: - case 209: - case 204: + case 210: + case 211: + case 206: return -2147450880; - case 261: + case 264: return -1941676032; - case 164: + case 166: return -2147483648; - case 214: + case 216: return -2072174592; - case 213: - case 256: + case 215: + case 259: return -1937940480; - case 255: + case 258: return -2146893824; - case 257: - case 226: + case 260: + case 228: return -2147344384; - case 171: + case 173: return -1937948672; - case 167: - return -2013249536; case 169: - case 172: - case 173: + return -2013249536; + case 171: + case 174: + case 175: return -2005057536; - case 130: - case 147: - case 158: - case 143: - case 150: + case 131: case 148: - case 133: - case 151: + case 160: + case 144: + case 152: + case 149: + case 134: + case 153: case 114: - case 163: - case 166: + case 165: case 168: - case 174: - case 175: + case 170: case 176: - case 258: - case 259: + case 177: + case 178: + case 261: + case 262: return -2; - case 205: + case 207: return -2147278848; - case 292: + case 295: return -2147418112; - case 201: - case 202: + case 203: + case 204: return -2147450880; - case 211: - case 229: - case 350: - case 212: + case 213: + case 235: + case 231: + case 353: + case 214: case 106: return -2147483648; - case 206: - case 207: + case 208: + case 209: return -2147483648; default: return -2147483648; @@ -22355,9 +22557,10 @@ var ts; }; var buildInfo_1; var getAndCacheBuildInfo_1 = function (getText) { + var _a; if (buildInfo_1 === undefined) { var result = getText(); - buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false; + buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false; } return buildInfo_1 || undefined; }; @@ -22406,7 +22609,7 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine; + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine, snippetElement = sourceEmitNode.snippetElement; if (!destEmitNode) destEmitNode = {}; if (leadingComments) @@ -22431,6 +22634,8 @@ var ts; } if (startsOnNewLine !== undefined) destEmitNode.startsOnNewLine = startsOnNewLine; + if (snippetElement !== undefined) + destEmitNode.snippetElement = snippetElement; return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -22448,7 +22653,7 @@ var ts; var _a; if (!node.emitNode) { if (ts.isParseTreeNode(node)) { - if (node.kind === 305) { + if (node.kind === 308) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = (_a = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)))) !== null && _a !== void 0 ? _a : ts.Debug.fail("Could not determine parsed source file."); @@ -22999,7 +23204,7 @@ var ts; importName: "__generator", scoped: false, priority: 6, - text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" + text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" }; ts.createBindingHelper = { name: "typescript:commonjscreatebinding", @@ -23194,19 +23399,19 @@ var ts; } ts.isExportModifier = isExportModifier; function isAsyncModifier(node) { - return node.kind === 131; + return node.kind === 132; } ts.isAsyncModifier = isAsyncModifier; function isAssertsKeyword(node) { - return node.kind === 128; + return node.kind === 129; } ts.isAssertsKeyword = isAssertsKeyword; function isAwaitKeyword(node) { - return node.kind === 132; + return node.kind === 133; } ts.isAwaitKeyword = isAwaitKeyword; function isReadonlyKeyword(node) { - return node.kind === 145; + return node.kind === 146; } ts.isReadonlyKeyword = isReadonlyKeyword; function isStaticModifier(node) { @@ -23218,9 +23423,13 @@ var ts; } ts.isAbstractModifier = isAbstractModifier; function isOverrideModifier(node) { - return node.kind === 159; + return node.kind === 161; } ts.isOverrideModifier = isOverrideModifier; + function isAccessorModifier(node) { + return node.kind === 127; + } + ts.isAccessorModifier = isAccessorModifier; function isSuperKeyword(node) { return node.kind === 106; } @@ -23230,755 +23439,759 @@ var ts; } ts.isImportKeyword = isImportKeyword; function isQualifiedName(node) { - return node.kind === 161; + return node.kind === 163; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 162; + return node.kind === 164; } ts.isComputedPropertyName = isComputedPropertyName; function isTypeParameterDeclaration(node) { - return node.kind === 163; + return node.kind === 165; } ts.isTypeParameterDeclaration = isTypeParameterDeclaration; function isParameter(node) { - return node.kind === 164; + return node.kind === 166; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 165; + return node.kind === 167; } ts.isDecorator = isDecorator; function isPropertySignature(node) { - return node.kind === 166; + return node.kind === 168; } ts.isPropertySignature = isPropertySignature; function isPropertyDeclaration(node) { - return node.kind === 167; + return node.kind === 169; } ts.isPropertyDeclaration = isPropertyDeclaration; function isMethodSignature(node) { - return node.kind === 168; + return node.kind === 170; } ts.isMethodSignature = isMethodSignature; function isMethodDeclaration(node) { - return node.kind === 169; + return node.kind === 171; } ts.isMethodDeclaration = isMethodDeclaration; function isClassStaticBlockDeclaration(node) { - return node.kind === 170; + return node.kind === 172; } ts.isClassStaticBlockDeclaration = isClassStaticBlockDeclaration; function isConstructorDeclaration(node) { - return node.kind === 171; + return node.kind === 173; } ts.isConstructorDeclaration = isConstructorDeclaration; function isGetAccessorDeclaration(node) { - return node.kind === 172; + return node.kind === 174; } ts.isGetAccessorDeclaration = isGetAccessorDeclaration; function isSetAccessorDeclaration(node) { - return node.kind === 173; + return node.kind === 175; } ts.isSetAccessorDeclaration = isSetAccessorDeclaration; function isCallSignatureDeclaration(node) { - return node.kind === 174; + return node.kind === 176; } ts.isCallSignatureDeclaration = isCallSignatureDeclaration; function isConstructSignatureDeclaration(node) { - return node.kind === 175; + return node.kind === 177; } ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration; function isIndexSignatureDeclaration(node) { - return node.kind === 176; + return node.kind === 178; } ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration; function isTypePredicateNode(node) { - return node.kind === 177; + return node.kind === 179; } ts.isTypePredicateNode = isTypePredicateNode; function isTypeReferenceNode(node) { - return node.kind === 178; + return node.kind === 180; } ts.isTypeReferenceNode = isTypeReferenceNode; function isFunctionTypeNode(node) { - return node.kind === 179; + return node.kind === 181; } ts.isFunctionTypeNode = isFunctionTypeNode; function isConstructorTypeNode(node) { - return node.kind === 180; + return node.kind === 182; } ts.isConstructorTypeNode = isConstructorTypeNode; function isTypeQueryNode(node) { - return node.kind === 181; + return node.kind === 183; } ts.isTypeQueryNode = isTypeQueryNode; function isTypeLiteralNode(node) { - return node.kind === 182; + return node.kind === 184; } ts.isTypeLiteralNode = isTypeLiteralNode; function isArrayTypeNode(node) { - return node.kind === 183; + return node.kind === 185; } ts.isArrayTypeNode = isArrayTypeNode; function isTupleTypeNode(node) { - return node.kind === 184; + return node.kind === 186; } ts.isTupleTypeNode = isTupleTypeNode; function isNamedTupleMember(node) { - return node.kind === 197; + return node.kind === 199; } ts.isNamedTupleMember = isNamedTupleMember; function isOptionalTypeNode(node) { - return node.kind === 185; + return node.kind === 187; } ts.isOptionalTypeNode = isOptionalTypeNode; function isRestTypeNode(node) { - return node.kind === 186; + return node.kind === 188; } ts.isRestTypeNode = isRestTypeNode; function isUnionTypeNode(node) { - return node.kind === 187; + return node.kind === 189; } ts.isUnionTypeNode = isUnionTypeNode; function isIntersectionTypeNode(node) { - return node.kind === 188; + return node.kind === 190; } ts.isIntersectionTypeNode = isIntersectionTypeNode; function isConditionalTypeNode(node) { - return node.kind === 189; + return node.kind === 191; } ts.isConditionalTypeNode = isConditionalTypeNode; function isInferTypeNode(node) { - return node.kind === 190; + return node.kind === 192; } ts.isInferTypeNode = isInferTypeNode; function isParenthesizedTypeNode(node) { - return node.kind === 191; + return node.kind === 193; } ts.isParenthesizedTypeNode = isParenthesizedTypeNode; function isThisTypeNode(node) { - return node.kind === 192; + return node.kind === 194; } ts.isThisTypeNode = isThisTypeNode; function isTypeOperatorNode(node) { - return node.kind === 193; + return node.kind === 195; } ts.isTypeOperatorNode = isTypeOperatorNode; function isIndexedAccessTypeNode(node) { - return node.kind === 194; + return node.kind === 196; } ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode; function isMappedTypeNode(node) { - return node.kind === 195; + return node.kind === 197; } ts.isMappedTypeNode = isMappedTypeNode; function isLiteralTypeNode(node) { - return node.kind === 196; + return node.kind === 198; } ts.isLiteralTypeNode = isLiteralTypeNode; function isImportTypeNode(node) { - return node.kind === 200; + return node.kind === 202; } ts.isImportTypeNode = isImportTypeNode; function isTemplateLiteralTypeSpan(node) { - return node.kind === 199; + return node.kind === 201; } ts.isTemplateLiteralTypeSpan = isTemplateLiteralTypeSpan; function isTemplateLiteralTypeNode(node) { - return node.kind === 198; + return node.kind === 200; } ts.isTemplateLiteralTypeNode = isTemplateLiteralTypeNode; function isObjectBindingPattern(node) { - return node.kind === 201; + return node.kind === 203; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 202; + return node.kind === 204; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 203; + return node.kind === 205; } ts.isBindingElement = isBindingElement; function isArrayLiteralExpression(node) { - return node.kind === 204; + return node.kind === 206; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 205; + return node.kind === 207; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 206; + return node.kind === 208; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 207; + return node.kind === 209; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 208; + return node.kind === 210; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 209; + return node.kind === 211; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 210; + return node.kind === 212; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertionExpression(node) { - return node.kind === 211; + return node.kind === 213; } ts.isTypeAssertionExpression = isTypeAssertionExpression; function isParenthesizedExpression(node) { - return node.kind === 212; + return node.kind === 214; } ts.isParenthesizedExpression = isParenthesizedExpression; function isFunctionExpression(node) { - return node.kind === 213; + return node.kind === 215; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 214; + return node.kind === 216; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 215; + return node.kind === 217; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 216; + return node.kind === 218; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 217; + return node.kind === 219; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 218; + return node.kind === 220; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 219; + return node.kind === 221; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 220; + return node.kind === 222; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 221; + return node.kind === 223; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 222; + return node.kind === 224; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 223; + return node.kind === 225; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 224; + return node.kind === 226; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 225; + return node.kind === 227; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 226; + return node.kind === 228; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 227; + return node.kind === 229; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 228; + return node.kind === 230; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 229; + return node.kind === 231; } ts.isAsExpression = isAsExpression; + function isSatisfiesExpression(node) { + return node.kind === 235; + } + ts.isSatisfiesExpression = isSatisfiesExpression; function isNonNullExpression(node) { - return node.kind === 230; + return node.kind === 232; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 231; + return node.kind === 233; } ts.isMetaProperty = isMetaProperty; function isSyntheticExpression(node) { - return node.kind === 232; + return node.kind === 234; } ts.isSyntheticExpression = isSyntheticExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 350; + return node.kind === 353; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isCommaListExpression(node) { - return node.kind === 351; + return node.kind === 354; } ts.isCommaListExpression = isCommaListExpression; function isTemplateSpan(node) { - return node.kind === 233; + return node.kind === 236; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 234; + return node.kind === 237; } ts.isSemicolonClassElement = isSemicolonClassElement; function isBlock(node) { - return node.kind === 235; + return node.kind === 238; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 237; + return node.kind === 240; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 236; + return node.kind === 239; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 238; + return node.kind === 241; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 239; + return node.kind === 242; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 240; + return node.kind === 243; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 241; + return node.kind === 244; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 242; + return node.kind === 245; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 243; + return node.kind === 246; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 244; + return node.kind === 247; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 245; + return node.kind === 248; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 246; + return node.kind === 249; } ts.isBreakStatement = isBreakStatement; function isReturnStatement(node) { - return node.kind === 247; + return node.kind === 250; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 248; + return node.kind === 251; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 249; + return node.kind === 252; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 250; + return node.kind === 253; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 251; + return node.kind === 254; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 252; + return node.kind === 255; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 253; + return node.kind === 256; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 254; + return node.kind === 257; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 255; + return node.kind === 258; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 256; + return node.kind === 259; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 257; + return node.kind === 260; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 258; + return node.kind === 261; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 259; + return node.kind === 262; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 260; + return node.kind === 263; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 261; + return node.kind === 264; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 262; + return node.kind === 265; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 263; + return node.kind === 266; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 264; + return node.kind === 267; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 265; + return node.kind === 268; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 266; + return node.kind === 269; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 267; + return node.kind === 270; } ts.isImportClause = isImportClause; function isImportTypeAssertionContainer(node) { - return node.kind === 295; + return node.kind === 298; } ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer; function isAssertClause(node) { - return node.kind === 293; + return node.kind === 296; } ts.isAssertClause = isAssertClause; function isAssertEntry(node) { - return node.kind === 294; + return node.kind === 297; } ts.isAssertEntry = isAssertEntry; function isNamespaceImport(node) { - return node.kind === 268; + return node.kind === 271; } ts.isNamespaceImport = isNamespaceImport; function isNamespaceExport(node) { - return node.kind === 274; + return node.kind === 277; } ts.isNamespaceExport = isNamespaceExport; function isNamedImports(node) { - return node.kind === 269; + return node.kind === 272; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 270; + return node.kind === 273; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 271; + return node.kind === 274; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 272; + return node.kind === 275; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 273; + return node.kind === 276; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 275; + return node.kind === 278; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 276; + return node.kind === 279; } ts.isMissingDeclaration = isMissingDeclaration; function isNotEmittedStatement(node) { - return node.kind === 349; + return node.kind === 352; } ts.isNotEmittedStatement = isNotEmittedStatement; function isSyntheticReference(node) { - return node.kind === 354; + return node.kind === 357; } ts.isSyntheticReference = isSyntheticReference; function isMergeDeclarationMarker(node) { - return node.kind === 352; + return node.kind === 355; } ts.isMergeDeclarationMarker = isMergeDeclarationMarker; function isEndOfDeclarationMarker(node) { - return node.kind === 353; + return node.kind === 356; } ts.isEndOfDeclarationMarker = isEndOfDeclarationMarker; function isExternalModuleReference(node) { - return node.kind === 277; + return node.kind === 280; } ts.isExternalModuleReference = isExternalModuleReference; function isJsxElement(node) { - return node.kind === 278; + return node.kind === 281; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 279; + return node.kind === 282; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 280; + return node.kind === 283; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 281; + return node.kind === 284; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 282; + return node.kind === 285; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 283; + return node.kind === 286; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 284; + return node.kind === 287; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 285; + return node.kind === 288; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 286; + return node.kind === 289; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 287; + return node.kind === 290; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 288; + return node.kind === 291; } ts.isJsxExpression = isJsxExpression; function isCaseClause(node) { - return node.kind === 289; + return node.kind === 292; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 290; + return node.kind === 293; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 291; + return node.kind === 294; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 292; + return node.kind === 295; } ts.isCatchClause = isCatchClause; function isPropertyAssignment(node) { - return node.kind === 296; + return node.kind === 299; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 297; + return node.kind === 300; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 298; + return node.kind === 301; } ts.isSpreadAssignment = isSpreadAssignment; function isEnumMember(node) { - return node.kind === 299; + return node.kind === 302; } ts.isEnumMember = isEnumMember; function isUnparsedPrepend(node) { - return node.kind === 301; + return node.kind === 304; } ts.isUnparsedPrepend = isUnparsedPrepend; function isSourceFile(node) { - return node.kind === 305; + return node.kind === 308; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 306; + return node.kind === 309; } ts.isBundle = isBundle; function isUnparsedSource(node) { - return node.kind === 307; + return node.kind === 310; } ts.isUnparsedSource = isUnparsedSource; function isJSDocTypeExpression(node) { - return node.kind === 309; + return node.kind === 312; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocNameReference(node) { - return node.kind === 310; + return node.kind === 313; } ts.isJSDocNameReference = isJSDocNameReference; function isJSDocMemberName(node) { - return node.kind === 311; + return node.kind === 314; } ts.isJSDocMemberName = isJSDocMemberName; function isJSDocLink(node) { - return node.kind === 324; + return node.kind === 327; } ts.isJSDocLink = isJSDocLink; function isJSDocLinkCode(node) { - return node.kind === 325; + return node.kind === 328; } ts.isJSDocLinkCode = isJSDocLinkCode; function isJSDocLinkPlain(node) { - return node.kind === 326; + return node.kind === 329; } ts.isJSDocLinkPlain = isJSDocLinkPlain; function isJSDocAllType(node) { - return node.kind === 312; + return node.kind === 315; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 313; + return node.kind === 316; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 314; + return node.kind === 317; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 315; + return node.kind === 318; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 316; + return node.kind === 319; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 317; + return node.kind === 320; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 318; + return node.kind === 321; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDocNamepathType(node) { - return node.kind === 319; + return node.kind === 322; } ts.isJSDocNamepathType = isJSDocNamepathType; function isJSDoc(node) { - return node.kind === 320; + return node.kind === 323; } ts.isJSDoc = isJSDoc; function isJSDocTypeLiteral(node) { - return node.kind === 322; + return node.kind === 325; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; function isJSDocSignature(node) { - return node.kind === 323; + return node.kind === 326; } ts.isJSDocSignature = isJSDocSignature; function isJSDocAugmentsTag(node) { - return node.kind === 328; + return node.kind === 331; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocAuthorTag(node) { - return node.kind === 330; + return node.kind === 333; } ts.isJSDocAuthorTag = isJSDocAuthorTag; function isJSDocClassTag(node) { - return node.kind === 332; + return node.kind === 335; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocCallbackTag(node) { - return node.kind === 338; + return node.kind === 341; } ts.isJSDocCallbackTag = isJSDocCallbackTag; function isJSDocPublicTag(node) { - return node.kind === 333; + return node.kind === 336; } ts.isJSDocPublicTag = isJSDocPublicTag; function isJSDocPrivateTag(node) { - return node.kind === 334; + return node.kind === 337; } ts.isJSDocPrivateTag = isJSDocPrivateTag; function isJSDocProtectedTag(node) { - return node.kind === 335; + return node.kind === 338; } ts.isJSDocProtectedTag = isJSDocProtectedTag; function isJSDocReadonlyTag(node) { - return node.kind === 336; + return node.kind === 339; } ts.isJSDocReadonlyTag = isJSDocReadonlyTag; function isJSDocOverrideTag(node) { - return node.kind === 337; + return node.kind === 340; } ts.isJSDocOverrideTag = isJSDocOverrideTag; function isJSDocDeprecatedTag(node) { - return node.kind === 331; + return node.kind === 334; } ts.isJSDocDeprecatedTag = isJSDocDeprecatedTag; function isJSDocSeeTag(node) { - return node.kind === 346; + return node.kind === 349; } ts.isJSDocSeeTag = isJSDocSeeTag; function isJSDocEnumTag(node) { - return node.kind === 339; + return node.kind === 342; } ts.isJSDocEnumTag = isJSDocEnumTag; function isJSDocParameterTag(node) { - return node.kind === 340; + return node.kind === 343; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 341; + return node.kind === 344; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocThisTag(node) { - return node.kind === 342; + return node.kind === 345; } ts.isJSDocThisTag = isJSDocThisTag; function isJSDocTypeTag(node) { - return node.kind === 343; + return node.kind === 346; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 344; + return node.kind === 347; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 345; + return node.kind === 348; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocUnknownTag(node) { - return node.kind === 327; + return node.kind === 330; } ts.isJSDocUnknownTag = isJSDocUnknownTag; function isJSDocPropertyTag(node) { - return node.kind === 347; + return node.kind === 350; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocImplementsTag(node) { - return node.kind === 329; + return node.kind === 332; } ts.isJSDocImplementsTag = isJSDocImplementsTag; function isSyntaxList(n) { - return n.kind === 348; + return n.kind === 351; } ts.isSyntaxList = isSyntaxList; })(ts || (ts = {})); @@ -24139,14 +24352,14 @@ var ts; ts.Debug.failBadSyntaxKind(property.name, "Private identifiers are not allowed in object literals."); } switch (property.kind) { - case 172: - case 173: + case 174: + case 175: return createExpressionForAccessorDeclaration(factory, node.properties, property, receiver, !!node.multiLine); - case 296: + case 299: return createExpressionForPropertyAssignment(factory, property, receiver); - case 297: + case 300: return createExpressionForShorthandPropertyAssignment(factory, property, receiver); - case 169: + case 171: return createExpressionForMethodDeclaration(factory, property, receiver); } } @@ -24212,8 +24425,8 @@ var ts; } ts.startsWithUseStrict = startsWithUseStrict; function isCommaSequence(node) { - return node.kind === 221 && node.operatorToken.kind === 27 || - node.kind === 351; + return node.kind === 223 && node.operatorToken.kind === 27 || + node.kind === 354; } ts.isCommaSequence = isCommaSequence; function isJSDocTypeAssertion(node) { @@ -24231,17 +24444,18 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 15; } switch (node.kind) { - case 212: + case 214: if (kinds & 16 && isJSDocTypeAssertion(node)) { return false; } return (kinds & 1) !== 0; - case 211: - case 229: + case 213: + case 231: + case 235: return (kinds & 2) !== 0; - case 230: + case 232: return (kinds & 4) !== 0; - case 350: + case 353: return (kinds & 8) !== 0; } return false; @@ -24353,10 +24567,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : factory.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 266 && node.importClause) { + if (node.kind === 269 && node.importClause) { return factory.getGeneratedNameForNode(node); } - if (node.kind === 272 && node.moduleSpecifier) { + if (node.kind === 275 && node.moduleSpecifier) { return factory.getGeneratedNameForNode(node); } return undefined; @@ -24419,11 +24633,11 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 296: + case 299: return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 297: + case 300: return bindingElement.name; - case 298: + case 301: return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } return undefined; @@ -24439,11 +24653,11 @@ var ts; ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement; function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 164: - case 203: + case 166: + case 205: return bindingElement.dotDotDotToken; - case 225: - case 298: + case 227: + case 301: return bindingElement; } return undefined; @@ -24457,7 +24671,7 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 203: + case 205: if (bindingElement.propertyName) { var propertyName = bindingElement.propertyName; if (ts.isPrivateIdentifier(propertyName)) { @@ -24468,7 +24682,7 @@ var ts; : propertyName; } break; - case 296: + case 299: if (bindingElement.name) { var propertyName = bindingElement.name; if (ts.isPrivateIdentifier(propertyName)) { @@ -24479,7 +24693,7 @@ var ts; : propertyName; } break; - case 298: + case 301: if (bindingElement.name && ts.isPrivateIdentifier(bindingElement.name)) { return ts.Debug.failBadSyntaxKind(bindingElement.name); } @@ -24498,11 +24712,11 @@ var ts; } function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 201: - case 202: + case 203: case 204: + case 206: return name.elements; - case 205: + case 207: return name.properties; } } @@ -24521,46 +24735,46 @@ var ts; ts.getJSDocTypeAliasName = getJSDocTypeAliasName; function canHaveIllegalType(node) { var kind = node.kind; - return kind === 171 - || kind === 173; + return kind === 173 + || kind === 175; } ts.canHaveIllegalType = canHaveIllegalType; function canHaveIllegalTypeParameters(node) { var kind = node.kind; - return kind === 171 - || kind === 172 - || kind === 173; + return kind === 173 + || kind === 174 + || kind === 175; } ts.canHaveIllegalTypeParameters = canHaveIllegalTypeParameters; function canHaveIllegalDecorators(node) { var kind = node.kind; - return kind === 296 - || kind === 297 - || kind === 256 - || kind === 171 - || kind === 176 - || kind === 170 - || kind === 276 - || kind === 237 - || kind === 258 + return kind === 299 + || kind === 300 || kind === 259 - || kind === 260 + || kind === 173 + || kind === 178 + || kind === 172 + || kind === 279 + || kind === 240 || kind === 261 - || kind === 265 - || kind === 266 + || kind === 262 + || kind === 263 || kind === 264 - || kind === 272 - || kind === 271; + || kind === 268 + || kind === 269 + || kind === 267 + || kind === 275 + || kind === 274; } ts.canHaveIllegalDecorators = canHaveIllegalDecorators; function canHaveIllegalModifiers(node) { var kind = node.kind; - return kind === 170 - || kind === 296 - || kind === 297 - || kind === 179 - || kind === 276 - || kind === 264; + return kind === 172 + || kind === 299 + || kind === 300 + || kind === 181 + || kind === 279 + || kind === 267; } ts.canHaveIllegalModifiers = canHaveIllegalModifiers; ts.isTypeNodeOrTypeParameterDeclaration = ts.or(ts.isTypeNode, ts.isTypeParameterDeclaration); @@ -24793,6 +25007,64 @@ var ts; return ts.setTextRange(factory.createNodeArray([], nodes.hasTrailingComma), nodes); } ts.elideNodes = elideNodes; + function getNodeForGeneratedName(name) { + if (name.autoGenerateFlags & 4) { + var autoGenerateId = name.autoGenerateId; + var node = name; + var original = node.original; + while (original) { + node = original; + if (ts.isMemberName(node) + && !!(node.autoGenerateFlags & 4) + && node.autoGenerateId !== autoGenerateId) { + break; + } + original = node.original; + } + return node; + } + return name; + } + ts.getNodeForGeneratedName = getNodeForGeneratedName; + function formatGeneratedNamePart(part, generateName) { + return typeof part === "object" ? formatGeneratedName(false, part.prefix, part.node, part.suffix, generateName) : + typeof part === "string" ? part.length > 0 && part.charCodeAt(0) === 35 ? part.slice(1) : part : + ""; + } + ts.formatGeneratedNamePart = formatGeneratedNamePart; + function formatIdentifier(name, generateName) { + return typeof name === "string" ? name : + formatIdentifierWorker(name, ts.Debug.checkDefined(generateName)); + } + function formatIdentifierWorker(node, generateName) { + return ts.isGeneratedPrivateIdentifier(node) ? generateName(node).slice(1) : + ts.isGeneratedIdentifier(node) ? generateName(node) : + ts.isPrivateIdentifier(node) ? node.escapedText.slice(1) : + ts.idText(node); + } + function formatGeneratedName(privateName, prefix, baseName, suffix, generateName) { + prefix = formatGeneratedNamePart(prefix, generateName); + suffix = formatGeneratedNamePart(suffix, generateName); + baseName = formatIdentifier(baseName, generateName); + return "".concat(privateName ? "#" : "").concat(prefix).concat(baseName).concat(suffix); + } + ts.formatGeneratedName = formatGeneratedName; + function createAccessorPropertyBackingField(factory, node, modifiers, initializer) { + return factory.updatePropertyDeclaration(node, modifiers, factory.getGeneratedPrivateNameForNode(node.name, undefined, "_accessor_storage"), undefined, undefined, initializer); + } + ts.createAccessorPropertyBackingField = createAccessorPropertyBackingField; + function createAccessorPropertyGetRedirector(factory, node, modifiers, name) { + return factory.createGetAccessorDeclaration(modifiers, name, [], undefined, factory.createBlock([ + factory.createReturnStatement(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, undefined, "_accessor_storage"))) + ])); + } + ts.createAccessorPropertyGetRedirector = createAccessorPropertyGetRedirector; + function createAccessorPropertySetRedirector(factory, node, modifiers, name) { + return factory.createSetAccessorDeclaration(modifiers, name, [factory.createParameterDeclaration(undefined, undefined, "value")], factory.createBlock([ + factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, undefined, "_accessor_storage")), factory.createIdentifier("value"))) + ])); + } + ts.createAccessorPropertySetRedirector = createAccessorPropertySetRedirector; })(ts || (ts = {})); var ts; (function (ts) { @@ -24802,47 +25074,48 @@ var ts; ts.setTextRange = setTextRange; function canHaveModifiers(node) { var kind = node.kind; - return kind === 163 - || kind === 164 + return kind === 165 || kind === 166 - || kind === 167 || kind === 168 || kind === 169 + || kind === 170 || kind === 171 - || kind === 172 || kind === 173 - || kind === 176 - || kind === 180 - || kind === 213 - || kind === 214 - || kind === 226 - || kind === 237 - || kind === 256 - || kind === 257 - || kind === 258 + || kind === 174 + || kind === 175 + || kind === 178 + || kind === 182 + || kind === 215 + || kind === 216 + || kind === 228 + || kind === 240 || kind === 259 || kind === 260 || kind === 261 - || kind === 265 - || kind === 266 - || kind === 271 - || kind === 272; + || kind === 262 + || kind === 263 + || kind === 264 + || kind === 268 + || kind === 269 + || kind === 274 + || kind === 275; } ts.canHaveModifiers = canHaveModifiers; function canHaveDecorators(node) { var kind = node.kind; - return kind === 164 - || kind === 167 + return kind === 166 || kind === 169 - || kind === 172 - || kind === 173 - || kind === 226 - || kind === 257; + || kind === 171 + || kind === 174 + || kind === 175 + || kind === 228 + || kind === 260; } ts.canHaveDecorators = canHaveDecorators; })(ts || (ts = {})); var ts; (function (ts) { + var _a; var NodeConstructor; var TokenConstructor; var IdentifierConstructor; @@ -24905,564 +25178,722 @@ var ts; function isImportMeta(node) { return ts.isMetaProperty(node) && node.keywordToken === 100 && node.name.escapedText === "meta"; } + var forEachChildTable = (_a = {}, + _a[163] = function forEachChildInQualifiedName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[165] = function forEachChildInTypeParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || + visitNode(cbNode, node.expression); + }, + _a[300] = function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); + }, + _a[301] = function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[166] = function forEachChildInParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[169] = function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[168] = function forEachChildInPropertySignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[299] = function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.initializer); + }, + _a[257] = function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[205] = function forEachChildInBindingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[178] = function forEachChildInIndexSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[182] = function forEachChildInConstructorType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[181] = function forEachChildInFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[176] = forEachChildInCallOrConstructSignature, + _a[177] = forEachChildInCallOrConstructSignature, + _a[171] = function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[170] = function forEachChildInMethodSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[173] = function forEachChildInConstructor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[174] = function forEachChildInGetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[175] = function forEachChildInSetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[259] = function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[215] = function forEachChildInFunctionExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[216] = function forEachChildInArrowFunction(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.equalsGreaterThanToken) || + visitNode(cbNode, node.body); + }, + _a[172] = function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.body); + }, + _a[180] = function forEachChildInTypeReference(node, cbNode, cbNodes) { + return visitNode(cbNode, node.typeName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[179] = function forEachChildInTypePredicate(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertsModifier) || + visitNode(cbNode, node.parameterName) || + visitNode(cbNode, node.type); + }, + _a[183] = function forEachChildInTypeQuery(node, cbNode, cbNodes) { + return visitNode(cbNode, node.exprName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[184] = function forEachChildInTypeLiteral(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.members); + }, + _a[185] = function forEachChildInArrayType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.elementType); + }, + _a[186] = function forEachChildInTupleType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[189] = forEachChildInUnionOrIntersectionType, + _a[190] = forEachChildInUnionOrIntersectionType, + _a[191] = function forEachChildInConditionalType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.checkType) || + visitNode(cbNode, node.extendsType) || + visitNode(cbNode, node.trueType) || + visitNode(cbNode, node.falseType); + }, + _a[192] = function forEachChildInInferType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.typeParameter); + }, + _a[202] = function forEachChildInImportType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.assertions) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[298] = function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertClause); + }, + _a[193] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[195] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[196] = function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.objectType) || + visitNode(cbNode, node.indexType); + }, + _a[197] = function forEachChildInMappedType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.readonlyToken) || + visitNode(cbNode, node.typeParameter) || + visitNode(cbNode, node.nameType) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[198] = function forEachChildInLiteralType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.literal); + }, + _a[199] = function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type); + }, + _a[203] = forEachChildInObjectOrArrayBindingPattern, + _a[204] = forEachChildInObjectOrArrayBindingPattern, + _a[206] = function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[207] = function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[208] = function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.name); + }, + _a[209] = function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.argumentExpression); + }, + _a[210] = forEachChildInCallOrNewExpression, + _a[211] = forEachChildInCallOrNewExpression, + _a[212] = function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.template); + }, + _a[213] = function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + }, + _a[214] = function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[217] = function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[218] = function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[219] = function forEachChildInVoidExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[221] = function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[226] = function forEachChildInYieldExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + }, + _a[220] = function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[222] = function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[223] = function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + }, + _a[231] = function forEachChildInAsExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.type); + }, + _a[232] = function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[235] = function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); + }, + _a[233] = function forEachChildInMetaProperty(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[224] = function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); + }, + _a[227] = function forEachChildInSpreadElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[238] = forEachChildInBlock, + _a[265] = forEachChildInBlock, + _a[308] = function forEachChildInSourceFile(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + }, + _a[240] = function forEachChildInVariableStatement(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + }, + _a[258] = function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.declarations); + }, + _a[241] = function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[242] = function forEachChildInIfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + }, + _a[243] = function forEachChildInDoStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + }, + _a[244] = function forEachChildInWhileStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[245] = function forEachChildInForStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || + visitNode(cbNode, node.statement); + }, + _a[246] = function forEachChildInForInStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[247] = function forEachChildInForOfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[248] = forEachChildInContinueOrBreakStatement, + _a[249] = forEachChildInContinueOrBreakStatement, + _a[250] = function forEachChildInReturnStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[251] = function forEachChildInWithStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[252] = function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + }, + _a[266] = function forEachChildInCaseBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.clauses); + }, + _a[292] = function forEachChildInCaseClause(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.statements); + }, + _a[293] = function forEachChildInDefaultClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + }, + _a[253] = function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + }, + _a[254] = function forEachChildInThrowStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[255] = function forEachChildInTryStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + }, + _a[295] = function forEachChildInCatchClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); + }, + _a[167] = function forEachChildInDecorator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[260] = forEachChildInClassDeclarationOrExpression, + _a[228] = forEachChildInClassDeclarationOrExpression, + _a[261] = function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[262] = function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + }, + _a[263] = function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[302] = function forEachChildInEnumMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[264] = function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + }, + _a[268] = function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + }, + _a[269] = function forEachChildInImportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[270] = function forEachChildInImportClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); + }, + _a[296] = function forEachChildInAssertClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[297] = function forEachChildInAssertEntry(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.value); + }, + _a[267] = function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNode(cbNode, node.name); + }, + _a[271] = function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[277] = function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[272] = forEachChildInNamedImportsOrExports, + _a[276] = forEachChildInNamedImportsOrExports, + _a[275] = function forEachChildInExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[273] = forEachChildInImportOrExportSpecifier, + _a[278] = forEachChildInImportOrExportSpecifier, + _a[274] = function forEachChildInExportAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); + }, + _a[225] = function forEachChildInTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[236] = function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.literal); + }, + _a[200] = function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[201] = function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.literal); + }, + _a[164] = function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[294] = function forEachChildInHeritageClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + }, + _a[230] = function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[280] = function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[279] = function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers); + }, + _a[354] = function forEachChildInCommaListExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[281] = function forEachChildInJsxElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingElement) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingElement); + }, + _a[285] = function forEachChildInJsxFragment(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); + }, + _a[282] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[283] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[289] = function forEachChildInJsxAttributes(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[288] = function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[290] = function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[291] = function forEachChildInJsxExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + }, + _a[284] = function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tagName); + }, + _a[187] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[188] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[312] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[318] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[317] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[319] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[321] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[320] = function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[323] = function forEachChildInJSDoc(node, cbNode, cbNodes) { + return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + || visitNodes(cbNode, cbNodes, node.tags); + }, + _a[349] = function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.name) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[313] = function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[314] = function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[343] = forEachChildInJSDocParameterOrPropertyTag, + _a[350] = forEachChildInJSDocParameterOrPropertyTag, + _a[333] = function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[332] = function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[331] = function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[347] = function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.constraint) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[348] = function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.typeExpression && + node.typeExpression.kind === 312 + ? visitNode(cbNode, node.typeExpression) || + visitNode(cbNode, node.fullName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + : visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); + }, + _a[341] = function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[344] = forEachChildInJSDocReturnTag, + _a[346] = forEachChildInJSDocReturnTag, + _a[345] = forEachChildInJSDocReturnTag, + _a[342] = forEachChildInJSDocReturnTag, + _a[326] = function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { + return ts.forEach(node.typeParameters, cbNode) || + ts.forEach(node.parameters, cbNode) || + visitNode(cbNode, node.type); + }, + _a[327] = forEachChildInJSDocLinkCodeOrPlain, + _a[328] = forEachChildInJSDocLinkCodeOrPlain, + _a[329] = forEachChildInJSDocLinkCodeOrPlain, + _a[325] = function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { + return ts.forEach(node.jsDocPropertyTags, cbNode); + }, + _a[330] = forEachChildInJSDocTag, + _a[335] = forEachChildInJSDocTag, + _a[336] = forEachChildInJSDocTag, + _a[337] = forEachChildInJSDocTag, + _a[338] = forEachChildInJSDocTag, + _a[339] = forEachChildInJSDocTag, + _a[334] = forEachChildInJSDocTag, + _a[340] = forEachChildInJSDocTag, + _a[353] = forEachChildInPartiallyEmittedExpression, + _a); + function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + } + function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + } + function forEachChildInParenthesizedTypeOrTypeOperator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInObjectOrArrayBindingPattern(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInCallOrNewExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNodes(cbNode, cbNodes, node.arguments); + } + function forEachChildInBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + } + function forEachChildInContinueOrBreakStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label); + } + function forEachChildInClassDeclarationOrExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + } + function forEachChildInNamedImportsOrExports(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInImportOrExportSpecifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); + } + function forEachChildInJsxOpeningOrSelfClosingElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.attributes); + } + function forEachChildInOptionalRestOrJSDocParameterModifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInJSDocParameterOrPropertyTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.isNameFirst + ? visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression) + : visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name)) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocReturnTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + } + function forEachChildInJSDocTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) + || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + } function forEachChild(node, cbNode, cbNodes) { - if (!node || node.kind <= 160) { + if (node === undefined || node.kind <= 162) { return; } - switch (node.kind) { - case 161: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 163: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.default) || - visitNode(cbNode, node.expression); - case 297: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.equalsToken) || - visitNode(cbNode, node.objectAssignmentInitializer); - case 298: - return visitNode(cbNode, node.expression); - case 164: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 167: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 166: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 296: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.initializer); - case 254: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 203: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 176: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 180: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 179: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 174: - case 175: - return visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 169: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 168: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 171: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 172: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 173: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 256: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 213: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 214: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.equalsGreaterThanToken) || - visitNode(cbNode, node.body); - case 170: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.body); - case 178: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 177: - return visitNode(cbNode, node.assertsModifier) || - visitNode(cbNode, node.parameterName) || - visitNode(cbNode, node.type); - case 181: - return visitNode(cbNode, node.exprName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 182: - return visitNodes(cbNode, cbNodes, node.members); - case 183: - return visitNode(cbNode, node.elementType); - case 184: - return visitNodes(cbNode, cbNodes, node.elements); - case 187: - case 188: - return visitNodes(cbNode, cbNodes, node.types); - case 189: - return visitNode(cbNode, node.checkType) || - visitNode(cbNode, node.extendsType) || - visitNode(cbNode, node.trueType) || - visitNode(cbNode, node.falseType); - case 190: - return visitNode(cbNode, node.typeParameter); - case 200: - return visitNode(cbNode, node.argument) || - visitNode(cbNode, node.assertions) || - visitNode(cbNode, node.qualifier) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 295: - return visitNode(cbNode, node.assertClause); - case 191: - case 193: - return visitNode(cbNode, node.type); - case 194: - return visitNode(cbNode, node.objectType) || - visitNode(cbNode, node.indexType); - case 195: - return visitNode(cbNode, node.readonlyToken) || - visitNode(cbNode, node.typeParameter) || - visitNode(cbNode, node.nameType) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNodes(cbNode, cbNodes, node.members); - case 196: - return visitNode(cbNode, node.literal); - case 197: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type); - case 201: - case 202: - return visitNodes(cbNode, cbNodes, node.elements); - case 204: - return visitNodes(cbNode, cbNodes, node.elements); - case 205: - return visitNodes(cbNode, cbNodes, node.properties); - case 206: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.name); - case 207: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.argumentExpression); - case 208: - case 209: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNodes(cbNode, cbNodes, node.arguments); - case 210: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.template); - case 211: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); - case 212: - return visitNode(cbNode, node.expression); - case 215: - return visitNode(cbNode, node.expression); - case 216: - return visitNode(cbNode, node.expression); - case 217: - return visitNode(cbNode, node.expression); - case 219: - return visitNode(cbNode, node.operand); - case 224: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); - case 218: - return visitNode(cbNode, node.expression); - case 220: - return visitNode(cbNode, node.operand); - case 221: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); - case 229: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.type); - case 230: - return visitNode(cbNode, node.expression); - case 231: - return visitNode(cbNode, node.name); - case 222: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); - case 225: - return visitNode(cbNode, node.expression); - case 235: - case 262: - return visitNodes(cbNode, cbNodes, node.statements); - case 305: - return visitNodes(cbNode, cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); - case 237: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); - case 255: - return visitNodes(cbNode, cbNodes, node.declarations); - case 238: - return visitNode(cbNode, node.expression); - case 239: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); - case 240: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); - case 241: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 242: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || - visitNode(cbNode, node.statement); - case 243: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 244: - return visitNode(cbNode, node.awaitModifier) || - visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 245: - case 246: - return visitNode(cbNode, node.label); - case 247: - return visitNode(cbNode, node.expression); - case 248: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 249: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 263: - return visitNodes(cbNode, cbNodes, node.clauses); - case 289: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.statements); - case 290: - return visitNodes(cbNode, cbNodes, node.statements); - case 250: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); - case 251: - return visitNode(cbNode, node.expression); - case 252: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); - case 292: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); - case 165: - return visitNode(cbNode, node.expression); - case 257: - case 226: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 258: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 259: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); - case 260: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.members); - case 299: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 261: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); - case 265: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); - case 266: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 267: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); - case 293: - return visitNodes(cbNode, cbNodes, node.elements); - case 294: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.value); - case 264: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNode(cbNode, node.name); - case 268: - return visitNode(cbNode, node.name); - case 274: - return visitNode(cbNode, node.name); - case 269: - case 273: - return visitNodes(cbNode, cbNodes, node.elements); - case 272: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 270: - case 275: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); - case 271: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.expression); - case 223: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 233: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.literal); - case 198: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 199: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.literal); - case 162: - return visitNode(cbNode, node.expression); - case 291: - return visitNodes(cbNode, cbNodes, node.types); - case 228: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 277: - return visitNode(cbNode, node.expression); - case 276: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers); - case 351: - return visitNodes(cbNode, cbNodes, node.elements); - case 278: - return visitNode(cbNode, node.openingElement) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingElement); - case 282: - return visitNode(cbNode, node.openingFragment) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingFragment); - case 279: - case 280: - return visitNode(cbNode, node.tagName) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.attributes); - case 286: - return visitNodes(cbNode, cbNodes, node.properties); - case 285: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 287: - return visitNode(cbNode, node.expression); - case 288: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.expression); - case 281: - return visitNode(cbNode, node.tagName); - case 185: - case 186: - case 309: - case 315: - case 314: - case 316: - case 318: - return visitNode(cbNode, node.type); - case 317: - return visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 320: - return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - || visitNodes(cbNode, cbNodes, node.tags); - case 346: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 310: - return visitNode(cbNode, node.name); - case 311: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 340: - case 347: - return visitNode(cbNode, node.tagName) || - (node.isNameFirst - ? visitNode(cbNode, node.name) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 330: - return visitNode(cbNode, node.tagName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 329: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 328: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 344: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.constraint) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 345: - return visitNode(cbNode, node.tagName) || - (node.typeExpression && - node.typeExpression.kind === 309 - ? visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.fullName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 338: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 341: - case 343: - case 342: - case 339: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 323: - return ts.forEach(node.typeParameters, cbNode) || - ts.forEach(node.parameters, cbNode) || - visitNode(cbNode, node.type); - case 324: - case 325: - case 326: - return visitNode(cbNode, node.name); - case 322: - return ts.forEach(node.jsDocPropertyTags, cbNode); - case 327: - case 332: - case 333: - case 334: - case 335: - case 336: - case 331: - case 337: - return visitNode(cbNode, node.tagName) - || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 350: - return visitNode(cbNode, node.expression); - } + var fn = forEachChildTable[node.kind]; + return fn === undefined ? undefined : fn(node, cbNode, cbNodes); } ts.forEachChild = forEachChild; function forEachChildRecursively(rootNode, cbNode, cbNodes) { @@ -25495,7 +25926,7 @@ var ts; continue; return res; } - if (current.kind >= 161) { + if (current.kind >= 163) { for (var _i = 0, _a = gatherPossibleChildren(current); _i < _a.length; _i++) { var child = _a[_i]; queue.push(child); @@ -26130,7 +26561,7 @@ var ts; if (token() === 125 && inYieldContext()) { return false; } - if (token() === 132 && inAwaitContext()) { + if (token() === 133 && inAwaitContext()) { return false; } return token() > 116; @@ -26347,7 +26778,7 @@ var ts; ts.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, "", "", undefined) : kind === 8 ? factory.createNumericLiteral("", undefined) : kind === 10 ? factory.createStringLiteral("", undefined) : - kind === 276 ? factory.createMissingDeclaration() : + kind === 279 ? factory.createMissingDeclaration() : factory.createToken(kind); return finishNode(result, pos); } @@ -26364,8 +26795,9 @@ var ts; var pos = getNodePos(); var originalKeywordKind = token(); var text = internIdentifier(scanner.getTokenValue()); + var hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape(); nextTokenWithoutCheck(); - return finishNode(factory.createIdentifier(text, undefined, originalKeywordKind), pos); + return finishNode(factory.createIdentifier(text, undefined, originalKeywordKind, hasExtendedUnicodeEscape), pos); } if (token() === 80) { parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); @@ -26434,7 +26866,7 @@ var ts; } function parsePrivateIdentifier() { var pos = getNodePos(); - var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText())); + var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue())); nextToken(); return finishNode(node, pos); } @@ -26457,15 +26889,16 @@ var ts; if (token() === 88) { return lookAhead(nextTokenCanFollowDefaultKeyword); } - if (token() === 152) { + if (token() === 154) { return lookAhead(nextTokenCanFollowExportModifier); } return canFollowExportModifier(); case 88: return nextTokenCanFollowDefaultKeyword(); + case 127: case 124: - case 136: - case 149: + case 137: + case 151: nextToken(); return canFollowModifier(); default: @@ -26474,7 +26907,7 @@ var ts; } function canFollowExportModifier() { return token() !== 41 - && token() !== 127 + && token() !== 128 && token() !== 18 && canFollowModifier(); } @@ -26497,7 +26930,7 @@ var ts; return token() === 84 || token() === 98 || token() === 118 || (token() === 126 && lookAhead(nextTokenIsClassKeywordOnSameLine)) || - (token() === 131 && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); + (token() === 132 && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } function isListElement(parsingContext, inErrorRecovery) { var node = currentNode(parsingContext); @@ -26767,17 +27200,17 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 171: - case 176: - case 172: case 173: - case 167: - case 234: - return true; + case 178: + case 174: + case 175: case 169: + case 237: + return true; + case 171: var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 79 && - methodDeclaration.name.originalKeywordKind === 134; + methodDeclaration.name.originalKeywordKind === 135; return !nameIsConstructor; } } @@ -26786,8 +27219,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 289: - case 290: + case 292: + case 293: return true; } } @@ -26796,65 +27229,65 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 256: - case 237: - case 235: - case 239: + case 259: + case 240: case 238: - case 251: - case 247: + case 242: + case 241: + case 254: + case 250: + case 252: case 249: + case 248: case 246: + case 247: case 245: - case 243: case 244: - case 242: - case 241: - case 248: - case 236: - case 252: - case 250: - case 240: + case 251: + case 239: + case 255: case 253: - case 266: - case 265: - case 272: - case 271: - case 261: - case 257: - case 258: + case 243: + case 256: + case 269: + case 268: + case 275: + case 274: + case 264: case 260: - case 259: + case 261: + case 263: + case 262: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 299; + return node.kind === 302; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 175: + case 177: + case 170: + case 178: case 168: case 176: - case 166: - case 174: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 254) { + if (node.kind !== 257) { return false; } var variableDeclarator = node; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 164) { + if (node.kind !== 166) { return false; } var parameter = node; @@ -27095,14 +27528,14 @@ var ts; } function typeHasArrowFunctionBlockingParseError(node) { switch (node.kind) { - case 178: + case 180: return ts.nodeIsMissing(node.typeName); - case 179: - case 180: { + case 181: + case 182: { var _a = node, parameters = _a.parameters, type = _a.type; return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); } - case 191: + case 193: return typeHasArrowFunctionBlockingParseError(node.type); default: return false; @@ -27165,7 +27598,7 @@ var ts; function parseJSDocType() { scanner.setInJSDocType(true); var pos = getNodePos(); - if (parseOptional(141)) { + if (parseOptional(142)) { var moduleTag = factory.createJSDocNamepathType(undefined); terminate: while (true) { switch (token()) { @@ -27319,14 +27752,14 @@ var ts; function parseSignatureMember(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - if (kind === 175) { + if (kind === 177) { parseExpected(103); } var typeParameters = parseTypeParameters(); var parameters = parseParameters(4); var type = parseReturnType(58, true); parseTypeMemberSemicolon(); - var node = kind === 174 + var node = kind === 176 ? factory.createCallSignature(typeParameters, parameters, type) : factory.createConstructSignature(typeParameters, parameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -27390,8 +27823,8 @@ var ts; function isTypeMemberStart() { if (token() === 20 || token() === 29 || - token() === 136 || - token() === 149) { + token() === 137 || + token() === 151) { return true; } var idToken = false; @@ -27418,19 +27851,19 @@ var ts; } function parseTypeMember() { if (token() === 20 || token() === 29) { - return parseSignatureMember(174); + return parseSignatureMember(176); } if (token() === 103 && lookAhead(nextTokenIsOpenParenOrLessThan)) { - return parseSignatureMember(175); + return parseSignatureMember(177); } var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); var modifiers = parseModifiers(); - if (parseContextualModifier(136)) { - return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 172, 4); + if (parseContextualModifier(137)) { + return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 174, 4); } - if (parseContextualModifier(149)) { - return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 173, 4); + if (parseContextualModifier(151)) { + return parseAccessorDeclaration(pos, hasJSDoc, undefined, modifiers, 175, 4); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(pos, hasJSDoc, undefined, modifiers); @@ -27471,9 +27904,9 @@ var ts; function isStartOfMappedType() { nextToken(); if (token() === 39 || token() === 40) { - return nextToken() === 145; + return nextToken() === 146; } - if (token() === 145) { + if (token() === 146) { nextToken(); } return token() === 22 && nextTokenIsIdentifier() && nextToken() === 101; @@ -27489,15 +27922,15 @@ var ts; var pos = getNodePos(); parseExpected(18); var readonlyToken; - if (token() === 145 || token() === 39 || token() === 40) { + if (token() === 146 || token() === 39 || token() === 40) { readonlyToken = parseTokenNode(); - if (readonlyToken.kind !== 145) { - parseExpected(145); + if (readonlyToken.kind !== 146) { + parseExpected(146); } } parseExpected(22); var typeParameter = parseMappedTypeParameter(); - var nameType = parseOptional(127) ? parseType() : undefined; + var nameType = parseOptional(128) ? parseType() : undefined; parseExpected(23); var questionToken; if (token() === 57 || token() === 39 || token() === 40) { @@ -27611,7 +28044,7 @@ var ts; var openBracePosition = scanner.getTokenPos(); parseExpected(18); var multiLine = scanner.hasPrecedingLineBreak(); - parseExpected(129); + parseExpected(130); parseExpected(58); var clause = parseAssertClause(true); if (!parseExpected(19)) { @@ -27644,16 +28077,16 @@ var ts; } function parseNonArrayType() { switch (token()) { - case 130: - case 155: - case 150: - case 147: - case 158: - case 151: - case 133: - case 153: - case 143: + case 131: + case 157: + case 152: case 148: + case 160: + case 153: + case 134: + case 155: + case 144: + case 149: return tryParse(parseKeywordAndNoDot) || parseTypeReference(); case 66: scanner.reScanAsteriskEqualsToken(); @@ -27681,7 +28114,7 @@ var ts; return parseTokenNode(); case 108: { var thisKeyword = parseThisTypeNode(); - if (token() === 139 && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 && !scanner.hasPrecedingLineBreak()) { return parseThisTypePredicate(thisKeyword); } else { @@ -27698,7 +28131,7 @@ var ts; return parseParenthesizedType(); case 100: return parseImportType(); - case 128: + case 129: return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference(); case 15: return parseTemplateType(); @@ -27708,21 +28141,21 @@ var ts; } function isStartOfType(inStartOfParameter) { switch (token()) { - case 130: - case 155: - case 150: - case 147: - case 158: - case 133: - case 145: - case 151: - case 154: - case 114: + case 131: + case 157: + case 152: + case 148: + case 160: + case 134: + case 146: case 153: + case 156: + case 114: + case 155: case 104: case 108: case 112: - case 143: + case 144: case 18: case 22: case 29: @@ -27734,14 +28167,14 @@ var ts; case 9: case 110: case 95: - case 148: + case 149: case 41: case 57: case 53: case 25: - case 137: + case 138: case 100: - case 128: + case 129: case 14: case 15: return true; @@ -27815,17 +28248,17 @@ var ts; } function parseInferType() { var pos = getNodePos(); - parseExpected(137); + parseExpected(138); return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos); } function parseTypeOperatorOrHigher() { var operator = token(); switch (operator) { - case 140: - case 154: - case 145: + case 141: + case 156: + case 146: return parseTypeOperator(operator); - case 137: + case 138: return parseInferType(); } return allowConditionalTypesAnd(parsePostfixTypeOrHigher); @@ -27931,16 +28364,16 @@ var ts; } function parseTypePredicatePrefix() { var id = parseIdentifier(); - if (token() === 139 && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 && !scanner.hasPrecedingLineBreak()) { nextToken(); return id; } } function parseAssertsTypePredicate() { var pos = getNodePos(); - var assertsModifier = parseExpectedToken(128); + var assertsModifier = parseExpectedToken(129); var parameterName = token() === 108 ? parseThisTypeNode() : parseIdentifier(); - var type = parseOptional(139) ? parseType() : undefined; + var type = parseOptional(140) ? parseType() : undefined; return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos); } function parseType() { @@ -28008,7 +28441,7 @@ var ts; case 45: case 46: case 29: - case 132: + case 133: case 125: case 80: return true; @@ -28107,7 +28540,7 @@ var ts; tryParse(function () { return parsePossibleParenthesizedArrowFunctionExpression(allowReturnTypeInArrowFunction); }); } function isParenthesizedArrowFunctionExpression() { - if (token() === 20 || token() === 29 || token() === 131) { + if (token() === 20 || token() === 29 || token() === 132) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token() === 38) { @@ -28116,7 +28549,7 @@ var ts; return 0; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token() === 131) { + if (token() === 132) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0; @@ -28145,8 +28578,8 @@ var ts; if (second === 25) { return 1; } - if (ts.isModifierKind(second) && second !== 131 && lookAhead(nextTokenIsIdentifier)) { - if (nextToken() === 127) { + if (ts.isModifierKind(second) && second !== 132 && lookAhead(nextTokenIsIdentifier)) { + if (nextToken() === 128) { return 0; } return 1; @@ -28213,7 +28646,7 @@ var ts; return result; } function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) { - if (token() === 131) { + if (token() === 132) { if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1) { var pos = getNodePos(); var asyncModifier = parseModifiersForArrowFunction(); @@ -28224,7 +28657,7 @@ var ts; return undefined; } function isUnParenthesizedAsyncArrowFunctionWorker() { - if (token() === 131) { + if (token() === 132) { nextToken(); if (scanner.hasPrecedingLineBreak() || token() === 38) { return 0; @@ -28270,7 +28703,7 @@ var ts; return undefined; } var unwrappedType = type; - while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 191) { + while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 193) { unwrappedType = unwrappedType.type; } var hasJSDocFunctionType = unwrappedType && ts.isJSDocFunctionType(unwrappedType); @@ -28325,7 +28758,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand, pos); } function isInOrOfKeyword(t) { - return t === 101 || t === 160; + return t === 101 || t === 162; } function parseBinaryExpressionRest(precedence, leftOperand, pos) { while (true) { @@ -28340,13 +28773,15 @@ var ts; if (token() === 101 && inDisallowInContext()) { break; } - if (token() === 127) { + if (token() === 128 || token() === 150) { if (scanner.hasPrecedingLineBreak()) { break; } else { + var keywordKind = token(); nextToken(); - leftOperand = makeAsExpression(leftOperand, parseType()); + leftOperand = keywordKind === 150 ? makeSatisfiesExpression(leftOperand, parseType()) : + makeAsExpression(leftOperand, parseType()); } } else { @@ -28361,6 +28796,9 @@ var ts; } return ts.getBinaryOperatorPrecedence(token()) > 0; } + function makeSatisfiesExpression(left, right) { + return finishNode(factory.createSatisfiesExpression(left, right), left.pos); + } function makeBinaryExpression(left, operatorToken, right, pos) { return finishNode(factory.createBinaryExpression(left, operatorToken, right), pos); } @@ -28384,7 +28822,7 @@ var ts; return finishNode(factory.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); } function isAwaitExpression() { - if (token() === 132) { + if (token() === 133) { if (inAwaitContext()) { return true; } @@ -28409,7 +28847,7 @@ var ts; if (token() === 42) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 211) { + if (simpleUnaryExpression.kind === 213) { parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -28433,7 +28871,7 @@ var ts; return parseVoidExpression(); case 29: return parseTypeAssertion(); - case 132: + case 133: if (isAwaitExpression()) { return parseAwaitExpression(); } @@ -28450,7 +28888,7 @@ var ts; case 89: case 112: case 114: - case 132: + case 133: return false; case 29: if (languageVariant !== 1) { @@ -28528,11 +28966,11 @@ var ts; var pos = getNodePos(); var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 280) { + if (opening.kind === 283) { var children = parseJsxChildren(opening); var closingElement = void 0; var lastChild = children[children.length - 1]; - if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 278 + if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 281 && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { var end = lastChild.children.end; @@ -28553,11 +28991,11 @@ var ts; } result = finishNode(factory.createJsxElement(opening, children, closingElement), pos); } - else if (opening.kind === 283) { + else if (opening.kind === 286) { result = finishNode(factory.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos); } else { - ts.Debug.assert(opening.kind === 279); + ts.Debug.assert(opening.kind === 282); result = opening; } if (inExpressionContext && token() === 29) { @@ -28615,7 +29053,7 @@ var ts; break; list.push(child); if (ts.isJsxOpeningElement(openingTag) - && (child === null || child === void 0 ? void 0 : child.kind) === 278 + && (child === null || child === void 0 ? void 0 : child.kind) === 281 && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { break; @@ -28840,7 +29278,7 @@ var ts; continue; } if (isTemplateStartOfTaggedTemplate()) { - expression = !questionDotToken && expression.kind === 228 ? + expression = !questionDotToken && expression.kind === 230 ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest(pos, expression, questionDotToken, undefined); continue; @@ -28886,7 +29324,7 @@ var ts; } } if (typeArguments || token() === 20) { - if (!questionDotToken && expression.kind === 228) { + if (!questionDotToken && expression.kind === 230) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -28959,7 +29397,7 @@ var ts; return parseArrayLiteralExpression(); case 18: return parseObjectLiteralExpression(); - case 131: + case 132: if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) { break; } @@ -29023,11 +29461,11 @@ var ts; } var decorators = parseDecorators(); var modifiers = parseModifiers(); - if (parseContextualModifier(136)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172, 0); + if (parseContextualModifier(137)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174, 0); } - if (parseContextualModifier(149)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173, 0); + if (parseContextualModifier(151)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175, 0); } var asteriskToken = parseOptionalToken(41); var tokenIsIdentifier = isIdentifier(); @@ -29100,7 +29538,7 @@ var ts; var expressionPos = getNodePos(); var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), false); var typeArguments; - if (expression.kind === 228) { + if (expression.kind === 230) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -29197,7 +29635,7 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(97); - var awaitToken = parseOptionalToken(132); + var awaitToken = parseOptionalToken(133); parseExpected(20); var initializer; if (token() !== 26) { @@ -29209,7 +29647,7 @@ var ts; } } var node; - if (awaitToken ? parseExpected(160) : parseOptional(160)) { + if (awaitToken ? parseExpected(162) : parseOptional(162)) { var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(true); }); parseExpected(21); node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement()); @@ -29236,10 +29674,10 @@ var ts; function parseBreakOrContinueStatement(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(kind === 246 ? 81 : 86); + parseExpected(kind === 249 ? 81 : 86); var label = canParseSemicolon() ? undefined : parseIdentifier(); parseSemicolon(); - var node = kind === 246 + var node = kind === 249 ? factory.createBreakStatement(label) : factory.createContinueStatement(label); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -29394,24 +29832,25 @@ var ts; case 92: return true; case 118: - case 152: + case 154: return nextTokenIsIdentifierOnSameLine(); - case 141: case 142: + case 143: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); case 126: - case 131: - case 135: + case 127: + case 132: + case 136: case 121: case 122: case 123: - case 145: + case 146: nextToken(); if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 157: + case 159: nextToken(); return token() === 18 || token() === 79 || token() === 93; case 100: @@ -29420,12 +29859,12 @@ var ts; token() === 18 || ts.tokenIsIdentifierOrKeyword(token()); case 93: var currentToken_1 = nextToken(); - if (currentToken_1 === 152) { + if (currentToken_1 === 154) { currentToken_1 = lookAhead(nextToken); } if (currentToken_1 === 63 || currentToken_1 === 41 || currentToken_1 === 18 || currentToken_1 === 88 || - currentToken_1 === 127) { + currentToken_1 === 128) { return true; } continue; @@ -29470,19 +29909,20 @@ var ts; case 85: case 93: return isStartOfDeclaration(); - case 131: - case 135: + case 132: + case 136: case 118: - case 141: case 142: - case 152: - case 157: + case 143: + case 154: + case 159: return true; + case 127: case 123: case 121: case 122: case 124: - case 145: + case 146: return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); default: return isStartOfExpression(); @@ -29521,9 +29961,9 @@ var ts; case 97: return parseForOrForInOrForOfStatement(); case 86: - return parseBreakOrContinueStatement(245); + return parseBreakOrContinueStatement(248); case 81: - return parseBreakOrContinueStatement(246); + return parseBreakOrContinueStatement(249); case 105: return parseReturnStatement(); case 116: @@ -29540,12 +29980,12 @@ var ts; return parseDebuggerStatement(); case 59: return parseDeclaration(); - case 131: + case 132: case 118: - case 152: - case 141: + case 154: case 142: - case 135: + case 143: + case 136: case 85: case 92: case 93: @@ -29554,9 +29994,10 @@ var ts; case 122: case 123: case 126: + case 127: case 124: - case 145: - case 157: + case 146: + case 159: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -29565,7 +30006,7 @@ var ts; return parseExpressionOrLabeledStatement(); } function isDeclareModifier(modifier) { - return modifier.kind === 135; + return modifier.kind === 136; } function parseDeclaration() { var pos = getNodePos(); @@ -29608,13 +30049,13 @@ var ts; return parseClassDeclaration(pos, hasJSDoc, decorators, modifiers); case 118: return parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers); - case 152: + case 154: return parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers); case 92: return parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers); - case 157: - case 141: + case 159: case 142: + case 143: return parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers); case 100: return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -29624,14 +30065,14 @@ var ts; case 88: case 63: return parseExportAssignment(pos, hasJSDoc, decorators, modifiers); - case 127: + case 128: return parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers); default: return parseExportDeclaration(pos, hasJSDoc, decorators, modifiers); } default: if (decorators || modifiers) { - var missing = createMissingNode(276, true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(279, true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); missing.illegalDecorators = decorators; missing.modifiers = modifiers; @@ -29747,7 +30188,7 @@ var ts; } nextToken(); var declarations; - if (token() === 160 && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 162 && lookAhead(canFollowContextualOfKeyword)) { declarations = createMissingList(); } else { @@ -29773,9 +30214,9 @@ var ts; var modifierFlags = ts.modifiersToFlags(modifiers); parseExpected(98); var asteriskToken = parseOptionalToken(41); - var name = modifierFlags & 512 ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); + var name = modifierFlags & 1024 ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); var isGenerator = asteriskToken ? 1 : 0; - var isAsync = modifierFlags & 256 ? 2 : 0; + var isAsync = modifierFlags & 512 ? 2 : 0; var typeParameters = parseTypeParameters(); if (modifierFlags & 1) setAwaitContext(true); @@ -29788,8 +30229,8 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { - if (token() === 134) { - return parseExpected(134); + if (token() === 135) { + return parseExpected(135); } if (token() === 10 && lookAhead(nextToken) === 20) { return tryParse(function () { @@ -29847,7 +30288,7 @@ var ts; var parameters = parseParameters(0); var type = parseReturnType(58, false); var body = parseFunctionBlockOrSemicolon(flags); - var node = kind === 172 + var node = kind === 174 ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body) : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body); node.typeParameters = typeParameters; @@ -29878,7 +30319,7 @@ var ts; return true; } if (idToken !== undefined) { - if (!ts.isKeyword(idToken) || idToken === 149 || idToken === 136) { + if (!ts.isKeyword(idToken) || idToken === 151 || idToken === 137) { return true; } switch (token()) { @@ -29914,7 +30355,7 @@ var ts; return body; } function parseDecoratorExpression() { - if (inAwaitContext() && token() === 132) { + if (inAwaitContext() && token() === 133) { var pos = getNodePos(); var awaitExpression = parseIdentifier(ts.Diagnostics.Expression_expected); nextToken(); @@ -29981,10 +30422,10 @@ var ts; } function parseModifiersForArrowFunction() { var modifiers; - if (token() === 131) { + if (token() === 132) { var pos = getNodePos(); nextToken(); - var modifier = finishNode(factory.createToken(131), pos); + var modifier = finishNode(factory.createToken(132), pos); modifiers = createNodeArray([modifier], pos); } return modifiers; @@ -30001,13 +30442,13 @@ var ts; if (token() === 124 && lookAhead(nextTokenIsOpenBrace)) { return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers); } - if (parseContextualModifier(136)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172, 0); + if (parseContextualModifier(137)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174, 0); } - if (parseContextualModifier(149)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173, 0); + if (parseContextualModifier(151)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175, 0); } - if (token() === 134 || token() === 10) { + if (token() === 135 || token() === 10) { var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers); if (constructorDeclaration) { return constructorDeclaration; @@ -30040,10 +30481,10 @@ var ts; return ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), undefined, undefined, 226); + return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), undefined, undefined, 228); } function parseClassDeclaration(pos, hasJSDoc, decorators, modifiers) { - return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 257); + return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 260); } function parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, kind) { var savedAwaitContext = inAwaitContext(); @@ -30062,7 +30503,7 @@ var ts; members = createMissingList(); } setAwaitContext(savedAwaitContext); - var node = kind === 257 + var node = kind === 260 ? factory.createClassDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members) : factory.createClassExpression(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -30092,7 +30533,7 @@ var ts; function parseExpressionWithTypeArguments() { var pos = getNodePos(); var expression = parseLeftHandSideExpressionOrHigher(); - if (expression.kind === 228) { + if (expression.kind === 230) { return expression; } var typeArguments = tryParseTypeArguments(); @@ -30119,11 +30560,11 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(152); + parseExpected(154); var name = parseIdentifier(); var typeParameters = parseTypeParameters(); parseExpected(63); - var type = token() === 138 && tryParse(parseKeywordAndNoDot) || parseType(); + var type = token() === 139 && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); node.illegalDecorators = decorators; @@ -30176,7 +30617,7 @@ var ts; function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; var name; - if (token() === 157) { + if (token() === 159) { name = parseIdentifier(); flags |= 1024; } @@ -30197,14 +30638,14 @@ var ts; } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; - if (token() === 157) { + if (token() === 159) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } - else if (parseOptional(142)) { + else if (parseOptional(143)) { flags |= 16; } else { - parseExpected(141); + parseExpected(142); if (token() === 10) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } @@ -30212,7 +30653,7 @@ var ts; return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags); } function isExternalModuleReference() { - return token() === 146 && + return token() === 147 && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -30225,8 +30666,8 @@ var ts; return nextToken() === 43; } function parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(127); - parseExpected(142); + parseExpected(128); + parseExpected(143); var name = parseIdentifier(); parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); @@ -30242,7 +30683,7 @@ var ts; identifier = parseIdentifier(); } var isTypeOnly = false; - if (token() !== 156 && + if (token() !== 158 && (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === "type" && (isIdentifier() || tokenAfterImportDefinitelyProducesImportDeclaration())) { isTypeOnly = true; @@ -30256,11 +30697,11 @@ var ts; token() === 41 || token() === 18) { importClause = parseImportClause(identifier, afterImportPos, isTypeOnly); - parseExpected(156); + parseExpected(158); } var moduleSpecifier = parseModuleSpecifier(); var assertClause; - if (token() === 129 && !scanner.hasPrecedingLineBreak()) { + if (token() === 130 && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -30278,7 +30719,7 @@ var ts; function parseAssertClause(skipAssertKeyword) { var pos = getNodePos(); if (!skipAssertKeyword) { - parseExpected(129); + parseExpected(130); } var openBracePosition = scanner.getTokenPos(); if (parseExpected(18)) { @@ -30301,7 +30742,7 @@ var ts; return token() === 41 || token() === 18; } function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() { - return token() === 27 || token() === 156; + return token() === 27 || token() === 158; } function parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly) { parseExpected(63); @@ -30316,7 +30757,7 @@ var ts; var namedBindings; if (!identifier || parseOptional(27)) { - namedBindings = token() === 41 ? parseNamespaceImport() : parseNamedImportsOrExports(269); + namedBindings = token() === 41 ? parseNamespaceImport() : parseNamedImportsOrExports(272); } return finishNode(factory.createImportClause(isTypeOnly, identifier, namedBindings), pos); } @@ -30327,7 +30768,7 @@ var ts; } function parseExternalModuleReference() { var pos = getNodePos(); - parseExpected(146); + parseExpected(147); parseExpected(20); var expression = parseModuleSpecifier(); parseExpected(21); @@ -30346,23 +30787,23 @@ var ts; function parseNamespaceImport() { var pos = getNodePos(); parseExpected(41); - parseExpected(127); + parseExpected(128); var name = parseIdentifier(); return finishNode(factory.createNamespaceImport(name), pos); } function parseNamedImportsOrExports(kind) { var pos = getNodePos(); - var node = kind === 269 + var node = kind === 272 ? factory.createNamedImports(parseBracketedList(23, parseImportSpecifier, 18, 19)) : factory.createNamedExports(parseBracketedList(23, parseExportSpecifier, 18, 19)); return finishNode(node, pos); } function parseExportSpecifier() { var hasJSDoc = hasPrecedingJSDocComment(); - return withJSDoc(parseImportOrExportSpecifier(275), hasJSDoc); + return withJSDoc(parseImportOrExportSpecifier(278), hasJSDoc); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(270); + return parseImportOrExportSpecifier(273); } function parseImportOrExportSpecifier(kind) { var pos = getNodePos(); @@ -30374,9 +30815,9 @@ var ts; var canParseAsKeyword = true; var name = parseIdentifierName(); if (name.escapedText === "type") { - if (token() === 127) { + if (token() === 128) { var firstAs = parseIdentifierName(); - if (token() === 127) { + if (token() === 128) { var secondAs = parseIdentifierName(); if (ts.tokenIsIdentifierOrKeyword(token())) { isTypeOnly = true; @@ -30405,15 +30846,15 @@ var ts; name = parseNameWithKeywordCheck(); } } - if (canParseAsKeyword && token() === 127) { + if (canParseAsKeyword && token() === 128) { propertyName = name; - parseExpected(127); + parseExpected(128); name = parseNameWithKeywordCheck(); } - if (kind === 270 && checkIdentifierIsKeyword) { + if (kind === 273 && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } - var node = kind === 270 + var node = kind === 273 ? factory.createImportSpecifier(isTypeOnly, propertyName, name) : factory.createExportSpecifier(isTypeOnly, propertyName, name); return finishNode(node, pos); @@ -30433,23 +30874,23 @@ var ts; var exportClause; var moduleSpecifier; var assertClause; - var isTypeOnly = parseOptional(152); + var isTypeOnly = parseOptional(154); var namespaceExportPos = getNodePos(); if (parseOptional(41)) { - if (parseOptional(127)) { + if (parseOptional(128)) { exportClause = parseNamespaceExport(namespaceExportPos); } - parseExpected(156); + parseExpected(158); moduleSpecifier = parseModuleSpecifier(); } else { - exportClause = parseNamedImportsOrExports(273); - if (token() === 156 || (token() === 10 && !scanner.hasPrecedingLineBreak())) { - parseExpected(156); + exportClause = parseNamedImportsOrExports(276); + if (token() === 158 || (token() === 10 && !scanner.hasPrecedingLineBreak())) { + parseExpected(158); moduleSpecifier = parseModuleSpecifier(); } } - if (moduleSpecifier && token() === 129 && !scanner.hasPrecedingLineBreak()) { + if (moduleSpecifier && token() === 130 && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -30982,9 +31423,9 @@ var ts; } function isObjectOrObjectArrayTypeReference(node) { switch (node.kind) { - case 148: + case 149: return true; - case 183: + case 185: return isObjectOrObjectArrayTypeReference(node.elementType); default: return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; @@ -31016,12 +31457,12 @@ var ts; var child = void 0; var children = void 0; while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) { - if (child.kind === 340 || child.kind === 347) { + if (child.kind === 343 || child.kind === 350) { children = ts.append(children, child); } } if (children) { - var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 183), pos); + var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 185), pos); return finishNode(factory.createJSDocTypeExpression(literal), pos); } } @@ -31139,7 +31580,7 @@ var ts; var hasChildren = false; while (child = tryParse(function () { return parseChildPropertyTag(indent); })) { hasChildren = true; - if (child.kind === 343) { + if (child.kind === 346) { if (childTypeTag) { var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); if (lastError) { @@ -31156,7 +31597,7 @@ var ts; } } if (hasChildren) { - var isArrayType = typeExpression && typeExpression.type.kind === 183; + var isArrayType = typeExpression && typeExpression.type.kind === 185; var jsdocTypeLiteral = factory.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType); typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : @@ -31206,7 +31647,7 @@ var ts; var returnTag = tryParse(function () { if (parseOptionalJsdoc(59)) { var tag = parseTag(indent); - if (tag && tag.kind === 341) { + if (tag && tag.kind === 344) { return tag; } } @@ -31241,7 +31682,7 @@ var ts; case 59: if (canParseTag) { var child = tryParseChildTag(target, indent); - if (child && (child.kind === 340 || child.kind === 347) && + if (child && (child.kind === 343 || child.kind === 350) && target !== 4 && name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; @@ -31983,6 +32424,7 @@ var ts; ["es2019.object", "lib.es2019.object.d.ts"], ["es2019.string", "lib.es2019.string.d.ts"], ["es2019.symbol", "lib.es2019.symbol.d.ts"], + ["es2019.intl", "lib.es2019.intl.d.ts"], ["es2020.bigint", "lib.es2020.bigint.d.ts"], ["es2020.date", "lib.es2020.date.d.ts"], ["es2020.promise", "lib.es2020.promise.d.ts"], @@ -32089,6 +32531,7 @@ var ts; shortName: "h", type: "boolean", showInSimplifiedHelpView: true, + isCommandLineOnly: true, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, defaultValueDescription: false, @@ -32097,6 +32540,8 @@ var ts; name: "help", shortName: "?", type: "boolean", + isCommandLineOnly: true, + category: ts.Diagnostics.Command_line_Options, defaultValueDescription: false, }, { @@ -33749,7 +34194,7 @@ var ts; var _a; var rootExpression = (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression; var knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : undefined; - if (rootExpression && rootExpression.kind !== 205) { + if (rootExpression && rootExpression.kind !== 207) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, rootExpression, ts.Diagnostics.The_root_value_of_a_0_file_must_be_an_object, ts.getBaseFileName(sourceFile.fileName) === "jsconfig.json" ? "jsconfig.json" : "tsconfig.json")); if (ts.isArrayLiteralExpression(rootExpression)) { var firstObject = ts.find(rootExpression.elements, ts.isObjectLiteralExpression); @@ -33777,7 +34222,7 @@ var ts; function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) { var result = returnValue ? {} : undefined; var _loop_4 = function (element) { - if (element.kind !== 296) { + if (element.kind !== 299) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); return "continue"; } @@ -33864,13 +34309,13 @@ var ts; case 8: reportInvalidOptionValue(option && option.type !== "number"); return validateValue(Number(valueExpression.text)); - case 219: + case 221: if (valueExpression.operator !== 40 || valueExpression.operand.kind !== 8) { break; } reportInvalidOptionValue(option && option.type !== "number"); return validateValue(-Number(valueExpression.operand.text)); - case 205: + case 207: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; if (option) { @@ -33880,7 +34325,7 @@ var ts; else { return validateValue(convertObjectLiteralExpressionToJson(objectLiteralExpression, undefined, undefined, undefined)); } - case 204: + case 206: reportInvalidOptionValue(option && option.type !== "list"); return validateValue(convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element)); } @@ -34080,12 +34525,22 @@ var ts; return !isCommandLineOnly && category !== undefined && (!categoriesToSkip.includes(category) || compilerOptionsMap.has(name)); } function writeConfigurations() { - var categorizedOptions = ts.createMultiMap(); + var categorizedOptions = new ts.Map(); + categorizedOptions.set(ts.Diagnostics.Projects, []); + categorizedOptions.set(ts.Diagnostics.Language_and_Environment, []); + categorizedOptions.set(ts.Diagnostics.Modules, []); + categorizedOptions.set(ts.Diagnostics.JavaScript_Support, []); + categorizedOptions.set(ts.Diagnostics.Emit, []); + categorizedOptions.set(ts.Diagnostics.Interop_Constraints, []); + categorizedOptions.set(ts.Diagnostics.Type_Checking, []); + categorizedOptions.set(ts.Diagnostics.Completeness, []); for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) { var option = optionDeclarations_1[_i]; - var category = option.category; if (isAllowedOptionForOutput(option)) { - categorizedOptions.add(ts.getLocaleSpecificMessage(category), option); + var listForCategory = categorizedOptions.get(option.category); + if (!listForCategory) + categorizedOptions.set(option.category, listForCategory = []); + listForCategory.push(option); } } var marginLength = 0; @@ -34095,7 +34550,7 @@ var ts; if (entries.length !== 0) { entries.push({ value: "" }); } - entries.push({ value: "/* ".concat(category, " */") }); + entries.push({ value: "/* ".concat(ts.getLocaleSpecificMessage(category), " */") }); for (var _i = 0, options_1 = options; _i < options_1.length; _i++) { var option = options_1[_i]; var optionName = void 0; @@ -34874,7 +35329,7 @@ var ts; function convertCompilerOptionsForTelemetry(opts) { var out = {}; for (var key in opts) { - if (opts.hasOwnProperty(key)) { + if (ts.hasProperty(opts, key)) { var type = getOptionFromName(key); if (type !== undefined) { out[key] = getOptionValueWithEmptyStrings(opts[key], type); @@ -35824,6 +36279,9 @@ var ts; requestContainingDirectory: containingDirectory, reportDiagnostic: function (diag) { return void diagnostics.push(diag); }, }; + if (traceEnabled && ts.getEmitModuleResolutionKind(compilerOptions) >= ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) <= ts.ModuleResolutionKind.NodeNext) { + trace(host, ts.Diagnostics.Resolving_in_0_mode_with_conditions_1, features & NodeResolutionFeatures.EsmMode ? "ESM" : "CJS", conditions.map(function (c) { return "'".concat(c, "'"); }).join(", ")); + } var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); }); return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache); function tryResolve(extensions) { @@ -36353,7 +36811,7 @@ var ts; } if (mainExport) { var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, false); - return loadModuleFromTargetImportOrExport(mainExport, "", false); + return loadModuleFromTargetImportOrExport(mainExport, "", false, "."); } } else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) { @@ -36428,7 +36886,7 @@ var ts; var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports); if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) { var target = lookupTable[moduleName]; - return loadModuleFromTargetImportOrExport(target, "", false); + return loadModuleFromTargetImportOrExport(target, "", false, moduleName); } var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys); for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) { @@ -36437,17 +36895,17 @@ var ts; var target = lookupTable[potentialTarget]; var starPos = potentialTarget.indexOf("*"); var subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos)); - return loadModuleFromTargetImportOrExport(target, subpath, true); + return loadModuleFromTargetImportOrExport(target, subpath, true, potentialTarget); } else if (ts.endsWith(potentialTarget, "*") && ts.startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) { var target = lookupTable[potentialTarget]; var subpath = moduleName.substring(potentialTarget.length - 1); - return loadModuleFromTargetImportOrExport(target, subpath, true); + return loadModuleFromTargetImportOrExport(target, subpath, true, potentialTarget); } else if (ts.startsWith(moduleName, potentialTarget)) { var target = lookupTable[potentialTarget]; var subpath = moduleName.substring(potentialTarget.length); - return loadModuleFromTargetImportOrExport(target, subpath, false); + return loadModuleFromTargetImportOrExport(target, subpath, false, potentialTarget); } } function matchesPatternWithTrailer(target, name) { @@ -36461,7 +36919,7 @@ var ts; } function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) { return loadModuleFromTargetImportOrExport; - function loadModuleFromTargetImportOrExport(target, subpath, pattern) { + function loadModuleFromTargetImportOrExport(target, subpath, pattern, key) { if (typeof target === "string") { if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) { if (state.traceEnabled) { @@ -36472,6 +36930,8 @@ var ts; if (!ts.startsWith(target, "./")) { if (isImports && !ts.startsWith(target, "../") && !ts.startsWith(target, "/") && !ts.isRootedDiskPath(target)) { var combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath; + traceIfEnabled(state, ts.Diagnostics.Using_0_subpath_1_with_target_2, "imports", key, combinedLookup); + traceIfEnabled(state, ts.Diagnostics.Resolving_module_0_from_1, combinedLookup, scope.packageDirectory + "/"); var result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference); return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : undefined); } @@ -36496,6 +36956,9 @@ var ts; } return toSearchResult(undefined); } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Using_0_subpath_1_with_target_2, isImports ? "imports" : "exports", key, pattern ? target.replace(/\*/g, subpath) : target + subpath); + } var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath); var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports); if (inputLink) @@ -36505,14 +36968,18 @@ var ts; else if (typeof target === "object" && target !== null) { if (!Array.isArray(target)) { for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) { - var key = _a[_i]; - if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) { - var subTarget = target[key]; - var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern); + var condition = _a[_i]; + if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) { + traceIfEnabled(state, ts.Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition); + var subTarget = target[condition]; + var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key); if (result) { return result; } } + else { + traceIfEnabled(state, ts.Diagnostics.Saw_non_matching_condition_0, condition); + } } return undefined; } @@ -36525,7 +36992,7 @@ var ts; } for (var _b = 0, target_2 = target; _b < target_2.length; _b++) { var elem = target_2[_b]; - var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern); + var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern, key); if (result) { return result; } @@ -36684,6 +37151,7 @@ var ts; } } function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) { + var _a; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName)); var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state); if (!(state.features & NodeResolutionFeatures.Exports)) { @@ -36696,12 +37164,7 @@ var ts; return withPackageId(packageInfo, fromDirectory); } } - var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest; var loader = function (extensions, candidate, onlyRecordFailures, state) { - var _a; - if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { - return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; - } var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo @@ -36711,18 +37174,22 @@ var ts; } return withPackageId(packageInfo, pathAndExtension); }; + var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest; + var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); if (rest !== "") { - var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.contents.versionPaths) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); - } - var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); - var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, undefined, loader, !packageDirectoryExists, state); - if (fromPaths) { - return fromPaths.value; - } + } + if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; + } + if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); + } + var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, undefined, loader, !packageDirectoryExists, state); + if (fromPaths) { + return fromPaths.value; } } return loader(extensions, candidate, !nodeModulesDirectoryExists, state); @@ -36876,6 +37343,15 @@ var ts; function toSearchResult(value) { return value !== undefined ? { value: value } : undefined; } + function traceIfEnabled(state, diagnostic) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + if (state.traceEnabled) { + trace.apply(void 0, __spreadArray([state.host, diagnostic], args, false)); + } + } })(ts || (ts = {})); var ts; (function (ts) { @@ -36900,23 +37376,23 @@ var ts; } function getModuleInstanceStateWorker(node, visited) { switch (node.kind) { - case 258: - case 259: + case 261: + case 262: return 0; - case 260: + case 263: if (ts.isEnumConst(node)) { return 2; } break; - case 266: - case 265: + case 269: + case 268: if (!(ts.hasSyntacticModifier(node, 1))) { return 0; } break; - case 272: + case 275: var exportDeclaration = node; - if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 273) { + if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 276) { var state = 0; for (var _i = 0, _a = exportDeclaration.exportClause.elements; _i < _a.length; _i++) { var specifier = _a[_i]; @@ -36931,7 +37407,7 @@ var ts; return state; } break; - case 262: { + case 265: { var state_1 = 0; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateCached(n, visited); @@ -36950,7 +37426,7 @@ var ts; }); return state_1; } - case 261: + case 264: return getModuleInstanceState(node, visited); case 79: if (node.isInJSDocNamespace) { @@ -37108,7 +37584,7 @@ var ts; } } function getDeclarationName(node) { - if (node.kind === 271) { + if (node.kind === 274) { return node.isExportEquals ? "export=" : "default"; } var name = ts.getNameOfDeclaration(node); @@ -37117,7 +37593,7 @@ var ts; var moduleName = ts.getTextOfIdentifierOrLiteral(name); return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"".concat(moduleName, "\"")); } - if (name.kind === 162) { + if (name.kind === 164) { var nameExpression = name.expression; if (ts.isStringOrNumericLiteralLike(nameExpression)) { return ts.escapeLeadingUnderscores(nameExpression.text); @@ -37140,31 +37616,31 @@ var ts; return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined; } switch (node.kind) { - case 171: + case 173: return "__constructor"; - case 179: - case 174: - case 323: + case 181: + case 176: + case 326: return "__call"; - case 180: - case 175: + case 182: + case 177: return "__new"; - case 176: + case 178: return "__index"; - case 272: + case 275: return "__export"; - case 305: + case 308: return "export="; - case 221: + case 223: if (ts.getAssignmentDeclarationKind(node) === 2) { return "export="; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 317: + case 320: return (ts.isJSDocConstructSignature(node) ? "__new" : "__call"); - case 164: - ts.Debug.assert(node.parent.kind === 317, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); + case 166: + ts.Debug.assert(node.parent.kind === 320, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; @@ -37175,7 +37651,7 @@ var ts; } function declareSymbol(symbolTable, parent, node, includes, excludes, isReplaceableByMethod, isComputedName) { ts.Debug.assert(isComputedName || !ts.hasDynamicName(node)); - var isDefaultExport = ts.hasSyntacticModifier(node, 512) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; + var isDefaultExport = ts.hasSyntacticModifier(node, 1024) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; var name = isComputedName ? "__computed" : isDefaultExport && parent ? "default" : getDeclarationName(node); @@ -37221,7 +37697,7 @@ var ts; } else { if (symbol.declarations && symbol.declarations.length && - (node.kind === 271 && !node.isExportEquals)) { + (node.kind === 274 && !node.isExportEquals)) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; messageNeedsName_1 = false; multipleDefaultExports_1 = true; @@ -37259,7 +37735,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = !!(ts.getCombinedModifierFlags(node) & 1) || jsdocTreatAsExported(node); if (symbolFlags & 2097152) { - if (node.kind === 275 || (node.kind === 265 && hasExportModifier)) { + if (node.kind === 278 || (node.kind === 268 && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -37270,7 +37746,7 @@ var ts; if (ts.isJSDocTypeAlias(node)) ts.Debug.assert(ts.isInJSFile(node)); if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 64)) { - if (!container.locals || (ts.hasSyntacticModifier(node, 512) && !getDeclarationName(node))) { + if (!container.locals || (ts.hasSyntacticModifier(node, 1024) && !getDeclarationName(node))) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } var exportKind = symbolFlags & 111551 ? 1048576 : 0; @@ -37306,7 +37782,7 @@ var ts; var saveThisParentContainer = thisParentContainer; var savedBlockScopeContainer = blockScopeContainer; if (containerFlags & 1) { - if (node.kind !== 214) { + if (node.kind !== 216) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -37328,17 +37804,17 @@ var ts; var saveActiveLabelList = activeLabelList; var saveHasExplicitReturn = hasExplicitReturn; var isImmediatelyInvoked = (containerFlags & 16 && - !ts.hasSyntacticModifier(node, 256) && + !ts.hasSyntacticModifier(node, 512) && !node.asteriskToken && !!ts.getImmediatelyInvokedFunctionExpression(node)) || - node.kind === 170; + node.kind === 172; if (!isImmediatelyInvoked) { currentFlow = initFlowNode({ flags: 2 }); if (containerFlags & (16 | 128)) { currentFlow.node = node; } } - currentReturnTarget = isImmediatelyInvoked || node.kind === 171 || (ts.isInJSFile(node) && (node.kind === 256 || node.kind === 213)) ? createBranchLabel() : undefined; + currentReturnTarget = isImmediatelyInvoked || node.kind === 173 || (ts.isInJSFile(node) && (node.kind === 259 || node.kind === 215)) ? createBranchLabel() : undefined; currentExceptionTarget = undefined; currentBreakTarget = undefined; currentContinueTarget = undefined; @@ -37352,14 +37828,14 @@ var ts; node.flags |= 512; node.endFlowNode = currentFlow; } - if (node.kind === 305) { + if (node.kind === 308) { node.flags |= emitFlags; node.endFlowNode = currentFlow; } if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); currentFlow = finishFlowLabel(currentReturnTarget); - if (node.kind === 171 || node.kind === 170 || (ts.isInJSFile(node) && (node.kind === 256 || node.kind === 213))) { + if (node.kind === 173 || node.kind === 172 || (ts.isInJSFile(node) && (node.kind === 259 || node.kind === 215))) { node.returnFlowNode = currentFlow; } } @@ -37386,8 +37862,8 @@ var ts; blockScopeContainer = savedBlockScopeContainer; } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 256 ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 256 ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 259 ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 259 ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -37408,59 +37884,59 @@ var ts; inAssignmentPattern = saveInAssignmentPattern; return; } - if (node.kind >= 237 && node.kind <= 253 && !options.allowUnreachableCode) { + if (node.kind >= 240 && node.kind <= 256 && !options.allowUnreachableCode) { node.flowNode = currentFlow; } switch (node.kind) { - case 241: + case 244: bindWhileStatement(node); break; - case 240: + case 243: bindDoStatement(node); break; - case 242: + case 245: bindForStatement(node); break; - case 243: - case 244: + case 246: + case 247: bindForInOrForOfStatement(node); break; - case 239: + case 242: bindIfStatement(node); break; - case 247: - case 251: + case 250: + case 254: bindReturnOrThrow(node); break; - case 246: - case 245: + case 249: + case 248: bindBreakOrContinueStatement(node); break; - case 252: + case 255: bindTryStatement(node); break; - case 249: + case 252: bindSwitchStatement(node); break; - case 263: + case 266: bindCaseBlock(node); break; - case 289: + case 292: bindCaseClause(node); break; - case 238: + case 241: bindExpressionStatement(node); break; - case 250: + case 253: bindLabeledStatement(node); break; - case 219: + case 221: bindPrefixUnaryExpressionFlow(node); break; - case 220: + case 222: bindPostfixUnaryExpressionFlow(node); break; - case 221: + case 223: if (ts.isDestructuringAssignment(node)) { inAssignmentPattern = saveInAssignmentPattern; bindDestructuringAssignmentFlow(node); @@ -37468,46 +37944,49 @@ var ts; } bindBinaryExpressionFlow(node); break; - case 215: + case 217: bindDeleteExpressionFlow(node); break; - case 222: + case 224: bindConditionalExpressionFlow(node); break; - case 254: + case 257: bindVariableDeclarationFlow(node); break; - case 206: - case 207: + case 208: + case 209: bindAccessExpressionFlow(node); break; - case 208: + case 210: bindCallExpressionFlow(node); break; - case 230: + case 232: bindNonNullExpressionFlow(node); break; - case 345: - case 338: - case 339: + case 348: + case 341: + case 342: bindJSDocTypeAlias(node); break; - case 305: { + case 308: { bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; } - case 235: - case 262: + case 238: + case 265: bindEachFunctionsFirst(node.statements); break; - case 203: + case 205: bindBindingElementFlow(node); break; - case 205: - case 204: - case 296: - case 225: + case 166: + bindParameterFlow(node); + break; + case 207: + case 206: + case 299: + case 227: inAssignmentPattern = saveInAssignmentPattern; default: bindEachChild(node); @@ -37521,19 +38000,19 @@ var ts; case 79: case 80: case 108: - case 206: - case 207: - return containsNarrowableReference(expr); case 208: + case 209: + return containsNarrowableReference(expr); + case 210: return hasNarrowableArgument(expr); - case 212: - case 230: + case 214: + case 232: return isNarrowingExpression(expr.expression); - case 221: + case 223: return isNarrowingBinaryExpression(expr); - case 219: + case 221: return expr.operator === 53 && isNarrowingExpression(expr.operand); - case 216: + case 218: return isNarrowingExpression(expr.expression); } return false; @@ -37557,7 +38036,7 @@ var ts; } } } - if (expr.expression.kind === 206 && + if (expr.expression.kind === 208 && containsNarrowableReference(expr.expression.expression)) { return true; } @@ -37590,9 +38069,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 212: + case 214: return isNarrowableOperand(expr.expression); - case 221: + case 223: switch (expr.operatorToken.kind) { case 63: return isNarrowableOperand(expr.left); @@ -37667,26 +38146,26 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 239: - case 241: - case 240: - return parent.expression === node; case 242: - case 222: + case 244: + case 243: + return parent.expression === node; + case 245: + case 224: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 212) { + if (node.kind === 214) { node = node.expression; } - else if (node.kind === 219 && node.operator === 53) { + else if (node.kind === 221 && node.operator === 53) { node = node.operand; } else { - return node.kind === 221 && (node.operatorToken.kind === 55 || + return node.kind === 223 && (node.operatorToken.kind === 55 || node.operatorToken.kind === 56 || node.operatorToken.kind === 60); } @@ -37732,7 +38211,7 @@ var ts; } function setContinueTarget(node, target) { var label = activeLabelList; - while (label && node.parent.kind === 250) { + while (label && node.parent.kind === 253) { label.continueTarget = target; label = label.next; node = node.parent; @@ -37783,12 +38262,12 @@ var ts; bind(node.expression); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 244) { + if (node.kind === 247) { bind(node.awaitModifier); } addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 255) { + if (node.initializer.kind !== 258) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -37810,7 +38289,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 247) { + if (node.kind === 250) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -37827,7 +38306,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 246 ? breakTarget : continueTarget; + var flowLabel = node.kind === 249 ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -37900,7 +38379,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 290; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 293; }); node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents; if (!hasDefault) { addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0)); @@ -37943,7 +38422,7 @@ var ts; maybeBindExpressionFlowIfCall(node.expression); } function maybeBindExpressionFlowIfCall(node) { - if (node.kind === 208) { + if (node.kind === 210) { var call = node; if (call.expression.kind !== 106 && ts.isDottedName(call.expression)) { currentFlow = createFlowCall(currentFlow, call); @@ -37969,7 +38448,7 @@ var ts; currentFlow = finishFlowLabel(postStatementLabel); } function bindDestructuringTargetFlow(node) { - if (node.kind === 221 && node.operatorToken.kind === 63) { + if (node.kind === 223 && node.operatorToken.kind === 63) { bindAssignmentTargetFlow(node.left); } else { @@ -37980,10 +38459,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowMutation(16, currentFlow, node); } - else if (node.kind === 204) { + else if (node.kind === 206) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 225) { + if (e.kind === 227) { bindAssignmentTargetFlow(e.expression); } else { @@ -37991,16 +38470,16 @@ var ts; } } } - else if (node.kind === 205) { + else if (node.kind === 207) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 296) { + if (p.kind === 299) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 297) { + else if (p.kind === 300) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 298) { + else if (p.kind === 301) { bindAssignmentTargetFlow(p.expression); } } @@ -38132,7 +38611,7 @@ var ts; var operator = node.operatorToken.kind; if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 63 && node.left.kind === 207) { + if (operator === 63 && node.left.kind === 209) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowMutation(256, currentFlow, node); @@ -38160,7 +38639,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 206) { + if (node.expression.kind === 208) { bindAssignmentTargetFlow(node.expression); } } @@ -38198,19 +38677,36 @@ var ts; } } function bindBindingElementFlow(node) { - if (ts.isBindingPattern(node.name)) { - bind(node.dotDotDotToken); - bind(node.propertyName); - bind(node.initializer); - bind(node.name); + bind(node.dotDotDotToken); + bind(node.propertyName); + bindInitializer(node.initializer); + bind(node.name); + } + function bindParameterFlow(node) { + bindEach(node.modifiers); + bind(node.dotDotDotToken); + bind(node.questionToken); + bind(node.type); + bindInitializer(node.initializer); + bind(node.name); + } + function bindInitializer(node) { + if (!node) { + return; } - else { - bindEachChild(node); + var entryFlow = currentFlow; + bind(node); + if (entryFlow === unreachableFlow || entryFlow === currentFlow) { + return; } + var exitFlow = createBranchLabel(); + addAntecedent(exitFlow, entryFlow); + addAntecedent(exitFlow, currentFlow); + currentFlow = finishFlowLabel(exitFlow); } function bindJSDocTypeAlias(node) { bind(node.tagName); - if (node.kind !== 339 && node.fullName) { + if (node.kind !== 342 && node.fullName) { ts.setParent(node.fullName, node); ts.setParentRecursive(node.fullName, false); } @@ -38221,7 +38717,7 @@ var ts; function bindJSDocClassTag(node) { bindEachChild(node); var host = ts.getHostSignatureFromJSDoc(node); - if (host && host.kind !== 169) { + if (host && host.kind !== 171) { addDeclarationToSymbol(host.symbol, host, 32); } } @@ -38234,15 +38730,15 @@ var ts; } function bindOptionalChainRest(node) { switch (node.kind) { - case 206: + case 208: bind(node.questionDotToken); bind(node.name); break; - case 207: + case 209: bind(node.questionDotToken); bind(node.argumentExpression); break; - case 208: + case 210: bind(node.questionDotToken); bindEach(node.typeArguments); bindEach(node.arguments); @@ -38293,7 +38789,7 @@ var ts; } else { var expr = ts.skipParentheses(node.expression); - if (expr.kind === 213 || expr.kind === 214) { + if (expr.kind === 215 || expr.kind === 216) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -38305,7 +38801,7 @@ var ts; } } } - if (node.expression.kind === 206) { + if (node.expression.kind === 208) { var propertyAccess = node.expression; if (ts.isIdentifier(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowMutation(256, currentFlow, node); @@ -38314,54 +38810,54 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 226: - case 257: + case 228: case 260: - case 205: - case 182: - case 322: - case 286: + case 263: + case 207: + case 184: + case 325: + case 289: return 1; - case 258: - return 1 | 64; case 261: - case 259: - case 195: - case 176: + return 1 | 64; + case 264: + case 262: + case 197: + case 178: return 1 | 32; - case 305: + case 308: return 1 | 4 | 32; - case 172: - case 173: - case 169: + case 174: + case 175: + case 171: if (ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { return 1 | 4 | 32 | 8 | 128; } - case 171: - case 256: - case 168: - case 174: - case 323: - case 317: - case 179: - case 175: - case 180: + case 173: + case 259: case 170: + case 176: + case 326: + case 320: + case 181: + case 177: + case 182: + case 172: return 1 | 4 | 32 | 8; - case 213: - case 214: + case 215: + case 216: return 1 | 4 | 32 | 8 | 16; - case 262: + case 265: return 4; - case 167: + case 169: return node.initializer ? 4 : 0; - case 292: - case 242: - case 243: - case 244: - case 263: + case 295: + case 245: + case 246: + case 247: + case 266: return 2; - case 235: + case 238: return ts.isFunctionLike(node.parent) || ts.isClassStaticBlockDeclaration(node.parent) ? 0 : 2; } return 0; @@ -38374,41 +38870,41 @@ var ts; } function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) { switch (container.kind) { - case 261: + case 264: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 305: + case 308: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 226: - case 257: - return declareClassMember(node, symbolFlags, symbolExcludes); + case 228: case 260: + return declareClassMember(node, symbolFlags, symbolExcludes); + case 263: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 182: - case 322: - case 205: - case 258: - case 286: + case 184: + case 325: + case 207: + case 261: + case 289: return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 179: - case 180: - case 174: - case 175: - case 323: + case 181: + case 182: case 176: - case 169: - case 168: + case 177: + case 326: + case 178: case 171: - case 172: - case 173: - case 256: - case 213: - case 214: - case 317: - case 345: - case 338: case 170: + case 173: + case 174: + case 175: case 259: - case 195: + case 215: + case 216: + case 320: + case 348: + case 341: + case 172: + case 262: + case 197: return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes); } } @@ -38499,10 +38995,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 261: + case 264: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 305: + case 308: if (ts.isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -38592,7 +39088,7 @@ var ts; node.originalKeywordKind <= 125) { file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); } - else if (node.originalKeywordKind === 132) { + else if (node.originalKeywordKind === 133) { if (ts.isExternalModule(file) && ts.isInTopLevelContext(node)) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, ts.declarationNameToString(node))); } @@ -38674,8 +39170,8 @@ var ts; } function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2) { - if (blockScopeContainer.kind !== 305 && - blockScopeContainer.kind !== 261 && + if (blockScopeContainer.kind !== 308 && + blockScopeContainer.kind !== 264 && !ts.isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { var errorSpan = ts.getErrorSpanForNode(file, node); file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node))); @@ -38739,7 +39235,7 @@ var ts; node.tracingPath = file.path; var saveInStrictMode = inStrictMode; bindWorker(node); - if (node.kind > 160) { + if (node.kind > 162) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -38807,23 +39303,23 @@ var ts; break; } case 108: - if (currentFlow && (ts.isExpression(node) || parent.kind === 297)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 300)) { node.flowNode = currentFlow; } return checkContextualIdentifier(node); - case 161: + case 163: if (currentFlow && ts.isPartOfTypeQuery(node)) { node.flowNode = currentFlow; } break; - case 231: + case 233: case 106: node.flowNode = currentFlow; break; case 80: return checkPrivateIdentifier(node); - case 206: - case 207: + case 208: + case 209: var expr = node; if (currentFlow && isNarrowableReference(expr)) { expr.flowNode = currentFlow; @@ -38838,7 +39334,7 @@ var ts; declareSymbol(file.locals, undefined, expr.expression, 1 | 134217728, 111550); } break; - case 221: + case 223: var specialKind = ts.getAssignmentDeclarationKind(node); switch (specialKind) { case 1: @@ -38873,74 +39369,74 @@ var ts; ts.Debug.fail("Unknown binary expression special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 292: + case 295: return checkStrictModeCatchClause(node); - case 215: + case 217: return checkStrictModeDeleteExpression(node); case 8: return checkStrictModeNumericLiteral(node); - case 220: + case 222: return checkStrictModePostfixUnaryExpression(node); - case 219: + case 221: return checkStrictModePrefixUnaryExpression(node); - case 248: + case 251: return checkStrictModeWithStatement(node); - case 250: + case 253: return checkStrictModeLabeledStatement(node); - case 192: + case 194: seenThisKeyword = true; return; - case 177: + case 179: break; - case 163: + case 165: return bindTypeParameter(node); - case 164: + case 166: return bindParameter(node); - case 254: + case 257: return bindVariableDeclarationOrBindingElement(node); - case 203: + case 205: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); - case 167: - case 166: + case 169: + case 168: return bindPropertyWorker(node); - case 296: - case 297: - return bindPropertyOrMethodOrAccessor(node, 4, 0); case 299: + case 300: + return bindPropertyOrMethodOrAccessor(node, 4, 0); + case 302: return bindPropertyOrMethodOrAccessor(node, 8, 900095); - case 174: - case 175: case 176: + case 177: + case 178: return declareSymbolAndAddToSymbolTable(node, 131072, 0); - case 169: - case 168: + case 171: + case 170: return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 16777216 : 0), ts.isObjectLiteralMethod(node) ? 0 : 103359); - case 256: + case 259: return bindFunctionDeclaration(node); - case 171: + case 173: return declareSymbolAndAddToSymbolTable(node, 16384, 0); - case 172: + case 174: return bindPropertyOrMethodOrAccessor(node, 32768, 46015); - case 173: + case 175: return bindPropertyOrMethodOrAccessor(node, 65536, 78783); - case 179: - case 317: - case 323: - case 180: - return bindFunctionOrConstructorType(node); + case 181: + case 320: + case 326: case 182: - case 322: - case 195: + return bindFunctionOrConstructorType(node); + case 184: + case 325: + case 197: return bindAnonymousTypeWorker(node); - case 332: + case 335: return bindJSDocClassTag(node); - case 205: + case 207: return bindObjectLiteralExpression(node); - case 213: - case 214: + case 215: + case 216: return bindFunctionExpression(node); - case 208: + case 210: var assignmentKind = ts.getAssignmentDeclarationKind(node); switch (assignmentKind) { case 7: @@ -38958,65 +39454,68 @@ var ts; bindCallExpression(node); } break; - case 226: - case 257: + case 228: + case 260: inStrictMode = true; return bindClassLikeDeclaration(node); - case 258: + case 261: return bindBlockScopedDeclaration(node, 64, 788872); - case 259: + case 262: return bindBlockScopedDeclaration(node, 524288, 788968); - case 260: + case 263: return bindEnumDeclaration(node); - case 261: + case 264: return bindModuleDeclaration(node); - case 286: + case 289: return bindJsxAttributes(node); - case 285: + case 288: return bindJsxAttribute(node, 4, 0); - case 265: case 268: - case 270: - case 275: + case 271: + case 273: + case 278: return declareSymbolAndAddToSymbolTable(node, 2097152, 2097152); - case 264: - return bindNamespaceExportDeclaration(node); case 267: + return bindNamespaceExportDeclaration(node); + case 270: return bindImportClause(node); - case 272: + case 275: return bindExportDeclaration(node); - case 271: + case 274: return bindExportAssignment(node); - case 305: + case 308: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 235: + case 238: if (!ts.isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) { return; } - case 262: + case 265: return updateStrictModeStatementList(node.statements); - case 340: - if (node.parent.kind === 323) { + case 343: + if (node.parent.kind === 326) { return bindParameter(node); } - if (node.parent.kind !== 322) { + if (node.parent.kind !== 325) { break; } - case 347: + case 350: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 319 ? 4 | 16777216 : 4; return declareSymbolAndAddToSymbolTable(propTag, flags, 0); - case 345: - case 338: - case 339: + case 348: + case 341: + case 342: return (delayedTypeAliases || (delayedTypeAliases = [])).push(node); } } function bindPropertyWorker(node) { - return bindPropertyOrMethodOrAccessor(node, 4 | (node.questionToken ? 16777216 : 0), 0); + var isAutoAccessor = ts.isAutoAccessorPropertyDeclaration(node); + var includes = isAutoAccessor ? 98304 : 4; + var excludes = isAutoAccessor ? 13247 : 0; + return bindPropertyOrMethodOrAccessor(node, includes | (node.questionToken ? 16777216 : 0), excludes); } function bindAnonymousTypeWorker(node) { return bindAnonymousDeclaration(node, 2048, "__type"); @@ -39157,8 +39656,8 @@ var ts; } var thisContainer = ts.getThisContainer(node, false); switch (thisContainer.kind) { - case 256: - case 213: + case 259: + case 215: var constructorSymbol = thisContainer.symbol; if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 63) { var l = thisContainer.parent.left; @@ -39177,12 +39676,12 @@ var ts; addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, 32); } break; - case 171: - case 167: + case 173: case 169: + case 171: + case 174: + case 175: case 172: - case 173: - case 170: var containingClass = thisContainer.parent; var symbolTable = ts.isStatic(thisContainer) ? containingClass.symbol.exports : containingClass.symbol.members; if (ts.hasDynamicName(node)) { @@ -39192,7 +39691,7 @@ var ts; declareSymbol(symbolTable, containingClass.symbol, node, 4 | 67108864, 0, true); } break; - case 305: + case 308: if (ts.hasDynamicName(node)) { break; } @@ -39220,7 +39719,7 @@ var ts; if (node.expression.kind === 108) { bindThisPropertyAssignment(node); } - else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 305) { + else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 308) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -39251,7 +39750,7 @@ var ts; } function bindObjectDefinePropertyAssignment(node) { var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]); - var isToplevel = node.parent.parent.kind === 305; + var isToplevel = node.parent.parent.kind === 308; namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, false, false); bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, false); } @@ -39345,8 +39844,8 @@ var ts; } function isTopLevelNamespaceAssignment(propertyAccess) { return ts.isBinaryExpression(propertyAccess.parent) - ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 305 - : propertyAccess.parent.parent.kind === 305; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 308 + : propertyAccess.parent.parent.kind === 308; } function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) { var namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer); @@ -39412,7 +39911,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 257) { + if (node.kind === 260) { bindBlockScopedDeclaration(node, 32, 899503); } else { @@ -39444,7 +39943,7 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } if (!ts.isBindingPattern(node.name)) { - var possibleVariableDecl = node.kind === 254 ? node : node.parent.parent; + var possibleVariableDecl = node.kind === 257 ? node : node.parent.parent; if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !ts.getJSDocTypeTag(node) && @@ -39463,7 +39962,7 @@ var ts; } } function bindParameter(node) { - if (node.kind === 340 && container.kind !== 323) { + if (node.kind === 343 && container.kind !== 326) { return; } if (inStrictMode && !(node.flags & 16777216)) { @@ -39536,7 +40035,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 262144, 526824); } } - else if (node.parent.kind === 190) { + else if (node.parent.kind === 192) { var container_2 = getInferTypeContainer(node.parent); if (container_2) { if (!container_2.locals) { @@ -39561,9 +40060,9 @@ var ts; return false; } if (currentFlow === unreachableFlow) { - var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 236) || - node.kind === 257 || - (node.kind === 261 && shouldReportErrorOnModuleDeclaration(node)); + var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 239) || + node.kind === 260 || + (node.kind === 264 && shouldReportErrorOnModuleDeclaration(node)); if (reportError) { currentFlow = reportedUnreachableFlow; if (!options.allowUnreachableCode) { @@ -39595,12 +40094,12 @@ var ts; } function isPurelyTypeDeclaration(s) { switch (s.kind) { - case 258: - case 259: - return true; case 261: + case 262: + return true; + case 264: return getModuleInstanceState(s) !== 1; - case 260: + case 263: return ts.hasSyntacticModifier(s, 2048); default: return false; @@ -39793,7 +40292,7 @@ var ts; symbol.exports.forEach(visitSymbol); } ts.forEach(symbol.declarations, function (d) { - if (d.type && d.type.kind === 181) { + if (d.type && d.type.kind === 183) { var query = d.type; var entity = getResolvedSymbol(getFirstIdentifier(query.exprName)); visitSymbol(entity); @@ -39965,6 +40464,7 @@ var ts; getTypeOfPropertyOfType: function (type, name) { return getTypeOfPropertyOfType(type, ts.escapeLeadingUnderscores(name)); }, getIndexInfoOfType: function (type, kind) { return getIndexInfoOfType(type, kind === 0 ? stringType : numberType); }, getIndexInfosOfType: getIndexInfosOfType, + getIndexInfosOfIndexSymbol: getIndexInfosOfIndexSymbol, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: function (type, kind) { return getIndexTypeOfType(type, kind === 0 ? stringType : numberType); }, getIndexType: function (type) { return getIndexType(type); }, @@ -39990,6 +40490,7 @@ var ts; signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, symbolToEntityName: nodeBuilder.symbolToEntityName, symbolToExpression: nodeBuilder.symbolToExpression, + symbolToNode: nodeBuilder.symbolToNode, symbolToTypeParameterDeclarations: nodeBuilder.symbolToTypeParameterDeclarations, symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration, typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration, @@ -40155,6 +40656,12 @@ var ts; getOptionalType: function () { return optionalType; }, getPromiseType: function () { return getGlobalPromiseType(false); }, getPromiseLikeType: function () { return getGlobalPromiseLikeType(false); }, + getAsyncIterableType: function () { + var type = getGlobalAsyncIterableType(false); + if (type === emptyGenericType) + return undefined; + return type; + }, isSymbolAccessible: isSymbolAccessible, isArrayType: isArrayType, isTupleType: isTupleType, @@ -40231,6 +40738,7 @@ var ts; isPropertyAccessible: isPropertyAccessible, getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration, getMemberOverrideModifierStatus: getMemberOverrideModifierStatus, + isTypeParameterPossiblyReferenced: isTypeParameterPossiblyReferenced, }; function runWithInferenceBlockedFromSourceNode(node, fn) { var containingCall = ts.findAncestor(node, ts.isCallLikeExpression); @@ -40350,7 +40858,8 @@ var ts; var emptyTypeLiteralSymbol = createSymbol(2048, "__type"); emptyTypeLiteralSymbol.members = ts.createSymbolTable(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); - var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType; + var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); + var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType; var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); emptyGenericType.instantiations = new ts.Map(); var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); @@ -40453,6 +40962,8 @@ var ts; var deferredGlobalOmitSymbol; var deferredGlobalAwaitedSymbol; var deferredGlobalBigIntType; + var deferredGlobalNaNSymbol; + var deferredGlobalRecordSymbol; var allPotentiallyUnusedIdentifiers = new ts.Map(); var flowLoopStart = 0; var flowLoopCount = 0; @@ -40853,7 +41364,7 @@ var ts; if (unidirectional === void 0) { unidirectional = false; } source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); - target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol); + target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol)); }); } function mergeModuleAugmentation(moduleName) { @@ -40926,7 +41437,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks()); } function isGlobalSourceFile(node) { - return node.kind === 305 && !ts.isExternalOrCommonJsModule(node); + return node.kind === 308 && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -40937,8 +41448,8 @@ var ts; return symbol; } if (symbol.flags & 2097152) { - var target = resolveAlias(symbol); - if (target === unknownSymbol || target.flags & meaning) { + var targetFlags = getAllSymbolFlags(symbol); + if (targetFlags & meaning) { return symbol; } } @@ -40973,15 +41484,15 @@ var ts; return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile); } if (declaration.pos <= usage.pos && !(ts.isPropertyDeclaration(declaration) && ts.isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) { - if (declaration.kind === 203) { - var errorBindingElement = ts.getAncestor(usage, 203); + if (declaration.kind === 205) { + var errorBindingElement = ts.getAncestor(usage, 205); if (errorBindingElement) { return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || declaration.pos < errorBindingElement.pos; } - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 254), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 257), usage); } - else if (declaration.kind === 254) { + else if (declaration.kind === 257) { return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } else if (ts.isClassDeclaration(declaration)) { @@ -40997,10 +41508,10 @@ var ts; } return true; } - if (usage.parent.kind === 275 || (usage.parent.kind === 271 && usage.parent.isExportEquals)) { + if (usage.parent.kind === 278 || (usage.parent.kind === 274 && usage.parent.isExportEquals)) { return true; } - if (usage.kind === 271 && usage.isExportEquals) { + if (usage.kind === 274 && usage.isExportEquals) { return true; } if (!!(usage.flags & 8388608) || isInTypeQuery(usage) || usageInTypeDeclaration()) { @@ -41022,9 +41533,9 @@ var ts; } function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { switch (declaration.parent.parent.kind) { - case 237: - case 242: - case 244: + case 240: + case 245: + case 247: if (isSameScopeDescendentOf(usage, declaration, declContainer)) { return true; } @@ -41049,7 +41560,7 @@ var ts; var initializerOfProperty = propertyDeclaration.initializer === current; if (initializerOfProperty) { if (ts.isStatic(current.parent)) { - if (declaration.kind === 169) { + if (declaration.kind === 171) { return true; } if (ts.isPropertyDeclaration(declaration) && ts.getContainingClass(usage) === ts.getContainingClass(declaration)) { @@ -41064,7 +41575,7 @@ var ts; } } else { - var isDeclarationInstanceProperty = declaration.kind === 167 && !ts.isStatic(declaration); + var isDeclarationInstanceProperty = declaration.kind === 169 && !ts.isStatic(declaration); if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { return true; } @@ -41083,18 +41594,18 @@ var ts; return "quit"; } switch (node.kind) { - case 214: + case 216: return true; - case 167: + case 169: return stopAtAnyPropertyDeclaration && (ts.isPropertyDeclaration(declaration) && node.parent === declaration.parent || ts.isParameterPropertyDeclaration(declaration, declaration.parent) && node.parent === declaration.parent.parent) ? "quit" : true; - case 235: + case 238: switch (node.parent.kind) { - case 172: - case 169: - case 173: + case 174: + case 171: + case 175: return true; default: return false; @@ -41129,17 +41640,17 @@ var ts; } function requiresScopeChangeWorker(node) { switch (node.kind) { - case 214: - case 213: - case 256: - case 171: - return false; - case 169: - case 172: + case 216: + case 215: + case 259: case 173: - case 296: + return false; + case 171: + case 174: + case 175: + case 299: return requiresScopeChangeWorker(node.name); - case 167: + case 169: if (ts.hasStaticModifier(node)) { return target < 99 || !useDefineForClassFields; } @@ -41161,10 +41672,10 @@ var ts; return (ts.isAssertionExpression(location) && ts.isConstTypeReference(location.type)) || (ts.isJSDocTypeTag(location) && ts.isConstTypeReference(location.typeExpression)); } - function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) { + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) { if (excludeGlobals === void 0) { excludeGlobals = false; } - if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; } - return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol); + if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; } + return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol); } function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) { var _a, _b, _c; @@ -41186,13 +41697,13 @@ var ts; if (result = lookup(location.locals, name, meaning)) { var useResult = true; if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) { - if (meaning & result.flags & 788968 && lastLocation.kind !== 320) { + if (meaning & result.flags & 788968 && lastLocation.kind !== 323) { useResult = result.flags & 262144 ? lastLocation === location.type || - lastLocation.kind === 164 || - lastLocation.kind === 340 || - lastLocation.kind === 341 || - lastLocation.kind === 163 + lastLocation.kind === 166 || + lastLocation.kind === 343 || + lastLocation.kind === 344 || + lastLocation.kind === 165 : false; } if (meaning & result.flags & 3) { @@ -41201,13 +41712,13 @@ var ts; } else if (result.flags & 1) { useResult = - lastLocation.kind === 164 || + lastLocation.kind === 166 || (lastLocation === location.type && !!ts.findAncestor(result.valueDeclaration, ts.isParameter)); } } } - else if (location.kind === 189) { + else if (location.kind === 191) { useResult = lastLocation === location.trueType; } if (useResult) { @@ -41220,13 +41731,13 @@ var ts; } withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation); switch (location.kind) { - case 305: + case 308: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; - case 261: + case 264: var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols; - if (location.kind === 305 || (ts.isModuleDeclaration(location) && location.flags & 16777216 && !ts.isGlobalScopeAugmentation(location))) { + if (location.kind === 308 || (ts.isModuleDeclaration(location) && location.flags & 16777216 && !ts.isGlobalScopeAugmentation(location))) { if (result = moduleExports.get("default")) { var localSymbol = ts.getLocalSymbolForExportDefault(result); if (localSymbol && (result.flags & meaning) && localSymbol.escapedName === name) { @@ -41237,7 +41748,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 && - (ts.getDeclarationOfKind(moduleExport, 275) || ts.getDeclarationOfKind(moduleExport, 274))) { + (ts.getDeclarationOfKind(moduleExport, 278) || ts.getDeclarationOfKind(moduleExport, 277))) { break; } } @@ -41250,12 +41761,12 @@ var ts; } } break; - case 260: + case 263: if (result = lookup(((_c = getSymbolOfNode(location)) === null || _c === void 0 ? void 0 : _c.exports) || emptySymbols, name, meaning & 8)) { break loop; } break; - case 167: + case 169: if (!ts.isStatic(location)) { var ctor = findConstructorDeclaration(location.parent); if (ctor && ctor.locals) { @@ -41266,21 +41777,23 @@ var ts; } } break; - case 257: - case 226: - case 258: + case 260: + case 228: + case 261: if (result = lookup(getSymbolOfNode(location).members || emptySymbols, name, meaning & 788968)) { if (!isTypeParameterSymbolDeclaredInContainer(result, location)) { result = undefined; break; } if (lastLocation && ts.isStatic(lastLocation)) { - error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + } return undefined; } break loop; } - if (location.kind === 226 && meaning & 32) { + if (location.kind === 228 && meaning & 32) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -41288,7 +41801,7 @@ var ts; } } break; - case 228: + case 230: if (lastLocation === location.expression && location.parent.token === 94) { var container = location.parent.parent; if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 788968))) { @@ -41299,30 +41812,32 @@ var ts; } } break; - case 162: + case 164: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 258) { + if (ts.isClassLike(grandparent) || grandparent.kind === 261) { if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968)) { - error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + } return undefined; } } break; - case 214: + case 216: if (ts.getEmitScriptTarget(compilerOptions) >= 2) { break; } - case 169: case 171: - case 172: case 173: - case 256: + case 174: + case 175: + case 259: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 213: + case 215: if (meaning & 3 && name === "arguments") { result = argumentsSymbol; break loop; @@ -41335,23 +41850,23 @@ var ts; } } break; - case 165: - if (location.parent && location.parent.kind === 164) { + case 167: + if (location.parent && location.parent.kind === 166) { location = location.parent; } - if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 257)) { + if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 260)) { location = location.parent; } break; - case 345: - case 338: - case 339: + case 348: + case 341: + case 342: var root = ts.getJSDocRoot(location); if (root) { location = root.parent; } break; - case 164: + case 166: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (!associatedDeclarationForContainingInitializerOrBindingName) { @@ -41359,7 +41874,7 @@ var ts; } } break; - case 203: + case 205: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (ts.isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) { @@ -41367,7 +41882,7 @@ var ts; } } break; - case 190: + case 192: if (meaning & 262144) { var parameterName = location.typeParameter.name; if (parameterName && name === parameterName.escapedText) { @@ -41390,7 +41905,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 305); + ts.Debug.assert(lastLocation.kind === 308); if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) { return lastLocation.symbol; } @@ -41424,8 +41939,8 @@ var ts; !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && + !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && - !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) { var suggestion = void 0; var suggestedLib = void 0; @@ -41463,7 +41978,7 @@ var ts; } return undefined; } - else if (checkAndReportErrorForInvalidInitializer()) { + else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) { return undefined; } if (nameNotFoundMessage) { @@ -41493,9 +42008,9 @@ var ts; } } if (result && errorLocation && meaning & 111551 && result.flags & 2097152 && !(result.flags & 111551) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) { - var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result); + var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551); if (typeOnlyDeclaration) { - var message = typeOnlyDeclaration.kind === 275 + var message = typeOnlyDeclaration.kind === 278 ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; var unescapedName = ts.unescapeLeadingUnderscores(name); @@ -41509,29 +42024,29 @@ var ts; function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) { if (!typeOnlyDeclaration) return diagnostic; - return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 275 ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); + return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 278 ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); } function getIsDeferredContext(location, lastLocation) { - if (location.kind !== 214 && location.kind !== 213) { + if (location.kind !== 216 && location.kind !== 215) { return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) || - (location.kind === 167 && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); + (location.kind === 169 && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); } if (lastLocation && lastLocation === location.name) { return false; } - if (location.asteriskToken || ts.hasSyntacticModifier(location, 256)) { + if (location.asteriskToken || ts.hasSyntacticModifier(location, 512)) { return true; } return !ts.getImmediatelyInvokedFunctionExpression(location); } function isSelfReferenceLocation(node) { switch (node.kind) { - case 256: - case 257: - case 258: - case 260: case 259: + case 260: case 261: + case 263: + case 262: + case 264: return true; default: return false; @@ -41544,7 +42059,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - if (decl.kind === 163) { + if (decl.kind === 165) { var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent; if (parent === container) { return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); @@ -41594,9 +42109,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 79: - case 206: + case 208: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 228: + case 230: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -41639,14 +42154,14 @@ var ts; return name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never" || name === "unknown"; } function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) { - if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 275) { + if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 278) { error(errorLocation, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name); return true; } return false; } function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) { - if (meaning & (111551 & ~1024)) { + if (meaning & 111551) { if (isPrimitiveTypeName(name)) { if (isExtendedByInterface(errorLocation)) { error(errorLocation, ts.Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, ts.unescapeLeadingUnderscores(name)); @@ -41657,7 +42172,8 @@ var ts; return true; } var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 & ~111551, undefined, undefined, false)); - if (symbol && !(symbol.flags & 1024)) { + var allFlags = symbol && getAllSymbolFlags(symbol); + if (symbol && allFlags !== undefined && !(allFlags & 111551)) { var rawName = ts.unescapeLeadingUnderscores(name); if (isES2015OrLaterConstructorName(name)) { error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later, rawName); @@ -41705,16 +42221,16 @@ var ts; } return false; } - function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) { - if (meaning & (111551 & ~1024 & ~788968)) { - var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 & ~111551, undefined, undefined, false)); + function checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) { + if (meaning & (111551 & ~788968)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1024, undefined, undefined, false)); if (symbol) { error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name)); return true; } } - else if (meaning & (788968 & ~1024 & ~111551)) { - var symbol = resolveSymbol(resolveName(errorLocation, name, (512 | 1024) & ~788968, undefined, undefined, false)); + else if (meaning & (788968 & ~111551)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1536, undefined, undefined, false)); if (symbol) { error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name)); return true; @@ -41728,7 +42244,7 @@ var ts; if (result.flags & (16 | 1 | 67108864) && result.flags & 32) { return; } - var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 260); }); + var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 263); }); if (declaration === undefined) return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration"); if (!(declaration.flags & 16777216) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { @@ -41760,13 +42276,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 265: + case 268: return node; - case 267: + case 270: return node.parent; - case 268: + case 271: return node.parent.parent; - case 270: + case 273: return node.parent.parent.parent; default: return undefined; @@ -41776,24 +42292,24 @@ var ts; return symbol.declarations && ts.findLast(symbol.declarations, isAliasSymbolDeclaration); } function isAliasSymbolDeclaration(node) { - return node.kind === 265 - || node.kind === 264 - || node.kind === 267 && !!node.name - || node.kind === 268 - || node.kind === 274 - || node.kind === 270 - || node.kind === 275 - || node.kind === 271 && ts.exportAssignmentIsAlias(node) + return node.kind === 268 + || node.kind === 267 + || node.kind === 270 && !!node.name + || node.kind === 271 + || node.kind === 277 + || node.kind === 273 + || node.kind === 278 + || node.kind === 274 && ts.exportAssignmentIsAlias(node) || ts.isBinaryExpression(node) && ts.getAssignmentDeclarationKind(node) === 2 && ts.exportAssignmentIsAlias(node) || ts.isAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 && isAliasableOrJsExpression(node.parent.right) - || node.kind === 297 - || node.kind === 296 && isAliasableOrJsExpression(node.initializer) - || node.kind === 254 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) - || node.kind === 203 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); + || node.kind === 300 + || node.kind === 299 && isAliasableOrJsExpression(node.initializer) + || node.kind === 257 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) + || node.kind === 205 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } function isAliasableOrJsExpression(e) { return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e); @@ -41806,7 +42322,7 @@ var ts; ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : undefined; } - if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 277) { + if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 280) { var immediate = resolveExternalModuleName(node, ts.getExternalModuleRequireArgument(node) || ts.getExternalModuleImportEqualsDeclarationExpression(node)); var resolved_4 = resolveExternalModuleSymbol(immediate); markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved_4, false); @@ -41819,7 +42335,7 @@ var ts; function checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved) { if (markSymbolOfAliasDeclarationIfTypeOnly(node, undefined, resolved, false) && !node.isTypeOnly) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfNode(node)); - var isExport = typeOnlyDeclaration.kind === 275; + var isExport = typeOnlyDeclaration.kind === 278; var message = isExport ? ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type; @@ -41838,7 +42354,7 @@ var ts; return resolved; } function isSyntacticDefault(node) { - return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 512) || ts.isExportSpecifier(node)); + return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 1024) || ts.isExportSpecifier(node)); } function getUsageModeForExpression(usage) { return ts.isStringLiteralLike(usage) ? ts.getModeForUsageLocation(ts.getSourceFileOfNode(usage), usage) : undefined; @@ -41925,11 +42441,11 @@ var ts; } function getModuleSpecifierForImportOrExport(node) { switch (node.kind) { - case 267: return node.parent.moduleSpecifier; - case 265: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; - case 268: return node.parent.parent.moduleSpecifier; - case 270: return node.parent.parent.parent.moduleSpecifier; - case 275: return node.parent.parent.moduleSpecifier; + case 270: return node.parent.moduleSpecifier; + case 268: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; + case 271: return node.parent.parent.moduleSpecifier; + case 273: return node.parent.parent.parent.moduleSpecifier; + case 278: return node.parent.parent.moduleSpecifier; default: return ts.Debug.assertNever(node); } } @@ -42178,31 +42694,31 @@ var ts; function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; } switch (node.kind) { - case 265: - case 254: + case 268: + case 257: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 267: + case 270: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 268: + case 271: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 274: + case 277: return getTargetOfNamespaceExport(node, dontRecursivelyResolve); - case 270: - case 203: + case 273: + case 205: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 275: + case 278: return getTargetOfExportSpecifier(node, 111551 | 788968 | 1920, dontRecursivelyResolve); - case 271: - case 221: + case 274: + case 223: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 264: + case 267: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); - case 297: + case 300: return resolveEntityName(node.name, 111551 | 788968 | 1920, true, dontRecursivelyResolve); - case 296: + case 299: return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve); - case 207: - case 206: + case 209: + case 208: return getTargetOfAccessExpression(node, dontRecursivelyResolve); default: return ts.Debug.fail(); @@ -42245,6 +42761,30 @@ var ts; } return undefined; } + function getAllSymbolFlags(symbol) { + var flags = symbol.flags; + var seenSymbols; + while (symbol.flags & 2097152) { + var target = resolveAlias(symbol); + if (target === unknownSymbol) { + return 67108863; + } + if (target === symbol || (seenSymbols === null || seenSymbols === void 0 ? void 0 : seenSymbols.has(target))) { + break; + } + if (target.flags & 2097152) { + if (seenSymbols) { + seenSymbols.add(target); + } + else { + seenSymbols = new ts.Set([symbol, target]); + } + } + flags |= target.flags; + symbol = target; + } + return flags; + } function markSymbolOfAliasDeclarationIfTypeOnly(aliasDeclaration, immediateTarget, finalTarget, overwriteEmpty) { if (!aliasDeclaration || ts.isPropertyAccessExpression(aliasDeclaration)) return false; @@ -42267,19 +42807,25 @@ var ts; } return !!aliasDeclarationLinks.typeOnlyDeclaration; } - function getTypeOnlyAliasDeclaration(symbol) { + function getTypeOnlyAliasDeclaration(symbol, include) { if (!(symbol.flags & 2097152)) { return undefined; } var links = getSymbolLinks(symbol); - return links.typeOnlyDeclaration || undefined; + if (include === undefined) { + return links.typeOnlyDeclaration || undefined; + } + if (links.typeOnlyDeclaration) { + return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : undefined; + } + return undefined; } function markExportAsReferenced(node) { var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target) { var markAlias = target === unknownSymbol || - ((target.flags & 111551) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol)); + ((getAllSymbolFlags(target) & 111551) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol, 111551)); if (markAlias) { markAliasSymbolAsReferenced(symbol); } @@ -42293,8 +42839,7 @@ var ts; if (!node) return ts.Debug.fail(); if (ts.isInternalModuleImportEqualsDeclaration(node)) { - var target = resolveSymbol(symbol); - if (target === unknownSymbol || target.flags & 111551) { + if (getAllSymbolFlags(resolveSymbol(symbol)) & 111551) { checkExpressionCached(node.moduleReference); } } @@ -42310,16 +42855,16 @@ var ts; if (entityName.kind === 79 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) { entityName = entityName.parent; } - if (entityName.kind === 79 || entityName.parent.kind === 161) { + if (entityName.kind === 79 || entityName.parent.kind === 163) { return resolveEntityName(entityName, 1920, false, dontResolveAlias); } else { - ts.Debug.assert(entityName.parent.kind === 265); + ts.Debug.assert(entityName.parent.kind === 268); return resolveEntityName(entityName, 111551 | 788968 | 1920, false, dontResolveAlias); } } function getFullyQualifiedName(symbol, containingLocation) { - return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, undefined, 16 | 4); + return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, undefined, 32 | 4); } function getContainingQualifiedNameNode(node) { while (ts.isQualifiedName(node.parent)) { @@ -42357,9 +42902,9 @@ var ts; return getMergedSymbol(symbolFromJSPrototype); } } - else if (name.kind === 161 || name.kind === 206) { - var left = name.kind === 161 ? name.left : name.expression; - var right = name.kind === 161 ? name.right : name.name; + else if (name.kind === 163 || name.kind === 208) { + var left = name.kind === 163 ? name.left : name.expression; + var right = name.kind === 163 ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -42417,7 +42962,7 @@ var ts; throw ts.Debug.assertNever(name, "Unknown entity name kind."); } ts.Debug.assert((ts.getCheckFlags(symbol) & 1) === 0, "Should never get an instantiated symbol here."); - if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 || name.parent.kind === 271)) { + if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 || name.parent.kind === 274)) { markSymbolOfAliasDeclarationIfTypeOnly(ts.getAliasDeclarationFromName(name), symbol, undefined, true); } return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); @@ -42697,7 +43242,7 @@ var ts; var _a; var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { - if (!suppressInteropError && !(symbol.flags & (1536 | 3)) && !ts.getDeclarationOfKind(symbol, 305)) { + if (!suppressInteropError && !(symbol.flags & (1536 | 3)) && !ts.getDeclarationOfKind(symbol, 308)) { var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop"; @@ -43024,13 +43569,13 @@ var ts; } function symbolIsValue(symbol, includeTypeOnlyMembers) { return !!(symbol.flags & 111551 || - symbol.flags & 2097152 && resolveAlias(symbol).flags & 111551 && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol))); + symbol.flags & 2097152 && getAllSymbolFlags(symbol) & 111551 && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol))); } function findConstructorDeclaration(node) { var members = node.members; for (var _i = 0, members_3 = members; _i < members_3.length; _i++) { var member = members_3[_i]; - if (member.kind === 171 && ts.nodeIsPresent(member.body)) { + if (member.kind === 173 && ts.nodeIsPresent(member.body)) { return member; } } @@ -43132,19 +43677,19 @@ var ts; } } switch (location.kind) { - case 305: + case 308: if (!ts.isExternalOrCommonJsModule(location)) { break; } - case 261: + case 264: var sym = getSymbolOfNode(location); if (result = callback((sym === null || sym === void 0 ? void 0 : sym.exports) || emptySymbols, undefined, true, location)) { return { value: result }; } break; - case 257: - case 226: - case 258: + case 260: + case 228: + case 261: var table_1; (getSymbolOfNode(location).members || emptySymbols).forEach(function (memberSymbol, key) { if (memberSymbol.flags & (788968 & ~67108864)) { @@ -43215,7 +43760,7 @@ var ts; && !(ts.isUMDExportSymbol(symbolFromSymbolTable) && enclosingDeclaration && ts.isExternalModule(ts.getSourceFileOfNode(enclosingDeclaration))) && (!useOnlyExternalAliasing || ts.some(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration)) && (isLocalNameLookup ? !ts.some(symbolFromSymbolTable.declarations, ts.isNamespaceReexportDeclaration) : true) - && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 275))) { + && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 278))) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); var candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification); if (candidate) { @@ -43251,8 +43796,10 @@ var ts; if (symbolFromSymbolTable === symbol) { return true; } - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 275)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; - if (symbolFromSymbolTable.flags & meaning) { + var shouldResolveAlias = (symbolFromSymbolTable.flags & 2097152 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278)); + symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + var flags = shouldResolveAlias ? getAllSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags; + if (flags & meaning) { qualify = true; return true; } @@ -43265,10 +43812,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 167: case 169: - case 172: - case 173: + case 171: + case 174: + case 175: continue; default: return false; @@ -43368,10 +43915,10 @@ var ts; return node && getSymbolOfNode(node); } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 305 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 308 && ts.isExternalOrCommonJsModule(declaration)); } function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { - return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 305 && ts.isExternalOrCommonJsModule(declaration)); + return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 308 && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -43432,13 +43979,13 @@ var ts; } function isEntityNameVisible(entityName, enclosingDeclaration) { var meaning; - if (entityName.parent.kind === 181 || - entityName.parent.kind === 228 && !ts.isPartOfTypeNode(entityName.parent) || - entityName.parent.kind === 162) { + if (entityName.parent.kind === 183 || + entityName.parent.kind === 230 && !ts.isPartOfTypeNode(entityName.parent) || + entityName.parent.kind === 164) { meaning = 111551 | 1048576; } - else if (entityName.kind === 161 || entityName.kind === 206 || - entityName.parent.kind === 265) { + else if (entityName.kind === 163 || entityName.kind === 208 || + entityName.parent.kind === 268) { meaning = 1920; } else { @@ -43470,14 +44017,17 @@ var ts; if (flags & 8) { nodeFlags |= 16384; } - if (flags & 16) { + if (flags & 32) { nodeFlags |= 134217728; } - var builder = flags & 4 ? nodeBuilder.symbolToExpression : nodeBuilder.symbolToEntityName; + if (flags & 16) { + nodeFlags |= 1073741824; + } + var builder = flags & 4 ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName; return writer ? symbolToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(symbolToStringWorker); function symbolToStringWorker(writer) { var entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags); - var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 305 ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); + var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 308 ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); printer.writeNode(4, entity, sourceFile, writer); return writer; @@ -43489,10 +44039,10 @@ var ts; function signatureToStringWorker(writer) { var sigOutput; if (flags & 262144) { - sigOutput = kind === 1 ? 180 : 179; + sigOutput = kind === 1 ? 182 : 181; } else { - sigOutput = kind === 1 ? 175 : 174; + sigOutput = kind === 1 ? 177 : 176; } var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 | 512); var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true }); @@ -43570,7 +44120,25 @@ var ts; symbolTableToDeclarationStatements: function (symbolTable, enclosingDeclaration, flags, tracker, bundled) { return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolTableToDeclarationStatements(symbolTable, context, bundled); }); }, + symbolToNode: function (symbol, meaning, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolToNode(symbol, context, meaning); }); + }, }; + function symbolToNode(symbol, context, meaning) { + if (context.flags & 1073741824) { + if (symbol.valueDeclaration) { + var name = ts.getNameOfDeclaration(symbol.valueDeclaration); + if (name && ts.isComputedPropertyName(name)) + return name; + } + var nameType = getSymbolLinks(symbol).nameType; + if (nameType && nameType.flags & (1024 | 8192)) { + context.enclosingDeclaration = nameType.symbol.valueDeclaration; + return ts.factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning)); + } + } + return symbolToExpression(symbol, context, meaning); + } function withContext(enclosingDeclaration, flags, tracker, cb) { var _a, _b; ts.Debug.assert(enclosingDeclaration === undefined || (enclosingDeclaration.flags & 8) === 0); @@ -43654,7 +44222,7 @@ var ts; return undefined; } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(130); + return ts.factory.createKeywordTypeNode(131); } if (!(context.flags & 536870912)) { type = getReducedType(type); @@ -43664,29 +44232,29 @@ var ts; return ts.factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context)); } if (type === unresolvedType) { - return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(130), 3, "unresolved"); + return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(131), 3, "unresolved"); } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 138 : 130); + return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 139 : 131); } if (type.flags & 2) { - return ts.factory.createKeywordTypeNode(155); + return ts.factory.createKeywordTypeNode(157); } if (type.flags & 4) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(150); + return ts.factory.createKeywordTypeNode(152); } if (type.flags & 8) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(147); + return ts.factory.createKeywordTypeNode(148); } if (type.flags & 64) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(158); + return ts.factory.createKeywordTypeNode(160); } if (type.flags & 16 && !type.aliasSymbol) { context.approximateLength += 7; - return ts.factory.createKeywordTypeNode(133); + return ts.factory.createKeywordTypeNode(134); } if (type.flags & 1024 && !(type.flags & 1048576)) { var parentSymbol = getParentOfSymbol(type.symbol); @@ -43740,7 +44308,7 @@ var ts; } } context.approximateLength += 13; - return ts.factory.createTypeOperatorNode(154, ts.factory.createKeywordTypeNode(151)); + return ts.factory.createTypeOperatorNode(156, ts.factory.createKeywordTypeNode(153)); } if (type.flags & 16384) { context.approximateLength += 4; @@ -43748,7 +44316,7 @@ var ts; } if (type.flags & 32768) { context.approximateLength += 9; - return ts.factory.createKeywordTypeNode(153); + return ts.factory.createKeywordTypeNode(155); } if (type.flags & 65536) { context.approximateLength += 4; @@ -43756,15 +44324,15 @@ var ts; } if (type.flags & 131072) { context.approximateLength += 5; - return ts.factory.createKeywordTypeNode(143); + return ts.factory.createKeywordTypeNode(144); } if (type.flags & 4096) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(151); + return ts.factory.createKeywordTypeNode(153); } if (type.flags & 67108864) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(148); + return ts.factory.createKeywordTypeNode(149); } if (ts.isThisTypeParameter(type)) { if (context.flags & 4194304) { @@ -43847,7 +44415,7 @@ var ts; var indexedType = type.type; context.approximateLength += 6; var indexTypeNode = typeToTypeNodeHelper(indexedType, context); - return ts.factory.createTypeOperatorNode(140, indexTypeNode); + return ts.factory.createTypeOperatorNode(141, indexTypeNode); } if (type.flags & 134217728) { var texts_1 = type.texts; @@ -43889,7 +44457,7 @@ var ts; context.inferTypeParameters = saveInferTypeParameters_1; var trueTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.trueType), newMapper)); var falseTypeNode_1 = typeToTypeNodeOrCircularityElision(instantiateType(getTypeFromTypeNode(type.root.node.falseType), newMapper)); - return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143)), ts.factory.createKeywordTypeNode(143)); + return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(144)), ts.factory.createKeywordTypeNode(144)); } var saveInferTypeParameters = context.inferTypeParameters; context.inferTypeParameters = type.root.inferTypeParameters; @@ -43929,7 +44497,7 @@ var ts; var name = typeParameterToName(newParam, context); newTypeVariable = ts.factory.createTypeReferenceNode(name); } - appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); + appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(141, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); } else { appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context); @@ -43942,7 +44510,7 @@ var ts; var result = ts.setEmitFlags(mappedTypeNode, 1); if (isHomomorphicMappedTypeWithNonHomomorphicInstantiation(type) && context.flags & 4) { var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper); - return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(143)); + return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(144)); } return result; } @@ -43985,7 +44553,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16) && (symbol.parent || ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 305 || declaration.parent.kind === 262; + return declaration.parent.kind === 308 || declaration.parent.kind === 265; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { return (!!(context.flags & 4096) || ((_a = context.visitedTypes) === null || _a === void 0 ? void 0 : _a.has(typeId))) && @@ -44069,12 +44637,12 @@ var ts; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { var signature = resolved.callSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 179, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 181, context); return signatureNode; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { var signature = resolved.constructSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 180, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 182, context); return signatureNode; } } @@ -44110,7 +44678,7 @@ var ts; } var elementType = typeToTypeNodeHelper(typeArguments[0], context); var arrayType = ts.factory.createArrayTypeNode(elementType); - return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(145, arrayType); + return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(146, arrayType); } else if (type.target.objectFlags & 8) { typeArguments = ts.sameMap(typeArguments, function (t, i) { return removeMissingType(t, !!(type.target.elementFlags[i] & 2)); }); @@ -44135,12 +44703,12 @@ var ts; } } var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode(tupleConstituentNodes), 1); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146, tupleTypeNode) : tupleTypeNode; } } if (context.encounteredError || (context.flags & 524288)) { var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode([]), 1); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146, tupleTypeNode) : tupleTypeNode; } context.encounteredError = true; return undefined; @@ -44240,13 +44808,13 @@ var ts; var typeElements = []; for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 174, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 176, context)); } for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; if (signature.flags & 4) continue; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 175, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 177, context)); } for (var _d = 0, _e = resolvedType.indexInfos; _d < _e.length; _d++) { var info = _e[_d]; @@ -44283,7 +44851,7 @@ var ts; if (!(context.flags & 1)) { return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier("..."), undefined); } - return ts.factory.createKeywordTypeNode(130); + return ts.factory.createKeywordTypeNode(131); } function shouldUsePlaceholderForProperty(propertySymbol, context) { var _a; @@ -44327,7 +44895,7 @@ var ts; var signatures = getSignaturesOfType(filterType(propertyType, function (t) { return !(t.flags & 32768); }), 0); for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) { var signature = signatures_1[_i]; - var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 168, context, { name: propertyName, questionToken: optionalToken }); + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 170, context, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration)); } } @@ -44341,12 +44909,12 @@ var ts; context.reverseMappedStack || (context.reverseMappedStack = []); context.reverseMappedStack.push(propertySymbol); } - propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(130); + propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(131); if (propertyIsReverseMapped) { context.reverseMappedStack.pop(); } } - var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(145)] : undefined; + var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(146)] : undefined; if (modifiers) { context.approximateLength += 9; } @@ -44355,8 +44923,8 @@ var ts; } function preserveCommentsOn(node) { var _a; - if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 347; })) { - var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 347; }); + if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 350; })) { + var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 350; }); var commentText = ts.getTextOfJSDocComment(d.comment); if (commentText) { ts.setSyntheticLeadingComments(node, [{ kind: 3, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); @@ -44442,7 +45010,7 @@ var ts; context.encounteredError = true; } context.approximateLength += (name.length + 4); - return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(145)] : undefined, [indexingParameter], typeNode); + return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(146)] : undefined, [indexingParameter], typeNode); } function signatureToSignatureDeclarationHelper(signature, kind, context, options) { var _a, _b, _c, _d; @@ -44459,7 +45027,7 @@ var ts; typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); }); } var expandedParams = getExpandedParameters(signature, true)[0]; - var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); + var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 173, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); var thisParameter = context.flags & 33554432 ? undefined : tryGetThisParameterDeclaration(signature, context); if (thisParameter) { parameters.unshift(thisParameter); @@ -44468,7 +45036,7 @@ var ts; var typePredicate = getTypePredicateOfSignature(signature); if (typePredicate) { var assertsModifier = typePredicate.kind === 2 || typePredicate.kind === 3 ? - ts.factory.createToken(128) : + ts.factory.createToken(129) : undefined; var parameterName = typePredicate.kind === 1 || typePredicate.kind === 3 ? ts.setEmitFlags(ts.factory.createIdentifier(typePredicate.parameterName), 16777216) : @@ -44482,28 +45050,28 @@ var ts; returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); } else if (!suppressAny) { - returnTypeNode = ts.factory.createKeywordTypeNode(130); + returnTypeNode = ts.factory.createKeywordTypeNode(131); } } var modifiers = options === null || options === void 0 ? void 0 : options.modifiers; - if ((kind === 180) && signature.flags & 4) { + if ((kind === 182) && signature.flags & 4) { var flags = ts.modifiersToFlags(modifiers); - modifiers = ts.factory.createModifiersFromModifierFlags(flags | 128); - } - var node = kind === 174 ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : - kind === 175 ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : - kind === 168 ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : - kind === 169 ? ts.factory.createMethodDeclaration(modifiers, undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), undefined, typeParameters, parameters, returnTypeNode, undefined) : - kind === 171 ? ts.factory.createConstructorDeclaration(modifiers, parameters, undefined) : - kind === 172 ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, undefined) : - kind === 173 ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, undefined) : - kind === 176 ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : - kind === 317 ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : - kind === 179 ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 180 ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 256 ? ts.factory.createFunctionDeclaration(modifiers, undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, undefined) : - kind === 213 ? ts.factory.createFunctionExpression(modifiers, undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : - kind === 214 ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, undefined, ts.factory.createBlock([])) : + modifiers = ts.factory.createModifiersFromModifierFlags(flags | 256); + } + var node = kind === 176 ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : + kind === 177 ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : + kind === 170 ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : + kind === 171 ? ts.factory.createMethodDeclaration(modifiers, undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), undefined, typeParameters, parameters, returnTypeNode, undefined) : + kind === 173 ? ts.factory.createConstructorDeclaration(modifiers, parameters, undefined) : + kind === 174 ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, undefined) : + kind === 175 ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, undefined) : + kind === 178 ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : + kind === 320 ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : + kind === 181 ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 182 ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 259 ? ts.factory.createFunctionDeclaration(modifiers, undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, undefined) : + kind === 215 ? ts.factory.createFunctionExpression(modifiers, undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : + kind === 216 ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, undefined, ts.factory.createBlock([])) : ts.Debug.assertNever(kind); if (typeArguments) { node.typeArguments = ts.factory.createNodeArray(typeArguments); @@ -44537,9 +45105,9 @@ var ts; return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) { - var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 164); + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 166); if (!parameterDeclaration && !ts.isTransientSymbol(parameterSymbol)) { - parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 340); + parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 343); } var parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -44551,7 +45119,7 @@ var ts; var dotDotDotToken = isRest ? ts.factory.createToken(25) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 79 ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name), 16777216) : - parameterDeclaration.name.kind === 161 ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216) : + parameterDeclaration.name.kind === 163 ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216) : cloneBindingName(parameterDeclaration.name) : ts.symbolName(parameterSymbol) : ts.symbolName(parameterSymbol); @@ -44697,11 +45265,11 @@ var ts; } function getSpecifierForModuleSymbol(symbol, context, overrideImportMode) { var _a; - var file = ts.getDeclarationOfKind(symbol, 305); + var file = ts.getDeclarationOfKind(symbol, 308); if (!file) { var equivalentFileSymbol = ts.firstDefined(symbol.declarations, function (d) { return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); }); if (equivalentFileSymbol) { - file = ts.getDeclarationOfKind(equivalentFileSymbol, 305); + file = ts.getDeclarationOfKind(equivalentFileSymbol, 308); } } if (file && file.moduleName !== undefined) { @@ -45135,17 +45703,17 @@ var ts; } return transformed === existing ? ts.setTextRange(ts.factory.cloneNode(existing), existing) : transformed; function visitExistingNodeTreeSymbols(node) { - if (ts.isJSDocAllType(node) || node.kind === 319) { - return ts.factory.createKeywordTypeNode(130); + if (ts.isJSDocAllType(node) || node.kind === 322) { + return ts.factory.createKeywordTypeNode(131); } if (ts.isJSDocUnknownType(node)) { - return ts.factory.createKeywordTypeNode(155); + return ts.factory.createKeywordTypeNode(157); } if (ts.isJSDocNullableType(node)) { return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createLiteralTypeNode(ts.factory.createNull())]); } if (ts.isJSDocOptionalType(node)) { - return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(153)]); + return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(155)]); } if (ts.isJSDocNonNullableType(node)) { return ts.visitNode(node.type, visitExistingNodeTreeSymbols); @@ -45158,11 +45726,11 @@ var ts; var name = ts.isIdentifier(t.name) ? t.name : t.name.right; var typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText); var overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : undefined; - return ts.factory.createPropertySignature(undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(130)); + return ts.factory.createPropertySignature(undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(131)); })); } if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "") { - return ts.setOriginalNode(ts.factory.createKeywordTypeNode(130), node); + return ts.setOriginalNode(ts.factory.createKeywordTypeNode(131), node); } if ((ts.isExpressionWithTypeArguments(node) || ts.isTypeReferenceNode(node)) && ts.isJSDocIndexSignature(node)) { return ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature(undefined, [ts.factory.createParameterDeclaration(undefined, undefined, "x", undefined, ts.visitNode(node.typeArguments[0], visitExistingNodeTreeSymbols))], ts.visitNode(node.typeArguments[1], visitExistingNodeTreeSymbols))]); @@ -45170,10 +45738,10 @@ var ts; if (ts.isJSDocFunctionType(node)) { if (ts.isJSDocConstructSignature(node)) { var newTypeNode_1; - return ts.factory.createConstructorTypeNode(undefined, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration(undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130)); + return ts.factory.createConstructorTypeNode(undefined, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration(undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131)); } else { - return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration(undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130)); + return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration(undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131)); } } if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(node, 788968, true))) { @@ -45237,8 +45805,8 @@ var ts; } } function symbolTableToDeclarationStatements(symbolTable, context, bundled) { - var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 169, true); - var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 168, false); + var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 171, true); + var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 170, false); var enclosingDeclaration = context.enclosingDeclaration; var results = []; var visitedSymbols = new ts.Set(); @@ -45337,7 +45905,7 @@ var ts; if (!e.propertyName) { var indices = ts.indicesOf(statements); var associatedIndices = ts.filter(indices, function (i) { return ts.nodeHasName(statements[i], e.name); }); - if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return canHaveExportModifier(statements[i]); })) { + if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return ts.canHaveExportModifier(statements[i]); })) { for (var _i = 0, associatedIndices_1 = associatedIndices; _i < associatedIndices_1.length; _i++) { var index_1 = associatedIndices_1[_i]; statements[index_1] = addExportModifier(statements[index_1]); @@ -45367,15 +45935,6 @@ var ts; } return statements; } - function canHaveExportModifier(node) { - return ts.isEnumDeclaration(node) || - ts.isVariableStatement(node) || - ts.isFunctionDeclaration(node) || - ts.isClassDeclaration(node) || - (ts.isModuleDeclaration(node) && !ts.isExternalModuleAugmentation(node) && !ts.isGlobalScopeAugmentation(node)) || - ts.isInterfaceDeclaration(node) || - isTypeDeclaration(node); - } function addExportModifier(node) { var flags = (ts.getEffectiveModifierFlags(node) | 1) & ~2; return ts.factory.updateModifiers(node, flags); @@ -45429,7 +45988,7 @@ var ts; if (needsPostExportDefault || needsExportDeclaration) { isPrivate = true; } - var modifierFlags = (!isPrivate ? 1 : 0) | (isDefault && !needsPostExportDefault ? 512 : 0); + var modifierFlags = (!isPrivate ? 1 : 0) | (isDefault && !needsPostExportDefault ? 1024 : 0); var isConstMergedWithNS = symbol.flags & 1536 && symbol.flags & (2 | 1 | 4) && symbol.escapedName !== "export="; @@ -45444,6 +46003,7 @@ var ts; && symbol.escapedName !== "export=" && !(symbol.flags & 4194304) && !(symbol.flags & 32) + && !(symbol.flags & 8192) && !isConstMergedWithNSPrintableAsSignatureMerge) { if (propertyAsAlias) { var createdExport = serializeMaybeAliasAssignment(symbol); @@ -45559,7 +46119,7 @@ var ts; (ts.isJSDocTypeAlias(context.enclosingDeclaration) ? ts.getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration); if (additionalModifierFlags & 1 && enclosingDeclaration_1 && (isExportingScope(enclosingDeclaration_1) || ts.isModuleDeclaration(enclosingDeclaration_1)) && - canHaveExportModifier(node)) { + ts.canHaveExportModifier(node)) { newModifierFlags |= 1; } if (addingDeclare && !(newModifierFlags & 1) && @@ -45567,8 +46127,8 @@ var ts; (ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) || ts.isModuleDeclaration(node))) { newModifierFlags |= 2; } - if ((additionalModifierFlags & 512) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { - newModifierFlags |= 512; + if ((additionalModifierFlags & 1024) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { + newModifierFlags |= 1024; } if (newModifierFlags) { node = ts.factory.updateModifiers(node, newModifierFlags | ts.getEffectiveModifierFlags(node)); @@ -45602,8 +46162,8 @@ var ts; var baseTypes = getBaseTypes(interfaceType); var baseType = ts.length(baseTypes) ? getIntersectionType(baseTypes) : undefined; var members = ts.flatMap(getPropertiesOfType(interfaceType), function (p) { return serializePropertySymbolForInterface(p, baseType); }); - var callSignatures = serializeSignatures(0, interfaceType, baseType, 174); - var constructSignatures = serializeSignatures(1, interfaceType, baseType, 175); + var callSignatures = serializeSignatures(0, interfaceType, baseType, 176); + var constructSignatures = serializeSignatures(1, interfaceType, baseType, 177); var indexSignatures = serializeIndexSignatures(interfaceType, baseType); var heritageClauses = !ts.length(baseTypes) ? undefined : [ts.factory.createHeritageClause(94, ts.mapDefined(baseTypes, function (b) { return trySerializeAsTypeReference(b, 111551); }))]; addResult(ts.factory.createInterfaceDeclaration(undefined, getInternalSymbolName(symbol, symbolName), typeParamDecls, heritageClauses, __spreadArray(__spreadArray(__spreadArray(__spreadArray([], indexSignatures, true), constructSignatures, true), callSignatures, true), members, true)), modifierFlags); @@ -45612,7 +46172,7 @@ var ts; return !symbol.exports ? [] : ts.filter(ts.arrayFrom(symbol.exports.values()), isNamespaceMember); } function isTypeOnlyNamespace(symbol) { - return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m).flags & 111551); }); + return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(getAllSymbolFlags(resolveSymbol(m)) & 111551); }); } function serializeModule(symbol, symbolName, modifierFlags) { var members = getNamespaceMembersForSerialization(symbol); @@ -45655,7 +46215,7 @@ var ts; var signatures = getSignaturesOfType(type, 0); for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var sig = signatures_2[_i]; - var decl = signatureToSignatureDeclarationHelper(sig, 256, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); + var decl = signatureToSignatureDeclarationHelper(sig, 259, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); addResult(ts.setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags); } if (!(symbol.flags & (512 | 1024) && !!symbol.exports && !!symbol.exports.size)) { @@ -45776,7 +46336,7 @@ var ts; !ts.some(getSignaturesOfType(staticType, 1)); var constructors = isNonConstructableClassLikeInJsFile ? [ts.factory.createConstructorDeclaration(ts.factory.createModifiersFromModifierFlags(8), [], undefined)] : - serializeSignatures(1, staticType, staticBaseType, 171); + serializeSignatures(1, staticType, staticBaseType, 173); var indexSignatures = serializeIndexSignatures(classType, baseTypes[0]); context.enclosingDeclaration = oldEnclosing; addResult(ts.setTextRange(ts.factory.createClassDeclaration(undefined, localName, typeParamDecls, heritageClauses, __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], indexSignatures, true), staticMembers, true), constructors, true), publicProperties, true), privateProperties, true)), symbol.declarations && ts.filter(symbol.declarations, function (d) { return ts.isClassDeclaration(d) || ts.isClassExpression(d); })[0]), modifierFlags); @@ -45817,8 +46377,8 @@ var ts; var targetName = getInternalSymbolName(target, verbatimTargetName); includePrivateSymbol(target); switch (node.kind) { - case 203: - if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 254) { + case 205: + if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 257) { var specifier_1 = getSpecifierForModuleSymbol(target.parent || target, context); var propertyName = node.propertyName; addResult(ts.factory.createImportDeclaration(undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports([ts.factory.createImportSpecifier(false, propertyName && ts.isIdentifier(propertyName) ? ts.factory.createIdentifier(ts.idText(propertyName)) : undefined, ts.factory.createIdentifier(localName))])), ts.factory.createStringLiteral(specifier_1), undefined), 0); @@ -45826,12 +46386,12 @@ var ts; } ts.Debug.failBadSyntaxKind(((_c = node.parent) === null || _c === void 0 ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization"); break; - case 297: - if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 221) { + case 300: + if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 223) { serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), targetName); } break; - case 254: + case 257: if (ts.isPropertyAccessExpression(node.initializer)) { var initializer = node.initializer; var uniqueName = ts.factory.createUniqueName(localName); @@ -45840,7 +46400,7 @@ var ts; addResult(ts.factory.createImportEqualsDeclaration(undefined, false, ts.factory.createIdentifier(localName), ts.factory.createQualifiedName(uniqueName, initializer.name)), modifierFlags); break; } - case 265: + case 268: if (target.escapedName === "export=" && ts.some(target.declarations, ts.isJsonSourceFile)) { serializeMaybeAliasAssignment(symbol); break; @@ -45850,33 +46410,33 @@ var ts; ? symbolToName(target, context, 67108863, false) : ts.factory.createExternalModuleReference(ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))), isLocalImport ? modifierFlags : 0); break; - case 264: + case 267: addResult(ts.factory.createNamespaceExportDeclaration(ts.idText(node.name)), 0); break; - case 267: + case 270: addResult(ts.factory.createImportDeclaration(undefined, ts.factory.createImportClause(false, ts.factory.createIdentifier(localName), undefined), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), undefined), 0); break; - case 268: + case 271: addResult(ts.factory.createImportDeclaration(undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamespaceImport(ts.factory.createIdentifier(localName))), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)), undefined), 0); break; - case 274: + case 277: addResult(ts.factory.createExportDeclaration(undefined, false, ts.factory.createNamespaceExport(ts.factory.createIdentifier(localName)), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))), 0); break; - case 270: + case 273: addResult(ts.factory.createImportDeclaration(undefined, ts.factory.createImportClause(false, undefined, ts.factory.createNamedImports([ ts.factory.createImportSpecifier(false, localName !== verbatimTargetName ? ts.factory.createIdentifier(verbatimTargetName) : undefined, ts.factory.createIdentifier(localName)) ])), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), undefined), 0); break; - case 275: + case 278: var specifier = node.parent.parent.moduleSpecifier; serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined); break; - case 271: + case 274: serializeMaybeAliasAssignment(symbol); break; - case 221: - case 206: - case 207: + case 223: + case 208: + case 209: if (symbol.escapedName === "default" || symbol.escapedName === "export=") { serializeMaybeAliasAssignment(symbol); } @@ -45982,7 +46542,7 @@ var ts; && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName)))) { return []; } - var flag = (modifierFlags & ~256) | (isStatic ? 32 : 0); + var flag = (modifierFlags & ~512) | (isStatic ? 32 : 0); var name = getPropertyNameNodeForSymbol(p, context); var firstPropertyLikeDecl = (_a = p.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.or(ts.isPropertyDeclaration, ts.isAccessor, ts.isVariableDeclaration, ts.isPropertySignature, ts.isBinaryExpression, ts.isPropertyAccessExpression)); if (p.flags & 98304 && useAccessors) { @@ -45997,7 +46557,7 @@ var ts; return result; } else if (p.flags & (4 | 3 | 98304)) { - return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 : 0) | flag), name, p.flags & 16777216 ? ts.factory.createToken(57) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), undefined), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts.or(ts.isPropertyDeclaration, ts.isVariableDeclaration))) || firstPropertyLikeDecl); + return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 : 0) | flag), name, p.flags & 16777216 ? ts.factory.createToken(57) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), undefined), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts.or(ts.isPropertyDeclaration, ts.isVariableDeclaration))) || firstPropertyLikeDecl); } if (p.flags & (8192 | 16)) { var type = getTypeOfSymbol(p); @@ -46173,7 +46733,7 @@ var ts; if (flags === void 0) { flags = 16384; } return writer ? typePredicateToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(typePredicateToStringWorker); function typePredicateToStringWorker(writer) { - var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 || typePredicate.kind === 3 ? ts.factory.createToken(128) : undefined, typePredicate.kind === 1 || typePredicate.kind === 3 ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 | 512)); + var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 || typePredicate.kind === 3 ? ts.factory.createToken(129) : undefined, typePredicate.kind === 1 || typePredicate.kind === 3 ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 | 512)); var printer = ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); printer.writeNode(4, predicate, sourceFile, writer); @@ -46219,7 +46779,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 && type.symbol.declarations) { var node = ts.walkUpParenthesizedTypes(type.symbol.declarations[0].parent); - if (node.kind === 259) { + if (node.kind === 262) { return getSymbolOfNode(node); } } @@ -46227,11 +46787,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 262 && + node.parent.kind === 265 && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 305 || ts.isAmbientModule(location); + return location.kind === 308 || ts.isAmbientModule(location); } function getNameOfSymbolFromNameType(symbol, context) { var nameType = getSymbolLinks(symbol).nameType; @@ -46279,17 +46839,17 @@ var ts; if (!declaration) { declaration = symbol.declarations[0]; } - if (declaration.parent && declaration.parent.kind === 254) { + if (declaration.parent && declaration.parent.kind === 257) { return ts.declarationNameToString(declaration.parent.name); } switch (declaration.kind) { - case 226: - case 213: - case 214: + case 228: + case 215: + case 216: if (context && !context.encounteredError && !(context.flags & 131072)) { context.encounteredError = true; } - return declaration.kind === 226 ? "(Anonymous class)" : "(Anonymous function)"; + return declaration.kind === 228 ? "(Anonymous class)" : "(Anonymous function)"; } } var name = getNameOfSymbolFromNameType(symbol, context); @@ -46306,68 +46866,68 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 338: - case 345: - case 339: + case 341: + case 348: + case 342: return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent)); - case 203: + case 205: return isDeclarationVisible(node.parent.parent); - case 254: + case 257: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { return false; } + case 264: + case 260: case 261: - case 257: - case 258: + case 262: case 259: - case 256: - case 260: - case 265: + case 263: + case 268: if (ts.isExternalModuleAugmentation(node)) { return true; } var parent = getDeclarationContainer(node); if (!(ts.getCombinedModifierFlags(node) & 1) && - !(node.kind !== 265 && parent.kind !== 305 && parent.flags & 16777216)) { + !(node.kind !== 268 && parent.kind !== 308 && parent.flags & 16777216)) { return isGlobalSourceFile(parent); } return isDeclarationVisible(parent); - case 167: - case 166: - case 172: - case 173: case 169: case 168: + case 174: + case 175: + case 171: + case 170: if (ts.hasEffectiveModifier(node, 8 | 16)) { return false; } - case 171: - case 175: - case 174: + case 173: + case 177: case 176: - case 164: - case 262: - case 179: - case 180: - case 182: case 178: - case 183: + case 166: + case 265: + case 181: + case 182: case 184: - case 187: - case 188: - case 191: - case 197: + case 180: + case 185: + case 186: + case 189: + case 190: + case 193: + case 199: return isDeclarationVisible(node.parent); - case 267: - case 268: case 270: + case 271: + case 273: return false; - case 163: - case 305: - case 264: + case 165: + case 308: + case 267: return true; - case 271: + case 274: return false; default: return false; @@ -46376,10 +46936,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 271) { + if (node.parent && node.parent.kind === 274) { exportSymbol = resolveName(node, node.escapedText, 111551 | 788968 | 1920 | 2097152, undefined, node, false); } - else if (node.parent.kind === 275) { + else if (node.parent.kind === 278) { exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 | 788968 | 1920 | 2097152); } var result; @@ -46469,12 +47029,12 @@ var ts; function getDeclarationContainer(node) { return ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 254: - case 255: + case 257: + case 258: + case 273: + case 272: + case 271: case 270: - case 269: - case 268: - case 267: return false; default: return true; @@ -46583,23 +47143,23 @@ var ts; function getParentElementAccess(node) { var ancestor = node.parent.parent; switch (ancestor.kind) { - case 203: - case 296: + case 205: + case 299: return getSyntheticElementAccess(ancestor); - case 204: + case 206: return getSyntheticElementAccess(node.parent); - case 254: + case 257: return ancestor.initializer; - case 221: + case 223: return ancestor.right; } } function getDestructuringPropertyName(node) { var parent = node.parent; - if (node.kind === 203 && parent.kind === 201) { + if (node.kind === 205 && parent.kind === 203) { return getLiteralPropertyNameText(node.propertyName || node.name); } - if (node.kind === 296 || node.kind === 297) { + if (node.kind === 299 || node.kind === 300) { return getLiteralPropertyNameText(node.name); } return "" + parent.elements.indexOf(node); @@ -46625,7 +47185,7 @@ var ts; parentType = getTypeWithFacts(parentType, 524288); } var type; - if (pattern.kind === 201) { + if (pattern.kind === 203) { if (declaration.dotDotDotToken) { parentType = getReducedType(parentType); if (parentType.flags & 2 || !isValidSpreadType(parentType)) { @@ -46687,7 +47247,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node, true); - return expr.kind === 204 && expr.elements.length === 0; + return expr.kind === 206 && expr.elements.length === 0; } function addOptionality(type, isProperty, isOptional) { if (isProperty === void 0) { isProperty = false; } @@ -46695,18 +47255,18 @@ var ts; return strictNullChecks && isOptional ? getOptionalType(type, isProperty) : type; } function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 246) { var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, checkMode))); return indexType.flags & (262144 | 4194304) ? getExtractStringType(indexType) : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247) { var forOfStatement = declaration.parent.parent; return checkRightHandSideOfForOf(forOfStatement) || anyType; } if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } - var isProperty = ts.isPropertyDeclaration(declaration) || ts.isPropertySignature(declaration); + var isProperty = ts.isPropertyDeclaration(declaration) && !ts.hasAccessorModifier(declaration) || ts.isPropertySignature(declaration); var isOptional = includeOptionality && (isProperty && !!declaration.questionToken || ts.isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) || isOptionalJSDocPropertyLikeTag(declaration)); @@ -46726,8 +47286,8 @@ var ts; } if (ts.isParameter(declaration)) { var func = declaration.parent; - if (func.kind === 173 && hasBindableName(func)) { - var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 172); + if (func.kind === 175 && hasBindableName(func)) { + var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 174); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -46738,11 +47298,9 @@ var ts; return getReturnTypeOfSignature(getterSignature); } } - if (ts.isInJSFile(declaration)) { - var type_1 = getParameterTypeOfTypeTag(func, declaration); - if (type_1) - return type_1; - } + var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration); + if (parameterTypeOfTypeTag) + return parameterTypeOfTypeTag; var type = declaration.symbol.escapedName === "this" ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration); if (type) { return addOptionality(type, false, isOptional); @@ -46790,7 +47348,7 @@ var ts; links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && ts.every(symbol.declarations, function (declaration) { return ts.isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && - (declaration.left.kind !== 207 || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && + (declaration.left.kind !== 209 || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration(undefined, declaration, symbol, declaration); }); } @@ -46810,11 +47368,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var container = ts.getThisContainer(declaration, false); - if (container && (container.kind === 171 || isJSConstructor(container))) { + if (container && (container.kind === 173 || isJSConstructor(container))) { return container; } } - ; } function getFlowTypeFromCommonJSExport(symbol) { var file = ts.getSourceFileOfNode(symbol.declarations[0]); @@ -47086,9 +47643,9 @@ var ts; } function isDeclarationInConstructor(expression) { var thisContainer = ts.getThisContainer(expression, false); - return thisContainer.kind === 171 || - thisContainer.kind === 256 || - (thisContainer.kind === 213 && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + return thisContainer.kind === 173 || + thisContainer.kind === 259 || + (thisContainer.kind === 215 && !ts.isPrototypePropertyAssignment(thisContainer.parent)); } function getConstructorDefinedThisAssignmentTypes(types, declarations) { ts.Debug.assert(types.length === declarations.length); @@ -47145,7 +47702,7 @@ var ts; function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) { var elements = pattern.elements; var lastElement = ts.lastOrUndefined(elements); - var restElement = lastElement && lastElement.kind === 203 && lastElement.dotDotDotToken ? lastElement : undefined; + var restElement = lastElement && lastElement.kind === 205 && lastElement.dotDotDotToken ? lastElement : undefined; if (elements.length === 0 || elements.length === 1 && restElement) { return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType; } @@ -47163,7 +47720,7 @@ var ts; function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { if (includePatternInType === void 0) { includePatternInType = false; } if (reportErrors === void 0) { reportErrors = false; } - return pattern.kind === 201 + return pattern.kind === 203 ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -47198,7 +47755,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 164 ? root.parent : root; + var memberDeclaration = root.kind === 166 ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function tryGetTypeFromEffectiveTypeNode(node) { @@ -47247,8 +47804,8 @@ var ts; if (typeNode === undefined) { return useUnknownInCatchVariables ? unknownType : anyType; } - var type_2 = getTypeOfNode(typeNode); - return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType; + var type_1 = getTypeOfNode(typeNode); + return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType; } if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) { if (!declaration.statements.length) { @@ -47266,7 +47823,7 @@ var ts; return reportCircularityError(symbol); } var type; - if (declaration.kind === 271) { + if (declaration.kind === 274) { type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); } else if (ts.isBinaryExpression(declaration) || @@ -47330,13 +47887,17 @@ var ts; } function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { - if (accessor.kind === 172) { - var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation; - } - else { - var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation; + switch (accessor.kind) { + case 174: + var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); + return getterTypeAnnotation; + case 175: + var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation; + case 169: + ts.Debug.assert(ts.hasAccessorModifier(accessor)); + var accessorTypeAnnotation = ts.getEffectiveTypeAnnotationNode(accessor); + return accessorTypeAnnotation; } } return undefined; @@ -47358,12 +47919,15 @@ var ts; if (!pushTypeResolution(symbol, 0)) { return errorType; } - var getter = ts.getDeclarationOfKind(symbol, 172); - var setter = ts.getDeclarationOfKind(symbol, 173); + var getter = ts.getDeclarationOfKind(symbol, 174); + var setter = ts.getDeclarationOfKind(symbol, 175); + var accessor = ts.tryCast(ts.getDeclarationOfKind(symbol, 169), ts.isAutoAccessorPropertyDeclaration); var type = getter && ts.isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || - getter && getter.body && getReturnTypeFromBody(getter); + getAnnotatedAccessorType(accessor) || + getter && getter.body && getReturnTypeFromBody(getter) || + accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration(accessor, true); if (!type) { if (setter && !isPrivateWithinAmbient(setter)) { errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); @@ -47371,6 +47935,9 @@ var ts; else if (getter && !isPrivateWithinAmbient(getter)) { errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); } + else if (accessor && !isPrivateWithinAmbient(accessor)) { + errorOrSuggestion(noImplicitAny, accessor, ts.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), "any"); + } type = anyType; } if (!popTypeResolution()) { @@ -47380,6 +47947,9 @@ var ts; else if (getAnnotatedAccessorTypeNode(setter)) { error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } + else if (getAnnotatedAccessorTypeNode(accessor)) { + error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } else if (getter && noImplicitAny) { error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } @@ -47390,12 +47960,13 @@ var ts; return links.type; } function getWriteTypeOfAccessors(symbol) { + var _a; var links = getSymbolLinks(symbol); if (!links.writeType) { if (!pushTypeResolution(symbol, 8)) { return errorType; } - var setter = ts.getDeclarationOfKind(symbol, 173); + var setter = (_a = ts.getDeclarationOfKind(symbol, 175)) !== null && _a !== void 0 ? _a : ts.tryCast(ts.getDeclarationOfKind(symbol, 169), ts.isAutoAccessorPropertyDeclaration); var writeType = getAnnotatedAccessorType(setter); if (!popTypeResolution()) { if (getAnnotatedAccessorTypeNode(setter)) { @@ -47433,9 +48004,9 @@ var ts; if (symbol.flags & 1536 && ts.isShorthandAmbientModuleSymbol(symbol)) { return anyType; } - else if (declaration && (declaration.kind === 221 || + else if (declaration && (declaration.kind === 223 || ts.isAccessExpression(declaration) && - declaration.parent.kind === 221)) { + declaration.parent.kind === 223)) { return getWidenedTypeForAssignmentDeclaration(symbol); } else if (symbol.flags & 512 && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) { @@ -47445,11 +48016,11 @@ var ts; return errorType; } var exportEquals = getMergedSymbol(symbol.exports.get("export=")); - var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); + var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); if (!popTypeResolution()) { return reportCircularityError(symbol); } - return type_3; + return type_2; } } var type = createObjectType(16, symbol); @@ -47474,7 +48045,7 @@ var ts; links.type = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol.declarations) ? autoType : declaredType ? declaredType - : targetSymbol.flags & 111551 ? getTypeOfSymbol(targetSymbol) + : getAllSymbolFlags(targetSymbol) & 111551 ? getTypeOfSymbol(targetSymbol) : errorType; } return links.type; @@ -47493,7 +48064,7 @@ var ts; error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); return errorType; } - if (noImplicitAny && (declaration.kind !== 164 || declaration.initializer)) { + if (noImplicitAny && (declaration.kind !== 166 || declaration.initializer)) { error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); } return anyType; @@ -47611,46 +48182,46 @@ var ts; return undefined; } switch (node.kind) { - case 257: - case 226: - case 258: - case 174: - case 175: - case 168: - case 179: - case 180: - case 317: - case 256: - case 169: - case 213: - case 214: + case 260: + case 228: + case 261: + case 176: + case 177: + case 170: + case 181: + case 182: + case 320: case 259: - case 344: - case 345: - case 339: - case 338: - case 195: - case 189: { + case 171: + case 215: + case 216: + case 262: + case 347: + case 348: + case 342: + case 341: + case 197: + case 191: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); - if (node.kind === 195) { + if (node.kind === 197) { return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))); } - else if (node.kind === 189) { + else if (node.kind === 191) { return ts.concatenate(outerTypeParameters, getInferTypeParameters(node)); } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node)); var thisType = includeThisTypes && - (node.kind === 257 || node.kind === 226 || node.kind === 258 || isJSConstructor(node)) && + (node.kind === 260 || node.kind === 228 || node.kind === 261 || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } - case 340: + case 343: var paramSymbol = ts.getParameterSymbolFromJSDoc(node); if (paramSymbol) { node = paramSymbol.valueDeclaration; } break; - case 320: { + case 323: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); return node.tags ? appendTypeParameters(outerTypeParameters, ts.flatMap(node.tags, function (t) { return ts.isJSDocTemplateTag(t) ? t.typeParameters : undefined; })) @@ -47660,7 +48231,7 @@ var ts; } } function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 258); + var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 261); ts.Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations"); return getOuterTypeParameters(declaration); } @@ -47671,9 +48242,9 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 258 || - node.kind === 257 || - node.kind === 226 || + if (node.kind === 261 || + node.kind === 260 || + node.kind === 228 || isJSConstructor(node) || ts.isTypeAlias(node)) { var declaration = node; @@ -47811,7 +48382,7 @@ var ts; if (!popTypeResolution() && type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 257 || declaration.kind === 258) { + if (declaration.kind === 260 || declaration.kind === 261) { reportCircularBaseType(declaration, type); } } @@ -47892,7 +48463,7 @@ var ts; if (type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 261 && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getReducedType(getTypeFromTypeNode(node)); @@ -47925,7 +48496,7 @@ var ts; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258) { + if (declaration.kind === 261) { if (declaration.flags & 128) { return false; } @@ -47993,7 +48564,7 @@ var ts; } else { type = errorType; - if (declaration.kind === 339) { + if (declaration.kind === 342) { error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } else { @@ -48008,7 +48579,7 @@ var ts; if (ts.isStringLiteralLike(expr)) { return true; } - else if (expr.kind === 221) { + else if (expr.kind === 223) { return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right); } return false; @@ -48023,12 +48594,12 @@ var ts; case 8: case 14: return true; - case 219: + case 221: return expr.operator === 40 && expr.operand.kind === 8; case 79: return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText); - case 221: + case 223: return isStringConcatExpression(expr); default: return false; @@ -48043,7 +48614,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260) { + if (declaration.kind === 263) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && ts.isStringLiteralLike(member.initializer)) { @@ -48072,7 +48643,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260) { + if (declaration.kind === 263) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var value = getEnumMemberValue(member); @@ -48140,22 +48711,22 @@ var ts; } function isThislessType(node) { switch (node.kind) { - case 130: - case 155: - case 150: - case 147: - case 158: - case 133: - case 151: + case 131: + case 157: + case 152: case 148: - case 114: + case 160: + case 134: case 153: - case 143: - case 196: + case 149: + case 114: + case 155: + case 144: + case 198: return true; - case 183: + case 185: return isThislessType(node.elementType); - case 178: + case 180: return !node.typeArguments || node.typeArguments.every(isThislessType); } return false; @@ -48171,7 +48742,7 @@ var ts; function isThislessFunctionLikeDeclaration(node) { var returnType = ts.getEffectiveReturnTypeNode(node); var typeParameters = ts.getEffectiveTypeParameterDeclarations(node); - return (node.kind === 171 || (!!returnType && isThislessType(returnType))) && + return (node.kind === 173 || (!!returnType && isThislessType(returnType))) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); } @@ -48180,14 +48751,14 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 167: - case 166: - return isThislessVariableLikeDeclaration(declaration); case 169: case 168: + return isThislessVariableLikeDeclaration(declaration); case 171: - case 172: + case 170: case 173: + case 174: + case 175: return isThislessFunctionLikeDeclaration(declaration); } } @@ -48327,8 +48898,10 @@ var ts; if (members) { for (var _b = 0, members_5 = members; _b < members_5.length; _b++) { var member = members_5[_b]; - if (isStatic_1 === ts.hasStaticModifier(member) && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === ts.hasStaticModifier(member)) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -48343,8 +48916,10 @@ var ts; || ts.isBinaryExpression(member) && isPossiblyAliasedThisProperty(member, assignmentKind) || assignmentKind === 9 || assignmentKind === 6; - if (isStatic_1 === !isInstanceMember && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === !isInstanceMember) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -48517,7 +49092,7 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1); var declaration = ts.getClassLikeDeclarationOfSymbol(classType.symbol); - var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 128); + var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 256); if (baseSignatures.length === 0) { return [createSignature(undefined, classType.localTypeParameters, undefined, ts.emptyArray, classType, undefined, 0, isAbstract ? 4 : 0)]; } @@ -49070,8 +49645,8 @@ var ts; } function isMappedTypeWithKeyofConstraintDeclaration(type) { var constraintDeclaration = getConstraintDeclarationForMappedType(type); - return constraintDeclaration.kind === 193 && - constraintDeclaration.operator === 140; + return constraintDeclaration.kind === 195 && + constraintDeclaration.operator === 141; } function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { @@ -49105,7 +49680,17 @@ var ts; return !!(ts.getObjectFlags(type) & 32 && getMappedTypeModifiers(type) & 4); } function isGenericMappedType(type) { - return !!(ts.getObjectFlags(type) & 32) && isGenericIndexType(getConstraintTypeFromMappedType(type)); + if (ts.getObjectFlags(type) & 32) { + var constraint = getConstraintTypeFromMappedType(type); + if (isGenericIndexType(constraint)) { + return true; + } + var nameType = getNameTypeFromMappedType(type); + if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) { + return true; + } + } + return false; } function resolveStructuredTypeMembers(type) { if (!type.members) { @@ -49379,10 +49964,10 @@ var ts; var baseTypes = []; var different = false; for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type_4 = types_7[_i]; - var baseType = getBaseConstraint(type_4); + var type_3 = types_7[_i]; + var baseType = getBaseConstraint(type_3); if (baseType) { - if (baseType !== type_4) { + if (baseType !== type_3) { different = true; } baseTypes.push(baseType); @@ -49424,7 +50009,7 @@ var ts; return constraint && getBaseConstraint(constraint); } if (t.flags & 33554432) { - return getBaseConstraint(t.substitute); + return getBaseConstraint(getSubstitutionIntersection(t)); } return t; } @@ -49504,7 +50089,7 @@ var ts; var propSet; var indexTypes; var isUnion = containingType.flags & 1048576; - var optionalFlag = isUnion ? 0 : 16777216; + var optionalFlag; var syntheticFlag = 4; var checkFlags = isUnion ? 0 : 8; var mergedInstantiations = false; @@ -49515,11 +50100,14 @@ var ts; var prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment); var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0; if (prop) { - if (isUnion) { - optionalFlag |= (prop.flags & 16777216); - } - else { - optionalFlag &= prop.flags; + if (prop.flags & 106500) { + optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : (optionalFlag = isUnion ? 0 : 16777216); + if (isUnion) { + optionalFlag |= (prop.flags & 16777216); + } + else { + optionalFlag &= prop.flags; + } } if (!singleProp) { singleProp = prop; @@ -49570,7 +50158,11 @@ var ts; } } } - if (!singleProp || isUnion && (propSet || checkFlags & 48) && checkFlags & (1024 | 512)) { + if (!singleProp || + isUnion && + (propSet || checkFlags & 48) && + checkFlags & (1024 | 512) && + !(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) { return undefined; } if (!propSet && !(checkFlags & 16) && !indexTypes) { @@ -49623,7 +50215,7 @@ var ts; propTypes.push(type); } ts.addRange(propTypes, indexTypes); - var result = createSymbol(4 | optionalFlag, name, syntheticFlag | checkFlags); + var result = createSymbol(4 | (optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : 0), name, syntheticFlag | checkFlags); result.containingType = containingType; if (!hasNonUniformValueDeclaration && firstValueDeclaration) { result.valueDeclaration = firstValueDeclaration; @@ -49660,6 +50252,33 @@ var ts; } return property; } + function getCommonDeclarationsOfSymbols(symbols) { + var commonDeclarations; + var _loop_14 = function (symbol) { + if (!symbol.declarations) { + return { value: undefined }; + } + if (!commonDeclarations) { + commonDeclarations = new ts.Set(symbol.declarations); + return "continue"; + } + commonDeclarations.forEach(function (declaration) { + if (!ts.contains(symbol.declarations, declaration)) { + commonDeclarations.delete(declaration); + } + }); + if (commonDeclarations.size === 0) { + return { value: undefined }; + } + }; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var symbol = symbols_3[_i]; + var state_4 = _loop_14(symbol); + if (typeof state_4 === "object") + return state_4.value; + } + return commonDeclarations; + } function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) { var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment); return property && !(ts.getCheckFlags(property) & 16) ? property : undefined; @@ -49827,10 +50446,10 @@ var ts; return result; } function isJSDocOptionalParameter(node) { - return ts.isInJSFile(node) && (node.type && node.type.kind === 316 + return ts.isInJSFile(node) && (node.type && node.type.kind === 319 || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -49859,14 +50478,14 @@ var ts; return false; } function isOptionalPropertyDeclaration(node) { - return ts.isPropertyDeclaration(node) && node.questionToken; + return ts.isPropertyDeclaration(node) && !ts.hasAccessorModifier(node) && node.questionToken; } function isOptionalJSDocPropertyLikeTag(node) { if (!ts.isJSDocPropertyLikeTag(node)) { return false; } var isBracketed = node.isBracketed, typeExpression = node.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319; } function createTypePredicate(kind, parameterName, parameterIndex, type) { return { kind: kind, parameterName: parameterName, parameterIndex: parameterIndex, type: type }; @@ -49939,7 +50558,7 @@ var ts; else { parameters.push(paramSymbol); } - if (type && type.kind === 196) { + if (type && type.kind === 198) { flags |= 2; } var isOptionalParameter_1 = isOptionalJSDocPropertyLikeTag(param) || @@ -49950,24 +50569,24 @@ var ts; minArgumentCount = parameters.length; } } - if ((declaration.kind === 172 || declaration.kind === 173) && + if ((declaration.kind === 174 || declaration.kind === 175) && hasBindableName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 172 ? 173 : 172; + var otherKind = declaration.kind === 174 ? 175 : 174; var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - var classType = declaration.kind === 171 ? + var classType = declaration.kind === 173 ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration); if (ts.hasRestParameter(declaration) || ts.isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) { flags |= 1; } - if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 128) || - ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 128)) { + if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 256) || + ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 256)) { flags |= 4; } links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, undefined, undefined, minArgumentCount, flags); @@ -50033,16 +50652,16 @@ var ts; switch (node.kind) { case 79: return node.escapedText === argumentsSymbol.escapedName && getReferencedValueSymbol(node) === argumentsSymbol; - case 167: case 169: - case 172: - case 173: - return node.name.kind === 162 + case 171: + case 174: + case 175: + return node.name.kind === 164 && traverse(node.name); - case 206: - case 207: + case 208: + case 209: return traverse(node.expression); - case 296: + case 299: return traverse(node.initializer); default: return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse); @@ -50063,7 +50682,10 @@ var ts; continue; } } - result.push(getSignatureFromDeclaration(decl)); + result.push((!ts.isFunctionExpressionOrArrowFunction(decl) && + !ts.isObjectLiteralMethod(decl) && + getSignatureOfTypeTag(decl)) || + getSignatureFromDeclaration(decl)); } return result; } @@ -50094,7 +50716,7 @@ var ts; else { var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration); var jsdocPredicate = void 0; - if (!type && ts.isInJSFile(signature.declaration)) { + if (!type) { var jsdocSignature = getSignatureOfTypeTag(signature.declaration); if (jsdocSignature && signature !== jsdocSignature) { jsdocPredicate = getTypePredicateOfSignature(jsdocSignature); @@ -50111,7 +50733,7 @@ var ts; function createTypePredicateFromTypePredicateNode(node, signature) { var parameterName = node.parameterName; var type = node.type && getTypeFromTypeNode(node.type); - return parameterName.kind === 192 ? + return parameterName.kind === 194 ? createTypePredicate(node.assertsModifier ? 2 : 0, undefined, undefined, type) : createTypePredicate(node.assertsModifier ? 3 : 1, parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type); } @@ -50157,7 +50779,7 @@ var ts; return signature.resolvedReturnType; } function getReturnTypeFromAnnotation(declaration) { - if (declaration.kind === 171) { + if (declaration.kind === 173) { return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)); } if (ts.isJSDocConstructSignature(declaration)) { @@ -50167,12 +50789,12 @@ var ts; if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (declaration.kind === 172 && hasBindableName(declaration)) { + if (declaration.kind === 174 && hasBindableName(declaration)) { var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration); if (jsDocType) { return jsDocType; } - var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 173); + var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 175); var setterType = getAnnotatedAccessorType(setter); if (setterType) { return setterType; @@ -50260,7 +50882,7 @@ var ts; var _a; if (!signature.isolatedSignatureType) { var kind = (_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind; - var isConstructor = kind === undefined || kind === 171 || kind === 175 || kind === 180; + var isConstructor = kind === undefined || kind === 173 || kind === 177 || kind === 182; var type = createObjectType(16); type.members = emptySymbols; type.properties = ts.emptyArray; @@ -50287,7 +50909,7 @@ var ts; function getIndexInfosOfIndexSymbol(indexSymbol) { if (indexSymbol.declarations) { var indexInfos_4 = []; - var _loop_14 = function (declaration) { + var _loop_15 = function (declaration) { if (declaration.parameters.length === 1) { var parameter = declaration.parameters[0]; if (parameter.type) { @@ -50301,7 +50923,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_14(declaration); + _loop_15(declaration); } return indexInfos_4; } @@ -50318,10 +50940,10 @@ var ts; var _a; var inferences; if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) { - var _loop_15 = function (declaration) { - if (declaration.parent.kind === 190) { + var _loop_16 = function (declaration) { + if (declaration.parent.kind === 192) { var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1]; - if (grandParent.kind === 178 && !omitTypeReferences) { + if (grandParent.kind === 180 && !omitTypeReferences) { var typeReference_1 = grandParent; var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1); if (typeParameters_1) { @@ -50340,20 +50962,20 @@ var ts; } } } - else if (grandParent.kind === 164 && grandParent.dotDotDotToken || - grandParent.kind === 186 || - grandParent.kind === 197 && grandParent.dotDotDotToken) { + else if (grandParent.kind === 166 && grandParent.dotDotDotToken || + grandParent.kind === 188 || + grandParent.kind === 199 && grandParent.dotDotDotToken) { inferences = ts.append(inferences, createArrayType(unknownType)); } - else if (grandParent.kind === 199) { + else if (grandParent.kind === 201) { inferences = ts.append(inferences, stringType); } - else if (grandParent.kind === 163 && grandParent.parent.kind === 195) { + else if (grandParent.kind === 165 && grandParent.parent.kind === 197) { inferences = ts.append(inferences, keyofConstraintType); } - else if (grandParent.kind === 195 && grandParent.type && - ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 189 && - grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 195 && + else if (grandParent.kind === 197 && grandParent.type && + ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 191 && + grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 197 && grandParent.parent.checkType.type) { var checkMappedType_1 = grandParent.parent.checkType; var nodeType = getTypeFromTypeNode(checkMappedType_1.type); @@ -50363,7 +50985,7 @@ var ts; }; for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - _loop_15(declaration); + _loop_16(declaration); } } return inferences && getIntersectionType(inferences); @@ -50382,7 +51004,7 @@ var ts; else { var type = getTypeFromTypeNode(constraintDeclaration); if (type.flags & 1 && !isErrorType(type)) { - type = constraintDeclaration.parent.parent.kind === 195 ? keyofConstraintType : unknownType; + type = constraintDeclaration.parent.parent.kind === 197 ? keyofConstraintType : unknownType; } typeParameter.constraint = type; } @@ -50391,7 +51013,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - var tp = ts.getDeclarationOfKind(typeParameter.symbol, 163); + var tp = ts.getDeclarationOfKind(typeParameter.symbol, 165); var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getEffectiveContainerForJSDocTemplateTag(tp.parent) : tp.parent; return host && getSymbolOfNode(host); } @@ -50473,8 +51095,8 @@ var ts; } var node = type.node; var typeArguments = !node ? ts.emptyArray : - node.kind === 178 ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : - node.kind === 183 ? [getTypeFromTypeNode(node.elementType)] : + node.kind === 180 ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : + node.kind === 185 ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); if (popTypeResolution()) { type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments; @@ -50512,7 +51134,7 @@ var ts; return errorType; } } - if (node.kind === 178 && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { + if (node.kind === 180 && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { return createDeferredTypeReference(type, node, undefined); } var typeArguments = ts.concatenate(type.outerTypeParameters, fillMissingTypeArguments(typeArgumentsFromTypeReferenceNode(node), typeParameters, minTypeArgumentCount, isJs)); @@ -50571,9 +51193,9 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 178: + case 180: return node.typeName; - case 228: + case 230: var expr = node.expression; if (ts.isEntityNameExpression(expr)) { return expr; @@ -50585,13 +51207,13 @@ var ts; return symbol.parent ? "".concat(getSymbolPath(symbol.parent), ".").concat(symbol.escapedName) : symbol.escapedName; } function getUnresolvedSymbolForEntityName(name) { - var identifier = name.kind === 161 ? name.right : - name.kind === 206 ? name.name : + var identifier = name.kind === 163 ? name.right : + name.kind === 208 ? name.name : name; var text = identifier.escapedText; if (text) { - var parentSymbol = name.kind === 161 ? getUnresolvedSymbolForEntityName(name.left) : - name.kind === 206 ? getUnresolvedSymbolForEntityName(name.expression) : + var parentSymbol = name.kind === 163 ? getUnresolvedSymbolForEntityName(name.left) : + name.kind === 208 ? getUnresolvedSymbolForEntityName(name.expression) : undefined; var path = parentSymbol ? "".concat(getSymbolPath(parentSymbol), ".").concat(text) : text; var result = unresolvedSymbols.get(path); @@ -50646,7 +51268,7 @@ var ts; var valueType = getTypeOfSymbol(symbol); var typeType = valueType; if (symbol.valueDeclaration) { - var isImportTypeWithQualifier = node.kind === 200 && node.qualifier; + var isImportTypeWithQualifier = node.kind === 202 && node.qualifier; if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) { typeType = getTypeReferenceType(node, valueType.symbol); } @@ -50655,23 +51277,27 @@ var ts; } return links.resolvedJSDocType; } - function getSubstitutionType(baseType, substitute) { - if (substitute.flags & 3 || substitute === baseType) { + function getSubstitutionType(baseType, constraint) { + if (constraint.flags & 3 || constraint === baseType || + !isGenericType(baseType) && !isGenericType(constraint)) { return baseType; } - var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(substitute)); + var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(constraint)); var cached = substitutionTypes.get(id); if (cached) { return cached; } var result = createType(33554432); result.baseType = baseType; - result.substitute = substitute; + result.constraint = constraint; substitutionTypes.set(id, result); return result; } + function getSubstitutionIntersection(substitutionType) { + return getIntersectionType([substitutionType.constraint, substitutionType.baseType]); + } function isUnaryTupleTypeNode(node) { - return node.kind === 184 && node.elements.length === 1; + return node.kind === 186 && node.elements.length === 1; } function getImpliedConstraint(type, checkNode, extendsNode) { return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) : @@ -50681,18 +51307,18 @@ var ts; function getConditionalFlowTypeOfType(type, node) { var constraints; var covariant = true; - while (node && !ts.isStatement(node) && node.kind !== 320) { + while (node && !ts.isStatement(node) && node.kind !== 323) { var parent = node.parent; - if (parent.kind === 164) { + if (parent.kind === 166) { covariant = !covariant; } - if ((covariant || type.flags & 8650752) && parent.kind === 189 && node === parent.trueType) { + if ((covariant || type.flags & 8650752) && parent.kind === 191 && node === parent.trueType) { var constraint = getImpliedConstraint(type, parent.checkType, parent.extendsType); if (constraint) { constraints = ts.append(constraints, constraint); } } - else if (type.flags & 262144 && parent.kind === 195 && node === parent.type) { + else if (type.flags & 262144 && parent.kind === 197 && node === parent.type) { var mappedType = getTypeFromTypeNode(parent); if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { var typeParameter = getHomomorphicTypeVariable(mappedType); @@ -50706,10 +51332,10 @@ var ts; } node = parent; } - return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type; + return constraints ? getSubstitutionType(type, getIntersectionType(constraints)) : type; } function isJSDocTypeReference(node) { - return !!(node.flags & 8388608) && (node.kind === 178 || node.kind === 200); + return !!(node.flags & 8388608) && (node.kind === 180 || node.kind === 202); } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { @@ -50817,9 +51443,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 257: - case 258: case 260: + case 261: + case 263: return declaration; } } @@ -50960,6 +51586,13 @@ var ts; function getGlobalBigIntType() { return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", 0, false))) || emptyObjectType; } + function getGlobalNaNSymbol() { + return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", false))); + } + function getGlobalRecordSymbol() { + deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", 2, true) || unknownSymbol); + return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol; + } function createTypeFromGenericGlobalType(genericGlobalType, typeArguments) { return genericGlobalType !== emptyGenericType ? createTypeReference(genericGlobalType, typeArguments) : emptyObjectType; } @@ -50974,11 +51607,11 @@ var ts; } function getTupleElementFlags(node) { switch (node.kind) { - case 185: + case 187: return 2; - case 186: + case 188: return getRestTypeElementFlags(node); - case 197: + case 199: return node.questionToken ? 2 : node.dotDotDotToken ? getRestTypeElementFlags(node) : 1; @@ -50996,57 +51629,57 @@ var ts; return readonly ? globalReadonlyArrayType : globalArrayType; } var elementFlags = ts.map(node.elements, getTupleElementFlags); - var missingName = ts.some(node.elements, function (e) { return e.kind !== 197; }); + var missingName = ts.some(node.elements, function (e) { return e.kind !== 199; }); return getTupleTargetType(elementFlags, readonly, missingName ? undefined : node.elements); } function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) { - return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 183 ? mayResolveTypeAlias(node.elementType) : - node.kind === 184 ? ts.some(node.elements, mayResolveTypeAlias) : + return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 185 ? mayResolveTypeAlias(node.elementType) : + node.kind === 186 ? ts.some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || ts.some(node.typeArguments, mayResolveTypeAlias)); } function isResolvedByTypeAlias(node) { var parent = node.parent; switch (parent.kind) { - case 191: - case 197: - case 178: - case 187: - case 188: - case 194: - case 189: case 193: - case 183: - case 184: + case 199: + case 180: + case 189: + case 190: + case 196: + case 191: + case 195: + case 185: + case 186: return isResolvedByTypeAlias(parent); - case 259: + case 262: return true; } return false; } function mayResolveTypeAlias(node) { switch (node.kind) { - case 178: + case 180: return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node, 788968).flags & 524288); - case 181: + case 183: return true; + case 195: + return node.operator !== 156 && mayResolveTypeAlias(node.type); case 193: - return node.operator !== 154 && mayResolveTypeAlias(node.type); - case 191: - case 185: - case 197: - case 316: - case 314: - case 315: - case 309: - return mayResolveTypeAlias(node.type); - case 186: - return node.type.kind !== 183 || mayResolveTypeAlias(node.type.elementType); case 187: + case 199: + case 319: + case 317: + case 318: + case 312: + return mayResolveTypeAlias(node.type); case 188: + return node.type.kind !== 185 || mayResolveTypeAlias(node.type.elementType); + case 189: + case 190: return ts.some(node.types, mayResolveTypeAlias); - case 194: + case 196: return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType); - case 189: + case 191: return mayResolveTypeAlias(node.checkType) || mayResolveTypeAlias(node.extendsType) || mayResolveTypeAlias(node.trueType) || mayResolveTypeAlias(node.falseType); } @@ -51059,19 +51692,19 @@ var ts; if (target === emptyGenericType) { links.resolvedType = emptyObjectType; } - else if (!(node.kind === 184 && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8); })) && isDeferredTypeReferenceNode(node)) { - links.resolvedType = node.kind === 184 && node.elements.length === 0 ? target : + else if (!(node.kind === 186 && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8); })) && isDeferredTypeReferenceNode(node)) { + links.resolvedType = node.kind === 186 && node.elements.length === 0 ? target : createDeferredTypeReference(target, node, undefined); } else { - var elementTypes = node.kind === 183 ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); + var elementTypes = node.kind === 185 ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); links.resolvedType = createNormalizedTypeReference(target, elementTypes); } } return links.resolvedType; } function isReadonlyTypeOperator(node) { - return ts.isTypeOperatorNode(node) && node.operator === 145; + return ts.isTypeOperatorNode(node) && node.operator === 146; } function createTupleType(elementTypes, elementFlags, readonly, namedMemberDeclarations) { if (readonly === void 0) { readonly = false; } @@ -51171,7 +51804,7 @@ var ts; var lastRequiredIndex = -1; var firstRestIndex = -1; var lastOptionalOrRestIndex = -1; - var _loop_16 = function (i) { + var _loop_17 = function (i) { var type = elementTypes[i]; var flags = target.elementFlags[i]; if (flags & 8) { @@ -51197,9 +51830,9 @@ var ts; } }; for (var i = 0; i < elementTypes.length; i++) { - var state_4 = _loop_16(i); - if (typeof state_4 === "object") - return state_4.value; + var state_5 = _loop_17(i); + if (typeof state_5 === "object") + return state_5.value; } for (var i = 0; i < lastRequiredIndex; i++) { if (expandedFlags[i] & 2) @@ -51225,7 +51858,7 @@ var ts; if (flags & (2 | 4)) { lastOptionalOrRestIndex = expandedFlags.length; } - expandedTypes.push(type); + expandedTypes.push(flags & 2 ? addOptionality(type, true) : type); expandedFlags.push(flags); if (expandedDeclarations && declaration) { expandedDeclarations.push(declaration); @@ -51374,7 +52007,7 @@ var ts; var templates = ts.filter(types, isPatternLiteralType); if (templates.length) { var i = types.length; - var _loop_17 = function () { + var _loop_18 = function () { i--; var t = types[i]; if (t.flags & 128 && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) { @@ -51382,7 +52015,7 @@ var ts; } }; while (i > 0) { - _loop_17(); + _loop_18(); } } } @@ -51452,14 +52085,14 @@ var ts; var namedUnions = []; addNamedUnions(namedUnions, types); var reducedTypes = []; - var _loop_18 = function (t) { + var _loop_19 = function (t) { if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) { reducedTypes.push(t); } }; for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) { var t = typeSet_1[_i]; - _loop_18(t); + _loop_19(t); } if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) { return namedUnions[0]; @@ -51872,7 +52505,7 @@ var ts; type.flags & 16777216 ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 | 134217728) ? ts.every(type.types, isDistributive) : type.flags & 8388608 ? isDistributive(type.objectType) && isDistributive(type.indexType) : - type.flags & 33554432 ? isDistributive(type.substitute) : + type.flags & 33554432 ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 ? isDistributive(type.type) : false; } @@ -51946,15 +52579,15 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { switch (node.operator) { - case 140: + case 141: links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); break; - case 154: - links.resolvedType = node.type.kind === 151 + case 156: + links.resolvedType = node.type.kind === 153 ? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent)) : errorType; break; - case 145: + case 146: links.resolvedType = getTypeFromTypeNode(node.type); break; default: @@ -51990,8 +52623,13 @@ var ts; return getStringLiteralType(text); } newTexts.push(text); - if (ts.every(newTexts, function (t) { return t === ""; }) && ts.every(newTypes, function (t) { return !!(t.flags & 4); })) { - return stringType; + if (ts.every(newTexts, function (t) { return t === ""; })) { + if (ts.every(newTypes, function (t) { return !!(t.flags & 4); })) { + return stringType; + } + if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) { + return newTypes[0]; + } } var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join("")); var type = templateLiteralTypes.get(id); @@ -52050,11 +52688,12 @@ var ts; } function getStringMappingType(symbol, type) { return type.flags & (1048576 | 131072) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) : - type.flags & 268435456 && symbol === type.symbol ? type : - isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456) ? getTemplateLiteralType(["", ""], [type]) : type) : - type.flags & 128 ? getStringLiteralType(applyStringMapping(symbol, type.value)) : - type.flags & 134217728 ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) : - type; + type.flags & 128 ? getStringLiteralType(applyStringMapping(symbol, type.value)) : + type.flags & 134217728 ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) : + type.flags & 268435456 && symbol === type.symbol ? type : + type.flags & (1 | 4 | 268435456) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : + isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) : + type; } function applyStringMapping(symbol, str) { switch (intrinsicTypeKinds.get(symbol.escapedName)) { @@ -52135,7 +52774,7 @@ var ts; } function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, accessNode, accessFlags) { var _a; - var accessExpression = accessNode && accessNode.kind === 207 ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 209 ? accessNode : undefined; var propName = accessNode && ts.isPrivateIdentifier(accessNode) ? undefined : getPropertyNameFromIndex(indexType, accessNode); if (propName !== undefined) { if (accessFlags & 256) { @@ -52207,7 +52846,15 @@ var ts; return accessFlags & 1 ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; } errorIfWritingToReadonlyIndex(indexInfo); - return accessFlags & 1 ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; + if ((accessFlags & 1) && + !(objectType.symbol && + objectType.symbol.flags & (256 | 128) && + (indexType.symbol && + indexType.flags & 1024 && + getParentOfSymbol(indexType.symbol) === objectType.symbol))) { + return getUnionType([indexInfo.type, undefinedType]); + } + return indexInfo.type; } if (indexType.flags & 131072) { return neverType; @@ -52304,16 +52951,17 @@ var ts; } } function getIndexNodeForAccessExpression(accessNode) { - return accessNode.kind === 207 ? accessNode.argumentExpression : - accessNode.kind === 194 ? accessNode.indexType : - accessNode.kind === 162 ? accessNode.expression : + return accessNode.kind === 209 ? accessNode.argumentExpression : + accessNode.kind === 196 ? accessNode.indexType : + accessNode.kind === 164 ? accessNode.expression : accessNode; } function isPatternLiteralPlaceholderType(type) { - return !!(type.flags & (1 | 4 | 8 | 64)) || !!(type.flags & 268435456 && isPatternLiteralPlaceholderType(type.type)); + return !!(type.flags & (1 | 4 | 8 | 64)) || isPatternLiteralType(type); } function isPatternLiteralType(type) { - return !!(type.flags & 134217728) && ts.every(type.types, isPatternLiteralPlaceholderType); + return !!(type.flags & 134217728) && ts.every(type.types, isPatternLiteralPlaceholderType) || + !!(type.flags & 268435456) && isPatternLiteralPlaceholderType(type.type); } function isGenericType(type) { return !!getGenericObjectFlags(type); @@ -52335,7 +52983,7 @@ var ts; if (type.flags & 33554432) { if (!(type.objectFlags & 2097152)) { type.objectFlags |= 2097152 | - getGenericObjectFlags(type.substitute) | getGenericObjectFlags(type.baseType); + getGenericObjectFlags(type.baseType) | getGenericObjectFlags(type.constraint); } return type.objectFlags & 12582912; } @@ -52448,7 +53096,7 @@ var ts; } if (compilerOptions.noUncheckedIndexedAccess && accessFlags & 32) accessFlags |= 1; - if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 194 ? + if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 196 ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) { if (objectType.flags & 3) { @@ -52494,11 +53142,7 @@ var ts; var objectType = getTypeFromTypeNode(node.objectType); var indexType = getTypeFromTypeNode(node.indexType); var potentialAlias = getAliasSymbolForTypeNode(node); - var resolved = getIndexedAccessType(objectType, indexType, 0, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); - links.resolvedType = resolved.flags & 8388608 && - resolved.objectType === objectType && - resolved.indexType === indexType ? - getConditionalFlowTypeOfType(resolved, node) : resolved; + links.resolvedType = getIndexedAccessType(objectType, indexType, 0, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); } return links.resolvedType; } @@ -52545,18 +53189,18 @@ var ts; var result; var extraTypes; var tailCount = 0; - var _loop_19 = function () { + while (true) { if (tailCount === 1000) { error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); result = errorType; - return "break"; + break; } var isUnwrapped = isTypicalNondistributiveConditional(root); var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper); var checkTypeInstantiable = isGenericType(checkType); var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper); if (checkType === wildcardType || extendsType === wildcardType) { - return { value: wildcardType }; + return wildcardType; } var combinedMapper = void 0; if (root.inferTypeParameters) { @@ -52572,7 +53216,7 @@ var ts; } } } - if (!checkTypeInstantiable || !ts.some(root.inferTypeParameters, function (t) { return t === extendsType; })) { + if (!checkTypeInstantiable) { inferTypes(context.inferences, checkType, instantiateType(extendsType, freshMapper), 512 | 1024); } var innerMapper = combineTypeMappers(freshMapper, context.mapper); @@ -52589,23 +53233,23 @@ var ts; var newRoot = falseType_1.root; if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) { root = newRoot; - return "continue"; + continue; } if (canTailRecurse(falseType_1, mapper)) { - return "continue"; + continue; } } result = instantiateType(falseType_1, mapper); - return "break"; + break; } if (inferredExtendsType.flags & 3 || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(inferredExtendsType))) { var trueType_1 = getTypeFromTypeNode(root.node.trueType); var trueMapper = combinedMapper || mapper; if (canTailRecurse(trueType_1, trueMapper)) { - return "continue"; + continue; } result = instantiateType(trueType_1, trueMapper); - return "break"; + break; } } result = createType(16777216); @@ -52616,14 +53260,7 @@ var ts; result.combinedMapper = combinedMapper; result.aliasSymbol = aliasSymbol || root.aliasSymbol; result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); - return "break"; - }; - while (true) { - var state_5 = _loop_19(); - if (typeof state_5 === "object") - return state_5.value; - if (state_5 === "break") - break; + break; } return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result; function canTailRecurse(newType, newMapper) { @@ -52806,7 +53443,7 @@ var ts; } function getAliasSymbolForTypeNode(node) { var host = node.parent; - while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 145) { + while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 146) { host = host.parent; } return ts.isTypeAlias(host) ? getSymbolOfNode(host) : undefined; @@ -53040,7 +53677,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 258)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 261)) { if (!ts.isStatic(container) && (!ts.isConstructorDeclaration(container) || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -53071,17 +53708,17 @@ var ts; } function getArrayElementTypeNode(node) { switch (node.kind) { - case 191: + case 193: return getArrayElementTypeNode(node.type); - case 184: + case 186: if (node.elements.length === 1) { node = node.elements[0]; - if (node.kind === 186 || node.kind === 197 && node.dotDotDotToken) { + if (node.kind === 188 || node.kind === 199 && node.dotDotDotToken) { return getArrayElementTypeNode(node.type); } } break; - case 183: + case 185: return node.elementType; } return undefined; @@ -53097,94 +53734,94 @@ var ts; } function getTypeFromTypeNodeWorker(node) { switch (node.kind) { - case 130: - case 312: - case 313: + case 131: + case 315: + case 316: return anyType; - case 155: + case 157: return unknownType; - case 150: + case 152: return stringType; - case 147: + case 148: return numberType; - case 158: + case 160: return bigintType; - case 133: + case 134: return booleanType; - case 151: + case 153: return esSymbolType; case 114: return voidType; - case 153: + case 155: return undefinedType; case 104: return nullType; - case 143: + case 144: return neverType; - case 148: + case 149: return node.flags & 262144 && !noImplicitAny ? anyType : nonPrimitiveType; - case 138: + case 139: return intrinsicMarkerType; - case 192: + case 194: case 108: return getTypeFromThisTypeNode(node); - case 196: + case 198: return getTypeFromLiteralTypeNode(node); - case 178: + case 180: return getTypeFromTypeReference(node); - case 177: + case 179: return node.assertsModifier ? voidType : booleanType; - case 228: + case 230: return getTypeFromTypeReference(node); - case 181: - return getTypeFromTypeQueryNode(node); case 183: - case 184: - return getTypeFromArrayOrTupleTypeNode(node); + return getTypeFromTypeQueryNode(node); case 185: - return getTypeFromOptionalTypeNode(node); + case 186: + return getTypeFromArrayOrTupleTypeNode(node); case 187: + return getTypeFromOptionalTypeNode(node); + case 189: return getTypeFromUnionTypeNode(node); - case 188: + case 190: return getTypeFromIntersectionTypeNode(node); - case 314: + case 317: return getTypeFromJSDocNullableTypeNode(node); - case 316: + case 319: return addOptionality(getTypeFromTypeNode(node.type)); - case 197: + case 199: return getTypeFromNamedTupleTypeNode(node); - case 191: - case 315: - case 309: + case 193: + case 318: + case 312: return getTypeFromTypeNode(node.type); - case 186: + case 188: return getTypeFromRestTypeNode(node); - case 318: + case 321: return getTypeFromJSDocVariadicType(node); - case 179: - case 180: + case 181: case 182: - case 322: - case 317: - case 323: + case 184: + case 325: + case 320: + case 326: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 193: + case 195: return getTypeFromTypeOperatorNode(node); - case 194: + case 196: return getTypeFromIndexedAccessTypeNode(node); - case 195: + case 197: return getTypeFromMappedTypeNode(node); - case 189: + case 191: return getTypeFromConditionalTypeNode(node); - case 190: + case 192: return getTypeFromInferTypeNode(node); - case 198: - return getTypeFromTemplateTypeNode(node); case 200: + return getTypeFromTemplateTypeNode(node); + case 202: return getTypeFromImportTypeNode(node); case 79: - case 161: - case 206: + case 163: + case 208: var symbol = getSymbolAtLocation(node); return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; default: @@ -53287,8 +53924,8 @@ var ts; return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5, mapper, makeUnaryTypeMapper(source, target)); } function getRestrictiveTypeParameter(tp) { - return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), - tp.restrictiveInstantiation.constraint = unknownType, + return !tp.constraint && !getConstraintDeclaration(tp) || tp.constraint === noConstraintType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), + tp.restrictiveInstantiation.constraint = noConstraintType, tp.restrictiveInstantiation); } function cloneTypeParameter(typeParameter) { @@ -53380,14 +54017,14 @@ var ts; return type; } function maybeTypeParameterReference(node) { - return !(node.parent.kind === 178 && node.parent.typeArguments && node === node.parent.typeName || - node.parent.kind === 200 && node.parent.typeArguments && node === node.parent.qualifier); + return !(node.parent.kind === 180 && node.parent.typeArguments && node === node.parent.typeName || + node.parent.kind === 202 && node.parent.typeArguments && node === node.parent.qualifier); } function isTypeParameterPossiblyReferenced(tp, node) { if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container = tp.symbol.declarations[0].parent; for (var n = node; n !== container; n = n.parent) { - if (!n || n.kind === 235 || n.kind === 189 && ts.forEachChild(n.extendsType, containsReference)) { + if (!n || n.kind === 238 || n.kind === 191 && ts.forEachChild(n.extendsType, containsReference)) { return true; } } @@ -53396,15 +54033,33 @@ var ts; return true; function containsReference(node) { switch (node.kind) { - case 192: + case 194: return !!tp.isThisType; case 79: return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && getTypeFromTypeNodeWorker(node) === tp; - case 181: + case 183: + var entityName = node.exprName; + var firstIdentifier = ts.getFirstIdentifier(entityName); + var firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); + var tpDeclaration = tp.symbol.declarations[0]; + var tpScope_1; + if (tpDeclaration.kind === 165) { + tpScope_1 = tpDeclaration.parent; + } + else if (tp.isThisType) { + tpScope_1 = tpDeclaration; + } + else { + return true; + } + if (firstIdentifierSymbol.declarations) { + return ts.some(firstIdentifierSymbol.declarations, function (idDecl) { return ts.isNodeDescendantOf(idDecl, tpScope_1); }) || + ts.some(node.typeArguments, containsReference); + } return true; - case 169: - case 168: + case 171: + case 170: return !node.type && !!node.body || ts.some(node.typeParameters, containsReference) || ts.some(node.parameters, containsReference) || @@ -53600,17 +54255,15 @@ var ts; return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments); } if (flags & 33554432) { - var maybeVariable = instantiateType(type.baseType, mapper); - if (maybeVariable.flags & 8650752) { - return getSubstitutionType(maybeVariable, instantiateType(type.substitute, mapper)); + var newBaseType = instantiateType(type.baseType, mapper); + var newConstraint = instantiateType(type.constraint, mapper); + if (newBaseType.flags & 8650752 && isGenericType(newConstraint)) { + return getSubstitutionType(newBaseType, newConstraint); } - else { - var sub = instantiateType(type.substitute, mapper); - if (sub.flags & 3 || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) { - return maybeVariable; - } - return sub; + if (newConstraint.flags & 3 || isTypeAssignableTo(getRestrictiveInstantiation(newBaseType), getRestrictiveInstantiation(newConstraint))) { + return newBaseType; } + return newBaseType.flags & 8650752 ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); } return type; } @@ -53652,34 +54305,34 @@ var ts; return createIndexInfo(info.keyType, instantiateType(info.type, mapper), info.isReadonly, info.declaration); } function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 169 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 213: - case 214: - case 169: - case 256: + case 215: + case 216: + case 171: + case 259: return isContextSensitiveFunctionLikeDeclaration(node); - case 205: + case 207: return ts.some(node.properties, isContextSensitive); - case 204: + case 206: return ts.some(node.elements, isContextSensitive); - case 222: + case 224: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 221: + case 223: return (node.operatorToken.kind === 56 || node.operatorToken.kind === 60) && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 296: + case 299: return isContextSensitive(node.initializer); - case 212: + case 214: return isContextSensitive(node.expression); - case 286: + case 289: return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive); - case 285: { + case 288: { var initializer = node.initializer; return !!initializer && isContextSensitive(initializer); } - case 288: { + case 291: { var expression = node.expression; return !!expression && isContextSensitive(expression); } @@ -53687,14 +54340,13 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return (!ts.isFunctionDeclaration(node) || ts.isInJSFile(node) && !!getTypeForDeclarationFromJSDocComment(node)) && - (ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node)); + return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node); } function hasContextSensitiveReturnExpression(node) { - return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 && isContextSensitive(node.body); + return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 238 && isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { - return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && + return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { @@ -53772,23 +54424,23 @@ var ts; return true; } switch (node.kind) { - case 288: - case 212: + case 291: + case 214: return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); - case 221: + case 223: switch (node.operatorToken.kind) { case 63: case 27: return elaborateError(node.right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); } break; - case 205: + case 207: return elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 204: + case 206: return elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 286: + case 289: return elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 214: + case 216: return elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer); } return false; @@ -53984,16 +54636,16 @@ var ts; } function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) { switch (child.kind) { - case 288: + case 291: return { errorNode: child, innerExpression: child.expression, nameType: nameType }; case 11: if (child.containsOnlyTriviaWhiteSpaces) { break; } return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() }; - case 278: - case 279: + case 281: case 282: + case 285: return { errorNode: child, innerExpression: child, nameType: nameType }; default: return ts.Debug.assertNever(child, "Found invalid jsx child"); @@ -54135,11 +54787,11 @@ var ts; } _b = prop.kind; switch (_b) { - case 173: return [3, 2]; - case 172: return [3, 2]; - case 169: return [3, 2]; - case 297: return [3, 2]; - case 296: return [3, 4]; + case 175: return [3, 2]; + case 174: return [3, 2]; + case 171: return [3, 2]; + case 300: return [3, 2]; + case 299: return [3, 4]; } return [3, 6]; case 2: return [4, { errorNode: prop.name, innerExpression: undefined, nameType: type }]; @@ -54200,8 +54852,8 @@ var ts; void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers); } var kind = target.declaration ? target.declaration.kind : 0; - var strictVariance = !(checkMode & 3) && strictFunctionTypes && kind !== 169 && - kind !== 168 && kind !== 171; + var strictVariance = !(checkMode & 3) && strictFunctionTypes && kind !== 171 && + kind !== 170 && kind !== 173; var result = -1; var sourceThisType = getThisTypeOfSignature(source); if (sourceThisType && sourceThisType !== voidType) { @@ -54474,7 +55126,7 @@ var ts; var t = isFreshLiteralType(type) ? type.regularType : ts.getObjectFlags(type) & 4 ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 ? getNormalizedUnionOrIntersectionType(type, writing) : - type.flags & 33554432 ? writing ? type.baseType : type.substitute : + type.flags & 33554432 ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 ? getSimplifiedType(type, writing) : type; if (t === type) @@ -54824,7 +55476,8 @@ var ts; return 0; } } - var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2) && + var isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source)) && + !(intersectionState & 2) && source.flags & (131068 | 524288 | 2097152) && source !== globalObjectType && target.flags & (524288 | 2097152) && isWeakType(target) && (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)); @@ -54851,12 +55504,6 @@ var ts; var result_7 = skipCaching ? unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) : recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags); - if (result_7 && !inPropertyCheck && (target.flags & 2097152 && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) || - isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 && getApparentType(source).flags & 3670016 && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144); }))) { - inPropertyCheck = true; - result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4, recursionFlags); - inPropertyCheck = false; - } if (result_7) { return result_7; } @@ -55040,11 +55687,15 @@ var ts; return typeRelatedToEachType(source, target, reportErrors, 2); } if (relation === comparableRelation && target.flags & 131068) { - var constraints = ts.sameMap(source.types, getBaseConstraintOrType); + var constraints = ts.sameMap(source.types, function (t) { return t.flags & 465829888 ? getBaseConstraintOfType(t) || unknownType : t; }); if (constraints !== source.types) { source = getIntersectionType(constraints); + if (source.flags & 131072) { + return 0; + } if (!(source.flags & 2097152)) { - return isRelatedTo(source, target, 1, false); + return isRelatedTo(source, target, 1, false) || + isRelatedTo(target, source, 1, false); } } } @@ -55196,8 +55847,7 @@ var ts; if (overflow) { return 0; } - var keyIntersectionState = intersectionState | (inPropertyCheck ? 8 : 0); - var id = getRelationKey(source, target, keyIntersectionState, relation, false); + var id = getRelationKey(source, target, intersectionState, relation, false); var entry = relation.get(id); if (entry !== undefined) { if (reportErrors && entry & 2 && !(entry & 4)) { @@ -55221,7 +55871,7 @@ var ts; targetStack = []; } else { - var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, true) : undefined; + var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, intersectionState, relation, true) : undefined; for (var i = 0; i < maybeCount; i++) { if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) { return 3; @@ -55303,10 +55953,18 @@ var ts; function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) { var saveErrorInfo = captureErrorCalculationState(); var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo); - if (!result && (source.flags & 2097152 || source.flags & 262144 && target.flags & 1048576)) { - var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576)); - if (constraint && everyType(constraint, function (c) { return c !== source; })) { - result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState); + if (relation !== identityRelation) { + if (!result && (source.flags & 2097152 || source.flags & 262144 && target.flags & 1048576)) { + var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 ? source.types : [source], !!(target.flags & 1048576)); + if (constraint && everyType(constraint, function (c) { return c !== source; })) { + result = isRelatedTo(constraint, target, 1, false, undefined, intersectionState); + } + } + if (result && !inPropertyCheck && (target.flags & 2097152 && !isGenericObjectType(target) && source.flags & (524288 | 2097152) || + isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 && getApparentType(source).flags & 3670016 && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144); }))) { + inPropertyCheck = true; + result &= propertiesRelatedTo(source, target, reportErrors, undefined, 0); + inPropertyCheck = false; } } if (result) { @@ -55315,9 +55973,6 @@ var ts; return result; } function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) { - if (intersectionState & 4) { - return propertiesRelatedTo(source, target, reportErrors, undefined, 0); - } var result; var originalErrorInfo; var varianceCheckFailed = false; @@ -55355,7 +56010,11 @@ var ts; } } if (sourceFlags & 33554432) { - return isRelatedTo(source.substitute, target.substitute, 3, false); + if (result = isRelatedTo(source.baseType, target.baseType, 3, false)) { + if (result &= isRelatedTo(source.constraint, target.constraint, 3, false)) { + return result; + } + } } if (!(sourceFlags & 524288)) { return 0; @@ -55399,7 +56058,7 @@ var ts; if (relation === comparableRelation && sourceFlags & 262144) { var constraint = getConstraintOfTypeParameter(source); if (constraint && hasNonCircularBaseConstraint(source)) { - while (constraint && constraint.flags & 262144) { + while (constraint && someType(constraint, function (c) { return !!(c.flags & 262144); })) { if (result = isRelatedTo(constraint, target, 1, false)) { return result; } @@ -55906,7 +56565,7 @@ var ts; } return 0; } - if (!skipOptional && sourceProp.flags & 16777216 && !(targetProp.flags & 16777216)) { + if (!skipOptional && sourceProp.flags & 16777216 && targetProp.flags & 106500 && !(targetProp.flags & 16777216)) { if (reportErrors) { reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target)); } @@ -55936,7 +56595,7 @@ var ts; shouldSkipElaboration = true; } if (props.length === 1) { - var propName = symbolToString(unmatchedProperty); + var propName = symbolToString(unmatchedProperty, undefined, 0, 4 | 16); reportError.apply(void 0, __spreadArray([ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName], getTypeNamesForErrorDisplay(source, target), false)); if (ts.length(unmatchedProperty.declarations)) { associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName)); @@ -56168,7 +56827,7 @@ var ts; var targetSignature = ts.first(targetSignatures); result = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors, incompatibleReporter(sourceSignature, targetSignature)); if (!result && reportErrors && kind === 1 && (sourceObjectFlags & targetObjectFlags) && - (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 171 || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 171)) { + (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 173 || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 173)) { var constructSignatureToString = function (signature) { return signatureToString(signature, undefined, 262144, kind); }; @@ -56829,7 +57488,7 @@ var ts; var target = type.target; if (ts.getObjectFlags(target) & 1) { var baseTypeNode = getBaseTypeNodeOfClass(target); - if (baseTypeNode && baseTypeNode.expression.kind !== 79 && baseTypeNode.expression.kind !== 206) { + if (baseTypeNode && baseTypeNode.expression.kind !== 79 && baseTypeNode.expression.kind !== 208) { return undefined; } } @@ -56877,8 +57536,7 @@ var ts; return !!(type.flags & 109440); } function isUnitLikeType(type) { - return type.flags & 2097152 ? ts.some(type.types, isUnitType) : - !!(type.flags & 109440); + return isUnitType(getBaseConstraintOrType(type)); } function extractUnitType(type) { return type.flags & 2097152 ? ts.find(type.types, isUnitType) || type : type; @@ -56920,7 +57578,7 @@ var ts; if (!isLiteralOfContextualType(type, contextualType)) { type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type)); } - return type; + return getRegularTypeOfLiteralType(type); } function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) { if (type && isUnitType(type)) { @@ -57006,7 +57664,8 @@ var ts; function getOptionalType(type, isProperty) { if (isProperty === void 0) { isProperty = false; } ts.Debug.assert(strictNullChecks); - return type.flags & 32768 ? type : getUnionType([type, isProperty ? missingType : undefinedType]); + var missingOrUndefined = isProperty ? missingType : undefinedType; + return type.flags & 32768 || type.flags & 1048576 && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); } function getGlobalNonNullableTypeInstantiation(type) { if (!deferredGlobalNonNullableTypeAlias) { @@ -57249,12 +57908,12 @@ var ts; } var diagnostic; switch (declaration.kind) { - case 221: - case 167: - case 166: + case 223: + case 169: + case 168: diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 164: + case 166: var param = declaration; if (ts.isIdentifier(param.name) && (ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) && @@ -57270,22 +57929,22 @@ var ts; noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 203: + case 205: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; if (!noImplicitAny) { return; } break; - case 317: + case 320: error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; - case 256: - case 169: - case 168: - case 172: - case 173: - case 213: - case 214: + case 259: + case 171: + case 170: + case 174: + case 175: + case 215: + case 216: if (noImplicitAny && !declaration.name) { if (wideningKind === 3) { error(declaration, ts.Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); @@ -57299,7 +57958,7 @@ var ts; wideningKind === 3 ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type : ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; - case 195: + case 197: if (noImplicitAny) { error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); } @@ -57400,7 +58059,7 @@ var ts; if (context.intraExpressionInferenceSites) { for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) { var _b = _a[_i], node = _b.node, type = _b.type; - var contextualType = node.kind === 169 ? + var contextualType = node.kind === 171 ? getContextualTypeForObjectLiteralMethod(node, 2) : getContextualType(node, 2); if (contextualType) { @@ -57460,8 +58119,8 @@ var ts; } function isNonGenericTopLevelType(type) { if (type.aliasSymbol && !type.aliasTypeArguments) { - var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 259); - return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 305 ? true : n.kind === 261 ? false : "quit"; })); + var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 262); + return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 308 ? true : n.kind === 264 ? false : "quit"; })); } return false; } @@ -57642,7 +58301,7 @@ var ts; && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) })); } function isMemberOfStringMapping(source, target) { - if (target.flags & (4 | 3)) { + if (target.flags & (4 | 1)) { return true; } if (target.flags & 134217728) { @@ -57881,7 +58540,7 @@ var ts; } else if (source.flags & 33554432) { inferFromTypes(source.baseType, target); - inferWithPriority(source.substitute, target, 4); + inferWithPriority(getSubstitutionIntersection(source), target, 4); } else if (target.flags & 16777216) { invokeOnce(source, target, inferToConditionalType); @@ -58290,7 +58949,7 @@ var ts; function inferFromSignature(source, target) { var saveBivariant = bivariant; var kind = target.declaration ? target.declaration.kind : 0; - bivariant = bivariant || kind === 169 || kind === 168 || kind === 171; + bivariant = bivariant || kind === 171 || kind === 170 || kind === 173; applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes); bivariant = saveBivariant; applyToReturnTypes(source, target, inferFromTypes); @@ -58469,7 +59128,7 @@ var ts; return ts.Diagnostics.Cannot_find_name_0_Did_you_mean_to_write_this_in_an_async_function; } default: - if (node.parent.kind === 297) { + if (node.parent.kind === 300) { return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; } else { @@ -58486,7 +59145,7 @@ var ts; return links.resolvedSymbol; } function isInTypeQuery(node) { - return !!ts.findAncestor(node, function (n) { return n.kind === 181 ? true : n.kind === 79 || n.kind === 161 ? false : "quit"; }); + return !!ts.findAncestor(node, function (n) { return n.kind === 183 ? true : n.kind === 79 || n.kind === 163 ? false : "quit"; }); } function getFlowCacheKey(node, declaredType, initialType, flowContainer) { switch (node.kind) { @@ -58497,42 +59156,42 @@ var ts; } case 108: return "0|".concat(flowContainer ? getNodeId(flowContainer) : "-1", "|").concat(getTypeId(declaredType), "|").concat(getTypeId(initialType)); - case 230: - case 212: + case 232: + case 214: return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); - case 161: + case 163: var left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer); return left && left + "." + node.right.escapedText; - case 206: - case 207: + case 208: + case 209: var propName = getAccessedPropertyName(node); if (propName !== undefined) { var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && key + "." + propName; } break; - case 201: - case 202: - case 256: - case 213: - case 214: - case 169: + case 203: + case 204: + case 259: + case 215: + case 216: + case 171: return "".concat(getNodeId(node), "#").concat(getTypeId(declaredType)); } return undefined; } function isMatchingReference(source, target) { switch (target.kind) { - case 212: - case 230: + case 214: + case 232: return isMatchingReference(source, target.expression); - case 221: + case 223: return (ts.isAssignmentExpression(target) && isMatchingReference(source, target.left)) || (ts.isBinaryExpression(target) && target.operatorToken.kind === 27 && isMatchingReference(source, target.right)); } switch (source.kind) { - case 231: - return target.kind === 231 + case 233: + return target.kind === 233 && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; case 79: @@ -58540,26 +59199,26 @@ var ts; return ts.isThisInTypeQuery(source) ? target.kind === 108 : target.kind === 79 && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 254 || target.kind === 203) && + (target.kind === 257 || target.kind === 205) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 108: return target.kind === 108; case 106: return target.kind === 106; - case 230: - case 212: + case 232: + case 214: return isMatchingReference(source.expression, target); - case 206: - case 207: + case 208: + case 209: var sourcePropertyName = getAccessedPropertyName(source); var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined; return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); - case 161: + case 163: return ts.isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression); - case 221: + case 223: return (ts.isBinaryExpression(source) && source.operatorToken.kind === 27 && isMatchingReference(source.right, target)); } return false; @@ -58590,7 +59249,7 @@ var ts; } if (ts.isEntityNameExpression(node.argumentExpression)) { var symbol = resolveEntityName(node.argumentExpression, 111551, true); - if (!symbol || !isConstVariable(symbol)) + if (!symbol || !(isConstVariable(symbol) || (symbol.flags & 8))) return undefined; var declaration = symbol.valueDeclaration; if (declaration === undefined) @@ -58602,9 +59261,14 @@ var ts; return name; } } - if (ts.hasOnlyExpressionInitializer(declaration)) { + if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) { var initializer = ts.getEffectiveInitializer(declaration); - return initializer && tryGetNameFromType(getTypeOfExpression(initializer)); + if (initializer) { + return tryGetNameFromType(getTypeOfExpression(initializer)); + } + if (ts.isEnumMember(declaration)) { + return ts.getTextOfPropertyName(declaration.name); + } } } return undefined; @@ -58720,7 +59384,7 @@ var ts; } function getMatchingUnionConstituentForObjectLiteral(unionType, node) { var keyPropertyName = getKeyPropertyName(unionType); - var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 296 && + var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 299 && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); }); var propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); return propType && getConstituentTypeForKeyType(unionType, propType); @@ -58737,7 +59401,7 @@ var ts; } } } - if (expression.expression.kind === 206 && + if (expression.expression.kind === 208 && isOrContainsMatchingReference(reference, expression.expression.expression)) { return true; } @@ -58920,15 +59584,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(65, type, undefinedType, undefined) || errorType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 204 && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 296 && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 206 && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 299 && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 221 && parent.parent.left === parent || - parent.parent.kind === 244 && parent.parent.initializer === parent; + return parent.parent.kind === 223 && parent.parent.left === parent || + parent.parent.kind === 247 && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -58945,21 +59609,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 243: + case 246: return stringType; - case 244: + case 247: return checkRightHandSideOfForOf(parent) || errorType; - case 221: + case 223: return getAssignedTypeOfBinaryExpression(parent); - case 215: + case 217: return undefinedType; - case 204: + case 206: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 225: + case 227: return getAssignedTypeOfSpreadExpression(parent); - case 296: + case 299: return getAssignedTypeOfPropertyAssignment(parent); - case 297: + case 300: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return errorType; @@ -58967,7 +59631,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 201 ? + var type = pattern.kind === 203 ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -58982,30 +59646,30 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 243) { + if (node.parent.parent.kind === 246) { return stringType; } - if (node.parent.parent.kind === 244) { + if (node.parent.parent.kind === 247) { return checkRightHandSideOfForOf(node.parent.parent) || errorType; } return errorType; } function getInitialType(node) { - return node.kind === 254 ? + return node.kind === 257 ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function isEmptyArrayAssignment(node) { - return node.kind === 254 && node.initializer && + return node.kind === 257 && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 203 && node.parent.kind === 221 && + node.kind !== 205 && node.parent.kind === 223 && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 212: + case 214: return getReferenceCandidate(node.expression); - case 221: + case 223: switch (node.operatorToken.kind) { case 63: case 75: @@ -59020,13 +59684,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 212 || - parent.kind === 221 && parent.operatorToken.kind === 63 && parent.left === node || - parent.kind === 221 && parent.operatorToken.kind === 27 && parent.right === node ? + return parent.kind === 214 || + parent.kind === 223 && parent.operatorToken.kind === 63 && parent.left === node || + parent.kind === 223 && parent.operatorToken.kind === 27 && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 289) { + if (clause.kind === 292) { return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); } return neverType; @@ -59043,13 +59707,13 @@ var ts; return links.switchTypes; } function getSwitchClauseTypeOfWitnesses(switchStatement) { - if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 289 && !ts.isStringLiteralLike(clause.expression); })) { + if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 292 && !ts.isStringLiteralLike(clause.expression); })) { return undefined; } var witnesses = []; for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { var clause = _a[_i]; - var text = clause.kind === 289 ? clause.expression.text : undefined; + var text = clause.kind === 292 ? clause.expression.text : undefined; witnesses.push(text && !ts.contains(witnesses, text) ? text : undefined); } return witnesses; @@ -59216,12 +59880,12 @@ var ts; var root = getReferenceRoot(node); var parent = root.parent; var isLengthPushOrUnshift = ts.isPropertyAccessExpression(parent) && (parent.name.escapedText === "length" || - parent.parent.kind === 208 + parent.parent.kind === 210 && ts.isIdentifier(parent.name) && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 207 && + var isElementAssignment = parent.kind === 209 && parent.expression === root && - parent.parent.kind === 221 && + parent.parent.kind === 223 && parent.parent.operatorToken.kind === 63 && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -59234,6 +59898,7 @@ var ts; ts.isInJSFile(node) && ts.hasInitializer(node) && node.initializer && ts.isFunctionExpressionOrArrowFunction(node.initializer) && ts.getEffectiveReturnTypeNode(node.initializer)); } function getExplicitTypeOfSymbol(symbol, diagnostic) { + symbol = resolveSymbol(symbol); if (symbol.flags & (16 | 8192 | 32 | 512)) { return getTypeOfSymbol(symbol); } @@ -59249,7 +59914,7 @@ var ts; if (isDeclarationWithExplicitTypeAnnotation(declaration)) { return getTypeOfSymbol(symbol); } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247) { var statement = declaration.parent.parent; var expressionType = getTypeOfDottedName(statement.expression, undefined); if (expressionType) { @@ -59268,12 +59933,12 @@ var ts; switch (node.kind) { case 79: var symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node)); - return getExplicitTypeOfSymbol(symbol.flags & 2097152 ? resolveAlias(symbol) : symbol, diagnostic); + return getExplicitTypeOfSymbol(symbol, diagnostic); case 108: return getExplicitThisType(node); case 106: return checkSuperExpression(node); - case 206: { + case 208: { var type = getTypeOfDottedName(node.expression, diagnostic); if (type) { var name = node.name; @@ -59291,7 +59956,7 @@ var ts; } return undefined; } - case 212: + case 214: return getTypeOfDottedName(node.expression, diagnostic); } } @@ -59301,7 +59966,7 @@ var ts; var signature = links.effectsSignature; if (signature === undefined) { var funcType = void 0; - if (node.parent.kind === 238) { + if (node.parent.kind === 241) { funcType = getTypeOfDottedName(node.expression, undefined); } else if (node.expression.kind !== 106) { @@ -59345,7 +60010,7 @@ var ts; } function isFalseExpression(expr) { var node = ts.skipParentheses(expr, true); - return node.kind === 95 || node.kind === 221 && (node.operatorToken.kind === 55 && (isFalseExpression(node.left) || isFalseExpression(node.right)) || + return node.kind === 95 || node.kind === 223 && (node.operatorToken.kind === 55 && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 56 && isFalseExpression(node.left) && isFalseExpression(node.right)); } function isReachableFlowNodeWorker(flow, noCacheCheck) { @@ -59456,8 +60121,8 @@ var ts; var symbol = getResolvedSymbol(node); return isConstVariable(symbol) || ts.isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); } - case 206: - case 207: + case 208: + case 209: return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol); } return false; @@ -59479,7 +60144,7 @@ var ts; var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(flowNode)); sharedFlowCount = sharedFlowStart; var resultType = ts.getObjectFlags(evolvedType) & 256 && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 230 && !(resultType.flags & 131072) && getTypeWithFacts(resultType, 2097152).flags & 131072) { + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 232 && !(resultType.flags & 131072) && getTypeWithFacts(resultType, 2097152).flags & 131072) { return declaredType; } return resultType === nonNullUnknownType ? unknownType : resultType; @@ -59557,8 +60222,8 @@ var ts; else if (flags & 2) { var container = flow.node; if (container && container !== flowContainer && - reference.kind !== 206 && - reference.kind !== 207 && + reference.kind !== 208 && + reference.kind !== 209 && reference.kind !== 108) { flow = container.flowNode; continue; @@ -59579,7 +60244,7 @@ var ts; } function getInitialOrAssignedType(flow) { var node = flow.node; - return getNarrowableTypeForReference(node.kind === 254 || node.kind === 203 ? + return getNarrowableTypeForReference(node.kind === 257 || node.kind === 205 ? getInitialType(node) : getAssignedType(node), reference); } @@ -59611,13 +60276,13 @@ var ts; } if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) { var init = ts.getDeclaredExpandoInitializer(node); - if (init && (init.kind === 213 || init.kind === 214)) { + if (init && (init.kind === 215 || init.kind === 216)) { return getTypeAtFlowNode(flow.antecedent); } } return declaredType; } - if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 && isMatchingReference(reference, node.parent.parent.expression)) { + if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 246 && isMatchingReference(reference, node.parent.parent.expression)) { return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)))); } return undefined; @@ -59627,7 +60292,7 @@ var ts; if (node.kind === 95) { return unreachableNeverType; } - if (node.kind === 221) { + if (node.kind === 223) { if (node.operatorToken.kind === 55) { return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right); } @@ -59658,7 +60323,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 208 ? + var expr = node.kind === 210 ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -59666,7 +60331,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256) { var evolvedType_1 = type; - if (node.kind === 208) { + if (node.kind === 210) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -59706,15 +60371,15 @@ var ts; if (isMatchingReference(reference, expr)) { type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } - else if (expr.kind === 216 && isMatchingReference(reference, expr.expression)) { - type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); + else if (expr.kind === 218 && isMatchingReference(reference, expr.expression)) { + type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } else { if (strictNullChecks) { if (optionalChainContainsReference(expr, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & (32768 | 131072)); }); } - else if (expr.kind === 216 && optionalChainContainsReference(expr.expression, reference)) { + else if (expr.kind === 218 && optionalChainContainsReference(expr.expression, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & 131072 || t.flags & 128 && t.value === "undefined"); }); } } @@ -59894,7 +60559,7 @@ var ts; var narrowedPropType = narrowType(propType); return filterType(type, function (t) { var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName); - return !(narrowedPropType.flags & 131072) && areTypesComparable(narrowedPropType, discriminantType); + return !(discriminantType.flags & 131072) && !(narrowedPropType.flags & 131072) && areTypesComparable(narrowedPropType, discriminantType); }); } function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { @@ -59936,18 +60601,22 @@ var ts; } function isTypePresencePossible(type, propName, assumeTrue) { var prop = getPropertyOfType(type, propName); - if (prop) { - return prop.flags & 16777216 ? true : assumeTrue; - } - return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue; - } - function narrowByInKeyword(type, name, assumeTrue) { - if (type.flags & 1048576 - || type.flags & 524288 && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type)) - || ts.isThisTypeParameter(type) - || type.flags & 2097152 && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) { + return prop ? + !!(prop.flags & 16777216) || assumeTrue : + !!getApplicableIndexInfoForName(type, propName) || !assumeTrue; + } + function narrowTypeByInKeyword(type, nameType, assumeTrue) { + var name = getPropertyNameFromType(nameType); + var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, true); }); + if (isKnownProperty) { return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); }); } + if (assumeTrue) { + var recordSymbol = getGlobalRecordSymbol(); + if (recordSymbol) { + return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]); + } + } return type; } function narrowTypeByBinaryExpression(type, expr, assumeTrue) { @@ -59964,10 +60633,10 @@ var ts; var operator = expr.operatorToken.kind; var left = getReferenceCandidate(expr.left); var right = getReferenceCandidate(expr.right); - if (left.kind === 216 && ts.isStringLiteralLike(right)) { + if (left.kind === 218 && ts.isStringLiteralLike(right)) { return narrowTypeByTypeof(type, left, operator, right, assumeTrue); } - if (right.kind === 216 && ts.isStringLiteralLike(left)) { + if (right.kind === 218 && ts.isStringLiteralLike(left)) { return narrowTypeByTypeof(type, right, operator, left, assumeTrue); } if (isMatchingReference(reference, left)) { @@ -60006,15 +60675,14 @@ var ts; return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue); } var target = getReferenceCandidate(expr.right); - var leftType = getTypeOfNode(expr.left); - if (leftType.flags & 128) { - var name = ts.escapeLeadingUnderscores(leftType.value); + var leftType = getTypeOfExpression(expr.left); + if (leftType.flags & 8576) { if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) && - getAccessedPropertyName(reference) === name) { + getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) { return getTypeWithFacts(type, assumeTrue ? 524288 : 65536); } if (isMatchingReference(reference, target)) { - return narrowByInKeyword(type, name, assumeTrue); + return narrowTypeByInKeyword(type, leftType, assumeTrue); } } break; @@ -60063,24 +60731,11 @@ var ts; assumeTrue = !assumeTrue; } var valueType = getTypeOfExpression(value); - if (((type.flags & 2) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304)) && - assumeTrue && - (operator === 36 || operator === 37)) { - if (valueType.flags & (131068 | 67108864)) { - return valueType; - } - if (valueType.flags & 524288) { - return nonPrimitiveType; - } - if (type.flags & 2) { - return type; - } - } + var doubleEquals = operator === 34 || operator === 35; if (valueType.flags & 98304) { if (!strictNullChecks) { return type; } - var doubleEquals = operator === 34 || operator === 35; var facts = doubleEquals ? assumeTrue ? 262144 : 2097152 : valueType.flags & 65536 ? @@ -60089,10 +60744,16 @@ var ts; return getAdjustedTypeWithFacts(type, facts); } if (assumeTrue) { - var filterFn = operator === 34 ? - function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); } : - function (t) { return areTypesComparable(t, valueType); }; - return replacePrimitivesWithLiterals(filterType(type, filterFn), valueType); + if (!doubleEquals && (type.flags & 2 || someType(type, isEmptyAnonymousObjectType))) { + if (valueType.flags & (131068 | 67108864) || isEmptyAnonymousObjectType(valueType)) { + return valueType; + } + if (valueType.flags & 524288) { + return nonPrimitiveType; + } + } + var filteredType = filterType(type, function (t) { return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); }); + return replacePrimitivesWithLiterals(filteredType, valueType); } if (isUnitType(valueType)) { return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); }); @@ -60105,11 +60766,18 @@ var ts; } var target = getReferenceCandidate(typeOfExpr.expression); if (!isMatchingReference(reference, target)) { + var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type); + if (propertyAccess) { + return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); }); + } if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) { return getAdjustedTypeWithFacts(type, 2097152); } return type; } + return narrowTypeByLiteralExpression(type, literal, assumeTrue); + } + function narrowTypeByLiteralExpression(type, literal, assumeTrue) { return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768); @@ -60176,12 +60844,12 @@ var ts; neverType; }); } - function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) { + function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) { var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement); if (!witnesses) { return type; } - var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 290; }); + var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 293; }); var hasDefaultClause = clauseStart === clauseEnd || (defaultIndex >= clauseStart && defaultIndex < clauseEnd); if (hasDefaultClause) { var notEqualFacts_1 = getNotEqualFactsFromTypeofSwitch(clauseStart, clauseEnd, witnesses); @@ -60350,17 +61018,17 @@ var ts; } case 108: case 106: - case 206: - case 207: - return narrowTypeByTruthiness(type, expr, assumeTrue); case 208: + case 209: + return narrowTypeByTruthiness(type, expr, assumeTrue); + case 210: return narrowTypeByCallExpression(type, expr, assumeTrue); - case 212: - case 230: + case 214: + case 232: return narrowType(type, expr.expression, assumeTrue); - case 221: + case 223: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 219: + case 221: if (expr.operator === 53) { return narrowType(type, expr.operand, !assumeTrue); } @@ -60400,9 +61068,9 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 262 || - node.kind === 305 || - node.kind === 167; + node.kind === 265 || + node.kind === 308 || + node.kind === 169; }); } function isSymbolAssigned(symbol) { @@ -60443,7 +61111,7 @@ var ts; function removeOptionalityFromDeclaredType(declaredType, declaration) { if (pushTypeResolution(declaration.symbol, 2)) { var annotationIncludesUndefined = strictNullChecks && - declaration.kind === 164 && + declaration.kind === 166 && declaration.initializer && getTypeFacts(declaredType) & 16777216 && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216); @@ -60457,10 +61125,10 @@ var ts; } function isConstraintPosition(type, node) { var parent = node.parent; - return parent.kind === 206 || - parent.kind === 161 || - parent.kind === 208 && parent.expression === node || - parent.kind === 207 && parent.expression === node && + return parent.kind === 208 || + parent.kind === 163 || + parent.kind === 210 && parent.expression === node || + parent.kind === 209 && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression))); } function isGenericTypeWithUnionConstraint(type) { @@ -60503,12 +61171,12 @@ var ts; }); } function markAliasReferenced(symbol, location) { - if (isNonLocalAlias(symbol, 111551) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, 111551) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551)) { var target = resolveAlias(symbol); - if (target.flags & 111551) { + if (getAllSymbolFlags(target) & (111551 | 1048576)) { if (compilerOptions.isolatedModules || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) || - !isConstEnumOrConstEnumOnlyModule(target)) { + !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) { markAliasSymbolAsReferenced(symbol); } else { @@ -60522,15 +61190,16 @@ var ts; if (declaration) { if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) { var parent = declaration.parent.parent; - if (parent.kind === 254 && ts.getCombinedNodeFlags(declaration) & 2 || parent.kind === 164) { + if (parent.kind === 257 && ts.getCombinedNodeFlags(declaration) & 2 || parent.kind === 166) { var links = getNodeLinks(parent); if (!(links.flags & 268435456)) { links.flags |= 268435456; var parentType = getTypeForBindingElementParent(parent, 0); + var parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~268435456; - if (parentType && parentType.flags & 1048576 && !(parent.kind === 164 && isSymbolAssigned(symbol))) { + if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 && !(parent.kind === 166 && isSymbolAssigned(symbol))) { var pattern = declaration.parent; - var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, undefined, location.flowNode); + var narrowedType = getFlowTypeOfReference(pattern, parentTypeConstraint, parentTypeConstraint, undefined, location.flowNode); if (narrowedType.flags & 131072) { return neverType; } @@ -60571,10 +61240,10 @@ var ts; } var container = ts.getContainingFunction(node); if (languageVersion < 2) { - if (container.kind === 214) { + if (container.kind === 216) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } - else if (ts.hasSyntacticModifier(container, 256)) { + else if (ts.hasSyntacticModifier(container, 512)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } @@ -60591,7 +61260,7 @@ var ts; } var declaration = localOrExportSymbol.valueDeclaration; if (declaration && localOrExportSymbol.flags & 32) { - if (declaration.kind === 257 + if (declaration.kind === 260 && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -60603,9 +61272,9 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 226) { + else if (declaration.kind === 228) { var container = ts.getThisContainer(node, false); - while (container.kind !== 305) { + while (container.kind !== 308) { if (container.parent === declaration) { if (ts.isPropertyDeclaration(container) && ts.isStatic(container) || ts.isClassStaticBlockDeclaration(container)) { getNodeLinks(declaration).flags |= 16777216; @@ -60658,22 +61327,22 @@ var ts; return type; } type = getNarrowableTypeForReference(type, node, checkMode); - var isParameter = ts.getRootDeclaration(declaration).kind === 164; + var isParameter = ts.getRootDeclaration(declaration).kind === 166; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; var isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && ts.isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent); var isModuleExports = symbol.flags & 134217728; - while (flowContainer !== declarationContainer && (flowContainer.kind === 213 || - flowContainer.kind === 214 || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 215 || + flowContainer.kind === 216 || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } - var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) || + var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 | 16384)) !== 0 || - isInTypeQuery(node) || node.parent.kind === 275) || - node.parent.kind === 230 || - declaration.kind === 254 && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 278) || + node.parent.kind === 232 || + declaration.kind === 257 && declaration.exclamationToken || declaration.flags & 16777216; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -60694,6 +61363,12 @@ var ts; } return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } + function isSameScopedBindingElement(node, declaration) { + if (ts.isBindingElement(declaration)) { + var bindingElement = ts.findAncestor(node, ts.isBindingElement); + return bindingElement && ts.getRootDeclaration(bindingElement) === ts.getRootDeclaration(declaration); + } + } function shouldMarkIdentifierAliasReferenced(node) { var _a; var parent = node.parent; @@ -60725,7 +61400,7 @@ var ts; (symbol.flags & (2 | 32)) === 0 || !symbol.valueDeclaration || ts.isSourceFile(symbol.valueDeclaration) || - symbol.valueDeclaration.parent.kind === 292) { + symbol.valueDeclaration.parent.kind === 295) { return; } var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration); @@ -60735,7 +61410,7 @@ var ts; if (isCaptured) { var capturesBlockScopeBindingInLoopBody = true; if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258); if (varDeclList && varDeclList.parent === container) { var part = getPartOfForStatementContainingNode(node.parent, container); if (part) { @@ -60754,7 +61429,7 @@ var ts; } } if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258); if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 4194304; } @@ -60771,14 +61446,14 @@ var ts; } function isAssignedInBodyOfForStatement(node, container) { var current = node; - while (current.parent.kind === 212) { + while (current.parent.kind === 214) { current = current.parent; } var isAssigned = false; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 219 || current.parent.kind === 220)) { + else if ((current.parent.kind === 221 || current.parent.kind === 222)) { var expr = current.parent; isAssigned = expr.operator === 45 || expr.operator === 46; } @@ -60789,7 +61464,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2; - if (container.kind === 167 || container.kind === 171) { + if (container.kind === 169 || container.kind === 173) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4; } @@ -60827,27 +61502,27 @@ var ts; var isNodeInTypeQuery = isInTypeQuery(node); var container = ts.getThisContainer(node, true); var capturedByArrowFunction = false; - if (container.kind === 171) { + if (container.kind === 173) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } - if (container.kind === 214) { + if (container.kind === 216) { container = ts.getThisContainer(container, false); capturedByArrowFunction = true; } checkThisInStaticClassFieldInitializerInDecoratedClass(node, container); switch (container.kind) { - case 261: + case 264: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); break; - case 260: + case 263: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); break; - case 171: + case 173: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); } break; - case 162: + case 164: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -60928,7 +61603,7 @@ var ts; } } function getClassNameFromPrototypeMethod(container) { - if (container.kind === 213 && + if (container.kind === 215 && ts.isBinaryExpression(container.parent) && ts.getAssignmentDeclarationKind(container.parent) === 3) { return container.parent @@ -60936,20 +61611,20 @@ var ts; .expression .expression; } - else if (container.kind === 169 && - container.parent.kind === 205 && + else if (container.kind === 171 && + container.parent.kind === 207 && ts.isBinaryExpression(container.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent) === 6) { return container.parent.parent.left.expression; } - else if (container.kind === 213 && - container.parent.kind === 296 && - container.parent.parent.kind === 205 && + else if (container.kind === 215 && + container.parent.kind === 299 && + container.parent.parent.kind === 207 && ts.isBinaryExpression(container.parent.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6) { return container.parent.parent.parent.left.expression; } - else if (container.kind === 213 && + else if (container.kind === 215 && ts.isPropertyAssignment(container.parent) && ts.isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && @@ -60971,7 +61646,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 317) { + if (jsdocType && jsdocType.kind === 320) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -60985,30 +61660,35 @@ var ts; } } function isInConstructorArgumentInitializer(node, constructorDecl) { - return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 164 && n.parent === constructorDecl; }); + return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 166 && n.parent === constructorDecl; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 208 && node.parent.expression === node; + var isCallExpression = node.parent.kind === 210 && node.parent.expression === node; var immediateContainer = ts.getSuperContainer(node, true); var container = immediateContainer; var needToCaptureLexicalThis = false; + var inAsyncFunction = false; if (!isCallExpression) { - while (container && container.kind === 214) { + while (container && container.kind === 216) { + if (ts.hasSyntacticModifier(container, 512)) + inAsyncFunction = true; container = ts.getSuperContainer(container, true); needToCaptureLexicalThis = languageVersion < 2; } + if (container && ts.hasSyntacticModifier(container, 512)) + inAsyncFunction = true; } var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; if (!canUseSuperExpression) { - var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 162; }); - if (current && current.kind === 162) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 164; }); + if (current && current.kind === 164) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 205)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 207)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -61016,7 +61696,7 @@ var ts; } return errorType; } - if (!isCallExpression && immediateContainer.kind === 171) { + if (!isCallExpression && immediateContainer.kind === 173) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if (ts.isStatic(container) || isCallExpression) { @@ -61035,7 +61715,7 @@ var ts; nodeCheckFlag = 256; } getNodeLinks(node).flags |= nodeCheckFlag; - if (container.kind === 169 && ts.hasSyntacticModifier(container, 256)) { + if (container.kind === 171 && inAsyncFunction) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { getNodeLinks(container).flags |= 4096; } @@ -61046,7 +61726,7 @@ var ts; if (needToCaptureLexicalThis) { captureLexicalThis(node.parent, container); } - if (container.parent.kind === 205) { + if (container.parent.kind === 207) { if (languageVersion < 2) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return errorType; @@ -61065,7 +61745,7 @@ var ts; if (!baseClassType) { return errorType; } - if (container.kind === 171 && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 173 && isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return errorType; } @@ -61077,26 +61757,26 @@ var ts; return false; } if (isCallExpression) { - return container.kind === 171; + return container.kind === 173; } else { - if (ts.isClassLike(container.parent) || container.parent.kind === 205) { + if (ts.isClassLike(container.parent) || container.parent.kind === 207) { if (ts.isStatic(container)) { - return container.kind === 169 || - container.kind === 168 || - container.kind === 172 || - container.kind === 173 || - container.kind === 167 || - container.kind === 170; + return container.kind === 171 || + container.kind === 170 || + container.kind === 174 || + container.kind === 175 || + container.kind === 169 || + container.kind === 172; } else { - return container.kind === 169 || + return container.kind === 171 || + container.kind === 170 || + container.kind === 174 || + container.kind === 175 || + container.kind === 169 || container.kind === 168 || - container.kind === 172 || - container.kind === 173 || - container.kind === 167 || - container.kind === 166 || - container.kind === 171; + container.kind === 173; } } } @@ -61104,10 +61784,10 @@ var ts; } } function getContainingObjectLiteral(func) { - return (func.kind === 169 || - func.kind === 172 || - func.kind === 173) && func.parent.kind === 205 ? func.parent : - func.kind === 213 && func.parent.kind === 296 ? func.parent.parent : + return (func.kind === 171 || + func.kind === 174 || + func.kind === 175) && func.parent.kind === 207 ? func.parent : + func.kind === 215 && func.parent.kind === 299 ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -61119,7 +61799,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 214) { + if (func.kind === 216) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -61143,7 +61823,7 @@ var ts; if (thisType) { return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); } - if (literal.parent.kind !== 296) { + if (literal.parent.kind !== 299) { break; } literal = literal.parent.parent; @@ -61152,7 +61832,7 @@ var ts; return getWidenedType(contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral)); } var parent = ts.walkUpParenthesizedExpressions(func.parent); - if (parent.kind === 221 && parent.operatorToken.kind === 63) { + if (parent.kind === 223 && parent.operatorToken.kind === 63) { var target = parent.left; if (ts.isAccessExpression(target)) { var expression = target.expression; @@ -61203,11 +61883,11 @@ var ts; return getTypeFromTypeNode(typeNode); } switch (declaration.kind) { - case 164: + case 166: return getContextuallyTypedParameterType(declaration); - case 203: + case 205: return getContextualTypeForBindingElement(declaration, contextFlags); - case 167: + case 169: if (ts.isStatic(declaration)) { return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags); } @@ -61217,10 +61897,10 @@ var ts; var parent = declaration.parent.parent; var name = declaration.propertyName || declaration.name; var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || - parent.kind !== 203 && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 : 0); + parent.kind !== 205 && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 : 0); if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name)) return undefined; - if (parent.name.kind === 202) { + if (parent.name.kind === 204) { var index = ts.indexOfNode(declaration.parent.elements, declaration); if (index < 0) return undefined; @@ -61360,7 +62040,7 @@ var ts; getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 210) { + if (template.parent.kind === 212) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -61464,8 +62144,11 @@ var ts; case 1: case 6: case 3: - var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; case 2: + var valueDeclaration = void 0; + if (kind !== 2) { + valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; + } valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration); var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration); return annotated ? getTypeFromTypeNode(annotated) : undefined; @@ -61621,21 +62304,21 @@ var ts; case 95: case 104: case 79: - case 153: + case 155: return true; - case 206: - case 212: + case 208: + case 214: return isPossiblyDiscriminantValue(node.expression); - case 288: + case 291: return !node.expression || isPossiblyDiscriminantValue(node.expression); } return false; } function discriminateContextualTypeByObjectMembers(node, contextualType) { - return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 296 && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 299 && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } function discriminateContextualTypeByJSXAttributes(node, contextualType) { - return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 285 && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 288 && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } function getApparentTypeOfContextualType(node, contextFlags) { var contextualType = ts.isObjectLiteralMethod(node) ? @@ -61652,7 +62335,7 @@ var ts; function instantiateContextualType(contextualType, node, contextFlags) { if (contextualType && maybeTypeOfKind(contextualType, 465829888)) { var inferenceContext = getInferenceContext(node); - if (inferenceContext && contextFlags & 1 && ts.some(inferenceContext.inferences, hasInferenceCandidates)) { + if (inferenceContext && contextFlags & 1 && ts.some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) { return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper); } if (inferenceContext === null || inferenceContext === void 0 ? void 0 : inferenceContext.returnMapper) { @@ -61685,59 +62368,61 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 254: - case 164: - case 167: + case 257: case 166: - case 203: + case 169: + case 168: + case 205: return getContextualTypeForInitializerExpression(node, contextFlags); - case 214: - case 247: + case 216: + case 250: return getContextualTypeForReturnExpression(node, contextFlags); - case 224: + case 226: return getContextualTypeForYieldOperand(parent, contextFlags); - case 218: + case 220: return getContextualTypeForAwaitOperand(parent, contextFlags); - case 208: - case 209: - return getContextualTypeForArgument(parent, node); + case 210: case 211: - case 229: + return getContextualTypeForArgument(parent, node); + case 213: + case 231: return ts.isConstTypeReference(parent.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(parent.type); - case 221: + case 223: return getContextualTypeForBinaryOperand(node, contextFlags); - case 296: - case 297: + case 299: + case 300: return getContextualTypeForObjectLiteralElement(parent, contextFlags); - case 298: + case 301: return getContextualType(parent.parent, contextFlags); - case 204: { + case 206: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 222: + case 224: return getContextualTypeForConditionalOperand(node, contextFlags); - case 233: - ts.Debug.assert(parent.parent.kind === 223); + case 236: + ts.Debug.assert(parent.parent.kind === 225); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 212: { + case 214: { var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return !tag ? getContextualType(parent, contextFlags) : ts.isJSDocTypeTag(tag) && ts.isConstTypeReference(tag.typeExpression.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(tag.typeExpression.type); } - case 230: + case 232: return getContextualType(parent, contextFlags); - case 271: + case 235: + return getTypeFromTypeNode(parent.type); + case 274: return tryGetTypeFromEffectiveTypeNode(parent); - case 288: + case 291: return getContextualTypeForJsxExpression(parent, contextFlags); - case 285: - case 287: + case 288: + case 290: return getContextualTypeForJsxAttribute(parent, contextFlags); - case 280: - case 279: + case 283: + case 282: return getContextualJsxElementAttributesType(parent, contextFlags); } return undefined; @@ -61849,9 +62534,14 @@ var ts; if (!isErrorType(intrinsicClassAttribs)) { var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); var hostClassType = getReturnTypeOfSignature(sig); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context))) - : intrinsicClassAttribs, apparentAttributesType); + var libraryManagedAttributeType = void 0; + if (typeParams) { + var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context)); + libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs)); + } + else + libraryManagedAttributeType = intrinsicClassAttribs; + apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType); } var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (!isErrorType(intrinsicAttribs)) { @@ -61959,7 +62649,7 @@ var ts; : undefined; } function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 169 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 || ts.isObjectLiteralMethod(node)); var typeTagSignature = getSignatureOfTypeTag(node); if (typeTagSignature) { return typeTagSignature; @@ -62003,8 +62693,8 @@ var ts; return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type; } function hasDefaultValue(node) { - return (node.kind === 203 && !!node.initializer) || - (node.kind === 221 && node.operatorToken.kind === 63); + return (node.kind === 205 && !!node.initializer) || + (node.kind === 223 && node.operatorToken.kind === 63); } function checkArrayLiteral(node, checkMode, forceTuple) { var elements = node.elements; @@ -62017,7 +62707,7 @@ var ts; var hasOmittedExpression = false; for (var i = 0; i < elementCount; i++) { var e = elements[i]; - if (e.kind === 225) { + if (e.kind === 227) { if (languageVersion < 2) { checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 : 1024); } @@ -62038,7 +62728,7 @@ var ts; elementFlags.push(4); } } - else if (exactOptionalPropertyTypes && e.kind === 227) { + else if (exactOptionalPropertyTypes && e.kind === 229) { hasOmittedExpression = true; elementTypes.push(missingType); elementFlags.push(2); @@ -62078,7 +62768,7 @@ var ts; } function isNumericName(name) { switch (name.kind) { - case 162: + case 164: return isNumericComputedName(name); case 79: return ts.isNumericLiteralName(name.escapedText); @@ -62097,7 +62787,7 @@ var ts; if (!links.resolvedType) { if ((ts.isTypeLiteralNode(node.parent.parent) || ts.isClassLike(node.parent.parent) || ts.isInterfaceDeclaration(node.parent.parent)) && ts.isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 101 - && node.parent.kind !== 172 && node.parent.kind !== 173) { + && node.parent.kind !== 174 && node.parent.kind !== 175) { return links.resolvedType = errorType; } links.resolvedType = checkExpression(node.expression); @@ -62162,7 +62852,7 @@ var ts; var spread = emptyObjectType; var contextualType = getApparentTypeOfContextualType(node, undefined); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 201 || contextualType.pattern.kind === 205); + (contextualType.pattern.kind === 203 || contextualType.pattern.kind === 207); var inConstContext = isConstContext(node); var checkFlags = inConstContext ? 8 : 0; var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node); @@ -62183,13 +62873,13 @@ var ts; for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var memberDecl = _c[_b]; var member = getSymbolOfNode(memberDecl); - var computedNameType = memberDecl.name && memberDecl.name.kind === 162 ? + var computedNameType = memberDecl.name && memberDecl.name.kind === 164 ? checkComputedPropertyName(memberDecl.name) : undefined; - if (memberDecl.kind === 296 || - memberDecl.kind === 297 || + if (memberDecl.kind === 299 || + memberDecl.kind === 300 || ts.isObjectLiteralMethod(memberDecl)) { - var type = memberDecl.kind === 296 ? checkPropertyAssignment(memberDecl, checkMode) : - memberDecl.kind === 297 ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : + var type = memberDecl.kind === 299 ? checkPropertyAssignment(memberDecl, checkMode) : + memberDecl.kind === 300 ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode); if (isInJavascript) { var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); @@ -62210,8 +62900,8 @@ var ts; prop.nameType = nameType; } if (inDestructuringPattern) { - var isOptional = (memberDecl.kind === 296 && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 297 && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 299 && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 300 && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216; } @@ -62235,14 +62925,14 @@ var ts; member = prop; allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop); if (contextualType && checkMode && checkMode & 2 && !(checkMode & 4) && - (memberDecl.kind === 296 || memberDecl.kind === 169) && isContextSensitive(memberDecl)) { + (memberDecl.kind === 299 || memberDecl.kind === 171) && isContextSensitive(memberDecl)) { var inferenceContext = getInferenceContext(node); ts.Debug.assert(inferenceContext); - var inferenceNode = memberDecl.kind === 296 ? memberDecl.initializer : memberDecl; + var inferenceNode = memberDecl.kind === 299 ? memberDecl.initializer : memberDecl; addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type); } } - else if (memberDecl.kind === 298) { + else if (memberDecl.kind === 301) { if (languageVersion < 2) { checkExternalEmitHelpers(memberDecl, 2); } @@ -62273,7 +62963,7 @@ var ts; continue; } else { - ts.Debug.assert(memberDecl.kind === 172 || memberDecl.kind === 173); + ts.Debug.assert(memberDecl.kind === 174 || memberDecl.kind === 175); checkNodeDeferred(memberDecl); } if (computedNameType && !(computedNameType.flags & 8576)) { @@ -62297,15 +62987,26 @@ var ts; } propertiesArray.push(member); } - if (contextualTypeHasPattern && node.parent.kind !== 298) { - for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { - var prop = _e[_d]; - if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { - if (!(prop.flags & 16777216)) { - error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + if (contextualTypeHasPattern) { + var rootPatternParent_1 = ts.findAncestor(contextualType.pattern.parent, function (n) { + return n.kind === 257 || + n.kind === 223 || + n.kind === 166; + }); + var spreadOrOutsideRootObject = ts.findAncestor(node, function (n) { + return n === rootPatternParent_1 || + n.kind === 301; + }); + if (spreadOrOutsideRootObject.kind !== 301) { + for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { + var prop = _e[_d]; + if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { + if (!(prop.flags & 16777216)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable.set(prop.escapedName, prop); + propertiesArray.push(prop); } - propertiesTable.set(prop.escapedName, prop); - propertiesArray.push(prop); } } } @@ -62396,6 +63097,7 @@ var ts; } function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) { var attributes = openingLikeElement.attributes; + var attributesType = getContextualType(attributes, 0); var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined; var attributesTable = ts.createSymbolTable(); var spread = emptyJsxObjectType; @@ -62423,9 +63125,15 @@ var ts; if (attributeDecl.name.escapedText === jsxChildrenPropertyName) { explicitlySpecifyChildrenAttribute = true; } + if (attributesType) { + var prop = getPropertyOfType(attributesType, member.escapedName); + if (prop && prop.declarations && isDeprecatedSymbol(prop)) { + addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText); + } + } } else { - ts.Debug.assert(attributeDecl.kind === 287); + ts.Debug.assert(attributeDecl.kind === 290); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, false); attributesTable = ts.createSymbolTable(); @@ -62451,7 +63159,7 @@ var ts; spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, false); } } - var parent = openingLikeElement.parent.kind === 278 ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 281 ? openingLikeElement.parent : undefined; if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { var childrenTypes = checkJsxChildren(parent, checkMode); if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") { @@ -62495,7 +63203,7 @@ var ts; childrenTypes.push(stringType); } } - else if (child.kind === 288 && !child.expression) { + else if (child.kind === 291 && !child.expression) { continue; } else { @@ -62838,9 +63546,9 @@ var ts; function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError) { if (reportError === void 0) { reportError = true; } var errorNode = !reportError ? undefined : - node.kind === 161 ? node.right : - node.kind === 200 ? node : - node.kind === 203 && node.propertyName ? node.propertyName : node.name; + node.kind === 163 ? node.right : + node.kind === 202 ? node : + node.kind === 205 && node.propertyName ? node.propertyName : node.name; return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode); } function checkPropertyAccessibilityAtLocation(location, isSuper, writing, containingType, prop, errorNode) { @@ -62854,14 +63562,14 @@ var ts; return false; } } - if (flags & 128) { + if (flags & 256) { if (errorNode) { error(errorNode, ts.Diagnostics.Abstract_method_0_in_class_1_cannot_be_accessed_via_super_expression, symbolToString(prop), typeToString(getDeclaringClass(prop))); } return false; } } - if ((flags & 128) && symbolHasNonMethodDeclaration(prop) && + if ((flags & 256) && symbolHasNonMethodDeclaration(prop) && (ts.isThisProperty(location) || ts.isThisInitializedObjectBindingExpression(location) || ts.isObjectBindingPattern(location.parent) && ts.isThisInitializedDeclaration(location.parent.parent))) { var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) { @@ -62943,10 +63651,27 @@ var ts; return isNullableType(type) ? getNonNullableType(type) : type; } function reportObjectPossiblyNullOrUndefinedError(node, facts) { - error(node, facts & 16777216 ? facts & 33554432 ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); + var nodeText = ts.isEntityNameExpression(node) ? ts.entityNameToString(node) : undefined; + if (node.kind === 104) { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "null"); + return; + } + if (nodeText !== undefined && nodeText.length < 100) { + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "undefined"); + return; + } + error(node, facts & 16777216 ? facts & 33554432 ? + ts.Diagnostics._0_is_possibly_null_or_undefined : + ts.Diagnostics._0_is_possibly_undefined : + ts.Diagnostics._0_is_possibly_null, nodeText); + } + else { + error(node, facts & 16777216 ? facts & 33554432 ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } } function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) { error(node, facts & 16777216 ? facts & 33554432 ? @@ -62956,6 +63681,13 @@ var ts; } function checkNonNullTypeWithReporter(type, node, reportError) { if (strictNullChecks && type.flags & 2) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_of_type_unknown, nodeText); + return errorType; + } + } error(node, ts.Diagnostics.Object_is_of_type_unknown); return errorType; } @@ -62973,6 +63705,17 @@ var ts; function checkNonNullNonVoidType(type, node) { var nonNullType = checkNonNullType(type, node); if (nonNullType.flags & 16384) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, nodeText); + return nonNullType; + } + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_possibly_undefined, nodeText); + return nonNullType; + } + } error(node, ts.Diagnostics.Object_is_possibly_undefined); } return nonNullType; @@ -62991,7 +63734,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, leftType, node.right, checkMode); } function isMethodAccessForCall(node) { - while (node.parent.kind === 212) { + while (node.parent.kind === 214) { node = node.parent; } return ts.isCallOrNewExpression(node.parent) && node.parent.expression === node; @@ -63123,10 +63866,10 @@ var ts; } return isErrorType(apparentType) ? errorType : apparentType; } - prop = getPropertyOfType(apparentType, right.escapedText, false, node.kind === 161); + prop = getPropertyOfType(apparentType, right.escapedText, false, node.kind === 163); } if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules || - !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 && node.parent.kind === 299)) || + !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 && node.parent.kind === 302)) || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { markAliasReferenced(parentSymbol, node); } @@ -63214,7 +63957,7 @@ var ts; if (declaration && isPropertyWithoutInitializer(declaration)) { if (!ts.isStatic(declaration)) { var flowContainer = getControlFlowContainer(node); - if (flowContainer.kind === 171 && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216)) { + if (flowContainer.kind === 173 && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216)) { assumeUninitialized = true; } } @@ -63248,8 +63991,8 @@ var ts; && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) { diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName); } - else if (valueDeclaration.kind === 257 && - node.parent.kind !== 178 && + else if (valueDeclaration.kind === 260 && + node.parent.kind !== 180 && !(valueDeclaration.flags & 16777216) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName); @@ -63261,25 +64004,25 @@ var ts; function isInPropertyInitializerOrClassStaticBlock(node) { return !!ts.findAncestor(node, function (node) { switch (node.kind) { - case 167: - return true; - case 296: case 169: - case 172: - case 173: - case 298: - case 162: - case 233: - case 288: - case 285: - case 286: - case 287: - case 280: - case 228: + return true; + case 299: + case 171: + case 174: + case 175: + case 301: + case 164: + case 236: case 291: + case 288: + case 289: + case 290: + case 283: + case 230: + case 294: return false; - case 214: - case 238: + case 216: + case 241: return ts.isBlock(node.parent) && ts.isClassStaticBlockDeclaration(node.parent.parent) ? true : "quit"; default: return ts.isExpressionNode(node) ? false : "quit"; @@ -63466,7 +64209,6 @@ var ts; } return false; } - ; var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get"; if (!hasProp(suggestedMethod)) { return undefined; @@ -63530,16 +64272,16 @@ var ts; } function isValidPropertyAccess(node, propertyName) { switch (node.kind) { - case 206: + case 208: return isValidPropertyAccessWithType(node, node.expression.kind === 106, propertyName, getWidenedType(checkExpression(node.expression))); - case 161: + case 163: return isValidPropertyAccessWithType(node, false, propertyName, getWidenedType(checkExpression(node.left))); - case 200: + case 202: return isValidPropertyAccessWithType(node, false, propertyName, getTypeFromTypeNode(node)); } } function isValidPropertyAccessForCompletions(node, type, property) { - return isPropertyAccessible(node, node.kind === 206 && node.expression.kind === 106, false, type, property); + return isPropertyAccessible(node, node.kind === 208 && node.expression.kind === 106, false, type, property); } function isValidPropertyAccessWithType(node, isSuper, propertyName, type) { if (isTypeAny(type)) { @@ -63560,7 +64302,7 @@ var ts; } function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 255) { + if (initializer.kind === 258) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -63582,7 +64324,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 243 && + if (node.kind === 246 && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -63629,13 +64371,13 @@ var ts; if (callLikeExpressionMayHaveTypeArguments(node)) { ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 210) { + if (node.kind === 212) { checkExpression(node.template); } else if (ts.isJsxOpeningLikeElement(node)) { checkExpression(node.attributes); } - else if (node.kind !== 165) { + else if (node.kind !== 167) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -63684,7 +64426,7 @@ var ts; } } function isSpreadArgument(arg) { - return !!arg && (arg.kind === 225 || arg.kind === 232 && arg.isSpread); + return !!arg && (arg.kind === 227 || arg.kind === 234 && arg.isSpread); } function getSpreadArgumentIndex(args) { return ts.findIndex(args, isSpreadArgument); @@ -63701,9 +64443,9 @@ var ts; var callIsIncomplete = false; var effectiveParameterCount = getParameterCount(signature); var effectiveMinimumArguments = getMinArgumentCount(signature); - if (node.kind === 210) { + if (node.kind === 212) { argCount = args.length; - if (node.template.kind === 223) { + if (node.template.kind === 225) { var lastSpan = ts.last(node.template.templateSpans); callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated; } @@ -63713,7 +64455,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 165) { + else if (node.kind === 167) { argCount = getDecoratorArgumentCount(node, signature); } else if (ts.isJsxOpeningLikeElement(node)) { @@ -63726,7 +64468,7 @@ var ts; effectiveMinimumArguments = Math.min(effectiveMinimumArguments, 1); } else if (!node.arguments) { - ts.Debug.assert(node.kind === 209); + ts.Debug.assert(node.kind === 211); return getMinArgumentCount(signature) === 0; } else { @@ -63812,7 +64554,7 @@ var ts; if (ts.isJsxOpeningLikeElement(node)) { return inferJsxTypeArguments(node, signature, checkMode, context); } - if (node.kind !== 165) { + if (node.kind !== 167) { var skipBindingPatterns = ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }); var contextualType = getContextualType(node, skipBindingPatterns ? 8 : 0); if (contextualType) { @@ -63851,7 +64593,7 @@ var ts; } for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 && !(checkMode & 32 && hasSkipDirectInferenceFlag(arg))) { + if (arg.kind !== 229 && !(checkMode & 32 && hasSkipDirectInferenceFlag(arg))) { var paramType = getTypeAtPosition(signature, i); if (couldContainTypeVariables(paramType)) { var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); @@ -63875,7 +64617,7 @@ var ts; if (index >= argCount - 1) { var arg = args[argCount - 1]; if (isSpreadArgument(arg)) { - return getMutableArrayOrTupleType(arg.kind === 232 ? arg.type : + return getMutableArrayOrTupleType(arg.kind === 234 ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode)); } } @@ -63885,13 +64627,13 @@ var ts; for (var i = index; i < argCount; i++) { var arg = args[i]; if (isSpreadArgument(arg)) { - var spreadType = arg.kind === 232 ? arg.type : checkExpression(arg.expression); + var spreadType = arg.kind === 234 ? arg.type : checkExpression(arg.expression); if (isArrayLikeType(spreadType)) { types.push(spreadType); flags.push(8); } else { - types.push(checkIteratedTypeOrElementType(33, spreadType, undefinedType, arg.kind === 225 ? arg.expression : arg)); + types.push(checkIteratedTypeOrElementType(33, spreadType, undefinedType, arg.kind === 227 ? arg.expression : arg)); flags.push(4); } } @@ -63902,7 +64644,7 @@ var ts; types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(1); } - if (arg.kind === 232 && arg.tupleNameSource) { + if (arg.kind === 234 && arg.tupleNameSource) { names.push(arg.tupleNameSource); } } @@ -64033,7 +64775,7 @@ var ts; return undefined; } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 209) { + if (thisType && thisType !== voidType && node.kind !== 211) { var thisArgumentNode = getThisArgumentOfCall(node); var thisArgumentType = getThisArgumentType(thisArgumentNode); var errorNode = reportErrors ? (thisArgumentNode || node) : undefined; @@ -64048,7 +64790,7 @@ var ts; var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227) { + if (arg.kind !== 229) { var paramType = getTypeAtPosition(signature, i); var argType = checkExpressionWithContextualType(arg, paramType, undefined, checkMode); var checkArgType = checkMode & 4 ? getRegularTypeOfObjectLiteral(argType) : argType; @@ -64086,8 +64828,8 @@ var ts; } } function getThisArgumentOfCall(node) { - var expression = node.kind === 208 ? node.expression : - node.kind === 210 ? node.tag : undefined; + var expression = node.kind === 210 ? node.expression : + node.kind === 212 ? node.tag : undefined; if (expression) { var callee = ts.skipOuterExpressions(expression); if (ts.isAccessExpression(callee)) { @@ -64102,17 +64844,17 @@ var ts; return result; } function getEffectiveCallArguments(node) { - if (node.kind === 210) { + if (node.kind === 212) { var template = node.template; var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; - if (template.kind === 223) { + if (template.kind === 225) { ts.forEach(template.templateSpans, function (span) { args_3.push(span.expression); }); } return args_3; } - if (node.kind === 165) { + if (node.kind === 167) { return getEffectiveDecoratorArguments(node); } if (ts.isJsxOpeningLikeElement(node)) { @@ -64124,7 +64866,7 @@ var ts; var effectiveArgs_1 = args.slice(0, spreadIndex); var _loop_26 = function (i) { var arg = args[i]; - var spreadType = arg.kind === 225 && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); + var spreadType = arg.kind === 227 && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); if (spreadType && isTupleType(spreadType)) { ts.forEach(getTypeArguments(spreadType), function (t, i) { var _a; @@ -64148,23 +64890,23 @@ var ts; var parent = node.parent; var expr = node.expression; switch (parent.kind) { - case 257: - case 226: + case 260: + case 228: return [ createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent))) ]; - case 164: + case 166: var func = parent.parent; return [ - createSyntheticExpression(expr, parent.parent.kind === 171 ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), + createSyntheticExpression(expr, parent.parent.kind === 173 ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), createSyntheticExpression(expr, anyType), createSyntheticExpression(expr, numberType) ]; - case 167: case 169: - case 172: - case 173: - var hasPropDesc = parent.kind !== 167 && languageVersion !== 0; + case 171: + case 174: + case 175: + var hasPropDesc = languageVersion !== 0 && (!ts.isPropertyDeclaration(parent) || ts.hasAccessorModifier(parent)); return [ createSyntheticExpression(expr, getParentTypeOfClassElement(parent)), createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)), @@ -64175,16 +64917,16 @@ var ts; } function getDecoratorArgumentCount(node, signature) { switch (node.parent.kind) { - case 257: - case 226: + case 260: + case 228: return 1; - case 167: - return 2; case 169: - case 172: - case 173: + return ts.hasAccessorModifier(node.parent) ? 3 : 2; + case 171: + case 174: + case 175: return languageVersion === 0 || signature.parameters.length <= 2 ? 2 : 3; - case 164: + case 166: return 3; default: return ts.Debug.fail(); @@ -64319,8 +65061,8 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, fallbackError) { - var isTaggedTemplate = node.kind === 210; - var isDecorator = node.kind === 165; + var isTaggedTemplate = node.kind === 212; + var isDecorator = node.kind === 167; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var reportErrors = !candidatesOutArray; var typeArguments; @@ -64346,7 +65088,7 @@ var ts; var candidateForArgumentArityError; var candidateForTypeArgumentError; var result; - var signatureHelpTrailingComma = !!(checkMode & 16) && node.kind === 208 && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = !!(checkMode & 16) && node.kind === 210 && node.arguments.hasTrailingComma; if (candidates.length > 1) { result = chooseOverload(candidates, subtypeRelation, isSingleNonGenericCandidate, signatureHelpTrailingComma); } @@ -64737,7 +65479,7 @@ var ts; return resolveErrorCall(node); } var valueDecl = expressionType.symbol && ts.getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && ts.hasSyntacticModifier(valueDecl, 128)) { + if (valueDecl && ts.hasSyntacticModifier(valueDecl, 256)) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class); return resolveErrorCall(node); } @@ -64802,7 +65544,7 @@ var ts; } var declaration = signature.declaration; var modifiers = ts.getSelectedEffectiveModifierFlags(declaration, 24); - if (!modifiers || declaration.kind !== 171) { + if (!modifiers || declaration.kind !== 173) { return true; } var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(declaration.parent.symbol); @@ -64934,16 +65676,16 @@ var ts; } function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 257: - case 226: + case 260: + case 228: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 164: + case 166: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 167: - return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; case 169: - case 172: - case 173: + return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; + case 171: + case 174: + case 175: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; default: return ts.Debug.fail(); @@ -64984,7 +65726,7 @@ var ts; var exports = namespace && getExportsOfSymbol(namespace); var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968); var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968, node); - var declaration = ts.factory.createFunctionTypeNode(undefined, [ts.factory.createParameterDeclaration(undefined, undefined, "props", undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, undefined) : ts.factory.createKeywordTypeNode(130)); + var declaration = ts.factory.createFunctionTypeNode(undefined, [ts.factory.createParameterDeclaration(undefined, undefined, "props", undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, undefined) : ts.factory.createKeywordTypeNode(131)); var parameterSymbol = createSymbol(1, "props"); parameterSymbol.type = result; return createSignature(declaration, undefined, undefined, [parameterSymbol], typeSymbol ? getDeclaredTypeOfSymbol(typeSymbol) : errorType, undefined, 1, 0); @@ -65024,16 +65766,16 @@ var ts; } function resolveSignature(node, candidatesOutArray, checkMode) { switch (node.kind) { - case 208: + case 210: return resolveCallExpression(node, candidatesOutArray, checkMode); - case 209: + case 211: return resolveNewExpression(node, candidatesOutArray, checkMode); - case 210: + case 212: return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode); - case 165: + case 167: return resolveDecorator(node, candidatesOutArray, checkMode); - case 280: - case 279: + case 283: + case 282: return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode); } throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); @@ -65057,11 +65799,13 @@ var ts; return false; } var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node : - ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : + (ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : undefined; if (func) { if (ts.getJSDocClassTag(node)) return true; + if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent))) + return false; var symbol = getSymbolOfNode(func); return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size); } @@ -65143,7 +65887,7 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 206) { + while (parent && parent.kind === 208) { parent = parent.parent; } if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 63) { @@ -65162,12 +65906,12 @@ var ts; if (node.expression.kind === 106) { return voidType; } - if (node.kind === 209) { + if (node.kind === 211) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 171 && - declaration.kind !== 175 && - declaration.kind !== 180 && + declaration.kind !== 173 && + declaration.kind !== 177 && + declaration.kind !== 182 && !ts.isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { if (noImplicitAny) { @@ -65183,7 +65927,7 @@ var ts; if (returnType.flags & 12288 && isSymbolOrSymbolForCall(node)) { return getESSymbolLikeTypeForNode(ts.walkUpParenthesizedExpressions(node.parent)); } - if (node.kind === 208 && !node.questionDotToken && node.parent.kind === 238 && + if (node.kind === 210 && !node.questionDotToken && node.parent.kind === 241 && returnType.flags & 16384 && getTypePredicateOfSignature(signature)) { if (!ts.isDottedName(node.expression)) { error(node.expression, ts.Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); @@ -65213,20 +65957,20 @@ var ts; function getDeprecatedSuggestionNode(node) { node = ts.skipParentheses(node); switch (node.kind) { - case 208: - case 165: - case 209: - return getDeprecatedSuggestionNode(node.expression); case 210: + case 167: + case 211: + return getDeprecatedSuggestionNode(node.expression); + case 212: return getDeprecatedSuggestionNode(node.tag); - case 280: - case 279: + case 283: + case 282: return getDeprecatedSuggestionNode(node.tagName); - case 207: + case 209: return node.argumentExpression; - case 206: + case 208: return node.name; - case 178: + case 180: var typeReference = node; return ts.isQualifiedName(typeReference.typeName) ? typeReference.typeName.right : typeReference; default: @@ -65293,8 +66037,8 @@ var ts; if (hasDefaultOnly && type && !isErrorType(type)) { var synthType = type; if (!synthType.defaultOnlyType) { - var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); - synthType.defaultOnlyType = type_5; + var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); + synthType.defaultOnlyType = type_4; } return synthType.defaultOnlyType; } @@ -65335,9 +66079,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 - ? 256 + ? 259 : resolvedRequire.flags & 3 - ? 254 + ? 257 : 0; if (targetDeclarationKind !== 0) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -65356,7 +66100,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkAssertion(node) { - if (node.kind === 211) { + if (node.kind === 213) { var file = ts.getSourceFileOfNode(node); if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts", ".mts"])) { grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead); @@ -65372,25 +66116,25 @@ var ts; case 9: case 110: case 95: - case 204: - case 205: - case 223: + case 206: + case 207: + case 225: return true; - case 212: + case 214: return isValidConstAssertionArgument(node.expression); - case 219: + case 221: var op = node.operator; var arg = node.operand; return op === 40 && (arg.kind === 8 || arg.kind === 9) || op === 39 && arg.kind === 8; - case 206: - case 207: + case 208: + case 209: var expr = node.expression; var symbol = getTypeOfNode(expr).symbol; if (symbol && symbol.flags & 2097152) { symbol = resolveAlias(symbol); } - return !!(symbol && (symbol.flags & 384) && getEnumKind(symbol) === 1); + return !!(symbol && (getAllSymbolFlags(symbol) & 384) && getEnumKind(symbol) === 1); } return false; } @@ -65426,7 +66170,7 @@ var ts; } function checkExpressionWithTypeArguments(node) { checkGrammarExpressionWithTypeArguments(node); - var exprType = node.kind === 228 ? checkExpression(node.expression) : + var exprType = node.kind === 230 ? checkExpression(node.expression) : ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); var typeArguments = node.typeArguments; @@ -65490,6 +66234,16 @@ var ts; }); } } + function checkSatisfiesExpression(node) { + checkSourceElement(node.type); + var targetType = getTypeFromTypeNode(node.type); + if (isErrorType(targetType)) { + return targetType; + } + var exprType = checkExpression(node.expression); + checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, node.type, node.expression, ts.Diagnostics.Type_0_does_not_satisfy_the_expected_type_1); + return exprType; + } function checkMetaProperty(node) { checkGrammarMetaProperty(node); if (node.keywordToken === 103) { @@ -65517,7 +66271,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return errorType; } - else if (container.kind === 171) { + else if (container.kind === 173) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -65569,7 +66323,7 @@ var ts; } function getParameterIdentifierNameAtPosition(signature, pos) { var _a; - if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 317) { + if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 320) { return undefined; } var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -65601,7 +66355,7 @@ var ts; return symbol.valueDeclaration && ts.isParameter(symbol.valueDeclaration) && ts.isIdentifier(symbol.valueDeclaration.name); } function isValidDeclarationForTupleLabel(d) { - return d.kind === 197 || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); + return d.kind === 199 || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); } function getNameableDeclarationAtPosition(signature, pos) { var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -65873,7 +66627,7 @@ var ts; var yieldType; var nextType; var fallbackReturnType = voidType; - if (func.body.kind !== 235) { + if (func.body.kind !== 238) { returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8); if (isAsync) { returnType = unwrapAwaitedType(checkAwaitedType(returnType, false, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member)); @@ -66005,22 +66759,32 @@ var ts; } function isExhaustiveSwitchStatement(node) { var links = getNodeLinks(node); - return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node)); + if (links.isExhaustive === undefined) { + links.isExhaustive = 0; + var exhaustive = computeExhaustiveSwitchStatement(node); + if (links.isExhaustive === 0) { + links.isExhaustive = exhaustive; + } + } + else if (links.isExhaustive === 0) { + links.isExhaustive = false; + } + return links.isExhaustive; } function computeExhaustiveSwitchStatement(node) { - if (node.expression.kind === 216) { + if (node.expression.kind === 218) { var witnesses = getSwitchClauseTypeOfWitnesses(node); if (!witnesses) { return false; } - var operandConstraint = getBaseConstraintOrType(getTypeOfExpression(node.expression.expression)); + var operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression)); var notEqualFacts_2 = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses); if (operandConstraint.flags & 3) { return (556800 & notEqualFacts_2) === 556800; } return !someType(operandConstraint, function (t) { return (getTypeFacts(t) & notEqualFacts_2) === notEqualFacts_2; }); } - var type = getTypeOfExpression(node.expression); + var type = checkExpressionCached(node.expression); if (!isLiteralType(type)) { return false; } @@ -66065,11 +66829,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 213: - case 214: + case 215: + case 216: return true; - case 169: - return func.parent.kind === 205; + case 171: + return func.parent.kind === 207; default: return false; } @@ -66083,7 +66847,7 @@ var ts; if (type && maybeTypeOfKind(type, 1 | 16384)) { return; } - if (func.kind === 168 || ts.nodeIsMissing(func.body) || func.body.kind !== 235 || !functionHasImplicitReturn(func)) { + if (func.kind === 170 || ts.nodeIsMissing(func.body) || func.body.kind !== 238 || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 512; @@ -66112,7 +66876,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { - ts.Debug.assert(node.kind !== 169 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 || ts.isObjectLiteralMethod(node)); checkNodeDeferred(node); if (ts.isFunctionExpression(node)) { checkCollisionsForDeclarationName(node, node.name); @@ -66135,7 +66899,7 @@ var ts; return anyFunctionType; } var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 213) { + if (!hasGrammarError && node.kind === 215) { checkGrammarForGenerator(node); } contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -66181,7 +66945,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 169 || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 || ts.isObjectLiteralMethod(node)); var functionFlags = ts.getFunctionFlags(node); var returnType = getReturnTypeFromAnnotation(node); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); @@ -66189,7 +66953,7 @@ var ts; if (!ts.getEffectiveReturnTypeNode(node)) { getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 235) { + if (node.body.kind === 238) { checkSourceElement(node.body); } else { @@ -66261,7 +67025,7 @@ var ts; ts.isAccessExpression(expr) && expr.expression.kind === 108) { var ctor = ts.getContainingFunction(expr); - if (!(ctor && (ctor.kind === 171 || isJSConstructor(ctor)))) { + if (!(ctor && (ctor.kind === 173 || isJSConstructor(ctor)))) { return true; } if (symbol.valueDeclaration) { @@ -66285,7 +67049,7 @@ var ts; var symbol_2 = getNodeLinks(node).resolvedSymbol; if (symbol_2.flags & 2097152) { var declaration = getDeclarationOfAliasSymbol(symbol_2); - return !!declaration && declaration.kind === 268; + return !!declaration && declaration.kind === 271; } } } @@ -66380,7 +67144,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); - if (container && container.kind !== 171 && (ts.getFunctionFlags(container) & 2) === 0) { + if (container && container.kind !== 173 && (ts.getFunctionFlags(container) & 2) === 0) { var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); } @@ -66537,6 +67301,9 @@ var ts; } return booleanType; } + function hasEmptyObjectIntersection(type) { + return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152) && ts.some(t.types, isEmptyAnonymousObjectType); }); + } function checkInExpression(left, right, leftType, rightType) { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; @@ -66551,18 +67318,12 @@ var ts; } } else { - leftType = checkNonNullType(leftType, left); - if (!(allTypesAssignableToKind(leftType, 402653316 | 296 | 12288) || - isTypeAssignableToKind(leftType, 4194304 | 134217728 | 268435456 | 262144))) { - error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol); - } + checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left); } - rightType = checkNonNullType(rightType, right); - var rightTypeConstraint = getConstraintOfType(rightType); - if (!allTypesAssignableToKind(rightType, 67108864 | 58982400) || - rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 | 58982400) || - !maybeTypeOfKind(rightTypeConstraint, 67108864 | 58982400 | 524288))) { - error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive); + if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) { + if (hasEmptyObjectIntersection(rightType)) { + error(right, ts.Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType)); + } } return booleanType; } @@ -66580,7 +67341,7 @@ var ts; if (rightIsThis === void 0) { rightIsThis = false; } var properties = node.properties; var property = properties[propertyIndex]; - if (property.kind === 296 || property.kind === 297) { + if (property.kind === 299 || property.kind === 300) { var name = property.name; var exprType = getLiteralTypeFromPropertyName(name); if (isTypeUsableAsPropertyName(exprType)) { @@ -66593,9 +67354,9 @@ var ts; } var elementType = getIndexedAccessType(objectLiteralType, exprType, 32, name); var type = getFlowTypeOfDestructuring(property, elementType); - return checkDestructuringAssignment(property.kind === 297 ? property : property.initializer, type); + return checkDestructuringAssignment(property.kind === 300 ? property : property.initializer, type); } - else if (property.kind === 298) { + else if (property.kind === 301) { if (propertyIndex < properties.length - 1) { error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } @@ -66630,7 +67391,7 @@ var ts; var inBoundsType = compilerOptions.noUncheckedIndexedAccess ? undefined : possiblyOutOfBoundsType; for (var i = 0; i < elements.length; i++) { var type = possiblyOutOfBoundsType; - if (node.elements[i].kind === 225) { + if (node.elements[i].kind === 227) { type = inBoundsType = inBoundsType !== null && inBoundsType !== void 0 ? inBoundsType : (checkIteratedTypeOrElementType(65, sourceType, undefinedType, node) || errorType); } checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode); @@ -66640,8 +67401,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 227) { - if (element.kind !== 225) { + if (element.kind !== 229) { + if (element.kind !== 227) { var indexType = getNumberLiteralType(elementIndex); if (isArrayLikeType(sourceType)) { var accessFlags = 32 | (hasDefaultValue(element) ? 16 : 0); @@ -66657,7 +67418,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 221 && restExpression.operatorToken.kind === 63) { + if (restExpression.kind === 223 && restExpression.operatorToken.kind === 63) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -66673,7 +67434,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) { var target; - if (exprOrAssignment.kind === 297) { + if (exprOrAssignment.kind === 300) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { if (strictNullChecks && @@ -66687,27 +67448,27 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 221 && target.operatorToken.kind === 63) { + if (target.kind === 223 && target.operatorToken.kind === 63) { checkBinaryExpression(target, checkMode); target = target.left; if (strictNullChecks) { sourceType = getTypeWithFacts(sourceType, 524288); } } - if (target.kind === 205) { + if (target.kind === 207) { return checkObjectLiteralAssignment(target, sourceType, rightIsThis); } - if (target.kind === 204) { + if (target.kind === 206) { return checkArrayLiteralAssignment(target, sourceType, checkMode); } return checkReferenceAssignment(target, sourceType, checkMode); } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 298 ? + var error = target.parent.kind === 301 ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; - var optionalError = target.parent.kind === 298 ? + var optionalError = target.parent.kind === 301 ? ts.Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; if (checkReferenceExpression(target, error, optionalError)) { @@ -66724,36 +67485,36 @@ var ts; case 79: case 10: case 13: - case 210: - case 223: + case 212: + case 225: case 14: case 8: case 9: case 110: case 95: case 104: - case 153: - case 213: - case 226: - case 214: - case 204: - case 205: + case 155: + case 215: + case 228: case 216: - case 230: - case 279: - case 278: + case 206: + case 207: + case 218: + case 232: + case 282: + case 281: return true; - case 222: + case 224: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 221: + case 223: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 219: - case 220: + case 221: + case 222: switch (node.operator) { case 53: case 39: @@ -66762,9 +67523,9 @@ var ts; return true; } return false; - case 217: - case 211: - case 229: + case 219: + case 213: + case 231: default: return false; } @@ -66801,7 +67562,7 @@ var ts; } checkGrammarNullishCoalesceWithLogicalExpression(node); var operator = node.operatorToken.kind; - if (operator === 63 && (node.left.kind === 205 || node.left.kind === 204)) { + if (operator === 63 && (node.left.kind === 207 || node.left.kind === 206)) { state.skip = true; setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === 108)); return state; @@ -66823,11 +67584,11 @@ var ts; if (operator === 55 || operator === 56 || operator === 60) { if (operator === 55) { var parent = node.parent; - while (parent.kind === 212 + while (parent.kind === 214 || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 || parent.operatorToken.kind === 56)) { parent = parent.parent; } - checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined); + checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined); } checkTruthinessOfType(leftType, node.left); } @@ -66892,7 +67653,7 @@ var ts; } function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 63 && (left.kind === 205 || left.kind === 204)) { + if (operator === 63 && (left.kind === 207 || left.kind === 206)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 108); } var leftType; @@ -67030,6 +67791,7 @@ var ts; var eqType = operator === 34 || operator === 36; error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true"); } + checkNaNEquality(errorNode, operator, left, right); reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); }); return booleanType; case 102: @@ -67213,20 +67975,35 @@ var ts; } } function tryGiveBetterPrimaryError(errNode, maybeMissingAwait, leftStr, rightStr) { - var typeName; switch (operatorToken.kind) { case 36: case 34: - typeName = "false"; - break; case 37: case 35: - typeName = "true"; + return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap, leftStr, rightStr); + default: + return undefined; } - if (typeName) { - return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, typeName, leftStr, rightStr); + } + function checkNaNEquality(errorNode, operator, left, right) { + var isLeftNaN = isGlobalNaN(ts.skipParentheses(left)); + var isRightNaN = isGlobalNaN(ts.skipParentheses(right)); + if (isLeftNaN || isRightNaN) { + var err = error(errorNode, ts.Diagnostics.This_condition_will_always_return_0, ts.tokenToString(operator === 36 || operator === 34 ? 95 : 110)); + if (isLeftNaN && isRightNaN) + return; + var operatorString = operator === 37 || operator === 35 ? ts.tokenToString(53) : ""; + var location = isLeftNaN ? right : left; + var expression = ts.skipParentheses(location); + ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")"))); } - return undefined; + } + function isGlobalNaN(expr) { + if (ts.isIdentifier(expr) && expr.escapedText === "NaN") { + var globalNaNSymbol = getGlobalNaNSymbol(); + return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr); + } + return false; } } function getBaseTypesIfUnrelated(leftType, rightType, isRelated) { @@ -67300,8 +68077,8 @@ var ts; } } function checkConditionalExpression(node, checkMode) { - checkTruthinessExpression(node.condition); - checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue); + var type = checkTruthinessExpression(node.condition); + checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue); var type1 = checkExpression(node.whenTrue, checkMode); var type2 = checkExpression(node.whenFalse, checkMode); return getUnionType([type1, type2], 2); @@ -67330,7 +68107,7 @@ var ts; type.flags & 58982400 && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316)); } function getContextNode(node) { - if (node.kind === 286 && !ts.isJsxSelfClosingElement(node.parent)) { + if (node.kind === 289 && !ts.isJsxSelfClosingElement(node.parent)) { return node.parent.parent; } return node; @@ -67373,8 +68150,8 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node, true); - return node.kind === 211 || - node.kind === 229 || + return node.kind === 213 || + node.kind === 231 || ts.isJSDocTypeAssertion(node); } function checkDeclarationInitializer(declaration, checkMode, contextualType) { @@ -67383,7 +68160,7 @@ var ts; (contextualType ? checkExpressionWithContextualType(initializer, contextualType, undefined, checkMode || 0) : checkExpressionCached(initializer, checkMode)); - return ts.isParameter(declaration) && declaration.name.kind === 202 && + return ts.isParameter(declaration) && declaration.name.kind === 204 && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; } @@ -67393,7 +68170,7 @@ var ts; var elementFlags = type.target.elementFlags.slice(); for (var i = getTypeReferenceArity(type); i < patternElements.length; i++) { var e = patternElements[i]; - if (i < patternElements.length - 1 || !(e.kind === 203 && e.dotDotDotToken)) { + if (i < patternElements.length - 1 || !(e.kind === 205 && e.dotDotDotToken)) { elementTypes.push(!ts.isOmittedExpression(e) && hasDefaultValue(e) ? getTypeFromBindingElement(e, false, false) : anyType); elementFlags.push(2); if (!ts.isOmittedExpression(e) && !hasDefaultValue(e)) { @@ -67453,14 +68230,14 @@ var ts; getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node, undefined) : contextualType, node, undefined)); } function checkPropertyAssignment(node, checkMode) { - if (node.name.kind === 162) { + if (node.name.kind === 164) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, checkMode); } function checkObjectLiteralMethod(node, checkMode) { checkGrammarMethod(node); - if (node.name.kind === 162) { + if (node.name.kind === 164) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -67517,6 +68294,9 @@ var ts; function hasInferenceCandidates(info) { return !!(info.candidates || info.contraCandidates); } + function hasInferenceCandidatesOrDefault(info) { + return !!(info.candidates || info.contraCandidates || hasTypeParameterDefault(info.typeParameter)); + } function hasOverlappingInferences(a, b) { for (var i = 0; i < a.length; i++) { if (hasInferenceCandidates(a[i]) && hasInferenceCandidates(b[i])) { @@ -67663,11 +68443,11 @@ var ts; return type; } function checkConstEnumAccess(node, type) { - var ok = (node.parent.kind === 206 && node.parent.expression === node) || - (node.parent.kind === 207 && node.parent.expression === node) || - ((node.kind === 79 || node.kind === 161) && isInRightSideOfImportOrExportAssignment(node) || - (node.parent.kind === 181 && node.parent.exprName === node)) || - (node.parent.kind === 275); + var ok = (node.parent.kind === 208 && node.parent.expression === node) || + (node.parent.kind === 209 && node.parent.expression === node) || + ((node.kind === 79 || node.kind === 163) && isInRightSideOfImportOrExportAssignment(node) || + (node.parent.kind === 183 && node.parent.exprName === node)) || + (node.parent.kind === 278); if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query); } @@ -67690,9 +68470,9 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { - case 226: - case 213: - case 214: + case 228: + case 215: + case 216: cancellationToken.throwIfCancellationRequested(); } } @@ -67723,79 +68503,81 @@ var ts; return trueType; case 95: return falseType; - case 223: + case 225: return checkTemplateExpression(node); case 13: return globalRegExpType; - case 204: + case 206: return checkArrayLiteral(node, checkMode, forceTuple); - case 205: + case 207: return checkObjectLiteral(node, checkMode); - case 206: + case 208: return checkPropertyAccessExpression(node, checkMode); - case 161: + case 163: return checkQualifiedName(node, checkMode); - case 207: + case 209: return checkIndexedAccess(node, checkMode); - case 208: + case 210: if (node.expression.kind === 100) { return checkImportCallExpression(node); } - case 209: + case 211: return checkCallExpression(node, checkMode); - case 210: - return checkTaggedTemplateExpression(node); case 212: + return checkTaggedTemplateExpression(node); + case 214: return checkParenthesizedExpression(node, checkMode); - case 226: + case 228: return checkClassExpression(node); - case 213: - case 214: - return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); + case 215: case 216: + return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); + case 218: return checkTypeOfExpression(node); - case 211: - case 229: + case 213: + case 231: return checkAssertion(node); - case 230: + case 232: return checkNonNullAssertion(node); - case 228: + case 230: return checkExpressionWithTypeArguments(node); - case 231: + case 235: + return checkSatisfiesExpression(node); + case 233: return checkMetaProperty(node); - case 215: - return checkDeleteExpression(node); case 217: + return checkDeleteExpression(node); + case 219: return checkVoidExpression(node); - case 218: + case 220: return checkAwaitExpression(node); - case 219: + case 221: return checkPrefixUnaryExpression(node); - case 220: + case 222: return checkPostfixUnaryExpression(node); - case 221: + case 223: return checkBinaryExpression(node, checkMode); - case 222: + case 224: return checkConditionalExpression(node, checkMode); - case 225: - return checkSpreadExpression(node, checkMode); case 227: + return checkSpreadExpression(node, checkMode); + case 229: return undefinedWideningType; - case 224: + case 226: return checkYieldExpression(node); - case 232: + case 234: return checkSyntheticExpression(node); - case 288: + case 291: return checkJsxExpression(node, checkMode); - case 278: + case 281: return checkJsxElement(node, checkMode); - case 279: - return checkJsxSelfClosingElement(node, checkMode); case 282: + return checkJsxSelfClosingElement(node, checkMode); + case 285: return checkJsxFragment(node); - case 286: + case 289: return checkJsxAttributes(node, checkMode); - case 280: + case 283: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return errorType; @@ -67847,10 +68629,10 @@ var ts; checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); if (ts.hasSyntacticModifier(node, 16476)) { - if (!(func.kind === 171 && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 173 && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } - if (func.kind === 171 && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { + if (func.kind === 173 && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); } } @@ -67861,13 +68643,13 @@ var ts; if (func.parameters.indexOf(node) !== 0) { error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } - if (func.kind === 171 || func.kind === 175 || func.kind === 180) { + if (func.kind === 173 || func.kind === 177 || func.kind === 182) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } - if (func.kind === 214) { + if (func.kind === 216) { error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter); } - if (func.kind === 172 || func.kind === 173) { + if (func.kind === 174 || func.kind === 175) { error(node, ts.Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); } } @@ -67921,13 +68703,13 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 214: - case 174: - case 256: - case 213: - case 179: - case 169: - case 168: + case 216: + case 176: + case 259: + case 215: + case 181: + case 171: + case 170: var parent = node.parent; if (node === parent.type) { return parent; @@ -67945,7 +68727,7 @@ var ts; error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name.kind === 202 || name.kind === 201) { + else if (name.kind === 204 || name.kind === 203) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -67953,12 +68735,12 @@ var ts; } } function checkSignatureDeclaration(node) { - if (node.kind === 176) { + if (node.kind === 178) { checkGrammarIndexSignature(node); } - else if (node.kind === 179 || node.kind === 256 || node.kind === 180 || - node.kind === 174 || node.kind === 171 || - node.kind === 175) { + else if (node.kind === 181 || node.kind === 259 || node.kind === 182 || + node.kind === 176 || node.kind === 173 || + node.kind === 177) { checkGrammarFunctionLikeDeclaration(node); } var functionFlags = ts.getFunctionFlags(node); @@ -67985,10 +68767,10 @@ var ts; var returnTypeNode = ts.getEffectiveReturnTypeNode(node); if (noImplicitAny && !returnTypeNode) { switch (node.kind) { - case 175: + case 177: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 174: + case 176: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -68012,7 +68794,7 @@ var ts; checkAsyncFunctionReturnType(node, returnTypeNode); } } - if (node.kind !== 176 && node.kind !== 317) { + if (node.kind !== 178 && node.kind !== 320) { registerForUnusedIdentifiersCheck(node); } } @@ -68023,7 +68805,7 @@ var ts; var privateIdentifiers = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 171) { + if (member.kind === 173) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param, member) && !ts.isBindingPattern(param.name)) { @@ -68045,16 +68827,16 @@ var ts; var memberName = name && ts.getPropertyNameForPropertyNameNode(name); if (memberName) { switch (member.kind) { - case 172: + case 174: addName(names, name, memberName, 1 | privateStaticFlags); break; - case 173: + case 175: addName(names, name, memberName, 2 | privateStaticFlags); break; - case 167: + case 169: addName(names, name, memberName, 3 | privateStaticFlags); break; - case 169: + case 171: addName(names, name, memberName, 8 | privateStaticFlags); break; } @@ -68113,7 +68895,7 @@ var ts; var names = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 166) { + if (member.kind === 168) { var memberName = void 0; var name = member.name; switch (name.kind) { @@ -68138,7 +68920,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 258) { + if (node.kind === 261) { var nodeSymbol = getSymbolOfNode(node); if (nodeSymbol.declarations && nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) { return; @@ -68179,7 +68961,7 @@ var ts; checkGrammarComputedPropertyName(node.name); checkVariableLikeDeclaration(node); setNodeLinksForPrivateIdentifierScope(node); - if (ts.hasSyntacticModifier(node, 128) && node.kind === 167 && node.initializer) { + if (ts.hasSyntacticModifier(node, 256) && node.kind === 169 && node.initializer) { error(node, ts.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -68196,7 +68978,7 @@ var ts; error(node.name, ts.Diagnostics.Class_constructor_may_not_be_a_generator); } checkFunctionOrMethodDeclaration(node); - if (ts.hasSyntacticModifier(node, 128) && node.kind === 169 && node.body) { + if (ts.hasSyntacticModifier(node, 256) && node.kind === 171 && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } if (ts.isPrivateIdentifier(node.name) && !ts.getContainingClass(node)) { @@ -68241,7 +69023,7 @@ var ts; if (ts.isPrivateIdentifierClassElementDeclaration(n)) { return true; } - return n.kind === 167 && + return n.kind === 169 && !ts.isStatic(n) && !!n.initializer; } @@ -68311,25 +69093,25 @@ var ts; checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 172) { + if (node.kind === 174) { if (!(node.flags & 16777216) && ts.nodeIsPresent(node.body) && (node.flags & 256)) { if (!(node.flags & 512)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); } } } - if (node.name.kind === 162) { + if (node.name.kind === 164) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { var symbol = getSymbolOfNode(node); - var getter = ts.getDeclarationOfKind(symbol, 172); - var setter = ts.getDeclarationOfKind(symbol, 173); + var getter = ts.getDeclarationOfKind(symbol, 174); + var setter = ts.getDeclarationOfKind(symbol, 175); if (getter && setter && !(getNodeCheckFlags(getter) & 1)) { getNodeLinks(getter).flags |= 1; var getterFlags = ts.getEffectiveModifierFlags(getter); var setterFlags = ts.getEffectiveModifierFlags(setter); - if ((getterFlags & 128) !== (setterFlags & 128)) { + if ((getterFlags & 256) !== (setterFlags & 256)) { error(getter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); error(setter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } @@ -68346,7 +69128,7 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 172) { + if (node.kind === 174) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } @@ -68392,7 +69174,7 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); - if (node.kind === 178 && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { + if (node.kind === 180 && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } ts.forEach(node.typeArguments, checkSourceElement); @@ -68408,7 +69190,7 @@ var ts; } var symbol = getNodeLinks(node).resolvedSymbol; if (symbol) { - if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456); })) { + if (ts.some(symbol.declarations, function (d) { return ts.isTypeDeclaration(d) && !!(d.flags & 268435456); })) { addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName); } if (type.flags & 32 && symbol.flags & 8) { @@ -68450,7 +69232,7 @@ var ts; var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember); for (var _i = 0, elementTypes_1 = elementTypes; _i < elementTypes_1.length; _i++) { var e = elementTypes_1[_i]; - if (e.kind !== 197 && hasNamedElement) { + if (e.kind !== 199 && hasNamedElement) { grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); break; } @@ -68498,7 +69280,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType, false))) { - if (accessNode.kind === 207 && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 209 && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 && getMappedTypeModifiers(objectType) & 1) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -68561,7 +69343,7 @@ var ts; ts.forEachChild(node, checkSourceElement); } function checkInferType(node) { - if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 189 && n.parent.extendsType === n; })) { + if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 191 && n.parent.extendsType === n; })) { grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter); @@ -68571,7 +69353,7 @@ var ts; if (!links.typeParametersChecked) { links.typeParametersChecked = true; var typeParameter = getDeclaredTypeOfTypeParameter(symbol); - var declarations = ts.getDeclarationsOfKind(symbol, 163); + var declarations = ts.getDeclarationsOfKind(symbol, 165); if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) { var name = symbolToString(symbol); for (var _i = 0, declarations_4 = declarations; _i < declarations_4.length; _i++) { @@ -68611,10 +69393,10 @@ var ts; if (node.dotDotDotToken && node.questionToken) { grammarErrorOnNode(node, ts.Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); } - if (node.type.kind === 185) { + if (node.type.kind === 187) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type); } - if (node.type.kind === 186) { + if (node.type.kind === 188) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); } checkSourceElement(node.type); @@ -68625,9 +69407,9 @@ var ts; } function getEffectiveDeclarationFlags(n, flagsToCheck) { var flags = ts.getCombinedModifierFlags(n); - if (n.parent.kind !== 258 && - n.parent.kind !== 257 && - n.parent.kind !== 226 && + if (n.parent.kind !== 261 && + n.parent.kind !== 260 && + n.parent.kind !== 228 && n.flags & 16777216) { if (!(flags & 2) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) { flags |= 1; @@ -68659,7 +69441,7 @@ var ts; else if (deviation & (8 | 16)) { error(ts.getNameOfDeclaration(o) || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } - else if (deviation & 128) { + else if (deviation & 256) { error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); @@ -68676,7 +69458,7 @@ var ts; }); } } - var flagsToCheck = 1 | 2 | 8 | 16 | 128; + var flagsToCheck = 1 | 2 | 8 | 16 | 256; var someNodeFlags = 0; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -68708,7 +69490,7 @@ var ts; ts.isComputedPropertyName(node.name) && ts.isComputedPropertyName(subsequentName) || ts.isPropertyNameLiteral(node.name) && ts.isPropertyNameLiteral(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) { - var reportError = (node.kind === 169 || node.kind === 168) && + var reportError = (node.kind === 171 || node.kind === 170) && ts.isStatic(node) !== ts.isStatic(subsequentNode); if (reportError) { var diagnostic = ts.isStatic(node) ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static; @@ -68727,7 +69509,7 @@ var ts; error(errorNode, ts.Diagnostics.Constructor_implementation_is_missing); } else { - if (ts.hasSyntacticModifier(node, 128)) { + if (ts.hasSyntacticModifier(node, 256)) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -68744,14 +69526,14 @@ var ts; var current = declarations_5[_i]; var node = current; var inAmbientContext = node.flags & 16777216; - var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 || node.parent.kind === 182) || inAmbientContext; + var inAmbientContextOrInterface = node.parent && (node.parent.kind === 261 || node.parent.kind === 184) || inAmbientContext; if (inAmbientContextOrInterface) { previousDeclaration = undefined; } - if ((node.kind === 257 || node.kind === 226) && !inAmbientContext) { + if ((node.kind === 260 || node.kind === 228) && !inAmbientContext) { hasNonAmbientClass = true; } - if (node.kind === 256 || node.kind === 169 || node.kind === 168 || node.kind === 171) { + if (node.kind === 259 || node.kind === 171 || node.kind === 170 || node.kind === 173) { functionDeclarations.push(node); var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; @@ -68796,12 +69578,12 @@ var ts; }); } if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 && declarations) { - var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 257; }) + var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 260; }) .map(function (d) { return ts.createDiagnosticForNode(d, ts.Diagnostics.Consider_adding_a_declare_modifier_to_this_class); }); ts.forEach(declarations, function (declaration) { - var diagnostic = declaration.kind === 257 + var diagnostic = declaration.kind === 260 ? ts.Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 - : declaration.kind === 256 + : declaration.kind === 259 ? ts.Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : undefined; if (diagnostic) { @@ -68810,7 +69592,7 @@ var ts; }); } if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 128) && !lastSeenNonAmbientDeclaration.questionToken) { + !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 256) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -68851,9 +69633,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 | 512); + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 | 1024); if (effectiveDeclarationFlags & 1) { - if (effectiveDeclarationFlags & 512) { + if (effectiveDeclarationFlags & 1024) { defaultExportedDeclarationSpaces |= declarationSpaces; } else { @@ -68883,43 +69665,43 @@ var ts; function getDeclarationSpaces(decl) { var d = decl; switch (d.kind) { - case 258: - case 259: - case 345: - case 338: - case 339: - return 2; case 261: + case 262: + case 348: + case 341: + case 342: + return 2; + case 264: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 ? 4 | 1 : 4; - case 257: case 260: - case 299: + case 263: + case 302: return 2 | 1; - case 305: + case 308: return 2 | 1 | 4; - case 271: - case 221: + case 274: + case 223: var node_2 = d; var expression = ts.isExportAssignment(node_2) ? node_2.expression : node_2.right; if (!ts.isEntityNameExpression(expression)) { return 1; } d = expression; - case 265: case 268: - case 267: + case 271: + case 270: var result_12 = 0; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_12 |= getDeclarationSpaces(d); }); return result_12; - case 254: - case 203: - case 256: - case 270: + case 257: + case 205: + case 259: + case 273: case 79: return 1; default: @@ -68942,7 +69724,7 @@ var ts; if (isReferenceToType(type, getGlobalPromiseType(false))) { return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0]; } - if (allTypesAssignableToKind(type, 131068 | 131072)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 | 131072)) { return undefined; } var thenFunction = getTypeOfPropertyOfType(type, "then"); @@ -68998,7 +69780,7 @@ var ts; return awaitedType || errorType; } function isThenableType(type) { - if (allTypesAssignableToKind(type, 131068 | 131072)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 | 131072)) { return false; } var thenFunction = getTypeOfPropertyOfType(type, "then"); @@ -69024,7 +69806,7 @@ var ts; if (isGenericObjectType(type)) { var baseConstraint = getBaseConstraintOfType(type); if (baseConstraint ? - baseConstraint.flags & 3 || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) : + baseConstraint.flags & 3 || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) : maybeTypeOfKind(type, 8650752)) { return true; } @@ -69170,20 +69952,20 @@ var ts; var headMessage; var expectedReturnType; switch (node.parent.kind) { - case 257: + case 260: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 167: - case 164: + case 169: + case 166: headMessage = ts.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; expectedReturnType = voidType; break; - case 169: - case 172: - case 173: + case 171: + case 174: + case 175: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); @@ -69231,15 +70013,15 @@ var ts; function getEntityNameForDecoratorMetadata(node) { if (node) { switch (node.kind) { - case 188: - case 187: - return getEntityNameForDecoratorMetadataFromTypeList(node.types); + case 190: case 189: - return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); + return getEntityNameForDecoratorMetadataFromTypeList(node.types); case 191: - case 197: + return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); + case 193: + case 199: return getEntityNameForDecoratorMetadata(node.type); - case 178: + case 180: return node.typeName; } } @@ -69248,13 +70030,13 @@ var ts; var commonEntityName; for (var _i = 0, types_21 = types; _i < types_21.length; _i++) { var typeNode = types_21[_i]; - while (typeNode.kind === 191 || typeNode.kind === 197) { + while (typeNode.kind === 193 || typeNode.kind === 199) { typeNode = typeNode.type; } - if (typeNode.kind === 143) { + if (typeNode.kind === 144) { continue; } - if (!strictNullChecks && (typeNode.kind === 196 && typeNode.literal.kind === 104 || typeNode.kind === 153)) { + if (!strictNullChecks && (typeNode.kind === 198 && typeNode.literal.kind === 104 || typeNode.kind === 155)) { continue; } var individualEntityName = getEntityNameForDecoratorMetadata(typeNode); @@ -69290,13 +70072,13 @@ var ts; return; } checkExternalEmitHelpers(firstDecorator, 8); - if (node.kind === 164) { + if (node.kind === 166) { checkExternalEmitHelpers(firstDecorator, 32); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16); switch (node.kind) { - case 257: + case 260: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -69305,23 +70087,23 @@ var ts; } } break; - case 172: - case 173: - var otherKind = node.kind === 172 ? 173 : 172; + case 174: + case 175: + var otherKind = node.kind === 174 ? 175 : 174; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); break; - case 169: + case 171: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node)); break; - case 167: + case 169: markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node)); break; - case 164: + case 166: markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); var containingSignature = node.parent; for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) { @@ -69422,7 +70204,7 @@ var ts; switch (node.kind) { case 79: return node; - case 206: + case 208: return node.name; default: return undefined; @@ -69433,7 +70215,7 @@ var ts; checkDecorators(node); checkSignatureDeclaration(node); var functionFlags = ts.getFunctionFlags(node); - if (node.name && node.name.kind === 162) { + if (node.name && node.name.kind === 164) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { @@ -69447,7 +70229,7 @@ var ts; checkFunctionOrConstructorSymbol(symbol); } } - var body = node.kind === 168 ? undefined : node.body; + var body = node.kind === 170 ? undefined : node.body; checkSourceElement(body); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node)); addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics); @@ -69484,42 +70266,42 @@ var ts; for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) { var node = potentiallyUnusedIdentifiers_1[_i]; switch (node.kind) { - case 257: - case 226: + case 260: + case 228: checkUnusedClassMembers(node, addDiagnostic); checkUnusedTypeParameters(node, addDiagnostic); break; - case 305: - case 261: - case 235: - case 263: - case 242: - case 243: - case 244: + case 308: + case 264: + case 238: + case 266: + case 245: + case 246: + case 247: checkUnusedLocalsAndParameters(node, addDiagnostic); break; - case 171: - case 213: - case 256: - case 214: - case 169: - case 172: case 173: + case 215: + case 259: + case 216: + case 171: + case 174: + case 175: if (node.body) { checkUnusedLocalsAndParameters(node, addDiagnostic); } checkUnusedTypeParameters(node, addDiagnostic); break; - case 168: - case 174: - case 175: - case 179: - case 180: - case 259: - case 258: + case 170: + case 176: + case 177: + case 181: + case 182: + case 262: + case 261: checkUnusedTypeParameters(node, addDiagnostic); break; - case 190: + case 192: checkUnusedInferTypeParameter(node, addDiagnostic); break; default: @@ -69529,7 +70311,7 @@ var ts; } function errorUnusedLocal(declaration, name, addDiagnostic) { var node = ts.getNameOfDeclaration(declaration) || declaration; - var message = isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read; + var message = ts.isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read; addDiagnostic(declaration, 0, ts.createDiagnosticForNode(node, message, name)); } function isIdentifierThatStartsWithUnderscore(node) { @@ -69539,11 +70321,11 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { + case 171: case 169: - case 167: - case 172: - case 173: - if (member.kind === 173 && member.symbol.flags & 32768) { + case 174: + case 175: + if (member.kind === 175 && member.symbol.flags & 32768) { break; } var symbol = getSymbolOfNode(member); @@ -69553,7 +70335,7 @@ var ts; addDiagnostic(member, 0, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; - case 171: + case 173: for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.hasSyntacticModifier(parameter, 8)) { @@ -69561,9 +70343,9 @@ var ts; } } break; - case 176: - case 234: - case 170: + case 178: + case 237: + case 172: break; default: ts.Debug.fail("Unexpected class member"); @@ -69588,7 +70370,7 @@ var ts; continue; var name = ts.idText(typeParameter.name); var parent = typeParameter.parent; - if (parent.kind !== 190 && parent.typeParameters.every(isTypeParameterUnused)) { + if (parent.kind !== 192 && parent.typeParameters.every(isTypeParameterUnused)) { if (ts.tryAddToSet(seenParentsWithEveryUnused, parent)) { var sourceFile = ts.getSourceFileOfNode(parent); var range = ts.isJSDocTemplateTag(parent) @@ -69682,7 +70464,7 @@ var ts; var importDecl = importClause.parent; var nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? - (importClause.namedBindings.kind === 268 ? 1 : importClause.namedBindings.elements.length) + (importClause.namedBindings.kind === 271 ? 1 : importClause.namedBindings.elements.length) : 0); if (nDeclarations === unuseds.length) { addDiagnostic(importDecl, 0, unuseds.length === 1 @@ -69700,7 +70482,7 @@ var ts; var bindingPattern = _a[0], bindingElements = _a[1]; var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 : 0; if (bindingPattern.elements.length === bindingElements.length) { - if (bindingElements.length === 1 && bindingPattern.parent.kind === 254 && bindingPattern.parent.parent.kind === 255) { + if (bindingElements.length === 1 && bindingPattern.parent.kind === 257 && bindingPattern.parent.parent.kind === 258) { addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId); } else { @@ -69721,7 +70503,7 @@ var ts; if (declarationList.declarations.length === declarations.length) { addDiagnostic(declarationList, 0, declarations.length === 1 ? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name)) - : ts.createDiagnosticForNode(declarationList.parent.kind === 237 ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); + : ts.createDiagnosticForNode(declarationList.parent.kind === 240 ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); } else { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -69750,21 +70532,21 @@ var ts; switch (name.kind) { case 79: return ts.idText(name); - case 202: - case 201: + case 204: + case 203: return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name); default: return ts.Debug.assertNever(name); } } function isImportedDeclaration(node) { - return node.kind === 267 || node.kind === 270 || node.kind === 268; + return node.kind === 270 || node.kind === 273 || node.kind === 271; } function importClauseFromImported(decl) { - return decl.kind === 267 ? decl : decl.kind === 268 ? decl.parent : decl.parent.parent; + return decl.kind === 270 ? decl : decl.kind === 271 ? decl.parent : decl.parent.parent; } function checkBlock(node) { - if (node.kind === 235) { + if (node.kind === 238) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -69793,13 +70575,13 @@ var ts; if ((identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) !== name) { return false; } - if (node.kind === 167 || - node.kind === 166 || - node.kind === 169 || + if (node.kind === 169 || node.kind === 168 || - node.kind === 172 || - node.kind === 173 || - node.kind === 296) { + node.kind === 171 || + node.kind === 170 || + node.kind === 174 || + node.kind === 175 || + node.kind === 299) { return false; } if (node.flags & 16777216) { @@ -69857,7 +70639,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 305 && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 308 && ts.isExternalOrCommonJsModule(parent)) { errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -69869,7 +70651,7 @@ var ts; return; } var parent = getDeclarationContainer(node); - if (parent.kind === 305 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048) { + if (parent.kind === 308 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048) { errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } } @@ -69940,7 +70722,7 @@ var ts; if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) { return; } - if (node.kind === 254 && !node.initializer) { + if (node.kind === 257 && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -69952,15 +70734,15 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 255); - var container = varDeclList.parent.kind === 237 && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 258); + var container = varDeclList.parent.kind === 240 && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; var namesShareScope = container && - (container.kind === 235 && ts.isFunctionLike(container.parent) || - container.kind === 262 || - container.kind === 261 || - container.kind === 305); + (container.kind === 238 && ts.isFunctionLike(container.parent) || + container.kind === 265 || + container.kind === 264 || + container.kind === 308); if (!namesShareScope) { var name = symbolToString(localDeclarationSymbol); error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); @@ -69981,7 +70763,7 @@ var ts; if (!node.name) { return; } - if (node.name.kind === 162) { + if (node.name.kind === 164) { checkComputedPropertyName(node.name); if (ts.hasOnlyExpressionInitializer(node) && node.initializer) { checkExpressionCached(node.initializer); @@ -69998,7 +70780,7 @@ var ts; if (ts.isObjectBindingPattern(node.parent) && node.dotDotDotToken && languageVersion < 5) { checkExternalEmitHelpers(node, 4); } - if (node.propertyName && node.propertyName.kind === 162) { + if (node.propertyName && node.propertyName.kind === 164) { checkComputedPropertyName(node.propertyName); } var parent = node.parent.parent; @@ -70018,7 +70800,7 @@ var ts; } } if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 202 && languageVersion < 2 && compilerOptions.downlevelIteration) { + if (node.name.kind === 204 && languageVersion < 2 && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512); } ts.forEach(node.name.elements, checkSourceElement); @@ -70028,7 +70810,7 @@ var ts; return; } if (ts.isBindingPattern(node.name)) { - var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 243; + var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246; var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression)); if (needCheckInitializer || needCheckWidenedType) { var widenedType = getWidenedTypeForVariableLikeDeclaration(node); @@ -70053,7 +70835,7 @@ var ts; return; } var symbol = getSymbolOfNode(node); - if (symbol.flags & 2097152 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 ? node.parent.parent : node)) { + if (symbol.flags & 2097152 && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 205 ? node.parent.parent : node)) { checkAliasSymbol(node); return; } @@ -70065,7 +70847,7 @@ var ts; ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) && !!((_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.size); - if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 243) { + if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 246) { checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, undefined); } } @@ -70089,9 +70871,9 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 167 && node.kind !== 166) { + if (node.kind !== 169 && node.kind !== 168) { checkExportsOnMergedDeclarations(node); - if (node.kind === 254 || node.kind === 203) { + if (node.kind === 257 || node.kind === 205) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionsForDeclarationName(node, node.name); @@ -70099,7 +70881,7 @@ var ts; } function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) { var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration); - var message = nextDeclaration.kind === 167 || nextDeclaration.kind === 166 + var message = nextDeclaration.kind === 169 || nextDeclaration.kind === 168 ? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; var declName = ts.declarationNameToString(nextDeclarationName); @@ -70109,8 +70891,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 164 && right.kind === 254) || - (left.kind === 254 && right.kind === 164)) { + if ((left.kind === 166 && right.kind === 257) || + (left.kind === 257 && right.kind === 166)) { return true; } if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) { @@ -70118,8 +70900,8 @@ var ts; } var interestingFlags = 8 | 16 | + 512 | 256 | - 128 | 64 | 32; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); @@ -70145,15 +70927,15 @@ var ts; } function checkIfStatement(node) { checkGrammarStatementInAmbientContext(node); - checkTruthinessExpression(node.expression); - checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement); + var type = checkTruthinessExpression(node.expression); + checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 236) { + if (node.thenStatement.kind === 239) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); } - function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) { + function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) { if (!strictNullChecks) return; helper(condExpr, body); @@ -70168,7 +70950,7 @@ var ts; : condExpr; if (ts.isModuleExportsAccessExpression(location)) return; - var type = checkTruthinessExpression(location); + var type = location === condExpr ? condType : checkTruthinessExpression(location); var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression); if (!(getTypeFacts(type) & 4194304) || isPropertyExpressionCast) return; @@ -70271,12 +71053,12 @@ var ts; } function checkForStatement(node) { if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 255) { + if (node.initializer && node.initializer.kind === 258) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 255) { + if (node.initializer.kind === 258) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -70309,13 +71091,13 @@ var ts; else if (compilerOptions.downlevelIteration && languageVersion < 2) { checkExternalEmitHelpers(node, 256); } - if (node.initializer.kind === 255) { + if (node.initializer.kind === 258) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node); - if (varExpr.kind === 204 || varExpr.kind === 205) { + if (varExpr.kind === 206 || varExpr.kind === 207) { checkDestructuringAssignment(varExpr, iteratedType || errorType); } else { @@ -70334,7 +71116,7 @@ var ts; function checkForInStatement(node) { checkGrammarForInOrForOfStatement(node); var rightType = getNonNullableTypeIfNeeded(checkExpression(node.expression)); - if (node.initializer.kind === 255) { + if (node.initializer.kind === 258) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -70344,7 +71126,7 @@ var ts; else { var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 204 || varExpr.kind === 205) { + if (varExpr.kind === 206 || varExpr.kind === 207) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -70706,7 +71488,13 @@ var ts; var message = allowAsyncIterables ? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator : ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator; - return errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type)); + var suggestAwait = !!getAwaitedTypeOfPromise(type) + || (!allowAsyncIterables && + ts.isForOfStatement(errorNode.parent) && + errorNode.parent.expression === errorNode && + getGlobalAsyncIterableType(false) !== emptyGenericType && + isTypeAssignableTo(type, getGlobalAsyncIterableType(false))); + return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type)); } function getIterationTypesOfIterator(type, resolver, errorNode, errorOutputContainer) { return getIterationTypesOfIteratorWorker(type, resolver, errorNode, errorOutputContainer, false); @@ -70923,12 +71711,12 @@ var ts; var functionFlags = ts.getFunctionFlags(container); if (strictNullChecks || node.expression || returnType.flags & 131072) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (container.kind === 173) { + if (container.kind === 175) { if (node.expression) { error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (container.kind === 171) { + else if (container.kind === 173) { if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -70943,7 +71731,7 @@ var ts; } } } - else if (container.kind !== 171 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { + else if (container.kind !== 173 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } } @@ -70968,7 +71756,7 @@ var ts; var expressionType = checkExpression(node.expression); var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { - if (clause.kind === 290 && !hasDuplicateDefaultClause) { + if (clause.kind === 293 && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -70977,7 +71765,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (clause.kind === 289) { + if (clause.kind === 292) { addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause)); } ts.forEach(clause.statements, checkSourceElement); @@ -71009,7 +71797,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 250 && current.label.escapedText === node.label.escapedText) { + if (current.kind === 253 && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -71098,9 +71886,9 @@ var ts; return; } var indexInfos = getApplicableIndexInfos(type, propNameType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 258) : undefined; - var propDeclaration = declaration && declaration.kind === 221 || - name && name.kind === 162 ? declaration : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 261) : undefined; + var propDeclaration = declaration && declaration.kind === 223 || + name && name.kind === 164 ? declaration : undefined; var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined; var _loop_30 = function (info) { var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; @@ -71122,7 +71910,7 @@ var ts; function checkIndexConstraintForIndexSignature(type, checkInfo) { var declaration = checkInfo.declaration; var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 258) : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 ? ts.getDeclarationOfKind(type.symbol, 261) : undefined; var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined; var _loop_31 = function (info) { if (info === checkInfo) @@ -71186,7 +71974,7 @@ var ts; } else { ts.forEach(jsdocParameters, function (_a, index) { - var name = _a.name; + var name = _a.name, isNameFirst = _a.isNameFirst; if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) { return; } @@ -71196,7 +71984,9 @@ var ts; } } else { - errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name)); + if (!isNameFirst) { + errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name)); + } } }); } @@ -71230,7 +72020,7 @@ var ts; function checkTypeParametersNotReferenced(root, typeParameters, index) { visit(root); function visit(node) { - if (node.kind === 178) { + if (node.kind === 180) { var type = getTypeFromTypeReference(node); if (type.flags & 262144) { for (var i = index; i < typeParameters.length; i++) { @@ -71309,7 +72099,7 @@ var ts; if (firstDecorator && ts.some(node.members, function (p) { return ts.hasStaticModifier(p) && ts.isPrivateIdentifierClassElementDeclaration(p); })) { grammarErrorOnNode(firstDecorator, ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator); } - if (!node.name && !ts.hasSyntacticModifier(node, 512)) { + if (!node.name && !ts.hasSyntacticModifier(node, 1024)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -71373,7 +72163,7 @@ var ts; } else { var constructSignatures = getSignaturesOfType(baseConstructorType, 1); - if (constructSignatures.some(function (signature) { return signature.flags & 4; }) && !ts.hasSyntacticModifier(node, 128)) { + if (constructSignatures.some(function (signature) { return signature.flags & 4; }) && !ts.hasSyntacticModifier(node, 256)) { error(node.name || node, ts.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract); } } @@ -71580,7 +72370,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 257 || d.kind === 258; + return d.kind === 260 || d.kind === 261; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -71600,7 +72390,7 @@ var ts; ts.Debug.assert(!!derived, "derived should point to something, even if it is the base class' declaration."); if (derived === base) { var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol); - if (baseDeclarationFlags & 128 && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 128))) { + if (baseDeclarationFlags & 256 && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 256))) { for (var _e = 0, _f = getBaseTypes(type); _e < _f.length; _e++) { var otherBaseType = _f[_e]; if (otherBaseType === baseType) @@ -71611,7 +72401,7 @@ var ts; return "continue-basePropertyCheck"; } } - if (derivedClassDecl.kind === 226) { + if (derivedClassDecl.kind === 228) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -71644,11 +72434,11 @@ var ts; error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type)); } else if (useDefineForClassFields) { - var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 && !d.initializer; }); + var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 169 && !d.initializer; }); if (uninitialized && !(derived.flags & 33554432) - && !(baseDeclarationFlags & 128) - && !(derivedDeclarationFlags & 128) + && !(baseDeclarationFlags & 256) + && !(derivedDeclarationFlags & 256) && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216); }))) { var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol)); var propName = uninitialized.name; @@ -71691,7 +72481,7 @@ var ts; } } function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) { - return baseDeclarationFlags & 128 && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) + return baseDeclarationFlags & 256 && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) || ts.isInterfaceDeclaration(declaration.parent); } function getNonInheritedProperties(type, baseTypes, properties) { @@ -71773,7 +72563,7 @@ var ts; } } function isPropertyWithoutInitializer(node) { - return node.kind === 167 && + return node.kind === 169 && !ts.hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; @@ -71813,7 +72603,7 @@ var ts; checkExportsOnMergedDeclarations(node); var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 258); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 261); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -71844,7 +72634,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); checkExportsOnMergedDeclarations(node); checkTypeParameters(node.typeParameters); - if (node.type.kind === 138) { + if (node.type.kind === 139) { if (!intrinsicTypeKinds.has(node.name.escapedText) || ts.length(node.typeParameters) !== 1) { error(node.type, ts.Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); } @@ -71923,7 +72713,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 219: + case 221: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -71933,7 +72723,7 @@ var ts; } } break; - case 221: + case 223: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -71962,7 +72752,7 @@ var ts; case 8: checkGrammarNumericLiteral(expr); return +expr.text; - case 212: + case 214: return evaluate(expr.expression); case 79: var identifier = expr; @@ -71970,13 +72760,13 @@ var ts; return +(identifier.escapedText); } return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText); - case 207: - case 206: + case 209: + case 208: if (isConstantMemberAccess(expr)) { var type = getTypeOfExpression(expr.expression); if (type.symbol && type.symbol.flags & 384) { var name = void 0; - if (expr.kind === 206) { + if (expr.kind === 208) { name = expr.name.escapedText; } else { @@ -72013,8 +72803,8 @@ var ts; return false; } return node.kind === 79 || - node.kind === 206 && isConstantMemberAccess(node.expression) || - node.kind === 207 && isConstantMemberAccess(node.expression) && + node.kind === 208 && isConstantMemberAccess(node.expression) || + node.kind === 209 && isConstantMemberAccess(node.expression) && ts.isStringLiteralLike(node.argumentExpression); } function checkEnumDeclaration(node) { @@ -72039,7 +72829,7 @@ var ts; } var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { - if (declaration.kind !== 260) { + if (declaration.kind !== 263) { return false; } var enumDeclaration = declaration; @@ -72068,8 +72858,8 @@ var ts; if (declarations) { for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; - if ((declaration.kind === 257 || - (declaration.kind === 256 && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 260 || + (declaration.kind === 259 && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 16777216)) { return declaration; } @@ -72135,7 +72925,7 @@ var ts; error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged); } } - var mergedClass = ts.getDeclarationOfKind(symbol, 257); + var mergedClass = ts.getDeclarationOfKind(symbol, 260); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768; @@ -72171,48 +72961,40 @@ var ts; } } function checkModuleAugmentationElement(node, isGlobalAugmentation) { - var _a; switch (node.kind) { - case 237: - for (var _i = 0, _b = node.declarationList.declarations; _i < _b.length; _i++) { - var decl = _b[_i]; + case 240: + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 271: - case 272: + case 274: + case 275: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 265: - case 266: + case 268: + case 269: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 203: - case 254: + case 205: + case 257: var name = node.name; if (ts.isBindingPattern(name)) { - for (var _c = 0, _d = name.elements; _c < _d.length; _c++) { - var el = _d[_c]; + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { + var el = _c[_b]; checkModuleAugmentationElement(el, isGlobalAugmentation); } break; } - case 257: case 260: - case 256: - case 258: - case 261: + case 263: case 259: + case 261: + case 264: + case 262: if (isGlobalAugmentation) { return; } - var symbol = getSymbolOfNode(node); - if (symbol) { - var reportError = !(symbol.flags & 33554432); - if (!reportError) { - reportError = !!((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.declarations) && ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); - } - } break; } } @@ -72220,12 +73002,12 @@ var ts; switch (node.kind) { case 79: return node; - case 161: + case 163: do { node = node.left; } while (node.kind !== 79); return node; - case 206: + case 208: do { if (ts.isModuleExportsAccessExpression(node.expression) && !ts.isPrivateIdentifier(node.name)) { return node.name; @@ -72244,9 +73026,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 262 && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 305 && !inAmbientExternalModule) { - error(moduleName, node.kind === 272 ? + var inAmbientExternalModule = node.parent.kind === 265 && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 308 && !inAmbientExternalModule) { + error(moduleName, node.kind === 275 ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -72280,8 +73062,8 @@ var ts; var errorNode = ts.isImportOrExportSpecifier(node) ? node.propertyName || node.name : ts.isNamedDeclaration(node) ? node.name : node; - ts.Debug.assert(node.kind !== 274); - if (node.kind === 275) { + ts.Debug.assert(node.kind !== 277); + if (node.kind === 278) { var diag = error(errorNode, ts.Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files); var alreadyExportedSymbol = (_b = (_a = ts.getSourceFileOfNode(node).symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.get((node.propertyName || node.name).escapedText); if (alreadyExportedSymbol === target) { @@ -72292,7 +73074,7 @@ var ts; } } else { - ts.Debug.assert(node.kind !== 254); + ts.Debug.assert(node.kind !== 257); var importDeclaration = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)); var moduleSpecifier = (_e = (importDeclaration && ((_d = ts.tryGetModuleSpecifierFromDeclaration(importDeclaration)) === null || _d === void 0 ? void 0 : _d.text))) !== null && _e !== void 0 ? _e : "..."; var importedIdentifier = ts.unescapeLeadingUnderscores(ts.isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName); @@ -72300,11 +73082,12 @@ var ts; } return; } + var targetFlags = getAllSymbolFlags(target); var excludedMeanings = (symbol.flags & (111551 | 1048576) ? 111551 : 0) | (symbol.flags & 788968 ? 788968 : 0) | (symbol.flags & 1920 ? 1920 : 0); - if (target.flags & excludedMeanings) { - var message = node.kind === 275 ? + if (targetFlags & excludedMeanings) { + var message = node.kind === 278 ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -72313,26 +73096,26 @@ var ts; && !ts.isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 16777216)) { var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol); - var isType = !(target.flags & 111551); + var isType = !(targetFlags & 111551); if (isType || typeOnlyAlias) { switch (node.kind) { - case 267: case 270: - case 265: { + case 273: + case 268: { if (compilerOptions.preserveValueImports) { ts.Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name"); var message = isType ? ts.Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled : ts.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled; - var name = ts.idText(node.kind === 270 ? node.propertyName || node.name : node.name); + var name = ts.idText(node.kind === 273 ? node.propertyName || node.name : node.name); addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name); } - if (isType && node.kind === 265 && ts.hasEffectiveModifier(node, 1)) { + if (isType && node.kind === 268 && ts.hasEffectiveModifier(node, 1)) { error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided); } break; } - case 275: { + case 278: { if (ts.getSourceFileOfNode(typeOnlyAlias) !== ts.getSourceFileOfNode(node)) { var message = isType ? ts.Diagnostics.Re_exporting_a_type_when_the_isolatedModules_flag_is_provided_requires_using_export_type @@ -72388,7 +73171,7 @@ var ts; function checkImportBinding(node) { checkCollisionsForDeclarationName(node, node.name); checkAliasSymbol(node); - if (node.kind === 270 && + if (node.kind === 273 && ts.idText(node.propertyName || node.name) === "default" && ts.getESModuleInterop(compilerOptions) && moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) { @@ -72437,7 +73220,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268) { + if (importClause.namedBindings.kind === 271) { checkImportBinding(importClause.namedBindings); if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && ts.getESModuleInterop(compilerOptions)) { checkExternalEmitHelpers(node, 65536); @@ -72464,16 +73247,17 @@ var ts; if (ts.hasSyntacticModifier(node, 1)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 277) { + if (node.moduleReference.kind !== 280) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { - if (target.flags & 111551) { + var targetFlags = getAllSymbolFlags(target); + if (targetFlags & 111551) { var moduleName = ts.getFirstIdentifier(node.moduleReference); if (!(resolveEntityName(moduleName, 111551 | 1920).flags & 1920)) { error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName)); } } - if (target.flags & 788968) { + if (targetFlags & 788968) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0); } } @@ -72502,10 +73286,10 @@ var ts; if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) { if (node.exportClause && !ts.isNamespaceExport(node.exportClause)) { ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 262 && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 && + var inAmbientExternalModule = node.parent.kind === 265 && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 265 && !node.moduleSpecifier && node.flags & 16777216; - if (node.parent.kind !== 305 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 308 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -72534,7 +73318,7 @@ var ts; function checkGrammarExportDeclaration(node) { var _a; if (node.isTypeOnly) { - if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 273) { + if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 276) { return checkGrammarNamedImportsOrExports(node.exportClause); } else { @@ -72544,7 +73328,7 @@ var ts; return false; } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 305 || node.parent.kind === 262 || node.parent.kind === 261; + var isInAppropriateContext = node.parent.kind === 308 || node.parent.kind === 265 || node.parent.kind === 264; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -72600,7 +73384,7 @@ var ts; markExportAsReferenced(node); } var target = symbol && (symbol.flags & 2097152 ? resolveAlias(symbol) : symbol); - if (!target || target === unknownSymbol || target.flags & 111551) { + if (!target || getAllSymbolFlags(target) & 111551) { checkExpressionCached(node.propertyName || node.name); } } @@ -72621,8 +73405,8 @@ var ts; if (checkGrammarModuleElementContext(node, illegalContextMessage)) { return; } - var container = node.parent.kind === 305 ? node.parent : node.parent.parent; - if (container.kind === 261 && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 ? node.parent : node.parent.parent; + if (container.kind === 264 && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -72644,7 +73428,7 @@ var ts; if (sym) { markAliasReferenced(sym, id); var target = sym.flags & 2097152 ? resolveAlias(sym) : sym; - if (target === unknownSymbol || target.flags & 111551) { + if (getAllSymbolFlags(target) & 111551) { checkExpressionCached(node.expression); } } @@ -72742,180 +73526,180 @@ var ts; var kind = node.kind; if (cancellationToken) { switch (kind) { + case 264: + case 260: case 261: - case 257: - case 258: - case 256: + case 259: cancellationToken.throwIfCancellationRequested(); } } - if (kind >= 237 && kind <= 253 && node.flowNode && !isReachableFlowNode(node.flowNode)) { + if (kind >= 240 && kind <= 256 && node.flowNode && !isReachableFlowNode(node.flowNode)) { errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, ts.Diagnostics.Unreachable_code_detected); } switch (kind) { - case 163: + case 165: return checkTypeParameter(node); - case 164: + case 166: return checkParameter(node); - case 167: + case 169: return checkPropertyDeclaration(node); - case 166: + case 168: return checkPropertySignature(node); - case 180: - case 179: - case 174: - case 175: + case 182: + case 181: case 176: + case 177: + case 178: return checkSignatureDeclaration(node); - case 169: - case 168: - return checkMethodDeclaration(node); - case 170: - return checkClassStaticBlockDeclaration(node); case 171: - return checkConstructorDeclaration(node); + case 170: + return checkMethodDeclaration(node); case 172: + return checkClassStaticBlockDeclaration(node); case 173: + return checkConstructorDeclaration(node); + case 174: + case 175: return checkAccessorDeclaration(node); - case 178: + case 180: return checkTypeReferenceNode(node); - case 177: + case 179: return checkTypePredicate(node); - case 181: + case 183: return checkTypeQuery(node); - case 182: + case 184: return checkTypeLiteral(node); - case 183: + case 185: return checkArrayType(node); - case 184: + case 186: return checkTupleType(node); + case 189: + case 190: + return checkUnionOrIntersectionType(node); + case 193: case 187: case 188: - return checkUnionOrIntersectionType(node); - case 191: - case 185: - case 186: return checkSourceElement(node.type); - case 192: + case 194: return checkThisType(node); - case 193: + case 195: return checkTypeOperator(node); - case 189: + case 191: return checkConditionalType(node); - case 190: + case 192: return checkInferType(node); - case 198: - return checkTemplateLiteralType(node); case 200: + return checkTemplateLiteralType(node); + case 202: return checkImportType(node); - case 197: + case 199: return checkNamedTupleMember(node); - case 328: + case 331: return checkJSDocAugmentsTag(node); - case 329: + case 332: return checkJSDocImplementsTag(node); - case 345: - case 338: - case 339: + case 348: + case 341: + case 342: return checkJSDocTypeAliasTag(node); - case 344: + case 347: return checkJSDocTemplateTag(node); - case 343: + case 346: return checkJSDocTypeTag(node); - case 324: - case 325: - case 326: + case 327: + case 328: + case 329: return checkJSDocLinkLikeTag(node); - case 340: + case 343: return checkJSDocParameterTag(node); - case 347: + case 350: return checkJSDocPropertyTag(node); - case 317: + case 320: checkJSDocFunctionType(node); + case 318: + case 317: case 315: - case 314: - case 312: - case 313: - case 322: + case 316: + case 325: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 318: + case 321: checkJSDocVariadicType(node); return; - case 309: + case 312: return checkSourceElement(node.type); - case 333: - case 335: - case 334: + case 336: + case 338: + case 337: return checkJSDocAccessibilityModifiers(node); - case 194: + case 196: return checkIndexedAccessType(node); - case 195: + case 197: return checkMappedType(node); - case 256: + case 259: return checkFunctionDeclaration(node); - case 235: - case 262: + case 238: + case 265: return checkBlock(node); - case 237: + case 240: return checkVariableStatement(node); - case 238: + case 241: return checkExpressionStatement(node); - case 239: + case 242: return checkIfStatement(node); - case 240: + case 243: return checkDoStatement(node); - case 241: + case 244: return checkWhileStatement(node); - case 242: + case 245: return checkForStatement(node); - case 243: + case 246: return checkForInStatement(node); - case 244: + case 247: return checkForOfStatement(node); - case 245: - case 246: + case 248: + case 249: return checkBreakOrContinueStatement(node); - case 247: + case 250: return checkReturnStatement(node); - case 248: + case 251: return checkWithStatement(node); - case 249: + case 252: return checkSwitchStatement(node); - case 250: + case 253: return checkLabeledStatement(node); - case 251: + case 254: return checkThrowStatement(node); - case 252: + case 255: return checkTryStatement(node); - case 254: + case 257: return checkVariableDeclaration(node); - case 203: + case 205: return checkBindingElement(node); - case 257: + case 260: return checkClassDeclaration(node); - case 258: + case 261: return checkInterfaceDeclaration(node); - case 259: + case 262: return checkTypeAliasDeclaration(node); - case 260: + case 263: return checkEnumDeclaration(node); - case 261: + case 264: return checkModuleDeclaration(node); - case 266: + case 269: return checkImportDeclaration(node); - case 265: + case 268: return checkImportEqualsDeclaration(node); - case 272: + case 275: return checkExportDeclaration(node); - case 271: + case 274: return checkExportAssignment(node); - case 236: - case 253: + case 239: + case 256: checkGrammarStatementInAmbientContext(node); return; - case 276: + case 279: return checkMissingDeclaration(node); } } @@ -73003,33 +73787,33 @@ var ts; currentNode = node; instantiationCount = 0; switch (node.kind) { - case 208: - case 209: case 210: - case 165: - case 280: + case 211: + case 212: + case 167: + case 283: resolveUntypedCall(node); break; - case 213: - case 214: - case 169: - case 168: + case 215: + case 216: + case 171: + case 170: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 172: - case 173: + case 174: + case 175: checkAccessorDeclaration(node); break; - case 226: + case 228: checkClassExpressionDeferred(node); break; - case 163: + case 165: checkTypeParameterDeferred(node); break; - case 279: + case 282: checkJsxSelfClosingElementDeferred(node); break; - case 278: + case 281: checkJsxElementDeferred(node); break; } @@ -73179,27 +73963,27 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 305: + case 308: if (!ts.isExternalModule(location)) break; - case 261: + case 264: copyLocallyVisibleExportSymbols(getSymbolOfNode(location).exports, meaning & 2623475); break; - case 260: + case 263: copySymbols(getSymbolOfNode(location).exports, meaning & 8); break; - case 226: + case 228: var className = location.name; if (className) { copySymbol(location.symbol, meaning); } - case 257: - case 258: + case 260: + case 261: if (!isStaticSymbol) { copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968); } break; - case 213: + case 215: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -73232,7 +74016,7 @@ var ts; function copyLocallyVisibleExportSymbols(source, meaning) { if (meaning) { source.forEach(function (symbol) { - if (!ts.getDeclarationOfKind(symbol, 275) && !ts.getDeclarationOfKind(symbol, 274)) { + if (!ts.getDeclarationOfKind(symbol, 278) && !ts.getDeclarationOfKind(symbol, 277)) { copySymbol(symbol, meaning); } }); @@ -73241,40 +74025,20 @@ var ts; } function isTypeDeclarationName(name) { return name.kind === 79 && - isTypeDeclaration(name.parent) && + ts.isTypeDeclaration(name.parent) && ts.getNameOfDeclaration(name.parent) === name; } - function isTypeDeclaration(node) { - switch (node.kind) { - case 163: - case 257: - case 258: - case 259: - case 260: - case 345: - case 338: - case 339: - return true; - case 267: - return node.isTypeOnly; - case 270: - case 275: - return node.parent.parent.isTypeOnly; - default: - return false; - } - } function isTypeReferenceIdentifier(node) { - while (node.parent.kind === 161) { + while (node.parent.kind === 163) { node = node.parent; } - return node.parent.kind === 178; + return node.parent.kind === 180; } function isHeritageClauseElementIdentifier(node) { - while (node.parent.kind === 206) { + while (node.parent.kind === 208) { node = node.parent; } - return node.parent.kind === 228; + return node.parent.kind === 230; } function forEachEnclosingClass(node, callback) { var result; @@ -73302,13 +74066,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 161) { + while (nodeOnRightSide.parent.kind === 163) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 265) { + if (nodeOnRightSide.parent.kind === 268) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } - if (nodeOnRightSide.parent.kind === 271) { + if (nodeOnRightSide.parent.kind === 274) { return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } return undefined; @@ -73334,7 +74098,7 @@ var ts; node = parent; parent = parent.parent; } - if (parent && parent.kind === 200 && parent.qualifier === node) { + if (parent && parent.kind === 202 && parent.qualifier === node) { return parent; } return undefined; @@ -73344,7 +74108,7 @@ var ts; return getSymbolOfNode(name.parent); } if (ts.isInJSFile(name) && - name.parent.kind === 206 && + name.parent.kind === 208 && name.parent === name.parent.parent.left) { if (!ts.isPrivateIdentifier(name) && !ts.isJSDocMemberName(name)) { var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(name); @@ -73353,14 +74117,14 @@ var ts; } } } - if (name.parent.kind === 271 && ts.isEntityNameExpression(name)) { + if (name.parent.kind === 274 && ts.isEntityNameExpression(name)) { var success = resolveEntityName(name, 111551 | 788968 | 1920 | 2097152, true); if (success && success !== unknownSymbol) { return success; } } else if (ts.isEntityName(name) && isInRightSideOfImportOrExportAssignment(name)) { - var importEqualsDeclaration = ts.getAncestor(name, 265); + var importEqualsDeclaration = ts.getAncestor(name, 268); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(name, true); } @@ -73377,7 +74141,7 @@ var ts; } if (isHeritageClauseElementIdentifier(name)) { var meaning = 0; - if (name.parent.kind === 228) { + if (name.parent.kind === 230) { meaning = 788968; if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) { meaning |= 111551; @@ -73392,10 +74156,10 @@ var ts; return entityNameSymbol; } } - if (name.parent.kind === 340) { + if (name.parent.kind === 343) { return ts.getParameterSymbolFromJSDoc(name.parent); } - if (name.parent.kind === 163 && name.parent.parent.kind === 344) { + if (name.parent.kind === 165 && name.parent.parent.kind === 347) { ts.Debug.assert(!ts.isInJSFile(name)); var typeParameter = ts.getTypeParameterFromJsDoc(name.parent); return typeParameter && typeParameter.symbol; @@ -73418,18 +74182,53 @@ var ts; return resolveJSDocMemberName(name, false, getSymbolOfNode(container)); } } + if (result && isJSDoc_1) { + var container = ts.getJSDocHost(name); + if (container && ts.isEnumMember(container) && container === result.valueDeclaration) { + return resolveEntityName(name, meaning, true, true, ts.getSourceFileOfNode(container)) || result; + } + } return result; } else if (ts.isPrivateIdentifier(name)) { return getSymbolForPrivateIdentifierExpression(name); } - else if (name.kind === 206 || name.kind === 161) { + else if (name.kind === 208 || name.kind === 163) { var links = getNodeLinks(name); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (name.kind === 206) { + if (name.kind === 208) { checkPropertyAccessExpression(name, 0); + if (!links.resolvedSymbol) { + var expressionType = checkExpressionCached(name.expression); + var infos = getApplicableIndexInfos(expressionType, getLiteralTypeFromPropertyName(name.name)); + if (infos.length && expressionType.members) { + var resolved = resolveStructuredTypeMembers(expressionType); + var symbol = resolved.members.get("__index"); + if (infos === getIndexInfosOfType(expressionType)) { + links.resolvedSymbol = symbol; + } + else if (symbol) { + var symbolLinks_1 = getSymbolLinks(symbol); + var declarationList = ts.mapDefined(infos, function (i) { return i.declaration; }); + var nodeListId = ts.map(declarationList, getNodeId).join(","); + if (!symbolLinks_1.filteredIndexSymbolCache) { + symbolLinks_1.filteredIndexSymbolCache = new ts.Map(); + } + if (symbolLinks_1.filteredIndexSymbolCache.has(nodeListId)) { + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + else { + var copy = createSymbol(131072, "__index"); + copy.declarations = ts.mapDefined(infos, function (i) { return i.declaration; }); + copy.parent = expressionType.aliasSymbol ? expressionType.aliasSymbol : expressionType.symbol ? expressionType.symbol : getSymbolAtLocation(copy.declarations[0].parent); + symbolLinks_1.filteredIndexSymbolCache.set(nodeListId, copy); + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + } + } + } } else { checkQualifiedName(name, 0); @@ -73444,11 +74243,11 @@ var ts; } } else if (isTypeReferenceIdentifier(name)) { - var meaning = name.parent.kind === 178 ? 788968 : 1920; + var meaning = name.parent.kind === 180 ? 788968 : 1920; var symbol = resolveEntityName(name, meaning, false, true); return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name); } - if (name.parent.kind === 177) { + if (name.parent.kind === 179) { return resolveEntityName(name, 1); } return undefined; @@ -73473,7 +74272,7 @@ var ts; } } function getSymbolAtLocation(node, ignoreErrors) { - if (node.kind === 305) { + if (node.kind === 308) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } var parent = node.parent; @@ -73494,8 +74293,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } - else if (parent.kind === 203 && - grandParent.kind === 201 && + else if (parent.kind === 205 && + grandParent.kind === 203 && node === parent.propertyName) { var typeOfPattern = getTypeOfNode(grandParent); var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText); @@ -73516,8 +74315,8 @@ var ts; switch (node.kind) { case 79: case 80: - case 206: - case 161: + case 208: + case 163: if (!ts.isThisInTypeQuery(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } @@ -73532,20 +74331,20 @@ var ts; if (ts.isInExpressionContext(node)) { return checkExpression(node).symbol; } - case 192: + case 194: return getTypeFromThisTypeNode(node).symbol; case 106: return checkExpression(node).symbol; - case 134: + case 135: var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 171) { + if (constructorDeclaration && constructorDeclaration.kind === 173) { return constructorDeclaration.parent.symbol; } return undefined; case 10: case 14: if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 266 || node.parent.kind === 272) && node.parent.moduleSpecifier === node) || + ((node.parent.kind === 269 || node.parent.kind === 275) && node.parent.moduleSpecifier === node) || ((ts.isInJSFile(node) && ts.isRequireCall(node.parent, false)) || ts.isImportCall(node.parent)) || (ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) { return resolveExternalModuleName(node, node, ignoreErrors); @@ -73565,14 +74364,14 @@ var ts; case 38: case 84: return getSymbolOfNode(node.parent); - case 200: + case 202: return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : undefined; case 93: return ts.isExportAssignment(node.parent) ? ts.Debug.checkDefined(node.parent.symbol) : undefined; case 100: case 103: return ts.isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : undefined; - case 231: + case 233: return checkExpression(node).symbol; default: return undefined; @@ -73588,7 +74387,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 297) { + if (location && location.kind === 300) { return resolveEntityName(location.name, 111551 | 2097152); } return undefined; @@ -73623,7 +74422,7 @@ var ts; var baseType = ts.firstOrUndefined(getBaseTypes(classType)); return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType; } - if (isTypeDeclaration(node)) { + if (ts.isTypeDeclaration(node)) { var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); } @@ -73658,16 +74457,16 @@ var ts; return errorType; } function getTypeOfAssignmentPattern(expr) { - ts.Debug.assert(expr.kind === 205 || expr.kind === 204); - if (expr.parent.kind === 244) { + ts.Debug.assert(expr.kind === 207 || expr.kind === 206); + if (expr.parent.kind === 247) { var iteratedType = checkRightHandSideOfForOf(expr.parent); return checkDestructuringAssignment(expr, iteratedType || errorType); } - if (expr.parent.kind === 221) { + if (expr.parent.kind === 223) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || errorType); } - if (expr.parent.kind === 296) { + if (expr.parent.kind === 299) { var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression); var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType; var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent); @@ -73702,7 +74501,7 @@ var ts; case 8: case 10: return getStringLiteralType(name.text); - case 162: + case 164: var nameType = checkComputedPropertyName(name); return isTypeAssignableToKind(nameType, 12288) ? nameType : stringType; default: @@ -73781,7 +74580,7 @@ var ts; return symbolLinks.exportsSomeValue; function isValue(s) { s = resolveSymbol(s); - return s && !!(s.flags & 111551); + return s && !!(getAllSymbolFlags(s) & 111551); } } function isNameOfModuleOrEnumDeclaration(node) { @@ -73802,7 +74601,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 305) { + if (parentSymbol_1.flags & 512 && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 308) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); var symbolIsUmdExport = symbolFile !== referenceFile; @@ -73819,8 +74618,8 @@ var ts; } var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier); if (node) { - var symbol = getReferencedValueSymbol(node); - if (isNonLocalAlias(symbol, 111551) && !getTypeOnlyAliasDeclaration(symbol)) { + var symbol = getReferencedValueOrAliasSymbol(node); + if (isNonLocalAlias(symbol, 111551) && !getTypeOnlyAliasDeclaration(symbol, 111551)) { return getDeclarationOfAliasSymbol(symbol); } } @@ -73829,7 +74628,7 @@ var ts; function isSymbolOfDestructuredElementOfCatchBinding(symbol) { return symbol.valueDeclaration && ts.isBindingElement(symbol.valueDeclaration) - && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 292; + && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 295; } function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 && symbol.valueDeclaration && !ts.isSourceFile(symbol.valueDeclaration)) { @@ -73844,7 +74643,7 @@ var ts; else if (nodeLinks_1.flags & 262144) { var isDeclaredInLoop = nodeLinks_1.flags & 524288; var inLoopInitializer = ts.isIterationStatement(container, false); - var inLoopBodyBlock = container.kind === 235 && ts.isIterationStatement(container.parent, false); + var inLoopBodyBlock = container.kind === 238 && ts.isIterationStatement(container.parent, false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -73880,19 +74679,19 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 265: - return isAliasResolvedToValue(getSymbolOfNode(node)); - case 267: case 268: + return isAliasResolvedToValue(getSymbolOfNode(node)); case 270: - case 275: + case 271: + case 273: + case 278: var symbol = getSymbolOfNode(node); - return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol); - case 272: + return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol, 111551); + case 275: var exportClause = node.exportClause; return !!exportClause && (ts.isNamespaceExport(exportClause) || ts.some(exportClause.elements, isValueAliasDeclaration)); - case 271: + case 274: return node.expression && node.expression.kind === 79 ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; @@ -73901,13 +74700,14 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(nodeIn) { var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 305 || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 308 || !ts.isInternalModuleImportEqualsDeclaration(node)) { return false; } var isValue = isAliasResolvedToValue(getSymbolOfNode(node)); return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference); } function isAliasResolvedToValue(symbol) { + var _a; if (!symbol) { return false; } @@ -73915,7 +74715,7 @@ var ts; if (target === unknownSymbol) { return true; } - return !!(target.flags & 111551) && + return !!(((_a = getAllSymbolFlags(target)) !== null && _a !== void 0 ? _a : -1) & 111551) && (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target)); } function isConstEnumOrConstEnumOnlyModule(s) { @@ -73930,7 +74730,7 @@ var ts; } var target = getSymbolLinks(symbol).aliasTarget; if (target && ts.getEffectiveModifierFlags(node) & 1 && - target.flags & 111551 && + getAllSymbolFlags(target) & 111551 && (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) { return true; } @@ -73996,15 +74796,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 299: - case 206: - case 207: + case 302: + case 208: + case 209: return true; } return false; } function getConstantValue(node) { - if (node.kind === 299) { + if (node.kind === 302) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -74092,7 +74892,7 @@ var ts; function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) { var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor); if (!declaration) { - return ts.factory.createToken(130); + return ts.factory.createToken(131); } var symbol = getSymbolOfNode(declaration); var type = symbol && !(symbol.flags & (2048 | 131072)) @@ -74110,7 +74910,7 @@ var ts; function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) { var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike); if (!signatureDeclaration) { - return ts.factory.createToken(130); + return ts.factory.createToken(131); } var signature = getSignatureFromDeclaration(signatureDeclaration); return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024, tracker); @@ -74118,7 +74918,7 @@ var ts; function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) { var expr = ts.getParseTreeNode(exprIn, ts.isExpression); if (!expr) { - return ts.factory.createToken(130); + return ts.factory.createToken(131); } var type = getWidenedType(getRegularTypeOfExpression(expr)); return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024, tracker); @@ -74140,6 +74940,13 @@ var ts; } return resolveName(location, reference.escapedText, 111551 | 1048576 | 2097152, undefined, undefined, true); } + function getReferencedValueOrAliasSymbol(reference) { + var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; + if (resolvedSymbol && resolvedSymbol !== unknownSymbol) { + return resolvedSymbol; + } + return resolveName(reference, reference.escapedText, 111551 | 1048576 | 2097152, undefined, undefined, true, undefined, undefined); + } function getReferencedValueDeclaration(referenceIn) { if (!ts.isGeneratedIdentifier(referenceIn)) { var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier); @@ -74266,12 +75073,12 @@ var ts; getJsxFragmentFactoryEntity: getJsxFragmentFactoryEntity, getAllAccessorDeclarations: function (accessor) { accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); - var otherKind = accessor.kind === 173 ? 172 : 173; + var otherKind = accessor.kind === 175 ? 174 : 175; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind); var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor; var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor; - var setAccessor = accessor.kind === 173 ? accessor : otherAccessor; - var getAccessor = accessor.kind === 172 ? accessor : otherAccessor; + var setAccessor = accessor.kind === 175 ? accessor : otherAccessor; + var getAccessor = accessor.kind === 174 ? accessor : otherAccessor; return { firstAccessor: firstAccessor, secondAccessor: secondAccessor, @@ -74287,7 +75094,7 @@ var ts; }, getDeclarationStatementsForSourceFile: function (node, flags, tracker, bundled) { var n = ts.getParseTreeNode(node); - ts.Debug.assert(n && n.kind === 305, "Non-sourcefile node passed into getDeclarationsForSourceFile"); + ts.Debug.assert(n && n.kind === 308, "Non-sourcefile node passed into getDeclarationsForSourceFile"); var sym = getSymbolOfNode(node); if (!sym) { return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker, bundled); @@ -74324,19 +75131,19 @@ var ts; return false; } function isInHeritageClause(node) { - return node.parent && node.parent.kind === 228 && node.parent.parent && node.parent.parent.kind === 291; + return node.parent && node.parent.kind === 230 && node.parent.parent && node.parent.parent.kind === 294; } function getTypeReferenceDirectivesForEntityName(node) { if (!fileToDirective) { return undefined; } var meaning; - if (node.parent.kind === 162) { + if (node.parent.kind === 164) { meaning = 111551 | 1048576; } else { meaning = 788968 | 1920; - if ((node.kind === 79 && isInTypeQuery(node)) || (node.kind === 206 && !isInHeritageClause(node))) { + if ((node.kind === 79 && isInTypeQuery(node)) || (node.kind === 208 && !isInHeritageClause(node))) { meaning = 111551 | 1048576; } } @@ -74377,7 +75184,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 305 && current.flags & 512) { + if (current.valueDeclaration && current.valueDeclaration.kind === 308 && current.flags & 512) { return false; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { @@ -74404,12 +75211,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 261 ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 264 ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, undefined); if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 305); + return ts.getDeclarationOfKind(moduleSymbol, 308); } function initializeTypeChecker() { for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) { @@ -74600,14 +75407,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) { - if (node.kind === 169 && !ts.nodeIsPresent(node.body)) { + if (node.kind === 171 && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 172 || node.kind === 173) { + else if (node.kind === 174 || node.kind === 175) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (ts.hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -74626,26 +75433,26 @@ var ts; var modifier = _a[_i]; if (ts.isDecorator(modifier)) continue; - if (modifier.kind !== 145) { - if (node.kind === 166 || node.kind === 168) { + if (modifier.kind !== 146) { + if (node.kind === 168 || node.kind === 170) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 176 && (modifier.kind !== 124 || !ts.isClassLike(node.parent))) { + if (node.kind === 178 && (modifier.kind !== 124 || !ts.isClassLike(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } - if (modifier.kind !== 101 && modifier.kind !== 144) { - if (node.kind === 163) { + if (modifier.kind !== 101 && modifier.kind !== 145) { + if (node.kind === 165) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 85: - if (node.kind !== 260) { + if (node.kind !== 263) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(85)); } break; - case 159: + case 161: if (flags & 16384) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "override"); } @@ -74655,7 +75462,10 @@ var ts; else if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); } - else if (flags & 256) { + else if (flags & 128) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor"); + } + else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); } flags |= 16384; @@ -74674,16 +75484,19 @@ var ts; else if (flags & 32) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & 128) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor"); + } else if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); } - else if (flags & 256) { + else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 262 || node.parent.kind === 305) { + else if (node.parent.kind === 265 || node.parent.kind === 308) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } - else if (flags & 128) { + else if (flags & 256) { if (modifier.kind === 121) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } @@ -74703,16 +75516,19 @@ var ts; else if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); } - else if (flags & 256) { + else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 262 || node.parent.kind === 305) { + else if (flags & 128) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); + } + else if (node.parent.kind === 265 || node.parent.kind === 308) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 164) { + else if (node.kind === 166) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - else if (flags & 128) { + else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } else if (flags & 16384) { @@ -74721,11 +75537,26 @@ var ts; flags |= 32; lastStatic = modifier; break; - case 145: + case 127: + if (flags & 128) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "accessor"); + } + else if (flags & 64) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); + } + else if (flags & 2) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); + } + else if (node.kind !== 169) { + return grammarErrorOnNode(modifier, ts.Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); + } + flags |= 128; + break; + case 146: if (flags & 64) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 167 && node.kind !== 166 && node.kind !== 176 && node.kind !== 164) { + else if (node.kind !== 169 && node.kind !== 168 && node.kind !== 178 && node.kind !== 166) { return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } flags |= 64; @@ -74737,35 +75568,35 @@ var ts; else if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (flags & 128) { + else if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); } - else if (flags & 256) { + else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (ts.isClassLike(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); } - else if (node.kind === 164) { + else if (node.kind === 166) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1; break; case 88: - var container = node.parent.kind === 305 ? node.parent : node.parent.parent; - if (container.kind === 261 && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 ? node.parent : node.parent.parent; + if (container.kind === 264 && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } else if (!(flags & 1)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); } - flags |= 512; + flags |= 1024; break; - case 135: + case 136: if (flags & 2) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (flags & 256) { + else if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (flags & 16384) { @@ -74774,10 +75605,10 @@ var ts; else if (ts.isClassLike(node.parent) && !ts.isPropertyDeclaration(node)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); } - else if (node.kind === 164) { + else if (node.kind === 166) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 16777216) && node.parent.kind === 262) { + else if ((node.parent.flags & 16777216) && node.parent.kind === 265) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } else if (ts.isPrivateIdentifierClassElementDeclaration(node)) { @@ -74787,18 +75618,18 @@ var ts; lastDeclare = modifier; break; case 126: - if (flags & 128) { + if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 257 && - node.kind !== 180) { - if (node.kind !== 169 && - node.kind !== 167 && - node.kind !== 172 && - node.kind !== 173) { + if (node.kind !== 260 && + node.kind !== 182) { + if (node.kind !== 171 && + node.kind !== 169 && + node.kind !== 174 && + node.kind !== 175) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 257 && ts.hasSyntacticModifier(node.parent, 128))) { + if (!(node.parent.kind === 260 && ts.hasSyntacticModifier(node.parent, 256))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32) { @@ -74807,39 +75638,42 @@ var ts; if (flags & 8) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } - if (flags & 256 && lastAsync) { + if (flags & 512 && lastAsync) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } if (flags & 16384) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); } + if (flags & 128) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); + } } if (ts.isNamedDeclaration(node) && node.name.kind === 80) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); } - flags |= 128; + flags |= 256; break; - case 131: - if (flags & 256) { + case 132: + if (flags & 512) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 || node.parent.flags & 16777216) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 164) { + else if (node.kind === 166) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } - if (flags & 128) { + if (flags & 256) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } - flags |= 256; + flags |= 512; lastAsync = modifier; break; case 101: - case 144: + case 145: var inOutFlag = modifier.kind === 101 ? 32768 : 65536; var inOutText = modifier.kind === 101 ? "in" : "out"; - if (node.kind !== 163 || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { + if (node.kind !== 165 || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); } if (flags & inOutFlag) { @@ -74852,28 +75686,28 @@ var ts; break; } } - if (node.kind === 171) { + if (node.kind === 173) { if (flags & 32) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } if (flags & 16384) { return grammarErrorOnNode(lastOverride, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override"); } - if (flags & 256) { + if (flags & 512) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return false; } - else if ((node.kind === 266 || node.kind === 265) && flags & 2) { + else if ((node.kind === 269 || node.kind === 268) && flags & 2) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 164 && (flags & 16476) && ts.isBindingPattern(node.name)) { + else if (node.kind === 166 && (flags & 16476) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 164 && (flags & 16476) && node.dotDotDotToken) { + else if (node.kind === 166 && (flags & 16476) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } - if (flags & 256) { + if (flags & 512) { return checkGrammarAsyncModifier(node, lastAsync); } return false; @@ -74887,47 +75721,47 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 172: + case 174: + case 175: case 173: - case 171: - case 167: - case 166: case 169: case 168: - case 176: - case 261: - case 266: - case 265: - case 272: - case 271: - case 213: - case 214: - case 164: - case 163: - return false; + case 171: case 170: - case 296: - case 297: + case 178: case 264: - case 179: - case 276: + case 269: + case 268: + case 275: + case 274: + case 215: + case 216: + case 166: + case 165: + return false; + case 172: + case 299: + case 300: + case 267: + case 181: + case 279: return true; default: - if (node.parent.kind === 262 || node.parent.kind === 305) { + if (node.parent.kind === 265 || node.parent.kind === 308) { return false; } switch (node.kind) { - case 256: - return nodeHasAnyModifiersExcept(node, 131); - case 257: - case 180: - return nodeHasAnyModifiersExcept(node, 126); - case 226: - case 258: - case 237: case 259: - return true; + return nodeHasAnyModifiersExcept(node, 132); case 260: + case 182: + return nodeHasAnyModifiersExcept(node, 126); + case 228: + case 261: + case 240: + case 262: + return true; + case 263: return nodeHasAnyModifiersExcept(node, 85); default: ts.Debug.assertNever(node); @@ -74945,10 +75779,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 169: - case 256: - case 213: - case 214: + case 171: + case 259: + case 215: + case 216: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); @@ -75172,20 +76006,20 @@ var ts; return false; } function checkGrammarComputedPropertyName(node) { - if (node.kind !== 162) { + if (node.kind !== 164) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 221 && computedPropertyName.expression.operatorToken.kind === 27) { + if (computedPropertyName.expression.kind === 223 && computedPropertyName.expression.operatorToken.kind === 27) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } return false; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 256 || - node.kind === 213 || - node.kind === 169); + ts.Debug.assert(node.kind === 259 || + node.kind === 215 || + node.kind === 171); if (node.flags & 16777216) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -75204,7 +76038,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 298) { + if (prop.kind === 301) { if (inDestructuring) { var expression = ts.skipParentheses(prop.expression); if (ts.isArrayLiteralExpression(expression) || ts.isObjectLiteralExpression(expression)) { @@ -75214,10 +76048,10 @@ var ts; continue; } var name = prop.name; - if (name.kind === 162) { + if (name.kind === 164) { checkGrammarComputedPropertyName(name); } - if (prop.kind === 297 && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 300 && !inDestructuring && prop.objectAssignmentInitializer) { grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern); } if (name.kind === 80) { @@ -75226,7 +76060,7 @@ var ts; if (ts.canHaveModifiers(prop) && prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (ts.isModifier(mod) && (mod.kind !== 131 || prop.kind !== 169)) { + if (ts.isModifier(mod) && (mod.kind !== 132 || prop.kind !== 171)) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -75239,8 +76073,8 @@ var ts; } var currentKind = void 0; switch (prop.kind) { - case 297: - case 296: + case 300: + case 299: checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); if (name.kind === 8) { @@ -75248,13 +76082,13 @@ var ts; } currentKind = 4; break; - case 169: + case 171: currentKind = 8; break; - case 172: + case 174: currentKind = 1; break; - case 173: + case 175: currentKind = 2; break; default: @@ -75297,7 +76131,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 287) { + if (attr.kind === 290) { continue; } var name = attr.name, initializer = attr.initializer; @@ -75307,7 +76141,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 288 && !initializer.expression) { + if (initializer && initializer.kind === 291 && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -75342,7 +76176,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 244 && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 247 && forInOrOfStatement.awaitModifier) { if (!(forInOrOfStatement.flags & 32768)) { var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement); if (ts.isInTopLevelContext(forInOrOfStatement)) { @@ -75373,7 +76207,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); var func = ts.getContainingFunction(forInOrOfStatement); - if (func && func.kind !== 171) { + if (func && func.kind !== 173) { ts.Debug.assert((ts.getFunctionFlags(func) & 2) === 0, "Enclosing function should never be an async function."); var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); @@ -75390,7 +76224,7 @@ var ts; grammarErrorOnNode(forInOrOfStatement.initializer, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); return false; } - if (forInOrOfStatement.initializer.kind === 255) { + if (forInOrOfStatement.initializer.kind === 258) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -75398,20 +76232,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 243 + var diagnostic = forInOrOfStatement.kind === 246 ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 243 + var diagnostic = forInOrOfStatement.kind === 246 ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 243 + var diagnostic = forInOrOfStatement.kind === 246 ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -75421,22 +76255,22 @@ var ts; return false; } function checkGrammarAccessor(accessor) { - if (!(accessor.flags & 16777216) && (accessor.parent.kind !== 182) && (accessor.parent.kind !== 258)) { + if (!(accessor.flags & 16777216) && (accessor.parent.kind !== 184) && (accessor.parent.kind !== 261)) { if (languageVersion < 1) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } if (languageVersion < 2 && ts.isPrivateIdentifier(accessor.name)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } - if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 128)) { + if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 256)) { return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } if (accessor.body) { - if (ts.hasSyntacticModifier(accessor, 128)) { + if (ts.hasSyntacticModifier(accessor, 256)) { return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); } - if (accessor.parent.kind === 182 || accessor.parent.kind === 258) { + if (accessor.parent.kind === 184 || accessor.parent.kind === 261) { return grammarErrorOnNode(accessor.body, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } } @@ -75444,11 +76278,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, accessor.kind === 172 ? + return grammarErrorOnNode(accessor.name, accessor.kind === 174 ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - if (accessor.kind === 173) { + if (accessor.kind === 175) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -75466,17 +76300,17 @@ var ts; return false; } function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 172 ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 174 ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 172 ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 174 ? 1 : 2)) { return ts.getThisParameter(accessor); } } function checkGrammarTypeOperatorNode(node) { - if (node.operator === 154) { - if (node.type.kind !== 151) { - return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(151)); + if (node.operator === 156) { + if (node.type.kind !== 153) { + return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(153)); } var parent = ts.walkUpParenthesizedTypes(node.parent); if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) { @@ -75486,7 +76320,7 @@ var ts; } } switch (parent.kind) { - case 254: + case 257: var decl = parent; if (decl.name.kind !== 79) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -75498,13 +76332,13 @@ var ts; return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); } break; - case 167: + case 169: if (!ts.isStatic(parent) || !ts.hasEffectiveReadonlyModifier(parent)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); } break; - case 166: + case 168: if (!ts.hasSyntacticModifier(parent, 64)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); } @@ -75513,9 +76347,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here); } } - else if (node.operator === 145) { - if (node.type.kind !== 183 && node.type.kind !== 184) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(151)); + else if (node.operator === 146) { + if (node.type.kind !== 185 && node.type.kind !== 186) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(153)); } } } @@ -75528,9 +76362,9 @@ var ts; if (checkGrammarFunctionLikeDeclaration(node)) { return true; } - if (node.kind === 169) { - if (node.parent.kind === 205) { - if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 131)) { + if (node.kind === 171) { + if (node.parent.kind === 207) { + if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 132)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { @@ -75554,14 +76388,14 @@ var ts; if (node.flags & 16777216) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.kind === 169 && !node.body) { + else if (node.kind === 171 && !node.body) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } - else if (node.parent.kind === 258) { + else if (node.parent.kind === 261) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.parent.kind === 182) { + else if (node.parent.kind === 184) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } @@ -75572,9 +76406,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 250: + case 253: if (node.label && current.label.escapedText === node.label.escapedText) { - var isMisplacedContinueLabel = node.kind === 245 + var isMisplacedContinueLabel = node.kind === 248 && !ts.isIterationStatement(current.statement, true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -75582,8 +76416,8 @@ var ts; return false; } break; - case 249: - if (node.kind === 246 && !node.label) { + case 252: + if (node.kind === 249 && !node.label) { return false; } break; @@ -75596,13 +76430,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 246 + var message = node.kind === 249 ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 246 + var message = node.kind === 249 ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -75625,12 +76459,12 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return ts.isStringOrNumericLiteralLike(expr) || - expr.kind === 219 && expr.operator === 40 && + expr.kind === 221 && expr.operator === 40 && expr.operand.kind === 8; } function isBigIntLiteralExpression(expr) { return expr.kind === 9 || - expr.kind === 219 && expr.operator === 40 && + expr.kind === 221 && expr.operator === 40 && expr.operand.kind === 9; } function isSimpleLiteralEnumReference(expr) { @@ -75658,7 +76492,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 243 && node.parent.parent.kind !== 244) { + if (node.parent.parent.kind !== 246 && node.parent.parent.kind !== 247) { if (node.flags & 16777216) { checkAmbientInitializer(node); } @@ -75671,7 +76505,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 237 || !node.type || node.initializer || node.flags & 16777216)) { + if (node.exclamationToken && (node.parent.parent.kind !== 240 || !node.type || node.initializer || node.flags & 16777216)) { var message = node.initializer ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type @@ -75732,15 +76566,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 239: - case 240: - case 241: - case 248: case 242: case 243: case 244: + case 251: + case 245: + case 246: + case 247: return false; - case 250: + case 253: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -75834,8 +76668,14 @@ var ts; if (languageVersion < 2 && ts.isPrivateIdentifier(node.name)) { return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } + if (languageVersion < 2 && ts.isAutoAccessorPropertyDeclaration(node)) { + return grammarErrorOnNode(node.name, ts.Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (ts.isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_accessor_property_cannot_be_declared_optional)) { + return true; + } } - else if (node.parent.kind === 258) { + else if (node.parent.kind === 261) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } @@ -75867,14 +76707,14 @@ var ts; } } function checkGrammarTopLevelElementForRequiredDeclareModifier(node) { - if (node.kind === 258 || - node.kind === 259 || - node.kind === 266 || - node.kind === 265 || - node.kind === 272 || - node.kind === 271 || - node.kind === 264 || - ts.hasSyntacticModifier(node, 2 | 1 | 512)) { + if (node.kind === 261 || + node.kind === 262 || + node.kind === 269 || + node.kind === 268 || + node.kind === 275 || + node.kind === 274 || + node.kind === 267 || + ts.hasSyntacticModifier(node, 2 | 1 | 1024)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); @@ -75882,7 +76722,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 237) { + if (ts.isDeclaration(decl) || decl.kind === 240) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -75899,7 +76739,7 @@ var ts; if (!links.hasReportedStatementInAmbientContext && (ts.isFunctionLike(node.parent) || ts.isAccessor(node.parent))) { return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } - if (node.parent.kind === 235 || node.parent.kind === 262 || node.parent.kind === 305) { + if (node.parent.kind === 238 || node.parent.kind === 265 || node.parent.kind === 308) { var links_2 = getNodeLinks(node.parent); if (!links_2.hasReportedStatementInAmbientContext) { return links_2.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts); @@ -75916,10 +76756,10 @@ var ts; if (languageVersion >= 1) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 196)) { + else if (ts.isChildOfNodeWithKind(node, 198)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 299)) { + else if (ts.isChildOfNodeWithKind(node, 302)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -75980,7 +76820,7 @@ var ts; if (node.isTypeOnly && node.name && node.namedBindings) { return grammarErrorOnNode(node, ts.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both); } - if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 269) { + if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 272) { return checkGrammarNamedImportsOrExports(node.namedBindings); } return false; @@ -75988,7 +76828,7 @@ var ts; function checkGrammarNamedImportsOrExports(namedBindings) { return !!ts.forEach(namedBindings.elements, function (specifier) { if (specifier.isTypeOnly) { - return grammarErrorOnFirstToken(specifier, specifier.kind === 270 + return grammarErrorOnFirstToken(specifier, specifier.kind === 273 ? ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement); } @@ -76102,13 +76942,13 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 256 && declaration.kind !== 169) || + return (declaration.kind !== 259 && declaration.kind !== 171) || !!declaration.body; } function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 270: - case 275: + case 273: + case 278: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -76144,6 +76984,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var _a; function visitNode(node, visitor, test, lift) { if (node === undefined || visitor === undefined) { return node; @@ -76321,9 +77162,10 @@ var ts; return updated; } ts.visitFunctionBody = visitFunctionBody; - function visitIterationBody(body, visitor, context) { + function visitIterationBody(body, visitor, context, nodeVisitor) { + if (nodeVisitor === void 0) { nodeVisitor = visitNode; } context.startBlockScope(); - var updated = visitNode(body, visitor, ts.isStatement, context.factory.liftToBlock); + var updated = nodeVisitor(body, visitor, ts.isStatement, context.factory.liftToBlock); var declarations = context.endBlockScope(); if (ts.some(declarations)) { if (ts.isBlock(updated)) { @@ -76342,437 +77184,428 @@ var ts; if (node === undefined) { return undefined; } - var kind = node.kind; - if ((kind > 0 && kind <= 160) || kind === 192) { - return node; - } - var factory = context.factory; - switch (kind) { - case 79: - ts.Debug.type(node); - return factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); - case 161: - ts.Debug.type(node); - return factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); - case 162: - ts.Debug.type(node); - return factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 163: - ts.Debug.type(node); - return factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); - case 164: - ts.Debug.type(node); - return factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 165: - ts.Debug.type(node); - return factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 166: - ts.Debug.type(node); - return factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 167: - ts.Debug.type(node); - return factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken || node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 168: - ts.Debug.type(node); - return factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 169: - ts.Debug.type(node); - return factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 171: - ts.Debug.type(node); - return factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 172: - ts.Debug.type(node); - return factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 173: - ts.Debug.type(node); - return factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 170: - ts.Debug.type(node); - context.startLexicalEnvironment(); - context.suspendLexicalEnvironment(); - return factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 174: - ts.Debug.type(node); - return factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 175: - ts.Debug.type(node); - return factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 176: - ts.Debug.type(node); - return factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 177: - ts.Debug.type(node); - return factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 178: - ts.Debug.type(node); - return factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 179: - ts.Debug.type(node); - return factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 180: - ts.Debug.type(node); - return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 181: - ts.Debug.type(node); - return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 182: - ts.Debug.type(node); - return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 183: - ts.Debug.type(node); - return factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); - case 184: - ts.Debug.type(node); - return factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); - case 185: - ts.Debug.type(node); - return factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 186: - ts.Debug.type(node); - return factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 187: - ts.Debug.type(node); - return factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 188: - ts.Debug.type(node); - return factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 189: - ts.Debug.type(node); - return factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); - case 190: - ts.Debug.type(node); - return factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); - case 200: - ts.Debug.type(node); - return factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isNode), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); - case 295: - ts.Debug.type(node); - return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine); - case 197: - ts.Debug.type(node); - return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 191: - ts.Debug.type(node); - return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 193: - ts.Debug.type(node); - return factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 194: - ts.Debug.type(node); - return factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); - case 195: - ts.Debug.type(node); - return factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 196: - ts.Debug.type(node); - return factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); - case 198: - ts.Debug.type(node); - return factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); - case 199: - ts.Debug.type(node); - return factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - case 201: - ts.Debug.type(node); - return factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); - case 202: - ts.Debug.type(node); - return factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); - case 203: - ts.Debug.type(node); - return factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 204: - ts.Debug.type(node); - return factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - case 205: - ts.Debug.type(node); - return factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 206: - if (node.flags & 32) { - ts.Debug.type(node); - return factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)); - } - ts.Debug.type(node); - return factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); - case 207: - if (node.flags & 32) { - ts.Debug.type(node); - return factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - case 208: - if (node.flags & 32) { - ts.Debug.type(node); - return factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 209: - ts.Debug.type(node); - return factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 210: - ts.Debug.type(node); - return factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); - case 211: - ts.Debug.type(node); - return factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 212: - ts.Debug.type(node); - return factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 213: - ts.Debug.type(node); - return factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 214: - ts.Debug.type(node); - return factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 215: - ts.Debug.type(node); - return factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 216: - ts.Debug.type(node); - return factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 217: - ts.Debug.type(node); - return factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 218: - ts.Debug.type(node); - return factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 219: - ts.Debug.type(node); - return factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 220: - ts.Debug.type(node); - return factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 221: - ts.Debug.type(node); - return factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); - case 222: - ts.Debug.type(node); - return factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); - case 223: - ts.Debug.type(node); - return factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); - case 224: - ts.Debug.type(node); - return factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 225: - ts.Debug.type(node); - return factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 226: - ts.Debug.type(node); - return factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 228: - ts.Debug.type(node); - return factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 229: - ts.Debug.type(node); - return factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 230: - if (node.flags & 32) { - ts.Debug.type(node); - return factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 231: - ts.Debug.type(node); - return factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 233: - ts.Debug.type(node); - return factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - case 235: - ts.Debug.type(node); - return factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 237: - ts.Debug.type(node); - return factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 238: - ts.Debug.type(node); - return factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 239: - ts.Debug.type(node); - return factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, factory.liftToBlock)); - case 240: - ts.Debug.type(node); - return factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 241: - ts.Debug.type(node); - return factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 242: - ts.Debug.type(node); - return factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 243: - ts.Debug.type(node); - return factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 244: - ts.Debug.type(node); - return factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 245: - ts.Debug.type(node); - return factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 246: - ts.Debug.type(node); - return factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 247: - ts.Debug.type(node); - return factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 248: - ts.Debug.type(node); - return factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 249: - ts.Debug.type(node); - return factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); - case 250: - ts.Debug.type(node); - return factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 251: - ts.Debug.type(node); - return factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 252: - ts.Debug.type(node); - return factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); - case 254: - ts.Debug.type(node); - return factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 255: - ts.Debug.type(node); - return factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); - case 256: - ts.Debug.type(node); - return factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 257: - ts.Debug.type(node); - return factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 258: - ts.Debug.type(node); - return factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 259: - ts.Debug.type(node); - return factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 260: - ts.Debug.type(node); - return factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); - case 261: - ts.Debug.type(node); - return factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); - case 262: - ts.Debug.type(node); - return factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 263: - ts.Debug.type(node); - return factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 264: - ts.Debug.type(node); - return factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 265: - ts.Debug.type(node); - return factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); - case 266: - ts.Debug.type(node); - return factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 293: - ts.Debug.type(node); - return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); - case 294: - ts.Debug.type(node); - return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode)); - case 267: - ts.Debug.type(node); - return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); - case 268: - ts.Debug.type(node); - return factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 274: - ts.Debug.type(node); - return factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 269: - ts.Debug.type(node); - return factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); - case 270: - ts.Debug.type(node); - return factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 271: - ts.Debug.type(node); - return factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 272: - ts.Debug.type(node); - return factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 273: - ts.Debug.type(node); - return factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); - case 275: - ts.Debug.type(node); - return factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 277: - ts.Debug.type(node); - return factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 278: - ts.Debug.type(node); - return factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); - case 279: - ts.Debug.type(node); - return factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 280: - ts.Debug.type(node); - return factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 281: - ts.Debug.type(node); - return factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 282: - ts.Debug.type(node); - return factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 285: - ts.Debug.type(node); - return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 286: - ts.Debug.type(node); - return factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 287: - ts.Debug.type(node); - return factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 288: - ts.Debug.type(node); - return factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 289: - ts.Debug.type(node); - return factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 290: - ts.Debug.type(node); - return factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 291: - ts.Debug.type(node); - return factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 292: - ts.Debug.type(node); - return factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); - case 296: - ts.Debug.type(node); - return factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 297: - ts.Debug.type(node); - return factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 298: - ts.Debug.type(node); - return factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 299: - ts.Debug.type(node); - return factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 305: - ts.Debug.type(node); - return factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context)); - case 350: - ts.Debug.type(node); - return factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 351: - ts.Debug.type(node); - return factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - default: - return node; - } + var fn = visitEachChildTable[node.kind]; + return fn === undefined ? node : fn(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor); } ts.visitEachChild = visitEachChild; + var visitEachChildTable = (_a = {}, + _a[79] = function visitEachChildOfIdentifier(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); + }, + _a[163] = function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); + }, + _a[164] = function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[165] = function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); + }, + _a[166] = function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[167] = function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[168] = function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[169] = function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + var _a; + return context.factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor((_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[170] = function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[171] = function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[173] = function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[174] = function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[175] = function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[172] = function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + context.startLexicalEnvironment(); + context.suspendLexicalEnvironment(); + return context.factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[176] = function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[177] = function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[178] = function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[179] = function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[180] = function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[181] = function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[182] = function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[183] = function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[184] = function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[185] = function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); + }, + _a[186] = function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); + }, + _a[187] = function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[188] = function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[189] = function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[190] = function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[191] = function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); + }, + _a[192] = function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + }, + _a[202] = function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isImportTypeAssertionContainer), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); + }, + _a[298] = function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isAssertClause), node.multiLine); + }, + _a[199] = function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[193] = function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[195] = function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[196] = function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); + }, + _a[197] = function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[198] = function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); + }, + _a[200] = function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); + }, + _a[201] = function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + _a[203] = function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); + }, + _a[204] = function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + }, + _a[205] = function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[206] = function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a[207] = function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + }, + _a[208] = function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isPropertyAccessChain(node) ? + context.factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)) : + context.factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); + }, + _a[209] = function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isElementAccessChain(node) ? + context.factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)) : + context.factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); + }, + _a[210] = function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isCallChain(node) ? + context.factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)) : + context.factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[211] = function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[212] = function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); + }, + _a[213] = function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[214] = function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[215] = function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[216] = function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[217] = function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[218] = function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[219] = function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[220] = function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[221] = function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[222] = function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[223] = function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); + }, + _a[224] = function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); + }, + _a[225] = function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + }, + _a[226] = function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[227] = function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[228] = function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[230] = function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[231] = function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[235] = function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSatisfiesExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[232] = function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return ts.isOptionalChain(node) ? + context.factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)) : + context.factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[233] = function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[236] = function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + _a[238] = function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[240] = function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); + }, + _a[241] = function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[242] = function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, context.factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[243] = function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context, nodeVisitor), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[244] = function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[245] = function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[246] = function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[247] = function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[248] = function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[249] = function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[250] = function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[251] = function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[252] = function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); + }, + _a[253] = function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[254] = function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[255] = function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); + }, + _a[257] = function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[258] = function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + }, + _a[259] = function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[260] = function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[261] = function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[262] = function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[263] = function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + }, + _a[264] = function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); + }, + _a[265] = function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[266] = function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + }, + _a[267] = function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[268] = function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); + }, + _a[269] = function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[296] = function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); + }, + _a[297] = function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpression)); + }, + _a[270] = function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); + }, + _a[271] = function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[277] = function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[272] = function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + }, + _a[273] = function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[274] = function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[275] = function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[276] = function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + }, + _a[278] = function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[280] = function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[281] = function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); + }, + _a[282] = function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[283] = function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[284] = function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); + }, + _a[285] = function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); + }, + _a[288] = function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + }, + _a[289] = function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + }, + _a[290] = function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[291] = function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[292] = function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[293] = function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[294] = function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + }, + _a[295] = function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); + }, + _a[299] = function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[300] = function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); + }, + _a[301] = function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[302] = function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[308] = function visitEachChildOfSourceFile(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context, undefined, undefined, nodesVisitor)); + }, + _a[353] = function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[354] = function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a); function extractSingleNode(nodes) { ts.Debug.assert(nodes.length <= 1, "Too many nodes written to output."); return ts.singleOrUndefined(nodes); @@ -77401,7 +78234,7 @@ var ts; function chainBundle(context, transformSourceFile) { return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - return node.kind === 305 ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -77450,7 +78283,7 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 266: + case 269: externalImports.push(node); if (!hasImportStar && getImportNeedsImportStarHelper(node)) { hasImportStar = true; @@ -77459,12 +78292,12 @@ var ts; hasImportDefault = true; } break; - case 265: - if (node.moduleReference.kind === 277) { + case 268: + if (node.moduleReference.kind === 280) { externalImports.push(node); } break; - case 272: + case 275: if (node.moduleSpecifier) { if (!node.exportClause) { externalImports.push(node); @@ -77490,12 +78323,12 @@ var ts; addExportedNamesForExportDeclaration(node); } break; - case 271: + case 274: if (node.isExportEquals && !exportEquals) { exportEquals = node; } break; - case 237: + case 240: if (ts.hasSyntacticModifier(node, 1)) { for (var _b = 0, _c = node.declarationList.declarations; _b < _c.length; _b++) { var decl = _c[_b]; @@ -77503,9 +78336,9 @@ var ts; } } break; - case 256: + case 259: if (ts.hasSyntacticModifier(node, 1)) { - if (ts.hasSyntacticModifier(node, 512)) { + if (ts.hasSyntacticModifier(node, 1024)) { if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); hasExportDefault = true; @@ -77521,9 +78354,9 @@ var ts; } } break; - case 257: + case 260: if (ts.hasSyntacticModifier(node, 1)) { - if (ts.hasSyntacticModifier(node, 512)) { + if (ts.hasSyntacticModifier(node, 1024)) { if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); hasExportDefault = true; @@ -77670,12 +78503,12 @@ var ts; return ts.isPropertyDeclaration(member) && ts.hasStaticModifier(member); } function isInitializedProperty(member) { - return member.kind === 167 + return member.kind === 169 && member.initializer !== undefined; } ts.isInitializedProperty = isInitializedProperty; function isNonStaticMethodOrAccessorWithPrivateName(member) { - return !ts.isStatic(member) && ts.isMethodOrAccessor(member) && ts.isPrivateIdentifier(member.name); + return !ts.isStatic(member) && (ts.isMethodOrAccessor(member) || ts.isAutoAccessorPropertyDeclaration(member)) && ts.isPrivateIdentifier(member.name); } ts.isNonStaticMethodOrAccessorWithPrivateName = isNonStaticMethodOrAccessorWithPrivateName; function getDecoratorsOfParameters(node) { @@ -77711,12 +78544,12 @@ var ts; ts.getAllDecoratorsOfClass = getAllDecoratorsOfClass; function getAllDecoratorsOfClassElement(member, parent) { switch (member.kind) { - case 172: - case 173: + case 174: + case 175: return getAllDecoratorsOfAccessors(member, parent); - case 169: + case 171: return getAllDecoratorsOfMethod(member); - case 167: + case 169: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -78188,8 +79021,8 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(206); - context.enableSubstitution(207); + context.enableSubstitution(208); + context.enableSubstitution(209); var currentSourceFile; var currentNamespace; var currentNamespaceContainerName; @@ -78200,14 +79033,14 @@ var ts; var applicableSubstitutions; return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - if (node.kind === 306) { + if (node.kind === 309) { return transformBundle(node); } return transformSourceFile(node); } function transformBundle(node) { return factory.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308) { + if (prepend.kind === 311) { return ts.createUnparsedSourceFile(prepend, "js"); } return prepend; @@ -78238,15 +79071,15 @@ var ts; } function onBeforeVisitNode(node) { switch (node.kind) { - case 305: - case 263: - case 262: - case 235: + case 308: + case 266: + case 265: + case 238: currentLexicalScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 257: - case 256: + case 260: + case 259: if (ts.hasSyntacticModifier(node, 2)) { break; } @@ -78254,7 +79087,7 @@ var ts; recordEmittedDeclarationInScope(node); } else { - ts.Debug.assert(node.kind === 257 || ts.hasSyntacticModifier(node, 512)); + ts.Debug.assert(node.kind === 260 || ts.hasSyntacticModifier(node, 1024)); } break; } @@ -78273,10 +79106,10 @@ var ts; } function sourceElementVisitorWorker(node) { switch (node.kind) { - case 266: - case 265: - case 271: - case 272: + case 269: + case 268: + case 274: + case 275: return visitElidableStatement(node); default: return visitorWorker(node); @@ -78291,13 +79124,13 @@ var ts; return node; } switch (node.kind) { - case 266: + case 269: return visitImportDeclaration(node); - case 265: + case 268: return visitImportEqualsDeclaration(node); - case 271: + case 274: return visitExportAssignment(node); - case 272: + case 275: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -78307,11 +79140,11 @@ var ts; return saveStateAndInvoke(node, namespaceElementVisitorWorker); } function namespaceElementVisitorWorker(node) { - if (node.kind === 272 || - node.kind === 266 || - node.kind === 267 || - (node.kind === 265 && - node.moduleReference.kind === 277)) { + if (node.kind === 275 || + node.kind === 269 || + node.kind === 270 || + (node.kind === 268 && + node.moduleReference.kind === 280)) { return undefined; } else if (node.transformFlags & 1 || ts.hasSyntacticModifier(node, 1)) { @@ -78324,21 +79157,21 @@ var ts; } function classElementVisitorWorker(node, parent) { switch (node.kind) { - case 171: + case 173: return visitConstructor(node); - case 167: + case 169: return visitPropertyDeclaration(node, parent); - case 172: + case 174: return visitGetAccessor(node, parent); - case 173: + case 175: return visitSetAccessor(node, parent); - case 169: + case 171: return visitMethodDeclaration(node, parent); - case 170: + case 172: return ts.visitEachChild(node, visitor, context); - case 234: + case 237: return node; - case 176: + case 178: return; default: return ts.Debug.failBadSyntaxKind(node); @@ -78349,15 +79182,15 @@ var ts; } function objectLiteralElementVisitorWorker(node, parent) { switch (node.kind) { - case 296: - case 297: - case 298: + case 299: + case 300: + case 301: return visitor(node); - case 172: + case 174: return visitGetAccessor(node, parent); - case 173: + case 175: return visitSetAccessor(node, parent); - case 169: + case 171: return visitMethodDeclaration(node, parent); default: return ts.Debug.failBadSyntaxKind(node); @@ -78366,7 +79199,7 @@ var ts; function modifierVisitor(node) { if (ts.isDecorator(node)) return undefined; - if (ts.modifierToFlag(node.kind) & 116958) { + if (ts.modifierToFlag(node.kind) & 117086) { return undefined; } else if (currentNamespace && node.kind === 93) { @@ -78386,99 +79219,101 @@ var ts; case 121: case 122: case 126: - case 159: + case 161: case 85: - case 135: - case 145: + case 136: + case 146: case 101: - case 144: - case 183: - case 184: + case 145: case 185: case 186: - case 182: - case 177: - case 163: - case 130: - case 155: - case 133: - case 150: - case 147: - case 143: - case 114: - case 151: - case 180: - case 179: - case 181: - case 178: case 187: case 188: + case 184: + case 179: + case 165: + case 131: + case 157: + case 134: + case 152: + case 148: + case 144: + case 114: + case 153: + case 182: + case 181: + case 183: + case 180: case 189: + case 190: case 191: - case 192: case 193: case 194: case 195: case 196: - case 176: + case 197: + case 198: + case 178: return undefined; - case 259: + case 262: return factory.createNotEmittedStatement(node); - case 264: + case 267: return undefined; - case 258: + case 261: return factory.createNotEmittedStatement(node); - case 257: + case 260: return visitClassDeclaration(node); - case 226: + case 228: return visitClassExpression(node); - case 291: + case 294: return visitHeritageClause(node); - case 228: + case 230: return visitExpressionWithTypeArguments(node); - case 205: + case 207: return visitObjectLiteralExpression(node); - case 171: - case 167: + case 173: case 169: + case 171: + case 174: + case 175: case 172: - case 173: - case 170: return ts.Debug.fail("Class and object literal elements must be visited with their respective visitors"); - case 256: + case 259: return visitFunctionDeclaration(node); - case 213: + case 215: return visitFunctionExpression(node); - case 214: + case 216: return visitArrowFunction(node); - case 164: + case 166: return visitParameter(node); - case 212: + case 214: return visitParenthesizedExpression(node); - case 211: - case 229: + case 213: + case 231: return visitAssertionExpression(node); - case 208: + case 235: + return visitSatisfiesExpression(node); + case 210: return visitCallExpression(node); - case 209: + case 211: return visitNewExpression(node); - case 210: + case 212: return visitTaggedTemplateExpression(node); - case 230: + case 232: return visitNonNullExpression(node); - case 260: + case 263: return visitEnumDeclaration(node); - case 237: + case 240: return visitVariableStatement(node); - case 254: + case 257: return visitVariableDeclaration(node); - case 261: + case 264: return visitModuleDeclaration(node); - case 265: + case 268: return visitImportEqualsDeclaration(node); - case 279: + case 282: return visitJsxSelfClosingElement(node); - case 280: + case 283: return visitJsxJsxOpeningElement(node); default: return ts.visitEachChild(node, visitor, context); @@ -78685,22 +79520,22 @@ var ts; } function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 169 - || kind === 172 - || kind === 173 - || kind === 167; + return kind === 171 + || kind === 174 + || kind === 175 + || kind === 169; } function shouldAddReturnTypeMetadata(node) { - return node.kind === 169; + return node.kind === 171; } function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 257: - case 226: + case 260: + case 228: return ts.getFirstConstructorWithBody(node) !== undefined; - case 169: - case 172: - case 173: + case 171: + case 174: + case 175: return true; } return false; @@ -78748,7 +79583,7 @@ var ts; return !ts.nodeIsMissing(node.body); } function visitPropertyDeclaration(node, parent) { - var isAmbient = node.flags & 16777216 || ts.hasSyntacticModifier(node, 128); + var isAmbient = node.flags & 16777216 || ts.hasSyntacticModifier(node, 256); if (isAmbient && !ts.hasDecorators(node)) { return undefined; } @@ -78816,7 +79651,7 @@ var ts; return factory.updateMethodDeclaration(node, ts.concatenate(decorators, ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifierLike)), node.asteriskToken, visitPropertyNameOfClassElement(node), undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)); } function shouldEmitAccessorDeclaration(node) { - return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 128)); + return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 256)); } function visitGetAccessor(node, parent) { if (!(node.transformFlags & 1)) { @@ -78922,6 +79757,10 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); return factory.createPartiallyEmittedExpression(expression, node); } + function visitSatisfiesExpression(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } function visitCallExpression(node) { return factory.updateCallExpression(node, ts.visitNode(node.expression, visitor, ts.isExpression), undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); } @@ -79049,11 +79888,11 @@ var ts; function addVarForEnumOrModuleDeclaration(statements, node) { var statement = factory.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), factory.createVariableDeclarationList([ factory.createVariableDeclaration(factory.getLocalName(node, false, true)) - ], currentLexicalScope.kind === 305 ? 0 : 1)); + ], currentLexicalScope.kind === 308 ? 0 : 1)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { - if (node.kind === 260) { + if (node.kind === 263) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -79119,7 +79958,7 @@ var ts; var statementsLocation; var blockLocation; if (node.body) { - if (node.body.kind === 262) { + if (node.body.kind === 265) { saveStateAndInvoke(node.body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = node.body.statements; blockLocation = node.body; @@ -79144,13 +79983,13 @@ var ts; currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName; var block = factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), true); ts.setTextRange(block, blockLocation); - if (!node.body || node.body.kind !== 262) { + if (!node.body || node.body.kind !== 265) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 261) { + if (moduleDeclaration.body.kind === 264) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -79176,7 +80015,7 @@ var ts; return (name || namedBindings) ? factory.updateImportClause(node, false, name, namedBindings) : undefined; } function visitNamedImportBindings(node) { - if (node.kind === 268) { + if (node.kind === 271) { return shouldEmitAliasDeclaration(node) ? node : undefined; } else { @@ -79259,11 +80098,11 @@ var ts; } function isNamedExternalModuleExport(node) { return isExternalModuleExport(node) - && !ts.hasSyntacticModifier(node, 512); + && !ts.hasSyntacticModifier(node, 1024); } function isDefaultExternalModuleExport(node) { return isExternalModuleExport(node) - && ts.hasSyntacticModifier(node, 512); + && ts.hasSyntacticModifier(node, 1024); } function addExportMemberAssignment(statements, node) { var expression = factory.createAssignment(factory.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, false, true), factory.getLocalName(node)); @@ -79299,15 +80138,15 @@ var ts; if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; context.enableSubstitution(79); - context.enableSubstitution(297); - context.enableEmitNotification(261); + context.enableSubstitution(300); + context.enableEmitNotification(264); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 261; + return ts.getOriginalNode(node).kind === 264; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 260; + return ts.getOriginalNode(node).kind === 263; } function onEmitNode(hint, node, emitCallback) { var savedApplicableSubstitutions = applicableSubstitutions; @@ -79353,9 +80192,9 @@ var ts; switch (node.kind) { case 79: return substituteExpressionIdentifier(node); - case 206: + case 208: return substitutePropertyAccessExpression(node); - case 207: + case 209: return substituteElementAccessExpression(node); } return node; @@ -79367,9 +80206,9 @@ var ts; function trySubstituteNamespaceExportedName(node) { if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) { var container = resolver.getReferencedExportContainer(node, false); - if (container && container.kind !== 305) { - var substitute = (applicableSubstitutions & 2 && container.kind === 261) || - (applicableSubstitutions & 8 && container.kind === 260); + if (container && container.kind !== 308) { + var substitute = (applicableSubstitutions & 2 && container.kind === 264) || + (applicableSubstitutions & 8 && container.kind === 263); if (substitute) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(container), node), node); } @@ -79406,9 +80245,10 @@ var ts; return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined; } function shouldEmitAliasDeclaration(node) { - return compilerOptions.preserveValueImports - ? resolver.isValueAliasDeclaration(node) - : resolver.isReferencedAliasDeclaration(node); + return ts.isInJSFile(node) || + (compilerOptions.preserveValueImports + ? resolver.isValueAliasDeclaration(node) + : resolver.isReferencedAliasDeclaration(node)); } } ts.transformTypeScript = transformTypeScript; @@ -79421,9 +80261,16 @@ var ts; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions); + var shouldTransformInitializersUsingSet = !useDefineForClassFields; + var shouldTransformInitializersUsingDefine = useDefineForClassFields && languageVersion < 9; + var shouldTransformInitializers = shouldTransformInitializersUsingSet || shouldTransformInitializersUsingDefine; var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9; + var shouldTransformAutoAccessors = languageVersion < 99; var shouldTransformThisInStaticInitializers = languageVersion < 9; var shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2; + var shouldTransformAnything = shouldTransformInitializers || + shouldTransformPrivateElementsOrClassStaticBlocks || + shouldTransformAutoAccessors; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -79435,98 +80282,130 @@ var ts; var classLexicalEnvironmentStack = []; var classLexicalEnvironmentMap = new ts.Map(); var currentClassLexicalEnvironment; + var currentClassContainer; var currentComputedPropertyNameClassLexicalEnvironment; var currentStaticPropertyDeclarationOrStaticBlock; return ts.chainBundle(context, transformSourceFile); function transformSourceFile(node) { - var options = context.getCompilerOptions(); - if (node.isDeclarationFile - || useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9) { + if (node.isDeclarationFile || !shouldTransformAnything) { return node; } var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); return visited; } - function visitorWorker(node, valueIsDiscarded) { - if (node.transformFlags & 16777216) { - switch (node.kind) { - case 226: - case 257: - return visitClassLike(node); - case 167: - return visitPropertyDeclaration(node); - case 237: - return visitVariableStatement(node); - case 80: - return visitPrivateIdentifier(node); - case 170: - return visitClassStaticBlockDeclaration(node); - } + function visitor(node) { + if (!(node.transformFlags & 16777216) && + !(node.transformFlags & 134234112)) { + return node; } - if (node.transformFlags & 16777216 || - node.transformFlags & 134217728 && - shouldTransformSuperInStaticInitializers && - currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - switch (node.kind) { - case 219: - case 220: - return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); - case 221: - return visitBinaryExpression(node, valueIsDiscarded); - case 208: - return visitCallExpression(node); - case 210: - return visitTaggedTemplateExpression(node); - case 206: - return visitPropertyAccessExpression(node); - case 207: - return visitElementAccessExpression(node); - case 238: - return visitExpressionStatement(node); - case 242: - return visitForStatement(node); - case 256: - case 213: - case 171: - case 169: - case 172: - case 173: { - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = undefined; - var result = ts.visitEachChild(node, visitor, context); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; - return result; - } + switch (node.kind) { + case 127: + return shouldTransformAutoAccessors ? undefined : node; + case 260: + return visitClassDeclaration(node); + case 228: + return visitClassExpression(node); + case 172: + return visitClassStaticBlockDeclaration(node); + case 169: + return visitPropertyDeclaration(node); + case 240: + return visitVariableStatement(node); + case 80: + return visitPrivateIdentifier(node); + case 208: + return visitPropertyAccessExpression(node); + case 209: + return visitElementAccessExpression(node); + case 221: + case 222: + return visitPreOrPostfixUnaryExpression(node, false); + case 223: + return visitBinaryExpression(node, false); + case 210: + return visitCallExpression(node); + case 241: + return visitExpressionStatement(node); + case 212: + return visitTaggedTemplateExpression(node); + case 245: + return visitForStatement(node); + case 259: + case 215: + case 173: + case 171: + case 174: + case 175: { + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd(undefined, fallbackVisitor, node); } + default: + return fallbackVisitor(node); } + } + function fallbackVisitor(node) { return ts.visitEachChild(node, visitor, context); } function discardedValueVisitor(node) { - return visitorWorker(node, true); - } - function visitor(node) { - return visitorWorker(node, false); + switch (node.kind) { + case 221: + case 222: + return visitPreOrPostfixUnaryExpression(node, true); + case 223: + return visitBinaryExpression(node, true); + default: + return visitor(node); + } } function heritageClauseVisitor(node) { switch (node.kind) { - case 291: + case 294: return ts.visitEachChild(node, heritageClauseVisitor, context); - case 228: - return visitExpressionWithTypeArguments(node); + case 230: + return visitExpressionWithTypeArgumentsInHeritageClause(node); + default: + return visitor(node); } - return visitor(node); } - function visitorDestructuringTarget(node) { + function assignmentTargetVisitor(node) { switch (node.kind) { - case 205: - case 204: + case 207: + case 206: return visitAssignmentPattern(node); default: return visitor(node); } } + function classElementVisitor(node) { + switch (node.kind) { + case 173: + return visitConstructorDeclaration(node); + case 174: + case 175: + case 171: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd(undefined, visitMethodOrAccessorDeclaration, node); + case 169: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd(undefined, visitPropertyDeclaration, node); + case 164: + return visitComputedPropertyName(node); + case 237: + return node; + default: + return visitor(node); + } + } + function accessorFieldResultVisitor(node) { + switch (node.kind) { + case 169: + return transformFieldInitializer(node); + case 174: + case 175: + return classElementVisitor(node); + default: + ts.Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); + break; + } + } function visitPrivateIdentifier(node) { if (!shouldTransformPrivateElementsOrClassStaticBlocks) { return node; @@ -79536,38 +80415,18 @@ var ts; } return ts.setOriginalNode(factory.createIdentifier(""), node); } - function visitPrivateIdentifierInInExpression(node) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return node; - } - var privId = node.left; - ts.Debug.assertNode(privId, ts.isPrivateIdentifier); - ts.Debug.assert(node.operatorToken.kind === 101); - var info = accessPrivateIdentifier(privId); + function isPrivateIdentifierInExpression(node) { + return ts.isPrivateIdentifier(node.left) + && node.operatorToken.kind === 101; + } + function transformPrivateIdentifierInInExpression(node) { + var info = accessPrivateIdentifier(node.left); if (info) { var receiver = ts.visitNode(node.right, visitor, ts.isExpression); return ts.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node); } return ts.visitEachChild(node, visitor, context); } - function classElementVisitor(node) { - switch (node.kind) { - case 171: - return undefined; - case 172: - case 173: - case 169: - return visitMethodOrAccessorDeclaration(node); - case 167: - return visitPropertyDeclaration(node); - case 162: - return visitComputedPropertyName(node); - case 234: - return node; - default: - return visitor(node); - } - } function visitVariableStatement(node) { var savedPendingStatements = pendingStatements; pendingStatements = []; @@ -79577,15 +80436,24 @@ var ts; pendingStatements = savedPendingStatements; return statement; } - function visitComputedPropertyName(name) { - var node = ts.visitEachChild(name, visitor, context); + function visitComputedPropertyName(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (ts.some(pendingExpressions)) { - var expressions = pendingExpressions; - expressions.push(node.expression); - pendingExpressions = []; - node = factory.updateComputedPropertyName(node, factory.inlineExpressions(expressions)); + if (ts.isParenthesizedExpression(expression)) { + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression.expression], false))); + } + else { + expression = factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression], false)); + } + pendingExpressions = undefined; } - return node; + return factory.updateComputedPropertyName(node, expression); + } + function visitConstructorDeclaration(node) { + if (currentClassContainer) { + return transformConstructor(node, currentClassContainer); + } + return fallbackVisitor(node); } function visitMethodOrAccessorDeclaration(node) { ts.Debug.assert(!ts.hasDecorators(node)); @@ -79599,10 +80467,17 @@ var ts; } var functionName = getHoistedFunctionName(node); if (functionName) { - getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m); }), node.asteriskToken, functionName, undefined, ts.visitParameterList(node.parameters, classElementVisitor, context), undefined, ts.visitFunctionBody(node.body, classElementVisitor, context)))); + getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m) && !ts.isAccessorModifier(m); }), node.asteriskToken, functionName, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.visitFunctionBody(node.body, visitor, context)))); } return undefined; } + function setCurrentStaticPropertyDeclarationOrStaticBlockAnd(current, visitor, arg) { + var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + currentStaticPropertyDeclarationOrStaticBlock = current; + var result = visitor(arg); + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return result; + } function getHoistedFunctionName(node) { ts.Debug.assert(ts.isPrivateIdentifier(node.name)); var info = accessPrivateIdentifier(node.name); @@ -79619,38 +80494,80 @@ var ts; } } } - function visitPropertyDeclaration(node) { - ts.Debug.assert(!ts.hasDecorators(node)); - if (ts.isPrivateIdentifier(node.name)) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - if (ts.isStatic(node)) { - return ts.visitEachChild(node, visitor, context); - } - return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, undefined, undefined, undefined); - } + function transformAutoAccessor(node) { + ts.Debug.assertEachNode(node.modifiers, ts.isModifier); + var commentRange = ts.getCommentRange(node); + var sourceMapRange = ts.getSourceMapRange(node); + var name = node.name; + var getterName = name; + var setterName = name; + if (ts.isComputedPropertyName(name) && !ts.isSimpleInlineableExpression(name.expression)) { + var temp = factory.createTempVariable(hoistVariableDeclaration); + ts.setSourceMapRange(temp, name.expression); + var expression = ts.visitNode(name.expression, visitor, ts.isExpression); + var assignment = factory.createAssignment(temp, expression); + ts.setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp])); + setterName = factory.updateComputedPropertyName(name, temp); + } + var backingField = ts.createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); + ts.setOriginalNode(backingField, node); + ts.setEmitFlags(backingField, 1536); + ts.setSourceMapRange(backingField, sourceMapRange); + var getter = ts.createAccessorPropertyGetRedirector(factory, node, node.modifiers, getterName); + ts.setOriginalNode(getter, node); + ts.setCommentRange(getter, commentRange); + ts.setSourceMapRange(getter, sourceMapRange); + var setter = ts.createAccessorPropertySetRedirector(factory, node, node.modifiers, setterName); + ts.setOriginalNode(setter, node); + ts.setEmitFlags(setter, 1536); + ts.setSourceMapRange(setter, sourceMapRange); + return ts.visitArray([backingField, getter, setter], accessorFieldResultVisitor, ts.isClassElement); + } + function transformPrivateFieldInitializer(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) { var info = accessPrivateIdentifier(node.name); ts.Debug.assert(info, "Undeclared private name for property declaration."); - if (!info.isValid) { - return node; - } + return info.isValid ? undefined : node; } - var expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer || useDefineForClassFields); - if (expr && !ts.isSimpleInlineableExpression(expr)) { - getPendingExpressions().push(expr); + if (shouldTransformInitializersUsingSet && !ts.isStatic(node)) { + return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, undefined, undefined, undefined); } - if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) { - var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); - if (initializerStatement) { - var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); - ts.setOriginalNode(staticBlock, node); - ts.setCommentRange(staticBlock, node); - ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); - ts.setSyntheticLeadingComments(initializerStatement, undefined); - ts.setSyntheticTrailingComments(initializerStatement, undefined); - return staticBlock; + return ts.visitEachChild(node, visitor, context); + } + function transformPublicFieldInitializer(node) { + if (shouldTransformInitializers) { + var expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer || useDefineForClassFields); + if (expr) { + getPendingExpressions().push(expr); + } + if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks) { + var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); + if (initializerStatement) { + var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); + ts.setOriginalNode(staticBlock, node); + ts.setCommentRange(staticBlock, node); + ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); + ts.setSyntheticLeadingComments(initializerStatement, undefined); + ts.setSyntheticTrailingComments(initializerStatement, undefined); + return staticBlock; + } } + return undefined; } - return undefined; + return ts.visitEachChild(node, classElementVisitor, context); + } + function transformFieldInitializer(node) { + ts.Debug.assert(!ts.hasDecorators(node), "Decorators should already have been transformed and elided."); + return ts.isPrivateIdentifierClassElementDeclaration(node) ? + transformPrivateFieldInitializer(node) : + transformPublicFieldInitializer(node); + } + function visitPropertyDeclaration(node) { + if (shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(node)) { + return transformAutoAccessor(node); + } + return transformFieldInitializer(node); } function createPrivateIdentifierAccess(info, receiver) { return createPrivateIdentifierAccessHelper(info, ts.visitNode(receiver, visitor, ts.isExpression)); @@ -79712,9 +80629,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) { - if (node.operator === 45 || node.operator === 46) { + if (node.operator === 45 || + node.operator === 46) { var operand = ts.skipParentheses(node.operand); - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(operand)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(operand)) { var info = void 0; if (info = accessPrivateIdentifier(operand.name)) { var receiver = ts.visitNode(operand.expression, visitor, ts.isExpression); @@ -79795,7 +80714,8 @@ var ts; return { readExpression: readExpression, initializeExpression: initializeExpression }; } function visitCallExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; if (ts.isCallChain(node)) { return factory.updateCallChain(node, factory.createPropertyAccessChain(ts.visitNode(target, visitor), node.questionDotToken, "call"), undefined, undefined, __spreadArray([ts.visitNode(thisArg, visitor, ts.isExpression)], ts.visitNodes(node.arguments, visitor, ts.isExpression), true)); @@ -79814,7 +80734,8 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitTaggedTemplateExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { var _a = factory.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; return factory.updateTaggedTemplateExpression(node, factory.createCallExpression(factory.createPropertyAccessExpression(ts.visitNode(target, visitor), "bind"), undefined, [ts.visitNode(thisArg, visitor, ts.isExpression)]), undefined, ts.visitNode(node.template, visitor, ts.isTemplateLiteral)); } @@ -79835,11 +80756,8 @@ var ts; classLexicalEnvironmentMap.set(ts.getOriginalNodeId(node), currentClassLexicalEnvironment); } startLexicalEnvironment(); - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = node; - var statements = ts.visitNodes(node.body.statements, visitor, ts.isStatement); + var statements = setCurrentStaticPropertyDeclarationOrStaticBlockAnd(node, function (statements) { return ts.visitNodes(statements, visitor, ts.isStatement); }, node.body.statements); statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; var iife = factory.createImmediatelyInvokedArrowFunction(statements); ts.setOriginalNode(iife, node); ts.setTextRange(iife, node); @@ -79851,7 +80769,7 @@ var ts; if (ts.isDestructuringAssignment(node)) { var savedPendingExpressions = pendingExpressions; pendingExpressions = undefined; - node = factory.updateBinaryExpression(node, ts.visitNode(node.left, visitorDestructuringTarget), node.operatorToken, ts.visitNode(node.right, visitor)); + node = factory.updateBinaryExpression(node, ts.visitNode(node.left, assignmentTargetVisitor), node.operatorToken, ts.visitNode(node.right, visitor)); var expr = ts.some(pendingExpressions) ? factory.inlineExpressions(ts.compact(__spreadArray(__spreadArray([], pendingExpressions, true), [node], false))) : node; @@ -79859,7 +80777,8 @@ var ts; return expr; } if (ts.isAssignmentExpression(node)) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { var info = accessPrivateIdentifier(node.left.name); if (info) { return ts.setTextRange(ts.setOriginalNode(createPrivateIdentifierAssignment(info, node.left.expression, node.right, node.operatorToken.kind), node), node); @@ -79908,8 +80827,9 @@ var ts; } } } - if (node.operatorToken.kind === 101 && ts.isPrivateIdentifier(node.left)) { - return visitPrivateIdentifierInInExpression(node); + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierInExpression(node)) { + return transformPrivateIdentifierInInExpression(node); } return ts.visitEachChild(node, visitor, context); } @@ -79933,33 +80853,6 @@ var ts; ts.Debug.assertNever(info, "Unknown private element type"); } } - function visitClassLike(node) { - if (!ts.forEach(node.members, doesClassElementNeedTransform)) { - return ts.visitEachChild(node, visitor, context); - } - var savedPendingExpressions = pendingExpressions; - pendingExpressions = undefined; - startClassLexicalEnvironment(); - if (shouldTransformPrivateElementsOrClassStaticBlocks) { - var name = ts.getNameOfDeclaration(node); - if (name && ts.isIdentifier(name)) { - getPrivateIdentifierEnvironment().className = ts.idText(name); - } - var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); - if (ts.some(privateInstanceMethodsAndAccessors)) { - getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); - } - } - var result = ts.isClassDeclaration(node) ? - visitClassDeclaration(node) : - visitClassExpression(node); - endClassLexicalEnvironment(); - pendingExpressions = savedPendingExpressions; - return result; - } - function doesClassElementNeedTransform(node) { - return ts.isPropertyDeclaration(node) || ts.isClassStaticBlockDeclaration(node) || (shouldTransformPrivateElementsOrClassStaticBlocks && node.name && ts.isPrivateIdentifier(node.name)); - } function getPrivateInstanceMethodsAndAccessors(node) { return ts.filter(node.members, ts.isNonStaticMethodOrAccessorWithPrivateName); } @@ -79973,7 +80866,7 @@ var ts; var member = _a[_i]; if (!ts.isStatic(member)) continue; - if (member.name && ts.isPrivateIdentifier(member.name) && shouldTransformPrivateElementsOrClassStaticBlocks) { + if (member.name && (ts.isPrivateIdentifier(member.name) || ts.isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) { facts |= 2; } if (ts.isPropertyDeclaration(member) || ts.isClassStaticBlockDeclaration(member)) { @@ -79992,7 +80885,7 @@ var ts; } return facts; } - function visitExpressionWithTypeArguments(node) { + function visitExpressionWithTypeArgumentsInHeritageClause(node) { var facts = (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.facts) || 0; if (facts & 4) { var temp = factory.createTempVariable(hoistVariableDeclaration, true); @@ -80001,7 +80894,22 @@ var ts; } return ts.visitEachChild(node, visitor, context); } - function visitClassDeclaration(node) { + function visitInNewClassLexicalEnvironment(node, visitor) { + var savedCurrentClassContainer = currentClassContainer; + var savedPendingExpressions = pendingExpressions; + currentClassContainer = node; + pendingExpressions = undefined; + startClassLexicalEnvironment(); + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + var name = ts.getNameOfDeclaration(node); + if (name && ts.isIdentifier(name)) { + getPrivateIdentifierEnvironment().className = name; + } + var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); + if (ts.some(privateInstanceMethodsAndAccessors)) { + getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); + } + } var facts = getClassFacts(node); if (facts) { getClassLexicalEnvironment().facts = facts; @@ -80009,41 +80917,51 @@ var ts; if (facts & 8) { enableSubstitutionForClassStaticThisOrSuperReference(); } + var result = visitor(node, facts); + endClassLexicalEnvironment(); + currentClassContainer = savedCurrentClassContainer; + pendingExpressions = savedPendingExpressions; + return result; + } + function visitClassDeclaration(node) { + return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); + } + function visitClassDeclarationInNewClassLexicalEnvironment(node, facts) { var pendingClassReferenceAssignment; if (facts & 2) { var temp = factory.createTempVariable(hoistVariableDeclaration, true); getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104); - var statements = [ - factory.updateClassDeclaration(node, node.modifiers, node.name, undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) - ]; + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classDecl = factory.updateClassDeclaration(node, modifiers, node.name, undefined, heritageClauses, members); + var statements = []; + if (prologue) { + statements.push(factory.createExpressionStatement(prologue)); + } + statements.push(classDecl); if (pendingClassReferenceAssignment) { getPendingExpressions().unshift(pendingClassReferenceAssignment); } if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); } - var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); - if (ts.some(staticProperties)) { - addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + if (shouldTransformInitializersUsingSet || shouldTransformPrivateElementsOrClassStaticBlocks) { + var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); + if (ts.some(staticProperties)) { + addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + } } return statements; } function visitClassExpression(node) { - var facts = getClassFacts(node); - if (facts) { - getClassLexicalEnvironment().facts = facts; - } - if (facts & 8) { - enableSubstitutionForClassStaticThisOrSuperReference(); - } + return visitInNewClassLexicalEnvironment(node, visitClassExpressionInNewClassLexicalEnvironment); + } + function visitClassExpressionInNewClassLexicalEnvironment(node, facts) { var isDecoratedClassDeclaration = !!(facts & 1); var staticPropertiesOrClassStaticBlocks = ts.getStaticPropertiesAndClassStaticBlock(node); - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104); var isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 16777216; var temp; function createClassTempVar() { @@ -80056,8 +80974,20 @@ var ts; temp = createClassTempVar(); getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); } - var classExpression = factory.updateClassExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)); - var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(staticPropertiesOrClassStaticBlocks, function (p) { return ts.isClassStaticBlockDeclaration(p) || !!p.initializer || ts.isPrivateIdentifier(p.name); }); + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classExpression = factory.updateClassExpression(node, modifiers, node.name, undefined, heritageClauses, members); + var expressions = []; + if (prologue) { + expressions.push(prologue); + } + var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && + ts.some(staticPropertiesOrClassStaticBlocks, function (node) { + return ts.isClassStaticBlockDeclaration(node) || + ts.isPrivateIdentifierClassElementDeclaration(node) || + shouldTransformInitializers && ts.isInitializedProperty(node); + }); if (hasTransformableStatics || ts.some(pendingExpressions)) { if (isDecoratedClassDeclaration) { ts.Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); @@ -80068,12 +80998,16 @@ var ts; addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); } if (temp) { - return factory.inlineExpressions([factory.createAssignment(temp, classExpression), temp]); + expressions.push(ts.startOnNewLine(factory.createAssignment(temp, classExpression)), ts.startOnNewLine(temp)); + } + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } } - return classExpression; } else { - var expressions = []; temp || (temp = createClassTempVar()); if (isClassWithConstructorReference) { enableSubstitutionForClassAliases(); @@ -80086,43 +81020,70 @@ var ts; ts.addRange(expressions, ts.map(pendingExpressions, ts.startOnNewLine)); ts.addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); expressions.push(ts.startOnNewLine(temp)); - return factory.inlineExpressions(expressions); } } - return classExpression; + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } + } + return factory.inlineExpressions(expressions); } function visitClassStaticBlockDeclaration(node) { if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return ts.visitEachChild(node, classElementVisitor, context); + return ts.visitEachChild(node, visitor, context); } return undefined; } - function transformClassMembers(node, isDerivedClass) { - var members = []; + function transformClassMembers(node) { if (shouldTransformPrivateElementsOrClassStaticBlocks) { for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (ts.isPrivateIdentifierClassElementDeclaration(member)) { - addPrivateIdentifierToEnvironment(member); + addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); } } if (ts.some(getPrivateInstanceMethodsAndAccessors(node))) { createBrandCheckWeakSetForPrivateMethods(); } + if (shouldTransformAutoAccessors) { + for (var _b = 0, _c = node.members; _b < _c.length; _b++) { + var member = _c[_b]; + if (ts.isAutoAccessorPropertyDeclaration(member)) { + var storageName = factory.getGeneratedPrivateNameForNode(member.name, undefined, "_accessor_storage"); + addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + } + } + } } - var constructor = transformConstructor(node, isDerivedClass); - var visitedMembers = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); - if (constructor) { - members.push(constructor); + var members = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); + var syntheticConstructor; + if (!ts.some(members, ts.isConstructorDeclaration)) { + syntheticConstructor = transformConstructor(undefined, node); } + var prologue; + var syntheticStaticBlock; if (!shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(pendingExpressions)) { - members.push(factory.createClassStaticBlockDeclaration(factory.createBlock([ - factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)) - ]))); + var statement = factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)); + if (statement.transformFlags & 134234112) { + var temp = factory.createTempVariable(hoistVariableDeclaration); + var arrow = factory.createArrowFunction(undefined, undefined, [], undefined, undefined, factory.createBlock([statement])); + prologue = factory.createAssignment(temp, arrow); + statement = factory.createExpressionStatement(factory.createCallExpression(temp, undefined, [])); + } + var block = factory.createBlock([statement]); + syntheticStaticBlock = factory.createClassStaticBlockDeclaration(block); pendingExpressions = undefined; } - ts.addRange(members, visitedMembers); - return ts.setTextRange(factory.createNodeArray(members), node.members); + if (syntheticConstructor || syntheticStaticBlock) { + var membersArray = void 0; + membersArray = ts.append(membersArray, syntheticConstructor); + membersArray = ts.append(membersArray, syntheticStaticBlock); + membersArray = ts.addRange(membersArray, members); + members = ts.setTextRange(factory.createNodeArray(membersArray), node.members); + } + return { members: members, prologue: prologue }; } function createBrandCheckWeakSetForPrivateMethods() { var weakSetName = getPrivateIdentifierEnvironment().weakSetName; @@ -80130,32 +81091,37 @@ var ts; getPendingExpressions().push(factory.createAssignment(weakSetName, factory.createNewExpression(factory.createIdentifier("WeakSet"), undefined, []))); } function isClassElementThatRequiresConstructorStatement(member) { - if (ts.isStatic(member) || ts.hasSyntacticModifier(ts.getOriginalNode(member), 128)) { + if (ts.isStatic(member) || ts.hasAbstractModifier(ts.getOriginalNode(member))) { return false; } - if (useDefineForClassFields) { - return languageVersion < 9; - } - return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member); + return shouldTransformInitializersUsingDefine && ts.isPropertyDeclaration(member) || + shouldTransformInitializersUsingSet && ts.isInitializedProperty(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(member); } - function transformConstructor(node, isDerivedClass) { - var constructor = ts.visitNode(ts.getFirstConstructorWithBody(node), visitor, ts.isConstructorDeclaration); - var elements = node.members.filter(isClassElementThatRequiresConstructorStatement); - if (!ts.some(elements)) { + function transformConstructor(constructor, container) { + constructor = ts.visitNode(constructor, visitor, ts.isConstructorDeclaration); + if (!ts.some(container.members, isClassElementThatRequiresConstructorStatement)) { return constructor; } + var extendsClauseElement = ts.getEffectiveBaseTypeNode(container); + var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104); var parameters = ts.visitParameterList(constructor ? constructor.parameters : undefined, visitor, context); - var body = transformConstructorBody(node, constructor, isDerivedClass); + var body = transformConstructorBody(container, constructor, isDerivedClass); if (!body) { - return undefined; + return constructor; + } + if (constructor) { + ts.Debug.assert(parameters); + return factory.updateConstructorDeclaration(constructor, undefined, parameters, body); } - return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration(undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || node), constructor)); + return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration(undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || container), constructor)); } function transformConstructorBody(node, constructor, isDerivedClass) { - var _a; + var _a, _b; var properties = ts.getProperties(node, false, false); if (!useDefineForClassFields) { - properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name); }); + properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name) || ts.hasAccessorModifier(property); }); } var privateMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); var needsConstructorBody = ts.some(properties) || ts.some(privateMethodsAndAccessors); @@ -80188,8 +81154,8 @@ var ts; statements = statements.filter(function (statement) { return !ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor); }); } else { - for (var _i = 0, _b = constructor.body.statements; _i < _b.length; _i++) { - var statement = _b[_i]; + for (var _i = 0, _c = constructor.body.statements; _i < _c.length; _i++) { + var statement = _c[_i]; if (ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { parameterPropertyDeclarationCount++; } @@ -80216,7 +81182,13 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue)); } statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); - return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), constructor ? constructor.body.statements : node.members), true), constructor ? constructor.body : undefined); + if (statements.length === 0 && !constructor) { + return undefined; + } + var multiLine = (constructor === null || constructor === void 0 ? void 0 : constructor.body) && constructor.body.statements.length >= statements.length ? + (_b = constructor.body.multiLine) !== null && _b !== void 0 ? _b : statements.length > 0 : + statements.length > 0; + return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), constructor ? constructor.body.statements : node.members), multiLine), constructor ? constructor.body : undefined); function visitBodyStatement(statement) { if (useDefineForClassFields && ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { return undefined; @@ -80245,9 +81217,10 @@ var ts; return undefined; } var statement = factory.createExpressionStatement(expression); + ts.setOriginalNode(statement, property); + ts.addEmitFlags(statement, ts.getEmitFlags(property) & 1536); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); - ts.setOriginalNode(statement, property); ts.setSyntheticLeadingComments(expression, undefined); ts.setSyntheticTrailingComments(expression, undefined); return statement; @@ -80261,9 +81234,10 @@ var ts; continue; } ts.startOnNewLine(expression); + ts.setOriginalNode(expression, property); + ts.addEmitFlags(expression, ts.getEmitFlags(property) & 1536); ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); ts.setCommentRange(expression, property); - ts.setOriginalNode(expression, property); expressions.push(expression); } return expressions; @@ -80282,9 +81256,11 @@ var ts; function transformPropertyWorker(property, receiver) { var _a; var emitAssignment = !useDefineForClassFields; - var propertyName = ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) - ? factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) - : property.name; + var propertyName = ts.hasAccessorModifier(property) ? + factory.getGeneratedPrivateNameForNode(property.name) : + ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) ? + factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) : + property.name; if (ts.hasStaticModifier(property)) { currentStaticPropertyDeclarationOrStaticBlock = property; } @@ -80311,7 +81287,7 @@ var ts; return undefined; } var propertyOriginalNode = ts.getOriginalNode(property); - if (ts.hasSyntacticModifier(propertyOriginalNode, 128)) { + if (ts.hasSyntacticModifier(propertyOriginalNode, 256)) { return undefined; } var initializer = property.initializer || emitAssignment ? (_a = ts.visitNode(property.initializer, visitor, ts.isExpression)) !== null && _a !== void 0 ? _a : factory.createVoidZero() @@ -80340,14 +81316,14 @@ var ts; if ((enabledSubstitutions & 2) === 0) { enabledSubstitutions |= 2; context.enableSubstitution(108); - context.enableEmitNotification(256); - context.enableEmitNotification(213); - context.enableEmitNotification(171); - context.enableEmitNotification(172); + context.enableEmitNotification(259); + context.enableEmitNotification(215); context.enableEmitNotification(173); + context.enableEmitNotification(174); + context.enableEmitNotification(175); + context.enableEmitNotification(171); context.enableEmitNotification(169); - context.enableEmitNotification(167); - context.enableEmitNotification(162); + context.enableEmitNotification(164); } } function addMethodStatements(statements, methods, receiver) { @@ -80379,12 +81355,12 @@ var ts; } } switch (node.kind) { - case 213: + case 215: if (ts.isArrowFunction(original) || ts.getEmitFlags(node) & 262144) { break; } - case 256: - case 171: { + case 259: + case 173: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = undefined; @@ -80394,10 +81370,10 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 172: - case 173: - case 169: - case 167: { + case 174: + case 175: + case 171: + case 169: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentComputedPropertyNameClassLexicalEnvironment = currentClassLexicalEnvironment; @@ -80407,7 +81383,7 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 162: { + case 164: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; @@ -80505,148 +81481,137 @@ var ts; function getPrivateIdentifierEnvironment() { var lex = getClassLexicalEnvironment(); lex.privateIdentifierEnvironment || (lex.privateIdentifierEnvironment = { - className: "", - identifiers: new ts.Map() + className: undefined, + weakSetName: undefined, + identifiers: undefined, + generatedIdentifiers: undefined, }); return lex.privateIdentifierEnvironment; } function getPendingExpressions() { - return pendingExpressions || (pendingExpressions = []); + return pendingExpressions !== null && pendingExpressions !== void 0 ? pendingExpressions : (pendingExpressions = []); } - function addPrivateIdentifierToEnvironment(node) { - var _a; - var text = ts.getTextOfPropertyName(node.name); - var lex = getClassLexicalEnvironment(); - var classConstructor = lex.classConstructor; - var privateEnv = getPrivateIdentifierEnvironment(); - var weakSetName = privateEnv.weakSetName; - var assignmentExpressions = []; - var privateName = node.name.escapedText; - var previousInfo = privateEnv.identifiers.get(privateName); - var isValid = !isReservedPrivateName(node.name) && previousInfo === undefined; - if (ts.hasStaticModifier(node)) { - ts.Debug.assert(classConstructor, "weakSetName should be set in private identifier environment"); - if (ts.isPropertyDeclaration(node)) { - var variableName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f", - variableName: variableName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isMethodDeclaration(node)) { - var functionName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "m", - methodName: functionName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isGetAccessorDeclaration(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a", - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else if (ts.isSetAccessorDeclaration(node)) { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a", - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else { - ts.Debug.assertNever(node, "Unknown class element type."); - } + function addPrivateIdentifierClassElementToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + if (ts.isAutoAccessorPropertyDeclaration(node)) { + addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isPropertyDeclaration(node)) { - var weakMapName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { + addPrivateIdentifierPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isMethodDeclaration(node)) { + addPrivateIdentifierMethodDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isGetAccessorDeclaration(node)) { + addPrivateIdentifierGetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isSetAccessorDeclaration(node)) { + addPrivateIdentifierSetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + } + function addPrivateIdentifierPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + if (isStatic) { + ts.Debug.assert(lex.classConstructor, "classConstructor should be set in private identifier environment"); + var variableName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f", + brandCheckIdentifier: lex.classConstructor, + variableName: variableName, + isStatic: true, + isValid: isValid, + }); + } + else { + var weakMapName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { kind: "f", brandCheckIdentifier: weakMapName, - isStatic: false, variableName: undefined, + isStatic: false, isValid: isValid, }); - assignmentExpressions.push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), undefined, []))); + getPendingExpressions().push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), undefined, []))); + } + } + function addPrivateIdentifierMethodDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var methodName = createHoistedVariableForPrivateName(name); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "m", + methodName: methodName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierGetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && previousInfo.isStatic === isStatic && !previousInfo.getterName) { + previousInfo.getterName = getterName; } - else if (ts.isMethodDeclaration(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - privateEnv.identifiers.set(privateName, { - kind: "m", - methodName: createHoistedVariableForPrivateName(text, node), - brandCheckIdentifier: weakSetName, - isStatic: false, + else { + setPrivateIdentifier(privateEnv, name, { + kind: "a", + getterName: getterName, + setterName: undefined, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, isValid: isValid, }); } - else if (ts.isAccessor(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - if (ts.isGetAccessor(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && !previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a", - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } - else { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && !previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a", - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } + } + function addPrivateIdentifierSetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" && previousInfo.isStatic === isStatic && !previousInfo.setterName) { + previousInfo.setterName = setterName; } else { - ts.Debug.assertNever(node, "Unknown class element type."); + setPrivateIdentifier(privateEnv, name, { + kind: "a", + getterName: undefined, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); } - (_a = getPendingExpressions()).push.apply(_a, assignmentExpressions); } - function createHoistedVariableForClass(name, node) { + function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "a", + getterName: getterName, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierToEnvironment(node, name, addDeclaration) { + var lex = getClassLexicalEnvironment(); + var privateEnv = getPrivateIdentifierEnvironment(); + var previousInfo = getPrivateIdentifier(privateEnv, name); + var isStatic = ts.hasStaticModifier(node); + var isValid = !isReservedPrivateName(name) && previousInfo === undefined; + addDeclaration(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + function createHoistedVariableForClass(name, node, suffix) { var className = getPrivateIdentifierEnvironment().className; - var prefix = className ? "_".concat(className) : ""; - var identifier = factory.createUniqueName("".concat(prefix, "_").concat(name), 16); + var prefix = className ? { prefix: "_", node: className, suffix: "_" } : "_"; + var identifier = typeof name === "object" ? factory.getGeneratedNameForNode(name, 16 | 8, prefix, suffix) : + typeof name === "string" ? factory.createUniqueName(name, 16, prefix, suffix) : + factory.createTempVariable(undefined, true, prefix, suffix); if (resolver.getNodeCheckFlags(node) & 524288) { addBlockScopedVariable(identifier); } @@ -80655,13 +81620,28 @@ var ts; } return identifier; } - function createHoistedVariableForPrivateName(privateName, node) { - return createHoistedVariableForClass(privateName.substring(1), node.name); + function createHoistedVariableForPrivateName(name, suffix) { + var _a; + var text = ts.tryGetTextOfPropertyName(name); + return createHoistedVariableForClass((_a = text === null || text === void 0 ? void 0 : text.substring(1)) !== null && _a !== void 0 ? _a : name, name, suffix); } function accessPrivateIdentifier(name) { - var _a; + if (ts.isGeneratedPrivateIdentifier(name)) { + return accessGeneratedPrivateIdentifier(name); + } + else { + return accessPrivateIdentifierByText(name.escapedText); + } + } + function accessPrivateIdentifierByText(text) { + return accessPrivateIdentifierWorker(getPrivateIdentifierInfo, text); + } + function accessGeneratedPrivateIdentifier(name) { + return accessPrivateIdentifierWorker(getGeneratedPrivateIdentifierInfo, ts.getNodeForGeneratedName(name)); + } + function accessPrivateIdentifierWorker(getPrivateIdentifierInfo, privateIdentifierKey) { if (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.privateIdentifierEnvironment) { - var info = currentClassLexicalEnvironment.privateIdentifierEnvironment.identifiers.get(name.escapedText); + var info = getPrivateIdentifierInfo(currentClassLexicalEnvironment.privateIdentifierEnvironment, privateIdentifierKey); if (info) { return info; } @@ -80671,9 +81651,11 @@ var ts; if (!env) { continue; } - var info = (_a = env.privateIdentifierEnvironment) === null || _a === void 0 ? void 0 : _a.identifiers.get(name.escapedText); - if (info) { - return info; + if (env.privateIdentifierEnvironment) { + var info = getPrivateIdentifierInfo(env.privateIdentifierEnvironment, privateIdentifierKey); + if (info) { + return info; + } } } return undefined; @@ -80728,7 +81710,7 @@ var ts; } } } - return ts.visitNode(node, visitorDestructuringTarget); + return ts.visitNode(node, assignmentTargetVisitor); } function visitObjectAssignmentTarget(node) { if (ts.isObjectBindingOrAssignmentElement(node) && !ts.isShorthandPropertyAssignment(node)) { @@ -80761,10 +81743,10 @@ var ts; var initializer = ts.getInitializerOfBindingOrAssignmentElement(node); return factory.updatePropertyAssignment(node, ts.visitNode(node.name, visitor, ts.isPropertyName), wrapped ? initializer ? factory.createAssignment(wrapped, ts.visitNode(initializer, visitor)) : wrapped : - ts.visitNode(node.initializer, visitorDestructuringTarget, ts.isExpression)); + ts.visitNode(node.initializer, assignmentTargetVisitor, ts.isExpression)); } if (ts.isSpreadAssignment(node)) { - return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, visitorDestructuringTarget, ts.isExpression)); + return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, assignmentTargetVisitor, ts.isExpression)); } ts.Debug.assert(wrapped === undefined, "Should not have generated a wrapped target"); } @@ -80792,7 +81774,31 @@ var ts; return ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(weakSetName, "add"), undefined, [receiver]); } function isReservedPrivateName(node) { - return node.escapedText === "#constructor"; + return !ts.isGeneratedPrivateIdentifier(node) && node.escapedText === "#constructor"; + } + function getPrivateIdentifier(privateEnv, name) { + return ts.isGeneratedPrivateIdentifier(name) ? + getGeneratedPrivateIdentifierInfo(privateEnv, ts.getNodeForGeneratedName(name)) : + getPrivateIdentifierInfo(privateEnv, name.escapedText); + } + function setPrivateIdentifier(privateEnv, name, info) { + var _a, _b; + if (ts.isGeneratedPrivateIdentifier(name)) { + (_a = privateEnv.generatedIdentifiers) !== null && _a !== void 0 ? _a : (privateEnv.generatedIdentifiers = new ts.Map()); + privateEnv.generatedIdentifiers.set(ts.getNodeForGeneratedName(name), info); + } + else { + (_b = privateEnv.identifiers) !== null && _b !== void 0 ? _b : (privateEnv.identifiers = new ts.Map()); + privateEnv.identifiers.set(name.escapedText, info); + } + } + function getPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.identifiers) === null || _a === void 0 ? void 0 : _a.get(key); + } + function getGeneratedPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.generatedIdentifiers) === null || _a === void 0 ? void 0 : _a.get(key); } })(ts || (ts = {})); var ts; @@ -80828,15 +81834,15 @@ var ts; } function serializeTypeOfNode(node) { switch (node.kind) { - case 167: - case 164: + case 169: + case 166: return serializeTypeNode(node.type); - case 173: - case 172: + case 175: + case 174: return serializeTypeNode(getAccessorTypeNode(node)); - case 257: - case 226: - case 169: + case 260: + case 228: + case 171: return ts.factory.createIdentifier("Function"); default: return ts.factory.createVoidZero(); @@ -80868,7 +81874,7 @@ var ts; return ts.factory.createArrayLiteralExpression(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 172) { + if (container && node.kind === 174) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -80892,65 +81898,65 @@ var ts; node = ts.skipTypeParentheses(node); switch (node.kind) { case 114: - case 153: - case 143: + case 155: + case 144: return ts.factory.createVoidZero(); - case 179: - case 180: + case 181: + case 182: return ts.factory.createIdentifier("Function"); - case 183: - case 184: + case 185: + case 186: return ts.factory.createIdentifier("Array"); - case 177: + case 179: return node.assertsModifier ? ts.factory.createVoidZero() : ts.factory.createIdentifier("Boolean"); - case 133: + case 134: return ts.factory.createIdentifier("Boolean"); - case 198: - case 150: + case 200: + case 152: return ts.factory.createIdentifier("String"); - case 148: + case 149: return ts.factory.createIdentifier("Object"); - case 196: + case 198: return serializeLiteralOfLiteralTypeNode(node.literal); - case 147: + case 148: return ts.factory.createIdentifier("Number"); - case 158: + case 160: return getGlobalConstructor("BigInt", 7); - case 151: + case 153: return getGlobalConstructor("Symbol", 2); - case 178: + case 180: return serializeTypeReferenceNode(node); - case 188: + case 190: return serializeUnionOrIntersectionConstituents(node.types, true); - case 187: - return serializeUnionOrIntersectionConstituents(node.types, false); case 189: + return serializeUnionOrIntersectionConstituents(node.types, false); + case 191: return serializeUnionOrIntersectionConstituents([node.trueType, node.falseType], false); - case 193: - if (node.operator === 145) { + case 195: + if (node.operator === 146) { return serializeTypeNode(node.type); } break; - case 181: + case 183: + case 196: + case 197: + case 184: + case 131: + case 157: case 194: - case 195: - case 182: - case 130: - case 155: - case 192: - case 200: + case 202: + break; + case 315: + case 316: + case 320: + case 321: + case 322: break; - case 312: - case 313: case 317: case 318: case 319: - break; - case 314: - case 315: - case 316: return serializeTypeNode(node.type); default: return ts.Debug.failBadSyntaxKind(node); @@ -80962,7 +81968,7 @@ var ts; case 10: case 14: return ts.factory.createIdentifier("String"); - case 219: { + case 221: { var operand = node.operand; switch (operand.kind) { case 8: @@ -80990,20 +81996,20 @@ var ts; for (var _i = 0, types_22 = types; _i < types_22.length; _i++) { var typeNode = types_22[_i]; typeNode = ts.skipTypeParentheses(typeNode); - if (typeNode.kind === 143) { + if (typeNode.kind === 144) { if (isIntersection) return ts.factory.createVoidZero(); continue; } - if (typeNode.kind === 155) { + if (typeNode.kind === 157) { if (!isIntersection) return ts.factory.createIdentifier("Object"); continue; } - if (typeNode.kind === 130) { + if (typeNode.kind === 131) { return ts.factory.createIdentifier("Object"); } - if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104) || typeNode.kind === 153)) { + if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104) || typeNode.kind === 155)) { continue; } var serializedConstituent = serializeTypeNode(typeNode); @@ -81105,7 +82111,7 @@ var ts; name.original = undefined; ts.setParent(name, ts.getParseTreeNode(currentLexicalScope)); return name; - case 161: + case 163: return serializeQualifiedNameAsExpression(node); } } @@ -81147,23 +82153,23 @@ var ts; return node; } switch (node.kind) { - case 165: + case 167: return undefined; - case 257: + case 260: return visitClassDeclaration(node); - case 226: + case 228: return visitClassExpression(node); - case 171: + case 173: return visitConstructorDeclaration(node); - case 169: + case 171: return visitMethodDeclaration(node); - case 173: + case 175: return visitSetAccessorDeclaration(node); - case 172: + case 174: return visitGetAccessorDeclaration(node); - case 167: + case 169: return visitPropertyDeclaration(node); - case 164: + case 166: return visitParameterDeclaration(node); default: return ts.visitEachChild(node, visitor, context); @@ -81322,7 +82328,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, !ts.hasSyntacticModifier(member, 2)); var descriptor = languageVersion > 0 - ? member.kind === 167 + ? ts.isPropertyDeclaration(member) && !ts.hasAccessorModifier(member) ? factory.createVoidZero() : factory.createNull() : undefined; @@ -81507,33 +82513,36 @@ var ts; return node; } switch (node.kind) { - case 131: + case 132: return undefined; - case 218: + case 220: return visitAwaitExpression(node); - case 169: + case 171: return doWithContext(1 | 2, visitMethodDeclaration, node); - case 256: + case 259: return doWithContext(1 | 2, visitFunctionDeclaration, node); - case 213: + case 215: return doWithContext(1 | 2, visitFunctionExpression, node); - case 214: + case 216: return doWithContext(1, visitArrowFunction, node); - case 206: + case 208: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207: + case 209: if (capturedSuperProperties && node.expression.kind === 106) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 172: + case 174: + return doWithContext(1 | 2, visitGetAccessorDeclaration, node); + case 175: + return doWithContext(1 | 2, visitSetAccessorDeclaration, node); case 173: - case 171: - case 257: - case 226: + return doWithContext(1 | 2, visitConstructorDeclaration, node); + case 260: + case 228: return doWithContext(1 | 2, visitDefault, node); default: return ts.visitEachChild(node, visitor, context); @@ -81542,27 +82551,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 237: + case 240: return visitVariableStatementInAsyncBody(node); - case 242: + case 245: return visitForStatementInAsyncBody(node); - case 243: + case 246: return visitForInStatementInAsyncBody(node); - case 244: + case 247: return visitForOfStatementInAsyncBody(node); - case 292: + case 295: return visitCatchClauseInAsyncBody(node); - case 235: - case 249: - case 263: - case 289: - case 290: + case 238: case 252: - case 240: - case 241: - case 239: - case 248: - case 250: + case 266: + case 292: + case 293: + case 255: + case 243: + case 244: + case 242: + case 251: + case 253: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -81622,10 +82631,19 @@ var ts; } return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node); } + function visitConstructorDeclaration(node) { + return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node)); + } function visitMethodDeclaration(node) { return factory.updateMethodDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.asteriskToken, node.name, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2 ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : transformMethodBody(node)); + } + function visitGetAccessorDeclaration(node) { + return factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), undefined, transformMethodBody(node)); + } + function visitSetAccessorDeclaration(node) { + return factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node)); } function visitFunctionDeclaration(node) { return factory.updateFunctionDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.asteriskToken, node.name, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, ts.getFunctionFlags(node) & 2 @@ -81709,12 +82727,45 @@ var ts; } return false; } + function transformMethodBody(node) { + ts.Debug.assertIsDefined(node.body); + var savedCapturedSuperProperties = capturedSuperProperties; + var savedHasSuperElementAccess = hasSuperElementAccess; + capturedSuperProperties = new ts.Set(); + hasSuperElementAccess = false; + var updated = ts.visitFunctionBody(node.body, visitor, context); + var originalMethod = ts.getOriginalNode(node, ts.isFunctionLikeDeclaration); + var emitSuperHelpers = languageVersion >= 2 && + resolver.getNodeCheckFlags(node) & (4096 | 2048) && + (ts.getFunctionFlags(originalMethod) & 3) !== 3; + if (emitSuperHelpers) { + enableSubstitutionForAsyncMethodsWithSuper(); + if (capturedSuperProperties.size) { + var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties); + substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true; + var statements = updated.statements.slice(); + ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]); + updated = factory.updateBlock(updated, statements); + } + if (hasSuperElementAccess) { + if (resolver.getNodeCheckFlags(node) & 4096) { + ts.addEmitHelper(updated, ts.advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & 2048) { + ts.addEmitHelper(updated, ts.asyncSuperHelper); + } + } + } + capturedSuperProperties = savedCapturedSuperProperties; + hasSuperElementAccess = savedHasSuperElementAccess; + return updated; + } function transformAsyncFunctionBody(node) { resumeLexicalEnvironment(); var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 214; + var isArrowFunction = node.kind === 216; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0; var savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames; enclosingFunctionParameterNames = new ts.Set(); @@ -81795,15 +82846,15 @@ var ts; function enableSubstitutionForAsyncMethodsWithSuper() { if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; + context.enableSubstitution(210); context.enableSubstitution(208); - context.enableSubstitution(206); - context.enableSubstitution(207); - context.enableEmitNotification(257); - context.enableEmitNotification(169); - context.enableEmitNotification(172); - context.enableEmitNotification(173); + context.enableSubstitution(209); + context.enableEmitNotification(260); context.enableEmitNotification(171); - context.enableEmitNotification(237); + context.enableEmitNotification(174); + context.enableEmitNotification(175); + context.enableEmitNotification(173); + context.enableEmitNotification(240); } } function onEmitNode(hint, node, emitCallback) { @@ -81835,11 +82886,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206: + case 208: return substitutePropertyAccessExpression(node); - case 207: + case 209: return substituteElementAccessExpression(node); - case 208: + case 210: return substituteCallExpression(node); } return node; @@ -81870,11 +82921,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 + return kind === 260 + || kind === 173 || kind === 171 - || kind === 169 - || kind === 172 - || kind === 173; + || kind === 174 + || kind === 175; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096) { @@ -81964,7 +83015,7 @@ var ts; return visitorWorker(node, true); } function visitorNoAsyncModifier(node) { - if (node.kind === 131) { + if (node.kind === 132) { return undefined; } return node; @@ -81986,70 +83037,70 @@ var ts; return node; } switch (node.kind) { - case 218: + case 220: return visitAwaitExpression(node); - case 224: + case 226: return visitYieldExpression(node); - case 247: - return visitReturnStatement(node); case 250: + return visitReturnStatement(node); + case 253: return visitLabeledStatement(node); - case 205: + case 207: return visitObjectLiteralExpression(node); - case 221: + case 223: return visitBinaryExpression(node, expressionResultIsUnused); - case 351: + case 354: return visitCommaListExpression(node, expressionResultIsUnused); - case 292: + case 295: return visitCatchClause(node); - case 237: + case 240: return visitVariableStatement(node); - case 254: + case 257: return visitVariableDeclaration(node); - case 240: - case 241: case 243: - return doWithHierarchyFacts(visitDefault, node, 0, 2); case 244: + case 246: + return doWithHierarchyFacts(visitDefault, node, 0, 2); + case 247: return visitForOfStatement(node, undefined); - case 242: + case 245: return doWithHierarchyFacts(visitForStatement, node, 0, 2); - case 217: + case 219: return visitVoidExpression(node); - case 171: + case 173: return doWithHierarchyFacts(visitConstructorDeclaration, node, 2, 1); - case 169: + case 171: return doWithHierarchyFacts(visitMethodDeclaration, node, 2, 1); - case 172: + case 174: return doWithHierarchyFacts(visitGetAccessorDeclaration, node, 2, 1); - case 173: + case 175: return doWithHierarchyFacts(visitSetAccessorDeclaration, node, 2, 1); - case 256: + case 259: return doWithHierarchyFacts(visitFunctionDeclaration, node, 2, 1); - case 213: + case 215: return doWithHierarchyFacts(visitFunctionExpression, node, 2, 1); - case 214: + case 216: return doWithHierarchyFacts(visitArrowFunction, node, 2, 0); - case 164: + case 166: return visitParameter(node); - case 238: + case 241: return visitExpressionStatement(node); - case 212: + case 214: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 210: + case 212: return visitTaggedTemplateExpression(node); - case 206: + case 208: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207: + case 209: if (capturedSuperProperties && node.expression.kind === 106) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 257: - case 226: + case 260: + case 228: return doWithHierarchyFacts(visitDefault, node, 2, 1); default: return ts.visitEachChild(node, visitor, context); @@ -82082,7 +83133,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 244 && statement.awaitModifier) { + if (statement.kind === 247 && statement.awaitModifier) { return visitForOfStatement(statement, node); } return factory.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement, factory.liftToBlock), node); @@ -82094,7 +83145,7 @@ var ts; var objects = []; for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) { var e = elements_5[_i]; - if (e.kind === 298) { + if (e.kind === 301) { if (chunkObject) { objects.push(factory.createObjectLiteralExpression(chunkObject)); chunkObject = undefined; @@ -82103,7 +83154,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 296 + chunkObject = ts.append(chunkObject, e.kind === 299 ? factory.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -82116,7 +83167,7 @@ var ts; function visitObjectLiteralExpression(node) { if (node.transformFlags & 65536) { var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 205) { + if (objects.length && objects[0].kind !== 207) { objects.unshift(factory.createObjectLiteralExpression()); } var expression = objects[0]; @@ -82262,11 +83313,22 @@ var ts; } return node; } - function convertForOfStatementHead(node, boundValue) { - var binding = ts.createForOfBindingStatement(factory, node.initializer, boundValue); + function convertForOfStatementHead(node, boundValue, nonUserCode) { + var value = factory.createTempVariable(hoistVariableDeclaration); + var iteratorValueExpression = factory.createAssignment(value, boundValue); + var iteratorValueStatement = factory.createExpressionStatement(iteratorValueExpression); + ts.setSourceMapRange(iteratorValueStatement, node.expression); + var exitNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createFalse()); + var exitNonUserCodeStatement = factory.createExpressionStatement(exitNonUserCodeExpression); + ts.setSourceMapRange(exitNonUserCodeStatement, node.expression); + var enterNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createTrue()); + var enterNonUserCodeStatement = factory.createExpressionStatement(enterNonUserCodeExpression); + ts.setSourceMapRange(exitNonUserCodeStatement, node.expression); + var statements = []; + var binding = ts.createForOfBindingStatement(factory, node.initializer, value); + statements.push(ts.visitNode(binding, visitor, ts.isStatement)); var bodyLocation; var statementsLocation; - var statements = [ts.visitNode(binding, visitor, ts.isStatement)]; var statement = ts.visitIterationBody(node.statement, visitor, context); if (ts.isBlock(statement)) { ts.addRange(statements, statement.statements); @@ -82276,7 +83338,14 @@ var ts; else { statements.push(statement); } - return ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), true), bodyLocation), 48 | 384); + var body = ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), true), bodyLocation), 48 | 384); + return factory.createBlock([ + iteratorValueStatement, + exitNonUserCodeStatement, + factory.createTryStatement(body, undefined, factory.createBlock([ + enterNonUserCodeStatement + ])) + ]); } function createDownlevelAwait(expression) { return enclosingFunctionFlags & 1 @@ -82287,6 +83356,8 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isExpression); var iterator = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(expression) : factory.createTempVariable(undefined); var result = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(iterator) : factory.createTempVariable(undefined); + var nonUserCode = factory.createTempVariable(undefined); + var done = factory.createTempVariable(hoistVariableDeclaration); var errorRecord = factory.createUniqueName("e"); var catchVariable = factory.getGeneratedNameForNode(errorRecord); var returnMethod = factory.createTempVariable(undefined); @@ -82301,9 +83372,14 @@ var ts; factory.inlineExpressions([factory.createAssignment(errorRecord, factory.createVoidZero()), callValues]) : callValues; var forStatement = ts.setEmitFlags(ts.setTextRange(factory.createForStatement(ts.setEmitFlags(ts.setTextRange(factory.createVariableDeclarationList([ + factory.createVariableDeclaration(nonUserCode, undefined, undefined, factory.createTrue()), ts.setTextRange(factory.createVariableDeclaration(iterator, undefined, undefined, initializer), node.expression), factory.createVariableDeclaration(result) - ]), node.expression), 2097152), factory.createComma(factory.createAssignment(result, createDownlevelAwait(callNext)), factory.createLogicalNot(getDone)), undefined, convertForOfStatementHead(node, getValue)), node), 256); + ]), node.expression), 2097152), factory.inlineExpressions([ + factory.createAssignment(result, createDownlevelAwait(callNext)), + factory.createAssignment(done, getDone), + factory.createLogicalNot(done) + ]), undefined, convertForOfStatementHead(node, getValue, nonUserCode)), node), 256); ts.setOriginalNode(forStatement, node); return factory.createTryStatement(factory.createBlock([ factory.restoreEnclosingLabel(forStatement, outermostLabeledStatement) @@ -82313,7 +83389,7 @@ var ts; ]))) ]), 1)), factory.createBlock([ factory.createTryStatement(factory.createBlock([ - ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(result, factory.createLogicalNot(getDone)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), 1) + ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(factory.createLogicalNot(nonUserCode), factory.createLogicalNot(done)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), 1) ]), undefined, ts.setEmitFlags(factory.createBlock([ ts.setEmitFlags(factory.createIfStatement(errorRecord, factory.createThrowStatement(factory.createPropertyAccessExpression(errorRecord, "error"))), 1) ]), 1)) @@ -82544,15 +83620,15 @@ var ts; function enableSubstitutionForAsyncMethodsWithSuper() { if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; + context.enableSubstitution(210); context.enableSubstitution(208); - context.enableSubstitution(206); - context.enableSubstitution(207); - context.enableEmitNotification(257); - context.enableEmitNotification(169); - context.enableEmitNotification(172); - context.enableEmitNotification(173); + context.enableSubstitution(209); + context.enableEmitNotification(260); context.enableEmitNotification(171); - context.enableEmitNotification(237); + context.enableEmitNotification(174); + context.enableEmitNotification(175); + context.enableEmitNotification(173); + context.enableEmitNotification(240); } } function onEmitNode(hint, node, emitCallback) { @@ -82584,11 +83660,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206: + case 208: return substitutePropertyAccessExpression(node); - case 207: + case 209: return substituteElementAccessExpression(node); - case 208: + case 210: return substituteCallExpression(node); } return node; @@ -82619,11 +83695,11 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 + return kind === 260 + || kind === 173 || kind === 171 - || kind === 169 - || kind === 172 - || kind === 173; + || kind === 174 + || kind === 175; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { if (enclosingSuperContainerFlags & 4096) { @@ -82652,7 +83728,7 @@ var ts; return node; } switch (node.kind) { - case 292: + case 295: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -82683,25 +83759,25 @@ var ts; return node; } switch (node.kind) { - case 208: { + case 210: { var updated = visitNonOptionalCallExpression(node, false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } - case 206: - case 207: + case 208: + case 209: if (ts.isOptionalChain(node)) { var updated = visitOptionalExpression(node, false, false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } return ts.visitEachChild(node, visitor, context); - case 221: + case 223: if (node.operatorToken.kind === 60) { return transformNullishCoalescingExpression(node); } return ts.visitEachChild(node, visitor, context); - case 215: + case 217: return visitDeleteExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -82740,7 +83816,7 @@ var ts; thisArg = expression; } } - expression = node.kind === 206 + expression = node.kind === 208 ? factory.updatePropertyAccessExpression(node, expression, ts.visitNode(node.name, visitor, ts.isIdentifier)) : factory.updateElementAccessExpression(node, expression, ts.visitNode(node.argumentExpression, visitor, ts.isExpression)); return thisArg ? factory.createSyntheticReferenceExpression(expression, thisArg) : expression; @@ -82761,10 +83837,10 @@ var ts; } function visitNonOptionalExpression(node, captureThisArg, isDelete) { switch (node.kind) { - case 212: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); - case 206: - case 207: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); - case 208: return visitNonOptionalCallExpression(node, captureThisArg); + case 214: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); + case 208: + case 209: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); + case 210: return visitNonOptionalCallExpression(node, captureThisArg); default: return ts.visitNode(node, visitor, ts.isExpression); } } @@ -82783,8 +83859,8 @@ var ts; for (var i = 0; i < chain.length; i++) { var segment = chain[i]; switch (segment.kind) { - case 206: - case 207: + case 208: + case 209: if (i === chain.length - 1 && captureThisArg) { if (!ts.isSimpleCopiableExpression(rightExpression)) { thisArg = factory.createTempVariable(hoistVariableDeclaration); @@ -82794,11 +83870,11 @@ var ts; thisArg = rightExpression; } } - rightExpression = segment.kind === 206 + rightExpression = segment.kind === 208 ? factory.createPropertyAccessExpression(rightExpression, ts.visitNode(segment.name, visitor, ts.isIdentifier)) : factory.createElementAccessExpression(rightExpression, ts.visitNode(segment.argumentExpression, visitor, ts.isExpression)); break; - case 208: + case 210: if (i === 0 && leftThisArg) { if (!ts.isGeneratedIdentifier(leftThisArg)) { leftThisArg = factory.cloneNode(leftThisArg); @@ -82855,7 +83931,7 @@ var ts; return node; } switch (node.kind) { - case 221: + case 223: var binaryExpression = node; if (ts.isLogicalOrCoalescingAssignmentExpression(binaryExpression)) { return transformLogicalAssignment(binaryExpression); @@ -83011,13 +84087,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 278: + case 281: return visitJsxElement(node, false); - case 279: - return visitJsxSelfClosingElement(node, false); case 282: + return visitJsxSelfClosingElement(node, false); + case 285: return visitJsxFragment(node, false); - case 288: + case 291: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -83027,13 +84103,13 @@ var ts; switch (node.kind) { case 11: return visitJsxText(node); - case 288: + case 291: return visitJsxExpression(node); - case 278: + case 281: return visitJsxElement(node, true); - case 279: - return visitJsxSelfClosingElement(node, true); case 282: + return visitJsxSelfClosingElement(node, true); + case 285: return visitJsxFragment(node, true); default: return ts.Debug.failBadSyntaxKind(node); @@ -83196,7 +84272,7 @@ var ts; var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote); return ts.setTextRange(literal, node); } - if (node.kind === 288) { + if (node.kind === 291) { if (node.expression === undefined) { return factory.createTrue(); } @@ -83263,7 +84339,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 278) { + if (node.kind === 281) { return getTagName(node.openingElement); } else { @@ -83564,7 +84640,7 @@ var ts; return node; } switch (node.kind) { - case 221: + case 223: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -83657,7 +84733,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return (hierarchyFacts & 8192) !== 0 - && node.kind === 247 + && node.kind === 250 && !node.expression; } function isOrMayContainReturnCompletion(node) { @@ -83711,65 +84787,65 @@ var ts; switch (node.kind) { case 124: return undefined; - case 257: + case 260: return visitClassDeclaration(node); - case 226: + case 228: return visitClassExpression(node); - case 164: + case 166: return visitParameter(node); - case 256: + case 259: return visitFunctionDeclaration(node); - case 214: + case 216: return visitArrowFunction(node); - case 213: + case 215: return visitFunctionExpression(node); - case 254: + case 257: return visitVariableDeclaration(node); case 79: return visitIdentifier(node); - case 255: + case 258: return visitVariableDeclarationList(node); - case 249: + case 252: return visitSwitchStatement(node); - case 263: + case 266: return visitCaseBlock(node); - case 235: + case 238: return visitBlock(node, false); - case 246: - case 245: + case 249: + case 248: return visitBreakOrContinueStatement(node); - case 250: + case 253: return visitLabeledStatement(node); - case 240: - case 241: + case 243: + case 244: return visitDoOrWhileStatement(node, undefined); - case 242: + case 245: return visitForStatement(node, undefined); - case 243: + case 246: return visitForInStatement(node, undefined); - case 244: + case 247: return visitForOfStatement(node, undefined); - case 238: + case 241: return visitExpressionStatement(node); - case 205: + case 207: return visitObjectLiteralExpression(node); - case 292: + case 295: return visitCatchClause(node); - case 297: + case 300: return visitShorthandPropertyAssignment(node); - case 162: + case 164: return visitComputedPropertyName(node); - case 204: + case 206: return visitArrayLiteralExpression(node); - case 208: + case 210: return visitCallExpression(node); - case 209: + case 211: return visitNewExpression(node); - case 212: + case 214: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 221: + case 223: return visitBinaryExpression(node, expressionResultIsUnused); - case 351: + case 354: return visitCommaListExpression(node, expressionResultIsUnused); case 14: case 15: @@ -83780,30 +84856,30 @@ var ts; return visitStringLiteral(node); case 8: return visitNumericLiteral(node); - case 210: + case 212: return visitTaggedTemplateExpression(node); - case 223: + case 225: return visitTemplateExpression(node); - case 224: + case 226: return visitYieldExpression(node); - case 225: + case 227: return visitSpreadElement(node); case 106: return visitSuperKeyword(false); case 108: return visitThisKeyword(node); - case 231: + case 233: return visitMetaProperty(node); - case 169: + case 171: return visitMethodDeclaration(node); - case 172: - case 173: + case 174: + case 175: return visitAccessorDeclaration(node); - case 237: + case 240: return visitVariableStatement(node); - case 247: + case 250: return visitReturnStatement(node); - case 217: + case 219: return visitVoidExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -83877,24 +84953,26 @@ var ts; return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context); } function visitIdentifier(node) { - if (!convertedLoopState) { - return node; + if (convertedLoopState) { + if (resolver.isArgumentsLocalBinding(node)) { + return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments")); + } } - if (resolver.isArgumentsLocalBinding(node)) { - return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments")); + if (node.hasExtendedUnicodeEscape) { + return ts.setOriginalNode(ts.setTextRange(factory.createIdentifier(ts.unescapeLeadingUnderscores(node.escapedText)), node), node); } return node; } function visitBreakOrContinueStatement(node) { if (convertedLoopState) { - var jump = node.kind === 246 ? 2 : 4; + var jump = node.kind === 249 ? 2 : 4; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; var label = node.label; if (!label) { - if (node.kind === 246) { + if (node.kind === 249) { convertedLoopState.nonLocalJumps |= 2; labelMarker = "break"; } @@ -83904,7 +84982,7 @@ var ts; } } else { - if (node.kind === 246) { + if (node.kind === 249) { labelMarker = "break-".concat(label.escapedText); setLabeledJump(convertedLoopState, true, ts.idText(label), labelMarker); } @@ -83943,7 +85021,7 @@ var ts; ts.startOnNewLine(statement); statements.push(statement); if (ts.hasSyntacticModifier(node, 1)) { - var exportStatement = ts.hasSyntacticModifier(node, 512) + var exportStatement = ts.hasSyntacticModifier(node, 1024) ? factory.createExportDefault(factory.getLocalName(node)) : factory.createExternalModuleExport(factory.getLocalName(node)); ts.setOriginalNode(exportStatement, statement); @@ -84112,17 +85190,17 @@ var ts; }; } function isSufficientlyCoveredByReturnStatements(statement) { - if (statement.kind === 247) { + if (statement.kind === 250) { return true; } - else if (statement.kind === 239) { + else if (statement.kind === 242) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement); } } - else if (statement.kind === 235) { + else if (statement.kind === 238) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -84230,7 +85308,7 @@ var ts; return true; } function insertCaptureThisForNodeIfNeeded(statements, node) { - if (hierarchyFacts & 65536 && node.kind !== 214) { + if (hierarchyFacts & 65536 && node.kind !== 216) { insertCaptureThisForNode(statements, node, factory.createThis()); return true; } @@ -84255,18 +85333,18 @@ var ts; if (hierarchyFacts & 32768) { var newTarget = void 0; switch (node.kind) { - case 214: + case 216: return statements; - case 169: - case 172: - case 173: + case 171: + case 174: + case 175: newTarget = factory.createVoidZero(); break; - case 171: + case 173: newTarget = factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createThis(), 4), "constructor"); break; - case 256: - case 213: + case 259: + case 215: newTarget = factory.createConditionalExpression(factory.createLogicalAnd(ts.setEmitFlags(factory.createThis(), 4), factory.createBinaryExpression(ts.setEmitFlags(factory.createThis(), 4), 102, factory.getLocalName(node))), undefined, factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createThis(), 4), "constructor"), undefined, factory.createVoidZero()); break; default: @@ -84287,21 +85365,21 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 234: + case 237: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 169: + case 171: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 172: - case 173: + case 174: + case 175: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 171: - case 170: + case 173: + case 172: break; default: ts.Debug.failBadSyntaxKind(member, currentSourceFile && currentSourceFile.fileName); @@ -84433,7 +85511,7 @@ var ts; : enterSubtree(32670, 65); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 32768 && !name && (node.kind === 256 || node.kind === 213)) { + if (hierarchyFacts & 32768 && !name && (node.kind === 259 || node.kind === 215)) { name = factory.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 98304, 0); @@ -84466,7 +85544,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 214); + ts.Debug.assert(node.kind === 216); statementsLocation = ts.moveRangeEnd(body, -1); var equalsGreaterThanToken = node.equalsGreaterThanToken; if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) { @@ -84670,14 +85748,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 240: - case 241: + case 243: + case 244: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 242: + case 245: return visitForStatement(node, outermostLabeledStatement); - case 243: + case 246: return visitForInStatement(node, outermostLabeledStatement); - case 244: + case 247: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -84802,7 +85880,7 @@ var ts; var property = properties[i]; if ((property.transformFlags & 1048576 && hierarchyFacts & 4) - || (hasComputed = ts.Debug.checkDefined(property.name).kind === 162)) { + || (hasComputed = ts.Debug.checkDefined(property.name).kind === 164)) { numInitialProperties = i; break; } @@ -84908,11 +85986,11 @@ var ts; } function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) { switch (node.kind) { - case 242: return convertForStatement(node, initializerFunction, convertedLoopBody); - case 243: return convertForInStatement(node, convertedLoopBody); - case 244: return convertForOfStatement(node, convertedLoopBody); - case 240: return convertDoStatement(node, convertedLoopBody); - case 241: return convertWhileStatement(node, convertedLoopBody); + case 245: return convertForStatement(node, initializerFunction, convertedLoopBody); + case 246: return convertForInStatement(node, convertedLoopBody); + case 247: return convertForOfStatement(node, convertedLoopBody); + case 243: return convertDoStatement(node, convertedLoopBody); + case 244: return convertWhileStatement(node, convertedLoopBody); default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected"); } } @@ -84936,11 +86014,11 @@ var ts; function createConvertedLoopState(node) { var loopInitializer; switch (node.kind) { - case 242: - case 243: - case 244: + case 245: + case 246: + case 247: var initializer = node.initializer; - if (initializer && initializer.kind === 255) { + if (initializer && initializer.kind === 258) { loopInitializer = initializer; } break; @@ -85212,20 +86290,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 172: - case 173: + case 174: + case 175: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine)); } break; - case 169: + case 171: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 296: + case 299: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 297: + case 300: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -85296,7 +86374,7 @@ var ts; var updated; var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (node.kind === 172) { + if (node.kind === 174) { updated = factory.updateGetAccessorDeclaration(node, node.modifiers, node.name, parameters, node.type, body); } else { @@ -85523,13 +86601,13 @@ var ts; if ((enabledSubstitutions & 1) === 0) { enabledSubstitutions |= 1; context.enableSubstitution(108); - context.enableEmitNotification(171); - context.enableEmitNotification(169); - context.enableEmitNotification(172); context.enableEmitNotification(173); - context.enableEmitNotification(214); - context.enableEmitNotification(213); - context.enableEmitNotification(256); + context.enableEmitNotification(171); + context.enableEmitNotification(174); + context.enableEmitNotification(175); + context.enableEmitNotification(216); + context.enableEmitNotification(215); + context.enableEmitNotification(259); } } function onSubstituteNode(hint, node) { @@ -85553,10 +86631,10 @@ var ts; } function isNameOfDeclarationWithCollidingName(node) { switch (node.parent.kind) { - case 203: - case 257: + case 205: case 260: - case 254: + case 263: + case 257: return node.parent.name === node && resolver.isDeclarationWithCollidingName(node.parent); } @@ -85617,11 +86695,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 238) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 241) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 208) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 210) { return false; } var callTarget = statementExpression.expression; @@ -85629,7 +86707,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 225) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 227) { return false; } var expression = callArgument.expression; @@ -85648,24 +86726,24 @@ var ts; if (compilerOptions.jsx === 1 || compilerOptions.jsx === 3) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(280); - context.enableEmitNotification(281); - context.enableEmitNotification(279); + context.enableEmitNotification(283); + context.enableEmitNotification(284); + context.enableEmitNotification(282); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(206); - context.enableSubstitution(296); + context.enableSubstitution(208); + context.enableSubstitution(299); return ts.chainBundle(context, transformSourceFile); function transformSourceFile(node) { return node; } function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 280: - case 281: - case 279: + case 283: + case 284: + case 282: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -85785,13 +86863,13 @@ var ts; } function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 240: + case 243: return visitDoStatement(node); - case 241: + case 244: return visitWhileStatement(node); - case 249: + case 252: return visitSwitchStatement(node); - case 250: + case 253: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -85799,24 +86877,24 @@ var ts; } function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 256: + case 259: return visitFunctionDeclaration(node); - case 213: + case 215: return visitFunctionExpression(node); - case 172: - case 173: + case 174: + case 175: return visitAccessorDeclaration(node); - case 237: + case 240: return visitVariableStatement(node); - case 242: + case 245: return visitForStatement(node); - case 243: - return visitForInStatement(node); case 246: + return visitForInStatement(node); + case 249: return visitBreakStatement(node); - case 245: + case 248: return visitContinueStatement(node); - case 247: + case 250: return visitReturnStatement(node); default: if (node.transformFlags & 1048576) { @@ -85832,23 +86910,23 @@ var ts; } function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 221: + case 223: return visitBinaryExpression(node); - case 351: + case 354: return visitCommaListExpression(node); - case 222: - return visitConditionalExpression(node); case 224: + return visitConditionalExpression(node); + case 226: return visitYieldExpression(node); - case 204: + case 206: return visitArrayLiteralExpression(node); - case 205: - return visitObjectLiteralExpression(node); case 207: + return visitObjectLiteralExpression(node); + case 209: return visitElementAccessExpression(node); - case 208: + case 210: return visitCallExpression(node); - case 209: + case 211: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -85856,9 +86934,9 @@ var ts; } function visitGenerator(node) { switch (node.kind) { - case 256: + case 259: return visitFunctionDeclaration(node); - case 213: + case 215: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -85995,10 +87073,10 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 206: + case 208: target = factory.updatePropertyAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 207: + case 209: target = factory.updateElementAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression))); break; default: @@ -86210,35 +87288,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 235: - return transformAndEmitBlock(node); case 238: + return transformAndEmitBlock(node); + case 241: return transformAndEmitExpressionStatement(node); - case 239: + case 242: return transformAndEmitIfStatement(node); - case 240: + case 243: return transformAndEmitDoStatement(node); - case 241: + case 244: return transformAndEmitWhileStatement(node); - case 242: + case 245: return transformAndEmitForStatement(node); - case 243: + case 246: return transformAndEmitForInStatement(node); - case 245: + case 248: return transformAndEmitContinueStatement(node); - case 246: + case 249: return transformAndEmitBreakStatement(node); - case 247: + case 250: return transformAndEmitReturnStatement(node); - case 248: + case 251: return transformAndEmitWithStatement(node); - case 249: + case 252: return transformAndEmitSwitchStatement(node); - case 250: + case 253: return transformAndEmitLabeledStatement(node); - case 251: + case 254: return transformAndEmitThrowStatement(node); - case 252: + case 255: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -86413,19 +87491,23 @@ var ts; } function transformAndEmitForInStatement(node) { if (containsYield(node)) { + var obj = declareLocal(); var keysArray = declareLocal(); var key = declareLocal(); var keysIndex = factory.createLoopVariable(); var initializer = node.initializer; hoistVariableDeclaration(keysIndex); + emitAssignment(obj, ts.visitNode(node.expression, visitor, ts.isExpression)); emitAssignment(keysArray, factory.createArrayLiteralExpression()); - emitStatement(factory.createForInStatement(key, ts.visitNode(node.expression, visitor, ts.isExpression), factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"), undefined, [key])))); + emitStatement(factory.createForInStatement(key, obj, factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"), undefined, [key])))); emitAssignment(keysIndex, factory.createNumericLiteral(0)); var conditionLabel = defineLabel(); var incrementLabel = defineLabel(); - var endLabel = beginLoopBlock(incrementLabel); + var endLoopLabel = beginLoopBlock(incrementLabel); markLabel(conditionLabel); - emitBreakWhenFalse(endLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length"))); + emitBreakWhenFalse(endLoopLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length"))); + emitAssignment(key, factory.createElementAccessExpression(keysArray, keysIndex)); + emitBreakWhenFalse(incrementLabel, factory.createBinaryExpression(key, 101, obj)); var variable = void 0; if (ts.isVariableDeclarationList(initializer)) { for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { @@ -86438,7 +87520,7 @@ var ts; variable = ts.visitNode(initializer, visitor, ts.isExpression); ts.Debug.assert(ts.isLeftHandSideExpression(variable)); } - emitAssignment(variable, factory.createElementAccessExpression(keysArray, keysIndex)); + emitAssignment(variable, key); transformAndEmitEmbeddedStatement(node.statement); markLabel(incrementLabel); emitStatement(factory.createExpressionStatement(factory.createPostfixIncrement(keysIndex))); @@ -86532,7 +87614,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 290 && defaultClauseIndex === -1) { + if (clause.kind === 293 && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -86542,7 +87624,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 289) { + if (clause.kind === 292) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -87347,12 +88429,12 @@ var ts; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(208); context.enableSubstitution(210); + context.enableSubstitution(212); context.enableSubstitution(79); - context.enableSubstitution(221); - context.enableSubstitution(297); - context.enableEmitNotification(305); + context.enableSubstitution(223); + context.enableSubstitution(300); + context.enableEmitNotification(308); var moduleInfoMap = []; var deferredExports = []; var currentSourceFile; @@ -87546,23 +88628,23 @@ var ts; } function topLevelVisitor(node) { switch (node.kind) { - case 266: + case 269: return visitImportDeclaration(node); - case 265: + case 268: return visitImportEqualsDeclaration(node); - case 272: + case 275: return visitExportDeclaration(node); - case 271: + case 274: return visitExportAssignment(node); - case 237: + case 240: return visitVariableStatement(node); - case 256: + case 259: return visitFunctionDeclaration(node); - case 257: + case 260: return visitClassDeclaration(node); - case 352: + case 355: return visitMergeDeclarationMarker(node); - case 353: + case 356: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -87573,26 +88655,26 @@ var ts; return node; } switch (node.kind) { - case 242: + case 245: return visitForStatement(node); - case 238: + case 241: return visitExpressionStatement(node); - case 212: + case 214: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350: + case 353: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 208: + case 210: if (ts.isImportCall(node) && currentSourceFile.impliedNodeFormat === undefined) { return visitImportCallExpression(node); } break; - case 221: + case 223: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 219: - case 220: + case 221: + case 222: return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -87608,24 +88690,24 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var elem = _a[_i]; switch (elem.kind) { - case 296: + case 299: if (destructuringNeedsFlattening(elem.initializer)) { return true; } break; - case 297: + case 300: if (destructuringNeedsFlattening(elem.name)) { return true; } break; - case 298: + case 301: if (destructuringNeedsFlattening(elem.expression)) { return true; } break; - case 169: - case 172: - case 173: + case 171: + case 174: + case 175: return false; default: ts.Debug.assertNever(elem, "Unhandled object member kind"); } @@ -87718,18 +88800,18 @@ var ts; return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis); case ts.ModuleKind.CommonJS: default: - return createImportCallExpressionCommonJS(argument, containsLexicalThis); + return createImportCallExpressionCommonJS(argument); } } function createImportCallExpressionUMD(arg, containsLexicalThis) { needUMDDynamicImportHelper = true; if (ts.isSimpleCopiableExpression(arg)) { var argClone = ts.isGeneratedIdentifier(arg) ? arg : ts.isStringLiteral(arg) ? factory.createStringLiteralFromNode(arg) : ts.setEmitFlags(ts.setTextRange(factory.cloneNode(arg), arg), 1536); - return factory.createConditionalExpression(factory.createIdentifier("__syncRequire"), undefined, createImportCallExpressionCommonJS(arg, containsLexicalThis), undefined, createImportCallExpressionAMD(argClone, containsLexicalThis)); + return factory.createConditionalExpression(factory.createIdentifier("__syncRequire"), undefined, createImportCallExpressionCommonJS(arg), undefined, createImportCallExpressionAMD(argClone, containsLexicalThis)); } else { var temp = factory.createTempVariable(hoistVariableDeclaration); - return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression(factory.createIdentifier("__syncRequire"), undefined, createImportCallExpressionCommonJS(temp, containsLexicalThis), undefined, createImportCallExpressionAMD(temp, containsLexicalThis))); + return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression(factory.createIdentifier("__syncRequire"), undefined, createImportCallExpressionCommonJS(temp, true), undefined, createImportCallExpressionAMD(temp, containsLexicalThis))); } } function createImportCallExpressionAMD(arg, containsLexicalThis) { @@ -87758,9 +88840,10 @@ var ts; } return promise; } - function createImportCallExpressionCommonJS(arg, containsLexicalThis) { + function createImportCallExpressionCommonJS(arg, isInlineable) { + var temp = arg && !ts.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined; var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), undefined, []); - var requireCall = factory.createCallExpression(factory.createIdentifier("require"), undefined, arg ? [arg] : []); + var requireCall = factory.createCallExpression(factory.createIdentifier("require"), undefined, temp ? [temp] : arg ? [arg] : []); if (ts.getESModuleInterop(compilerOptions)) { requireCall = emitHelpers().createImportStarHelper(requireCall); } @@ -87770,11 +88853,9 @@ var ts; } else { func = factory.createFunctionExpression(undefined, undefined, undefined, undefined, [], undefined, factory.createBlock([factory.createReturnStatement(requireCall)])); - if (containsLexicalThis) { - ts.setEmitFlags(func, 8); - } } - return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), undefined, [func]); + var downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), undefined, [func]); + return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]); } function getHelperExpressionForExport(node, innerExpr) { if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864) { @@ -88028,7 +89109,7 @@ var ts; } } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -88060,10 +89141,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268: + case 271: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269: + case 272: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding, true); @@ -88111,7 +89192,7 @@ var ts; return statements; } if (ts.hasSyntacticModifier(decl, 1)) { - var exportName = ts.hasSyntacticModifier(decl, 512) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); + var exportName = ts.hasSyntacticModifier(decl, 1024) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); statements = appendExportStatement(statements, exportName, factory.getLocalName(decl), decl); } if (decl.name) { @@ -88178,7 +89259,7 @@ var ts; return node; } function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305) { + if (node.kind === 308) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; previousOnEmitNode(hint, node, emitCallback); @@ -88218,11 +89299,11 @@ var ts; switch (node.kind) { case 79: return substituteExpressionIdentifier(node); - case 208: - return substituteCallExpression(node); case 210: + return substituteCallExpression(node); + case 212: return substituteTaggedTemplateExpression(node); - case 221: + case 223: return substituteBinaryExpression(node); } return node; @@ -88258,7 +89339,7 @@ var ts; } else if (!(ts.isGeneratedIdentifier(node) && !(node.autoGenerateFlags & 64)) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 305) { + if (exportContainer && exportContainer.kind === 308) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(node)), node); } var importDeclaration = resolver.getReferencedImportDeclaration(node); @@ -88323,10 +89404,10 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(79); - context.enableSubstitution(297); - context.enableSubstitution(221); - context.enableSubstitution(231); - context.enableEmitNotification(305); + context.enableSubstitution(300); + context.enableSubstitution(223); + context.enableSubstitution(233); + context.enableEmitNotification(308); var moduleInfoMap = []; var deferredExports = []; var exportFunctionsMap = []; @@ -88416,7 +89497,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var exportStarFunction = addExportStarIfNeeded(statements); var modifiers = node.transformFlags & 2097152 ? - factory.createModifiersFromModifierFlags(256) : + factory.createModifiersFromModifierFlags(512) : undefined; var moduleObject = factory.createObjectLiteralExpression([ factory.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), @@ -88433,7 +89514,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 272 && externalImport.exportClause) { + if (externalImport.kind === 275 && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -88494,15 +89575,21 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(factory, entry, currentSourceFile); switch (entry.kind) { - case 266: + case 269: if (!entry.importClause) { break; } - case 265: + case 268: ts.Debug.assert(importVariableName !== undefined); statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName))); + if (ts.hasSyntacticModifier(entry, 1)) { + statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction, undefined, [ + factory.createStringLiteral(ts.idText(importVariableName)), + parameterName, + ]))); + } break; - case 272: + case 275: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { if (ts.isNamedExports(entry.exportClause)) { @@ -88532,13 +89619,13 @@ var ts; } function topLevelVisitor(node) { switch (node.kind) { - case 266: + case 269: return visitImportDeclaration(node); - case 265: + case 268: return visitImportEqualsDeclaration(node); - case 272: + case 275: return visitExportDeclaration(node); - case 271: + case 274: return visitExportAssignment(node); default: return topLevelNestedVisitor(node); @@ -88663,7 +89750,7 @@ var ts; } function shouldHoistVariableDeclarationList(node) { return (ts.getEmitFlags(node) & 2097152) === 0 - && (enclosingBlockScopedContainer.kind === 305 + && (enclosingBlockScopedContainer.kind === 308 || (ts.getOriginalNode(node).flags & 3) === 0); } function transformInitializedVariable(node, isExportedDeclaration) { @@ -88685,7 +89772,7 @@ var ts; : preventSubstitution(ts.setTextRange(factory.createAssignment(name, value), location)); } function visitMergeDeclarationMarker(node) { - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasSyntacticModifier(node.original, 1); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -88724,10 +89811,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268: + case 271: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269: + case 272: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -88783,7 +89870,7 @@ var ts; } var excludeName; if (ts.hasSyntacticModifier(decl, 1)) { - var exportName = ts.hasSyntacticModifier(decl, 512) ? factory.createStringLiteral("default") : decl.name; + var exportName = ts.hasSyntacticModifier(decl, 1024) ? factory.createStringLiteral("default") : decl.name; statements = appendExportStatement(statements, exportName, factory.getLocalName(decl)); excludeName = ts.getTextOfIdentifierOrLiteral(exportName); } @@ -88827,43 +89914,43 @@ var ts; } function topLevelNestedVisitor(node) { switch (node.kind) { - case 237: + case 240: return visitVariableStatement(node); - case 256: + case 259: return visitFunctionDeclaration(node); - case 257: + case 260: return visitClassDeclaration(node); - case 242: + case 245: return visitForStatement(node, true); - case 243: + case 246: return visitForInStatement(node); - case 244: + case 247: return visitForOfStatement(node); - case 240: + case 243: return visitDoStatement(node); - case 241: + case 244: return visitWhileStatement(node); - case 250: + case 253: return visitLabeledStatement(node); - case 248: + case 251: return visitWithStatement(node); - case 249: + case 252: return visitSwitchStatement(node); - case 263: + case 266: return visitCaseBlock(node); - case 289: + case 292: return visitCaseClause(node); - case 290: + case 293: return visitDefaultClause(node); - case 252: + case 255: return visitTryStatement(node); - case 292: + case 295: return visitCatchClause(node); - case 235: + case 238: return visitBlock(node); - case 352: + case 355: return visitMergeDeclarationMarker(node); - case 353: + case 356: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -88960,26 +90047,26 @@ var ts; return node; } switch (node.kind) { - case 242: + case 245: return visitForStatement(node, false); - case 238: + case 241: return visitExpressionStatement(node); - case 212: + case 214: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350: + case 353: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 221: + case 223: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 208: + case 210: if (ts.isImportCall(node)) { return visitImportCallExpression(node); } break; - case 219: - case 220: + case 221: + case 222: return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -89032,7 +90119,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 305; + return container !== undefined && container.kind === 308; } else { return false; @@ -89083,7 +90170,7 @@ var ts; return node; } function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305) { + if (node.kind === 308) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -89119,7 +90206,7 @@ var ts; } function substituteUnspecified(node) { switch (node.kind) { - case 297: + case 300: return substituteShorthandPropertyAssignment(node); } return node; @@ -89144,9 +90231,9 @@ var ts; switch (node.kind) { case 79: return substituteExpressionIdentifier(node); - case 221: + case 223: return substituteBinaryExpression(node); - case 231: + case 233: return substituteMetaProperty(node); } return node; @@ -89204,7 +90291,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, false); - if (exportContainer && exportContainer.kind === 305) { + if (exportContainer && exportContainer.kind === 308) { exportedNames = ts.append(exportedNames, factory.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -89236,7 +90323,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(305); + context.enableEmitNotification(308); context.enableSubstitution(79); var helperNameSubstitutions; var currentSourceFile; @@ -89276,11 +90363,11 @@ var ts; } function visitor(node) { switch (node.kind) { - case 265: + case 268: return ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.Node16 ? visitImportEqualsDeclaration(node) : undefined; - case 271: + case 274: return visitExportAssignment(node); - case 272: + case 275: var exportDecl = node; return visitExportDeclaration(exportDecl); } @@ -89387,8 +90474,8 @@ var ts; var cjsOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(305); - context.enableEmitNotification(305); + context.enableSubstitution(308); + context.enableEmitNotification(308); var currentSourceFile; return transformSourceFileOrBundle; function onSubstituteNode(hint, node) { @@ -89432,7 +90519,7 @@ var ts; return result; } function transformSourceFileOrBundle(node) { - return node.kind === 305 ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -89491,7 +90578,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257) { + else if (node.parent.kind === 260) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -89520,7 +90607,7 @@ var ts; ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257) { + else if (node.parent.kind === 260) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -89567,15 +90654,15 @@ var ts; return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: ".concat(ts.Debug.formatSyntaxKind(node.kind))); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 254 || node.kind === 203) { + if (node.kind === 257 || node.kind === 205) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1; } - else if (node.kind === 167 || node.kind === 206 || node.kind === 166 || - (node.kind === 164 && ts.hasSyntacticModifier(node.parent, 8))) { + else if (node.kind === 169 || node.kind === 208 || node.kind === 168 || + (node.kind === 166 && ts.hasSyntacticModifier(node.parent, 8))) { if (ts.isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -89583,7 +90670,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 || node.kind === 164) { + else if (node.parent.kind === 260 || node.kind === 166) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -89607,7 +90694,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.kind === 173) { + if (node.kind === 175) { if (ts.isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 : @@ -89644,23 +90731,23 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 175: + case 177: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 174: + case 176: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 176: + case 178: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 169: - case 168: + case 171: + case 170: if (ts.isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -89668,7 +90755,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 257) { + else if (node.parent.kind === 260) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -89681,7 +90768,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 256: + case 259: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -89706,27 +90793,27 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 171: + case 173: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 175: - case 180: + case 177: + case 182: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 174: + case 176: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 176: + case 178: return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 169: - case 168: + case 171: + case 170: if (ts.isStatic(node.parent)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? @@ -89734,7 +90821,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257) { + else if (node.parent.parent.kind === 260) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -89746,15 +90833,15 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 256: - case 179: + case 259: + case 181: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - case 173: - case 172: + case 175: + case 174: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 ? ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -89767,39 +90854,39 @@ var ts; function getTypeParameterConstraintVisibilityError() { var diagnosticMessage; switch (node.parent.kind) { - case 257: + case 260: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 258: + case 261: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 195: + case 197: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1; break; - case 180: - case 175: + case 182: + case 177: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 174: + case 176: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 169: - case 168: + case 171: + case 170: if (ts.isStatic(node.parent)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257) { + else if (node.parent.parent.kind === 260) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 179: - case 256: + case 181: + case 259: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 259: + case 262: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -89861,7 +90948,7 @@ var ts; } function isInternalDeclaration(node, currentSourceFile) { var parseTreeNode = ts.getParseTreeNode(node); - if (parseTreeNode && parseTreeNode.kind === 164) { + if (parseTreeNode && parseTreeNode.kind === 166) { var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode); var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined; var text = currentSourceFile.text; @@ -90022,7 +91109,7 @@ var ts; var _a; var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; }); var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; }); - if (augmentingDeclarations) { + if (primaryDeclaration && augmentingDeclarations) { for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) { var augmentations = augmentingDeclarations_1[_i]; context.addDiagnostic(ts.addRelatedInfo(ts.createDiagnosticForNode(augmentations, ts.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts.createDiagnosticForNode(primaryDeclaration, ts.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file))); @@ -90052,10 +91139,10 @@ var ts; return result; } function transformRoot(node) { - if (node.kind === 305 && node.isDeclarationFile) { + if (node.kind === 308 && node.isDeclarationFile) { return node; } - if (node.kind === 306) { + if (node.kind === 309) { isBundledEmit = true; refs = new ts.Map(); libs = new ts.Map(); @@ -90078,14 +91165,14 @@ var ts; resultHasExternalModuleIndicator = false; needsDeclare = false; var statements = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile, true)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(135)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], true, [], [], false, []); + var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(136)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], true, [], [], false, []); return newFile; } needsDeclare = true; var updated = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); return factory.updateSourceFile(sourceFile, transformAndReplaceLatePaintedStatements(updated), true, [], [], false, []); }), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308) { + if (prepend.kind === 311) { var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal); hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib; collectReferences(sourceFile, refs); @@ -90218,7 +91305,7 @@ var ts; return name; } else { - if (name.kind === 202) { + if (name.kind === 204) { return factory.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -90226,7 +91313,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 227) { + if (elem.kind === 229) { return elem; } if (elem.propertyName && ts.isIdentifier(elem.propertyName) && ts.isIdentifier(elem.name) && !elem.symbol.isReferenced) { @@ -90263,17 +91350,17 @@ var ts; if (shouldPrintWithInitializer(node)) { return; } - var shouldUseResolverType = node.kind === 164 && + var shouldUseResolverType = node.kind === 166 && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); if (type && !shouldUseResolverType) { return ts.visitNode(type, visitDeclarationSubtree); } if (!ts.getParseTreeNode(node)) { - return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(130); + return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(131); } - if (node.kind === 173) { - return factory.createKeywordTypeNode(130); + if (node.kind === 175) { + return factory.createKeywordTypeNode(131); } errorNameNode = node.name; var oldDiag; @@ -90281,12 +91368,12 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 254 || node.kind === 203) { + if (node.kind === 257 || node.kind === 205) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } - if (node.kind === 164 - || node.kind === 167 - || node.kind === 166) { + if (node.kind === 166 + || node.kind === 169 + || node.kind === 168) { if (ts.isPropertySignature(node) || !node.initializer) return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType)); return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); @@ -90297,27 +91384,27 @@ var ts; if (!suppressNewDiagnosticContexts) { getSymbolAccessibilityDiagnostic = oldDiag; } - return returnValue || factory.createKeywordTypeNode(130); + return returnValue || factory.createKeywordTypeNode(131); } } function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 256: - case 261: - case 258: - case 257: case 259: + case 264: + case 261: case 260: + case 262: + case 263: return !resolver.isDeclarationVisible(node); - case 254: + case 257: return !getBindingNameVisible(node); - case 265: - case 266: - case 272: - case 271: + case 268: + case 269: + case 275: + case 274: return false; - case 170: + case 172: return true; } return false; @@ -90402,7 +91489,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return undefined; - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 261 && parent.kind !== 200); + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 264 && parent.kind !== 202); if (ts.isStringLiteralLike(input)) { if (isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); @@ -90422,7 +91509,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 277) { + if (decl.moduleReference.kind === 280) { var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return factory.updateImportEqualsDeclaration(decl, decl.modifiers, decl.isTypeOnly, decl.name, factory.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))); } @@ -90442,7 +91529,7 @@ var ts; if (!decl.importClause.namedBindings) { return visibleDefaultBinding && factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); } - if (decl.importClause.namedBindings.kind === 268) { + if (decl.importClause.namedBindings.kind === 271) { var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : undefined; return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined; } @@ -90519,7 +91606,7 @@ var ts; var oldDiag = getSymbolAccessibilityDiagnostic; var canProduceDiagnostic = ts.canProduceDiagnostics(input); var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 182 || input.kind === 195) && input.parent.kind !== 259); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 184 || input.kind === 197) && input.parent.kind !== 262); if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) { if (ts.hasEffectiveModifier(input, 8)) { if (input.symbol && input.symbol.declarations && input.symbol.declarations[0] !== input) @@ -90538,67 +91625,67 @@ var ts; } if (isProcessedComponent(input)) { switch (input.kind) { - case 228: { + case 230: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments)); } - case 178: { + case 180: { checkEntityNameVisibility(input.typeName, enclosingDeclaration); var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); } - case 175: + case 177: return cleanup(factory.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); - case 171: { + case 173: { var ctor = factory.createConstructorDeclaration(ensureModifiers(input), updateParamsList(input, input.parameters, 0), undefined); return cleanup(ctor); } - case 169: { + case 171: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(undefined); } var sig = factory.createMethodDeclaration(ensureModifiers(input), undefined, input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), undefined); return cleanup(sig); } - case 172: { + case 174: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(undefined); } var accessorType = getTypeAnnotationFromAllAccessorDeclarations(input, resolver.getAllAccessorDeclarations(input)); return cleanup(factory.updateGetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8)), ensureType(input, accessorType), undefined)); } - case 173: { + case 175: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(undefined); } return cleanup(factory.updateSetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8)), undefined)); } - case 167: + case 169: if (ts.isPrivateIdentifier(input.name)) { return cleanup(undefined); } return cleanup(factory.updatePropertyDeclaration(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type), ensureNoInitializer(input))); - case 166: + case 168: if (ts.isPrivateIdentifier(input.name)) { return cleanup(undefined); } return cleanup(factory.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type))); - case 168: { + case 170: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(undefined); } return cleanup(factory.updateMethodSignature(input, ensureModifiers(input), input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 174: { + case 176: { return cleanup(factory.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 176: { - return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(130))); + case 178: { + return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(131))); } - case 254: { + case 257: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -90606,13 +91693,13 @@ var ts; suppressNewDiagnosticContexts = true; return cleanup(factory.updateVariableDeclaration(input, input.name, undefined, ensureType(input, input.type), ensureNoInitializer(input))); } - case 163: { + case 165: { if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) { return cleanup(factory.updateTypeParameterDeclaration(input, input.modifiers, input.name, undefined, undefined)); } return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context)); } - case 189: { + case 191: { var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree); var extendsType = ts.visitNode(input.extendsType, visitDeclarationSubtree); var oldEnclosingDecl = enclosingDeclaration; @@ -90622,13 +91709,13 @@ var ts; var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree); return cleanup(factory.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); } - case 179: { + case 181: { return cleanup(factory.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 180: { + case 182: { return cleanup(factory.updateConstructorTypeNode(input, ensureModifiers(input), ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 200: { + case 202: { if (!ts.isLiteralImportTypeNode(input)) return cleanup(input); return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); @@ -90660,7 +91747,7 @@ var ts; } } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 169 && ts.hasEffectiveModifier(node.parent, 8); + return node.parent.kind === 171 && ts.hasEffectiveModifier(node.parent, 8); } function visitDeclarationStatements(input) { if (!isPreservedDeclarationStatement(input)) { @@ -90669,14 +91756,14 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 272: { + case 275: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } resultHasScopeMarker = true; return factory.updateExportDeclaration(input, input.modifiers, input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), ts.getResolutionModeOverrideForClause(input.assertClause) ? input.assertClause : undefined); } - case 271: { + case 274: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -90693,7 +91780,7 @@ var ts; errorFallbackNode = input; var varDecl = factory.createVariableDeclaration(newId, undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), undefined); errorFallbackNode = undefined; - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135)] : [], factory.createVariableDeclarationList([varDecl], 2)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136)] : [], factory.createVariableDeclarationList([varDecl], 2)); preserveJsDoc(statement, input); ts.removeAllComments(input); return [statement, factory.updateExportAssignment(input, input.modifiers, newId)]; @@ -90705,10 +91792,10 @@ var ts; return input; } function stripExportModifiers(statement) { - if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 512) || !ts.canHaveModifiers(statement)) { + if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 1024) || !ts.canHaveModifiers(statement)) { return statement; } - var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (257023 ^ 1)); + var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (258047 ^ 1)); return factory.updateModifiers(statement, modifiers); } function transformTopLevelDeclaration(input) { @@ -90719,10 +91806,10 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 265: { + case 268: { return transformImportEqualsDeclaration(input); } - case 266: { + case 269: { return transformImportDeclaration(input); } } @@ -90742,12 +91829,16 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 259: - return cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 258: { + case 262: { + needsDeclare = false; + var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); + needsDeclare = previousNeedsDeclare; + return clean; + } + case 261: { return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 256: { + case 259: { var clean = cleanup(factory.updateFunctionDeclaration(input, ensureModifiers(input), undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), undefined)); if (clean && resolver.isExpandoFunctionDeclaration(input) && shouldEmitFunctionProperties(input)) { var props = resolver.getPropertiesOfContainerFunction(input); @@ -90782,10 +91873,10 @@ var ts; })))); } var namespaceDecl = factory.createModuleDeclaration(ensureModifiers(input), input.name, factory.createModuleBlock(declarations), 16); - if (!ts.hasEffectiveModifier(clean, 512)) { + if (!ts.hasEffectiveModifier(clean, 1024)) { return [clean, namespaceDecl]; } - var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~513) | 2); + var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~1025) | 2); var cleanDeclaration = factory.updateFunctionDeclaration(clean, modifiers, undefined, clean.name, clean.typeParameters, clean.parameters, clean.type, undefined); var namespaceDeclaration = factory.updateModuleDeclaration(namespaceDecl, modifiers, namespaceDecl.name, namespaceDecl.body); var exportDefaultDeclaration = factory.createExportAssignment(undefined, false, namespaceDecl.name); @@ -90799,10 +91890,10 @@ var ts; return clean; } } - case 261: { + case 264: { needsDeclare = false; var inner = input.body; - if (inner && inner.kind === 262) { + if (inner && inner.kind === 265) { var oldNeedsScopeFix = needsScopeFixMarker; var oldHasScopeFix = resultHasScopeMarker; resultHasScopeMarker = false; @@ -90838,7 +91929,7 @@ var ts; return cleanup(factory.updateModuleDeclaration(input, mods, input.name, body)); } } - case 257: { + case 260: { errorNameNode = input.name; errorFallbackNode = input; var modifiers = factory.createNodeArray(ensureModifiers(input)); @@ -90890,7 +91981,7 @@ var ts; typeName: input.name }); }; var varDecl = factory.createVariableDeclaration(newId_1, undefined, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), undefined); - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135)] : [], factory.createVariableDeclarationList([varDecl], 2)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136)] : [], factory.createVariableDeclarationList([varDecl], 2)); var heritageClauses = factory.createNodeArray(ts.map(input.heritageClauses, function (clause) { if (clause.token === 94) { var oldDiag_2 = getSymbolAccessibilityDiagnostic; @@ -90908,10 +91999,10 @@ var ts; return cleanup(factory.updateClassDeclaration(input, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 237: { + case 240: { return cleanup(transformVariableStatement(input)); } - case 260: { + case 263: { return cleanup(factory.updateEnumDeclaration(input, factory.createNodeArray(ensureModifiers(input)), input.name, factory.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -90928,7 +92019,7 @@ var ts; if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - if (input.kind === 261) { + if (input.kind === 264) { needsDeclare = previousNeedsDeclare; } if (node === input) { @@ -90951,7 +92042,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 227) { + if (e.kind === 229) { return; } if (e.name) { @@ -90999,9 +92090,9 @@ var ts; return factory.createModifiersFromModifierFlags(newFlags); } function ensureModifierFlags(node) { - var mask = 257023 ^ (4 | 256 | 16384); + var mask = 258047 ^ (4 | 512 | 16384); var additions = (needsDeclare && !isAlwaysType(node)) ? 2 : 0; - var parentIsFile = node.parent.kind === 305; + var parentIsFile = node.parent.kind === 308; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= 2; additions = 0; @@ -91028,7 +92119,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 258) { + if (node.kind === 261) { return true; } return false; @@ -91037,20 +92128,20 @@ var ts; return ts.factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); } function maskModifierFlags(node, modifierMask, modifierAdditions) { - if (modifierMask === void 0) { modifierMask = 257023 ^ 4; } + if (modifierMask === void 0) { modifierMask = 258047 ^ 4; } if (modifierAdditions === void 0) { modifierAdditions = 0; } var flags = (ts.getEffectiveModifierFlags(node) & modifierMask) | modifierAdditions; - if (flags & 512 && !(flags & 1)) { + if (flags & 1024 && !(flags & 1)) { flags ^= 1; } - if (flags & 512 && flags & 2) { + if (flags & 1024 && flags & 2) { flags ^= 2; } return flags; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 172 + return accessor.kind === 174 ? accessor.type : accessor.parameters.length > 0 ? accessor.parameters[0].type @@ -91059,52 +92150,52 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 167: - case 166: + case 169: + case 168: return !ts.hasEffectiveModifier(node, 8); - case 164: - case 254: + case 166: + case 257: return true; } return false; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 256: - case 261: - case 265: - case 258: - case 257: case 259: + case 264: + case 268: + case 261: case 260: - case 237: - case 266: - case 272: - case 271: + case 262: + case 263: + case 240: + case 269: + case 275: + case 274: return true; } return false; } function isProcessedComponent(node) { switch (node.kind) { - case 175: + case 177: + case 173: case 171: + case 174: + case 175: case 169: - case 172: - case 173: - case 167: - case 166: case 168: - case 174: + case 170: case 176: - case 254: - case 163: - case 228: case 178: - case 189: - case 179: + case 257: + case 165: + case 230: case 180: - case 200: + case 191: + case 181: + case 182: + case 202: return true; } return false; @@ -91213,7 +92304,7 @@ var ts; } ts.noEmitNotification = noEmitNotification; function transformNodes(resolver, host, factory, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(355); + var enabledSyntaxKindFeatures = new Array(358); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentStatements; @@ -91289,7 +92380,7 @@ var ts; var transformed = []; for (var _a = 0, nodes_3 = nodes; _a < nodes_3.length; _a++) { var node = nodes_3[_a]; - ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit", "transformNodes", node.kind === 305 ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); + ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit", "transformNodes", node.kind === 308 ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); transformed.push((allowDtsFiles ? transformation : transformRoot)(node)); ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop(); } @@ -91617,7 +92708,7 @@ var ts; ts.getOutputPathsForBundle = getOutputPathsForBundle; function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 306) { + if (sourceFile.kind === 309) { return getOutputPathsForBundle(options, forceDtsPaths); } else { @@ -91957,8 +93048,8 @@ var ts; } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) { var sourceFileOrBundle = transform.transformed[0]; - var bundle = sourceFileOrBundle.kind === 306 ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 305 ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 309 ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 308 ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; var sourceMapGenerator; if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) { @@ -92003,7 +93094,7 @@ var ts; } function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) { return (mapOptions.sourceMap || mapOptions.inlineSourceMap) - && (sourceFileOrBundle.kind !== 305 || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json")); + && (sourceFileOrBundle.kind !== 308 || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json")); } function getSourceRoot(mapOptions) { var sourceRoot = ts.normalizeSlashes(mapOptions.sourceRoot || ""); @@ -92052,8 +93143,8 @@ var ts; return JSON.stringify(buildInfo); } ts.getBuildInfoText = getBuildInfoText; - function getBuildInfo(buildInfoText) { - return JSON.parse(buildInfoText); + function getBuildInfo(buildInfoFile, buildInfoText) { + return ts.readJsonOrUndefined(buildInfoFile, buildInfoText); } ts.getBuildInfo = getBuildInfo; ts.notImplementedResolver = { @@ -92127,17 +93218,16 @@ var ts; var _a = getOutputPathsForBundle(config.options, false), buildInfoPath = _a.buildInfoPath, jsFilePath = _a.jsFilePath, sourceMapFilePath = _a.sourceMapFilePath, declarationFilePath = _a.declarationFilePath, declarationMapPath = _a.declarationMapPath; var buildInfo; if (host.getBuildInfo) { - var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); - if (!hostBuildInfo) - return buildInfoPath; - buildInfo = hostBuildInfo; + buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); } else { var buildInfoText = host.readFile(buildInfoPath); if (!buildInfoText) return buildInfoPath; - buildInfo = getBuildInfo(buildInfoText); + buildInfo = getBuildInfo(buildInfoPath, buildInfoText); } + if (!buildInfo) + return buildInfoPath; if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts)) return buildInfoPath; var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath)); @@ -92247,6 +93337,10 @@ var ts; var nodeIdToGeneratedName; var autoGeneratedIdToGeneratedName; var generatedNames; + var formattedNameTempFlagsStack; + var formattedNameTempFlags; + var privateNameTempFlagsStack; + var privateNameTempFlags; var tempFlagsStack; var tempFlags; var reservedNamesStack; @@ -92308,9 +93402,9 @@ var ts; break; } switch (node.kind) { - case 305: return printFile(node); - case 306: return printBundle(node); - case 307: return printUnparsedSource(node); + case 308: return printFile(node); + case 309: return printBundle(node); + case 310: return printUnparsedSource(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -92499,6 +93593,10 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNames = new ts.Set(); + formattedNameTempFlagsStack = []; + formattedNameTempFlags = new ts.Map(); + privateNameTempFlagsStack = []; + privateNameTempFlags = 0; tempFlagsStack = []; tempFlags = 0; reservedNamesStack = []; @@ -92632,294 +93730,294 @@ var ts; return emitIdentifier(node); case 80: return emitPrivateIdentifier(node); - case 161: - return emitQualifiedName(node); - case 162: - return emitComputedPropertyName(node); case 163: - return emitTypeParameter(node); + return emitQualifiedName(node); case 164: - return emitParameter(node); + return emitComputedPropertyName(node); case 165: - return emitDecorator(node); + return emitTypeParameter(node); case 166: - return emitPropertySignature(node); + return emitParameter(node); case 167: - return emitPropertyDeclaration(node); + return emitDecorator(node); case 168: - return emitMethodSignature(node); + return emitPropertySignature(node); case 169: - return emitMethodDeclaration(node); + return emitPropertyDeclaration(node); case 170: - return emitClassStaticBlockDeclaration(node); + return emitMethodSignature(node); case 171: - return emitConstructor(node); + return emitMethodDeclaration(node); case 172: + return emitClassStaticBlockDeclaration(node); case 173: - return emitAccessorDeclaration(node); + return emitConstructor(node); case 174: - return emitCallSignature(node); case 175: - return emitConstructSignature(node); + return emitAccessorDeclaration(node); case 176: - return emitIndexSignature(node); + return emitCallSignature(node); case 177: - return emitTypePredicate(node); + return emitConstructSignature(node); case 178: - return emitTypeReference(node); + return emitIndexSignature(node); case 179: - return emitFunctionType(node); + return emitTypePredicate(node); case 180: - return emitConstructorType(node); + return emitTypeReference(node); case 181: - return emitTypeQuery(node); + return emitFunctionType(node); case 182: - return emitTypeLiteral(node); + return emitConstructorType(node); case 183: - return emitArrayType(node); + return emitTypeQuery(node); case 184: - return emitTupleType(node); + return emitTypeLiteral(node); case 185: - return emitOptionalType(node); + return emitArrayType(node); + case 186: + return emitTupleType(node); case 187: + return emitOptionalType(node); + case 189: return emitUnionType(node); - case 188: + case 190: return emitIntersectionType(node); - case 189: + case 191: return emitConditionalType(node); - case 190: + case 192: return emitInferType(node); - case 191: + case 193: return emitParenthesizedType(node); - case 228: + case 230: return emitExpressionWithTypeArguments(node); - case 192: + case 194: return emitThisType(); - case 193: + case 195: return emitTypeOperator(node); - case 194: + case 196: return emitIndexedAccessType(node); - case 195: + case 197: return emitMappedType(node); - case 196: + case 198: return emitLiteralType(node); - case 197: + case 199: return emitNamedTupleMember(node); - case 198: + case 200: return emitTemplateType(node); - case 199: + case 201: return emitTemplateTypeSpan(node); - case 200: + case 202: return emitImportTypeNode(node); - case 201: + case 203: return emitObjectBindingPattern(node); - case 202: + case 204: return emitArrayBindingPattern(node); - case 203: + case 205: return emitBindingElement(node); - case 233: + case 236: return emitTemplateSpan(node); - case 234: + case 237: return emitSemicolonClassElement(); - case 235: + case 238: return emitBlock(node); - case 237: + case 240: return emitVariableStatement(node); - case 236: + case 239: return emitEmptyStatement(false); - case 238: + case 241: return emitExpressionStatement(node); - case 239: + case 242: return emitIfStatement(node); - case 240: + case 243: return emitDoStatement(node); - case 241: + case 244: return emitWhileStatement(node); - case 242: + case 245: return emitForStatement(node); - case 243: + case 246: return emitForInStatement(node); - case 244: + case 247: return emitForOfStatement(node); - case 245: + case 248: return emitContinueStatement(node); - case 246: + case 249: return emitBreakStatement(node); - case 247: + case 250: return emitReturnStatement(node); - case 248: + case 251: return emitWithStatement(node); - case 249: + case 252: return emitSwitchStatement(node); - case 250: + case 253: return emitLabeledStatement(node); - case 251: + case 254: return emitThrowStatement(node); - case 252: + case 255: return emitTryStatement(node); - case 253: + case 256: return emitDebuggerStatement(node); - case 254: + case 257: return emitVariableDeclaration(node); - case 255: + case 258: return emitVariableDeclarationList(node); - case 256: + case 259: return emitFunctionDeclaration(node); - case 257: + case 260: return emitClassDeclaration(node); - case 258: + case 261: return emitInterfaceDeclaration(node); - case 259: + case 262: return emitTypeAliasDeclaration(node); - case 260: + case 263: return emitEnumDeclaration(node); - case 261: + case 264: return emitModuleDeclaration(node); - case 262: + case 265: return emitModuleBlock(node); - case 263: + case 266: return emitCaseBlock(node); - case 264: + case 267: return emitNamespaceExportDeclaration(node); - case 265: + case 268: return emitImportEqualsDeclaration(node); - case 266: + case 269: return emitImportDeclaration(node); - case 267: + case 270: return emitImportClause(node); - case 268: + case 271: return emitNamespaceImport(node); - case 274: + case 277: return emitNamespaceExport(node); - case 269: + case 272: return emitNamedImports(node); - case 270: + case 273: return emitImportSpecifier(node); - case 271: + case 274: return emitExportAssignment(node); - case 272: + case 275: return emitExportDeclaration(node); - case 273: + case 276: return emitNamedExports(node); - case 275: + case 278: return emitExportSpecifier(node); - case 293: + case 296: return emitAssertClause(node); - case 294: + case 297: return emitAssertEntry(node); - case 276: + case 279: return; - case 277: + case 280: return emitExternalModuleReference(node); case 11: return emitJsxText(node); - case 280: case 283: + case 286: return emitJsxOpeningElementOrFragment(node); - case 281: case 284: + case 287: return emitJsxClosingElementOrFragment(node); - case 285: + case 288: return emitJsxAttribute(node); - case 286: + case 289: return emitJsxAttributes(node); - case 287: + case 290: return emitJsxSpreadAttribute(node); - case 288: + case 291: return emitJsxExpression(node); - case 289: + case 292: return emitCaseClause(node); - case 290: + case 293: return emitDefaultClause(node); - case 291: + case 294: return emitHeritageClause(node); - case 292: + case 295: return emitCatchClause(node); - case 296: + case 299: return emitPropertyAssignment(node); - case 297: + case 300: return emitShorthandPropertyAssignment(node); - case 298: + case 301: return emitSpreadAssignment(node); - case 299: + case 302: return emitEnumMember(node); - case 300: + case 303: return writeUnparsedNode(node); - case 307: - case 301: + case 310: + case 304: return emitUnparsedSourceOrPrepend(node); - case 302: - case 303: + case 305: + case 306: return emitUnparsedTextLike(node); - case 304: + case 307: return emitUnparsedSyntheticReference(node); - case 305: + case 308: return emitSourceFile(node); - case 306: + case 309: return ts.Debug.fail("Bundles should be printed using printBundle"); - case 308: + case 311: return ts.Debug.fail("InputFiles should not be printed"); - case 309: + case 312: return emitJSDocTypeExpression(node); - case 310: + case 313: return emitJSDocNameReference(node); - case 312: + case 315: return writePunctuation("*"); - case 313: + case 316: return writePunctuation("?"); - case 314: + case 317: return emitJSDocNullableType(node); - case 315: + case 318: return emitJSDocNonNullableType(node); - case 316: + case 319: return emitJSDocOptionalType(node); - case 317: + case 320: return emitJSDocFunctionType(node); - case 186: - case 318: + case 188: + case 321: return emitRestOrJSDocVariadicType(node); - case 319: + case 322: return; - case 320: + case 323: return emitJSDoc(node); - case 322: + case 325: return emitJSDocTypeLiteral(node); - case 323: + case 326: return emitJSDocSignature(node); - case 327: - case 332: - case 337: - return emitJSDocSimpleTag(node); - case 328: - case 329: - return emitJSDocHeritageTag(node); case 330: + case 335: + case 340: + return emitJSDocSimpleTag(node); case 331: - return; + case 332: + return emitJSDocHeritageTag(node); case 333: case 334: - case 335: - case 336: return; + case 336: + case 337: case 338: - return emitJSDocCallbackTag(node); - case 340: - case 347: - return emitJSDocPropertyLikeTag(node); case 339: + return; case 341: - case 342: + return emitJSDocCallbackTag(node); case 343: - return emitJSDocSimpleTypedTag(node); + case 350: + return emitJSDocPropertyLikeTag(node); + case 342: case 344: - return emitJSDocTemplateTag(node); case 345: - return emitJSDocTypedefTag(node); case 346: - return emitJSDocSeeTag(node); + return emitJSDocSimpleTypedTag(node); + case 347: + return emitJSDocTemplateTag(node); + case 348: + return emitJSDocTypedefTag(node); case 349: - case 353: + return emitJSDocSeeTag(node); case 352: + case 356: + case 355: return; } if (ts.isExpression(node)) { @@ -92948,82 +94046,84 @@ var ts; return emitIdentifier(node); case 80: return emitPrivateIdentifier(node); - case 204: + case 206: return emitArrayLiteralExpression(node); - case 205: + case 207: return emitObjectLiteralExpression(node); - case 206: + case 208: return emitPropertyAccessExpression(node); - case 207: + case 209: return emitElementAccessExpression(node); - case 208: + case 210: return emitCallExpression(node); - case 209: + case 211: return emitNewExpression(node); - case 210: + case 212: return emitTaggedTemplateExpression(node); - case 211: + case 213: return emitTypeAssertionExpression(node); - case 212: + case 214: return emitParenthesizedExpression(node); - case 213: + case 215: return emitFunctionExpression(node); - case 214: + case 216: return emitArrowFunction(node); - case 215: + case 217: return emitDeleteExpression(node); - case 216: + case 218: return emitTypeOfExpression(node); - case 217: + case 219: return emitVoidExpression(node); - case 218: + case 220: return emitAwaitExpression(node); - case 219: + case 221: return emitPrefixUnaryExpression(node); - case 220: + case 222: return emitPostfixUnaryExpression(node); - case 221: + case 223: return emitBinaryExpression(node); - case 222: + case 224: return emitConditionalExpression(node); - case 223: + case 225: return emitTemplateExpression(node); - case 224: + case 226: return emitYieldExpression(node); - case 225: + case 227: return emitSpreadElement(node); - case 226: + case 228: return emitClassExpression(node); - case 227: - return; case 229: + return; + case 231: return emitAsExpression(node); - case 230: + case 232: return emitNonNullExpression(node); - case 228: + case 230: return emitExpressionWithTypeArguments(node); - case 231: + case 235: + return emitSatisfiesExpression(node); + case 233: return emitMetaProperty(node); - case 232: + case 234: return ts.Debug.fail("SyntheticExpression should never be printed."); - case 278: + case 281: return emitJsxElement(node); - case 279: - return emitJsxSelfClosingElement(node); case 282: + return emitJsxSelfClosingElement(node); + case 285: return emitJsxFragment(node); - case 348: + case 351: return ts.Debug.fail("SyntaxList should not be printed"); - case 349: + case 352: return; - case 350: + case 353: return emitPartiallyEmittedExpression(node); - case 351: + case 354: return emitCommaList(node); - case 352: - case 353: + case 355: + case 356: return; - case 354: + case 357: return ts.Debug.fail("SyntheticReferenceExpression should not be printed"); } } @@ -93071,7 +94171,7 @@ var ts; } function emitHelpers(node) { var helpersEmitted = false; - var bundle = node.kind === 306 ? node : undefined; + var bundle = node.kind === 309 ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -93145,7 +94245,7 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 302 ? + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 305 ? "text" : "internal"); } @@ -93176,7 +94276,7 @@ var ts; nonEscapingWrite("}"); } function emitTabStop(hint, node, snippet) { - ts.Debug.assert(node.kind === 236, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); + ts.Debug.assert(node.kind === 239, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); ts.Debug.assert(hint !== 5, "A tab stop cannot be attached to an embedded statement."); nonEscapingWrite("$".concat(snippet.order)); } @@ -93228,7 +94328,7 @@ var ts; emit(node.dotDotDotToken); emitNodeWithWriter(node.name, writeParameter); emit(node.questionToken); - if (node.parent && node.parent.kind === 317 && !node.name) { + if (node.parent && node.parent.kind === 320 && !node.name) { emit(node.type); } else { @@ -93285,7 +94385,7 @@ var ts; } function emitAccessorDeclaration(node) { emitDecoratorsAndModifiers(node, node.modifiers); - writeKeyword(node.kind === 172 ? "get" : "set"); + writeKeyword(node.kind === 174 ? "get" : "set"); writeSpace(); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); @@ -93455,7 +94555,7 @@ var ts; function emitTypeOperator(node) { writeTokenText(node.operator, writeKeyword); writeSpace(); - var parenthesizerRule = node.operator === 145 ? + var parenthesizerRule = node.operator === 146 ? parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : parenthesizer.parenthesizeOperandOfTypeOperator; emit(node.type, parenthesizerRule); @@ -93478,7 +94578,7 @@ var ts; } if (node.readonlyToken) { emit(node.readonlyToken); - if (node.readonlyToken.kind !== 145) { + if (node.readonlyToken.kind !== 146) { writeKeyword("readonly"); } writeSpace(); @@ -93711,7 +94811,7 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } function emitAwaitExpression(node) { - emitTokenWithComment(132, node.pos, writeKeyword, node); + emitTokenWithComment(133, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } @@ -93724,7 +94824,7 @@ var ts; } function shouldEmitWhitespaceBeforeOperand(node) { var operand = node.operand; - return operand.kind === 219 + return operand.kind === 221 && ((node.operator === 39 && (operand.operator === 39 || operand.operator === 45)) || (node.operator === 40 && (operand.operator === 40 || operand.operator === 46))); } @@ -93872,6 +94972,15 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); writeOperator("!"); } + function emitSatisfiesExpression(node) { + emitExpression(node.expression, undefined); + if (node.type) { + writeSpace(); + writeKeyword("satisfies"); + writeSpace(); + emit(node.type); + } + } function emitMetaProperty(node) { writeToken(node.keywordToken, node.pos, writePunctuation); writePunctuation("."); @@ -93919,7 +95028,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node, node.thenStatement, node.elseStatement); emitTokenWithComment(91, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 239) { + if (node.elseStatement.kind === 242) { writeSpace(); emit(node.elseStatement); } @@ -93982,7 +95091,7 @@ var ts; emitTokenWithComment(20, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(160, node.initializer.end, writeKeyword, node); + emitTokenWithComment(162, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitTokenWithComment(21, node.expression.end, writePunctuation, node); @@ -93990,7 +95099,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 255) { + if (node.kind === 258) { emit(node); } else { @@ -94027,7 +95136,7 @@ var ts; } pos = writeTokenText(token, writer, pos); if (isSimilarNode && contextNode.end !== pos) { - var isJsxExprContext = contextNode.kind === 288; + var isJsxExprContext = contextNode.kind === 291; emitTrailingCommentsOfPosition(pos, !isJsxExprContext, isJsxExprContext); } return pos; @@ -94322,7 +95431,7 @@ var ts; emitTokenWithComment(100, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - emitTokenWithComment(152, node.pos, writeKeyword, node); + emitTokenWithComment(154, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -94347,7 +95456,7 @@ var ts; if (node.importClause) { emit(node.importClause); writeSpace(); - emitTokenWithComment(156, node.importClause.end, writeKeyword, node); + emitTokenWithComment(158, node.importClause.end, writeKeyword, node); writeSpace(); } emitExpression(node.moduleSpecifier); @@ -94358,7 +95467,7 @@ var ts; } function emitImportClause(node) { if (node.isTypeOnly) { - emitTokenWithComment(152, node.pos, writeKeyword, node); + emitTokenWithComment(154, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -94371,7 +95480,7 @@ var ts; function emitNamespaceImport(node) { var asPos = emitTokenWithComment(41, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127, asPos, writeKeyword, node); + emitTokenWithComment(128, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -94397,10 +95506,11 @@ var ts; writeTrailingSemicolon(); } function emitExportDeclaration(node) { + emitModifiers(node, node.modifiers); var nextPos = emitTokenWithComment(93, node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - nextPos = emitTokenWithComment(152, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(154, nextPos, writeKeyword, node); writeSpace(); } if (node.exportClause) { @@ -94412,7 +95522,7 @@ var ts; if (node.moduleSpecifier) { writeSpace(); var fromPos = node.exportClause ? node.exportClause.end : nextPos; - emitTokenWithComment(156, fromPos, writeKeyword, node); + emitTokenWithComment(158, fromPos, writeKeyword, node); writeSpace(); emitExpression(node.moduleSpecifier); } @@ -94422,7 +95532,7 @@ var ts; writeTrailingSemicolon(); } function emitAssertClause(node) { - emitTokenWithComment(129, node.pos, writeKeyword, node); + emitTokenWithComment(130, node.pos, writeKeyword, node); writeSpace(); var elements = node.elements; emitList(node, elements, 526226); @@ -94441,9 +95551,9 @@ var ts; function emitNamespaceExportDeclaration(node) { var nextPos = emitTokenWithComment(93, node.pos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(127, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(128, nextPos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(142, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(143, nextPos, writeKeyword, node); writeSpace(); emit(node.name); writeTrailingSemicolon(); @@ -94451,7 +95561,7 @@ var ts; function emitNamespaceExport(node) { var asPos = emitTokenWithComment(41, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127, asPos, writeKeyword, node); + emitTokenWithComment(128, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -94474,7 +95584,7 @@ var ts; if (node.propertyName) { emit(node.propertyName); writeSpace(); - emitTokenWithComment(127, node.propertyName.end, writeKeyword, node); + emitTokenWithComment(128, node.propertyName.end, writeKeyword, node); writeSpace(); } emit(node.name); @@ -94668,7 +95778,7 @@ var ts; } } if (node.tags) { - if (node.tags.length === 1 && node.tags[0].kind === 343 && !node.comment) { + if (node.tags.length === 1 && node.tags[0].kind === 346 && !node.comment) { writeSpace(); emit(node.tags[0]); } @@ -94713,7 +95823,7 @@ var ts; function emitJSDocTypedefTag(tag) { emitJSDocTagName(tag.tagName); if (tag.typeExpression) { - if (tag.typeExpression.kind === 309) { + if (tag.typeExpression.kind === 312) { emitJSDocTypeExpression(tag.typeExpression); } else { @@ -94732,7 +95842,7 @@ var ts; emit(tag.fullName); } emitJSDocComment(tag.comment); - if (tag.typeExpression && tag.typeExpression.kind === 322) { + if (tag.typeExpression && tag.typeExpression.kind === 325) { emitJSDocTypeLiteral(tag.typeExpression); } } @@ -95569,13 +96679,13 @@ var ts; && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile)); } function skipSynthesizedParentheses(node) { - while (node.kind === 212 && ts.nodeIsSynthesized(node)) { + while (node.kind === 214 && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; } function getTextOfNode(node, includeTrivia) { - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.isGeneratedPrivateIdentifier(node)) { return generateName(node); } if (ts.isStringLiteral(node) && node.textSourceNode) { @@ -95599,7 +96709,7 @@ var ts; function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) { if (node.kind === 10 && node.textSourceNode) { var textSourceNode = node.textSourceNode; - if (ts.isIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { + if (ts.isIdentifier(textSourceNode) || ts.isPrivateIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { var text = ts.isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode); return jsxAttributeEscape ? "\"".concat(ts.escapeJsxAttributeString(text), "\"") : neverAsciiEscape || (ts.getEmitFlags(node) & 16777216) ? "\"".concat(ts.escapeString(text), "\"") : @@ -95621,6 +96731,10 @@ var ts; } tempFlagsStack.push(tempFlags); tempFlags = 0; + privateNameTempFlagsStack.push(privateNameTempFlags); + privateNameTempFlags = 0; + formattedNameTempFlagsStack.push(formattedNameTempFlags); + formattedNameTempFlags = undefined; reservedNamesStack.push(reservedNames); } function popNameGenerationScope(node) { @@ -95628,6 +96742,8 @@ var ts; return; } tempFlags = tempFlagsStack.pop(); + privateNameTempFlags = privateNameTempFlagsStack.pop(); + formattedNameTempFlags = formattedNameTempFlagsStack.pop(); reservedNames = reservedNamesStack.pop(); } function reserveNameInNestedScopes(name) { @@ -95640,84 +96756,84 @@ var ts; if (!node) return; switch (node.kind) { - case 235: + case 238: ts.forEach(node.statements, generateNames); break; - case 250: - case 248: - case 240: - case 241: + case 253: + case 251: + case 243: + case 244: generateNames(node.statement); break; - case 239: + case 242: generateNames(node.thenStatement); generateNames(node.elseStatement); break; - case 242: - case 244: - case 243: + case 245: + case 247: + case 246: generateNames(node.initializer); generateNames(node.statement); break; - case 249: + case 252: generateNames(node.caseBlock); break; - case 263: + case 266: ts.forEach(node.clauses, generateNames); break; - case 289: - case 290: + case 292: + case 293: ts.forEach(node.statements, generateNames); break; - case 252: + case 255: generateNames(node.tryBlock); generateNames(node.catchClause); generateNames(node.finallyBlock); break; - case 292: + case 295: generateNames(node.variableDeclaration); generateNames(node.block); break; - case 237: + case 240: generateNames(node.declarationList); break; - case 255: + case 258: ts.forEach(node.declarations, generateNames); break; - case 254: - case 164: - case 203: case 257: + case 166: + case 205: + case 260: generateNameIfNeeded(node.name); break; - case 256: + case 259: generateNameIfNeeded(node.name); if (ts.getEmitFlags(node) & 524288) { ts.forEach(node.parameters, generateNames); generateNames(node.body); } break; - case 201: - case 202: + case 203: + case 204: ts.forEach(node.elements, generateNames); break; - case 266: + case 269: generateNames(node.importClause); break; - case 267: + case 270: generateNameIfNeeded(node.name); generateNames(node.namedBindings); break; - case 268: + case 271: generateNameIfNeeded(node.name); break; - case 274: + case 277: generateNameIfNeeded(node.name); break; - case 269: + case 272: ts.forEach(node.elements, generateNames); break; - case 270: + case 273: generateNameIfNeeded(node.propertyName || node.name); break; } @@ -95726,19 +96842,19 @@ var ts; if (!node) return; switch (node.kind) { - case 296: - case 297: - case 167: + case 299: + case 300: case 169: - case 172: - case 173: + case 171: + case 174: + case 175: generateNameIfNeeded(node.name); break; } } function generateNameIfNeeded(name) { if (name) { - if (ts.isGeneratedIdentifier(name)) { + if (ts.isGeneratedIdentifier(name) || ts.isGeneratedPrivateIdentifier(name)) { generateName(name); } else if (ts.isBindingPattern(name)) { @@ -95748,16 +96864,16 @@ var ts; } function generateName(name) { if ((name.autoGenerateFlags & 7) === 4) { - return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags); + return generateNameCached(ts.getNodeForGeneratedName(name), ts.isPrivateIdentifier(name), name.autoGenerateFlags, name.autoGeneratePrefix, name.autoGenerateSuffix); } else { var autoGenerateId = name.autoGenerateId; return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name)); } } - function generateNameCached(node, flags) { + function generateNameCached(node, privateName, flags, prefix, suffix) { var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags)); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags !== null && flags !== void 0 ? flags : 0, ts.formatGeneratedNamePart(prefix, generateName), ts.formatGeneratedNamePart(suffix))); } function isUniqueName(name) { return isFileLevelUniqueName(name) @@ -95778,15 +96894,47 @@ var ts; } return true; } - function makeTempVariableName(flags, reservedInNestedScopes) { + function getTempFlags(formattedNameKey) { + var _a; + switch (formattedNameKey) { + case "": + return tempFlags; + case "#": + return privateNameTempFlags; + default: + return (_a = formattedNameTempFlags === null || formattedNameTempFlags === void 0 ? void 0 : formattedNameTempFlags.get(formattedNameKey)) !== null && _a !== void 0 ? _a : 0; + } + } + function setTempFlags(formattedNameKey, flags) { + switch (formattedNameKey) { + case "": + tempFlags = flags; + break; + case "#": + privateNameTempFlags = flags; + break; + default: + formattedNameTempFlags !== null && formattedNameTempFlags !== void 0 ? formattedNameTempFlags : (formattedNameTempFlags = new ts.Map()); + formattedNameTempFlags.set(formattedNameKey, flags); + break; + } + } + function makeTempVariableName(flags, reservedInNestedScopes, privateName, prefix, suffix) { + if (prefix.length > 0 && prefix.charCodeAt(0) === 35) { + prefix = prefix.slice(1); + } + var key = ts.formatGeneratedName(privateName, prefix, "", suffix); + var tempFlags = getTempFlags(key); if (flags && !(tempFlags & flags)) { var name = flags === 268435456 ? "_i" : "_n"; - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { tempFlags |= flags; if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } while (true) { @@ -95796,26 +96944,35 @@ var ts; var name = count < 26 ? "_" + String.fromCharCode(97 + count) : "_" + (count - 26); - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } } } - function makeUniqueName(baseName, checkFn, optimistic, scoped) { + function makeUniqueName(baseName, checkFn, optimistic, scoped, privateName, prefix, suffix) { if (checkFn === void 0) { checkFn = isUniqueName; } + if (baseName.length > 0 && baseName.charCodeAt(0) === 35) { + baseName = baseName.slice(1); + } + if (prefix.length > 0 && prefix.charCodeAt(0) === 35) { + prefix = prefix.slice(1); + } if (optimistic) { - if (checkFn(baseName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(baseName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(baseName); + generatedNames.add(fullName); } - return baseName; + return fullName; } } if (baseName.charCodeAt(baseName.length - 1) !== 95) { @@ -95823,95 +96980,88 @@ var ts; } var i = 1; while (true) { - var generatedName = baseName + i; - if (checkFn(generatedName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName + i, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(generatedName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(generatedName); + generatedNames.add(fullName); } - return generatedName; + return fullName; } i++; } } function makeFileLevelOptimisticUniqueName(name) { - return makeUniqueName(name, isFileLevelUniqueName, true); + return makeUniqueName(name, isFileLevelUniqueName, true, false, false, "", ""); } function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + return isUniqueLocalName(name, node) ? name : makeUniqueName(name, isUniqueName, false, false, false, "", ""); } function generateNameForImportOrExportDeclaration(node) { var expr = ts.getExternalModuleName(node); var baseName = ts.isStringLiteral(expr) ? ts.makeIdentifierFromModuleName(expr.text) : "module"; - return makeUniqueName(baseName); + return makeUniqueName(baseName, isUniqueName, false, false, false, "", ""); } function generateNameForExportDefault() { - return makeUniqueName("default"); + return makeUniqueName("default", isUniqueName, false, false, false, "", ""); } function generateNameForClassExpression() { - return makeUniqueName("class"); + return makeUniqueName("class", isUniqueName, false, false, false, "", ""); } - function generateNameForMethodOrAccessor(node) { + function generateNameForMethodOrAccessor(node, privateName, prefix, suffix) { if (ts.isIdentifier(node.name)) { - return generateNameCached(node.name); + return generateNameCached(node.name, privateName); } - return makeTempVariableName(0); + return makeTempVariableName(0, false, privateName, prefix, suffix); } - function generateNameForNode(node, flags) { + function generateNameForNode(node, privateName, flags, prefix, suffix) { switch (node.kind) { case 79: - return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16), !!(flags & 8)); - case 261: - case 260: + case 80: + return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16), !!(flags & 8), privateName, prefix, suffix); + case 264: + case 263: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForModuleOrEnum(node); - case 266: - case 272: + case 269: + case 275: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForImportOrExportDeclaration(node); - case 256: - case 257: - case 271: + case 259: + case 260: + case 274: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForExportDefault(); - case 226: + case 228: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForClassExpression(); - case 169: - case 172: - case 173: - return generateNameForMethodOrAccessor(node); - case 162: - return makeTempVariableName(0, true); + case 171: + case 174: + case 175: + return generateNameForMethodOrAccessor(node, privateName, prefix, suffix); + case 164: + return makeTempVariableName(0, true, privateName, prefix, suffix); default: - return makeTempVariableName(0); + return makeTempVariableName(0, false, privateName, prefix, suffix); } } function makeName(name) { + var prefix = ts.formatGeneratedNamePart(name.autoGeneratePrefix, generateName); + var suffix = ts.formatGeneratedNamePart(name.autoGenerateSuffix); switch (name.autoGenerateFlags & 7) { case 1: - return makeTempVariableName(0, !!(name.autoGenerateFlags & 8)); + return makeTempVariableName(0, !!(name.autoGenerateFlags & 8), ts.isPrivateIdentifier(name), prefix, suffix); case 2: - return makeTempVariableName(268435456, !!(name.autoGenerateFlags & 8)); + ts.Debug.assertNode(name, ts.isIdentifier); + return makeTempVariableName(268435456, !!(name.autoGenerateFlags & 8), false, prefix, suffix); case 3: - return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16), !!(name.autoGenerateFlags & 8)); - } - return ts.Debug.fail("Unsupported GeneratedIdentifierKind."); - } - function getNodeForGeneratedName(name) { - var autoGenerateId = name.autoGenerateId; - var node = name; - var original = node.original; - while (original) { - node = original; - if (ts.isIdentifier(node) - && !!(node.autoGenerateFlags & 4) - && node.autoGenerateId !== autoGenerateId) { - break; - } - original = node.original; + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16), !!(name.autoGenerateFlags & 8), ts.isPrivateIdentifier(name), prefix, suffix); } - return node; + return ts.Debug.fail("Unsupported GeneratedIdentifierKind: ".concat(ts.Debug.formatEnum(name.autoGenerateFlags & 7, ts.GeneratedIdentifierFlags, true), ".")); } function pipelineEmitWithComments(hint, node) { var pipelinePhase = getNextPipelinePhase(2, hint, node); @@ -95949,14 +97099,14 @@ var ts; var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0 || node.kind === 11; if ((pos > 0 || end > 0) && pos !== end) { if (!skipLeadingComments) { - emitLeadingComments(pos, node.kind !== 349); + emitLeadingComments(pos, node.kind !== 352); } if (!skipLeadingComments || (pos >= 0 && (emitFlags & 512) !== 0)) { containerPos = pos; } if (!skipTrailingComments || (end >= 0 && (emitFlags & 1024) !== 0)) { containerEnd = end; - if (node.kind === 255) { + if (node.kind === 258) { declarationListContainerEnd = end; } } @@ -95972,7 +97122,7 @@ var ts; containerPos = savedContainerPos; containerEnd = savedContainerEnd; declarationListContainerEnd = savedDeclarationListContainerEnd; - if (!skipTrailingComments && node.kind !== 349) { + if (!skipTrailingComments && node.kind !== 352) { emitTrailingComments(end); } } @@ -96229,7 +97379,7 @@ var ts; } else { var source = sourceMapRange.source || sourceMapSource; - if (node.kind !== 349 + if (node.kind !== 352 && (emitFlags & 16) === 0 && sourceMapRange.pos >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos)); @@ -96246,7 +97396,7 @@ var ts; if (emitFlags & 64) { sourceMapsDisabled = false; } - if (node.kind !== 349 + if (node.kind !== 352 && (emitFlags & 32) === 0 && sourceMapRange.end >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end); @@ -96381,7 +97531,15 @@ var ts; return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath)); } function getCachedFileSystemEntriesForBaseDir(path) { - return getCachedFileSystemEntries(ts.getDirectoryPath(path)); + var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path)); + if (!entries) { + return entries; + } + if (!entries.sortedAndCanonicalizedFiles) { + entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort(); + entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort(); + } + return entries; } function getBaseNameOfFileName(fileName) { return ts.getBaseFileName(ts.normalizePath(fileName)); @@ -96416,21 +97574,9 @@ var ts; return undefined; } } - function fileNameEqual(name1, name2) { - return getCanonicalFileName(name1) === getCanonicalFileName(name2); - } function hasEntry(entries, name) { - return ts.some(entries, function (file) { return fileNameEqual(file, name); }); - } - function updateFileSystemEntry(entries, baseName, isValid) { - if (hasEntry(entries, baseName)) { - if (!isValid) { - return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); }); - } - } - else if (isValid) { - return entries.push(baseName); - } + var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive); + return index >= 0; } function writeFile(fileName, data, writeByteOrderMark) { var path = toPath(fileName); @@ -96443,7 +97589,7 @@ var ts; function fileExists(fileName) { var path = toPath(fileName); var result = getCachedFileSystemEntriesForBaseDir(path); - return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) || + return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) || host.fileExists(fileName); } function directoryExists(dirPath) { @@ -96453,9 +97599,13 @@ var ts; function createDirectory(dirPath) { var path = toPath(dirPath); var result = getCachedFileSystemEntriesForBaseDir(path); - var baseFileName = getBaseNameOfFileName(dirPath); if (result) { - updateFileSystemEntry(result.directories, baseFileName, true); + var baseName = getBaseNameOfFileName(dirPath); + var canonicalizedBaseName = getCanonicalFileName(baseName); + var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories; + if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + result.directories.push(baseName); + } } host.createDirectory(dirPath); } @@ -96519,7 +97669,7 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) { clearCache(); } else { @@ -96537,7 +97687,21 @@ var ts; } } function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) { - updateFileSystemEntry(parentResult.files, baseName, fileExists); + var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles; + var canonicalizedBaseName = getCanonicalFileName(baseName); + if (fileExists) { + if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + parentResult.files.push(baseName); + } + } + else { + var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive); + if (sortedIndex >= 0) { + canonicalizedFiles.splice(sortedIndex, 1); + var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; }); + parentResult.files.splice(unsortedIndex, 1); + } + } } function clearCache() { cachedReadDirectoryResult.clear(); @@ -96960,14 +98124,16 @@ var ts; } return setReadFileCache(key, fileName); }; - var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersion, onError, shouldCreateNewSourceFile) { + var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) { var key = toPath(fileName); - var value = sourceFileCache.get(key); + var impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : undefined; + var forImpliedNodeFormat = sourceFileCache.get(impliedNodeFormat); + var value = forImpliedNodeFormat === null || forImpliedNodeFormat === void 0 ? void 0 : forImpliedNodeFormat.get(key); if (value) return value; - var sourceFile = getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile); + var sourceFile = getSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile); if (sourceFile && (ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json"))) { - sourceFileCache.set(key, sourceFile); + sourceFileCache.set(impliedNodeFormat, (forImpliedNodeFormat || new ts.Map()).set(key, sourceFile)); } return sourceFile; } : undefined; @@ -96991,13 +98157,15 @@ var ts; var value = readFileCache.get(key); if (value !== undefined && value !== data) { readFileCache.delete(key); - sourceFileCache.delete(key); + sourceFileCache.forEach(function (map) { return map.delete(key); }); } else if (getSourceFileWithCache) { - var sourceFile = sourceFileCache.get(key); - if (sourceFile && sourceFile.text !== data) { - sourceFileCache.delete(key); - } + sourceFileCache.forEach(function (map) { + var sourceFile = map.get(key); + if (sourceFile && sourceFile.text !== data) { + map.delete(key); + } + }); } originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false)); }; @@ -97226,7 +98394,6 @@ var ts; return resolutions; } ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache; - ; function getModeForFileReference(ref, containingFileMode) { return (ts.isString(ref) ? containingFileMode : ref.resolutionMode) || containingFileMode; } @@ -97394,7 +98561,7 @@ var ts; return { file: file, pos: pos, end: end, packageId: packageId }; } ts.getReferencedFileLocation = getReferencedFileLocation; - function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { + function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames())) return false; if (!ts.arrayIsEqualTo(program.getRootFileNames(), rootFileNames)) @@ -97414,7 +98581,7 @@ var ts; return true; function sourceFileNotUptoDate(sourceFile) { return !sourceFileVersionUptoDate(sourceFile) || - hasInvalidatedResolution(sourceFile.path); + hasInvalidatedResolutions(sourceFile.path); } function sourceFileVersionUptoDate(sourceFile) { return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName); @@ -97622,7 +98789,7 @@ var ts; var moduleResolutionCache; var typeReferenceDirectiveResolutionCache; var actualResolveModuleNamesWorker; - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; if (host.resolveModuleNames) { actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) { if (!resolved || resolved.extension !== undefined) { @@ -97997,7 +99164,7 @@ var ts; var predictedToResolveToAmbientModuleMarker = {}; for (var i = 0; i < moduleNames.length; i++) { var moduleName = moduleNames[i]; - if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) { + if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) { var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i)); if (oldResolvedModule) { if (ts.isTraceEnabled(options, host)) { @@ -98182,7 +99349,7 @@ var ts; } modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); } - else if (hasInvalidatedResolution(oldSourceFile.path)) { + else if (hasInvalidatedResolutions(oldSourceFile.path)) { structureIsReused = 1; modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); } @@ -98521,86 +99688,89 @@ var ts; return diagnostics; function walk(node, parent) { switch (parent.kind) { - case 164: - case 167: + case 166: case 169: + case 171: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); return "skip"; } - case 168: - case 171: - case 172: + case 170: case 173: - case 213: - case 256: - case 214: - case 254: + case 174: + case 175: + case 215: + case 259: + case 216: + case 257: if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); return "skip"; } } switch (node.kind) { - case 267: + case 270: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type")); return "skip"; } break; - case 272: + case 275: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type")); return "skip"; } break; - case 270: - case 275: + case 273: + case 278: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, ts.isImportSpecifier(node) ? "import...type" : "export...type")); return "skip"; } break; - case 265: + case 268: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_TypeScript_files)); return "skip"; - case 271: + case 274: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 291: + case 294: var heritageClause = node; if (heritageClause.token === 117) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 258: + case 261: var interfaceKeyword = ts.tokenToString(118); ts.Debug.assertIsDefined(interfaceKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword)); return "skip"; - case 261: - var moduleKeyword = node.flags & 16 ? ts.tokenToString(142) : ts.tokenToString(141); + case 264: + var moduleKeyword = node.flags & 16 ? ts.tokenToString(143) : ts.tokenToString(142); ts.Debug.assertIsDefined(moduleKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); return "skip"; - case 259: + case 262: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); return "skip"; - case 260: + case 263: var enumKeyword = ts.Debug.checkDefined(ts.tokenToString(92)); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); return "skip"; - case 230: + case 232: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 229: + case 231: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 211: + case 235: + diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 213: ts.Debug.fail(); } } @@ -98609,48 +99779,50 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)); } switch (parent.kind) { - case 257: - case 226: - case 169: + case 260: + case 228: case 171: - case 172: case 173: - case 213: - case 256: - case 214: + case 174: + case 175: + case 215: + case 259: + case 216: if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); return "skip"; } - case 237: + case 240: if (nodes === parent.modifiers) { - checkModifiers(parent.modifiers, parent.kind === 237); + checkModifiers(parent.modifiers, parent.kind === 240); return "skip"; } break; - case 167: + case 169: if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; - if (ts.isModifier(modifier) && modifier.kind !== 124) { + if (ts.isModifier(modifier) + && modifier.kind !== 124 + && modifier.kind !== 127) { diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); } } return "skip"; } break; - case 164: + case 166: if (nodes === parent.modifiers && ts.some(nodes, ts.isModifier)) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 208: - case 209: - case 228: - case 279: - case 280: case 210: + case 211: + case 230: + case 282: + case 283: + case 212: if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); return "skip"; @@ -98669,17 +99841,18 @@ var ts; case 123: case 121: case 122: - case 145: - case 135: + case 146: + case 136: case 126: - case 159: + case 161: case 101: - case 144: + case 145: diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); break; case 124: case 93: case 88: + case 127: } } } @@ -99510,10 +100683,12 @@ var ts; if (options.preserveConstEnums === false) { createDiagnosticForOptionName(ts.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled, "preserveConstEnums", "isolatedModules"); } - var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6; }); - if (firstNonExternalModuleSourceFile) { - var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(firstNonExternalModuleSourceFile.fileName))); + for (var _a = 0, files_5 = files; _a < files_5.length; _a++) { + var file = files_5[_a]; + if (!ts.isExternalModule(file) && !ts.isSourceFileJS(file) && !file.isDeclarationFile && file.scriptKind !== 6) { + var span = ts.getErrorSpanForNode(file, file); + programDiagnostics.add(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(file.fileName))); + } } } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 && options.module === ts.ModuleKind.None) { @@ -100606,7 +101781,7 @@ var ts; var canCopyEmitSignatures = compilerOptions.composite && (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) && !outFilePath && - !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions); + !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions); if (useOldState) { (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); }); if (!outFilePath && oldState.affectedFilesPendingEmit) { @@ -101628,7 +102803,7 @@ var ts; var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47; if (isNonDirectorySeparatorRoot && dirPath.search(/[a-zA-Z]:/) !== 0 && - pathPartForUserCheck.search(/[a-zA-z]\$\//) === 0) { + pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) { nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, nextDirectorySeparator + 1); if (nextDirectorySeparator === -1) { return false; @@ -101695,7 +102870,7 @@ var ts; invalidateResolutionOfFile: invalidateResolutionOfFile, invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations, setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports, - createHasInvalidatedResolution: createHasInvalidatedResolution, + createHasInvalidatedResolutions: createHasInvalidatedResolutions, isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports, updateTypeRootsWatch: updateTypeRootsWatch, closeTypeRootsWatch: closeTypeRootsWatch, @@ -101749,15 +102924,12 @@ var ts; var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path); return !!value && !!value.length; } - function createHasInvalidatedResolution(forceAllFilesAsInvalidated) { + function createHasInvalidatedResolutions(customHasInvalidatedResolutions) { invalidateResolutionsOfFailedLookupLocations(); - if (forceAllFilesAsInvalidated) { - filesWithInvalidatedResolutions = undefined; - return ts.returnTrue; - } var collected = filesWithInvalidatedResolutions; filesWithInvalidatedResolutions = undefined; - return function (path) { return (!!collected && collected.has(path)) || + return function (path) { return customHasInvalidatedResolutions(path) || + !!(collected === null || collected === void 0 ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path); }; } function startCachingPerDirectoryResolution() { @@ -102908,15 +104080,21 @@ var ts; return undefined; } function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) { - var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); - if (normalizedTargetPath === undefined) { + var normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); + if (normalizedTargetPaths === undefined) { + return undefined; + } + var normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); + var relativePaths = ts.flatMap(normalizedSourcePaths, function (sourcePath) { + return ts.map(normalizedTargetPaths, function (targetPath) { return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)); }); + }); + var shortest = ts.min(relativePaths, ts.compareNumberOfDirectorySeparators); + if (!shortest) { return undefined; } - var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); - var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath; return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs - ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions) - : ts.removeFileExtension(relativePath); + ? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions) + : ts.removeFileExtension(shortest); } function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) { var path = _a.path, isRedirect = _a.isRedirect; @@ -103036,8 +104214,8 @@ var ts; } } } - function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) { - return ts.firstDefined(rootDirs, function (rootDir) { + function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) { + return ts.mapDefined(rootDirs, function (rootDir) { var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName); return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath; }); @@ -103691,18 +104869,14 @@ var ts; var buildInfo; if (host.getBuildInfo) { buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath); - if (!buildInfo) - return undefined; } else { var content = host.readFile(buildInfoPath); if (!content) return undefined; - buildInfo = ts.getBuildInfo(content); + buildInfo = ts.getBuildInfo(buildInfoPath, content); } - if (buildInfo.version !== ts.version) - return undefined; - if (!buildInfo.program) + if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program) return undefined; return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host); } @@ -103851,6 +105025,9 @@ var ts; ts.maybeBind(host, host.getModuleResolutionCache) : (function () { return resolutionCache.getModuleResolutionCache(); }); var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; + var customHasInvalidatedResolutions = userProvidedResolution ? + ts.maybeBind(host, host.hasInvalidatedResolutions) || ts.returnTrue : + ts.returnFalse; builderProgram = readBuilderProgram(compilerOptions, compilerHost); synchronizeProgram(); watchConfigFileWildCardDirectories(); @@ -103914,8 +105091,9 @@ var ts; resolutionCache.clear(); } } - var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + var hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions); + var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile; + if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { if (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -103928,15 +105106,20 @@ var ts; if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); } - createNewProgram(hasInvalidatedResolution); + createNewProgram(hasInvalidatedResolutions); } reportFileChangeDetectedOnCreateProgram = false; if (host.afterProgramCreate && program !== builderProgram) { host.afterProgramCreate(builderProgram); } + compilerHost.readFile = originalReadFile; + compilerHost.fileExists = originalFileExists; + compilerHost.directoryExists = originalDirectoryExists; + compilerHost.createDirectory = originalCreateDirectory; + compilerHost.writeFile = originalWriteFile; return builderProgram; } - function createNewProgram(hasInvalidatedResolution) { + function createNewProgram(hasInvalidatedResolutions) { writeLog("CreatingProgramWith::"); writeLog(" roots: ".concat(JSON.stringify(rootFileNames))); writeLog(" options: ".concat(JSON.stringify(compilerOptions))); @@ -103946,7 +105129,7 @@ var ts; hasChangedCompilerOptions = false; hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); - compilerHost.hasInvalidatedResolution = hasInvalidatedResolution; + compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; var oldProgram = getCurrentProgram(); builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences); @@ -104353,16 +105536,17 @@ var ts; UpToDateStatusType[UpToDateStatusType["UpToDateWithUpstreamTypes"] = 2] = "UpToDateWithUpstreamTypes"; UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend"; UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream"; - UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo"; - UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate"; - UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked"; - UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream"; - UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate"; - UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText"; - UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly"; - UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild"; + UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream"; + UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo"; + UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate"; + UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked"; + UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream"; + UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate"; + UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText"; + UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly"; + UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild"; })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {})); function resolveConfigFileProjectName(project) { if (ts.fileExtensionIs(project, ".json")) { @@ -104562,6 +105746,7 @@ var ts; if (value) { return isParsedCommandLine(value) ? value : undefined; } + ts.performance.mark("SolutionBuilder::beforeConfigFileParsing"); var diagnostic; var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host; var parsed; @@ -104576,6 +105761,8 @@ var ts; parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop; } configFileCache.set(configFilePath, parsed || diagnostic); + ts.performance.mark("SolutionBuilder::afterConfigFileParsing"); + ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing"); return parsed; } function resolveProjectName(state, name) { @@ -104768,6 +105955,7 @@ var ts; if (updateOutputFileStampsPending) { updateOutputTimestamps(state, config, projectPath); } + ts.performance.mark("SolutionBuilder::Timestamps only updates"); return doneInvalidatedProject(state, projectPath); } }; @@ -104861,6 +106049,10 @@ var ts; }; function done(cancellationToken, writeFile, customTransformers) { executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers); + if (kind === InvalidatedProjectKind.Build) + ts.performance.mark("SolutionBuilder::Projects built"); + else + ts.performance.mark("SolutionBuilder::Bundles updated"); return doneInvalidatedProject(state, projectPath); } function withProgramOrUndefined(action) { @@ -105027,13 +106219,13 @@ var ts; var emitterDiagnostics = ts.createDiagnosticCollection(); var emittedOutputs = new ts.Map(); var resultFlags = BuildResultFlags.DeclarationOutputUnchanged; - var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo; + var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined; outputFiles.forEach(function (_a) { var _b, _c; var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo; emittedOutputs.set(toPath(state, name), name); if (buildInfo) { - if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { + if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; } setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags); @@ -105316,8 +106508,7 @@ var ts; return existing.buildInfo || undefined; } var value = state.readFileWithCache(buildInfoPath); - var buildInfo = value ? ts.getBuildInfo(value) : undefined; - ts.Debug.assert(modifiedTime || !buildInfo); + var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined; state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime }); return buildInfo; } @@ -105395,7 +106586,13 @@ var ts; missingOutputFileName: buildInfoPath }; } - var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime)); + var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime); + if (!buildInfo) { + return { + type: ts.UpToDateStatusType.ErrorReadingFile, + fileName: buildInfoPath + }; + } if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) { return { type: ts.UpToDateStatusType.TsVersionOutputOfDate, @@ -105404,7 +106601,9 @@ var ts; } if (buildInfo.program) { if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) || - (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) { + (!project.options.noEmit ? + (_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length : + ts.some(buildInfo.program.semanticDiagnosticsPerFile, ts.isArray))) { return { type: ts.UpToDateStatusType.OutOfDateBuildInfo, buildInfoFile: buildInfoPath @@ -105556,7 +106755,10 @@ var ts; if (prior !== undefined) { return prior; } + ts.performance.mark("SolutionBuilder::beforeUpToDateCheck"); var actual = getUpToDateStatusWorker(state, project, resolvedPath); + ts.performance.mark("SolutionBuilder::afterUpToDateCheck"); + ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck"); state.projectStatus.set(resolvedPath, actual); return actual; } @@ -105683,6 +106885,13 @@ var ts; } } function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + return result; + } + function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -105710,6 +106919,13 @@ var ts; : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } function clean(state, project, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeClean"); + var result = cleanWorker(state, project, onlyReferences); + ts.performance.mark("SolutionBuilder::afterClean"); + ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean"); + return result; + } + function cleanWorker(state, project, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -105780,6 +106996,14 @@ var ts; state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected); } function buildNextInvalidatedProject(state, changeDetected) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + if (buildOrder) + reportErrorSummary(state, buildOrder); + } + function buildNextInvalidatedProjectWorker(state, changeDetected) { state.timerToBuildInvalidatedProject = undefined; if (state.reportFileChangeDetected) { state.reportFileChangeDetected = false; @@ -105809,7 +107033,7 @@ var ts; } } disableCache(state); - reportErrorSummary(state, buildOrder); + return buildOrder; } function watchConfigFile(state, resolved, resolvedPath, parsed) { if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath)) @@ -105864,6 +107088,7 @@ var ts; function startWatching(state, buildOrder) { if (!state.watchAllProjectsPending) return; + ts.performance.mark("SolutionBuilder::beforeWatcherCreation"); state.watchAllProjectsPending = false; for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) { var resolved = _a[_i]; @@ -105877,6 +107102,8 @@ var ts; watchPackageJsonFiles(state, resolved, resolvedPath, cfg); } } + ts.performance.mark("SolutionBuilder::afterWatcherCreation"); + ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation"); } function stopWatching(state) { ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher); @@ -105986,6 +107213,8 @@ var ts; return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName)); case ts.UpToDateStatusType.OutputMissing: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName)); + case ts.UpToDateStatusType.ErrorReadingFile: + return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName)); case ts.UpToDateStatusType.OutOfDateBuildInfo: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile)); case ts.UpToDateStatusType.UpToDate: @@ -106026,6 +107255,12 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var StatisticType; + (function (StatisticType) { + StatisticType[StatisticType["time"] = 0] = "time"; + StatisticType[StatisticType["count"] = 1] = "count"; + StatisticType[StatisticType["memory"] = 2] = "memory"; + })(StatisticType = ts.StatisticType || (ts.StatisticType = {})); function countLines(program) { var counts = getCountsMap(); ts.forEach(program.getSourceFiles(), function (file) { @@ -106035,14 +107270,6 @@ var ts; }); return counts; } - function countNodes(program) { - var counts = getCountsMap(); - ts.forEach(program.getSourceFiles(), function (file) { - var key = getCountKey(program, file); - counts.set(key, counts.get(key) + file.nodeCount); - }); - return counts; - } function getCountsMap() { var counts = new ts.Map(); counts.set("Library", 0); @@ -106389,7 +107616,6 @@ var ts; var colors = createColors(sys); var header = []; var terminalWidth = (_b = (_a = sys.getWidthOfTerminal) === null || _a === void 0 ? void 0 : _a.call(sys)) !== null && _b !== void 0 ? _b : 0; - ; var tsIconLength = 5; var tsIconFirstLine = colors.blueBackground(ts.padLeft("", tsIconLength)); var tsIconSecondLine = colors.blueBackground(colors.brightWhite(ts.padLeft("TS ", tsIconLength))); @@ -106586,15 +107812,26 @@ var ts; if (reportWatchModeWithoutSysSupport(sys, reportDiagnostic)) return; var buildHost_1 = ts.createSolutionBuilderWithWatchHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createWatchStatusReporter(sys, buildOptions)); - updateSolutionBuilderHost(sys, cb, buildHost_1); + var solutionPerformance_1 = enableSolutionPerformance(sys, buildOptions); + updateSolutionBuilderHost(sys, cb, buildHost_1, solutionPerformance_1); + var onWatchStatusChange_1 = buildHost_1.onWatchStatusChange; + buildHost_1.onWatchStatusChange = function (d, newLine, options, errorCount) { + onWatchStatusChange_1 === null || onWatchStatusChange_1 === void 0 ? void 0 : onWatchStatusChange_1(d, newLine, options, errorCount); + if (d.code === ts.Diagnostics.Found_0_errors_Watching_for_file_changes.code || + d.code === ts.Diagnostics.Found_1_error_Watching_for_file_changes.code) { + reportSolutionBuilderTimes(builder_1, solutionPerformance_1); + } + }; var builder_1 = ts.createSolutionBuilderWithWatch(buildHost_1, projects, buildOptions, watchOptions); builder_1.build(); return builder_1; } var buildHost = ts.createSolutionBuilderHost(sys, undefined, reportDiagnostic, ts.createBuilderStatusReporter(sys, shouldBePretty(sys, buildOptions)), createReportErrorSummary(sys, buildOptions)); - updateSolutionBuilderHost(sys, cb, buildHost); + var solutionPerformance = enableSolutionPerformance(sys, buildOptions); + updateSolutionBuilderHost(sys, cb, buildHost, solutionPerformance); var builder = ts.createSolutionBuilder(buildHost, projects, buildOptions); var exitStatus = buildOptions.clean ? builder.clean() : builder.build(); + reportSolutionBuilderTimes(builder, solutionPerformance); ts.dumpTracingLegend(); return sys.exit(exitStatus); } @@ -106619,7 +107856,7 @@ var ts; }; var program = ts.createProgram(programOptions); var exitStatus = ts.emitFilesAndReportErrorsAndGetExitStatus(program, reportDiagnostic, function (s) { return sys.write(s + sys.newLine); }, createReportErrorSummary(sys, options)); - reportStatistics(sys, program); + reportStatistics(sys, program, undefined); cb(program); return sys.exit(exitStatus); } @@ -106637,36 +107874,36 @@ var ts; reportDiagnostic: reportDiagnostic, reportErrorSummary: createReportErrorSummary(sys, options), afterProgramEmitAndDiagnostics: function (builderProgram) { - reportStatistics(sys, builderProgram.getProgram()); + reportStatistics(sys, builderProgram.getProgram(), undefined); cb(builderProgram); } }); return sys.exit(exitStatus); } - function updateSolutionBuilderHost(sys, cb, buildHost) { - updateCreateProgram(sys, buildHost); + function updateSolutionBuilderHost(sys, cb, buildHost, solutionPerformance) { + updateCreateProgram(sys, buildHost, true); buildHost.afterProgramEmitAndDiagnostics = function (program) { - reportStatistics(sys, program.getProgram()); + reportStatistics(sys, program.getProgram(), solutionPerformance); cb(program); }; buildHost.afterEmitBundle = cb; } - function updateCreateProgram(sys, host) { + function updateCreateProgram(sys, host, isBuildMode) { var compileUsingBuilder = host.createProgram; host.createProgram = function (rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences) { ts.Debug.assert(rootNames !== undefined || (options === undefined && !!oldProgram)); if (options !== undefined) { - enableStatisticsAndTracing(sys, options, true); + enableStatisticsAndTracing(sys, options, isBuildMode); } return compileUsingBuilder(rootNames, options, host, oldProgram, configFileParsingDiagnostics, projectReferences); }; } function updateWatchCompilationHost(sys, cb, watchCompilerHost) { - updateCreateProgram(sys, watchCompilerHost); + updateCreateProgram(sys, watchCompilerHost, false); var emitFilesUsingBuilder = watchCompilerHost.afterProgramCreate; watchCompilerHost.afterProgramCreate = function (builderProgram) { emitFilesUsingBuilder(builderProgram); - reportStatistics(sys, builderProgram.getProgram()); + reportStatistics(sys, builderProgram.getProgram(), undefined); cb(builderProgram); }; } @@ -106699,6 +107936,71 @@ var ts; updateWatchCompilationHost(system, cb, watchCompilerHost); return ts.createWatchProgram(watchCompilerHost); } + function enableSolutionPerformance(system, options) { + if (system === ts.sys && options.extendedDiagnostics) { + ts.performance.enable(); + return createSolutionPerfomrance(); + } + } + function createSolutionPerfomrance() { + var statistics; + return { + addAggregateStatistic: addAggregateStatistic, + forEachAggregateStatistics: forEachAggreateStatistics, + clear: clear, + }; + function addAggregateStatistic(s) { + var existing = statistics === null || statistics === void 0 ? void 0 : statistics.get(s.name); + if (existing) { + if (existing.type === StatisticType.memory) + existing.value = Math.max(existing.value, s.value); + else + existing.value += s.value; + } + else { + (statistics !== null && statistics !== void 0 ? statistics : (statistics = new ts.Map())).set(s.name, s); + } + } + function forEachAggreateStatistics(cb) { + statistics === null || statistics === void 0 ? void 0 : statistics.forEach(cb); + } + function clear() { + statistics = undefined; + } + } + function reportSolutionBuilderTimes(builder, solutionPerformance) { + if (!solutionPerformance) + return; + if (!ts.performance.isEnabled()) { + ts.sys.write(ts.Diagnostics.Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found.message + "\n"); + return; + } + var statistics = []; + statistics.push({ name: "Projects in scope", value: ts.getBuildOrderFromAnyBuildOrder(builder.getBuildOrder()).length, type: StatisticType.count }); + reportSolutionBuilderCountStatistic("SolutionBuilder::Projects built"); + reportSolutionBuilderCountStatistic("SolutionBuilder::Timestamps only updates"); + reportSolutionBuilderCountStatistic("SolutionBuilder::Bundles updated"); + solutionPerformance.forEachAggregateStatistics(function (s) { + s.name = "Aggregate ".concat(s.name); + statistics.push(s); + }); + ts.performance.forEachMeasure(function (name, duration) { + if (isSolutionMarkOrMeasure(name)) + statistics.push({ name: "".concat(getNameFromSolutionBuilderMarkOrMeasure(name), " time"), value: duration, type: StatisticType.time }); + }); + ts.performance.disable(); + ts.performance.enable(); + reportAllStatistics(ts.sys, statistics); + function reportSolutionBuilderCountStatistic(name) { + var value = ts.performance.getCount(name); + if (value) { + statistics.push({ name: getNameFromSolutionBuilderMarkOrMeasure(name), value: value, type: StatisticType.count }); + } + } + function getNameFromSolutionBuilderMarkOrMeasure(name) { + return name.replace("SolutionBuilder::", ""); + } + } function canReportDiagnostics(system, compilerOptions) { return system === ts.sys && (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics); } @@ -106713,7 +108015,10 @@ var ts; ts.startTracing(isBuildMode ? "build" : "project", compilerOptions.generateTrace, compilerOptions.configFilePath); } } - function reportStatistics(sys, program) { + function isSolutionMarkOrMeasure(name) { + return ts.startsWith(name, "SolutionBuilder::"); + } + function reportStatistics(sys, program, solutionPerformance) { var compilerOptions = program.getCompilerOptions(); if (canTrace(sys, compilerOptions)) { ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.stopTracing(); @@ -106724,27 +108029,21 @@ var ts; var memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1; reportCountStatistic("Files", program.getSourceFiles().length); var lineCounts = countLines(program); - var nodeCounts = countNodes(program); if (compilerOptions.extendedDiagnostics) { for (var _i = 0, _a = ts.arrayFrom(lineCounts.keys()); _i < _a.length; _i++) { var key = _a[_i]; reportCountStatistic("Lines of " + key, lineCounts.get(key)); } - for (var _b = 0, _c = ts.arrayFrom(nodeCounts.keys()); _b < _c.length; _b++) { - var key = _c[_b]; - reportCountStatistic("Nodes of " + key, nodeCounts.get(key)); - } } else { reportCountStatistic("Lines", ts.reduceLeftIterator(lineCounts.values(), function (sum, count) { return sum + count; }, 0)); - reportCountStatistic("Nodes", ts.reduceLeftIterator(nodeCounts.values(), function (sum, count) { return sum + count; }, 0)); } reportCountStatistic("Identifiers", program.getIdentifierCount()); reportCountStatistic("Symbols", program.getSymbolCount()); reportCountStatistic("Types", program.getTypeCount()); reportCountStatistic("Instantiations", program.getInstantiationCount()); if (memoryUsed >= 0) { - reportStatisticalValue("Memory used", Math.round(memoryUsed / 1000) + "K"); + reportStatisticalValue({ name: "Memory used", value: memoryUsed, type: StatisticType.memory }, true); } var isPerformanceEnabled = ts.performance.isEnabled(); var programTime = isPerformanceEnabled ? ts.performance.getDuration("Program") : 0; @@ -106758,53 +108057,83 @@ var ts; reportCountStatistic("Subtype cache size", caches.subtype); reportCountStatistic("Strict subtype cache size", caches.strictSubtype); if (isPerformanceEnabled) { - ts.performance.forEachMeasure(function (name, duration) { return reportTimeStatistic("".concat(name, " time"), duration); }); + ts.performance.forEachMeasure(function (name, duration) { + if (!isSolutionMarkOrMeasure(name)) + reportTimeStatistic("".concat(name, " time"), duration, true); + }); } } else if (isPerformanceEnabled) { - reportTimeStatistic("I/O read", ts.performance.getDuration("I/O Read")); - reportTimeStatistic("I/O write", ts.performance.getDuration("I/O Write")); - reportTimeStatistic("Parse time", programTime); - reportTimeStatistic("Bind time", bindTime); - reportTimeStatistic("Check time", checkTime); - reportTimeStatistic("Emit time", emitTime); + reportTimeStatistic("I/O read", ts.performance.getDuration("I/O Read"), true); + reportTimeStatistic("I/O write", ts.performance.getDuration("I/O Write"), true); + reportTimeStatistic("Parse time", programTime, true); + reportTimeStatistic("Bind time", bindTime, true); + reportTimeStatistic("Check time", checkTime, true); + reportTimeStatistic("Emit time", emitTime, true); } if (isPerformanceEnabled) { - reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime); + reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime, false); } - reportStatistics(); + reportAllStatistics(sys, statistics); if (!isPerformanceEnabled) { sys.write(ts.Diagnostics.Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found.message + "\n"); } else { - ts.performance.disable(); - } - } - function reportStatistics() { - var nameSize = 0; - var valueSize = 0; - for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) { - var _a = statistics_1[_i], name = _a.name, value = _a.value; - if (name.length > nameSize) { - nameSize = name.length; + if (solutionPerformance) { + ts.performance.forEachMeasure(function (name) { + if (!isSolutionMarkOrMeasure(name)) + ts.performance.clearMeasures(name); + }); + ts.performance.forEachMark(function (name) { + if (!isSolutionMarkOrMeasure(name)) + ts.performance.clearMarks(name); + }); } - if (value.length > valueSize) { - valueSize = value.length; + else { + ts.performance.disable(); } } - for (var _b = 0, statistics_2 = statistics; _b < statistics_2.length; _b++) { - var _c = statistics_2[_b], name = _c.name, value = _c.value; - sys.write(ts.padRight(name + ":", nameSize + 2) + ts.padLeft(value.toString(), valueSize) + sys.newLine); - } } - function reportStatisticalValue(name, value) { - statistics.push({ name: name, value: value }); + function reportStatisticalValue(s, aggregate) { + statistics.push(s); + if (aggregate) + solutionPerformance === null || solutionPerformance === void 0 ? void 0 : solutionPerformance.addAggregateStatistic(s); } function reportCountStatistic(name, count) { - reportStatisticalValue(name, "" + count); + reportStatisticalValue({ name: name, value: count, type: StatisticType.count }, true); + } + function reportTimeStatistic(name, time, aggregate) { + reportStatisticalValue({ name: name, value: time, type: StatisticType.time }, aggregate); + } + } + function reportAllStatistics(sys, statistics) { + var nameSize = 0; + var valueSize = 0; + for (var _i = 0, statistics_1 = statistics; _i < statistics_1.length; _i++) { + var s = statistics_1[_i]; + if (s.name.length > nameSize) { + nameSize = s.name.length; + } + var value = statisticValue(s); + if (value.length > valueSize) { + valueSize = value.length; + } + } + for (var _a = 0, statistics_2 = statistics; _a < statistics_2.length; _a++) { + var s = statistics_2[_a]; + sys.write(ts.padRight(s.name + ":", nameSize + 2) + ts.padLeft(statisticValue(s).toString(), valueSize) + sys.newLine); } - function reportTimeStatistic(name, time) { - reportStatisticalValue(name, (time / 1000).toFixed(2) + "s"); + } + function statisticValue(s) { + switch (s.type) { + case StatisticType.count: + return "" + s.value; + case StatisticType.time: + return (s.value / 1000).toFixed(2) + "s"; + case StatisticType.memory: + return Math.round(s.value / 1000) + "K"; + default: + ts.Debug.assertNever(s.type); } } function writeConfigFile(sys, reportDiagnostic, options, fileNames) { diff --git a/node_modules/typescript/lib/tsserver.js b/node_modules/typescript/lib/tsserver.js index 33a0f2908..4d7f350bb 100644 --- a/node_modules/typescript/lib/tsserver.js +++ b/node_modules/typescript/lib/tsserver.js @@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); - while (_) try { + while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { @@ -105,11 +105,11 @@ var ts; (function (ts) { // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configurePrerelease` too. - ts.versionMajorMinor = "4.8"; + ts.versionMajorMinor = "4.9"; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.8.4"; + ts.version = "".concat(ts.versionMajorMinor, ".3"); /* @internal */ var Comparison; (function (Comparison) { @@ -130,8 +130,12 @@ var ts; function tryGetNativeMap() { // Internet Explorer's Map doesn't support iteration, so don't use it. var gMap = globals === null || globals === void 0 ? void 0 : globals.Map; - // eslint-disable-next-line no-in-operator - return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + if (!constructor) { + throw new Error("No compatible Map implementation found."); + } + return constructor; } NativeCollections.tryGetNativeMap = tryGetNativeMap; /** @@ -140,24 +144,19 @@ var ts; function tryGetNativeSet() { // Internet Explorer's Set doesn't support iteration, so don't use it. var gSet = globals === null || globals === void 0 ? void 0 : globals.Set; - // eslint-disable-next-line no-in-operator - return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + if (!constructor) { + throw new Error("No compatible Set implementation found."); + } + return constructor; } NativeCollections.tryGetNativeSet = tryGetNativeSet; })(NativeCollections || (NativeCollections = {})); /* @internal */ - ts.Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim"); - /* @internal */ - ts.Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim"); + ts.Map = NativeCollections.tryGetNativeMap(); /* @internal */ - function getCollectionImplementation(name, nativeFactory, shimFactory) { - var _a; - // NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it. - var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator); - if (constructor) - return constructor; - throw new Error("TypeScript requires an environment that provides a compatible native ".concat(name, " implementation.")); - } + ts.Set = NativeCollections.tryGetNativeSet(); })(ts || (ts = {})); /* @internal */ var ts; @@ -873,15 +872,18 @@ var ts; function insertSorted(array, insert, compare, allowDuplicates) { if (array.length === 0) { array.push(insert); - return; + return true; } var insertIndex = binarySearch(array, insert, identity, compare); if (insertIndex < 0) { array.splice(~insertIndex, 0, insert); + return true; } - else if (allowDuplicates) { + if (allowDuplicates) { array.splice(insertIndex, 0, insert); + return true; } + return false; } ts.insertSorted = insertSorted; function sortAndDeduplicate(array, comparer, equalityComparer) { @@ -1161,6 +1163,13 @@ var ts; : undefined; } ts.singleOrUndefined = singleOrUndefined; + /** + * Returns the only element of an array if it contains only one element; throws otherwise. + */ + function single(array) { + return ts.Debug.checkDefined(singleOrUndefined(array)); + } + ts.single = single; function singleOrMany(array) { return array && array.length === 1 ? array[0] @@ -1892,8 +1901,8 @@ var ts; return compareValues(a === null || a === void 0 ? void 0 : a.start, b === null || b === void 0 ? void 0 : b.start) || compareValues(a === null || a === void 0 ? void 0 : a.length, b === null || b === void 0 ? void 0 : b.length); } ts.compareTextSpans = compareTextSpans; - function min(a, b, compare) { - return compare(a, b) === -1 /* Comparison.LessThan */ ? a : b; + function min(items, compare) { + return reduceLeft(items, function (x, y) { return compare(x, y) === -1 /* Comparison.LessThan */ ? x : y; }); } ts.min = min; /** @@ -2684,7 +2693,7 @@ var ts; if (typeof func !== "function") { return ""; } - else if (func.hasOwnProperty("name")) { + else if (ts.hasProperty(func, "name")) { return func.name; } else { @@ -2834,7 +2843,7 @@ var ts; Debug.formatControlFlowGraph = formatControlFlowGraph; var flowNodeProto; function attachFlowNodeDebugInfoWorker(flowNode) { - if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line no-in-operator + if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line local/no-in-operator Object.defineProperties(flowNode, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -2880,7 +2889,7 @@ var ts; Debug.attachFlowNodeDebugInfo = attachFlowNodeDebugInfo; var nodeArrayProto; function attachNodeArrayDebugInfoWorker(array) { - if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line no-in-operator + if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line local/no-in-operator Object.defineProperties(array, { __tsDebuggerDisplay: { value: function (defaultValue) { @@ -3009,7 +3018,7 @@ var ts; ]; for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) { var ctor = nodeConstructors_1[_i]; - if (!ctor.prototype.hasOwnProperty("__debugKind")) { + if (!ts.hasProperty(ctor.prototype, "__debugKind")) { Object.defineProperties(ctor.prototype, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -3206,11 +3215,13 @@ var ts; // > alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric identifiers // > MUST NOT include leading zeroes. var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-][a-z0-9-]*))*$/i; + var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i; // https://semver.org/#spec-item-10 // > Build metadata MAY be denoted by appending a plus sign and a series of dot separated // > identifiers immediately following the patch or pre-release version. Identifiers MUST // > comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i; + var buildPartRegExp = /^[a-z0-9-]+$/i; // https://semver.org/#spec-item-9 // > Numeric identifiers MUST NOT include leading zeroes. var numericIdentifierRegExp = /^(0|[1-9]\d*)$/; @@ -3230,13 +3241,15 @@ var ts; ts.Debug.assert(major >= 0, "Invalid argument: major"); ts.Debug.assert(minor >= 0, "Invalid argument: minor"); ts.Debug.assert(patch >= 0, "Invalid argument: patch"); - ts.Debug.assert(!prerelease || prereleaseRegExp.test(prerelease), "Invalid argument: prerelease"); - ts.Debug.assert(!build || buildRegExp.test(build), "Invalid argument: build"); + var prereleaseArray = prerelease ? ts.isArray(prerelease) ? prerelease : prerelease.split(".") : ts.emptyArray; + var buildArray = build ? ts.isArray(build) ? build : build.split(".") : ts.emptyArray; + ts.Debug.assert(ts.every(prereleaseArray, function (s) { return prereleasePartRegExp.test(s); }), "Invalid argument: prerelease"); + ts.Debug.assert(ts.every(buildArray, function (s) { return buildPartRegExp.test(s); }), "Invalid argument: build"); this.major = major; this.minor = minor; this.patch = patch; - this.prerelease = prerelease ? prerelease.split(".") : ts.emptyArray; - this.build = build ? build.split(".") : ts.emptyArray; + this.prerelease = prereleaseArray; + this.build = buildArray; } Version.tryParse = function (text) { var result = tryParseComponents(text); @@ -3275,6 +3288,10 @@ var ts; default: return ts.Debug.assertNever(field); } }; + Version.prototype.with = function (fields) { + var _a = fields.major, major = _a === void 0 ? this.major : _a, _b = fields.minor, minor = _b === void 0 ? this.minor : _b, _c = fields.patch, patch = _c === void 0 ? this.patch : _c, _d = fields.prerelease, prerelease = _d === void 0 ? this.prerelease : _d, _e = fields.build, build = _e === void 0 ? this.build : _e; + return new Version(major, minor, patch, prerelease, build); + }; Version.prototype.toString = function () { var result = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch); if (ts.some(this.prerelease)) @@ -3283,7 +3300,7 @@ var ts; result += "+".concat(this.build.join(".")); return result; }; - Version.zero = new Version(0, 0, 0); + Version.zero = new Version(0, 0, 0, ["0"]); return Version; }()); ts.Version = Version; @@ -3366,6 +3383,10 @@ var ts; } return undefined; }; + /** + * Tests whether a version matches the range. This is equivalent to `satisfies(version, range, { includePrerelease: true })`. + * in `node-semver`. + */ VersionRange.prototype.test = function (version) { if (typeof version === "string") version = new Version(version); @@ -3476,19 +3497,20 @@ var ts; break; case "<": case ">=": - comparators.push(createComparator(operator, version)); + comparators.push(isWildcard(minor) || isWildcard(patch) ? createComparator(operator, version.with({ prerelease: "0" })) : + createComparator(operator, version)); break; case "<=": case ">": - comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major")) : - isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor")) : + comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major").with({ prerelease: "0" })) : + isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor").with({ prerelease: "0" })) : createComparator(operator, version)); break; case "=": case undefined: if (isWildcard(minor) || isWildcard(patch)) { - comparators.push(createComparator(">=", version)); - comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor"))); + comparators.push(createComparator(">=", version.with({ prerelease: "0" }))); + comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor").with({ prerelease: "0" }))); } else { comparators.push(createComparator("=", version)); @@ -3562,6 +3584,8 @@ var ts; typeof performance.mark === "function" && typeof performance.measure === "function" && typeof performance.now === "function" && + typeof performance.clearMarks === "function" && + typeof performance.clearMeasures === "function" && typeof PerformanceObserver === "function"; } function tryGetWebPerformanceHooks() { @@ -3606,7 +3630,9 @@ var ts; if (end === "__performance.measure-fix__") { nodePerformance_1.clearMarks("__performance.measure-fix__"); } - } + }, + clearMarks: function (name) { return nodePerformance_1.clearMarks(name); }, + clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); }, }; } return { @@ -3739,6 +3765,30 @@ var ts; durations.forEach(function (duration, measureName) { return cb(measureName, duration); }); } performance.forEachMeasure = forEachMeasure; + function forEachMark(cb) { + marks.forEach(function (_time, markName) { return cb(markName); }); + } + performance.forEachMark = forEachMark; + function clearMeasures(name) { + if (name !== undefined) + durations.delete(name); + else + durations.clear(); + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name); + } + performance.clearMeasures = clearMeasures; + function clearMarks(name) { + if (name !== undefined) { + counts.delete(name); + marks.delete(name); + } + else { + counts.clear(); + marks.clear(); + } + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name); + } + performance.clearMarks = clearMarks; /** * Indicates whether the performance API is enabled. */ @@ -3836,7 +3886,6 @@ var ts; var typeCatalog = []; // NB: id is index + 1 var legendPath; var legend = []; - ; /** Starts tracing for the given project. */ function startTracing(tracingMode, traceDir, configFilePath) { ts.Debug.assert(!ts.tracing, "Tracing already started"); @@ -4041,7 +4090,7 @@ var ts; var substitutionType = type; substitutionProperties = { substitutionBaseType: (_o = substitutionType.baseType) === null || _o === void 0 ? void 0 : _o.id, - substituteType: (_p = substitutionType.substitute) === null || _p === void 0 ? void 0 : _p.id, + constraintType: (_p = substitutionType.constraint) === null || _p === void 0 ? void 0 : _p.id, }; } var reverseMappedProperties = {}; @@ -4241,257 +4290,260 @@ var ts; SyntaxKind[SyntaxKind["YieldKeyword"] = 125] = "YieldKeyword"; // Contextual keywords SyntaxKind[SyntaxKind["AbstractKeyword"] = 126] = "AbstractKeyword"; - SyntaxKind[SyntaxKind["AsKeyword"] = 127] = "AsKeyword"; - SyntaxKind[SyntaxKind["AssertsKeyword"] = 128] = "AssertsKeyword"; - SyntaxKind[SyntaxKind["AssertKeyword"] = 129] = "AssertKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 130] = "AnyKeyword"; - SyntaxKind[SyntaxKind["AsyncKeyword"] = 131] = "AsyncKeyword"; - SyntaxKind[SyntaxKind["AwaitKeyword"] = 132] = "AwaitKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 133] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 134] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 135] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 136] = "GetKeyword"; - SyntaxKind[SyntaxKind["InferKeyword"] = 137] = "InferKeyword"; - SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 138] = "IntrinsicKeyword"; - SyntaxKind[SyntaxKind["IsKeyword"] = 139] = "IsKeyword"; - SyntaxKind[SyntaxKind["KeyOfKeyword"] = 140] = "KeyOfKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 141] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["NamespaceKeyword"] = 142] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["NeverKeyword"] = 143] = "NeverKeyword"; - SyntaxKind[SyntaxKind["OutKeyword"] = 144] = "OutKeyword"; - SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 145] = "ReadonlyKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 146] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 147] = "NumberKeyword"; - SyntaxKind[SyntaxKind["ObjectKeyword"] = 148] = "ObjectKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 149] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 150] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 151] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 152] = "TypeKeyword"; - SyntaxKind[SyntaxKind["UndefinedKeyword"] = 153] = "UndefinedKeyword"; - SyntaxKind[SyntaxKind["UniqueKeyword"] = 154] = "UniqueKeyword"; - SyntaxKind[SyntaxKind["UnknownKeyword"] = 155] = "UnknownKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 156] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 157] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["BigIntKeyword"] = 158] = "BigIntKeyword"; - SyntaxKind[SyntaxKind["OverrideKeyword"] = 159] = "OverrideKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 160] = "OfKeyword"; + SyntaxKind[SyntaxKind["AccessorKeyword"] = 127] = "AccessorKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 128] = "AsKeyword"; + SyntaxKind[SyntaxKind["AssertsKeyword"] = 129] = "AssertsKeyword"; + SyntaxKind[SyntaxKind["AssertKeyword"] = 130] = "AssertKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 131] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 132] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 133] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 134] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 135] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 136] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 137] = "GetKeyword"; + SyntaxKind[SyntaxKind["InferKeyword"] = 138] = "InferKeyword"; + SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 139] = "IntrinsicKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 140] = "IsKeyword"; + SyntaxKind[SyntaxKind["KeyOfKeyword"] = 141] = "KeyOfKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 142] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 143] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["NeverKeyword"] = 144] = "NeverKeyword"; + SyntaxKind[SyntaxKind["OutKeyword"] = 145] = "OutKeyword"; + SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 146] = "ReadonlyKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 147] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 148] = "NumberKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 149] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SatisfiesKeyword"] = 150] = "SatisfiesKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 151] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 152] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 153] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 154] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 155] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["UniqueKeyword"] = 156] = "UniqueKeyword"; + SyntaxKind[SyntaxKind["UnknownKeyword"] = 157] = "UnknownKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 158] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 159] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["BigIntKeyword"] = 160] = "BigIntKeyword"; + SyntaxKind[SyntaxKind["OverrideKeyword"] = 161] = "OverrideKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 162] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 161] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 162] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 163] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 164] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 163] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 164] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 165] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 165] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 166] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 167] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 166] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 167] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 168] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 169] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 170] = "ClassStaticBlockDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 171] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 172] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 173] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 174] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 175] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 176] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 168] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 169] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 170] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 171] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 172] = "ClassStaticBlockDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 173] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 174] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 175] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 176] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 177] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 178] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 177] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 178] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 179] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 180] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 181] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 182] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 183] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 184] = "TupleType"; - SyntaxKind[SyntaxKind["OptionalType"] = 185] = "OptionalType"; - SyntaxKind[SyntaxKind["RestType"] = 186] = "RestType"; - SyntaxKind[SyntaxKind["UnionType"] = 187] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 188] = "IntersectionType"; - SyntaxKind[SyntaxKind["ConditionalType"] = 189] = "ConditionalType"; - SyntaxKind[SyntaxKind["InferType"] = 190] = "InferType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 191] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 192] = "ThisType"; - SyntaxKind[SyntaxKind["TypeOperator"] = 193] = "TypeOperator"; - SyntaxKind[SyntaxKind["IndexedAccessType"] = 194] = "IndexedAccessType"; - SyntaxKind[SyntaxKind["MappedType"] = 195] = "MappedType"; - SyntaxKind[SyntaxKind["LiteralType"] = 196] = "LiteralType"; - SyntaxKind[SyntaxKind["NamedTupleMember"] = 197] = "NamedTupleMember"; - SyntaxKind[SyntaxKind["TemplateLiteralType"] = 198] = "TemplateLiteralType"; - SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 199] = "TemplateLiteralTypeSpan"; - SyntaxKind[SyntaxKind["ImportType"] = 200] = "ImportType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 179] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 180] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 181] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 182] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 183] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 184] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 185] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 186] = "TupleType"; + SyntaxKind[SyntaxKind["OptionalType"] = 187] = "OptionalType"; + SyntaxKind[SyntaxKind["RestType"] = 188] = "RestType"; + SyntaxKind[SyntaxKind["UnionType"] = 189] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 190] = "IntersectionType"; + SyntaxKind[SyntaxKind["ConditionalType"] = 191] = "ConditionalType"; + SyntaxKind[SyntaxKind["InferType"] = 192] = "InferType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 193] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 194] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 195] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 196] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 197] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 198] = "LiteralType"; + SyntaxKind[SyntaxKind["NamedTupleMember"] = 199] = "NamedTupleMember"; + SyntaxKind[SyntaxKind["TemplateLiteralType"] = 200] = "TemplateLiteralType"; + SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 201] = "TemplateLiteralTypeSpan"; + SyntaxKind[SyntaxKind["ImportType"] = 202] = "ImportType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 201] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 202] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 203] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 203] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 204] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 205] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 204] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 205] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 206] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 207] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 208] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 209] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 210] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 211] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 212] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 213] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 214] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 215] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 216] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 217] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 218] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 219] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 220] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 221] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 222] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 223] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 224] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 225] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 226] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 227] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 228] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 229] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 230] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 231] = "MetaProperty"; - SyntaxKind[SyntaxKind["SyntheticExpression"] = 232] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 206] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 207] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 208] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 209] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 210] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 211] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 212] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 213] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 214] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 215] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 216] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 217] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 218] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 219] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 220] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 221] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 222] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 223] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 224] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 225] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 226] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 227] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 228] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 229] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 230] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 231] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 232] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 233] = "MetaProperty"; + SyntaxKind[SyntaxKind["SyntheticExpression"] = 234] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["SatisfiesExpression"] = 235] = "SatisfiesExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 233] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 234] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 236] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 237] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 235] = "Block"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 236] = "EmptyStatement"; - SyntaxKind[SyntaxKind["VariableStatement"] = 237] = "VariableStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 238] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 239] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 240] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 241] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 242] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 243] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 244] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 245] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 246] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 247] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 248] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 249] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 250] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 251] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 252] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 253] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 254] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 255] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 256] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 257] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 258] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 259] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 260] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 261] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 262] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 263] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 264] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 265] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 266] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 267] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 268] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 269] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 270] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 271] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 272] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 273] = "NamedExports"; - SyntaxKind[SyntaxKind["NamespaceExport"] = 274] = "NamespaceExport"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 275] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 276] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 238] = "Block"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 239] = "EmptyStatement"; + SyntaxKind[SyntaxKind["VariableStatement"] = 240] = "VariableStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 241] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 242] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 243] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 244] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 245] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 246] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 247] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 248] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 249] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 250] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 251] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 252] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 253] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 254] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 255] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 256] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 257] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 258] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 259] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 260] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 261] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 262] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 263] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 264] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 265] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 266] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 267] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 268] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 269] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 270] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 271] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 272] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 273] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 274] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 275] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 276] = "NamedExports"; + SyntaxKind[SyntaxKind["NamespaceExport"] = 277] = "NamespaceExport"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 278] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 279] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 277] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 280] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 278] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 279] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 280] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 281] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxFragment"] = 282] = "JsxFragment"; - SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 283] = "JsxOpeningFragment"; - SyntaxKind[SyntaxKind["JsxClosingFragment"] = 284] = "JsxClosingFragment"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 285] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 286] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 287] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 288] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 281] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 282] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 283] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 284] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxFragment"] = 285] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 286] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 287] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 288] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 289] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 290] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 291] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 289] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 290] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 291] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 292] = "CatchClause"; - SyntaxKind[SyntaxKind["AssertClause"] = 293] = "AssertClause"; - SyntaxKind[SyntaxKind["AssertEntry"] = 294] = "AssertEntry"; - SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 295] = "ImportTypeAssertionContainer"; + SyntaxKind[SyntaxKind["CaseClause"] = 292] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 293] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 294] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 295] = "CatchClause"; + SyntaxKind[SyntaxKind["AssertClause"] = 296] = "AssertClause"; + SyntaxKind[SyntaxKind["AssertEntry"] = 297] = "AssertEntry"; + SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 298] = "ImportTypeAssertionContainer"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 296] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 297] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 298] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 299] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 300] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 301] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 299] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 302] = "EnumMember"; // Unparsed - SyntaxKind[SyntaxKind["UnparsedPrologue"] = 300] = "UnparsedPrologue"; - SyntaxKind[SyntaxKind["UnparsedPrepend"] = 301] = "UnparsedPrepend"; - SyntaxKind[SyntaxKind["UnparsedText"] = 302] = "UnparsedText"; - SyntaxKind[SyntaxKind["UnparsedInternalText"] = 303] = "UnparsedInternalText"; - SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 304] = "UnparsedSyntheticReference"; + SyntaxKind[SyntaxKind["UnparsedPrologue"] = 303] = "UnparsedPrologue"; + SyntaxKind[SyntaxKind["UnparsedPrepend"] = 304] = "UnparsedPrepend"; + SyntaxKind[SyntaxKind["UnparsedText"] = 305] = "UnparsedText"; + SyntaxKind[SyntaxKind["UnparsedInternalText"] = 306] = "UnparsedInternalText"; + SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 307] = "UnparsedSyntheticReference"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 305] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 306] = "Bundle"; - SyntaxKind[SyntaxKind["UnparsedSource"] = 307] = "UnparsedSource"; - SyntaxKind[SyntaxKind["InputFiles"] = 308] = "InputFiles"; + SyntaxKind[SyntaxKind["SourceFile"] = 308] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 309] = "Bundle"; + SyntaxKind[SyntaxKind["UnparsedSource"] = 310] = "UnparsedSource"; + SyntaxKind[SyntaxKind["InputFiles"] = 311] = "InputFiles"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 309] = "JSDocTypeExpression"; - SyntaxKind[SyntaxKind["JSDocNameReference"] = 310] = "JSDocNameReference"; - SyntaxKind[SyntaxKind["JSDocMemberName"] = 311] = "JSDocMemberName"; - SyntaxKind[SyntaxKind["JSDocAllType"] = 312] = "JSDocAllType"; - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 313] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 314] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 315] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 316] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType"; - SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 312] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocNameReference"] = 313] = "JSDocNameReference"; + SyntaxKind[SyntaxKind["JSDocMemberName"] = 314] = "JSDocMemberName"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 315] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 316] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 317] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 318] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 319] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 320] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 321] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocNamepathType"] = 322] = "JSDocNamepathType"; + SyntaxKind[SyntaxKind["JSDoc"] = 323] = "JSDoc"; /** @deprecated Use SyntaxKind.JSDoc */ - SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 322] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocSignature"] = 323] = "JSDocSignature"; - SyntaxKind[SyntaxKind["JSDocLink"] = 324] = "JSDocLink"; - SyntaxKind[SyntaxKind["JSDocLinkCode"] = 325] = "JSDocLinkCode"; - SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 326] = "JSDocLinkPlain"; - SyntaxKind[SyntaxKind["JSDocTag"] = 327] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 328] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 329] = "JSDocImplementsTag"; - SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 330] = "JSDocAuthorTag"; - SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 331] = "JSDocDeprecatedTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 332] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocPublicTag"] = 333] = "JSDocPublicTag"; - SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 334] = "JSDocPrivateTag"; - SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 335] = "JSDocProtectedTag"; - SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 336] = "JSDocReadonlyTag"; - SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 337] = "JSDocOverrideTag"; - SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 338] = "JSDocCallbackTag"; - SyntaxKind[SyntaxKind["JSDocEnumTag"] = 339] = "JSDocEnumTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 340] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 341] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocThisTag"] = 342] = "JSDocThisTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 343] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 344] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 345] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocSeeTag"] = 346] = "JSDocSeeTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 347] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocComment"] = 323] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocText"] = 324] = "JSDocText"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 325] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocSignature"] = 326] = "JSDocSignature"; + SyntaxKind[SyntaxKind["JSDocLink"] = 327] = "JSDocLink"; + SyntaxKind[SyntaxKind["JSDocLinkCode"] = 328] = "JSDocLinkCode"; + SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 329] = "JSDocLinkPlain"; + SyntaxKind[SyntaxKind["JSDocTag"] = 330] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 331] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 332] = "JSDocImplementsTag"; + SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 333] = "JSDocAuthorTag"; + SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 334] = "JSDocDeprecatedTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 335] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocPublicTag"] = 336] = "JSDocPublicTag"; + SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 337] = "JSDocPrivateTag"; + SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 338] = "JSDocProtectedTag"; + SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 339] = "JSDocReadonlyTag"; + SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 340] = "JSDocOverrideTag"; + SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 341] = "JSDocCallbackTag"; + SyntaxKind[SyntaxKind["JSDocEnumTag"] = 342] = "JSDocEnumTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 343] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 344] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocThisTag"] = 345] = "JSDocThisTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 346] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 347] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 348] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocSeeTag"] = 349] = "JSDocSeeTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 350] = "JSDocPropertyTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 348] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 351] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 349] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 350] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 351] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 352] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 353] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 354] = "SyntheticReferenceExpression"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 352] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 353] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 354] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 355] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 356] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 357] = "SyntheticReferenceExpression"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 355] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 358] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 63] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 78] = "LastAssignment"; @@ -4500,15 +4552,15 @@ var ts; SyntaxKind[SyntaxKind["FirstReservedWord"] = 81] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 116] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 81] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 160] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 162] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 117] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 125] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 177] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 200] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 179] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 202] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 78] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 160] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 162] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -4517,15 +4569,15 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 29] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 78] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstStatement"] = 237] = "FirstStatement"; - SyntaxKind[SyntaxKind["LastStatement"] = 253] = "LastStatement"; - SyntaxKind[SyntaxKind["FirstNode"] = 161] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 309] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 347] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 327] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstStatement"] = 240] = "FirstStatement"; + SyntaxKind[SyntaxKind["LastStatement"] = 256] = "LastStatement"; + SyntaxKind[SyntaxKind["FirstNode"] = 163] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 312] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 350] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 330] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 350] = "LastJSDocTagNode"; /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword"; - /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword"; + /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 162] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -4590,9 +4642,10 @@ var ts; ModifierFlags[ModifierFlags["Protected"] = 16] = "Protected"; ModifierFlags[ModifierFlags["Static"] = 32] = "Static"; ModifierFlags[ModifierFlags["Readonly"] = 64] = "Readonly"; - ModifierFlags[ModifierFlags["Abstract"] = 128] = "Abstract"; - ModifierFlags[ModifierFlags["Async"] = 256] = "Async"; - ModifierFlags[ModifierFlags["Default"] = 512] = "Default"; + ModifierFlags[ModifierFlags["Accessor"] = 128] = "Accessor"; + ModifierFlags[ModifierFlags["Abstract"] = 256] = "Abstract"; + ModifierFlags[ModifierFlags["Async"] = 512] = "Async"; + ModifierFlags[ModifierFlags["Default"] = 1024] = "Default"; ModifierFlags[ModifierFlags["Const"] = 2048] = "Const"; ModifierFlags[ModifierFlags["HasComputedJSDocModifiers"] = 4096] = "HasComputedJSDocModifiers"; ModifierFlags[ModifierFlags["Deprecated"] = 8192] = "Deprecated"; @@ -4605,10 +4658,10 @@ var ts; // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 16476] = "ParameterPropertyModifier"; ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier"; - ModifierFlags[ModifierFlags["TypeScriptModifier"] = 116958] = "TypeScriptModifier"; - ModifierFlags[ModifierFlags["ExportDefault"] = 513] = "ExportDefault"; - ModifierFlags[ModifierFlags["All"] = 257023] = "All"; - ModifierFlags[ModifierFlags["Modifier"] = 125951] = "Modifier"; + ModifierFlags[ModifierFlags["TypeScriptModifier"] = 117086] = "TypeScriptModifier"; + ModifierFlags[ModifierFlags["ExportDefault"] = 1025] = "ExportDefault"; + ModifierFlags[ModifierFlags["All"] = 258047] = "All"; + ModifierFlags[ModifierFlags["Modifier"] = 126975] = "Modifier"; })(ModifierFlags = ts.ModifierFlags || (ts.ModifierFlags = {})); var JsxFlags; (function (JsxFlags) { @@ -4804,6 +4857,7 @@ var ts; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyTuple"] = 524288] = "AllowEmptyTuple"; NodeBuilderFlags[NodeBuilderFlags["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType"; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType"; + /* @internal */ NodeBuilderFlags[NodeBuilderFlags["WriteComputedProps"] = 1073741824] = "WriteComputedProps"; // Errors (cont.) NodeBuilderFlags[NodeBuilderFlags["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths"; /* @internal */ NodeBuilderFlags[NodeBuilderFlags["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain"; @@ -4864,8 +4918,10 @@ var ts; SymbolFormatFlags[SymbolFormatFlags["AllowAnyNodeKind"] = 4] = "AllowAnyNodeKind"; // Prefer aliases which are not directly visible SymbolFormatFlags[SymbolFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 8] = "UseAliasDefinedOutsideCurrentScope"; + // { [E.A]: 1 } + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["WriteComputedProps"] = 16] = "WriteComputedProps"; // Skip building an accessible symbol chain - /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 16] = "DoNotIncludeSymbolChain"; + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 32] = "DoNotIncludeSymbolChain"; })(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); /* @internal */ var SymbolAccessibility; @@ -4979,6 +5035,7 @@ var ts; SymbolFlags[SymbolFlags["MethodExcludes"] = 103359] = "MethodExcludes"; SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes"; SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes"; + SymbolFlags[SymbolFlags["AccessorExcludes"] = 13247] = "AccessorExcludes"; SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes"; SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes"; SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes"; @@ -5062,8 +5119,8 @@ var ts; NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance"; NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic"; NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked"; - NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuper"] = 2048] = "AsyncMethodWithSuper"; - NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuperBinding"] = 4096] = "AsyncMethodWithSuperBinding"; + NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAccessInAsync"] = 2048] = "MethodWithSuperPropertyAccessInAsync"; + NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAssignmentInAsync"] = 4096] = "MethodWithSuperPropertyAssignmentInAsync"; NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments"; NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed"; NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass"; @@ -6105,7 +6162,6 @@ var ts; var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels); /* @internal */ ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels); - /* @internal */ function setCustomPollingValues(system) { if (!system.getEnvironmentVariable) { return; @@ -6148,7 +6204,6 @@ var ts; createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels); } } - ts.setCustomPollingValues = setCustomPollingValues; function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) { var definedValueCopyToIndex = pollIndex; // Max visit would be all elements of the queue @@ -6194,7 +6249,6 @@ var ts; } } } - /* @internal */ function createDynamicPriorityPollingWatchFile(host) { var watchedFiles = []; var changedFilesInLastPoll = []; @@ -6303,7 +6357,6 @@ var ts; pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval)); } } - ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile; function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) { // One file can have multiple watchers var fileWatcherCallbacks = ts.createMultiMap(); @@ -6382,42 +6435,38 @@ var ts; pollScheduled = host.setTimeout(pollQueue, PollingInterval.High); } } - /* @internal */ - function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) { - var cache = new ts.Map(); - var callbacksCache = ts.createMultiMap(); + function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) { var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - return function (fileName, callback, pollingInterval, options) { - var path = toCanonicalFileName(fileName); - var existing = cache.get(path); - if (existing) { - existing.refCount++; - } - else { - cache.set(path, { - watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options), - refCount: 1 - }); + var path = toCanonicalFileName(name); + var existing = cache.get(path); + if (existing) { + existing.callbacks.push(callback); + } + else { + cache.set(path, { + watcher: createWatcher(( + // Cant infer types correctly so lets satisfy checker + function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })), + callbacks: [callback] + }); + } + return { + close: function () { + var watcher = cache.get(path); + // Watcher is not expected to be undefined, but if it is normally its because + // exception was thrown somewhere else and watch state is not what it should be + if (!watcher) + return; + if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length) + return; + cache.delete(path); + ts.closeFileWatcherOf(watcher); } - callbacksCache.add(path, callback); - return { - close: function () { - var watcher = ts.Debug.checkDefined(cache.get(path)); - callbacksCache.remove(path, callback); - watcher.refCount--; - if (watcher.refCount) - return; - cache.delete(path); - ts.closeFileWatcherOf(watcher); - } - }; }; } - ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName; /** * Returns true if file status changed */ - /*@internal*/ function onWatchedFileStat(watchedFile, modifiedTime) { var oldTime = watchedFile.mtime.getTime(); var newTime = modifiedTime.getTime(); @@ -6429,7 +6478,6 @@ var ts; } return false; } - ts.onWatchedFileStat = onWatchedFileStat; /*@internal*/ function getFileWatcherEventKind(oldTime, newTime) { return oldTime === 0 @@ -6457,7 +6505,6 @@ var ts; * that means if this is recursive watcher, watch the children directories as well * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile) */ - /*@internal*/ function createDirectoryWatcherSupportingRecursive(_a) { var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout; var cache = new ts.Map(); @@ -6666,18 +6713,15 @@ var ts; return ts.stringContains(toCanonicalFilePath(path), searchPath); } } - ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive; /*@internal*/ var FileSystemEntryKind; (function (FileSystemEntryKind) { FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File"; FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory"; })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {})); - /*@internal*/ function createFileWatcherCallback(callback) { return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); }; } - ts.createFileWatcherCallback = createFileWatcherCallback; function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) { return function (eventName, _relativeFileName, modifiedTime) { if (eventName === "rename") { @@ -6711,7 +6755,10 @@ var ts; } /*@internal*/ function createSystemWatchFunctions(_a) { - var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatches = new ts.Map(); + var fsWatches = new ts.Map(); + var fsWatchesRecursive = new ts.Map(); var dynamicPollingWatchFile; var fixedChunkSizePollingWatchFile; var nonPollingWatchFile; @@ -6774,8 +6821,8 @@ var ts; return useNonPollingWatchers ? // Use notifications from FS to watch with falling back to fs.watchFile generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) : - // Default to do not use fixed polling interval - { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval }; + // Default to using fs events + { watchFile: ts.WatchFileKind.UseFsEvents }; } } function generateWatchFileOptions(watchFile, fallbackPolling, options) { @@ -6846,7 +6893,13 @@ var ts; }; } } + function pollingWatchFile(fileName, callback, pollingInterval, options) { + return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); }); + } function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { + return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); }); + } + function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { var lastDirectoryPartWithDirectorySeparator; var lastDirectoryPart; if (inodeWatching) { @@ -7025,7 +7078,7 @@ var ts; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); var _b = createSystemWatchFunctions({ - pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), + pollingWatchFileWorker: fsWatchFileWorker, getModifiedTime: getModifiedTime, setTimeout: setTimeout, clearTimeout: clearTimeout, @@ -7041,7 +7094,6 @@ var ts; tscWatchFile: process.env.TSC_WATCHFILE, useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER, tscWatchDirectory: process.env.TSC_WATCHDIRECTORY, - defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); }, inodeWatching: isLinuxOrMacOs, sysLog: sysLog, }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory; @@ -7845,12 +7897,9 @@ var ts; * Normalize path separators, converting `\` into `/`. */ function normalizeSlashes(path) { - var index = path.indexOf("\\"); - if (index === -1) { - return path; - } - backslashRegExp.lastIndex = index; // prime regex with known position - return path.replace(backslashRegExp, ts.directorySeparator); + return path.indexOf("\\") !== -1 + ? path.replace(backslashRegExp, ts.directorySeparator) + : path; } ts.normalizeSlashes = normalizeSlashes; /** @@ -8433,6 +8482,8 @@ var ts; A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."), _0_modifier_cannot_appear_on_a_type_parameter: diag(1273, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_parameter_1273", "'{0}' modifier cannot appear on a type parameter"), _0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"), + accessor_modifier_can_only_appear_on_a_property_declaration: diag(1275, ts.DiagnosticCategory.Error, "accessor_modifier_can_only_appear_on_a_property_declaration_1275", "'accessor' modifier can only appear on a property declaration."), + An_accessor_property_cannot_be_declared_optional: diag(1276, ts.DiagnosticCategory.Error, "An_accessor_property_cannot_be_declared_optional_1276", "An 'accessor' property cannot be declared optional."), with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."), await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."), The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."), @@ -8483,7 +8534,7 @@ var ts; An_enum_member_name_must_be_followed_by_a_or: diag(1357, ts.DiagnosticCategory.Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."), Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, ts.DiagnosticCategory.Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."), Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here: diag(1359, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."), - Class_constructor_may_not_be_a_generator: diag(1360, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1360", "Class constructor may not be a generator."), + Type_0_does_not_satisfy_the_expected_type_1: diag(1360, ts.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_expected_type_1_1360", "Type '{0}' does not satisfy the expected type '{1}'."), _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type: diag(1361, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."), _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type: diag(1362, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."), A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both: diag(1363, ts.DiagnosticCategory.Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."), @@ -8491,6 +8542,7 @@ var ts; Convert_all_re_exported_types_to_type_only_exports: diag(1365, ts.DiagnosticCategory.Message, "Convert_all_re_exported_types_to_type_only_exports_1365", "Convert all re-exported types to type-only exports"), Split_into_two_separate_import_declarations: diag(1366, ts.DiagnosticCategory.Message, "Split_into_two_separate_import_declarations_1366", "Split into two separate import declarations"), Split_all_invalid_type_only_imports: diag(1367, ts.DiagnosticCategory.Message, "Split_all_invalid_type_only_imports_1367", "Split all invalid type-only imports"), + Class_constructor_may_not_be_a_generator: diag(1368, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."), Did_you_mean_0: diag(1369, ts.DiagnosticCategory.Message, "Did_you_mean_0_1369", "Did you mean '{0}'?"), This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, ts.DiagnosticCategory.Error, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."), Convert_to_type_only_import: diag(1373, ts.DiagnosticCategory.Message, "Convert_to_type_only_import_1373", "Convert to type-only import"), @@ -8664,14 +8716,12 @@ var ts; The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."), The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."), The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."), - The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."), - The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."), The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."), Operator_0_cannot_be_applied_to_types_1_and_2: diag(2365, ts.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."), Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: diag(2366, ts.DiagnosticCategory.Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."), - This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367", "This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap."), + This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367", "This comparison appears to be unintentional because the types '{0}' and '{1}' have no overlap."), Type_parameter_name_cannot_be_0: diag(2368, ts.DiagnosticCategory.Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."), A_parameter_property_is_only_allowed_in_a_constructor_implementation: diag(2369, ts.DiagnosticCategory.Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."), A_rest_parameter_must_be_of_an_array_type: diag(2370, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."), @@ -8914,6 +8964,7 @@ var ts; Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."), Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."), Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."), + Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, ts.DiagnosticCategory.Error, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."), Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."), A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."), Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."), @@ -9094,6 +9145,7 @@ var ts; _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"), We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."), Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), + This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."), Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), @@ -9551,6 +9603,11 @@ var ts; Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."), Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"), Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"), + Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"), + Resolving_in_0_mode_with_conditions_1: diag(6402, ts.DiagnosticCategory.Message, "Resolving_in_0_mode_with_conditions_1_6402", "Resolving in {0} mode with conditions {1}."), + Matched_0_condition_1: diag(6403, ts.DiagnosticCategory.Message, "Matched_0_condition_1_6403", "Matched '{0}' condition '{1}'."), + Using_0_subpath_1_with_target_2: diag(6404, ts.DiagnosticCategory.Message, "Using_0_subpath_1_with_target_2_6404", "Using '{0}' subpath '{1}' with target '{2}'."), + Saw_non_matching_condition_0: diag(6405, ts.DiagnosticCategory.Message, "Saw_non_matching_condition_0_6405", "Saw non-matching condition '{0}'."), The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"), The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."), The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."), @@ -9793,6 +9850,7 @@ var ts; The_tag_was_first_specified_here: diag(8034, ts.DiagnosticCategory.Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."), You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."), You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."), + Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, ts.DiagnosticCategory.Error, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."), Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."), Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."), JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17000, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."), @@ -9866,6 +9924,8 @@ var ts; Remove_type_from_import_of_0_from_1: diag(90056, ts.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", "Remove 'type' from import of '{0}' from \"{1}\""), Add_import_from_0: diag(90057, ts.DiagnosticCategory.Message, "Add_import_from_0_90057", "Add import from \"{0}\""), Update_import_from_0: diag(90058, ts.DiagnosticCategory.Message, "Update_import_from_0_90058", "Update import from \"{0}\""), + Export_0_from_module_1: diag(90059, ts.DiagnosticCategory.Message, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"), + Export_all_referenced_locals: diag(90060, ts.DiagnosticCategory.Message, "Export_all_referenced_locals_90060", "Export all referenced locals"), Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"), Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"), Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"), @@ -9964,6 +10024,7 @@ var ts; Set_the_module_option_in_your_configuration_file_to_0: diag(95099, ts.DiagnosticCategory.Message, "Set_the_module_option_in_your_configuration_file_to_0_95099", "Set the 'module' option in your configuration file to '{0}'"), Convert_invalid_character_to_its_html_entity_code: diag(95100, ts.DiagnosticCategory.Message, "Convert_invalid_character_to_its_html_entity_code_95100", "Convert invalid character to its html entity code"), Convert_all_invalid_characters_to_HTML_entity_code: diag(95101, ts.DiagnosticCategory.Message, "Convert_all_invalid_characters_to_HTML_entity_code_95101", "Convert all invalid characters to HTML entity code"), + Convert_all_const_to_let: diag(95102, ts.DiagnosticCategory.Message, "Convert_all_const_to_let_95102", "Convert all 'const' to 'let'"), Convert_function_expression_0_to_arrow_function: diag(95105, ts.DiagnosticCategory.Message, "Convert_function_expression_0_to_arrow_function_95105", "Convert function expression '{0}' to arrow function"), Convert_function_declaration_0_to_arrow_function: diag(95106, ts.DiagnosticCategory.Message, "Convert_function_declaration_0_to_arrow_function_95106", "Convert function declaration '{0}' to arrow function"), Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"), @@ -10033,6 +10094,8 @@ var ts; Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"), Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"), Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"), + Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."), + Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."), No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."), Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."), JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"), @@ -10066,6 +10129,12 @@ var ts; _0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation: diag(18042, ts.DiagnosticCategory.Error, "_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation_18042", "'{0}' is a type and cannot be imported in JavaScript files. Use '{1}' in a JSDoc type annotation."), Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."), _0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."), + Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18045, ts.DiagnosticCategory.Error, "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045", "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."), + _0_is_of_type_unknown: diag(18046, ts.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."), + _0_is_possibly_null: diag(18047, ts.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."), + _0_is_possibly_undefined: diag(18048, ts.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."), + _0_is_possibly_null_or_undefined: diag(18049, ts.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."), + The_value_0_cannot_be_used_here: diag(18050, ts.DiagnosticCategory.Error, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."), }; })(ts || (ts = {})); var ts; @@ -10084,12 +10153,13 @@ var ts; /** @internal */ ts.textToKeywordObj = (_a = { abstract: 126 /* SyntaxKind.AbstractKeyword */, - any: 130 /* SyntaxKind.AnyKeyword */, - as: 127 /* SyntaxKind.AsKeyword */, - asserts: 128 /* SyntaxKind.AssertsKeyword */, - assert: 129 /* SyntaxKind.AssertKeyword */, - bigint: 158 /* SyntaxKind.BigIntKeyword */, - boolean: 133 /* SyntaxKind.BooleanKeyword */, + accessor: 127 /* SyntaxKind.AccessorKeyword */, + any: 131 /* SyntaxKind.AnyKeyword */, + as: 128 /* SyntaxKind.AsKeyword */, + asserts: 129 /* SyntaxKind.AssertsKeyword */, + assert: 130 /* SyntaxKind.AssertKeyword */, + bigint: 160 /* SyntaxKind.BigIntKeyword */, + boolean: 134 /* SyntaxKind.BooleanKeyword */, break: 81 /* SyntaxKind.BreakKeyword */, case: 82 /* SyntaxKind.CaseKeyword */, catch: 83 /* SyntaxKind.CatchKeyword */, @@ -10097,9 +10167,9 @@ var ts; continue: 86 /* SyntaxKind.ContinueKeyword */, const: 85 /* SyntaxKind.ConstKeyword */ }, - _a["" + "constructor"] = 134 /* SyntaxKind.ConstructorKeyword */, + _a["" + "constructor"] = 135 /* SyntaxKind.ConstructorKeyword */, _a.debugger = 87 /* SyntaxKind.DebuggerKeyword */, - _a.declare = 135 /* SyntaxKind.DeclareKeyword */, + _a.declare = 136 /* SyntaxKind.DeclareKeyword */, _a.default = 88 /* SyntaxKind.DefaultKeyword */, _a.delete = 89 /* SyntaxKind.DeleteKeyword */, _a.do = 90 /* SyntaxKind.DoKeyword */, @@ -10110,60 +10180,61 @@ var ts; _a.false = 95 /* SyntaxKind.FalseKeyword */, _a.finally = 96 /* SyntaxKind.FinallyKeyword */, _a.for = 97 /* SyntaxKind.ForKeyword */, - _a.from = 156 /* SyntaxKind.FromKeyword */, + _a.from = 158 /* SyntaxKind.FromKeyword */, _a.function = 98 /* SyntaxKind.FunctionKeyword */, - _a.get = 136 /* SyntaxKind.GetKeyword */, + _a.get = 137 /* SyntaxKind.GetKeyword */, _a.if = 99 /* SyntaxKind.IfKeyword */, _a.implements = 117 /* SyntaxKind.ImplementsKeyword */, _a.import = 100 /* SyntaxKind.ImportKeyword */, _a.in = 101 /* SyntaxKind.InKeyword */, - _a.infer = 137 /* SyntaxKind.InferKeyword */, + _a.infer = 138 /* SyntaxKind.InferKeyword */, _a.instanceof = 102 /* SyntaxKind.InstanceOfKeyword */, _a.interface = 118 /* SyntaxKind.InterfaceKeyword */, - _a.intrinsic = 138 /* SyntaxKind.IntrinsicKeyword */, - _a.is = 139 /* SyntaxKind.IsKeyword */, - _a.keyof = 140 /* SyntaxKind.KeyOfKeyword */, + _a.intrinsic = 139 /* SyntaxKind.IntrinsicKeyword */, + _a.is = 140 /* SyntaxKind.IsKeyword */, + _a.keyof = 141 /* SyntaxKind.KeyOfKeyword */, _a.let = 119 /* SyntaxKind.LetKeyword */, - _a.module = 141 /* SyntaxKind.ModuleKeyword */, - _a.namespace = 142 /* SyntaxKind.NamespaceKeyword */, - _a.never = 143 /* SyntaxKind.NeverKeyword */, + _a.module = 142 /* SyntaxKind.ModuleKeyword */, + _a.namespace = 143 /* SyntaxKind.NamespaceKeyword */, + _a.never = 144 /* SyntaxKind.NeverKeyword */, _a.new = 103 /* SyntaxKind.NewKeyword */, _a.null = 104 /* SyntaxKind.NullKeyword */, - _a.number = 147 /* SyntaxKind.NumberKeyword */, - _a.object = 148 /* SyntaxKind.ObjectKeyword */, + _a.number = 148 /* SyntaxKind.NumberKeyword */, + _a.object = 149 /* SyntaxKind.ObjectKeyword */, _a.package = 120 /* SyntaxKind.PackageKeyword */, _a.private = 121 /* SyntaxKind.PrivateKeyword */, _a.protected = 122 /* SyntaxKind.ProtectedKeyword */, _a.public = 123 /* SyntaxKind.PublicKeyword */, - _a.override = 159 /* SyntaxKind.OverrideKeyword */, - _a.out = 144 /* SyntaxKind.OutKeyword */, - _a.readonly = 145 /* SyntaxKind.ReadonlyKeyword */, - _a.require = 146 /* SyntaxKind.RequireKeyword */, - _a.global = 157 /* SyntaxKind.GlobalKeyword */, + _a.override = 161 /* SyntaxKind.OverrideKeyword */, + _a.out = 145 /* SyntaxKind.OutKeyword */, + _a.readonly = 146 /* SyntaxKind.ReadonlyKeyword */, + _a.require = 147 /* SyntaxKind.RequireKeyword */, + _a.global = 159 /* SyntaxKind.GlobalKeyword */, _a.return = 105 /* SyntaxKind.ReturnKeyword */, - _a.set = 149 /* SyntaxKind.SetKeyword */, + _a.satisfies = 150 /* SyntaxKind.SatisfiesKeyword */, + _a.set = 151 /* SyntaxKind.SetKeyword */, _a.static = 124 /* SyntaxKind.StaticKeyword */, - _a.string = 150 /* SyntaxKind.StringKeyword */, + _a.string = 152 /* SyntaxKind.StringKeyword */, _a.super = 106 /* SyntaxKind.SuperKeyword */, _a.switch = 107 /* SyntaxKind.SwitchKeyword */, - _a.symbol = 151 /* SyntaxKind.SymbolKeyword */, + _a.symbol = 153 /* SyntaxKind.SymbolKeyword */, _a.this = 108 /* SyntaxKind.ThisKeyword */, _a.throw = 109 /* SyntaxKind.ThrowKeyword */, _a.true = 110 /* SyntaxKind.TrueKeyword */, _a.try = 111 /* SyntaxKind.TryKeyword */, - _a.type = 152 /* SyntaxKind.TypeKeyword */, + _a.type = 154 /* SyntaxKind.TypeKeyword */, _a.typeof = 112 /* SyntaxKind.TypeOfKeyword */, - _a.undefined = 153 /* SyntaxKind.UndefinedKeyword */, - _a.unique = 154 /* SyntaxKind.UniqueKeyword */, - _a.unknown = 155 /* SyntaxKind.UnknownKeyword */, + _a.undefined = 155 /* SyntaxKind.UndefinedKeyword */, + _a.unique = 156 /* SyntaxKind.UniqueKeyword */, + _a.unknown = 157 /* SyntaxKind.UnknownKeyword */, _a.var = 113 /* SyntaxKind.VarKeyword */, _a.void = 114 /* SyntaxKind.VoidKeyword */, _a.while = 115 /* SyntaxKind.WhileKeyword */, _a.with = 116 /* SyntaxKind.WithKeyword */, _a.yield = 125 /* SyntaxKind.YieldKeyword */, - _a.async = 131 /* SyntaxKind.AsyncKeyword */, - _a.await = 132 /* SyntaxKind.AwaitKeyword */, - _a.of = 160 /* SyntaxKind.OfKeyword */, + _a.async = 132 /* SyntaxKind.AsyncKeyword */, + _a.await = 133 /* SyntaxKind.AwaitKeyword */, + _a.of = 162 /* SyntaxKind.OfKeyword */, _a); var textToKeyword = new ts.Map(ts.getEntries(ts.textToKeywordObj)); var textToToken = new ts.Map(ts.getEntries(__assign(__assign({}, ts.textToKeywordObj), { "{": 18 /* SyntaxKind.OpenBraceToken */, "}": 19 /* SyntaxKind.CloseBraceToken */, "(": 20 /* SyntaxKind.OpenParenToken */, ")": 21 /* SyntaxKind.CloseParenToken */, "[": 22 /* SyntaxKind.OpenBracketToken */, "]": 23 /* SyntaxKind.CloseBracketToken */, ".": 24 /* SyntaxKind.DotToken */, "...": 25 /* SyntaxKind.DotDotDotToken */, ";": 26 /* SyntaxKind.SemicolonToken */, ",": 27 /* SyntaxKind.CommaToken */, "<": 29 /* SyntaxKind.LessThanToken */, ">": 31 /* SyntaxKind.GreaterThanToken */, "<=": 32 /* SyntaxKind.LessThanEqualsToken */, ">=": 33 /* SyntaxKind.GreaterThanEqualsToken */, "==": 34 /* SyntaxKind.EqualsEqualsToken */, "!=": 35 /* SyntaxKind.ExclamationEqualsToken */, "===": 36 /* SyntaxKind.EqualsEqualsEqualsToken */, "!==": 37 /* SyntaxKind.ExclamationEqualsEqualsToken */, "=>": 38 /* SyntaxKind.EqualsGreaterThanToken */, "+": 39 /* SyntaxKind.PlusToken */, "-": 40 /* SyntaxKind.MinusToken */, "**": 42 /* SyntaxKind.AsteriskAsteriskToken */, "*": 41 /* SyntaxKind.AsteriskToken */, "/": 43 /* SyntaxKind.SlashToken */, "%": 44 /* SyntaxKind.PercentToken */, "++": 45 /* SyntaxKind.PlusPlusToken */, "--": 46 /* SyntaxKind.MinusMinusToken */, "<<": 47 /* SyntaxKind.LessThanLessThanToken */, ">": 48 /* SyntaxKind.GreaterThanGreaterThanToken */, ">>>": 49 /* SyntaxKind.GreaterThanGreaterThanGreaterThanToken */, "&": 50 /* SyntaxKind.AmpersandToken */, "|": 51 /* SyntaxKind.BarToken */, "^": 52 /* SyntaxKind.CaretToken */, "!": 53 /* SyntaxKind.ExclamationToken */, "~": 54 /* SyntaxKind.TildeToken */, "&&": 55 /* SyntaxKind.AmpersandAmpersandToken */, "||": 56 /* SyntaxKind.BarBarToken */, "?": 57 /* SyntaxKind.QuestionToken */, "??": 60 /* SyntaxKind.QuestionQuestionToken */, "?.": 28 /* SyntaxKind.QuestionDotToken */, ":": 58 /* SyntaxKind.ColonToken */, "=": 63 /* SyntaxKind.EqualsToken */, "+=": 64 /* SyntaxKind.PlusEqualsToken */, "-=": 65 /* SyntaxKind.MinusEqualsToken */, "*=": 66 /* SyntaxKind.AsteriskEqualsToken */, "**=": 67 /* SyntaxKind.AsteriskAsteriskEqualsToken */, "/=": 68 /* SyntaxKind.SlashEqualsToken */, "%=": 69 /* SyntaxKind.PercentEqualsToken */, "<<=": 70 /* SyntaxKind.LessThanLessThanEqualsToken */, ">>=": 71 /* SyntaxKind.GreaterThanGreaterThanEqualsToken */, ">>>=": 72 /* SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 73 /* SyntaxKind.AmpersandEqualsToken */, "|=": 74 /* SyntaxKind.BarEqualsToken */, "^=": 78 /* SyntaxKind.CaretEqualsToken */, "||=": 75 /* SyntaxKind.BarBarEqualsToken */, "&&=": 76 /* SyntaxKind.AmpersandAmpersandEqualsToken */, "??=": 77 /* SyntaxKind.QuestionQuestionEqualsToken */, "@": 59 /* SyntaxKind.AtToken */, "#": 62 /* SyntaxKind.HashToken */, "`": 61 /* SyntaxKind.BacktickToken */ }))); @@ -10286,7 +10357,7 @@ var ts; ts.stringToToken = stringToToken; /* @internal */ function computeLineStarts(text) { - var result = new Array(); + var result = []; var pos = 0; var lineStart = 0; while (pos < text.length) { @@ -11312,7 +11383,7 @@ var ts; return -1; } function peekExtendedUnicodeEscape() { - if (languageVersion >= 2 /* ScriptTarget.ES2015 */ && codePointAt(text, pos + 1) === 117 /* CharacterCodes.u */ && codePointAt(text, pos + 2) === 123 /* CharacterCodes.openBrace */) { + if (codePointAt(text, pos + 1) === 117 /* CharacterCodes.u */ && codePointAt(text, pos + 2) === 123 /* CharacterCodes.openBrace */) { var start_2 = pos; pos += 3; var escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false); @@ -11847,12 +11918,36 @@ var ts; pos++; return token = 0 /* SyntaxKind.Unknown */; } - if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) { + var charAfterHash = codePointAt(text, pos + 1); + if (charAfterHash === 92 /* CharacterCodes.backslash */) { + pos++; + var extendedCookedChar_1 = peekExtendedUnicodeEscape(); + if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) { + pos += 3; + tokenFlags |= 8 /* TokenFlags.ExtendedUnicodeEscape */; + tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + var cookedChar_1 = peekUnicodeEscape(); + if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) { + pos += 6; + tokenFlags |= 1024 /* TokenFlags.UnicodeEscape */; + tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + pos--; + } + if (isIdentifierStart(charAfterHash, languageVersion)) { pos++; - scanIdentifier(codePointAt(text, pos), languageVersion); + // We're relying on scanIdentifier's behavior and adjusting the token kind after the fact. + // Notably absent from this block is the fact that calling a function named "scanIdentifier", + // but identifiers don't include '#', and that function doesn't deal with it at all. + // This works because 'scanIdentifier' tries to reuse source characters and builds up substrings; + // however, it starts at the 'tokenPos' which includes the '#', and will "accidentally" prepend the '#' for us. + scanIdentifier(charAfterHash, languageVersion); } else { - tokenValue = String.fromCharCode(codePointAt(text, pos)); + tokenValue = "#"; error(ts.Diagnostics.Invalid_character, pos++, charSize(ch)); } return token = 80 /* SyntaxKind.PrivateIdentifier */; @@ -12603,9 +12698,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 163 /* SyntaxKind.TypeParameter */) { + if (d && d.kind === 165 /* SyntaxKind.TypeParameter */) { for (var current = d; current; current = current.parent) { - if (isFunctionLike(current) || isClassLike(current) || current.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (isFunctionLike(current) || isClassLike(current) || current.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return current; } } @@ -12613,7 +12708,7 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node, parent) { - return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 171 /* SyntaxKind.Constructor */; + return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 173 /* SyntaxKind.Constructor */; } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function isEmptyBindingPattern(node) { @@ -12643,14 +12738,14 @@ var ts; node = walkUpBindingElementsAndPatterns(node); } var flags = getFlags(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node && node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { flags |= getFlags(node); node = node.parent; } - if (node && node.kind === 237 /* SyntaxKind.VariableStatement */) { + if (node && node.kind === 240 /* SyntaxKind.VariableStatement */) { flags |= getFlags(node); } return flags; @@ -12823,30 +12918,30 @@ var ts; } // Covers remaining cases (returning undefined if none match). switch (hostNode.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: var expr = hostNode.expression; - if (expr.kind === 221 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (expr.kind === 223 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { expr = expr.left; } switch (expr.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return expr.name; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; } } break; - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { return getDeclarationIdentifier(hostNode.expression); } - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { if (isDeclaration(hostNode.statement) || isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -12883,16 +12978,16 @@ var ts; switch (declaration.kind) { case 79 /* SyntaxKind.Identifier */: return declaration; - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: { var name = declaration.name; - if (name.kind === 161 /* SyntaxKind.QualifiedName */) { + if (name.kind === 163 /* SyntaxKind.QualifiedName */) { return name.right; } break; } - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var expr_1 = declaration; switch (ts.getAssignmentDeclarationKind(expr_1)) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -12908,15 +13003,15 @@ var ts; return undefined; } } - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); - case 339 /* SyntaxKind.JSDocEnumTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return nameForNamelessJSDocTypedef(declaration); - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = declaration; if (ts.isBindableStaticElementAccessExpression(expr)) { return expr.argumentExpression; @@ -12960,7 +13055,7 @@ var ts; } ts.getDecorators = getDecorators; function getModifiers(node) { - if (ts.hasSyntacticModifier(node, 125951 /* ModifierFlags.Modifier */)) { + if (ts.hasSyntacticModifier(node, 126975 /* ModifierFlags.Modifier */)) { return ts.filter(node.modifiers, isModifier); } } @@ -13221,12 +13316,12 @@ var ts; /** Gets the text of a jsdoc comment, flattening links to their text. */ function getTextOfJSDocComment(comment) { return typeof comment === "string" ? comment - : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 321 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); + : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 324 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); } ts.getTextOfJSDocComment = getTextOfJSDocComment; function formatJSDocLink(link) { - var kind = link.kind === 324 /* SyntaxKind.JSDocLink */ ? "link" - : link.kind === 325 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" + var kind = link.kind === 327 /* SyntaxKind.JSDocLink */ ? "link" + : link.kind === 328 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" : "linkplain"; var name = link.name ? ts.entityNameToString(link.name) : ""; var space = link.name && link.text.startsWith("://") ? "" : " "; @@ -13247,7 +13342,7 @@ var ts; return ts.emptyArray; } if (ts.isJSDocTypeAlias(node)) { - ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDoc */); + ts.Debug.assert(node.parent.kind === 323 /* SyntaxKind.JSDoc */); return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; }); } if (node.typeParameters) { @@ -13282,7 +13377,7 @@ var ts; ts.isMemberName = isMemberName; /* @internal */ function isGetOrSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */ || node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */ || node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration; function isPropertyAccessChain(node) { @@ -13300,10 +13395,10 @@ var ts; function isOptionalChain(node) { var kind = node.kind; return !!(node.flags & 32 /* NodeFlags.OptionalChain */) && - (kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 207 /* SyntaxKind.ElementAccessExpression */ - || kind === 208 /* SyntaxKind.CallExpression */ - || kind === 230 /* SyntaxKind.NonNullExpression */); + (kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 209 /* SyntaxKind.ElementAccessExpression */ + || kind === 210 /* SyntaxKind.CallExpression */ + || kind === 232 /* SyntaxKind.NonNullExpression */); } ts.isOptionalChain = isOptionalChain; /* @internal */ @@ -13338,7 +13433,7 @@ var ts; } ts.isOutermostOptionalChain = isOutermostOptionalChain; function isNullishCoalesce(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; } ts.isNullishCoalesce = isNullishCoalesce; function isConstTypeReference(node) { @@ -13355,17 +13450,17 @@ var ts; } ts.isNonNullChain = isNonNullChain; function isBreakOrContinueStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */ || node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */ || node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isNamedExportBindings(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExportBindings = isNamedExportBindings; function isUnparsedTextLike(node) { switch (node.kind) { - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return true; default: return false; @@ -13374,12 +13469,12 @@ var ts; ts.isUnparsedTextLike = isUnparsedTextLike; function isUnparsedNode(node) { return isUnparsedTextLike(node) || - node.kind === 300 /* SyntaxKind.UnparsedPrologue */ || - node.kind === 304 /* SyntaxKind.UnparsedSyntheticReference */; + node.kind === 303 /* SyntaxKind.UnparsedPrologue */ || + node.kind === 307 /* SyntaxKind.UnparsedSyntheticReference */; } ts.isUnparsedNode = isUnparsedNode; function isJSDocPropertyLikeTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; // #endregion @@ -13395,7 +13490,7 @@ var ts; ts.isNode = isNode; /* @internal */ function isNodeKind(kind) { - return kind >= 161 /* SyntaxKind.FirstNode */; + return kind >= 163 /* SyntaxKind.FirstNode */; } ts.isNodeKind = isNodeKind; /** @@ -13404,7 +13499,7 @@ var ts; * Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail. */ function isTokenKind(kind) { - return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */; + return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 162 /* SyntaxKind.LastToken */; } ts.isTokenKind = isTokenKind; /** @@ -13419,7 +13514,7 @@ var ts; // Node Arrays /* @internal */ function isNodeArray(array) { - return array.hasOwnProperty("pos") && array.hasOwnProperty("end"); + return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end"); } ts.isNodeArray = isNodeArray; // Literals @@ -13435,11 +13530,11 @@ var ts; /** @internal */ function isLiteralExpressionOfObject(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; } return false; @@ -13467,13 +13562,13 @@ var ts; ts.isImportOrExportSpecifier = isImportOrExportSpecifier; function isTypeOnlyImportOrExportDeclaration(node) { switch (node.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return node.isTypeOnly || node.parent.parent.isTypeOnly; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.isTypeOnly; - case 267 /* SyntaxKind.ImportClause */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.isTypeOnly; default: return false; @@ -13494,6 +13589,11 @@ var ts; return ts.isIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; } ts.isGeneratedIdentifier = isGeneratedIdentifier; + /* @internal */ + function isGeneratedPrivateIdentifier(node) { + return ts.isPrivateIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; + } + ts.isGeneratedPrivateIdentifier = isGeneratedPrivateIdentifier; // Private Identifiers /*@internal*/ function isPrivateIdentifierClassElementDeclaration(node) { @@ -13510,19 +13610,20 @@ var ts; function isModifierKind(token) { switch (token) { case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 101 /* SyntaxKind.InKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; } return false; @@ -13535,7 +13636,10 @@ var ts; ts.isParameterPropertyModifier = isParameterPropertyModifier; /* @internal */ function isClassMemberModifier(idToken) { - return isParameterPropertyModifier(idToken) || idToken === 124 /* SyntaxKind.StaticKeyword */ || idToken === 159 /* SyntaxKind.OverrideKeyword */; + return isParameterPropertyModifier(idToken) || + idToken === 124 /* SyntaxKind.StaticKeyword */ || + idToken === 161 /* SyntaxKind.OverrideKeyword */ || + idToken === 127 /* SyntaxKind.AccessorKeyword */; } ts.isClassMemberModifier = isClassMemberModifier; function isModifier(node) { @@ -13544,7 +13648,7 @@ var ts; ts.isModifier = isModifier; function isEntityName(node) { var kind = node.kind; - return kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isEntityName = isEntityName; @@ -13554,14 +13658,14 @@ var ts; || kind === 80 /* SyntaxKind.PrivateIdentifier */ || kind === 10 /* SyntaxKind.StringLiteral */ || kind === 8 /* SyntaxKind.NumericLiteral */ - || kind === 162 /* SyntaxKind.ComputedPropertyName */; + || kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isPropertyName = isPropertyName; function isBindingName(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */ - || kind === 202 /* SyntaxKind.ArrayBindingPattern */; + || kind === 203 /* SyntaxKind.ObjectBindingPattern */ + || kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Functions @@ -13586,13 +13690,13 @@ var ts; ts.isBooleanLiteral = isBooleanLiteral; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -13601,14 +13705,14 @@ var ts; /* @internal */ function isFunctionLikeKind(kind) { switch (kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; default: return isFunctionLikeDeclarationKind(kind); @@ -13623,36 +13727,53 @@ var ts; // Classes function isClassElement(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 234 /* SyntaxKind.SemicolonClassElement */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */); + return node && (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isClassLike = isClassLike; function isAccessor(node) { - return node && (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */); + return node && (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */); } ts.isAccessor = isAccessor; + function isAutoAccessorPropertyDeclaration(node) { + return ts.isPropertyDeclaration(node) && ts.hasAccessorModifier(node); + } + ts.isAutoAccessorPropertyDeclaration = isAutoAccessorPropertyDeclaration; /* @internal */ function isMethodOrAccessor(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; } } ts.isMethodOrAccessor = isMethodOrAccessor; + /* @internal */ + function isNamedClassElement(node) { + switch (node.kind) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return true; + default: + return false; + } + } + ts.isNamedClassElement = isNamedClassElement; // Type members function isModifierLike(node) { return isModifier(node) || ts.isDecorator(node); @@ -13660,13 +13781,13 @@ var ts; ts.isModifierLike = isModifierLike; function isTypeElement(node) { var kind = node.kind; - return kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 174 /* SyntaxKind.CallSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 176 /* SyntaxKind.CallSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isTypeElement = isTypeElement; function isClassOrTypeElement(node) { @@ -13675,12 +13796,12 @@ var ts; ts.isClassOrTypeElement = isClassOrTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 298 /* SyntaxKind.SpreadAssignment */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 301 /* SyntaxKind.SpreadAssignment */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type @@ -13695,8 +13816,8 @@ var ts; ts.isTypeNode = isTypeNode; function isFunctionOrConstructorTypeNode(node) { switch (node.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; } return false; @@ -13707,8 +13828,8 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 202 /* SyntaxKind.ArrayBindingPattern */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return kind === 204 /* SyntaxKind.ArrayBindingPattern */ + || kind === 203 /* SyntaxKind.ObjectBindingPattern */; } return false; } @@ -13716,15 +13837,15 @@ var ts; /* @internal */ function isAssignmentPattern(node) { var kind = node.kind; - return kind === 204 /* SyntaxKind.ArrayLiteralExpression */ - || kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return kind === 206 /* SyntaxKind.ArrayLiteralExpression */ + || kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; /* @internal */ function isArrayBindingElement(node) { var kind = node.kind; - return kind === 203 /* SyntaxKind.BindingElement */ - || kind === 227 /* SyntaxKind.OmittedExpression */; + return kind === 205 /* SyntaxKind.BindingElement */ + || kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -13733,9 +13854,9 @@ var ts; /* @internal */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: return true; } return false; @@ -13756,8 +13877,8 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return true; } return false; @@ -13766,10 +13887,10 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentElement(node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty - case 298 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty + case 301 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty return true; } return false; @@ -13781,8 +13902,8 @@ var ts; /* @internal */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; } return false; @@ -13791,26 +13912,26 @@ var ts; /* @internal */ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */ - || kind === 200 /* SyntaxKind.ImportType */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */ + || kind === 202 /* SyntaxKind.ImportType */; } ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; // Expression function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: return true; default: return false; @@ -13818,12 +13939,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */ || node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */ || node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 223 /* SyntaxKind.TemplateExpression */ + return kind === 225 /* SyntaxKind.TemplateExpression */ || kind === 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; @@ -13834,19 +13955,19 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: // technically this is only an Expression if it's in a `#field in expr` BinaryExpression case 13 /* SyntaxKind.RegularExpressionLiteral */: @@ -13854,15 +13975,15 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 230 /* SyntaxKind.NonNullExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 231 /* SyntaxKind.MetaProperty */: + case 232 /* SyntaxKind.NonNullExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 233 /* SyntaxKind.MetaProperty */: case 100 /* SyntaxKind.ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: @@ -13876,13 +13997,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return true; default: return isLeftHandSideExpressionKind(kind); @@ -13891,9 +14012,9 @@ var ts; /* @internal */ function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; default: @@ -13912,15 +14033,16 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 221 /* SyntaxKind.BinaryExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 229 /* SyntaxKind.AsExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 223 /* SyntaxKind.BinaryExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 231 /* SyntaxKind.AsExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -13928,8 +14050,8 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 211 /* SyntaxKind.TypeAssertionExpression */ - || kind === 229 /* SyntaxKind.AsExpression */; + return kind === 213 /* SyntaxKind.TypeAssertionExpression */ + || kind === 231 /* SyntaxKind.AsExpression */; } ts.isAssertionExpression = isAssertionExpression; /* @internal */ @@ -13940,13 +14062,13 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -13975,7 +14097,7 @@ var ts; ts.isExternalModuleIndicator = isExternalModuleIndicator; /* @internal */ function isForInOrOfStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */ || node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */ || node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForInOrOfStatement = isForInOrOfStatement; // Element @@ -13999,115 +14121,115 @@ var ts; /* @internal */ function isModuleBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleBody = isModuleBody; /* @internal */ function isNamespaceBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isNamespaceBody = isNamespaceBody; /* @internal */ function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; /* @internal */ function isNamedImportBindings(node) { var kind = node.kind; - return kind === 269 /* SyntaxKind.NamedImports */ - || kind === 268 /* SyntaxKind.NamespaceImport */; + return kind === 272 /* SyntaxKind.NamedImports */ + || kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; /* @internal */ function isModuleOrEnumDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 203 /* SyntaxKind.BindingElement */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 299 /* SyntaxKind.EnumMember */ - || kind === 275 /* SyntaxKind.ExportSpecifier */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 267 /* SyntaxKind.ImportClause */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 270 /* SyntaxKind.ImportSpecifier */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 268 /* SyntaxKind.NamespaceImport */ - || kind === 274 /* SyntaxKind.NamespaceExport */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 254 /* SyntaxKind.VariableDeclaration */ - || kind === 345 /* SyntaxKind.JSDocTypedefTag */ - || kind === 338 /* SyntaxKind.JSDocCallbackTag */ - || kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 205 /* SyntaxKind.BindingElement */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 302 /* SyntaxKind.EnumMember */ + || kind === 278 /* SyntaxKind.ExportSpecifier */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 270 /* SyntaxKind.ImportClause */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 273 /* SyntaxKind.ImportSpecifier */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 271 /* SyntaxKind.NamespaceImport */ + || kind === 277 /* SyntaxKind.NamespaceExport */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 257 /* SyntaxKind.VariableDeclaration */ + || kind === 348 /* SyntaxKind.JSDocTypedefTag */ + || kind === 341 /* SyntaxKind.JSDocCallbackTag */ + || kind === 350 /* SyntaxKind.JSDocPropertyTag */; } function isDeclarationStatementKind(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 236 /* SyntaxKind.EmptyStatement */ - || kind === 243 /* SyntaxKind.ForInStatement */ - || kind === 244 /* SyntaxKind.ForOfStatement */ - || kind === 242 /* SyntaxKind.ForStatement */ - || kind === 239 /* SyntaxKind.IfStatement */ - || kind === 250 /* SyntaxKind.LabeledStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 249 /* SyntaxKind.SwitchStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 252 /* SyntaxKind.TryStatement */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 241 /* SyntaxKind.WhileStatement */ - || kind === 248 /* SyntaxKind.WithStatement */ - || kind === 349 /* SyntaxKind.NotEmittedStatement */ - || kind === 353 /* SyntaxKind.EndOfDeclarationMarker */ - || kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 239 /* SyntaxKind.EmptyStatement */ + || kind === 246 /* SyntaxKind.ForInStatement */ + || kind === 247 /* SyntaxKind.ForOfStatement */ + || kind === 245 /* SyntaxKind.ForStatement */ + || kind === 242 /* SyntaxKind.IfStatement */ + || kind === 253 /* SyntaxKind.LabeledStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 252 /* SyntaxKind.SwitchStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 255 /* SyntaxKind.TryStatement */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 244 /* SyntaxKind.WhileStatement */ + || kind === 251 /* SyntaxKind.WithStatement */ + || kind === 352 /* SyntaxKind.NotEmittedStatement */ + || kind === 356 /* SyntaxKind.EndOfDeclarationMarker */ + || kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { - return (node.parent && node.parent.kind !== 344 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { + return (node.parent && node.parent.kind !== 347 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); } return isDeclarationKind(node.kind); } @@ -14134,10 +14256,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 235 /* SyntaxKind.Block */) + if (node.kind !== 238 /* SyntaxKind.Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 252 /* SyntaxKind.TryStatement */ || node.parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (node.parent.kind === 255 /* SyntaxKind.TryStatement */ || node.parent.kind === 295 /* SyntaxKind.CatchClause */) { return false; } } @@ -14151,15 +14273,15 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 235 /* SyntaxKind.Block */; + || kind === 238 /* SyntaxKind.Block */; } ts.isStatementOrBlock = isStatementOrBlock; // Module references /* @internal */ function isModuleReference(node) { var kind = node.kind; - return kind === 277 /* SyntaxKind.ExternalModuleReference */ - || kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 280 /* SyntaxKind.ExternalModuleReference */ + || kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleReference = isModuleReference; @@ -14169,58 +14291,58 @@ var ts; var kind = node.kind; return kind === 108 /* SyntaxKind.ThisKeyword */ || kind === 79 /* SyntaxKind.Identifier */ - || kind === 206 /* SyntaxKind.PropertyAccessExpression */; + || kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; /* @internal */ function isJsxChild(node) { var kind = node.kind; - return kind === 278 /* SyntaxKind.JsxElement */ - || kind === 288 /* SyntaxKind.JsxExpression */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */ + return kind === 281 /* SyntaxKind.JsxElement */ + || kind === 291 /* SyntaxKind.JsxExpression */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || kind === 11 /* SyntaxKind.JsxText */ - || kind === 282 /* SyntaxKind.JsxFragment */; + || kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 10 /* SyntaxKind.StringLiteral */ - || kind === 288 /* SyntaxKind.JsxExpression */; + || kind === 291 /* SyntaxKind.JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 280 /* SyntaxKind.JsxOpeningElement */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return kind === 283 /* SyntaxKind.JsxOpeningElement */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 289 /* SyntaxKind.CaseClause */ - || kind === 290 /* SyntaxKind.DefaultClause */; + return kind === 292 /* SyntaxKind.CaseClause */ + || kind === 293 /* SyntaxKind.DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 309 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocNode */; + return node.kind >= 312 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */ - || node.kind === 319 /* SyntaxKind.JSDocNamepathType */ - || node.kind === 321 /* SyntaxKind.JSDocText */ + return node.kind === 323 /* SyntaxKind.JSDoc */ + || node.kind === 322 /* SyntaxKind.JSDocNamepathType */ + || node.kind === 324 /* SyntaxKind.JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) @@ -14230,15 +14352,15 @@ var ts; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 327 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocTagNode */; + return node.kind >= 330 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessor = isSetAccessor; function isGetAccessor(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessor = isGetAccessor; /** True if has jsdoc nodes attached to it. */ @@ -14264,12 +14386,12 @@ var ts; /** True if has initializer node attached to it. */ function hasOnlyExpressionInitializer(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: return true; default: return false; @@ -14277,12 +14399,12 @@ var ts; } ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */ || node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); + return node.kind === 288 /* SyntaxKind.JsxAttribute */ || node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); } ts.isObjectLiteralElement = isObjectLiteralElement; /* @internal */ function isTypeReferenceType(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -14315,7 +14437,7 @@ var ts; } ts.isStringLiteralLike = isStringLiteralLike; function isJSDocLinkLike(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */ || node.kind === 325 /* SyntaxKind.JSDocLinkCode */ || node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 327 /* SyntaxKind.JSDocLink */ || node.kind === 328 /* SyntaxKind.JSDocLinkCode */ || node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkLike = isJSDocLinkLike; function hasRestParameter(s) { @@ -14325,7 +14447,7 @@ var ts; ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type; - return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.dotDotDotToken !== undefined || !!type && type.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isRestParameter = isRestParameter; // #endregion @@ -14583,7 +14705,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 305 /* SyntaxKind.SourceFile */) { + while (node && node.kind !== 308 /* SyntaxKind.SourceFile */) { node = node.parent; } return node; @@ -14599,11 +14721,11 @@ var ts; ts.isPlainJsFile = isPlainJsFile; function isStatementWithLocals(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return true; } return false; @@ -14799,7 +14921,7 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 348 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { + if (node.kind === 351 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, @@ -14864,7 +14986,6 @@ var ts; return emitNode && emitNode.flags || 0; } ts.getEmitFlags = getEmitFlags; - ; function getScriptTargetFeatures() { return { es2015: { @@ -15037,7 +15158,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -15069,11 +15190,11 @@ var ts; ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return !!node && node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && (!node.body); + return !!node && node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || + return node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || ts.isFunctionLikeOrClassStaticBlockDeclaration(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -15090,9 +15211,9 @@ var ts; // - defined in the top level scope and source file is an external module // - defined inside ambient module declaration located in the top level scope and source file not an external module switch (node.parent.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node.parent); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -15147,26 +15268,30 @@ var ts; return false; } ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile; + function isAmbientPropertyDeclaration(node) { + return !!(node.flags & 16777216 /* NodeFlags.Ambient */) || hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); + } + ts.isAmbientPropertyDeclaration = isAmbientPropertyDeclaration; function isBlockScope(node, parentNode) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 292 /* SyntaxKind.CatchClause */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return !ts.isFunctionLikeOrClassStaticBlockDeclaration(parentNode); @@ -15176,9 +15301,9 @@ var ts; ts.isBlockScope = isBlockScope; function isDeclarationWithTypeParameters(node) { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 323 /* SyntaxKind.JSDocSignature */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 326 /* SyntaxKind.JSDocSignature */: return true; default: ts.assertType(node); @@ -15188,25 +15313,25 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isDeclarationWithTypeParameterChildren(node) { switch (node.kind) { - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: ts.assertType(node); @@ -15216,8 +15341,8 @@ var ts; ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren; function isAnyImportSyntax(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -15230,15 +15355,15 @@ var ts; ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire; function isLateVisibilityPaintedStatement(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return true; default: return false; @@ -15279,19 +15404,19 @@ var ts; } ts.getNameFromIndexInfo = getNameFromIndexInfo; function isComputedNonLiteralName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); } ts.isComputedNonLiteralName = isComputedNonLiteralName; function tryGetTextOfPropertyName(name) { switch (name.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - return name.escapedText; + return name.autoGenerateFlags ? undefined : name.escapedText; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: if (isStringOrNumericLiteralLike(name.expression)) return ts.escapeLeadingUnderscores(name.expression.text); return undefined; @@ -15311,16 +15436,16 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: case 79 /* SyntaxKind.Identifier */: return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (ts.isIdentifier(name.name) || ts.isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { return ts.Debug.assertNever(name.name); } - case 311 /* SyntaxKind.JSDocMemberName */: + case 314 /* SyntaxKind.JSDocMemberName */: return entityNameToString(name.left) + entityNameToString(name.right); default: return ts.Debug.assertNever(name); @@ -15410,7 +15535,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body && node.body.kind === 238 /* SyntaxKind.Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -15424,7 +15549,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -15433,29 +15558,29 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 268 /* SyntaxKind.NamespaceImport */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 271 /* SyntaxKind.NamespaceImport */: errorNode = node.name; break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: var start = ts.skipTrivia(sourceFile.text, node.pos); var end = node.statements.length > 0 ? node.statements[0].pos : node.end; return ts.createTextSpanFromBounds(start, end); @@ -15507,11 +15632,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; } ts.isImportCall = isImportCall; function isImportMeta(n) { @@ -15525,7 +15650,7 @@ var ts; } ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */ + return node.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.expression.kind === 10 /* SyntaxKind.StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -15553,13 +15678,13 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 164 /* SyntaxKind.Parameter */ || - node.kind === 163 /* SyntaxKind.TypeParameter */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 214 /* SyntaxKind.ArrowFunction */ || - node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */) ? + var commentRanges = (node.kind === 166 /* SyntaxKind.Parameter */ || + node.kind === 165 /* SyntaxKind.TypeParameter */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 216 /* SyntaxKind.ArrowFunction */ || + node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); // True if the comment starts with '/**' but not if it is '/**/' @@ -15575,48 +15700,48 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (177 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return true; case 114 /* SyntaxKind.VoidKeyword */: - return node.parent.kind !== 217 /* SyntaxKind.VoidExpression */; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + return node.parent.kind !== 219 /* SyntaxKind.VoidExpression */; + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 163 /* SyntaxKind.TypeParameter */: - return node.parent.kind === 195 /* SyntaxKind.MappedType */ || node.parent.kind === 190 /* SyntaxKind.InferType */; + case 165 /* SyntaxKind.TypeParameter */: + return node.parent.kind === 197 /* SyntaxKind.MappedType */ || node.parent.kind === 192 /* SyntaxKind.InferType */; // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case 79 /* SyntaxKind.Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); // falls through - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 108 /* SyntaxKind.ThisKeyword */: { var parent = node.parent; - if (parent.kind === 181 /* SyntaxKind.TypeQuery */) { + if (parent.kind === 183 /* SyntaxKind.TypeQuery */) { return false; } - if (parent.kind === 200 /* SyntaxKind.ImportType */) { + if (parent.kind === 202 /* SyntaxKind.ImportType */) { return !parent.isTypeOf; } // Do not recursively call isPartOfTypeNode on the parent. In the example: @@ -15625,40 +15750,40 @@ var ts; // // Calling isPartOfTypeNode would consider the qualified name A.B a type node. // Only C and A.B.C are type nodes. - if (177 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (parent.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent); - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return node === parent.constraint; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return node === parent.constraint; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return node === parent.type; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return node === parent.type; - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return node === parent.type; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return node === parent.type; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.contains(parent.typeArguments, node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -15683,23 +15808,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitor(node); - case 263 /* SyntaxKind.CaseBlock */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 266 /* SyntaxKind.CaseBlock */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return ts.forEachChild(node, traverse); } } @@ -15709,23 +15834,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, skip them to avoid the work. return; default: if (ts.isFunctionLike(node)) { - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. traverse(node.name.expression); @@ -15748,10 +15873,10 @@ var ts; * @param node The type node. */ function getRestParameterElementType(node) { - if (node && node.kind === 183 /* SyntaxKind.ArrayType */) { + if (node && node.kind === 185 /* SyntaxKind.ArrayType */) { return node.elementType; } - else if (node && node.kind === 178 /* SyntaxKind.TypeReference */) { + else if (node && node.kind === 180 /* SyntaxKind.TypeReference */) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -15761,12 +15886,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 182 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 184 /* SyntaxKind.TypeLiteral */: return node.members; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return node.properties; } } @@ -15774,14 +15899,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 299 /* SyntaxKind.EnumMember */: - case 164 /* SyntaxKind.Parameter */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 302 /* SyntaxKind.EnumMember */: + case 166 /* SyntaxKind.Parameter */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } } @@ -15793,8 +15918,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ - && node.parent.parent.kind === 237 /* SyntaxKind.VariableStatement */; + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ + && node.parent.parent.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isCommonJsExportedExpression(node) { @@ -15818,13 +15943,13 @@ var ts; ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return true; } return false; @@ -15835,7 +15960,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 250 /* SyntaxKind.LabeledStatement */) { + if (node.statement.kind !== 253 /* SyntaxKind.LabeledStatement */) { return node.statement; } node = node.statement; @@ -15843,17 +15968,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); + return node && node.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethodOrAccessor(node) { - return (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) && - (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || - node.parent.kind === 226 /* SyntaxKind.ClassExpression */); + return (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) && + (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || + node.parent.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethodOrAccessor = isObjectLiteralOrClassExpressionMethodOrAccessor; function isIdentifierTypePredicate(predicate) { @@ -15866,7 +15991,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return objectLiteral.properties.filter(function (property) { - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */) { var propName = tryGetTextOfPropertyName(property.name); return key === propName || (!!key2 && key2 === propName); } @@ -15928,14 +16053,14 @@ var ts; } ts.getContainingFunctionOrClassStaticBlock = getContainingFunctionOrClassStaticBlock; function getThisContainer(node, includeArrowFunctions) { - ts.Debug.assert(node.kind !== 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(node.kind !== 308 /* SyntaxKind.SourceFile */); while (true) { node = node.parent; if (!node) { return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that. } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -15950,9 +16075,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -15963,27 +16088,27 @@ var ts; node = node.parent; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (!includeArrowFunctions) { continue; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 305 /* SyntaxKind.SourceFile */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 308 /* SyntaxKind.SourceFile */: return node; } } @@ -15996,17 +16121,17 @@ var ts; switch (node.kind) { // Arrow functions use the same scope, but may do so in a "delayed" manner // For example, `const getThis = () => this` may be before a super() call in a derived constructor - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Object properties can have computed names; only method-like bodies start a new scope return true; default: @@ -16030,9 +16155,9 @@ var ts; var container = getThisContainer(node, /*includeArrowFunctions*/ false); if (container) { switch (container.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return container; } } @@ -16054,28 +16179,28 @@ var ts; return node; } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: node = node.parent; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (!stopOnFunctions) { continue; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return node; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -16091,14 +16216,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 213 /* SyntaxKind.FunctionExpression */ || func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 215 /* SyntaxKind.FunctionExpression */ || func.kind === 216 /* SyntaxKind.ArrowFunction */) { var prev = func; var parent = func.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { prev = parent; parent = parent.parent; } - if (parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === prev) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === prev) { return parent; } } @@ -16114,7 +16239,7 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperProperty = isSuperProperty; @@ -16123,7 +16248,7 @@ var ts; */ function isThisProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 108 /* SyntaxKind.ThisKeyword */; } ts.isThisProperty = isThisProperty; @@ -16142,15 +16267,15 @@ var ts; ts.isThisInitializedObjectBindingExpression = isThisInitializedObjectBindingExpression; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return node; } return undefined; @@ -16158,10 +16283,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return node.tag; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return node.tagName; default: return node.expression; @@ -16174,25 +16299,25 @@ var ts; return false; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // classes are valid targets return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + return parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 164 /* SyntaxKind.Parameter */: + && parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 166 /* SyntaxKind.Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; return parent.body !== undefined - && (parent.kind === 171 /* SyntaxKind.Constructor */ - || parent.kind === 169 /* SyntaxKind.MethodDeclaration */ - || parent.kind === 173 /* SyntaxKind.SetAccessor */) - && grandparent.kind === 257 /* SyntaxKind.ClassDeclaration */; + && (parent.kind === 173 /* SyntaxKind.Constructor */ + || parent.kind === 171 /* SyntaxKind.MethodDeclaration */ + || parent.kind === 175 /* SyntaxKind.SetAccessor */) + && grandparent.kind === 260 /* SyntaxKind.ClassDeclaration */; } return false; } @@ -16208,11 +16333,11 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217 - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217 default: return false; @@ -16228,9 +16353,9 @@ var ts; ts.classOrConstructorParameterIsDecorated = classOrConstructorParameterIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 280 /* SyntaxKind.JsxOpeningElement */ || - parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || - parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (parent.kind === 283 /* SyntaxKind.JsxOpeningElement */ || + parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || + parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return parent.tagName === node; } return false; @@ -16243,53 +16368,54 @@ var ts; case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 221 /* SyntaxKind.BinaryExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 223 /* SyntaxKind.TemplateExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 224 /* SyntaxKind.YieldExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 225 /* SyntaxKind.TemplateExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 226 /* SyntaxKind.YieldExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 233 /* SyntaxKind.MetaProperty */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return !ts.isHeritageClause(node.parent); - case 161 /* SyntaxKind.QualifiedName */: - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + case 163 /* SyntaxKind.QualifiedName */: + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); - case 311 /* SyntaxKind.JSDocMemberName */: + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + case 314 /* SyntaxKind.JSDocMemberName */: while (ts.isJSDocMemberName(node.parent)) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); case 80 /* SyntaxKind.PrivateIdentifier */: return ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; case 79 /* SyntaxKind.Identifier */: - if (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { + if (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { return true; } // falls through @@ -16307,60 +16433,62 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: return parent.initializer === node; - case 238 /* SyntaxKind.ExpressionStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 251 /* SyntaxKind.ThrowStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 254 /* SyntaxKind.ThrowStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forInStatement.expression === node; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return node === parent.expression; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node === parent.expression; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return node === parent.expression; - case 165 /* SyntaxKind.Decorator */: - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 167 /* SyntaxKind.Decorator */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 301 /* SyntaxKind.SpreadAssignment */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return parent.expression === node && !isPartOfTypeNode(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return parent.objectAssignmentInitializer === node; + case 235 /* SyntaxKind.SatisfiesExpression */: + return node === parent.expression; default: return isExpressionNode(parent); } } ts.isInExpressionContext = isInExpressionContext; function isPartOfTypeQuery(node) { - while (node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { + while (node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { node = node.parent; } - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isPartOfTypeQuery = isPartOfTypeQuery; function isNamespaceReexportDeclaration(node) { @@ -16368,7 +16496,7 @@ var ts; } ts.isNamespaceReexportDeclaration = isNamespaceReexportDeclaration; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -16381,7 +16509,7 @@ var ts; } ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJS(file) { @@ -16413,11 +16541,11 @@ var ts; ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && - (node.typeArguments[0].kind === 150 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */); + (node.typeArguments[0].kind === 152 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */); } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, requireStringLiteralLikeArgument) { - if (callExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (callExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -16526,11 +16654,11 @@ var ts; function getExpandoInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 213 /* SyntaxKind.FunctionExpression */ || e.kind === 214 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; + return e.kind === 215 /* SyntaxKind.FunctionExpression */ || e.kind === 216 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; } - if (initializer.kind === 213 /* SyntaxKind.FunctionExpression */ || - initializer.kind === 226 /* SyntaxKind.ClassExpression */ || - initializer.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (initializer.kind === 215 /* SyntaxKind.FunctionExpression */ || + initializer.kind === 228 /* SyntaxKind.ClassExpression */ || + initializer.kind === 216 /* SyntaxKind.ArrowFunction */) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -16776,7 +16904,7 @@ var ts; ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJSFile(expr) && - expr.parent && expr.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + expr.parent && expr.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && (!ts.isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!ts.getJSDocTypeTag(expr.parent); } @@ -16797,17 +16925,17 @@ var ts; return false; } var decl = symbol.valueDeclaration; - return decl.kind === 256 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); + return decl.kind === 259 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); } ts.isFunctionSymbol = isFunctionSymbol; function tryGetModuleSpecifierFromDeclaration(node) { var _a, _b; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0]; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike); default: ts.Debug.assertNever(node); @@ -16820,14 +16948,14 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function tryGetImportFromModuleSpecifier(node) { switch (node.parent.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.parent; - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return node.parent.parent; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return isImportCall(node.parent) || isRequireCall(node.parent, /*checkArg*/ false) ? node.parent : undefined; - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: ts.Debug.assert(ts.isStringLiteral(node)); return ts.tryCast(node.parent.parent, ts.isImportTypeNode); default: @@ -16837,16 +16965,16 @@ var ts; ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; - case 200 /* SyntaxKind.ImportType */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + return node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 202 /* SyntaxKind.ImportType */: return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return node.arguments[0]; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node.name.kind === 10 /* SyntaxKind.StringLiteral */ ? node.name : undefined; default: return ts.Debug.assertNever(node); @@ -16855,11 +16983,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.exportClause && ts.tryCast(node.exportClause, ts.isNamespaceExport); default: return ts.Debug.assertNever(node); @@ -16867,7 +16995,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function forEachImportClauseDeclaration(node, action) { @@ -16888,13 +17016,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return node.questionToken !== undefined; } } @@ -16908,7 +17036,7 @@ var ts; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function isJSDocTypeAlias(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 338 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 341 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocTypeAlias = isJSDocTypeAlias; function isTypeAlias(node) { @@ -16933,12 +17061,12 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return node.initializer; } } @@ -16950,7 +17078,7 @@ var ts; function getNestedModuleDeclaration(node) { return ts.isModuleDeclaration(node) && node.body && - node.body.kind === 261 /* SyntaxKind.ModuleDeclaration */ + node.body.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? node.body : undefined; } @@ -16965,11 +17093,11 @@ var ts; if (ts.hasJSDocNodes(node)) { result = ts.addRange(result, filterOwnedJSDocTags(hostNode, ts.last(node.jsDoc))); } - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocParameterTagsNoCache : ts.getJSDocParameterTags)(node)); break; } - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocTypeParameterTagsNoCache : ts.getJSDocTypeParameterTags)(node)); break; } @@ -16998,11 +17126,11 @@ var ts; } function getNextJSDocCommentLocation(node) { var parent = node.parent; - if (parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - parent.kind === 271 /* SyntaxKind.ExportAssignment */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 247 /* SyntaxKind.ReturnStatement */ || + if (parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + parent.kind === 274 /* SyntaxKind.ExportAssignment */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 250 /* SyntaxKind.ReturnStatement */ || getNestedModuleDeclaration(parent) || ts.isBinaryExpression(node) && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return parent; @@ -17112,34 +17240,34 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 63 /* SyntaxKind.EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* AssignmentKind.Definite */ : 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 45 /* SyntaxKind.PlusPlusToken */ || unaryOperator === 46 /* SyntaxKind.MinusMinusToken */ ? 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return parent.initializer === node ? 1 /* AssignmentKind.Definite */ : 0 /* AssignmentKind.None */; - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 232 /* SyntaxKind.NonNullExpression */: node = parent; break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: node = parent.parent; break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* AssignmentKind.None */; } node = parent.parent; break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (parent.name === node) { return 0 /* AssignmentKind.None */; } @@ -17166,22 +17294,22 @@ var ts; */ function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 237 /* SyntaxKind.VariableStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 238 /* SyntaxKind.Block */: + case 240 /* SyntaxKind.VariableStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return true; } return false; @@ -17198,11 +17326,11 @@ var ts; return node; } function walkUpParenthesizedTypes(node) { - return walkUp(node, 191 /* SyntaxKind.ParenthesizedType */); + return walkUp(node, 193 /* SyntaxKind.ParenthesizedType */); } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 212 /* SyntaxKind.ParenthesizedExpression */); + return walkUp(node, 214 /* SyntaxKind.ParenthesizedExpression */); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; /** @@ -17212,7 +17340,7 @@ var ts; */ function walkUpParenthesizedTypesAndGetParentAndChild(node) { var child; - while (node && node.kind === 191 /* SyntaxKind.ParenthesizedType */) { + while (node && node.kind === 193 /* SyntaxKind.ParenthesizedType */) { child = node; node = node.parent; } @@ -17234,11 +17362,11 @@ var ts; ts.skipParentheses = skipParentheses; // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped function isDeleteTarget(node) { - if (node.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 207 /* SyntaxKind.ElementAccessExpression */) { + if (node.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 209 /* SyntaxKind.ElementAccessExpression */) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node && node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -17291,7 +17419,7 @@ var ts; ts.getDeclarationFromName = getDeclarationFromName; function isLiteralComputedPropertyDeclarationName(node) { return isStringOrNumericLiteralLike(node) && - node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */ && + node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */ && ts.isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; @@ -17299,29 +17427,29 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: // Name on right hand side of dot in a type query or type reference return parent.right === node; - case 203 /* SyntaxKind.BindingElement */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 275 /* SyntaxKind.ExportSpecifier */: - case 285 /* SyntaxKind.JsxAttribute */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 288 /* SyntaxKind.JsxAttribute */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: // Any name in an export specifier or JSX Attribute or Jsx Element return true; } @@ -17344,14 +17472,14 @@ var ts; // const x = require("...").y // const { x } = require("...").y function isAliasSymbolDeclaration(node) { - if (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name || - node.kind === 268 /* SyntaxKind.NamespaceImport */ || - node.kind === 274 /* SyntaxKind.NamespaceExport */ || - node.kind === 270 /* SyntaxKind.ImportSpecifier */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { + if (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name || + node.kind === 271 /* SyntaxKind.NamespaceImport */ || + node.kind === 277 /* SyntaxKind.NamespaceExport */ || + node.kind === 273 /* SyntaxKind.ImportSpecifier */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { return true; } return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && exportAssignmentIsAlias(node) || @@ -17364,18 +17492,18 @@ var ts; ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getAliasDeclarationFromName(node) { switch (node.parent.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 271 /* SyntaxKind.ExportAssignment */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 274 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.parent; - } while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */); + } while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */); return getAliasDeclarationFromName(node); } } @@ -17394,7 +17522,7 @@ var ts; } ts.getExportAssignmentExpression = getExportAssignmentExpression; function getPropertyAssignmentAliasLikeExpression(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.initializer : + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.initializer : node.parent.right; } ts.getPropertyAssignmentAliasLikeExpression = getPropertyAssignmentAliasLikeExpression; @@ -17460,11 +17588,11 @@ var ts; } ts.getAncestor = getAncestor; function isKeyword(token) { - return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 160 /* SyntaxKind.LastKeyword */; + return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 162 /* SyntaxKind.LastKeyword */; } ts.isKeyword = isKeyword; function isContextualKeyword(token) { - return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 160 /* SyntaxKind.LastContextualKeyword */; + return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 162 /* SyntaxKind.LastContextualKeyword */; } ts.isContextualKeyword = isContextualKeyword; function isNonContextualKeyword(token) { @@ -17508,15 +17636,15 @@ var ts; } var flags = 0 /* FunctionFlags.Normal */; switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { flags |= 1 /* FunctionFlags.Generator */; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: - if (hasSyntacticModifier(node, 256 /* ModifierFlags.Async */)) { + case 216 /* SyntaxKind.ArrowFunction */: + if (hasSyntacticModifier(node, 512 /* ModifierFlags.Async */)) { flags |= 2 /* FunctionFlags.Async */; } break; @@ -17529,13 +17657,13 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return node.body !== undefined && node.asteriskToken === undefined - && hasSyntacticModifier(node, 256 /* ModifierFlags.Async */); + && hasSyntacticModifier(node, 512 /* ModifierFlags.Async */); } return false; } @@ -17562,7 +17690,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - if (!(name.kind === 162 /* SyntaxKind.ComputedPropertyName */ || name.kind === 207 /* SyntaxKind.ElementAccessExpression */)) { + if (!(name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || name.kind === 209 /* SyntaxKind.ElementAccessExpression */)) { return false; } var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression; @@ -17578,7 +17706,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameExpression = name.expression; if (isStringOrNumericLiteralLike(nameExpression)) { return ts.escapeLeadingUnderscores(nameExpression.text); @@ -17644,11 +17772,11 @@ var ts; ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 164 /* SyntaxKind.Parameter */; + return root.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 203 /* SyntaxKind.BindingElement */) { + while (node.kind === 205 /* SyntaxKind.BindingElement */) { node = node.parent.parent; } return node; @@ -17656,15 +17784,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 305 /* SyntaxKind.SourceFile */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 308 /* SyntaxKind.SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -17683,23 +17811,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 0 /* Associativity.Left */ : 1 /* Associativity.Right */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 1 /* Associativity.Right */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operator) { case 42 /* SyntaxKind.AsteriskAsteriskToken */: case 63 /* SyntaxKind.EqualsToken */: @@ -17726,15 +17854,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expression.kind === 223 /* SyntaxKind.BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 220 /* SyntaxKind.PostfixUnaryExpression */) { + else if (expression.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 222 /* SyntaxKind.PostfixUnaryExpression */) { return expression.operator; } else { @@ -17913,15 +18041,15 @@ var ts; })(OperatorPrecedence = ts.OperatorPrecedence || (ts.OperatorPrecedence = {})); function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return 0 /* OperatorPrecedence.Comma */; - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return 1 /* OperatorPrecedence.Spread */; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 2 /* OperatorPrecedence.Yield */; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return 4 /* OperatorPrecedence.Conditional */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operatorKind) { case 27 /* SyntaxKind.CommaToken */: return 0 /* OperatorPrecedence.Comma */; @@ -17946,26 +18074,27 @@ var ts; return getBinaryOperatorPrecedence(operatorKind); } // TODO: Should prefix `++` and `--` be moved to the `Update` precedence? - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return 16 /* OperatorPrecedence.Unary */; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return 17 /* OperatorPrecedence.Update */; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return 18 /* OperatorPrecedence.LeftHandSide */; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 19 /* OperatorPrecedence.Member */ : 18 /* OperatorPrecedence.LeftHandSide */; - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 233 /* SyntaxKind.MetaProperty */: return 19 /* OperatorPrecedence.Member */; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return 11 /* OperatorPrecedence.Relational */; case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: @@ -17977,19 +18106,19 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 225 /* SyntaxKind.TemplateExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: return 20 /* OperatorPrecedence.Primary */; default: return -1 /* OperatorPrecedence.Invalid */; @@ -18021,7 +18150,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: return 11 /* OperatorPrecedence.Relational */; case 47 /* SyntaxKind.LessThanLessThanToken */: case 48 /* SyntaxKind.GreaterThanGreaterThanToken */: @@ -18045,7 +18175,7 @@ var ts; function getSemanticJsxChildren(children) { return ts.filter(children, function (i) { switch (i.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !!i.expression; case 11 /* SyntaxKind.JsxText */: return !i.containsOnlyTriviaWhiteSpaces; @@ -18101,7 +18231,7 @@ var ts; } diagnostics = nonFileDiagnostics; } - ts.insertSorted(diagnostics, diagnostic, compareDiagnostics); + ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation); } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -18637,7 +18767,7 @@ var ts; while (ts.isQualifiedName(node.parent) && node.parent.left === node) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */; + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isThisInTypeQuery = isThisInTypeQuery; function identifierIsThisKeyword(id) { @@ -18652,10 +18782,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { + if (accessor.kind === 174 /* SyntaxKind.GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { setAccessor = accessor; } else { @@ -18675,10 +18805,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 172 /* SyntaxKind.GetAccessor */ && !getAccessor) { + if (member.kind === 174 /* SyntaxKind.GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && !setAccessor) { + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -18727,7 +18857,7 @@ var ts; ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations; /** template tags are only available when a typedef isn't already using them */ function isNonTypeAliasTemplate(tag) { - return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 320 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); + return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 323 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); } /** * Gets the effective type annotation of the value parameter of a set accessor. If the node @@ -18960,13 +19090,17 @@ var ts; } ts.hasOverrideModifier = hasOverrideModifier; function hasAbstractModifier(node) { - return hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + return hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); } ts.hasAbstractModifier = hasAbstractModifier; function hasAmbientModifier(node) { return hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); } ts.hasAmbientModifier = hasAmbientModifier; + function hasAccessorModifier(node) { + return hasSyntacticModifier(node, 128 /* ModifierFlags.Accessor */); + } + ts.hasAccessorModifier = hasAccessorModifier; function hasEffectiveReadonlyModifier(node) { return hasEffectiveModifier(node, 64 /* ModifierFlags.Readonly */); } @@ -18984,7 +19118,7 @@ var ts; } ts.getSelectedSyntacticModifierFlags = getSelectedSyntacticModifierFlags; function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) { - if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 162 /* SyntaxKind.LastToken */) { return 0 /* ModifierFlags.None */; } if (!(node.modifierFlagsCache & 536870912 /* ModifierFlags.HasComputedFlags */)) { @@ -19076,25 +19210,22 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: return 4 /* ModifierFlags.Public */; case 122 /* SyntaxKind.ProtectedKeyword */: return 16 /* ModifierFlags.Protected */; case 121 /* SyntaxKind.PrivateKeyword */: return 8 /* ModifierFlags.Private */; - case 126 /* SyntaxKind.AbstractKeyword */: return 128 /* ModifierFlags.Abstract */; + case 126 /* SyntaxKind.AbstractKeyword */: return 256 /* ModifierFlags.Abstract */; + case 127 /* SyntaxKind.AccessorKeyword */: return 128 /* ModifierFlags.Accessor */; case 93 /* SyntaxKind.ExportKeyword */: return 1 /* ModifierFlags.Export */; - case 135 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; + case 136 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; case 85 /* SyntaxKind.ConstKeyword */: return 2048 /* ModifierFlags.Const */; - case 88 /* SyntaxKind.DefaultKeyword */: return 512 /* ModifierFlags.Default */; - case 131 /* SyntaxKind.AsyncKeyword */: return 256 /* ModifierFlags.Async */; - case 145 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; - case 159 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; + case 88 /* SyntaxKind.DefaultKeyword */: return 1024 /* ModifierFlags.Default */; + case 132 /* SyntaxKind.AsyncKeyword */: return 512 /* ModifierFlags.Async */; + case 146 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; + case 161 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; case 101 /* SyntaxKind.InKeyword */: return 32768 /* ModifierFlags.In */; - case 144 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; - case 165 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; + case 145 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; + case 167 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; } return 0 /* ModifierFlags.None */; } ts.modifierToFlag = modifierToFlag; - function createModifiers(modifierFlags) { - return modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; - } - ts.createModifiers = createModifiers; function isLogicalOperator(token) { return token === 56 /* SyntaxKind.BarBarToken */ || token === 55 /* SyntaxKind.AmpersandAmpersandToken */ @@ -19144,8 +19275,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 205 /* SyntaxKind.ObjectLiteralExpression */ - || kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return kind === 207 /* SyntaxKind.ObjectLiteralExpression */ + || kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } return false; } @@ -19162,12 +19293,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 79 /* SyntaxKind.Identifier */); @@ -19179,9 +19310,9 @@ var ts; return node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 108 /* SyntaxKind.ThisKeyword */ || node.kind === 106 /* SyntaxKind.SuperKeyword */ - || node.kind === 231 /* SyntaxKind.MetaProperty */ - || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) - || node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); + || node.kind === 233 /* SyntaxKind.MetaProperty */ + || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) + || node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); } ts.isDottedName = isDottedName; function isPropertyAccessEntityNameExpression(node) { @@ -19212,8 +19343,8 @@ var ts; } ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isRightSideOfAccessExpression(node) { @@ -19228,12 +19359,12 @@ var ts; } ts.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName = isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName; function isEmptyObjectLiteral(expression) { - return expression.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + return expression.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && + return expression.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -19249,7 +19380,7 @@ var ts; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function isExportDefaultSymbol(symbol) { - return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 512 /* ModifierFlags.Default */); + return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 1024 /* ModifierFlags.Default */); } /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ function tryExtractTSExtension(fileName) { @@ -19394,21 +19525,17 @@ var ts; return getStringFromExpandedCharCodes(expandedCharCodes); } ts.base64decode = base64decode; + function readJsonOrUndefined(path, hostOrText) { + var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path); + if (!jsonText) + return undefined; + // gracefully handle if readFile fails or returns not JSON + var result = ts.parseConfigFileTextToJson(path, jsonText); + return !result.error ? result.config : undefined; + } + ts.readJsonOrUndefined = readJsonOrUndefined; function readJson(path, host) { - try { - var jsonText = host.readFile(path); - if (!jsonText) - return {}; - var result = ts.parseConfigFileTextToJson(path, jsonText); - if (result.error) { - return {}; - } - return result.config; - } - catch (e) { - // gracefully handle if readFile fails or returns not JSON - return {}; - } + return readJsonOrUndefined(path, host) || {}; } ts.readJson = readJson; function directoryProbablyExists(directoryName, host) { @@ -19567,8 +19694,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -19584,7 +19711,7 @@ var ts; } function isWatchSet(options) { // Firefox has Object.prototype.watch - return options.watch && options.hasOwnProperty("watch"); + return options.watch && ts.hasProperty(options, "watch"); } ts.isWatchSet = isWatchSet; function closeFileWatcher(watcher) { @@ -19648,35 +19775,35 @@ var ts; if (!parent) return 0 /* AccessKind.Read */; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return accessKind(parent); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var operator = parent.operator; return operator === 45 /* SyntaxKind.PlusPlusToken */ || operator === 46 /* SyntaxKind.MinusMinusToken */ ? writeOrReadWrite() : 0 /* AccessKind.Read */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ ? 1 /* AccessKind.Write */ : writeOrReadWrite() : 0 /* AccessKind.Read */; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node ? 0 /* AccessKind.Read */ : accessKind(parent); - case 296 /* SyntaxKind.PropertyAssignment */: { + case 299 /* SyntaxKind.PropertyAssignment */: { var parentAccess = accessKind(parent.parent); // In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write. return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess; } - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals. return node === parent.objectAssignmentInitializer ? 0 /* AccessKind.Read */ : accessKind(parent.parent); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return accessKind(parent); default: return 0 /* AccessKind.Read */; } function writeOrReadWrite() { // If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect. - return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 238 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; + return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 241 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; } } function reverseAccessKind(a) { @@ -19758,7 +19885,7 @@ var ts; function isAbstractConstructorSymbol(symbol) { if (symbol.flags & 32 /* SymbolFlags.Class */) { var declaration = getClassLikeDeclarationOfSymbol(symbol); - return !!declaration && hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + return !!declaration && hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); } return false; } @@ -19820,37 +19947,37 @@ var ts; } ts.isObjectTypeDeclaration = isObjectTypeDeclaration; function isTypeNodeKind(kind) { - return (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) - || kind === 130 /* SyntaxKind.AnyKeyword */ - || kind === 155 /* SyntaxKind.UnknownKeyword */ - || kind === 147 /* SyntaxKind.NumberKeyword */ - || kind === 158 /* SyntaxKind.BigIntKeyword */ - || kind === 148 /* SyntaxKind.ObjectKeyword */ - || kind === 133 /* SyntaxKind.BooleanKeyword */ - || kind === 150 /* SyntaxKind.StringKeyword */ - || kind === 151 /* SyntaxKind.SymbolKeyword */ + return (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) + || kind === 131 /* SyntaxKind.AnyKeyword */ + || kind === 157 /* SyntaxKind.UnknownKeyword */ + || kind === 148 /* SyntaxKind.NumberKeyword */ + || kind === 160 /* SyntaxKind.BigIntKeyword */ + || kind === 149 /* SyntaxKind.ObjectKeyword */ + || kind === 134 /* SyntaxKind.BooleanKeyword */ + || kind === 152 /* SyntaxKind.StringKeyword */ + || kind === 153 /* SyntaxKind.SymbolKeyword */ || kind === 114 /* SyntaxKind.VoidKeyword */ - || kind === 153 /* SyntaxKind.UndefinedKeyword */ - || kind === 143 /* SyntaxKind.NeverKeyword */ - || kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ - || kind === 312 /* SyntaxKind.JSDocAllType */ - || kind === 313 /* SyntaxKind.JSDocUnknownType */ - || kind === 314 /* SyntaxKind.JSDocNullableType */ - || kind === 315 /* SyntaxKind.JSDocNonNullableType */ - || kind === 316 /* SyntaxKind.JSDocOptionalType */ - || kind === 317 /* SyntaxKind.JSDocFunctionType */ - || kind === 318 /* SyntaxKind.JSDocVariadicType */; + || kind === 155 /* SyntaxKind.UndefinedKeyword */ + || kind === 144 /* SyntaxKind.NeverKeyword */ + || kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ + || kind === 315 /* SyntaxKind.JSDocAllType */ + || kind === 316 /* SyntaxKind.JSDocUnknownType */ + || kind === 317 /* SyntaxKind.JSDocNullableType */ + || kind === 318 /* SyntaxKind.JSDocNonNullableType */ + || kind === 319 /* SyntaxKind.JSDocOptionalType */ + || kind === 320 /* SyntaxKind.JSDocFunctionType */ + || kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isTypeNodeKind = isTypeNodeKind; function isAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isAccessExpression = isAccessExpression; function getNameOfAccessExpression(node) { - if (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { return node.name; } - ts.Debug.assert(node.kind === 207 /* SyntaxKind.ElementAccessExpression */); + ts.Debug.assert(node.kind === 209 /* SyntaxKind.ElementAccessExpression */); return node.argumentExpression; } ts.getNameOfAccessExpression = getNameOfAccessExpression; @@ -19865,7 +19992,7 @@ var ts; } ts.isBundleFileTextLike = isBundleFileTextLike; function isNamedImportsOrExports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 272 /* SyntaxKind.NamedImports */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedImportsOrExports = isNamedImportsOrExports; function getLeftmostAccessExpression(expr) { @@ -19880,13 +20007,13 @@ var ts; return walkAccessExpression(name.parent); } function walkAccessExpression(access) { - if (access.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (access.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var res = action(access.name); if (res !== undefined) { return res; } } - else if (access.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + else if (access.kind === 209 /* SyntaxKind.ElementAccessExpression */) { if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) { var res = action(access.argumentExpression); if (res !== undefined) { @@ -19913,28 +20040,29 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: node = node.operand; continue; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: node = node.left; continue; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: node = node.condition; continue; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: node = node.tag; continue; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (stopAtCallExpressions) { return node; } // falls through - case 229 /* SyntaxKind.AsExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: node = node.expression; continue; } @@ -21170,17 +21298,17 @@ var ts; return ts.isIdentifier(useSite) && ts.isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite; } function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { - while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } - if (hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */)) { + if (hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */)) { return true; } var containerKind = node.parent.parent.kind; - return containerKind === 258 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 182 /* SyntaxKind.TypeLiteral */; + return containerKind === 261 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 184 /* SyntaxKind.TypeLiteral */; } /** Returns true for an identifier in 1) an `implements` clause, and 2) an `extends` clause of an interface. */ function isIdentifierInNonEmittingHeritageClause(node) { @@ -21188,16 +21316,16 @@ var ts; return false; var heritageClause = ts.findAncestor(node.parent, function (parent) { switch (parent.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return false; default: return "quit"; } }); - return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 258 /* SyntaxKind.InterfaceDeclaration */; + return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 261 /* SyntaxKind.InterfaceDeclaration */; } function isIdentifierTypeReference(node) { return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName); @@ -21358,22 +21486,22 @@ var ts; if (!node.parent) return undefined; switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: var parent_1 = node.parent; - return parent_1.kind === 190 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; - case 164 /* SyntaxKind.Parameter */: + return parent_1.kind === 192 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; + case 166 /* SyntaxKind.Parameter */: return node.parent.parameters; - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return node.parent.templateSpans; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node.parent.templateSpans; - case 165 /* SyntaxKind.Decorator */: { + case 167 /* SyntaxKind.Decorator */: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return node.parent.heritageClauses; } var parent = node.parent; @@ -21381,45 +21509,45 @@ var ts; return ts.isJSDocTypeLiteral(node.parent) ? undefined : node.parent.tags; } switch (parent.kind) { - case 182 /* SyntaxKind.TypeLiteral */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.isTypeElement(node) ? parent.members : undefined; - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return parent.types; - case 184 /* SyntaxKind.TupleType */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 186 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return parent.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 286 /* SyntaxKind.JsxAttributes */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 289 /* SyntaxKind.JsxAttributes */: return parent.properties; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.isTypeNode(node) ? parent.typeArguments : parent.expression === node ? undefined : parent.arguments; - case 278 /* SyntaxKind.JsxElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 285 /* SyntaxKind.JsxFragment */: return ts.isJsxChild(node) ? parent.children : undefined; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return ts.isTypeNode(node) ? parent.typeArguments : undefined; - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: return parent.statements; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return parent.clauses; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.isClassElement(node) ? parent.members : undefined; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.isEnumMember(node) ? parent.members : undefined; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return parent.statements; } } @@ -21431,7 +21559,7 @@ var ts; if (ts.some(node.parameters, function (p) { return !getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { // If the first parameter is not an explicit 'this' parameter, then the function has // an implicit 'this' parameter which is subject to contextual typing. var parameter = ts.firstOrUndefined(node.parameters); @@ -21449,7 +21577,7 @@ var ts; } ts.isInfinityOrNaNString = isInfinityOrNaNString; function isCatchClauseVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function isParameterOrCatchClauseVariable(symbol) { @@ -21458,7 +21586,7 @@ var ts; } ts.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable; function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */ || node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */ || node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction; function escapeSnippetText(text) { @@ -21555,9 +21683,35 @@ var ts; ts.getNodeModulePathParts = getNodeModulePathParts; function getParameterTypeNode(parameter) { var _a; - return parameter.kind === 340 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; + return parameter.kind === 343 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; } ts.getParameterTypeNode = getParameterTypeNode; + function isTypeDeclaration(node) { + switch (node.kind) { + case 165 /* SyntaxKind.TypeParameter */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + return true; + case 270 /* SyntaxKind.ImportClause */: + return node.isTypeOnly; + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: + return node.parent.parent.isTypeOnly; + default: + return false; + } + } + ts.isTypeDeclaration = isTypeDeclaration; + function canHaveExportModifier(node) { + return ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) + || ts.isInterfaceDeclaration(node) || isTypeDeclaration(node) || (ts.isModuleDeclaration(node) && !isExternalModuleAugmentation(node) && !isGlobalScopeAugmentation(node)); + } + ts.canHaveExportModifier = canHaveExportModifier; })(ts || (ts = {})); /* @internal */ var ts; @@ -21566,13 +21720,11 @@ var ts; * Creates a `BaseNodeFactory` which can be used to create `Node` instances from the constructors provided by the object allocator. */ function createBaseNodeFactory() { - // tslint:disable variable-name var NodeConstructor; var TokenConstructor; var IdentifierConstructor; var PrivateIdentifierConstructor; var SourceFileConstructor; - // tslint:enable variable-name return { createBaseSourceFileNode: createBaseSourceFileNode, createBaseIdentifierNode: createBaseIdentifierNode, @@ -21680,10 +21832,10 @@ var ts; // // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve // the intended order of operations: `(a ** b) ** c` - var binaryOperatorPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(221 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(223 /* SyntaxKind.BinaryExpression */, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); - if (!isLeftSideOfBinary && operand.kind === 214 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { + if (!isLeftSideOfBinary && operand.kind === 216 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { // We need to parenthesize arrow functions on the right side to avoid it being // parsed as parenthesized expression: `a && (() => {})` return true; @@ -21695,7 +21847,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Associativity.Right */ - && operand.kind === 224 /* SyntaxKind.YieldExpression */) { + && operand.kind === 226 /* SyntaxKind.YieldExpression */) { return false; } return true; @@ -21764,13 +21916,15 @@ var ts; // (a|b)|c -> a|(b|c) -> a|b|c // (a&b)&c -> a&(b&c) -> a&b&c // (a^b)^c -> a^(b^c) -> a^b^c + // (a,b),c -> a,(b,c) -> a,b,c // // While addition is associative in mathematics, JavaScript's `+` is not // guaranteed to be associative as it is overloaded with string concatenation. return binaryOperator === 41 /* SyntaxKind.AsteriskToken */ || binaryOperator === 51 /* SyntaxKind.BarToken */ || binaryOperator === 50 /* SyntaxKind.AmpersandToken */ - || binaryOperator === 52 /* SyntaxKind.CaretToken */; + || binaryOperator === 52 /* SyntaxKind.CaretToken */ + || binaryOperator === 27 /* SyntaxKind.CommaToken */; } /** * This function determines whether an expression consists of a homogeneous set of @@ -21783,7 +21937,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -21809,7 +21963,7 @@ var ts; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = ts.skipPartiallyEmittedExpressions(operand); // If the resulting expression is already parenthesized, we do not need to do any further processing. - if (skipped.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (skipped.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -21826,7 +21980,7 @@ var ts; return ts.isCommaSequence(expression) ? factory.createParenthesizedExpression(expression) : expression; } function parenthesizeConditionOfConditionalExpression(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(222 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(224 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) !== 1 /* Comparison.GreaterThan */) { @@ -21859,8 +22013,8 @@ var ts; var needsParens = ts.isCommaSequence(check); if (!needsParens) { switch (ts.getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: needsParens = true; } } @@ -21873,9 +22027,9 @@ var ts; function parenthesizeExpressionOfNew(expression) { var leftmostExpr = ts.getLeftmostExpression(expression, /*stopAtCallExpressions*/ true); switch (leftmostExpr.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return factory.createParenthesizedExpression(expression); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return !leftmostExpr.arguments ? factory.createParenthesizedExpression(expression) : expression; // TODO(rbuckton): Verify this assertion holds @@ -21895,7 +22049,7 @@ var ts; // var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 209 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) + && (emittedExpression.kind !== 211 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) && (optionalChain || !ts.isOptionalChain(emittedExpression))) { // TODO(rbuckton): Verify whether this assertion holds. return expression; @@ -21918,7 +22072,7 @@ var ts; function parenthesizeExpressionForDisallowedComma(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } @@ -21927,21 +22081,21 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 213 /* SyntaxKind.FunctionExpression */ || kind === 214 /* SyntaxKind.ArrowFunction */) { + if (kind === 215 /* SyntaxKind.FunctionExpression */ || kind === 216 /* SyntaxKind.ArrowFunction */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. var updated = factory.updateCallExpression(emittedExpression, ts.setTextRange(factory.createParenthesizedExpression(callee), callee), emittedExpression.typeArguments, emittedExpression.arguments); return factory.restoreOuterExpressions(expression, updated, 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */); } } var leftmostExpressionKind = ts.getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind; - if (leftmostExpressionKind === 205 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 213 /* SyntaxKind.FunctionExpression */) { + if (leftmostExpressionKind === 207 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 215 /* SyntaxKind.FunctionExpression */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } return expression; } function parenthesizeConciseBodyOfArrowFunction(body) { - if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(body), body); } @@ -21959,16 +22113,16 @@ var ts; // - The true and false branch types (the second and third `Type` non-terminals, above) allow any type function parenthesizeCheckTypeOfConditionalType(checkType) { switch (checkType.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 189 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(checkType); } return checkType; } function parenthesizeExtendsTypeOfConditionalType(extendsType) { switch (extendsType.kind) { - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(extendsType); } return extendsType; @@ -21980,8 +22134,8 @@ var ts; // - A union type constituent has the same precedence as the check type of a conditional type function parenthesizeConstituentTypeOfUnionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 189 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeCheckTypeOfConditionalType(type); @@ -21996,8 +22150,8 @@ var ts; // - An intersection type constituent does not allow function, constructor, conditional, or union types (they must be parenthesized) function parenthesizeConstituentTypeOfIntersectionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfUnionType(type); @@ -22014,14 +22168,14 @@ var ts; // function parenthesizeOperandOfTypeOperator(type) { switch (type.kind) { - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfIntersectionType(type); } function parenthesizeOperandOfReadonlyTypeOperator(type) { switch (type.kind) { - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22041,9 +22195,9 @@ var ts; // function parenthesizeNonArrayTypeOfPostfixType(type) { switch (type.kind) { - case 190 /* SyntaxKind.InferType */: - case 193 /* SyntaxKind.TypeOperator */: - case 181 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 192 /* SyntaxKind.InferType */: + case 195 /* SyntaxKind.TypeOperator */: + case 183 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22237,11 +22391,11 @@ var ts; } function convertToAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -22335,6 +22489,8 @@ var ts; createUniqueName: createUniqueName, getGeneratedNameForNode: getGeneratedNameForNode, createPrivateIdentifier: createPrivateIdentifier, + createUniquePrivateName: createUniquePrivateName, + getGeneratedPrivateNameForNode: getGeneratedPrivateNameForNode, createToken: createToken, createSuper: createSuper, createThis: createThis, @@ -22497,6 +22653,8 @@ var ts; updateAsExpression: updateAsExpression, createNonNullExpression: createNonNullExpression, updateNonNullExpression: updateNonNullExpression, + createSatisfiesExpression: createSatisfiesExpression, + updateSatisfiesExpression: updateSatisfiesExpression, createNonNullChain: createNonNullChain, updateNonNullChain: updateNonNullChain, createMetaProperty: createMetaProperty, @@ -22594,18 +22752,18 @@ var ts; createExternalModuleReference: createExternalModuleReference, updateExternalModuleReference: updateExternalModuleReference, // lazily load factory members for JSDoc types with similar structure - get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312 /* SyntaxKind.JSDocAllType */); }, - get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313 /* SyntaxKind.JSDocUnknownType */); }, - get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, - get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, + get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(315 /* SyntaxKind.JSDocAllType */); }, + get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(316 /* SyntaxKind.JSDocUnknownType */); }, + get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, + get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, createJSDocFunctionType: createJSDocFunctionType, updateJSDocFunctionType: updateJSDocFunctionType, createJSDocTypeLiteral: createJSDocTypeLiteral, @@ -22641,30 +22799,30 @@ var ts; createJSDocLinkPlain: createJSDocLinkPlain, updateJSDocLinkPlain: updateJSDocLinkPlain, // lazily load factory members for JSDoc tags with similar structure - get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, - get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, + get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, + get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, createJSDocUnknownTag: createJSDocUnknownTag, updateJSDocUnknownTag: updateJSDocUnknownTag, createJSDocText: createJSDocText, @@ -22867,11 +23025,11 @@ var ts; // don't propagate child flags. if (name) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isIdentifier(name)) { node.transformFlags |= propagateIdentifierNameFlags(name); break; @@ -23020,23 +23178,29 @@ var ts; node.escapedText = ts.escapeLeadingUnderscores(text); return node; } - function createBaseGeneratedIdentifier(text, autoGenerateFlags) { + function createBaseGeneratedIdentifier(text, autoGenerateFlags, prefix, suffix) { var node = createBaseIdentifier(text, /*originalKeywordKind*/ undefined); node.autoGenerateFlags = autoGenerateFlags; node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; nextAutoGenerateId++; return node; } // @api - function createIdentifier(text, typeArguments, originalKeywordKind) { + function createIdentifier(text, typeArguments, originalKeywordKind, hasExtendedUnicodeEscape) { var node = createBaseIdentifier(text, originalKeywordKind); if (typeArguments) { // NOTE: we do not use `setChildren` here because typeArguments in an identifier do not contribute to transformations node.typeArguments = createNodeArray(typeArguments); } - if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { node.transformFlags |= 67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; } + if (hasExtendedUnicodeEscape) { + node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape; + node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; + } return node; } // @api @@ -23046,11 +23210,11 @@ var ts; : node; } // @api - function createTempVariable(recordTempVariable, reservedInNestedScopes) { + function createTempVariable(recordTempVariable, reservedInNestedScopes, prefix, suffix) { var flags = 1 /* GeneratedIdentifierFlags.Auto */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - var name = createBaseGeneratedIdentifier("", flags); + var name = createBaseGeneratedIdentifier("", flags, prefix, suffix); if (recordTempVariable) { recordTempVariable(name); } @@ -23062,34 +23226,69 @@ var ts; var flags = 2 /* GeneratedIdentifierFlags.Loop */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - return createBaseGeneratedIdentifier("", flags); + return createBaseGeneratedIdentifier("", flags, /*prefix*/ undefined, /*suffix*/ undefined); } /** Create a unique name based on the supplied text. */ // @api - function createUniqueName(text, flags) { + function createUniqueName(text, flags, prefix, suffix) { if (flags === void 0) { flags = 0 /* GeneratedIdentifierFlags.None */; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); ts.Debug.assert((flags & (16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */)) !== 32 /* GeneratedIdentifierFlags.FileLevel */, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"); - return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags); + return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags, prefix, suffix); } /** Create a unique name generated for a node. */ // @api - function getGeneratedNameForNode(node, flags) { + function getGeneratedNameForNode(node, flags, prefix, suffix) { if (flags === void 0) { flags = 0; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); - var name = createBaseGeneratedIdentifier(node && ts.isIdentifier(node) ? ts.idText(node) : "", 4 /* GeneratedIdentifierFlags.Node */ | flags); + var text = !node ? "" : + ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ false, prefix, node, suffix, ts.idText) : + "generated@".concat(ts.getNodeId(node)); + if (prefix || suffix) + flags |= 16 /* GeneratedIdentifierFlags.Optimistic */; + var name = createBaseGeneratedIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); name.original = node; return name; } + function createBasePrivateIdentifier(text) { + var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); + node.escapedText = ts.escapeLeadingUnderscores(text); + node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return node; + } // @api function createPrivateIdentifier(text) { if (!ts.startsWith(text, "#")) ts.Debug.fail("First character of private identifier must be #: " + text); - var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); - node.escapedText = ts.escapeLeadingUnderscores(text); - node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return createBasePrivateIdentifier(text); + } + function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags, prefix, suffix) { + var node = createBasePrivateIdentifier(text); + node.autoGenerateFlags = autoGenerateFlags; + node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; + nextAutoGenerateId++; return node; } + /** Create a unique name based on the supplied text. */ + // @api + function createUniquePrivateName(text, prefix, suffix) { + if (text && !ts.startsWith(text, "#")) + ts.Debug.fail("First character of private identifier must be #: " + text); + var autoGenerateFlags = 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */ | + (text ? 3 /* GeneratedIdentifierFlags.Unique */ : 1 /* GeneratedIdentifierFlags.Auto */); + return createBaseGeneratedPrivateIdentifier(text !== null && text !== void 0 ? text : "", autoGenerateFlags, prefix, suffix); + } + // @api + function getGeneratedPrivateNameForNode(node, prefix, suffix) { + var text = ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ true, prefix, node, suffix, ts.idText) : + "#generated@".concat(ts.getNodeId(node)); + var flags = prefix || suffix ? 16 /* GeneratedIdentifierFlags.Optimistic */ : 0 /* GeneratedIdentifierFlags.None */; + var name = createBaseGeneratedPrivateIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); + name.original = node; + return name; + } // // Punctuation // @@ -23097,14 +23296,14 @@ var ts; return baseFactory.createBaseTokenNode(kind); } function createToken(token) { - ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 160 /* SyntaxKind.LastToken */, "Invalid token"); + ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 162 /* SyntaxKind.LastToken */, "Invalid token"); ts.Debug.assert(token <= 14 /* SyntaxKind.FirstTemplateToken */ || token >= 17 /* SyntaxKind.LastTemplateToken */, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."); ts.Debug.assert(token <= 8 /* SyntaxKind.FirstLiteralToken */ || token >= 14 /* SyntaxKind.LastLiteralToken */, "Invalid token. Use 'createLiteralLikeNode' to create literals."); ts.Debug.assert(token !== 79 /* SyntaxKind.Identifier */, "Invalid token. Use 'createIdentifier' to create identifiers"); var node = createBaseToken(token); var transformFlags = 0 /* TransformFlags.None */; switch (token) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // 'async' modifier is ES2017 (async functions) or ES2018 (async generators) transformFlags = 256 /* TransformFlags.ContainsES2017 */ | @@ -23113,24 +23312,24 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. + case 157 /* SyntaxKind.UnknownKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. transformFlags = 1 /* TransformFlags.ContainsTypeScript */; break; case 106 /* SyntaxKind.SuperKeyword */: @@ -23139,6 +23338,9 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: transformFlags = 1024 /* TransformFlags.ContainsES2015 */; break; + case 127 /* SyntaxKind.AccessorKeyword */: + transformFlags = 16777216 /* TransformFlags.ContainsClassFields */; + break; case 108 /* SyntaxKind.ThisKeyword */: // 'this' indicates a lexical 'this' transformFlags = 16384 /* TransformFlags.ContainsLexicalThis */; @@ -23185,8 +23387,8 @@ var ts; if (flags & 1 /* ModifierFlags.Export */) result.push(createModifier(93 /* SyntaxKind.ExportKeyword */)); if (flags & 2 /* ModifierFlags.Ambient */) - result.push(createModifier(135 /* SyntaxKind.DeclareKeyword */)); - if (flags & 512 /* ModifierFlags.Default */) + result.push(createModifier(136 /* SyntaxKind.DeclareKeyword */)); + if (flags & 1024 /* ModifierFlags.Default */) result.push(createModifier(88 /* SyntaxKind.DefaultKeyword */)); if (flags & 2048 /* ModifierFlags.Const */) result.push(createModifier(85 /* SyntaxKind.ConstKeyword */)); @@ -23196,20 +23398,22 @@ var ts; result.push(createModifier(121 /* SyntaxKind.PrivateKeyword */)); if (flags & 16 /* ModifierFlags.Protected */) result.push(createModifier(122 /* SyntaxKind.ProtectedKeyword */)); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push(createModifier(126 /* SyntaxKind.AbstractKeyword */)); if (flags & 32 /* ModifierFlags.Static */) result.push(createModifier(124 /* SyntaxKind.StaticKeyword */)); if (flags & 16384 /* ModifierFlags.Override */) - result.push(createModifier(159 /* SyntaxKind.OverrideKeyword */)); + result.push(createModifier(161 /* SyntaxKind.OverrideKeyword */)); if (flags & 64 /* ModifierFlags.Readonly */) - result.push(createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); - if (flags & 256 /* ModifierFlags.Async */) - result.push(createModifier(131 /* SyntaxKind.AsyncKeyword */)); + result.push(createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); + if (flags & 128 /* ModifierFlags.Accessor */) + result.push(createModifier(127 /* SyntaxKind.AccessorKeyword */)); + if (flags & 512 /* ModifierFlags.Async */) + result.push(createModifier(132 /* SyntaxKind.AsyncKeyword */)); if (flags & 32768 /* ModifierFlags.In */) result.push(createModifier(101 /* SyntaxKind.InKeyword */)); if (flags & 65536 /* ModifierFlags.Out */) - result.push(createModifier(144 /* SyntaxKind.OutKeyword */)); + result.push(createModifier(145 /* SyntaxKind.OutKeyword */)); return result.length ? result : undefined; } // @@ -23217,7 +23421,7 @@ var ts; // // @api function createQualifiedName(left, right) { - var node = createBaseNode(161 /* SyntaxKind.QualifiedName */); + var node = createBaseNode(163 /* SyntaxKind.QualifiedName */); node.left = left; node.right = asName(right); node.transformFlags |= @@ -23234,7 +23438,7 @@ var ts; } // @api function createComputedPropertyName(expression) { - var node = createBaseNode(162 /* SyntaxKind.ComputedPropertyName */); + var node = createBaseNode(164 /* SyntaxKind.ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23253,7 +23457,7 @@ var ts; // // @api function createTypeParameterDeclaration(modifiers, name, constraint, defaultType) { - var node = createBaseNamedDeclaration(163 /* SyntaxKind.TypeParameter */, modifiers, name); + var node = createBaseNamedDeclaration(165 /* SyntaxKind.TypeParameter */, modifiers, name); node.constraint = constraint; node.default = defaultType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23270,7 +23474,7 @@ var ts; } // @api function createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(164 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + var node = createBaseVariableLikeDeclaration(166 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.dotDotDotToken = dotDotDotToken; node.questionToken = questionToken; if (ts.isThisIdentifier(node.name)) { @@ -23302,7 +23506,7 @@ var ts; } // @api function createDecorator(expression) { - var node = createBaseNode(165 /* SyntaxKind.Decorator */); + var node = createBaseNode(167 /* SyntaxKind.Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23322,7 +23526,7 @@ var ts; // // @api function createPropertySignature(modifiers, name, questionToken, type) { - var node = createBaseNamedDeclaration(166 /* SyntaxKind.PropertySignature */, modifiers, name); + var node = createBaseNamedDeclaration(168 /* SyntaxKind.PropertySignature */, modifiers, name); node.type = type; node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23348,7 +23552,7 @@ var ts; } // @api function createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(167 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); + var node = createBaseVariableLikeDeclaration(169 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); node.questionToken = questionOrExclamationToken && ts.isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= @@ -23376,7 +23580,7 @@ var ts; } // @api function createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(168 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(170 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23394,7 +23598,7 @@ var ts; } // @api function createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(169 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.questionToken = questionToken; node.transformFlags |= @@ -23404,7 +23608,7 @@ var ts; if (questionToken) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -23440,7 +23644,7 @@ var ts; } // @api function createClassStaticBlockDeclaration(body) { - var node = createBaseGenericNamedDeclaration(170 /* SyntaxKind.ClassStaticBlockDeclaration */, + var node = createBaseGenericNamedDeclaration(172 /* SyntaxKind.ClassStaticBlockDeclaration */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined); @@ -23466,7 +23670,7 @@ var ts; } // @api function createConstructorDeclaration(modifiers, parameters, body) { - var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.Constructor */, modifiers, + var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.Constructor */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); @@ -23495,7 +23699,7 @@ var ts; } // @api function createGetAccessorDeclaration(modifiers, name, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(172 /* SyntaxKind.GetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(174 /* SyntaxKind.GetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, type, body); // The following properties are used only to report grammar errors node.typeParameters = undefined; @@ -23519,7 +23723,7 @@ var ts; } // @api function createSetAccessorDeclaration(modifiers, name, parameters, body) { - var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.SetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(175 /* SyntaxKind.SetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); // The following properties are used only to report grammar errors @@ -23545,7 +23749,7 @@ var ts; } // @api function createCallSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(174 /* SyntaxKind.CallSignature */, + var node = createBaseSignatureDeclaration(176 /* SyntaxKind.CallSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23561,7 +23765,7 @@ var ts; } // @api function createConstructSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(175 /* SyntaxKind.ConstructSignature */, + var node = createBaseSignatureDeclaration(177 /* SyntaxKind.ConstructSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23577,7 +23781,7 @@ var ts; } // @api function createIndexSignature(modifiers, parameters, type) { - var node = createBaseSignatureDeclaration(176 /* SyntaxKind.IndexSignature */, modifiers, + var node = createBaseSignatureDeclaration(178 /* SyntaxKind.IndexSignature */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23593,7 +23797,7 @@ var ts; } // @api function createTemplateLiteralTypeSpan(type, literal) { - var node = createBaseNode(199 /* SyntaxKind.TemplateLiteralTypeSpan */); + var node = createBaseNode(201 /* SyntaxKind.TemplateLiteralTypeSpan */); node.type = type; node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23615,7 +23819,7 @@ var ts; } // @api function createTypePredicateNode(assertsModifier, parameterName, type) { - var node = createBaseNode(177 /* SyntaxKind.TypePredicate */); + var node = createBaseNode(179 /* SyntaxKind.TypePredicate */); node.assertsModifier = assertsModifier; node.parameterName = asName(parameterName); node.type = type; @@ -23632,7 +23836,7 @@ var ts; } // @api function createTypeReferenceNode(typeName, typeArguments) { - var node = createBaseNode(178 /* SyntaxKind.TypeReference */); + var node = createBaseNode(180 /* SyntaxKind.TypeReference */); node.typeName = asName(typeName); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(createNodeArray(typeArguments)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23647,7 +23851,7 @@ var ts; } // @api function createFunctionTypeNode(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(179 /* SyntaxKind.FunctionType */, + var node = createBaseSignatureDeclaration(181 /* SyntaxKind.FunctionType */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23680,7 +23884,7 @@ var ts; ts.Debug.fail("Incorrect number of arguments specified."); } function createConstructorTypeNode1(modifiers, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(180 /* SyntaxKind.ConstructorType */, modifiers, + var node = createBaseSignatureDeclaration(182 /* SyntaxKind.ConstructorType */, modifiers, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23713,7 +23917,7 @@ var ts; } // @api function createTypeQueryNode(exprName, typeArguments) { - var node = createBaseNode(181 /* SyntaxKind.TypeQuery */); + var node = createBaseNode(183 /* SyntaxKind.TypeQuery */); node.exprName = exprName; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23728,7 +23932,7 @@ var ts; } // @api function createTypeLiteralNode(members) { - var node = createBaseNode(182 /* SyntaxKind.TypeLiteral */); + var node = createBaseNode(184 /* SyntaxKind.TypeLiteral */); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23741,7 +23945,7 @@ var ts; } // @api function createArrayTypeNode(elementType) { - var node = createBaseNode(183 /* SyntaxKind.ArrayType */); + var node = createBaseNode(185 /* SyntaxKind.ArrayType */); node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23754,7 +23958,7 @@ var ts; } // @api function createTupleTypeNode(elements) { - var node = createBaseNode(184 /* SyntaxKind.TupleType */); + var node = createBaseNode(186 /* SyntaxKind.TupleType */); node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23767,7 +23971,7 @@ var ts; } // @api function createNamedTupleMember(dotDotDotToken, name, questionToken, type) { - var node = createBaseNode(197 /* SyntaxKind.NamedTupleMember */); + var node = createBaseNode(199 /* SyntaxKind.NamedTupleMember */); node.dotDotDotToken = dotDotDotToken; node.name = name; node.questionToken = questionToken; @@ -23786,7 +23990,7 @@ var ts; } // @api function createOptionalTypeNode(type) { - var node = createBaseNode(185 /* SyntaxKind.OptionalType */); + var node = createBaseNode(187 /* SyntaxKind.OptionalType */); node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23799,7 +24003,7 @@ var ts; } // @api function createRestTypeNode(type) { - var node = createBaseNode(186 /* SyntaxKind.RestType */); + var node = createBaseNode(188 /* SyntaxKind.RestType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23823,7 +24027,7 @@ var ts; } // @api function createUnionTypeNode(types) { - return createUnionOrIntersectionTypeNode(187 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); + return createUnionOrIntersectionTypeNode(189 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } // @api function updateUnionTypeNode(node, types) { @@ -23831,7 +24035,7 @@ var ts; } // @api function createIntersectionTypeNode(types) { - return createUnionOrIntersectionTypeNode(188 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); + return createUnionOrIntersectionTypeNode(190 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } // @api function updateIntersectionTypeNode(node, types) { @@ -23839,7 +24043,7 @@ var ts; } // @api function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { - var node = createBaseNode(189 /* SyntaxKind.ConditionalType */); + var node = createBaseNode(191 /* SyntaxKind.ConditionalType */); node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType); node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType); node.trueType = trueType; @@ -23858,7 +24062,7 @@ var ts; } // @api function createInferTypeNode(typeParameter) { - var node = createBaseNode(190 /* SyntaxKind.InferType */); + var node = createBaseNode(192 /* SyntaxKind.InferType */); node.typeParameter = typeParameter; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23871,7 +24075,7 @@ var ts; } // @api function createTemplateLiteralType(head, templateSpans) { - var node = createBaseNode(198 /* SyntaxKind.TemplateLiteralType */); + var node = createBaseNode(200 /* SyntaxKind.TemplateLiteralType */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23887,7 +24091,7 @@ var ts; // @api function createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf) { if (isTypeOf === void 0) { isTypeOf = false; } - var node = createBaseNode(200 /* SyntaxKind.ImportType */); + var node = createBaseNode(202 /* SyntaxKind.ImportType */); node.argument = argument; node.assertions = assertions; node.qualifier = qualifier; @@ -23909,7 +24113,7 @@ var ts; } // @api function createParenthesizedType(type) { - var node = createBaseNode(191 /* SyntaxKind.ParenthesizedType */); + var node = createBaseNode(193 /* SyntaxKind.ParenthesizedType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23922,15 +24126,15 @@ var ts; } // @api function createThisTypeNode() { - var node = createBaseNode(192 /* SyntaxKind.ThisType */); + var node = createBaseNode(194 /* SyntaxKind.ThisType */); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; } // @api function createTypeOperatorNode(operator, type) { - var node = createBaseNode(193 /* SyntaxKind.TypeOperator */); + var node = createBaseNode(195 /* SyntaxKind.TypeOperator */); node.operator = operator; - node.type = operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + node.type = operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : parenthesizerRules().parenthesizeOperandOfTypeOperator(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23944,7 +24148,7 @@ var ts; } // @api function createIndexedAccessTypeNode(objectType, indexType) { - var node = createBaseNode(194 /* SyntaxKind.IndexedAccessType */); + var node = createBaseNode(196 /* SyntaxKind.IndexedAccessType */); node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType); node.indexType = indexType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23959,7 +24163,7 @@ var ts; } // @api function createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members) { - var node = createBaseNode(195 /* SyntaxKind.MappedType */); + var node = createBaseNode(197 /* SyntaxKind.MappedType */); node.readonlyToken = readonlyToken; node.typeParameter = typeParameter; node.nameType = nameType; @@ -23982,7 +24186,7 @@ var ts; } // @api function createLiteralTypeNode(literal) { - var node = createBaseNode(196 /* SyntaxKind.LiteralType */); + var node = createBaseNode(198 /* SyntaxKind.LiteralType */); node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23998,7 +24202,7 @@ var ts; // // @api function createObjectBindingPattern(elements) { - var node = createBaseNode(201 /* SyntaxKind.ObjectBindingPattern */); + var node = createBaseNode(203 /* SyntaxKind.ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24019,7 +24223,7 @@ var ts; } // @api function createArrayBindingPattern(elements) { - var node = createBaseNode(202 /* SyntaxKind.ArrayBindingPattern */); + var node = createBaseNode(204 /* SyntaxKind.ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24035,7 +24239,7 @@ var ts; } // @api function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createBaseBindingLikeDeclaration(203 /* SyntaxKind.BindingElement */, + var node = createBaseBindingLikeDeclaration(205 /* SyntaxKind.BindingElement */, /*modifiers*/ undefined, name, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; @@ -24070,7 +24274,7 @@ var ts; } // @api function createArrayLiteralExpression(elements, multiLine) { - var node = createBaseExpression(204 /* SyntaxKind.ArrayLiteralExpression */); + var node = createBaseExpression(206 /* SyntaxKind.ArrayLiteralExpression */); // Ensure we add a trailing comma for something like `[NumericLiteral(1), NumericLiteral(2), OmittedExpresion]` so that // we end up with `[1, 2, ,]` instead of `[1, 2, ]` otherwise the `OmittedExpression` will just end up being treated like // a trailing comma. @@ -24089,7 +24293,7 @@ var ts; } // @api function createObjectLiteralExpression(properties, multiLine) { - var node = createBaseExpression(205 /* SyntaxKind.ObjectLiteralExpression */); + var node = createBaseExpression(207 /* SyntaxKind.ObjectLiteralExpression */); node.properties = createNodeArray(properties); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.properties); @@ -24103,7 +24307,7 @@ var ts; } // @api function createPropertyAccessExpression(expression, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.name = asName(name); node.transformFlags = @@ -24132,7 +24336,7 @@ var ts; } // @api function createPropertyAccessChain(expression, questionDotToken, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24159,7 +24363,7 @@ var ts; } // @api function createElementAccessExpression(expression, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.argumentExpression = asExpression(index); node.transformFlags |= @@ -24186,7 +24390,7 @@ var ts; } // @api function createElementAccessChain(expression, questionDotToken, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24211,7 +24415,7 @@ var ts; } // @api function createCallExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray)); @@ -24243,7 +24447,7 @@ var ts; } // @api function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24275,7 +24479,7 @@ var ts; } // @api function createNewExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(209 /* SyntaxKind.NewExpression */); + var node = createBaseExpression(211 /* SyntaxKind.NewExpression */); node.expression = parenthesizerRules().parenthesizeExpressionOfNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(argumentsArray) : undefined; @@ -24299,7 +24503,7 @@ var ts; } // @api function createTaggedTemplateExpression(tag, typeArguments, template) { - var node = createBaseExpression(210 /* SyntaxKind.TaggedTemplateExpression */); + var node = createBaseExpression(212 /* SyntaxKind.TaggedTemplateExpression */); node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.template = template; @@ -24326,7 +24530,7 @@ var ts; } // @api function createTypeAssertion(type, expression) { - var node = createBaseExpression(211 /* SyntaxKind.TypeAssertionExpression */); + var node = createBaseExpression(213 /* SyntaxKind.TypeAssertionExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.type = type; node.transformFlags |= @@ -24344,7 +24548,7 @@ var ts; } // @api function createParenthesizedExpression(expression) { - var node = createBaseExpression(212 /* SyntaxKind.ParenthesizedExpression */); + var node = createBaseExpression(214 /* SyntaxKind.ParenthesizedExpression */); node.expression = expression; node.transformFlags = propagateChildFlags(node.expression); return node; @@ -24357,13 +24561,13 @@ var ts; } // @api function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(213 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(215 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.asteriskToken); if (node.typeParameters) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -24390,13 +24594,13 @@ var ts; } // @api function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createBaseFunctionLikeDeclaration(214 /* SyntaxKind.ArrowFunction */, modifiers, + var node = createBaseFunctionLikeDeclaration(216 /* SyntaxKind.ArrowFunction */, modifiers, /*name*/ undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* SyntaxKind.EqualsGreaterThanToken */); node.transformFlags |= propagateChildFlags(node.equalsGreaterThanToken) | 1024 /* TransformFlags.ContainsES2015 */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { node.transformFlags |= 256 /* TransformFlags.ContainsES2017 */ | 16384 /* TransformFlags.ContainsLexicalThis */; } return node; @@ -24414,7 +24618,7 @@ var ts; } // @api function createDeleteExpression(expression) { - var node = createBaseExpression(215 /* SyntaxKind.DeleteExpression */); + var node = createBaseExpression(217 /* SyntaxKind.DeleteExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24427,7 +24631,7 @@ var ts; } // @api function createTypeOfExpression(expression) { - var node = createBaseExpression(216 /* SyntaxKind.TypeOfExpression */); + var node = createBaseExpression(218 /* SyntaxKind.TypeOfExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24440,7 +24644,7 @@ var ts; } // @api function createVoidExpression(expression) { - var node = createBaseExpression(217 /* SyntaxKind.VoidExpression */); + var node = createBaseExpression(219 /* SyntaxKind.VoidExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24453,7 +24657,7 @@ var ts; } // @api function createAwaitExpression(expression) { - var node = createBaseExpression(218 /* SyntaxKind.AwaitExpression */); + var node = createBaseExpression(220 /* SyntaxKind.AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24470,7 +24674,7 @@ var ts; } // @api function createPrefixUnaryExpression(operator, operand) { - var node = createBaseExpression(219 /* SyntaxKind.PrefixUnaryExpression */); + var node = createBaseExpression(221 /* SyntaxKind.PrefixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24492,7 +24696,7 @@ var ts; } // @api function createPostfixUnaryExpression(operand, operator) { - var node = createBaseExpression(220 /* SyntaxKind.PostfixUnaryExpression */); + var node = createBaseExpression(222 /* SyntaxKind.PostfixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24513,7 +24717,7 @@ var ts; } // @api function createBinaryExpression(left, operator, right) { - var node = createBaseExpression(221 /* SyntaxKind.BinaryExpression */); + var node = createBaseExpression(223 /* SyntaxKind.BinaryExpression */); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = parenthesizerRules().parenthesizeLeftSideOfBinary(operatorKind, left); @@ -24585,7 +24789,7 @@ var ts; } // @api function createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse) { - var node = createBaseExpression(222 /* SyntaxKind.ConditionalExpression */); + var node = createBaseExpression(224 /* SyntaxKind.ConditionalExpression */); node.condition = parenthesizerRules().parenthesizeConditionOfConditionalExpression(condition); node.questionToken = questionToken !== null && questionToken !== void 0 ? questionToken : createToken(57 /* SyntaxKind.QuestionToken */); node.whenTrue = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenTrue); @@ -24611,7 +24815,7 @@ var ts; } // @api function createTemplateExpression(head, templateSpans) { - var node = createBaseExpression(223 /* SyntaxKind.TemplateExpression */); + var node = createBaseExpression(225 /* SyntaxKind.TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= @@ -24681,7 +24885,7 @@ var ts; // @api function createYieldExpression(asteriskToken, expression) { ts.Debug.assert(!asteriskToken || !!expression, "A `YieldExpression` with an asteriskToken must have an expression."); - var node = createBaseExpression(224 /* SyntaxKind.YieldExpression */); + var node = createBaseExpression(226 /* SyntaxKind.YieldExpression */); node.expression = expression && parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.asteriskToken = asteriskToken; node.transformFlags |= @@ -24701,7 +24905,7 @@ var ts; } // @api function createSpreadElement(expression) { - var node = createBaseExpression(225 /* SyntaxKind.SpreadElement */); + var node = createBaseExpression(227 /* SyntaxKind.SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24717,7 +24921,7 @@ var ts; } // @api function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(226 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(228 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -24733,11 +24937,11 @@ var ts; } // @api function createOmittedExpression() { - return createBaseExpression(227 /* SyntaxKind.OmittedExpression */); + return createBaseExpression(229 /* SyntaxKind.OmittedExpression */); } // @api function createExpressionWithTypeArguments(expression, typeArguments) { - var node = createBaseNode(228 /* SyntaxKind.ExpressionWithTypeArguments */); + var node = createBaseNode(230 /* SyntaxKind.ExpressionWithTypeArguments */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= @@ -24755,7 +24959,7 @@ var ts; } // @api function createAsExpression(expression, type) { - var node = createBaseExpression(229 /* SyntaxKind.AsExpression */); + var node = createBaseExpression(231 /* SyntaxKind.AsExpression */); node.expression = expression; node.type = type; node.transformFlags |= @@ -24773,7 +24977,7 @@ var ts; } // @api function createNonNullExpression(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24790,8 +24994,26 @@ var ts; : node; } // @api + function createSatisfiesExpression(expression, type) { + var node = createBaseExpression(235 /* SyntaxKind.SatisfiesExpression */); + node.expression = expression; + node.type = type; + node.transformFlags |= + propagateChildFlags(node.expression) | + propagateChildFlags(node.type) | + 1 /* TransformFlags.ContainsTypeScript */; + return node; + } + // @api + function updateSatisfiesExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? update(createSatisfiesExpression(expression, type), node) + : node; + } + // @api function createNonNullChain(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.transformFlags |= @@ -24808,7 +25030,7 @@ var ts; } // @api function createMetaProperty(keywordToken, name) { - var node = createBaseExpression(231 /* SyntaxKind.MetaProperty */); + var node = createBaseExpression(233 /* SyntaxKind.MetaProperty */); node.keywordToken = keywordToken; node.name = name; node.transformFlags |= propagateChildFlags(node.name); @@ -24835,7 +25057,7 @@ var ts; // // @api function createTemplateSpan(expression, literal) { - var node = createBaseNode(233 /* SyntaxKind.TemplateSpan */); + var node = createBaseNode(236 /* SyntaxKind.TemplateSpan */); node.expression = expression; node.literal = literal; node.transformFlags |= @@ -24853,7 +25075,7 @@ var ts; } // @api function createSemicolonClassElement() { - var node = createBaseNode(234 /* SyntaxKind.SemicolonClassElement */); + var node = createBaseNode(237 /* SyntaxKind.SemicolonClassElement */); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -24862,7 +25084,7 @@ var ts; // // @api function createBlock(statements, multiLine) { - var node = createBaseNode(235 /* SyntaxKind.Block */); + var node = createBaseNode(238 /* SyntaxKind.Block */); node.statements = createNodeArray(statements); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.statements); @@ -24876,7 +25098,7 @@ var ts; } // @api function createVariableStatement(modifiers, declarationList) { - var node = createBaseDeclaration(237 /* SyntaxKind.VariableStatement */); + var node = createBaseDeclaration(240 /* SyntaxKind.VariableStatement */); node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; node.transformFlags |= @@ -24896,11 +25118,11 @@ var ts; } // @api function createEmptyStatement() { - return createBaseNode(236 /* SyntaxKind.EmptyStatement */); + return createBaseNode(239 /* SyntaxKind.EmptyStatement */); } // @api function createExpressionStatement(expression) { - var node = createBaseNode(238 /* SyntaxKind.ExpressionStatement */); + var node = createBaseNode(241 /* SyntaxKind.ExpressionStatement */); node.expression = parenthesizerRules().parenthesizeExpressionOfExpressionStatement(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24913,7 +25135,7 @@ var ts; } // @api function createIfStatement(expression, thenStatement, elseStatement) { - var node = createBaseNode(239 /* SyntaxKind.IfStatement */); + var node = createBaseNode(242 /* SyntaxKind.IfStatement */); node.expression = expression; node.thenStatement = asEmbeddedStatement(thenStatement); node.elseStatement = asEmbeddedStatement(elseStatement); @@ -24933,7 +25155,7 @@ var ts; } // @api function createDoStatement(statement, expression) { - var node = createBaseNode(240 /* SyntaxKind.DoStatement */); + var node = createBaseNode(243 /* SyntaxKind.DoStatement */); node.statement = asEmbeddedStatement(statement); node.expression = expression; node.transformFlags |= @@ -24950,7 +25172,7 @@ var ts; } // @api function createWhileStatement(expression, statement) { - var node = createBaseNode(241 /* SyntaxKind.WhileStatement */); + var node = createBaseNode(244 /* SyntaxKind.WhileStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -24967,7 +25189,7 @@ var ts; } // @api function createForStatement(initializer, condition, incrementor, statement) { - var node = createBaseNode(242 /* SyntaxKind.ForStatement */); + var node = createBaseNode(245 /* SyntaxKind.ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -24990,7 +25212,7 @@ var ts; } // @api function createForInStatement(initializer, expression, statement) { - var node = createBaseNode(243 /* SyntaxKind.ForInStatement */); + var node = createBaseNode(246 /* SyntaxKind.ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = asEmbeddedStatement(statement); @@ -25010,7 +25232,7 @@ var ts; } // @api function createForOfStatement(awaitModifier, initializer, expression, statement) { - var node = createBaseNode(244 /* SyntaxKind.ForOfStatement */); + var node = createBaseNode(247 /* SyntaxKind.ForOfStatement */); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); @@ -25036,7 +25258,7 @@ var ts; } // @api function createContinueStatement(label) { - var node = createBaseNode(245 /* SyntaxKind.ContinueStatement */); + var node = createBaseNode(248 /* SyntaxKind.ContinueStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25051,7 +25273,7 @@ var ts; } // @api function createBreakStatement(label) { - var node = createBaseNode(246 /* SyntaxKind.BreakStatement */); + var node = createBaseNode(249 /* SyntaxKind.BreakStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25066,7 +25288,7 @@ var ts; } // @api function createReturnStatement(expression) { - var node = createBaseNode(247 /* SyntaxKind.ReturnStatement */); + var node = createBaseNode(250 /* SyntaxKind.ReturnStatement */); node.expression = expression; // return in an ES2018 async generator must be awaited node.transformFlags |= @@ -25083,7 +25305,7 @@ var ts; } // @api function createWithStatement(expression, statement) { - var node = createBaseNode(248 /* SyntaxKind.WithStatement */); + var node = createBaseNode(251 /* SyntaxKind.WithStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25100,7 +25322,7 @@ var ts; } // @api function createSwitchStatement(expression, caseBlock) { - var node = createBaseNode(249 /* SyntaxKind.SwitchStatement */); + var node = createBaseNode(252 /* SyntaxKind.SwitchStatement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.caseBlock = caseBlock; node.transformFlags |= @@ -25117,7 +25339,7 @@ var ts; } // @api function createLabeledStatement(label, statement) { - var node = createBaseNode(250 /* SyntaxKind.LabeledStatement */); + var node = createBaseNode(253 /* SyntaxKind.LabeledStatement */); node.label = asName(label); node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25134,7 +25356,7 @@ var ts; } // @api function createThrowStatement(expression) { - var node = createBaseNode(251 /* SyntaxKind.ThrowStatement */); + var node = createBaseNode(254 /* SyntaxKind.ThrowStatement */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -25147,7 +25369,7 @@ var ts; } // @api function createTryStatement(tryBlock, catchClause, finallyBlock) { - var node = createBaseNode(252 /* SyntaxKind.TryStatement */); + var node = createBaseNode(255 /* SyntaxKind.TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -25167,11 +25389,11 @@ var ts; } // @api function createDebuggerStatement() { - return createBaseNode(253 /* SyntaxKind.DebuggerStatement */); + return createBaseNode(256 /* SyntaxKind.DebuggerStatement */); } // @api function createVariableDeclaration(name, exclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(254 /* SyntaxKind.VariableDeclaration */, + var node = createBaseVariableLikeDeclaration(257 /* SyntaxKind.VariableDeclaration */, /*modifiers*/ undefined, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.exclamationToken = exclamationToken; node.transformFlags |= propagateChildFlags(node.exclamationToken); @@ -25192,7 +25414,7 @@ var ts; // @api function createVariableDeclarationList(declarations, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseNode(255 /* SyntaxKind.VariableDeclarationList */); + var node = createBaseNode(258 /* SyntaxKind.VariableDeclarationList */); node.flags |= flags & 3 /* NodeFlags.BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= @@ -25213,7 +25435,7 @@ var ts; } // @api function createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(256 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(259 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; if (!node.body || ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -25222,7 +25444,7 @@ var ts; node.transformFlags |= propagateChildFlags(node.asteriskToken) | 4194304 /* TransformFlags.ContainsHoistedDeclarationOrCompletion */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -25259,7 +25481,7 @@ var ts; } // @api function createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(257 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(260 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); if (ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; } @@ -25283,7 +25505,7 @@ var ts; } // @api function createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseInterfaceOrClassLikeDeclaration(258 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); + var node = createBaseInterfaceOrClassLikeDeclaration(261 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25308,7 +25530,7 @@ var ts; } // @api function createTypeAliasDeclaration(modifiers, name, typeParameters, type) { - var node = createBaseGenericNamedDeclaration(259 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); + var node = createBaseGenericNamedDeclaration(262 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25332,7 +25554,7 @@ var ts; } // @api function createEnumDeclaration(modifiers, name, members) { - var node = createBaseNamedDeclaration(260 /* SyntaxKind.EnumDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(263 /* SyntaxKind.EnumDeclaration */, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= propagateChildrenFlags(node.members) | @@ -25359,7 +25581,7 @@ var ts; // @api function createModuleDeclaration(modifiers, name, body, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseDeclaration(261 /* SyntaxKind.ModuleDeclaration */); + var node = createBaseDeclaration(264 /* SyntaxKind.ModuleDeclaration */); node.modifiers = asNodeArray(modifiers); node.flags |= flags & (16 /* NodeFlags.Namespace */ | 4 /* NodeFlags.NestedNamespace */ | 1024 /* NodeFlags.GlobalAugmentation */); node.name = name; @@ -25395,7 +25617,7 @@ var ts; } // @api function createModuleBlock(statements) { - var node = createBaseNode(262 /* SyntaxKind.ModuleBlock */); + var node = createBaseNode(265 /* SyntaxKind.ModuleBlock */); node.statements = createNodeArray(statements); node.transformFlags |= propagateChildrenFlags(node.statements); return node; @@ -25408,7 +25630,7 @@ var ts; } // @api function createCaseBlock(clauses) { - var node = createBaseNode(263 /* SyntaxKind.CaseBlock */); + var node = createBaseNode(266 /* SyntaxKind.CaseBlock */); node.clauses = createNodeArray(clauses); node.transformFlags |= propagateChildrenFlags(node.clauses); return node; @@ -25421,7 +25643,7 @@ var ts; } // @api function createNamespaceExportDeclaration(name) { - var node = createBaseNamedDeclaration(264 /* SyntaxKind.NamespaceExportDeclaration */, + var node = createBaseNamedDeclaration(267 /* SyntaxKind.NamespaceExportDeclaration */, /*modifiers*/ undefined, name); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25444,7 +25666,7 @@ var ts; } // @api function createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference) { - var node = createBaseNamedDeclaration(265 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(268 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); node.isTypeOnly = isTypeOnly; node.moduleReference = moduleReference; node.transformFlags |= propagateChildFlags(node.moduleReference); @@ -25472,7 +25694,7 @@ var ts; } // @api function createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(266 /* SyntaxKind.ImportDeclaration */); + var node = createBaseDeclaration(269 /* SyntaxKind.ImportDeclaration */); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; @@ -25502,7 +25724,7 @@ var ts; } // @api function createImportClause(isTypeOnly, name, namedBindings) { - var node = createBaseNode(267 /* SyntaxKind.ImportClause */); + var node = createBaseNode(270 /* SyntaxKind.ImportClause */); node.isTypeOnly = isTypeOnly; node.name = name; node.namedBindings = namedBindings; @@ -25525,7 +25747,7 @@ var ts; } // @api function createAssertClause(elements, multiLine) { - var node = createBaseNode(293 /* SyntaxKind.AssertClause */); + var node = createBaseNode(296 /* SyntaxKind.AssertClause */); node.elements = createNodeArray(elements); node.multiLine = multiLine; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25540,7 +25762,7 @@ var ts; } // @api function createAssertEntry(name, value) { - var node = createBaseNode(294 /* SyntaxKind.AssertEntry */); + var node = createBaseNode(297 /* SyntaxKind.AssertEntry */); node.name = name; node.value = value; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25555,7 +25777,7 @@ var ts; } // @api function createImportTypeAssertionContainer(clause, multiLine) { - var node = createBaseNode(295 /* SyntaxKind.ImportTypeAssertionContainer */); + var node = createBaseNode(298 /* SyntaxKind.ImportTypeAssertionContainer */); node.assertClause = clause; node.multiLine = multiLine; return node; @@ -25569,7 +25791,7 @@ var ts; } // @api function createNamespaceImport(name) { - var node = createBaseNode(268 /* SyntaxKind.NamespaceImport */); + var node = createBaseNode(271 /* SyntaxKind.NamespaceImport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25583,7 +25805,7 @@ var ts; } // @api function createNamespaceExport(name) { - var node = createBaseNode(274 /* SyntaxKind.NamespaceExport */); + var node = createBaseNode(277 /* SyntaxKind.NamespaceExport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name) | @@ -25599,7 +25821,7 @@ var ts; } // @api function createNamedImports(elements) { - var node = createBaseNode(269 /* SyntaxKind.NamedImports */); + var node = createBaseNode(272 /* SyntaxKind.NamedImports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25613,7 +25835,7 @@ var ts; } // @api function createImportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(270 /* SyntaxKind.ImportSpecifier */); + var node = createBaseNode(273 /* SyntaxKind.ImportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = propertyName; node.name = name; @@ -25633,7 +25855,7 @@ var ts; } // @api function createExportAssignment(modifiers, isExportEquals, expression) { - var node = createBaseDeclaration(271 /* SyntaxKind.ExportAssignment */); + var node = createBaseDeclaration(274 /* SyntaxKind.ExportAssignment */); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = isExportEquals @@ -25660,7 +25882,7 @@ var ts; } // @api function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(272 /* SyntaxKind.ExportDeclaration */); + var node = createBaseDeclaration(275 /* SyntaxKind.ExportDeclaration */); node.modifiers = asNodeArray(modifiers); node.isTypeOnly = isTypeOnly; node.exportClause = exportClause; @@ -25693,7 +25915,7 @@ var ts; } // @api function createNamedExports(elements) { - var node = createBaseNode(273 /* SyntaxKind.NamedExports */); + var node = createBaseNode(276 /* SyntaxKind.NamedExports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25707,7 +25929,7 @@ var ts; } // @api function createExportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(275 /* SyntaxKind.ExportSpecifier */); + var node = createBaseNode(278 /* SyntaxKind.ExportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = asName(propertyName); node.name = asName(name); @@ -25727,7 +25949,7 @@ var ts; } // @api function createMissingDeclaration() { - var node = createBaseDeclaration(276 /* SyntaxKind.MissingDeclaration */); + var node = createBaseDeclaration(279 /* SyntaxKind.MissingDeclaration */); return node; } // @@ -25735,7 +25957,7 @@ var ts; // // @api function createExternalModuleReference(expression) { - var node = createBaseNode(277 /* SyntaxKind.ExternalModuleReference */); + var node = createBaseNode(280 /* SyntaxKind.ExternalModuleReference */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25793,7 +26015,7 @@ var ts; } // @api function createJSDocFunctionType(parameters, type) { - var node = createBaseSignatureDeclaration(317 /* SyntaxKind.JSDocFunctionType */, + var node = createBaseSignatureDeclaration(320 /* SyntaxKind.JSDocFunctionType */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); @@ -25809,7 +26031,7 @@ var ts; // @api function createJSDocTypeLiteral(propertyTags, isArrayType) { if (isArrayType === void 0) { isArrayType = false; } - var node = createBaseNode(322 /* SyntaxKind.JSDocTypeLiteral */); + var node = createBaseNode(325 /* SyntaxKind.JSDocTypeLiteral */); node.jsDocPropertyTags = asNodeArray(propertyTags); node.isArrayType = isArrayType; return node; @@ -25823,7 +26045,7 @@ var ts; } // @api function createJSDocTypeExpression(type) { - var node = createBaseNode(309 /* SyntaxKind.JSDocTypeExpression */); + var node = createBaseNode(312 /* SyntaxKind.JSDocTypeExpression */); node.type = type; return node; } @@ -25835,7 +26057,7 @@ var ts; } // @api function createJSDocSignature(typeParameters, parameters, type) { - var node = createBaseNode(323 /* SyntaxKind.JSDocSignature */); + var node = createBaseNode(326 /* SyntaxKind.JSDocSignature */); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; @@ -25864,7 +26086,7 @@ var ts; } // @api function createJSDocTemplateTag(tagName, constraint, typeParameters, comment) { - var node = createBaseJSDocTag(344 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); + var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); return node; @@ -25881,7 +26103,7 @@ var ts; } // @api function createJSDocTypedefTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(345 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); + var node = createBaseJSDocTag(348 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -25899,7 +26121,7 @@ var ts; } // @api function createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(340 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); + var node = createBaseJSDocTag(343 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -25920,7 +26142,7 @@ var ts; } // @api function createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); + var node = createBaseJSDocTag(350 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -25941,7 +26163,7 @@ var ts; } // @api function createJSDocCallbackTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(338 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); + var node = createBaseJSDocTag(341 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -25959,7 +26181,7 @@ var ts; } // @api function createJSDocAugmentsTag(tagName, className, comment) { - var node = createBaseJSDocTag(328 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); + var node = createBaseJSDocTag(331 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); node.class = className; return node; } @@ -25974,13 +26196,13 @@ var ts; } // @api function createJSDocImplementsTag(tagName, className, comment) { - var node = createBaseJSDocTag(329 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); + var node = createBaseJSDocTag(332 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); node.class = className; return node; } // @api function createJSDocSeeTag(tagName, name, comment) { - var node = createBaseJSDocTag(346 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); + var node = createBaseJSDocTag(349 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); node.name = name; return node; } @@ -25994,7 +26216,7 @@ var ts; } // @api function createJSDocNameReference(name) { - var node = createBaseNode(310 /* SyntaxKind.JSDocNameReference */); + var node = createBaseNode(313 /* SyntaxKind.JSDocNameReference */); node.name = name; return node; } @@ -26006,7 +26228,7 @@ var ts; } // @api function createJSDocMemberName(left, right) { - var node = createBaseNode(311 /* SyntaxKind.JSDocMemberName */); + var node = createBaseNode(314 /* SyntaxKind.JSDocMemberName */); node.left = left; node.right = right; node.transformFlags |= @@ -26023,7 +26245,7 @@ var ts; } // @api function createJSDocLink(name, text) { - var node = createBaseNode(324 /* SyntaxKind.JSDocLink */); + var node = createBaseNode(327 /* SyntaxKind.JSDocLink */); node.name = name; node.text = text; return node; @@ -26036,7 +26258,7 @@ var ts; } // @api function createJSDocLinkCode(name, text) { - var node = createBaseNode(325 /* SyntaxKind.JSDocLinkCode */); + var node = createBaseNode(328 /* SyntaxKind.JSDocLinkCode */); node.name = name; node.text = text; return node; @@ -26049,7 +26271,7 @@ var ts; } // @api function createJSDocLinkPlain(name, text) { - var node = createBaseNode(326 /* SyntaxKind.JSDocLinkPlain */); + var node = createBaseNode(329 /* SyntaxKind.JSDocLinkPlain */); node.name = name; node.text = text; return node; @@ -26121,7 +26343,7 @@ var ts; } // @api function createJSDocUnknownTag(tagName, comment) { - var node = createBaseJSDocTag(327 /* SyntaxKind.JSDocTag */, tagName, comment); + var node = createBaseJSDocTag(330 /* SyntaxKind.JSDocTag */, tagName, comment); return node; } // @api @@ -26133,7 +26355,7 @@ var ts; } // @api function createJSDocText(text) { - var node = createBaseNode(321 /* SyntaxKind.JSDocText */); + var node = createBaseNode(324 /* SyntaxKind.JSDocText */); node.text = text; return node; } @@ -26145,7 +26367,7 @@ var ts; } // @api function createJSDocComment(comment, tags) { - var node = createBaseNode(320 /* SyntaxKind.JSDoc */); + var node = createBaseNode(323 /* SyntaxKind.JSDoc */); node.comment = comment; node.tags = asNodeArray(tags); return node; @@ -26162,7 +26384,7 @@ var ts; // // @api function createJsxElement(openingElement, children, closingElement) { - var node = createBaseNode(278 /* SyntaxKind.JsxElement */); + var node = createBaseNode(281 /* SyntaxKind.JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -26183,7 +26405,7 @@ var ts; } // @api function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createBaseNode(279 /* SyntaxKind.JsxSelfClosingElement */); + var node = createBaseNode(282 /* SyntaxKind.JsxSelfClosingElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26207,7 +26429,7 @@ var ts; } // @api function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createBaseNode(280 /* SyntaxKind.JsxOpeningElement */); + var node = createBaseNode(283 /* SyntaxKind.JsxOpeningElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26231,7 +26453,7 @@ var ts; } // @api function createJsxClosingElement(tagName) { - var node = createBaseNode(281 /* SyntaxKind.JsxClosingElement */); + var node = createBaseNode(284 /* SyntaxKind.JsxClosingElement */); node.tagName = tagName; node.transformFlags |= propagateChildFlags(node.tagName) | @@ -26246,7 +26468,7 @@ var ts; } // @api function createJsxFragment(openingFragment, children, closingFragment) { - var node = createBaseNode(282 /* SyntaxKind.JsxFragment */); + var node = createBaseNode(285 /* SyntaxKind.JsxFragment */); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -26282,19 +26504,19 @@ var ts; } // @api function createJsxOpeningFragment() { - var node = createBaseNode(283 /* SyntaxKind.JsxOpeningFragment */); + var node = createBaseNode(286 /* SyntaxKind.JsxOpeningFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxJsxClosingFragment() { - var node = createBaseNode(284 /* SyntaxKind.JsxClosingFragment */); + var node = createBaseNode(287 /* SyntaxKind.JsxClosingFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxAttribute(name, initializer) { - var node = createBaseNode(285 /* SyntaxKind.JsxAttribute */); + var node = createBaseNode(288 /* SyntaxKind.JsxAttribute */); node.name = name; node.initializer = initializer; node.transformFlags |= @@ -26312,7 +26534,7 @@ var ts; } // @api function createJsxAttributes(properties) { - var node = createBaseNode(286 /* SyntaxKind.JsxAttributes */); + var node = createBaseNode(289 /* SyntaxKind.JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= propagateChildrenFlags(node.properties) | @@ -26327,7 +26549,7 @@ var ts; } // @api function createJsxSpreadAttribute(expression) { - var node = createBaseNode(287 /* SyntaxKind.JsxSpreadAttribute */); + var node = createBaseNode(290 /* SyntaxKind.JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | @@ -26342,7 +26564,7 @@ var ts; } // @api function createJsxExpression(dotDotDotToken, expression) { - var node = createBaseNode(288 /* SyntaxKind.JsxExpression */); + var node = createBaseNode(291 /* SyntaxKind.JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; node.transformFlags |= @@ -26362,7 +26584,7 @@ var ts; // // @api function createCaseClause(expression, statements) { - var node = createBaseNode(289 /* SyntaxKind.CaseClause */); + var node = createBaseNode(292 /* SyntaxKind.CaseClause */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.statements = createNodeArray(statements); node.transformFlags |= @@ -26379,7 +26601,7 @@ var ts; } // @api function createDefaultClause(statements) { - var node = createBaseNode(290 /* SyntaxKind.DefaultClause */); + var node = createBaseNode(293 /* SyntaxKind.DefaultClause */); node.statements = createNodeArray(statements); node.transformFlags = propagateChildrenFlags(node.statements); return node; @@ -26392,7 +26614,7 @@ var ts; } // @api function createHeritageClause(token, types) { - var node = createBaseNode(291 /* SyntaxKind.HeritageClause */); + var node = createBaseNode(294 /* SyntaxKind.HeritageClause */); node.token = token; node.types = createNodeArray(types); node.transformFlags |= propagateChildrenFlags(node.types); @@ -26416,7 +26638,7 @@ var ts; } // @api function createCatchClause(variableDeclaration, block) { - var node = createBaseNode(292 /* SyntaxKind.CatchClause */); + var node = createBaseNode(295 /* SyntaxKind.CatchClause */); if (typeof variableDeclaration === "string" || variableDeclaration && !ts.isVariableDeclaration(variableDeclaration)) { variableDeclaration = createVariableDeclaration(variableDeclaration, /*exclamationToken*/ undefined, @@ -26444,7 +26666,7 @@ var ts; // // @api function createPropertyAssignment(name, initializer) { - var node = createBaseNamedDeclaration(296 /* SyntaxKind.PropertyAssignment */, + var node = createBaseNamedDeclaration(299 /* SyntaxKind.PropertyAssignment */, /*modifiers*/ undefined, name); node.initializer = parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26476,7 +26698,7 @@ var ts; } // @api function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createBaseNamedDeclaration(297 /* SyntaxKind.ShorthandPropertyAssignment */, + var node = createBaseNamedDeclaration(300 /* SyntaxKind.ShorthandPropertyAssignment */, /*modifiers*/ undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= @@ -26510,7 +26732,7 @@ var ts; } // @api function createSpreadAssignment(expression) { - var node = createBaseNode(298 /* SyntaxKind.SpreadAssignment */); + var node = createBaseNode(301 /* SyntaxKind.SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -26529,7 +26751,7 @@ var ts; // // @api function createEnumMember(name, initializer) { - var node = createBaseNode(299 /* SyntaxKind.EnumMember */); + var node = createBaseNode(302 /* SyntaxKind.EnumMember */); node.name = asName(name); node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26550,7 +26772,7 @@ var ts; // // @api function createSourceFile(statements, endOfFileToken, flags) { - var node = baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */); + var node = baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */); node.statements = createNodeArray(statements); node.endOfFileToken = endOfFileToken; node.flags |= flags; @@ -26567,7 +26789,7 @@ var ts; return node; } function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) { - var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */)); + var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */)); for (var p in source) { if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p)) continue; @@ -26606,7 +26828,7 @@ var ts; // @api function createBundle(sourceFiles, prepends) { if (prepends === void 0) { prepends = ts.emptyArray; } - var node = createBaseNode(306 /* SyntaxKind.Bundle */); + var node = createBaseNode(309 /* SyntaxKind.Bundle */); node.prepends = prepends; node.sourceFiles = sourceFiles; return node; @@ -26621,7 +26843,7 @@ var ts; } // @api function createUnparsedSource(prologues, syntheticReferences, texts) { - var node = createBaseNode(307 /* SyntaxKind.UnparsedSource */); + var node = createBaseNode(310 /* SyntaxKind.UnparsedSource */); node.prologues = prologues; node.syntheticReferences = syntheticReferences; node.texts = texts; @@ -26639,28 +26861,28 @@ var ts; } // @api function createUnparsedPrologue(data) { - return createBaseUnparsedNode(300 /* SyntaxKind.UnparsedPrologue */, data); + return createBaseUnparsedNode(303 /* SyntaxKind.UnparsedPrologue */, data); } // @api function createUnparsedPrepend(data, texts) { - var node = createBaseUnparsedNode(301 /* SyntaxKind.UnparsedPrepend */, data); + var node = createBaseUnparsedNode(304 /* SyntaxKind.UnparsedPrepend */, data); node.texts = texts; return node; } // @api function createUnparsedTextLike(data, internal) { - return createBaseUnparsedNode(internal ? 303 /* SyntaxKind.UnparsedInternalText */ : 302 /* SyntaxKind.UnparsedText */, data); + return createBaseUnparsedNode(internal ? 306 /* SyntaxKind.UnparsedInternalText */ : 305 /* SyntaxKind.UnparsedText */, data); } // @api function createUnparsedSyntheticReference(section) { - var node = createBaseNode(304 /* SyntaxKind.UnparsedSyntheticReference */); + var node = createBaseNode(307 /* SyntaxKind.UnparsedSyntheticReference */); node.data = section.data; node.section = section; return node; } // @api function createInputFiles() { - var node = createBaseNode(308 /* SyntaxKind.InputFiles */); + var node = createBaseNode(311 /* SyntaxKind.InputFiles */); node.javascriptText = ""; node.declarationText = ""; return node; @@ -26671,7 +26893,7 @@ var ts; // @api function createSyntheticExpression(type, isSpread, tupleNameSource) { if (isSpread === void 0) { isSpread = false; } - var node = createBaseNode(232 /* SyntaxKind.SyntheticExpression */); + var node = createBaseNode(234 /* SyntaxKind.SyntheticExpression */); node.type = type; node.isSpread = isSpread; node.tupleNameSource = tupleNameSource; @@ -26679,7 +26901,7 @@ var ts; } // @api function createSyntaxList(children) { - var node = createBaseNode(348 /* SyntaxKind.SyntaxList */); + var node = createBaseNode(351 /* SyntaxKind.SyntaxList */); node._children = children; return node; } @@ -26694,7 +26916,7 @@ var ts; */ // @api function createNotEmittedStatement(original) { - var node = createBaseNode(349 /* SyntaxKind.NotEmittedStatement */); + var node = createBaseNode(352 /* SyntaxKind.NotEmittedStatement */); node.original = original; ts.setTextRange(node, original); return node; @@ -26708,7 +26930,7 @@ var ts; */ // @api function createPartiallyEmittedExpression(expression, original) { - var node = createBaseNode(350 /* SyntaxKind.PartiallyEmittedExpression */); + var node = createBaseNode(353 /* SyntaxKind.PartiallyEmittedExpression */); node.expression = expression; node.original = original; node.transformFlags |= @@ -26736,7 +26958,7 @@ var ts; } // @api function createCommaListExpression(elements) { - var node = createBaseNode(351 /* SyntaxKind.CommaListExpression */); + var node = createBaseNode(354 /* SyntaxKind.CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); node.transformFlags |= propagateChildrenFlags(node.elements); return node; @@ -26753,7 +26975,7 @@ var ts; */ // @api function createEndOfDeclarationMarker(original) { - var node = createBaseNode(353 /* SyntaxKind.EndOfDeclarationMarker */); + var node = createBaseNode(356 /* SyntaxKind.EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -26764,14 +26986,14 @@ var ts; */ // @api function createMergeDeclarationMarker(original) { - var node = createBaseNode(352 /* SyntaxKind.MergeDeclarationMarker */); + var node = createBaseNode(355 /* SyntaxKind.MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; } // @api function createSyntheticReferenceExpression(expression, thisArg) { - var node = createBaseNode(354 /* SyntaxKind.SyntheticReferenceExpression */); + var node = createBaseNode(357 /* SyntaxKind.SyntheticReferenceExpression */); node.expression = expression; node.thisArg = thisArg; node.transformFlags |= @@ -26793,7 +27015,7 @@ var ts; if (node === undefined) { return node; } - var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */) : + var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */) : ts.isIdentifier(node) ? baseFactory.createBaseIdentifierNode(79 /* SyntaxKind.Identifier */) : ts.isPrivateIdentifier(node) ? baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */) : !ts.isNodeKind(node.kind) ? baseFactory.createBaseTokenNode(node.kind) : @@ -26802,7 +27024,7 @@ var ts; clone.transformFlags = node.transformFlags; setOriginalNode(clone, node); for (var key in node) { - if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) { continue; } clone[key] = node[key]; @@ -26910,11 +27132,12 @@ var ts; } function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); - case 211 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 229 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); - case 230 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); + case 214 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); + case 213 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 231 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); + case 235 /* SyntaxKind.SatisfiesExpression */: return updateSatisfiesExpression(outerExpression, expression, outerExpression.type); + case 232 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -26968,13 +27191,13 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: return false; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -27400,24 +27623,24 @@ var ts; } function getDefaultTagNameForKind(kind) { switch (kind) { - case 343 /* SyntaxKind.JSDocTypeTag */: return "type"; - case 341 /* SyntaxKind.JSDocReturnTag */: return "returns"; - case 342 /* SyntaxKind.JSDocThisTag */: return "this"; - case 339 /* SyntaxKind.JSDocEnumTag */: return "enum"; - case 330 /* SyntaxKind.JSDocAuthorTag */: return "author"; - case 332 /* SyntaxKind.JSDocClassTag */: return "class"; - case 333 /* SyntaxKind.JSDocPublicTag */: return "public"; - case 334 /* SyntaxKind.JSDocPrivateTag */: return "private"; - case 335 /* SyntaxKind.JSDocProtectedTag */: return "protected"; - case 336 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; - case 337 /* SyntaxKind.JSDocOverrideTag */: return "override"; - case 344 /* SyntaxKind.JSDocTemplateTag */: return "template"; - case 345 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; - case 340 /* SyntaxKind.JSDocParameterTag */: return "param"; - case 347 /* SyntaxKind.JSDocPropertyTag */: return "prop"; - case 338 /* SyntaxKind.JSDocCallbackTag */: return "callback"; - case 328 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; - case 329 /* SyntaxKind.JSDocImplementsTag */: return "implements"; + case 346 /* SyntaxKind.JSDocTypeTag */: return "type"; + case 344 /* SyntaxKind.JSDocReturnTag */: return "returns"; + case 345 /* SyntaxKind.JSDocThisTag */: return "this"; + case 342 /* SyntaxKind.JSDocEnumTag */: return "enum"; + case 333 /* SyntaxKind.JSDocAuthorTag */: return "author"; + case 335 /* SyntaxKind.JSDocClassTag */: return "class"; + case 336 /* SyntaxKind.JSDocPublicTag */: return "public"; + case 337 /* SyntaxKind.JSDocPrivateTag */: return "private"; + case 338 /* SyntaxKind.JSDocProtectedTag */: return "protected"; + case 339 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; + case 340 /* SyntaxKind.JSDocOverrideTag */: return "override"; + case 347 /* SyntaxKind.JSDocTemplateTag */: return "template"; + case 348 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; + case 343 /* SyntaxKind.JSDocParameterTag */: return "param"; + case 350 /* SyntaxKind.JSDocPropertyTag */: return "prop"; + case 341 /* SyntaxKind.JSDocCallbackTag */: return "callback"; + case 331 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; + case 332 /* SyntaxKind.JSDocImplementsTag */: return "implements"; default: return ts.Debug.fail("Unsupported kind: ".concat(ts.Debug.formatSyntaxKind(kind))); } @@ -27433,11 +27656,9 @@ var ts; rawTextScanner.setText("`" + rawText + "`"); break; case 15 /* SyntaxKind.TemplateHead */: - // tslint:disable-next-line no-invalid-template-strings rawTextScanner.setText("`" + rawText + "${"); break; case 16 /* SyntaxKind.TemplateMiddle */: - // tslint:disable-next-line no-invalid-template-strings rawTextScanner.setText("}" + rawText + "${"); break; case 17 /* SyntaxKind.TemplateTail */: @@ -27497,69 +27718,70 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) { return -2 /* TransformFlags.TypeExcludes */; } switch (kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return -2147450880 /* TransformFlags.ArrayLiteralOrCallOrNewExcludes */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return -1941676032 /* TransformFlags.ModuleExcludes */; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return -2147483648 /* TransformFlags.ParameterExcludes */; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return -2072174592 /* TransformFlags.ArrowFunctionExcludes */; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return -1937940480 /* TransformFlags.FunctionExcludes */; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return -2146893824 /* TransformFlags.VariableDeclarationListExcludes */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return -2147344384 /* TransformFlags.ClassExcludes */; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return -1937948672 /* TransformFlags.ConstructorExcludes */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return -2013249536 /* TransformFlags.PropertyExcludes */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return -2005057536 /* TransformFlags.MethodOrAccessorExcludes */; - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 163 /* SyntaxKind.TypeParameter */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return -2 /* TransformFlags.TypeExcludes */; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return -2147278848 /* TransformFlags.ObjectLiteralExcludes */; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return -2147418112 /* TransformFlags.CatchClauseExcludes */; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return -2147450880 /* TransformFlags.BindingPatternExcludes */; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: case 106 /* SyntaxKind.SuperKeyword */: return -2147483648 /* TransformFlags.OuterExpressionExcludes */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return -2147483648 /* TransformFlags.PropertyAccessExcludes */; default: return -2147483648 /* TransformFlags.NodeExcludes */; @@ -27759,9 +27981,10 @@ var ts; }; var buildInfo_1; var getAndCacheBuildInfo_1 = function (getText) { + var _a; if (buildInfo_1 === undefined) { var result = getText(); - buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false; + buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false; } return buildInfo_1 || undefined; }; @@ -27794,7 +28017,6 @@ var ts; return node; } ts.createInputFiles = createInputFiles; - // tslint:disable-next-line variable-name var SourceMapSource; /** * Create an external source map source file reference @@ -27815,7 +28037,7 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine; + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine, snippetElement = sourceEmitNode.snippetElement; if (!destEmitNode) destEmitNode = {}; // We are using `.slice()` here in case `destEmitNode.leadingComments` is pushed to later. @@ -27841,6 +28063,8 @@ var ts; } if (startsOnNewLine !== undefined) destEmitNode.startsOnNewLine = startsOnNewLine; + if (snippetElement !== undefined) + destEmitNode.snippetElement = snippetElement; return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -27866,7 +28090,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = (_a = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)))) !== null && _a !== void 0 ? _a : ts.Debug.fail("Could not determine parsed source file."); @@ -28584,6 +28808,8 @@ var ts; // - The verb (`next`, `throw`, or `return` method) to delegate to the expression // of a `yield*`. // - The result of evaluating the verb delegated to the expression of a `yield*`. + // g A temporary variable that holds onto the generator object until the generator + // is started, allowing it to also act as the `suspendedStart` state. // // functions: // verb(n) Creates a bound callback to the `step` function for opcode `n`. @@ -28622,7 +28848,7 @@ var ts; importName: "__generator", scoped: false, priority: 6, - text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" + text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" }; // ES Module Helpers ts.createBindingHelper = { @@ -28944,22 +29170,22 @@ var ts; ts.isExportModifier = isExportModifier; /* @internal */ function isAsyncModifier(node) { - return node.kind === 131 /* SyntaxKind.AsyncKeyword */; + return node.kind === 132 /* SyntaxKind.AsyncKeyword */; } ts.isAsyncModifier = isAsyncModifier; /* @internal */ function isAssertsKeyword(node) { - return node.kind === 128 /* SyntaxKind.AssertsKeyword */; + return node.kind === 129 /* SyntaxKind.AssertsKeyword */; } ts.isAssertsKeyword = isAssertsKeyword; /* @internal */ function isAwaitKeyword(node) { - return node.kind === 132 /* SyntaxKind.AwaitKeyword */; + return node.kind === 133 /* SyntaxKind.AwaitKeyword */; } ts.isAwaitKeyword = isAwaitKeyword; /* @internal */ function isReadonlyKeyword(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */; } ts.isReadonlyKeyword = isReadonlyKeyword; /* @internal */ @@ -28974,9 +29200,14 @@ var ts; ts.isAbstractModifier = isAbstractModifier; /* @internal */ function isOverrideModifier(node) { - return node.kind === 159 /* SyntaxKind.OverrideKeyword */; + return node.kind === 161 /* SyntaxKind.OverrideKeyword */; } ts.isOverrideModifier = isOverrideModifier; + /* @internal */ + function isAccessorModifier(node) { + return node.kind === 127 /* SyntaxKind.AccessorKeyword */; + } + ts.isAccessorModifier = isAccessorModifier; /*@internal*/ function isSuperKeyword(node) { return node.kind === 106 /* SyntaxKind.SuperKeyword */; @@ -28989,605 +29220,609 @@ var ts; ts.isImportKeyword = isImportKeyword; // Names function isQualifiedName(node) { - return node.kind === 161 /* SyntaxKind.QualifiedName */; + return node.kind === 163 /* SyntaxKind.QualifiedName */; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return node.kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isComputedPropertyName = isComputedPropertyName; // Signature elements function isTypeParameterDeclaration(node) { - return node.kind === 163 /* SyntaxKind.TypeParameter */; + return node.kind === 165 /* SyntaxKind.TypeParameter */; } ts.isTypeParameterDeclaration = isTypeParameterDeclaration; // TODO(rbuckton): Rename to 'isParameterDeclaration' function isParameter(node) { - return node.kind === 164 /* SyntaxKind.Parameter */; + return node.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 165 /* SyntaxKind.Decorator */; + return node.kind === 167 /* SyntaxKind.Decorator */; } ts.isDecorator = isDecorator; // TypeMember function isPropertySignature(node) { - return node.kind === 166 /* SyntaxKind.PropertySignature */; + return node.kind === 168 /* SyntaxKind.PropertySignature */; } ts.isPropertySignature = isPropertySignature; function isPropertyDeclaration(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } ts.isPropertyDeclaration = isPropertyDeclaration; function isMethodSignature(node) { - return node.kind === 168 /* SyntaxKind.MethodSignature */; + return node.kind === 170 /* SyntaxKind.MethodSignature */; } ts.isMethodSignature = isMethodSignature; function isMethodDeclaration(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } ts.isMethodDeclaration = isMethodDeclaration; function isClassStaticBlockDeclaration(node) { - return node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } ts.isClassStaticBlockDeclaration = isClassStaticBlockDeclaration; function isConstructorDeclaration(node) { - return node.kind === 171 /* SyntaxKind.Constructor */; + return node.kind === 173 /* SyntaxKind.Constructor */; } ts.isConstructorDeclaration = isConstructorDeclaration; function isGetAccessorDeclaration(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessorDeclaration = isGetAccessorDeclaration; function isSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessorDeclaration = isSetAccessorDeclaration; function isCallSignatureDeclaration(node) { - return node.kind === 174 /* SyntaxKind.CallSignature */; + return node.kind === 176 /* SyntaxKind.CallSignature */; } ts.isCallSignatureDeclaration = isCallSignatureDeclaration; function isConstructSignatureDeclaration(node) { - return node.kind === 175 /* SyntaxKind.ConstructSignature */; + return node.kind === 177 /* SyntaxKind.ConstructSignature */; } ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration; function isIndexSignatureDeclaration(node) { - return node.kind === 176 /* SyntaxKind.IndexSignature */; + return node.kind === 178 /* SyntaxKind.IndexSignature */; } ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration; // Type function isTypePredicateNode(node) { - return node.kind === 177 /* SyntaxKind.TypePredicate */; + return node.kind === 179 /* SyntaxKind.TypePredicate */; } ts.isTypePredicateNode = isTypePredicateNode; function isTypeReferenceNode(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */; + return node.kind === 180 /* SyntaxKind.TypeReference */; } ts.isTypeReferenceNode = isTypeReferenceNode; function isFunctionTypeNode(node) { - return node.kind === 179 /* SyntaxKind.FunctionType */; + return node.kind === 181 /* SyntaxKind.FunctionType */; } ts.isFunctionTypeNode = isFunctionTypeNode; function isConstructorTypeNode(node) { - return node.kind === 180 /* SyntaxKind.ConstructorType */; + return node.kind === 182 /* SyntaxKind.ConstructorType */; } ts.isConstructorTypeNode = isConstructorTypeNode; function isTypeQueryNode(node) { - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isTypeQueryNode = isTypeQueryNode; function isTypeLiteralNode(node) { - return node.kind === 182 /* SyntaxKind.TypeLiteral */; + return node.kind === 184 /* SyntaxKind.TypeLiteral */; } ts.isTypeLiteralNode = isTypeLiteralNode; function isArrayTypeNode(node) { - return node.kind === 183 /* SyntaxKind.ArrayType */; + return node.kind === 185 /* SyntaxKind.ArrayType */; } ts.isArrayTypeNode = isArrayTypeNode; function isTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */; + return node.kind === 186 /* SyntaxKind.TupleType */; } ts.isTupleTypeNode = isTupleTypeNode; function isNamedTupleMember(node) { - return node.kind === 197 /* SyntaxKind.NamedTupleMember */; + return node.kind === 199 /* SyntaxKind.NamedTupleMember */; } ts.isNamedTupleMember = isNamedTupleMember; function isOptionalTypeNode(node) { - return node.kind === 185 /* SyntaxKind.OptionalType */; + return node.kind === 187 /* SyntaxKind.OptionalType */; } ts.isOptionalTypeNode = isOptionalTypeNode; function isRestTypeNode(node) { - return node.kind === 186 /* SyntaxKind.RestType */; + return node.kind === 188 /* SyntaxKind.RestType */; } ts.isRestTypeNode = isRestTypeNode; function isUnionTypeNode(node) { - return node.kind === 187 /* SyntaxKind.UnionType */; + return node.kind === 189 /* SyntaxKind.UnionType */; } ts.isUnionTypeNode = isUnionTypeNode; function isIntersectionTypeNode(node) { - return node.kind === 188 /* SyntaxKind.IntersectionType */; + return node.kind === 190 /* SyntaxKind.IntersectionType */; } ts.isIntersectionTypeNode = isIntersectionTypeNode; function isConditionalTypeNode(node) { - return node.kind === 189 /* SyntaxKind.ConditionalType */; + return node.kind === 191 /* SyntaxKind.ConditionalType */; } ts.isConditionalTypeNode = isConditionalTypeNode; function isInferTypeNode(node) { - return node.kind === 190 /* SyntaxKind.InferType */; + return node.kind === 192 /* SyntaxKind.InferType */; } ts.isInferTypeNode = isInferTypeNode; function isParenthesizedTypeNode(node) { - return node.kind === 191 /* SyntaxKind.ParenthesizedType */; + return node.kind === 193 /* SyntaxKind.ParenthesizedType */; } ts.isParenthesizedTypeNode = isParenthesizedTypeNode; function isThisTypeNode(node) { - return node.kind === 192 /* SyntaxKind.ThisType */; + return node.kind === 194 /* SyntaxKind.ThisType */; } ts.isThisTypeNode = isThisTypeNode; function isTypeOperatorNode(node) { - return node.kind === 193 /* SyntaxKind.TypeOperator */; + return node.kind === 195 /* SyntaxKind.TypeOperator */; } ts.isTypeOperatorNode = isTypeOperatorNode; function isIndexedAccessTypeNode(node) { - return node.kind === 194 /* SyntaxKind.IndexedAccessType */; + return node.kind === 196 /* SyntaxKind.IndexedAccessType */; } ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode; function isMappedTypeNode(node) { - return node.kind === 195 /* SyntaxKind.MappedType */; + return node.kind === 197 /* SyntaxKind.MappedType */; } ts.isMappedTypeNode = isMappedTypeNode; function isLiteralTypeNode(node) { - return node.kind === 196 /* SyntaxKind.LiteralType */; + return node.kind === 198 /* SyntaxKind.LiteralType */; } ts.isLiteralTypeNode = isLiteralTypeNode; function isImportTypeNode(node) { - return node.kind === 200 /* SyntaxKind.ImportType */; + return node.kind === 202 /* SyntaxKind.ImportType */; } ts.isImportTypeNode = isImportTypeNode; function isTemplateLiteralTypeSpan(node) { - return node.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */; + return node.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */; } ts.isTemplateLiteralTypeSpan = isTemplateLiteralTypeSpan; function isTemplateLiteralTypeNode(node) { - return node.kind === 198 /* SyntaxKind.TemplateLiteralType */; + return node.kind === 200 /* SyntaxKind.TemplateLiteralType */; } ts.isTemplateLiteralTypeNode = isTemplateLiteralTypeNode; // Binding patterns function isObjectBindingPattern(node) { - return node.kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return node.kind === 203 /* SyntaxKind.ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 202 /* SyntaxKind.ArrayBindingPattern */; + return node.kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 203 /* SyntaxKind.BindingElement */; + return node.kind === 205 /* SyntaxKind.BindingElement */; } ts.isBindingElement = isBindingElement; // Expression function isArrayLiteralExpression(node) { - return node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; + return node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertionExpression(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } ts.isTypeAssertionExpression = isTypeAssertionExpression; function isParenthesizedExpression(node) { - return node.kind === 212 /* SyntaxKind.ParenthesizedExpression */; + return node.kind === 214 /* SyntaxKind.ParenthesizedExpression */; } ts.isParenthesizedExpression = isParenthesizedExpression; function isFunctionExpression(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 216 /* SyntaxKind.TypeOfExpression */; + return node.kind === 218 /* SyntaxKind.TypeOfExpression */; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 217 /* SyntaxKind.VoidExpression */; + return node.kind === 219 /* SyntaxKind.VoidExpression */; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 218 /* SyntaxKind.AwaitExpression */; + return node.kind === 220 /* SyntaxKind.AwaitExpression */; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */; + return node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 220 /* SyntaxKind.PostfixUnaryExpression */; + return node.kind === 222 /* SyntaxKind.PostfixUnaryExpression */; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 222 /* SyntaxKind.ConditionalExpression */; + return node.kind === 224 /* SyntaxKind.ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 223 /* SyntaxKind.TemplateExpression */; + return node.kind === 225 /* SyntaxKind.TemplateExpression */; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 224 /* SyntaxKind.YieldExpression */; + return node.kind === 226 /* SyntaxKind.YieldExpression */; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 225 /* SyntaxKind.SpreadElement */; + return node.kind === 227 /* SyntaxKind.SpreadElement */; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 226 /* SyntaxKind.ClassExpression */; + return node.kind === 228 /* SyntaxKind.ClassExpression */; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 227 /* SyntaxKind.OmittedExpression */; + return node.kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 229 /* SyntaxKind.AsExpression */; + return node.kind === 231 /* SyntaxKind.AsExpression */; } ts.isAsExpression = isAsExpression; + function isSatisfiesExpression(node) { + return node.kind === 235 /* SyntaxKind.SatisfiesExpression */; + } + ts.isSatisfiesExpression = isSatisfiesExpression; function isNonNullExpression(node) { - return node.kind === 230 /* SyntaxKind.NonNullExpression */; + return node.kind === 232 /* SyntaxKind.NonNullExpression */; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 231 /* SyntaxKind.MetaProperty */; + return node.kind === 233 /* SyntaxKind.MetaProperty */; } ts.isMetaProperty = isMetaProperty; function isSyntheticExpression(node) { - return node.kind === 232 /* SyntaxKind.SyntheticExpression */; + return node.kind === 234 /* SyntaxKind.SyntheticExpression */; } ts.isSyntheticExpression = isSyntheticExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 350 /* SyntaxKind.PartiallyEmittedExpression */; + return node.kind === 353 /* SyntaxKind.PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isCommaListExpression(node) { - return node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaListExpression = isCommaListExpression; // Misc function isTemplateSpan(node) { - return node.kind === 233 /* SyntaxKind.TemplateSpan */; + return node.kind === 236 /* SyntaxKind.TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 234 /* SyntaxKind.SemicolonClassElement */; + return node.kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isSemicolonClassElement = isSemicolonClassElement; // Elements function isBlock(node) { - return node.kind === 235 /* SyntaxKind.Block */; + return node.kind === 238 /* SyntaxKind.Block */; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 237 /* SyntaxKind.VariableStatement */; + return node.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 236 /* SyntaxKind.EmptyStatement */; + return node.kind === 239 /* SyntaxKind.EmptyStatement */; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */; + return node.kind === 241 /* SyntaxKind.ExpressionStatement */; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 239 /* SyntaxKind.IfStatement */; + return node.kind === 242 /* SyntaxKind.IfStatement */; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 240 /* SyntaxKind.DoStatement */; + return node.kind === 243 /* SyntaxKind.DoStatement */; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 241 /* SyntaxKind.WhileStatement */; + return node.kind === 244 /* SyntaxKind.WhileStatement */; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 242 /* SyntaxKind.ForStatement */; + return node.kind === 245 /* SyntaxKind.ForStatement */; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */; } ts.isBreakStatement = isBreakStatement; function isReturnStatement(node) { - return node.kind === 247 /* SyntaxKind.ReturnStatement */; + return node.kind === 250 /* SyntaxKind.ReturnStatement */; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 248 /* SyntaxKind.WithStatement */; + return node.kind === 251 /* SyntaxKind.WithStatement */; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 249 /* SyntaxKind.SwitchStatement */; + return node.kind === 252 /* SyntaxKind.SwitchStatement */; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 250 /* SyntaxKind.LabeledStatement */; + return node.kind === 253 /* SyntaxKind.LabeledStatement */; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 251 /* SyntaxKind.ThrowStatement */; + return node.kind === 254 /* SyntaxKind.ThrowStatement */; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 252 /* SyntaxKind.TryStatement */; + return node.kind === 255 /* SyntaxKind.TryStatement */; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 253 /* SyntaxKind.DebuggerStatement */; + return node.kind === 256 /* SyntaxKind.DebuggerStatement */; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 255 /* SyntaxKind.VariableDeclarationList */; + return node.kind === 258 /* SyntaxKind.VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 256 /* SyntaxKind.FunctionDeclaration */; + return node.kind === 259 /* SyntaxKind.FunctionDeclaration */; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 257 /* SyntaxKind.ClassDeclaration */; + return node.kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return node.kind === 261 /* SyntaxKind.InterfaceDeclaration */; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */; + return node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 262 /* SyntaxKind.ModuleBlock */; + return node.kind === 265 /* SyntaxKind.ModuleBlock */; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 263 /* SyntaxKind.CaseBlock */; + return node.kind === 266 /* SyntaxKind.CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */; + return node.kind === 270 /* SyntaxKind.ImportClause */; } ts.isImportClause = isImportClause; function isImportTypeAssertionContainer(node) { - return node.kind === 295 /* SyntaxKind.ImportTypeAssertionContainer */; + return node.kind === 298 /* SyntaxKind.ImportTypeAssertionContainer */; } ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer; function isAssertClause(node) { - return node.kind === 293 /* SyntaxKind.AssertClause */; + return node.kind === 296 /* SyntaxKind.AssertClause */; } ts.isAssertClause = isAssertClause; function isAssertEntry(node) { - return node.kind === 294 /* SyntaxKind.AssertEntry */; + return node.kind === 297 /* SyntaxKind.AssertEntry */; } ts.isAssertEntry = isAssertEntry; function isNamespaceImport(node) { - return node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamespaceImport = isNamespaceImport; function isNamespaceExport(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */; } ts.isNamespaceExport = isNamespaceExport; function isNamedImports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */; + return node.kind === 272 /* SyntaxKind.NamedImports */; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 270 /* SyntaxKind.ImportSpecifier */; + return node.kind === 273 /* SyntaxKind.ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 271 /* SyntaxKind.ExportAssignment */; + return node.kind === 274 /* SyntaxKind.ExportAssignment */; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 272 /* SyntaxKind.ExportDeclaration */; + return node.kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 275 /* SyntaxKind.ExportSpecifier */; + return node.kind === 278 /* SyntaxKind.ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 276 /* SyntaxKind.MissingDeclaration */; + return node.kind === 279 /* SyntaxKind.MissingDeclaration */; } ts.isMissingDeclaration = isMissingDeclaration; function isNotEmittedStatement(node) { - return node.kind === 349 /* SyntaxKind.NotEmittedStatement */; + return node.kind === 352 /* SyntaxKind.NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ function isSyntheticReference(node) { - return node.kind === 354 /* SyntaxKind.SyntheticReferenceExpression */; + return node.kind === 357 /* SyntaxKind.SyntheticReferenceExpression */; } ts.isSyntheticReference = isSyntheticReference; /* @internal */ function isMergeDeclarationMarker(node) { - return node.kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return node.kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } ts.isMergeDeclarationMarker = isMergeDeclarationMarker; /* @internal */ function isEndOfDeclarationMarker(node) { - return node.kind === 353 /* SyntaxKind.EndOfDeclarationMarker */; + return node.kind === 356 /* SyntaxKind.EndOfDeclarationMarker */; } ts.isEndOfDeclarationMarker = isEndOfDeclarationMarker; // Module References function isExternalModuleReference(node) { - return node.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleReference = isExternalModuleReference; // JSX function isJsxElement(node) { - return node.kind === 278 /* SyntaxKind.JsxElement */; + return node.kind === 281 /* SyntaxKind.JsxElement */; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return node.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 280 /* SyntaxKind.JsxOpeningElement */; + return node.kind === 283 /* SyntaxKind.JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 281 /* SyntaxKind.JsxClosingElement */; + return node.kind === 284 /* SyntaxKind.JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 282 /* SyntaxKind.JsxFragment */; + return node.kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 283 /* SyntaxKind.JsxOpeningFragment */; + return node.kind === 286 /* SyntaxKind.JsxOpeningFragment */; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 284 /* SyntaxKind.JsxClosingFragment */; + return node.kind === 287 /* SyntaxKind.JsxClosingFragment */; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */; + return node.kind === 288 /* SyntaxKind.JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 286 /* SyntaxKind.JsxAttributes */; + return node.kind === 289 /* SyntaxKind.JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 288 /* SyntaxKind.JsxExpression */; + return node.kind === 291 /* SyntaxKind.JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 289 /* SyntaxKind.CaseClause */; + return node.kind === 292 /* SyntaxKind.CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 290 /* SyntaxKind.DefaultClause */; + return node.kind === 293 /* SyntaxKind.DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 291 /* SyntaxKind.HeritageClause */; + return node.kind === 294 /* SyntaxKind.HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 296 /* SyntaxKind.PropertyAssignment */; + return node.kind === 299 /* SyntaxKind.PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 298 /* SyntaxKind.SpreadAssignment */; + return node.kind === 301 /* SyntaxKind.SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } ts.isEnumMember = isEnumMember; // Unparsed // TODO(rbuckton): isUnparsedPrologue function isUnparsedPrepend(node) { - return node.kind === 301 /* SyntaxKind.UnparsedPrepend */; + return node.kind === 304 /* SyntaxKind.UnparsedPrepend */; } ts.isUnparsedPrepend = isUnparsedPrepend; // TODO(rbuckton): isUnparsedText @@ -29595,176 +29830,176 @@ var ts; // TODO(rbuckton): isUnparsedSyntheticReference // Top-level nodes function isSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */; + return node.kind === 308 /* SyntaxKind.SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 306 /* SyntaxKind.Bundle */; + return node.kind === 309 /* SyntaxKind.Bundle */; } ts.isBundle = isBundle; function isUnparsedSource(node) { - return node.kind === 307 /* SyntaxKind.UnparsedSource */; + return node.kind === 310 /* SyntaxKind.UnparsedSource */; } ts.isUnparsedSource = isUnparsedSource; // TODO(rbuckton): isInputFiles // JSDoc Elements function isJSDocTypeExpression(node) { - return node.kind === 309 /* SyntaxKind.JSDocTypeExpression */; + return node.kind === 312 /* SyntaxKind.JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocNameReference(node) { - return node.kind === 310 /* SyntaxKind.JSDocNameReference */; + return node.kind === 313 /* SyntaxKind.JSDocNameReference */; } ts.isJSDocNameReference = isJSDocNameReference; function isJSDocMemberName(node) { - return node.kind === 311 /* SyntaxKind.JSDocMemberName */; + return node.kind === 314 /* SyntaxKind.JSDocMemberName */; } ts.isJSDocMemberName = isJSDocMemberName; function isJSDocLink(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */; + return node.kind === 327 /* SyntaxKind.JSDocLink */; } ts.isJSDocLink = isJSDocLink; function isJSDocLinkCode(node) { - return node.kind === 325 /* SyntaxKind.JSDocLinkCode */; + return node.kind === 328 /* SyntaxKind.JSDocLinkCode */; } ts.isJSDocLinkCode = isJSDocLinkCode; function isJSDocLinkPlain(node) { - return node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkPlain = isJSDocLinkPlain; function isJSDocAllType(node) { - return node.kind === 312 /* SyntaxKind.JSDocAllType */; + return node.kind === 315 /* SyntaxKind.JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 313 /* SyntaxKind.JSDocUnknownType */; + return node.kind === 316 /* SyntaxKind.JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 314 /* SyntaxKind.JSDocNullableType */; + return node.kind === 317 /* SyntaxKind.JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 315 /* SyntaxKind.JSDocNonNullableType */; + return node.kind === 318 /* SyntaxKind.JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return node.kind === 319 /* SyntaxKind.JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 317 /* SyntaxKind.JSDocFunctionType */; + return node.kind === 320 /* SyntaxKind.JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDocNamepathType(node) { - return node.kind === 319 /* SyntaxKind.JSDocNamepathType */; + return node.kind === 322 /* SyntaxKind.JSDocNamepathType */; } ts.isJSDocNamepathType = isJSDocNamepathType; function isJSDoc(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */; + return node.kind === 323 /* SyntaxKind.JSDoc */; } ts.isJSDoc = isJSDoc; function isJSDocTypeLiteral(node) { - return node.kind === 322 /* SyntaxKind.JSDocTypeLiteral */; + return node.kind === 325 /* SyntaxKind.JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; function isJSDocSignature(node) { - return node.kind === 323 /* SyntaxKind.JSDocSignature */; + return node.kind === 326 /* SyntaxKind.JSDocSignature */; } ts.isJSDocSignature = isJSDocSignature; // JSDoc Tags function isJSDocAugmentsTag(node) { - return node.kind === 328 /* SyntaxKind.JSDocAugmentsTag */; + return node.kind === 331 /* SyntaxKind.JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocAuthorTag(node) { - return node.kind === 330 /* SyntaxKind.JSDocAuthorTag */; + return node.kind === 333 /* SyntaxKind.JSDocAuthorTag */; } ts.isJSDocAuthorTag = isJSDocAuthorTag; function isJSDocClassTag(node) { - return node.kind === 332 /* SyntaxKind.JSDocClassTag */; + return node.kind === 335 /* SyntaxKind.JSDocClassTag */; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocCallbackTag(node) { - return node.kind === 338 /* SyntaxKind.JSDocCallbackTag */; + return node.kind === 341 /* SyntaxKind.JSDocCallbackTag */; } ts.isJSDocCallbackTag = isJSDocCallbackTag; function isJSDocPublicTag(node) { - return node.kind === 333 /* SyntaxKind.JSDocPublicTag */; + return node.kind === 336 /* SyntaxKind.JSDocPublicTag */; } ts.isJSDocPublicTag = isJSDocPublicTag; function isJSDocPrivateTag(node) { - return node.kind === 334 /* SyntaxKind.JSDocPrivateTag */; + return node.kind === 337 /* SyntaxKind.JSDocPrivateTag */; } ts.isJSDocPrivateTag = isJSDocPrivateTag; function isJSDocProtectedTag(node) { - return node.kind === 335 /* SyntaxKind.JSDocProtectedTag */; + return node.kind === 338 /* SyntaxKind.JSDocProtectedTag */; } ts.isJSDocProtectedTag = isJSDocProtectedTag; function isJSDocReadonlyTag(node) { - return node.kind === 336 /* SyntaxKind.JSDocReadonlyTag */; + return node.kind === 339 /* SyntaxKind.JSDocReadonlyTag */; } ts.isJSDocReadonlyTag = isJSDocReadonlyTag; function isJSDocOverrideTag(node) { - return node.kind === 337 /* SyntaxKind.JSDocOverrideTag */; + return node.kind === 340 /* SyntaxKind.JSDocOverrideTag */; } ts.isJSDocOverrideTag = isJSDocOverrideTag; function isJSDocDeprecatedTag(node) { - return node.kind === 331 /* SyntaxKind.JSDocDeprecatedTag */; + return node.kind === 334 /* SyntaxKind.JSDocDeprecatedTag */; } ts.isJSDocDeprecatedTag = isJSDocDeprecatedTag; function isJSDocSeeTag(node) { - return node.kind === 346 /* SyntaxKind.JSDocSeeTag */; + return node.kind === 349 /* SyntaxKind.JSDocSeeTag */; } ts.isJSDocSeeTag = isJSDocSeeTag; function isJSDocEnumTag(node) { - return node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocEnumTag = isJSDocEnumTag; function isJSDocParameterTag(node) { - return node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 341 /* SyntaxKind.JSDocReturnTag */; + return node.kind === 344 /* SyntaxKind.JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocThisTag(node) { - return node.kind === 342 /* SyntaxKind.JSDocThisTag */; + return node.kind === 345 /* SyntaxKind.JSDocThisTag */; } ts.isJSDocThisTag = isJSDocThisTag; function isJSDocTypeTag(node) { - return node.kind === 343 /* SyntaxKind.JSDocTypeTag */; + return node.kind === 346 /* SyntaxKind.JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 344 /* SyntaxKind.JSDocTemplateTag */; + return node.kind === 347 /* SyntaxKind.JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocUnknownTag(node) { - return node.kind === 327 /* SyntaxKind.JSDocTag */; + return node.kind === 330 /* SyntaxKind.JSDocTag */; } ts.isJSDocUnknownTag = isJSDocUnknownTag; function isJSDocPropertyTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocImplementsTag(node) { - return node.kind === 329 /* SyntaxKind.JSDocImplementsTag */; + return node.kind === 332 /* SyntaxKind.JSDocImplementsTag */; } ts.isJSDocImplementsTag = isJSDocImplementsTag; // Synthesized list /* @internal */ function isSyntaxList(n) { - return n.kind === 348 /* SyntaxKind.SyntaxList */; + return n.kind === 351 /* SyntaxKind.SyntaxList */; } ts.isSyntaxList = isSyntaxList; })(ts || (ts = {})); @@ -29963,14 +30198,14 @@ var ts; ts.Debug.failBadSyntaxKind(property.name, "Private identifiers are not allowed in object literals."); } switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return createExpressionForAccessorDeclaration(factory, node.properties, property, receiver, !!node.multiLine); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return createExpressionForPropertyAssignment(factory, property, receiver); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(factory, property, receiver); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return createExpressionForMethodDeclaration(factory, property, receiver); } } @@ -30078,8 +30313,8 @@ var ts; } ts.startsWithUseStrict = startsWithUseStrict; function isCommaSequence(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || - node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || + node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaSequence = isCommaSequence; function isJSDocTypeAssertion(node) { @@ -30097,17 +30332,18 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 15 /* OuterExpressionKinds.All */; } switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: if (kinds & 16 /* OuterExpressionKinds.ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) { return false; } return (kinds & 1 /* OuterExpressionKinds.Parentheses */) !== 0; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return (kinds & 2 /* OuterExpressionKinds.TypeAssertions */) !== 0; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return (kinds & 4 /* OuterExpressionKinds.NonNullAssertions */) !== 0; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return (kinds & 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */) !== 0; } return false; @@ -30228,10 +30464,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : factory.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 266 /* SyntaxKind.ImportDeclaration */ && node.importClause) { + if (node.kind === 269 /* SyntaxKind.ImportDeclaration */ && node.importClause) { return factory.getGeneratedNameForNode(node); } - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { return factory.getGeneratedNameForNode(node); } return undefined; @@ -30350,7 +30586,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -30362,11 +30598,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -30398,12 +30634,12 @@ var ts; */ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 225 /* SyntaxKind.SpreadElement */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 227 /* SyntaxKind.SpreadElement */: + case 301 /* SyntaxKind.SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -30421,7 +30657,7 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -30436,7 +30672,7 @@ var ts; : propertyName; } break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -30451,7 +30687,7 @@ var ts; : propertyName; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` if (bindingElement.name && ts.isPrivateIdentifier(bindingElement.name)) { return ts.Debug.failBadSyntaxKind(bindingElement.name); @@ -30474,13 +30710,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -30501,46 +30737,46 @@ var ts; ts.getJSDocTypeAliasName = getJSDocTypeAliasName; function canHaveIllegalType(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalType = canHaveIllegalType; function canHaveIllegalTypeParameters(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalTypeParameters = canHaveIllegalTypeParameters; function canHaveIllegalDecorators(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.canHaveIllegalDecorators = canHaveIllegalDecorators; function canHaveIllegalModifiers(node) { var kind = node.kind; - return kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 179 /* SyntaxKind.FunctionType */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 181 /* SyntaxKind.FunctionType */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.canHaveIllegalModifiers = canHaveIllegalModifiers; ts.isTypeNodeOrTypeParameterDeclaration = ts.or(ts.isTypeNode, ts.isTypeParameterDeclaration); @@ -30814,6 +31050,83 @@ var ts; return ts.setTextRange(factory.createNodeArray([], nodes.hasTrailingComma), nodes); } ts.elideNodes = elideNodes; + /** + * Gets the node from which a name should be generated. + */ + function getNodeForGeneratedName(name) { + if (name.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) { + var autoGenerateId = name.autoGenerateId; + var node = name; + var original = node.original; + while (original) { + node = original; + // if "node" is a different generated name (having a different "autoGenerateId"), use it and stop traversing. + if (ts.isMemberName(node) + && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) + && node.autoGenerateId !== autoGenerateId) { + break; + } + original = node.original; + } + // otherwise, return the original node for the source + return node; + } + return name; + } + ts.getNodeForGeneratedName = getNodeForGeneratedName; + function formatGeneratedNamePart(part, generateName) { + return typeof part === "object" ? formatGeneratedName(/*privateName*/ false, part.prefix, part.node, part.suffix, generateName) : + typeof part === "string" ? part.length > 0 && part.charCodeAt(0) === 35 /* CharacterCodes.hash */ ? part.slice(1) : part : + ""; + } + ts.formatGeneratedNamePart = formatGeneratedNamePart; + function formatIdentifier(name, generateName) { + return typeof name === "string" ? name : + formatIdentifierWorker(name, ts.Debug.checkDefined(generateName)); + } + function formatIdentifierWorker(node, generateName) { + return ts.isGeneratedPrivateIdentifier(node) ? generateName(node).slice(1) : + ts.isGeneratedIdentifier(node) ? generateName(node) : + ts.isPrivateIdentifier(node) ? node.escapedText.slice(1) : + ts.idText(node); + } + function formatGeneratedName(privateName, prefix, baseName, suffix, generateName) { + prefix = formatGeneratedNamePart(prefix, generateName); + suffix = formatGeneratedNamePart(suffix, generateName); + baseName = formatIdentifier(baseName, generateName); + return "".concat(privateName ? "#" : "").concat(prefix).concat(baseName).concat(suffix); + } + ts.formatGeneratedName = formatGeneratedName; + /** + * Creates a private backing field for an `accessor` {@link PropertyDeclaration}. + */ + function createAccessorPropertyBackingField(factory, node, modifiers, initializer) { + return factory.updatePropertyDeclaration(node, modifiers, factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"), + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, initializer); + } + ts.createAccessorPropertyBackingField = createAccessorPropertyBackingField; + /** + * Creates a {@link GetAccessorDeclaration} that reads from a private backing field. + */ + function createAccessorPropertyGetRedirector(factory, node, modifiers, name) { + return factory.createGetAccessorDeclaration(modifiers, name, [], + /*type*/ undefined, factory.createBlock([ + factory.createReturnStatement(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"))) + ])); + } + ts.createAccessorPropertyGetRedirector = createAccessorPropertyGetRedirector; + /** + * Creates a {@link SetAccessorDeclaration} that writes to a private backing field. + */ + function createAccessorPropertySetRedirector(factory, node, modifiers, name) { + return factory.createSetAccessorDeclaration(modifiers, name, [factory.createParameterDeclaration( + /*modifiers*/ undefined, + /*dotdotDotToken*/ undefined, "value")], factory.createBlock([ + factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage")), factory.createIdentifier("value"))) + ])); + } + ts.createAccessorPropertySetRedirector = createAccessorPropertySetRedirector; })(ts || (ts = {})); var ts; (function (ts) { @@ -30823,47 +31136,48 @@ var ts; ts.setTextRange = setTextRange; function canHaveModifiers(node) { var kind = node.kind; - return kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 180 /* SyntaxKind.ConstructorType */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 272 /* SyntaxKind.ExportDeclaration */; + return kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 182 /* SyntaxKind.ConstructorType */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.canHaveModifiers = canHaveModifiers; function canHaveDecorators(node) { var kind = node.kind; - return kind === 164 /* SyntaxKind.Parameter */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 257 /* SyntaxKind.ClassDeclaration */; + return kind === 166 /* SyntaxKind.Parameter */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.canHaveDecorators = canHaveDecorators; })(ts || (ts = {})); var ts; (function (ts) { + var _a; var SignatureFlags; (function (SignatureFlags) { SignatureFlags[SignatureFlags["None"] = 0] = "None"; @@ -30951,6 +31265,718 @@ var ts; function isImportMeta(node) { return ts.isMetaProperty(node) && node.keywordToken === 100 /* SyntaxKind.ImportKeyword */ && node.name.escapedText === "meta"; } + var forEachChildTable = (_a = {}, + _a[163 /* SyntaxKind.QualifiedName */] = function forEachChildInQualifiedName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[165 /* SyntaxKind.TypeParameter */] = function forEachChildInTypeParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || + visitNode(cbNode, node.expression); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[166 /* SyntaxKind.Parameter */] = function forEachChildInParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[168 /* SyntaxKind.PropertySignature */] = function forEachChildInPropertySignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[299 /* SyntaxKind.PropertyAssignment */] = function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.initializer); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[205 /* SyntaxKind.BindingElement */] = function forEachChildInBindingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function forEachChildInIndexSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function forEachChildInConstructorType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[181 /* SyntaxKind.FunctionType */] = function forEachChildInFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[176 /* SyntaxKind.CallSignature */] = forEachChildInCallOrConstructSignature, + _a[177 /* SyntaxKind.ConstructSignature */] = forEachChildInCallOrConstructSignature, + _a[171 /* SyntaxKind.MethodDeclaration */] = function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function forEachChildInMethodSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[173 /* SyntaxKind.Constructor */] = function forEachChildInConstructor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function forEachChildInGetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function forEachChildInSetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function forEachChildInFunctionExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function forEachChildInArrowFunction(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.equalsGreaterThanToken) || + visitNode(cbNode, node.body); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.body); + }, + _a[180 /* SyntaxKind.TypeReference */] = function forEachChildInTypeReference(node, cbNode, cbNodes) { + return visitNode(cbNode, node.typeName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[179 /* SyntaxKind.TypePredicate */] = function forEachChildInTypePredicate(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertsModifier) || + visitNode(cbNode, node.parameterName) || + visitNode(cbNode, node.type); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function forEachChildInTypeQuery(node, cbNode, cbNodes) { + return visitNode(cbNode, node.exprName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function forEachChildInTypeLiteral(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.members); + }, + _a[185 /* SyntaxKind.ArrayType */] = function forEachChildInArrayType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.elementType); + }, + _a[186 /* SyntaxKind.TupleType */] = function forEachChildInTupleType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[189 /* SyntaxKind.UnionType */] = forEachChildInUnionOrIntersectionType, + _a[190 /* SyntaxKind.IntersectionType */] = forEachChildInUnionOrIntersectionType, + _a[191 /* SyntaxKind.ConditionalType */] = function forEachChildInConditionalType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.checkType) || + visitNode(cbNode, node.extendsType) || + visitNode(cbNode, node.trueType) || + visitNode(cbNode, node.falseType); + }, + _a[192 /* SyntaxKind.InferType */] = function forEachChildInInferType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.typeParameter); + }, + _a[202 /* SyntaxKind.ImportType */] = function forEachChildInImportType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.assertions) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertClause); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[195 /* SyntaxKind.TypeOperator */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[196 /* SyntaxKind.IndexedAccessType */] = function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.objectType) || + visitNode(cbNode, node.indexType); + }, + _a[197 /* SyntaxKind.MappedType */] = function forEachChildInMappedType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.readonlyToken) || + visitNode(cbNode, node.typeParameter) || + visitNode(cbNode, node.nameType) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[198 /* SyntaxKind.LiteralType */] = function forEachChildInLiteralType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.literal); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type); + }, + _a[203 /* SyntaxKind.ObjectBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.name); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.argumentExpression); + }, + _a[210 /* SyntaxKind.CallExpression */] = forEachChildInCallOrNewExpression, + _a[211 /* SyntaxKind.NewExpression */] = forEachChildInCallOrNewExpression, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.template); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function forEachChildInVoidExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function forEachChildInYieldExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + }, + _a[231 /* SyntaxKind.AsExpression */] = function forEachChildInAsExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.type); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function forEachChildInMetaProperty(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function forEachChildInSpreadElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[238 /* SyntaxKind.Block */] = forEachChildInBlock, + _a[265 /* SyntaxKind.ModuleBlock */] = forEachChildInBlock, + _a[308 /* SyntaxKind.SourceFile */] = function forEachChildInSourceFile(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function forEachChildInVariableStatement(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.declarations); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[242 /* SyntaxKind.IfStatement */] = function forEachChildInIfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + }, + _a[243 /* SyntaxKind.DoStatement */] = function forEachChildInDoStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function forEachChildInWhileStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[245 /* SyntaxKind.ForStatement */] = function forEachChildInForStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || + visitNode(cbNode, node.statement); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function forEachChildInForInStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function forEachChildInForOfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = forEachChildInContinueOrBreakStatement, + _a[249 /* SyntaxKind.BreakStatement */] = forEachChildInContinueOrBreakStatement, + _a[250 /* SyntaxKind.ReturnStatement */] = function forEachChildInReturnStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[251 /* SyntaxKind.WithStatement */] = function forEachChildInWithStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function forEachChildInCaseBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.clauses); + }, + _a[292 /* SyntaxKind.CaseClause */] = function forEachChildInCaseClause(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.statements); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function forEachChildInDefaultClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function forEachChildInThrowStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[255 /* SyntaxKind.TryStatement */] = function forEachChildInTryStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + }, + _a[295 /* SyntaxKind.CatchClause */] = function forEachChildInCatchClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); + }, + _a[167 /* SyntaxKind.Decorator */] = function forEachChildInDecorator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = forEachChildInClassDeclarationOrExpression, + _a[228 /* SyntaxKind.ClassExpression */] = forEachChildInClassDeclarationOrExpression, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[302 /* SyntaxKind.EnumMember */] = function forEachChildInEnumMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function forEachChildInImportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[270 /* SyntaxKind.ImportClause */] = function forEachChildInImportClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); + }, + _a[296 /* SyntaxKind.AssertClause */] = function forEachChildInAssertClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function forEachChildInAssertEntry(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.value); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNode(cbNode, node.name); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[272 /* SyntaxKind.NamedImports */] = forEachChildInNamedImportsOrExports, + _a[276 /* SyntaxKind.NamedExports */] = forEachChildInNamedImportsOrExports, + _a[275 /* SyntaxKind.ExportDeclaration */] = function forEachChildInExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[278 /* SyntaxKind.ExportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[274 /* SyntaxKind.ExportAssignment */] = function forEachChildInExportAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function forEachChildInTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[236 /* SyntaxKind.TemplateSpan */] = function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.literal); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.literal); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function forEachChildInHeritageClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[280 /* SyntaxKind.ExternalModuleReference */] = function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[279 /* SyntaxKind.MissingDeclaration */] = function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function forEachChildInCommaListExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[281 /* SyntaxKind.JsxElement */] = function forEachChildInJsxElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingElement) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingElement); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function forEachChildInJsxFragment(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[283 /* SyntaxKind.JsxOpeningElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[289 /* SyntaxKind.JsxAttributes */] = function forEachChildInJsxAttributes(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function forEachChildInJsxExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tagName); + }, + _a[187 /* SyntaxKind.OptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[188 /* SyntaxKind.RestType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[312 /* SyntaxKind.JSDocTypeExpression */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[318 /* SyntaxKind.JSDocNonNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[317 /* SyntaxKind.JSDocNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[319 /* SyntaxKind.JSDocOptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[321 /* SyntaxKind.JSDocVariadicType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[320 /* SyntaxKind.JSDocFunctionType */] = function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[323 /* SyntaxKind.JSDoc */] = function forEachChildInJSDoc(node, cbNode, cbNodes) { + return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + || visitNodes(cbNode, cbNodes, node.tags); + }, + _a[349 /* SyntaxKind.JSDocSeeTag */] = function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.name) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[313 /* SyntaxKind.JSDocNameReference */] = function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[314 /* SyntaxKind.JSDocMemberName */] = function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[343 /* SyntaxKind.JSDocParameterTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[350 /* SyntaxKind.JSDocPropertyTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[333 /* SyntaxKind.JSDocAuthorTag */] = function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[332 /* SyntaxKind.JSDocImplementsTag */] = function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[331 /* SyntaxKind.JSDocAugmentsTag */] = function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[347 /* SyntaxKind.JSDocTemplateTag */] = function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.constraint) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[348 /* SyntaxKind.JSDocTypedefTag */] = function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.typeExpression && + node.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ + ? visitNode(cbNode, node.typeExpression) || + visitNode(cbNode, node.fullName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + : visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); + }, + _a[341 /* SyntaxKind.JSDocCallbackTag */] = function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[344 /* SyntaxKind.JSDocReturnTag */] = forEachChildInJSDocReturnTag, + _a[346 /* SyntaxKind.JSDocTypeTag */] = forEachChildInJSDocReturnTag, + _a[345 /* SyntaxKind.JSDocThisTag */] = forEachChildInJSDocReturnTag, + _a[342 /* SyntaxKind.JSDocEnumTag */] = forEachChildInJSDocReturnTag, + _a[326 /* SyntaxKind.JSDocSignature */] = function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { + return ts.forEach(node.typeParameters, cbNode) || + ts.forEach(node.parameters, cbNode) || + visitNode(cbNode, node.type); + }, + _a[327 /* SyntaxKind.JSDocLink */] = forEachChildInJSDocLinkCodeOrPlain, + _a[328 /* SyntaxKind.JSDocLinkCode */] = forEachChildInJSDocLinkCodeOrPlain, + _a[329 /* SyntaxKind.JSDocLinkPlain */] = forEachChildInJSDocLinkCodeOrPlain, + _a[325 /* SyntaxKind.JSDocTypeLiteral */] = function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { + return ts.forEach(node.jsDocPropertyTags, cbNode); + }, + _a[330 /* SyntaxKind.JSDocTag */] = forEachChildInJSDocTag, + _a[335 /* SyntaxKind.JSDocClassTag */] = forEachChildInJSDocTag, + _a[336 /* SyntaxKind.JSDocPublicTag */] = forEachChildInJSDocTag, + _a[337 /* SyntaxKind.JSDocPrivateTag */] = forEachChildInJSDocTag, + _a[338 /* SyntaxKind.JSDocProtectedTag */] = forEachChildInJSDocTag, + _a[339 /* SyntaxKind.JSDocReadonlyTag */] = forEachChildInJSDocTag, + _a[334 /* SyntaxKind.JSDocDeprecatedTag */] = forEachChildInJSDocTag, + _a[340 /* SyntaxKind.JSDocOverrideTag */] = forEachChildInJSDocTag, + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = forEachChildInPartiallyEmittedExpression, + _a); + // shared + function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + } + function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + } + function forEachChildInParenthesizedTypeOrTypeOperator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInObjectOrArrayBindingPattern(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInCallOrNewExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + // TODO: should we separate these branches out? + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNodes(cbNode, cbNodes, node.arguments); + } + function forEachChildInBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + } + function forEachChildInContinueOrBreakStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label); + } + function forEachChildInClassDeclarationOrExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + } + function forEachChildInNamedImportsOrExports(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInImportOrExportSpecifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); + } + function forEachChildInJsxOpeningOrSelfClosingElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.attributes); + } + function forEachChildInOptionalRestOrJSDocParameterModifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInJSDocParameterOrPropertyTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.isNameFirst + ? visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression) + : visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name)) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocReturnTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + } + function forEachChildInJSDocTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) + || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + } /** * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, @@ -30965,563 +31991,11 @@ var ts; * that they appear in the source code. The language service depends on this property to locate nodes by position. */ function forEachChild(node, cbNode, cbNodes) { - if (!node || node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node === undefined || node.kind <= 162 /* SyntaxKind.LastToken */) { return; } - switch (node.kind) { - case 161 /* SyntaxKind.QualifiedName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 163 /* SyntaxKind.TypeParameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.default) || - visitNode(cbNode, node.expression); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.equalsToken) || - visitNode(cbNode, node.objectAssignmentInitializer); - case 298 /* SyntaxKind.SpreadAssignment */: - return visitNode(cbNode, node.expression); - case 164 /* SyntaxKind.Parameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 166 /* SyntaxKind.PropertySignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 296 /* SyntaxKind.PropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.initializer); - case 254 /* SyntaxKind.VariableDeclaration */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 203 /* SyntaxKind.BindingElement */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 176 /* SyntaxKind.IndexSignature */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 180 /* SyntaxKind.ConstructorType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 179 /* SyntaxKind.FunctionType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - return visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 169 /* SyntaxKind.MethodDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 168 /* SyntaxKind.MethodSignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 171 /* SyntaxKind.Constructor */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 172 /* SyntaxKind.GetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 173 /* SyntaxKind.SetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 256 /* SyntaxKind.FunctionDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 213 /* SyntaxKind.FunctionExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 214 /* SyntaxKind.ArrowFunction */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.equalsGreaterThanToken) || - visitNode(cbNode, node.body); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.body); - case 178 /* SyntaxKind.TypeReference */: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 177 /* SyntaxKind.TypePredicate */: - return visitNode(cbNode, node.assertsModifier) || - visitNode(cbNode, node.parameterName) || - visitNode(cbNode, node.type); - case 181 /* SyntaxKind.TypeQuery */: - return visitNode(cbNode, node.exprName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 182 /* SyntaxKind.TypeLiteral */: - return visitNodes(cbNode, cbNodes, node.members); - case 183 /* SyntaxKind.ArrayType */: - return visitNode(cbNode, node.elementType); - case 184 /* SyntaxKind.TupleType */: - return visitNodes(cbNode, cbNodes, node.elements); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - return visitNodes(cbNode, cbNodes, node.types); - case 189 /* SyntaxKind.ConditionalType */: - return visitNode(cbNode, node.checkType) || - visitNode(cbNode, node.extendsType) || - visitNode(cbNode, node.trueType) || - visitNode(cbNode, node.falseType); - case 190 /* SyntaxKind.InferType */: - return visitNode(cbNode, node.typeParameter); - case 200 /* SyntaxKind.ImportType */: - return visitNode(cbNode, node.argument) || - visitNode(cbNode, node.assertions) || - visitNode(cbNode, node.qualifier) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - return visitNode(cbNode, node.assertClause); - case 191 /* SyntaxKind.ParenthesizedType */: - case 193 /* SyntaxKind.TypeOperator */: - return visitNode(cbNode, node.type); - case 194 /* SyntaxKind.IndexedAccessType */: - return visitNode(cbNode, node.objectType) || - visitNode(cbNode, node.indexType); - case 195 /* SyntaxKind.MappedType */: - return visitNode(cbNode, node.readonlyToken) || - visitNode(cbNode, node.typeParameter) || - visitNode(cbNode, node.nameType) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNodes(cbNode, cbNodes, node.members); - case 196 /* SyntaxKind.LiteralType */: - return visitNode(cbNode, node.literal); - case 197 /* SyntaxKind.NamedTupleMember */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - return visitNodes(cbNode, cbNodes, node.elements); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.properties); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.name); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.argumentExpression); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNodes(cbNode, cbNodes, node.arguments); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.template); - case 211 /* SyntaxKind.TypeAssertionExpression */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); - case 212 /* SyntaxKind.ParenthesizedExpression */: - return visitNode(cbNode, node.expression); - case 215 /* SyntaxKind.DeleteExpression */: - return visitNode(cbNode, node.expression); - case 216 /* SyntaxKind.TypeOfExpression */: - return visitNode(cbNode, node.expression); - case 217 /* SyntaxKind.VoidExpression */: - return visitNode(cbNode, node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 224 /* SyntaxKind.YieldExpression */: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); - case 218 /* SyntaxKind.AwaitExpression */: - return visitNode(cbNode, node.expression); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 221 /* SyntaxKind.BinaryExpression */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); - case 229 /* SyntaxKind.AsExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.type); - case 230 /* SyntaxKind.NonNullExpression */: - return visitNode(cbNode, node.expression); - case 231 /* SyntaxKind.MetaProperty */: - return visitNode(cbNode, node.name); - case 222 /* SyntaxKind.ConditionalExpression */: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); - case 225 /* SyntaxKind.SpreadElement */: - return visitNode(cbNode, node.expression); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - return visitNodes(cbNode, cbNodes, node.statements); - case 305 /* SyntaxKind.SourceFile */: - return visitNodes(cbNode, cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); - case 237 /* SyntaxKind.VariableStatement */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); - case 255 /* SyntaxKind.VariableDeclarationList */: - return visitNodes(cbNode, cbNodes, node.declarations); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitNode(cbNode, node.expression); - case 239 /* SyntaxKind.IfStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); - case 240 /* SyntaxKind.DoStatement */: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); - case 241 /* SyntaxKind.WhileStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 242 /* SyntaxKind.ForStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || - visitNode(cbNode, node.statement); - case 243 /* SyntaxKind.ForInStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 244 /* SyntaxKind.ForOfStatement */: - return visitNode(cbNode, node.awaitModifier) || - visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return visitNode(cbNode, node.label); - case 247 /* SyntaxKind.ReturnStatement */: - return visitNode(cbNode, node.expression); - case 248 /* SyntaxKind.WithStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 249 /* SyntaxKind.SwitchStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 263 /* SyntaxKind.CaseBlock */: - return visitNodes(cbNode, cbNodes, node.clauses); - case 289 /* SyntaxKind.CaseClause */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.statements); - case 290 /* SyntaxKind.DefaultClause */: - return visitNodes(cbNode, cbNodes, node.statements); - case 250 /* SyntaxKind.LabeledStatement */: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); - case 251 /* SyntaxKind.ThrowStatement */: - return visitNode(cbNode, node.expression); - case 252 /* SyntaxKind.TryStatement */: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); - case 292 /* SyntaxKind.CatchClause */: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); - case 165 /* SyntaxKind.Decorator */: - return visitNode(cbNode, node.expression); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 258 /* SyntaxKind.InterfaceDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); - case 260 /* SyntaxKind.EnumDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.members); - case 299 /* SyntaxKind.EnumMember */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 261 /* SyntaxKind.ModuleDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 267 /* SyntaxKind.ImportClause */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); - case 293 /* SyntaxKind.AssertClause */: - return visitNodes(cbNode, cbNodes, node.elements); - case 294 /* SyntaxKind.AssertEntry */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.value); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNode(cbNode, node.name); - case 268 /* SyntaxKind.NamespaceImport */: - return visitNode(cbNode, node.name); - case 274 /* SyntaxKind.NamespaceExport */: - return visitNode(cbNode, node.name); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: - return visitNodes(cbNode, cbNodes, node.elements); - case 272 /* SyntaxKind.ExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); - case 271 /* SyntaxKind.ExportAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.expression); - case 223 /* SyntaxKind.TemplateExpression */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 233 /* SyntaxKind.TemplateSpan */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.literal); - case 198 /* SyntaxKind.TemplateLiteralType */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.literal); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitNode(cbNode, node.expression); - case 291 /* SyntaxKind.HeritageClause */: - return visitNodes(cbNode, cbNodes, node.types); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 277 /* SyntaxKind.ExternalModuleReference */: - return visitNode(cbNode, node.expression); - case 276 /* SyntaxKind.MissingDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers); - case 351 /* SyntaxKind.CommaListExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 278 /* SyntaxKind.JsxElement */: - return visitNode(cbNode, node.openingElement) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingElement); - case 282 /* SyntaxKind.JsxFragment */: - return visitNode(cbNode, node.openingFragment) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingFragment); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - return visitNode(cbNode, node.tagName) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.attributes); - case 286 /* SyntaxKind.JsxAttributes */: - return visitNodes(cbNode, cbNodes, node.properties); - case 285 /* SyntaxKind.JsxAttribute */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - return visitNode(cbNode, node.expression); - case 288 /* SyntaxKind.JsxExpression */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.expression); - case 281 /* SyntaxKind.JsxClosingElement */: - return visitNode(cbNode, node.tagName); - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - return visitNode(cbNode, node.type); - case 317 /* SyntaxKind.JSDocFunctionType */: - return visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 320 /* SyntaxKind.JSDoc */: - return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - || visitNodes(cbNode, cbNodes, node.tags); - case 346 /* SyntaxKind.JSDocSeeTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 310 /* SyntaxKind.JSDocNameReference */: - return visitNode(cbNode, node.name); - case 311 /* SyntaxKind.JSDocMemberName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - return visitNode(cbNode, node.tagName) || - (node.isNameFirst - ? visitNode(cbNode, node.name) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 330 /* SyntaxKind.JSDocAuthorTag */: - return visitNode(cbNode, node.tagName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 329 /* SyntaxKind.JSDocImplementsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 344 /* SyntaxKind.JSDocTemplateTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.constraint) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 345 /* SyntaxKind.JSDocTypedefTag */: - return visitNode(cbNode, node.tagName) || - (node.typeExpression && - node.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ - ? visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.fullName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 338 /* SyntaxKind.JSDocCallbackTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 323 /* SyntaxKind.JSDocSignature */: - return ts.forEach(node.typeParameters, cbNode) || - ts.forEach(node.parameters, cbNode) || - visitNode(cbNode, node.type); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: - return visitNode(cbNode, node.name); - case 322 /* SyntaxKind.JSDocTypeLiteral */: - return ts.forEach(node.jsDocPropertyTags, cbNode); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: - case 337 /* SyntaxKind.JSDocOverrideTag */: - return visitNode(cbNode, node.tagName) - || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - return visitNode(cbNode, node.expression); - } + var fn = forEachChildTable[node.kind]; + return fn === undefined ? undefined : fn(node, cbNode, cbNodes); } ts.forEachChild = forEachChild; /** @internal */ @@ -31568,7 +32042,7 @@ var ts; continue; return res; } - if (current.kind >= 161 /* SyntaxKind.FirstNode */) { + if (current.kind >= 163 /* SyntaxKind.FirstNode */) { // add children in reverse order to the queue, so popping gives the first child for (var _i = 0, _a = gatherPossibleChildren(current); _i < _a.length; _i++) { var child = _a[_i]; @@ -31678,13 +32152,11 @@ var ts; var scanner = ts.createScanner(99 /* ScriptTarget.Latest */, /*skipTrivia*/ true); var disallowInAndDecoratorContext = 4096 /* NodeFlags.DisallowInContext */ | 16384 /* NodeFlags.DecoratorContext */; // capture constructors in 'initializeState' to avoid null checks - // tslint:disable variable-name var NodeConstructor; var TokenConstructor; var IdentifierConstructor; var PrivateIdentifierConstructor; var SourceFileConstructor; - // tslint:enable variable-name function countNode(node) { nodeCount++; return node; @@ -32393,7 +32865,7 @@ var ts; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. - if (token() === 132 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { return false; } return token() > 116 /* SyntaxKind.LastReservedWord */; @@ -32639,7 +33111,7 @@ var ts; ts.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, "", "", /*templateFlags*/ undefined) : kind === 8 /* SyntaxKind.NumericLiteral */ ? factory.createNumericLiteral("", /*numericLiteralFlags*/ undefined) : kind === 10 /* SyntaxKind.StringLiteral */ ? factory.createStringLiteral("", /*isSingleQuote*/ undefined) : - kind === 276 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : + kind === 279 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : factory.createToken(kind); return finishNode(result, pos); } @@ -32660,8 +33132,9 @@ var ts; // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker var originalKeywordKind = token(); var text = internIdentifier(scanner.getTokenValue()); + var hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape(); nextTokenWithoutCheck(); - return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind), pos); + return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind, hasExtendedUnicodeEscape), pos); } if (token() === 80 /* SyntaxKind.PrivateIdentifier */) { parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); @@ -32738,7 +33211,7 @@ var ts; } function parsePrivateIdentifier() { var pos = getNodePos(); - var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText())); + var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue())); nextToken(); return finishNode(node, pos); } @@ -32762,15 +33235,16 @@ var ts; if (token() === 88 /* SyntaxKind.DefaultKeyword */) { return lookAhead(nextTokenCanFollowDefaultKeyword); } - if (token() === 152 /* SyntaxKind.TypeKeyword */) { + if (token() === 154 /* SyntaxKind.TypeKeyword */) { return lookAhead(nextTokenCanFollowExportModifier); } return canFollowExportModifier(); case 88 /* SyntaxKind.DefaultKeyword */: return nextTokenCanFollowDefaultKeyword(); + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: nextToken(); return canFollowModifier(); default: @@ -32779,7 +33253,7 @@ var ts; } function canFollowExportModifier() { return token() !== 41 /* SyntaxKind.AsteriskToken */ - && token() !== 127 /* SyntaxKind.AsKeyword */ + && token() !== 128 /* SyntaxKind.AsKeyword */ && token() !== 18 /* SyntaxKind.OpenBraceToken */ && canFollowModifier(); } @@ -32802,7 +33276,7 @@ var ts; return token() === 84 /* SyntaxKind.ClassKeyword */ || token() === 98 /* SyntaxKind.FunctionKeyword */ || token() === 118 /* SyntaxKind.InterfaceKeyword */ || (token() === 126 /* SyntaxKind.AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) || - (token() === 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); + (token() === 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } // True if positioned at the start of a list element function isListElement(parsingContext, inErrorRecovery) { @@ -33182,20 +33656,20 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 176 /* SyntaxKind.IndexSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 234 /* SyntaxKind.SemicolonClassElement */: + case 173 /* SyntaxKind.Constructor */: + case 178 /* SyntaxKind.IndexSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 237 /* SyntaxKind.SemicolonClassElement */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ && - methodDeclaration.name.originalKeywordKind === 134 /* SyntaxKind.ConstructorKeyword */; + methodDeclaration.name.originalKeywordKind === 135 /* SyntaxKind.ConstructorKeyword */; return !nameIsConstructor; } } @@ -33204,8 +33678,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return true; } } @@ -33214,58 +33688,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 238 /* SyntaxKind.ExpressionStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 236 /* SyntaxKind.EmptyStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 250 /* SyntaxKind.LabeledStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 174 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 176 /* SyntaxKind.CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind !== 257 /* SyntaxKind.VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -33286,7 +33760,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 164 /* SyntaxKind.Parameter */) { + if (node.kind !== 166 /* SyntaxKind.Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -33579,14 +34053,14 @@ var ts; // If true, we should abort parsing an error function. function typeHasArrowFunctionBlockingParseError(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return ts.nodeIsMissing(node.typeName); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: { + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: { var _a = node, parameters = _a.parameters, type = _a.type; return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); } - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return typeHasArrowFunctionBlockingParseError(node.type); default: return false; @@ -33665,7 +34139,7 @@ var ts; function parseJSDocType() { scanner.setInJSDocType(true); var pos = getNodePos(); - if (parseOptional(141 /* SyntaxKind.ModuleKeyword */)) { + if (parseOptional(142 /* SyntaxKind.ModuleKeyword */)) { // TODO(rbuckton): We never set the type for a JSDocNamepathType. What should we put here? var moduleTag = factory.createJSDocNamepathType(/*type*/ undefined); terminate: while (true) { @@ -33881,14 +34355,14 @@ var ts; function parseSignatureMember(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - if (kind === 175 /* SyntaxKind.ConstructSignature */) { + if (kind === 177 /* SyntaxKind.ConstructSignature */) { parseExpected(103 /* SyntaxKind.NewKeyword */); } var typeParameters = parseTypeParameters(); var parameters = parseParameters(4 /* SignatureFlags.Type */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ true); parseTypeMemberSemicolon(); - var node = kind === 174 /* SyntaxKind.CallSignature */ + var node = kind === 176 /* SyntaxKind.CallSignature */ ? factory.createCallSignature(typeParameters, parameters, type) : factory.createConstructSignature(typeParameters, parameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -33982,8 +34456,8 @@ var ts; // Return true if we have the start of a signature member if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || - token() === 136 /* SyntaxKind.GetKeyword */ || - token() === 149 /* SyntaxKind.SetKeyword */) { + token() === 137 /* SyntaxKind.GetKeyword */ || + token() === 151 /* SyntaxKind.SetKeyword */) { return true; } var idToken = false; @@ -34015,19 +34489,19 @@ var ts; } function parseTypeMember() { if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */) { - return parseSignatureMember(174 /* SyntaxKind.CallSignature */); + return parseSignatureMember(176 /* SyntaxKind.CallSignature */); } if (token() === 103 /* SyntaxKind.NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) { - return parseSignatureMember(175 /* SyntaxKind.ConstructSignature */); + return parseSignatureMember(177 /* SyntaxKind.ConstructSignature */); } var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 174 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 175 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers); @@ -34068,9 +34542,9 @@ var ts; function isStartOfMappedType() { nextToken(); if (token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { - return nextToken() === 145 /* SyntaxKind.ReadonlyKeyword */; + return nextToken() === 146 /* SyntaxKind.ReadonlyKeyword */; } - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */) { nextToken(); } return token() === 22 /* SyntaxKind.OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 101 /* SyntaxKind.InKeyword */; @@ -34086,15 +34560,15 @@ var ts; var pos = getNodePos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var readonlyToken; - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { readonlyToken = parseTokenNode(); - if (readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - parseExpected(145 /* SyntaxKind.ReadonlyKeyword */); + if (readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + parseExpected(146 /* SyntaxKind.ReadonlyKeyword */); } } parseExpected(22 /* SyntaxKind.OpenBracketToken */); var typeParameter = parseMappedTypeParameter(); - var nameType = parseOptional(127 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; + var nameType = parseOptional(128 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; parseExpected(23 /* SyntaxKind.CloseBracketToken */); var questionToken; if (token() === 57 /* SyntaxKind.QuestionToken */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { @@ -34208,7 +34682,7 @@ var ts; var openBracePosition = scanner.getTokenPos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var multiLine = scanner.hasPrecedingLineBreak(); - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); parseExpected(58 /* SyntaxKind.ColonToken */); var clause = parseAssertClause(/*skipAssertKeyword*/ true); if (!parseExpected(19 /* SyntaxKind.CloseBraceToken */)) { @@ -34241,16 +34715,16 @@ var ts; } function parseNonArrayType() { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. return tryParse(parseKeywordAndNoDot) || parseTypeReference(); case 66 /* SyntaxKind.AsteriskEqualsToken */: @@ -34283,7 +34757,7 @@ var ts; return parseTokenNode(); case 108 /* SyntaxKind.ThisKeyword */: { var thisKeyword = parseThisTypeNode(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { return parseThisTypePredicate(thisKeyword); } else { @@ -34300,7 +34774,7 @@ var ts; return parseParenthesizedType(); case 100 /* SyntaxKind.ImportKeyword */: return parseImportType(); - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference(); case 15 /* SyntaxKind.TemplateHead */: return parseTemplateType(); @@ -34310,21 +34784,21 @@ var ts; } function isStartOfType(inStartOfParameter) { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 18 /* SyntaxKind.OpenBraceToken */: case 22 /* SyntaxKind.OpenBracketToken */: case 29 /* SyntaxKind.LessThanToken */: @@ -34336,14 +34810,14 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 41 /* SyntaxKind.AsteriskToken */: case 57 /* SyntaxKind.QuestionToken */: case 53 /* SyntaxKind.ExclamationToken */: case 25 /* SyntaxKind.DotDotDotToken */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 100 /* SyntaxKind.ImportKeyword */: - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: return true; @@ -34420,17 +34894,17 @@ var ts; } function parseInferType() { var pos = getNodePos(); - parseExpected(137 /* SyntaxKind.InferKeyword */); + parseExpected(138 /* SyntaxKind.InferKeyword */); return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos); } function parseTypeOperatorOrHigher() { var operator = token(); switch (operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: return parseTypeOperator(operator); - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return parseInferType(); } return allowConditionalTypesAnd(parsePostfixTypeOrHigher); @@ -34550,16 +35024,16 @@ var ts; } function parseTypePredicatePrefix() { var id = parseIdentifier(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { nextToken(); return id; } } function parseAssertsTypePredicate() { var pos = getNodePos(); - var assertsModifier = parseExpectedToken(128 /* SyntaxKind.AssertsKeyword */); + var assertsModifier = parseExpectedToken(129 /* SyntaxKind.AssertsKeyword */); var parameterName = token() === 108 /* SyntaxKind.ThisKeyword */ ? parseThisTypeNode() : parseIdentifier(); - var type = parseOptional(139 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; + var type = parseOptional(140 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos); } function parseType() { @@ -34629,7 +35103,7 @@ var ts; case 45 /* SyntaxKind.PlusPlusToken */: case 46 /* SyntaxKind.MinusMinusToken */: case 29 /* SyntaxKind.LessThanToken */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: case 125 /* SyntaxKind.YieldKeyword */: case 80 /* SyntaxKind.PrivateIdentifier */: // Yield/await always starts an expression. Either it is an identifier (in which case @@ -34817,7 +35291,7 @@ var ts; // Unknown -> There *might* be a parenthesized arrow function here. // Speculatively look ahead to be sure, and rollback if not. function isParenthesizedArrowFunctionExpression() { - if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 132 /* SyntaxKind.AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token() === 38 /* SyntaxKind.EqualsGreaterThanToken */) { @@ -34830,7 +35304,7 @@ var ts; return 0 /* Tristate.False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0 /* Tristate.False */; @@ -34874,8 +35348,8 @@ var ts; // Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This // isn't actually allowed, but we want to treat it as a lambda so we can provide // a good error message. - if (ts.isModifierKind(second) && second !== 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { - if (nextToken() === 127 /* SyntaxKind.AsKeyword */) { + if (ts.isModifierKind(second) && second !== 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { + if (nextToken() === 128 /* SyntaxKind.AsKeyword */) { // https://github.com/microsoft/TypeScript/issues/44466 return 0 /* Tristate.False */; } @@ -34957,7 +35431,7 @@ var ts; } function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) { // We do a check here so that we won't be doing unnecessarily call to "lookAhead" - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* Tristate.True */) { var pos = getNodePos(); var asyncModifier = parseModifiersForArrowFunction(); @@ -34971,7 +35445,7 @@ var ts; // AsyncArrowFunctionExpression: // 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In] // 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In] - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); // If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function // but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher" @@ -35037,7 +35511,7 @@ var ts; // // So we need just a bit of lookahead to ensure that it can only be a signature. var unwrappedType = type; - while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 191 /* SyntaxKind.ParenthesizedType */) { + while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 193 /* SyntaxKind.ParenthesizedType */) { unwrappedType = unwrappedType.type; // Skip parens if need be } var hasJSDocFunctionType = unwrappedType && ts.isJSDocFunctionType(unwrappedType); @@ -35132,7 +35606,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand, pos); } function isInOrOfKeyword(t) { - return t === 101 /* SyntaxKind.InKeyword */ || t === 160 /* SyntaxKind.OfKeyword */; + return t === 101 /* SyntaxKind.InKeyword */ || t === 162 /* SyntaxKind.OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand, pos) { while (true) { @@ -35170,7 +35644,7 @@ var ts; if (token() === 101 /* SyntaxKind.InKeyword */ && inDisallowInContext()) { break; } - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */ || token() === 150 /* SyntaxKind.SatisfiesKeyword */) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -35180,8 +35654,10 @@ var ts; break; } else { + var keywordKind = token(); nextToken(); - leftOperand = makeAsExpression(leftOperand, parseType()); + leftOperand = keywordKind === 150 /* SyntaxKind.SatisfiesKeyword */ ? makeSatisfiesExpression(leftOperand, parseType()) : + makeAsExpression(leftOperand, parseType()); } } else { @@ -35196,6 +35672,9 @@ var ts; } return ts.getBinaryOperatorPrecedence(token()) > 0; } + function makeSatisfiesExpression(left, right) { + return finishNode(factory.createSatisfiesExpression(left, right), left.pos); + } function makeBinaryExpression(left, operatorToken, right, pos) { return finishNode(factory.createBinaryExpression(left, operatorToken, right), pos); } @@ -35219,7 +35698,7 @@ var ts; return finishNode(factory.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); } function isAwaitExpression() { - if (token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -35272,7 +35751,7 @@ var ts; if (token() === 42 /* SyntaxKind.AsteriskAsteriskToken */) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -35313,7 +35792,7 @@ var ts; // UnaryExpression (modified): // < type > UnaryExpression return parseTypeAssertion(); - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: if (isAwaitExpression()) { return parseAwaitExpression(); } @@ -35343,7 +35822,7 @@ var ts; case 89 /* SyntaxKind.DeleteKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: return false; case 29 /* SyntaxKind.LessThanToken */: // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression @@ -35526,11 +36005,11 @@ var ts; var pos = getNodePos(); var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (opening.kind === 283 /* SyntaxKind.JsxOpeningElement */) { var children = parseJsxChildren(opening); var closingElement = void 0; var lastChild = children[children.length - 1]; - if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 278 /* SyntaxKind.JsxElement */ + if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { // when an unclosed JsxOpeningElement incorrectly parses its parent's JsxClosingElement, @@ -35556,11 +36035,11 @@ var ts; } result = finishNode(factory.createJsxElement(opening, children, closingElement), pos); } - else if (opening.kind === 283 /* SyntaxKind.JsxOpeningFragment */) { + else if (opening.kind === 286 /* SyntaxKind.JsxOpeningFragment */) { result = finishNode(factory.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos); } else { - ts.Debug.assert(opening.kind === 279 /* SyntaxKind.JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 282 /* SyntaxKind.JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -35630,7 +36109,7 @@ var ts; break; list.push(child); if (ts.isJsxOpeningElement(openingTag) - && (child === null || child === void 0 ? void 0 : child.kind) === 278 /* SyntaxKind.JsxElement */ + && (child === null || child === void 0 ? void 0 : child.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { // stop after parsing a mismatched child like

...(
) in order to reattach the higher @@ -35875,7 +36354,7 @@ var ts; } if (isTemplateStartOfTaggedTemplate()) { // Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments - expression = !questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? + expression = !questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest(pos, expression, questionDotToken, /*typeArguments*/ undefined); continue; @@ -35922,7 +36401,7 @@ var ts; } if (typeArguments || token() === 20 /* SyntaxKind.OpenParenToken */) { // Absorb type arguments into CallExpression when preceding expression is ExpressionWithTypeArguments - if (!questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (!questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36008,7 +36487,7 @@ var ts; return parseArrayLiteralExpression(); case 18 /* SyntaxKind.OpenBraceToken */: return parseObjectLiteralExpression(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. // If we encounter `async [no LineTerminator here] function` then this is an async // function; otherwise, its an identifier. @@ -36075,11 +36554,11 @@ var ts; } var decorators = parseDecorators(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); var tokenIsIdentifier = isIdentifier(); @@ -36167,7 +36646,7 @@ var ts; var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false); var typeArguments; // Absorb type arguments into NewExpression when preceding expression is ExpressionWithTypeArguments - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36271,7 +36750,7 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(97 /* SyntaxKind.ForKeyword */); - var awaitToken = parseOptionalToken(132 /* SyntaxKind.AwaitKeyword */); + var awaitToken = parseOptionalToken(133 /* SyntaxKind.AwaitKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var initializer; if (token() !== 26 /* SyntaxKind.SemicolonToken */) { @@ -36283,7 +36762,7 @@ var ts; } } var node; - if (awaitToken ? parseExpected(160 /* SyntaxKind.OfKeyword */) : parseOptional(160 /* SyntaxKind.OfKeyword */)) { + if (awaitToken ? parseExpected(162 /* SyntaxKind.OfKeyword */) : parseOptional(162 /* SyntaxKind.OfKeyword */)) { var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true); }); parseExpected(21 /* SyntaxKind.CloseParenToken */); node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement()); @@ -36310,10 +36789,10 @@ var ts; function parseBreakOrContinueStatement(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(kind === 246 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); + parseExpected(kind === 249 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); var label = canParseSemicolon() ? undefined : parseIdentifier(); parseSemicolon(); - var node = kind === 246 /* SyntaxKind.BreakStatement */ + var node = kind === 249 /* SyntaxKind.BreakStatement */ ? factory.createBreakStatement(label) : factory.createContinueStatement(label); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -36504,25 +36983,26 @@ var ts; // // could be legal, it would add complexity for very little gain. case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: nextToken(); return token() === 18 /* SyntaxKind.OpenBraceToken */ || token() === 79 /* SyntaxKind.Identifier */ || token() === 93 /* SyntaxKind.ExportKeyword */; case 100 /* SyntaxKind.ImportKeyword */: @@ -36531,12 +37011,12 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token()); case 93 /* SyntaxKind.ExportKeyword */: var currentToken_1 = nextToken(); - if (currentToken_1 === 152 /* SyntaxKind.TypeKeyword */) { + if (currentToken_1 === 154 /* SyntaxKind.TypeKeyword */) { currentToken_1 = lookAhead(nextToken); } if (currentToken_1 === 63 /* SyntaxKind.EqualsToken */ || currentToken_1 === 41 /* SyntaxKind.AsteriskToken */ || currentToken_1 === 18 /* SyntaxKind.OpenBraceToken */ || currentToken_1 === 88 /* SyntaxKind.DefaultKeyword */ || - currentToken_1 === 127 /* SyntaxKind.AsKeyword */) { + currentToken_1 === 128 /* SyntaxKind.AsKeyword */) { return true; } continue; @@ -36584,20 +37064,21 @@ var ts; case 85 /* SyntaxKind.ConstKeyword */: case 93 /* SyntaxKind.ExportKeyword */: return isStartOfDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; + case 127 /* SyntaxKind.AccessorKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -36640,9 +37121,9 @@ var ts; case 97 /* SyntaxKind.ForKeyword */: return parseForOrForInOrForOfStatement(); case 86 /* SyntaxKind.ContinueKeyword */: - return parseBreakOrContinueStatement(245 /* SyntaxKind.ContinueStatement */); + return parseBreakOrContinueStatement(248 /* SyntaxKind.ContinueStatement */); case 81 /* SyntaxKind.BreakKeyword */: - return parseBreakOrContinueStatement(246 /* SyntaxKind.BreakStatement */); + return parseBreakOrContinueStatement(249 /* SyntaxKind.BreakStatement */); case 105 /* SyntaxKind.ReturnKeyword */: return parseReturnStatement(); case 116 /* SyntaxKind.WithKeyword */: @@ -36661,12 +37142,12 @@ var ts; return parseDebuggerStatement(); case 59 /* SyntaxKind.AtToken */: return parseDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 93 /* SyntaxKind.ExportKeyword */: @@ -36675,9 +37156,10 @@ var ts; case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -36686,7 +37168,7 @@ var ts; return parseExpressionOrLabeledStatement(); } function isDeclareModifier(modifier) { - return modifier.kind === 135 /* SyntaxKind.DeclareKeyword */; + return modifier.kind === 136 /* SyntaxKind.DeclareKeyword */; } function parseDeclaration() { // `parseListElement` attempted to get the reused node at this position, @@ -36732,13 +37214,13 @@ var ts; return parseClassDeclaration(pos, hasJSDoc, decorators, modifiers); case 118 /* SyntaxKind.InterfaceKeyword */: return parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers); - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers); case 92 /* SyntaxKind.EnumKeyword */: return parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers); - case 157 /* SyntaxKind.GlobalKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers); case 100 /* SyntaxKind.ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36748,7 +37230,7 @@ var ts; case 88 /* SyntaxKind.DefaultKeyword */: case 63 /* SyntaxKind.EqualsToken */: return parseExportAssignment(pos, hasJSDoc, decorators, modifiers); - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: return parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers); default: return parseExportDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36757,7 +37239,7 @@ var ts; if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var missing = createMissingNode(276 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(279 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); missing.illegalDecorators = decorators; missing.modifiers = modifiers; @@ -36883,7 +37365,7 @@ var ts; // this context. // The checker will then give an error that there is an empty declaration list. var declarations; - if (token() === 160 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 162 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { declarations = createMissingList(); } else { @@ -36911,9 +37393,9 @@ var ts; parseExpected(98 /* SyntaxKind.FunctionKeyword */); var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); // We don't parse the name here in await context, instead we will report a grammar error in the checker. - var name = modifierFlags & 512 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); + var name = modifierFlags & 1024 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); var isGenerator = asteriskToken ? 1 /* SignatureFlags.Yield */ : 0 /* SignatureFlags.None */; - var isAsync = modifierFlags & 256 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; + var isAsync = modifierFlags & 512 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; var typeParameters = parseTypeParameters(); if (modifierFlags & 1 /* ModifierFlags.Export */) setAwaitContext(/*value*/ true); @@ -36926,8 +37408,8 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { - if (token() === 134 /* SyntaxKind.ConstructorKeyword */) { - return parseExpected(134 /* SyntaxKind.ConstructorKeyword */); + if (token() === 135 /* SyntaxKind.ConstructorKeyword */) { + return parseExpected(135 /* SyntaxKind.ConstructorKeyword */); } if (token() === 10 /* SyntaxKind.StringLiteral */ && lookAhead(nextToken) === 20 /* SyntaxKind.OpenParenToken */) { return tryParse(function () { @@ -36989,7 +37471,7 @@ var ts; var parameters = parseParameters(0 /* SignatureFlags.None */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ false); var body = parseFunctionBlockOrSemicolon(flags); - var node = kind === 172 /* SyntaxKind.GetAccessor */ + var node = kind === 174 /* SyntaxKind.GetAccessor */ ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body) : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body); // Keep track of `typeParameters` (for both) and `type` (for setters) if they were parsed those indicate grammar errors @@ -37033,7 +37515,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 149 /* SyntaxKind.SetKeyword */ || idToken === 136 /* SyntaxKind.GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 151 /* SyntaxKind.SetKeyword */ || idToken === 137 /* SyntaxKind.GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -37076,7 +37558,7 @@ var ts; return body; } function parseDecoratorExpression() { - if (inAwaitContext() && token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (inAwaitContext() && token() === 133 /* SyntaxKind.AwaitKeyword */) { // `@await` is is disallowed in an [Await] context, but can cause parsing to go off the rails // This simply parses the missing identifier and moves on. var pos = getNodePos(); @@ -37154,10 +37636,10 @@ var ts; } function parseModifiersForArrowFunction() { var modifiers; - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { var pos = getNodePos(); nextToken(); - var modifier = finishNode(factory.createToken(131 /* SyntaxKind.AsyncKeyword */), pos); + var modifier = finishNode(factory.createToken(132 /* SyntaxKind.AsyncKeyword */), pos); modifiers = createNodeArray([modifier], pos); } return modifiers; @@ -37174,13 +37656,13 @@ var ts; if (token() === 124 /* SyntaxKind.StaticKeyword */ && lookAhead(nextTokenIsOpenBrace)) { return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers); } - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } - if (token() === 134 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { + if (token() === 135 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers); if (constructorDeclaration) { return constructorDeclaration; @@ -37217,10 +37699,10 @@ var ts; return ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 226 /* SyntaxKind.ClassExpression */); + return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 228 /* SyntaxKind.ClassExpression */); } function parseClassDeclaration(pos, hasJSDoc, decorators, modifiers) { - return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 257 /* SyntaxKind.ClassDeclaration */); + return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 260 /* SyntaxKind.ClassDeclaration */); } function parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, kind) { var savedAwaitContext = inAwaitContext(); @@ -37242,7 +37724,7 @@ var ts; members = createMissingList(); } setAwaitContext(savedAwaitContext); - var node = kind === 257 /* SyntaxKind.ClassDeclaration */ + var node = kind === 260 /* SyntaxKind.ClassDeclaration */ ? factory.createClassDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members) : factory.createClassExpression(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -37279,7 +37761,7 @@ var ts; function parseExpressionWithTypeArguments() { var pos = getNodePos(); var expression = parseLeftHandSideExpressionOrHigher(); - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { return expression; } var typeArguments = tryParseTypeArguments(); @@ -37306,11 +37788,11 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(152 /* SyntaxKind.TypeKeyword */); + parseExpected(154 /* SyntaxKind.TypeKeyword */); var name = parseIdentifier(); var typeParameters = parseTypeParameters(); parseExpected(63 /* SyntaxKind.EqualsToken */); - var type = token() === 138 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); + var type = token() === 139 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); node.illegalDecorators = decorators; @@ -37369,7 +37851,7 @@ var ts; function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; var name; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // parse 'global' as name of global scope augmentation name = parseIdentifier(); flags |= 1024 /* NodeFlags.GlobalAugmentation */; @@ -37391,15 +37873,15 @@ var ts; } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } - else if (parseOptional(142 /* SyntaxKind.NamespaceKeyword */)) { + else if (parseOptional(143 /* SyntaxKind.NamespaceKeyword */)) { flags |= 16 /* NodeFlags.Namespace */; } else { - parseExpected(141 /* SyntaxKind.ModuleKeyword */); + parseExpected(142 /* SyntaxKind.ModuleKeyword */); if (token() === 10 /* SyntaxKind.StringLiteral */) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } @@ -37407,7 +37889,7 @@ var ts; return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags); } function isExternalModuleReference() { - return token() === 146 /* SyntaxKind.RequireKeyword */ && + return token() === 147 /* SyntaxKind.RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -37420,8 +37902,8 @@ var ts; return nextToken() === 43 /* SyntaxKind.SlashToken */; } function parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(127 /* SyntaxKind.AsKeyword */); - parseExpected(142 /* SyntaxKind.NamespaceKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); + parseExpected(143 /* SyntaxKind.NamespaceKeyword */); var name = parseIdentifier(); parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); @@ -37439,7 +37921,7 @@ var ts; identifier = parseIdentifier(); } var isTypeOnly = false; - if (token() !== 156 /* SyntaxKind.FromKeyword */ && + if (token() !== 158 /* SyntaxKind.FromKeyword */ && (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === "type" && (isIdentifier() || tokenAfterImportDefinitelyProducesImportDeclaration())) { isTypeOnly = true; @@ -37457,11 +37939,11 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ // import { ) { importClause = parseImportClause(identifier, afterImportPos, isTypeOnly); - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); } var moduleSpecifier = parseModuleSpecifier(); var assertClause; - if (token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -37479,7 +37961,7 @@ var ts; function parseAssertClause(skipAssertKeyword) { var pos = getNodePos(); if (!skipAssertKeyword) { - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); } var openBracePosition = scanner.getTokenPos(); if (parseExpected(18 /* SyntaxKind.OpenBraceToken */)) { @@ -37504,7 +37986,7 @@ var ts; function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() { // In `import id ___`, the current token decides whether to produce // an ImportDeclaration or ImportEqualsDeclaration. - return token() === 27 /* SyntaxKind.CommaToken */ || token() === 156 /* SyntaxKind.FromKeyword */; + return token() === 27 /* SyntaxKind.CommaToken */ || token() === 158 /* SyntaxKind.FromKeyword */; } function parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly) { parseExpected(63 /* SyntaxKind.EqualsToken */); @@ -37527,7 +38009,7 @@ var ts; var namedBindings; if (!identifier || parseOptional(27 /* SyntaxKind.CommaToken */)) { - namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(269 /* SyntaxKind.NamedImports */); + namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(272 /* SyntaxKind.NamedImports */); } return finishNode(factory.createImportClause(isTypeOnly, identifier, namedBindings), pos); } @@ -37538,7 +38020,7 @@ var ts; } function parseExternalModuleReference() { var pos = getNodePos(); - parseExpected(146 /* SyntaxKind.RequireKeyword */); + parseExpected(147 /* SyntaxKind.RequireKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var expression = parseModuleSpecifier(); parseExpected(21 /* SyntaxKind.CloseParenToken */); @@ -37562,7 +38044,7 @@ var ts; // * as ImportedBinding var pos = getNodePos(); parseExpected(41 /* SyntaxKind.AsteriskToken */); - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); var name = parseIdentifier(); return finishNode(factory.createNamespaceImport(name), pos); } @@ -37575,17 +38057,17 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - var node = kind === 269 /* SyntaxKind.NamedImports */ + var node = kind === 272 /* SyntaxKind.NamedImports */ ? factory.createNamedImports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseImportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)) : factory.createNamedExports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseExportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)); return finishNode(node, pos); } function parseExportSpecifier() { var hasJSDoc = hasPrecedingJSDocComment(); - return withJSDoc(parseImportOrExportSpecifier(275 /* SyntaxKind.ExportSpecifier */), hasJSDoc); + return withJSDoc(parseImportOrExportSpecifier(278 /* SyntaxKind.ExportSpecifier */), hasJSDoc); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(270 /* SyntaxKind.ImportSpecifier */); + return parseImportOrExportSpecifier(273 /* SyntaxKind.ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var pos = getNodePos(); @@ -37610,10 +38092,10 @@ var ts; // import { type as } from "mod"; - isTypeOnly: true, name: as // import { type as as } from "mod"; - isTypeOnly: false, name: as, propertyName: type // import { type as as as } from "mod"; - isTypeOnly: true, name: as, propertyName: as - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as ...? } var firstAs = parseIdentifierName(); - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as as ...? } var secondAs = parseIdentifierName(); if (ts.tokenIsIdentifierOrKeyword(token())) { @@ -37648,15 +38130,15 @@ var ts; name = parseNameWithKeywordCheck(); } } - if (canParseAsKeyword && token() === 127 /* SyntaxKind.AsKeyword */) { + if (canParseAsKeyword && token() === 128 /* SyntaxKind.AsKeyword */) { propertyName = name; - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); name = parseNameWithKeywordCheck(); } - if (kind === 270 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 273 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } - var node = kind === 270 /* SyntaxKind.ImportSpecifier */ + var node = kind === 273 /* SyntaxKind.ImportSpecifier */ ? factory.createImportSpecifier(isTypeOnly, propertyName, name) : factory.createExportSpecifier(isTypeOnly, propertyName, name); return finishNode(node, pos); @@ -37676,26 +38158,26 @@ var ts; var exportClause; var moduleSpecifier; var assertClause; - var isTypeOnly = parseOptional(152 /* SyntaxKind.TypeKeyword */); + var isTypeOnly = parseOptional(154 /* SyntaxKind.TypeKeyword */); var namespaceExportPos = getNodePos(); if (parseOptional(41 /* SyntaxKind.AsteriskToken */)) { - if (parseOptional(127 /* SyntaxKind.AsKeyword */)) { + if (parseOptional(128 /* SyntaxKind.AsKeyword */)) { exportClause = parseNamespaceExport(namespaceExportPos); } - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } else { - exportClause = parseNamedImportsOrExports(273 /* SyntaxKind.NamedExports */); + exportClause = parseNamedImportsOrExports(276 /* SyntaxKind.NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token() === 156 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(156 /* SyntaxKind.FromKeyword */); + if (token() === 158 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } } - if (moduleSpecifier && token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (moduleSpecifier && token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -38308,9 +38790,9 @@ var ts; } function isObjectOrObjectArrayTypeReference(node) { switch (node.kind) { - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isObjectOrObjectArrayTypeReference(node.elementType); default: return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; @@ -38342,12 +38824,12 @@ var ts; var child = void 0; var children = void 0; while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) { - if (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) { + if (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) { children = ts.append(children, child); } } if (children) { - var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */), pos); + var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */), pos); return finishNode(factory.createJSDocTypeExpression(literal), pos); } } @@ -38465,7 +38947,7 @@ var ts; var hasChildren = false; while (child = tryParse(function () { return parseChildPropertyTag(indent); })) { hasChildren = true; - if (child.kind === 343 /* SyntaxKind.JSDocTypeTag */) { + if (child.kind === 346 /* SyntaxKind.JSDocTypeTag */) { if (childTypeTag) { var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); if (lastError) { @@ -38482,7 +38964,7 @@ var ts; } } if (hasChildren) { - var isArrayType = typeExpression && typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */; + var isArrayType = typeExpression && typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */; var jsdocTypeLiteral = factory.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType); typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : @@ -38534,7 +39016,7 @@ var ts; var returnTag = tryParse(function () { if (parseOptionalJsdoc(59 /* SyntaxKind.AtToken */)) { var tag = parseTag(indent); - if (tag && tag.kind === 341 /* SyntaxKind.JSDocReturnTag */) { + if (tag && tag.kind === 344 /* SyntaxKind.JSDocReturnTag */) { return tag; } } @@ -38569,7 +39051,7 @@ var ts; case 59 /* SyntaxKind.AtToken */: if (canParseTag) { var child = tryParseChildTag(target, indent); - if (child && (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) && + if (child && (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) && target !== 4 /* PropertyLikeParse.CallbackParameter */ && name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; @@ -39539,6 +40021,7 @@ var ts; ["es2019.object", "lib.es2019.object.d.ts"], ["es2019.string", "lib.es2019.string.d.ts"], ["es2019.symbol", "lib.es2019.symbol.d.ts"], + ["es2019.intl", "lib.es2019.intl.d.ts"], ["es2020.bigint", "lib.es2020.bigint.d.ts"], ["es2020.date", "lib.es2020.date.d.ts"], ["es2020.promise", "lib.es2020.promise.d.ts"], @@ -39659,6 +40142,7 @@ var ts; shortName: "h", type: "boolean", showInSimplifiedHelpView: true, + isCommandLineOnly: true, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, defaultValueDescription: false, @@ -39667,6 +40151,8 @@ var ts; name: "help", shortName: "?", type: "boolean", + isCommandLineOnly: true, + category: ts.Diagnostics.Command_line_Options, defaultValueDescription: false, }, { @@ -41398,7 +41884,7 @@ var ts; var _a; var rootExpression = (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression; var knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : undefined; - if (rootExpression && rootExpression.kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (rootExpression && rootExpression.kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, rootExpression, ts.Diagnostics.The_root_value_of_a_0_file_must_be_an_object, ts.getBaseFileName(sourceFile.fileName) === "jsconfig.json" ? "jsconfig.json" : "tsconfig.json")); // Last-ditch error recovery. Somewhat useful because the JSON parser will recover from some parse errors by // synthesizing a top-level array literal expression. There's a reasonable chance the first element of that @@ -41438,7 +41924,7 @@ var ts; function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) { var result = returnValue ? {} : undefined; var _loop_4 = function (element) { - if (element.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (element.kind !== 299 /* SyntaxKind.PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); return "continue"; } @@ -41532,13 +42018,13 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: reportInvalidOptionValue(option && option.type !== "number"); return validateValue(Number(valueExpression.text)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (valueExpression.operator !== 40 /* SyntaxKind.MinusToken */ || valueExpression.operand.kind !== 8 /* SyntaxKind.NumericLiteral */) { break; // not valid JSON syntax } reportInvalidOptionValue(option && option.type !== "number"); return validateValue(-Number(valueExpression.operand.text)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; // Currently having element option declaration in the tsconfig with type "object" @@ -41555,7 +42041,7 @@ var ts; return validateValue(convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined, /*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined)); } - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: reportInvalidOptionValue(option && option.type !== "list"); return validateValue(convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element)); } @@ -41787,12 +42273,23 @@ var ts; } function writeConfigurations() { // Filter applicable options to place in the file - var categorizedOptions = ts.createMultiMap(); + var categorizedOptions = new ts.Map(); + // Set allowed categories in order + categorizedOptions.set(ts.Diagnostics.Projects, []); + categorizedOptions.set(ts.Diagnostics.Language_and_Environment, []); + categorizedOptions.set(ts.Diagnostics.Modules, []); + categorizedOptions.set(ts.Diagnostics.JavaScript_Support, []); + categorizedOptions.set(ts.Diagnostics.Emit, []); + categorizedOptions.set(ts.Diagnostics.Interop_Constraints, []); + categorizedOptions.set(ts.Diagnostics.Type_Checking, []); + categorizedOptions.set(ts.Diagnostics.Completeness, []); for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) { var option = optionDeclarations_1[_i]; - var category = option.category; if (isAllowedOptionForOutput(option)) { - categorizedOptions.add(ts.getLocaleSpecificMessage(category), option); + var listForCategory = categorizedOptions.get(option.category); + if (!listForCategory) + categorizedOptions.set(option.category, listForCategory = []); + listForCategory.push(option); } } // Serialize all options and their descriptions @@ -41803,7 +42300,7 @@ var ts; if (entries.length !== 0) { entries.push({ value: "" }); } - entries.push({ value: "/* ".concat(category, " */") }); + entries.push({ value: "/* ".concat(ts.getLocaleSpecificMessage(category), " */") }); for (var _i = 0, options_1 = options; _i < options_1.length; _i++) { var option = options_1[_i]; var optionName = void 0; @@ -42739,7 +43236,7 @@ var ts; function convertCompilerOptionsForTelemetry(opts) { var out = {}; for (var key in opts) { - if (opts.hasOwnProperty(key)) { + if (ts.hasProperty(opts, key)) { var type = getOptionFromName(key); if (type !== undefined) { // Ignore unknown options out[key] = getOptionValueWithEmptyStrings(opts[key], type); @@ -43845,6 +44342,9 @@ var ts; requestContainingDirectory: containingDirectory, reportDiagnostic: function (diag) { return void diagnostics.push(diag); }, }; + if (traceEnabled && ts.getEmitModuleResolutionKind(compilerOptions) >= ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) <= ts.ModuleResolutionKind.NodeNext) { + trace(host, ts.Diagnostics.Resolving_in_0_mode_with_conditions_1, features & NodeResolutionFeatures.EsmMode ? "ESM" : "CJS", conditions.map(function (c) { return "'".concat(c, "'"); }).join(", ")); + } var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); }); return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache); function tryResolve(extensions) { @@ -44434,7 +44934,7 @@ var ts; } if (mainExport) { var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false); - return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false); + return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false, "."); } } else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) { @@ -44514,7 +45014,7 @@ var ts; var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports); if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) { var target = lookupTable[moduleName]; - return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false); + return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false, moduleName); } var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys); for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) { @@ -44523,17 +45023,17 @@ var ts; var target = lookupTable[potentialTarget]; var starPos = potentialTarget.indexOf("*"); var subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos)); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget); } else if (ts.endsWith(potentialTarget, "*") && ts.startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) { var target = lookupTable[potentialTarget]; var subpath = moduleName.substring(potentialTarget.length - 1); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget); } else if (ts.startsWith(moduleName, potentialTarget)) { var target = lookupTable[potentialTarget]; var subpath = moduleName.substring(potentialTarget.length); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false, potentialTarget); } } function matchesPatternWithTrailer(target, name) { @@ -44550,7 +45050,7 @@ var ts; */ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) { return loadModuleFromTargetImportOrExport; - function loadModuleFromTargetImportOrExport(target, subpath, pattern) { + function loadModuleFromTargetImportOrExport(target, subpath, pattern, key) { if (typeof target === "string") { if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) { if (state.traceEnabled) { @@ -44561,6 +45061,8 @@ var ts; if (!ts.startsWith(target, "./")) { if (isImports && !ts.startsWith(target, "../") && !ts.startsWith(target, "/") && !ts.isRootedDiskPath(target)) { var combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath; + traceIfEnabled(state, ts.Diagnostics.Using_0_subpath_1_with_target_2, "imports", key, combinedLookup); + traceIfEnabled(state, ts.Diagnostics.Resolving_module_0_from_1, combinedLookup, scope.packageDirectory + "/"); var result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference); return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : undefined); } @@ -44587,6 +45089,9 @@ var ts; } return toSearchResult(/*value*/ undefined); } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Using_0_subpath_1_with_target_2, isImports ? "imports" : "exports", key, pattern ? target.replace(/\*/g, subpath) : target + subpath); + } var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath); var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports); if (inputLink) @@ -44596,14 +45101,18 @@ var ts; else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null if (!Array.isArray(target)) { for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) { - var key = _a[_i]; - if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) { - var subTarget = target[key]; - var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern); + var condition = _a[_i]; + if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) { + traceIfEnabled(state, ts.Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition); + var subTarget = target[condition]; + var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key); if (result) { return result; } } + else { + traceIfEnabled(state, ts.Diagnostics.Saw_non_matching_condition_0, condition); + } } return undefined; } @@ -44616,7 +45125,7 @@ var ts; } for (var _b = 0, target_2 = target; _b < target_2.length; _b++) { var elem = target_2[_b]; - var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern); + var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern, key); if (result) { return result; } @@ -44811,6 +45320,7 @@ var ts; } } function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) { + var _a; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName)); // First look for a nested package.json, as in `node_modules/foo/bar/package.json`. var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state); @@ -44825,13 +45335,7 @@ var ts; return withPackageId(packageInfo, fromDirectory); } } - var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest; var loader = function (extensions, candidate, onlyRecordFailures, state) { - var _a; - // package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them) - if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { - return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; - } var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo @@ -44844,19 +45348,24 @@ var ts; } return withPackageId(packageInfo, pathAndExtension); }; - if (rest !== "") { // If "rest" is empty, we just did this search above. - var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); - // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings. + var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest; + var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); + if (rest !== "") { + // Previous `packageInfo` may have been from a nested package.json; ensure we have the one from the package root now. packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.contents.versionPaths) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); - } - var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); - var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); - if (fromPaths) { - return fromPaths.value; - } + } + // package exports are higher priority than file/directory/typesVersions lookups and (and, if there's exports present, blocks them) + if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; + } + if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); + } + var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); + if (fromPaths) { + return fromPaths.value; } } return loader(extensions, candidate, !nodeModulesDirectoryExists, state); @@ -45032,6 +45541,15 @@ var ts; function toSearchResult(value) { return value !== undefined ? { value: value } : undefined; } + function traceIfEnabled(state, diagnostic) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + if (state.traceEnabled) { + trace.apply(void 0, __spreadArray([state.host, diagnostic], args, false)); + } + } })(ts || (ts = {})); /* @internal */ var ts; @@ -45066,26 +45584,26 @@ var ts; // A module is uninstantiated if it contains only switch (node.kind) { // 1. interface declarations, type alias declarations - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return 0 /* ModuleInstanceState.NonInstantiated */; // 2. const enum declarations - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (ts.isEnumConst(node)) { return 2 /* ModuleInstanceState.ConstEnumOnly */; } break; // 3. non-exported import declarations - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (!(ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */))) { return 0 /* ModuleInstanceState.NonInstantiated */; } break; // 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDeclaration = node; - if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 273 /* SyntaxKind.NamedExports */) { + if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 276 /* SyntaxKind.NamedExports */) { var state = 0 /* ModuleInstanceState.NonInstantiated */; for (var _i = 0, _a = exportDeclaration.exportClause.elements; _i < _a.length; _i++) { var specifier = _a[_i]; @@ -45101,7 +45619,7 @@ var ts; } break; // 5. other uninstantiated module declarations. - case 262 /* SyntaxKind.ModuleBlock */: { + case 265 /* SyntaxKind.ModuleBlock */: { var state_1 = 0 /* ModuleInstanceState.NonInstantiated */; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateCached(n, visited); @@ -45123,7 +45641,7 @@ var ts; }); return state_1; } - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(node, visited); case 79 /* SyntaxKind.Identifier */: // Only jsdoc typedef definition can exist in jsdoc namespace, and it should @@ -45324,7 +45842,7 @@ var ts; // Should not be called on a declaration with a computed property name, // unless it is a well known Symbol. function getDeclarationName(node) { - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) { return node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; } var name = ts.getNameOfDeclaration(node); @@ -45333,7 +45851,7 @@ var ts; var moduleName = ts.getTextOfIdentifierOrLiteral(name); return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"".concat(moduleName, "\"")); } - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { var nameExpression = name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteralLike(nameExpression)) { @@ -45359,36 +45877,36 @@ var ts; return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "__constructor" /* InternalSymbolName.Constructor */; - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return "__call" /* InternalSymbolName.Call */; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return "__new" /* InternalSymbolName.New */; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "__index" /* InternalSymbolName.Index */; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return "__export" /* InternalSymbolName.ExportStar */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // json file should behave as // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */) { // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* InternalSymbolName.New */ : "__call" /* InternalSymbolName.Call */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); + ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; @@ -45407,7 +45925,7 @@ var ts; */ function declareSymbol(symbolTable, parent, node, includes, excludes, isReplaceableByMethod, isComputedName) { ts.Debug.assert(isComputedName || !ts.hasDynamicName(node)); - var isDefaultExport = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; + var isDefaultExport = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; // The exported symbol for an export default function/class node is always named "default" var name = isComputedName ? "__computed" /* InternalSymbolName.Computed */ : isDefaultExport && parent ? "default" /* InternalSymbolName.Default */ @@ -45490,7 +46008,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (node.kind === 271 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { + (node.kind === 274 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; messageNeedsName_1 = false; multipleDefaultExports_1 = true; @@ -45529,7 +46047,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = !!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) || jsdocTreatAsExported(node); if (symbolFlags & 2097152 /* SymbolFlags.Alias */) { - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */ || (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */ || (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -45554,7 +46072,7 @@ var ts; if (ts.isJSDocTypeAlias(node)) ts.Debug.assert(ts.isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 64 /* NodeFlags.ExportContext */)) { - if (!container.locals || (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) && !getDeclarationName(node))) { + if (!container.locals || (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) && !getDeclarationName(node))) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default! } var exportKind = symbolFlags & 111551 /* SymbolFlags.Value */ ? 1048576 /* SymbolFlags.ExportValue */ : 0; @@ -45618,7 +46136,7 @@ var ts; // for it. We must clear this so we don't accidentally move any stale data forward from // a previous compilation. if (containerFlags & 1 /* ContainerFlags.IsContainer */) { - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -45640,10 +46158,10 @@ var ts; var saveActiveLabelList = activeLabelList; var saveHasExplicitReturn = hasExplicitReturn; var isImmediatelyInvoked = (containerFlags & 16 /* ContainerFlags.IsFunctionExpression */ && - !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Async */) && + !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Async */) && !node.asteriskToken && !!ts.getImmediatelyInvokedFunctionExpression(node)) || - node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; // A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave // similarly to break statements that exit to a label just past the statement body. if (!isImmediatelyInvoked) { @@ -45654,7 +46172,7 @@ var ts; } // We create a return control flow graph for IIFEs and constructors. For constructors // we use the return control flow graph in strict property initialization checks. - currentReturnTarget = isImmediatelyInvoked || node.kind === 171 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; + currentReturnTarget = isImmediatelyInvoked || node.kind === 173 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; currentExceptionTarget = undefined; currentBreakTarget = undefined; currentContinueTarget = undefined; @@ -45669,14 +46187,14 @@ var ts; node.flags |= 512 /* NodeFlags.HasExplicitReturn */; node.endFlowNode = currentFlow; } - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { node.flags |= emitFlags; node.endFlowNode = currentFlow; } if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); currentFlow = finishFlowLabel(currentReturnTarget); - if (node.kind === 171 /* SyntaxKind.Constructor */ || node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */))) { + if (node.kind === 173 /* SyntaxKind.Constructor */ || node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */))) { node.returnFlowNode = currentFlow; } } @@ -45703,8 +46221,8 @@ var ts; blockScopeContainer = savedBlockScopeContainer; } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -45727,59 +46245,59 @@ var ts; inAssignmentPattern = saveInAssignmentPattern; return; } - if (node.kind >= 237 /* SyntaxKind.FirstStatement */ && node.kind <= 253 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { + if (node.kind >= 240 /* SyntaxKind.FirstStatement */ && node.kind <= 256 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { node.flowNode = currentFlow; } switch (node.kind) { - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: bindWhileStatement(node); break; - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: bindDoStatement(node); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: bindForStatement(node); break; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: bindForInOrForOfStatement(node); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: bindIfStatement(node); break; - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: bindReturnOrThrow(node); break; - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: bindTryStatement(node); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: bindSwitchStatement(node); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: bindCaseBlock(node); break; - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: bindCaseClause(node); break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: bindExpressionStatement(node); break; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: bindLabeledStatement(node); break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { // Carry over whether we are in an assignment pattern to // binary expressions that could actually be an initializer @@ -45789,47 +46307,50 @@ var ts; } bindBinaryExpressionFlow(node); break; - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bindAccessExpressionFlow(node); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bindCallExpressionFlow(node); break; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: bindNonNullExpressionFlow(node); break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: bindJSDocTypeAlias(node); break; // In source files and blocks, bind functions first to match hoisting that occurs at runtime - case 305 /* SyntaxKind.SourceFile */: { + case 308 /* SyntaxKind.SourceFile */: { bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; } - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: bindEachFunctionsFirst(node.statements); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: bindBindingElementFlow(node); break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 225 /* SyntaxKind.SpreadElement */: + case 166 /* SyntaxKind.Parameter */: + bindParameterFlow(node); + break; + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 227 /* SyntaxKind.SpreadElement */: // Carry over whether we are in an assignment pattern of Object and Array literals // as well as their children that are valid assignment targets. inAssignmentPattern = saveInAssignmentPattern; @@ -45846,19 +46367,19 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: case 108 /* SyntaxKind.ThisKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return containsNarrowableReference(expr); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return hasNarrowableArgument(expr); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isNarrowingExpression(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 53 /* SyntaxKind.ExclamationToken */ && isNarrowingExpression(expr.operand); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return isNarrowingExpression(expr.expression); } return false; @@ -45882,7 +46403,7 @@ var ts; } } } - if (expr.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expr.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && containsNarrowableReference(expr.expression.expression)) { return true; } @@ -45915,9 +46436,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (expr.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: return isNarrowableOperand(expr.left); @@ -45993,26 +46514,26 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: + case 245 /* SyntaxKind.ForStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { + else if (node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { node = node.operand; } else { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */); } @@ -46058,7 +46579,7 @@ var ts; } function setContinueTarget(node, target) { var label = activeLabelList; - while (label && node.parent.kind === 250 /* SyntaxKind.LabeledStatement */) { + while (label && node.parent.kind === 253 /* SyntaxKind.LabeledStatement */) { label.continueTarget = target; label = label.next; node = node.parent; @@ -46109,12 +46630,12 @@ var ts; bind(node.expression); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.kind === 247 /* SyntaxKind.ForOfStatement */) { bind(node.awaitModifier); } addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -46136,7 +46657,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (node.kind === 250 /* SyntaxKind.ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -46153,7 +46674,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 246 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 249 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -46258,7 +46779,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 290 /* SyntaxKind.DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 293 /* SyntaxKind.DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). Note, we no longer need // this property in control flow analysis, it's there only for backwards compatibility. @@ -46306,7 +46827,7 @@ var ts; function maybeBindExpressionFlowIfCall(node) { // A top level or comma expression call expression with a dotted function name and at least one argument // is potentially an assertion and is therefore included in the control flow. - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { var call = node; if (call.expression.kind !== 106 /* SyntaxKind.SuperKeyword */ && ts.isDottedName(call.expression)) { currentFlow = createFlowCall(currentFlow, call); @@ -46332,7 +46853,7 @@ var ts; currentFlow = finishFlowLabel(postStatementLabel); } function bindDestructuringTargetFlow(node) { - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -46343,10 +46864,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowMutation(16 /* FlowFlags.Assignment */, currentFlow, node); } - else if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + else if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -46354,16 +46875,16 @@ var ts; } } } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (p.kind === 299 /* SyntaxKind.PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + else if (p.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (p.kind === 301 /* SyntaxKind.SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -46500,7 +47021,7 @@ var ts; var operator = node.operatorToken.kind; if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 209 /* SyntaxKind.ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46528,7 +47049,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -46566,24 +47087,42 @@ var ts; } } function bindBindingElementFlow(node) { - if (ts.isBindingPattern(node.name)) { - // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: - // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - bind(node.dotDotDotToken); - bind(node.propertyName); - bind(node.initializer); - bind(node.name); + // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: + // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + bind(node.dotDotDotToken); + bind(node.propertyName); + bindInitializer(node.initializer); + bind(node.name); + } + function bindParameterFlow(node) { + bindEach(node.modifiers); + bind(node.dotDotDotToken); + bind(node.questionToken); + bind(node.type); + bindInitializer(node.initializer); + bind(node.name); + } + // a BindingElement/Parameter does not have side effects if initializers are not evaluated and used. (see GH#49759) + function bindInitializer(node) { + if (!node) { + return; } - else { - bindEachChild(node); + var entryFlow = currentFlow; + bind(node); + if (entryFlow === unreachableFlow || entryFlow === currentFlow) { + return; } + var exitFlow = createBranchLabel(); + addAntecedent(exitFlow, entryFlow); + addAntecedent(exitFlow, currentFlow); + currentFlow = finishFlowLabel(exitFlow); } function bindJSDocTypeAlias(node) { bind(node.tagName); - if (node.kind !== 339 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { + if (node.kind !== 342 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { // don't bind the type name yet; that's delayed until delayedBindJSDocTypedefTag ts.setParent(node.fullName, node); ts.setParentRecursive(node.fullName, /*incremental*/ false); @@ -46595,7 +47134,7 @@ var ts; function bindJSDocClassTag(node) { bindEachChild(node); var host = ts.getHostSignatureFromJSDoc(node); - if (host && host.kind !== 169 /* SyntaxKind.MethodDeclaration */) { + if (host && host.kind !== 171 /* SyntaxKind.MethodDeclaration */) { addDeclarationToSymbol(host.symbol, host, 32 /* SymbolFlags.Class */); } } @@ -46608,15 +47147,15 @@ var ts; } function bindOptionalChainRest(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: bind(node.questionDotToken); bind(node.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bind(node.questionDotToken); bind(node.argumentExpression); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bind(node.questionDotToken); bindEach(node.typeArguments); bindEach(node.arguments); @@ -46681,7 +47220,7 @@ var ts; // an immediately invoked function expression (IIFE). Initialize the flowNode property to // the current control flow (which includes evaluation of the IIFE arguments). var expr = ts.skipParentheses(node.expression); - if (expr.kind === 213 /* SyntaxKind.FunctionExpression */ || expr.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (expr.kind === 215 /* SyntaxKind.FunctionExpression */ || expr.kind === 216 /* SyntaxKind.ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -46693,7 +47232,7 @@ var ts; } } } - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var propertyAccess = node.expression; if (ts.isIdentifier(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46702,55 +47241,55 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 286 /* SyntaxKind.JsxAttributes */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 289 /* SyntaxKind.JsxAttributes */: return 1 /* ContainerFlags.IsContainer */; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 64 /* ContainerFlags.IsInterface */; - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: - case 176 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: + case 178 /* SyntaxKind.IndexSignature */: return 1 /* ContainerFlags.IsContainer */ | 32 /* ContainerFlags.HasLocals */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 128 /* ContainerFlags.IsObjectLiteralOrClassExpressionMethodOrAccessor */; } // falls through - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 179 /* SyntaxKind.FunctionType */: - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 181 /* SyntaxKind.FunctionType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 16 /* ContainerFlags.IsFunctionExpression */; - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return 4 /* ContainerFlags.IsControlFlowContainer */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer ? 4 /* ContainerFlags.IsControlFlowContainer */ : 0; - case 292 /* SyntaxKind.CatchClause */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 263 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 266 /* SyntaxKind.CaseBlock */: return 2 /* ContainerFlags.IsBlockScopedContainer */; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -46783,46 +47322,46 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 286 /* SyntaxKind.JsxAttributes */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 289 /* SyntaxKind.JsxAttributes */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -46930,10 +47469,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -47030,7 +47569,7 @@ var ts; node.originalKeywordKind <= 125 /* SyntaxKind.LastFutureReservedWord */) { file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); } - else if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + else if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { if (ts.isExternalModule(file) && ts.isInTopLevelContext(node)) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, ts.declarationNameToString(node))); } @@ -47132,8 +47671,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 305 /* SyntaxKind.SourceFile */ && - blockScopeContainer.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && + if (blockScopeContainer.kind !== 308 /* SyntaxKind.SourceFile */ && + blockScopeContainer.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -47230,7 +47769,7 @@ var ts; // the current 'container' node when it changes. This helps us know which symbol table // a local should go into for example. Since terminal nodes are known not to have // children, as an optimization we don't process those. - if (node.kind > 160 /* SyntaxKind.LastToken */) { + if (node.kind > 162 /* SyntaxKind.LastToken */) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -47306,23 +47845,23 @@ var ts; } // falls through case 108 /* SyntaxKind.ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkContextualIdentifier(node); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: if (currentFlow && ts.isPartOfTypeQuery(node)) { node.flowNode = currentFlow; } break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: case 106 /* SyntaxKind.SuperKeyword */: node.flowNode = currentFlow; break; case 80 /* SyntaxKind.PrivateIdentifier */: return checkPrivateIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node; if (currentFlow && isNarrowableReference(expr)) { expr.flowNode = currentFlow; @@ -47337,7 +47876,7 @@ var ts; declareSymbol(file.locals, /*parent*/ undefined, expr.expression, 1 /* SymbolFlags.FunctionScopedVariable */ | 134217728 /* SymbolFlags.ModuleExports */, 111550 /* SymbolFlags.FunctionScopedVariableExcludes */); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var specialKind = ts.getAssignmentDeclarationKind(node); switch (specialKind) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -47373,78 +47912,78 @@ var ts; ts.Debug.fail("Unknown binary expression special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return checkStrictModeCatchClause(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* SyntaxKind.NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkStrictModeWithStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkStrictModeLabeledStatement(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: seenThisKeyword = true; return; - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: break; // Binding the children will handle everything - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return bindTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return bindParameter(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return bindVariableDeclarationOrBindingElement(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return bindPropertyWorker(node); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* SymbolFlags.EnumMember */, 900095 /* SymbolFlags.EnumMemberExcludes */); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* SymbolFlags.Signature */, 0 /* SymbolFlags.None */); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* SymbolFlags.Method */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), ts.isObjectLiteralMethod(node) ? 0 /* SymbolFlags.PropertyExcludes */ : 103359 /* SymbolFlags.MethodExcludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return bindFunctionDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* SymbolFlags.Constructor */, /*symbolExcludes:*/ 0 /* SymbolFlags.None */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* SymbolFlags.GetAccessor */, 46015 /* SymbolFlags.GetAccessorExcludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SymbolFlags.SetAccessor */, 78783 /* SymbolFlags.SetAccessorExcludes */); - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: + case 182 /* SyntaxKind.ConstructorType */: return bindFunctionOrConstructorType(node); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 195 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 197 /* SyntaxKind.MappedType */: return bindAnonymousTypeWorker(node); - case 332 /* SyntaxKind.JSDocClassTag */: + case 335 /* SyntaxKind.JSDocClassTag */: return bindJSDocClassTag(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return bindFunctionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: var assignmentKind = ts.getAssignmentDeclarationKind(node); switch (assignmentKind) { case 7 /* AssignmentDeclarationKind.ObjectDefinePropertyValue */: @@ -47463,70 +48002,73 @@ var ts; } break; // Members of classes, interfaces, and modules - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* SymbolFlags.Interface */, 788872 /* SymbolFlags.InterfaceExcludes */); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* SymbolFlags.TypeAlias */, 788968 /* SymbolFlags.TypeAliasExcludes */); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return bindEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return bindJsxAttributes(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return bindJsxAttribute(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); // Imports and exports - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 2097152 /* SymbolFlags.Alias */, 2097152 /* SymbolFlags.AliasExcludes */); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return bindImportClause(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return bindExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return bindExportAssignment(node); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (!ts.isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) { return; } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 340 /* SyntaxKind.JSDocParameterTag */: - if (node.parent.kind === 323 /* SyntaxKind.JSDocSignature */) { + case 343 /* SyntaxKind.JSDocParameterTag */: + if (node.parent.kind === 326 /* SyntaxKind.JSDocSignature */) { return bindParameter(node); } - if (node.parent.kind !== 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (node.parent.kind !== 325 /* SyntaxKind.JSDocTypeLiteral */) { break; } // falls through - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ ? 4 /* SymbolFlags.Property */ | 16777216 /* SymbolFlags.Optional */ : 4 /* SymbolFlags.Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* SymbolFlags.PropertyExcludes */); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return (delayedTypeAliases || (delayedTypeAliases = [])).push(node); } } function bindPropertyWorker(node) { - return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), 0 /* SymbolFlags.PropertyExcludes */); + var isAutoAccessor = ts.isAutoAccessorPropertyDeclaration(node); + var includes = isAutoAccessor ? 98304 /* SymbolFlags.Accessor */ : 4 /* SymbolFlags.Property */; + var excludes = isAutoAccessor ? 13247 /* SymbolFlags.AccessorExcludes */ : 0 /* SymbolFlags.PropertyExcludes */; + return bindPropertyOrMethodOrAccessor(node, includes | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), excludes); } function bindAnonymousTypeWorker(node) { return bindAnonymousDeclaration(node, 2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); @@ -47686,8 +48228,8 @@ var ts; } var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false); switch (thisContainer.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var constructorSymbol = thisContainer.symbol; // For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression. if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -47709,12 +48251,12 @@ var ts; addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, 32 /* SymbolFlags.Class */); } break; - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // this.foo assignment in a JavaScript class // Bind this property to the containing class var containingClass = thisContainer.parent; @@ -47726,7 +48268,7 @@ var ts; declareSymbol(symbolTable, containingClass.symbol, node, 4 /* SymbolFlags.Property */ | 67108864 /* SymbolFlags.Assignment */, 0 /* SymbolFlags.None */, /*isReplaceableByMethod*/ true); } break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script if (ts.hasDynamicName(node)) { break; @@ -47755,7 +48297,7 @@ var ts; if (node.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { bindThisPropertyAssignment(node); } - else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -47795,7 +48337,7 @@ var ts; } function bindObjectDefinePropertyAssignment(node) { var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]); - var isToplevel = node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + var isToplevel = node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false, /*containerIsClass*/ false); bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false); } @@ -47904,8 +48446,8 @@ var ts; } function isTopLevelNamespaceAssignment(propertyAccess) { return ts.isBinaryExpression(propertyAccess.parent) - ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 305 /* SyntaxKind.SourceFile */ - : propertyAccess.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 308 /* SyntaxKind.SourceFile */ + : propertyAccess.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; } function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) { var namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer); @@ -47984,7 +48526,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 257 /* SyntaxKind.ClassDeclaration */) { + if (node.kind === 260 /* SyntaxKind.ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* SymbolFlags.Class */, 899503 /* SymbolFlags.ClassExcludes */); } else { @@ -48026,7 +48568,7 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } if (!ts.isBindingPattern(node.name)) { - var possibleVariableDecl = node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; + var possibleVariableDecl = node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !ts.getJSDocTypeTag(node) && @@ -48054,7 +48596,7 @@ var ts; } } function bindParameter(node) { - if (node.kind === 340 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 323 /* SyntaxKind.JSDocSignature */) { + if (node.kind === 343 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 326 /* SyntaxKind.JSDocSignature */) { return; } if (inStrictMode && !(node.flags & 16777216 /* NodeFlags.Ambient */)) { @@ -48131,7 +48673,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 262144 /* SymbolFlags.TypeParameter */, 526824 /* SymbolFlags.TypeParameterExcludes */); } } - else if (node.parent.kind === 190 /* SyntaxKind.InferType */) { + else if (node.parent.kind === 192 /* SyntaxKind.InferType */) { var container_2 = getInferTypeContainer(node.parent); if (container_2) { if (!container_2.locals) { @@ -48159,11 +48701,11 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 236 /* SyntaxKind.EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 239 /* SyntaxKind.EmptyStatement */) || // report error on class declarations - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); + (node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); if (reportError) { currentFlow = reportedUnreachableFlow; if (!options.allowUnreachableCode) { @@ -48207,12 +48749,12 @@ var ts; } function isPurelyTypeDeclaration(s) { switch (s.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(s) !== 1 /* ModuleInstanceState.Instantiated */; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.hasSyntacticModifier(s, 2048 /* ModifierFlags.Const */); default: return false; @@ -48413,7 +48955,7 @@ var ts; // (their type resolved directly to the member deeply referenced) // So to get the intervening symbols, we need to check if there's a type // query node on any of the symbol's declarations and get symbols there - if (d.type && d.type.kind === 181 /* SyntaxKind.TypeQuery */) { + if (d.type && d.type.kind === 183 /* SyntaxKind.TypeQuery */) { var query = d.type; var entity = getResolvedSymbol(getFirstIdentifier(query.exprName)); visitSymbol(entity); @@ -48599,8 +49141,6 @@ var ts; IntersectionState[IntersectionState["None"] = 0] = "None"; IntersectionState[IntersectionState["Source"] = 1] = "Source"; IntersectionState[IntersectionState["Target"] = 2] = "Target"; - IntersectionState[IntersectionState["PropertyCheck"] = 4] = "PropertyCheck"; - IntersectionState[IntersectionState["InPropertyCheck"] = 8] = "InPropertyCheck"; })(IntersectionState || (IntersectionState = {})); var RecursionFlags; (function (RecursionFlags) { @@ -48824,6 +49364,7 @@ var ts; getTypeOfPropertyOfType: function (type, name) { return getTypeOfPropertyOfType(type, ts.escapeLeadingUnderscores(name)); }, getIndexInfoOfType: function (type, kind) { return getIndexInfoOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexInfosOfType: getIndexInfosOfType, + getIndexInfosOfIndexSymbol: getIndexInfosOfIndexSymbol, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: function (type, kind) { return getIndexTypeOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexType: function (type) { return getIndexType(type); }, @@ -48849,6 +49390,7 @@ var ts; signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, symbolToEntityName: nodeBuilder.symbolToEntityName, symbolToExpression: nodeBuilder.symbolToExpression, + symbolToNode: nodeBuilder.symbolToNode, symbolToTypeParameterDeclarations: nodeBuilder.symbolToTypeParameterDeclarations, symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration, typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration, @@ -49017,6 +49559,12 @@ var ts; getOptionalType: function () { return optionalType; }, getPromiseType: function () { return getGlobalPromiseType(/*reportErrors*/ false); }, getPromiseLikeType: function () { return getGlobalPromiseLikeType(/*reportErrors*/ false); }, + getAsyncIterableType: function () { + var type = getGlobalAsyncIterableType(/*reportErrors*/ false); + if (type === emptyGenericType) + return undefined; + return type; + }, isSymbolAccessible: isSymbolAccessible, isArrayType: isArrayType, isTupleType: isTupleType, @@ -49097,6 +49645,7 @@ var ts; isPropertyAccessible: isPropertyAccessible, getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration, getMemberOverrideModifierStatus: getMemberOverrideModifierStatus, + isTypeParameterPossiblyReferenced: isTypeParameterPossiblyReferenced, }; function runWithInferenceBlockedFromSourceNode(node, fn) { var containingCall = ts.findAncestor(node, ts.isCallLikeExpression); @@ -49216,7 +49765,8 @@ var ts; var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); emptyTypeLiteralSymbol.members = ts.createSymbolTable(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); - var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType; + var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); + var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType; var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); emptyGenericType.instantiations = new ts.Map(); var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); @@ -49330,6 +49880,8 @@ var ts; var deferredGlobalOmitSymbol; var deferredGlobalAwaitedSymbol; var deferredGlobalBigIntType; + var deferredGlobalNaNSymbol; + var deferredGlobalRecordSymbol; var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name var flowLoopStart = 0; var flowLoopCount = 0; @@ -49519,10 +50071,10 @@ var ts; } // Issue errors globally var file = ts.getSourceFileOfNode(location); - addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line local/no-in-operator return; } - addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line local/no-in-operator } function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) { var diagnostic = error(location, message, arg0, arg1, arg2, arg3); @@ -49751,7 +50303,7 @@ var ts; if (unidirectional === void 0) { unidirectional = false; } source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); - target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol); + target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol)); }); } function mergeModuleAugmentation(moduleName) { @@ -49839,7 +50391,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks()); } function isGlobalSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -49850,9 +50402,9 @@ var ts; return symbol; } if (symbol.flags & 2097152 /* SymbolFlags.Alias */) { - var target = resolveAlias(symbol); - // Unknown symbol means an error occurred in alias resolution, treat it as positive answer to avoid cascading errors - if (target === unknownSymbol || target.flags & meaning) { + var targetFlags = getAllSymbolFlags(symbol); + // `targetFlags` will be `SymbolFlags.All` if an error occurred in alias resolution; this avoids cascading errors + if (targetFlags & meaning) { return symbol; } } @@ -49898,17 +50450,17 @@ var ts; } if (declaration.pos <= usage.pos && !(ts.isPropertyDeclaration(declaration) && ts.isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) { // declaration is before usage - if (declaration.kind === 203 /* SyntaxKind.BindingElement */) { + if (declaration.kind === 205 /* SyntaxKind.BindingElement */) { // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) - var errorBindingElement = ts.getAncestor(usage, 203 /* SyntaxKind.BindingElement */); + var errorBindingElement = ts.getAncestor(usage, 205 /* SyntaxKind.BindingElement */); if (errorBindingElement) { return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || declaration.pos < errorBindingElement.pos; } // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 254 /* SyntaxKind.VariableDeclaration */), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 257 /* SyntaxKind.VariableDeclaration */), usage); } - else if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { + else if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } @@ -49938,12 +50490,12 @@ var ts; // or if usage is in a type context: // 1. inside a type query (typeof in type position) // 2. inside a jsdoc comment - if (usage.parent.kind === 275 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { + if (usage.parent.kind === 278 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { // export specifiers do not use the variable, they only make it available for use return true; } // When resolving symbols for exports, the `usage` location passed in can be the export site directly - if (usage.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { + if (usage.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { return true; } if (!!(usage.flags & 8388608 /* NodeFlags.JSDoc */) || isInTypeQuery(usage) || usageInTypeDeclaration()) { @@ -49965,9 +50517,9 @@ var ts; } function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { switch (declaration.parent.parent.kind) { - case 237 /* SyntaxKind.VariableStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 240 /* SyntaxKind.VariableStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, declContainer)) { @@ -49995,7 +50547,7 @@ var ts; var initializerOfProperty = propertyDeclaration.initializer === current; if (initializerOfProperty) { if (ts.isStatic(current.parent)) { - if (declaration.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (declaration.kind === 171 /* SyntaxKind.MethodDeclaration */) { return true; } if (ts.isPropertyDeclaration(declaration) && ts.getContainingClass(usage) === ts.getContainingClass(declaration)) { @@ -50010,7 +50562,7 @@ var ts; } } else { - var isDeclarationInstanceProperty = declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); + var isDeclarationInstanceProperty = declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { return true; } @@ -50033,19 +50585,19 @@ var ts; return "quit"; } switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // even when stopping at any property declaration, they need to come from the same class return stopAtAnyPropertyDeclaration && (ts.isPropertyDeclaration(declaration) && node.parent === declaration.parent || ts.isParameterPropertyDeclaration(declaration, declaration.parent) && node.parent === declaration.parent.parent) ? "quit" : true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; @@ -50085,18 +50637,18 @@ var ts; } function requiresScopeChangeWorker(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: // do not descend into these return false; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: return requiresScopeChangeWorker(node.name); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // static properties in classes introduce temporary variables if (ts.hasStaticModifier(node)) { return target < 99 /* ScriptTarget.ESNext */ || !useDefineForClassFields; @@ -50125,12 +50677,13 @@ var ts; * the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with * the given name can be found. * + * @param nameNotFoundMessage If defined, we will report errors found during resolve. * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters. */ - function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) { + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) { if (excludeGlobals === void 0) { excludeGlobals = false; } - if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; } - return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol); + if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; } + return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol); } function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) { var _a, _b, _c; @@ -50161,14 +50714,14 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 320 /* SyntaxKind.JSDoc */) { + if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 323 /* SyntaxKind.JSDoc */) { useResult = result.flags & 262144 /* SymbolFlags.TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || - lastLocation.kind === 340 /* SyntaxKind.JSDocParameterTag */ || - lastLocation.kind === 341 /* SyntaxKind.JSDocReturnTag */ || - lastLocation.kind === 163 /* SyntaxKind.TypeParameter */ + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || + lastLocation.kind === 343 /* SyntaxKind.JSDocParameterTag */ || + lastLocation.kind === 344 /* SyntaxKind.JSDocReturnTag */ || + lastLocation.kind === 165 /* SyntaxKind.TypeParameter */ // local types not visible outside the function body : false; } @@ -50183,13 +50736,13 @@ var ts; // however it is detected separately when checking initializers of parameters // to make sure that they reference no variables declared after them. useResult = - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || (lastLocation === location.type && !!ts.findAncestor(result.valueDeclaration, ts.isParameter)); } } } - else if (location.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (location.kind === 191 /* SyntaxKind.ConditionalType */) { // A type parameter declared using 'infer T' in a conditional type is visible only in // the true branch of the conditional type. useResult = lastLocation === location.trueType; @@ -50204,14 +50757,14 @@ var ts; } withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation); switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols; - if (location.kind === 305 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { + if (location.kind === 308 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports.get("default" /* InternalSymbolName.Default */)) { @@ -50235,7 +50788,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 /* SymbolFlags.Alias */ && - (ts.getDeclarationOfKind(moduleExport, 275 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 274 /* SyntaxKind.NamespaceExport */))) { + (ts.getDeclarationOfKind(moduleExport, 278 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 277 /* SyntaxKind.NamespaceExport */))) { break; } } @@ -50249,12 +50802,12 @@ var ts; } } break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (result = lookup(((_c = getSymbolOfNode(location)) === null || _c === void 0 ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* SymbolFlags.EnumMember */)) { break loop; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or @@ -50272,9 +50825,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals // These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would // trigger resolving late-bound names, which we may already be in the process of doing while we're here! @@ -50288,12 +50841,14 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type // parameter list is associated, with the exception of static member declarations in classes. - error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + } return undefined; } break loop; } - if (location.kind === 226 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { + if (location.kind === 228 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -50301,7 +50856,7 @@ var ts; } } break; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // The type parameters of a class are not in scope in the base class expression. if (lastLocation === location.expression && location.parent.token === 94 /* SyntaxKind.ExtendsKeyword */) { var container = location.parent.parent; @@ -50321,34 +50876,36 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) { - error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + } return undefined; } } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // when targeting ES6 or higher there is no 'arguments' in an arrow function // for lower compile targets the resolved symbol is used to emit an error if (ts.getEmitScriptTarget(compilerOptions) >= 2 /* ScriptTarget.ES2015 */) { break; } // falls through - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -50361,7 +50918,7 @@ var ts; } } break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -50370,7 +50927,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 164 /* SyntaxKind.Parameter */) { + if (location.parent && location.parent.kind === 166 /* SyntaxKind.Parameter */) { location = location.parent; } // @@ -50385,20 +50942,20 @@ var ts; // declare function y(x: T): any; // @param(1 as T) // <-- T should resolve to the type alias outside of class C // class C {} - if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 257 /* SyntaxKind.ClassDeclaration */)) { + if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 260 /* SyntaxKind.ClassDeclaration */)) { location = location.parent; } break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // js type aliases do not resolve names from their host, so skip past it var root = ts.getJSDocRoot(location); if (root) { location = root.parent; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (!associatedDeclarationForContainingInitializerOrBindingName) { @@ -50406,7 +50963,7 @@ var ts; } } break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (ts.isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) { @@ -50414,7 +50971,7 @@ var ts; } } break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: if (meaning & 262144 /* SymbolFlags.TypeParameter */) { var parameterName = location.typeParameter.name; if (parameterName && name === parameterName.escapedText) { @@ -50440,7 +50997,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(lastLocation.kind === 308 /* SyntaxKind.SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) { return lastLocation.symbol; } @@ -50480,8 +51037,8 @@ var ts; !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && + !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && - !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) { var suggestion = void 0; var suggestedLib = void 0; @@ -50522,7 +51079,7 @@ var ts; } return undefined; } - else if (checkAndReportErrorForInvalidInitializer()) { + else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) { return undefined; } // Perform extra checks only if error reporting was requested @@ -50568,9 +51125,9 @@ var ts; } } if (result && errorLocation && meaning & 111551 /* SymbolFlags.Value */ && result.flags & 2097152 /* SymbolFlags.Alias */ && !(result.flags & 111551 /* SymbolFlags.Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) { - var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result); + var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* SymbolFlags.Value */); if (typeOnlyDeclaration) { - var message = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ + var message = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; var unescapedName = ts.unescapeLeadingUnderscores(name); @@ -50584,31 +51141,31 @@ var ts; function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) { if (!typeOnlyDeclaration) return diagnostic; - return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); + return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); } function getIsDeferredContext(location, lastLocation) { - if (location.kind !== 214 /* SyntaxKind.ArrowFunction */ && location.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (location.kind !== 216 /* SyntaxKind.ArrowFunction */ && location.kind !== 215 /* SyntaxKind.FunctionExpression */) { // initializers in instance property declaration of class like entities are executed in constructor and thus deferred return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) || - (location.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred + (location.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred } if (lastLocation && lastLocation === location.name) { return false; } // generator functions and async functions are not inlined in control flow when immediately invoked - if (location.asteriskToken || ts.hasSyntacticModifier(location, 256 /* ModifierFlags.Async */)) { + if (location.asteriskToken || ts.hasSyntacticModifier(location, 512 /* ModifierFlags.Async */)) { return true; } return !ts.getImmediatelyInvokedFunctionExpression(location); } function isSelfReferenceLocation(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -50621,7 +51178,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - if (decl.kind === 163 /* SyntaxKind.TypeParameter */) { + if (decl.kind === 165 /* SyntaxKind.TypeParameter */) { var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent; if (parent === container) { return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); @@ -50678,9 +51235,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -50724,14 +51281,14 @@ var ts; return name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never" || name === "unknown"; } function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) { - if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { error(errorLocation, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name); return true; } return false; } function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) { - if (meaning & (111551 /* SymbolFlags.Value */ & ~1024 /* SymbolFlags.NamespaceModule */)) { + if (meaning & 111551 /* SymbolFlags.Value */) { if (isPrimitiveTypeName(name)) { if (isExtendedByInterface(errorLocation)) { error(errorLocation, ts.Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, ts.unescapeLeadingUnderscores(name)); @@ -50742,7 +51299,8 @@ var ts; return true; } var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); - if (symbol && !(symbol.flags & 1024 /* SymbolFlags.NamespaceModule */)) { + var allFlags = symbol && getAllSymbolFlags(symbol); + if (symbol && allFlags !== undefined && !(allFlags & 111551 /* SymbolFlags.Value */)) { var rawName = ts.unescapeLeadingUnderscores(name); if (isES2015OrLaterConstructorName(name)) { error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later, rawName); @@ -50790,16 +51348,16 @@ var ts; } return false; } - function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) { - if (meaning & (111551 /* SymbolFlags.Value */ & ~1024 /* SymbolFlags.NamespaceModule */ & ~788968 /* SymbolFlags.Type */)) { - var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); + function checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) { + if (meaning & (111551 /* SymbolFlags.Value */ & ~788968 /* SymbolFlags.Type */)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); if (symbol) { error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name)); return true; } } - else if (meaning & (788968 /* SymbolFlags.Type */ & ~1024 /* SymbolFlags.NamespaceModule */ & ~111551 /* SymbolFlags.Value */)) { - var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* SymbolFlags.ValueModule */ | 1024 /* SymbolFlags.NamespaceModule */) & ~788968 /* SymbolFlags.Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); + else if (meaning & (788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1536 /* SymbolFlags.Module */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); if (symbol) { error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name)); return true; @@ -50815,7 +51373,7 @@ var ts; return; } // Block-scoped variables cannot be used before their definition - var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 260 /* SyntaxKind.EnumDeclaration */); }); + var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 263 /* SyntaxKind.EnumDeclaration */); }); if (declaration === undefined) return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration"); if (!(declaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { @@ -50852,13 +51410,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return node.parent; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; default: return undefined; @@ -50883,24 +51441,24 @@ var ts; * const { x } = require ... */ function isAliasSymbolDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name - || node.kind === 268 /* SyntaxKind.NamespaceImport */ - || node.kind === 274 /* SyntaxKind.NamespaceExport */ - || node.kind === 270 /* SyntaxKind.ImportSpecifier */ - || node.kind === 275 /* SyntaxKind.ExportSpecifier */ - || node.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name + || node.kind === 271 /* SyntaxKind.NamespaceImport */ + || node.kind === 277 /* SyntaxKind.NamespaceExport */ + || node.kind === 273 /* SyntaxKind.ImportSpecifier */ + || node.kind === 278 /* SyntaxKind.ExportSpecifier */ + || node.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) || ts.isBinaryExpression(node) && ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && ts.exportAssignmentIsAlias(node) || ts.isAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && isAliasableOrJsExpression(node.parent.right) - || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || node.kind === 296 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) - || node.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) - || node.kind === 203 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); + || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || node.kind === 299 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) + || node.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) + || node.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } function isAliasableOrJsExpression(e) { return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e); @@ -50913,7 +51471,7 @@ var ts; ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : undefined; } - if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { var immediate = resolveExternalModuleName(node, ts.getExternalModuleRequireArgument(node) || ts.getExternalModuleImportEqualsDeclarationExpression(node)); var resolved_4 = resolveExternalModuleSymbol(immediate); markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved_4, /*overwriteEmpty*/ false); @@ -50926,7 +51484,7 @@ var ts; function checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved) { if (markSymbolOfAliasDeclarationIfTypeOnly(node, /*immediateTarget*/ undefined, resolved, /*overwriteEmpty*/ false) && !node.isTypeOnly) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfNode(node)); - var isExport = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */; + var isExport = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */; var message = isExport ? ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type; @@ -50945,7 +51503,7 @@ var ts; return resolved; } function isSyntacticDefault(node) { - return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); + return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); } function getUsageModeForExpression(usage) { return ts.isStringLiteralLike(usage) ? ts.getModeForUsageLocation(ts.getSourceFileOfNode(usage), usage) : undefined; @@ -51045,11 +51603,11 @@ var ts; } function getModuleSpecifierForImportOrExport(node) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; - case 268 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; - case 270 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; - case 275 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; + case 270 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; + case 278 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; default: return ts.Debug.assertNever(node); } } @@ -51318,31 +51876,31 @@ var ts; function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; } switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return getTargetOfNamespaceExport(node, dontRecursivelyResolve); - case 270 /* SyntaxKind.ImportSpecifier */: - case 203 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return getTargetOfExportSpecifier(node, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, dontRecursivelyResolve); - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return resolveEntityName(node.name, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ true, dontRecursivelyResolve); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return getTargetOfAccessExpression(node, dontRecursivelyResolve); default: return ts.Debug.fail(); @@ -51389,6 +51947,52 @@ var ts; } return undefined; } + /** + * Gets combined flags of a `symbol` and all alias targets it resolves to. `resolveAlias` + * is typically recursive over chains of aliases, but stops mid-chain if an alias is merged + * with another exported symbol, e.g. + * ```ts + * // a.ts + * export const a = 0; + * // b.ts + * export { a } from "./a"; + * export type a = number; + * // c.ts + * import { a } from "./b"; + * ``` + * Calling `resolveAlias` on the `a` in c.ts would stop at the merged symbol exported + * from b.ts, even though there is still more alias to resolve. Consequently, if we were + * trying to determine if the `a` in c.ts has a value meaning, looking at the flags on + * the local symbol and on the symbol returned by `resolveAlias` is not enough. + * @returns SymbolFlags.All if `symbol` is an alias that ultimately resolves to `unknown`; + * combined flags of all alias targets otherwise. + */ + function getAllSymbolFlags(symbol) { + var flags = symbol.flags; + var seenSymbols; + while (symbol.flags & 2097152 /* SymbolFlags.Alias */) { + var target = resolveAlias(symbol); + if (target === unknownSymbol) { + return 67108863 /* SymbolFlags.All */; + } + // Optimizations - try to avoid creating or adding to + // `seenSymbols` if possible + if (target === symbol || (seenSymbols === null || seenSymbols === void 0 ? void 0 : seenSymbols.has(target))) { + break; + } + if (target.flags & 2097152 /* SymbolFlags.Alias */) { + if (seenSymbols) { + seenSymbols.add(target); + } + else { + seenSymbols = new ts.Set([symbol, target]); + } + } + flags |= target.flags; + symbol = target; + } + return flags; + } /** * Marks a symbol as type-only if its declaration is syntactically type-only. * If it is not itself marked type-only, but resolves to a type-only alias @@ -51434,19 +52038,25 @@ var ts; return !!aliasDeclarationLinks.typeOnlyDeclaration; } /** Indicates that a symbol directly or indirectly resolves to a type-only import or export. */ - function getTypeOnlyAliasDeclaration(symbol) { + function getTypeOnlyAliasDeclaration(symbol, include) { if (!(symbol.flags & 2097152 /* SymbolFlags.Alias */)) { return undefined; } var links = getSymbolLinks(symbol); - return links.typeOnlyDeclaration || undefined; + if (include === undefined) { + return links.typeOnlyDeclaration || undefined; + } + if (links.typeOnlyDeclaration) { + return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : undefined; + } + return undefined; } function markExportAsReferenced(node) { var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target) { var markAlias = target === unknownSymbol || - ((target.flags & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol)); + ((getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)); if (markAlias) { markAliasSymbolAsReferenced(symbol); } @@ -51466,8 +52076,7 @@ var ts; // This way a chain of imports can be elided if ultimately the final input is only used in a type // position. if (ts.isInternalModuleImportEqualsDeclaration(node)) { - var target = resolveSymbol(symbol); - if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(resolveSymbol(symbol)) & 111551 /* SymbolFlags.Value */) { // import foo = checkExpressionCached(node.moduleReference); } @@ -51494,18 +52103,18 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 163 /* SyntaxKind.QualifiedName */) { return resolveEntityName(entityName, 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */); return resolveEntityName(entityName, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } function getFullyQualifiedName(symbol, containingLocation) { - return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); } function getContainingQualifiedNameNode(node) { while (ts.isQualifiedName(node.parent)) { @@ -51546,9 +52155,9 @@ var ts; return getMergedSymbol(symbolFromJSPrototype); } } - else if (name.kind === 161 /* SyntaxKind.QualifiedName */ || name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - var left = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; - var right = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : name.name; + else if (name.kind === 163 /* SyntaxKind.QualifiedName */ || name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + var left = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; + var right = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -51606,7 +52215,7 @@ var ts; throw ts.Debug.assertNever(name, "Unknown entity name kind."); } ts.Debug.assert((ts.getCheckFlags(symbol) & 1 /* CheckFlags.Instantiated */) === 0, "Should never get an instantiated symbol here."); - if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 271 /* SyntaxKind.ExportAssignment */)) { + if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 274 /* SyntaxKind.ExportAssignment */)) { markSymbolOfAliasDeclarationIfTypeOnly(ts.getAliasDeclarationFromName(name), symbol, /*finalTarget*/ undefined, /*overwriteEmpty*/ true); } return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); @@ -51929,7 +52538,7 @@ var ts; var _a; var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { - if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */)) { + if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */)) { var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop"; @@ -52289,13 +52898,13 @@ var ts; } function symbolIsValue(symbol, includeTypeOnlyMembers) { return !!(symbol.flags & 111551 /* SymbolFlags.Value */ || - symbol.flags & 2097152 /* SymbolFlags.Alias */ && resolveAlias(symbol).flags & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol))); + symbol.flags & 2097152 /* SymbolFlags.Alias */ && getAllSymbolFlags(symbol) & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol))); } function findConstructorDeclaration(node) { var members = node.members; for (var _i = 0, members_3 = members; _i < members_3.length; _i++) { var member = members_3[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -52403,12 +53012,12 @@ var ts; } } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var sym = getSymbolOfNode(location); // `sym` may not have exports if this module declaration is backed by the symbol for a `const` that's being rewritten // into a namespace - in such cases, it's best to just let the namespace appear empty (the const members couldn't have referred @@ -52417,9 +53026,9 @@ var ts; return { value: result }; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // Type parameters are bound into `members` lists so they can merge across declarations // This is troublesome, since in all other respects, they behave like locals :cries: // TODO: the below is shared with similar code in `resolveName` - in fact, rephrasing all this symbol @@ -52514,7 +53123,7 @@ var ts; && (isLocalNameLookup ? !ts.some(symbolFromSymbolTable.declarations, ts.isNamespaceReexportDeclaration) : true) // While exports are generally considered to be in scope, export-specifier declared symbols are _not_ // See similar comment in `resolveName` for details - && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */))) { + && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */))) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); var candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification); if (candidate) { @@ -52558,8 +53167,10 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; - if (symbolFromSymbolTable.flags & meaning) { + var shouldResolveAlias = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */)); + symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + var flags = shouldResolveAlias ? getAllSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags; + if (flags & meaning) { qualify = true; return true; } @@ -52573,10 +53184,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: continue; default: return false; @@ -52706,10 +53317,10 @@ var ts; return node && getSymbolOfNode(node); } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { - return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -52777,14 +53388,14 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 181 /* SyntaxKind.TypeQuery */ || - entityName.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || - entityName.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (entityName.parent.kind === 183 /* SyntaxKind.TypeQuery */ || + entityName.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || + entityName.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Typeof value meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } - else if (entityName.kind === 161 /* SyntaxKind.QualifiedName */ || entityName.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (entityName.kind === 163 /* SyntaxKind.QualifiedName */ || entityName.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* SymbolFlags.Namespace */; @@ -52820,15 +53431,18 @@ var ts; if (flags & 8 /* SymbolFormatFlags.UseAliasDefinedOutsideCurrentScope */) { nodeFlags |= 16384 /* NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope */; } - if (flags & 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { + if (flags & 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { nodeFlags |= 134217728 /* NodeBuilderFlags.DoNotIncludeSymbolChain */; } - var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToExpression : nodeBuilder.symbolToEntityName; + if (flags & 16 /* SymbolFormatFlags.WriteComputedProps */) { + nodeFlags |= 1073741824 /* NodeBuilderFlags.WriteComputedProps */; + } + var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName; return writer ? symbolToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(symbolToStringWorker); function symbolToStringWorker(writer) { var entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags); // TODO: GH#18217 // add neverAsciiEscape for GH#39027 - var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 305 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); + var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 308 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); printer.writeNode(4 /* EmitHint.Unspecified */, entity, /*sourceFile*/ sourceFile, writer); return writer; @@ -52840,10 +53454,10 @@ var ts; function signatureToStringWorker(writer) { var sigOutput; if (flags & 262144 /* TypeFormatFlags.WriteArrowStyleSignature */) { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 180 /* SyntaxKind.ConstructorType */ : 179 /* SyntaxKind.FunctionType */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 182 /* SyntaxKind.ConstructorType */ : 181 /* SyntaxKind.FunctionType */; } else { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 175 /* SyntaxKind.ConstructSignature */ : 174 /* SyntaxKind.CallSignature */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 177 /* SyntaxKind.ConstructSignature */ : 176 /* SyntaxKind.CallSignature */; } var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */); var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true }); @@ -52923,7 +53537,25 @@ var ts; symbolTableToDeclarationStatements: function (symbolTable, enclosingDeclaration, flags, tracker, bundled) { return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolTableToDeclarationStatements(symbolTable, context, bundled); }); }, + symbolToNode: function (symbol, meaning, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolToNode(symbol, context, meaning); }); + }, }; + function symbolToNode(symbol, context, meaning) { + if (context.flags & 1073741824 /* NodeBuilderFlags.WriteComputedProps */) { + if (symbol.valueDeclaration) { + var name = ts.getNameOfDeclaration(symbol.valueDeclaration); + if (name && ts.isComputedPropertyName(name)) + return name; + } + var nameType = getSymbolLinks(symbol).nameType; + if (nameType && nameType.flags & (1024 /* TypeFlags.EnumLiteral */ | 8192 /* TypeFlags.UniqueESSymbol */)) { + context.enclosingDeclaration = nameType.symbol.valueDeclaration; + return ts.factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning)); + } + } + return symbolToExpression(symbol, context, meaning); + } function withContext(enclosingDeclaration, flags, tracker, cb) { var _a, _b; ts.Debug.assert(enclosingDeclaration === undefined || (enclosingDeclaration.flags & 8 /* NodeFlags.Synthesized */) === 0); @@ -53008,7 +53640,7 @@ var ts; return undefined; // TODO: GH#18217 } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (!(context.flags & 536870912 /* NodeBuilderFlags.NoTypeReduction */)) { type = getReducedType(type); @@ -53018,29 +53650,29 @@ var ts; return ts.factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context)); } if (type === unresolvedType) { - return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); + return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 138 /* SyntaxKind.IntrinsicKeyword */ : 130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 139 /* SyntaxKind.IntrinsicKeyword */ : 131 /* SyntaxKind.AnyKeyword */); } if (type.flags & 2 /* TypeFlags.Unknown */) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (type.flags & 4 /* TypeFlags.String */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + return ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); } if (type.flags & 8 /* TypeFlags.Number */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(147 /* SyntaxKind.NumberKeyword */); + return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.NumberKeyword */); } if (type.flags & 64 /* TypeFlags.BigInt */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(158 /* SyntaxKind.BigIntKeyword */); + return ts.factory.createKeywordTypeNode(160 /* SyntaxKind.BigIntKeyword */); } if (type.flags & 16 /* TypeFlags.Boolean */ && !type.aliasSymbol) { context.approximateLength += 7; - return ts.factory.createKeywordTypeNode(133 /* SyntaxKind.BooleanKeyword */); + return ts.factory.createKeywordTypeNode(134 /* SyntaxKind.BooleanKeyword */); } if (type.flags & 1024 /* TypeFlags.EnumLiteral */ && !(type.flags & 1048576 /* TypeFlags.Union */)) { var parentSymbol = getParentOfSymbol(type.symbol); @@ -53094,7 +53726,7 @@ var ts; } } context.approximateLength += 13; - return ts.factory.createTypeOperatorNode(154 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */)); + return ts.factory.createTypeOperatorNode(156 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */)); } if (type.flags & 16384 /* TypeFlags.Void */) { context.approximateLength += 4; @@ -53102,7 +53734,7 @@ var ts; } if (type.flags & 32768 /* TypeFlags.Undefined */) { context.approximateLength += 9; - return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); } if (type.flags & 65536 /* TypeFlags.Null */) { context.approximateLength += 4; @@ -53110,15 +53742,15 @@ var ts; } if (type.flags & 131072 /* TypeFlags.Never */) { context.approximateLength += 5; - return ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */); + return ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */); } if (type.flags & 4096 /* TypeFlags.ESSymbol */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */); + return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */); } if (type.flags & 67108864 /* TypeFlags.NonPrimitive */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.ObjectKeyword */); + return ts.factory.createKeywordTypeNode(149 /* SyntaxKind.ObjectKeyword */); } if (ts.isThisTypeParameter(type)) { if (context.flags & 4194304 /* NodeBuilderFlags.InObjectTypeLiteral */) { @@ -53207,7 +53839,7 @@ var ts; var indexedType = type.type; context.approximateLength += 6; var indexTypeNode = typeToTypeNodeHelper(indexedType, context); - return ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); + return ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); } if (type.flags & 134217728 /* TypeFlags.TemplateLiteral */) { var texts_1 = type.texts; @@ -53259,7 +53891,7 @@ var ts; // On the other hand, // checkType extends infer T extends checkType ? T extends extendsType ? trueType : falseType : never; // may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS. - return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } var saveInferTypeParameters = context.inferTypeParameters; context.inferTypeParameters = type.root.inferTypeParameters; @@ -53301,7 +53933,7 @@ var ts; var name = typeParameterToName(newParam, context); newTypeVariable = ts.factory.createTypeReferenceNode(name); } - appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); + appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); } else { appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context); @@ -53317,7 +53949,7 @@ var ts; // wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting // type stays homomorphic var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper); - return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } return result; } @@ -53365,7 +53997,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* SymbolFlags.Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 305 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 262 /* SyntaxKind.ModuleBlock */; + return declaration.parent.kind === 308 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 265 /* SyntaxKind.ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -53454,12 +54086,12 @@ var ts; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { var signature = resolved.callSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 179 /* SyntaxKind.FunctionType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 181 /* SyntaxKind.FunctionType */, context); return signatureNode; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { var signature = resolved.constructSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 180 /* SyntaxKind.ConstructorType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 182 /* SyntaxKind.ConstructorType */, context); return signatureNode; } } @@ -53502,7 +54134,7 @@ var ts; } var elementType = typeToTypeNodeHelper(typeArguments[0], context); var arrayType = ts.factory.createArrayTypeNode(elementType); - return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, arrayType); + return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, arrayType); } else if (type.target.objectFlags & 8 /* ObjectFlags.Tuple */) { typeArguments = ts.sameMap(typeArguments, function (t, i) { return removeMissingType(t, !!(type.target.elementFlags[i] & 2 /* ElementFlags.Optional */)); }); @@ -53527,12 +54159,12 @@ var ts; } } var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode(tupleConstituentNodes), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } } if (context.encounteredError || (context.flags & 524288 /* NodeBuilderFlags.AllowEmptyTuple */)) { var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode([]), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } context.encounteredError = true; return undefined; // TODO: GH#18217 @@ -53639,13 +54271,13 @@ var ts; var typeElements = []; for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 174 /* SyntaxKind.CallSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 176 /* SyntaxKind.CallSignature */, context)); } for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; if (signature.flags & 4 /* SignatureFlags.Abstract */) continue; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 175 /* SyntaxKind.ConstructSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 177 /* SyntaxKind.ConstructSignature */, context)); } for (var _d = 0, _e = resolvedType.indexInfos; _d < _e.length; _d++) { var info = _e[_d]; @@ -53682,7 +54314,7 @@ var ts; if (!(context.flags & 1 /* NodeBuilderFlags.NoTruncation */)) { return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier("..."), /*typeArguments*/ undefined); } - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function shouldUsePlaceholderForProperty(propertySymbol, context) { var _a; @@ -53732,7 +54364,7 @@ var ts; var signatures = getSignaturesOfType(filterType(propertyType, function (t) { return !(t.flags & 32768 /* TypeFlags.Undefined */); }), 0 /* SignatureKind.Call */); for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) { var signature = signatures_1[_i]; - var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 168 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 170 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration)); } } @@ -53746,12 +54378,12 @@ var ts; context.reverseMappedStack || (context.reverseMappedStack = []); context.reverseMappedStack.push(propertySymbol); } - propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); if (propertyIsReverseMapped) { context.reverseMappedStack.pop(); } } - var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined; + var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined; if (modifiers) { context.approximateLength += 9; } @@ -53760,8 +54392,8 @@ var ts; } function preserveCommentsOn(node) { var _a; - if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; })) { - var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; }); + if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; })) { + var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; }); var commentText = ts.getTextOfJSDocComment(d.comment); if (commentText) { ts.setSyntheticLeadingComments(node, [{ kind: 3 /* SyntaxKind.MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); @@ -53860,7 +54492,7 @@ var ts; context.encounteredError = true; } context.approximateLength += (name.length + 4); - return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); + return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); } function signatureToSignatureDeclarationHelper(signature, kind, context, options) { var _a, _b, _c, _d; @@ -53878,7 +54510,7 @@ var ts; } var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0]; // If the expanded parameter list had a variadic in a non-trailing position, don't expand it - var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); + var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 173 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); var thisParameter = context.flags & 33554432 /* NodeBuilderFlags.OmitThisParameter */ ? undefined : tryGetThisParameterDeclaration(signature, context); if (thisParameter) { parameters.unshift(thisParameter); @@ -53887,7 +54519,7 @@ var ts; var typePredicate = getTypePredicateOfSignature(signature); if (typePredicate) { var assertsModifier = typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? - ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : + ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined; var parameterName = typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.setEmitFlags(ts.factory.createIdentifier(typePredicate.parameterName), 16777216 /* EmitFlags.NoAsciiEscaping */) : @@ -53901,28 +54533,28 @@ var ts; returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); } else if (!suppressAny) { - returnTypeNode = ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + returnTypeNode = ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } var modifiers = options === null || options === void 0 ? void 0 : options.modifiers; - if ((kind === 180 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { + if ((kind === 182 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { var flags = ts.modifiersToFlags(modifiers); - modifiers = ts.factory.createModifiersFromModifierFlags(flags | 128 /* ModifierFlags.Abstract */); - } - var node = kind === 174 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : - kind === 175 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : - kind === 168 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : - kind === 169 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 171 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : - kind === 172 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : - kind === 173 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : - kind === 176 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : - kind === 317 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : - kind === 179 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 180 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 256 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 213 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : - kind === 214 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : + modifiers = ts.factory.createModifiersFromModifierFlags(flags | 256 /* ModifierFlags.Abstract */); + } + var node = kind === 176 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : + kind === 177 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : + kind === 170 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : + kind === 171 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 173 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : + kind === 174 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : + kind === 175 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : + kind === 178 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : + kind === 320 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : + kind === 181 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 182 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 215 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : + kind === 216 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : ts.Debug.assertNever(kind); if (typeArguments) { node.typeArguments = ts.factory.createNodeArray(typeArguments); @@ -53959,9 +54591,9 @@ var ts; return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) { - var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 164 /* SyntaxKind.Parameter */); + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 166 /* SyntaxKind.Parameter */); if (!parameterDeclaration && !ts.isTransientSymbol(parameterSymbol)) { - parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 340 /* SyntaxKind.JSDocParameterTag */); + parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 343 /* SyntaxKind.JSDocParameterTag */); } var parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -53973,7 +54605,7 @@ var ts; var dotDotDotToken = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name), 16777216 /* EmitFlags.NoAsciiEscaping */) : - parameterDeclaration.name.kind === 161 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : + parameterDeclaration.name.kind === 163 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : ts.symbolName(parameterSymbol) : ts.symbolName(parameterSymbol); @@ -54137,11 +54769,11 @@ var ts; } function getSpecifierForModuleSymbol(symbol, context, overrideImportMode) { var _a; - var file = ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */); + var file = ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */); if (!file) { var equivalentFileSymbol = ts.firstDefined(symbol.declarations, function (d) { return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); }); if (equivalentFileSymbol) { - file = ts.getDeclarationOfKind(equivalentFileSymbol, 305 /* SyntaxKind.SourceFile */); + file = ts.getDeclarationOfKind(equivalentFileSymbol, 308 /* SyntaxKind.SourceFile */); } } if (file && file.moduleName !== undefined) { @@ -54609,17 +55241,17 @@ var ts; return transformed === existing ? ts.setTextRange(ts.factory.cloneNode(existing), existing) : transformed; function visitExistingNodeTreeSymbols(node) { // We don't _actually_ support jsdoc namepath types, emit `any` instead - if (ts.isJSDocAllType(node) || node.kind === 319 /* SyntaxKind.JSDocNamepathType */) { - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + if (ts.isJSDocAllType(node) || node.kind === 322 /* SyntaxKind.JSDocNamepathType */) { + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (ts.isJSDocUnknownType(node)) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (ts.isJSDocNullableType(node)) { return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createLiteralTypeNode(ts.factory.createNull())]); } if (ts.isJSDocOptionalType(node)) { - return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } if (ts.isJSDocNonNullableType(node)) { return ts.visitNode(node.type, visitExistingNodeTreeSymbols); @@ -54633,11 +55265,11 @@ var ts; var typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText); var overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : undefined; return ts.factory.createPropertySignature( - /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); })); } if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "") { - return ts.setOriginalNode(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), node); + return ts.setOriginalNode(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), node); } if ((ts.isExpressionWithTypeArguments(node) || ts.isTypeReferenceNode(node)) && ts.isJSDocIndexSignature(node)) { return ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature( @@ -54652,12 +55284,12 @@ var ts; return ts.factory.createConstructorTypeNode( /*modifiers*/ undefined, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } else { return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } } if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */, /*ignoreErrors*/ true))) { @@ -54725,8 +55357,8 @@ var ts; } } function symbolTableToDeclarationStatements(symbolTable, context, bundled) { - var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 169 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); - var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 168 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); + var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 171 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); + var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 170 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); // TODO: Use `setOriginalNode` on original declaration names where possible so these declarations see some kind of // declaration mapping // We save the enclosing declaration off here so it's not adjusted by well-meaning declaration @@ -54850,7 +55482,7 @@ var ts; // export {name} - look thru `statements` for `name`, and if all results can take an `export` modifier, do so and filter it var indices = ts.indicesOf(statements); var associatedIndices = ts.filter(indices, function (i) { return ts.nodeHasName(statements[i], e.name); }); - if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return canHaveExportModifier(statements[i]); })) { + if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return ts.canHaveExportModifier(statements[i]); })) { for (var _i = 0, associatedIndices_1 = associatedIndices; _i < associatedIndices_1.length; _i++) { var index_1 = associatedIndices_1[_i]; statements[index_1] = addExportModifier(statements[index_1]); @@ -54884,15 +55516,6 @@ var ts; } return statements; } - function canHaveExportModifier(node) { - return ts.isEnumDeclaration(node) || - ts.isVariableStatement(node) || - ts.isFunctionDeclaration(node) || - ts.isClassDeclaration(node) || - (ts.isModuleDeclaration(node) && !ts.isExternalModuleAugmentation(node) && !ts.isGlobalScopeAugmentation(node)) || - ts.isInterfaceDeclaration(node) || - isTypeDeclaration(node); - } function addExportModifier(node) { var flags = (ts.getEffectiveModifierFlags(node) | 1 /* ModifierFlags.Export */) & ~2 /* ModifierFlags.Ambient */; return ts.factory.updateModifiers(node, flags); @@ -54964,7 +55587,7 @@ var ts; if (needsPostExportDefault || needsExportDeclaration) { isPrivate = true; } - var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 512 /* ModifierFlags.Default */ : 0); + var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 1024 /* ModifierFlags.Default */ : 0); var isConstMergedWithNS = symbol.flags & 1536 /* SymbolFlags.Module */ && symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 1 /* SymbolFlags.FunctionScopedVariable */ | 4 /* SymbolFlags.Property */) && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */; @@ -54981,6 +55604,7 @@ var ts; && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */ && !(symbol.flags & 4194304 /* SymbolFlags.Prototype */) && !(symbol.flags & 32 /* SymbolFlags.Class */) + && !(symbol.flags & 8192 /* SymbolFlags.Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) { if (propertyAsAlias) { var createdExport = serializeMaybeAliasAssignment(symbol); @@ -55138,7 +55762,7 @@ var ts; (ts.isJSDocTypeAlias(context.enclosingDeclaration) ? ts.getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration); if (additionalModifierFlags & 1 /* ModifierFlags.Export */ && enclosingDeclaration_1 && (isExportingScope(enclosingDeclaration_1) || ts.isModuleDeclaration(enclosingDeclaration_1)) && - canHaveExportModifier(node)) { + ts.canHaveExportModifier(node)) { // Classes, namespaces, variables, functions, interfaces, and types should all be `export`ed in a module context if not private newModifierFlags |= 1 /* ModifierFlags.Export */; } @@ -55148,8 +55772,8 @@ var ts; // Classes, namespaces, variables, enums, and functions all need `declare` modifiers to be valid in a declaration file top-level scope newModifierFlags |= 2 /* ModifierFlags.Ambient */; } - if ((additionalModifierFlags & 512 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { - newModifierFlags |= 512 /* ModifierFlags.Default */; + if ((additionalModifierFlags & 1024 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { + newModifierFlags |= 1024 /* ModifierFlags.Default */; } if (newModifierFlags) { node = ts.factory.updateModifiers(node, newModifierFlags | ts.getEffectiveModifierFlags(node)); @@ -55183,8 +55807,8 @@ var ts; var baseTypes = getBaseTypes(interfaceType); var baseType = ts.length(baseTypes) ? getIntersectionType(baseTypes) : undefined; var members = ts.flatMap(getPropertiesOfType(interfaceType), function (p) { return serializePropertySymbolForInterface(p, baseType); }); - var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 174 /* SyntaxKind.CallSignature */); - var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 175 /* SyntaxKind.ConstructSignature */); + var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 176 /* SyntaxKind.CallSignature */); + var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 177 /* SyntaxKind.ConstructSignature */); var indexSignatures = serializeIndexSignatures(interfaceType, baseType); var heritageClauses = !ts.length(baseTypes) ? undefined : [ts.factory.createHeritageClause(94 /* SyntaxKind.ExtendsKeyword */, ts.mapDefined(baseTypes, function (b) { return trySerializeAsTypeReference(b, 111551 /* SymbolFlags.Value */); }))]; addResult(ts.factory.createInterfaceDeclaration( @@ -55194,7 +55818,7 @@ var ts; return !symbol.exports ? [] : ts.filter(ts.arrayFrom(symbol.exports.values()), isNamespaceMember); } function isTypeOnlyNamespace(symbol) { - return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m).flags & 111551 /* SymbolFlags.Value */); }); + return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* SymbolFlags.Value */); }); } function serializeModule(symbol, symbolName, modifierFlags) { var members = getNamespaceMembersForSerialization(symbol); @@ -55249,7 +55873,7 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var sig = signatures_2[_i]; // Each overload becomes a separate function declaration, in order - var decl = signatureToSignatureDeclarationHelper(sig, 256 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); + var decl = signatureToSignatureDeclarationHelper(sig, 259 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); addResult(ts.setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags); } // Module symbol emit will take care of module-y members, provided it has exports @@ -55407,7 +56031,7 @@ var ts; !ts.some(getSignaturesOfType(staticType, 1 /* SignatureKind.Construct */)); var constructors = isNonConstructableClassLikeInJsFile ? [ts.factory.createConstructorDeclaration(ts.factory.createModifiersFromModifierFlags(8 /* ModifierFlags.Private */), [], /*body*/ undefined)] : - serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 171 /* SyntaxKind.Constructor */); + serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 173 /* SyntaxKind.Constructor */); var indexSignatures = serializeIndexSignatures(classType, baseTypes[0]); context.enclosingDeclaration = oldEnclosing; addResult(ts.setTextRange(ts.factory.createClassDeclaration( @@ -55456,8 +56080,8 @@ var ts; var targetName = getInternalSymbolName(target, verbatimTargetName); includePrivateSymbol(target); // the target may be within the same scope - attempt to serialize it first switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 254 /* SyntaxKind.VariableDeclaration */) { + case 205 /* SyntaxKind.BindingElement */: + if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 257 /* SyntaxKind.VariableDeclaration */) { // const { SomeClass } = require('./lib'); var specifier_1 = getSpecifierForModuleSymbol(target.parent || target, context); // './lib' var propertyName = node.propertyName; @@ -55470,13 +56094,13 @@ var ts; // We don't know how to serialize this (nested?) binding element ts.Debug.failBadSyntaxKind(((_c = node.parent) === null || _c === void 0 ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization"); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 221 /* SyntaxKind.BinaryExpression */) { + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 223 /* SyntaxKind.BinaryExpression */) { // module.exports = { SomeClass } serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), targetName); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // commonjs require: const x = require('y') if (ts.isPropertyAccessExpression(node.initializer)) { // const x = require('y').z @@ -55494,7 +56118,7 @@ var ts; break; } // else fall through and treat commonjs require just like import= - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // This _specifically_ only exists to handle json declarations - where we make aliases, but since // we emit no declarations for the json document, must not refer to it in the declarations if (target.escapedName === "export=" /* InternalSymbolName.ExportEquals */ && ts.some(target.declarations, ts.isJsonSourceFile)) { @@ -55510,13 +56134,13 @@ var ts; ? symbolToName(target, context, 67108863 /* SymbolFlags.All */, /*expectsIdentifier*/ false) : ts.factory.createExternalModuleReference(ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))), isLocalImport ? modifierFlags : 0 /* ModifierFlags.None */); break; - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // export as namespace foo // TODO: Not part of a file's local or export symbol tables // Is bound into file.symbol.globalExports instead, which we don't currently traverse addResult(ts.factory.createNamespaceExportDeclaration(ts.idText(node.name)), 0 /* ModifierFlags.None */); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, ts.factory.createIdentifier(localName), /*namedBindings*/ undefined), // We use `target.parent || target` below as `target.parent` is unset when the target is a module which has been export assigned @@ -55525,17 +56149,17 @@ var ts; ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*importClause*/ undefined, ts.factory.createNamespaceImport(ts.factory.createIdentifier(localName))), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: addResult(ts.factory.createExportDeclaration( /*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamespaceExport(ts.factory.createIdentifier(localName)), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))), 0 /* ModifierFlags.None */); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause( /*isTypeOnly*/ false, @@ -55545,7 +56169,7 @@ var ts; ])), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: // does not use localName because the symbol name in this case refers to the name in the exports table, // which we must exactly preserve var specifier = node.parent.parent.moduleSpecifier; @@ -55553,12 +56177,12 @@ var ts; // another file serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: serializeMaybeAliasAssignment(symbol); break; - case 221 /* SyntaxKind.BinaryExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // Could be best encoded as though an export specifier or as though an export assignment // If name is default or export=, do an export assignment // Otherwise do an export specifier @@ -55702,7 +56326,7 @@ var ts; && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName)))) { return []; } - var flag = (modifierFlags & ~256 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); + var flag = (modifierFlags & ~512 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); var name = getPropertyNameNodeForSymbol(p, context); var firstPropertyLikeDecl = (_a = p.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.or(ts.isPropertyDeclaration, ts.isAccessor, ts.isVariableDeclaration, ts.isPropertySignature, ts.isBinaryExpression, ts.isPropertyAccessExpression)); if (p.flags & 98304 /* SymbolFlags.Accessor */ && useAccessors) { @@ -55724,7 +56348,7 @@ var ts; // This is an else/if as accessors and properties can't merge in TS, but might in JS // If this happens, we assume the accessor takes priority, as it imposes more constraints else if (p.flags & (4 /* SymbolFlags.Property */ | 3 /* SymbolFlags.Variable */ | 98304 /* SymbolFlags.Accessor */)) { - return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), + return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357 // interface members can't have initializers, however class members _can_ /*initializer*/ undefined), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts.or(ts.isPropertyDeclaration, ts.isVariableDeclaration))) || firstPropertyLikeDecl); @@ -55914,7 +56538,7 @@ var ts; if (flags === void 0) { flags = 16384 /* TypeFormatFlags.UseAliasDefinedOutsideCurrentScope */; } return writer ? typePredicateToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(typePredicateToStringWorker); function typePredicateToStringWorker(writer) { - var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 + var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 ); var printer = ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); @@ -55961,7 +56585,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ && type.symbol.declarations) { var node = ts.walkUpParenthesizedTypes(type.symbol.declarations[0].parent); - if (node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -55969,11 +56593,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 305 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); + return location.kind === 308 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); } function getNameOfSymbolFromNameType(symbol, context) { var nameType = getSymbolLinks(symbol).nameType; @@ -56032,17 +56656,17 @@ var ts; if (!declaration) { declaration = symbol.declarations[0]; // Declaration may be nameless, but we'll try anyway } - if (declaration.parent && declaration.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (declaration.parent && declaration.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { return ts.declarationNameToString(declaration.parent.name); } switch (declaration.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (context && !context.encounteredError && !(context.flags & 131072 /* NodeBuilderFlags.AllowAnonymousIdentifier */)) { context.encounteredError = true; } - return declaration.kind === 226 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; + return declaration.kind === 228 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; } } var name = getNameOfSymbolFromNameType(symbol, context); @@ -56059,28 +56683,28 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // Top-level jsdoc type aliases are considered exported // First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent)); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return isDeclarationVisible(node.parent.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; @@ -56088,55 +56712,55 @@ var ts; var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) && - !(node.kind !== 265 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 305 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { + !(node.kind !== 268 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 308 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 164 /* SyntaxKind.Parameter */: - case 262 /* SyntaxKind.ModuleBlock */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 178 /* SyntaxKind.TypeReference */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 166 /* SyntaxKind.Parameter */: + case 265 /* SyntaxKind.ModuleBlock */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 180 /* SyntaxKind.TypeReference */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: return false; // Type parameters are always visible - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: // Source file and namespace export are always visible // falls through - case 305 /* SyntaxKind.SourceFile */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return false; default: return false; @@ -56145,10 +56769,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.parent && node.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { exportSymbol = resolveName(node, node.escapedText, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false); } - else if (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + else if (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */); } var result; @@ -56255,12 +56879,12 @@ var ts; function getDeclarationContainer(node) { return ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 255 /* SyntaxKind.VariableDeclarationList */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 269 /* SyntaxKind.NamedImports */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 258 /* SyntaxKind.VariableDeclarationList */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 272 /* SyntaxKind.NamedImports */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: return false; default: return true; @@ -56390,23 +57014,23 @@ var ts; function getParentElementAccess(node) { var ancestor = node.parent.parent; switch (ancestor.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: return getSyntheticElementAccess(ancestor); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getSyntheticElementAccess(node.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ancestor.initializer; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ancestor.right; } } function getDestructuringPropertyName(node) { var parent = node.parent; - if (node.kind === 203 /* SyntaxKind.BindingElement */ && parent.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (node.kind === 205 /* SyntaxKind.BindingElement */ && parent.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { return getLiteralPropertyNameText(node.propertyName || node.name); } - if (node.kind === 296 /* SyntaxKind.PropertyAssignment */ || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.kind === 299 /* SyntaxKind.PropertyAssignment */ || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return getLiteralPropertyNameText(node.name); } return "" + parent.elements.indexOf(node); @@ -56436,7 +57060,7 @@ var ts; parentType = getTypeWithFacts(parentType, 524288 /* TypeFacts.NEUndefined */); } var type; - if (pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (declaration.dotDotDotToken) { parentType = getReducedType(parentType); if (parentType.flags & 2 /* TypeFlags.Unknown */ || !isValidSpreadType(parentType)) { @@ -56507,7 +57131,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, isProperty, isOptional) { if (isProperty === void 0) { isProperty = false; } @@ -56518,11 +57142,11 @@ var ts; function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, /*checkMode*/ checkMode))); return indexType.flags & (262144 /* TypeFlags.TypeParameter */ | 4194304 /* TypeFlags.Index */) ? getExtractStringType(indexType) : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -56533,7 +57157,7 @@ var ts; if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } - var isProperty = ts.isPropertyDeclaration(declaration) || ts.isPropertySignature(declaration); + var isProperty = ts.isPropertyDeclaration(declaration) && !ts.hasAccessorModifier(declaration) || ts.isPropertySignature(declaration); var isOptional = includeOptionality && (isProperty && !!declaration.questionToken || ts.isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) || isOptionalJSDocPropertyLikeTag(declaration)); @@ -56560,8 +57184,8 @@ var ts; if (ts.isParameter(declaration)) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 173 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { - var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 172 /* SyntaxKind.GetAccessor */); + if (func.kind === 175 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { + var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 174 /* SyntaxKind.GetAccessor */); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -56573,11 +57197,9 @@ var ts; return getReturnTypeOfSignature(getterSignature); } } - if (ts.isInJSFile(declaration)) { - var type_1 = getParameterTypeOfTypeTag(func, declaration); - if (type_1) - return type_1; - } + var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration); + if (parameterTypeOfTypeTag) + return parameterTypeOfTypeTag; // Use contextual parameter type if one is available var type = declaration.symbol.escapedName === "this" /* InternalSymbolName.This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration); if (type) { @@ -56638,7 +57260,7 @@ var ts; links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && ts.every(symbol.declarations, function (declaration) { return ts.isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && - (declaration.left.kind !== 207 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && + (declaration.left.kind !== 209 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration(/*declaredType*/ undefined, declaration, symbol, declaration); }); } @@ -56660,11 +57282,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var container = ts.getThisContainer(declaration, /*includeArrowFunctions*/ false); - if (container && (container.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { + if (container && (container.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { return container; } } - ; } /** Create a synthetic property access flow node after the last statement of the file */ function getFlowTypeFromCommonJSExport(symbol) { @@ -56957,9 +57578,9 @@ var ts; var thisContainer = ts.getThisContainer(expression, /*includeArrowFunctions*/ false); // Properties defined in a constructor (or base constructor, or javascript constructor function) don't get undefined added. // Function expressions that are assigned to the prototype count as methods. - return thisContainer.kind === 171 /* SyntaxKind.Constructor */ || - thisContainer.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (thisContainer.kind === 213 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + return thisContainer.kind === 173 /* SyntaxKind.Constructor */ || + thisContainer.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (thisContainer.kind === 215 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); } function getConstructorDefinedThisAssignmentTypes(types, declarations) { ts.Debug.assert(types.length === declarations.length); @@ -57029,7 +57650,7 @@ var ts; function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) { var elements = pattern.elements; var lastElement = ts.lastOrUndefined(elements); - var restElement = lastElement && lastElement.kind === 203 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; + var restElement = lastElement && lastElement.kind === 205 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; if (elements.length === 0 || elements.length === 1 && restElement) { return languageVersion >= 2 /* ScriptTarget.ES2015 */ ? createIterableType(anyType) : anyArrayType; } @@ -57054,7 +57675,7 @@ var ts; function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { if (includePatternInType === void 0) { includePatternInType = false; } if (reportErrors === void 0) { reportErrors = false; } - return pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + return pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -57102,7 +57723,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 164 /* SyntaxKind.Parameter */ ? root.parent : root; + var memberDeclaration = root.kind === 166 /* SyntaxKind.Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function tryGetTypeFromEffectiveTypeNode(node) { @@ -57157,9 +57778,9 @@ var ts; if (typeNode === undefined) { return useUnknownInCatchVariables ? unknownType : anyType; } - var type_2 = getTypeOfNode(typeNode); + var type_1 = getTypeOfNode(typeNode); // an errorType will make `checkTryStatement` issue an error - return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType; + return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType; } // Handle export default expressions if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) { @@ -57182,7 +57803,7 @@ var ts; return reportCircularityError(symbol); } var type; - if (declaration.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (declaration.kind === 274 /* SyntaxKind.ExportAssignment */) { type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); } else if (ts.isBinaryExpression(declaration) || @@ -57250,13 +57871,17 @@ var ts; } function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { - var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation; - } - else { - var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation; + switch (accessor.kind) { + case 174 /* SyntaxKind.GetAccessor */: + var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); + return getterTypeAnnotation; + case 175 /* SyntaxKind.SetAccessor */: + var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation; + case 169 /* SyntaxKind.PropertyDeclaration */: + ts.Debug.assert(ts.hasAccessorModifier(accessor)); + var accessorTypeAnnotation = ts.getEffectiveTypeAnnotationNode(accessor); + return accessorTypeAnnotation; } } return undefined; @@ -57278,14 +57903,17 @@ var ts; if (!pushTypeResolution(symbol, 0 /* TypeSystemPropertyName.Type */)) { return errorType; } - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); + var accessor = ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); // We try to resolve a getter type annotation, a setter type annotation, or a getter function // body return type inference, in that order. var type = getter && ts.isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || - getter && getter.body && getReturnTypeFromBody(getter); + getAnnotatedAccessorType(accessor) || + getter && getter.body && getReturnTypeFromBody(getter) || + accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration(accessor, /*includeOptionality*/ true); if (!type) { if (setter && !isPrivateWithinAmbient(setter)) { errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); @@ -57293,6 +57921,9 @@ var ts; else if (getter && !isPrivateWithinAmbient(getter)) { errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); } + else if (accessor && !isPrivateWithinAmbient(accessor)) { + errorOrSuggestion(noImplicitAny, accessor, ts.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), "any"); + } type = anyType; } if (!popTypeResolution()) { @@ -57302,6 +57933,9 @@ var ts; else if (getAnnotatedAccessorTypeNode(setter)) { error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } + else if (getAnnotatedAccessorTypeNode(accessor)) { + error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } else if (getter && noImplicitAny) { error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } @@ -57312,12 +57946,13 @@ var ts; return links.type; } function getWriteTypeOfAccessors(symbol) { + var _a; var links = getSymbolLinks(symbol); if (!links.writeType) { if (!pushTypeResolution(symbol, 8 /* TypeSystemPropertyName.WriteType */)) { return errorType; } - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var setter = (_a = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */)) !== null && _a !== void 0 ? _a : ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); var writeType = getAnnotatedAccessorType(setter); if (!popTypeResolution()) { if (getAnnotatedAccessorTypeNode(setter)) { @@ -57357,9 +57992,9 @@ var ts; if (symbol.flags & 1536 /* SymbolFlags.Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) { return anyType; } - else if (declaration && (declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || + else if (declaration && (declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || ts.isAccessExpression(declaration) && - declaration.parent.kind === 221 /* SyntaxKind.BinaryExpression */)) { + declaration.parent.kind === 223 /* SyntaxKind.BinaryExpression */)) { return getWidenedTypeForAssignmentDeclaration(symbol); } else if (symbol.flags & 512 /* SymbolFlags.ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) { @@ -57369,11 +58004,11 @@ var ts; return errorType; } var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* InternalSymbolName.ExportEquals */)); - var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); + var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); if (!popTypeResolution()) { return reportCircularityError(symbol); } - return type_3; + return type_2; } } var type = createObjectType(16 /* ObjectFlags.Anonymous */, symbol); @@ -57403,7 +58038,7 @@ var ts; links.type = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol.declarations) ? autoType : declaredType ? declaredType - : targetSymbol.flags & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol) + : getAllSymbolFlags(targetSymbol) & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol) : errorType; } return links.type; @@ -57424,7 +58059,7 @@ var ts; return errorType; } // Check if variable has initializer that circularly references the variable itself - if (noImplicitAny && (declaration.kind !== 164 /* SyntaxKind.Parameter */ || declaration.initializer)) { + if (noImplicitAny && (declaration.kind !== 166 /* SyntaxKind.Parameter */ || declaration.initializer)) { error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); } // Circularities could also result from parameters in function expressions that end up @@ -57556,46 +58191,46 @@ var ts; return undefined; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 195 /* SyntaxKind.MappedType */: - case 189 /* SyntaxKind.ConditionalType */: { + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 197 /* SyntaxKind.MappedType */: + case 191 /* SyntaxKind.ConditionalType */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); - if (node.kind === 195 /* SyntaxKind.MappedType */) { + if (node.kind === 197 /* SyntaxKind.MappedType */) { return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))); } - else if (node.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (node.kind === 191 /* SyntaxKind.ConditionalType */) { return ts.concatenate(outerTypeParameters, getInferTypeParameters(node)); } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node)); var thisType = includeThisTypes && - (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && + (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var paramSymbol = ts.getParameterSymbolFromJSDoc(node); if (paramSymbol) { node = paramSymbol.valueDeclaration; } break; - case 320 /* SyntaxKind.JSDoc */: { + case 323 /* SyntaxKind.JSDoc */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); return node.tags ? appendTypeParameters(outerTypeParameters, ts.flatMap(node.tags, function (t) { return ts.isJSDocTemplateTag(t) ? t.typeParameters : undefined; })) @@ -57606,7 +58241,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); ts.Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations"); return getOuterTypeParameters(declaration); } @@ -57619,9 +58254,9 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || - node.kind === 226 /* SyntaxKind.ClassExpression */ || + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || + node.kind === 228 /* SyntaxKind.ClassExpression */ || isJSConstructor(node) || ts.isTypeAlias(node)) { var declaration = node; @@ -57773,7 +58408,7 @@ var ts; if (!popTypeResolution() && type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { reportCircularBaseType(declaration, type); } } @@ -57869,7 +58504,7 @@ var ts; if (type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getReducedType(getTypeFromTypeNode(node)); @@ -57909,7 +58544,7 @@ var ts; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (declaration.flags & 128 /* NodeFlags.ContainsThis */) { return false; } @@ -57988,7 +58623,7 @@ var ts; } else { type = errorType; - if (declaration.kind === 339 /* SyntaxKind.JSDocEnumTag */) { + if (declaration.kind === 342 /* SyntaxKind.JSDocEnumTag */) { error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } else { @@ -58003,7 +58638,7 @@ var ts; if (ts.isStringLiteralLike(expr)) { return true; } - else if (expr.kind === 221 /* SyntaxKind.BinaryExpression */) { + else if (expr.kind === 223 /* SyntaxKind.BinaryExpression */) { return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right); } return false; @@ -58018,12 +58653,12 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; case 79 /* SyntaxKind.Identifier */: return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isStringConcatExpression(expr); default: return false; @@ -58038,7 +58673,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && ts.isStringLiteralLike(member.initializer)) { @@ -58067,7 +58702,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var value = getEnumMemberValue(member); @@ -58140,22 +58775,22 @@ var ts; */ function isThislessType(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 196 /* SyntaxKind.LiteralType */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 198 /* SyntaxKind.LiteralType */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isThislessType(node.elementType); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return !node.typeArguments || node.typeArguments.every(isThislessType); } return false; @@ -58181,7 +58816,7 @@ var ts; function isThislessFunctionLikeDeclaration(node) { var returnType = ts.getEffectiveReturnTypeNode(node); var typeParameters = ts.getEffectiveTypeParameterDeclarations(node); - return (node.kind === 171 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && + return (node.kind === 173 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); } @@ -58197,14 +58832,14 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return isThislessVariableLikeDeclaration(declaration); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return isThislessFunctionLikeDeclaration(declaration); } } @@ -58415,8 +59050,10 @@ var ts; if (members) { for (var _b = 0, members_5 = members; _b < members_5.length; _b++) { var member = members_5[_b]; - if (isStatic_1 === ts.hasStaticModifier(member) && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === ts.hasStaticModifier(member)) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58431,8 +59068,10 @@ var ts; || ts.isBinaryExpression(member) && isPossiblyAliasedThisProperty(member, assignmentKind) || assignmentKind === 9 /* AssignmentDeclarationKind.ObjectDefinePrototypeProperty */ || assignmentKind === 6 /* AssignmentDeclarationKind.Prototype */; // A straight `Prototype` assignment probably can never have a computed name - if (isStatic_1 === !isInstanceMember && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === !isInstanceMember) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58619,7 +59258,7 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); var declaration = ts.getClassLikeDeclarationOfSymbol(classType.symbol); - var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); if (baseSignatures.length === 0) { return [createSignature(undefined, classType.localTypeParameters, undefined, ts.emptyArray, classType, /*resolvedTypePredicate*/ undefined, 0, isAbstract ? 4 /* SignatureFlags.Abstract */ : 0 /* SignatureFlags.None */)]; } @@ -59241,8 +59880,8 @@ var ts; } function isMappedTypeWithKeyofConstraintDeclaration(type) { var constraintDeclaration = getConstraintDeclarationForMappedType(type); // TODO: GH#18217 - return constraintDeclaration.kind === 193 /* SyntaxKind.TypeOperator */ && - constraintDeclaration.operator === 140 /* SyntaxKind.KeyOfKeyword */; + return constraintDeclaration.kind === 195 /* SyntaxKind.TypeOperator */ && + constraintDeclaration.operator === 141 /* SyntaxKind.KeyOfKeyword */; } function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { @@ -59282,7 +59921,20 @@ var ts; return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(type) & 4 /* MappedTypeModifiers.IncludeOptional */); } function isGenericMappedType(type) { - return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) && isGenericIndexType(getConstraintTypeFromMappedType(type)); + if (ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) { + var constraint = getConstraintTypeFromMappedType(type); + if (isGenericIndexType(constraint)) { + return true; + } + // A mapped type is generic if the 'as' clause references generic types other than the iteration type. + // To determine this, we substitute the constraint type (that we now know isn't generic) for the iteration + // type and check whether the resulting type is generic. + var nameType = getNameTypeFromMappedType(type); + if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) { + return true; + } + } + return false; } function resolveStructuredTypeMembers(type) { if (!type.members) { @@ -59602,10 +60254,10 @@ var ts; var baseTypes = []; var different = false; for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type_4 = types_7[_i]; - var baseType = getBaseConstraint(type_4); + var type_3 = types_7[_i]; + var baseType = getBaseConstraint(type_3); if (baseType) { - if (baseType !== type_4) { + if (baseType !== type_3) { different = true; } baseTypes.push(baseType); @@ -59649,7 +60301,7 @@ var ts; return constraint && getBaseConstraint(constraint); } if (t.flags & 33554432 /* TypeFlags.Substitution */) { - return getBaseConstraint(t.substitute); + return getBaseConstraint(getSubstitutionIntersection(t)); } return t; } @@ -59752,7 +60404,7 @@ var ts; var indexTypes; var isUnion = containingType.flags & 1048576 /* TypeFlags.Union */; // Flags we want to propagate to the result if they exist in all source symbols - var optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */; + var optionalFlag; var syntheticFlag = 4 /* CheckFlags.SyntheticMethod */; var checkFlags = isUnion ? 0 : 8 /* CheckFlags.Readonly */; var mergedInstantiations = false; @@ -59763,11 +60415,14 @@ var ts; var prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment); var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0; if (prop) { - if (isUnion) { - optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */); - } - else { - optionalFlag &= prop.flags; + if (prop.flags & 106500 /* SymbolFlags.ClassMember */) { + optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : (optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */); + if (isUnion) { + optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */); + } + else { + optionalFlag &= prop.flags; + } } if (!singleProp) { singleProp = prop; @@ -59776,7 +60431,7 @@ var ts; var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp); // If the symbols are instances of one another with identical types - consider the symbols // equivalent and just use the first one, which thus allows us to avoid eliding private - // members when intersecting a (this-)instantiations of a class with it's raw base or another instance + // members when intersecting a (this-)instantiations of a class with its raw base or another instance if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) { // If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used // to do when we recorded multiple distinct symbols so that we still get, eg, `Array.length` printed @@ -59824,7 +60479,11 @@ var ts; } } } - if (!singleProp || isUnion && (propSet || checkFlags & 48 /* CheckFlags.Partial */) && checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */)) { + if (!singleProp || + isUnion && + (propSet || checkFlags & 48 /* CheckFlags.Partial */) && + checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */) && + !(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) { // No property was found, or, in a union, a property has a private or protected declaration in one // constituent, but is missing or has a different declaration in another constituent. return undefined; @@ -59882,7 +60541,7 @@ var ts; propTypes.push(type); } ts.addRange(propTypes, indexTypes); - var result = createSymbol(4 /* SymbolFlags.Property */ | optionalFlag, name, syntheticFlag | checkFlags); + var result = createSymbol(4 /* SymbolFlags.Property */ | (optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : 0), name, syntheticFlag | checkFlags); result.containingType = containingType; if (!hasNonUniformValueDeclaration && firstValueDeclaration) { result.valueDeclaration = firstValueDeclaration; @@ -59926,6 +60585,33 @@ var ts; } return property; } + function getCommonDeclarationsOfSymbols(symbols) { + var commonDeclarations; + var _loop_14 = function (symbol) { + if (!symbol.declarations) { + return { value: undefined }; + } + if (!commonDeclarations) { + commonDeclarations = new ts.Set(symbol.declarations); + return "continue"; + } + commonDeclarations.forEach(function (declaration) { + if (!ts.contains(symbol.declarations, declaration)) { + commonDeclarations.delete(declaration); + } + }); + if (commonDeclarations.size === 0) { + return { value: undefined }; + } + }; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var symbol = symbols_3[_i]; + var state_4 = _loop_14(symbol); + if (typeof state_4 === "object") + return state_4.value; + } + return commonDeclarations; + } function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) { var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment); // We need to filter out partial properties in union types @@ -60129,10 +60815,10 @@ var ts; function isJSDocOptionalParameter(node) { return ts.isInJSFile(node) && ( // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType - node.type && node.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ + node.type && node.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -60165,14 +60851,14 @@ var ts; return false; } function isOptionalPropertyDeclaration(node) { - return ts.isPropertyDeclaration(node) && node.questionToken; + return ts.isPropertyDeclaration(node) && !ts.hasAccessorModifier(node) && node.questionToken; } function isOptionalJSDocPropertyLikeTag(node) { if (!ts.isJSDocPropertyLikeTag(node)) { return false; } var isBracketed = node.isBracketed, typeExpression = node.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; } function createTypePredicate(kind, parameterName, parameterIndex, type) { return { kind: kind, parameterName: parameterName, parameterIndex: parameterIndex, type: type }; @@ -60254,7 +60940,7 @@ var ts; else { parameters.push(paramSymbol); } - if (type && type.kind === 196 /* SyntaxKind.LiteralType */) { + if (type && type.kind === 198 /* SyntaxKind.LiteralType */) { flags |= 2 /* SignatureFlags.HasLiteralTypes */; } // Record a new minimum argument count if this is not an optional parameter @@ -60267,24 +60953,24 @@ var ts; } } // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation - if ((declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) && + if ((declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) && hasBindableName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + var otherKind = declaration.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - var classType = declaration.kind === 171 /* SyntaxKind.Constructor */ ? + var classType = declaration.kind === 173 /* SyntaxKind.Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration); if (ts.hasRestParameter(declaration) || ts.isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) { flags |= 1 /* SignatureFlags.HasRestParameter */; } - if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */) || - ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 128 /* ModifierFlags.Abstract */)) { + if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */) || + ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 256 /* ModifierFlags.Abstract */)) { flags |= 4 /* SignatureFlags.Abstract */; } links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, @@ -60363,16 +61049,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node.escapedText === argumentsSymbol.escapedName && getReferencedValueSymbol(node) === argumentsSymbol; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && traverse(node.name); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return traverse(node.expression); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return traverse(node.initializer); default: return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse); @@ -60396,7 +61082,12 @@ var ts; continue; } } - result.push(getSignatureFromDeclaration(decl)); + // If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters. + // Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would supress checks that the two are compatible. + result.push((!ts.isFunctionExpressionOrArrowFunction(decl) && + !ts.isObjectLiteralMethod(decl) && + getSignatureOfTypeTag(decl)) || + getSignatureFromDeclaration(decl)); } return result; } @@ -60427,7 +61118,7 @@ var ts; else { var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration); var jsdocPredicate = void 0; - if (!type && ts.isInJSFile(signature.declaration)) { + if (!type) { var jsdocSignature = getSignatureOfTypeTag(signature.declaration); if (jsdocSignature && signature !== jsdocSignature) { jsdocPredicate = getTypePredicateOfSignature(jsdocSignature); @@ -60444,7 +61135,7 @@ var ts; function createTypePredicateFromTypePredicateNode(node, signature) { var parameterName = node.parameterName; var type = node.type && getTypeFromTypeNode(node.type); - return parameterName.kind === 192 /* SyntaxKind.ThisType */ ? + return parameterName.kind === 194 /* SyntaxKind.ThisType */ ? createTypePredicate(node.assertsModifier ? 2 /* TypePredicateKind.AssertsThis */ : 0 /* TypePredicateKind.This */, /*parameterName*/ undefined, /*parameterIndex*/ undefined, type) : createTypePredicate(node.assertsModifier ? 3 /* TypePredicateKind.AssertsIdentifier */ : 1 /* TypePredicateKind.Identifier */, parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type); } @@ -60490,7 +61181,7 @@ var ts; return signature.resolvedReturnType; } function getReturnTypeFromAnnotation(declaration) { - if (declaration.kind === 171 /* SyntaxKind.Constructor */) { + if (declaration.kind === 173 /* SyntaxKind.Constructor */) { return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)); } if (ts.isJSDocConstructSignature(declaration)) { @@ -60500,12 +61191,12 @@ var ts; if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration); if (jsDocType) { return jsDocType; } - var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 173 /* SyntaxKind.SetAccessor */); + var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 175 /* SyntaxKind.SetAccessor */); var setterType = getAnnotatedAccessorType(setter); if (setterType) { return setterType; @@ -60608,7 +61299,7 @@ var ts; if (!signature.isolatedSignatureType) { var kind = (_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind; // If declaration is undefined, it is likely to be the signature of the default constructor. - var isConstructor = kind === undefined || kind === 171 /* SyntaxKind.Constructor */ || kind === 175 /* SyntaxKind.ConstructSignature */ || kind === 180 /* SyntaxKind.ConstructorType */; + var isConstructor = kind === undefined || kind === 173 /* SyntaxKind.Constructor */ || kind === 177 /* SyntaxKind.ConstructSignature */ || kind === 182 /* SyntaxKind.ConstructorType */; var type = createObjectType(16 /* ObjectFlags.Anonymous */); type.members = emptySymbols; type.properties = ts.emptyArray; @@ -60635,7 +61326,7 @@ var ts; function getIndexInfosOfIndexSymbol(indexSymbol) { if (indexSymbol.declarations) { var indexInfos_4 = []; - var _loop_14 = function (declaration) { + var _loop_15 = function (declaration) { if (declaration.parameters.length === 1) { var parameter = declaration.parameters[0]; if (parameter.type) { @@ -60649,7 +61340,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_14(declaration); + _loop_15(declaration); } return indexInfos_4; } @@ -60666,14 +61357,14 @@ var ts; var _a; var inferences; if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) { - var _loop_15 = function (declaration) { - if (declaration.parent.kind === 190 /* SyntaxKind.InferType */) { + var _loop_16 = function (declaration) { + if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) { // When an 'infer T' declaration is immediately contained in a type reference node // (such as 'Foo'), T's constraint is inferred from the constraint of the // corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are // present, we form an intersection of the inferred constraint types. var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1]; - if (grandParent.kind === 178 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { + if (grandParent.kind === 180 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { var typeReference_1 = grandParent; var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1); if (typeParameters_1) { @@ -60700,27 +61391,27 @@ var ts; } // When an 'infer T' declaration is immediately contained in a rest parameter declaration, a rest type // or a named rest tuple element, we infer an 'unknown[]' constraint. - else if (grandParent.kind === 164 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || - grandParent.kind === 186 /* SyntaxKind.RestType */ || - grandParent.kind === 197 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { + else if (grandParent.kind === 166 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || + grandParent.kind === 188 /* SyntaxKind.RestType */ || + grandParent.kind === 199 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { inferences = ts.append(inferences, createArrayType(unknownType)); } // When an 'infer T' declaration is immediately contained in a string template type, we infer a 'string' // constraint. - else if (grandParent.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */) { + else if (grandParent.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */) { inferences = ts.append(inferences, stringType); } // When an 'infer T' declaration is in the constraint position of a mapped type, we infer a 'keyof any' // constraint. - else if (grandParent.kind === 163 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 195 /* SyntaxKind.MappedType */) { + else if (grandParent.kind === 165 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 197 /* SyntaxKind.MappedType */) { inferences = ts.append(inferences, keyofConstraintType); } // When an 'infer T' declaration is the template of a mapped type, and that mapped type is the extends // clause of a conditional whose check type is also a mapped type, give it a constraint equal to the template // of the check type's mapped type - else if (grandParent.kind === 195 /* SyntaxKind.MappedType */ && grandParent.type && - ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 189 /* SyntaxKind.ConditionalType */ && - grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 195 /* SyntaxKind.MappedType */ && + else if (grandParent.kind === 197 /* SyntaxKind.MappedType */ && grandParent.type && + ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 191 /* SyntaxKind.ConditionalType */ && + grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 197 /* SyntaxKind.MappedType */ && grandParent.parent.checkType.type) { var checkMappedType_1 = grandParent.parent.checkType; var nodeType = getTypeFromTypeNode(checkMappedType_1.type); @@ -60730,7 +61421,7 @@ var ts; }; for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - _loop_15(declaration); + _loop_16(declaration); } } return inferences && getIntersectionType(inferences); @@ -60752,7 +61443,7 @@ var ts; if (type.flags & 1 /* TypeFlags.Any */ && !isErrorType(type)) { // Allow errorType to propegate to keep downstream errors suppressed // use keyofConstraintType as the base constraint for mapped type key constraints (unknown isn;t assignable to that, but `any` was), // use unknown otherwise - type = constraintDeclaration.parent.parent.kind === 195 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; + type = constraintDeclaration.parent.parent.kind === 197 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; } typeParameter.constraint = type; } @@ -60761,7 +61452,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - var tp = ts.getDeclarationOfKind(typeParameter.symbol, 163 /* SyntaxKind.TypeParameter */); + var tp = ts.getDeclarationOfKind(typeParameter.symbol, 165 /* SyntaxKind.TypeParameter */); var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getEffectiveContainerForJSDocTemplateTag(tp.parent) : tp.parent; return host && getSymbolOfNode(host); } @@ -60847,8 +61538,8 @@ var ts; } var node = type.node; var typeArguments = !node ? ts.emptyArray : - node.kind === 178 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : - node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : + node.kind === 180 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : + node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); if (popTypeResolution()) { type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments; @@ -60890,7 +61581,7 @@ var ts; return errorType; } } - if (node.kind === 178 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { return createDeferredTypeReference(type, node, /*mapper*/ undefined); } // In a type reference, the outer type parameters of the referenced class or interface are automatically @@ -60961,9 +61652,9 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -60978,13 +61669,13 @@ var ts; return symbol.parent ? "".concat(getSymbolPath(symbol.parent), ".").concat(symbol.escapedName) : symbol.escapedName; } function getUnresolvedSymbolForEntityName(name) { - var identifier = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? name.name : + var identifier = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? name.name : name; var text = identifier.escapedText; if (text) { - var parentSymbol = name.kind === 161 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : + var parentSymbol = name.kind === 163 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : undefined; var path = parentSymbol ? "".concat(getSymbolPath(parentSymbol), ".").concat(text) : text; var result = unresolvedSymbols.get(path); @@ -61045,7 +61736,7 @@ var ts; var valueType = getTypeOfSymbol(symbol); var typeType = valueType; if (symbol.valueDeclaration) { - var isImportTypeWithQualifier = node.kind === 200 /* SyntaxKind.ImportType */ && node.qualifier; + var isImportTypeWithQualifier = node.kind === 202 /* SyntaxKind.ImportType */ && node.qualifier; // valueType might not have a symbol, eg, {import('./b').STRING_LITERAL} if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) { typeType = getTypeReferenceType(node, valueType.symbol); @@ -61055,23 +61746,27 @@ var ts; } return links.resolvedJSDocType; } - function getSubstitutionType(baseType, substitute) { - if (substitute.flags & 3 /* TypeFlags.AnyOrUnknown */ || substitute === baseType) { + function getSubstitutionType(baseType, constraint) { + if (constraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || constraint === baseType || + !isGenericType(baseType) && !isGenericType(constraint)) { return baseType; } - var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(substitute)); + var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(constraint)); var cached = substitutionTypes.get(id); if (cached) { return cached; } var result = createType(33554432 /* TypeFlags.Substitution */); result.baseType = baseType; - result.substitute = substitute; + result.constraint = constraint; substitutionTypes.set(id, result); return result; } + function getSubstitutionIntersection(substitutionType) { + return getIntersectionType([substitutionType.constraint, substitutionType.baseType]); + } function isUnaryTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 1; + return node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 1; } function getImpliedConstraint(type, checkNode, extendsNode) { return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) : @@ -61081,16 +61776,16 @@ var ts; function getConditionalFlowTypeOfType(type, node) { var constraints; var covariant = true; - while (node && !ts.isStatement(node) && node.kind !== 320 /* SyntaxKind.JSDoc */) { + while (node && !ts.isStatement(node) && node.kind !== 323 /* SyntaxKind.JSDoc */) { var parent = node.parent; // only consider variance flipped by parameter locations - `keyof` types would usually be considered variance inverting, but // often get used in indexed accesses where they behave sortof invariantly, but our checking is lax - if (parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 166 /* SyntaxKind.Parameter */) { covariant = !covariant; } // Always substitute on type parameters, regardless of variance, since even // in contravariant positions, they may rely on substituted constraints to be valid - if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 189 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { + if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 191 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { var constraint = getImpliedConstraint(type, parent.checkType, parent.extendsType); if (constraint) { constraints = ts.append(constraints, constraint); @@ -61098,7 +61793,7 @@ var ts; } // Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the // template type XXX, K has an added constraint of number | `${number}`. - else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 195 /* SyntaxKind.MappedType */ && node === parent.type) { + else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 197 /* SyntaxKind.MappedType */ && node === parent.type) { var mappedType = getTypeFromTypeNode(parent); if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { var typeParameter = getHomomorphicTypeVariable(mappedType); @@ -61112,10 +61807,10 @@ var ts; } node = parent; } - return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type; + return constraints ? getSubstitutionType(type, getIntersectionType(constraints)) : type; } function isJSDocTypeReference(node) { - return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 200 /* SyntaxKind.ImportType */); + return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 202 /* SyntaxKind.ImportType */); } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { @@ -61230,9 +61925,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declaration; } } @@ -61383,6 +62078,13 @@ var ts; function getGlobalBigIntType() { return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType; } + function getGlobalNaNSymbol() { + return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false))); + } + function getGlobalRecordSymbol() { + deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol); + return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol; + } /** * Instantiates a global type that is generic with some element type, and returns that instantiation. */ @@ -61400,11 +62102,11 @@ var ts; } function getTupleElementFlags(node) { switch (node.kind) { - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return 2 /* ElementFlags.Optional */; - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getRestTypeElementFlags(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return node.questionToken ? 2 /* ElementFlags.Optional */ : node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* ElementFlags.Required */; @@ -61422,14 +62124,14 @@ var ts; return readonly ? globalReadonlyArrayType : globalArrayType; } var elementFlags = ts.map(node.elements, getTupleElementFlags); - var missingName = ts.some(node.elements, function (e) { return e.kind !== 197 /* SyntaxKind.NamedTupleMember */; }); + var missingName = ts.some(node.elements, function (e) { return e.kind !== 199 /* SyntaxKind.NamedTupleMember */; }); return getTupleTargetType(elementFlags, readonly, /*associatedNames*/ missingName ? undefined : node.elements); } // Return true if the given type reference node is directly aliased or if it needs to be deferred // because it is possibly contained in a circular chain of eagerly resolved types. function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) { - return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 183 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : - node.kind === 184 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : + return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 185 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : + node.kind === 186 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || ts.some(node.typeArguments, mayResolveTypeAlias)); } // Return true when the given node is transitively contained in type constructs that eagerly @@ -61438,18 +62140,18 @@ var ts; function isResolvedByTypeAlias(node) { var parent = node.parent; switch (parent.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 189 /* SyntaxKind.ConditionalType */: - case 193 /* SyntaxKind.TypeOperator */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 191 /* SyntaxKind.ConditionalType */: + case 195 /* SyntaxKind.TypeOperator */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return isResolvedByTypeAlias(parent); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } return false; @@ -61458,28 +62160,28 @@ var ts; // of a type alias. function mayResolveTypeAlias(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */).flags & 524288 /* SymbolFlags.TypeAlias */); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return true; - case 193 /* SyntaxKind.TypeOperator */: - return node.operator !== 154 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 195 /* SyntaxKind.TypeOperator */: + return node.operator !== 156 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 319 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return mayResolveTypeAlias(node.type); - case 186 /* SyntaxKind.RestType */: - return node.type.kind !== 183 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 188 /* SyntaxKind.RestType */: + return node.type.kind !== 185 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return ts.some(node.types, mayResolveTypeAlias); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return mayResolveTypeAlias(node.checkType) || mayResolveTypeAlias(node.extendsType) || mayResolveTypeAlias(node.trueType) || mayResolveTypeAlias(node.falseType); } @@ -61492,19 +62194,19 @@ var ts; if (target === emptyGenericType) { links.resolvedType = emptyObjectType; } - else if (!(node.kind === 184 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { - links.resolvedType = node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : + else if (!(node.kind === 186 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { + links.resolvedType = node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : createDeferredTypeReference(target, node, /*mapper*/ undefined); } else { - var elementTypes = node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); + var elementTypes = node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); links.resolvedType = createNormalizedTypeReference(target, elementTypes); } } return links.resolvedType; } function isReadonlyTypeOperator(node) { - return ts.isTypeOperatorNode(node) && node.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + return ts.isTypeOperatorNode(node) && node.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } function createTupleType(elementTypes, elementFlags, readonly, namedMemberDeclarations) { if (readonly === void 0) { readonly = false; } @@ -61619,7 +62321,7 @@ var ts; var lastRequiredIndex = -1; var firstRestIndex = -1; var lastOptionalOrRestIndex = -1; - var _loop_16 = function (i) { + var _loop_17 = function (i) { var type = elementTypes[i]; var flags = target.elementFlags[i]; if (flags & 8 /* ElementFlags.Variadic */) { @@ -61649,9 +62351,9 @@ var ts; } }; for (var i = 0; i < elementTypes.length; i++) { - var state_4 = _loop_16(i); - if (typeof state_4 === "object") - return state_4.value; + var state_5 = _loop_17(i); + if (typeof state_5 === "object") + return state_5.value; } // Turn optional elements preceding the last required element into required elements for (var i = 0; i < lastRequiredIndex; i++) { @@ -61679,7 +62381,7 @@ var ts; if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) { lastOptionalOrRestIndex = expandedFlags.length; } - expandedTypes.push(type); + expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type); expandedFlags.push(flags); if (expandedDeclarations && declaration) { expandedDeclarations.push(declaration); @@ -61845,7 +62547,7 @@ var ts; var templates = ts.filter(types, isPatternLiteralType); if (templates.length) { var i = types.length; - var _loop_17 = function () { + var _loop_18 = function () { i--; var t = types[i]; if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) { @@ -61853,7 +62555,7 @@ var ts; } }; while (i > 0) { - _loop_17(); + _loop_18(); } } } @@ -61930,14 +62632,14 @@ var ts; var namedUnions = []; addNamedUnions(namedUnions, types); var reducedTypes = []; - var _loop_18 = function (t) { + var _loop_19 = function (t) { if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) { reducedTypes.push(t); } }; for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) { var t = typeSet_1[_i]; - _loop_18(t); + _loop_19(t); } if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) { return namedUnions[0]; @@ -62427,7 +63129,7 @@ var ts; type.flags & 16777216 /* TypeFlags.Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* TypeFlags.UnionOrIntersection */ | 134217728 /* TypeFlags.TemplateLiteral */) ? ts.every(type.types, isDistributive) : type.flags & 8388608 /* TypeFlags.IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.substitute) : + type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* TypeFlags.StringMapping */ ? isDistributive(type.type) : false; } @@ -62508,15 +63210,15 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { switch (node.operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); break; - case 154 /* SyntaxKind.UniqueKeyword */: - links.resolvedType = node.type.kind === 151 /* SyntaxKind.SymbolKeyword */ + case 156 /* SyntaxKind.UniqueKeyword */: + links.resolvedType = node.type.kind === 153 /* SyntaxKind.SymbolKeyword */ ? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent)) : errorType; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: links.resolvedType = getTypeFromTypeNode(node.type); break; default: @@ -62552,8 +63254,14 @@ var ts; return getStringLiteralType(text); } newTexts.push(text); - if (ts.every(newTexts, function (t) { return t === ""; }) && ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) { - return stringType; + if (ts.every(newTexts, function (t) { return t === ""; })) { + if (ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) { + return stringType; + } + // Normalize `${Mapping}` into Mapping + if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) { + return newTypes[0]; + } } var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join("")); var type = templateLiteralTypes.get(id); @@ -62612,12 +63320,14 @@ var ts; } function getStringMappingType(symbol, type) { return type.flags & (1048576 /* TypeFlags.Union */ | 131072 /* TypeFlags.Never */) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) : - // Mapping> === Mapping - type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type : - isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456 /* TypeFlags.StringMapping */) ? getTemplateLiteralType(["", ""], [type]) : type) : - type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : - type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) : - type; + type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : + type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) : + // Mapping> === Mapping + type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type : + type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 268435456 /* TypeFlags.StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : + // This handles Mapping<`${number}`> and Mapping<`${bigint}`> + isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) : + type; } function applyStringMapping(symbol, str) { switch (intrinsicTypeKinds.get(symbol.escapedName)) { @@ -62708,7 +63418,7 @@ var ts; } function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, accessNode, accessFlags) { var _a; - var accessExpression = accessNode && accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; var propName = accessNode && ts.isPrivateIdentifier(accessNode) ? undefined : getPropertyNameFromIndex(indexType, accessNode); if (propName !== undefined) { if (accessFlags & 256 /* AccessFlags.Contextual */) { @@ -62782,7 +63492,18 @@ var ts; return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; } errorIfWritingToReadonlyIndex(indexInfo); - return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; + // When accessing an enum object with its own type, + // e.g. E[E.A] for enum E { A }, undefined shouldn't + // be included in the result type + if ((accessFlags & 1 /* AccessFlags.IncludeUndefined */) && + !(objectType.symbol && + objectType.symbol.flags & (256 /* SymbolFlags.RegularEnum */ | 128 /* SymbolFlags.ConstEnum */) && + (indexType.symbol && + indexType.flags & 1024 /* TypeFlags.EnumLiteral */ && + getParentOfSymbol(indexType.symbol) === objectType.symbol))) { + return getUnionType([indexInfo.type, undefinedType]); + } + return indexInfo.type; } if (indexType.flags & 131072 /* TypeFlags.Never */) { return neverType; @@ -62879,16 +63600,17 @@ var ts; } } function getIndexNodeForAccessExpression(accessNode) { - return accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : - accessNode.kind === 194 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : - accessNode.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : + return accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : + accessNode.kind === 196 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : + accessNode.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : accessNode; } function isPatternLiteralPlaceholderType(type) { - return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || !!(type.flags & 268435456 /* TypeFlags.StringMapping */ && isPatternLiteralPlaceholderType(type.type)); + return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || isPatternLiteralType(type); } function isPatternLiteralType(type) { - return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType); + return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType) || + !!(type.flags & 268435456 /* TypeFlags.StringMapping */) && isPatternLiteralPlaceholderType(type.type); } function isGenericType(type) { return !!getGenericObjectFlags(type); @@ -62910,7 +63632,7 @@ var ts; if (type.flags & 33554432 /* TypeFlags.Substitution */) { if (!(type.objectFlags & 2097152 /* ObjectFlags.IsGenericTypeComputed */)) { type.objectFlags |= 2097152 /* ObjectFlags.IsGenericTypeComputed */ | - getGenericObjectFlags(type.substitute) | getGenericObjectFlags(type.baseType); + getGenericObjectFlags(type.baseType) | getGenericObjectFlags(type.constraint); } return type.objectFlags & 12582912 /* ObjectFlags.IsGenericType */; } @@ -63061,7 +63783,7 @@ var ts; // for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved // eagerly using the constraint type of 'this' at the given location. - if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 194 /* SyntaxKind.IndexedAccessType */ ? + if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 196 /* SyntaxKind.IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) { if (objectType.flags & 3 /* TypeFlags.AnyOrUnknown */) { @@ -63113,11 +63835,7 @@ var ts; var objectType = getTypeFromTypeNode(node.objectType); var indexType = getTypeFromTypeNode(node.indexType); var potentialAlias = getAliasSymbolForTypeNode(node); - var resolved = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); - links.resolvedType = resolved.flags & 8388608 /* TypeFlags.IndexedAccess */ && - resolved.objectType === objectType && - resolved.indexType === indexType ? - getConditionalFlowTypeOfType(resolved, node) : resolved; + links.resolvedType = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); } return links.resolvedType; } @@ -63171,18 +63889,23 @@ var ts; var result; var extraTypes; var tailCount = 0; - var _loop_19 = function () { + // We loop here for an immediately nested conditional type in the false position, effectively treating + // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for + // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of + // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive + // cases we increment the tail recursion counter and stop after 1000 iterations. + while (true) { if (tailCount === 1000) { error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); result = errorType; - return "break"; + break; } var isUnwrapped = isTypicalNondistributiveConditional(root); var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper); var checkTypeInstantiable = isGenericType(checkType); var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper); if (checkType === wildcardType || extendsType === wildcardType) { - return { value: wildcardType }; + return wildcardType; } var combinedMapper = void 0; if (root.inferTypeParameters) { @@ -63215,11 +63938,7 @@ var ts; } } } - // We skip inference of the possible `infer` types unles the `extendsType` _is_ an infer type - // if it was, it's trivial to say that extendsType = checkType, however such a pattern is used to - // "reset" the type being build up during constraint calculation and avoid making an apparently "infinite" constraint - // so in those cases we refain from performing inference and retain the uninfered type parameter - if (!checkTypeInstantiable || !ts.some(root.inferTypeParameters, function (t) { return t === extendsType; })) { + if (!checkTypeInstantiable) { // We don't want inferences from constraints as they may cause us to eagerly resolve the // conditional type instead of deferring resolution. Also, we always want strict function // types rules (i.e. proper contravariance) for inferences. @@ -63251,14 +63970,14 @@ var ts; var newRoot = falseType_1.root; if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) { root = newRoot; - return "continue"; + continue; } if (canTailRecurse(falseType_1, mapper)) { - return "continue"; + continue; } } result = instantiateType(falseType_1, mapper); - return "break"; + break; } // Return trueType for a definitely true extends check. We check instantiations of the two // types with type parameters mapped to their restrictive form, i.e. a form of the type parameter @@ -63269,10 +63988,10 @@ var ts; var trueType_1 = getTypeFromTypeNode(root.node.trueType); var trueMapper = combinedMapper || mapper; if (canTailRecurse(trueType_1, trueMapper)) { - return "continue"; + continue; } result = instantiateType(trueType_1, trueMapper); - return "break"; + break; } } // Return a deferred type for a check that is neither definitely true nor definitely false @@ -63284,19 +64003,7 @@ var ts; result.combinedMapper = combinedMapper; result.aliasSymbol = aliasSymbol || root.aliasSymbol; result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217 - return "break"; - }; - // We loop here for an immediately nested conditional type in the false position, effectively treating - // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for - // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of - // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive - // cases we increment the tail recursion counter and stop after 1000 iterations. - while (true) { - var state_5 = _loop_19(); - if (typeof state_5 === "object") - return state_5.value; - if (state_5 === "break") - break; + break; } return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result; // We tail-recurse for generic conditional types that (a) have not already been evaluated and cached, and @@ -63488,7 +64195,7 @@ var ts; } function getAliasSymbolForTypeNode(node) { var host = node.parent; - while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { host = host.parent; } return ts.isTypeAlias(host) ? getSymbolOfNode(host) : undefined; @@ -63733,7 +64440,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */)) { if (!ts.isStatic(container) && (!ts.isConstructorDeclaration(container) || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -63768,17 +64475,17 @@ var ts; } function getArrayElementTypeNode(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return getArrayElementTypeNode(node.type); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: if (node.elements.length === 1) { node = node.elements[0]; - if (node.kind === 186 /* SyntaxKind.RestType */ || node.kind === 197 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { + if (node.kind === 188 /* SyntaxKind.RestType */ || node.kind === 199 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { return getArrayElementTypeNode(node.type); } } break; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return node.elementType; } return undefined; @@ -63794,99 +64501,99 @@ var ts; } function getTypeFromTypeNodeWorker(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 131 /* SyntaxKind.AnyKeyword */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return anyType; - case 155 /* SyntaxKind.UnknownKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return unknownType; - case 150 /* SyntaxKind.StringKeyword */: + case 152 /* SyntaxKind.StringKeyword */: return stringType; - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return numberType; - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return bigintType; - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return booleanType; - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return esSymbolType; case 114 /* SyntaxKind.VoidKeyword */: return voidType; - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return undefinedType; case 104 /* SyntaxKind.NullKeyword */: // TODO(rbuckton): `NullKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service. return nullType; - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return neverType; - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return node.flags & 262144 /* NodeFlags.JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType; - case 138 /* SyntaxKind.IntrinsicKeyword */: + case 139 /* SyntaxKind.IntrinsicKeyword */: return intrinsicMarkerType; - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: // TODO(rbuckton): `ThisKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service and because of `isPartOfTypeNode`. return getTypeFromThisTypeNode(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return getTypeFromLiteralTypeNode(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getTypeFromTypeReference(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? voidType : booleanType; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return getTypeFromTypeQueryNode(node); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return getTypeFromArrayOrTupleTypeNode(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return getTypeFromOptionalTypeNode(node); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return getTypeFromUnionTypeNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return addOptionality(getTypeFromTypeNode(node.type)); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return getTypeFromNamedTupleTypeNode(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return getTypeFromTypeNode(node.type); - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getTypeFromRestTypeNode(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return getTypeFromMappedTypeNode(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getTypeFromConditionalTypeNode(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return getTypeFromInferTypeNode(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return getTypeFromTemplateTypeNode(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return getTypeFromImportTypeNode(node); // This function assumes that an identifier, qualified name, or property access expression is a type expression // Callers should first ensure this by calling `isPartOfTypeNode` // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var symbol = getSymbolAtLocation(node); return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; default: @@ -63993,8 +64700,8 @@ var ts; return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* TypeMapKind.Merged */, mapper, makeUnaryTypeMapper(source, target)); } function getRestrictiveTypeParameter(tp) { - return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), - tp.restrictiveInstantiation.constraint = unknownType, + return !tp.constraint && !getConstraintDeclaration(tp) || tp.constraint === noConstraintType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), + tp.restrictiveInstantiation.constraint = noConstraintType, tp.restrictiveInstantiation); } function cloneTypeParameter(typeParameter) { @@ -64108,17 +64815,18 @@ var ts; return type; } function maybeTypeParameterReference(node) { - return !(node.parent.kind === 178 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || - node.parent.kind === 200 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); + return !(node.parent.kind === 180 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || + node.parent.kind === 202 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); } function isTypeParameterPossiblyReferenced(tp, node) { - // If the type parameter doesn't have exactly one declaration, if there are invening statement blocks + // If the type parameter doesn't have exactly one declaration, if there are intervening statement blocks // between the node and the type parameter declaration, if the node contains actual references to the - // type parameter, or if the node contains type queries, we consider the type parameter possibly referenced. + // type parameter, or if the node contains type queries that we can't prove couldn't contain references to the type parameter, + // we consider the type parameter possibly referenced. if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container = tp.symbol.declarations[0].parent; for (var n = node; n !== container; n = n.parent) { - if (!n || n.kind === 235 /* SyntaxKind.Block */ || n.kind === 189 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { + if (!n || n.kind === 238 /* SyntaxKind.Block */ || n.kind === 191 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { return true; } } @@ -64127,15 +64835,36 @@ var ts; return true; function containsReference(node) { switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return !!tp.isThisType; case 79 /* SyntaxKind.Identifier */: return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && getTypeFromTypeNodeWorker(node) === tp; // use worker because we're looking for === equality - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: + var entityName = node.exprName; + var firstIdentifier = ts.getFirstIdentifier(entityName); + var firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); + var tpDeclaration = tp.symbol.declarations[0]; // There is exactly one declaration, otherwise `containsReference` is not called + var tpScope_1; + if (tpDeclaration.kind === 165 /* SyntaxKind.TypeParameter */) { // Type parameter is a regular type parameter, e.g. foo + tpScope_1 = tpDeclaration.parent; + } + else if (tp.isThisType) { + // Type parameter is the this type, and its declaration is the class declaration. + tpScope_1 = tpDeclaration; + } + else { + // Type parameter's declaration was unrecognized. + // This could happen if the type parameter comes from e.g. a JSDoc annotation, so we default to returning true. + return true; + } + if (firstIdentifierSymbol.declarations) { + return ts.some(firstIdentifierSymbol.declarations, function (idDecl) { return ts.isNodeDescendantOf(idDecl, tpScope_1); }) || + ts.some(node.typeArguments, containsReference); + } return true; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return !node.type && !!node.body || ts.some(node.typeParameters, containsReference) || ts.some(node.parameters, containsReference) || @@ -64357,17 +65086,18 @@ var ts; return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments); } if (flags & 33554432 /* TypeFlags.Substitution */) { - var maybeVariable = instantiateType(type.baseType, mapper); - if (maybeVariable.flags & 8650752 /* TypeFlags.TypeVariable */) { - return getSubstitutionType(maybeVariable, instantiateType(type.substitute, mapper)); + var newBaseType = instantiateType(type.baseType, mapper); + var newConstraint = instantiateType(type.constraint, mapper); + // A substitution type originates in the true branch of a conditional type and can be resolved + // to just the base type in the same cases as the conditional type resolves to its true branch + // (because the base type is then known to satisfy the constraint). + if (newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ && isGenericType(newConstraint)) { + return getSubstitutionType(newBaseType, newConstraint); } - else { - var sub = instantiateType(type.substitute, mapper); - if (sub.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) { - return maybeVariable; - } - return sub; + if (newConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(newBaseType), getRestrictiveInstantiation(newConstraint))) { + return newBaseType; } + return newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); } return type; } @@ -64416,35 +65146,35 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type return isContextSensitiveFunctionLikeDeclaration(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return ts.some(node.properties, isContextSensitive); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return ts.some(node.elements, isContextSensitive); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return isContextSensitive(node.initializer); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isContextSensitive(node.expression); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive); - case 285 /* SyntaxKind.JsxAttribute */: { + case 288 /* SyntaxKind.JsxAttribute */: { // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. var initializer = node.initializer; return !!initializer && isContextSensitive(initializer); } - case 288 /* SyntaxKind.JsxExpression */: { + case 291 /* SyntaxKind.JsxExpression */: { // It is possible to that node.expression is undefined (e.g
) var expression = node.expression; return !!expression && isContextSensitive(expression); @@ -64453,15 +65183,14 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return (!ts.isFunctionDeclaration(node) || ts.isInJSFile(node) && !!getTypeForDeclarationFromJSDocComment(node)) && - (ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node)); + return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node); } function hasContextSensitiveReturnExpression(node) { // TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value. - return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 /* SyntaxKind.Block */ && isContextSensitive(node.body); + return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 238 /* SyntaxKind.Block */ && isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { - return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && + return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { @@ -64562,23 +65291,23 @@ var ts; return true; } switch (node.kind) { - case 288 /* SyntaxKind.JsxExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 27 /* SyntaxKind.CommaToken */: return elaborateError(node.right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); } break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer); } return false; @@ -64787,7 +65516,7 @@ var ts; } function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) { switch (child.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: // child is of the type of the expression return { errorNode: child, innerExpression: child.expression, nameType: nameType }; case 11 /* SyntaxKind.JsxText */: @@ -64796,9 +65525,9 @@ var ts; } // child is a string return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() }; - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: // child is of type JSX.Element return { errorNode: child, innerExpression: child, nameType: nameType }; default: @@ -64946,11 +65675,11 @@ var ts; } _b = prop.kind; switch (_b) { - case 173 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; - case 172 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; - case 169 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; - case 296 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; + case 175 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; + case 174 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; + case 171 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; + case 299 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; } return [3 /*break*/, 6]; case 2: return [4 /*yield*/, { errorNode: prop.name, innerExpression: undefined, nameType: type }]; @@ -65023,8 +65752,8 @@ var ts; void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers); } var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; - var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 169 /* SyntaxKind.MethodDeclaration */ && - kind !== 168 /* SyntaxKind.MethodSignature */ && kind !== 171 /* SyntaxKind.Constructor */; + var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 171 /* SyntaxKind.MethodDeclaration */ && + kind !== 170 /* SyntaxKind.MethodSignature */ && kind !== 173 /* SyntaxKind.Constructor */; var result = -1 /* Ternary.True */; var sourceThisType = getThisTypeOfSignature(source); if (sourceThisType && sourceThisType !== voidType) { @@ -65321,7 +66050,7 @@ var ts; var t = isFreshLiteralType(type) ? type.regularType : ts.getObjectFlags(type) & 4 /* ObjectFlags.Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* TypeFlags.UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : type.substitute : + type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* TypeFlags.Simplifiable */ ? getSimplifiedType(type, writing) : type; if (t === type) @@ -65728,7 +66457,8 @@ var ts; return 0 /* Ternary.False */; } } - var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2 /* IntersectionState.Target */) && + var isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source)) && + !(intersectionState & 2 /* IntersectionState.Target */) && source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType && target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) && (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)); @@ -65755,27 +66485,6 @@ var ts; var result_7 = skipCaching ? unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) : recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags); - // For certain combinations involving intersections and optional, excess, or mismatched properties we need - // an extra property check where the intersection is viewed as a single object. The following are motivating - // examples that all should be errors, but aren't without this extra property check: - // - // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property - // - // declare let wrong: { a: { y: string } }; - // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type - // - // function foo(x: { a?: string }, y: T & { a: boolean }) { - // x = y; // Mismatched property in source intersection - // } - // - // We suppress recursive intersection property checks because they can generate lots of work when relating - // recursive intersections that are structurally similar but not exactly identical. See #37854. - if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) || - isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) { - inPropertyCheck = true; - result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* IntersectionState.PropertyCheck */, recursionFlags); - inPropertyCheck = false; - } if (result_7) { return result_7; } @@ -65980,11 +66689,15 @@ var ts; // parameter 'T extends 1 | 2', the intersection 'T & 1' should be reduced to '1' such that it doesn't // appear to be comparable to '2'. if (relation === comparableRelation && target.flags & 131068 /* TypeFlags.Primitive */) { - var constraints = ts.sameMap(source.types, getBaseConstraintOrType); + var constraints = ts.sameMap(source.types, function (t) { return t.flags & 465829888 /* TypeFlags.Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t; }); if (constraints !== source.types) { source = getIntersectionType(constraints); + if (source.flags & 131072 /* TypeFlags.Never */) { + return 0 /* Ternary.False */; + } if (!(source.flags & 2097152 /* TypeFlags.Intersection */)) { - return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); + return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false) || + isRelatedTo(target, source, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); } } } @@ -66169,8 +66882,7 @@ var ts; if (overflow) { return 0 /* Ternary.False */; } - var keyIntersectionState = intersectionState | (inPropertyCheck ? 8 /* IntersectionState.InPropertyCheck */ : 0); - var id = getRelationKey(source, target, keyIntersectionState, relation, /*ingnoreConstraints*/ false); + var id = getRelationKey(source, target, intersectionState, relation, /*ingnoreConstraints*/ false); var entry = relation.get(id); if (entry !== undefined) { if (reportErrors && entry & 2 /* RelationComparisonResult.Failed */ && !(entry & 4 /* RelationComparisonResult.Reported */)) { @@ -66200,7 +66912,7 @@ var ts; // A key that starts with "*" is an indication that we have type references that reference constrained // type parameters. For such keys we also check against the key we would have gotten if all type parameters // were unconstrained. - var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, /*ignoreConstraints*/ true) : undefined; + var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, intersectionState, relation, /*ignoreConstraints*/ true) : undefined; for (var i = 0; i < maybeCount; i++) { // If source and target are already being compared, consider them related with assumptions if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) { @@ -66287,7 +66999,7 @@ var ts; function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) { var saveErrorInfo = captureErrorCalculationState(); var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo); - if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) { + if (relation !== identityRelation) { // The combined constraint of an intersection type is the intersection of the constraints of // the constituents. When an intersection type contains instantiable types with union type // constraints, there are situations where we need to examine the combined constraint. One is @@ -66301,10 +67013,33 @@ var ts; // needs to have its constraint hoisted into an intersection with said type parameter, this way // the type param can be compared with itself in the target (with the influence of its constraint to match other parts) // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)` - var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */)); - if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself - // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this - result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); + if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) { + var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */)); + if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself + // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this + result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); + } + } + // For certain combinations involving intersections and optional, excess, or mismatched properties we need + // an extra property check where the intersection is viewed as a single object. The following are motivating + // examples that all should be errors, but aren't without this extra property check: + // + // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property + // + // declare let wrong: { a: { y: string } }; + // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type + // + // function foo(x: { a?: string }, y: T & { a: boolean }) { + // x = y; // Mismatched property in source intersection + // } + // + // We suppress recursive intersection property checks because they can generate lots of work when relating + // recursive intersections that are structurally similar but not exactly identical. See #37854. + if (result && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && !isGenericObjectType(target) && source.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) || + isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) { + inPropertyCheck = true; + result &= propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */); + inPropertyCheck = false; } } if (result) { @@ -66313,9 +67048,6 @@ var ts; return result; } function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) { - if (intersectionState & 4 /* IntersectionState.PropertyCheck */) { - return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */); - } var result; var originalErrorInfo; var varianceCheckFailed = false; @@ -66354,7 +67086,11 @@ var ts; } } if (sourceFlags & 33554432 /* TypeFlags.Substitution */) { - return isRelatedTo(source.substitute, target.substitute, 3 /* RecursionFlags.Both */, /*reportErrors*/ false); + if (result = isRelatedTo(source.baseType, target.baseType, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + if (result &= isRelatedTo(source.constraint, target.constraint, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + return result; + } + } } if (!(sourceFlags & 524288 /* TypeFlags.Object */)) { return 0 /* Ternary.False */; @@ -66412,7 +67148,7 @@ var ts; // with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!) var constraint = getConstraintOfTypeParameter(source); if (constraint && hasNonCircularBaseConstraint(source)) { - while (constraint && constraint.flags & 262144 /* TypeFlags.TypeParameter */) { + while (constraint && someType(constraint, function (c) { return !!(c.flags & 262144 /* TypeFlags.TypeParameter */); })) { if (result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false)) { return result; } @@ -67068,7 +67804,7 @@ var ts; return 0 /* Ternary.False */; } // When checking for comparability, be more lenient with optional properties. - if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) { + if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && targetProp.flags & 106500 /* SymbolFlags.ClassMember */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) { // TypeScript 1.0 spec (April 2014): 3.8.3 // S is a subtype of a type T, and T is a supertype of S if ... // S' and T are object types and, for each member M in T.. @@ -67106,7 +67842,7 @@ var ts; shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it } if (props.length === 1) { - var propName = symbolToString(unmatchedProperty); + var propName = symbolToString(unmatchedProperty, /*enclosingDeclaration*/ undefined, 0 /* SymbolFlags.None */, 4 /* SymbolFormatFlags.AllowAnyNodeKind */ | 16 /* SymbolFormatFlags.WriteComputedProps */); reportError.apply(void 0, __spreadArray([ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName], getTypeNamesForErrorDisplay(source, target), false)); if (ts.length(unmatchedProperty.declarations)) { associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName)); @@ -67355,7 +68091,7 @@ var ts; var targetSignature = ts.first(targetSignatures); result = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors, incompatibleReporter(sourceSignature, targetSignature)); if (!result && reportErrors && kind === 1 /* SignatureKind.Construct */ && (sourceObjectFlags & targetObjectFlags) && - (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 171 /* SyntaxKind.Constructor */)) { + (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 173 /* SyntaxKind.Constructor */)) { var constructSignatureToString = function (signature) { return signatureToString(signature, /*enclosingDeclaration*/ undefined, 262144 /* TypeFormatFlags.WriteArrowStyleSignature */, kind); }; @@ -68120,7 +68856,7 @@ var ts; var baseTypeNode = getBaseTypeNodeOfClass(target); // A base type expression may circularly reference the class itself (e.g. as an argument to function call), so we only // check for base types specified as simple qualified names. - if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 206 /* SyntaxKind.PropertyAccessExpression */) { + if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 208 /* SyntaxKind.PropertyAccessExpression */) { return undefined; } } @@ -68168,8 +68904,7 @@ var ts; return !!(type.flags & 109440 /* TypeFlags.Unit */); } function isUnitLikeType(type) { - return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.some(type.types, isUnitType) : - !!(type.flags & 109440 /* TypeFlags.Unit */); + return isUnitType(getBaseConstraintOrType(type)); } function extractUnitType(type) { return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.find(type.types, isUnitType) || type : type; @@ -68211,7 +68946,7 @@ var ts; if (!isLiteralOfContextualType(type, contextualType)) { type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type)); } - return type; + return getRegularTypeOfLiteralType(type); } function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) { if (type && isUnitType(type)) { @@ -68306,7 +69041,8 @@ var ts; function getOptionalType(type, isProperty) { if (isProperty === void 0) { isProperty = false; } ts.Debug.assert(strictNullChecks); - return type.flags & 32768 /* TypeFlags.Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]); + var missingOrUndefined = isProperty ? missingType : undefinedType; + return type.flags & 32768 /* TypeFlags.Undefined */ || type.flags & 1048576 /* TypeFlags.Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); } function getGlobalNonNullableTypeInstantiation(type) { if (!deferredGlobalNonNullableTypeAlias) { @@ -68595,12 +69331,12 @@ var ts; } var diagnostic; switch (declaration.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 223 /* SyntaxKind.BinaryExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: var param = declaration; if (ts.isIdentifier(param.name) && (ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) && @@ -68616,23 +69352,23 @@ var ts; noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; if (!noImplicitAny) { // Don't issue a suggestion for binding elements since the codefix doesn't yet support them. return; } break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (noImplicitAny && !declaration.name) { if (wideningKind === 3 /* WideningKind.GeneratorYield */) { error(declaration, ts.Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); @@ -68646,7 +69382,7 @@ var ts; wideningKind === 3 /* WideningKind.GeneratorYield */ ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type : ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: if (noImplicitAny) { error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); } @@ -68763,7 +69499,7 @@ var ts; if (context.intraExpressionInferenceSites) { for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) { var _b = _a[_i], node = _b.node, type = _b.type; - var contextualType = node.kind === 169 /* SyntaxKind.MethodDeclaration */ ? + var contextualType = node.kind === 171 /* SyntaxKind.MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* ContextFlags.NoConstraints */) : getContextualType(node, 2 /* ContextFlags.NoConstraints */); if (contextualType) { @@ -68826,8 +69562,8 @@ var ts; } function isNonGenericTopLevelType(type) { if (type.aliasSymbol && !type.aliasTypeArguments) { - var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 259 /* SyntaxKind.TypeAliasDeclaration */); - return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 305 /* SyntaxKind.SourceFile */ ? true : n.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); + var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 262 /* SyntaxKind.TypeAliasDeclaration */); + return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 308 /* SyntaxKind.SourceFile */ ? true : n.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); } return false; } @@ -69047,7 +69783,7 @@ var ts; && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) })); } function isMemberOfStringMapping(source, target) { - if (target.flags & (4 /* TypeFlags.String */ | 3 /* TypeFlags.AnyOrUnknown */)) { + if (target.flags & (4 /* TypeFlags.String */ | 1 /* TypeFlags.Any */)) { return true; } if (target.flags & 134217728 /* TypeFlags.TemplateLiteral */) { @@ -69361,7 +70097,7 @@ var ts; } else if (source.flags & 33554432 /* TypeFlags.Substitution */) { inferFromTypes(source.baseType, target); - inferWithPriority(source.substitute, target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority + inferWithPriority(getSubstitutionIntersection(source), target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority } else if (target.flags & 16777216 /* TypeFlags.Conditional */) { invokeOnce(source, target, inferToConditionalType); @@ -69843,7 +70579,7 @@ var ts; var saveBivariant = bivariant; var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; // Once we descend into a bivariant signature we remain bivariant for all nested inferences - bivariant = bivariant || kind === 169 /* SyntaxKind.MethodDeclaration */ || kind === 168 /* SyntaxKind.MethodSignature */ || kind === 171 /* SyntaxKind.Constructor */; + bivariant = bivariant || kind === 171 /* SyntaxKind.MethodDeclaration */ || kind === 170 /* SyntaxKind.MethodSignature */ || kind === 173 /* SyntaxKind.Constructor */; applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes); bivariant = saveBivariant; applyToReturnTypes(source, target, inferFromTypes); @@ -70042,7 +70778,7 @@ var ts; } // falls through default: - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; } else { @@ -70063,7 +70799,7 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.6.3 // A type query consists of the keyword typeof followed by an expression. // The expression is restricted to a single identifier or a sequence of identifiers separated by periods - return !!ts.findAncestor(node, function (n) { return n.kind === 181 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 161 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); + return !!ts.findAncestor(node, function (n) { return n.kind === 183 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 163 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); } // Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers // separated by dots). The key consists of the id of the symbol referenced by the @@ -70079,26 +70815,26 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: return "0|".concat(flowContainer ? getNodeId(flowContainer) : "-1", "|").concat(getTypeId(declaredType), "|").concat(getTypeId(initialType)); - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: var left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer); return left && left + "." + node.right.escapedText; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var propName = getAccessedPropertyName(node); if (propName !== undefined) { var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && key + "." + propName; } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: // Handle pseudo-references originating in getNarrowedTypeOfSymbol. return "".concat(getNodeId(node), "#").concat(getTypeId(declaredType)); } @@ -70106,16 +70842,16 @@ var ts; } function isMatchingReference(source, target) { switch (target.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isMatchingReference(source, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isAssignmentExpression(target) && isMatchingReference(source, target.left)) || (ts.isBinaryExpression(target) && target.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source, target.right)); } switch (source.kind) { - case 231 /* SyntaxKind.MetaProperty */: - return target.kind === 231 /* SyntaxKind.MetaProperty */ + case 233 /* SyntaxKind.MetaProperty */: + return target.kind === 233 /* SyntaxKind.MetaProperty */ && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; case 79 /* SyntaxKind.Identifier */: @@ -70123,26 +70859,26 @@ var ts; return ts.isThisInTypeQuery(source) ? target.kind === 108 /* SyntaxKind.ThisKeyword */ : target.kind === 79 /* SyntaxKind.Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 254 /* SyntaxKind.VariableDeclaration */ || target.kind === 203 /* SyntaxKind.BindingElement */) && + (target.kind === 257 /* SyntaxKind.VariableDeclaration */ || target.kind === 205 /* SyntaxKind.BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 108 /* SyntaxKind.ThisKeyword */: return target.kind === 108 /* SyntaxKind.ThisKeyword */; case 106 /* SyntaxKind.SuperKeyword */: return target.kind === 106 /* SyntaxKind.SuperKeyword */; - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isMatchingReference(source.expression, target); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var sourcePropertyName = getAccessedPropertyName(source); var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined; return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return ts.isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isBinaryExpression(source) && source.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source.right, target)); } return false; @@ -70173,7 +70909,7 @@ var ts; } if (ts.isEntityNameExpression(node.argumentExpression)) { var symbol = resolveEntityName(node.argumentExpression, 111551 /* SymbolFlags.Value */, /*ignoreErrors*/ true); - if (!symbol || !isConstVariable(symbol)) + if (!symbol || !(isConstVariable(symbol) || (symbol.flags & 8 /* SymbolFlags.EnumMember */))) return undefined; var declaration = symbol.valueDeclaration; if (declaration === undefined) @@ -70185,9 +70921,14 @@ var ts; return name; } } - if (ts.hasOnlyExpressionInitializer(declaration)) { + if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) { var initializer = ts.getEffectiveInitializer(declaration); - return initializer && tryGetNameFromType(getTypeOfExpression(initializer)); + if (initializer) { + return tryGetNameFromType(getTypeOfExpression(initializer)); + } + if (ts.isEnumMember(declaration)) { + return ts.getTextOfPropertyName(declaration.name); + } } } return undefined; @@ -70314,7 +71055,7 @@ var ts; } function getMatchingUnionConstituentForObjectLiteral(unionType, node) { var keyPropertyName = getKeyPropertyName(unionType); - var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && + var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); }); var propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); return propType && getConstituentTypeForKeyType(unionType, propType); @@ -70331,7 +71072,7 @@ var ts; } } } - if (expression.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expression.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isOrContainsMatchingReference(reference, expression.expression.expression)) { return true; } @@ -70531,15 +71272,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, type, undefinedType, /*errorNode*/ undefined) || errorType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; + return parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -70556,21 +71297,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return stringType; - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkRightHandSideOfForOf(parent) || errorType; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return undefinedType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return errorType; @@ -70578,7 +71319,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ ? + var type = pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -70596,30 +71337,30 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent) || errorType; } return errorType; } function getInitialType(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function isEmptyArrayAssignment(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.initializer && + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 203 /* SyntaxKind.BindingElement */ && node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + node.kind !== 205 /* SyntaxKind.BindingElement */ && node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 75 /* SyntaxKind.BarBarEqualsToken */: @@ -70634,13 +71375,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? + return parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); } return neverType; @@ -70659,13 +71400,13 @@ var ts; // Get the type names from all cases in a switch on `typeof`. The default clause and/or duplicate type names are // represented as undefined. Return undefined if one or more case clause expressions are not string literals. function getSwitchClauseTypeOfWitnesses(switchStatement) { - if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 289 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { + if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 292 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { return undefined; } var witnesses = []; for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { var clause = _a[_i]; - var text = clause.kind === 289 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; + var text = clause.kind === 292 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; witnesses.push(text && !ts.contains(witnesses, text) ? text : undefined); } return witnesses; @@ -70852,12 +71593,12 @@ var ts; var root = getReferenceRoot(node); var parent = root.parent; var isLengthPushOrUnshift = ts.isPropertyAccessExpression(parent) && (parent.name.escapedText === "length" || - parent.parent.kind === 208 /* SyntaxKind.CallExpression */ + parent.parent.kind === 210 /* SyntaxKind.CallExpression */ && ts.isIdentifier(parent.name) && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + var isElementAssignment = parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -70870,6 +71611,7 @@ var ts; ts.isInJSFile(node) && ts.hasInitializer(node) && node.initializer && ts.isFunctionExpressionOrArrowFunction(node.initializer) && ts.getEffectiveReturnTypeNode(node.initializer)); } function getExplicitTypeOfSymbol(symbol, diagnostic) { + symbol = resolveSymbol(symbol); if (symbol.flags & (16 /* SymbolFlags.Function */ | 8192 /* SymbolFlags.Method */ | 32 /* SymbolFlags.Class */ | 512 /* SymbolFlags.ValueModule */)) { return getTypeOfSymbol(symbol); } @@ -70885,7 +71627,7 @@ var ts; if (isDeclarationWithExplicitTypeAnnotation(declaration)) { return getTypeOfSymbol(symbol); } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var statement = declaration.parent.parent; var expressionType = getTypeOfDottedName(statement.expression, /*diagnostic*/ undefined); if (expressionType) { @@ -70908,12 +71650,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: var symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node)); - return getExplicitTypeOfSymbol(symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol, diagnostic); + return getExplicitTypeOfSymbol(symbol, diagnostic); case 108 /* SyntaxKind.ThisKeyword */: return getExplicitThisType(node); case 106 /* SyntaxKind.SuperKeyword */: return checkSuperExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var type = getTypeOfDottedName(node.expression, diagnostic); if (type) { var name = node.name; @@ -70931,7 +71673,7 @@ var ts; } return undefined; } - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getTypeOfDottedName(node.expression, diagnostic); } } @@ -70945,7 +71687,7 @@ var ts; // circularities in control flow analysis, we use getTypeOfDottedName when resolving the call // target expression of an assertion. var funcType = void 0; - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { funcType = getTypeOfDottedName(node.expression, /*diagnostic*/ undefined); } else if (node.expression.kind !== 106 /* SyntaxKind.SuperKeyword */) { @@ -70989,7 +71731,7 @@ var ts; } function isFalseExpression(expr) { var node = ts.skipParentheses(expr, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || + return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ && isFalseExpression(node.left) && isFalseExpression(node.right)); } function isReachableFlowNodeWorker(flow, noCacheCheck) { @@ -71110,8 +71852,8 @@ var ts; var symbol = getResolvedSymbol(node); return isConstVariable(symbol) || ts.isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // The resolvedSymbol property is initialized by checkPropertyAccess or checkElementAccess before we get here. return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol); } @@ -71138,7 +71880,7 @@ var ts; // on empty arrays are possible without implicit any errors and new element types can be inferred without // type mismatch errors. var resultType = ts.getObjectFlags(evolvedType) & 256 /* ObjectFlags.EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 230 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 232 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { return declaredType; } // The non-null unknown type should never escape control flow analysis. @@ -71223,8 +71965,8 @@ var ts; // Check if we should continue with the control flow of the containing function. var container = flow.node; if (container && container !== flowContainer && - reference.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && - reference.kind !== 207 /* SyntaxKind.ElementAccessExpression */ && + reference.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && + reference.kind !== 209 /* SyntaxKind.ElementAccessExpression */ && reference.kind !== 108 /* SyntaxKind.ThisKeyword */) { flow = container.flowNode; continue; @@ -71249,7 +71991,7 @@ var ts; } function getInitialOrAssignedType(flow) { var node = flow.node; - return getNarrowableTypeForReference(node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */ ? + return getNarrowableTypeForReference(node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */ ? getInitialType(node) : getAssignedType(node), reference); } @@ -71289,14 +72031,14 @@ var ts; // in which case we continue control flow analysis back to the function's declaration if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) { var init = ts.getDeclaredExpandoInitializer(node); - if (init && (init.kind === 213 /* SyntaxKind.FunctionExpression */ || init.kind === 214 /* SyntaxKind.ArrowFunction */)) { + if (init && (init.kind === 215 /* SyntaxKind.FunctionExpression */ || init.kind === 216 /* SyntaxKind.ArrowFunction */)) { return getTypeAtFlowNode(flow.antecedent); } } return declaredType; } // for (const _ in ref) acts as a nonnull on ref - if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { + if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)))); } // Assignment doesn't affect reference @@ -71307,7 +72049,7 @@ var ts; if (node.kind === 95 /* SyntaxKind.FalseKeyword */) { return unreachableNeverType; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { if (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */) { return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right); } @@ -71338,7 +72080,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 208 /* SyntaxKind.CallExpression */ ? + var expr = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -71346,7 +72088,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256 /* ObjectFlags.EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -71394,15 +72136,15 @@ var ts; if (isMatchingReference(reference, expr)) { type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { - type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { + type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } else { if (strictNullChecks) { if (optionalChainContainsReference(expr, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & (32768 /* TypeFlags.Undefined */ | 131072 /* TypeFlags.Never */)); }); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & 131072 /* TypeFlags.Never */ || t.flags & 128 /* TypeFlags.StringLiteral */ && t.value === "undefined"); }); } } @@ -71630,7 +72372,7 @@ var ts; var narrowedPropType = narrowType(propType); return filterType(type, function (t) { var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName); - return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); + return !(discriminantType.flags & 131072 /* TypeFlags.Never */) && !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); }); } function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { @@ -71672,18 +72414,26 @@ var ts; } function isTypePresencePossible(type, propName, assumeTrue) { var prop = getPropertyOfType(type, propName); - if (prop) { - return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue; - } - return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue; - } - function narrowByInKeyword(type, name, assumeTrue) { - if (type.flags & 1048576 /* TypeFlags.Union */ - || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type)) - || ts.isThisTypeParameter(type) - || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) { + return prop ? + !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue : + !!getApplicableIndexInfoForName(type, propName) || !assumeTrue; + } + function narrowTypeByInKeyword(type, nameType, assumeTrue) { + var name = getPropertyNameFromType(nameType); + var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); }); + if (isKnownProperty) { + // If the check is for a known property (i.e. a property declared in some constituent of + // the target type), we filter the target type by presence of absence of the property. return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); }); } + if (assumeTrue) { + // If the check is for an unknown property, we intersect the target type with `Record`, + // where X is the name of the property. + var recordSymbol = getGlobalRecordSymbol(); + if (recordSymbol) { + return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]); + } + } return type; } function narrowTypeByBinaryExpression(type, expr, assumeTrue) { @@ -71700,10 +72450,10 @@ var ts; var operator = expr.operatorToken.kind; var left = getReferenceCandidate(expr.left); var right = getReferenceCandidate(expr.right); - if (left.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { + if (left.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { return narrowTypeByTypeof(type, left, operator, right, assumeTrue); } - if (right.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { + if (right.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { return narrowTypeByTypeof(type, right, operator, left, assumeTrue); } if (isMatchingReference(reference, left)) { @@ -71742,15 +72492,14 @@ var ts; return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue); } var target = getReferenceCandidate(expr.right); - var leftType = getTypeOfNode(expr.left); - if (leftType.flags & 128 /* TypeFlags.StringLiteral */) { - var name = ts.escapeLeadingUnderscores(leftType.value); + var leftType = getTypeOfExpression(expr.left); + if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) { if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) && - getAccessedPropertyName(reference) === name) { + getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) { return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */); } if (isMatchingReference(reference, target)) { - return narrowByInKeyword(type, name, assumeTrue); + return narrowTypeByInKeyword(type, leftType, assumeTrue); } } break; @@ -71812,24 +72561,11 @@ var ts; assumeTrue = !assumeTrue; } var valueType = getTypeOfExpression(value); - if (((type.flags & 2 /* TypeFlags.Unknown */) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304 /* TypeFlags.Nullable */)) && - assumeTrue && - (operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) { - if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) { - return valueType; - } - if (valueType.flags & 524288 /* TypeFlags.Object */) { - return nonPrimitiveType; - } - if (type.flags & 2 /* TypeFlags.Unknown */) { - return type; - } - } + var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; if (valueType.flags & 98304 /* TypeFlags.Nullable */) { if (!strictNullChecks) { return type; } - var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; var facts = doubleEquals ? assumeTrue ? 262144 /* TypeFacts.EQUndefinedOrNull */ : 2097152 /* TypeFacts.NEUndefinedOrNull */ : valueType.flags & 65536 /* TypeFlags.Null */ ? @@ -71838,10 +72574,16 @@ var ts; return getAdjustedTypeWithFacts(type, facts); } if (assumeTrue) { - var filterFn = operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? - function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); } : - function (t) { return areTypesComparable(t, valueType); }; - return replacePrimitivesWithLiterals(filterType(type, filterFn), valueType); + if (!doubleEquals && (type.flags & 2 /* TypeFlags.Unknown */ || someType(type, isEmptyAnonymousObjectType))) { + if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) { + return valueType; + } + if (valueType.flags & 524288 /* TypeFlags.Object */) { + return nonPrimitiveType; + } + } + var filteredType = filterType(type, function (t) { return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); }); + return replacePrimitivesWithLiterals(filteredType, valueType); } if (isUnitType(valueType)) { return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); }); @@ -71855,11 +72597,18 @@ var ts; } var target = getReferenceCandidate(typeOfExpr.expression); if (!isMatchingReference(reference, target)) { + var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type); + if (propertyAccess) { + return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); }); + } if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) { return getAdjustedTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */); } return type; } + return narrowTypeByLiteralExpression(type, literal, assumeTrue); + } + function narrowTypeByLiteralExpression(type, literal, assumeTrue) { return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeFacts.TypeofNEHostObject */); @@ -71939,13 +72688,13 @@ var ts; neverType; }); } - function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) { + function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) { var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement); if (!witnesses) { return type; } // Equal start and end denotes implicit fallthrough; undefined marks explicit default clause. - var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 290 /* SyntaxKind.DefaultClause */; }); + var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 293 /* SyntaxKind.DefaultClause */; }); var hasDefaultClause = clauseStart === clauseEnd || (defaultIndex >= clauseStart && defaultIndex < clauseEnd); if (hasDefaultClause) { // In the default clause we filter constituents down to those that are not-equal to all handled cases. @@ -72149,17 +72898,17 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return narrowTypeByCallExpression(type, expr, assumeTrue); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return narrowType(type, expr.expression, assumeTrue); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (expr.operator === 53 /* SyntaxKind.ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -72208,9 +72957,9 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 262 /* SyntaxKind.ModuleBlock */ || - node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 265 /* SyntaxKind.ModuleBlock */ || + node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; }); } // Check if a parameter or catch variable is assigned anywhere @@ -72253,7 +73002,7 @@ var ts; function removeOptionalityFromDeclaredType(declaredType, declaration) { if (pushTypeResolution(declaration.symbol, 2 /* TypeSystemPropertyName.DeclaredType */)) { var annotationIncludesUndefined = strictNullChecks && - declaration.kind === 164 /* SyntaxKind.Parameter */ && + declaration.kind === 166 /* SyntaxKind.Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* TypeFacts.IsUndefined */ && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* TypeFacts.IsUndefined */); @@ -72270,10 +73019,10 @@ var ts; // In an element access obj[x], we consider obj to be in a constraint position, except when obj is of // a generic type without a nullable constraint and x is a generic type. This is because when both obj // and x are of generic types T and K, we want the resulting type to be T[K]. - return parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 161 /* SyntaxKind.QualifiedName */ || - parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === node || - parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && + return parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 163 /* SyntaxKind.QualifiedName */ || + parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === node || + parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression))); } function isGenericTypeWithUnionConstraint(type) { @@ -72327,15 +73076,15 @@ var ts; }); } function markAliasReferenced(symbol, location) { - if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) { var target = resolveAlias(symbol); - if (target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(target) & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */)) { // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled // (because the const enum value will not be inlined), or if (2) the alias is an export // of a const enum declaration that will be preserved. if (compilerOptions.isolatedModules || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) || - !isConstEnumOrConstEnumOnlyModule(target)) { + !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) { markAliasSymbolAsReferenced(symbol); } else { @@ -72372,15 +73121,16 @@ var ts; // destructuring from the narrowed parent type. if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) { var parent = declaration.parent.parent; - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 166 /* SyntaxKind.Parameter */) { var links = getNodeLinks(parent); if (!(links.flags & 268435456 /* NodeCheckFlags.InCheckIdentifier */)) { links.flags |= 268435456 /* NodeCheckFlags.InCheckIdentifier */; var parentType = getTypeForBindingElementParent(parent, 0 /* CheckMode.Normal */); + var parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~268435456 /* NodeCheckFlags.InCheckIdentifier */; - if (parentType && parentType.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 164 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { + if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 166 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { var pattern = declaration.parent; - var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, /*flowContainer*/ undefined, location.flowNode); + var narrowedType = getFlowTypeOfReference(pattern, parentTypeConstraint, parentTypeConstraint, /*flowContainer*/ undefined, location.flowNode); if (narrowedType.flags & 131072 /* TypeFlags.Never */) { return neverType; } @@ -72447,10 +73197,10 @@ var ts; } var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ScriptTarget.ES2015 */) { - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } - else if (ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + else if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } @@ -72470,7 +73220,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -72482,12 +73232,12 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (declaration.kind === 228 /* SyntaxKind.ClassExpression */) { // When we emit a class expression with static members that contain a reference // to the constructor in the initializer, we will need to substitute that // binding with an alias as the class name is not in scope. var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); - while (container.kind !== 305 /* SyntaxKind.SourceFile */) { + while (container.kind !== 308 /* SyntaxKind.SourceFile */) { if (container.parent === declaration) { if (ts.isPropertyDeclaration(container) && ts.isStatic(container) || ts.isClassStaticBlockDeclaration(container)) { getNodeLinks(declaration).flags |= 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; @@ -72545,7 +73295,7 @@ var ts; // The declaration container is the innermost function that encloses the declaration of the variable // or parameter. The flow container is the innermost function starting with which we analyze the control // flow graph to determine the control flow based type. - var isParameter = ts.getRootDeclaration(declaration).kind === 164 /* SyntaxKind.Parameter */; + var isParameter = ts.getRootDeclaration(declaration).kind === 166 /* SyntaxKind.Parameter */; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; @@ -72554,19 +73304,19 @@ var ts; // When the control flow originates in a function expression or arrow function and we are referencing // a const variable or parameter from an outer function, we extend the origin of the control flow // analysis to include the immediately enclosing function. - while (flowContainer !== declarationContainer && (flowContainer.kind === 213 /* SyntaxKind.FunctionExpression */ || - flowContainer.kind === 214 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* SyntaxKind.FunctionExpression */ || + flowContainer.kind === 216 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } // We only look for uninitialized variables in strict null checking mode, and only when we can analyze // the entire control flow graph from the variable's declaration (i.e. when the flow container and // declaration container are the same). - var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) || + var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* TypeFlags.AnyOrUnknown */ | 16384 /* TypeFlags.Void */)) !== 0 || - isInTypeQuery(node) || node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) || - node.parent.kind === 230 /* SyntaxKind.NonNullExpression */ || - declaration.kind === 254 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) || + node.parent.kind === 232 /* SyntaxKind.NonNullExpression */ || + declaration.kind === 257 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* NodeFlags.Ambient */; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -72591,6 +73341,12 @@ var ts; } return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } + function isSameScopedBindingElement(node, declaration) { + if (ts.isBindingElement(declaration)) { + var bindingElement = ts.findAncestor(node, ts.isBindingElement); + return bindingElement && ts.getRootDeclaration(bindingElement) === ts.getRootDeclaration(declaration); + } + } function shouldMarkIdentifierAliasReferenced(node) { var _a; var parent = node.parent; @@ -72624,7 +73380,7 @@ var ts; (symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 32 /* SymbolFlags.Class */)) === 0 || !symbol.valueDeclaration || ts.isSourceFile(symbol.valueDeclaration) || - symbol.valueDeclaration.parent.kind === 292 /* SyntaxKind.CatchClause */) { + symbol.valueDeclaration.parent.kind === 295 /* SyntaxKind.CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -72639,7 +73395,7 @@ var ts; // mark iteration statement as containing block-scoped binding captured in some function var capturesBlockScopeBindingInLoopBody = true; if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container) { var part = getPartOfForStatementContainingNode(node.parent, container); if (part) { @@ -72660,7 +73416,7 @@ var ts; // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 4194304 /* NodeCheckFlags.NeedsLoopOutParameter */; } @@ -72679,7 +73435,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { // skip parenthesized nodes var current = node; - while (current.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (current.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -72687,7 +73443,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */)) { + else if ((current.parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; } @@ -72700,7 +73456,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* NodeCheckFlags.LexicalThis */; - if (container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || container.kind === 173 /* SyntaxKind.Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* NodeCheckFlags.CaptureThis */; } @@ -72747,31 +73503,31 @@ var ts; // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var capturedByArrowFunction = false; - if (container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); capturedByArrowFunction = true; } checkThisInStaticClassFieldInitializerInDecoratedClass(node, container); switch (container.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -72859,7 +73615,7 @@ var ts; } function getClassNameFromPrototypeMethod(container) { // Check if it's the RHS of a x.prototype.y = function [name]() { .... } - if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isBinaryExpression(container.parent) && ts.getAssignmentDeclarationKind(container.parent) === 3 /* AssignmentDeclarationKind.PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = container' @@ -72869,16 +73625,16 @@ var ts; .expression; // x } // x.prototype = { method() { } } - else if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && - container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && + container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.left.expression; } // x.prototype = { method: function() { } } - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && - container.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && - container.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && + container.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && + container.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.parent.left.expression; @@ -72886,7 +73642,7 @@ var ts; // Object.defineProperty(x, "method", { value: function() { } }); // Object.defineProperty(x, "method", { set: (x: () => void) => void }); // Object.defineProperty(x, "method", { get: () => function() { }) }); - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isPropertyAssignment(container.parent) && ts.isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && @@ -72911,7 +73667,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 317 /* SyntaxKind.JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 320 /* SyntaxKind.JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -72925,19 +73681,24 @@ var ts; } } function isInConstructorArgumentInitializer(node, constructorDecl) { - return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 164 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); + return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 166 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 208 /* SyntaxKind.CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 210 /* SyntaxKind.CallExpression */ && node.parent.expression === node; var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var container = immediateContainer; var needToCaptureLexicalThis = false; + var inAsyncFunction = false; // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - while (container && container.kind === 214 /* SyntaxKind.ArrowFunction */) { + while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) { + if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) + inAsyncFunction = true; container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */; } + if (container && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) + inAsyncFunction = true; } var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; @@ -72947,14 +73708,14 @@ var ts; // class B { // [super.foo()]() {} // } - var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 162 /* SyntaxKind.ComputedPropertyName */; }); - if (current && current.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 164 /* SyntaxKind.ComputedPropertyName */; }); + if (current && current.kind === 164 /* SyntaxKind.ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -72962,7 +73723,7 @@ var ts; } return errorType; } - if (!isCallExpression && immediateContainer.kind === 171 /* SyntaxKind.Constructor */) { + if (!isCallExpression && immediateContainer.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if (ts.isStatic(container) || isCallExpression) { @@ -73043,12 +73804,12 @@ var ts; // as a call expression cannot be used as the target of a destructuring assignment while a property access can. // // For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations. - if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && inAsyncFunction) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { - getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */; + getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */; } else { - getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.AsyncMethodWithSuper */; + getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */; } } if (needToCaptureLexicalThis) { @@ -73057,7 +73818,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return errorType; @@ -73078,7 +73839,7 @@ var ts; if (!baseClassType) { return errorType; } - if (container.kind === 171 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 173 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return errorType; @@ -73093,7 +73854,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 173 /* SyntaxKind.Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -73101,23 +73862,23 @@ var ts; // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor // topmost container must be something that is directly nested in the class declaration\object literal expression - if (ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (ts.isStatic(container)) { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } else { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 166 /* SyntaxKind.PropertySignature */ || - container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 168 /* SyntaxKind.PropertySignature */ || + container.kind === 173 /* SyntaxKind.Constructor */; } } } @@ -73125,10 +73886,10 @@ var ts; } } function getContainingObjectLiteral(func) { - return (func.kind === 169 /* SyntaxKind.MethodDeclaration */ || - func.kind === 172 /* SyntaxKind.GetAccessor */ || - func.kind === 173 /* SyntaxKind.SetAccessor */) && func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : - func.kind === 213 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : + return (func.kind === 171 /* SyntaxKind.MethodDeclaration */ || + func.kind === 174 /* SyntaxKind.GetAccessor */ || + func.kind === 175 /* SyntaxKind.SetAccessor */) && func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : + func.kind === 215 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -73140,7 +73901,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -73167,7 +73928,7 @@ var ts; if (thisType) { return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); } - if (literal.parent.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (literal.parent.kind !== 299 /* SyntaxKind.PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -73181,7 +73942,7 @@ var ts; // In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the // contextual type for 'this' is 'obj'. var parent = ts.walkUpParenthesizedExpressions(func.parent); - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { var target = parent.left; if (ts.isAccessExpression(target)) { var expression = target.expression; @@ -73234,11 +73995,11 @@ var ts; return getTypeFromTypeNode(typeNode); } switch (declaration.kind) { - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return getContextuallyTypedParameterType(declaration); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForBindingElement(declaration, contextFlags); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isStatic(declaration)) { return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags); } @@ -73249,10 +74010,10 @@ var ts; var parent = declaration.parent.parent; var name = declaration.propertyName || declaration.name; var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || - parent.kind !== 203 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); + parent.kind !== 205 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name)) return undefined; - if (parent.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (parent.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { var index = ts.indexOfNode(declaration.parent.elements, declaration); if (index < 0) return undefined; @@ -73409,7 +74170,7 @@ var ts; getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (template.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -73528,9 +74289,11 @@ var ts; case 1 /* AssignmentDeclarationKind.ExportsProperty */: case 6 /* AssignmentDeclarationKind.Prototype */: case 3 /* AssignmentDeclarationKind.PrototypeProperty */: - var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; - // falls through case 2 /* AssignmentDeclarationKind.ModuleExports */: + var valueDeclaration = void 0; + if (kind !== 2 /* AssignmentDeclarationKind.ModuleExports */) { + valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; + } valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration); var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration); return annotated ? getTypeFromTypeNode(annotated) : undefined; @@ -73707,21 +74470,21 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 79 /* SyntaxKind.Identifier */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isPossiblyDiscriminantValue(node.expression); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !node.expression || isPossiblyDiscriminantValue(node.expression); } return false; } function discriminateContextualTypeByObjectMembers(node, contextualType) { - return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } function discriminateContextualTypeByJSXAttributes(node, contextualType) { - return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 285 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 288 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. @@ -73742,9 +74505,10 @@ var ts; function instantiateContextualType(contextualType, node, contextFlags) { if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* TypeFlags.Instantiable */)) { var inferenceContext = getInferenceContext(node); - // If no inferences have been made, nothing is gained from instantiating as type parameters - // would just be replaced with their defaults similar to the apparent type. - if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidates)) { + // If no inferences have been made, and none of the type parameters for which we are inferring + // specify default types, nothing is gained from instantiating as type parameters would just be + // replaced with their constraints similar to the apparent type. + if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) { // For contextual signatures we incorporate all inferences made so far, e.g. from return // types as well as arguments to the left in a function call. return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper); @@ -73804,60 +74568,62 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForInitializerExpression(node, contextFlags); - case 214 /* SyntaxKind.ArrowFunction */: - case 247 /* SyntaxKind.ReturnStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 250 /* SyntaxKind.ReturnStatement */: return getContextualTypeForReturnExpression(node, contextFlags); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return getContextualTypeForYieldOperand(parent, contextFlags); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return getContextualTypeForAwaitOperand(parent, contextFlags); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return getContextualTypeForArgument(parent, node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return ts.isConstTypeReference(parent.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(parent.type); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getContextualTypeForBinaryOperand(node, contextFlags); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent, contextFlags); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return getContextualType(parent.parent, contextFlags); - case 204 /* SyntaxKind.ArrayLiteralExpression */: { + case 206 /* SyntaxKind.ArrayLiteralExpression */: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return getContextualTypeForConditionalOperand(node, contextFlags); - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 223 /* SyntaxKind.TemplateExpression */); + case 236 /* SyntaxKind.TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 225 /* SyntaxKind.TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { // Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast. var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return !tag ? getContextualType(parent, contextFlags) : ts.isJSDocTypeTag(tag) && ts.isConstTypeReference(tag.typeExpression.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(tag.typeExpression.type); } - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return getContextualType(parent, contextFlags); - case 271 /* SyntaxKind.ExportAssignment */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return getTypeFromTypeNode(parent.type); + case 274 /* SyntaxKind.ExportAssignment */: return tryGetTypeFromEffectiveTypeNode(parent); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return getContextualTypeForJsxExpression(parent, contextFlags); - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent, contextFlags); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getContextualJsxElementAttributesType(parent, contextFlags); } return undefined; @@ -73983,9 +74749,16 @@ var ts; if (!isErrorType(intrinsicClassAttribs)) { var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); var hostClassType = getReturnTypeOfSignature(sig); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context))) - : intrinsicClassAttribs, apparentAttributesType); + var libraryManagedAttributeType = void 0; + if (typeParams) { + // apply JSX.IntrinsicClassElements + var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context)); + libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs)); + } + // or JSX.IntrinsicClassElements has no generics. + else + libraryManagedAttributeType = intrinsicClassAttribs; + apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType); } var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (!isErrorType(intrinsicAttribs)) { @@ -74108,7 +74881,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var typeTagSignature = getSignatureOfTypeTag(node); if (typeTagSignature) { return typeTagSignature; @@ -74156,8 +74929,8 @@ var ts; return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type; } function hasDefaultValue(node) { - return (node.kind === 203 /* SyntaxKind.BindingElement */ && !!node.initializer) || - (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); + return (node.kind === 205 /* SyntaxKind.BindingElement */ && !!node.initializer) || + (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); } function checkArrayLiteral(node, checkMode, forceTuple) { var elements = node.elements; @@ -74170,7 +74943,7 @@ var ts; var hasOmittedExpression = false; for (var i = 0; i < elementCount; i++) { var e = elements[i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 /* ExternalEmitHelpers.SpreadIncludes */ : 1024 /* ExternalEmitHelpers.SpreadArray */); } @@ -74203,7 +74976,7 @@ var ts; elementFlags.push(4 /* ElementFlags.Rest */); } } - else if (exactOptionalPropertyTypes && e.kind === 227 /* SyntaxKind.OmittedExpression */) { + else if (exactOptionalPropertyTypes && e.kind === 229 /* SyntaxKind.OmittedExpression */) { hasOmittedExpression = true; elementTypes.push(missingType); elementFlags.push(2 /* ElementFlags.Optional */); @@ -74243,7 +75016,7 @@ var ts; } function isNumericName(name) { switch (name.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return isNumericComputedName(name); case 79 /* SyntaxKind.Identifier */: return ts.isNumericLiteralName(name.escapedText); @@ -74264,7 +75037,7 @@ var ts; if (!links.resolvedType) { if ((ts.isTypeLiteralNode(node.parent.parent) || ts.isClassLike(node.parent.parent) || ts.isInterfaceDeclaration(node.parent.parent)) && ts.isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ - && node.parent.kind !== 172 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 173 /* SyntaxKind.SetAccessor */) { + && node.parent.kind !== 174 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 175 /* SyntaxKind.SetAccessor */) { return links.resolvedType = errorType; } links.resolvedType = checkExpression(node.expression); @@ -74337,7 +75110,7 @@ var ts; var spread = emptyObjectType; var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 205 /* SyntaxKind.ObjectLiteralExpression */); + (contextualType.pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 207 /* SyntaxKind.ObjectLiteralExpression */); var inConstContext = isConstContext(node); var checkFlags = inConstContext ? 8 /* CheckFlags.Readonly */ : 0; var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node); @@ -74361,16 +75134,16 @@ var ts; for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var memberDecl = _c[_b]; var member = getSymbolOfNode(memberDecl); - var computedNameType = memberDecl.name && memberDecl.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? + var computedNameType = memberDecl.name && memberDecl.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : undefined; - if (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ || + if (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { - var type = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : + var type = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`. // we don't want to say "could not find 'a'". - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode); if (isInJavascript) { var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); @@ -74393,8 +75166,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* SymbolFlags.Optional */; } @@ -74420,14 +75193,14 @@ var ts; member = prop; allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop); if (contextualType && checkMode && checkMode & 2 /* CheckMode.Inferential */ && !(checkMode & 4 /* CheckMode.SkipContextSensitive */) && - (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 169 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { + (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 171 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { var inferenceContext = getInferenceContext(node); ts.Debug.assert(inferenceContext); // In CheckMode.Inferential we should always have an inference context - var inferenceNode = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; + var inferenceNode = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type); } } - else if (memberDecl.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (memberDecl.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* ExternalEmitHelpers.Assign */); } @@ -74463,7 +75236,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 172 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 173 /* SyntaxKind.SetAccessor */); + ts.Debug.assert(memberDecl.kind === 174 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 175 /* SyntaxKind.SetAccessor */); checkNodeDeferred(memberDecl); } if (computedNameType && !(computedNameType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */)) { @@ -74490,16 +75263,30 @@ var ts; // If object literal is contextually typed by the implied type of a binding pattern, augment the result // type with those properties for which the binding pattern specifies a default value. // If the object literal is spread into another object literal, skip this step and let the top-level object - // literal handle it instead. - if (contextualTypeHasPattern && node.parent.kind !== 298 /* SyntaxKind.SpreadAssignment */) { - for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { - var prop = _e[_d]; - if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { - if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { - error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + // literal handle it instead. Note that this might require full traversal to the root pattern's parent + // as it's the guaranteed to be the common ancestor of the pattern node and the current object node. + // It's not possible to check if the immediate parent node is a spread assignment + // since the type flows in non-obvious ways through conditional expressions, IIFEs and more. + if (contextualTypeHasPattern) { + var rootPatternParent_1 = ts.findAncestor(contextualType.pattern.parent, function (n) { + return n.kind === 257 /* SyntaxKind.VariableDeclaration */ || + n.kind === 223 /* SyntaxKind.BinaryExpression */ || + n.kind === 166 /* SyntaxKind.Parameter */; + }); + var spreadOrOutsideRootObject = ts.findAncestor(node, function (n) { + return n === rootPatternParent_1 || + n.kind === 301 /* SyntaxKind.SpreadAssignment */; + }); + if (spreadOrOutsideRootObject.kind !== 301 /* SyntaxKind.SpreadAssignment */) { + for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { + var prop = _e[_d]; + if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { + if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable.set(prop.escapedName, prop); + propertiesArray.push(prop); } - propertiesTable.set(prop.escapedName, prop); - propertiesArray.push(prop); } } } @@ -74607,6 +75394,7 @@ var ts; */ function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) { var attributes = openingLikeElement.attributes; + var attributesType = getContextualType(attributes, 0 /* ContextFlags.None */); var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined; var attributesTable = ts.createSymbolTable(); var spread = emptyJsxObjectType; @@ -74634,9 +75422,15 @@ var ts; if (attributeDecl.name.escapedText === jsxChildrenPropertyName) { explicitlySpecifyChildrenAttribute = true; } + if (attributesType) { + var prop = getPropertyOfType(attributesType, member.escapedName); + if (prop && prop.declarations && isDeprecatedSymbol(prop)) { + addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText); + } + } } else { - ts.Debug.assert(attributeDecl.kind === 287 /* SyntaxKind.JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 290 /* SyntaxKind.JsxSpreadAttribute */); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false); attributesTable = ts.createSymbolTable(); @@ -74663,7 +75457,7 @@ var ts; } } // Handle children attribute - var parent = openingLikeElement.parent.kind === 278 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 281 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; // We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { var childrenTypes = checkJsxChildren(parent, checkMode); @@ -74720,7 +75514,7 @@ var ts; childrenTypes.push(stringType); } } - else if (child.kind === 288 /* SyntaxKind.JsxExpression */ && !child.expression) { + else if (child.kind === 291 /* SyntaxKind.JsxExpression */ && !child.expression) { continue; // empty jsx expressions don't *really* count as present children } else { @@ -75152,9 +75946,9 @@ var ts; function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError) { if (reportError === void 0) { reportError = true; } var errorNode = !reportError ? undefined : - node.kind === 161 /* SyntaxKind.QualifiedName */ ? node.right : - node.kind === 200 /* SyntaxKind.ImportType */ ? node : - node.kind === 203 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; + node.kind === 163 /* SyntaxKind.QualifiedName */ ? node.right : + node.kind === 202 /* SyntaxKind.ImportType */ ? node : + node.kind === 205 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode); } /** @@ -75185,7 +75979,7 @@ var ts; return false; } } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { // A method cannot be accessed in a super property access if the method is abstract. // This error could mask a private property access error. But, a member // cannot simultaneously be private and abstract, so this will trigger an @@ -75197,7 +75991,7 @@ var ts; } } // Referencing abstract properties within their own constructors is not allowed - if ((flags & 128 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && + if ((flags & 256 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && (ts.isThisProperty(location) || ts.isThisInitializedObjectBindingExpression(location) || ts.isObjectBindingPattern(location.parent) && ts.isThisInitializedDeclaration(location.parent.parent))) { var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) { @@ -75291,10 +76085,27 @@ var ts; return isNullableType(type) ? getNonNullableType(type) : type; } function reportObjectPossiblyNullOrUndefinedError(node, facts) { - error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); + var nodeText = ts.isEntityNameExpression(node) ? ts.entityNameToString(node) : undefined; + if (node.kind === 104 /* SyntaxKind.NullKeyword */) { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "null"); + return; + } + if (nodeText !== undefined && nodeText.length < 100) { + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "undefined"); + return; + } + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics._0_is_possibly_null_or_undefined : + ts.Diagnostics._0_is_possibly_undefined : + ts.Diagnostics._0_is_possibly_null, nodeText); + } + else { + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } } function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) { error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? @@ -75304,6 +76115,13 @@ var ts; } function checkNonNullTypeWithReporter(type, node, reportError) { if (strictNullChecks && type.flags & 2 /* TypeFlags.Unknown */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_of_type_unknown, nodeText); + return errorType; + } + } error(node, ts.Diagnostics.Object_is_of_type_unknown); return errorType; } @@ -75321,6 +76139,17 @@ var ts; function checkNonNullNonVoidType(type, node) { var nonNullType = checkNonNullType(type, node); if (nonNullType.flags & 16384 /* TypeFlags.Void */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, nodeText); + return nonNullType; + } + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_possibly_undefined, nodeText); + return nonNullType; + } + } error(node, ts.Diagnostics.Object_is_possibly_undefined); } return nonNullType; @@ -75339,7 +76168,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, leftType, node.right, checkMode); } function isMethodAccessForCall(node) { - while (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.parent; } return ts.isCallOrNewExpression(node.parent) && node.parent.expression === node; @@ -75479,7 +76308,7 @@ var ts; } return isErrorType(apparentType) ? errorType : apparentType; } - prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 161 /* SyntaxKind.QualifiedName */); + prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 163 /* SyntaxKind.QualifiedName */); } // In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums. // `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined @@ -75489,7 +76318,7 @@ var ts; // 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and // 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`. if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules || - !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 299 /* SyntaxKind.EnumMember */)) || + !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 302 /* SyntaxKind.EnumMember */)) || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { markAliasReferenced(parentSymbol, node); } @@ -75591,7 +76420,7 @@ var ts; if (declaration && isPropertyWithoutInitializer(declaration)) { if (!ts.isStatic(declaration)) { var flowContainer = getControlFlowContainer(node); - if (flowContainer.kind === 171 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { + if (flowContainer.kind === 173 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { assumeUninitialized = true; } } @@ -75626,8 +76455,8 @@ var ts; && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) { diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName); } - else if (valueDeclaration.kind === 257 /* SyntaxKind.ClassDeclaration */ && - node.parent.kind !== 178 /* SyntaxKind.TypeReference */ && + else if (valueDeclaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && + node.parent.kind !== 180 /* SyntaxKind.TypeReference */ && !(valueDeclaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName); @@ -75639,25 +76468,25 @@ var ts; function isInPropertyInitializerOrClassStaticBlock(node) { return !!ts.findAncestor(node, function (node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 298 /* SyntaxKind.SpreadAssignment */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 233 /* SyntaxKind.TemplateSpan */: - case 288 /* SyntaxKind.JsxExpression */: - case 285 /* SyntaxKind.JsxAttribute */: - case 286 /* SyntaxKind.JsxAttributes */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 291 /* SyntaxKind.HeritageClause */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 301 /* SyntaxKind.SpreadAssignment */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 236 /* SyntaxKind.TemplateSpan */: + case 291 /* SyntaxKind.JsxExpression */: + case 288 /* SyntaxKind.JsxAttribute */: + case 289 /* SyntaxKind.JsxAttributes */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 294 /* SyntaxKind.HeritageClause */: return false; - case 214 /* SyntaxKind.ArrowFunction */: - case 238 /* SyntaxKind.ExpressionStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.isBlock(node.parent) && ts.isClassStaticBlockDeclaration(node.parent.parent) ? true : "quit"; default: return ts.isExpressionNode(node) ? false : "quit"; @@ -75852,7 +76681,6 @@ var ts; } return false; } - ; var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get"; if (!hasProp(suggestedMethod)) { return undefined; @@ -75932,11 +76760,11 @@ var ts; } function isValidPropertyAccess(node, propertyName) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return isValidPropertyAccessWithType(node, node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression))); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getWidenedType(checkExpression(node.left))); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getTypeFromTypeNode(node)); } } @@ -75951,7 +76779,7 @@ var ts; * @param property the accessed property's symbol. */ function isValidPropertyAccessForCompletions(node, type, property) { - return isPropertyAccessible(node, node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, + return isPropertyAccessible(node, node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, /* isWrite */ false, type, property); // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context. } @@ -75991,7 +76819,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -76020,7 +76848,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 243 /* SyntaxKind.ForInStatement */ && + if (node.kind === 246 /* SyntaxKind.ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -76069,13 +76897,13 @@ var ts; // This gets us diagnostics for the type arguments and marks them as referenced. ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { checkExpression(node.template); } else if (ts.isJsxOpeningLikeElement(node)) { checkExpression(node.attributes); } - else if (node.kind !== 165 /* SyntaxKind.Decorator */) { + else if (node.kind !== 167 /* SyntaxKind.Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -76139,7 +76967,7 @@ var ts; } } function isSpreadArgument(arg) { - return !!arg && (arg.kind === 225 /* SyntaxKind.SpreadElement */ || arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); + return !!arg && (arg.kind === 227 /* SyntaxKind.SpreadElement */ || arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); } function getSpreadArgumentIndex(args) { return ts.findIndex(args, isSpreadArgument); @@ -76156,9 +76984,9 @@ var ts; var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments var effectiveParameterCount = getParameterCount(signature); var effectiveMinimumArguments = getMinArgumentCount(signature); - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { argCount = args.length; - if (node.template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (node.template.kind === 225 /* SyntaxKind.TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var lastSpan = ts.last(node.template.templateSpans); // we should always have at least one span. @@ -76173,7 +77001,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 165 /* SyntaxKind.Decorator */) { + else if (node.kind === 167 /* SyntaxKind.Decorator */) { argCount = getDecoratorArgumentCount(node, signature); } else if (ts.isJsxOpeningLikeElement(node)) { @@ -76187,7 +77015,7 @@ var ts; } else if (!node.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(node.kind === 209 /* SyntaxKind.NewExpression */); + ts.Debug.assert(node.kind === 211 /* SyntaxKind.NewExpression */); return getMinArgumentCount(signature) === 0; } else { @@ -76290,7 +77118,7 @@ var ts; // example, given a 'function wrap(cb: (x: T) => U): (x: T) => U' and a call expression // 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the // return type of 'wrap'. - if (node.kind !== 165 /* SyntaxKind.Decorator */) { + if (node.kind !== 167 /* SyntaxKind.Decorator */) { var skipBindingPatterns = ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }); var contextualType = getContextualType(node, skipBindingPatterns ? 8 /* ContextFlags.SkipBindingPatterns */ : 0 /* ContextFlags.None */); if (contextualType) { @@ -76354,7 +77182,7 @@ var ts; } for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { var paramType = getTypeAtPosition(signature, i); if (couldContainTypeVariables(paramType)) { var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); @@ -76380,7 +77208,7 @@ var ts; if (isSpreadArgument(arg)) { // We are inferring from a spread expression in the last argument position, i.e. both the parameter // and the argument are ...x forms. - return getMutableArrayOrTupleType(arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : + return getMutableArrayOrTupleType(arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode)); } } @@ -76390,13 +77218,13 @@ var ts; for (var i = index; i < argCount; i++) { var arg = args[i]; if (isSpreadArgument(arg)) { - var spreadType = arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); + var spreadType = arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); if (isArrayLikeType(spreadType)) { types.push(spreadType); flags.push(8 /* ElementFlags.Variadic */); } else { - types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 225 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); + types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 227 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); flags.push(4 /* ElementFlags.Rest */); } } @@ -76407,7 +77235,7 @@ var ts; types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(1 /* ElementFlags.Required */); } - if (arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { + if (arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { names.push(arg.tupleNameSource); } } @@ -76551,7 +77379,7 @@ var ts; return undefined; } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 209 /* SyntaxKind.NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 211 /* SyntaxKind.NewExpression */) { // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. // If the expression is a new expression, then the check is skipped. @@ -76569,7 +77397,7 @@ var ts; var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = checkExpressionWithContextualType(arg, paramType, /*inferenceContext*/ undefined, checkMode); // If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive), @@ -76614,8 +77442,8 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - var expression = node.kind === 208 /* SyntaxKind.CallExpression */ ? node.expression : - node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; + var expression = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression : + node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; if (expression) { var callee = ts.skipOuterExpressions(expression); if (ts.isAccessExpression(callee)) { @@ -76633,17 +77461,17 @@ var ts; * Returns the effective arguments for an expression that works like a function invocation. */ function getEffectiveCallArguments(node) { - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var template = node.template; var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args_3.push(span.expression); }); } return args_3; } - if (node.kind === 165 /* SyntaxKind.Decorator */) { + if (node.kind === 167 /* SyntaxKind.Decorator */) { return getEffectiveDecoratorArguments(node); } if (ts.isJsxOpeningLikeElement(node)) { @@ -76657,7 +77485,7 @@ var ts; var _loop_26 = function (i) { var arg = args[i]; // We can call checkExpressionCached because spread expressions never have a contextual type. - var spreadType = arg.kind === 225 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); + var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); if (spreadType && isTupleType(spreadType)) { ts.forEach(getTypeArguments(spreadType), function (t, i) { var _a; @@ -76684,30 +77512,30 @@ var ts; var parent = node.parent; var expr = node.expression; switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class). return [ createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent))) ]; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts). var func = parent.parent; return [ - createSyntheticExpression(expr, parent.parent.kind === 171 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), + createSyntheticExpression(expr, parent.parent.kind === 173 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), createSyntheticExpression(expr, anyType), createSyntheticExpression(expr, numberType) ]; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators // for ES3, we will only pass two arguments. - var hasPropDesc = parent.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && languageVersion !== 0 /* ScriptTarget.ES3 */; + var hasPropDesc = languageVersion !== 0 /* ScriptTarget.ES3 */ && (!ts.isPropertyDeclaration(parent) || ts.hasAccessorModifier(parent)); return [ createSyntheticExpression(expr, getParentTypeOfClassElement(parent)), createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)), @@ -76721,17 +77549,17 @@ var ts; */ function getDecoratorArgumentCount(node, signature) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return 1; - case 167 /* SyntaxKind.PropertyDeclaration */: - return 2; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return ts.hasAccessorModifier(node.parent) ? 3 : 2; + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // For ES3 or decorators with only two parameters we supply only two arguments return languageVersion === 0 /* ScriptTarget.ES3 */ || signature.parameters.length <= 2 ? 2 : 3; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return 3; default: return ts.Debug.fail(); @@ -76873,8 +77701,8 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, fallbackError) { - var isTaggedTemplate = node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; - var isDecorator = node.kind === 165 /* SyntaxKind.Decorator */; + var isTaggedTemplate = node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; + var isDecorator = node.kind === 167 /* SyntaxKind.Decorator */; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var reportErrors = !candidatesOutArray; var typeArguments; @@ -76937,7 +77765,7 @@ var ts; var result; // If we are in signature help, a trailing comma indicates that we intend to provide another argument, // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments. - var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 208 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 210 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument // expression is a subtype of each corresponding parameter type, the return type of the first @@ -77426,7 +78254,7 @@ var ts; return resolveErrorCall(node); } var valueDecl = expressionType.symbol && ts.getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && ts.hasSyntacticModifier(valueDecl, 128 /* ModifierFlags.Abstract */)) { + if (valueDecl && ts.hasSyntacticModifier(valueDecl, 256 /* ModifierFlags.Abstract */)) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class); return resolveErrorCall(node); } @@ -77497,7 +78325,7 @@ var ts; var declaration = signature.declaration; var modifiers = ts.getSelectedEffectiveModifierFlags(declaration, 24 /* ModifierFlags.NonPublicAccessibilityModifier */); // (1) Public constructors and (2) constructor functions are always accessible. - if (!modifiers || declaration.kind !== 171 /* SyntaxKind.Constructor */) { + if (!modifiers || declaration.kind !== 173 /* SyntaxKind.Constructor */) { return true; } var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(declaration.parent.symbol); @@ -77641,16 +78469,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; default: return ts.Debug.fail(); @@ -77696,7 +78524,7 @@ var ts; // file would probably be preferable. var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968 /* SymbolFlags.Type */); var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968 /* SymbolFlags.Type */, node); - var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); var parameterSymbol = createSymbol(1 /* SymbolFlags.FunctionScopedVariable */, "props"); parameterSymbol.type = result; return createSignature(declaration, @@ -77745,16 +78573,16 @@ var ts; } function resolveSignature(node, candidatesOutArray, checkMode) { switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return resolveCallExpression(node, candidatesOutArray, checkMode); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return resolveNewExpression(node, candidatesOutArray, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return resolveDecorator(node, candidatesOutArray, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode); } throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); @@ -77798,12 +78626,15 @@ var ts; return false; } var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node : - ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : + (ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : undefined; if (func) { - // If the node has a @class tag, treat it like a constructor. + // If the node has a @class or @constructor tag, treat it like a constructor. if (ts.getJSDocClassTag(node)) return true; + // If the node is a property of an object literal. + if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent))) + return false; // If the symbol of the node has members, treat it like a constructor. var symbol = getSymbolOfNode(func); return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size); @@ -77886,7 +78717,7 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { parent = parent.parent; } if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -77912,12 +78743,12 @@ var ts; if (node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { return voidType; } - if (node.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.kind === 211 /* SyntaxKind.NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 171 /* SyntaxKind.Constructor */ && - declaration.kind !== 175 /* SyntaxKind.ConstructSignature */ && - declaration.kind !== 180 /* SyntaxKind.ConstructorType */ && + declaration.kind !== 173 /* SyntaxKind.Constructor */ && + declaration.kind !== 177 /* SyntaxKind.ConstructSignature */ && + declaration.kind !== 182 /* SyntaxKind.ConstructorType */ && !ts.isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any @@ -77937,7 +78768,7 @@ var ts; if (returnType.flags & 12288 /* TypeFlags.ESSymbolLike */ && isSymbolOrSymbolForCall(node)) { return getESSymbolLikeTypeForNode(ts.walkUpParenthesizedExpressions(node.parent)); } - if (node.kind === 208 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + if (node.kind === 210 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && returnType.flags & 16384 /* TypeFlags.Void */ && getTypePredicateOfSignature(signature)) { if (!ts.isDottedName(node.expression)) { error(node.expression, ts.Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); @@ -77967,20 +78798,20 @@ var ts; function getDeprecatedSuggestionNode(node) { node = ts.skipParentheses(node); switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 165 /* SyntaxKind.Decorator */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 167 /* SyntaxKind.Decorator */: + case 211 /* SyntaxKind.NewExpression */: return getDeprecatedSuggestionNode(node.expression); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return getDeprecatedSuggestionNode(node.tag); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getDeprecatedSuggestionNode(node.tagName); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.argumentExpression; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: var typeReference = node; return ts.isQualifiedName(typeReference.typeName) ? typeReference.typeName.right : typeReference; default: @@ -78051,8 +78882,8 @@ var ts; if (hasDefaultOnly && type && !isErrorType(type)) { var synthType = type; if (!synthType.defaultOnlyType) { - var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); - synthType.defaultOnlyType = type_5; + var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); + synthType.defaultOnlyType = type_4; } return synthType.defaultOnlyType; } @@ -78095,9 +78926,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* SymbolFlags.Function */ - ? 256 /* SyntaxKind.FunctionDeclaration */ + ? 259 /* SyntaxKind.FunctionDeclaration */ : resolvedRequire.flags & 3 /* SymbolFlags.Variable */ - ? 254 /* SyntaxKind.VariableDeclaration */ + ? 257 /* SyntaxKind.VariableDeclaration */ : 0 /* SyntaxKind.Unknown */; if (targetDeclarationKind !== 0 /* SyntaxKind.Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -78117,7 +78948,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkAssertion(node) { - if (node.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { var file = ts.getSourceFileOfNode(node); if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts" /* Extension.Cts */, ".mts" /* Extension.Mts */])) { grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead); @@ -78133,25 +78964,25 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isValidConstAssertionArgument(node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var op = node.operator; var arg = node.operand; return op === 40 /* SyntaxKind.MinusToken */ && (arg.kind === 8 /* SyntaxKind.NumericLiteral */ || arg.kind === 9 /* SyntaxKind.BigIntLiteral */) || op === 39 /* SyntaxKind.PlusToken */ && arg.kind === 8 /* SyntaxKind.NumericLiteral */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node.expression; var symbol = getTypeOfNode(expr).symbol; if (symbol && symbol.flags & 2097152 /* SymbolFlags.Alias */) { symbol = resolveAlias(symbol); } - return !!(symbol && (symbol.flags & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */); + return !!(symbol && (getAllSymbolFlags(symbol) & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */); } return false; } @@ -78187,7 +79018,7 @@ var ts; } function checkExpressionWithTypeArguments(node) { checkGrammarExpressionWithTypeArguments(node); - var exprType = node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : + var exprType = node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); var typeArguments = node.typeArguments; @@ -78251,6 +79082,16 @@ var ts; }); } } + function checkSatisfiesExpression(node) { + checkSourceElement(node.type); + var targetType = getTypeFromTypeNode(node.type); + if (isErrorType(targetType)) { + return targetType; + } + var exprType = checkExpression(node.expression); + checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, node.type, node.expression, ts.Diagnostics.Type_0_does_not_satisfy_the_expected_type_1); + return exprType; + } function checkMetaProperty(node) { checkGrammarMetaProperty(node); if (node.keywordToken === 103 /* SyntaxKind.NewKeyword */) { @@ -78278,7 +79119,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return errorType; } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -78330,7 +79171,7 @@ var ts; } function getParameterIdentifierNameAtPosition(signature, pos) { var _a; - if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 317 /* SyntaxKind.JSDocFunctionType */) { + if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDocFunctionType */) { return undefined; } var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78362,7 +79203,7 @@ var ts; return symbol.valueDeclaration && ts.isParameter(symbol.valueDeclaration) && ts.isIdentifier(symbol.valueDeclaration.name); } function isValidDeclarationForTupleLabel(d) { - return d.kind === 197 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); + return d.kind === 199 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); } function getNameableDeclarationAtPosition(signature, pos) { var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78654,7 +79495,7 @@ var ts; var yieldType; var nextType; var fallbackReturnType = voidType; - if (func.body.kind !== 235 /* SyntaxKind.Block */) { // Async or normal arrow function + if (func.body.kind !== 238 /* SyntaxKind.Block */) { // Async or normal arrow function returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* CheckMode.SkipGenericFunctions */); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -78803,15 +79644,25 @@ var ts; } function isExhaustiveSwitchStatement(node) { var links = getNodeLinks(node); - return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node)); + if (links.isExhaustive === undefined) { + links.isExhaustive = 0; // Indicate resolution is in process + var exhaustive = computeExhaustiveSwitchStatement(node); + if (links.isExhaustive === 0) { + links.isExhaustive = exhaustive; + } + } + else if (links.isExhaustive === 0) { + links.isExhaustive = false; // Resolve circularity to false + } + return links.isExhaustive; } function computeExhaustiveSwitchStatement(node) { - if (node.expression.kind === 216 /* SyntaxKind.TypeOfExpression */) { + if (node.expression.kind === 218 /* SyntaxKind.TypeOfExpression */) { var witnesses = getSwitchClauseTypeOfWitnesses(node); if (!witnesses) { return false; } - var operandConstraint = getBaseConstraintOrType(getTypeOfExpression(node.expression.expression)); + var operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression)); // Get the not-equal flags for all handled cases. var notEqualFacts_2 = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses); if (operandConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */) { @@ -78821,7 +79672,7 @@ var ts; // A missing not-equal flag indicates that the type wasn't handled by some case. return !someType(operandConstraint, function (t) { return (getTypeFacts(t) & notEqualFacts_2) === notEqualFacts_2; }); } - var type = getTypeOfExpression(node.expression); + var type = checkExpressionCached(node.expression); if (!isLiteralType(type)) { return false; } @@ -78872,11 +79723,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: - return func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + case 171 /* SyntaxKind.MethodDeclaration */: + return func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; default: return false; } @@ -78902,7 +79753,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (func.kind === 168 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 235 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { + if (func.kind === 170 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 238 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 512 /* NodeFlags.HasExplicitReturn */; @@ -78936,7 +79787,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); checkNodeDeferred(node); if (ts.isFunctionExpression(node)) { checkCollisionsForDeclarationName(node, node.name); @@ -78963,7 +79814,7 @@ var ts; } // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (!hasGrammarError && node.kind === 215 /* SyntaxKind.FunctionExpression */) { checkGrammarForGenerator(node); } contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -79014,7 +79865,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var functionFlags = ts.getFunctionFlags(node); var returnType = getReturnTypeFromAnnotation(node); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); @@ -79027,7 +79878,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body.kind === 238 /* SyntaxKind.Block */) { checkSourceElement(node.body); } else { @@ -79117,7 +79968,7 @@ var ts; expr.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var ctor = ts.getContainingFunction(expr); - if (!(ctor && (ctor.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { + if (!(ctor && (ctor.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { return true; } if (symbol.valueDeclaration) { @@ -79142,7 +79993,7 @@ var ts; var symbol_2 = getNodeLinks(node).resolvedSymbol; if (symbol_2.flags & 2097152 /* SymbolFlags.Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol_2); - return !!declaration && declaration.kind === 268 /* SyntaxKind.NamespaceImport */; + return !!declaration && declaration.kind === 271 /* SyntaxKind.NamespaceImport */; } } } @@ -79242,7 +80093,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); - if (container && container.kind !== 171 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { + if (container && container.kind !== 173 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); } @@ -79410,6 +80261,9 @@ var ts; } return booleanType; } + function hasEmptyObjectIntersection(type) { + return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); }); + } function checkInExpression(left, right, leftType, rightType) { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; @@ -79426,40 +80280,20 @@ var ts; } } else { - leftType = checkNonNullType(leftType, left); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // Require the left operand to be of type Any, the String primitive type, or the Number primitive type. - if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) || - isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) { - error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol); + // The type of the lef operand must be assignable to string, number, or symbol. + checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left); + } + // The type of the right operand must be assignable to 'object'. + if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) { + // The {} type is assignable to the object type, yet {} might represent a primitive type. Here we + // detect and error on {} that results from narrowing the unknown type, as well as intersections + // that include {} (we know that the other types in such intersections are assignable to object + // since we already checked for that). + if (hasEmptyObjectIntersection(rightType)) { + error(right, ts.Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType)); } } - rightType = checkNonNullType(rightType, right); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // The in operator requires the right operand to be - // - // 1. assignable to the non-primitive type, - // 2. an unconstrained type parameter, - // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the - // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the - // non-primitive type, or - // 4. a type parameter whose constraint is - // i. an object type, - // ii. the non-primitive type, or - // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type. - // - // The divergent behavior for type parameters and unions containing type parameters is a workaround for type - // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance - // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error - // unless *all* instantiations would result in an error. - // // The result is always of the Boolean primitive type. - var rightTypeConstraint = getConstraintOfType(rightType); - if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) { - error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive); - } return booleanType; } function checkObjectLiteralAssignment(node, sourceType, rightIsThis) { @@ -79477,7 +80311,7 @@ var ts; if (rightIsThis === void 0) { rightIsThis = false; } var properties = node.properties; var property = properties[propertyIndex]; - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */ || property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */ || property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var name = property.name; var exprType = getLiteralTypeFromPropertyName(name); if (isTypeUsableAsPropertyName(exprType)) { @@ -79490,9 +80324,9 @@ var ts; } var elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* AccessFlags.ExpressionPosition */, name); var type = getFlowTypeOfDestructuring(property, elementType); - return checkDestructuringAssignment(property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); + return checkDestructuringAssignment(property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); } - else if (property.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (property.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (propertyIndex < properties.length - 1) { error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } @@ -79530,7 +80364,7 @@ var ts; var inBoundsType = compilerOptions.noUncheckedIndexedAccess ? undefined : possiblyOutOfBoundsType; for (var i = 0; i < elements.length; i++) { var type = possiblyOutOfBoundsType; - if (node.elements[i].kind === 225 /* SyntaxKind.SpreadElement */) { + if (node.elements[i].kind === 227 /* SyntaxKind.SpreadElement */) { type = inBoundsType = inBoundsType !== null && inBoundsType !== void 0 ? inBoundsType : (checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, sourceType, undefinedType, node) || errorType); } checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode); @@ -79540,8 +80374,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 227 /* SyntaxKind.OmittedExpression */) { - if (element.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (element.kind !== 229 /* SyntaxKind.OmittedExpression */) { + if (element.kind !== 227 /* SyntaxKind.SpreadElement */) { var indexType = getNumberLiteralType(elementIndex); if (isArrayLikeType(sourceType)) { // We create a synthetic expression so that getIndexedAccessType doesn't get confused @@ -79559,7 +80393,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 221 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (restExpression.kind === 223 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -79575,7 +80409,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) { var target; - if (exprOrAssignment.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -79591,7 +80425,7 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 221 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (target.kind === 223 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { checkBinaryExpression(target, checkMode); target = target.left; // A default value is specified, so remove undefined from the final type. @@ -79599,20 +80433,20 @@ var ts; sourceType = getTypeWithFacts(sourceType, 524288 /* TypeFacts.NEUndefined */); } } - if (target.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (target.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, rightIsThis); } - if (target.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + if (target.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, checkMode); } return checkReferenceAssignment(target, sourceType, checkMode); } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var error = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; - var optionalError = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var optionalError = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; if (checkReferenceExpression(target, error, optionalError)) { @@ -79637,36 +80471,36 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 10 /* SyntaxKind.StringLiteral */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: return true; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -79678,9 +80512,9 @@ var ts; } return false; // Some forms listed here for clarity - case 217 /* SyntaxKind.VoidExpression */: // Explicit opt-out - case 211 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 229 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings + case 219 /* SyntaxKind.VoidExpression */: // Explicit opt-out + case 213 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 231 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -79717,7 +80551,7 @@ var ts; } checkGrammarNullishCoalesceWithLogicalExpression(node); var operator = node.operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { state.skip = true; setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === 108 /* SyntaxKind.ThisKeyword */)); return state; @@ -79739,11 +80573,11 @@ var ts; if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */ || operator === 56 /* SyntaxKind.BarBarToken */ || operator === 60 /* SyntaxKind.QuestionQuestionToken */) { if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */) { var parent = node.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)) { parent = parent.parent; } - checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined); + checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined); } checkTruthinessOfType(leftType, node.left); } @@ -79814,7 +80648,7 @@ var ts; // expression-wide checks and does not use a work stack to fold nested binary expressions into the same callstack frame function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 108 /* SyntaxKind.ThisKeyword */); } var leftType; @@ -79970,6 +80804,7 @@ var ts; var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */; error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true"); } + checkNaNEquality(errorNode, operator, left, right); reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); }); return booleanType; case 102 /* SyntaxKind.InstanceOfKeyword */: @@ -80165,20 +81000,35 @@ var ts; } } function tryGiveBetterPrimaryError(errNode, maybeMissingAwait, leftStr, rightStr) { - var typeName; switch (operatorToken.kind) { case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: case 34 /* SyntaxKind.EqualsEqualsToken */: - typeName = "false"; - break; case 37 /* SyntaxKind.ExclamationEqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: - typeName = "true"; + return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap, leftStr, rightStr); + default: + return undefined; } - if (typeName) { - return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, typeName, leftStr, rightStr); + } + function checkNaNEquality(errorNode, operator, left, right) { + var isLeftNaN = isGlobalNaN(ts.skipParentheses(left)); + var isRightNaN = isGlobalNaN(ts.skipParentheses(right)); + if (isLeftNaN || isRightNaN) { + var err = error(errorNode, ts.Diagnostics.This_condition_will_always_return_0, ts.tokenToString(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? 95 /* SyntaxKind.FalseKeyword */ : 110 /* SyntaxKind.TrueKeyword */)); + if (isLeftNaN && isRightNaN) + return; + var operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? ts.tokenToString(53 /* SyntaxKind.ExclamationToken */) : ""; + var location = isLeftNaN ? right : left; + var expression = ts.skipParentheses(location); + ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")"))); } - return undefined; + } + function isGlobalNaN(expr) { + if (ts.isIdentifier(expr) && expr.escapedText === "NaN") { + var globalNaNSymbol = getGlobalNaNSymbol(); + return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr); + } + return false; } } function getBaseTypesIfUnrelated(leftType, rightType, isRelated) { @@ -80259,8 +81109,8 @@ var ts; } } function checkConditionalExpression(node, checkMode) { - checkTruthinessExpression(node.condition); - checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue); + var type = checkTruthinessExpression(node.condition); + checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue); var type1 = checkExpression(node.whenTrue, checkMode); var type2 = checkExpression(node.whenFalse, checkMode); return getUnionType([type1, type2], 2 /* UnionReduction.Subtype */); @@ -80289,7 +81139,7 @@ var ts; type.flags & 58982400 /* TypeFlags.InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* TypeFlags.StringLike */)); } function getContextNode(node) { - if (node.kind === 286 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { + if (node.kind === 289 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { return node.parent.parent; // Needs to be the root JsxElement, so it encompasses the attributes _and_ the children (which are essentially part of the attributes) } return node; @@ -80343,8 +81193,8 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */ || - node.kind === 229 /* SyntaxKind.AsExpression */ || + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */ || + node.kind === 231 /* SyntaxKind.AsExpression */ || ts.isJSDocTypeAssertion(node); } function checkDeclarationInitializer(declaration, checkMode, contextualType) { @@ -80353,7 +81203,7 @@ var ts; (contextualType ? checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, checkMode || 0 /* CheckMode.Normal */) : checkExpressionCached(initializer, checkMode)); - return ts.isParameter(declaration) && declaration.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && + return ts.isParameter(declaration) && declaration.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; } @@ -80363,7 +81213,7 @@ var ts; var elementFlags = type.target.elementFlags.slice(); for (var i = getTypeReferenceArity(type); i < patternElements.length; i++) { var e = patternElements[i]; - if (i < patternElements.length - 1 || !(e.kind === 203 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { + if (i < patternElements.length - 1 || !(e.kind === 205 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { elementTypes.push(!ts.isOmittedExpression(e) && hasDefaultValue(e) ? getTypeFromBindingElement(e, /*includePatternInType*/ false, /*reportErrors*/ false) : anyType); elementFlags.push(2 /* ElementFlags.Optional */); if (!ts.isOmittedExpression(e) && !hasDefaultValue(e)) { @@ -80431,7 +81281,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, checkMode); @@ -80442,7 +81292,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -80516,6 +81366,9 @@ var ts; function hasInferenceCandidates(info) { return !!(info.candidates || info.contraCandidates); } + function hasInferenceCandidatesOrDefault(info) { + return !!(info.candidates || info.contraCandidates || hasTypeParameterDefault(info.typeParameter)); + } function hasOverlappingInferences(a, b) { for (var i = 0; i < a.length; i++) { if (hasInferenceCandidates(a[i]) && hasInferenceCandidates(b[i])) { @@ -80685,11 +81538,11 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || - (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || - (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums + var ok = (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || + (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || + (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query); } @@ -80714,9 +81567,9 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -80747,80 +81600,82 @@ var ts; return trueType; case 95 /* SyntaxKind.FalseKeyword */: return falseType; - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return checkTemplateExpression(node); case 13 /* SyntaxKind.RegularExpressionLiteral */: return globalRegExpType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return checkArrayLiteral(node, checkMode, forceTuple); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return checkObjectLiteral(node, checkMode); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return checkPropertyAccessExpression(node, checkMode); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return checkQualifiedName(node, checkMode); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return checkIndexedAccess(node, checkMode); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (node.expression.kind === 100 /* SyntaxKind.ImportKeyword */) { return checkImportCallExpression(node); } // falls through - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checkCallExpression(node, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return checkParenthesizedExpression(node, checkMode); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return checkClassExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return checkTypeOfExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return checkAssertion(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return checkNonNullAssertion(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return checkExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return checkSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return checkMetaProperty(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkDeleteExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return checkVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return checkAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checkBinaryExpression(node, checkMode); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return checkConditionalExpression(node, checkMode); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return checkSpreadExpression(node, checkMode); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return undefinedWideningType; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return checkYieldExpression(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return checkSyntheticExpression(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return checkJsxExpression(node, checkMode); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return checkJsxElement(node, checkMode); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return checkJsxSelfClosingElement(node, checkMode); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return checkJsxFragment(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return checkJsxAttributes(node, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return errorType; @@ -80879,10 +81734,10 @@ var ts; checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); if (ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { - if (!(func.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } - if (func.kind === 171 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { + if (func.kind === 173 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); } } @@ -80893,13 +81748,13 @@ var ts; if (func.parameters.indexOf(node) !== 0) { error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } - if (func.kind === 171 /* SyntaxKind.Constructor */ || func.kind === 175 /* SyntaxKind.ConstructSignature */ || func.kind === 180 /* SyntaxKind.ConstructorType */) { + if (func.kind === 173 /* SyntaxKind.Constructor */ || func.kind === 177 /* SyntaxKind.ConstructSignature */ || func.kind === 182 /* SyntaxKind.ConstructorType */) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter); } - if (func.kind === 172 /* SyntaxKind.GetAccessor */ || func.kind === 173 /* SyntaxKind.SetAccessor */) { + if (func.kind === 174 /* SyntaxKind.GetAccessor */ || func.kind === 175 /* SyntaxKind.SetAccessor */) { error(node, ts.Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); } } @@ -80957,13 +81812,13 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 179 /* SyntaxKind.FunctionType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 181 /* SyntaxKind.FunctionType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var parent = node.parent; if (node === parent.type) { return parent; @@ -80981,7 +81836,7 @@ var ts; error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + else if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -80990,13 +81845,13 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 176 /* SyntaxKind.IndexSignature */) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */) { checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === 179 /* SyntaxKind.FunctionType */ || node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 180 /* SyntaxKind.ConstructorType */ || - node.kind === 174 /* SyntaxKind.CallSignature */ || node.kind === 171 /* SyntaxKind.Constructor */ || - node.kind === 175 /* SyntaxKind.ConstructSignature */) { + else if (node.kind === 181 /* SyntaxKind.FunctionType */ || node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 182 /* SyntaxKind.ConstructorType */ || + node.kind === 176 /* SyntaxKind.CallSignature */ || node.kind === 173 /* SyntaxKind.Constructor */ || + node.kind === 177 /* SyntaxKind.ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } var functionFlags = ts.getFunctionFlags(node); @@ -81028,10 +81883,10 @@ var ts; var returnTypeNode = ts.getEffectiveReturnTypeNode(node); if (noImplicitAny && !returnTypeNode) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -81061,7 +81916,7 @@ var ts; checkAsyncFunctionReturnType(node, returnTypeNode); } } - if (node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 317 /* SyntaxKind.JSDocFunctionType */) { + if (node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 320 /* SyntaxKind.JSDocFunctionType */) { registerForUnusedIdentifiersCheck(node); } } @@ -81073,7 +81928,7 @@ var ts; var privateIdentifiers = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */) { + if (member.kind === 173 /* SyntaxKind.Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param, member) && !ts.isBindingPattern(param.name)) { @@ -81095,16 +81950,16 @@ var ts; var memberName = name && ts.getPropertyNameForPropertyNameNode(name); if (memberName) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: addName(names, name, memberName, 1 /* DeclarationMeaning.GetAccessor */ | privateStaticFlags); break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: addName(names, name, memberName, 2 /* DeclarationMeaning.SetAccessor */ | privateStaticFlags); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: addName(names, name, memberName, 3 /* DeclarationMeaning.GetOrSetAccessor */ | privateStaticFlags); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: addName(names, name, memberName, 8 /* DeclarationMeaning.Method */ | privateStaticFlags); break; } @@ -81176,7 +82031,7 @@ var ts; var names = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 166 /* SyntaxKind.PropertySignature */) { + if (member.kind === 168 /* SyntaxKind.PropertySignature */) { var memberName = void 0; var name = member.name; switch (name.kind) { @@ -81201,7 +82056,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -81249,7 +82104,7 @@ var ts; checkVariableLikeDeclaration(node); setNodeLinksForPrivateIdentifierScope(node); // property signatures already report "initializer not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { error(node, ts.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -81269,7 +82124,7 @@ var ts; // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration checkFunctionOrMethodDeclaration(node); // method signatures already report "implementation not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.body) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } // Private named methods are only allowed in class declarations @@ -81322,7 +82177,7 @@ var ts; if (ts.isPrivateIdentifierClassElementDeclaration(n)) { return true; } - return n.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return n.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(n) && !!n.initializer; } @@ -81405,7 +82260,7 @@ var ts; checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { if (!(node.flags & 16777216 /* NodeFlags.Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 256 /* NodeFlags.HasImplicitReturn */)) { if (!(node.flags & 512 /* NodeFlags.HasExplicitReturn */)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); @@ -81415,20 +82270,20 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. var symbol = getSymbolOfNode(node); - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); if (getter && setter && !(getNodeCheckFlags(getter) & 1 /* NodeCheckFlags.TypeChecked */)) { getNodeLinks(getter).flags |= 1 /* NodeCheckFlags.TypeChecked */; var getterFlags = ts.getEffectiveModifierFlags(getter); var setterFlags = ts.getEffectiveModifierFlags(setter); - if ((getterFlags & 128 /* ModifierFlags.Abstract */) !== (setterFlags & 128 /* ModifierFlags.Abstract */)) { + if ((getterFlags & 256 /* ModifierFlags.Abstract */) !== (setterFlags & 256 /* ModifierFlags.Abstract */)) { error(getter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); error(setter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } @@ -81445,7 +82300,7 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } @@ -81491,7 +82346,7 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); - if (node.kind === 178 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } ts.forEach(node.typeArguments, checkSourceElement); @@ -81507,7 +82362,7 @@ var ts; } var symbol = getNodeLinks(node).resolvedSymbol; if (symbol) { - if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) { + if (ts.some(symbol.declarations, function (d) { return ts.isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) { addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName); } if (type.flags & 32 /* TypeFlags.Enum */ && symbol.flags & 8 /* SymbolFlags.EnumMember */) { @@ -81549,7 +82404,7 @@ var ts; var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember); for (var _i = 0, elementTypes_1 = elementTypes; _i < elementTypes_1.length; _i++) { var e = elementTypes_1[_i]; - if (e.kind !== 197 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { + if (e.kind !== 199 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); break; } @@ -81598,7 +82453,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) { - if (accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(objectType) & 1 /* MappedTypeModifiers.IncludeReadonly */) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -81663,7 +82518,7 @@ var ts; ts.forEachChild(node, checkSourceElement); } function checkInferType(node) { - if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 189 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { + if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 191 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter); @@ -81673,7 +82528,7 @@ var ts; if (!links.typeParametersChecked) { links.typeParametersChecked = true; var typeParameter = getDeclaredTypeOfTypeParameter(symbol); - var declarations = ts.getDeclarationsOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var declarations = ts.getDeclarationsOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) { // Report an error on every conflicting declaration. var name = symbolToString(symbol); @@ -81714,10 +82569,10 @@ var ts; if (node.dotDotDotToken && node.questionToken) { grammarErrorOnNode(node, ts.Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); } - if (node.type.kind === 185 /* SyntaxKind.OptionalType */) { + if (node.type.kind === 187 /* SyntaxKind.OptionalType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type); } - if (node.type.kind === 186 /* SyntaxKind.RestType */) { + if (node.type.kind === 188 /* SyntaxKind.RestType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); } checkSourceElement(node.type); @@ -81730,9 +82585,9 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */ && - n.parent.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - n.parent.kind !== 226 /* SyntaxKind.ClassExpression */ && + if (n.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */ && + n.parent.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + n.parent.kind !== 228 /* SyntaxKind.ClassExpression */ && n.flags & 16777216 /* NodeFlags.Ambient */) { if (!(flags & 2 /* ModifierFlags.Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) { // It is nested in an ambient context, which means it is automatically exported @@ -81772,7 +82627,7 @@ var ts; else if (deviation & (8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { error(ts.getNameOfDeclaration(o) || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } - else if (deviation & 128 /* ModifierFlags.Abstract */) { + else if (deviation & 256 /* ModifierFlags.Abstract */) { error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); @@ -81789,7 +82644,7 @@ var ts; }); } } - var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 128 /* ModifierFlags.Abstract */; + var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 256 /* ModifierFlags.Abstract */; var someNodeFlags = 0 /* ModifierFlags.None */; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -81828,7 +82683,7 @@ var ts; // Both are literal property names that are the same. ts.isPropertyNameLiteral(node.name) && ts.isPropertyNameLiteral(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) { - var reportError = (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */) && + var reportError = (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */) && ts.isStatic(node) !== ts.isStatic(subsequentNode); // we can get here in two cases // 1. mixed static and instance class members @@ -81853,7 +82708,7 @@ var ts; else { // Report different errors regarding non-consecutive blocks of declarations depending on whether // the node in question is abstract. - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -81870,7 +82725,7 @@ var ts; var current = declarations_5[_i]; var node = current; var inAmbientContext = node.flags & 16777216 /* NodeFlags.Ambient */; - var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) || inAmbientContext; + var inAmbientContextOrInterface = node.parent && (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -81881,10 +82736,10 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if ((node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { + if ((node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { hasNonAmbientClass = true; } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */ || node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */ || node.kind === 173 /* SyntaxKind.Constructor */) { functionDeclarations.push(node); var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; @@ -81929,12 +82784,12 @@ var ts; }); } if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* SymbolFlags.Function */ && declarations) { - var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 257 /* SyntaxKind.ClassDeclaration */; }) + var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 260 /* SyntaxKind.ClassDeclaration */; }) .map(function (d) { return ts.createDiagnosticForNode(d, ts.Diagnostics.Consider_adding_a_declare_modifier_to_this_class); }); ts.forEach(declarations, function (declaration) { - var diagnostic = declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + var diagnostic = declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ ? ts.Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 - : declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ + : declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : undefined; if (diagnostic) { @@ -81944,7 +82799,7 @@ var ts; } // Abstract methods can't have an implementation -- in particular, they don't need one. if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 128 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { + !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 256 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -81990,9 +82845,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */); + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */); if (effectiveDeclarationFlags & 1 /* ModifierFlags.Export */) { - if (effectiveDeclarationFlags & 512 /* ModifierFlags.Default */) { + if (effectiveDeclarationFlags & 1024 /* ModifierFlags.Default */) { defaultExportedDeclarationSpaces |= declarationSpaces; } else { @@ -82025,26 +82880,26 @@ var ts; function getDeclarationSpaces(decl) { var d = decl; switch (d.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // A jsdoc typedef and callback are, by definition, type aliases. // falls through - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return 2 /* DeclarationSpaces.ExportType */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* ModuleInstanceState.NonInstantiated */ ? 4 /* DeclarationSpaces.ExportNamespace */ | 1 /* DeclarationSpaces.ExportValue */ : 4 /* DeclarationSpaces.ExportNamespace */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */ | 4 /* DeclarationSpaces.ExportNamespace */; - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: var node_2 = d; var expression = ts.isExportAssignment(node_2) ? node_2.expression : node_2.right; // Export assigned entity name expressions act as aliases and should fall through, otherwise they export values @@ -82054,19 +82909,19 @@ var ts; d = expression; // The below options all declare an Alias, which is allowed to merge with other values within the importing module. // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: var result_12 = 0 /* DeclarationSpaces.None */; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_12 |= getDeclarationSpaces(d); }); return result_12; - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 case 79 /* SyntaxKind.Identifier */: // https://github.com/microsoft/TypeScript/issues/36098 // Identifiers are used as declarations of assignment declarations whose parents may be // SyntaxKind.CallExpression - `Object.defineProperty(thing, "aField", {value: 42});` @@ -82110,7 +82965,7 @@ var ts; return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0]; } // primitives with a `{ then() }` won't be unwrapped/adopted. - if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { return undefined; } var thenFunction = getTypeOfPropertyOfType(type, "then"); // TODO: GH#18217 @@ -82177,7 +83032,7 @@ var ts; * Determines whether a type is an object with a callable `then` member. */ function isThenableType(type) { - if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { // primitive types cannot be considered "thenable" since they are not objects. return false; } @@ -82211,7 +83066,7 @@ var ts; // We only need `Awaited` if `T` is a type variable that has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`, // or is promise-like. if (baseConstraint ? - baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) : + baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) : maybeTypeOfKind(type, 8650752 /* TypeFlags.TypeVariable */)) { return true; } @@ -82479,20 +83334,20 @@ var ts; var headMessage; var expectedReturnType; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: headMessage = ts.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; expectedReturnType = voidType; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); @@ -82551,15 +83406,15 @@ var ts; function getEntityNameForDecoratorMetadata(node) { if (node) { switch (node.kind) { - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: return getEntityNameForDecoratorMetadataFromTypeList(node.types); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return getEntityNameForDecoratorMetadata(node.type); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; } } @@ -82568,13 +83423,13 @@ var ts; var commonEntityName; for (var _i = 0, types_21 = types; _i < types_21.length; _i++) { var typeNode = types_21[_i]; - while (typeNode.kind === 191 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 197 /* SyntaxKind.NamedTupleMember */) { + while (typeNode.kind === 193 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 199 /* SyntaxKind.NamedTupleMember */) { typeNode = typeNode.type; // Skip parens if need be } - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { continue; // Always elide `never` from the union/intersection if possible } - if (!strictNullChecks && (typeNode.kind === 196 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && (typeNode.kind === 198 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var individualEntityName = getEntityNameForDecoratorMetadata(typeNode); @@ -82620,14 +83475,14 @@ var ts; return; } checkExternalEmitHelpers(firstDecorator, 8 /* ExternalEmitHelpers.Decorate */); - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { checkExternalEmitHelpers(firstDecorator, 32 /* ExternalEmitHelpers.Param */); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16 /* ExternalEmitHelpers.Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -82636,23 +83491,23 @@ var ts; } } break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - var otherKind = node.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + var otherKind = node.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node)); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node)); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); var containingSignature = node.parent; for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) { @@ -82754,7 +83609,7 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; default: return undefined; @@ -82768,7 +83623,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -82794,7 +83649,7 @@ var ts; checkFunctionOrConstructorSymbol(symbol); } } - var body = node.kind === 168 /* SyntaxKind.MethodSignature */ ? undefined : node.body; + var body = node.kind === 170 /* SyntaxKind.MethodSignature */ ? undefined : node.body; checkSourceElement(body); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node)); addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics); @@ -82840,42 +83695,42 @@ var ts; for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) { var node = potentiallyUnusedIdentifiers_1[_i]; switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: checkUnusedClassMembers(node, addDiagnostic); checkUnusedTypeParameters(node, addDiagnostic); break; - case 305 /* SyntaxKind.SourceFile */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 308 /* SyntaxKind.SourceFile */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: checkUnusedLocalsAndParameters(node, addDiagnostic); break; - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.body) { // Don't report unused parameters in overloads checkUnusedLocalsAndParameters(node, addDiagnostic); } checkUnusedTypeParameters(node, addDiagnostic); break; - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: checkUnusedTypeParameters(node, addDiagnostic); break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: checkUnusedInferTypeParameter(node, addDiagnostic); break; default: @@ -82885,7 +83740,7 @@ var ts; } function errorUnusedLocal(declaration, name, addDiagnostic) { var node = ts.getNameOfDeclaration(declaration) || declaration; - var message = isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read; + var message = ts.isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read; addDiagnostic(declaration, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(node, message, name)); } function isIdentifierThatStartsWithUnderscore(node) { @@ -82895,11 +83750,11 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { // Already would have reported an error on the getter. break; } @@ -82910,7 +83765,7 @@ var ts; addDiagnostic(member, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.hasSyntacticModifier(parameter, 8 /* ModifierFlags.Private */)) { @@ -82918,9 +83773,9 @@ var ts; } } break; - case 176 /* SyntaxKind.IndexSignature */: - case 234 /* SyntaxKind.SemicolonClassElement */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 237 /* SyntaxKind.SemicolonClassElement */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Can't be private break; default: @@ -82948,7 +83803,7 @@ var ts; continue; var name = ts.idText(typeParameter.name); var parent = typeParameter.parent; - if (parent.kind !== 190 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { + if (parent.kind !== 192 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { if (ts.tryAddToSet(seenParentsWithEveryUnused, parent)) { var sourceFile = ts.getSourceFileOfNode(parent); var range = ts.isJSDocTemplateTag(parent) @@ -83054,7 +83909,7 @@ var ts; var importDecl = importClause.parent; var nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? - (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) + (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) : 0); if (nDeclarations === unuseds.length) { addDiagnostic(importDecl, 0 /* UnusedKind.Local */, unuseds.length === 1 @@ -83072,7 +83927,7 @@ var ts; var bindingPattern = _a[0], bindingElements = _a[1]; var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* UnusedKind.Parameter */ : 0 /* UnusedKind.Local */; if (bindingPattern.elements.length === bindingElements.length) { - if (bindingElements.length === 1 && bindingPattern.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (bindingElements.length === 1 && bindingPattern.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId); } else { @@ -83093,7 +83948,7 @@ var ts; if (declarationList.declarations.length === declarations.length) { addDiagnostic(declarationList, 0 /* UnusedKind.Local */, declarations.length === 1 ? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name)) - : ts.createDiagnosticForNode(declarationList.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); + : ts.createDiagnosticForNode(declarationList.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); } else { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -83123,22 +83978,22 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return ts.idText(name); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name); default: return ts.Debug.assertNever(name); } } function isImportedDeclaration(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */ || node.kind === 270 /* SyntaxKind.ImportSpecifier */ || node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 270 /* SyntaxKind.ImportClause */ || node.kind === 273 /* SyntaxKind.ImportSpecifier */ || node.kind === 271 /* SyntaxKind.NamespaceImport */; } function importClauseFromImported(decl) { - return decl.kind === 267 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 268 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; + return decl.kind === 270 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 271 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 235 /* SyntaxKind.Block */) { + if (node.kind === 238 /* SyntaxKind.Block */) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -83173,13 +84028,13 @@ var ts; if ((identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) !== name) { return false; } - if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */ || - node.kind === 168 /* SyntaxKind.MethodSignature */ || - node.kind === 172 /* SyntaxKind.GetAccessor */ || - node.kind === 173 /* SyntaxKind.SetAccessor */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */ || + node.kind === 170 /* SyntaxKind.MethodSignature */ || + node.kind === 174 /* SyntaxKind.GetAccessor */ || + node.kind === 175 /* SyntaxKind.SetAccessor */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */) { // it is ok to have member named '_super', '_this', `Promise`, etc. - member access is always qualified return false; } @@ -83245,7 +84100,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83260,7 +84115,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83360,7 +84215,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -83372,17 +84227,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* SymbolFlags.BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* NodeFlags.BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); - var container = varDeclList.parent.kind === 237 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); + var container = varDeclList.parent.kind === 240 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || - container.kind === 262 /* SyntaxKind.ModuleBlock */ || - container.kind === 261 /* SyntaxKind.ModuleDeclaration */ || - container.kind === 305 /* SyntaxKind.SourceFile */); + (container.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || + container.kind === 265 /* SyntaxKind.ModuleBlock */ || + container.kind === 264 /* SyntaxKind.ModuleDeclaration */ || + container.kind === 308 /* SyntaxKind.SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -83413,7 +84268,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); if (ts.hasOnlyExpressionInitializer(node) && node.initializer) { checkExpressionCached(node.initializer); @@ -83435,7 +84290,7 @@ var ts; checkExternalEmitHelpers(node, 4 /* ExternalEmitHelpers.Rest */); } // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access @@ -83457,7 +84312,7 @@ var ts; } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { + if (node.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* ExternalEmitHelpers.Read */); } ts.forEach(node.name.elements, checkSourceElement); @@ -83469,7 +84324,7 @@ var ts; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { - var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */; + var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */; var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression)); if (needCheckInitializer || needCheckWidenedType) { // Don't validate for-in initializer as it is already an error @@ -83497,7 +84352,7 @@ var ts; } // For a commonjs `const x = require`, validate the alias and exit var symbol = getSymbolOfNode(node); - if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { + if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 205 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { checkAliasSymbol(node); return; } @@ -83511,7 +84366,7 @@ var ts; ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) && !!((_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.size); - if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */) { + if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */) { checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined); } } @@ -83537,10 +84392,10 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionsForDeclarationName(node, node.name); @@ -83548,7 +84403,7 @@ var ts; } function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) { var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration); - var message = nextDeclaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 166 /* SyntaxKind.PropertySignature */ + var message = nextDeclaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 168 /* SyntaxKind.PropertySignature */ ? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; var declName = ts.declarationNameToString(nextDeclarationName); @@ -83558,8 +84413,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 164 /* SyntaxKind.Parameter */ && right.kind === 254 /* SyntaxKind.VariableDeclaration */) || - (left.kind === 254 /* SyntaxKind.VariableDeclaration */ && right.kind === 164 /* SyntaxKind.Parameter */)) { + if ((left.kind === 166 /* SyntaxKind.Parameter */ && right.kind === 257 /* SyntaxKind.VariableDeclaration */) || + (left.kind === 257 /* SyntaxKind.VariableDeclaration */ && right.kind === 166 /* SyntaxKind.Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -83568,8 +84423,8 @@ var ts; } var interestingFlags = 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | - 256 /* ModifierFlags.Async */ | - 128 /* ModifierFlags.Abstract */ | + 512 /* ModifierFlags.Async */ | + 256 /* ModifierFlags.Abstract */ | 64 /* ModifierFlags.Readonly */ | 32 /* ModifierFlags.Static */; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); @@ -83598,15 +84453,15 @@ var ts; function checkIfStatement(node) { // Grammar checking checkGrammarStatementInAmbientContext(node); - checkTruthinessExpression(node.expression); - checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement); + var type = checkTruthinessExpression(node.expression); + checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 236 /* SyntaxKind.EmptyStatement */) { + if (node.thenStatement.kind === 239 /* SyntaxKind.EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); } - function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) { + function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) { if (!strictNullChecks) return; helper(condExpr, body); @@ -83621,7 +84476,7 @@ var ts; : condExpr; if (ts.isModuleExportsAccessExpression(location)) return; - var type = checkTruthinessExpression(location); + var type = location === condExpr ? condType : checkTruthinessExpression(location); var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression); if (!(getTypeFacts(type) & 4194304 /* TypeFacts.Truthy */) || isPropertyExpressionCast) return; @@ -83735,12 +84590,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -83780,14 +84635,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node); // There may be a destructuring assignment on the left side - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -83819,7 +84674,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -83833,7 +84688,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -84315,7 +85170,16 @@ var ts; var message = allowAsyncIterables ? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator : ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator; - return errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type)); + var suggestAwait = + // for (const x of Promise<...>) or [...Promise<...>] + !!getAwaitedTypeOfPromise(type) + // for (const x of AsyncIterable<...>) + || (!allowAsyncIterables && + ts.isForOfStatement(errorNode.parent) && + errorNode.parent.expression === errorNode && + getGlobalAsyncIterableType(/** reportErrors */ false) !== emptyGenericType && + isTypeAssignableTo(type, getGlobalAsyncIterableType(/** reportErrors */ false))); + return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type)); } /** * Gets the *yield*, *return*, and *next* types from an `Iterator`-like or `AsyncIterator`-like type. @@ -84633,12 +85497,12 @@ var ts; var functionFlags = ts.getFunctionFlags(container); if (strictNullChecks || node.expression || returnType.flags & 131072 /* TypeFlags.Never */) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (container.kind === 173 /* SyntaxKind.SetAccessor */) { + if (container.kind === 175 /* SyntaxKind.SetAccessor */) { if (node.expression) { error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -84656,7 +85520,7 @@ var ts; } } } - else if (container.kind !== 171 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { + else if (container.kind !== 173 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { // The function has a return type, but the return statement doesn't have an expression. error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -84685,7 +85549,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -84694,7 +85558,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause)); } ts.forEach(clause.statements, checkSourceElement); @@ -84731,7 +85595,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 250 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { + if (current.kind === 253 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -84826,9 +85690,9 @@ var ts; return; } var indexInfos = getApplicableIndexInfos(type, propNameType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; - var propDeclaration = declaration && declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || - name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || + name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined; var _loop_30 = function (info) { var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; @@ -84853,7 +85717,7 @@ var ts; function checkIndexConstraintForIndexSignature(type, checkInfo) { var declaration = checkInfo.declaration; var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined; var _loop_31 = function (info) { if (info === checkInfo) @@ -84925,7 +85789,7 @@ var ts; } else { ts.forEach(jsdocParameters, function (_a, index) { - var name = _a.name; + var name = _a.name, isNameFirst = _a.isNameFirst; if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) { return; } @@ -84935,7 +85799,9 @@ var ts; } } else { - errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name)); + if (!isNameFirst) { + errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name)); + } } }); } @@ -84973,7 +85839,7 @@ var ts; function checkTypeParametersNotReferenced(root, typeParameters, index) { visit(root); function visit(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */) { var type = getTypeFromTypeReference(node); if (type.flags & 262144 /* TypeFlags.TypeParameter */) { for (var i = index; i < typeParameters.length; i++) { @@ -85063,7 +85929,7 @@ var ts; if (firstDecorator && ts.some(node.members, function (p) { return ts.hasStaticModifier(p) && ts.isPrivateIdentifierClassElementDeclaration(p); })) { grammarErrorOnNode(firstDecorator, ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator); } - if (!node.name && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (!node.name && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -85130,7 +85996,7 @@ var ts; } else { var constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); - if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(node.name || node, ts.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract); } } @@ -85365,7 +86231,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 257 /* SyntaxKind.ClassDeclaration */ || d.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return d.kind === 260 /* SyntaxKind.ClassDeclaration */ || d.kind === 261 /* SyntaxKind.InterfaceDeclaration */; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -85406,7 +86272,7 @@ var ts; // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. - if (baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 128 /* ModifierFlags.Abstract */))) { + if (baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 256 /* ModifierFlags.Abstract */))) { // Searches other base types for a declaration that would satisfy the inherited abstract member. // (The class may have more than one base type via declaration merging with an interface with the // same name.) @@ -85420,7 +86286,7 @@ var ts; return "continue-basePropertyCheck"; } } - if (derivedClassDecl.kind === 226 /* SyntaxKind.ClassExpression */) { + if (derivedClassDecl.kind === 228 /* SyntaxKind.ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -85455,11 +86321,11 @@ var ts; error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type)); } else if (useDefineForClassFields) { - var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); + var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); if (uninitialized && !(derived.flags & 33554432 /* SymbolFlags.Transient */) - && !(baseDeclarationFlags & 128 /* ModifierFlags.Abstract */) - && !(derivedDeclarationFlags & 128 /* ModifierFlags.Abstract */) + && !(baseDeclarationFlags & 256 /* ModifierFlags.Abstract */) + && !(derivedDeclarationFlags & 256 /* ModifierFlags.Abstract */) && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* NodeFlags.Ambient */); }))) { var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol)); var propName = uninitialized.name; @@ -85502,7 +86368,7 @@ var ts; } } function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) { - return baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) + return baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) || ts.isInterfaceDeclaration(declaration.parent); } function getNonInheritedProperties(type, baseTypes, properties) { @@ -85584,7 +86450,7 @@ var ts; } } function isPropertyWithoutInitializer(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; @@ -85627,7 +86493,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -85660,7 +86526,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); checkExportsOnMergedDeclarations(node); checkTypeParameters(node.typeParameters); - if (node.type.kind === 138 /* SyntaxKind.IntrinsicKeyword */) { + if (node.type.kind === 139 /* SyntaxKind.IntrinsicKeyword */) { if (!intrinsicTypeKinds.has(node.name.escapedText) || ts.length(node.typeParameters) !== 1) { error(node.type, ts.Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); } @@ -85746,7 +86612,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -85756,7 +86622,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -85785,7 +86651,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: checkGrammarNumericLiteral(expr); return +expr.text; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return evaluate(expr.expression); case 79 /* SyntaxKind.Identifier */: var identifier = expr; @@ -85793,13 +86659,13 @@ var ts; return +(identifier.escapedText); } return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (isConstantMemberAccess(expr)) { var type = getTypeOfExpression(expr.expression); if (type.symbol && type.symbol.flags & 384 /* SymbolFlags.Enum */) { var name = void 0; - if (expr.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (expr.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { name = expr.name.escapedText; } else { @@ -85836,8 +86702,8 @@ var ts; return false; } return node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || - node.kind === 207 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && + node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || + node.kind === 209 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && ts.isStringLiteralLike(node.argumentExpression); } function checkEnumDeclaration(node) { @@ -85871,7 +86737,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -85900,8 +86766,8 @@ var ts; if (declarations) { for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; - if ((declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || - (declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || + (declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { return declaration; } @@ -85972,7 +86838,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 257 /* SyntaxKind.ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 260 /* SyntaxKind.ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* NodeCheckFlags.LexicalModuleMergesWithClass */; @@ -86015,56 +86881,43 @@ var ts; } } function checkModuleAugmentationElement(node, isGlobalAugmentation) { - var _a; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement - for (var _i = 0, _b = node.declarationList.declarations; _i < _b.length; _i++) { - var decl = _b[_i]; + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 203 /* SyntaxKind.BindingElement */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: var name = node.name; if (ts.isBindingPattern(name)) { - for (var _c = 0, _d = name.elements; _c < _d.length; _c++) { - var el = _d[_c]; + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { + var el = _c[_b]; // mark individual names in binding pattern checkModuleAugmentationElement(el, isGlobalAugmentation); } break; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } - var symbol = getSymbolOfNode(node); - if (symbol) { - // module augmentations cannot introduce new names on the top level scope of the module - // this is done it two steps - // 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error - // 2. main check - report error if value declaration of the parent symbol is module augmentation) - var reportError = !(symbol.flags & 33554432 /* SymbolFlags.Transient */); - if (!reportError) { - // symbol should not originate in augmentation - reportError = !!((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.declarations) && ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); - } - } break; } } @@ -86072,12 +86925,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { if (ts.isModuleExportsAccessExpression(node.expression) && !ts.isPrivateIdentifier(node.name)) { return node.name; @@ -86097,9 +86950,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 272 /* SyntaxKind.ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 275 /* SyntaxKind.ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -86146,8 +86999,8 @@ var ts; var errorNode = ts.isImportOrExportSpecifier(node) ? node.propertyName || node.name : ts.isNamedDeclaration(node) ? node.name : node; - ts.Debug.assert(node.kind !== 274 /* SyntaxKind.NamespaceExport */); - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */) { + ts.Debug.assert(node.kind !== 277 /* SyntaxKind.NamespaceExport */); + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */) { var diag = error(errorNode, ts.Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files); var alreadyExportedSymbol = (_b = (_a = ts.getSourceFileOfNode(node).symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.get((node.propertyName || node.name).escapedText); if (alreadyExportedSymbol === target) { @@ -86158,7 +87011,7 @@ var ts; } } else { - ts.Debug.assert(node.kind !== 254 /* SyntaxKind.VariableDeclaration */); + ts.Debug.assert(node.kind !== 257 /* SyntaxKind.VariableDeclaration */); var importDeclaration = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)); var moduleSpecifier = (_e = (importDeclaration && ((_d = ts.tryGetModuleSpecifierFromDeclaration(importDeclaration)) === null || _d === void 0 ? void 0 : _d.text))) !== null && _e !== void 0 ? _e : "..."; var importedIdentifier = ts.unescapeLeadingUnderscores(ts.isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName); @@ -86166,11 +87019,12 @@ var ts; } return; } + var targetFlags = getAllSymbolFlags(target); var excludedMeanings = (symbol.flags & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */) ? 111551 /* SymbolFlags.Value */ : 0) | (symbol.flags & 788968 /* SymbolFlags.Type */ ? 788968 /* SymbolFlags.Type */ : 0) | (symbol.flags & 1920 /* SymbolFlags.Namespace */ ? 1920 /* SymbolFlags.Namespace */ : 0); - if (target.flags & excludedMeanings) { - var message = node.kind === 275 /* SyntaxKind.ExportSpecifier */ ? + if (targetFlags & excludedMeanings) { + var message = node.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -86179,26 +87033,26 @@ var ts; && !ts.isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 16777216 /* NodeFlags.Ambient */)) { var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol); - var isType = !(target.flags & 111551 /* SymbolFlags.Value */); + var isType = !(targetFlags & 111551 /* SymbolFlags.Value */); if (isType || typeOnlyAlias) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { if (compilerOptions.preserveValueImports) { ts.Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name"); var message = isType ? ts.Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled : ts.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled; - var name = ts.idText(node.kind === 270 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); + var name = ts.idText(node.kind === 273 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name); } - if (isType && node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { + if (isType && node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided); } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // Don't allow re-exporting an export that will be elided when `--isolatedModules` is set. // The exception is that `import type { A } from './a'; export { A }` is allowed // because single-file analysis can determine that the export should be dropped. @@ -86257,7 +87111,7 @@ var ts; function checkImportBinding(node) { checkCollisionsForDeclarationName(node, node.name); checkAliasSymbol(node); - if (node.kind === 270 /* SyntaxKind.ImportSpecifier */ && + if (node.kind === 273 /* SyntaxKind.ImportSpecifier */ && ts.idText(node.propertyName || node.name) === "default" && ts.getESModuleInterop(compilerOptions) && moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) { @@ -86307,7 +87161,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { checkImportBinding(importClause.namedBindings); if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && ts.getESModuleInterop(compilerOptions)) { // import * as ns from "foo"; @@ -86336,17 +87190,18 @@ var ts; if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */) { + if (node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { - if (target.flags & 111551 /* SymbolFlags.Value */) { + var targetFlags = getAllSymbolFlags(target); + if (targetFlags & 111551 /* SymbolFlags.Value */) { // Target is a value symbol, check that it is not hidden by a local declaration with the same name var moduleName = ts.getFirstIdentifier(node.moduleReference); if (!(resolveEntityName(moduleName, 111551 /* SymbolFlags.Value */ | 1920 /* SymbolFlags.Namespace */).flags & 1920 /* SymbolFlags.Namespace */)) { error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName)); } } - if (target.flags & 788968 /* SymbolFlags.Type */) { + if (targetFlags & 788968 /* SymbolFlags.Type */) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0); } } @@ -86379,10 +87234,10 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* NodeFlags.Ambient */; - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -86417,7 +87272,7 @@ var ts; function checkGrammarExportDeclaration(node) { var _a; if (node.isTypeOnly) { - if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 273 /* SyntaxKind.NamedExports */) { + if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 276 /* SyntaxKind.NamedExports */) { return checkGrammarNamedImportsOrExports(node.exportClause); } else { @@ -86427,7 +87282,7 @@ var ts; return false; } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 305 /* SyntaxKind.SourceFile */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 308 /* SyntaxKind.SourceFile */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -86485,7 +87340,7 @@ var ts; markExportAsReferenced(node); } var target = symbol && (symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol); - if (!target || target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (!target || getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) { checkExpressionCached(node.propertyName || node.name); } } @@ -86507,8 +87362,8 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -86532,7 +87387,7 @@ var ts; markAliasReferenced(sym, id); // If not a value, we're interpreting the identifier as a type export, along the lines of (`export { Id as default }`) var target = sym.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(sym) : sym; - if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) { // However if it is a value, we need to check it's being used correctly checkExpressionCached(node.expression); } @@ -86640,181 +87495,181 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } - if (kind >= 237 /* SyntaxKind.FirstStatement */ && kind <= 253 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { + if (kind >= 240 /* SyntaxKind.FirstStatement */ && kind <= 256 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, ts.Diagnostics.Unreachable_code_detected); } switch (kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return checkTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return checkParameter(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return checkPropertyDeclaration(node); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checkPropertySignature(node); - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return checkSignatureDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return checkMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return checkClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return checkConstructorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return checkAccessorDeclaration(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return checkTypeReferenceNode(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return checkTypePredicate(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return checkTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return checkTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return checkArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return checkTupleType(node); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return checkUnionOrIntersectionType(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: return checkSourceElement(node.type); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return checkThisType(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return checkTypeOperator(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return checkConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return checkInferType(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return checkTemplateLiteralType(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return checkImportType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return checkNamedTupleMember(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return checkJSDocImplementsTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return checkJSDocTypeAliasTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return checkJSDocTemplateTag(node); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return checkJSDocTypeTag(node); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: + case 327 /* SyntaxKind.JSDocLink */: + case 328 /* SyntaxKind.JSDocLinkCode */: + case 329 /* SyntaxKind.JSDocLinkPlain */: return checkJSDocLinkLikeTag(node); - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return checkJSDocParameterTag(node); - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return checkJSDocPropertyTag(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: checkJSDocFunctionType(node); // falls through - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: checkJSDocVariadicType(node); return; - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return checkSourceElement(node.type); - case 333 /* SyntaxKind.JSDocPublicTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: return checkJSDocAccessibilityModifiers(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return checkIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return checkMappedType(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return checkFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return checkBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return checkVariableStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return checkExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return checkIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return checkDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return checkWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return checkForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return checkForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: return checkBreakOrContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return checkReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return checkSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return checkThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return checkTryStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checkVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return checkBindingElement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return checkClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return checkEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return checkModuleDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return checkImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return checkExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return checkExportAssignment(node); - case 236 /* SyntaxKind.EmptyStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -86921,36 +87776,36 @@ var ts; currentNode = node; instantiationCount = 0; switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: // These node kinds are deferred checked when overload resolution fails // To save on work, we ensure the arguments are checked just once, in // a deferred way resolveUntypedCall(node); break; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: checkAccessorDeclaration(node); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: checkClassExpressionDeferred(node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: checkTypeParameterDeferred(node); break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: checkJsxSelfClosingElementDeferred(node); break; - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: checkJsxElementDeferred(node); break; } @@ -87123,17 +87978,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalModule(location)) break; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: copyLocallyVisibleExportSymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* SymbolFlags.ModuleMember */); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* SymbolFlags.EnumMember */); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); @@ -87141,8 +87996,8 @@ var ts; // this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration. // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -87151,7 +88006,7 @@ var ts; copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968 /* SymbolFlags.Type */); } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -87195,7 +88050,7 @@ var ts; if (meaning) { source.forEach(function (symbol) { // Similar condition as in `resolveNameHelper` - if (!ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 274 /* SyntaxKind.NamespaceExport */)) { + if (!ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 277 /* SyntaxKind.NamespaceExport */)) { copySymbol(symbol, meaning); } }); @@ -87204,41 +88059,21 @@ var ts; } function isTypeDeclarationName(name) { return name.kind === 79 /* SyntaxKind.Identifier */ && - isTypeDeclaration(name.parent) && + ts.isTypeDeclaration(name.parent) && ts.getNameOfDeclaration(name.parent) === name; } - function isTypeDeclaration(node) { - switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - return true; - case 267 /* SyntaxKind.ImportClause */: - return node.isTypeOnly; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - return node.parent.parent.isTypeOnly; - default: - return false; - } - } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 178 /* SyntaxKind.TypeReference */; + return node.parent.kind === 180 /* SyntaxKind.TypeReference */; } function isHeritageClauseElementIdentifier(node) { - while (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - return node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -87266,13 +88101,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (nodeOnRightSide.parent.kind === 163 /* SyntaxKind.QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } - if (nodeOnRightSide.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } return undefined; @@ -87298,7 +88133,7 @@ var ts; node = parent; parent = parent.parent; } - if (parent && parent.kind === 200 /* SyntaxKind.ImportType */ && parent.qualifier === node) { + if (parent && parent.kind === 202 /* SyntaxKind.ImportType */ && parent.qualifier === node) { return parent; } return undefined; @@ -87308,7 +88143,7 @@ var ts; return getSymbolOfNode(name.parent); } if (ts.isInJSFile(name) && - name.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + name.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && name.parent === name.parent.parent.left) { // Check if this is a special property assignment if (!ts.isPrivateIdentifier(name) && !ts.isJSDocMemberName(name)) { @@ -87318,7 +88153,7 @@ var ts; } } } - if (name.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { + if (name.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { // Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression var success = resolveEntityName(name, /*all meanings*/ 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*ignoreErrors*/ true); @@ -87328,7 +88163,7 @@ var ts; } else if (ts.isEntityName(name) && isInRightSideOfImportOrExportAssignment(name)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(name, 265 /* SyntaxKind.ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(name, 268 /* SyntaxKind.ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(name, /*dontResolveAlias*/ true); } @@ -87346,7 +88181,7 @@ var ts; if (isHeritageClauseElementIdentifier(name)) { var meaning = 0 /* SymbolFlags.None */; // In an interface or class, we're definitely interested in a type. - if (name.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (name.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { meaning = 788968 /* SymbolFlags.Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) { @@ -87362,10 +88197,10 @@ var ts; return entityNameSymbol; } } - if (name.parent.kind === 340 /* SyntaxKind.JSDocParameterTag */) { + if (name.parent.kind === 343 /* SyntaxKind.JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(name.parent); } - if (name.parent.kind === 163 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 344 /* SyntaxKind.JSDocTemplateTag */) { + if (name.parent.kind === 165 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 347 /* SyntaxKind.JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJSFile(name)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(name.parent); return typeParameter && typeParameter.symbol; @@ -87389,18 +88224,53 @@ var ts; return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container)); } } + if (result && isJSDoc_1) { + var container = ts.getJSDocHost(name); + if (container && ts.isEnumMember(container) && container === result.valueDeclaration) { + return resolveEntityName(name, meaning, /*ignoreErrors*/ true, /* dontResolveAlias */ true, ts.getSourceFileOfNode(container)) || result; + } + } return result; } else if (ts.isPrivateIdentifier(name)) { return getSymbolForPrivateIdentifierExpression(name); } - else if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 161 /* SyntaxKind.QualifiedName */) { + else if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 163 /* SyntaxKind.QualifiedName */) { var links = getNodeLinks(name); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { checkPropertyAccessExpression(name, 0 /* CheckMode.Normal */); + if (!links.resolvedSymbol) { + var expressionType = checkExpressionCached(name.expression); + var infos = getApplicableIndexInfos(expressionType, getLiteralTypeFromPropertyName(name.name)); + if (infos.length && expressionType.members) { + var resolved = resolveStructuredTypeMembers(expressionType); + var symbol = resolved.members.get("__index" /* InternalSymbolName.Index */); + if (infos === getIndexInfosOfType(expressionType)) { + links.resolvedSymbol = symbol; + } + else if (symbol) { + var symbolLinks_1 = getSymbolLinks(symbol); + var declarationList = ts.mapDefined(infos, function (i) { return i.declaration; }); + var nodeListId = ts.map(declarationList, getNodeId).join(","); + if (!symbolLinks_1.filteredIndexSymbolCache) { + symbolLinks_1.filteredIndexSymbolCache = new ts.Map(); + } + if (symbolLinks_1.filteredIndexSymbolCache.has(nodeListId)) { + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + else { + var copy = createSymbol(131072 /* SymbolFlags.Signature */, "__index" /* InternalSymbolName.Index */); + copy.declarations = ts.mapDefined(infos, function (i) { return i.declaration; }); + copy.parent = expressionType.aliasSymbol ? expressionType.aliasSymbol : expressionType.symbol ? expressionType.symbol : getSymbolAtLocation(copy.declarations[0].parent); + symbolLinks_1.filteredIndexSymbolCache.set(nodeListId, copy); + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + } + } + } } else { checkQualifiedName(name, 0 /* CheckMode.Normal */); @@ -87415,11 +88285,11 @@ var ts; } } else if (isTypeReferenceIdentifier(name)) { - var meaning = name.parent.kind === 178 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; + var meaning = name.parent.kind === 180 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; var symbol = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name); } - if (name.parent.kind === 177 /* SyntaxKind.TypePredicate */) { + if (name.parent.kind === 179 /* SyntaxKind.TypePredicate */) { return resolveEntityName(name, /*meaning*/ 1 /* SymbolFlags.FunctionScopedVariable */); } return undefined; @@ -87453,7 +88323,7 @@ var ts; } } function getSymbolAtLocation(node, ignoreErrors) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } var parent = node.parent; @@ -87476,8 +88346,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } - else if (parent.kind === 203 /* SyntaxKind.BindingElement */ && - grandParent.kind === 201 /* SyntaxKind.ObjectBindingPattern */ && + else if (parent.kind === 205 /* SyntaxKind.BindingElement */ && + grandParent.kind === 203 /* SyntaxKind.ObjectBindingPattern */ && node === parent.propertyName) { var typeOfPattern = getTypeOfNode(grandParent); var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText); @@ -87504,8 +88374,8 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: if (!ts.isThisInTypeQuery(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } @@ -87522,14 +88392,14 @@ var ts; return checkExpression(node).symbol; } // falls through - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return getTypeFromThisTypeNode(node).symbol; case 106 /* SyntaxKind.SuperKeyword */: return checkExpression(node).symbol; - case 134 /* SyntaxKind.ConstructorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 171 /* SyntaxKind.Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 173 /* SyntaxKind.Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -87540,7 +88410,7 @@ var ts; // 3). Dynamic import call or require in javascript // 4). type A = import("./f/*gotToDefinitionHere*/oo") if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 272 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || + ((node.parent.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 275 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || ((ts.isInJSFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent)) || (ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) { return resolveExternalModuleName(node, node, ignoreErrors); @@ -87562,14 +88432,14 @@ var ts; case 38 /* SyntaxKind.EqualsGreaterThanToken */: case 84 /* SyntaxKind.ClassKeyword */: return getSymbolOfNode(node.parent); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : undefined; case 93 /* SyntaxKind.ExportKeyword */: return ts.isExportAssignment(node.parent) ? ts.Debug.checkDefined(node.parent.symbol) : undefined; case 100 /* SyntaxKind.ImportKeyword */: case 103 /* SyntaxKind.NewKeyword */: return ts.isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : undefined; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return checkExpression(node).symbol; default: return undefined; @@ -87585,7 +88455,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (location && location.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 111551 /* SymbolFlags.Value */ | 2097152 /* SymbolFlags.Alias */); } return undefined; @@ -87624,7 +88494,7 @@ var ts; var baseType = ts.firstOrUndefined(getBaseTypes(classType)); return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType; } - if (isTypeDeclaration(node)) { + if (ts.isTypeDeclaration(node)) { // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); @@ -87667,23 +88537,23 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfAssignmentPattern(expr) { - ts.Debug.assert(expr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (expr.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expr.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (expr.parent.kind === 299 /* SyntaxKind.PropertyAssignment */) { var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression); var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType; var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent); @@ -87731,7 +88601,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 10 /* SyntaxKind.StringLiteral */: return getStringLiteralType(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameType = checkComputedPropertyName(name); return isTypeAssignableToKind(nameType, 12288 /* TypeFlags.ESSymbolLike */) ? nameType : stringType; default: @@ -87819,7 +88689,7 @@ var ts; return symbolLinks.exportsSomeValue; function isValue(s) { s = resolveSymbol(s); - return s && !!(s.flags & 111551 /* SymbolFlags.Value */); + return s && !!(getAllSymbolFlags(s) & 111551 /* SymbolFlags.Value */); } } function isNameOfModuleOrEnumDeclaration(node) { @@ -87849,7 +88719,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 305 /* SyntaxKind.SourceFile */) { + if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 308 /* SyntaxKind.SourceFile */) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -87869,10 +88739,10 @@ var ts; } var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier); if (node) { - var symbol = getReferencedValueSymbol(node); + var symbol = getReferencedValueOrAliasSymbol(node); // We should only get the declaration of an alias if there isn't a local value // declaration for the symbol - if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) { return getDeclarationOfAliasSymbol(symbol); } } @@ -87881,7 +88751,7 @@ var ts; function isSymbolOfDestructuredElementOfCatchBinding(symbol) { return symbol.valueDeclaration && ts.isBindingElement(symbol.valueDeclaration) - && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 292 /* SyntaxKind.CatchClause */; + && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 295 /* SyntaxKind.CatchClause */; } function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 /* SymbolFlags.BlockScoped */ && symbol.valueDeclaration && !ts.isSourceFile(symbol.valueDeclaration)) { @@ -87912,7 +88782,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 235 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 238 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -87953,19 +88823,19 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: var symbol = getSymbolOfNode(node); - return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol); - case 272 /* SyntaxKind.ExportDeclaration */: + return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */); + case 275 /* SyntaxKind.ExportDeclaration */: var exportClause = node.exportClause; return !!exportClause && (ts.isNamespaceExport(exportClause) || ts.some(exportClause.elements, isValueAliasDeclaration)); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return node.expression && node.expression.kind === 79 /* SyntaxKind.Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; @@ -87974,7 +88844,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(nodeIn) { var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -87982,6 +88852,7 @@ var ts; return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference); } function isAliasResolvedToValue(symbol) { + var _a; if (!symbol) { return false; } @@ -87991,7 +88862,7 @@ var ts; } // const enums and modules that contain only const enums are not considered values from the emit perspective // unless 'preserveConstEnums' option is set to true - return !!(target.flags & 111551 /* SymbolFlags.Value */) && + return !!(((_a = getAllSymbolFlags(target)) !== null && _a !== void 0 ? _a : -1) & 111551 /* SymbolFlags.Value */) && (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target)); } function isConstEnumOrConstEnumOnlyModule(s) { @@ -88006,7 +88877,7 @@ var ts; } var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217 if (target && ts.getEffectiveModifierFlags(node) & 1 /* ModifierFlags.Export */ && - target.flags & 111551 /* SymbolFlags.Value */ && + getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */ && (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) { // An `export import ... =` of a value symbol is always considered referenced return true; @@ -88084,15 +88955,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 299 /* SyntaxKind.EnumMember */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 302 /* SyntaxKind.EnumMember */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return true; } return false; } function getConstantValue(node) { - if (node.kind === 299 /* SyntaxKind.EnumMember */) { + if (node.kind === 302 /* SyntaxKind.EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -88185,7 +89056,7 @@ var ts; function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) { var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor); if (!declaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } // Get type of the symbol if this is the valid symbol otherwise get type at location var symbol = getSymbolOfNode(declaration); @@ -88204,7 +89075,7 @@ var ts; function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) { var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike); if (!signatureDeclaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var signature = getSignatureFromDeclaration(signatureDeclaration); return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88212,7 +89083,7 @@ var ts; function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) { var expr = ts.getParseTreeNode(exprIn, ts.isExpression); if (!expr) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var type = getWidenedType(getRegularTypeOfExpression(expr)); return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88236,6 +89107,25 @@ var ts; } return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); } + /** + * Get either a value-meaning symbol or an alias symbol. + * Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol, + * we call `resolveName` to find a symbol. + * This is because when caching the resolved symbol, we only consider value symbols, but here + * we want to also get an alias symbol if one exists. + */ + function getReferencedValueOrAliasSymbol(reference) { + var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; + if (resolvedSymbol && resolvedSymbol !== unknownSymbol) { + return resolvedSymbol; + } + return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, + /*nodeNotFoundMessage*/ undefined, + /*nameArg*/ undefined, + /*isUse*/ true, + /*excludeGlobals*/ undefined, + /*getSpellingSuggestions*/ undefined); + } function getReferencedValueDeclaration(referenceIn) { if (!ts.isGeneratedIdentifier(referenceIn)) { var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier); @@ -88369,12 +89259,12 @@ var ts; getJsxFragmentFactoryEntity: getJsxFragmentFactoryEntity, getAllAccessorDeclarations: function (accessor) { accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); // TODO: GH#18217 - var otherKind = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? 172 /* SyntaxKind.GetAccessor */ : 173 /* SyntaxKind.SetAccessor */; + var otherKind = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? 174 /* SyntaxKind.GetAccessor */ : 175 /* SyntaxKind.SetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind); var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor; var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor; - var setAccessor = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; - var getAccessor = accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; + var setAccessor = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; + var getAccessor = accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; return { firstAccessor: firstAccessor, secondAccessor: secondAccessor, @@ -88390,7 +89280,7 @@ var ts; }, getDeclarationStatementsForSourceFile: function (node, flags, tracker, bundled) { var n = ts.getParseTreeNode(node); - ts.Debug.assert(n && n.kind === 305 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); + ts.Debug.assert(n && n.kind === 308 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); var sym = getSymbolOfNode(node); if (!sym) { return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker, bundled); @@ -88427,7 +89317,7 @@ var ts; return false; } function isInHeritageClause(node) { - return node.parent && node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */; + return node.parent && node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */; } // defined here to avoid outer scope pollution function getTypeReferenceDirectivesForEntityName(node) { @@ -88440,12 +89330,12 @@ var ts; // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries var meaning; - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } else { meaning = 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */; - if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { + if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } } @@ -88494,7 +89384,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 305 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 308 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -88522,12 +89412,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); // TODO: GH#18217 if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 305 /* SyntaxKind.SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 308 /* SyntaxKind.SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -88739,14 +89629,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) { - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (ts.hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -88765,26 +89655,26 @@ var ts; var modifier = _a[_i]; if (ts.isDecorator(modifier)) continue; - if (modifier.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.kind === 166 /* SyntaxKind.PropertySignature */ || node.kind === 168 /* SyntaxKind.MethodSignature */) { + if (modifier.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.kind === 168 /* SyntaxKind.PropertySignature */ || node.kind === 170 /* SyntaxKind.MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 176 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } - if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 144 /* SyntaxKind.OutKeyword */) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 145 /* SyntaxKind.OutKeyword */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 85 /* SyntaxKind.ConstKeyword */: - if (node.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(85 /* SyntaxKind.ConstKeyword */)); } break; - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "override"); @@ -88795,7 +89685,10 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor"); + } + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); } flags |= 16384 /* ModifierFlags.Override */; @@ -88814,16 +89707,19 @@ var ts; else if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor"); + } else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { if (modifier.kind === 121 /* SyntaxKind.PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } @@ -88843,16 +89739,19 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); + } + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -88861,11 +89760,26 @@ var ts; flags |= 32 /* ModifierFlags.Static */; lastStatic = modifier; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "accessor"); + } + else if (flags & 64 /* ModifierFlags.Readonly */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); + } + else if (flags & 2 /* ModifierFlags.Ambient */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); + } + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */) { + return grammarErrorOnNode(modifier, ts.Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); + } + flags |= 128 /* ModifierFlags.Accessor */; + break; + case 146 /* SyntaxKind.ReadonlyKeyword */: if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */ && node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 164 /* SyntaxKind.Parameter */) { + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */ && node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 166 /* SyntaxKind.Parameter */) { // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } @@ -88878,35 +89792,35 @@ var ts; else if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (ts.isClassLike(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* ModifierFlags.Export */; break; case 88 /* SyntaxKind.DefaultKeyword */: - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } else if (!(flags & 1 /* ModifierFlags.Export */)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); } - flags |= 512 /* ModifierFlags.Default */; + flags |= 1024 /* ModifierFlags.Default */; break; - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -88915,10 +89829,10 @@ var ts; else if (ts.isClassLike(node.parent) && !ts.isPropertyDeclaration(node)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } else if (ts.isPrivateIdentifierClassElementDeclaration(node)) { @@ -88928,18 +89842,18 @@ var ts; lastDeclare = modifier; break; case 126 /* SyntaxKind.AbstractKeyword */: - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - node.kind !== 180 /* SyntaxKind.ConstructorType */) { - if (node.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - node.kind !== 172 /* SyntaxKind.GetAccessor */ && - node.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (node.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + node.kind !== 182 /* SyntaxKind.ConstructorType */) { + if (node.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + node.kind !== 174 /* SyntaxKind.GetAccessor */ && + node.kind !== 175 /* SyntaxKind.SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */))) { + if (!(node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* ModifierFlags.Static */) { @@ -88948,39 +89862,42 @@ var ts; if (flags & 8 /* ModifierFlags.Private */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } - if (flags & 256 /* ModifierFlags.Async */ && lastAsync) { + if (flags & 512 /* ModifierFlags.Async */ && lastAsync) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); } + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); + } } if (ts.isNamedDeclaration(node) && node.name.kind === 80 /* SyntaxKind.PrivateIdentifier */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); } - flags |= 128 /* ModifierFlags.Abstract */; + flags |= 256 /* ModifierFlags.Abstract */; break; - case 131 /* SyntaxKind.AsyncKeyword */: - if (flags & 256 /* ModifierFlags.Async */) { + case 132 /* SyntaxKind.AsyncKeyword */: + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* ModifierFlags.Ambient */ || node.parent.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } - flags |= 256 /* ModifierFlags.Async */; + flags |= 512 /* ModifierFlags.Async */; lastAsync = modifier; break; case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: var inOutFlag = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? 32768 /* ModifierFlags.In */ : 65536 /* ModifierFlags.Out */; var inOutText = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? "in" : "out"; - if (node.kind !== 163 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { + if (node.kind !== 165 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); } if (flags & inOutFlag) { @@ -88993,28 +89910,28 @@ var ts; break; } } - if (node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 173 /* SyntaxKind.Constructor */) { if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(lastOverride, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override"); // TODO: GH#18217 } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return false; } - else if ((node.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { + else if ((node.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return checkGrammarAsyncModifier(node, lastAsync); } return false; @@ -89032,47 +89949,47 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 179 /* SyntaxKind.FunctionType */: - case 276 /* SyntaxKind.MissingDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 279 /* SyntaxKind.MissingDeclaration */: return true; default: - if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return false; } switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - return nodeHasAnyModifiersExcept(node, 131 /* SyntaxKind.AsyncKeyword */); - case 257 /* SyntaxKind.ClassDeclaration */: - case 180 /* SyntaxKind.ConstructorType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + return nodeHasAnyModifiersExcept(node, 132 /* SyntaxKind.AsyncKeyword */); + case 260 /* SyntaxKind.ClassDeclaration */: + case 182 /* SyntaxKind.ConstructorType */: return nodeHasAnyModifiersExcept(node, 126 /* SyntaxKind.AbstractKeyword */); - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 85 /* SyntaxKind.ConstKeyword */); default: ts.Debug.assertNever(node); @@ -89090,10 +90007,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); @@ -89322,20 +90239,20 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 221 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { + if (computedPropertyName.expression.kind === 223 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } return false; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.Debug.assert(node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */); if (node.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -89354,7 +90271,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (prop.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (inDestructuring) { // a rest property cannot be destructured any further var expression = ts.skipParentheses(prop.expression); @@ -89365,11 +90282,11 @@ var ts; continue; } var name = prop.name; - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern); @@ -89381,7 +90298,7 @@ var ts; if (ts.canHaveModifiers(prop) && prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (ts.isModifier(mod) && (mod.kind !== 131 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 169 /* SyntaxKind.MethodDeclaration */)) { + if (ts.isModifier(mod) && (mod.kind !== 132 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 171 /* SyntaxKind.MethodDeclaration */)) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -89402,8 +90319,8 @@ var ts; // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; switch (prop.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); @@ -89412,13 +90329,13 @@ var ts; } currentKind = 4 /* DeclarationMeaning.PropertyAssignment */; break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: currentKind = 8 /* DeclarationMeaning.Method */; break; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: currentKind = 1 /* DeclarationMeaning.GetAccessor */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: currentKind = 2 /* DeclarationMeaning.SetAccessor */; break; default: @@ -89461,7 +90378,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (attr.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { continue; } var name = attr.name, initializer = attr.initializer; @@ -89471,7 +90388,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 288 /* SyntaxKind.JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 291 /* SyntaxKind.JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -89506,7 +90423,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 244 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 247 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { if (!(forInOrOfStatement.flags & 32768 /* NodeFlags.AwaitContext */)) { var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement); if (ts.isInTopLevelContext(forInOrOfStatement)) { @@ -89540,7 +90457,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); var func = ts.getContainingFunction(forInOrOfStatement); - if (func && func.kind !== 171 /* SyntaxKind.Constructor */) { + if (func && func.kind !== 173 /* SyntaxKind.Constructor */) { ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* FunctionFlags.Async */) === 0, "Enclosing function should never be an async function."); var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); @@ -89557,7 +90474,7 @@ var ts; grammarErrorOnNode(forInOrOfStatement.initializer, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); return false; } - if (forInOrOfStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -89572,20 +90489,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -89595,22 +90512,22 @@ var ts; return false; } function checkGrammarAccessor(accessor) { - if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 182 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 184 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */)) { if (languageVersion < 1 /* ScriptTarget.ES5 */) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(accessor.name)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } - if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } if (accessor.body) { - if (ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); } - if (accessor.parent.kind === 182 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (accessor.parent.kind === 184 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return grammarErrorOnNode(accessor.body, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } } @@ -89618,11 +90535,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? + return grammarErrorOnNode(accessor.name, accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -89644,17 +90561,17 @@ var ts; * A set accessor has one parameter or a `this` parameter and one more parameter. */ function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { return ts.getThisParameter(accessor); } } function checkGrammarTypeOperatorNode(node) { - if (node.operator === 154 /* SyntaxKind.UniqueKeyword */) { - if (node.type.kind !== 151 /* SyntaxKind.SymbolKeyword */) { - return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + if (node.operator === 156 /* SyntaxKind.UniqueKeyword */) { + if (node.type.kind !== 153 /* SyntaxKind.SymbolKeyword */) { + return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } var parent = ts.walkUpParenthesizedTypes(node.parent); if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) { @@ -89664,7 +90581,7 @@ var ts; } } switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: var decl = parent; if (decl.name.kind !== 79 /* SyntaxKind.Identifier */) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -89676,13 +90593,13 @@ var ts; return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (!ts.isStatic(parent) || !ts.hasEffectiveReadonlyModifier(parent)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (!ts.hasSyntacticModifier(parent, 64 /* ModifierFlags.Readonly */)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); } @@ -89691,9 +90608,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here); } } - else if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.type.kind !== 183 /* SyntaxKind.ArrayType */ && node.type.kind !== 184 /* SyntaxKind.TupleType */) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + else if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.type.kind !== 185 /* SyntaxKind.ArrayType */ && node.type.kind !== 186 /* SyntaxKind.TupleType */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } } } @@ -89706,10 +90623,10 @@ var ts; if (checkGrammarFunctionLikeDeclaration(node)) { return true; } - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */) { - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */) { + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 131 /* SyntaxKind.AsyncKeyword */)) { + if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 132 /* SyntaxKind.AsyncKeyword */)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { @@ -89738,14 +90655,14 @@ var ts; if (node.flags & 16777216 /* NodeFlags.Ambient */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !node.body) { + else if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !node.body) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) { + else if (node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } @@ -89756,11 +90673,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: if (node.label && current.label.escapedText === node.label.escapedText) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 245 /* SyntaxKind.ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 248 /* SyntaxKind.ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -89768,8 +90685,8 @@ var ts; return false; } break; - case 249 /* SyntaxKind.SwitchStatement */: - if (node.kind === 246 /* SyntaxKind.BreakStatement */ && !node.label) { + case 252 /* SyntaxKind.SwitchStatement */: + if (node.kind === 249 /* SyntaxKind.BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -89784,13 +90701,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -89814,12 +90731,12 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return ts.isStringOrNumericLiteralLike(expr) || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; } function isBigIntLiteralExpression(expr) { return expr.kind === 9 /* SyntaxKind.BigIntLiteral */ || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 9 /* SyntaxKind.BigIntLiteral */; } function isSimpleLiteralEnumReference(expr) { @@ -89847,7 +90764,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 247 /* SyntaxKind.ForOfStatement */) { if (node.flags & 16777216 /* NodeFlags.Ambient */) { checkAmbientInitializer(node); } @@ -89860,7 +90777,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 237 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { + if (node.exclamationToken && (node.parent.parent.kind !== 240 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { var message = node.initializer ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type @@ -89927,15 +90844,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return false; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -90029,8 +90946,14 @@ var ts; if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(node.name)) { return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } + if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isAutoAccessorPropertyDeclaration(node)) { + return grammarErrorOnNode(node.name, ts.Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (ts.isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_accessor_property_cannot_be_declared_optional)) { + return true; + } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } @@ -90076,14 +90999,14 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */)) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); @@ -90091,7 +91014,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 237 /* SyntaxKind.VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 240 /* SyntaxKind.VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -90114,7 +91037,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 235 /* SyntaxKind.Block */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 238 /* SyntaxKind.Block */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { var links_2 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_2.hasReportedStatementInAmbientContext) { @@ -90136,10 +91059,10 @@ var ts; if (languageVersion >= 1 /* ScriptTarget.ES5 */) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 196 /* SyntaxKind.LiteralType */)) { + else if (ts.isChildOfNodeWithKind(node, 198 /* SyntaxKind.LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 299 /* SyntaxKind.EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 302 /* SyntaxKind.EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -90211,7 +91134,7 @@ var ts; if (node.isTypeOnly && node.name && node.namedBindings) { return grammarErrorOnNode(node, ts.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both); } - if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 269 /* SyntaxKind.NamedImports */) { + if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 272 /* SyntaxKind.NamedImports */) { return checkGrammarNamedImportsOrExports(node.namedBindings); } return false; @@ -90219,7 +91142,7 @@ var ts; function checkGrammarNamedImportsOrExports(namedBindings) { return !!ts.forEach(namedBindings.elements, function (specifier) { if (specifier.isTypeOnly) { - return grammarErrorOnFirstToken(specifier, specifier.kind === 270 /* SyntaxKind.ImportSpecifier */ + return grammarErrorOnFirstToken(specifier, specifier.kind === 273 /* SyntaxKind.ImportSpecifier */ ? ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement); } @@ -90342,14 +91265,14 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 169 /* SyntaxKind.MethodDeclaration */) || + return (declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 171 /* SyntaxKind.MethodDeclaration */) || !!declaration.body; } /** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */ function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -90385,6 +91308,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var _a; function visitNode(node, visitor, test, lift) { if (node === undefined || visitor === undefined) { return node; @@ -90451,7 +91375,6 @@ var ts; return nodes; } ts.visitNodes = visitNodes; - /* @internal */ function visitArray(nodes, visitor, test, start, count) { if (nodes === undefined) { return nodes; @@ -90599,12 +91522,10 @@ var ts; return updated; } ts.visitFunctionBody = visitFunctionBody; - /** - * Visits an iteration body, adding any block-scoped variables required by the transformation. - */ - function visitIterationBody(body, visitor, context) { + function visitIterationBody(body, visitor, context, nodeVisitor) { + if (nodeVisitor === void 0) { nodeVisitor = visitNode; } context.startBlockScope(); - var updated = visitNode(body, visitor, ts.isStatement, context.factory.liftToBlock); + var updated = nodeVisitor(body, visitor, ts.isStatement, context.factory.liftToBlock); var declarations = context.endBlockScope(); if (ts.some(declarations)) { if (ts.isBlock(updated)) { @@ -90623,456 +91544,446 @@ var ts; if (node === undefined) { return undefined; } - var kind = node.kind; - // No need to visit nodes with no children. - if ((kind > 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */) || kind === 192 /* SyntaxKind.ThisType */) { - return node; - } - var factory = context.factory; - switch (kind) { - // Names - case 79 /* SyntaxKind.Identifier */: - ts.Debug.type(node); - return factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); - case 161 /* SyntaxKind.QualifiedName */: - ts.Debug.type(node); - return factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); - case 162 /* SyntaxKind.ComputedPropertyName */: - ts.Debug.type(node); - return factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Signature elements - case 163 /* SyntaxKind.TypeParameter */: - ts.Debug.type(node); - return factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); - case 164 /* SyntaxKind.Parameter */: - ts.Debug.type(node); - return factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 165 /* SyntaxKind.Decorator */: - ts.Debug.type(node); - return factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Type elements - case 166 /* SyntaxKind.PropertySignature */: - ts.Debug.type(node); - return factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 167 /* SyntaxKind.PropertyDeclaration */: - ts.Debug.type(node); - return factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), - // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too - nodeVisitor(node.questionToken || node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 168 /* SyntaxKind.MethodSignature */: - ts.Debug.type(node); - return factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 169 /* SyntaxKind.MethodDeclaration */: - ts.Debug.type(node); - return factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 171 /* SyntaxKind.Constructor */: - ts.Debug.type(node); - return factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 172 /* SyntaxKind.GetAccessor */: - ts.Debug.type(node); - return factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 173 /* SyntaxKind.SetAccessor */: - ts.Debug.type(node); - return factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - ts.Debug.type(node); - context.startLexicalEnvironment(); - context.suspendLexicalEnvironment(); - return factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 174 /* SyntaxKind.CallSignature */: - ts.Debug.type(node); - return factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 175 /* SyntaxKind.ConstructSignature */: - ts.Debug.type(node); - return factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 176 /* SyntaxKind.IndexSignature */: - ts.Debug.type(node); - return factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - // Types - case 177 /* SyntaxKind.TypePredicate */: - ts.Debug.type(node); - return factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 178 /* SyntaxKind.TypeReference */: - ts.Debug.type(node); - return factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 179 /* SyntaxKind.FunctionType */: - ts.Debug.type(node); - return factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 180 /* SyntaxKind.ConstructorType */: - ts.Debug.type(node); - return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 181 /* SyntaxKind.TypeQuery */: - ts.Debug.type(node); - return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 182 /* SyntaxKind.TypeLiteral */: - ts.Debug.type(node); - return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 183 /* SyntaxKind.ArrayType */: - ts.Debug.type(node); - return factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); - case 184 /* SyntaxKind.TupleType */: - ts.Debug.type(node); - return factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); - case 185 /* SyntaxKind.OptionalType */: - ts.Debug.type(node); - return factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 186 /* SyntaxKind.RestType */: - ts.Debug.type(node); - return factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 187 /* SyntaxKind.UnionType */: - ts.Debug.type(node); - return factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 188 /* SyntaxKind.IntersectionType */: - ts.Debug.type(node); - return factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 189 /* SyntaxKind.ConditionalType */: - ts.Debug.type(node); - return factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); - case 190 /* SyntaxKind.InferType */: - ts.Debug.type(node); - return factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); - case 200 /* SyntaxKind.ImportType */: - ts.Debug.type(node); - return factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isNode), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - ts.Debug.type(node); - return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine); - case 197 /* SyntaxKind.NamedTupleMember */: - ts.Debug.type(node); - return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 191 /* SyntaxKind.ParenthesizedType */: - ts.Debug.type(node); - return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 193 /* SyntaxKind.TypeOperator */: - ts.Debug.type(node); - return factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 194 /* SyntaxKind.IndexedAccessType */: - ts.Debug.type(node); - return factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); - case 195 /* SyntaxKind.MappedType */: - ts.Debug.type(node); - return factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 196 /* SyntaxKind.LiteralType */: - ts.Debug.type(node); - return factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); - case 198 /* SyntaxKind.TemplateLiteralType */: - ts.Debug.type(node); - return factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - ts.Debug.type(node); - return factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: - ts.Debug.type(node); - return factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); - case 202 /* SyntaxKind.ArrayBindingPattern */: - ts.Debug.type(node); - return factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); - case 203 /* SyntaxKind.BindingElement */: - ts.Debug.type(node); - return factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Expression - case 204 /* SyntaxKind.ArrayLiteralExpression */: - ts.Debug.type(node); - return factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - ts.Debug.type(node); - return factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 206 /* SyntaxKind.PropertyAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)); - } - ts.Debug.type(node); - return factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); - case 207 /* SyntaxKind.ElementAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - case 208 /* SyntaxKind.CallExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 209 /* SyntaxKind.NewExpression */: - ts.Debug.type(node); - return factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - ts.Debug.type(node); - return factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); - case 211 /* SyntaxKind.TypeAssertionExpression */: - ts.Debug.type(node); - return factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 212 /* SyntaxKind.ParenthesizedExpression */: - ts.Debug.type(node); - return factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 213 /* SyntaxKind.FunctionExpression */: - ts.Debug.type(node); - return factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 214 /* SyntaxKind.ArrowFunction */: - ts.Debug.type(node); - return factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 215 /* SyntaxKind.DeleteExpression */: - ts.Debug.type(node); - return factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 216 /* SyntaxKind.TypeOfExpression */: - ts.Debug.type(node); - return factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 217 /* SyntaxKind.VoidExpression */: - ts.Debug.type(node); - return factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 218 /* SyntaxKind.AwaitExpression */: - ts.Debug.type(node); - return factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 221 /* SyntaxKind.BinaryExpression */: - ts.Debug.type(node); - return factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); - case 222 /* SyntaxKind.ConditionalExpression */: - ts.Debug.type(node); - return factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); - case 223 /* SyntaxKind.TemplateExpression */: - ts.Debug.type(node); - return factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); - case 224 /* SyntaxKind.YieldExpression */: - ts.Debug.type(node); - return factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 225 /* SyntaxKind.SpreadElement */: - ts.Debug.type(node); - return factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 226 /* SyntaxKind.ClassExpression */: - ts.Debug.type(node); - return factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - ts.Debug.type(node); - return factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 229 /* SyntaxKind.AsExpression */: - ts.Debug.type(node); - return factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 230 /* SyntaxKind.NonNullExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 231 /* SyntaxKind.MetaProperty */: - ts.Debug.type(node); - return factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Misc - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.type(node); - return factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Element - case 235 /* SyntaxKind.Block */: - ts.Debug.type(node); - return factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 237 /* SyntaxKind.VariableStatement */: - ts.Debug.type(node); - return factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 238 /* SyntaxKind.ExpressionStatement */: - ts.Debug.type(node); - return factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 239 /* SyntaxKind.IfStatement */: - ts.Debug.type(node); - return factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, factory.liftToBlock)); - case 240 /* SyntaxKind.DoStatement */: - ts.Debug.type(node); - return factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 241 /* SyntaxKind.WhileStatement */: - ts.Debug.type(node); - return factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 242 /* SyntaxKind.ForStatement */: - ts.Debug.type(node); - return factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 243 /* SyntaxKind.ForInStatement */: - ts.Debug.type(node); - return factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 244 /* SyntaxKind.ForOfStatement */: - ts.Debug.type(node); - return factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 245 /* SyntaxKind.ContinueStatement */: - ts.Debug.type(node); - return factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 246 /* SyntaxKind.BreakStatement */: - ts.Debug.type(node); - return factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 247 /* SyntaxKind.ReturnStatement */: - ts.Debug.type(node); - return factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 248 /* SyntaxKind.WithStatement */: - ts.Debug.type(node); - return factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 249 /* SyntaxKind.SwitchStatement */: - ts.Debug.type(node); - return factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); - case 250 /* SyntaxKind.LabeledStatement */: - ts.Debug.type(node); - return factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 251 /* SyntaxKind.ThrowStatement */: - ts.Debug.type(node); - return factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 252 /* SyntaxKind.TryStatement */: - ts.Debug.type(node); - return factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); - case 254 /* SyntaxKind.VariableDeclaration */: - ts.Debug.type(node); - return factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 255 /* SyntaxKind.VariableDeclarationList */: - ts.Debug.type(node); - return factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); - case 256 /* SyntaxKind.FunctionDeclaration */: - ts.Debug.type(node); - return factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 257 /* SyntaxKind.ClassDeclaration */: - ts.Debug.type(node); - return factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 258 /* SyntaxKind.InterfaceDeclaration */: - ts.Debug.type(node); - return factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - ts.Debug.type(node); - return factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 260 /* SyntaxKind.EnumDeclaration */: - ts.Debug.type(node); - return factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); - case 261 /* SyntaxKind.ModuleDeclaration */: - ts.Debug.type(node); - return factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); - case 262 /* SyntaxKind.ModuleBlock */: - ts.Debug.type(node); - return factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 263 /* SyntaxKind.CaseBlock */: - ts.Debug.type(node); - return factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - ts.Debug.type(node); - return factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - ts.Debug.type(node); - return factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); - case 266 /* SyntaxKind.ImportDeclaration */: - ts.Debug.type(node); - return factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 293 /* SyntaxKind.AssertClause */: - ts.Debug.type(node); - return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); - case 294 /* SyntaxKind.AssertEntry */: - ts.Debug.type(node); - return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode)); - case 267 /* SyntaxKind.ImportClause */: - ts.Debug.type(node); - return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); - case 268 /* SyntaxKind.NamespaceImport */: - ts.Debug.type(node); - return factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 274 /* SyntaxKind.NamespaceExport */: - ts.Debug.type(node); - return factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 269 /* SyntaxKind.NamedImports */: - ts.Debug.type(node); - return factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); - case 270 /* SyntaxKind.ImportSpecifier */: - ts.Debug.type(node); - return factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 271 /* SyntaxKind.ExportAssignment */: - ts.Debug.type(node); - return factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 272 /* SyntaxKind.ExportDeclaration */: - ts.Debug.type(node); - return factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 273 /* SyntaxKind.NamedExports */: - ts.Debug.type(node); - return factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); - case 275 /* SyntaxKind.ExportSpecifier */: - ts.Debug.type(node); - return factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: - ts.Debug.type(node); - return factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // JSX - case 278 /* SyntaxKind.JsxElement */: - ts.Debug.type(node); - return factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - ts.Debug.type(node); - return factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 280 /* SyntaxKind.JsxOpeningElement */: - ts.Debug.type(node); - return factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 281 /* SyntaxKind.JsxClosingElement */: - ts.Debug.type(node); - return factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 282 /* SyntaxKind.JsxFragment */: - ts.Debug.type(node); - return factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 285 /* SyntaxKind.JsxAttribute */: - ts.Debug.type(node); - return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 286 /* SyntaxKind.JsxAttributes */: - ts.Debug.type(node); - return factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - ts.Debug.type(node); - return factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 288 /* SyntaxKind.JsxExpression */: - ts.Debug.type(node); - return factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Clauses - case 289 /* SyntaxKind.CaseClause */: - ts.Debug.type(node); - return factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 290 /* SyntaxKind.DefaultClause */: - ts.Debug.type(node); - return factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 291 /* SyntaxKind.HeritageClause */: - ts.Debug.type(node); - return factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 292 /* SyntaxKind.CatchClause */: - ts.Debug.type(node); - return factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); - // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: - ts.Debug.type(node); - return factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - ts.Debug.type(node); - return factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 298 /* SyntaxKind.SpreadAssignment */: - ts.Debug.type(node); - return factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Enum - case 299 /* SyntaxKind.EnumMember */: - ts.Debug.type(node); - return factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: - ts.Debug.type(node); - return factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context)); - // Transformation nodes - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - ts.Debug.type(node); - return factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 351 /* SyntaxKind.CommaListExpression */: - ts.Debug.type(node); - return factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - default: - // No need to visit nodes with no children. - return node; - } + var fn = visitEachChildTable[node.kind]; + return fn === undefined ? node : fn(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor); } ts.visitEachChild = visitEachChild; + // NOTE: Before you can add a new method to `visitEachChildTable`, you must first ensure the `Node` subtype you + // wish to add is defined in the `HasChildren` union in types.ts. + var visitEachChildTable = (_a = {}, + _a[79 /* SyntaxKind.Identifier */] = function visitEachChildOfIdentifier(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); + }, + _a[163 /* SyntaxKind.QualifiedName */] = function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Signature elements + _a[165 /* SyntaxKind.TypeParameter */] = function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); + }, + _a[166 /* SyntaxKind.Parameter */] = function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[167 /* SyntaxKind.Decorator */] = function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Type elements + _a[168 /* SyntaxKind.PropertySignature */] = function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + var _a; + return context.factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), + // QuestionToken and ExclamationToken are mutually exclusive in PropertyDeclaration + nodeVisitor((_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[171 /* SyntaxKind.MethodDeclaration */] = function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[173 /* SyntaxKind.Constructor */] = function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + context.startLexicalEnvironment(); + context.suspendLexicalEnvironment(); + return context.factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[176 /* SyntaxKind.CallSignature */] = function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[177 /* SyntaxKind.ConstructSignature */] = function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + // Types + _a[179 /* SyntaxKind.TypePredicate */] = function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[180 /* SyntaxKind.TypeReference */] = function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[181 /* SyntaxKind.FunctionType */] = function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[185 /* SyntaxKind.ArrayType */] = function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); + }, + _a[186 /* SyntaxKind.TupleType */] = function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); + }, + _a[187 /* SyntaxKind.OptionalType */] = function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[188 /* SyntaxKind.RestType */] = function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[189 /* SyntaxKind.UnionType */] = function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[190 /* SyntaxKind.IntersectionType */] = function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[191 /* SyntaxKind.ConditionalType */] = function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); + }, + _a[192 /* SyntaxKind.InferType */] = function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + }, + _a[202 /* SyntaxKind.ImportType */] = function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isImportTypeAssertionContainer), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isAssertClause), node.multiLine); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[195 /* SyntaxKind.TypeOperator */] = function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[196 /* SyntaxKind.IndexedAccessType */] = function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); + }, + _a[197 /* SyntaxKind.MappedType */] = function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[198 /* SyntaxKind.LiteralType */] = function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Binding patterns + _a[203 /* SyntaxKind.ObjectBindingPattern */] = function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); + }, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + }, + _a[205 /* SyntaxKind.BindingElement */] = function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Expression + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isPropertyAccessChain(node) ? + context.factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)) : + context.factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isElementAccessChain(node) ? + context.factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)) : + context.factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); + }, + _a[210 /* SyntaxKind.CallExpression */] = function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isCallChain(node) ? + context.factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)) : + context.factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[211 /* SyntaxKind.NewExpression */] = function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[228 /* SyntaxKind.ClassExpression */] = function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[231 /* SyntaxKind.AsExpression */] = function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSatisfiesExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return ts.isOptionalChain(node) ? + context.factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)) : + context.factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Misc + _a[236 /* SyntaxKind.TemplateSpan */] = function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Element + _a[238 /* SyntaxKind.Block */] = function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[242 /* SyntaxKind.IfStatement */] = function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, context.factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[243 /* SyntaxKind.DoStatement */] = function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context, nodeVisitor), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[245 /* SyntaxKind.ForStatement */] = function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[249 /* SyntaxKind.BreakStatement */] = function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[250 /* SyntaxKind.ReturnStatement */] = function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[251 /* SyntaxKind.WithStatement */] = function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[255 /* SyntaxKind.TryStatement */] = function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); + }, + _a[265 /* SyntaxKind.ModuleBlock */] = function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[296 /* SyntaxKind.AssertClause */] = function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpression)); + }, + _a[270 /* SyntaxKind.ImportClause */] = function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[272 /* SyntaxKind.NamedImports */] = function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[274 /* SyntaxKind.ExportAssignment */] = function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[275 /* SyntaxKind.ExportDeclaration */] = function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[276 /* SyntaxKind.NamedExports */] = function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + }, + _a[278 /* SyntaxKind.ExportSpecifier */] = function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Module references + _a[280 /* SyntaxKind.ExternalModuleReference */] = function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // JSX + _a[281 /* SyntaxKind.JsxElement */] = function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[283 /* SyntaxKind.JsxOpeningElement */] = function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + }, + _a[289 /* SyntaxKind.JsxAttributes */] = function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Clauses + _a[292 /* SyntaxKind.CaseClause */] = function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + }, + _a[295 /* SyntaxKind.CatchClause */] = function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); + }, + // Property assignments + _a[299 /* SyntaxKind.PropertyAssignment */] = function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Enum + _a[302 /* SyntaxKind.EnumMember */] = function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Top-level nodes + _a[308 /* SyntaxKind.SourceFile */] = function visitEachChildOfSourceFile(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context, /*start*/ undefined, /*ensureUseStrict*/ undefined, nodesVisitor)); + }, + // Transformation nodes + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a); /** * Extracts the single node from a NodeArray. * @@ -91140,7 +92051,7 @@ var ts; exit(); return sourceIndex; } - /* eslint-disable boolean-trivia, no-null/no-null */ + /* eslint-disable local/boolean-trivia, no-null/no-null */ function setSourceContent(sourceIndex, content) { enter(); if (content !== null) { @@ -91153,7 +92064,7 @@ var ts; } exit(); } - /* eslint-enable boolean-trivia, no-null/no-null */ + /* eslint-enable local/boolean-trivia, no-null/no-null */ function addName(name) { enter(); if (!nameToNameIndexMap) @@ -91755,7 +92666,7 @@ var ts; function chainBundle(context, transformSourceFile) { return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -91806,7 +92717,7 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" @@ -91819,13 +92730,13 @@ var ts; hasImportDefault = true; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - if (node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + if (node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -91856,13 +92767,13 @@ var ts; addExportedNamesForExportDeclaration(node); } break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { for (var _b = 0, _c = node.declarationList.declarations; _b < _c.length; _b++) { var decl = _c[_b]; @@ -91870,9 +92781,9 @@ var ts; } } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default function() { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -91890,9 +92801,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default class { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -92070,7 +92981,7 @@ var ts; * @param isStatic A value indicating whether the member should be a static or instance member. */ function isInitializedProperty(member) { - return member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + return member.kind === 169 /* SyntaxKind.PropertyDeclaration */ && member.initializer !== undefined; } ts.isInitializedProperty = isInitializedProperty; @@ -92080,7 +92991,7 @@ var ts; * @param member The class element node. */ function isNonStaticMethodOrAccessorWithPrivateName(member) { - return !ts.isStatic(member) && ts.isMethodOrAccessor(member) && ts.isPrivateIdentifier(member.name); + return !ts.isStatic(member) && (ts.isMethodOrAccessor(member) || ts.isAutoAccessorPropertyDeclaration(member)) && ts.isPrivateIdentifier(member.name); } ts.isNonStaticMethodOrAccessorWithPrivateName = isNonStaticMethodOrAccessorWithPrivateName; /** @@ -92134,12 +93045,12 @@ var ts; */ function getAllDecoratorsOfClassElement(member, parent) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return getAllDecoratorsOfAccessors(member, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -92800,8 +93711,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -92821,14 +93732,14 @@ var ts; var applicableSubstitutions; return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { return transformBundle(node); } return transformSourceFile(node); } function transformBundle(node) { return factory.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { return ts.createUnparsedSourceFile(prepend, "js"); } return prepend; @@ -92877,15 +93788,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 262 /* SyntaxKind.ModuleBlock */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 265 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: currentLexicalScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */)) { break; } @@ -92897,7 +93808,7 @@ var ts; // These nodes should always have names unless they are default-exports; // however, class declaration parsing allows for undefined names, so syntactically invalid // programs may also have an undefined name. - ts.Debug.assert(node.kind === 257 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)); + ts.Debug.assert(node.kind === 260 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)); } break; } @@ -92936,10 +93847,10 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitElidableStatement(node); default: return visitorWorker(node); @@ -92960,13 +93871,13 @@ var ts; return node; } switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -92986,11 +93897,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ || - (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && - node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */)) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ || + (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && + node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -93014,27 +93925,27 @@ var ts; */ function classElementVisitorWorker(node, parent) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructor(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Property declarations are not TypeScript syntax, but they must be visited // for the decorator transformation. return visitPropertyDeclaration(node, parent); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.visitEachChild(node, visitor, context); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return node; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Index signatures are elided return; default: @@ -93046,17 +93957,17 @@ var ts; } function objectLiteralElementVisitorWorker(node, parent) { switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return visitor(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); @@ -93067,7 +93978,7 @@ var ts; function modifierVisitor(node) { if (ts.isDecorator(node)) return undefined; - if (ts.modifierToFlag(node.kind) & 116958 /* ModifierFlags.TypeScriptModifier */) { + if (ts.modifierToFlag(node.kind) & 117086 /* ModifierFlags.TypeScriptModifier */) { return undefined; } else if (currentNamespace && node.kind === 93 /* SyntaxKind.ExportKeyword */) { @@ -93095,58 +94006,58 @@ var ts; case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: // TypeScript accessibility and readonly modifiers are elided // falls through - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 177 /* SyntaxKind.TypePredicate */: - case 163 /* SyntaxKind.TypeParameter */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 179 /* SyntaxKind.TypePredicate */: + case 165 /* SyntaxKind.TypeParameter */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 181 /* SyntaxKind.TypeQuery */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 189 /* SyntaxKind.ConditionalType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 192 /* SyntaxKind.ThisType */: - case 193 /* SyntaxKind.TypeOperator */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 196 /* SyntaxKind.LiteralType */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 183 /* SyntaxKind.TypeQuery */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 191 /* SyntaxKind.ConditionalType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 194 /* SyntaxKind.ThisType */: + case 195 /* SyntaxKind.TypeOperator */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 198 /* SyntaxKind.LiteralType */: // TypeScript type nodes are elided. // falls through - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // TypeScript index signatures are elided. return undefined; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // TypeScript type-only declarations are elided. return factory.createNotEmittedStatement(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // TypeScript namespace export declarations are elided. return undefined; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return factory.createNotEmittedStatement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // This may be a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93156,7 +94067,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // This may be a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93166,34 +94077,34 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: // This may be a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.Debug.fail("Class and object literal elements must be visited with their respective visitors"); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // This may be a parameter declaration with TypeScript syntax extensions. // // TypeScript parameter declaration syntax extensions include: @@ -93203,40 +94114,42 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return visitSatisfiesExpression(node); + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return visitJsxJsxOpeningElement(node); default: // node contains some other TypeScript syntax @@ -93506,10 +94419,10 @@ var ts; */ function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */; + return kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */; } /** * Determines whether to emit the "design:returntype" metadata based on the node's kind. @@ -93519,7 +94432,7 @@ var ts; * @param node The node to test. */ function shouldAddReturnTypeMetadata(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } /** * Determines whether to emit the "design:paramtypes" metadata based on the node's kind. @@ -93530,12 +94443,12 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; } return false; @@ -93625,7 +94538,7 @@ var ts; return !ts.nodeIsMissing(node.body); } function visitPropertyDeclaration(node, parent) { - var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); if (isAmbient && !ts.hasDecorators(node)) { return undefined; } @@ -93733,7 +94646,7 @@ var ts; * @param node The declaration node. */ function shouldEmitAccessorDeclaration(node) { - return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)); + return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)); } function visitGetAccessor(node, parent) { if (!(node.transformFlags & 1 /* TransformFlags.ContainsTypeScript */)) { @@ -93875,6 +94788,10 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); return factory.createPartiallyEmittedExpression(expression, node); } + function visitSatisfiesExpression(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } function visitCallExpression(node) { return factory.updateCallExpression(node, ts.visitNode(node.expression, visitor, ts.isExpression), /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); @@ -94088,12 +95005,12 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = factory.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), factory.createVariableDeclarationList([ factory.createVariableDeclaration(factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentLexicalScope.kind === 305 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); + ], currentLexicalScope.kind === 308 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind === 263 /* SyntaxKind.EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -94218,7 +95135,7 @@ var ts; var statementsLocation; var blockLocation; if (node.body) { - if (node.body.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (node.body.kind === 265 /* SyntaxKind.ModuleBlock */) { saveStateAndInvoke(node.body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = node.body.statements; blockLocation = node.body; @@ -94265,13 +95182,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (!node.body || node.body.kind !== 262 /* SyntaxKind.ModuleBlock */) { + if (!node.body || node.body.kind !== 265 /* SyntaxKind.ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* EmitFlags.NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -94318,7 +95235,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (node.kind === 271 /* SyntaxKind.NamespaceImport */) { // Elide a namespace import if it is not referenced. return shouldEmitAliasDeclaration(node) ? node : undefined; } @@ -94476,7 +95393,7 @@ var ts; */ function isNamedExternalModuleExport(node) { return isExternalModuleExport(node) - && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } /** * Gets a value indicating whether the node is the default export of an external module. @@ -94485,7 +95402,7 @@ var ts; */ function isDefaultExternalModuleExport(node) { return isExternalModuleExport(node) - && ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } function addExportMemberAssignment(statements, node) { var expression = factory.createAssignment(factory.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), factory.getLocalName(node)); @@ -94530,16 +95447,16 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(79 /* SyntaxKind.Identifier */); - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(261 /* SyntaxKind.ModuleDeclaration */); + context.enableEmitNotification(264 /* SyntaxKind.ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 261 /* SyntaxKind.ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 260 /* SyntaxKind.EnumDeclaration */; + return ts.getOriginalNode(node).kind === 263 /* SyntaxKind.EnumDeclaration */; } /** * Hook for node emit. @@ -94600,9 +95517,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -94617,9 +95534,9 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 305 /* SyntaxKind.SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 261 /* SyntaxKind.ModuleDeclaration */) || - (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 260 /* SyntaxKind.EnumDeclaration */); + if (container && container.kind !== 308 /* SyntaxKind.SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 264 /* SyntaxKind.ModuleDeclaration */) || + (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 263 /* SyntaxKind.EnumDeclaration */); if (substitute) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(container), node), /*location*/ node); @@ -94658,9 +95575,10 @@ var ts; return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined; } function shouldEmitAliasDeclaration(node) { - return compilerOptions.preserveValueImports - ? resolver.isValueAliasDeclaration(node) - : resolver.isReferencedAliasDeclaration(node); + return ts.isInJSFile(node) || + (compilerOptions.preserveValueImports + ? resolver.isValueAliasDeclaration(node) + : resolver.isReferencedAliasDeclaration(node)); } } ts.transformTypeScript = transformTypeScript; @@ -94708,13 +95626,24 @@ var ts; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions); + // Always transform field initializers using Set semantics when `useDefineForClassFields: false`. + var shouldTransformInitializersUsingSet = !useDefineForClassFields; + // Transform field initializers using Define semantics when `useDefineForClassFields: true` and target < ES2022. + var shouldTransformInitializersUsingDefine = useDefineForClassFields && languageVersion < 9 /* ScriptTarget.ES2022 */; + var shouldTransformInitializers = shouldTransformInitializersUsingSet || shouldTransformInitializersUsingDefine; + // We need to transform private members and class static blocks when target < ES2022. var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* ScriptTarget.ES2022 */; + // We need to transform `accessor` fields when target < ESNext + var shouldTransformAutoAccessors = languageVersion < 99 /* ScriptTarget.ESNext */; // We need to transform `this` in a static initializer into a reference to the class - // when targeting < ES2022 since the assignment will be moved outside of the class body. + // when target < ES2022 since the assignment will be moved outside of the class body. var shouldTransformThisInStaticInitializers = languageVersion < 9 /* ScriptTarget.ES2022 */; - // We don't need to transform `super` property access when targeting ES5, ES3 because + // We don't need to transform `super` property access when target <= ES5 because // the es2015 transformation handles those. var shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2 /* ScriptTarget.ES2015 */; + var shouldTransformAnything = shouldTransformInitializers || + shouldTransformPrivateElementsOrClassStaticBlocks || + shouldTransformAutoAccessors; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -94734,98 +95663,149 @@ var ts; var classLexicalEnvironmentStack = []; var classLexicalEnvironmentMap = new ts.Map(); var currentClassLexicalEnvironment; + var currentClassContainer; var currentComputedPropertyNameClassLexicalEnvironment; var currentStaticPropertyDeclarationOrStaticBlock; return ts.chainBundle(context, transformSourceFile); function transformSourceFile(node) { - var options = context.getCompilerOptions(); - if (node.isDeclarationFile - || useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9 /* ScriptTarget.ES2022 */) { + if (node.isDeclarationFile || !shouldTransformAnything) { return node; } var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); return visited; } - function visitorWorker(node, valueIsDiscarded) { - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) { - switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - return visitClassLike(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: - return visitVariableStatement(node); - case 80 /* SyntaxKind.PrivateIdentifier */: - return visitPrivateIdentifier(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitClassStaticBlockDeclaration(node); - } + function visitor(node) { + if (!(node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) && + !(node.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */)) { + return node; } - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */ || - node.transformFlags & 134217728 /* TransformFlags.ContainsLexicalSuper */ && - shouldTransformSuperInStaticInitializers && - currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: - return visitBinaryExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: - return visitCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitElementAccessExpression(node); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitExpressionStatement(node); - case 242 /* SyntaxKind.ForStatement */: - return visitForStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = undefined; - var result = ts.visitEachChild(node, visitor, context); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; - return result; - } + switch (node.kind) { + case 127 /* SyntaxKind.AccessorKeyword */: + return shouldTransformAutoAccessors ? undefined : node; + case 260 /* SyntaxKind.ClassDeclaration */: + return visitClassDeclaration(node); + case 228 /* SyntaxKind.ClassExpression */: + return visitClassExpression(node); + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + return visitClassStaticBlockDeclaration(node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return visitPropertyDeclaration(node); + case 240 /* SyntaxKind.VariableStatement */: + return visitVariableStatement(node); + case 80 /* SyntaxKind.PrivateIdentifier */: + return visitPrivateIdentifier(node); + case 208 /* SyntaxKind.PropertyAccessExpression */: + return visitPropertyAccessExpression(node); + case 209 /* SyntaxKind.ElementAccessExpression */: + return visitElementAccessExpression(node); + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ false); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ false); + case 210 /* SyntaxKind.CallExpression */: + return visitCallExpression(node); + case 241 /* SyntaxKind.ExpressionStatement */: + return visitExpressionStatement(node); + case 212 /* SyntaxKind.TaggedTemplateExpression */: + return visitTaggedTemplateExpression(node); + case 245 /* SyntaxKind.ForStatement */: + return visitForStatement(node); + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + // If we are descending into a new scope, clear the current static property or block + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, fallbackVisitor, node); } + default: + return fallbackVisitor(node); } + } + function fallbackVisitor(node) { return ts.visitEachChild(node, visitor, context); } + /** + * Visits a node in an expression whose result is discarded. + */ function discardedValueVisitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ true); - } - function visitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ false); + switch (node.kind) { + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ true); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ true); + default: + return visitor(node); + } } + /** + * Visits a node in a {@link HeritageClause}. + */ function heritageClauseVisitor(node) { switch (node.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return ts.visitEachChild(node, heritageClauseVisitor, context); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitExpressionWithTypeArguments(node); + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + return visitExpressionWithTypeArgumentsInHeritageClause(node); + default: + return visitor(node); } - return visitor(node); } - function visitorDestructuringTarget(node) { + /** + * Visits the assignment target of a destructuring assignment. + */ + function assignmentTargetVisitor(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitAssignmentPattern(node); default: return visitor(node); } } + /** + * Visits a member of a class. + */ + function classElementVisitor(node) { + switch (node.kind) { + case 173 /* SyntaxKind.Constructor */: + return visitConstructorDeclaration(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitMethodOrAccessorDeclaration, node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitPropertyDeclaration, node); + case 164 /* SyntaxKind.ComputedPropertyName */: + return visitComputedPropertyName(node); + case 237 /* SyntaxKind.SemicolonClassElement */: + return node; + default: + return visitor(node); + } + } + /** + * Visits the results of an auto-accessor field transformation in a second pass. + */ + function accessorFieldResultVisitor(node) { + switch (node.kind) { + case 169 /* SyntaxKind.PropertyDeclaration */: + return transformFieldInitializer(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return classElementVisitor(node); + default: + ts.Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); + break; + } + } /** * If we visit a private name, this means it is an undeclared private name. * Replace it with an empty identifier to indicate a problem with the code, @@ -94841,17 +95821,15 @@ var ts; } return ts.setOriginalNode(factory.createIdentifier(""), node); } + function isPrivateIdentifierInExpression(node) { + return ts.isPrivateIdentifier(node.left) + && node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; + } /** * Visits `#id in expr` */ - function visitPrivateIdentifierInInExpression(node) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return node; - } - var privId = node.left; - ts.Debug.assertNode(privId, ts.isPrivateIdentifier); - ts.Debug.assert(node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */); - var info = accessPrivateIdentifier(privId); + function transformPrivateIdentifierInInExpression(node) { + var info = accessPrivateIdentifier(node.left); if (info) { var receiver = ts.visitNode(node.right, visitor, ts.isExpression); return ts.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node); @@ -94859,31 +95837,6 @@ var ts; // Private name has not been declared. Subsequent transformers will handle this error return ts.visitEachChild(node, visitor, context); } - /** - * Visits the members of a class that has fields. - * - * @param node The node to visit. - */ - function classElementVisitor(node) { - switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - // Constructors for classes using class fields are transformed in - // `visitClassDeclaration` or `visitClassExpression`. - return undefined; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - return visitMethodOrAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitComputedPropertyName(node); - case 234 /* SyntaxKind.SemicolonClassElement */: - return node; - default: - return visitor(node); - } - } function visitVariableStatement(node) { var savedPendingStatements = pendingStatements; pendingStatements = []; @@ -94893,15 +95846,24 @@ var ts; pendingStatements = savedPendingStatements; return statement; } - function visitComputedPropertyName(name) { - var node = ts.visitEachChild(name, visitor, context); + function visitComputedPropertyName(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (ts.some(pendingExpressions)) { - var expressions = pendingExpressions; - expressions.push(node.expression); - pendingExpressions = []; - node = factory.updateComputedPropertyName(node, factory.inlineExpressions(expressions)); + if (ts.isParenthesizedExpression(expression)) { + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression.expression], false))); + } + else { + expression = factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression], false)); + } + pendingExpressions = undefined; } - return node; + return factory.updateComputedPropertyName(node, expression); + } + function visitConstructorDeclaration(node) { + if (currentClassContainer) { + return transformConstructor(node, currentClassContainer); + } + return fallbackVisitor(node); } function visitMethodOrAccessorDeclaration(node) { ts.Debug.assert(!ts.hasDecorators(node)); @@ -94916,13 +95878,20 @@ var ts; } var functionName = getHoistedFunctionName(node); if (functionName) { - getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m); }), node.asteriskToken, functionName, - /* typeParameters */ undefined, ts.visitParameterList(node.parameters, classElementVisitor, context), - /* type */ undefined, ts.visitFunctionBody(node.body, classElementVisitor, context)))); + getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m) && !ts.isAccessorModifier(m); }), node.asteriskToken, functionName, + /* typeParameters */ undefined, ts.visitParameterList(node.parameters, visitor, context), + /* type */ undefined, ts.visitFunctionBody(node.body, visitor, context)))); } // remove method declaration from class return undefined; } + function setCurrentStaticPropertyDeclarationOrStaticBlockAnd(current, visitor, arg) { + var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + currentStaticPropertyDeclarationOrStaticBlock = current; + var result = visitor(arg); + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return result; + } function getHoistedFunctionName(node) { ts.Debug.assert(ts.isPrivateIdentifier(node.name)); var info = accessPrivateIdentifier(node.name); @@ -94939,49 +95908,104 @@ var ts; } } } - function visitPropertyDeclaration(node) { - ts.Debug.assert(!ts.hasDecorators(node)); - if (ts.isPrivateIdentifier(node.name)) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - if (ts.isStatic(node)) { - // static fields are left as is - return ts.visitEachChild(node, visitor, context); - } - // Initializer is elided as the field is initialized in transformConstructor. - return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*questionOrExclamationToken*/ undefined, - /*type*/ undefined, - /*initializer*/ undefined); - } - // leave invalid code untransformed + function transformAutoAccessor(node) { + // transforms: + // accessor x = 1; + // into: + // #x = 1; + // get x() { return this.#x; } + // set x(value) { this.#x = value; } + ts.Debug.assertEachNode(node.modifiers, ts.isModifier); + var commentRange = ts.getCommentRange(node); + var sourceMapRange = ts.getSourceMapRange(node); + // Since we're creating two declarations where there was previously one, cache + // the expression for any computed property names. + var name = node.name; + var getterName = name; + var setterName = name; + if (ts.isComputedPropertyName(name) && !ts.isSimpleInlineableExpression(name.expression)) { + var temp = factory.createTempVariable(hoistVariableDeclaration); + ts.setSourceMapRange(temp, name.expression); + var expression = ts.visitNode(name.expression, visitor, ts.isExpression); + var assignment = factory.createAssignment(temp, expression); + ts.setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp])); + setterName = factory.updateComputedPropertyName(name, temp); + } + var backingField = ts.createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); + ts.setOriginalNode(backingField, node); + ts.setEmitFlags(backingField, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(backingField, sourceMapRange); + var getter = ts.createAccessorPropertyGetRedirector(factory, node, node.modifiers, getterName); + ts.setOriginalNode(getter, node); + ts.setCommentRange(getter, commentRange); + ts.setSourceMapRange(getter, sourceMapRange); + var setter = ts.createAccessorPropertySetRedirector(factory, node, node.modifiers, setterName); + ts.setOriginalNode(setter, node); + ts.setEmitFlags(setter, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(setter, sourceMapRange); + return ts.visitArray([backingField, getter, setter], accessorFieldResultVisitor, ts.isClassElement); + } + function transformPrivateFieldInitializer(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + // If we are transforming private elements into WeakMap/WeakSet, we should elide the node. var info = accessPrivateIdentifier(node.name); ts.Debug.assert(info, "Undeclared private name for property declaration."); - if (!info.isValid) { - return node; - } - } - // Create a temporary variable to store a computed property name (if necessary). - // If it's not inlineable, then we emit an expression after the class which assigns - // the property name to the temporary variable. - var expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer || useDefineForClassFields); - if (expr && !ts.isSimpleInlineableExpression(expr)) { - getPendingExpressions().push(expr); + // Leave invalid code untransformed; otherwise, elide the node as it is transformed elsewhere. + return info.isValid ? undefined : node; + } + if (shouldTransformInitializersUsingSet && !ts.isStatic(node)) { + // If we are transforming initializers using Set semantics we will elide the initializer as it will + // be moved to the constructor to preserve evaluation order next to public instance fields. We don't + // need to do this transformation for private static fields since public static fields can be + // transformed into `static {}` blocks. + return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + /*initializer*/ undefined); } - if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) { - var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); - if (initializerStatement) { - var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); - ts.setOriginalNode(staticBlock, node); - ts.setCommentRange(staticBlock, node); - // Set the comment range for the statement to an empty synthetic range - // and drop synthetic comments from the statement to avoid printing them twice. - ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); - ts.setSyntheticLeadingComments(initializerStatement, undefined); - ts.setSyntheticTrailingComments(initializerStatement, undefined); - return staticBlock; + return ts.visitEachChild(node, visitor, context); + } + function transformPublicFieldInitializer(node) { + if (shouldTransformInitializers) { + // Create a temporary variable to store a computed property name (if necessary). + // If it's not inlineable, then we emit an expression after the class which assigns + // the property name to the temporary variable. + var expr = getPropertyNameExpressionIfNeeded(node.name, /*shouldHoist*/ !!node.initializer || useDefineForClassFields); + if (expr) { + getPendingExpressions().push(expr); + } + if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks) { + var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); + if (initializerStatement) { + var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); + ts.setOriginalNode(staticBlock, node); + ts.setCommentRange(staticBlock, node); + // Set the comment range for the statement to an empty synthetic range + // and drop synthetic comments from the statement to avoid printing them twice. + ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); + ts.setSyntheticLeadingComments(initializerStatement, undefined); + ts.setSyntheticTrailingComments(initializerStatement, undefined); + return staticBlock; + } } + return undefined; } - return undefined; + return ts.visitEachChild(node, classElementVisitor, context); + } + function transformFieldInitializer(node) { + ts.Debug.assert(!ts.hasDecorators(node), "Decorators should already have been transformed and elided."); + return ts.isPrivateIdentifierClassElementDeclaration(node) ? + transformPrivateFieldInitializer(node) : + transformPublicFieldInitializer(node); + } + function visitPropertyDeclaration(node) { + // If this is an auto-accessor, we defer to `transformAutoAccessor`. That function + // will in turn call `transformFieldInitializer` as needed. + if (shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(node)) { + return transformAutoAccessor(node); + } + return transformFieldInitializer(node); } function createPrivateIdentifierAccess(info, receiver) { return createPrivateIdentifierAccessHelper(info, ts.visitNode(receiver, visitor, ts.isExpression)); @@ -95045,9 +96069,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) { - if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || node.operator === 46 /* SyntaxKind.MinusMinusToken */) { + if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || + node.operator === 46 /* SyntaxKind.MinusMinusToken */) { var operand = ts.skipParentheses(node.operand); - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(operand)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(operand)) { var info = void 0; if (info = accessPrivateIdentifier(operand.name)) { var receiver = ts.visitNode(operand.expression, visitor, ts.isExpression); @@ -95136,7 +96162,9 @@ var ts; return { readExpression: readExpression, initializeExpression: initializeExpression }; } function visitCallExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + // obj.#x() // Transform call expressions of private names to properly bind the `this` parameter. var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; if (ts.isCallChain(node)) { @@ -95151,6 +96179,8 @@ var ts; ts.isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.classConstructor)) { + // super.x() + // super[x]() // converts `super.f(...)` into `Reflect.get(_baseTemp, "f", _classTemp).call(_classTemp, ...)` var invocation = factory.createFunctionCallCall(ts.visitNode(node.expression, visitor, ts.isExpression), currentClassLexicalEnvironment.classConstructor, ts.visitNodes(node.arguments, visitor, ts.isExpression)); ts.setOriginalNode(invocation, node); @@ -95160,7 +96190,8 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitTaggedTemplateExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { // Bind the `this` correctly for tagged template literals when the tag is a private identifier property access. var _a = factory.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; return factory.updateTaggedTemplateExpression(node, factory.createCallExpression(factory.createPropertyAccessExpression(ts.visitNode(target, visitor), "bind"), @@ -95186,11 +96217,8 @@ var ts; classLexicalEnvironmentMap.set(ts.getOriginalNodeId(node), currentClassLexicalEnvironment); } startLexicalEnvironment(); - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = node; - var statements = ts.visitNodes(node.body.statements, visitor, ts.isStatement); + var statements = setCurrentStaticPropertyDeclarationOrStaticBlockAnd(node, function (statements) { return ts.visitNodes(statements, visitor, ts.isStatement); }, node.body.statements); statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; var iife = factory.createImmediatelyInvokedArrowFunction(statements); ts.setOriginalNode(iife, node); ts.setTextRange(iife, node); @@ -95200,9 +96228,12 @@ var ts; } function visitBinaryExpression(node, valueIsDiscarded) { if (ts.isDestructuringAssignment(node)) { + // ({ x: obj.#x } = ...) + // ({ x: super.x } = ...) + // ({ x: super[x] } = ...) var savedPendingExpressions = pendingExpressions; pendingExpressions = undefined; - node = factory.updateBinaryExpression(node, ts.visitNode(node.left, visitorDestructuringTarget), node.operatorToken, ts.visitNode(node.right, visitor)); + node = factory.updateBinaryExpression(node, ts.visitNode(node.left, assignmentTargetVisitor), node.operatorToken, ts.visitNode(node.right, visitor)); var expr = ts.some(pendingExpressions) ? factory.inlineExpressions(ts.compact(__spreadArray(__spreadArray([], pendingExpressions, true), [node], false))) : node; @@ -95210,7 +96241,9 @@ var ts; return expr; } if (ts.isAssignmentExpression(node)) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + // obj.#x = ... var info = accessPrivateIdentifier(node.left.name); if (info) { return ts.setTextRange(ts.setOriginalNode(createPrivateIdentifierAssignment(info, node.left.expression, node.right, node.operatorToken.kind), node), node); @@ -95220,6 +96253,10 @@ var ts; ts.isSuperProperty(node.left) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + // super.x = ... + // super[x] = ... + // super.x += ... + // super.x -= ... var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts; if (facts & 1 /* ClassFacts.ClassWasDecorated */) { return factory.updateBinaryExpression(node, visitInvalidSuperProperty(node.left), node.operatorToken, ts.visitNode(node.right, visitor, ts.isExpression)); @@ -95263,8 +96300,10 @@ var ts; } } } - if (node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ && ts.isPrivateIdentifier(node.left)) { - return visitPrivateIdentifierInInExpression(node); + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierInExpression(node)) { + // #x in obj + return transformPrivateIdentifierInInExpression(node); } return ts.visitEachChild(node, visitor, context); } @@ -95289,36 +96328,6 @@ var ts; ts.Debug.assertNever(info, "Unknown private element type"); } } - /** - * Set up the environment for a class. - */ - function visitClassLike(node) { - if (!ts.forEach(node.members, doesClassElementNeedTransform)) { - return ts.visitEachChild(node, visitor, context); - } - var savedPendingExpressions = pendingExpressions; - pendingExpressions = undefined; - startClassLexicalEnvironment(); - if (shouldTransformPrivateElementsOrClassStaticBlocks) { - var name = ts.getNameOfDeclaration(node); - if (name && ts.isIdentifier(name)) { - getPrivateIdentifierEnvironment().className = ts.idText(name); - } - var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); - if (ts.some(privateInstanceMethodsAndAccessors)) { - getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); - } - } - var result = ts.isClassDeclaration(node) ? - visitClassDeclaration(node) : - visitClassExpression(node); - endClassLexicalEnvironment(); - pendingExpressions = savedPendingExpressions; - return result; - } - function doesClassElementNeedTransform(node) { - return ts.isPropertyDeclaration(node) || ts.isClassStaticBlockDeclaration(node) || (shouldTransformPrivateElementsOrClassStaticBlocks && node.name && ts.isPrivateIdentifier(node.name)); - } function getPrivateInstanceMethodsAndAccessors(node) { return ts.filter(node.members, ts.isNonStaticMethodOrAccessorWithPrivateName); } @@ -95332,7 +96341,7 @@ var ts; var member = _a[_i]; if (!ts.isStatic(member)) continue; - if (member.name && ts.isPrivateIdentifier(member.name) && shouldTransformPrivateElementsOrClassStaticBlocks) { + if (member.name && (ts.isPrivateIdentifier(member.name) || ts.isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) { facts |= 2 /* ClassFacts.NeedsClassConstructorReference */; } if (ts.isPropertyDeclaration(member) || ts.isClassStaticBlockDeclaration(member)) { @@ -95351,7 +96360,7 @@ var ts; } return facts; } - function visitExpressionWithTypeArguments(node) { + function visitExpressionWithTypeArgumentsInHeritageClause(node) { var facts = (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.facts) || 0 /* ClassFacts.None */; if (facts & 4 /* ClassFacts.NeedsClassSuperReference */) { var temp = factory.createTempVariable(hoistVariableDeclaration, /*reserveInNestedScopes*/ true); @@ -95361,7 +96370,22 @@ var ts; } return ts.visitEachChild(node, visitor, context); } - function visitClassDeclaration(node) { + function visitInNewClassLexicalEnvironment(node, visitor) { + var savedCurrentClassContainer = currentClassContainer; + var savedPendingExpressions = pendingExpressions; + currentClassContainer = node; + pendingExpressions = undefined; + startClassLexicalEnvironment(); + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + var name = ts.getNameOfDeclaration(node); + if (name && ts.isIdentifier(name)) { + getPrivateIdentifierEnvironment().className = name; + } + var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); + if (ts.some(privateInstanceMethodsAndAccessors)) { + getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); + } + } var facts = getClassFacts(node); if (facts) { getClassLexicalEnvironment().facts = facts; @@ -95369,6 +96393,16 @@ var ts; if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { enableSubstitutionForClassStaticThisOrSuperReference(); } + var result = visitor(node, facts); + endClassLexicalEnvironment(); + currentClassContainer = savedCurrentClassContainer; + pendingExpressions = savedPendingExpressions; + return result; + } + function visitClassDeclaration(node) { + return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); + } + function visitClassDeclarationInNewClassLexicalEnvironment(node, facts) { // If a class has private static fields, or a static field has a `this` or `super` reference, // then we need to allocate a temp variable to hold on to that reference. var pendingClassReferenceAssignment; @@ -95377,12 +96411,16 @@ var ts; getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); - var statements = [ - factory.updateClassDeclaration(node, node.modifiers, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) - ]; + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classDecl = factory.updateClassDeclaration(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var statements = []; + if (prologue) { + statements.push(factory.createExpressionStatement(prologue)); + } + statements.push(classDecl); if (pendingClassReferenceAssignment) { getPendingExpressions().unshift(pendingClassReferenceAssignment); } @@ -95390,25 +96428,23 @@ var ts; if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); } - // Emit static property assignment. Because classDeclaration is lexically evaluated, - // it is safe to emit static property assignment after classDeclaration - // From ES6 specification: - // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using - // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. - var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); - if (ts.some(staticProperties)) { - addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + if (shouldTransformInitializersUsingSet || shouldTransformPrivateElementsOrClassStaticBlocks) { + // Emit static property assignment. Because classDeclaration is lexically evaluated, + // it is safe to emit static property assignment after classDeclaration + // From ES6 specification: + // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using + // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. + var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); + if (ts.some(staticProperties)) { + addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + } } return statements; } function visitClassExpression(node) { - var facts = getClassFacts(node); - if (facts) { - getClassLexicalEnvironment().facts = facts; - } - if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { - enableSubstitutionForClassStaticThisOrSuperReference(); - } + return visitInNewClassLexicalEnvironment(node, visitClassExpressionInNewClassLexicalEnvironment); + } + function visitClassExpressionInNewClassLexicalEnvironment(node, facts) { // If this class expression is a transformation of a decorated class declaration, // then we want to output the pendingExpressions as statements, not as inlined // expressions with the class statement. @@ -95418,8 +96454,6 @@ var ts; // these statements after the class expression variable statement. var isDecoratedClassDeclaration = !!(facts & 1 /* ClassFacts.ClassWasDecorated */); var staticPropertiesOrClassStaticBlocks = ts.getStaticPropertiesAndClassStaticBlock(node); - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; var temp; function createClassTempVar() { @@ -95432,9 +96466,23 @@ var ts; temp = createClassTempVar(); getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); } - var classExpression = factory.updateClassExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)); - var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(staticPropertiesOrClassStaticBlocks, function (p) { return ts.isClassStaticBlockDeclaration(p) || !!p.initializer || ts.isPrivateIdentifier(p.name); }); + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classExpression = factory.updateClassExpression(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var expressions = []; + if (prologue) { + expressions.push(prologue); + } + // Static initializers are transformed to `static {}` blocks when `useDefineForClassFields: false` + // and not also transforming static blocks. + var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && + ts.some(staticPropertiesOrClassStaticBlocks, function (node) { + return ts.isClassStaticBlockDeclaration(node) || + ts.isPrivateIdentifierClassElementDeclaration(node) || + shouldTransformInitializers && ts.isInitializedProperty(node); + }); if (hasTransformableStatics || ts.some(pendingExpressions)) { if (isDecoratedClassDeclaration) { ts.Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); @@ -95446,12 +96494,16 @@ var ts; addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); } if (temp) { - return factory.inlineExpressions([factory.createAssignment(temp, classExpression), temp]); + expressions.push(ts.startOnNewLine(factory.createAssignment(temp, classExpression)), ts.startOnNewLine(temp)); + } + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } } - return classExpression; } else { - var expressions = []; temp || (temp = createClassTempVar()); if (isClassWithConstructorReference) { // record an alias as the class name is not in scope for statics. @@ -95468,45 +96520,87 @@ var ts; ts.addRange(expressions, ts.map(pendingExpressions, ts.startOnNewLine)); ts.addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); expressions.push(ts.startOnNewLine(temp)); - return factory.inlineExpressions(expressions); } } - return classExpression; + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } + } + return factory.inlineExpressions(expressions); } function visitClassStaticBlockDeclaration(node) { if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return ts.visitEachChild(node, classElementVisitor, context); + return ts.visitEachChild(node, visitor, context); } // ClassStaticBlockDeclaration for classes are transformed in `visitClassDeclaration` or `visitClassExpression`. return undefined; } - function transformClassMembers(node, isDerivedClass) { - var members = []; + function transformClassMembers(node) { + // Declare private names if (shouldTransformPrivateElementsOrClassStaticBlocks) { - // Declare private names. for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (ts.isPrivateIdentifierClassElementDeclaration(member)) { - addPrivateIdentifierToEnvironment(member); + addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); } } if (ts.some(getPrivateInstanceMethodsAndAccessors(node))) { createBrandCheckWeakSetForPrivateMethods(); } + if (shouldTransformAutoAccessors) { + for (var _b = 0, _c = node.members; _b < _c.length; _b++) { + var member = _c[_b]; + if (ts.isAutoAccessorPropertyDeclaration(member)) { + var storageName = factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"); + addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + } + } + } } - var constructor = transformConstructor(node, isDerivedClass); - var visitedMembers = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); - if (constructor) { - members.push(constructor); + var members = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); + // Create a synthetic constructor if necessary + var syntheticConstructor; + if (!ts.some(members, ts.isConstructorDeclaration)) { + syntheticConstructor = transformConstructor(/*constructor*/ undefined, node); } + var prologue; + // If there are pending expressions create a class static block in which to evaluate them, but only if + // class static blocks are not also being transformed. This block will be injected at the top of the class + // to ensure that expressions from computed property names are evaluated before any other static + // initializers. + var syntheticStaticBlock; if (!shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(pendingExpressions)) { - members.push(factory.createClassStaticBlockDeclaration(factory.createBlock([ - factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)) - ]))); + var statement = factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)); + if (statement.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */) { + // If there are `this` or `super` references from computed property names, shift the expression + // into an arrow function to be evaluated in the outer scope so that `this` and `super` are + // properly captured. + var temp = factory.createTempVariable(hoistVariableDeclaration); + var arrow = factory.createArrowFunction( + /*modifiers*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, + /*equalsGreaterThanToken*/ undefined, factory.createBlock([statement])); + prologue = factory.createAssignment(temp, arrow); + statement = factory.createExpressionStatement(factory.createCallExpression(temp, /*typeArguments*/ undefined, [])); + } + var block = factory.createBlock([statement]); + syntheticStaticBlock = factory.createClassStaticBlockDeclaration(block); pendingExpressions = undefined; } - ts.addRange(members, visitedMembers); - return ts.setTextRange(factory.createNodeArray(members), /*location*/ node.members); + // If we created a synthetic constructor or class static block, add them to the visited members + // and return a new array. + if (syntheticConstructor || syntheticStaticBlock) { + var membersArray = void 0; + membersArray = ts.append(membersArray, syntheticConstructor); + membersArray = ts.append(membersArray, syntheticStaticBlock); + membersArray = ts.addRange(membersArray, members); + members = ts.setTextRange(factory.createNodeArray(membersArray), /*location*/ node.members); + } + return { members: members, prologue: prologue }; } function createBrandCheckWeakSetForPrivateMethods() { var weakSetName = getPrivateIdentifierEnvironment().weakSetName; @@ -95515,35 +96609,38 @@ var ts; /*typeArguments*/ undefined, []))); } function isClassElementThatRequiresConstructorStatement(member) { - if (ts.isStatic(member) || ts.hasSyntacticModifier(ts.getOriginalNode(member), 128 /* ModifierFlags.Abstract */)) { + if (ts.isStatic(member) || ts.hasAbstractModifier(ts.getOriginalNode(member))) { return false; } - if (useDefineForClassFields) { - // If we are using define semantics and targeting ESNext or higher, - // then we don't need to transform any class properties. - return languageVersion < 9 /* ScriptTarget.ES2022 */; - } - return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member); + return shouldTransformInitializersUsingDefine && ts.isPropertyDeclaration(member) || + shouldTransformInitializersUsingSet && ts.isInitializedProperty(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(member); } - function transformConstructor(node, isDerivedClass) { - var constructor = ts.visitNode(ts.getFirstConstructorWithBody(node), visitor, ts.isConstructorDeclaration); - var elements = node.members.filter(isClassElementThatRequiresConstructorStatement); - if (!ts.some(elements)) { + function transformConstructor(constructor, container) { + constructor = ts.visitNode(constructor, visitor, ts.isConstructorDeclaration); + if (!ts.some(container.members, isClassElementThatRequiresConstructorStatement)) { return constructor; } + var extendsClauseElement = ts.getEffectiveBaseTypeNode(container); + var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var parameters = ts.visitParameterList(constructor ? constructor.parameters : undefined, visitor, context); - var body = transformConstructorBody(node, constructor, isDerivedClass); + var body = transformConstructorBody(container, constructor, isDerivedClass); if (!body) { - return undefined; + return constructor; + } + if (constructor) { + ts.Debug.assert(parameters); + return factory.updateConstructorDeclaration(constructor, /*modifiers*/ undefined, parameters, body); } return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration( - /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || node), constructor)); + /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || container), constructor)); } function transformConstructorBody(node, constructor, isDerivedClass) { - var _a; + var _a, _b; var properties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ false); if (!useDefineForClassFields) { - properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name); }); + properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name) || ts.hasAccessorModifier(property); }); } var privateMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); var needsConstructorBody = ts.some(properties) || ts.some(privateMethodsAndAccessors); @@ -95595,8 +96692,8 @@ var ts; statements = statements.filter(function (statement) { return !ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor); }); } else { - for (var _i = 0, _b = constructor.body.statements; _i < _b.length; _i++) { - var statement = _b[_i]; + for (var _i = 0, _c = constructor.body.statements; _i < _c.length; _i++) { + var statement = _c[_i]; if (ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { parameterPropertyDeclarationCount++; } @@ -95628,9 +96725,14 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue)); } statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + if (statements.length === 0 && !constructor) { + return undefined; + } + var multiLine = (constructor === null || constructor === void 0 ? void 0 : constructor.body) && constructor.body.statements.length >= statements.length ? + (_b = constructor.body.multiLine) !== null && _b !== void 0 ? _b : statements.length > 0 : + statements.length > 0; return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), - /*location*/ constructor ? constructor.body.statements : node.members), - /*multiLine*/ true), + /*location*/ constructor ? constructor.body.statements : node.members), multiLine), /*location*/ constructor ? constructor.body : undefined); function visitBodyStatement(statement) { if (useDefineForClassFields && ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { @@ -95666,9 +96768,10 @@ var ts; return undefined; } var statement = factory.createExpressionStatement(expression); + ts.setOriginalNode(statement, property); + ts.addEmitFlags(statement, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); - ts.setOriginalNode(statement, property); // `setOriginalNode` *copies* the `emitNode` from `property`, so now both // `statement` and `expression` have a copy of the synthesized comments. // Drop the comments from expression to avoid printing them twice. @@ -95691,9 +96794,10 @@ var ts; continue; } ts.startOnNewLine(expression); + ts.setOriginalNode(expression, property); + ts.addEmitFlags(expression, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); ts.setCommentRange(expression, property); - ts.setOriginalNode(expression, property); expressions.push(expression); } return expressions; @@ -95720,9 +96824,11 @@ var ts; var _a; // We generate a name here in order to reuse the value cached by the relocated computed name expression (which uses the same generated name) var emitAssignment = !useDefineForClassFields; - var propertyName = ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) - ? factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) - : property.name; + var propertyName = ts.hasAccessorModifier(property) ? + factory.getGeneratedPrivateNameForNode(property.name) : + ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) ? + factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) : + property.name; if (ts.hasStaticModifier(property)) { currentStaticPropertyDeclarationOrStaticBlock = property; } @@ -95749,7 +96855,7 @@ var ts; return undefined; } var propertyOriginalNode = ts.getOriginalNode(property); - if (ts.hasSyntacticModifier(propertyOriginalNode, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(propertyOriginalNode, 256 /* ModifierFlags.Abstract */)) { return undefined; } var initializer = property.initializer || emitAssignment ? (_a = ts.visitNode(property.initializer, visitor, ts.isExpression)) !== null && _a !== void 0 ? _a : factory.createVoidZero() @@ -95783,17 +96889,17 @@ var ts; // substitute `this` in a static field initializer context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); // these push a new lexical environment that is not the class lexical environment - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // these push a new lexical environment that is not the class lexical environment, except // when they have a computed property name - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(167 /* SyntaxKind.PropertyDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(169 /* SyntaxKind.PropertyDeclaration */); // class lexical environments are restored when entering a computed property name - context.enableEmitNotification(162 /* SyntaxKind.ComputedPropertyName */); + context.enableEmitNotification(164 /* SyntaxKind.ComputedPropertyName */); } } /** @@ -95832,13 +96938,13 @@ var ts; } } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (ts.isArrowFunction(original) || ts.getEmitFlags(node) & 262144 /* EmitFlags.AsyncFunctionBody */) { break; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = undefined; @@ -95848,10 +96954,10 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentComputedPropertyNameClassLexicalEnvironment = currentClassLexicalEnvironment; @@ -95861,7 +96967,7 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 162 /* SyntaxKind.ComputedPropertyName */: { + case 164 /* SyntaxKind.ComputedPropertyName */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; @@ -95975,149 +97081,138 @@ var ts; function getPrivateIdentifierEnvironment() { var lex = getClassLexicalEnvironment(); lex.privateIdentifierEnvironment || (lex.privateIdentifierEnvironment = { - className: "", - identifiers: new ts.Map() + className: undefined, + weakSetName: undefined, + identifiers: undefined, + generatedIdentifiers: undefined, }); return lex.privateIdentifierEnvironment; } function getPendingExpressions() { - return pendingExpressions || (pendingExpressions = []); + return pendingExpressions !== null && pendingExpressions !== void 0 ? pendingExpressions : (pendingExpressions = []); } - function addPrivateIdentifierToEnvironment(node) { - var _a; - var text = ts.getTextOfPropertyName(node.name); - var lex = getClassLexicalEnvironment(); - var classConstructor = lex.classConstructor; - var privateEnv = getPrivateIdentifierEnvironment(); - var weakSetName = privateEnv.weakSetName; - var assignmentExpressions = []; - var privateName = node.name.escapedText; - var previousInfo = privateEnv.identifiers.get(privateName); - var isValid = !isReservedPrivateName(node.name) && previousInfo === undefined; - if (ts.hasStaticModifier(node)) { - ts.Debug.assert(classConstructor, "weakSetName should be set in private identifier environment"); - if (ts.isPropertyDeclaration(node)) { - var variableName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f" /* PrivateIdentifierKind.Field */, - variableName: variableName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isMethodDeclaration(node)) { - var functionName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: functionName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isGetAccessorDeclaration(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else if (ts.isSetAccessorDeclaration(node)) { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else { - ts.Debug.assertNever(node, "Unknown class element type."); - } + function addPrivateIdentifierClassElementToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + if (ts.isAutoAccessorPropertyDeclaration(node)) { + addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isPropertyDeclaration(node)) { - var weakMapName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { + addPrivateIdentifierPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isMethodDeclaration(node)) { + addPrivateIdentifierMethodDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isGetAccessorDeclaration(node)) { + addPrivateIdentifierGetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isSetAccessorDeclaration(node)) { + addPrivateIdentifierSetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + } + function addPrivateIdentifierPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + if (isStatic) { + ts.Debug.assert(lex.classConstructor, "classConstructor should be set in private identifier environment"); + var variableName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f" /* PrivateIdentifierKind.Field */, + brandCheckIdentifier: lex.classConstructor, + variableName: variableName, + isStatic: true, + isValid: isValid, + }); + } + else { + var weakMapName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { kind: "f" /* PrivateIdentifierKind.Field */, brandCheckIdentifier: weakMapName, - isStatic: false, variableName: undefined, + isStatic: false, isValid: isValid, }); - assignmentExpressions.push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), + getPendingExpressions().push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), /*typeArguments*/ undefined, []))); } - else if (ts.isMethodDeclaration(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: createHoistedVariableForPrivateName(text, node), - brandCheckIdentifier: weakSetName, - isStatic: false, + } + function addPrivateIdentifierMethodDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var methodName = createHoistedVariableForPrivateName(name); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "m" /* PrivateIdentifierKind.Method */, + methodName: methodName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierGetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.getterName) { + previousInfo.getterName = getterName; + } + else { + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: undefined, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, isValid: isValid, }); } - else if (ts.isAccessor(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - if (ts.isGetAccessor(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } - else { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } + } + function addPrivateIdentifierSetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.setterName) { + previousInfo.setterName = setterName; } else { - ts.Debug.assertNever(node, "Unknown class element type."); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: undefined, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); } - (_a = getPendingExpressions()).push.apply(_a, assignmentExpressions); } - function createHoistedVariableForClass(name, node) { + function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierToEnvironment(node, name, addDeclaration) { + var lex = getClassLexicalEnvironment(); + var privateEnv = getPrivateIdentifierEnvironment(); + var previousInfo = getPrivateIdentifier(privateEnv, name); + var isStatic = ts.hasStaticModifier(node); + var isValid = !isReservedPrivateName(name) && previousInfo === undefined; + addDeclaration(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + function createHoistedVariableForClass(name, node, suffix) { var className = getPrivateIdentifierEnvironment().className; - var prefix = className ? "_".concat(className) : ""; - var identifier = factory.createUniqueName("".concat(prefix, "_").concat(name), 16 /* GeneratedIdentifierFlags.Optimistic */); + var prefix = className ? { prefix: "_", node: className, suffix: "_" } : "_"; + var identifier = typeof name === "object" ? factory.getGeneratedNameForNode(name, 16 /* GeneratedIdentifierFlags.Optimistic */ | 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */, prefix, suffix) : + typeof name === "string" ? factory.createUniqueName(name, 16 /* GeneratedIdentifierFlags.Optimistic */, prefix, suffix) : + factory.createTempVariable(/*recordTempVariable*/ undefined, /*reserveInNestedScopes*/ true, prefix, suffix); if (resolver.getNodeCheckFlags(node) & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */) { addBlockScopedVariable(identifier); } @@ -96126,13 +97221,33 @@ var ts; } return identifier; } - function createHoistedVariableForPrivateName(privateName, node) { - return createHoistedVariableForClass(privateName.substring(1), node.name); + function createHoistedVariableForPrivateName(name, suffix) { + var _a; + var text = ts.tryGetTextOfPropertyName(name); + return createHoistedVariableForClass((_a = text === null || text === void 0 ? void 0 : text.substring(1)) !== null && _a !== void 0 ? _a : name, name, suffix); } + /** + * Access an already defined {@link PrivateIdentifier} in the current {@link PrivateIdentifierEnvironment}. + * + * @seealso {@link addPrivateIdentifierToEnvironment} + */ function accessPrivateIdentifier(name) { - var _a; + if (ts.isGeneratedPrivateIdentifier(name)) { + return accessGeneratedPrivateIdentifier(name); + } + else { + return accessPrivateIdentifierByText(name.escapedText); + } + } + function accessPrivateIdentifierByText(text) { + return accessPrivateIdentifierWorker(getPrivateIdentifierInfo, text); + } + function accessGeneratedPrivateIdentifier(name) { + return accessPrivateIdentifierWorker(getGeneratedPrivateIdentifierInfo, ts.getNodeForGeneratedName(name)); + } + function accessPrivateIdentifierWorker(getPrivateIdentifierInfo, privateIdentifierKey) { if (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.privateIdentifierEnvironment) { - var info = currentClassLexicalEnvironment.privateIdentifierEnvironment.identifiers.get(name.escapedText); + var info = getPrivateIdentifierInfo(currentClassLexicalEnvironment.privateIdentifierEnvironment, privateIdentifierKey); if (info) { return info; } @@ -96142,9 +97257,11 @@ var ts; if (!env) { continue; } - var info = (_a = env.privateIdentifierEnvironment) === null || _a === void 0 ? void 0 : _a.identifiers.get(name.escapedText); - if (info) { - return info; + if (env.privateIdentifierEnvironment) { + var info = getPrivateIdentifierInfo(env.privateIdentifierEnvironment, privateIdentifierKey); + if (info) { + return info; + } } } return undefined; @@ -96201,7 +97318,7 @@ var ts; } } } - return ts.visitNode(node, visitorDestructuringTarget); + return ts.visitNode(node, assignmentTargetVisitor); } function visitObjectAssignmentTarget(node) { if (ts.isObjectBindingOrAssignmentElement(node) && !ts.isShorthandPropertyAssignment(node)) { @@ -96234,10 +97351,10 @@ var ts; var initializer = ts.getInitializerOfBindingOrAssignmentElement(node); return factory.updatePropertyAssignment(node, ts.visitNode(node.name, visitor, ts.isPropertyName), wrapped ? initializer ? factory.createAssignment(wrapped, ts.visitNode(initializer, visitor)) : wrapped : - ts.visitNode(node.initializer, visitorDestructuringTarget, ts.isExpression)); + ts.visitNode(node.initializer, assignmentTargetVisitor, ts.isExpression)); } if (ts.isSpreadAssignment(node)) { - return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, visitorDestructuringTarget, ts.isExpression)); + return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, assignmentTargetVisitor, ts.isExpression)); } ts.Debug.assert(wrapped === undefined, "Should not have generated a wrapped target"); } @@ -96283,7 +97400,31 @@ var ts; /*typeArguments*/ undefined, [receiver]); } function isReservedPrivateName(node) { - return node.escapedText === "#constructor"; + return !ts.isGeneratedPrivateIdentifier(node) && node.escapedText === "#constructor"; + } + function getPrivateIdentifier(privateEnv, name) { + return ts.isGeneratedPrivateIdentifier(name) ? + getGeneratedPrivateIdentifierInfo(privateEnv, ts.getNodeForGeneratedName(name)) : + getPrivateIdentifierInfo(privateEnv, name.escapedText); + } + function setPrivateIdentifier(privateEnv, name, info) { + var _a, _b; + if (ts.isGeneratedPrivateIdentifier(name)) { + (_a = privateEnv.generatedIdentifiers) !== null && _a !== void 0 ? _a : (privateEnv.generatedIdentifiers = new ts.Map()); + privateEnv.generatedIdentifiers.set(ts.getNodeForGeneratedName(name), info); + } + else { + (_b = privateEnv.identifiers) !== null && _b !== void 0 ? _b : (privateEnv.identifiers = new ts.Map()); + privateEnv.identifiers.set(name.escapedText, info); + } + } + function getPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.identifiers) === null || _a === void 0 ? void 0 : _a.get(key); + } + function getGeneratedPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.generatedIdentifiers) === null || _a === void 0 ? void 0 : _a.get(key); } })(ts || (ts = {})); /*@internal*/ @@ -96324,15 +97465,15 @@ var ts; */ function serializeTypeOfNode(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: return serializeTypeNode(node.type); - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return serializeTypeNode(getAccessorTypeNode(node)); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createIdentifier("Function"); default: return ts.factory.createVoidZero(); @@ -96368,7 +97509,7 @@ var ts; return ts.factory.createArrayLiteralExpression(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (container && node.kind === 174 /* SyntaxKind.GetAccessor */) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -96414,66 +97555,66 @@ var ts; node = ts.skipTypeParentheses(node); switch (node.kind) { case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return ts.factory.createVoidZero(); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return ts.factory.createIdentifier("Function"); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return ts.factory.createIdentifier("Array"); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? ts.factory.createVoidZero() : ts.factory.createIdentifier("Boolean"); - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return ts.factory.createIdentifier("Boolean"); - case 198 /* SyntaxKind.TemplateLiteralType */: - case 150 /* SyntaxKind.StringKeyword */: + case 200 /* SyntaxKind.TemplateLiteralType */: + case 152 /* SyntaxKind.StringKeyword */: return ts.factory.createIdentifier("String"); - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return ts.factory.createIdentifier("Object"); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return serializeLiteralOfLiteralTypeNode(node.literal); - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return ts.factory.createIdentifier("Number"); - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return getGlobalConstructor("BigInt", 7 /* ScriptTarget.ES2020 */); - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return getGlobalConstructor("Symbol", 2 /* ScriptTarget.ES2015 */); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return serializeTypeReferenceNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ true); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ false); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return serializeUnionOrIntersectionConstituents([node.trueType, node.falseType], /*isIntersection*/ false); - case 193 /* SyntaxKind.TypeOperator */: - if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + case 195 /* SyntaxKind.TypeOperator */: + if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { return serializeTypeNode(node.type); } break; - case 181 /* SyntaxKind.TypeQuery */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 192 /* SyntaxKind.ThisType */: - case 200 /* SyntaxKind.ImportType */: + case 183 /* SyntaxKind.TypeQuery */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 194 /* SyntaxKind.ThisType */: + case 202 /* SyntaxKind.ImportType */: break; // handle JSDoc types from an invalid parse - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - case 319 /* SyntaxKind.JSDocNamepathType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 321 /* SyntaxKind.JSDocVariadicType */: + case 322 /* SyntaxKind.JSDocNamepathType */: break; - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return serializeTypeNode(node.type); default: return ts.Debug.failBadSyntaxKind(node); @@ -96485,7 +97626,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.factory.createIdentifier("String"); - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; switch (operand.kind) { case 8 /* SyntaxKind.NumericLiteral */: @@ -96514,20 +97655,20 @@ var ts; for (var _i = 0, types_22 = types; _i < types_22.length; _i++) { var typeNode = types_22[_i]; typeNode = ts.skipTypeParentheses(typeNode); - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { if (isIntersection) return ts.factory.createVoidZero(); // Reduce to `never` in an intersection continue; // Elide `never` in a union } - if (typeNode.kind === 155 /* SyntaxKind.UnknownKeyword */) { + if (typeNode.kind === 157 /* SyntaxKind.UnknownKeyword */) { if (!isIntersection) return ts.factory.createIdentifier("Object"); // Reduce to `unknown` in a union continue; // Elide `unknown` in an intersection } - if (typeNode.kind === 130 /* SyntaxKind.AnyKeyword */) { + if (typeNode.kind === 131 /* SyntaxKind.AnyKeyword */) { return ts.factory.createIdentifier("Object"); // Reduce to `any` in a union or intersection } - if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var serializedConstituent = serializeTypeNode(typeNode); @@ -96675,7 +97816,7 @@ var ts; name.original = undefined; ts.setParent(name, ts.getParseTreeNode(currentLexicalScope)); // ensure the parent is set to a parse tree node. return name; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return serializeQualifiedNameAsExpression(node); } } @@ -96730,24 +97871,24 @@ var ts; return node; } switch (node.kind) { - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are elided. They will be emitted as part of `visitClassDeclaration`. return undefined; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructorDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitSetAccessorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return visitGetAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return visitPropertyDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameterDeclaration(node); default: return ts.visitEachChild(node, visitor, context); @@ -97103,7 +98244,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ !ts.hasSyntacticModifier(member, 2 /* ModifierFlags.Ambient */)); var descriptor = languageVersion > 0 /* ScriptTarget.ES3 */ - ? member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + ? ts.isPropertyDeclaration(member) && !ts.hasAccessorModifier(member) // We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it // should not invoke `Object.getOwnPropertyDescriptor`. ? factory.createVoidZero() @@ -97366,34 +98507,37 @@ var ts; return node; } switch (node.kind) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 return undefined; - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitMethodDeclaration, node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionDeclaration, node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionExpression, node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithContext(1 /* ContextFlags.NonTopLevel */, visitArrowFunction, node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 174 /* SyntaxKind.GetAccessor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitGetAccessorDeclaration, node); + case 175 /* SyntaxKind.SetAccessor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitSetAccessorDeclaration, node); + case 173 /* SyntaxKind.Constructor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitConstructorDeclaration, node); + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node); default: return ts.visitEachChild(node, visitor, context); @@ -97402,27 +98546,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatementInAsyncBody(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatementInAsyncBody(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatementInAsyncBody(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatementInAsyncBody(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClauseInAsyncBody(node); - case 235 /* SyntaxKind.Block */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 250 /* SyntaxKind.LabeledStatement */: + case 238 /* SyntaxKind.Block */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -97492,6 +98636,9 @@ var ts; return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression( /*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node); } + function visitConstructorDeclaration(node) { + return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node)); + } /** * Visits a MethodDeclaration node. * @@ -97506,7 +98653,14 @@ var ts; /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* FunctionFlags.Async */ ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : transformMethodBody(node)); + } + function visitGetAccessorDeclaration(node) { + return factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformMethodBody(node)); + } + function visitSetAccessorDeclaration(node) { + return factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node)); } /** * Visits a FunctionDeclaration node. @@ -97620,12 +98774,48 @@ var ts; } return false; } + function transformMethodBody(node) { + ts.Debug.assertIsDefined(node.body); + var savedCapturedSuperProperties = capturedSuperProperties; + var savedHasSuperElementAccess = hasSuperElementAccess; + capturedSuperProperties = new ts.Set(); + hasSuperElementAccess = false; + var updated = ts.visitFunctionBody(node.body, visitor, context); + // Minor optimization, emit `_super` helper to capture `super` access in an arrow. + // This step isn't needed if we eventually transform this to ES5. + var originalMethod = ts.getOriginalNode(node, ts.isFunctionLikeDeclaration); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && + resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) && + (ts.getFunctionFlags(originalMethod) & 3 /* FunctionFlags.AsyncGenerator */) !== 3 /* FunctionFlags.AsyncGenerator */; + if (emitSuperHelpers) { + enableSubstitutionForAsyncMethodsWithSuper(); + if (capturedSuperProperties.size) { + var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties); + substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true; + var statements = updated.statements.slice(); + ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]); + updated = factory.updateBlock(updated, statements); + } + if (hasSuperElementAccess) { + // Emit helpers for super element access expressions (`super[x]`). + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { + ts.addEmitHelper(updated, ts.advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { + ts.addEmitHelper(updated, ts.asyncSuperHelper); + } + } + } + capturedSuperProperties = savedCapturedSuperProperties; + hasSuperElementAccess = savedHasSuperElementAccess; + return updated; + } function transformAsyncFunctionBody(node) { resumeLexicalEnvironment(); var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ScriptTarget.ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 214 /* SyntaxKind.ArrowFunction */; + var isArrowFunction = node.kind === 216 /* SyntaxKind.ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* NodeCheckFlags.CaptureArguments */) !== 0; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current @@ -97652,7 +98842,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); // Minor optimization, emit `_super` helper to capture `super` access in an arrow. // This step isn't needed if we eventually transform this to ES5. - var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */ | 2048 /* NodeCheckFlags.AsyncMethodWithSuper */); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */); if (emitSuperHelpers) { enableSubstitutionForAsyncMethodsWithSuper(); if (capturedSuperProperties.size) { @@ -97665,10 +98855,10 @@ var ts; ts.setTextRange(block, node.body); if (emitSuperHelpers && hasSuperElementAccess) { // Emit helpers for super element access expressions (`super[x]`). - if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); } - else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) { + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { ts.addEmitHelper(block, ts.asyncSuperHelper); } } @@ -97716,17 +98906,17 @@ var ts; enabledSubstitutions |= 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -97740,7 +98930,7 @@ var ts; // If we need to support substitutions for `super` in an async method, // we should track it here. if (enabledSubstitutions & 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) { - var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */); + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */); if (superContainerFlags !== enclosingSuperContainerFlags) { var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; enclosingSuperContainerFlags = superContainerFlags; @@ -97774,11 +98964,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -97810,14 +99000,14 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { - if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createUniqueName("_superIndex", 16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */), /*typeArguments*/ undefined, [argumentExpression]), "value"), location); } @@ -97832,7 +99022,7 @@ var ts; function createSuperAccessVariableStatement(factory, resolver, node, names) { // Create a variable declaration with a getter/setter (if binding) definition for each name: // const _super = Object.create(null, { x: { get: () => super.x, set: (v) => super.x = v }, ... }); - var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) !== 0; + var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) !== 0; var accessors = []; names.forEach(function (_, key) { var name = ts.unescapeLeadingUnderscores(key); @@ -97971,7 +99161,7 @@ var ts; return visitorWorker(node, /*expressionResultIsUnused*/ true); } function visitorNoAsyncModifier(node) { - if (node.kind === 131 /* SyntaxKind.AsyncKeyword */) { + if (node.kind === 132 /* SyntaxKind.AsyncKeyword */) { return undefined; } return node; @@ -97997,70 +99187,70 @@ var ts; return node; } switch (node.kind) { - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: return doWithHierarchyFacts(visitDefault, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return doWithHierarchyFacts(visitForStatement, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return doWithHierarchyFacts(visitConstructorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithHierarchyFacts(visitMethodDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return doWithHierarchyFacts(visitGetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return doWithHierarchyFacts(visitSetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithHierarchyFacts(visitFunctionDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithHierarchyFacts(visitFunctionExpression, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithHierarchyFacts(visitArrowFunction, node, 2 /* HierarchyFacts.ArrowFunctionExcludes */, 0 /* HierarchyFacts.ArrowFunctionIncludes */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithHierarchyFacts(visitDefault, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); default: return ts.visitEachChild(node, visitor, context); @@ -98096,7 +99286,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2 /* FunctionFlags.Async */) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 244 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { + if (statement.kind === 247 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { return visitForOfStatement(statement, node); } return factory.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement, factory.liftToBlock), node); @@ -98108,7 +99298,7 @@ var ts; var objects = []; for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) { var e = elements_5[_i]; - if (e.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (e.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (chunkObject) { objects.push(factory.createObjectLiteralExpression(chunkObject)); chunkObject = undefined; @@ -98117,7 +99307,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 296 /* SyntaxKind.PropertyAssignment */ + chunkObject = ts.append(chunkObject, e.kind === 299 /* SyntaxKind.PropertyAssignment */ ? factory.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -98151,7 +99341,7 @@ var ts; // If we translate the above to `__assign({}, k, l)`, the `l` will evaluate before `k` is spread and we // end up with `{ a: 1, b: 2, c: 3 }` var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { objects.unshift(factory.createObjectLiteralExpression()); } var expression = objects[0]; @@ -98325,11 +99515,22 @@ var ts; } return node; } - function convertForOfStatementHead(node, boundValue) { - var binding = ts.createForOfBindingStatement(factory, node.initializer, boundValue); + function convertForOfStatementHead(node, boundValue, nonUserCode) { + var value = factory.createTempVariable(hoistVariableDeclaration); + var iteratorValueExpression = factory.createAssignment(value, boundValue); + var iteratorValueStatement = factory.createExpressionStatement(iteratorValueExpression); + ts.setSourceMapRange(iteratorValueStatement, node.expression); + var exitNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createFalse()); + var exitNonUserCodeStatement = factory.createExpressionStatement(exitNonUserCodeExpression); + ts.setSourceMapRange(exitNonUserCodeStatement, node.expression); + var enterNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createTrue()); + var enterNonUserCodeStatement = factory.createExpressionStatement(enterNonUserCodeExpression); + ts.setSourceMapRange(exitNonUserCodeStatement, node.expression); + var statements = []; + var binding = ts.createForOfBindingStatement(factory, node.initializer, value); + statements.push(ts.visitNode(binding, visitor, ts.isStatement)); var bodyLocation; var statementsLocation; - var statements = [ts.visitNode(binding, visitor, ts.isStatement)]; var statement = ts.visitIterationBody(node.statement, visitor, context); if (ts.isBlock(statement)) { ts.addRange(statements, statement.statements); @@ -98339,8 +99540,16 @@ var ts; else { statements.push(statement); } - return ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), + var body = ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), /*multiLine*/ true), bodyLocation), 48 /* EmitFlags.NoSourceMap */ | 384 /* EmitFlags.NoTokenSourceMaps */); + return factory.createBlock([ + iteratorValueStatement, + exitNonUserCodeStatement, + factory.createTryStatement(body, + /*catchClause*/ undefined, factory.createBlock([ + enterNonUserCodeStatement + ])) + ]); } function createDownlevelAwait(expression) { return enclosingFunctionFlags & 1 /* FunctionFlags.Generator */ @@ -98351,6 +99560,8 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isExpression); var iterator = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(expression) : factory.createTempVariable(/*recordTempVariable*/ undefined); var result = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(iterator) : factory.createTempVariable(/*recordTempVariable*/ undefined); + var nonUserCode = factory.createTempVariable(/*recordTempVariable*/ undefined); + var done = factory.createTempVariable(hoistVariableDeclaration); var errorRecord = factory.createUniqueName("e"); var catchVariable = factory.getGeneratedNameForNode(errorRecord); var returnMethod = factory.createTempVariable(/*recordTempVariable*/ undefined); @@ -98367,12 +99578,17 @@ var ts; callValues; var forStatement = ts.setEmitFlags(ts.setTextRange(factory.createForStatement( /*initializer*/ ts.setEmitFlags(ts.setTextRange(factory.createVariableDeclarationList([ + factory.createVariableDeclaration(nonUserCode, /*exclamationToken*/ undefined, /*type*/ undefined, factory.createTrue()), ts.setTextRange(factory.createVariableDeclaration(iterator, /*exclamationToken*/ undefined, /*type*/ undefined, initializer), node.expression), factory.createVariableDeclaration(result) ]), node.expression), 2097152 /* EmitFlags.NoHoisting */), - /*condition*/ factory.createComma(factory.createAssignment(result, createDownlevelAwait(callNext)), factory.createLogicalNot(getDone)), + /*condition*/ factory.inlineExpressions([ + factory.createAssignment(result, createDownlevelAwait(callNext)), + factory.createAssignment(done, getDone), + factory.createLogicalNot(done) + ]), /*incrementor*/ undefined, - /*statement*/ convertForOfStatementHead(node, getValue)), + /*statement*/ convertForOfStatementHead(node, getValue, nonUserCode)), /*location*/ node), 256 /* EmitFlags.NoTokenTrailingSourceMaps */); ts.setOriginalNode(forStatement, node); return factory.createTryStatement(factory.createBlock([ @@ -98384,7 +99600,7 @@ var ts; ]), 1 /* EmitFlags.SingleLine */)), factory.createBlock([ factory.createTryStatement( /*tryBlock*/ factory.createBlock([ - ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(result, factory.createLogicalNot(getDone)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), 1 /* EmitFlags.SingleLine */) + ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(factory.createLogicalNot(nonUserCode), factory.createLogicalNot(done)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), 1 /* EmitFlags.SingleLine */) ]), /*catchClause*/ undefined, /*finallyBlock*/ ts.setEmitFlags(factory.createBlock([ @@ -98540,7 +99756,7 @@ var ts; /*type*/ undefined, factory.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !!(hierarchyFacts & 1 /* HierarchyFacts.HasLexicalThis */))); // Minor optimization, emit `_super` helper to capture `super` access in an arrow. // This step isn't needed if we eventually transform this to ES5. - var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */ | 2048 /* NodeCheckFlags.AsyncMethodWithSuper */); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */); if (emitSuperHelpers) { enableSubstitutionForAsyncMethodsWithSuper(); var variableStatement = ts.createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties); @@ -98551,10 +99767,10 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var block = factory.updateBlock(node.body, statements); if (emitSuperHelpers && hasSuperElementAccess) { - if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); } - else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) { + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { ts.addEmitHelper(block, ts.asyncSuperHelper); } } @@ -98659,17 +99875,17 @@ var ts; enabledSubstitutions |= 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -98683,7 +99899,7 @@ var ts; // If we need to support substitutions for `super` in an async method, // we should track it here. if (enabledSubstitutions & 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) { - var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */); + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */); if (superContainerFlags !== enclosingSuperContainerFlags) { var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; enclosingSuperContainerFlags = superContainerFlags; @@ -98717,11 +99933,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -98753,14 +99969,14 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { - if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createIdentifier("_superIndex"), /*typeArguments*/ undefined, [argumentExpression]), "value"), location); } @@ -98789,7 +100005,7 @@ var ts; return node; } switch (node.kind) { - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -98821,25 +100037,25 @@ var ts; return node; } switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { var updated = visitNonOptionalCallExpression(node, /*captureThisArg*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (ts.isOptionalChain(node)) { var updated = visitOptionalExpression(node, /*captureThisArg*/ false, /*isDelete*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } return ts.visitEachChild(node, visitor, context); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) { return transformNullishCoalescingExpression(node); } return ts.visitEachChild(node, visitor, context); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return visitDeleteExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -98881,7 +100097,7 @@ var ts; thisArg = expression; } } - expression = node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + expression = node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.updatePropertyAccessExpression(node, expression, ts.visitNode(node.name, visitor, ts.isIdentifier)) : factory.updateElementAccessExpression(node, expression, ts.visitNode(node.argumentExpression, visitor, ts.isExpression)); return thisArg ? factory.createSyntheticReferenceExpression(expression, thisArg) : expression; @@ -98904,10 +100120,10 @@ var ts; } function visitNonOptionalExpression(node, captureThisArg, isDelete) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); - case 208 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); + case 210 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); default: return ts.visitNode(node, visitor, ts.isExpression); } } @@ -98926,8 +100142,8 @@ var ts; for (var i = 0; i < chain.length; i++) { var segment = chain[i]; switch (segment.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (i === chain.length - 1 && captureThisArg) { if (!ts.isSimpleCopiableExpression(rightExpression)) { thisArg = factory.createTempVariable(hoistVariableDeclaration); @@ -98937,11 +100153,11 @@ var ts; thisArg = rightExpression; } } - rightExpression = segment.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + rightExpression = segment.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.createPropertyAccessExpression(rightExpression, ts.visitNode(segment.name, visitor, ts.isIdentifier)) : factory.createElementAccessExpression(rightExpression, ts.visitNode(segment.argumentExpression, visitor, ts.isExpression)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (i === 0 && leftThisArg) { if (!ts.isGeneratedIdentifier(leftThisArg)) { leftThisArg = factory.cloneNode(leftThisArg); @@ -99002,7 +100218,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryExpression = node; if (ts.isLogicalOrCoalescingAssignmentExpression(binaryExpression)) { return transformLogicalAssignment(binaryExpression); @@ -99171,13 +100387,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ false); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99187,13 +100403,13 @@ var ts; switch (node.kind) { case 11 /* SyntaxKind.JsxText */: return visitJsxText(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ true); default: return ts.Debug.failBadSyntaxKind(node); @@ -99374,7 +100590,7 @@ var ts; var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote); return ts.setTextRange(literal, node); } - if (node.kind === 288 /* SyntaxKind.JsxExpression */) { + if (node.kind === 291 /* SyntaxKind.JsxExpression */) { if (node.expression === undefined) { return factory.createTrue(); } @@ -99475,7 +100691,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 278 /* SyntaxKind.JsxElement */) { + if (node.kind === 281 /* SyntaxKind.JsxElement */) { return getTagName(node.openingElement); } else { @@ -99782,7 +100998,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -100007,7 +101223,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return (hierarchyFacts & 8192 /* HierarchyFacts.ConstructorWithCapturedSuper */) !== 0 - && node.kind === 247 /* SyntaxKind.ReturnStatement */ + && node.kind === 250 /* SyntaxKind.ReturnStatement */ && !node.expression; } function isOrMayContainReturnCompletion(node) { @@ -100061,65 +101277,65 @@ var ts; switch (node.kind) { case 124 /* SyntaxKind.StaticKeyword */: return undefined; // elide static keyword - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return visitArrowFunction(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); case 79 /* SyntaxKind.Identifier */: return visitIdentifier(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return visitVariableDeclarationList(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node, /*isFunctionBody*/ false); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitBreakOrContinueStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*outermostLabeledStatement*/ undefined); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return visitComputedPropertyName(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: @@ -100130,30 +101346,30 @@ var ts; return visitStringLiteral(node); case 8 /* SyntaxKind.NumericLiteral */: return visitNumericLiteral(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return visitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return visitSpreadElement(node); case 106 /* SyntaxKind.SuperKeyword */: return visitSuperKeyword(/*isExpressionOfCall*/ false); case 108 /* SyntaxKind.ThisKeyword */: return visitThisKeyword(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return visitMetaProperty(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -100229,11 +101445,13 @@ var ts; return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context); } function visitIdentifier(node) { - if (!convertedLoopState) { - return node; + if (convertedLoopState) { + if (resolver.isArgumentsLocalBinding(node)) { + return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments")); + } } - if (resolver.isArgumentsLocalBinding(node)) { - return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments")); + if (node.hasExtendedUnicodeEscape) { + return ts.setOriginalNode(ts.setTextRange(factory.createIdentifier(ts.unescapeLeadingUnderscores(node.escapedText)), node), node); } return node; } @@ -100243,14 +101461,14 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 246 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; + var jump = node.kind === 249 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; var label = node.label; if (!label) { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Jump.Break */; labelMarker = "break"; } @@ -100261,7 +101479,7 @@ var ts; } } else { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { labelMarker = "break-".concat(label.escapedText); setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(label), labelMarker); } @@ -100317,7 +101535,7 @@ var ts; statements.push(statement); // Add an `export default` statement for default exports (for `--target es5 --module es6`) if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - var exportStatement = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) + var exportStatement = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? factory.createExportDefault(factory.getLocalName(node)) : factory.createExternalModuleExport(factory.getLocalName(node)); ts.setOriginalNode(exportStatement, statement); @@ -100686,11 +101904,11 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (statement.kind === 250 /* SyntaxKind.ReturnStatement */) { return true; } // An if-statement with two covered branches is covered. - else if (statement.kind === 239 /* SyntaxKind.IfStatement */) { + else if (statement.kind === 242 /* SyntaxKind.IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && @@ -100698,7 +101916,7 @@ var ts; } } // A block is covered if it has a last statement which is covered. - else if (statement.kind === 235 /* SyntaxKind.Block */) { + else if (statement.kind === 238 /* SyntaxKind.Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -100898,7 +102116,7 @@ var ts; * @param node A node. */ function insertCaptureThisForNodeIfNeeded(statements, node) { - if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 216 /* SyntaxKind.ArrowFunction */) { insertCaptureThisForNode(statements, node, factory.createThis()); return true; } @@ -100932,22 +102150,22 @@ var ts; if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */) { var newTarget = void 0; switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return statements; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Methods and accessors cannot be constructors, so 'new.target' will // always return 'undefined'. newTarget = factory.createVoidZero(); break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Class constructors can only be called with `new`, so `this.constructor` // should be relatively safe to use. newTarget = factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), "constructor"); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: // Functions can be called or constructed, and may have a `this` due to // being a member or when calling an imported function via `other_1.f()`. newTarget = factory.createConditionalExpression(factory.createLogicalAnd(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), factory.createBinaryExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), 102 /* SyntaxKind.InstanceOfKeyword */, factory.getLocalName(node))), @@ -100982,21 +102200,21 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Constructors are handled in visitClassExpression/visitClassDeclaration break; default: @@ -101195,7 +102413,7 @@ var ts; : enterSubtree(32670 /* HierarchyFacts.FunctionExcludes */, 65 /* HierarchyFacts.FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) { + if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) { name = factory.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 98304 /* HierarchyFacts.FunctionSubtreeExcludes */, 0 /* HierarchyFacts.None */); @@ -101241,7 +102459,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 214 /* SyntaxKind.ArrowFunction */); + ts.Debug.assert(node.kind === 216 /* SyntaxKind.ArrowFunction */); // To align with the old emitter, we use a synthetic end position on the location // for the statement list we synthesize when we down-level an arrow function with // an expression function body. This prevents both comments and source maps from @@ -101548,14 +102766,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -101741,7 +102959,7 @@ var ts; var property = properties[i]; if ((property.transformFlags & 1048576 /* TransformFlags.ContainsYield */ && hierarchyFacts & 4 /* HierarchyFacts.AsyncFunctionBody */) - || (hasComputed = ts.Debug.checkDefined(property.name).kind === 162 /* SyntaxKind.ComputedPropertyName */)) { + || (hasComputed = ts.Debug.checkDefined(property.name).kind === 164 /* SyntaxKind.ComputedPropertyName */)) { numInitialProperties = i; break; } @@ -101857,11 +103075,11 @@ var ts; } function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); - case 243 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); - case 244 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); - case 240 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); - case 241 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); + case 245 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); + case 246 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); + case 247 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); + case 243 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); + case 244 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected"); } } @@ -101886,11 +103104,11 @@ var ts; function createConvertedLoopState(node) { var loopInitializer; switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer && initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -102306,20 +103524,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine)); } break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -102426,7 +103644,7 @@ var ts; var updated; var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { updated = factory.updateGetAccessorDeclaration(node, node.modifiers, node.name, parameters, node.type, body); } else { @@ -102886,13 +104104,13 @@ var ts; if ((enabledSubstitutions & 1 /* ES2015SubstitutionFlags.CapturedThis */) === 0) { enabledSubstitutions |= 1 /* ES2015SubstitutionFlags.CapturedThis */; context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(214 /* SyntaxKind.ArrowFunction */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(216 /* SyntaxKind.ArrowFunction */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); } } /** @@ -102933,10 +104151,10 @@ var ts; */ function isNameOfDeclarationWithCollidingName(node) { switch (node.parent.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return node.parent.name === node && resolver.isDeclarationWithCollidingName(node.parent); } @@ -103018,11 +104236,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 238 /* SyntaxKind.ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 241 /* SyntaxKind.ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -103030,7 +104248,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 227 /* SyntaxKind.SpreadElement */) { return false; } var expression = callArgument.expression; @@ -103056,15 +104274,15 @@ var ts; if (compilerOptions.jsx === 1 /* JsxEmit.Preserve */ || compilerOptions.jsx === 3 /* JsxEmit.ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(280 /* SyntaxKind.JsxOpeningElement */); - context.enableEmitNotification(281 /* SyntaxKind.JsxClosingElement */); - context.enableEmitNotification(279 /* SyntaxKind.JsxSelfClosingElement */); + context.enableEmitNotification(283 /* SyntaxKind.JsxOpeningElement */); + context.enableEmitNotification(284 /* SyntaxKind.JsxClosingElement */); + context.enableEmitNotification(282 /* SyntaxKind.JsxSelfClosingElement */); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(296 /* SyntaxKind.PropertyAssignment */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(299 /* SyntaxKind.PropertyAssignment */); return ts.chainBundle(context, transformSourceFile); /** * Transforms an ES5 source file to ES3. @@ -103083,9 +104301,9 @@ var ts; */ function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -103420,13 +104638,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -103439,24 +104657,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return visitBreakStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 1048576 /* TransformFlags.ContainsYield */) { @@ -103477,23 +104695,23 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return visitConditionalExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -103506,9 +104724,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -103715,7 +104933,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // [source] // a.b = yield; // @@ -103727,7 +104945,7 @@ var ts; // _a.b = %sent%; target = factory.updatePropertyAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // [source] // a[b] = yield; // @@ -104121,35 +105339,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return transformAndEmitBlock(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return transformAndEmitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return transformAndEmitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return transformAndEmitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return transformAndEmitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return transformAndEmitForInStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return transformAndEmitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return transformAndEmitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return transformAndEmitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return transformAndEmitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return transformAndEmitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -104380,7 +105598,6 @@ var ts; return node; } function transformAndEmitForInStatement(node) { - // TODO(rbuckton): Source map locations if (containsYield(node)) { // [source] // for (var p in o) { @@ -104388,34 +105605,41 @@ var ts; // } // // [intermediate] - // .local _a, _b, _i - // _a = []; - // for (_b in o) _a.push(_b); + // .local _b, _a, _c, _i + // _b = []; + // _a = o; + // for (_c in _a) _b.push(_c); // _i = 0; // .loop incrementLabel, endLoopLabel // .mark conditionLabel - // .brfalse endLoopLabel, (_i < _a.length) - // p = _a[_i]; + // .brfalse endLoopLabel, (_i < _b.length) + // _c = _b[_i]; + // .brfalse incrementLabel, (_c in _a) + // p = _c; // /*body*/ // .mark incrementLabel - // _b++; + // _c++; // .br conditionLabel // .endloop // .mark endLoopLabel - var keysArray = declareLocal(); // _a - var key = declareLocal(); // _b + var obj = declareLocal(); // _a + var keysArray = declareLocal(); // _b + var key = declareLocal(); // _c var keysIndex = factory.createLoopVariable(); // _i var initializer = node.initializer; hoistVariableDeclaration(keysIndex); + emitAssignment(obj, ts.visitNode(node.expression, visitor, ts.isExpression)); emitAssignment(keysArray, factory.createArrayLiteralExpression()); - emitStatement(factory.createForInStatement(key, ts.visitNode(node.expression, visitor, ts.isExpression), factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"), + emitStatement(factory.createForInStatement(key, obj, factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"), /*typeArguments*/ undefined, [key])))); emitAssignment(keysIndex, factory.createNumericLiteral(0)); var conditionLabel = defineLabel(); var incrementLabel = defineLabel(); - var endLabel = beginLoopBlock(incrementLabel); + var endLoopLabel = beginLoopBlock(incrementLabel); markLabel(conditionLabel); - emitBreakWhenFalse(endLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length"))); + emitBreakWhenFalse(endLoopLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length"))); + emitAssignment(key, factory.createElementAccessExpression(keysArray, keysIndex)); + emitBreakWhenFalse(incrementLabel, factory.createBinaryExpression(key, 101 /* SyntaxKind.InKeyword */, obj)); var variable = void 0; if (ts.isVariableDeclarationList(initializer)) { for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { @@ -104428,7 +105652,7 @@ var ts; variable = ts.visitNode(initializer, visitor, ts.isExpression); ts.Debug.assert(ts.isLeftHandSideExpression(variable)); } - emitAssignment(variable, factory.createElementAccessExpression(keysArray, keysIndex)); + emitAssignment(variable, key); transformAndEmitEmbeddedStatement(node.statement); markLabel(incrementLabel); emitStatement(factory.createExpressionStatement(factory.createPostfixIncrement(keysIndex))); @@ -104579,7 +105803,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -104592,7 +105816,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -105752,12 +106976,12 @@ var ts; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. - context.enableSubstitution(210 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(212 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. @@ -106085,23 +107309,23 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -106114,26 +107338,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node) && currentSourceFile.impliedNodeFormat === undefined) { return visitImportCallExpression(node); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -106149,24 +107373,24 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var elem = _a[_i]; switch (elem.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (destructuringNeedsFlattening(elem.initializer)) { return true; } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (destructuringNeedsFlattening(elem.name)) { return true; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: if (destructuringNeedsFlattening(elem.expression)) { return true; } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return false; default: ts.Debug.assertNever(elem, "Unhandled object member kind"); } @@ -106269,7 +107493,7 @@ var ts; return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis); case ts.ModuleKind.CommonJS: default: - return createImportCallExpressionCommonJS(argument, containsLexicalThis); + return createImportCallExpressionCommonJS(argument); } } function createImportCallExpressionUMD(arg, containsLexicalThis) { @@ -106292,7 +107516,7 @@ var ts; return factory.createConditionalExpression( /*condition*/ factory.createIdentifier("__syncRequire"), /*questionToken*/ undefined, - /*whenTrue*/ createImportCallExpressionCommonJS(arg, containsLexicalThis), + /*whenTrue*/ createImportCallExpressionCommonJS(arg), /*colonToken*/ undefined, /*whenFalse*/ createImportCallExpressionAMD(argClone, containsLexicalThis)); } @@ -106301,7 +107525,7 @@ var ts; return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression( /*condition*/ factory.createIdentifier("__syncRequire"), /*questionToken*/ undefined, - /*whenTrue*/ createImportCallExpressionCommonJS(temp, containsLexicalThis), + /*whenTrue*/ createImportCallExpressionCommonJS(temp, /* isInlineable */ true), /*colonToken*/ undefined, /*whenFalse*/ createImportCallExpressionAMD(temp, containsLexicalThis))); } @@ -106351,14 +107575,20 @@ var ts; } return promise; } - function createImportCallExpressionCommonJS(arg, containsLexicalThis) { - // import("./blah") + function createImportCallExpressionCommonJS(arg, isInlineable) { + // import(x) // emit as - // Promise.resolve().then(function () { return require(x); }) /*CommonJs Require*/ + // var _a; + // (_a = x, Promise.resolve().then(() => require(_a)) /*CommonJs Require*/ // We have to wrap require in then callback so that require is done in asynchronously // if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately - var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []); - var requireCall = factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []); + // If the arg is not inlineable, we have to evaluate it in the current scope with a temp var + var temp = arg && !ts.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined; + var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), + /*typeArguments*/ undefined, + /*argumentsArray*/ []); + var requireCall = factory.createCallExpression(factory.createIdentifier("require"), + /*typeArguments*/ undefined, temp ? [temp] : arg ? [arg] : []); if (ts.getESModuleInterop(compilerOptions)) { requireCall = emitHelpers().createImportStarHelper(requireCall); } @@ -106379,14 +107609,9 @@ var ts; /*typeParameters*/ undefined, /*parameters*/ [], /*type*/ undefined, factory.createBlock([factory.createReturnStatement(requireCall)])); - // if there is a lexical 'this' in the import call arguments, ensure we indicate - // that this new function expression indicates it captures 'this' so that the - // es2015 transformer will properly substitute 'this' with '_this'. - if (containsLexicalThis) { - ts.setEmitFlags(func, 8 /* EmitFlags.CapturesThis */); - } } - return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]); + var downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]); + return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]); } function getHelperExpressionForExport(node, innerExpr) { if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864 /* EmitFlags.NeverApplyImportHelper */) { @@ -106752,7 +107977,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -106807,10 +108032,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding, /* liveBinding */ true); @@ -106894,7 +108119,7 @@ var ts; return statements; } if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); statements = appendExportStatement(statements, exportName, factory.getLocalName(decl), /*location*/ decl); } if (decl.name) { @@ -107023,7 +108248,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; previousOnEmitNode(hint, node, emitCallback); @@ -107085,11 +108310,11 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return substituteTaggedTemplateExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); } return node; @@ -107133,7 +108358,7 @@ var ts; } else if (!(ts.isGeneratedIdentifier(node) && !(node.autoGenerateFlags & 64 /* GeneratedIdentifierFlags.AllowNameSubstitution */)) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(node)), /*location*/ node); } @@ -107223,10 +108448,10 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(231 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(233 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var exportFunctionsMap = []; // The export function associated with a source file. @@ -107416,7 +108641,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var exportStarFunction = addExportStarIfNeeded(statements); // TODO: GH#18217 var modifiers = node.transformFlags & 2097152 /* TransformFlags.ContainsAwait */ ? - factory.createModifiersFromModifierFlags(256 /* ModifierFlags.Async */) : + factory.createModifiersFromModifierFlags(512 /* ModifierFlags.Async */) : undefined; var moduleObject = factory.createObjectLiteralExpression([ factory.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), @@ -107450,7 +108675,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 272 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 275 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -107539,19 +108764,26 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(factory, entry, currentSourceFile); // TODO: GH#18217 switch (entry.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName))); + if (ts.hasSyntacticModifier(entry, 1 /* ModifierFlags.Export */)) { + statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction, + /*typeArguments*/ undefined, [ + factory.createStringLiteral(ts.idText(importVariableName)), + parameterName, + ]))); + } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { if (ts.isNamedExports(entry.exportClause)) { @@ -107610,13 +108842,13 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); default: return topLevelNestedVisitor(node); @@ -107795,7 +109027,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 2097152 /* EmitFlags.NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 305 /* SyntaxKind.SourceFile */ + && (enclosingBlockScopedContainer.kind === 308 /* SyntaxKind.SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* NodeFlags.BlockScoped */) === 0); } /** @@ -107859,7 +109091,7 @@ var ts; // // To balance the declaration, we defer the exports of the elided variable // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasSyntacticModifier(node.original, 1 /* ModifierFlags.Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -107921,10 +109153,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -108019,7 +109251,7 @@ var ts; } var excludeName; if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; statements = appendExportStatement(statements, exportName, factory.getLocalName(decl)); excludeName = ts.getTextOfIdentifierOrLiteral(exportName); } @@ -108104,43 +109336,43 @@ var ts; */ function topLevelNestedVisitor(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ true); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return visitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return visitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return visitDefaultClause(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return visitTryStatement(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -108326,26 +109558,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node)) { return visitImportCallExpression(node); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -108425,7 +109657,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 305 /* SyntaxKind.SourceFile */; + return container !== undefined && container.kind === 308 /* SyntaxKind.SourceFile */; } else { return false; @@ -108503,7 +109735,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -108553,7 +109785,7 @@ var ts; */ function substituteUnspecified(node) { switch (node.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return substituteShorthandPropertyAssignment(node); } return node; @@ -108590,9 +109822,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return substituteMetaProperty(node); } return node; @@ -108682,7 +109914,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { exportedNames = ts.append(exportedNames, factory.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -108725,7 +109957,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); context.enableSubstitution(79 /* SyntaxKind.Identifier */); var helperNameSubstitutions; var currentSourceFile; @@ -108765,14 +109997,14 @@ var ts; } function visitor(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // Though an error in es2020 modules, in node-flavor es2020 modules, we can helpfully transform this to a synthetic `require` call // To give easy access to a synchronous `require` in node-flavor esm. We do the transform even in scenarios where we error, but `import.meta.url` // is available, just because the output is reasonable for a node-like runtime. return ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.Node16 ? visitImportEqualsDeclaration(node) : undefined; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDecl = node; return visitExportDeclaration(exportDecl); } @@ -108929,8 +110161,8 @@ var ts; var cjsOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(305 /* SyntaxKind.SourceFile */); - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableSubstitution(308 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); var currentSourceFile; return transformSourceFileOrBundle; function onSubstituteNode(hint, node) { @@ -108977,7 +110209,7 @@ var ts; return result; } function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -109037,7 +110269,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109066,7 +110298,7 @@ var ts; ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109113,7 +110345,7 @@ var ts; return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: ".concat(ts.Debug.formatSyntaxKind(node.kind))); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109122,8 +110354,8 @@ var ts; } // This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit // The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all. - else if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 166 /* SyntaxKind.PropertySignature */ || - (node.kind === 164 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { + else if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 168 /* SyntaxKind.PropertySignature */ || + (node.kind === 166 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { // TODO(jfreeman): Deal with computed properties in error reporting. if (ts.isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? @@ -109132,7 +110364,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 166 /* SyntaxKind.Parameter */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109157,7 +110389,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Getters can infer the return type from the returned expression, but setters cannot, so the // "_from_external_module_1_but_cannot_be_named" case cannot occur. if (ts.isStatic(node)) { @@ -109196,26 +110428,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109223,7 +110455,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109237,7 +110469,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109262,30 +110494,30 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109293,7 +110525,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109306,15 +110538,15 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 256 /* SyntaxKind.FunctionDeclaration */: - case 179 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109328,39 +110560,39 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1; break; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 179 /* SyntaxKind.FunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -109426,7 +110658,7 @@ var ts; } function isInternalDeclaration(node, currentSourceFile) { var parseTreeNode = ts.getParseTreeNode(node); - if (parseTreeNode && parseTreeNode.kind === 164 /* SyntaxKind.Parameter */) { + if (parseTreeNode && parseTreeNode.kind === 166 /* SyntaxKind.Parameter */) { var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode); var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined; var text = currentSourceFile.text; @@ -109602,7 +110834,7 @@ var ts; var _a; var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; }); var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; }); - if (augmentingDeclarations) { + if (primaryDeclaration && augmentingDeclarations) { for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) { var augmentations = augmentingDeclarations_1[_i]; context.addDiagnostic(ts.addRelatedInfo(ts.createDiagnosticForNode(augmentations, ts.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts.createDiagnosticForNode(primaryDeclaration, ts.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file))); @@ -109632,10 +110864,10 @@ var ts; return result; } function transformRoot(node) { - if (node.kind === 305 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { + if (node.kind === 308 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { return node; } - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { isBundledEmit = true; refs = new ts.Map(); libs = new ts.Map(); @@ -109658,14 +110890,14 @@ var ts; resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) needsDeclare = false; var statements = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile, /*bundled*/ true)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); + var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); return newFile; } needsDeclare = true; var updated = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); return factory.updateSourceFile(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); }), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal); hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib; collectReferences(sourceFile, refs); @@ -109806,7 +111038,7 @@ var ts; return name; } else { - if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { return factory.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -109814,7 +111046,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (elem.kind === 229 /* SyntaxKind.OmittedExpression */) { return elem; } if (elem.propertyName && ts.isIdentifier(elem.propertyName) && ts.isIdentifier(elem.name) && !elem.symbol.isReferenced) { @@ -109856,19 +111088,19 @@ var ts; // Literal const declarations will have an initializer ensured rather than a type return; } - var shouldUseResolverType = node.kind === 164 /* SyntaxKind.Parameter */ && + var shouldUseResolverType = node.kind === 166 /* SyntaxKind.Parameter */ && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); if (type && !shouldUseResolverType) { return ts.visitNode(type, visitDeclarationSubtree); } if (!ts.getParseTreeNode(node)) { - return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now // (The inferred type here will be void, but the old declaration emitter printed `any`, so this replicates that) - return factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } errorNameNode = node.name; var oldDiag; @@ -109876,12 +111108,12 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } - if (node.kind === 164 /* SyntaxKind.Parameter */ - || node.kind === 167 /* SyntaxKind.PropertyDeclaration */ - || node.kind === 166 /* SyntaxKind.PropertySignature */) { + if (node.kind === 166 /* SyntaxKind.Parameter */ + || node.kind === 169 /* SyntaxKind.PropertyDeclaration */ + || node.kind === 168 /* SyntaxKind.PropertySignature */) { if (ts.isPropertySignature(node) || !node.initializer) return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType)); return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); @@ -109892,28 +111124,28 @@ var ts; if (!suppressNewDiagnosticContexts) { getSymbolAccessibilityDiagnostic = oldDiag; } - return returnValue || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return returnValue || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return !resolver.isDeclarationVisible(node); // The following should be doing their own visibility checks based on filtering their members - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !getBindingNameVisible(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; } return false; @@ -110002,7 +111234,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return undefined; // TODO: GH#18217 - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 200 /* SyntaxKind.ImportType */); + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 202 /* SyntaxKind.ImportType */); if (ts.isStringLiteralLike(input)) { if (isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); @@ -110022,7 +111254,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (decl.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // Rewrite external module names if necessary var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return factory.updateImportEqualsDeclaration(decl, decl.modifiers, decl.isTypeOnly, decl.name, factory.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))); @@ -110047,7 +111279,7 @@ var ts; return visibleDefaultBinding && factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); } - if (decl.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (decl.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // Namespace import (optionally with visible default) var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined; return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined; @@ -110150,7 +111382,7 @@ var ts; // We'd see a TDZ violation at runtime var canProduceDiagnostic = ts.canProduceDiagnostics(input); var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 182 /* SyntaxKind.TypeLiteral */ || input.kind === 195 /* SyntaxKind.MappedType */) && input.parent.kind !== 259 /* SyntaxKind.TypeAliasDeclaration */); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 184 /* SyntaxKind.TypeLiteral */ || input.kind === 197 /* SyntaxKind.MappedType */) && input.parent.kind !== 262 /* SyntaxKind.TypeAliasDeclaration */); // Emit methods which are private as properties with no type information if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) { if (ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)) { @@ -110171,28 +111403,28 @@ var ts; } if (isProcessedComponent(input)) { switch (input.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments)); } - case 178 /* SyntaxKind.TypeReference */: { + case 180 /* SyntaxKind.TypeReference */: { checkEntityNameVisibility(input.typeName, enclosingDeclaration); var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); } - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return cleanup(factory.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { // A constructor declaration may not have a type annotation var ctor = factory.createConstructorDeclaration( /*modifiers*/ ensureModifiers(input), updateParamsList(input, input.parameters, 0 /* ModifierFlags.None */), /*body*/ undefined); return cleanup(ctor); } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110201,7 +111433,7 @@ var ts; /*body*/ undefined); return cleanup(sig); } - case 172 /* SyntaxKind.GetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110209,36 +111441,36 @@ var ts; return cleanup(factory.updateGetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), ensureType(input, accessorType), /*body*/ undefined)); } - case 173 /* SyntaxKind.SetAccessor */: { + case 175 /* SyntaxKind.SetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateSetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), /*body*/ undefined)); } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertyDeclaration(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type), ensureNoInitializer(input))); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type))); - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateMethodSignature(input, ensureModifiers(input), input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { return cleanup(factory.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 176 /* SyntaxKind.IndexSignature */: { - return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */))); + case 178 /* SyntaxKind.IndexSignature */: { + return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */))); } - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -110246,13 +111478,13 @@ var ts; suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types return cleanup(factory.updateVariableDeclaration(input, input.name, /*exclamationToken*/ undefined, ensureType(input, input.type), ensureNoInitializer(input))); } - case 163 /* SyntaxKind.TypeParameter */: { + case 165 /* SyntaxKind.TypeParameter */: { if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) { return cleanup(factory.updateTypeParameterDeclaration(input, input.modifiers, input.name, /*constraint*/ undefined, /*defaultType*/ undefined)); } return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context)); } - case 189 /* SyntaxKind.ConditionalType */: { + case 191 /* SyntaxKind.ConditionalType */: { // We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration // just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type. var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree); @@ -110264,13 +111496,13 @@ var ts; var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree); return cleanup(factory.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); } - case 179 /* SyntaxKind.FunctionType */: { + case 181 /* SyntaxKind.FunctionType */: { return cleanup(factory.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 180 /* SyntaxKind.ConstructorType */: { + case 182 /* SyntaxKind.ConstructorType */: { return cleanup(factory.updateConstructorTypeNode(input, ensureModifiers(input), ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 200 /* SyntaxKind.ImportType */: { + case 202 /* SyntaxKind.ImportType */: { if (!ts.isLiteralImportTypeNode(input)) return cleanup(input); return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); @@ -110302,7 +111534,7 @@ var ts; } } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); + return node.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); } function visitDeclarationStatements(input) { if (!isPreservedDeclarationStatement(input)) { @@ -110312,7 +111544,7 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -110321,7 +111553,7 @@ var ts; // Rewrite external module names if necessary return factory.updateExportDeclaration(input, input.modifiers, input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), ts.getResolutionModeOverrideForClause(input.assertClause) ? input.assertClause : undefined); } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { // Always visible if the parent node isn't dropped for being not visible if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; @@ -110339,7 +111571,7 @@ var ts; errorFallbackNode = input; var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); errorFallbackNode = undefined; - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); preserveJsDoc(statement, input); ts.removeAllComments(input); return [statement, factory.updateExportAssignment(input, input.modifiers, newId)]; @@ -110352,12 +111584,12 @@ var ts; return input; } function stripExportModifiers(statement) { - if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 512 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { + if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 1024 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { // `export import` statements should remain as-is, as imports are _not_ implicitly exported in an ambient namespace // Likewise, `export default` classes and the like and just be `default`, so we preserve their `export` modifiers, too return statement; } - var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (257023 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); + var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (258047 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); return factory.updateModifiers(statement, modifiers); } function transformTopLevelDeclaration(input) { @@ -110368,10 +111600,10 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { return transformImportEqualsDeclaration(input); } - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { return transformImportDeclaration(input); } } @@ -110392,12 +111624,16 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 259 /* SyntaxKind.TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all - return cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 258 /* SyntaxKind.InterfaceDeclaration */: { + case 262 /* SyntaxKind.TypeAliasDeclaration */: { + needsDeclare = false; + var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); + needsDeclare = previousNeedsDeclare; + return clean; + } + case 261 /* SyntaxKind.InterfaceDeclaration */: { return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { // Generators lose their generator-ness, excepting their return type var clean = cleanup(factory.updateFunctionDeclaration(input, ensureModifiers(input), /*asteriskToken*/ undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), @@ -110438,10 +111674,10 @@ var ts; })))); } var namespaceDecl = factory.createModuleDeclaration(ensureModifiers(input), input.name, factory.createModuleBlock(declarations), 16 /* NodeFlags.Namespace */); - if (!ts.hasEffectiveModifier(clean, 512 /* ModifierFlags.Default */)) { + if (!ts.hasEffectiveModifier(clean, 1024 /* ModifierFlags.Default */)) { return [clean, namespaceDecl]; } - var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~513 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); + var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~1025 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); var cleanDeclaration = factory.updateFunctionDeclaration(clean, modifiers, /*asteriskToken*/ undefined, clean.name, clean.typeParameters, clean.parameters, clean.type, /*body*/ undefined); @@ -110459,10 +111695,10 @@ var ts; return clean; } } - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 264 /* SyntaxKind.ModuleDeclaration */: { needsDeclare = false; var inner = input.body; - if (inner && inner.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (inner && inner.kind === 265 /* SyntaxKind.ModuleBlock */) { var oldNeedsScopeFix = needsScopeFixMarker; var oldHasScopeFix = resultHasScopeMarker; resultHasScopeMarker = false; @@ -110503,7 +111739,7 @@ var ts; return cleanup(factory.updateModuleDeclaration(input, mods, input.name, body)); } } - case 257 /* SyntaxKind.ClassDeclaration */: { + case 260 /* SyntaxKind.ClassDeclaration */: { errorNameNode = input.name; errorFallbackNode = input; var modifiers = factory.createNodeArray(ensureModifiers(input)); @@ -110565,7 +111801,7 @@ var ts; typeName: input.name }); }; var varDecl = factory.createVariableDeclaration(newId_1, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); var heritageClauses = factory.createNodeArray(ts.map(input.heritageClauses, function (clause) { if (clause.token === 94 /* SyntaxKind.ExtendsKeyword */) { var oldDiag_2 = getSymbolAccessibilityDiagnostic; @@ -110583,10 +111819,10 @@ var ts; return cleanup(factory.updateClassDeclaration(input, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { return cleanup(transformVariableStatement(input)); } - case 260 /* SyntaxKind.EnumDeclaration */: { + case 263 /* SyntaxKind.EnumDeclaration */: { return cleanup(factory.updateEnumDeclaration(input, factory.createNodeArray(ensureModifiers(input)), input.name, factory.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -110605,7 +111841,7 @@ var ts; if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - if (input.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (input.kind === 264 /* SyntaxKind.ModuleDeclaration */) { needsDeclare = previousNeedsDeclare; } if (node === input) { @@ -110628,7 +111864,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (e.kind === 229 /* SyntaxKind.OmittedExpression */) { return; } if (e.name) { @@ -110676,9 +111912,9 @@ var ts; return factory.createModifiersFromModifierFlags(newFlags); } function ensureModifierFlags(node) { - var mask = 257023 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 256 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files + var mask = 258047 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 512 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* ModifierFlags.Ambient */ : 0 /* ModifierFlags.None */; - var parentIsFile = node.parent.kind === 305 /* SyntaxKind.SourceFile */; + var parentIsFile = node.parent.kind === 308 /* SyntaxKind.SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= 2 /* ModifierFlags.Ambient */; additions = 0 /* ModifierFlags.None */; @@ -110707,7 +111943,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return true; } return false; @@ -110717,22 +111953,22 @@ var ts; return ts.factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); } function maskModifierFlags(node, modifierMask, modifierAdditions) { - if (modifierMask === void 0) { modifierMask = 257023 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } + if (modifierMask === void 0) { modifierMask = 258047 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } if (modifierAdditions === void 0) { modifierAdditions = 0 /* ModifierFlags.None */; } var flags = (ts.getEffectiveModifierFlags(node) & modifierMask) | modifierAdditions; - if (flags & 512 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { + if (flags & 1024 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { // A non-exported default is a nonsequitor - we usually try to remove all export modifiers // from statements in ambient declarations; but a default export must retain its export modifier to be syntactically valid flags ^= 1 /* ModifierFlags.Export */; } - if (flags & 512 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { + if (flags & 1024 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { flags ^= 2 /* ModifierFlags.Ambient */; // `declare` is never required alongside `default` (and would be an error if printed) } return flags; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 172 /* SyntaxKind.GetAccessor */ + return accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -110741,52 +111977,52 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return !ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */); - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } return false; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return true; } return false; } function isProcessedComponent(node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 254 /* SyntaxKind.VariableDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: - case 189 /* SyntaxKind.ConditionalType */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 200 /* SyntaxKind.ImportType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 191 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 202 /* SyntaxKind.ImportType */: return true; } return false; @@ -110926,7 +112162,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, factory, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(355 /* SyntaxKind.Count */); + var enabledSyntaxKindFeatures = new Array(358 /* SyntaxKind.Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentStatements; @@ -111008,7 +112244,7 @@ var ts; var transformed = []; for (var _a = 0, nodes_3 = nodes; _a < nodes_3.length; _a++) { var node = nodes_3[_a]; - ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 305 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); + ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 308 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); transformed.push((allowDtsFiles ? transformation : transformRoot)(node)); ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop(); } @@ -111414,7 +112650,7 @@ var ts; /*@internal*/ function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 306 /* SyntaxKind.Bundle */) { + if (sourceFile.kind === 309 /* SyntaxKind.Bundle */) { return getOutputPathsForBundle(options, forceDtsPaths); } else { @@ -111783,8 +113019,8 @@ var ts; } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) { var sourceFileOrBundle = transform.transformed[0]; - var bundle = sourceFileOrBundle.kind === 306 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 309 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; var sourceMapGenerator; if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) { @@ -111834,7 +113070,7 @@ var ts; } function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) { return (mapOptions.sourceMap || mapOptions.inlineSourceMap) - && (sourceFileOrBundle.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); + && (sourceFileOrBundle.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); } function getSourceRoot(mapOptions) { // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the @@ -111897,8 +113133,8 @@ var ts; } ts.getBuildInfoText = getBuildInfoText; /*@internal*/ - function getBuildInfo(buildInfoText) { - return JSON.parse(buildInfoText); + function getBuildInfo(buildInfoFile, buildInfoText) { + return ts.readJsonOrUndefined(buildInfoFile, buildInfoText); } ts.getBuildInfo = getBuildInfo; /*@internal*/ @@ -111976,17 +113212,16 @@ var ts; var buildInfo; if (host.getBuildInfo) { // If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo - var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); - if (!hostBuildInfo) - return buildInfoPath; - buildInfo = hostBuildInfo; + buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); } else { var buildInfoText = host.readFile(buildInfoPath); if (!buildInfoText) return buildInfoPath; - buildInfo = getBuildInfo(buildInfoText); + buildInfo = getBuildInfo(buildInfoPath, buildInfoText); } + if (!buildInfo) + return buildInfoPath; if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts)) return buildInfoPath; var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath)); @@ -112112,6 +113347,10 @@ var ts; var nodeIdToGeneratedName; // Map of generated names for specific nodes. var autoGeneratedIdToGeneratedName; // Map of generated names for temp and loop variables. var generatedNames; // Set of names generated by the NameGenerator. + var formattedNameTempFlagsStack; + var formattedNameTempFlags; + var privateNameTempFlagsStack; // Stack of enclosing name generation scopes. + var privateNameTempFlags; // TempFlags for the current name generation scope. var tempFlagsStack; // Stack of enclosing name generation scopes. var tempFlags; // TempFlags for the current name generation scope. var reservedNamesStack; // Stack of TempFlags reserved in enclosing name generation scopes. @@ -112177,9 +113416,9 @@ var ts; break; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: return printFile(node); - case 306 /* SyntaxKind.Bundle */: return printBundle(node); - case 307 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); + case 308 /* SyntaxKind.SourceFile */: return printFile(node); + case 309 /* SyntaxKind.Bundle */: return printBundle(node); + case 310 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -112370,6 +113609,10 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNames = new ts.Set(); + formattedNameTempFlagsStack = []; + formattedNameTempFlags = new ts.Map(); + privateNameTempFlagsStack = []; + privateNameTempFlags = 0 /* TempFlags.Auto */; tempFlagsStack = []; tempFlags = 0 /* TempFlags.Auto */; reservedNamesStack = []; @@ -112513,315 +113756,315 @@ var ts; return emitPrivateIdentifier(node); // Parse tree nodes // Names - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return emitQualifiedName(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return emitComputedPropertyName(node); // Signature elements - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return emitTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return emitParameter(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return emitDecorator(node); // Type members - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return emitPropertySignature(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return emitPropertyDeclaration(node); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return emitMethodSignature(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return emitMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return emitClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return emitConstructor(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return emitAccessorDeclaration(node); - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return emitCallSignature(node); - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return emitConstructSignature(node); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return emitIndexSignature(node); // Types - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return emitTypePredicate(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return emitTypeReference(node); - case 179 /* SyntaxKind.FunctionType */: + case 181 /* SyntaxKind.FunctionType */: return emitFunctionType(node); - case 180 /* SyntaxKind.ConstructorType */: + case 182 /* SyntaxKind.ConstructorType */: return emitConstructorType(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return emitTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return emitTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return emitArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return emitTupleType(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return emitOptionalType(node); // SyntaxKind.RestType is handled below - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return emitUnionType(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return emitIntersectionType(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return emitConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return emitInferType(node); - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return emitParenthesizedType(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return emitThisType(); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return emitTypeOperator(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return emitIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return emitMappedType(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return emitLiteralType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return emitNamedTupleMember(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return emitTemplateType(node); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return emitTemplateTypeSpan(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return emitImportTypeNode(node); // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return emitBindingElement(node); // Misc - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return emitTemplateSpan(node); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return emitBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return emitVariableStatement(node); - case 236 /* SyntaxKind.EmptyStatement */: + case 239 /* SyntaxKind.EmptyStatement */: return emitEmptyStatement(/*isEmbeddedStatement*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return emitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return emitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return emitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return emitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return emitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return emitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return emitForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return emitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return emitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return emitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return emitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return emitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return emitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return emitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return emitTryStatement(node); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return emitVariableDeclaration(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return emitVariableDeclarationList(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return emitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return emitClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return emitEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return emitModuleDeclaration(node); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return emitModuleBlock(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return emitCaseBlock(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return emitNamespaceExportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return emitImportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return emitImportClause(node); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return emitNamespaceImport(node); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return emitNamespaceExport(node); - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: return emitNamedImports(node); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return emitImportSpecifier(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return emitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return emitExportDeclaration(node); - case 273 /* SyntaxKind.NamedExports */: + case 276 /* SyntaxKind.NamedExports */: return emitNamedExports(node); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return emitExportSpecifier(node); - case 293 /* SyntaxKind.AssertClause */: + case 296 /* SyntaxKind.AssertClause */: return emitAssertClause(node); - case 294 /* SyntaxKind.AssertEntry */: + case 297 /* SyntaxKind.AssertEntry */: return emitAssertEntry(node); - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return; // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 11 /* SyntaxKind.JsxText */: return emitJsxText(node); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: return emitJsxOpeningElementOrFragment(node); - case 281 /* SyntaxKind.JsxClosingElement */: - case 284 /* SyntaxKind.JsxClosingFragment */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 287 /* SyntaxKind.JsxClosingFragment */: return emitJsxClosingElementOrFragment(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return emitJsxAttribute(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return emitJsxAttributes(node); - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return emitJsxExpression(node); // Clauses - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return emitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return emitDefaultClause(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return emitHeritageClause(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return emitCatchClause(node); // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return emitPropertyAssignment(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return emitEnumMember(node); // Unparsed - case 300 /* SyntaxKind.UnparsedPrologue */: + case 303 /* SyntaxKind.UnparsedPrologue */: return writeUnparsedNode(node); - case 307 /* SyntaxKind.UnparsedSource */: - case 301 /* SyntaxKind.UnparsedPrepend */: + case 310 /* SyntaxKind.UnparsedSource */: + case 304 /* SyntaxKind.UnparsedPrepend */: return emitUnparsedSourceOrPrepend(node); - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return emitUnparsedTextLike(node); - case 304 /* SyntaxKind.UnparsedSyntheticReference */: + case 307 /* SyntaxKind.UnparsedSyntheticReference */: return emitUnparsedSyntheticReference(node); // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return emitSourceFile(node); - case 306 /* SyntaxKind.Bundle */: + case 309 /* SyntaxKind.Bundle */: return ts.Debug.fail("Bundles should be printed using printBundle"); // SyntaxKind.UnparsedSource (handled above) - case 308 /* SyntaxKind.InputFiles */: + case 311 /* SyntaxKind.InputFiles */: return ts.Debug.fail("InputFiles should not be printed"); // JSDoc nodes (only used in codefixes currently) - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return emitJSDocTypeExpression(node); - case 310 /* SyntaxKind.JSDocNameReference */: + case 313 /* SyntaxKind.JSDocNameReference */: return emitJSDocNameReference(node); - case 312 /* SyntaxKind.JSDocAllType */: + case 315 /* SyntaxKind.JSDocAllType */: return writePunctuation("*"); - case 313 /* SyntaxKind.JSDocUnknownType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return writePunctuation("?"); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return emitJSDocNullableType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return emitJSDocOptionalType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return emitJSDocFunctionType(node); - case 186 /* SyntaxKind.RestType */: - case 318 /* SyntaxKind.JSDocVariadicType */: + case 188 /* SyntaxKind.RestType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return emitRestOrJSDocVariadicType(node); - case 319 /* SyntaxKind.JSDocNamepathType */: + case 322 /* SyntaxKind.JSDocNamepathType */: return; - case 320 /* SyntaxKind.JSDoc */: + case 323 /* SyntaxKind.JSDoc */: return emitJSDoc(node); - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: return emitJSDocTypeLiteral(node); - case 323 /* SyntaxKind.JSDocSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return emitJSDocSignature(node); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 337 /* SyntaxKind.JSDocOverrideTag */: + case 330 /* SyntaxKind.JSDocTag */: + case 335 /* SyntaxKind.JSDocClassTag */: + case 340 /* SyntaxKind.JSDocOverrideTag */: return emitJSDocSimpleTag(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return emitJSDocHeritageTag(node); - case 330 /* SyntaxKind.JSDocAuthorTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: + case 333 /* SyntaxKind.JSDocAuthorTag */: + case 334 /* SyntaxKind.JSDocDeprecatedTag */: return; // SyntaxKind.JSDocClassTag (see JSDocTag, above) - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 339 /* SyntaxKind.JSDocReadonlyTag */: return; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return emitJSDocCallbackTag(node); // SyntaxKind.JSDocEnumTag (see below) - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return emitJSDocPropertyLikeTag(node); - case 339 /* SyntaxKind.JSDocEnumTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return emitJSDocSimpleTypedTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return emitJSDocTemplateTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return emitJSDocTypedefTag(node); - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: return emitJSDocSeeTag(node); // SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above) // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 352 /* SyntaxKind.NotEmittedStatement */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return; } if (ts.isExpression(node)) { @@ -112853,85 +114096,87 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: return emitPrivateIdentifier(node); // Expressions - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return emitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return emitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return emitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return emitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return emitArrowFunction(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return emitDeleteExpression(node); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return emitTypeOfExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return emitVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return emitAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return emitBinaryExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return emitConditionalExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return emitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return emitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return emitSpreadElement(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return emitClassExpression(node); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: return emitAsExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return emitNonNullExpression(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return emitSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return emitMetaProperty(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return ts.Debug.fail("SyntheticExpression should never be printed."); // JSX - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return emitJsxElement(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return emitJsxFragment(node); // Synthesized list - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.Debug.fail("SyntaxList should not be printed"); // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: + case 352 /* SyntaxKind.NotEmittedStatement */: return; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return emitCommaList(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return; - case 354 /* SyntaxKind.SyntheticReferenceExpression */: + case 357 /* SyntaxKind.SyntheticReferenceExpression */: return ts.Debug.fail("SyntheticReferenceExpression should not be printed"); } } @@ -112979,7 +114224,7 @@ var ts; } function emitHelpers(node) { var helpersEmitted = false; - var bundle = node.kind === 306 /* SyntaxKind.Bundle */ ? node : undefined; + var bundle = node.kind === 309 /* SyntaxKind.Bundle */ ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -113079,7 +114324,7 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 302 /* SyntaxKind.UnparsedText */ ? + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 305 /* SyntaxKind.UnparsedText */ ? "text" /* BundleFileSectionKind.Text */ : "internal" /* BundleFileSectionKind.Internal */); } @@ -113116,7 +114361,7 @@ var ts; } function emitTabStop(hint, node, snippet) { // A tab stop should only be attached to an empty node, i.e. a node that doesn't emit any text. - ts.Debug.assert(node.kind === 236 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); + ts.Debug.assert(node.kind === 239 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); ts.Debug.assert(hint !== 5 /* EmitHint.EmbeddedStatement */, "A tab stop cannot be attached to an embedded statement."); nonEscapingWrite("$".concat(snippet.order)); } @@ -113177,7 +114422,7 @@ var ts; emit(node.dotDotDotToken); emitNodeWithWriter(node.name, writeParameter); emit(node.questionToken); - if (node.parent && node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */ && !node.name) { + if (node.parent && node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */ && !node.name) { emit(node.type); } else { @@ -113238,7 +114483,7 @@ var ts; } function emitAccessorDeclaration(node) { emitDecoratorsAndModifiers(node, node.modifiers); - writeKeyword(node.kind === 172 /* SyntaxKind.GetAccessor */ ? "get" : "set"); + writeKeyword(node.kind === 174 /* SyntaxKind.GetAccessor */ ? "get" : "set"); writeSpace(); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); @@ -113411,7 +114656,7 @@ var ts; function emitTypeOperator(node) { writeTokenText(node.operator, writeKeyword); writeSpace(); - var parenthesizerRule = node.operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + var parenthesizerRule = node.operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : parenthesizer.parenthesizeOperandOfTypeOperator; emit(node.type, parenthesizerRule); @@ -113434,7 +114679,7 @@ var ts; } if (node.readonlyToken) { emit(node.readonlyToken); - if (node.readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { + if (node.readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { writeKeyword("readonly"); } writeSpace(); @@ -113680,7 +114925,7 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } function emitAwaitExpression(node) { - emitTokenWithComment(132 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(133 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } @@ -113705,7 +114950,7 @@ var ts; // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. var operand = node.operand; - return operand.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ + return operand.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && ((node.operator === 39 /* SyntaxKind.PlusToken */ && (operand.operator === 39 /* SyntaxKind.PlusToken */ || operand.operator === 45 /* SyntaxKind.PlusPlusToken */)) || (node.operator === 40 /* SyntaxKind.MinusToken */ && (operand.operator === 40 /* SyntaxKind.MinusToken */ || operand.operator === 46 /* SyntaxKind.MinusMinusToken */))); } @@ -113853,6 +115098,15 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); writeOperator("!"); } + function emitSatisfiesExpression(node) { + emitExpression(node.expression, /*parenthesizerRules*/ undefined); + if (node.type) { + writeSpace(); + writeKeyword("satisfies"); + writeSpace(); + emit(node.type); + } + } function emitMetaProperty(node) { writeToken(node.keywordToken, node.pos, writePunctuation); writePunctuation("."); @@ -113910,7 +115164,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node, node.thenStatement, node.elseStatement); emitTokenWithComment(91 /* SyntaxKind.ElseKeyword */, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 239 /* SyntaxKind.IfStatement */) { + if (node.elseStatement.kind === 242 /* SyntaxKind.IfStatement */) { writeSpace(); emit(node.elseStatement); } @@ -113973,7 +115227,7 @@ var ts; emitTokenWithComment(20 /* SyntaxKind.OpenParenToken */, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(160 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); + emitTokenWithComment(162 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitTokenWithComment(21 /* SyntaxKind.CloseParenToken */, node.expression.end, writePunctuation, node); @@ -113981,7 +115235,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { emit(node); } else { @@ -114018,7 +115272,7 @@ var ts; } pos = writeTokenText(token, writer, pos); if (isSimilarNode && contextNode.end !== pos) { - var isJsxExprContext = contextNode.kind === 288 /* SyntaxKind.JsxExpression */; + var isJsxExprContext = contextNode.kind === 291 /* SyntaxKind.JsxExpression */; emitTrailingCommentsOfPosition(pos, /*prefixSpace*/ !isJsxExprContext, /*forceNoNewline*/ isJsxExprContext); } return pos; @@ -114328,7 +115582,7 @@ var ts; emitTokenWithComment(100 /* SyntaxKind.ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114353,7 +115607,7 @@ var ts; if (node.importClause) { emit(node.importClause); writeSpace(); - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); writeSpace(); } emitExpression(node.moduleSpecifier); @@ -114364,7 +115618,7 @@ var ts; } function emitImportClause(node) { if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114377,7 +115631,7 @@ var ts; function emitNamespaceImport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114403,10 +115657,11 @@ var ts; writeTrailingSemicolon(); } function emitExportDeclaration(node) { + emitModifiers(node, node.modifiers); var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - nextPos = emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); writeSpace(); } if (node.exportClause) { @@ -114418,7 +115673,7 @@ var ts; if (node.moduleSpecifier) { writeSpace(); var fromPos = node.exportClause ? node.exportClause.end : nextPos; - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); writeSpace(); emitExpression(node.moduleSpecifier); } @@ -114428,7 +115683,7 @@ var ts; writeTrailingSemicolon(); } function emitAssertClause(node) { - emitTokenWithComment(129 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(130 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); writeSpace(); var elements = node.elements; emitList(node, elements, 526226 /* ListFormat.ImportClauseEntries */); @@ -114448,9 +115703,9 @@ var ts; function emitNamespaceExportDeclaration(node) { var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(142 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(143 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); writeSpace(); emit(node.name); writeTrailingSemicolon(); @@ -114458,7 +115713,7 @@ var ts; function emitNamespaceExport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114481,7 +115736,7 @@ var ts; if (node.propertyName) { emit(node.propertyName); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114702,7 +115957,7 @@ var ts; } } if (node.tags) { - if (node.tags.length === 1 && node.tags[0].kind === 343 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { + if (node.tags.length === 1 && node.tags[0].kind === 346 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { writeSpace(); emit(node.tags[0]); } @@ -114747,7 +116002,7 @@ var ts; function emitJSDocTypedefTag(tag) { emitJSDocTagName(tag.tagName); if (tag.typeExpression) { - if (tag.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */) { + if (tag.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */) { emitJSDocTypeExpression(tag.typeExpression); } else { @@ -114766,7 +116021,7 @@ var ts; emit(tag.fullName); } emitJSDocComment(tag.comment); - if (tag.typeExpression && tag.typeExpression.kind === 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (tag.typeExpression && tag.typeExpression.kind === 325 /* SyntaxKind.JSDocTypeLiteral */) { emitJSDocTypeLiteral(tag.typeExpression); } } @@ -115699,13 +116954,13 @@ var ts; && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile)); } function skipSynthesizedParentheses(node) { - while (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; } function getTextOfNode(node, includeTrivia) { - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.isGeneratedPrivateIdentifier(node)) { return generateName(node); } if (ts.isStringLiteral(node) && node.textSourceNode) { @@ -115729,7 +116984,7 @@ var ts; function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) { if (node.kind === 10 /* SyntaxKind.StringLiteral */ && node.textSourceNode) { var textSourceNode = node.textSourceNode; - if (ts.isIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { + if (ts.isIdentifier(textSourceNode) || ts.isPrivateIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { var text = ts.isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode); return jsxAttributeEscape ? "\"".concat(ts.escapeJsxAttributeString(text), "\"") : neverAsciiEscape || (ts.getEmitFlags(node) & 16777216 /* EmitFlags.NoAsciiEscaping */) ? "\"".concat(ts.escapeString(text), "\"") : @@ -115753,7 +117008,11 @@ var ts; return; } tempFlagsStack.push(tempFlags); - tempFlags = 0; + tempFlags = 0 /* TempFlags.Auto */; + privateNameTempFlagsStack.push(privateNameTempFlags); + privateNameTempFlags = 0 /* TempFlags.Auto */; + formattedNameTempFlagsStack.push(formattedNameTempFlags); + formattedNameTempFlags = undefined; reservedNamesStack.push(reservedNames); } /** @@ -115764,6 +117023,8 @@ var ts; return; } tempFlags = tempFlagsStack.pop(); + privateNameTempFlags = privateNameTempFlagsStack.pop(); + formattedNameTempFlags = formattedNameTempFlagsStack.pop(); reservedNames = reservedNamesStack.pop(); } function reserveNameInNestedScopes(name) { @@ -115776,84 +117037,84 @@ var ts; if (!node) return; switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: ts.forEach(node.statements, generateNames); break; - case 250 /* SyntaxKind.LabeledStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: generateNames(node.statement); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: generateNames(node.thenStatement); generateNames(node.elseStatement); break; - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: generateNames(node.initializer); generateNames(node.statement); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: generateNames(node.caseBlock); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: ts.forEach(node.clauses, generateNames); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: ts.forEach(node.statements, generateNames); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: generateNames(node.tryBlock); generateNames(node.catchClause); generateNames(node.finallyBlock); break; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: generateNames(node.variableDeclaration); generateNames(node.block); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: generateNames(node.declarationList); break; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: ts.forEach(node.declarations, generateNames); break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: generateNameIfNeeded(node.name); break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: generateNameIfNeeded(node.name); if (ts.getEmitFlags(node) & 524288 /* EmitFlags.ReuseTempVariableScope */) { ts.forEach(node.parameters, generateNames); generateNames(node.body); } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: ts.forEach(node.elements, generateNames); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: generateNames(node.importClause); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: generateNameIfNeeded(node.name); generateNames(node.namedBindings); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: generateNameIfNeeded(node.name); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: generateNameIfNeeded(node.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: ts.forEach(node.elements, generateNames); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: generateNameIfNeeded(node.propertyName || node.name); break; } @@ -115862,19 +117123,19 @@ var ts; if (!node) return; switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: generateNameIfNeeded(node.name); break; } } function generateNameIfNeeded(name) { if (name) { - if (ts.isGeneratedIdentifier(name)) { + if (ts.isGeneratedIdentifier(name) || ts.isGeneratedPrivateIdentifier(name)) { generateName(name); } else if (ts.isBindingPattern(name)) { @@ -115889,7 +117150,7 @@ var ts; if ((name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) === 4 /* GeneratedIdentifierFlags.Node */) { // Node names generate unique names based on their original node // and are cached based on that node's id. - return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags); + return generateNameCached(ts.getNodeForGeneratedName(name), ts.isPrivateIdentifier(name), name.autoGenerateFlags, name.autoGeneratePrefix, name.autoGenerateSuffix); } else { // Auto, Loop, and Unique names are cached based on their unique @@ -115898,9 +117159,9 @@ var ts; return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name)); } } - function generateNameCached(node, flags) { + function generateNameCached(node, privateName, flags, prefix, suffix) { var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags)); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags !== null && flags !== void 0 ? flags : 0 /* GeneratedIdentifierFlags.None */, ts.formatGeneratedNamePart(prefix, generateName), ts.formatGeneratedNamePart(suffix))); } /** * Returns a value indicating whether a name is unique globally, within the current file, @@ -115932,20 +117193,53 @@ var ts; } return true; } + function getTempFlags(formattedNameKey) { + var _a; + switch (formattedNameKey) { + case "": + return tempFlags; + case "#": + return privateNameTempFlags; + default: + return (_a = formattedNameTempFlags === null || formattedNameTempFlags === void 0 ? void 0 : formattedNameTempFlags.get(formattedNameKey)) !== null && _a !== void 0 ? _a : 0 /* TempFlags.Auto */; + } + } + function setTempFlags(formattedNameKey, flags) { + switch (formattedNameKey) { + case "": + tempFlags = flags; + break; + case "#": + privateNameTempFlags = flags; + break; + default: + formattedNameTempFlags !== null && formattedNameTempFlags !== void 0 ? formattedNameTempFlags : (formattedNameTempFlags = new ts.Map()); + formattedNameTempFlags.set(formattedNameKey, flags); + break; + } + } /** * Return the next available name in the pattern _a ... _z, _0, _1, ... * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. * Note that names generated by makeTempVariableName and makeUniqueName will never conflict. */ - function makeTempVariableName(flags, reservedInNestedScopes) { + function makeTempVariableName(flags, reservedInNestedScopes, privateName, prefix, suffix) { + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } + // Generate a key to use to acquire a TempFlags counter based on the fixed portions of the generated name. + var key = ts.formatGeneratedName(privateName, prefix, "", suffix); + var tempFlags = getTempFlags(key); if (flags && !(tempFlags & flags)) { var name = flags === 268435456 /* TempFlags._i */ ? "_i" : "_n"; - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { tempFlags |= flags; if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } while (true) { @@ -115956,11 +117250,13 @@ var ts; var name = count < 26 ? "_" + String.fromCharCode(97 /* CharacterCodes.a */ + count) : "_" + (count - 26); - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } } @@ -115972,17 +117268,24 @@ var ts; * makeUniqueName are guaranteed to never conflict. * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1' */ - function makeUniqueName(baseName, checkFn, optimistic, scoped) { + function makeUniqueName(baseName, checkFn, optimistic, scoped, privateName, prefix, suffix) { if (checkFn === void 0) { checkFn = isUniqueName; } + if (baseName.length > 0 && baseName.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + baseName = baseName.slice(1); + } + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } if (optimistic) { - if (checkFn(baseName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(baseName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(baseName); + generatedNames.add(fullName); } - return baseName; + return fullName; } } // Find the first unique 'name_n', where n is a positive number @@ -115991,21 +117294,21 @@ var ts; } var i = 1; while (true) { - var generatedName = baseName + i; - if (checkFn(generatedName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName + i, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(generatedName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(generatedName); + generatedNames.add(fullName); } - return generatedName; + return fullName; } i++; } } function makeFileLevelOptimisticUniqueName(name) { - return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true); + return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a ModuleDeclaration or EnumDeclaration. @@ -116013,7 +117316,7 @@ var ts; function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); // Use module/enum name itself if it is unique, otherwise make a unique variation - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + return isUniqueLocalName(name, node) ? name : makeUniqueName(name, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for an ImportDeclaration or ExportDeclaration. @@ -116022,89 +117325,76 @@ var ts; var expr = ts.getExternalModuleName(node); // TODO: GH#18217 var baseName = ts.isStringLiteral(expr) ? ts.makeIdentifierFromModuleName(expr.text) : "module"; - return makeUniqueName(baseName); + return makeUniqueName(baseName, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a default export. */ function generateNameForExportDefault() { - return makeUniqueName("default"); + return makeUniqueName("default", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a class expression. */ function generateNameForClassExpression() { - return makeUniqueName("class"); + return makeUniqueName("class", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } - function generateNameForMethodOrAccessor(node) { + function generateNameForMethodOrAccessor(node, privateName, prefix, suffix) { if (ts.isIdentifier(node.name)) { - return generateNameCached(node.name); + return generateNameCached(node.name, privateName); } - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reservedInNestedScopes*/ false, privateName, prefix, suffix); } /** * Generates a unique name from a node. */ - function generateNameForNode(node, flags) { + function generateNameForNode(node, privateName, flags, prefix, suffix) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 80 /* SyntaxKind.PrivateIdentifier */: + return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), privateName, prefix, suffix); + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForModuleOrEnum(node); - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForImportOrExportDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForExportDefault(); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForClassExpression(); - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return generateNameForMethodOrAccessor(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true); + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return generateNameForMethodOrAccessor(node, privateName, prefix, suffix); + case 164 /* SyntaxKind.ComputedPropertyName */: + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true, privateName, prefix, suffix); default: - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ false, privateName, prefix, suffix); } } /** * Generates a unique identifier for a node. */ function makeName(name) { + var prefix = ts.formatGeneratedNamePart(name.autoGeneratePrefix, generateName); + var suffix = ts.formatGeneratedNamePart(name.autoGenerateSuffix); switch (name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) { case 1 /* GeneratedIdentifierFlags.Auto */: - return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); case 2 /* GeneratedIdentifierFlags.Loop */: - return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + ts.Debug.assertNode(name, ts.isIdentifier); + return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), /*privateName*/ false, prefix, suffix); case 3 /* GeneratedIdentifierFlags.Unique */: - return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); - } - return ts.Debug.fail("Unsupported GeneratedIdentifierKind."); - } - /** - * Gets the node from which a name should be generated. - */ - function getNodeForGeneratedName(name) { - var autoGenerateId = name.autoGenerateId; - var node = name; - var original = node.original; - while (original) { - node = original; - // if "node" is a different generated name (having a different - // "autoGenerateId"), use it and stop traversing. - if (ts.isIdentifier(node) - && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) - && node.autoGenerateId !== autoGenerateId) { - break; - } - original = node.original; + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); } - // otherwise, return the original node for the source; - return node; + return ts.Debug.fail("Unsupported GeneratedIdentifierKind: ".concat(ts.Debug.formatEnum(name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */, ts.GeneratedIdentifierFlags, /*isFlags*/ true), ".")); } // Comments function pipelineEmitWithComments(hint, node) { @@ -116150,7 +117440,7 @@ var ts; // Emit leading comments if the position is not synthesized and the node // has not opted out from emitting leading comments. if (!skipLeadingComments) { - emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 349 /* SyntaxKind.NotEmittedStatement */); + emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 352 /* SyntaxKind.NotEmittedStatement */); } if (!skipLeadingComments || (pos >= 0 && (emitFlags & 512 /* EmitFlags.NoLeadingComments */) !== 0)) { // Advance the container position if comments get emitted or if they've been disabled explicitly using NoLeadingComments. @@ -116161,7 +117451,7 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -116180,7 +117470,7 @@ var ts; declarationListContainerEnd = savedDeclarationListContainerEnd; // Emit trailing comments if the position is not synthesized and the node // has not opted out from emitting leading comments and is an emitted node. - if (!skipTrailingComments && node.kind !== 349 /* SyntaxKind.NotEmittedStatement */) { + if (!skipTrailingComments && node.kind !== 352 /* SyntaxKind.NotEmittedStatement */) { emitTrailingComments(end); } } @@ -116461,7 +117751,7 @@ var ts; } else { var source = sourceMapRange.source || sourceMapSource; - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 16 /* EmitFlags.NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos)); @@ -116479,7 +117769,7 @@ var ts; if (emitFlags & 64 /* EmitFlags.NoNestedSourceMaps */) { sourceMapsDisabled = false; } - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 32 /* EmitFlags.NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end); @@ -116644,7 +117934,16 @@ var ts; return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath)); } function getCachedFileSystemEntriesForBaseDir(path) { - return getCachedFileSystemEntries(ts.getDirectoryPath(path)); + var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path)); + if (!entries) { + return entries; + } + // If we're looking for the base directory, we're definitely going to search the entries + if (!entries.sortedAndCanonicalizedFiles) { + entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort(); + entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort(); + } + return entries; } function getBaseNameOfFileName(fileName) { return ts.getBaseFileName(ts.normalizePath(fileName)); @@ -116687,21 +117986,10 @@ var ts; return undefined; } } - function fileNameEqual(name1, name2) { - return getCanonicalFileName(name1) === getCanonicalFileName(name2); - } function hasEntry(entries, name) { - return ts.some(entries, function (file) { return fileNameEqual(file, name); }); - } - function updateFileSystemEntry(entries, baseName, isValid) { - if (hasEntry(entries, baseName)) { - if (!isValid) { - return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); }); - } - } - else if (isValid) { - return entries.push(baseName); - } + // Case-sensitive comparison since already canonicalized + var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive); + return index >= 0; } function writeFile(fileName, data, writeByteOrderMark) { var path = toPath(fileName); @@ -116714,7 +118002,7 @@ var ts; function fileExists(fileName) { var path = toPath(fileName); var result = getCachedFileSystemEntriesForBaseDir(path); - return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) || + return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) || host.fileExists(fileName); } function directoryExists(dirPath) { @@ -116724,9 +118012,14 @@ var ts; function createDirectory(dirPath) { var path = toPath(dirPath); var result = getCachedFileSystemEntriesForBaseDir(path); - var baseFileName = getBaseNameOfFileName(dirPath); if (result) { - updateFileSystemEntry(result.directories, baseFileName, /*isValid*/ true); + var baseName = getBaseNameOfFileName(dirPath); + var canonicalizedBaseName = getCanonicalFileName(baseName); + var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories; + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + result.directories.push(baseName); + } } host.createDirectory(dirPath); } @@ -116795,7 +118088,7 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) { // Folder added or removed, clear the cache instead of updating the folder and its structure clearCache(); } @@ -116815,7 +118108,23 @@ var ts; } } function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) { - updateFileSystemEntry(parentResult.files, baseName, fileExists); + var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles; + var canonicalizedBaseName = getCanonicalFileName(baseName); + if (fileExists) { + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + parentResult.files.push(baseName); + } + } + else { + // Case-sensitive comparison since already canonicalized + var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive); + if (sortedIndex >= 0) { + canonicalizedFiles.splice(sortedIndex, 1); + var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; }); + parentResult.files.splice(unsortedIndex, 1); + } + } } function clearCache() { cachedReadDirectoryResult.clear(); @@ -117295,14 +118604,16 @@ var ts; } return setReadFileCache(key, fileName); }; - var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersion, onError, shouldCreateNewSourceFile) { + var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) { var key = toPath(fileName); - var value = sourceFileCache.get(key); + var impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : undefined; + var forImpliedNodeFormat = sourceFileCache.get(impliedNodeFormat); + var value = forImpliedNodeFormat === null || forImpliedNodeFormat === void 0 ? void 0 : forImpliedNodeFormat.get(key); if (value) return value; - var sourceFile = getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile); + var sourceFile = getSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile); if (sourceFile && (ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Extension.Json */))) { - sourceFileCache.set(key, sourceFile); + sourceFileCache.set(impliedNodeFormat, (forImpliedNodeFormat || new ts.Map()).set(key, sourceFile)); } return sourceFile; } : undefined; @@ -117327,13 +118638,15 @@ var ts; var value = readFileCache.get(key); if (value !== undefined && value !== data) { readFileCache.delete(key); - sourceFileCache.delete(key); + sourceFileCache.forEach(function (map) { return map.delete(key); }); } else if (getSourceFileWithCache) { - var sourceFile = sourceFileCache.get(key); - if (sourceFile && sourceFile.text !== data) { - sourceFileCache.delete(key); - } + sourceFileCache.forEach(function (map) { + var sourceFile = map.get(key); + if (sourceFile && sourceFile.text !== data) { + map.delete(key); + } + }); } originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false)); }; @@ -117575,7 +118888,6 @@ var ts; return resolutions; } ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache; - ; /** * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file. @@ -117775,7 +119087,7 @@ var ts; * Determines if program structure is upto date or needs to be recreated */ /* @internal */ - function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { + function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { // If we haven't created a program yet or have changed automatic type directives, then it is not up-to-date if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames())) return false; @@ -117803,7 +119115,7 @@ var ts; return true; function sourceFileNotUptoDate(sourceFile) { return !sourceFileVersionUptoDate(sourceFile) || - hasInvalidatedResolution(sourceFile.path); + hasInvalidatedResolutions(sourceFile.path); } function sourceFileVersionUptoDate(sourceFile) { return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName); @@ -118049,7 +119361,7 @@ var ts; var moduleResolutionCache; var typeReferenceDirectiveResolutionCache; var actualResolveModuleNamesWorker; - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; if (host.resolveModuleNames) { actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) { // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. @@ -118496,7 +119808,7 @@ var ts; for (var i = 0; i < moduleNames.length; i++) { var moduleName = moduleNames[i]; // If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions - if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) { + if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) { var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i)); if (oldResolvedModule) { if (ts.isTraceEnabled(options, host)) { @@ -118732,7 +120044,7 @@ var ts; // tentatively approve the file modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); } - else if (hasInvalidatedResolution(oldSourceFile.path)) { + else if (hasInvalidatedResolutions(oldSourceFile.path)) { // 'module/types' references could have changed structureIsReused = 1 /* StructureIsReused.SafeModules */; // add file to the modified list so that we will resolve it later @@ -119120,22 +120432,22 @@ var ts; // Return directly from the case if the given node doesnt want to visit each child // Otherwise break to visit each child switch (parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); return "skip"; } // falls through - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 257 /* SyntaxKind.VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); @@ -119143,65 +120455,68 @@ var ts; } } switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type")); return "skip"; } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type")); return "skip"; } break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, ts.isImportSpecifier(node) ? "import...type" : "export...type")); return "skip"; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_TypeScript_files)); return "skip"; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: var heritageClause = node; if (heritageClause.token === 117 /* SyntaxKind.ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: var interfaceKeyword = ts.tokenToString(118 /* SyntaxKind.InterfaceKeyword */); ts.Debug.assertIsDefined(interfaceKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword)); return "skip"; - case 261 /* SyntaxKind.ModuleDeclaration */: - var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(142 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(141 /* SyntaxKind.ModuleKeyword */); + case 264 /* SyntaxKind.ModuleDeclaration */: + var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(143 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(142 /* SyntaxKind.ModuleKeyword */); ts.Debug.assertIsDefined(moduleKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); return "skip"; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); return "skip"; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumKeyword = ts.Debug.checkDefined(ts.tokenToString(92 /* SyntaxKind.EnumKeyword */)); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); return "skip"; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 213 /* SyntaxKind.TypeAssertionExpression */: ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. } } @@ -119210,53 +120525,55 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)); } switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); return "skip"; } // falls through - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - checkModifiers(parent.modifiers, parent.kind === 237 /* SyntaxKind.VariableStatement */); + checkModifiers(parent.modifiers, parent.kind === 240 /* SyntaxKind.VariableStatement */); return "skip"; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Check modifiers of property declaration if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; - if (ts.isModifier(modifier) && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */) { + if (ts.isModifier(modifier) + && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ + && modifier.kind !== 127 /* SyntaxKind.AccessorKeyword */) { diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); } } return "skip"; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Check modifiers of parameter declaration if (nodes === parent.modifiers && ts.some(nodes, ts.isModifier)) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); @@ -119278,18 +120595,19 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); break; // These are all legal modifiers. case 124 /* SyntaxKind.StaticKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: } } } @@ -120214,10 +121532,12 @@ var ts; if (options.preserveConstEnums === false) { createDiagnosticForOptionName(ts.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled, "preserveConstEnums", "isolatedModules"); } - var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* ScriptKind.JSON */; }); - if (firstNonExternalModuleSourceFile) { - var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(firstNonExternalModuleSourceFile.fileName))); + for (var _a = 0, files_5 = files; _a < files_5.length; _a++) { + var file = files_5[_a]; + if (!ts.isExternalModule(file) && !ts.isSourceFileJS(file) && !file.isDeclarationFile && file.scriptKind !== 6 /* ScriptKind.JSON */) { + var span = ts.getErrorSpanForNode(file, file); + programDiagnostics.add(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(file.fileName))); + } } } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ScriptTarget.ES2015 */ && options.module === ts.ModuleKind.None) { @@ -121468,10 +122788,16 @@ var ts; var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined; var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile && !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions); + // We can only reuse emit signatures (i.e. .d.ts signatures) if the .d.ts file is unchanged, + // which will eg be depedent on change in options like declarationDir and outDir options are unchanged. + // We need to look in oldState.compilerOptions, rather than oldCompilerOptions (i.e.we need to disregard useOldState) because + // oldCompilerOptions can be undefined if there was change in say module from None to some other option + // which would make useOldState as false since we can now use reference maps that are needed to track what to emit, what to check etc + // but that option change does not affect d.ts file name so emitSignatures should still be reused. var canCopyEmitSignatures = compilerOptions.composite && (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) && !outFilePath && - !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions); + !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions); if (useOldState) { // Copy old state's changed files set (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); }); @@ -122686,7 +124012,7 @@ var ts; var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* CharacterCodes.slash */; if (isNonDirectorySeparatorRoot && dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths - pathPartForUserCheck.search(/[a-zA-z]\$\//) === 0) { // Dos style nextPart + pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) { // Dos style nextPart nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, nextDirectorySeparator + 1); if (nextDirectorySeparator === -1) { // ignore "//vda1cs4850/c$/folderAtRoot" @@ -122770,7 +124096,7 @@ var ts; invalidateResolutionOfFile: invalidateResolutionOfFile, invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations, setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports, - createHasInvalidatedResolution: createHasInvalidatedResolution, + createHasInvalidatedResolutions: createHasInvalidatedResolutions, isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports, updateTypeRootsWatch: updateTypeRootsWatch, closeTypeRootsWatch: closeTypeRootsWatch, @@ -122825,17 +124151,13 @@ var ts; var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path); return !!value && !!value.length; } - function createHasInvalidatedResolution(forceAllFilesAsInvalidated) { + function createHasInvalidatedResolutions(customHasInvalidatedResolutions) { // Ensure pending resolutions are applied invalidateResolutionsOfFailedLookupLocations(); - if (forceAllFilesAsInvalidated) { - // Any file asked would have invalidated resolution - filesWithInvalidatedResolutions = undefined; - return ts.returnTrue; - } var collected = filesWithInvalidatedResolutions; filesWithInvalidatedResolutions = undefined; - return function (path) { return (!!collected && collected.has(path)) || + return function (path) { return customHasInvalidatedResolutions(path) || + !!(collected === null || collected === void 0 ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path); }; } function startCachingPerDirectoryResolution() { @@ -124196,15 +125518,21 @@ var ts; return undefined; } function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) { - var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); - if (normalizedTargetPath === undefined) { + var normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); + if (normalizedTargetPaths === undefined) { + return undefined; + } + var normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); + var relativePaths = ts.flatMap(normalizedSourcePaths, function (sourcePath) { + return ts.map(normalizedTargetPaths, function (targetPath) { return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)); }); + }); + var shortest = ts.min(relativePaths, ts.compareNumberOfDirectorySeparators); + if (!shortest) { return undefined; } - var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); - var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath; return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs - ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions) - : ts.removeFileExtension(relativePath); + ? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions) + : ts.removeFileExtension(shortest); } function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) { var path = _a.path, isRedirect = _a.isRedirect; @@ -124341,8 +125669,8 @@ var ts; } } } - function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) { - return ts.firstDefined(rootDirs, function (rootDir) { + function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) { + return ts.mapDefined(rootDirs, function (rootDir) { var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName); return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath; }); @@ -125053,18 +126381,14 @@ var ts; if (host.getBuildInfo) { // host provides buildinfo, get it from there. This allows host to cache it buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath); - if (!buildInfo) - return undefined; } else { var content = host.readFile(buildInfoPath); if (!content) return undefined; - buildInfo = ts.getBuildInfo(content); + buildInfo = ts.getBuildInfo(buildInfoPath, content); } - if (buildInfo.version !== ts.version) - return undefined; - if (!buildInfo.program) + if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program) return undefined; return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host); } @@ -125219,6 +126543,10 @@ var ts; ts.maybeBind(host, host.getModuleResolutionCache) : (function () { return resolutionCache.getModuleResolutionCache(); }); var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; + // All resolutions are invalid if user provided resolutions and didnt supply hasInvalidatedResolutions + var customHasInvalidatedResolutions = userProvidedResolution ? + ts.maybeBind(host, host.hasInvalidatedResolutions) || ts.returnTrue : + ts.returnFalse; builderProgram = readBuilderProgram(compilerOptions, compilerHost); synchronizeProgram(); // Update the wild card directory watch @@ -125284,9 +126612,9 @@ var ts; resolutionCache.clear(); } } - // All resolutions are invalid if user provided resolutions - var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + var hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions); + var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile; + if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { if (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -125299,15 +126627,20 @@ var ts; if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); } - createNewProgram(hasInvalidatedResolution); + createNewProgram(hasInvalidatedResolutions); } reportFileChangeDetectedOnCreateProgram = false; if (host.afterProgramCreate && program !== builderProgram) { host.afterProgramCreate(builderProgram); } + compilerHost.readFile = originalReadFile; + compilerHost.fileExists = originalFileExists; + compilerHost.directoryExists = originalDirectoryExists; + compilerHost.createDirectory = originalCreateDirectory; + compilerHost.writeFile = originalWriteFile; return builderProgram; } - function createNewProgram(hasInvalidatedResolution) { + function createNewProgram(hasInvalidatedResolutions) { // Compile the program writeLog("CreatingProgramWith::"); writeLog(" roots: ".concat(JSON.stringify(rootFileNames))); @@ -125318,7 +126651,7 @@ var ts; hasChangedCompilerOptions = false; hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); - compilerHost.hasInvalidatedResolution = hasInvalidatedResolution; + compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; var oldProgram = getCurrentProgram(); builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences); @@ -125782,19 +127115,20 @@ var ts; */ UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend"; UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream"; - UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo"; - UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate"; - UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked"; - UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream"; - UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate"; - UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText"; + UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream"; + UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo"; + UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate"; + UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked"; + UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream"; + UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate"; + UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText"; /** * Projects with no outputs (i.e. "solution" files) */ - UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly"; - UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild"; + UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly"; + UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild"; })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {})); function resolveConfigFileProjectName(project) { if (ts.fileExtensionIs(project, ".json" /* Extension.Json */)) { @@ -126012,6 +127346,7 @@ var ts; if (value) { return isParsedCommandLine(value) ? value : undefined; } + ts.performance.mark("SolutionBuilder::beforeConfigFileParsing"); var diagnostic; var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host; var parsed; @@ -126026,6 +127361,8 @@ var ts; parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop; } configFileCache.set(configFilePath, parsed || diagnostic); + ts.performance.mark("SolutionBuilder::afterConfigFileParsing"); + ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing"); return parsed; } function resolveProjectName(state, name) { @@ -126225,6 +127562,7 @@ var ts; if (updateOutputFileStampsPending) { updateOutputTimestamps(state, config, projectPath); } + ts.performance.mark("SolutionBuilder::Timestamps only updates"); return doneInvalidatedProject(state, projectPath); } }; @@ -126318,6 +127656,10 @@ var ts; }; function done(cancellationToken, writeFile, customTransformers) { executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers); + if (kind === InvalidatedProjectKind.Build) + ts.performance.mark("SolutionBuilder::Projects built"); + else + ts.performance.mark("SolutionBuilder::Bundles updated"); return doneInvalidatedProject(state, projectPath); } function withProgramOrUndefined(action) { @@ -126496,13 +127838,13 @@ var ts; var emitterDiagnostics = ts.createDiagnosticCollection(); var emittedOutputs = new ts.Map(); var resultFlags = BuildResultFlags.DeclarationOutputUnchanged; - var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo; + var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined; outputFiles.forEach(function (_a) { var _b, _c; var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo; emittedOutputs.set(toPath(state, name), name); if (buildInfo) { - if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { + if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; } setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags); @@ -126795,8 +128137,7 @@ var ts; return existing.buildInfo || undefined; } var value = state.readFileWithCache(buildInfoPath); - var buildInfo = value ? ts.getBuildInfo(value) : undefined; - ts.Debug.assert(modifiedTime || !buildInfo); + var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined; state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime }); return buildInfo; } @@ -126881,7 +128222,14 @@ var ts; missingOutputFileName: buildInfoPath }; } - var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime)); + var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime); + if (!buildInfo) { + // Error reading buildInfo + return { + type: ts.UpToDateStatusType.ErrorReadingFile, + fileName: buildInfoPath + }; + } if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) { return { type: ts.UpToDateStatusType.TsVersionOutputOfDate, @@ -126890,8 +128238,15 @@ var ts; } if (buildInfo.program) { // If there are pending changes that are not emitted, project is out of date + // When there are syntax errors, changeFileSet will have list of files changed (irrespective of noEmit) + // But in case of semantic error we need special treatment. + // Checking presence of affectedFilesPendingEmit list is fast and good way to tell if there were semantic errors and file emit was blocked + // But if noEmit is true, affectedFilesPendingEmit will have file list even if there are no semantic errors to preserve list of files to be emitted when running with noEmit false + // So with noEmit set to true, check on semantic diagnostics needs to be explicit as oppose to when it is false when only files pending emit is sufficient if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) || - (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) { + (!project.options.noEmit ? + (_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length : + ts.some(buildInfo.program.semanticDiagnosticsPerFile, ts.isArray))) { return { type: ts.UpToDateStatusType.OutOfDateBuildInfo, buildInfoFile: buildInfoPath @@ -127066,7 +128421,10 @@ var ts; if (prior !== undefined) { return prior; } + ts.performance.mark("SolutionBuilder::beforeUpToDateCheck"); var actual = getUpToDateStatusWorker(state, project, resolvedPath); + ts.performance.mark("SolutionBuilder::afterUpToDateCheck"); + ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck"); state.projectStatus.set(resolvedPath, actual); return actual; } @@ -127204,6 +128562,13 @@ var ts; } } function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + return result; + } + function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127231,6 +128596,13 @@ var ts; : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } function clean(state, project, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeClean"); + var result = cleanWorker(state, project, onlyReferences); + ts.performance.mark("SolutionBuilder::afterClean"); + ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean"); + return result; + } + function cleanWorker(state, project, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127304,6 +128676,14 @@ var ts; state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected); } function buildNextInvalidatedProject(state, changeDetected) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + if (buildOrder) + reportErrorSummary(state, buildOrder); + } + function buildNextInvalidatedProjectWorker(state, changeDetected) { state.timerToBuildInvalidatedProject = undefined; if (state.reportFileChangeDetected) { state.reportFileChangeDetected = false; @@ -127336,7 +128716,7 @@ var ts; } } disableCache(state); - reportErrorSummary(state, buildOrder); + return buildOrder; } function watchConfigFile(state, resolved, resolvedPath, parsed) { if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath)) @@ -127391,6 +128771,7 @@ var ts; function startWatching(state, buildOrder) { if (!state.watchAllProjectsPending) return; + ts.performance.mark("SolutionBuilder::beforeWatcherCreation"); state.watchAllProjectsPending = false; for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) { var resolved = _a[_i]; @@ -127408,6 +128789,8 @@ var ts; watchPackageJsonFiles(state, resolved, resolvedPath, cfg); } } + ts.performance.mark("SolutionBuilder::afterWatcherCreation"); + ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation"); } function stopWatching(state) { ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher); @@ -127521,6 +128904,8 @@ var ts; return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName)); case ts.UpToDateStatusType.OutputMissing: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName)); + case ts.UpToDateStatusType.ErrorReadingFile: + return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName)); case ts.UpToDateStatusType.OutOfDateBuildInfo: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile)); case ts.UpToDateStatusType.UpToDate: @@ -127623,6 +129008,12 @@ var ts; SemanticClassificationFormat["Original"] = "original"; SemanticClassificationFormat["TwentyTwenty"] = "2020"; })(SemanticClassificationFormat = ts.SemanticClassificationFormat || (ts.SemanticClassificationFormat = {})); + var OrganizeImportsMode; + (function (OrganizeImportsMode) { + OrganizeImportsMode["All"] = "All"; + OrganizeImportsMode["SortAndCombine"] = "SortAndCombine"; + OrganizeImportsMode["RemoveUnused"] = "RemoveUnused"; + })(OrganizeImportsMode = ts.OrganizeImportsMode || (ts.OrganizeImportsMode = {})); var CompletionTriggerKind; (function (CompletionTriggerKind) { /** Completion was triggered by typing an identifier, manual invocation (e.g Ctrl+Space) or via API. */ @@ -127809,6 +129200,8 @@ var ts; * interface Y { foo:number; } */ ScriptElementKind["memberVariableElement"] = "property"; + /** class X { [public|private]* accessor foo: number; } */ + ScriptElementKind["memberAccessorVariableElement"] = "accessor"; /** * class X { constructor() { } } * class X { static { } } @@ -127941,37 +129334,37 @@ var ts; })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})); function getMeaningFromDeclaration(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.isInJSFile(node) && ts.getJSDocEnumTag(node) ? 7 /* SemanticMeaning.All */ : 1 /* SemanticMeaning.Value */; - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 292 /* SyntaxKind.CatchClause */: - case 285 /* SyntaxKind.JsxAttribute */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 295 /* SyntaxKind.CatchClause */: + case 288 /* SyntaxKind.JsxAttribute */: return 1 /* SemanticMeaning.Value */; - case 163 /* SyntaxKind.TypeParameter */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 165 /* SyntaxKind.TypeParameter */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: return 2 /* SemanticMeaning.Type */; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: // If it has no name node, it shares the name with the value declaration below it. return node.name === undefined ? 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */ : 2 /* SemanticMeaning.Type */; - case 299 /* SyntaxKind.EnumMember */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: return 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } @@ -127981,16 +129374,16 @@ var ts; else { return 4 /* SemanticMeaning.Namespace */; } - case 260 /* SyntaxKind.EnumDeclaration */: - case 269 /* SyntaxKind.NamedImports */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 272 /* SyntaxKind.NamedImports */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return 7 /* SemanticMeaning.All */; // An external module can be a Value - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } return 7 /* SemanticMeaning.All */; @@ -127999,7 +129392,7 @@ var ts; function getMeaningFromLocation(node) { node = getAdjustedReferenceLocation(node); var parent = node.parent; - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return 1 /* SemanticMeaning.Value */; } else if (ts.isExportAssignment(parent) @@ -128042,11 +129435,11 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - var name = node.kind === 161 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; - return name && name.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; + var name = node.kind === 163 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; + return name && name.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; } function isInRightSideOfInternalImportEqualsDeclaration(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -128058,27 +129451,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { - while (root.parent && root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { + while (root.parent && root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 178 /* SyntaxKind.TypeReference */ && !isLastClause; + return root.parent.kind === 180 /* SyntaxKind.TypeReference */ && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */) { + if (!isLastClause && root.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 257 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || - (decl.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); + return (decl.kind === 260 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || + (decl.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); } return false; } @@ -128089,15 +129482,15 @@ var ts; switch (node.kind) { case 108 /* SyntaxKind.ThisKeyword */: return !ts.isExpressionNode(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return true; } switch (node.parent.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return true; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return !node.parent.isTypeOf; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isPartOfTypeNode(node.parent); } return false; @@ -128164,7 +129557,7 @@ var ts; ts.climbPastPropertyOrElementAccess = climbPastPropertyOrElementAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 250 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { + if (referenceNode.kind === 253 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -128225,22 +129618,22 @@ var ts; ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { switch (node.parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.getNameOfDeclaration(node.parent) === node; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.parent.argumentExpression === node; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return true; - case 196 /* SyntaxKind.LiteralType */: - return node.parent.parent.kind === 194 /* SyntaxKind.IndexedAccessType */; + case 198 /* SyntaxKind.LiteralType */: + return node.parent.parent.kind === 196 /* SyntaxKind.IndexedAccessType */; default: return false; } @@ -128264,17 +129657,17 @@ var ts; return undefined; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node; } } @@ -128282,56 +129675,56 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node) ? "module" /* ScriptElementKind.moduleElement */ : "script" /* ScriptElementKind.scriptElement */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return "module" /* ScriptElementKind.moduleElement */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return "class" /* ScriptElementKind.classElement */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return "type" /* ScriptElementKind.typeElement */; - case 260 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; - case 254 /* SyntaxKind.VariableDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; + case 257 /* SyntaxKind.VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return "function" /* ScriptElementKind.functionElement */; - case 172 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; - case 173 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; + case 175 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return "method" /* ScriptElementKind.memberFunctionElement */; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: var initializer = node.initializer; return ts.isFunctionLike(initializer) ? "method" /* ScriptElementKind.memberFunctionElement */ : "property" /* ScriptElementKind.memberVariableElement */; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return "property" /* ScriptElementKind.memberVariableElement */; - case 176 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; - case 175 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; - case 174 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; + case 177 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; + case 176 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return "constructor" /* ScriptElementKind.constructorImplementationElement */; - case 163 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; - case 299 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; - case 164 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: + case 165 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; + case 302 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; + case 166 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: return "alias" /* ScriptElementKind.alias */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var kind = ts.getAssignmentDeclarationKind(node); var right = node.right; switch (kind) { @@ -128360,7 +129753,7 @@ var ts; } case 79 /* SyntaxKind.Identifier */: return ts.isImportClause(node.parent) ? "alias" /* ScriptElementKind.alias */ : "" /* ScriptElementKind.unknown */; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: var scriptKind = getNodeKind(node.expression); // If the expression didn't come back with something (like it does for an identifiers) return scriptKind === "" /* ScriptElementKind.unknown */ ? "const" /* ScriptElementKind.constElement */ : scriptKind; @@ -128383,7 +129776,7 @@ var ts; return true; case 79 /* SyntaxKind.Identifier */: // 'this' as a parameter - return ts.identifierIsThisKeyword(node) && node.parent.kind === 164 /* SyntaxKind.Parameter */; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 166 /* SyntaxKind.Parameter */; default: return false; } @@ -128448,42 +129841,42 @@ var ts; return false; } switch (n.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 182 /* SyntaxKind.TypeLiteral */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 263 /* SyntaxKind.CaseBlock */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 184 /* SyntaxKind.TypeLiteral */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 266 /* SyntaxKind.CaseBlock */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return nodeEndsWith(n, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return isCompletedNode(n.block, sourceFile); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: if (!n.arguments) { return true; } // falls through - case 208 /* SyntaxKind.CallExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 191 /* SyntaxKind.ParenthesizedType */: + case 210 /* SyntaxKind.CallExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: return nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 216 /* SyntaxKind.ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -128493,65 +129886,65 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return !!n.body && isCompletedNode(n.body, sourceFile); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 26 /* SyntaxKind.SemicolonToken */, sourceFile); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 184 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 186 /* SyntaxKind.TupleType */: return nodeEndsWith(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; return hasChildOfKind(n, 115 /* SyntaxKind.WhileKeyword */, sourceFile) ? nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile) : isCompletedNode(n.statement, sourceFile); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 216 /* SyntaxKind.TypeOfExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 225 /* SyntaxKind.SpreadElement */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 227 /* SyntaxKind.SpreadElement */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.nodeIsPresent(n.moduleSpecifier); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -128666,6 +130059,8 @@ var ts; return lastTypeNode; } function getContextualTypeFromParentOrAncestorTypeNode(node, checker) { + if (node.flags & (8388608 /* NodeFlags.JSDoc */ & ~262144 /* NodeFlags.JavaScriptFile */)) + return undefined; var contextualType = getContextualTypeFromParent(node, checker); if (contextualType) return contextualType; @@ -128676,13 +130071,13 @@ var ts; function getAdjustedLocationForDeclaration(node, forRename) { if (!forRename) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return getAdjustedLocationForClass(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return getAdjustedLocationForFunction(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return node; } } @@ -128777,11 +130172,11 @@ var ts; node.kind === 98 /* SyntaxKind.FunctionKeyword */ ? ts.isFunctionDeclaration(parent) || ts.isFunctionExpression(node) : node.kind === 118 /* SyntaxKind.InterfaceKeyword */ ? ts.isInterfaceDeclaration(parent) : node.kind === 92 /* SyntaxKind.EnumKeyword */ ? ts.isEnumDeclaration(parent) : - node.kind === 152 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : - node.kind === 142 /* SyntaxKind.NamespaceKeyword */ || node.kind === 141 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : + node.kind === 154 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : + node.kind === 143 /* SyntaxKind.NamespaceKeyword */ || node.kind === 142 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : node.kind === 100 /* SyntaxKind.ImportKeyword */ ? ts.isImportEqualsDeclaration(parent) : - node.kind === 136 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : - node.kind === 149 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { + node.kind === 137 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : + node.kind === 151 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { var location = getAdjustedLocationForDeclaration(parent, forRename); if (location) { return location; @@ -128795,7 +130190,7 @@ var ts; return decl.name; } } - if (node.kind === 152 /* SyntaxKind.TypeKeyword */) { + if (node.kind === 154 /* SyntaxKind.TypeKeyword */) { // import /**/type [|name|] from ...; // import /**/type { [|name|] } from ...; // import /**/type { propertyName as [|name|] } from ...; @@ -128821,7 +130216,7 @@ var ts; // import * /**/as [|name|] ... // export { propertyName /**/as [|name|] } ... // export * /**/as [|name|] ... - if (node.kind === 127 /* SyntaxKind.AsKeyword */) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */) { if (ts.isImportSpecifier(parent) && parent.propertyName || ts.isExportSpecifier(parent) && parent.propertyName || ts.isNamespaceImport(parent) || @@ -128862,12 +130257,12 @@ var ts; } } // import name = /**/require("[|module|]"); - if (node.kind === 146 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { + if (node.kind === 147 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { return parent.expression; } // import ... /**/from "[|module|]"; // export ... /**/from "[|module|]"; - if (node.kind === 156 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { + if (node.kind === 158 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { return parent.moduleSpecifier; } // class ... /**/extends [|name|] ... @@ -128892,7 +130287,7 @@ var ts; } } // ... T extends /**/infer [|U|] ? ... - if (node.kind === 137 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { + if (node.kind === 138 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { return parent.typeParameter.name; } // { [ [|K|] /**/in keyof T]: ... } @@ -128900,12 +130295,12 @@ var ts; return parent.name; } // /**/keyof [|T|] - if (node.kind === 140 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 140 /* SyntaxKind.KeyOfKeyword */ && + if (node.kind === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // /**/readonly [|name|][] - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */ && + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isArrayTypeNode(parent.type) && ts.isTypeReferenceNode(parent.type.elementType)) { return parent.type.elementType.typeName; } @@ -128923,7 +130318,7 @@ var ts; if (node.kind === 103 /* SyntaxKind.NewKeyword */ && ts.isNewExpression(parent) || node.kind === 114 /* SyntaxKind.VoidKeyword */ && ts.isVoidExpression(parent) || node.kind === 112 /* SyntaxKind.TypeOfKeyword */ && ts.isTypeOfExpression(parent) || - node.kind === 132 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || + node.kind === 133 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || node.kind === 125 /* SyntaxKind.YieldKeyword */ && ts.isYieldExpression(parent) || node.kind === 89 /* SyntaxKind.DeleteKeyword */ && ts.isDeleteExpression(parent)) { if (parent.expression) { @@ -128936,13 +130331,13 @@ var ts; return ts.skipOuterExpressions(parent.right); } // left /**/as [|name|] - if (node.kind === 127 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // for (... /**/in [|name|]) // for (... /**/of [|name|]) if (node.kind === 101 /* SyntaxKind.InKeyword */ && ts.isForInStatement(parent) || - node.kind === 160 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { + node.kind === 162 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { return ts.skipOuterExpressions(parent.expression); } } @@ -129174,7 +130569,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 305 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 308 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -129205,7 +130600,7 @@ var ts; for (var i = exclusiveStartPosition - 1; i >= 0; i--) { var child = children[i]; if (isWhiteSpaceOnlyJsxText(child)) { - if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { ts.Debug.fail("`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`"); } } @@ -129249,17 +130644,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
|
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return true; } return false; @@ -129290,7 +130685,7 @@ var ts; function isInsideJsxElement(sourceFile, position) { function isInsideJsxElementTraversal(node) { while (node) { - if (node.kind >= 279 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 288 /* SyntaxKind.JsxExpression */ + if (node.kind >= 282 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 291 /* SyntaxKind.JsxExpression */ || node.kind === 11 /* SyntaxKind.JsxText */ || node.kind === 29 /* SyntaxKind.LessThanToken */ || node.kind === 31 /* SyntaxKind.GreaterThanToken */ @@ -129300,7 +130695,7 @@ var ts; || node.kind === 43 /* SyntaxKind.SlashToken */) { node = node.parent; } - else if (node.kind === 278 /* SyntaxKind.JsxElement */) { + else if (node.kind === 281 /* SyntaxKind.JsxElement */) { if (position > node.getStart(sourceFile)) return true; node = node.parent; @@ -129448,7 +130843,7 @@ var ts; // falls through case 112 /* SyntaxKind.TypeOfKeyword */: case 94 /* SyntaxKind.ExtendsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: case 24 /* SyntaxKind.DotToken */: case 51 /* SyntaxKind.BarToken */: case 57 /* SyntaxKind.QuestionToken */: @@ -129469,7 +130864,7 @@ var ts; /** * Returns true if the cursor at position in sourceFile is within a comment. * - * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position) + * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position)` * @param predicate Additional predicate to test on the comment range. */ function isInComment(sourceFile, position, tokenAtPosition) { @@ -129500,7 +130895,7 @@ var ts; result.push("public" /* ScriptElementKindModifier.publicMemberModifier */); if (flags & 32 /* ModifierFlags.Static */ || ts.isClassStaticBlockDeclaration(node)) result.push("static" /* ScriptElementKindModifier.staticModifier */); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push("abstract" /* ScriptElementKindModifier.abstractModifier */); if (flags & 1 /* ModifierFlags.Export */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); @@ -129508,16 +130903,16 @@ var ts; result.push("deprecated" /* ScriptElementKindModifier.deprecatedModifier */); if (node.flags & 16777216 /* NodeFlags.Ambient */) result.push("declare" /* ScriptElementKindModifier.ambientModifier */); - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); return result.length > 0 ? result.join(",") : "" /* ScriptElementKindModifier.none */; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 210 /* SyntaxKind.CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return node.typeParameters; } return undefined; @@ -129562,18 +130957,18 @@ var ts; } ts.cloneCompilerOptions = cloneCompilerOptions; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || - node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || + node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + if (node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return true; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -129581,7 +130976,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -129643,32 +131038,32 @@ var ts; } ts.createTextChange = createTextChange; ts.typeKeywords = [ - 130 /* SyntaxKind.AnyKeyword */, - 128 /* SyntaxKind.AssertsKeyword */, - 158 /* SyntaxKind.BigIntKeyword */, - 133 /* SyntaxKind.BooleanKeyword */, + 131 /* SyntaxKind.AnyKeyword */, + 129 /* SyntaxKind.AssertsKeyword */, + 160 /* SyntaxKind.BigIntKeyword */, + 134 /* SyntaxKind.BooleanKeyword */, 95 /* SyntaxKind.FalseKeyword */, - 137 /* SyntaxKind.InferKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 143 /* SyntaxKind.NeverKeyword */, + 138 /* SyntaxKind.InferKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 144 /* SyntaxKind.NeverKeyword */, 104 /* SyntaxKind.NullKeyword */, - 147 /* SyntaxKind.NumberKeyword */, - 148 /* SyntaxKind.ObjectKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 150 /* SyntaxKind.StringKeyword */, - 151 /* SyntaxKind.SymbolKeyword */, + 148 /* SyntaxKind.NumberKeyword */, + 149 /* SyntaxKind.ObjectKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 152 /* SyntaxKind.StringKeyword */, + 153 /* SyntaxKind.SymbolKeyword */, 110 /* SyntaxKind.TrueKeyword */, 114 /* SyntaxKind.VoidKeyword */, - 153 /* SyntaxKind.UndefinedKeyword */, - 154 /* SyntaxKind.UniqueKeyword */, - 155 /* SyntaxKind.UnknownKeyword */, + 155 /* SyntaxKind.UndefinedKeyword */, + 156 /* SyntaxKind.UniqueKeyword */, + 157 /* SyntaxKind.UnknownKeyword */, ]; function isTypeKeyword(kind) { return ts.contains(ts.typeKeywords, kind); } ts.isTypeKeyword = isTypeKeyword; function isTypeKeywordToken(node) { - return node.kind === 152 /* SyntaxKind.TypeKeyword */; + return node.kind === 154 /* SyntaxKind.TypeKeyword */; } ts.isTypeKeywordToken = isTypeKeywordToken; function isTypeKeywordTokenOrIdentifier(node) { @@ -129705,7 +131100,7 @@ var ts; } ts.skipConstraint = skipConstraint; function getNameFromPropertyName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ // treat computed property names where expression is string/numeric literal as just string/numeric literal ? ts.isStringOrNumericLiteralLike(name.expression) ? name.expression.text : undefined : ts.isPrivateIdentifier(name) ? ts.idText(name) : ts.getTextOfIdentifierOrLiteral(name); @@ -129855,7 +131250,7 @@ var ts; ts.findModifier = findModifier; function insertImports(changes, sourceFile, imports, blankLineBetween) { var decl = ts.isArray(imports) ? imports[0] : imports; - var importKindPredicate = decl.kind === 237 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; + var importKindPredicate = decl.kind === 240 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; var existingImportStatements = ts.filter(sourceFile.statements, importKindPredicate); var sortedNewImports = ts.isArray(imports) ? ts.stableSort(imports, ts.OrganizeImports.compareImportsOrRequireStatements) : [imports]; if (!existingImportStatements.length) { @@ -130529,15 +131924,15 @@ var ts; function getContextualTypeFromParent(node, checker) { var parent = node.parent; switch (parent.kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checker.getContextualType(parent); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var _a = parent, left = _a.left, operatorToken = _a.operatorToken, right = _a.right; return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node); } - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return parent.expression === node ? getSwitchedType(parent, checker) : undefined; default: return checker.getContextualType(node); @@ -130567,8 +131962,8 @@ var ts; switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return true; default: return false; @@ -130602,38 +131997,38 @@ var ts; } ts.getTypeNodeIfAccessible = getTypeNodeIfAccessible; function syntaxRequiresTrailingCommaOrSemicolonOrASI(kind) { - return kind === 174 /* SyntaxKind.CallSignature */ - || kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */; + return kind === 176 /* SyntaxKind.CallSignature */ + || kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */; } function syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind) { - return kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 264 /* SyntaxKind.ModuleDeclaration */; } function syntaxRequiresTrailingSemicolonOrASI(kind) { - return kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.syntaxRequiresTrailingSemicolonOrASI = syntaxRequiresTrailingSemicolonOrASI; ts.syntaxMayBeASICandidate = ts.or(syntaxRequiresTrailingCommaOrSemicolonOrASI, syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI, syntaxRequiresTrailingModuleBlockOrSemicolonOrASI, syntaxRequiresTrailingSemicolonOrASI); @@ -130663,7 +132058,7 @@ var ts; return false; } // See comment in parser’s `parseDoStatement` - if (node.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.kind === 243 /* SyntaxKind.DoStatement */) { return true; } var topNode = ts.findAncestor(node, function (ancestor) { return !ancestor.parent; }); @@ -131152,6 +132547,10 @@ var ts; return jsx === 2 /* JsxEmit.React */ || jsx === 3 /* JsxEmit.ReactNative */; } ts.jsxModeNeedsExplicitImport = jsxModeNeedsExplicitImport; + function isSourceFileFromLibrary(program, node) { + return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node); + } + ts.isSourceFileFromLibrary = isSourceFileFromLibrary; // #endregion })(ts || (ts = {})); /*@internal*/ @@ -131267,14 +132666,16 @@ var ts; search: function (importingFile, preferCapitalized, matches, action) { if (importingFile !== usableByFileName) return; - exportInfo.forEach(function (info, key) { + return ts.forEachEntry(exportInfo, function (info, key) { var _a = parseKey(key), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName; var name = preferCapitalized && info[0].capitalizedSymbolName || symbolName; if (matches(name, info[0].targetFlags)) { var rehydrated = info.map(rehydrateCachedInfo); var filtered = rehydrated.filter(function (r, i) { return isNotShadowedByDeeperNodeModulesPackage(r, info[i].packageName); }); if (filtered.length) { - action(filtered, name, !!ambientModuleName, key); + var res = action(filtered, name, !!ambientModuleName, key); + if (res !== undefined) + return res; } } }); @@ -131662,11 +133063,11 @@ var ts; angleBracketStack--; } break; - case 130 /* SyntaxKind.AnyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, @@ -131855,10 +133256,11 @@ var ts; return true; } switch (keyword2) { - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: return true; // Allow things like "public get", "public constructor" and "public static". default: return false; // Any other keyword following "public" is actually an identifier, not a real keyword. @@ -131905,7 +133307,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: case 34 /* SyntaxKind.EqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: @@ -132001,13 +133404,13 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -132229,46 +133632,46 @@ var ts; pos = tag.tagName.end; var commentStart = tag.tagName.end; switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var param = tag; processJSDocParameterTag(param); commentStart = param.isNameFirst && ((_a = param.typeExpression) === null || _a === void 0 ? void 0 : _a.end) || param.name.end; break; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var prop = tag; commentStart = prop.isNameFirst && ((_b = prop.typeExpression) === null || _b === void 0 ? void 0 : _b.end) || prop.name.end; break; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: processJSDocTemplateTag(tag); pos = tag.end; commentStart = tag.typeParameters.end; break; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: var type = tag; - commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 309 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; + commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 312 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; break; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: commentStart = tag.typeExpression.end; break; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = tag.typeExpression.end; break; - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: commentStart = tag.typeExpression.end; break; - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = ((_f = tag.typeExpression) === null || _f === void 0 ? void 0 : _f.end) || commentStart; break; - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: commentStart = ((_g = tag.name) === null || _g === void 0 ? void 0 : _g.end) || commentStart; break; - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: commentStart = tag.class.end; break; } @@ -132315,7 +133718,7 @@ var ts; // defined in `ts.commentPragmas` would be excessive, but we can avoid // some obvious false positives (e.g. in XML-like doc comments) by // checking the element name. - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!match[3] || !(match[3] in ts.commentPragmas)) { return false; } @@ -132425,22 +133828,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* ClassificationType.jsxOpenTagName */; } break; - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* ClassificationType.jsxCloseTagName */; } break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* ClassificationType.jsxSelfClosingTagName */; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: if (token.parent.name === token) { return 22 /* ClassificationType.jsxAttribute */; } @@ -132469,17 +133872,17 @@ var ts; var parent = token.parent; if (tokenKind === 63 /* SyntaxKind.EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 164 /* SyntaxKind.Parameter */ || - parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 166 /* SyntaxKind.Parameter */ || + parent.kind === 288 /* SyntaxKind.JsxAttribute */) { return 5 /* ClassificationType.operator */; } } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ || - parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || - parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */ || - parent.kind === 222 /* SyntaxKind.ConditionalExpression */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ || + parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || + parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */ || + parent.kind === 224 /* SyntaxKind.ConditionalExpression */) { return 5 /* ClassificationType.operator */; } } @@ -132492,7 +133895,7 @@ var ts; return 25 /* ClassificationType.bigintLiteral */; } else if (tokenKind === 10 /* SyntaxKind.StringLiteral */) { - return token && token.parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; + return token && token.parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; } else if (tokenKind === 13 /* SyntaxKind.RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -132508,32 +133911,32 @@ var ts; else if (tokenKind === 79 /* SyntaxKind.Identifier */) { if (token) { switch (token.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (token.parent.name === token) { return 11 /* ClassificationType.className */; } return; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: if (token.parent.name === token) { return 15 /* ClassificationType.typeParameterName */; } return; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* ClassificationType.interfaceName */; } return; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (token.parent.name === token) { return 12 /* ClassificationType.enumName */; } return; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (token.parent.name === token) { return 14 /* ClassificationType.moduleName */; } return; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (token.parent.name === token) { return ts.isThisIdentifier(token) ? 3 /* ClassificationType.keyword */ : 17 /* ClassificationType.parameterName */; } @@ -132638,13 +134041,13 @@ var ts; var inJSXElement = false; function visit(node) { switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!node || !ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) { @@ -132684,7 +134087,7 @@ var ts; if (modifiers & 32 /* ModifierFlags.Static */) { modifierSet |= 1 << 1 /* TokenModifier.static */; } - if (modifiers & 256 /* ModifierFlags.Async */) { + if (modifiers & 512 /* ModifierFlags.Async */) { modifierSet |= 1 << 2 /* TokenModifier.async */; } if (typeIdx !== 0 /* TokenType.class */ && typeIdx !== 2 /* TokenType.interface */) { @@ -132790,25 +134193,25 @@ var ts; return (ts.isQualifiedName(node.parent) && node.parent.right === node) || (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node); } var tokenFromDeclarationMapping = new ts.Map([ - [254 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], - [164 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], - [167 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], - [261 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], - [260 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], - [299 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], - [257 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], - [169 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], - [256 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], - [213 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], - [168 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], - [172 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], - [173 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], - [166 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], - [258 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], - [259 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], - [163 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], - [296 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], - [297 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] + [257 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], + [166 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], + [169 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], + [264 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], + [263 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], + [302 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], + [260 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], + [171 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], + [259 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], + [215 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], + [170 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], + [174 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], + [175 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], + [168 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], + [261 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], + [262 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], + [165 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], + [299 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], + [300 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] ]); })(v2020 = classifier.v2020 || (classifier.v2020 = {})); })(classifier = ts.classifier || (ts.classifier = {})); @@ -132942,18 +134345,18 @@ var ts; function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host, preferences) { var parent = walkUpParentheses(node.parent); switch (parent.kind) { - case 196 /* SyntaxKind.LiteralType */: { + case 198 /* SyntaxKind.LiteralType */: { var grandParent_1 = walkUpParentheses(parent.parent); switch (grandParent_1.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: { var typeArgument = ts.findAncestor(parent, function (n) { return n.parent === grandParent_1; }); if (typeArgument) { return { kind: 2 /* StringLiteralCompletionKind.Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false }; } return undefined; } - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: // Get all apparent property names // i.e. interface Foo { // foo: string; @@ -132965,9 +134368,9 @@ var ts; return undefined; } return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType)); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return { kind: 0 /* StringLiteralCompletionKind.Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; - case 187 /* SyntaxKind.UnionType */: { + case 189 /* SyntaxKind.UnionType */: { if (!ts.isTypeReferenceNode(grandParent_1.parent)) { return undefined; } @@ -132979,7 +134382,7 @@ var ts; return undefined; } } - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isObjectLiteralExpression(parent.parent) && parent.name === node) { // Get quoted name of properties of the object literal expression // i.e. interface ConfigFiles { @@ -132996,7 +134399,7 @@ var ts; return stringLiteralCompletionsForObjectLiteral(typeChecker, parent.parent); } return fromContextualType(); - case 207 /* SyntaxKind.ElementAccessExpression */: { + case 209 /* SyntaxKind.ElementAccessExpression */: { var _b = parent, expression = _b.expression, argumentExpression = _b.argumentExpression; if (node === ts.skipParentheses(argumentExpression)) { // Get all names of properties on the expression @@ -133009,20 +134412,20 @@ var ts; } return undefined; } - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 285 /* SyntaxKind.JsxAttribute */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 288 /* SyntaxKind.JsxAttribute */: if (!isRequireCallArgument(node) && !ts.isImportCall(parent)) { - var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); + var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); // Get string literal completions from specialized signatures of the target // i.e. declare function f(a: 'A'); // f("/*completion position*/") - return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) : fromContextualType(); + return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(); } // falls through (is `require("")` or `require(""` or `import("")`) - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 277 /* SyntaxKind.ExternalModuleReference */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 280 /* SyntaxKind.ExternalModuleReference */: // Get all known external module names or complete a path to a module // i.e. import * as ns from "/*completion position*/"; // var y = import("/*completion position*/"); @@ -133041,9 +134444,9 @@ var ts; } function walkUpParentheses(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return ts.walkUpParenthesizedTypes(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return ts.walkUpParenthesizedExpressions(node); default: return node; @@ -133073,7 +134476,7 @@ var ts; isNewIdentifier = isNewIdentifier || !!(type.flags & 4 /* TypeFlags.String */); return getStringLiteralTypes(type, uniques); }); - return { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier }; + return ts.length(types) ? { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier } : undefined; } function stringLiteralCompletionsFromProperties(type) { return type && { @@ -133591,7 +134994,7 @@ var ts; if (!dependencies) continue; for (var dep in dependencies) { - if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { + if (ts.hasProperty(dependencies, dep) && !ts.startsWith(dep, "@types/")) { result.push(dep); } } @@ -133966,7 +135369,7 @@ var ts; } function keywordFiltersFromSyntaxKind(keywordCompletion) { switch (keywordCompletion) { - case 152 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; + case 154 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; default: ts.Debug.fail("Unknown mapping from SyntaxKind to KeywordCompletionFilters"); } } @@ -133975,7 +135378,7 @@ var ts; return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* SyntaxKind.Identifier */ ? ts.createTextSpanFromNode(location) : undefined; } function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) { - var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importCompletionNode = completionData.importCompletionNode, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; + var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importStatementCompletion = completionData.importStatementCompletion, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; // Verify if the file is JSX language variant if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* LanguageVariant.JSX */) { var completionInfo = getJsxClosingTagCompletion(location, sourceFile); @@ -133989,7 +135392,7 @@ var ts; return undefined; } var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, - /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); + /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); if (keywordFilters !== 0 /* KeywordCompletionFilters.None */) { for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) { var keywordEntry = _a[_i]; @@ -134042,12 +135445,12 @@ var ts; // We wanna walk up the tree till we find a JSX closing element var jsxClosingElement = ts.findAncestor(location, function (node) { switch (node.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: return true; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return false; default: return "quit"; @@ -134107,7 +135510,7 @@ var ts; function createCompletionEntryForLiteral(sourceFile, preferences, literal) { return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* ScriptElementKind.string */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.LocationPriority }; } - function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { + function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { var _a, _b; var insertText; var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken); @@ -134163,8 +135566,8 @@ var ts; } if (originIsResolvedExport(origin)) { sourceDisplay = [ts.textPart(origin.moduleSpecifier)]; - if (importCompletionNode) { - (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); + if (importStatementCompletion) { + (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined; } } @@ -134174,7 +135577,7 @@ var ts; if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* CompletionKind.MemberLike */ && - isClassLikeMemberCompletion(symbol, location)) { + isClassLikeMemberCompletion(symbol, location, sourceFile)) { var importAdder = void 0; (_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder, replacementSpan = _b.replacementSpan); sortText = Completions.SortText.ClassMemberSnippets; // sortText has to be lower priority than the sortText for keywords. See #47852. @@ -134219,7 +135622,7 @@ var ts; } if (originIsExport(origin) || originIsResolvedExport(origin)) { data = originToCompletionEntryData(origin); - hasAction = !importCompletionNode; + hasAction = !importStatementCompletion; } // TODO(drosen): Right now we just permit *all* semantic meanings when calling // 'getSymbolKind' which is permissible given that it is backwards compatible; but @@ -134242,11 +135645,11 @@ var ts; labelDetails: labelDetails, isSnippet: isSnippet, isPackageJsonImport: originIsPackageJsonImport(origin) || undefined, - isImportStatementCompletion: !!importCompletionNode || undefined, + isImportStatementCompletion: !!importStatementCompletion || undefined, data: data, }; } - function isClassLikeMemberCompletion(symbol, location) { + function isClassLikeMemberCompletion(symbol, location, sourceFile) { // TODO: support JS files. if (ts.isInJSFile(location)) { return false; @@ -134280,6 +135683,7 @@ var ts; location.parent.parent && ts.isClassElement(location.parent) && location === location.parent.name && + location.parent.getLastToken(sourceFile) === location.parent.name && ts.isClassLike(location.parent.parent)) || (location.parent && ts.isSyntaxList(location) && @@ -134321,7 +135725,7 @@ var ts; // Whether the suggested member should be abstract. // e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`. var _a = getPresentModifiers(contextToken), presentModifiers = _a.modifiers, modifiersSpan = _a.span; - var isAbstract = !!(presentModifiers & 128 /* ModifierFlags.Abstract */); + var isAbstract = !!(presentModifiers & 256 /* ModifierFlags.Abstract */); var completionNodes = []; ts.codefix.addNewNodeForMemberSymbol(symbol, classLikeDeclaration, sourceFile, { program: program, host: host }, preferences, importAdder, // `addNewNodeForMemberSymbol` calls this callback function for each new member node @@ -134334,7 +135738,7 @@ var ts; function (node) { var requiredModifiers = 0 /* ModifierFlags.None */; if (isAbstract) { - requiredModifiers |= 128 /* ModifierFlags.Abstract */; + requiredModifiers |= 256 /* ModifierFlags.Abstract */; } if (ts.isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* MemberOverrideStatus.NeedsOverride */) { @@ -134395,7 +135799,7 @@ var ts; span = ts.createTextSpanFromNode(contextToken); } if (ts.isPropertyDeclaration(contextToken.parent)) { - modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 125951 /* ModifierFlags.Modifier */; + modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 126975 /* ModifierFlags.Modifier */; span = ts.createTextSpanFromNode(contextToken.parent); } return { modifiers: modifiers, span: span }; @@ -134444,7 +135848,6 @@ var ts; var labelDetails = { detail: signaturePrinter.printNode(4 /* EmitHint.Unspecified */, methodSignature, sourceFile) }; return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails }; } - ; function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) { var declarations = symbol.getDeclarations(); if (!(declarations && declarations.length)) { @@ -134457,10 +135860,10 @@ var ts; var quotePreference = ts.getQuotePreference(sourceFile, preferences); var builderFlags = 33554432 /* NodeBuilderFlags.OmitThisParameter */ | (quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : 0 /* NodeBuilderFlags.None */); switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: { var effectiveType = type.flags & 1048576 /* TypeFlags.Union */ && type.types.length < 10 ? checker.getUnionType(type.types, 2 /* UnionReduction.Subtype */) : type; @@ -134494,7 +135897,8 @@ var ts; } var parameters = typeNode.parameters.map(function (typedParam) { return ts.factory.createParameterDeclaration( - /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, typedParam.questionToken, + /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, + /*questionToken*/ undefined, /*type*/ undefined, typedParam.initializer); }); return ts.factory.createMethodDeclaration( @@ -134614,20 +136018,17 @@ var ts; }; return unresolvedOrigin; } - function getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences) { - var _a, _b, _c; - var sourceFile = importCompletionNode.getSourceFile(); - var replacementSpan = ts.createTextSpanFromNode(ts.findAncestor(importCompletionNode, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)) || importCompletionNode, sourceFile); + function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) { + var replacementSpan = importStatementCompletion.replacementSpan; var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier); var exportKind = origin.isDefaultExport ? 1 /* ExportKind.Default */ : origin.exportName === "export=" /* InternalSymbolName.ExportEquals */ ? 2 /* ExportKind.ExportEquals */ : 0 /* ExportKind.Named */; var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : ""; var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options, /*forceImportKeyword*/ true); - var isTopLevelTypeOnly = ((_b = (_a = ts.tryCast(importCompletionNode, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || ((_c = ts.tryCast(importCompletionNode, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly); - var isImportSpecifierTypeOnly = couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); - var topLevelTypeOnlyText = isTopLevelTypeOnly ? " ".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : " "; - var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : ""; + var isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier; + var topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " "; + var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : ""; var suffix = useSemicolons ? ";" : ""; switch (importKind) { case 3 /* ImportKind.CommonJS */: return { replacementSpan: replacementSpan, insertText: "import".concat(topLevelTypeOnlyText).concat(ts.escapeSnippetText(name)).concat(tabStop, " = require(").concat(quotedModuleSpecifier, ")").concat(suffix) }; @@ -134660,7 +136061,7 @@ var ts; return CompletionSource.TypeOnlyAlias; } } - function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { + function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { var _a; var start = ts.timestamp(); var variableDeclaration = getVariableDeclaration(location); @@ -134681,7 +136082,7 @@ var ts; var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess; var originalSortText = (_a = symbolToSortTextMap === null || symbolToSortTextMap === void 0 ? void 0 : symbolToSortTextMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : Completions.SortText.LocationPriority; var sortText = (isDeprecated(symbol, typeChecker) ? Completions.SortText.Deprecated(originalSortText) : originalSortText); - var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); + var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); if (!entry) { continue; } @@ -134841,7 +136242,7 @@ var ts; } case "symbol": { var symbol = symbolCompletion.symbol, location = symbolCompletion.location, contextToken_2 = symbolCompletion.contextToken, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken; - var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; + var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); // TODO: GH#18217 } case "literal": { @@ -134870,9 +136271,9 @@ var ts; return { name: name, kindModifiers: kindModifiers, kind: kind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source, sourceDisplay: source }; } Completions.createCompletionDetails = createCompletionDetails; - function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) { + function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) { if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) { - if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementNode) { + if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) { // Import statement completion: 'import c|' return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] }; } @@ -134902,7 +136303,7 @@ var ts; var moduleSymbol = origin.moduleSymbol; var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker)); var isJsxOpeningTagName = (contextToken === null || contextToken === void 0 ? void 0 : contextToken.kind) === 29 /* SyntaxKind.LessThanToken */ && ts.isJsxOpeningLikeElement(contextToken.parent); - var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; + var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences, cancellationToken), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier); return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] }; } @@ -134945,11 +136346,11 @@ var ts; return ts.getContextualTypeFromParent(previousToken, checker); case 63 /* SyntaxKind.EqualsToken */: switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.getContextualType(parent.initializer); // TODO: GH#18217 - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checker.getTypeAtLocation(parent.left); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return checker.getContextualTypeForJsxAttribute(parent); default: return undefined; @@ -134980,7 +136381,7 @@ var ts; } function isModuleSymbol(symbol) { var _a; - return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 305 /* SyntaxKind.SourceFile */; })); + return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 308 /* SyntaxKind.SourceFile */; })); } function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) { var typeChecker = program.getTypeChecker(); @@ -135037,7 +136438,7 @@ var ts; currentToken = ts.getTokenAtPosition(sourceFile, position); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 347 /* SyntaxKind.JSDocPropertyTag */ || + (currentToken.parent.kind !== 350 /* SyntaxKind.JSDocPropertyTag */ || currentToken.parent.name !== currentToken))) { // Use as type location if inside tag's type expression insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression); @@ -135073,34 +136474,34 @@ var ts; var isStartingCloseTag = false; var isJsxInitializer = false; var isJsxIdentifierExpected = false; - var importCompletionNode; + var importStatementCompletion; var location = ts.getTouchingPropertyName(sourceFile, position); var keywordFilters = 0 /* KeywordCompletionFilters.None */; var isNewIdentifierLocation = false; var flags = 0 /* CompletionInfoFlags.None */; if (contextToken) { - var importStatementCompletion = getImportStatementCompletionInfo(contextToken); - isNewIdentifierLocation = importStatementCompletion.isNewIdentifierLocation; - if (importStatementCompletion.keywordCompletion) { - if (importStatementCompletion.isKeywordOnlyCompletion) { + var importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken); + if (importStatementCompletionInfo.keywordCompletion) { + if (importStatementCompletionInfo.isKeywordOnlyCompletion) { return { kind: 4 /* CompletionDataKind.Keywords */, - keywordCompletions: [keywordToCompletionEntry(importStatementCompletion.keywordCompletion)], - isNewIdentifierLocation: isNewIdentifierLocation, + keywordCompletions: [keywordToCompletionEntry(importStatementCompletionInfo.keywordCompletion)], + isNewIdentifierLocation: importStatementCompletionInfo.isNewIdentifierLocation, }; } - keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletion.keywordCompletion); + keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletionInfo.keywordCompletion); } - if (importStatementCompletion.replacementNode && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { + if (importStatementCompletionInfo.replacementSpan && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { // Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier` // added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients // to opt in with the `includeCompletionsForImportStatements` user preference. - importCompletionNode = importStatementCompletion.replacementNode; flags |= 2 /* CompletionInfoFlags.IsImportStatementCompletion */; + importStatementCompletion = importStatementCompletionInfo; + isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation; } // Bail out if this is a known invalid completion location - if (!importCompletionNode && isCompletionListBlocker(contextToken)) { + if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) { log("Returning an empty list because completion was requested in an invalid position."); return keywordFilters ? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation()) @@ -135111,7 +136512,7 @@ var ts; isRightOfDot = contextToken.kind === 24 /* SyntaxKind.DotToken */; isRightOfQuestionDot = contextToken.kind === 28 /* SyntaxKind.QuestionDotToken */; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; var leftmostAccessExpression = ts.getLeftmostAccessExpression(propertyAccessToConvert); @@ -135127,16 +136528,16 @@ var ts; return undefined; } break; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: node = parent.left; break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: node = parent.name; break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: node = parent; break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: node = parent.getFirstToken(sourceFile); ts.Debug.assert(node.kind === 100 /* SyntaxKind.ImportKeyword */ || node.kind === 103 /* SyntaxKind.NewKeyword */); break; @@ -135146,11 +136547,11 @@ var ts; return undefined; } } - else if (!importCompletionNode && sourceFile.languageVariant === 1 /* LanguageVariant.JSX */) { + else if (!importStatementCompletion) { // // If the tagname is a property access expression, we will then walk up to the top most of property access expression. // Then, try to get a JSX container and its associated attributes type. - if (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { contextToken = parent; parent = parent.parent; } @@ -135158,46 +136559,46 @@ var ts; if (currentToken.parent === location) { switch (currentToken.kind) { case 31 /* SyntaxKind.GreaterThanToken */: - if (currentToken.parent.kind === 278 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (currentToken.parent.kind === 281 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { location = currentToken; } break; case 43 /* SyntaxKind.SlashToken */: - if (currentToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { + if (currentToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { location = currentToken; } break; } } switch (parent.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (contextToken.kind === 43 /* SyntaxKind.SlashToken */) { isStartingCloseTag = true; location = contextToken; } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (!binaryExpressionMayBeOpenTag(parent)) { break; } // falls through - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: isJsxIdentifierExpected = true; if (contextToken.kind === 29 /* SyntaxKind.LessThanToken */) { isRightOfOpenTag = true; location = contextToken; } break; - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: // For `
`, `parent` will be `{true}` and `previousToken` will be `}` if (previousToken.kind === 19 /* SyntaxKind.CloseBraceToken */ && currentToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { isJsxIdentifierExpected = true; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: // For `
`, `parent` will be JsxAttribute and `previousToken` will be its initializer if (parent.initializer === previousToken && previousToken.end < position) { @@ -135289,19 +136690,19 @@ var ts; isTypeOnlyLocation: isTypeOnlyLocation, isJsxIdentifierExpected: isJsxIdentifierExpected, isRightOfOpenTag: isRightOfOpenTag, - importCompletionNode: importCompletionNode, + importStatementCompletion: importStatementCompletion, hasUnresolvedAutoImports: hasUnresolvedAutoImports, flags: flags, }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return true; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return !!tag.constraint; default: return false; @@ -135310,7 +136711,7 @@ var ts; function tryGetTypeExpressionFromTag(tag) { if (isTagWithTypeExpression(tag)) { var typeExpression = ts.isJSDocTemplateTag(tag) ? tag.constraint : tag.typeExpression; - return typeExpression && typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; + return typeExpression && typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; } return undefined; } @@ -135353,7 +136754,7 @@ var ts; // If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods). if (!isTypeLocation && symbol.declarations && - symbol.declarations.some(function (d) { return d.kind !== 305 /* SyntaxKind.SourceFile */ && d.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 260 /* SyntaxKind.EnumDeclaration */; })) { + symbol.declarations.some(function (d) { return d.kind !== 308 /* SyntaxKind.SourceFile */ && d.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 263 /* SyntaxKind.EnumDeclaration */; })) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node).getNonOptionalType(); var insertQuestionDot = false; if (type.isNullableType()) { @@ -135399,7 +136800,7 @@ var ts; if (isRightOfQuestionDot && ts.some(type.getCallSignatures())) { isNewIdentifierLocation = true; } - var propertyAccess = node.kind === 200 /* SyntaxKind.ImportType */ ? node : node.parent; + var propertyAccess = node.kind === 202 /* SyntaxKind.ImportType */ ? node : node.parent; if (inCheckedFile) { for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { var symbol = _a[_i]; @@ -135543,7 +136944,7 @@ var ts; return 1 /* GlobalsSearch.Success */; } function tryGetImportCompletionSymbols() { - if (!importCompletionNode) + if (!importStatementCompletion) return 0 /* GlobalsSearch.Continue */; isNewIdentifierLocation = true; collectAutoImports(); @@ -135606,7 +137007,7 @@ var ts; } } // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions` - if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 305 /* SyntaxKind.SourceFile */) { + if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 308 /* SyntaxKind.SourceFile */) { var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false, ts.isClassLike(scopeNode.parent) ? scopeNode : undefined); if (thisType && !isProbablyGlobalType(thisType, sourceFile, typeChecker)) { for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) { @@ -135626,7 +137027,7 @@ var ts; } function shouldOfferImportCompletions() { // If already typing an import statement, provide completions for it. - if (importCompletionNode) + if (importStatementCompletion) return true; // If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols if (isNonContextualObjectLiteral) @@ -135645,10 +137046,10 @@ var ts; } function isSnippetScope(scopeNode) { switch (scopeNode.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 223 /* SyntaxKind.TemplateExpression */: - case 288 /* SyntaxKind.JsxExpression */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 225 /* SyntaxKind.TemplateExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 238 /* SyntaxKind.Block */: return true; default: return ts.isStatement(scopeNode); @@ -135656,7 +137057,7 @@ var ts; } function isTypeOnlyCompletion() { return insideJsDocTagTypeExpression - || !!importCompletionNode && ts.isTypeOnlyImportOrExportDeclaration(location.parent) + || !!importStatementCompletion && ts.isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || ts.isPartOfTypeNode(location) @@ -135665,28 +137066,30 @@ var ts; function isContextTokenValueLocation(contextToken) { return contextToken && ((contextToken.kind === 112 /* SyntaxKind.TypeOfKeyword */ && - (contextToken.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || - (contextToken.kind === 128 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 177 /* SyntaxKind.TypePredicate */)); + (contextToken.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || + (contextToken.kind === 129 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 179 /* SyntaxKind.TypePredicate */)); } function isContextTokenTypeLocation(contextToken) { if (contextToken) { var parentKind = contextToken.parent.kind; switch (contextToken.kind) { case 58 /* SyntaxKind.ColonToken */: - return parentKind === 167 /* SyntaxKind.PropertyDeclaration */ || - parentKind === 166 /* SyntaxKind.PropertySignature */ || - parentKind === 164 /* SyntaxKind.Parameter */ || - parentKind === 254 /* SyntaxKind.VariableDeclaration */ || + return parentKind === 169 /* SyntaxKind.PropertyDeclaration */ || + parentKind === 168 /* SyntaxKind.PropertySignature */ || + parentKind === 166 /* SyntaxKind.Parameter */ || + parentKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(parentKind); case 63 /* SyntaxKind.EqualsToken */: - return parentKind === 259 /* SyntaxKind.TypeAliasDeclaration */; - case 127 /* SyntaxKind.AsKeyword */: - return parentKind === 229 /* SyntaxKind.AsExpression */; + return parentKind === 262 /* SyntaxKind.TypeAliasDeclaration */; + case 128 /* SyntaxKind.AsKeyword */: + return parentKind === 231 /* SyntaxKind.AsExpression */; case 29 /* SyntaxKind.LessThanToken */: - return parentKind === 178 /* SyntaxKind.TypeReference */ || - parentKind === 211 /* SyntaxKind.TypeAssertionExpression */; + return parentKind === 180 /* SyntaxKind.TypeReference */ || + parentKind === 213 /* SyntaxKind.TypeAssertionExpression */; case 94 /* SyntaxKind.ExtendsKeyword */: - return parentKind === 163 /* SyntaxKind.TypeParameter */; + return parentKind === 165 /* SyntaxKind.TypeParameter */; + case 150 /* SyntaxKind.SatisfiesKeyword */: + return parentKind === 235 /* SyntaxKind.SatisfiesExpression */; } } return false; @@ -135704,8 +137107,7 @@ var ts; flags |= 1 /* CompletionInfoFlags.MayIncludeAutoImports */; // import { type | -> token text should be blank var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken - && importCompletionNode - && couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); + && importStatementCompletion; var lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" : previousToken && ts.isIdentifier(previousToken) ? previousToken.text.toLowerCase() : ""; @@ -135713,14 +137115,14 @@ var ts; var exportInfo = ts.getExportInfoMap(sourceFile, host, program, preferences, cancellationToken); var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host); var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host); - resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importCompletionNode, ts.isValidTypeOnlyAliasUseSite(location), function (context) { + resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importStatementCompletion, ts.isValidTypeOnlyAliasUseSite(location), function (context) { exportInfo.search(sourceFile.path, /*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) { if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings()))) return false; if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName)) return false; - if (!isTypeOnlyLocation && !importCompletionNode && !(targetFlags & 111551 /* SymbolFlags.Value */)) + if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & 111551 /* SymbolFlags.Value */)) return false; if (isTypeOnlyLocation && !(targetFlags & (1536 /* SymbolFlags.Module */ | 788968 /* SymbolFlags.Type */))) return false; @@ -135801,7 +137203,7 @@ var ts; return; } symbolToOriginInfoMap[symbols.length] = origin; - symbolToSortTextMap[symbolId] = importCompletionNode ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; + symbolToSortTextMap[symbolId] = importStatementCompletion ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; symbols.push(symbol); } /* Mutates `symbols` and `symbolToOriginInfoMap`. */ @@ -135877,18 +137279,18 @@ var ts; // - contextToken: GreaterThanToken (before cursor) // - location: JsxSelfClosingElement or JsxOpeningElement // - contextToken.parent === location - if (location === contextToken.parent && (location.kind === 280 /* SyntaxKind.JsxOpeningElement */ || location.kind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (location === contextToken.parent && (location.kind === 283 /* SyntaxKind.JsxOpeningElement */ || location.kind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { return false; } - if (contextToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (contextToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { //
/**/ // - contextToken: GreaterThanToken (before cursor) // - location: JSXElement // - different parents (JSXOpeningElement, JSXElement) - return location.parent.kind !== 280 /* SyntaxKind.JsxOpeningElement */; + return location.parent.kind !== 283 /* SyntaxKind.JsxOpeningElement */; } - if (contextToken.parent.kind === 281 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { - return !!contextToken.parent.parent && contextToken.parent.parent.kind === 278 /* SyntaxKind.JsxElement */; + if (contextToken.parent.kind === 284 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { + return !!contextToken.parent.parent && contextToken.parent.parent.kind === 281 /* SyntaxKind.JsxElement */; } } return false; @@ -135900,44 +137302,44 @@ var ts; // Previous token may have been a keyword that was converted to an identifier. switch (tokenKind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( a, | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a, | - || containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [a, | - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */ // const x = (a, | - || containingNodeKind === 179 /* SyntaxKind.FunctionType */ // var x: (s: string, list| - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( a, | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a, | + || containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [a, | + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */ // const x = (a, | + || containingNodeKind === 181 /* SyntaxKind.FunctionType */ // var x: (s: string, list| + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( | - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a| - || containingNodeKind === 212 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| - || containingNodeKind === 191 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( | + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a| + || containingNodeKind === 214 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 193 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [ | - || containingNodeKind === 176 /* SyntaxKind.IndexSignature */ // [ | : string ] - || containingNodeKind === 162 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ - case 141 /* SyntaxKind.ModuleKeyword */: // module | - case 142 /* SyntaxKind.NamespaceKeyword */: // namespace | + return containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [ | + || containingNodeKind === 178 /* SyntaxKind.IndexSignature */ // [ | : string ] + || containingNodeKind === 164 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ + case 142 /* SyntaxKind.ModuleKeyword */: // module | + case 143 /* SyntaxKind.NamespaceKeyword */: // namespace | case 100 /* SyntaxKind.ImportKeyword */: // import | return true; case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 261 /* SyntaxKind.ModuleDeclaration */; // module A.| + return containingNodeKind === 264 /* SyntaxKind.ModuleDeclaration */; // module A.| case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ // class A { | - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ // class A { | + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | case 63 /* SyntaxKind.EqualsToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ // const x = a| - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */; // x = a| + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ // const x = a| + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */; // x = a| case 15 /* SyntaxKind.TemplateHead */: - return containingNodeKind === 223 /* SyntaxKind.TemplateExpression */; // `aa ${| + return containingNodeKind === 225 /* SyntaxKind.TemplateExpression */; // `aa ${| case 16 /* SyntaxKind.TemplateMiddle */: - return containingNodeKind === 233 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| - case 131 /* SyntaxKind.AsyncKeyword */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() - || containingNodeKind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| + return containingNodeKind === 236 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| + case 132 /* SyntaxKind.AsyncKeyword */: + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() + || containingNodeKind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| case 41 /* SyntaxKind.AsteriskToken */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| } if (isClassMemberCompletionKeyword(tokenKind)) { return true; @@ -135987,7 +137389,7 @@ var ts; completionKind = 0 /* CompletionKind.ObjectPropertyDeclaration */; var typeMembers; var existingMembers; - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { var instantiatedType = tryGetObjectLiteralContextualType(objectLikeContainer, typeChecker); // Check completions for Object property value shorthand if (instantiatedType === undefined) { @@ -136012,7 +137414,7 @@ var ts; } } else { - ts.Debug.assert(objectLikeContainer.kind === 201 /* SyntaxKind.ObjectBindingPattern */); + ts.Debug.assert(objectLikeContainer.kind === 203 /* SyntaxKind.ObjectBindingPattern */); // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -136023,12 +137425,12 @@ var ts; // through type declaration or inference. // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed - // type of parameter will flow in from the contextual type of the function - var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */; - if (!canGetType && rootDeclaration.kind === 164 /* SyntaxKind.Parameter */) { + var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */; + if (!canGetType && rootDeclaration.kind === 166 /* SyntaxKind.Parameter */) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); } - else if (rootDeclaration.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (rootDeclaration.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 175 /* SyntaxKind.SetAccessor */) { canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -136047,7 +137449,7 @@ var ts; var filteredMembers = filterObjectMembersList(typeMembers, ts.Debug.checkDefined(existingMembers)); symbols = ts.concatenate(symbols, filteredMembers); setSortTextToOptionalMember(); - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && preferences.includeCompletionsWithObjectLiteralMethodSnippets && preferences.includeCompletionsWithInsertText) { transformObjectLiteralMembersSortText(symbolsStartIndex); @@ -136082,10 +137484,10 @@ var ts; keywordFilters = 8 /* KeywordCompletionFilters.TypeKeyword */; } // try to show exported member for imported/re-exported module - var moduleSpecifier = (namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; + var moduleSpecifier = (namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; if (!moduleSpecifier) { isNewIdentifierLocation = true; - return namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; + return namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; } var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); // TODO: GH#18217 if (!moduleSpecifierSymbol) { @@ -136230,11 +137632,11 @@ var ts; case 30 /* SyntaxKind.LessThanSlashToken */: case 43 /* SyntaxKind.SlashToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 286 /* SyntaxKind.JsxAttributes */: - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - if (parent && (parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 280 /* SyntaxKind.JsxOpeningElement */)) { + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 289 /* SyntaxKind.JsxAttributes */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + if (parent && (parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 283 /* SyntaxKind.JsxOpeningElement */)) { if (contextToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { var precedingToken = ts.findPrecedingToken(contextToken.pos, sourceFile, /*startNode*/ undefined); if (!parent.typeArguments || (precedingToken && precedingToken.kind === 43 /* SyntaxKind.SlashToken */)) @@ -136242,7 +137644,7 @@ var ts; } return parent; } - else if (parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + else if (parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136254,7 +137656,7 @@ var ts; // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 10 /* SyntaxKind.StringLiteral */: - if (parent && ((parent.kind === 285 /* SyntaxKind.JsxAttribute */) || (parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */))) { + if (parent && ((parent.kind === 288 /* SyntaxKind.JsxAttribute */) || (parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */))) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136264,8 +137666,8 @@ var ts; break; case 19 /* SyntaxKind.CloseBraceToken */: if (parent && - parent.kind === 288 /* SyntaxKind.JsxExpression */ && - parent.parent && parent.parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + parent.kind === 291 /* SyntaxKind.JsxExpression */ && + parent.parent && parent.parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136273,7 +137675,7 @@ var ts; // each JsxAttribute can have initializer as JsxExpression return parent.parent.parent.parent; } - if (parent && parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (parent && parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136293,54 +137695,54 @@ var ts; var containingNodeKind = parent.kind; switch (contextToken.kind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ || + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ || isVariableDeclarationListButNotTypeArgument(contextToken) || - containingNodeKind === 237 /* SyntaxKind.VariableStatement */ || - containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | + containingNodeKind === 240 /* SyntaxKind.VariableStatement */ || + containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | isFunctionLikeButNotConstructor(containingNodeKind) || - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A= contextToken.pos); case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [.| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [.| case 58 /* SyntaxKind.ColonToken */: - return containingNodeKind === 203 /* SyntaxKind.BindingElement */; // var {x :html| + return containingNodeKind === 205 /* SyntaxKind.BindingElement */; // var {x :html| case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [x| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [x| case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 292 /* SyntaxKind.CatchClause */ || + return containingNodeKind === 295 /* SyntaxKind.CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */; // enum a { | + return containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */; // enum a { | case 29 /* SyntaxKind.LessThanToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ || // class A< | - containingNodeKind === 226 /* SyntaxKind.ClassExpression */ || // var C = class D< | - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | - containingNodeKind === 259 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ || // class A< | + containingNodeKind === 228 /* SyntaxKind.ClassExpression */ || // var C = class D< | + containingNodeKind === 261 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | + containingNodeKind === 262 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | ts.isFunctionLikeKind(containingNodeKind); case 124 /* SyntaxKind.StaticKeyword */: - return containingNodeKind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); + return containingNodeKind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); case 25 /* SyntaxKind.DotDotDotToken */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ || - (!!parent.parent && parent.parent.kind === 202 /* SyntaxKind.ArrayBindingPattern */); // var [...z| + return containingNodeKind === 166 /* SyntaxKind.Parameter */ || + (!!parent.parent && parent.parent.kind === 204 /* SyntaxKind.ArrayBindingPattern */); // var [...z| case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); - case 127 /* SyntaxKind.AsKeyword */: - return containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ || - containingNodeKind === 275 /* SyntaxKind.ExportSpecifier */ || - containingNodeKind === 268 /* SyntaxKind.NamespaceImport */; - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + return containingNodeKind === 166 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); + case 128 /* SyntaxKind.AsKeyword */: + return containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ || + containingNodeKind === 278 /* SyntaxKind.ExportSpecifier */ || + containingNodeKind === 271 /* SyntaxKind.NamespaceImport */; + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: return !isFromObjectTypeDeclaration(contextToken); case 79 /* SyntaxKind.Identifier */: - if (containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ && + if (containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ && contextToken === parent.name && contextToken.text === "type") { // import { type | } @@ -136355,11 +137757,11 @@ var ts; case 100 /* SyntaxKind.ImportKeyword */: case 119 /* SyntaxKind.LetKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return true; - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: // import { type foo| } - return containingNodeKind !== 270 /* SyntaxKind.ImportSpecifier */; + return containingNodeKind !== 273 /* SyntaxKind.ImportSpecifier */; case 41 /* SyntaxKind.AsteriskToken */: return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent); } @@ -136384,7 +137786,7 @@ var ts; case 126 /* SyntaxKind.AbstractKeyword */: case 84 /* SyntaxKind.ClassKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 98 /* SyntaxKind.FunctionKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: @@ -136395,7 +137797,7 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: case 113 /* SyntaxKind.VarKeyword */: return true; - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return ts.isPropertyDeclaration(contextToken.parent); } // If we are inside a class declaration, and `constructor` is totally not present, @@ -136404,7 +137806,7 @@ var ts; if (ancestorClassLike && contextToken === previousToken && isPreviousPropertyDeclarationTerminated(contextToken, position)) { return false; // Don't block completions. } - var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 167 /* SyntaxKind.PropertyDeclaration */); + var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 169 /* SyntaxKind.PropertyDeclaration */); // If we are inside a class declaration and typing `constructor` after property declaration... if (ancestorPropertyDeclaraion && contextToken !== previousToken @@ -136436,7 +137838,7 @@ var ts; || !ts.positionsAreOnSameLine(contextToken.end, position, sourceFile)); } function isFunctionLikeButNotConstructor(kind) { - return ts.isFunctionLikeKind(kind) && kind !== 171 /* SyntaxKind.Constructor */; + return ts.isFunctionLikeKind(kind) && kind !== 173 /* SyntaxKind.Constructor */; } function isDotOfNumericLiteral(contextToken) { if (contextToken.kind === 8 /* SyntaxKind.NumericLiteral */) { @@ -136446,7 +137848,7 @@ var ts; return false; } function isVariableDeclarationListButNotTypeArgument(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && !ts.isPossiblyTypeArgumentPosition(node, sourceFile, typeChecker); } /** @@ -136464,13 +137866,13 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 296 /* SyntaxKind.PropertyAssignment */ && - m.kind !== 297 /* SyntaxKind.ShorthandPropertyAssignment */ && - m.kind !== 203 /* SyntaxKind.BindingElement */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */ && - m.kind !== 298 /* SyntaxKind.SpreadAssignment */) { + if (m.kind !== 299 /* SyntaxKind.PropertyAssignment */ && + m.kind !== 300 /* SyntaxKind.ShorthandPropertyAssignment */ && + m.kind !== 205 /* SyntaxKind.BindingElement */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */ && + m.kind !== 301 /* SyntaxKind.SpreadAssignment */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -136561,10 +137963,10 @@ var ts; for (var _i = 0, existingMembers_2 = existingMembers; _i < existingMembers_2.length; _i++) { var m = existingMembers_2[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (m.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -136606,7 +138008,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (attr.kind === 288 /* SyntaxKind.JsxAttribute */) { seenNames.add(attr.name.escapedText); } else if (ts.isJsxSpreadAttribute(attr)) { @@ -136704,7 +138106,7 @@ var ts; var _keywordCompletions = []; var allKeywordsCompletions = ts.memoize(function () { var res = []; - for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 160 /* SyntaxKind.LastKeyword */; i++) { + for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 162 /* SyntaxKind.LastKeyword */; i++) { res.push({ name: ts.tokenToString(i), kind: "keyword" /* ScriptElementKind.keyword */, @@ -136730,12 +138132,12 @@ var ts; return false; case 1 /* KeywordCompletionFilters.All */: return isFunctionLikeBodyKeyword(kind) - || kind === 135 /* SyntaxKind.DeclareKeyword */ - || kind === 141 /* SyntaxKind.ModuleKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ - || kind === 142 /* SyntaxKind.NamespaceKeyword */ + || kind === 136 /* SyntaxKind.DeclareKeyword */ + || kind === 142 /* SyntaxKind.ModuleKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ + || kind === 143 /* SyntaxKind.NamespaceKeyword */ || kind === 126 /* SyntaxKind.AbstractKeyword */ - || ts.isTypeKeyword(kind) && kind !== 153 /* SyntaxKind.UndefinedKeyword */; + || ts.isTypeKeyword(kind) && kind !== 155 /* SyntaxKind.UndefinedKeyword */; case 5 /* KeywordCompletionFilters.FunctionLikeBodyKeywords */: return isFunctionLikeBodyKeyword(kind); case 2 /* KeywordCompletionFilters.ClassElementKeywords */: @@ -136749,7 +138151,7 @@ var ts; case 7 /* KeywordCompletionFilters.TypeKeywords */: return ts.isTypeKeyword(kind); case 8 /* KeywordCompletionFilters.TypeKeyword */: - return kind === 152 /* SyntaxKind.TypeKeyword */; + return kind === 154 /* SyntaxKind.TypeKeyword */; default: return ts.Debug.assertNever(keywordFilter); } @@ -136758,59 +138160,61 @@ var ts; function isTypeScriptOnlyKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: case 117 /* SyntaxKind.ImplementsKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 139 /* SyntaxKind.IsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 140 /* SyntaxKind.IsKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return true; default: return false; } } function isInterfaceOrTypeLiteralCompletionKeyword(kind) { - return kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return kind === 146 /* SyntaxKind.ReadonlyKeyword */; } function isClassMemberCompletionKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; default: return ts.isClassMemberModifier(kind); } } function isFunctionLikeBodyKeyword(kind) { - return kind === 131 /* SyntaxKind.AsyncKeyword */ - || kind === 132 /* SyntaxKind.AwaitKeyword */ - || kind === 127 /* SyntaxKind.AsKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ + return kind === 132 /* SyntaxKind.AsyncKeyword */ + || kind === 133 /* SyntaxKind.AwaitKeyword */ + || kind === 128 /* SyntaxKind.AsKeyword */ + || kind === 150 /* SyntaxKind.SatisfiesKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); } function keywordForNode(node) { @@ -136835,7 +138239,7 @@ var ts; && contextToken === parent.moduleSpecifier && tokenLine === currentLine) { entries.push({ - name: ts.tokenToString(129 /* SyntaxKind.AssertKeyword */), + name: ts.tokenToString(130 /* SyntaxKind.AssertKeyword */), kind: "keyword" /* ScriptElementKind.keyword */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.GlobalsOrKeywords, @@ -136901,7 +138305,7 @@ var ts; function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) { // class c { method() { } | method2() { } } switch (location.kind) { - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.tryCast(location.parent, ts.isObjectTypeDeclaration); case 1 /* SyntaxKind.EndOfFileToken */: var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration); @@ -136927,7 +138331,7 @@ var ts; if (!contextToken) return undefined; // class C { blah; constructor/**/ } and so on - if (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ + if (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ // class C { blah \n constructor/**/ } || (ts.isIdentifier(contextToken) && ts.isPropertyDeclaration(contextToken.parent) && ts.isClassLike(location))) { return ts.findAncestor(contextToken, ts.isClassLike); @@ -136970,7 +138374,7 @@ var ts; case 26 /* SyntaxKind.SemicolonToken */: case 27 /* SyntaxKind.CommaToken */: case 79 /* SyntaxKind.Identifier */: - if (parent.kind === 166 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { + if (parent.kind === 168 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { return parent.parent; } break; @@ -136987,11 +138391,11 @@ var ts; if (!t) return undefined; switch (node.kind) { - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checker.getTypeOfPropertyOfContextualType(t, node.symbol.escapedName); - case 188 /* SyntaxKind.IntersectionType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 189 /* SyntaxKind.UnionType */: return t; } } @@ -137019,7 +138423,7 @@ var ts; ? !!ts.tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 43 /* SyntaxKind.SlashToken */ && ts.isJsxClosingElement(contextToken.parent)); case " ": - return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 305 /* SyntaxKind.SourceFile */; + return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 308 /* SyntaxKind.SourceFile */; default: return ts.Debug.assertNever(triggerCharacter); } @@ -137066,21 +138470,22 @@ var ts; return undefined; } function getImportStatementCompletionInfo(contextToken) { + var _a, _b, _c; var keywordCompletion; var isKeywordOnlyCompletion = false; var candidate = getCandidate(); return { isKeywordOnlyCompletion: isKeywordOnlyCompletion, keywordCompletion: keywordCompletion, - isNewIdentifierLocation: !!(candidate || keywordCompletion === 152 /* SyntaxKind.TypeKeyword */), - replacementNode: candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) - ? candidate - : undefined + isNewIdentifierLocation: !!(candidate || keywordCompletion === 154 /* SyntaxKind.TypeKeyword */), + isTopLevelTypeOnly: !!((_b = (_a = ts.tryCast(candidate, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || !!((_c = ts.tryCast(candidate, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly), + couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken), + replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate), }; function getCandidate() { var parent = contextToken.parent; if (ts.isImportEqualsDeclaration(parent)) { - keywordCompletion = contextToken.kind === 152 /* SyntaxKind.TypeKeyword */ ? undefined : 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = contextToken.kind === 154 /* SyntaxKind.TypeKeyword */ ? undefined : 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleReference) ? parent : undefined; } if (couldBeTypeOnlyImportSpecifier(parent, contextToken) && canCompleteFromNamedBindings(parent.parent)) { @@ -137090,13 +138495,13 @@ var ts; if (!parent.parent.isTypeOnly && (contextToken.kind === 18 /* SyntaxKind.OpenBraceToken */ || contextToken.kind === 100 /* SyntaxKind.ImportKeyword */ || contextToken.kind === 27 /* SyntaxKind.CommaToken */)) { - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; } if (canCompleteFromNamedBindings(parent)) { // At `import { ... } |` or `import * as Foo |`, the only possible completion is `from` if (contextToken.kind === 19 /* SyntaxKind.CloseBraceToken */ || contextToken.kind === 79 /* SyntaxKind.Identifier */) { isKeywordOnlyCompletion = true; - keywordCompletion = 156 /* SyntaxKind.FromKeyword */; + keywordCompletion = 158 /* SyntaxKind.FromKeyword */; } else { return parent.parent.parent; @@ -137106,25 +138511,82 @@ var ts; } if (ts.isImportKeyword(contextToken) && ts.isSourceFile(parent)) { // A lone import keyword with nothing following it does not parse as a statement at all - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return contextToken; } if (ts.isImportKeyword(contextToken) && ts.isImportDeclaration(parent)) { // `import s| from` - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleSpecifier) ? parent : undefined; } return undefined; } } + function getSingleLineReplacementSpanForImportCompletionNode(node) { + var _a, _b, _c; + if (!node) + return undefined; + var top = (_a = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration))) !== null && _a !== void 0 ? _a : node; + var sourceFile = top.getSourceFile(); + if (ts.rangeIsOnSingleLine(top, sourceFile)) { + return ts.createTextSpanFromNode(top, sourceFile); + } + // ImportKeyword was necessarily on one line; ImportSpecifier was necessarily parented in an ImportDeclaration + ts.Debug.assert(top.kind !== 100 /* SyntaxKind.ImportKeyword */ && top.kind !== 273 /* SyntaxKind.ImportSpecifier */); + // Guess which point in the import might actually be a later statement parsed as part of the import + // during parser recovery - either in the middle of named imports, or the module specifier. + var potentialSplitPoint = top.kind === 269 /* SyntaxKind.ImportDeclaration */ + ? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings)) !== null && _c !== void 0 ? _c : top.moduleSpecifier + : top.moduleReference; + var withoutModuleSpecifier = { + pos: top.getFirstToken().getStart(), + end: potentialSplitPoint.pos, + }; + // The module specifier/reference was previously found to be missing, empty, or + // not a string literal - in this last case, it's likely that statement on a following + // line was parsed as the module specifier of a partially-typed import, e.g. + // import Foo| + // interface Blah {} + // This appears to be a multiline-import, and editors can't replace multiple lines. + // But if everything but the "module specifier" is on one line, by this point we can + // assume that the "module specifier" is actually just another statement, and return + // the single-line range of the import excluding that probable statement. + if (ts.rangeIsOnSingleLine(withoutModuleSpecifier, sourceFile)) { + return ts.createTextSpanFromRange(withoutModuleSpecifier); + } + } + // Tries to identify the first named import that is not really a named import, but rather + // just parser recovery for a situation like: + // import { Foo| + // interface Bar {} + // in which `Foo`, `interface`, and `Bar` are all parsed as import specifiers. The caller + // will also check if this token is on a separate line from the rest of the import. + function getPotentiallyInvalidImportSpecifier(namedBindings) { + var _a; + return ts.find((_a = ts.tryCast(namedBindings, ts.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements, function (e) { + var _a; + return !e.propertyName && + ts.isStringANonContextualKeyword(e.name.text) && + ((_a = ts.findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) === null || _a === void 0 ? void 0 : _a.kind) !== 27 /* SyntaxKind.CommaToken */; + }); + } function couldBeTypeOnlyImportSpecifier(importSpecifier, contextToken) { return ts.isImportSpecifier(importSpecifier) && (importSpecifier.isTypeOnly || contextToken === importSpecifier.name && ts.isTypeKeywordTokenOrIdentifier(contextToken)); } function canCompleteFromNamedBindings(namedBindings) { - return isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) - && (ts.isNamespaceImport(namedBindings) || namedBindings.elements.length < 2) - && !namedBindings.parent.name; + if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) { + return false; + } + if (ts.isNamedImports(namedBindings)) { + // We can only complete on named imports if there are no other named imports already, + // but parser recovery sometimes puts later statements in the named imports list, so + // we try to only consider the probably-valid ones. + var invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings); + var validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length; + return validImports < 2; + } + return true; } function isModuleSpecifierMissingOrEmpty(specifier) { var _a; @@ -137143,7 +138605,6 @@ var ts; function isArrowFunctionBody(node) { return node.parent && ts.isArrowFunction(node.parent) && node.parent.body === node; } - ; /** True if symbol is a type or a module containing at least one type. */ function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) { if (seenModules === void 0) { seenModules = new ts.Map(); } @@ -137292,14 +138753,14 @@ var ts; case 115 /* SyntaxKind.WhileKeyword */: case 90 /* SyntaxKind.DoKeyword */: return useParent(node.parent, function (n) { return ts.isIterationStatement(n, /*lookInLabeledStatements*/ true); }, getLoopBreakContinueOccurrences); - case 134 /* SyntaxKind.ConstructorKeyword */: - return getFromAllDeclarations(ts.isConstructorDeclaration, [134 /* SyntaxKind.ConstructorKeyword */]); - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - return getFromAllDeclarations(ts.isAccessor, [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */]); - case 132 /* SyntaxKind.AwaitKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + return getFromAllDeclarations(ts.isConstructorDeclaration, [135 /* SyntaxKind.ConstructorKeyword */]); + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + return getFromAllDeclarations(ts.isAccessor, [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */]); + case 133 /* SyntaxKind.AwaitKeyword */: return useParent(node.parent, ts.isAwaitExpression, getAsyncAndAwaitOccurrences); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return highlightSpans(getAsyncAndAwaitOccurrences(node)); case 125 /* SyntaxKind.YieldKeyword */: return highlightSpans(getYieldOccurrences(node)); @@ -137346,7 +138807,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (ts.isFunctionBlock(parent) || parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } // A throw-statement is only owned by a try-statement if the try-statement has @@ -137378,16 +138839,16 @@ var ts; function getBreakOrContinueOwner(statement) { return ts.findAncestor(statement, function (node) { switch (node.kind) { - case 249 /* SyntaxKind.SwitchStatement */: - if (statement.kind === 245 /* SyntaxKind.ContinueStatement */) { + case 252 /* SyntaxKind.SwitchStatement */: + if (statement.kind === 248 /* SyntaxKind.ContinueStatement */) { return false; } // falls through - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return !statement.label || isLabeledBy(node, statement.label.escapedText); default: // Don't cross function boundaries. @@ -137403,26 +138864,26 @@ var ts; // Types of node whose children might have modifiers. var container = declaration.parent; switch (container.kind) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // Container is either a class declaration or the declaration is a classDeclaration - if (modifierFlag & 128 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { + if (modifierFlag & 256 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { return __spreadArray(__spreadArray([], declaration.members, true), [declaration], false); } else { return container.statements; } - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return __spreadArray(__spreadArray([], container.parameters, true), (ts.isClassLike(container.parent) ? container.parent.members : []), true); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: var nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. @@ -137432,12 +138893,12 @@ var ts; return __spreadArray(__spreadArray([], nodes, true), constructor.parameters, true); } } - else if (modifierFlag & 128 /* ModifierFlags.Abstract */) { + else if (modifierFlag & 256 /* ModifierFlags.Abstract */) { return __spreadArray(__spreadArray([], nodes, true), [container], false); } return nodes; // Syntactically invalid positions that the parser might produce anyway - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return undefined; default: ts.Debug.assertNever(container, "Invalid container kind."); @@ -137458,7 +138919,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 97 /* SyntaxKind.ForKeyword */, 115 /* SyntaxKind.WhileKeyword */, 90 /* SyntaxKind.DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 240 /* SyntaxKind.DoStatement */) { + if (loopNode.kind === 243 /* SyntaxKind.DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 115 /* SyntaxKind.WhileKeyword */)) { @@ -137478,13 +138939,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -137557,13 +139018,13 @@ var ts; var keywords = []; if (func.modifiers) { func.modifiers.forEach(function (modifier) { - pushKeywordIf(keywords, modifier, 131 /* SyntaxKind.AsyncKeyword */); + pushKeywordIf(keywords, modifier, 132 /* SyntaxKind.AsyncKeyword */); }); } ts.forEachChild(func, function (child) { traverseWithoutCrossingFunction(child, function (node) { if (ts.isAwaitExpression(node)) { - pushKeywordIf(keywords, node.getFirstToken(), 132 /* SyntaxKind.AwaitKeyword */); + pushKeywordIf(keywords, node.getFirstToken(), 133 /* SyntaxKind.AwaitKeyword */); } }); }); @@ -137947,14 +139408,14 @@ var ts; if (cancellationToken) cancellationToken.throwIfCancellationRequested(); switch (direct.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(direct)) { handleImportCall(direct); break; } if (!isAvailableThroughGlobal) { var parent = direct.parent; - if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { var name = parent.name; if (name.kind === 79 /* SyntaxKind.Identifier */) { directImports.push(name); @@ -137965,25 +139426,25 @@ var ts; break; case 79 /* SyntaxKind.Identifier */: // for 'const x = require("y"); break; // TODO: GH#23879 - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: handleNamespaceImport(direct, direct.name, ts.hasSyntacticModifier(direct, 1 /* ModifierFlags.Export */), /*alreadyAddedDirect*/ false); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: directImports.push(direct); var namedBindings = direct.importClause && direct.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings && namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { handleNamespaceImport(direct, namedBindings.name, /*isReExport*/ false, /*alreadyAddedDirect*/ true); } else if (!isAvailableThroughGlobal && ts.isDefaultImport(direct)) { addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); // Add a check for indirect uses to handle synthetic default imports } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (!direct.exportClause) { // This is `export * from "foo"`, so imports of this module may import the export too. handleDirectImports(getContainingModuleSymbol(direct, checker)); } - else if (direct.exportClause.kind === 274 /* SyntaxKind.NamespaceExport */) { + else if (direct.exportClause.kind === 277 /* SyntaxKind.NamespaceExport */) { // `export * as foo from "foo"` add to indirect uses addIndirectUser(getSourceFileLikeForImportDeclaration(direct), /** addTransitiveDependencies */ true); } @@ -137992,9 +139453,9 @@ var ts; directImports.push(direct); } break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: // Only check for typeof import('xyz') - if (direct.isTypeOf && !direct.qualifier && isExported(direct)) { + if (!isAvailableThroughGlobal && direct.isTypeOf && !direct.qualifier && isExported(direct)) { addIndirectUser(direct.getSourceFile(), /** addTransitiveDependencies */ true); } directImports.push(direct); @@ -138025,7 +139486,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 261 /* SyntaxKind.ModuleDeclaration */); + ts.Debug.assert(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 264 /* SyntaxKind.ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUser(sourceFileLike, /** addTransitiveDependencies */ true); } @@ -138081,7 +139542,7 @@ var ts; } return { importSearches: importSearches, singleReferences: singleReferences }; function handleImport(decl) { - if (decl.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (decl.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { if (isExternalModuleImportEquals(decl)) { handleNamespaceImportLike(decl.name); } @@ -138091,7 +139552,7 @@ var ts; handleNamespaceImportLike(decl); return; } - if (decl.kind === 200 /* SyntaxKind.ImportType */) { + if (decl.kind === 202 /* SyntaxKind.ImportType */) { if (decl.qualifier) { var firstIdentifier = ts.getFirstIdentifier(decl.qualifier); if (firstIdentifier.escapedText === ts.symbolName(exportSymbol)) { @@ -138107,7 +139568,7 @@ var ts; if (decl.moduleSpecifier.kind !== 10 /* SyntaxKind.StringLiteral */) { return; } - if (decl.kind === 272 /* SyntaxKind.ExportDeclaration */) { + if (decl.kind === 275 /* SyntaxKind.ExportDeclaration */) { if (decl.exportClause && ts.isNamedExports(decl.exportClause)) { searchForNamedImport(decl.exportClause); } @@ -138116,10 +139577,10 @@ var ts; var _a = decl.importClause || { name: undefined, namedBindings: undefined }, name = _a.name, namedBindings = _a.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: handleNamespaceImportLike(namedBindings.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: // 'default' might be accessed as a named import `{ default as foo }`. if (exportKind === 0 /* ExportKind.Named */ || exportKind === 1 /* ExportKind.Default */) { searchForNamedImport(namedBindings); @@ -138169,7 +139630,7 @@ var ts; } } else { - var localSymbol = element.kind === 275 /* SyntaxKind.ExportSpecifier */ && element.propertyName + var localSymbol = element.kind === 278 /* SyntaxKind.ExportSpecifier */ && element.propertyName ? checker.getExportSpecifierLocalTargetSymbol(element) // For re-exporting under a different name, we want to get the re-exported symbol. : checker.getSymbolAtLocation(name); addSearch(name, localSymbol); @@ -138198,7 +139659,7 @@ var ts; for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { var referencingFile = sourceFiles_1[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 305 /* SyntaxKind.SourceFile */) { + if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 308 /* SyntaxKind.SourceFile */) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -138246,7 +139707,7 @@ var ts; } /** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */ function forEachPossibleImportOrExportStatement(sourceFileLike, action) { - return ts.forEach(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -138261,15 +139722,15 @@ var ts; else { forEachPossibleImportOrExportStatement(sourceFile, function (statement) { switch (statement.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: { var decl = statement; if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) { action(decl, decl.moduleSpecifier); } break; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { var decl = statement; if (isExternalModuleImportEquals(decl)) { action(decl, decl.moduleReference.expression); @@ -138294,7 +139755,7 @@ var ts; var parent = node.parent; var grandparent = parent.parent; if (symbol.exportSymbol) { - if (parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { // When accessing an export of a JS module, there's no alias. The symbol will still be flagged as an export even though we're at the use. // So check that we are at the declaration. return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === parent; })) && ts.isBinaryExpression(grandparent) @@ -138378,6 +139839,8 @@ var ts; // Similarly, skip past the symbol for 'export =' if (importedSymbol.escapedName === "export=") { importedSymbol = getExportEqualsLocalSymbol(importedSymbol, checker); + if (importedSymbol === undefined) + return undefined; } // If the import has a different name than the export, do not continue searching. // If `importedName` is undefined, do continue searching as the export is anonymous. @@ -138393,25 +139856,25 @@ var ts; } // Not meant for use with export specifiers or export assignment. function getExportKindForDeclaration(node) { - return ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; + return ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; } } FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol; function getExportEqualsLocalSymbol(importedSymbol, checker) { if (importedSymbol.flags & 2097152 /* SymbolFlags.Alias */) { - return ts.Debug.checkDefined(checker.getImmediateAliasedSymbol(importedSymbol)); + return checker.getImmediateAliasedSymbol(importedSymbol); } var decl = ts.Debug.checkDefined(importedSymbol.valueDeclaration); if (ts.isExportAssignment(decl)) { // `export = class {}` - return ts.Debug.checkDefined(decl.expression.symbol); + return decl.expression.symbol; } else if (ts.isBinaryExpression(decl)) { // `module.exports = class {}` - return ts.Debug.checkDefined(decl.right.symbol); + return decl.right.symbol; } else if (ts.isSourceFile(decl)) { // json module - return ts.Debug.checkDefined(decl.symbol); + return decl.symbol; } - return ts.Debug.fail(); + return undefined; } // If a reference is a class expression, the exported node would be its parent. // If a reference is a variable declaration, the exported node would be the variable statement. @@ -138428,16 +139891,16 @@ var ts; function isNodeImport(node) { var parent = node.parent; switch (parent.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return parent.name === node && isExternalModuleImportEquals(parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: // For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`. return !parent.propertyName; - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: ts.Debug.assert(parent.name === node); return true; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent.parent.parent); default: return false; @@ -138478,21 +139941,21 @@ var ts; return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); } function getSourceFileLikeForImportDeclaration(node) { - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } - ts.Debug.assert(parent.kind === 262 /* SyntaxKind.ModuleBlock */); + ts.Debug.assert(parent.kind === 265 /* SyntaxKind.ModuleBlock */); return ts.cast(parent.parent, isAmbientModuleDeclaration); } function isAmbientModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; } function isExternalModuleImportEquals(eq) { - return eq.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; + return eq.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); @@ -138586,7 +140049,7 @@ var ts; ((ts.isImportOrExportSpecifier(node.parent) || ts.isBindingElement(node.parent)) && node.parent.propertyName === node) || // Is default export - (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 513 /* ModifierFlags.ExportDefault */))) { + (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 1025 /* ModifierFlags.ExportDefault */))) { return getContextNode(node.parent); } return undefined; @@ -138595,7 +140058,7 @@ var ts; if (!node) return undefined; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !ts.isVariableDeclarationList(node.parent) || node.parent.declarations.length !== 1 ? node : ts.isVariableStatement(node.parent.parent) ? @@ -138603,28 +140066,28 @@ var ts; ts.isForInOrOfStatement(node.parent.parent) ? getContextNode(node.parent.parent) : node.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextNode(node.parent.parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 267 /* SyntaxKind.ImportClause */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ts.isExpressionStatement(node.parent) ? node.parent : node; - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return { start: node.initializer, end: node.expression }; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent) ? getContextNode(ts.findAncestor(node.parent, function (node) { return ts.isBinaryExpression(node) || ts.isForInOrOfStatement(node); @@ -138685,15 +140148,15 @@ var ts; return node.kind === 88 /* SyntaxKind.DefaultKeyword */ || !!ts.getDeclarationFromName(node) || ts.isLiteralComputedPropertyDeclarationName(node) - || (node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); + || (node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); } function getImplementationsAtPosition(program, cancellationToken, sourceFiles, sourceFile, position) { var node = ts.getTouchingPropertyName(sourceFile, position); var referenceEntries; var entries = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position); - if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || node.parent.kind === 203 /* SyntaxKind.BindingElement */ - || node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ + if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || node.parent.kind === 205 /* SyntaxKind.BindingElement */ + || node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ || node.kind === 106 /* SyntaxKind.SuperKeyword */) { referenceEntries = entries && __spreadArray([], entries, true); } @@ -138717,13 +140180,13 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return undefined; } var checker = program.getTypeChecker(); // If invoked directly on a shorthand property assignment, then return // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var result_2 = []; Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_2.push(nodeEntry(node)); }); return result_2; @@ -138899,13 +140362,13 @@ var ts; if (symbol) { return getDefinitionKindAndDisplayParts(symbol, checker, node); } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return { kind: "interface" /* ScriptElementKind.interfaceElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] }; } - else if (node.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (node.kind === 228 /* SyntaxKind.ClassExpression */) { return { kind: "local class" /* ScriptElementKind.localClassElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] @@ -138959,7 +140422,7 @@ var ts; var source = ts.getDeclarationFromName(node) || (node.kind === 88 /* SyntaxKind.DefaultKeyword */ ? node.parent : ts.isLiteralComputedPropertyDeclarationName(node) ? node.parent.parent - : node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent + : node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent : undefined); var commonjsSource = source && ts.isBinaryExpression(source) ? source.left : undefined; return !!(source && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === source || d === commonjsSource; }))); @@ -138974,47 +140437,47 @@ var ts; if (!!(decl.flags & 16777216 /* NodeFlags.Ambient */)) return true; switch (decl.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: case 88 /* SyntaxKind.DefaultKeyword */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: // default import - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 285 /* SyntaxKind.JsxAttribute */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: - case 164 /* SyntaxKind.Parameter */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: // default import + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 288 /* SyntaxKind.JsxAttribute */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: + case 166 /* SyntaxKind.Parameter */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // In `({ x: y } = 0);`, `x` is not a write access. (Won't call this function for `y`.) return !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(decl.parent); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return !!decl.body; - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return !!decl.initializer || ts.isCatchClause(decl.parent); - case 168 /* SyntaxKind.MethodSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 170 /* SyntaxKind.MethodSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return false; default: return ts.Debug.failBadSyntaxKind(decl); @@ -139240,10 +140703,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.) break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (sourceFilesSet.has(decl.getSourceFile().fileName)) { references.push(nodeEntry(decl.name)); } @@ -139272,9 +140735,9 @@ var ts; } /** As in a `readonly prop: any` or `constructor(readonly prop: any)`, not a `readonly any[]`. */ function isReadonlyTypeOperator(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(node.parent) - && node.parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + && node.parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } /** getReferencedSymbols for special node kinds. */ function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) { @@ -139285,12 +140748,12 @@ var ts; } // A modifier readonly (like on a property declaration) is not special; // a readonly type keyword (like `readonly string[]`) is. - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { return undefined; } // Likewise, when we *are* looking for a special keyword, make sure we // *don’t* include readonly member modifiers. - return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); } if (ts.isImportMeta(node.parent) && node.parent.name === node) { return getAllReferencesForImportMeta(sourceFiles, cancellationToken); @@ -139357,8 +140820,8 @@ var ts; } function getSpecialSearchKind(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 173 /* SyntaxKind.Constructor */: + case 135 /* SyntaxKind.ConstructorKeyword */: return 1 /* SpecialSearchKind.Constructor */; case 79 /* SyntaxKind.Identifier */: if (ts.isClassLike(node.parent)) { @@ -139606,7 +141069,7 @@ var ts; // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 213 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 226 /* SyntaxKind.ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 215 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 228 /* SyntaxKind.ClassExpression */)) { return valueDeclaration; } if (!declarations) { @@ -139616,7 +141079,7 @@ var ts; if (flags & (4 /* SymbolFlags.Property */ | 8192 /* SymbolFlags.Method */)) { var privateDeclaration = ts.find(declarations, function (d) { return ts.hasEffectiveModifier(d, 8 /* ModifierFlags.Private */) || ts.isPrivateIdentifierClassElementDeclaration(d); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 257 /* SyntaxKind.ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 260 /* SyntaxKind.ClassDeclaration */); } // Else this is a public property and could be accessed from anywhere. return undefined; @@ -139645,7 +141108,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (!container || container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -139903,7 +141366,7 @@ var ts; } // Use the parent symbol if the location is commonjs require syntax on javascript files only. if (ts.isInJSFile(referenceLocation) - && referenceLocation.parent.kind === 203 /* SyntaxKind.BindingElement */ + && referenceLocation.parent.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent.parent.parent)) { referenceSymbol = referenceLocation.parent.symbol; // The parent will not have a symbol if it's an ObjectBindingPattern (when destructuring is used). In @@ -140010,7 +141473,7 @@ var ts; } } function addReference(referenceLocation, relatedSymbol, state) { - var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line no-in-operator + var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line local/no-in-operator // if rename symbol from default export anonymous function, for example `export default function() {}`, we do not need to add reference if (state.options.use === 2 /* FindReferencesUse.Rename */ && referenceLocation.kind === 88 /* SyntaxKind.DefaultKeyword */) { return; @@ -140076,15 +141539,15 @@ var ts; if (constructorSymbol && constructorSymbol.declarations) { for (var _i = 0, _a = constructorSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - var ctrKeyword = ts.findChildOfKind(decl, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */ && !!ctrKeyword); + var ctrKeyword = ts.findChildOfKind(decl, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */ && !!ctrKeyword); addNode(ctrKeyword); } } if (classSymbol.exports) { classSymbol.exports.forEach(function (member) { var decl = member.valueDeclaration; - if (decl && decl.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (decl && decl.kind === 171 /* SyntaxKind.MethodDeclaration */) { var body = decl.body; if (body) { forEachDescendantOfKind(body, 108 /* SyntaxKind.ThisKeyword */, function (thisKeyword) { @@ -140108,7 +141571,7 @@ var ts; } for (var _i = 0, _a = constructor.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */); var body = decl.body; if (body) { forEachDescendantOfKind(body, 106 /* SyntaxKind.SuperKeyword */, function (node) { @@ -140138,7 +141601,7 @@ var ts; if (refNode.kind !== 79 /* SyntaxKind.Identifier */) { return; } - if (refNode.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } @@ -140158,7 +141621,7 @@ var ts; } else if (ts.isFunctionLike(typeHavingNode) && typeHavingNode.body) { var body = typeHavingNode.body; - if (body.kind === 235 /* SyntaxKind.Block */) { + if (body.kind === 238 /* SyntaxKind.Block */) { ts.forEachReturnStatement(body, function (returnStatement) { if (returnStatement.expression) addIfImplementation(returnStatement.expression); @@ -140186,13 +141649,13 @@ var ts; */ function isImplementationExpression(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isImplementationExpression(node.expression); - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; default: return false; @@ -140245,13 +141708,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -140272,43 +141735,43 @@ var ts; return [{ definition: { type: 0 /* DefinitionKind.Symbol */, symbol: searchSpaceNode.symbol }, references: references }]; } function isParameterName(node) { - return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 164 /* SyntaxKind.Parameter */ && node.parent.name === node; + return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 166 /* SyntaxKind.Parameter */ && node.parent.name === node; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning object literals break; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) { return undefined; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. default: return undefined; } - var references = ts.flatMap(searchSpaceNode.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { + var references = ts.flatMap(searchSpaceNode.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { cancellationToken.throwIfCancellationRequested(); return getPossibleSymbolReferenceNodes(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(function (node) { if (!ts.isThis(node)) { @@ -140316,20 +141779,20 @@ var ts; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return searchSpaceNode.symbol === container.symbol; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol; - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // Make sure the container belongs to the same class/object literals // and has the appropriate static modifier from the original container. return container.parent && searchSpaceNode.symbol === container.parent.symbol && ts.isStatic(container) === !!staticFlag; - case 305 /* SyntaxKind.SourceFile */: - return container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); + case 308 /* SyntaxKind.SourceFile */: + return container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); } }); }).map(function (n) { return nodeEntry(n); }); @@ -140440,7 +141903,7 @@ var ts; ts.Debug.assert(paramProps.length === 2 && !!(paramProps[0].flags & 1 /* SymbolFlags.FunctionScopedVariable */) && !!(paramProps[1].flags & 4 /* SymbolFlags.Property */)); // is [parameter, property] return fromRoot(symbol.flags & 1 /* SymbolFlags.FunctionScopedVariable */ ? paramProps[1] : paramProps[0]); } - var exportSpecifier = ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */); + var exportSpecifier = ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */); if (!isForRenamePopulateSearchSymbolSet || exportSpecifier && !exportSpecifier.propertyName) { var localSymbol = exportSpecifier && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier); if (localSymbol) { @@ -140485,7 +141948,7 @@ var ts; }); } function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) { - var bindingElement = ts.getDeclarationOfKind(symbol, 203 /* SyntaxKind.BindingElement */); + var bindingElement = ts.getDeclarationOfKind(symbol, 205 /* SyntaxKind.BindingElement */); if (bindingElement && ts.isObjectBindingElementWithoutPropertyName(bindingElement)) { return ts.getPropertySymbolFromBindingElement(checker, bindingElement); } @@ -140748,16 +142211,16 @@ var ts; return; } switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return (_a = ts.getAssignedName(node.parent)) === null || _a === void 0 ? void 0 : _a.getText(); } return (_b = ts.getNameOfDeclaration(node.parent)) === null || _b === void 0 ? void 0 : _b.getText(); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isModuleBlock(node.parent) && ts.isIdentifier(node.parent.parent.name)) { return node.parent.parent.name.getText(); } @@ -140972,61 +142435,65 @@ var ts; } switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // do not descend into nodes that cannot contain callable nodes return; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: recordCallSite(node); return; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // do not descend into the type side of an assertion collect(node.expression); return; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: // do not descend into the type of a variable or parameter declaration collect(node.name); collect(node.initializer); return; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: // do not descend into the type arguments of a call expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: // do not descend into the type arguments of a new expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // do not descend into the type arguments of a tagged template expression recordCallSite(node); collect(node.tag); collect(node.template); return; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // do not descend into the type arguments of a JsxOpeningLikeElement recordCallSite(node); collect(node.tagName); collect(node.attributes); return; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: recordCallSite(node); collect(node.expression); return; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: recordCallSite(node); ts.forEachChild(node, collect); break; + case 235 /* SyntaxKind.SatisfiesExpression */: + // do not descend into the type side of an assertion + collect(node.expression); + return; } if (ts.isPartOfTypeNode(node)) { // do not descend into types @@ -141081,25 +142548,25 @@ var ts; var callSites = []; var collect = createCallSiteCollector(program, callSites); switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: collectCallSitesOfSourceFile(node, collect); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: collectCallSitesOfModuleDeclaration(node, collect); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: collectCallSitesOfFunctionLikeDeclaration(program.getTypeChecker(), node, collect); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: collectCallSitesOfClassLikeDeclaration(node, collect); break; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: collectCallSitesOfClassStaticBlockDeclaration(node, collect); break; default: @@ -141370,7 +142837,7 @@ var ts; } var parent = node.parent; var typeChecker = program.getTypeChecker(); - if (node.kind === 159 /* SyntaxKind.OverrideKeyword */ || (ts.isIdentifier(node) && ts.isJSDocOverrideTag(parent) && parent.tagName === node)) { + if (node.kind === 161 /* SyntaxKind.OverrideKeyword */ || (ts.isIdentifier(node) && ts.isJSDocOverrideTag(parent) && parent.tagName === node)) { return getDefinitionFromOverriddenMember(typeChecker, node) || ts.emptyArray; } // Labels @@ -141378,6 +142845,12 @@ var ts; var label = ts.getTargetLabel(node.parent, node.text); return label ? [createDefinitionInfoFromName(typeChecker, label, "label" /* ScriptElementKind.label */, node.text, /*containerName*/ undefined)] : undefined; // TODO: GH#18217 } + if (node.kind === 105 /* SyntaxKind.ReturnKeyword */) { + var functionDeclaration = ts.findAncestor(node.parent, function (n) { + return ts.isClassStaticBlockDeclaration(n) ? "quit" : ts.isFunctionLikeDeclaration(n); + }); + return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : undefined; + } if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) { var classDecl = node.parent.parent; var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution; @@ -141446,7 +142919,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node, /*unverified*/ false, failedAliasResolution); }) : ts.emptyArray; return ts.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts.emptyArray); @@ -141513,13 +142986,16 @@ var ts; if (!baseDeclaration) return; var baseTypeNode = ts.getEffectiveBaseTypeNode(baseDeclaration); - var baseType = baseTypeNode ? typeChecker.getTypeAtLocation(baseTypeNode) : undefined; - if (!baseType) + if (!baseTypeNode) + return; + var expression = ts.skipParentheses(baseTypeNode.expression); + var base = ts.isClassExpression(expression) ? expression.symbol : typeChecker.getSymbolAtLocation(expression); + if (!base) return; var name = ts.unescapeLeadingUnderscores(ts.getTextOfPropertyName(classElement.name)); var symbol = ts.hasStaticModifier(classElement) - ? typeChecker.getPropertyOfType(typeChecker.getTypeOfSymbolAtLocation(baseType.symbol, baseDeclaration), name) - : typeChecker.getPropertyOfType(baseType, name); + ? typeChecker.getPropertyOfType(typeChecker.getTypeOfSymbol(base), name) + : typeChecker.getPropertyOfType(typeChecker.getDeclaredTypeOfSymbol(base), name); if (!symbol) return; return getDefinitionFromSymbol(typeChecker, symbol, node); @@ -141652,7 +143128,7 @@ var ts; if (node.parent === declaration) { return true; } - if (declaration.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (declaration.kind === 271 /* SyntaxKind.NamespaceImport */) { return false; } return true; @@ -141694,7 +143170,7 @@ var ts; function getConstructSignatureDefinition() { // Applicable only if we are in a new expression, or we are on a constructor declaration // and in either case the symbol has a construct signature definition, i.e. class - if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 134 /* SyntaxKind.ConstructorKeyword */)) { + if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 135 /* SyntaxKind.ConstructorKeyword */)) { var cls = ts.find(filteredDeclarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration"); return getSignatureDefinition(cls.members, /*selectConstructors*/ true); } @@ -141746,22 +143222,22 @@ var ts; return isDefinitionVisible(checker, declaration.parent); // Handle some exceptions here like arrow function, members of class and object literal expression which are technically not visible but we want the definition to be determined by its parent switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // Private/protected properties/methods are not visible if (ts.hasEffectiveModifier(declaration, 8 /* ModifierFlags.Private */)) return false; // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: return isDefinitionVisible(checker, declaration.parent); default: return false; @@ -141799,9 +143275,9 @@ var ts; } function isConstructorLike(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return true; default: return false; @@ -141907,17 +143383,17 @@ var ts; ts.forEachUnique(declarations, function (declaration) { for (var _i = 0, _a = getCommentHavingNodes(declaration); _i < _a.length; _i++) { var jsdoc = _a[_i]; - var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 327 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); + var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 330 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @typedefs are themselves declarations with associated comments // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation if (jsdoc.comment === undefined && !inheritDoc || ts.isJSDoc(jsdoc) - && declaration.kind !== 345 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 338 /* SyntaxKind.JSDocCallbackTag */ + && declaration.kind !== 348 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 341 /* SyntaxKind.JSDocCallbackTag */ && jsdoc.tags - && jsdoc.tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !jsdoc.tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + && jsdoc.tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !jsdoc.tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { continue; } var newparts = jsdoc.comment ? getDisplayPartsFromComment(jsdoc.comment, checker) : []; @@ -141937,11 +143413,11 @@ var ts; } function getCommentHavingNodes(declaration) { switch (declaration.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return [declaration]; - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return [declaration, declaration.parent]; default: return ts.getJSDocCommentsAndTags(declaration); @@ -141955,8 +143431,8 @@ var ts; // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation - if (tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + if (tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { return; } for (var _i = 0, tags_1 = tags; _i < tags_1.length; _i++) { @@ -141971,17 +143447,17 @@ var ts; if (typeof comment === "string") { return [ts.textPart(comment)]; } - return ts.flatMap(comment, function (node) { return node.kind === 321 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); + return ts.flatMap(comment, function (node) { return node.kind === 324 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); } function getCommentDisplayParts(tag, checker) { var comment = tag.comment, kind = tag.kind; var namePart = getTagNameDisplayPart(kind); switch (kind) { - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return withNode(tag.class); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return withNode(tag.class); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: var templateTag = tag; var displayParts_3 = []; if (templateTag.constraint) { @@ -142003,13 +143479,13 @@ var ts; displayParts_3.push.apply(displayParts_3, __spreadArray([ts.spacePart()], getDisplayPartsFromComment(comment, checker), true)); } return displayParts_3; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return withNode(tag.typeExpression); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: - case 346 /* SyntaxKind.JSDocSeeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: var name = tag.name; return name ? withNode(name) : comment === undefined ? undefined @@ -142036,14 +143512,14 @@ var ts; } function getTagNameDisplayPart(kind) { switch (kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return ts.parameterNamePart; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return ts.propertyNamePart; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return ts.typeParameterNamePart; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return ts.typeAliasNamePart; default: return ts.textPart; @@ -142214,43 +143690,48 @@ var ts; } function getCommentOwnerInfoWorker(commentOwner, options) { switch (commentOwner.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: var host = commentOwner; return { commentOwner: commentOwner, parameters: host.parameters, hasReturn: hasReturn(host, options) }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getCommentOwnerInfoWorker(commentOwner.initializer, options); - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return { commentOwner: commentOwner }; - case 237 /* SyntaxKind.VariableStatement */: { + case 168 /* SyntaxKind.PropertySignature */: { + var host_1 = commentOwner; + return host_1.type && ts.isFunctionTypeNode(host_1.type) + ? { commentOwner: commentOwner, parameters: host_1.type.parameters, hasReturn: hasReturn(host_1.type, options) } + : { commentOwner: commentOwner }; + } + case 240 /* SyntaxKind.VariableStatement */: { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; - var host_1 = varDeclarations.length === 1 && varDeclarations[0].initializer + var host_2 = varDeclarations.length === 1 && varDeclarations[0].initializer ? getRightHandSideOfAssignment(varDeclarations[0].initializer) : undefined; - return host_1 - ? { commentOwner: commentOwner, parameters: host_1.parameters, hasReturn: hasReturn(host_1, options) } + return host_2 + ? { commentOwner: commentOwner, parameters: host_2.parameters, hasReturn: hasReturn(host_2, options) } : { commentOwner: commentOwner }; } - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return "quit"; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - return commentOwner.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; - case 238 /* SyntaxKind.ExpressionStatement */: + return commentOwner.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; + case 241 /* SyntaxKind.ExpressionStatement */: return getCommentOwnerInfoWorker(commentOwner.expression, options); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var be = commentOwner; if (ts.getAssignmentDeclarationKind(be) === 0 /* AssignmentDeclarationKind.None */) { return "quit"; @@ -142259,7 +143740,7 @@ var ts; ? { commentOwner: commentOwner, parameters: be.right.parameters, hasReturn: hasReturn(be.right, options) } : { commentOwner: commentOwner }; } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: var init = commentOwner.initializer; if (init && (ts.isFunctionExpression(init) || ts.isArrowFunction(init))) { return { commentOwner: commentOwner, parameters: init.parameters, hasReturn: hasReturn(init, options) }; @@ -142268,18 +143749,18 @@ var ts; } function hasReturn(node, options) { return !!(options === null || options === void 0 ? void 0 : options.generateReturnInDocTemplate) && - (ts.isArrowFunction(node) && ts.isExpression(node.body) + (ts.isFunctionTypeNode(node) || ts.isArrowFunction(node) && ts.isExpression(node.body) || ts.isFunctionLikeDeclaration(node) && node.body && ts.isBlock(node.body) && !!ts.forEachReturnStatement(node.body, function (n) { return n; })); } function getRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (rightHandSide.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return rightHandSide; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return ts.find(rightHandSide.members, ts.isConstructorDeclaration); } } @@ -142338,9 +143819,9 @@ var ts; } function shouldKeepItem(declaration, checker) { switch (declaration.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var importer = checker.getSymbolAtLocation(declaration.name); // TODO: GH#18217 var imported = checker.getAliasedSymbol(importer); return importer.escapedName !== imported.escapedName; @@ -142350,7 +143831,7 @@ var ts; } function tryAddSingleDeclarationName(declaration, containers) { var name = ts.getNameOfDeclaration(declaration); - return !!name && (pushLiteral(name, containers) || name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); + return !!name && (pushLiteral(name, containers) || name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); } // Only added the names of computed properties if they're simple dotted expressions, like: // @@ -142367,7 +143848,7 @@ var ts; // First, if we started with a computed property name, then add all but the last // portion into the container array. var name = ts.getNameOfDeclaration(declaration); - if (name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { + if (name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { return ts.emptyArray; } // Don't include the last portion. @@ -142584,7 +144065,7 @@ var ts; */ function hasNavigationBarName(node) { return !ts.hasDynamicName(node) || - (node.kind !== 221 /* SyntaxKind.BinaryExpression */ && + (node.kind !== 223 /* SyntaxKind.BinaryExpression */ && ts.isPropertyAccessExpression(node.name.expression) && ts.isIdentifier(node.name.expression.expression) && ts.idText(node.name.expression.expression) === "Symbol"); @@ -142597,7 +144078,7 @@ var ts; return; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Get parameter properties, and treat them as being on the *same* level as the constructor, not under it. var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); @@ -142609,25 +144090,25 @@ var ts; } } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 170 /* SyntaxKind.MethodSignature */: if (hasNavigationBarName(node)) { addNodeWithRecursiveChild(node, node.body); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (hasNavigationBarName(node)) { addNodeWithRecursiveInitializer(node); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (hasNavigationBarName(node)) { addLeafNode(node); } break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -142639,7 +144120,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -142650,17 +144131,17 @@ var ts; } } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: addNodeWithRecursiveChild(node, node.name); break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: var expression = node.expression; // Use the expression as the name of the SpreadAssignment, otherwise show as . ts.isIdentifier(expression) ? addLeafNode(node, expression) : addLeafNode(node); break; - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: { + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: { var child = node; if (ts.isBindingPattern(child.name)) { addChildrenRecursively(child.name); @@ -142670,7 +144151,7 @@ var ts; } break; } - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: var nameNode = node.name; // If we see a function declaration track as a possible ES5 class if (nameNode && ts.isIdentifier(nameNode)) { @@ -142678,11 +144159,11 @@ var ts; } addNodeWithRecursiveChild(node, node.body); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: startNode(node); for (var _e = 0, _f = node.members; _e < _f.length; _e++) { var member = _f[_e]; @@ -142692,9 +144173,9 @@ var ts; } endNode(); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: startNode(node); for (var _g = 0, _h = node.members; _g < _h.length; _g++) { var member = _h[_g]; @@ -142702,10 +144183,10 @@ var ts; } endNode(); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression_1 = node.expression; var child = ts.isObjectLiteralExpression(expression_1) || ts.isCallExpression(expression_1) ? expression_1 : ts.isArrowFunction(expression_1) || ts.isFunctionExpression(expression_1) ? expression_1.body : undefined; @@ -142719,16 +144200,16 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 176 /* SyntaxKind.IndexSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: addLeafNode(node); break; - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var special = ts.getAssignmentDeclarationKind(node); switch (special) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -142968,12 +144449,12 @@ var ts; return false; } switch (a.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.isStatic(a) === ts.isStatic(b); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return areSameModule(a, b) && getFullyQualifiedModuleName(a) === getFullyQualifiedModuleName(b); default: @@ -142995,7 +144476,7 @@ var ts; if (!a.body || !b.body) { return a.body === b.body; } - return a.body.kind === b.body.kind && (a.body.kind !== 261 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); + return a.body.kind === b.body.kind && (a.body.kind !== 264 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); } /** Merge source into target. Source should be thrown away after this is called. */ function merge(target, source) { @@ -143025,7 +144506,7 @@ var ts; * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return getModuleName(node); } var declName = ts.getNameOfDeclaration(node); @@ -143034,16 +144515,16 @@ var ts; return propertyName && ts.unescapeLeadingUnderscores(propertyName); } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: return getFunctionOrClassName(node); default: return undefined; } } function getItemName(node, name) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return cleanText(getModuleName(node)); } if (name) { @@ -143055,32 +144536,32 @@ var ts; } } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"".concat(ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))), "\"") : ""; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return ts.isExportAssignment(node) && node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } // We may get a string with newlines or other whitespace in the case of an object dereference // (eg: "app\n.onactivated"), so we should remove the whitespace for readability in the // navigation bar. return getFunctionOrClassName(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return "new()"; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return "()"; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "[]"; default: return ""; @@ -143113,19 +144594,19 @@ var ts; } // Some nodes are otherwise important enough to always include in the primary navigation menu. switch (navigationBarNodeKind(item)) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 305 /* SyntaxKind.SourceFile */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return true; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -143135,10 +144616,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: return true; default: return false; @@ -143200,7 +144681,7 @@ var ts; function getFullyQualifiedModuleName(moduleDeclaration) { // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = [ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)]; - while (moduleDeclaration.body && moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } @@ -143214,13 +144695,13 @@ var ts; return decl.body && ts.isModuleDeclaration(decl.body) ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return !member.name || member.name.kind === 164 /* SyntaxKind.ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); } function getModifiers(node) { - if (node.parent && node.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.parent && node.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } return ts.getNodeModifiers(node); @@ -143243,7 +144724,7 @@ var ts; return nodeText(parent.name); } // Default exports are named "default" - else if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + else if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } else if (ts.isClassLike(node)) { @@ -143278,9 +144759,9 @@ var ts; } function isFunctionOrClassExpression(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; default: return false; @@ -143309,23 +144790,39 @@ var ts; * 2) Coalescing imports from the same module * 3) Sorting imports */ - function organizeImports(sourceFile, formatContext, host, program, preferences, skipDestructiveCodeActions) { + function organizeImports(sourceFile, formatContext, host, program, preferences, mode) { var changeTracker = ts.textChanges.ChangeTracker.fromContext({ host: host, formatContext: formatContext, preferences: preferences }); - var coalesceAndOrganizeImports = function (importGroup) { return ts.stableSort(coalesceImports(removeUnusedImports(importGroup, sourceFile, program, skipDestructiveCodeActions)), function (s1, s2) { return compareImportsOrRequireStatements(s1, s2); }); }; + var shouldSort = mode === "SortAndCombine" /* OrganizeImportsMode.SortAndCombine */ || mode === "All" /* OrganizeImportsMode.All */; + var shouldCombine = shouldSort; // These are currently inseparable, but I draw a distinction for clarity and in case we add modes in the future. + var shouldRemove = mode === "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */ || mode === "All" /* OrganizeImportsMode.All */; + var maybeRemove = shouldRemove ? removeUnusedImports : ts.identity; + var maybeCoalesce = shouldCombine ? coalesceImports : ts.identity; + var processImportsOfSameModuleSpecifier = function (importGroup) { + var processedDeclarations = maybeCoalesce(maybeRemove(importGroup, sourceFile, program)); + return shouldSort + ? ts.stableSort(processedDeclarations, function (s1, s2) { return compareImportsOrRequireStatements(s1, s2); }) + : processedDeclarations; + }; // All of the old ImportDeclarations in the file, in syntactic order. var topLevelImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, sourceFile.statements.filter(ts.isImportDeclaration)); - topLevelImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, coalesceAndOrganizeImports); }); - // All of the old ExportDeclarations in the file, in syntactic order. - var topLevelExportDecls = sourceFile.statements.filter(ts.isExportDeclaration); - organizeImportsWorker(topLevelExportDecls, coalesceExports); + topLevelImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier); }); + // Exports are always used + if (mode !== "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */) { + // All of the old ExportDeclarations in the file, in syntactic order. + var topLevelExportDecls = sourceFile.statements.filter(ts.isExportDeclaration); + organizeImportsWorker(topLevelExportDecls, coalesceExports); + } for (var _i = 0, _a = sourceFile.statements.filter(ts.isAmbientModule); _i < _a.length; _i++) { var ambientModule = _a[_i]; if (!ambientModule.body) continue; var ambientModuleImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(ts.isImportDeclaration)); - ambientModuleImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, coalesceAndOrganizeImports); }); - var ambientModuleExportDecls = ambientModule.body.statements.filter(ts.isExportDeclaration); - organizeImportsWorker(ambientModuleExportDecls, coalesceExports); + ambientModuleImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier); }); + // Exports are always used + if (mode !== "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */) { + var ambientModuleExportDecls = ambientModule.body.statements.filter(ts.isExportDeclaration); + organizeImportsWorker(ambientModuleExportDecls, coalesceExports); + } } return changeTracker.getChanges(); function organizeImportsWorker(oldImportDecls, coalesce) { @@ -143338,8 +144835,12 @@ var ts; // Consider: we could do a more careful check that this trivia is actually a header, // but the consequences of being wrong are very minor. ts.suppressLeadingTrivia(oldImportDecls[0]); - var oldImportGroups = ts.group(oldImportDecls, function (importDecl) { return getExternalModuleName(importDecl.moduleSpecifier); }); - var sortedImportGroups = ts.stableSort(oldImportGroups, function (group1, group2) { return compareModuleSpecifiers(group1[0].moduleSpecifier, group2[0].moduleSpecifier); }); + var oldImportGroups = shouldCombine + ? ts.group(oldImportDecls, function (importDecl) { return getExternalModuleName(importDecl.moduleSpecifier); }) + : [oldImportDecls]; + var sortedImportGroups = shouldSort + ? ts.stableSort(oldImportGroups, function (group1, group2) { return compareModuleSpecifiers(group1[0].moduleSpecifier, group2[0].moduleSpecifier); }) + : oldImportGroups; var newImportDecls = ts.flatMap(sortedImportGroups, function (importGroup) { return getExternalModuleName(importGroup[0].moduleSpecifier) ? coalesce(importGroup) @@ -143403,11 +144904,7 @@ var ts; } return false; } - function removeUnusedImports(oldImports, sourceFile, program, skipDestructiveCodeActions) { - // As a precaution, consider unused import detection to be destructive (GH #43051) - if (skipDestructiveCodeActions) { - return oldImports; - } + function removeUnusedImports(oldImports, sourceFile, program) { var typeChecker = program.getTypeChecker(); var compilerOptions = program.getCompilerOptions(); var jsxNamespace = typeChecker.getJsxNamespace(sourceFile); @@ -143681,11 +145178,11 @@ var ts; function getModuleSpecifierExpression(declaration) { var _a; switch (declaration.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return (_a = ts.tryCast(declaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return declaration.moduleSpecifier; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return declaration.declarationList.declarations[0].initializer.arguments[0]; } } @@ -143724,19 +145221,19 @@ var ts; function getImportKindOrder(s1) { var _a; switch (s1.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!s1.importClause) return 0; if (s1.importClause.isTypeOnly) return 1; - if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 268 /* SyntaxKind.NamespaceImport */) + if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 271 /* SyntaxKind.NamespaceImport */) return 2; if (s1.importClause.name) return 3; return 4; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return 5; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return 6; } } @@ -143925,7 +145422,7 @@ var ts; } function getOutliningSpanForNode(n, sourceFile) { switch (n.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionLike(n.parent)) { return functionSpan(n.parent, n, sourceFile); } @@ -143933,16 +145430,16 @@ var ts; // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. switch (n.parent.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 243 /* SyntaxKind.DoStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 295 /* SyntaxKind.CatchClause */: return spanForNode(n.parent); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // Could be the try-block, or the finally-block. var tryStatement = n.parent; if (tryStatement.tryBlock === n) { @@ -143959,42 +145456,42 @@ var ts; // the span of the block, independent of any parent span. return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile), "code" /* OutliningSpanKind.Code */); } - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanForNode(n.parent); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 263 /* SyntaxKind.CaseBlock */: - case 182 /* SyntaxKind.TypeLiteral */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 266 /* SyntaxKind.CaseBlock */: + case 184 /* SyntaxKind.TypeLiteral */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return spanForNode(n); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isTupleTypeNode(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return spanForNodeArray(n.statements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return spanForObjectOrArrayLiteral(n); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return spanForObjectOrArrayLiteral(n, 22 /* SyntaxKind.OpenBracketToken */); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return spanForJSXElement(n); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return spanForJSXFragment(n); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return spanForJSXAttributes(n.attributes); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return spanForTemplateLiteral(n); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isBindingElement(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return spanForArrowFunction(n); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return spanForCallExpression(n); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanForParenthesizedExpression(n); } function spanForCallExpression(node) { @@ -144067,7 +145564,7 @@ var ts; function functionSpan(node, body, sourceFile) { var openToken = tryGetFunctionOpenToken(node, body, sourceFile); var closeToken = ts.findChildOfKind(body, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 214 /* SyntaxKind.ArrowFunction */); + return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 216 /* SyntaxKind.ArrowFunction */); } function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart) { if (autoCollapse === void 0) { autoCollapse = false; } @@ -144263,7 +145760,7 @@ var ts; return bestMatch; } function betterMatch(a, b) { - return ts.min(a, b, compareMatches); + return ts.min([a, b], compareMatches); } function compareMatches(a, b) { return a === undefined ? 1 /* Comparison.GreaterThan */ : b === undefined ? -1 /* Comparison.LessThan */ @@ -144611,10 +146108,10 @@ var ts; */ function tryConsumeDeclare() { var token = ts.scanner.getToken(); - if (token === 135 /* SyntaxKind.DeclareKeyword */) { + if (token === 136 /* SyntaxKind.DeclareKeyword */) { // declare module "mod" token = nextToken(); - if (token === 141 /* SyntaxKind.ModuleKeyword */) { + if (token === 142 /* SyntaxKind.ModuleKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { recordAmbientExternalModule(); @@ -144648,10 +146145,10 @@ var ts; return true; } else { - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); - return token !== 156 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || + return token !== 158 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || token === 18 /* SyntaxKind.OpenBraceToken */ || token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)); @@ -144662,7 +146159,7 @@ var ts; } if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import d from "mod"; @@ -144693,7 +146190,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import {a as A} from "mod"; @@ -144705,11 +146202,11 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 127 /* SyntaxKind.AsKeyword */) { + if (token === 128 /* SyntaxKind.AsKeyword */) { token = nextToken(); if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import * as NS from "mod" @@ -144730,7 +146227,7 @@ var ts; if (token === 93 /* SyntaxKind.ExportKeyword */) { markAsExternalModuleIfTopLevel(); token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 41 /* SyntaxKind.AsteriskToken */ || @@ -144749,7 +146246,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export {a as A} from "mod"; @@ -144761,7 +146258,7 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export * from "mod" @@ -144771,7 +146268,7 @@ var ts; } else if (token === 100 /* SyntaxKind.ImportKeyword */) { token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 79 /* SyntaxKind.Identifier */ || @@ -144797,7 +146294,7 @@ var ts; function tryConsumeRequireCall(skipCurrentToken, allowTemplateLiterals) { if (allowTemplateLiterals === void 0) { allowTemplateLiterals = false; } var token = skipCurrentToken ? nextToken() : ts.scanner.getToken(); - if (token === 146 /* SyntaxKind.RequireKeyword */) { + if (token === 147 /* SyntaxKind.RequireKeyword */) { token = nextToken(); if (token === 20 /* SyntaxKind.OpenParenToken */) { token = nextToken(); @@ -144872,8 +146369,8 @@ var ts; } if (ts.scanner.getToken() === 15 /* SyntaxKind.TemplateHead */) { var stack = [ts.scanner.getToken()]; - var token = ts.scanner.scan(); loop: while (ts.length(stack)) { + var token = ts.scanner.scan(); switch (token) { case 1 /* SyntaxKind.EndOfFileToken */: break loop; @@ -144901,7 +146398,6 @@ var ts; } break; } - token = ts.scanner.scan(); } nextToken(); } @@ -145009,7 +146505,7 @@ var ts; return getRenameInfoError(wouldRenameNodeModules); } var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) + var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) ? ts.stripQuotes(ts.getTextOfIdentifierOrLiteral(node)) : undefined; var displayName = specifierName || typeChecker.symbolToString(symbol); @@ -145154,6 +146650,10 @@ var ts; pushSelectionCommentRange(comment.pos, comment.end); } if (positionShouldSnapToNode(sourceFile, pos, node)) { + if (ts.isFunctionBody(node) + && ts.isFunctionLikeDeclaration(parentNode) && !ts.positionsAreOnSameLine(node.getStart(sourceFile), node.getEnd(), sourceFile)) { + pushSelectionRange(node.getStart(sourceFile), node.getEnd()); + } // 1. Blocks are effectively redundant with SyntaxLists. // 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping // of things that should be considered independently. @@ -145291,14 +146791,14 @@ var ts; ts.Debug.assertEqual(closeBraceToken.kind, 19 /* SyntaxKind.CloseBraceToken */); // Group `-/+readonly` and `-/+?` var groupedWithPlusMinusTokens = groupChildren(children, function (child) { - return child === node.readonlyToken || child.kind === 145 /* SyntaxKind.ReadonlyKeyword */ || + return child === node.readonlyToken || child.kind === 146 /* SyntaxKind.ReadonlyKeyword */ || child === node.questionToken || child.kind === 57 /* SyntaxKind.QuestionToken */; }); // Group type parameter with surrounding brackets var groupedWithBrackets = groupChildren(groupedWithPlusMinusTokens, function (_a) { var kind = _a.kind; return kind === 22 /* SyntaxKind.OpenBracketToken */ || - kind === 163 /* SyntaxKind.TypeParameter */ || + kind === 165 /* SyntaxKind.TypeParameter */ || kind === 23 /* SyntaxKind.CloseBracketToken */; }); return [ @@ -145316,7 +146816,7 @@ var ts; var children = groupChildren(node.getChildren(), function (child) { return child === node.name || ts.contains(node.modifiers, child); }); - var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDoc */ ? children[0] : undefined; + var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 323 /* SyntaxKind.JSDoc */ ? children[0] : undefined; var withJSDocSeparated = firstJSDocChild ? children.slice(1) : children; var splittedChildren = splitChildren(withJSDocSeparated, function (_a) { var kind = _a.kind; @@ -145415,22 +146915,22 @@ var ts; return kind === 18 /* SyntaxKind.OpenBraceToken */ || kind === 22 /* SyntaxKind.OpenBracketToken */ || kind === 20 /* SyntaxKind.OpenParenToken */ - || kind === 280 /* SyntaxKind.JsxOpeningElement */; + || kind === 283 /* SyntaxKind.JsxOpeningElement */; } function isListCloser(token) { var kind = token && token.kind; return kind === 19 /* SyntaxKind.CloseBraceToken */ || kind === 23 /* SyntaxKind.CloseBracketToken */ || kind === 21 /* SyntaxKind.CloseParenToken */ - || kind === 281 /* SyntaxKind.JsxClosingElement */; + || kind === 284 /* SyntaxKind.JsxClosingElement */; } function getEndPos(sourceFile, node) { switch (node.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 342 /* SyntaxKind.JSDocThisTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 345 /* SyntaxKind.JSDocThisTag */: return sourceFile.getLineEndOfPosition(node.getStart()); default: return node.getEnd(); @@ -145640,10 +147140,10 @@ var ts; } return undefined; } - else if (ts.isTemplateHead(node) && parent.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + else if (ts.isTemplateHead(node) && parent.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var templateExpression = parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 223 /* SyntaxKind.TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 225 /* SyntaxKind.TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } @@ -145715,17 +147215,17 @@ var ts; return undefined; var parent = startingToken.parent; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: var info = getArgumentOrParameterListInfo(startingToken, position, sourceFile); if (!info) return undefined; var argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan; var contextualType = ts.isMethodDeclaration(parent) ? checker.getContextualTypeForObjectLiteralElement(parent) : checker.getContextualType(parent); return contextualType && { contextualType: contextualType, argumentIndex: argumentIndex, argumentCount: argumentCount, argumentsSpan: argumentsSpan }; - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var highestBinary = getHighestBinary(parent); var contextualType_1 = checker.getContextualType(highestBinary); var argumentIndex_1 = startingToken.kind === 20 /* SyntaxKind.OpenParenToken */ ? 0 : countBinaryExpressionParameters(parent) - 1; @@ -145796,11 +147296,11 @@ var ts; // not enough to put us in the substitution expression; we should consider ourselves part of // the *next* span's expression by offsetting the index (argIndex = (spanIndex + 1) + 1). // - /* eslint-disable no-double-space */ + /* eslint-disable local/no-double-space */ // Example: f `# abcd $#{# 1 + 1# }# efghi ${ #"#hello"# } # ` // ^ ^ ^ ^ ^ ^ ^ ^ ^ // Case: 1 1 3 2 1 3 2 2 1 - /* eslint-enable no-double-space */ + /* eslint-enable local/no-double-space */ ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."); if (ts.isTemplateLiteralToken(node)) { if (ts.isInsideTemplateLiteral(node, position, sourceFile)) { @@ -145849,7 +147349,7 @@ var ts; // | | // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { var lastSpan = ts.last(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -146054,14 +147554,14 @@ var ts; return; } switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) { @@ -146205,7 +147705,7 @@ var ts; } function isHintableLiteral(node) { switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; return ts.isLiteralExpression(operand) || ts.isIdentifier(operand) && ts.isInfinityOrNaNString(operand.escapedText); } @@ -146213,7 +147713,7 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; case 79 /* SyntaxKind.Identifier */: { var name = node.escapedText; @@ -146534,11 +148034,11 @@ var ts; function containsTopLevelCommonjs(sourceFile) { return sourceFile.statements.some(function (statement) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return statement.declarationList.declarations.some(function (decl) { return !!decl.initializer && ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), /*checkArgumentIsStringLiteralLike*/ true); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; if (!ts.isBinaryExpression(expression)) return ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true); @@ -146555,12 +148055,12 @@ var ts; } function importNameForConvertToDefaultImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier; - return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) + return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; default: return undefined; @@ -146636,20 +148136,20 @@ var ts; // should be kept up to date with getTransformationBody in convertToAsyncFunction.ts function isFixablePromiseArgument(arg, checker) { switch (arg.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var functionFlags = ts.getFunctionFlags(arg); if (functionFlags & 1 /* FunctionFlags.Generator */) { return false; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true); // falls through case 104 /* SyntaxKind.NullKeyword */: return true; case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var symbol = checker.getSymbolAtLocation(arg); if (!symbol) { return false; @@ -146666,24 +148166,24 @@ var ts; } function canBeConvertedToClass(node, checker) { var _a, _b, _c, _d; - if (node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (node.kind === 215 /* SyntaxKind.FunctionExpression */) { if (ts.isVariableDeclaration(node.parent) && ((_a = node.symbol.members) === null || _a === void 0 ? void 0 : _a.size)) { return true; } var symbol = checker.getSymbolOfExpando(node, /*allowDeclaration*/ false); return !!(symbol && (((_b = symbol.exports) === null || _b === void 0 ? void 0 : _b.size) || ((_c = symbol.members) === null || _c === void 0 ? void 0 : _c.size))); } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */) { return !!((_d = node.symbol.members) === null || _d === void 0 ? void 0 : _d.size); } return false; } function canBeConvertedToAsync(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -146705,7 +148205,7 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* SymbolFlags.Class */) { - return ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */) ? "local class" /* ScriptElementKind.localClassElement */ : "class" /* ScriptElementKind.classElement */; } if (flags & 384 /* SymbolFlags.Enum */) @@ -146768,6 +148268,8 @@ var ts; return "method" /* ScriptElementKind.memberFunctionElement */; if (flags & 16384 /* SymbolFlags.Constructor */) return "constructor" /* ScriptElementKind.constructorImplementationElement */; + if (flags & 131072 /* SymbolFlags.Signature */) + return "index" /* ScriptElementKind.indexSignatureElement */; if (flags & 4 /* SymbolFlags.Property */) { if (flags & 33554432 /* SymbolFlags.Transient */ && symbol.checkFlags & 6 /* CheckFlags.Synthetic */) { // If union property is result of union of non method (property/accessors/variables), it is labeled as property @@ -146851,12 +148353,15 @@ var ts; var declaration = ts.find(symbol.declarations, function (declaration) { return declaration.name === location; }); if (declaration) { switch (declaration.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: symbolKind = "getter" /* ScriptElementKind.memberGetAccessorElement */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: symbolKind = "setter" /* ScriptElementKind.memberSetAccessorElement */; break; + case 169 /* SyntaxKind.PropertyDeclaration */: + symbolKind = "accessor" /* ScriptElementKind.memberAccessorVariableElement */; + break; default: ts.Debug.assertNever(declaration); } @@ -146867,7 +148372,7 @@ var ts; } var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); - if (location.parent && location.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -146887,7 +148392,7 @@ var ts; } if (callExpressionLike) { signature = typeChecker.getResolvedSignature(callExpressionLike); // TODO: GH#18217 - var useConstructSignatures = callExpressionLike.kind === 209 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); + var useConstructSignatures = callExpressionLike.kind === 211 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (signature && !ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -146951,29 +148456,29 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* SymbolFlags.Accessor */)) || // name of function declaration - (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 171 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration + (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 173 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration // get the signature from the declaration and write it var functionDeclaration_1 = location.parent; // Use function declaration to write the signatures only if the symbol corresponding to this declaration var locationIsSymbolDeclaration = symbol.declarations && ts.find(symbol.declarations, function (declaration) { - return declaration === (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); + return declaration === (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); }); if (locationIsSymbolDeclaration) { - var allSignatures = functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration_1)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration_1); // TODO: GH#18217 } else { signature = allSignatures[0]; } - if (functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */) { + if (functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */) { // show (constructor) Type(...) signature symbolKind = "constructor" /* ScriptElementKind.constructorImplementationElement */; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 174 /* SyntaxKind.CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 176 /* SyntaxKind.CallSignature */ && !(type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ || type.symbol.flags & 4096 /* SymbolFlags.ObjectLiteral */) ? type.symbol : symbol, symbolKind); } if (signature) { @@ -146986,7 +148491,7 @@ var ts; } if (symbolFlags & 32 /* SymbolFlags.Class */ && !hasAddedSymbolInfo && !isThisExpression) { addAliasPrefixIfNecessary(); - if (ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -147009,7 +148514,7 @@ var ts; } if ((symbolFlags & 524288 /* SymbolFlags.TypeAlias */) && (semanticMeaning & 2 /* SemanticMeaning.Type */)) { prefixNextMeaning(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -147030,9 +148535,9 @@ var ts; } if (symbolFlags & 1536 /* SymbolFlags.Module */ && !isThisExpression) { prefixNextMeaning(); - var declaration = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 264 /* SyntaxKind.ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 79 /* SyntaxKind.Identifier */; - displayParts.push(ts.keywordPart(isNamespace ? 142 /* SyntaxKind.NamespaceKeyword */ : 141 /* SyntaxKind.ModuleKeyword */)); + displayParts.push(ts.keywordPart(isNamespace ? 143 /* SyntaxKind.NamespaceKeyword */ : 142 /* SyntaxKind.ModuleKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } @@ -147051,7 +148556,7 @@ var ts; } else { // Method/function type parameter - var decl = ts.getDeclarationOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var decl = ts.getDeclarationOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (decl === undefined) return ts.Debug.fail(); var declaration = decl.parent; @@ -147059,21 +148564,21 @@ var ts; if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); // TODO: GH#18217 - if (declaration.kind === 175 /* SyntaxKind.ConstructSignature */) { + if (declaration.kind === 177 /* SyntaxKind.ConstructSignature */) { displayParts.push(ts.keywordPart(103 /* SyntaxKind.NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 174 /* SyntaxKind.CallSignature */ && declaration.name) { + else if (declaration.kind !== 176 /* SyntaxKind.CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* TypeFormatFlags.WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + else if (declaration.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path addInPrefix(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -147085,7 +148590,7 @@ var ts; symbolKind = "enum member" /* ScriptElementKind.enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]; - if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 299 /* SyntaxKind.EnumMember */) { + if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 302 /* SyntaxKind.EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -147121,17 +148626,17 @@ var ts; } if (symbol.declarations) { switch (symbol.declarations[0].kind) { - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(142 /* SyntaxKind.NamespaceKeyword */)); + displayParts.push(ts.keywordPart(143 /* SyntaxKind.NamespaceKeyword */)); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 63 /* SyntaxKind.EqualsToken */ : 88 /* SyntaxKind.DefaultKeyword */)); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); break; default: @@ -147141,13 +148646,13 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); displayParts.push(ts.operatorPart(63 /* SyntaxKind.EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(146 /* SyntaxKind.RequireKeyword */)); + displayParts.push(ts.keywordPart(147 /* SyntaxKind.RequireKeyword */)); displayParts.push(ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)); @@ -147177,16 +148682,18 @@ var ts; } // For properties, variables and local vars: show the type if (symbolKind === "property" /* ScriptElementKind.memberVariableElement */ || + symbolKind === "accessor" /* ScriptElementKind.memberAccessorVariableElement */ || symbolKind === "getter" /* ScriptElementKind.memberGetAccessorElement */ || symbolKind === "setter" /* ScriptElementKind.memberSetAccessorElement */ || symbolKind === "JSX attribute" /* ScriptElementKind.jsxAttribute */ || symbolFlags & 3 /* SymbolFlags.Variable */ || symbolKind === "local var" /* ScriptElementKind.localVariableElement */ || + symbolKind === "index" /* ScriptElementKind.indexSignatureElement */ || isThisExpression) { displayParts.push(ts.punctuationPart(58 /* SyntaxKind.ColonToken */)); displayParts.push(ts.spacePart()); // If the type is type parameter, format it specially - if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */) { + if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */ && symbolKind !== "index" /* ScriptElementKind.indexSignatureElement */) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { var param = typeChecker.typeParameterToDeclaration(type, enclosingDeclaration, symbolDisplayNodeBuilderFlags); getPrinter().writeNode(4 /* EmitHint.Unspecified */, param, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosingDeclaration)), writer); @@ -147230,10 +148737,10 @@ var ts; // For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 305 /* SyntaxKind.SourceFile */; })) { + if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 308 /* SyntaxKind.SourceFile */; })) { for (var _i = 0, _b = symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - if (!declaration.parent || declaration.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -147294,10 +148801,34 @@ var ts; displayParts.push(ts.spacePart()); } function addFullSymbolName(symbolToDisplay, enclosingDeclaration) { + var indexInfos; if (alias && symbolToDisplay === symbol) { symbolToDisplay = alias; } - var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + if (symbolKind === "index" /* ScriptElementKind.indexSignatureElement */) { + indexInfos = typeChecker.getIndexInfosOfIndexSymbol(symbolToDisplay); + } + var fullSymbolDisplayParts = []; + if (symbolToDisplay.flags & 131072 /* SymbolFlags.Signature */ && indexInfos) { + if (symbolToDisplay.parent) { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay.parent); + } + fullSymbolDisplayParts.push(ts.punctuationPart(22 /* SyntaxKind.OpenBracketToken */)); + //Needed to handle more than one type of index + indexInfos.forEach(function (info, i) { + //Needed to handle template literals + fullSymbolDisplayParts.push.apply(fullSymbolDisplayParts, ts.typeToDisplayParts(typeChecker, info.keyType)); + if (i !== indexInfos.length - 1) { + fullSymbolDisplayParts.push(ts.spacePart()); + fullSymbolDisplayParts.push(ts.punctuationPart(51 /* SyntaxKind.BarToken */)); + fullSymbolDisplayParts.push(ts.spacePart()); + } + }); + fullSymbolDisplayParts.push(ts.punctuationPart(23 /* SyntaxKind.CloseBracketToken */)); + } + else { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + } ts.addRange(displayParts, fullSymbolDisplayParts); if (symbol.flags & 16777216 /* SymbolFlags.Optional */) { displayParts.push(ts.punctuationPart(57 /* SyntaxKind.QuestionToken */)); @@ -147345,7 +148876,7 @@ var ts; tags = signature.getJsDocTags(); if (allSignatures.length > 1 && documentation.length === 0 && tags.length === 0) { documentation = allSignatures[0].getDocumentationComment(typeChecker); - tags = allSignatures[0].getJsDocTags(); + tags = allSignatures[0].getJsDocTags().filter(function (tag) { return tag.name !== "deprecated"; }); // should only include @deprecated JSDoc tag on the first overload (#49368) } } function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { @@ -147363,16 +148894,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (declaration.kind === 215 /* SyntaxKind.FunctionExpression */) { return true; } - if (declaration.kind !== 254 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */) { + if (declaration.kind !== 257 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block - if (parent.kind === 305 /* SyntaxKind.SourceFile */ || parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ || parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return false; } } @@ -147677,10 +149208,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 285 /* SyntaxKind.JsxAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 288 /* SyntaxKind.JsxAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // May parse an identifier like `module-layout`; that will be scanned as a keyword at first, but we should parse the whole thing to get an identifier. return ts.isKeyword(node.kind) || node.kind === 79 /* SyntaxKind.Identifier */; } @@ -147688,7 +149219,7 @@ var ts; return false; } function shouldRescanJsxText(node) { - return ts.isJsxText(node); + return ts.isJsxText(node) || ts.isJsxElement(node) && (lastTokenInfo === null || lastTokenInfo === void 0 ? void 0 : lastTokenInfo.token.kind) === 11 /* SyntaxKind.JsxText */; } function shouldRescanSlashToken(container) { return container.kind === 13 /* SyntaxKind.RegularExpressionLiteral */; @@ -147873,7 +149404,7 @@ var ts; (function (formatting) { function getAllRules() { var allTokens = []; - for (var token = 0 /* SyntaxKind.FirstToken */; token <= 160 /* SyntaxKind.LastToken */; token++) { + for (var token = 0 /* SyntaxKind.FirstToken */; token <= 162 /* SyntaxKind.LastToken */; token++) { if (token !== 1 /* SyntaxKind.EndOfFileToken */) { allTokens.push(token); } @@ -147888,9 +149419,9 @@ var ts; var anyToken = { tokens: allTokens, isSpecific: false }; var anyTokenIncludingMultilineComments = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [3 /* SyntaxKind.MultiLineCommentTrivia */], false)); var anyTokenIncludingEOF = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [1 /* SyntaxKind.EndOfFileToken */], false)); - var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 160 /* SyntaxKind.LastKeyword */); + var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 162 /* SyntaxKind.LastKeyword */); var binaryOperators = tokenRangeFromRange(29 /* SyntaxKind.FirstBinaryOperator */, 78 /* SyntaxKind.LastBinaryOperator */); - var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 160 /* SyntaxKind.OfKeyword */, 127 /* SyntaxKind.AsKeyword */, 139 /* SyntaxKind.IsKeyword */]; + var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 162 /* SyntaxKind.OfKeyword */, 128 /* SyntaxKind.AsKeyword */, 140 /* SyntaxKind.IsKeyword */]; var unaryPrefixOperators = [45 /* SyntaxKind.PlusPlusToken */, 46 /* SyntaxKind.MinusMinusToken */, 54 /* SyntaxKind.TildeToken */, 53 /* SyntaxKind.ExclamationToken */]; var unaryPrefixExpressions = [ 8 /* SyntaxKind.NumericLiteral */, 9 /* SyntaxKind.BigIntLiteral */, 79 /* SyntaxKind.Identifier */, 20 /* SyntaxKind.OpenParenToken */, @@ -147921,7 +149452,7 @@ var ts; rule("SpaceAfterQuestionMarkInConditionalOperator", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext, isConditionalOperatorContext], 4 /* RuleAction.InsertSpace */), // in other cases there should be no space between '?' and next token rule("NoSpaceAfterQuestionMark", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext, isNotPropertyAccessOnIntegerLiteral], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterDot", [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceBetweenImportParenInImportType", 100 /* SyntaxKind.ImportKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 16 /* RuleAction.DeleteSpace */), // Special handling of unary operators. @@ -147964,11 +149495,11 @@ var ts; // Though, we do extra check on the context to make sure we are dealing with get/set node. Example: // get x() {} // set x(val) {} - rule("SpaceAfterGetSetInMember", [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterGetSetInMember", [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenYieldKeywordAndStar", 125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 16 /* RuleAction.DeleteSpace */), rule("SpaceBetweenYieldOrYieldStarAndOperand", [125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenReturnAndSemicolon", 105 /* SyntaxKind.ReturnKeyword */, 26 /* SyntaxKind.SemicolonToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 132 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 133 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterLetConstInVariableDeclaration", [119 /* SyntaxKind.LetKeyword */, 85 /* SyntaxKind.ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBeforeOpenParenInFuncCall", anyToken, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], 16 /* RuleAction.DeleteSpace */), // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. @@ -147976,8 +149507,8 @@ var ts; rule("SpaceAfterBinaryKeywordOperator", binaryKeywordOperators, anyToken, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterVoidOperator", 114 /* SyntaxKind.VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 4 /* RuleAction.InsertSpace */), // Async-await - rule("SpaceBetweenAsyncAndOpenParen", 131 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBetweenAsyncAndFunctionKeyword", 131 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndOpenParen", 132 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndFunctionKeyword", 132 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Template string rule("NoSpaceBetweenTagAndTemplateString", [79 /* SyntaxKind.Identifier */, 21 /* SyntaxKind.CloseParenToken */], [14 /* SyntaxKind.NoSubstitutionTemplateLiteral */, 15 /* SyntaxKind.TemplateHead */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // JSX opening elements @@ -147988,34 +149519,35 @@ var ts; rule("NoSpaceAfterEqualInJsxAttribute", 63 /* SyntaxKind.EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // TypeScript-specific rules // Use of module as a function call. e.g.: import m2 = module("m2"); - rule("NoSpaceAfterModuleImport", [141 /* SyntaxKind.ModuleKeyword */, 146 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceAfterModuleImport", [142 /* SyntaxKind.ModuleKeyword */, 147 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // Add a space around certain TypeScript keywords rule("SpaceAfterCertainTypeScriptKeywords", [ 126 /* SyntaxKind.AbstractKeyword */, + 127 /* SyntaxKind.AccessorKeyword */, 84 /* SyntaxKind.ClassKeyword */, - 135 /* SyntaxKind.DeclareKeyword */, + 136 /* SyntaxKind.DeclareKeyword */, 88 /* SyntaxKind.DefaultKeyword */, 92 /* SyntaxKind.EnumKeyword */, 93 /* SyntaxKind.ExportKeyword */, 94 /* SyntaxKind.ExtendsKeyword */, - 136 /* SyntaxKind.GetKeyword */, + 137 /* SyntaxKind.GetKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 100 /* SyntaxKind.ImportKeyword */, 118 /* SyntaxKind.InterfaceKeyword */, - 141 /* SyntaxKind.ModuleKeyword */, - 142 /* SyntaxKind.NamespaceKeyword */, + 142 /* SyntaxKind.ModuleKeyword */, + 143 /* SyntaxKind.NamespaceKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 123 /* SyntaxKind.PublicKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 151 /* SyntaxKind.SetKeyword */, 124 /* SyntaxKind.StaticKeyword */, - 152 /* SyntaxKind.TypeKeyword */, - 156 /* SyntaxKind.FromKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 137 /* SyntaxKind.InferKeyword */, + 154 /* SyntaxKind.TypeKeyword */, + 158 /* SyntaxKind.FromKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 138 /* SyntaxKind.InferKeyword */, ], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 156 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 158 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { rule("SpaceAfterModuleName", 10 /* SyntaxKind.StringLiteral */, 18 /* SyntaxKind.OpenBraceToken */, [isModuleDeclContext], 4 /* RuleAction.InsertSpace */), // Lambda expressions @@ -148046,8 +149578,8 @@ var ts; 123 /* SyntaxKind.PublicKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 136 /* SyntaxKind.GetKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 137 /* SyntaxKind.GetKeyword */, + 151 /* SyntaxKind.SetKeyword */, 22 /* SyntaxKind.OpenBracketToken */, 41 /* SyntaxKind.AsteriskToken */, ], [isEndOfDecoratorContextOnSameLine], 4 /* RuleAction.InsertSpace */), @@ -148058,8 +149590,8 @@ var ts; // These rules are applied after high priority var userConfigurableRules = [ // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - rule("SpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("NoSpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("SpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("NoSpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket, isNextTokenNotCloseParen], 4 /* RuleAction.InsertSpace */), rule("NoSpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], 16 /* RuleAction.DeleteSpace */), // Insert space after function keyword for anonymous functions @@ -148133,11 +149665,11 @@ var ts; rule("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 18 /* SyntaxKind.OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 4 /* RuleAction.InsertSpace */, 1 /* RuleFlags.CanDeleteNewLines */), rule("NoSpaceBeforeComma", anyToken, 27 /* SyntaxKind.CommaToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // No space before and after indexer `x[]` - rule("NoSpaceBeforeOpenBracket", anyTokenExcept(131 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeOpenBracket", anyTokenExcept(132 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterCloseBracket", 23 /* SyntaxKind.CloseBracketToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterSemicolon", 26 /* SyntaxKind.SemicolonToken */, anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Remove extra space between for and await - rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 132 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 133 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] rule("SpaceBetweenStatements", [21 /* SyntaxKind.CloseParenToken */, 90 /* SyntaxKind.DoKeyword */, 91 /* SyntaxKind.ElseKeyword */, 82 /* SyntaxKind.CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 4 /* RuleAction.InsertSpace */), @@ -148186,69 +149718,70 @@ var ts; return function (context) { return context.options && context.options[optionName] === optionValue; }; } function isOptionEnabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !!context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !!context.options[optionName]; }; } function isOptionDisabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !context.options[optionName]; }; } function isOptionDisabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName]; }; } function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; } function isOptionEnabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !!context.options[optionName]; }; } function isForContext(context) { - return context.contextNode.kind === 242 /* SyntaxKind.ForStatement */; + return context.contextNode.kind === 245 /* SyntaxKind.ForStatement */; } function isNotForContext(context) { return !isForContext(context); } function isBinaryOpContext(context) { switch (context.contextNode.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return context.contextNode.operatorToken.kind !== 27 /* SyntaxKind.CommaToken */; - case 222 /* SyntaxKind.ConditionalExpression */: - case 189 /* SyntaxKind.ConditionalType */: - case 229 /* SyntaxKind.AsExpression */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 177 /* SyntaxKind.TypePredicate */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 191 /* SyntaxKind.ConditionalType */: + case 231 /* SyntaxKind.AsExpression */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 179 /* SyntaxKind.TypePredicate */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // equals in type X = ... // falls through - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // equal in import a = module('a'); // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // equal in export = 1 // falls through - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // equal in let a = 0 // falls through - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // equal in p = 0 // falls through - case 164 /* SyntaxKind.Parameter */: - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // "in" keyword in for (let x in []) { } - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // "in" keyword in [P in keyof T]: T[P] // falls through - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return context.currentTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.nextTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 244 /* SyntaxKind.ForOfStatement */: - return context.currentTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */; + case 247 /* SyntaxKind.ForOfStatement */: + return context.currentTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */; } return false; } @@ -148260,22 +149793,22 @@ var ts; } function isTypeAnnotationContext(context) { var contextKind = context.contextNode.kind; - return contextKind === 167 /* SyntaxKind.PropertyDeclaration */ || - contextKind === 166 /* SyntaxKind.PropertySignature */ || - contextKind === 164 /* SyntaxKind.Parameter */ || - contextKind === 254 /* SyntaxKind.VariableDeclaration */ || + return contextKind === 169 /* SyntaxKind.PropertyDeclaration */ || + contextKind === 168 /* SyntaxKind.PropertySignature */ || + contextKind === 166 /* SyntaxKind.Parameter */ || + contextKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(contextKind); } function isConditionalOperatorContext(context) { - return context.contextNode.kind === 222 /* SyntaxKind.ConditionalExpression */ || - context.contextNode.kind === 189 /* SyntaxKind.ConditionalType */; + return context.contextNode.kind === 224 /* SyntaxKind.ConditionalExpression */ || + context.contextNode.kind === 191 /* SyntaxKind.ConditionalType */; } function isSameLineTokenOrBeforeBlockContext(context) { return context.TokensAreOnSameLine() || isBeforeBlockContext(context); } function isBraceWrappedContext(context) { - return context.contextNode.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || - context.contextNode.kind === 195 /* SyntaxKind.MappedType */ || + return context.contextNode.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || + context.contextNode.kind === 197 /* SyntaxKind.MappedType */ || isSingleLineBlockContext(context); } // This check is done before an open brace in a control construct, a function, or a typescript block declaration @@ -148301,34 +149834,34 @@ var ts; return true; } switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 265 /* SyntaxKind.ModuleBlock */: return true; } return false; } function isFunctionDeclContext(context) { switch (context.contextNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: // falls through - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // case SyntaxKind.MethodSignature: // falls through - case 174 /* SyntaxKind.CallSignature */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: // falls through - case 258 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one + case 261 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one return true; } return false; @@ -148337,40 +149870,40 @@ var ts; return !isFunctionDeclContext(context); } function isFunctionDeclarationOrFunctionExpressionContext(context) { - return context.contextNode.kind === 256 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 213 /* SyntaxKind.FunctionExpression */; + return context.contextNode.kind === 259 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 215 /* SyntaxKind.FunctionExpression */; } function isTypeScriptDeclWithBlockContext(context) { return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 273 /* SyntaxKind.NamedExports */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 269 /* SyntaxKind.NamedImports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 276 /* SyntaxKind.NamedExports */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 272 /* SyntaxKind.NamedImports */: return true; } return false; } function isAfterCodeBlockContext(context) { switch (context.currentTokenParent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 292 /* SyntaxKind.CatchClause */: - case 262 /* SyntaxKind.ModuleBlock */: - case 249 /* SyntaxKind.SwitchStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 295 /* SyntaxKind.CatchClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 252 /* SyntaxKind.SwitchStatement */: return true; - case 235 /* SyntaxKind.Block */: { + case 238 /* SyntaxKind.Block */: { var blockParent = context.currentTokenParent.parent; // In a codefix scenario, we can't rely on parents being set. So just always return true. - if (!blockParent || blockParent.kind !== 214 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (!blockParent || blockParent.kind !== 216 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 215 /* SyntaxKind.FunctionExpression */) { return true; } } @@ -148379,32 +149912,32 @@ var ts; } function isControlDeclContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 248 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 251 /* SyntaxKind.WithStatement */: // TODO // case SyntaxKind.ElseClause: // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return true; default: return false; } } function isObjectContext(context) { - return context.contextNode.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return context.contextNode.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } function isFunctionCallContext(context) { - return context.contextNode.kind === 208 /* SyntaxKind.CallExpression */; + return context.contextNode.kind === 210 /* SyntaxKind.CallExpression */; } function isNewContext(context) { - return context.contextNode.kind === 209 /* SyntaxKind.NewExpression */; + return context.contextNode.kind === 211 /* SyntaxKind.NewExpression */; } function isFunctionCallOrNewContext(context) { return isFunctionCallContext(context) || isNewContext(context); @@ -148419,10 +149952,10 @@ var ts; return context.nextTokenSpan.kind !== 21 /* SyntaxKind.CloseParenToken */; } function isArrowFunctionContext(context) { - return context.contextNode.kind === 214 /* SyntaxKind.ArrowFunction */; + return context.contextNode.kind === 216 /* SyntaxKind.ArrowFunction */; } function isImportTypeContext(context) { - return context.contextNode.kind === 200 /* SyntaxKind.ImportType */; + return context.contextNode.kind === 202 /* SyntaxKind.ImportType */; } function isNonJsxSameLineTokenContext(context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; @@ -148431,19 +149964,19 @@ var ts; return context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; } function isNonJsxElementOrFragmentContext(context) { - return context.contextNode.kind !== 278 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 282 /* SyntaxKind.JsxFragment */; + return context.contextNode.kind !== 281 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 285 /* SyntaxKind.JsxFragment */; } function isJsxExpressionContext(context) { - return context.contextNode.kind === 288 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return context.contextNode.kind === 291 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } function isNextTokenParentJsxAttribute(context) { - return context.nextTokenParent.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.nextTokenParent.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxAttributeContext(context) { - return context.contextNode.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.contextNode.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxSelfClosingElementContext(context) { - return context.contextNode.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return context.contextNode.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } function isNotBeforeBlockInFunctionDeclarationContext(context) { return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); @@ -148455,48 +149988,48 @@ var ts; !nodeIsInDecoratorContext(context.nextTokenParent); } function nodeIsInDecoratorContext(node) { - while (ts.isExpressionNode(node)) { + while (node && ts.isExpression(node)) { node = node.parent; } - return node.kind === 165 /* SyntaxKind.Decorator */; + return node && node.kind === 167 /* SyntaxKind.Decorator */; } function isStartOfVariableDeclarationList(context) { - return context.currentTokenParent.kind === 255 /* SyntaxKind.VariableDeclarationList */ && + return context.currentTokenParent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } function isNotFormatOnEnter(context) { return context.formattingRequestKind !== 2 /* FormattingRequestKind.FormatOnEnter */; } function isModuleDeclContext(context) { - return context.contextNode.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return context.contextNode.kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isObjectTypeContext(context) { - return context.contextNode.kind === 182 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 184 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; } function isConstructorSignatureContext(context) { - return context.contextNode.kind === 175 /* SyntaxKind.ConstructSignature */; + return context.contextNode.kind === 177 /* SyntaxKind.ConstructSignature */; } function isTypeArgumentOrParameterOrAssertion(token, parent) { if (token.kind !== 29 /* SyntaxKind.LessThanToken */ && token.kind !== 31 /* SyntaxKind.GreaterThanToken */) { return false; } switch (parent.kind) { - case 178 /* SyntaxKind.TypeReference */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return true; default: return false; @@ -148507,28 +150040,28 @@ var ts; isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); } function isTypeAssertionContext(context) { - return context.contextNode.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return context.contextNode.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } function isVoidOpContext(context) { - return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 217 /* SyntaxKind.VoidExpression */; + return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 219 /* SyntaxKind.VoidExpression */; } function isYieldOrYieldStarWithOperand(context) { - return context.contextNode.kind === 224 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 226 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; } function isNonNullAssertionContext(context) { - return context.contextNode.kind === 230 /* SyntaxKind.NonNullExpression */; + return context.contextNode.kind === 232 /* SyntaxKind.NonNullExpression */; } function isNotStatementConditionContext(context) { return !isStatementConditionContext(context); } function isStatementConditionContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; default: return false; @@ -148553,12 +150086,12 @@ var ts; return nextTokenKind === 19 /* SyntaxKind.CloseBraceToken */ || nextTokenKind === 1 /* SyntaxKind.EndOfFileToken */; } - if (nextTokenKind === 234 /* SyntaxKind.SemicolonClassElement */ || + if (nextTokenKind === 237 /* SyntaxKind.SemicolonClassElement */ || nextTokenKind === 26 /* SyntaxKind.SemicolonToken */) { return false; } - if (context.contextNode.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - context.contextNode.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (context.contextNode.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + context.contextNode.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Can’t remove semicolon after `foo`; it would parse as a method declaration: // // interface I { @@ -148572,9 +150105,9 @@ var ts; if (ts.isPropertyDeclaration(context.currentTokenParent)) { return !context.currentTokenParent.initializer; } - return context.currentTokenParent.kind !== 242 /* SyntaxKind.ForStatement */ - && context.currentTokenParent.kind !== 236 /* SyntaxKind.EmptyStatement */ - && context.currentTokenParent.kind !== 234 /* SyntaxKind.SemicolonClassElement */ + return context.currentTokenParent.kind !== 245 /* SyntaxKind.ForStatement */ + && context.currentTokenParent.kind !== 239 /* SyntaxKind.EmptyStatement */ + && context.currentTokenParent.kind !== 237 /* SyntaxKind.SemicolonClassElement */ && nextTokenKind !== 22 /* SyntaxKind.OpenBracketToken */ && nextTokenKind !== 20 /* SyntaxKind.OpenParenToken */ && nextTokenKind !== 39 /* SyntaxKind.PlusToken */ @@ -148582,7 +150115,7 @@ var ts; && nextTokenKind !== 43 /* SyntaxKind.SlashToken */ && nextTokenKind !== 13 /* SyntaxKind.RegularExpressionLiteral */ && nextTokenKind !== 27 /* SyntaxKind.CommaToken */ - && nextTokenKind !== 223 /* SyntaxKind.TemplateExpression */ + && nextTokenKind !== 225 /* SyntaxKind.TemplateExpression */ && nextTokenKind !== 15 /* SyntaxKind.TemplateHead */ && nextTokenKind !== 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */ && nextTokenKind !== 24 /* SyntaxKind.DotToken */; @@ -148590,6 +150123,11 @@ var ts; function isSemicolonInsertionContext(context) { return ts.positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile); } + function isNotPropertyAccessOnIntegerLiteral(context) { + return !ts.isPropertyAccessExpression(context.contextNode) + || !ts.isNumericLiteral(context.contextNode.expression) + || context.contextNode.expression.getText().indexOf(".") !== -1; + } })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); /* @internal */ @@ -148673,12 +150211,12 @@ var ts; return map; } function getRuleBucketIndex(row, column) { - ts.Debug.assert(row <= 160 /* SyntaxKind.LastKeyword */ && column <= 160 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 162 /* SyntaxKind.LastKeyword */ && column <= 162 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); return (row * mapRowLength) + column; } var maskBitSize = 5; var mask = 31; // MaskBitSize bits - var mapRowLength = 160 /* SyntaxKind.LastToken */ + 1; + var mapRowLength = 162 /* SyntaxKind.LastToken */ + 1; var RulesPosition; (function (RulesPosition) { RulesPosition[RulesPosition["StopRulesSpecific"] = 0] = "StopRulesSpecific"; @@ -148866,17 +150404,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var body = parent.body; - return !!body && body.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + return !!body && body.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -149139,19 +150677,19 @@ var ts; return modifier.kind; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; - case 256 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; - case 260 /* SyntaxKind.EnumDeclaration */: return 260 /* SyntaxKind.EnumDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: return 136 /* SyntaxKind.GetKeyword */; - case 173 /* SyntaxKind.SetAccessor */: return 149 /* SyntaxKind.SetKeyword */; - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; + case 261 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; + case 259 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; + case 263 /* SyntaxKind.EnumDeclaration */: return 263 /* SyntaxKind.EnumDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: return 137 /* SyntaxKind.GetKeyword */; + case 175 /* SyntaxKind.SetAccessor */: return 151 /* SyntaxKind.SetKeyword */; + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { return 41 /* SyntaxKind.AsteriskToken */; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: var name = ts.getNameOfDeclaration(node); if (name) { return name.kind; @@ -149208,15 +150746,15 @@ var ts; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: switch (container.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return false; } break; case 22 /* SyntaxKind.OpenBracketToken */: case 23 /* SyntaxKind.CloseBracketToken */: - if (container.kind !== 195 /* SyntaxKind.MappedType */) { + if (container.kind !== 197 /* SyntaxKind.MappedType */) { return false; } break; @@ -149320,11 +150858,11 @@ var ts; return inheritedIndentation; } } - var effectiveParentStartLine = child.kind === 165 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 167 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { + if (isFirstListItem && parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -149782,18 +151320,18 @@ var ts; formatting.getRangeOfEnclosingComment = getRangeOfEnclosingComment; function getOpenTokenForList(node, list) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -149801,8 +151339,8 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -149810,24 +151348,24 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 178 /* SyntaxKind.TypeReference */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 181 /* SyntaxKind.TypeQuery */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 200 /* SyntaxKind.ImportType */: + case 180 /* SyntaxKind.TypeReference */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 183 /* SyntaxKind.TypeQuery */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 202 /* SyntaxKind.ImportType */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return 18 /* SyntaxKind.OpenBraceToken */; } return 0 /* SyntaxKind.Unknown */; @@ -149963,11 +151501,11 @@ var ts; // y: undefined, // } // ``` - var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; if (options.indentStyle === ts.IndentStyle.Block || isObjectLiteral) { return getBlockIndent(sourceFile, position, options); } - if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Value.Unknown */) { @@ -149977,7 +151515,7 @@ var ts; var containerList = getListByPosition(position, precedingToken.parent, sourceFile); // use list position if the preceding token is before any list items if (containerList && !ts.rangeContainsRange(containerList, precedingToken)) { - var useTheSameBaseIndentation = [213 /* SyntaxKind.FunctionExpression */, 214 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; + var useTheSameBaseIndentation = [215 /* SyntaxKind.FunctionExpression */, 216 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; var indentSize = useTheSameBaseIndentation ? 0 : options.indentSize; return getActualIndentationForListStartLine(containerList, sourceFile, options) + indentSize; // TODO: GH#18217 } @@ -150142,7 +151680,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 305 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); + (parent.kind === 308 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Value.Unknown */; } @@ -150190,7 +151728,7 @@ var ts; } SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 239 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 242 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 91 /* SyntaxKind.ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -150271,42 +151809,42 @@ var ts; } function getListByRange(start, end, node, sourceFile) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getList(node.typeArguments); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return getList(node.properties); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getList(node.elements); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return getList(node.members); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return getList(node.typeParameters) || getList(node.parameters); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return getList(node.parameters); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return getList(node.typeParameters); - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: return getList(node.typeArguments) || getList(node.arguments); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return getList(node.declarations); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return getList(node.elements); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return getList(node.elements); } function getList(list) { @@ -150329,7 +151867,7 @@ var ts; return findColumnForFirstNonWhitespaceCharacterInLine(sourceFile.getLineAndCharacterOfPosition(list.pos), sourceFile, options); } function getActualIndentationForListItem(node, sourceFile, options, listIndentsChild) { - if (node.parent && node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.parent && node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // VariableDeclarationList has no wrapping tokens return -1 /* Value.Unknown */; } @@ -150402,96 +151940,96 @@ var ts; function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) { var childKind = child ? child.kind : 0 /* SyntaxKind.Unknown */; switch (parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 195 /* SyntaxKind.MappedType */: - case 184 /* SyntaxKind.TupleType */: - case 263 /* SyntaxKind.CaseBlock */: - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 237 /* SyntaxKind.VariableStatement */: - case 271 /* SyntaxKind.ExportAssignment */: - case 247 /* SyntaxKind.ReturnStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 288 /* SyntaxKind.JsxExpression */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 164 /* SyntaxKind.Parameter */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 273 /* SyntaxKind.NamedExports */: - case 269 /* SyntaxKind.NamedImports */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 197 /* SyntaxKind.MappedType */: + case 186 /* SyntaxKind.TupleType */: + case 266 /* SyntaxKind.CaseBlock */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 240 /* SyntaxKind.VariableStatement */: + case 274 /* SyntaxKind.ExportAssignment */: + case 250 /* SyntaxKind.ReturnStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 291 /* SyntaxKind.JsxExpression */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 166 /* SyntaxKind.Parameter */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 276 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: - if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 205 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 + case 257 /* SyntaxKind.VariableDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: + if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 return rangeIsOnOneLine(sourceFile, child); } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 278 /* SyntaxKind.JsxElement */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 281 /* SyntaxKind.JsxElement */) { var parentStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, parent.pos)).line; var childStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, child.pos)).line; return parentStartLine !== childStartLine; } - if (parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { return true; } break; - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return childKind !== 235 /* SyntaxKind.Block */; - case 214 /* SyntaxKind.ArrowFunction */: - if (sourceFile && childKind === 212 /* SyntaxKind.ParenthesizedExpression */) { + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return childKind !== 238 /* SyntaxKind.Block */; + case 216 /* SyntaxKind.ArrowFunction */: + if (sourceFile && childKind === 214 /* SyntaxKind.ParenthesizedExpression */) { return rangeIsOnOneLine(sourceFile, child); } - return childKind !== 235 /* SyntaxKind.Block */; - case 272 /* SyntaxKind.ExportDeclaration */: - return childKind !== 273 /* SyntaxKind.NamedExports */; - case 266 /* SyntaxKind.ImportDeclaration */: - return childKind !== 267 /* SyntaxKind.ImportClause */ || - (!!child.namedBindings && child.namedBindings.kind !== 269 /* SyntaxKind.NamedImports */); - case 278 /* SyntaxKind.JsxElement */: - return childKind !== 281 /* SyntaxKind.JsxClosingElement */; - case 282 /* SyntaxKind.JsxFragment */: - return childKind !== 284 /* SyntaxKind.JsxClosingFragment */; - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: - if (childKind === 182 /* SyntaxKind.TypeLiteral */ || childKind === 184 /* SyntaxKind.TupleType */) { + return childKind !== 238 /* SyntaxKind.Block */; + case 275 /* SyntaxKind.ExportDeclaration */: + return childKind !== 276 /* SyntaxKind.NamedExports */; + case 269 /* SyntaxKind.ImportDeclaration */: + return childKind !== 270 /* SyntaxKind.ImportClause */ || + (!!child.namedBindings && child.namedBindings.kind !== 272 /* SyntaxKind.NamedImports */); + case 281 /* SyntaxKind.JsxElement */: + return childKind !== 284 /* SyntaxKind.JsxClosingElement */; + case 285 /* SyntaxKind.JsxFragment */: + return childKind !== 287 /* SyntaxKind.JsxClosingFragment */; + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + if (childKind === 184 /* SyntaxKind.TypeLiteral */ || childKind === 186 /* SyntaxKind.TupleType */) { return false; } break; @@ -150502,11 +152040,11 @@ var ts; SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; function isControlFlowEndingStatement(kind, parent) { switch (kind) { - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return parent.kind !== 235 /* SyntaxKind.Block */; + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + return parent.kind !== 238 /* SyntaxKind.Block */; default: return false; } @@ -150723,7 +152261,7 @@ var ts; * Checks if 'candidate' argument is a legal separator in the list that contains 'node' as an element */ function isSeparator(node, candidate) { - return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)); + return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)); } function isThisTypeAnnotatable(containingFunction) { return ts.isFunctionExpression(containingFunction) || ts.isFunctionDeclaration(containingFunction); @@ -150955,7 +152493,7 @@ var ts; } } else { - endNode = (_a = (node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; + endNode = (_a = (node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; } this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " }); return true; @@ -151121,18 +152659,18 @@ var ts; }; ChangeTracker.prototype.getInsertNodeAfterOptionsWorker = function (node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return { prefix: this.newLineCharacter, suffix: this.newLineCharacter }; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: case 10 /* SyntaxKind.StringLiteral */: case 79 /* SyntaxKind.Identifier */: return { prefix: ", " }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return { suffix: "," + this.newLineCharacter }; case 93 /* SyntaxKind.ExportKeyword */: return { prefix: " " }; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return {}; default: ts.Debug.assert(ts.isStatement(node) || ts.isClassOrTypeElement(node)); // Else we haven't handled this kind of node yet -- add it @@ -151141,7 +152679,7 @@ var ts; }; ChangeTracker.prototype.insertName = function (sourceFile, node, name) { ts.Debug.assert(!node.name); - if (node.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind === 216 /* SyntaxKind.ArrowFunction */) { var arrow = ts.findChildOfKind(node, 38 /* SyntaxKind.EqualsGreaterThanToken */, sourceFile); var lparen = ts.findChildOfKind(node, 20 /* SyntaxKind.OpenParenToken */, sourceFile); if (lparen) { @@ -151155,14 +152693,14 @@ var ts; // Replacing full range of arrow to get rid of the leading space -- replace ` =>` with `)` this.replaceRange(sourceFile, arrow, ts.factory.createToken(21 /* SyntaxKind.CloseParenToken */)); } - if (node.body.kind !== 235 /* SyntaxKind.Block */) { + if (node.body.kind !== 238 /* SyntaxKind.Block */) { // `() => 0` => `function f() { return 0; }` this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.factory.createToken(18 /* SyntaxKind.OpenBraceToken */), ts.factory.createToken(105 /* SyntaxKind.ReturnKeyword */)], { joiner: " ", suffix: " " }); this.insertNodesAt(sourceFile, node.body.end, [ts.factory.createToken(26 /* SyntaxKind.SemicolonToken */), ts.factory.createToken(19 /* SyntaxKind.CloseBraceToken */)], { joiner: " " }); } } else { - var pos = ts.findChildOfKind(node, node.kind === 213 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; + var pos = ts.findChildOfKind(node, node.kind === 215 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; this.insertNodeAt(sourceFile, pos, ts.factory.createIdentifier(name), { prefix: " " }); } }; @@ -151339,10 +152877,10 @@ var ts; }()); textChanges_3.ChangeTracker = ChangeTracker; function updateJSDocHost(parent) { - if (parent.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (parent.kind !== 216 /* SyntaxKind.ArrowFunction */) { return parent; } - var jsDocNode = parent.parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ ? + var jsDocNode = parent.parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ ? parent.parent : parent.parent.parent; jsDocNode.jsDoc = parent.jsDoc; @@ -151354,16 +152892,16 @@ var ts; return undefined; } switch (oldTag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 343 /* SyntaxKind.JSDocParameterTag */: { var oldParam = oldTag; var newParam = newTag; return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText ? ts.factory.createJSDocParameterTag(/*tagName*/ undefined, newParam.name, /*isBracketed*/ false, newParam.typeExpression, newParam.isNameFirst, oldParam.comment) : undefined; } - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: return ts.factory.createJSDocReturnTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return ts.factory.createJSDocTypeTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); } } @@ -151371,6 +152909,26 @@ var ts; function startPositionToDeleteNodeInList(sourceFile, node) { return ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, { leadingTriviaOption: LeadingTriviaOption.IncludeAll }), /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); } + function endPositionToDeleteNodeInList(sourceFile, node, prevNode, nextNode) { + var end = startPositionToDeleteNodeInList(sourceFile, nextNode); + if (prevNode === undefined || ts.positionsAreOnSameLine(getAdjustedEndPosition(sourceFile, node, {}), end, sourceFile)) { + return end; + } + var token = ts.findPrecedingToken(nextNode.getStart(sourceFile), sourceFile); + if (isSeparator(node, token)) { + var prevToken = ts.findPrecedingToken(node.getStart(sourceFile), sourceFile); + if (isSeparator(prevNode, prevToken)) { + var pos = ts.skipTrivia(sourceFile.text, token.getEnd(), /*stopAfterLineBreak*/ true, /*stopAtComments*/ true); + if (ts.positionsAreOnSameLine(prevToken.getStart(sourceFile), token.getStart(sourceFile), sourceFile)) { + return ts.isLineBreak(sourceFile.text.charCodeAt(pos - 1)) ? pos - 1 : pos; + } + if (ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + return pos; + } + } + } + return end; + } function getClassOrObjectBraceEnds(cls, sourceFile) { var open = ts.findChildOfKind(cls, 18 /* SyntaxKind.OpenBraceToken */, sourceFile); var close = ts.findChildOfKind(cls, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); @@ -151757,14 +153315,14 @@ var ts; } textChanges_3.isValidLocationToAddComment = isValidLocationToAddComment; function needSemicolonBetween(a, b) { - return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[` } var deleteDeclaration; (function (deleteDeclaration_1) { function deleteDeclaration(changes, deletedNodesInLists, sourceFile, node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: { + case 166 /* SyntaxKind.Parameter */: { var oldFunction = node.parent; if (ts.isArrowFunction(oldFunction) && oldFunction.parameters.length === 1 && @@ -151779,17 +153337,17 @@ var ts; } break; } - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var isFirstImport = sourceFile.imports.length && node === ts.first(sourceFile.imports).parent || node === ts.find(sourceFile.statements, ts.isAnyImportSyntax); // For first import, leave header comment in place, otherwise only delete JSDoc comments deleteNode(changes, sourceFile, node, { leadingTriviaOption: isFirstImport ? LeadingTriviaOption.Exclude : ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine, }); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: var pattern = node.parent; - var preserveComma = pattern.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); + var preserveComma = pattern.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); if (preserveComma) { deleteNode(changes, sourceFile, node); } @@ -151797,13 +153355,13 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: var namedImports = node.parent; if (namedImports.elements.length === 1) { deleteImportBinding(changes, sourceFile, namedImports); @@ -151812,7 +153370,7 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: deleteImportBinding(changes, sourceFile, node); break; case 26 /* SyntaxKind.SemicolonToken */: @@ -151821,8 +153379,8 @@ var ts; case 98 /* SyntaxKind.FunctionKeyword */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: LeadingTriviaOption.Exclude }); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -151873,13 +153431,13 @@ var ts; // Delete the entire import declaration // |import * as ns from './file'| // |import { a } from './file'| - var importDecl = ts.getAncestor(node, 266 /* SyntaxKind.ImportDeclaration */); + var importDecl = ts.getAncestor(node, 269 /* SyntaxKind.ImportDeclaration */); deleteNode(changes, sourceFile, importDecl); } } function deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node) { var parent = node.parent; - if (parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (parent.kind === 295 /* SyntaxKind.CatchClause */) { // TODO: There's currently no unused diagnostic for this, could be a suggestion changes.deleteNodeRange(sourceFile, ts.findChildOfKind(parent, 20 /* SyntaxKind.OpenParenToken */, sourceFile), ts.findChildOfKind(parent, 21 /* SyntaxKind.CloseParenToken */, sourceFile)); return; @@ -151890,14 +153448,14 @@ var ts; } var gp = parent.parent; switch (gp.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: changes.replaceNode(sourceFile, node, ts.factory.createObjectLiteralExpression()); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: deleteNode(changes, sourceFile, parent); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: deleteNode(changes, sourceFile, gp, { leadingTriviaOption: ts.hasJSDocNodes(gp) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -151928,7 +153486,7 @@ var ts; deletedNodesInLists.add(node); changes.deleteRange(sourceFile, { pos: startPositionToDeleteNodeInList(sourceFile, node), - end: index === containingList.length - 1 ? getAdjustedEndPosition(sourceFile, node, {}) : startPositionToDeleteNodeInList(sourceFile, containingList[index + 1]), + end: index === containingList.length - 1 ? getAdjustedEndPosition(sourceFile, node, {}) : endPositionToDeleteNodeInList(sourceFile, node, containingList[index - 1], containingList[index + 1]), }); } })(textChanges = ts.textChanges || (ts.textChanges = {})); @@ -152084,8 +153642,8 @@ var ts; }); function makeChange(changeTracker, sourceFile, assertion) { var replacement = ts.isAsExpression(assertion) - ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)) - : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), assertion.expression); + ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)) + : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), assertion.expression); changeTracker.replaceNode(sourceFile, assertion.expression, replacement); } function getAssertion(sourceFile, pos) { @@ -152169,7 +153727,7 @@ var ts; } } fixedDeclarations === null || fixedDeclarations === void 0 ? void 0 : fixedDeclarations.add(ts.getNodeId(insertionSite)); - var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 256 /* ModifierFlags.Async */))); + var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 512 /* ModifierFlags.Async */))); changeTracker.replaceNode(sourceFile, insertionSite, cloneWithModifier); } function getFixableErrorSpanDeclaration(sourceFile, span) { @@ -152215,7 +153773,7 @@ var ts; ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_type_1.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2.code, - ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap.code, + ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap.code, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined.code, ts.Diagnostics.Type_0_is_not_an_array_type.code, ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type.code, @@ -152313,7 +153871,7 @@ var ts; } var declaration = ts.tryCast(symbol.valueDeclaration, ts.isVariableDeclaration); var variableName = declaration && ts.tryCast(declaration.name, ts.isIdentifier); - var variableStatement = ts.getAncestor(declaration, 237 /* SyntaxKind.VariableStatement */); + var variableStatement = ts.getAncestor(declaration, 240 /* SyntaxKind.VariableStatement */); if (!declaration || !variableStatement || declaration.type || !declaration.initializer || @@ -152391,13 +153949,22 @@ var ts; function isInsideAwaitableBody(node) { return node.kind & 32768 /* NodeFlags.AwaitContext */ || !!ts.findAncestor(node, function (ancestor) { return ancestor.parent && ts.isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || - ts.isBlock(ancestor) && (ancestor.parent.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - ancestor.parent.kind === 213 /* SyntaxKind.FunctionExpression */ || - ancestor.parent.kind === 214 /* SyntaxKind.ArrowFunction */ || - ancestor.parent.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.isBlock(ancestor) && (ancestor.parent.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + ancestor.parent.kind === 215 /* SyntaxKind.FunctionExpression */ || + ancestor.parent.kind === 216 /* SyntaxKind.ArrowFunction */ || + ancestor.parent.kind === 171 /* SyntaxKind.MethodDeclaration */); }); } function makeChange(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) { + if (ts.isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) { + var exprType = checker.getTypeAtLocation(insertionSite); + var asyncIter = checker.getAsyncIterableType(); + if (asyncIter && checker.isTypeAssignableTo(exprType, asyncIter)) { + var forOf = insertionSite.parent; + changeTracker.replaceNode(sourceFile, forOf, ts.factory.updateForOfStatement(forOf, ts.factory.createToken(133 /* SyntaxKind.AwaitKeyword */), forOf.initializer, forOf.expression, forOf.statement)); + return; + } + } if (ts.isBinaryExpression(insertionSite)) { for (var _i = 0, _a = [insertionSite.left, insertionSite.right]; _i < _a.length; _i++) { var side = _a[_i]; @@ -152513,10 +154080,10 @@ var ts; function isPossiblyPartOfDestructuring(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return true; default: return false; @@ -152531,7 +154098,7 @@ var ts; function isPossiblyPartOfCommaSeperatedInitializer(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: case 27 /* SyntaxKind.CommaToken */: return true; default: @@ -152580,9 +154147,9 @@ var ts; return; } var declaration = token.parent; - if (declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + if (declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && (!fixedNodes || ts.tryAddToSet(fixedNodes, declaration))) { - changeTracker.insertModifierBefore(sourceFile, 135 /* SyntaxKind.DeclareKeyword */, declaration); + changeTracker.insertModifierBefore(sourceFile, 136 /* SyntaxKind.DeclareKeyword */, declaration); } } })(codefix = ts.codefix || (ts.codefix = {})); @@ -152736,7 +154303,7 @@ var ts; var add = toAdd_1[_i]; var d = add.valueDeclaration; if (d && (ts.isPropertySignature(d) || ts.isPropertyDeclaration(d)) && d.type) { - var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 187 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ + var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 189 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ ts.factory.createTypeReferenceNode("undefined") ], false)); changes.replaceNode(d.getSourceFile(), d.type, t); @@ -152816,26 +154383,26 @@ var ts; } function isDeclarationWithType(node) { return ts.isFunctionLikeDeclaration(node) || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } function transformJSDocType(node) { switch (node.kind) { - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return ts.factory.createTypeReferenceNode("any", ts.emptyArray); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return transformJSDocOptionalType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return transformJSDocType(node.type); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return transformJSDocNullableType(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return transformJSDocVariadicType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return transformJSDocFunctionType(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return transformJSDocTypeReference(node); default: var visited = ts.visitEachChild(node, transformJSDocType, ts.nullTransformationContext); @@ -152856,11 +154423,11 @@ var ts; var _a; // TODO: This does not properly handle `function(new:C, string)` per https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System#the-javascript-type-language // however we do handle it correctly in `serializeTypeForDeclaration` in checker.ts - return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 318 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 + var isRest = node.type.kind === 321 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : node.dotDotDotToken; return ts.factory.createParameterDeclaration(node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -152899,8 +154466,8 @@ var ts; function transformJSDocIndexSignature(node) { var index = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, - /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "n" : "s", - /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), + /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "n" : "s", + /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), /*initializer*/ undefined); var indexSignature = ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature(/*modifiers*/ undefined, [index], node.typeArguments[1])]); ts.setEmitFlags(indexSignature, 1 /* EmitFlags.SingleLine */); @@ -152935,8 +154502,8 @@ var ts; return undefined; } var ctorDeclaration = ctorSymbol.valueDeclaration; - if (ts.isFunctionDeclaration(ctorDeclaration)) { - changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunctionDeclaration(ctorDeclaration)); + if (ts.isFunctionDeclaration(ctorDeclaration) || ts.isFunctionExpression(ctorDeclaration)) { + changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunction(ctorDeclaration)); } else if (ts.isVariableDeclaration(ctorDeclaration)) { var classDeclaration = createClassFromVariableDeclaration(ctorDeclaration); @@ -153040,7 +154607,7 @@ var ts; return; } // delete the entire statement if this expression is the sole expression to take care of the semicolon at the end - var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ + var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ ? assignmentBinaryExpression.parent : assignmentBinaryExpression; changes.delete(sourceFile, nodeToDelete); if (!assignmentExpr) { @@ -153092,7 +154659,7 @@ var ts; return createArrowFunctionExpressionMember(members, expression, name); } function createFunctionExpressionMember(members, functionExpression, name) { - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -153103,14 +154670,14 @@ var ts; var arrowFunctionBody = arrowFunction.body; var bodyBlock; // case 1: () => { return [1,2,3] } - if (arrowFunctionBody.kind === 235 /* SyntaxKind.Block */) { + if (arrowFunctionBody.kind === 238 /* SyntaxKind.Block */) { bodyBlock = arrowFunctionBody; } // case 2: () => [1,2,3] else { bodyBlock = ts.factory.createBlock([ts.factory.createReturnStatement(arrowFunctionBody)]); } - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -153133,7 +154700,7 @@ var ts; // Don't call copyComments here because we'll already leave them in place return cls; } - function createClassFromFunctionDeclaration(node) { + function createClassFromFunction(node) { var memberElements = createClassElementsFromSymbol(ctorSymbol); if (node.body) { memberElements.unshift(ts.factory.createConstructorDeclaration(/*modifiers*/ undefined, node.parameters, node.body)); @@ -153223,7 +154790,7 @@ var ts; return; } var pos = ts.skipTrivia(sourceFile.text, ts.moveRangePastModifiers(functionToConvert).pos); - changes.insertModifierAt(sourceFile, pos, 131 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); + changes.insertModifierAt(sourceFile, pos, 132 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); var _loop_12 = function (returnStatement) { ts.forEachChild(returnStatement, function visit(node) { if (ts.isCallExpression(node)) { @@ -153629,7 +155196,7 @@ var ts; case 104 /* SyntaxKind.NullKeyword */: // do not produce a transformed statement for a null argument break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 79 /* SyntaxKind.Identifier */: // identifier includes undefined if (!inputArgName) { // undefined was argument passed to promise handler @@ -153651,8 +155218,8 @@ var ts; continuationArgName.types.push(transformer.checker.getAwaitedType(returnType) || returnType); } return varDeclOrAssignment; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: { + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: { var funcBody = func.body; var returnType_1 = (_a = getLastCallSignature(transformer.checker.getTypeAtLocation(func), transformer.checker)) === null || _a === void 0 ? void 0 : _a.getReturnType(); // Arrow functions with block bodies { } will enter this control flow @@ -153821,7 +155388,7 @@ var ts; name = getMapEntryOrDefault(funcNode.name); } // return undefined argName when arg is null or undefined - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!name || "identifier" in name && name.identifier.text === "undefined") { return undefined; } @@ -153930,10 +155497,10 @@ var ts; } var importNode = ts.importFromModuleSpecifier(moduleSpecifier); switch (importNode.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.replaceNode(importingFile, importNode, ts.makeImport(importNode.name, /*namedImports*/ undefined, moduleSpecifier, quotePreference)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isRequireCall(importNode, /*checkArgumentIsStringLiteralLike*/ false)) { changes.replaceNode(importingFile, importNode, ts.factory.createPropertyAccessExpression(ts.getSynthesizedDeepClone(importNode), "default")); } @@ -154000,20 +155567,20 @@ var ts; } function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, useSitesToUnqualify, quotePreference) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference); return false; - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; switch (expression.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { if (ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true)) { // For side-effecting require() call, just make a side-effecting import. changes.replaceNode(sourceFile, statement, ts.makeImport(/*name*/ undefined, /*namedImports*/ undefined, expression.arguments[0], quotePreference)); } return false; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var operatorToken = expression.operatorToken; return operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports, useSitesToUnqualify); } @@ -154062,8 +155629,8 @@ var ts; /** Converts `const name = require("moduleSpecifier").propertyName` */ function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: { // `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;` var tmp = makeUniqueName(propertyName, identifiers); return convertedImports([ @@ -154114,16 +155681,16 @@ var ts; function tryChangeModuleExportsObject(object, useSitesToUnqualify) { var statements = ts.mapAllOrFail(object.properties, function (prop) { switch (prop.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`. // falls through - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return undefined; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer, useSitesToUnqualify); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)], prop, useSitesToUnqualify); default: ts.Debug.assertNever(prop, "Convert to ES6 got invalid prop kind ".concat(prop.kind)); @@ -154187,7 +155754,7 @@ var ts; function convertExportsDotXEquals_replaceNode(name, exported, useSitesToUnqualify) { var modifiers = [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)]; switch (exported.kind) { - case 213 /* SyntaxKind.FunctionExpression */: { + case 215 /* SyntaxKind.FunctionExpression */: { var expressionName = exported.name; if (expressionName && expressionName.text !== name) { // `exports.f = function g() {}` -> `export const f = function g() {}` @@ -154195,10 +155762,10 @@ var ts; } } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // `exports.f = function() {}` --> `export function f() {}` return functionExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // `exports.C = class {}` --> `export class C {}` return classExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); default: @@ -154218,7 +155785,7 @@ var ts; : ts.getSynthesizedDeepCloneWithReplacements(nodeOrNodes, /*includeTrivia*/ true, replaceNode); function replaceNode(original) { // We are replacing `mod.SomeExport` wih `SomeExport`, so we only need to look at PropertyAccessExpressions - if (original.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (original.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var replacement = useSitesToUnqualify.get(original); // Remove entry from `useSitesToUnqualify` so the refactor knows it's taken care of by the parent statement we're replacing useSitesToUnqualify.delete(original); @@ -154233,7 +155800,7 @@ var ts; */ function convertSingleImport(name, moduleSpecifier, checker, identifiers, target, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { var importSpecifiers = ts.mapAllOrFail(name.elements, function (e) { return e.dotDotDotToken || e.initializer || e.propertyName && !ts.isIdentifier(e.propertyName) || !ts.isIdentifier(e.name) ? undefined @@ -154244,7 +155811,7 @@ var ts; } } // falls through -- object destructuring has an interesting pattern and must be a variable declaration - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 204 /* SyntaxKind.ArrayBindingPattern */: { /* import x from "x"; const [a, b, c] = x; @@ -154337,11 +155904,11 @@ var ts; function isFreeIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return parent.propertyName !== node; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return parent.propertyName !== node; default: return true; @@ -154452,7 +156019,7 @@ var ts; var exportDeclaration = exportClause.parent; var typeExportSpecifiers = getTypeExportSpecifiers(exportSpecifier, context); if (typeExportSpecifiers.length === exportClause.elements.length) { - changes.insertModifierBefore(context.sourceFile, 152 /* SyntaxKind.TypeKeyword */, exportClause); + changes.insertModifierBefore(context.sourceFile, 154 /* SyntaxKind.TypeKeyword */, exportClause); } else { var valueExportDeclaration = ts.factory.updateExportDeclaration(exportDeclaration, exportDeclaration.modifiers, @@ -154688,27 +156255,29 @@ var ts; errorCodes: errorCodes, getCodeActions: function (context) { var errorCode = context.errorCode, preferences = context.preferences, sourceFile = context.sourceFile, span = context.span, program = context.program; - var info = getFixesInfo(context, errorCode, span.start, /*useAutoImportProvider*/ true); + var info = getFixInfos(context, errorCode, span.start, /*useAutoImportProvider*/ true); if (!info) return undefined; - var fixes = info.fixes, symbolName = info.symbolName, errorIdentifierText = info.errorIdentifierText; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - return fixes.map(function (fix) { return codeActionForFix(context, sourceFile, symbolName, fix, - /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); }); + return info.map(function (_a) { + var fix = _a.fix, symbolName = _a.symbolName, errorIdentifierText = _a.errorIdentifierText; + return codeActionForFix(context, sourceFile, symbolName, fix, + /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); + }); }, fixIds: [importFixId], getAllCodeActions: function (context) { - var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host; - var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host); + var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host, cancellationToken = context.cancellationToken; + var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host, cancellationToken); codefix.eachDiagnostic(context, errorCodes, function (diag) { return importAdder.addImportFromDiagnostic(diag, context); }); return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, importAdder.writeFixes)); }, }); - function createImportAdder(sourceFile, program, preferences, host) { - return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host); + function createImportAdder(sourceFile, program, preferences, host, cancellationToken) { + return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host, cancellationToken); } codefix.createImportAdder = createImportAdder; - function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host) { + function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host, cancellationToken) { var compilerOptions = program.getCompilerOptions(); // Namespace fixes don't conflict, so just build a list. var addToNamespace = []; @@ -154719,27 +156288,26 @@ var ts; var newImports = new ts.Map(); return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes }; function addImportFromDiagnostic(diagnostic, context) { - var info = getFixesInfo(context, diagnostic.code, diagnostic.start, useAutoImportProvider); - if (!info || !info.fixes.length) + var info = getFixInfos(context, diagnostic.code, diagnostic.start, useAutoImportProvider); + if (!info || !info.length) return; - addImport(info); + addImport(ts.first(info)); } function addImportFromExportedSymbol(exportedSymbol, isValidTypeOnlyUseSite) { var moduleSymbol = ts.Debug.checkDefined(exportedSymbol.parent); var symbolName = ts.getNameForExportedSymbol(exportedSymbol, ts.getEmitScriptTarget(compilerOptions)); var checker = program.getTypeChecker(); var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker)); - var exportInfo = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider); + var exportInfo = getAllExportInfoForSymbol(sourceFile, symbol, symbolName, /*isJsxTagName*/ false, program, host, preferences, cancellationToken); var useRequire = shouldUseRequire(sourceFile, program); - var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); + var fix = getImportFixForSymbol(sourceFile, ts.Debug.checkDefined(exportInfo), moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); if (fix) { - addImport({ fixes: [fix], symbolName: symbolName, errorIdentifierText: undefined }); + addImport({ fix: fix, symbolName: symbolName, errorIdentifierText: undefined }); } } function addImport(info) { var _a, _b; - var fixes = info.fixes, symbolName = info.symbolName; - var fix = ts.first(fixes); + var fix = info.fix, symbolName = info.symbolName; switch (fix.kind) { case 0 /* ImportFixKind.UseNamespace */: addToNamespace.push(fix); @@ -154906,11 +156474,12 @@ var ts; AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required"; AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed"; })(AddAsTypeOnly || (AddAsTypeOnly = {})); - function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences) { + function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) { var compilerOptions = program.getCompilerOptions(); var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name)) - ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] - : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, isJsxTagName, host, program, preferences, /*useAutoImportProvider*/ true); + ? [getSingleExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] + : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName, isJsxTagName, program, host, preferences, cancellationToken); + ts.Debug.assertIsDefined(exportInfos); var useRequire = shouldUseRequire(sourceFile, program); var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position)); var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, { symbolName: symbolName, position: position }, isValidTypeOnlyUseSite, useRequire, host, preferences)); @@ -154923,7 +156492,7 @@ var ts; codefix.getImportCompletionAction = getImportCompletionAction; function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) { var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions); + var symbolName = ts.single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions)); var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program); var includeSymbolNameInDescription = symbolName !== symbolToken.text; return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* QuotePreference.Double */, compilerOptions)); @@ -154938,7 +156507,16 @@ var ts; var description = _a.description, changes = _a.changes, commands = _a.commands; return { description: description, changes: changes, commands: commands }; } - function getSymbolExportInfoForSymbol(symbol, moduleSymbol, program, host) { + function getAllExportInfoForSymbol(importingFile, symbol, symbolName, preferCapitalized, program, host, preferences, cancellationToken) { + var getChecker = createGetChecker(program, host); + return ts.getExportInfoMap(importingFile, host, program, preferences, cancellationToken) + .search(importingFile.path, preferCapitalized, function (name) { return name === symbolName; }, function (info) { + if (ts.skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol) { + return info; + } + }); + } + function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) { var _a, _b; var compilerOptions = program.getCompilerOptions(); var mainProgramInfo = getInfoWithChecker(program.getTypeChecker(), /*isFromPackageJson*/ false); @@ -154958,35 +156536,6 @@ var ts; } } } - function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, isJsxTagName, host, program, preferences, useAutoImportProvider) { - var result = []; - var compilerOptions = program.getCompilerOptions(); - var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) { - return ts.createModuleSpecifierResolutionHost(isFromPackageJson ? host.getPackageJsonAutoImportProvider() : program, host); - }); - ts.forEachExternalModuleToImportFrom(program, host, preferences, useAutoImportProvider, function (moduleSymbol, moduleFile, program, isFromPackageJson) { - var checker = program.getTypeChecker(); - // Don't import from a re-export when looking "up" like to `./index` or `../index`. - if (moduleFile && moduleSymbol !== exportingModuleSymbol && ts.startsWith(importingFile.fileName, ts.getDirectoryPath(moduleFile.fileName))) { - return; - } - var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions); - if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: defaultInfo.symbol, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: defaultInfo.exportKind, targetFlags: ts.skipAlias(defaultInfo.symbol, checker).flags, isFromPackageJson: isFromPackageJson }); - } - for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) { - var exported = _a[_i]; - if (exported.name === symbolName && checker.getMergedSymbol(ts.skipAlias(exported, checker)) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: exported, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: 0 /* ExportKind.Named */, targetFlags: ts.skipAlias(exported, checker).flags, isFromPackageJson: isFromPackageJson }); - } - } - }); - return result; - function isImportable(program, moduleFile, isFromPackageJson) { - var _a; - return !moduleFile || ts.isImportableFile(program, importingFile, moduleFile, preferences, /*packageJsonFilter*/ undefined, getModuleSpecifierResolutionHost(isFromPackageJson), (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host)); - } - } function getImportFixes(exportInfos, useNamespaceInfo, /** undefined only for missing JSX namespace */ isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap, fromCacheOnly) { @@ -155037,11 +156586,11 @@ var ts; function getTargetModuleFromNamespaceLikeImport(declaration, checker) { var _a; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.resolveExternalModuleName(declaration.initializer.arguments[0]); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checker.getAliasedSymbol(declaration.symbol); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var namespaceImport = ts.tryCast((_a = declaration.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings, ts.isNamespaceImport); return namespaceImport && checker.getAliasedSymbol(namespaceImport.symbol); default: @@ -155051,11 +156600,11 @@ var ts; function getNamespaceLikeImportText(declaration) { var _a, _b, _c; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.tryCast(declaration.name, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return declaration.name.text; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return (_c = ts.tryCast((_b = declaration.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings, ts.isNamespaceImport)) === null || _c === void 0 ? void 0 : _c.name.text; default: return ts.Debug.assertNever(declaration); @@ -155082,12 +156631,12 @@ var ts; function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, compilerOptions) { return ts.firstDefined(existingImports, function (_a) { var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags; - if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // These kinds of imports are not combinable with anything return undefined; } - if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { - return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { + return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? { kind: 2 /* ImportFixKind.AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind: importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* AddAsTypeOnly.NotAllowed */ } : undefined; } @@ -155108,7 +156657,7 @@ var ts; )) return undefined; if (importKind === 0 /* ImportKind.Named */ && - (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 268 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import + (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 271 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import ) return undefined; return { @@ -155131,7 +156680,7 @@ var ts; (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i.parent); } } - else if (i.kind === 266 /* SyntaxKind.ImportDeclaration */ || i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (i.kind === 269 /* SyntaxKind.ImportDeclaration */ || i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); if (moduleSymbol) { (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i); @@ -155180,11 +156729,14 @@ var ts; // 5. Literally nothing to go on return true; } + function createGetChecker(program, host) { + return ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + } function getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfo, host, preferences, fromCacheOnly) { var isJs = ts.isSourceFileJS(sourceFile); var compilerOptions = program.getCompilerOptions(); var moduleSpecifierResolutionHost = ts.createModuleSpecifierResolutionHost(program, host); - var getChecker = ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + var getChecker = createGetChecker(program, host); var rejectNodeModulesRelativePaths = ts.moduleResolutionUsesNodeModules(ts.getEmitModuleResolutionKind(compilerOptions)); var getModuleSpecifiers = fromCacheOnly ? function (moduleSymbol) { return ({ moduleSpecifiers: ts.moduleSpecifiers.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }); } @@ -155228,7 +156780,7 @@ var ts; return { kind: 3 /* ImportFixKind.AddNew */, moduleSpecifier: moduleSpecifier, importKind: importKind, addAsTypeOnly: addAsTypeOnly, useRequire: useRequire }; } } - function getFixesInfo(context, errorCode, pos, useAutoImportProvider) { + function getFixInfos(context, errorCode, pos, useAutoImportProvider) { var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos); var info; if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { @@ -155238,19 +156790,23 @@ var ts; return undefined; } else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) { - var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions()); + var symbolName_1 = ts.single(getSymbolNamesToImport(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions())); var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program); - return fix && { fixes: [fix], symbolName: symbolName_1, errorIdentifierText: symbolToken.text }; + return fix && [{ fix: fix, symbolName: symbolName_1, errorIdentifierText: symbolToken.text }]; } else { info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider); } var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host); - return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter, context.host) }); + return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host); } - function sortFixes(fixes, sourceFile, program, packageJsonImportFilter, host) { + function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host) { var _toPath = function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); }; - return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); }); + return ts.sort(fixes, function (a, b) { + return ts.compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || + ts.compareValues(a.fix.kind, b.fix.kind) || + compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); + }); } function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) { if (!ts.some(fixes)) @@ -155301,7 +156857,6 @@ var ts; return 0 /* Comparison.EqualTo */; } function getFixesInfoForUMDImport(_a, token) { - var _b; var sourceFile = _a.sourceFile, program = _a.program, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var umdSymbol = getUmdSymbol(token, checker); @@ -155313,7 +156868,7 @@ var ts; var useRequire = shouldUseRequire(sourceFile, program); var position = ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined; var fixes = getImportFixes(exportInfo, position ? { position: position, symbolName: symbolName } : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences).fixes; - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: (_b = ts.tryCast(token, ts.isIdentifier)) === null || _b === void 0 ? void 0 : _b.text }; + return fixes.map(function (fix) { var _a; return ({ fix: fix, symbolName: symbolName, errorIdentifierText: (_a = ts.tryCast(token, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text }); }); } function getUmdSymbol(token, checker) { // try the identifier to see if it is the umd symbol @@ -155374,19 +156929,20 @@ var ts; var sourceFile = _a.sourceFile, program = _a.program, cancellationToken = _a.cancellationToken, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, checker, symbolToken, compilerOptions); - // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. - if (symbolName === "default" /* InternalSymbolName.Default */) { - return undefined; - } - var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); - var useRequire = shouldUseRequire(sourceFile, program); - var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); - var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { - var _ = _a[0], exportInfos = _a[1]; - return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; - })); - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: symbolToken.text }; + return ts.flatMap(getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions), function (symbolName) { + // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. + if (symbolName === "default" /* InternalSymbolName.Default */) { + return undefined; + } + var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); + var useRequire = shouldUseRequire(sourceFile, program); + var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); + var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { + var _ = _a[0], exportInfos = _a[1]; + return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; + })); + return fixes.map(function (fix) { return ({ fix: fix, symbolName: symbolName, errorIdentifierText: symbolToken.text, isJsxNamespaceFix: symbolName !== symbolToken.text }); }); + }); } function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) { var checker = program.getTypeChecker(); @@ -155398,15 +156954,16 @@ var ts; return undefined; return { kind: 4 /* ImportFixKind.PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration }; } - function getSymbolName(sourceFile, checker, symbolToken, compilerOptions) { + function getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions) { var parent = symbolToken.parent; if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && ts.jsxModeNeedsExplicitImport(compilerOptions.jsx)) { var jsxNamespace = checker.getJsxNamespace(sourceFile); if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) { - return jsxNamespace; + var needsComponentNameFix = !ts.isIntrinsicJsxName(symbolToken.text) && !checker.resolveName(symbolToken.text, symbolToken, 111551 /* SymbolFlags.Value */, /*excludeGlobals*/ false); + return needsComponentNameFix ? [symbolToken.text, jsxNamespace] : [jsxNamespace]; } } - return symbolToken.text; + return [symbolToken.text]; } function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) { if (ts.isIntrinsicJsxName(symbolToken.text)) @@ -155515,7 +157072,7 @@ var ts; case 4 /* ImportFixKind.PromoteTypeOnly */: { var typeOnlyAliasDeclaration = fix.typeOnlyAliasDeclaration; var promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile); - return promotedDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ + return promotedDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ ? [ts.Diagnostics.Remove_type_from_import_of_0_from_1, symbolName, getModuleSpecifierText(promotedDeclaration.parent.parent)] : [ts.Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)]; } @@ -155525,7 +157082,7 @@ var ts; } function getModuleSpecifierText(promotedDeclaration) { var _a, _b; - return promotedDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ + return promotedDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? ((_b = ts.tryCast((_a = ts.tryCast(promotedDeclaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression, ts.isStringLiteralLike)) === null || _b === void 0 ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : ts.cast(promotedDeclaration.parent.moduleSpecifier, ts.isStringLiteral).text; } @@ -155533,7 +157090,7 @@ var ts; // See comment in `doAddExistingFix` on constant with the same name. var convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules; switch (aliasDeclaration.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: if (aliasDeclaration.isTypeOnly) { if (aliasDeclaration.parent.elements.length > 1 && ts.OrganizeImports.importSpecifiersAreSorted(aliasDeclaration.parent.elements)) { changes.delete(sourceFile, aliasDeclaration); @@ -155551,13 +157108,13 @@ var ts; promoteImportClause(aliasDeclaration.parent.parent); return aliasDeclaration.parent.parent; } - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: promoteImportClause(aliasDeclaration); return aliasDeclaration; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: promoteImportClause(aliasDeclaration.parent); return aliasDeclaration.parent; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.deleteRange(sourceFile, aliasDeclaration.getChildAt(1)); return aliasDeclaration; default: @@ -155569,7 +157126,7 @@ var ts; var namedImports = ts.tryCast(importClause.namedBindings, ts.isNamedImports); if (namedImports && namedImports.elements.length > 1) { if (ts.OrganizeImports.importSpecifiersAreSorted(namedImports.elements) && - aliasDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && + aliasDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && namedImports.elements.indexOf(aliasDeclaration) !== 0) { // The import specifier being promoted will be the only non-type-only, // import in the NamedImports, so it should be moved to the front. @@ -155579,7 +157136,7 @@ var ts; for (var _i = 0, _a = namedImports.elements; _i < _a.length; _i++) { var element = _a[_i]; if (element !== aliasDeclaration && !element.isTypeOnly) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, element); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, element); } } } @@ -155588,7 +157145,7 @@ var ts; } function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, compilerOptions) { var _a; - if (clause.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (clause.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (defaultImport) { addElementToBindingPattern(clause, defaultImport.name, "default"); } @@ -155649,7 +157206,7 @@ var ts; if (convertExistingToTypeOnly && existingSpecifiers) { for (var _d = 0, existingSpecifiers_1 = existingSpecifiers; _d < existingSpecifiers_1.length; _d++) { var specifier = existingSpecifiers_1[_d]; - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, specifier); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, specifier); } } } @@ -155824,7 +157381,7 @@ var ts; var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; }); if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) return; - var declaration = findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + var declaration = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); if (declaration === undefined) return; if (ts.isIdentifier(declaration) && ts.isTypeParameterDeclaration(declaration.parent)) { @@ -155858,14 +157415,6 @@ var ts; } } } - function findAncestorMatchingSpan(sourceFile, span) { - var end = ts.textSpanEnd(span); - var token = ts.getTokenAtPosition(sourceFile, span.start); - while (token.end < end) { - token = token.parent; - } - return token; - } function tryGetConstraintFromDiagnosticMessage(messageText) { var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/`extends (.*)`/) || [], _ = _a[0], constraint = _a[1]; return constraint; @@ -156009,7 +157558,7 @@ var ts; accessibilityModifier ? accessibilityModifier.end : lastDecorator ? ts.skipTrivia(sourceFile.text, lastDecorator.end) : classElement.getStart(sourceFile); var options = accessibilityModifier || staticModifier || abstractModifier ? { prefix: " " } : { suffix: " " }; - changeTracker.insertModifierAt(sourceFile, modifierPos, 159 /* SyntaxKind.OverrideKeyword */, options); + changeTracker.insertModifierAt(sourceFile, modifierPos, 161 /* SyntaxKind.OverrideKeyword */, options); } function doRemoveOverrideModifierChange(changeTracker, sourceFile, pos) { var classElement = findContainerClassElementLike(sourceFile, pos); @@ -156023,13 +157572,13 @@ var ts; } function isClassElementLikeHasJSDoc(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.isParameterPropertyDeclaration(node, node.parent); default: return false; @@ -156141,6 +157690,143 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + var fixId = "fixImportNonExportedMember"; + var errorCodes = [ + ts.Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported.code, + ]; + codefix.registerCodeFix({ + errorCodes: errorCodes, + fixIds: [fixId], + getCodeActions: function (context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getInfo(sourceFile, span.start, program); + if (info === undefined) + return undefined; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, program, info); }); + return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId, ts.Diagnostics.Export_all_referenced_locals)]; + }, + getAllCodeActions: function (context) { + var program = context.program; + return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) { + var exports = new ts.Map(); + codefix.eachDiagnostic(context, errorCodes, function (diag) { + var info = getInfo(diag.file, diag.start, program); + if (info === undefined) + return undefined; + var exportName = info.exportName, node = info.node, moduleSourceFile = info.moduleSourceFile; + if (tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly) === undefined && ts.canHaveExportModifier(node)) { + changes.insertExportModifier(moduleSourceFile, node); + } + else { + var moduleExports = exports.get(moduleSourceFile) || { typeOnlyExports: [], exports: [] }; + if (exportName.isTypeOnly) { + moduleExports.typeOnlyExports.push(exportName); + } + else { + moduleExports.exports.push(exportName); + } + exports.set(moduleSourceFile, moduleExports); + } + }); + exports.forEach(function (moduleExports, moduleSourceFile) { + var exportDeclaration = tryGetExportDeclaration(moduleSourceFile, /*isTypeOnly*/ true); + if (exportDeclaration && exportDeclaration.isTypeOnly) { + doChanges(changes, program, moduleSourceFile, moduleExports.typeOnlyExports, exportDeclaration); + doChanges(changes, program, moduleSourceFile, moduleExports.exports, tryGetExportDeclaration(moduleSourceFile, /*isTypeOnly*/ false)); + } + else { + doChanges(changes, program, moduleSourceFile, __spreadArray(__spreadArray([], moduleExports.exports, true), moduleExports.typeOnlyExports, true), exportDeclaration); + } + }); + })); + } + }); + function getInfo(sourceFile, pos, program) { + var _a; + var token = ts.getTokenAtPosition(sourceFile, pos); + if (ts.isIdentifier(token)) { + var importDeclaration = ts.findAncestor(token, ts.isImportDeclaration); + if (importDeclaration === undefined) + return undefined; + var moduleSpecifier = ts.isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : undefined; + if (moduleSpecifier === undefined) + return undefined; + var resolvedModule = ts.getResolvedModule(sourceFile, moduleSpecifier, /*mode*/ undefined); + if (resolvedModule === undefined) + return undefined; + var moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName); + if (moduleSourceFile === undefined || ts.isSourceFileFromLibrary(program, moduleSourceFile)) + return undefined; + var moduleSymbol = moduleSourceFile.symbol; + var locals = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals; + if (locals === undefined) + return undefined; + var localSymbol = locals.get(token.escapedText); + if (localSymbol === undefined) + return undefined; + var node = getNodeOfSymbol(localSymbol); + if (node === undefined) + return undefined; + var exportName = { node: token, isTypeOnly: ts.isTypeDeclaration(node) }; + return { exportName: exportName, node: node, moduleSourceFile: moduleSourceFile, moduleSpecifier: moduleSpecifier }; + } + return undefined; + } + function doChange(changes, program, _a) { + var exportName = _a.exportName, node = _a.node, moduleSourceFile = _a.moduleSourceFile; + var exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly); + if (exportDeclaration) { + updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]); + } + else if (ts.canHaveExportModifier(node)) { + changes.insertExportModifier(moduleSourceFile, node); + } + else { + createExport(changes, program, moduleSourceFile, [exportName]); + } + } + function doChanges(changes, program, sourceFile, moduleExports, node) { + if (ts.length(moduleExports)) { + if (node) { + updateExport(changes, program, sourceFile, node, moduleExports); + } + else { + createExport(changes, program, sourceFile, moduleExports); + } + } + } + function tryGetExportDeclaration(sourceFile, isTypeOnly) { + var predicate = function (node) { + return ts.isExportDeclaration(node) && (isTypeOnly && node.isTypeOnly || !node.isTypeOnly); + }; + return ts.findLast(sourceFile.statements, predicate); + } + function updateExport(changes, program, sourceFile, node, names) { + var namedExports = node.exportClause && ts.isNamedExports(node.exportClause) ? node.exportClause.elements : ts.factory.createNodeArray([]); + var allowTypeModifier = !node.isTypeOnly && !!(program.getCompilerOptions().isolatedModules || ts.find(namedExports, function (e) { return e.isTypeOnly; })); + changes.replaceNode(sourceFile, node, ts.factory.updateExportDeclaration(node, node.modifiers, node.isTypeOnly, ts.factory.createNamedExports(ts.factory.createNodeArray(__spreadArray(__spreadArray([], namedExports, true), createExportSpecifiers(names, allowTypeModifier), true), /*hasTrailingComma*/ namedExports.hasTrailingComma)), node.moduleSpecifier, node.assertClause)); + } + function createExport(changes, program, sourceFile, names) { + changes.insertNodeAtEndOfScope(sourceFile, sourceFile, ts.factory.createExportDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamedExports(createExportSpecifiers(names, /*allowTypeModifier*/ !!program.getCompilerOptions().isolatedModules)), /*moduleSpecifier*/ undefined, /*assertClause*/ undefined)); + } + function createExportSpecifiers(names, allowTypeModifier) { + return ts.factory.createNodeArray(ts.map(names, function (n) { return ts.factory.createExportSpecifier(allowTypeModifier && n.isTypeOnly, /*propertyName*/ undefined, n.node); })); + } + function getNodeOfSymbol(symbol) { + if (symbol.valueDeclaration === undefined) { + return ts.firstOrUndefined(symbol.declarations); + } + var declaration = symbol.valueDeclaration; + var variableStatement = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : undefined; + return variableStatement && ts.length(variableStatement.declarationList.declarations) === 1 ? variableStatement : declaration; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -156161,7 +157847,7 @@ var ts; }); function getNamedTupleMember(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); - return ts.findAncestor(token, function (t) { return t.kind === 197 /* SyntaxKind.NamedTupleMember */; }); + return ts.findAncestor(token, function (t) { return t.kind === 199 /* SyntaxKind.NamedTupleMember */; }); } function doChange(changes, sourceFile, namedTupleMember) { if (!namedTupleMember) { @@ -156170,11 +157856,11 @@ var ts; var unwrappedType = namedTupleMember.type; var sawOptional = false; var sawRest = false; - while (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 186 /* SyntaxKind.RestType */ || unwrappedType.kind === 191 /* SyntaxKind.ParenthesizedType */) { - if (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */) { + while (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 188 /* SyntaxKind.RestType */ || unwrappedType.kind === 193 /* SyntaxKind.ParenthesizedType */) { + if (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */) { sawOptional = true; } - else if (unwrappedType.kind === 186 /* SyntaxKind.RestType */) { + else if (unwrappedType.kind === 188 /* SyntaxKind.RestType */) { sawRest = true; } unwrappedType = unwrappedType.type; @@ -156445,7 +158131,7 @@ var ts; if (isFunctionType) { var sig = checker.getSignatureFromDeclaration(declaration); if (sig) { - if (ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Async */)) { + if (ts.hasSyntacticModifier(declaration, 512 /* ModifierFlags.Async */)) { exprType = checker.createPromiseType(exprType); } var newSig = checker.createSignature(declaration, sig.typeParameters, sig.thisParameter, sig.parameters, exprType, @@ -156489,19 +158175,19 @@ var ts; } function getVariableLikeInitializer(declaration) { switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: return declaration.initializer; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return declaration.initializer && (ts.isJsxExpression(declaration.initializer) ? declaration.initializer.expression : undefined); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return undefined; } } @@ -156555,6 +158241,15 @@ var ts; ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code, ts.Diagnostics.Cannot_find_name_0.code ]; + var InfoKind; + (function (InfoKind) { + InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; + InfoKind[InfoKind["Enum"] = 1] = "Enum"; + InfoKind[InfoKind["Function"] = 2] = "Function"; + InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; + InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; + InfoKind[InfoKind["Signature"] = 5] = "Signature"; + })(InfoKind || (InfoKind = {})); codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { @@ -156563,19 +158258,19 @@ var ts; if (!info) { return undefined; } - if (info.kind === 3 /* InfoKind.ObjectLiteral */) { + if (info.kind === InfoKind.ObjectLiteral) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addObjectLiteralProperties(t, context, info); }); return [codefix.createCodeFixAction(fixMissingProperties, changes, ts.Diagnostics.Add_missing_properties, fixMissingProperties, ts.Diagnostics.Add_all_missing_properties)]; } - if (info.kind === 4 /* InfoKind.JsxAttributes */) { + if (info.kind === InfoKind.JsxAttributes) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addJsxAttributes(t, context, info); }); return [codefix.createCodeFixAction(fixMissingAttributes, changes, ts.Diagnostics.Add_missing_attributes, fixMissingAttributes, ts.Diagnostics.Add_all_missing_attributes)]; } - if (info.kind === 2 /* InfoKind.Function */) { + if (info.kind === InfoKind.Function || info.kind === InfoKind.Signature) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addFunctionDeclaration(t, context, info); }); return [codefix.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts.Diagnostics.Add_all_missing_function_declarations)]; } - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addEnumMemberDeclaration(t, context.program.getTypeChecker(), info); }); return [codefix.createCodeFixAction(fixMissingMember, changes, [ts.Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members)]; } @@ -156593,20 +158288,20 @@ var ts; if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) { return; } - if (fixId === fixMissingFunctionDeclaration && info.kind === 2 /* InfoKind.Function */) { + if (fixId === fixMissingFunctionDeclaration && (info.kind === InfoKind.Function || info.kind === InfoKind.Signature)) { addFunctionDeclaration(changes, context, info); } - else if (fixId === fixMissingProperties && info.kind === 3 /* InfoKind.ObjectLiteral */) { + else if (fixId === fixMissingProperties && info.kind === InfoKind.ObjectLiteral) { addObjectLiteralProperties(changes, context, info); } - else if (fixId === fixMissingAttributes && info.kind === 4 /* InfoKind.JsxAttributes */) { + else if (fixId === fixMissingAttributes && info.kind === InfoKind.JsxAttributes) { addJsxAttributes(changes, context, info); } else { - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { addEnumMemberDeclaration(changes, checker, info); } - if (info.kind === 0 /* InfoKind.TypeLikeDeclaration */) { + if (info.kind === InfoKind.TypeLikeDeclaration) { var parentDeclaration = info.parentDeclaration, token_1 = info.token; var infos = ts.getOrUpdate(typeDeclToMembers, parentDeclaration, function () { return []; }); if (!infos.some(function (i) { return i.token.text === token_1.text; })) { @@ -156650,14 +158345,6 @@ var ts; })); }, }); - var InfoKind; - (function (InfoKind) { - InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; - InfoKind[InfoKind["Enum"] = 1] = "Enum"; - InfoKind[InfoKind["Function"] = 2] = "Function"; - InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; - InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; - })(InfoKind || (InfoKind = {})); function getInfo(sourceFile, tokenPos, errorCode, checker, program) { // The identifier of the missing property. eg: // this.missing = 1; @@ -156670,7 +158357,7 @@ var ts; var argIndex = ts.findIndex(parent.parent.arguments, function (arg) { return arg === parent; }); if (argIndex < 0) return undefined; - var signature = ts.singleOrUndefined(checker.getSignaturesOfType(checker.getTypeAtLocation(parent.parent.expression), 0 /* SignatureKind.Call */)); + var signature = checker.getResolvedSignature(parent.parent); if (!(signature && signature.declaration && signature.parameters[argIndex])) return undefined; var param = signature.parameters[argIndex].valueDeclaration; @@ -156679,7 +158366,7 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getParameterType(signature, argIndex), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: param.name, properties: properties, parentDeclaration: parent }; + return { kind: InfoKind.ObjectLiteral, token: param.name, properties: properties, parentDeclaration: parent }; } if (!ts.isMemberName(token)) return undefined; @@ -156687,17 +158374,26 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent.initializer), checker.getTypeAtLocation(token), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: token, properties: properties, parentDeclaration: parent.initializer }; + return { kind: InfoKind.ObjectLiteral, token: token, properties: properties, parentDeclaration: parent.initializer }; } if (ts.isIdentifier(token) && ts.isJsxOpeningLikeElement(token.parent)) { var target = ts.getEmitScriptTarget(program.getCompilerOptions()); var attributes = getUnmatchedAttributes(checker, target, token.parent); if (!ts.length(attributes)) return undefined; - return { kind: 4 /* InfoKind.JsxAttributes */, token: token, attributes: attributes, parentDeclaration: token.parent }; + return { kind: InfoKind.JsxAttributes, token: token, attributes: attributes, parentDeclaration: token.parent }; } - if (ts.isIdentifier(token) && ts.isCallExpression(parent) && parent.expression === token) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: sourceFile }; + if (ts.isIdentifier(token)) { + var type = checker.getContextualType(token); + if (type && ts.getObjectFlags(type) & 16 /* ObjectFlags.Anonymous */) { + var signature = ts.firstOrUndefined(checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */)); + if (signature === undefined) + return undefined; + return { kind: InfoKind.Signature, token: token, signature: signature, sourceFile: sourceFile, parentDeclaration: findScope(token) }; + } + if (ts.isCallExpression(parent) && parent.expression === token) { + return { kind: InfoKind.Function, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: findScope(token) }; + } } if (!ts.isPropertyAccessExpression(parent)) return undefined; @@ -156708,14 +158404,14 @@ var ts; if (ts.isIdentifier(token) && ts.isCallExpression(parent.parent)) { var moduleDeclaration = ts.find(symbol.declarations, ts.isModuleDeclaration); var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile(); - if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; + if (moduleDeclaration && moduleDeclarationSourceFile && !ts.isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) { + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; } var moduleSourceFile = ts.find(symbol.declarations, ts.isSourceFile); if (sourceFile.commonJsModuleIndicator) return undefined; - if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; + if (moduleSourceFile && !ts.isSourceFileFromLibrary(program, moduleSourceFile)) { + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; } } var classDeclaration = ts.find(symbol.declarations, ts.isClassLike); @@ -156724,7 +158420,7 @@ var ts; return undefined; // Prefer to change the class instead of the interface if they are merged var declaration = classDeclaration || ts.find(symbol.declarations, function (d) { return ts.isInterfaceDeclaration(d) || ts.isTypeLiteralNode(d); }); - if (declaration && !isSourceFileFromLibrary(program, declaration.getSourceFile())) { + if (declaration && !ts.isSourceFileFromLibrary(program, declaration.getSourceFile())) { var makeStatic = !ts.isTypeLiteralNode(declaration) && (leftExpressionType.target || leftExpressionType) !== checker.getDeclaredTypeOfSymbol(symbol); if (makeStatic && (ts.isPrivateIdentifier(token) || ts.isInterfaceDeclaration(declaration))) return undefined; @@ -156733,17 +158429,14 @@ var ts; (makeStatic ? 32 /* ModifierFlags.Static */ : 0 /* ModifierFlags.None */) | (ts.startsWithUnderscore(token.text) ? 8 /* ModifierFlags.Private */ : 0 /* ModifierFlags.None */); var isJSFile = ts.isSourceFileJS(declSourceFile); var call = ts.tryCast(parent.parent, ts.isCallExpression); - return { kind: 0 /* InfoKind.TypeLikeDeclaration */, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; + return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; } var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration); - if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { - return { kind: 1 /* InfoKind.Enum */, token: token, parentDeclaration: enumDeclaration }; + if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !ts.isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { + return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration }; } return undefined; } - function isSourceFileFromLibrary(program, node) { - return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node); - } function getActionsForMissingMemberDeclaration(context, info) { return info.isJSFile ? ts.singleElementArray(createActionForAddMissingMemberInJavascriptFile(context, info)) : createActionsForAddMissingMemberInTypeScriptFile(context, info); @@ -156764,7 +158457,7 @@ var ts; function addMissingMemberInJs(changeTracker, sourceFile, classDeclaration, token, makeStatic) { var tokenName = token.text; if (makeStatic) { - if (classDeclaration.kind === 226 /* SyntaxKind.ClassExpression */) { + if (classDeclaration.kind === 228 /* SyntaxKind.ClassExpression */) { return; } var className = classDeclaration.name.getText(); @@ -156815,7 +158508,7 @@ var ts; } function getTypeNode(checker, node, token) { var typeNode; - if (token.parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (token.parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var binaryExpression = token.parent.parent; var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left; var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression))); @@ -156825,7 +158518,7 @@ var ts; var contextualType = checker.getContextualType(token.parent); typeNode = contextualType ? checker.typeToTypeNode(contextualType, /*enclosingDeclaration*/ undefined, 1 /* NodeBuilderFlags.NoTruncation */) : undefined; } - return typeNode || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return typeNode || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function addPropertyDeclaration(changeTracker, sourceFile, node, tokenName, typeNode, modifierFlags) { var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; @@ -156853,7 +158546,7 @@ var ts; } function createAddIndexSignatureAction(context, sourceFile, node, tokenName, typeNode) { // Index signatures cannot have the static modifier. - var stringTypeNode = ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + var stringTypeNode = ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); var indexingParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "x", @@ -156884,7 +158577,7 @@ var ts; } function addMethodDeclaration(context, changes, callExpression, name, modifierFlags, parentDeclaration, sourceFile) { var importAdder = codefix.createImportAdder(sourceFile, context.program, context.preferences, context.host); - var kind = ts.isClassLike(parentDeclaration) ? 169 /* SyntaxKind.MethodDeclaration */ : 168 /* SyntaxKind.MethodSignature */; + var kind = ts.isClassLike(parentDeclaration) ? 171 /* SyntaxKind.MethodDeclaration */ : 170 /* SyntaxKind.MethodSignature */; var signatureDeclaration = codefix.createSignatureDeclarationFromCallExpression(kind, context, importAdder, callExpression, name, modifierFlags, parentDeclaration); var containingMethodDeclaration = tryGetContainingMethodDeclaration(parentDeclaration, callExpression); if (containingMethodDeclaration) { @@ -156913,9 +158606,17 @@ var ts; }); } function addFunctionDeclaration(changes, context, info) { + var quotePreference = ts.getQuotePreference(context.sourceFile, context.preferences); var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host); - var functionDeclaration = codefix.createSignatureDeclarationFromCallExpression(256 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration); - changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); + var functionDeclaration = info.kind === InfoKind.Function + ? codefix.createSignatureDeclarationFromCallExpression(259 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration) + : codefix.createSignatureDeclarationFromSignature(259 /* SyntaxKind.FunctionDeclaration */, context, quotePreference, info.signature, codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), info.token, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ undefined, importAdder); + if (functionDeclaration === undefined) { + ts.Debug.fail("fixMissingFunctionDeclaration codefix got unexpected error."); + } + ts.isReturnStatement(info.parentDeclaration) + ? changes.insertNodeBefore(info.sourceFile, info.parentDeclaration, functionDeclaration, /*blankLineBetween*/ true) + : changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); importAdder.writeFixes(changes); } function addJsxAttributes(changes, context, info) { @@ -157011,7 +158712,7 @@ var ts; var signature = checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */); if (signature === undefined) return createUndefined(); - var func = codefix.createSignatureDeclarationFromSignature(213 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); + var func = codefix.createSignatureDeclarationFromSignature(215 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); return func !== null && func !== void 0 ? func : createUndefined(); } if (ts.getObjectFlags(type) & 1 /* ObjectFlags.Class */) { @@ -157065,14 +158766,21 @@ var ts; return declaration && declaration.parent === node ? declaration : undefined; } function createPropertyNameFromSymbol(symbol, target, quotePreference, checker) { - if (ts.isTransientSymbol(symbol) && symbol.nameType && symbol.nameType.flags & 8192 /* TypeFlags.UniqueESSymbol */) { - var expression = checker.symbolToExpression(symbol.nameType.symbol, 111551 /* SymbolFlags.Value */, symbol.valueDeclaration, 1048576 /* NodeBuilderFlags.AllowUniqueESSymbolType */); - if (expression) { - return ts.factory.createComputedPropertyName(expression); - } + if (ts.isTransientSymbol(symbol)) { + var prop = checker.symbolToNode(symbol, 111551 /* SymbolFlags.Value */, /*enclosingDeclaration*/ undefined, 1073741824 /* NodeBuilderFlags.WriteComputedProps */); + if (prop && ts.isComputedPropertyName(prop)) + return prop; } return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* QuotePreference.Single */); } + function findScope(node) { + if (ts.findAncestor(node, ts.isJsxExpression)) { + var returnStatement = ts.findAncestor(node.parent, ts.isReturnStatement); + if (returnStatement) + return returnStatement; + } + return ts.getSourceFileOfNode(node); + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -157223,7 +158931,7 @@ var ts; // See `codeFixClassExtendAbstractProtectedProperty.ts` in https://github.com/Microsoft/TypeScript/pull/11547/files // (now named `codeFixClassExtendAbstractPrivateProperty.ts`) var flags = ts.getSyntacticModifierFlags(ts.first(symbol.getDeclarations())); - return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 128 /* ModifierFlags.Abstract */); + return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 256 /* ModifierFlags.Abstract */); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -157386,6 +159094,63 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + var fixId = "fixNaNEquality"; + var errorCodes = [ + ts.Diagnostics.This_condition_will_always_return_0.code, + ]; + codefix.registerCodeFix({ + errorCodes: errorCodes, + getCodeActions: function (context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getInfo(program, sourceFile, span); + if (info === undefined) + return; + var suggestion = info.suggestion, expression = info.expression, arg = info.arg; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, arg, expression); }); + return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Use_0, suggestion], fixId, ts.Diagnostics.Use_Number_isNaN_in_all_conditions)]; + }, + fixIds: [fixId], + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(context.program, diag.file, ts.createTextSpan(diag.start, diag.length)); + if (info) { + doChange(changes, diag.file, info.arg, info.expression); + } + }); + } + }); + function getInfo(program, sourceFile, span) { + var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; }); + if (diag === undefined || diag.relatedInformation === undefined) + return; + var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.Did_you_mean_0.code; }); + if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) + return; + var token = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + if (token === undefined) + return; + if (ts.isExpression(token) && ts.isBinaryExpression(token.parent)) { + return { suggestion: getSuggestion(related.messageText), expression: token.parent, arg: token }; + } + return undefined; + } + function doChange(changes, sourceFile, arg, expression) { + var callExpression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("Number"), ts.factory.createIdentifier("isNaN")), /*typeArguments*/ undefined, [arg]); + var operator = expression.operatorToken.kind; + changes.replaceNode(sourceFile, expression, operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ + ? ts.factory.createPrefixUnaryExpression(53 /* SyntaxKind.ExclamationToken */, callExpression) : callExpression); + } + function getSuggestion(messageText) { + var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [], _ = _a[0], suggestion = _a[1]; + return suggestion; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -157703,7 +159468,7 @@ var ts; var importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start); if (!importDeclaration) return; - var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); + var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); var typeOnlyChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program); }); var actions; if (namespaceChanges.length) { @@ -157718,7 +159483,7 @@ var ts; }); function getImportDeclaration(sourceFile, program, start) { var identifier = ts.tryCast(ts.getTokenAtPosition(sourceFile, start), ts.isIdentifier); - if (!identifier || identifier.parent.kind !== 178 /* SyntaxKind.TypeReference */) + if (!identifier || identifier.parent.kind !== 180 /* SyntaxKind.TypeReference */) return; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(identifier); @@ -157730,11 +159495,11 @@ var ts; // new type-only import declaration, but honestly I doubt anyone will ever use this // codefix at all, so it's probably not worth the lines of code. function doTypeOnlyImportChange(changes, sourceFile, importDeclaration, program) { - if (importDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importDeclaration.name); + if (importDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importDeclaration.name); return; } - var importClause = importDeclaration.kind === 267 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; + var importClause = importDeclaration.kind === 270 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; if (importClause.name && importClause.namedBindings) { // Cannot convert an import with a default import and named bindings to type-only // (it's a grammar error). @@ -157751,7 +159516,7 @@ var ts; // Don't convert it to type-only. return; } - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importClause); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importClause); } function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) { ts.refactor.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent); @@ -157829,7 +159594,7 @@ var ts; ]; } var result = []; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return changeInferToUnknown(t, sourceFile, token); }); var name = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name.text; result.push(codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Replace_infer_0_with_unknown, name], fixIdInfer, ts.Diagnostics.Replace_all_unused_infer_with_unknown)); @@ -157871,7 +159636,7 @@ var ts; break; } case fixIdDelete: { - if (token.kind === 137 /* SyntaxKind.InferKeyword */ || isImport(token)) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */ || isImport(token)) { break; // Can't delete } else if (ts.isJSDocTemplateTag(token)) { @@ -157900,7 +159665,7 @@ var ts; break; } case fixIdInfer: - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { changeInferToUnknown(changes, sourceFile, token); } break; @@ -157911,7 +159676,7 @@ var ts; }, }); function changeInferToUnknown(changes, sourceFile, token) { - changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)); + changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)); } function createDeleteFix(changes, diag) { return codefix.createCodeFixAction(fixName, changes, diag, fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations); @@ -157921,7 +159686,7 @@ var ts; } function isImport(token) { return token.kind === 100 /* SyntaxKind.ImportKeyword */ - || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 270 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 267 /* SyntaxKind.ImportClause */); + || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 273 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 270 /* SyntaxKind.ImportClause */); } /** Sometimes the diagnostic span is an entire ImportDeclaration, so we should remove the whole thing. */ function tryGetFullImport(token) { @@ -157931,7 +159696,7 @@ var ts; return ts.isVariableDeclarationList(token.parent) && ts.first(token.parent.getChildren(sourceFile)) === token; } function deleteEntireVariableStatement(changes, sourceFile, node) { - changes.delete(sourceFile, node.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? node.parent : node); + changes.delete(sourceFile, node.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? node.parent : node); } function deleteDestructuringElements(changes, sourceFile, node) { ts.forEach(node.elements, function (n) { return changes.delete(sourceFile, n); }); @@ -157940,7 +159705,7 @@ var ts; // Don't offer to prefix a property. if (errorCode === ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code) return; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { token = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name; } if (ts.isIdentifier(token) && canPrefix(token)) { @@ -157956,14 +159721,14 @@ var ts; } function canPrefix(token) { switch (token.parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var varDecl = token.parent; switch (varDecl.parent.parent.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return true; } } @@ -158018,8 +159783,8 @@ var ts; function mayDeleteParameter(checker, sourceFile, parameter, sourceFiles, program, cancellationToken, isFixAll) { var parent = parameter.parent; switch (parent.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: var index = parent.parameters.indexOf(parameter); var referent = ts.isMethodDeclaration(parent) ? parent.name : parent; var entries = ts.FindAllReferences.Core.getReferencedSymbolsForNode(parent.pos, referent, program, sourceFiles, cancellationToken); @@ -158049,20 +159814,20 @@ var ts; } } return true; - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { if (parent.name && isCallbackLike(checker, sourceFile, parent.name)) { return isLastParameter(parent, parameter, isFixAll); } return true; } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: // Can't remove a non-last parameter in a callback. Can remove a parameter in code-fix-all if future parameters are also unused. return isLastParameter(parent, parameter, isFixAll); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Setter must have a parameter return false; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Getter cannot have parameters return true; default: @@ -158123,7 +159888,7 @@ var ts; var container = (ts.isBlock(statement.parent) ? statement.parent : statement).parent; if (!ts.isBlock(statement.parent) || statement === ts.first(statement.parent.statements)) { switch (container.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (container.elseStatement) { if (ts.isBlock(statement.parent)) { break; @@ -158134,8 +159899,8 @@ var ts; return; } // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: changes.delete(sourceFile, container); return; } @@ -158208,7 +159973,7 @@ var ts; var typeNode = info.typeNode, type = info.type; var original = typeNode.getText(sourceFile); var actions = [fix(type, fixIdPlain, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)]; - if (typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */) { + if (typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */) { // for nullable types, suggest the flow-compatible `T | null | undefined` // in addition to the jsdoc/closure-compatible `T | null` actions.push(fix(checker.getNullableType(type, 32768 /* TypeFlags.Undefined */), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)); @@ -158228,7 +159993,7 @@ var ts; if (!info) return; var typeNode = info.typeNode, type = info.type; - var fixedType = typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; + var fixedType = typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; doChange(changes, sourceFile, typeNode, fixedType, checker); }); } @@ -158245,22 +160010,22 @@ var ts; // NOTE: Some locations are not handled yet: // MappedTypeNode.typeParameters and SignatureDeclaration.typeParameters, as well as CallExpression.typeArguments switch (node.kind) { - case 229 /* SyntaxKind.AsExpression */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 176 /* SyntaxKind.IndexSignature */: - case 195 /* SyntaxKind.MappedType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 231 /* SyntaxKind.AsExpression */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 178 /* SyntaxKind.IndexSignature */: + case 197 /* SyntaxKind.MappedType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; default: return false; @@ -158363,14 +160128,14 @@ var ts; } var insertBefore; switch (containingFunction.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: insertBefore = containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: insertBefore = ts.findChildOfKind(containingFunction, 98 /* SyntaxKind.FunctionKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: var kind = containingFunction.typeParameters ? 29 /* SyntaxKind.LessThanToken */ : 20 /* SyntaxKind.OpenParenToken */; insertBefore = ts.findChildOfKind(containingFunction, kind, sourceFile) || ts.first(containingFunction.parameters); break; @@ -158390,7 +160155,7 @@ var ts; changes.replaceNode(sourceFile, returnType, ts.factory.createTypeReferenceNode("Promise", ts.factory.createNodeArray([returnType]))); } } - changes.insertModifierBefore(sourceFile, 131 /* SyntaxKind.AsyncKeyword */, insertBefore); + changes.insertModifierBefore(sourceFile, 132 /* SyntaxKind.AsyncKeyword */, insertBefore); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -158706,7 +160471,7 @@ var ts; function annotate(changes, importAdder, sourceFile, declaration, type, program, host) { var typeNode = ts.getTypeNodeIfAccessible(type, declaration, program, host); if (typeNode) { - if (ts.isInJSFile(sourceFile) && declaration.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (ts.isInJSFile(sourceFile) && declaration.kind !== 168 /* SyntaxKind.PropertySignature */) { var parent = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : declaration; if (!parent) { return; @@ -158793,19 +160558,19 @@ var ts; function getFunctionReferences(containingFunction, sourceFile, program, cancellationToken) { var searchToken; switch (containingFunction.kind) { - case 171 /* SyntaxKind.Constructor */: - searchToken = ts.findChildOfKind(containingFunction, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); + case 173 /* SyntaxKind.Constructor */: + searchToken = ts.findChildOfKind(containingFunction, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: var parent = containingFunction.parent; searchToken = (ts.isVariableDeclaration(parent) || ts.isPropertyDeclaration(parent)) && ts.isIdentifier(parent.name) ? parent.name : containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: searchToken = containingFunction.name; break; } @@ -158947,24 +160712,24 @@ var ts; node = node.parent; } switch (node.parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: inferTypeFromExpressionStatement(node, usage); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: usage.isNumber = true; break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: inferTypeFromPrefixUnaryExpression(node.parent, usage); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: inferTypeFromBinaryExpression(node, node.parent, usage); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: inferTypeFromSwitchStatementLabel(node.parent, usage); break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.parent.expression === node) { inferTypeFromCallExpression(node.parent, usage); } @@ -158972,20 +160737,20 @@ var ts; inferTypeFromContextualType(node, usage); } break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: inferTypeFromPropertyAccessExpression(node.parent, usage); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: inferTypeFromPropertyElementExpression(node.parent, node, usage); break; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: inferTypeFromPropertyAssignment(node.parent, usage); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: inferTypeFromPropertyDeclaration(node.parent, usage); break; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var _a = node.parent, name = _a.name, initializer = _a.initializer; if (node === name) { if (initializer) { // This can happen for `let x = null;` which still has an implicit-any error. @@ -159107,7 +160872,7 @@ var ts; case 56 /* SyntaxKind.BarBarToken */: case 60 /* SyntaxKind.QuestionQuestionToken */: if (node === parent.left && - (node.parent.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { + (node.parent.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { // var x = x || {}; // TODO: use getFalsyflagsOfType addCandidateType(usage, checker.getTypeAtLocation(parent.right)); @@ -159135,7 +160900,7 @@ var ts; } } calculateUsageOfNode(parent, call.return_); - if (parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */) { (usage.calls || (usage.calls = [])).push(call); } else { @@ -159589,25 +161354,44 @@ var ts; * @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub. */ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) { + var _a; if (preserveOptional === void 0) { preserveOptional = 3 /* PreserveOptionalFlags.All */; } if (isAmbient === void 0) { isAmbient = false; } var declarations = symbol.getDeclarations(); - if (!(declarations && declarations.length)) { - return undefined; - } + var declaration = declarations === null || declarations === void 0 ? void 0 : declarations[0]; var checker = context.program.getTypeChecker(); var scriptTarget = ts.getEmitScriptTarget(context.program.getCompilerOptions()); - var declaration = declarations[0]; - var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); - var visibilityModifier = createVisibilityModifier(ts.getEffectiveModifierFlags(declaration)); - var modifiers = visibilityModifier ? ts.factory.createNodeArray([visibilityModifier]) : undefined; + /** + * (#49811) + * Note that there are cases in which the symbol declaration is not present. For example, in the code below both + * `MappedIndirect.ax` and `MappedIndirect.ay` have no declaration node attached (due to their mapped-type + * parent): + * + * ```ts + * type Base = { ax: number; ay: string }; + * type BaseKeys = keyof Base; + * type MappedIndirect = { [K in BaseKeys]: boolean }; + * ``` + * + * In such cases, we assume the declaration to be a `PropertySignature`. + */ + var kind = (_a = declaration === null || declaration === void 0 ? void 0 : declaration.kind) !== null && _a !== void 0 ? _a : 168 /* SyntaxKind.PropertySignature */; + var declarationName = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); + var effectiveModifierFlags = declaration ? ts.getEffectiveModifierFlags(declaration) : 0 /* ModifierFlags.None */; + var modifierFlags = effectiveModifierFlags & 4 /* ModifierFlags.Public */ ? 4 /* ModifierFlags.Public */ : + effectiveModifierFlags & 16 /* ModifierFlags.Protected */ ? 16 /* ModifierFlags.Protected */ : + 0 /* ModifierFlags.None */; + if (declaration && ts.isAutoAccessorPropertyDeclaration(declaration)) { + modifierFlags |= 128 /* ModifierFlags.Accessor */; + } + var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); var optional = !!(symbol.flags & 16777216 /* SymbolFlags.Optional */); var ambient = !!(enclosingDeclaration.flags & 16777216 /* NodeFlags.Ambient */) || isAmbient; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: + switch (kind) { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: var flags = quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : undefined; var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context)); if (importAdder) { @@ -159617,11 +161401,12 @@ var ts; importSymbols(importAdder, importableReference.symbols); } } - addClassElement(ts.factory.createPropertyDeclaration(modifiers, name, optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, + addClassElement(ts.factory.createPropertyDeclaration(modifiers, declaration ? createName(declarationName) : symbol.getName(), optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, /*initializer*/ undefined)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + ts.Debug.assertIsDefined(declarations); var typeNode_1 = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context)); var allAccessors = ts.getAllAccessorDeclarations(declarations, declaration); var orderedAccessors = allAccessors.secondAccessor @@ -159637,19 +161422,19 @@ var ts; for (var _i = 0, orderedAccessors_1 = orderedAccessors; _i < orderedAccessors_1.length; _i++) { var accessor = orderedAccessors_1[_i]; if (ts.isGetAccessorDeclaration(accessor)) { - addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, createName(declarationName), ts.emptyArray, createTypeNode(typeNode_1), createBody(body, quotePreference, ambient))); } else { ts.Debug.assertNode(accessor, ts.isSetAccessorDeclaration, "The counterpart to a getter should be a setter"); var parameter = ts.getSetAccessorValueParameter(accessor); var parameterName = parameter && ts.isIdentifier(parameter.name) ? ts.idText(parameter.name) : undefined; - addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, createName(declarationName), createDummyParameters(1, [parameterName], [createTypeNode(typeNode_1)], 1, /*inJs*/ false), createBody(body, quotePreference, ambient))); } } break; } - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: // The signature for the implementation appears as an entry in `signatures` iff // there is only one signature. // If there are overloads and an implementation signature, it appears as an @@ -159657,6 +161442,7 @@ var ts; // If there is more than one overload but no implementation signature // (eg: an abstract method or interface declaration), there is a 1-1 // correspondence of declarations and signatures. + ts.Debug.assertIsDefined(declarations); var signatures = type.isUnion() ? ts.flatMap(type.types, function (t) { return t.getCallSignatures(); }) : type.getCallSignatures(); if (!ts.some(signatures)) { break; @@ -159664,31 +161450,41 @@ var ts; if (declarations.length === 1) { ts.Debug.assert(signatures.length === 1, "One declaration implies one signature"); var signature = signatures[0]; - outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference, ambient)); break; } - for (var _a = 0, signatures_1 = signatures; _a < signatures_1.length; _a++) { - var signature = signatures_1[_a]; + for (var _b = 0, signatures_1 = signatures; _b < signatures_1.length; _b++) { + var signature = signatures_1[_b]; // Ensure nodes are fresh so they can have different positions when going through formatting. - outputMethod(quotePreference, signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName)); } if (!ambient) { if (declarations.length > signatures.length) { var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); - outputMethod(quotePreference, signature, modifiers, name, body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference)); } else { ts.Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count"); - addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); + addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, createName(declarationName), optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); } } break; } function outputMethod(quotePreference, signature, modifiers, name, body) { - var method = createSignatureDeclarationFromSignature(169 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); + var method = createSignatureDeclarationFromSignature(171 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); if (method) addClassElement(method); } + function createName(node) { + return ts.getSynthesizedDeepClone(node, /*includeTrivia*/ false); + } + function createBody(block, quotePreference, ambient) { + return ambient ? undefined : + ts.getSynthesizedDeepClone(block, /*includeTrivia*/ false) || createStubbedMethodBody(quotePreference); + } + function createTypeNode(typeNode) { + return ts.getSynthesizedDeepClone(typeNode, /*includeTrivia*/ false); + } } codefix.addNewNodeForMemberSymbol = addNewNodeForMemberSymbol; function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) { @@ -159762,6 +161558,9 @@ var ts; if (ts.isMethodDeclaration(signatureDeclaration)) { return ts.factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name !== null && name !== void 0 ? name : ts.factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body); } + if (ts.isFunctionDeclaration(signatureDeclaration)) { + return ts.factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, ts.tryCast(name, ts.isIdentifier), typeParameters, parameters, type, body !== null && body !== void 0 ? body : signatureDeclaration.body); + } return undefined; } codefix.createSignatureDeclarationFromSignature = createSignatureDeclarationFromSignature; @@ -159790,13 +161589,13 @@ var ts; ? undefined : checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker); switch (kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createMethodDeclaration(modifiers, asteriskToken, name, /*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference)); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return ts.factory.createMethodSignature(modifiers, name, - /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */) : type); - case 256 /* SyntaxKind.FunctionDeclaration */: + /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */) : type); + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference)); default: ts.Debug.fail("Unexpected kind"); @@ -159933,7 +161732,7 @@ var ts; /*dotDotDotToken*/ undefined, /*name*/ parameterName + (parameterNameCount || ""), /*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, - /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), + /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), /*initializer*/ undefined); parameters.push(newParameter); } @@ -159963,7 +161762,7 @@ var ts; if (someSigHasRestParameter) { var restParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest", - /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)), + /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)), /*initializer*/ undefined); parameters.push(restParameter); } @@ -159991,15 +161790,6 @@ var ts; /*multiline*/ true); } codefix.createStubbedBody = createStubbedBody; - function createVisibilityModifier(flags) { - if (flags & 4 /* ModifierFlags.Public */) { - return ts.factory.createToken(123 /* SyntaxKind.PublicKeyword */); - } - else if (flags & 16 /* ModifierFlags.Protected */) { - return ts.factory.createToken(122 /* SyntaxKind.ProtectedKeyword */); - } - return undefined; - } function setJsonCompilerOptionValues(changeTracker, configFile, options) { var tsconfigObjectLiteral = ts.getTsConfigObjectLiteralExpression(configFile); if (!tsconfigObjectLiteral) @@ -160078,6 +161868,15 @@ var ts; symbols.forEach(function (s) { return importAdder.addImportFromExportedSymbol(s, /*isValidTypeOnlyUseSite*/ true); }); } codefix.importSymbols = importSymbols; + function findAncestorMatchingSpan(sourceFile, span) { + var end = ts.textSpanEnd(span); + var token = ts.getTokenAtPosition(sourceFile, span.start); + while (token.end < end) { + token = token.parent; + } + return token; + } + codefix.findAncestorMatchingSpan = findAncestorMatchingSpan; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -160100,13 +161899,13 @@ var ts; if (ts.isClassLike(container)) { var modifierFlags = ts.getEffectiveModifierFlags(declaration); if (ts.isSourceFileJS(file)) { - var modifiers = ts.createModifiers(modifierFlags); + var modifiers = ts.factory.createModifiersFromModifierFlags(modifierFlags); accessorModifiers = modifiers; fieldModifiers = modifiers; } else { - accessorModifiers = ts.createModifiers(prepareModifierFlagsForAccessor(modifierFlags)); - fieldModifiers = ts.createModifiers(prepareModifierFlagsForField(modifierFlags)); + accessorModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForAccessor(modifierFlags)); + fieldModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForField(modifierFlags)); } if (ts.canHaveDecorators(declaration)) { fieldModifiers = ts.concatenate(ts.getDecorators(declaration), fieldModifiers); @@ -160175,7 +161974,7 @@ var ts; error: ts.getLocaleSpecificMessage(ts.Diagnostics.Name_is_not_valid) }; } - if (((ts.getEffectiveModifierFlags(declaration) & 125951 /* ModifierFlags.Modifier */) | meaning) !== meaning) { + if (((ts.getEffectiveModifierFlags(declaration) & 126975 /* ModifierFlags.Modifier */) | meaning) !== meaning) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_property_with_modifier) }; @@ -160188,7 +161987,7 @@ var ts; isStatic: ts.hasStaticModifier(declaration), isReadonly: ts.hasEffectiveReadonlyModifier(declaration), type: getDeclarationType(declaration, program), - container: declaration.kind === 164 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, + container: declaration.kind === 166 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, originalName: declaration.name.text, declaration: declaration, fieldName: fieldName, @@ -160262,7 +162061,7 @@ var ts; var type = typeChecker.getTypeFromTypeNode(typeNode); if (!typeChecker.isTypeAssignableTo(typeChecker.getUndefinedType(), type)) { var types = ts.isUnionTypeNode(typeNode) ? typeNode.types : [typeNode]; - return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)], false)); + return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)], false)); } } return typeNode; @@ -160320,7 +162119,7 @@ var ts; }); function getActionsForUsageOfInvalidImport(context) { var sourceFile = context.sourceFile; - var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 208 /* SyntaxKind.CallExpression */ : 209 /* SyntaxKind.NewExpression */; + var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 210 /* SyntaxKind.CallExpression */ : 211 /* SyntaxKind.NewExpression */; var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start), function (a) { return a.kind === targetKind; }); if (!node) { return []; @@ -160446,7 +162245,7 @@ var ts; return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_undefined_type_to_property_0, info.prop.name.getText()], fixIdAddUndefinedType, ts.Diagnostics.Add_undefined_type_to_all_uninitialized_properties); } function addUndefinedType(changeTracker, sourceFile, info) { - var undefinedTypeNode = ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + var undefinedTypeNode = ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); var types = ts.isUnionTypeNode(info.type) ? info.type.types.concat(undefinedTypeNode) : [info.type, undefinedTypeNode]; var unionTypeNode = ts.factory.createUnionTypeNode(types); if (info.isJs) { @@ -160492,7 +162291,7 @@ var ts; } else if (type.isClass()) { var classDeclaration = ts.getClassLikeDeclarationOfSymbol(type.symbol); - if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 128 /* ModifierFlags.Abstract */)) + if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 256 /* ModifierFlags.Abstract */)) return undefined; var constructorDeclaration = ts.getFirstConstructorWithBody(classDeclaration); if (constructorDeclaration && constructorDeclaration.parameters.length) @@ -160669,7 +162468,7 @@ var ts; function getImportTypeNode(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); ts.Debug.assert(token.kind === 100 /* SyntaxKind.ImportKeyword */, "This token should be an ImportKeyword"); - ts.Debug.assert(token.parent.kind === 200 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); + ts.Debug.assert(token.parent.kind === 202 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); return token.parent; } function doChange(changes, sourceFile, importType) { @@ -160798,7 +162597,7 @@ var ts; var otherMembers = members.filter(function (member) { return !ts.isIndexSignatureDeclaration(member); }); var parameter = ts.first(indexSignature.parameters); var mappedTypeParameter = ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.cast(parameter.name, ts.isIdentifier), parameter.type); - var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, + var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, /*nameType*/ undefined, indexSignature.questionToken, indexSignature.type, /*members*/ undefined); var intersectionType = ts.factory.createIntersectionTypeNode(__spreadArray(__spreadArray(__spreadArray([], ts.getAllSuperTypeNodes(container), true), [ @@ -160856,7 +162655,7 @@ var ts; }, }); function makeChange(changeTracker, sourceFile, span) { - var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 132 /* SyntaxKind.AwaitKeyword */; }); + var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 133 /* SyntaxKind.AwaitKeyword */; }); var awaitExpression = awaitKeyword && ts.tryCast(awaitKeyword.parent, ts.isAwaitExpression); if (!awaitExpression) { return; @@ -160923,28 +162722,45 @@ var ts; errorCodes: errorCodes, getCodeActions: function getCodeActionsToConvertConstToLet(context) { var sourceFile = context.sourceFile, span = context.span, program = context.program; - var range = getConstTokenRange(sourceFile, span.start, program); - if (range === undefined) + var info = getInfo(sourceFile, span.start, program); + if (info === undefined) return; - var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, range); }); - return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_const_to_let)]; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, info.token); }); + return [codefix.createCodeFixActionMaybeFixAll(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_all_const_to_let)]; + }, + getAllCodeActions: function (context) { + var program = context.program; + var seen = new ts.Map(); + return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) { + codefix.eachDiagnostic(context, errorCodes, function (diag) { + var info = getInfo(diag.file, diag.start, program); + if (info) { + if (ts.addToSeen(seen, ts.getSymbolId(info.symbol))) { + return doChange(changes, diag.file, info.token); + } + } + return undefined; + }); + })); }, fixIds: [fixId] }); - function getConstTokenRange(sourceFile, pos, program) { + function getInfo(sourceFile, pos, program) { var _a; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(ts.getTokenAtPosition(sourceFile, pos)); + if (symbol === undefined) + return; var declaration = ts.tryCast((_a = symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.parent, ts.isVariableDeclarationList); if (declaration === undefined) return; var constToken = ts.findChildOfKind(declaration, 85 /* SyntaxKind.ConstKeyword */, sourceFile); if (constToken === undefined) return; - return ts.createRange(constToken.pos, constToken.end); + return { symbol: symbol, token: constToken }; } - function doChange(changes, sourceFile, range) { - changes.replaceRangeWithText(sourceFile, range, "let"); + function doChange(changes, sourceFile, token) { + changes.replaceNode(sourceFile, token, ts.factory.createToken(119 /* SyntaxKind.LetKeyword */)); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -161119,7 +162935,6 @@ var ts; return { edits: edits, renameFilename: undefined, renameLocation: undefined }; }, }); - ; function getInfo(context, considerPartialSpans) { if (considerPartialSpans === void 0) { considerPartialSpans = true; } var file = context.file, program = context.program; @@ -161131,8 +162946,8 @@ var ts; } var checker = program.getTypeChecker(); var exportingModuleSymbol = getExportingModuleSymbol(exportNode, checker); - var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 513 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); - var wasDefault = !!(flags & 512 /* ModifierFlags.Default */); + var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 1025 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); + var wasDefault = !!(flags & 1024 /* ModifierFlags.Default */); // If source file already has a default export, don't offer refactor. if (!(flags & 1 /* ModifierFlags.Export */) || !wasDefault && exportingModuleSymbol.exports.has("default" /* InternalSymbolName.Default */)) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.This_file_already_has_a_default_export) }; @@ -161142,19 +162957,19 @@ var ts; : { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_named_export) }; }; switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: { var node = exportNode; if (!node.name) return undefined; return noSymbolError(node.name) || { exportNode: node, exportName: node.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { var vs = exportNode; // Must be `export const x = something;`. if (!(vs.declarationList.flags & 2 /* NodeFlags.Const */) || vs.declarationList.declarations.length !== 1) { @@ -161167,7 +162982,7 @@ var ts; return noSymbolError(decl.name) || { exportNode: vs, exportName: decl.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var node = exportNode; if (node.isExportEquals) return undefined; @@ -161197,12 +163012,12 @@ var ts; else { var exportKeyword = ts.Debug.checkDefined(ts.findModifier(exportNode, 93 /* SyntaxKind.ExportKeyword */), "Should find an export keyword in modifier list"); switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.factory.createToken(88 /* SyntaxKind.DefaultKeyword */)); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // If 'x' isn't used in this file and doesn't have type definition, `export const x = 0;` --> `export default 0;` var decl = ts.first(exportNode.declarationList.declarations); if (!ts.FindAllReferences.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile) && !decl.type) { @@ -161211,9 +163026,9 @@ var ts; break; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // `export type T = number;` -> `type T = number; export default T;` changes.deleteModifier(exportingSourceFile, exportKeyword); changes.insertNodeAfter(exportingSourceFile, exportNode, ts.factory.createExportDefault(ts.factory.createIdentifier(exportName.text))); @@ -161242,18 +163057,18 @@ var ts; function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.default` --> `a.foo` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier(exportName)); break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: { var spec = parent; // `default as foo` --> `foo`, `default as bar` --> `foo as bar` changes.replaceNode(importingSourceFile, spec, makeImportSpecifier(exportName, spec.name.text)); break; } - case 267 /* SyntaxKind.ImportClause */: { + case 270 /* SyntaxKind.ImportClause */: { var clause = parent; ts.Debug.assert(clause.name === ref, "Import clause name should match provided ref"); var spec = makeImportSpecifier(exportName, ref.text); @@ -161262,7 +163077,7 @@ var ts; // `import foo from "./a";` --> `import { foo } from "./a";` changes.replaceNode(importingSourceFile, ref, ts.factory.createNamedImports([spec])); } - else if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + else if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // `import foo, * as a from "./a";` --> `import * as a from ".a/"; import { foo } from "./a";` changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) }); var quotePreference = ts.isStringLiteral(clause.parent.moduleSpecifier) ? ts.quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1 /* QuotePreference.Double */; @@ -161276,7 +163091,7 @@ var ts; } break; } - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: var importTypeNode = parent; changes.replaceNode(importingSourceFile, parent, ts.factory.createImportTypeNode(importTypeNode.argument, importTypeNode.assertions, ts.factory.createIdentifier(exportName), importTypeNode.typeArguments, importTypeNode.isTypeOf)); break; @@ -161287,11 +163102,11 @@ var ts; function changeNamedToDefaultImport(importingSourceFile, ref, changes) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.foo` --> `a.default` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier("default")); break; - case 270 /* SyntaxKind.ImportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: { // `import { foo } from "./a";` --> `import foo from "./a";` // `import { foo as bar } from "./a";` --> `import bar from "./a";` var defaultImport = ts.factory.createIdentifier(parent.name.text); @@ -161304,7 +163119,7 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // `export { foo } from "./a";` --> `export { default as foo } from "./a";` // `export { foo as bar } from "./a";` --> `export { default as bar } from "./a";` // `export { foo as default } from "./a";` --> `export { default } from "./a";` @@ -161405,7 +163220,7 @@ var ts; if (!importClause.namedBindings) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_namespace_import_or_named_imports) }; } - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return { convertTo: 0 /* ImportKind.Named */, import: importClause.namedBindings }; } var shouldUseDefault = getShouldUseDefault(context.program, importClause); @@ -161596,7 +163411,6 @@ var ts; }); return { edits: edits, renameFilename: undefined, renameLocation: undefined }; } - ; function isValidExpression(node) { return ts.isBinaryExpression(node) || ts.isConditionalExpression(node); } @@ -161644,7 +163458,6 @@ var ts; if (expression.operatorToken.kind !== 55 /* SyntaxKind.AmpersandAmpersandToken */) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_logical_AND_access_chains) }; } - ; var finalExpression = getFinalExpressionInChain(expression.right); if (!finalExpression) return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_convertible_access_expression) }; @@ -161854,27 +163667,27 @@ var ts; var lastDeclaration = signatureDecls[signatureDecls.length - 1]; var updated = lastDeclaration; switch (lastDeclaration.kind) { - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { updated = ts.factory.updateMethodSignature(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { updated = ts.factory.updateMethodDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { updated = ts.factory.updateCallSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { updated = ts.factory.updateConstructorDeclaration(lastDeclaration, lastDeclaration.modifiers, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.body); break; } - case 175 /* SyntaxKind.ConstructSignature */: { + case 177 /* SyntaxKind.ConstructSignature */: { updated = ts.factory.updateConstructSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { updated = ts.factory.updateFunctionDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } @@ -161905,7 +163718,7 @@ var ts; } function convertParameterToNamedTupleMember(p) { ts.Debug.assert(ts.isIdentifier(p.name)); // This is checked during refactoring applicability checking - var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)), p); + var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)), p); var parameterDocComment = p.symbol && p.symbol.getDocumentationComment(checker); if (parameterDocComment) { var newComment = ts.displayPartsToString(parameterDocComment); @@ -161925,12 +163738,12 @@ var ts; } function isConvertableSignatureDeclaration(d) { switch (d.kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: return true; } return false; @@ -162049,8 +163862,8 @@ var ts; var i = 0; for (var _i = 0, extractions_1 = extractions; _i < extractions_1.length; _i++) { var _a = extractions_1[_i], functionExtraction = _a.functionExtraction, constantExtraction = _a.constantExtraction; - var description = functionExtraction.description; if (refactor.refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) { + var description = functionExtraction.description; if (functionExtraction.errors.length === 0) { // Don't issue refactorings with duplicated names. // Scopes come back in "innermost first" order, so extractions will @@ -162074,15 +163887,15 @@ var ts; } } if (refactor.refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) { + var description = constantExtraction.description; if (constantExtraction.errors.length === 0) { // Don't issue refactorings with duplicated names. // Scopes come back in "innermost first" order, so extractions will // preferentially go into nearer scopes - var description_1 = constantExtraction.description; - if (!usedConstantNames.has(description_1)) { - usedConstantNames.set(description_1, true); + if (!usedConstantNames.has(description)) { + usedConstantNames.set(description, true); constantActions.push({ - description: description_1, + description: description, name: "constant_scope_".concat(i), kind: extractConstantAction.kind }); @@ -162227,7 +164040,6 @@ var ts; var start = cursorRequest ? getExtractableParent(startToken) : ts.getParentNodeInSpan(startToken, sourceFile, adjustedSpan); // Do the same for the ending position var end = cursorRequest ? start : ts.getParentNodeInSpan(endToken, sourceFile, adjustedSpan); - var declarations = []; // We'll modify these flags as we walk the tree to collect data // about what things need to be done as part of the extraction. var rangeFacts = RangeFacts.None; @@ -162270,7 +164082,7 @@ var ts; // the expression. return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] }; } - return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; + return { targetRange: { range: statements, facts: rangeFacts, thisNode: thisNode } }; } if (ts.isReturnStatement(start) && !start.expression) { // Makes no sense to extract an expression-less return statement. @@ -162282,7 +164094,7 @@ var ts; if (errors) { return { errors: errors }; } - return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; // TODO: GH#18217 + return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, thisNode: thisNode } }; // TODO: GH#18217 /** * Attempt to refine the extraction node (generally, by shrinking it) to produce better results. * @param node The unrefined extraction node. @@ -162294,10 +164106,10 @@ var ts; } } else if (ts.isVariableStatement(node) || ts.isVariableDeclarationList(node)) { - var declarations_6 = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations; + var declarations = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations; var numInitializers = 0; var lastInitializer = void 0; - for (var _i = 0, declarations_5 = declarations_6; _i < declarations_5.length; _i++) { + for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; if (declaration.initializer) { numInitializers++; @@ -162325,20 +164137,20 @@ var ts; function checkForStaticContext(nodeToCheck, containingClass) { var current = nodeToCheck; while (current !== containingClass) { - if (current.kind === 167 /* SyntaxKind.PropertyDeclaration */) { + if (current.kind === 169 /* SyntaxKind.PropertyDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 164 /* SyntaxKind.Parameter */) { + else if (current.kind === 166 /* SyntaxKind.Parameter */) { var ctorOrMethod = ts.getContainingFunction(current); - if (ctorOrMethod.kind === 171 /* SyntaxKind.Constructor */) { + if (ctorOrMethod.kind === 173 /* SyntaxKind.Constructor */) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 169 /* SyntaxKind.MethodDeclaration */) { + else if (current.kind === 171 /* SyntaxKind.MethodDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } @@ -162376,9 +164188,9 @@ var ts; visit(nodeToCheck); if (rangeFacts & RangeFacts.UsesThis) { var container = ts.getThisContainer(nodeToCheck, /** includeArrowFunctions */ false); - if (container.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) || - container.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (container.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) || + container.kind === 215 /* SyntaxKind.FunctionExpression */) { rangeFacts |= RangeFacts.UsesThisInFunction; } } @@ -162389,7 +164201,7 @@ var ts; return true; } if (ts.isDeclaration(node)) { - var declaringNode = (node.kind === 254 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; + var declaringNode = (node.kind === 257 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; if (ts.hasSyntacticModifier(declaringNode, 1 /* ModifierFlags.Export */)) { // TODO: GH#18217 Silly to use `errors ||` since it's definitely not defined (see top of `visit`) // Also, if we're only pushing one error, just use `let error: Diagnostic | undefined`! @@ -162397,20 +164209,19 @@ var ts; (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; } - declarations.push(node.symbol); } // Some things can't be extracted in certain situations switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport)); return true; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; case 106 /* SyntaxKind.SuperKeyword */: // For a super *constructor call*, we have to be extracting the entire class, // but a super *method call* simply implies a 'this' reference - if (node.parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.parent.kind === 210 /* SyntaxKind.CallExpression */) { // Super constructor call var containingClass_1 = ts.getContainingClass(node); if (containingClass_1 === undefined || containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) { @@ -162423,7 +164234,7 @@ var ts; thisNode = node; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // check if arrow function uses this ts.forEachChild(node, function check(n) { if (ts.isThis(n)) { @@ -162438,39 +164249,39 @@ var ts; } }); // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) { // You cannot extract global declarations (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope)); } // falls through - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // do not dive into functions or classes return false; } var savedPermittedJumps = permittedJumps; switch (node.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: permittedJumps &= ~4 /* PermittedJumps.Return */; break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // forbid all jumps inside try blocks permittedJumps = 0 /* PermittedJumps.None */; break; - case 235 /* SyntaxKind.Block */: - if (node.parent && node.parent.kind === 252 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { + case 238 /* SyntaxKind.Block */: + if (node.parent && node.parent.kind === 255 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { // allow unconditional returns from finally blocks permittedJumps = 4 /* PermittedJumps.Return */; } break; - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: // allow unlabeled break inside case clauses permittedJumps |= 1 /* PermittedJumps.Break */; break; @@ -162482,20 +164293,20 @@ var ts; break; } switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: rangeFacts |= RangeFacts.UsesThis; thisNode = node; break; - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { var label = node.label; (seenLabels || (seenLabels = [])).push(label.escapedText); ts.forEachChild(node, visit); seenLabels.pop(); break; } - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: { + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: { var label = node.label; if (label) { if (!ts.contains(seenLabels, label.escapedText)) { @@ -162504,20 +164315,20 @@ var ts; } } else { - if (!(permittedJumps & (node.kind === 246 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { + if (!(permittedJumps & (node.kind === 249 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { // attempt to break or continue in a forbidden context (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); } } break; } - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: rangeFacts |= RangeFacts.IsAsyncFunction; break; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: rangeFacts |= RangeFacts.IsGenerator; break; - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: if (permittedJumps & 4 /* PermittedJumps.Return */) { rangeFacts |= RangeFacts.HasReturn; } @@ -162587,7 +164398,7 @@ var ts; while (true) { current = current.parent; // A function parameter's initializer is actually in the outer scope, not the function declaration - if (current.kind === 164 /* SyntaxKind.Parameter */) { + if (current.kind === 166 /* SyntaxKind.Parameter */) { // Skip all the way to the outer scope of the function that declared this parameter current = ts.findAncestor(current, function (parent) { return ts.isFunctionLikeDeclaration(parent); }).parent; } @@ -162598,7 +164409,7 @@ var ts; // * Module/namespace or source file if (isScope(current)) { scopes.push(current); - if (current.kind === 305 /* SyntaxKind.SourceFile */) { + if (current.kind === 308 /* SyntaxKind.SourceFile */) { return scopes; } } @@ -162688,32 +164499,32 @@ var ts; } function getDescriptionForFunctionLikeDeclaration(scope) { switch (scope.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return scope.name ? "function '".concat(scope.name.text, "'") : ts.ANONYMOUS; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return "arrow function"; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return "method '".concat(scope.name.getText(), "'"); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return "'get ".concat(scope.name.getText(), "'"); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return "'set ".concat(scope.name.getText(), "'"); default: throw ts.Debug.assertNever(scope, "Unexpected scope kind ".concat(scope.kind)); } } function getDescriptionForClassLikeDeclaration(scope) { - return scope.kind === 257 /* SyntaxKind.ClassDeclaration */ + return scope.kind === 260 /* SyntaxKind.ClassDeclaration */ ? scope.name ? "class '".concat(scope.name.text, "'") : "anonymous class declaration" : scope.name ? "class expression '".concat(scope.name.text, "'") : "anonymous class expression"; } function getDescriptionForModuleLikeDeclaration(scope) { - return scope.kind === 262 /* SyntaxKind.ModuleBlock */ + return scope.kind === 265 /* SyntaxKind.ModuleBlock */ ? "namespace '".concat(scope.parent.name.getText(), "'") : scope.externalModuleIndicator ? 0 /* SpecialScope.Module */ : 1 /* SpecialScope.Global */; } @@ -162786,7 +164597,7 @@ var ts; modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } if (range.facts & RangeFacts.IsAsyncFunction) { - modifiers.push(ts.factory.createModifier(131 /* SyntaxKind.AsyncKeyword */)); + modifiers.push(ts.factory.createModifier(132 /* SyntaxKind.AsyncKeyword */)); } newFunction = ts.factory.createMethodDeclaration(modifiers.length ? modifiers : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, /*questionToken*/ undefined, typeParameters, parameters, returnType, body); @@ -162800,7 +164611,7 @@ var ts; /*questionToken*/ undefined, checker.typeToTypeNode(checker.getTypeAtLocation(range.thisNode), scope, 1 /* NodeBuilderFlags.NoTruncation */), /*initializer*/ undefined)); } - newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(131 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); + newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(132 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); } var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); var minInsertionPos = (isReadonlyArray(range.range) ? ts.last(range.range) : range.range).end; @@ -162948,9 +164759,9 @@ var ts; while (ts.isParenthesizedTypeNode(withoutParens)) { withoutParens = withoutParens.type; } - return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 153 /* SyntaxKind.UndefinedKeyword */; }) + return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 155 /* SyntaxKind.UndefinedKeyword */; }) ? clone - : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } } /** @@ -162981,7 +164792,7 @@ var ts; if (rangeFacts & RangeFacts.InStaticRegion) { modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } - modifiers.push(ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); + modifiers.push(ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); var newVariable = ts.factory.createPropertyDeclaration(modifiers, localNameText, /*questionToken*/ undefined, variableType, initializer); var localReference = ts.factory.createPropertyAccessExpression(rangeFacts & RangeFacts.InStaticRegion @@ -163012,7 +164823,7 @@ var ts; var localReference = ts.factory.createIdentifier(localNameText); changeTracker.replaceNode(context.file, node, localReference); } - else if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { + else if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { // If the parent is an expression statement and the target scope is the immediately enclosing one, // replace the statement with the declaration. var newVariableStatement = ts.factory.createVariableStatement( @@ -163031,7 +164842,7 @@ var ts; changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ false); } // Consume - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { // If the parent is an expression statement, delete it. changeTracker.delete(context.file, node.parent); } @@ -163677,30 +165488,30 @@ var ts; function isExtractableExpression(node) { var parent = node.parent; switch (parent.kind) { - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return false; } switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: - return parent.kind !== 266 /* SyntaxKind.ImportDeclaration */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */; - case 225 /* SyntaxKind.SpreadElement */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 203 /* SyntaxKind.BindingElement */: + return parent.kind !== 269 /* SyntaxKind.ImportDeclaration */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */; + case 227 /* SyntaxKind.SpreadElement */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 205 /* SyntaxKind.BindingElement */: return false; case 79 /* SyntaxKind.Identifier */: - return parent.kind !== 203 /* SyntaxKind.BindingElement */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */ && - parent.kind !== 275 /* SyntaxKind.ExportSpecifier */; + return parent.kind !== 205 /* SyntaxKind.BindingElement */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */ && + parent.kind !== 278 /* SyntaxKind.ExportSpecifier */; } return true; } function isBlockLike(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 305 /* SyntaxKind.SourceFile */: - case 262 /* SyntaxKind.ModuleBlock */: - case 289 /* SyntaxKind.CaseClause */: + case 238 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 265 /* SyntaxKind.ModuleBlock */: + case 292 /* SyntaxKind.CaseClause */: return true; default: return false; @@ -163988,7 +165799,6 @@ var ts; (function (ts) { var refactor; (function (refactor) { - ; /** * Checks if some refactor info has refactor error info. */ @@ -164093,15 +165903,14 @@ var ts; // Imports will be copied to the new file anyway, and may still be needed in the old file. // Prologue directives will be copied to the new file and should be left in the old file. return !isPureImport(statement) && !ts.isPrologueDirective(statement); - ; } function isPureImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return true; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return !ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return node.declarationList.declarations.every(function (d) { return !!d.initializer && ts.isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true); }); default: return false; @@ -164124,7 +165933,7 @@ var ts; function getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, newModuleName, preferences) { var checker = program.getTypeChecker(); var prologueDirectives = ts.takeWhile(oldFile.statements, ts.isPrologueDirective); - if (!oldFile.externalModuleIndicator && !oldFile.commonJsModuleIndicator) { + if (oldFile.externalModuleIndicator === undefined && oldFile.commonJsModuleIndicator === undefined && usage.oldImportsNeededByNewFile.size() === 0) { deleteMovedStatements(oldFile, toMove.ranges, changes); return __spreadArray(__spreadArray([], prologueDirectives, true), toMove.all, true); } @@ -164197,12 +166006,12 @@ var ts; } function getNamespaceLikeImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? + case 269 /* SyntaxKind.ImportDeclaration */: + return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? node.importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.tryCast(node.name, ts.isIdentifier); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); @@ -164233,21 +166042,21 @@ var ts; var newNamespaceId = ts.factory.createIdentifier(newNamespaceName); var newModuleString = ts.factory.createStringLiteral(newModuleSpecifier); switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, ts.factory.createNamespaceImport(newNamespaceId)), newModuleString, /*assertClause*/ undefined); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.createImportEqualsDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, newNamespaceId, ts.factory.createExternalModuleReference(newModuleString)); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.factory.createVariableDeclaration(newNamespaceId, /*exclamationToken*/ undefined, /*type*/ undefined, createRequireCall(newModuleString)); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); } } function moduleSpecifierFromImport(i) { - return (i.kind === 266 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier - : i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression + return (i.kind === 269 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier + : i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression : i.initializer.arguments[0]); } function forEachImportInStatement(statement, cb) { @@ -164317,15 +166126,15 @@ var ts; } function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) { switch (importDecl.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (isUnused(importDecl.name)) { changes.delete(sourceFile, importDecl); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused); break; default: @@ -164338,7 +166147,7 @@ var ts; var _a = importDecl.importClause, name = _a.name, namedBindings = _a.namedBindings; var defaultUnused = !name || isUnused(name); var namedBindingsUnused = !namedBindings || - (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); + (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); if (defaultUnused && namedBindingsUnused) { changes.delete(sourceFile, importDecl); } @@ -164350,7 +166159,7 @@ var ts; if (namedBindingsUnused) { changes.replaceNode(sourceFile, importDecl.importClause, ts.factory.updateImportClause(importDecl.importClause, importDecl.importClause.isTypeOnly, name, /*namedBindings*/ undefined)); } - else if (namedBindings.kind === 269 /* SyntaxKind.NamedImports */) { + else if (namedBindings.kind === 272 /* SyntaxKind.NamedImports */) { for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) { var element = _b[_i]; if (isUnused(element.name)) @@ -164365,12 +166174,17 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: if (isUnused(name)) { - changes.delete(sourceFile, name); + if (varDecl.initializer && ts.isRequireCall(varDecl.initializer, /*requireStringLiteralLikeArgument*/ true)) { + changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && ts.length(varDecl.parent.declarations) === 1 ? varDecl.parent.parent : varDecl); + } + else { + changes.delete(sourceFile, name); + } } break; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: break; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: if (name.elements.every(function (e) { return ts.isIdentifier(e.name) && isUnused(e.name); })) { changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl); } @@ -164412,7 +166226,7 @@ var ts; if (markSeenTop(top)) { addExportToChanges(oldFile, top, name, changes, useEsModuleSyntax); } - if (ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */)) { oldFileDefault = name; } else { @@ -164500,14 +166314,14 @@ var ts; // Below should all be utilities function isInImport(decl) { switch (decl.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return isVariableDeclarationInImport(decl); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); default: return false; @@ -164519,7 +166333,7 @@ var ts; } function filterImport(i, moduleSpecifier, keep) { switch (i.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { var clause = i.importClause; if (!clause) return undefined; @@ -164529,9 +166343,9 @@ var ts; ? ts.factory.createImportDeclaration(/*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, defaultImport, namedBindings), moduleSpecifier, /*assertClause*/ undefined) : undefined; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return keep(i.name) ? i : undefined; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var name = filterBindingName(i.name, keep); return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : undefined; } @@ -164540,7 +166354,7 @@ var ts; } } function filterNamedBindings(namedBindings, keep) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return keep(namedBindings.name) ? namedBindings : undefined; } else { @@ -164552,9 +166366,9 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return keep(name) ? name : undefined; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return name; - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { // We can't handle nested destructurings or property names well here, so just copy them all. var newElements = name.elements.filter(function (prop) { return prop.propertyName || !ts.isIdentifier(prop.name) || keep(prop.name); }); return newElements.length ? ts.factory.createObjectBindingPattern(newElements) : undefined; @@ -164597,6 +166411,9 @@ var ts; ts.copyEntries(this.map, clone.map); return clone; }; + SymbolSet.prototype.size = function () { + return this.map.size; + }; return SymbolSet; }()); function isTopLevelDeclaration(node) { @@ -164611,13 +166428,13 @@ var ts; } function isNonVariableTopLevelDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -164625,17 +166442,17 @@ var ts; } function forEachTopLevelDeclaration(statement, cb) { switch (statement.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return cb(statement); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.firstDefined(statement.declarationList.declarations, function (decl) { return forEachTopLevelDeclarationInBindingName(decl.name, cb); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; return ts.isBinaryExpression(expression) && ts.getAssignmentDeclarationKind(expression) === 1 /* AssignmentDeclarationKind.ExportsProperty */ ? cb(statement) @@ -164647,8 +166464,8 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return cb(ts.cast(name.parent, function (x) { return ts.isVariableDeclaration(x) || ts.isBindingElement(x); })); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return ts.firstDefined(name.elements, function (em) { return ts.isOmittedExpression(em) ? undefined : forEachTopLevelDeclarationInBindingName(em.name, cb); }); default: return ts.Debug.assertNever(name, "Unexpected name kind ".concat(name.kind)); @@ -164659,9 +166476,9 @@ var ts; } function getTopLevelDeclarationStatement(d) { switch (d.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return d.parent.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getTopLevelDeclarationStatement(ts.cast(d.parent.parent, function (p) { return ts.isVariableDeclaration(p) || ts.isBindingElement(p); })); default: return d; @@ -164685,7 +166502,8 @@ var ts; if (useEs6Exports) { return !ts.isExpressionStatement(decl) && ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */) || !!(name && ((_a = sourceFile.symbol.exports) === null || _a === void 0 ? void 0 : _a.has(name.escapedText))); } - return getNamesToExportInCommonJS(decl).some(function (name) { return sourceFile.symbol.exports.has(ts.escapeLeadingUnderscores(name)); }); + return !!sourceFile.symbol && !!sourceFile.symbol.exports && + getNamesToExportInCommonJS(decl).some(function (name) { return sourceFile.symbol.exports.has(ts.escapeLeadingUnderscores(name)); }); } function addExport(decl, useEs6Exports) { return useEs6Exports ? [addEs6Export(decl)] : addCommonjsExport(decl); @@ -164693,24 +166511,24 @@ var ts; function addEs6Export(d) { var modifiers = ts.canHaveModifiers(d) ? ts.concatenate([ts.factory.createModifier(93 /* SyntaxKind.ExportKeyword */)], ts.getModifiers(d)) : undefined; switch (d.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.updateFunctionDeclaration(d, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var decorators = ts.canHaveDecorators(d) ? ts.getDecorators(d) : undefined; return ts.factory.updateClassDeclaration(d, ts.concatenate(decorators, modifiers), d.name, d.typeParameters, d.heritageClauses, d.members); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.factory.updateVariableStatement(d, modifiers, d.declarationList); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.factory.updateModuleDeclaration(d, modifiers, d.name, d.body); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.factory.updateEnumDeclaration(d, modifiers, d.name, d.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return ts.factory.updateTypeAliasDeclaration(d, modifiers, d.name, d.typeParameters, d.type); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.factory.updateInterfaceDeclaration(d, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.updateImportEqualsDeclaration(d, modifiers, d.isTypeOnly, d.name, d.moduleReference); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(d, "Unexpected declaration kind ".concat(d.kind)); @@ -164721,18 +166539,18 @@ var ts; } function getNamesToExportInCommonJS(decl) { switch (decl.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return [decl.name.text]; // TODO: GH#18217 - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.mapDefined(decl.declarationList.declarations, function (d) { return ts.isIdentifier(d.name) ? d.name.text : undefined; }); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.emptyArray; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail("Can't export an ExpressionStatement"); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(decl, "Unexpected decl kind ".concat(decl.kind)); @@ -165073,15 +166891,15 @@ var ts; var parent = functionReference.parent; switch (parent.kind) { // foo(...) or super(...) or new Foo(...) - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: var callOrNewExpression = ts.tryCast(parent, ts.isCallOrNewExpression); if (callOrNewExpression && callOrNewExpression.expression === functionReference) { return callOrNewExpression; } break; // x.foo(...) - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) { var callOrNewExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallOrNewExpression); @@ -165091,7 +166909,7 @@ var ts; } break; // x["foo"](...) - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) { var callOrNewExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallOrNewExpression); @@ -165110,14 +166928,14 @@ var ts; var parent = reference.parent; switch (parent.kind) { // `C.foo` - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.expression === reference) { return propertyAccessExpression; } break; // `C["foo"]` - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.expression === reference) { return elementAccessExpression; @@ -165163,16 +166981,16 @@ var ts; if (!isValidParameterNodeArray(functionDeclaration.parameters, checker)) return false; switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralExpression(functionDeclaration.parent)) { var contextualSymbol = getSymbolForContextualType(functionDeclaration.name, checker); // don't offer the refactor when there are multiple signatures since we won't know which ones the user wants to change return ((_a = contextualSymbol === null || contextualSymbol === void 0 ? void 0 : contextualSymbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 && isSingleImplementation(functionDeclaration, checker); } return isSingleImplementation(functionDeclaration, checker); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (ts.isClassDeclaration(functionDeclaration.parent)) { return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker); } @@ -165180,8 +166998,8 @@ var ts; return isValidVariableDeclaration(functionDeclaration.parent.parent) && isSingleImplementation(functionDeclaration, checker); } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return isValidVariableDeclaration(functionDeclaration.parent); } return false; @@ -165329,7 +167147,7 @@ var ts; } function getClassNames(constructorDeclaration) { switch (constructorDeclaration.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = constructorDeclaration.parent; if (classDeclaration.name) return [classDeclaration.name]; @@ -165337,7 +167155,7 @@ var ts; // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(classDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless class declaration should be a default export"); return [defaultModifier]; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var classExpression = constructorDeclaration.parent; var variableDeclaration = constructorDeclaration.parent.parent; var className = classExpression.name; @@ -165348,25 +167166,25 @@ var ts; } function getFunctionNames(functionDeclaration) { switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (functionDeclaration.name) return [functionDeclaration.name]; // If the function declaration doesn't have a name, it should have a default modifier. // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(functionDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless function declaration should be a default export"); return [defaultModifier]; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return [functionDeclaration.name]; - case 171 /* SyntaxKind.Constructor */: - var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 134 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); - if (functionDeclaration.parent.kind === 226 /* SyntaxKind.ClassExpression */) { + case 173 /* SyntaxKind.Constructor */: + var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 135 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); + if (functionDeclaration.parent.kind === 228 /* SyntaxKind.ClassExpression */) { var variableDeclaration = functionDeclaration.parent.parent; return [variableDeclaration.name, ctrKeyword]; } return [ctrKeyword]; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return [functionDeclaration.parent.name]; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (functionDeclaration.name) return [functionDeclaration.name, functionDeclaration.parent.name]; return [functionDeclaration.parent.name]; @@ -165457,11 +167275,11 @@ var ts; function getParentBinaryExpression(expr) { var container = ts.findAncestor(expr.parent, function (n) { switch (n.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return false; - case 223 /* SyntaxKind.TemplateExpression */: - case 221 /* SyntaxKind.BinaryExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return !(ts.isBinaryExpression(n.parent) && isNotEqualsOperator(n.parent)); default: return "quit"; @@ -165909,10 +167727,10 @@ var ts; } function isConvertibleDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return true; default: return false; @@ -165957,7 +167775,7 @@ var ts; this.kind = kind; } NodeObject.prototype.assertHasRealPosition = function (message) { - // eslint-disable-next-line debug-assert + // eslint-disable-next-line local/debug-assert ts.Debug.assert(!ts.positionIsSynthesized(this.pos) && !ts.positionIsSynthesized(this.end), message || "Node must have a real position for this operation"); }; NodeObject.prototype.getSourceFile = function () { @@ -166014,8 +167832,8 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 309 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 347 /* SyntaxKind.LastJSDocNode */; }); - return child.kind < 161 /* SyntaxKind.FirstNode */ ? + var child = ts.find(children, function (kid) { return kid.kind < 312 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 350 /* SyntaxKind.LastJSDocNode */; }); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getFirstToken(sourceFile); }; @@ -166026,7 +167844,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 161 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); }; NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) { return ts.forEachChild(this, cbNode, cbNodeArray); @@ -166086,7 +167904,7 @@ var ts; } } function createSyntaxList(nodes, parent) { - var list = createNode(348 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); + var list = createNode(351 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { @@ -166435,7 +168253,7 @@ var ts; var _a; if (!seenSymbols_1.has(symbol)) { seenSymbols_1.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualJsDocTags(declaration, checker); } return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : undefined; @@ -166445,8 +168263,8 @@ var ts; tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true); } }; - for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { - var declaration = declarations_7[_i]; + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; _loop_20(declaration); } } @@ -166462,7 +168280,7 @@ var ts; var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) { if (!seenSymbols_2.has(symbol)) { seenSymbols_2.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualDocumentationComment(declaration, checker); } return symbol.getDocumentationComment(checker); @@ -166472,8 +168290,8 @@ var ts; if (inheritedDocs) doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc); }; - for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { - var declaration = declarations_8[_i]; + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; _loop_21(declaration); } } @@ -166481,7 +168299,7 @@ var ts; } function findBaseOfDeclaration(checker, declaration, cb) { var _a; - var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; + var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; if (!classOrInterfaceDeclaration) return; var isStaticMember = ts.hasStaticModifier(declaration); @@ -166496,7 +168314,7 @@ var ts; __extends(SourceFileObject, _super); function SourceFileObject(kind, pos, end) { var _this = _super.call(this, kind, pos, end) || this; - _this.kind = 305 /* SyntaxKind.SourceFile */; + _this.kind = 308 /* SyntaxKind.SourceFile */; return _this; } SourceFileObject.prototype.update = function (newText, textChangeRange) { @@ -166555,10 +168373,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -166578,31 +168396,31 @@ var ts; } ts.forEachChild(node, visit); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 184 /* SyntaxKind.TypeLiteral */: addDeclaration(node); ts.forEachChild(node, visit); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Only consider parameter properties if (!ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { break; } // falls through - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -166613,12 +168431,12 @@ var ts; } } // falls through - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: addDeclaration(node); break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; var exportDeclaration = node; @@ -166631,7 +168449,7 @@ var ts; } } break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -166643,7 +168461,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -166652,7 +168470,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) !== 0 /* AssignmentDeclarationKind.None */) { addDeclaration(node); } @@ -166998,7 +168816,7 @@ var ts; var rootFileNames = host.getScriptFileNames().slice(); // Get a fresh cache of the host information var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; var hasChangedAutomaticTypeDirectiveNames = ts.maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames); var projectReferences = (_b = host.getProjectReferences) === null || _b === void 0 ? void 0 : _b.call(host); var parsedCommandLines; @@ -167029,7 +168847,7 @@ var ts; }, onReleaseOldSourceFile: onReleaseOldSourceFile, onReleaseParsedCommandLine: onReleaseParsedCommandLine, - hasInvalidatedResolution: hasInvalidatedResolution, + hasInvalidatedResolutions: hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames, trace: ts.maybeBind(host, host.trace), resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames), @@ -167064,8 +168882,12 @@ var ts; getCurrentDirectory: compilerHost.getCurrentDirectory, onUnRecoverableConfigFileDiagnostic: ts.noop, }; + // The call to isProgramUptoDate below may refer back to documentRegistryBucketKey; + // calculate this early so it's not undefined if downleveled to a var (or, if emitted + // as a const variable without downleveling, doesn't crash). + var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); // If the program is already up-to-date, we can reuse it - if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { return; } // IMPORTANT - It is critical from this moment onward that we do not check @@ -167073,7 +168895,6 @@ var ts; // instance. If we cancel midway through, we may end up in an inconsistent state where // the program points to old source files that have been invalidated because of // incremental parsing. - var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); var options = { rootNames: rootFileNames, options: newSettings, @@ -167369,16 +169190,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return !ts.isLabelName(node) && !ts.isTagName(node) && !ts.isConstTypeReference(node.parent); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: // Don't return quickInfo if inside the comment in `a/**/.b` return !ts.isInComment(sourceFile, position); case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 106 /* SyntaxKind.SuperKeyword */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return true; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return ts.isImportMeta(node); default: return false; @@ -167485,15 +169306,15 @@ var ts; return undefined; } switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: case 10 /* SyntaxKind.StringLiteral */: case 95 /* SyntaxKind.FalseKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 106 /* SyntaxKind.SuperKeyword */: case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 79 /* SyntaxKind.Identifier */: break; // Cant create the text span @@ -167510,7 +169331,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -167640,12 +169461,14 @@ var ts; return ts.codefix.getAllFixes({ fixId: fixId, sourceFile: sourceFile, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences }); } function organizeImports(args, formatOptions, preferences) { + var _a; if (preferences === void 0) { preferences = ts.emptyOptions; } synchronizeHostData(); ts.Debug.assert(args.type === "file"); var sourceFile = getValidSourceFile(args.fileName); var formatContext = ts.formatting.getFormatContext(formatOptions, host); - return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences, args.skipDestructiveCodeActions); + var mode = (_a = args.mode) !== null && _a !== void 0 ? _a : (args.skipDestructiveCodeActions ? "SortAndCombine" /* OrganizeImportsMode.SortAndCombine */ : "All" /* OrganizeImportsMode.All */); + return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences, mode); } function getEditsForFileRename(oldFilePath, newFilePath, formatOptions, preferences) { if (preferences === void 0) { preferences = ts.emptyOptions; } @@ -168259,7 +170082,7 @@ var ts; */ function literalIsName(node) { return ts.isDeclarationName(node) || - node.parent.kind === 277 /* SyntaxKind.ExternalModuleReference */ || + node.parent.kind === 280 /* SyntaxKind.ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node); } @@ -168277,13 +170100,13 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined; } // falls through case 79 /* SyntaxKind.Identifier */: return ts.isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 286 /* SyntaxKind.JsxAttributes */) && + (node.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 289 /* SyntaxKind.JsxAttributes */) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -168325,7 +170148,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.argumentExpression === node; } /** @@ -168418,114 +170241,114 @@ var ts; if (node) { var parent = node.parent; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return spanInVariableDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return spanInParameterDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return spanInFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanInBlock(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInBlock(node.block); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: // span in statement return spanInNode(node.statement); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return spanInForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 203 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 205 /* SyntaxKind.BindingElement */: // span on complete node return textSpan(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: // span in statement return spanInNode(node.statement); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return spanInNodeArray(parent.modifiers, node, ts.isDecorator); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return undefined; // Tokens: case 26 /* SyntaxKind.SemicolonToken */: @@ -168555,7 +170378,7 @@ var ts; case 83 /* SyntaxKind.CatchKeyword */: case 96 /* SyntaxKind.FinallyKeyword */: return spanInNextNode(node); - case 160 /* SyntaxKind.OfKeyword */: + case 162 /* SyntaxKind.OfKeyword */: return spanInOfKeyword(node); default: // Destructuring pattern in destructuring assignment @@ -168568,13 +170391,13 @@ var ts; // `a` or `...c` or `d: x` from // `[a, b, ...c]` or `{ a, b }` or `{ d: x }` from destructuring pattern if ((node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 225 /* SyntaxKind.SpreadElement */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) && + node.kind === 227 /* SyntaxKind.SpreadElement */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(parent)) { return textSpan(node); } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { var _a = node, left = _a.left, operatorToken = _a.operatorToken; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of @@ -168596,22 +170419,22 @@ var ts; } if (ts.isExpressionNode(node)) { switch (parent.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return textSpan(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -168620,21 +170443,21 @@ var ts; } } switch (node.parent.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // If this is name of property assignment, set breakpoint in the initializer if (node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } break; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: // Breakpoint in type assertion goes to its operand if (node.parent.type === node) { return spanInNextNode(node.parent.type); } break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: { // initializer of variable/parameter declaration go to previous node var _b = node.parent, initializer = _b.initializer, type = _b.type; if (initializer === node || type === node || ts.isAssignmentOperator(node.kind)) { @@ -168642,7 +170465,7 @@ var ts; } break; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var left = node.parent.left; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) { // If initializer of destructuring assignment move to previous token @@ -168672,7 +170495,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } var parent = variableDeclaration.parent; @@ -168684,7 +170507,7 @@ var ts; // or its declaration from 'for of' if ((ts.hasOnlyExpressionInitializer(variableDeclaration) && variableDeclaration.initializer) || ts.hasSyntacticModifier(variableDeclaration, 1 /* ModifierFlags.Export */) || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } if (ts.isVariableDeclarationList(variableDeclaration.parent) && @@ -168725,7 +170548,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasSyntacticModifier(functionDeclaration, 1 /* ModifierFlags.Export */) || - (functionDeclaration.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 171 /* SyntaxKind.Constructor */); + (functionDeclaration.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 173 /* SyntaxKind.Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -168748,26 +170571,26 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -168792,21 +170615,21 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 203 /* SyntaxKind.BindingElement */) { + if (bindingPattern.parent.kind === 205 /* SyntaxKind.BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 202 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 201 /* SyntaxKind.ObjectBindingPattern */); - var elements = node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + ts.Debug.assert(node.kind !== 204 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 203 /* SyntaxKind.ObjectBindingPattern */); + var elements = node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -168814,18 +170637,18 @@ var ts; // just nested element in another destructuring assignment // set breakpoint on assignment when parent is destructuring assignment // Otherwise set breakpoint for this element - return textSpan(node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -168833,25 +170656,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // Span on close brace token return textSpan(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -168859,7 +170682,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -168875,7 +170698,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -168890,12 +170713,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead - node.parent.kind === 208 /* SyntaxKind.CallExpression */ || - node.parent.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead + node.parent.kind === 210 /* SyntaxKind.CallExpression */ || + node.parent.kind === 211 /* SyntaxKind.NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -168904,21 +170727,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -168928,20 +170751,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.parent.kind === 164 /* SyntaxKind.Parameter */) { + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.parent.kind === 166 /* SyntaxKind.Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.parent.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -168949,7 +170772,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -168998,7 +170821,7 @@ var debugObjectHost = (function () { return this; })(); // We need to use 'null' to interface with the managed side. -/* eslint-disable no-in-operator */ +/* eslint-disable local/no-in-operator */ /* @internal */ var ts; (function (ts) { @@ -169798,7 +171621,7 @@ var ts; }()); ts.TypeScriptServicesFactory = TypeScriptServicesFactory; })(ts || (ts = {})); -/* eslint-enable no-in-operator */ +/* eslint-enable local/no-in-operator */ // We polyfill `globalThis` here so re can reliably patch the global scope // in the contexts we want to in the same way across script and module formats /* eslint-enable no-var */ @@ -170644,6 +172467,12 @@ var ts; CommandTypes["ProvideInlayHints"] = "provideInlayHints"; // NOTE: If updating this, be sure to also update `allCommandNames` in `testRunner/unittests/tsserver/session.ts`. })(CommandTypes = protocol.CommandTypes || (protocol.CommandTypes = {})); + var OrganizeImportsMode; + (function (OrganizeImportsMode) { + OrganizeImportsMode["All"] = "All"; + OrganizeImportsMode["SortAndCombine"] = "SortAndCombine"; + OrganizeImportsMode["RemoveUnused"] = "RemoveUnused"; + })(OrganizeImportsMode = protocol.OrganizeImportsMode || (protocol.OrganizeImportsMode = {})); var WatchFileKind; (function (WatchFileKind) { WatchFileKind["FixedPollingInterval"] = "FixedPollingInterval"; @@ -171530,6 +173359,7 @@ var ts; this.watchOptions = watchOptions; this.rootFiles = []; this.rootFilesMap = new ts.Map(); + /*@internal*/ this.plugins = []; /*@internal*/ /** @@ -172058,6 +173888,7 @@ var ts; this.directoryStructureHost = undefined; this.exportMapCache = undefined; this.projectErrors = undefined; + this.plugins.length = 0; // Clean up file watchers waiting for missing files if (this.missingFilesMap) { ts.clearMap(this.missingFilesMap, ts.closeFileWatcher); @@ -172360,7 +174191,7 @@ var ts; ts.Debug.assert(!this.isClosed(), "Called update graph worker of closed project"); this.writeLog("Starting updateGraphWorker: Project: ".concat(this.getProjectName())); var start = ts.timestamp(); - this.hasInvalidatedResolution = this.resolutionCache.createHasInvalidatedResolution(); + this.hasInvalidatedResolutions = this.resolutionCache.createHasInvalidatedResolutions(ts.returnFalse); this.resolutionCache.startCachingPerDirectoryResolution(); this.program = this.languageService.getProgram(); // TODO: GH#18217 this.dirty = false; @@ -172731,35 +174562,39 @@ var ts; Project.prototype.isSourceOfProjectReferenceRedirect = function (fileName) { return !!this.program && this.program.isSourceOfProjectReferenceRedirect(fileName); }; + /*@internal*/ + Project.prototype.getGlobalPluginSearchPaths = function () { + // Search any globally-specified probe paths, then our peer node_modules + return __spreadArray(__spreadArray([], this.projectService.pluginProbeLocations, true), [ + // ../../.. to walk from X/node_modules/typescript/lib/tsserver.js to X/node_modules/ + ts.combinePaths(this.projectService.getExecutingFilePath(), "../../.."), + ], false); + }; Project.prototype.enableGlobalPlugins = function (options, pluginConfigOverrides) { + if (!this.projectService.globalPlugins.length) + return; var host = this.projectService.host; if (!host.require && !host.importPlugin) { this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded"); return; } - // Search any globally-specified probe paths, then our peer node_modules - var searchPaths = __spreadArray(__spreadArray([], this.projectService.pluginProbeLocations, true), [ - // ../../.. to walk from X/node_modules/typescript/lib/tsserver.js to X/node_modules/ - ts.combinePaths(this.projectService.getExecutingFilePath(), "../../.."), - ], false); - if (this.projectService.globalPlugins) { - var _loop_1 = function (globalPluginName) { - // Skip empty names from odd commandline parses - if (!globalPluginName) - return "continue"; - // Skip already-locally-loaded plugins - if (options.plugins && options.plugins.some(function (p) { return p.name === globalPluginName; })) - return "continue"; - // Provide global: true so plugins can detect why they can't find their config - this_1.projectService.logger.info("Loading global plugin ".concat(globalPluginName)); - this_1.enablePlugin({ name: globalPluginName, global: true }, searchPaths, pluginConfigOverrides); - }; - var this_1 = this; - // Enable global plugins with synthetic configuration entries - for (var _i = 0, _a = this.projectService.globalPlugins; _i < _a.length; _i++) { - var globalPluginName = _a[_i]; - _loop_1(globalPluginName); - } + // Enable global plugins with synthetic configuration entries + var searchPaths = this.getGlobalPluginSearchPaths(); + var _loop_1 = function (globalPluginName) { + // Skip empty names from odd commandline parses + if (!globalPluginName) + return "continue"; + // Skip already-locally-loaded plugins + if (options.plugins && options.plugins.some(function (p) { return p.name === globalPluginName; })) + return "continue"; + // Provide global: true so plugins can detect why they can't find their config + this_1.projectService.logger.info("Loading global plugin ".concat(globalPluginName)); + this_1.enablePlugin({ name: globalPluginName, global: true }, searchPaths, pluginConfigOverrides); + }; + var this_1 = this; + for (var _i = 0, _a = this.projectService.globalPlugins; _i < _a.length; _i++) { + var globalPluginName = _a[_i]; + _loop_1(globalPluginName); } }; /** @@ -172858,7 +174693,7 @@ var ts; var newLS = pluginModule.create(info); for (var _i = 0, _a = Object.keys(this.languageService); _i < _a.length; _i++) { var k = _a[_i]; - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!(k in newLS)) { this.projectService.logger.info("Plugin activation warning: Missing proxied method ".concat(k, " in created LS. Patching.")); newLS[k] = this.languageService[k]; @@ -173490,14 +175325,16 @@ var ts; }; /*@internal*/ ConfiguredProject.prototype.enablePluginsWithOptions = function (options, pluginConfigOverrides) { + var _a; + this.plugins.length = 0; + if (!((_a = options.plugins) === null || _a === void 0 ? void 0 : _a.length) && !this.projectService.globalPlugins.length) + return; var host = this.projectService.host; if (!host.require && !host.importPlugin) { this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded"); return; } - // Search our peer node_modules, then any globally-specified probe paths - // ../../.. to walk from X/node_modules/typescript/lib/tsserver.js to X/node_modules/ - var searchPaths = __spreadArray([ts.combinePaths(this.projectService.getExecutingFilePath(), "../../..")], this.projectService.pluginProbeLocations, true); + var searchPaths = this.getGlobalPluginSearchPaths(); if (this.projectService.allowLocalPluginLoads) { var local = ts.getDirectoryPath(this.canonicalConfigFilePath); this.projectService.logger.info("Local plugin loading enabled; adding ".concat(local, " to search paths")); @@ -173505,8 +175342,8 @@ var ts; } // Enable tsconfig-specified plugins if (options.plugins) { - for (var _i = 0, _a = options.plugins; _i < _a.length; _i++) { - var pluginConfigEntry = _a[_i]; + for (var _i = 0, _b = options.plugins; _i < _b.length; _i++) { + var pluginConfigEntry = _b[_i]; this.enablePlugin(pluginConfigEntry, searchPaths, pluginConfigOverrides); } } @@ -174145,7 +175982,7 @@ var ts; // raw is now fixed and ready this.safelist = raw.typesMap; for (var key in raw.simpleMap) { - if (raw.simpleMap.hasOwnProperty(key)) { + if (ts.hasProperty(raw.simpleMap, key)) { this.legacySafelist.set(key, raw.simpleMap[key].toLowerCase()); } } @@ -174351,18 +176188,20 @@ var ts; return ensureProject ? this.ensureDefaultProjectForFile(fileName) : this.tryGetDefaultProjectForFile(fileName); }; /* @internal */ - ProjectService.prototype.tryGetDefaultProjectForFile = function (fileName) { - var scriptInfo = this.getScriptInfoForNormalizedPath(fileName); + ProjectService.prototype.tryGetDefaultProjectForFile = function (fileNameOrScriptInfo) { + var scriptInfo = ts.isString(fileNameOrScriptInfo) ? this.getScriptInfoForNormalizedPath(fileNameOrScriptInfo) : fileNameOrScriptInfo; return scriptInfo && !scriptInfo.isOrphan() ? scriptInfo.getDefaultProject() : undefined; }; /* @internal */ - ProjectService.prototype.ensureDefaultProjectForFile = function (fileName) { - return this.tryGetDefaultProjectForFile(fileName) || this.doEnsureDefaultProjectForFile(fileName); + ProjectService.prototype.ensureDefaultProjectForFile = function (fileNameOrScriptInfo) { + return this.tryGetDefaultProjectForFile(fileNameOrScriptInfo) || this.doEnsureDefaultProjectForFile(fileNameOrScriptInfo); }; - ProjectService.prototype.doEnsureDefaultProjectForFile = function (fileName) { + ProjectService.prototype.doEnsureDefaultProjectForFile = function (fileNameOrScriptInfo) { this.ensureProjectStructuresUptoDate(); - var scriptInfo = this.getScriptInfoForNormalizedPath(fileName); - return scriptInfo ? scriptInfo.getDefaultProject() : (this.logErrorForScriptInfoNotFound(fileName), server.Errors.ThrowNoProject()); + var scriptInfo = ts.isString(fileNameOrScriptInfo) ? this.getScriptInfoForNormalizedPath(fileNameOrScriptInfo) : fileNameOrScriptInfo; + return scriptInfo ? + scriptInfo.getDefaultProject() : + (this.logErrorForScriptInfoNotFound(ts.isString(fileNameOrScriptInfo) ? fileNameOrScriptInfo : fileNameOrScriptInfo.fileName), server.Errors.ThrowNoProject()); }; ProjectService.prototype.getScriptInfoEnsuringProjectsUptoDate = function (uncheckedFileName) { this.ensureProjectStructuresUptoDate(); @@ -176534,7 +178373,7 @@ var ts; if (this.serverMode !== ts.LanguageServiceMode.Semantic || !this.eventHandler || !scriptInfo.isJavaScript() || !ts.addToSeen(this.allJsFilesForOpenFileTelemetry, scriptInfo.path)) { return; } - var project = scriptInfo.getDefaultProject(); + var project = this.ensureDefaultProjectForFile(scriptInfo); if (!project.languageServiceEnabled) { return; } @@ -177559,7 +179398,6 @@ var ts; } return ts.deduplicate(outputs, ts.equateValues); } - ; function createDocumentSpanSet() { return ts.createSet(function (_a) { var textSpan = _a.textSpan; @@ -178909,7 +180747,7 @@ var ts; } var initialNode = ts.getTouchingPropertyName(program.getSourceFile(file), position); var symbol = program.getTypeChecker().getSymbolAtLocation(initialNode); - var importSpecifier = symbol && ts.getDeclarationOfKind(symbol, 270 /* SyntaxKind.ImportSpecifier */); + var importSpecifier = symbol && ts.getDeclarationOfKind(symbol, 273 /* SyntaxKind.ImportSpecifier */); if (!importSpecifier) return undefined; var nameToSearch = ((_a = importSpecifier.propertyName) === null || _a === void 0 ? void 0 : _a.text) || importSpecifier.name.text; @@ -179135,6 +180973,10 @@ var ts; this.projectService.logErrorForScriptInfoNotFound(args.file); return server.Errors.ThrowNoProject(); } + else if (!getScriptInfoEnsuringProjectsUptoDate) { + // Ensure there are containing projects are present + this.projectService.ensureDefaultProjectForFile(scriptInfo); + } projects = scriptInfo.containingProjects; symLinkedProjects = this.projectService.getSymlinkedProjects(scriptInfo); } @@ -179203,6 +181045,7 @@ var ts; var references = getReferencesWorker(projects, this.getDefaultProject(args), { fileName: args.file, pos: position }, this.logger); if (!simplifiedResult) return references; + var preferences = this.getPreferences(file); var defaultProject = this.getDefaultProject(args); var scriptInfo = defaultProject.getScriptInfoForNormalizedPath(file); var nameInfo = defaultProject.getLanguageService().getQuickInfoAtPosition(file, position); @@ -179211,7 +181054,7 @@ var ts; var symbolStartOffset = nameSpan ? scriptInfo.positionToLineOffset(nameSpan.start).offset : 0; var symbolName = nameSpan ? scriptInfo.getSnapshot().getText(nameSpan.start, ts.textSpanEnd(nameSpan)) : ""; var refs = ts.flatMap(references, function (referencedSymbol) { - return referencedSymbol.references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry); }); + return referencedSymbol.references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry, preferences); }); }); return { refs: refs, symbolName: symbolName, symbolStartOffset: symbolStartOffset, symbolDisplayString: symbolDisplayString }; }; @@ -179219,6 +181062,7 @@ var ts; var _this = this; var projects = this.getProjects(args); var fileName = args.file; + var preferences = this.getPreferences(server.toNormalizedPath(fileName)); var references = []; var seen = createDocumentSpanSet(); forEachProjectInProjects(projects, /*path*/ undefined, function (project) { @@ -179237,7 +181081,7 @@ var ts; }); if (!simplifiedResult) return references; - var refs = references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry); }); + var refs = references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry, preferences); }); return { refs: refs, symbolName: "\"".concat(args.file, "\"") @@ -179261,13 +181105,7 @@ var ts; return this.getFileAndProjectWorker(args.file, args.projectFileName); }; Session.prototype.getFileAndLanguageServiceForSyntacticOperation = function (args) { - // Since this is syntactic operation, there should always be project for the file - // we wouldnt have to ensure project but rather throw if we dont get project - var file = server.toNormalizedPath(args.file); - var project = this.getProject(args.projectFileName) || this.projectService.tryGetDefaultProjectForFile(file); - if (!project) { - return server.Errors.ThrowNoProject(); - } + var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; return { file: file, languageService: project.getLanguageService(/*ensureSynchronized*/ false) @@ -179808,11 +181646,12 @@ var ts; } }; Session.prototype.organizeImports = function (args, simplifiedResult) { + var _a; ts.Debug.assert(args.scope.type === "file"); - var _a = this.getFileAndProject(args.scope.args), file = _a.file, project = _a.project; + var _b = this.getFileAndProject(args.scope.args), file = _b.file, project = _b.project; var changes = project.getLanguageService().organizeImports({ fileName: file, - skipDestructiveCodeActions: args.skipDestructiveCodeActions, + mode: (_a = args.mode) !== null && _a !== void 0 ? _a : (args.skipDestructiveCodeActions ? "SortAndCombine" /* OrganizeImportsMode.SortAndCombine */ : undefined), type: "file", }, this.getFormatOptions(file), this.getPreferences(file)); if (simplifiedResult) { @@ -180306,14 +182145,18 @@ var ts; } return text; } - function referenceEntryToReferencesResponseItem(projectService, _a) { + function referenceEntryToReferencesResponseItem(projectService, _a, _b) { var fileName = _a.fileName, textSpan = _a.textSpan, contextSpan = _a.contextSpan, isWriteAccess = _a.isWriteAccess, isDefinition = _a.isDefinition; + var disableLineTextInReferences = _b.disableLineTextInReferences; var scriptInfo = ts.Debug.checkDefined(projectService.getScriptInfo(fileName)); var span = toProtocolTextSpanWithContext(textSpan, contextSpan, scriptInfo); - var lineSpan = scriptInfo.lineToTextSpan(span.start.line - 1); - var lineText = scriptInfo.getSnapshot().getText(lineSpan.start, ts.textSpanEnd(lineSpan)).replace(/\r|\n/g, ""); + var lineText = disableLineTextInReferences ? undefined : getLineText(scriptInfo, span); return __assign(__assign({ file: fileName }, span), { lineText: lineText, isWriteAccess: isWriteAccess, isDefinition: isDefinition }); } + function getLineText(scriptInfo, span) { + var lineSpan = scriptInfo.lineToTextSpan(span.start.line - 1); + return scriptInfo.getSnapshot().getText(lineSpan.start, ts.textSpanEnd(lineSpan)).replace(/\r|\n/g, ""); + } function isCompletionEntryData(data) { return data === undefined || data && typeof data === "object" && typeof data.exportName === "string" @@ -182057,7 +183900,7 @@ var ts; if (typeof value === "number") { return ts.factory.createNumericLiteral(value); } - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (typeof value === "object" && "base10Value" in value) { // PseudoBigInt return ts.factory.createBigIntLiteral(value); } @@ -182085,7 +183928,7 @@ var ts; } else { type = operatorOrType; - operator = 140 /* SyntaxKind.KeyOfKeyword */; + operator = 141 /* SyntaxKind.KeyOfKeyword */; } return ts.factory.createTypeOperatorNode(operator, type); }, factoryDeprecation); @@ -182263,7 +184106,7 @@ var ts; ts.createNode = ts.Debug.deprecate(function createNode(kind, pos, end) { if (pos === void 0) { pos = 0; } if (end === void 0) { end = 0; } - return ts.setTextRangePosEnd(kind === 305 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : + return ts.setTextRangePosEnd(kind === 308 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : kind === 79 /* SyntaxKind.Identifier */ ? ts.parseBaseNodeFactory.createBaseIdentifierNode(kind) : kind === 80 /* SyntaxKind.PrivateIdentifier */ ? ts.parseBaseNodeFactory.createBasePrivateIdentifierNode(kind) : !ts.isNodeKind(kind) ? ts.parseBaseNodeFactory.createBaseTokenNode(kind) : @@ -182293,7 +184136,7 @@ var ts; (function (ts) { /** @deprecated Use `isTypeAssertionExpression` instead. */ ts.isTypeAssertion = ts.Debug.deprecate(function isTypeAssertion(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; }, { since: "4.0", warnAfter: "4.1", @@ -183900,20 +185743,6 @@ var ts; } // Override sys.write because fs.writeSync is not reliable on Node 4 sys.write = function (s) { return writeMessage(sys.bufferFrom(s, "utf8")); }; - // REVIEW: for now this implementation uses polling. - // The advantage of polling is that it works reliably - // on all os and with network mounted files. - // For 90 referenced files, the average time to detect - // changes is 2*msInterval (by default 5 seconds). - // The overhead of this is .04 percent (1/2500) with - // average pause of < 1 millisecond (and max - // pause less than 1.5 milliseconds); question is - // do we anticipate reference sets in the 100s and - // do we care about waiting 10-20 seconds to detect - // changes for large reference sets? If so, do we want - // to increase the chunk size or decrease the interval - // time dynamically to match the large reference set? - sys.defaultWatchFileKind = function () { return ts.WatchFileKind.FixedChunkSizePolling; }; /* eslint-disable no-restricted-globals */ sys.setTimeout = setTimeout; sys.clearTimeout = clearTimeout; @@ -184367,6 +186196,9 @@ var ts; process.on("message", function (e) { _this.onMessage(e); }); + process.on("disconnect", function () { + _this.exit(); + }); }; return IpcIOSession; }(IOSession)); diff --git a/node_modules/typescript/lib/tsserverlibrary.d.ts b/node_modules/typescript/lib/tsserverlibrary.d.ts index 8003ac00a..90dd9ed78 100644 --- a/node_modules/typescript/lib/tsserverlibrary.d.ts +++ b/node_modules/typescript/lib/tsserverlibrary.d.ts @@ -14,7 +14,7 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { - const versionMajorMinor = "4.8"; + const versionMajorMinor = "4.9"; /** The version of the TypeScript compiler release */ const version: string; /** @@ -232,237 +232,240 @@ declare namespace ts { StaticKeyword = 124, YieldKeyword = 125, AbstractKeyword = 126, - AsKeyword = 127, - AssertsKeyword = 128, - AssertKeyword = 129, - AnyKeyword = 130, - AsyncKeyword = 131, - AwaitKeyword = 132, - BooleanKeyword = 133, - ConstructorKeyword = 134, - DeclareKeyword = 135, - GetKeyword = 136, - InferKeyword = 137, - IntrinsicKeyword = 138, - IsKeyword = 139, - KeyOfKeyword = 140, - ModuleKeyword = 141, - NamespaceKeyword = 142, - NeverKeyword = 143, - OutKeyword = 144, - ReadonlyKeyword = 145, - RequireKeyword = 146, - NumberKeyword = 147, - ObjectKeyword = 148, - SetKeyword = 149, - StringKeyword = 150, - SymbolKeyword = 151, - TypeKeyword = 152, - UndefinedKeyword = 153, - UniqueKeyword = 154, - UnknownKeyword = 155, - FromKeyword = 156, - GlobalKeyword = 157, - BigIntKeyword = 158, - OverrideKeyword = 159, - OfKeyword = 160, - QualifiedName = 161, - ComputedPropertyName = 162, - TypeParameter = 163, - Parameter = 164, - Decorator = 165, - PropertySignature = 166, - PropertyDeclaration = 167, - MethodSignature = 168, - MethodDeclaration = 169, - ClassStaticBlockDeclaration = 170, - Constructor = 171, - GetAccessor = 172, - SetAccessor = 173, - CallSignature = 174, - ConstructSignature = 175, - IndexSignature = 176, - TypePredicate = 177, - TypeReference = 178, - FunctionType = 179, - ConstructorType = 180, - TypeQuery = 181, - TypeLiteral = 182, - ArrayType = 183, - TupleType = 184, - OptionalType = 185, - RestType = 186, - UnionType = 187, - IntersectionType = 188, - ConditionalType = 189, - InferType = 190, - ParenthesizedType = 191, - ThisType = 192, - TypeOperator = 193, - IndexedAccessType = 194, - MappedType = 195, - LiteralType = 196, - NamedTupleMember = 197, - TemplateLiteralType = 198, - TemplateLiteralTypeSpan = 199, - ImportType = 200, - ObjectBindingPattern = 201, - ArrayBindingPattern = 202, - BindingElement = 203, - ArrayLiteralExpression = 204, - ObjectLiteralExpression = 205, - PropertyAccessExpression = 206, - ElementAccessExpression = 207, - CallExpression = 208, - NewExpression = 209, - TaggedTemplateExpression = 210, - TypeAssertionExpression = 211, - ParenthesizedExpression = 212, - FunctionExpression = 213, - ArrowFunction = 214, - DeleteExpression = 215, - TypeOfExpression = 216, - VoidExpression = 217, - AwaitExpression = 218, - PrefixUnaryExpression = 219, - PostfixUnaryExpression = 220, - BinaryExpression = 221, - ConditionalExpression = 222, - TemplateExpression = 223, - YieldExpression = 224, - SpreadElement = 225, - ClassExpression = 226, - OmittedExpression = 227, - ExpressionWithTypeArguments = 228, - AsExpression = 229, - NonNullExpression = 230, - MetaProperty = 231, - SyntheticExpression = 232, - TemplateSpan = 233, - SemicolonClassElement = 234, - Block = 235, - EmptyStatement = 236, - VariableStatement = 237, - ExpressionStatement = 238, - IfStatement = 239, - DoStatement = 240, - WhileStatement = 241, - ForStatement = 242, - ForInStatement = 243, - ForOfStatement = 244, - ContinueStatement = 245, - BreakStatement = 246, - ReturnStatement = 247, - WithStatement = 248, - SwitchStatement = 249, - LabeledStatement = 250, - ThrowStatement = 251, - TryStatement = 252, - DebuggerStatement = 253, - VariableDeclaration = 254, - VariableDeclarationList = 255, - FunctionDeclaration = 256, - ClassDeclaration = 257, - InterfaceDeclaration = 258, - TypeAliasDeclaration = 259, - EnumDeclaration = 260, - ModuleDeclaration = 261, - ModuleBlock = 262, - CaseBlock = 263, - NamespaceExportDeclaration = 264, - ImportEqualsDeclaration = 265, - ImportDeclaration = 266, - ImportClause = 267, - NamespaceImport = 268, - NamedImports = 269, - ImportSpecifier = 270, - ExportAssignment = 271, - ExportDeclaration = 272, - NamedExports = 273, - NamespaceExport = 274, - ExportSpecifier = 275, - MissingDeclaration = 276, - ExternalModuleReference = 277, - JsxElement = 278, - JsxSelfClosingElement = 279, - JsxOpeningElement = 280, - JsxClosingElement = 281, - JsxFragment = 282, - JsxOpeningFragment = 283, - JsxClosingFragment = 284, - JsxAttribute = 285, - JsxAttributes = 286, - JsxSpreadAttribute = 287, - JsxExpression = 288, - CaseClause = 289, - DefaultClause = 290, - HeritageClause = 291, - CatchClause = 292, - AssertClause = 293, - AssertEntry = 294, - ImportTypeAssertionContainer = 295, - PropertyAssignment = 296, - ShorthandPropertyAssignment = 297, - SpreadAssignment = 298, - EnumMember = 299, - UnparsedPrologue = 300, - UnparsedPrepend = 301, - UnparsedText = 302, - UnparsedInternalText = 303, - UnparsedSyntheticReference = 304, - SourceFile = 305, - Bundle = 306, - UnparsedSource = 307, - InputFiles = 308, - JSDocTypeExpression = 309, - JSDocNameReference = 310, - JSDocMemberName = 311, - JSDocAllType = 312, - JSDocUnknownType = 313, - JSDocNullableType = 314, - JSDocNonNullableType = 315, - JSDocOptionalType = 316, - JSDocFunctionType = 317, - JSDocVariadicType = 318, - JSDocNamepathType = 319, - JSDoc = 320, + AccessorKeyword = 127, + AsKeyword = 128, + AssertsKeyword = 129, + AssertKeyword = 130, + AnyKeyword = 131, + AsyncKeyword = 132, + AwaitKeyword = 133, + BooleanKeyword = 134, + ConstructorKeyword = 135, + DeclareKeyword = 136, + GetKeyword = 137, + InferKeyword = 138, + IntrinsicKeyword = 139, + IsKeyword = 140, + KeyOfKeyword = 141, + ModuleKeyword = 142, + NamespaceKeyword = 143, + NeverKeyword = 144, + OutKeyword = 145, + ReadonlyKeyword = 146, + RequireKeyword = 147, + NumberKeyword = 148, + ObjectKeyword = 149, + SatisfiesKeyword = 150, + SetKeyword = 151, + StringKeyword = 152, + SymbolKeyword = 153, + TypeKeyword = 154, + UndefinedKeyword = 155, + UniqueKeyword = 156, + UnknownKeyword = 157, + FromKeyword = 158, + GlobalKeyword = 159, + BigIntKeyword = 160, + OverrideKeyword = 161, + OfKeyword = 162, + QualifiedName = 163, + ComputedPropertyName = 164, + TypeParameter = 165, + Parameter = 166, + Decorator = 167, + PropertySignature = 168, + PropertyDeclaration = 169, + MethodSignature = 170, + MethodDeclaration = 171, + ClassStaticBlockDeclaration = 172, + Constructor = 173, + GetAccessor = 174, + SetAccessor = 175, + CallSignature = 176, + ConstructSignature = 177, + IndexSignature = 178, + TypePredicate = 179, + TypeReference = 180, + FunctionType = 181, + ConstructorType = 182, + TypeQuery = 183, + TypeLiteral = 184, + ArrayType = 185, + TupleType = 186, + OptionalType = 187, + RestType = 188, + UnionType = 189, + IntersectionType = 190, + ConditionalType = 191, + InferType = 192, + ParenthesizedType = 193, + ThisType = 194, + TypeOperator = 195, + IndexedAccessType = 196, + MappedType = 197, + LiteralType = 198, + NamedTupleMember = 199, + TemplateLiteralType = 200, + TemplateLiteralTypeSpan = 201, + ImportType = 202, + ObjectBindingPattern = 203, + ArrayBindingPattern = 204, + BindingElement = 205, + ArrayLiteralExpression = 206, + ObjectLiteralExpression = 207, + PropertyAccessExpression = 208, + ElementAccessExpression = 209, + CallExpression = 210, + NewExpression = 211, + TaggedTemplateExpression = 212, + TypeAssertionExpression = 213, + ParenthesizedExpression = 214, + FunctionExpression = 215, + ArrowFunction = 216, + DeleteExpression = 217, + TypeOfExpression = 218, + VoidExpression = 219, + AwaitExpression = 220, + PrefixUnaryExpression = 221, + PostfixUnaryExpression = 222, + BinaryExpression = 223, + ConditionalExpression = 224, + TemplateExpression = 225, + YieldExpression = 226, + SpreadElement = 227, + ClassExpression = 228, + OmittedExpression = 229, + ExpressionWithTypeArguments = 230, + AsExpression = 231, + NonNullExpression = 232, + MetaProperty = 233, + SyntheticExpression = 234, + SatisfiesExpression = 235, + TemplateSpan = 236, + SemicolonClassElement = 237, + Block = 238, + EmptyStatement = 239, + VariableStatement = 240, + ExpressionStatement = 241, + IfStatement = 242, + DoStatement = 243, + WhileStatement = 244, + ForStatement = 245, + ForInStatement = 246, + ForOfStatement = 247, + ContinueStatement = 248, + BreakStatement = 249, + ReturnStatement = 250, + WithStatement = 251, + SwitchStatement = 252, + LabeledStatement = 253, + ThrowStatement = 254, + TryStatement = 255, + DebuggerStatement = 256, + VariableDeclaration = 257, + VariableDeclarationList = 258, + FunctionDeclaration = 259, + ClassDeclaration = 260, + InterfaceDeclaration = 261, + TypeAliasDeclaration = 262, + EnumDeclaration = 263, + ModuleDeclaration = 264, + ModuleBlock = 265, + CaseBlock = 266, + NamespaceExportDeclaration = 267, + ImportEqualsDeclaration = 268, + ImportDeclaration = 269, + ImportClause = 270, + NamespaceImport = 271, + NamedImports = 272, + ImportSpecifier = 273, + ExportAssignment = 274, + ExportDeclaration = 275, + NamedExports = 276, + NamespaceExport = 277, + ExportSpecifier = 278, + MissingDeclaration = 279, + ExternalModuleReference = 280, + JsxElement = 281, + JsxSelfClosingElement = 282, + JsxOpeningElement = 283, + JsxClosingElement = 284, + JsxFragment = 285, + JsxOpeningFragment = 286, + JsxClosingFragment = 287, + JsxAttribute = 288, + JsxAttributes = 289, + JsxSpreadAttribute = 290, + JsxExpression = 291, + CaseClause = 292, + DefaultClause = 293, + HeritageClause = 294, + CatchClause = 295, + AssertClause = 296, + AssertEntry = 297, + ImportTypeAssertionContainer = 298, + PropertyAssignment = 299, + ShorthandPropertyAssignment = 300, + SpreadAssignment = 301, + EnumMember = 302, + UnparsedPrologue = 303, + UnparsedPrepend = 304, + UnparsedText = 305, + UnparsedInternalText = 306, + UnparsedSyntheticReference = 307, + SourceFile = 308, + Bundle = 309, + UnparsedSource = 310, + InputFiles = 311, + JSDocTypeExpression = 312, + JSDocNameReference = 313, + JSDocMemberName = 314, + JSDocAllType = 315, + JSDocUnknownType = 316, + JSDocNullableType = 317, + JSDocNonNullableType = 318, + JSDocOptionalType = 319, + JSDocFunctionType = 320, + JSDocVariadicType = 321, + JSDocNamepathType = 322, + JSDoc = 323, /** @deprecated Use SyntaxKind.JSDoc */ - JSDocComment = 320, - JSDocText = 321, - JSDocTypeLiteral = 322, - JSDocSignature = 323, - JSDocLink = 324, - JSDocLinkCode = 325, - JSDocLinkPlain = 326, - JSDocTag = 327, - JSDocAugmentsTag = 328, - JSDocImplementsTag = 329, - JSDocAuthorTag = 330, - JSDocDeprecatedTag = 331, - JSDocClassTag = 332, - JSDocPublicTag = 333, - JSDocPrivateTag = 334, - JSDocProtectedTag = 335, - JSDocReadonlyTag = 336, - JSDocOverrideTag = 337, - JSDocCallbackTag = 338, - JSDocEnumTag = 339, - JSDocParameterTag = 340, - JSDocReturnTag = 341, - JSDocThisTag = 342, - JSDocTypeTag = 343, - JSDocTemplateTag = 344, - JSDocTypedefTag = 345, - JSDocSeeTag = 346, - JSDocPropertyTag = 347, - SyntaxList = 348, - NotEmittedStatement = 349, - PartiallyEmittedExpression = 350, - CommaListExpression = 351, - MergeDeclarationMarker = 352, - EndOfDeclarationMarker = 353, - SyntheticReferenceExpression = 354, - Count = 355, + JSDocComment = 323, + JSDocText = 324, + JSDocTypeLiteral = 325, + JSDocSignature = 326, + JSDocLink = 327, + JSDocLinkCode = 328, + JSDocLinkPlain = 329, + JSDocTag = 330, + JSDocAugmentsTag = 331, + JSDocImplementsTag = 332, + JSDocAuthorTag = 333, + JSDocDeprecatedTag = 334, + JSDocClassTag = 335, + JSDocPublicTag = 336, + JSDocPrivateTag = 337, + JSDocProtectedTag = 338, + JSDocReadonlyTag = 339, + JSDocOverrideTag = 340, + JSDocCallbackTag = 341, + JSDocEnumTag = 342, + JSDocParameterTag = 343, + JSDocReturnTag = 344, + JSDocThisTag = 345, + JSDocTypeTag = 346, + JSDocTemplateTag = 347, + JSDocTypedefTag = 348, + JSDocSeeTag = 349, + JSDocPropertyTag = 350, + SyntaxList = 351, + NotEmittedStatement = 352, + PartiallyEmittedExpression = 353, + CommaListExpression = 354, + MergeDeclarationMarker = 355, + EndOfDeclarationMarker = 356, + SyntheticReferenceExpression = 357, + Count = 358, FirstAssignment = 63, LastAssignment = 78, FirstCompoundAssignment = 64, @@ -470,15 +473,15 @@ declare namespace ts { FirstReservedWord = 81, LastReservedWord = 116, FirstKeyword = 81, - LastKeyword = 160, + LastKeyword = 162, FirstFutureReservedWord = 117, LastFutureReservedWord = 125, - FirstTypeNode = 177, - LastTypeNode = 200, + FirstTypeNode = 179, + LastTypeNode = 202, FirstPunctuation = 18, LastPunctuation = 78, FirstToken = 0, - LastToken = 160, + LastToken = 162, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -487,20 +490,20 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 29, LastBinaryOperator = 78, - FirstStatement = 237, - LastStatement = 253, - FirstNode = 161, - FirstJSDocNode = 309, - LastJSDocNode = 347, - FirstJSDocTagNode = 327, - LastJSDocTagNode = 347, + FirstStatement = 240, + LastStatement = 256, + FirstNode = 163, + FirstJSDocNode = 312, + LastJSDocNode = 350, + FirstJSDocTagNode = 330, + LastJSDocTagNode = 350, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail; export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; - export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; - export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; + export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; + export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind; export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; @@ -545,9 +548,10 @@ declare namespace ts { Protected = 16, Static = 32, Readonly = 64, - Abstract = 128, - Async = 256, - Default = 512, + Accessor = 128, + Abstract = 256, + Async = 512, + Default = 1024, Const = 2048, HasComputedJSDocModifiers = 4096, Deprecated = 8192, @@ -559,10 +563,10 @@ declare namespace ts { AccessibilityModifier = 28, ParameterPropertyModifier = 16476, NonPublicAccessibilityModifier = 24, - TypeScriptModifier = 116958, - ExportDefault = 513, - All = 257023, - Modifier = 125951 + TypeScriptModifier = 117086, + ExportDefault = 1025, + All = 258047, + Modifier = 126975 } export enum JsxFlags { None = 0, @@ -618,6 +622,7 @@ declare namespace ts { export interface ModifierToken extends KeywordToken { } export type AbstractKeyword = ModifierToken; + export type AccessorKeyword = ModifierToken; export type AsyncKeyword = ModifierToken; export type ConstKeyword = ModifierToken; export type DeclareKeyword = ModifierToken; @@ -633,11 +638,11 @@ declare namespace ts { export type StaticKeyword = ModifierToken; /** @deprecated Use `ReadonlyKeyword` instead. */ export type ReadonlyToken = ReadonlyKeyword; - export type Modifier = AbstractKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; + export type Modifier = AbstractKeyword | AccessorKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; export type ModifierLike = Modifier | Decorator; export type AccessibilityModifier = PublicKeyword | PrivateKeyword | ProtectedKeyword; export type ParameterPropertyModifier = AccessibilityModifier | ReadonlyKeyword; - export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword; + export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword | AccessorKeyword; export type ModifiersArray = NodeArray; export enum GeneratedIdentifierFlags { None = 0, @@ -764,6 +769,9 @@ declare namespace ts { readonly type?: TypeNode; readonly initializer?: Expression; } + export interface AutoAccessorPropertyDeclaration extends PropertyDeclaration { + _autoAccessorBrand: any; + } export interface ObjectLiteralElement extends NamedDeclaration { _objectLiteralBrand: any; readonly name?: PropertyName; @@ -1340,6 +1348,11 @@ declare namespace ts { readonly type: TypeNode; readonly expression: UnaryExpression; } + export interface SatisfiesExpression extends Expression { + readonly kind: SyntaxKind.SatisfiesExpression; + readonly expression: Expression; + readonly type: TypeNode; + } export type AssertionExpression = TypeAssertion | AsExpression; export interface NonNullExpression extends LeftHandSideExpression { readonly kind: SyntaxKind.NonNullExpression; @@ -2316,6 +2329,7 @@ declare namespace ts { getPrivateIdentifierPropertyOfType(leftType: Type, name: string, location: Node): Symbol | undefined; getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo | undefined; getIndexInfosOfType(type: Type): readonly IndexInfo[]; + getIndexInfosOfIndexSymbol: (indexSymbol: Symbol) => IndexInfo[]; getSignaturesOfType(type: Type, kind: SignatureKind): readonly Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type | undefined; getBaseTypes(type: InterfaceType): BaseType[]; @@ -2562,6 +2576,7 @@ declare namespace ts { MethodExcludes = 103359, GetAccessorExcludes = 46015, SetAccessorExcludes = 78783, + AccessorExcludes = 13247, TypeParameterExcludes = 526824, TypeAliasExcludes = 788968, AliasExcludes = 2097152, @@ -2832,7 +2847,7 @@ declare namespace ts { export interface SubstitutionType extends InstantiableType { objectFlags: ObjectFlags; baseType: Type; - substitute: Type; + constraint: Type; } export enum SignatureKind { Call = 0, @@ -3305,6 +3320,8 @@ declare namespace ts { */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; getEnvironmentVariable?(name: string): string | undefined; + /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ + hasInvalidatedResolutions?(filePath: Path): boolean; createHash?(data: string): string; getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined; } @@ -3387,7 +3404,7 @@ declare namespace ts { createNumericLiteral(value: string | number, numericLiteralFlags?: TokenFlags): NumericLiteral; createBigIntLiteral(value: string | PseudoBigInt): BigIntLiteral; createStringLiteral(text: string, isSingleQuote?: boolean): StringLiteral; - createStringLiteralFromNode(sourceNode: PropertyNameLiteral, isSingleQuote?: boolean): StringLiteral; + createStringLiteralFromNode(sourceNode: PropertyNameLiteral | PrivateIdentifier, isSingleQuote?: boolean): StringLiteral; createRegularExpressionLiteral(text: string): RegularExpressionLiteral; createIdentifier(text: string): Identifier; /** @@ -3412,6 +3429,8 @@ declare namespace ts { /** Create a unique name generated for a node. */ getGeneratedNameForNode(node: Node | undefined, flags?: GeneratedIdentifierFlags): Identifier; createPrivateIdentifier(text: string): PrivateIdentifier; + createUniquePrivateName(text?: string): PrivateIdentifier; + getGeneratedPrivateNameForNode(node: Node): PrivateIdentifier; createToken(token: SyntaxKind.SuperKeyword): SuperExpression; createToken(token: SyntaxKind.ThisKeyword): ThisExpression; createToken(token: SyntaxKind.NullKeyword): NullLiteral; @@ -3587,6 +3606,8 @@ declare namespace ts { updateNonNullChain(node: NonNullChain, expression: Expression): NonNullChain; createMetaProperty(keywordToken: MetaProperty["keywordToken"], name: Identifier): MetaProperty; updateMetaProperty(node: MetaProperty, name: Identifier): MetaProperty; + createSatisfiesExpression(expression: Expression, type: TypeNode): SatisfiesExpression; + updateSatisfiesExpression(node: SatisfiesExpression, expression: Expression, type: TypeNode): SatisfiesExpression; createTemplateSpan(expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; createSemicolonClassElement(): SemicolonClassElement; @@ -3948,7 +3969,7 @@ declare namespace ts { (nodes: NodeArray, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray; (nodes: NodeArray | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray | undefined; } - export type VisitResult = T | T[] | undefined; + export type VisitResult = T | readonly T[] | undefined; export interface Printer { /** * Print a node and its subtree as-is, without any emit transformations. @@ -4515,6 +4536,7 @@ declare namespace ts { function isClassElement(node: Node): node is ClassElement; function isClassLike(node: Node): node is ClassLikeDeclaration; function isAccessor(node: Node): node is AccessorDeclaration; + function isAutoAccessorPropertyDeclaration(node: Node): node is AutoAccessorPropertyDeclaration; function isModifierLike(node: Node): node is ModifierLike; function isTypeElement(node: Node): node is TypeElement; function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement; @@ -4716,6 +4738,7 @@ declare namespace ts { function isOmittedExpression(node: Node): node is OmittedExpression; function isExpressionWithTypeArguments(node: Node): node is ExpressionWithTypeArguments; function isAsExpression(node: Node): node is AsExpression; + function isSatisfiesExpression(node: Node): node is SatisfiesExpression; function isNonNullExpression(node: Node): node is NonNullExpression; function isMetaProperty(node: Node): node is MetaProperty; function isSyntheticExpression(node: Node): node is SyntheticExpression; @@ -5376,9 +5399,9 @@ declare namespace ts { /** If provided, called with Diagnostic message that informs about change in watch status */ onWatchStatusChange?(diagnostic: Diagnostic, newLine: string, options: CompilerOptions, errorCount?: number): void; /** Used to watch changes in source files, missing files needed to update the program or config file */ - watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: CompilerOptions): FileWatcher; + watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: WatchOptions): FileWatcher; /** Used to watch resolved module's failed lookup locations, config file specs, type roots where auto type reference directives are added */ - watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: CompilerOptions): FileWatcher; + watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: WatchOptions): FileWatcher; /** If provided, will be used to set delayed compilation, so that multiple changes in short span are compiled together */ setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; /** If provided, will be used to reset existing delayed compilation */ @@ -5421,6 +5444,8 @@ declare namespace ts { resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[]; /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; + /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ + hasInvalidatedResolutions?(filePath: Path): boolean; /** * Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it */ @@ -6007,8 +6032,15 @@ declare namespace ts { type: "file"; fileName: string; } + enum OrganizeImportsMode { + All = "All", + SortAndCombine = "SortAndCombine", + RemoveUnused = "RemoveUnused" + } interface OrganizeImportsArgs extends CombinedCodeFixScope { + /** @deprecated Use `mode` instead */ skipDestructiveCodeActions?: boolean; + mode?: OrganizeImportsMode; } type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<" | "#" | " "; enum CompletionTriggerKind { @@ -6526,7 +6558,7 @@ declare namespace ts { isGlobalCompletion: boolean; isMemberCompletion: boolean; /** - * In the absence of `CompletionEntry["replacementSpan"], the editor may choose whether to use + * In the absence of `CompletionEntry["replacementSpan"]`, the editor may choose whether to use * this span or its default one. If `CompletionEntry["replacementSpan"]` is defined, that span * must be used to commit that completion entry. */ @@ -6739,6 +6771,8 @@ declare namespace ts { * interface Y { foo:number; } */ memberVariableElement = "property", + /** class X { [public|private]* accessor foo: number; } */ + memberAccessorVariableElement = "accessor", /** * class X { constructor() { } } * class X { static { } } @@ -7589,9 +7623,16 @@ declare namespace ts.server.protocol { arguments: OrganizeImportsRequestArgs; } type OrganizeImportsScope = GetCombinedCodeFixScope; + enum OrganizeImportsMode { + All = "All", + SortAndCombine = "SortAndCombine", + RemoveUnused = "RemoveUnused" + } interface OrganizeImportsRequestArgs { scope: OrganizeImportsScope; + /** @deprecated Use `mode` instead */ skipDestructiveCodeActions?: boolean; + mode?: OrganizeImportsMode; } interface OrganizeImportsResponse extends Response { body: readonly FileCodeEdits[]; @@ -7941,12 +7982,14 @@ declare namespace ts.server.protocol { command: CommandTypes.References; } interface ReferencesResponseItem extends FileSpanWithContext { - /** Text of line containing the reference. Including this - * with the response avoids latency of editor loading files - * to show text of reference line (the server already has - * loaded the referencing files). + /** + * Text of line containing the reference. Including this + * with the response avoids latency of editor loading files + * to show text of reference line (the server already has loaded the referencing files). + * + * If {@link UserPreferences.disableLineTextInReferences} is enabled, the property won't be filled */ - lineText: string; + lineText?: string; /** * True if reference is a write location, false otherwise. */ @@ -9792,6 +9835,10 @@ declare namespace ts.server.protocol { readonly includeInlayFunctionLikeReturnTypeHints?: boolean; readonly includeInlayEnumMemberValueHints?: boolean; readonly autoImportFileExcludePatterns?: string[]; + /** + * Indicates whether {@link ReferencesResponseItem.lineText} is supported. + */ + readonly disableLineTextInReferences?: boolean; } interface CompilerOptions { allowJs?: boolean; @@ -10043,7 +10090,6 @@ declare namespace ts.server { private externalFiles; private missingFilesMap; private generatedFilesMap; - private plugins; protected languageService: LanguageService; languageServiceEnabled: boolean; readonly trace?: (s: string) => void; @@ -10885,7 +10931,7 @@ declare namespace ts { (text: string, isSingleQuote?: boolean | undefined, hasExtendedUnicodeEscape?: boolean | undefined): StringLiteral; }; /** @deprecated Use `factory.createStringLiteralFromNode` or the factory supplied by your transformation context instead. */ - const createStringLiteralFromNode: (sourceNode: PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral; + const createStringLiteralFromNode: (sourceNode: PrivateIdentifier | PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral; /** @deprecated Use `factory.createRegularExpressionLiteral` or the factory supplied by your transformation context instead. */ const createRegularExpressionLiteral: (text: string) => RegularExpressionLiteral; /** @deprecated Use `factory.createLoopVariable` or the factory supplied by your transformation context instead. */ diff --git a/node_modules/typescript/lib/tsserverlibrary.js b/node_modules/typescript/lib/tsserverlibrary.js index b6532d29d..4c9c38508 100644 --- a/node_modules/typescript/lib/tsserverlibrary.js +++ b/node_modules/typescript/lib/tsserverlibrary.js @@ -44,7 +44,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); - while (_) try { + while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { @@ -100,210 +100,15 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -/* @internal */ -var ts; -(function (ts) { - function createMapData() { - var sentinel = {}; - sentinel.prev = sentinel; - return { head: sentinel, tail: sentinel, size: 0 }; - } - function createMapEntry(key, value) { - return { key: key, value: value, next: undefined, prev: undefined }; - } - function sameValueZero(x, y) { - // Treats -0 === 0 and NaN === NaN - return x === y || x !== x && y !== y; - } - function getPrev(entry) { - var prev = entry.prev; - // Entries without a 'prev' have been removed from the map. - // An entry whose 'prev' points to itself is the head of the list and is invalid here. - if (!prev || prev === entry) - throw new Error("Illegal state"); - return prev; - } - function getNext(entry) { - while (entry) { - // Entries without a 'prev' have been removed from the map. Their 'next' - // pointer should point to the previous entry prior to deletion and - // that entry should be skipped to resume iteration. - var skipNext = !entry.prev; - entry = entry.next; - if (skipNext) { - continue; - } - return entry; - } - } - function getEntry(data, key) { - // We walk backwards from 'tail' to prioritize recently added entries. - // We skip 'head' because it is an empty entry used to track iteration start. - for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) { - if (sameValueZero(entry.key, key)) { - return entry; - } - } - } - function addOrUpdateEntry(data, key, value) { - var existing = getEntry(data, key); - if (existing) { - existing.value = value; - return; - } - var entry = createMapEntry(key, value); - entry.prev = data.tail; - data.tail.next = entry; - data.tail = entry; - data.size++; - return entry; - } - function deleteEntry(data, key) { - // We walk backwards from 'tail' to prioritize recently added entries. - // We skip 'head' because it is an empty entry used to track iteration start. - for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) { - // all entries in the map should have a 'prev' pointer. - if (entry.prev === undefined) - throw new Error("Illegal state"); - if (sameValueZero(entry.key, key)) { - if (entry.next) { - entry.next.prev = entry.prev; - } - else { - // an entry in the map without a 'next' pointer must be the 'tail'. - if (data.tail !== entry) - throw new Error("Illegal state"); - data.tail = entry.prev; - } - entry.prev.next = entry.next; - entry.next = entry.prev; - entry.prev = undefined; - data.size--; - return entry; - } - } - } - function clearEntries(data) { - var node = data.tail; - while (node !== data.head) { - var prev = getPrev(node); - node.next = data.head; - node.prev = undefined; - node = prev; - } - data.head.next = undefined; - data.tail = data.head; - data.size = 0; - } - function forEachEntry(data, action) { - var entry = data.head; - while (entry) { - entry = getNext(entry); - if (entry) { - action(entry.value, entry.key); - } - } - } - function forEachIteration(iterator, action) { - if (iterator) { - for (var step = iterator.next(); !step.done; step = iterator.next()) { - action(step.value); - } - } - } - function createIteratorData(data, selector) { - return { current: data.head, selector: selector }; - } - function iteratorNext(data) { - // Navigate to the next entry. - data.current = getNext(data.current); - if (data.current) { - return { value: data.selector(data.current.key, data.current.value), done: false }; - } - else { - return { value: undefined, done: true }; - } - } - /* @internal */ - var ShimCollections; - (function (ShimCollections) { - function createMapShim(getIterator) { - var MapIterator = /** @class */ (function () { - function MapIterator(data, selector) { - this._data = createIteratorData(data, selector); - } - MapIterator.prototype.next = function () { return iteratorNext(this._data); }; - return MapIterator; - }()); - return /** @class */ (function () { - function Map(iterable) { - var _this = this; - this._mapData = createMapData(); - forEachIteration(getIterator(iterable), function (_a) { - var key = _a[0], value = _a[1]; - return _this.set(key, value); - }); - } - Object.defineProperty(Map.prototype, "size", { - get: function () { return this._mapData.size; }, - enumerable: false, - configurable: true - }); - Map.prototype.get = function (key) { var _a; return (_a = getEntry(this._mapData, key)) === null || _a === void 0 ? void 0 : _a.value; }; - Map.prototype.set = function (key, value) { return addOrUpdateEntry(this._mapData, key, value), this; }; - Map.prototype.has = function (key) { return !!getEntry(this._mapData, key); }; - Map.prototype.delete = function (key) { return !!deleteEntry(this._mapData, key); }; - Map.prototype.clear = function () { clearEntries(this._mapData); }; - Map.prototype.keys = function () { return new MapIterator(this._mapData, function (key, _value) { return key; }); }; - Map.prototype.values = function () { return new MapIterator(this._mapData, function (_key, value) { return value; }); }; - Map.prototype.entries = function () { return new MapIterator(this._mapData, function (key, value) { return [key, value]; }); }; - Map.prototype.forEach = function (action) { forEachEntry(this._mapData, action); }; - return Map; - }()); - } - ShimCollections.createMapShim = createMapShim; - function createSetShim(getIterator) { - var SetIterator = /** @class */ (function () { - function SetIterator(data, selector) { - this._data = createIteratorData(data, selector); - } - SetIterator.prototype.next = function () { return iteratorNext(this._data); }; - return SetIterator; - }()); - return /** @class */ (function () { - function Set(iterable) { - var _this = this; - this._mapData = createMapData(); - forEachIteration(getIterator(iterable), function (value) { return _this.add(value); }); - } - Object.defineProperty(Set.prototype, "size", { - get: function () { return this._mapData.size; }, - enumerable: false, - configurable: true - }); - Set.prototype.add = function (value) { return addOrUpdateEntry(this._mapData, value, value), this; }; - Set.prototype.has = function (value) { return !!getEntry(this._mapData, value); }; - Set.prototype.delete = function (value) { return !!deleteEntry(this._mapData, value); }; - Set.prototype.clear = function () { clearEntries(this._mapData); }; - Set.prototype.keys = function () { return new SetIterator(this._mapData, function (key, _value) { return key; }); }; - Set.prototype.values = function () { return new SetIterator(this._mapData, function (_key, value) { return value; }); }; - Set.prototype.entries = function () { return new SetIterator(this._mapData, function (key, value) { return [key, value]; }); }; - Set.prototype.forEach = function (action) { forEachEntry(this._mapData, action); }; - return Set; - }()); - } - ShimCollections.createSetShim = createSetShim; - })(ShimCollections = ts.ShimCollections || (ts.ShimCollections = {})); -})(ts || (ts = {})); var ts; (function (ts) { // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configurePrerelease` too. - ts.versionMajorMinor = "4.8"; + ts.versionMajorMinor = "4.9"; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.8.4"; + ts.version = "".concat(ts.versionMajorMinor, ".3"); /* @internal */ var Comparison; (function (Comparison) { @@ -324,8 +129,12 @@ var ts; function tryGetNativeMap() { // Internet Explorer's Map doesn't support iteration, so don't use it. var gMap = globals === null || globals === void 0 ? void 0 : globals.Map; - // eslint-disable-next-line no-in-operator - return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + if (!constructor) { + throw new Error("No compatible Map implementation found."); + } + return constructor; } NativeCollections.tryGetNativeMap = tryGetNativeMap; /** @@ -334,24 +143,19 @@ var ts; function tryGetNativeSet() { // Internet Explorer's Set doesn't support iteration, so don't use it. var gSet = globals === null || globals === void 0 ? void 0 : globals.Set; - // eslint-disable-next-line no-in-operator - return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + if (!constructor) { + throw new Error("No compatible Set implementation found."); + } + return constructor; } NativeCollections.tryGetNativeSet = tryGetNativeSet; })(NativeCollections || (NativeCollections = {})); /* @internal */ - ts.Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim"); + ts.Map = NativeCollections.tryGetNativeMap(); /* @internal */ - ts.Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim"); - /* @internal */ - function getCollectionImplementation(name, nativeFactory, shimFactory) { - var _a; - // NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it. - var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator); - if (constructor) - return constructor; - throw new Error("TypeScript requires an environment that provides a compatible native ".concat(name, " implementation.")); - } + ts.Set = NativeCollections.tryGetNativeSet(); })(ts || (ts = {})); /* @internal */ var ts; @@ -1067,15 +871,18 @@ var ts; function insertSorted(array, insert, compare, allowDuplicates) { if (array.length === 0) { array.push(insert); - return; + return true; } var insertIndex = binarySearch(array, insert, identity, compare); if (insertIndex < 0) { array.splice(~insertIndex, 0, insert); + return true; } - else if (allowDuplicates) { + if (allowDuplicates) { array.splice(insertIndex, 0, insert); + return true; } + return false; } ts.insertSorted = insertSorted; function sortAndDeduplicate(array, comparer, equalityComparer) { @@ -1355,6 +1162,13 @@ var ts; : undefined; } ts.singleOrUndefined = singleOrUndefined; + /** + * Returns the only element of an array if it contains only one element; throws otherwise. + */ + function single(array) { + return ts.Debug.checkDefined(singleOrUndefined(array)); + } + ts.single = single; function singleOrMany(array) { return array && array.length === 1 ? array[0] @@ -2086,8 +1900,8 @@ var ts; return compareValues(a === null || a === void 0 ? void 0 : a.start, b === null || b === void 0 ? void 0 : b.start) || compareValues(a === null || a === void 0 ? void 0 : a.length, b === null || b === void 0 ? void 0 : b.length); } ts.compareTextSpans = compareTextSpans; - function min(a, b, compare) { - return compare(a, b) === -1 /* Comparison.LessThan */ ? a : b; + function min(items, compare) { + return reduceLeft(items, function (x, y) { return compare(x, y) === -1 /* Comparison.LessThan */ ? x : y; }); } ts.min = min; /** @@ -2878,7 +2692,7 @@ var ts; if (typeof func !== "function") { return ""; } - else if (func.hasOwnProperty("name")) { + else if (ts.hasProperty(func, "name")) { return func.name; } else { @@ -3028,7 +2842,7 @@ var ts; Debug.formatControlFlowGraph = formatControlFlowGraph; var flowNodeProto; function attachFlowNodeDebugInfoWorker(flowNode) { - if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line no-in-operator + if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line local/no-in-operator Object.defineProperties(flowNode, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -3074,7 +2888,7 @@ var ts; Debug.attachFlowNodeDebugInfo = attachFlowNodeDebugInfo; var nodeArrayProto; function attachNodeArrayDebugInfoWorker(array) { - if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line no-in-operator + if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line local/no-in-operator Object.defineProperties(array, { __tsDebuggerDisplay: { value: function (defaultValue) { @@ -3203,7 +3017,7 @@ var ts; ]; for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) { var ctor = nodeConstructors_1[_i]; - if (!ctor.prototype.hasOwnProperty("__debugKind")) { + if (!ts.hasProperty(ctor.prototype, "__debugKind")) { Object.defineProperties(ctor.prototype, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -3400,11 +3214,13 @@ var ts; // > alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric identifiers // > MUST NOT include leading zeroes. var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-][a-z0-9-]*))*$/i; + var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i; // https://semver.org/#spec-item-10 // > Build metadata MAY be denoted by appending a plus sign and a series of dot separated // > identifiers immediately following the patch or pre-release version. Identifiers MUST // > comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i; + var buildPartRegExp = /^[a-z0-9-]+$/i; // https://semver.org/#spec-item-9 // > Numeric identifiers MUST NOT include leading zeroes. var numericIdentifierRegExp = /^(0|[1-9]\d*)$/; @@ -3424,13 +3240,15 @@ var ts; ts.Debug.assert(major >= 0, "Invalid argument: major"); ts.Debug.assert(minor >= 0, "Invalid argument: minor"); ts.Debug.assert(patch >= 0, "Invalid argument: patch"); - ts.Debug.assert(!prerelease || prereleaseRegExp.test(prerelease), "Invalid argument: prerelease"); - ts.Debug.assert(!build || buildRegExp.test(build), "Invalid argument: build"); + var prereleaseArray = prerelease ? ts.isArray(prerelease) ? prerelease : prerelease.split(".") : ts.emptyArray; + var buildArray = build ? ts.isArray(build) ? build : build.split(".") : ts.emptyArray; + ts.Debug.assert(ts.every(prereleaseArray, function (s) { return prereleasePartRegExp.test(s); }), "Invalid argument: prerelease"); + ts.Debug.assert(ts.every(buildArray, function (s) { return buildPartRegExp.test(s); }), "Invalid argument: build"); this.major = major; this.minor = minor; this.patch = patch; - this.prerelease = prerelease ? prerelease.split(".") : ts.emptyArray; - this.build = build ? build.split(".") : ts.emptyArray; + this.prerelease = prereleaseArray; + this.build = buildArray; } Version.tryParse = function (text) { var result = tryParseComponents(text); @@ -3469,6 +3287,10 @@ var ts; default: return ts.Debug.assertNever(field); } }; + Version.prototype.with = function (fields) { + var _a = fields.major, major = _a === void 0 ? this.major : _a, _b = fields.minor, minor = _b === void 0 ? this.minor : _b, _c = fields.patch, patch = _c === void 0 ? this.patch : _c, _d = fields.prerelease, prerelease = _d === void 0 ? this.prerelease : _d, _e = fields.build, build = _e === void 0 ? this.build : _e; + return new Version(major, minor, patch, prerelease, build); + }; Version.prototype.toString = function () { var result = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch); if (ts.some(this.prerelease)) @@ -3477,7 +3299,7 @@ var ts; result += "+".concat(this.build.join(".")); return result; }; - Version.zero = new Version(0, 0, 0); + Version.zero = new Version(0, 0, 0, ["0"]); return Version; }()); ts.Version = Version; @@ -3560,6 +3382,10 @@ var ts; } return undefined; }; + /** + * Tests whether a version matches the range. This is equivalent to `satisfies(version, range, { includePrerelease: true })`. + * in `node-semver`. + */ VersionRange.prototype.test = function (version) { if (typeof version === "string") version = new Version(version); @@ -3670,19 +3496,20 @@ var ts; break; case "<": case ">=": - comparators.push(createComparator(operator, version)); + comparators.push(isWildcard(minor) || isWildcard(patch) ? createComparator(operator, version.with({ prerelease: "0" })) : + createComparator(operator, version)); break; case "<=": case ">": - comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major")) : - isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor")) : + comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major").with({ prerelease: "0" })) : + isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor").with({ prerelease: "0" })) : createComparator(operator, version)); break; case "=": case undefined: if (isWildcard(minor) || isWildcard(patch)) { - comparators.push(createComparator(">=", version)); - comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor"))); + comparators.push(createComparator(">=", version.with({ prerelease: "0" }))); + comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor").with({ prerelease: "0" }))); } else { comparators.push(createComparator("=", version)); @@ -3756,6 +3583,8 @@ var ts; typeof performance.mark === "function" && typeof performance.measure === "function" && typeof performance.now === "function" && + typeof performance.clearMarks === "function" && + typeof performance.clearMeasures === "function" && typeof PerformanceObserver === "function"; } function tryGetWebPerformanceHooks() { @@ -3800,7 +3629,9 @@ var ts; if (end === "__performance.measure-fix__") { nodePerformance_1.clearMarks("__performance.measure-fix__"); } - } + }, + clearMarks: function (name) { return nodePerformance_1.clearMarks(name); }, + clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); }, }; } return { @@ -3933,6 +3764,30 @@ var ts; durations.forEach(function (duration, measureName) { return cb(measureName, duration); }); } performance.forEachMeasure = forEachMeasure; + function forEachMark(cb) { + marks.forEach(function (_time, markName) { return cb(markName); }); + } + performance.forEachMark = forEachMark; + function clearMeasures(name) { + if (name !== undefined) + durations.delete(name); + else + durations.clear(); + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name); + } + performance.clearMeasures = clearMeasures; + function clearMarks(name) { + if (name !== undefined) { + counts.delete(name); + marks.delete(name); + } + else { + counts.clear(); + marks.clear(); + } + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name); + } + performance.clearMarks = clearMarks; /** * Indicates whether the performance API is enabled. */ @@ -4030,7 +3885,6 @@ var ts; var typeCatalog = []; // NB: id is index + 1 var legendPath; var legend = []; - ; /** Starts tracing for the given project. */ function startTracing(tracingMode, traceDir, configFilePath) { ts.Debug.assert(!ts.tracing, "Tracing already started"); @@ -4235,7 +4089,7 @@ var ts; var substitutionType = type; substitutionProperties = { substitutionBaseType: (_o = substitutionType.baseType) === null || _o === void 0 ? void 0 : _o.id, - substituteType: (_p = substitutionType.substitute) === null || _p === void 0 ? void 0 : _p.id, + constraintType: (_p = substitutionType.constraint) === null || _p === void 0 ? void 0 : _p.id, }; } var reverseMappedProperties = {}; @@ -4435,257 +4289,260 @@ var ts; SyntaxKind[SyntaxKind["YieldKeyword"] = 125] = "YieldKeyword"; // Contextual keywords SyntaxKind[SyntaxKind["AbstractKeyword"] = 126] = "AbstractKeyword"; - SyntaxKind[SyntaxKind["AsKeyword"] = 127] = "AsKeyword"; - SyntaxKind[SyntaxKind["AssertsKeyword"] = 128] = "AssertsKeyword"; - SyntaxKind[SyntaxKind["AssertKeyword"] = 129] = "AssertKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 130] = "AnyKeyword"; - SyntaxKind[SyntaxKind["AsyncKeyword"] = 131] = "AsyncKeyword"; - SyntaxKind[SyntaxKind["AwaitKeyword"] = 132] = "AwaitKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 133] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 134] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 135] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 136] = "GetKeyword"; - SyntaxKind[SyntaxKind["InferKeyword"] = 137] = "InferKeyword"; - SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 138] = "IntrinsicKeyword"; - SyntaxKind[SyntaxKind["IsKeyword"] = 139] = "IsKeyword"; - SyntaxKind[SyntaxKind["KeyOfKeyword"] = 140] = "KeyOfKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 141] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["NamespaceKeyword"] = 142] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["NeverKeyword"] = 143] = "NeverKeyword"; - SyntaxKind[SyntaxKind["OutKeyword"] = 144] = "OutKeyword"; - SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 145] = "ReadonlyKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 146] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 147] = "NumberKeyword"; - SyntaxKind[SyntaxKind["ObjectKeyword"] = 148] = "ObjectKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 149] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 150] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 151] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 152] = "TypeKeyword"; - SyntaxKind[SyntaxKind["UndefinedKeyword"] = 153] = "UndefinedKeyword"; - SyntaxKind[SyntaxKind["UniqueKeyword"] = 154] = "UniqueKeyword"; - SyntaxKind[SyntaxKind["UnknownKeyword"] = 155] = "UnknownKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 156] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 157] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["BigIntKeyword"] = 158] = "BigIntKeyword"; - SyntaxKind[SyntaxKind["OverrideKeyword"] = 159] = "OverrideKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 160] = "OfKeyword"; + SyntaxKind[SyntaxKind["AccessorKeyword"] = 127] = "AccessorKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 128] = "AsKeyword"; + SyntaxKind[SyntaxKind["AssertsKeyword"] = 129] = "AssertsKeyword"; + SyntaxKind[SyntaxKind["AssertKeyword"] = 130] = "AssertKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 131] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 132] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 133] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 134] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 135] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 136] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 137] = "GetKeyword"; + SyntaxKind[SyntaxKind["InferKeyword"] = 138] = "InferKeyword"; + SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 139] = "IntrinsicKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 140] = "IsKeyword"; + SyntaxKind[SyntaxKind["KeyOfKeyword"] = 141] = "KeyOfKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 142] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 143] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["NeverKeyword"] = 144] = "NeverKeyword"; + SyntaxKind[SyntaxKind["OutKeyword"] = 145] = "OutKeyword"; + SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 146] = "ReadonlyKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 147] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 148] = "NumberKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 149] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SatisfiesKeyword"] = 150] = "SatisfiesKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 151] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 152] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 153] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 154] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 155] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["UniqueKeyword"] = 156] = "UniqueKeyword"; + SyntaxKind[SyntaxKind["UnknownKeyword"] = 157] = "UnknownKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 158] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 159] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["BigIntKeyword"] = 160] = "BigIntKeyword"; + SyntaxKind[SyntaxKind["OverrideKeyword"] = 161] = "OverrideKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 162] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 161] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 162] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 163] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 164] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 163] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 164] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 165] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 165] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 166] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 167] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 166] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 167] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 168] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 169] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 170] = "ClassStaticBlockDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 171] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 172] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 173] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 174] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 175] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 176] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 168] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 169] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 170] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 171] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 172] = "ClassStaticBlockDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 173] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 174] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 175] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 176] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 177] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 178] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 177] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 178] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 179] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 180] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 181] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 182] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 183] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 184] = "TupleType"; - SyntaxKind[SyntaxKind["OptionalType"] = 185] = "OptionalType"; - SyntaxKind[SyntaxKind["RestType"] = 186] = "RestType"; - SyntaxKind[SyntaxKind["UnionType"] = 187] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 188] = "IntersectionType"; - SyntaxKind[SyntaxKind["ConditionalType"] = 189] = "ConditionalType"; - SyntaxKind[SyntaxKind["InferType"] = 190] = "InferType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 191] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 192] = "ThisType"; - SyntaxKind[SyntaxKind["TypeOperator"] = 193] = "TypeOperator"; - SyntaxKind[SyntaxKind["IndexedAccessType"] = 194] = "IndexedAccessType"; - SyntaxKind[SyntaxKind["MappedType"] = 195] = "MappedType"; - SyntaxKind[SyntaxKind["LiteralType"] = 196] = "LiteralType"; - SyntaxKind[SyntaxKind["NamedTupleMember"] = 197] = "NamedTupleMember"; - SyntaxKind[SyntaxKind["TemplateLiteralType"] = 198] = "TemplateLiteralType"; - SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 199] = "TemplateLiteralTypeSpan"; - SyntaxKind[SyntaxKind["ImportType"] = 200] = "ImportType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 179] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 180] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 181] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 182] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 183] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 184] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 185] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 186] = "TupleType"; + SyntaxKind[SyntaxKind["OptionalType"] = 187] = "OptionalType"; + SyntaxKind[SyntaxKind["RestType"] = 188] = "RestType"; + SyntaxKind[SyntaxKind["UnionType"] = 189] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 190] = "IntersectionType"; + SyntaxKind[SyntaxKind["ConditionalType"] = 191] = "ConditionalType"; + SyntaxKind[SyntaxKind["InferType"] = 192] = "InferType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 193] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 194] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 195] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 196] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 197] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 198] = "LiteralType"; + SyntaxKind[SyntaxKind["NamedTupleMember"] = 199] = "NamedTupleMember"; + SyntaxKind[SyntaxKind["TemplateLiteralType"] = 200] = "TemplateLiteralType"; + SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 201] = "TemplateLiteralTypeSpan"; + SyntaxKind[SyntaxKind["ImportType"] = 202] = "ImportType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 201] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 202] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 203] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 203] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 204] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 205] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 204] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 205] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 206] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 207] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 208] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 209] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 210] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 211] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 212] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 213] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 214] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 215] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 216] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 217] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 218] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 219] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 220] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 221] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 222] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 223] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 224] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 225] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 226] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 227] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 228] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 229] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 230] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 231] = "MetaProperty"; - SyntaxKind[SyntaxKind["SyntheticExpression"] = 232] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 206] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 207] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 208] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 209] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 210] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 211] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 212] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 213] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 214] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 215] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 216] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 217] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 218] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 219] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 220] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 221] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 222] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 223] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 224] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 225] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 226] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 227] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 228] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 229] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 230] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 231] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 232] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 233] = "MetaProperty"; + SyntaxKind[SyntaxKind["SyntheticExpression"] = 234] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["SatisfiesExpression"] = 235] = "SatisfiesExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 233] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 234] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 236] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 237] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 235] = "Block"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 236] = "EmptyStatement"; - SyntaxKind[SyntaxKind["VariableStatement"] = 237] = "VariableStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 238] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 239] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 240] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 241] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 242] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 243] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 244] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 245] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 246] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 247] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 248] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 249] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 250] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 251] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 252] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 253] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 254] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 255] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 256] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 257] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 258] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 259] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 260] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 261] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 262] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 263] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 264] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 265] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 266] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 267] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 268] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 269] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 270] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 271] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 272] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 273] = "NamedExports"; - SyntaxKind[SyntaxKind["NamespaceExport"] = 274] = "NamespaceExport"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 275] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 276] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 238] = "Block"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 239] = "EmptyStatement"; + SyntaxKind[SyntaxKind["VariableStatement"] = 240] = "VariableStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 241] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 242] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 243] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 244] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 245] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 246] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 247] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 248] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 249] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 250] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 251] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 252] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 253] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 254] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 255] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 256] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 257] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 258] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 259] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 260] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 261] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 262] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 263] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 264] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 265] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 266] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 267] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 268] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 269] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 270] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 271] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 272] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 273] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 274] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 275] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 276] = "NamedExports"; + SyntaxKind[SyntaxKind["NamespaceExport"] = 277] = "NamespaceExport"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 278] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 279] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 277] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 280] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 278] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 279] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 280] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 281] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxFragment"] = 282] = "JsxFragment"; - SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 283] = "JsxOpeningFragment"; - SyntaxKind[SyntaxKind["JsxClosingFragment"] = 284] = "JsxClosingFragment"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 285] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 286] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 287] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 288] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 281] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 282] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 283] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 284] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxFragment"] = 285] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 286] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 287] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 288] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 289] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 290] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 291] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 289] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 290] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 291] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 292] = "CatchClause"; - SyntaxKind[SyntaxKind["AssertClause"] = 293] = "AssertClause"; - SyntaxKind[SyntaxKind["AssertEntry"] = 294] = "AssertEntry"; - SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 295] = "ImportTypeAssertionContainer"; + SyntaxKind[SyntaxKind["CaseClause"] = 292] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 293] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 294] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 295] = "CatchClause"; + SyntaxKind[SyntaxKind["AssertClause"] = 296] = "AssertClause"; + SyntaxKind[SyntaxKind["AssertEntry"] = 297] = "AssertEntry"; + SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 298] = "ImportTypeAssertionContainer"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 296] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 297] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 298] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 299] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 300] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 301] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 299] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 302] = "EnumMember"; // Unparsed - SyntaxKind[SyntaxKind["UnparsedPrologue"] = 300] = "UnparsedPrologue"; - SyntaxKind[SyntaxKind["UnparsedPrepend"] = 301] = "UnparsedPrepend"; - SyntaxKind[SyntaxKind["UnparsedText"] = 302] = "UnparsedText"; - SyntaxKind[SyntaxKind["UnparsedInternalText"] = 303] = "UnparsedInternalText"; - SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 304] = "UnparsedSyntheticReference"; + SyntaxKind[SyntaxKind["UnparsedPrologue"] = 303] = "UnparsedPrologue"; + SyntaxKind[SyntaxKind["UnparsedPrepend"] = 304] = "UnparsedPrepend"; + SyntaxKind[SyntaxKind["UnparsedText"] = 305] = "UnparsedText"; + SyntaxKind[SyntaxKind["UnparsedInternalText"] = 306] = "UnparsedInternalText"; + SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 307] = "UnparsedSyntheticReference"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 305] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 306] = "Bundle"; - SyntaxKind[SyntaxKind["UnparsedSource"] = 307] = "UnparsedSource"; - SyntaxKind[SyntaxKind["InputFiles"] = 308] = "InputFiles"; + SyntaxKind[SyntaxKind["SourceFile"] = 308] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 309] = "Bundle"; + SyntaxKind[SyntaxKind["UnparsedSource"] = 310] = "UnparsedSource"; + SyntaxKind[SyntaxKind["InputFiles"] = 311] = "InputFiles"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 309] = "JSDocTypeExpression"; - SyntaxKind[SyntaxKind["JSDocNameReference"] = 310] = "JSDocNameReference"; - SyntaxKind[SyntaxKind["JSDocMemberName"] = 311] = "JSDocMemberName"; - SyntaxKind[SyntaxKind["JSDocAllType"] = 312] = "JSDocAllType"; - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 313] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 314] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 315] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 316] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType"; - SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 312] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocNameReference"] = 313] = "JSDocNameReference"; + SyntaxKind[SyntaxKind["JSDocMemberName"] = 314] = "JSDocMemberName"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 315] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 316] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 317] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 318] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 319] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 320] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 321] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocNamepathType"] = 322] = "JSDocNamepathType"; + SyntaxKind[SyntaxKind["JSDoc"] = 323] = "JSDoc"; /** @deprecated Use SyntaxKind.JSDoc */ - SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 322] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocSignature"] = 323] = "JSDocSignature"; - SyntaxKind[SyntaxKind["JSDocLink"] = 324] = "JSDocLink"; - SyntaxKind[SyntaxKind["JSDocLinkCode"] = 325] = "JSDocLinkCode"; - SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 326] = "JSDocLinkPlain"; - SyntaxKind[SyntaxKind["JSDocTag"] = 327] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 328] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 329] = "JSDocImplementsTag"; - SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 330] = "JSDocAuthorTag"; - SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 331] = "JSDocDeprecatedTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 332] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocPublicTag"] = 333] = "JSDocPublicTag"; - SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 334] = "JSDocPrivateTag"; - SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 335] = "JSDocProtectedTag"; - SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 336] = "JSDocReadonlyTag"; - SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 337] = "JSDocOverrideTag"; - SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 338] = "JSDocCallbackTag"; - SyntaxKind[SyntaxKind["JSDocEnumTag"] = 339] = "JSDocEnumTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 340] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 341] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocThisTag"] = 342] = "JSDocThisTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 343] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 344] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 345] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocSeeTag"] = 346] = "JSDocSeeTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 347] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocComment"] = 323] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocText"] = 324] = "JSDocText"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 325] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocSignature"] = 326] = "JSDocSignature"; + SyntaxKind[SyntaxKind["JSDocLink"] = 327] = "JSDocLink"; + SyntaxKind[SyntaxKind["JSDocLinkCode"] = 328] = "JSDocLinkCode"; + SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 329] = "JSDocLinkPlain"; + SyntaxKind[SyntaxKind["JSDocTag"] = 330] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 331] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 332] = "JSDocImplementsTag"; + SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 333] = "JSDocAuthorTag"; + SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 334] = "JSDocDeprecatedTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 335] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocPublicTag"] = 336] = "JSDocPublicTag"; + SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 337] = "JSDocPrivateTag"; + SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 338] = "JSDocProtectedTag"; + SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 339] = "JSDocReadonlyTag"; + SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 340] = "JSDocOverrideTag"; + SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 341] = "JSDocCallbackTag"; + SyntaxKind[SyntaxKind["JSDocEnumTag"] = 342] = "JSDocEnumTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 343] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 344] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocThisTag"] = 345] = "JSDocThisTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 346] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 347] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 348] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocSeeTag"] = 349] = "JSDocSeeTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 350] = "JSDocPropertyTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 348] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 351] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 349] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 350] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 351] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 352] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 353] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 354] = "SyntheticReferenceExpression"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 352] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 353] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 354] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 355] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 356] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 357] = "SyntheticReferenceExpression"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 355] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 358] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 63] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 78] = "LastAssignment"; @@ -4694,15 +4551,15 @@ var ts; SyntaxKind[SyntaxKind["FirstReservedWord"] = 81] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 116] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 81] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 160] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 162] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 117] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 125] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 177] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 200] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 179] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 202] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 78] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 160] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 162] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -4711,15 +4568,15 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 29] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 78] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstStatement"] = 237] = "FirstStatement"; - SyntaxKind[SyntaxKind["LastStatement"] = 253] = "LastStatement"; - SyntaxKind[SyntaxKind["FirstNode"] = 161] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 309] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 347] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 327] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstStatement"] = 240] = "FirstStatement"; + SyntaxKind[SyntaxKind["LastStatement"] = 256] = "LastStatement"; + SyntaxKind[SyntaxKind["FirstNode"] = 163] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 312] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 350] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 330] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 350] = "LastJSDocTagNode"; /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword"; - /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword"; + /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 162] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -4784,9 +4641,10 @@ var ts; ModifierFlags[ModifierFlags["Protected"] = 16] = "Protected"; ModifierFlags[ModifierFlags["Static"] = 32] = "Static"; ModifierFlags[ModifierFlags["Readonly"] = 64] = "Readonly"; - ModifierFlags[ModifierFlags["Abstract"] = 128] = "Abstract"; - ModifierFlags[ModifierFlags["Async"] = 256] = "Async"; - ModifierFlags[ModifierFlags["Default"] = 512] = "Default"; + ModifierFlags[ModifierFlags["Accessor"] = 128] = "Accessor"; + ModifierFlags[ModifierFlags["Abstract"] = 256] = "Abstract"; + ModifierFlags[ModifierFlags["Async"] = 512] = "Async"; + ModifierFlags[ModifierFlags["Default"] = 1024] = "Default"; ModifierFlags[ModifierFlags["Const"] = 2048] = "Const"; ModifierFlags[ModifierFlags["HasComputedJSDocModifiers"] = 4096] = "HasComputedJSDocModifiers"; ModifierFlags[ModifierFlags["Deprecated"] = 8192] = "Deprecated"; @@ -4799,10 +4657,10 @@ var ts; // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 16476] = "ParameterPropertyModifier"; ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier"; - ModifierFlags[ModifierFlags["TypeScriptModifier"] = 116958] = "TypeScriptModifier"; - ModifierFlags[ModifierFlags["ExportDefault"] = 513] = "ExportDefault"; - ModifierFlags[ModifierFlags["All"] = 257023] = "All"; - ModifierFlags[ModifierFlags["Modifier"] = 125951] = "Modifier"; + ModifierFlags[ModifierFlags["TypeScriptModifier"] = 117086] = "TypeScriptModifier"; + ModifierFlags[ModifierFlags["ExportDefault"] = 1025] = "ExportDefault"; + ModifierFlags[ModifierFlags["All"] = 258047] = "All"; + ModifierFlags[ModifierFlags["Modifier"] = 126975] = "Modifier"; })(ModifierFlags = ts.ModifierFlags || (ts.ModifierFlags = {})); var JsxFlags; (function (JsxFlags) { @@ -4998,6 +4856,7 @@ var ts; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyTuple"] = 524288] = "AllowEmptyTuple"; NodeBuilderFlags[NodeBuilderFlags["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType"; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType"; + /* @internal */ NodeBuilderFlags[NodeBuilderFlags["WriteComputedProps"] = 1073741824] = "WriteComputedProps"; // Errors (cont.) NodeBuilderFlags[NodeBuilderFlags["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths"; /* @internal */ NodeBuilderFlags[NodeBuilderFlags["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain"; @@ -5058,8 +4917,10 @@ var ts; SymbolFormatFlags[SymbolFormatFlags["AllowAnyNodeKind"] = 4] = "AllowAnyNodeKind"; // Prefer aliases which are not directly visible SymbolFormatFlags[SymbolFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 8] = "UseAliasDefinedOutsideCurrentScope"; + // { [E.A]: 1 } + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["WriteComputedProps"] = 16] = "WriteComputedProps"; // Skip building an accessible symbol chain - /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 16] = "DoNotIncludeSymbolChain"; + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 32] = "DoNotIncludeSymbolChain"; })(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); /* @internal */ var SymbolAccessibility; @@ -5173,6 +5034,7 @@ var ts; SymbolFlags[SymbolFlags["MethodExcludes"] = 103359] = "MethodExcludes"; SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes"; SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes"; + SymbolFlags[SymbolFlags["AccessorExcludes"] = 13247] = "AccessorExcludes"; SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes"; SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes"; SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes"; @@ -5256,8 +5118,8 @@ var ts; NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance"; NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic"; NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked"; - NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuper"] = 2048] = "AsyncMethodWithSuper"; - NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuperBinding"] = 4096] = "AsyncMethodWithSuperBinding"; + NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAccessInAsync"] = 2048] = "MethodWithSuperPropertyAccessInAsync"; + NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAssignmentInAsync"] = 4096] = "MethodWithSuperPropertyAssignmentInAsync"; NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments"; NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed"; NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass"; @@ -6299,7 +6161,6 @@ var ts; var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels); /* @internal */ ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels); - /* @internal */ function setCustomPollingValues(system) { if (!system.getEnvironmentVariable) { return; @@ -6342,7 +6203,6 @@ var ts; createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels); } } - ts.setCustomPollingValues = setCustomPollingValues; function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) { var definedValueCopyToIndex = pollIndex; // Max visit would be all elements of the queue @@ -6388,7 +6248,6 @@ var ts; } } } - /* @internal */ function createDynamicPriorityPollingWatchFile(host) { var watchedFiles = []; var changedFilesInLastPoll = []; @@ -6497,7 +6356,6 @@ var ts; pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval)); } } - ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile; function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) { // One file can have multiple watchers var fileWatcherCallbacks = ts.createMultiMap(); @@ -6576,42 +6434,38 @@ var ts; pollScheduled = host.setTimeout(pollQueue, PollingInterval.High); } } - /* @internal */ - function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) { - var cache = new ts.Map(); - var callbacksCache = ts.createMultiMap(); + function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) { var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - return function (fileName, callback, pollingInterval, options) { - var path = toCanonicalFileName(fileName); - var existing = cache.get(path); - if (existing) { - existing.refCount++; - } - else { - cache.set(path, { - watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options), - refCount: 1 - }); + var path = toCanonicalFileName(name); + var existing = cache.get(path); + if (existing) { + existing.callbacks.push(callback); + } + else { + cache.set(path, { + watcher: createWatcher(( + // Cant infer types correctly so lets satisfy checker + function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })), + callbacks: [callback] + }); + } + return { + close: function () { + var watcher = cache.get(path); + // Watcher is not expected to be undefined, but if it is normally its because + // exception was thrown somewhere else and watch state is not what it should be + if (!watcher) + return; + if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length) + return; + cache.delete(path); + ts.closeFileWatcherOf(watcher); } - callbacksCache.add(path, callback); - return { - close: function () { - var watcher = ts.Debug.checkDefined(cache.get(path)); - callbacksCache.remove(path, callback); - watcher.refCount--; - if (watcher.refCount) - return; - cache.delete(path); - ts.closeFileWatcherOf(watcher); - } - }; }; } - ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName; /** * Returns true if file status changed */ - /*@internal*/ function onWatchedFileStat(watchedFile, modifiedTime) { var oldTime = watchedFile.mtime.getTime(); var newTime = modifiedTime.getTime(); @@ -6623,7 +6477,6 @@ var ts; } return false; } - ts.onWatchedFileStat = onWatchedFileStat; /*@internal*/ function getFileWatcherEventKind(oldTime, newTime) { return oldTime === 0 @@ -6651,7 +6504,6 @@ var ts; * that means if this is recursive watcher, watch the children directories as well * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile) */ - /*@internal*/ function createDirectoryWatcherSupportingRecursive(_a) { var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout; var cache = new ts.Map(); @@ -6860,18 +6712,15 @@ var ts; return ts.stringContains(toCanonicalFilePath(path), searchPath); } } - ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive; /*@internal*/ var FileSystemEntryKind; (function (FileSystemEntryKind) { FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File"; FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory"; })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {})); - /*@internal*/ function createFileWatcherCallback(callback) { return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); }; } - ts.createFileWatcherCallback = createFileWatcherCallback; function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) { return function (eventName, _relativeFileName, modifiedTime) { if (eventName === "rename") { @@ -6905,7 +6754,10 @@ var ts; } /*@internal*/ function createSystemWatchFunctions(_a) { - var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatches = new ts.Map(); + var fsWatches = new ts.Map(); + var fsWatchesRecursive = new ts.Map(); var dynamicPollingWatchFile; var fixedChunkSizePollingWatchFile; var nonPollingWatchFile; @@ -6968,8 +6820,8 @@ var ts; return useNonPollingWatchers ? // Use notifications from FS to watch with falling back to fs.watchFile generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) : - // Default to do not use fixed polling interval - { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval }; + // Default to using fs events + { watchFile: ts.WatchFileKind.UseFsEvents }; } } function generateWatchFileOptions(watchFile, fallbackPolling, options) { @@ -7040,7 +6892,13 @@ var ts; }; } } + function pollingWatchFile(fileName, callback, pollingInterval, options) { + return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); }); + } function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { + return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); }); + } + function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { var lastDirectoryPartWithDirectorySeparator; var lastDirectoryPart; if (inodeWatching) { @@ -7219,7 +7077,7 @@ var ts; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); var _b = createSystemWatchFunctions({ - pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), + pollingWatchFileWorker: fsWatchFileWorker, getModifiedTime: getModifiedTime, setTimeout: setTimeout, clearTimeout: clearTimeout, @@ -7235,7 +7093,6 @@ var ts; tscWatchFile: process.env.TSC_WATCHFILE, useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER, tscWatchDirectory: process.env.TSC_WATCHDIRECTORY, - defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); }, inodeWatching: isLinuxOrMacOs, sysLog: sysLog, }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory; @@ -8039,12 +7896,9 @@ var ts; * Normalize path separators, converting `\` into `/`. */ function normalizeSlashes(path) { - var index = path.indexOf("\\"); - if (index === -1) { - return path; - } - backslashRegExp.lastIndex = index; // prime regex with known position - return path.replace(backslashRegExp, ts.directorySeparator); + return path.indexOf("\\") !== -1 + ? path.replace(backslashRegExp, ts.directorySeparator) + : path; } ts.normalizeSlashes = normalizeSlashes; /** @@ -8627,6 +8481,8 @@ var ts; A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."), _0_modifier_cannot_appear_on_a_type_parameter: diag(1273, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_parameter_1273", "'{0}' modifier cannot appear on a type parameter"), _0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"), + accessor_modifier_can_only_appear_on_a_property_declaration: diag(1275, ts.DiagnosticCategory.Error, "accessor_modifier_can_only_appear_on_a_property_declaration_1275", "'accessor' modifier can only appear on a property declaration."), + An_accessor_property_cannot_be_declared_optional: diag(1276, ts.DiagnosticCategory.Error, "An_accessor_property_cannot_be_declared_optional_1276", "An 'accessor' property cannot be declared optional."), with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."), await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."), The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."), @@ -8677,7 +8533,7 @@ var ts; An_enum_member_name_must_be_followed_by_a_or: diag(1357, ts.DiagnosticCategory.Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."), Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, ts.DiagnosticCategory.Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."), Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here: diag(1359, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."), - Class_constructor_may_not_be_a_generator: diag(1360, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1360", "Class constructor may not be a generator."), + Type_0_does_not_satisfy_the_expected_type_1: diag(1360, ts.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_expected_type_1_1360", "Type '{0}' does not satisfy the expected type '{1}'."), _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type: diag(1361, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."), _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type: diag(1362, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."), A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both: diag(1363, ts.DiagnosticCategory.Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."), @@ -8685,6 +8541,7 @@ var ts; Convert_all_re_exported_types_to_type_only_exports: diag(1365, ts.DiagnosticCategory.Message, "Convert_all_re_exported_types_to_type_only_exports_1365", "Convert all re-exported types to type-only exports"), Split_into_two_separate_import_declarations: diag(1366, ts.DiagnosticCategory.Message, "Split_into_two_separate_import_declarations_1366", "Split into two separate import declarations"), Split_all_invalid_type_only_imports: diag(1367, ts.DiagnosticCategory.Message, "Split_all_invalid_type_only_imports_1367", "Split all invalid type-only imports"), + Class_constructor_may_not_be_a_generator: diag(1368, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."), Did_you_mean_0: diag(1369, ts.DiagnosticCategory.Message, "Did_you_mean_0_1369", "Did you mean '{0}'?"), This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, ts.DiagnosticCategory.Error, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."), Convert_to_type_only_import: diag(1373, ts.DiagnosticCategory.Message, "Convert_to_type_only_import_1373", "Convert to type-only import"), @@ -8858,14 +8715,12 @@ var ts; The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."), The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."), The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."), - The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."), - The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."), The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."), Operator_0_cannot_be_applied_to_types_1_and_2: diag(2365, ts.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."), Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: diag(2366, ts.DiagnosticCategory.Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."), - This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367", "This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap."), + This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367", "This comparison appears to be unintentional because the types '{0}' and '{1}' have no overlap."), Type_parameter_name_cannot_be_0: diag(2368, ts.DiagnosticCategory.Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."), A_parameter_property_is_only_allowed_in_a_constructor_implementation: diag(2369, ts.DiagnosticCategory.Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."), A_rest_parameter_must_be_of_an_array_type: diag(2370, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."), @@ -9108,6 +8963,7 @@ var ts; Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."), Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."), Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."), + Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, ts.DiagnosticCategory.Error, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."), Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."), A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."), Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."), @@ -9288,6 +9144,7 @@ var ts; _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"), We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."), Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), + This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."), Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), @@ -9745,6 +9602,11 @@ var ts; Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."), Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"), Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"), + Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"), + Resolving_in_0_mode_with_conditions_1: diag(6402, ts.DiagnosticCategory.Message, "Resolving_in_0_mode_with_conditions_1_6402", "Resolving in {0} mode with conditions {1}."), + Matched_0_condition_1: diag(6403, ts.DiagnosticCategory.Message, "Matched_0_condition_1_6403", "Matched '{0}' condition '{1}'."), + Using_0_subpath_1_with_target_2: diag(6404, ts.DiagnosticCategory.Message, "Using_0_subpath_1_with_target_2_6404", "Using '{0}' subpath '{1}' with target '{2}'."), + Saw_non_matching_condition_0: diag(6405, ts.DiagnosticCategory.Message, "Saw_non_matching_condition_0_6405", "Saw non-matching condition '{0}'."), The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"), The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."), The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."), @@ -9987,6 +9849,7 @@ var ts; The_tag_was_first_specified_here: diag(8034, ts.DiagnosticCategory.Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."), You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."), You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."), + Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, ts.DiagnosticCategory.Error, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."), Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."), Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."), JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17000, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."), @@ -10060,6 +9923,8 @@ var ts; Remove_type_from_import_of_0_from_1: diag(90056, ts.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", "Remove 'type' from import of '{0}' from \"{1}\""), Add_import_from_0: diag(90057, ts.DiagnosticCategory.Message, "Add_import_from_0_90057", "Add import from \"{0}\""), Update_import_from_0: diag(90058, ts.DiagnosticCategory.Message, "Update_import_from_0_90058", "Update import from \"{0}\""), + Export_0_from_module_1: diag(90059, ts.DiagnosticCategory.Message, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"), + Export_all_referenced_locals: diag(90060, ts.DiagnosticCategory.Message, "Export_all_referenced_locals_90060", "Export all referenced locals"), Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"), Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"), Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"), @@ -10158,6 +10023,7 @@ var ts; Set_the_module_option_in_your_configuration_file_to_0: diag(95099, ts.DiagnosticCategory.Message, "Set_the_module_option_in_your_configuration_file_to_0_95099", "Set the 'module' option in your configuration file to '{0}'"), Convert_invalid_character_to_its_html_entity_code: diag(95100, ts.DiagnosticCategory.Message, "Convert_invalid_character_to_its_html_entity_code_95100", "Convert invalid character to its html entity code"), Convert_all_invalid_characters_to_HTML_entity_code: diag(95101, ts.DiagnosticCategory.Message, "Convert_all_invalid_characters_to_HTML_entity_code_95101", "Convert all invalid characters to HTML entity code"), + Convert_all_const_to_let: diag(95102, ts.DiagnosticCategory.Message, "Convert_all_const_to_let_95102", "Convert all 'const' to 'let'"), Convert_function_expression_0_to_arrow_function: diag(95105, ts.DiagnosticCategory.Message, "Convert_function_expression_0_to_arrow_function_95105", "Convert function expression '{0}' to arrow function"), Convert_function_declaration_0_to_arrow_function: diag(95106, ts.DiagnosticCategory.Message, "Convert_function_declaration_0_to_arrow_function_95106", "Convert function declaration '{0}' to arrow function"), Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"), @@ -10227,6 +10093,8 @@ var ts; Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"), Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"), Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"), + Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."), + Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."), No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."), Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."), JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"), @@ -10260,6 +10128,12 @@ var ts; _0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation: diag(18042, ts.DiagnosticCategory.Error, "_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation_18042", "'{0}' is a type and cannot be imported in JavaScript files. Use '{1}' in a JSDoc type annotation."), Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."), _0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."), + Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18045, ts.DiagnosticCategory.Error, "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045", "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."), + _0_is_of_type_unknown: diag(18046, ts.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."), + _0_is_possibly_null: diag(18047, ts.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."), + _0_is_possibly_undefined: diag(18048, ts.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."), + _0_is_possibly_null_or_undefined: diag(18049, ts.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."), + The_value_0_cannot_be_used_here: diag(18050, ts.DiagnosticCategory.Error, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."), }; })(ts || (ts = {})); var ts; @@ -10278,12 +10152,13 @@ var ts; /** @internal */ ts.textToKeywordObj = (_a = { abstract: 126 /* SyntaxKind.AbstractKeyword */, - any: 130 /* SyntaxKind.AnyKeyword */, - as: 127 /* SyntaxKind.AsKeyword */, - asserts: 128 /* SyntaxKind.AssertsKeyword */, - assert: 129 /* SyntaxKind.AssertKeyword */, - bigint: 158 /* SyntaxKind.BigIntKeyword */, - boolean: 133 /* SyntaxKind.BooleanKeyword */, + accessor: 127 /* SyntaxKind.AccessorKeyword */, + any: 131 /* SyntaxKind.AnyKeyword */, + as: 128 /* SyntaxKind.AsKeyword */, + asserts: 129 /* SyntaxKind.AssertsKeyword */, + assert: 130 /* SyntaxKind.AssertKeyword */, + bigint: 160 /* SyntaxKind.BigIntKeyword */, + boolean: 134 /* SyntaxKind.BooleanKeyword */, break: 81 /* SyntaxKind.BreakKeyword */, case: 82 /* SyntaxKind.CaseKeyword */, catch: 83 /* SyntaxKind.CatchKeyword */, @@ -10291,9 +10166,9 @@ var ts; continue: 86 /* SyntaxKind.ContinueKeyword */, const: 85 /* SyntaxKind.ConstKeyword */ }, - _a["" + "constructor"] = 134 /* SyntaxKind.ConstructorKeyword */, + _a["" + "constructor"] = 135 /* SyntaxKind.ConstructorKeyword */, _a.debugger = 87 /* SyntaxKind.DebuggerKeyword */, - _a.declare = 135 /* SyntaxKind.DeclareKeyword */, + _a.declare = 136 /* SyntaxKind.DeclareKeyword */, _a.default = 88 /* SyntaxKind.DefaultKeyword */, _a.delete = 89 /* SyntaxKind.DeleteKeyword */, _a.do = 90 /* SyntaxKind.DoKeyword */, @@ -10304,60 +10179,61 @@ var ts; _a.false = 95 /* SyntaxKind.FalseKeyword */, _a.finally = 96 /* SyntaxKind.FinallyKeyword */, _a.for = 97 /* SyntaxKind.ForKeyword */, - _a.from = 156 /* SyntaxKind.FromKeyword */, + _a.from = 158 /* SyntaxKind.FromKeyword */, _a.function = 98 /* SyntaxKind.FunctionKeyword */, - _a.get = 136 /* SyntaxKind.GetKeyword */, + _a.get = 137 /* SyntaxKind.GetKeyword */, _a.if = 99 /* SyntaxKind.IfKeyword */, _a.implements = 117 /* SyntaxKind.ImplementsKeyword */, _a.import = 100 /* SyntaxKind.ImportKeyword */, _a.in = 101 /* SyntaxKind.InKeyword */, - _a.infer = 137 /* SyntaxKind.InferKeyword */, + _a.infer = 138 /* SyntaxKind.InferKeyword */, _a.instanceof = 102 /* SyntaxKind.InstanceOfKeyword */, _a.interface = 118 /* SyntaxKind.InterfaceKeyword */, - _a.intrinsic = 138 /* SyntaxKind.IntrinsicKeyword */, - _a.is = 139 /* SyntaxKind.IsKeyword */, - _a.keyof = 140 /* SyntaxKind.KeyOfKeyword */, + _a.intrinsic = 139 /* SyntaxKind.IntrinsicKeyword */, + _a.is = 140 /* SyntaxKind.IsKeyword */, + _a.keyof = 141 /* SyntaxKind.KeyOfKeyword */, _a.let = 119 /* SyntaxKind.LetKeyword */, - _a.module = 141 /* SyntaxKind.ModuleKeyword */, - _a.namespace = 142 /* SyntaxKind.NamespaceKeyword */, - _a.never = 143 /* SyntaxKind.NeverKeyword */, + _a.module = 142 /* SyntaxKind.ModuleKeyword */, + _a.namespace = 143 /* SyntaxKind.NamespaceKeyword */, + _a.never = 144 /* SyntaxKind.NeverKeyword */, _a.new = 103 /* SyntaxKind.NewKeyword */, _a.null = 104 /* SyntaxKind.NullKeyword */, - _a.number = 147 /* SyntaxKind.NumberKeyword */, - _a.object = 148 /* SyntaxKind.ObjectKeyword */, + _a.number = 148 /* SyntaxKind.NumberKeyword */, + _a.object = 149 /* SyntaxKind.ObjectKeyword */, _a.package = 120 /* SyntaxKind.PackageKeyword */, _a.private = 121 /* SyntaxKind.PrivateKeyword */, _a.protected = 122 /* SyntaxKind.ProtectedKeyword */, _a.public = 123 /* SyntaxKind.PublicKeyword */, - _a.override = 159 /* SyntaxKind.OverrideKeyword */, - _a.out = 144 /* SyntaxKind.OutKeyword */, - _a.readonly = 145 /* SyntaxKind.ReadonlyKeyword */, - _a.require = 146 /* SyntaxKind.RequireKeyword */, - _a.global = 157 /* SyntaxKind.GlobalKeyword */, + _a.override = 161 /* SyntaxKind.OverrideKeyword */, + _a.out = 145 /* SyntaxKind.OutKeyword */, + _a.readonly = 146 /* SyntaxKind.ReadonlyKeyword */, + _a.require = 147 /* SyntaxKind.RequireKeyword */, + _a.global = 159 /* SyntaxKind.GlobalKeyword */, _a.return = 105 /* SyntaxKind.ReturnKeyword */, - _a.set = 149 /* SyntaxKind.SetKeyword */, + _a.satisfies = 150 /* SyntaxKind.SatisfiesKeyword */, + _a.set = 151 /* SyntaxKind.SetKeyword */, _a.static = 124 /* SyntaxKind.StaticKeyword */, - _a.string = 150 /* SyntaxKind.StringKeyword */, + _a.string = 152 /* SyntaxKind.StringKeyword */, _a.super = 106 /* SyntaxKind.SuperKeyword */, _a.switch = 107 /* SyntaxKind.SwitchKeyword */, - _a.symbol = 151 /* SyntaxKind.SymbolKeyword */, + _a.symbol = 153 /* SyntaxKind.SymbolKeyword */, _a.this = 108 /* SyntaxKind.ThisKeyword */, _a.throw = 109 /* SyntaxKind.ThrowKeyword */, _a.true = 110 /* SyntaxKind.TrueKeyword */, _a.try = 111 /* SyntaxKind.TryKeyword */, - _a.type = 152 /* SyntaxKind.TypeKeyword */, + _a.type = 154 /* SyntaxKind.TypeKeyword */, _a.typeof = 112 /* SyntaxKind.TypeOfKeyword */, - _a.undefined = 153 /* SyntaxKind.UndefinedKeyword */, - _a.unique = 154 /* SyntaxKind.UniqueKeyword */, - _a.unknown = 155 /* SyntaxKind.UnknownKeyword */, + _a.undefined = 155 /* SyntaxKind.UndefinedKeyword */, + _a.unique = 156 /* SyntaxKind.UniqueKeyword */, + _a.unknown = 157 /* SyntaxKind.UnknownKeyword */, _a.var = 113 /* SyntaxKind.VarKeyword */, _a.void = 114 /* SyntaxKind.VoidKeyword */, _a.while = 115 /* SyntaxKind.WhileKeyword */, _a.with = 116 /* SyntaxKind.WithKeyword */, _a.yield = 125 /* SyntaxKind.YieldKeyword */, - _a.async = 131 /* SyntaxKind.AsyncKeyword */, - _a.await = 132 /* SyntaxKind.AwaitKeyword */, - _a.of = 160 /* SyntaxKind.OfKeyword */, + _a.async = 132 /* SyntaxKind.AsyncKeyword */, + _a.await = 133 /* SyntaxKind.AwaitKeyword */, + _a.of = 162 /* SyntaxKind.OfKeyword */, _a); var textToKeyword = new ts.Map(ts.getEntries(ts.textToKeywordObj)); var textToToken = new ts.Map(ts.getEntries(__assign(__assign({}, ts.textToKeywordObj), { "{": 18 /* SyntaxKind.OpenBraceToken */, "}": 19 /* SyntaxKind.CloseBraceToken */, "(": 20 /* SyntaxKind.OpenParenToken */, ")": 21 /* SyntaxKind.CloseParenToken */, "[": 22 /* SyntaxKind.OpenBracketToken */, "]": 23 /* SyntaxKind.CloseBracketToken */, ".": 24 /* SyntaxKind.DotToken */, "...": 25 /* SyntaxKind.DotDotDotToken */, ";": 26 /* SyntaxKind.SemicolonToken */, ",": 27 /* SyntaxKind.CommaToken */, "<": 29 /* SyntaxKind.LessThanToken */, ">": 31 /* SyntaxKind.GreaterThanToken */, "<=": 32 /* SyntaxKind.LessThanEqualsToken */, ">=": 33 /* SyntaxKind.GreaterThanEqualsToken */, "==": 34 /* SyntaxKind.EqualsEqualsToken */, "!=": 35 /* SyntaxKind.ExclamationEqualsToken */, "===": 36 /* SyntaxKind.EqualsEqualsEqualsToken */, "!==": 37 /* SyntaxKind.ExclamationEqualsEqualsToken */, "=>": 38 /* SyntaxKind.EqualsGreaterThanToken */, "+": 39 /* SyntaxKind.PlusToken */, "-": 40 /* SyntaxKind.MinusToken */, "**": 42 /* SyntaxKind.AsteriskAsteriskToken */, "*": 41 /* SyntaxKind.AsteriskToken */, "/": 43 /* SyntaxKind.SlashToken */, "%": 44 /* SyntaxKind.PercentToken */, "++": 45 /* SyntaxKind.PlusPlusToken */, "--": 46 /* SyntaxKind.MinusMinusToken */, "<<": 47 /* SyntaxKind.LessThanLessThanToken */, ">": 48 /* SyntaxKind.GreaterThanGreaterThanToken */, ">>>": 49 /* SyntaxKind.GreaterThanGreaterThanGreaterThanToken */, "&": 50 /* SyntaxKind.AmpersandToken */, "|": 51 /* SyntaxKind.BarToken */, "^": 52 /* SyntaxKind.CaretToken */, "!": 53 /* SyntaxKind.ExclamationToken */, "~": 54 /* SyntaxKind.TildeToken */, "&&": 55 /* SyntaxKind.AmpersandAmpersandToken */, "||": 56 /* SyntaxKind.BarBarToken */, "?": 57 /* SyntaxKind.QuestionToken */, "??": 60 /* SyntaxKind.QuestionQuestionToken */, "?.": 28 /* SyntaxKind.QuestionDotToken */, ":": 58 /* SyntaxKind.ColonToken */, "=": 63 /* SyntaxKind.EqualsToken */, "+=": 64 /* SyntaxKind.PlusEqualsToken */, "-=": 65 /* SyntaxKind.MinusEqualsToken */, "*=": 66 /* SyntaxKind.AsteriskEqualsToken */, "**=": 67 /* SyntaxKind.AsteriskAsteriskEqualsToken */, "/=": 68 /* SyntaxKind.SlashEqualsToken */, "%=": 69 /* SyntaxKind.PercentEqualsToken */, "<<=": 70 /* SyntaxKind.LessThanLessThanEqualsToken */, ">>=": 71 /* SyntaxKind.GreaterThanGreaterThanEqualsToken */, ">>>=": 72 /* SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 73 /* SyntaxKind.AmpersandEqualsToken */, "|=": 74 /* SyntaxKind.BarEqualsToken */, "^=": 78 /* SyntaxKind.CaretEqualsToken */, "||=": 75 /* SyntaxKind.BarBarEqualsToken */, "&&=": 76 /* SyntaxKind.AmpersandAmpersandEqualsToken */, "??=": 77 /* SyntaxKind.QuestionQuestionEqualsToken */, "@": 59 /* SyntaxKind.AtToken */, "#": 62 /* SyntaxKind.HashToken */, "`": 61 /* SyntaxKind.BacktickToken */ }))); @@ -10480,7 +10356,7 @@ var ts; ts.stringToToken = stringToToken; /* @internal */ function computeLineStarts(text) { - var result = new Array(); + var result = []; var pos = 0; var lineStart = 0; while (pos < text.length) { @@ -11506,7 +11382,7 @@ var ts; return -1; } function peekExtendedUnicodeEscape() { - if (languageVersion >= 2 /* ScriptTarget.ES2015 */ && codePointAt(text, pos + 1) === 117 /* CharacterCodes.u */ && codePointAt(text, pos + 2) === 123 /* CharacterCodes.openBrace */) { + if (codePointAt(text, pos + 1) === 117 /* CharacterCodes.u */ && codePointAt(text, pos + 2) === 123 /* CharacterCodes.openBrace */) { var start_2 = pos; pos += 3; var escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false); @@ -12041,12 +11917,36 @@ var ts; pos++; return token = 0 /* SyntaxKind.Unknown */; } - if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) { + var charAfterHash = codePointAt(text, pos + 1); + if (charAfterHash === 92 /* CharacterCodes.backslash */) { + pos++; + var extendedCookedChar_1 = peekExtendedUnicodeEscape(); + if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) { + pos += 3; + tokenFlags |= 8 /* TokenFlags.ExtendedUnicodeEscape */; + tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + var cookedChar_1 = peekUnicodeEscape(); + if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) { + pos += 6; + tokenFlags |= 1024 /* TokenFlags.UnicodeEscape */; + tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + pos--; + } + if (isIdentifierStart(charAfterHash, languageVersion)) { pos++; - scanIdentifier(codePointAt(text, pos), languageVersion); + // We're relying on scanIdentifier's behavior and adjusting the token kind after the fact. + // Notably absent from this block is the fact that calling a function named "scanIdentifier", + // but identifiers don't include '#', and that function doesn't deal with it at all. + // This works because 'scanIdentifier' tries to reuse source characters and builds up substrings; + // however, it starts at the 'tokenPos' which includes the '#', and will "accidentally" prepend the '#' for us. + scanIdentifier(charAfterHash, languageVersion); } else { - tokenValue = String.fromCharCode(codePointAt(text, pos)); + tokenValue = "#"; error(ts.Diagnostics.Invalid_character, pos++, charSize(ch)); } return token = 80 /* SyntaxKind.PrivateIdentifier */; @@ -12797,9 +12697,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 163 /* SyntaxKind.TypeParameter */) { + if (d && d.kind === 165 /* SyntaxKind.TypeParameter */) { for (var current = d; current; current = current.parent) { - if (isFunctionLike(current) || isClassLike(current) || current.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (isFunctionLike(current) || isClassLike(current) || current.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return current; } } @@ -12807,7 +12707,7 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node, parent) { - return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 171 /* SyntaxKind.Constructor */; + return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 173 /* SyntaxKind.Constructor */; } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function isEmptyBindingPattern(node) { @@ -12837,14 +12737,14 @@ var ts; node = walkUpBindingElementsAndPatterns(node); } var flags = getFlags(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node && node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { flags |= getFlags(node); node = node.parent; } - if (node && node.kind === 237 /* SyntaxKind.VariableStatement */) { + if (node && node.kind === 240 /* SyntaxKind.VariableStatement */) { flags |= getFlags(node); } return flags; @@ -13017,30 +12917,30 @@ var ts; } // Covers remaining cases (returning undefined if none match). switch (hostNode.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: var expr = hostNode.expression; - if (expr.kind === 221 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (expr.kind === 223 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { expr = expr.left; } switch (expr.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return expr.name; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; } } break; - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { return getDeclarationIdentifier(hostNode.expression); } - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { if (isDeclaration(hostNode.statement) || isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -13077,16 +12977,16 @@ var ts; switch (declaration.kind) { case 79 /* SyntaxKind.Identifier */: return declaration; - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: { var name = declaration.name; - if (name.kind === 161 /* SyntaxKind.QualifiedName */) { + if (name.kind === 163 /* SyntaxKind.QualifiedName */) { return name.right; } break; } - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var expr_1 = declaration; switch (ts.getAssignmentDeclarationKind(expr_1)) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -13102,15 +13002,15 @@ var ts; return undefined; } } - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); - case 339 /* SyntaxKind.JSDocEnumTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return nameForNamelessJSDocTypedef(declaration); - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = declaration; if (ts.isBindableStaticElementAccessExpression(expr)) { return expr.argumentExpression; @@ -13154,7 +13054,7 @@ var ts; } ts.getDecorators = getDecorators; function getModifiers(node) { - if (ts.hasSyntacticModifier(node, 125951 /* ModifierFlags.Modifier */)) { + if (ts.hasSyntacticModifier(node, 126975 /* ModifierFlags.Modifier */)) { return ts.filter(node.modifiers, isModifier); } } @@ -13415,12 +13315,12 @@ var ts; /** Gets the text of a jsdoc comment, flattening links to their text. */ function getTextOfJSDocComment(comment) { return typeof comment === "string" ? comment - : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 321 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); + : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 324 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); } ts.getTextOfJSDocComment = getTextOfJSDocComment; function formatJSDocLink(link) { - var kind = link.kind === 324 /* SyntaxKind.JSDocLink */ ? "link" - : link.kind === 325 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" + var kind = link.kind === 327 /* SyntaxKind.JSDocLink */ ? "link" + : link.kind === 328 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" : "linkplain"; var name = link.name ? ts.entityNameToString(link.name) : ""; var space = link.name && link.text.startsWith("://") ? "" : " "; @@ -13441,7 +13341,7 @@ var ts; return ts.emptyArray; } if (ts.isJSDocTypeAlias(node)) { - ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDoc */); + ts.Debug.assert(node.parent.kind === 323 /* SyntaxKind.JSDoc */); return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; }); } if (node.typeParameters) { @@ -13476,7 +13376,7 @@ var ts; ts.isMemberName = isMemberName; /* @internal */ function isGetOrSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */ || node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */ || node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration; function isPropertyAccessChain(node) { @@ -13494,10 +13394,10 @@ var ts; function isOptionalChain(node) { var kind = node.kind; return !!(node.flags & 32 /* NodeFlags.OptionalChain */) && - (kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 207 /* SyntaxKind.ElementAccessExpression */ - || kind === 208 /* SyntaxKind.CallExpression */ - || kind === 230 /* SyntaxKind.NonNullExpression */); + (kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 209 /* SyntaxKind.ElementAccessExpression */ + || kind === 210 /* SyntaxKind.CallExpression */ + || kind === 232 /* SyntaxKind.NonNullExpression */); } ts.isOptionalChain = isOptionalChain; /* @internal */ @@ -13532,7 +13432,7 @@ var ts; } ts.isOutermostOptionalChain = isOutermostOptionalChain; function isNullishCoalesce(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; } ts.isNullishCoalesce = isNullishCoalesce; function isConstTypeReference(node) { @@ -13549,17 +13449,17 @@ var ts; } ts.isNonNullChain = isNonNullChain; function isBreakOrContinueStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */ || node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */ || node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isNamedExportBindings(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExportBindings = isNamedExportBindings; function isUnparsedTextLike(node) { switch (node.kind) { - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return true; default: return false; @@ -13568,12 +13468,12 @@ var ts; ts.isUnparsedTextLike = isUnparsedTextLike; function isUnparsedNode(node) { return isUnparsedTextLike(node) || - node.kind === 300 /* SyntaxKind.UnparsedPrologue */ || - node.kind === 304 /* SyntaxKind.UnparsedSyntheticReference */; + node.kind === 303 /* SyntaxKind.UnparsedPrologue */ || + node.kind === 307 /* SyntaxKind.UnparsedSyntheticReference */; } ts.isUnparsedNode = isUnparsedNode; function isJSDocPropertyLikeTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; // #endregion @@ -13589,7 +13489,7 @@ var ts; ts.isNode = isNode; /* @internal */ function isNodeKind(kind) { - return kind >= 161 /* SyntaxKind.FirstNode */; + return kind >= 163 /* SyntaxKind.FirstNode */; } ts.isNodeKind = isNodeKind; /** @@ -13598,7 +13498,7 @@ var ts; * Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail. */ function isTokenKind(kind) { - return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */; + return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 162 /* SyntaxKind.LastToken */; } ts.isTokenKind = isTokenKind; /** @@ -13613,7 +13513,7 @@ var ts; // Node Arrays /* @internal */ function isNodeArray(array) { - return array.hasOwnProperty("pos") && array.hasOwnProperty("end"); + return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end"); } ts.isNodeArray = isNodeArray; // Literals @@ -13629,11 +13529,11 @@ var ts; /** @internal */ function isLiteralExpressionOfObject(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; } return false; @@ -13661,13 +13561,13 @@ var ts; ts.isImportOrExportSpecifier = isImportOrExportSpecifier; function isTypeOnlyImportOrExportDeclaration(node) { switch (node.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return node.isTypeOnly || node.parent.parent.isTypeOnly; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.isTypeOnly; - case 267 /* SyntaxKind.ImportClause */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.isTypeOnly; default: return false; @@ -13688,6 +13588,11 @@ var ts; return ts.isIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; } ts.isGeneratedIdentifier = isGeneratedIdentifier; + /* @internal */ + function isGeneratedPrivateIdentifier(node) { + return ts.isPrivateIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; + } + ts.isGeneratedPrivateIdentifier = isGeneratedPrivateIdentifier; // Private Identifiers /*@internal*/ function isPrivateIdentifierClassElementDeclaration(node) { @@ -13704,19 +13609,20 @@ var ts; function isModifierKind(token) { switch (token) { case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 101 /* SyntaxKind.InKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; } return false; @@ -13729,7 +13635,10 @@ var ts; ts.isParameterPropertyModifier = isParameterPropertyModifier; /* @internal */ function isClassMemberModifier(idToken) { - return isParameterPropertyModifier(idToken) || idToken === 124 /* SyntaxKind.StaticKeyword */ || idToken === 159 /* SyntaxKind.OverrideKeyword */; + return isParameterPropertyModifier(idToken) || + idToken === 124 /* SyntaxKind.StaticKeyword */ || + idToken === 161 /* SyntaxKind.OverrideKeyword */ || + idToken === 127 /* SyntaxKind.AccessorKeyword */; } ts.isClassMemberModifier = isClassMemberModifier; function isModifier(node) { @@ -13738,7 +13647,7 @@ var ts; ts.isModifier = isModifier; function isEntityName(node) { var kind = node.kind; - return kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isEntityName = isEntityName; @@ -13748,14 +13657,14 @@ var ts; || kind === 80 /* SyntaxKind.PrivateIdentifier */ || kind === 10 /* SyntaxKind.StringLiteral */ || kind === 8 /* SyntaxKind.NumericLiteral */ - || kind === 162 /* SyntaxKind.ComputedPropertyName */; + || kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isPropertyName = isPropertyName; function isBindingName(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */ - || kind === 202 /* SyntaxKind.ArrayBindingPattern */; + || kind === 203 /* SyntaxKind.ObjectBindingPattern */ + || kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Functions @@ -13780,13 +13689,13 @@ var ts; ts.isBooleanLiteral = isBooleanLiteral; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -13795,14 +13704,14 @@ var ts; /* @internal */ function isFunctionLikeKind(kind) { switch (kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; default: return isFunctionLikeDeclarationKind(kind); @@ -13817,36 +13726,53 @@ var ts; // Classes function isClassElement(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 234 /* SyntaxKind.SemicolonClassElement */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */); + return node && (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isClassLike = isClassLike; function isAccessor(node) { - return node && (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */); + return node && (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */); } ts.isAccessor = isAccessor; + function isAutoAccessorPropertyDeclaration(node) { + return ts.isPropertyDeclaration(node) && ts.hasAccessorModifier(node); + } + ts.isAutoAccessorPropertyDeclaration = isAutoAccessorPropertyDeclaration; /* @internal */ function isMethodOrAccessor(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; } } ts.isMethodOrAccessor = isMethodOrAccessor; + /* @internal */ + function isNamedClassElement(node) { + switch (node.kind) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return true; + default: + return false; + } + } + ts.isNamedClassElement = isNamedClassElement; // Type members function isModifierLike(node) { return isModifier(node) || ts.isDecorator(node); @@ -13854,13 +13780,13 @@ var ts; ts.isModifierLike = isModifierLike; function isTypeElement(node) { var kind = node.kind; - return kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 174 /* SyntaxKind.CallSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 176 /* SyntaxKind.CallSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isTypeElement = isTypeElement; function isClassOrTypeElement(node) { @@ -13869,12 +13795,12 @@ var ts; ts.isClassOrTypeElement = isClassOrTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 298 /* SyntaxKind.SpreadAssignment */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 301 /* SyntaxKind.SpreadAssignment */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type @@ -13889,8 +13815,8 @@ var ts; ts.isTypeNode = isTypeNode; function isFunctionOrConstructorTypeNode(node) { switch (node.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; } return false; @@ -13901,8 +13827,8 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 202 /* SyntaxKind.ArrayBindingPattern */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return kind === 204 /* SyntaxKind.ArrayBindingPattern */ + || kind === 203 /* SyntaxKind.ObjectBindingPattern */; } return false; } @@ -13910,15 +13836,15 @@ var ts; /* @internal */ function isAssignmentPattern(node) { var kind = node.kind; - return kind === 204 /* SyntaxKind.ArrayLiteralExpression */ - || kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return kind === 206 /* SyntaxKind.ArrayLiteralExpression */ + || kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; /* @internal */ function isArrayBindingElement(node) { var kind = node.kind; - return kind === 203 /* SyntaxKind.BindingElement */ - || kind === 227 /* SyntaxKind.OmittedExpression */; + return kind === 205 /* SyntaxKind.BindingElement */ + || kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -13927,9 +13853,9 @@ var ts; /* @internal */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: return true; } return false; @@ -13950,8 +13876,8 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return true; } return false; @@ -13960,10 +13886,10 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentElement(node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty - case 298 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty + case 301 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty return true; } return false; @@ -13975,8 +13901,8 @@ var ts; /* @internal */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; } return false; @@ -13985,26 +13911,26 @@ var ts; /* @internal */ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */ - || kind === 200 /* SyntaxKind.ImportType */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */ + || kind === 202 /* SyntaxKind.ImportType */; } ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; // Expression function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: return true; default: return false; @@ -14012,12 +13938,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */ || node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */ || node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 223 /* SyntaxKind.TemplateExpression */ + return kind === 225 /* SyntaxKind.TemplateExpression */ || kind === 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; @@ -14028,19 +13954,19 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: // technically this is only an Expression if it's in a `#field in expr` BinaryExpression case 13 /* SyntaxKind.RegularExpressionLiteral */: @@ -14048,15 +13974,15 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 230 /* SyntaxKind.NonNullExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 231 /* SyntaxKind.MetaProperty */: + case 232 /* SyntaxKind.NonNullExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 233 /* SyntaxKind.MetaProperty */: case 100 /* SyntaxKind.ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: @@ -14070,13 +13996,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return true; default: return isLeftHandSideExpressionKind(kind); @@ -14085,9 +14011,9 @@ var ts; /* @internal */ function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; default: @@ -14106,15 +14032,16 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 221 /* SyntaxKind.BinaryExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 229 /* SyntaxKind.AsExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 223 /* SyntaxKind.BinaryExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 231 /* SyntaxKind.AsExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -14122,8 +14049,8 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 211 /* SyntaxKind.TypeAssertionExpression */ - || kind === 229 /* SyntaxKind.AsExpression */; + return kind === 213 /* SyntaxKind.TypeAssertionExpression */ + || kind === 231 /* SyntaxKind.AsExpression */; } ts.isAssertionExpression = isAssertionExpression; /* @internal */ @@ -14134,13 +14061,13 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -14169,7 +14096,7 @@ var ts; ts.isExternalModuleIndicator = isExternalModuleIndicator; /* @internal */ function isForInOrOfStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */ || node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */ || node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForInOrOfStatement = isForInOrOfStatement; // Element @@ -14193,115 +14120,115 @@ var ts; /* @internal */ function isModuleBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleBody = isModuleBody; /* @internal */ function isNamespaceBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isNamespaceBody = isNamespaceBody; /* @internal */ function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; /* @internal */ function isNamedImportBindings(node) { var kind = node.kind; - return kind === 269 /* SyntaxKind.NamedImports */ - || kind === 268 /* SyntaxKind.NamespaceImport */; + return kind === 272 /* SyntaxKind.NamedImports */ + || kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; /* @internal */ function isModuleOrEnumDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 203 /* SyntaxKind.BindingElement */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 299 /* SyntaxKind.EnumMember */ - || kind === 275 /* SyntaxKind.ExportSpecifier */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 267 /* SyntaxKind.ImportClause */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 270 /* SyntaxKind.ImportSpecifier */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 268 /* SyntaxKind.NamespaceImport */ - || kind === 274 /* SyntaxKind.NamespaceExport */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 254 /* SyntaxKind.VariableDeclaration */ - || kind === 345 /* SyntaxKind.JSDocTypedefTag */ - || kind === 338 /* SyntaxKind.JSDocCallbackTag */ - || kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 205 /* SyntaxKind.BindingElement */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 302 /* SyntaxKind.EnumMember */ + || kind === 278 /* SyntaxKind.ExportSpecifier */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 270 /* SyntaxKind.ImportClause */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 273 /* SyntaxKind.ImportSpecifier */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 271 /* SyntaxKind.NamespaceImport */ + || kind === 277 /* SyntaxKind.NamespaceExport */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 257 /* SyntaxKind.VariableDeclaration */ + || kind === 348 /* SyntaxKind.JSDocTypedefTag */ + || kind === 341 /* SyntaxKind.JSDocCallbackTag */ + || kind === 350 /* SyntaxKind.JSDocPropertyTag */; } function isDeclarationStatementKind(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 236 /* SyntaxKind.EmptyStatement */ - || kind === 243 /* SyntaxKind.ForInStatement */ - || kind === 244 /* SyntaxKind.ForOfStatement */ - || kind === 242 /* SyntaxKind.ForStatement */ - || kind === 239 /* SyntaxKind.IfStatement */ - || kind === 250 /* SyntaxKind.LabeledStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 249 /* SyntaxKind.SwitchStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 252 /* SyntaxKind.TryStatement */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 241 /* SyntaxKind.WhileStatement */ - || kind === 248 /* SyntaxKind.WithStatement */ - || kind === 349 /* SyntaxKind.NotEmittedStatement */ - || kind === 353 /* SyntaxKind.EndOfDeclarationMarker */ - || kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 239 /* SyntaxKind.EmptyStatement */ + || kind === 246 /* SyntaxKind.ForInStatement */ + || kind === 247 /* SyntaxKind.ForOfStatement */ + || kind === 245 /* SyntaxKind.ForStatement */ + || kind === 242 /* SyntaxKind.IfStatement */ + || kind === 253 /* SyntaxKind.LabeledStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 252 /* SyntaxKind.SwitchStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 255 /* SyntaxKind.TryStatement */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 244 /* SyntaxKind.WhileStatement */ + || kind === 251 /* SyntaxKind.WithStatement */ + || kind === 352 /* SyntaxKind.NotEmittedStatement */ + || kind === 356 /* SyntaxKind.EndOfDeclarationMarker */ + || kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { - return (node.parent && node.parent.kind !== 344 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { + return (node.parent && node.parent.kind !== 347 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); } return isDeclarationKind(node.kind); } @@ -14328,10 +14255,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 235 /* SyntaxKind.Block */) + if (node.kind !== 238 /* SyntaxKind.Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 252 /* SyntaxKind.TryStatement */ || node.parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (node.parent.kind === 255 /* SyntaxKind.TryStatement */ || node.parent.kind === 295 /* SyntaxKind.CatchClause */) { return false; } } @@ -14345,15 +14272,15 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 235 /* SyntaxKind.Block */; + || kind === 238 /* SyntaxKind.Block */; } ts.isStatementOrBlock = isStatementOrBlock; // Module references /* @internal */ function isModuleReference(node) { var kind = node.kind; - return kind === 277 /* SyntaxKind.ExternalModuleReference */ - || kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 280 /* SyntaxKind.ExternalModuleReference */ + || kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleReference = isModuleReference; @@ -14363,58 +14290,58 @@ var ts; var kind = node.kind; return kind === 108 /* SyntaxKind.ThisKeyword */ || kind === 79 /* SyntaxKind.Identifier */ - || kind === 206 /* SyntaxKind.PropertyAccessExpression */; + || kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; /* @internal */ function isJsxChild(node) { var kind = node.kind; - return kind === 278 /* SyntaxKind.JsxElement */ - || kind === 288 /* SyntaxKind.JsxExpression */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */ + return kind === 281 /* SyntaxKind.JsxElement */ + || kind === 291 /* SyntaxKind.JsxExpression */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || kind === 11 /* SyntaxKind.JsxText */ - || kind === 282 /* SyntaxKind.JsxFragment */; + || kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 10 /* SyntaxKind.StringLiteral */ - || kind === 288 /* SyntaxKind.JsxExpression */; + || kind === 291 /* SyntaxKind.JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 280 /* SyntaxKind.JsxOpeningElement */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return kind === 283 /* SyntaxKind.JsxOpeningElement */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 289 /* SyntaxKind.CaseClause */ - || kind === 290 /* SyntaxKind.DefaultClause */; + return kind === 292 /* SyntaxKind.CaseClause */ + || kind === 293 /* SyntaxKind.DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 309 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocNode */; + return node.kind >= 312 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */ - || node.kind === 319 /* SyntaxKind.JSDocNamepathType */ - || node.kind === 321 /* SyntaxKind.JSDocText */ + return node.kind === 323 /* SyntaxKind.JSDoc */ + || node.kind === 322 /* SyntaxKind.JSDocNamepathType */ + || node.kind === 324 /* SyntaxKind.JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) @@ -14424,15 +14351,15 @@ var ts; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 327 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocTagNode */; + return node.kind >= 330 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessor = isSetAccessor; function isGetAccessor(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessor = isGetAccessor; /** True if has jsdoc nodes attached to it. */ @@ -14458,12 +14385,12 @@ var ts; /** True if has initializer node attached to it. */ function hasOnlyExpressionInitializer(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: return true; default: return false; @@ -14471,12 +14398,12 @@ var ts; } ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */ || node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); + return node.kind === 288 /* SyntaxKind.JsxAttribute */ || node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); } ts.isObjectLiteralElement = isObjectLiteralElement; /* @internal */ function isTypeReferenceType(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -14509,7 +14436,7 @@ var ts; } ts.isStringLiteralLike = isStringLiteralLike; function isJSDocLinkLike(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */ || node.kind === 325 /* SyntaxKind.JSDocLinkCode */ || node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 327 /* SyntaxKind.JSDocLink */ || node.kind === 328 /* SyntaxKind.JSDocLinkCode */ || node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkLike = isJSDocLinkLike; function hasRestParameter(s) { @@ -14519,7 +14446,7 @@ var ts; ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type; - return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.dotDotDotToken !== undefined || !!type && type.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isRestParameter = isRestParameter; // #endregion @@ -14777,7 +14704,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 305 /* SyntaxKind.SourceFile */) { + while (node && node.kind !== 308 /* SyntaxKind.SourceFile */) { node = node.parent; } return node; @@ -14793,11 +14720,11 @@ var ts; ts.isPlainJsFile = isPlainJsFile; function isStatementWithLocals(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return true; } return false; @@ -14993,7 +14920,7 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 348 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { + if (node.kind === 351 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, @@ -15058,7 +14985,6 @@ var ts; return emitNode && emitNode.flags || 0; } ts.getEmitFlags = getEmitFlags; - ; function getScriptTargetFeatures() { return { es2015: { @@ -15231,7 +15157,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -15263,11 +15189,11 @@ var ts; ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return !!node && node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && (!node.body); + return !!node && node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || + return node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || ts.isFunctionLikeOrClassStaticBlockDeclaration(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -15284,9 +15210,9 @@ var ts; // - defined in the top level scope and source file is an external module // - defined inside ambient module declaration located in the top level scope and source file not an external module switch (node.parent.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node.parent); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -15341,26 +15267,30 @@ var ts; return false; } ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile; + function isAmbientPropertyDeclaration(node) { + return !!(node.flags & 16777216 /* NodeFlags.Ambient */) || hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); + } + ts.isAmbientPropertyDeclaration = isAmbientPropertyDeclaration; function isBlockScope(node, parentNode) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 292 /* SyntaxKind.CatchClause */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return !ts.isFunctionLikeOrClassStaticBlockDeclaration(parentNode); @@ -15370,9 +15300,9 @@ var ts; ts.isBlockScope = isBlockScope; function isDeclarationWithTypeParameters(node) { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 323 /* SyntaxKind.JSDocSignature */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 326 /* SyntaxKind.JSDocSignature */: return true; default: ts.assertType(node); @@ -15382,25 +15312,25 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isDeclarationWithTypeParameterChildren(node) { switch (node.kind) { - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: ts.assertType(node); @@ -15410,8 +15340,8 @@ var ts; ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren; function isAnyImportSyntax(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -15424,15 +15354,15 @@ var ts; ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire; function isLateVisibilityPaintedStatement(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return true; default: return false; @@ -15473,19 +15403,19 @@ var ts; } ts.getNameFromIndexInfo = getNameFromIndexInfo; function isComputedNonLiteralName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); } ts.isComputedNonLiteralName = isComputedNonLiteralName; function tryGetTextOfPropertyName(name) { switch (name.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - return name.escapedText; + return name.autoGenerateFlags ? undefined : name.escapedText; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: if (isStringOrNumericLiteralLike(name.expression)) return ts.escapeLeadingUnderscores(name.expression.text); return undefined; @@ -15505,16 +15435,16 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: case 79 /* SyntaxKind.Identifier */: return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (ts.isIdentifier(name.name) || ts.isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { return ts.Debug.assertNever(name.name); } - case 311 /* SyntaxKind.JSDocMemberName */: + case 314 /* SyntaxKind.JSDocMemberName */: return entityNameToString(name.left) + entityNameToString(name.right); default: return ts.Debug.assertNever(name); @@ -15604,7 +15534,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body && node.body.kind === 238 /* SyntaxKind.Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -15618,7 +15548,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -15627,29 +15557,29 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 268 /* SyntaxKind.NamespaceImport */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 271 /* SyntaxKind.NamespaceImport */: errorNode = node.name; break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: var start = ts.skipTrivia(sourceFile.text, node.pos); var end = node.statements.length > 0 ? node.statements[0].pos : node.end; return ts.createTextSpanFromBounds(start, end); @@ -15701,11 +15631,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; } ts.isImportCall = isImportCall; function isImportMeta(n) { @@ -15719,7 +15649,7 @@ var ts; } ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */ + return node.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.expression.kind === 10 /* SyntaxKind.StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -15747,13 +15677,13 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 164 /* SyntaxKind.Parameter */ || - node.kind === 163 /* SyntaxKind.TypeParameter */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 214 /* SyntaxKind.ArrowFunction */ || - node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */) ? + var commentRanges = (node.kind === 166 /* SyntaxKind.Parameter */ || + node.kind === 165 /* SyntaxKind.TypeParameter */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 216 /* SyntaxKind.ArrowFunction */ || + node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); // True if the comment starts with '/**' but not if it is '/**/' @@ -15769,48 +15699,48 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (177 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return true; case 114 /* SyntaxKind.VoidKeyword */: - return node.parent.kind !== 217 /* SyntaxKind.VoidExpression */; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + return node.parent.kind !== 219 /* SyntaxKind.VoidExpression */; + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 163 /* SyntaxKind.TypeParameter */: - return node.parent.kind === 195 /* SyntaxKind.MappedType */ || node.parent.kind === 190 /* SyntaxKind.InferType */; + case 165 /* SyntaxKind.TypeParameter */: + return node.parent.kind === 197 /* SyntaxKind.MappedType */ || node.parent.kind === 192 /* SyntaxKind.InferType */; // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case 79 /* SyntaxKind.Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); // falls through - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 108 /* SyntaxKind.ThisKeyword */: { var parent = node.parent; - if (parent.kind === 181 /* SyntaxKind.TypeQuery */) { + if (parent.kind === 183 /* SyntaxKind.TypeQuery */) { return false; } - if (parent.kind === 200 /* SyntaxKind.ImportType */) { + if (parent.kind === 202 /* SyntaxKind.ImportType */) { return !parent.isTypeOf; } // Do not recursively call isPartOfTypeNode on the parent. In the example: @@ -15819,40 +15749,40 @@ var ts; // // Calling isPartOfTypeNode would consider the qualified name A.B a type node. // Only C and A.B.C are type nodes. - if (177 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (parent.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent); - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return node === parent.constraint; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return node === parent.constraint; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return node === parent.type; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return node === parent.type; - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return node === parent.type; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return node === parent.type; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.contains(parent.typeArguments, node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -15877,23 +15807,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitor(node); - case 263 /* SyntaxKind.CaseBlock */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 266 /* SyntaxKind.CaseBlock */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return ts.forEachChild(node, traverse); } } @@ -15903,23 +15833,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, skip them to avoid the work. return; default: if (ts.isFunctionLike(node)) { - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. traverse(node.name.expression); @@ -15942,10 +15872,10 @@ var ts; * @param node The type node. */ function getRestParameterElementType(node) { - if (node && node.kind === 183 /* SyntaxKind.ArrayType */) { + if (node && node.kind === 185 /* SyntaxKind.ArrayType */) { return node.elementType; } - else if (node && node.kind === 178 /* SyntaxKind.TypeReference */) { + else if (node && node.kind === 180 /* SyntaxKind.TypeReference */) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -15955,12 +15885,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 182 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 184 /* SyntaxKind.TypeLiteral */: return node.members; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return node.properties; } } @@ -15968,14 +15898,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 299 /* SyntaxKind.EnumMember */: - case 164 /* SyntaxKind.Parameter */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 302 /* SyntaxKind.EnumMember */: + case 166 /* SyntaxKind.Parameter */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } } @@ -15987,8 +15917,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ - && node.parent.parent.kind === 237 /* SyntaxKind.VariableStatement */; + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ + && node.parent.parent.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isCommonJsExportedExpression(node) { @@ -16012,13 +15942,13 @@ var ts; ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return true; } return false; @@ -16029,7 +15959,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 250 /* SyntaxKind.LabeledStatement */) { + if (node.statement.kind !== 253 /* SyntaxKind.LabeledStatement */) { return node.statement; } node = node.statement; @@ -16037,17 +15967,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); + return node && node.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethodOrAccessor(node) { - return (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) && - (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || - node.parent.kind === 226 /* SyntaxKind.ClassExpression */); + return (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) && + (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || + node.parent.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethodOrAccessor = isObjectLiteralOrClassExpressionMethodOrAccessor; function isIdentifierTypePredicate(predicate) { @@ -16060,7 +15990,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return objectLiteral.properties.filter(function (property) { - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */) { var propName = tryGetTextOfPropertyName(property.name); return key === propName || (!!key2 && key2 === propName); } @@ -16122,14 +16052,14 @@ var ts; } ts.getContainingFunctionOrClassStaticBlock = getContainingFunctionOrClassStaticBlock; function getThisContainer(node, includeArrowFunctions) { - ts.Debug.assert(node.kind !== 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(node.kind !== 308 /* SyntaxKind.SourceFile */); while (true) { node = node.parent; if (!node) { return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that. } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -16144,9 +16074,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -16157,27 +16087,27 @@ var ts; node = node.parent; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (!includeArrowFunctions) { continue; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 305 /* SyntaxKind.SourceFile */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 308 /* SyntaxKind.SourceFile */: return node; } } @@ -16190,17 +16120,17 @@ var ts; switch (node.kind) { // Arrow functions use the same scope, but may do so in a "delayed" manner // For example, `const getThis = () => this` may be before a super() call in a derived constructor - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Object properties can have computed names; only method-like bodies start a new scope return true; default: @@ -16224,9 +16154,9 @@ var ts; var container = getThisContainer(node, /*includeArrowFunctions*/ false); if (container) { switch (container.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return container; } } @@ -16248,28 +16178,28 @@ var ts; return node; } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: node = node.parent; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (!stopOnFunctions) { continue; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return node; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -16285,14 +16215,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 213 /* SyntaxKind.FunctionExpression */ || func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 215 /* SyntaxKind.FunctionExpression */ || func.kind === 216 /* SyntaxKind.ArrowFunction */) { var prev = func; var parent = func.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { prev = parent; parent = parent.parent; } - if (parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === prev) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === prev) { return parent; } } @@ -16308,7 +16238,7 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperProperty = isSuperProperty; @@ -16317,7 +16247,7 @@ var ts; */ function isThisProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 108 /* SyntaxKind.ThisKeyword */; } ts.isThisProperty = isThisProperty; @@ -16336,15 +16266,15 @@ var ts; ts.isThisInitializedObjectBindingExpression = isThisInitializedObjectBindingExpression; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return node; } return undefined; @@ -16352,10 +16282,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return node.tag; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return node.tagName; default: return node.expression; @@ -16368,25 +16298,25 @@ var ts; return false; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // classes are valid targets return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + return parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 164 /* SyntaxKind.Parameter */: + && parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 166 /* SyntaxKind.Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; return parent.body !== undefined - && (parent.kind === 171 /* SyntaxKind.Constructor */ - || parent.kind === 169 /* SyntaxKind.MethodDeclaration */ - || parent.kind === 173 /* SyntaxKind.SetAccessor */) - && grandparent.kind === 257 /* SyntaxKind.ClassDeclaration */; + && (parent.kind === 173 /* SyntaxKind.Constructor */ + || parent.kind === 171 /* SyntaxKind.MethodDeclaration */ + || parent.kind === 175 /* SyntaxKind.SetAccessor */) + && grandparent.kind === 260 /* SyntaxKind.ClassDeclaration */; } return false; } @@ -16402,11 +16332,11 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217 - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217 default: return false; @@ -16422,9 +16352,9 @@ var ts; ts.classOrConstructorParameterIsDecorated = classOrConstructorParameterIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 280 /* SyntaxKind.JsxOpeningElement */ || - parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || - parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (parent.kind === 283 /* SyntaxKind.JsxOpeningElement */ || + parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || + parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return parent.tagName === node; } return false; @@ -16437,53 +16367,54 @@ var ts; case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 221 /* SyntaxKind.BinaryExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 223 /* SyntaxKind.TemplateExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 224 /* SyntaxKind.YieldExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 225 /* SyntaxKind.TemplateExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 226 /* SyntaxKind.YieldExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 233 /* SyntaxKind.MetaProperty */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return !ts.isHeritageClause(node.parent); - case 161 /* SyntaxKind.QualifiedName */: - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + case 163 /* SyntaxKind.QualifiedName */: + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); - case 311 /* SyntaxKind.JSDocMemberName */: + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + case 314 /* SyntaxKind.JSDocMemberName */: while (ts.isJSDocMemberName(node.parent)) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); case 80 /* SyntaxKind.PrivateIdentifier */: return ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; case 79 /* SyntaxKind.Identifier */: - if (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { + if (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { return true; } // falls through @@ -16501,60 +16432,62 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: return parent.initializer === node; - case 238 /* SyntaxKind.ExpressionStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 251 /* SyntaxKind.ThrowStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 254 /* SyntaxKind.ThrowStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forInStatement.expression === node; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return node === parent.expression; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node === parent.expression; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return node === parent.expression; - case 165 /* SyntaxKind.Decorator */: - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 167 /* SyntaxKind.Decorator */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 301 /* SyntaxKind.SpreadAssignment */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return parent.expression === node && !isPartOfTypeNode(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return parent.objectAssignmentInitializer === node; + case 235 /* SyntaxKind.SatisfiesExpression */: + return node === parent.expression; default: return isExpressionNode(parent); } } ts.isInExpressionContext = isInExpressionContext; function isPartOfTypeQuery(node) { - while (node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { + while (node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { node = node.parent; } - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isPartOfTypeQuery = isPartOfTypeQuery; function isNamespaceReexportDeclaration(node) { @@ -16562,7 +16495,7 @@ var ts; } ts.isNamespaceReexportDeclaration = isNamespaceReexportDeclaration; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -16575,7 +16508,7 @@ var ts; } ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJS(file) { @@ -16607,11 +16540,11 @@ var ts; ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && - (node.typeArguments[0].kind === 150 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */); + (node.typeArguments[0].kind === 152 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */); } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, requireStringLiteralLikeArgument) { - if (callExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (callExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -16720,11 +16653,11 @@ var ts; function getExpandoInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 213 /* SyntaxKind.FunctionExpression */ || e.kind === 214 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; + return e.kind === 215 /* SyntaxKind.FunctionExpression */ || e.kind === 216 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; } - if (initializer.kind === 213 /* SyntaxKind.FunctionExpression */ || - initializer.kind === 226 /* SyntaxKind.ClassExpression */ || - initializer.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (initializer.kind === 215 /* SyntaxKind.FunctionExpression */ || + initializer.kind === 228 /* SyntaxKind.ClassExpression */ || + initializer.kind === 216 /* SyntaxKind.ArrowFunction */) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -16970,7 +16903,7 @@ var ts; ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJSFile(expr) && - expr.parent && expr.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + expr.parent && expr.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && (!ts.isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!ts.getJSDocTypeTag(expr.parent); } @@ -16991,17 +16924,17 @@ var ts; return false; } var decl = symbol.valueDeclaration; - return decl.kind === 256 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); + return decl.kind === 259 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); } ts.isFunctionSymbol = isFunctionSymbol; function tryGetModuleSpecifierFromDeclaration(node) { var _a, _b; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0]; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike); default: ts.Debug.assertNever(node); @@ -17014,14 +16947,14 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function tryGetImportFromModuleSpecifier(node) { switch (node.parent.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.parent; - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return node.parent.parent; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return isImportCall(node.parent) || isRequireCall(node.parent, /*checkArg*/ false) ? node.parent : undefined; - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: ts.Debug.assert(ts.isStringLiteral(node)); return ts.tryCast(node.parent.parent, ts.isImportTypeNode); default: @@ -17031,16 +16964,16 @@ var ts; ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; - case 200 /* SyntaxKind.ImportType */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + return node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 202 /* SyntaxKind.ImportType */: return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return node.arguments[0]; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node.name.kind === 10 /* SyntaxKind.StringLiteral */ ? node.name : undefined; default: return ts.Debug.assertNever(node); @@ -17049,11 +16982,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.exportClause && ts.tryCast(node.exportClause, ts.isNamespaceExport); default: return ts.Debug.assertNever(node); @@ -17061,7 +16994,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function forEachImportClauseDeclaration(node, action) { @@ -17082,13 +17015,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return node.questionToken !== undefined; } } @@ -17102,7 +17035,7 @@ var ts; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function isJSDocTypeAlias(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 338 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 341 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocTypeAlias = isJSDocTypeAlias; function isTypeAlias(node) { @@ -17127,12 +17060,12 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return node.initializer; } } @@ -17144,7 +17077,7 @@ var ts; function getNestedModuleDeclaration(node) { return ts.isModuleDeclaration(node) && node.body && - node.body.kind === 261 /* SyntaxKind.ModuleDeclaration */ + node.body.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? node.body : undefined; } @@ -17159,11 +17092,11 @@ var ts; if (ts.hasJSDocNodes(node)) { result = ts.addRange(result, filterOwnedJSDocTags(hostNode, ts.last(node.jsDoc))); } - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocParameterTagsNoCache : ts.getJSDocParameterTags)(node)); break; } - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocTypeParameterTagsNoCache : ts.getJSDocTypeParameterTags)(node)); break; } @@ -17192,11 +17125,11 @@ var ts; } function getNextJSDocCommentLocation(node) { var parent = node.parent; - if (parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - parent.kind === 271 /* SyntaxKind.ExportAssignment */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 247 /* SyntaxKind.ReturnStatement */ || + if (parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + parent.kind === 274 /* SyntaxKind.ExportAssignment */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 250 /* SyntaxKind.ReturnStatement */ || getNestedModuleDeclaration(parent) || ts.isBinaryExpression(node) && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return parent; @@ -17306,34 +17239,34 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 63 /* SyntaxKind.EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* AssignmentKind.Definite */ : 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 45 /* SyntaxKind.PlusPlusToken */ || unaryOperator === 46 /* SyntaxKind.MinusMinusToken */ ? 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return parent.initializer === node ? 1 /* AssignmentKind.Definite */ : 0 /* AssignmentKind.None */; - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 232 /* SyntaxKind.NonNullExpression */: node = parent; break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: node = parent.parent; break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* AssignmentKind.None */; } node = parent.parent; break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (parent.name === node) { return 0 /* AssignmentKind.None */; } @@ -17360,22 +17293,22 @@ var ts; */ function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 237 /* SyntaxKind.VariableStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 238 /* SyntaxKind.Block */: + case 240 /* SyntaxKind.VariableStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return true; } return false; @@ -17392,11 +17325,11 @@ var ts; return node; } function walkUpParenthesizedTypes(node) { - return walkUp(node, 191 /* SyntaxKind.ParenthesizedType */); + return walkUp(node, 193 /* SyntaxKind.ParenthesizedType */); } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 212 /* SyntaxKind.ParenthesizedExpression */); + return walkUp(node, 214 /* SyntaxKind.ParenthesizedExpression */); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; /** @@ -17406,7 +17339,7 @@ var ts; */ function walkUpParenthesizedTypesAndGetParentAndChild(node) { var child; - while (node && node.kind === 191 /* SyntaxKind.ParenthesizedType */) { + while (node && node.kind === 193 /* SyntaxKind.ParenthesizedType */) { child = node; node = node.parent; } @@ -17428,11 +17361,11 @@ var ts; ts.skipParentheses = skipParentheses; // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped function isDeleteTarget(node) { - if (node.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 207 /* SyntaxKind.ElementAccessExpression */) { + if (node.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 209 /* SyntaxKind.ElementAccessExpression */) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node && node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -17485,7 +17418,7 @@ var ts; ts.getDeclarationFromName = getDeclarationFromName; function isLiteralComputedPropertyDeclarationName(node) { return isStringOrNumericLiteralLike(node) && - node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */ && + node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */ && ts.isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; @@ -17493,29 +17426,29 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: // Name on right hand side of dot in a type query or type reference return parent.right === node; - case 203 /* SyntaxKind.BindingElement */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 275 /* SyntaxKind.ExportSpecifier */: - case 285 /* SyntaxKind.JsxAttribute */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 288 /* SyntaxKind.JsxAttribute */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: // Any name in an export specifier or JSX Attribute or Jsx Element return true; } @@ -17538,14 +17471,14 @@ var ts; // const x = require("...").y // const { x } = require("...").y function isAliasSymbolDeclaration(node) { - if (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name || - node.kind === 268 /* SyntaxKind.NamespaceImport */ || - node.kind === 274 /* SyntaxKind.NamespaceExport */ || - node.kind === 270 /* SyntaxKind.ImportSpecifier */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { + if (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name || + node.kind === 271 /* SyntaxKind.NamespaceImport */ || + node.kind === 277 /* SyntaxKind.NamespaceExport */ || + node.kind === 273 /* SyntaxKind.ImportSpecifier */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { return true; } return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && exportAssignmentIsAlias(node) || @@ -17558,18 +17491,18 @@ var ts; ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getAliasDeclarationFromName(node) { switch (node.parent.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 271 /* SyntaxKind.ExportAssignment */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 274 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.parent; - } while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */); + } while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */); return getAliasDeclarationFromName(node); } } @@ -17588,7 +17521,7 @@ var ts; } ts.getExportAssignmentExpression = getExportAssignmentExpression; function getPropertyAssignmentAliasLikeExpression(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.initializer : + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.initializer : node.parent.right; } ts.getPropertyAssignmentAliasLikeExpression = getPropertyAssignmentAliasLikeExpression; @@ -17654,11 +17587,11 @@ var ts; } ts.getAncestor = getAncestor; function isKeyword(token) { - return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 160 /* SyntaxKind.LastKeyword */; + return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 162 /* SyntaxKind.LastKeyword */; } ts.isKeyword = isKeyword; function isContextualKeyword(token) { - return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 160 /* SyntaxKind.LastContextualKeyword */; + return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 162 /* SyntaxKind.LastContextualKeyword */; } ts.isContextualKeyword = isContextualKeyword; function isNonContextualKeyword(token) { @@ -17702,15 +17635,15 @@ var ts; } var flags = 0 /* FunctionFlags.Normal */; switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { flags |= 1 /* FunctionFlags.Generator */; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: - if (hasSyntacticModifier(node, 256 /* ModifierFlags.Async */)) { + case 216 /* SyntaxKind.ArrowFunction */: + if (hasSyntacticModifier(node, 512 /* ModifierFlags.Async */)) { flags |= 2 /* FunctionFlags.Async */; } break; @@ -17723,13 +17656,13 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return node.body !== undefined && node.asteriskToken === undefined - && hasSyntacticModifier(node, 256 /* ModifierFlags.Async */); + && hasSyntacticModifier(node, 512 /* ModifierFlags.Async */); } return false; } @@ -17756,7 +17689,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - if (!(name.kind === 162 /* SyntaxKind.ComputedPropertyName */ || name.kind === 207 /* SyntaxKind.ElementAccessExpression */)) { + if (!(name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || name.kind === 209 /* SyntaxKind.ElementAccessExpression */)) { return false; } var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression; @@ -17772,7 +17705,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameExpression = name.expression; if (isStringOrNumericLiteralLike(nameExpression)) { return ts.escapeLeadingUnderscores(nameExpression.text); @@ -17838,11 +17771,11 @@ var ts; ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 164 /* SyntaxKind.Parameter */; + return root.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 203 /* SyntaxKind.BindingElement */) { + while (node.kind === 205 /* SyntaxKind.BindingElement */) { node = node.parent.parent; } return node; @@ -17850,15 +17783,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 305 /* SyntaxKind.SourceFile */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 308 /* SyntaxKind.SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -17877,23 +17810,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 0 /* Associativity.Left */ : 1 /* Associativity.Right */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 1 /* Associativity.Right */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operator) { case 42 /* SyntaxKind.AsteriskAsteriskToken */: case 63 /* SyntaxKind.EqualsToken */: @@ -17920,15 +17853,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expression.kind === 223 /* SyntaxKind.BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 220 /* SyntaxKind.PostfixUnaryExpression */) { + else if (expression.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 222 /* SyntaxKind.PostfixUnaryExpression */) { return expression.operator; } else { @@ -18107,15 +18040,15 @@ var ts; })(OperatorPrecedence = ts.OperatorPrecedence || (ts.OperatorPrecedence = {})); function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return 0 /* OperatorPrecedence.Comma */; - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return 1 /* OperatorPrecedence.Spread */; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 2 /* OperatorPrecedence.Yield */; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return 4 /* OperatorPrecedence.Conditional */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operatorKind) { case 27 /* SyntaxKind.CommaToken */: return 0 /* OperatorPrecedence.Comma */; @@ -18140,26 +18073,27 @@ var ts; return getBinaryOperatorPrecedence(operatorKind); } // TODO: Should prefix `++` and `--` be moved to the `Update` precedence? - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return 16 /* OperatorPrecedence.Unary */; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return 17 /* OperatorPrecedence.Update */; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return 18 /* OperatorPrecedence.LeftHandSide */; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 19 /* OperatorPrecedence.Member */ : 18 /* OperatorPrecedence.LeftHandSide */; - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 233 /* SyntaxKind.MetaProperty */: return 19 /* OperatorPrecedence.Member */; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return 11 /* OperatorPrecedence.Relational */; case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: @@ -18171,19 +18105,19 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 225 /* SyntaxKind.TemplateExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: return 20 /* OperatorPrecedence.Primary */; default: return -1 /* OperatorPrecedence.Invalid */; @@ -18215,7 +18149,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: return 11 /* OperatorPrecedence.Relational */; case 47 /* SyntaxKind.LessThanLessThanToken */: case 48 /* SyntaxKind.GreaterThanGreaterThanToken */: @@ -18239,7 +18174,7 @@ var ts; function getSemanticJsxChildren(children) { return ts.filter(children, function (i) { switch (i.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !!i.expression; case 11 /* SyntaxKind.JsxText */: return !i.containsOnlyTriviaWhiteSpaces; @@ -18295,7 +18230,7 @@ var ts; } diagnostics = nonFileDiagnostics; } - ts.insertSorted(diagnostics, diagnostic, compareDiagnostics); + ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation); } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -18831,7 +18766,7 @@ var ts; while (ts.isQualifiedName(node.parent) && node.parent.left === node) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */; + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isThisInTypeQuery = isThisInTypeQuery; function identifierIsThisKeyword(id) { @@ -18846,10 +18781,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { + if (accessor.kind === 174 /* SyntaxKind.GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { setAccessor = accessor; } else { @@ -18869,10 +18804,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 172 /* SyntaxKind.GetAccessor */ && !getAccessor) { + if (member.kind === 174 /* SyntaxKind.GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && !setAccessor) { + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -18921,7 +18856,7 @@ var ts; ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations; /** template tags are only available when a typedef isn't already using them */ function isNonTypeAliasTemplate(tag) { - return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 320 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); + return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 323 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); } /** * Gets the effective type annotation of the value parameter of a set accessor. If the node @@ -19154,13 +19089,17 @@ var ts; } ts.hasOverrideModifier = hasOverrideModifier; function hasAbstractModifier(node) { - return hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + return hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); } ts.hasAbstractModifier = hasAbstractModifier; function hasAmbientModifier(node) { return hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); } ts.hasAmbientModifier = hasAmbientModifier; + function hasAccessorModifier(node) { + return hasSyntacticModifier(node, 128 /* ModifierFlags.Accessor */); + } + ts.hasAccessorModifier = hasAccessorModifier; function hasEffectiveReadonlyModifier(node) { return hasEffectiveModifier(node, 64 /* ModifierFlags.Readonly */); } @@ -19178,7 +19117,7 @@ var ts; } ts.getSelectedSyntacticModifierFlags = getSelectedSyntacticModifierFlags; function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) { - if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 162 /* SyntaxKind.LastToken */) { return 0 /* ModifierFlags.None */; } if (!(node.modifierFlagsCache & 536870912 /* ModifierFlags.HasComputedFlags */)) { @@ -19270,25 +19209,22 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: return 4 /* ModifierFlags.Public */; case 122 /* SyntaxKind.ProtectedKeyword */: return 16 /* ModifierFlags.Protected */; case 121 /* SyntaxKind.PrivateKeyword */: return 8 /* ModifierFlags.Private */; - case 126 /* SyntaxKind.AbstractKeyword */: return 128 /* ModifierFlags.Abstract */; + case 126 /* SyntaxKind.AbstractKeyword */: return 256 /* ModifierFlags.Abstract */; + case 127 /* SyntaxKind.AccessorKeyword */: return 128 /* ModifierFlags.Accessor */; case 93 /* SyntaxKind.ExportKeyword */: return 1 /* ModifierFlags.Export */; - case 135 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; + case 136 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; case 85 /* SyntaxKind.ConstKeyword */: return 2048 /* ModifierFlags.Const */; - case 88 /* SyntaxKind.DefaultKeyword */: return 512 /* ModifierFlags.Default */; - case 131 /* SyntaxKind.AsyncKeyword */: return 256 /* ModifierFlags.Async */; - case 145 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; - case 159 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; + case 88 /* SyntaxKind.DefaultKeyword */: return 1024 /* ModifierFlags.Default */; + case 132 /* SyntaxKind.AsyncKeyword */: return 512 /* ModifierFlags.Async */; + case 146 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; + case 161 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; case 101 /* SyntaxKind.InKeyword */: return 32768 /* ModifierFlags.In */; - case 144 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; - case 165 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; + case 145 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; + case 167 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; } return 0 /* ModifierFlags.None */; } ts.modifierToFlag = modifierToFlag; - function createModifiers(modifierFlags) { - return modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; - } - ts.createModifiers = createModifiers; function isLogicalOperator(token) { return token === 56 /* SyntaxKind.BarBarToken */ || token === 55 /* SyntaxKind.AmpersandAmpersandToken */ @@ -19338,8 +19274,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 205 /* SyntaxKind.ObjectLiteralExpression */ - || kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return kind === 207 /* SyntaxKind.ObjectLiteralExpression */ + || kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } return false; } @@ -19356,12 +19292,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 79 /* SyntaxKind.Identifier */); @@ -19373,9 +19309,9 @@ var ts; return node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 108 /* SyntaxKind.ThisKeyword */ || node.kind === 106 /* SyntaxKind.SuperKeyword */ - || node.kind === 231 /* SyntaxKind.MetaProperty */ - || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) - || node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); + || node.kind === 233 /* SyntaxKind.MetaProperty */ + || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) + || node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); } ts.isDottedName = isDottedName; function isPropertyAccessEntityNameExpression(node) { @@ -19406,8 +19342,8 @@ var ts; } ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isRightSideOfAccessExpression(node) { @@ -19422,12 +19358,12 @@ var ts; } ts.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName = isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName; function isEmptyObjectLiteral(expression) { - return expression.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + return expression.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && + return expression.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -19443,7 +19379,7 @@ var ts; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function isExportDefaultSymbol(symbol) { - return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 512 /* ModifierFlags.Default */); + return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 1024 /* ModifierFlags.Default */); } /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ function tryExtractTSExtension(fileName) { @@ -19588,21 +19524,17 @@ var ts; return getStringFromExpandedCharCodes(expandedCharCodes); } ts.base64decode = base64decode; + function readJsonOrUndefined(path, hostOrText) { + var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path); + if (!jsonText) + return undefined; + // gracefully handle if readFile fails or returns not JSON + var result = ts.parseConfigFileTextToJson(path, jsonText); + return !result.error ? result.config : undefined; + } + ts.readJsonOrUndefined = readJsonOrUndefined; function readJson(path, host) { - try { - var jsonText = host.readFile(path); - if (!jsonText) - return {}; - var result = ts.parseConfigFileTextToJson(path, jsonText); - if (result.error) { - return {}; - } - return result.config; - } - catch (e) { - // gracefully handle if readFile fails or returns not JSON - return {}; - } + return readJsonOrUndefined(path, host) || {}; } ts.readJson = readJson; function directoryProbablyExists(directoryName, host) { @@ -19761,8 +19693,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -19778,7 +19710,7 @@ var ts; } function isWatchSet(options) { // Firefox has Object.prototype.watch - return options.watch && options.hasOwnProperty("watch"); + return options.watch && ts.hasProperty(options, "watch"); } ts.isWatchSet = isWatchSet; function closeFileWatcher(watcher) { @@ -19842,35 +19774,35 @@ var ts; if (!parent) return 0 /* AccessKind.Read */; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return accessKind(parent); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var operator = parent.operator; return operator === 45 /* SyntaxKind.PlusPlusToken */ || operator === 46 /* SyntaxKind.MinusMinusToken */ ? writeOrReadWrite() : 0 /* AccessKind.Read */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ ? 1 /* AccessKind.Write */ : writeOrReadWrite() : 0 /* AccessKind.Read */; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node ? 0 /* AccessKind.Read */ : accessKind(parent); - case 296 /* SyntaxKind.PropertyAssignment */: { + case 299 /* SyntaxKind.PropertyAssignment */: { var parentAccess = accessKind(parent.parent); // In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write. return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess; } - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals. return node === parent.objectAssignmentInitializer ? 0 /* AccessKind.Read */ : accessKind(parent.parent); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return accessKind(parent); default: return 0 /* AccessKind.Read */; } function writeOrReadWrite() { // If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect. - return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 238 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; + return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 241 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; } } function reverseAccessKind(a) { @@ -19952,7 +19884,7 @@ var ts; function isAbstractConstructorSymbol(symbol) { if (symbol.flags & 32 /* SymbolFlags.Class */) { var declaration = getClassLikeDeclarationOfSymbol(symbol); - return !!declaration && hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + return !!declaration && hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); } return false; } @@ -20014,37 +19946,37 @@ var ts; } ts.isObjectTypeDeclaration = isObjectTypeDeclaration; function isTypeNodeKind(kind) { - return (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) - || kind === 130 /* SyntaxKind.AnyKeyword */ - || kind === 155 /* SyntaxKind.UnknownKeyword */ - || kind === 147 /* SyntaxKind.NumberKeyword */ - || kind === 158 /* SyntaxKind.BigIntKeyword */ - || kind === 148 /* SyntaxKind.ObjectKeyword */ - || kind === 133 /* SyntaxKind.BooleanKeyword */ - || kind === 150 /* SyntaxKind.StringKeyword */ - || kind === 151 /* SyntaxKind.SymbolKeyword */ + return (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) + || kind === 131 /* SyntaxKind.AnyKeyword */ + || kind === 157 /* SyntaxKind.UnknownKeyword */ + || kind === 148 /* SyntaxKind.NumberKeyword */ + || kind === 160 /* SyntaxKind.BigIntKeyword */ + || kind === 149 /* SyntaxKind.ObjectKeyword */ + || kind === 134 /* SyntaxKind.BooleanKeyword */ + || kind === 152 /* SyntaxKind.StringKeyword */ + || kind === 153 /* SyntaxKind.SymbolKeyword */ || kind === 114 /* SyntaxKind.VoidKeyword */ - || kind === 153 /* SyntaxKind.UndefinedKeyword */ - || kind === 143 /* SyntaxKind.NeverKeyword */ - || kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ - || kind === 312 /* SyntaxKind.JSDocAllType */ - || kind === 313 /* SyntaxKind.JSDocUnknownType */ - || kind === 314 /* SyntaxKind.JSDocNullableType */ - || kind === 315 /* SyntaxKind.JSDocNonNullableType */ - || kind === 316 /* SyntaxKind.JSDocOptionalType */ - || kind === 317 /* SyntaxKind.JSDocFunctionType */ - || kind === 318 /* SyntaxKind.JSDocVariadicType */; + || kind === 155 /* SyntaxKind.UndefinedKeyword */ + || kind === 144 /* SyntaxKind.NeverKeyword */ + || kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ + || kind === 315 /* SyntaxKind.JSDocAllType */ + || kind === 316 /* SyntaxKind.JSDocUnknownType */ + || kind === 317 /* SyntaxKind.JSDocNullableType */ + || kind === 318 /* SyntaxKind.JSDocNonNullableType */ + || kind === 319 /* SyntaxKind.JSDocOptionalType */ + || kind === 320 /* SyntaxKind.JSDocFunctionType */ + || kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isTypeNodeKind = isTypeNodeKind; function isAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isAccessExpression = isAccessExpression; function getNameOfAccessExpression(node) { - if (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { return node.name; } - ts.Debug.assert(node.kind === 207 /* SyntaxKind.ElementAccessExpression */); + ts.Debug.assert(node.kind === 209 /* SyntaxKind.ElementAccessExpression */); return node.argumentExpression; } ts.getNameOfAccessExpression = getNameOfAccessExpression; @@ -20059,7 +19991,7 @@ var ts; } ts.isBundleFileTextLike = isBundleFileTextLike; function isNamedImportsOrExports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 272 /* SyntaxKind.NamedImports */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedImportsOrExports = isNamedImportsOrExports; function getLeftmostAccessExpression(expr) { @@ -20074,13 +20006,13 @@ var ts; return walkAccessExpression(name.parent); } function walkAccessExpression(access) { - if (access.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (access.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var res = action(access.name); if (res !== undefined) { return res; } } - else if (access.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + else if (access.kind === 209 /* SyntaxKind.ElementAccessExpression */) { if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) { var res = action(access.argumentExpression); if (res !== undefined) { @@ -20107,28 +20039,29 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: node = node.operand; continue; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: node = node.left; continue; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: node = node.condition; continue; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: node = node.tag; continue; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (stopAtCallExpressions) { return node; } // falls through - case 229 /* SyntaxKind.AsExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: node = node.expression; continue; } @@ -21364,17 +21297,17 @@ var ts; return ts.isIdentifier(useSite) && ts.isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite; } function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { - while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } - if (hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */)) { + if (hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */)) { return true; } var containerKind = node.parent.parent.kind; - return containerKind === 258 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 182 /* SyntaxKind.TypeLiteral */; + return containerKind === 261 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 184 /* SyntaxKind.TypeLiteral */; } /** Returns true for an identifier in 1) an `implements` clause, and 2) an `extends` clause of an interface. */ function isIdentifierInNonEmittingHeritageClause(node) { @@ -21382,16 +21315,16 @@ var ts; return false; var heritageClause = ts.findAncestor(node.parent, function (parent) { switch (parent.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return false; default: return "quit"; } }); - return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 258 /* SyntaxKind.InterfaceDeclaration */; + return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 261 /* SyntaxKind.InterfaceDeclaration */; } function isIdentifierTypeReference(node) { return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName); @@ -21552,22 +21485,22 @@ var ts; if (!node.parent) return undefined; switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: var parent_1 = node.parent; - return parent_1.kind === 190 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; - case 164 /* SyntaxKind.Parameter */: + return parent_1.kind === 192 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; + case 166 /* SyntaxKind.Parameter */: return node.parent.parameters; - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return node.parent.templateSpans; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node.parent.templateSpans; - case 165 /* SyntaxKind.Decorator */: { + case 167 /* SyntaxKind.Decorator */: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return node.parent.heritageClauses; } var parent = node.parent; @@ -21575,45 +21508,45 @@ var ts; return ts.isJSDocTypeLiteral(node.parent) ? undefined : node.parent.tags; } switch (parent.kind) { - case 182 /* SyntaxKind.TypeLiteral */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.isTypeElement(node) ? parent.members : undefined; - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return parent.types; - case 184 /* SyntaxKind.TupleType */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 186 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return parent.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 286 /* SyntaxKind.JsxAttributes */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 289 /* SyntaxKind.JsxAttributes */: return parent.properties; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.isTypeNode(node) ? parent.typeArguments : parent.expression === node ? undefined : parent.arguments; - case 278 /* SyntaxKind.JsxElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 285 /* SyntaxKind.JsxFragment */: return ts.isJsxChild(node) ? parent.children : undefined; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return ts.isTypeNode(node) ? parent.typeArguments : undefined; - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: return parent.statements; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return parent.clauses; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.isClassElement(node) ? parent.members : undefined; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.isEnumMember(node) ? parent.members : undefined; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return parent.statements; } } @@ -21625,7 +21558,7 @@ var ts; if (ts.some(node.parameters, function (p) { return !getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { // If the first parameter is not an explicit 'this' parameter, then the function has // an implicit 'this' parameter which is subject to contextual typing. var parameter = ts.firstOrUndefined(node.parameters); @@ -21643,7 +21576,7 @@ var ts; } ts.isInfinityOrNaNString = isInfinityOrNaNString; function isCatchClauseVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function isParameterOrCatchClauseVariable(symbol) { @@ -21652,7 +21585,7 @@ var ts; } ts.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable; function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */ || node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */ || node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction; function escapeSnippetText(text) { @@ -21749,9 +21682,35 @@ var ts; ts.getNodeModulePathParts = getNodeModulePathParts; function getParameterTypeNode(parameter) { var _a; - return parameter.kind === 340 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; + return parameter.kind === 343 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; } ts.getParameterTypeNode = getParameterTypeNode; + function isTypeDeclaration(node) { + switch (node.kind) { + case 165 /* SyntaxKind.TypeParameter */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + return true; + case 270 /* SyntaxKind.ImportClause */: + return node.isTypeOnly; + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: + return node.parent.parent.isTypeOnly; + default: + return false; + } + } + ts.isTypeDeclaration = isTypeDeclaration; + function canHaveExportModifier(node) { + return ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) + || ts.isInterfaceDeclaration(node) || isTypeDeclaration(node) || (ts.isModuleDeclaration(node) && !isExternalModuleAugmentation(node) && !isGlobalScopeAugmentation(node)); + } + ts.canHaveExportModifier = canHaveExportModifier; })(ts || (ts = {})); /* @internal */ var ts; @@ -21760,13 +21719,11 @@ var ts; * Creates a `BaseNodeFactory` which can be used to create `Node` instances from the constructors provided by the object allocator. */ function createBaseNodeFactory() { - // tslint:disable variable-name var NodeConstructor; var TokenConstructor; var IdentifierConstructor; var PrivateIdentifierConstructor; var SourceFileConstructor; - // tslint:enable variable-name return { createBaseSourceFileNode: createBaseSourceFileNode, createBaseIdentifierNode: createBaseIdentifierNode, @@ -21874,10 +21831,10 @@ var ts; // // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve // the intended order of operations: `(a ** b) ** c` - var binaryOperatorPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(221 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(223 /* SyntaxKind.BinaryExpression */, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); - if (!isLeftSideOfBinary && operand.kind === 214 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { + if (!isLeftSideOfBinary && operand.kind === 216 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { // We need to parenthesize arrow functions on the right side to avoid it being // parsed as parenthesized expression: `a && (() => {})` return true; @@ -21889,7 +21846,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Associativity.Right */ - && operand.kind === 224 /* SyntaxKind.YieldExpression */) { + && operand.kind === 226 /* SyntaxKind.YieldExpression */) { return false; } return true; @@ -21958,13 +21915,15 @@ var ts; // (a|b)|c -> a|(b|c) -> a|b|c // (a&b)&c -> a&(b&c) -> a&b&c // (a^b)^c -> a^(b^c) -> a^b^c + // (a,b),c -> a,(b,c) -> a,b,c // // While addition is associative in mathematics, JavaScript's `+` is not // guaranteed to be associative as it is overloaded with string concatenation. return binaryOperator === 41 /* SyntaxKind.AsteriskToken */ || binaryOperator === 51 /* SyntaxKind.BarToken */ || binaryOperator === 50 /* SyntaxKind.AmpersandToken */ - || binaryOperator === 52 /* SyntaxKind.CaretToken */; + || binaryOperator === 52 /* SyntaxKind.CaretToken */ + || binaryOperator === 27 /* SyntaxKind.CommaToken */; } /** * This function determines whether an expression consists of a homogeneous set of @@ -21977,7 +21936,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -22003,7 +21962,7 @@ var ts; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = ts.skipPartiallyEmittedExpressions(operand); // If the resulting expression is already parenthesized, we do not need to do any further processing. - if (skipped.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (skipped.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -22020,7 +21979,7 @@ var ts; return ts.isCommaSequence(expression) ? factory.createParenthesizedExpression(expression) : expression; } function parenthesizeConditionOfConditionalExpression(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(222 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(224 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) !== 1 /* Comparison.GreaterThan */) { @@ -22053,8 +22012,8 @@ var ts; var needsParens = ts.isCommaSequence(check); if (!needsParens) { switch (ts.getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: needsParens = true; } } @@ -22067,9 +22026,9 @@ var ts; function parenthesizeExpressionOfNew(expression) { var leftmostExpr = ts.getLeftmostExpression(expression, /*stopAtCallExpressions*/ true); switch (leftmostExpr.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return factory.createParenthesizedExpression(expression); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return !leftmostExpr.arguments ? factory.createParenthesizedExpression(expression) : expression; // TODO(rbuckton): Verify this assertion holds @@ -22089,7 +22048,7 @@ var ts; // var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 209 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) + && (emittedExpression.kind !== 211 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) && (optionalChain || !ts.isOptionalChain(emittedExpression))) { // TODO(rbuckton): Verify whether this assertion holds. return expression; @@ -22112,7 +22071,7 @@ var ts; function parenthesizeExpressionForDisallowedComma(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } @@ -22121,21 +22080,21 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 213 /* SyntaxKind.FunctionExpression */ || kind === 214 /* SyntaxKind.ArrowFunction */) { + if (kind === 215 /* SyntaxKind.FunctionExpression */ || kind === 216 /* SyntaxKind.ArrowFunction */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. var updated = factory.updateCallExpression(emittedExpression, ts.setTextRange(factory.createParenthesizedExpression(callee), callee), emittedExpression.typeArguments, emittedExpression.arguments); return factory.restoreOuterExpressions(expression, updated, 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */); } } var leftmostExpressionKind = ts.getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind; - if (leftmostExpressionKind === 205 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 213 /* SyntaxKind.FunctionExpression */) { + if (leftmostExpressionKind === 207 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 215 /* SyntaxKind.FunctionExpression */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } return expression; } function parenthesizeConciseBodyOfArrowFunction(body) { - if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(body), body); } @@ -22153,16 +22112,16 @@ var ts; // - The true and false branch types (the second and third `Type` non-terminals, above) allow any type function parenthesizeCheckTypeOfConditionalType(checkType) { switch (checkType.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 189 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(checkType); } return checkType; } function parenthesizeExtendsTypeOfConditionalType(extendsType) { switch (extendsType.kind) { - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(extendsType); } return extendsType; @@ -22174,8 +22133,8 @@ var ts; // - A union type constituent has the same precedence as the check type of a conditional type function parenthesizeConstituentTypeOfUnionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 189 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeCheckTypeOfConditionalType(type); @@ -22190,8 +22149,8 @@ var ts; // - An intersection type constituent does not allow function, constructor, conditional, or union types (they must be parenthesized) function parenthesizeConstituentTypeOfIntersectionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfUnionType(type); @@ -22208,14 +22167,14 @@ var ts; // function parenthesizeOperandOfTypeOperator(type) { switch (type.kind) { - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfIntersectionType(type); } function parenthesizeOperandOfReadonlyTypeOperator(type) { switch (type.kind) { - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22235,9 +22194,9 @@ var ts; // function parenthesizeNonArrayTypeOfPostfixType(type) { switch (type.kind) { - case 190 /* SyntaxKind.InferType */: - case 193 /* SyntaxKind.TypeOperator */: - case 181 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 192 /* SyntaxKind.InferType */: + case 195 /* SyntaxKind.TypeOperator */: + case 183 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22431,11 +22390,11 @@ var ts; } function convertToAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -22529,6 +22488,8 @@ var ts; createUniqueName: createUniqueName, getGeneratedNameForNode: getGeneratedNameForNode, createPrivateIdentifier: createPrivateIdentifier, + createUniquePrivateName: createUniquePrivateName, + getGeneratedPrivateNameForNode: getGeneratedPrivateNameForNode, createToken: createToken, createSuper: createSuper, createThis: createThis, @@ -22691,6 +22652,8 @@ var ts; updateAsExpression: updateAsExpression, createNonNullExpression: createNonNullExpression, updateNonNullExpression: updateNonNullExpression, + createSatisfiesExpression: createSatisfiesExpression, + updateSatisfiesExpression: updateSatisfiesExpression, createNonNullChain: createNonNullChain, updateNonNullChain: updateNonNullChain, createMetaProperty: createMetaProperty, @@ -22788,18 +22751,18 @@ var ts; createExternalModuleReference: createExternalModuleReference, updateExternalModuleReference: updateExternalModuleReference, // lazily load factory members for JSDoc types with similar structure - get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312 /* SyntaxKind.JSDocAllType */); }, - get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313 /* SyntaxKind.JSDocUnknownType */); }, - get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, - get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, + get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(315 /* SyntaxKind.JSDocAllType */); }, + get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(316 /* SyntaxKind.JSDocUnknownType */); }, + get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, + get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, createJSDocFunctionType: createJSDocFunctionType, updateJSDocFunctionType: updateJSDocFunctionType, createJSDocTypeLiteral: createJSDocTypeLiteral, @@ -22835,30 +22798,30 @@ var ts; createJSDocLinkPlain: createJSDocLinkPlain, updateJSDocLinkPlain: updateJSDocLinkPlain, // lazily load factory members for JSDoc tags with similar structure - get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, - get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, + get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, + get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, createJSDocUnknownTag: createJSDocUnknownTag, updateJSDocUnknownTag: updateJSDocUnknownTag, createJSDocText: createJSDocText, @@ -23061,11 +23024,11 @@ var ts; // don't propagate child flags. if (name) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isIdentifier(name)) { node.transformFlags |= propagateIdentifierNameFlags(name); break; @@ -23214,23 +23177,29 @@ var ts; node.escapedText = ts.escapeLeadingUnderscores(text); return node; } - function createBaseGeneratedIdentifier(text, autoGenerateFlags) { + function createBaseGeneratedIdentifier(text, autoGenerateFlags, prefix, suffix) { var node = createBaseIdentifier(text, /*originalKeywordKind*/ undefined); node.autoGenerateFlags = autoGenerateFlags; node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; nextAutoGenerateId++; return node; } // @api - function createIdentifier(text, typeArguments, originalKeywordKind) { + function createIdentifier(text, typeArguments, originalKeywordKind, hasExtendedUnicodeEscape) { var node = createBaseIdentifier(text, originalKeywordKind); if (typeArguments) { // NOTE: we do not use `setChildren` here because typeArguments in an identifier do not contribute to transformations node.typeArguments = createNodeArray(typeArguments); } - if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { node.transformFlags |= 67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; } + if (hasExtendedUnicodeEscape) { + node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape; + node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; + } return node; } // @api @@ -23240,11 +23209,11 @@ var ts; : node; } // @api - function createTempVariable(recordTempVariable, reservedInNestedScopes) { + function createTempVariable(recordTempVariable, reservedInNestedScopes, prefix, suffix) { var flags = 1 /* GeneratedIdentifierFlags.Auto */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - var name = createBaseGeneratedIdentifier("", flags); + var name = createBaseGeneratedIdentifier("", flags, prefix, suffix); if (recordTempVariable) { recordTempVariable(name); } @@ -23256,34 +23225,69 @@ var ts; var flags = 2 /* GeneratedIdentifierFlags.Loop */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - return createBaseGeneratedIdentifier("", flags); + return createBaseGeneratedIdentifier("", flags, /*prefix*/ undefined, /*suffix*/ undefined); } /** Create a unique name based on the supplied text. */ // @api - function createUniqueName(text, flags) { + function createUniqueName(text, flags, prefix, suffix) { if (flags === void 0) { flags = 0 /* GeneratedIdentifierFlags.None */; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); ts.Debug.assert((flags & (16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */)) !== 32 /* GeneratedIdentifierFlags.FileLevel */, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"); - return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags); + return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags, prefix, suffix); } /** Create a unique name generated for a node. */ // @api - function getGeneratedNameForNode(node, flags) { + function getGeneratedNameForNode(node, flags, prefix, suffix) { if (flags === void 0) { flags = 0; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); - var name = createBaseGeneratedIdentifier(node && ts.isIdentifier(node) ? ts.idText(node) : "", 4 /* GeneratedIdentifierFlags.Node */ | flags); + var text = !node ? "" : + ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ false, prefix, node, suffix, ts.idText) : + "generated@".concat(ts.getNodeId(node)); + if (prefix || suffix) + flags |= 16 /* GeneratedIdentifierFlags.Optimistic */; + var name = createBaseGeneratedIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); name.original = node; return name; } + function createBasePrivateIdentifier(text) { + var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); + node.escapedText = ts.escapeLeadingUnderscores(text); + node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return node; + } // @api function createPrivateIdentifier(text) { if (!ts.startsWith(text, "#")) ts.Debug.fail("First character of private identifier must be #: " + text); - var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); - node.escapedText = ts.escapeLeadingUnderscores(text); - node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return createBasePrivateIdentifier(text); + } + function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags, prefix, suffix) { + var node = createBasePrivateIdentifier(text); + node.autoGenerateFlags = autoGenerateFlags; + node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; + nextAutoGenerateId++; return node; } + /** Create a unique name based on the supplied text. */ + // @api + function createUniquePrivateName(text, prefix, suffix) { + if (text && !ts.startsWith(text, "#")) + ts.Debug.fail("First character of private identifier must be #: " + text); + var autoGenerateFlags = 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */ | + (text ? 3 /* GeneratedIdentifierFlags.Unique */ : 1 /* GeneratedIdentifierFlags.Auto */); + return createBaseGeneratedPrivateIdentifier(text !== null && text !== void 0 ? text : "", autoGenerateFlags, prefix, suffix); + } + // @api + function getGeneratedPrivateNameForNode(node, prefix, suffix) { + var text = ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ true, prefix, node, suffix, ts.idText) : + "#generated@".concat(ts.getNodeId(node)); + var flags = prefix || suffix ? 16 /* GeneratedIdentifierFlags.Optimistic */ : 0 /* GeneratedIdentifierFlags.None */; + var name = createBaseGeneratedPrivateIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); + name.original = node; + return name; + } // // Punctuation // @@ -23291,14 +23295,14 @@ var ts; return baseFactory.createBaseTokenNode(kind); } function createToken(token) { - ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 160 /* SyntaxKind.LastToken */, "Invalid token"); + ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 162 /* SyntaxKind.LastToken */, "Invalid token"); ts.Debug.assert(token <= 14 /* SyntaxKind.FirstTemplateToken */ || token >= 17 /* SyntaxKind.LastTemplateToken */, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."); ts.Debug.assert(token <= 8 /* SyntaxKind.FirstLiteralToken */ || token >= 14 /* SyntaxKind.LastLiteralToken */, "Invalid token. Use 'createLiteralLikeNode' to create literals."); ts.Debug.assert(token !== 79 /* SyntaxKind.Identifier */, "Invalid token. Use 'createIdentifier' to create identifiers"); var node = createBaseToken(token); var transformFlags = 0 /* TransformFlags.None */; switch (token) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // 'async' modifier is ES2017 (async functions) or ES2018 (async generators) transformFlags = 256 /* TransformFlags.ContainsES2017 */ | @@ -23307,24 +23311,24 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. + case 157 /* SyntaxKind.UnknownKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. transformFlags = 1 /* TransformFlags.ContainsTypeScript */; break; case 106 /* SyntaxKind.SuperKeyword */: @@ -23333,6 +23337,9 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: transformFlags = 1024 /* TransformFlags.ContainsES2015 */; break; + case 127 /* SyntaxKind.AccessorKeyword */: + transformFlags = 16777216 /* TransformFlags.ContainsClassFields */; + break; case 108 /* SyntaxKind.ThisKeyword */: // 'this' indicates a lexical 'this' transformFlags = 16384 /* TransformFlags.ContainsLexicalThis */; @@ -23379,8 +23386,8 @@ var ts; if (flags & 1 /* ModifierFlags.Export */) result.push(createModifier(93 /* SyntaxKind.ExportKeyword */)); if (flags & 2 /* ModifierFlags.Ambient */) - result.push(createModifier(135 /* SyntaxKind.DeclareKeyword */)); - if (flags & 512 /* ModifierFlags.Default */) + result.push(createModifier(136 /* SyntaxKind.DeclareKeyword */)); + if (flags & 1024 /* ModifierFlags.Default */) result.push(createModifier(88 /* SyntaxKind.DefaultKeyword */)); if (flags & 2048 /* ModifierFlags.Const */) result.push(createModifier(85 /* SyntaxKind.ConstKeyword */)); @@ -23390,20 +23397,22 @@ var ts; result.push(createModifier(121 /* SyntaxKind.PrivateKeyword */)); if (flags & 16 /* ModifierFlags.Protected */) result.push(createModifier(122 /* SyntaxKind.ProtectedKeyword */)); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push(createModifier(126 /* SyntaxKind.AbstractKeyword */)); if (flags & 32 /* ModifierFlags.Static */) result.push(createModifier(124 /* SyntaxKind.StaticKeyword */)); if (flags & 16384 /* ModifierFlags.Override */) - result.push(createModifier(159 /* SyntaxKind.OverrideKeyword */)); + result.push(createModifier(161 /* SyntaxKind.OverrideKeyword */)); if (flags & 64 /* ModifierFlags.Readonly */) - result.push(createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); - if (flags & 256 /* ModifierFlags.Async */) - result.push(createModifier(131 /* SyntaxKind.AsyncKeyword */)); + result.push(createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); + if (flags & 128 /* ModifierFlags.Accessor */) + result.push(createModifier(127 /* SyntaxKind.AccessorKeyword */)); + if (flags & 512 /* ModifierFlags.Async */) + result.push(createModifier(132 /* SyntaxKind.AsyncKeyword */)); if (flags & 32768 /* ModifierFlags.In */) result.push(createModifier(101 /* SyntaxKind.InKeyword */)); if (flags & 65536 /* ModifierFlags.Out */) - result.push(createModifier(144 /* SyntaxKind.OutKeyword */)); + result.push(createModifier(145 /* SyntaxKind.OutKeyword */)); return result.length ? result : undefined; } // @@ -23411,7 +23420,7 @@ var ts; // // @api function createQualifiedName(left, right) { - var node = createBaseNode(161 /* SyntaxKind.QualifiedName */); + var node = createBaseNode(163 /* SyntaxKind.QualifiedName */); node.left = left; node.right = asName(right); node.transformFlags |= @@ -23428,7 +23437,7 @@ var ts; } // @api function createComputedPropertyName(expression) { - var node = createBaseNode(162 /* SyntaxKind.ComputedPropertyName */); + var node = createBaseNode(164 /* SyntaxKind.ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23447,7 +23456,7 @@ var ts; // // @api function createTypeParameterDeclaration(modifiers, name, constraint, defaultType) { - var node = createBaseNamedDeclaration(163 /* SyntaxKind.TypeParameter */, modifiers, name); + var node = createBaseNamedDeclaration(165 /* SyntaxKind.TypeParameter */, modifiers, name); node.constraint = constraint; node.default = defaultType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23464,7 +23473,7 @@ var ts; } // @api function createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(164 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + var node = createBaseVariableLikeDeclaration(166 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.dotDotDotToken = dotDotDotToken; node.questionToken = questionToken; if (ts.isThisIdentifier(node.name)) { @@ -23496,7 +23505,7 @@ var ts; } // @api function createDecorator(expression) { - var node = createBaseNode(165 /* SyntaxKind.Decorator */); + var node = createBaseNode(167 /* SyntaxKind.Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23516,7 +23525,7 @@ var ts; // // @api function createPropertySignature(modifiers, name, questionToken, type) { - var node = createBaseNamedDeclaration(166 /* SyntaxKind.PropertySignature */, modifiers, name); + var node = createBaseNamedDeclaration(168 /* SyntaxKind.PropertySignature */, modifiers, name); node.type = type; node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23542,7 +23551,7 @@ var ts; } // @api function createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(167 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); + var node = createBaseVariableLikeDeclaration(169 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); node.questionToken = questionOrExclamationToken && ts.isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= @@ -23570,7 +23579,7 @@ var ts; } // @api function createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(168 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(170 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23588,7 +23597,7 @@ var ts; } // @api function createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(169 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.questionToken = questionToken; node.transformFlags |= @@ -23598,7 +23607,7 @@ var ts; if (questionToken) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -23634,7 +23643,7 @@ var ts; } // @api function createClassStaticBlockDeclaration(body) { - var node = createBaseGenericNamedDeclaration(170 /* SyntaxKind.ClassStaticBlockDeclaration */, + var node = createBaseGenericNamedDeclaration(172 /* SyntaxKind.ClassStaticBlockDeclaration */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined); @@ -23660,7 +23669,7 @@ var ts; } // @api function createConstructorDeclaration(modifiers, parameters, body) { - var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.Constructor */, modifiers, + var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.Constructor */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); @@ -23689,7 +23698,7 @@ var ts; } // @api function createGetAccessorDeclaration(modifiers, name, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(172 /* SyntaxKind.GetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(174 /* SyntaxKind.GetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, type, body); // The following properties are used only to report grammar errors node.typeParameters = undefined; @@ -23713,7 +23722,7 @@ var ts; } // @api function createSetAccessorDeclaration(modifiers, name, parameters, body) { - var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.SetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(175 /* SyntaxKind.SetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); // The following properties are used only to report grammar errors @@ -23739,7 +23748,7 @@ var ts; } // @api function createCallSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(174 /* SyntaxKind.CallSignature */, + var node = createBaseSignatureDeclaration(176 /* SyntaxKind.CallSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23755,7 +23764,7 @@ var ts; } // @api function createConstructSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(175 /* SyntaxKind.ConstructSignature */, + var node = createBaseSignatureDeclaration(177 /* SyntaxKind.ConstructSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23771,7 +23780,7 @@ var ts; } // @api function createIndexSignature(modifiers, parameters, type) { - var node = createBaseSignatureDeclaration(176 /* SyntaxKind.IndexSignature */, modifiers, + var node = createBaseSignatureDeclaration(178 /* SyntaxKind.IndexSignature */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23787,7 +23796,7 @@ var ts; } // @api function createTemplateLiteralTypeSpan(type, literal) { - var node = createBaseNode(199 /* SyntaxKind.TemplateLiteralTypeSpan */); + var node = createBaseNode(201 /* SyntaxKind.TemplateLiteralTypeSpan */); node.type = type; node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23809,7 +23818,7 @@ var ts; } // @api function createTypePredicateNode(assertsModifier, parameterName, type) { - var node = createBaseNode(177 /* SyntaxKind.TypePredicate */); + var node = createBaseNode(179 /* SyntaxKind.TypePredicate */); node.assertsModifier = assertsModifier; node.parameterName = asName(parameterName); node.type = type; @@ -23826,7 +23835,7 @@ var ts; } // @api function createTypeReferenceNode(typeName, typeArguments) { - var node = createBaseNode(178 /* SyntaxKind.TypeReference */); + var node = createBaseNode(180 /* SyntaxKind.TypeReference */); node.typeName = asName(typeName); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(createNodeArray(typeArguments)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23841,7 +23850,7 @@ var ts; } // @api function createFunctionTypeNode(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(179 /* SyntaxKind.FunctionType */, + var node = createBaseSignatureDeclaration(181 /* SyntaxKind.FunctionType */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23874,7 +23883,7 @@ var ts; ts.Debug.fail("Incorrect number of arguments specified."); } function createConstructorTypeNode1(modifiers, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(180 /* SyntaxKind.ConstructorType */, modifiers, + var node = createBaseSignatureDeclaration(182 /* SyntaxKind.ConstructorType */, modifiers, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23907,7 +23916,7 @@ var ts; } // @api function createTypeQueryNode(exprName, typeArguments) { - var node = createBaseNode(181 /* SyntaxKind.TypeQuery */); + var node = createBaseNode(183 /* SyntaxKind.TypeQuery */); node.exprName = exprName; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23922,7 +23931,7 @@ var ts; } // @api function createTypeLiteralNode(members) { - var node = createBaseNode(182 /* SyntaxKind.TypeLiteral */); + var node = createBaseNode(184 /* SyntaxKind.TypeLiteral */); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23935,7 +23944,7 @@ var ts; } // @api function createArrayTypeNode(elementType) { - var node = createBaseNode(183 /* SyntaxKind.ArrayType */); + var node = createBaseNode(185 /* SyntaxKind.ArrayType */); node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23948,7 +23957,7 @@ var ts; } // @api function createTupleTypeNode(elements) { - var node = createBaseNode(184 /* SyntaxKind.TupleType */); + var node = createBaseNode(186 /* SyntaxKind.TupleType */); node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23961,7 +23970,7 @@ var ts; } // @api function createNamedTupleMember(dotDotDotToken, name, questionToken, type) { - var node = createBaseNode(197 /* SyntaxKind.NamedTupleMember */); + var node = createBaseNode(199 /* SyntaxKind.NamedTupleMember */); node.dotDotDotToken = dotDotDotToken; node.name = name; node.questionToken = questionToken; @@ -23980,7 +23989,7 @@ var ts; } // @api function createOptionalTypeNode(type) { - var node = createBaseNode(185 /* SyntaxKind.OptionalType */); + var node = createBaseNode(187 /* SyntaxKind.OptionalType */); node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23993,7 +24002,7 @@ var ts; } // @api function createRestTypeNode(type) { - var node = createBaseNode(186 /* SyntaxKind.RestType */); + var node = createBaseNode(188 /* SyntaxKind.RestType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24017,7 +24026,7 @@ var ts; } // @api function createUnionTypeNode(types) { - return createUnionOrIntersectionTypeNode(187 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); + return createUnionOrIntersectionTypeNode(189 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } // @api function updateUnionTypeNode(node, types) { @@ -24025,7 +24034,7 @@ var ts; } // @api function createIntersectionTypeNode(types) { - return createUnionOrIntersectionTypeNode(188 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); + return createUnionOrIntersectionTypeNode(190 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } // @api function updateIntersectionTypeNode(node, types) { @@ -24033,7 +24042,7 @@ var ts; } // @api function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { - var node = createBaseNode(189 /* SyntaxKind.ConditionalType */); + var node = createBaseNode(191 /* SyntaxKind.ConditionalType */); node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType); node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType); node.trueType = trueType; @@ -24052,7 +24061,7 @@ var ts; } // @api function createInferTypeNode(typeParameter) { - var node = createBaseNode(190 /* SyntaxKind.InferType */); + var node = createBaseNode(192 /* SyntaxKind.InferType */); node.typeParameter = typeParameter; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24065,7 +24074,7 @@ var ts; } // @api function createTemplateLiteralType(head, templateSpans) { - var node = createBaseNode(198 /* SyntaxKind.TemplateLiteralType */); + var node = createBaseNode(200 /* SyntaxKind.TemplateLiteralType */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24081,7 +24090,7 @@ var ts; // @api function createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf) { if (isTypeOf === void 0) { isTypeOf = false; } - var node = createBaseNode(200 /* SyntaxKind.ImportType */); + var node = createBaseNode(202 /* SyntaxKind.ImportType */); node.argument = argument; node.assertions = assertions; node.qualifier = qualifier; @@ -24103,7 +24112,7 @@ var ts; } // @api function createParenthesizedType(type) { - var node = createBaseNode(191 /* SyntaxKind.ParenthesizedType */); + var node = createBaseNode(193 /* SyntaxKind.ParenthesizedType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24116,15 +24125,15 @@ var ts; } // @api function createThisTypeNode() { - var node = createBaseNode(192 /* SyntaxKind.ThisType */); + var node = createBaseNode(194 /* SyntaxKind.ThisType */); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; } // @api function createTypeOperatorNode(operator, type) { - var node = createBaseNode(193 /* SyntaxKind.TypeOperator */); + var node = createBaseNode(195 /* SyntaxKind.TypeOperator */); node.operator = operator; - node.type = operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + node.type = operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : parenthesizerRules().parenthesizeOperandOfTypeOperator(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24138,7 +24147,7 @@ var ts; } // @api function createIndexedAccessTypeNode(objectType, indexType) { - var node = createBaseNode(194 /* SyntaxKind.IndexedAccessType */); + var node = createBaseNode(196 /* SyntaxKind.IndexedAccessType */); node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType); node.indexType = indexType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24153,7 +24162,7 @@ var ts; } // @api function createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members) { - var node = createBaseNode(195 /* SyntaxKind.MappedType */); + var node = createBaseNode(197 /* SyntaxKind.MappedType */); node.readonlyToken = readonlyToken; node.typeParameter = typeParameter; node.nameType = nameType; @@ -24176,7 +24185,7 @@ var ts; } // @api function createLiteralTypeNode(literal) { - var node = createBaseNode(196 /* SyntaxKind.LiteralType */); + var node = createBaseNode(198 /* SyntaxKind.LiteralType */); node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24192,7 +24201,7 @@ var ts; // // @api function createObjectBindingPattern(elements) { - var node = createBaseNode(201 /* SyntaxKind.ObjectBindingPattern */); + var node = createBaseNode(203 /* SyntaxKind.ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24213,7 +24222,7 @@ var ts; } // @api function createArrayBindingPattern(elements) { - var node = createBaseNode(202 /* SyntaxKind.ArrayBindingPattern */); + var node = createBaseNode(204 /* SyntaxKind.ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24229,7 +24238,7 @@ var ts; } // @api function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createBaseBindingLikeDeclaration(203 /* SyntaxKind.BindingElement */, + var node = createBaseBindingLikeDeclaration(205 /* SyntaxKind.BindingElement */, /*modifiers*/ undefined, name, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; @@ -24264,7 +24273,7 @@ var ts; } // @api function createArrayLiteralExpression(elements, multiLine) { - var node = createBaseExpression(204 /* SyntaxKind.ArrayLiteralExpression */); + var node = createBaseExpression(206 /* SyntaxKind.ArrayLiteralExpression */); // Ensure we add a trailing comma for something like `[NumericLiteral(1), NumericLiteral(2), OmittedExpresion]` so that // we end up with `[1, 2, ,]` instead of `[1, 2, ]` otherwise the `OmittedExpression` will just end up being treated like // a trailing comma. @@ -24283,7 +24292,7 @@ var ts; } // @api function createObjectLiteralExpression(properties, multiLine) { - var node = createBaseExpression(205 /* SyntaxKind.ObjectLiteralExpression */); + var node = createBaseExpression(207 /* SyntaxKind.ObjectLiteralExpression */); node.properties = createNodeArray(properties); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.properties); @@ -24297,7 +24306,7 @@ var ts; } // @api function createPropertyAccessExpression(expression, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.name = asName(name); node.transformFlags = @@ -24326,7 +24335,7 @@ var ts; } // @api function createPropertyAccessChain(expression, questionDotToken, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24353,7 +24362,7 @@ var ts; } // @api function createElementAccessExpression(expression, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.argumentExpression = asExpression(index); node.transformFlags |= @@ -24380,7 +24389,7 @@ var ts; } // @api function createElementAccessChain(expression, questionDotToken, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24405,7 +24414,7 @@ var ts; } // @api function createCallExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray)); @@ -24437,7 +24446,7 @@ var ts; } // @api function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24469,7 +24478,7 @@ var ts; } // @api function createNewExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(209 /* SyntaxKind.NewExpression */); + var node = createBaseExpression(211 /* SyntaxKind.NewExpression */); node.expression = parenthesizerRules().parenthesizeExpressionOfNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(argumentsArray) : undefined; @@ -24493,7 +24502,7 @@ var ts; } // @api function createTaggedTemplateExpression(tag, typeArguments, template) { - var node = createBaseExpression(210 /* SyntaxKind.TaggedTemplateExpression */); + var node = createBaseExpression(212 /* SyntaxKind.TaggedTemplateExpression */); node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.template = template; @@ -24520,7 +24529,7 @@ var ts; } // @api function createTypeAssertion(type, expression) { - var node = createBaseExpression(211 /* SyntaxKind.TypeAssertionExpression */); + var node = createBaseExpression(213 /* SyntaxKind.TypeAssertionExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.type = type; node.transformFlags |= @@ -24538,7 +24547,7 @@ var ts; } // @api function createParenthesizedExpression(expression) { - var node = createBaseExpression(212 /* SyntaxKind.ParenthesizedExpression */); + var node = createBaseExpression(214 /* SyntaxKind.ParenthesizedExpression */); node.expression = expression; node.transformFlags = propagateChildFlags(node.expression); return node; @@ -24551,13 +24560,13 @@ var ts; } // @api function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(213 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(215 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.asteriskToken); if (node.typeParameters) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -24584,13 +24593,13 @@ var ts; } // @api function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createBaseFunctionLikeDeclaration(214 /* SyntaxKind.ArrowFunction */, modifiers, + var node = createBaseFunctionLikeDeclaration(216 /* SyntaxKind.ArrowFunction */, modifiers, /*name*/ undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* SyntaxKind.EqualsGreaterThanToken */); node.transformFlags |= propagateChildFlags(node.equalsGreaterThanToken) | 1024 /* TransformFlags.ContainsES2015 */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { node.transformFlags |= 256 /* TransformFlags.ContainsES2017 */ | 16384 /* TransformFlags.ContainsLexicalThis */; } return node; @@ -24608,7 +24617,7 @@ var ts; } // @api function createDeleteExpression(expression) { - var node = createBaseExpression(215 /* SyntaxKind.DeleteExpression */); + var node = createBaseExpression(217 /* SyntaxKind.DeleteExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24621,7 +24630,7 @@ var ts; } // @api function createTypeOfExpression(expression) { - var node = createBaseExpression(216 /* SyntaxKind.TypeOfExpression */); + var node = createBaseExpression(218 /* SyntaxKind.TypeOfExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24634,7 +24643,7 @@ var ts; } // @api function createVoidExpression(expression) { - var node = createBaseExpression(217 /* SyntaxKind.VoidExpression */); + var node = createBaseExpression(219 /* SyntaxKind.VoidExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24647,7 +24656,7 @@ var ts; } // @api function createAwaitExpression(expression) { - var node = createBaseExpression(218 /* SyntaxKind.AwaitExpression */); + var node = createBaseExpression(220 /* SyntaxKind.AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24664,7 +24673,7 @@ var ts; } // @api function createPrefixUnaryExpression(operator, operand) { - var node = createBaseExpression(219 /* SyntaxKind.PrefixUnaryExpression */); + var node = createBaseExpression(221 /* SyntaxKind.PrefixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24686,7 +24695,7 @@ var ts; } // @api function createPostfixUnaryExpression(operand, operator) { - var node = createBaseExpression(220 /* SyntaxKind.PostfixUnaryExpression */); + var node = createBaseExpression(222 /* SyntaxKind.PostfixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24707,7 +24716,7 @@ var ts; } // @api function createBinaryExpression(left, operator, right) { - var node = createBaseExpression(221 /* SyntaxKind.BinaryExpression */); + var node = createBaseExpression(223 /* SyntaxKind.BinaryExpression */); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = parenthesizerRules().parenthesizeLeftSideOfBinary(operatorKind, left); @@ -24779,7 +24788,7 @@ var ts; } // @api function createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse) { - var node = createBaseExpression(222 /* SyntaxKind.ConditionalExpression */); + var node = createBaseExpression(224 /* SyntaxKind.ConditionalExpression */); node.condition = parenthesizerRules().parenthesizeConditionOfConditionalExpression(condition); node.questionToken = questionToken !== null && questionToken !== void 0 ? questionToken : createToken(57 /* SyntaxKind.QuestionToken */); node.whenTrue = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenTrue); @@ -24805,7 +24814,7 @@ var ts; } // @api function createTemplateExpression(head, templateSpans) { - var node = createBaseExpression(223 /* SyntaxKind.TemplateExpression */); + var node = createBaseExpression(225 /* SyntaxKind.TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= @@ -24875,7 +24884,7 @@ var ts; // @api function createYieldExpression(asteriskToken, expression) { ts.Debug.assert(!asteriskToken || !!expression, "A `YieldExpression` with an asteriskToken must have an expression."); - var node = createBaseExpression(224 /* SyntaxKind.YieldExpression */); + var node = createBaseExpression(226 /* SyntaxKind.YieldExpression */); node.expression = expression && parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.asteriskToken = asteriskToken; node.transformFlags |= @@ -24895,7 +24904,7 @@ var ts; } // @api function createSpreadElement(expression) { - var node = createBaseExpression(225 /* SyntaxKind.SpreadElement */); + var node = createBaseExpression(227 /* SyntaxKind.SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24911,7 +24920,7 @@ var ts; } // @api function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(226 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(228 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -24927,11 +24936,11 @@ var ts; } // @api function createOmittedExpression() { - return createBaseExpression(227 /* SyntaxKind.OmittedExpression */); + return createBaseExpression(229 /* SyntaxKind.OmittedExpression */); } // @api function createExpressionWithTypeArguments(expression, typeArguments) { - var node = createBaseNode(228 /* SyntaxKind.ExpressionWithTypeArguments */); + var node = createBaseNode(230 /* SyntaxKind.ExpressionWithTypeArguments */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= @@ -24949,7 +24958,7 @@ var ts; } // @api function createAsExpression(expression, type) { - var node = createBaseExpression(229 /* SyntaxKind.AsExpression */); + var node = createBaseExpression(231 /* SyntaxKind.AsExpression */); node.expression = expression; node.type = type; node.transformFlags |= @@ -24967,7 +24976,7 @@ var ts; } // @api function createNonNullExpression(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24984,8 +24993,26 @@ var ts; : node; } // @api + function createSatisfiesExpression(expression, type) { + var node = createBaseExpression(235 /* SyntaxKind.SatisfiesExpression */); + node.expression = expression; + node.type = type; + node.transformFlags |= + propagateChildFlags(node.expression) | + propagateChildFlags(node.type) | + 1 /* TransformFlags.ContainsTypeScript */; + return node; + } + // @api + function updateSatisfiesExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? update(createSatisfiesExpression(expression, type), node) + : node; + } + // @api function createNonNullChain(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.transformFlags |= @@ -25002,7 +25029,7 @@ var ts; } // @api function createMetaProperty(keywordToken, name) { - var node = createBaseExpression(231 /* SyntaxKind.MetaProperty */); + var node = createBaseExpression(233 /* SyntaxKind.MetaProperty */); node.keywordToken = keywordToken; node.name = name; node.transformFlags |= propagateChildFlags(node.name); @@ -25029,7 +25056,7 @@ var ts; // // @api function createTemplateSpan(expression, literal) { - var node = createBaseNode(233 /* SyntaxKind.TemplateSpan */); + var node = createBaseNode(236 /* SyntaxKind.TemplateSpan */); node.expression = expression; node.literal = literal; node.transformFlags |= @@ -25047,7 +25074,7 @@ var ts; } // @api function createSemicolonClassElement() { - var node = createBaseNode(234 /* SyntaxKind.SemicolonClassElement */); + var node = createBaseNode(237 /* SyntaxKind.SemicolonClassElement */); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -25056,7 +25083,7 @@ var ts; // // @api function createBlock(statements, multiLine) { - var node = createBaseNode(235 /* SyntaxKind.Block */); + var node = createBaseNode(238 /* SyntaxKind.Block */); node.statements = createNodeArray(statements); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.statements); @@ -25070,7 +25097,7 @@ var ts; } // @api function createVariableStatement(modifiers, declarationList) { - var node = createBaseDeclaration(237 /* SyntaxKind.VariableStatement */); + var node = createBaseDeclaration(240 /* SyntaxKind.VariableStatement */); node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; node.transformFlags |= @@ -25090,11 +25117,11 @@ var ts; } // @api function createEmptyStatement() { - return createBaseNode(236 /* SyntaxKind.EmptyStatement */); + return createBaseNode(239 /* SyntaxKind.EmptyStatement */); } // @api function createExpressionStatement(expression) { - var node = createBaseNode(238 /* SyntaxKind.ExpressionStatement */); + var node = createBaseNode(241 /* SyntaxKind.ExpressionStatement */); node.expression = parenthesizerRules().parenthesizeExpressionOfExpressionStatement(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -25107,7 +25134,7 @@ var ts; } // @api function createIfStatement(expression, thenStatement, elseStatement) { - var node = createBaseNode(239 /* SyntaxKind.IfStatement */); + var node = createBaseNode(242 /* SyntaxKind.IfStatement */); node.expression = expression; node.thenStatement = asEmbeddedStatement(thenStatement); node.elseStatement = asEmbeddedStatement(elseStatement); @@ -25127,7 +25154,7 @@ var ts; } // @api function createDoStatement(statement, expression) { - var node = createBaseNode(240 /* SyntaxKind.DoStatement */); + var node = createBaseNode(243 /* SyntaxKind.DoStatement */); node.statement = asEmbeddedStatement(statement); node.expression = expression; node.transformFlags |= @@ -25144,7 +25171,7 @@ var ts; } // @api function createWhileStatement(expression, statement) { - var node = createBaseNode(241 /* SyntaxKind.WhileStatement */); + var node = createBaseNode(244 /* SyntaxKind.WhileStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25161,7 +25188,7 @@ var ts; } // @api function createForStatement(initializer, condition, incrementor, statement) { - var node = createBaseNode(242 /* SyntaxKind.ForStatement */); + var node = createBaseNode(245 /* SyntaxKind.ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -25184,7 +25211,7 @@ var ts; } // @api function createForInStatement(initializer, expression, statement) { - var node = createBaseNode(243 /* SyntaxKind.ForInStatement */); + var node = createBaseNode(246 /* SyntaxKind.ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = asEmbeddedStatement(statement); @@ -25204,7 +25231,7 @@ var ts; } // @api function createForOfStatement(awaitModifier, initializer, expression, statement) { - var node = createBaseNode(244 /* SyntaxKind.ForOfStatement */); + var node = createBaseNode(247 /* SyntaxKind.ForOfStatement */); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); @@ -25230,7 +25257,7 @@ var ts; } // @api function createContinueStatement(label) { - var node = createBaseNode(245 /* SyntaxKind.ContinueStatement */); + var node = createBaseNode(248 /* SyntaxKind.ContinueStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25245,7 +25272,7 @@ var ts; } // @api function createBreakStatement(label) { - var node = createBaseNode(246 /* SyntaxKind.BreakStatement */); + var node = createBaseNode(249 /* SyntaxKind.BreakStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25260,7 +25287,7 @@ var ts; } // @api function createReturnStatement(expression) { - var node = createBaseNode(247 /* SyntaxKind.ReturnStatement */); + var node = createBaseNode(250 /* SyntaxKind.ReturnStatement */); node.expression = expression; // return in an ES2018 async generator must be awaited node.transformFlags |= @@ -25277,7 +25304,7 @@ var ts; } // @api function createWithStatement(expression, statement) { - var node = createBaseNode(248 /* SyntaxKind.WithStatement */); + var node = createBaseNode(251 /* SyntaxKind.WithStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25294,7 +25321,7 @@ var ts; } // @api function createSwitchStatement(expression, caseBlock) { - var node = createBaseNode(249 /* SyntaxKind.SwitchStatement */); + var node = createBaseNode(252 /* SyntaxKind.SwitchStatement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.caseBlock = caseBlock; node.transformFlags |= @@ -25311,7 +25338,7 @@ var ts; } // @api function createLabeledStatement(label, statement) { - var node = createBaseNode(250 /* SyntaxKind.LabeledStatement */); + var node = createBaseNode(253 /* SyntaxKind.LabeledStatement */); node.label = asName(label); node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25328,7 +25355,7 @@ var ts; } // @api function createThrowStatement(expression) { - var node = createBaseNode(251 /* SyntaxKind.ThrowStatement */); + var node = createBaseNode(254 /* SyntaxKind.ThrowStatement */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -25341,7 +25368,7 @@ var ts; } // @api function createTryStatement(tryBlock, catchClause, finallyBlock) { - var node = createBaseNode(252 /* SyntaxKind.TryStatement */); + var node = createBaseNode(255 /* SyntaxKind.TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -25361,11 +25388,11 @@ var ts; } // @api function createDebuggerStatement() { - return createBaseNode(253 /* SyntaxKind.DebuggerStatement */); + return createBaseNode(256 /* SyntaxKind.DebuggerStatement */); } // @api function createVariableDeclaration(name, exclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(254 /* SyntaxKind.VariableDeclaration */, + var node = createBaseVariableLikeDeclaration(257 /* SyntaxKind.VariableDeclaration */, /*modifiers*/ undefined, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.exclamationToken = exclamationToken; node.transformFlags |= propagateChildFlags(node.exclamationToken); @@ -25386,7 +25413,7 @@ var ts; // @api function createVariableDeclarationList(declarations, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseNode(255 /* SyntaxKind.VariableDeclarationList */); + var node = createBaseNode(258 /* SyntaxKind.VariableDeclarationList */); node.flags |= flags & 3 /* NodeFlags.BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= @@ -25407,7 +25434,7 @@ var ts; } // @api function createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(256 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(259 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; if (!node.body || ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -25416,7 +25443,7 @@ var ts; node.transformFlags |= propagateChildFlags(node.asteriskToken) | 4194304 /* TransformFlags.ContainsHoistedDeclarationOrCompletion */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -25453,7 +25480,7 @@ var ts; } // @api function createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(257 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(260 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); if (ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; } @@ -25477,7 +25504,7 @@ var ts; } // @api function createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseInterfaceOrClassLikeDeclaration(258 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); + var node = createBaseInterfaceOrClassLikeDeclaration(261 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25502,7 +25529,7 @@ var ts; } // @api function createTypeAliasDeclaration(modifiers, name, typeParameters, type) { - var node = createBaseGenericNamedDeclaration(259 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); + var node = createBaseGenericNamedDeclaration(262 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25526,7 +25553,7 @@ var ts; } // @api function createEnumDeclaration(modifiers, name, members) { - var node = createBaseNamedDeclaration(260 /* SyntaxKind.EnumDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(263 /* SyntaxKind.EnumDeclaration */, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= propagateChildrenFlags(node.members) | @@ -25553,7 +25580,7 @@ var ts; // @api function createModuleDeclaration(modifiers, name, body, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseDeclaration(261 /* SyntaxKind.ModuleDeclaration */); + var node = createBaseDeclaration(264 /* SyntaxKind.ModuleDeclaration */); node.modifiers = asNodeArray(modifiers); node.flags |= flags & (16 /* NodeFlags.Namespace */ | 4 /* NodeFlags.NestedNamespace */ | 1024 /* NodeFlags.GlobalAugmentation */); node.name = name; @@ -25589,7 +25616,7 @@ var ts; } // @api function createModuleBlock(statements) { - var node = createBaseNode(262 /* SyntaxKind.ModuleBlock */); + var node = createBaseNode(265 /* SyntaxKind.ModuleBlock */); node.statements = createNodeArray(statements); node.transformFlags |= propagateChildrenFlags(node.statements); return node; @@ -25602,7 +25629,7 @@ var ts; } // @api function createCaseBlock(clauses) { - var node = createBaseNode(263 /* SyntaxKind.CaseBlock */); + var node = createBaseNode(266 /* SyntaxKind.CaseBlock */); node.clauses = createNodeArray(clauses); node.transformFlags |= propagateChildrenFlags(node.clauses); return node; @@ -25615,7 +25642,7 @@ var ts; } // @api function createNamespaceExportDeclaration(name) { - var node = createBaseNamedDeclaration(264 /* SyntaxKind.NamespaceExportDeclaration */, + var node = createBaseNamedDeclaration(267 /* SyntaxKind.NamespaceExportDeclaration */, /*modifiers*/ undefined, name); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25638,7 +25665,7 @@ var ts; } // @api function createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference) { - var node = createBaseNamedDeclaration(265 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(268 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); node.isTypeOnly = isTypeOnly; node.moduleReference = moduleReference; node.transformFlags |= propagateChildFlags(node.moduleReference); @@ -25666,7 +25693,7 @@ var ts; } // @api function createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(266 /* SyntaxKind.ImportDeclaration */); + var node = createBaseDeclaration(269 /* SyntaxKind.ImportDeclaration */); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; @@ -25696,7 +25723,7 @@ var ts; } // @api function createImportClause(isTypeOnly, name, namedBindings) { - var node = createBaseNode(267 /* SyntaxKind.ImportClause */); + var node = createBaseNode(270 /* SyntaxKind.ImportClause */); node.isTypeOnly = isTypeOnly; node.name = name; node.namedBindings = namedBindings; @@ -25719,7 +25746,7 @@ var ts; } // @api function createAssertClause(elements, multiLine) { - var node = createBaseNode(293 /* SyntaxKind.AssertClause */); + var node = createBaseNode(296 /* SyntaxKind.AssertClause */); node.elements = createNodeArray(elements); node.multiLine = multiLine; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25734,7 +25761,7 @@ var ts; } // @api function createAssertEntry(name, value) { - var node = createBaseNode(294 /* SyntaxKind.AssertEntry */); + var node = createBaseNode(297 /* SyntaxKind.AssertEntry */); node.name = name; node.value = value; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25749,7 +25776,7 @@ var ts; } // @api function createImportTypeAssertionContainer(clause, multiLine) { - var node = createBaseNode(295 /* SyntaxKind.ImportTypeAssertionContainer */); + var node = createBaseNode(298 /* SyntaxKind.ImportTypeAssertionContainer */); node.assertClause = clause; node.multiLine = multiLine; return node; @@ -25763,7 +25790,7 @@ var ts; } // @api function createNamespaceImport(name) { - var node = createBaseNode(268 /* SyntaxKind.NamespaceImport */); + var node = createBaseNode(271 /* SyntaxKind.NamespaceImport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25777,7 +25804,7 @@ var ts; } // @api function createNamespaceExport(name) { - var node = createBaseNode(274 /* SyntaxKind.NamespaceExport */); + var node = createBaseNode(277 /* SyntaxKind.NamespaceExport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name) | @@ -25793,7 +25820,7 @@ var ts; } // @api function createNamedImports(elements) { - var node = createBaseNode(269 /* SyntaxKind.NamedImports */); + var node = createBaseNode(272 /* SyntaxKind.NamedImports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25807,7 +25834,7 @@ var ts; } // @api function createImportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(270 /* SyntaxKind.ImportSpecifier */); + var node = createBaseNode(273 /* SyntaxKind.ImportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = propertyName; node.name = name; @@ -25827,7 +25854,7 @@ var ts; } // @api function createExportAssignment(modifiers, isExportEquals, expression) { - var node = createBaseDeclaration(271 /* SyntaxKind.ExportAssignment */); + var node = createBaseDeclaration(274 /* SyntaxKind.ExportAssignment */); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = isExportEquals @@ -25854,7 +25881,7 @@ var ts; } // @api function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(272 /* SyntaxKind.ExportDeclaration */); + var node = createBaseDeclaration(275 /* SyntaxKind.ExportDeclaration */); node.modifiers = asNodeArray(modifiers); node.isTypeOnly = isTypeOnly; node.exportClause = exportClause; @@ -25887,7 +25914,7 @@ var ts; } // @api function createNamedExports(elements) { - var node = createBaseNode(273 /* SyntaxKind.NamedExports */); + var node = createBaseNode(276 /* SyntaxKind.NamedExports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25901,7 +25928,7 @@ var ts; } // @api function createExportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(275 /* SyntaxKind.ExportSpecifier */); + var node = createBaseNode(278 /* SyntaxKind.ExportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = asName(propertyName); node.name = asName(name); @@ -25921,7 +25948,7 @@ var ts; } // @api function createMissingDeclaration() { - var node = createBaseDeclaration(276 /* SyntaxKind.MissingDeclaration */); + var node = createBaseDeclaration(279 /* SyntaxKind.MissingDeclaration */); return node; } // @@ -25929,7 +25956,7 @@ var ts; // // @api function createExternalModuleReference(expression) { - var node = createBaseNode(277 /* SyntaxKind.ExternalModuleReference */); + var node = createBaseNode(280 /* SyntaxKind.ExternalModuleReference */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25987,7 +26014,7 @@ var ts; } // @api function createJSDocFunctionType(parameters, type) { - var node = createBaseSignatureDeclaration(317 /* SyntaxKind.JSDocFunctionType */, + var node = createBaseSignatureDeclaration(320 /* SyntaxKind.JSDocFunctionType */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); @@ -26003,7 +26030,7 @@ var ts; // @api function createJSDocTypeLiteral(propertyTags, isArrayType) { if (isArrayType === void 0) { isArrayType = false; } - var node = createBaseNode(322 /* SyntaxKind.JSDocTypeLiteral */); + var node = createBaseNode(325 /* SyntaxKind.JSDocTypeLiteral */); node.jsDocPropertyTags = asNodeArray(propertyTags); node.isArrayType = isArrayType; return node; @@ -26017,7 +26044,7 @@ var ts; } // @api function createJSDocTypeExpression(type) { - var node = createBaseNode(309 /* SyntaxKind.JSDocTypeExpression */); + var node = createBaseNode(312 /* SyntaxKind.JSDocTypeExpression */); node.type = type; return node; } @@ -26029,7 +26056,7 @@ var ts; } // @api function createJSDocSignature(typeParameters, parameters, type) { - var node = createBaseNode(323 /* SyntaxKind.JSDocSignature */); + var node = createBaseNode(326 /* SyntaxKind.JSDocSignature */); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; @@ -26058,7 +26085,7 @@ var ts; } // @api function createJSDocTemplateTag(tagName, constraint, typeParameters, comment) { - var node = createBaseJSDocTag(344 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); + var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); return node; @@ -26075,7 +26102,7 @@ var ts; } // @api function createJSDocTypedefTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(345 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); + var node = createBaseJSDocTag(348 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -26093,7 +26120,7 @@ var ts; } // @api function createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(340 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); + var node = createBaseJSDocTag(343 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -26114,7 +26141,7 @@ var ts; } // @api function createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); + var node = createBaseJSDocTag(350 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -26135,7 +26162,7 @@ var ts; } // @api function createJSDocCallbackTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(338 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); + var node = createBaseJSDocTag(341 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -26153,7 +26180,7 @@ var ts; } // @api function createJSDocAugmentsTag(tagName, className, comment) { - var node = createBaseJSDocTag(328 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); + var node = createBaseJSDocTag(331 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); node.class = className; return node; } @@ -26168,13 +26195,13 @@ var ts; } // @api function createJSDocImplementsTag(tagName, className, comment) { - var node = createBaseJSDocTag(329 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); + var node = createBaseJSDocTag(332 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); node.class = className; return node; } // @api function createJSDocSeeTag(tagName, name, comment) { - var node = createBaseJSDocTag(346 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); + var node = createBaseJSDocTag(349 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); node.name = name; return node; } @@ -26188,7 +26215,7 @@ var ts; } // @api function createJSDocNameReference(name) { - var node = createBaseNode(310 /* SyntaxKind.JSDocNameReference */); + var node = createBaseNode(313 /* SyntaxKind.JSDocNameReference */); node.name = name; return node; } @@ -26200,7 +26227,7 @@ var ts; } // @api function createJSDocMemberName(left, right) { - var node = createBaseNode(311 /* SyntaxKind.JSDocMemberName */); + var node = createBaseNode(314 /* SyntaxKind.JSDocMemberName */); node.left = left; node.right = right; node.transformFlags |= @@ -26217,7 +26244,7 @@ var ts; } // @api function createJSDocLink(name, text) { - var node = createBaseNode(324 /* SyntaxKind.JSDocLink */); + var node = createBaseNode(327 /* SyntaxKind.JSDocLink */); node.name = name; node.text = text; return node; @@ -26230,7 +26257,7 @@ var ts; } // @api function createJSDocLinkCode(name, text) { - var node = createBaseNode(325 /* SyntaxKind.JSDocLinkCode */); + var node = createBaseNode(328 /* SyntaxKind.JSDocLinkCode */); node.name = name; node.text = text; return node; @@ -26243,7 +26270,7 @@ var ts; } // @api function createJSDocLinkPlain(name, text) { - var node = createBaseNode(326 /* SyntaxKind.JSDocLinkPlain */); + var node = createBaseNode(329 /* SyntaxKind.JSDocLinkPlain */); node.name = name; node.text = text; return node; @@ -26315,7 +26342,7 @@ var ts; } // @api function createJSDocUnknownTag(tagName, comment) { - var node = createBaseJSDocTag(327 /* SyntaxKind.JSDocTag */, tagName, comment); + var node = createBaseJSDocTag(330 /* SyntaxKind.JSDocTag */, tagName, comment); return node; } // @api @@ -26327,7 +26354,7 @@ var ts; } // @api function createJSDocText(text) { - var node = createBaseNode(321 /* SyntaxKind.JSDocText */); + var node = createBaseNode(324 /* SyntaxKind.JSDocText */); node.text = text; return node; } @@ -26339,7 +26366,7 @@ var ts; } // @api function createJSDocComment(comment, tags) { - var node = createBaseNode(320 /* SyntaxKind.JSDoc */); + var node = createBaseNode(323 /* SyntaxKind.JSDoc */); node.comment = comment; node.tags = asNodeArray(tags); return node; @@ -26356,7 +26383,7 @@ var ts; // // @api function createJsxElement(openingElement, children, closingElement) { - var node = createBaseNode(278 /* SyntaxKind.JsxElement */); + var node = createBaseNode(281 /* SyntaxKind.JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -26377,7 +26404,7 @@ var ts; } // @api function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createBaseNode(279 /* SyntaxKind.JsxSelfClosingElement */); + var node = createBaseNode(282 /* SyntaxKind.JsxSelfClosingElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26401,7 +26428,7 @@ var ts; } // @api function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createBaseNode(280 /* SyntaxKind.JsxOpeningElement */); + var node = createBaseNode(283 /* SyntaxKind.JsxOpeningElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26425,7 +26452,7 @@ var ts; } // @api function createJsxClosingElement(tagName) { - var node = createBaseNode(281 /* SyntaxKind.JsxClosingElement */); + var node = createBaseNode(284 /* SyntaxKind.JsxClosingElement */); node.tagName = tagName; node.transformFlags |= propagateChildFlags(node.tagName) | @@ -26440,7 +26467,7 @@ var ts; } // @api function createJsxFragment(openingFragment, children, closingFragment) { - var node = createBaseNode(282 /* SyntaxKind.JsxFragment */); + var node = createBaseNode(285 /* SyntaxKind.JsxFragment */); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -26476,19 +26503,19 @@ var ts; } // @api function createJsxOpeningFragment() { - var node = createBaseNode(283 /* SyntaxKind.JsxOpeningFragment */); + var node = createBaseNode(286 /* SyntaxKind.JsxOpeningFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxJsxClosingFragment() { - var node = createBaseNode(284 /* SyntaxKind.JsxClosingFragment */); + var node = createBaseNode(287 /* SyntaxKind.JsxClosingFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxAttribute(name, initializer) { - var node = createBaseNode(285 /* SyntaxKind.JsxAttribute */); + var node = createBaseNode(288 /* SyntaxKind.JsxAttribute */); node.name = name; node.initializer = initializer; node.transformFlags |= @@ -26506,7 +26533,7 @@ var ts; } // @api function createJsxAttributes(properties) { - var node = createBaseNode(286 /* SyntaxKind.JsxAttributes */); + var node = createBaseNode(289 /* SyntaxKind.JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= propagateChildrenFlags(node.properties) | @@ -26521,7 +26548,7 @@ var ts; } // @api function createJsxSpreadAttribute(expression) { - var node = createBaseNode(287 /* SyntaxKind.JsxSpreadAttribute */); + var node = createBaseNode(290 /* SyntaxKind.JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | @@ -26536,7 +26563,7 @@ var ts; } // @api function createJsxExpression(dotDotDotToken, expression) { - var node = createBaseNode(288 /* SyntaxKind.JsxExpression */); + var node = createBaseNode(291 /* SyntaxKind.JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; node.transformFlags |= @@ -26556,7 +26583,7 @@ var ts; // // @api function createCaseClause(expression, statements) { - var node = createBaseNode(289 /* SyntaxKind.CaseClause */); + var node = createBaseNode(292 /* SyntaxKind.CaseClause */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.statements = createNodeArray(statements); node.transformFlags |= @@ -26573,7 +26600,7 @@ var ts; } // @api function createDefaultClause(statements) { - var node = createBaseNode(290 /* SyntaxKind.DefaultClause */); + var node = createBaseNode(293 /* SyntaxKind.DefaultClause */); node.statements = createNodeArray(statements); node.transformFlags = propagateChildrenFlags(node.statements); return node; @@ -26586,7 +26613,7 @@ var ts; } // @api function createHeritageClause(token, types) { - var node = createBaseNode(291 /* SyntaxKind.HeritageClause */); + var node = createBaseNode(294 /* SyntaxKind.HeritageClause */); node.token = token; node.types = createNodeArray(types); node.transformFlags |= propagateChildrenFlags(node.types); @@ -26610,7 +26637,7 @@ var ts; } // @api function createCatchClause(variableDeclaration, block) { - var node = createBaseNode(292 /* SyntaxKind.CatchClause */); + var node = createBaseNode(295 /* SyntaxKind.CatchClause */); if (typeof variableDeclaration === "string" || variableDeclaration && !ts.isVariableDeclaration(variableDeclaration)) { variableDeclaration = createVariableDeclaration(variableDeclaration, /*exclamationToken*/ undefined, @@ -26638,7 +26665,7 @@ var ts; // // @api function createPropertyAssignment(name, initializer) { - var node = createBaseNamedDeclaration(296 /* SyntaxKind.PropertyAssignment */, + var node = createBaseNamedDeclaration(299 /* SyntaxKind.PropertyAssignment */, /*modifiers*/ undefined, name); node.initializer = parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26670,7 +26697,7 @@ var ts; } // @api function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createBaseNamedDeclaration(297 /* SyntaxKind.ShorthandPropertyAssignment */, + var node = createBaseNamedDeclaration(300 /* SyntaxKind.ShorthandPropertyAssignment */, /*modifiers*/ undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= @@ -26704,7 +26731,7 @@ var ts; } // @api function createSpreadAssignment(expression) { - var node = createBaseNode(298 /* SyntaxKind.SpreadAssignment */); + var node = createBaseNode(301 /* SyntaxKind.SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -26723,7 +26750,7 @@ var ts; // // @api function createEnumMember(name, initializer) { - var node = createBaseNode(299 /* SyntaxKind.EnumMember */); + var node = createBaseNode(302 /* SyntaxKind.EnumMember */); node.name = asName(name); node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26744,7 +26771,7 @@ var ts; // // @api function createSourceFile(statements, endOfFileToken, flags) { - var node = baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */); + var node = baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */); node.statements = createNodeArray(statements); node.endOfFileToken = endOfFileToken; node.flags |= flags; @@ -26761,7 +26788,7 @@ var ts; return node; } function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) { - var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */)); + var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */)); for (var p in source) { if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p)) continue; @@ -26800,7 +26827,7 @@ var ts; // @api function createBundle(sourceFiles, prepends) { if (prepends === void 0) { prepends = ts.emptyArray; } - var node = createBaseNode(306 /* SyntaxKind.Bundle */); + var node = createBaseNode(309 /* SyntaxKind.Bundle */); node.prepends = prepends; node.sourceFiles = sourceFiles; return node; @@ -26815,7 +26842,7 @@ var ts; } // @api function createUnparsedSource(prologues, syntheticReferences, texts) { - var node = createBaseNode(307 /* SyntaxKind.UnparsedSource */); + var node = createBaseNode(310 /* SyntaxKind.UnparsedSource */); node.prologues = prologues; node.syntheticReferences = syntheticReferences; node.texts = texts; @@ -26833,28 +26860,28 @@ var ts; } // @api function createUnparsedPrologue(data) { - return createBaseUnparsedNode(300 /* SyntaxKind.UnparsedPrologue */, data); + return createBaseUnparsedNode(303 /* SyntaxKind.UnparsedPrologue */, data); } // @api function createUnparsedPrepend(data, texts) { - var node = createBaseUnparsedNode(301 /* SyntaxKind.UnparsedPrepend */, data); + var node = createBaseUnparsedNode(304 /* SyntaxKind.UnparsedPrepend */, data); node.texts = texts; return node; } // @api function createUnparsedTextLike(data, internal) { - return createBaseUnparsedNode(internal ? 303 /* SyntaxKind.UnparsedInternalText */ : 302 /* SyntaxKind.UnparsedText */, data); + return createBaseUnparsedNode(internal ? 306 /* SyntaxKind.UnparsedInternalText */ : 305 /* SyntaxKind.UnparsedText */, data); } // @api function createUnparsedSyntheticReference(section) { - var node = createBaseNode(304 /* SyntaxKind.UnparsedSyntheticReference */); + var node = createBaseNode(307 /* SyntaxKind.UnparsedSyntheticReference */); node.data = section.data; node.section = section; return node; } // @api function createInputFiles() { - var node = createBaseNode(308 /* SyntaxKind.InputFiles */); + var node = createBaseNode(311 /* SyntaxKind.InputFiles */); node.javascriptText = ""; node.declarationText = ""; return node; @@ -26865,7 +26892,7 @@ var ts; // @api function createSyntheticExpression(type, isSpread, tupleNameSource) { if (isSpread === void 0) { isSpread = false; } - var node = createBaseNode(232 /* SyntaxKind.SyntheticExpression */); + var node = createBaseNode(234 /* SyntaxKind.SyntheticExpression */); node.type = type; node.isSpread = isSpread; node.tupleNameSource = tupleNameSource; @@ -26873,7 +26900,7 @@ var ts; } // @api function createSyntaxList(children) { - var node = createBaseNode(348 /* SyntaxKind.SyntaxList */); + var node = createBaseNode(351 /* SyntaxKind.SyntaxList */); node._children = children; return node; } @@ -26888,7 +26915,7 @@ var ts; */ // @api function createNotEmittedStatement(original) { - var node = createBaseNode(349 /* SyntaxKind.NotEmittedStatement */); + var node = createBaseNode(352 /* SyntaxKind.NotEmittedStatement */); node.original = original; ts.setTextRange(node, original); return node; @@ -26902,7 +26929,7 @@ var ts; */ // @api function createPartiallyEmittedExpression(expression, original) { - var node = createBaseNode(350 /* SyntaxKind.PartiallyEmittedExpression */); + var node = createBaseNode(353 /* SyntaxKind.PartiallyEmittedExpression */); node.expression = expression; node.original = original; node.transformFlags |= @@ -26930,7 +26957,7 @@ var ts; } // @api function createCommaListExpression(elements) { - var node = createBaseNode(351 /* SyntaxKind.CommaListExpression */); + var node = createBaseNode(354 /* SyntaxKind.CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); node.transformFlags |= propagateChildrenFlags(node.elements); return node; @@ -26947,7 +26974,7 @@ var ts; */ // @api function createEndOfDeclarationMarker(original) { - var node = createBaseNode(353 /* SyntaxKind.EndOfDeclarationMarker */); + var node = createBaseNode(356 /* SyntaxKind.EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -26958,14 +26985,14 @@ var ts; */ // @api function createMergeDeclarationMarker(original) { - var node = createBaseNode(352 /* SyntaxKind.MergeDeclarationMarker */); + var node = createBaseNode(355 /* SyntaxKind.MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; } // @api function createSyntheticReferenceExpression(expression, thisArg) { - var node = createBaseNode(354 /* SyntaxKind.SyntheticReferenceExpression */); + var node = createBaseNode(357 /* SyntaxKind.SyntheticReferenceExpression */); node.expression = expression; node.thisArg = thisArg; node.transformFlags |= @@ -26987,7 +27014,7 @@ var ts; if (node === undefined) { return node; } - var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */) : + var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */) : ts.isIdentifier(node) ? baseFactory.createBaseIdentifierNode(79 /* SyntaxKind.Identifier */) : ts.isPrivateIdentifier(node) ? baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */) : !ts.isNodeKind(node.kind) ? baseFactory.createBaseTokenNode(node.kind) : @@ -26996,7 +27023,7 @@ var ts; clone.transformFlags = node.transformFlags; setOriginalNode(clone, node); for (var key in node) { - if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) { continue; } clone[key] = node[key]; @@ -27104,11 +27131,12 @@ var ts; } function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); - case 211 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 229 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); - case 230 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); + case 214 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); + case 213 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 231 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); + case 235 /* SyntaxKind.SatisfiesExpression */: return updateSatisfiesExpression(outerExpression, expression, outerExpression.type); + case 232 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -27162,13 +27190,13 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: return false; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -27594,24 +27622,24 @@ var ts; } function getDefaultTagNameForKind(kind) { switch (kind) { - case 343 /* SyntaxKind.JSDocTypeTag */: return "type"; - case 341 /* SyntaxKind.JSDocReturnTag */: return "returns"; - case 342 /* SyntaxKind.JSDocThisTag */: return "this"; - case 339 /* SyntaxKind.JSDocEnumTag */: return "enum"; - case 330 /* SyntaxKind.JSDocAuthorTag */: return "author"; - case 332 /* SyntaxKind.JSDocClassTag */: return "class"; - case 333 /* SyntaxKind.JSDocPublicTag */: return "public"; - case 334 /* SyntaxKind.JSDocPrivateTag */: return "private"; - case 335 /* SyntaxKind.JSDocProtectedTag */: return "protected"; - case 336 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; - case 337 /* SyntaxKind.JSDocOverrideTag */: return "override"; - case 344 /* SyntaxKind.JSDocTemplateTag */: return "template"; - case 345 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; - case 340 /* SyntaxKind.JSDocParameterTag */: return "param"; - case 347 /* SyntaxKind.JSDocPropertyTag */: return "prop"; - case 338 /* SyntaxKind.JSDocCallbackTag */: return "callback"; - case 328 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; - case 329 /* SyntaxKind.JSDocImplementsTag */: return "implements"; + case 346 /* SyntaxKind.JSDocTypeTag */: return "type"; + case 344 /* SyntaxKind.JSDocReturnTag */: return "returns"; + case 345 /* SyntaxKind.JSDocThisTag */: return "this"; + case 342 /* SyntaxKind.JSDocEnumTag */: return "enum"; + case 333 /* SyntaxKind.JSDocAuthorTag */: return "author"; + case 335 /* SyntaxKind.JSDocClassTag */: return "class"; + case 336 /* SyntaxKind.JSDocPublicTag */: return "public"; + case 337 /* SyntaxKind.JSDocPrivateTag */: return "private"; + case 338 /* SyntaxKind.JSDocProtectedTag */: return "protected"; + case 339 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; + case 340 /* SyntaxKind.JSDocOverrideTag */: return "override"; + case 347 /* SyntaxKind.JSDocTemplateTag */: return "template"; + case 348 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; + case 343 /* SyntaxKind.JSDocParameterTag */: return "param"; + case 350 /* SyntaxKind.JSDocPropertyTag */: return "prop"; + case 341 /* SyntaxKind.JSDocCallbackTag */: return "callback"; + case 331 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; + case 332 /* SyntaxKind.JSDocImplementsTag */: return "implements"; default: return ts.Debug.fail("Unsupported kind: ".concat(ts.Debug.formatSyntaxKind(kind))); } @@ -27627,11 +27655,9 @@ var ts; rawTextScanner.setText("`" + rawText + "`"); break; case 15 /* SyntaxKind.TemplateHead */: - // tslint:disable-next-line no-invalid-template-strings rawTextScanner.setText("`" + rawText + "${"); break; case 16 /* SyntaxKind.TemplateMiddle */: - // tslint:disable-next-line no-invalid-template-strings rawTextScanner.setText("}" + rawText + "${"); break; case 17 /* SyntaxKind.TemplateTail */: @@ -27691,69 +27717,70 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) { return -2 /* TransformFlags.TypeExcludes */; } switch (kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return -2147450880 /* TransformFlags.ArrayLiteralOrCallOrNewExcludes */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return -1941676032 /* TransformFlags.ModuleExcludes */; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return -2147483648 /* TransformFlags.ParameterExcludes */; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return -2072174592 /* TransformFlags.ArrowFunctionExcludes */; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return -1937940480 /* TransformFlags.FunctionExcludes */; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return -2146893824 /* TransformFlags.VariableDeclarationListExcludes */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return -2147344384 /* TransformFlags.ClassExcludes */; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return -1937948672 /* TransformFlags.ConstructorExcludes */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return -2013249536 /* TransformFlags.PropertyExcludes */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return -2005057536 /* TransformFlags.MethodOrAccessorExcludes */; - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 163 /* SyntaxKind.TypeParameter */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return -2 /* TransformFlags.TypeExcludes */; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return -2147278848 /* TransformFlags.ObjectLiteralExcludes */; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return -2147418112 /* TransformFlags.CatchClauseExcludes */; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return -2147450880 /* TransformFlags.BindingPatternExcludes */; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: case 106 /* SyntaxKind.SuperKeyword */: return -2147483648 /* TransformFlags.OuterExpressionExcludes */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return -2147483648 /* TransformFlags.PropertyAccessExcludes */; default: return -2147483648 /* TransformFlags.NodeExcludes */; @@ -27953,9 +27980,10 @@ var ts; }; var buildInfo_1; var getAndCacheBuildInfo_1 = function (getText) { + var _a; if (buildInfo_1 === undefined) { var result = getText(); - buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false; + buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false; } return buildInfo_1 || undefined; }; @@ -27988,7 +28016,6 @@ var ts; return node; } ts.createInputFiles = createInputFiles; - // tslint:disable-next-line variable-name var SourceMapSource; /** * Create an external source map source file reference @@ -28009,7 +28036,7 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine; + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine, snippetElement = sourceEmitNode.snippetElement; if (!destEmitNode) destEmitNode = {}; // We are using `.slice()` here in case `destEmitNode.leadingComments` is pushed to later. @@ -28035,6 +28062,8 @@ var ts; } if (startsOnNewLine !== undefined) destEmitNode.startsOnNewLine = startsOnNewLine; + if (snippetElement !== undefined) + destEmitNode.snippetElement = snippetElement; return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -28060,7 +28089,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = (_a = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)))) !== null && _a !== void 0 ? _a : ts.Debug.fail("Could not determine parsed source file."); @@ -28778,6 +28807,8 @@ var ts; // - The verb (`next`, `throw`, or `return` method) to delegate to the expression // of a `yield*`. // - The result of evaluating the verb delegated to the expression of a `yield*`. + // g A temporary variable that holds onto the generator object until the generator + // is started, allowing it to also act as the `suspendedStart` state. // // functions: // verb(n) Creates a bound callback to the `step` function for opcode `n`. @@ -28816,7 +28847,7 @@ var ts; importName: "__generator", scoped: false, priority: 6, - text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" + text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" }; // ES Module Helpers ts.createBindingHelper = { @@ -29138,22 +29169,22 @@ var ts; ts.isExportModifier = isExportModifier; /* @internal */ function isAsyncModifier(node) { - return node.kind === 131 /* SyntaxKind.AsyncKeyword */; + return node.kind === 132 /* SyntaxKind.AsyncKeyword */; } ts.isAsyncModifier = isAsyncModifier; /* @internal */ function isAssertsKeyword(node) { - return node.kind === 128 /* SyntaxKind.AssertsKeyword */; + return node.kind === 129 /* SyntaxKind.AssertsKeyword */; } ts.isAssertsKeyword = isAssertsKeyword; /* @internal */ function isAwaitKeyword(node) { - return node.kind === 132 /* SyntaxKind.AwaitKeyword */; + return node.kind === 133 /* SyntaxKind.AwaitKeyword */; } ts.isAwaitKeyword = isAwaitKeyword; /* @internal */ function isReadonlyKeyword(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */; } ts.isReadonlyKeyword = isReadonlyKeyword; /* @internal */ @@ -29168,9 +29199,14 @@ var ts; ts.isAbstractModifier = isAbstractModifier; /* @internal */ function isOverrideModifier(node) { - return node.kind === 159 /* SyntaxKind.OverrideKeyword */; + return node.kind === 161 /* SyntaxKind.OverrideKeyword */; } ts.isOverrideModifier = isOverrideModifier; + /* @internal */ + function isAccessorModifier(node) { + return node.kind === 127 /* SyntaxKind.AccessorKeyword */; + } + ts.isAccessorModifier = isAccessorModifier; /*@internal*/ function isSuperKeyword(node) { return node.kind === 106 /* SyntaxKind.SuperKeyword */; @@ -29183,605 +29219,609 @@ var ts; ts.isImportKeyword = isImportKeyword; // Names function isQualifiedName(node) { - return node.kind === 161 /* SyntaxKind.QualifiedName */; + return node.kind === 163 /* SyntaxKind.QualifiedName */; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return node.kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isComputedPropertyName = isComputedPropertyName; // Signature elements function isTypeParameterDeclaration(node) { - return node.kind === 163 /* SyntaxKind.TypeParameter */; + return node.kind === 165 /* SyntaxKind.TypeParameter */; } ts.isTypeParameterDeclaration = isTypeParameterDeclaration; // TODO(rbuckton): Rename to 'isParameterDeclaration' function isParameter(node) { - return node.kind === 164 /* SyntaxKind.Parameter */; + return node.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 165 /* SyntaxKind.Decorator */; + return node.kind === 167 /* SyntaxKind.Decorator */; } ts.isDecorator = isDecorator; // TypeMember function isPropertySignature(node) { - return node.kind === 166 /* SyntaxKind.PropertySignature */; + return node.kind === 168 /* SyntaxKind.PropertySignature */; } ts.isPropertySignature = isPropertySignature; function isPropertyDeclaration(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } ts.isPropertyDeclaration = isPropertyDeclaration; function isMethodSignature(node) { - return node.kind === 168 /* SyntaxKind.MethodSignature */; + return node.kind === 170 /* SyntaxKind.MethodSignature */; } ts.isMethodSignature = isMethodSignature; function isMethodDeclaration(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } ts.isMethodDeclaration = isMethodDeclaration; function isClassStaticBlockDeclaration(node) { - return node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } ts.isClassStaticBlockDeclaration = isClassStaticBlockDeclaration; function isConstructorDeclaration(node) { - return node.kind === 171 /* SyntaxKind.Constructor */; + return node.kind === 173 /* SyntaxKind.Constructor */; } ts.isConstructorDeclaration = isConstructorDeclaration; function isGetAccessorDeclaration(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessorDeclaration = isGetAccessorDeclaration; function isSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessorDeclaration = isSetAccessorDeclaration; function isCallSignatureDeclaration(node) { - return node.kind === 174 /* SyntaxKind.CallSignature */; + return node.kind === 176 /* SyntaxKind.CallSignature */; } ts.isCallSignatureDeclaration = isCallSignatureDeclaration; function isConstructSignatureDeclaration(node) { - return node.kind === 175 /* SyntaxKind.ConstructSignature */; + return node.kind === 177 /* SyntaxKind.ConstructSignature */; } ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration; function isIndexSignatureDeclaration(node) { - return node.kind === 176 /* SyntaxKind.IndexSignature */; + return node.kind === 178 /* SyntaxKind.IndexSignature */; } ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration; // Type function isTypePredicateNode(node) { - return node.kind === 177 /* SyntaxKind.TypePredicate */; + return node.kind === 179 /* SyntaxKind.TypePredicate */; } ts.isTypePredicateNode = isTypePredicateNode; function isTypeReferenceNode(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */; + return node.kind === 180 /* SyntaxKind.TypeReference */; } ts.isTypeReferenceNode = isTypeReferenceNode; function isFunctionTypeNode(node) { - return node.kind === 179 /* SyntaxKind.FunctionType */; + return node.kind === 181 /* SyntaxKind.FunctionType */; } ts.isFunctionTypeNode = isFunctionTypeNode; function isConstructorTypeNode(node) { - return node.kind === 180 /* SyntaxKind.ConstructorType */; + return node.kind === 182 /* SyntaxKind.ConstructorType */; } ts.isConstructorTypeNode = isConstructorTypeNode; function isTypeQueryNode(node) { - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isTypeQueryNode = isTypeQueryNode; function isTypeLiteralNode(node) { - return node.kind === 182 /* SyntaxKind.TypeLiteral */; + return node.kind === 184 /* SyntaxKind.TypeLiteral */; } ts.isTypeLiteralNode = isTypeLiteralNode; function isArrayTypeNode(node) { - return node.kind === 183 /* SyntaxKind.ArrayType */; + return node.kind === 185 /* SyntaxKind.ArrayType */; } ts.isArrayTypeNode = isArrayTypeNode; function isTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */; + return node.kind === 186 /* SyntaxKind.TupleType */; } ts.isTupleTypeNode = isTupleTypeNode; function isNamedTupleMember(node) { - return node.kind === 197 /* SyntaxKind.NamedTupleMember */; + return node.kind === 199 /* SyntaxKind.NamedTupleMember */; } ts.isNamedTupleMember = isNamedTupleMember; function isOptionalTypeNode(node) { - return node.kind === 185 /* SyntaxKind.OptionalType */; + return node.kind === 187 /* SyntaxKind.OptionalType */; } ts.isOptionalTypeNode = isOptionalTypeNode; function isRestTypeNode(node) { - return node.kind === 186 /* SyntaxKind.RestType */; + return node.kind === 188 /* SyntaxKind.RestType */; } ts.isRestTypeNode = isRestTypeNode; function isUnionTypeNode(node) { - return node.kind === 187 /* SyntaxKind.UnionType */; + return node.kind === 189 /* SyntaxKind.UnionType */; } ts.isUnionTypeNode = isUnionTypeNode; function isIntersectionTypeNode(node) { - return node.kind === 188 /* SyntaxKind.IntersectionType */; + return node.kind === 190 /* SyntaxKind.IntersectionType */; } ts.isIntersectionTypeNode = isIntersectionTypeNode; function isConditionalTypeNode(node) { - return node.kind === 189 /* SyntaxKind.ConditionalType */; + return node.kind === 191 /* SyntaxKind.ConditionalType */; } ts.isConditionalTypeNode = isConditionalTypeNode; function isInferTypeNode(node) { - return node.kind === 190 /* SyntaxKind.InferType */; + return node.kind === 192 /* SyntaxKind.InferType */; } ts.isInferTypeNode = isInferTypeNode; function isParenthesizedTypeNode(node) { - return node.kind === 191 /* SyntaxKind.ParenthesizedType */; + return node.kind === 193 /* SyntaxKind.ParenthesizedType */; } ts.isParenthesizedTypeNode = isParenthesizedTypeNode; function isThisTypeNode(node) { - return node.kind === 192 /* SyntaxKind.ThisType */; + return node.kind === 194 /* SyntaxKind.ThisType */; } ts.isThisTypeNode = isThisTypeNode; function isTypeOperatorNode(node) { - return node.kind === 193 /* SyntaxKind.TypeOperator */; + return node.kind === 195 /* SyntaxKind.TypeOperator */; } ts.isTypeOperatorNode = isTypeOperatorNode; function isIndexedAccessTypeNode(node) { - return node.kind === 194 /* SyntaxKind.IndexedAccessType */; + return node.kind === 196 /* SyntaxKind.IndexedAccessType */; } ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode; function isMappedTypeNode(node) { - return node.kind === 195 /* SyntaxKind.MappedType */; + return node.kind === 197 /* SyntaxKind.MappedType */; } ts.isMappedTypeNode = isMappedTypeNode; function isLiteralTypeNode(node) { - return node.kind === 196 /* SyntaxKind.LiteralType */; + return node.kind === 198 /* SyntaxKind.LiteralType */; } ts.isLiteralTypeNode = isLiteralTypeNode; function isImportTypeNode(node) { - return node.kind === 200 /* SyntaxKind.ImportType */; + return node.kind === 202 /* SyntaxKind.ImportType */; } ts.isImportTypeNode = isImportTypeNode; function isTemplateLiteralTypeSpan(node) { - return node.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */; + return node.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */; } ts.isTemplateLiteralTypeSpan = isTemplateLiteralTypeSpan; function isTemplateLiteralTypeNode(node) { - return node.kind === 198 /* SyntaxKind.TemplateLiteralType */; + return node.kind === 200 /* SyntaxKind.TemplateLiteralType */; } ts.isTemplateLiteralTypeNode = isTemplateLiteralTypeNode; // Binding patterns function isObjectBindingPattern(node) { - return node.kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return node.kind === 203 /* SyntaxKind.ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 202 /* SyntaxKind.ArrayBindingPattern */; + return node.kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 203 /* SyntaxKind.BindingElement */; + return node.kind === 205 /* SyntaxKind.BindingElement */; } ts.isBindingElement = isBindingElement; // Expression function isArrayLiteralExpression(node) { - return node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; + return node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertionExpression(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } ts.isTypeAssertionExpression = isTypeAssertionExpression; function isParenthesizedExpression(node) { - return node.kind === 212 /* SyntaxKind.ParenthesizedExpression */; + return node.kind === 214 /* SyntaxKind.ParenthesizedExpression */; } ts.isParenthesizedExpression = isParenthesizedExpression; function isFunctionExpression(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 216 /* SyntaxKind.TypeOfExpression */; + return node.kind === 218 /* SyntaxKind.TypeOfExpression */; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 217 /* SyntaxKind.VoidExpression */; + return node.kind === 219 /* SyntaxKind.VoidExpression */; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 218 /* SyntaxKind.AwaitExpression */; + return node.kind === 220 /* SyntaxKind.AwaitExpression */; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */; + return node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 220 /* SyntaxKind.PostfixUnaryExpression */; + return node.kind === 222 /* SyntaxKind.PostfixUnaryExpression */; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 222 /* SyntaxKind.ConditionalExpression */; + return node.kind === 224 /* SyntaxKind.ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 223 /* SyntaxKind.TemplateExpression */; + return node.kind === 225 /* SyntaxKind.TemplateExpression */; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 224 /* SyntaxKind.YieldExpression */; + return node.kind === 226 /* SyntaxKind.YieldExpression */; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 225 /* SyntaxKind.SpreadElement */; + return node.kind === 227 /* SyntaxKind.SpreadElement */; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 226 /* SyntaxKind.ClassExpression */; + return node.kind === 228 /* SyntaxKind.ClassExpression */; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 227 /* SyntaxKind.OmittedExpression */; + return node.kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 229 /* SyntaxKind.AsExpression */; + return node.kind === 231 /* SyntaxKind.AsExpression */; } ts.isAsExpression = isAsExpression; + function isSatisfiesExpression(node) { + return node.kind === 235 /* SyntaxKind.SatisfiesExpression */; + } + ts.isSatisfiesExpression = isSatisfiesExpression; function isNonNullExpression(node) { - return node.kind === 230 /* SyntaxKind.NonNullExpression */; + return node.kind === 232 /* SyntaxKind.NonNullExpression */; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 231 /* SyntaxKind.MetaProperty */; + return node.kind === 233 /* SyntaxKind.MetaProperty */; } ts.isMetaProperty = isMetaProperty; function isSyntheticExpression(node) { - return node.kind === 232 /* SyntaxKind.SyntheticExpression */; + return node.kind === 234 /* SyntaxKind.SyntheticExpression */; } ts.isSyntheticExpression = isSyntheticExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 350 /* SyntaxKind.PartiallyEmittedExpression */; + return node.kind === 353 /* SyntaxKind.PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isCommaListExpression(node) { - return node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaListExpression = isCommaListExpression; // Misc function isTemplateSpan(node) { - return node.kind === 233 /* SyntaxKind.TemplateSpan */; + return node.kind === 236 /* SyntaxKind.TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 234 /* SyntaxKind.SemicolonClassElement */; + return node.kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isSemicolonClassElement = isSemicolonClassElement; // Elements function isBlock(node) { - return node.kind === 235 /* SyntaxKind.Block */; + return node.kind === 238 /* SyntaxKind.Block */; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 237 /* SyntaxKind.VariableStatement */; + return node.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 236 /* SyntaxKind.EmptyStatement */; + return node.kind === 239 /* SyntaxKind.EmptyStatement */; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */; + return node.kind === 241 /* SyntaxKind.ExpressionStatement */; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 239 /* SyntaxKind.IfStatement */; + return node.kind === 242 /* SyntaxKind.IfStatement */; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 240 /* SyntaxKind.DoStatement */; + return node.kind === 243 /* SyntaxKind.DoStatement */; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 241 /* SyntaxKind.WhileStatement */; + return node.kind === 244 /* SyntaxKind.WhileStatement */; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 242 /* SyntaxKind.ForStatement */; + return node.kind === 245 /* SyntaxKind.ForStatement */; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */; } ts.isBreakStatement = isBreakStatement; function isReturnStatement(node) { - return node.kind === 247 /* SyntaxKind.ReturnStatement */; + return node.kind === 250 /* SyntaxKind.ReturnStatement */; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 248 /* SyntaxKind.WithStatement */; + return node.kind === 251 /* SyntaxKind.WithStatement */; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 249 /* SyntaxKind.SwitchStatement */; + return node.kind === 252 /* SyntaxKind.SwitchStatement */; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 250 /* SyntaxKind.LabeledStatement */; + return node.kind === 253 /* SyntaxKind.LabeledStatement */; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 251 /* SyntaxKind.ThrowStatement */; + return node.kind === 254 /* SyntaxKind.ThrowStatement */; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 252 /* SyntaxKind.TryStatement */; + return node.kind === 255 /* SyntaxKind.TryStatement */; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 253 /* SyntaxKind.DebuggerStatement */; + return node.kind === 256 /* SyntaxKind.DebuggerStatement */; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 255 /* SyntaxKind.VariableDeclarationList */; + return node.kind === 258 /* SyntaxKind.VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 256 /* SyntaxKind.FunctionDeclaration */; + return node.kind === 259 /* SyntaxKind.FunctionDeclaration */; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 257 /* SyntaxKind.ClassDeclaration */; + return node.kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return node.kind === 261 /* SyntaxKind.InterfaceDeclaration */; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */; + return node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 262 /* SyntaxKind.ModuleBlock */; + return node.kind === 265 /* SyntaxKind.ModuleBlock */; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 263 /* SyntaxKind.CaseBlock */; + return node.kind === 266 /* SyntaxKind.CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */; + return node.kind === 270 /* SyntaxKind.ImportClause */; } ts.isImportClause = isImportClause; function isImportTypeAssertionContainer(node) { - return node.kind === 295 /* SyntaxKind.ImportTypeAssertionContainer */; + return node.kind === 298 /* SyntaxKind.ImportTypeAssertionContainer */; } ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer; function isAssertClause(node) { - return node.kind === 293 /* SyntaxKind.AssertClause */; + return node.kind === 296 /* SyntaxKind.AssertClause */; } ts.isAssertClause = isAssertClause; function isAssertEntry(node) { - return node.kind === 294 /* SyntaxKind.AssertEntry */; + return node.kind === 297 /* SyntaxKind.AssertEntry */; } ts.isAssertEntry = isAssertEntry; function isNamespaceImport(node) { - return node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamespaceImport = isNamespaceImport; function isNamespaceExport(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */; } ts.isNamespaceExport = isNamespaceExport; function isNamedImports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */; + return node.kind === 272 /* SyntaxKind.NamedImports */; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 270 /* SyntaxKind.ImportSpecifier */; + return node.kind === 273 /* SyntaxKind.ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 271 /* SyntaxKind.ExportAssignment */; + return node.kind === 274 /* SyntaxKind.ExportAssignment */; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 272 /* SyntaxKind.ExportDeclaration */; + return node.kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 275 /* SyntaxKind.ExportSpecifier */; + return node.kind === 278 /* SyntaxKind.ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 276 /* SyntaxKind.MissingDeclaration */; + return node.kind === 279 /* SyntaxKind.MissingDeclaration */; } ts.isMissingDeclaration = isMissingDeclaration; function isNotEmittedStatement(node) { - return node.kind === 349 /* SyntaxKind.NotEmittedStatement */; + return node.kind === 352 /* SyntaxKind.NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ function isSyntheticReference(node) { - return node.kind === 354 /* SyntaxKind.SyntheticReferenceExpression */; + return node.kind === 357 /* SyntaxKind.SyntheticReferenceExpression */; } ts.isSyntheticReference = isSyntheticReference; /* @internal */ function isMergeDeclarationMarker(node) { - return node.kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return node.kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } ts.isMergeDeclarationMarker = isMergeDeclarationMarker; /* @internal */ function isEndOfDeclarationMarker(node) { - return node.kind === 353 /* SyntaxKind.EndOfDeclarationMarker */; + return node.kind === 356 /* SyntaxKind.EndOfDeclarationMarker */; } ts.isEndOfDeclarationMarker = isEndOfDeclarationMarker; // Module References function isExternalModuleReference(node) { - return node.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleReference = isExternalModuleReference; // JSX function isJsxElement(node) { - return node.kind === 278 /* SyntaxKind.JsxElement */; + return node.kind === 281 /* SyntaxKind.JsxElement */; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return node.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 280 /* SyntaxKind.JsxOpeningElement */; + return node.kind === 283 /* SyntaxKind.JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 281 /* SyntaxKind.JsxClosingElement */; + return node.kind === 284 /* SyntaxKind.JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 282 /* SyntaxKind.JsxFragment */; + return node.kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 283 /* SyntaxKind.JsxOpeningFragment */; + return node.kind === 286 /* SyntaxKind.JsxOpeningFragment */; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 284 /* SyntaxKind.JsxClosingFragment */; + return node.kind === 287 /* SyntaxKind.JsxClosingFragment */; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */; + return node.kind === 288 /* SyntaxKind.JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 286 /* SyntaxKind.JsxAttributes */; + return node.kind === 289 /* SyntaxKind.JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 288 /* SyntaxKind.JsxExpression */; + return node.kind === 291 /* SyntaxKind.JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 289 /* SyntaxKind.CaseClause */; + return node.kind === 292 /* SyntaxKind.CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 290 /* SyntaxKind.DefaultClause */; + return node.kind === 293 /* SyntaxKind.DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 291 /* SyntaxKind.HeritageClause */; + return node.kind === 294 /* SyntaxKind.HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 296 /* SyntaxKind.PropertyAssignment */; + return node.kind === 299 /* SyntaxKind.PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 298 /* SyntaxKind.SpreadAssignment */; + return node.kind === 301 /* SyntaxKind.SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } ts.isEnumMember = isEnumMember; // Unparsed // TODO(rbuckton): isUnparsedPrologue function isUnparsedPrepend(node) { - return node.kind === 301 /* SyntaxKind.UnparsedPrepend */; + return node.kind === 304 /* SyntaxKind.UnparsedPrepend */; } ts.isUnparsedPrepend = isUnparsedPrepend; // TODO(rbuckton): isUnparsedText @@ -29789,176 +29829,176 @@ var ts; // TODO(rbuckton): isUnparsedSyntheticReference // Top-level nodes function isSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */; + return node.kind === 308 /* SyntaxKind.SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 306 /* SyntaxKind.Bundle */; + return node.kind === 309 /* SyntaxKind.Bundle */; } ts.isBundle = isBundle; function isUnparsedSource(node) { - return node.kind === 307 /* SyntaxKind.UnparsedSource */; + return node.kind === 310 /* SyntaxKind.UnparsedSource */; } ts.isUnparsedSource = isUnparsedSource; // TODO(rbuckton): isInputFiles // JSDoc Elements function isJSDocTypeExpression(node) { - return node.kind === 309 /* SyntaxKind.JSDocTypeExpression */; + return node.kind === 312 /* SyntaxKind.JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocNameReference(node) { - return node.kind === 310 /* SyntaxKind.JSDocNameReference */; + return node.kind === 313 /* SyntaxKind.JSDocNameReference */; } ts.isJSDocNameReference = isJSDocNameReference; function isJSDocMemberName(node) { - return node.kind === 311 /* SyntaxKind.JSDocMemberName */; + return node.kind === 314 /* SyntaxKind.JSDocMemberName */; } ts.isJSDocMemberName = isJSDocMemberName; function isJSDocLink(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */; + return node.kind === 327 /* SyntaxKind.JSDocLink */; } ts.isJSDocLink = isJSDocLink; function isJSDocLinkCode(node) { - return node.kind === 325 /* SyntaxKind.JSDocLinkCode */; + return node.kind === 328 /* SyntaxKind.JSDocLinkCode */; } ts.isJSDocLinkCode = isJSDocLinkCode; function isJSDocLinkPlain(node) { - return node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkPlain = isJSDocLinkPlain; function isJSDocAllType(node) { - return node.kind === 312 /* SyntaxKind.JSDocAllType */; + return node.kind === 315 /* SyntaxKind.JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 313 /* SyntaxKind.JSDocUnknownType */; + return node.kind === 316 /* SyntaxKind.JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 314 /* SyntaxKind.JSDocNullableType */; + return node.kind === 317 /* SyntaxKind.JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 315 /* SyntaxKind.JSDocNonNullableType */; + return node.kind === 318 /* SyntaxKind.JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return node.kind === 319 /* SyntaxKind.JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 317 /* SyntaxKind.JSDocFunctionType */; + return node.kind === 320 /* SyntaxKind.JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDocNamepathType(node) { - return node.kind === 319 /* SyntaxKind.JSDocNamepathType */; + return node.kind === 322 /* SyntaxKind.JSDocNamepathType */; } ts.isJSDocNamepathType = isJSDocNamepathType; function isJSDoc(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */; + return node.kind === 323 /* SyntaxKind.JSDoc */; } ts.isJSDoc = isJSDoc; function isJSDocTypeLiteral(node) { - return node.kind === 322 /* SyntaxKind.JSDocTypeLiteral */; + return node.kind === 325 /* SyntaxKind.JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; function isJSDocSignature(node) { - return node.kind === 323 /* SyntaxKind.JSDocSignature */; + return node.kind === 326 /* SyntaxKind.JSDocSignature */; } ts.isJSDocSignature = isJSDocSignature; // JSDoc Tags function isJSDocAugmentsTag(node) { - return node.kind === 328 /* SyntaxKind.JSDocAugmentsTag */; + return node.kind === 331 /* SyntaxKind.JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocAuthorTag(node) { - return node.kind === 330 /* SyntaxKind.JSDocAuthorTag */; + return node.kind === 333 /* SyntaxKind.JSDocAuthorTag */; } ts.isJSDocAuthorTag = isJSDocAuthorTag; function isJSDocClassTag(node) { - return node.kind === 332 /* SyntaxKind.JSDocClassTag */; + return node.kind === 335 /* SyntaxKind.JSDocClassTag */; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocCallbackTag(node) { - return node.kind === 338 /* SyntaxKind.JSDocCallbackTag */; + return node.kind === 341 /* SyntaxKind.JSDocCallbackTag */; } ts.isJSDocCallbackTag = isJSDocCallbackTag; function isJSDocPublicTag(node) { - return node.kind === 333 /* SyntaxKind.JSDocPublicTag */; + return node.kind === 336 /* SyntaxKind.JSDocPublicTag */; } ts.isJSDocPublicTag = isJSDocPublicTag; function isJSDocPrivateTag(node) { - return node.kind === 334 /* SyntaxKind.JSDocPrivateTag */; + return node.kind === 337 /* SyntaxKind.JSDocPrivateTag */; } ts.isJSDocPrivateTag = isJSDocPrivateTag; function isJSDocProtectedTag(node) { - return node.kind === 335 /* SyntaxKind.JSDocProtectedTag */; + return node.kind === 338 /* SyntaxKind.JSDocProtectedTag */; } ts.isJSDocProtectedTag = isJSDocProtectedTag; function isJSDocReadonlyTag(node) { - return node.kind === 336 /* SyntaxKind.JSDocReadonlyTag */; + return node.kind === 339 /* SyntaxKind.JSDocReadonlyTag */; } ts.isJSDocReadonlyTag = isJSDocReadonlyTag; function isJSDocOverrideTag(node) { - return node.kind === 337 /* SyntaxKind.JSDocOverrideTag */; + return node.kind === 340 /* SyntaxKind.JSDocOverrideTag */; } ts.isJSDocOverrideTag = isJSDocOverrideTag; function isJSDocDeprecatedTag(node) { - return node.kind === 331 /* SyntaxKind.JSDocDeprecatedTag */; + return node.kind === 334 /* SyntaxKind.JSDocDeprecatedTag */; } ts.isJSDocDeprecatedTag = isJSDocDeprecatedTag; function isJSDocSeeTag(node) { - return node.kind === 346 /* SyntaxKind.JSDocSeeTag */; + return node.kind === 349 /* SyntaxKind.JSDocSeeTag */; } ts.isJSDocSeeTag = isJSDocSeeTag; function isJSDocEnumTag(node) { - return node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocEnumTag = isJSDocEnumTag; function isJSDocParameterTag(node) { - return node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 341 /* SyntaxKind.JSDocReturnTag */; + return node.kind === 344 /* SyntaxKind.JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocThisTag(node) { - return node.kind === 342 /* SyntaxKind.JSDocThisTag */; + return node.kind === 345 /* SyntaxKind.JSDocThisTag */; } ts.isJSDocThisTag = isJSDocThisTag; function isJSDocTypeTag(node) { - return node.kind === 343 /* SyntaxKind.JSDocTypeTag */; + return node.kind === 346 /* SyntaxKind.JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 344 /* SyntaxKind.JSDocTemplateTag */; + return node.kind === 347 /* SyntaxKind.JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocUnknownTag(node) { - return node.kind === 327 /* SyntaxKind.JSDocTag */; + return node.kind === 330 /* SyntaxKind.JSDocTag */; } ts.isJSDocUnknownTag = isJSDocUnknownTag; function isJSDocPropertyTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocImplementsTag(node) { - return node.kind === 329 /* SyntaxKind.JSDocImplementsTag */; + return node.kind === 332 /* SyntaxKind.JSDocImplementsTag */; } ts.isJSDocImplementsTag = isJSDocImplementsTag; // Synthesized list /* @internal */ function isSyntaxList(n) { - return n.kind === 348 /* SyntaxKind.SyntaxList */; + return n.kind === 351 /* SyntaxKind.SyntaxList */; } ts.isSyntaxList = isSyntaxList; })(ts || (ts = {})); @@ -30157,14 +30197,14 @@ var ts; ts.Debug.failBadSyntaxKind(property.name, "Private identifiers are not allowed in object literals."); } switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return createExpressionForAccessorDeclaration(factory, node.properties, property, receiver, !!node.multiLine); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return createExpressionForPropertyAssignment(factory, property, receiver); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(factory, property, receiver); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return createExpressionForMethodDeclaration(factory, property, receiver); } } @@ -30272,8 +30312,8 @@ var ts; } ts.startsWithUseStrict = startsWithUseStrict; function isCommaSequence(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || - node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || + node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaSequence = isCommaSequence; function isJSDocTypeAssertion(node) { @@ -30291,17 +30331,18 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 15 /* OuterExpressionKinds.All */; } switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: if (kinds & 16 /* OuterExpressionKinds.ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) { return false; } return (kinds & 1 /* OuterExpressionKinds.Parentheses */) !== 0; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return (kinds & 2 /* OuterExpressionKinds.TypeAssertions */) !== 0; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return (kinds & 4 /* OuterExpressionKinds.NonNullAssertions */) !== 0; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return (kinds & 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */) !== 0; } return false; @@ -30422,10 +30463,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : factory.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 266 /* SyntaxKind.ImportDeclaration */ && node.importClause) { + if (node.kind === 269 /* SyntaxKind.ImportDeclaration */ && node.importClause) { return factory.getGeneratedNameForNode(node); } - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { return factory.getGeneratedNameForNode(node); } return undefined; @@ -30544,7 +30585,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -30556,11 +30597,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -30592,12 +30633,12 @@ var ts; */ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 225 /* SyntaxKind.SpreadElement */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 227 /* SyntaxKind.SpreadElement */: + case 301 /* SyntaxKind.SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -30615,7 +30656,7 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -30630,7 +30671,7 @@ var ts; : propertyName; } break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -30645,7 +30686,7 @@ var ts; : propertyName; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` if (bindingElement.name && ts.isPrivateIdentifier(bindingElement.name)) { return ts.Debug.failBadSyntaxKind(bindingElement.name); @@ -30668,13 +30709,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -30695,46 +30736,46 @@ var ts; ts.getJSDocTypeAliasName = getJSDocTypeAliasName; function canHaveIllegalType(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalType = canHaveIllegalType; function canHaveIllegalTypeParameters(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalTypeParameters = canHaveIllegalTypeParameters; function canHaveIllegalDecorators(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.canHaveIllegalDecorators = canHaveIllegalDecorators; function canHaveIllegalModifiers(node) { var kind = node.kind; - return kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 179 /* SyntaxKind.FunctionType */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 181 /* SyntaxKind.FunctionType */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.canHaveIllegalModifiers = canHaveIllegalModifiers; ts.isTypeNodeOrTypeParameterDeclaration = ts.or(ts.isTypeNode, ts.isTypeParameterDeclaration); @@ -31008,6 +31049,83 @@ var ts; return ts.setTextRange(factory.createNodeArray([], nodes.hasTrailingComma), nodes); } ts.elideNodes = elideNodes; + /** + * Gets the node from which a name should be generated. + */ + function getNodeForGeneratedName(name) { + if (name.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) { + var autoGenerateId = name.autoGenerateId; + var node = name; + var original = node.original; + while (original) { + node = original; + // if "node" is a different generated name (having a different "autoGenerateId"), use it and stop traversing. + if (ts.isMemberName(node) + && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) + && node.autoGenerateId !== autoGenerateId) { + break; + } + original = node.original; + } + // otherwise, return the original node for the source + return node; + } + return name; + } + ts.getNodeForGeneratedName = getNodeForGeneratedName; + function formatGeneratedNamePart(part, generateName) { + return typeof part === "object" ? formatGeneratedName(/*privateName*/ false, part.prefix, part.node, part.suffix, generateName) : + typeof part === "string" ? part.length > 0 && part.charCodeAt(0) === 35 /* CharacterCodes.hash */ ? part.slice(1) : part : + ""; + } + ts.formatGeneratedNamePart = formatGeneratedNamePart; + function formatIdentifier(name, generateName) { + return typeof name === "string" ? name : + formatIdentifierWorker(name, ts.Debug.checkDefined(generateName)); + } + function formatIdentifierWorker(node, generateName) { + return ts.isGeneratedPrivateIdentifier(node) ? generateName(node).slice(1) : + ts.isGeneratedIdentifier(node) ? generateName(node) : + ts.isPrivateIdentifier(node) ? node.escapedText.slice(1) : + ts.idText(node); + } + function formatGeneratedName(privateName, prefix, baseName, suffix, generateName) { + prefix = formatGeneratedNamePart(prefix, generateName); + suffix = formatGeneratedNamePart(suffix, generateName); + baseName = formatIdentifier(baseName, generateName); + return "".concat(privateName ? "#" : "").concat(prefix).concat(baseName).concat(suffix); + } + ts.formatGeneratedName = formatGeneratedName; + /** + * Creates a private backing field for an `accessor` {@link PropertyDeclaration}. + */ + function createAccessorPropertyBackingField(factory, node, modifiers, initializer) { + return factory.updatePropertyDeclaration(node, modifiers, factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"), + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, initializer); + } + ts.createAccessorPropertyBackingField = createAccessorPropertyBackingField; + /** + * Creates a {@link GetAccessorDeclaration} that reads from a private backing field. + */ + function createAccessorPropertyGetRedirector(factory, node, modifiers, name) { + return factory.createGetAccessorDeclaration(modifiers, name, [], + /*type*/ undefined, factory.createBlock([ + factory.createReturnStatement(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"))) + ])); + } + ts.createAccessorPropertyGetRedirector = createAccessorPropertyGetRedirector; + /** + * Creates a {@link SetAccessorDeclaration} that writes to a private backing field. + */ + function createAccessorPropertySetRedirector(factory, node, modifiers, name) { + return factory.createSetAccessorDeclaration(modifiers, name, [factory.createParameterDeclaration( + /*modifiers*/ undefined, + /*dotdotDotToken*/ undefined, "value")], factory.createBlock([ + factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage")), factory.createIdentifier("value"))) + ])); + } + ts.createAccessorPropertySetRedirector = createAccessorPropertySetRedirector; })(ts || (ts = {})); var ts; (function (ts) { @@ -31017,47 +31135,48 @@ var ts; ts.setTextRange = setTextRange; function canHaveModifiers(node) { var kind = node.kind; - return kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 180 /* SyntaxKind.ConstructorType */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 272 /* SyntaxKind.ExportDeclaration */; + return kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 182 /* SyntaxKind.ConstructorType */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.canHaveModifiers = canHaveModifiers; function canHaveDecorators(node) { var kind = node.kind; - return kind === 164 /* SyntaxKind.Parameter */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 257 /* SyntaxKind.ClassDeclaration */; + return kind === 166 /* SyntaxKind.Parameter */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.canHaveDecorators = canHaveDecorators; })(ts || (ts = {})); var ts; (function (ts) { + var _a; var SignatureFlags; (function (SignatureFlags) { SignatureFlags[SignatureFlags["None"] = 0] = "None"; @@ -31145,6 +31264,718 @@ var ts; function isImportMeta(node) { return ts.isMetaProperty(node) && node.keywordToken === 100 /* SyntaxKind.ImportKeyword */ && node.name.escapedText === "meta"; } + var forEachChildTable = (_a = {}, + _a[163 /* SyntaxKind.QualifiedName */] = function forEachChildInQualifiedName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[165 /* SyntaxKind.TypeParameter */] = function forEachChildInTypeParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || + visitNode(cbNode, node.expression); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[166 /* SyntaxKind.Parameter */] = function forEachChildInParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[168 /* SyntaxKind.PropertySignature */] = function forEachChildInPropertySignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[299 /* SyntaxKind.PropertyAssignment */] = function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.initializer); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[205 /* SyntaxKind.BindingElement */] = function forEachChildInBindingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function forEachChildInIndexSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function forEachChildInConstructorType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[181 /* SyntaxKind.FunctionType */] = function forEachChildInFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[176 /* SyntaxKind.CallSignature */] = forEachChildInCallOrConstructSignature, + _a[177 /* SyntaxKind.ConstructSignature */] = forEachChildInCallOrConstructSignature, + _a[171 /* SyntaxKind.MethodDeclaration */] = function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function forEachChildInMethodSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[173 /* SyntaxKind.Constructor */] = function forEachChildInConstructor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function forEachChildInGetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function forEachChildInSetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function forEachChildInFunctionExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function forEachChildInArrowFunction(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.equalsGreaterThanToken) || + visitNode(cbNode, node.body); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.body); + }, + _a[180 /* SyntaxKind.TypeReference */] = function forEachChildInTypeReference(node, cbNode, cbNodes) { + return visitNode(cbNode, node.typeName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[179 /* SyntaxKind.TypePredicate */] = function forEachChildInTypePredicate(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertsModifier) || + visitNode(cbNode, node.parameterName) || + visitNode(cbNode, node.type); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function forEachChildInTypeQuery(node, cbNode, cbNodes) { + return visitNode(cbNode, node.exprName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function forEachChildInTypeLiteral(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.members); + }, + _a[185 /* SyntaxKind.ArrayType */] = function forEachChildInArrayType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.elementType); + }, + _a[186 /* SyntaxKind.TupleType */] = function forEachChildInTupleType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[189 /* SyntaxKind.UnionType */] = forEachChildInUnionOrIntersectionType, + _a[190 /* SyntaxKind.IntersectionType */] = forEachChildInUnionOrIntersectionType, + _a[191 /* SyntaxKind.ConditionalType */] = function forEachChildInConditionalType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.checkType) || + visitNode(cbNode, node.extendsType) || + visitNode(cbNode, node.trueType) || + visitNode(cbNode, node.falseType); + }, + _a[192 /* SyntaxKind.InferType */] = function forEachChildInInferType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.typeParameter); + }, + _a[202 /* SyntaxKind.ImportType */] = function forEachChildInImportType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.assertions) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertClause); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[195 /* SyntaxKind.TypeOperator */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[196 /* SyntaxKind.IndexedAccessType */] = function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.objectType) || + visitNode(cbNode, node.indexType); + }, + _a[197 /* SyntaxKind.MappedType */] = function forEachChildInMappedType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.readonlyToken) || + visitNode(cbNode, node.typeParameter) || + visitNode(cbNode, node.nameType) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[198 /* SyntaxKind.LiteralType */] = function forEachChildInLiteralType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.literal); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type); + }, + _a[203 /* SyntaxKind.ObjectBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.name); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.argumentExpression); + }, + _a[210 /* SyntaxKind.CallExpression */] = forEachChildInCallOrNewExpression, + _a[211 /* SyntaxKind.NewExpression */] = forEachChildInCallOrNewExpression, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.template); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function forEachChildInVoidExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function forEachChildInYieldExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + }, + _a[231 /* SyntaxKind.AsExpression */] = function forEachChildInAsExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.type); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function forEachChildInMetaProperty(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function forEachChildInSpreadElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[238 /* SyntaxKind.Block */] = forEachChildInBlock, + _a[265 /* SyntaxKind.ModuleBlock */] = forEachChildInBlock, + _a[308 /* SyntaxKind.SourceFile */] = function forEachChildInSourceFile(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function forEachChildInVariableStatement(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.declarations); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[242 /* SyntaxKind.IfStatement */] = function forEachChildInIfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + }, + _a[243 /* SyntaxKind.DoStatement */] = function forEachChildInDoStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function forEachChildInWhileStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[245 /* SyntaxKind.ForStatement */] = function forEachChildInForStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || + visitNode(cbNode, node.statement); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function forEachChildInForInStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function forEachChildInForOfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = forEachChildInContinueOrBreakStatement, + _a[249 /* SyntaxKind.BreakStatement */] = forEachChildInContinueOrBreakStatement, + _a[250 /* SyntaxKind.ReturnStatement */] = function forEachChildInReturnStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[251 /* SyntaxKind.WithStatement */] = function forEachChildInWithStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function forEachChildInCaseBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.clauses); + }, + _a[292 /* SyntaxKind.CaseClause */] = function forEachChildInCaseClause(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.statements); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function forEachChildInDefaultClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function forEachChildInThrowStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[255 /* SyntaxKind.TryStatement */] = function forEachChildInTryStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + }, + _a[295 /* SyntaxKind.CatchClause */] = function forEachChildInCatchClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); + }, + _a[167 /* SyntaxKind.Decorator */] = function forEachChildInDecorator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = forEachChildInClassDeclarationOrExpression, + _a[228 /* SyntaxKind.ClassExpression */] = forEachChildInClassDeclarationOrExpression, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[302 /* SyntaxKind.EnumMember */] = function forEachChildInEnumMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function forEachChildInImportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[270 /* SyntaxKind.ImportClause */] = function forEachChildInImportClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); + }, + _a[296 /* SyntaxKind.AssertClause */] = function forEachChildInAssertClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function forEachChildInAssertEntry(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.value); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNode(cbNode, node.name); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[272 /* SyntaxKind.NamedImports */] = forEachChildInNamedImportsOrExports, + _a[276 /* SyntaxKind.NamedExports */] = forEachChildInNamedImportsOrExports, + _a[275 /* SyntaxKind.ExportDeclaration */] = function forEachChildInExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[278 /* SyntaxKind.ExportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[274 /* SyntaxKind.ExportAssignment */] = function forEachChildInExportAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function forEachChildInTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[236 /* SyntaxKind.TemplateSpan */] = function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.literal); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.literal); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function forEachChildInHeritageClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[280 /* SyntaxKind.ExternalModuleReference */] = function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[279 /* SyntaxKind.MissingDeclaration */] = function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function forEachChildInCommaListExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[281 /* SyntaxKind.JsxElement */] = function forEachChildInJsxElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingElement) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingElement); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function forEachChildInJsxFragment(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[283 /* SyntaxKind.JsxOpeningElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[289 /* SyntaxKind.JsxAttributes */] = function forEachChildInJsxAttributes(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function forEachChildInJsxExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tagName); + }, + _a[187 /* SyntaxKind.OptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[188 /* SyntaxKind.RestType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[312 /* SyntaxKind.JSDocTypeExpression */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[318 /* SyntaxKind.JSDocNonNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[317 /* SyntaxKind.JSDocNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[319 /* SyntaxKind.JSDocOptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[321 /* SyntaxKind.JSDocVariadicType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[320 /* SyntaxKind.JSDocFunctionType */] = function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[323 /* SyntaxKind.JSDoc */] = function forEachChildInJSDoc(node, cbNode, cbNodes) { + return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + || visitNodes(cbNode, cbNodes, node.tags); + }, + _a[349 /* SyntaxKind.JSDocSeeTag */] = function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.name) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[313 /* SyntaxKind.JSDocNameReference */] = function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[314 /* SyntaxKind.JSDocMemberName */] = function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[343 /* SyntaxKind.JSDocParameterTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[350 /* SyntaxKind.JSDocPropertyTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[333 /* SyntaxKind.JSDocAuthorTag */] = function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[332 /* SyntaxKind.JSDocImplementsTag */] = function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[331 /* SyntaxKind.JSDocAugmentsTag */] = function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[347 /* SyntaxKind.JSDocTemplateTag */] = function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.constraint) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[348 /* SyntaxKind.JSDocTypedefTag */] = function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.typeExpression && + node.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ + ? visitNode(cbNode, node.typeExpression) || + visitNode(cbNode, node.fullName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + : visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); + }, + _a[341 /* SyntaxKind.JSDocCallbackTag */] = function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[344 /* SyntaxKind.JSDocReturnTag */] = forEachChildInJSDocReturnTag, + _a[346 /* SyntaxKind.JSDocTypeTag */] = forEachChildInJSDocReturnTag, + _a[345 /* SyntaxKind.JSDocThisTag */] = forEachChildInJSDocReturnTag, + _a[342 /* SyntaxKind.JSDocEnumTag */] = forEachChildInJSDocReturnTag, + _a[326 /* SyntaxKind.JSDocSignature */] = function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { + return ts.forEach(node.typeParameters, cbNode) || + ts.forEach(node.parameters, cbNode) || + visitNode(cbNode, node.type); + }, + _a[327 /* SyntaxKind.JSDocLink */] = forEachChildInJSDocLinkCodeOrPlain, + _a[328 /* SyntaxKind.JSDocLinkCode */] = forEachChildInJSDocLinkCodeOrPlain, + _a[329 /* SyntaxKind.JSDocLinkPlain */] = forEachChildInJSDocLinkCodeOrPlain, + _a[325 /* SyntaxKind.JSDocTypeLiteral */] = function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { + return ts.forEach(node.jsDocPropertyTags, cbNode); + }, + _a[330 /* SyntaxKind.JSDocTag */] = forEachChildInJSDocTag, + _a[335 /* SyntaxKind.JSDocClassTag */] = forEachChildInJSDocTag, + _a[336 /* SyntaxKind.JSDocPublicTag */] = forEachChildInJSDocTag, + _a[337 /* SyntaxKind.JSDocPrivateTag */] = forEachChildInJSDocTag, + _a[338 /* SyntaxKind.JSDocProtectedTag */] = forEachChildInJSDocTag, + _a[339 /* SyntaxKind.JSDocReadonlyTag */] = forEachChildInJSDocTag, + _a[334 /* SyntaxKind.JSDocDeprecatedTag */] = forEachChildInJSDocTag, + _a[340 /* SyntaxKind.JSDocOverrideTag */] = forEachChildInJSDocTag, + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = forEachChildInPartiallyEmittedExpression, + _a); + // shared + function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + } + function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + } + function forEachChildInParenthesizedTypeOrTypeOperator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInObjectOrArrayBindingPattern(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInCallOrNewExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + // TODO: should we separate these branches out? + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNodes(cbNode, cbNodes, node.arguments); + } + function forEachChildInBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + } + function forEachChildInContinueOrBreakStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label); + } + function forEachChildInClassDeclarationOrExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + } + function forEachChildInNamedImportsOrExports(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInImportOrExportSpecifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); + } + function forEachChildInJsxOpeningOrSelfClosingElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.attributes); + } + function forEachChildInOptionalRestOrJSDocParameterModifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInJSDocParameterOrPropertyTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.isNameFirst + ? visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression) + : visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name)) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocReturnTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + } + function forEachChildInJSDocTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) + || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + } /** * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, @@ -31159,563 +31990,11 @@ var ts; * that they appear in the source code. The language service depends on this property to locate nodes by position. */ function forEachChild(node, cbNode, cbNodes) { - if (!node || node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node === undefined || node.kind <= 162 /* SyntaxKind.LastToken */) { return; } - switch (node.kind) { - case 161 /* SyntaxKind.QualifiedName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 163 /* SyntaxKind.TypeParameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.default) || - visitNode(cbNode, node.expression); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.equalsToken) || - visitNode(cbNode, node.objectAssignmentInitializer); - case 298 /* SyntaxKind.SpreadAssignment */: - return visitNode(cbNode, node.expression); - case 164 /* SyntaxKind.Parameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 166 /* SyntaxKind.PropertySignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 296 /* SyntaxKind.PropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.initializer); - case 254 /* SyntaxKind.VariableDeclaration */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 203 /* SyntaxKind.BindingElement */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 176 /* SyntaxKind.IndexSignature */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 180 /* SyntaxKind.ConstructorType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 179 /* SyntaxKind.FunctionType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - return visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 169 /* SyntaxKind.MethodDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 168 /* SyntaxKind.MethodSignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 171 /* SyntaxKind.Constructor */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 172 /* SyntaxKind.GetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 173 /* SyntaxKind.SetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 256 /* SyntaxKind.FunctionDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 213 /* SyntaxKind.FunctionExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 214 /* SyntaxKind.ArrowFunction */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.equalsGreaterThanToken) || - visitNode(cbNode, node.body); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.body); - case 178 /* SyntaxKind.TypeReference */: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 177 /* SyntaxKind.TypePredicate */: - return visitNode(cbNode, node.assertsModifier) || - visitNode(cbNode, node.parameterName) || - visitNode(cbNode, node.type); - case 181 /* SyntaxKind.TypeQuery */: - return visitNode(cbNode, node.exprName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 182 /* SyntaxKind.TypeLiteral */: - return visitNodes(cbNode, cbNodes, node.members); - case 183 /* SyntaxKind.ArrayType */: - return visitNode(cbNode, node.elementType); - case 184 /* SyntaxKind.TupleType */: - return visitNodes(cbNode, cbNodes, node.elements); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - return visitNodes(cbNode, cbNodes, node.types); - case 189 /* SyntaxKind.ConditionalType */: - return visitNode(cbNode, node.checkType) || - visitNode(cbNode, node.extendsType) || - visitNode(cbNode, node.trueType) || - visitNode(cbNode, node.falseType); - case 190 /* SyntaxKind.InferType */: - return visitNode(cbNode, node.typeParameter); - case 200 /* SyntaxKind.ImportType */: - return visitNode(cbNode, node.argument) || - visitNode(cbNode, node.assertions) || - visitNode(cbNode, node.qualifier) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - return visitNode(cbNode, node.assertClause); - case 191 /* SyntaxKind.ParenthesizedType */: - case 193 /* SyntaxKind.TypeOperator */: - return visitNode(cbNode, node.type); - case 194 /* SyntaxKind.IndexedAccessType */: - return visitNode(cbNode, node.objectType) || - visitNode(cbNode, node.indexType); - case 195 /* SyntaxKind.MappedType */: - return visitNode(cbNode, node.readonlyToken) || - visitNode(cbNode, node.typeParameter) || - visitNode(cbNode, node.nameType) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNodes(cbNode, cbNodes, node.members); - case 196 /* SyntaxKind.LiteralType */: - return visitNode(cbNode, node.literal); - case 197 /* SyntaxKind.NamedTupleMember */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - return visitNodes(cbNode, cbNodes, node.elements); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.properties); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.name); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.argumentExpression); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNodes(cbNode, cbNodes, node.arguments); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.template); - case 211 /* SyntaxKind.TypeAssertionExpression */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); - case 212 /* SyntaxKind.ParenthesizedExpression */: - return visitNode(cbNode, node.expression); - case 215 /* SyntaxKind.DeleteExpression */: - return visitNode(cbNode, node.expression); - case 216 /* SyntaxKind.TypeOfExpression */: - return visitNode(cbNode, node.expression); - case 217 /* SyntaxKind.VoidExpression */: - return visitNode(cbNode, node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 224 /* SyntaxKind.YieldExpression */: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); - case 218 /* SyntaxKind.AwaitExpression */: - return visitNode(cbNode, node.expression); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 221 /* SyntaxKind.BinaryExpression */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); - case 229 /* SyntaxKind.AsExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.type); - case 230 /* SyntaxKind.NonNullExpression */: - return visitNode(cbNode, node.expression); - case 231 /* SyntaxKind.MetaProperty */: - return visitNode(cbNode, node.name); - case 222 /* SyntaxKind.ConditionalExpression */: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); - case 225 /* SyntaxKind.SpreadElement */: - return visitNode(cbNode, node.expression); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - return visitNodes(cbNode, cbNodes, node.statements); - case 305 /* SyntaxKind.SourceFile */: - return visitNodes(cbNode, cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); - case 237 /* SyntaxKind.VariableStatement */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); - case 255 /* SyntaxKind.VariableDeclarationList */: - return visitNodes(cbNode, cbNodes, node.declarations); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitNode(cbNode, node.expression); - case 239 /* SyntaxKind.IfStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); - case 240 /* SyntaxKind.DoStatement */: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); - case 241 /* SyntaxKind.WhileStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 242 /* SyntaxKind.ForStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || - visitNode(cbNode, node.statement); - case 243 /* SyntaxKind.ForInStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 244 /* SyntaxKind.ForOfStatement */: - return visitNode(cbNode, node.awaitModifier) || - visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return visitNode(cbNode, node.label); - case 247 /* SyntaxKind.ReturnStatement */: - return visitNode(cbNode, node.expression); - case 248 /* SyntaxKind.WithStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 249 /* SyntaxKind.SwitchStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 263 /* SyntaxKind.CaseBlock */: - return visitNodes(cbNode, cbNodes, node.clauses); - case 289 /* SyntaxKind.CaseClause */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.statements); - case 290 /* SyntaxKind.DefaultClause */: - return visitNodes(cbNode, cbNodes, node.statements); - case 250 /* SyntaxKind.LabeledStatement */: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); - case 251 /* SyntaxKind.ThrowStatement */: - return visitNode(cbNode, node.expression); - case 252 /* SyntaxKind.TryStatement */: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); - case 292 /* SyntaxKind.CatchClause */: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); - case 165 /* SyntaxKind.Decorator */: - return visitNode(cbNode, node.expression); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 258 /* SyntaxKind.InterfaceDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); - case 260 /* SyntaxKind.EnumDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.members); - case 299 /* SyntaxKind.EnumMember */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 261 /* SyntaxKind.ModuleDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 267 /* SyntaxKind.ImportClause */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); - case 293 /* SyntaxKind.AssertClause */: - return visitNodes(cbNode, cbNodes, node.elements); - case 294 /* SyntaxKind.AssertEntry */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.value); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNode(cbNode, node.name); - case 268 /* SyntaxKind.NamespaceImport */: - return visitNode(cbNode, node.name); - case 274 /* SyntaxKind.NamespaceExport */: - return visitNode(cbNode, node.name); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: - return visitNodes(cbNode, cbNodes, node.elements); - case 272 /* SyntaxKind.ExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); - case 271 /* SyntaxKind.ExportAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.expression); - case 223 /* SyntaxKind.TemplateExpression */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 233 /* SyntaxKind.TemplateSpan */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.literal); - case 198 /* SyntaxKind.TemplateLiteralType */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.literal); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitNode(cbNode, node.expression); - case 291 /* SyntaxKind.HeritageClause */: - return visitNodes(cbNode, cbNodes, node.types); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 277 /* SyntaxKind.ExternalModuleReference */: - return visitNode(cbNode, node.expression); - case 276 /* SyntaxKind.MissingDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers); - case 351 /* SyntaxKind.CommaListExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 278 /* SyntaxKind.JsxElement */: - return visitNode(cbNode, node.openingElement) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingElement); - case 282 /* SyntaxKind.JsxFragment */: - return visitNode(cbNode, node.openingFragment) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingFragment); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - return visitNode(cbNode, node.tagName) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.attributes); - case 286 /* SyntaxKind.JsxAttributes */: - return visitNodes(cbNode, cbNodes, node.properties); - case 285 /* SyntaxKind.JsxAttribute */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - return visitNode(cbNode, node.expression); - case 288 /* SyntaxKind.JsxExpression */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.expression); - case 281 /* SyntaxKind.JsxClosingElement */: - return visitNode(cbNode, node.tagName); - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - return visitNode(cbNode, node.type); - case 317 /* SyntaxKind.JSDocFunctionType */: - return visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 320 /* SyntaxKind.JSDoc */: - return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - || visitNodes(cbNode, cbNodes, node.tags); - case 346 /* SyntaxKind.JSDocSeeTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 310 /* SyntaxKind.JSDocNameReference */: - return visitNode(cbNode, node.name); - case 311 /* SyntaxKind.JSDocMemberName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - return visitNode(cbNode, node.tagName) || - (node.isNameFirst - ? visitNode(cbNode, node.name) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 330 /* SyntaxKind.JSDocAuthorTag */: - return visitNode(cbNode, node.tagName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 329 /* SyntaxKind.JSDocImplementsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 344 /* SyntaxKind.JSDocTemplateTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.constraint) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 345 /* SyntaxKind.JSDocTypedefTag */: - return visitNode(cbNode, node.tagName) || - (node.typeExpression && - node.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ - ? visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.fullName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 338 /* SyntaxKind.JSDocCallbackTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 323 /* SyntaxKind.JSDocSignature */: - return ts.forEach(node.typeParameters, cbNode) || - ts.forEach(node.parameters, cbNode) || - visitNode(cbNode, node.type); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: - return visitNode(cbNode, node.name); - case 322 /* SyntaxKind.JSDocTypeLiteral */: - return ts.forEach(node.jsDocPropertyTags, cbNode); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: - case 337 /* SyntaxKind.JSDocOverrideTag */: - return visitNode(cbNode, node.tagName) - || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - return visitNode(cbNode, node.expression); - } + var fn = forEachChildTable[node.kind]; + return fn === undefined ? undefined : fn(node, cbNode, cbNodes); } ts.forEachChild = forEachChild; /** @internal */ @@ -31762,7 +32041,7 @@ var ts; continue; return res; } - if (current.kind >= 161 /* SyntaxKind.FirstNode */) { + if (current.kind >= 163 /* SyntaxKind.FirstNode */) { // add children in reverse order to the queue, so popping gives the first child for (var _i = 0, _a = gatherPossibleChildren(current); _i < _a.length; _i++) { var child = _a[_i]; @@ -31872,13 +32151,11 @@ var ts; var scanner = ts.createScanner(99 /* ScriptTarget.Latest */, /*skipTrivia*/ true); var disallowInAndDecoratorContext = 4096 /* NodeFlags.DisallowInContext */ | 16384 /* NodeFlags.DecoratorContext */; // capture constructors in 'initializeState' to avoid null checks - // tslint:disable variable-name var NodeConstructor; var TokenConstructor; var IdentifierConstructor; var PrivateIdentifierConstructor; var SourceFileConstructor; - // tslint:enable variable-name function countNode(node) { nodeCount++; return node; @@ -32587,7 +32864,7 @@ var ts; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. - if (token() === 132 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { return false; } return token() > 116 /* SyntaxKind.LastReservedWord */; @@ -32833,7 +33110,7 @@ var ts; ts.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, "", "", /*templateFlags*/ undefined) : kind === 8 /* SyntaxKind.NumericLiteral */ ? factory.createNumericLiteral("", /*numericLiteralFlags*/ undefined) : kind === 10 /* SyntaxKind.StringLiteral */ ? factory.createStringLiteral("", /*isSingleQuote*/ undefined) : - kind === 276 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : + kind === 279 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : factory.createToken(kind); return finishNode(result, pos); } @@ -32854,8 +33131,9 @@ var ts; // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker var originalKeywordKind = token(); var text = internIdentifier(scanner.getTokenValue()); + var hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape(); nextTokenWithoutCheck(); - return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind), pos); + return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind, hasExtendedUnicodeEscape), pos); } if (token() === 80 /* SyntaxKind.PrivateIdentifier */) { parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); @@ -32932,7 +33210,7 @@ var ts; } function parsePrivateIdentifier() { var pos = getNodePos(); - var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText())); + var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue())); nextToken(); return finishNode(node, pos); } @@ -32956,15 +33234,16 @@ var ts; if (token() === 88 /* SyntaxKind.DefaultKeyword */) { return lookAhead(nextTokenCanFollowDefaultKeyword); } - if (token() === 152 /* SyntaxKind.TypeKeyword */) { + if (token() === 154 /* SyntaxKind.TypeKeyword */) { return lookAhead(nextTokenCanFollowExportModifier); } return canFollowExportModifier(); case 88 /* SyntaxKind.DefaultKeyword */: return nextTokenCanFollowDefaultKeyword(); + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: nextToken(); return canFollowModifier(); default: @@ -32973,7 +33252,7 @@ var ts; } function canFollowExportModifier() { return token() !== 41 /* SyntaxKind.AsteriskToken */ - && token() !== 127 /* SyntaxKind.AsKeyword */ + && token() !== 128 /* SyntaxKind.AsKeyword */ && token() !== 18 /* SyntaxKind.OpenBraceToken */ && canFollowModifier(); } @@ -32996,7 +33275,7 @@ var ts; return token() === 84 /* SyntaxKind.ClassKeyword */ || token() === 98 /* SyntaxKind.FunctionKeyword */ || token() === 118 /* SyntaxKind.InterfaceKeyword */ || (token() === 126 /* SyntaxKind.AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) || - (token() === 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); + (token() === 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } // True if positioned at the start of a list element function isListElement(parsingContext, inErrorRecovery) { @@ -33376,20 +33655,20 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 176 /* SyntaxKind.IndexSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 234 /* SyntaxKind.SemicolonClassElement */: + case 173 /* SyntaxKind.Constructor */: + case 178 /* SyntaxKind.IndexSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 237 /* SyntaxKind.SemicolonClassElement */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ && - methodDeclaration.name.originalKeywordKind === 134 /* SyntaxKind.ConstructorKeyword */; + methodDeclaration.name.originalKeywordKind === 135 /* SyntaxKind.ConstructorKeyword */; return !nameIsConstructor; } } @@ -33398,8 +33677,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return true; } } @@ -33408,58 +33687,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 238 /* SyntaxKind.ExpressionStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 236 /* SyntaxKind.EmptyStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 250 /* SyntaxKind.LabeledStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 174 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 176 /* SyntaxKind.CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind !== 257 /* SyntaxKind.VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -33480,7 +33759,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 164 /* SyntaxKind.Parameter */) { + if (node.kind !== 166 /* SyntaxKind.Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -33773,14 +34052,14 @@ var ts; // If true, we should abort parsing an error function. function typeHasArrowFunctionBlockingParseError(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return ts.nodeIsMissing(node.typeName); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: { + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: { var _a = node, parameters = _a.parameters, type = _a.type; return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); } - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return typeHasArrowFunctionBlockingParseError(node.type); default: return false; @@ -33859,7 +34138,7 @@ var ts; function parseJSDocType() { scanner.setInJSDocType(true); var pos = getNodePos(); - if (parseOptional(141 /* SyntaxKind.ModuleKeyword */)) { + if (parseOptional(142 /* SyntaxKind.ModuleKeyword */)) { // TODO(rbuckton): We never set the type for a JSDocNamepathType. What should we put here? var moduleTag = factory.createJSDocNamepathType(/*type*/ undefined); terminate: while (true) { @@ -34075,14 +34354,14 @@ var ts; function parseSignatureMember(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - if (kind === 175 /* SyntaxKind.ConstructSignature */) { + if (kind === 177 /* SyntaxKind.ConstructSignature */) { parseExpected(103 /* SyntaxKind.NewKeyword */); } var typeParameters = parseTypeParameters(); var parameters = parseParameters(4 /* SignatureFlags.Type */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ true); parseTypeMemberSemicolon(); - var node = kind === 174 /* SyntaxKind.CallSignature */ + var node = kind === 176 /* SyntaxKind.CallSignature */ ? factory.createCallSignature(typeParameters, parameters, type) : factory.createConstructSignature(typeParameters, parameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -34176,8 +34455,8 @@ var ts; // Return true if we have the start of a signature member if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || - token() === 136 /* SyntaxKind.GetKeyword */ || - token() === 149 /* SyntaxKind.SetKeyword */) { + token() === 137 /* SyntaxKind.GetKeyword */ || + token() === 151 /* SyntaxKind.SetKeyword */) { return true; } var idToken = false; @@ -34209,19 +34488,19 @@ var ts; } function parseTypeMember() { if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */) { - return parseSignatureMember(174 /* SyntaxKind.CallSignature */); + return parseSignatureMember(176 /* SyntaxKind.CallSignature */); } if (token() === 103 /* SyntaxKind.NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) { - return parseSignatureMember(175 /* SyntaxKind.ConstructSignature */); + return parseSignatureMember(177 /* SyntaxKind.ConstructSignature */); } var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 174 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 175 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers); @@ -34262,9 +34541,9 @@ var ts; function isStartOfMappedType() { nextToken(); if (token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { - return nextToken() === 145 /* SyntaxKind.ReadonlyKeyword */; + return nextToken() === 146 /* SyntaxKind.ReadonlyKeyword */; } - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */) { nextToken(); } return token() === 22 /* SyntaxKind.OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 101 /* SyntaxKind.InKeyword */; @@ -34280,15 +34559,15 @@ var ts; var pos = getNodePos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var readonlyToken; - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { readonlyToken = parseTokenNode(); - if (readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - parseExpected(145 /* SyntaxKind.ReadonlyKeyword */); + if (readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + parseExpected(146 /* SyntaxKind.ReadonlyKeyword */); } } parseExpected(22 /* SyntaxKind.OpenBracketToken */); var typeParameter = parseMappedTypeParameter(); - var nameType = parseOptional(127 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; + var nameType = parseOptional(128 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; parseExpected(23 /* SyntaxKind.CloseBracketToken */); var questionToken; if (token() === 57 /* SyntaxKind.QuestionToken */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { @@ -34402,7 +34681,7 @@ var ts; var openBracePosition = scanner.getTokenPos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var multiLine = scanner.hasPrecedingLineBreak(); - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); parseExpected(58 /* SyntaxKind.ColonToken */); var clause = parseAssertClause(/*skipAssertKeyword*/ true); if (!parseExpected(19 /* SyntaxKind.CloseBraceToken */)) { @@ -34435,16 +34714,16 @@ var ts; } function parseNonArrayType() { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. return tryParse(parseKeywordAndNoDot) || parseTypeReference(); case 66 /* SyntaxKind.AsteriskEqualsToken */: @@ -34477,7 +34756,7 @@ var ts; return parseTokenNode(); case 108 /* SyntaxKind.ThisKeyword */: { var thisKeyword = parseThisTypeNode(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { return parseThisTypePredicate(thisKeyword); } else { @@ -34494,7 +34773,7 @@ var ts; return parseParenthesizedType(); case 100 /* SyntaxKind.ImportKeyword */: return parseImportType(); - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference(); case 15 /* SyntaxKind.TemplateHead */: return parseTemplateType(); @@ -34504,21 +34783,21 @@ var ts; } function isStartOfType(inStartOfParameter) { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 18 /* SyntaxKind.OpenBraceToken */: case 22 /* SyntaxKind.OpenBracketToken */: case 29 /* SyntaxKind.LessThanToken */: @@ -34530,14 +34809,14 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 41 /* SyntaxKind.AsteriskToken */: case 57 /* SyntaxKind.QuestionToken */: case 53 /* SyntaxKind.ExclamationToken */: case 25 /* SyntaxKind.DotDotDotToken */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 100 /* SyntaxKind.ImportKeyword */: - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: return true; @@ -34614,17 +34893,17 @@ var ts; } function parseInferType() { var pos = getNodePos(); - parseExpected(137 /* SyntaxKind.InferKeyword */); + parseExpected(138 /* SyntaxKind.InferKeyword */); return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos); } function parseTypeOperatorOrHigher() { var operator = token(); switch (operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: return parseTypeOperator(operator); - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return parseInferType(); } return allowConditionalTypesAnd(parsePostfixTypeOrHigher); @@ -34744,16 +35023,16 @@ var ts; } function parseTypePredicatePrefix() { var id = parseIdentifier(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { nextToken(); return id; } } function parseAssertsTypePredicate() { var pos = getNodePos(); - var assertsModifier = parseExpectedToken(128 /* SyntaxKind.AssertsKeyword */); + var assertsModifier = parseExpectedToken(129 /* SyntaxKind.AssertsKeyword */); var parameterName = token() === 108 /* SyntaxKind.ThisKeyword */ ? parseThisTypeNode() : parseIdentifier(); - var type = parseOptional(139 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; + var type = parseOptional(140 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos); } function parseType() { @@ -34823,7 +35102,7 @@ var ts; case 45 /* SyntaxKind.PlusPlusToken */: case 46 /* SyntaxKind.MinusMinusToken */: case 29 /* SyntaxKind.LessThanToken */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: case 125 /* SyntaxKind.YieldKeyword */: case 80 /* SyntaxKind.PrivateIdentifier */: // Yield/await always starts an expression. Either it is an identifier (in which case @@ -35011,7 +35290,7 @@ var ts; // Unknown -> There *might* be a parenthesized arrow function here. // Speculatively look ahead to be sure, and rollback if not. function isParenthesizedArrowFunctionExpression() { - if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 132 /* SyntaxKind.AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token() === 38 /* SyntaxKind.EqualsGreaterThanToken */) { @@ -35024,7 +35303,7 @@ var ts; return 0 /* Tristate.False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0 /* Tristate.False */; @@ -35068,8 +35347,8 @@ var ts; // Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This // isn't actually allowed, but we want to treat it as a lambda so we can provide // a good error message. - if (ts.isModifierKind(second) && second !== 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { - if (nextToken() === 127 /* SyntaxKind.AsKeyword */) { + if (ts.isModifierKind(second) && second !== 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { + if (nextToken() === 128 /* SyntaxKind.AsKeyword */) { // https://github.com/microsoft/TypeScript/issues/44466 return 0 /* Tristate.False */; } @@ -35151,7 +35430,7 @@ var ts; } function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) { // We do a check here so that we won't be doing unnecessarily call to "lookAhead" - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* Tristate.True */) { var pos = getNodePos(); var asyncModifier = parseModifiersForArrowFunction(); @@ -35165,7 +35444,7 @@ var ts; // AsyncArrowFunctionExpression: // 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In] // 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In] - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); // If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function // but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher" @@ -35231,7 +35510,7 @@ var ts; // // So we need just a bit of lookahead to ensure that it can only be a signature. var unwrappedType = type; - while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 191 /* SyntaxKind.ParenthesizedType */) { + while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 193 /* SyntaxKind.ParenthesizedType */) { unwrappedType = unwrappedType.type; // Skip parens if need be } var hasJSDocFunctionType = unwrappedType && ts.isJSDocFunctionType(unwrappedType); @@ -35326,7 +35605,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand, pos); } function isInOrOfKeyword(t) { - return t === 101 /* SyntaxKind.InKeyword */ || t === 160 /* SyntaxKind.OfKeyword */; + return t === 101 /* SyntaxKind.InKeyword */ || t === 162 /* SyntaxKind.OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand, pos) { while (true) { @@ -35364,7 +35643,7 @@ var ts; if (token() === 101 /* SyntaxKind.InKeyword */ && inDisallowInContext()) { break; } - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */ || token() === 150 /* SyntaxKind.SatisfiesKeyword */) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -35374,8 +35653,10 @@ var ts; break; } else { + var keywordKind = token(); nextToken(); - leftOperand = makeAsExpression(leftOperand, parseType()); + leftOperand = keywordKind === 150 /* SyntaxKind.SatisfiesKeyword */ ? makeSatisfiesExpression(leftOperand, parseType()) : + makeAsExpression(leftOperand, parseType()); } } else { @@ -35390,6 +35671,9 @@ var ts; } return ts.getBinaryOperatorPrecedence(token()) > 0; } + function makeSatisfiesExpression(left, right) { + return finishNode(factory.createSatisfiesExpression(left, right), left.pos); + } function makeBinaryExpression(left, operatorToken, right, pos) { return finishNode(factory.createBinaryExpression(left, operatorToken, right), pos); } @@ -35413,7 +35697,7 @@ var ts; return finishNode(factory.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); } function isAwaitExpression() { - if (token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -35466,7 +35750,7 @@ var ts; if (token() === 42 /* SyntaxKind.AsteriskAsteriskToken */) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -35507,7 +35791,7 @@ var ts; // UnaryExpression (modified): // < type > UnaryExpression return parseTypeAssertion(); - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: if (isAwaitExpression()) { return parseAwaitExpression(); } @@ -35537,7 +35821,7 @@ var ts; case 89 /* SyntaxKind.DeleteKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: return false; case 29 /* SyntaxKind.LessThanToken */: // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression @@ -35720,11 +36004,11 @@ var ts; var pos = getNodePos(); var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (opening.kind === 283 /* SyntaxKind.JsxOpeningElement */) { var children = parseJsxChildren(opening); var closingElement = void 0; var lastChild = children[children.length - 1]; - if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 278 /* SyntaxKind.JsxElement */ + if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { // when an unclosed JsxOpeningElement incorrectly parses its parent's JsxClosingElement, @@ -35750,11 +36034,11 @@ var ts; } result = finishNode(factory.createJsxElement(opening, children, closingElement), pos); } - else if (opening.kind === 283 /* SyntaxKind.JsxOpeningFragment */) { + else if (opening.kind === 286 /* SyntaxKind.JsxOpeningFragment */) { result = finishNode(factory.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos); } else { - ts.Debug.assert(opening.kind === 279 /* SyntaxKind.JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 282 /* SyntaxKind.JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -35824,7 +36108,7 @@ var ts; break; list.push(child); if (ts.isJsxOpeningElement(openingTag) - && (child === null || child === void 0 ? void 0 : child.kind) === 278 /* SyntaxKind.JsxElement */ + && (child === null || child === void 0 ? void 0 : child.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { // stop after parsing a mismatched child like
...(
) in order to reattach the
higher @@ -36069,7 +36353,7 @@ var ts; } if (isTemplateStartOfTaggedTemplate()) { // Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments - expression = !questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? + expression = !questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest(pos, expression, questionDotToken, /*typeArguments*/ undefined); continue; @@ -36116,7 +36400,7 @@ var ts; } if (typeArguments || token() === 20 /* SyntaxKind.OpenParenToken */) { // Absorb type arguments into CallExpression when preceding expression is ExpressionWithTypeArguments - if (!questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (!questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36202,7 +36486,7 @@ var ts; return parseArrayLiteralExpression(); case 18 /* SyntaxKind.OpenBraceToken */: return parseObjectLiteralExpression(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. // If we encounter `async [no LineTerminator here] function` then this is an async // function; otherwise, its an identifier. @@ -36269,11 +36553,11 @@ var ts; } var decorators = parseDecorators(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); var tokenIsIdentifier = isIdentifier(); @@ -36361,7 +36645,7 @@ var ts; var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false); var typeArguments; // Absorb type arguments into NewExpression when preceding expression is ExpressionWithTypeArguments - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36465,7 +36749,7 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(97 /* SyntaxKind.ForKeyword */); - var awaitToken = parseOptionalToken(132 /* SyntaxKind.AwaitKeyword */); + var awaitToken = parseOptionalToken(133 /* SyntaxKind.AwaitKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var initializer; if (token() !== 26 /* SyntaxKind.SemicolonToken */) { @@ -36477,7 +36761,7 @@ var ts; } } var node; - if (awaitToken ? parseExpected(160 /* SyntaxKind.OfKeyword */) : parseOptional(160 /* SyntaxKind.OfKeyword */)) { + if (awaitToken ? parseExpected(162 /* SyntaxKind.OfKeyword */) : parseOptional(162 /* SyntaxKind.OfKeyword */)) { var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true); }); parseExpected(21 /* SyntaxKind.CloseParenToken */); node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement()); @@ -36504,10 +36788,10 @@ var ts; function parseBreakOrContinueStatement(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(kind === 246 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); + parseExpected(kind === 249 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); var label = canParseSemicolon() ? undefined : parseIdentifier(); parseSemicolon(); - var node = kind === 246 /* SyntaxKind.BreakStatement */ + var node = kind === 249 /* SyntaxKind.BreakStatement */ ? factory.createBreakStatement(label) : factory.createContinueStatement(label); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -36698,25 +36982,26 @@ var ts; // // could be legal, it would add complexity for very little gain. case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: nextToken(); return token() === 18 /* SyntaxKind.OpenBraceToken */ || token() === 79 /* SyntaxKind.Identifier */ || token() === 93 /* SyntaxKind.ExportKeyword */; case 100 /* SyntaxKind.ImportKeyword */: @@ -36725,12 +37010,12 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token()); case 93 /* SyntaxKind.ExportKeyword */: var currentToken_1 = nextToken(); - if (currentToken_1 === 152 /* SyntaxKind.TypeKeyword */) { + if (currentToken_1 === 154 /* SyntaxKind.TypeKeyword */) { currentToken_1 = lookAhead(nextToken); } if (currentToken_1 === 63 /* SyntaxKind.EqualsToken */ || currentToken_1 === 41 /* SyntaxKind.AsteriskToken */ || currentToken_1 === 18 /* SyntaxKind.OpenBraceToken */ || currentToken_1 === 88 /* SyntaxKind.DefaultKeyword */ || - currentToken_1 === 127 /* SyntaxKind.AsKeyword */) { + currentToken_1 === 128 /* SyntaxKind.AsKeyword */) { return true; } continue; @@ -36778,20 +37063,21 @@ var ts; case 85 /* SyntaxKind.ConstKeyword */: case 93 /* SyntaxKind.ExportKeyword */: return isStartOfDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; + case 127 /* SyntaxKind.AccessorKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -36834,9 +37120,9 @@ var ts; case 97 /* SyntaxKind.ForKeyword */: return parseForOrForInOrForOfStatement(); case 86 /* SyntaxKind.ContinueKeyword */: - return parseBreakOrContinueStatement(245 /* SyntaxKind.ContinueStatement */); + return parseBreakOrContinueStatement(248 /* SyntaxKind.ContinueStatement */); case 81 /* SyntaxKind.BreakKeyword */: - return parseBreakOrContinueStatement(246 /* SyntaxKind.BreakStatement */); + return parseBreakOrContinueStatement(249 /* SyntaxKind.BreakStatement */); case 105 /* SyntaxKind.ReturnKeyword */: return parseReturnStatement(); case 116 /* SyntaxKind.WithKeyword */: @@ -36855,12 +37141,12 @@ var ts; return parseDebuggerStatement(); case 59 /* SyntaxKind.AtToken */: return parseDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 93 /* SyntaxKind.ExportKeyword */: @@ -36869,9 +37155,10 @@ var ts; case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -36880,7 +37167,7 @@ var ts; return parseExpressionOrLabeledStatement(); } function isDeclareModifier(modifier) { - return modifier.kind === 135 /* SyntaxKind.DeclareKeyword */; + return modifier.kind === 136 /* SyntaxKind.DeclareKeyword */; } function parseDeclaration() { // `parseListElement` attempted to get the reused node at this position, @@ -36926,13 +37213,13 @@ var ts; return parseClassDeclaration(pos, hasJSDoc, decorators, modifiers); case 118 /* SyntaxKind.InterfaceKeyword */: return parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers); - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers); case 92 /* SyntaxKind.EnumKeyword */: return parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers); - case 157 /* SyntaxKind.GlobalKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers); case 100 /* SyntaxKind.ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36942,7 +37229,7 @@ var ts; case 88 /* SyntaxKind.DefaultKeyword */: case 63 /* SyntaxKind.EqualsToken */: return parseExportAssignment(pos, hasJSDoc, decorators, modifiers); - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: return parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers); default: return parseExportDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36951,7 +37238,7 @@ var ts; if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var missing = createMissingNode(276 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(279 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); missing.illegalDecorators = decorators; missing.modifiers = modifiers; @@ -37077,7 +37364,7 @@ var ts; // this context. // The checker will then give an error that there is an empty declaration list. var declarations; - if (token() === 160 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 162 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { declarations = createMissingList(); } else { @@ -37105,9 +37392,9 @@ var ts; parseExpected(98 /* SyntaxKind.FunctionKeyword */); var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); // We don't parse the name here in await context, instead we will report a grammar error in the checker. - var name = modifierFlags & 512 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); + var name = modifierFlags & 1024 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); var isGenerator = asteriskToken ? 1 /* SignatureFlags.Yield */ : 0 /* SignatureFlags.None */; - var isAsync = modifierFlags & 256 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; + var isAsync = modifierFlags & 512 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; var typeParameters = parseTypeParameters(); if (modifierFlags & 1 /* ModifierFlags.Export */) setAwaitContext(/*value*/ true); @@ -37120,8 +37407,8 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { - if (token() === 134 /* SyntaxKind.ConstructorKeyword */) { - return parseExpected(134 /* SyntaxKind.ConstructorKeyword */); + if (token() === 135 /* SyntaxKind.ConstructorKeyword */) { + return parseExpected(135 /* SyntaxKind.ConstructorKeyword */); } if (token() === 10 /* SyntaxKind.StringLiteral */ && lookAhead(nextToken) === 20 /* SyntaxKind.OpenParenToken */) { return tryParse(function () { @@ -37183,7 +37470,7 @@ var ts; var parameters = parseParameters(0 /* SignatureFlags.None */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ false); var body = parseFunctionBlockOrSemicolon(flags); - var node = kind === 172 /* SyntaxKind.GetAccessor */ + var node = kind === 174 /* SyntaxKind.GetAccessor */ ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body) : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body); // Keep track of `typeParameters` (for both) and `type` (for setters) if they were parsed those indicate grammar errors @@ -37227,7 +37514,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 149 /* SyntaxKind.SetKeyword */ || idToken === 136 /* SyntaxKind.GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 151 /* SyntaxKind.SetKeyword */ || idToken === 137 /* SyntaxKind.GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -37270,7 +37557,7 @@ var ts; return body; } function parseDecoratorExpression() { - if (inAwaitContext() && token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (inAwaitContext() && token() === 133 /* SyntaxKind.AwaitKeyword */) { // `@await` is is disallowed in an [Await] context, but can cause parsing to go off the rails // This simply parses the missing identifier and moves on. var pos = getNodePos(); @@ -37348,10 +37635,10 @@ var ts; } function parseModifiersForArrowFunction() { var modifiers; - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { var pos = getNodePos(); nextToken(); - var modifier = finishNode(factory.createToken(131 /* SyntaxKind.AsyncKeyword */), pos); + var modifier = finishNode(factory.createToken(132 /* SyntaxKind.AsyncKeyword */), pos); modifiers = createNodeArray([modifier], pos); } return modifiers; @@ -37368,13 +37655,13 @@ var ts; if (token() === 124 /* SyntaxKind.StaticKeyword */ && lookAhead(nextTokenIsOpenBrace)) { return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers); } - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } - if (token() === 134 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { + if (token() === 135 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers); if (constructorDeclaration) { return constructorDeclaration; @@ -37411,10 +37698,10 @@ var ts; return ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 226 /* SyntaxKind.ClassExpression */); + return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 228 /* SyntaxKind.ClassExpression */); } function parseClassDeclaration(pos, hasJSDoc, decorators, modifiers) { - return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 257 /* SyntaxKind.ClassDeclaration */); + return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 260 /* SyntaxKind.ClassDeclaration */); } function parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, kind) { var savedAwaitContext = inAwaitContext(); @@ -37436,7 +37723,7 @@ var ts; members = createMissingList(); } setAwaitContext(savedAwaitContext); - var node = kind === 257 /* SyntaxKind.ClassDeclaration */ + var node = kind === 260 /* SyntaxKind.ClassDeclaration */ ? factory.createClassDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members) : factory.createClassExpression(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -37473,7 +37760,7 @@ var ts; function parseExpressionWithTypeArguments() { var pos = getNodePos(); var expression = parseLeftHandSideExpressionOrHigher(); - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { return expression; } var typeArguments = tryParseTypeArguments(); @@ -37500,11 +37787,11 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(152 /* SyntaxKind.TypeKeyword */); + parseExpected(154 /* SyntaxKind.TypeKeyword */); var name = parseIdentifier(); var typeParameters = parseTypeParameters(); parseExpected(63 /* SyntaxKind.EqualsToken */); - var type = token() === 138 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); + var type = token() === 139 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); node.illegalDecorators = decorators; @@ -37563,7 +37850,7 @@ var ts; function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; var name; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // parse 'global' as name of global scope augmentation name = parseIdentifier(); flags |= 1024 /* NodeFlags.GlobalAugmentation */; @@ -37585,15 +37872,15 @@ var ts; } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } - else if (parseOptional(142 /* SyntaxKind.NamespaceKeyword */)) { + else if (parseOptional(143 /* SyntaxKind.NamespaceKeyword */)) { flags |= 16 /* NodeFlags.Namespace */; } else { - parseExpected(141 /* SyntaxKind.ModuleKeyword */); + parseExpected(142 /* SyntaxKind.ModuleKeyword */); if (token() === 10 /* SyntaxKind.StringLiteral */) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } @@ -37601,7 +37888,7 @@ var ts; return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags); } function isExternalModuleReference() { - return token() === 146 /* SyntaxKind.RequireKeyword */ && + return token() === 147 /* SyntaxKind.RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -37614,8 +37901,8 @@ var ts; return nextToken() === 43 /* SyntaxKind.SlashToken */; } function parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(127 /* SyntaxKind.AsKeyword */); - parseExpected(142 /* SyntaxKind.NamespaceKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); + parseExpected(143 /* SyntaxKind.NamespaceKeyword */); var name = parseIdentifier(); parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); @@ -37633,7 +37920,7 @@ var ts; identifier = parseIdentifier(); } var isTypeOnly = false; - if (token() !== 156 /* SyntaxKind.FromKeyword */ && + if (token() !== 158 /* SyntaxKind.FromKeyword */ && (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === "type" && (isIdentifier() || tokenAfterImportDefinitelyProducesImportDeclaration())) { isTypeOnly = true; @@ -37651,11 +37938,11 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ // import { ) { importClause = parseImportClause(identifier, afterImportPos, isTypeOnly); - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); } var moduleSpecifier = parseModuleSpecifier(); var assertClause; - if (token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -37673,7 +37960,7 @@ var ts; function parseAssertClause(skipAssertKeyword) { var pos = getNodePos(); if (!skipAssertKeyword) { - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); } var openBracePosition = scanner.getTokenPos(); if (parseExpected(18 /* SyntaxKind.OpenBraceToken */)) { @@ -37698,7 +37985,7 @@ var ts; function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() { // In `import id ___`, the current token decides whether to produce // an ImportDeclaration or ImportEqualsDeclaration. - return token() === 27 /* SyntaxKind.CommaToken */ || token() === 156 /* SyntaxKind.FromKeyword */; + return token() === 27 /* SyntaxKind.CommaToken */ || token() === 158 /* SyntaxKind.FromKeyword */; } function parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly) { parseExpected(63 /* SyntaxKind.EqualsToken */); @@ -37721,7 +38008,7 @@ var ts; var namedBindings; if (!identifier || parseOptional(27 /* SyntaxKind.CommaToken */)) { - namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(269 /* SyntaxKind.NamedImports */); + namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(272 /* SyntaxKind.NamedImports */); } return finishNode(factory.createImportClause(isTypeOnly, identifier, namedBindings), pos); } @@ -37732,7 +38019,7 @@ var ts; } function parseExternalModuleReference() { var pos = getNodePos(); - parseExpected(146 /* SyntaxKind.RequireKeyword */); + parseExpected(147 /* SyntaxKind.RequireKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var expression = parseModuleSpecifier(); parseExpected(21 /* SyntaxKind.CloseParenToken */); @@ -37756,7 +38043,7 @@ var ts; // * as ImportedBinding var pos = getNodePos(); parseExpected(41 /* SyntaxKind.AsteriskToken */); - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); var name = parseIdentifier(); return finishNode(factory.createNamespaceImport(name), pos); } @@ -37769,17 +38056,17 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - var node = kind === 269 /* SyntaxKind.NamedImports */ + var node = kind === 272 /* SyntaxKind.NamedImports */ ? factory.createNamedImports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseImportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)) : factory.createNamedExports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseExportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)); return finishNode(node, pos); } function parseExportSpecifier() { var hasJSDoc = hasPrecedingJSDocComment(); - return withJSDoc(parseImportOrExportSpecifier(275 /* SyntaxKind.ExportSpecifier */), hasJSDoc); + return withJSDoc(parseImportOrExportSpecifier(278 /* SyntaxKind.ExportSpecifier */), hasJSDoc); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(270 /* SyntaxKind.ImportSpecifier */); + return parseImportOrExportSpecifier(273 /* SyntaxKind.ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var pos = getNodePos(); @@ -37804,10 +38091,10 @@ var ts; // import { type as } from "mod"; - isTypeOnly: true, name: as // import { type as as } from "mod"; - isTypeOnly: false, name: as, propertyName: type // import { type as as as } from "mod"; - isTypeOnly: true, name: as, propertyName: as - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as ...? } var firstAs = parseIdentifierName(); - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as as ...? } var secondAs = parseIdentifierName(); if (ts.tokenIsIdentifierOrKeyword(token())) { @@ -37842,15 +38129,15 @@ var ts; name = parseNameWithKeywordCheck(); } } - if (canParseAsKeyword && token() === 127 /* SyntaxKind.AsKeyword */) { + if (canParseAsKeyword && token() === 128 /* SyntaxKind.AsKeyword */) { propertyName = name; - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); name = parseNameWithKeywordCheck(); } - if (kind === 270 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 273 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } - var node = kind === 270 /* SyntaxKind.ImportSpecifier */ + var node = kind === 273 /* SyntaxKind.ImportSpecifier */ ? factory.createImportSpecifier(isTypeOnly, propertyName, name) : factory.createExportSpecifier(isTypeOnly, propertyName, name); return finishNode(node, pos); @@ -37870,26 +38157,26 @@ var ts; var exportClause; var moduleSpecifier; var assertClause; - var isTypeOnly = parseOptional(152 /* SyntaxKind.TypeKeyword */); + var isTypeOnly = parseOptional(154 /* SyntaxKind.TypeKeyword */); var namespaceExportPos = getNodePos(); if (parseOptional(41 /* SyntaxKind.AsteriskToken */)) { - if (parseOptional(127 /* SyntaxKind.AsKeyword */)) { + if (parseOptional(128 /* SyntaxKind.AsKeyword */)) { exportClause = parseNamespaceExport(namespaceExportPos); } - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } else { - exportClause = parseNamedImportsOrExports(273 /* SyntaxKind.NamedExports */); + exportClause = parseNamedImportsOrExports(276 /* SyntaxKind.NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token() === 156 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(156 /* SyntaxKind.FromKeyword */); + if (token() === 158 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } } - if (moduleSpecifier && token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (moduleSpecifier && token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -38502,9 +38789,9 @@ var ts; } function isObjectOrObjectArrayTypeReference(node) { switch (node.kind) { - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isObjectOrObjectArrayTypeReference(node.elementType); default: return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; @@ -38536,12 +38823,12 @@ var ts; var child = void 0; var children = void 0; while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) { - if (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) { + if (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) { children = ts.append(children, child); } } if (children) { - var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */), pos); + var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */), pos); return finishNode(factory.createJSDocTypeExpression(literal), pos); } } @@ -38659,7 +38946,7 @@ var ts; var hasChildren = false; while (child = tryParse(function () { return parseChildPropertyTag(indent); })) { hasChildren = true; - if (child.kind === 343 /* SyntaxKind.JSDocTypeTag */) { + if (child.kind === 346 /* SyntaxKind.JSDocTypeTag */) { if (childTypeTag) { var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); if (lastError) { @@ -38676,7 +38963,7 @@ var ts; } } if (hasChildren) { - var isArrayType = typeExpression && typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */; + var isArrayType = typeExpression && typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */; var jsdocTypeLiteral = factory.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType); typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : @@ -38728,7 +39015,7 @@ var ts; var returnTag = tryParse(function () { if (parseOptionalJsdoc(59 /* SyntaxKind.AtToken */)) { var tag = parseTag(indent); - if (tag && tag.kind === 341 /* SyntaxKind.JSDocReturnTag */) { + if (tag && tag.kind === 344 /* SyntaxKind.JSDocReturnTag */) { return tag; } } @@ -38763,7 +39050,7 @@ var ts; case 59 /* SyntaxKind.AtToken */: if (canParseTag) { var child = tryParseChildTag(target, indent); - if (child && (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) && + if (child && (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) && target !== 4 /* PropertyLikeParse.CallbackParameter */ && name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; @@ -39733,6 +40020,7 @@ var ts; ["es2019.object", "lib.es2019.object.d.ts"], ["es2019.string", "lib.es2019.string.d.ts"], ["es2019.symbol", "lib.es2019.symbol.d.ts"], + ["es2019.intl", "lib.es2019.intl.d.ts"], ["es2020.bigint", "lib.es2020.bigint.d.ts"], ["es2020.date", "lib.es2020.date.d.ts"], ["es2020.promise", "lib.es2020.promise.d.ts"], @@ -39853,6 +40141,7 @@ var ts; shortName: "h", type: "boolean", showInSimplifiedHelpView: true, + isCommandLineOnly: true, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, defaultValueDescription: false, @@ -39861,6 +40150,8 @@ var ts; name: "help", shortName: "?", type: "boolean", + isCommandLineOnly: true, + category: ts.Diagnostics.Command_line_Options, defaultValueDescription: false, }, { @@ -41592,7 +41883,7 @@ var ts; var _a; var rootExpression = (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression; var knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : undefined; - if (rootExpression && rootExpression.kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (rootExpression && rootExpression.kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, rootExpression, ts.Diagnostics.The_root_value_of_a_0_file_must_be_an_object, ts.getBaseFileName(sourceFile.fileName) === "jsconfig.json" ? "jsconfig.json" : "tsconfig.json")); // Last-ditch error recovery. Somewhat useful because the JSON parser will recover from some parse errors by // synthesizing a top-level array literal expression. There's a reasonable chance the first element of that @@ -41632,7 +41923,7 @@ var ts; function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) { var result = returnValue ? {} : undefined; var _loop_4 = function (element) { - if (element.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (element.kind !== 299 /* SyntaxKind.PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); return "continue"; } @@ -41726,13 +42017,13 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: reportInvalidOptionValue(option && option.type !== "number"); return validateValue(Number(valueExpression.text)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (valueExpression.operator !== 40 /* SyntaxKind.MinusToken */ || valueExpression.operand.kind !== 8 /* SyntaxKind.NumericLiteral */) { break; // not valid JSON syntax } reportInvalidOptionValue(option && option.type !== "number"); return validateValue(-Number(valueExpression.operand.text)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; // Currently having element option declaration in the tsconfig with type "object" @@ -41749,7 +42040,7 @@ var ts; return validateValue(convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined, /*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined)); } - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: reportInvalidOptionValue(option && option.type !== "list"); return validateValue(convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element)); } @@ -41981,12 +42272,23 @@ var ts; } function writeConfigurations() { // Filter applicable options to place in the file - var categorizedOptions = ts.createMultiMap(); + var categorizedOptions = new ts.Map(); + // Set allowed categories in order + categorizedOptions.set(ts.Diagnostics.Projects, []); + categorizedOptions.set(ts.Diagnostics.Language_and_Environment, []); + categorizedOptions.set(ts.Diagnostics.Modules, []); + categorizedOptions.set(ts.Diagnostics.JavaScript_Support, []); + categorizedOptions.set(ts.Diagnostics.Emit, []); + categorizedOptions.set(ts.Diagnostics.Interop_Constraints, []); + categorizedOptions.set(ts.Diagnostics.Type_Checking, []); + categorizedOptions.set(ts.Diagnostics.Completeness, []); for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) { var option = optionDeclarations_1[_i]; - var category = option.category; if (isAllowedOptionForOutput(option)) { - categorizedOptions.add(ts.getLocaleSpecificMessage(category), option); + var listForCategory = categorizedOptions.get(option.category); + if (!listForCategory) + categorizedOptions.set(option.category, listForCategory = []); + listForCategory.push(option); } } // Serialize all options and their descriptions @@ -41997,7 +42299,7 @@ var ts; if (entries.length !== 0) { entries.push({ value: "" }); } - entries.push({ value: "/* ".concat(category, " */") }); + entries.push({ value: "/* ".concat(ts.getLocaleSpecificMessage(category), " */") }); for (var _i = 0, options_1 = options; _i < options_1.length; _i++) { var option = options_1[_i]; var optionName = void 0; @@ -42933,7 +43235,7 @@ var ts; function convertCompilerOptionsForTelemetry(opts) { var out = {}; for (var key in opts) { - if (opts.hasOwnProperty(key)) { + if (ts.hasProperty(opts, key)) { var type = getOptionFromName(key); if (type !== undefined) { // Ignore unknown options out[key] = getOptionValueWithEmptyStrings(opts[key], type); @@ -44039,6 +44341,9 @@ var ts; requestContainingDirectory: containingDirectory, reportDiagnostic: function (diag) { return void diagnostics.push(diag); }, }; + if (traceEnabled && ts.getEmitModuleResolutionKind(compilerOptions) >= ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) <= ts.ModuleResolutionKind.NodeNext) { + trace(host, ts.Diagnostics.Resolving_in_0_mode_with_conditions_1, features & NodeResolutionFeatures.EsmMode ? "ESM" : "CJS", conditions.map(function (c) { return "'".concat(c, "'"); }).join(", ")); + } var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); }); return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache); function tryResolve(extensions) { @@ -44628,7 +44933,7 @@ var ts; } if (mainExport) { var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false); - return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false); + return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false, "."); } } else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) { @@ -44708,7 +45013,7 @@ var ts; var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports); if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) { var target = lookupTable[moduleName]; - return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false); + return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false, moduleName); } var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys); for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) { @@ -44717,17 +45022,17 @@ var ts; var target = lookupTable[potentialTarget]; var starPos = potentialTarget.indexOf("*"); var subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos)); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget); } else if (ts.endsWith(potentialTarget, "*") && ts.startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) { var target = lookupTable[potentialTarget]; var subpath = moduleName.substring(potentialTarget.length - 1); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget); } else if (ts.startsWith(moduleName, potentialTarget)) { var target = lookupTable[potentialTarget]; var subpath = moduleName.substring(potentialTarget.length); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false, potentialTarget); } } function matchesPatternWithTrailer(target, name) { @@ -44744,7 +45049,7 @@ var ts; */ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) { return loadModuleFromTargetImportOrExport; - function loadModuleFromTargetImportOrExport(target, subpath, pattern) { + function loadModuleFromTargetImportOrExport(target, subpath, pattern, key) { if (typeof target === "string") { if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) { if (state.traceEnabled) { @@ -44755,6 +45060,8 @@ var ts; if (!ts.startsWith(target, "./")) { if (isImports && !ts.startsWith(target, "../") && !ts.startsWith(target, "/") && !ts.isRootedDiskPath(target)) { var combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath; + traceIfEnabled(state, ts.Diagnostics.Using_0_subpath_1_with_target_2, "imports", key, combinedLookup); + traceIfEnabled(state, ts.Diagnostics.Resolving_module_0_from_1, combinedLookup, scope.packageDirectory + "/"); var result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference); return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : undefined); } @@ -44781,6 +45088,9 @@ var ts; } return toSearchResult(/*value*/ undefined); } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Using_0_subpath_1_with_target_2, isImports ? "imports" : "exports", key, pattern ? target.replace(/\*/g, subpath) : target + subpath); + } var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath); var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports); if (inputLink) @@ -44790,14 +45100,18 @@ var ts; else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null if (!Array.isArray(target)) { for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) { - var key = _a[_i]; - if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) { - var subTarget = target[key]; - var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern); + var condition = _a[_i]; + if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) { + traceIfEnabled(state, ts.Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition); + var subTarget = target[condition]; + var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key); if (result) { return result; } } + else { + traceIfEnabled(state, ts.Diagnostics.Saw_non_matching_condition_0, condition); + } } return undefined; } @@ -44810,7 +45124,7 @@ var ts; } for (var _b = 0, target_2 = target; _b < target_2.length; _b++) { var elem = target_2[_b]; - var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern); + var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern, key); if (result) { return result; } @@ -45005,6 +45319,7 @@ var ts; } } function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) { + var _a; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName)); // First look for a nested package.json, as in `node_modules/foo/bar/package.json`. var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state); @@ -45019,13 +45334,7 @@ var ts; return withPackageId(packageInfo, fromDirectory); } } - var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest; var loader = function (extensions, candidate, onlyRecordFailures, state) { - var _a; - // package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them) - if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { - return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; - } var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo @@ -45038,19 +45347,24 @@ var ts; } return withPackageId(packageInfo, pathAndExtension); }; - if (rest !== "") { // If "rest" is empty, we just did this search above. - var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); - // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings. + var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest; + var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); + if (rest !== "") { + // Previous `packageInfo` may have been from a nested package.json; ensure we have the one from the package root now. packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.contents.versionPaths) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); - } - var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); - var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); - if (fromPaths) { - return fromPaths.value; - } + } + // package exports are higher priority than file/directory/typesVersions lookups and (and, if there's exports present, blocks them) + if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; + } + if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); + } + var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); + if (fromPaths) { + return fromPaths.value; } } return loader(extensions, candidate, !nodeModulesDirectoryExists, state); @@ -45226,6 +45540,15 @@ var ts; function toSearchResult(value) { return value !== undefined ? { value: value } : undefined; } + function traceIfEnabled(state, diagnostic) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + if (state.traceEnabled) { + trace.apply(void 0, __spreadArray([state.host, diagnostic], args, false)); + } + } })(ts || (ts = {})); /* @internal */ var ts; @@ -45260,26 +45583,26 @@ var ts; // A module is uninstantiated if it contains only switch (node.kind) { // 1. interface declarations, type alias declarations - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return 0 /* ModuleInstanceState.NonInstantiated */; // 2. const enum declarations - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (ts.isEnumConst(node)) { return 2 /* ModuleInstanceState.ConstEnumOnly */; } break; // 3. non-exported import declarations - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (!(ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */))) { return 0 /* ModuleInstanceState.NonInstantiated */; } break; // 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDeclaration = node; - if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 273 /* SyntaxKind.NamedExports */) { + if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 276 /* SyntaxKind.NamedExports */) { var state = 0 /* ModuleInstanceState.NonInstantiated */; for (var _i = 0, _a = exportDeclaration.exportClause.elements; _i < _a.length; _i++) { var specifier = _a[_i]; @@ -45295,7 +45618,7 @@ var ts; } break; // 5. other uninstantiated module declarations. - case 262 /* SyntaxKind.ModuleBlock */: { + case 265 /* SyntaxKind.ModuleBlock */: { var state_1 = 0 /* ModuleInstanceState.NonInstantiated */; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateCached(n, visited); @@ -45317,7 +45640,7 @@ var ts; }); return state_1; } - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(node, visited); case 79 /* SyntaxKind.Identifier */: // Only jsdoc typedef definition can exist in jsdoc namespace, and it should @@ -45518,7 +45841,7 @@ var ts; // Should not be called on a declaration with a computed property name, // unless it is a well known Symbol. function getDeclarationName(node) { - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) { return node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; } var name = ts.getNameOfDeclaration(node); @@ -45527,7 +45850,7 @@ var ts; var moduleName = ts.getTextOfIdentifierOrLiteral(name); return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"".concat(moduleName, "\"")); } - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { var nameExpression = name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteralLike(nameExpression)) { @@ -45553,36 +45876,36 @@ var ts; return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "__constructor" /* InternalSymbolName.Constructor */; - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return "__call" /* InternalSymbolName.Call */; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return "__new" /* InternalSymbolName.New */; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "__index" /* InternalSymbolName.Index */; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return "__export" /* InternalSymbolName.ExportStar */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // json file should behave as // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */) { // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* InternalSymbolName.New */ : "__call" /* InternalSymbolName.Call */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); + ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; @@ -45601,7 +45924,7 @@ var ts; */ function declareSymbol(symbolTable, parent, node, includes, excludes, isReplaceableByMethod, isComputedName) { ts.Debug.assert(isComputedName || !ts.hasDynamicName(node)); - var isDefaultExport = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; + var isDefaultExport = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; // The exported symbol for an export default function/class node is always named "default" var name = isComputedName ? "__computed" /* InternalSymbolName.Computed */ : isDefaultExport && parent ? "default" /* InternalSymbolName.Default */ @@ -45684,7 +46007,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (node.kind === 271 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { + (node.kind === 274 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; messageNeedsName_1 = false; multipleDefaultExports_1 = true; @@ -45723,7 +46046,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = !!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) || jsdocTreatAsExported(node); if (symbolFlags & 2097152 /* SymbolFlags.Alias */) { - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */ || (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */ || (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -45748,7 +46071,7 @@ var ts; if (ts.isJSDocTypeAlias(node)) ts.Debug.assert(ts.isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 64 /* NodeFlags.ExportContext */)) { - if (!container.locals || (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) && !getDeclarationName(node))) { + if (!container.locals || (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) && !getDeclarationName(node))) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default! } var exportKind = symbolFlags & 111551 /* SymbolFlags.Value */ ? 1048576 /* SymbolFlags.ExportValue */ : 0; @@ -45812,7 +46135,7 @@ var ts; // for it. We must clear this so we don't accidentally move any stale data forward from // a previous compilation. if (containerFlags & 1 /* ContainerFlags.IsContainer */) { - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -45834,10 +46157,10 @@ var ts; var saveActiveLabelList = activeLabelList; var saveHasExplicitReturn = hasExplicitReturn; var isImmediatelyInvoked = (containerFlags & 16 /* ContainerFlags.IsFunctionExpression */ && - !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Async */) && + !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Async */) && !node.asteriskToken && !!ts.getImmediatelyInvokedFunctionExpression(node)) || - node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; // A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave // similarly to break statements that exit to a label just past the statement body. if (!isImmediatelyInvoked) { @@ -45848,7 +46171,7 @@ var ts; } // We create a return control flow graph for IIFEs and constructors. For constructors // we use the return control flow graph in strict property initialization checks. - currentReturnTarget = isImmediatelyInvoked || node.kind === 171 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; + currentReturnTarget = isImmediatelyInvoked || node.kind === 173 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; currentExceptionTarget = undefined; currentBreakTarget = undefined; currentContinueTarget = undefined; @@ -45863,14 +46186,14 @@ var ts; node.flags |= 512 /* NodeFlags.HasExplicitReturn */; node.endFlowNode = currentFlow; } - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { node.flags |= emitFlags; node.endFlowNode = currentFlow; } if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); currentFlow = finishFlowLabel(currentReturnTarget); - if (node.kind === 171 /* SyntaxKind.Constructor */ || node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */))) { + if (node.kind === 173 /* SyntaxKind.Constructor */ || node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */))) { node.returnFlowNode = currentFlow; } } @@ -45897,8 +46220,8 @@ var ts; blockScopeContainer = savedBlockScopeContainer; } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -45921,59 +46244,59 @@ var ts; inAssignmentPattern = saveInAssignmentPattern; return; } - if (node.kind >= 237 /* SyntaxKind.FirstStatement */ && node.kind <= 253 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { + if (node.kind >= 240 /* SyntaxKind.FirstStatement */ && node.kind <= 256 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { node.flowNode = currentFlow; } switch (node.kind) { - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: bindWhileStatement(node); break; - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: bindDoStatement(node); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: bindForStatement(node); break; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: bindForInOrForOfStatement(node); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: bindIfStatement(node); break; - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: bindReturnOrThrow(node); break; - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: bindTryStatement(node); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: bindSwitchStatement(node); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: bindCaseBlock(node); break; - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: bindCaseClause(node); break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: bindExpressionStatement(node); break; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: bindLabeledStatement(node); break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { // Carry over whether we are in an assignment pattern to // binary expressions that could actually be an initializer @@ -45983,47 +46306,50 @@ var ts; } bindBinaryExpressionFlow(node); break; - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bindAccessExpressionFlow(node); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bindCallExpressionFlow(node); break; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: bindNonNullExpressionFlow(node); break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: bindJSDocTypeAlias(node); break; // In source files and blocks, bind functions first to match hoisting that occurs at runtime - case 305 /* SyntaxKind.SourceFile */: { + case 308 /* SyntaxKind.SourceFile */: { bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; } - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: bindEachFunctionsFirst(node.statements); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: bindBindingElementFlow(node); break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 225 /* SyntaxKind.SpreadElement */: + case 166 /* SyntaxKind.Parameter */: + bindParameterFlow(node); + break; + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 227 /* SyntaxKind.SpreadElement */: // Carry over whether we are in an assignment pattern of Object and Array literals // as well as their children that are valid assignment targets. inAssignmentPattern = saveInAssignmentPattern; @@ -46040,19 +46366,19 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: case 108 /* SyntaxKind.ThisKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return containsNarrowableReference(expr); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return hasNarrowableArgument(expr); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isNarrowingExpression(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 53 /* SyntaxKind.ExclamationToken */ && isNarrowingExpression(expr.operand); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return isNarrowingExpression(expr.expression); } return false; @@ -46076,7 +46402,7 @@ var ts; } } } - if (expr.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expr.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && containsNarrowableReference(expr.expression.expression)) { return true; } @@ -46109,9 +46435,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (expr.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: return isNarrowableOperand(expr.left); @@ -46187,26 +46513,26 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: + case 245 /* SyntaxKind.ForStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { + else if (node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { node = node.operand; } else { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */); } @@ -46252,7 +46578,7 @@ var ts; } function setContinueTarget(node, target) { var label = activeLabelList; - while (label && node.parent.kind === 250 /* SyntaxKind.LabeledStatement */) { + while (label && node.parent.kind === 253 /* SyntaxKind.LabeledStatement */) { label.continueTarget = target; label = label.next; node = node.parent; @@ -46303,12 +46629,12 @@ var ts; bind(node.expression); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.kind === 247 /* SyntaxKind.ForOfStatement */) { bind(node.awaitModifier); } addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -46330,7 +46656,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (node.kind === 250 /* SyntaxKind.ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -46347,7 +46673,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 246 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 249 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -46452,7 +46778,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 290 /* SyntaxKind.DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 293 /* SyntaxKind.DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). Note, we no longer need // this property in control flow analysis, it's there only for backwards compatibility. @@ -46500,7 +46826,7 @@ var ts; function maybeBindExpressionFlowIfCall(node) { // A top level or comma expression call expression with a dotted function name and at least one argument // is potentially an assertion and is therefore included in the control flow. - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { var call = node; if (call.expression.kind !== 106 /* SyntaxKind.SuperKeyword */ && ts.isDottedName(call.expression)) { currentFlow = createFlowCall(currentFlow, call); @@ -46526,7 +46852,7 @@ var ts; currentFlow = finishFlowLabel(postStatementLabel); } function bindDestructuringTargetFlow(node) { - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -46537,10 +46863,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowMutation(16 /* FlowFlags.Assignment */, currentFlow, node); } - else if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + else if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -46548,16 +46874,16 @@ var ts; } } } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (p.kind === 299 /* SyntaxKind.PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + else if (p.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (p.kind === 301 /* SyntaxKind.SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -46694,7 +47020,7 @@ var ts; var operator = node.operatorToken.kind; if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 209 /* SyntaxKind.ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46722,7 +47048,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -46760,24 +47086,42 @@ var ts; } } function bindBindingElementFlow(node) { - if (ts.isBindingPattern(node.name)) { - // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: - // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - bind(node.dotDotDotToken); - bind(node.propertyName); - bind(node.initializer); - bind(node.name); + // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: + // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + bind(node.dotDotDotToken); + bind(node.propertyName); + bindInitializer(node.initializer); + bind(node.name); + } + function bindParameterFlow(node) { + bindEach(node.modifiers); + bind(node.dotDotDotToken); + bind(node.questionToken); + bind(node.type); + bindInitializer(node.initializer); + bind(node.name); + } + // a BindingElement/Parameter does not have side effects if initializers are not evaluated and used. (see GH#49759) + function bindInitializer(node) { + if (!node) { + return; } - else { - bindEachChild(node); + var entryFlow = currentFlow; + bind(node); + if (entryFlow === unreachableFlow || entryFlow === currentFlow) { + return; } + var exitFlow = createBranchLabel(); + addAntecedent(exitFlow, entryFlow); + addAntecedent(exitFlow, currentFlow); + currentFlow = finishFlowLabel(exitFlow); } function bindJSDocTypeAlias(node) { bind(node.tagName); - if (node.kind !== 339 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { + if (node.kind !== 342 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { // don't bind the type name yet; that's delayed until delayedBindJSDocTypedefTag ts.setParent(node.fullName, node); ts.setParentRecursive(node.fullName, /*incremental*/ false); @@ -46789,7 +47133,7 @@ var ts; function bindJSDocClassTag(node) { bindEachChild(node); var host = ts.getHostSignatureFromJSDoc(node); - if (host && host.kind !== 169 /* SyntaxKind.MethodDeclaration */) { + if (host && host.kind !== 171 /* SyntaxKind.MethodDeclaration */) { addDeclarationToSymbol(host.symbol, host, 32 /* SymbolFlags.Class */); } } @@ -46802,15 +47146,15 @@ var ts; } function bindOptionalChainRest(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: bind(node.questionDotToken); bind(node.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bind(node.questionDotToken); bind(node.argumentExpression); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bind(node.questionDotToken); bindEach(node.typeArguments); bindEach(node.arguments); @@ -46875,7 +47219,7 @@ var ts; // an immediately invoked function expression (IIFE). Initialize the flowNode property to // the current control flow (which includes evaluation of the IIFE arguments). var expr = ts.skipParentheses(node.expression); - if (expr.kind === 213 /* SyntaxKind.FunctionExpression */ || expr.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (expr.kind === 215 /* SyntaxKind.FunctionExpression */ || expr.kind === 216 /* SyntaxKind.ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -46887,7 +47231,7 @@ var ts; } } } - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var propertyAccess = node.expression; if (ts.isIdentifier(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46896,55 +47240,55 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 286 /* SyntaxKind.JsxAttributes */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 289 /* SyntaxKind.JsxAttributes */: return 1 /* ContainerFlags.IsContainer */; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 64 /* ContainerFlags.IsInterface */; - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: - case 176 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: + case 178 /* SyntaxKind.IndexSignature */: return 1 /* ContainerFlags.IsContainer */ | 32 /* ContainerFlags.HasLocals */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 128 /* ContainerFlags.IsObjectLiteralOrClassExpressionMethodOrAccessor */; } // falls through - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 179 /* SyntaxKind.FunctionType */: - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 181 /* SyntaxKind.FunctionType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 16 /* ContainerFlags.IsFunctionExpression */; - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return 4 /* ContainerFlags.IsControlFlowContainer */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer ? 4 /* ContainerFlags.IsControlFlowContainer */ : 0; - case 292 /* SyntaxKind.CatchClause */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 263 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 266 /* SyntaxKind.CaseBlock */: return 2 /* ContainerFlags.IsBlockScopedContainer */; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -46977,46 +47321,46 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 286 /* SyntaxKind.JsxAttributes */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 289 /* SyntaxKind.JsxAttributes */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -47124,10 +47468,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -47224,7 +47568,7 @@ var ts; node.originalKeywordKind <= 125 /* SyntaxKind.LastFutureReservedWord */) { file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); } - else if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + else if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { if (ts.isExternalModule(file) && ts.isInTopLevelContext(node)) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, ts.declarationNameToString(node))); } @@ -47326,8 +47670,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 305 /* SyntaxKind.SourceFile */ && - blockScopeContainer.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && + if (blockScopeContainer.kind !== 308 /* SyntaxKind.SourceFile */ && + blockScopeContainer.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -47424,7 +47768,7 @@ var ts; // the current 'container' node when it changes. This helps us know which symbol table // a local should go into for example. Since terminal nodes are known not to have // children, as an optimization we don't process those. - if (node.kind > 160 /* SyntaxKind.LastToken */) { + if (node.kind > 162 /* SyntaxKind.LastToken */) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -47500,23 +47844,23 @@ var ts; } // falls through case 108 /* SyntaxKind.ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkContextualIdentifier(node); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: if (currentFlow && ts.isPartOfTypeQuery(node)) { node.flowNode = currentFlow; } break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: case 106 /* SyntaxKind.SuperKeyword */: node.flowNode = currentFlow; break; case 80 /* SyntaxKind.PrivateIdentifier */: return checkPrivateIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node; if (currentFlow && isNarrowableReference(expr)) { expr.flowNode = currentFlow; @@ -47531,7 +47875,7 @@ var ts; declareSymbol(file.locals, /*parent*/ undefined, expr.expression, 1 /* SymbolFlags.FunctionScopedVariable */ | 134217728 /* SymbolFlags.ModuleExports */, 111550 /* SymbolFlags.FunctionScopedVariableExcludes */); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var specialKind = ts.getAssignmentDeclarationKind(node); switch (specialKind) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -47567,78 +47911,78 @@ var ts; ts.Debug.fail("Unknown binary expression special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return checkStrictModeCatchClause(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* SyntaxKind.NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkStrictModeWithStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkStrictModeLabeledStatement(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: seenThisKeyword = true; return; - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: break; // Binding the children will handle everything - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return bindTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return bindParameter(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return bindVariableDeclarationOrBindingElement(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return bindPropertyWorker(node); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* SymbolFlags.EnumMember */, 900095 /* SymbolFlags.EnumMemberExcludes */); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* SymbolFlags.Signature */, 0 /* SymbolFlags.None */); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* SymbolFlags.Method */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), ts.isObjectLiteralMethod(node) ? 0 /* SymbolFlags.PropertyExcludes */ : 103359 /* SymbolFlags.MethodExcludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return bindFunctionDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* SymbolFlags.Constructor */, /*symbolExcludes:*/ 0 /* SymbolFlags.None */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* SymbolFlags.GetAccessor */, 46015 /* SymbolFlags.GetAccessorExcludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SymbolFlags.SetAccessor */, 78783 /* SymbolFlags.SetAccessorExcludes */); - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: + case 182 /* SyntaxKind.ConstructorType */: return bindFunctionOrConstructorType(node); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 195 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 197 /* SyntaxKind.MappedType */: return bindAnonymousTypeWorker(node); - case 332 /* SyntaxKind.JSDocClassTag */: + case 335 /* SyntaxKind.JSDocClassTag */: return bindJSDocClassTag(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return bindFunctionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: var assignmentKind = ts.getAssignmentDeclarationKind(node); switch (assignmentKind) { case 7 /* AssignmentDeclarationKind.ObjectDefinePropertyValue */: @@ -47657,70 +48001,73 @@ var ts; } break; // Members of classes, interfaces, and modules - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* SymbolFlags.Interface */, 788872 /* SymbolFlags.InterfaceExcludes */); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* SymbolFlags.TypeAlias */, 788968 /* SymbolFlags.TypeAliasExcludes */); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return bindEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return bindJsxAttributes(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return bindJsxAttribute(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); // Imports and exports - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 2097152 /* SymbolFlags.Alias */, 2097152 /* SymbolFlags.AliasExcludes */); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return bindImportClause(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return bindExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return bindExportAssignment(node); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (!ts.isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) { return; } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 340 /* SyntaxKind.JSDocParameterTag */: - if (node.parent.kind === 323 /* SyntaxKind.JSDocSignature */) { + case 343 /* SyntaxKind.JSDocParameterTag */: + if (node.parent.kind === 326 /* SyntaxKind.JSDocSignature */) { return bindParameter(node); } - if (node.parent.kind !== 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (node.parent.kind !== 325 /* SyntaxKind.JSDocTypeLiteral */) { break; } // falls through - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ ? 4 /* SymbolFlags.Property */ | 16777216 /* SymbolFlags.Optional */ : 4 /* SymbolFlags.Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* SymbolFlags.PropertyExcludes */); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return (delayedTypeAliases || (delayedTypeAliases = [])).push(node); } } function bindPropertyWorker(node) { - return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), 0 /* SymbolFlags.PropertyExcludes */); + var isAutoAccessor = ts.isAutoAccessorPropertyDeclaration(node); + var includes = isAutoAccessor ? 98304 /* SymbolFlags.Accessor */ : 4 /* SymbolFlags.Property */; + var excludes = isAutoAccessor ? 13247 /* SymbolFlags.AccessorExcludes */ : 0 /* SymbolFlags.PropertyExcludes */; + return bindPropertyOrMethodOrAccessor(node, includes | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), excludes); } function bindAnonymousTypeWorker(node) { return bindAnonymousDeclaration(node, 2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); @@ -47880,8 +48227,8 @@ var ts; } var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false); switch (thisContainer.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var constructorSymbol = thisContainer.symbol; // For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression. if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -47903,12 +48250,12 @@ var ts; addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, 32 /* SymbolFlags.Class */); } break; - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // this.foo assignment in a JavaScript class // Bind this property to the containing class var containingClass = thisContainer.parent; @@ -47920,7 +48267,7 @@ var ts; declareSymbol(symbolTable, containingClass.symbol, node, 4 /* SymbolFlags.Property */ | 67108864 /* SymbolFlags.Assignment */, 0 /* SymbolFlags.None */, /*isReplaceableByMethod*/ true); } break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script if (ts.hasDynamicName(node)) { break; @@ -47949,7 +48296,7 @@ var ts; if (node.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { bindThisPropertyAssignment(node); } - else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -47989,7 +48336,7 @@ var ts; } function bindObjectDefinePropertyAssignment(node) { var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]); - var isToplevel = node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + var isToplevel = node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false, /*containerIsClass*/ false); bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false); } @@ -48098,8 +48445,8 @@ var ts; } function isTopLevelNamespaceAssignment(propertyAccess) { return ts.isBinaryExpression(propertyAccess.parent) - ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 305 /* SyntaxKind.SourceFile */ - : propertyAccess.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 308 /* SyntaxKind.SourceFile */ + : propertyAccess.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; } function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) { var namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer); @@ -48178,7 +48525,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 257 /* SyntaxKind.ClassDeclaration */) { + if (node.kind === 260 /* SyntaxKind.ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* SymbolFlags.Class */, 899503 /* SymbolFlags.ClassExcludes */); } else { @@ -48220,7 +48567,7 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } if (!ts.isBindingPattern(node.name)) { - var possibleVariableDecl = node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; + var possibleVariableDecl = node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !ts.getJSDocTypeTag(node) && @@ -48248,7 +48595,7 @@ var ts; } } function bindParameter(node) { - if (node.kind === 340 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 323 /* SyntaxKind.JSDocSignature */) { + if (node.kind === 343 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 326 /* SyntaxKind.JSDocSignature */) { return; } if (inStrictMode && !(node.flags & 16777216 /* NodeFlags.Ambient */)) { @@ -48325,7 +48672,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 262144 /* SymbolFlags.TypeParameter */, 526824 /* SymbolFlags.TypeParameterExcludes */); } } - else if (node.parent.kind === 190 /* SyntaxKind.InferType */) { + else if (node.parent.kind === 192 /* SyntaxKind.InferType */) { var container_2 = getInferTypeContainer(node.parent); if (container_2) { if (!container_2.locals) { @@ -48353,11 +48700,11 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 236 /* SyntaxKind.EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 239 /* SyntaxKind.EmptyStatement */) || // report error on class declarations - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); + (node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); if (reportError) { currentFlow = reportedUnreachableFlow; if (!options.allowUnreachableCode) { @@ -48401,12 +48748,12 @@ var ts; } function isPurelyTypeDeclaration(s) { switch (s.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(s) !== 1 /* ModuleInstanceState.Instantiated */; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.hasSyntacticModifier(s, 2048 /* ModifierFlags.Const */); default: return false; @@ -48607,7 +48954,7 @@ var ts; // (their type resolved directly to the member deeply referenced) // So to get the intervening symbols, we need to check if there's a type // query node on any of the symbol's declarations and get symbols there - if (d.type && d.type.kind === 181 /* SyntaxKind.TypeQuery */) { + if (d.type && d.type.kind === 183 /* SyntaxKind.TypeQuery */) { var query = d.type; var entity = getResolvedSymbol(getFirstIdentifier(query.exprName)); visitSymbol(entity); @@ -48793,8 +49140,6 @@ var ts; IntersectionState[IntersectionState["None"] = 0] = "None"; IntersectionState[IntersectionState["Source"] = 1] = "Source"; IntersectionState[IntersectionState["Target"] = 2] = "Target"; - IntersectionState[IntersectionState["PropertyCheck"] = 4] = "PropertyCheck"; - IntersectionState[IntersectionState["InPropertyCheck"] = 8] = "InPropertyCheck"; })(IntersectionState || (IntersectionState = {})); var RecursionFlags; (function (RecursionFlags) { @@ -49018,6 +49363,7 @@ var ts; getTypeOfPropertyOfType: function (type, name) { return getTypeOfPropertyOfType(type, ts.escapeLeadingUnderscores(name)); }, getIndexInfoOfType: function (type, kind) { return getIndexInfoOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexInfosOfType: getIndexInfosOfType, + getIndexInfosOfIndexSymbol: getIndexInfosOfIndexSymbol, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: function (type, kind) { return getIndexTypeOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexType: function (type) { return getIndexType(type); }, @@ -49043,6 +49389,7 @@ var ts; signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, symbolToEntityName: nodeBuilder.symbolToEntityName, symbolToExpression: nodeBuilder.symbolToExpression, + symbolToNode: nodeBuilder.symbolToNode, symbolToTypeParameterDeclarations: nodeBuilder.symbolToTypeParameterDeclarations, symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration, typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration, @@ -49211,6 +49558,12 @@ var ts; getOptionalType: function () { return optionalType; }, getPromiseType: function () { return getGlobalPromiseType(/*reportErrors*/ false); }, getPromiseLikeType: function () { return getGlobalPromiseLikeType(/*reportErrors*/ false); }, + getAsyncIterableType: function () { + var type = getGlobalAsyncIterableType(/*reportErrors*/ false); + if (type === emptyGenericType) + return undefined; + return type; + }, isSymbolAccessible: isSymbolAccessible, isArrayType: isArrayType, isTupleType: isTupleType, @@ -49291,6 +49644,7 @@ var ts; isPropertyAccessible: isPropertyAccessible, getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration, getMemberOverrideModifierStatus: getMemberOverrideModifierStatus, + isTypeParameterPossiblyReferenced: isTypeParameterPossiblyReferenced, }; function runWithInferenceBlockedFromSourceNode(node, fn) { var containingCall = ts.findAncestor(node, ts.isCallLikeExpression); @@ -49410,7 +49764,8 @@ var ts; var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); emptyTypeLiteralSymbol.members = ts.createSymbolTable(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); - var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType; + var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); + var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType; var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); emptyGenericType.instantiations = new ts.Map(); var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); @@ -49524,6 +49879,8 @@ var ts; var deferredGlobalOmitSymbol; var deferredGlobalAwaitedSymbol; var deferredGlobalBigIntType; + var deferredGlobalNaNSymbol; + var deferredGlobalRecordSymbol; var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name var flowLoopStart = 0; var flowLoopCount = 0; @@ -49713,10 +50070,10 @@ var ts; } // Issue errors globally var file = ts.getSourceFileOfNode(location); - addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line local/no-in-operator return; } - addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line local/no-in-operator } function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) { var diagnostic = error(location, message, arg0, arg1, arg2, arg3); @@ -49945,7 +50302,7 @@ var ts; if (unidirectional === void 0) { unidirectional = false; } source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); - target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol); + target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol)); }); } function mergeModuleAugmentation(moduleName) { @@ -50033,7 +50390,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks()); } function isGlobalSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -50044,9 +50401,9 @@ var ts; return symbol; } if (symbol.flags & 2097152 /* SymbolFlags.Alias */) { - var target = resolveAlias(symbol); - // Unknown symbol means an error occurred in alias resolution, treat it as positive answer to avoid cascading errors - if (target === unknownSymbol || target.flags & meaning) { + var targetFlags = getAllSymbolFlags(symbol); + // `targetFlags` will be `SymbolFlags.All` if an error occurred in alias resolution; this avoids cascading errors + if (targetFlags & meaning) { return symbol; } } @@ -50092,17 +50449,17 @@ var ts; } if (declaration.pos <= usage.pos && !(ts.isPropertyDeclaration(declaration) && ts.isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) { // declaration is before usage - if (declaration.kind === 203 /* SyntaxKind.BindingElement */) { + if (declaration.kind === 205 /* SyntaxKind.BindingElement */) { // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) - var errorBindingElement = ts.getAncestor(usage, 203 /* SyntaxKind.BindingElement */); + var errorBindingElement = ts.getAncestor(usage, 205 /* SyntaxKind.BindingElement */); if (errorBindingElement) { return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || declaration.pos < errorBindingElement.pos; } // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 254 /* SyntaxKind.VariableDeclaration */), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 257 /* SyntaxKind.VariableDeclaration */), usage); } - else if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { + else if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } @@ -50132,12 +50489,12 @@ var ts; // or if usage is in a type context: // 1. inside a type query (typeof in type position) // 2. inside a jsdoc comment - if (usage.parent.kind === 275 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { + if (usage.parent.kind === 278 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { // export specifiers do not use the variable, they only make it available for use return true; } // When resolving symbols for exports, the `usage` location passed in can be the export site directly - if (usage.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { + if (usage.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { return true; } if (!!(usage.flags & 8388608 /* NodeFlags.JSDoc */) || isInTypeQuery(usage) || usageInTypeDeclaration()) { @@ -50159,9 +50516,9 @@ var ts; } function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { switch (declaration.parent.parent.kind) { - case 237 /* SyntaxKind.VariableStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 240 /* SyntaxKind.VariableStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, declContainer)) { @@ -50189,7 +50546,7 @@ var ts; var initializerOfProperty = propertyDeclaration.initializer === current; if (initializerOfProperty) { if (ts.isStatic(current.parent)) { - if (declaration.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (declaration.kind === 171 /* SyntaxKind.MethodDeclaration */) { return true; } if (ts.isPropertyDeclaration(declaration) && ts.getContainingClass(usage) === ts.getContainingClass(declaration)) { @@ -50204,7 +50561,7 @@ var ts; } } else { - var isDeclarationInstanceProperty = declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); + var isDeclarationInstanceProperty = declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { return true; } @@ -50227,19 +50584,19 @@ var ts; return "quit"; } switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // even when stopping at any property declaration, they need to come from the same class return stopAtAnyPropertyDeclaration && (ts.isPropertyDeclaration(declaration) && node.parent === declaration.parent || ts.isParameterPropertyDeclaration(declaration, declaration.parent) && node.parent === declaration.parent.parent) ? "quit" : true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; @@ -50279,18 +50636,18 @@ var ts; } function requiresScopeChangeWorker(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: // do not descend into these return false; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: return requiresScopeChangeWorker(node.name); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // static properties in classes introduce temporary variables if (ts.hasStaticModifier(node)) { return target < 99 /* ScriptTarget.ESNext */ || !useDefineForClassFields; @@ -50319,12 +50676,13 @@ var ts; * the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with * the given name can be found. * + * @param nameNotFoundMessage If defined, we will report errors found during resolve. * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters. */ - function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) { + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) { if (excludeGlobals === void 0) { excludeGlobals = false; } - if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; } - return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol); + if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; } + return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol); } function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) { var _a, _b, _c; @@ -50355,14 +50713,14 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 320 /* SyntaxKind.JSDoc */) { + if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 323 /* SyntaxKind.JSDoc */) { useResult = result.flags & 262144 /* SymbolFlags.TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || - lastLocation.kind === 340 /* SyntaxKind.JSDocParameterTag */ || - lastLocation.kind === 341 /* SyntaxKind.JSDocReturnTag */ || - lastLocation.kind === 163 /* SyntaxKind.TypeParameter */ + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || + lastLocation.kind === 343 /* SyntaxKind.JSDocParameterTag */ || + lastLocation.kind === 344 /* SyntaxKind.JSDocReturnTag */ || + lastLocation.kind === 165 /* SyntaxKind.TypeParameter */ // local types not visible outside the function body : false; } @@ -50377,13 +50735,13 @@ var ts; // however it is detected separately when checking initializers of parameters // to make sure that they reference no variables declared after them. useResult = - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || (lastLocation === location.type && !!ts.findAncestor(result.valueDeclaration, ts.isParameter)); } } } - else if (location.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (location.kind === 191 /* SyntaxKind.ConditionalType */) { // A type parameter declared using 'infer T' in a conditional type is visible only in // the true branch of the conditional type. useResult = lastLocation === location.trueType; @@ -50398,14 +50756,14 @@ var ts; } withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation); switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols; - if (location.kind === 305 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { + if (location.kind === 308 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports.get("default" /* InternalSymbolName.Default */)) { @@ -50429,7 +50787,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 /* SymbolFlags.Alias */ && - (ts.getDeclarationOfKind(moduleExport, 275 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 274 /* SyntaxKind.NamespaceExport */))) { + (ts.getDeclarationOfKind(moduleExport, 278 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 277 /* SyntaxKind.NamespaceExport */))) { break; } } @@ -50443,12 +50801,12 @@ var ts; } } break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (result = lookup(((_c = getSymbolOfNode(location)) === null || _c === void 0 ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* SymbolFlags.EnumMember */)) { break loop; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or @@ -50466,9 +50824,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals // These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would // trigger resolving late-bound names, which we may already be in the process of doing while we're here! @@ -50482,12 +50840,14 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type // parameter list is associated, with the exception of static member declarations in classes. - error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + } return undefined; } break loop; } - if (location.kind === 226 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { + if (location.kind === 228 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -50495,7 +50855,7 @@ var ts; } } break; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // The type parameters of a class are not in scope in the base class expression. if (lastLocation === location.expression && location.parent.token === 94 /* SyntaxKind.ExtendsKeyword */) { var container = location.parent.parent; @@ -50515,34 +50875,36 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) { - error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + } return undefined; } } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // when targeting ES6 or higher there is no 'arguments' in an arrow function // for lower compile targets the resolved symbol is used to emit an error if (ts.getEmitScriptTarget(compilerOptions) >= 2 /* ScriptTarget.ES2015 */) { break; } // falls through - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -50555,7 +50917,7 @@ var ts; } } break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -50564,7 +50926,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 164 /* SyntaxKind.Parameter */) { + if (location.parent && location.parent.kind === 166 /* SyntaxKind.Parameter */) { location = location.parent; } // @@ -50579,20 +50941,20 @@ var ts; // declare function y(x: T): any; // @param(1 as T) // <-- T should resolve to the type alias outside of class C // class C {} - if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 257 /* SyntaxKind.ClassDeclaration */)) { + if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 260 /* SyntaxKind.ClassDeclaration */)) { location = location.parent; } break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // js type aliases do not resolve names from their host, so skip past it var root = ts.getJSDocRoot(location); if (root) { location = root.parent; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (!associatedDeclarationForContainingInitializerOrBindingName) { @@ -50600,7 +50962,7 @@ var ts; } } break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (ts.isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) { @@ -50608,7 +50970,7 @@ var ts; } } break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: if (meaning & 262144 /* SymbolFlags.TypeParameter */) { var parameterName = location.typeParameter.name; if (parameterName && name === parameterName.escapedText) { @@ -50634,7 +50996,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(lastLocation.kind === 308 /* SyntaxKind.SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) { return lastLocation.symbol; } @@ -50674,8 +51036,8 @@ var ts; !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && + !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && - !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) { var suggestion = void 0; var suggestedLib = void 0; @@ -50716,7 +51078,7 @@ var ts; } return undefined; } - else if (checkAndReportErrorForInvalidInitializer()) { + else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) { return undefined; } // Perform extra checks only if error reporting was requested @@ -50762,9 +51124,9 @@ var ts; } } if (result && errorLocation && meaning & 111551 /* SymbolFlags.Value */ && result.flags & 2097152 /* SymbolFlags.Alias */ && !(result.flags & 111551 /* SymbolFlags.Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) { - var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result); + var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* SymbolFlags.Value */); if (typeOnlyDeclaration) { - var message = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ + var message = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; var unescapedName = ts.unescapeLeadingUnderscores(name); @@ -50778,31 +51140,31 @@ var ts; function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) { if (!typeOnlyDeclaration) return diagnostic; - return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); + return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); } function getIsDeferredContext(location, lastLocation) { - if (location.kind !== 214 /* SyntaxKind.ArrowFunction */ && location.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (location.kind !== 216 /* SyntaxKind.ArrowFunction */ && location.kind !== 215 /* SyntaxKind.FunctionExpression */) { // initializers in instance property declaration of class like entities are executed in constructor and thus deferred return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) || - (location.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred + (location.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred } if (lastLocation && lastLocation === location.name) { return false; } // generator functions and async functions are not inlined in control flow when immediately invoked - if (location.asteriskToken || ts.hasSyntacticModifier(location, 256 /* ModifierFlags.Async */)) { + if (location.asteriskToken || ts.hasSyntacticModifier(location, 512 /* ModifierFlags.Async */)) { return true; } return !ts.getImmediatelyInvokedFunctionExpression(location); } function isSelfReferenceLocation(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -50815,7 +51177,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - if (decl.kind === 163 /* SyntaxKind.TypeParameter */) { + if (decl.kind === 165 /* SyntaxKind.TypeParameter */) { var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent; if (parent === container) { return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); @@ -50872,9 +51234,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -50918,14 +51280,14 @@ var ts; return name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never" || name === "unknown"; } function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) { - if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { error(errorLocation, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name); return true; } return false; } function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) { - if (meaning & (111551 /* SymbolFlags.Value */ & ~1024 /* SymbolFlags.NamespaceModule */)) { + if (meaning & 111551 /* SymbolFlags.Value */) { if (isPrimitiveTypeName(name)) { if (isExtendedByInterface(errorLocation)) { error(errorLocation, ts.Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, ts.unescapeLeadingUnderscores(name)); @@ -50936,7 +51298,8 @@ var ts; return true; } var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); - if (symbol && !(symbol.flags & 1024 /* SymbolFlags.NamespaceModule */)) { + var allFlags = symbol && getAllSymbolFlags(symbol); + if (symbol && allFlags !== undefined && !(allFlags & 111551 /* SymbolFlags.Value */)) { var rawName = ts.unescapeLeadingUnderscores(name); if (isES2015OrLaterConstructorName(name)) { error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later, rawName); @@ -50984,16 +51347,16 @@ var ts; } return false; } - function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) { - if (meaning & (111551 /* SymbolFlags.Value */ & ~1024 /* SymbolFlags.NamespaceModule */ & ~788968 /* SymbolFlags.Type */)) { - var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); + function checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) { + if (meaning & (111551 /* SymbolFlags.Value */ & ~788968 /* SymbolFlags.Type */)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); if (symbol) { error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name)); return true; } } - else if (meaning & (788968 /* SymbolFlags.Type */ & ~1024 /* SymbolFlags.NamespaceModule */ & ~111551 /* SymbolFlags.Value */)) { - var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* SymbolFlags.ValueModule */ | 1024 /* SymbolFlags.NamespaceModule */) & ~788968 /* SymbolFlags.Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); + else if (meaning & (788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1536 /* SymbolFlags.Module */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); if (symbol) { error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name)); return true; @@ -51009,7 +51372,7 @@ var ts; return; } // Block-scoped variables cannot be used before their definition - var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 260 /* SyntaxKind.EnumDeclaration */); }); + var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 263 /* SyntaxKind.EnumDeclaration */); }); if (declaration === undefined) return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration"); if (!(declaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { @@ -51046,13 +51409,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return node.parent; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; default: return undefined; @@ -51077,24 +51440,24 @@ var ts; * const { x } = require ... */ function isAliasSymbolDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name - || node.kind === 268 /* SyntaxKind.NamespaceImport */ - || node.kind === 274 /* SyntaxKind.NamespaceExport */ - || node.kind === 270 /* SyntaxKind.ImportSpecifier */ - || node.kind === 275 /* SyntaxKind.ExportSpecifier */ - || node.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name + || node.kind === 271 /* SyntaxKind.NamespaceImport */ + || node.kind === 277 /* SyntaxKind.NamespaceExport */ + || node.kind === 273 /* SyntaxKind.ImportSpecifier */ + || node.kind === 278 /* SyntaxKind.ExportSpecifier */ + || node.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) || ts.isBinaryExpression(node) && ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && ts.exportAssignmentIsAlias(node) || ts.isAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && isAliasableOrJsExpression(node.parent.right) - || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || node.kind === 296 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) - || node.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) - || node.kind === 203 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); + || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || node.kind === 299 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) + || node.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) + || node.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } function isAliasableOrJsExpression(e) { return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e); @@ -51107,7 +51470,7 @@ var ts; ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : undefined; } - if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { var immediate = resolveExternalModuleName(node, ts.getExternalModuleRequireArgument(node) || ts.getExternalModuleImportEqualsDeclarationExpression(node)); var resolved_4 = resolveExternalModuleSymbol(immediate); markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved_4, /*overwriteEmpty*/ false); @@ -51120,7 +51483,7 @@ var ts; function checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved) { if (markSymbolOfAliasDeclarationIfTypeOnly(node, /*immediateTarget*/ undefined, resolved, /*overwriteEmpty*/ false) && !node.isTypeOnly) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfNode(node)); - var isExport = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */; + var isExport = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */; var message = isExport ? ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type; @@ -51139,7 +51502,7 @@ var ts; return resolved; } function isSyntacticDefault(node) { - return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); + return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); } function getUsageModeForExpression(usage) { return ts.isStringLiteralLike(usage) ? ts.getModeForUsageLocation(ts.getSourceFileOfNode(usage), usage) : undefined; @@ -51239,11 +51602,11 @@ var ts; } function getModuleSpecifierForImportOrExport(node) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; - case 268 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; - case 270 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; - case 275 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; + case 270 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; + case 278 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; default: return ts.Debug.assertNever(node); } } @@ -51512,31 +51875,31 @@ var ts; function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; } switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return getTargetOfNamespaceExport(node, dontRecursivelyResolve); - case 270 /* SyntaxKind.ImportSpecifier */: - case 203 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return getTargetOfExportSpecifier(node, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, dontRecursivelyResolve); - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return resolveEntityName(node.name, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ true, dontRecursivelyResolve); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return getTargetOfAccessExpression(node, dontRecursivelyResolve); default: return ts.Debug.fail(); @@ -51583,6 +51946,52 @@ var ts; } return undefined; } + /** + * Gets combined flags of a `symbol` and all alias targets it resolves to. `resolveAlias` + * is typically recursive over chains of aliases, but stops mid-chain if an alias is merged + * with another exported symbol, e.g. + * ```ts + * // a.ts + * export const a = 0; + * // b.ts + * export { a } from "./a"; + * export type a = number; + * // c.ts + * import { a } from "./b"; + * ``` + * Calling `resolveAlias` on the `a` in c.ts would stop at the merged symbol exported + * from b.ts, even though there is still more alias to resolve. Consequently, if we were + * trying to determine if the `a` in c.ts has a value meaning, looking at the flags on + * the local symbol and on the symbol returned by `resolveAlias` is not enough. + * @returns SymbolFlags.All if `symbol` is an alias that ultimately resolves to `unknown`; + * combined flags of all alias targets otherwise. + */ + function getAllSymbolFlags(symbol) { + var flags = symbol.flags; + var seenSymbols; + while (symbol.flags & 2097152 /* SymbolFlags.Alias */) { + var target = resolveAlias(symbol); + if (target === unknownSymbol) { + return 67108863 /* SymbolFlags.All */; + } + // Optimizations - try to avoid creating or adding to + // `seenSymbols` if possible + if (target === symbol || (seenSymbols === null || seenSymbols === void 0 ? void 0 : seenSymbols.has(target))) { + break; + } + if (target.flags & 2097152 /* SymbolFlags.Alias */) { + if (seenSymbols) { + seenSymbols.add(target); + } + else { + seenSymbols = new ts.Set([symbol, target]); + } + } + flags |= target.flags; + symbol = target; + } + return flags; + } /** * Marks a symbol as type-only if its declaration is syntactically type-only. * If it is not itself marked type-only, but resolves to a type-only alias @@ -51628,19 +52037,25 @@ var ts; return !!aliasDeclarationLinks.typeOnlyDeclaration; } /** Indicates that a symbol directly or indirectly resolves to a type-only import or export. */ - function getTypeOnlyAliasDeclaration(symbol) { + function getTypeOnlyAliasDeclaration(symbol, include) { if (!(symbol.flags & 2097152 /* SymbolFlags.Alias */)) { return undefined; } var links = getSymbolLinks(symbol); - return links.typeOnlyDeclaration || undefined; + if (include === undefined) { + return links.typeOnlyDeclaration || undefined; + } + if (links.typeOnlyDeclaration) { + return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : undefined; + } + return undefined; } function markExportAsReferenced(node) { var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target) { var markAlias = target === unknownSymbol || - ((target.flags & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol)); + ((getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)); if (markAlias) { markAliasSymbolAsReferenced(symbol); } @@ -51660,8 +52075,7 @@ var ts; // This way a chain of imports can be elided if ultimately the final input is only used in a type // position. if (ts.isInternalModuleImportEqualsDeclaration(node)) { - var target = resolveSymbol(symbol); - if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(resolveSymbol(symbol)) & 111551 /* SymbolFlags.Value */) { // import foo = checkExpressionCached(node.moduleReference); } @@ -51688,18 +52102,18 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 163 /* SyntaxKind.QualifiedName */) { return resolveEntityName(entityName, 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */); return resolveEntityName(entityName, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } function getFullyQualifiedName(symbol, containingLocation) { - return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); } function getContainingQualifiedNameNode(node) { while (ts.isQualifiedName(node.parent)) { @@ -51740,9 +52154,9 @@ var ts; return getMergedSymbol(symbolFromJSPrototype); } } - else if (name.kind === 161 /* SyntaxKind.QualifiedName */ || name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - var left = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; - var right = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : name.name; + else if (name.kind === 163 /* SyntaxKind.QualifiedName */ || name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + var left = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; + var right = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -51800,7 +52214,7 @@ var ts; throw ts.Debug.assertNever(name, "Unknown entity name kind."); } ts.Debug.assert((ts.getCheckFlags(symbol) & 1 /* CheckFlags.Instantiated */) === 0, "Should never get an instantiated symbol here."); - if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 271 /* SyntaxKind.ExportAssignment */)) { + if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 274 /* SyntaxKind.ExportAssignment */)) { markSymbolOfAliasDeclarationIfTypeOnly(ts.getAliasDeclarationFromName(name), symbol, /*finalTarget*/ undefined, /*overwriteEmpty*/ true); } return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); @@ -52123,7 +52537,7 @@ var ts; var _a; var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { - if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */)) { + if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */)) { var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop"; @@ -52483,13 +52897,13 @@ var ts; } function symbolIsValue(symbol, includeTypeOnlyMembers) { return !!(symbol.flags & 111551 /* SymbolFlags.Value */ || - symbol.flags & 2097152 /* SymbolFlags.Alias */ && resolveAlias(symbol).flags & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol))); + symbol.flags & 2097152 /* SymbolFlags.Alias */ && getAllSymbolFlags(symbol) & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol))); } function findConstructorDeclaration(node) { var members = node.members; for (var _i = 0, members_3 = members; _i < members_3.length; _i++) { var member = members_3[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -52597,12 +53011,12 @@ var ts; } } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var sym = getSymbolOfNode(location); // `sym` may not have exports if this module declaration is backed by the symbol for a `const` that's being rewritten // into a namespace - in such cases, it's best to just let the namespace appear empty (the const members couldn't have referred @@ -52611,9 +53025,9 @@ var ts; return { value: result }; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // Type parameters are bound into `members` lists so they can merge across declarations // This is troublesome, since in all other respects, they behave like locals :cries: // TODO: the below is shared with similar code in `resolveName` - in fact, rephrasing all this symbol @@ -52708,7 +53122,7 @@ var ts; && (isLocalNameLookup ? !ts.some(symbolFromSymbolTable.declarations, ts.isNamespaceReexportDeclaration) : true) // While exports are generally considered to be in scope, export-specifier declared symbols are _not_ // See similar comment in `resolveName` for details - && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */))) { + && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */))) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); var candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification); if (candidate) { @@ -52752,8 +53166,10 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; - if (symbolFromSymbolTable.flags & meaning) { + var shouldResolveAlias = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */)); + symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + var flags = shouldResolveAlias ? getAllSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags; + if (flags & meaning) { qualify = true; return true; } @@ -52767,10 +53183,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: continue; default: return false; @@ -52900,10 +53316,10 @@ var ts; return node && getSymbolOfNode(node); } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { - return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -52971,14 +53387,14 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 181 /* SyntaxKind.TypeQuery */ || - entityName.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || - entityName.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (entityName.parent.kind === 183 /* SyntaxKind.TypeQuery */ || + entityName.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || + entityName.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Typeof value meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } - else if (entityName.kind === 161 /* SyntaxKind.QualifiedName */ || entityName.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (entityName.kind === 163 /* SyntaxKind.QualifiedName */ || entityName.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* SymbolFlags.Namespace */; @@ -53014,15 +53430,18 @@ var ts; if (flags & 8 /* SymbolFormatFlags.UseAliasDefinedOutsideCurrentScope */) { nodeFlags |= 16384 /* NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope */; } - if (flags & 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { + if (flags & 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { nodeFlags |= 134217728 /* NodeBuilderFlags.DoNotIncludeSymbolChain */; } - var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToExpression : nodeBuilder.symbolToEntityName; + if (flags & 16 /* SymbolFormatFlags.WriteComputedProps */) { + nodeFlags |= 1073741824 /* NodeBuilderFlags.WriteComputedProps */; + } + var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName; return writer ? symbolToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(symbolToStringWorker); function symbolToStringWorker(writer) { var entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags); // TODO: GH#18217 // add neverAsciiEscape for GH#39027 - var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 305 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); + var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 308 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); printer.writeNode(4 /* EmitHint.Unspecified */, entity, /*sourceFile*/ sourceFile, writer); return writer; @@ -53034,10 +53453,10 @@ var ts; function signatureToStringWorker(writer) { var sigOutput; if (flags & 262144 /* TypeFormatFlags.WriteArrowStyleSignature */) { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 180 /* SyntaxKind.ConstructorType */ : 179 /* SyntaxKind.FunctionType */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 182 /* SyntaxKind.ConstructorType */ : 181 /* SyntaxKind.FunctionType */; } else { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 175 /* SyntaxKind.ConstructSignature */ : 174 /* SyntaxKind.CallSignature */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 177 /* SyntaxKind.ConstructSignature */ : 176 /* SyntaxKind.CallSignature */; } var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */); var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true }); @@ -53117,7 +53536,25 @@ var ts; symbolTableToDeclarationStatements: function (symbolTable, enclosingDeclaration, flags, tracker, bundled) { return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolTableToDeclarationStatements(symbolTable, context, bundled); }); }, + symbolToNode: function (symbol, meaning, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolToNode(symbol, context, meaning); }); + }, }; + function symbolToNode(symbol, context, meaning) { + if (context.flags & 1073741824 /* NodeBuilderFlags.WriteComputedProps */) { + if (symbol.valueDeclaration) { + var name = ts.getNameOfDeclaration(symbol.valueDeclaration); + if (name && ts.isComputedPropertyName(name)) + return name; + } + var nameType = getSymbolLinks(symbol).nameType; + if (nameType && nameType.flags & (1024 /* TypeFlags.EnumLiteral */ | 8192 /* TypeFlags.UniqueESSymbol */)) { + context.enclosingDeclaration = nameType.symbol.valueDeclaration; + return ts.factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning)); + } + } + return symbolToExpression(symbol, context, meaning); + } function withContext(enclosingDeclaration, flags, tracker, cb) { var _a, _b; ts.Debug.assert(enclosingDeclaration === undefined || (enclosingDeclaration.flags & 8 /* NodeFlags.Synthesized */) === 0); @@ -53202,7 +53639,7 @@ var ts; return undefined; // TODO: GH#18217 } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (!(context.flags & 536870912 /* NodeBuilderFlags.NoTypeReduction */)) { type = getReducedType(type); @@ -53212,29 +53649,29 @@ var ts; return ts.factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context)); } if (type === unresolvedType) { - return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); + return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 138 /* SyntaxKind.IntrinsicKeyword */ : 130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 139 /* SyntaxKind.IntrinsicKeyword */ : 131 /* SyntaxKind.AnyKeyword */); } if (type.flags & 2 /* TypeFlags.Unknown */) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (type.flags & 4 /* TypeFlags.String */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + return ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); } if (type.flags & 8 /* TypeFlags.Number */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(147 /* SyntaxKind.NumberKeyword */); + return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.NumberKeyword */); } if (type.flags & 64 /* TypeFlags.BigInt */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(158 /* SyntaxKind.BigIntKeyword */); + return ts.factory.createKeywordTypeNode(160 /* SyntaxKind.BigIntKeyword */); } if (type.flags & 16 /* TypeFlags.Boolean */ && !type.aliasSymbol) { context.approximateLength += 7; - return ts.factory.createKeywordTypeNode(133 /* SyntaxKind.BooleanKeyword */); + return ts.factory.createKeywordTypeNode(134 /* SyntaxKind.BooleanKeyword */); } if (type.flags & 1024 /* TypeFlags.EnumLiteral */ && !(type.flags & 1048576 /* TypeFlags.Union */)) { var parentSymbol = getParentOfSymbol(type.symbol); @@ -53288,7 +53725,7 @@ var ts; } } context.approximateLength += 13; - return ts.factory.createTypeOperatorNode(154 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */)); + return ts.factory.createTypeOperatorNode(156 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */)); } if (type.flags & 16384 /* TypeFlags.Void */) { context.approximateLength += 4; @@ -53296,7 +53733,7 @@ var ts; } if (type.flags & 32768 /* TypeFlags.Undefined */) { context.approximateLength += 9; - return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); } if (type.flags & 65536 /* TypeFlags.Null */) { context.approximateLength += 4; @@ -53304,15 +53741,15 @@ var ts; } if (type.flags & 131072 /* TypeFlags.Never */) { context.approximateLength += 5; - return ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */); + return ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */); } if (type.flags & 4096 /* TypeFlags.ESSymbol */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */); + return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */); } if (type.flags & 67108864 /* TypeFlags.NonPrimitive */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.ObjectKeyword */); + return ts.factory.createKeywordTypeNode(149 /* SyntaxKind.ObjectKeyword */); } if (ts.isThisTypeParameter(type)) { if (context.flags & 4194304 /* NodeBuilderFlags.InObjectTypeLiteral */) { @@ -53401,7 +53838,7 @@ var ts; var indexedType = type.type; context.approximateLength += 6; var indexTypeNode = typeToTypeNodeHelper(indexedType, context); - return ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); + return ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); } if (type.flags & 134217728 /* TypeFlags.TemplateLiteral */) { var texts_1 = type.texts; @@ -53453,7 +53890,7 @@ var ts; // On the other hand, // checkType extends infer T extends checkType ? T extends extendsType ? trueType : falseType : never; // may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS. - return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } var saveInferTypeParameters = context.inferTypeParameters; context.inferTypeParameters = type.root.inferTypeParameters; @@ -53495,7 +53932,7 @@ var ts; var name = typeParameterToName(newParam, context); newTypeVariable = ts.factory.createTypeReferenceNode(name); } - appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); + appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); } else { appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context); @@ -53511,7 +53948,7 @@ var ts; // wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting // type stays homomorphic var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper); - return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } return result; } @@ -53559,7 +53996,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* SymbolFlags.Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 305 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 262 /* SyntaxKind.ModuleBlock */; + return declaration.parent.kind === 308 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 265 /* SyntaxKind.ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -53648,12 +54085,12 @@ var ts; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { var signature = resolved.callSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 179 /* SyntaxKind.FunctionType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 181 /* SyntaxKind.FunctionType */, context); return signatureNode; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { var signature = resolved.constructSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 180 /* SyntaxKind.ConstructorType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 182 /* SyntaxKind.ConstructorType */, context); return signatureNode; } } @@ -53696,7 +54133,7 @@ var ts; } var elementType = typeToTypeNodeHelper(typeArguments[0], context); var arrayType = ts.factory.createArrayTypeNode(elementType); - return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, arrayType); + return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, arrayType); } else if (type.target.objectFlags & 8 /* ObjectFlags.Tuple */) { typeArguments = ts.sameMap(typeArguments, function (t, i) { return removeMissingType(t, !!(type.target.elementFlags[i] & 2 /* ElementFlags.Optional */)); }); @@ -53721,12 +54158,12 @@ var ts; } } var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode(tupleConstituentNodes), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } } if (context.encounteredError || (context.flags & 524288 /* NodeBuilderFlags.AllowEmptyTuple */)) { var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode([]), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } context.encounteredError = true; return undefined; // TODO: GH#18217 @@ -53833,13 +54270,13 @@ var ts; var typeElements = []; for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 174 /* SyntaxKind.CallSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 176 /* SyntaxKind.CallSignature */, context)); } for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; if (signature.flags & 4 /* SignatureFlags.Abstract */) continue; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 175 /* SyntaxKind.ConstructSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 177 /* SyntaxKind.ConstructSignature */, context)); } for (var _d = 0, _e = resolvedType.indexInfos; _d < _e.length; _d++) { var info = _e[_d]; @@ -53876,7 +54313,7 @@ var ts; if (!(context.flags & 1 /* NodeBuilderFlags.NoTruncation */)) { return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier("..."), /*typeArguments*/ undefined); } - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function shouldUsePlaceholderForProperty(propertySymbol, context) { var _a; @@ -53926,7 +54363,7 @@ var ts; var signatures = getSignaturesOfType(filterType(propertyType, function (t) { return !(t.flags & 32768 /* TypeFlags.Undefined */); }), 0 /* SignatureKind.Call */); for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) { var signature = signatures_1[_i]; - var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 168 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 170 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration)); } } @@ -53940,12 +54377,12 @@ var ts; context.reverseMappedStack || (context.reverseMappedStack = []); context.reverseMappedStack.push(propertySymbol); } - propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); if (propertyIsReverseMapped) { context.reverseMappedStack.pop(); } } - var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined; + var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined; if (modifiers) { context.approximateLength += 9; } @@ -53954,8 +54391,8 @@ var ts; } function preserveCommentsOn(node) { var _a; - if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; })) { - var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; }); + if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; })) { + var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; }); var commentText = ts.getTextOfJSDocComment(d.comment); if (commentText) { ts.setSyntheticLeadingComments(node, [{ kind: 3 /* SyntaxKind.MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); @@ -54054,7 +54491,7 @@ var ts; context.encounteredError = true; } context.approximateLength += (name.length + 4); - return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); + return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); } function signatureToSignatureDeclarationHelper(signature, kind, context, options) { var _a, _b, _c, _d; @@ -54072,7 +54509,7 @@ var ts; } var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0]; // If the expanded parameter list had a variadic in a non-trailing position, don't expand it - var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); + var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 173 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); var thisParameter = context.flags & 33554432 /* NodeBuilderFlags.OmitThisParameter */ ? undefined : tryGetThisParameterDeclaration(signature, context); if (thisParameter) { parameters.unshift(thisParameter); @@ -54081,7 +54518,7 @@ var ts; var typePredicate = getTypePredicateOfSignature(signature); if (typePredicate) { var assertsModifier = typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? - ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : + ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined; var parameterName = typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.setEmitFlags(ts.factory.createIdentifier(typePredicate.parameterName), 16777216 /* EmitFlags.NoAsciiEscaping */) : @@ -54095,28 +54532,28 @@ var ts; returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); } else if (!suppressAny) { - returnTypeNode = ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + returnTypeNode = ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } var modifiers = options === null || options === void 0 ? void 0 : options.modifiers; - if ((kind === 180 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { + if ((kind === 182 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { var flags = ts.modifiersToFlags(modifiers); - modifiers = ts.factory.createModifiersFromModifierFlags(flags | 128 /* ModifierFlags.Abstract */); - } - var node = kind === 174 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : - kind === 175 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : - kind === 168 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : - kind === 169 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 171 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : - kind === 172 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : - kind === 173 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : - kind === 176 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : - kind === 317 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : - kind === 179 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 180 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 256 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 213 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : - kind === 214 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : + modifiers = ts.factory.createModifiersFromModifierFlags(flags | 256 /* ModifierFlags.Abstract */); + } + var node = kind === 176 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : + kind === 177 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : + kind === 170 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : + kind === 171 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 173 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : + kind === 174 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : + kind === 175 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : + kind === 178 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : + kind === 320 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : + kind === 181 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 182 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 215 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : + kind === 216 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : ts.Debug.assertNever(kind); if (typeArguments) { node.typeArguments = ts.factory.createNodeArray(typeArguments); @@ -54153,9 +54590,9 @@ var ts; return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) { - var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 164 /* SyntaxKind.Parameter */); + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 166 /* SyntaxKind.Parameter */); if (!parameterDeclaration && !ts.isTransientSymbol(parameterSymbol)) { - parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 340 /* SyntaxKind.JSDocParameterTag */); + parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 343 /* SyntaxKind.JSDocParameterTag */); } var parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -54167,7 +54604,7 @@ var ts; var dotDotDotToken = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name), 16777216 /* EmitFlags.NoAsciiEscaping */) : - parameterDeclaration.name.kind === 161 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : + parameterDeclaration.name.kind === 163 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : ts.symbolName(parameterSymbol) : ts.symbolName(parameterSymbol); @@ -54331,11 +54768,11 @@ var ts; } function getSpecifierForModuleSymbol(symbol, context, overrideImportMode) { var _a; - var file = ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */); + var file = ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */); if (!file) { var equivalentFileSymbol = ts.firstDefined(symbol.declarations, function (d) { return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); }); if (equivalentFileSymbol) { - file = ts.getDeclarationOfKind(equivalentFileSymbol, 305 /* SyntaxKind.SourceFile */); + file = ts.getDeclarationOfKind(equivalentFileSymbol, 308 /* SyntaxKind.SourceFile */); } } if (file && file.moduleName !== undefined) { @@ -54803,17 +55240,17 @@ var ts; return transformed === existing ? ts.setTextRange(ts.factory.cloneNode(existing), existing) : transformed; function visitExistingNodeTreeSymbols(node) { // We don't _actually_ support jsdoc namepath types, emit `any` instead - if (ts.isJSDocAllType(node) || node.kind === 319 /* SyntaxKind.JSDocNamepathType */) { - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + if (ts.isJSDocAllType(node) || node.kind === 322 /* SyntaxKind.JSDocNamepathType */) { + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (ts.isJSDocUnknownType(node)) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (ts.isJSDocNullableType(node)) { return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createLiteralTypeNode(ts.factory.createNull())]); } if (ts.isJSDocOptionalType(node)) { - return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } if (ts.isJSDocNonNullableType(node)) { return ts.visitNode(node.type, visitExistingNodeTreeSymbols); @@ -54827,11 +55264,11 @@ var ts; var typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText); var overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : undefined; return ts.factory.createPropertySignature( - /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); })); } if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "") { - return ts.setOriginalNode(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), node); + return ts.setOriginalNode(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), node); } if ((ts.isExpressionWithTypeArguments(node) || ts.isTypeReferenceNode(node)) && ts.isJSDocIndexSignature(node)) { return ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature( @@ -54846,12 +55283,12 @@ var ts; return ts.factory.createConstructorTypeNode( /*modifiers*/ undefined, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } else { return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } } if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */, /*ignoreErrors*/ true))) { @@ -54919,8 +55356,8 @@ var ts; } } function symbolTableToDeclarationStatements(symbolTable, context, bundled) { - var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 169 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); - var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 168 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); + var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 171 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); + var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 170 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); // TODO: Use `setOriginalNode` on original declaration names where possible so these declarations see some kind of // declaration mapping // We save the enclosing declaration off here so it's not adjusted by well-meaning declaration @@ -55044,7 +55481,7 @@ var ts; // export {name} - look thru `statements` for `name`, and if all results can take an `export` modifier, do so and filter it var indices = ts.indicesOf(statements); var associatedIndices = ts.filter(indices, function (i) { return ts.nodeHasName(statements[i], e.name); }); - if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return canHaveExportModifier(statements[i]); })) { + if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return ts.canHaveExportModifier(statements[i]); })) { for (var _i = 0, associatedIndices_1 = associatedIndices; _i < associatedIndices_1.length; _i++) { var index_1 = associatedIndices_1[_i]; statements[index_1] = addExportModifier(statements[index_1]); @@ -55078,15 +55515,6 @@ var ts; } return statements; } - function canHaveExportModifier(node) { - return ts.isEnumDeclaration(node) || - ts.isVariableStatement(node) || - ts.isFunctionDeclaration(node) || - ts.isClassDeclaration(node) || - (ts.isModuleDeclaration(node) && !ts.isExternalModuleAugmentation(node) && !ts.isGlobalScopeAugmentation(node)) || - ts.isInterfaceDeclaration(node) || - isTypeDeclaration(node); - } function addExportModifier(node) { var flags = (ts.getEffectiveModifierFlags(node) | 1 /* ModifierFlags.Export */) & ~2 /* ModifierFlags.Ambient */; return ts.factory.updateModifiers(node, flags); @@ -55158,7 +55586,7 @@ var ts; if (needsPostExportDefault || needsExportDeclaration) { isPrivate = true; } - var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 512 /* ModifierFlags.Default */ : 0); + var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 1024 /* ModifierFlags.Default */ : 0); var isConstMergedWithNS = symbol.flags & 1536 /* SymbolFlags.Module */ && symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 1 /* SymbolFlags.FunctionScopedVariable */ | 4 /* SymbolFlags.Property */) && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */; @@ -55175,6 +55603,7 @@ var ts; && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */ && !(symbol.flags & 4194304 /* SymbolFlags.Prototype */) && !(symbol.flags & 32 /* SymbolFlags.Class */) + && !(symbol.flags & 8192 /* SymbolFlags.Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) { if (propertyAsAlias) { var createdExport = serializeMaybeAliasAssignment(symbol); @@ -55332,7 +55761,7 @@ var ts; (ts.isJSDocTypeAlias(context.enclosingDeclaration) ? ts.getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration); if (additionalModifierFlags & 1 /* ModifierFlags.Export */ && enclosingDeclaration_1 && (isExportingScope(enclosingDeclaration_1) || ts.isModuleDeclaration(enclosingDeclaration_1)) && - canHaveExportModifier(node)) { + ts.canHaveExportModifier(node)) { // Classes, namespaces, variables, functions, interfaces, and types should all be `export`ed in a module context if not private newModifierFlags |= 1 /* ModifierFlags.Export */; } @@ -55342,8 +55771,8 @@ var ts; // Classes, namespaces, variables, enums, and functions all need `declare` modifiers to be valid in a declaration file top-level scope newModifierFlags |= 2 /* ModifierFlags.Ambient */; } - if ((additionalModifierFlags & 512 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { - newModifierFlags |= 512 /* ModifierFlags.Default */; + if ((additionalModifierFlags & 1024 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { + newModifierFlags |= 1024 /* ModifierFlags.Default */; } if (newModifierFlags) { node = ts.factory.updateModifiers(node, newModifierFlags | ts.getEffectiveModifierFlags(node)); @@ -55377,8 +55806,8 @@ var ts; var baseTypes = getBaseTypes(interfaceType); var baseType = ts.length(baseTypes) ? getIntersectionType(baseTypes) : undefined; var members = ts.flatMap(getPropertiesOfType(interfaceType), function (p) { return serializePropertySymbolForInterface(p, baseType); }); - var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 174 /* SyntaxKind.CallSignature */); - var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 175 /* SyntaxKind.ConstructSignature */); + var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 176 /* SyntaxKind.CallSignature */); + var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 177 /* SyntaxKind.ConstructSignature */); var indexSignatures = serializeIndexSignatures(interfaceType, baseType); var heritageClauses = !ts.length(baseTypes) ? undefined : [ts.factory.createHeritageClause(94 /* SyntaxKind.ExtendsKeyword */, ts.mapDefined(baseTypes, function (b) { return trySerializeAsTypeReference(b, 111551 /* SymbolFlags.Value */); }))]; addResult(ts.factory.createInterfaceDeclaration( @@ -55388,7 +55817,7 @@ var ts; return !symbol.exports ? [] : ts.filter(ts.arrayFrom(symbol.exports.values()), isNamespaceMember); } function isTypeOnlyNamespace(symbol) { - return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m).flags & 111551 /* SymbolFlags.Value */); }); + return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* SymbolFlags.Value */); }); } function serializeModule(symbol, symbolName, modifierFlags) { var members = getNamespaceMembersForSerialization(symbol); @@ -55443,7 +55872,7 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var sig = signatures_2[_i]; // Each overload becomes a separate function declaration, in order - var decl = signatureToSignatureDeclarationHelper(sig, 256 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); + var decl = signatureToSignatureDeclarationHelper(sig, 259 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); addResult(ts.setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags); } // Module symbol emit will take care of module-y members, provided it has exports @@ -55601,7 +56030,7 @@ var ts; !ts.some(getSignaturesOfType(staticType, 1 /* SignatureKind.Construct */)); var constructors = isNonConstructableClassLikeInJsFile ? [ts.factory.createConstructorDeclaration(ts.factory.createModifiersFromModifierFlags(8 /* ModifierFlags.Private */), [], /*body*/ undefined)] : - serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 171 /* SyntaxKind.Constructor */); + serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 173 /* SyntaxKind.Constructor */); var indexSignatures = serializeIndexSignatures(classType, baseTypes[0]); context.enclosingDeclaration = oldEnclosing; addResult(ts.setTextRange(ts.factory.createClassDeclaration( @@ -55650,8 +56079,8 @@ var ts; var targetName = getInternalSymbolName(target, verbatimTargetName); includePrivateSymbol(target); // the target may be within the same scope - attempt to serialize it first switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 254 /* SyntaxKind.VariableDeclaration */) { + case 205 /* SyntaxKind.BindingElement */: + if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 257 /* SyntaxKind.VariableDeclaration */) { // const { SomeClass } = require('./lib'); var specifier_1 = getSpecifierForModuleSymbol(target.parent || target, context); // './lib' var propertyName = node.propertyName; @@ -55664,13 +56093,13 @@ var ts; // We don't know how to serialize this (nested?) binding element ts.Debug.failBadSyntaxKind(((_c = node.parent) === null || _c === void 0 ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization"); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 221 /* SyntaxKind.BinaryExpression */) { + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 223 /* SyntaxKind.BinaryExpression */) { // module.exports = { SomeClass } serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), targetName); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // commonjs require: const x = require('y') if (ts.isPropertyAccessExpression(node.initializer)) { // const x = require('y').z @@ -55688,7 +56117,7 @@ var ts; break; } // else fall through and treat commonjs require just like import= - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // This _specifically_ only exists to handle json declarations - where we make aliases, but since // we emit no declarations for the json document, must not refer to it in the declarations if (target.escapedName === "export=" /* InternalSymbolName.ExportEquals */ && ts.some(target.declarations, ts.isJsonSourceFile)) { @@ -55704,13 +56133,13 @@ var ts; ? symbolToName(target, context, 67108863 /* SymbolFlags.All */, /*expectsIdentifier*/ false) : ts.factory.createExternalModuleReference(ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))), isLocalImport ? modifierFlags : 0 /* ModifierFlags.None */); break; - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // export as namespace foo // TODO: Not part of a file's local or export symbol tables // Is bound into file.symbol.globalExports instead, which we don't currently traverse addResult(ts.factory.createNamespaceExportDeclaration(ts.idText(node.name)), 0 /* ModifierFlags.None */); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, ts.factory.createIdentifier(localName), /*namedBindings*/ undefined), // We use `target.parent || target` below as `target.parent` is unset when the target is a module which has been export assigned @@ -55719,17 +56148,17 @@ var ts; ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*importClause*/ undefined, ts.factory.createNamespaceImport(ts.factory.createIdentifier(localName))), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: addResult(ts.factory.createExportDeclaration( /*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamespaceExport(ts.factory.createIdentifier(localName)), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))), 0 /* ModifierFlags.None */); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause( /*isTypeOnly*/ false, @@ -55739,7 +56168,7 @@ var ts; ])), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: // does not use localName because the symbol name in this case refers to the name in the exports table, // which we must exactly preserve var specifier = node.parent.parent.moduleSpecifier; @@ -55747,12 +56176,12 @@ var ts; // another file serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: serializeMaybeAliasAssignment(symbol); break; - case 221 /* SyntaxKind.BinaryExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // Could be best encoded as though an export specifier or as though an export assignment // If name is default or export=, do an export assignment // Otherwise do an export specifier @@ -55896,7 +56325,7 @@ var ts; && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName)))) { return []; } - var flag = (modifierFlags & ~256 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); + var flag = (modifierFlags & ~512 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); var name = getPropertyNameNodeForSymbol(p, context); var firstPropertyLikeDecl = (_a = p.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.or(ts.isPropertyDeclaration, ts.isAccessor, ts.isVariableDeclaration, ts.isPropertySignature, ts.isBinaryExpression, ts.isPropertyAccessExpression)); if (p.flags & 98304 /* SymbolFlags.Accessor */ && useAccessors) { @@ -55918,7 +56347,7 @@ var ts; // This is an else/if as accessors and properties can't merge in TS, but might in JS // If this happens, we assume the accessor takes priority, as it imposes more constraints else if (p.flags & (4 /* SymbolFlags.Property */ | 3 /* SymbolFlags.Variable */ | 98304 /* SymbolFlags.Accessor */)) { - return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), + return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357 // interface members can't have initializers, however class members _can_ /*initializer*/ undefined), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts.or(ts.isPropertyDeclaration, ts.isVariableDeclaration))) || firstPropertyLikeDecl); @@ -56108,7 +56537,7 @@ var ts; if (flags === void 0) { flags = 16384 /* TypeFormatFlags.UseAliasDefinedOutsideCurrentScope */; } return writer ? typePredicateToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(typePredicateToStringWorker); function typePredicateToStringWorker(writer) { - var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 + var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 ); var printer = ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); @@ -56155,7 +56584,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ && type.symbol.declarations) { var node = ts.walkUpParenthesizedTypes(type.symbol.declarations[0].parent); - if (node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -56163,11 +56592,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 305 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); + return location.kind === 308 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); } function getNameOfSymbolFromNameType(symbol, context) { var nameType = getSymbolLinks(symbol).nameType; @@ -56226,17 +56655,17 @@ var ts; if (!declaration) { declaration = symbol.declarations[0]; // Declaration may be nameless, but we'll try anyway } - if (declaration.parent && declaration.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (declaration.parent && declaration.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { return ts.declarationNameToString(declaration.parent.name); } switch (declaration.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (context && !context.encounteredError && !(context.flags & 131072 /* NodeBuilderFlags.AllowAnonymousIdentifier */)) { context.encounteredError = true; } - return declaration.kind === 226 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; + return declaration.kind === 228 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; } } var name = getNameOfSymbolFromNameType(symbol, context); @@ -56253,28 +56682,28 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // Top-level jsdoc type aliases are considered exported // First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent)); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return isDeclarationVisible(node.parent.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; @@ -56282,55 +56711,55 @@ var ts; var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) && - !(node.kind !== 265 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 305 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { + !(node.kind !== 268 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 308 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 164 /* SyntaxKind.Parameter */: - case 262 /* SyntaxKind.ModuleBlock */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 178 /* SyntaxKind.TypeReference */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 166 /* SyntaxKind.Parameter */: + case 265 /* SyntaxKind.ModuleBlock */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 180 /* SyntaxKind.TypeReference */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: return false; // Type parameters are always visible - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: // Source file and namespace export are always visible // falls through - case 305 /* SyntaxKind.SourceFile */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return false; default: return false; @@ -56339,10 +56768,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.parent && node.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { exportSymbol = resolveName(node, node.escapedText, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false); } - else if (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + else if (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */); } var result; @@ -56449,12 +56878,12 @@ var ts; function getDeclarationContainer(node) { return ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 255 /* SyntaxKind.VariableDeclarationList */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 269 /* SyntaxKind.NamedImports */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 258 /* SyntaxKind.VariableDeclarationList */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 272 /* SyntaxKind.NamedImports */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: return false; default: return true; @@ -56584,23 +57013,23 @@ var ts; function getParentElementAccess(node) { var ancestor = node.parent.parent; switch (ancestor.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: return getSyntheticElementAccess(ancestor); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getSyntheticElementAccess(node.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ancestor.initializer; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ancestor.right; } } function getDestructuringPropertyName(node) { var parent = node.parent; - if (node.kind === 203 /* SyntaxKind.BindingElement */ && parent.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (node.kind === 205 /* SyntaxKind.BindingElement */ && parent.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { return getLiteralPropertyNameText(node.propertyName || node.name); } - if (node.kind === 296 /* SyntaxKind.PropertyAssignment */ || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.kind === 299 /* SyntaxKind.PropertyAssignment */ || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return getLiteralPropertyNameText(node.name); } return "" + parent.elements.indexOf(node); @@ -56630,7 +57059,7 @@ var ts; parentType = getTypeWithFacts(parentType, 524288 /* TypeFacts.NEUndefined */); } var type; - if (pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (declaration.dotDotDotToken) { parentType = getReducedType(parentType); if (parentType.flags & 2 /* TypeFlags.Unknown */ || !isValidSpreadType(parentType)) { @@ -56701,7 +57130,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, isProperty, isOptional) { if (isProperty === void 0) { isProperty = false; } @@ -56712,11 +57141,11 @@ var ts; function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, /*checkMode*/ checkMode))); return indexType.flags & (262144 /* TypeFlags.TypeParameter */ | 4194304 /* TypeFlags.Index */) ? getExtractStringType(indexType) : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -56727,7 +57156,7 @@ var ts; if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } - var isProperty = ts.isPropertyDeclaration(declaration) || ts.isPropertySignature(declaration); + var isProperty = ts.isPropertyDeclaration(declaration) && !ts.hasAccessorModifier(declaration) || ts.isPropertySignature(declaration); var isOptional = includeOptionality && (isProperty && !!declaration.questionToken || ts.isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) || isOptionalJSDocPropertyLikeTag(declaration)); @@ -56754,8 +57183,8 @@ var ts; if (ts.isParameter(declaration)) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 173 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { - var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 172 /* SyntaxKind.GetAccessor */); + if (func.kind === 175 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { + var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 174 /* SyntaxKind.GetAccessor */); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -56767,11 +57196,9 @@ var ts; return getReturnTypeOfSignature(getterSignature); } } - if (ts.isInJSFile(declaration)) { - var type_1 = getParameterTypeOfTypeTag(func, declaration); - if (type_1) - return type_1; - } + var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration); + if (parameterTypeOfTypeTag) + return parameterTypeOfTypeTag; // Use contextual parameter type if one is available var type = declaration.symbol.escapedName === "this" /* InternalSymbolName.This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration); if (type) { @@ -56832,7 +57259,7 @@ var ts; links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && ts.every(symbol.declarations, function (declaration) { return ts.isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && - (declaration.left.kind !== 207 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && + (declaration.left.kind !== 209 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration(/*declaredType*/ undefined, declaration, symbol, declaration); }); } @@ -56854,11 +57281,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var container = ts.getThisContainer(declaration, /*includeArrowFunctions*/ false); - if (container && (container.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { + if (container && (container.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { return container; } } - ; } /** Create a synthetic property access flow node after the last statement of the file */ function getFlowTypeFromCommonJSExport(symbol) { @@ -57151,9 +57577,9 @@ var ts; var thisContainer = ts.getThisContainer(expression, /*includeArrowFunctions*/ false); // Properties defined in a constructor (or base constructor, or javascript constructor function) don't get undefined added. // Function expressions that are assigned to the prototype count as methods. - return thisContainer.kind === 171 /* SyntaxKind.Constructor */ || - thisContainer.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (thisContainer.kind === 213 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + return thisContainer.kind === 173 /* SyntaxKind.Constructor */ || + thisContainer.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (thisContainer.kind === 215 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); } function getConstructorDefinedThisAssignmentTypes(types, declarations) { ts.Debug.assert(types.length === declarations.length); @@ -57223,7 +57649,7 @@ var ts; function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) { var elements = pattern.elements; var lastElement = ts.lastOrUndefined(elements); - var restElement = lastElement && lastElement.kind === 203 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; + var restElement = lastElement && lastElement.kind === 205 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; if (elements.length === 0 || elements.length === 1 && restElement) { return languageVersion >= 2 /* ScriptTarget.ES2015 */ ? createIterableType(anyType) : anyArrayType; } @@ -57248,7 +57674,7 @@ var ts; function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { if (includePatternInType === void 0) { includePatternInType = false; } if (reportErrors === void 0) { reportErrors = false; } - return pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + return pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -57296,7 +57722,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 164 /* SyntaxKind.Parameter */ ? root.parent : root; + var memberDeclaration = root.kind === 166 /* SyntaxKind.Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function tryGetTypeFromEffectiveTypeNode(node) { @@ -57351,9 +57777,9 @@ var ts; if (typeNode === undefined) { return useUnknownInCatchVariables ? unknownType : anyType; } - var type_2 = getTypeOfNode(typeNode); + var type_1 = getTypeOfNode(typeNode); // an errorType will make `checkTryStatement` issue an error - return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType; + return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType; } // Handle export default expressions if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) { @@ -57376,7 +57802,7 @@ var ts; return reportCircularityError(symbol); } var type; - if (declaration.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (declaration.kind === 274 /* SyntaxKind.ExportAssignment */) { type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); } else if (ts.isBinaryExpression(declaration) || @@ -57444,13 +57870,17 @@ var ts; } function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { - var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation; - } - else { - var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation; + switch (accessor.kind) { + case 174 /* SyntaxKind.GetAccessor */: + var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); + return getterTypeAnnotation; + case 175 /* SyntaxKind.SetAccessor */: + var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation; + case 169 /* SyntaxKind.PropertyDeclaration */: + ts.Debug.assert(ts.hasAccessorModifier(accessor)); + var accessorTypeAnnotation = ts.getEffectiveTypeAnnotationNode(accessor); + return accessorTypeAnnotation; } } return undefined; @@ -57472,14 +57902,17 @@ var ts; if (!pushTypeResolution(symbol, 0 /* TypeSystemPropertyName.Type */)) { return errorType; } - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); + var accessor = ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); // We try to resolve a getter type annotation, a setter type annotation, or a getter function // body return type inference, in that order. var type = getter && ts.isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || - getter && getter.body && getReturnTypeFromBody(getter); + getAnnotatedAccessorType(accessor) || + getter && getter.body && getReturnTypeFromBody(getter) || + accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration(accessor, /*includeOptionality*/ true); if (!type) { if (setter && !isPrivateWithinAmbient(setter)) { errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); @@ -57487,6 +57920,9 @@ var ts; else if (getter && !isPrivateWithinAmbient(getter)) { errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); } + else if (accessor && !isPrivateWithinAmbient(accessor)) { + errorOrSuggestion(noImplicitAny, accessor, ts.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), "any"); + } type = anyType; } if (!popTypeResolution()) { @@ -57496,6 +57932,9 @@ var ts; else if (getAnnotatedAccessorTypeNode(setter)) { error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } + else if (getAnnotatedAccessorTypeNode(accessor)) { + error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } else if (getter && noImplicitAny) { error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } @@ -57506,12 +57945,13 @@ var ts; return links.type; } function getWriteTypeOfAccessors(symbol) { + var _a; var links = getSymbolLinks(symbol); if (!links.writeType) { if (!pushTypeResolution(symbol, 8 /* TypeSystemPropertyName.WriteType */)) { return errorType; } - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var setter = (_a = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */)) !== null && _a !== void 0 ? _a : ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); var writeType = getAnnotatedAccessorType(setter); if (!popTypeResolution()) { if (getAnnotatedAccessorTypeNode(setter)) { @@ -57551,9 +57991,9 @@ var ts; if (symbol.flags & 1536 /* SymbolFlags.Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) { return anyType; } - else if (declaration && (declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || + else if (declaration && (declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || ts.isAccessExpression(declaration) && - declaration.parent.kind === 221 /* SyntaxKind.BinaryExpression */)) { + declaration.parent.kind === 223 /* SyntaxKind.BinaryExpression */)) { return getWidenedTypeForAssignmentDeclaration(symbol); } else if (symbol.flags & 512 /* SymbolFlags.ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) { @@ -57563,11 +58003,11 @@ var ts; return errorType; } var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* InternalSymbolName.ExportEquals */)); - var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); + var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); if (!popTypeResolution()) { return reportCircularityError(symbol); } - return type_3; + return type_2; } } var type = createObjectType(16 /* ObjectFlags.Anonymous */, symbol); @@ -57597,7 +58037,7 @@ var ts; links.type = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol.declarations) ? autoType : declaredType ? declaredType - : targetSymbol.flags & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol) + : getAllSymbolFlags(targetSymbol) & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol) : errorType; } return links.type; @@ -57618,7 +58058,7 @@ var ts; return errorType; } // Check if variable has initializer that circularly references the variable itself - if (noImplicitAny && (declaration.kind !== 164 /* SyntaxKind.Parameter */ || declaration.initializer)) { + if (noImplicitAny && (declaration.kind !== 166 /* SyntaxKind.Parameter */ || declaration.initializer)) { error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); } // Circularities could also result from parameters in function expressions that end up @@ -57750,46 +58190,46 @@ var ts; return undefined; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 195 /* SyntaxKind.MappedType */: - case 189 /* SyntaxKind.ConditionalType */: { + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 197 /* SyntaxKind.MappedType */: + case 191 /* SyntaxKind.ConditionalType */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); - if (node.kind === 195 /* SyntaxKind.MappedType */) { + if (node.kind === 197 /* SyntaxKind.MappedType */) { return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))); } - else if (node.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (node.kind === 191 /* SyntaxKind.ConditionalType */) { return ts.concatenate(outerTypeParameters, getInferTypeParameters(node)); } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node)); var thisType = includeThisTypes && - (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && + (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var paramSymbol = ts.getParameterSymbolFromJSDoc(node); if (paramSymbol) { node = paramSymbol.valueDeclaration; } break; - case 320 /* SyntaxKind.JSDoc */: { + case 323 /* SyntaxKind.JSDoc */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); return node.tags ? appendTypeParameters(outerTypeParameters, ts.flatMap(node.tags, function (t) { return ts.isJSDocTemplateTag(t) ? t.typeParameters : undefined; })) @@ -57800,7 +58240,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); ts.Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations"); return getOuterTypeParameters(declaration); } @@ -57813,9 +58253,9 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || - node.kind === 226 /* SyntaxKind.ClassExpression */ || + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || + node.kind === 228 /* SyntaxKind.ClassExpression */ || isJSConstructor(node) || ts.isTypeAlias(node)) { var declaration = node; @@ -57967,7 +58407,7 @@ var ts; if (!popTypeResolution() && type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { reportCircularBaseType(declaration, type); } } @@ -58063,7 +58503,7 @@ var ts; if (type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getReducedType(getTypeFromTypeNode(node)); @@ -58103,7 +58543,7 @@ var ts; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (declaration.flags & 128 /* NodeFlags.ContainsThis */) { return false; } @@ -58182,7 +58622,7 @@ var ts; } else { type = errorType; - if (declaration.kind === 339 /* SyntaxKind.JSDocEnumTag */) { + if (declaration.kind === 342 /* SyntaxKind.JSDocEnumTag */) { error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } else { @@ -58197,7 +58637,7 @@ var ts; if (ts.isStringLiteralLike(expr)) { return true; } - else if (expr.kind === 221 /* SyntaxKind.BinaryExpression */) { + else if (expr.kind === 223 /* SyntaxKind.BinaryExpression */) { return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right); } return false; @@ -58212,12 +58652,12 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; case 79 /* SyntaxKind.Identifier */: return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isStringConcatExpression(expr); default: return false; @@ -58232,7 +58672,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && ts.isStringLiteralLike(member.initializer)) { @@ -58261,7 +58701,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var value = getEnumMemberValue(member); @@ -58334,22 +58774,22 @@ var ts; */ function isThislessType(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 196 /* SyntaxKind.LiteralType */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 198 /* SyntaxKind.LiteralType */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isThislessType(node.elementType); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return !node.typeArguments || node.typeArguments.every(isThislessType); } return false; @@ -58375,7 +58815,7 @@ var ts; function isThislessFunctionLikeDeclaration(node) { var returnType = ts.getEffectiveReturnTypeNode(node); var typeParameters = ts.getEffectiveTypeParameterDeclarations(node); - return (node.kind === 171 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && + return (node.kind === 173 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); } @@ -58391,14 +58831,14 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return isThislessVariableLikeDeclaration(declaration); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return isThislessFunctionLikeDeclaration(declaration); } } @@ -58609,8 +59049,10 @@ var ts; if (members) { for (var _b = 0, members_5 = members; _b < members_5.length; _b++) { var member = members_5[_b]; - if (isStatic_1 === ts.hasStaticModifier(member) && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === ts.hasStaticModifier(member)) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58625,8 +59067,10 @@ var ts; || ts.isBinaryExpression(member) && isPossiblyAliasedThisProperty(member, assignmentKind) || assignmentKind === 9 /* AssignmentDeclarationKind.ObjectDefinePrototypeProperty */ || assignmentKind === 6 /* AssignmentDeclarationKind.Prototype */; // A straight `Prototype` assignment probably can never have a computed name - if (isStatic_1 === !isInstanceMember && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === !isInstanceMember) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58813,7 +59257,7 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); var declaration = ts.getClassLikeDeclarationOfSymbol(classType.symbol); - var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); if (baseSignatures.length === 0) { return [createSignature(undefined, classType.localTypeParameters, undefined, ts.emptyArray, classType, /*resolvedTypePredicate*/ undefined, 0, isAbstract ? 4 /* SignatureFlags.Abstract */ : 0 /* SignatureFlags.None */)]; } @@ -59435,8 +59879,8 @@ var ts; } function isMappedTypeWithKeyofConstraintDeclaration(type) { var constraintDeclaration = getConstraintDeclarationForMappedType(type); // TODO: GH#18217 - return constraintDeclaration.kind === 193 /* SyntaxKind.TypeOperator */ && - constraintDeclaration.operator === 140 /* SyntaxKind.KeyOfKeyword */; + return constraintDeclaration.kind === 195 /* SyntaxKind.TypeOperator */ && + constraintDeclaration.operator === 141 /* SyntaxKind.KeyOfKeyword */; } function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { @@ -59476,7 +59920,20 @@ var ts; return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(type) & 4 /* MappedTypeModifiers.IncludeOptional */); } function isGenericMappedType(type) { - return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) && isGenericIndexType(getConstraintTypeFromMappedType(type)); + if (ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) { + var constraint = getConstraintTypeFromMappedType(type); + if (isGenericIndexType(constraint)) { + return true; + } + // A mapped type is generic if the 'as' clause references generic types other than the iteration type. + // To determine this, we substitute the constraint type (that we now know isn't generic) for the iteration + // type and check whether the resulting type is generic. + var nameType = getNameTypeFromMappedType(type); + if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) { + return true; + } + } + return false; } function resolveStructuredTypeMembers(type) { if (!type.members) { @@ -59796,10 +60253,10 @@ var ts; var baseTypes = []; var different = false; for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type_4 = types_7[_i]; - var baseType = getBaseConstraint(type_4); + var type_3 = types_7[_i]; + var baseType = getBaseConstraint(type_3); if (baseType) { - if (baseType !== type_4) { + if (baseType !== type_3) { different = true; } baseTypes.push(baseType); @@ -59843,7 +60300,7 @@ var ts; return constraint && getBaseConstraint(constraint); } if (t.flags & 33554432 /* TypeFlags.Substitution */) { - return getBaseConstraint(t.substitute); + return getBaseConstraint(getSubstitutionIntersection(t)); } return t; } @@ -59946,7 +60403,7 @@ var ts; var indexTypes; var isUnion = containingType.flags & 1048576 /* TypeFlags.Union */; // Flags we want to propagate to the result if they exist in all source symbols - var optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */; + var optionalFlag; var syntheticFlag = 4 /* CheckFlags.SyntheticMethod */; var checkFlags = isUnion ? 0 : 8 /* CheckFlags.Readonly */; var mergedInstantiations = false; @@ -59957,11 +60414,14 @@ var ts; var prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment); var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0; if (prop) { - if (isUnion) { - optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */); - } - else { - optionalFlag &= prop.flags; + if (prop.flags & 106500 /* SymbolFlags.ClassMember */) { + optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : (optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */); + if (isUnion) { + optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */); + } + else { + optionalFlag &= prop.flags; + } } if (!singleProp) { singleProp = prop; @@ -59970,7 +60430,7 @@ var ts; var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp); // If the symbols are instances of one another with identical types - consider the symbols // equivalent and just use the first one, which thus allows us to avoid eliding private - // members when intersecting a (this-)instantiations of a class with it's raw base or another instance + // members when intersecting a (this-)instantiations of a class with its raw base or another instance if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) { // If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used // to do when we recorded multiple distinct symbols so that we still get, eg, `Array.length` printed @@ -60018,7 +60478,11 @@ var ts; } } } - if (!singleProp || isUnion && (propSet || checkFlags & 48 /* CheckFlags.Partial */) && checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */)) { + if (!singleProp || + isUnion && + (propSet || checkFlags & 48 /* CheckFlags.Partial */) && + checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */) && + !(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) { // No property was found, or, in a union, a property has a private or protected declaration in one // constituent, but is missing or has a different declaration in another constituent. return undefined; @@ -60076,7 +60540,7 @@ var ts; propTypes.push(type); } ts.addRange(propTypes, indexTypes); - var result = createSymbol(4 /* SymbolFlags.Property */ | optionalFlag, name, syntheticFlag | checkFlags); + var result = createSymbol(4 /* SymbolFlags.Property */ | (optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : 0), name, syntheticFlag | checkFlags); result.containingType = containingType; if (!hasNonUniformValueDeclaration && firstValueDeclaration) { result.valueDeclaration = firstValueDeclaration; @@ -60120,6 +60584,33 @@ var ts; } return property; } + function getCommonDeclarationsOfSymbols(symbols) { + var commonDeclarations; + var _loop_14 = function (symbol) { + if (!symbol.declarations) { + return { value: undefined }; + } + if (!commonDeclarations) { + commonDeclarations = new ts.Set(symbol.declarations); + return "continue"; + } + commonDeclarations.forEach(function (declaration) { + if (!ts.contains(symbol.declarations, declaration)) { + commonDeclarations.delete(declaration); + } + }); + if (commonDeclarations.size === 0) { + return { value: undefined }; + } + }; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var symbol = symbols_3[_i]; + var state_4 = _loop_14(symbol); + if (typeof state_4 === "object") + return state_4.value; + } + return commonDeclarations; + } function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) { var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment); // We need to filter out partial properties in union types @@ -60323,10 +60814,10 @@ var ts; function isJSDocOptionalParameter(node) { return ts.isInJSFile(node) && ( // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType - node.type && node.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ + node.type && node.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -60359,14 +60850,14 @@ var ts; return false; } function isOptionalPropertyDeclaration(node) { - return ts.isPropertyDeclaration(node) && node.questionToken; + return ts.isPropertyDeclaration(node) && !ts.hasAccessorModifier(node) && node.questionToken; } function isOptionalJSDocPropertyLikeTag(node) { if (!ts.isJSDocPropertyLikeTag(node)) { return false; } var isBracketed = node.isBracketed, typeExpression = node.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; } function createTypePredicate(kind, parameterName, parameterIndex, type) { return { kind: kind, parameterName: parameterName, parameterIndex: parameterIndex, type: type }; @@ -60448,7 +60939,7 @@ var ts; else { parameters.push(paramSymbol); } - if (type && type.kind === 196 /* SyntaxKind.LiteralType */) { + if (type && type.kind === 198 /* SyntaxKind.LiteralType */) { flags |= 2 /* SignatureFlags.HasLiteralTypes */; } // Record a new minimum argument count if this is not an optional parameter @@ -60461,24 +60952,24 @@ var ts; } } // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation - if ((declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) && + if ((declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) && hasBindableName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + var otherKind = declaration.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - var classType = declaration.kind === 171 /* SyntaxKind.Constructor */ ? + var classType = declaration.kind === 173 /* SyntaxKind.Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration); if (ts.hasRestParameter(declaration) || ts.isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) { flags |= 1 /* SignatureFlags.HasRestParameter */; } - if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */) || - ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 128 /* ModifierFlags.Abstract */)) { + if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */) || + ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 256 /* ModifierFlags.Abstract */)) { flags |= 4 /* SignatureFlags.Abstract */; } links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, @@ -60557,16 +61048,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node.escapedText === argumentsSymbol.escapedName && getReferencedValueSymbol(node) === argumentsSymbol; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && traverse(node.name); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return traverse(node.expression); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return traverse(node.initializer); default: return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse); @@ -60590,7 +61081,12 @@ var ts; continue; } } - result.push(getSignatureFromDeclaration(decl)); + // If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters. + // Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would supress checks that the two are compatible. + result.push((!ts.isFunctionExpressionOrArrowFunction(decl) && + !ts.isObjectLiteralMethod(decl) && + getSignatureOfTypeTag(decl)) || + getSignatureFromDeclaration(decl)); } return result; } @@ -60621,7 +61117,7 @@ var ts; else { var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration); var jsdocPredicate = void 0; - if (!type && ts.isInJSFile(signature.declaration)) { + if (!type) { var jsdocSignature = getSignatureOfTypeTag(signature.declaration); if (jsdocSignature && signature !== jsdocSignature) { jsdocPredicate = getTypePredicateOfSignature(jsdocSignature); @@ -60638,7 +61134,7 @@ var ts; function createTypePredicateFromTypePredicateNode(node, signature) { var parameterName = node.parameterName; var type = node.type && getTypeFromTypeNode(node.type); - return parameterName.kind === 192 /* SyntaxKind.ThisType */ ? + return parameterName.kind === 194 /* SyntaxKind.ThisType */ ? createTypePredicate(node.assertsModifier ? 2 /* TypePredicateKind.AssertsThis */ : 0 /* TypePredicateKind.This */, /*parameterName*/ undefined, /*parameterIndex*/ undefined, type) : createTypePredicate(node.assertsModifier ? 3 /* TypePredicateKind.AssertsIdentifier */ : 1 /* TypePredicateKind.Identifier */, parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type); } @@ -60684,7 +61180,7 @@ var ts; return signature.resolvedReturnType; } function getReturnTypeFromAnnotation(declaration) { - if (declaration.kind === 171 /* SyntaxKind.Constructor */) { + if (declaration.kind === 173 /* SyntaxKind.Constructor */) { return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)); } if (ts.isJSDocConstructSignature(declaration)) { @@ -60694,12 +61190,12 @@ var ts; if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration); if (jsDocType) { return jsDocType; } - var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 173 /* SyntaxKind.SetAccessor */); + var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 175 /* SyntaxKind.SetAccessor */); var setterType = getAnnotatedAccessorType(setter); if (setterType) { return setterType; @@ -60802,7 +61298,7 @@ var ts; if (!signature.isolatedSignatureType) { var kind = (_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind; // If declaration is undefined, it is likely to be the signature of the default constructor. - var isConstructor = kind === undefined || kind === 171 /* SyntaxKind.Constructor */ || kind === 175 /* SyntaxKind.ConstructSignature */ || kind === 180 /* SyntaxKind.ConstructorType */; + var isConstructor = kind === undefined || kind === 173 /* SyntaxKind.Constructor */ || kind === 177 /* SyntaxKind.ConstructSignature */ || kind === 182 /* SyntaxKind.ConstructorType */; var type = createObjectType(16 /* ObjectFlags.Anonymous */); type.members = emptySymbols; type.properties = ts.emptyArray; @@ -60829,7 +61325,7 @@ var ts; function getIndexInfosOfIndexSymbol(indexSymbol) { if (indexSymbol.declarations) { var indexInfos_4 = []; - var _loop_14 = function (declaration) { + var _loop_15 = function (declaration) { if (declaration.parameters.length === 1) { var parameter = declaration.parameters[0]; if (parameter.type) { @@ -60843,7 +61339,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_14(declaration); + _loop_15(declaration); } return indexInfos_4; } @@ -60860,14 +61356,14 @@ var ts; var _a; var inferences; if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) { - var _loop_15 = function (declaration) { - if (declaration.parent.kind === 190 /* SyntaxKind.InferType */) { + var _loop_16 = function (declaration) { + if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) { // When an 'infer T' declaration is immediately contained in a type reference node // (such as 'Foo'), T's constraint is inferred from the constraint of the // corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are // present, we form an intersection of the inferred constraint types. var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1]; - if (grandParent.kind === 178 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { + if (grandParent.kind === 180 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { var typeReference_1 = grandParent; var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1); if (typeParameters_1) { @@ -60894,27 +61390,27 @@ var ts; } // When an 'infer T' declaration is immediately contained in a rest parameter declaration, a rest type // or a named rest tuple element, we infer an 'unknown[]' constraint. - else if (grandParent.kind === 164 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || - grandParent.kind === 186 /* SyntaxKind.RestType */ || - grandParent.kind === 197 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { + else if (grandParent.kind === 166 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || + grandParent.kind === 188 /* SyntaxKind.RestType */ || + grandParent.kind === 199 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { inferences = ts.append(inferences, createArrayType(unknownType)); } // When an 'infer T' declaration is immediately contained in a string template type, we infer a 'string' // constraint. - else if (grandParent.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */) { + else if (grandParent.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */) { inferences = ts.append(inferences, stringType); } // When an 'infer T' declaration is in the constraint position of a mapped type, we infer a 'keyof any' // constraint. - else if (grandParent.kind === 163 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 195 /* SyntaxKind.MappedType */) { + else if (grandParent.kind === 165 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 197 /* SyntaxKind.MappedType */) { inferences = ts.append(inferences, keyofConstraintType); } // When an 'infer T' declaration is the template of a mapped type, and that mapped type is the extends // clause of a conditional whose check type is also a mapped type, give it a constraint equal to the template // of the check type's mapped type - else if (grandParent.kind === 195 /* SyntaxKind.MappedType */ && grandParent.type && - ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 189 /* SyntaxKind.ConditionalType */ && - grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 195 /* SyntaxKind.MappedType */ && + else if (grandParent.kind === 197 /* SyntaxKind.MappedType */ && grandParent.type && + ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 191 /* SyntaxKind.ConditionalType */ && + grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 197 /* SyntaxKind.MappedType */ && grandParent.parent.checkType.type) { var checkMappedType_1 = grandParent.parent.checkType; var nodeType = getTypeFromTypeNode(checkMappedType_1.type); @@ -60924,7 +61420,7 @@ var ts; }; for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - _loop_15(declaration); + _loop_16(declaration); } } return inferences && getIntersectionType(inferences); @@ -60946,7 +61442,7 @@ var ts; if (type.flags & 1 /* TypeFlags.Any */ && !isErrorType(type)) { // Allow errorType to propegate to keep downstream errors suppressed // use keyofConstraintType as the base constraint for mapped type key constraints (unknown isn;t assignable to that, but `any` was), // use unknown otherwise - type = constraintDeclaration.parent.parent.kind === 195 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; + type = constraintDeclaration.parent.parent.kind === 197 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; } typeParameter.constraint = type; } @@ -60955,7 +61451,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - var tp = ts.getDeclarationOfKind(typeParameter.symbol, 163 /* SyntaxKind.TypeParameter */); + var tp = ts.getDeclarationOfKind(typeParameter.symbol, 165 /* SyntaxKind.TypeParameter */); var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getEffectiveContainerForJSDocTemplateTag(tp.parent) : tp.parent; return host && getSymbolOfNode(host); } @@ -61041,8 +61537,8 @@ var ts; } var node = type.node; var typeArguments = !node ? ts.emptyArray : - node.kind === 178 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : - node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : + node.kind === 180 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : + node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); if (popTypeResolution()) { type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments; @@ -61084,7 +61580,7 @@ var ts; return errorType; } } - if (node.kind === 178 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { return createDeferredTypeReference(type, node, /*mapper*/ undefined); } // In a type reference, the outer type parameters of the referenced class or interface are automatically @@ -61155,9 +61651,9 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -61172,13 +61668,13 @@ var ts; return symbol.parent ? "".concat(getSymbolPath(symbol.parent), ".").concat(symbol.escapedName) : symbol.escapedName; } function getUnresolvedSymbolForEntityName(name) { - var identifier = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? name.name : + var identifier = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? name.name : name; var text = identifier.escapedText; if (text) { - var parentSymbol = name.kind === 161 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : + var parentSymbol = name.kind === 163 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : undefined; var path = parentSymbol ? "".concat(getSymbolPath(parentSymbol), ".").concat(text) : text; var result = unresolvedSymbols.get(path); @@ -61239,7 +61735,7 @@ var ts; var valueType = getTypeOfSymbol(symbol); var typeType = valueType; if (symbol.valueDeclaration) { - var isImportTypeWithQualifier = node.kind === 200 /* SyntaxKind.ImportType */ && node.qualifier; + var isImportTypeWithQualifier = node.kind === 202 /* SyntaxKind.ImportType */ && node.qualifier; // valueType might not have a symbol, eg, {import('./b').STRING_LITERAL} if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) { typeType = getTypeReferenceType(node, valueType.symbol); @@ -61249,23 +61745,27 @@ var ts; } return links.resolvedJSDocType; } - function getSubstitutionType(baseType, substitute) { - if (substitute.flags & 3 /* TypeFlags.AnyOrUnknown */ || substitute === baseType) { + function getSubstitutionType(baseType, constraint) { + if (constraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || constraint === baseType || + !isGenericType(baseType) && !isGenericType(constraint)) { return baseType; } - var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(substitute)); + var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(constraint)); var cached = substitutionTypes.get(id); if (cached) { return cached; } var result = createType(33554432 /* TypeFlags.Substitution */); result.baseType = baseType; - result.substitute = substitute; + result.constraint = constraint; substitutionTypes.set(id, result); return result; } + function getSubstitutionIntersection(substitutionType) { + return getIntersectionType([substitutionType.constraint, substitutionType.baseType]); + } function isUnaryTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 1; + return node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 1; } function getImpliedConstraint(type, checkNode, extendsNode) { return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) : @@ -61275,16 +61775,16 @@ var ts; function getConditionalFlowTypeOfType(type, node) { var constraints; var covariant = true; - while (node && !ts.isStatement(node) && node.kind !== 320 /* SyntaxKind.JSDoc */) { + while (node && !ts.isStatement(node) && node.kind !== 323 /* SyntaxKind.JSDoc */) { var parent = node.parent; // only consider variance flipped by parameter locations - `keyof` types would usually be considered variance inverting, but // often get used in indexed accesses where they behave sortof invariantly, but our checking is lax - if (parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 166 /* SyntaxKind.Parameter */) { covariant = !covariant; } // Always substitute on type parameters, regardless of variance, since even // in contravariant positions, they may rely on substituted constraints to be valid - if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 189 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { + if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 191 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { var constraint = getImpliedConstraint(type, parent.checkType, parent.extendsType); if (constraint) { constraints = ts.append(constraints, constraint); @@ -61292,7 +61792,7 @@ var ts; } // Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the // template type XXX, K has an added constraint of number | `${number}`. - else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 195 /* SyntaxKind.MappedType */ && node === parent.type) { + else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 197 /* SyntaxKind.MappedType */ && node === parent.type) { var mappedType = getTypeFromTypeNode(parent); if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { var typeParameter = getHomomorphicTypeVariable(mappedType); @@ -61306,10 +61806,10 @@ var ts; } node = parent; } - return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type; + return constraints ? getSubstitutionType(type, getIntersectionType(constraints)) : type; } function isJSDocTypeReference(node) { - return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 200 /* SyntaxKind.ImportType */); + return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 202 /* SyntaxKind.ImportType */); } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { @@ -61424,9 +61924,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declaration; } } @@ -61577,6 +62077,13 @@ var ts; function getGlobalBigIntType() { return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType; } + function getGlobalNaNSymbol() { + return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false))); + } + function getGlobalRecordSymbol() { + deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol); + return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol; + } /** * Instantiates a global type that is generic with some element type, and returns that instantiation. */ @@ -61594,11 +62101,11 @@ var ts; } function getTupleElementFlags(node) { switch (node.kind) { - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return 2 /* ElementFlags.Optional */; - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getRestTypeElementFlags(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return node.questionToken ? 2 /* ElementFlags.Optional */ : node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* ElementFlags.Required */; @@ -61616,14 +62123,14 @@ var ts; return readonly ? globalReadonlyArrayType : globalArrayType; } var elementFlags = ts.map(node.elements, getTupleElementFlags); - var missingName = ts.some(node.elements, function (e) { return e.kind !== 197 /* SyntaxKind.NamedTupleMember */; }); + var missingName = ts.some(node.elements, function (e) { return e.kind !== 199 /* SyntaxKind.NamedTupleMember */; }); return getTupleTargetType(elementFlags, readonly, /*associatedNames*/ missingName ? undefined : node.elements); } // Return true if the given type reference node is directly aliased or if it needs to be deferred // because it is possibly contained in a circular chain of eagerly resolved types. function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) { - return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 183 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : - node.kind === 184 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : + return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 185 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : + node.kind === 186 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || ts.some(node.typeArguments, mayResolveTypeAlias)); } // Return true when the given node is transitively contained in type constructs that eagerly @@ -61632,18 +62139,18 @@ var ts; function isResolvedByTypeAlias(node) { var parent = node.parent; switch (parent.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 189 /* SyntaxKind.ConditionalType */: - case 193 /* SyntaxKind.TypeOperator */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 191 /* SyntaxKind.ConditionalType */: + case 195 /* SyntaxKind.TypeOperator */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return isResolvedByTypeAlias(parent); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } return false; @@ -61652,28 +62159,28 @@ var ts; // of a type alias. function mayResolveTypeAlias(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */).flags & 524288 /* SymbolFlags.TypeAlias */); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return true; - case 193 /* SyntaxKind.TypeOperator */: - return node.operator !== 154 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 195 /* SyntaxKind.TypeOperator */: + return node.operator !== 156 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 319 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return mayResolveTypeAlias(node.type); - case 186 /* SyntaxKind.RestType */: - return node.type.kind !== 183 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 188 /* SyntaxKind.RestType */: + return node.type.kind !== 185 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return ts.some(node.types, mayResolveTypeAlias); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return mayResolveTypeAlias(node.checkType) || mayResolveTypeAlias(node.extendsType) || mayResolveTypeAlias(node.trueType) || mayResolveTypeAlias(node.falseType); } @@ -61686,19 +62193,19 @@ var ts; if (target === emptyGenericType) { links.resolvedType = emptyObjectType; } - else if (!(node.kind === 184 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { - links.resolvedType = node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : + else if (!(node.kind === 186 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { + links.resolvedType = node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : createDeferredTypeReference(target, node, /*mapper*/ undefined); } else { - var elementTypes = node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); + var elementTypes = node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); links.resolvedType = createNormalizedTypeReference(target, elementTypes); } } return links.resolvedType; } function isReadonlyTypeOperator(node) { - return ts.isTypeOperatorNode(node) && node.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + return ts.isTypeOperatorNode(node) && node.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } function createTupleType(elementTypes, elementFlags, readonly, namedMemberDeclarations) { if (readonly === void 0) { readonly = false; } @@ -61813,7 +62320,7 @@ var ts; var lastRequiredIndex = -1; var firstRestIndex = -1; var lastOptionalOrRestIndex = -1; - var _loop_16 = function (i) { + var _loop_17 = function (i) { var type = elementTypes[i]; var flags = target.elementFlags[i]; if (flags & 8 /* ElementFlags.Variadic */) { @@ -61843,9 +62350,9 @@ var ts; } }; for (var i = 0; i < elementTypes.length; i++) { - var state_4 = _loop_16(i); - if (typeof state_4 === "object") - return state_4.value; + var state_5 = _loop_17(i); + if (typeof state_5 === "object") + return state_5.value; } // Turn optional elements preceding the last required element into required elements for (var i = 0; i < lastRequiredIndex; i++) { @@ -61873,7 +62380,7 @@ var ts; if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) { lastOptionalOrRestIndex = expandedFlags.length; } - expandedTypes.push(type); + expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type); expandedFlags.push(flags); if (expandedDeclarations && declaration) { expandedDeclarations.push(declaration); @@ -62039,7 +62546,7 @@ var ts; var templates = ts.filter(types, isPatternLiteralType); if (templates.length) { var i = types.length; - var _loop_17 = function () { + var _loop_18 = function () { i--; var t = types[i]; if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) { @@ -62047,7 +62554,7 @@ var ts; } }; while (i > 0) { - _loop_17(); + _loop_18(); } } } @@ -62124,14 +62631,14 @@ var ts; var namedUnions = []; addNamedUnions(namedUnions, types); var reducedTypes = []; - var _loop_18 = function (t) { + var _loop_19 = function (t) { if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) { reducedTypes.push(t); } }; for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) { var t = typeSet_1[_i]; - _loop_18(t); + _loop_19(t); } if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) { return namedUnions[0]; @@ -62621,7 +63128,7 @@ var ts; type.flags & 16777216 /* TypeFlags.Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* TypeFlags.UnionOrIntersection */ | 134217728 /* TypeFlags.TemplateLiteral */) ? ts.every(type.types, isDistributive) : type.flags & 8388608 /* TypeFlags.IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.substitute) : + type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* TypeFlags.StringMapping */ ? isDistributive(type.type) : false; } @@ -62702,15 +63209,15 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { switch (node.operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); break; - case 154 /* SyntaxKind.UniqueKeyword */: - links.resolvedType = node.type.kind === 151 /* SyntaxKind.SymbolKeyword */ + case 156 /* SyntaxKind.UniqueKeyword */: + links.resolvedType = node.type.kind === 153 /* SyntaxKind.SymbolKeyword */ ? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent)) : errorType; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: links.resolvedType = getTypeFromTypeNode(node.type); break; default: @@ -62746,8 +63253,14 @@ var ts; return getStringLiteralType(text); } newTexts.push(text); - if (ts.every(newTexts, function (t) { return t === ""; }) && ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) { - return stringType; + if (ts.every(newTexts, function (t) { return t === ""; })) { + if (ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) { + return stringType; + } + // Normalize `${Mapping}` into Mapping + if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) { + return newTypes[0]; + } } var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join("")); var type = templateLiteralTypes.get(id); @@ -62806,12 +63319,14 @@ var ts; } function getStringMappingType(symbol, type) { return type.flags & (1048576 /* TypeFlags.Union */ | 131072 /* TypeFlags.Never */) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) : - // Mapping> === Mapping - type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type : - isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456 /* TypeFlags.StringMapping */) ? getTemplateLiteralType(["", ""], [type]) : type) : - type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : - type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) : - type; + type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : + type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) : + // Mapping> === Mapping + type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type : + type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 268435456 /* TypeFlags.StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : + // This handles Mapping<`${number}`> and Mapping<`${bigint}`> + isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) : + type; } function applyStringMapping(symbol, str) { switch (intrinsicTypeKinds.get(symbol.escapedName)) { @@ -62902,7 +63417,7 @@ var ts; } function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, accessNode, accessFlags) { var _a; - var accessExpression = accessNode && accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; var propName = accessNode && ts.isPrivateIdentifier(accessNode) ? undefined : getPropertyNameFromIndex(indexType, accessNode); if (propName !== undefined) { if (accessFlags & 256 /* AccessFlags.Contextual */) { @@ -62976,7 +63491,18 @@ var ts; return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; } errorIfWritingToReadonlyIndex(indexInfo); - return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; + // When accessing an enum object with its own type, + // e.g. E[E.A] for enum E { A }, undefined shouldn't + // be included in the result type + if ((accessFlags & 1 /* AccessFlags.IncludeUndefined */) && + !(objectType.symbol && + objectType.symbol.flags & (256 /* SymbolFlags.RegularEnum */ | 128 /* SymbolFlags.ConstEnum */) && + (indexType.symbol && + indexType.flags & 1024 /* TypeFlags.EnumLiteral */ && + getParentOfSymbol(indexType.symbol) === objectType.symbol))) { + return getUnionType([indexInfo.type, undefinedType]); + } + return indexInfo.type; } if (indexType.flags & 131072 /* TypeFlags.Never */) { return neverType; @@ -63073,16 +63599,17 @@ var ts; } } function getIndexNodeForAccessExpression(accessNode) { - return accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : - accessNode.kind === 194 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : - accessNode.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : + return accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : + accessNode.kind === 196 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : + accessNode.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : accessNode; } function isPatternLiteralPlaceholderType(type) { - return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || !!(type.flags & 268435456 /* TypeFlags.StringMapping */ && isPatternLiteralPlaceholderType(type.type)); + return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || isPatternLiteralType(type); } function isPatternLiteralType(type) { - return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType); + return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType) || + !!(type.flags & 268435456 /* TypeFlags.StringMapping */) && isPatternLiteralPlaceholderType(type.type); } function isGenericType(type) { return !!getGenericObjectFlags(type); @@ -63104,7 +63631,7 @@ var ts; if (type.flags & 33554432 /* TypeFlags.Substitution */) { if (!(type.objectFlags & 2097152 /* ObjectFlags.IsGenericTypeComputed */)) { type.objectFlags |= 2097152 /* ObjectFlags.IsGenericTypeComputed */ | - getGenericObjectFlags(type.substitute) | getGenericObjectFlags(type.baseType); + getGenericObjectFlags(type.baseType) | getGenericObjectFlags(type.constraint); } return type.objectFlags & 12582912 /* ObjectFlags.IsGenericType */; } @@ -63255,7 +63782,7 @@ var ts; // for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved // eagerly using the constraint type of 'this' at the given location. - if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 194 /* SyntaxKind.IndexedAccessType */ ? + if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 196 /* SyntaxKind.IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) { if (objectType.flags & 3 /* TypeFlags.AnyOrUnknown */) { @@ -63307,11 +63834,7 @@ var ts; var objectType = getTypeFromTypeNode(node.objectType); var indexType = getTypeFromTypeNode(node.indexType); var potentialAlias = getAliasSymbolForTypeNode(node); - var resolved = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); - links.resolvedType = resolved.flags & 8388608 /* TypeFlags.IndexedAccess */ && - resolved.objectType === objectType && - resolved.indexType === indexType ? - getConditionalFlowTypeOfType(resolved, node) : resolved; + links.resolvedType = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); } return links.resolvedType; } @@ -63365,18 +63888,23 @@ var ts; var result; var extraTypes; var tailCount = 0; - var _loop_19 = function () { + // We loop here for an immediately nested conditional type in the false position, effectively treating + // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for + // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of + // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive + // cases we increment the tail recursion counter and stop after 1000 iterations. + while (true) { if (tailCount === 1000) { error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); result = errorType; - return "break"; + break; } var isUnwrapped = isTypicalNondistributiveConditional(root); var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper); var checkTypeInstantiable = isGenericType(checkType); var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper); if (checkType === wildcardType || extendsType === wildcardType) { - return { value: wildcardType }; + return wildcardType; } var combinedMapper = void 0; if (root.inferTypeParameters) { @@ -63409,11 +63937,7 @@ var ts; } } } - // We skip inference of the possible `infer` types unles the `extendsType` _is_ an infer type - // if it was, it's trivial to say that extendsType = checkType, however such a pattern is used to - // "reset" the type being build up during constraint calculation and avoid making an apparently "infinite" constraint - // so in those cases we refain from performing inference and retain the uninfered type parameter - if (!checkTypeInstantiable || !ts.some(root.inferTypeParameters, function (t) { return t === extendsType; })) { + if (!checkTypeInstantiable) { // We don't want inferences from constraints as they may cause us to eagerly resolve the // conditional type instead of deferring resolution. Also, we always want strict function // types rules (i.e. proper contravariance) for inferences. @@ -63445,14 +63969,14 @@ var ts; var newRoot = falseType_1.root; if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) { root = newRoot; - return "continue"; + continue; } if (canTailRecurse(falseType_1, mapper)) { - return "continue"; + continue; } } result = instantiateType(falseType_1, mapper); - return "break"; + break; } // Return trueType for a definitely true extends check. We check instantiations of the two // types with type parameters mapped to their restrictive form, i.e. a form of the type parameter @@ -63463,10 +63987,10 @@ var ts; var trueType_1 = getTypeFromTypeNode(root.node.trueType); var trueMapper = combinedMapper || mapper; if (canTailRecurse(trueType_1, trueMapper)) { - return "continue"; + continue; } result = instantiateType(trueType_1, trueMapper); - return "break"; + break; } } // Return a deferred type for a check that is neither definitely true nor definitely false @@ -63478,19 +64002,7 @@ var ts; result.combinedMapper = combinedMapper; result.aliasSymbol = aliasSymbol || root.aliasSymbol; result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217 - return "break"; - }; - // We loop here for an immediately nested conditional type in the false position, effectively treating - // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for - // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of - // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive - // cases we increment the tail recursion counter and stop after 1000 iterations. - while (true) { - var state_5 = _loop_19(); - if (typeof state_5 === "object") - return state_5.value; - if (state_5 === "break") - break; + break; } return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result; // We tail-recurse for generic conditional types that (a) have not already been evaluated and cached, and @@ -63682,7 +64194,7 @@ var ts; } function getAliasSymbolForTypeNode(node) { var host = node.parent; - while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { host = host.parent; } return ts.isTypeAlias(host) ? getSymbolOfNode(host) : undefined; @@ -63927,7 +64439,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */)) { if (!ts.isStatic(container) && (!ts.isConstructorDeclaration(container) || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -63962,17 +64474,17 @@ var ts; } function getArrayElementTypeNode(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return getArrayElementTypeNode(node.type); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: if (node.elements.length === 1) { node = node.elements[0]; - if (node.kind === 186 /* SyntaxKind.RestType */ || node.kind === 197 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { + if (node.kind === 188 /* SyntaxKind.RestType */ || node.kind === 199 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { return getArrayElementTypeNode(node.type); } } break; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return node.elementType; } return undefined; @@ -63988,99 +64500,99 @@ var ts; } function getTypeFromTypeNodeWorker(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 131 /* SyntaxKind.AnyKeyword */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return anyType; - case 155 /* SyntaxKind.UnknownKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return unknownType; - case 150 /* SyntaxKind.StringKeyword */: + case 152 /* SyntaxKind.StringKeyword */: return stringType; - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return numberType; - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return bigintType; - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return booleanType; - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return esSymbolType; case 114 /* SyntaxKind.VoidKeyword */: return voidType; - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return undefinedType; case 104 /* SyntaxKind.NullKeyword */: // TODO(rbuckton): `NullKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service. return nullType; - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return neverType; - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return node.flags & 262144 /* NodeFlags.JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType; - case 138 /* SyntaxKind.IntrinsicKeyword */: + case 139 /* SyntaxKind.IntrinsicKeyword */: return intrinsicMarkerType; - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: // TODO(rbuckton): `ThisKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service and because of `isPartOfTypeNode`. return getTypeFromThisTypeNode(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return getTypeFromLiteralTypeNode(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getTypeFromTypeReference(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? voidType : booleanType; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return getTypeFromTypeQueryNode(node); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return getTypeFromArrayOrTupleTypeNode(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return getTypeFromOptionalTypeNode(node); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return getTypeFromUnionTypeNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return addOptionality(getTypeFromTypeNode(node.type)); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return getTypeFromNamedTupleTypeNode(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return getTypeFromTypeNode(node.type); - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getTypeFromRestTypeNode(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return getTypeFromMappedTypeNode(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getTypeFromConditionalTypeNode(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return getTypeFromInferTypeNode(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return getTypeFromTemplateTypeNode(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return getTypeFromImportTypeNode(node); // This function assumes that an identifier, qualified name, or property access expression is a type expression // Callers should first ensure this by calling `isPartOfTypeNode` // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var symbol = getSymbolAtLocation(node); return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; default: @@ -64187,8 +64699,8 @@ var ts; return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* TypeMapKind.Merged */, mapper, makeUnaryTypeMapper(source, target)); } function getRestrictiveTypeParameter(tp) { - return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), - tp.restrictiveInstantiation.constraint = unknownType, + return !tp.constraint && !getConstraintDeclaration(tp) || tp.constraint === noConstraintType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), + tp.restrictiveInstantiation.constraint = noConstraintType, tp.restrictiveInstantiation); } function cloneTypeParameter(typeParameter) { @@ -64302,17 +64814,18 @@ var ts; return type; } function maybeTypeParameterReference(node) { - return !(node.parent.kind === 178 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || - node.parent.kind === 200 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); + return !(node.parent.kind === 180 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || + node.parent.kind === 202 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); } function isTypeParameterPossiblyReferenced(tp, node) { - // If the type parameter doesn't have exactly one declaration, if there are invening statement blocks + // If the type parameter doesn't have exactly one declaration, if there are intervening statement blocks // between the node and the type parameter declaration, if the node contains actual references to the - // type parameter, or if the node contains type queries, we consider the type parameter possibly referenced. + // type parameter, or if the node contains type queries that we can't prove couldn't contain references to the type parameter, + // we consider the type parameter possibly referenced. if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container = tp.symbol.declarations[0].parent; for (var n = node; n !== container; n = n.parent) { - if (!n || n.kind === 235 /* SyntaxKind.Block */ || n.kind === 189 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { + if (!n || n.kind === 238 /* SyntaxKind.Block */ || n.kind === 191 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { return true; } } @@ -64321,15 +64834,36 @@ var ts; return true; function containsReference(node) { switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return !!tp.isThisType; case 79 /* SyntaxKind.Identifier */: return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && getTypeFromTypeNodeWorker(node) === tp; // use worker because we're looking for === equality - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: + var entityName = node.exprName; + var firstIdentifier = ts.getFirstIdentifier(entityName); + var firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); + var tpDeclaration = tp.symbol.declarations[0]; // There is exactly one declaration, otherwise `containsReference` is not called + var tpScope_1; + if (tpDeclaration.kind === 165 /* SyntaxKind.TypeParameter */) { // Type parameter is a regular type parameter, e.g. foo + tpScope_1 = tpDeclaration.parent; + } + else if (tp.isThisType) { + // Type parameter is the this type, and its declaration is the class declaration. + tpScope_1 = tpDeclaration; + } + else { + // Type parameter's declaration was unrecognized. + // This could happen if the type parameter comes from e.g. a JSDoc annotation, so we default to returning true. + return true; + } + if (firstIdentifierSymbol.declarations) { + return ts.some(firstIdentifierSymbol.declarations, function (idDecl) { return ts.isNodeDescendantOf(idDecl, tpScope_1); }) || + ts.some(node.typeArguments, containsReference); + } return true; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return !node.type && !!node.body || ts.some(node.typeParameters, containsReference) || ts.some(node.parameters, containsReference) || @@ -64551,17 +65085,18 @@ var ts; return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments); } if (flags & 33554432 /* TypeFlags.Substitution */) { - var maybeVariable = instantiateType(type.baseType, mapper); - if (maybeVariable.flags & 8650752 /* TypeFlags.TypeVariable */) { - return getSubstitutionType(maybeVariable, instantiateType(type.substitute, mapper)); + var newBaseType = instantiateType(type.baseType, mapper); + var newConstraint = instantiateType(type.constraint, mapper); + // A substitution type originates in the true branch of a conditional type and can be resolved + // to just the base type in the same cases as the conditional type resolves to its true branch + // (because the base type is then known to satisfy the constraint). + if (newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ && isGenericType(newConstraint)) { + return getSubstitutionType(newBaseType, newConstraint); } - else { - var sub = instantiateType(type.substitute, mapper); - if (sub.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) { - return maybeVariable; - } - return sub; + if (newConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(newBaseType), getRestrictiveInstantiation(newConstraint))) { + return newBaseType; } + return newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); } return type; } @@ -64610,35 +65145,35 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type return isContextSensitiveFunctionLikeDeclaration(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return ts.some(node.properties, isContextSensitive); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return ts.some(node.elements, isContextSensitive); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return isContextSensitive(node.initializer); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isContextSensitive(node.expression); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive); - case 285 /* SyntaxKind.JsxAttribute */: { + case 288 /* SyntaxKind.JsxAttribute */: { // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. var initializer = node.initializer; return !!initializer && isContextSensitive(initializer); } - case 288 /* SyntaxKind.JsxExpression */: { + case 291 /* SyntaxKind.JsxExpression */: { // It is possible to that node.expression is undefined (e.g
) var expression = node.expression; return !!expression && isContextSensitive(expression); @@ -64647,15 +65182,14 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return (!ts.isFunctionDeclaration(node) || ts.isInJSFile(node) && !!getTypeForDeclarationFromJSDocComment(node)) && - (ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node)); + return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node); } function hasContextSensitiveReturnExpression(node) { // TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value. - return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 /* SyntaxKind.Block */ && isContextSensitive(node.body); + return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 238 /* SyntaxKind.Block */ && isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { - return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && + return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { @@ -64756,23 +65290,23 @@ var ts; return true; } switch (node.kind) { - case 288 /* SyntaxKind.JsxExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 27 /* SyntaxKind.CommaToken */: return elaborateError(node.right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); } break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer); } return false; @@ -64981,7 +65515,7 @@ var ts; } function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) { switch (child.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: // child is of the type of the expression return { errorNode: child, innerExpression: child.expression, nameType: nameType }; case 11 /* SyntaxKind.JsxText */: @@ -64990,9 +65524,9 @@ var ts; } // child is a string return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() }; - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: // child is of type JSX.Element return { errorNode: child, innerExpression: child, nameType: nameType }; default: @@ -65140,11 +65674,11 @@ var ts; } _b = prop.kind; switch (_b) { - case 173 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; - case 172 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; - case 169 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; - case 296 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; + case 175 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; + case 174 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; + case 171 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; + case 299 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; } return [3 /*break*/, 6]; case 2: return [4 /*yield*/, { errorNode: prop.name, innerExpression: undefined, nameType: type }]; @@ -65217,8 +65751,8 @@ var ts; void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers); } var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; - var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 169 /* SyntaxKind.MethodDeclaration */ && - kind !== 168 /* SyntaxKind.MethodSignature */ && kind !== 171 /* SyntaxKind.Constructor */; + var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 171 /* SyntaxKind.MethodDeclaration */ && + kind !== 170 /* SyntaxKind.MethodSignature */ && kind !== 173 /* SyntaxKind.Constructor */; var result = -1 /* Ternary.True */; var sourceThisType = getThisTypeOfSignature(source); if (sourceThisType && sourceThisType !== voidType) { @@ -65515,7 +66049,7 @@ var ts; var t = isFreshLiteralType(type) ? type.regularType : ts.getObjectFlags(type) & 4 /* ObjectFlags.Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* TypeFlags.UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : type.substitute : + type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* TypeFlags.Simplifiable */ ? getSimplifiedType(type, writing) : type; if (t === type) @@ -65922,7 +66456,8 @@ var ts; return 0 /* Ternary.False */; } } - var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2 /* IntersectionState.Target */) && + var isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source)) && + !(intersectionState & 2 /* IntersectionState.Target */) && source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType && target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) && (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)); @@ -65949,27 +66484,6 @@ var ts; var result_7 = skipCaching ? unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) : recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags); - // For certain combinations involving intersections and optional, excess, or mismatched properties we need - // an extra property check where the intersection is viewed as a single object. The following are motivating - // examples that all should be errors, but aren't without this extra property check: - // - // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property - // - // declare let wrong: { a: { y: string } }; - // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type - // - // function foo(x: { a?: string }, y: T & { a: boolean }) { - // x = y; // Mismatched property in source intersection - // } - // - // We suppress recursive intersection property checks because they can generate lots of work when relating - // recursive intersections that are structurally similar but not exactly identical. See #37854. - if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) || - isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) { - inPropertyCheck = true; - result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* IntersectionState.PropertyCheck */, recursionFlags); - inPropertyCheck = false; - } if (result_7) { return result_7; } @@ -66174,11 +66688,15 @@ var ts; // parameter 'T extends 1 | 2', the intersection 'T & 1' should be reduced to '1' such that it doesn't // appear to be comparable to '2'. if (relation === comparableRelation && target.flags & 131068 /* TypeFlags.Primitive */) { - var constraints = ts.sameMap(source.types, getBaseConstraintOrType); + var constraints = ts.sameMap(source.types, function (t) { return t.flags & 465829888 /* TypeFlags.Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t; }); if (constraints !== source.types) { source = getIntersectionType(constraints); + if (source.flags & 131072 /* TypeFlags.Never */) { + return 0 /* Ternary.False */; + } if (!(source.flags & 2097152 /* TypeFlags.Intersection */)) { - return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); + return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false) || + isRelatedTo(target, source, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); } } } @@ -66363,8 +66881,7 @@ var ts; if (overflow) { return 0 /* Ternary.False */; } - var keyIntersectionState = intersectionState | (inPropertyCheck ? 8 /* IntersectionState.InPropertyCheck */ : 0); - var id = getRelationKey(source, target, keyIntersectionState, relation, /*ingnoreConstraints*/ false); + var id = getRelationKey(source, target, intersectionState, relation, /*ingnoreConstraints*/ false); var entry = relation.get(id); if (entry !== undefined) { if (reportErrors && entry & 2 /* RelationComparisonResult.Failed */ && !(entry & 4 /* RelationComparisonResult.Reported */)) { @@ -66394,7 +66911,7 @@ var ts; // A key that starts with "*" is an indication that we have type references that reference constrained // type parameters. For such keys we also check against the key we would have gotten if all type parameters // were unconstrained. - var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, /*ignoreConstraints*/ true) : undefined; + var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, intersectionState, relation, /*ignoreConstraints*/ true) : undefined; for (var i = 0; i < maybeCount; i++) { // If source and target are already being compared, consider them related with assumptions if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) { @@ -66481,7 +66998,7 @@ var ts; function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) { var saveErrorInfo = captureErrorCalculationState(); var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo); - if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) { + if (relation !== identityRelation) { // The combined constraint of an intersection type is the intersection of the constraints of // the constituents. When an intersection type contains instantiable types with union type // constraints, there are situations where we need to examine the combined constraint. One is @@ -66495,10 +67012,33 @@ var ts; // needs to have its constraint hoisted into an intersection with said type parameter, this way // the type param can be compared with itself in the target (with the influence of its constraint to match other parts) // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)` - var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */)); - if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself - // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this - result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); + if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) { + var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */)); + if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself + // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this + result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); + } + } + // For certain combinations involving intersections and optional, excess, or mismatched properties we need + // an extra property check where the intersection is viewed as a single object. The following are motivating + // examples that all should be errors, but aren't without this extra property check: + // + // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property + // + // declare let wrong: { a: { y: string } }; + // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type + // + // function foo(x: { a?: string }, y: T & { a: boolean }) { + // x = y; // Mismatched property in source intersection + // } + // + // We suppress recursive intersection property checks because they can generate lots of work when relating + // recursive intersections that are structurally similar but not exactly identical. See #37854. + if (result && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && !isGenericObjectType(target) && source.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) || + isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) { + inPropertyCheck = true; + result &= propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */); + inPropertyCheck = false; } } if (result) { @@ -66507,9 +67047,6 @@ var ts; return result; } function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) { - if (intersectionState & 4 /* IntersectionState.PropertyCheck */) { - return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */); - } var result; var originalErrorInfo; var varianceCheckFailed = false; @@ -66548,7 +67085,11 @@ var ts; } } if (sourceFlags & 33554432 /* TypeFlags.Substitution */) { - return isRelatedTo(source.substitute, target.substitute, 3 /* RecursionFlags.Both */, /*reportErrors*/ false); + if (result = isRelatedTo(source.baseType, target.baseType, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + if (result &= isRelatedTo(source.constraint, target.constraint, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + return result; + } + } } if (!(sourceFlags & 524288 /* TypeFlags.Object */)) { return 0 /* Ternary.False */; @@ -66606,7 +67147,7 @@ var ts; // with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!) var constraint = getConstraintOfTypeParameter(source); if (constraint && hasNonCircularBaseConstraint(source)) { - while (constraint && constraint.flags & 262144 /* TypeFlags.TypeParameter */) { + while (constraint && someType(constraint, function (c) { return !!(c.flags & 262144 /* TypeFlags.TypeParameter */); })) { if (result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false)) { return result; } @@ -67262,7 +67803,7 @@ var ts; return 0 /* Ternary.False */; } // When checking for comparability, be more lenient with optional properties. - if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) { + if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && targetProp.flags & 106500 /* SymbolFlags.ClassMember */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) { // TypeScript 1.0 spec (April 2014): 3.8.3 // S is a subtype of a type T, and T is a supertype of S if ... // S' and T are object types and, for each member M in T.. @@ -67300,7 +67841,7 @@ var ts; shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it } if (props.length === 1) { - var propName = symbolToString(unmatchedProperty); + var propName = symbolToString(unmatchedProperty, /*enclosingDeclaration*/ undefined, 0 /* SymbolFlags.None */, 4 /* SymbolFormatFlags.AllowAnyNodeKind */ | 16 /* SymbolFormatFlags.WriteComputedProps */); reportError.apply(void 0, __spreadArray([ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName], getTypeNamesForErrorDisplay(source, target), false)); if (ts.length(unmatchedProperty.declarations)) { associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName)); @@ -67549,7 +68090,7 @@ var ts; var targetSignature = ts.first(targetSignatures); result = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors, incompatibleReporter(sourceSignature, targetSignature)); if (!result && reportErrors && kind === 1 /* SignatureKind.Construct */ && (sourceObjectFlags & targetObjectFlags) && - (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 171 /* SyntaxKind.Constructor */)) { + (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 173 /* SyntaxKind.Constructor */)) { var constructSignatureToString = function (signature) { return signatureToString(signature, /*enclosingDeclaration*/ undefined, 262144 /* TypeFormatFlags.WriteArrowStyleSignature */, kind); }; @@ -68314,7 +68855,7 @@ var ts; var baseTypeNode = getBaseTypeNodeOfClass(target); // A base type expression may circularly reference the class itself (e.g. as an argument to function call), so we only // check for base types specified as simple qualified names. - if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 206 /* SyntaxKind.PropertyAccessExpression */) { + if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 208 /* SyntaxKind.PropertyAccessExpression */) { return undefined; } } @@ -68362,8 +68903,7 @@ var ts; return !!(type.flags & 109440 /* TypeFlags.Unit */); } function isUnitLikeType(type) { - return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.some(type.types, isUnitType) : - !!(type.flags & 109440 /* TypeFlags.Unit */); + return isUnitType(getBaseConstraintOrType(type)); } function extractUnitType(type) { return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.find(type.types, isUnitType) || type : type; @@ -68405,7 +68945,7 @@ var ts; if (!isLiteralOfContextualType(type, contextualType)) { type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type)); } - return type; + return getRegularTypeOfLiteralType(type); } function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) { if (type && isUnitType(type)) { @@ -68500,7 +69040,8 @@ var ts; function getOptionalType(type, isProperty) { if (isProperty === void 0) { isProperty = false; } ts.Debug.assert(strictNullChecks); - return type.flags & 32768 /* TypeFlags.Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]); + var missingOrUndefined = isProperty ? missingType : undefinedType; + return type.flags & 32768 /* TypeFlags.Undefined */ || type.flags & 1048576 /* TypeFlags.Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); } function getGlobalNonNullableTypeInstantiation(type) { if (!deferredGlobalNonNullableTypeAlias) { @@ -68789,12 +69330,12 @@ var ts; } var diagnostic; switch (declaration.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 223 /* SyntaxKind.BinaryExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: var param = declaration; if (ts.isIdentifier(param.name) && (ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) && @@ -68810,23 +69351,23 @@ var ts; noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; if (!noImplicitAny) { // Don't issue a suggestion for binding elements since the codefix doesn't yet support them. return; } break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (noImplicitAny && !declaration.name) { if (wideningKind === 3 /* WideningKind.GeneratorYield */) { error(declaration, ts.Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); @@ -68840,7 +69381,7 @@ var ts; wideningKind === 3 /* WideningKind.GeneratorYield */ ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type : ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: if (noImplicitAny) { error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); } @@ -68957,7 +69498,7 @@ var ts; if (context.intraExpressionInferenceSites) { for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) { var _b = _a[_i], node = _b.node, type = _b.type; - var contextualType = node.kind === 169 /* SyntaxKind.MethodDeclaration */ ? + var contextualType = node.kind === 171 /* SyntaxKind.MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* ContextFlags.NoConstraints */) : getContextualType(node, 2 /* ContextFlags.NoConstraints */); if (contextualType) { @@ -69020,8 +69561,8 @@ var ts; } function isNonGenericTopLevelType(type) { if (type.aliasSymbol && !type.aliasTypeArguments) { - var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 259 /* SyntaxKind.TypeAliasDeclaration */); - return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 305 /* SyntaxKind.SourceFile */ ? true : n.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); + var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 262 /* SyntaxKind.TypeAliasDeclaration */); + return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 308 /* SyntaxKind.SourceFile */ ? true : n.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); } return false; } @@ -69241,7 +69782,7 @@ var ts; && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) })); } function isMemberOfStringMapping(source, target) { - if (target.flags & (4 /* TypeFlags.String */ | 3 /* TypeFlags.AnyOrUnknown */)) { + if (target.flags & (4 /* TypeFlags.String */ | 1 /* TypeFlags.Any */)) { return true; } if (target.flags & 134217728 /* TypeFlags.TemplateLiteral */) { @@ -69555,7 +70096,7 @@ var ts; } else if (source.flags & 33554432 /* TypeFlags.Substitution */) { inferFromTypes(source.baseType, target); - inferWithPriority(source.substitute, target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority + inferWithPriority(getSubstitutionIntersection(source), target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority } else if (target.flags & 16777216 /* TypeFlags.Conditional */) { invokeOnce(source, target, inferToConditionalType); @@ -70037,7 +70578,7 @@ var ts; var saveBivariant = bivariant; var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; // Once we descend into a bivariant signature we remain bivariant for all nested inferences - bivariant = bivariant || kind === 169 /* SyntaxKind.MethodDeclaration */ || kind === 168 /* SyntaxKind.MethodSignature */ || kind === 171 /* SyntaxKind.Constructor */; + bivariant = bivariant || kind === 171 /* SyntaxKind.MethodDeclaration */ || kind === 170 /* SyntaxKind.MethodSignature */ || kind === 173 /* SyntaxKind.Constructor */; applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes); bivariant = saveBivariant; applyToReturnTypes(source, target, inferFromTypes); @@ -70236,7 +70777,7 @@ var ts; } // falls through default: - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; } else { @@ -70257,7 +70798,7 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.6.3 // A type query consists of the keyword typeof followed by an expression. // The expression is restricted to a single identifier or a sequence of identifiers separated by periods - return !!ts.findAncestor(node, function (n) { return n.kind === 181 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 161 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); + return !!ts.findAncestor(node, function (n) { return n.kind === 183 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 163 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); } // Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers // separated by dots). The key consists of the id of the symbol referenced by the @@ -70273,26 +70814,26 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: return "0|".concat(flowContainer ? getNodeId(flowContainer) : "-1", "|").concat(getTypeId(declaredType), "|").concat(getTypeId(initialType)); - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: var left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer); return left && left + "." + node.right.escapedText; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var propName = getAccessedPropertyName(node); if (propName !== undefined) { var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && key + "." + propName; } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: // Handle pseudo-references originating in getNarrowedTypeOfSymbol. return "".concat(getNodeId(node), "#").concat(getTypeId(declaredType)); } @@ -70300,16 +70841,16 @@ var ts; } function isMatchingReference(source, target) { switch (target.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isMatchingReference(source, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isAssignmentExpression(target) && isMatchingReference(source, target.left)) || (ts.isBinaryExpression(target) && target.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source, target.right)); } switch (source.kind) { - case 231 /* SyntaxKind.MetaProperty */: - return target.kind === 231 /* SyntaxKind.MetaProperty */ + case 233 /* SyntaxKind.MetaProperty */: + return target.kind === 233 /* SyntaxKind.MetaProperty */ && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; case 79 /* SyntaxKind.Identifier */: @@ -70317,26 +70858,26 @@ var ts; return ts.isThisInTypeQuery(source) ? target.kind === 108 /* SyntaxKind.ThisKeyword */ : target.kind === 79 /* SyntaxKind.Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 254 /* SyntaxKind.VariableDeclaration */ || target.kind === 203 /* SyntaxKind.BindingElement */) && + (target.kind === 257 /* SyntaxKind.VariableDeclaration */ || target.kind === 205 /* SyntaxKind.BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 108 /* SyntaxKind.ThisKeyword */: return target.kind === 108 /* SyntaxKind.ThisKeyword */; case 106 /* SyntaxKind.SuperKeyword */: return target.kind === 106 /* SyntaxKind.SuperKeyword */; - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isMatchingReference(source.expression, target); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var sourcePropertyName = getAccessedPropertyName(source); var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined; return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return ts.isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isBinaryExpression(source) && source.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source.right, target)); } return false; @@ -70367,7 +70908,7 @@ var ts; } if (ts.isEntityNameExpression(node.argumentExpression)) { var symbol = resolveEntityName(node.argumentExpression, 111551 /* SymbolFlags.Value */, /*ignoreErrors*/ true); - if (!symbol || !isConstVariable(symbol)) + if (!symbol || !(isConstVariable(symbol) || (symbol.flags & 8 /* SymbolFlags.EnumMember */))) return undefined; var declaration = symbol.valueDeclaration; if (declaration === undefined) @@ -70379,9 +70920,14 @@ var ts; return name; } } - if (ts.hasOnlyExpressionInitializer(declaration)) { + if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) { var initializer = ts.getEffectiveInitializer(declaration); - return initializer && tryGetNameFromType(getTypeOfExpression(initializer)); + if (initializer) { + return tryGetNameFromType(getTypeOfExpression(initializer)); + } + if (ts.isEnumMember(declaration)) { + return ts.getTextOfPropertyName(declaration.name); + } } } return undefined; @@ -70508,7 +71054,7 @@ var ts; } function getMatchingUnionConstituentForObjectLiteral(unionType, node) { var keyPropertyName = getKeyPropertyName(unionType); - var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && + var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); }); var propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); return propType && getConstituentTypeForKeyType(unionType, propType); @@ -70525,7 +71071,7 @@ var ts; } } } - if (expression.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expression.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isOrContainsMatchingReference(reference, expression.expression.expression)) { return true; } @@ -70725,15 +71271,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, type, undefinedType, /*errorNode*/ undefined) || errorType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; + return parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -70750,21 +71296,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return stringType; - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkRightHandSideOfForOf(parent) || errorType; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return undefinedType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return errorType; @@ -70772,7 +71318,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ ? + var type = pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -70790,30 +71336,30 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent) || errorType; } return errorType; } function getInitialType(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function isEmptyArrayAssignment(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.initializer && + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 203 /* SyntaxKind.BindingElement */ && node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + node.kind !== 205 /* SyntaxKind.BindingElement */ && node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 75 /* SyntaxKind.BarBarEqualsToken */: @@ -70828,13 +71374,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? + return parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); } return neverType; @@ -70853,13 +71399,13 @@ var ts; // Get the type names from all cases in a switch on `typeof`. The default clause and/or duplicate type names are // represented as undefined. Return undefined if one or more case clause expressions are not string literals. function getSwitchClauseTypeOfWitnesses(switchStatement) { - if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 289 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { + if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 292 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { return undefined; } var witnesses = []; for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { var clause = _a[_i]; - var text = clause.kind === 289 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; + var text = clause.kind === 292 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; witnesses.push(text && !ts.contains(witnesses, text) ? text : undefined); } return witnesses; @@ -71046,12 +71592,12 @@ var ts; var root = getReferenceRoot(node); var parent = root.parent; var isLengthPushOrUnshift = ts.isPropertyAccessExpression(parent) && (parent.name.escapedText === "length" || - parent.parent.kind === 208 /* SyntaxKind.CallExpression */ + parent.parent.kind === 210 /* SyntaxKind.CallExpression */ && ts.isIdentifier(parent.name) && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + var isElementAssignment = parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -71064,6 +71610,7 @@ var ts; ts.isInJSFile(node) && ts.hasInitializer(node) && node.initializer && ts.isFunctionExpressionOrArrowFunction(node.initializer) && ts.getEffectiveReturnTypeNode(node.initializer)); } function getExplicitTypeOfSymbol(symbol, diagnostic) { + symbol = resolveSymbol(symbol); if (symbol.flags & (16 /* SymbolFlags.Function */ | 8192 /* SymbolFlags.Method */ | 32 /* SymbolFlags.Class */ | 512 /* SymbolFlags.ValueModule */)) { return getTypeOfSymbol(symbol); } @@ -71079,7 +71626,7 @@ var ts; if (isDeclarationWithExplicitTypeAnnotation(declaration)) { return getTypeOfSymbol(symbol); } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var statement = declaration.parent.parent; var expressionType = getTypeOfDottedName(statement.expression, /*diagnostic*/ undefined); if (expressionType) { @@ -71102,12 +71649,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: var symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node)); - return getExplicitTypeOfSymbol(symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol, diagnostic); + return getExplicitTypeOfSymbol(symbol, diagnostic); case 108 /* SyntaxKind.ThisKeyword */: return getExplicitThisType(node); case 106 /* SyntaxKind.SuperKeyword */: return checkSuperExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var type = getTypeOfDottedName(node.expression, diagnostic); if (type) { var name = node.name; @@ -71125,7 +71672,7 @@ var ts; } return undefined; } - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getTypeOfDottedName(node.expression, diagnostic); } } @@ -71139,7 +71686,7 @@ var ts; // circularities in control flow analysis, we use getTypeOfDottedName when resolving the call // target expression of an assertion. var funcType = void 0; - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { funcType = getTypeOfDottedName(node.expression, /*diagnostic*/ undefined); } else if (node.expression.kind !== 106 /* SyntaxKind.SuperKeyword */) { @@ -71183,7 +71730,7 @@ var ts; } function isFalseExpression(expr) { var node = ts.skipParentheses(expr, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || + return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ && isFalseExpression(node.left) && isFalseExpression(node.right)); } function isReachableFlowNodeWorker(flow, noCacheCheck) { @@ -71304,8 +71851,8 @@ var ts; var symbol = getResolvedSymbol(node); return isConstVariable(symbol) || ts.isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // The resolvedSymbol property is initialized by checkPropertyAccess or checkElementAccess before we get here. return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol); } @@ -71332,7 +71879,7 @@ var ts; // on empty arrays are possible without implicit any errors and new element types can be inferred without // type mismatch errors. var resultType = ts.getObjectFlags(evolvedType) & 256 /* ObjectFlags.EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 230 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 232 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { return declaredType; } // The non-null unknown type should never escape control flow analysis. @@ -71417,8 +71964,8 @@ var ts; // Check if we should continue with the control flow of the containing function. var container = flow.node; if (container && container !== flowContainer && - reference.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && - reference.kind !== 207 /* SyntaxKind.ElementAccessExpression */ && + reference.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && + reference.kind !== 209 /* SyntaxKind.ElementAccessExpression */ && reference.kind !== 108 /* SyntaxKind.ThisKeyword */) { flow = container.flowNode; continue; @@ -71443,7 +71990,7 @@ var ts; } function getInitialOrAssignedType(flow) { var node = flow.node; - return getNarrowableTypeForReference(node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */ ? + return getNarrowableTypeForReference(node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */ ? getInitialType(node) : getAssignedType(node), reference); } @@ -71483,14 +72030,14 @@ var ts; // in which case we continue control flow analysis back to the function's declaration if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) { var init = ts.getDeclaredExpandoInitializer(node); - if (init && (init.kind === 213 /* SyntaxKind.FunctionExpression */ || init.kind === 214 /* SyntaxKind.ArrowFunction */)) { + if (init && (init.kind === 215 /* SyntaxKind.FunctionExpression */ || init.kind === 216 /* SyntaxKind.ArrowFunction */)) { return getTypeAtFlowNode(flow.antecedent); } } return declaredType; } // for (const _ in ref) acts as a nonnull on ref - if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { + if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)))); } // Assignment doesn't affect reference @@ -71501,7 +72048,7 @@ var ts; if (node.kind === 95 /* SyntaxKind.FalseKeyword */) { return unreachableNeverType; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { if (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */) { return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right); } @@ -71532,7 +72079,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 208 /* SyntaxKind.CallExpression */ ? + var expr = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -71540,7 +72087,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256 /* ObjectFlags.EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -71588,15 +72135,15 @@ var ts; if (isMatchingReference(reference, expr)) { type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { - type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { + type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } else { if (strictNullChecks) { if (optionalChainContainsReference(expr, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & (32768 /* TypeFlags.Undefined */ | 131072 /* TypeFlags.Never */)); }); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & 131072 /* TypeFlags.Never */ || t.flags & 128 /* TypeFlags.StringLiteral */ && t.value === "undefined"); }); } } @@ -71824,7 +72371,7 @@ var ts; var narrowedPropType = narrowType(propType); return filterType(type, function (t) { var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName); - return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); + return !(discriminantType.flags & 131072 /* TypeFlags.Never */) && !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); }); } function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { @@ -71866,18 +72413,26 @@ var ts; } function isTypePresencePossible(type, propName, assumeTrue) { var prop = getPropertyOfType(type, propName); - if (prop) { - return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue; - } - return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue; - } - function narrowByInKeyword(type, name, assumeTrue) { - if (type.flags & 1048576 /* TypeFlags.Union */ - || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type)) - || ts.isThisTypeParameter(type) - || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) { + return prop ? + !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue : + !!getApplicableIndexInfoForName(type, propName) || !assumeTrue; + } + function narrowTypeByInKeyword(type, nameType, assumeTrue) { + var name = getPropertyNameFromType(nameType); + var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); }); + if (isKnownProperty) { + // If the check is for a known property (i.e. a property declared in some constituent of + // the target type), we filter the target type by presence of absence of the property. return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); }); } + if (assumeTrue) { + // If the check is for an unknown property, we intersect the target type with `Record`, + // where X is the name of the property. + var recordSymbol = getGlobalRecordSymbol(); + if (recordSymbol) { + return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]); + } + } return type; } function narrowTypeByBinaryExpression(type, expr, assumeTrue) { @@ -71894,10 +72449,10 @@ var ts; var operator = expr.operatorToken.kind; var left = getReferenceCandidate(expr.left); var right = getReferenceCandidate(expr.right); - if (left.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { + if (left.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { return narrowTypeByTypeof(type, left, operator, right, assumeTrue); } - if (right.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { + if (right.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { return narrowTypeByTypeof(type, right, operator, left, assumeTrue); } if (isMatchingReference(reference, left)) { @@ -71936,15 +72491,14 @@ var ts; return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue); } var target = getReferenceCandidate(expr.right); - var leftType = getTypeOfNode(expr.left); - if (leftType.flags & 128 /* TypeFlags.StringLiteral */) { - var name = ts.escapeLeadingUnderscores(leftType.value); + var leftType = getTypeOfExpression(expr.left); + if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) { if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) && - getAccessedPropertyName(reference) === name) { + getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) { return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */); } if (isMatchingReference(reference, target)) { - return narrowByInKeyword(type, name, assumeTrue); + return narrowTypeByInKeyword(type, leftType, assumeTrue); } } break; @@ -72006,24 +72560,11 @@ var ts; assumeTrue = !assumeTrue; } var valueType = getTypeOfExpression(value); - if (((type.flags & 2 /* TypeFlags.Unknown */) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304 /* TypeFlags.Nullable */)) && - assumeTrue && - (operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) { - if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) { - return valueType; - } - if (valueType.flags & 524288 /* TypeFlags.Object */) { - return nonPrimitiveType; - } - if (type.flags & 2 /* TypeFlags.Unknown */) { - return type; - } - } + var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; if (valueType.flags & 98304 /* TypeFlags.Nullable */) { if (!strictNullChecks) { return type; } - var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; var facts = doubleEquals ? assumeTrue ? 262144 /* TypeFacts.EQUndefinedOrNull */ : 2097152 /* TypeFacts.NEUndefinedOrNull */ : valueType.flags & 65536 /* TypeFlags.Null */ ? @@ -72032,10 +72573,16 @@ var ts; return getAdjustedTypeWithFacts(type, facts); } if (assumeTrue) { - var filterFn = operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? - function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); } : - function (t) { return areTypesComparable(t, valueType); }; - return replacePrimitivesWithLiterals(filterType(type, filterFn), valueType); + if (!doubleEquals && (type.flags & 2 /* TypeFlags.Unknown */ || someType(type, isEmptyAnonymousObjectType))) { + if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) { + return valueType; + } + if (valueType.flags & 524288 /* TypeFlags.Object */) { + return nonPrimitiveType; + } + } + var filteredType = filterType(type, function (t) { return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); }); + return replacePrimitivesWithLiterals(filteredType, valueType); } if (isUnitType(valueType)) { return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); }); @@ -72049,11 +72596,18 @@ var ts; } var target = getReferenceCandidate(typeOfExpr.expression); if (!isMatchingReference(reference, target)) { + var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type); + if (propertyAccess) { + return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); }); + } if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) { return getAdjustedTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */); } return type; } + return narrowTypeByLiteralExpression(type, literal, assumeTrue); + } + function narrowTypeByLiteralExpression(type, literal, assumeTrue) { return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeFacts.TypeofNEHostObject */); @@ -72133,13 +72687,13 @@ var ts; neverType; }); } - function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) { + function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) { var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement); if (!witnesses) { return type; } // Equal start and end denotes implicit fallthrough; undefined marks explicit default clause. - var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 290 /* SyntaxKind.DefaultClause */; }); + var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 293 /* SyntaxKind.DefaultClause */; }); var hasDefaultClause = clauseStart === clauseEnd || (defaultIndex >= clauseStart && defaultIndex < clauseEnd); if (hasDefaultClause) { // In the default clause we filter constituents down to those that are not-equal to all handled cases. @@ -72343,17 +72897,17 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return narrowTypeByCallExpression(type, expr, assumeTrue); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return narrowType(type, expr.expression, assumeTrue); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (expr.operator === 53 /* SyntaxKind.ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -72402,9 +72956,9 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 262 /* SyntaxKind.ModuleBlock */ || - node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 265 /* SyntaxKind.ModuleBlock */ || + node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; }); } // Check if a parameter or catch variable is assigned anywhere @@ -72447,7 +73001,7 @@ var ts; function removeOptionalityFromDeclaredType(declaredType, declaration) { if (pushTypeResolution(declaration.symbol, 2 /* TypeSystemPropertyName.DeclaredType */)) { var annotationIncludesUndefined = strictNullChecks && - declaration.kind === 164 /* SyntaxKind.Parameter */ && + declaration.kind === 166 /* SyntaxKind.Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* TypeFacts.IsUndefined */ && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* TypeFacts.IsUndefined */); @@ -72464,10 +73018,10 @@ var ts; // In an element access obj[x], we consider obj to be in a constraint position, except when obj is of // a generic type without a nullable constraint and x is a generic type. This is because when both obj // and x are of generic types T and K, we want the resulting type to be T[K]. - return parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 161 /* SyntaxKind.QualifiedName */ || - parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === node || - parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && + return parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 163 /* SyntaxKind.QualifiedName */ || + parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === node || + parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression))); } function isGenericTypeWithUnionConstraint(type) { @@ -72521,15 +73075,15 @@ var ts; }); } function markAliasReferenced(symbol, location) { - if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) { var target = resolveAlias(symbol); - if (target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(target) & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */)) { // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled // (because the const enum value will not be inlined), or if (2) the alias is an export // of a const enum declaration that will be preserved. if (compilerOptions.isolatedModules || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) || - !isConstEnumOrConstEnumOnlyModule(target)) { + !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) { markAliasSymbolAsReferenced(symbol); } else { @@ -72566,15 +73120,16 @@ var ts; // destructuring from the narrowed parent type. if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) { var parent = declaration.parent.parent; - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 166 /* SyntaxKind.Parameter */) { var links = getNodeLinks(parent); if (!(links.flags & 268435456 /* NodeCheckFlags.InCheckIdentifier */)) { links.flags |= 268435456 /* NodeCheckFlags.InCheckIdentifier */; var parentType = getTypeForBindingElementParent(parent, 0 /* CheckMode.Normal */); + var parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~268435456 /* NodeCheckFlags.InCheckIdentifier */; - if (parentType && parentType.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 164 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { + if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 166 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { var pattern = declaration.parent; - var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, /*flowContainer*/ undefined, location.flowNode); + var narrowedType = getFlowTypeOfReference(pattern, parentTypeConstraint, parentTypeConstraint, /*flowContainer*/ undefined, location.flowNode); if (narrowedType.flags & 131072 /* TypeFlags.Never */) { return neverType; } @@ -72641,10 +73196,10 @@ var ts; } var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ScriptTarget.ES2015 */) { - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } - else if (ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + else if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } @@ -72664,7 +73219,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -72676,12 +73231,12 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (declaration.kind === 228 /* SyntaxKind.ClassExpression */) { // When we emit a class expression with static members that contain a reference // to the constructor in the initializer, we will need to substitute that // binding with an alias as the class name is not in scope. var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); - while (container.kind !== 305 /* SyntaxKind.SourceFile */) { + while (container.kind !== 308 /* SyntaxKind.SourceFile */) { if (container.parent === declaration) { if (ts.isPropertyDeclaration(container) && ts.isStatic(container) || ts.isClassStaticBlockDeclaration(container)) { getNodeLinks(declaration).flags |= 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; @@ -72739,7 +73294,7 @@ var ts; // The declaration container is the innermost function that encloses the declaration of the variable // or parameter. The flow container is the innermost function starting with which we analyze the control // flow graph to determine the control flow based type. - var isParameter = ts.getRootDeclaration(declaration).kind === 164 /* SyntaxKind.Parameter */; + var isParameter = ts.getRootDeclaration(declaration).kind === 166 /* SyntaxKind.Parameter */; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; @@ -72748,19 +73303,19 @@ var ts; // When the control flow originates in a function expression or arrow function and we are referencing // a const variable or parameter from an outer function, we extend the origin of the control flow // analysis to include the immediately enclosing function. - while (flowContainer !== declarationContainer && (flowContainer.kind === 213 /* SyntaxKind.FunctionExpression */ || - flowContainer.kind === 214 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* SyntaxKind.FunctionExpression */ || + flowContainer.kind === 216 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } // We only look for uninitialized variables in strict null checking mode, and only when we can analyze // the entire control flow graph from the variable's declaration (i.e. when the flow container and // declaration container are the same). - var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) || + var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* TypeFlags.AnyOrUnknown */ | 16384 /* TypeFlags.Void */)) !== 0 || - isInTypeQuery(node) || node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) || - node.parent.kind === 230 /* SyntaxKind.NonNullExpression */ || - declaration.kind === 254 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) || + node.parent.kind === 232 /* SyntaxKind.NonNullExpression */ || + declaration.kind === 257 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* NodeFlags.Ambient */; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -72785,6 +73340,12 @@ var ts; } return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } + function isSameScopedBindingElement(node, declaration) { + if (ts.isBindingElement(declaration)) { + var bindingElement = ts.findAncestor(node, ts.isBindingElement); + return bindingElement && ts.getRootDeclaration(bindingElement) === ts.getRootDeclaration(declaration); + } + } function shouldMarkIdentifierAliasReferenced(node) { var _a; var parent = node.parent; @@ -72818,7 +73379,7 @@ var ts; (symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 32 /* SymbolFlags.Class */)) === 0 || !symbol.valueDeclaration || ts.isSourceFile(symbol.valueDeclaration) || - symbol.valueDeclaration.parent.kind === 292 /* SyntaxKind.CatchClause */) { + symbol.valueDeclaration.parent.kind === 295 /* SyntaxKind.CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -72833,7 +73394,7 @@ var ts; // mark iteration statement as containing block-scoped binding captured in some function var capturesBlockScopeBindingInLoopBody = true; if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container) { var part = getPartOfForStatementContainingNode(node.parent, container); if (part) { @@ -72854,7 +73415,7 @@ var ts; // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 4194304 /* NodeCheckFlags.NeedsLoopOutParameter */; } @@ -72873,7 +73434,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { // skip parenthesized nodes var current = node; - while (current.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (current.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -72881,7 +73442,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */)) { + else if ((current.parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; } @@ -72894,7 +73455,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* NodeCheckFlags.LexicalThis */; - if (container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || container.kind === 173 /* SyntaxKind.Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* NodeCheckFlags.CaptureThis */; } @@ -72941,31 +73502,31 @@ var ts; // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var capturedByArrowFunction = false; - if (container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); capturedByArrowFunction = true; } checkThisInStaticClassFieldInitializerInDecoratedClass(node, container); switch (container.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -73053,7 +73614,7 @@ var ts; } function getClassNameFromPrototypeMethod(container) { // Check if it's the RHS of a x.prototype.y = function [name]() { .... } - if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isBinaryExpression(container.parent) && ts.getAssignmentDeclarationKind(container.parent) === 3 /* AssignmentDeclarationKind.PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = container' @@ -73063,16 +73624,16 @@ var ts; .expression; // x } // x.prototype = { method() { } } - else if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && - container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && + container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.left.expression; } // x.prototype = { method: function() { } } - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && - container.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && - container.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && + container.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && + container.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.parent.left.expression; @@ -73080,7 +73641,7 @@ var ts; // Object.defineProperty(x, "method", { value: function() { } }); // Object.defineProperty(x, "method", { set: (x: () => void) => void }); // Object.defineProperty(x, "method", { get: () => function() { }) }); - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isPropertyAssignment(container.parent) && ts.isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && @@ -73105,7 +73666,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 317 /* SyntaxKind.JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 320 /* SyntaxKind.JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -73119,19 +73680,24 @@ var ts; } } function isInConstructorArgumentInitializer(node, constructorDecl) { - return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 164 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); + return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 166 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 208 /* SyntaxKind.CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 210 /* SyntaxKind.CallExpression */ && node.parent.expression === node; var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var container = immediateContainer; var needToCaptureLexicalThis = false; + var inAsyncFunction = false; // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - while (container && container.kind === 214 /* SyntaxKind.ArrowFunction */) { + while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) { + if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) + inAsyncFunction = true; container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */; } + if (container && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) + inAsyncFunction = true; } var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; @@ -73141,14 +73707,14 @@ var ts; // class B { // [super.foo()]() {} // } - var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 162 /* SyntaxKind.ComputedPropertyName */; }); - if (current && current.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 164 /* SyntaxKind.ComputedPropertyName */; }); + if (current && current.kind === 164 /* SyntaxKind.ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -73156,7 +73722,7 @@ var ts; } return errorType; } - if (!isCallExpression && immediateContainer.kind === 171 /* SyntaxKind.Constructor */) { + if (!isCallExpression && immediateContainer.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if (ts.isStatic(container) || isCallExpression) { @@ -73237,12 +73803,12 @@ var ts; // as a call expression cannot be used as the target of a destructuring assignment while a property access can. // // For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations. - if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && inAsyncFunction) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { - getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */; + getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */; } else { - getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.AsyncMethodWithSuper */; + getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */; } } if (needToCaptureLexicalThis) { @@ -73251,7 +73817,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return errorType; @@ -73272,7 +73838,7 @@ var ts; if (!baseClassType) { return errorType; } - if (container.kind === 171 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 173 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return errorType; @@ -73287,7 +73853,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 173 /* SyntaxKind.Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -73295,23 +73861,23 @@ var ts; // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor // topmost container must be something that is directly nested in the class declaration\object literal expression - if (ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (ts.isStatic(container)) { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } else { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 166 /* SyntaxKind.PropertySignature */ || - container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 168 /* SyntaxKind.PropertySignature */ || + container.kind === 173 /* SyntaxKind.Constructor */; } } } @@ -73319,10 +73885,10 @@ var ts; } } function getContainingObjectLiteral(func) { - return (func.kind === 169 /* SyntaxKind.MethodDeclaration */ || - func.kind === 172 /* SyntaxKind.GetAccessor */ || - func.kind === 173 /* SyntaxKind.SetAccessor */) && func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : - func.kind === 213 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : + return (func.kind === 171 /* SyntaxKind.MethodDeclaration */ || + func.kind === 174 /* SyntaxKind.GetAccessor */ || + func.kind === 175 /* SyntaxKind.SetAccessor */) && func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : + func.kind === 215 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -73334,7 +73900,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -73361,7 +73927,7 @@ var ts; if (thisType) { return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); } - if (literal.parent.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (literal.parent.kind !== 299 /* SyntaxKind.PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -73375,7 +73941,7 @@ var ts; // In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the // contextual type for 'this' is 'obj'. var parent = ts.walkUpParenthesizedExpressions(func.parent); - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { var target = parent.left; if (ts.isAccessExpression(target)) { var expression = target.expression; @@ -73428,11 +73994,11 @@ var ts; return getTypeFromTypeNode(typeNode); } switch (declaration.kind) { - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return getContextuallyTypedParameterType(declaration); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForBindingElement(declaration, contextFlags); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isStatic(declaration)) { return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags); } @@ -73443,10 +74009,10 @@ var ts; var parent = declaration.parent.parent; var name = declaration.propertyName || declaration.name; var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || - parent.kind !== 203 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); + parent.kind !== 205 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name)) return undefined; - if (parent.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (parent.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { var index = ts.indexOfNode(declaration.parent.elements, declaration); if (index < 0) return undefined; @@ -73603,7 +74169,7 @@ var ts; getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (template.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -73722,9 +74288,11 @@ var ts; case 1 /* AssignmentDeclarationKind.ExportsProperty */: case 6 /* AssignmentDeclarationKind.Prototype */: case 3 /* AssignmentDeclarationKind.PrototypeProperty */: - var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; - // falls through case 2 /* AssignmentDeclarationKind.ModuleExports */: + var valueDeclaration = void 0; + if (kind !== 2 /* AssignmentDeclarationKind.ModuleExports */) { + valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; + } valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration); var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration); return annotated ? getTypeFromTypeNode(annotated) : undefined; @@ -73901,21 +74469,21 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 79 /* SyntaxKind.Identifier */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isPossiblyDiscriminantValue(node.expression); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !node.expression || isPossiblyDiscriminantValue(node.expression); } return false; } function discriminateContextualTypeByObjectMembers(node, contextualType) { - return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } function discriminateContextualTypeByJSXAttributes(node, contextualType) { - return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 285 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 288 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. @@ -73936,9 +74504,10 @@ var ts; function instantiateContextualType(contextualType, node, contextFlags) { if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* TypeFlags.Instantiable */)) { var inferenceContext = getInferenceContext(node); - // If no inferences have been made, nothing is gained from instantiating as type parameters - // would just be replaced with their defaults similar to the apparent type. - if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidates)) { + // If no inferences have been made, and none of the type parameters for which we are inferring + // specify default types, nothing is gained from instantiating as type parameters would just be + // replaced with their constraints similar to the apparent type. + if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) { // For contextual signatures we incorporate all inferences made so far, e.g. from return // types as well as arguments to the left in a function call. return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper); @@ -73998,60 +74567,62 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForInitializerExpression(node, contextFlags); - case 214 /* SyntaxKind.ArrowFunction */: - case 247 /* SyntaxKind.ReturnStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 250 /* SyntaxKind.ReturnStatement */: return getContextualTypeForReturnExpression(node, contextFlags); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return getContextualTypeForYieldOperand(parent, contextFlags); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return getContextualTypeForAwaitOperand(parent, contextFlags); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return getContextualTypeForArgument(parent, node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return ts.isConstTypeReference(parent.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(parent.type); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getContextualTypeForBinaryOperand(node, contextFlags); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent, contextFlags); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return getContextualType(parent.parent, contextFlags); - case 204 /* SyntaxKind.ArrayLiteralExpression */: { + case 206 /* SyntaxKind.ArrayLiteralExpression */: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return getContextualTypeForConditionalOperand(node, contextFlags); - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 223 /* SyntaxKind.TemplateExpression */); + case 236 /* SyntaxKind.TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 225 /* SyntaxKind.TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { // Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast. var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return !tag ? getContextualType(parent, contextFlags) : ts.isJSDocTypeTag(tag) && ts.isConstTypeReference(tag.typeExpression.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(tag.typeExpression.type); } - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return getContextualType(parent, contextFlags); - case 271 /* SyntaxKind.ExportAssignment */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return getTypeFromTypeNode(parent.type); + case 274 /* SyntaxKind.ExportAssignment */: return tryGetTypeFromEffectiveTypeNode(parent); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return getContextualTypeForJsxExpression(parent, contextFlags); - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent, contextFlags); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getContextualJsxElementAttributesType(parent, contextFlags); } return undefined; @@ -74177,9 +74748,16 @@ var ts; if (!isErrorType(intrinsicClassAttribs)) { var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); var hostClassType = getReturnTypeOfSignature(sig); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context))) - : intrinsicClassAttribs, apparentAttributesType); + var libraryManagedAttributeType = void 0; + if (typeParams) { + // apply JSX.IntrinsicClassElements + var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context)); + libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs)); + } + // or JSX.IntrinsicClassElements has no generics. + else + libraryManagedAttributeType = intrinsicClassAttribs; + apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType); } var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (!isErrorType(intrinsicAttribs)) { @@ -74302,7 +74880,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var typeTagSignature = getSignatureOfTypeTag(node); if (typeTagSignature) { return typeTagSignature; @@ -74350,8 +74928,8 @@ var ts; return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type; } function hasDefaultValue(node) { - return (node.kind === 203 /* SyntaxKind.BindingElement */ && !!node.initializer) || - (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); + return (node.kind === 205 /* SyntaxKind.BindingElement */ && !!node.initializer) || + (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); } function checkArrayLiteral(node, checkMode, forceTuple) { var elements = node.elements; @@ -74364,7 +74942,7 @@ var ts; var hasOmittedExpression = false; for (var i = 0; i < elementCount; i++) { var e = elements[i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 /* ExternalEmitHelpers.SpreadIncludes */ : 1024 /* ExternalEmitHelpers.SpreadArray */); } @@ -74397,7 +74975,7 @@ var ts; elementFlags.push(4 /* ElementFlags.Rest */); } } - else if (exactOptionalPropertyTypes && e.kind === 227 /* SyntaxKind.OmittedExpression */) { + else if (exactOptionalPropertyTypes && e.kind === 229 /* SyntaxKind.OmittedExpression */) { hasOmittedExpression = true; elementTypes.push(missingType); elementFlags.push(2 /* ElementFlags.Optional */); @@ -74437,7 +75015,7 @@ var ts; } function isNumericName(name) { switch (name.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return isNumericComputedName(name); case 79 /* SyntaxKind.Identifier */: return ts.isNumericLiteralName(name.escapedText); @@ -74458,7 +75036,7 @@ var ts; if (!links.resolvedType) { if ((ts.isTypeLiteralNode(node.parent.parent) || ts.isClassLike(node.parent.parent) || ts.isInterfaceDeclaration(node.parent.parent)) && ts.isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ - && node.parent.kind !== 172 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 173 /* SyntaxKind.SetAccessor */) { + && node.parent.kind !== 174 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 175 /* SyntaxKind.SetAccessor */) { return links.resolvedType = errorType; } links.resolvedType = checkExpression(node.expression); @@ -74531,7 +75109,7 @@ var ts; var spread = emptyObjectType; var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 205 /* SyntaxKind.ObjectLiteralExpression */); + (contextualType.pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 207 /* SyntaxKind.ObjectLiteralExpression */); var inConstContext = isConstContext(node); var checkFlags = inConstContext ? 8 /* CheckFlags.Readonly */ : 0; var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node); @@ -74555,16 +75133,16 @@ var ts; for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var memberDecl = _c[_b]; var member = getSymbolOfNode(memberDecl); - var computedNameType = memberDecl.name && memberDecl.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? + var computedNameType = memberDecl.name && memberDecl.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : undefined; - if (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ || + if (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { - var type = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : + var type = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`. // we don't want to say "could not find 'a'". - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode); if (isInJavascript) { var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); @@ -74587,8 +75165,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* SymbolFlags.Optional */; } @@ -74614,14 +75192,14 @@ var ts; member = prop; allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop); if (contextualType && checkMode && checkMode & 2 /* CheckMode.Inferential */ && !(checkMode & 4 /* CheckMode.SkipContextSensitive */) && - (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 169 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { + (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 171 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { var inferenceContext = getInferenceContext(node); ts.Debug.assert(inferenceContext); // In CheckMode.Inferential we should always have an inference context - var inferenceNode = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; + var inferenceNode = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type); } } - else if (memberDecl.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (memberDecl.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* ExternalEmitHelpers.Assign */); } @@ -74657,7 +75235,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 172 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 173 /* SyntaxKind.SetAccessor */); + ts.Debug.assert(memberDecl.kind === 174 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 175 /* SyntaxKind.SetAccessor */); checkNodeDeferred(memberDecl); } if (computedNameType && !(computedNameType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */)) { @@ -74684,16 +75262,30 @@ var ts; // If object literal is contextually typed by the implied type of a binding pattern, augment the result // type with those properties for which the binding pattern specifies a default value. // If the object literal is spread into another object literal, skip this step and let the top-level object - // literal handle it instead. - if (contextualTypeHasPattern && node.parent.kind !== 298 /* SyntaxKind.SpreadAssignment */) { - for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { - var prop = _e[_d]; - if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { - if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { - error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + // literal handle it instead. Note that this might require full traversal to the root pattern's parent + // as it's the guaranteed to be the common ancestor of the pattern node and the current object node. + // It's not possible to check if the immediate parent node is a spread assignment + // since the type flows in non-obvious ways through conditional expressions, IIFEs and more. + if (contextualTypeHasPattern) { + var rootPatternParent_1 = ts.findAncestor(contextualType.pattern.parent, function (n) { + return n.kind === 257 /* SyntaxKind.VariableDeclaration */ || + n.kind === 223 /* SyntaxKind.BinaryExpression */ || + n.kind === 166 /* SyntaxKind.Parameter */; + }); + var spreadOrOutsideRootObject = ts.findAncestor(node, function (n) { + return n === rootPatternParent_1 || + n.kind === 301 /* SyntaxKind.SpreadAssignment */; + }); + if (spreadOrOutsideRootObject.kind !== 301 /* SyntaxKind.SpreadAssignment */) { + for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { + var prop = _e[_d]; + if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { + if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable.set(prop.escapedName, prop); + propertiesArray.push(prop); } - propertiesTable.set(prop.escapedName, prop); - propertiesArray.push(prop); } } } @@ -74801,6 +75393,7 @@ var ts; */ function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) { var attributes = openingLikeElement.attributes; + var attributesType = getContextualType(attributes, 0 /* ContextFlags.None */); var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined; var attributesTable = ts.createSymbolTable(); var spread = emptyJsxObjectType; @@ -74828,9 +75421,15 @@ var ts; if (attributeDecl.name.escapedText === jsxChildrenPropertyName) { explicitlySpecifyChildrenAttribute = true; } + if (attributesType) { + var prop = getPropertyOfType(attributesType, member.escapedName); + if (prop && prop.declarations && isDeprecatedSymbol(prop)) { + addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText); + } + } } else { - ts.Debug.assert(attributeDecl.kind === 287 /* SyntaxKind.JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 290 /* SyntaxKind.JsxSpreadAttribute */); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false); attributesTable = ts.createSymbolTable(); @@ -74857,7 +75456,7 @@ var ts; } } // Handle children attribute - var parent = openingLikeElement.parent.kind === 278 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 281 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; // We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { var childrenTypes = checkJsxChildren(parent, checkMode); @@ -74914,7 +75513,7 @@ var ts; childrenTypes.push(stringType); } } - else if (child.kind === 288 /* SyntaxKind.JsxExpression */ && !child.expression) { + else if (child.kind === 291 /* SyntaxKind.JsxExpression */ && !child.expression) { continue; // empty jsx expressions don't *really* count as present children } else { @@ -75346,9 +75945,9 @@ var ts; function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError) { if (reportError === void 0) { reportError = true; } var errorNode = !reportError ? undefined : - node.kind === 161 /* SyntaxKind.QualifiedName */ ? node.right : - node.kind === 200 /* SyntaxKind.ImportType */ ? node : - node.kind === 203 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; + node.kind === 163 /* SyntaxKind.QualifiedName */ ? node.right : + node.kind === 202 /* SyntaxKind.ImportType */ ? node : + node.kind === 205 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode); } /** @@ -75379,7 +75978,7 @@ var ts; return false; } } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { // A method cannot be accessed in a super property access if the method is abstract. // This error could mask a private property access error. But, a member // cannot simultaneously be private and abstract, so this will trigger an @@ -75391,7 +75990,7 @@ var ts; } } // Referencing abstract properties within their own constructors is not allowed - if ((flags & 128 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && + if ((flags & 256 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && (ts.isThisProperty(location) || ts.isThisInitializedObjectBindingExpression(location) || ts.isObjectBindingPattern(location.parent) && ts.isThisInitializedDeclaration(location.parent.parent))) { var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) { @@ -75485,10 +76084,27 @@ var ts; return isNullableType(type) ? getNonNullableType(type) : type; } function reportObjectPossiblyNullOrUndefinedError(node, facts) { - error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); + var nodeText = ts.isEntityNameExpression(node) ? ts.entityNameToString(node) : undefined; + if (node.kind === 104 /* SyntaxKind.NullKeyword */) { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "null"); + return; + } + if (nodeText !== undefined && nodeText.length < 100) { + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "undefined"); + return; + } + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics._0_is_possibly_null_or_undefined : + ts.Diagnostics._0_is_possibly_undefined : + ts.Diagnostics._0_is_possibly_null, nodeText); + } + else { + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } } function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) { error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? @@ -75498,6 +76114,13 @@ var ts; } function checkNonNullTypeWithReporter(type, node, reportError) { if (strictNullChecks && type.flags & 2 /* TypeFlags.Unknown */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_of_type_unknown, nodeText); + return errorType; + } + } error(node, ts.Diagnostics.Object_is_of_type_unknown); return errorType; } @@ -75515,6 +76138,17 @@ var ts; function checkNonNullNonVoidType(type, node) { var nonNullType = checkNonNullType(type, node); if (nonNullType.flags & 16384 /* TypeFlags.Void */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, nodeText); + return nonNullType; + } + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_possibly_undefined, nodeText); + return nonNullType; + } + } error(node, ts.Diagnostics.Object_is_possibly_undefined); } return nonNullType; @@ -75533,7 +76167,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, leftType, node.right, checkMode); } function isMethodAccessForCall(node) { - while (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.parent; } return ts.isCallOrNewExpression(node.parent) && node.parent.expression === node; @@ -75673,7 +76307,7 @@ var ts; } return isErrorType(apparentType) ? errorType : apparentType; } - prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 161 /* SyntaxKind.QualifiedName */); + prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 163 /* SyntaxKind.QualifiedName */); } // In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums. // `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined @@ -75683,7 +76317,7 @@ var ts; // 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and // 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`. if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules || - !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 299 /* SyntaxKind.EnumMember */)) || + !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 302 /* SyntaxKind.EnumMember */)) || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { markAliasReferenced(parentSymbol, node); } @@ -75785,7 +76419,7 @@ var ts; if (declaration && isPropertyWithoutInitializer(declaration)) { if (!ts.isStatic(declaration)) { var flowContainer = getControlFlowContainer(node); - if (flowContainer.kind === 171 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { + if (flowContainer.kind === 173 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { assumeUninitialized = true; } } @@ -75820,8 +76454,8 @@ var ts; && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) { diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName); } - else if (valueDeclaration.kind === 257 /* SyntaxKind.ClassDeclaration */ && - node.parent.kind !== 178 /* SyntaxKind.TypeReference */ && + else if (valueDeclaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && + node.parent.kind !== 180 /* SyntaxKind.TypeReference */ && !(valueDeclaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName); @@ -75833,25 +76467,25 @@ var ts; function isInPropertyInitializerOrClassStaticBlock(node) { return !!ts.findAncestor(node, function (node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 298 /* SyntaxKind.SpreadAssignment */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 233 /* SyntaxKind.TemplateSpan */: - case 288 /* SyntaxKind.JsxExpression */: - case 285 /* SyntaxKind.JsxAttribute */: - case 286 /* SyntaxKind.JsxAttributes */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 291 /* SyntaxKind.HeritageClause */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 301 /* SyntaxKind.SpreadAssignment */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 236 /* SyntaxKind.TemplateSpan */: + case 291 /* SyntaxKind.JsxExpression */: + case 288 /* SyntaxKind.JsxAttribute */: + case 289 /* SyntaxKind.JsxAttributes */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 294 /* SyntaxKind.HeritageClause */: return false; - case 214 /* SyntaxKind.ArrowFunction */: - case 238 /* SyntaxKind.ExpressionStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.isBlock(node.parent) && ts.isClassStaticBlockDeclaration(node.parent.parent) ? true : "quit"; default: return ts.isExpressionNode(node) ? false : "quit"; @@ -76046,7 +76680,6 @@ var ts; } return false; } - ; var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get"; if (!hasProp(suggestedMethod)) { return undefined; @@ -76126,11 +76759,11 @@ var ts; } function isValidPropertyAccess(node, propertyName) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return isValidPropertyAccessWithType(node, node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression))); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getWidenedType(checkExpression(node.left))); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getTypeFromTypeNode(node)); } } @@ -76145,7 +76778,7 @@ var ts; * @param property the accessed property's symbol. */ function isValidPropertyAccessForCompletions(node, type, property) { - return isPropertyAccessible(node, node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, + return isPropertyAccessible(node, node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, /* isWrite */ false, type, property); // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context. } @@ -76185,7 +76818,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -76214,7 +76847,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 243 /* SyntaxKind.ForInStatement */ && + if (node.kind === 246 /* SyntaxKind.ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -76263,13 +76896,13 @@ var ts; // This gets us diagnostics for the type arguments and marks them as referenced. ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { checkExpression(node.template); } else if (ts.isJsxOpeningLikeElement(node)) { checkExpression(node.attributes); } - else if (node.kind !== 165 /* SyntaxKind.Decorator */) { + else if (node.kind !== 167 /* SyntaxKind.Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -76333,7 +76966,7 @@ var ts; } } function isSpreadArgument(arg) { - return !!arg && (arg.kind === 225 /* SyntaxKind.SpreadElement */ || arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); + return !!arg && (arg.kind === 227 /* SyntaxKind.SpreadElement */ || arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); } function getSpreadArgumentIndex(args) { return ts.findIndex(args, isSpreadArgument); @@ -76350,9 +76983,9 @@ var ts; var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments var effectiveParameterCount = getParameterCount(signature); var effectiveMinimumArguments = getMinArgumentCount(signature); - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { argCount = args.length; - if (node.template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (node.template.kind === 225 /* SyntaxKind.TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var lastSpan = ts.last(node.template.templateSpans); // we should always have at least one span. @@ -76367,7 +77000,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 165 /* SyntaxKind.Decorator */) { + else if (node.kind === 167 /* SyntaxKind.Decorator */) { argCount = getDecoratorArgumentCount(node, signature); } else if (ts.isJsxOpeningLikeElement(node)) { @@ -76381,7 +77014,7 @@ var ts; } else if (!node.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(node.kind === 209 /* SyntaxKind.NewExpression */); + ts.Debug.assert(node.kind === 211 /* SyntaxKind.NewExpression */); return getMinArgumentCount(signature) === 0; } else { @@ -76484,7 +77117,7 @@ var ts; // example, given a 'function wrap(cb: (x: T) => U): (x: T) => U' and a call expression // 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the // return type of 'wrap'. - if (node.kind !== 165 /* SyntaxKind.Decorator */) { + if (node.kind !== 167 /* SyntaxKind.Decorator */) { var skipBindingPatterns = ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }); var contextualType = getContextualType(node, skipBindingPatterns ? 8 /* ContextFlags.SkipBindingPatterns */ : 0 /* ContextFlags.None */); if (contextualType) { @@ -76548,7 +77181,7 @@ var ts; } for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { var paramType = getTypeAtPosition(signature, i); if (couldContainTypeVariables(paramType)) { var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); @@ -76574,7 +77207,7 @@ var ts; if (isSpreadArgument(arg)) { // We are inferring from a spread expression in the last argument position, i.e. both the parameter // and the argument are ...x forms. - return getMutableArrayOrTupleType(arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : + return getMutableArrayOrTupleType(arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode)); } } @@ -76584,13 +77217,13 @@ var ts; for (var i = index; i < argCount; i++) { var arg = args[i]; if (isSpreadArgument(arg)) { - var spreadType = arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); + var spreadType = arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); if (isArrayLikeType(spreadType)) { types.push(spreadType); flags.push(8 /* ElementFlags.Variadic */); } else { - types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 225 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); + types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 227 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); flags.push(4 /* ElementFlags.Rest */); } } @@ -76601,7 +77234,7 @@ var ts; types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(1 /* ElementFlags.Required */); } - if (arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { + if (arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { names.push(arg.tupleNameSource); } } @@ -76745,7 +77378,7 @@ var ts; return undefined; } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 209 /* SyntaxKind.NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 211 /* SyntaxKind.NewExpression */) { // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. // If the expression is a new expression, then the check is skipped. @@ -76763,7 +77396,7 @@ var ts; var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = checkExpressionWithContextualType(arg, paramType, /*inferenceContext*/ undefined, checkMode); // If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive), @@ -76808,8 +77441,8 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - var expression = node.kind === 208 /* SyntaxKind.CallExpression */ ? node.expression : - node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; + var expression = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression : + node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; if (expression) { var callee = ts.skipOuterExpressions(expression); if (ts.isAccessExpression(callee)) { @@ -76827,17 +77460,17 @@ var ts; * Returns the effective arguments for an expression that works like a function invocation. */ function getEffectiveCallArguments(node) { - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var template = node.template; var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args_3.push(span.expression); }); } return args_3; } - if (node.kind === 165 /* SyntaxKind.Decorator */) { + if (node.kind === 167 /* SyntaxKind.Decorator */) { return getEffectiveDecoratorArguments(node); } if (ts.isJsxOpeningLikeElement(node)) { @@ -76851,7 +77484,7 @@ var ts; var _loop_26 = function (i) { var arg = args[i]; // We can call checkExpressionCached because spread expressions never have a contextual type. - var spreadType = arg.kind === 225 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); + var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); if (spreadType && isTupleType(spreadType)) { ts.forEach(getTypeArguments(spreadType), function (t, i) { var _a; @@ -76878,30 +77511,30 @@ var ts; var parent = node.parent; var expr = node.expression; switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class). return [ createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent))) ]; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts). var func = parent.parent; return [ - createSyntheticExpression(expr, parent.parent.kind === 171 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), + createSyntheticExpression(expr, parent.parent.kind === 173 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), createSyntheticExpression(expr, anyType), createSyntheticExpression(expr, numberType) ]; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators // for ES3, we will only pass two arguments. - var hasPropDesc = parent.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && languageVersion !== 0 /* ScriptTarget.ES3 */; + var hasPropDesc = languageVersion !== 0 /* ScriptTarget.ES3 */ && (!ts.isPropertyDeclaration(parent) || ts.hasAccessorModifier(parent)); return [ createSyntheticExpression(expr, getParentTypeOfClassElement(parent)), createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)), @@ -76915,17 +77548,17 @@ var ts; */ function getDecoratorArgumentCount(node, signature) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return 1; - case 167 /* SyntaxKind.PropertyDeclaration */: - return 2; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return ts.hasAccessorModifier(node.parent) ? 3 : 2; + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // For ES3 or decorators with only two parameters we supply only two arguments return languageVersion === 0 /* ScriptTarget.ES3 */ || signature.parameters.length <= 2 ? 2 : 3; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return 3; default: return ts.Debug.fail(); @@ -77067,8 +77700,8 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, fallbackError) { - var isTaggedTemplate = node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; - var isDecorator = node.kind === 165 /* SyntaxKind.Decorator */; + var isTaggedTemplate = node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; + var isDecorator = node.kind === 167 /* SyntaxKind.Decorator */; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var reportErrors = !candidatesOutArray; var typeArguments; @@ -77131,7 +77764,7 @@ var ts; var result; // If we are in signature help, a trailing comma indicates that we intend to provide another argument, // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments. - var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 208 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 210 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument // expression is a subtype of each corresponding parameter type, the return type of the first @@ -77620,7 +78253,7 @@ var ts; return resolveErrorCall(node); } var valueDecl = expressionType.symbol && ts.getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && ts.hasSyntacticModifier(valueDecl, 128 /* ModifierFlags.Abstract */)) { + if (valueDecl && ts.hasSyntacticModifier(valueDecl, 256 /* ModifierFlags.Abstract */)) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class); return resolveErrorCall(node); } @@ -77691,7 +78324,7 @@ var ts; var declaration = signature.declaration; var modifiers = ts.getSelectedEffectiveModifierFlags(declaration, 24 /* ModifierFlags.NonPublicAccessibilityModifier */); // (1) Public constructors and (2) constructor functions are always accessible. - if (!modifiers || declaration.kind !== 171 /* SyntaxKind.Constructor */) { + if (!modifiers || declaration.kind !== 173 /* SyntaxKind.Constructor */) { return true; } var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(declaration.parent.symbol); @@ -77835,16 +78468,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; default: return ts.Debug.fail(); @@ -77890,7 +78523,7 @@ var ts; // file would probably be preferable. var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968 /* SymbolFlags.Type */); var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968 /* SymbolFlags.Type */, node); - var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); var parameterSymbol = createSymbol(1 /* SymbolFlags.FunctionScopedVariable */, "props"); parameterSymbol.type = result; return createSignature(declaration, @@ -77939,16 +78572,16 @@ var ts; } function resolveSignature(node, candidatesOutArray, checkMode) { switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return resolveCallExpression(node, candidatesOutArray, checkMode); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return resolveNewExpression(node, candidatesOutArray, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return resolveDecorator(node, candidatesOutArray, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode); } throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); @@ -77992,12 +78625,15 @@ var ts; return false; } var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node : - ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : + (ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : undefined; if (func) { - // If the node has a @class tag, treat it like a constructor. + // If the node has a @class or @constructor tag, treat it like a constructor. if (ts.getJSDocClassTag(node)) return true; + // If the node is a property of an object literal. + if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent))) + return false; // If the symbol of the node has members, treat it like a constructor. var symbol = getSymbolOfNode(func); return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size); @@ -78080,7 +78716,7 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { parent = parent.parent; } if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -78106,12 +78742,12 @@ var ts; if (node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { return voidType; } - if (node.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.kind === 211 /* SyntaxKind.NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 171 /* SyntaxKind.Constructor */ && - declaration.kind !== 175 /* SyntaxKind.ConstructSignature */ && - declaration.kind !== 180 /* SyntaxKind.ConstructorType */ && + declaration.kind !== 173 /* SyntaxKind.Constructor */ && + declaration.kind !== 177 /* SyntaxKind.ConstructSignature */ && + declaration.kind !== 182 /* SyntaxKind.ConstructorType */ && !ts.isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any @@ -78131,7 +78767,7 @@ var ts; if (returnType.flags & 12288 /* TypeFlags.ESSymbolLike */ && isSymbolOrSymbolForCall(node)) { return getESSymbolLikeTypeForNode(ts.walkUpParenthesizedExpressions(node.parent)); } - if (node.kind === 208 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + if (node.kind === 210 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && returnType.flags & 16384 /* TypeFlags.Void */ && getTypePredicateOfSignature(signature)) { if (!ts.isDottedName(node.expression)) { error(node.expression, ts.Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); @@ -78161,20 +78797,20 @@ var ts; function getDeprecatedSuggestionNode(node) { node = ts.skipParentheses(node); switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 165 /* SyntaxKind.Decorator */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 167 /* SyntaxKind.Decorator */: + case 211 /* SyntaxKind.NewExpression */: return getDeprecatedSuggestionNode(node.expression); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return getDeprecatedSuggestionNode(node.tag); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getDeprecatedSuggestionNode(node.tagName); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.argumentExpression; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: var typeReference = node; return ts.isQualifiedName(typeReference.typeName) ? typeReference.typeName.right : typeReference; default: @@ -78245,8 +78881,8 @@ var ts; if (hasDefaultOnly && type && !isErrorType(type)) { var synthType = type; if (!synthType.defaultOnlyType) { - var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); - synthType.defaultOnlyType = type_5; + var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); + synthType.defaultOnlyType = type_4; } return synthType.defaultOnlyType; } @@ -78289,9 +78925,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* SymbolFlags.Function */ - ? 256 /* SyntaxKind.FunctionDeclaration */ + ? 259 /* SyntaxKind.FunctionDeclaration */ : resolvedRequire.flags & 3 /* SymbolFlags.Variable */ - ? 254 /* SyntaxKind.VariableDeclaration */ + ? 257 /* SyntaxKind.VariableDeclaration */ : 0 /* SyntaxKind.Unknown */; if (targetDeclarationKind !== 0 /* SyntaxKind.Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -78311,7 +78947,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkAssertion(node) { - if (node.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { var file = ts.getSourceFileOfNode(node); if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts" /* Extension.Cts */, ".mts" /* Extension.Mts */])) { grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead); @@ -78327,25 +78963,25 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isValidConstAssertionArgument(node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var op = node.operator; var arg = node.operand; return op === 40 /* SyntaxKind.MinusToken */ && (arg.kind === 8 /* SyntaxKind.NumericLiteral */ || arg.kind === 9 /* SyntaxKind.BigIntLiteral */) || op === 39 /* SyntaxKind.PlusToken */ && arg.kind === 8 /* SyntaxKind.NumericLiteral */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node.expression; var symbol = getTypeOfNode(expr).symbol; if (symbol && symbol.flags & 2097152 /* SymbolFlags.Alias */) { symbol = resolveAlias(symbol); } - return !!(symbol && (symbol.flags & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */); + return !!(symbol && (getAllSymbolFlags(symbol) & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */); } return false; } @@ -78381,7 +79017,7 @@ var ts; } function checkExpressionWithTypeArguments(node) { checkGrammarExpressionWithTypeArguments(node); - var exprType = node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : + var exprType = node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); var typeArguments = node.typeArguments; @@ -78445,6 +79081,16 @@ var ts; }); } } + function checkSatisfiesExpression(node) { + checkSourceElement(node.type); + var targetType = getTypeFromTypeNode(node.type); + if (isErrorType(targetType)) { + return targetType; + } + var exprType = checkExpression(node.expression); + checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, node.type, node.expression, ts.Diagnostics.Type_0_does_not_satisfy_the_expected_type_1); + return exprType; + } function checkMetaProperty(node) { checkGrammarMetaProperty(node); if (node.keywordToken === 103 /* SyntaxKind.NewKeyword */) { @@ -78472,7 +79118,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return errorType; } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -78524,7 +79170,7 @@ var ts; } function getParameterIdentifierNameAtPosition(signature, pos) { var _a; - if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 317 /* SyntaxKind.JSDocFunctionType */) { + if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDocFunctionType */) { return undefined; } var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78556,7 +79202,7 @@ var ts; return symbol.valueDeclaration && ts.isParameter(symbol.valueDeclaration) && ts.isIdentifier(symbol.valueDeclaration.name); } function isValidDeclarationForTupleLabel(d) { - return d.kind === 197 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); + return d.kind === 199 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); } function getNameableDeclarationAtPosition(signature, pos) { var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78848,7 +79494,7 @@ var ts; var yieldType; var nextType; var fallbackReturnType = voidType; - if (func.body.kind !== 235 /* SyntaxKind.Block */) { // Async or normal arrow function + if (func.body.kind !== 238 /* SyntaxKind.Block */) { // Async or normal arrow function returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* CheckMode.SkipGenericFunctions */); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -78997,15 +79643,25 @@ var ts; } function isExhaustiveSwitchStatement(node) { var links = getNodeLinks(node); - return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node)); + if (links.isExhaustive === undefined) { + links.isExhaustive = 0; // Indicate resolution is in process + var exhaustive = computeExhaustiveSwitchStatement(node); + if (links.isExhaustive === 0) { + links.isExhaustive = exhaustive; + } + } + else if (links.isExhaustive === 0) { + links.isExhaustive = false; // Resolve circularity to false + } + return links.isExhaustive; } function computeExhaustiveSwitchStatement(node) { - if (node.expression.kind === 216 /* SyntaxKind.TypeOfExpression */) { + if (node.expression.kind === 218 /* SyntaxKind.TypeOfExpression */) { var witnesses = getSwitchClauseTypeOfWitnesses(node); if (!witnesses) { return false; } - var operandConstraint = getBaseConstraintOrType(getTypeOfExpression(node.expression.expression)); + var operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression)); // Get the not-equal flags for all handled cases. var notEqualFacts_2 = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses); if (operandConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */) { @@ -79015,7 +79671,7 @@ var ts; // A missing not-equal flag indicates that the type wasn't handled by some case. return !someType(operandConstraint, function (t) { return (getTypeFacts(t) & notEqualFacts_2) === notEqualFacts_2; }); } - var type = getTypeOfExpression(node.expression); + var type = checkExpressionCached(node.expression); if (!isLiteralType(type)) { return false; } @@ -79066,11 +79722,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: - return func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + case 171 /* SyntaxKind.MethodDeclaration */: + return func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; default: return false; } @@ -79096,7 +79752,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (func.kind === 168 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 235 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { + if (func.kind === 170 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 238 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 512 /* NodeFlags.HasExplicitReturn */; @@ -79130,7 +79786,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); checkNodeDeferred(node); if (ts.isFunctionExpression(node)) { checkCollisionsForDeclarationName(node, node.name); @@ -79157,7 +79813,7 @@ var ts; } // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (!hasGrammarError && node.kind === 215 /* SyntaxKind.FunctionExpression */) { checkGrammarForGenerator(node); } contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -79208,7 +79864,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var functionFlags = ts.getFunctionFlags(node); var returnType = getReturnTypeFromAnnotation(node); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); @@ -79221,7 +79877,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body.kind === 238 /* SyntaxKind.Block */) { checkSourceElement(node.body); } else { @@ -79311,7 +79967,7 @@ var ts; expr.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var ctor = ts.getContainingFunction(expr); - if (!(ctor && (ctor.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { + if (!(ctor && (ctor.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { return true; } if (symbol.valueDeclaration) { @@ -79336,7 +79992,7 @@ var ts; var symbol_2 = getNodeLinks(node).resolvedSymbol; if (symbol_2.flags & 2097152 /* SymbolFlags.Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol_2); - return !!declaration && declaration.kind === 268 /* SyntaxKind.NamespaceImport */; + return !!declaration && declaration.kind === 271 /* SyntaxKind.NamespaceImport */; } } } @@ -79436,7 +80092,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); - if (container && container.kind !== 171 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { + if (container && container.kind !== 173 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); } @@ -79604,6 +80260,9 @@ var ts; } return booleanType; } + function hasEmptyObjectIntersection(type) { + return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); }); + } function checkInExpression(left, right, leftType, rightType) { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; @@ -79620,40 +80279,20 @@ var ts; } } else { - leftType = checkNonNullType(leftType, left); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // Require the left operand to be of type Any, the String primitive type, or the Number primitive type. - if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) || - isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) { - error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol); + // The type of the lef operand must be assignable to string, number, or symbol. + checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left); + } + // The type of the right operand must be assignable to 'object'. + if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) { + // The {} type is assignable to the object type, yet {} might represent a primitive type. Here we + // detect and error on {} that results from narrowing the unknown type, as well as intersections + // that include {} (we know that the other types in such intersections are assignable to object + // since we already checked for that). + if (hasEmptyObjectIntersection(rightType)) { + error(right, ts.Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType)); } } - rightType = checkNonNullType(rightType, right); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // The in operator requires the right operand to be - // - // 1. assignable to the non-primitive type, - // 2. an unconstrained type parameter, - // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the - // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the - // non-primitive type, or - // 4. a type parameter whose constraint is - // i. an object type, - // ii. the non-primitive type, or - // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type. - // - // The divergent behavior for type parameters and unions containing type parameters is a workaround for type - // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance - // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error - // unless *all* instantiations would result in an error. - // // The result is always of the Boolean primitive type. - var rightTypeConstraint = getConstraintOfType(rightType); - if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) { - error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive); - } return booleanType; } function checkObjectLiteralAssignment(node, sourceType, rightIsThis) { @@ -79671,7 +80310,7 @@ var ts; if (rightIsThis === void 0) { rightIsThis = false; } var properties = node.properties; var property = properties[propertyIndex]; - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */ || property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */ || property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var name = property.name; var exprType = getLiteralTypeFromPropertyName(name); if (isTypeUsableAsPropertyName(exprType)) { @@ -79684,9 +80323,9 @@ var ts; } var elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* AccessFlags.ExpressionPosition */, name); var type = getFlowTypeOfDestructuring(property, elementType); - return checkDestructuringAssignment(property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); + return checkDestructuringAssignment(property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); } - else if (property.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (property.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (propertyIndex < properties.length - 1) { error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } @@ -79724,7 +80363,7 @@ var ts; var inBoundsType = compilerOptions.noUncheckedIndexedAccess ? undefined : possiblyOutOfBoundsType; for (var i = 0; i < elements.length; i++) { var type = possiblyOutOfBoundsType; - if (node.elements[i].kind === 225 /* SyntaxKind.SpreadElement */) { + if (node.elements[i].kind === 227 /* SyntaxKind.SpreadElement */) { type = inBoundsType = inBoundsType !== null && inBoundsType !== void 0 ? inBoundsType : (checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, sourceType, undefinedType, node) || errorType); } checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode); @@ -79734,8 +80373,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 227 /* SyntaxKind.OmittedExpression */) { - if (element.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (element.kind !== 229 /* SyntaxKind.OmittedExpression */) { + if (element.kind !== 227 /* SyntaxKind.SpreadElement */) { var indexType = getNumberLiteralType(elementIndex); if (isArrayLikeType(sourceType)) { // We create a synthetic expression so that getIndexedAccessType doesn't get confused @@ -79753,7 +80392,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 221 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (restExpression.kind === 223 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -79769,7 +80408,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) { var target; - if (exprOrAssignment.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -79785,7 +80424,7 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 221 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (target.kind === 223 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { checkBinaryExpression(target, checkMode); target = target.left; // A default value is specified, so remove undefined from the final type. @@ -79793,20 +80432,20 @@ var ts; sourceType = getTypeWithFacts(sourceType, 524288 /* TypeFacts.NEUndefined */); } } - if (target.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (target.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, rightIsThis); } - if (target.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + if (target.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, checkMode); } return checkReferenceAssignment(target, sourceType, checkMode); } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var error = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; - var optionalError = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var optionalError = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; if (checkReferenceExpression(target, error, optionalError)) { @@ -79831,36 +80470,36 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 10 /* SyntaxKind.StringLiteral */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: return true; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -79872,9 +80511,9 @@ var ts; } return false; // Some forms listed here for clarity - case 217 /* SyntaxKind.VoidExpression */: // Explicit opt-out - case 211 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 229 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings + case 219 /* SyntaxKind.VoidExpression */: // Explicit opt-out + case 213 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 231 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -79911,7 +80550,7 @@ var ts; } checkGrammarNullishCoalesceWithLogicalExpression(node); var operator = node.operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { state.skip = true; setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === 108 /* SyntaxKind.ThisKeyword */)); return state; @@ -79933,11 +80572,11 @@ var ts; if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */ || operator === 56 /* SyntaxKind.BarBarToken */ || operator === 60 /* SyntaxKind.QuestionQuestionToken */) { if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */) { var parent = node.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)) { parent = parent.parent; } - checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined); + checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined); } checkTruthinessOfType(leftType, node.left); } @@ -80008,7 +80647,7 @@ var ts; // expression-wide checks and does not use a work stack to fold nested binary expressions into the same callstack frame function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 108 /* SyntaxKind.ThisKeyword */); } var leftType; @@ -80164,6 +80803,7 @@ var ts; var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */; error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true"); } + checkNaNEquality(errorNode, operator, left, right); reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); }); return booleanType; case 102 /* SyntaxKind.InstanceOfKeyword */: @@ -80359,20 +80999,35 @@ var ts; } } function tryGiveBetterPrimaryError(errNode, maybeMissingAwait, leftStr, rightStr) { - var typeName; switch (operatorToken.kind) { case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: case 34 /* SyntaxKind.EqualsEqualsToken */: - typeName = "false"; - break; case 37 /* SyntaxKind.ExclamationEqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: - typeName = "true"; + return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap, leftStr, rightStr); + default: + return undefined; } - if (typeName) { - return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, typeName, leftStr, rightStr); + } + function checkNaNEquality(errorNode, operator, left, right) { + var isLeftNaN = isGlobalNaN(ts.skipParentheses(left)); + var isRightNaN = isGlobalNaN(ts.skipParentheses(right)); + if (isLeftNaN || isRightNaN) { + var err = error(errorNode, ts.Diagnostics.This_condition_will_always_return_0, ts.tokenToString(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? 95 /* SyntaxKind.FalseKeyword */ : 110 /* SyntaxKind.TrueKeyword */)); + if (isLeftNaN && isRightNaN) + return; + var operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? ts.tokenToString(53 /* SyntaxKind.ExclamationToken */) : ""; + var location = isLeftNaN ? right : left; + var expression = ts.skipParentheses(location); + ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")"))); } - return undefined; + } + function isGlobalNaN(expr) { + if (ts.isIdentifier(expr) && expr.escapedText === "NaN") { + var globalNaNSymbol = getGlobalNaNSymbol(); + return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr); + } + return false; } } function getBaseTypesIfUnrelated(leftType, rightType, isRelated) { @@ -80453,8 +81108,8 @@ var ts; } } function checkConditionalExpression(node, checkMode) { - checkTruthinessExpression(node.condition); - checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue); + var type = checkTruthinessExpression(node.condition); + checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue); var type1 = checkExpression(node.whenTrue, checkMode); var type2 = checkExpression(node.whenFalse, checkMode); return getUnionType([type1, type2], 2 /* UnionReduction.Subtype */); @@ -80483,7 +81138,7 @@ var ts; type.flags & 58982400 /* TypeFlags.InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* TypeFlags.StringLike */)); } function getContextNode(node) { - if (node.kind === 286 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { + if (node.kind === 289 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { return node.parent.parent; // Needs to be the root JsxElement, so it encompasses the attributes _and_ the children (which are essentially part of the attributes) } return node; @@ -80537,8 +81192,8 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */ || - node.kind === 229 /* SyntaxKind.AsExpression */ || + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */ || + node.kind === 231 /* SyntaxKind.AsExpression */ || ts.isJSDocTypeAssertion(node); } function checkDeclarationInitializer(declaration, checkMode, contextualType) { @@ -80547,7 +81202,7 @@ var ts; (contextualType ? checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, checkMode || 0 /* CheckMode.Normal */) : checkExpressionCached(initializer, checkMode)); - return ts.isParameter(declaration) && declaration.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && + return ts.isParameter(declaration) && declaration.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; } @@ -80557,7 +81212,7 @@ var ts; var elementFlags = type.target.elementFlags.slice(); for (var i = getTypeReferenceArity(type); i < patternElements.length; i++) { var e = patternElements[i]; - if (i < patternElements.length - 1 || !(e.kind === 203 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { + if (i < patternElements.length - 1 || !(e.kind === 205 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { elementTypes.push(!ts.isOmittedExpression(e) && hasDefaultValue(e) ? getTypeFromBindingElement(e, /*includePatternInType*/ false, /*reportErrors*/ false) : anyType); elementFlags.push(2 /* ElementFlags.Optional */); if (!ts.isOmittedExpression(e) && !hasDefaultValue(e)) { @@ -80625,7 +81280,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, checkMode); @@ -80636,7 +81291,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -80710,6 +81365,9 @@ var ts; function hasInferenceCandidates(info) { return !!(info.candidates || info.contraCandidates); } + function hasInferenceCandidatesOrDefault(info) { + return !!(info.candidates || info.contraCandidates || hasTypeParameterDefault(info.typeParameter)); + } function hasOverlappingInferences(a, b) { for (var i = 0; i < a.length; i++) { if (hasInferenceCandidates(a[i]) && hasInferenceCandidates(b[i])) { @@ -80879,11 +81537,11 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || - (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || - (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums + var ok = (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || + (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || + (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query); } @@ -80908,9 +81566,9 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -80941,80 +81599,82 @@ var ts; return trueType; case 95 /* SyntaxKind.FalseKeyword */: return falseType; - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return checkTemplateExpression(node); case 13 /* SyntaxKind.RegularExpressionLiteral */: return globalRegExpType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return checkArrayLiteral(node, checkMode, forceTuple); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return checkObjectLiteral(node, checkMode); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return checkPropertyAccessExpression(node, checkMode); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return checkQualifiedName(node, checkMode); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return checkIndexedAccess(node, checkMode); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (node.expression.kind === 100 /* SyntaxKind.ImportKeyword */) { return checkImportCallExpression(node); } // falls through - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checkCallExpression(node, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return checkParenthesizedExpression(node, checkMode); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return checkClassExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return checkTypeOfExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return checkAssertion(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return checkNonNullAssertion(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return checkExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return checkSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return checkMetaProperty(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkDeleteExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return checkVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return checkAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checkBinaryExpression(node, checkMode); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return checkConditionalExpression(node, checkMode); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return checkSpreadExpression(node, checkMode); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return undefinedWideningType; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return checkYieldExpression(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return checkSyntheticExpression(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return checkJsxExpression(node, checkMode); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return checkJsxElement(node, checkMode); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return checkJsxSelfClosingElement(node, checkMode); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return checkJsxFragment(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return checkJsxAttributes(node, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return errorType; @@ -81073,10 +81733,10 @@ var ts; checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); if (ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { - if (!(func.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } - if (func.kind === 171 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { + if (func.kind === 173 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); } } @@ -81087,13 +81747,13 @@ var ts; if (func.parameters.indexOf(node) !== 0) { error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } - if (func.kind === 171 /* SyntaxKind.Constructor */ || func.kind === 175 /* SyntaxKind.ConstructSignature */ || func.kind === 180 /* SyntaxKind.ConstructorType */) { + if (func.kind === 173 /* SyntaxKind.Constructor */ || func.kind === 177 /* SyntaxKind.ConstructSignature */ || func.kind === 182 /* SyntaxKind.ConstructorType */) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter); } - if (func.kind === 172 /* SyntaxKind.GetAccessor */ || func.kind === 173 /* SyntaxKind.SetAccessor */) { + if (func.kind === 174 /* SyntaxKind.GetAccessor */ || func.kind === 175 /* SyntaxKind.SetAccessor */) { error(node, ts.Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); } } @@ -81151,13 +81811,13 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 179 /* SyntaxKind.FunctionType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 181 /* SyntaxKind.FunctionType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var parent = node.parent; if (node === parent.type) { return parent; @@ -81175,7 +81835,7 @@ var ts; error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + else if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -81184,13 +81844,13 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 176 /* SyntaxKind.IndexSignature */) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */) { checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === 179 /* SyntaxKind.FunctionType */ || node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 180 /* SyntaxKind.ConstructorType */ || - node.kind === 174 /* SyntaxKind.CallSignature */ || node.kind === 171 /* SyntaxKind.Constructor */ || - node.kind === 175 /* SyntaxKind.ConstructSignature */) { + else if (node.kind === 181 /* SyntaxKind.FunctionType */ || node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 182 /* SyntaxKind.ConstructorType */ || + node.kind === 176 /* SyntaxKind.CallSignature */ || node.kind === 173 /* SyntaxKind.Constructor */ || + node.kind === 177 /* SyntaxKind.ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } var functionFlags = ts.getFunctionFlags(node); @@ -81222,10 +81882,10 @@ var ts; var returnTypeNode = ts.getEffectiveReturnTypeNode(node); if (noImplicitAny && !returnTypeNode) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -81255,7 +81915,7 @@ var ts; checkAsyncFunctionReturnType(node, returnTypeNode); } } - if (node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 317 /* SyntaxKind.JSDocFunctionType */) { + if (node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 320 /* SyntaxKind.JSDocFunctionType */) { registerForUnusedIdentifiersCheck(node); } } @@ -81267,7 +81927,7 @@ var ts; var privateIdentifiers = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */) { + if (member.kind === 173 /* SyntaxKind.Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param, member) && !ts.isBindingPattern(param.name)) { @@ -81289,16 +81949,16 @@ var ts; var memberName = name && ts.getPropertyNameForPropertyNameNode(name); if (memberName) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: addName(names, name, memberName, 1 /* DeclarationMeaning.GetAccessor */ | privateStaticFlags); break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: addName(names, name, memberName, 2 /* DeclarationMeaning.SetAccessor */ | privateStaticFlags); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: addName(names, name, memberName, 3 /* DeclarationMeaning.GetOrSetAccessor */ | privateStaticFlags); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: addName(names, name, memberName, 8 /* DeclarationMeaning.Method */ | privateStaticFlags); break; } @@ -81370,7 +82030,7 @@ var ts; var names = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 166 /* SyntaxKind.PropertySignature */) { + if (member.kind === 168 /* SyntaxKind.PropertySignature */) { var memberName = void 0; var name = member.name; switch (name.kind) { @@ -81395,7 +82055,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -81443,7 +82103,7 @@ var ts; checkVariableLikeDeclaration(node); setNodeLinksForPrivateIdentifierScope(node); // property signatures already report "initializer not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { error(node, ts.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -81463,7 +82123,7 @@ var ts; // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration checkFunctionOrMethodDeclaration(node); // method signatures already report "implementation not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.body) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } // Private named methods are only allowed in class declarations @@ -81516,7 +82176,7 @@ var ts; if (ts.isPrivateIdentifierClassElementDeclaration(n)) { return true; } - return n.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return n.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(n) && !!n.initializer; } @@ -81599,7 +82259,7 @@ var ts; checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { if (!(node.flags & 16777216 /* NodeFlags.Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 256 /* NodeFlags.HasImplicitReturn */)) { if (!(node.flags & 512 /* NodeFlags.HasExplicitReturn */)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); @@ -81609,20 +82269,20 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. var symbol = getSymbolOfNode(node); - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); if (getter && setter && !(getNodeCheckFlags(getter) & 1 /* NodeCheckFlags.TypeChecked */)) { getNodeLinks(getter).flags |= 1 /* NodeCheckFlags.TypeChecked */; var getterFlags = ts.getEffectiveModifierFlags(getter); var setterFlags = ts.getEffectiveModifierFlags(setter); - if ((getterFlags & 128 /* ModifierFlags.Abstract */) !== (setterFlags & 128 /* ModifierFlags.Abstract */)) { + if ((getterFlags & 256 /* ModifierFlags.Abstract */) !== (setterFlags & 256 /* ModifierFlags.Abstract */)) { error(getter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); error(setter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } @@ -81639,7 +82299,7 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } @@ -81685,7 +82345,7 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); - if (node.kind === 178 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } ts.forEach(node.typeArguments, checkSourceElement); @@ -81701,7 +82361,7 @@ var ts; } var symbol = getNodeLinks(node).resolvedSymbol; if (symbol) { - if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) { + if (ts.some(symbol.declarations, function (d) { return ts.isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) { addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName); } if (type.flags & 32 /* TypeFlags.Enum */ && symbol.flags & 8 /* SymbolFlags.EnumMember */) { @@ -81743,7 +82403,7 @@ var ts; var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember); for (var _i = 0, elementTypes_1 = elementTypes; _i < elementTypes_1.length; _i++) { var e = elementTypes_1[_i]; - if (e.kind !== 197 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { + if (e.kind !== 199 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); break; } @@ -81792,7 +82452,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) { - if (accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(objectType) & 1 /* MappedTypeModifiers.IncludeReadonly */) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -81857,7 +82517,7 @@ var ts; ts.forEachChild(node, checkSourceElement); } function checkInferType(node) { - if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 189 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { + if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 191 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter); @@ -81867,7 +82527,7 @@ var ts; if (!links.typeParametersChecked) { links.typeParametersChecked = true; var typeParameter = getDeclaredTypeOfTypeParameter(symbol); - var declarations = ts.getDeclarationsOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var declarations = ts.getDeclarationsOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) { // Report an error on every conflicting declaration. var name = symbolToString(symbol); @@ -81908,10 +82568,10 @@ var ts; if (node.dotDotDotToken && node.questionToken) { grammarErrorOnNode(node, ts.Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); } - if (node.type.kind === 185 /* SyntaxKind.OptionalType */) { + if (node.type.kind === 187 /* SyntaxKind.OptionalType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type); } - if (node.type.kind === 186 /* SyntaxKind.RestType */) { + if (node.type.kind === 188 /* SyntaxKind.RestType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); } checkSourceElement(node.type); @@ -81924,9 +82584,9 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */ && - n.parent.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - n.parent.kind !== 226 /* SyntaxKind.ClassExpression */ && + if (n.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */ && + n.parent.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + n.parent.kind !== 228 /* SyntaxKind.ClassExpression */ && n.flags & 16777216 /* NodeFlags.Ambient */) { if (!(flags & 2 /* ModifierFlags.Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) { // It is nested in an ambient context, which means it is automatically exported @@ -81966,7 +82626,7 @@ var ts; else if (deviation & (8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { error(ts.getNameOfDeclaration(o) || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } - else if (deviation & 128 /* ModifierFlags.Abstract */) { + else if (deviation & 256 /* ModifierFlags.Abstract */) { error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); @@ -81983,7 +82643,7 @@ var ts; }); } } - var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 128 /* ModifierFlags.Abstract */; + var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 256 /* ModifierFlags.Abstract */; var someNodeFlags = 0 /* ModifierFlags.None */; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -82022,7 +82682,7 @@ var ts; // Both are literal property names that are the same. ts.isPropertyNameLiteral(node.name) && ts.isPropertyNameLiteral(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) { - var reportError = (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */) && + var reportError = (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */) && ts.isStatic(node) !== ts.isStatic(subsequentNode); // we can get here in two cases // 1. mixed static and instance class members @@ -82047,7 +82707,7 @@ var ts; else { // Report different errors regarding non-consecutive blocks of declarations depending on whether // the node in question is abstract. - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -82064,7 +82724,7 @@ var ts; var current = declarations_5[_i]; var node = current; var inAmbientContext = node.flags & 16777216 /* NodeFlags.Ambient */; - var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) || inAmbientContext; + var inAmbientContextOrInterface = node.parent && (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -82075,10 +82735,10 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if ((node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { + if ((node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { hasNonAmbientClass = true; } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */ || node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */ || node.kind === 173 /* SyntaxKind.Constructor */) { functionDeclarations.push(node); var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; @@ -82123,12 +82783,12 @@ var ts; }); } if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* SymbolFlags.Function */ && declarations) { - var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 257 /* SyntaxKind.ClassDeclaration */; }) + var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 260 /* SyntaxKind.ClassDeclaration */; }) .map(function (d) { return ts.createDiagnosticForNode(d, ts.Diagnostics.Consider_adding_a_declare_modifier_to_this_class); }); ts.forEach(declarations, function (declaration) { - var diagnostic = declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + var diagnostic = declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ ? ts.Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 - : declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ + : declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : undefined; if (diagnostic) { @@ -82138,7 +82798,7 @@ var ts; } // Abstract methods can't have an implementation -- in particular, they don't need one. if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 128 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { + !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 256 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -82184,9 +82844,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */); + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */); if (effectiveDeclarationFlags & 1 /* ModifierFlags.Export */) { - if (effectiveDeclarationFlags & 512 /* ModifierFlags.Default */) { + if (effectiveDeclarationFlags & 1024 /* ModifierFlags.Default */) { defaultExportedDeclarationSpaces |= declarationSpaces; } else { @@ -82219,26 +82879,26 @@ var ts; function getDeclarationSpaces(decl) { var d = decl; switch (d.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // A jsdoc typedef and callback are, by definition, type aliases. // falls through - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return 2 /* DeclarationSpaces.ExportType */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* ModuleInstanceState.NonInstantiated */ ? 4 /* DeclarationSpaces.ExportNamespace */ | 1 /* DeclarationSpaces.ExportValue */ : 4 /* DeclarationSpaces.ExportNamespace */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */ | 4 /* DeclarationSpaces.ExportNamespace */; - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: var node_2 = d; var expression = ts.isExportAssignment(node_2) ? node_2.expression : node_2.right; // Export assigned entity name expressions act as aliases and should fall through, otherwise they export values @@ -82248,19 +82908,19 @@ var ts; d = expression; // The below options all declare an Alias, which is allowed to merge with other values within the importing module. // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: var result_12 = 0 /* DeclarationSpaces.None */; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_12 |= getDeclarationSpaces(d); }); return result_12; - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 case 79 /* SyntaxKind.Identifier */: // https://github.com/microsoft/TypeScript/issues/36098 // Identifiers are used as declarations of assignment declarations whose parents may be // SyntaxKind.CallExpression - `Object.defineProperty(thing, "aField", {value: 42});` @@ -82304,7 +82964,7 @@ var ts; return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0]; } // primitives with a `{ then() }` won't be unwrapped/adopted. - if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { return undefined; } var thenFunction = getTypeOfPropertyOfType(type, "then"); // TODO: GH#18217 @@ -82371,7 +83031,7 @@ var ts; * Determines whether a type is an object with a callable `then` member. */ function isThenableType(type) { - if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { // primitive types cannot be considered "thenable" since they are not objects. return false; } @@ -82405,7 +83065,7 @@ var ts; // We only need `Awaited` if `T` is a type variable that has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`, // or is promise-like. if (baseConstraint ? - baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) : + baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) : maybeTypeOfKind(type, 8650752 /* TypeFlags.TypeVariable */)) { return true; } @@ -82673,20 +83333,20 @@ var ts; var headMessage; var expectedReturnType; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: headMessage = ts.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; expectedReturnType = voidType; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); @@ -82745,15 +83405,15 @@ var ts; function getEntityNameForDecoratorMetadata(node) { if (node) { switch (node.kind) { - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: return getEntityNameForDecoratorMetadataFromTypeList(node.types); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return getEntityNameForDecoratorMetadata(node.type); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; } } @@ -82762,13 +83422,13 @@ var ts; var commonEntityName; for (var _i = 0, types_21 = types; _i < types_21.length; _i++) { var typeNode = types_21[_i]; - while (typeNode.kind === 191 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 197 /* SyntaxKind.NamedTupleMember */) { + while (typeNode.kind === 193 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 199 /* SyntaxKind.NamedTupleMember */) { typeNode = typeNode.type; // Skip parens if need be } - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { continue; // Always elide `never` from the union/intersection if possible } - if (!strictNullChecks && (typeNode.kind === 196 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && (typeNode.kind === 198 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var individualEntityName = getEntityNameForDecoratorMetadata(typeNode); @@ -82814,14 +83474,14 @@ var ts; return; } checkExternalEmitHelpers(firstDecorator, 8 /* ExternalEmitHelpers.Decorate */); - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { checkExternalEmitHelpers(firstDecorator, 32 /* ExternalEmitHelpers.Param */); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16 /* ExternalEmitHelpers.Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -82830,23 +83490,23 @@ var ts; } } break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - var otherKind = node.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + var otherKind = node.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node)); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node)); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); var containingSignature = node.parent; for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) { @@ -82948,7 +83608,7 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; default: return undefined; @@ -82962,7 +83622,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -82988,7 +83648,7 @@ var ts; checkFunctionOrConstructorSymbol(symbol); } } - var body = node.kind === 168 /* SyntaxKind.MethodSignature */ ? undefined : node.body; + var body = node.kind === 170 /* SyntaxKind.MethodSignature */ ? undefined : node.body; checkSourceElement(body); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node)); addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics); @@ -83034,42 +83694,42 @@ var ts; for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) { var node = potentiallyUnusedIdentifiers_1[_i]; switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: checkUnusedClassMembers(node, addDiagnostic); checkUnusedTypeParameters(node, addDiagnostic); break; - case 305 /* SyntaxKind.SourceFile */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 308 /* SyntaxKind.SourceFile */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: checkUnusedLocalsAndParameters(node, addDiagnostic); break; - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.body) { // Don't report unused parameters in overloads checkUnusedLocalsAndParameters(node, addDiagnostic); } checkUnusedTypeParameters(node, addDiagnostic); break; - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: checkUnusedTypeParameters(node, addDiagnostic); break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: checkUnusedInferTypeParameter(node, addDiagnostic); break; default: @@ -83079,7 +83739,7 @@ var ts; } function errorUnusedLocal(declaration, name, addDiagnostic) { var node = ts.getNameOfDeclaration(declaration) || declaration; - var message = isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read; + var message = ts.isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read; addDiagnostic(declaration, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(node, message, name)); } function isIdentifierThatStartsWithUnderscore(node) { @@ -83089,11 +83749,11 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { // Already would have reported an error on the getter. break; } @@ -83104,7 +83764,7 @@ var ts; addDiagnostic(member, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.hasSyntacticModifier(parameter, 8 /* ModifierFlags.Private */)) { @@ -83112,9 +83772,9 @@ var ts; } } break; - case 176 /* SyntaxKind.IndexSignature */: - case 234 /* SyntaxKind.SemicolonClassElement */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 237 /* SyntaxKind.SemicolonClassElement */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Can't be private break; default: @@ -83142,7 +83802,7 @@ var ts; continue; var name = ts.idText(typeParameter.name); var parent = typeParameter.parent; - if (parent.kind !== 190 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { + if (parent.kind !== 192 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { if (ts.tryAddToSet(seenParentsWithEveryUnused, parent)) { var sourceFile = ts.getSourceFileOfNode(parent); var range = ts.isJSDocTemplateTag(parent) @@ -83248,7 +83908,7 @@ var ts; var importDecl = importClause.parent; var nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? - (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) + (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) : 0); if (nDeclarations === unuseds.length) { addDiagnostic(importDecl, 0 /* UnusedKind.Local */, unuseds.length === 1 @@ -83266,7 +83926,7 @@ var ts; var bindingPattern = _a[0], bindingElements = _a[1]; var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* UnusedKind.Parameter */ : 0 /* UnusedKind.Local */; if (bindingPattern.elements.length === bindingElements.length) { - if (bindingElements.length === 1 && bindingPattern.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (bindingElements.length === 1 && bindingPattern.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId); } else { @@ -83287,7 +83947,7 @@ var ts; if (declarationList.declarations.length === declarations.length) { addDiagnostic(declarationList, 0 /* UnusedKind.Local */, declarations.length === 1 ? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name)) - : ts.createDiagnosticForNode(declarationList.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); + : ts.createDiagnosticForNode(declarationList.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); } else { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -83317,22 +83977,22 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return ts.idText(name); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name); default: return ts.Debug.assertNever(name); } } function isImportedDeclaration(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */ || node.kind === 270 /* SyntaxKind.ImportSpecifier */ || node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 270 /* SyntaxKind.ImportClause */ || node.kind === 273 /* SyntaxKind.ImportSpecifier */ || node.kind === 271 /* SyntaxKind.NamespaceImport */; } function importClauseFromImported(decl) { - return decl.kind === 267 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 268 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; + return decl.kind === 270 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 271 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 235 /* SyntaxKind.Block */) { + if (node.kind === 238 /* SyntaxKind.Block */) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -83367,13 +84027,13 @@ var ts; if ((identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) !== name) { return false; } - if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */ || - node.kind === 168 /* SyntaxKind.MethodSignature */ || - node.kind === 172 /* SyntaxKind.GetAccessor */ || - node.kind === 173 /* SyntaxKind.SetAccessor */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */ || + node.kind === 170 /* SyntaxKind.MethodSignature */ || + node.kind === 174 /* SyntaxKind.GetAccessor */ || + node.kind === 175 /* SyntaxKind.SetAccessor */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */) { // it is ok to have member named '_super', '_this', `Promise`, etc. - member access is always qualified return false; } @@ -83439,7 +84099,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83454,7 +84114,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83554,7 +84214,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -83566,17 +84226,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* SymbolFlags.BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* NodeFlags.BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); - var container = varDeclList.parent.kind === 237 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); + var container = varDeclList.parent.kind === 240 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || - container.kind === 262 /* SyntaxKind.ModuleBlock */ || - container.kind === 261 /* SyntaxKind.ModuleDeclaration */ || - container.kind === 305 /* SyntaxKind.SourceFile */); + (container.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || + container.kind === 265 /* SyntaxKind.ModuleBlock */ || + container.kind === 264 /* SyntaxKind.ModuleDeclaration */ || + container.kind === 308 /* SyntaxKind.SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -83607,7 +84267,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); if (ts.hasOnlyExpressionInitializer(node) && node.initializer) { checkExpressionCached(node.initializer); @@ -83629,7 +84289,7 @@ var ts; checkExternalEmitHelpers(node, 4 /* ExternalEmitHelpers.Rest */); } // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access @@ -83651,7 +84311,7 @@ var ts; } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { + if (node.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* ExternalEmitHelpers.Read */); } ts.forEach(node.name.elements, checkSourceElement); @@ -83663,7 +84323,7 @@ var ts; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { - var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */; + var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */; var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression)); if (needCheckInitializer || needCheckWidenedType) { // Don't validate for-in initializer as it is already an error @@ -83691,7 +84351,7 @@ var ts; } // For a commonjs `const x = require`, validate the alias and exit var symbol = getSymbolOfNode(node); - if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { + if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 205 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { checkAliasSymbol(node); return; } @@ -83705,7 +84365,7 @@ var ts; ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) && !!((_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.size); - if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */) { + if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */) { checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined); } } @@ -83731,10 +84391,10 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionsForDeclarationName(node, node.name); @@ -83742,7 +84402,7 @@ var ts; } function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) { var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration); - var message = nextDeclaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 166 /* SyntaxKind.PropertySignature */ + var message = nextDeclaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 168 /* SyntaxKind.PropertySignature */ ? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; var declName = ts.declarationNameToString(nextDeclarationName); @@ -83752,8 +84412,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 164 /* SyntaxKind.Parameter */ && right.kind === 254 /* SyntaxKind.VariableDeclaration */) || - (left.kind === 254 /* SyntaxKind.VariableDeclaration */ && right.kind === 164 /* SyntaxKind.Parameter */)) { + if ((left.kind === 166 /* SyntaxKind.Parameter */ && right.kind === 257 /* SyntaxKind.VariableDeclaration */) || + (left.kind === 257 /* SyntaxKind.VariableDeclaration */ && right.kind === 166 /* SyntaxKind.Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -83762,8 +84422,8 @@ var ts; } var interestingFlags = 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | - 256 /* ModifierFlags.Async */ | - 128 /* ModifierFlags.Abstract */ | + 512 /* ModifierFlags.Async */ | + 256 /* ModifierFlags.Abstract */ | 64 /* ModifierFlags.Readonly */ | 32 /* ModifierFlags.Static */; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); @@ -83792,15 +84452,15 @@ var ts; function checkIfStatement(node) { // Grammar checking checkGrammarStatementInAmbientContext(node); - checkTruthinessExpression(node.expression); - checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement); + var type = checkTruthinessExpression(node.expression); + checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 236 /* SyntaxKind.EmptyStatement */) { + if (node.thenStatement.kind === 239 /* SyntaxKind.EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); } - function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) { + function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) { if (!strictNullChecks) return; helper(condExpr, body); @@ -83815,7 +84475,7 @@ var ts; : condExpr; if (ts.isModuleExportsAccessExpression(location)) return; - var type = checkTruthinessExpression(location); + var type = location === condExpr ? condType : checkTruthinessExpression(location); var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression); if (!(getTypeFacts(type) & 4194304 /* TypeFacts.Truthy */) || isPropertyExpressionCast) return; @@ -83929,12 +84589,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -83974,14 +84634,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node); // There may be a destructuring assignment on the left side - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -84013,7 +84673,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -84027,7 +84687,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -84509,7 +85169,16 @@ var ts; var message = allowAsyncIterables ? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator : ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator; - return errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type)); + var suggestAwait = + // for (const x of Promise<...>) or [...Promise<...>] + !!getAwaitedTypeOfPromise(type) + // for (const x of AsyncIterable<...>) + || (!allowAsyncIterables && + ts.isForOfStatement(errorNode.parent) && + errorNode.parent.expression === errorNode && + getGlobalAsyncIterableType(/** reportErrors */ false) !== emptyGenericType && + isTypeAssignableTo(type, getGlobalAsyncIterableType(/** reportErrors */ false))); + return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type)); } /** * Gets the *yield*, *return*, and *next* types from an `Iterator`-like or `AsyncIterator`-like type. @@ -84827,12 +85496,12 @@ var ts; var functionFlags = ts.getFunctionFlags(container); if (strictNullChecks || node.expression || returnType.flags & 131072 /* TypeFlags.Never */) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (container.kind === 173 /* SyntaxKind.SetAccessor */) { + if (container.kind === 175 /* SyntaxKind.SetAccessor */) { if (node.expression) { error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -84850,7 +85519,7 @@ var ts; } } } - else if (container.kind !== 171 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { + else if (container.kind !== 173 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { // The function has a return type, but the return statement doesn't have an expression. error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -84879,7 +85548,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -84888,7 +85557,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause)); } ts.forEach(clause.statements, checkSourceElement); @@ -84925,7 +85594,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 250 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { + if (current.kind === 253 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -85020,9 +85689,9 @@ var ts; return; } var indexInfos = getApplicableIndexInfos(type, propNameType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; - var propDeclaration = declaration && declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || - name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || + name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined; var _loop_30 = function (info) { var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; @@ -85047,7 +85716,7 @@ var ts; function checkIndexConstraintForIndexSignature(type, checkInfo) { var declaration = checkInfo.declaration; var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined; var _loop_31 = function (info) { if (info === checkInfo) @@ -85119,7 +85788,7 @@ var ts; } else { ts.forEach(jsdocParameters, function (_a, index) { - var name = _a.name; + var name = _a.name, isNameFirst = _a.isNameFirst; if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) { return; } @@ -85129,7 +85798,9 @@ var ts; } } else { - errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name)); + if (!isNameFirst) { + errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name)); + } } }); } @@ -85167,7 +85838,7 @@ var ts; function checkTypeParametersNotReferenced(root, typeParameters, index) { visit(root); function visit(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */) { var type = getTypeFromTypeReference(node); if (type.flags & 262144 /* TypeFlags.TypeParameter */) { for (var i = index; i < typeParameters.length; i++) { @@ -85257,7 +85928,7 @@ var ts; if (firstDecorator && ts.some(node.members, function (p) { return ts.hasStaticModifier(p) && ts.isPrivateIdentifierClassElementDeclaration(p); })) { grammarErrorOnNode(firstDecorator, ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator); } - if (!node.name && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (!node.name && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -85324,7 +85995,7 @@ var ts; } else { var constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); - if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(node.name || node, ts.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract); } } @@ -85559,7 +86230,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 257 /* SyntaxKind.ClassDeclaration */ || d.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return d.kind === 260 /* SyntaxKind.ClassDeclaration */ || d.kind === 261 /* SyntaxKind.InterfaceDeclaration */; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -85600,7 +86271,7 @@ var ts; // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. - if (baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 128 /* ModifierFlags.Abstract */))) { + if (baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 256 /* ModifierFlags.Abstract */))) { // Searches other base types for a declaration that would satisfy the inherited abstract member. // (The class may have more than one base type via declaration merging with an interface with the // same name.) @@ -85614,7 +86285,7 @@ var ts; return "continue-basePropertyCheck"; } } - if (derivedClassDecl.kind === 226 /* SyntaxKind.ClassExpression */) { + if (derivedClassDecl.kind === 228 /* SyntaxKind.ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -85649,11 +86320,11 @@ var ts; error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type)); } else if (useDefineForClassFields) { - var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); + var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); if (uninitialized && !(derived.flags & 33554432 /* SymbolFlags.Transient */) - && !(baseDeclarationFlags & 128 /* ModifierFlags.Abstract */) - && !(derivedDeclarationFlags & 128 /* ModifierFlags.Abstract */) + && !(baseDeclarationFlags & 256 /* ModifierFlags.Abstract */) + && !(derivedDeclarationFlags & 256 /* ModifierFlags.Abstract */) && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* NodeFlags.Ambient */); }))) { var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol)); var propName = uninitialized.name; @@ -85696,7 +86367,7 @@ var ts; } } function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) { - return baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) + return baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) || ts.isInterfaceDeclaration(declaration.parent); } function getNonInheritedProperties(type, baseTypes, properties) { @@ -85778,7 +86449,7 @@ var ts; } } function isPropertyWithoutInitializer(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; @@ -85821,7 +86492,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -85854,7 +86525,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); checkExportsOnMergedDeclarations(node); checkTypeParameters(node.typeParameters); - if (node.type.kind === 138 /* SyntaxKind.IntrinsicKeyword */) { + if (node.type.kind === 139 /* SyntaxKind.IntrinsicKeyword */) { if (!intrinsicTypeKinds.has(node.name.escapedText) || ts.length(node.typeParameters) !== 1) { error(node.type, ts.Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); } @@ -85940,7 +86611,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -85950,7 +86621,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -85979,7 +86650,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: checkGrammarNumericLiteral(expr); return +expr.text; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return evaluate(expr.expression); case 79 /* SyntaxKind.Identifier */: var identifier = expr; @@ -85987,13 +86658,13 @@ var ts; return +(identifier.escapedText); } return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (isConstantMemberAccess(expr)) { var type = getTypeOfExpression(expr.expression); if (type.symbol && type.symbol.flags & 384 /* SymbolFlags.Enum */) { var name = void 0; - if (expr.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (expr.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { name = expr.name.escapedText; } else { @@ -86030,8 +86701,8 @@ var ts; return false; } return node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || - node.kind === 207 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && + node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || + node.kind === 209 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && ts.isStringLiteralLike(node.argumentExpression); } function checkEnumDeclaration(node) { @@ -86065,7 +86736,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -86094,8 +86765,8 @@ var ts; if (declarations) { for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; - if ((declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || - (declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || + (declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { return declaration; } @@ -86166,7 +86837,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 257 /* SyntaxKind.ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 260 /* SyntaxKind.ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* NodeCheckFlags.LexicalModuleMergesWithClass */; @@ -86209,56 +86880,43 @@ var ts; } } function checkModuleAugmentationElement(node, isGlobalAugmentation) { - var _a; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement - for (var _i = 0, _b = node.declarationList.declarations; _i < _b.length; _i++) { - var decl = _b[_i]; + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 203 /* SyntaxKind.BindingElement */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: var name = node.name; if (ts.isBindingPattern(name)) { - for (var _c = 0, _d = name.elements; _c < _d.length; _c++) { - var el = _d[_c]; + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { + var el = _c[_b]; // mark individual names in binding pattern checkModuleAugmentationElement(el, isGlobalAugmentation); } break; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } - var symbol = getSymbolOfNode(node); - if (symbol) { - // module augmentations cannot introduce new names on the top level scope of the module - // this is done it two steps - // 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error - // 2. main check - report error if value declaration of the parent symbol is module augmentation) - var reportError = !(symbol.flags & 33554432 /* SymbolFlags.Transient */); - if (!reportError) { - // symbol should not originate in augmentation - reportError = !!((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.declarations) && ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); - } - } break; } } @@ -86266,12 +86924,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { if (ts.isModuleExportsAccessExpression(node.expression) && !ts.isPrivateIdentifier(node.name)) { return node.name; @@ -86291,9 +86949,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 272 /* SyntaxKind.ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 275 /* SyntaxKind.ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -86340,8 +86998,8 @@ var ts; var errorNode = ts.isImportOrExportSpecifier(node) ? node.propertyName || node.name : ts.isNamedDeclaration(node) ? node.name : node; - ts.Debug.assert(node.kind !== 274 /* SyntaxKind.NamespaceExport */); - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */) { + ts.Debug.assert(node.kind !== 277 /* SyntaxKind.NamespaceExport */); + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */) { var diag = error(errorNode, ts.Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files); var alreadyExportedSymbol = (_b = (_a = ts.getSourceFileOfNode(node).symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.get((node.propertyName || node.name).escapedText); if (alreadyExportedSymbol === target) { @@ -86352,7 +87010,7 @@ var ts; } } else { - ts.Debug.assert(node.kind !== 254 /* SyntaxKind.VariableDeclaration */); + ts.Debug.assert(node.kind !== 257 /* SyntaxKind.VariableDeclaration */); var importDeclaration = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)); var moduleSpecifier = (_e = (importDeclaration && ((_d = ts.tryGetModuleSpecifierFromDeclaration(importDeclaration)) === null || _d === void 0 ? void 0 : _d.text))) !== null && _e !== void 0 ? _e : "..."; var importedIdentifier = ts.unescapeLeadingUnderscores(ts.isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName); @@ -86360,11 +87018,12 @@ var ts; } return; } + var targetFlags = getAllSymbolFlags(target); var excludedMeanings = (symbol.flags & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */) ? 111551 /* SymbolFlags.Value */ : 0) | (symbol.flags & 788968 /* SymbolFlags.Type */ ? 788968 /* SymbolFlags.Type */ : 0) | (symbol.flags & 1920 /* SymbolFlags.Namespace */ ? 1920 /* SymbolFlags.Namespace */ : 0); - if (target.flags & excludedMeanings) { - var message = node.kind === 275 /* SyntaxKind.ExportSpecifier */ ? + if (targetFlags & excludedMeanings) { + var message = node.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -86373,26 +87032,26 @@ var ts; && !ts.isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 16777216 /* NodeFlags.Ambient */)) { var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol); - var isType = !(target.flags & 111551 /* SymbolFlags.Value */); + var isType = !(targetFlags & 111551 /* SymbolFlags.Value */); if (isType || typeOnlyAlias) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { if (compilerOptions.preserveValueImports) { ts.Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name"); var message = isType ? ts.Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled : ts.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled; - var name = ts.idText(node.kind === 270 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); + var name = ts.idText(node.kind === 273 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name); } - if (isType && node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { + if (isType && node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided); } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // Don't allow re-exporting an export that will be elided when `--isolatedModules` is set. // The exception is that `import type { A } from './a'; export { A }` is allowed // because single-file analysis can determine that the export should be dropped. @@ -86451,7 +87110,7 @@ var ts; function checkImportBinding(node) { checkCollisionsForDeclarationName(node, node.name); checkAliasSymbol(node); - if (node.kind === 270 /* SyntaxKind.ImportSpecifier */ && + if (node.kind === 273 /* SyntaxKind.ImportSpecifier */ && ts.idText(node.propertyName || node.name) === "default" && ts.getESModuleInterop(compilerOptions) && moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) { @@ -86501,7 +87160,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { checkImportBinding(importClause.namedBindings); if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && ts.getESModuleInterop(compilerOptions)) { // import * as ns from "foo"; @@ -86530,17 +87189,18 @@ var ts; if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */) { + if (node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { - if (target.flags & 111551 /* SymbolFlags.Value */) { + var targetFlags = getAllSymbolFlags(target); + if (targetFlags & 111551 /* SymbolFlags.Value */) { // Target is a value symbol, check that it is not hidden by a local declaration with the same name var moduleName = ts.getFirstIdentifier(node.moduleReference); if (!(resolveEntityName(moduleName, 111551 /* SymbolFlags.Value */ | 1920 /* SymbolFlags.Namespace */).flags & 1920 /* SymbolFlags.Namespace */)) { error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName)); } } - if (target.flags & 788968 /* SymbolFlags.Type */) { + if (targetFlags & 788968 /* SymbolFlags.Type */) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0); } } @@ -86573,10 +87233,10 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* NodeFlags.Ambient */; - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -86611,7 +87271,7 @@ var ts; function checkGrammarExportDeclaration(node) { var _a; if (node.isTypeOnly) { - if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 273 /* SyntaxKind.NamedExports */) { + if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 276 /* SyntaxKind.NamedExports */) { return checkGrammarNamedImportsOrExports(node.exportClause); } else { @@ -86621,7 +87281,7 @@ var ts; return false; } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 305 /* SyntaxKind.SourceFile */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 308 /* SyntaxKind.SourceFile */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -86679,7 +87339,7 @@ var ts; markExportAsReferenced(node); } var target = symbol && (symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol); - if (!target || target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (!target || getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) { checkExpressionCached(node.propertyName || node.name); } } @@ -86701,8 +87361,8 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -86726,7 +87386,7 @@ var ts; markAliasReferenced(sym, id); // If not a value, we're interpreting the identifier as a type export, along the lines of (`export { Id as default }`) var target = sym.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(sym) : sym; - if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) { // However if it is a value, we need to check it's being used correctly checkExpressionCached(node.expression); } @@ -86834,181 +87494,181 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } - if (kind >= 237 /* SyntaxKind.FirstStatement */ && kind <= 253 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { + if (kind >= 240 /* SyntaxKind.FirstStatement */ && kind <= 256 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, ts.Diagnostics.Unreachable_code_detected); } switch (kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return checkTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return checkParameter(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return checkPropertyDeclaration(node); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checkPropertySignature(node); - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return checkSignatureDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return checkMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return checkClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return checkConstructorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return checkAccessorDeclaration(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return checkTypeReferenceNode(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return checkTypePredicate(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return checkTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return checkTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return checkArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return checkTupleType(node); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return checkUnionOrIntersectionType(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: return checkSourceElement(node.type); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return checkThisType(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return checkTypeOperator(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return checkConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return checkInferType(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return checkTemplateLiteralType(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return checkImportType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return checkNamedTupleMember(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return checkJSDocImplementsTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return checkJSDocTypeAliasTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return checkJSDocTemplateTag(node); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return checkJSDocTypeTag(node); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: + case 327 /* SyntaxKind.JSDocLink */: + case 328 /* SyntaxKind.JSDocLinkCode */: + case 329 /* SyntaxKind.JSDocLinkPlain */: return checkJSDocLinkLikeTag(node); - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return checkJSDocParameterTag(node); - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return checkJSDocPropertyTag(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: checkJSDocFunctionType(node); // falls through - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: checkJSDocVariadicType(node); return; - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return checkSourceElement(node.type); - case 333 /* SyntaxKind.JSDocPublicTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: return checkJSDocAccessibilityModifiers(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return checkIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return checkMappedType(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return checkFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return checkBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return checkVariableStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return checkExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return checkIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return checkDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return checkWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return checkForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return checkForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: return checkBreakOrContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return checkReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return checkSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return checkThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return checkTryStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checkVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return checkBindingElement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return checkClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return checkEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return checkModuleDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return checkImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return checkExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return checkExportAssignment(node); - case 236 /* SyntaxKind.EmptyStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -87115,36 +87775,36 @@ var ts; currentNode = node; instantiationCount = 0; switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: // These node kinds are deferred checked when overload resolution fails // To save on work, we ensure the arguments are checked just once, in // a deferred way resolveUntypedCall(node); break; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: checkAccessorDeclaration(node); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: checkClassExpressionDeferred(node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: checkTypeParameterDeferred(node); break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: checkJsxSelfClosingElementDeferred(node); break; - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: checkJsxElementDeferred(node); break; } @@ -87317,17 +87977,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalModule(location)) break; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: copyLocallyVisibleExportSymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* SymbolFlags.ModuleMember */); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* SymbolFlags.EnumMember */); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); @@ -87335,8 +87995,8 @@ var ts; // this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration. // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -87345,7 +88005,7 @@ var ts; copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968 /* SymbolFlags.Type */); } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -87389,7 +88049,7 @@ var ts; if (meaning) { source.forEach(function (symbol) { // Similar condition as in `resolveNameHelper` - if (!ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 274 /* SyntaxKind.NamespaceExport */)) { + if (!ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 277 /* SyntaxKind.NamespaceExport */)) { copySymbol(symbol, meaning); } }); @@ -87398,41 +88058,21 @@ var ts; } function isTypeDeclarationName(name) { return name.kind === 79 /* SyntaxKind.Identifier */ && - isTypeDeclaration(name.parent) && + ts.isTypeDeclaration(name.parent) && ts.getNameOfDeclaration(name.parent) === name; } - function isTypeDeclaration(node) { - switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - return true; - case 267 /* SyntaxKind.ImportClause */: - return node.isTypeOnly; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - return node.parent.parent.isTypeOnly; - default: - return false; - } - } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 178 /* SyntaxKind.TypeReference */; + return node.parent.kind === 180 /* SyntaxKind.TypeReference */; } function isHeritageClauseElementIdentifier(node) { - while (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - return node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -87460,13 +88100,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (nodeOnRightSide.parent.kind === 163 /* SyntaxKind.QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } - if (nodeOnRightSide.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } return undefined; @@ -87492,7 +88132,7 @@ var ts; node = parent; parent = parent.parent; } - if (parent && parent.kind === 200 /* SyntaxKind.ImportType */ && parent.qualifier === node) { + if (parent && parent.kind === 202 /* SyntaxKind.ImportType */ && parent.qualifier === node) { return parent; } return undefined; @@ -87502,7 +88142,7 @@ var ts; return getSymbolOfNode(name.parent); } if (ts.isInJSFile(name) && - name.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + name.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && name.parent === name.parent.parent.left) { // Check if this is a special property assignment if (!ts.isPrivateIdentifier(name) && !ts.isJSDocMemberName(name)) { @@ -87512,7 +88152,7 @@ var ts; } } } - if (name.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { + if (name.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { // Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression var success = resolveEntityName(name, /*all meanings*/ 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*ignoreErrors*/ true); @@ -87522,7 +88162,7 @@ var ts; } else if (ts.isEntityName(name) && isInRightSideOfImportOrExportAssignment(name)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(name, 265 /* SyntaxKind.ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(name, 268 /* SyntaxKind.ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(name, /*dontResolveAlias*/ true); } @@ -87540,7 +88180,7 @@ var ts; if (isHeritageClauseElementIdentifier(name)) { var meaning = 0 /* SymbolFlags.None */; // In an interface or class, we're definitely interested in a type. - if (name.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (name.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { meaning = 788968 /* SymbolFlags.Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) { @@ -87556,10 +88196,10 @@ var ts; return entityNameSymbol; } } - if (name.parent.kind === 340 /* SyntaxKind.JSDocParameterTag */) { + if (name.parent.kind === 343 /* SyntaxKind.JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(name.parent); } - if (name.parent.kind === 163 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 344 /* SyntaxKind.JSDocTemplateTag */) { + if (name.parent.kind === 165 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 347 /* SyntaxKind.JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJSFile(name)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(name.parent); return typeParameter && typeParameter.symbol; @@ -87583,18 +88223,53 @@ var ts; return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container)); } } + if (result && isJSDoc_1) { + var container = ts.getJSDocHost(name); + if (container && ts.isEnumMember(container) && container === result.valueDeclaration) { + return resolveEntityName(name, meaning, /*ignoreErrors*/ true, /* dontResolveAlias */ true, ts.getSourceFileOfNode(container)) || result; + } + } return result; } else if (ts.isPrivateIdentifier(name)) { return getSymbolForPrivateIdentifierExpression(name); } - else if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 161 /* SyntaxKind.QualifiedName */) { + else if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 163 /* SyntaxKind.QualifiedName */) { var links = getNodeLinks(name); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { checkPropertyAccessExpression(name, 0 /* CheckMode.Normal */); + if (!links.resolvedSymbol) { + var expressionType = checkExpressionCached(name.expression); + var infos = getApplicableIndexInfos(expressionType, getLiteralTypeFromPropertyName(name.name)); + if (infos.length && expressionType.members) { + var resolved = resolveStructuredTypeMembers(expressionType); + var symbol = resolved.members.get("__index" /* InternalSymbolName.Index */); + if (infos === getIndexInfosOfType(expressionType)) { + links.resolvedSymbol = symbol; + } + else if (symbol) { + var symbolLinks_1 = getSymbolLinks(symbol); + var declarationList = ts.mapDefined(infos, function (i) { return i.declaration; }); + var nodeListId = ts.map(declarationList, getNodeId).join(","); + if (!symbolLinks_1.filteredIndexSymbolCache) { + symbolLinks_1.filteredIndexSymbolCache = new ts.Map(); + } + if (symbolLinks_1.filteredIndexSymbolCache.has(nodeListId)) { + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + else { + var copy = createSymbol(131072 /* SymbolFlags.Signature */, "__index" /* InternalSymbolName.Index */); + copy.declarations = ts.mapDefined(infos, function (i) { return i.declaration; }); + copy.parent = expressionType.aliasSymbol ? expressionType.aliasSymbol : expressionType.symbol ? expressionType.symbol : getSymbolAtLocation(copy.declarations[0].parent); + symbolLinks_1.filteredIndexSymbolCache.set(nodeListId, copy); + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + } + } + } } else { checkQualifiedName(name, 0 /* CheckMode.Normal */); @@ -87609,11 +88284,11 @@ var ts; } } else if (isTypeReferenceIdentifier(name)) { - var meaning = name.parent.kind === 178 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; + var meaning = name.parent.kind === 180 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; var symbol = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name); } - if (name.parent.kind === 177 /* SyntaxKind.TypePredicate */) { + if (name.parent.kind === 179 /* SyntaxKind.TypePredicate */) { return resolveEntityName(name, /*meaning*/ 1 /* SymbolFlags.FunctionScopedVariable */); } return undefined; @@ -87647,7 +88322,7 @@ var ts; } } function getSymbolAtLocation(node, ignoreErrors) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } var parent = node.parent; @@ -87670,8 +88345,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } - else if (parent.kind === 203 /* SyntaxKind.BindingElement */ && - grandParent.kind === 201 /* SyntaxKind.ObjectBindingPattern */ && + else if (parent.kind === 205 /* SyntaxKind.BindingElement */ && + grandParent.kind === 203 /* SyntaxKind.ObjectBindingPattern */ && node === parent.propertyName) { var typeOfPattern = getTypeOfNode(grandParent); var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText); @@ -87698,8 +88373,8 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: if (!ts.isThisInTypeQuery(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } @@ -87716,14 +88391,14 @@ var ts; return checkExpression(node).symbol; } // falls through - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return getTypeFromThisTypeNode(node).symbol; case 106 /* SyntaxKind.SuperKeyword */: return checkExpression(node).symbol; - case 134 /* SyntaxKind.ConstructorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 171 /* SyntaxKind.Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 173 /* SyntaxKind.Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -87734,7 +88409,7 @@ var ts; // 3). Dynamic import call or require in javascript // 4). type A = import("./f/*gotToDefinitionHere*/oo") if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 272 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || + ((node.parent.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 275 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || ((ts.isInJSFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent)) || (ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) { return resolveExternalModuleName(node, node, ignoreErrors); @@ -87756,14 +88431,14 @@ var ts; case 38 /* SyntaxKind.EqualsGreaterThanToken */: case 84 /* SyntaxKind.ClassKeyword */: return getSymbolOfNode(node.parent); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : undefined; case 93 /* SyntaxKind.ExportKeyword */: return ts.isExportAssignment(node.parent) ? ts.Debug.checkDefined(node.parent.symbol) : undefined; case 100 /* SyntaxKind.ImportKeyword */: case 103 /* SyntaxKind.NewKeyword */: return ts.isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : undefined; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return checkExpression(node).symbol; default: return undefined; @@ -87779,7 +88454,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (location && location.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 111551 /* SymbolFlags.Value */ | 2097152 /* SymbolFlags.Alias */); } return undefined; @@ -87818,7 +88493,7 @@ var ts; var baseType = ts.firstOrUndefined(getBaseTypes(classType)); return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType; } - if (isTypeDeclaration(node)) { + if (ts.isTypeDeclaration(node)) { // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); @@ -87861,23 +88536,23 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfAssignmentPattern(expr) { - ts.Debug.assert(expr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (expr.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expr.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (expr.parent.kind === 299 /* SyntaxKind.PropertyAssignment */) { var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression); var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType; var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent); @@ -87925,7 +88600,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 10 /* SyntaxKind.StringLiteral */: return getStringLiteralType(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameType = checkComputedPropertyName(name); return isTypeAssignableToKind(nameType, 12288 /* TypeFlags.ESSymbolLike */) ? nameType : stringType; default: @@ -88013,7 +88688,7 @@ var ts; return symbolLinks.exportsSomeValue; function isValue(s) { s = resolveSymbol(s); - return s && !!(s.flags & 111551 /* SymbolFlags.Value */); + return s && !!(getAllSymbolFlags(s) & 111551 /* SymbolFlags.Value */); } } function isNameOfModuleOrEnumDeclaration(node) { @@ -88043,7 +88718,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 305 /* SyntaxKind.SourceFile */) { + if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 308 /* SyntaxKind.SourceFile */) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -88063,10 +88738,10 @@ var ts; } var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier); if (node) { - var symbol = getReferencedValueSymbol(node); + var symbol = getReferencedValueOrAliasSymbol(node); // We should only get the declaration of an alias if there isn't a local value // declaration for the symbol - if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) { return getDeclarationOfAliasSymbol(symbol); } } @@ -88075,7 +88750,7 @@ var ts; function isSymbolOfDestructuredElementOfCatchBinding(symbol) { return symbol.valueDeclaration && ts.isBindingElement(symbol.valueDeclaration) - && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 292 /* SyntaxKind.CatchClause */; + && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 295 /* SyntaxKind.CatchClause */; } function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 /* SymbolFlags.BlockScoped */ && symbol.valueDeclaration && !ts.isSourceFile(symbol.valueDeclaration)) { @@ -88106,7 +88781,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 235 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 238 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -88147,19 +88822,19 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: var symbol = getSymbolOfNode(node); - return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol); - case 272 /* SyntaxKind.ExportDeclaration */: + return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */); + case 275 /* SyntaxKind.ExportDeclaration */: var exportClause = node.exportClause; return !!exportClause && (ts.isNamespaceExport(exportClause) || ts.some(exportClause.elements, isValueAliasDeclaration)); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return node.expression && node.expression.kind === 79 /* SyntaxKind.Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; @@ -88168,7 +88843,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(nodeIn) { var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -88176,6 +88851,7 @@ var ts; return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference); } function isAliasResolvedToValue(symbol) { + var _a; if (!symbol) { return false; } @@ -88185,7 +88861,7 @@ var ts; } // const enums and modules that contain only const enums are not considered values from the emit perspective // unless 'preserveConstEnums' option is set to true - return !!(target.flags & 111551 /* SymbolFlags.Value */) && + return !!(((_a = getAllSymbolFlags(target)) !== null && _a !== void 0 ? _a : -1) & 111551 /* SymbolFlags.Value */) && (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target)); } function isConstEnumOrConstEnumOnlyModule(s) { @@ -88200,7 +88876,7 @@ var ts; } var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217 if (target && ts.getEffectiveModifierFlags(node) & 1 /* ModifierFlags.Export */ && - target.flags & 111551 /* SymbolFlags.Value */ && + getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */ && (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) { // An `export import ... =` of a value symbol is always considered referenced return true; @@ -88278,15 +88954,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 299 /* SyntaxKind.EnumMember */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 302 /* SyntaxKind.EnumMember */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return true; } return false; } function getConstantValue(node) { - if (node.kind === 299 /* SyntaxKind.EnumMember */) { + if (node.kind === 302 /* SyntaxKind.EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -88379,7 +89055,7 @@ var ts; function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) { var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor); if (!declaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } // Get type of the symbol if this is the valid symbol otherwise get type at location var symbol = getSymbolOfNode(declaration); @@ -88398,7 +89074,7 @@ var ts; function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) { var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike); if (!signatureDeclaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var signature = getSignatureFromDeclaration(signatureDeclaration); return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88406,7 +89082,7 @@ var ts; function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) { var expr = ts.getParseTreeNode(exprIn, ts.isExpression); if (!expr) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var type = getWidenedType(getRegularTypeOfExpression(expr)); return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88430,6 +89106,25 @@ var ts; } return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); } + /** + * Get either a value-meaning symbol or an alias symbol. + * Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol, + * we call `resolveName` to find a symbol. + * This is because when caching the resolved symbol, we only consider value symbols, but here + * we want to also get an alias symbol if one exists. + */ + function getReferencedValueOrAliasSymbol(reference) { + var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; + if (resolvedSymbol && resolvedSymbol !== unknownSymbol) { + return resolvedSymbol; + } + return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, + /*nodeNotFoundMessage*/ undefined, + /*nameArg*/ undefined, + /*isUse*/ true, + /*excludeGlobals*/ undefined, + /*getSpellingSuggestions*/ undefined); + } function getReferencedValueDeclaration(referenceIn) { if (!ts.isGeneratedIdentifier(referenceIn)) { var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier); @@ -88563,12 +89258,12 @@ var ts; getJsxFragmentFactoryEntity: getJsxFragmentFactoryEntity, getAllAccessorDeclarations: function (accessor) { accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); // TODO: GH#18217 - var otherKind = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? 172 /* SyntaxKind.GetAccessor */ : 173 /* SyntaxKind.SetAccessor */; + var otherKind = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? 174 /* SyntaxKind.GetAccessor */ : 175 /* SyntaxKind.SetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind); var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor; var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor; - var setAccessor = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; - var getAccessor = accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; + var setAccessor = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; + var getAccessor = accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; return { firstAccessor: firstAccessor, secondAccessor: secondAccessor, @@ -88584,7 +89279,7 @@ var ts; }, getDeclarationStatementsForSourceFile: function (node, flags, tracker, bundled) { var n = ts.getParseTreeNode(node); - ts.Debug.assert(n && n.kind === 305 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); + ts.Debug.assert(n && n.kind === 308 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); var sym = getSymbolOfNode(node); if (!sym) { return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker, bundled); @@ -88621,7 +89316,7 @@ var ts; return false; } function isInHeritageClause(node) { - return node.parent && node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */; + return node.parent && node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */; } // defined here to avoid outer scope pollution function getTypeReferenceDirectivesForEntityName(node) { @@ -88634,12 +89329,12 @@ var ts; // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries var meaning; - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } else { meaning = 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */; - if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { + if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } } @@ -88688,7 +89383,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 305 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 308 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -88716,12 +89411,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); // TODO: GH#18217 if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 305 /* SyntaxKind.SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 308 /* SyntaxKind.SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -88933,14 +89628,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) { - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (ts.hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -88959,26 +89654,26 @@ var ts; var modifier = _a[_i]; if (ts.isDecorator(modifier)) continue; - if (modifier.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.kind === 166 /* SyntaxKind.PropertySignature */ || node.kind === 168 /* SyntaxKind.MethodSignature */) { + if (modifier.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.kind === 168 /* SyntaxKind.PropertySignature */ || node.kind === 170 /* SyntaxKind.MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 176 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } - if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 144 /* SyntaxKind.OutKeyword */) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 145 /* SyntaxKind.OutKeyword */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 85 /* SyntaxKind.ConstKeyword */: - if (node.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(85 /* SyntaxKind.ConstKeyword */)); } break; - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "override"); @@ -88989,7 +89684,10 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor"); + } + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); } flags |= 16384 /* ModifierFlags.Override */; @@ -89008,16 +89706,19 @@ var ts; else if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor"); + } else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { if (modifier.kind === 121 /* SyntaxKind.PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } @@ -89037,16 +89738,19 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); + } + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -89055,11 +89759,26 @@ var ts; flags |= 32 /* ModifierFlags.Static */; lastStatic = modifier; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "accessor"); + } + else if (flags & 64 /* ModifierFlags.Readonly */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); + } + else if (flags & 2 /* ModifierFlags.Ambient */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); + } + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */) { + return grammarErrorOnNode(modifier, ts.Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); + } + flags |= 128 /* ModifierFlags.Accessor */; + break; + case 146 /* SyntaxKind.ReadonlyKeyword */: if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */ && node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 164 /* SyntaxKind.Parameter */) { + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */ && node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 166 /* SyntaxKind.Parameter */) { // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } @@ -89072,35 +89791,35 @@ var ts; else if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (ts.isClassLike(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* ModifierFlags.Export */; break; case 88 /* SyntaxKind.DefaultKeyword */: - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } else if (!(flags & 1 /* ModifierFlags.Export */)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); } - flags |= 512 /* ModifierFlags.Default */; + flags |= 1024 /* ModifierFlags.Default */; break; - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -89109,10 +89828,10 @@ var ts; else if (ts.isClassLike(node.parent) && !ts.isPropertyDeclaration(node)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } else if (ts.isPrivateIdentifierClassElementDeclaration(node)) { @@ -89122,18 +89841,18 @@ var ts; lastDeclare = modifier; break; case 126 /* SyntaxKind.AbstractKeyword */: - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - node.kind !== 180 /* SyntaxKind.ConstructorType */) { - if (node.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - node.kind !== 172 /* SyntaxKind.GetAccessor */ && - node.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (node.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + node.kind !== 182 /* SyntaxKind.ConstructorType */) { + if (node.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + node.kind !== 174 /* SyntaxKind.GetAccessor */ && + node.kind !== 175 /* SyntaxKind.SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */))) { + if (!(node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* ModifierFlags.Static */) { @@ -89142,39 +89861,42 @@ var ts; if (flags & 8 /* ModifierFlags.Private */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } - if (flags & 256 /* ModifierFlags.Async */ && lastAsync) { + if (flags & 512 /* ModifierFlags.Async */ && lastAsync) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); } + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); + } } if (ts.isNamedDeclaration(node) && node.name.kind === 80 /* SyntaxKind.PrivateIdentifier */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); } - flags |= 128 /* ModifierFlags.Abstract */; + flags |= 256 /* ModifierFlags.Abstract */; break; - case 131 /* SyntaxKind.AsyncKeyword */: - if (flags & 256 /* ModifierFlags.Async */) { + case 132 /* SyntaxKind.AsyncKeyword */: + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* ModifierFlags.Ambient */ || node.parent.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } - flags |= 256 /* ModifierFlags.Async */; + flags |= 512 /* ModifierFlags.Async */; lastAsync = modifier; break; case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: var inOutFlag = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? 32768 /* ModifierFlags.In */ : 65536 /* ModifierFlags.Out */; var inOutText = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? "in" : "out"; - if (node.kind !== 163 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { + if (node.kind !== 165 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); } if (flags & inOutFlag) { @@ -89187,28 +89909,28 @@ var ts; break; } } - if (node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 173 /* SyntaxKind.Constructor */) { if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(lastOverride, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override"); // TODO: GH#18217 } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return false; } - else if ((node.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { + else if ((node.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return checkGrammarAsyncModifier(node, lastAsync); } return false; @@ -89226,47 +89948,47 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 179 /* SyntaxKind.FunctionType */: - case 276 /* SyntaxKind.MissingDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 279 /* SyntaxKind.MissingDeclaration */: return true; default: - if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return false; } switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - return nodeHasAnyModifiersExcept(node, 131 /* SyntaxKind.AsyncKeyword */); - case 257 /* SyntaxKind.ClassDeclaration */: - case 180 /* SyntaxKind.ConstructorType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + return nodeHasAnyModifiersExcept(node, 132 /* SyntaxKind.AsyncKeyword */); + case 260 /* SyntaxKind.ClassDeclaration */: + case 182 /* SyntaxKind.ConstructorType */: return nodeHasAnyModifiersExcept(node, 126 /* SyntaxKind.AbstractKeyword */); - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 85 /* SyntaxKind.ConstKeyword */); default: ts.Debug.assertNever(node); @@ -89284,10 +90006,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); @@ -89516,20 +90238,20 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 221 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { + if (computedPropertyName.expression.kind === 223 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } return false; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.Debug.assert(node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */); if (node.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -89548,7 +90270,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (prop.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (inDestructuring) { // a rest property cannot be destructured any further var expression = ts.skipParentheses(prop.expression); @@ -89559,11 +90281,11 @@ var ts; continue; } var name = prop.name; - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern); @@ -89575,7 +90297,7 @@ var ts; if (ts.canHaveModifiers(prop) && prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (ts.isModifier(mod) && (mod.kind !== 131 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 169 /* SyntaxKind.MethodDeclaration */)) { + if (ts.isModifier(mod) && (mod.kind !== 132 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 171 /* SyntaxKind.MethodDeclaration */)) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -89596,8 +90318,8 @@ var ts; // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; switch (prop.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); @@ -89606,13 +90328,13 @@ var ts; } currentKind = 4 /* DeclarationMeaning.PropertyAssignment */; break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: currentKind = 8 /* DeclarationMeaning.Method */; break; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: currentKind = 1 /* DeclarationMeaning.GetAccessor */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: currentKind = 2 /* DeclarationMeaning.SetAccessor */; break; default: @@ -89655,7 +90377,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (attr.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { continue; } var name = attr.name, initializer = attr.initializer; @@ -89665,7 +90387,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 288 /* SyntaxKind.JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 291 /* SyntaxKind.JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -89700,7 +90422,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 244 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 247 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { if (!(forInOrOfStatement.flags & 32768 /* NodeFlags.AwaitContext */)) { var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement); if (ts.isInTopLevelContext(forInOrOfStatement)) { @@ -89734,7 +90456,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); var func = ts.getContainingFunction(forInOrOfStatement); - if (func && func.kind !== 171 /* SyntaxKind.Constructor */) { + if (func && func.kind !== 173 /* SyntaxKind.Constructor */) { ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* FunctionFlags.Async */) === 0, "Enclosing function should never be an async function."); var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); @@ -89751,7 +90473,7 @@ var ts; grammarErrorOnNode(forInOrOfStatement.initializer, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); return false; } - if (forInOrOfStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -89766,20 +90488,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -89789,22 +90511,22 @@ var ts; return false; } function checkGrammarAccessor(accessor) { - if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 182 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 184 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */)) { if (languageVersion < 1 /* ScriptTarget.ES5 */) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(accessor.name)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } - if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } if (accessor.body) { - if (ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); } - if (accessor.parent.kind === 182 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (accessor.parent.kind === 184 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return grammarErrorOnNode(accessor.body, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } } @@ -89812,11 +90534,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? + return grammarErrorOnNode(accessor.name, accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -89838,17 +90560,17 @@ var ts; * A set accessor has one parameter or a `this` parameter and one more parameter. */ function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { return ts.getThisParameter(accessor); } } function checkGrammarTypeOperatorNode(node) { - if (node.operator === 154 /* SyntaxKind.UniqueKeyword */) { - if (node.type.kind !== 151 /* SyntaxKind.SymbolKeyword */) { - return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + if (node.operator === 156 /* SyntaxKind.UniqueKeyword */) { + if (node.type.kind !== 153 /* SyntaxKind.SymbolKeyword */) { + return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } var parent = ts.walkUpParenthesizedTypes(node.parent); if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) { @@ -89858,7 +90580,7 @@ var ts; } } switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: var decl = parent; if (decl.name.kind !== 79 /* SyntaxKind.Identifier */) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -89870,13 +90592,13 @@ var ts; return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (!ts.isStatic(parent) || !ts.hasEffectiveReadonlyModifier(parent)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (!ts.hasSyntacticModifier(parent, 64 /* ModifierFlags.Readonly */)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); } @@ -89885,9 +90607,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here); } } - else if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.type.kind !== 183 /* SyntaxKind.ArrayType */ && node.type.kind !== 184 /* SyntaxKind.TupleType */) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + else if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.type.kind !== 185 /* SyntaxKind.ArrayType */ && node.type.kind !== 186 /* SyntaxKind.TupleType */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } } } @@ -89900,10 +90622,10 @@ var ts; if (checkGrammarFunctionLikeDeclaration(node)) { return true; } - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */) { - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */) { + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 131 /* SyntaxKind.AsyncKeyword */)) { + if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 132 /* SyntaxKind.AsyncKeyword */)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { @@ -89932,14 +90654,14 @@ var ts; if (node.flags & 16777216 /* NodeFlags.Ambient */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !node.body) { + else if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !node.body) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) { + else if (node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } @@ -89950,11 +90672,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: if (node.label && current.label.escapedText === node.label.escapedText) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 245 /* SyntaxKind.ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 248 /* SyntaxKind.ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -89962,8 +90684,8 @@ var ts; return false; } break; - case 249 /* SyntaxKind.SwitchStatement */: - if (node.kind === 246 /* SyntaxKind.BreakStatement */ && !node.label) { + case 252 /* SyntaxKind.SwitchStatement */: + if (node.kind === 249 /* SyntaxKind.BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -89978,13 +90700,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -90008,12 +90730,12 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return ts.isStringOrNumericLiteralLike(expr) || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; } function isBigIntLiteralExpression(expr) { return expr.kind === 9 /* SyntaxKind.BigIntLiteral */ || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 9 /* SyntaxKind.BigIntLiteral */; } function isSimpleLiteralEnumReference(expr) { @@ -90041,7 +90763,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 247 /* SyntaxKind.ForOfStatement */) { if (node.flags & 16777216 /* NodeFlags.Ambient */) { checkAmbientInitializer(node); } @@ -90054,7 +90776,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 237 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { + if (node.exclamationToken && (node.parent.parent.kind !== 240 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { var message = node.initializer ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type @@ -90121,15 +90843,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return false; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -90223,8 +90945,14 @@ var ts; if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(node.name)) { return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } + if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isAutoAccessorPropertyDeclaration(node)) { + return grammarErrorOnNode(node.name, ts.Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (ts.isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_accessor_property_cannot_be_declared_optional)) { + return true; + } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } @@ -90270,14 +90998,14 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */)) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); @@ -90285,7 +91013,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 237 /* SyntaxKind.VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 240 /* SyntaxKind.VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -90308,7 +91036,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 235 /* SyntaxKind.Block */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 238 /* SyntaxKind.Block */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { var links_2 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_2.hasReportedStatementInAmbientContext) { @@ -90330,10 +91058,10 @@ var ts; if (languageVersion >= 1 /* ScriptTarget.ES5 */) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 196 /* SyntaxKind.LiteralType */)) { + else if (ts.isChildOfNodeWithKind(node, 198 /* SyntaxKind.LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 299 /* SyntaxKind.EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 302 /* SyntaxKind.EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -90405,7 +91133,7 @@ var ts; if (node.isTypeOnly && node.name && node.namedBindings) { return grammarErrorOnNode(node, ts.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both); } - if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 269 /* SyntaxKind.NamedImports */) { + if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 272 /* SyntaxKind.NamedImports */) { return checkGrammarNamedImportsOrExports(node.namedBindings); } return false; @@ -90413,7 +91141,7 @@ var ts; function checkGrammarNamedImportsOrExports(namedBindings) { return !!ts.forEach(namedBindings.elements, function (specifier) { if (specifier.isTypeOnly) { - return grammarErrorOnFirstToken(specifier, specifier.kind === 270 /* SyntaxKind.ImportSpecifier */ + return grammarErrorOnFirstToken(specifier, specifier.kind === 273 /* SyntaxKind.ImportSpecifier */ ? ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement); } @@ -90536,14 +91264,14 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 169 /* SyntaxKind.MethodDeclaration */) || + return (declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 171 /* SyntaxKind.MethodDeclaration */) || !!declaration.body; } /** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */ function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -90579,6 +91307,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var _a; function visitNode(node, visitor, test, lift) { if (node === undefined || visitor === undefined) { return node; @@ -90645,7 +91374,6 @@ var ts; return nodes; } ts.visitNodes = visitNodes; - /* @internal */ function visitArray(nodes, visitor, test, start, count) { if (nodes === undefined) { return nodes; @@ -90793,12 +91521,10 @@ var ts; return updated; } ts.visitFunctionBody = visitFunctionBody; - /** - * Visits an iteration body, adding any block-scoped variables required by the transformation. - */ - function visitIterationBody(body, visitor, context) { + function visitIterationBody(body, visitor, context, nodeVisitor) { + if (nodeVisitor === void 0) { nodeVisitor = visitNode; } context.startBlockScope(); - var updated = visitNode(body, visitor, ts.isStatement, context.factory.liftToBlock); + var updated = nodeVisitor(body, visitor, ts.isStatement, context.factory.liftToBlock); var declarations = context.endBlockScope(); if (ts.some(declarations)) { if (ts.isBlock(updated)) { @@ -90817,456 +91543,446 @@ var ts; if (node === undefined) { return undefined; } - var kind = node.kind; - // No need to visit nodes with no children. - if ((kind > 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */) || kind === 192 /* SyntaxKind.ThisType */) { - return node; - } - var factory = context.factory; - switch (kind) { - // Names - case 79 /* SyntaxKind.Identifier */: - ts.Debug.type(node); - return factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); - case 161 /* SyntaxKind.QualifiedName */: - ts.Debug.type(node); - return factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); - case 162 /* SyntaxKind.ComputedPropertyName */: - ts.Debug.type(node); - return factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Signature elements - case 163 /* SyntaxKind.TypeParameter */: - ts.Debug.type(node); - return factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); - case 164 /* SyntaxKind.Parameter */: - ts.Debug.type(node); - return factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 165 /* SyntaxKind.Decorator */: - ts.Debug.type(node); - return factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Type elements - case 166 /* SyntaxKind.PropertySignature */: - ts.Debug.type(node); - return factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 167 /* SyntaxKind.PropertyDeclaration */: - ts.Debug.type(node); - return factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), - // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too - nodeVisitor(node.questionToken || node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 168 /* SyntaxKind.MethodSignature */: - ts.Debug.type(node); - return factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 169 /* SyntaxKind.MethodDeclaration */: - ts.Debug.type(node); - return factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 171 /* SyntaxKind.Constructor */: - ts.Debug.type(node); - return factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 172 /* SyntaxKind.GetAccessor */: - ts.Debug.type(node); - return factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 173 /* SyntaxKind.SetAccessor */: - ts.Debug.type(node); - return factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - ts.Debug.type(node); - context.startLexicalEnvironment(); - context.suspendLexicalEnvironment(); - return factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 174 /* SyntaxKind.CallSignature */: - ts.Debug.type(node); - return factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 175 /* SyntaxKind.ConstructSignature */: - ts.Debug.type(node); - return factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 176 /* SyntaxKind.IndexSignature */: - ts.Debug.type(node); - return factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - // Types - case 177 /* SyntaxKind.TypePredicate */: - ts.Debug.type(node); - return factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 178 /* SyntaxKind.TypeReference */: - ts.Debug.type(node); - return factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 179 /* SyntaxKind.FunctionType */: - ts.Debug.type(node); - return factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 180 /* SyntaxKind.ConstructorType */: - ts.Debug.type(node); - return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 181 /* SyntaxKind.TypeQuery */: - ts.Debug.type(node); - return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 182 /* SyntaxKind.TypeLiteral */: - ts.Debug.type(node); - return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 183 /* SyntaxKind.ArrayType */: - ts.Debug.type(node); - return factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); - case 184 /* SyntaxKind.TupleType */: - ts.Debug.type(node); - return factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); - case 185 /* SyntaxKind.OptionalType */: - ts.Debug.type(node); - return factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 186 /* SyntaxKind.RestType */: - ts.Debug.type(node); - return factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 187 /* SyntaxKind.UnionType */: - ts.Debug.type(node); - return factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 188 /* SyntaxKind.IntersectionType */: - ts.Debug.type(node); - return factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 189 /* SyntaxKind.ConditionalType */: - ts.Debug.type(node); - return factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); - case 190 /* SyntaxKind.InferType */: - ts.Debug.type(node); - return factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); - case 200 /* SyntaxKind.ImportType */: - ts.Debug.type(node); - return factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isNode), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - ts.Debug.type(node); - return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine); - case 197 /* SyntaxKind.NamedTupleMember */: - ts.Debug.type(node); - return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 191 /* SyntaxKind.ParenthesizedType */: - ts.Debug.type(node); - return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 193 /* SyntaxKind.TypeOperator */: - ts.Debug.type(node); - return factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 194 /* SyntaxKind.IndexedAccessType */: - ts.Debug.type(node); - return factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); - case 195 /* SyntaxKind.MappedType */: - ts.Debug.type(node); - return factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 196 /* SyntaxKind.LiteralType */: - ts.Debug.type(node); - return factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); - case 198 /* SyntaxKind.TemplateLiteralType */: - ts.Debug.type(node); - return factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - ts.Debug.type(node); - return factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: - ts.Debug.type(node); - return factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); - case 202 /* SyntaxKind.ArrayBindingPattern */: - ts.Debug.type(node); - return factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); - case 203 /* SyntaxKind.BindingElement */: - ts.Debug.type(node); - return factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Expression - case 204 /* SyntaxKind.ArrayLiteralExpression */: - ts.Debug.type(node); - return factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - ts.Debug.type(node); - return factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 206 /* SyntaxKind.PropertyAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)); - } - ts.Debug.type(node); - return factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); - case 207 /* SyntaxKind.ElementAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - case 208 /* SyntaxKind.CallExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 209 /* SyntaxKind.NewExpression */: - ts.Debug.type(node); - return factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - ts.Debug.type(node); - return factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); - case 211 /* SyntaxKind.TypeAssertionExpression */: - ts.Debug.type(node); - return factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 212 /* SyntaxKind.ParenthesizedExpression */: - ts.Debug.type(node); - return factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 213 /* SyntaxKind.FunctionExpression */: - ts.Debug.type(node); - return factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 214 /* SyntaxKind.ArrowFunction */: - ts.Debug.type(node); - return factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 215 /* SyntaxKind.DeleteExpression */: - ts.Debug.type(node); - return factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 216 /* SyntaxKind.TypeOfExpression */: - ts.Debug.type(node); - return factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 217 /* SyntaxKind.VoidExpression */: - ts.Debug.type(node); - return factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 218 /* SyntaxKind.AwaitExpression */: - ts.Debug.type(node); - return factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 221 /* SyntaxKind.BinaryExpression */: - ts.Debug.type(node); - return factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); - case 222 /* SyntaxKind.ConditionalExpression */: - ts.Debug.type(node); - return factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); - case 223 /* SyntaxKind.TemplateExpression */: - ts.Debug.type(node); - return factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); - case 224 /* SyntaxKind.YieldExpression */: - ts.Debug.type(node); - return factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 225 /* SyntaxKind.SpreadElement */: - ts.Debug.type(node); - return factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 226 /* SyntaxKind.ClassExpression */: - ts.Debug.type(node); - return factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - ts.Debug.type(node); - return factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 229 /* SyntaxKind.AsExpression */: - ts.Debug.type(node); - return factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 230 /* SyntaxKind.NonNullExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 231 /* SyntaxKind.MetaProperty */: - ts.Debug.type(node); - return factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Misc - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.type(node); - return factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Element - case 235 /* SyntaxKind.Block */: - ts.Debug.type(node); - return factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 237 /* SyntaxKind.VariableStatement */: - ts.Debug.type(node); - return factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 238 /* SyntaxKind.ExpressionStatement */: - ts.Debug.type(node); - return factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 239 /* SyntaxKind.IfStatement */: - ts.Debug.type(node); - return factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, factory.liftToBlock)); - case 240 /* SyntaxKind.DoStatement */: - ts.Debug.type(node); - return factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 241 /* SyntaxKind.WhileStatement */: - ts.Debug.type(node); - return factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 242 /* SyntaxKind.ForStatement */: - ts.Debug.type(node); - return factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 243 /* SyntaxKind.ForInStatement */: - ts.Debug.type(node); - return factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 244 /* SyntaxKind.ForOfStatement */: - ts.Debug.type(node); - return factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 245 /* SyntaxKind.ContinueStatement */: - ts.Debug.type(node); - return factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 246 /* SyntaxKind.BreakStatement */: - ts.Debug.type(node); - return factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 247 /* SyntaxKind.ReturnStatement */: - ts.Debug.type(node); - return factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 248 /* SyntaxKind.WithStatement */: - ts.Debug.type(node); - return factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 249 /* SyntaxKind.SwitchStatement */: - ts.Debug.type(node); - return factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); - case 250 /* SyntaxKind.LabeledStatement */: - ts.Debug.type(node); - return factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 251 /* SyntaxKind.ThrowStatement */: - ts.Debug.type(node); - return factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 252 /* SyntaxKind.TryStatement */: - ts.Debug.type(node); - return factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); - case 254 /* SyntaxKind.VariableDeclaration */: - ts.Debug.type(node); - return factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 255 /* SyntaxKind.VariableDeclarationList */: - ts.Debug.type(node); - return factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); - case 256 /* SyntaxKind.FunctionDeclaration */: - ts.Debug.type(node); - return factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 257 /* SyntaxKind.ClassDeclaration */: - ts.Debug.type(node); - return factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 258 /* SyntaxKind.InterfaceDeclaration */: - ts.Debug.type(node); - return factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - ts.Debug.type(node); - return factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 260 /* SyntaxKind.EnumDeclaration */: - ts.Debug.type(node); - return factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); - case 261 /* SyntaxKind.ModuleDeclaration */: - ts.Debug.type(node); - return factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); - case 262 /* SyntaxKind.ModuleBlock */: - ts.Debug.type(node); - return factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 263 /* SyntaxKind.CaseBlock */: - ts.Debug.type(node); - return factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - ts.Debug.type(node); - return factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - ts.Debug.type(node); - return factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); - case 266 /* SyntaxKind.ImportDeclaration */: - ts.Debug.type(node); - return factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 293 /* SyntaxKind.AssertClause */: - ts.Debug.type(node); - return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); - case 294 /* SyntaxKind.AssertEntry */: - ts.Debug.type(node); - return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode)); - case 267 /* SyntaxKind.ImportClause */: - ts.Debug.type(node); - return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); - case 268 /* SyntaxKind.NamespaceImport */: - ts.Debug.type(node); - return factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 274 /* SyntaxKind.NamespaceExport */: - ts.Debug.type(node); - return factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 269 /* SyntaxKind.NamedImports */: - ts.Debug.type(node); - return factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); - case 270 /* SyntaxKind.ImportSpecifier */: - ts.Debug.type(node); - return factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 271 /* SyntaxKind.ExportAssignment */: - ts.Debug.type(node); - return factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 272 /* SyntaxKind.ExportDeclaration */: - ts.Debug.type(node); - return factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 273 /* SyntaxKind.NamedExports */: - ts.Debug.type(node); - return factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); - case 275 /* SyntaxKind.ExportSpecifier */: - ts.Debug.type(node); - return factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: - ts.Debug.type(node); - return factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // JSX - case 278 /* SyntaxKind.JsxElement */: - ts.Debug.type(node); - return factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - ts.Debug.type(node); - return factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 280 /* SyntaxKind.JsxOpeningElement */: - ts.Debug.type(node); - return factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 281 /* SyntaxKind.JsxClosingElement */: - ts.Debug.type(node); - return factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 282 /* SyntaxKind.JsxFragment */: - ts.Debug.type(node); - return factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 285 /* SyntaxKind.JsxAttribute */: - ts.Debug.type(node); - return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 286 /* SyntaxKind.JsxAttributes */: - ts.Debug.type(node); - return factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - ts.Debug.type(node); - return factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 288 /* SyntaxKind.JsxExpression */: - ts.Debug.type(node); - return factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Clauses - case 289 /* SyntaxKind.CaseClause */: - ts.Debug.type(node); - return factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 290 /* SyntaxKind.DefaultClause */: - ts.Debug.type(node); - return factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 291 /* SyntaxKind.HeritageClause */: - ts.Debug.type(node); - return factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 292 /* SyntaxKind.CatchClause */: - ts.Debug.type(node); - return factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); - // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: - ts.Debug.type(node); - return factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - ts.Debug.type(node); - return factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 298 /* SyntaxKind.SpreadAssignment */: - ts.Debug.type(node); - return factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Enum - case 299 /* SyntaxKind.EnumMember */: - ts.Debug.type(node); - return factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: - ts.Debug.type(node); - return factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context)); - // Transformation nodes - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - ts.Debug.type(node); - return factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 351 /* SyntaxKind.CommaListExpression */: - ts.Debug.type(node); - return factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - default: - // No need to visit nodes with no children. - return node; - } + var fn = visitEachChildTable[node.kind]; + return fn === undefined ? node : fn(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor); } ts.visitEachChild = visitEachChild; + // NOTE: Before you can add a new method to `visitEachChildTable`, you must first ensure the `Node` subtype you + // wish to add is defined in the `HasChildren` union in types.ts. + var visitEachChildTable = (_a = {}, + _a[79 /* SyntaxKind.Identifier */] = function visitEachChildOfIdentifier(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); + }, + _a[163 /* SyntaxKind.QualifiedName */] = function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Signature elements + _a[165 /* SyntaxKind.TypeParameter */] = function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); + }, + _a[166 /* SyntaxKind.Parameter */] = function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[167 /* SyntaxKind.Decorator */] = function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Type elements + _a[168 /* SyntaxKind.PropertySignature */] = function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + var _a; + return context.factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), + // QuestionToken and ExclamationToken are mutually exclusive in PropertyDeclaration + nodeVisitor((_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[171 /* SyntaxKind.MethodDeclaration */] = function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[173 /* SyntaxKind.Constructor */] = function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + context.startLexicalEnvironment(); + context.suspendLexicalEnvironment(); + return context.factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[176 /* SyntaxKind.CallSignature */] = function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[177 /* SyntaxKind.ConstructSignature */] = function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + // Types + _a[179 /* SyntaxKind.TypePredicate */] = function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[180 /* SyntaxKind.TypeReference */] = function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[181 /* SyntaxKind.FunctionType */] = function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[185 /* SyntaxKind.ArrayType */] = function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); + }, + _a[186 /* SyntaxKind.TupleType */] = function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); + }, + _a[187 /* SyntaxKind.OptionalType */] = function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[188 /* SyntaxKind.RestType */] = function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[189 /* SyntaxKind.UnionType */] = function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[190 /* SyntaxKind.IntersectionType */] = function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[191 /* SyntaxKind.ConditionalType */] = function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); + }, + _a[192 /* SyntaxKind.InferType */] = function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + }, + _a[202 /* SyntaxKind.ImportType */] = function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isImportTypeAssertionContainer), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isAssertClause), node.multiLine); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[195 /* SyntaxKind.TypeOperator */] = function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[196 /* SyntaxKind.IndexedAccessType */] = function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); + }, + _a[197 /* SyntaxKind.MappedType */] = function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[198 /* SyntaxKind.LiteralType */] = function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Binding patterns + _a[203 /* SyntaxKind.ObjectBindingPattern */] = function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); + }, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + }, + _a[205 /* SyntaxKind.BindingElement */] = function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Expression + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isPropertyAccessChain(node) ? + context.factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)) : + context.factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isElementAccessChain(node) ? + context.factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)) : + context.factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); + }, + _a[210 /* SyntaxKind.CallExpression */] = function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isCallChain(node) ? + context.factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)) : + context.factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[211 /* SyntaxKind.NewExpression */] = function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[228 /* SyntaxKind.ClassExpression */] = function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[231 /* SyntaxKind.AsExpression */] = function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSatisfiesExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return ts.isOptionalChain(node) ? + context.factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)) : + context.factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Misc + _a[236 /* SyntaxKind.TemplateSpan */] = function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Element + _a[238 /* SyntaxKind.Block */] = function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[242 /* SyntaxKind.IfStatement */] = function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, context.factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[243 /* SyntaxKind.DoStatement */] = function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context, nodeVisitor), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[245 /* SyntaxKind.ForStatement */] = function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[249 /* SyntaxKind.BreakStatement */] = function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[250 /* SyntaxKind.ReturnStatement */] = function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[251 /* SyntaxKind.WithStatement */] = function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[255 /* SyntaxKind.TryStatement */] = function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); + }, + _a[265 /* SyntaxKind.ModuleBlock */] = function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[296 /* SyntaxKind.AssertClause */] = function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpression)); + }, + _a[270 /* SyntaxKind.ImportClause */] = function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[272 /* SyntaxKind.NamedImports */] = function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[274 /* SyntaxKind.ExportAssignment */] = function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[275 /* SyntaxKind.ExportDeclaration */] = function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[276 /* SyntaxKind.NamedExports */] = function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + }, + _a[278 /* SyntaxKind.ExportSpecifier */] = function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Module references + _a[280 /* SyntaxKind.ExternalModuleReference */] = function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // JSX + _a[281 /* SyntaxKind.JsxElement */] = function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[283 /* SyntaxKind.JsxOpeningElement */] = function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + }, + _a[289 /* SyntaxKind.JsxAttributes */] = function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Clauses + _a[292 /* SyntaxKind.CaseClause */] = function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + }, + _a[295 /* SyntaxKind.CatchClause */] = function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); + }, + // Property assignments + _a[299 /* SyntaxKind.PropertyAssignment */] = function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Enum + _a[302 /* SyntaxKind.EnumMember */] = function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Top-level nodes + _a[308 /* SyntaxKind.SourceFile */] = function visitEachChildOfSourceFile(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context, /*start*/ undefined, /*ensureUseStrict*/ undefined, nodesVisitor)); + }, + // Transformation nodes + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a); /** * Extracts the single node from a NodeArray. * @@ -91334,7 +92050,7 @@ var ts; exit(); return sourceIndex; } - /* eslint-disable boolean-trivia, no-null/no-null */ + /* eslint-disable local/boolean-trivia, no-null/no-null */ function setSourceContent(sourceIndex, content) { enter(); if (content !== null) { @@ -91347,7 +92063,7 @@ var ts; } exit(); } - /* eslint-enable boolean-trivia, no-null/no-null */ + /* eslint-enable local/boolean-trivia, no-null/no-null */ function addName(name) { enter(); if (!nameToNameIndexMap) @@ -91949,7 +92665,7 @@ var ts; function chainBundle(context, transformSourceFile) { return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -92000,7 +92716,7 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" @@ -92013,13 +92729,13 @@ var ts; hasImportDefault = true; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - if (node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + if (node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -92050,13 +92766,13 @@ var ts; addExportedNamesForExportDeclaration(node); } break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { for (var _b = 0, _c = node.declarationList.declarations; _b < _c.length; _b++) { var decl = _c[_b]; @@ -92064,9 +92780,9 @@ var ts; } } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default function() { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -92084,9 +92800,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default class { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -92264,7 +92980,7 @@ var ts; * @param isStatic A value indicating whether the member should be a static or instance member. */ function isInitializedProperty(member) { - return member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + return member.kind === 169 /* SyntaxKind.PropertyDeclaration */ && member.initializer !== undefined; } ts.isInitializedProperty = isInitializedProperty; @@ -92274,7 +92990,7 @@ var ts; * @param member The class element node. */ function isNonStaticMethodOrAccessorWithPrivateName(member) { - return !ts.isStatic(member) && ts.isMethodOrAccessor(member) && ts.isPrivateIdentifier(member.name); + return !ts.isStatic(member) && (ts.isMethodOrAccessor(member) || ts.isAutoAccessorPropertyDeclaration(member)) && ts.isPrivateIdentifier(member.name); } ts.isNonStaticMethodOrAccessorWithPrivateName = isNonStaticMethodOrAccessorWithPrivateName; /** @@ -92328,12 +93044,12 @@ var ts; */ function getAllDecoratorsOfClassElement(member, parent) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return getAllDecoratorsOfAccessors(member, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -92994,8 +93710,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -93015,14 +93731,14 @@ var ts; var applicableSubstitutions; return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { return transformBundle(node); } return transformSourceFile(node); } function transformBundle(node) { return factory.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { return ts.createUnparsedSourceFile(prepend, "js"); } return prepend; @@ -93071,15 +93787,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 262 /* SyntaxKind.ModuleBlock */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 265 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: currentLexicalScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */)) { break; } @@ -93091,7 +93807,7 @@ var ts; // These nodes should always have names unless they are default-exports; // however, class declaration parsing allows for undefined names, so syntactically invalid // programs may also have an undefined name. - ts.Debug.assert(node.kind === 257 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)); + ts.Debug.assert(node.kind === 260 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)); } break; } @@ -93130,10 +93846,10 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitElidableStatement(node); default: return visitorWorker(node); @@ -93154,13 +93870,13 @@ var ts; return node; } switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -93180,11 +93896,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ || - (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && - node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */)) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ || + (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && + node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -93208,27 +93924,27 @@ var ts; */ function classElementVisitorWorker(node, parent) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructor(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Property declarations are not TypeScript syntax, but they must be visited // for the decorator transformation. return visitPropertyDeclaration(node, parent); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.visitEachChild(node, visitor, context); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return node; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Index signatures are elided return; default: @@ -93240,17 +93956,17 @@ var ts; } function objectLiteralElementVisitorWorker(node, parent) { switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return visitor(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); @@ -93261,7 +93977,7 @@ var ts; function modifierVisitor(node) { if (ts.isDecorator(node)) return undefined; - if (ts.modifierToFlag(node.kind) & 116958 /* ModifierFlags.TypeScriptModifier */) { + if (ts.modifierToFlag(node.kind) & 117086 /* ModifierFlags.TypeScriptModifier */) { return undefined; } else if (currentNamespace && node.kind === 93 /* SyntaxKind.ExportKeyword */) { @@ -93289,58 +94005,58 @@ var ts; case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: // TypeScript accessibility and readonly modifiers are elided // falls through - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 177 /* SyntaxKind.TypePredicate */: - case 163 /* SyntaxKind.TypeParameter */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 179 /* SyntaxKind.TypePredicate */: + case 165 /* SyntaxKind.TypeParameter */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 181 /* SyntaxKind.TypeQuery */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 189 /* SyntaxKind.ConditionalType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 192 /* SyntaxKind.ThisType */: - case 193 /* SyntaxKind.TypeOperator */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 196 /* SyntaxKind.LiteralType */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 183 /* SyntaxKind.TypeQuery */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 191 /* SyntaxKind.ConditionalType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 194 /* SyntaxKind.ThisType */: + case 195 /* SyntaxKind.TypeOperator */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 198 /* SyntaxKind.LiteralType */: // TypeScript type nodes are elided. // falls through - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // TypeScript index signatures are elided. return undefined; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // TypeScript type-only declarations are elided. return factory.createNotEmittedStatement(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // TypeScript namespace export declarations are elided. return undefined; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return factory.createNotEmittedStatement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // This may be a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93350,7 +94066,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // This may be a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93360,34 +94076,34 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: // This may be a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.Debug.fail("Class and object literal elements must be visited with their respective visitors"); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // This may be a parameter declaration with TypeScript syntax extensions. // // TypeScript parameter declaration syntax extensions include: @@ -93397,40 +94113,42 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return visitSatisfiesExpression(node); + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return visitJsxJsxOpeningElement(node); default: // node contains some other TypeScript syntax @@ -93700,10 +94418,10 @@ var ts; */ function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */; + return kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */; } /** * Determines whether to emit the "design:returntype" metadata based on the node's kind. @@ -93713,7 +94431,7 @@ var ts; * @param node The node to test. */ function shouldAddReturnTypeMetadata(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } /** * Determines whether to emit the "design:paramtypes" metadata based on the node's kind. @@ -93724,12 +94442,12 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; } return false; @@ -93819,7 +94537,7 @@ var ts; return !ts.nodeIsMissing(node.body); } function visitPropertyDeclaration(node, parent) { - var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); if (isAmbient && !ts.hasDecorators(node)) { return undefined; } @@ -93927,7 +94645,7 @@ var ts; * @param node The declaration node. */ function shouldEmitAccessorDeclaration(node) { - return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)); + return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)); } function visitGetAccessor(node, parent) { if (!(node.transformFlags & 1 /* TransformFlags.ContainsTypeScript */)) { @@ -94069,6 +94787,10 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); return factory.createPartiallyEmittedExpression(expression, node); } + function visitSatisfiesExpression(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } function visitCallExpression(node) { return factory.updateCallExpression(node, ts.visitNode(node.expression, visitor, ts.isExpression), /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); @@ -94282,12 +95004,12 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = factory.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), factory.createVariableDeclarationList([ factory.createVariableDeclaration(factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentLexicalScope.kind === 305 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); + ], currentLexicalScope.kind === 308 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind === 263 /* SyntaxKind.EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -94412,7 +95134,7 @@ var ts; var statementsLocation; var blockLocation; if (node.body) { - if (node.body.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (node.body.kind === 265 /* SyntaxKind.ModuleBlock */) { saveStateAndInvoke(node.body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = node.body.statements; blockLocation = node.body; @@ -94459,13 +95181,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (!node.body || node.body.kind !== 262 /* SyntaxKind.ModuleBlock */) { + if (!node.body || node.body.kind !== 265 /* SyntaxKind.ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* EmitFlags.NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -94512,7 +95234,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (node.kind === 271 /* SyntaxKind.NamespaceImport */) { // Elide a namespace import if it is not referenced. return shouldEmitAliasDeclaration(node) ? node : undefined; } @@ -94670,7 +95392,7 @@ var ts; */ function isNamedExternalModuleExport(node) { return isExternalModuleExport(node) - && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } /** * Gets a value indicating whether the node is the default export of an external module. @@ -94679,7 +95401,7 @@ var ts; */ function isDefaultExternalModuleExport(node) { return isExternalModuleExport(node) - && ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } function addExportMemberAssignment(statements, node) { var expression = factory.createAssignment(factory.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), factory.getLocalName(node)); @@ -94724,16 +95446,16 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(79 /* SyntaxKind.Identifier */); - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(261 /* SyntaxKind.ModuleDeclaration */); + context.enableEmitNotification(264 /* SyntaxKind.ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 261 /* SyntaxKind.ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 260 /* SyntaxKind.EnumDeclaration */; + return ts.getOriginalNode(node).kind === 263 /* SyntaxKind.EnumDeclaration */; } /** * Hook for node emit. @@ -94794,9 +95516,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -94811,9 +95533,9 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 305 /* SyntaxKind.SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 261 /* SyntaxKind.ModuleDeclaration */) || - (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 260 /* SyntaxKind.EnumDeclaration */); + if (container && container.kind !== 308 /* SyntaxKind.SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 264 /* SyntaxKind.ModuleDeclaration */) || + (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 263 /* SyntaxKind.EnumDeclaration */); if (substitute) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(container), node), /*location*/ node); @@ -94852,9 +95574,10 @@ var ts; return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined; } function shouldEmitAliasDeclaration(node) { - return compilerOptions.preserveValueImports - ? resolver.isValueAliasDeclaration(node) - : resolver.isReferencedAliasDeclaration(node); + return ts.isInJSFile(node) || + (compilerOptions.preserveValueImports + ? resolver.isValueAliasDeclaration(node) + : resolver.isReferencedAliasDeclaration(node)); } } ts.transformTypeScript = transformTypeScript; @@ -94902,13 +95625,24 @@ var ts; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions); + // Always transform field initializers using Set semantics when `useDefineForClassFields: false`. + var shouldTransformInitializersUsingSet = !useDefineForClassFields; + // Transform field initializers using Define semantics when `useDefineForClassFields: true` and target < ES2022. + var shouldTransformInitializersUsingDefine = useDefineForClassFields && languageVersion < 9 /* ScriptTarget.ES2022 */; + var shouldTransformInitializers = shouldTransformInitializersUsingSet || shouldTransformInitializersUsingDefine; + // We need to transform private members and class static blocks when target < ES2022. var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* ScriptTarget.ES2022 */; + // We need to transform `accessor` fields when target < ESNext + var shouldTransformAutoAccessors = languageVersion < 99 /* ScriptTarget.ESNext */; // We need to transform `this` in a static initializer into a reference to the class - // when targeting < ES2022 since the assignment will be moved outside of the class body. + // when target < ES2022 since the assignment will be moved outside of the class body. var shouldTransformThisInStaticInitializers = languageVersion < 9 /* ScriptTarget.ES2022 */; - // We don't need to transform `super` property access when targeting ES5, ES3 because + // We don't need to transform `super` property access when target <= ES5 because // the es2015 transformation handles those. var shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2 /* ScriptTarget.ES2015 */; + var shouldTransformAnything = shouldTransformInitializers || + shouldTransformPrivateElementsOrClassStaticBlocks || + shouldTransformAutoAccessors; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -94928,98 +95662,149 @@ var ts; var classLexicalEnvironmentStack = []; var classLexicalEnvironmentMap = new ts.Map(); var currentClassLexicalEnvironment; + var currentClassContainer; var currentComputedPropertyNameClassLexicalEnvironment; var currentStaticPropertyDeclarationOrStaticBlock; return ts.chainBundle(context, transformSourceFile); function transformSourceFile(node) { - var options = context.getCompilerOptions(); - if (node.isDeclarationFile - || useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9 /* ScriptTarget.ES2022 */) { + if (node.isDeclarationFile || !shouldTransformAnything) { return node; } var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); return visited; } - function visitorWorker(node, valueIsDiscarded) { - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) { - switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - return visitClassLike(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: - return visitVariableStatement(node); - case 80 /* SyntaxKind.PrivateIdentifier */: - return visitPrivateIdentifier(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitClassStaticBlockDeclaration(node); - } + function visitor(node) { + if (!(node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) && + !(node.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */)) { + return node; } - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */ || - node.transformFlags & 134217728 /* TransformFlags.ContainsLexicalSuper */ && - shouldTransformSuperInStaticInitializers && - currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: - return visitBinaryExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: - return visitCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitElementAccessExpression(node); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitExpressionStatement(node); - case 242 /* SyntaxKind.ForStatement */: - return visitForStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = undefined; - var result = ts.visitEachChild(node, visitor, context); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; - return result; - } + switch (node.kind) { + case 127 /* SyntaxKind.AccessorKeyword */: + return shouldTransformAutoAccessors ? undefined : node; + case 260 /* SyntaxKind.ClassDeclaration */: + return visitClassDeclaration(node); + case 228 /* SyntaxKind.ClassExpression */: + return visitClassExpression(node); + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + return visitClassStaticBlockDeclaration(node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return visitPropertyDeclaration(node); + case 240 /* SyntaxKind.VariableStatement */: + return visitVariableStatement(node); + case 80 /* SyntaxKind.PrivateIdentifier */: + return visitPrivateIdentifier(node); + case 208 /* SyntaxKind.PropertyAccessExpression */: + return visitPropertyAccessExpression(node); + case 209 /* SyntaxKind.ElementAccessExpression */: + return visitElementAccessExpression(node); + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ false); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ false); + case 210 /* SyntaxKind.CallExpression */: + return visitCallExpression(node); + case 241 /* SyntaxKind.ExpressionStatement */: + return visitExpressionStatement(node); + case 212 /* SyntaxKind.TaggedTemplateExpression */: + return visitTaggedTemplateExpression(node); + case 245 /* SyntaxKind.ForStatement */: + return visitForStatement(node); + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + // If we are descending into a new scope, clear the current static property or block + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, fallbackVisitor, node); } + default: + return fallbackVisitor(node); } + } + function fallbackVisitor(node) { return ts.visitEachChild(node, visitor, context); } + /** + * Visits a node in an expression whose result is discarded. + */ function discardedValueVisitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ true); - } - function visitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ false); + switch (node.kind) { + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ true); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ true); + default: + return visitor(node); + } } + /** + * Visits a node in a {@link HeritageClause}. + */ function heritageClauseVisitor(node) { switch (node.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return ts.visitEachChild(node, heritageClauseVisitor, context); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitExpressionWithTypeArguments(node); + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + return visitExpressionWithTypeArgumentsInHeritageClause(node); + default: + return visitor(node); } - return visitor(node); } - function visitorDestructuringTarget(node) { + /** + * Visits the assignment target of a destructuring assignment. + */ + function assignmentTargetVisitor(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitAssignmentPattern(node); default: return visitor(node); } } + /** + * Visits a member of a class. + */ + function classElementVisitor(node) { + switch (node.kind) { + case 173 /* SyntaxKind.Constructor */: + return visitConstructorDeclaration(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitMethodOrAccessorDeclaration, node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitPropertyDeclaration, node); + case 164 /* SyntaxKind.ComputedPropertyName */: + return visitComputedPropertyName(node); + case 237 /* SyntaxKind.SemicolonClassElement */: + return node; + default: + return visitor(node); + } + } + /** + * Visits the results of an auto-accessor field transformation in a second pass. + */ + function accessorFieldResultVisitor(node) { + switch (node.kind) { + case 169 /* SyntaxKind.PropertyDeclaration */: + return transformFieldInitializer(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return classElementVisitor(node); + default: + ts.Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); + break; + } + } /** * If we visit a private name, this means it is an undeclared private name. * Replace it with an empty identifier to indicate a problem with the code, @@ -95035,17 +95820,15 @@ var ts; } return ts.setOriginalNode(factory.createIdentifier(""), node); } + function isPrivateIdentifierInExpression(node) { + return ts.isPrivateIdentifier(node.left) + && node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; + } /** * Visits `#id in expr` */ - function visitPrivateIdentifierInInExpression(node) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return node; - } - var privId = node.left; - ts.Debug.assertNode(privId, ts.isPrivateIdentifier); - ts.Debug.assert(node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */); - var info = accessPrivateIdentifier(privId); + function transformPrivateIdentifierInInExpression(node) { + var info = accessPrivateIdentifier(node.left); if (info) { var receiver = ts.visitNode(node.right, visitor, ts.isExpression); return ts.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node); @@ -95053,31 +95836,6 @@ var ts; // Private name has not been declared. Subsequent transformers will handle this error return ts.visitEachChild(node, visitor, context); } - /** - * Visits the members of a class that has fields. - * - * @param node The node to visit. - */ - function classElementVisitor(node) { - switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - // Constructors for classes using class fields are transformed in - // `visitClassDeclaration` or `visitClassExpression`. - return undefined; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - return visitMethodOrAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitComputedPropertyName(node); - case 234 /* SyntaxKind.SemicolonClassElement */: - return node; - default: - return visitor(node); - } - } function visitVariableStatement(node) { var savedPendingStatements = pendingStatements; pendingStatements = []; @@ -95087,15 +95845,24 @@ var ts; pendingStatements = savedPendingStatements; return statement; } - function visitComputedPropertyName(name) { - var node = ts.visitEachChild(name, visitor, context); + function visitComputedPropertyName(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (ts.some(pendingExpressions)) { - var expressions = pendingExpressions; - expressions.push(node.expression); - pendingExpressions = []; - node = factory.updateComputedPropertyName(node, factory.inlineExpressions(expressions)); + if (ts.isParenthesizedExpression(expression)) { + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression.expression], false))); + } + else { + expression = factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression], false)); + } + pendingExpressions = undefined; } - return node; + return factory.updateComputedPropertyName(node, expression); + } + function visitConstructorDeclaration(node) { + if (currentClassContainer) { + return transformConstructor(node, currentClassContainer); + } + return fallbackVisitor(node); } function visitMethodOrAccessorDeclaration(node) { ts.Debug.assert(!ts.hasDecorators(node)); @@ -95110,13 +95877,20 @@ var ts; } var functionName = getHoistedFunctionName(node); if (functionName) { - getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m); }), node.asteriskToken, functionName, - /* typeParameters */ undefined, ts.visitParameterList(node.parameters, classElementVisitor, context), - /* type */ undefined, ts.visitFunctionBody(node.body, classElementVisitor, context)))); + getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m) && !ts.isAccessorModifier(m); }), node.asteriskToken, functionName, + /* typeParameters */ undefined, ts.visitParameterList(node.parameters, visitor, context), + /* type */ undefined, ts.visitFunctionBody(node.body, visitor, context)))); } // remove method declaration from class return undefined; } + function setCurrentStaticPropertyDeclarationOrStaticBlockAnd(current, visitor, arg) { + var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + currentStaticPropertyDeclarationOrStaticBlock = current; + var result = visitor(arg); + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return result; + } function getHoistedFunctionName(node) { ts.Debug.assert(ts.isPrivateIdentifier(node.name)); var info = accessPrivateIdentifier(node.name); @@ -95133,49 +95907,104 @@ var ts; } } } - function visitPropertyDeclaration(node) { - ts.Debug.assert(!ts.hasDecorators(node)); - if (ts.isPrivateIdentifier(node.name)) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - if (ts.isStatic(node)) { - // static fields are left as is - return ts.visitEachChild(node, visitor, context); - } - // Initializer is elided as the field is initialized in transformConstructor. - return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*questionOrExclamationToken*/ undefined, - /*type*/ undefined, - /*initializer*/ undefined); - } - // leave invalid code untransformed + function transformAutoAccessor(node) { + // transforms: + // accessor x = 1; + // into: + // #x = 1; + // get x() { return this.#x; } + // set x(value) { this.#x = value; } + ts.Debug.assertEachNode(node.modifiers, ts.isModifier); + var commentRange = ts.getCommentRange(node); + var sourceMapRange = ts.getSourceMapRange(node); + // Since we're creating two declarations where there was previously one, cache + // the expression for any computed property names. + var name = node.name; + var getterName = name; + var setterName = name; + if (ts.isComputedPropertyName(name) && !ts.isSimpleInlineableExpression(name.expression)) { + var temp = factory.createTempVariable(hoistVariableDeclaration); + ts.setSourceMapRange(temp, name.expression); + var expression = ts.visitNode(name.expression, visitor, ts.isExpression); + var assignment = factory.createAssignment(temp, expression); + ts.setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp])); + setterName = factory.updateComputedPropertyName(name, temp); + } + var backingField = ts.createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); + ts.setOriginalNode(backingField, node); + ts.setEmitFlags(backingField, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(backingField, sourceMapRange); + var getter = ts.createAccessorPropertyGetRedirector(factory, node, node.modifiers, getterName); + ts.setOriginalNode(getter, node); + ts.setCommentRange(getter, commentRange); + ts.setSourceMapRange(getter, sourceMapRange); + var setter = ts.createAccessorPropertySetRedirector(factory, node, node.modifiers, setterName); + ts.setOriginalNode(setter, node); + ts.setEmitFlags(setter, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(setter, sourceMapRange); + return ts.visitArray([backingField, getter, setter], accessorFieldResultVisitor, ts.isClassElement); + } + function transformPrivateFieldInitializer(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + // If we are transforming private elements into WeakMap/WeakSet, we should elide the node. var info = accessPrivateIdentifier(node.name); ts.Debug.assert(info, "Undeclared private name for property declaration."); - if (!info.isValid) { - return node; - } - } - // Create a temporary variable to store a computed property name (if necessary). - // If it's not inlineable, then we emit an expression after the class which assigns - // the property name to the temporary variable. - var expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer || useDefineForClassFields); - if (expr && !ts.isSimpleInlineableExpression(expr)) { - getPendingExpressions().push(expr); + // Leave invalid code untransformed; otherwise, elide the node as it is transformed elsewhere. + return info.isValid ? undefined : node; + } + if (shouldTransformInitializersUsingSet && !ts.isStatic(node)) { + // If we are transforming initializers using Set semantics we will elide the initializer as it will + // be moved to the constructor to preserve evaluation order next to public instance fields. We don't + // need to do this transformation for private static fields since public static fields can be + // transformed into `static {}` blocks. + return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + /*initializer*/ undefined); } - if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) { - var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); - if (initializerStatement) { - var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); - ts.setOriginalNode(staticBlock, node); - ts.setCommentRange(staticBlock, node); - // Set the comment range for the statement to an empty synthetic range - // and drop synthetic comments from the statement to avoid printing them twice. - ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); - ts.setSyntheticLeadingComments(initializerStatement, undefined); - ts.setSyntheticTrailingComments(initializerStatement, undefined); - return staticBlock; + return ts.visitEachChild(node, visitor, context); + } + function transformPublicFieldInitializer(node) { + if (shouldTransformInitializers) { + // Create a temporary variable to store a computed property name (if necessary). + // If it's not inlineable, then we emit an expression after the class which assigns + // the property name to the temporary variable. + var expr = getPropertyNameExpressionIfNeeded(node.name, /*shouldHoist*/ !!node.initializer || useDefineForClassFields); + if (expr) { + getPendingExpressions().push(expr); + } + if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks) { + var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); + if (initializerStatement) { + var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); + ts.setOriginalNode(staticBlock, node); + ts.setCommentRange(staticBlock, node); + // Set the comment range for the statement to an empty synthetic range + // and drop synthetic comments from the statement to avoid printing them twice. + ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); + ts.setSyntheticLeadingComments(initializerStatement, undefined); + ts.setSyntheticTrailingComments(initializerStatement, undefined); + return staticBlock; + } } + return undefined; } - return undefined; + return ts.visitEachChild(node, classElementVisitor, context); + } + function transformFieldInitializer(node) { + ts.Debug.assert(!ts.hasDecorators(node), "Decorators should already have been transformed and elided."); + return ts.isPrivateIdentifierClassElementDeclaration(node) ? + transformPrivateFieldInitializer(node) : + transformPublicFieldInitializer(node); + } + function visitPropertyDeclaration(node) { + // If this is an auto-accessor, we defer to `transformAutoAccessor`. That function + // will in turn call `transformFieldInitializer` as needed. + if (shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(node)) { + return transformAutoAccessor(node); + } + return transformFieldInitializer(node); } function createPrivateIdentifierAccess(info, receiver) { return createPrivateIdentifierAccessHelper(info, ts.visitNode(receiver, visitor, ts.isExpression)); @@ -95239,9 +96068,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) { - if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || node.operator === 46 /* SyntaxKind.MinusMinusToken */) { + if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || + node.operator === 46 /* SyntaxKind.MinusMinusToken */) { var operand = ts.skipParentheses(node.operand); - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(operand)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(operand)) { var info = void 0; if (info = accessPrivateIdentifier(operand.name)) { var receiver = ts.visitNode(operand.expression, visitor, ts.isExpression); @@ -95330,7 +96161,9 @@ var ts; return { readExpression: readExpression, initializeExpression: initializeExpression }; } function visitCallExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + // obj.#x() // Transform call expressions of private names to properly bind the `this` parameter. var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; if (ts.isCallChain(node)) { @@ -95345,6 +96178,8 @@ var ts; ts.isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.classConstructor)) { + // super.x() + // super[x]() // converts `super.f(...)` into `Reflect.get(_baseTemp, "f", _classTemp).call(_classTemp, ...)` var invocation = factory.createFunctionCallCall(ts.visitNode(node.expression, visitor, ts.isExpression), currentClassLexicalEnvironment.classConstructor, ts.visitNodes(node.arguments, visitor, ts.isExpression)); ts.setOriginalNode(invocation, node); @@ -95354,7 +96189,8 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitTaggedTemplateExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { // Bind the `this` correctly for tagged template literals when the tag is a private identifier property access. var _a = factory.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; return factory.updateTaggedTemplateExpression(node, factory.createCallExpression(factory.createPropertyAccessExpression(ts.visitNode(target, visitor), "bind"), @@ -95380,11 +96216,8 @@ var ts; classLexicalEnvironmentMap.set(ts.getOriginalNodeId(node), currentClassLexicalEnvironment); } startLexicalEnvironment(); - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = node; - var statements = ts.visitNodes(node.body.statements, visitor, ts.isStatement); + var statements = setCurrentStaticPropertyDeclarationOrStaticBlockAnd(node, function (statements) { return ts.visitNodes(statements, visitor, ts.isStatement); }, node.body.statements); statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; var iife = factory.createImmediatelyInvokedArrowFunction(statements); ts.setOriginalNode(iife, node); ts.setTextRange(iife, node); @@ -95394,9 +96227,12 @@ var ts; } function visitBinaryExpression(node, valueIsDiscarded) { if (ts.isDestructuringAssignment(node)) { + // ({ x: obj.#x } = ...) + // ({ x: super.x } = ...) + // ({ x: super[x] } = ...) var savedPendingExpressions = pendingExpressions; pendingExpressions = undefined; - node = factory.updateBinaryExpression(node, ts.visitNode(node.left, visitorDestructuringTarget), node.operatorToken, ts.visitNode(node.right, visitor)); + node = factory.updateBinaryExpression(node, ts.visitNode(node.left, assignmentTargetVisitor), node.operatorToken, ts.visitNode(node.right, visitor)); var expr = ts.some(pendingExpressions) ? factory.inlineExpressions(ts.compact(__spreadArray(__spreadArray([], pendingExpressions, true), [node], false))) : node; @@ -95404,7 +96240,9 @@ var ts; return expr; } if (ts.isAssignmentExpression(node)) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + // obj.#x = ... var info = accessPrivateIdentifier(node.left.name); if (info) { return ts.setTextRange(ts.setOriginalNode(createPrivateIdentifierAssignment(info, node.left.expression, node.right, node.operatorToken.kind), node), node); @@ -95414,6 +96252,10 @@ var ts; ts.isSuperProperty(node.left) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + // super.x = ... + // super[x] = ... + // super.x += ... + // super.x -= ... var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts; if (facts & 1 /* ClassFacts.ClassWasDecorated */) { return factory.updateBinaryExpression(node, visitInvalidSuperProperty(node.left), node.operatorToken, ts.visitNode(node.right, visitor, ts.isExpression)); @@ -95457,8 +96299,10 @@ var ts; } } } - if (node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ && ts.isPrivateIdentifier(node.left)) { - return visitPrivateIdentifierInInExpression(node); + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierInExpression(node)) { + // #x in obj + return transformPrivateIdentifierInInExpression(node); } return ts.visitEachChild(node, visitor, context); } @@ -95483,36 +96327,6 @@ var ts; ts.Debug.assertNever(info, "Unknown private element type"); } } - /** - * Set up the environment for a class. - */ - function visitClassLike(node) { - if (!ts.forEach(node.members, doesClassElementNeedTransform)) { - return ts.visitEachChild(node, visitor, context); - } - var savedPendingExpressions = pendingExpressions; - pendingExpressions = undefined; - startClassLexicalEnvironment(); - if (shouldTransformPrivateElementsOrClassStaticBlocks) { - var name = ts.getNameOfDeclaration(node); - if (name && ts.isIdentifier(name)) { - getPrivateIdentifierEnvironment().className = ts.idText(name); - } - var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); - if (ts.some(privateInstanceMethodsAndAccessors)) { - getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); - } - } - var result = ts.isClassDeclaration(node) ? - visitClassDeclaration(node) : - visitClassExpression(node); - endClassLexicalEnvironment(); - pendingExpressions = savedPendingExpressions; - return result; - } - function doesClassElementNeedTransform(node) { - return ts.isPropertyDeclaration(node) || ts.isClassStaticBlockDeclaration(node) || (shouldTransformPrivateElementsOrClassStaticBlocks && node.name && ts.isPrivateIdentifier(node.name)); - } function getPrivateInstanceMethodsAndAccessors(node) { return ts.filter(node.members, ts.isNonStaticMethodOrAccessorWithPrivateName); } @@ -95526,7 +96340,7 @@ var ts; var member = _a[_i]; if (!ts.isStatic(member)) continue; - if (member.name && ts.isPrivateIdentifier(member.name) && shouldTransformPrivateElementsOrClassStaticBlocks) { + if (member.name && (ts.isPrivateIdentifier(member.name) || ts.isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) { facts |= 2 /* ClassFacts.NeedsClassConstructorReference */; } if (ts.isPropertyDeclaration(member) || ts.isClassStaticBlockDeclaration(member)) { @@ -95545,7 +96359,7 @@ var ts; } return facts; } - function visitExpressionWithTypeArguments(node) { + function visitExpressionWithTypeArgumentsInHeritageClause(node) { var facts = (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.facts) || 0 /* ClassFacts.None */; if (facts & 4 /* ClassFacts.NeedsClassSuperReference */) { var temp = factory.createTempVariable(hoistVariableDeclaration, /*reserveInNestedScopes*/ true); @@ -95555,7 +96369,22 @@ var ts; } return ts.visitEachChild(node, visitor, context); } - function visitClassDeclaration(node) { + function visitInNewClassLexicalEnvironment(node, visitor) { + var savedCurrentClassContainer = currentClassContainer; + var savedPendingExpressions = pendingExpressions; + currentClassContainer = node; + pendingExpressions = undefined; + startClassLexicalEnvironment(); + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + var name = ts.getNameOfDeclaration(node); + if (name && ts.isIdentifier(name)) { + getPrivateIdentifierEnvironment().className = name; + } + var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); + if (ts.some(privateInstanceMethodsAndAccessors)) { + getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); + } + } var facts = getClassFacts(node); if (facts) { getClassLexicalEnvironment().facts = facts; @@ -95563,6 +96392,16 @@ var ts; if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { enableSubstitutionForClassStaticThisOrSuperReference(); } + var result = visitor(node, facts); + endClassLexicalEnvironment(); + currentClassContainer = savedCurrentClassContainer; + pendingExpressions = savedPendingExpressions; + return result; + } + function visitClassDeclaration(node) { + return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); + } + function visitClassDeclarationInNewClassLexicalEnvironment(node, facts) { // If a class has private static fields, or a static field has a `this` or `super` reference, // then we need to allocate a temp variable to hold on to that reference. var pendingClassReferenceAssignment; @@ -95571,12 +96410,16 @@ var ts; getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); - var statements = [ - factory.updateClassDeclaration(node, node.modifiers, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) - ]; + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classDecl = factory.updateClassDeclaration(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var statements = []; + if (prologue) { + statements.push(factory.createExpressionStatement(prologue)); + } + statements.push(classDecl); if (pendingClassReferenceAssignment) { getPendingExpressions().unshift(pendingClassReferenceAssignment); } @@ -95584,25 +96427,23 @@ var ts; if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); } - // Emit static property assignment. Because classDeclaration is lexically evaluated, - // it is safe to emit static property assignment after classDeclaration - // From ES6 specification: - // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using - // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. - var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); - if (ts.some(staticProperties)) { - addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + if (shouldTransformInitializersUsingSet || shouldTransformPrivateElementsOrClassStaticBlocks) { + // Emit static property assignment. Because classDeclaration is lexically evaluated, + // it is safe to emit static property assignment after classDeclaration + // From ES6 specification: + // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using + // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. + var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); + if (ts.some(staticProperties)) { + addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + } } return statements; } function visitClassExpression(node) { - var facts = getClassFacts(node); - if (facts) { - getClassLexicalEnvironment().facts = facts; - } - if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { - enableSubstitutionForClassStaticThisOrSuperReference(); - } + return visitInNewClassLexicalEnvironment(node, visitClassExpressionInNewClassLexicalEnvironment); + } + function visitClassExpressionInNewClassLexicalEnvironment(node, facts) { // If this class expression is a transformation of a decorated class declaration, // then we want to output the pendingExpressions as statements, not as inlined // expressions with the class statement. @@ -95612,8 +96453,6 @@ var ts; // these statements after the class expression variable statement. var isDecoratedClassDeclaration = !!(facts & 1 /* ClassFacts.ClassWasDecorated */); var staticPropertiesOrClassStaticBlocks = ts.getStaticPropertiesAndClassStaticBlock(node); - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; var temp; function createClassTempVar() { @@ -95626,9 +96465,23 @@ var ts; temp = createClassTempVar(); getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); } - var classExpression = factory.updateClassExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)); - var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(staticPropertiesOrClassStaticBlocks, function (p) { return ts.isClassStaticBlockDeclaration(p) || !!p.initializer || ts.isPrivateIdentifier(p.name); }); + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classExpression = factory.updateClassExpression(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var expressions = []; + if (prologue) { + expressions.push(prologue); + } + // Static initializers are transformed to `static {}` blocks when `useDefineForClassFields: false` + // and not also transforming static blocks. + var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && + ts.some(staticPropertiesOrClassStaticBlocks, function (node) { + return ts.isClassStaticBlockDeclaration(node) || + ts.isPrivateIdentifierClassElementDeclaration(node) || + shouldTransformInitializers && ts.isInitializedProperty(node); + }); if (hasTransformableStatics || ts.some(pendingExpressions)) { if (isDecoratedClassDeclaration) { ts.Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); @@ -95640,12 +96493,16 @@ var ts; addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); } if (temp) { - return factory.inlineExpressions([factory.createAssignment(temp, classExpression), temp]); + expressions.push(ts.startOnNewLine(factory.createAssignment(temp, classExpression)), ts.startOnNewLine(temp)); + } + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } } - return classExpression; } else { - var expressions = []; temp || (temp = createClassTempVar()); if (isClassWithConstructorReference) { // record an alias as the class name is not in scope for statics. @@ -95662,45 +96519,87 @@ var ts; ts.addRange(expressions, ts.map(pendingExpressions, ts.startOnNewLine)); ts.addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); expressions.push(ts.startOnNewLine(temp)); - return factory.inlineExpressions(expressions); } } - return classExpression; + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } + } + return factory.inlineExpressions(expressions); } function visitClassStaticBlockDeclaration(node) { if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return ts.visitEachChild(node, classElementVisitor, context); + return ts.visitEachChild(node, visitor, context); } // ClassStaticBlockDeclaration for classes are transformed in `visitClassDeclaration` or `visitClassExpression`. return undefined; } - function transformClassMembers(node, isDerivedClass) { - var members = []; + function transformClassMembers(node) { + // Declare private names if (shouldTransformPrivateElementsOrClassStaticBlocks) { - // Declare private names. for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (ts.isPrivateIdentifierClassElementDeclaration(member)) { - addPrivateIdentifierToEnvironment(member); + addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); } } if (ts.some(getPrivateInstanceMethodsAndAccessors(node))) { createBrandCheckWeakSetForPrivateMethods(); } + if (shouldTransformAutoAccessors) { + for (var _b = 0, _c = node.members; _b < _c.length; _b++) { + var member = _c[_b]; + if (ts.isAutoAccessorPropertyDeclaration(member)) { + var storageName = factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"); + addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + } + } + } } - var constructor = transformConstructor(node, isDerivedClass); - var visitedMembers = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); - if (constructor) { - members.push(constructor); + var members = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); + // Create a synthetic constructor if necessary + var syntheticConstructor; + if (!ts.some(members, ts.isConstructorDeclaration)) { + syntheticConstructor = transformConstructor(/*constructor*/ undefined, node); } + var prologue; + // If there are pending expressions create a class static block in which to evaluate them, but only if + // class static blocks are not also being transformed. This block will be injected at the top of the class + // to ensure that expressions from computed property names are evaluated before any other static + // initializers. + var syntheticStaticBlock; if (!shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(pendingExpressions)) { - members.push(factory.createClassStaticBlockDeclaration(factory.createBlock([ - factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)) - ]))); + var statement = factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)); + if (statement.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */) { + // If there are `this` or `super` references from computed property names, shift the expression + // into an arrow function to be evaluated in the outer scope so that `this` and `super` are + // properly captured. + var temp = factory.createTempVariable(hoistVariableDeclaration); + var arrow = factory.createArrowFunction( + /*modifiers*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, + /*equalsGreaterThanToken*/ undefined, factory.createBlock([statement])); + prologue = factory.createAssignment(temp, arrow); + statement = factory.createExpressionStatement(factory.createCallExpression(temp, /*typeArguments*/ undefined, [])); + } + var block = factory.createBlock([statement]); + syntheticStaticBlock = factory.createClassStaticBlockDeclaration(block); pendingExpressions = undefined; } - ts.addRange(members, visitedMembers); - return ts.setTextRange(factory.createNodeArray(members), /*location*/ node.members); + // If we created a synthetic constructor or class static block, add them to the visited members + // and return a new array. + if (syntheticConstructor || syntheticStaticBlock) { + var membersArray = void 0; + membersArray = ts.append(membersArray, syntheticConstructor); + membersArray = ts.append(membersArray, syntheticStaticBlock); + membersArray = ts.addRange(membersArray, members); + members = ts.setTextRange(factory.createNodeArray(membersArray), /*location*/ node.members); + } + return { members: members, prologue: prologue }; } function createBrandCheckWeakSetForPrivateMethods() { var weakSetName = getPrivateIdentifierEnvironment().weakSetName; @@ -95709,35 +96608,38 @@ var ts; /*typeArguments*/ undefined, []))); } function isClassElementThatRequiresConstructorStatement(member) { - if (ts.isStatic(member) || ts.hasSyntacticModifier(ts.getOriginalNode(member), 128 /* ModifierFlags.Abstract */)) { + if (ts.isStatic(member) || ts.hasAbstractModifier(ts.getOriginalNode(member))) { return false; } - if (useDefineForClassFields) { - // If we are using define semantics and targeting ESNext or higher, - // then we don't need to transform any class properties. - return languageVersion < 9 /* ScriptTarget.ES2022 */; - } - return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member); + return shouldTransformInitializersUsingDefine && ts.isPropertyDeclaration(member) || + shouldTransformInitializersUsingSet && ts.isInitializedProperty(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(member); } - function transformConstructor(node, isDerivedClass) { - var constructor = ts.visitNode(ts.getFirstConstructorWithBody(node), visitor, ts.isConstructorDeclaration); - var elements = node.members.filter(isClassElementThatRequiresConstructorStatement); - if (!ts.some(elements)) { + function transformConstructor(constructor, container) { + constructor = ts.visitNode(constructor, visitor, ts.isConstructorDeclaration); + if (!ts.some(container.members, isClassElementThatRequiresConstructorStatement)) { return constructor; } + var extendsClauseElement = ts.getEffectiveBaseTypeNode(container); + var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var parameters = ts.visitParameterList(constructor ? constructor.parameters : undefined, visitor, context); - var body = transformConstructorBody(node, constructor, isDerivedClass); + var body = transformConstructorBody(container, constructor, isDerivedClass); if (!body) { - return undefined; + return constructor; + } + if (constructor) { + ts.Debug.assert(parameters); + return factory.updateConstructorDeclaration(constructor, /*modifiers*/ undefined, parameters, body); } return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration( - /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || node), constructor)); + /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || container), constructor)); } function transformConstructorBody(node, constructor, isDerivedClass) { - var _a; + var _a, _b; var properties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ false); if (!useDefineForClassFields) { - properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name); }); + properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name) || ts.hasAccessorModifier(property); }); } var privateMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); var needsConstructorBody = ts.some(properties) || ts.some(privateMethodsAndAccessors); @@ -95789,8 +96691,8 @@ var ts; statements = statements.filter(function (statement) { return !ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor); }); } else { - for (var _i = 0, _b = constructor.body.statements; _i < _b.length; _i++) { - var statement = _b[_i]; + for (var _i = 0, _c = constructor.body.statements; _i < _c.length; _i++) { + var statement = _c[_i]; if (ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { parameterPropertyDeclarationCount++; } @@ -95822,9 +96724,14 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue)); } statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + if (statements.length === 0 && !constructor) { + return undefined; + } + var multiLine = (constructor === null || constructor === void 0 ? void 0 : constructor.body) && constructor.body.statements.length >= statements.length ? + (_b = constructor.body.multiLine) !== null && _b !== void 0 ? _b : statements.length > 0 : + statements.length > 0; return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), - /*location*/ constructor ? constructor.body.statements : node.members), - /*multiLine*/ true), + /*location*/ constructor ? constructor.body.statements : node.members), multiLine), /*location*/ constructor ? constructor.body : undefined); function visitBodyStatement(statement) { if (useDefineForClassFields && ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { @@ -95860,9 +96767,10 @@ var ts; return undefined; } var statement = factory.createExpressionStatement(expression); + ts.setOriginalNode(statement, property); + ts.addEmitFlags(statement, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); - ts.setOriginalNode(statement, property); // `setOriginalNode` *copies* the `emitNode` from `property`, so now both // `statement` and `expression` have a copy of the synthesized comments. // Drop the comments from expression to avoid printing them twice. @@ -95885,9 +96793,10 @@ var ts; continue; } ts.startOnNewLine(expression); + ts.setOriginalNode(expression, property); + ts.addEmitFlags(expression, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); ts.setCommentRange(expression, property); - ts.setOriginalNode(expression, property); expressions.push(expression); } return expressions; @@ -95914,9 +96823,11 @@ var ts; var _a; // We generate a name here in order to reuse the value cached by the relocated computed name expression (which uses the same generated name) var emitAssignment = !useDefineForClassFields; - var propertyName = ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) - ? factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) - : property.name; + var propertyName = ts.hasAccessorModifier(property) ? + factory.getGeneratedPrivateNameForNode(property.name) : + ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) ? + factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) : + property.name; if (ts.hasStaticModifier(property)) { currentStaticPropertyDeclarationOrStaticBlock = property; } @@ -95943,7 +96854,7 @@ var ts; return undefined; } var propertyOriginalNode = ts.getOriginalNode(property); - if (ts.hasSyntacticModifier(propertyOriginalNode, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(propertyOriginalNode, 256 /* ModifierFlags.Abstract */)) { return undefined; } var initializer = property.initializer || emitAssignment ? (_a = ts.visitNode(property.initializer, visitor, ts.isExpression)) !== null && _a !== void 0 ? _a : factory.createVoidZero() @@ -95977,17 +96888,17 @@ var ts; // substitute `this` in a static field initializer context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); // these push a new lexical environment that is not the class lexical environment - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // these push a new lexical environment that is not the class lexical environment, except // when they have a computed property name - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(167 /* SyntaxKind.PropertyDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(169 /* SyntaxKind.PropertyDeclaration */); // class lexical environments are restored when entering a computed property name - context.enableEmitNotification(162 /* SyntaxKind.ComputedPropertyName */); + context.enableEmitNotification(164 /* SyntaxKind.ComputedPropertyName */); } } /** @@ -96026,13 +96937,13 @@ var ts; } } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (ts.isArrowFunction(original) || ts.getEmitFlags(node) & 262144 /* EmitFlags.AsyncFunctionBody */) { break; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = undefined; @@ -96042,10 +96953,10 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentComputedPropertyNameClassLexicalEnvironment = currentClassLexicalEnvironment; @@ -96055,7 +96966,7 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 162 /* SyntaxKind.ComputedPropertyName */: { + case 164 /* SyntaxKind.ComputedPropertyName */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; @@ -96169,149 +97080,138 @@ var ts; function getPrivateIdentifierEnvironment() { var lex = getClassLexicalEnvironment(); lex.privateIdentifierEnvironment || (lex.privateIdentifierEnvironment = { - className: "", - identifiers: new ts.Map() + className: undefined, + weakSetName: undefined, + identifiers: undefined, + generatedIdentifiers: undefined, }); return lex.privateIdentifierEnvironment; } function getPendingExpressions() { - return pendingExpressions || (pendingExpressions = []); + return pendingExpressions !== null && pendingExpressions !== void 0 ? pendingExpressions : (pendingExpressions = []); } - function addPrivateIdentifierToEnvironment(node) { - var _a; - var text = ts.getTextOfPropertyName(node.name); - var lex = getClassLexicalEnvironment(); - var classConstructor = lex.classConstructor; - var privateEnv = getPrivateIdentifierEnvironment(); - var weakSetName = privateEnv.weakSetName; - var assignmentExpressions = []; - var privateName = node.name.escapedText; - var previousInfo = privateEnv.identifiers.get(privateName); - var isValid = !isReservedPrivateName(node.name) && previousInfo === undefined; - if (ts.hasStaticModifier(node)) { - ts.Debug.assert(classConstructor, "weakSetName should be set in private identifier environment"); - if (ts.isPropertyDeclaration(node)) { - var variableName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f" /* PrivateIdentifierKind.Field */, - variableName: variableName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isMethodDeclaration(node)) { - var functionName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: functionName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isGetAccessorDeclaration(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else if (ts.isSetAccessorDeclaration(node)) { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else { - ts.Debug.assertNever(node, "Unknown class element type."); - } + function addPrivateIdentifierClassElementToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + if (ts.isAutoAccessorPropertyDeclaration(node)) { + addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isPropertyDeclaration(node)) { - var weakMapName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { + addPrivateIdentifierPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isMethodDeclaration(node)) { + addPrivateIdentifierMethodDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isGetAccessorDeclaration(node)) { + addPrivateIdentifierGetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isSetAccessorDeclaration(node)) { + addPrivateIdentifierSetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + } + function addPrivateIdentifierPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + if (isStatic) { + ts.Debug.assert(lex.classConstructor, "classConstructor should be set in private identifier environment"); + var variableName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f" /* PrivateIdentifierKind.Field */, + brandCheckIdentifier: lex.classConstructor, + variableName: variableName, + isStatic: true, + isValid: isValid, + }); + } + else { + var weakMapName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { kind: "f" /* PrivateIdentifierKind.Field */, brandCheckIdentifier: weakMapName, - isStatic: false, variableName: undefined, + isStatic: false, isValid: isValid, }); - assignmentExpressions.push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), + getPendingExpressions().push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), /*typeArguments*/ undefined, []))); } - else if (ts.isMethodDeclaration(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: createHoistedVariableForPrivateName(text, node), - brandCheckIdentifier: weakSetName, - isStatic: false, + } + function addPrivateIdentifierMethodDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var methodName = createHoistedVariableForPrivateName(name); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "m" /* PrivateIdentifierKind.Method */, + methodName: methodName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierGetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.getterName) { + previousInfo.getterName = getterName; + } + else { + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: undefined, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, isValid: isValid, }); } - else if (ts.isAccessor(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - if (ts.isGetAccessor(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } - else { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } + } + function addPrivateIdentifierSetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.setterName) { + previousInfo.setterName = setterName; } else { - ts.Debug.assertNever(node, "Unknown class element type."); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: undefined, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); } - (_a = getPendingExpressions()).push.apply(_a, assignmentExpressions); } - function createHoistedVariableForClass(name, node) { + function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierToEnvironment(node, name, addDeclaration) { + var lex = getClassLexicalEnvironment(); + var privateEnv = getPrivateIdentifierEnvironment(); + var previousInfo = getPrivateIdentifier(privateEnv, name); + var isStatic = ts.hasStaticModifier(node); + var isValid = !isReservedPrivateName(name) && previousInfo === undefined; + addDeclaration(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + function createHoistedVariableForClass(name, node, suffix) { var className = getPrivateIdentifierEnvironment().className; - var prefix = className ? "_".concat(className) : ""; - var identifier = factory.createUniqueName("".concat(prefix, "_").concat(name), 16 /* GeneratedIdentifierFlags.Optimistic */); + var prefix = className ? { prefix: "_", node: className, suffix: "_" } : "_"; + var identifier = typeof name === "object" ? factory.getGeneratedNameForNode(name, 16 /* GeneratedIdentifierFlags.Optimistic */ | 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */, prefix, suffix) : + typeof name === "string" ? factory.createUniqueName(name, 16 /* GeneratedIdentifierFlags.Optimistic */, prefix, suffix) : + factory.createTempVariable(/*recordTempVariable*/ undefined, /*reserveInNestedScopes*/ true, prefix, suffix); if (resolver.getNodeCheckFlags(node) & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */) { addBlockScopedVariable(identifier); } @@ -96320,13 +97220,33 @@ var ts; } return identifier; } - function createHoistedVariableForPrivateName(privateName, node) { - return createHoistedVariableForClass(privateName.substring(1), node.name); + function createHoistedVariableForPrivateName(name, suffix) { + var _a; + var text = ts.tryGetTextOfPropertyName(name); + return createHoistedVariableForClass((_a = text === null || text === void 0 ? void 0 : text.substring(1)) !== null && _a !== void 0 ? _a : name, name, suffix); } + /** + * Access an already defined {@link PrivateIdentifier} in the current {@link PrivateIdentifierEnvironment}. + * + * @seealso {@link addPrivateIdentifierToEnvironment} + */ function accessPrivateIdentifier(name) { - var _a; + if (ts.isGeneratedPrivateIdentifier(name)) { + return accessGeneratedPrivateIdentifier(name); + } + else { + return accessPrivateIdentifierByText(name.escapedText); + } + } + function accessPrivateIdentifierByText(text) { + return accessPrivateIdentifierWorker(getPrivateIdentifierInfo, text); + } + function accessGeneratedPrivateIdentifier(name) { + return accessPrivateIdentifierWorker(getGeneratedPrivateIdentifierInfo, ts.getNodeForGeneratedName(name)); + } + function accessPrivateIdentifierWorker(getPrivateIdentifierInfo, privateIdentifierKey) { if (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.privateIdentifierEnvironment) { - var info = currentClassLexicalEnvironment.privateIdentifierEnvironment.identifiers.get(name.escapedText); + var info = getPrivateIdentifierInfo(currentClassLexicalEnvironment.privateIdentifierEnvironment, privateIdentifierKey); if (info) { return info; } @@ -96336,9 +97256,11 @@ var ts; if (!env) { continue; } - var info = (_a = env.privateIdentifierEnvironment) === null || _a === void 0 ? void 0 : _a.identifiers.get(name.escapedText); - if (info) { - return info; + if (env.privateIdentifierEnvironment) { + var info = getPrivateIdentifierInfo(env.privateIdentifierEnvironment, privateIdentifierKey); + if (info) { + return info; + } } } return undefined; @@ -96395,7 +97317,7 @@ var ts; } } } - return ts.visitNode(node, visitorDestructuringTarget); + return ts.visitNode(node, assignmentTargetVisitor); } function visitObjectAssignmentTarget(node) { if (ts.isObjectBindingOrAssignmentElement(node) && !ts.isShorthandPropertyAssignment(node)) { @@ -96428,10 +97350,10 @@ var ts; var initializer = ts.getInitializerOfBindingOrAssignmentElement(node); return factory.updatePropertyAssignment(node, ts.visitNode(node.name, visitor, ts.isPropertyName), wrapped ? initializer ? factory.createAssignment(wrapped, ts.visitNode(initializer, visitor)) : wrapped : - ts.visitNode(node.initializer, visitorDestructuringTarget, ts.isExpression)); + ts.visitNode(node.initializer, assignmentTargetVisitor, ts.isExpression)); } if (ts.isSpreadAssignment(node)) { - return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, visitorDestructuringTarget, ts.isExpression)); + return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, assignmentTargetVisitor, ts.isExpression)); } ts.Debug.assert(wrapped === undefined, "Should not have generated a wrapped target"); } @@ -96477,7 +97399,31 @@ var ts; /*typeArguments*/ undefined, [receiver]); } function isReservedPrivateName(node) { - return node.escapedText === "#constructor"; + return !ts.isGeneratedPrivateIdentifier(node) && node.escapedText === "#constructor"; + } + function getPrivateIdentifier(privateEnv, name) { + return ts.isGeneratedPrivateIdentifier(name) ? + getGeneratedPrivateIdentifierInfo(privateEnv, ts.getNodeForGeneratedName(name)) : + getPrivateIdentifierInfo(privateEnv, name.escapedText); + } + function setPrivateIdentifier(privateEnv, name, info) { + var _a, _b; + if (ts.isGeneratedPrivateIdentifier(name)) { + (_a = privateEnv.generatedIdentifiers) !== null && _a !== void 0 ? _a : (privateEnv.generatedIdentifiers = new ts.Map()); + privateEnv.generatedIdentifiers.set(ts.getNodeForGeneratedName(name), info); + } + else { + (_b = privateEnv.identifiers) !== null && _b !== void 0 ? _b : (privateEnv.identifiers = new ts.Map()); + privateEnv.identifiers.set(name.escapedText, info); + } + } + function getPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.identifiers) === null || _a === void 0 ? void 0 : _a.get(key); + } + function getGeneratedPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.generatedIdentifiers) === null || _a === void 0 ? void 0 : _a.get(key); } })(ts || (ts = {})); /*@internal*/ @@ -96518,15 +97464,15 @@ var ts; */ function serializeTypeOfNode(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: return serializeTypeNode(node.type); - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return serializeTypeNode(getAccessorTypeNode(node)); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createIdentifier("Function"); default: return ts.factory.createVoidZero(); @@ -96562,7 +97508,7 @@ var ts; return ts.factory.createArrayLiteralExpression(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (container && node.kind === 174 /* SyntaxKind.GetAccessor */) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -96608,66 +97554,66 @@ var ts; node = ts.skipTypeParentheses(node); switch (node.kind) { case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return ts.factory.createVoidZero(); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return ts.factory.createIdentifier("Function"); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return ts.factory.createIdentifier("Array"); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? ts.factory.createVoidZero() : ts.factory.createIdentifier("Boolean"); - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return ts.factory.createIdentifier("Boolean"); - case 198 /* SyntaxKind.TemplateLiteralType */: - case 150 /* SyntaxKind.StringKeyword */: + case 200 /* SyntaxKind.TemplateLiteralType */: + case 152 /* SyntaxKind.StringKeyword */: return ts.factory.createIdentifier("String"); - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return ts.factory.createIdentifier("Object"); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return serializeLiteralOfLiteralTypeNode(node.literal); - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return ts.factory.createIdentifier("Number"); - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return getGlobalConstructor("BigInt", 7 /* ScriptTarget.ES2020 */); - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return getGlobalConstructor("Symbol", 2 /* ScriptTarget.ES2015 */); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return serializeTypeReferenceNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ true); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ false); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return serializeUnionOrIntersectionConstituents([node.trueType, node.falseType], /*isIntersection*/ false); - case 193 /* SyntaxKind.TypeOperator */: - if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + case 195 /* SyntaxKind.TypeOperator */: + if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { return serializeTypeNode(node.type); } break; - case 181 /* SyntaxKind.TypeQuery */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 192 /* SyntaxKind.ThisType */: - case 200 /* SyntaxKind.ImportType */: + case 183 /* SyntaxKind.TypeQuery */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 194 /* SyntaxKind.ThisType */: + case 202 /* SyntaxKind.ImportType */: break; // handle JSDoc types from an invalid parse - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - case 319 /* SyntaxKind.JSDocNamepathType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 321 /* SyntaxKind.JSDocVariadicType */: + case 322 /* SyntaxKind.JSDocNamepathType */: break; - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return serializeTypeNode(node.type); default: return ts.Debug.failBadSyntaxKind(node); @@ -96679,7 +97625,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.factory.createIdentifier("String"); - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; switch (operand.kind) { case 8 /* SyntaxKind.NumericLiteral */: @@ -96708,20 +97654,20 @@ var ts; for (var _i = 0, types_22 = types; _i < types_22.length; _i++) { var typeNode = types_22[_i]; typeNode = ts.skipTypeParentheses(typeNode); - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { if (isIntersection) return ts.factory.createVoidZero(); // Reduce to `never` in an intersection continue; // Elide `never` in a union } - if (typeNode.kind === 155 /* SyntaxKind.UnknownKeyword */) { + if (typeNode.kind === 157 /* SyntaxKind.UnknownKeyword */) { if (!isIntersection) return ts.factory.createIdentifier("Object"); // Reduce to `unknown` in a union continue; // Elide `unknown` in an intersection } - if (typeNode.kind === 130 /* SyntaxKind.AnyKeyword */) { + if (typeNode.kind === 131 /* SyntaxKind.AnyKeyword */) { return ts.factory.createIdentifier("Object"); // Reduce to `any` in a union or intersection } - if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var serializedConstituent = serializeTypeNode(typeNode); @@ -96869,7 +97815,7 @@ var ts; name.original = undefined; ts.setParent(name, ts.getParseTreeNode(currentLexicalScope)); // ensure the parent is set to a parse tree node. return name; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return serializeQualifiedNameAsExpression(node); } } @@ -96924,24 +97870,24 @@ var ts; return node; } switch (node.kind) { - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are elided. They will be emitted as part of `visitClassDeclaration`. return undefined; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructorDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitSetAccessorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return visitGetAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return visitPropertyDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameterDeclaration(node); default: return ts.visitEachChild(node, visitor, context); @@ -97297,7 +98243,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ !ts.hasSyntacticModifier(member, 2 /* ModifierFlags.Ambient */)); var descriptor = languageVersion > 0 /* ScriptTarget.ES3 */ - ? member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + ? ts.isPropertyDeclaration(member) && !ts.hasAccessorModifier(member) // We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it // should not invoke `Object.getOwnPropertyDescriptor`. ? factory.createVoidZero() @@ -97560,34 +98506,37 @@ var ts; return node; } switch (node.kind) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 return undefined; - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitMethodDeclaration, node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionDeclaration, node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionExpression, node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithContext(1 /* ContextFlags.NonTopLevel */, visitArrowFunction, node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 174 /* SyntaxKind.GetAccessor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitGetAccessorDeclaration, node); + case 175 /* SyntaxKind.SetAccessor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitSetAccessorDeclaration, node); + case 173 /* SyntaxKind.Constructor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitConstructorDeclaration, node); + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node); default: return ts.visitEachChild(node, visitor, context); @@ -97596,27 +98545,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatementInAsyncBody(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatementInAsyncBody(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatementInAsyncBody(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatementInAsyncBody(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClauseInAsyncBody(node); - case 235 /* SyntaxKind.Block */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 250 /* SyntaxKind.LabeledStatement */: + case 238 /* SyntaxKind.Block */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -97686,6 +98635,9 @@ var ts; return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression( /*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node); } + function visitConstructorDeclaration(node) { + return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node)); + } /** * Visits a MethodDeclaration node. * @@ -97700,7 +98652,14 @@ var ts; /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* FunctionFlags.Async */ ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : transformMethodBody(node)); + } + function visitGetAccessorDeclaration(node) { + return factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformMethodBody(node)); + } + function visitSetAccessorDeclaration(node) { + return factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node)); } /** * Visits a FunctionDeclaration node. @@ -97814,12 +98773,48 @@ var ts; } return false; } + function transformMethodBody(node) { + ts.Debug.assertIsDefined(node.body); + var savedCapturedSuperProperties = capturedSuperProperties; + var savedHasSuperElementAccess = hasSuperElementAccess; + capturedSuperProperties = new ts.Set(); + hasSuperElementAccess = false; + var updated = ts.visitFunctionBody(node.body, visitor, context); + // Minor optimization, emit `_super` helper to capture `super` access in an arrow. + // This step isn't needed if we eventually transform this to ES5. + var originalMethod = ts.getOriginalNode(node, ts.isFunctionLikeDeclaration); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && + resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) && + (ts.getFunctionFlags(originalMethod) & 3 /* FunctionFlags.AsyncGenerator */) !== 3 /* FunctionFlags.AsyncGenerator */; + if (emitSuperHelpers) { + enableSubstitutionForAsyncMethodsWithSuper(); + if (capturedSuperProperties.size) { + var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties); + substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true; + var statements = updated.statements.slice(); + ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]); + updated = factory.updateBlock(updated, statements); + } + if (hasSuperElementAccess) { + // Emit helpers for super element access expressions (`super[x]`). + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { + ts.addEmitHelper(updated, ts.advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { + ts.addEmitHelper(updated, ts.asyncSuperHelper); + } + } + } + capturedSuperProperties = savedCapturedSuperProperties; + hasSuperElementAccess = savedHasSuperElementAccess; + return updated; + } function transformAsyncFunctionBody(node) { resumeLexicalEnvironment(); var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ScriptTarget.ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 214 /* SyntaxKind.ArrowFunction */; + var isArrowFunction = node.kind === 216 /* SyntaxKind.ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* NodeCheckFlags.CaptureArguments */) !== 0; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current @@ -97846,7 +98841,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); // Minor optimization, emit `_super` helper to capture `super` access in an arrow. // This step isn't needed if we eventually transform this to ES5. - var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */ | 2048 /* NodeCheckFlags.AsyncMethodWithSuper */); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */); if (emitSuperHelpers) { enableSubstitutionForAsyncMethodsWithSuper(); if (capturedSuperProperties.size) { @@ -97859,10 +98854,10 @@ var ts; ts.setTextRange(block, node.body); if (emitSuperHelpers && hasSuperElementAccess) { // Emit helpers for super element access expressions (`super[x]`). - if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); } - else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) { + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { ts.addEmitHelper(block, ts.asyncSuperHelper); } } @@ -97910,17 +98905,17 @@ var ts; enabledSubstitutions |= 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -97934,7 +98929,7 @@ var ts; // If we need to support substitutions for `super` in an async method, // we should track it here. if (enabledSubstitutions & 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) { - var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */); + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */); if (superContainerFlags !== enclosingSuperContainerFlags) { var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; enclosingSuperContainerFlags = superContainerFlags; @@ -97968,11 +98963,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -98004,14 +98999,14 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { - if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createUniqueName("_superIndex", 16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */), /*typeArguments*/ undefined, [argumentExpression]), "value"), location); } @@ -98026,7 +99021,7 @@ var ts; function createSuperAccessVariableStatement(factory, resolver, node, names) { // Create a variable declaration with a getter/setter (if binding) definition for each name: // const _super = Object.create(null, { x: { get: () => super.x, set: (v) => super.x = v }, ... }); - var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) !== 0; + var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) !== 0; var accessors = []; names.forEach(function (_, key) { var name = ts.unescapeLeadingUnderscores(key); @@ -98165,7 +99160,7 @@ var ts; return visitorWorker(node, /*expressionResultIsUnused*/ true); } function visitorNoAsyncModifier(node) { - if (node.kind === 131 /* SyntaxKind.AsyncKeyword */) { + if (node.kind === 132 /* SyntaxKind.AsyncKeyword */) { return undefined; } return node; @@ -98191,70 +99186,70 @@ var ts; return node; } switch (node.kind) { - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: return doWithHierarchyFacts(visitDefault, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return doWithHierarchyFacts(visitForStatement, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return doWithHierarchyFacts(visitConstructorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithHierarchyFacts(visitMethodDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return doWithHierarchyFacts(visitGetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return doWithHierarchyFacts(visitSetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithHierarchyFacts(visitFunctionDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithHierarchyFacts(visitFunctionExpression, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithHierarchyFacts(visitArrowFunction, node, 2 /* HierarchyFacts.ArrowFunctionExcludes */, 0 /* HierarchyFacts.ArrowFunctionIncludes */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithHierarchyFacts(visitDefault, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); default: return ts.visitEachChild(node, visitor, context); @@ -98290,7 +99285,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2 /* FunctionFlags.Async */) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 244 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { + if (statement.kind === 247 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { return visitForOfStatement(statement, node); } return factory.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement, factory.liftToBlock), node); @@ -98302,7 +99297,7 @@ var ts; var objects = []; for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) { var e = elements_5[_i]; - if (e.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (e.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (chunkObject) { objects.push(factory.createObjectLiteralExpression(chunkObject)); chunkObject = undefined; @@ -98311,7 +99306,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 296 /* SyntaxKind.PropertyAssignment */ + chunkObject = ts.append(chunkObject, e.kind === 299 /* SyntaxKind.PropertyAssignment */ ? factory.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -98345,7 +99340,7 @@ var ts; // If we translate the above to `__assign({}, k, l)`, the `l` will evaluate before `k` is spread and we // end up with `{ a: 1, b: 2, c: 3 }` var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { objects.unshift(factory.createObjectLiteralExpression()); } var expression = objects[0]; @@ -98519,11 +99514,22 @@ var ts; } return node; } - function convertForOfStatementHead(node, boundValue) { - var binding = ts.createForOfBindingStatement(factory, node.initializer, boundValue); + function convertForOfStatementHead(node, boundValue, nonUserCode) { + var value = factory.createTempVariable(hoistVariableDeclaration); + var iteratorValueExpression = factory.createAssignment(value, boundValue); + var iteratorValueStatement = factory.createExpressionStatement(iteratorValueExpression); + ts.setSourceMapRange(iteratorValueStatement, node.expression); + var exitNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createFalse()); + var exitNonUserCodeStatement = factory.createExpressionStatement(exitNonUserCodeExpression); + ts.setSourceMapRange(exitNonUserCodeStatement, node.expression); + var enterNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createTrue()); + var enterNonUserCodeStatement = factory.createExpressionStatement(enterNonUserCodeExpression); + ts.setSourceMapRange(exitNonUserCodeStatement, node.expression); + var statements = []; + var binding = ts.createForOfBindingStatement(factory, node.initializer, value); + statements.push(ts.visitNode(binding, visitor, ts.isStatement)); var bodyLocation; var statementsLocation; - var statements = [ts.visitNode(binding, visitor, ts.isStatement)]; var statement = ts.visitIterationBody(node.statement, visitor, context); if (ts.isBlock(statement)) { ts.addRange(statements, statement.statements); @@ -98533,8 +99539,16 @@ var ts; else { statements.push(statement); } - return ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), + var body = ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), /*multiLine*/ true), bodyLocation), 48 /* EmitFlags.NoSourceMap */ | 384 /* EmitFlags.NoTokenSourceMaps */); + return factory.createBlock([ + iteratorValueStatement, + exitNonUserCodeStatement, + factory.createTryStatement(body, + /*catchClause*/ undefined, factory.createBlock([ + enterNonUserCodeStatement + ])) + ]); } function createDownlevelAwait(expression) { return enclosingFunctionFlags & 1 /* FunctionFlags.Generator */ @@ -98545,6 +99559,8 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isExpression); var iterator = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(expression) : factory.createTempVariable(/*recordTempVariable*/ undefined); var result = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(iterator) : factory.createTempVariable(/*recordTempVariable*/ undefined); + var nonUserCode = factory.createTempVariable(/*recordTempVariable*/ undefined); + var done = factory.createTempVariable(hoistVariableDeclaration); var errorRecord = factory.createUniqueName("e"); var catchVariable = factory.getGeneratedNameForNode(errorRecord); var returnMethod = factory.createTempVariable(/*recordTempVariable*/ undefined); @@ -98561,12 +99577,17 @@ var ts; callValues; var forStatement = ts.setEmitFlags(ts.setTextRange(factory.createForStatement( /*initializer*/ ts.setEmitFlags(ts.setTextRange(factory.createVariableDeclarationList([ + factory.createVariableDeclaration(nonUserCode, /*exclamationToken*/ undefined, /*type*/ undefined, factory.createTrue()), ts.setTextRange(factory.createVariableDeclaration(iterator, /*exclamationToken*/ undefined, /*type*/ undefined, initializer), node.expression), factory.createVariableDeclaration(result) ]), node.expression), 2097152 /* EmitFlags.NoHoisting */), - /*condition*/ factory.createComma(factory.createAssignment(result, createDownlevelAwait(callNext)), factory.createLogicalNot(getDone)), + /*condition*/ factory.inlineExpressions([ + factory.createAssignment(result, createDownlevelAwait(callNext)), + factory.createAssignment(done, getDone), + factory.createLogicalNot(done) + ]), /*incrementor*/ undefined, - /*statement*/ convertForOfStatementHead(node, getValue)), + /*statement*/ convertForOfStatementHead(node, getValue, nonUserCode)), /*location*/ node), 256 /* EmitFlags.NoTokenTrailingSourceMaps */); ts.setOriginalNode(forStatement, node); return factory.createTryStatement(factory.createBlock([ @@ -98578,7 +99599,7 @@ var ts; ]), 1 /* EmitFlags.SingleLine */)), factory.createBlock([ factory.createTryStatement( /*tryBlock*/ factory.createBlock([ - ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(result, factory.createLogicalNot(getDone)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), 1 /* EmitFlags.SingleLine */) + ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(factory.createLogicalNot(nonUserCode), factory.createLogicalNot(done)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), 1 /* EmitFlags.SingleLine */) ]), /*catchClause*/ undefined, /*finallyBlock*/ ts.setEmitFlags(factory.createBlock([ @@ -98734,7 +99755,7 @@ var ts; /*type*/ undefined, factory.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !!(hierarchyFacts & 1 /* HierarchyFacts.HasLexicalThis */))); // Minor optimization, emit `_super` helper to capture `super` access in an arrow. // This step isn't needed if we eventually transform this to ES5. - var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */ | 2048 /* NodeCheckFlags.AsyncMethodWithSuper */); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */); if (emitSuperHelpers) { enableSubstitutionForAsyncMethodsWithSuper(); var variableStatement = ts.createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties); @@ -98745,10 +99766,10 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var block = factory.updateBlock(node.body, statements); if (emitSuperHelpers && hasSuperElementAccess) { - if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); } - else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) { + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { ts.addEmitHelper(block, ts.asyncSuperHelper); } } @@ -98853,17 +99874,17 @@ var ts; enabledSubstitutions |= 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -98877,7 +99898,7 @@ var ts; // If we need to support substitutions for `super` in an async method, // we should track it here. if (enabledSubstitutions & 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) { - var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */); + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */); if (superContainerFlags !== enclosingSuperContainerFlags) { var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; enclosingSuperContainerFlags = superContainerFlags; @@ -98911,11 +99932,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -98947,14 +99968,14 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { - if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createIdentifier("_superIndex"), /*typeArguments*/ undefined, [argumentExpression]), "value"), location); } @@ -98983,7 +100004,7 @@ var ts; return node; } switch (node.kind) { - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -99015,25 +100036,25 @@ var ts; return node; } switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { var updated = visitNonOptionalCallExpression(node, /*captureThisArg*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (ts.isOptionalChain(node)) { var updated = visitOptionalExpression(node, /*captureThisArg*/ false, /*isDelete*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } return ts.visitEachChild(node, visitor, context); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) { return transformNullishCoalescingExpression(node); } return ts.visitEachChild(node, visitor, context); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return visitDeleteExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99075,7 +100096,7 @@ var ts; thisArg = expression; } } - expression = node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + expression = node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.updatePropertyAccessExpression(node, expression, ts.visitNode(node.name, visitor, ts.isIdentifier)) : factory.updateElementAccessExpression(node, expression, ts.visitNode(node.argumentExpression, visitor, ts.isExpression)); return thisArg ? factory.createSyntheticReferenceExpression(expression, thisArg) : expression; @@ -99098,10 +100119,10 @@ var ts; } function visitNonOptionalExpression(node, captureThisArg, isDelete) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); - case 208 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); + case 210 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); default: return ts.visitNode(node, visitor, ts.isExpression); } } @@ -99120,8 +100141,8 @@ var ts; for (var i = 0; i < chain.length; i++) { var segment = chain[i]; switch (segment.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (i === chain.length - 1 && captureThisArg) { if (!ts.isSimpleCopiableExpression(rightExpression)) { thisArg = factory.createTempVariable(hoistVariableDeclaration); @@ -99131,11 +100152,11 @@ var ts; thisArg = rightExpression; } } - rightExpression = segment.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + rightExpression = segment.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.createPropertyAccessExpression(rightExpression, ts.visitNode(segment.name, visitor, ts.isIdentifier)) : factory.createElementAccessExpression(rightExpression, ts.visitNode(segment.argumentExpression, visitor, ts.isExpression)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (i === 0 && leftThisArg) { if (!ts.isGeneratedIdentifier(leftThisArg)) { leftThisArg = factory.cloneNode(leftThisArg); @@ -99196,7 +100217,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryExpression = node; if (ts.isLogicalOrCoalescingAssignmentExpression(binaryExpression)) { return transformLogicalAssignment(binaryExpression); @@ -99365,13 +100386,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ false); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99381,13 +100402,13 @@ var ts; switch (node.kind) { case 11 /* SyntaxKind.JsxText */: return visitJsxText(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ true); default: return ts.Debug.failBadSyntaxKind(node); @@ -99568,7 +100589,7 @@ var ts; var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote); return ts.setTextRange(literal, node); } - if (node.kind === 288 /* SyntaxKind.JsxExpression */) { + if (node.kind === 291 /* SyntaxKind.JsxExpression */) { if (node.expression === undefined) { return factory.createTrue(); } @@ -99669,7 +100690,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 278 /* SyntaxKind.JsxElement */) { + if (node.kind === 281 /* SyntaxKind.JsxElement */) { return getTagName(node.openingElement); } else { @@ -99976,7 +100997,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -100201,7 +101222,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return (hierarchyFacts & 8192 /* HierarchyFacts.ConstructorWithCapturedSuper */) !== 0 - && node.kind === 247 /* SyntaxKind.ReturnStatement */ + && node.kind === 250 /* SyntaxKind.ReturnStatement */ && !node.expression; } function isOrMayContainReturnCompletion(node) { @@ -100255,65 +101276,65 @@ var ts; switch (node.kind) { case 124 /* SyntaxKind.StaticKeyword */: return undefined; // elide static keyword - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return visitArrowFunction(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); case 79 /* SyntaxKind.Identifier */: return visitIdentifier(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return visitVariableDeclarationList(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node, /*isFunctionBody*/ false); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitBreakOrContinueStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*outermostLabeledStatement*/ undefined); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return visitComputedPropertyName(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: @@ -100324,30 +101345,30 @@ var ts; return visitStringLiteral(node); case 8 /* SyntaxKind.NumericLiteral */: return visitNumericLiteral(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return visitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return visitSpreadElement(node); case 106 /* SyntaxKind.SuperKeyword */: return visitSuperKeyword(/*isExpressionOfCall*/ false); case 108 /* SyntaxKind.ThisKeyword */: return visitThisKeyword(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return visitMetaProperty(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -100423,11 +101444,13 @@ var ts; return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context); } function visitIdentifier(node) { - if (!convertedLoopState) { - return node; + if (convertedLoopState) { + if (resolver.isArgumentsLocalBinding(node)) { + return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments")); + } } - if (resolver.isArgumentsLocalBinding(node)) { - return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments")); + if (node.hasExtendedUnicodeEscape) { + return ts.setOriginalNode(ts.setTextRange(factory.createIdentifier(ts.unescapeLeadingUnderscores(node.escapedText)), node), node); } return node; } @@ -100437,14 +101460,14 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 246 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; + var jump = node.kind === 249 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; var label = node.label; if (!label) { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Jump.Break */; labelMarker = "break"; } @@ -100455,7 +101478,7 @@ var ts; } } else { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { labelMarker = "break-".concat(label.escapedText); setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(label), labelMarker); } @@ -100511,7 +101534,7 @@ var ts; statements.push(statement); // Add an `export default` statement for default exports (for `--target es5 --module es6`) if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - var exportStatement = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) + var exportStatement = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? factory.createExportDefault(factory.getLocalName(node)) : factory.createExternalModuleExport(factory.getLocalName(node)); ts.setOriginalNode(exportStatement, statement); @@ -100880,11 +101903,11 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (statement.kind === 250 /* SyntaxKind.ReturnStatement */) { return true; } // An if-statement with two covered branches is covered. - else if (statement.kind === 239 /* SyntaxKind.IfStatement */) { + else if (statement.kind === 242 /* SyntaxKind.IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && @@ -100892,7 +101915,7 @@ var ts; } } // A block is covered if it has a last statement which is covered. - else if (statement.kind === 235 /* SyntaxKind.Block */) { + else if (statement.kind === 238 /* SyntaxKind.Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -101092,7 +102115,7 @@ var ts; * @param node A node. */ function insertCaptureThisForNodeIfNeeded(statements, node) { - if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 216 /* SyntaxKind.ArrowFunction */) { insertCaptureThisForNode(statements, node, factory.createThis()); return true; } @@ -101126,22 +102149,22 @@ var ts; if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */) { var newTarget = void 0; switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return statements; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Methods and accessors cannot be constructors, so 'new.target' will // always return 'undefined'. newTarget = factory.createVoidZero(); break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Class constructors can only be called with `new`, so `this.constructor` // should be relatively safe to use. newTarget = factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), "constructor"); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: // Functions can be called or constructed, and may have a `this` due to // being a member or when calling an imported function via `other_1.f()`. newTarget = factory.createConditionalExpression(factory.createLogicalAnd(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), factory.createBinaryExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), 102 /* SyntaxKind.InstanceOfKeyword */, factory.getLocalName(node))), @@ -101176,21 +102199,21 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Constructors are handled in visitClassExpression/visitClassDeclaration break; default: @@ -101389,7 +102412,7 @@ var ts; : enterSubtree(32670 /* HierarchyFacts.FunctionExcludes */, 65 /* HierarchyFacts.FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) { + if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) { name = factory.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 98304 /* HierarchyFacts.FunctionSubtreeExcludes */, 0 /* HierarchyFacts.None */); @@ -101435,7 +102458,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 214 /* SyntaxKind.ArrowFunction */); + ts.Debug.assert(node.kind === 216 /* SyntaxKind.ArrowFunction */); // To align with the old emitter, we use a synthetic end position on the location // for the statement list we synthesize when we down-level an arrow function with // an expression function body. This prevents both comments and source maps from @@ -101742,14 +102765,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -101935,7 +102958,7 @@ var ts; var property = properties[i]; if ((property.transformFlags & 1048576 /* TransformFlags.ContainsYield */ && hierarchyFacts & 4 /* HierarchyFacts.AsyncFunctionBody */) - || (hasComputed = ts.Debug.checkDefined(property.name).kind === 162 /* SyntaxKind.ComputedPropertyName */)) { + || (hasComputed = ts.Debug.checkDefined(property.name).kind === 164 /* SyntaxKind.ComputedPropertyName */)) { numInitialProperties = i; break; } @@ -102051,11 +103074,11 @@ var ts; } function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); - case 243 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); - case 244 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); - case 240 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); - case 241 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); + case 245 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); + case 246 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); + case 247 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); + case 243 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); + case 244 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected"); } } @@ -102080,11 +103103,11 @@ var ts; function createConvertedLoopState(node) { var loopInitializer; switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer && initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -102500,20 +103523,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine)); } break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -102620,7 +103643,7 @@ var ts; var updated; var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { updated = factory.updateGetAccessorDeclaration(node, node.modifiers, node.name, parameters, node.type, body); } else { @@ -103080,13 +104103,13 @@ var ts; if ((enabledSubstitutions & 1 /* ES2015SubstitutionFlags.CapturedThis */) === 0) { enabledSubstitutions |= 1 /* ES2015SubstitutionFlags.CapturedThis */; context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(214 /* SyntaxKind.ArrowFunction */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(216 /* SyntaxKind.ArrowFunction */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); } } /** @@ -103127,10 +104150,10 @@ var ts; */ function isNameOfDeclarationWithCollidingName(node) { switch (node.parent.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return node.parent.name === node && resolver.isDeclarationWithCollidingName(node.parent); } @@ -103212,11 +104235,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 238 /* SyntaxKind.ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 241 /* SyntaxKind.ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -103224,7 +104247,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 227 /* SyntaxKind.SpreadElement */) { return false; } var expression = callArgument.expression; @@ -103250,15 +104273,15 @@ var ts; if (compilerOptions.jsx === 1 /* JsxEmit.Preserve */ || compilerOptions.jsx === 3 /* JsxEmit.ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(280 /* SyntaxKind.JsxOpeningElement */); - context.enableEmitNotification(281 /* SyntaxKind.JsxClosingElement */); - context.enableEmitNotification(279 /* SyntaxKind.JsxSelfClosingElement */); + context.enableEmitNotification(283 /* SyntaxKind.JsxOpeningElement */); + context.enableEmitNotification(284 /* SyntaxKind.JsxClosingElement */); + context.enableEmitNotification(282 /* SyntaxKind.JsxSelfClosingElement */); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(296 /* SyntaxKind.PropertyAssignment */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(299 /* SyntaxKind.PropertyAssignment */); return ts.chainBundle(context, transformSourceFile); /** * Transforms an ES5 source file to ES3. @@ -103277,9 +104300,9 @@ var ts; */ function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -103614,13 +104637,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -103633,24 +104656,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return visitBreakStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 1048576 /* TransformFlags.ContainsYield */) { @@ -103671,23 +104694,23 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return visitConditionalExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -103700,9 +104723,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -103909,7 +104932,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // [source] // a.b = yield; // @@ -103921,7 +104944,7 @@ var ts; // _a.b = %sent%; target = factory.updatePropertyAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // [source] // a[b] = yield; // @@ -104315,35 +105338,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return transformAndEmitBlock(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return transformAndEmitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return transformAndEmitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return transformAndEmitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return transformAndEmitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return transformAndEmitForInStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return transformAndEmitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return transformAndEmitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return transformAndEmitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return transformAndEmitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return transformAndEmitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -104574,7 +105597,6 @@ var ts; return node; } function transformAndEmitForInStatement(node) { - // TODO(rbuckton): Source map locations if (containsYield(node)) { // [source] // for (var p in o) { @@ -104582,34 +105604,41 @@ var ts; // } // // [intermediate] - // .local _a, _b, _i - // _a = []; - // for (_b in o) _a.push(_b); + // .local _b, _a, _c, _i + // _b = []; + // _a = o; + // for (_c in _a) _b.push(_c); // _i = 0; // .loop incrementLabel, endLoopLabel // .mark conditionLabel - // .brfalse endLoopLabel, (_i < _a.length) - // p = _a[_i]; + // .brfalse endLoopLabel, (_i < _b.length) + // _c = _b[_i]; + // .brfalse incrementLabel, (_c in _a) + // p = _c; // /*body*/ // .mark incrementLabel - // _b++; + // _c++; // .br conditionLabel // .endloop // .mark endLoopLabel - var keysArray = declareLocal(); // _a - var key = declareLocal(); // _b + var obj = declareLocal(); // _a + var keysArray = declareLocal(); // _b + var key = declareLocal(); // _c var keysIndex = factory.createLoopVariable(); // _i var initializer = node.initializer; hoistVariableDeclaration(keysIndex); + emitAssignment(obj, ts.visitNode(node.expression, visitor, ts.isExpression)); emitAssignment(keysArray, factory.createArrayLiteralExpression()); - emitStatement(factory.createForInStatement(key, ts.visitNode(node.expression, visitor, ts.isExpression), factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"), + emitStatement(factory.createForInStatement(key, obj, factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"), /*typeArguments*/ undefined, [key])))); emitAssignment(keysIndex, factory.createNumericLiteral(0)); var conditionLabel = defineLabel(); var incrementLabel = defineLabel(); - var endLabel = beginLoopBlock(incrementLabel); + var endLoopLabel = beginLoopBlock(incrementLabel); markLabel(conditionLabel); - emitBreakWhenFalse(endLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length"))); + emitBreakWhenFalse(endLoopLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length"))); + emitAssignment(key, factory.createElementAccessExpression(keysArray, keysIndex)); + emitBreakWhenFalse(incrementLabel, factory.createBinaryExpression(key, 101 /* SyntaxKind.InKeyword */, obj)); var variable = void 0; if (ts.isVariableDeclarationList(initializer)) { for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { @@ -104622,7 +105651,7 @@ var ts; variable = ts.visitNode(initializer, visitor, ts.isExpression); ts.Debug.assert(ts.isLeftHandSideExpression(variable)); } - emitAssignment(variable, factory.createElementAccessExpression(keysArray, keysIndex)); + emitAssignment(variable, key); transformAndEmitEmbeddedStatement(node.statement); markLabel(incrementLabel); emitStatement(factory.createExpressionStatement(factory.createPostfixIncrement(keysIndex))); @@ -104773,7 +105802,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -104786,7 +105815,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -105946,12 +106975,12 @@ var ts; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. - context.enableSubstitution(210 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(212 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. @@ -106279,23 +107308,23 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -106308,26 +107337,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node) && currentSourceFile.impliedNodeFormat === undefined) { return visitImportCallExpression(node); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -106343,24 +107372,24 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var elem = _a[_i]; switch (elem.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (destructuringNeedsFlattening(elem.initializer)) { return true; } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (destructuringNeedsFlattening(elem.name)) { return true; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: if (destructuringNeedsFlattening(elem.expression)) { return true; } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return false; default: ts.Debug.assertNever(elem, "Unhandled object member kind"); } @@ -106463,7 +107492,7 @@ var ts; return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis); case ts.ModuleKind.CommonJS: default: - return createImportCallExpressionCommonJS(argument, containsLexicalThis); + return createImportCallExpressionCommonJS(argument); } } function createImportCallExpressionUMD(arg, containsLexicalThis) { @@ -106486,7 +107515,7 @@ var ts; return factory.createConditionalExpression( /*condition*/ factory.createIdentifier("__syncRequire"), /*questionToken*/ undefined, - /*whenTrue*/ createImportCallExpressionCommonJS(arg, containsLexicalThis), + /*whenTrue*/ createImportCallExpressionCommonJS(arg), /*colonToken*/ undefined, /*whenFalse*/ createImportCallExpressionAMD(argClone, containsLexicalThis)); } @@ -106495,7 +107524,7 @@ var ts; return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression( /*condition*/ factory.createIdentifier("__syncRequire"), /*questionToken*/ undefined, - /*whenTrue*/ createImportCallExpressionCommonJS(temp, containsLexicalThis), + /*whenTrue*/ createImportCallExpressionCommonJS(temp, /* isInlineable */ true), /*colonToken*/ undefined, /*whenFalse*/ createImportCallExpressionAMD(temp, containsLexicalThis))); } @@ -106545,14 +107574,20 @@ var ts; } return promise; } - function createImportCallExpressionCommonJS(arg, containsLexicalThis) { - // import("./blah") + function createImportCallExpressionCommonJS(arg, isInlineable) { + // import(x) // emit as - // Promise.resolve().then(function () { return require(x); }) /*CommonJs Require*/ + // var _a; + // (_a = x, Promise.resolve().then(() => require(_a)) /*CommonJs Require*/ // We have to wrap require in then callback so that require is done in asynchronously // if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately - var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []); - var requireCall = factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []); + // If the arg is not inlineable, we have to evaluate it in the current scope with a temp var + var temp = arg && !ts.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined; + var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), + /*typeArguments*/ undefined, + /*argumentsArray*/ []); + var requireCall = factory.createCallExpression(factory.createIdentifier("require"), + /*typeArguments*/ undefined, temp ? [temp] : arg ? [arg] : []); if (ts.getESModuleInterop(compilerOptions)) { requireCall = emitHelpers().createImportStarHelper(requireCall); } @@ -106573,14 +107608,9 @@ var ts; /*typeParameters*/ undefined, /*parameters*/ [], /*type*/ undefined, factory.createBlock([factory.createReturnStatement(requireCall)])); - // if there is a lexical 'this' in the import call arguments, ensure we indicate - // that this new function expression indicates it captures 'this' so that the - // es2015 transformer will properly substitute 'this' with '_this'. - if (containsLexicalThis) { - ts.setEmitFlags(func, 8 /* EmitFlags.CapturesThis */); - } } - return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]); + var downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]); + return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]); } function getHelperExpressionForExport(node, innerExpr) { if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864 /* EmitFlags.NeverApplyImportHelper */) { @@ -106946,7 +107976,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -107001,10 +108031,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding, /* liveBinding */ true); @@ -107088,7 +108118,7 @@ var ts; return statements; } if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); statements = appendExportStatement(statements, exportName, factory.getLocalName(decl), /*location*/ decl); } if (decl.name) { @@ -107217,7 +108247,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; previousOnEmitNode(hint, node, emitCallback); @@ -107279,11 +108309,11 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return substituteTaggedTemplateExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); } return node; @@ -107327,7 +108357,7 @@ var ts; } else if (!(ts.isGeneratedIdentifier(node) && !(node.autoGenerateFlags & 64 /* GeneratedIdentifierFlags.AllowNameSubstitution */)) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(node)), /*location*/ node); } @@ -107417,10 +108447,10 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(231 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(233 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var exportFunctionsMap = []; // The export function associated with a source file. @@ -107610,7 +108640,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var exportStarFunction = addExportStarIfNeeded(statements); // TODO: GH#18217 var modifiers = node.transformFlags & 2097152 /* TransformFlags.ContainsAwait */ ? - factory.createModifiersFromModifierFlags(256 /* ModifierFlags.Async */) : + factory.createModifiersFromModifierFlags(512 /* ModifierFlags.Async */) : undefined; var moduleObject = factory.createObjectLiteralExpression([ factory.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), @@ -107644,7 +108674,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 272 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 275 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -107733,19 +108763,26 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(factory, entry, currentSourceFile); // TODO: GH#18217 switch (entry.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName))); + if (ts.hasSyntacticModifier(entry, 1 /* ModifierFlags.Export */)) { + statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction, + /*typeArguments*/ undefined, [ + factory.createStringLiteral(ts.idText(importVariableName)), + parameterName, + ]))); + } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { if (ts.isNamedExports(entry.exportClause)) { @@ -107804,13 +108841,13 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); default: return topLevelNestedVisitor(node); @@ -107989,7 +109026,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 2097152 /* EmitFlags.NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 305 /* SyntaxKind.SourceFile */ + && (enclosingBlockScopedContainer.kind === 308 /* SyntaxKind.SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* NodeFlags.BlockScoped */) === 0); } /** @@ -108053,7 +109090,7 @@ var ts; // // To balance the declaration, we defer the exports of the elided variable // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasSyntacticModifier(node.original, 1 /* ModifierFlags.Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -108115,10 +109152,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -108213,7 +109250,7 @@ var ts; } var excludeName; if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; statements = appendExportStatement(statements, exportName, factory.getLocalName(decl)); excludeName = ts.getTextOfIdentifierOrLiteral(exportName); } @@ -108298,43 +109335,43 @@ var ts; */ function topLevelNestedVisitor(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ true); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return visitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return visitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return visitDefaultClause(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return visitTryStatement(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -108520,26 +109557,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node)) { return visitImportCallExpression(node); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -108619,7 +109656,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 305 /* SyntaxKind.SourceFile */; + return container !== undefined && container.kind === 308 /* SyntaxKind.SourceFile */; } else { return false; @@ -108697,7 +109734,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -108747,7 +109784,7 @@ var ts; */ function substituteUnspecified(node) { switch (node.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return substituteShorthandPropertyAssignment(node); } return node; @@ -108784,9 +109821,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return substituteMetaProperty(node); } return node; @@ -108876,7 +109913,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { exportedNames = ts.append(exportedNames, factory.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -108919,7 +109956,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); context.enableSubstitution(79 /* SyntaxKind.Identifier */); var helperNameSubstitutions; var currentSourceFile; @@ -108959,14 +109996,14 @@ var ts; } function visitor(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // Though an error in es2020 modules, in node-flavor es2020 modules, we can helpfully transform this to a synthetic `require` call // To give easy access to a synchronous `require` in node-flavor esm. We do the transform even in scenarios where we error, but `import.meta.url` // is available, just because the output is reasonable for a node-like runtime. return ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.Node16 ? visitImportEqualsDeclaration(node) : undefined; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDecl = node; return visitExportDeclaration(exportDecl); } @@ -109123,8 +110160,8 @@ var ts; var cjsOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(305 /* SyntaxKind.SourceFile */); - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableSubstitution(308 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); var currentSourceFile; return transformSourceFileOrBundle; function onSubstituteNode(hint, node) { @@ -109171,7 +110208,7 @@ var ts; return result; } function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -109231,7 +110268,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109260,7 +110297,7 @@ var ts; ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109307,7 +110344,7 @@ var ts; return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: ".concat(ts.Debug.formatSyntaxKind(node.kind))); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109316,8 +110353,8 @@ var ts; } // This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit // The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all. - else if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 166 /* SyntaxKind.PropertySignature */ || - (node.kind === 164 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { + else if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 168 /* SyntaxKind.PropertySignature */ || + (node.kind === 166 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { // TODO(jfreeman): Deal with computed properties in error reporting. if (ts.isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? @@ -109326,7 +110363,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 166 /* SyntaxKind.Parameter */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109351,7 +110388,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Getters can infer the return type from the returned expression, but setters cannot, so the // "_from_external_module_1_but_cannot_be_named" case cannot occur. if (ts.isStatic(node)) { @@ -109390,26 +110427,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109417,7 +110454,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109431,7 +110468,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109456,30 +110493,30 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109487,7 +110524,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109500,15 +110537,15 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 256 /* SyntaxKind.FunctionDeclaration */: - case 179 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109522,39 +110559,39 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1; break; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 179 /* SyntaxKind.FunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -109620,7 +110657,7 @@ var ts; } function isInternalDeclaration(node, currentSourceFile) { var parseTreeNode = ts.getParseTreeNode(node); - if (parseTreeNode && parseTreeNode.kind === 164 /* SyntaxKind.Parameter */) { + if (parseTreeNode && parseTreeNode.kind === 166 /* SyntaxKind.Parameter */) { var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode); var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined; var text = currentSourceFile.text; @@ -109796,7 +110833,7 @@ var ts; var _a; var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; }); var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; }); - if (augmentingDeclarations) { + if (primaryDeclaration && augmentingDeclarations) { for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) { var augmentations = augmentingDeclarations_1[_i]; context.addDiagnostic(ts.addRelatedInfo(ts.createDiagnosticForNode(augmentations, ts.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts.createDiagnosticForNode(primaryDeclaration, ts.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file))); @@ -109826,10 +110863,10 @@ var ts; return result; } function transformRoot(node) { - if (node.kind === 305 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { + if (node.kind === 308 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { return node; } - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { isBundledEmit = true; refs = new ts.Map(); libs = new ts.Map(); @@ -109852,14 +110889,14 @@ var ts; resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) needsDeclare = false; var statements = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile, /*bundled*/ true)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); + var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); return newFile; } needsDeclare = true; var updated = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); return factory.updateSourceFile(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); }), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal); hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib; collectReferences(sourceFile, refs); @@ -110000,7 +111037,7 @@ var ts; return name; } else { - if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { return factory.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -110008,7 +111045,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (elem.kind === 229 /* SyntaxKind.OmittedExpression */) { return elem; } if (elem.propertyName && ts.isIdentifier(elem.propertyName) && ts.isIdentifier(elem.name) && !elem.symbol.isReferenced) { @@ -110050,19 +111087,19 @@ var ts; // Literal const declarations will have an initializer ensured rather than a type return; } - var shouldUseResolverType = node.kind === 164 /* SyntaxKind.Parameter */ && + var shouldUseResolverType = node.kind === 166 /* SyntaxKind.Parameter */ && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); if (type && !shouldUseResolverType) { return ts.visitNode(type, visitDeclarationSubtree); } if (!ts.getParseTreeNode(node)) { - return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now // (The inferred type here will be void, but the old declaration emitter printed `any`, so this replicates that) - return factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } errorNameNode = node.name; var oldDiag; @@ -110070,12 +111107,12 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } - if (node.kind === 164 /* SyntaxKind.Parameter */ - || node.kind === 167 /* SyntaxKind.PropertyDeclaration */ - || node.kind === 166 /* SyntaxKind.PropertySignature */) { + if (node.kind === 166 /* SyntaxKind.Parameter */ + || node.kind === 169 /* SyntaxKind.PropertyDeclaration */ + || node.kind === 168 /* SyntaxKind.PropertySignature */) { if (ts.isPropertySignature(node) || !node.initializer) return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType)); return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); @@ -110086,28 +111123,28 @@ var ts; if (!suppressNewDiagnosticContexts) { getSymbolAccessibilityDiagnostic = oldDiag; } - return returnValue || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return returnValue || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return !resolver.isDeclarationVisible(node); // The following should be doing their own visibility checks based on filtering their members - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !getBindingNameVisible(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; } return false; @@ -110196,7 +111233,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return undefined; // TODO: GH#18217 - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 200 /* SyntaxKind.ImportType */); + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 202 /* SyntaxKind.ImportType */); if (ts.isStringLiteralLike(input)) { if (isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); @@ -110216,7 +111253,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (decl.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // Rewrite external module names if necessary var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return factory.updateImportEqualsDeclaration(decl, decl.modifiers, decl.isTypeOnly, decl.name, factory.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))); @@ -110241,7 +111278,7 @@ var ts; return visibleDefaultBinding && factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); } - if (decl.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (decl.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // Namespace import (optionally with visible default) var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined; return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined; @@ -110344,7 +111381,7 @@ var ts; // We'd see a TDZ violation at runtime var canProduceDiagnostic = ts.canProduceDiagnostics(input); var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 182 /* SyntaxKind.TypeLiteral */ || input.kind === 195 /* SyntaxKind.MappedType */) && input.parent.kind !== 259 /* SyntaxKind.TypeAliasDeclaration */); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 184 /* SyntaxKind.TypeLiteral */ || input.kind === 197 /* SyntaxKind.MappedType */) && input.parent.kind !== 262 /* SyntaxKind.TypeAliasDeclaration */); // Emit methods which are private as properties with no type information if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) { if (ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)) { @@ -110365,28 +111402,28 @@ var ts; } if (isProcessedComponent(input)) { switch (input.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments)); } - case 178 /* SyntaxKind.TypeReference */: { + case 180 /* SyntaxKind.TypeReference */: { checkEntityNameVisibility(input.typeName, enclosingDeclaration); var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); } - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return cleanup(factory.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { // A constructor declaration may not have a type annotation var ctor = factory.createConstructorDeclaration( /*modifiers*/ ensureModifiers(input), updateParamsList(input, input.parameters, 0 /* ModifierFlags.None */), /*body*/ undefined); return cleanup(ctor); } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110395,7 +111432,7 @@ var ts; /*body*/ undefined); return cleanup(sig); } - case 172 /* SyntaxKind.GetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110403,36 +111440,36 @@ var ts; return cleanup(factory.updateGetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), ensureType(input, accessorType), /*body*/ undefined)); } - case 173 /* SyntaxKind.SetAccessor */: { + case 175 /* SyntaxKind.SetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateSetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), /*body*/ undefined)); } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertyDeclaration(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type), ensureNoInitializer(input))); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type))); - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateMethodSignature(input, ensureModifiers(input), input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { return cleanup(factory.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 176 /* SyntaxKind.IndexSignature */: { - return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */))); + case 178 /* SyntaxKind.IndexSignature */: { + return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */))); } - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -110440,13 +111477,13 @@ var ts; suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types return cleanup(factory.updateVariableDeclaration(input, input.name, /*exclamationToken*/ undefined, ensureType(input, input.type), ensureNoInitializer(input))); } - case 163 /* SyntaxKind.TypeParameter */: { + case 165 /* SyntaxKind.TypeParameter */: { if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) { return cleanup(factory.updateTypeParameterDeclaration(input, input.modifiers, input.name, /*constraint*/ undefined, /*defaultType*/ undefined)); } return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context)); } - case 189 /* SyntaxKind.ConditionalType */: { + case 191 /* SyntaxKind.ConditionalType */: { // We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration // just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type. var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree); @@ -110458,13 +111495,13 @@ var ts; var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree); return cleanup(factory.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); } - case 179 /* SyntaxKind.FunctionType */: { + case 181 /* SyntaxKind.FunctionType */: { return cleanup(factory.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 180 /* SyntaxKind.ConstructorType */: { + case 182 /* SyntaxKind.ConstructorType */: { return cleanup(factory.updateConstructorTypeNode(input, ensureModifiers(input), ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 200 /* SyntaxKind.ImportType */: { + case 202 /* SyntaxKind.ImportType */: { if (!ts.isLiteralImportTypeNode(input)) return cleanup(input); return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); @@ -110496,7 +111533,7 @@ var ts; } } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); + return node.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); } function visitDeclarationStatements(input) { if (!isPreservedDeclarationStatement(input)) { @@ -110506,7 +111543,7 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -110515,7 +111552,7 @@ var ts; // Rewrite external module names if necessary return factory.updateExportDeclaration(input, input.modifiers, input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), ts.getResolutionModeOverrideForClause(input.assertClause) ? input.assertClause : undefined); } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { // Always visible if the parent node isn't dropped for being not visible if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; @@ -110533,7 +111570,7 @@ var ts; errorFallbackNode = input; var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); errorFallbackNode = undefined; - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); preserveJsDoc(statement, input); ts.removeAllComments(input); return [statement, factory.updateExportAssignment(input, input.modifiers, newId)]; @@ -110546,12 +111583,12 @@ var ts; return input; } function stripExportModifiers(statement) { - if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 512 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { + if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 1024 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { // `export import` statements should remain as-is, as imports are _not_ implicitly exported in an ambient namespace // Likewise, `export default` classes and the like and just be `default`, so we preserve their `export` modifiers, too return statement; } - var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (257023 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); + var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (258047 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); return factory.updateModifiers(statement, modifiers); } function transformTopLevelDeclaration(input) { @@ -110562,10 +111599,10 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { return transformImportEqualsDeclaration(input); } - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { return transformImportDeclaration(input); } } @@ -110586,12 +111623,16 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 259 /* SyntaxKind.TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all - return cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 258 /* SyntaxKind.InterfaceDeclaration */: { + case 262 /* SyntaxKind.TypeAliasDeclaration */: { + needsDeclare = false; + var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); + needsDeclare = previousNeedsDeclare; + return clean; + } + case 261 /* SyntaxKind.InterfaceDeclaration */: { return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { // Generators lose their generator-ness, excepting their return type var clean = cleanup(factory.updateFunctionDeclaration(input, ensureModifiers(input), /*asteriskToken*/ undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), @@ -110632,10 +111673,10 @@ var ts; })))); } var namespaceDecl = factory.createModuleDeclaration(ensureModifiers(input), input.name, factory.createModuleBlock(declarations), 16 /* NodeFlags.Namespace */); - if (!ts.hasEffectiveModifier(clean, 512 /* ModifierFlags.Default */)) { + if (!ts.hasEffectiveModifier(clean, 1024 /* ModifierFlags.Default */)) { return [clean, namespaceDecl]; } - var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~513 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); + var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~1025 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); var cleanDeclaration = factory.updateFunctionDeclaration(clean, modifiers, /*asteriskToken*/ undefined, clean.name, clean.typeParameters, clean.parameters, clean.type, /*body*/ undefined); @@ -110653,10 +111694,10 @@ var ts; return clean; } } - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 264 /* SyntaxKind.ModuleDeclaration */: { needsDeclare = false; var inner = input.body; - if (inner && inner.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (inner && inner.kind === 265 /* SyntaxKind.ModuleBlock */) { var oldNeedsScopeFix = needsScopeFixMarker; var oldHasScopeFix = resultHasScopeMarker; resultHasScopeMarker = false; @@ -110697,7 +111738,7 @@ var ts; return cleanup(factory.updateModuleDeclaration(input, mods, input.name, body)); } } - case 257 /* SyntaxKind.ClassDeclaration */: { + case 260 /* SyntaxKind.ClassDeclaration */: { errorNameNode = input.name; errorFallbackNode = input; var modifiers = factory.createNodeArray(ensureModifiers(input)); @@ -110759,7 +111800,7 @@ var ts; typeName: input.name }); }; var varDecl = factory.createVariableDeclaration(newId_1, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); var heritageClauses = factory.createNodeArray(ts.map(input.heritageClauses, function (clause) { if (clause.token === 94 /* SyntaxKind.ExtendsKeyword */) { var oldDiag_2 = getSymbolAccessibilityDiagnostic; @@ -110777,10 +111818,10 @@ var ts; return cleanup(factory.updateClassDeclaration(input, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { return cleanup(transformVariableStatement(input)); } - case 260 /* SyntaxKind.EnumDeclaration */: { + case 263 /* SyntaxKind.EnumDeclaration */: { return cleanup(factory.updateEnumDeclaration(input, factory.createNodeArray(ensureModifiers(input)), input.name, factory.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -110799,7 +111840,7 @@ var ts; if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - if (input.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (input.kind === 264 /* SyntaxKind.ModuleDeclaration */) { needsDeclare = previousNeedsDeclare; } if (node === input) { @@ -110822,7 +111863,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (e.kind === 229 /* SyntaxKind.OmittedExpression */) { return; } if (e.name) { @@ -110870,9 +111911,9 @@ var ts; return factory.createModifiersFromModifierFlags(newFlags); } function ensureModifierFlags(node) { - var mask = 257023 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 256 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files + var mask = 258047 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 512 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* ModifierFlags.Ambient */ : 0 /* ModifierFlags.None */; - var parentIsFile = node.parent.kind === 305 /* SyntaxKind.SourceFile */; + var parentIsFile = node.parent.kind === 308 /* SyntaxKind.SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= 2 /* ModifierFlags.Ambient */; additions = 0 /* ModifierFlags.None */; @@ -110901,7 +111942,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return true; } return false; @@ -110911,22 +111952,22 @@ var ts; return ts.factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); } function maskModifierFlags(node, modifierMask, modifierAdditions) { - if (modifierMask === void 0) { modifierMask = 257023 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } + if (modifierMask === void 0) { modifierMask = 258047 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } if (modifierAdditions === void 0) { modifierAdditions = 0 /* ModifierFlags.None */; } var flags = (ts.getEffectiveModifierFlags(node) & modifierMask) | modifierAdditions; - if (flags & 512 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { + if (flags & 1024 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { // A non-exported default is a nonsequitor - we usually try to remove all export modifiers // from statements in ambient declarations; but a default export must retain its export modifier to be syntactically valid flags ^= 1 /* ModifierFlags.Export */; } - if (flags & 512 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { + if (flags & 1024 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { flags ^= 2 /* ModifierFlags.Ambient */; // `declare` is never required alongside `default` (and would be an error if printed) } return flags; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 172 /* SyntaxKind.GetAccessor */ + return accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -110935,52 +111976,52 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return !ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */); - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } return false; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return true; } return false; } function isProcessedComponent(node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 254 /* SyntaxKind.VariableDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: - case 189 /* SyntaxKind.ConditionalType */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 200 /* SyntaxKind.ImportType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 191 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 202 /* SyntaxKind.ImportType */: return true; } return false; @@ -111120,7 +112161,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, factory, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(355 /* SyntaxKind.Count */); + var enabledSyntaxKindFeatures = new Array(358 /* SyntaxKind.Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentStatements; @@ -111202,7 +112243,7 @@ var ts; var transformed = []; for (var _a = 0, nodes_3 = nodes; _a < nodes_3.length; _a++) { var node = nodes_3[_a]; - ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 305 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); + ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 308 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); transformed.push((allowDtsFiles ? transformation : transformRoot)(node)); ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop(); } @@ -111608,7 +112649,7 @@ var ts; /*@internal*/ function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 306 /* SyntaxKind.Bundle */) { + if (sourceFile.kind === 309 /* SyntaxKind.Bundle */) { return getOutputPathsForBundle(options, forceDtsPaths); } else { @@ -111977,8 +113018,8 @@ var ts; } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) { var sourceFileOrBundle = transform.transformed[0]; - var bundle = sourceFileOrBundle.kind === 306 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 309 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; var sourceMapGenerator; if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) { @@ -112028,7 +113069,7 @@ var ts; } function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) { return (mapOptions.sourceMap || mapOptions.inlineSourceMap) - && (sourceFileOrBundle.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); + && (sourceFileOrBundle.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); } function getSourceRoot(mapOptions) { // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the @@ -112091,8 +113132,8 @@ var ts; } ts.getBuildInfoText = getBuildInfoText; /*@internal*/ - function getBuildInfo(buildInfoText) { - return JSON.parse(buildInfoText); + function getBuildInfo(buildInfoFile, buildInfoText) { + return ts.readJsonOrUndefined(buildInfoFile, buildInfoText); } ts.getBuildInfo = getBuildInfo; /*@internal*/ @@ -112170,17 +113211,16 @@ var ts; var buildInfo; if (host.getBuildInfo) { // If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo - var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); - if (!hostBuildInfo) - return buildInfoPath; - buildInfo = hostBuildInfo; + buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); } else { var buildInfoText = host.readFile(buildInfoPath); if (!buildInfoText) return buildInfoPath; - buildInfo = getBuildInfo(buildInfoText); + buildInfo = getBuildInfo(buildInfoPath, buildInfoText); } + if (!buildInfo) + return buildInfoPath; if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts)) return buildInfoPath; var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath)); @@ -112306,6 +113346,10 @@ var ts; var nodeIdToGeneratedName; // Map of generated names for specific nodes. var autoGeneratedIdToGeneratedName; // Map of generated names for temp and loop variables. var generatedNames; // Set of names generated by the NameGenerator. + var formattedNameTempFlagsStack; + var formattedNameTempFlags; + var privateNameTempFlagsStack; // Stack of enclosing name generation scopes. + var privateNameTempFlags; // TempFlags for the current name generation scope. var tempFlagsStack; // Stack of enclosing name generation scopes. var tempFlags; // TempFlags for the current name generation scope. var reservedNamesStack; // Stack of TempFlags reserved in enclosing name generation scopes. @@ -112371,9 +113415,9 @@ var ts; break; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: return printFile(node); - case 306 /* SyntaxKind.Bundle */: return printBundle(node); - case 307 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); + case 308 /* SyntaxKind.SourceFile */: return printFile(node); + case 309 /* SyntaxKind.Bundle */: return printBundle(node); + case 310 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -112564,6 +113608,10 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNames = new ts.Set(); + formattedNameTempFlagsStack = []; + formattedNameTempFlags = new ts.Map(); + privateNameTempFlagsStack = []; + privateNameTempFlags = 0 /* TempFlags.Auto */; tempFlagsStack = []; tempFlags = 0 /* TempFlags.Auto */; reservedNamesStack = []; @@ -112707,315 +113755,315 @@ var ts; return emitPrivateIdentifier(node); // Parse tree nodes // Names - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return emitQualifiedName(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return emitComputedPropertyName(node); // Signature elements - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return emitTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return emitParameter(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return emitDecorator(node); // Type members - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return emitPropertySignature(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return emitPropertyDeclaration(node); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return emitMethodSignature(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return emitMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return emitClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return emitConstructor(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return emitAccessorDeclaration(node); - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return emitCallSignature(node); - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return emitConstructSignature(node); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return emitIndexSignature(node); // Types - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return emitTypePredicate(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return emitTypeReference(node); - case 179 /* SyntaxKind.FunctionType */: + case 181 /* SyntaxKind.FunctionType */: return emitFunctionType(node); - case 180 /* SyntaxKind.ConstructorType */: + case 182 /* SyntaxKind.ConstructorType */: return emitConstructorType(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return emitTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return emitTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return emitArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return emitTupleType(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return emitOptionalType(node); // SyntaxKind.RestType is handled below - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return emitUnionType(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return emitIntersectionType(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return emitConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return emitInferType(node); - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return emitParenthesizedType(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return emitThisType(); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return emitTypeOperator(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return emitIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return emitMappedType(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return emitLiteralType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return emitNamedTupleMember(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return emitTemplateType(node); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return emitTemplateTypeSpan(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return emitImportTypeNode(node); // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return emitBindingElement(node); // Misc - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return emitTemplateSpan(node); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return emitBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return emitVariableStatement(node); - case 236 /* SyntaxKind.EmptyStatement */: + case 239 /* SyntaxKind.EmptyStatement */: return emitEmptyStatement(/*isEmbeddedStatement*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return emitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return emitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return emitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return emitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return emitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return emitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return emitForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return emitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return emitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return emitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return emitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return emitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return emitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return emitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return emitTryStatement(node); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return emitVariableDeclaration(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return emitVariableDeclarationList(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return emitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return emitClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return emitEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return emitModuleDeclaration(node); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return emitModuleBlock(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return emitCaseBlock(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return emitNamespaceExportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return emitImportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return emitImportClause(node); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return emitNamespaceImport(node); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return emitNamespaceExport(node); - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: return emitNamedImports(node); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return emitImportSpecifier(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return emitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return emitExportDeclaration(node); - case 273 /* SyntaxKind.NamedExports */: + case 276 /* SyntaxKind.NamedExports */: return emitNamedExports(node); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return emitExportSpecifier(node); - case 293 /* SyntaxKind.AssertClause */: + case 296 /* SyntaxKind.AssertClause */: return emitAssertClause(node); - case 294 /* SyntaxKind.AssertEntry */: + case 297 /* SyntaxKind.AssertEntry */: return emitAssertEntry(node); - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return; // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 11 /* SyntaxKind.JsxText */: return emitJsxText(node); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: return emitJsxOpeningElementOrFragment(node); - case 281 /* SyntaxKind.JsxClosingElement */: - case 284 /* SyntaxKind.JsxClosingFragment */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 287 /* SyntaxKind.JsxClosingFragment */: return emitJsxClosingElementOrFragment(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return emitJsxAttribute(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return emitJsxAttributes(node); - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return emitJsxExpression(node); // Clauses - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return emitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return emitDefaultClause(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return emitHeritageClause(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return emitCatchClause(node); // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return emitPropertyAssignment(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return emitEnumMember(node); // Unparsed - case 300 /* SyntaxKind.UnparsedPrologue */: + case 303 /* SyntaxKind.UnparsedPrologue */: return writeUnparsedNode(node); - case 307 /* SyntaxKind.UnparsedSource */: - case 301 /* SyntaxKind.UnparsedPrepend */: + case 310 /* SyntaxKind.UnparsedSource */: + case 304 /* SyntaxKind.UnparsedPrepend */: return emitUnparsedSourceOrPrepend(node); - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return emitUnparsedTextLike(node); - case 304 /* SyntaxKind.UnparsedSyntheticReference */: + case 307 /* SyntaxKind.UnparsedSyntheticReference */: return emitUnparsedSyntheticReference(node); // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return emitSourceFile(node); - case 306 /* SyntaxKind.Bundle */: + case 309 /* SyntaxKind.Bundle */: return ts.Debug.fail("Bundles should be printed using printBundle"); // SyntaxKind.UnparsedSource (handled above) - case 308 /* SyntaxKind.InputFiles */: + case 311 /* SyntaxKind.InputFiles */: return ts.Debug.fail("InputFiles should not be printed"); // JSDoc nodes (only used in codefixes currently) - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return emitJSDocTypeExpression(node); - case 310 /* SyntaxKind.JSDocNameReference */: + case 313 /* SyntaxKind.JSDocNameReference */: return emitJSDocNameReference(node); - case 312 /* SyntaxKind.JSDocAllType */: + case 315 /* SyntaxKind.JSDocAllType */: return writePunctuation("*"); - case 313 /* SyntaxKind.JSDocUnknownType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return writePunctuation("?"); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return emitJSDocNullableType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return emitJSDocOptionalType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return emitJSDocFunctionType(node); - case 186 /* SyntaxKind.RestType */: - case 318 /* SyntaxKind.JSDocVariadicType */: + case 188 /* SyntaxKind.RestType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return emitRestOrJSDocVariadicType(node); - case 319 /* SyntaxKind.JSDocNamepathType */: + case 322 /* SyntaxKind.JSDocNamepathType */: return; - case 320 /* SyntaxKind.JSDoc */: + case 323 /* SyntaxKind.JSDoc */: return emitJSDoc(node); - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: return emitJSDocTypeLiteral(node); - case 323 /* SyntaxKind.JSDocSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return emitJSDocSignature(node); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 337 /* SyntaxKind.JSDocOverrideTag */: + case 330 /* SyntaxKind.JSDocTag */: + case 335 /* SyntaxKind.JSDocClassTag */: + case 340 /* SyntaxKind.JSDocOverrideTag */: return emitJSDocSimpleTag(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return emitJSDocHeritageTag(node); - case 330 /* SyntaxKind.JSDocAuthorTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: + case 333 /* SyntaxKind.JSDocAuthorTag */: + case 334 /* SyntaxKind.JSDocDeprecatedTag */: return; // SyntaxKind.JSDocClassTag (see JSDocTag, above) - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 339 /* SyntaxKind.JSDocReadonlyTag */: return; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return emitJSDocCallbackTag(node); // SyntaxKind.JSDocEnumTag (see below) - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return emitJSDocPropertyLikeTag(node); - case 339 /* SyntaxKind.JSDocEnumTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return emitJSDocSimpleTypedTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return emitJSDocTemplateTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return emitJSDocTypedefTag(node); - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: return emitJSDocSeeTag(node); // SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above) // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 352 /* SyntaxKind.NotEmittedStatement */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return; } if (ts.isExpression(node)) { @@ -113047,85 +114095,87 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: return emitPrivateIdentifier(node); // Expressions - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return emitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return emitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return emitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return emitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return emitArrowFunction(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return emitDeleteExpression(node); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return emitTypeOfExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return emitVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return emitAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return emitBinaryExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return emitConditionalExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return emitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return emitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return emitSpreadElement(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return emitClassExpression(node); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: return emitAsExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return emitNonNullExpression(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return emitSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return emitMetaProperty(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return ts.Debug.fail("SyntheticExpression should never be printed."); // JSX - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return emitJsxElement(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return emitJsxFragment(node); // Synthesized list - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.Debug.fail("SyntaxList should not be printed"); // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: + case 352 /* SyntaxKind.NotEmittedStatement */: return; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return emitCommaList(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return; - case 354 /* SyntaxKind.SyntheticReferenceExpression */: + case 357 /* SyntaxKind.SyntheticReferenceExpression */: return ts.Debug.fail("SyntheticReferenceExpression should not be printed"); } } @@ -113173,7 +114223,7 @@ var ts; } function emitHelpers(node) { var helpersEmitted = false; - var bundle = node.kind === 306 /* SyntaxKind.Bundle */ ? node : undefined; + var bundle = node.kind === 309 /* SyntaxKind.Bundle */ ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -113273,7 +114323,7 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 302 /* SyntaxKind.UnparsedText */ ? + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 305 /* SyntaxKind.UnparsedText */ ? "text" /* BundleFileSectionKind.Text */ : "internal" /* BundleFileSectionKind.Internal */); } @@ -113310,7 +114360,7 @@ var ts; } function emitTabStop(hint, node, snippet) { // A tab stop should only be attached to an empty node, i.e. a node that doesn't emit any text. - ts.Debug.assert(node.kind === 236 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); + ts.Debug.assert(node.kind === 239 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); ts.Debug.assert(hint !== 5 /* EmitHint.EmbeddedStatement */, "A tab stop cannot be attached to an embedded statement."); nonEscapingWrite("$".concat(snippet.order)); } @@ -113371,7 +114421,7 @@ var ts; emit(node.dotDotDotToken); emitNodeWithWriter(node.name, writeParameter); emit(node.questionToken); - if (node.parent && node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */ && !node.name) { + if (node.parent && node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */ && !node.name) { emit(node.type); } else { @@ -113432,7 +114482,7 @@ var ts; } function emitAccessorDeclaration(node) { emitDecoratorsAndModifiers(node, node.modifiers); - writeKeyword(node.kind === 172 /* SyntaxKind.GetAccessor */ ? "get" : "set"); + writeKeyword(node.kind === 174 /* SyntaxKind.GetAccessor */ ? "get" : "set"); writeSpace(); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); @@ -113605,7 +114655,7 @@ var ts; function emitTypeOperator(node) { writeTokenText(node.operator, writeKeyword); writeSpace(); - var parenthesizerRule = node.operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + var parenthesizerRule = node.operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : parenthesizer.parenthesizeOperandOfTypeOperator; emit(node.type, parenthesizerRule); @@ -113628,7 +114678,7 @@ var ts; } if (node.readonlyToken) { emit(node.readonlyToken); - if (node.readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { + if (node.readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { writeKeyword("readonly"); } writeSpace(); @@ -113874,7 +114924,7 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } function emitAwaitExpression(node) { - emitTokenWithComment(132 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(133 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } @@ -113899,7 +114949,7 @@ var ts; // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. var operand = node.operand; - return operand.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ + return operand.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && ((node.operator === 39 /* SyntaxKind.PlusToken */ && (operand.operator === 39 /* SyntaxKind.PlusToken */ || operand.operator === 45 /* SyntaxKind.PlusPlusToken */)) || (node.operator === 40 /* SyntaxKind.MinusToken */ && (operand.operator === 40 /* SyntaxKind.MinusToken */ || operand.operator === 46 /* SyntaxKind.MinusMinusToken */))); } @@ -114047,6 +115097,15 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); writeOperator("!"); } + function emitSatisfiesExpression(node) { + emitExpression(node.expression, /*parenthesizerRules*/ undefined); + if (node.type) { + writeSpace(); + writeKeyword("satisfies"); + writeSpace(); + emit(node.type); + } + } function emitMetaProperty(node) { writeToken(node.keywordToken, node.pos, writePunctuation); writePunctuation("."); @@ -114104,7 +115163,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node, node.thenStatement, node.elseStatement); emitTokenWithComment(91 /* SyntaxKind.ElseKeyword */, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 239 /* SyntaxKind.IfStatement */) { + if (node.elseStatement.kind === 242 /* SyntaxKind.IfStatement */) { writeSpace(); emit(node.elseStatement); } @@ -114167,7 +115226,7 @@ var ts; emitTokenWithComment(20 /* SyntaxKind.OpenParenToken */, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(160 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); + emitTokenWithComment(162 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitTokenWithComment(21 /* SyntaxKind.CloseParenToken */, node.expression.end, writePunctuation, node); @@ -114175,7 +115234,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { emit(node); } else { @@ -114212,7 +115271,7 @@ var ts; } pos = writeTokenText(token, writer, pos); if (isSimilarNode && contextNode.end !== pos) { - var isJsxExprContext = contextNode.kind === 288 /* SyntaxKind.JsxExpression */; + var isJsxExprContext = contextNode.kind === 291 /* SyntaxKind.JsxExpression */; emitTrailingCommentsOfPosition(pos, /*prefixSpace*/ !isJsxExprContext, /*forceNoNewline*/ isJsxExprContext); } return pos; @@ -114522,7 +115581,7 @@ var ts; emitTokenWithComment(100 /* SyntaxKind.ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114547,7 +115606,7 @@ var ts; if (node.importClause) { emit(node.importClause); writeSpace(); - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); writeSpace(); } emitExpression(node.moduleSpecifier); @@ -114558,7 +115617,7 @@ var ts; } function emitImportClause(node) { if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114571,7 +115630,7 @@ var ts; function emitNamespaceImport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114597,10 +115656,11 @@ var ts; writeTrailingSemicolon(); } function emitExportDeclaration(node) { + emitModifiers(node, node.modifiers); var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - nextPos = emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); writeSpace(); } if (node.exportClause) { @@ -114612,7 +115672,7 @@ var ts; if (node.moduleSpecifier) { writeSpace(); var fromPos = node.exportClause ? node.exportClause.end : nextPos; - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); writeSpace(); emitExpression(node.moduleSpecifier); } @@ -114622,7 +115682,7 @@ var ts; writeTrailingSemicolon(); } function emitAssertClause(node) { - emitTokenWithComment(129 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(130 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); writeSpace(); var elements = node.elements; emitList(node, elements, 526226 /* ListFormat.ImportClauseEntries */); @@ -114642,9 +115702,9 @@ var ts; function emitNamespaceExportDeclaration(node) { var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(142 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(143 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); writeSpace(); emit(node.name); writeTrailingSemicolon(); @@ -114652,7 +115712,7 @@ var ts; function emitNamespaceExport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114675,7 +115735,7 @@ var ts; if (node.propertyName) { emit(node.propertyName); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114896,7 +115956,7 @@ var ts; } } if (node.tags) { - if (node.tags.length === 1 && node.tags[0].kind === 343 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { + if (node.tags.length === 1 && node.tags[0].kind === 346 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { writeSpace(); emit(node.tags[0]); } @@ -114941,7 +116001,7 @@ var ts; function emitJSDocTypedefTag(tag) { emitJSDocTagName(tag.tagName); if (tag.typeExpression) { - if (tag.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */) { + if (tag.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */) { emitJSDocTypeExpression(tag.typeExpression); } else { @@ -114960,7 +116020,7 @@ var ts; emit(tag.fullName); } emitJSDocComment(tag.comment); - if (tag.typeExpression && tag.typeExpression.kind === 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (tag.typeExpression && tag.typeExpression.kind === 325 /* SyntaxKind.JSDocTypeLiteral */) { emitJSDocTypeLiteral(tag.typeExpression); } } @@ -115893,13 +116953,13 @@ var ts; && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile)); } function skipSynthesizedParentheses(node) { - while (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; } function getTextOfNode(node, includeTrivia) { - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.isGeneratedPrivateIdentifier(node)) { return generateName(node); } if (ts.isStringLiteral(node) && node.textSourceNode) { @@ -115923,7 +116983,7 @@ var ts; function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) { if (node.kind === 10 /* SyntaxKind.StringLiteral */ && node.textSourceNode) { var textSourceNode = node.textSourceNode; - if (ts.isIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { + if (ts.isIdentifier(textSourceNode) || ts.isPrivateIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { var text = ts.isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode); return jsxAttributeEscape ? "\"".concat(ts.escapeJsxAttributeString(text), "\"") : neverAsciiEscape || (ts.getEmitFlags(node) & 16777216 /* EmitFlags.NoAsciiEscaping */) ? "\"".concat(ts.escapeString(text), "\"") : @@ -115947,7 +117007,11 @@ var ts; return; } tempFlagsStack.push(tempFlags); - tempFlags = 0; + tempFlags = 0 /* TempFlags.Auto */; + privateNameTempFlagsStack.push(privateNameTempFlags); + privateNameTempFlags = 0 /* TempFlags.Auto */; + formattedNameTempFlagsStack.push(formattedNameTempFlags); + formattedNameTempFlags = undefined; reservedNamesStack.push(reservedNames); } /** @@ -115958,6 +117022,8 @@ var ts; return; } tempFlags = tempFlagsStack.pop(); + privateNameTempFlags = privateNameTempFlagsStack.pop(); + formattedNameTempFlags = formattedNameTempFlagsStack.pop(); reservedNames = reservedNamesStack.pop(); } function reserveNameInNestedScopes(name) { @@ -115970,84 +117036,84 @@ var ts; if (!node) return; switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: ts.forEach(node.statements, generateNames); break; - case 250 /* SyntaxKind.LabeledStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: generateNames(node.statement); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: generateNames(node.thenStatement); generateNames(node.elseStatement); break; - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: generateNames(node.initializer); generateNames(node.statement); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: generateNames(node.caseBlock); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: ts.forEach(node.clauses, generateNames); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: ts.forEach(node.statements, generateNames); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: generateNames(node.tryBlock); generateNames(node.catchClause); generateNames(node.finallyBlock); break; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: generateNames(node.variableDeclaration); generateNames(node.block); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: generateNames(node.declarationList); break; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: ts.forEach(node.declarations, generateNames); break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: generateNameIfNeeded(node.name); break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: generateNameIfNeeded(node.name); if (ts.getEmitFlags(node) & 524288 /* EmitFlags.ReuseTempVariableScope */) { ts.forEach(node.parameters, generateNames); generateNames(node.body); } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: ts.forEach(node.elements, generateNames); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: generateNames(node.importClause); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: generateNameIfNeeded(node.name); generateNames(node.namedBindings); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: generateNameIfNeeded(node.name); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: generateNameIfNeeded(node.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: ts.forEach(node.elements, generateNames); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: generateNameIfNeeded(node.propertyName || node.name); break; } @@ -116056,19 +117122,19 @@ var ts; if (!node) return; switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: generateNameIfNeeded(node.name); break; } } function generateNameIfNeeded(name) { if (name) { - if (ts.isGeneratedIdentifier(name)) { + if (ts.isGeneratedIdentifier(name) || ts.isGeneratedPrivateIdentifier(name)) { generateName(name); } else if (ts.isBindingPattern(name)) { @@ -116083,7 +117149,7 @@ var ts; if ((name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) === 4 /* GeneratedIdentifierFlags.Node */) { // Node names generate unique names based on their original node // and are cached based on that node's id. - return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags); + return generateNameCached(ts.getNodeForGeneratedName(name), ts.isPrivateIdentifier(name), name.autoGenerateFlags, name.autoGeneratePrefix, name.autoGenerateSuffix); } else { // Auto, Loop, and Unique names are cached based on their unique @@ -116092,9 +117158,9 @@ var ts; return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name)); } } - function generateNameCached(node, flags) { + function generateNameCached(node, privateName, flags, prefix, suffix) { var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags)); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags !== null && flags !== void 0 ? flags : 0 /* GeneratedIdentifierFlags.None */, ts.formatGeneratedNamePart(prefix, generateName), ts.formatGeneratedNamePart(suffix))); } /** * Returns a value indicating whether a name is unique globally, within the current file, @@ -116126,20 +117192,53 @@ var ts; } return true; } + function getTempFlags(formattedNameKey) { + var _a; + switch (formattedNameKey) { + case "": + return tempFlags; + case "#": + return privateNameTempFlags; + default: + return (_a = formattedNameTempFlags === null || formattedNameTempFlags === void 0 ? void 0 : formattedNameTempFlags.get(formattedNameKey)) !== null && _a !== void 0 ? _a : 0 /* TempFlags.Auto */; + } + } + function setTempFlags(formattedNameKey, flags) { + switch (formattedNameKey) { + case "": + tempFlags = flags; + break; + case "#": + privateNameTempFlags = flags; + break; + default: + formattedNameTempFlags !== null && formattedNameTempFlags !== void 0 ? formattedNameTempFlags : (formattedNameTempFlags = new ts.Map()); + formattedNameTempFlags.set(formattedNameKey, flags); + break; + } + } /** * Return the next available name in the pattern _a ... _z, _0, _1, ... * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. * Note that names generated by makeTempVariableName and makeUniqueName will never conflict. */ - function makeTempVariableName(flags, reservedInNestedScopes) { + function makeTempVariableName(flags, reservedInNestedScopes, privateName, prefix, suffix) { + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } + // Generate a key to use to acquire a TempFlags counter based on the fixed portions of the generated name. + var key = ts.formatGeneratedName(privateName, prefix, "", suffix); + var tempFlags = getTempFlags(key); if (flags && !(tempFlags & flags)) { var name = flags === 268435456 /* TempFlags._i */ ? "_i" : "_n"; - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { tempFlags |= flags; if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } while (true) { @@ -116150,11 +117249,13 @@ var ts; var name = count < 26 ? "_" + String.fromCharCode(97 /* CharacterCodes.a */ + count) : "_" + (count - 26); - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } } @@ -116166,17 +117267,24 @@ var ts; * makeUniqueName are guaranteed to never conflict. * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1' */ - function makeUniqueName(baseName, checkFn, optimistic, scoped) { + function makeUniqueName(baseName, checkFn, optimistic, scoped, privateName, prefix, suffix) { if (checkFn === void 0) { checkFn = isUniqueName; } + if (baseName.length > 0 && baseName.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + baseName = baseName.slice(1); + } + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } if (optimistic) { - if (checkFn(baseName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(baseName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(baseName); + generatedNames.add(fullName); } - return baseName; + return fullName; } } // Find the first unique 'name_n', where n is a positive number @@ -116185,21 +117293,21 @@ var ts; } var i = 1; while (true) { - var generatedName = baseName + i; - if (checkFn(generatedName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName + i, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(generatedName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(generatedName); + generatedNames.add(fullName); } - return generatedName; + return fullName; } i++; } } function makeFileLevelOptimisticUniqueName(name) { - return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true); + return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a ModuleDeclaration or EnumDeclaration. @@ -116207,7 +117315,7 @@ var ts; function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); // Use module/enum name itself if it is unique, otherwise make a unique variation - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + return isUniqueLocalName(name, node) ? name : makeUniqueName(name, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for an ImportDeclaration or ExportDeclaration. @@ -116216,89 +117324,76 @@ var ts; var expr = ts.getExternalModuleName(node); // TODO: GH#18217 var baseName = ts.isStringLiteral(expr) ? ts.makeIdentifierFromModuleName(expr.text) : "module"; - return makeUniqueName(baseName); + return makeUniqueName(baseName, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a default export. */ function generateNameForExportDefault() { - return makeUniqueName("default"); + return makeUniqueName("default", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a class expression. */ function generateNameForClassExpression() { - return makeUniqueName("class"); + return makeUniqueName("class", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } - function generateNameForMethodOrAccessor(node) { + function generateNameForMethodOrAccessor(node, privateName, prefix, suffix) { if (ts.isIdentifier(node.name)) { - return generateNameCached(node.name); + return generateNameCached(node.name, privateName); } - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reservedInNestedScopes*/ false, privateName, prefix, suffix); } /** * Generates a unique name from a node. */ - function generateNameForNode(node, flags) { + function generateNameForNode(node, privateName, flags, prefix, suffix) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 80 /* SyntaxKind.PrivateIdentifier */: + return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), privateName, prefix, suffix); + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForModuleOrEnum(node); - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForImportOrExportDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForExportDefault(); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForClassExpression(); - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return generateNameForMethodOrAccessor(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true); + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return generateNameForMethodOrAccessor(node, privateName, prefix, suffix); + case 164 /* SyntaxKind.ComputedPropertyName */: + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true, privateName, prefix, suffix); default: - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ false, privateName, prefix, suffix); } } /** * Generates a unique identifier for a node. */ function makeName(name) { + var prefix = ts.formatGeneratedNamePart(name.autoGeneratePrefix, generateName); + var suffix = ts.formatGeneratedNamePart(name.autoGenerateSuffix); switch (name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) { case 1 /* GeneratedIdentifierFlags.Auto */: - return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); case 2 /* GeneratedIdentifierFlags.Loop */: - return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + ts.Debug.assertNode(name, ts.isIdentifier); + return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), /*privateName*/ false, prefix, suffix); case 3 /* GeneratedIdentifierFlags.Unique */: - return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); - } - return ts.Debug.fail("Unsupported GeneratedIdentifierKind."); - } - /** - * Gets the node from which a name should be generated. - */ - function getNodeForGeneratedName(name) { - var autoGenerateId = name.autoGenerateId; - var node = name; - var original = node.original; - while (original) { - node = original; - // if "node" is a different generated name (having a different - // "autoGenerateId"), use it and stop traversing. - if (ts.isIdentifier(node) - && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) - && node.autoGenerateId !== autoGenerateId) { - break; - } - original = node.original; + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); } - // otherwise, return the original node for the source; - return node; + return ts.Debug.fail("Unsupported GeneratedIdentifierKind: ".concat(ts.Debug.formatEnum(name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */, ts.GeneratedIdentifierFlags, /*isFlags*/ true), ".")); } // Comments function pipelineEmitWithComments(hint, node) { @@ -116344,7 +117439,7 @@ var ts; // Emit leading comments if the position is not synthesized and the node // has not opted out from emitting leading comments. if (!skipLeadingComments) { - emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 349 /* SyntaxKind.NotEmittedStatement */); + emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 352 /* SyntaxKind.NotEmittedStatement */); } if (!skipLeadingComments || (pos >= 0 && (emitFlags & 512 /* EmitFlags.NoLeadingComments */) !== 0)) { // Advance the container position if comments get emitted or if they've been disabled explicitly using NoLeadingComments. @@ -116355,7 +117450,7 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -116374,7 +117469,7 @@ var ts; declarationListContainerEnd = savedDeclarationListContainerEnd; // Emit trailing comments if the position is not synthesized and the node // has not opted out from emitting leading comments and is an emitted node. - if (!skipTrailingComments && node.kind !== 349 /* SyntaxKind.NotEmittedStatement */) { + if (!skipTrailingComments && node.kind !== 352 /* SyntaxKind.NotEmittedStatement */) { emitTrailingComments(end); } } @@ -116655,7 +117750,7 @@ var ts; } else { var source = sourceMapRange.source || sourceMapSource; - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 16 /* EmitFlags.NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos)); @@ -116673,7 +117768,7 @@ var ts; if (emitFlags & 64 /* EmitFlags.NoNestedSourceMaps */) { sourceMapsDisabled = false; } - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 32 /* EmitFlags.NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end); @@ -116838,7 +117933,16 @@ var ts; return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath)); } function getCachedFileSystemEntriesForBaseDir(path) { - return getCachedFileSystemEntries(ts.getDirectoryPath(path)); + var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path)); + if (!entries) { + return entries; + } + // If we're looking for the base directory, we're definitely going to search the entries + if (!entries.sortedAndCanonicalizedFiles) { + entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort(); + entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort(); + } + return entries; } function getBaseNameOfFileName(fileName) { return ts.getBaseFileName(ts.normalizePath(fileName)); @@ -116881,21 +117985,10 @@ var ts; return undefined; } } - function fileNameEqual(name1, name2) { - return getCanonicalFileName(name1) === getCanonicalFileName(name2); - } function hasEntry(entries, name) { - return ts.some(entries, function (file) { return fileNameEqual(file, name); }); - } - function updateFileSystemEntry(entries, baseName, isValid) { - if (hasEntry(entries, baseName)) { - if (!isValid) { - return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); }); - } - } - else if (isValid) { - return entries.push(baseName); - } + // Case-sensitive comparison since already canonicalized + var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive); + return index >= 0; } function writeFile(fileName, data, writeByteOrderMark) { var path = toPath(fileName); @@ -116908,7 +118001,7 @@ var ts; function fileExists(fileName) { var path = toPath(fileName); var result = getCachedFileSystemEntriesForBaseDir(path); - return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) || + return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) || host.fileExists(fileName); } function directoryExists(dirPath) { @@ -116918,9 +118011,14 @@ var ts; function createDirectory(dirPath) { var path = toPath(dirPath); var result = getCachedFileSystemEntriesForBaseDir(path); - var baseFileName = getBaseNameOfFileName(dirPath); if (result) { - updateFileSystemEntry(result.directories, baseFileName, /*isValid*/ true); + var baseName = getBaseNameOfFileName(dirPath); + var canonicalizedBaseName = getCanonicalFileName(baseName); + var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories; + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + result.directories.push(baseName); + } } host.createDirectory(dirPath); } @@ -116989,7 +118087,7 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) { // Folder added or removed, clear the cache instead of updating the folder and its structure clearCache(); } @@ -117009,7 +118107,23 @@ var ts; } } function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) { - updateFileSystemEntry(parentResult.files, baseName, fileExists); + var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles; + var canonicalizedBaseName = getCanonicalFileName(baseName); + if (fileExists) { + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + parentResult.files.push(baseName); + } + } + else { + // Case-sensitive comparison since already canonicalized + var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive); + if (sortedIndex >= 0) { + canonicalizedFiles.splice(sortedIndex, 1); + var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; }); + parentResult.files.splice(unsortedIndex, 1); + } + } } function clearCache() { cachedReadDirectoryResult.clear(); @@ -117489,14 +118603,16 @@ var ts; } return setReadFileCache(key, fileName); }; - var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersion, onError, shouldCreateNewSourceFile) { + var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) { var key = toPath(fileName); - var value = sourceFileCache.get(key); + var impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : undefined; + var forImpliedNodeFormat = sourceFileCache.get(impliedNodeFormat); + var value = forImpliedNodeFormat === null || forImpliedNodeFormat === void 0 ? void 0 : forImpliedNodeFormat.get(key); if (value) return value; - var sourceFile = getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile); + var sourceFile = getSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile); if (sourceFile && (ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Extension.Json */))) { - sourceFileCache.set(key, sourceFile); + sourceFileCache.set(impliedNodeFormat, (forImpliedNodeFormat || new ts.Map()).set(key, sourceFile)); } return sourceFile; } : undefined; @@ -117521,13 +118637,15 @@ var ts; var value = readFileCache.get(key); if (value !== undefined && value !== data) { readFileCache.delete(key); - sourceFileCache.delete(key); + sourceFileCache.forEach(function (map) { return map.delete(key); }); } else if (getSourceFileWithCache) { - var sourceFile = sourceFileCache.get(key); - if (sourceFile && sourceFile.text !== data) { - sourceFileCache.delete(key); - } + sourceFileCache.forEach(function (map) { + var sourceFile = map.get(key); + if (sourceFile && sourceFile.text !== data) { + map.delete(key); + } + }); } originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false)); }; @@ -117769,7 +118887,6 @@ var ts; return resolutions; } ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache; - ; /** * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file. @@ -117969,7 +119086,7 @@ var ts; * Determines if program structure is upto date or needs to be recreated */ /* @internal */ - function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { + function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { // If we haven't created a program yet or have changed automatic type directives, then it is not up-to-date if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames())) return false; @@ -117997,7 +119114,7 @@ var ts; return true; function sourceFileNotUptoDate(sourceFile) { return !sourceFileVersionUptoDate(sourceFile) || - hasInvalidatedResolution(sourceFile.path); + hasInvalidatedResolutions(sourceFile.path); } function sourceFileVersionUptoDate(sourceFile) { return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName); @@ -118243,7 +119360,7 @@ var ts; var moduleResolutionCache; var typeReferenceDirectiveResolutionCache; var actualResolveModuleNamesWorker; - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; if (host.resolveModuleNames) { actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) { // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. @@ -118690,7 +119807,7 @@ var ts; for (var i = 0; i < moduleNames.length; i++) { var moduleName = moduleNames[i]; // If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions - if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) { + if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) { var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i)); if (oldResolvedModule) { if (ts.isTraceEnabled(options, host)) { @@ -118926,7 +120043,7 @@ var ts; // tentatively approve the file modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); } - else if (hasInvalidatedResolution(oldSourceFile.path)) { + else if (hasInvalidatedResolutions(oldSourceFile.path)) { // 'module/types' references could have changed structureIsReused = 1 /* StructureIsReused.SafeModules */; // add file to the modified list so that we will resolve it later @@ -119314,22 +120431,22 @@ var ts; // Return directly from the case if the given node doesnt want to visit each child // Otherwise break to visit each child switch (parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); return "skip"; } // falls through - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 257 /* SyntaxKind.VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); @@ -119337,65 +120454,68 @@ var ts; } } switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type")); return "skip"; } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type")); return "skip"; } break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, ts.isImportSpecifier(node) ? "import...type" : "export...type")); return "skip"; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_TypeScript_files)); return "skip"; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: var heritageClause = node; if (heritageClause.token === 117 /* SyntaxKind.ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: var interfaceKeyword = ts.tokenToString(118 /* SyntaxKind.InterfaceKeyword */); ts.Debug.assertIsDefined(interfaceKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword)); return "skip"; - case 261 /* SyntaxKind.ModuleDeclaration */: - var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(142 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(141 /* SyntaxKind.ModuleKeyword */); + case 264 /* SyntaxKind.ModuleDeclaration */: + var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(143 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(142 /* SyntaxKind.ModuleKeyword */); ts.Debug.assertIsDefined(moduleKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); return "skip"; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); return "skip"; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumKeyword = ts.Debug.checkDefined(ts.tokenToString(92 /* SyntaxKind.EnumKeyword */)); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); return "skip"; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 213 /* SyntaxKind.TypeAssertionExpression */: ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. } } @@ -119404,53 +120524,55 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)); } switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); return "skip"; } // falls through - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - checkModifiers(parent.modifiers, parent.kind === 237 /* SyntaxKind.VariableStatement */); + checkModifiers(parent.modifiers, parent.kind === 240 /* SyntaxKind.VariableStatement */); return "skip"; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Check modifiers of property declaration if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; - if (ts.isModifier(modifier) && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */) { + if (ts.isModifier(modifier) + && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ + && modifier.kind !== 127 /* SyntaxKind.AccessorKeyword */) { diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); } } return "skip"; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Check modifiers of parameter declaration if (nodes === parent.modifiers && ts.some(nodes, ts.isModifier)) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); @@ -119472,18 +120594,19 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); break; // These are all legal modifiers. case 124 /* SyntaxKind.StaticKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: } } } @@ -120408,10 +121531,12 @@ var ts; if (options.preserveConstEnums === false) { createDiagnosticForOptionName(ts.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled, "preserveConstEnums", "isolatedModules"); } - var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* ScriptKind.JSON */; }); - if (firstNonExternalModuleSourceFile) { - var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(firstNonExternalModuleSourceFile.fileName))); + for (var _a = 0, files_5 = files; _a < files_5.length; _a++) { + var file = files_5[_a]; + if (!ts.isExternalModule(file) && !ts.isSourceFileJS(file) && !file.isDeclarationFile && file.scriptKind !== 6 /* ScriptKind.JSON */) { + var span = ts.getErrorSpanForNode(file, file); + programDiagnostics.add(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(file.fileName))); + } } } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ScriptTarget.ES2015 */ && options.module === ts.ModuleKind.None) { @@ -121662,10 +122787,16 @@ var ts; var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined; var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile && !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions); + // We can only reuse emit signatures (i.e. .d.ts signatures) if the .d.ts file is unchanged, + // which will eg be depedent on change in options like declarationDir and outDir options are unchanged. + // We need to look in oldState.compilerOptions, rather than oldCompilerOptions (i.e.we need to disregard useOldState) because + // oldCompilerOptions can be undefined if there was change in say module from None to some other option + // which would make useOldState as false since we can now use reference maps that are needed to track what to emit, what to check etc + // but that option change does not affect d.ts file name so emitSignatures should still be reused. var canCopyEmitSignatures = compilerOptions.composite && (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) && !outFilePath && - !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions); + !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions); if (useOldState) { // Copy old state's changed files set (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); }); @@ -122880,7 +124011,7 @@ var ts; var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* CharacterCodes.slash */; if (isNonDirectorySeparatorRoot && dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths - pathPartForUserCheck.search(/[a-zA-z]\$\//) === 0) { // Dos style nextPart + pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) { // Dos style nextPart nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, nextDirectorySeparator + 1); if (nextDirectorySeparator === -1) { // ignore "//vda1cs4850/c$/folderAtRoot" @@ -122964,7 +124095,7 @@ var ts; invalidateResolutionOfFile: invalidateResolutionOfFile, invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations, setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports, - createHasInvalidatedResolution: createHasInvalidatedResolution, + createHasInvalidatedResolutions: createHasInvalidatedResolutions, isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports, updateTypeRootsWatch: updateTypeRootsWatch, closeTypeRootsWatch: closeTypeRootsWatch, @@ -123019,17 +124150,13 @@ var ts; var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path); return !!value && !!value.length; } - function createHasInvalidatedResolution(forceAllFilesAsInvalidated) { + function createHasInvalidatedResolutions(customHasInvalidatedResolutions) { // Ensure pending resolutions are applied invalidateResolutionsOfFailedLookupLocations(); - if (forceAllFilesAsInvalidated) { - // Any file asked would have invalidated resolution - filesWithInvalidatedResolutions = undefined; - return ts.returnTrue; - } var collected = filesWithInvalidatedResolutions; filesWithInvalidatedResolutions = undefined; - return function (path) { return (!!collected && collected.has(path)) || + return function (path) { return customHasInvalidatedResolutions(path) || + !!(collected === null || collected === void 0 ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path); }; } function startCachingPerDirectoryResolution() { @@ -124390,15 +125517,21 @@ var ts; return undefined; } function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) { - var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); - if (normalizedTargetPath === undefined) { + var normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); + if (normalizedTargetPaths === undefined) { + return undefined; + } + var normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); + var relativePaths = ts.flatMap(normalizedSourcePaths, function (sourcePath) { + return ts.map(normalizedTargetPaths, function (targetPath) { return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)); }); + }); + var shortest = ts.min(relativePaths, ts.compareNumberOfDirectorySeparators); + if (!shortest) { return undefined; } - var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); - var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath; return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs - ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions) - : ts.removeFileExtension(relativePath); + ? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions) + : ts.removeFileExtension(shortest); } function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) { var path = _a.path, isRedirect = _a.isRedirect; @@ -124535,8 +125668,8 @@ var ts; } } } - function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) { - return ts.firstDefined(rootDirs, function (rootDir) { + function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) { + return ts.mapDefined(rootDirs, function (rootDir) { var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName); return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath; }); @@ -125247,18 +126380,14 @@ var ts; if (host.getBuildInfo) { // host provides buildinfo, get it from there. This allows host to cache it buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath); - if (!buildInfo) - return undefined; } else { var content = host.readFile(buildInfoPath); if (!content) return undefined; - buildInfo = ts.getBuildInfo(content); + buildInfo = ts.getBuildInfo(buildInfoPath, content); } - if (buildInfo.version !== ts.version) - return undefined; - if (!buildInfo.program) + if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program) return undefined; return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host); } @@ -125413,6 +126542,10 @@ var ts; ts.maybeBind(host, host.getModuleResolutionCache) : (function () { return resolutionCache.getModuleResolutionCache(); }); var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; + // All resolutions are invalid if user provided resolutions and didnt supply hasInvalidatedResolutions + var customHasInvalidatedResolutions = userProvidedResolution ? + ts.maybeBind(host, host.hasInvalidatedResolutions) || ts.returnTrue : + ts.returnFalse; builderProgram = readBuilderProgram(compilerOptions, compilerHost); synchronizeProgram(); // Update the wild card directory watch @@ -125478,9 +126611,9 @@ var ts; resolutionCache.clear(); } } - // All resolutions are invalid if user provided resolutions - var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + var hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions); + var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile; + if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { if (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -125493,15 +126626,20 @@ var ts; if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); } - createNewProgram(hasInvalidatedResolution); + createNewProgram(hasInvalidatedResolutions); } reportFileChangeDetectedOnCreateProgram = false; if (host.afterProgramCreate && program !== builderProgram) { host.afterProgramCreate(builderProgram); } + compilerHost.readFile = originalReadFile; + compilerHost.fileExists = originalFileExists; + compilerHost.directoryExists = originalDirectoryExists; + compilerHost.createDirectory = originalCreateDirectory; + compilerHost.writeFile = originalWriteFile; return builderProgram; } - function createNewProgram(hasInvalidatedResolution) { + function createNewProgram(hasInvalidatedResolutions) { // Compile the program writeLog("CreatingProgramWith::"); writeLog(" roots: ".concat(JSON.stringify(rootFileNames))); @@ -125512,7 +126650,7 @@ var ts; hasChangedCompilerOptions = false; hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); - compilerHost.hasInvalidatedResolution = hasInvalidatedResolution; + compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; var oldProgram = getCurrentProgram(); builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences); @@ -125976,19 +127114,20 @@ var ts; */ UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend"; UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream"; - UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo"; - UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate"; - UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked"; - UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream"; - UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate"; - UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText"; + UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream"; + UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo"; + UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate"; + UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked"; + UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream"; + UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate"; + UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText"; /** * Projects with no outputs (i.e. "solution" files) */ - UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly"; - UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild"; + UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly"; + UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild"; })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {})); function resolveConfigFileProjectName(project) { if (ts.fileExtensionIs(project, ".json" /* Extension.Json */)) { @@ -126206,6 +127345,7 @@ var ts; if (value) { return isParsedCommandLine(value) ? value : undefined; } + ts.performance.mark("SolutionBuilder::beforeConfigFileParsing"); var diagnostic; var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host; var parsed; @@ -126220,6 +127360,8 @@ var ts; parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop; } configFileCache.set(configFilePath, parsed || diagnostic); + ts.performance.mark("SolutionBuilder::afterConfigFileParsing"); + ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing"); return parsed; } function resolveProjectName(state, name) { @@ -126419,6 +127561,7 @@ var ts; if (updateOutputFileStampsPending) { updateOutputTimestamps(state, config, projectPath); } + ts.performance.mark("SolutionBuilder::Timestamps only updates"); return doneInvalidatedProject(state, projectPath); } }; @@ -126512,6 +127655,10 @@ var ts; }; function done(cancellationToken, writeFile, customTransformers) { executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers); + if (kind === InvalidatedProjectKind.Build) + ts.performance.mark("SolutionBuilder::Projects built"); + else + ts.performance.mark("SolutionBuilder::Bundles updated"); return doneInvalidatedProject(state, projectPath); } function withProgramOrUndefined(action) { @@ -126690,13 +127837,13 @@ var ts; var emitterDiagnostics = ts.createDiagnosticCollection(); var emittedOutputs = new ts.Map(); var resultFlags = BuildResultFlags.DeclarationOutputUnchanged; - var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo; + var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined; outputFiles.forEach(function (_a) { var _b, _c; var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo; emittedOutputs.set(toPath(state, name), name); if (buildInfo) { - if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { + if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; } setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags); @@ -126989,8 +128136,7 @@ var ts; return existing.buildInfo || undefined; } var value = state.readFileWithCache(buildInfoPath); - var buildInfo = value ? ts.getBuildInfo(value) : undefined; - ts.Debug.assert(modifiedTime || !buildInfo); + var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined; state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime }); return buildInfo; } @@ -127075,7 +128221,14 @@ var ts; missingOutputFileName: buildInfoPath }; } - var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime)); + var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime); + if (!buildInfo) { + // Error reading buildInfo + return { + type: ts.UpToDateStatusType.ErrorReadingFile, + fileName: buildInfoPath + }; + } if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) { return { type: ts.UpToDateStatusType.TsVersionOutputOfDate, @@ -127084,8 +128237,15 @@ var ts; } if (buildInfo.program) { // If there are pending changes that are not emitted, project is out of date + // When there are syntax errors, changeFileSet will have list of files changed (irrespective of noEmit) + // But in case of semantic error we need special treatment. + // Checking presence of affectedFilesPendingEmit list is fast and good way to tell if there were semantic errors and file emit was blocked + // But if noEmit is true, affectedFilesPendingEmit will have file list even if there are no semantic errors to preserve list of files to be emitted when running with noEmit false + // So with noEmit set to true, check on semantic diagnostics needs to be explicit as oppose to when it is false when only files pending emit is sufficient if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) || - (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) { + (!project.options.noEmit ? + (_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length : + ts.some(buildInfo.program.semanticDiagnosticsPerFile, ts.isArray))) { return { type: ts.UpToDateStatusType.OutOfDateBuildInfo, buildInfoFile: buildInfoPath @@ -127260,7 +128420,10 @@ var ts; if (prior !== undefined) { return prior; } + ts.performance.mark("SolutionBuilder::beforeUpToDateCheck"); var actual = getUpToDateStatusWorker(state, project, resolvedPath); + ts.performance.mark("SolutionBuilder::afterUpToDateCheck"); + ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck"); state.projectStatus.set(resolvedPath, actual); return actual; } @@ -127398,6 +128561,13 @@ var ts; } } function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + return result; + } + function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127425,6 +128595,13 @@ var ts; : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } function clean(state, project, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeClean"); + var result = cleanWorker(state, project, onlyReferences); + ts.performance.mark("SolutionBuilder::afterClean"); + ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean"); + return result; + } + function cleanWorker(state, project, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127498,6 +128675,14 @@ var ts; state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected); } function buildNextInvalidatedProject(state, changeDetected) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + if (buildOrder) + reportErrorSummary(state, buildOrder); + } + function buildNextInvalidatedProjectWorker(state, changeDetected) { state.timerToBuildInvalidatedProject = undefined; if (state.reportFileChangeDetected) { state.reportFileChangeDetected = false; @@ -127530,7 +128715,7 @@ var ts; } } disableCache(state); - reportErrorSummary(state, buildOrder); + return buildOrder; } function watchConfigFile(state, resolved, resolvedPath, parsed) { if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath)) @@ -127585,6 +128770,7 @@ var ts; function startWatching(state, buildOrder) { if (!state.watchAllProjectsPending) return; + ts.performance.mark("SolutionBuilder::beforeWatcherCreation"); state.watchAllProjectsPending = false; for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) { var resolved = _a[_i]; @@ -127602,6 +128788,8 @@ var ts; watchPackageJsonFiles(state, resolved, resolvedPath, cfg); } } + ts.performance.mark("SolutionBuilder::afterWatcherCreation"); + ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation"); } function stopWatching(state) { ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher); @@ -127715,6 +128903,8 @@ var ts; return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName)); case ts.UpToDateStatusType.OutputMissing: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName)); + case ts.UpToDateStatusType.ErrorReadingFile: + return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName)); case ts.UpToDateStatusType.OutOfDateBuildInfo: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile)); case ts.UpToDateStatusType.UpToDate: @@ -128236,6 +129426,12 @@ var ts; SemanticClassificationFormat["Original"] = "original"; SemanticClassificationFormat["TwentyTwenty"] = "2020"; })(SemanticClassificationFormat = ts.SemanticClassificationFormat || (ts.SemanticClassificationFormat = {})); + var OrganizeImportsMode; + (function (OrganizeImportsMode) { + OrganizeImportsMode["All"] = "All"; + OrganizeImportsMode["SortAndCombine"] = "SortAndCombine"; + OrganizeImportsMode["RemoveUnused"] = "RemoveUnused"; + })(OrganizeImportsMode = ts.OrganizeImportsMode || (ts.OrganizeImportsMode = {})); var CompletionTriggerKind; (function (CompletionTriggerKind) { /** Completion was triggered by typing an identifier, manual invocation (e.g Ctrl+Space) or via API. */ @@ -128422,6 +129618,8 @@ var ts; * interface Y { foo:number; } */ ScriptElementKind["memberVariableElement"] = "property"; + /** class X { [public|private]* accessor foo: number; } */ + ScriptElementKind["memberAccessorVariableElement"] = "accessor"; /** * class X { constructor() { } } * class X { static { } } @@ -128554,37 +129752,37 @@ var ts; })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})); function getMeaningFromDeclaration(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.isInJSFile(node) && ts.getJSDocEnumTag(node) ? 7 /* SemanticMeaning.All */ : 1 /* SemanticMeaning.Value */; - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 292 /* SyntaxKind.CatchClause */: - case 285 /* SyntaxKind.JsxAttribute */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 295 /* SyntaxKind.CatchClause */: + case 288 /* SyntaxKind.JsxAttribute */: return 1 /* SemanticMeaning.Value */; - case 163 /* SyntaxKind.TypeParameter */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 165 /* SyntaxKind.TypeParameter */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: return 2 /* SemanticMeaning.Type */; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: // If it has no name node, it shares the name with the value declaration below it. return node.name === undefined ? 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */ : 2 /* SemanticMeaning.Type */; - case 299 /* SyntaxKind.EnumMember */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: return 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } @@ -128594,16 +129792,16 @@ var ts; else { return 4 /* SemanticMeaning.Namespace */; } - case 260 /* SyntaxKind.EnumDeclaration */: - case 269 /* SyntaxKind.NamedImports */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 272 /* SyntaxKind.NamedImports */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return 7 /* SemanticMeaning.All */; // An external module can be a Value - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } return 7 /* SemanticMeaning.All */; @@ -128612,7 +129810,7 @@ var ts; function getMeaningFromLocation(node) { node = getAdjustedReferenceLocation(node); var parent = node.parent; - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return 1 /* SemanticMeaning.Value */; } else if (ts.isExportAssignment(parent) @@ -128655,11 +129853,11 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - var name = node.kind === 161 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; - return name && name.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; + var name = node.kind === 163 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; + return name && name.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; } function isInRightSideOfInternalImportEqualsDeclaration(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -128671,27 +129869,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { - while (root.parent && root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { + while (root.parent && root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 178 /* SyntaxKind.TypeReference */ && !isLastClause; + return root.parent.kind === 180 /* SyntaxKind.TypeReference */ && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */) { + if (!isLastClause && root.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 257 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || - (decl.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); + return (decl.kind === 260 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || + (decl.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); } return false; } @@ -128702,15 +129900,15 @@ var ts; switch (node.kind) { case 108 /* SyntaxKind.ThisKeyword */: return !ts.isExpressionNode(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return true; } switch (node.parent.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return true; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return !node.parent.isTypeOf; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isPartOfTypeNode(node.parent); } return false; @@ -128777,7 +129975,7 @@ var ts; ts.climbPastPropertyOrElementAccess = climbPastPropertyOrElementAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 250 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { + if (referenceNode.kind === 253 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -128838,22 +130036,22 @@ var ts; ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { switch (node.parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.getNameOfDeclaration(node.parent) === node; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.parent.argumentExpression === node; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return true; - case 196 /* SyntaxKind.LiteralType */: - return node.parent.parent.kind === 194 /* SyntaxKind.IndexedAccessType */; + case 198 /* SyntaxKind.LiteralType */: + return node.parent.parent.kind === 196 /* SyntaxKind.IndexedAccessType */; default: return false; } @@ -128877,17 +130075,17 @@ var ts; return undefined; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node; } } @@ -128895,56 +130093,56 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node) ? "module" /* ScriptElementKind.moduleElement */ : "script" /* ScriptElementKind.scriptElement */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return "module" /* ScriptElementKind.moduleElement */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return "class" /* ScriptElementKind.classElement */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return "type" /* ScriptElementKind.typeElement */; - case 260 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; - case 254 /* SyntaxKind.VariableDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; + case 257 /* SyntaxKind.VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return "function" /* ScriptElementKind.functionElement */; - case 172 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; - case 173 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; + case 175 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return "method" /* ScriptElementKind.memberFunctionElement */; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: var initializer = node.initializer; return ts.isFunctionLike(initializer) ? "method" /* ScriptElementKind.memberFunctionElement */ : "property" /* ScriptElementKind.memberVariableElement */; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return "property" /* ScriptElementKind.memberVariableElement */; - case 176 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; - case 175 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; - case 174 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; + case 177 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; + case 176 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return "constructor" /* ScriptElementKind.constructorImplementationElement */; - case 163 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; - case 299 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; - case 164 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: + case 165 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; + case 302 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; + case 166 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: return "alias" /* ScriptElementKind.alias */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var kind = ts.getAssignmentDeclarationKind(node); var right = node.right; switch (kind) { @@ -128973,7 +130171,7 @@ var ts; } case 79 /* SyntaxKind.Identifier */: return ts.isImportClause(node.parent) ? "alias" /* ScriptElementKind.alias */ : "" /* ScriptElementKind.unknown */; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: var scriptKind = getNodeKind(node.expression); // If the expression didn't come back with something (like it does for an identifiers) return scriptKind === "" /* ScriptElementKind.unknown */ ? "const" /* ScriptElementKind.constElement */ : scriptKind; @@ -128996,7 +130194,7 @@ var ts; return true; case 79 /* SyntaxKind.Identifier */: // 'this' as a parameter - return ts.identifierIsThisKeyword(node) && node.parent.kind === 164 /* SyntaxKind.Parameter */; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 166 /* SyntaxKind.Parameter */; default: return false; } @@ -129061,42 +130259,42 @@ var ts; return false; } switch (n.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 182 /* SyntaxKind.TypeLiteral */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 263 /* SyntaxKind.CaseBlock */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 184 /* SyntaxKind.TypeLiteral */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 266 /* SyntaxKind.CaseBlock */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return nodeEndsWith(n, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return isCompletedNode(n.block, sourceFile); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: if (!n.arguments) { return true; } // falls through - case 208 /* SyntaxKind.CallExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 191 /* SyntaxKind.ParenthesizedType */: + case 210 /* SyntaxKind.CallExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: return nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 216 /* SyntaxKind.ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -129106,65 +130304,65 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return !!n.body && isCompletedNode(n.body, sourceFile); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 26 /* SyntaxKind.SemicolonToken */, sourceFile); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 184 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 186 /* SyntaxKind.TupleType */: return nodeEndsWith(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; return hasChildOfKind(n, 115 /* SyntaxKind.WhileKeyword */, sourceFile) ? nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile) : isCompletedNode(n.statement, sourceFile); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 216 /* SyntaxKind.TypeOfExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 225 /* SyntaxKind.SpreadElement */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 227 /* SyntaxKind.SpreadElement */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.nodeIsPresent(n.moduleSpecifier); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -129279,6 +130477,8 @@ var ts; return lastTypeNode; } function getContextualTypeFromParentOrAncestorTypeNode(node, checker) { + if (node.flags & (8388608 /* NodeFlags.JSDoc */ & ~262144 /* NodeFlags.JavaScriptFile */)) + return undefined; var contextualType = getContextualTypeFromParent(node, checker); if (contextualType) return contextualType; @@ -129289,13 +130489,13 @@ var ts; function getAdjustedLocationForDeclaration(node, forRename) { if (!forRename) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return getAdjustedLocationForClass(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return getAdjustedLocationForFunction(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return node; } } @@ -129390,11 +130590,11 @@ var ts; node.kind === 98 /* SyntaxKind.FunctionKeyword */ ? ts.isFunctionDeclaration(parent) || ts.isFunctionExpression(node) : node.kind === 118 /* SyntaxKind.InterfaceKeyword */ ? ts.isInterfaceDeclaration(parent) : node.kind === 92 /* SyntaxKind.EnumKeyword */ ? ts.isEnumDeclaration(parent) : - node.kind === 152 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : - node.kind === 142 /* SyntaxKind.NamespaceKeyword */ || node.kind === 141 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : + node.kind === 154 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : + node.kind === 143 /* SyntaxKind.NamespaceKeyword */ || node.kind === 142 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : node.kind === 100 /* SyntaxKind.ImportKeyword */ ? ts.isImportEqualsDeclaration(parent) : - node.kind === 136 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : - node.kind === 149 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { + node.kind === 137 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : + node.kind === 151 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { var location = getAdjustedLocationForDeclaration(parent, forRename); if (location) { return location; @@ -129408,7 +130608,7 @@ var ts; return decl.name; } } - if (node.kind === 152 /* SyntaxKind.TypeKeyword */) { + if (node.kind === 154 /* SyntaxKind.TypeKeyword */) { // import /**/type [|name|] from ...; // import /**/type { [|name|] } from ...; // import /**/type { propertyName as [|name|] } from ...; @@ -129434,7 +130634,7 @@ var ts; // import * /**/as [|name|] ... // export { propertyName /**/as [|name|] } ... // export * /**/as [|name|] ... - if (node.kind === 127 /* SyntaxKind.AsKeyword */) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */) { if (ts.isImportSpecifier(parent) && parent.propertyName || ts.isExportSpecifier(parent) && parent.propertyName || ts.isNamespaceImport(parent) || @@ -129475,12 +130675,12 @@ var ts; } } // import name = /**/require("[|module|]"); - if (node.kind === 146 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { + if (node.kind === 147 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { return parent.expression; } // import ... /**/from "[|module|]"; // export ... /**/from "[|module|]"; - if (node.kind === 156 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { + if (node.kind === 158 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { return parent.moduleSpecifier; } // class ... /**/extends [|name|] ... @@ -129505,7 +130705,7 @@ var ts; } } // ... T extends /**/infer [|U|] ? ... - if (node.kind === 137 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { + if (node.kind === 138 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { return parent.typeParameter.name; } // { [ [|K|] /**/in keyof T]: ... } @@ -129513,12 +130713,12 @@ var ts; return parent.name; } // /**/keyof [|T|] - if (node.kind === 140 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 140 /* SyntaxKind.KeyOfKeyword */ && + if (node.kind === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // /**/readonly [|name|][] - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */ && + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isArrayTypeNode(parent.type) && ts.isTypeReferenceNode(parent.type.elementType)) { return parent.type.elementType.typeName; } @@ -129536,7 +130736,7 @@ var ts; if (node.kind === 103 /* SyntaxKind.NewKeyword */ && ts.isNewExpression(parent) || node.kind === 114 /* SyntaxKind.VoidKeyword */ && ts.isVoidExpression(parent) || node.kind === 112 /* SyntaxKind.TypeOfKeyword */ && ts.isTypeOfExpression(parent) || - node.kind === 132 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || + node.kind === 133 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || node.kind === 125 /* SyntaxKind.YieldKeyword */ && ts.isYieldExpression(parent) || node.kind === 89 /* SyntaxKind.DeleteKeyword */ && ts.isDeleteExpression(parent)) { if (parent.expression) { @@ -129549,13 +130749,13 @@ var ts; return ts.skipOuterExpressions(parent.right); } // left /**/as [|name|] - if (node.kind === 127 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // for (... /**/in [|name|]) // for (... /**/of [|name|]) if (node.kind === 101 /* SyntaxKind.InKeyword */ && ts.isForInStatement(parent) || - node.kind === 160 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { + node.kind === 162 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { return ts.skipOuterExpressions(parent.expression); } } @@ -129787,7 +130987,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 305 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 308 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -129818,7 +131018,7 @@ var ts; for (var i = exclusiveStartPosition - 1; i >= 0; i--) { var child = children[i]; if (isWhiteSpaceOnlyJsxText(child)) { - if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { ts.Debug.fail("`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`"); } } @@ -129862,17 +131062,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
|
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return true; } return false; @@ -129903,7 +131103,7 @@ var ts; function isInsideJsxElement(sourceFile, position) { function isInsideJsxElementTraversal(node) { while (node) { - if (node.kind >= 279 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 288 /* SyntaxKind.JsxExpression */ + if (node.kind >= 282 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 291 /* SyntaxKind.JsxExpression */ || node.kind === 11 /* SyntaxKind.JsxText */ || node.kind === 29 /* SyntaxKind.LessThanToken */ || node.kind === 31 /* SyntaxKind.GreaterThanToken */ @@ -129913,7 +131113,7 @@ var ts; || node.kind === 43 /* SyntaxKind.SlashToken */) { node = node.parent; } - else if (node.kind === 278 /* SyntaxKind.JsxElement */) { + else if (node.kind === 281 /* SyntaxKind.JsxElement */) { if (position > node.getStart(sourceFile)) return true; node = node.parent; @@ -130061,7 +131261,7 @@ var ts; // falls through case 112 /* SyntaxKind.TypeOfKeyword */: case 94 /* SyntaxKind.ExtendsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: case 24 /* SyntaxKind.DotToken */: case 51 /* SyntaxKind.BarToken */: case 57 /* SyntaxKind.QuestionToken */: @@ -130082,7 +131282,7 @@ var ts; /** * Returns true if the cursor at position in sourceFile is within a comment. * - * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position) + * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position)` * @param predicate Additional predicate to test on the comment range. */ function isInComment(sourceFile, position, tokenAtPosition) { @@ -130113,7 +131313,7 @@ var ts; result.push("public" /* ScriptElementKindModifier.publicMemberModifier */); if (flags & 32 /* ModifierFlags.Static */ || ts.isClassStaticBlockDeclaration(node)) result.push("static" /* ScriptElementKindModifier.staticModifier */); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push("abstract" /* ScriptElementKindModifier.abstractModifier */); if (flags & 1 /* ModifierFlags.Export */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); @@ -130121,16 +131321,16 @@ var ts; result.push("deprecated" /* ScriptElementKindModifier.deprecatedModifier */); if (node.flags & 16777216 /* NodeFlags.Ambient */) result.push("declare" /* ScriptElementKindModifier.ambientModifier */); - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); return result.length > 0 ? result.join(",") : "" /* ScriptElementKindModifier.none */; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 210 /* SyntaxKind.CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return node.typeParameters; } return undefined; @@ -130175,18 +131375,18 @@ var ts; } ts.cloneCompilerOptions = cloneCompilerOptions; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || - node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || + node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + if (node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return true; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -130194,7 +131394,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -130256,32 +131456,32 @@ var ts; } ts.createTextChange = createTextChange; ts.typeKeywords = [ - 130 /* SyntaxKind.AnyKeyword */, - 128 /* SyntaxKind.AssertsKeyword */, - 158 /* SyntaxKind.BigIntKeyword */, - 133 /* SyntaxKind.BooleanKeyword */, + 131 /* SyntaxKind.AnyKeyword */, + 129 /* SyntaxKind.AssertsKeyword */, + 160 /* SyntaxKind.BigIntKeyword */, + 134 /* SyntaxKind.BooleanKeyword */, 95 /* SyntaxKind.FalseKeyword */, - 137 /* SyntaxKind.InferKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 143 /* SyntaxKind.NeverKeyword */, + 138 /* SyntaxKind.InferKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 144 /* SyntaxKind.NeverKeyword */, 104 /* SyntaxKind.NullKeyword */, - 147 /* SyntaxKind.NumberKeyword */, - 148 /* SyntaxKind.ObjectKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 150 /* SyntaxKind.StringKeyword */, - 151 /* SyntaxKind.SymbolKeyword */, + 148 /* SyntaxKind.NumberKeyword */, + 149 /* SyntaxKind.ObjectKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 152 /* SyntaxKind.StringKeyword */, + 153 /* SyntaxKind.SymbolKeyword */, 110 /* SyntaxKind.TrueKeyword */, 114 /* SyntaxKind.VoidKeyword */, - 153 /* SyntaxKind.UndefinedKeyword */, - 154 /* SyntaxKind.UniqueKeyword */, - 155 /* SyntaxKind.UnknownKeyword */, + 155 /* SyntaxKind.UndefinedKeyword */, + 156 /* SyntaxKind.UniqueKeyword */, + 157 /* SyntaxKind.UnknownKeyword */, ]; function isTypeKeyword(kind) { return ts.contains(ts.typeKeywords, kind); } ts.isTypeKeyword = isTypeKeyword; function isTypeKeywordToken(node) { - return node.kind === 152 /* SyntaxKind.TypeKeyword */; + return node.kind === 154 /* SyntaxKind.TypeKeyword */; } ts.isTypeKeywordToken = isTypeKeywordToken; function isTypeKeywordTokenOrIdentifier(node) { @@ -130318,7 +131518,7 @@ var ts; } ts.skipConstraint = skipConstraint; function getNameFromPropertyName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ // treat computed property names where expression is string/numeric literal as just string/numeric literal ? ts.isStringOrNumericLiteralLike(name.expression) ? name.expression.text : undefined : ts.isPrivateIdentifier(name) ? ts.idText(name) : ts.getTextOfIdentifierOrLiteral(name); @@ -130468,7 +131668,7 @@ var ts; ts.findModifier = findModifier; function insertImports(changes, sourceFile, imports, blankLineBetween) { var decl = ts.isArray(imports) ? imports[0] : imports; - var importKindPredicate = decl.kind === 237 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; + var importKindPredicate = decl.kind === 240 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; var existingImportStatements = ts.filter(sourceFile.statements, importKindPredicate); var sortedNewImports = ts.isArray(imports) ? ts.stableSort(imports, ts.OrganizeImports.compareImportsOrRequireStatements) : [imports]; if (!existingImportStatements.length) { @@ -131142,15 +132342,15 @@ var ts; function getContextualTypeFromParent(node, checker) { var parent = node.parent; switch (parent.kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checker.getContextualType(parent); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var _a = parent, left = _a.left, operatorToken = _a.operatorToken, right = _a.right; return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node); } - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return parent.expression === node ? getSwitchedType(parent, checker) : undefined; default: return checker.getContextualType(node); @@ -131180,8 +132380,8 @@ var ts; switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return true; default: return false; @@ -131215,38 +132415,38 @@ var ts; } ts.getTypeNodeIfAccessible = getTypeNodeIfAccessible; function syntaxRequiresTrailingCommaOrSemicolonOrASI(kind) { - return kind === 174 /* SyntaxKind.CallSignature */ - || kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */; + return kind === 176 /* SyntaxKind.CallSignature */ + || kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */; } function syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind) { - return kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 264 /* SyntaxKind.ModuleDeclaration */; } function syntaxRequiresTrailingSemicolonOrASI(kind) { - return kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.syntaxRequiresTrailingSemicolonOrASI = syntaxRequiresTrailingSemicolonOrASI; ts.syntaxMayBeASICandidate = ts.or(syntaxRequiresTrailingCommaOrSemicolonOrASI, syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI, syntaxRequiresTrailingModuleBlockOrSemicolonOrASI, syntaxRequiresTrailingSemicolonOrASI); @@ -131276,7 +132476,7 @@ var ts; return false; } // See comment in parser’s `parseDoStatement` - if (node.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.kind === 243 /* SyntaxKind.DoStatement */) { return true; } var topNode = ts.findAncestor(node, function (ancestor) { return !ancestor.parent; }); @@ -131765,6 +132965,10 @@ var ts; return jsx === 2 /* JsxEmit.React */ || jsx === 3 /* JsxEmit.ReactNative */; } ts.jsxModeNeedsExplicitImport = jsxModeNeedsExplicitImport; + function isSourceFileFromLibrary(program, node) { + return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node); + } + ts.isSourceFileFromLibrary = isSourceFileFromLibrary; // #endregion })(ts || (ts = {})); /*@internal*/ @@ -131880,14 +133084,16 @@ var ts; search: function (importingFile, preferCapitalized, matches, action) { if (importingFile !== usableByFileName) return; - exportInfo.forEach(function (info, key) { + return ts.forEachEntry(exportInfo, function (info, key) { var _a = parseKey(key), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName; var name = preferCapitalized && info[0].capitalizedSymbolName || symbolName; if (matches(name, info[0].targetFlags)) { var rehydrated = info.map(rehydrateCachedInfo); var filtered = rehydrated.filter(function (r, i) { return isNotShadowedByDeeperNodeModulesPackage(r, info[i].packageName); }); if (filtered.length) { - action(filtered, name, !!ambientModuleName, key); + var res = action(filtered, name, !!ambientModuleName, key); + if (res !== undefined) + return res; } } }); @@ -132275,11 +133481,11 @@ var ts; angleBracketStack--; } break; - case 130 /* SyntaxKind.AnyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, @@ -132468,10 +133674,11 @@ var ts; return true; } switch (keyword2) { - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: return true; // Allow things like "public get", "public constructor" and "public static". default: return false; // Any other keyword following "public" is actually an identifier, not a real keyword. @@ -132518,7 +133725,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: case 34 /* SyntaxKind.EqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: @@ -132614,13 +133822,13 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -132842,46 +134050,46 @@ var ts; pos = tag.tagName.end; var commentStart = tag.tagName.end; switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var param = tag; processJSDocParameterTag(param); commentStart = param.isNameFirst && ((_a = param.typeExpression) === null || _a === void 0 ? void 0 : _a.end) || param.name.end; break; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var prop = tag; commentStart = prop.isNameFirst && ((_b = prop.typeExpression) === null || _b === void 0 ? void 0 : _b.end) || prop.name.end; break; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: processJSDocTemplateTag(tag); pos = tag.end; commentStart = tag.typeParameters.end; break; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: var type = tag; - commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 309 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; + commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 312 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; break; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: commentStart = tag.typeExpression.end; break; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = tag.typeExpression.end; break; - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: commentStart = tag.typeExpression.end; break; - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = ((_f = tag.typeExpression) === null || _f === void 0 ? void 0 : _f.end) || commentStart; break; - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: commentStart = ((_g = tag.name) === null || _g === void 0 ? void 0 : _g.end) || commentStart; break; - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: commentStart = tag.class.end; break; } @@ -132928,7 +134136,7 @@ var ts; // defined in `ts.commentPragmas` would be excessive, but we can avoid // some obvious false positives (e.g. in XML-like doc comments) by // checking the element name. - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!match[3] || !(match[3] in ts.commentPragmas)) { return false; } @@ -133038,22 +134246,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* ClassificationType.jsxOpenTagName */; } break; - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* ClassificationType.jsxCloseTagName */; } break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* ClassificationType.jsxSelfClosingTagName */; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: if (token.parent.name === token) { return 22 /* ClassificationType.jsxAttribute */; } @@ -133082,17 +134290,17 @@ var ts; var parent = token.parent; if (tokenKind === 63 /* SyntaxKind.EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 164 /* SyntaxKind.Parameter */ || - parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 166 /* SyntaxKind.Parameter */ || + parent.kind === 288 /* SyntaxKind.JsxAttribute */) { return 5 /* ClassificationType.operator */; } } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ || - parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || - parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */ || - parent.kind === 222 /* SyntaxKind.ConditionalExpression */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ || + parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || + parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */ || + parent.kind === 224 /* SyntaxKind.ConditionalExpression */) { return 5 /* ClassificationType.operator */; } } @@ -133105,7 +134313,7 @@ var ts; return 25 /* ClassificationType.bigintLiteral */; } else if (tokenKind === 10 /* SyntaxKind.StringLiteral */) { - return token && token.parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; + return token && token.parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; } else if (tokenKind === 13 /* SyntaxKind.RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -133121,32 +134329,32 @@ var ts; else if (tokenKind === 79 /* SyntaxKind.Identifier */) { if (token) { switch (token.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (token.parent.name === token) { return 11 /* ClassificationType.className */; } return; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: if (token.parent.name === token) { return 15 /* ClassificationType.typeParameterName */; } return; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* ClassificationType.interfaceName */; } return; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (token.parent.name === token) { return 12 /* ClassificationType.enumName */; } return; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (token.parent.name === token) { return 14 /* ClassificationType.moduleName */; } return; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (token.parent.name === token) { return ts.isThisIdentifier(token) ? 3 /* ClassificationType.keyword */ : 17 /* ClassificationType.parameterName */; } @@ -133251,13 +134459,13 @@ var ts; var inJSXElement = false; function visit(node) { switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!node || !ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) { @@ -133297,7 +134505,7 @@ var ts; if (modifiers & 32 /* ModifierFlags.Static */) { modifierSet |= 1 << 1 /* TokenModifier.static */; } - if (modifiers & 256 /* ModifierFlags.Async */) { + if (modifiers & 512 /* ModifierFlags.Async */) { modifierSet |= 1 << 2 /* TokenModifier.async */; } if (typeIdx !== 0 /* TokenType.class */ && typeIdx !== 2 /* TokenType.interface */) { @@ -133403,25 +134611,25 @@ var ts; return (ts.isQualifiedName(node.parent) && node.parent.right === node) || (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node); } var tokenFromDeclarationMapping = new ts.Map([ - [254 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], - [164 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], - [167 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], - [261 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], - [260 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], - [299 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], - [257 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], - [169 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], - [256 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], - [213 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], - [168 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], - [172 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], - [173 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], - [166 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], - [258 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], - [259 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], - [163 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], - [296 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], - [297 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] + [257 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], + [166 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], + [169 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], + [264 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], + [263 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], + [302 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], + [260 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], + [171 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], + [259 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], + [215 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], + [170 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], + [174 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], + [175 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], + [168 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], + [261 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], + [262 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], + [165 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], + [299 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], + [300 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] ]); })(v2020 = classifier.v2020 || (classifier.v2020 = {})); })(classifier = ts.classifier || (ts.classifier = {})); @@ -133555,18 +134763,18 @@ var ts; function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host, preferences) { var parent = walkUpParentheses(node.parent); switch (parent.kind) { - case 196 /* SyntaxKind.LiteralType */: { + case 198 /* SyntaxKind.LiteralType */: { var grandParent_1 = walkUpParentheses(parent.parent); switch (grandParent_1.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: { var typeArgument = ts.findAncestor(parent, function (n) { return n.parent === grandParent_1; }); if (typeArgument) { return { kind: 2 /* StringLiteralCompletionKind.Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false }; } return undefined; } - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: // Get all apparent property names // i.e. interface Foo { // foo: string; @@ -133578,9 +134786,9 @@ var ts; return undefined; } return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType)); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return { kind: 0 /* StringLiteralCompletionKind.Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; - case 187 /* SyntaxKind.UnionType */: { + case 189 /* SyntaxKind.UnionType */: { if (!ts.isTypeReferenceNode(grandParent_1.parent)) { return undefined; } @@ -133592,7 +134800,7 @@ var ts; return undefined; } } - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isObjectLiteralExpression(parent.parent) && parent.name === node) { // Get quoted name of properties of the object literal expression // i.e. interface ConfigFiles { @@ -133609,7 +134817,7 @@ var ts; return stringLiteralCompletionsForObjectLiteral(typeChecker, parent.parent); } return fromContextualType(); - case 207 /* SyntaxKind.ElementAccessExpression */: { + case 209 /* SyntaxKind.ElementAccessExpression */: { var _b = parent, expression = _b.expression, argumentExpression = _b.argumentExpression; if (node === ts.skipParentheses(argumentExpression)) { // Get all names of properties on the expression @@ -133622,20 +134830,20 @@ var ts; } return undefined; } - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 285 /* SyntaxKind.JsxAttribute */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 288 /* SyntaxKind.JsxAttribute */: if (!isRequireCallArgument(node) && !ts.isImportCall(parent)) { - var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); + var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); // Get string literal completions from specialized signatures of the target // i.e. declare function f(a: 'A'); // f("/*completion position*/") - return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) : fromContextualType(); + return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(); } // falls through (is `require("")` or `require(""` or `import("")`) - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 277 /* SyntaxKind.ExternalModuleReference */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 280 /* SyntaxKind.ExternalModuleReference */: // Get all known external module names or complete a path to a module // i.e. import * as ns from "/*completion position*/"; // var y = import("/*completion position*/"); @@ -133654,9 +134862,9 @@ var ts; } function walkUpParentheses(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return ts.walkUpParenthesizedTypes(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return ts.walkUpParenthesizedExpressions(node); default: return node; @@ -133686,7 +134894,7 @@ var ts; isNewIdentifier = isNewIdentifier || !!(type.flags & 4 /* TypeFlags.String */); return getStringLiteralTypes(type, uniques); }); - return { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier }; + return ts.length(types) ? { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier } : undefined; } function stringLiteralCompletionsFromProperties(type) { return type && { @@ -134204,7 +135412,7 @@ var ts; if (!dependencies) continue; for (var dep in dependencies) { - if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { + if (ts.hasProperty(dependencies, dep) && !ts.startsWith(dep, "@types/")) { result.push(dep); } } @@ -134579,7 +135787,7 @@ var ts; } function keywordFiltersFromSyntaxKind(keywordCompletion) { switch (keywordCompletion) { - case 152 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; + case 154 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; default: ts.Debug.fail("Unknown mapping from SyntaxKind to KeywordCompletionFilters"); } } @@ -134588,7 +135796,7 @@ var ts; return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* SyntaxKind.Identifier */ ? ts.createTextSpanFromNode(location) : undefined; } function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) { - var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importCompletionNode = completionData.importCompletionNode, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; + var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importStatementCompletion = completionData.importStatementCompletion, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; // Verify if the file is JSX language variant if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* LanguageVariant.JSX */) { var completionInfo = getJsxClosingTagCompletion(location, sourceFile); @@ -134602,7 +135810,7 @@ var ts; return undefined; } var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, - /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); + /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); if (keywordFilters !== 0 /* KeywordCompletionFilters.None */) { for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) { var keywordEntry = _a[_i]; @@ -134655,12 +135863,12 @@ var ts; // We wanna walk up the tree till we find a JSX closing element var jsxClosingElement = ts.findAncestor(location, function (node) { switch (node.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: return true; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return false; default: return "quit"; @@ -134720,7 +135928,7 @@ var ts; function createCompletionEntryForLiteral(sourceFile, preferences, literal) { return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* ScriptElementKind.string */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.LocationPriority }; } - function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { + function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { var _a, _b; var insertText; var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken); @@ -134776,8 +135984,8 @@ var ts; } if (originIsResolvedExport(origin)) { sourceDisplay = [ts.textPart(origin.moduleSpecifier)]; - if (importCompletionNode) { - (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); + if (importStatementCompletion) { + (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined; } } @@ -134787,7 +135995,7 @@ var ts; if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* CompletionKind.MemberLike */ && - isClassLikeMemberCompletion(symbol, location)) { + isClassLikeMemberCompletion(symbol, location, sourceFile)) { var importAdder = void 0; (_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder, replacementSpan = _b.replacementSpan); sortText = Completions.SortText.ClassMemberSnippets; // sortText has to be lower priority than the sortText for keywords. See #47852. @@ -134832,7 +136040,7 @@ var ts; } if (originIsExport(origin) || originIsResolvedExport(origin)) { data = originToCompletionEntryData(origin); - hasAction = !importCompletionNode; + hasAction = !importStatementCompletion; } // TODO(drosen): Right now we just permit *all* semantic meanings when calling // 'getSymbolKind' which is permissible given that it is backwards compatible; but @@ -134855,11 +136063,11 @@ var ts; labelDetails: labelDetails, isSnippet: isSnippet, isPackageJsonImport: originIsPackageJsonImport(origin) || undefined, - isImportStatementCompletion: !!importCompletionNode || undefined, + isImportStatementCompletion: !!importStatementCompletion || undefined, data: data, }; } - function isClassLikeMemberCompletion(symbol, location) { + function isClassLikeMemberCompletion(symbol, location, sourceFile) { // TODO: support JS files. if (ts.isInJSFile(location)) { return false; @@ -134893,6 +136101,7 @@ var ts; location.parent.parent && ts.isClassElement(location.parent) && location === location.parent.name && + location.parent.getLastToken(sourceFile) === location.parent.name && ts.isClassLike(location.parent.parent)) || (location.parent && ts.isSyntaxList(location) && @@ -134934,7 +136143,7 @@ var ts; // Whether the suggested member should be abstract. // e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`. var _a = getPresentModifiers(contextToken), presentModifiers = _a.modifiers, modifiersSpan = _a.span; - var isAbstract = !!(presentModifiers & 128 /* ModifierFlags.Abstract */); + var isAbstract = !!(presentModifiers & 256 /* ModifierFlags.Abstract */); var completionNodes = []; ts.codefix.addNewNodeForMemberSymbol(symbol, classLikeDeclaration, sourceFile, { program: program, host: host }, preferences, importAdder, // `addNewNodeForMemberSymbol` calls this callback function for each new member node @@ -134947,7 +136156,7 @@ var ts; function (node) { var requiredModifiers = 0 /* ModifierFlags.None */; if (isAbstract) { - requiredModifiers |= 128 /* ModifierFlags.Abstract */; + requiredModifiers |= 256 /* ModifierFlags.Abstract */; } if (ts.isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* MemberOverrideStatus.NeedsOverride */) { @@ -135008,7 +136217,7 @@ var ts; span = ts.createTextSpanFromNode(contextToken); } if (ts.isPropertyDeclaration(contextToken.parent)) { - modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 125951 /* ModifierFlags.Modifier */; + modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 126975 /* ModifierFlags.Modifier */; span = ts.createTextSpanFromNode(contextToken.parent); } return { modifiers: modifiers, span: span }; @@ -135057,7 +136266,6 @@ var ts; var labelDetails = { detail: signaturePrinter.printNode(4 /* EmitHint.Unspecified */, methodSignature, sourceFile) }; return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails }; } - ; function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) { var declarations = symbol.getDeclarations(); if (!(declarations && declarations.length)) { @@ -135070,10 +136278,10 @@ var ts; var quotePreference = ts.getQuotePreference(sourceFile, preferences); var builderFlags = 33554432 /* NodeBuilderFlags.OmitThisParameter */ | (quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : 0 /* NodeBuilderFlags.None */); switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: { var effectiveType = type.flags & 1048576 /* TypeFlags.Union */ && type.types.length < 10 ? checker.getUnionType(type.types, 2 /* UnionReduction.Subtype */) : type; @@ -135107,7 +136315,8 @@ var ts; } var parameters = typeNode.parameters.map(function (typedParam) { return ts.factory.createParameterDeclaration( - /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, typedParam.questionToken, + /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, + /*questionToken*/ undefined, /*type*/ undefined, typedParam.initializer); }); return ts.factory.createMethodDeclaration( @@ -135227,20 +136436,17 @@ var ts; }; return unresolvedOrigin; } - function getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences) { - var _a, _b, _c; - var sourceFile = importCompletionNode.getSourceFile(); - var replacementSpan = ts.createTextSpanFromNode(ts.findAncestor(importCompletionNode, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)) || importCompletionNode, sourceFile); + function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) { + var replacementSpan = importStatementCompletion.replacementSpan; var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier); var exportKind = origin.isDefaultExport ? 1 /* ExportKind.Default */ : origin.exportName === "export=" /* InternalSymbolName.ExportEquals */ ? 2 /* ExportKind.ExportEquals */ : 0 /* ExportKind.Named */; var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : ""; var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options, /*forceImportKeyword*/ true); - var isTopLevelTypeOnly = ((_b = (_a = ts.tryCast(importCompletionNode, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || ((_c = ts.tryCast(importCompletionNode, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly); - var isImportSpecifierTypeOnly = couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); - var topLevelTypeOnlyText = isTopLevelTypeOnly ? " ".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : " "; - var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : ""; + var isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier; + var topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " "; + var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : ""; var suffix = useSemicolons ? ";" : ""; switch (importKind) { case 3 /* ImportKind.CommonJS */: return { replacementSpan: replacementSpan, insertText: "import".concat(topLevelTypeOnlyText).concat(ts.escapeSnippetText(name)).concat(tabStop, " = require(").concat(quotedModuleSpecifier, ")").concat(suffix) }; @@ -135273,7 +136479,7 @@ var ts; return CompletionSource.TypeOnlyAlias; } } - function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { + function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { var _a; var start = ts.timestamp(); var variableDeclaration = getVariableDeclaration(location); @@ -135294,7 +136500,7 @@ var ts; var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess; var originalSortText = (_a = symbolToSortTextMap === null || symbolToSortTextMap === void 0 ? void 0 : symbolToSortTextMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : Completions.SortText.LocationPriority; var sortText = (isDeprecated(symbol, typeChecker) ? Completions.SortText.Deprecated(originalSortText) : originalSortText); - var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); + var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); if (!entry) { continue; } @@ -135454,7 +136660,7 @@ var ts; } case "symbol": { var symbol = symbolCompletion.symbol, location = symbolCompletion.location, contextToken_2 = symbolCompletion.contextToken, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken; - var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; + var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); // TODO: GH#18217 } case "literal": { @@ -135483,9 +136689,9 @@ var ts; return { name: name, kindModifiers: kindModifiers, kind: kind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source, sourceDisplay: source }; } Completions.createCompletionDetails = createCompletionDetails; - function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) { + function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) { if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) { - if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementNode) { + if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) { // Import statement completion: 'import c|' return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] }; } @@ -135515,7 +136721,7 @@ var ts; var moduleSymbol = origin.moduleSymbol; var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker)); var isJsxOpeningTagName = (contextToken === null || contextToken === void 0 ? void 0 : contextToken.kind) === 29 /* SyntaxKind.LessThanToken */ && ts.isJsxOpeningLikeElement(contextToken.parent); - var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; + var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences, cancellationToken), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier); return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] }; } @@ -135558,11 +136764,11 @@ var ts; return ts.getContextualTypeFromParent(previousToken, checker); case 63 /* SyntaxKind.EqualsToken */: switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.getContextualType(parent.initializer); // TODO: GH#18217 - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checker.getTypeAtLocation(parent.left); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return checker.getContextualTypeForJsxAttribute(parent); default: return undefined; @@ -135593,7 +136799,7 @@ var ts; } function isModuleSymbol(symbol) { var _a; - return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 305 /* SyntaxKind.SourceFile */; })); + return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 308 /* SyntaxKind.SourceFile */; })); } function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) { var typeChecker = program.getTypeChecker(); @@ -135650,7 +136856,7 @@ var ts; currentToken = ts.getTokenAtPosition(sourceFile, position); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 347 /* SyntaxKind.JSDocPropertyTag */ || + (currentToken.parent.kind !== 350 /* SyntaxKind.JSDocPropertyTag */ || currentToken.parent.name !== currentToken))) { // Use as type location if inside tag's type expression insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression); @@ -135686,34 +136892,34 @@ var ts; var isStartingCloseTag = false; var isJsxInitializer = false; var isJsxIdentifierExpected = false; - var importCompletionNode; + var importStatementCompletion; var location = ts.getTouchingPropertyName(sourceFile, position); var keywordFilters = 0 /* KeywordCompletionFilters.None */; var isNewIdentifierLocation = false; var flags = 0 /* CompletionInfoFlags.None */; if (contextToken) { - var importStatementCompletion = getImportStatementCompletionInfo(contextToken); - isNewIdentifierLocation = importStatementCompletion.isNewIdentifierLocation; - if (importStatementCompletion.keywordCompletion) { - if (importStatementCompletion.isKeywordOnlyCompletion) { + var importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken); + if (importStatementCompletionInfo.keywordCompletion) { + if (importStatementCompletionInfo.isKeywordOnlyCompletion) { return { kind: 4 /* CompletionDataKind.Keywords */, - keywordCompletions: [keywordToCompletionEntry(importStatementCompletion.keywordCompletion)], - isNewIdentifierLocation: isNewIdentifierLocation, + keywordCompletions: [keywordToCompletionEntry(importStatementCompletionInfo.keywordCompletion)], + isNewIdentifierLocation: importStatementCompletionInfo.isNewIdentifierLocation, }; } - keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletion.keywordCompletion); + keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletionInfo.keywordCompletion); } - if (importStatementCompletion.replacementNode && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { + if (importStatementCompletionInfo.replacementSpan && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { // Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier` // added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients // to opt in with the `includeCompletionsForImportStatements` user preference. - importCompletionNode = importStatementCompletion.replacementNode; flags |= 2 /* CompletionInfoFlags.IsImportStatementCompletion */; + importStatementCompletion = importStatementCompletionInfo; + isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation; } // Bail out if this is a known invalid completion location - if (!importCompletionNode && isCompletionListBlocker(contextToken)) { + if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) { log("Returning an empty list because completion was requested in an invalid position."); return keywordFilters ? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation()) @@ -135724,7 +136930,7 @@ var ts; isRightOfDot = contextToken.kind === 24 /* SyntaxKind.DotToken */; isRightOfQuestionDot = contextToken.kind === 28 /* SyntaxKind.QuestionDotToken */; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; var leftmostAccessExpression = ts.getLeftmostAccessExpression(propertyAccessToConvert); @@ -135740,16 +136946,16 @@ var ts; return undefined; } break; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: node = parent.left; break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: node = parent.name; break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: node = parent; break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: node = parent.getFirstToken(sourceFile); ts.Debug.assert(node.kind === 100 /* SyntaxKind.ImportKeyword */ || node.kind === 103 /* SyntaxKind.NewKeyword */); break; @@ -135759,11 +136965,11 @@ var ts; return undefined; } } - else if (!importCompletionNode && sourceFile.languageVariant === 1 /* LanguageVariant.JSX */) { + else if (!importStatementCompletion) { // // If the tagname is a property access expression, we will then walk up to the top most of property access expression. // Then, try to get a JSX container and its associated attributes type. - if (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { contextToken = parent; parent = parent.parent; } @@ -135771,46 +136977,46 @@ var ts; if (currentToken.parent === location) { switch (currentToken.kind) { case 31 /* SyntaxKind.GreaterThanToken */: - if (currentToken.parent.kind === 278 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (currentToken.parent.kind === 281 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { location = currentToken; } break; case 43 /* SyntaxKind.SlashToken */: - if (currentToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { + if (currentToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { location = currentToken; } break; } } switch (parent.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (contextToken.kind === 43 /* SyntaxKind.SlashToken */) { isStartingCloseTag = true; location = contextToken; } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (!binaryExpressionMayBeOpenTag(parent)) { break; } // falls through - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: isJsxIdentifierExpected = true; if (contextToken.kind === 29 /* SyntaxKind.LessThanToken */) { isRightOfOpenTag = true; location = contextToken; } break; - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: // For `
`, `parent` will be `{true}` and `previousToken` will be `}` if (previousToken.kind === 19 /* SyntaxKind.CloseBraceToken */ && currentToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { isJsxIdentifierExpected = true; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: // For `
`, `parent` will be JsxAttribute and `previousToken` will be its initializer if (parent.initializer === previousToken && previousToken.end < position) { @@ -135902,19 +137108,19 @@ var ts; isTypeOnlyLocation: isTypeOnlyLocation, isJsxIdentifierExpected: isJsxIdentifierExpected, isRightOfOpenTag: isRightOfOpenTag, - importCompletionNode: importCompletionNode, + importStatementCompletion: importStatementCompletion, hasUnresolvedAutoImports: hasUnresolvedAutoImports, flags: flags, }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return true; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return !!tag.constraint; default: return false; @@ -135923,7 +137129,7 @@ var ts; function tryGetTypeExpressionFromTag(tag) { if (isTagWithTypeExpression(tag)) { var typeExpression = ts.isJSDocTemplateTag(tag) ? tag.constraint : tag.typeExpression; - return typeExpression && typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; + return typeExpression && typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; } return undefined; } @@ -135966,7 +137172,7 @@ var ts; // If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods). if (!isTypeLocation && symbol.declarations && - symbol.declarations.some(function (d) { return d.kind !== 305 /* SyntaxKind.SourceFile */ && d.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 260 /* SyntaxKind.EnumDeclaration */; })) { + symbol.declarations.some(function (d) { return d.kind !== 308 /* SyntaxKind.SourceFile */ && d.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 263 /* SyntaxKind.EnumDeclaration */; })) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node).getNonOptionalType(); var insertQuestionDot = false; if (type.isNullableType()) { @@ -136012,7 +137218,7 @@ var ts; if (isRightOfQuestionDot && ts.some(type.getCallSignatures())) { isNewIdentifierLocation = true; } - var propertyAccess = node.kind === 200 /* SyntaxKind.ImportType */ ? node : node.parent; + var propertyAccess = node.kind === 202 /* SyntaxKind.ImportType */ ? node : node.parent; if (inCheckedFile) { for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { var symbol = _a[_i]; @@ -136156,7 +137362,7 @@ var ts; return 1 /* GlobalsSearch.Success */; } function tryGetImportCompletionSymbols() { - if (!importCompletionNode) + if (!importStatementCompletion) return 0 /* GlobalsSearch.Continue */; isNewIdentifierLocation = true; collectAutoImports(); @@ -136219,7 +137425,7 @@ var ts; } } // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions` - if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 305 /* SyntaxKind.SourceFile */) { + if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 308 /* SyntaxKind.SourceFile */) { var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false, ts.isClassLike(scopeNode.parent) ? scopeNode : undefined); if (thisType && !isProbablyGlobalType(thisType, sourceFile, typeChecker)) { for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) { @@ -136239,7 +137445,7 @@ var ts; } function shouldOfferImportCompletions() { // If already typing an import statement, provide completions for it. - if (importCompletionNode) + if (importStatementCompletion) return true; // If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols if (isNonContextualObjectLiteral) @@ -136258,10 +137464,10 @@ var ts; } function isSnippetScope(scopeNode) { switch (scopeNode.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 223 /* SyntaxKind.TemplateExpression */: - case 288 /* SyntaxKind.JsxExpression */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 225 /* SyntaxKind.TemplateExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 238 /* SyntaxKind.Block */: return true; default: return ts.isStatement(scopeNode); @@ -136269,7 +137475,7 @@ var ts; } function isTypeOnlyCompletion() { return insideJsDocTagTypeExpression - || !!importCompletionNode && ts.isTypeOnlyImportOrExportDeclaration(location.parent) + || !!importStatementCompletion && ts.isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || ts.isPartOfTypeNode(location) @@ -136278,28 +137484,30 @@ var ts; function isContextTokenValueLocation(contextToken) { return contextToken && ((contextToken.kind === 112 /* SyntaxKind.TypeOfKeyword */ && - (contextToken.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || - (contextToken.kind === 128 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 177 /* SyntaxKind.TypePredicate */)); + (contextToken.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || + (contextToken.kind === 129 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 179 /* SyntaxKind.TypePredicate */)); } function isContextTokenTypeLocation(contextToken) { if (contextToken) { var parentKind = contextToken.parent.kind; switch (contextToken.kind) { case 58 /* SyntaxKind.ColonToken */: - return parentKind === 167 /* SyntaxKind.PropertyDeclaration */ || - parentKind === 166 /* SyntaxKind.PropertySignature */ || - parentKind === 164 /* SyntaxKind.Parameter */ || - parentKind === 254 /* SyntaxKind.VariableDeclaration */ || + return parentKind === 169 /* SyntaxKind.PropertyDeclaration */ || + parentKind === 168 /* SyntaxKind.PropertySignature */ || + parentKind === 166 /* SyntaxKind.Parameter */ || + parentKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(parentKind); case 63 /* SyntaxKind.EqualsToken */: - return parentKind === 259 /* SyntaxKind.TypeAliasDeclaration */; - case 127 /* SyntaxKind.AsKeyword */: - return parentKind === 229 /* SyntaxKind.AsExpression */; + return parentKind === 262 /* SyntaxKind.TypeAliasDeclaration */; + case 128 /* SyntaxKind.AsKeyword */: + return parentKind === 231 /* SyntaxKind.AsExpression */; case 29 /* SyntaxKind.LessThanToken */: - return parentKind === 178 /* SyntaxKind.TypeReference */ || - parentKind === 211 /* SyntaxKind.TypeAssertionExpression */; + return parentKind === 180 /* SyntaxKind.TypeReference */ || + parentKind === 213 /* SyntaxKind.TypeAssertionExpression */; case 94 /* SyntaxKind.ExtendsKeyword */: - return parentKind === 163 /* SyntaxKind.TypeParameter */; + return parentKind === 165 /* SyntaxKind.TypeParameter */; + case 150 /* SyntaxKind.SatisfiesKeyword */: + return parentKind === 235 /* SyntaxKind.SatisfiesExpression */; } } return false; @@ -136317,8 +137525,7 @@ var ts; flags |= 1 /* CompletionInfoFlags.MayIncludeAutoImports */; // import { type | -> token text should be blank var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken - && importCompletionNode - && couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); + && importStatementCompletion; var lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" : previousToken && ts.isIdentifier(previousToken) ? previousToken.text.toLowerCase() : ""; @@ -136326,14 +137533,14 @@ var ts; var exportInfo = ts.getExportInfoMap(sourceFile, host, program, preferences, cancellationToken); var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host); var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host); - resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importCompletionNode, ts.isValidTypeOnlyAliasUseSite(location), function (context) { + resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importStatementCompletion, ts.isValidTypeOnlyAliasUseSite(location), function (context) { exportInfo.search(sourceFile.path, /*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) { if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings()))) return false; if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName)) return false; - if (!isTypeOnlyLocation && !importCompletionNode && !(targetFlags & 111551 /* SymbolFlags.Value */)) + if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & 111551 /* SymbolFlags.Value */)) return false; if (isTypeOnlyLocation && !(targetFlags & (1536 /* SymbolFlags.Module */ | 788968 /* SymbolFlags.Type */))) return false; @@ -136414,7 +137621,7 @@ var ts; return; } symbolToOriginInfoMap[symbols.length] = origin; - symbolToSortTextMap[symbolId] = importCompletionNode ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; + symbolToSortTextMap[symbolId] = importStatementCompletion ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; symbols.push(symbol); } /* Mutates `symbols` and `symbolToOriginInfoMap`. */ @@ -136490,18 +137697,18 @@ var ts; // - contextToken: GreaterThanToken (before cursor) // - location: JsxSelfClosingElement or JsxOpeningElement // - contextToken.parent === location - if (location === contextToken.parent && (location.kind === 280 /* SyntaxKind.JsxOpeningElement */ || location.kind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (location === contextToken.parent && (location.kind === 283 /* SyntaxKind.JsxOpeningElement */ || location.kind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { return false; } - if (contextToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (contextToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { //
/**/ // - contextToken: GreaterThanToken (before cursor) // - location: JSXElement // - different parents (JSXOpeningElement, JSXElement) - return location.parent.kind !== 280 /* SyntaxKind.JsxOpeningElement */; + return location.parent.kind !== 283 /* SyntaxKind.JsxOpeningElement */; } - if (contextToken.parent.kind === 281 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { - return !!contextToken.parent.parent && contextToken.parent.parent.kind === 278 /* SyntaxKind.JsxElement */; + if (contextToken.parent.kind === 284 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { + return !!contextToken.parent.parent && contextToken.parent.parent.kind === 281 /* SyntaxKind.JsxElement */; } } return false; @@ -136513,44 +137720,44 @@ var ts; // Previous token may have been a keyword that was converted to an identifier. switch (tokenKind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( a, | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a, | - || containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [a, | - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */ // const x = (a, | - || containingNodeKind === 179 /* SyntaxKind.FunctionType */ // var x: (s: string, list| - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( a, | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a, | + || containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [a, | + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */ // const x = (a, | + || containingNodeKind === 181 /* SyntaxKind.FunctionType */ // var x: (s: string, list| + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( | - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a| - || containingNodeKind === 212 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| - || containingNodeKind === 191 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( | + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a| + || containingNodeKind === 214 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 193 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [ | - || containingNodeKind === 176 /* SyntaxKind.IndexSignature */ // [ | : string ] - || containingNodeKind === 162 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ - case 141 /* SyntaxKind.ModuleKeyword */: // module | - case 142 /* SyntaxKind.NamespaceKeyword */: // namespace | + return containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [ | + || containingNodeKind === 178 /* SyntaxKind.IndexSignature */ // [ | : string ] + || containingNodeKind === 164 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ + case 142 /* SyntaxKind.ModuleKeyword */: // module | + case 143 /* SyntaxKind.NamespaceKeyword */: // namespace | case 100 /* SyntaxKind.ImportKeyword */: // import | return true; case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 261 /* SyntaxKind.ModuleDeclaration */; // module A.| + return containingNodeKind === 264 /* SyntaxKind.ModuleDeclaration */; // module A.| case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ // class A { | - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ // class A { | + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | case 63 /* SyntaxKind.EqualsToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ // const x = a| - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */; // x = a| + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ // const x = a| + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */; // x = a| case 15 /* SyntaxKind.TemplateHead */: - return containingNodeKind === 223 /* SyntaxKind.TemplateExpression */; // `aa ${| + return containingNodeKind === 225 /* SyntaxKind.TemplateExpression */; // `aa ${| case 16 /* SyntaxKind.TemplateMiddle */: - return containingNodeKind === 233 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| - case 131 /* SyntaxKind.AsyncKeyword */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() - || containingNodeKind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| + return containingNodeKind === 236 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| + case 132 /* SyntaxKind.AsyncKeyword */: + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() + || containingNodeKind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| case 41 /* SyntaxKind.AsteriskToken */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| } if (isClassMemberCompletionKeyword(tokenKind)) { return true; @@ -136600,7 +137807,7 @@ var ts; completionKind = 0 /* CompletionKind.ObjectPropertyDeclaration */; var typeMembers; var existingMembers; - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { var instantiatedType = tryGetObjectLiteralContextualType(objectLikeContainer, typeChecker); // Check completions for Object property value shorthand if (instantiatedType === undefined) { @@ -136625,7 +137832,7 @@ var ts; } } else { - ts.Debug.assert(objectLikeContainer.kind === 201 /* SyntaxKind.ObjectBindingPattern */); + ts.Debug.assert(objectLikeContainer.kind === 203 /* SyntaxKind.ObjectBindingPattern */); // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -136636,12 +137843,12 @@ var ts; // through type declaration or inference. // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed - // type of parameter will flow in from the contextual type of the function - var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */; - if (!canGetType && rootDeclaration.kind === 164 /* SyntaxKind.Parameter */) { + var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */; + if (!canGetType && rootDeclaration.kind === 166 /* SyntaxKind.Parameter */) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); } - else if (rootDeclaration.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (rootDeclaration.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 175 /* SyntaxKind.SetAccessor */) { canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -136660,7 +137867,7 @@ var ts; var filteredMembers = filterObjectMembersList(typeMembers, ts.Debug.checkDefined(existingMembers)); symbols = ts.concatenate(symbols, filteredMembers); setSortTextToOptionalMember(); - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && preferences.includeCompletionsWithObjectLiteralMethodSnippets && preferences.includeCompletionsWithInsertText) { transformObjectLiteralMembersSortText(symbolsStartIndex); @@ -136695,10 +137902,10 @@ var ts; keywordFilters = 8 /* KeywordCompletionFilters.TypeKeyword */; } // try to show exported member for imported/re-exported module - var moduleSpecifier = (namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; + var moduleSpecifier = (namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; if (!moduleSpecifier) { isNewIdentifierLocation = true; - return namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; + return namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; } var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); // TODO: GH#18217 if (!moduleSpecifierSymbol) { @@ -136843,11 +138050,11 @@ var ts; case 30 /* SyntaxKind.LessThanSlashToken */: case 43 /* SyntaxKind.SlashToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 286 /* SyntaxKind.JsxAttributes */: - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - if (parent && (parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 280 /* SyntaxKind.JsxOpeningElement */)) { + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 289 /* SyntaxKind.JsxAttributes */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + if (parent && (parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 283 /* SyntaxKind.JsxOpeningElement */)) { if (contextToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { var precedingToken = ts.findPrecedingToken(contextToken.pos, sourceFile, /*startNode*/ undefined); if (!parent.typeArguments || (precedingToken && precedingToken.kind === 43 /* SyntaxKind.SlashToken */)) @@ -136855,7 +138062,7 @@ var ts; } return parent; } - else if (parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + else if (parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136867,7 +138074,7 @@ var ts; // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 10 /* SyntaxKind.StringLiteral */: - if (parent && ((parent.kind === 285 /* SyntaxKind.JsxAttribute */) || (parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */))) { + if (parent && ((parent.kind === 288 /* SyntaxKind.JsxAttribute */) || (parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */))) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136877,8 +138084,8 @@ var ts; break; case 19 /* SyntaxKind.CloseBraceToken */: if (parent && - parent.kind === 288 /* SyntaxKind.JsxExpression */ && - parent.parent && parent.parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + parent.kind === 291 /* SyntaxKind.JsxExpression */ && + parent.parent && parent.parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136886,7 +138093,7 @@ var ts; // each JsxAttribute can have initializer as JsxExpression return parent.parent.parent.parent; } - if (parent && parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (parent && parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136906,54 +138113,54 @@ var ts; var containingNodeKind = parent.kind; switch (contextToken.kind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ || + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ || isVariableDeclarationListButNotTypeArgument(contextToken) || - containingNodeKind === 237 /* SyntaxKind.VariableStatement */ || - containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | + containingNodeKind === 240 /* SyntaxKind.VariableStatement */ || + containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | isFunctionLikeButNotConstructor(containingNodeKind) || - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A= contextToken.pos); case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [.| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [.| case 58 /* SyntaxKind.ColonToken */: - return containingNodeKind === 203 /* SyntaxKind.BindingElement */; // var {x :html| + return containingNodeKind === 205 /* SyntaxKind.BindingElement */; // var {x :html| case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [x| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [x| case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 292 /* SyntaxKind.CatchClause */ || + return containingNodeKind === 295 /* SyntaxKind.CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */; // enum a { | + return containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */; // enum a { | case 29 /* SyntaxKind.LessThanToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ || // class A< | - containingNodeKind === 226 /* SyntaxKind.ClassExpression */ || // var C = class D< | - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | - containingNodeKind === 259 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ || // class A< | + containingNodeKind === 228 /* SyntaxKind.ClassExpression */ || // var C = class D< | + containingNodeKind === 261 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | + containingNodeKind === 262 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | ts.isFunctionLikeKind(containingNodeKind); case 124 /* SyntaxKind.StaticKeyword */: - return containingNodeKind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); + return containingNodeKind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); case 25 /* SyntaxKind.DotDotDotToken */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ || - (!!parent.parent && parent.parent.kind === 202 /* SyntaxKind.ArrayBindingPattern */); // var [...z| + return containingNodeKind === 166 /* SyntaxKind.Parameter */ || + (!!parent.parent && parent.parent.kind === 204 /* SyntaxKind.ArrayBindingPattern */); // var [...z| case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); - case 127 /* SyntaxKind.AsKeyword */: - return containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ || - containingNodeKind === 275 /* SyntaxKind.ExportSpecifier */ || - containingNodeKind === 268 /* SyntaxKind.NamespaceImport */; - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + return containingNodeKind === 166 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); + case 128 /* SyntaxKind.AsKeyword */: + return containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ || + containingNodeKind === 278 /* SyntaxKind.ExportSpecifier */ || + containingNodeKind === 271 /* SyntaxKind.NamespaceImport */; + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: return !isFromObjectTypeDeclaration(contextToken); case 79 /* SyntaxKind.Identifier */: - if (containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ && + if (containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ && contextToken === parent.name && contextToken.text === "type") { // import { type | } @@ -136968,11 +138175,11 @@ var ts; case 100 /* SyntaxKind.ImportKeyword */: case 119 /* SyntaxKind.LetKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return true; - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: // import { type foo| } - return containingNodeKind !== 270 /* SyntaxKind.ImportSpecifier */; + return containingNodeKind !== 273 /* SyntaxKind.ImportSpecifier */; case 41 /* SyntaxKind.AsteriskToken */: return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent); } @@ -136997,7 +138204,7 @@ var ts; case 126 /* SyntaxKind.AbstractKeyword */: case 84 /* SyntaxKind.ClassKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 98 /* SyntaxKind.FunctionKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: @@ -137008,7 +138215,7 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: case 113 /* SyntaxKind.VarKeyword */: return true; - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return ts.isPropertyDeclaration(contextToken.parent); } // If we are inside a class declaration, and `constructor` is totally not present, @@ -137017,7 +138224,7 @@ var ts; if (ancestorClassLike && contextToken === previousToken && isPreviousPropertyDeclarationTerminated(contextToken, position)) { return false; // Don't block completions. } - var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 167 /* SyntaxKind.PropertyDeclaration */); + var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 169 /* SyntaxKind.PropertyDeclaration */); // If we are inside a class declaration and typing `constructor` after property declaration... if (ancestorPropertyDeclaraion && contextToken !== previousToken @@ -137049,7 +138256,7 @@ var ts; || !ts.positionsAreOnSameLine(contextToken.end, position, sourceFile)); } function isFunctionLikeButNotConstructor(kind) { - return ts.isFunctionLikeKind(kind) && kind !== 171 /* SyntaxKind.Constructor */; + return ts.isFunctionLikeKind(kind) && kind !== 173 /* SyntaxKind.Constructor */; } function isDotOfNumericLiteral(contextToken) { if (contextToken.kind === 8 /* SyntaxKind.NumericLiteral */) { @@ -137059,7 +138266,7 @@ var ts; return false; } function isVariableDeclarationListButNotTypeArgument(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && !ts.isPossiblyTypeArgumentPosition(node, sourceFile, typeChecker); } /** @@ -137077,13 +138284,13 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 296 /* SyntaxKind.PropertyAssignment */ && - m.kind !== 297 /* SyntaxKind.ShorthandPropertyAssignment */ && - m.kind !== 203 /* SyntaxKind.BindingElement */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */ && - m.kind !== 298 /* SyntaxKind.SpreadAssignment */) { + if (m.kind !== 299 /* SyntaxKind.PropertyAssignment */ && + m.kind !== 300 /* SyntaxKind.ShorthandPropertyAssignment */ && + m.kind !== 205 /* SyntaxKind.BindingElement */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */ && + m.kind !== 301 /* SyntaxKind.SpreadAssignment */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -137174,10 +138381,10 @@ var ts; for (var _i = 0, existingMembers_2 = existingMembers; _i < existingMembers_2.length; _i++) { var m = existingMembers_2[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (m.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -137219,7 +138426,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (attr.kind === 288 /* SyntaxKind.JsxAttribute */) { seenNames.add(attr.name.escapedText); } else if (ts.isJsxSpreadAttribute(attr)) { @@ -137317,7 +138524,7 @@ var ts; var _keywordCompletions = []; var allKeywordsCompletions = ts.memoize(function () { var res = []; - for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 160 /* SyntaxKind.LastKeyword */; i++) { + for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 162 /* SyntaxKind.LastKeyword */; i++) { res.push({ name: ts.tokenToString(i), kind: "keyword" /* ScriptElementKind.keyword */, @@ -137343,12 +138550,12 @@ var ts; return false; case 1 /* KeywordCompletionFilters.All */: return isFunctionLikeBodyKeyword(kind) - || kind === 135 /* SyntaxKind.DeclareKeyword */ - || kind === 141 /* SyntaxKind.ModuleKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ - || kind === 142 /* SyntaxKind.NamespaceKeyword */ + || kind === 136 /* SyntaxKind.DeclareKeyword */ + || kind === 142 /* SyntaxKind.ModuleKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ + || kind === 143 /* SyntaxKind.NamespaceKeyword */ || kind === 126 /* SyntaxKind.AbstractKeyword */ - || ts.isTypeKeyword(kind) && kind !== 153 /* SyntaxKind.UndefinedKeyword */; + || ts.isTypeKeyword(kind) && kind !== 155 /* SyntaxKind.UndefinedKeyword */; case 5 /* KeywordCompletionFilters.FunctionLikeBodyKeywords */: return isFunctionLikeBodyKeyword(kind); case 2 /* KeywordCompletionFilters.ClassElementKeywords */: @@ -137362,7 +138569,7 @@ var ts; case 7 /* KeywordCompletionFilters.TypeKeywords */: return ts.isTypeKeyword(kind); case 8 /* KeywordCompletionFilters.TypeKeyword */: - return kind === 152 /* SyntaxKind.TypeKeyword */; + return kind === 154 /* SyntaxKind.TypeKeyword */; default: return ts.Debug.assertNever(keywordFilter); } @@ -137371,59 +138578,61 @@ var ts; function isTypeScriptOnlyKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: case 117 /* SyntaxKind.ImplementsKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 139 /* SyntaxKind.IsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 140 /* SyntaxKind.IsKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return true; default: return false; } } function isInterfaceOrTypeLiteralCompletionKeyword(kind) { - return kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return kind === 146 /* SyntaxKind.ReadonlyKeyword */; } function isClassMemberCompletionKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; default: return ts.isClassMemberModifier(kind); } } function isFunctionLikeBodyKeyword(kind) { - return kind === 131 /* SyntaxKind.AsyncKeyword */ - || kind === 132 /* SyntaxKind.AwaitKeyword */ - || kind === 127 /* SyntaxKind.AsKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ + return kind === 132 /* SyntaxKind.AsyncKeyword */ + || kind === 133 /* SyntaxKind.AwaitKeyword */ + || kind === 128 /* SyntaxKind.AsKeyword */ + || kind === 150 /* SyntaxKind.SatisfiesKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); } function keywordForNode(node) { @@ -137448,7 +138657,7 @@ var ts; && contextToken === parent.moduleSpecifier && tokenLine === currentLine) { entries.push({ - name: ts.tokenToString(129 /* SyntaxKind.AssertKeyword */), + name: ts.tokenToString(130 /* SyntaxKind.AssertKeyword */), kind: "keyword" /* ScriptElementKind.keyword */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.GlobalsOrKeywords, @@ -137514,7 +138723,7 @@ var ts; function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) { // class c { method() { } | method2() { } } switch (location.kind) { - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.tryCast(location.parent, ts.isObjectTypeDeclaration); case 1 /* SyntaxKind.EndOfFileToken */: var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration); @@ -137540,7 +138749,7 @@ var ts; if (!contextToken) return undefined; // class C { blah; constructor/**/ } and so on - if (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ + if (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ // class C { blah \n constructor/**/ } || (ts.isIdentifier(contextToken) && ts.isPropertyDeclaration(contextToken.parent) && ts.isClassLike(location))) { return ts.findAncestor(contextToken, ts.isClassLike); @@ -137583,7 +138792,7 @@ var ts; case 26 /* SyntaxKind.SemicolonToken */: case 27 /* SyntaxKind.CommaToken */: case 79 /* SyntaxKind.Identifier */: - if (parent.kind === 166 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { + if (parent.kind === 168 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { return parent.parent; } break; @@ -137600,11 +138809,11 @@ var ts; if (!t) return undefined; switch (node.kind) { - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checker.getTypeOfPropertyOfContextualType(t, node.symbol.escapedName); - case 188 /* SyntaxKind.IntersectionType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 189 /* SyntaxKind.UnionType */: return t; } } @@ -137632,7 +138841,7 @@ var ts; ? !!ts.tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 43 /* SyntaxKind.SlashToken */ && ts.isJsxClosingElement(contextToken.parent)); case " ": - return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 305 /* SyntaxKind.SourceFile */; + return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 308 /* SyntaxKind.SourceFile */; default: return ts.Debug.assertNever(triggerCharacter); } @@ -137679,21 +138888,22 @@ var ts; return undefined; } function getImportStatementCompletionInfo(contextToken) { + var _a, _b, _c; var keywordCompletion; var isKeywordOnlyCompletion = false; var candidate = getCandidate(); return { isKeywordOnlyCompletion: isKeywordOnlyCompletion, keywordCompletion: keywordCompletion, - isNewIdentifierLocation: !!(candidate || keywordCompletion === 152 /* SyntaxKind.TypeKeyword */), - replacementNode: candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) - ? candidate - : undefined + isNewIdentifierLocation: !!(candidate || keywordCompletion === 154 /* SyntaxKind.TypeKeyword */), + isTopLevelTypeOnly: !!((_b = (_a = ts.tryCast(candidate, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || !!((_c = ts.tryCast(candidate, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly), + couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken), + replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate), }; function getCandidate() { var parent = contextToken.parent; if (ts.isImportEqualsDeclaration(parent)) { - keywordCompletion = contextToken.kind === 152 /* SyntaxKind.TypeKeyword */ ? undefined : 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = contextToken.kind === 154 /* SyntaxKind.TypeKeyword */ ? undefined : 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleReference) ? parent : undefined; } if (couldBeTypeOnlyImportSpecifier(parent, contextToken) && canCompleteFromNamedBindings(parent.parent)) { @@ -137703,13 +138913,13 @@ var ts; if (!parent.parent.isTypeOnly && (contextToken.kind === 18 /* SyntaxKind.OpenBraceToken */ || contextToken.kind === 100 /* SyntaxKind.ImportKeyword */ || contextToken.kind === 27 /* SyntaxKind.CommaToken */)) { - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; } if (canCompleteFromNamedBindings(parent)) { // At `import { ... } |` or `import * as Foo |`, the only possible completion is `from` if (contextToken.kind === 19 /* SyntaxKind.CloseBraceToken */ || contextToken.kind === 79 /* SyntaxKind.Identifier */) { isKeywordOnlyCompletion = true; - keywordCompletion = 156 /* SyntaxKind.FromKeyword */; + keywordCompletion = 158 /* SyntaxKind.FromKeyword */; } else { return parent.parent.parent; @@ -137719,25 +138929,82 @@ var ts; } if (ts.isImportKeyword(contextToken) && ts.isSourceFile(parent)) { // A lone import keyword with nothing following it does not parse as a statement at all - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return contextToken; } if (ts.isImportKeyword(contextToken) && ts.isImportDeclaration(parent)) { // `import s| from` - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleSpecifier) ? parent : undefined; } return undefined; } } + function getSingleLineReplacementSpanForImportCompletionNode(node) { + var _a, _b, _c; + if (!node) + return undefined; + var top = (_a = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration))) !== null && _a !== void 0 ? _a : node; + var sourceFile = top.getSourceFile(); + if (ts.rangeIsOnSingleLine(top, sourceFile)) { + return ts.createTextSpanFromNode(top, sourceFile); + } + // ImportKeyword was necessarily on one line; ImportSpecifier was necessarily parented in an ImportDeclaration + ts.Debug.assert(top.kind !== 100 /* SyntaxKind.ImportKeyword */ && top.kind !== 273 /* SyntaxKind.ImportSpecifier */); + // Guess which point in the import might actually be a later statement parsed as part of the import + // during parser recovery - either in the middle of named imports, or the module specifier. + var potentialSplitPoint = top.kind === 269 /* SyntaxKind.ImportDeclaration */ + ? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings)) !== null && _c !== void 0 ? _c : top.moduleSpecifier + : top.moduleReference; + var withoutModuleSpecifier = { + pos: top.getFirstToken().getStart(), + end: potentialSplitPoint.pos, + }; + // The module specifier/reference was previously found to be missing, empty, or + // not a string literal - in this last case, it's likely that statement on a following + // line was parsed as the module specifier of a partially-typed import, e.g. + // import Foo| + // interface Blah {} + // This appears to be a multiline-import, and editors can't replace multiple lines. + // But if everything but the "module specifier" is on one line, by this point we can + // assume that the "module specifier" is actually just another statement, and return + // the single-line range of the import excluding that probable statement. + if (ts.rangeIsOnSingleLine(withoutModuleSpecifier, sourceFile)) { + return ts.createTextSpanFromRange(withoutModuleSpecifier); + } + } + // Tries to identify the first named import that is not really a named import, but rather + // just parser recovery for a situation like: + // import { Foo| + // interface Bar {} + // in which `Foo`, `interface`, and `Bar` are all parsed as import specifiers. The caller + // will also check if this token is on a separate line from the rest of the import. + function getPotentiallyInvalidImportSpecifier(namedBindings) { + var _a; + return ts.find((_a = ts.tryCast(namedBindings, ts.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements, function (e) { + var _a; + return !e.propertyName && + ts.isStringANonContextualKeyword(e.name.text) && + ((_a = ts.findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) === null || _a === void 0 ? void 0 : _a.kind) !== 27 /* SyntaxKind.CommaToken */; + }); + } function couldBeTypeOnlyImportSpecifier(importSpecifier, contextToken) { return ts.isImportSpecifier(importSpecifier) && (importSpecifier.isTypeOnly || contextToken === importSpecifier.name && ts.isTypeKeywordTokenOrIdentifier(contextToken)); } function canCompleteFromNamedBindings(namedBindings) { - return isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) - && (ts.isNamespaceImport(namedBindings) || namedBindings.elements.length < 2) - && !namedBindings.parent.name; + if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) { + return false; + } + if (ts.isNamedImports(namedBindings)) { + // We can only complete on named imports if there are no other named imports already, + // but parser recovery sometimes puts later statements in the named imports list, so + // we try to only consider the probably-valid ones. + var invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings); + var validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length; + return validImports < 2; + } + return true; } function isModuleSpecifierMissingOrEmpty(specifier) { var _a; @@ -137756,7 +139023,6 @@ var ts; function isArrowFunctionBody(node) { return node.parent && ts.isArrowFunction(node.parent) && node.parent.body === node; } - ; /** True if symbol is a type or a module containing at least one type. */ function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) { if (seenModules === void 0) { seenModules = new ts.Map(); } @@ -137905,14 +139171,14 @@ var ts; case 115 /* SyntaxKind.WhileKeyword */: case 90 /* SyntaxKind.DoKeyword */: return useParent(node.parent, function (n) { return ts.isIterationStatement(n, /*lookInLabeledStatements*/ true); }, getLoopBreakContinueOccurrences); - case 134 /* SyntaxKind.ConstructorKeyword */: - return getFromAllDeclarations(ts.isConstructorDeclaration, [134 /* SyntaxKind.ConstructorKeyword */]); - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - return getFromAllDeclarations(ts.isAccessor, [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */]); - case 132 /* SyntaxKind.AwaitKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + return getFromAllDeclarations(ts.isConstructorDeclaration, [135 /* SyntaxKind.ConstructorKeyword */]); + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + return getFromAllDeclarations(ts.isAccessor, [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */]); + case 133 /* SyntaxKind.AwaitKeyword */: return useParent(node.parent, ts.isAwaitExpression, getAsyncAndAwaitOccurrences); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return highlightSpans(getAsyncAndAwaitOccurrences(node)); case 125 /* SyntaxKind.YieldKeyword */: return highlightSpans(getYieldOccurrences(node)); @@ -137959,7 +139225,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (ts.isFunctionBlock(parent) || parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } // A throw-statement is only owned by a try-statement if the try-statement has @@ -137991,16 +139257,16 @@ var ts; function getBreakOrContinueOwner(statement) { return ts.findAncestor(statement, function (node) { switch (node.kind) { - case 249 /* SyntaxKind.SwitchStatement */: - if (statement.kind === 245 /* SyntaxKind.ContinueStatement */) { + case 252 /* SyntaxKind.SwitchStatement */: + if (statement.kind === 248 /* SyntaxKind.ContinueStatement */) { return false; } // falls through - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return !statement.label || isLabeledBy(node, statement.label.escapedText); default: // Don't cross function boundaries. @@ -138016,26 +139282,26 @@ var ts; // Types of node whose children might have modifiers. var container = declaration.parent; switch (container.kind) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // Container is either a class declaration or the declaration is a classDeclaration - if (modifierFlag & 128 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { + if (modifierFlag & 256 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { return __spreadArray(__spreadArray([], declaration.members, true), [declaration], false); } else { return container.statements; } - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return __spreadArray(__spreadArray([], container.parameters, true), (ts.isClassLike(container.parent) ? container.parent.members : []), true); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: var nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. @@ -138045,12 +139311,12 @@ var ts; return __spreadArray(__spreadArray([], nodes, true), constructor.parameters, true); } } - else if (modifierFlag & 128 /* ModifierFlags.Abstract */) { + else if (modifierFlag & 256 /* ModifierFlags.Abstract */) { return __spreadArray(__spreadArray([], nodes, true), [container], false); } return nodes; // Syntactically invalid positions that the parser might produce anyway - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return undefined; default: ts.Debug.assertNever(container, "Invalid container kind."); @@ -138071,7 +139337,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 97 /* SyntaxKind.ForKeyword */, 115 /* SyntaxKind.WhileKeyword */, 90 /* SyntaxKind.DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 240 /* SyntaxKind.DoStatement */) { + if (loopNode.kind === 243 /* SyntaxKind.DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 115 /* SyntaxKind.WhileKeyword */)) { @@ -138091,13 +139357,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -138170,13 +139436,13 @@ var ts; var keywords = []; if (func.modifiers) { func.modifiers.forEach(function (modifier) { - pushKeywordIf(keywords, modifier, 131 /* SyntaxKind.AsyncKeyword */); + pushKeywordIf(keywords, modifier, 132 /* SyntaxKind.AsyncKeyword */); }); } ts.forEachChild(func, function (child) { traverseWithoutCrossingFunction(child, function (node) { if (ts.isAwaitExpression(node)) { - pushKeywordIf(keywords, node.getFirstToken(), 132 /* SyntaxKind.AwaitKeyword */); + pushKeywordIf(keywords, node.getFirstToken(), 133 /* SyntaxKind.AwaitKeyword */); } }); }); @@ -138560,14 +139826,14 @@ var ts; if (cancellationToken) cancellationToken.throwIfCancellationRequested(); switch (direct.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(direct)) { handleImportCall(direct); break; } if (!isAvailableThroughGlobal) { var parent = direct.parent; - if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { var name = parent.name; if (name.kind === 79 /* SyntaxKind.Identifier */) { directImports.push(name); @@ -138578,25 +139844,25 @@ var ts; break; case 79 /* SyntaxKind.Identifier */: // for 'const x = require("y"); break; // TODO: GH#23879 - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: handleNamespaceImport(direct, direct.name, ts.hasSyntacticModifier(direct, 1 /* ModifierFlags.Export */), /*alreadyAddedDirect*/ false); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: directImports.push(direct); var namedBindings = direct.importClause && direct.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings && namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { handleNamespaceImport(direct, namedBindings.name, /*isReExport*/ false, /*alreadyAddedDirect*/ true); } else if (!isAvailableThroughGlobal && ts.isDefaultImport(direct)) { addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); // Add a check for indirect uses to handle synthetic default imports } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (!direct.exportClause) { // This is `export * from "foo"`, so imports of this module may import the export too. handleDirectImports(getContainingModuleSymbol(direct, checker)); } - else if (direct.exportClause.kind === 274 /* SyntaxKind.NamespaceExport */) { + else if (direct.exportClause.kind === 277 /* SyntaxKind.NamespaceExport */) { // `export * as foo from "foo"` add to indirect uses addIndirectUser(getSourceFileLikeForImportDeclaration(direct), /** addTransitiveDependencies */ true); } @@ -138605,9 +139871,9 @@ var ts; directImports.push(direct); } break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: // Only check for typeof import('xyz') - if (direct.isTypeOf && !direct.qualifier && isExported(direct)) { + if (!isAvailableThroughGlobal && direct.isTypeOf && !direct.qualifier && isExported(direct)) { addIndirectUser(direct.getSourceFile(), /** addTransitiveDependencies */ true); } directImports.push(direct); @@ -138638,7 +139904,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 261 /* SyntaxKind.ModuleDeclaration */); + ts.Debug.assert(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 264 /* SyntaxKind.ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUser(sourceFileLike, /** addTransitiveDependencies */ true); } @@ -138694,7 +139960,7 @@ var ts; } return { importSearches: importSearches, singleReferences: singleReferences }; function handleImport(decl) { - if (decl.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (decl.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { if (isExternalModuleImportEquals(decl)) { handleNamespaceImportLike(decl.name); } @@ -138704,7 +139970,7 @@ var ts; handleNamespaceImportLike(decl); return; } - if (decl.kind === 200 /* SyntaxKind.ImportType */) { + if (decl.kind === 202 /* SyntaxKind.ImportType */) { if (decl.qualifier) { var firstIdentifier = ts.getFirstIdentifier(decl.qualifier); if (firstIdentifier.escapedText === ts.symbolName(exportSymbol)) { @@ -138720,7 +139986,7 @@ var ts; if (decl.moduleSpecifier.kind !== 10 /* SyntaxKind.StringLiteral */) { return; } - if (decl.kind === 272 /* SyntaxKind.ExportDeclaration */) { + if (decl.kind === 275 /* SyntaxKind.ExportDeclaration */) { if (decl.exportClause && ts.isNamedExports(decl.exportClause)) { searchForNamedImport(decl.exportClause); } @@ -138729,10 +139995,10 @@ var ts; var _a = decl.importClause || { name: undefined, namedBindings: undefined }, name = _a.name, namedBindings = _a.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: handleNamespaceImportLike(namedBindings.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: // 'default' might be accessed as a named import `{ default as foo }`. if (exportKind === 0 /* ExportKind.Named */ || exportKind === 1 /* ExportKind.Default */) { searchForNamedImport(namedBindings); @@ -138782,7 +140048,7 @@ var ts; } } else { - var localSymbol = element.kind === 275 /* SyntaxKind.ExportSpecifier */ && element.propertyName + var localSymbol = element.kind === 278 /* SyntaxKind.ExportSpecifier */ && element.propertyName ? checker.getExportSpecifierLocalTargetSymbol(element) // For re-exporting under a different name, we want to get the re-exported symbol. : checker.getSymbolAtLocation(name); addSearch(name, localSymbol); @@ -138811,7 +140077,7 @@ var ts; for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { var referencingFile = sourceFiles_1[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 305 /* SyntaxKind.SourceFile */) { + if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 308 /* SyntaxKind.SourceFile */) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -138859,7 +140125,7 @@ var ts; } /** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */ function forEachPossibleImportOrExportStatement(sourceFileLike, action) { - return ts.forEach(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -138874,15 +140140,15 @@ var ts; else { forEachPossibleImportOrExportStatement(sourceFile, function (statement) { switch (statement.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: { var decl = statement; if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) { action(decl, decl.moduleSpecifier); } break; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { var decl = statement; if (isExternalModuleImportEquals(decl)) { action(decl, decl.moduleReference.expression); @@ -138907,7 +140173,7 @@ var ts; var parent = node.parent; var grandparent = parent.parent; if (symbol.exportSymbol) { - if (parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { // When accessing an export of a JS module, there's no alias. The symbol will still be flagged as an export even though we're at the use. // So check that we are at the declaration. return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === parent; })) && ts.isBinaryExpression(grandparent) @@ -138991,6 +140257,8 @@ var ts; // Similarly, skip past the symbol for 'export =' if (importedSymbol.escapedName === "export=") { importedSymbol = getExportEqualsLocalSymbol(importedSymbol, checker); + if (importedSymbol === undefined) + return undefined; } // If the import has a different name than the export, do not continue searching. // If `importedName` is undefined, do continue searching as the export is anonymous. @@ -139006,25 +140274,25 @@ var ts; } // Not meant for use with export specifiers or export assignment. function getExportKindForDeclaration(node) { - return ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; + return ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; } } FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol; function getExportEqualsLocalSymbol(importedSymbol, checker) { if (importedSymbol.flags & 2097152 /* SymbolFlags.Alias */) { - return ts.Debug.checkDefined(checker.getImmediateAliasedSymbol(importedSymbol)); + return checker.getImmediateAliasedSymbol(importedSymbol); } var decl = ts.Debug.checkDefined(importedSymbol.valueDeclaration); if (ts.isExportAssignment(decl)) { // `export = class {}` - return ts.Debug.checkDefined(decl.expression.symbol); + return decl.expression.symbol; } else if (ts.isBinaryExpression(decl)) { // `module.exports = class {}` - return ts.Debug.checkDefined(decl.right.symbol); + return decl.right.symbol; } else if (ts.isSourceFile(decl)) { // json module - return ts.Debug.checkDefined(decl.symbol); + return decl.symbol; } - return ts.Debug.fail(); + return undefined; } // If a reference is a class expression, the exported node would be its parent. // If a reference is a variable declaration, the exported node would be the variable statement. @@ -139041,16 +140309,16 @@ var ts; function isNodeImport(node) { var parent = node.parent; switch (parent.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return parent.name === node && isExternalModuleImportEquals(parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: // For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`. return !parent.propertyName; - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: ts.Debug.assert(parent.name === node); return true; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent.parent.parent); default: return false; @@ -139091,21 +140359,21 @@ var ts; return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); } function getSourceFileLikeForImportDeclaration(node) { - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } - ts.Debug.assert(parent.kind === 262 /* SyntaxKind.ModuleBlock */); + ts.Debug.assert(parent.kind === 265 /* SyntaxKind.ModuleBlock */); return ts.cast(parent.parent, isAmbientModuleDeclaration); } function isAmbientModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; } function isExternalModuleImportEquals(eq) { - return eq.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; + return eq.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); @@ -139199,7 +140467,7 @@ var ts; ((ts.isImportOrExportSpecifier(node.parent) || ts.isBindingElement(node.parent)) && node.parent.propertyName === node) || // Is default export - (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 513 /* ModifierFlags.ExportDefault */))) { + (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 1025 /* ModifierFlags.ExportDefault */))) { return getContextNode(node.parent); } return undefined; @@ -139208,7 +140476,7 @@ var ts; if (!node) return undefined; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !ts.isVariableDeclarationList(node.parent) || node.parent.declarations.length !== 1 ? node : ts.isVariableStatement(node.parent.parent) ? @@ -139216,28 +140484,28 @@ var ts; ts.isForInOrOfStatement(node.parent.parent) ? getContextNode(node.parent.parent) : node.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextNode(node.parent.parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 267 /* SyntaxKind.ImportClause */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ts.isExpressionStatement(node.parent) ? node.parent : node; - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return { start: node.initializer, end: node.expression }; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent) ? getContextNode(ts.findAncestor(node.parent, function (node) { return ts.isBinaryExpression(node) || ts.isForInOrOfStatement(node); @@ -139298,15 +140566,15 @@ var ts; return node.kind === 88 /* SyntaxKind.DefaultKeyword */ || !!ts.getDeclarationFromName(node) || ts.isLiteralComputedPropertyDeclarationName(node) - || (node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); + || (node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); } function getImplementationsAtPosition(program, cancellationToken, sourceFiles, sourceFile, position) { var node = ts.getTouchingPropertyName(sourceFile, position); var referenceEntries; var entries = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position); - if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || node.parent.kind === 203 /* SyntaxKind.BindingElement */ - || node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ + if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || node.parent.kind === 205 /* SyntaxKind.BindingElement */ + || node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ || node.kind === 106 /* SyntaxKind.SuperKeyword */) { referenceEntries = entries && __spreadArray([], entries, true); } @@ -139330,13 +140598,13 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return undefined; } var checker = program.getTypeChecker(); // If invoked directly on a shorthand property assignment, then return // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var result_2 = []; Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_2.push(nodeEntry(node)); }); return result_2; @@ -139512,13 +140780,13 @@ var ts; if (symbol) { return getDefinitionKindAndDisplayParts(symbol, checker, node); } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return { kind: "interface" /* ScriptElementKind.interfaceElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] }; } - else if (node.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (node.kind === 228 /* SyntaxKind.ClassExpression */) { return { kind: "local class" /* ScriptElementKind.localClassElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] @@ -139572,7 +140840,7 @@ var ts; var source = ts.getDeclarationFromName(node) || (node.kind === 88 /* SyntaxKind.DefaultKeyword */ ? node.parent : ts.isLiteralComputedPropertyDeclarationName(node) ? node.parent.parent - : node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent + : node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent : undefined); var commonjsSource = source && ts.isBinaryExpression(source) ? source.left : undefined; return !!(source && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === source || d === commonjsSource; }))); @@ -139587,47 +140855,47 @@ var ts; if (!!(decl.flags & 16777216 /* NodeFlags.Ambient */)) return true; switch (decl.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: case 88 /* SyntaxKind.DefaultKeyword */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: // default import - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 285 /* SyntaxKind.JsxAttribute */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: - case 164 /* SyntaxKind.Parameter */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: // default import + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 288 /* SyntaxKind.JsxAttribute */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: + case 166 /* SyntaxKind.Parameter */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // In `({ x: y } = 0);`, `x` is not a write access. (Won't call this function for `y`.) return !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(decl.parent); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return !!decl.body; - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return !!decl.initializer || ts.isCatchClause(decl.parent); - case 168 /* SyntaxKind.MethodSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 170 /* SyntaxKind.MethodSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return false; default: return ts.Debug.failBadSyntaxKind(decl); @@ -139853,10 +141121,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.) break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (sourceFilesSet.has(decl.getSourceFile().fileName)) { references.push(nodeEntry(decl.name)); } @@ -139885,9 +141153,9 @@ var ts; } /** As in a `readonly prop: any` or `constructor(readonly prop: any)`, not a `readonly any[]`. */ function isReadonlyTypeOperator(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(node.parent) - && node.parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + && node.parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } /** getReferencedSymbols for special node kinds. */ function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) { @@ -139898,12 +141166,12 @@ var ts; } // A modifier readonly (like on a property declaration) is not special; // a readonly type keyword (like `readonly string[]`) is. - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { return undefined; } // Likewise, when we *are* looking for a special keyword, make sure we // *don’t* include readonly member modifiers. - return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); } if (ts.isImportMeta(node.parent) && node.parent.name === node) { return getAllReferencesForImportMeta(sourceFiles, cancellationToken); @@ -139970,8 +141238,8 @@ var ts; } function getSpecialSearchKind(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 173 /* SyntaxKind.Constructor */: + case 135 /* SyntaxKind.ConstructorKeyword */: return 1 /* SpecialSearchKind.Constructor */; case 79 /* SyntaxKind.Identifier */: if (ts.isClassLike(node.parent)) { @@ -140219,7 +141487,7 @@ var ts; // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 213 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 226 /* SyntaxKind.ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 215 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 228 /* SyntaxKind.ClassExpression */)) { return valueDeclaration; } if (!declarations) { @@ -140229,7 +141497,7 @@ var ts; if (flags & (4 /* SymbolFlags.Property */ | 8192 /* SymbolFlags.Method */)) { var privateDeclaration = ts.find(declarations, function (d) { return ts.hasEffectiveModifier(d, 8 /* ModifierFlags.Private */) || ts.isPrivateIdentifierClassElementDeclaration(d); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 257 /* SyntaxKind.ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 260 /* SyntaxKind.ClassDeclaration */); } // Else this is a public property and could be accessed from anywhere. return undefined; @@ -140258,7 +141526,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (!container || container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -140516,7 +141784,7 @@ var ts; } // Use the parent symbol if the location is commonjs require syntax on javascript files only. if (ts.isInJSFile(referenceLocation) - && referenceLocation.parent.kind === 203 /* SyntaxKind.BindingElement */ + && referenceLocation.parent.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent.parent.parent)) { referenceSymbol = referenceLocation.parent.symbol; // The parent will not have a symbol if it's an ObjectBindingPattern (when destructuring is used). In @@ -140623,7 +141891,7 @@ var ts; } } function addReference(referenceLocation, relatedSymbol, state) { - var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line no-in-operator + var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line local/no-in-operator // if rename symbol from default export anonymous function, for example `export default function() {}`, we do not need to add reference if (state.options.use === 2 /* FindReferencesUse.Rename */ && referenceLocation.kind === 88 /* SyntaxKind.DefaultKeyword */) { return; @@ -140689,15 +141957,15 @@ var ts; if (constructorSymbol && constructorSymbol.declarations) { for (var _i = 0, _a = constructorSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - var ctrKeyword = ts.findChildOfKind(decl, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */ && !!ctrKeyword); + var ctrKeyword = ts.findChildOfKind(decl, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */ && !!ctrKeyword); addNode(ctrKeyword); } } if (classSymbol.exports) { classSymbol.exports.forEach(function (member) { var decl = member.valueDeclaration; - if (decl && decl.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (decl && decl.kind === 171 /* SyntaxKind.MethodDeclaration */) { var body = decl.body; if (body) { forEachDescendantOfKind(body, 108 /* SyntaxKind.ThisKeyword */, function (thisKeyword) { @@ -140721,7 +141989,7 @@ var ts; } for (var _i = 0, _a = constructor.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */); var body = decl.body; if (body) { forEachDescendantOfKind(body, 106 /* SyntaxKind.SuperKeyword */, function (node) { @@ -140751,7 +142019,7 @@ var ts; if (refNode.kind !== 79 /* SyntaxKind.Identifier */) { return; } - if (refNode.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } @@ -140771,7 +142039,7 @@ var ts; } else if (ts.isFunctionLike(typeHavingNode) && typeHavingNode.body) { var body = typeHavingNode.body; - if (body.kind === 235 /* SyntaxKind.Block */) { + if (body.kind === 238 /* SyntaxKind.Block */) { ts.forEachReturnStatement(body, function (returnStatement) { if (returnStatement.expression) addIfImplementation(returnStatement.expression); @@ -140799,13 +142067,13 @@ var ts; */ function isImplementationExpression(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isImplementationExpression(node.expression); - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; default: return false; @@ -140858,13 +142126,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -140885,43 +142153,43 @@ var ts; return [{ definition: { type: 0 /* DefinitionKind.Symbol */, symbol: searchSpaceNode.symbol }, references: references }]; } function isParameterName(node) { - return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 164 /* SyntaxKind.Parameter */ && node.parent.name === node; + return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 166 /* SyntaxKind.Parameter */ && node.parent.name === node; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning object literals break; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) { return undefined; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. default: return undefined; } - var references = ts.flatMap(searchSpaceNode.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { + var references = ts.flatMap(searchSpaceNode.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { cancellationToken.throwIfCancellationRequested(); return getPossibleSymbolReferenceNodes(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(function (node) { if (!ts.isThis(node)) { @@ -140929,20 +142197,20 @@ var ts; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return searchSpaceNode.symbol === container.symbol; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol; - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // Make sure the container belongs to the same class/object literals // and has the appropriate static modifier from the original container. return container.parent && searchSpaceNode.symbol === container.parent.symbol && ts.isStatic(container) === !!staticFlag; - case 305 /* SyntaxKind.SourceFile */: - return container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); + case 308 /* SyntaxKind.SourceFile */: + return container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); } }); }).map(function (n) { return nodeEntry(n); }); @@ -141053,7 +142321,7 @@ var ts; ts.Debug.assert(paramProps.length === 2 && !!(paramProps[0].flags & 1 /* SymbolFlags.FunctionScopedVariable */) && !!(paramProps[1].flags & 4 /* SymbolFlags.Property */)); // is [parameter, property] return fromRoot(symbol.flags & 1 /* SymbolFlags.FunctionScopedVariable */ ? paramProps[1] : paramProps[0]); } - var exportSpecifier = ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */); + var exportSpecifier = ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */); if (!isForRenamePopulateSearchSymbolSet || exportSpecifier && !exportSpecifier.propertyName) { var localSymbol = exportSpecifier && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier); if (localSymbol) { @@ -141098,7 +142366,7 @@ var ts; }); } function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) { - var bindingElement = ts.getDeclarationOfKind(symbol, 203 /* SyntaxKind.BindingElement */); + var bindingElement = ts.getDeclarationOfKind(symbol, 205 /* SyntaxKind.BindingElement */); if (bindingElement && ts.isObjectBindingElementWithoutPropertyName(bindingElement)) { return ts.getPropertySymbolFromBindingElement(checker, bindingElement); } @@ -141361,16 +142629,16 @@ var ts; return; } switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return (_a = ts.getAssignedName(node.parent)) === null || _a === void 0 ? void 0 : _a.getText(); } return (_b = ts.getNameOfDeclaration(node.parent)) === null || _b === void 0 ? void 0 : _b.getText(); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isModuleBlock(node.parent) && ts.isIdentifier(node.parent.parent.name)) { return node.parent.parent.name.getText(); } @@ -141585,61 +142853,65 @@ var ts; } switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // do not descend into nodes that cannot contain callable nodes return; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: recordCallSite(node); return; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // do not descend into the type side of an assertion collect(node.expression); return; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: // do not descend into the type of a variable or parameter declaration collect(node.name); collect(node.initializer); return; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: // do not descend into the type arguments of a call expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: // do not descend into the type arguments of a new expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // do not descend into the type arguments of a tagged template expression recordCallSite(node); collect(node.tag); collect(node.template); return; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // do not descend into the type arguments of a JsxOpeningLikeElement recordCallSite(node); collect(node.tagName); collect(node.attributes); return; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: recordCallSite(node); collect(node.expression); return; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: recordCallSite(node); ts.forEachChild(node, collect); break; + case 235 /* SyntaxKind.SatisfiesExpression */: + // do not descend into the type side of an assertion + collect(node.expression); + return; } if (ts.isPartOfTypeNode(node)) { // do not descend into types @@ -141694,25 +142966,25 @@ var ts; var callSites = []; var collect = createCallSiteCollector(program, callSites); switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: collectCallSitesOfSourceFile(node, collect); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: collectCallSitesOfModuleDeclaration(node, collect); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: collectCallSitesOfFunctionLikeDeclaration(program.getTypeChecker(), node, collect); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: collectCallSitesOfClassLikeDeclaration(node, collect); break; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: collectCallSitesOfClassStaticBlockDeclaration(node, collect); break; default: @@ -141983,7 +143255,7 @@ var ts; } var parent = node.parent; var typeChecker = program.getTypeChecker(); - if (node.kind === 159 /* SyntaxKind.OverrideKeyword */ || (ts.isIdentifier(node) && ts.isJSDocOverrideTag(parent) && parent.tagName === node)) { + if (node.kind === 161 /* SyntaxKind.OverrideKeyword */ || (ts.isIdentifier(node) && ts.isJSDocOverrideTag(parent) && parent.tagName === node)) { return getDefinitionFromOverriddenMember(typeChecker, node) || ts.emptyArray; } // Labels @@ -141991,6 +143263,12 @@ var ts; var label = ts.getTargetLabel(node.parent, node.text); return label ? [createDefinitionInfoFromName(typeChecker, label, "label" /* ScriptElementKind.label */, node.text, /*containerName*/ undefined)] : undefined; // TODO: GH#18217 } + if (node.kind === 105 /* SyntaxKind.ReturnKeyword */) { + var functionDeclaration = ts.findAncestor(node.parent, function (n) { + return ts.isClassStaticBlockDeclaration(n) ? "quit" : ts.isFunctionLikeDeclaration(n); + }); + return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : undefined; + } if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) { var classDecl = node.parent.parent; var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution; @@ -142059,7 +143337,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node, /*unverified*/ false, failedAliasResolution); }) : ts.emptyArray; return ts.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts.emptyArray); @@ -142126,13 +143404,16 @@ var ts; if (!baseDeclaration) return; var baseTypeNode = ts.getEffectiveBaseTypeNode(baseDeclaration); - var baseType = baseTypeNode ? typeChecker.getTypeAtLocation(baseTypeNode) : undefined; - if (!baseType) + if (!baseTypeNode) + return; + var expression = ts.skipParentheses(baseTypeNode.expression); + var base = ts.isClassExpression(expression) ? expression.symbol : typeChecker.getSymbolAtLocation(expression); + if (!base) return; var name = ts.unescapeLeadingUnderscores(ts.getTextOfPropertyName(classElement.name)); var symbol = ts.hasStaticModifier(classElement) - ? typeChecker.getPropertyOfType(typeChecker.getTypeOfSymbolAtLocation(baseType.symbol, baseDeclaration), name) - : typeChecker.getPropertyOfType(baseType, name); + ? typeChecker.getPropertyOfType(typeChecker.getTypeOfSymbol(base), name) + : typeChecker.getPropertyOfType(typeChecker.getDeclaredTypeOfSymbol(base), name); if (!symbol) return; return getDefinitionFromSymbol(typeChecker, symbol, node); @@ -142265,7 +143546,7 @@ var ts; if (node.parent === declaration) { return true; } - if (declaration.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (declaration.kind === 271 /* SyntaxKind.NamespaceImport */) { return false; } return true; @@ -142307,7 +143588,7 @@ var ts; function getConstructSignatureDefinition() { // Applicable only if we are in a new expression, or we are on a constructor declaration // and in either case the symbol has a construct signature definition, i.e. class - if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 134 /* SyntaxKind.ConstructorKeyword */)) { + if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 135 /* SyntaxKind.ConstructorKeyword */)) { var cls = ts.find(filteredDeclarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration"); return getSignatureDefinition(cls.members, /*selectConstructors*/ true); } @@ -142359,22 +143640,22 @@ var ts; return isDefinitionVisible(checker, declaration.parent); // Handle some exceptions here like arrow function, members of class and object literal expression which are technically not visible but we want the definition to be determined by its parent switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // Private/protected properties/methods are not visible if (ts.hasEffectiveModifier(declaration, 8 /* ModifierFlags.Private */)) return false; // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: return isDefinitionVisible(checker, declaration.parent); default: return false; @@ -142412,9 +143693,9 @@ var ts; } function isConstructorLike(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return true; default: return false; @@ -142520,17 +143801,17 @@ var ts; ts.forEachUnique(declarations, function (declaration) { for (var _i = 0, _a = getCommentHavingNodes(declaration); _i < _a.length; _i++) { var jsdoc = _a[_i]; - var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 327 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); + var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 330 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @typedefs are themselves declarations with associated comments // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation if (jsdoc.comment === undefined && !inheritDoc || ts.isJSDoc(jsdoc) - && declaration.kind !== 345 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 338 /* SyntaxKind.JSDocCallbackTag */ + && declaration.kind !== 348 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 341 /* SyntaxKind.JSDocCallbackTag */ && jsdoc.tags - && jsdoc.tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !jsdoc.tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + && jsdoc.tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !jsdoc.tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { continue; } var newparts = jsdoc.comment ? getDisplayPartsFromComment(jsdoc.comment, checker) : []; @@ -142550,11 +143831,11 @@ var ts; } function getCommentHavingNodes(declaration) { switch (declaration.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return [declaration]; - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return [declaration, declaration.parent]; default: return ts.getJSDocCommentsAndTags(declaration); @@ -142568,8 +143849,8 @@ var ts; // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation - if (tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + if (tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { return; } for (var _i = 0, tags_1 = tags; _i < tags_1.length; _i++) { @@ -142584,17 +143865,17 @@ var ts; if (typeof comment === "string") { return [ts.textPart(comment)]; } - return ts.flatMap(comment, function (node) { return node.kind === 321 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); + return ts.flatMap(comment, function (node) { return node.kind === 324 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); } function getCommentDisplayParts(tag, checker) { var comment = tag.comment, kind = tag.kind; var namePart = getTagNameDisplayPart(kind); switch (kind) { - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return withNode(tag.class); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return withNode(tag.class); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: var templateTag = tag; var displayParts_3 = []; if (templateTag.constraint) { @@ -142616,13 +143897,13 @@ var ts; displayParts_3.push.apply(displayParts_3, __spreadArray([ts.spacePart()], getDisplayPartsFromComment(comment, checker), true)); } return displayParts_3; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return withNode(tag.typeExpression); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: - case 346 /* SyntaxKind.JSDocSeeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: var name = tag.name; return name ? withNode(name) : comment === undefined ? undefined @@ -142649,14 +143930,14 @@ var ts; } function getTagNameDisplayPart(kind) { switch (kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return ts.parameterNamePart; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return ts.propertyNamePart; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return ts.typeParameterNamePart; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return ts.typeAliasNamePart; default: return ts.textPart; @@ -142827,43 +144108,48 @@ var ts; } function getCommentOwnerInfoWorker(commentOwner, options) { switch (commentOwner.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: var host = commentOwner; return { commentOwner: commentOwner, parameters: host.parameters, hasReturn: hasReturn(host, options) }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getCommentOwnerInfoWorker(commentOwner.initializer, options); - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return { commentOwner: commentOwner }; - case 237 /* SyntaxKind.VariableStatement */: { + case 168 /* SyntaxKind.PropertySignature */: { + var host_1 = commentOwner; + return host_1.type && ts.isFunctionTypeNode(host_1.type) + ? { commentOwner: commentOwner, parameters: host_1.type.parameters, hasReturn: hasReturn(host_1.type, options) } + : { commentOwner: commentOwner }; + } + case 240 /* SyntaxKind.VariableStatement */: { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; - var host_1 = varDeclarations.length === 1 && varDeclarations[0].initializer + var host_2 = varDeclarations.length === 1 && varDeclarations[0].initializer ? getRightHandSideOfAssignment(varDeclarations[0].initializer) : undefined; - return host_1 - ? { commentOwner: commentOwner, parameters: host_1.parameters, hasReturn: hasReturn(host_1, options) } + return host_2 + ? { commentOwner: commentOwner, parameters: host_2.parameters, hasReturn: hasReturn(host_2, options) } : { commentOwner: commentOwner }; } - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return "quit"; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - return commentOwner.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; - case 238 /* SyntaxKind.ExpressionStatement */: + return commentOwner.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; + case 241 /* SyntaxKind.ExpressionStatement */: return getCommentOwnerInfoWorker(commentOwner.expression, options); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var be = commentOwner; if (ts.getAssignmentDeclarationKind(be) === 0 /* AssignmentDeclarationKind.None */) { return "quit"; @@ -142872,7 +144158,7 @@ var ts; ? { commentOwner: commentOwner, parameters: be.right.parameters, hasReturn: hasReturn(be.right, options) } : { commentOwner: commentOwner }; } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: var init = commentOwner.initializer; if (init && (ts.isFunctionExpression(init) || ts.isArrowFunction(init))) { return { commentOwner: commentOwner, parameters: init.parameters, hasReturn: hasReturn(init, options) }; @@ -142881,18 +144167,18 @@ var ts; } function hasReturn(node, options) { return !!(options === null || options === void 0 ? void 0 : options.generateReturnInDocTemplate) && - (ts.isArrowFunction(node) && ts.isExpression(node.body) + (ts.isFunctionTypeNode(node) || ts.isArrowFunction(node) && ts.isExpression(node.body) || ts.isFunctionLikeDeclaration(node) && node.body && ts.isBlock(node.body) && !!ts.forEachReturnStatement(node.body, function (n) { return n; })); } function getRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (rightHandSide.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return rightHandSide; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return ts.find(rightHandSide.members, ts.isConstructorDeclaration); } } @@ -142951,9 +144237,9 @@ var ts; } function shouldKeepItem(declaration, checker) { switch (declaration.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var importer = checker.getSymbolAtLocation(declaration.name); // TODO: GH#18217 var imported = checker.getAliasedSymbol(importer); return importer.escapedName !== imported.escapedName; @@ -142963,7 +144249,7 @@ var ts; } function tryAddSingleDeclarationName(declaration, containers) { var name = ts.getNameOfDeclaration(declaration); - return !!name && (pushLiteral(name, containers) || name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); + return !!name && (pushLiteral(name, containers) || name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); } // Only added the names of computed properties if they're simple dotted expressions, like: // @@ -142980,7 +144266,7 @@ var ts; // First, if we started with a computed property name, then add all but the last // portion into the container array. var name = ts.getNameOfDeclaration(declaration); - if (name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { + if (name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { return ts.emptyArray; } // Don't include the last portion. @@ -143197,7 +144483,7 @@ var ts; */ function hasNavigationBarName(node) { return !ts.hasDynamicName(node) || - (node.kind !== 221 /* SyntaxKind.BinaryExpression */ && + (node.kind !== 223 /* SyntaxKind.BinaryExpression */ && ts.isPropertyAccessExpression(node.name.expression) && ts.isIdentifier(node.name.expression.expression) && ts.idText(node.name.expression.expression) === "Symbol"); @@ -143210,7 +144496,7 @@ var ts; return; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Get parameter properties, and treat them as being on the *same* level as the constructor, not under it. var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); @@ -143222,25 +144508,25 @@ var ts; } } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 170 /* SyntaxKind.MethodSignature */: if (hasNavigationBarName(node)) { addNodeWithRecursiveChild(node, node.body); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (hasNavigationBarName(node)) { addNodeWithRecursiveInitializer(node); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (hasNavigationBarName(node)) { addLeafNode(node); } break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -143252,7 +144538,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -143263,17 +144549,17 @@ var ts; } } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: addNodeWithRecursiveChild(node, node.name); break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: var expression = node.expression; // Use the expression as the name of the SpreadAssignment, otherwise show as . ts.isIdentifier(expression) ? addLeafNode(node, expression) : addLeafNode(node); break; - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: { + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: { var child = node; if (ts.isBindingPattern(child.name)) { addChildrenRecursively(child.name); @@ -143283,7 +144569,7 @@ var ts; } break; } - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: var nameNode = node.name; // If we see a function declaration track as a possible ES5 class if (nameNode && ts.isIdentifier(nameNode)) { @@ -143291,11 +144577,11 @@ var ts; } addNodeWithRecursiveChild(node, node.body); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: startNode(node); for (var _e = 0, _f = node.members; _e < _f.length; _e++) { var member = _f[_e]; @@ -143305,9 +144591,9 @@ var ts; } endNode(); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: startNode(node); for (var _g = 0, _h = node.members; _g < _h.length; _g++) { var member = _h[_g]; @@ -143315,10 +144601,10 @@ var ts; } endNode(); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression_1 = node.expression; var child = ts.isObjectLiteralExpression(expression_1) || ts.isCallExpression(expression_1) ? expression_1 : ts.isArrowFunction(expression_1) || ts.isFunctionExpression(expression_1) ? expression_1.body : undefined; @@ -143332,16 +144618,16 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 176 /* SyntaxKind.IndexSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: addLeafNode(node); break; - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var special = ts.getAssignmentDeclarationKind(node); switch (special) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -143581,12 +144867,12 @@ var ts; return false; } switch (a.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.isStatic(a) === ts.isStatic(b); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return areSameModule(a, b) && getFullyQualifiedModuleName(a) === getFullyQualifiedModuleName(b); default: @@ -143608,7 +144894,7 @@ var ts; if (!a.body || !b.body) { return a.body === b.body; } - return a.body.kind === b.body.kind && (a.body.kind !== 261 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); + return a.body.kind === b.body.kind && (a.body.kind !== 264 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); } /** Merge source into target. Source should be thrown away after this is called. */ function merge(target, source) { @@ -143638,7 +144924,7 @@ var ts; * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return getModuleName(node); } var declName = ts.getNameOfDeclaration(node); @@ -143647,16 +144933,16 @@ var ts; return propertyName && ts.unescapeLeadingUnderscores(propertyName); } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: return getFunctionOrClassName(node); default: return undefined; } } function getItemName(node, name) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return cleanText(getModuleName(node)); } if (name) { @@ -143668,32 +144954,32 @@ var ts; } } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"".concat(ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))), "\"") : ""; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return ts.isExportAssignment(node) && node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } // We may get a string with newlines or other whitespace in the case of an object dereference // (eg: "app\n.onactivated"), so we should remove the whitespace for readability in the // navigation bar. return getFunctionOrClassName(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return "new()"; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return "()"; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "[]"; default: return ""; @@ -143726,19 +145012,19 @@ var ts; } // Some nodes are otherwise important enough to always include in the primary navigation menu. switch (navigationBarNodeKind(item)) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 305 /* SyntaxKind.SourceFile */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return true; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -143748,10 +145034,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: return true; default: return false; @@ -143813,7 +145099,7 @@ var ts; function getFullyQualifiedModuleName(moduleDeclaration) { // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = [ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)]; - while (moduleDeclaration.body && moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } @@ -143827,13 +145113,13 @@ var ts; return decl.body && ts.isModuleDeclaration(decl.body) ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return !member.name || member.name.kind === 164 /* SyntaxKind.ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); } function getModifiers(node) { - if (node.parent && node.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.parent && node.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } return ts.getNodeModifiers(node); @@ -143856,7 +145142,7 @@ var ts; return nodeText(parent.name); } // Default exports are named "default" - else if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + else if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } else if (ts.isClassLike(node)) { @@ -143891,9 +145177,9 @@ var ts; } function isFunctionOrClassExpression(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; default: return false; @@ -143922,23 +145208,39 @@ var ts; * 2) Coalescing imports from the same module * 3) Sorting imports */ - function organizeImports(sourceFile, formatContext, host, program, preferences, skipDestructiveCodeActions) { + function organizeImports(sourceFile, formatContext, host, program, preferences, mode) { var changeTracker = ts.textChanges.ChangeTracker.fromContext({ host: host, formatContext: formatContext, preferences: preferences }); - var coalesceAndOrganizeImports = function (importGroup) { return ts.stableSort(coalesceImports(removeUnusedImports(importGroup, sourceFile, program, skipDestructiveCodeActions)), function (s1, s2) { return compareImportsOrRequireStatements(s1, s2); }); }; + var shouldSort = mode === "SortAndCombine" /* OrganizeImportsMode.SortAndCombine */ || mode === "All" /* OrganizeImportsMode.All */; + var shouldCombine = shouldSort; // These are currently inseparable, but I draw a distinction for clarity and in case we add modes in the future. + var shouldRemove = mode === "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */ || mode === "All" /* OrganizeImportsMode.All */; + var maybeRemove = shouldRemove ? removeUnusedImports : ts.identity; + var maybeCoalesce = shouldCombine ? coalesceImports : ts.identity; + var processImportsOfSameModuleSpecifier = function (importGroup) { + var processedDeclarations = maybeCoalesce(maybeRemove(importGroup, sourceFile, program)); + return shouldSort + ? ts.stableSort(processedDeclarations, function (s1, s2) { return compareImportsOrRequireStatements(s1, s2); }) + : processedDeclarations; + }; // All of the old ImportDeclarations in the file, in syntactic order. var topLevelImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, sourceFile.statements.filter(ts.isImportDeclaration)); - topLevelImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, coalesceAndOrganizeImports); }); - // All of the old ExportDeclarations in the file, in syntactic order. - var topLevelExportDecls = sourceFile.statements.filter(ts.isExportDeclaration); - organizeImportsWorker(topLevelExportDecls, coalesceExports); + topLevelImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier); }); + // Exports are always used + if (mode !== "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */) { + // All of the old ExportDeclarations in the file, in syntactic order. + var topLevelExportDecls = sourceFile.statements.filter(ts.isExportDeclaration); + organizeImportsWorker(topLevelExportDecls, coalesceExports); + } for (var _i = 0, _a = sourceFile.statements.filter(ts.isAmbientModule); _i < _a.length; _i++) { var ambientModule = _a[_i]; if (!ambientModule.body) continue; var ambientModuleImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(ts.isImportDeclaration)); - ambientModuleImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, coalesceAndOrganizeImports); }); - var ambientModuleExportDecls = ambientModule.body.statements.filter(ts.isExportDeclaration); - organizeImportsWorker(ambientModuleExportDecls, coalesceExports); + ambientModuleImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier); }); + // Exports are always used + if (mode !== "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */) { + var ambientModuleExportDecls = ambientModule.body.statements.filter(ts.isExportDeclaration); + organizeImportsWorker(ambientModuleExportDecls, coalesceExports); + } } return changeTracker.getChanges(); function organizeImportsWorker(oldImportDecls, coalesce) { @@ -143951,8 +145253,12 @@ var ts; // Consider: we could do a more careful check that this trivia is actually a header, // but the consequences of being wrong are very minor. ts.suppressLeadingTrivia(oldImportDecls[0]); - var oldImportGroups = ts.group(oldImportDecls, function (importDecl) { return getExternalModuleName(importDecl.moduleSpecifier); }); - var sortedImportGroups = ts.stableSort(oldImportGroups, function (group1, group2) { return compareModuleSpecifiers(group1[0].moduleSpecifier, group2[0].moduleSpecifier); }); + var oldImportGroups = shouldCombine + ? ts.group(oldImportDecls, function (importDecl) { return getExternalModuleName(importDecl.moduleSpecifier); }) + : [oldImportDecls]; + var sortedImportGroups = shouldSort + ? ts.stableSort(oldImportGroups, function (group1, group2) { return compareModuleSpecifiers(group1[0].moduleSpecifier, group2[0].moduleSpecifier); }) + : oldImportGroups; var newImportDecls = ts.flatMap(sortedImportGroups, function (importGroup) { return getExternalModuleName(importGroup[0].moduleSpecifier) ? coalesce(importGroup) @@ -144016,11 +145322,7 @@ var ts; } return false; } - function removeUnusedImports(oldImports, sourceFile, program, skipDestructiveCodeActions) { - // As a precaution, consider unused import detection to be destructive (GH #43051) - if (skipDestructiveCodeActions) { - return oldImports; - } + function removeUnusedImports(oldImports, sourceFile, program) { var typeChecker = program.getTypeChecker(); var compilerOptions = program.getCompilerOptions(); var jsxNamespace = typeChecker.getJsxNamespace(sourceFile); @@ -144294,11 +145596,11 @@ var ts; function getModuleSpecifierExpression(declaration) { var _a; switch (declaration.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return (_a = ts.tryCast(declaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return declaration.moduleSpecifier; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return declaration.declarationList.declarations[0].initializer.arguments[0]; } } @@ -144337,19 +145639,19 @@ var ts; function getImportKindOrder(s1) { var _a; switch (s1.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!s1.importClause) return 0; if (s1.importClause.isTypeOnly) return 1; - if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 268 /* SyntaxKind.NamespaceImport */) + if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 271 /* SyntaxKind.NamespaceImport */) return 2; if (s1.importClause.name) return 3; return 4; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return 5; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return 6; } } @@ -144538,7 +145840,7 @@ var ts; } function getOutliningSpanForNode(n, sourceFile) { switch (n.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionLike(n.parent)) { return functionSpan(n.parent, n, sourceFile); } @@ -144546,16 +145848,16 @@ var ts; // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. switch (n.parent.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 243 /* SyntaxKind.DoStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 295 /* SyntaxKind.CatchClause */: return spanForNode(n.parent); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // Could be the try-block, or the finally-block. var tryStatement = n.parent; if (tryStatement.tryBlock === n) { @@ -144572,42 +145874,42 @@ var ts; // the span of the block, independent of any parent span. return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile), "code" /* OutliningSpanKind.Code */); } - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanForNode(n.parent); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 263 /* SyntaxKind.CaseBlock */: - case 182 /* SyntaxKind.TypeLiteral */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 266 /* SyntaxKind.CaseBlock */: + case 184 /* SyntaxKind.TypeLiteral */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return spanForNode(n); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isTupleTypeNode(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return spanForNodeArray(n.statements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return spanForObjectOrArrayLiteral(n); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return spanForObjectOrArrayLiteral(n, 22 /* SyntaxKind.OpenBracketToken */); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return spanForJSXElement(n); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return spanForJSXFragment(n); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return spanForJSXAttributes(n.attributes); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return spanForTemplateLiteral(n); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isBindingElement(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return spanForArrowFunction(n); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return spanForCallExpression(n); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanForParenthesizedExpression(n); } function spanForCallExpression(node) { @@ -144680,7 +145982,7 @@ var ts; function functionSpan(node, body, sourceFile) { var openToken = tryGetFunctionOpenToken(node, body, sourceFile); var closeToken = ts.findChildOfKind(body, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 214 /* SyntaxKind.ArrowFunction */); + return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 216 /* SyntaxKind.ArrowFunction */); } function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart) { if (autoCollapse === void 0) { autoCollapse = false; } @@ -144876,7 +146178,7 @@ var ts; return bestMatch; } function betterMatch(a, b) { - return ts.min(a, b, compareMatches); + return ts.min([a, b], compareMatches); } function compareMatches(a, b) { return a === undefined ? 1 /* Comparison.GreaterThan */ : b === undefined ? -1 /* Comparison.LessThan */ @@ -145224,10 +146526,10 @@ var ts; */ function tryConsumeDeclare() { var token = ts.scanner.getToken(); - if (token === 135 /* SyntaxKind.DeclareKeyword */) { + if (token === 136 /* SyntaxKind.DeclareKeyword */) { // declare module "mod" token = nextToken(); - if (token === 141 /* SyntaxKind.ModuleKeyword */) { + if (token === 142 /* SyntaxKind.ModuleKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { recordAmbientExternalModule(); @@ -145261,10 +146563,10 @@ var ts; return true; } else { - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); - return token !== 156 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || + return token !== 158 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || token === 18 /* SyntaxKind.OpenBraceToken */ || token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)); @@ -145275,7 +146577,7 @@ var ts; } if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import d from "mod"; @@ -145306,7 +146608,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import {a as A} from "mod"; @@ -145318,11 +146620,11 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 127 /* SyntaxKind.AsKeyword */) { + if (token === 128 /* SyntaxKind.AsKeyword */) { token = nextToken(); if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import * as NS from "mod" @@ -145343,7 +146645,7 @@ var ts; if (token === 93 /* SyntaxKind.ExportKeyword */) { markAsExternalModuleIfTopLevel(); token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 41 /* SyntaxKind.AsteriskToken */ || @@ -145362,7 +146664,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export {a as A} from "mod"; @@ -145374,7 +146676,7 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export * from "mod" @@ -145384,7 +146686,7 @@ var ts; } else if (token === 100 /* SyntaxKind.ImportKeyword */) { token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 79 /* SyntaxKind.Identifier */ || @@ -145410,7 +146712,7 @@ var ts; function tryConsumeRequireCall(skipCurrentToken, allowTemplateLiterals) { if (allowTemplateLiterals === void 0) { allowTemplateLiterals = false; } var token = skipCurrentToken ? nextToken() : ts.scanner.getToken(); - if (token === 146 /* SyntaxKind.RequireKeyword */) { + if (token === 147 /* SyntaxKind.RequireKeyword */) { token = nextToken(); if (token === 20 /* SyntaxKind.OpenParenToken */) { token = nextToken(); @@ -145485,8 +146787,8 @@ var ts; } if (ts.scanner.getToken() === 15 /* SyntaxKind.TemplateHead */) { var stack = [ts.scanner.getToken()]; - var token = ts.scanner.scan(); loop: while (ts.length(stack)) { + var token = ts.scanner.scan(); switch (token) { case 1 /* SyntaxKind.EndOfFileToken */: break loop; @@ -145514,7 +146816,6 @@ var ts; } break; } - token = ts.scanner.scan(); } nextToken(); } @@ -145622,7 +146923,7 @@ var ts; return getRenameInfoError(wouldRenameNodeModules); } var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) + var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) ? ts.stripQuotes(ts.getTextOfIdentifierOrLiteral(node)) : undefined; var displayName = specifierName || typeChecker.symbolToString(symbol); @@ -145767,6 +147068,10 @@ var ts; pushSelectionCommentRange(comment.pos, comment.end); } if (positionShouldSnapToNode(sourceFile, pos, node)) { + if (ts.isFunctionBody(node) + && ts.isFunctionLikeDeclaration(parentNode) && !ts.positionsAreOnSameLine(node.getStart(sourceFile), node.getEnd(), sourceFile)) { + pushSelectionRange(node.getStart(sourceFile), node.getEnd()); + } // 1. Blocks are effectively redundant with SyntaxLists. // 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping // of things that should be considered independently. @@ -145904,14 +147209,14 @@ var ts; ts.Debug.assertEqual(closeBraceToken.kind, 19 /* SyntaxKind.CloseBraceToken */); // Group `-/+readonly` and `-/+?` var groupedWithPlusMinusTokens = groupChildren(children, function (child) { - return child === node.readonlyToken || child.kind === 145 /* SyntaxKind.ReadonlyKeyword */ || + return child === node.readonlyToken || child.kind === 146 /* SyntaxKind.ReadonlyKeyword */ || child === node.questionToken || child.kind === 57 /* SyntaxKind.QuestionToken */; }); // Group type parameter with surrounding brackets var groupedWithBrackets = groupChildren(groupedWithPlusMinusTokens, function (_a) { var kind = _a.kind; return kind === 22 /* SyntaxKind.OpenBracketToken */ || - kind === 163 /* SyntaxKind.TypeParameter */ || + kind === 165 /* SyntaxKind.TypeParameter */ || kind === 23 /* SyntaxKind.CloseBracketToken */; }); return [ @@ -145929,7 +147234,7 @@ var ts; var children = groupChildren(node.getChildren(), function (child) { return child === node.name || ts.contains(node.modifiers, child); }); - var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDoc */ ? children[0] : undefined; + var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 323 /* SyntaxKind.JSDoc */ ? children[0] : undefined; var withJSDocSeparated = firstJSDocChild ? children.slice(1) : children; var splittedChildren = splitChildren(withJSDocSeparated, function (_a) { var kind = _a.kind; @@ -146028,22 +147333,22 @@ var ts; return kind === 18 /* SyntaxKind.OpenBraceToken */ || kind === 22 /* SyntaxKind.OpenBracketToken */ || kind === 20 /* SyntaxKind.OpenParenToken */ - || kind === 280 /* SyntaxKind.JsxOpeningElement */; + || kind === 283 /* SyntaxKind.JsxOpeningElement */; } function isListCloser(token) { var kind = token && token.kind; return kind === 19 /* SyntaxKind.CloseBraceToken */ || kind === 23 /* SyntaxKind.CloseBracketToken */ || kind === 21 /* SyntaxKind.CloseParenToken */ - || kind === 281 /* SyntaxKind.JsxClosingElement */; + || kind === 284 /* SyntaxKind.JsxClosingElement */; } function getEndPos(sourceFile, node) { switch (node.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 342 /* SyntaxKind.JSDocThisTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 345 /* SyntaxKind.JSDocThisTag */: return sourceFile.getLineEndOfPosition(node.getStart()); default: return node.getEnd(); @@ -146253,10 +147558,10 @@ var ts; } return undefined; } - else if (ts.isTemplateHead(node) && parent.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + else if (ts.isTemplateHead(node) && parent.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var templateExpression = parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 223 /* SyntaxKind.TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 225 /* SyntaxKind.TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } @@ -146328,17 +147633,17 @@ var ts; return undefined; var parent = startingToken.parent; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: var info = getArgumentOrParameterListInfo(startingToken, position, sourceFile); if (!info) return undefined; var argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan; var contextualType = ts.isMethodDeclaration(parent) ? checker.getContextualTypeForObjectLiteralElement(parent) : checker.getContextualType(parent); return contextualType && { contextualType: contextualType, argumentIndex: argumentIndex, argumentCount: argumentCount, argumentsSpan: argumentsSpan }; - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var highestBinary = getHighestBinary(parent); var contextualType_1 = checker.getContextualType(highestBinary); var argumentIndex_1 = startingToken.kind === 20 /* SyntaxKind.OpenParenToken */ ? 0 : countBinaryExpressionParameters(parent) - 1; @@ -146409,11 +147714,11 @@ var ts; // not enough to put us in the substitution expression; we should consider ourselves part of // the *next* span's expression by offsetting the index (argIndex = (spanIndex + 1) + 1). // - /* eslint-disable no-double-space */ + /* eslint-disable local/no-double-space */ // Example: f `# abcd $#{# 1 + 1# }# efghi ${ #"#hello"# } # ` // ^ ^ ^ ^ ^ ^ ^ ^ ^ // Case: 1 1 3 2 1 3 2 2 1 - /* eslint-enable no-double-space */ + /* eslint-enable local/no-double-space */ ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."); if (ts.isTemplateLiteralToken(node)) { if (ts.isInsideTemplateLiteral(node, position, sourceFile)) { @@ -146462,7 +147767,7 @@ var ts; // | | // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { var lastSpan = ts.last(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -146667,14 +147972,14 @@ var ts; return; } switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) { @@ -146818,7 +148123,7 @@ var ts; } function isHintableLiteral(node) { switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; return ts.isLiteralExpression(operand) || ts.isIdentifier(operand) && ts.isInfinityOrNaNString(operand.escapedText); } @@ -146826,7 +148131,7 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; case 79 /* SyntaxKind.Identifier */: { var name = node.escapedText; @@ -147147,11 +148452,11 @@ var ts; function containsTopLevelCommonjs(sourceFile) { return sourceFile.statements.some(function (statement) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return statement.declarationList.declarations.some(function (decl) { return !!decl.initializer && ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), /*checkArgumentIsStringLiteralLike*/ true); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; if (!ts.isBinaryExpression(expression)) return ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true); @@ -147168,12 +148473,12 @@ var ts; } function importNameForConvertToDefaultImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier; - return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) + return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; default: return undefined; @@ -147249,20 +148554,20 @@ var ts; // should be kept up to date with getTransformationBody in convertToAsyncFunction.ts function isFixablePromiseArgument(arg, checker) { switch (arg.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var functionFlags = ts.getFunctionFlags(arg); if (functionFlags & 1 /* FunctionFlags.Generator */) { return false; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true); // falls through case 104 /* SyntaxKind.NullKeyword */: return true; case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var symbol = checker.getSymbolAtLocation(arg); if (!symbol) { return false; @@ -147279,24 +148584,24 @@ var ts; } function canBeConvertedToClass(node, checker) { var _a, _b, _c, _d; - if (node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (node.kind === 215 /* SyntaxKind.FunctionExpression */) { if (ts.isVariableDeclaration(node.parent) && ((_a = node.symbol.members) === null || _a === void 0 ? void 0 : _a.size)) { return true; } var symbol = checker.getSymbolOfExpando(node, /*allowDeclaration*/ false); return !!(symbol && (((_b = symbol.exports) === null || _b === void 0 ? void 0 : _b.size) || ((_c = symbol.members) === null || _c === void 0 ? void 0 : _c.size))); } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */) { return !!((_d = node.symbol.members) === null || _d === void 0 ? void 0 : _d.size); } return false; } function canBeConvertedToAsync(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -147318,7 +148623,7 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* SymbolFlags.Class */) { - return ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */) ? "local class" /* ScriptElementKind.localClassElement */ : "class" /* ScriptElementKind.classElement */; } if (flags & 384 /* SymbolFlags.Enum */) @@ -147381,6 +148686,8 @@ var ts; return "method" /* ScriptElementKind.memberFunctionElement */; if (flags & 16384 /* SymbolFlags.Constructor */) return "constructor" /* ScriptElementKind.constructorImplementationElement */; + if (flags & 131072 /* SymbolFlags.Signature */) + return "index" /* ScriptElementKind.indexSignatureElement */; if (flags & 4 /* SymbolFlags.Property */) { if (flags & 33554432 /* SymbolFlags.Transient */ && symbol.checkFlags & 6 /* CheckFlags.Synthetic */) { // If union property is result of union of non method (property/accessors/variables), it is labeled as property @@ -147464,12 +148771,15 @@ var ts; var declaration = ts.find(symbol.declarations, function (declaration) { return declaration.name === location; }); if (declaration) { switch (declaration.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: symbolKind = "getter" /* ScriptElementKind.memberGetAccessorElement */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: symbolKind = "setter" /* ScriptElementKind.memberSetAccessorElement */; break; + case 169 /* SyntaxKind.PropertyDeclaration */: + symbolKind = "accessor" /* ScriptElementKind.memberAccessorVariableElement */; + break; default: ts.Debug.assertNever(declaration); } @@ -147480,7 +148790,7 @@ var ts; } var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); - if (location.parent && location.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -147500,7 +148810,7 @@ var ts; } if (callExpressionLike) { signature = typeChecker.getResolvedSignature(callExpressionLike); // TODO: GH#18217 - var useConstructSignatures = callExpressionLike.kind === 209 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); + var useConstructSignatures = callExpressionLike.kind === 211 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (signature && !ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -147564,29 +148874,29 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* SymbolFlags.Accessor */)) || // name of function declaration - (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 171 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration + (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 173 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration // get the signature from the declaration and write it var functionDeclaration_1 = location.parent; // Use function declaration to write the signatures only if the symbol corresponding to this declaration var locationIsSymbolDeclaration = symbol.declarations && ts.find(symbol.declarations, function (declaration) { - return declaration === (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); + return declaration === (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); }); if (locationIsSymbolDeclaration) { - var allSignatures = functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration_1)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration_1); // TODO: GH#18217 } else { signature = allSignatures[0]; } - if (functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */) { + if (functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */) { // show (constructor) Type(...) signature symbolKind = "constructor" /* ScriptElementKind.constructorImplementationElement */; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 174 /* SyntaxKind.CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 176 /* SyntaxKind.CallSignature */ && !(type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ || type.symbol.flags & 4096 /* SymbolFlags.ObjectLiteral */) ? type.symbol : symbol, symbolKind); } if (signature) { @@ -147599,7 +148909,7 @@ var ts; } if (symbolFlags & 32 /* SymbolFlags.Class */ && !hasAddedSymbolInfo && !isThisExpression) { addAliasPrefixIfNecessary(); - if (ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -147622,7 +148932,7 @@ var ts; } if ((symbolFlags & 524288 /* SymbolFlags.TypeAlias */) && (semanticMeaning & 2 /* SemanticMeaning.Type */)) { prefixNextMeaning(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -147643,9 +148953,9 @@ var ts; } if (symbolFlags & 1536 /* SymbolFlags.Module */ && !isThisExpression) { prefixNextMeaning(); - var declaration = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 264 /* SyntaxKind.ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 79 /* SyntaxKind.Identifier */; - displayParts.push(ts.keywordPart(isNamespace ? 142 /* SyntaxKind.NamespaceKeyword */ : 141 /* SyntaxKind.ModuleKeyword */)); + displayParts.push(ts.keywordPart(isNamespace ? 143 /* SyntaxKind.NamespaceKeyword */ : 142 /* SyntaxKind.ModuleKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } @@ -147664,7 +148974,7 @@ var ts; } else { // Method/function type parameter - var decl = ts.getDeclarationOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var decl = ts.getDeclarationOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (decl === undefined) return ts.Debug.fail(); var declaration = decl.parent; @@ -147672,21 +148982,21 @@ var ts; if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); // TODO: GH#18217 - if (declaration.kind === 175 /* SyntaxKind.ConstructSignature */) { + if (declaration.kind === 177 /* SyntaxKind.ConstructSignature */) { displayParts.push(ts.keywordPart(103 /* SyntaxKind.NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 174 /* SyntaxKind.CallSignature */ && declaration.name) { + else if (declaration.kind !== 176 /* SyntaxKind.CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* TypeFormatFlags.WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + else if (declaration.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path addInPrefix(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -147698,7 +149008,7 @@ var ts; symbolKind = "enum member" /* ScriptElementKind.enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]; - if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 299 /* SyntaxKind.EnumMember */) { + if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 302 /* SyntaxKind.EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -147734,17 +149044,17 @@ var ts; } if (symbol.declarations) { switch (symbol.declarations[0].kind) { - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(142 /* SyntaxKind.NamespaceKeyword */)); + displayParts.push(ts.keywordPart(143 /* SyntaxKind.NamespaceKeyword */)); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 63 /* SyntaxKind.EqualsToken */ : 88 /* SyntaxKind.DefaultKeyword */)); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); break; default: @@ -147754,13 +149064,13 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); displayParts.push(ts.operatorPart(63 /* SyntaxKind.EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(146 /* SyntaxKind.RequireKeyword */)); + displayParts.push(ts.keywordPart(147 /* SyntaxKind.RequireKeyword */)); displayParts.push(ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)); @@ -147790,16 +149100,18 @@ var ts; } // For properties, variables and local vars: show the type if (symbolKind === "property" /* ScriptElementKind.memberVariableElement */ || + symbolKind === "accessor" /* ScriptElementKind.memberAccessorVariableElement */ || symbolKind === "getter" /* ScriptElementKind.memberGetAccessorElement */ || symbolKind === "setter" /* ScriptElementKind.memberSetAccessorElement */ || symbolKind === "JSX attribute" /* ScriptElementKind.jsxAttribute */ || symbolFlags & 3 /* SymbolFlags.Variable */ || symbolKind === "local var" /* ScriptElementKind.localVariableElement */ || + symbolKind === "index" /* ScriptElementKind.indexSignatureElement */ || isThisExpression) { displayParts.push(ts.punctuationPart(58 /* SyntaxKind.ColonToken */)); displayParts.push(ts.spacePart()); // If the type is type parameter, format it specially - if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */) { + if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */ && symbolKind !== "index" /* ScriptElementKind.indexSignatureElement */) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { var param = typeChecker.typeParameterToDeclaration(type, enclosingDeclaration, symbolDisplayNodeBuilderFlags); getPrinter().writeNode(4 /* EmitHint.Unspecified */, param, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosingDeclaration)), writer); @@ -147843,10 +149155,10 @@ var ts; // For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 305 /* SyntaxKind.SourceFile */; })) { + if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 308 /* SyntaxKind.SourceFile */; })) { for (var _i = 0, _b = symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - if (!declaration.parent || declaration.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -147907,10 +149219,34 @@ var ts; displayParts.push(ts.spacePart()); } function addFullSymbolName(symbolToDisplay, enclosingDeclaration) { + var indexInfos; if (alias && symbolToDisplay === symbol) { symbolToDisplay = alias; } - var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + if (symbolKind === "index" /* ScriptElementKind.indexSignatureElement */) { + indexInfos = typeChecker.getIndexInfosOfIndexSymbol(symbolToDisplay); + } + var fullSymbolDisplayParts = []; + if (symbolToDisplay.flags & 131072 /* SymbolFlags.Signature */ && indexInfos) { + if (symbolToDisplay.parent) { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay.parent); + } + fullSymbolDisplayParts.push(ts.punctuationPart(22 /* SyntaxKind.OpenBracketToken */)); + //Needed to handle more than one type of index + indexInfos.forEach(function (info, i) { + //Needed to handle template literals + fullSymbolDisplayParts.push.apply(fullSymbolDisplayParts, ts.typeToDisplayParts(typeChecker, info.keyType)); + if (i !== indexInfos.length - 1) { + fullSymbolDisplayParts.push(ts.spacePart()); + fullSymbolDisplayParts.push(ts.punctuationPart(51 /* SyntaxKind.BarToken */)); + fullSymbolDisplayParts.push(ts.spacePart()); + } + }); + fullSymbolDisplayParts.push(ts.punctuationPart(23 /* SyntaxKind.CloseBracketToken */)); + } + else { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + } ts.addRange(displayParts, fullSymbolDisplayParts); if (symbol.flags & 16777216 /* SymbolFlags.Optional */) { displayParts.push(ts.punctuationPart(57 /* SyntaxKind.QuestionToken */)); @@ -147958,7 +149294,7 @@ var ts; tags = signature.getJsDocTags(); if (allSignatures.length > 1 && documentation.length === 0 && tags.length === 0) { documentation = allSignatures[0].getDocumentationComment(typeChecker); - tags = allSignatures[0].getJsDocTags(); + tags = allSignatures[0].getJsDocTags().filter(function (tag) { return tag.name !== "deprecated"; }); // should only include @deprecated JSDoc tag on the first overload (#49368) } } function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { @@ -147976,16 +149312,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (declaration.kind === 215 /* SyntaxKind.FunctionExpression */) { return true; } - if (declaration.kind !== 254 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */) { + if (declaration.kind !== 257 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block - if (parent.kind === 305 /* SyntaxKind.SourceFile */ || parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ || parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return false; } } @@ -148290,10 +149626,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 285 /* SyntaxKind.JsxAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 288 /* SyntaxKind.JsxAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // May parse an identifier like `module-layout`; that will be scanned as a keyword at first, but we should parse the whole thing to get an identifier. return ts.isKeyword(node.kind) || node.kind === 79 /* SyntaxKind.Identifier */; } @@ -148301,7 +149637,7 @@ var ts; return false; } function shouldRescanJsxText(node) { - return ts.isJsxText(node); + return ts.isJsxText(node) || ts.isJsxElement(node) && (lastTokenInfo === null || lastTokenInfo === void 0 ? void 0 : lastTokenInfo.token.kind) === 11 /* SyntaxKind.JsxText */; } function shouldRescanSlashToken(container) { return container.kind === 13 /* SyntaxKind.RegularExpressionLiteral */; @@ -148486,7 +149822,7 @@ var ts; (function (formatting) { function getAllRules() { var allTokens = []; - for (var token = 0 /* SyntaxKind.FirstToken */; token <= 160 /* SyntaxKind.LastToken */; token++) { + for (var token = 0 /* SyntaxKind.FirstToken */; token <= 162 /* SyntaxKind.LastToken */; token++) { if (token !== 1 /* SyntaxKind.EndOfFileToken */) { allTokens.push(token); } @@ -148501,9 +149837,9 @@ var ts; var anyToken = { tokens: allTokens, isSpecific: false }; var anyTokenIncludingMultilineComments = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [3 /* SyntaxKind.MultiLineCommentTrivia */], false)); var anyTokenIncludingEOF = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [1 /* SyntaxKind.EndOfFileToken */], false)); - var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 160 /* SyntaxKind.LastKeyword */); + var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 162 /* SyntaxKind.LastKeyword */); var binaryOperators = tokenRangeFromRange(29 /* SyntaxKind.FirstBinaryOperator */, 78 /* SyntaxKind.LastBinaryOperator */); - var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 160 /* SyntaxKind.OfKeyword */, 127 /* SyntaxKind.AsKeyword */, 139 /* SyntaxKind.IsKeyword */]; + var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 162 /* SyntaxKind.OfKeyword */, 128 /* SyntaxKind.AsKeyword */, 140 /* SyntaxKind.IsKeyword */]; var unaryPrefixOperators = [45 /* SyntaxKind.PlusPlusToken */, 46 /* SyntaxKind.MinusMinusToken */, 54 /* SyntaxKind.TildeToken */, 53 /* SyntaxKind.ExclamationToken */]; var unaryPrefixExpressions = [ 8 /* SyntaxKind.NumericLiteral */, 9 /* SyntaxKind.BigIntLiteral */, 79 /* SyntaxKind.Identifier */, 20 /* SyntaxKind.OpenParenToken */, @@ -148534,7 +149870,7 @@ var ts; rule("SpaceAfterQuestionMarkInConditionalOperator", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext, isConditionalOperatorContext], 4 /* RuleAction.InsertSpace */), // in other cases there should be no space between '?' and next token rule("NoSpaceAfterQuestionMark", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext, isNotPropertyAccessOnIntegerLiteral], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterDot", [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceBetweenImportParenInImportType", 100 /* SyntaxKind.ImportKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 16 /* RuleAction.DeleteSpace */), // Special handling of unary operators. @@ -148577,11 +149913,11 @@ var ts; // Though, we do extra check on the context to make sure we are dealing with get/set node. Example: // get x() {} // set x(val) {} - rule("SpaceAfterGetSetInMember", [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterGetSetInMember", [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenYieldKeywordAndStar", 125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 16 /* RuleAction.DeleteSpace */), rule("SpaceBetweenYieldOrYieldStarAndOperand", [125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenReturnAndSemicolon", 105 /* SyntaxKind.ReturnKeyword */, 26 /* SyntaxKind.SemicolonToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 132 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 133 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterLetConstInVariableDeclaration", [119 /* SyntaxKind.LetKeyword */, 85 /* SyntaxKind.ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBeforeOpenParenInFuncCall", anyToken, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], 16 /* RuleAction.DeleteSpace */), // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. @@ -148589,8 +149925,8 @@ var ts; rule("SpaceAfterBinaryKeywordOperator", binaryKeywordOperators, anyToken, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterVoidOperator", 114 /* SyntaxKind.VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 4 /* RuleAction.InsertSpace */), // Async-await - rule("SpaceBetweenAsyncAndOpenParen", 131 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBetweenAsyncAndFunctionKeyword", 131 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndOpenParen", 132 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndFunctionKeyword", 132 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Template string rule("NoSpaceBetweenTagAndTemplateString", [79 /* SyntaxKind.Identifier */, 21 /* SyntaxKind.CloseParenToken */], [14 /* SyntaxKind.NoSubstitutionTemplateLiteral */, 15 /* SyntaxKind.TemplateHead */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // JSX opening elements @@ -148601,34 +149937,35 @@ var ts; rule("NoSpaceAfterEqualInJsxAttribute", 63 /* SyntaxKind.EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // TypeScript-specific rules // Use of module as a function call. e.g.: import m2 = module("m2"); - rule("NoSpaceAfterModuleImport", [141 /* SyntaxKind.ModuleKeyword */, 146 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceAfterModuleImport", [142 /* SyntaxKind.ModuleKeyword */, 147 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // Add a space around certain TypeScript keywords rule("SpaceAfterCertainTypeScriptKeywords", [ 126 /* SyntaxKind.AbstractKeyword */, + 127 /* SyntaxKind.AccessorKeyword */, 84 /* SyntaxKind.ClassKeyword */, - 135 /* SyntaxKind.DeclareKeyword */, + 136 /* SyntaxKind.DeclareKeyword */, 88 /* SyntaxKind.DefaultKeyword */, 92 /* SyntaxKind.EnumKeyword */, 93 /* SyntaxKind.ExportKeyword */, 94 /* SyntaxKind.ExtendsKeyword */, - 136 /* SyntaxKind.GetKeyword */, + 137 /* SyntaxKind.GetKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 100 /* SyntaxKind.ImportKeyword */, 118 /* SyntaxKind.InterfaceKeyword */, - 141 /* SyntaxKind.ModuleKeyword */, - 142 /* SyntaxKind.NamespaceKeyword */, + 142 /* SyntaxKind.ModuleKeyword */, + 143 /* SyntaxKind.NamespaceKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 123 /* SyntaxKind.PublicKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 151 /* SyntaxKind.SetKeyword */, 124 /* SyntaxKind.StaticKeyword */, - 152 /* SyntaxKind.TypeKeyword */, - 156 /* SyntaxKind.FromKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 137 /* SyntaxKind.InferKeyword */, + 154 /* SyntaxKind.TypeKeyword */, + 158 /* SyntaxKind.FromKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 138 /* SyntaxKind.InferKeyword */, ], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 156 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 158 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { rule("SpaceAfterModuleName", 10 /* SyntaxKind.StringLiteral */, 18 /* SyntaxKind.OpenBraceToken */, [isModuleDeclContext], 4 /* RuleAction.InsertSpace */), // Lambda expressions @@ -148659,8 +149996,8 @@ var ts; 123 /* SyntaxKind.PublicKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 136 /* SyntaxKind.GetKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 137 /* SyntaxKind.GetKeyword */, + 151 /* SyntaxKind.SetKeyword */, 22 /* SyntaxKind.OpenBracketToken */, 41 /* SyntaxKind.AsteriskToken */, ], [isEndOfDecoratorContextOnSameLine], 4 /* RuleAction.InsertSpace */), @@ -148671,8 +150008,8 @@ var ts; // These rules are applied after high priority var userConfigurableRules = [ // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - rule("SpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("NoSpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("SpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("NoSpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket, isNextTokenNotCloseParen], 4 /* RuleAction.InsertSpace */), rule("NoSpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], 16 /* RuleAction.DeleteSpace */), // Insert space after function keyword for anonymous functions @@ -148746,11 +150083,11 @@ var ts; rule("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 18 /* SyntaxKind.OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 4 /* RuleAction.InsertSpace */, 1 /* RuleFlags.CanDeleteNewLines */), rule("NoSpaceBeforeComma", anyToken, 27 /* SyntaxKind.CommaToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // No space before and after indexer `x[]` - rule("NoSpaceBeforeOpenBracket", anyTokenExcept(131 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeOpenBracket", anyTokenExcept(132 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterCloseBracket", 23 /* SyntaxKind.CloseBracketToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterSemicolon", 26 /* SyntaxKind.SemicolonToken */, anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Remove extra space between for and await - rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 132 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 133 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] rule("SpaceBetweenStatements", [21 /* SyntaxKind.CloseParenToken */, 90 /* SyntaxKind.DoKeyword */, 91 /* SyntaxKind.ElseKeyword */, 82 /* SyntaxKind.CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 4 /* RuleAction.InsertSpace */), @@ -148799,69 +150136,70 @@ var ts; return function (context) { return context.options && context.options[optionName] === optionValue; }; } function isOptionEnabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !!context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !!context.options[optionName]; }; } function isOptionDisabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !context.options[optionName]; }; } function isOptionDisabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName]; }; } function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; } function isOptionEnabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !!context.options[optionName]; }; } function isForContext(context) { - return context.contextNode.kind === 242 /* SyntaxKind.ForStatement */; + return context.contextNode.kind === 245 /* SyntaxKind.ForStatement */; } function isNotForContext(context) { return !isForContext(context); } function isBinaryOpContext(context) { switch (context.contextNode.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return context.contextNode.operatorToken.kind !== 27 /* SyntaxKind.CommaToken */; - case 222 /* SyntaxKind.ConditionalExpression */: - case 189 /* SyntaxKind.ConditionalType */: - case 229 /* SyntaxKind.AsExpression */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 177 /* SyntaxKind.TypePredicate */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 191 /* SyntaxKind.ConditionalType */: + case 231 /* SyntaxKind.AsExpression */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 179 /* SyntaxKind.TypePredicate */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // equals in type X = ... // falls through - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // equal in import a = module('a'); // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // equal in export = 1 // falls through - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // equal in let a = 0 // falls through - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // equal in p = 0 // falls through - case 164 /* SyntaxKind.Parameter */: - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // "in" keyword in for (let x in []) { } - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // "in" keyword in [P in keyof T]: T[P] // falls through - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return context.currentTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.nextTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 244 /* SyntaxKind.ForOfStatement */: - return context.currentTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */; + case 247 /* SyntaxKind.ForOfStatement */: + return context.currentTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */; } return false; } @@ -148873,22 +150211,22 @@ var ts; } function isTypeAnnotationContext(context) { var contextKind = context.contextNode.kind; - return contextKind === 167 /* SyntaxKind.PropertyDeclaration */ || - contextKind === 166 /* SyntaxKind.PropertySignature */ || - contextKind === 164 /* SyntaxKind.Parameter */ || - contextKind === 254 /* SyntaxKind.VariableDeclaration */ || + return contextKind === 169 /* SyntaxKind.PropertyDeclaration */ || + contextKind === 168 /* SyntaxKind.PropertySignature */ || + contextKind === 166 /* SyntaxKind.Parameter */ || + contextKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(contextKind); } function isConditionalOperatorContext(context) { - return context.contextNode.kind === 222 /* SyntaxKind.ConditionalExpression */ || - context.contextNode.kind === 189 /* SyntaxKind.ConditionalType */; + return context.contextNode.kind === 224 /* SyntaxKind.ConditionalExpression */ || + context.contextNode.kind === 191 /* SyntaxKind.ConditionalType */; } function isSameLineTokenOrBeforeBlockContext(context) { return context.TokensAreOnSameLine() || isBeforeBlockContext(context); } function isBraceWrappedContext(context) { - return context.contextNode.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || - context.contextNode.kind === 195 /* SyntaxKind.MappedType */ || + return context.contextNode.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || + context.contextNode.kind === 197 /* SyntaxKind.MappedType */ || isSingleLineBlockContext(context); } // This check is done before an open brace in a control construct, a function, or a typescript block declaration @@ -148914,34 +150252,34 @@ var ts; return true; } switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 265 /* SyntaxKind.ModuleBlock */: return true; } return false; } function isFunctionDeclContext(context) { switch (context.contextNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: // falls through - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // case SyntaxKind.MethodSignature: // falls through - case 174 /* SyntaxKind.CallSignature */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: // falls through - case 258 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one + case 261 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one return true; } return false; @@ -148950,40 +150288,40 @@ var ts; return !isFunctionDeclContext(context); } function isFunctionDeclarationOrFunctionExpressionContext(context) { - return context.contextNode.kind === 256 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 213 /* SyntaxKind.FunctionExpression */; + return context.contextNode.kind === 259 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 215 /* SyntaxKind.FunctionExpression */; } function isTypeScriptDeclWithBlockContext(context) { return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 273 /* SyntaxKind.NamedExports */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 269 /* SyntaxKind.NamedImports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 276 /* SyntaxKind.NamedExports */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 272 /* SyntaxKind.NamedImports */: return true; } return false; } function isAfterCodeBlockContext(context) { switch (context.currentTokenParent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 292 /* SyntaxKind.CatchClause */: - case 262 /* SyntaxKind.ModuleBlock */: - case 249 /* SyntaxKind.SwitchStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 295 /* SyntaxKind.CatchClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 252 /* SyntaxKind.SwitchStatement */: return true; - case 235 /* SyntaxKind.Block */: { + case 238 /* SyntaxKind.Block */: { var blockParent = context.currentTokenParent.parent; // In a codefix scenario, we can't rely on parents being set. So just always return true. - if (!blockParent || blockParent.kind !== 214 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (!blockParent || blockParent.kind !== 216 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 215 /* SyntaxKind.FunctionExpression */) { return true; } } @@ -148992,32 +150330,32 @@ var ts; } function isControlDeclContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 248 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 251 /* SyntaxKind.WithStatement */: // TODO // case SyntaxKind.ElseClause: // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return true; default: return false; } } function isObjectContext(context) { - return context.contextNode.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return context.contextNode.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } function isFunctionCallContext(context) { - return context.contextNode.kind === 208 /* SyntaxKind.CallExpression */; + return context.contextNode.kind === 210 /* SyntaxKind.CallExpression */; } function isNewContext(context) { - return context.contextNode.kind === 209 /* SyntaxKind.NewExpression */; + return context.contextNode.kind === 211 /* SyntaxKind.NewExpression */; } function isFunctionCallOrNewContext(context) { return isFunctionCallContext(context) || isNewContext(context); @@ -149032,10 +150370,10 @@ var ts; return context.nextTokenSpan.kind !== 21 /* SyntaxKind.CloseParenToken */; } function isArrowFunctionContext(context) { - return context.contextNode.kind === 214 /* SyntaxKind.ArrowFunction */; + return context.contextNode.kind === 216 /* SyntaxKind.ArrowFunction */; } function isImportTypeContext(context) { - return context.contextNode.kind === 200 /* SyntaxKind.ImportType */; + return context.contextNode.kind === 202 /* SyntaxKind.ImportType */; } function isNonJsxSameLineTokenContext(context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; @@ -149044,19 +150382,19 @@ var ts; return context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; } function isNonJsxElementOrFragmentContext(context) { - return context.contextNode.kind !== 278 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 282 /* SyntaxKind.JsxFragment */; + return context.contextNode.kind !== 281 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 285 /* SyntaxKind.JsxFragment */; } function isJsxExpressionContext(context) { - return context.contextNode.kind === 288 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return context.contextNode.kind === 291 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } function isNextTokenParentJsxAttribute(context) { - return context.nextTokenParent.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.nextTokenParent.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxAttributeContext(context) { - return context.contextNode.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.contextNode.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxSelfClosingElementContext(context) { - return context.contextNode.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return context.contextNode.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } function isNotBeforeBlockInFunctionDeclarationContext(context) { return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); @@ -149068,48 +150406,48 @@ var ts; !nodeIsInDecoratorContext(context.nextTokenParent); } function nodeIsInDecoratorContext(node) { - while (ts.isExpressionNode(node)) { + while (node && ts.isExpression(node)) { node = node.parent; } - return node.kind === 165 /* SyntaxKind.Decorator */; + return node && node.kind === 167 /* SyntaxKind.Decorator */; } function isStartOfVariableDeclarationList(context) { - return context.currentTokenParent.kind === 255 /* SyntaxKind.VariableDeclarationList */ && + return context.currentTokenParent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } function isNotFormatOnEnter(context) { return context.formattingRequestKind !== 2 /* FormattingRequestKind.FormatOnEnter */; } function isModuleDeclContext(context) { - return context.contextNode.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return context.contextNode.kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isObjectTypeContext(context) { - return context.contextNode.kind === 182 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 184 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; } function isConstructorSignatureContext(context) { - return context.contextNode.kind === 175 /* SyntaxKind.ConstructSignature */; + return context.contextNode.kind === 177 /* SyntaxKind.ConstructSignature */; } function isTypeArgumentOrParameterOrAssertion(token, parent) { if (token.kind !== 29 /* SyntaxKind.LessThanToken */ && token.kind !== 31 /* SyntaxKind.GreaterThanToken */) { return false; } switch (parent.kind) { - case 178 /* SyntaxKind.TypeReference */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return true; default: return false; @@ -149120,28 +150458,28 @@ var ts; isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); } function isTypeAssertionContext(context) { - return context.contextNode.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return context.contextNode.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } function isVoidOpContext(context) { - return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 217 /* SyntaxKind.VoidExpression */; + return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 219 /* SyntaxKind.VoidExpression */; } function isYieldOrYieldStarWithOperand(context) { - return context.contextNode.kind === 224 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 226 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; } function isNonNullAssertionContext(context) { - return context.contextNode.kind === 230 /* SyntaxKind.NonNullExpression */; + return context.contextNode.kind === 232 /* SyntaxKind.NonNullExpression */; } function isNotStatementConditionContext(context) { return !isStatementConditionContext(context); } function isStatementConditionContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; default: return false; @@ -149166,12 +150504,12 @@ var ts; return nextTokenKind === 19 /* SyntaxKind.CloseBraceToken */ || nextTokenKind === 1 /* SyntaxKind.EndOfFileToken */; } - if (nextTokenKind === 234 /* SyntaxKind.SemicolonClassElement */ || + if (nextTokenKind === 237 /* SyntaxKind.SemicolonClassElement */ || nextTokenKind === 26 /* SyntaxKind.SemicolonToken */) { return false; } - if (context.contextNode.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - context.contextNode.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (context.contextNode.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + context.contextNode.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Can’t remove semicolon after `foo`; it would parse as a method declaration: // // interface I { @@ -149185,9 +150523,9 @@ var ts; if (ts.isPropertyDeclaration(context.currentTokenParent)) { return !context.currentTokenParent.initializer; } - return context.currentTokenParent.kind !== 242 /* SyntaxKind.ForStatement */ - && context.currentTokenParent.kind !== 236 /* SyntaxKind.EmptyStatement */ - && context.currentTokenParent.kind !== 234 /* SyntaxKind.SemicolonClassElement */ + return context.currentTokenParent.kind !== 245 /* SyntaxKind.ForStatement */ + && context.currentTokenParent.kind !== 239 /* SyntaxKind.EmptyStatement */ + && context.currentTokenParent.kind !== 237 /* SyntaxKind.SemicolonClassElement */ && nextTokenKind !== 22 /* SyntaxKind.OpenBracketToken */ && nextTokenKind !== 20 /* SyntaxKind.OpenParenToken */ && nextTokenKind !== 39 /* SyntaxKind.PlusToken */ @@ -149195,7 +150533,7 @@ var ts; && nextTokenKind !== 43 /* SyntaxKind.SlashToken */ && nextTokenKind !== 13 /* SyntaxKind.RegularExpressionLiteral */ && nextTokenKind !== 27 /* SyntaxKind.CommaToken */ - && nextTokenKind !== 223 /* SyntaxKind.TemplateExpression */ + && nextTokenKind !== 225 /* SyntaxKind.TemplateExpression */ && nextTokenKind !== 15 /* SyntaxKind.TemplateHead */ && nextTokenKind !== 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */ && nextTokenKind !== 24 /* SyntaxKind.DotToken */; @@ -149203,6 +150541,11 @@ var ts; function isSemicolonInsertionContext(context) { return ts.positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile); } + function isNotPropertyAccessOnIntegerLiteral(context) { + return !ts.isPropertyAccessExpression(context.contextNode) + || !ts.isNumericLiteral(context.contextNode.expression) + || context.contextNode.expression.getText().indexOf(".") !== -1; + } })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); /* @internal */ @@ -149286,12 +150629,12 @@ var ts; return map; } function getRuleBucketIndex(row, column) { - ts.Debug.assert(row <= 160 /* SyntaxKind.LastKeyword */ && column <= 160 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 162 /* SyntaxKind.LastKeyword */ && column <= 162 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); return (row * mapRowLength) + column; } var maskBitSize = 5; var mask = 31; // MaskBitSize bits - var mapRowLength = 160 /* SyntaxKind.LastToken */ + 1; + var mapRowLength = 162 /* SyntaxKind.LastToken */ + 1; var RulesPosition; (function (RulesPosition) { RulesPosition[RulesPosition["StopRulesSpecific"] = 0] = "StopRulesSpecific"; @@ -149479,17 +150822,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var body = parent.body; - return !!body && body.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + return !!body && body.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -149752,19 +151095,19 @@ var ts; return modifier.kind; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; - case 256 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; - case 260 /* SyntaxKind.EnumDeclaration */: return 260 /* SyntaxKind.EnumDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: return 136 /* SyntaxKind.GetKeyword */; - case 173 /* SyntaxKind.SetAccessor */: return 149 /* SyntaxKind.SetKeyword */; - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; + case 261 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; + case 259 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; + case 263 /* SyntaxKind.EnumDeclaration */: return 263 /* SyntaxKind.EnumDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: return 137 /* SyntaxKind.GetKeyword */; + case 175 /* SyntaxKind.SetAccessor */: return 151 /* SyntaxKind.SetKeyword */; + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { return 41 /* SyntaxKind.AsteriskToken */; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: var name = ts.getNameOfDeclaration(node); if (name) { return name.kind; @@ -149821,15 +151164,15 @@ var ts; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: switch (container.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return false; } break; case 22 /* SyntaxKind.OpenBracketToken */: case 23 /* SyntaxKind.CloseBracketToken */: - if (container.kind !== 195 /* SyntaxKind.MappedType */) { + if (container.kind !== 197 /* SyntaxKind.MappedType */) { return false; } break; @@ -149933,11 +151276,11 @@ var ts; return inheritedIndentation; } } - var effectiveParentStartLine = child.kind === 165 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 167 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { + if (isFirstListItem && parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -150395,18 +151738,18 @@ var ts; formatting.getRangeOfEnclosingComment = getRangeOfEnclosingComment; function getOpenTokenForList(node, list) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -150414,8 +151757,8 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -150423,24 +151766,24 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 178 /* SyntaxKind.TypeReference */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 181 /* SyntaxKind.TypeQuery */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 200 /* SyntaxKind.ImportType */: + case 180 /* SyntaxKind.TypeReference */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 183 /* SyntaxKind.TypeQuery */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 202 /* SyntaxKind.ImportType */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return 18 /* SyntaxKind.OpenBraceToken */; } return 0 /* SyntaxKind.Unknown */; @@ -150576,11 +151919,11 @@ var ts; // y: undefined, // } // ``` - var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; if (options.indentStyle === ts.IndentStyle.Block || isObjectLiteral) { return getBlockIndent(sourceFile, position, options); } - if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Value.Unknown */) { @@ -150590,7 +151933,7 @@ var ts; var containerList = getListByPosition(position, precedingToken.parent, sourceFile); // use list position if the preceding token is before any list items if (containerList && !ts.rangeContainsRange(containerList, precedingToken)) { - var useTheSameBaseIndentation = [213 /* SyntaxKind.FunctionExpression */, 214 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; + var useTheSameBaseIndentation = [215 /* SyntaxKind.FunctionExpression */, 216 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; var indentSize = useTheSameBaseIndentation ? 0 : options.indentSize; return getActualIndentationForListStartLine(containerList, sourceFile, options) + indentSize; // TODO: GH#18217 } @@ -150755,7 +152098,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 305 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); + (parent.kind === 308 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Value.Unknown */; } @@ -150803,7 +152146,7 @@ var ts; } SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 239 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 242 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 91 /* SyntaxKind.ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -150884,42 +152227,42 @@ var ts; } function getListByRange(start, end, node, sourceFile) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getList(node.typeArguments); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return getList(node.properties); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getList(node.elements); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return getList(node.members); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return getList(node.typeParameters) || getList(node.parameters); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return getList(node.parameters); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return getList(node.typeParameters); - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: return getList(node.typeArguments) || getList(node.arguments); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return getList(node.declarations); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return getList(node.elements); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return getList(node.elements); } function getList(list) { @@ -150942,7 +152285,7 @@ var ts; return findColumnForFirstNonWhitespaceCharacterInLine(sourceFile.getLineAndCharacterOfPosition(list.pos), sourceFile, options); } function getActualIndentationForListItem(node, sourceFile, options, listIndentsChild) { - if (node.parent && node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.parent && node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // VariableDeclarationList has no wrapping tokens return -1 /* Value.Unknown */; } @@ -151015,96 +152358,96 @@ var ts; function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) { var childKind = child ? child.kind : 0 /* SyntaxKind.Unknown */; switch (parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 195 /* SyntaxKind.MappedType */: - case 184 /* SyntaxKind.TupleType */: - case 263 /* SyntaxKind.CaseBlock */: - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 237 /* SyntaxKind.VariableStatement */: - case 271 /* SyntaxKind.ExportAssignment */: - case 247 /* SyntaxKind.ReturnStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 288 /* SyntaxKind.JsxExpression */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 164 /* SyntaxKind.Parameter */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 273 /* SyntaxKind.NamedExports */: - case 269 /* SyntaxKind.NamedImports */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 197 /* SyntaxKind.MappedType */: + case 186 /* SyntaxKind.TupleType */: + case 266 /* SyntaxKind.CaseBlock */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 240 /* SyntaxKind.VariableStatement */: + case 274 /* SyntaxKind.ExportAssignment */: + case 250 /* SyntaxKind.ReturnStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 291 /* SyntaxKind.JsxExpression */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 166 /* SyntaxKind.Parameter */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 276 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: - if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 205 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 + case 257 /* SyntaxKind.VariableDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: + if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 return rangeIsOnOneLine(sourceFile, child); } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 278 /* SyntaxKind.JsxElement */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 281 /* SyntaxKind.JsxElement */) { var parentStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, parent.pos)).line; var childStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, child.pos)).line; return parentStartLine !== childStartLine; } - if (parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { return true; } break; - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return childKind !== 235 /* SyntaxKind.Block */; - case 214 /* SyntaxKind.ArrowFunction */: - if (sourceFile && childKind === 212 /* SyntaxKind.ParenthesizedExpression */) { + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return childKind !== 238 /* SyntaxKind.Block */; + case 216 /* SyntaxKind.ArrowFunction */: + if (sourceFile && childKind === 214 /* SyntaxKind.ParenthesizedExpression */) { return rangeIsOnOneLine(sourceFile, child); } - return childKind !== 235 /* SyntaxKind.Block */; - case 272 /* SyntaxKind.ExportDeclaration */: - return childKind !== 273 /* SyntaxKind.NamedExports */; - case 266 /* SyntaxKind.ImportDeclaration */: - return childKind !== 267 /* SyntaxKind.ImportClause */ || - (!!child.namedBindings && child.namedBindings.kind !== 269 /* SyntaxKind.NamedImports */); - case 278 /* SyntaxKind.JsxElement */: - return childKind !== 281 /* SyntaxKind.JsxClosingElement */; - case 282 /* SyntaxKind.JsxFragment */: - return childKind !== 284 /* SyntaxKind.JsxClosingFragment */; - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: - if (childKind === 182 /* SyntaxKind.TypeLiteral */ || childKind === 184 /* SyntaxKind.TupleType */) { + return childKind !== 238 /* SyntaxKind.Block */; + case 275 /* SyntaxKind.ExportDeclaration */: + return childKind !== 276 /* SyntaxKind.NamedExports */; + case 269 /* SyntaxKind.ImportDeclaration */: + return childKind !== 270 /* SyntaxKind.ImportClause */ || + (!!child.namedBindings && child.namedBindings.kind !== 272 /* SyntaxKind.NamedImports */); + case 281 /* SyntaxKind.JsxElement */: + return childKind !== 284 /* SyntaxKind.JsxClosingElement */; + case 285 /* SyntaxKind.JsxFragment */: + return childKind !== 287 /* SyntaxKind.JsxClosingFragment */; + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + if (childKind === 184 /* SyntaxKind.TypeLiteral */ || childKind === 186 /* SyntaxKind.TupleType */) { return false; } break; @@ -151115,11 +152458,11 @@ var ts; SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; function isControlFlowEndingStatement(kind, parent) { switch (kind) { - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return parent.kind !== 235 /* SyntaxKind.Block */; + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + return parent.kind !== 238 /* SyntaxKind.Block */; default: return false; } @@ -151336,7 +152679,7 @@ var ts; * Checks if 'candidate' argument is a legal separator in the list that contains 'node' as an element */ function isSeparator(node, candidate) { - return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)); + return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)); } function isThisTypeAnnotatable(containingFunction) { return ts.isFunctionExpression(containingFunction) || ts.isFunctionDeclaration(containingFunction); @@ -151568,7 +152911,7 @@ var ts; } } else { - endNode = (_a = (node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; + endNode = (_a = (node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; } this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " }); return true; @@ -151734,18 +153077,18 @@ var ts; }; ChangeTracker.prototype.getInsertNodeAfterOptionsWorker = function (node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return { prefix: this.newLineCharacter, suffix: this.newLineCharacter }; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: case 10 /* SyntaxKind.StringLiteral */: case 79 /* SyntaxKind.Identifier */: return { prefix: ", " }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return { suffix: "," + this.newLineCharacter }; case 93 /* SyntaxKind.ExportKeyword */: return { prefix: " " }; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return {}; default: ts.Debug.assert(ts.isStatement(node) || ts.isClassOrTypeElement(node)); // Else we haven't handled this kind of node yet -- add it @@ -151754,7 +153097,7 @@ var ts; }; ChangeTracker.prototype.insertName = function (sourceFile, node, name) { ts.Debug.assert(!node.name); - if (node.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind === 216 /* SyntaxKind.ArrowFunction */) { var arrow = ts.findChildOfKind(node, 38 /* SyntaxKind.EqualsGreaterThanToken */, sourceFile); var lparen = ts.findChildOfKind(node, 20 /* SyntaxKind.OpenParenToken */, sourceFile); if (lparen) { @@ -151768,14 +153111,14 @@ var ts; // Replacing full range of arrow to get rid of the leading space -- replace ` =>` with `)` this.replaceRange(sourceFile, arrow, ts.factory.createToken(21 /* SyntaxKind.CloseParenToken */)); } - if (node.body.kind !== 235 /* SyntaxKind.Block */) { + if (node.body.kind !== 238 /* SyntaxKind.Block */) { // `() => 0` => `function f() { return 0; }` this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.factory.createToken(18 /* SyntaxKind.OpenBraceToken */), ts.factory.createToken(105 /* SyntaxKind.ReturnKeyword */)], { joiner: " ", suffix: " " }); this.insertNodesAt(sourceFile, node.body.end, [ts.factory.createToken(26 /* SyntaxKind.SemicolonToken */), ts.factory.createToken(19 /* SyntaxKind.CloseBraceToken */)], { joiner: " " }); } } else { - var pos = ts.findChildOfKind(node, node.kind === 213 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; + var pos = ts.findChildOfKind(node, node.kind === 215 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; this.insertNodeAt(sourceFile, pos, ts.factory.createIdentifier(name), { prefix: " " }); } }; @@ -151952,10 +153295,10 @@ var ts; }()); textChanges_3.ChangeTracker = ChangeTracker; function updateJSDocHost(parent) { - if (parent.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (parent.kind !== 216 /* SyntaxKind.ArrowFunction */) { return parent; } - var jsDocNode = parent.parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ ? + var jsDocNode = parent.parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ ? parent.parent : parent.parent.parent; jsDocNode.jsDoc = parent.jsDoc; @@ -151967,16 +153310,16 @@ var ts; return undefined; } switch (oldTag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 343 /* SyntaxKind.JSDocParameterTag */: { var oldParam = oldTag; var newParam = newTag; return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText ? ts.factory.createJSDocParameterTag(/*tagName*/ undefined, newParam.name, /*isBracketed*/ false, newParam.typeExpression, newParam.isNameFirst, oldParam.comment) : undefined; } - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: return ts.factory.createJSDocReturnTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return ts.factory.createJSDocTypeTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); } } @@ -151984,6 +153327,26 @@ var ts; function startPositionToDeleteNodeInList(sourceFile, node) { return ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, { leadingTriviaOption: LeadingTriviaOption.IncludeAll }), /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); } + function endPositionToDeleteNodeInList(sourceFile, node, prevNode, nextNode) { + var end = startPositionToDeleteNodeInList(sourceFile, nextNode); + if (prevNode === undefined || ts.positionsAreOnSameLine(getAdjustedEndPosition(sourceFile, node, {}), end, sourceFile)) { + return end; + } + var token = ts.findPrecedingToken(nextNode.getStart(sourceFile), sourceFile); + if (isSeparator(node, token)) { + var prevToken = ts.findPrecedingToken(node.getStart(sourceFile), sourceFile); + if (isSeparator(prevNode, prevToken)) { + var pos = ts.skipTrivia(sourceFile.text, token.getEnd(), /*stopAfterLineBreak*/ true, /*stopAtComments*/ true); + if (ts.positionsAreOnSameLine(prevToken.getStart(sourceFile), token.getStart(sourceFile), sourceFile)) { + return ts.isLineBreak(sourceFile.text.charCodeAt(pos - 1)) ? pos - 1 : pos; + } + if (ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + return pos; + } + } + } + return end; + } function getClassOrObjectBraceEnds(cls, sourceFile) { var open = ts.findChildOfKind(cls, 18 /* SyntaxKind.OpenBraceToken */, sourceFile); var close = ts.findChildOfKind(cls, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); @@ -152370,14 +153733,14 @@ var ts; } textChanges_3.isValidLocationToAddComment = isValidLocationToAddComment; function needSemicolonBetween(a, b) { - return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[` } var deleteDeclaration; (function (deleteDeclaration_1) { function deleteDeclaration(changes, deletedNodesInLists, sourceFile, node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: { + case 166 /* SyntaxKind.Parameter */: { var oldFunction = node.parent; if (ts.isArrowFunction(oldFunction) && oldFunction.parameters.length === 1 && @@ -152392,17 +153755,17 @@ var ts; } break; } - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var isFirstImport = sourceFile.imports.length && node === ts.first(sourceFile.imports).parent || node === ts.find(sourceFile.statements, ts.isAnyImportSyntax); // For first import, leave header comment in place, otherwise only delete JSDoc comments deleteNode(changes, sourceFile, node, { leadingTriviaOption: isFirstImport ? LeadingTriviaOption.Exclude : ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine, }); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: var pattern = node.parent; - var preserveComma = pattern.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); + var preserveComma = pattern.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); if (preserveComma) { deleteNode(changes, sourceFile, node); } @@ -152410,13 +153773,13 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: var namedImports = node.parent; if (namedImports.elements.length === 1) { deleteImportBinding(changes, sourceFile, namedImports); @@ -152425,7 +153788,7 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: deleteImportBinding(changes, sourceFile, node); break; case 26 /* SyntaxKind.SemicolonToken */: @@ -152434,8 +153797,8 @@ var ts; case 98 /* SyntaxKind.FunctionKeyword */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: LeadingTriviaOption.Exclude }); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -152486,13 +153849,13 @@ var ts; // Delete the entire import declaration // |import * as ns from './file'| // |import { a } from './file'| - var importDecl = ts.getAncestor(node, 266 /* SyntaxKind.ImportDeclaration */); + var importDecl = ts.getAncestor(node, 269 /* SyntaxKind.ImportDeclaration */); deleteNode(changes, sourceFile, importDecl); } } function deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node) { var parent = node.parent; - if (parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (parent.kind === 295 /* SyntaxKind.CatchClause */) { // TODO: There's currently no unused diagnostic for this, could be a suggestion changes.deleteNodeRange(sourceFile, ts.findChildOfKind(parent, 20 /* SyntaxKind.OpenParenToken */, sourceFile), ts.findChildOfKind(parent, 21 /* SyntaxKind.CloseParenToken */, sourceFile)); return; @@ -152503,14 +153866,14 @@ var ts; } var gp = parent.parent; switch (gp.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: changes.replaceNode(sourceFile, node, ts.factory.createObjectLiteralExpression()); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: deleteNode(changes, sourceFile, parent); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: deleteNode(changes, sourceFile, gp, { leadingTriviaOption: ts.hasJSDocNodes(gp) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -152541,7 +153904,7 @@ var ts; deletedNodesInLists.add(node); changes.deleteRange(sourceFile, { pos: startPositionToDeleteNodeInList(sourceFile, node), - end: index === containingList.length - 1 ? getAdjustedEndPosition(sourceFile, node, {}) : startPositionToDeleteNodeInList(sourceFile, containingList[index + 1]), + end: index === containingList.length - 1 ? getAdjustedEndPosition(sourceFile, node, {}) : endPositionToDeleteNodeInList(sourceFile, node, containingList[index - 1], containingList[index + 1]), }); } })(textChanges = ts.textChanges || (ts.textChanges = {})); @@ -152697,8 +154060,8 @@ var ts; }); function makeChange(changeTracker, sourceFile, assertion) { var replacement = ts.isAsExpression(assertion) - ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)) - : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), assertion.expression); + ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)) + : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), assertion.expression); changeTracker.replaceNode(sourceFile, assertion.expression, replacement); } function getAssertion(sourceFile, pos) { @@ -152782,7 +154145,7 @@ var ts; } } fixedDeclarations === null || fixedDeclarations === void 0 ? void 0 : fixedDeclarations.add(ts.getNodeId(insertionSite)); - var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 256 /* ModifierFlags.Async */))); + var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 512 /* ModifierFlags.Async */))); changeTracker.replaceNode(sourceFile, insertionSite, cloneWithModifier); } function getFixableErrorSpanDeclaration(sourceFile, span) { @@ -152828,7 +154191,7 @@ var ts; ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_type_1.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2.code, - ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap.code, + ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap.code, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined.code, ts.Diagnostics.Type_0_is_not_an_array_type.code, ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type.code, @@ -152926,7 +154289,7 @@ var ts; } var declaration = ts.tryCast(symbol.valueDeclaration, ts.isVariableDeclaration); var variableName = declaration && ts.tryCast(declaration.name, ts.isIdentifier); - var variableStatement = ts.getAncestor(declaration, 237 /* SyntaxKind.VariableStatement */); + var variableStatement = ts.getAncestor(declaration, 240 /* SyntaxKind.VariableStatement */); if (!declaration || !variableStatement || declaration.type || !declaration.initializer || @@ -153004,13 +154367,22 @@ var ts; function isInsideAwaitableBody(node) { return node.kind & 32768 /* NodeFlags.AwaitContext */ || !!ts.findAncestor(node, function (ancestor) { return ancestor.parent && ts.isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || - ts.isBlock(ancestor) && (ancestor.parent.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - ancestor.parent.kind === 213 /* SyntaxKind.FunctionExpression */ || - ancestor.parent.kind === 214 /* SyntaxKind.ArrowFunction */ || - ancestor.parent.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.isBlock(ancestor) && (ancestor.parent.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + ancestor.parent.kind === 215 /* SyntaxKind.FunctionExpression */ || + ancestor.parent.kind === 216 /* SyntaxKind.ArrowFunction */ || + ancestor.parent.kind === 171 /* SyntaxKind.MethodDeclaration */); }); } function makeChange(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) { + if (ts.isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) { + var exprType = checker.getTypeAtLocation(insertionSite); + var asyncIter = checker.getAsyncIterableType(); + if (asyncIter && checker.isTypeAssignableTo(exprType, asyncIter)) { + var forOf = insertionSite.parent; + changeTracker.replaceNode(sourceFile, forOf, ts.factory.updateForOfStatement(forOf, ts.factory.createToken(133 /* SyntaxKind.AwaitKeyword */), forOf.initializer, forOf.expression, forOf.statement)); + return; + } + } if (ts.isBinaryExpression(insertionSite)) { for (var _i = 0, _a = [insertionSite.left, insertionSite.right]; _i < _a.length; _i++) { var side = _a[_i]; @@ -153126,10 +154498,10 @@ var ts; function isPossiblyPartOfDestructuring(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return true; default: return false; @@ -153144,7 +154516,7 @@ var ts; function isPossiblyPartOfCommaSeperatedInitializer(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: case 27 /* SyntaxKind.CommaToken */: return true; default: @@ -153193,9 +154565,9 @@ var ts; return; } var declaration = token.parent; - if (declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + if (declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && (!fixedNodes || ts.tryAddToSet(fixedNodes, declaration))) { - changeTracker.insertModifierBefore(sourceFile, 135 /* SyntaxKind.DeclareKeyword */, declaration); + changeTracker.insertModifierBefore(sourceFile, 136 /* SyntaxKind.DeclareKeyword */, declaration); } } })(codefix = ts.codefix || (ts.codefix = {})); @@ -153349,7 +154721,7 @@ var ts; var add = toAdd_1[_i]; var d = add.valueDeclaration; if (d && (ts.isPropertySignature(d) || ts.isPropertyDeclaration(d)) && d.type) { - var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 187 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ + var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 189 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ ts.factory.createTypeReferenceNode("undefined") ], false)); changes.replaceNode(d.getSourceFile(), d.type, t); @@ -153429,26 +154801,26 @@ var ts; } function isDeclarationWithType(node) { return ts.isFunctionLikeDeclaration(node) || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } function transformJSDocType(node) { switch (node.kind) { - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return ts.factory.createTypeReferenceNode("any", ts.emptyArray); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return transformJSDocOptionalType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return transformJSDocType(node.type); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return transformJSDocNullableType(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return transformJSDocVariadicType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return transformJSDocFunctionType(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return transformJSDocTypeReference(node); default: var visited = ts.visitEachChild(node, transformJSDocType, ts.nullTransformationContext); @@ -153469,11 +154841,11 @@ var ts; var _a; // TODO: This does not properly handle `function(new:C, string)` per https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System#the-javascript-type-language // however we do handle it correctly in `serializeTypeForDeclaration` in checker.ts - return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 318 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 + var isRest = node.type.kind === 321 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : node.dotDotDotToken; return ts.factory.createParameterDeclaration(node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -153512,8 +154884,8 @@ var ts; function transformJSDocIndexSignature(node) { var index = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, - /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "n" : "s", - /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), + /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "n" : "s", + /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), /*initializer*/ undefined); var indexSignature = ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature(/*modifiers*/ undefined, [index], node.typeArguments[1])]); ts.setEmitFlags(indexSignature, 1 /* EmitFlags.SingleLine */); @@ -153548,8 +154920,8 @@ var ts; return undefined; } var ctorDeclaration = ctorSymbol.valueDeclaration; - if (ts.isFunctionDeclaration(ctorDeclaration)) { - changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunctionDeclaration(ctorDeclaration)); + if (ts.isFunctionDeclaration(ctorDeclaration) || ts.isFunctionExpression(ctorDeclaration)) { + changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunction(ctorDeclaration)); } else if (ts.isVariableDeclaration(ctorDeclaration)) { var classDeclaration = createClassFromVariableDeclaration(ctorDeclaration); @@ -153653,7 +155025,7 @@ var ts; return; } // delete the entire statement if this expression is the sole expression to take care of the semicolon at the end - var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ + var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ ? assignmentBinaryExpression.parent : assignmentBinaryExpression; changes.delete(sourceFile, nodeToDelete); if (!assignmentExpr) { @@ -153705,7 +155077,7 @@ var ts; return createArrowFunctionExpressionMember(members, expression, name); } function createFunctionExpressionMember(members, functionExpression, name) { - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -153716,14 +155088,14 @@ var ts; var arrowFunctionBody = arrowFunction.body; var bodyBlock; // case 1: () => { return [1,2,3] } - if (arrowFunctionBody.kind === 235 /* SyntaxKind.Block */) { + if (arrowFunctionBody.kind === 238 /* SyntaxKind.Block */) { bodyBlock = arrowFunctionBody; } // case 2: () => [1,2,3] else { bodyBlock = ts.factory.createBlock([ts.factory.createReturnStatement(arrowFunctionBody)]); } - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -153746,7 +155118,7 @@ var ts; // Don't call copyComments here because we'll already leave them in place return cls; } - function createClassFromFunctionDeclaration(node) { + function createClassFromFunction(node) { var memberElements = createClassElementsFromSymbol(ctorSymbol); if (node.body) { memberElements.unshift(ts.factory.createConstructorDeclaration(/*modifiers*/ undefined, node.parameters, node.body)); @@ -153836,7 +155208,7 @@ var ts; return; } var pos = ts.skipTrivia(sourceFile.text, ts.moveRangePastModifiers(functionToConvert).pos); - changes.insertModifierAt(sourceFile, pos, 131 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); + changes.insertModifierAt(sourceFile, pos, 132 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); var _loop_12 = function (returnStatement) { ts.forEachChild(returnStatement, function visit(node) { if (ts.isCallExpression(node)) { @@ -154242,7 +155614,7 @@ var ts; case 104 /* SyntaxKind.NullKeyword */: // do not produce a transformed statement for a null argument break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 79 /* SyntaxKind.Identifier */: // identifier includes undefined if (!inputArgName) { // undefined was argument passed to promise handler @@ -154264,8 +155636,8 @@ var ts; continuationArgName.types.push(transformer.checker.getAwaitedType(returnType) || returnType); } return varDeclOrAssignment; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: { + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: { var funcBody = func.body; var returnType_1 = (_a = getLastCallSignature(transformer.checker.getTypeAtLocation(func), transformer.checker)) === null || _a === void 0 ? void 0 : _a.getReturnType(); // Arrow functions with block bodies { } will enter this control flow @@ -154434,7 +155806,7 @@ var ts; name = getMapEntryOrDefault(funcNode.name); } // return undefined argName when arg is null or undefined - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!name || "identifier" in name && name.identifier.text === "undefined") { return undefined; } @@ -154543,10 +155915,10 @@ var ts; } var importNode = ts.importFromModuleSpecifier(moduleSpecifier); switch (importNode.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.replaceNode(importingFile, importNode, ts.makeImport(importNode.name, /*namedImports*/ undefined, moduleSpecifier, quotePreference)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isRequireCall(importNode, /*checkArgumentIsStringLiteralLike*/ false)) { changes.replaceNode(importingFile, importNode, ts.factory.createPropertyAccessExpression(ts.getSynthesizedDeepClone(importNode), "default")); } @@ -154613,20 +155985,20 @@ var ts; } function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, useSitesToUnqualify, quotePreference) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference); return false; - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; switch (expression.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { if (ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true)) { // For side-effecting require() call, just make a side-effecting import. changes.replaceNode(sourceFile, statement, ts.makeImport(/*name*/ undefined, /*namedImports*/ undefined, expression.arguments[0], quotePreference)); } return false; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var operatorToken = expression.operatorToken; return operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports, useSitesToUnqualify); } @@ -154675,8 +156047,8 @@ var ts; /** Converts `const name = require("moduleSpecifier").propertyName` */ function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: { // `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;` var tmp = makeUniqueName(propertyName, identifiers); return convertedImports([ @@ -154727,16 +156099,16 @@ var ts; function tryChangeModuleExportsObject(object, useSitesToUnqualify) { var statements = ts.mapAllOrFail(object.properties, function (prop) { switch (prop.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`. // falls through - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return undefined; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer, useSitesToUnqualify); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)], prop, useSitesToUnqualify); default: ts.Debug.assertNever(prop, "Convert to ES6 got invalid prop kind ".concat(prop.kind)); @@ -154800,7 +156172,7 @@ var ts; function convertExportsDotXEquals_replaceNode(name, exported, useSitesToUnqualify) { var modifiers = [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)]; switch (exported.kind) { - case 213 /* SyntaxKind.FunctionExpression */: { + case 215 /* SyntaxKind.FunctionExpression */: { var expressionName = exported.name; if (expressionName && expressionName.text !== name) { // `exports.f = function g() {}` -> `export const f = function g() {}` @@ -154808,10 +156180,10 @@ var ts; } } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // `exports.f = function() {}` --> `export function f() {}` return functionExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // `exports.C = class {}` --> `export class C {}` return classExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); default: @@ -154831,7 +156203,7 @@ var ts; : ts.getSynthesizedDeepCloneWithReplacements(nodeOrNodes, /*includeTrivia*/ true, replaceNode); function replaceNode(original) { // We are replacing `mod.SomeExport` wih `SomeExport`, so we only need to look at PropertyAccessExpressions - if (original.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (original.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var replacement = useSitesToUnqualify.get(original); // Remove entry from `useSitesToUnqualify` so the refactor knows it's taken care of by the parent statement we're replacing useSitesToUnqualify.delete(original); @@ -154846,7 +156218,7 @@ var ts; */ function convertSingleImport(name, moduleSpecifier, checker, identifiers, target, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { var importSpecifiers = ts.mapAllOrFail(name.elements, function (e) { return e.dotDotDotToken || e.initializer || e.propertyName && !ts.isIdentifier(e.propertyName) || !ts.isIdentifier(e.name) ? undefined @@ -154857,7 +156229,7 @@ var ts; } } // falls through -- object destructuring has an interesting pattern and must be a variable declaration - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 204 /* SyntaxKind.ArrayBindingPattern */: { /* import x from "x"; const [a, b, c] = x; @@ -154950,11 +156322,11 @@ var ts; function isFreeIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return parent.propertyName !== node; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return parent.propertyName !== node; default: return true; @@ -155065,7 +156437,7 @@ var ts; var exportDeclaration = exportClause.parent; var typeExportSpecifiers = getTypeExportSpecifiers(exportSpecifier, context); if (typeExportSpecifiers.length === exportClause.elements.length) { - changes.insertModifierBefore(context.sourceFile, 152 /* SyntaxKind.TypeKeyword */, exportClause); + changes.insertModifierBefore(context.sourceFile, 154 /* SyntaxKind.TypeKeyword */, exportClause); } else { var valueExportDeclaration = ts.factory.updateExportDeclaration(exportDeclaration, exportDeclaration.modifiers, @@ -155301,27 +156673,29 @@ var ts; errorCodes: errorCodes, getCodeActions: function (context) { var errorCode = context.errorCode, preferences = context.preferences, sourceFile = context.sourceFile, span = context.span, program = context.program; - var info = getFixesInfo(context, errorCode, span.start, /*useAutoImportProvider*/ true); + var info = getFixInfos(context, errorCode, span.start, /*useAutoImportProvider*/ true); if (!info) return undefined; - var fixes = info.fixes, symbolName = info.symbolName, errorIdentifierText = info.errorIdentifierText; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - return fixes.map(function (fix) { return codeActionForFix(context, sourceFile, symbolName, fix, - /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); }); + return info.map(function (_a) { + var fix = _a.fix, symbolName = _a.symbolName, errorIdentifierText = _a.errorIdentifierText; + return codeActionForFix(context, sourceFile, symbolName, fix, + /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); + }); }, fixIds: [importFixId], getAllCodeActions: function (context) { - var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host; - var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host); + var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host, cancellationToken = context.cancellationToken; + var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host, cancellationToken); codefix.eachDiagnostic(context, errorCodes, function (diag) { return importAdder.addImportFromDiagnostic(diag, context); }); return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, importAdder.writeFixes)); }, }); - function createImportAdder(sourceFile, program, preferences, host) { - return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host); + function createImportAdder(sourceFile, program, preferences, host, cancellationToken) { + return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host, cancellationToken); } codefix.createImportAdder = createImportAdder; - function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host) { + function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host, cancellationToken) { var compilerOptions = program.getCompilerOptions(); // Namespace fixes don't conflict, so just build a list. var addToNamespace = []; @@ -155332,27 +156706,26 @@ var ts; var newImports = new ts.Map(); return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes }; function addImportFromDiagnostic(diagnostic, context) { - var info = getFixesInfo(context, diagnostic.code, diagnostic.start, useAutoImportProvider); - if (!info || !info.fixes.length) + var info = getFixInfos(context, diagnostic.code, diagnostic.start, useAutoImportProvider); + if (!info || !info.length) return; - addImport(info); + addImport(ts.first(info)); } function addImportFromExportedSymbol(exportedSymbol, isValidTypeOnlyUseSite) { var moduleSymbol = ts.Debug.checkDefined(exportedSymbol.parent); var symbolName = ts.getNameForExportedSymbol(exportedSymbol, ts.getEmitScriptTarget(compilerOptions)); var checker = program.getTypeChecker(); var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker)); - var exportInfo = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider); + var exportInfo = getAllExportInfoForSymbol(sourceFile, symbol, symbolName, /*isJsxTagName*/ false, program, host, preferences, cancellationToken); var useRequire = shouldUseRequire(sourceFile, program); - var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); + var fix = getImportFixForSymbol(sourceFile, ts.Debug.checkDefined(exportInfo), moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); if (fix) { - addImport({ fixes: [fix], symbolName: symbolName, errorIdentifierText: undefined }); + addImport({ fix: fix, symbolName: symbolName, errorIdentifierText: undefined }); } } function addImport(info) { var _a, _b; - var fixes = info.fixes, symbolName = info.symbolName; - var fix = ts.first(fixes); + var fix = info.fix, symbolName = info.symbolName; switch (fix.kind) { case 0 /* ImportFixKind.UseNamespace */: addToNamespace.push(fix); @@ -155519,11 +156892,12 @@ var ts; AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required"; AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed"; })(AddAsTypeOnly || (AddAsTypeOnly = {})); - function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences) { + function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) { var compilerOptions = program.getCompilerOptions(); var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name)) - ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] - : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, isJsxTagName, host, program, preferences, /*useAutoImportProvider*/ true); + ? [getSingleExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] + : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName, isJsxTagName, program, host, preferences, cancellationToken); + ts.Debug.assertIsDefined(exportInfos); var useRequire = shouldUseRequire(sourceFile, program); var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position)); var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, { symbolName: symbolName, position: position }, isValidTypeOnlyUseSite, useRequire, host, preferences)); @@ -155536,7 +156910,7 @@ var ts; codefix.getImportCompletionAction = getImportCompletionAction; function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) { var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions); + var symbolName = ts.single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions)); var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program); var includeSymbolNameInDescription = symbolName !== symbolToken.text; return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* QuotePreference.Double */, compilerOptions)); @@ -155551,7 +156925,16 @@ var ts; var description = _a.description, changes = _a.changes, commands = _a.commands; return { description: description, changes: changes, commands: commands }; } - function getSymbolExportInfoForSymbol(symbol, moduleSymbol, program, host) { + function getAllExportInfoForSymbol(importingFile, symbol, symbolName, preferCapitalized, program, host, preferences, cancellationToken) { + var getChecker = createGetChecker(program, host); + return ts.getExportInfoMap(importingFile, host, program, preferences, cancellationToken) + .search(importingFile.path, preferCapitalized, function (name) { return name === symbolName; }, function (info) { + if (ts.skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol) { + return info; + } + }); + } + function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) { var _a, _b; var compilerOptions = program.getCompilerOptions(); var mainProgramInfo = getInfoWithChecker(program.getTypeChecker(), /*isFromPackageJson*/ false); @@ -155571,35 +156954,6 @@ var ts; } } } - function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, isJsxTagName, host, program, preferences, useAutoImportProvider) { - var result = []; - var compilerOptions = program.getCompilerOptions(); - var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) { - return ts.createModuleSpecifierResolutionHost(isFromPackageJson ? host.getPackageJsonAutoImportProvider() : program, host); - }); - ts.forEachExternalModuleToImportFrom(program, host, preferences, useAutoImportProvider, function (moduleSymbol, moduleFile, program, isFromPackageJson) { - var checker = program.getTypeChecker(); - // Don't import from a re-export when looking "up" like to `./index` or `../index`. - if (moduleFile && moduleSymbol !== exportingModuleSymbol && ts.startsWith(importingFile.fileName, ts.getDirectoryPath(moduleFile.fileName))) { - return; - } - var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions); - if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: defaultInfo.symbol, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: defaultInfo.exportKind, targetFlags: ts.skipAlias(defaultInfo.symbol, checker).flags, isFromPackageJson: isFromPackageJson }); - } - for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) { - var exported = _a[_i]; - if (exported.name === symbolName && checker.getMergedSymbol(ts.skipAlias(exported, checker)) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: exported, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: 0 /* ExportKind.Named */, targetFlags: ts.skipAlias(exported, checker).flags, isFromPackageJson: isFromPackageJson }); - } - } - }); - return result; - function isImportable(program, moduleFile, isFromPackageJson) { - var _a; - return !moduleFile || ts.isImportableFile(program, importingFile, moduleFile, preferences, /*packageJsonFilter*/ undefined, getModuleSpecifierResolutionHost(isFromPackageJson), (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host)); - } - } function getImportFixes(exportInfos, useNamespaceInfo, /** undefined only for missing JSX namespace */ isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap, fromCacheOnly) { @@ -155650,11 +157004,11 @@ var ts; function getTargetModuleFromNamespaceLikeImport(declaration, checker) { var _a; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.resolveExternalModuleName(declaration.initializer.arguments[0]); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checker.getAliasedSymbol(declaration.symbol); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var namespaceImport = ts.tryCast((_a = declaration.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings, ts.isNamespaceImport); return namespaceImport && checker.getAliasedSymbol(namespaceImport.symbol); default: @@ -155664,11 +157018,11 @@ var ts; function getNamespaceLikeImportText(declaration) { var _a, _b, _c; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.tryCast(declaration.name, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return declaration.name.text; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return (_c = ts.tryCast((_b = declaration.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings, ts.isNamespaceImport)) === null || _c === void 0 ? void 0 : _c.name.text; default: return ts.Debug.assertNever(declaration); @@ -155695,12 +157049,12 @@ var ts; function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, compilerOptions) { return ts.firstDefined(existingImports, function (_a) { var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags; - if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // These kinds of imports are not combinable with anything return undefined; } - if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { - return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { + return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? { kind: 2 /* ImportFixKind.AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind: importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* AddAsTypeOnly.NotAllowed */ } : undefined; } @@ -155721,7 +157075,7 @@ var ts; )) return undefined; if (importKind === 0 /* ImportKind.Named */ && - (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 268 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import + (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 271 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import ) return undefined; return { @@ -155744,7 +157098,7 @@ var ts; (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i.parent); } } - else if (i.kind === 266 /* SyntaxKind.ImportDeclaration */ || i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (i.kind === 269 /* SyntaxKind.ImportDeclaration */ || i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); if (moduleSymbol) { (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i); @@ -155793,11 +157147,14 @@ var ts; // 5. Literally nothing to go on return true; } + function createGetChecker(program, host) { + return ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + } function getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfo, host, preferences, fromCacheOnly) { var isJs = ts.isSourceFileJS(sourceFile); var compilerOptions = program.getCompilerOptions(); var moduleSpecifierResolutionHost = ts.createModuleSpecifierResolutionHost(program, host); - var getChecker = ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + var getChecker = createGetChecker(program, host); var rejectNodeModulesRelativePaths = ts.moduleResolutionUsesNodeModules(ts.getEmitModuleResolutionKind(compilerOptions)); var getModuleSpecifiers = fromCacheOnly ? function (moduleSymbol) { return ({ moduleSpecifiers: ts.moduleSpecifiers.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }); } @@ -155841,7 +157198,7 @@ var ts; return { kind: 3 /* ImportFixKind.AddNew */, moduleSpecifier: moduleSpecifier, importKind: importKind, addAsTypeOnly: addAsTypeOnly, useRequire: useRequire }; } } - function getFixesInfo(context, errorCode, pos, useAutoImportProvider) { + function getFixInfos(context, errorCode, pos, useAutoImportProvider) { var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos); var info; if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { @@ -155851,19 +157208,23 @@ var ts; return undefined; } else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) { - var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions()); + var symbolName_1 = ts.single(getSymbolNamesToImport(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions())); var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program); - return fix && { fixes: [fix], symbolName: symbolName_1, errorIdentifierText: symbolToken.text }; + return fix && [{ fix: fix, symbolName: symbolName_1, errorIdentifierText: symbolToken.text }]; } else { info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider); } var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host); - return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter, context.host) }); + return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host); } - function sortFixes(fixes, sourceFile, program, packageJsonImportFilter, host) { + function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host) { var _toPath = function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); }; - return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); }); + return ts.sort(fixes, function (a, b) { + return ts.compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || + ts.compareValues(a.fix.kind, b.fix.kind) || + compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); + }); } function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) { if (!ts.some(fixes)) @@ -155914,7 +157275,6 @@ var ts; return 0 /* Comparison.EqualTo */; } function getFixesInfoForUMDImport(_a, token) { - var _b; var sourceFile = _a.sourceFile, program = _a.program, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var umdSymbol = getUmdSymbol(token, checker); @@ -155926,7 +157286,7 @@ var ts; var useRequire = shouldUseRequire(sourceFile, program); var position = ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined; var fixes = getImportFixes(exportInfo, position ? { position: position, symbolName: symbolName } : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences).fixes; - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: (_b = ts.tryCast(token, ts.isIdentifier)) === null || _b === void 0 ? void 0 : _b.text }; + return fixes.map(function (fix) { var _a; return ({ fix: fix, symbolName: symbolName, errorIdentifierText: (_a = ts.tryCast(token, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text }); }); } function getUmdSymbol(token, checker) { // try the identifier to see if it is the umd symbol @@ -155987,19 +157347,20 @@ var ts; var sourceFile = _a.sourceFile, program = _a.program, cancellationToken = _a.cancellationToken, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, checker, symbolToken, compilerOptions); - // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. - if (symbolName === "default" /* InternalSymbolName.Default */) { - return undefined; - } - var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); - var useRequire = shouldUseRequire(sourceFile, program); - var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); - var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { - var _ = _a[0], exportInfos = _a[1]; - return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; - })); - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: symbolToken.text }; + return ts.flatMap(getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions), function (symbolName) { + // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. + if (symbolName === "default" /* InternalSymbolName.Default */) { + return undefined; + } + var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); + var useRequire = shouldUseRequire(sourceFile, program); + var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); + var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { + var _ = _a[0], exportInfos = _a[1]; + return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; + })); + return fixes.map(function (fix) { return ({ fix: fix, symbolName: symbolName, errorIdentifierText: symbolToken.text, isJsxNamespaceFix: symbolName !== symbolToken.text }); }); + }); } function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) { var checker = program.getTypeChecker(); @@ -156011,15 +157372,16 @@ var ts; return undefined; return { kind: 4 /* ImportFixKind.PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration }; } - function getSymbolName(sourceFile, checker, symbolToken, compilerOptions) { + function getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions) { var parent = symbolToken.parent; if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && ts.jsxModeNeedsExplicitImport(compilerOptions.jsx)) { var jsxNamespace = checker.getJsxNamespace(sourceFile); if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) { - return jsxNamespace; + var needsComponentNameFix = !ts.isIntrinsicJsxName(symbolToken.text) && !checker.resolveName(symbolToken.text, symbolToken, 111551 /* SymbolFlags.Value */, /*excludeGlobals*/ false); + return needsComponentNameFix ? [symbolToken.text, jsxNamespace] : [jsxNamespace]; } } - return symbolToken.text; + return [symbolToken.text]; } function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) { if (ts.isIntrinsicJsxName(symbolToken.text)) @@ -156128,7 +157490,7 @@ var ts; case 4 /* ImportFixKind.PromoteTypeOnly */: { var typeOnlyAliasDeclaration = fix.typeOnlyAliasDeclaration; var promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile); - return promotedDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ + return promotedDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ ? [ts.Diagnostics.Remove_type_from_import_of_0_from_1, symbolName, getModuleSpecifierText(promotedDeclaration.parent.parent)] : [ts.Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)]; } @@ -156138,7 +157500,7 @@ var ts; } function getModuleSpecifierText(promotedDeclaration) { var _a, _b; - return promotedDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ + return promotedDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? ((_b = ts.tryCast((_a = ts.tryCast(promotedDeclaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression, ts.isStringLiteralLike)) === null || _b === void 0 ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : ts.cast(promotedDeclaration.parent.moduleSpecifier, ts.isStringLiteral).text; } @@ -156146,7 +157508,7 @@ var ts; // See comment in `doAddExistingFix` on constant with the same name. var convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules; switch (aliasDeclaration.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: if (aliasDeclaration.isTypeOnly) { if (aliasDeclaration.parent.elements.length > 1 && ts.OrganizeImports.importSpecifiersAreSorted(aliasDeclaration.parent.elements)) { changes.delete(sourceFile, aliasDeclaration); @@ -156164,13 +157526,13 @@ var ts; promoteImportClause(aliasDeclaration.parent.parent); return aliasDeclaration.parent.parent; } - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: promoteImportClause(aliasDeclaration); return aliasDeclaration; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: promoteImportClause(aliasDeclaration.parent); return aliasDeclaration.parent; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.deleteRange(sourceFile, aliasDeclaration.getChildAt(1)); return aliasDeclaration; default: @@ -156182,7 +157544,7 @@ var ts; var namedImports = ts.tryCast(importClause.namedBindings, ts.isNamedImports); if (namedImports && namedImports.elements.length > 1) { if (ts.OrganizeImports.importSpecifiersAreSorted(namedImports.elements) && - aliasDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && + aliasDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && namedImports.elements.indexOf(aliasDeclaration) !== 0) { // The import specifier being promoted will be the only non-type-only, // import in the NamedImports, so it should be moved to the front. @@ -156192,7 +157554,7 @@ var ts; for (var _i = 0, _a = namedImports.elements; _i < _a.length; _i++) { var element = _a[_i]; if (element !== aliasDeclaration && !element.isTypeOnly) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, element); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, element); } } } @@ -156201,7 +157563,7 @@ var ts; } function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, compilerOptions) { var _a; - if (clause.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (clause.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (defaultImport) { addElementToBindingPattern(clause, defaultImport.name, "default"); } @@ -156262,7 +157624,7 @@ var ts; if (convertExistingToTypeOnly && existingSpecifiers) { for (var _d = 0, existingSpecifiers_1 = existingSpecifiers; _d < existingSpecifiers_1.length; _d++) { var specifier = existingSpecifiers_1[_d]; - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, specifier); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, specifier); } } } @@ -156437,7 +157799,7 @@ var ts; var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; }); if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) return; - var declaration = findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + var declaration = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); if (declaration === undefined) return; if (ts.isIdentifier(declaration) && ts.isTypeParameterDeclaration(declaration.parent)) { @@ -156471,14 +157833,6 @@ var ts; } } } - function findAncestorMatchingSpan(sourceFile, span) { - var end = ts.textSpanEnd(span); - var token = ts.getTokenAtPosition(sourceFile, span.start); - while (token.end < end) { - token = token.parent; - } - return token; - } function tryGetConstraintFromDiagnosticMessage(messageText) { var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/`extends (.*)`/) || [], _ = _a[0], constraint = _a[1]; return constraint; @@ -156622,7 +157976,7 @@ var ts; accessibilityModifier ? accessibilityModifier.end : lastDecorator ? ts.skipTrivia(sourceFile.text, lastDecorator.end) : classElement.getStart(sourceFile); var options = accessibilityModifier || staticModifier || abstractModifier ? { prefix: " " } : { suffix: " " }; - changeTracker.insertModifierAt(sourceFile, modifierPos, 159 /* SyntaxKind.OverrideKeyword */, options); + changeTracker.insertModifierAt(sourceFile, modifierPos, 161 /* SyntaxKind.OverrideKeyword */, options); } function doRemoveOverrideModifierChange(changeTracker, sourceFile, pos) { var classElement = findContainerClassElementLike(sourceFile, pos); @@ -156636,13 +157990,13 @@ var ts; } function isClassElementLikeHasJSDoc(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.isParameterPropertyDeclaration(node, node.parent); default: return false; @@ -156754,6 +158108,143 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + var fixId = "fixImportNonExportedMember"; + var errorCodes = [ + ts.Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported.code, + ]; + codefix.registerCodeFix({ + errorCodes: errorCodes, + fixIds: [fixId], + getCodeActions: function (context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getInfo(sourceFile, span.start, program); + if (info === undefined) + return undefined; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, program, info); }); + return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId, ts.Diagnostics.Export_all_referenced_locals)]; + }, + getAllCodeActions: function (context) { + var program = context.program; + return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) { + var exports = new ts.Map(); + codefix.eachDiagnostic(context, errorCodes, function (diag) { + var info = getInfo(diag.file, diag.start, program); + if (info === undefined) + return undefined; + var exportName = info.exportName, node = info.node, moduleSourceFile = info.moduleSourceFile; + if (tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly) === undefined && ts.canHaveExportModifier(node)) { + changes.insertExportModifier(moduleSourceFile, node); + } + else { + var moduleExports = exports.get(moduleSourceFile) || { typeOnlyExports: [], exports: [] }; + if (exportName.isTypeOnly) { + moduleExports.typeOnlyExports.push(exportName); + } + else { + moduleExports.exports.push(exportName); + } + exports.set(moduleSourceFile, moduleExports); + } + }); + exports.forEach(function (moduleExports, moduleSourceFile) { + var exportDeclaration = tryGetExportDeclaration(moduleSourceFile, /*isTypeOnly*/ true); + if (exportDeclaration && exportDeclaration.isTypeOnly) { + doChanges(changes, program, moduleSourceFile, moduleExports.typeOnlyExports, exportDeclaration); + doChanges(changes, program, moduleSourceFile, moduleExports.exports, tryGetExportDeclaration(moduleSourceFile, /*isTypeOnly*/ false)); + } + else { + doChanges(changes, program, moduleSourceFile, __spreadArray(__spreadArray([], moduleExports.exports, true), moduleExports.typeOnlyExports, true), exportDeclaration); + } + }); + })); + } + }); + function getInfo(sourceFile, pos, program) { + var _a; + var token = ts.getTokenAtPosition(sourceFile, pos); + if (ts.isIdentifier(token)) { + var importDeclaration = ts.findAncestor(token, ts.isImportDeclaration); + if (importDeclaration === undefined) + return undefined; + var moduleSpecifier = ts.isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : undefined; + if (moduleSpecifier === undefined) + return undefined; + var resolvedModule = ts.getResolvedModule(sourceFile, moduleSpecifier, /*mode*/ undefined); + if (resolvedModule === undefined) + return undefined; + var moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName); + if (moduleSourceFile === undefined || ts.isSourceFileFromLibrary(program, moduleSourceFile)) + return undefined; + var moduleSymbol = moduleSourceFile.symbol; + var locals = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals; + if (locals === undefined) + return undefined; + var localSymbol = locals.get(token.escapedText); + if (localSymbol === undefined) + return undefined; + var node = getNodeOfSymbol(localSymbol); + if (node === undefined) + return undefined; + var exportName = { node: token, isTypeOnly: ts.isTypeDeclaration(node) }; + return { exportName: exportName, node: node, moduleSourceFile: moduleSourceFile, moduleSpecifier: moduleSpecifier }; + } + return undefined; + } + function doChange(changes, program, _a) { + var exportName = _a.exportName, node = _a.node, moduleSourceFile = _a.moduleSourceFile; + var exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly); + if (exportDeclaration) { + updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]); + } + else if (ts.canHaveExportModifier(node)) { + changes.insertExportModifier(moduleSourceFile, node); + } + else { + createExport(changes, program, moduleSourceFile, [exportName]); + } + } + function doChanges(changes, program, sourceFile, moduleExports, node) { + if (ts.length(moduleExports)) { + if (node) { + updateExport(changes, program, sourceFile, node, moduleExports); + } + else { + createExport(changes, program, sourceFile, moduleExports); + } + } + } + function tryGetExportDeclaration(sourceFile, isTypeOnly) { + var predicate = function (node) { + return ts.isExportDeclaration(node) && (isTypeOnly && node.isTypeOnly || !node.isTypeOnly); + }; + return ts.findLast(sourceFile.statements, predicate); + } + function updateExport(changes, program, sourceFile, node, names) { + var namedExports = node.exportClause && ts.isNamedExports(node.exportClause) ? node.exportClause.elements : ts.factory.createNodeArray([]); + var allowTypeModifier = !node.isTypeOnly && !!(program.getCompilerOptions().isolatedModules || ts.find(namedExports, function (e) { return e.isTypeOnly; })); + changes.replaceNode(sourceFile, node, ts.factory.updateExportDeclaration(node, node.modifiers, node.isTypeOnly, ts.factory.createNamedExports(ts.factory.createNodeArray(__spreadArray(__spreadArray([], namedExports, true), createExportSpecifiers(names, allowTypeModifier), true), /*hasTrailingComma*/ namedExports.hasTrailingComma)), node.moduleSpecifier, node.assertClause)); + } + function createExport(changes, program, sourceFile, names) { + changes.insertNodeAtEndOfScope(sourceFile, sourceFile, ts.factory.createExportDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamedExports(createExportSpecifiers(names, /*allowTypeModifier*/ !!program.getCompilerOptions().isolatedModules)), /*moduleSpecifier*/ undefined, /*assertClause*/ undefined)); + } + function createExportSpecifiers(names, allowTypeModifier) { + return ts.factory.createNodeArray(ts.map(names, function (n) { return ts.factory.createExportSpecifier(allowTypeModifier && n.isTypeOnly, /*propertyName*/ undefined, n.node); })); + } + function getNodeOfSymbol(symbol) { + if (symbol.valueDeclaration === undefined) { + return ts.firstOrUndefined(symbol.declarations); + } + var declaration = symbol.valueDeclaration; + var variableStatement = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : undefined; + return variableStatement && ts.length(variableStatement.declarationList.declarations) === 1 ? variableStatement : declaration; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -156774,7 +158265,7 @@ var ts; }); function getNamedTupleMember(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); - return ts.findAncestor(token, function (t) { return t.kind === 197 /* SyntaxKind.NamedTupleMember */; }); + return ts.findAncestor(token, function (t) { return t.kind === 199 /* SyntaxKind.NamedTupleMember */; }); } function doChange(changes, sourceFile, namedTupleMember) { if (!namedTupleMember) { @@ -156783,11 +158274,11 @@ var ts; var unwrappedType = namedTupleMember.type; var sawOptional = false; var sawRest = false; - while (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 186 /* SyntaxKind.RestType */ || unwrappedType.kind === 191 /* SyntaxKind.ParenthesizedType */) { - if (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */) { + while (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 188 /* SyntaxKind.RestType */ || unwrappedType.kind === 193 /* SyntaxKind.ParenthesizedType */) { + if (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */) { sawOptional = true; } - else if (unwrappedType.kind === 186 /* SyntaxKind.RestType */) { + else if (unwrappedType.kind === 188 /* SyntaxKind.RestType */) { sawRest = true; } unwrappedType = unwrappedType.type; @@ -157058,7 +158549,7 @@ var ts; if (isFunctionType) { var sig = checker.getSignatureFromDeclaration(declaration); if (sig) { - if (ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Async */)) { + if (ts.hasSyntacticModifier(declaration, 512 /* ModifierFlags.Async */)) { exprType = checker.createPromiseType(exprType); } var newSig = checker.createSignature(declaration, sig.typeParameters, sig.thisParameter, sig.parameters, exprType, @@ -157102,19 +158593,19 @@ var ts; } function getVariableLikeInitializer(declaration) { switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: return declaration.initializer; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return declaration.initializer && (ts.isJsxExpression(declaration.initializer) ? declaration.initializer.expression : undefined); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return undefined; } } @@ -157168,6 +158659,15 @@ var ts; ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code, ts.Diagnostics.Cannot_find_name_0.code ]; + var InfoKind; + (function (InfoKind) { + InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; + InfoKind[InfoKind["Enum"] = 1] = "Enum"; + InfoKind[InfoKind["Function"] = 2] = "Function"; + InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; + InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; + InfoKind[InfoKind["Signature"] = 5] = "Signature"; + })(InfoKind || (InfoKind = {})); codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { @@ -157176,19 +158676,19 @@ var ts; if (!info) { return undefined; } - if (info.kind === 3 /* InfoKind.ObjectLiteral */) { + if (info.kind === InfoKind.ObjectLiteral) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addObjectLiteralProperties(t, context, info); }); return [codefix.createCodeFixAction(fixMissingProperties, changes, ts.Diagnostics.Add_missing_properties, fixMissingProperties, ts.Diagnostics.Add_all_missing_properties)]; } - if (info.kind === 4 /* InfoKind.JsxAttributes */) { + if (info.kind === InfoKind.JsxAttributes) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addJsxAttributes(t, context, info); }); return [codefix.createCodeFixAction(fixMissingAttributes, changes, ts.Diagnostics.Add_missing_attributes, fixMissingAttributes, ts.Diagnostics.Add_all_missing_attributes)]; } - if (info.kind === 2 /* InfoKind.Function */) { + if (info.kind === InfoKind.Function || info.kind === InfoKind.Signature) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addFunctionDeclaration(t, context, info); }); return [codefix.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts.Diagnostics.Add_all_missing_function_declarations)]; } - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addEnumMemberDeclaration(t, context.program.getTypeChecker(), info); }); return [codefix.createCodeFixAction(fixMissingMember, changes, [ts.Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members)]; } @@ -157206,20 +158706,20 @@ var ts; if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) { return; } - if (fixId === fixMissingFunctionDeclaration && info.kind === 2 /* InfoKind.Function */) { + if (fixId === fixMissingFunctionDeclaration && (info.kind === InfoKind.Function || info.kind === InfoKind.Signature)) { addFunctionDeclaration(changes, context, info); } - else if (fixId === fixMissingProperties && info.kind === 3 /* InfoKind.ObjectLiteral */) { + else if (fixId === fixMissingProperties && info.kind === InfoKind.ObjectLiteral) { addObjectLiteralProperties(changes, context, info); } - else if (fixId === fixMissingAttributes && info.kind === 4 /* InfoKind.JsxAttributes */) { + else if (fixId === fixMissingAttributes && info.kind === InfoKind.JsxAttributes) { addJsxAttributes(changes, context, info); } else { - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { addEnumMemberDeclaration(changes, checker, info); } - if (info.kind === 0 /* InfoKind.TypeLikeDeclaration */) { + if (info.kind === InfoKind.TypeLikeDeclaration) { var parentDeclaration = info.parentDeclaration, token_1 = info.token; var infos = ts.getOrUpdate(typeDeclToMembers, parentDeclaration, function () { return []; }); if (!infos.some(function (i) { return i.token.text === token_1.text; })) { @@ -157263,14 +158763,6 @@ var ts; })); }, }); - var InfoKind; - (function (InfoKind) { - InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; - InfoKind[InfoKind["Enum"] = 1] = "Enum"; - InfoKind[InfoKind["Function"] = 2] = "Function"; - InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; - InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; - })(InfoKind || (InfoKind = {})); function getInfo(sourceFile, tokenPos, errorCode, checker, program) { // The identifier of the missing property. eg: // this.missing = 1; @@ -157283,7 +158775,7 @@ var ts; var argIndex = ts.findIndex(parent.parent.arguments, function (arg) { return arg === parent; }); if (argIndex < 0) return undefined; - var signature = ts.singleOrUndefined(checker.getSignaturesOfType(checker.getTypeAtLocation(parent.parent.expression), 0 /* SignatureKind.Call */)); + var signature = checker.getResolvedSignature(parent.parent); if (!(signature && signature.declaration && signature.parameters[argIndex])) return undefined; var param = signature.parameters[argIndex].valueDeclaration; @@ -157292,7 +158784,7 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getParameterType(signature, argIndex), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: param.name, properties: properties, parentDeclaration: parent }; + return { kind: InfoKind.ObjectLiteral, token: param.name, properties: properties, parentDeclaration: parent }; } if (!ts.isMemberName(token)) return undefined; @@ -157300,17 +158792,26 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent.initializer), checker.getTypeAtLocation(token), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: token, properties: properties, parentDeclaration: parent.initializer }; + return { kind: InfoKind.ObjectLiteral, token: token, properties: properties, parentDeclaration: parent.initializer }; } if (ts.isIdentifier(token) && ts.isJsxOpeningLikeElement(token.parent)) { var target = ts.getEmitScriptTarget(program.getCompilerOptions()); var attributes = getUnmatchedAttributes(checker, target, token.parent); if (!ts.length(attributes)) return undefined; - return { kind: 4 /* InfoKind.JsxAttributes */, token: token, attributes: attributes, parentDeclaration: token.parent }; + return { kind: InfoKind.JsxAttributes, token: token, attributes: attributes, parentDeclaration: token.parent }; } - if (ts.isIdentifier(token) && ts.isCallExpression(parent) && parent.expression === token) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: sourceFile }; + if (ts.isIdentifier(token)) { + var type = checker.getContextualType(token); + if (type && ts.getObjectFlags(type) & 16 /* ObjectFlags.Anonymous */) { + var signature = ts.firstOrUndefined(checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */)); + if (signature === undefined) + return undefined; + return { kind: InfoKind.Signature, token: token, signature: signature, sourceFile: sourceFile, parentDeclaration: findScope(token) }; + } + if (ts.isCallExpression(parent) && parent.expression === token) { + return { kind: InfoKind.Function, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: findScope(token) }; + } } if (!ts.isPropertyAccessExpression(parent)) return undefined; @@ -157321,14 +158822,14 @@ var ts; if (ts.isIdentifier(token) && ts.isCallExpression(parent.parent)) { var moduleDeclaration = ts.find(symbol.declarations, ts.isModuleDeclaration); var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile(); - if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; + if (moduleDeclaration && moduleDeclarationSourceFile && !ts.isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) { + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; } var moduleSourceFile = ts.find(symbol.declarations, ts.isSourceFile); if (sourceFile.commonJsModuleIndicator) return undefined; - if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; + if (moduleSourceFile && !ts.isSourceFileFromLibrary(program, moduleSourceFile)) { + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; } } var classDeclaration = ts.find(symbol.declarations, ts.isClassLike); @@ -157337,7 +158838,7 @@ var ts; return undefined; // Prefer to change the class instead of the interface if they are merged var declaration = classDeclaration || ts.find(symbol.declarations, function (d) { return ts.isInterfaceDeclaration(d) || ts.isTypeLiteralNode(d); }); - if (declaration && !isSourceFileFromLibrary(program, declaration.getSourceFile())) { + if (declaration && !ts.isSourceFileFromLibrary(program, declaration.getSourceFile())) { var makeStatic = !ts.isTypeLiteralNode(declaration) && (leftExpressionType.target || leftExpressionType) !== checker.getDeclaredTypeOfSymbol(symbol); if (makeStatic && (ts.isPrivateIdentifier(token) || ts.isInterfaceDeclaration(declaration))) return undefined; @@ -157346,17 +158847,14 @@ var ts; (makeStatic ? 32 /* ModifierFlags.Static */ : 0 /* ModifierFlags.None */) | (ts.startsWithUnderscore(token.text) ? 8 /* ModifierFlags.Private */ : 0 /* ModifierFlags.None */); var isJSFile = ts.isSourceFileJS(declSourceFile); var call = ts.tryCast(parent.parent, ts.isCallExpression); - return { kind: 0 /* InfoKind.TypeLikeDeclaration */, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; + return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; } var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration); - if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { - return { kind: 1 /* InfoKind.Enum */, token: token, parentDeclaration: enumDeclaration }; + if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !ts.isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { + return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration }; } return undefined; } - function isSourceFileFromLibrary(program, node) { - return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node); - } function getActionsForMissingMemberDeclaration(context, info) { return info.isJSFile ? ts.singleElementArray(createActionForAddMissingMemberInJavascriptFile(context, info)) : createActionsForAddMissingMemberInTypeScriptFile(context, info); @@ -157377,7 +158875,7 @@ var ts; function addMissingMemberInJs(changeTracker, sourceFile, classDeclaration, token, makeStatic) { var tokenName = token.text; if (makeStatic) { - if (classDeclaration.kind === 226 /* SyntaxKind.ClassExpression */) { + if (classDeclaration.kind === 228 /* SyntaxKind.ClassExpression */) { return; } var className = classDeclaration.name.getText(); @@ -157428,7 +158926,7 @@ var ts; } function getTypeNode(checker, node, token) { var typeNode; - if (token.parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (token.parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var binaryExpression = token.parent.parent; var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left; var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression))); @@ -157438,7 +158936,7 @@ var ts; var contextualType = checker.getContextualType(token.parent); typeNode = contextualType ? checker.typeToTypeNode(contextualType, /*enclosingDeclaration*/ undefined, 1 /* NodeBuilderFlags.NoTruncation */) : undefined; } - return typeNode || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return typeNode || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function addPropertyDeclaration(changeTracker, sourceFile, node, tokenName, typeNode, modifierFlags) { var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; @@ -157466,7 +158964,7 @@ var ts; } function createAddIndexSignatureAction(context, sourceFile, node, tokenName, typeNode) { // Index signatures cannot have the static modifier. - var stringTypeNode = ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + var stringTypeNode = ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); var indexingParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "x", @@ -157497,7 +158995,7 @@ var ts; } function addMethodDeclaration(context, changes, callExpression, name, modifierFlags, parentDeclaration, sourceFile) { var importAdder = codefix.createImportAdder(sourceFile, context.program, context.preferences, context.host); - var kind = ts.isClassLike(parentDeclaration) ? 169 /* SyntaxKind.MethodDeclaration */ : 168 /* SyntaxKind.MethodSignature */; + var kind = ts.isClassLike(parentDeclaration) ? 171 /* SyntaxKind.MethodDeclaration */ : 170 /* SyntaxKind.MethodSignature */; var signatureDeclaration = codefix.createSignatureDeclarationFromCallExpression(kind, context, importAdder, callExpression, name, modifierFlags, parentDeclaration); var containingMethodDeclaration = tryGetContainingMethodDeclaration(parentDeclaration, callExpression); if (containingMethodDeclaration) { @@ -157526,9 +159024,17 @@ var ts; }); } function addFunctionDeclaration(changes, context, info) { + var quotePreference = ts.getQuotePreference(context.sourceFile, context.preferences); var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host); - var functionDeclaration = codefix.createSignatureDeclarationFromCallExpression(256 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration); - changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); + var functionDeclaration = info.kind === InfoKind.Function + ? codefix.createSignatureDeclarationFromCallExpression(259 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration) + : codefix.createSignatureDeclarationFromSignature(259 /* SyntaxKind.FunctionDeclaration */, context, quotePreference, info.signature, codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), info.token, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ undefined, importAdder); + if (functionDeclaration === undefined) { + ts.Debug.fail("fixMissingFunctionDeclaration codefix got unexpected error."); + } + ts.isReturnStatement(info.parentDeclaration) + ? changes.insertNodeBefore(info.sourceFile, info.parentDeclaration, functionDeclaration, /*blankLineBetween*/ true) + : changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); importAdder.writeFixes(changes); } function addJsxAttributes(changes, context, info) { @@ -157624,7 +159130,7 @@ var ts; var signature = checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */); if (signature === undefined) return createUndefined(); - var func = codefix.createSignatureDeclarationFromSignature(213 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); + var func = codefix.createSignatureDeclarationFromSignature(215 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); return func !== null && func !== void 0 ? func : createUndefined(); } if (ts.getObjectFlags(type) & 1 /* ObjectFlags.Class */) { @@ -157678,14 +159184,21 @@ var ts; return declaration && declaration.parent === node ? declaration : undefined; } function createPropertyNameFromSymbol(symbol, target, quotePreference, checker) { - if (ts.isTransientSymbol(symbol) && symbol.nameType && symbol.nameType.flags & 8192 /* TypeFlags.UniqueESSymbol */) { - var expression = checker.symbolToExpression(symbol.nameType.symbol, 111551 /* SymbolFlags.Value */, symbol.valueDeclaration, 1048576 /* NodeBuilderFlags.AllowUniqueESSymbolType */); - if (expression) { - return ts.factory.createComputedPropertyName(expression); - } + if (ts.isTransientSymbol(symbol)) { + var prop = checker.symbolToNode(symbol, 111551 /* SymbolFlags.Value */, /*enclosingDeclaration*/ undefined, 1073741824 /* NodeBuilderFlags.WriteComputedProps */); + if (prop && ts.isComputedPropertyName(prop)) + return prop; } return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* QuotePreference.Single */); } + function findScope(node) { + if (ts.findAncestor(node, ts.isJsxExpression)) { + var returnStatement = ts.findAncestor(node.parent, ts.isReturnStatement); + if (returnStatement) + return returnStatement; + } + return ts.getSourceFileOfNode(node); + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -157836,7 +159349,7 @@ var ts; // See `codeFixClassExtendAbstractProtectedProperty.ts` in https://github.com/Microsoft/TypeScript/pull/11547/files // (now named `codeFixClassExtendAbstractPrivateProperty.ts`) var flags = ts.getSyntacticModifierFlags(ts.first(symbol.getDeclarations())); - return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 128 /* ModifierFlags.Abstract */); + return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 256 /* ModifierFlags.Abstract */); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -157999,6 +159512,63 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + var fixId = "fixNaNEquality"; + var errorCodes = [ + ts.Diagnostics.This_condition_will_always_return_0.code, + ]; + codefix.registerCodeFix({ + errorCodes: errorCodes, + getCodeActions: function (context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getInfo(program, sourceFile, span); + if (info === undefined) + return; + var suggestion = info.suggestion, expression = info.expression, arg = info.arg; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, arg, expression); }); + return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Use_0, suggestion], fixId, ts.Diagnostics.Use_Number_isNaN_in_all_conditions)]; + }, + fixIds: [fixId], + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(context.program, diag.file, ts.createTextSpan(diag.start, diag.length)); + if (info) { + doChange(changes, diag.file, info.arg, info.expression); + } + }); + } + }); + function getInfo(program, sourceFile, span) { + var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; }); + if (diag === undefined || diag.relatedInformation === undefined) + return; + var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.Did_you_mean_0.code; }); + if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) + return; + var token = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + if (token === undefined) + return; + if (ts.isExpression(token) && ts.isBinaryExpression(token.parent)) { + return { suggestion: getSuggestion(related.messageText), expression: token.parent, arg: token }; + } + return undefined; + } + function doChange(changes, sourceFile, arg, expression) { + var callExpression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("Number"), ts.factory.createIdentifier("isNaN")), /*typeArguments*/ undefined, [arg]); + var operator = expression.operatorToken.kind; + changes.replaceNode(sourceFile, expression, operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ + ? ts.factory.createPrefixUnaryExpression(53 /* SyntaxKind.ExclamationToken */, callExpression) : callExpression); + } + function getSuggestion(messageText) { + var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [], _ = _a[0], suggestion = _a[1]; + return suggestion; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -158316,7 +159886,7 @@ var ts; var importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start); if (!importDeclaration) return; - var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); + var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); var typeOnlyChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program); }); var actions; if (namespaceChanges.length) { @@ -158331,7 +159901,7 @@ var ts; }); function getImportDeclaration(sourceFile, program, start) { var identifier = ts.tryCast(ts.getTokenAtPosition(sourceFile, start), ts.isIdentifier); - if (!identifier || identifier.parent.kind !== 178 /* SyntaxKind.TypeReference */) + if (!identifier || identifier.parent.kind !== 180 /* SyntaxKind.TypeReference */) return; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(identifier); @@ -158343,11 +159913,11 @@ var ts; // new type-only import declaration, but honestly I doubt anyone will ever use this // codefix at all, so it's probably not worth the lines of code. function doTypeOnlyImportChange(changes, sourceFile, importDeclaration, program) { - if (importDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importDeclaration.name); + if (importDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importDeclaration.name); return; } - var importClause = importDeclaration.kind === 267 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; + var importClause = importDeclaration.kind === 270 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; if (importClause.name && importClause.namedBindings) { // Cannot convert an import with a default import and named bindings to type-only // (it's a grammar error). @@ -158364,7 +159934,7 @@ var ts; // Don't convert it to type-only. return; } - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importClause); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importClause); } function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) { ts.refactor.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent); @@ -158442,7 +160012,7 @@ var ts; ]; } var result = []; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return changeInferToUnknown(t, sourceFile, token); }); var name = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name.text; result.push(codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Replace_infer_0_with_unknown, name], fixIdInfer, ts.Diagnostics.Replace_all_unused_infer_with_unknown)); @@ -158484,7 +160054,7 @@ var ts; break; } case fixIdDelete: { - if (token.kind === 137 /* SyntaxKind.InferKeyword */ || isImport(token)) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */ || isImport(token)) { break; // Can't delete } else if (ts.isJSDocTemplateTag(token)) { @@ -158513,7 +160083,7 @@ var ts; break; } case fixIdInfer: - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { changeInferToUnknown(changes, sourceFile, token); } break; @@ -158524,7 +160094,7 @@ var ts; }, }); function changeInferToUnknown(changes, sourceFile, token) { - changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)); + changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)); } function createDeleteFix(changes, diag) { return codefix.createCodeFixAction(fixName, changes, diag, fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations); @@ -158534,7 +160104,7 @@ var ts; } function isImport(token) { return token.kind === 100 /* SyntaxKind.ImportKeyword */ - || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 270 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 267 /* SyntaxKind.ImportClause */); + || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 273 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 270 /* SyntaxKind.ImportClause */); } /** Sometimes the diagnostic span is an entire ImportDeclaration, so we should remove the whole thing. */ function tryGetFullImport(token) { @@ -158544,7 +160114,7 @@ var ts; return ts.isVariableDeclarationList(token.parent) && ts.first(token.parent.getChildren(sourceFile)) === token; } function deleteEntireVariableStatement(changes, sourceFile, node) { - changes.delete(sourceFile, node.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? node.parent : node); + changes.delete(sourceFile, node.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? node.parent : node); } function deleteDestructuringElements(changes, sourceFile, node) { ts.forEach(node.elements, function (n) { return changes.delete(sourceFile, n); }); @@ -158553,7 +160123,7 @@ var ts; // Don't offer to prefix a property. if (errorCode === ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code) return; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { token = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name; } if (ts.isIdentifier(token) && canPrefix(token)) { @@ -158569,14 +160139,14 @@ var ts; } function canPrefix(token) { switch (token.parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var varDecl = token.parent; switch (varDecl.parent.parent.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return true; } } @@ -158631,8 +160201,8 @@ var ts; function mayDeleteParameter(checker, sourceFile, parameter, sourceFiles, program, cancellationToken, isFixAll) { var parent = parameter.parent; switch (parent.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: var index = parent.parameters.indexOf(parameter); var referent = ts.isMethodDeclaration(parent) ? parent.name : parent; var entries = ts.FindAllReferences.Core.getReferencedSymbolsForNode(parent.pos, referent, program, sourceFiles, cancellationToken); @@ -158662,20 +160232,20 @@ var ts; } } return true; - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { if (parent.name && isCallbackLike(checker, sourceFile, parent.name)) { return isLastParameter(parent, parameter, isFixAll); } return true; } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: // Can't remove a non-last parameter in a callback. Can remove a parameter in code-fix-all if future parameters are also unused. return isLastParameter(parent, parameter, isFixAll); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Setter must have a parameter return false; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Getter cannot have parameters return true; default: @@ -158736,7 +160306,7 @@ var ts; var container = (ts.isBlock(statement.parent) ? statement.parent : statement).parent; if (!ts.isBlock(statement.parent) || statement === ts.first(statement.parent.statements)) { switch (container.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (container.elseStatement) { if (ts.isBlock(statement.parent)) { break; @@ -158747,8 +160317,8 @@ var ts; return; } // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: changes.delete(sourceFile, container); return; } @@ -158821,7 +160391,7 @@ var ts; var typeNode = info.typeNode, type = info.type; var original = typeNode.getText(sourceFile); var actions = [fix(type, fixIdPlain, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)]; - if (typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */) { + if (typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */) { // for nullable types, suggest the flow-compatible `T | null | undefined` // in addition to the jsdoc/closure-compatible `T | null` actions.push(fix(checker.getNullableType(type, 32768 /* TypeFlags.Undefined */), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)); @@ -158841,7 +160411,7 @@ var ts; if (!info) return; var typeNode = info.typeNode, type = info.type; - var fixedType = typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; + var fixedType = typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; doChange(changes, sourceFile, typeNode, fixedType, checker); }); } @@ -158858,22 +160428,22 @@ var ts; // NOTE: Some locations are not handled yet: // MappedTypeNode.typeParameters and SignatureDeclaration.typeParameters, as well as CallExpression.typeArguments switch (node.kind) { - case 229 /* SyntaxKind.AsExpression */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 176 /* SyntaxKind.IndexSignature */: - case 195 /* SyntaxKind.MappedType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 231 /* SyntaxKind.AsExpression */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 178 /* SyntaxKind.IndexSignature */: + case 197 /* SyntaxKind.MappedType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; default: return false; @@ -158976,14 +160546,14 @@ var ts; } var insertBefore; switch (containingFunction.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: insertBefore = containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: insertBefore = ts.findChildOfKind(containingFunction, 98 /* SyntaxKind.FunctionKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: var kind = containingFunction.typeParameters ? 29 /* SyntaxKind.LessThanToken */ : 20 /* SyntaxKind.OpenParenToken */; insertBefore = ts.findChildOfKind(containingFunction, kind, sourceFile) || ts.first(containingFunction.parameters); break; @@ -159003,7 +160573,7 @@ var ts; changes.replaceNode(sourceFile, returnType, ts.factory.createTypeReferenceNode("Promise", ts.factory.createNodeArray([returnType]))); } } - changes.insertModifierBefore(sourceFile, 131 /* SyntaxKind.AsyncKeyword */, insertBefore); + changes.insertModifierBefore(sourceFile, 132 /* SyntaxKind.AsyncKeyword */, insertBefore); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -159319,7 +160889,7 @@ var ts; function annotate(changes, importAdder, sourceFile, declaration, type, program, host) { var typeNode = ts.getTypeNodeIfAccessible(type, declaration, program, host); if (typeNode) { - if (ts.isInJSFile(sourceFile) && declaration.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (ts.isInJSFile(sourceFile) && declaration.kind !== 168 /* SyntaxKind.PropertySignature */) { var parent = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : declaration; if (!parent) { return; @@ -159406,19 +160976,19 @@ var ts; function getFunctionReferences(containingFunction, sourceFile, program, cancellationToken) { var searchToken; switch (containingFunction.kind) { - case 171 /* SyntaxKind.Constructor */: - searchToken = ts.findChildOfKind(containingFunction, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); + case 173 /* SyntaxKind.Constructor */: + searchToken = ts.findChildOfKind(containingFunction, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: var parent = containingFunction.parent; searchToken = (ts.isVariableDeclaration(parent) || ts.isPropertyDeclaration(parent)) && ts.isIdentifier(parent.name) ? parent.name : containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: searchToken = containingFunction.name; break; } @@ -159560,24 +161130,24 @@ var ts; node = node.parent; } switch (node.parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: inferTypeFromExpressionStatement(node, usage); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: usage.isNumber = true; break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: inferTypeFromPrefixUnaryExpression(node.parent, usage); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: inferTypeFromBinaryExpression(node, node.parent, usage); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: inferTypeFromSwitchStatementLabel(node.parent, usage); break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.parent.expression === node) { inferTypeFromCallExpression(node.parent, usage); } @@ -159585,20 +161155,20 @@ var ts; inferTypeFromContextualType(node, usage); } break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: inferTypeFromPropertyAccessExpression(node.parent, usage); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: inferTypeFromPropertyElementExpression(node.parent, node, usage); break; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: inferTypeFromPropertyAssignment(node.parent, usage); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: inferTypeFromPropertyDeclaration(node.parent, usage); break; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var _a = node.parent, name = _a.name, initializer = _a.initializer; if (node === name) { if (initializer) { // This can happen for `let x = null;` which still has an implicit-any error. @@ -159720,7 +161290,7 @@ var ts; case 56 /* SyntaxKind.BarBarToken */: case 60 /* SyntaxKind.QuestionQuestionToken */: if (node === parent.left && - (node.parent.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { + (node.parent.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { // var x = x || {}; // TODO: use getFalsyflagsOfType addCandidateType(usage, checker.getTypeAtLocation(parent.right)); @@ -159748,7 +161318,7 @@ var ts; } } calculateUsageOfNode(parent, call.return_); - if (parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */) { (usage.calls || (usage.calls = [])).push(call); } else { @@ -160202,25 +161772,44 @@ var ts; * @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub. */ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) { + var _a; if (preserveOptional === void 0) { preserveOptional = 3 /* PreserveOptionalFlags.All */; } if (isAmbient === void 0) { isAmbient = false; } var declarations = symbol.getDeclarations(); - if (!(declarations && declarations.length)) { - return undefined; - } + var declaration = declarations === null || declarations === void 0 ? void 0 : declarations[0]; var checker = context.program.getTypeChecker(); var scriptTarget = ts.getEmitScriptTarget(context.program.getCompilerOptions()); - var declaration = declarations[0]; - var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); - var visibilityModifier = createVisibilityModifier(ts.getEffectiveModifierFlags(declaration)); - var modifiers = visibilityModifier ? ts.factory.createNodeArray([visibilityModifier]) : undefined; + /** + * (#49811) + * Note that there are cases in which the symbol declaration is not present. For example, in the code below both + * `MappedIndirect.ax` and `MappedIndirect.ay` have no declaration node attached (due to their mapped-type + * parent): + * + * ```ts + * type Base = { ax: number; ay: string }; + * type BaseKeys = keyof Base; + * type MappedIndirect = { [K in BaseKeys]: boolean }; + * ``` + * + * In such cases, we assume the declaration to be a `PropertySignature`. + */ + var kind = (_a = declaration === null || declaration === void 0 ? void 0 : declaration.kind) !== null && _a !== void 0 ? _a : 168 /* SyntaxKind.PropertySignature */; + var declarationName = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); + var effectiveModifierFlags = declaration ? ts.getEffectiveModifierFlags(declaration) : 0 /* ModifierFlags.None */; + var modifierFlags = effectiveModifierFlags & 4 /* ModifierFlags.Public */ ? 4 /* ModifierFlags.Public */ : + effectiveModifierFlags & 16 /* ModifierFlags.Protected */ ? 16 /* ModifierFlags.Protected */ : + 0 /* ModifierFlags.None */; + if (declaration && ts.isAutoAccessorPropertyDeclaration(declaration)) { + modifierFlags |= 128 /* ModifierFlags.Accessor */; + } + var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); var optional = !!(symbol.flags & 16777216 /* SymbolFlags.Optional */); var ambient = !!(enclosingDeclaration.flags & 16777216 /* NodeFlags.Ambient */) || isAmbient; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: + switch (kind) { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: var flags = quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : undefined; var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context)); if (importAdder) { @@ -160230,11 +161819,12 @@ var ts; importSymbols(importAdder, importableReference.symbols); } } - addClassElement(ts.factory.createPropertyDeclaration(modifiers, name, optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, + addClassElement(ts.factory.createPropertyDeclaration(modifiers, declaration ? createName(declarationName) : symbol.getName(), optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, /*initializer*/ undefined)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + ts.Debug.assertIsDefined(declarations); var typeNode_1 = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context)); var allAccessors = ts.getAllAccessorDeclarations(declarations, declaration); var orderedAccessors = allAccessors.secondAccessor @@ -160250,19 +161840,19 @@ var ts; for (var _i = 0, orderedAccessors_1 = orderedAccessors; _i < orderedAccessors_1.length; _i++) { var accessor = orderedAccessors_1[_i]; if (ts.isGetAccessorDeclaration(accessor)) { - addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, createName(declarationName), ts.emptyArray, createTypeNode(typeNode_1), createBody(body, quotePreference, ambient))); } else { ts.Debug.assertNode(accessor, ts.isSetAccessorDeclaration, "The counterpart to a getter should be a setter"); var parameter = ts.getSetAccessorValueParameter(accessor); var parameterName = parameter && ts.isIdentifier(parameter.name) ? ts.idText(parameter.name) : undefined; - addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, createName(declarationName), createDummyParameters(1, [parameterName], [createTypeNode(typeNode_1)], 1, /*inJs*/ false), createBody(body, quotePreference, ambient))); } } break; } - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: // The signature for the implementation appears as an entry in `signatures` iff // there is only one signature. // If there are overloads and an implementation signature, it appears as an @@ -160270,6 +161860,7 @@ var ts; // If there is more than one overload but no implementation signature // (eg: an abstract method or interface declaration), there is a 1-1 // correspondence of declarations and signatures. + ts.Debug.assertIsDefined(declarations); var signatures = type.isUnion() ? ts.flatMap(type.types, function (t) { return t.getCallSignatures(); }) : type.getCallSignatures(); if (!ts.some(signatures)) { break; @@ -160277,31 +161868,41 @@ var ts; if (declarations.length === 1) { ts.Debug.assert(signatures.length === 1, "One declaration implies one signature"); var signature = signatures[0]; - outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference, ambient)); break; } - for (var _a = 0, signatures_1 = signatures; _a < signatures_1.length; _a++) { - var signature = signatures_1[_a]; + for (var _b = 0, signatures_1 = signatures; _b < signatures_1.length; _b++) { + var signature = signatures_1[_b]; // Ensure nodes are fresh so they can have different positions when going through formatting. - outputMethod(quotePreference, signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName)); } if (!ambient) { if (declarations.length > signatures.length) { var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); - outputMethod(quotePreference, signature, modifiers, name, body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference)); } else { ts.Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count"); - addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); + addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, createName(declarationName), optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); } } break; } function outputMethod(quotePreference, signature, modifiers, name, body) { - var method = createSignatureDeclarationFromSignature(169 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); + var method = createSignatureDeclarationFromSignature(171 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); if (method) addClassElement(method); } + function createName(node) { + return ts.getSynthesizedDeepClone(node, /*includeTrivia*/ false); + } + function createBody(block, quotePreference, ambient) { + return ambient ? undefined : + ts.getSynthesizedDeepClone(block, /*includeTrivia*/ false) || createStubbedMethodBody(quotePreference); + } + function createTypeNode(typeNode) { + return ts.getSynthesizedDeepClone(typeNode, /*includeTrivia*/ false); + } } codefix.addNewNodeForMemberSymbol = addNewNodeForMemberSymbol; function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) { @@ -160375,6 +161976,9 @@ var ts; if (ts.isMethodDeclaration(signatureDeclaration)) { return ts.factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name !== null && name !== void 0 ? name : ts.factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body); } + if (ts.isFunctionDeclaration(signatureDeclaration)) { + return ts.factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, ts.tryCast(name, ts.isIdentifier), typeParameters, parameters, type, body !== null && body !== void 0 ? body : signatureDeclaration.body); + } return undefined; } codefix.createSignatureDeclarationFromSignature = createSignatureDeclarationFromSignature; @@ -160403,13 +162007,13 @@ var ts; ? undefined : checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker); switch (kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createMethodDeclaration(modifiers, asteriskToken, name, /*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference)); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return ts.factory.createMethodSignature(modifiers, name, - /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */) : type); - case 256 /* SyntaxKind.FunctionDeclaration */: + /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */) : type); + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference)); default: ts.Debug.fail("Unexpected kind"); @@ -160546,7 +162150,7 @@ var ts; /*dotDotDotToken*/ undefined, /*name*/ parameterName + (parameterNameCount || ""), /*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, - /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), + /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), /*initializer*/ undefined); parameters.push(newParameter); } @@ -160576,7 +162180,7 @@ var ts; if (someSigHasRestParameter) { var restParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest", - /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)), + /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)), /*initializer*/ undefined); parameters.push(restParameter); } @@ -160604,15 +162208,6 @@ var ts; /*multiline*/ true); } codefix.createStubbedBody = createStubbedBody; - function createVisibilityModifier(flags) { - if (flags & 4 /* ModifierFlags.Public */) { - return ts.factory.createToken(123 /* SyntaxKind.PublicKeyword */); - } - else if (flags & 16 /* ModifierFlags.Protected */) { - return ts.factory.createToken(122 /* SyntaxKind.ProtectedKeyword */); - } - return undefined; - } function setJsonCompilerOptionValues(changeTracker, configFile, options) { var tsconfigObjectLiteral = ts.getTsConfigObjectLiteralExpression(configFile); if (!tsconfigObjectLiteral) @@ -160691,6 +162286,15 @@ var ts; symbols.forEach(function (s) { return importAdder.addImportFromExportedSymbol(s, /*isValidTypeOnlyUseSite*/ true); }); } codefix.importSymbols = importSymbols; + function findAncestorMatchingSpan(sourceFile, span) { + var end = ts.textSpanEnd(span); + var token = ts.getTokenAtPosition(sourceFile, span.start); + while (token.end < end) { + token = token.parent; + } + return token; + } + codefix.findAncestorMatchingSpan = findAncestorMatchingSpan; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -160713,13 +162317,13 @@ var ts; if (ts.isClassLike(container)) { var modifierFlags = ts.getEffectiveModifierFlags(declaration); if (ts.isSourceFileJS(file)) { - var modifiers = ts.createModifiers(modifierFlags); + var modifiers = ts.factory.createModifiersFromModifierFlags(modifierFlags); accessorModifiers = modifiers; fieldModifiers = modifiers; } else { - accessorModifiers = ts.createModifiers(prepareModifierFlagsForAccessor(modifierFlags)); - fieldModifiers = ts.createModifiers(prepareModifierFlagsForField(modifierFlags)); + accessorModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForAccessor(modifierFlags)); + fieldModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForField(modifierFlags)); } if (ts.canHaveDecorators(declaration)) { fieldModifiers = ts.concatenate(ts.getDecorators(declaration), fieldModifiers); @@ -160788,7 +162392,7 @@ var ts; error: ts.getLocaleSpecificMessage(ts.Diagnostics.Name_is_not_valid) }; } - if (((ts.getEffectiveModifierFlags(declaration) & 125951 /* ModifierFlags.Modifier */) | meaning) !== meaning) { + if (((ts.getEffectiveModifierFlags(declaration) & 126975 /* ModifierFlags.Modifier */) | meaning) !== meaning) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_property_with_modifier) }; @@ -160801,7 +162405,7 @@ var ts; isStatic: ts.hasStaticModifier(declaration), isReadonly: ts.hasEffectiveReadonlyModifier(declaration), type: getDeclarationType(declaration, program), - container: declaration.kind === 164 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, + container: declaration.kind === 166 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, originalName: declaration.name.text, declaration: declaration, fieldName: fieldName, @@ -160875,7 +162479,7 @@ var ts; var type = typeChecker.getTypeFromTypeNode(typeNode); if (!typeChecker.isTypeAssignableTo(typeChecker.getUndefinedType(), type)) { var types = ts.isUnionTypeNode(typeNode) ? typeNode.types : [typeNode]; - return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)], false)); + return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)], false)); } } return typeNode; @@ -160933,7 +162537,7 @@ var ts; }); function getActionsForUsageOfInvalidImport(context) { var sourceFile = context.sourceFile; - var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 208 /* SyntaxKind.CallExpression */ : 209 /* SyntaxKind.NewExpression */; + var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 210 /* SyntaxKind.CallExpression */ : 211 /* SyntaxKind.NewExpression */; var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start), function (a) { return a.kind === targetKind; }); if (!node) { return []; @@ -161059,7 +162663,7 @@ var ts; return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_undefined_type_to_property_0, info.prop.name.getText()], fixIdAddUndefinedType, ts.Diagnostics.Add_undefined_type_to_all_uninitialized_properties); } function addUndefinedType(changeTracker, sourceFile, info) { - var undefinedTypeNode = ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + var undefinedTypeNode = ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); var types = ts.isUnionTypeNode(info.type) ? info.type.types.concat(undefinedTypeNode) : [info.type, undefinedTypeNode]; var unionTypeNode = ts.factory.createUnionTypeNode(types); if (info.isJs) { @@ -161105,7 +162709,7 @@ var ts; } else if (type.isClass()) { var classDeclaration = ts.getClassLikeDeclarationOfSymbol(type.symbol); - if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 128 /* ModifierFlags.Abstract */)) + if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 256 /* ModifierFlags.Abstract */)) return undefined; var constructorDeclaration = ts.getFirstConstructorWithBody(classDeclaration); if (constructorDeclaration && constructorDeclaration.parameters.length) @@ -161282,7 +162886,7 @@ var ts; function getImportTypeNode(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); ts.Debug.assert(token.kind === 100 /* SyntaxKind.ImportKeyword */, "This token should be an ImportKeyword"); - ts.Debug.assert(token.parent.kind === 200 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); + ts.Debug.assert(token.parent.kind === 202 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); return token.parent; } function doChange(changes, sourceFile, importType) { @@ -161411,7 +163015,7 @@ var ts; var otherMembers = members.filter(function (member) { return !ts.isIndexSignatureDeclaration(member); }); var parameter = ts.first(indexSignature.parameters); var mappedTypeParameter = ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.cast(parameter.name, ts.isIdentifier), parameter.type); - var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, + var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, /*nameType*/ undefined, indexSignature.questionToken, indexSignature.type, /*members*/ undefined); var intersectionType = ts.factory.createIntersectionTypeNode(__spreadArray(__spreadArray(__spreadArray([], ts.getAllSuperTypeNodes(container), true), [ @@ -161469,7 +163073,7 @@ var ts; }, }); function makeChange(changeTracker, sourceFile, span) { - var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 132 /* SyntaxKind.AwaitKeyword */; }); + var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 133 /* SyntaxKind.AwaitKeyword */; }); var awaitExpression = awaitKeyword && ts.tryCast(awaitKeyword.parent, ts.isAwaitExpression); if (!awaitExpression) { return; @@ -161536,28 +163140,45 @@ var ts; errorCodes: errorCodes, getCodeActions: function getCodeActionsToConvertConstToLet(context) { var sourceFile = context.sourceFile, span = context.span, program = context.program; - var range = getConstTokenRange(sourceFile, span.start, program); - if (range === undefined) + var info = getInfo(sourceFile, span.start, program); + if (info === undefined) return; - var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, range); }); - return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_const_to_let)]; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, info.token); }); + return [codefix.createCodeFixActionMaybeFixAll(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_all_const_to_let)]; + }, + getAllCodeActions: function (context) { + var program = context.program; + var seen = new ts.Map(); + return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) { + codefix.eachDiagnostic(context, errorCodes, function (diag) { + var info = getInfo(diag.file, diag.start, program); + if (info) { + if (ts.addToSeen(seen, ts.getSymbolId(info.symbol))) { + return doChange(changes, diag.file, info.token); + } + } + return undefined; + }); + })); }, fixIds: [fixId] }); - function getConstTokenRange(sourceFile, pos, program) { + function getInfo(sourceFile, pos, program) { var _a; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(ts.getTokenAtPosition(sourceFile, pos)); + if (symbol === undefined) + return; var declaration = ts.tryCast((_a = symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.parent, ts.isVariableDeclarationList); if (declaration === undefined) return; var constToken = ts.findChildOfKind(declaration, 85 /* SyntaxKind.ConstKeyword */, sourceFile); if (constToken === undefined) return; - return ts.createRange(constToken.pos, constToken.end); + return { symbol: symbol, token: constToken }; } - function doChange(changes, sourceFile, range) { - changes.replaceRangeWithText(sourceFile, range, "let"); + function doChange(changes, sourceFile, token) { + changes.replaceNode(sourceFile, token, ts.factory.createToken(119 /* SyntaxKind.LetKeyword */)); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -161732,7 +163353,6 @@ var ts; return { edits: edits, renameFilename: undefined, renameLocation: undefined }; }, }); - ; function getInfo(context, considerPartialSpans) { if (considerPartialSpans === void 0) { considerPartialSpans = true; } var file = context.file, program = context.program; @@ -161744,8 +163364,8 @@ var ts; } var checker = program.getTypeChecker(); var exportingModuleSymbol = getExportingModuleSymbol(exportNode, checker); - var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 513 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); - var wasDefault = !!(flags & 512 /* ModifierFlags.Default */); + var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 1025 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); + var wasDefault = !!(flags & 1024 /* ModifierFlags.Default */); // If source file already has a default export, don't offer refactor. if (!(flags & 1 /* ModifierFlags.Export */) || !wasDefault && exportingModuleSymbol.exports.has("default" /* InternalSymbolName.Default */)) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.This_file_already_has_a_default_export) }; @@ -161755,19 +163375,19 @@ var ts; : { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_named_export) }; }; switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: { var node = exportNode; if (!node.name) return undefined; return noSymbolError(node.name) || { exportNode: node, exportName: node.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { var vs = exportNode; // Must be `export const x = something;`. if (!(vs.declarationList.flags & 2 /* NodeFlags.Const */) || vs.declarationList.declarations.length !== 1) { @@ -161780,7 +163400,7 @@ var ts; return noSymbolError(decl.name) || { exportNode: vs, exportName: decl.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var node = exportNode; if (node.isExportEquals) return undefined; @@ -161810,12 +163430,12 @@ var ts; else { var exportKeyword = ts.Debug.checkDefined(ts.findModifier(exportNode, 93 /* SyntaxKind.ExportKeyword */), "Should find an export keyword in modifier list"); switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.factory.createToken(88 /* SyntaxKind.DefaultKeyword */)); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // If 'x' isn't used in this file and doesn't have type definition, `export const x = 0;` --> `export default 0;` var decl = ts.first(exportNode.declarationList.declarations); if (!ts.FindAllReferences.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile) && !decl.type) { @@ -161824,9 +163444,9 @@ var ts; break; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // `export type T = number;` -> `type T = number; export default T;` changes.deleteModifier(exportingSourceFile, exportKeyword); changes.insertNodeAfter(exportingSourceFile, exportNode, ts.factory.createExportDefault(ts.factory.createIdentifier(exportName.text))); @@ -161855,18 +163475,18 @@ var ts; function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.default` --> `a.foo` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier(exportName)); break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: { var spec = parent; // `default as foo` --> `foo`, `default as bar` --> `foo as bar` changes.replaceNode(importingSourceFile, spec, makeImportSpecifier(exportName, spec.name.text)); break; } - case 267 /* SyntaxKind.ImportClause */: { + case 270 /* SyntaxKind.ImportClause */: { var clause = parent; ts.Debug.assert(clause.name === ref, "Import clause name should match provided ref"); var spec = makeImportSpecifier(exportName, ref.text); @@ -161875,7 +163495,7 @@ var ts; // `import foo from "./a";` --> `import { foo } from "./a";` changes.replaceNode(importingSourceFile, ref, ts.factory.createNamedImports([spec])); } - else if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + else if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // `import foo, * as a from "./a";` --> `import * as a from ".a/"; import { foo } from "./a";` changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) }); var quotePreference = ts.isStringLiteral(clause.parent.moduleSpecifier) ? ts.quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1 /* QuotePreference.Double */; @@ -161889,7 +163509,7 @@ var ts; } break; } - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: var importTypeNode = parent; changes.replaceNode(importingSourceFile, parent, ts.factory.createImportTypeNode(importTypeNode.argument, importTypeNode.assertions, ts.factory.createIdentifier(exportName), importTypeNode.typeArguments, importTypeNode.isTypeOf)); break; @@ -161900,11 +163520,11 @@ var ts; function changeNamedToDefaultImport(importingSourceFile, ref, changes) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.foo` --> `a.default` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier("default")); break; - case 270 /* SyntaxKind.ImportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: { // `import { foo } from "./a";` --> `import foo from "./a";` // `import { foo as bar } from "./a";` --> `import bar from "./a";` var defaultImport = ts.factory.createIdentifier(parent.name.text); @@ -161917,7 +163537,7 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // `export { foo } from "./a";` --> `export { default as foo } from "./a";` // `export { foo as bar } from "./a";` --> `export { default as bar } from "./a";` // `export { foo as default } from "./a";` --> `export { default } from "./a";` @@ -162018,7 +163638,7 @@ var ts; if (!importClause.namedBindings) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_namespace_import_or_named_imports) }; } - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return { convertTo: 0 /* ImportKind.Named */, import: importClause.namedBindings }; } var shouldUseDefault = getShouldUseDefault(context.program, importClause); @@ -162209,7 +163829,6 @@ var ts; }); return { edits: edits, renameFilename: undefined, renameLocation: undefined }; } - ; function isValidExpression(node) { return ts.isBinaryExpression(node) || ts.isConditionalExpression(node); } @@ -162257,7 +163876,6 @@ var ts; if (expression.operatorToken.kind !== 55 /* SyntaxKind.AmpersandAmpersandToken */) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_logical_AND_access_chains) }; } - ; var finalExpression = getFinalExpressionInChain(expression.right); if (!finalExpression) return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_convertible_access_expression) }; @@ -162467,27 +164085,27 @@ var ts; var lastDeclaration = signatureDecls[signatureDecls.length - 1]; var updated = lastDeclaration; switch (lastDeclaration.kind) { - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { updated = ts.factory.updateMethodSignature(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { updated = ts.factory.updateMethodDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { updated = ts.factory.updateCallSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { updated = ts.factory.updateConstructorDeclaration(lastDeclaration, lastDeclaration.modifiers, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.body); break; } - case 175 /* SyntaxKind.ConstructSignature */: { + case 177 /* SyntaxKind.ConstructSignature */: { updated = ts.factory.updateConstructSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { updated = ts.factory.updateFunctionDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } @@ -162518,7 +164136,7 @@ var ts; } function convertParameterToNamedTupleMember(p) { ts.Debug.assert(ts.isIdentifier(p.name)); // This is checked during refactoring applicability checking - var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)), p); + var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)), p); var parameterDocComment = p.symbol && p.symbol.getDocumentationComment(checker); if (parameterDocComment) { var newComment = ts.displayPartsToString(parameterDocComment); @@ -162538,12 +164156,12 @@ var ts; } function isConvertableSignatureDeclaration(d) { switch (d.kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: return true; } return false; @@ -162662,8 +164280,8 @@ var ts; var i = 0; for (var _i = 0, extractions_1 = extractions; _i < extractions_1.length; _i++) { var _a = extractions_1[_i], functionExtraction = _a.functionExtraction, constantExtraction = _a.constantExtraction; - var description = functionExtraction.description; if (refactor.refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) { + var description = functionExtraction.description; if (functionExtraction.errors.length === 0) { // Don't issue refactorings with duplicated names. // Scopes come back in "innermost first" order, so extractions will @@ -162687,15 +164305,15 @@ var ts; } } if (refactor.refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) { + var description = constantExtraction.description; if (constantExtraction.errors.length === 0) { // Don't issue refactorings with duplicated names. // Scopes come back in "innermost first" order, so extractions will // preferentially go into nearer scopes - var description_1 = constantExtraction.description; - if (!usedConstantNames.has(description_1)) { - usedConstantNames.set(description_1, true); + if (!usedConstantNames.has(description)) { + usedConstantNames.set(description, true); constantActions.push({ - description: description_1, + description: description, name: "constant_scope_".concat(i), kind: extractConstantAction.kind }); @@ -162840,7 +164458,6 @@ var ts; var start = cursorRequest ? getExtractableParent(startToken) : ts.getParentNodeInSpan(startToken, sourceFile, adjustedSpan); // Do the same for the ending position var end = cursorRequest ? start : ts.getParentNodeInSpan(endToken, sourceFile, adjustedSpan); - var declarations = []; // We'll modify these flags as we walk the tree to collect data // about what things need to be done as part of the extraction. var rangeFacts = RangeFacts.None; @@ -162883,7 +164500,7 @@ var ts; // the expression. return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] }; } - return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; + return { targetRange: { range: statements, facts: rangeFacts, thisNode: thisNode } }; } if (ts.isReturnStatement(start) && !start.expression) { // Makes no sense to extract an expression-less return statement. @@ -162895,7 +164512,7 @@ var ts; if (errors) { return { errors: errors }; } - return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; // TODO: GH#18217 + return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, thisNode: thisNode } }; // TODO: GH#18217 /** * Attempt to refine the extraction node (generally, by shrinking it) to produce better results. * @param node The unrefined extraction node. @@ -162907,10 +164524,10 @@ var ts; } } else if (ts.isVariableStatement(node) || ts.isVariableDeclarationList(node)) { - var declarations_6 = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations; + var declarations = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations; var numInitializers = 0; var lastInitializer = void 0; - for (var _i = 0, declarations_5 = declarations_6; _i < declarations_5.length; _i++) { + for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; if (declaration.initializer) { numInitializers++; @@ -162938,20 +164555,20 @@ var ts; function checkForStaticContext(nodeToCheck, containingClass) { var current = nodeToCheck; while (current !== containingClass) { - if (current.kind === 167 /* SyntaxKind.PropertyDeclaration */) { + if (current.kind === 169 /* SyntaxKind.PropertyDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 164 /* SyntaxKind.Parameter */) { + else if (current.kind === 166 /* SyntaxKind.Parameter */) { var ctorOrMethod = ts.getContainingFunction(current); - if (ctorOrMethod.kind === 171 /* SyntaxKind.Constructor */) { + if (ctorOrMethod.kind === 173 /* SyntaxKind.Constructor */) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 169 /* SyntaxKind.MethodDeclaration */) { + else if (current.kind === 171 /* SyntaxKind.MethodDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } @@ -162989,9 +164606,9 @@ var ts; visit(nodeToCheck); if (rangeFacts & RangeFacts.UsesThis) { var container = ts.getThisContainer(nodeToCheck, /** includeArrowFunctions */ false); - if (container.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) || - container.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (container.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) || + container.kind === 215 /* SyntaxKind.FunctionExpression */) { rangeFacts |= RangeFacts.UsesThisInFunction; } } @@ -163002,7 +164619,7 @@ var ts; return true; } if (ts.isDeclaration(node)) { - var declaringNode = (node.kind === 254 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; + var declaringNode = (node.kind === 257 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; if (ts.hasSyntacticModifier(declaringNode, 1 /* ModifierFlags.Export */)) { // TODO: GH#18217 Silly to use `errors ||` since it's definitely not defined (see top of `visit`) // Also, if we're only pushing one error, just use `let error: Diagnostic | undefined`! @@ -163010,20 +164627,19 @@ var ts; (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; } - declarations.push(node.symbol); } // Some things can't be extracted in certain situations switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport)); return true; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; case 106 /* SyntaxKind.SuperKeyword */: // For a super *constructor call*, we have to be extracting the entire class, // but a super *method call* simply implies a 'this' reference - if (node.parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.parent.kind === 210 /* SyntaxKind.CallExpression */) { // Super constructor call var containingClass_1 = ts.getContainingClass(node); if (containingClass_1 === undefined || containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) { @@ -163036,7 +164652,7 @@ var ts; thisNode = node; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // check if arrow function uses this ts.forEachChild(node, function check(n) { if (ts.isThis(n)) { @@ -163051,39 +164667,39 @@ var ts; } }); // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) { // You cannot extract global declarations (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope)); } // falls through - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // do not dive into functions or classes return false; } var savedPermittedJumps = permittedJumps; switch (node.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: permittedJumps &= ~4 /* PermittedJumps.Return */; break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // forbid all jumps inside try blocks permittedJumps = 0 /* PermittedJumps.None */; break; - case 235 /* SyntaxKind.Block */: - if (node.parent && node.parent.kind === 252 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { + case 238 /* SyntaxKind.Block */: + if (node.parent && node.parent.kind === 255 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { // allow unconditional returns from finally blocks permittedJumps = 4 /* PermittedJumps.Return */; } break; - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: // allow unlabeled break inside case clauses permittedJumps |= 1 /* PermittedJumps.Break */; break; @@ -163095,20 +164711,20 @@ var ts; break; } switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: rangeFacts |= RangeFacts.UsesThis; thisNode = node; break; - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { var label = node.label; (seenLabels || (seenLabels = [])).push(label.escapedText); ts.forEachChild(node, visit); seenLabels.pop(); break; } - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: { + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: { var label = node.label; if (label) { if (!ts.contains(seenLabels, label.escapedText)) { @@ -163117,20 +164733,20 @@ var ts; } } else { - if (!(permittedJumps & (node.kind === 246 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { + if (!(permittedJumps & (node.kind === 249 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { // attempt to break or continue in a forbidden context (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); } } break; } - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: rangeFacts |= RangeFacts.IsAsyncFunction; break; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: rangeFacts |= RangeFacts.IsGenerator; break; - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: if (permittedJumps & 4 /* PermittedJumps.Return */) { rangeFacts |= RangeFacts.HasReturn; } @@ -163200,7 +164816,7 @@ var ts; while (true) { current = current.parent; // A function parameter's initializer is actually in the outer scope, not the function declaration - if (current.kind === 164 /* SyntaxKind.Parameter */) { + if (current.kind === 166 /* SyntaxKind.Parameter */) { // Skip all the way to the outer scope of the function that declared this parameter current = ts.findAncestor(current, function (parent) { return ts.isFunctionLikeDeclaration(parent); }).parent; } @@ -163211,7 +164827,7 @@ var ts; // * Module/namespace or source file if (isScope(current)) { scopes.push(current); - if (current.kind === 305 /* SyntaxKind.SourceFile */) { + if (current.kind === 308 /* SyntaxKind.SourceFile */) { return scopes; } } @@ -163301,32 +164917,32 @@ var ts; } function getDescriptionForFunctionLikeDeclaration(scope) { switch (scope.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return scope.name ? "function '".concat(scope.name.text, "'") : ts.ANONYMOUS; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return "arrow function"; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return "method '".concat(scope.name.getText(), "'"); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return "'get ".concat(scope.name.getText(), "'"); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return "'set ".concat(scope.name.getText(), "'"); default: throw ts.Debug.assertNever(scope, "Unexpected scope kind ".concat(scope.kind)); } } function getDescriptionForClassLikeDeclaration(scope) { - return scope.kind === 257 /* SyntaxKind.ClassDeclaration */ + return scope.kind === 260 /* SyntaxKind.ClassDeclaration */ ? scope.name ? "class '".concat(scope.name.text, "'") : "anonymous class declaration" : scope.name ? "class expression '".concat(scope.name.text, "'") : "anonymous class expression"; } function getDescriptionForModuleLikeDeclaration(scope) { - return scope.kind === 262 /* SyntaxKind.ModuleBlock */ + return scope.kind === 265 /* SyntaxKind.ModuleBlock */ ? "namespace '".concat(scope.parent.name.getText(), "'") : scope.externalModuleIndicator ? 0 /* SpecialScope.Module */ : 1 /* SpecialScope.Global */; } @@ -163399,7 +165015,7 @@ var ts; modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } if (range.facts & RangeFacts.IsAsyncFunction) { - modifiers.push(ts.factory.createModifier(131 /* SyntaxKind.AsyncKeyword */)); + modifiers.push(ts.factory.createModifier(132 /* SyntaxKind.AsyncKeyword */)); } newFunction = ts.factory.createMethodDeclaration(modifiers.length ? modifiers : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, /*questionToken*/ undefined, typeParameters, parameters, returnType, body); @@ -163413,7 +165029,7 @@ var ts; /*questionToken*/ undefined, checker.typeToTypeNode(checker.getTypeAtLocation(range.thisNode), scope, 1 /* NodeBuilderFlags.NoTruncation */), /*initializer*/ undefined)); } - newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(131 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); + newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(132 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); } var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); var minInsertionPos = (isReadonlyArray(range.range) ? ts.last(range.range) : range.range).end; @@ -163561,9 +165177,9 @@ var ts; while (ts.isParenthesizedTypeNode(withoutParens)) { withoutParens = withoutParens.type; } - return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 153 /* SyntaxKind.UndefinedKeyword */; }) + return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 155 /* SyntaxKind.UndefinedKeyword */; }) ? clone - : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } } /** @@ -163594,7 +165210,7 @@ var ts; if (rangeFacts & RangeFacts.InStaticRegion) { modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } - modifiers.push(ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); + modifiers.push(ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); var newVariable = ts.factory.createPropertyDeclaration(modifiers, localNameText, /*questionToken*/ undefined, variableType, initializer); var localReference = ts.factory.createPropertyAccessExpression(rangeFacts & RangeFacts.InStaticRegion @@ -163625,7 +165241,7 @@ var ts; var localReference = ts.factory.createIdentifier(localNameText); changeTracker.replaceNode(context.file, node, localReference); } - else if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { + else if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { // If the parent is an expression statement and the target scope is the immediately enclosing one, // replace the statement with the declaration. var newVariableStatement = ts.factory.createVariableStatement( @@ -163644,7 +165260,7 @@ var ts; changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ false); } // Consume - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { // If the parent is an expression statement, delete it. changeTracker.delete(context.file, node.parent); } @@ -164290,30 +165906,30 @@ var ts; function isExtractableExpression(node) { var parent = node.parent; switch (parent.kind) { - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return false; } switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: - return parent.kind !== 266 /* SyntaxKind.ImportDeclaration */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */; - case 225 /* SyntaxKind.SpreadElement */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 203 /* SyntaxKind.BindingElement */: + return parent.kind !== 269 /* SyntaxKind.ImportDeclaration */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */; + case 227 /* SyntaxKind.SpreadElement */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 205 /* SyntaxKind.BindingElement */: return false; case 79 /* SyntaxKind.Identifier */: - return parent.kind !== 203 /* SyntaxKind.BindingElement */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */ && - parent.kind !== 275 /* SyntaxKind.ExportSpecifier */; + return parent.kind !== 205 /* SyntaxKind.BindingElement */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */ && + parent.kind !== 278 /* SyntaxKind.ExportSpecifier */; } return true; } function isBlockLike(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 305 /* SyntaxKind.SourceFile */: - case 262 /* SyntaxKind.ModuleBlock */: - case 289 /* SyntaxKind.CaseClause */: + case 238 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 265 /* SyntaxKind.ModuleBlock */: + case 292 /* SyntaxKind.CaseClause */: return true; default: return false; @@ -164601,7 +166217,6 @@ var ts; (function (ts) { var refactor; (function (refactor) { - ; /** * Checks if some refactor info has refactor error info. */ @@ -164706,15 +166321,14 @@ var ts; // Imports will be copied to the new file anyway, and may still be needed in the old file. // Prologue directives will be copied to the new file and should be left in the old file. return !isPureImport(statement) && !ts.isPrologueDirective(statement); - ; } function isPureImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return true; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return !ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return node.declarationList.declarations.every(function (d) { return !!d.initializer && ts.isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true); }); default: return false; @@ -164737,7 +166351,7 @@ var ts; function getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, newModuleName, preferences) { var checker = program.getTypeChecker(); var prologueDirectives = ts.takeWhile(oldFile.statements, ts.isPrologueDirective); - if (!oldFile.externalModuleIndicator && !oldFile.commonJsModuleIndicator) { + if (oldFile.externalModuleIndicator === undefined && oldFile.commonJsModuleIndicator === undefined && usage.oldImportsNeededByNewFile.size() === 0) { deleteMovedStatements(oldFile, toMove.ranges, changes); return __spreadArray(__spreadArray([], prologueDirectives, true), toMove.all, true); } @@ -164810,12 +166424,12 @@ var ts; } function getNamespaceLikeImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? + case 269 /* SyntaxKind.ImportDeclaration */: + return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? node.importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.tryCast(node.name, ts.isIdentifier); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); @@ -164846,21 +166460,21 @@ var ts; var newNamespaceId = ts.factory.createIdentifier(newNamespaceName); var newModuleString = ts.factory.createStringLiteral(newModuleSpecifier); switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, ts.factory.createNamespaceImport(newNamespaceId)), newModuleString, /*assertClause*/ undefined); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.createImportEqualsDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, newNamespaceId, ts.factory.createExternalModuleReference(newModuleString)); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.factory.createVariableDeclaration(newNamespaceId, /*exclamationToken*/ undefined, /*type*/ undefined, createRequireCall(newModuleString)); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); } } function moduleSpecifierFromImport(i) { - return (i.kind === 266 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier - : i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression + return (i.kind === 269 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier + : i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression : i.initializer.arguments[0]); } function forEachImportInStatement(statement, cb) { @@ -164930,15 +166544,15 @@ var ts; } function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) { switch (importDecl.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (isUnused(importDecl.name)) { changes.delete(sourceFile, importDecl); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused); break; default: @@ -164951,7 +166565,7 @@ var ts; var _a = importDecl.importClause, name = _a.name, namedBindings = _a.namedBindings; var defaultUnused = !name || isUnused(name); var namedBindingsUnused = !namedBindings || - (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); + (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); if (defaultUnused && namedBindingsUnused) { changes.delete(sourceFile, importDecl); } @@ -164963,7 +166577,7 @@ var ts; if (namedBindingsUnused) { changes.replaceNode(sourceFile, importDecl.importClause, ts.factory.updateImportClause(importDecl.importClause, importDecl.importClause.isTypeOnly, name, /*namedBindings*/ undefined)); } - else if (namedBindings.kind === 269 /* SyntaxKind.NamedImports */) { + else if (namedBindings.kind === 272 /* SyntaxKind.NamedImports */) { for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) { var element = _b[_i]; if (isUnused(element.name)) @@ -164978,12 +166592,17 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: if (isUnused(name)) { - changes.delete(sourceFile, name); + if (varDecl.initializer && ts.isRequireCall(varDecl.initializer, /*requireStringLiteralLikeArgument*/ true)) { + changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && ts.length(varDecl.parent.declarations) === 1 ? varDecl.parent.parent : varDecl); + } + else { + changes.delete(sourceFile, name); + } } break; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: break; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: if (name.elements.every(function (e) { return ts.isIdentifier(e.name) && isUnused(e.name); })) { changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl); } @@ -165025,7 +166644,7 @@ var ts; if (markSeenTop(top)) { addExportToChanges(oldFile, top, name, changes, useEsModuleSyntax); } - if (ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */)) { oldFileDefault = name; } else { @@ -165113,14 +166732,14 @@ var ts; // Below should all be utilities function isInImport(decl) { switch (decl.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return isVariableDeclarationInImport(decl); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); default: return false; @@ -165132,7 +166751,7 @@ var ts; } function filterImport(i, moduleSpecifier, keep) { switch (i.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { var clause = i.importClause; if (!clause) return undefined; @@ -165142,9 +166761,9 @@ var ts; ? ts.factory.createImportDeclaration(/*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, defaultImport, namedBindings), moduleSpecifier, /*assertClause*/ undefined) : undefined; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return keep(i.name) ? i : undefined; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var name = filterBindingName(i.name, keep); return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : undefined; } @@ -165153,7 +166772,7 @@ var ts; } } function filterNamedBindings(namedBindings, keep) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return keep(namedBindings.name) ? namedBindings : undefined; } else { @@ -165165,9 +166784,9 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return keep(name) ? name : undefined; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return name; - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { // We can't handle nested destructurings or property names well here, so just copy them all. var newElements = name.elements.filter(function (prop) { return prop.propertyName || !ts.isIdentifier(prop.name) || keep(prop.name); }); return newElements.length ? ts.factory.createObjectBindingPattern(newElements) : undefined; @@ -165210,6 +166829,9 @@ var ts; ts.copyEntries(this.map, clone.map); return clone; }; + SymbolSet.prototype.size = function () { + return this.map.size; + }; return SymbolSet; }()); function isTopLevelDeclaration(node) { @@ -165224,13 +166846,13 @@ var ts; } function isNonVariableTopLevelDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -165238,17 +166860,17 @@ var ts; } function forEachTopLevelDeclaration(statement, cb) { switch (statement.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return cb(statement); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.firstDefined(statement.declarationList.declarations, function (decl) { return forEachTopLevelDeclarationInBindingName(decl.name, cb); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; return ts.isBinaryExpression(expression) && ts.getAssignmentDeclarationKind(expression) === 1 /* AssignmentDeclarationKind.ExportsProperty */ ? cb(statement) @@ -165260,8 +166882,8 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return cb(ts.cast(name.parent, function (x) { return ts.isVariableDeclaration(x) || ts.isBindingElement(x); })); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return ts.firstDefined(name.elements, function (em) { return ts.isOmittedExpression(em) ? undefined : forEachTopLevelDeclarationInBindingName(em.name, cb); }); default: return ts.Debug.assertNever(name, "Unexpected name kind ".concat(name.kind)); @@ -165272,9 +166894,9 @@ var ts; } function getTopLevelDeclarationStatement(d) { switch (d.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return d.parent.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getTopLevelDeclarationStatement(ts.cast(d.parent.parent, function (p) { return ts.isVariableDeclaration(p) || ts.isBindingElement(p); })); default: return d; @@ -165298,7 +166920,8 @@ var ts; if (useEs6Exports) { return !ts.isExpressionStatement(decl) && ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */) || !!(name && ((_a = sourceFile.symbol.exports) === null || _a === void 0 ? void 0 : _a.has(name.escapedText))); } - return getNamesToExportInCommonJS(decl).some(function (name) { return sourceFile.symbol.exports.has(ts.escapeLeadingUnderscores(name)); }); + return !!sourceFile.symbol && !!sourceFile.symbol.exports && + getNamesToExportInCommonJS(decl).some(function (name) { return sourceFile.symbol.exports.has(ts.escapeLeadingUnderscores(name)); }); } function addExport(decl, useEs6Exports) { return useEs6Exports ? [addEs6Export(decl)] : addCommonjsExport(decl); @@ -165306,24 +166929,24 @@ var ts; function addEs6Export(d) { var modifiers = ts.canHaveModifiers(d) ? ts.concatenate([ts.factory.createModifier(93 /* SyntaxKind.ExportKeyword */)], ts.getModifiers(d)) : undefined; switch (d.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.updateFunctionDeclaration(d, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var decorators = ts.canHaveDecorators(d) ? ts.getDecorators(d) : undefined; return ts.factory.updateClassDeclaration(d, ts.concatenate(decorators, modifiers), d.name, d.typeParameters, d.heritageClauses, d.members); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.factory.updateVariableStatement(d, modifiers, d.declarationList); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.factory.updateModuleDeclaration(d, modifiers, d.name, d.body); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.factory.updateEnumDeclaration(d, modifiers, d.name, d.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return ts.factory.updateTypeAliasDeclaration(d, modifiers, d.name, d.typeParameters, d.type); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.factory.updateInterfaceDeclaration(d, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.updateImportEqualsDeclaration(d, modifiers, d.isTypeOnly, d.name, d.moduleReference); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(d, "Unexpected declaration kind ".concat(d.kind)); @@ -165334,18 +166957,18 @@ var ts; } function getNamesToExportInCommonJS(decl) { switch (decl.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return [decl.name.text]; // TODO: GH#18217 - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.mapDefined(decl.declarationList.declarations, function (d) { return ts.isIdentifier(d.name) ? d.name.text : undefined; }); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.emptyArray; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail("Can't export an ExpressionStatement"); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(decl, "Unexpected decl kind ".concat(decl.kind)); @@ -165686,15 +167309,15 @@ var ts; var parent = functionReference.parent; switch (parent.kind) { // foo(...) or super(...) or new Foo(...) - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: var callOrNewExpression = ts.tryCast(parent, ts.isCallOrNewExpression); if (callOrNewExpression && callOrNewExpression.expression === functionReference) { return callOrNewExpression; } break; // x.foo(...) - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) { var callOrNewExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallOrNewExpression); @@ -165704,7 +167327,7 @@ var ts; } break; // x["foo"](...) - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) { var callOrNewExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallOrNewExpression); @@ -165723,14 +167346,14 @@ var ts; var parent = reference.parent; switch (parent.kind) { // `C.foo` - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.expression === reference) { return propertyAccessExpression; } break; // `C["foo"]` - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.expression === reference) { return elementAccessExpression; @@ -165776,16 +167399,16 @@ var ts; if (!isValidParameterNodeArray(functionDeclaration.parameters, checker)) return false; switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralExpression(functionDeclaration.parent)) { var contextualSymbol = getSymbolForContextualType(functionDeclaration.name, checker); // don't offer the refactor when there are multiple signatures since we won't know which ones the user wants to change return ((_a = contextualSymbol === null || contextualSymbol === void 0 ? void 0 : contextualSymbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 && isSingleImplementation(functionDeclaration, checker); } return isSingleImplementation(functionDeclaration, checker); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (ts.isClassDeclaration(functionDeclaration.parent)) { return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker); } @@ -165793,8 +167416,8 @@ var ts; return isValidVariableDeclaration(functionDeclaration.parent.parent) && isSingleImplementation(functionDeclaration, checker); } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return isValidVariableDeclaration(functionDeclaration.parent); } return false; @@ -165942,7 +167565,7 @@ var ts; } function getClassNames(constructorDeclaration) { switch (constructorDeclaration.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = constructorDeclaration.parent; if (classDeclaration.name) return [classDeclaration.name]; @@ -165950,7 +167573,7 @@ var ts; // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(classDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless class declaration should be a default export"); return [defaultModifier]; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var classExpression = constructorDeclaration.parent; var variableDeclaration = constructorDeclaration.parent.parent; var className = classExpression.name; @@ -165961,25 +167584,25 @@ var ts; } function getFunctionNames(functionDeclaration) { switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (functionDeclaration.name) return [functionDeclaration.name]; // If the function declaration doesn't have a name, it should have a default modifier. // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(functionDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless function declaration should be a default export"); return [defaultModifier]; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return [functionDeclaration.name]; - case 171 /* SyntaxKind.Constructor */: - var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 134 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); - if (functionDeclaration.parent.kind === 226 /* SyntaxKind.ClassExpression */) { + case 173 /* SyntaxKind.Constructor */: + var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 135 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); + if (functionDeclaration.parent.kind === 228 /* SyntaxKind.ClassExpression */) { var variableDeclaration = functionDeclaration.parent.parent; return [variableDeclaration.name, ctrKeyword]; } return [ctrKeyword]; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return [functionDeclaration.parent.name]; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (functionDeclaration.name) return [functionDeclaration.name, functionDeclaration.parent.name]; return [functionDeclaration.parent.name]; @@ -166070,11 +167693,11 @@ var ts; function getParentBinaryExpression(expr) { var container = ts.findAncestor(expr.parent, function (n) { switch (n.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return false; - case 223 /* SyntaxKind.TemplateExpression */: - case 221 /* SyntaxKind.BinaryExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return !(ts.isBinaryExpression(n.parent) && isNotEqualsOperator(n.parent)); default: return "quit"; @@ -166522,10 +168145,10 @@ var ts; } function isConvertibleDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return true; default: return false; @@ -166570,7 +168193,7 @@ var ts; this.kind = kind; } NodeObject.prototype.assertHasRealPosition = function (message) { - // eslint-disable-next-line debug-assert + // eslint-disable-next-line local/debug-assert ts.Debug.assert(!ts.positionIsSynthesized(this.pos) && !ts.positionIsSynthesized(this.end), message || "Node must have a real position for this operation"); }; NodeObject.prototype.getSourceFile = function () { @@ -166627,8 +168250,8 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 309 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 347 /* SyntaxKind.LastJSDocNode */; }); - return child.kind < 161 /* SyntaxKind.FirstNode */ ? + var child = ts.find(children, function (kid) { return kid.kind < 312 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 350 /* SyntaxKind.LastJSDocNode */; }); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getFirstToken(sourceFile); }; @@ -166639,7 +168262,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 161 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); }; NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) { return ts.forEachChild(this, cbNode, cbNodeArray); @@ -166699,7 +168322,7 @@ var ts; } } function createSyntaxList(nodes, parent) { - var list = createNode(348 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); + var list = createNode(351 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { @@ -167048,7 +168671,7 @@ var ts; var _a; if (!seenSymbols_1.has(symbol)) { seenSymbols_1.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualJsDocTags(declaration, checker); } return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : undefined; @@ -167058,8 +168681,8 @@ var ts; tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true); } }; - for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { - var declaration = declarations_7[_i]; + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; _loop_20(declaration); } } @@ -167075,7 +168698,7 @@ var ts; var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) { if (!seenSymbols_2.has(symbol)) { seenSymbols_2.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualDocumentationComment(declaration, checker); } return symbol.getDocumentationComment(checker); @@ -167085,8 +168708,8 @@ var ts; if (inheritedDocs) doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc); }; - for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { - var declaration = declarations_8[_i]; + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; _loop_21(declaration); } } @@ -167094,7 +168717,7 @@ var ts; } function findBaseOfDeclaration(checker, declaration, cb) { var _a; - var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; + var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; if (!classOrInterfaceDeclaration) return; var isStaticMember = ts.hasStaticModifier(declaration); @@ -167109,7 +168732,7 @@ var ts; __extends(SourceFileObject, _super); function SourceFileObject(kind, pos, end) { var _this = _super.call(this, kind, pos, end) || this; - _this.kind = 305 /* SyntaxKind.SourceFile */; + _this.kind = 308 /* SyntaxKind.SourceFile */; return _this; } SourceFileObject.prototype.update = function (newText, textChangeRange) { @@ -167168,10 +168791,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -167191,31 +168814,31 @@ var ts; } ts.forEachChild(node, visit); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 184 /* SyntaxKind.TypeLiteral */: addDeclaration(node); ts.forEachChild(node, visit); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Only consider parameter properties if (!ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { break; } // falls through - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -167226,12 +168849,12 @@ var ts; } } // falls through - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: addDeclaration(node); break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; var exportDeclaration = node; @@ -167244,7 +168867,7 @@ var ts; } } break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -167256,7 +168879,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -167265,7 +168888,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) !== 0 /* AssignmentDeclarationKind.None */) { addDeclaration(node); } @@ -167611,7 +169234,7 @@ var ts; var rootFileNames = host.getScriptFileNames().slice(); // Get a fresh cache of the host information var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; var hasChangedAutomaticTypeDirectiveNames = ts.maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames); var projectReferences = (_b = host.getProjectReferences) === null || _b === void 0 ? void 0 : _b.call(host); var parsedCommandLines; @@ -167642,7 +169265,7 @@ var ts; }, onReleaseOldSourceFile: onReleaseOldSourceFile, onReleaseParsedCommandLine: onReleaseParsedCommandLine, - hasInvalidatedResolution: hasInvalidatedResolution, + hasInvalidatedResolutions: hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames, trace: ts.maybeBind(host, host.trace), resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames), @@ -167677,8 +169300,12 @@ var ts; getCurrentDirectory: compilerHost.getCurrentDirectory, onUnRecoverableConfigFileDiagnostic: ts.noop, }; + // The call to isProgramUptoDate below may refer back to documentRegistryBucketKey; + // calculate this early so it's not undefined if downleveled to a var (or, if emitted + // as a const variable without downleveling, doesn't crash). + var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); // If the program is already up-to-date, we can reuse it - if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { return; } // IMPORTANT - It is critical from this moment onward that we do not check @@ -167686,7 +169313,6 @@ var ts; // instance. If we cancel midway through, we may end up in an inconsistent state where // the program points to old source files that have been invalidated because of // incremental parsing. - var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); var options = { rootNames: rootFileNames, options: newSettings, @@ -167982,16 +169608,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return !ts.isLabelName(node) && !ts.isTagName(node) && !ts.isConstTypeReference(node.parent); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: // Don't return quickInfo if inside the comment in `a/**/.b` return !ts.isInComment(sourceFile, position); case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 106 /* SyntaxKind.SuperKeyword */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return true; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return ts.isImportMeta(node); default: return false; @@ -168098,15 +169724,15 @@ var ts; return undefined; } switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: case 10 /* SyntaxKind.StringLiteral */: case 95 /* SyntaxKind.FalseKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 106 /* SyntaxKind.SuperKeyword */: case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 79 /* SyntaxKind.Identifier */: break; // Cant create the text span @@ -168123,7 +169749,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -168253,12 +169879,14 @@ var ts; return ts.codefix.getAllFixes({ fixId: fixId, sourceFile: sourceFile, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences }); } function organizeImports(args, formatOptions, preferences) { + var _a; if (preferences === void 0) { preferences = ts.emptyOptions; } synchronizeHostData(); ts.Debug.assert(args.type === "file"); var sourceFile = getValidSourceFile(args.fileName); var formatContext = ts.formatting.getFormatContext(formatOptions, host); - return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences, args.skipDestructiveCodeActions); + var mode = (_a = args.mode) !== null && _a !== void 0 ? _a : (args.skipDestructiveCodeActions ? "SortAndCombine" /* OrganizeImportsMode.SortAndCombine */ : "All" /* OrganizeImportsMode.All */); + return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences, mode); } function getEditsForFileRename(oldFilePath, newFilePath, formatOptions, preferences) { if (preferences === void 0) { preferences = ts.emptyOptions; } @@ -168872,7 +170500,7 @@ var ts; */ function literalIsName(node) { return ts.isDeclarationName(node) || - node.parent.kind === 277 /* SyntaxKind.ExternalModuleReference */ || + node.parent.kind === 280 /* SyntaxKind.ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node); } @@ -168890,13 +170518,13 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined; } // falls through case 79 /* SyntaxKind.Identifier */: return ts.isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 286 /* SyntaxKind.JsxAttributes */) && + (node.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 289 /* SyntaxKind.JsxAttributes */) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -168938,7 +170566,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.argumentExpression === node; } /** @@ -169031,114 +170659,114 @@ var ts; if (node) { var parent = node.parent; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return spanInVariableDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return spanInParameterDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return spanInFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanInBlock(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInBlock(node.block); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: // span in statement return spanInNode(node.statement); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return spanInForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 203 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 205 /* SyntaxKind.BindingElement */: // span on complete node return textSpan(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: // span in statement return spanInNode(node.statement); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return spanInNodeArray(parent.modifiers, node, ts.isDecorator); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return undefined; // Tokens: case 26 /* SyntaxKind.SemicolonToken */: @@ -169168,7 +170796,7 @@ var ts; case 83 /* SyntaxKind.CatchKeyword */: case 96 /* SyntaxKind.FinallyKeyword */: return spanInNextNode(node); - case 160 /* SyntaxKind.OfKeyword */: + case 162 /* SyntaxKind.OfKeyword */: return spanInOfKeyword(node); default: // Destructuring pattern in destructuring assignment @@ -169181,13 +170809,13 @@ var ts; // `a` or `...c` or `d: x` from // `[a, b, ...c]` or `{ a, b }` or `{ d: x }` from destructuring pattern if ((node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 225 /* SyntaxKind.SpreadElement */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) && + node.kind === 227 /* SyntaxKind.SpreadElement */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(parent)) { return textSpan(node); } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { var _a = node, left = _a.left, operatorToken = _a.operatorToken; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of @@ -169209,22 +170837,22 @@ var ts; } if (ts.isExpressionNode(node)) { switch (parent.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return textSpan(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -169233,21 +170861,21 @@ var ts; } } switch (node.parent.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // If this is name of property assignment, set breakpoint in the initializer if (node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } break; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: // Breakpoint in type assertion goes to its operand if (node.parent.type === node) { return spanInNextNode(node.parent.type); } break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: { // initializer of variable/parameter declaration go to previous node var _b = node.parent, initializer = _b.initializer, type = _b.type; if (initializer === node || type === node || ts.isAssignmentOperator(node.kind)) { @@ -169255,7 +170883,7 @@ var ts; } break; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var left = node.parent.left; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) { // If initializer of destructuring assignment move to previous token @@ -169285,7 +170913,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } var parent = variableDeclaration.parent; @@ -169297,7 +170925,7 @@ var ts; // or its declaration from 'for of' if ((ts.hasOnlyExpressionInitializer(variableDeclaration) && variableDeclaration.initializer) || ts.hasSyntacticModifier(variableDeclaration, 1 /* ModifierFlags.Export */) || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } if (ts.isVariableDeclarationList(variableDeclaration.parent) && @@ -169338,7 +170966,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasSyntacticModifier(functionDeclaration, 1 /* ModifierFlags.Export */) || - (functionDeclaration.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 171 /* SyntaxKind.Constructor */); + (functionDeclaration.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 173 /* SyntaxKind.Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -169361,26 +170989,26 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -169405,21 +171033,21 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 203 /* SyntaxKind.BindingElement */) { + if (bindingPattern.parent.kind === 205 /* SyntaxKind.BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 202 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 201 /* SyntaxKind.ObjectBindingPattern */); - var elements = node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + ts.Debug.assert(node.kind !== 204 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 203 /* SyntaxKind.ObjectBindingPattern */); + var elements = node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -169427,18 +171055,18 @@ var ts; // just nested element in another destructuring assignment // set breakpoint on assignment when parent is destructuring assignment // Otherwise set breakpoint for this element - return textSpan(node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -169446,25 +171074,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // Span on close brace token return textSpan(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -169472,7 +171100,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -169488,7 +171116,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -169503,12 +171131,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead - node.parent.kind === 208 /* SyntaxKind.CallExpression */ || - node.parent.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead + node.parent.kind === 210 /* SyntaxKind.CallExpression */ || + node.parent.kind === 211 /* SyntaxKind.NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -169517,21 +171145,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -169541,20 +171169,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.parent.kind === 164 /* SyntaxKind.Parameter */) { + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.parent.kind === 166 /* SyntaxKind.Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.parent.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -169562,7 +171190,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -169611,7 +171239,7 @@ var debugObjectHost = (function () { return this; })(); // We need to use 'null' to interface with the managed side. -/* eslint-disable no-in-operator */ +/* eslint-disable local/no-in-operator */ /* @internal */ var ts; (function (ts) { @@ -170411,7 +172039,7 @@ var ts; }()); ts.TypeScriptServicesFactory = TypeScriptServicesFactory; })(ts || (ts = {})); -/* eslint-enable no-in-operator */ +/* eslint-enable local/no-in-operator */ // We polyfill `globalThis` here so re can reliably patch the global scope // in the contexts we want to in the same way across script and module formats /* eslint-enable no-var */ @@ -170838,6 +172466,12 @@ var ts; CommandTypes["ProvideInlayHints"] = "provideInlayHints"; // NOTE: If updating this, be sure to also update `allCommandNames` in `testRunner/unittests/tsserver/session.ts`. })(CommandTypes = protocol.CommandTypes || (protocol.CommandTypes = {})); + var OrganizeImportsMode; + (function (OrganizeImportsMode) { + OrganizeImportsMode["All"] = "All"; + OrganizeImportsMode["SortAndCombine"] = "SortAndCombine"; + OrganizeImportsMode["RemoveUnused"] = "RemoveUnused"; + })(OrganizeImportsMode = protocol.OrganizeImportsMode || (protocol.OrganizeImportsMode = {})); var WatchFileKind; (function (WatchFileKind) { WatchFileKind["FixedPollingInterval"] = "FixedPollingInterval"; @@ -171724,6 +173358,7 @@ var ts; this.watchOptions = watchOptions; this.rootFiles = []; this.rootFilesMap = new ts.Map(); + /*@internal*/ this.plugins = []; /*@internal*/ /** @@ -172252,6 +173887,7 @@ var ts; this.directoryStructureHost = undefined; this.exportMapCache = undefined; this.projectErrors = undefined; + this.plugins.length = 0; // Clean up file watchers waiting for missing files if (this.missingFilesMap) { ts.clearMap(this.missingFilesMap, ts.closeFileWatcher); @@ -172554,7 +174190,7 @@ var ts; ts.Debug.assert(!this.isClosed(), "Called update graph worker of closed project"); this.writeLog("Starting updateGraphWorker: Project: ".concat(this.getProjectName())); var start = ts.timestamp(); - this.hasInvalidatedResolution = this.resolutionCache.createHasInvalidatedResolution(); + this.hasInvalidatedResolutions = this.resolutionCache.createHasInvalidatedResolutions(ts.returnFalse); this.resolutionCache.startCachingPerDirectoryResolution(); this.program = this.languageService.getProgram(); // TODO: GH#18217 this.dirty = false; @@ -172925,35 +174561,39 @@ var ts; Project.prototype.isSourceOfProjectReferenceRedirect = function (fileName) { return !!this.program && this.program.isSourceOfProjectReferenceRedirect(fileName); }; + /*@internal*/ + Project.prototype.getGlobalPluginSearchPaths = function () { + // Search any globally-specified probe paths, then our peer node_modules + return __spreadArray(__spreadArray([], this.projectService.pluginProbeLocations, true), [ + // ../../.. to walk from X/node_modules/typescript/lib/tsserver.js to X/node_modules/ + ts.combinePaths(this.projectService.getExecutingFilePath(), "../../.."), + ], false); + }; Project.prototype.enableGlobalPlugins = function (options, pluginConfigOverrides) { + if (!this.projectService.globalPlugins.length) + return; var host = this.projectService.host; if (!host.require && !host.importPlugin) { this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded"); return; } - // Search any globally-specified probe paths, then our peer node_modules - var searchPaths = __spreadArray(__spreadArray([], this.projectService.pluginProbeLocations, true), [ - // ../../.. to walk from X/node_modules/typescript/lib/tsserver.js to X/node_modules/ - ts.combinePaths(this.projectService.getExecutingFilePath(), "../../.."), - ], false); - if (this.projectService.globalPlugins) { - var _loop_1 = function (globalPluginName) { - // Skip empty names from odd commandline parses - if (!globalPluginName) - return "continue"; - // Skip already-locally-loaded plugins - if (options.plugins && options.plugins.some(function (p) { return p.name === globalPluginName; })) - return "continue"; - // Provide global: true so plugins can detect why they can't find their config - this_1.projectService.logger.info("Loading global plugin ".concat(globalPluginName)); - this_1.enablePlugin({ name: globalPluginName, global: true }, searchPaths, pluginConfigOverrides); - }; - var this_1 = this; - // Enable global plugins with synthetic configuration entries - for (var _i = 0, _a = this.projectService.globalPlugins; _i < _a.length; _i++) { - var globalPluginName = _a[_i]; - _loop_1(globalPluginName); - } + // Enable global plugins with synthetic configuration entries + var searchPaths = this.getGlobalPluginSearchPaths(); + var _loop_1 = function (globalPluginName) { + // Skip empty names from odd commandline parses + if (!globalPluginName) + return "continue"; + // Skip already-locally-loaded plugins + if (options.plugins && options.plugins.some(function (p) { return p.name === globalPluginName; })) + return "continue"; + // Provide global: true so plugins can detect why they can't find their config + this_1.projectService.logger.info("Loading global plugin ".concat(globalPluginName)); + this_1.enablePlugin({ name: globalPluginName, global: true }, searchPaths, pluginConfigOverrides); + }; + var this_1 = this; + for (var _i = 0, _a = this.projectService.globalPlugins; _i < _a.length; _i++) { + var globalPluginName = _a[_i]; + _loop_1(globalPluginName); } }; /** @@ -173052,7 +174692,7 @@ var ts; var newLS = pluginModule.create(info); for (var _i = 0, _a = Object.keys(this.languageService); _i < _a.length; _i++) { var k = _a[_i]; - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!(k in newLS)) { this.projectService.logger.info("Plugin activation warning: Missing proxied method ".concat(k, " in created LS. Patching.")); newLS[k] = this.languageService[k]; @@ -173684,14 +175324,16 @@ var ts; }; /*@internal*/ ConfiguredProject.prototype.enablePluginsWithOptions = function (options, pluginConfigOverrides) { + var _a; + this.plugins.length = 0; + if (!((_a = options.plugins) === null || _a === void 0 ? void 0 : _a.length) && !this.projectService.globalPlugins.length) + return; var host = this.projectService.host; if (!host.require && !host.importPlugin) { this.projectService.logger.info("Plugins were requested but not running in environment that supports 'require'. Nothing will be loaded"); return; } - // Search our peer node_modules, then any globally-specified probe paths - // ../../.. to walk from X/node_modules/typescript/lib/tsserver.js to X/node_modules/ - var searchPaths = __spreadArray([ts.combinePaths(this.projectService.getExecutingFilePath(), "../../..")], this.projectService.pluginProbeLocations, true); + var searchPaths = this.getGlobalPluginSearchPaths(); if (this.projectService.allowLocalPluginLoads) { var local = ts.getDirectoryPath(this.canonicalConfigFilePath); this.projectService.logger.info("Local plugin loading enabled; adding ".concat(local, " to search paths")); @@ -173699,8 +175341,8 @@ var ts; } // Enable tsconfig-specified plugins if (options.plugins) { - for (var _i = 0, _a = options.plugins; _i < _a.length; _i++) { - var pluginConfigEntry = _a[_i]; + for (var _i = 0, _b = options.plugins; _i < _b.length; _i++) { + var pluginConfigEntry = _b[_i]; this.enablePlugin(pluginConfigEntry, searchPaths, pluginConfigOverrides); } } @@ -174339,7 +175981,7 @@ var ts; // raw is now fixed and ready this.safelist = raw.typesMap; for (var key in raw.simpleMap) { - if (raw.simpleMap.hasOwnProperty(key)) { + if (ts.hasProperty(raw.simpleMap, key)) { this.legacySafelist.set(key, raw.simpleMap[key].toLowerCase()); } } @@ -174545,18 +176187,20 @@ var ts; return ensureProject ? this.ensureDefaultProjectForFile(fileName) : this.tryGetDefaultProjectForFile(fileName); }; /* @internal */ - ProjectService.prototype.tryGetDefaultProjectForFile = function (fileName) { - var scriptInfo = this.getScriptInfoForNormalizedPath(fileName); + ProjectService.prototype.tryGetDefaultProjectForFile = function (fileNameOrScriptInfo) { + var scriptInfo = ts.isString(fileNameOrScriptInfo) ? this.getScriptInfoForNormalizedPath(fileNameOrScriptInfo) : fileNameOrScriptInfo; return scriptInfo && !scriptInfo.isOrphan() ? scriptInfo.getDefaultProject() : undefined; }; /* @internal */ - ProjectService.prototype.ensureDefaultProjectForFile = function (fileName) { - return this.tryGetDefaultProjectForFile(fileName) || this.doEnsureDefaultProjectForFile(fileName); + ProjectService.prototype.ensureDefaultProjectForFile = function (fileNameOrScriptInfo) { + return this.tryGetDefaultProjectForFile(fileNameOrScriptInfo) || this.doEnsureDefaultProjectForFile(fileNameOrScriptInfo); }; - ProjectService.prototype.doEnsureDefaultProjectForFile = function (fileName) { + ProjectService.prototype.doEnsureDefaultProjectForFile = function (fileNameOrScriptInfo) { this.ensureProjectStructuresUptoDate(); - var scriptInfo = this.getScriptInfoForNormalizedPath(fileName); - return scriptInfo ? scriptInfo.getDefaultProject() : (this.logErrorForScriptInfoNotFound(fileName), server.Errors.ThrowNoProject()); + var scriptInfo = ts.isString(fileNameOrScriptInfo) ? this.getScriptInfoForNormalizedPath(fileNameOrScriptInfo) : fileNameOrScriptInfo; + return scriptInfo ? + scriptInfo.getDefaultProject() : + (this.logErrorForScriptInfoNotFound(ts.isString(fileNameOrScriptInfo) ? fileNameOrScriptInfo : fileNameOrScriptInfo.fileName), server.Errors.ThrowNoProject()); }; ProjectService.prototype.getScriptInfoEnsuringProjectsUptoDate = function (uncheckedFileName) { this.ensureProjectStructuresUptoDate(); @@ -176728,7 +178372,7 @@ var ts; if (this.serverMode !== ts.LanguageServiceMode.Semantic || !this.eventHandler || !scriptInfo.isJavaScript() || !ts.addToSeen(this.allJsFilesForOpenFileTelemetry, scriptInfo.path)) { return; } - var project = scriptInfo.getDefaultProject(); + var project = this.ensureDefaultProjectForFile(scriptInfo); if (!project.languageServiceEnabled) { return; } @@ -177753,7 +179397,6 @@ var ts; } return ts.deduplicate(outputs, ts.equateValues); } - ; function createDocumentSpanSet() { return ts.createSet(function (_a) { var textSpan = _a.textSpan; @@ -179103,7 +180746,7 @@ var ts; } var initialNode = ts.getTouchingPropertyName(program.getSourceFile(file), position); var symbol = program.getTypeChecker().getSymbolAtLocation(initialNode); - var importSpecifier = symbol && ts.getDeclarationOfKind(symbol, 270 /* SyntaxKind.ImportSpecifier */); + var importSpecifier = symbol && ts.getDeclarationOfKind(symbol, 273 /* SyntaxKind.ImportSpecifier */); if (!importSpecifier) return undefined; var nameToSearch = ((_a = importSpecifier.propertyName) === null || _a === void 0 ? void 0 : _a.text) || importSpecifier.name.text; @@ -179329,6 +180972,10 @@ var ts; this.projectService.logErrorForScriptInfoNotFound(args.file); return server.Errors.ThrowNoProject(); } + else if (!getScriptInfoEnsuringProjectsUptoDate) { + // Ensure there are containing projects are present + this.projectService.ensureDefaultProjectForFile(scriptInfo); + } projects = scriptInfo.containingProjects; symLinkedProjects = this.projectService.getSymlinkedProjects(scriptInfo); } @@ -179397,6 +181044,7 @@ var ts; var references = getReferencesWorker(projects, this.getDefaultProject(args), { fileName: args.file, pos: position }, this.logger); if (!simplifiedResult) return references; + var preferences = this.getPreferences(file); var defaultProject = this.getDefaultProject(args); var scriptInfo = defaultProject.getScriptInfoForNormalizedPath(file); var nameInfo = defaultProject.getLanguageService().getQuickInfoAtPosition(file, position); @@ -179405,7 +181053,7 @@ var ts; var symbolStartOffset = nameSpan ? scriptInfo.positionToLineOffset(nameSpan.start).offset : 0; var symbolName = nameSpan ? scriptInfo.getSnapshot().getText(nameSpan.start, ts.textSpanEnd(nameSpan)) : ""; var refs = ts.flatMap(references, function (referencedSymbol) { - return referencedSymbol.references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry); }); + return referencedSymbol.references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry, preferences); }); }); return { refs: refs, symbolName: symbolName, symbolStartOffset: symbolStartOffset, symbolDisplayString: symbolDisplayString }; }; @@ -179413,6 +181061,7 @@ var ts; var _this = this; var projects = this.getProjects(args); var fileName = args.file; + var preferences = this.getPreferences(server.toNormalizedPath(fileName)); var references = []; var seen = createDocumentSpanSet(); forEachProjectInProjects(projects, /*path*/ undefined, function (project) { @@ -179431,7 +181080,7 @@ var ts; }); if (!simplifiedResult) return references; - var refs = references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry); }); + var refs = references.map(function (entry) { return referenceEntryToReferencesResponseItem(_this.projectService, entry, preferences); }); return { refs: refs, symbolName: "\"".concat(args.file, "\"") @@ -179455,13 +181104,7 @@ var ts; return this.getFileAndProjectWorker(args.file, args.projectFileName); }; Session.prototype.getFileAndLanguageServiceForSyntacticOperation = function (args) { - // Since this is syntactic operation, there should always be project for the file - // we wouldnt have to ensure project but rather throw if we dont get project - var file = server.toNormalizedPath(args.file); - var project = this.getProject(args.projectFileName) || this.projectService.tryGetDefaultProjectForFile(file); - if (!project) { - return server.Errors.ThrowNoProject(); - } + var _a = this.getFileAndProject(args), file = _a.file, project = _a.project; return { file: file, languageService: project.getLanguageService(/*ensureSynchronized*/ false) @@ -180002,11 +181645,12 @@ var ts; } }; Session.prototype.organizeImports = function (args, simplifiedResult) { + var _a; ts.Debug.assert(args.scope.type === "file"); - var _a = this.getFileAndProject(args.scope.args), file = _a.file, project = _a.project; + var _b = this.getFileAndProject(args.scope.args), file = _b.file, project = _b.project; var changes = project.getLanguageService().organizeImports({ fileName: file, - skipDestructiveCodeActions: args.skipDestructiveCodeActions, + mode: (_a = args.mode) !== null && _a !== void 0 ? _a : (args.skipDestructiveCodeActions ? "SortAndCombine" /* OrganizeImportsMode.SortAndCombine */ : undefined), type: "file", }, this.getFormatOptions(file), this.getPreferences(file)); if (simplifiedResult) { @@ -180500,14 +182144,18 @@ var ts; } return text; } - function referenceEntryToReferencesResponseItem(projectService, _a) { + function referenceEntryToReferencesResponseItem(projectService, _a, _b) { var fileName = _a.fileName, textSpan = _a.textSpan, contextSpan = _a.contextSpan, isWriteAccess = _a.isWriteAccess, isDefinition = _a.isDefinition; + var disableLineTextInReferences = _b.disableLineTextInReferences; var scriptInfo = ts.Debug.checkDefined(projectService.getScriptInfo(fileName)); var span = toProtocolTextSpanWithContext(textSpan, contextSpan, scriptInfo); - var lineSpan = scriptInfo.lineToTextSpan(span.start.line - 1); - var lineText = scriptInfo.getSnapshot().getText(lineSpan.start, ts.textSpanEnd(lineSpan)).replace(/\r|\n/g, ""); + var lineText = disableLineTextInReferences ? undefined : getLineText(scriptInfo, span); return __assign(__assign({ file: fileName }, span), { lineText: lineText, isWriteAccess: isWriteAccess, isDefinition: isDefinition }); } + function getLineText(scriptInfo, span) { + var lineSpan = scriptInfo.lineToTextSpan(span.start.line - 1); + return scriptInfo.getSnapshot().getText(lineSpan.start, ts.textSpanEnd(lineSpan)).replace(/\r|\n/g, ""); + } function isCompletionEntryData(data) { return data === undefined || data && typeof data === "object" && typeof data.exportName === "string" @@ -181997,7 +183645,7 @@ var ts; if (typeof value === "number") { return ts.factory.createNumericLiteral(value); } - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (typeof value === "object" && "base10Value" in value) { // PseudoBigInt return ts.factory.createBigIntLiteral(value); } @@ -182025,7 +183673,7 @@ var ts; } else { type = operatorOrType; - operator = 140 /* SyntaxKind.KeyOfKeyword */; + operator = 141 /* SyntaxKind.KeyOfKeyword */; } return ts.factory.createTypeOperatorNode(operator, type); }, factoryDeprecation); @@ -182203,7 +183851,7 @@ var ts; ts.createNode = ts.Debug.deprecate(function createNode(kind, pos, end) { if (pos === void 0) { pos = 0; } if (end === void 0) { end = 0; } - return ts.setTextRangePosEnd(kind === 305 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : + return ts.setTextRangePosEnd(kind === 308 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : kind === 79 /* SyntaxKind.Identifier */ ? ts.parseBaseNodeFactory.createBaseIdentifierNode(kind) : kind === 80 /* SyntaxKind.PrivateIdentifier */ ? ts.parseBaseNodeFactory.createBasePrivateIdentifierNode(kind) : !ts.isNodeKind(kind) ? ts.parseBaseNodeFactory.createBaseTokenNode(kind) : @@ -182233,7 +183881,7 @@ var ts; (function (ts) { /** @deprecated Use `isTypeAssertionExpression` instead. */ ts.isTypeAssertion = ts.Debug.deprecate(function isTypeAssertion(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; }, { since: "4.0", warnAfter: "4.1", diff --git a/node_modules/typescript/lib/typescript.d.ts b/node_modules/typescript/lib/typescript.d.ts index 0fd60ae88..54e4c654e 100644 --- a/node_modules/typescript/lib/typescript.d.ts +++ b/node_modules/typescript/lib/typescript.d.ts @@ -14,7 +14,7 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { - const versionMajorMinor = "4.8"; + const versionMajorMinor = "4.9"; /** The version of the TypeScript compiler release */ const version: string; /** @@ -232,237 +232,240 @@ declare namespace ts { StaticKeyword = 124, YieldKeyword = 125, AbstractKeyword = 126, - AsKeyword = 127, - AssertsKeyword = 128, - AssertKeyword = 129, - AnyKeyword = 130, - AsyncKeyword = 131, - AwaitKeyword = 132, - BooleanKeyword = 133, - ConstructorKeyword = 134, - DeclareKeyword = 135, - GetKeyword = 136, - InferKeyword = 137, - IntrinsicKeyword = 138, - IsKeyword = 139, - KeyOfKeyword = 140, - ModuleKeyword = 141, - NamespaceKeyword = 142, - NeverKeyword = 143, - OutKeyword = 144, - ReadonlyKeyword = 145, - RequireKeyword = 146, - NumberKeyword = 147, - ObjectKeyword = 148, - SetKeyword = 149, - StringKeyword = 150, - SymbolKeyword = 151, - TypeKeyword = 152, - UndefinedKeyword = 153, - UniqueKeyword = 154, - UnknownKeyword = 155, - FromKeyword = 156, - GlobalKeyword = 157, - BigIntKeyword = 158, - OverrideKeyword = 159, - OfKeyword = 160, - QualifiedName = 161, - ComputedPropertyName = 162, - TypeParameter = 163, - Parameter = 164, - Decorator = 165, - PropertySignature = 166, - PropertyDeclaration = 167, - MethodSignature = 168, - MethodDeclaration = 169, - ClassStaticBlockDeclaration = 170, - Constructor = 171, - GetAccessor = 172, - SetAccessor = 173, - CallSignature = 174, - ConstructSignature = 175, - IndexSignature = 176, - TypePredicate = 177, - TypeReference = 178, - FunctionType = 179, - ConstructorType = 180, - TypeQuery = 181, - TypeLiteral = 182, - ArrayType = 183, - TupleType = 184, - OptionalType = 185, - RestType = 186, - UnionType = 187, - IntersectionType = 188, - ConditionalType = 189, - InferType = 190, - ParenthesizedType = 191, - ThisType = 192, - TypeOperator = 193, - IndexedAccessType = 194, - MappedType = 195, - LiteralType = 196, - NamedTupleMember = 197, - TemplateLiteralType = 198, - TemplateLiteralTypeSpan = 199, - ImportType = 200, - ObjectBindingPattern = 201, - ArrayBindingPattern = 202, - BindingElement = 203, - ArrayLiteralExpression = 204, - ObjectLiteralExpression = 205, - PropertyAccessExpression = 206, - ElementAccessExpression = 207, - CallExpression = 208, - NewExpression = 209, - TaggedTemplateExpression = 210, - TypeAssertionExpression = 211, - ParenthesizedExpression = 212, - FunctionExpression = 213, - ArrowFunction = 214, - DeleteExpression = 215, - TypeOfExpression = 216, - VoidExpression = 217, - AwaitExpression = 218, - PrefixUnaryExpression = 219, - PostfixUnaryExpression = 220, - BinaryExpression = 221, - ConditionalExpression = 222, - TemplateExpression = 223, - YieldExpression = 224, - SpreadElement = 225, - ClassExpression = 226, - OmittedExpression = 227, - ExpressionWithTypeArguments = 228, - AsExpression = 229, - NonNullExpression = 230, - MetaProperty = 231, - SyntheticExpression = 232, - TemplateSpan = 233, - SemicolonClassElement = 234, - Block = 235, - EmptyStatement = 236, - VariableStatement = 237, - ExpressionStatement = 238, - IfStatement = 239, - DoStatement = 240, - WhileStatement = 241, - ForStatement = 242, - ForInStatement = 243, - ForOfStatement = 244, - ContinueStatement = 245, - BreakStatement = 246, - ReturnStatement = 247, - WithStatement = 248, - SwitchStatement = 249, - LabeledStatement = 250, - ThrowStatement = 251, - TryStatement = 252, - DebuggerStatement = 253, - VariableDeclaration = 254, - VariableDeclarationList = 255, - FunctionDeclaration = 256, - ClassDeclaration = 257, - InterfaceDeclaration = 258, - TypeAliasDeclaration = 259, - EnumDeclaration = 260, - ModuleDeclaration = 261, - ModuleBlock = 262, - CaseBlock = 263, - NamespaceExportDeclaration = 264, - ImportEqualsDeclaration = 265, - ImportDeclaration = 266, - ImportClause = 267, - NamespaceImport = 268, - NamedImports = 269, - ImportSpecifier = 270, - ExportAssignment = 271, - ExportDeclaration = 272, - NamedExports = 273, - NamespaceExport = 274, - ExportSpecifier = 275, - MissingDeclaration = 276, - ExternalModuleReference = 277, - JsxElement = 278, - JsxSelfClosingElement = 279, - JsxOpeningElement = 280, - JsxClosingElement = 281, - JsxFragment = 282, - JsxOpeningFragment = 283, - JsxClosingFragment = 284, - JsxAttribute = 285, - JsxAttributes = 286, - JsxSpreadAttribute = 287, - JsxExpression = 288, - CaseClause = 289, - DefaultClause = 290, - HeritageClause = 291, - CatchClause = 292, - AssertClause = 293, - AssertEntry = 294, - ImportTypeAssertionContainer = 295, - PropertyAssignment = 296, - ShorthandPropertyAssignment = 297, - SpreadAssignment = 298, - EnumMember = 299, - UnparsedPrologue = 300, - UnparsedPrepend = 301, - UnparsedText = 302, - UnparsedInternalText = 303, - UnparsedSyntheticReference = 304, - SourceFile = 305, - Bundle = 306, - UnparsedSource = 307, - InputFiles = 308, - JSDocTypeExpression = 309, - JSDocNameReference = 310, - JSDocMemberName = 311, - JSDocAllType = 312, - JSDocUnknownType = 313, - JSDocNullableType = 314, - JSDocNonNullableType = 315, - JSDocOptionalType = 316, - JSDocFunctionType = 317, - JSDocVariadicType = 318, - JSDocNamepathType = 319, - JSDoc = 320, + AccessorKeyword = 127, + AsKeyword = 128, + AssertsKeyword = 129, + AssertKeyword = 130, + AnyKeyword = 131, + AsyncKeyword = 132, + AwaitKeyword = 133, + BooleanKeyword = 134, + ConstructorKeyword = 135, + DeclareKeyword = 136, + GetKeyword = 137, + InferKeyword = 138, + IntrinsicKeyword = 139, + IsKeyword = 140, + KeyOfKeyword = 141, + ModuleKeyword = 142, + NamespaceKeyword = 143, + NeverKeyword = 144, + OutKeyword = 145, + ReadonlyKeyword = 146, + RequireKeyword = 147, + NumberKeyword = 148, + ObjectKeyword = 149, + SatisfiesKeyword = 150, + SetKeyword = 151, + StringKeyword = 152, + SymbolKeyword = 153, + TypeKeyword = 154, + UndefinedKeyword = 155, + UniqueKeyword = 156, + UnknownKeyword = 157, + FromKeyword = 158, + GlobalKeyword = 159, + BigIntKeyword = 160, + OverrideKeyword = 161, + OfKeyword = 162, + QualifiedName = 163, + ComputedPropertyName = 164, + TypeParameter = 165, + Parameter = 166, + Decorator = 167, + PropertySignature = 168, + PropertyDeclaration = 169, + MethodSignature = 170, + MethodDeclaration = 171, + ClassStaticBlockDeclaration = 172, + Constructor = 173, + GetAccessor = 174, + SetAccessor = 175, + CallSignature = 176, + ConstructSignature = 177, + IndexSignature = 178, + TypePredicate = 179, + TypeReference = 180, + FunctionType = 181, + ConstructorType = 182, + TypeQuery = 183, + TypeLiteral = 184, + ArrayType = 185, + TupleType = 186, + OptionalType = 187, + RestType = 188, + UnionType = 189, + IntersectionType = 190, + ConditionalType = 191, + InferType = 192, + ParenthesizedType = 193, + ThisType = 194, + TypeOperator = 195, + IndexedAccessType = 196, + MappedType = 197, + LiteralType = 198, + NamedTupleMember = 199, + TemplateLiteralType = 200, + TemplateLiteralTypeSpan = 201, + ImportType = 202, + ObjectBindingPattern = 203, + ArrayBindingPattern = 204, + BindingElement = 205, + ArrayLiteralExpression = 206, + ObjectLiteralExpression = 207, + PropertyAccessExpression = 208, + ElementAccessExpression = 209, + CallExpression = 210, + NewExpression = 211, + TaggedTemplateExpression = 212, + TypeAssertionExpression = 213, + ParenthesizedExpression = 214, + FunctionExpression = 215, + ArrowFunction = 216, + DeleteExpression = 217, + TypeOfExpression = 218, + VoidExpression = 219, + AwaitExpression = 220, + PrefixUnaryExpression = 221, + PostfixUnaryExpression = 222, + BinaryExpression = 223, + ConditionalExpression = 224, + TemplateExpression = 225, + YieldExpression = 226, + SpreadElement = 227, + ClassExpression = 228, + OmittedExpression = 229, + ExpressionWithTypeArguments = 230, + AsExpression = 231, + NonNullExpression = 232, + MetaProperty = 233, + SyntheticExpression = 234, + SatisfiesExpression = 235, + TemplateSpan = 236, + SemicolonClassElement = 237, + Block = 238, + EmptyStatement = 239, + VariableStatement = 240, + ExpressionStatement = 241, + IfStatement = 242, + DoStatement = 243, + WhileStatement = 244, + ForStatement = 245, + ForInStatement = 246, + ForOfStatement = 247, + ContinueStatement = 248, + BreakStatement = 249, + ReturnStatement = 250, + WithStatement = 251, + SwitchStatement = 252, + LabeledStatement = 253, + ThrowStatement = 254, + TryStatement = 255, + DebuggerStatement = 256, + VariableDeclaration = 257, + VariableDeclarationList = 258, + FunctionDeclaration = 259, + ClassDeclaration = 260, + InterfaceDeclaration = 261, + TypeAliasDeclaration = 262, + EnumDeclaration = 263, + ModuleDeclaration = 264, + ModuleBlock = 265, + CaseBlock = 266, + NamespaceExportDeclaration = 267, + ImportEqualsDeclaration = 268, + ImportDeclaration = 269, + ImportClause = 270, + NamespaceImport = 271, + NamedImports = 272, + ImportSpecifier = 273, + ExportAssignment = 274, + ExportDeclaration = 275, + NamedExports = 276, + NamespaceExport = 277, + ExportSpecifier = 278, + MissingDeclaration = 279, + ExternalModuleReference = 280, + JsxElement = 281, + JsxSelfClosingElement = 282, + JsxOpeningElement = 283, + JsxClosingElement = 284, + JsxFragment = 285, + JsxOpeningFragment = 286, + JsxClosingFragment = 287, + JsxAttribute = 288, + JsxAttributes = 289, + JsxSpreadAttribute = 290, + JsxExpression = 291, + CaseClause = 292, + DefaultClause = 293, + HeritageClause = 294, + CatchClause = 295, + AssertClause = 296, + AssertEntry = 297, + ImportTypeAssertionContainer = 298, + PropertyAssignment = 299, + ShorthandPropertyAssignment = 300, + SpreadAssignment = 301, + EnumMember = 302, + UnparsedPrologue = 303, + UnparsedPrepend = 304, + UnparsedText = 305, + UnparsedInternalText = 306, + UnparsedSyntheticReference = 307, + SourceFile = 308, + Bundle = 309, + UnparsedSource = 310, + InputFiles = 311, + JSDocTypeExpression = 312, + JSDocNameReference = 313, + JSDocMemberName = 314, + JSDocAllType = 315, + JSDocUnknownType = 316, + JSDocNullableType = 317, + JSDocNonNullableType = 318, + JSDocOptionalType = 319, + JSDocFunctionType = 320, + JSDocVariadicType = 321, + JSDocNamepathType = 322, + JSDoc = 323, /** @deprecated Use SyntaxKind.JSDoc */ - JSDocComment = 320, - JSDocText = 321, - JSDocTypeLiteral = 322, - JSDocSignature = 323, - JSDocLink = 324, - JSDocLinkCode = 325, - JSDocLinkPlain = 326, - JSDocTag = 327, - JSDocAugmentsTag = 328, - JSDocImplementsTag = 329, - JSDocAuthorTag = 330, - JSDocDeprecatedTag = 331, - JSDocClassTag = 332, - JSDocPublicTag = 333, - JSDocPrivateTag = 334, - JSDocProtectedTag = 335, - JSDocReadonlyTag = 336, - JSDocOverrideTag = 337, - JSDocCallbackTag = 338, - JSDocEnumTag = 339, - JSDocParameterTag = 340, - JSDocReturnTag = 341, - JSDocThisTag = 342, - JSDocTypeTag = 343, - JSDocTemplateTag = 344, - JSDocTypedefTag = 345, - JSDocSeeTag = 346, - JSDocPropertyTag = 347, - SyntaxList = 348, - NotEmittedStatement = 349, - PartiallyEmittedExpression = 350, - CommaListExpression = 351, - MergeDeclarationMarker = 352, - EndOfDeclarationMarker = 353, - SyntheticReferenceExpression = 354, - Count = 355, + JSDocComment = 323, + JSDocText = 324, + JSDocTypeLiteral = 325, + JSDocSignature = 326, + JSDocLink = 327, + JSDocLinkCode = 328, + JSDocLinkPlain = 329, + JSDocTag = 330, + JSDocAugmentsTag = 331, + JSDocImplementsTag = 332, + JSDocAuthorTag = 333, + JSDocDeprecatedTag = 334, + JSDocClassTag = 335, + JSDocPublicTag = 336, + JSDocPrivateTag = 337, + JSDocProtectedTag = 338, + JSDocReadonlyTag = 339, + JSDocOverrideTag = 340, + JSDocCallbackTag = 341, + JSDocEnumTag = 342, + JSDocParameterTag = 343, + JSDocReturnTag = 344, + JSDocThisTag = 345, + JSDocTypeTag = 346, + JSDocTemplateTag = 347, + JSDocTypedefTag = 348, + JSDocSeeTag = 349, + JSDocPropertyTag = 350, + SyntaxList = 351, + NotEmittedStatement = 352, + PartiallyEmittedExpression = 353, + CommaListExpression = 354, + MergeDeclarationMarker = 355, + EndOfDeclarationMarker = 356, + SyntheticReferenceExpression = 357, + Count = 358, FirstAssignment = 63, LastAssignment = 78, FirstCompoundAssignment = 64, @@ -470,15 +473,15 @@ declare namespace ts { FirstReservedWord = 81, LastReservedWord = 116, FirstKeyword = 81, - LastKeyword = 160, + LastKeyword = 162, FirstFutureReservedWord = 117, LastFutureReservedWord = 125, - FirstTypeNode = 177, - LastTypeNode = 200, + FirstTypeNode = 179, + LastTypeNode = 202, FirstPunctuation = 18, LastPunctuation = 78, FirstToken = 0, - LastToken = 160, + LastToken = 162, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -487,20 +490,20 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 29, LastBinaryOperator = 78, - FirstStatement = 237, - LastStatement = 253, - FirstNode = 161, - FirstJSDocNode = 309, - LastJSDocNode = 347, - FirstJSDocTagNode = 327, - LastJSDocTagNode = 347, + FirstStatement = 240, + LastStatement = 256, + FirstNode = 163, + FirstJSDocNode = 312, + LastJSDocNode = 350, + FirstJSDocTagNode = 330, + LastJSDocTagNode = 350, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail; export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; - export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; - export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; + export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; + export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind; export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; @@ -545,9 +548,10 @@ declare namespace ts { Protected = 16, Static = 32, Readonly = 64, - Abstract = 128, - Async = 256, - Default = 512, + Accessor = 128, + Abstract = 256, + Async = 512, + Default = 1024, Const = 2048, HasComputedJSDocModifiers = 4096, Deprecated = 8192, @@ -559,10 +563,10 @@ declare namespace ts { AccessibilityModifier = 28, ParameterPropertyModifier = 16476, NonPublicAccessibilityModifier = 24, - TypeScriptModifier = 116958, - ExportDefault = 513, - All = 257023, - Modifier = 125951 + TypeScriptModifier = 117086, + ExportDefault = 1025, + All = 258047, + Modifier = 126975 } export enum JsxFlags { None = 0, @@ -618,6 +622,7 @@ declare namespace ts { export interface ModifierToken extends KeywordToken { } export type AbstractKeyword = ModifierToken; + export type AccessorKeyword = ModifierToken; export type AsyncKeyword = ModifierToken; export type ConstKeyword = ModifierToken; export type DeclareKeyword = ModifierToken; @@ -633,11 +638,11 @@ declare namespace ts { export type StaticKeyword = ModifierToken; /** @deprecated Use `ReadonlyKeyword` instead. */ export type ReadonlyToken = ReadonlyKeyword; - export type Modifier = AbstractKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; + export type Modifier = AbstractKeyword | AccessorKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; export type ModifierLike = Modifier | Decorator; export type AccessibilityModifier = PublicKeyword | PrivateKeyword | ProtectedKeyword; export type ParameterPropertyModifier = AccessibilityModifier | ReadonlyKeyword; - export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword; + export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword | AccessorKeyword; export type ModifiersArray = NodeArray; export enum GeneratedIdentifierFlags { None = 0, @@ -764,6 +769,9 @@ declare namespace ts { readonly type?: TypeNode; readonly initializer?: Expression; } + export interface AutoAccessorPropertyDeclaration extends PropertyDeclaration { + _autoAccessorBrand: any; + } export interface ObjectLiteralElement extends NamedDeclaration { _objectLiteralBrand: any; readonly name?: PropertyName; @@ -1340,6 +1348,11 @@ declare namespace ts { readonly type: TypeNode; readonly expression: UnaryExpression; } + export interface SatisfiesExpression extends Expression { + readonly kind: SyntaxKind.SatisfiesExpression; + readonly expression: Expression; + readonly type: TypeNode; + } export type AssertionExpression = TypeAssertion | AsExpression; export interface NonNullExpression extends LeftHandSideExpression { readonly kind: SyntaxKind.NonNullExpression; @@ -2316,6 +2329,7 @@ declare namespace ts { getPrivateIdentifierPropertyOfType(leftType: Type, name: string, location: Node): Symbol | undefined; getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo | undefined; getIndexInfosOfType(type: Type): readonly IndexInfo[]; + getIndexInfosOfIndexSymbol: (indexSymbol: Symbol) => IndexInfo[]; getSignaturesOfType(type: Type, kind: SignatureKind): readonly Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type | undefined; getBaseTypes(type: InterfaceType): BaseType[]; @@ -2562,6 +2576,7 @@ declare namespace ts { MethodExcludes = 103359, GetAccessorExcludes = 46015, SetAccessorExcludes = 78783, + AccessorExcludes = 13247, TypeParameterExcludes = 526824, TypeAliasExcludes = 788968, AliasExcludes = 2097152, @@ -2832,7 +2847,7 @@ declare namespace ts { export interface SubstitutionType extends InstantiableType { objectFlags: ObjectFlags; baseType: Type; - substitute: Type; + constraint: Type; } export enum SignatureKind { Call = 0, @@ -3305,6 +3320,8 @@ declare namespace ts { */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; getEnvironmentVariable?(name: string): string | undefined; + /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ + hasInvalidatedResolutions?(filePath: Path): boolean; createHash?(data: string): string; getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined; } @@ -3387,7 +3404,7 @@ declare namespace ts { createNumericLiteral(value: string | number, numericLiteralFlags?: TokenFlags): NumericLiteral; createBigIntLiteral(value: string | PseudoBigInt): BigIntLiteral; createStringLiteral(text: string, isSingleQuote?: boolean): StringLiteral; - createStringLiteralFromNode(sourceNode: PropertyNameLiteral, isSingleQuote?: boolean): StringLiteral; + createStringLiteralFromNode(sourceNode: PropertyNameLiteral | PrivateIdentifier, isSingleQuote?: boolean): StringLiteral; createRegularExpressionLiteral(text: string): RegularExpressionLiteral; createIdentifier(text: string): Identifier; /** @@ -3412,6 +3429,8 @@ declare namespace ts { /** Create a unique name generated for a node. */ getGeneratedNameForNode(node: Node | undefined, flags?: GeneratedIdentifierFlags): Identifier; createPrivateIdentifier(text: string): PrivateIdentifier; + createUniquePrivateName(text?: string): PrivateIdentifier; + getGeneratedPrivateNameForNode(node: Node): PrivateIdentifier; createToken(token: SyntaxKind.SuperKeyword): SuperExpression; createToken(token: SyntaxKind.ThisKeyword): ThisExpression; createToken(token: SyntaxKind.NullKeyword): NullLiteral; @@ -3587,6 +3606,8 @@ declare namespace ts { updateNonNullChain(node: NonNullChain, expression: Expression): NonNullChain; createMetaProperty(keywordToken: MetaProperty["keywordToken"], name: Identifier): MetaProperty; updateMetaProperty(node: MetaProperty, name: Identifier): MetaProperty; + createSatisfiesExpression(expression: Expression, type: TypeNode): SatisfiesExpression; + updateSatisfiesExpression(node: SatisfiesExpression, expression: Expression, type: TypeNode): SatisfiesExpression; createTemplateSpan(expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; createSemicolonClassElement(): SemicolonClassElement; @@ -3948,7 +3969,7 @@ declare namespace ts { (nodes: NodeArray, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray; (nodes: NodeArray | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray | undefined; } - export type VisitResult = T | T[] | undefined; + export type VisitResult = T | readonly T[] | undefined; export interface Printer { /** * Print a node and its subtree as-is, without any emit transformations. @@ -4515,6 +4536,7 @@ declare namespace ts { function isClassElement(node: Node): node is ClassElement; function isClassLike(node: Node): node is ClassLikeDeclaration; function isAccessor(node: Node): node is AccessorDeclaration; + function isAutoAccessorPropertyDeclaration(node: Node): node is AutoAccessorPropertyDeclaration; function isModifierLike(node: Node): node is ModifierLike; function isTypeElement(node: Node): node is TypeElement; function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement; @@ -4716,6 +4738,7 @@ declare namespace ts { function isOmittedExpression(node: Node): node is OmittedExpression; function isExpressionWithTypeArguments(node: Node): node is ExpressionWithTypeArguments; function isAsExpression(node: Node): node is AsExpression; + function isSatisfiesExpression(node: Node): node is SatisfiesExpression; function isNonNullExpression(node: Node): node is NonNullExpression; function isMetaProperty(node: Node): node is MetaProperty; function isSyntheticExpression(node: Node): node is SyntheticExpression; @@ -5376,9 +5399,9 @@ declare namespace ts { /** If provided, called with Diagnostic message that informs about change in watch status */ onWatchStatusChange?(diagnostic: Diagnostic, newLine: string, options: CompilerOptions, errorCount?: number): void; /** Used to watch changes in source files, missing files needed to update the program or config file */ - watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: CompilerOptions): FileWatcher; + watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: WatchOptions): FileWatcher; /** Used to watch resolved module's failed lookup locations, config file specs, type roots where auto type reference directives are added */ - watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: CompilerOptions): FileWatcher; + watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: WatchOptions): FileWatcher; /** If provided, will be used to set delayed compilation, so that multiple changes in short span are compiled together */ setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; /** If provided, will be used to reset existing delayed compilation */ @@ -5421,6 +5444,8 @@ declare namespace ts { resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[]; /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; + /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ + hasInvalidatedResolutions?(filePath: Path): boolean; /** * Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it */ @@ -6007,8 +6032,15 @@ declare namespace ts { type: "file"; fileName: string; } + enum OrganizeImportsMode { + All = "All", + SortAndCombine = "SortAndCombine", + RemoveUnused = "RemoveUnused" + } interface OrganizeImportsArgs extends CombinedCodeFixScope { + /** @deprecated Use `mode` instead */ skipDestructiveCodeActions?: boolean; + mode?: OrganizeImportsMode; } type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<" | "#" | " "; enum CompletionTriggerKind { @@ -6526,7 +6558,7 @@ declare namespace ts { isGlobalCompletion: boolean; isMemberCompletion: boolean; /** - * In the absence of `CompletionEntry["replacementSpan"], the editor may choose whether to use + * In the absence of `CompletionEntry["replacementSpan"]`, the editor may choose whether to use * this span or its default one. If `CompletionEntry["replacementSpan"]` is defined, that span * must be used to commit that completion entry. */ @@ -6739,6 +6771,8 @@ declare namespace ts { * interface Y { foo:number; } */ memberVariableElement = "property", + /** class X { [public|private]* accessor foo: number; } */ + memberAccessorVariableElement = "accessor", /** * class X { constructor() { } } * class X { static { } } @@ -7018,7 +7052,7 @@ declare namespace ts { (text: string, isSingleQuote?: boolean | undefined, hasExtendedUnicodeEscape?: boolean | undefined): StringLiteral; }; /** @deprecated Use `factory.createStringLiteralFromNode` or the factory supplied by your transformation context instead. */ - const createStringLiteralFromNode: (sourceNode: PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral; + const createStringLiteralFromNode: (sourceNode: PrivateIdentifier | PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral; /** @deprecated Use `factory.createRegularExpressionLiteral` or the factory supplied by your transformation context instead. */ const createRegularExpressionLiteral: (text: string) => RegularExpressionLiteral; /** @deprecated Use `factory.createLoopVariable` or the factory supplied by your transformation context instead. */ diff --git a/node_modules/typescript/lib/typescript.js b/node_modules/typescript/lib/typescript.js index c0f6f3a57..7e5216130 100644 --- a/node_modules/typescript/lib/typescript.js +++ b/node_modules/typescript/lib/typescript.js @@ -44,7 +44,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); - while (_) try { + while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { @@ -91,210 +91,15 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -/* @internal */ -var ts; -(function (ts) { - function createMapData() { - var sentinel = {}; - sentinel.prev = sentinel; - return { head: sentinel, tail: sentinel, size: 0 }; - } - function createMapEntry(key, value) { - return { key: key, value: value, next: undefined, prev: undefined }; - } - function sameValueZero(x, y) { - // Treats -0 === 0 and NaN === NaN - return x === y || x !== x && y !== y; - } - function getPrev(entry) { - var prev = entry.prev; - // Entries without a 'prev' have been removed from the map. - // An entry whose 'prev' points to itself is the head of the list and is invalid here. - if (!prev || prev === entry) - throw new Error("Illegal state"); - return prev; - } - function getNext(entry) { - while (entry) { - // Entries without a 'prev' have been removed from the map. Their 'next' - // pointer should point to the previous entry prior to deletion and - // that entry should be skipped to resume iteration. - var skipNext = !entry.prev; - entry = entry.next; - if (skipNext) { - continue; - } - return entry; - } - } - function getEntry(data, key) { - // We walk backwards from 'tail' to prioritize recently added entries. - // We skip 'head' because it is an empty entry used to track iteration start. - for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) { - if (sameValueZero(entry.key, key)) { - return entry; - } - } - } - function addOrUpdateEntry(data, key, value) { - var existing = getEntry(data, key); - if (existing) { - existing.value = value; - return; - } - var entry = createMapEntry(key, value); - entry.prev = data.tail; - data.tail.next = entry; - data.tail = entry; - data.size++; - return entry; - } - function deleteEntry(data, key) { - // We walk backwards from 'tail' to prioritize recently added entries. - // We skip 'head' because it is an empty entry used to track iteration start. - for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) { - // all entries in the map should have a 'prev' pointer. - if (entry.prev === undefined) - throw new Error("Illegal state"); - if (sameValueZero(entry.key, key)) { - if (entry.next) { - entry.next.prev = entry.prev; - } - else { - // an entry in the map without a 'next' pointer must be the 'tail'. - if (data.tail !== entry) - throw new Error("Illegal state"); - data.tail = entry.prev; - } - entry.prev.next = entry.next; - entry.next = entry.prev; - entry.prev = undefined; - data.size--; - return entry; - } - } - } - function clearEntries(data) { - var node = data.tail; - while (node !== data.head) { - var prev = getPrev(node); - node.next = data.head; - node.prev = undefined; - node = prev; - } - data.head.next = undefined; - data.tail = data.head; - data.size = 0; - } - function forEachEntry(data, action) { - var entry = data.head; - while (entry) { - entry = getNext(entry); - if (entry) { - action(entry.value, entry.key); - } - } - } - function forEachIteration(iterator, action) { - if (iterator) { - for (var step = iterator.next(); !step.done; step = iterator.next()) { - action(step.value); - } - } - } - function createIteratorData(data, selector) { - return { current: data.head, selector: selector }; - } - function iteratorNext(data) { - // Navigate to the next entry. - data.current = getNext(data.current); - if (data.current) { - return { value: data.selector(data.current.key, data.current.value), done: false }; - } - else { - return { value: undefined, done: true }; - } - } - /* @internal */ - var ShimCollections; - (function (ShimCollections) { - function createMapShim(getIterator) { - var MapIterator = /** @class */ (function () { - function MapIterator(data, selector) { - this._data = createIteratorData(data, selector); - } - MapIterator.prototype.next = function () { return iteratorNext(this._data); }; - return MapIterator; - }()); - return /** @class */ (function () { - function Map(iterable) { - var _this = this; - this._mapData = createMapData(); - forEachIteration(getIterator(iterable), function (_a) { - var key = _a[0], value = _a[1]; - return _this.set(key, value); - }); - } - Object.defineProperty(Map.prototype, "size", { - get: function () { return this._mapData.size; }, - enumerable: false, - configurable: true - }); - Map.prototype.get = function (key) { var _a; return (_a = getEntry(this._mapData, key)) === null || _a === void 0 ? void 0 : _a.value; }; - Map.prototype.set = function (key, value) { return addOrUpdateEntry(this._mapData, key, value), this; }; - Map.prototype.has = function (key) { return !!getEntry(this._mapData, key); }; - Map.prototype.delete = function (key) { return !!deleteEntry(this._mapData, key); }; - Map.prototype.clear = function () { clearEntries(this._mapData); }; - Map.prototype.keys = function () { return new MapIterator(this._mapData, function (key, _value) { return key; }); }; - Map.prototype.values = function () { return new MapIterator(this._mapData, function (_key, value) { return value; }); }; - Map.prototype.entries = function () { return new MapIterator(this._mapData, function (key, value) { return [key, value]; }); }; - Map.prototype.forEach = function (action) { forEachEntry(this._mapData, action); }; - return Map; - }()); - } - ShimCollections.createMapShim = createMapShim; - function createSetShim(getIterator) { - var SetIterator = /** @class */ (function () { - function SetIterator(data, selector) { - this._data = createIteratorData(data, selector); - } - SetIterator.prototype.next = function () { return iteratorNext(this._data); }; - return SetIterator; - }()); - return /** @class */ (function () { - function Set(iterable) { - var _this = this; - this._mapData = createMapData(); - forEachIteration(getIterator(iterable), function (value) { return _this.add(value); }); - } - Object.defineProperty(Set.prototype, "size", { - get: function () { return this._mapData.size; }, - enumerable: false, - configurable: true - }); - Set.prototype.add = function (value) { return addOrUpdateEntry(this._mapData, value, value), this; }; - Set.prototype.has = function (value) { return !!getEntry(this._mapData, value); }; - Set.prototype.delete = function (value) { return !!deleteEntry(this._mapData, value); }; - Set.prototype.clear = function () { clearEntries(this._mapData); }; - Set.prototype.keys = function () { return new SetIterator(this._mapData, function (key, _value) { return key; }); }; - Set.prototype.values = function () { return new SetIterator(this._mapData, function (_key, value) { return value; }); }; - Set.prototype.entries = function () { return new SetIterator(this._mapData, function (key, value) { return [key, value]; }); }; - Set.prototype.forEach = function (action) { forEachEntry(this._mapData, action); }; - return Set; - }()); - } - ShimCollections.createSetShim = createSetShim; - })(ShimCollections = ts.ShimCollections || (ts.ShimCollections = {})); -})(ts || (ts = {})); var ts; (function (ts) { // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configurePrerelease` too. - ts.versionMajorMinor = "4.8"; + ts.versionMajorMinor = "4.9"; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.8.4"; + ts.version = "".concat(ts.versionMajorMinor, ".3"); /* @internal */ var Comparison; (function (Comparison) { @@ -315,8 +120,12 @@ var ts; function tryGetNativeMap() { // Internet Explorer's Map doesn't support iteration, so don't use it. var gMap = globals === null || globals === void 0 ? void 0 : globals.Map; - // eslint-disable-next-line no-in-operator - return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + if (!constructor) { + throw new Error("No compatible Map implementation found."); + } + return constructor; } NativeCollections.tryGetNativeMap = tryGetNativeMap; /** @@ -325,24 +134,19 @@ var ts; function tryGetNativeSet() { // Internet Explorer's Set doesn't support iteration, so don't use it. var gSet = globals === null || globals === void 0 ? void 0 : globals.Set; - // eslint-disable-next-line no-in-operator - return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + if (!constructor) { + throw new Error("No compatible Set implementation found."); + } + return constructor; } NativeCollections.tryGetNativeSet = tryGetNativeSet; })(NativeCollections || (NativeCollections = {})); /* @internal */ - ts.Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim"); - /* @internal */ - ts.Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim"); + ts.Map = NativeCollections.tryGetNativeMap(); /* @internal */ - function getCollectionImplementation(name, nativeFactory, shimFactory) { - var _a; - // NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it. - var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator); - if (constructor) - return constructor; - throw new Error("TypeScript requires an environment that provides a compatible native ".concat(name, " implementation.")); - } + ts.Set = NativeCollections.tryGetNativeSet(); })(ts || (ts = {})); /* @internal */ var ts; @@ -1058,15 +862,18 @@ var ts; function insertSorted(array, insert, compare, allowDuplicates) { if (array.length === 0) { array.push(insert); - return; + return true; } var insertIndex = binarySearch(array, insert, identity, compare); if (insertIndex < 0) { array.splice(~insertIndex, 0, insert); + return true; } - else if (allowDuplicates) { + if (allowDuplicates) { array.splice(insertIndex, 0, insert); + return true; } + return false; } ts.insertSorted = insertSorted; function sortAndDeduplicate(array, comparer, equalityComparer) { @@ -1346,6 +1153,13 @@ var ts; : undefined; } ts.singleOrUndefined = singleOrUndefined; + /** + * Returns the only element of an array if it contains only one element; throws otherwise. + */ + function single(array) { + return ts.Debug.checkDefined(singleOrUndefined(array)); + } + ts.single = single; function singleOrMany(array) { return array && array.length === 1 ? array[0] @@ -2077,8 +1891,8 @@ var ts; return compareValues(a === null || a === void 0 ? void 0 : a.start, b === null || b === void 0 ? void 0 : b.start) || compareValues(a === null || a === void 0 ? void 0 : a.length, b === null || b === void 0 ? void 0 : b.length); } ts.compareTextSpans = compareTextSpans; - function min(a, b, compare) { - return compare(a, b) === -1 /* Comparison.LessThan */ ? a : b; + function min(items, compare) { + return reduceLeft(items, function (x, y) { return compare(x, y) === -1 /* Comparison.LessThan */ ? x : y; }); } ts.min = min; /** @@ -2869,7 +2683,7 @@ var ts; if (typeof func !== "function") { return ""; } - else if (func.hasOwnProperty("name")) { + else if (ts.hasProperty(func, "name")) { return func.name; } else { @@ -3019,7 +2833,7 @@ var ts; Debug.formatControlFlowGraph = formatControlFlowGraph; var flowNodeProto; function attachFlowNodeDebugInfoWorker(flowNode) { - if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line no-in-operator + if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line local/no-in-operator Object.defineProperties(flowNode, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -3065,7 +2879,7 @@ var ts; Debug.attachFlowNodeDebugInfo = attachFlowNodeDebugInfo; var nodeArrayProto; function attachNodeArrayDebugInfoWorker(array) { - if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line no-in-operator + if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line local/no-in-operator Object.defineProperties(array, { __tsDebuggerDisplay: { value: function (defaultValue) { @@ -3194,7 +3008,7 @@ var ts; ]; for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) { var ctor = nodeConstructors_1[_i]; - if (!ctor.prototype.hasOwnProperty("__debugKind")) { + if (!ts.hasProperty(ctor.prototype, "__debugKind")) { Object.defineProperties(ctor.prototype, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -3391,11 +3205,13 @@ var ts; // > alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric identifiers // > MUST NOT include leading zeroes. var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-][a-z0-9-]*))*$/i; + var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i; // https://semver.org/#spec-item-10 // > Build metadata MAY be denoted by appending a plus sign and a series of dot separated // > identifiers immediately following the patch or pre-release version. Identifiers MUST // > comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i; + var buildPartRegExp = /^[a-z0-9-]+$/i; // https://semver.org/#spec-item-9 // > Numeric identifiers MUST NOT include leading zeroes. var numericIdentifierRegExp = /^(0|[1-9]\d*)$/; @@ -3415,13 +3231,15 @@ var ts; ts.Debug.assert(major >= 0, "Invalid argument: major"); ts.Debug.assert(minor >= 0, "Invalid argument: minor"); ts.Debug.assert(patch >= 0, "Invalid argument: patch"); - ts.Debug.assert(!prerelease || prereleaseRegExp.test(prerelease), "Invalid argument: prerelease"); - ts.Debug.assert(!build || buildRegExp.test(build), "Invalid argument: build"); + var prereleaseArray = prerelease ? ts.isArray(prerelease) ? prerelease : prerelease.split(".") : ts.emptyArray; + var buildArray = build ? ts.isArray(build) ? build : build.split(".") : ts.emptyArray; + ts.Debug.assert(ts.every(prereleaseArray, function (s) { return prereleasePartRegExp.test(s); }), "Invalid argument: prerelease"); + ts.Debug.assert(ts.every(buildArray, function (s) { return buildPartRegExp.test(s); }), "Invalid argument: build"); this.major = major; this.minor = minor; this.patch = patch; - this.prerelease = prerelease ? prerelease.split(".") : ts.emptyArray; - this.build = build ? build.split(".") : ts.emptyArray; + this.prerelease = prereleaseArray; + this.build = buildArray; } Version.tryParse = function (text) { var result = tryParseComponents(text); @@ -3460,6 +3278,10 @@ var ts; default: return ts.Debug.assertNever(field); } }; + Version.prototype.with = function (fields) { + var _a = fields.major, major = _a === void 0 ? this.major : _a, _b = fields.minor, minor = _b === void 0 ? this.minor : _b, _c = fields.patch, patch = _c === void 0 ? this.patch : _c, _d = fields.prerelease, prerelease = _d === void 0 ? this.prerelease : _d, _e = fields.build, build = _e === void 0 ? this.build : _e; + return new Version(major, minor, patch, prerelease, build); + }; Version.prototype.toString = function () { var result = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch); if (ts.some(this.prerelease)) @@ -3468,7 +3290,7 @@ var ts; result += "+".concat(this.build.join(".")); return result; }; - Version.zero = new Version(0, 0, 0); + Version.zero = new Version(0, 0, 0, ["0"]); return Version; }()); ts.Version = Version; @@ -3551,6 +3373,10 @@ var ts; } return undefined; }; + /** + * Tests whether a version matches the range. This is equivalent to `satisfies(version, range, { includePrerelease: true })`. + * in `node-semver`. + */ VersionRange.prototype.test = function (version) { if (typeof version === "string") version = new Version(version); @@ -3661,19 +3487,20 @@ var ts; break; case "<": case ">=": - comparators.push(createComparator(operator, version)); + comparators.push(isWildcard(minor) || isWildcard(patch) ? createComparator(operator, version.with({ prerelease: "0" })) : + createComparator(operator, version)); break; case "<=": case ">": - comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major")) : - isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor")) : + comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major").with({ prerelease: "0" })) : + isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor").with({ prerelease: "0" })) : createComparator(operator, version)); break; case "=": case undefined: if (isWildcard(minor) || isWildcard(patch)) { - comparators.push(createComparator(">=", version)); - comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor"))); + comparators.push(createComparator(">=", version.with({ prerelease: "0" }))); + comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor").with({ prerelease: "0" }))); } else { comparators.push(createComparator("=", version)); @@ -3747,6 +3574,8 @@ var ts; typeof performance.mark === "function" && typeof performance.measure === "function" && typeof performance.now === "function" && + typeof performance.clearMarks === "function" && + typeof performance.clearMeasures === "function" && typeof PerformanceObserver === "function"; } function tryGetWebPerformanceHooks() { @@ -3791,7 +3620,9 @@ var ts; if (end === "__performance.measure-fix__") { nodePerformance_1.clearMarks("__performance.measure-fix__"); } - } + }, + clearMarks: function (name) { return nodePerformance_1.clearMarks(name); }, + clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); }, }; } return { @@ -3924,6 +3755,30 @@ var ts; durations.forEach(function (duration, measureName) { return cb(measureName, duration); }); } performance.forEachMeasure = forEachMeasure; + function forEachMark(cb) { + marks.forEach(function (_time, markName) { return cb(markName); }); + } + performance.forEachMark = forEachMark; + function clearMeasures(name) { + if (name !== undefined) + durations.delete(name); + else + durations.clear(); + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name); + } + performance.clearMeasures = clearMeasures; + function clearMarks(name) { + if (name !== undefined) { + counts.delete(name); + marks.delete(name); + } + else { + counts.clear(); + marks.clear(); + } + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name); + } + performance.clearMarks = clearMarks; /** * Indicates whether the performance API is enabled. */ @@ -4021,7 +3876,6 @@ var ts; var typeCatalog = []; // NB: id is index + 1 var legendPath; var legend = []; - ; /** Starts tracing for the given project. */ function startTracing(tracingMode, traceDir, configFilePath) { ts.Debug.assert(!ts.tracing, "Tracing already started"); @@ -4226,7 +4080,7 @@ var ts; var substitutionType = type; substitutionProperties = { substitutionBaseType: (_o = substitutionType.baseType) === null || _o === void 0 ? void 0 : _o.id, - substituteType: (_p = substitutionType.substitute) === null || _p === void 0 ? void 0 : _p.id, + constraintType: (_p = substitutionType.constraint) === null || _p === void 0 ? void 0 : _p.id, }; } var reverseMappedProperties = {}; @@ -4426,257 +4280,260 @@ var ts; SyntaxKind[SyntaxKind["YieldKeyword"] = 125] = "YieldKeyword"; // Contextual keywords SyntaxKind[SyntaxKind["AbstractKeyword"] = 126] = "AbstractKeyword"; - SyntaxKind[SyntaxKind["AsKeyword"] = 127] = "AsKeyword"; - SyntaxKind[SyntaxKind["AssertsKeyword"] = 128] = "AssertsKeyword"; - SyntaxKind[SyntaxKind["AssertKeyword"] = 129] = "AssertKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 130] = "AnyKeyword"; - SyntaxKind[SyntaxKind["AsyncKeyword"] = 131] = "AsyncKeyword"; - SyntaxKind[SyntaxKind["AwaitKeyword"] = 132] = "AwaitKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 133] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 134] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 135] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 136] = "GetKeyword"; - SyntaxKind[SyntaxKind["InferKeyword"] = 137] = "InferKeyword"; - SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 138] = "IntrinsicKeyword"; - SyntaxKind[SyntaxKind["IsKeyword"] = 139] = "IsKeyword"; - SyntaxKind[SyntaxKind["KeyOfKeyword"] = 140] = "KeyOfKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 141] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["NamespaceKeyword"] = 142] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["NeverKeyword"] = 143] = "NeverKeyword"; - SyntaxKind[SyntaxKind["OutKeyword"] = 144] = "OutKeyword"; - SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 145] = "ReadonlyKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 146] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 147] = "NumberKeyword"; - SyntaxKind[SyntaxKind["ObjectKeyword"] = 148] = "ObjectKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 149] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 150] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 151] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 152] = "TypeKeyword"; - SyntaxKind[SyntaxKind["UndefinedKeyword"] = 153] = "UndefinedKeyword"; - SyntaxKind[SyntaxKind["UniqueKeyword"] = 154] = "UniqueKeyword"; - SyntaxKind[SyntaxKind["UnknownKeyword"] = 155] = "UnknownKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 156] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 157] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["BigIntKeyword"] = 158] = "BigIntKeyword"; - SyntaxKind[SyntaxKind["OverrideKeyword"] = 159] = "OverrideKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 160] = "OfKeyword"; + SyntaxKind[SyntaxKind["AccessorKeyword"] = 127] = "AccessorKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 128] = "AsKeyword"; + SyntaxKind[SyntaxKind["AssertsKeyword"] = 129] = "AssertsKeyword"; + SyntaxKind[SyntaxKind["AssertKeyword"] = 130] = "AssertKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 131] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 132] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 133] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 134] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 135] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 136] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 137] = "GetKeyword"; + SyntaxKind[SyntaxKind["InferKeyword"] = 138] = "InferKeyword"; + SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 139] = "IntrinsicKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 140] = "IsKeyword"; + SyntaxKind[SyntaxKind["KeyOfKeyword"] = 141] = "KeyOfKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 142] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 143] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["NeverKeyword"] = 144] = "NeverKeyword"; + SyntaxKind[SyntaxKind["OutKeyword"] = 145] = "OutKeyword"; + SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 146] = "ReadonlyKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 147] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 148] = "NumberKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 149] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SatisfiesKeyword"] = 150] = "SatisfiesKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 151] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 152] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 153] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 154] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 155] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["UniqueKeyword"] = 156] = "UniqueKeyword"; + SyntaxKind[SyntaxKind["UnknownKeyword"] = 157] = "UnknownKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 158] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 159] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["BigIntKeyword"] = 160] = "BigIntKeyword"; + SyntaxKind[SyntaxKind["OverrideKeyword"] = 161] = "OverrideKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 162] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 161] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 162] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 163] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 164] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 163] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 164] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 165] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 165] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 166] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 167] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 166] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 167] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 168] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 169] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 170] = "ClassStaticBlockDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 171] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 172] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 173] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 174] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 175] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 176] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 168] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 169] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 170] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 171] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 172] = "ClassStaticBlockDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 173] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 174] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 175] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 176] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 177] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 178] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 177] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 178] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 179] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 180] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 181] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 182] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 183] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 184] = "TupleType"; - SyntaxKind[SyntaxKind["OptionalType"] = 185] = "OptionalType"; - SyntaxKind[SyntaxKind["RestType"] = 186] = "RestType"; - SyntaxKind[SyntaxKind["UnionType"] = 187] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 188] = "IntersectionType"; - SyntaxKind[SyntaxKind["ConditionalType"] = 189] = "ConditionalType"; - SyntaxKind[SyntaxKind["InferType"] = 190] = "InferType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 191] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 192] = "ThisType"; - SyntaxKind[SyntaxKind["TypeOperator"] = 193] = "TypeOperator"; - SyntaxKind[SyntaxKind["IndexedAccessType"] = 194] = "IndexedAccessType"; - SyntaxKind[SyntaxKind["MappedType"] = 195] = "MappedType"; - SyntaxKind[SyntaxKind["LiteralType"] = 196] = "LiteralType"; - SyntaxKind[SyntaxKind["NamedTupleMember"] = 197] = "NamedTupleMember"; - SyntaxKind[SyntaxKind["TemplateLiteralType"] = 198] = "TemplateLiteralType"; - SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 199] = "TemplateLiteralTypeSpan"; - SyntaxKind[SyntaxKind["ImportType"] = 200] = "ImportType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 179] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 180] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 181] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 182] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 183] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 184] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 185] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 186] = "TupleType"; + SyntaxKind[SyntaxKind["OptionalType"] = 187] = "OptionalType"; + SyntaxKind[SyntaxKind["RestType"] = 188] = "RestType"; + SyntaxKind[SyntaxKind["UnionType"] = 189] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 190] = "IntersectionType"; + SyntaxKind[SyntaxKind["ConditionalType"] = 191] = "ConditionalType"; + SyntaxKind[SyntaxKind["InferType"] = 192] = "InferType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 193] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 194] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 195] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 196] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 197] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 198] = "LiteralType"; + SyntaxKind[SyntaxKind["NamedTupleMember"] = 199] = "NamedTupleMember"; + SyntaxKind[SyntaxKind["TemplateLiteralType"] = 200] = "TemplateLiteralType"; + SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 201] = "TemplateLiteralTypeSpan"; + SyntaxKind[SyntaxKind["ImportType"] = 202] = "ImportType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 201] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 202] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 203] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 203] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 204] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 205] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 204] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 205] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 206] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 207] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 208] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 209] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 210] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 211] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 212] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 213] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 214] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 215] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 216] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 217] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 218] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 219] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 220] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 221] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 222] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 223] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 224] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 225] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 226] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 227] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 228] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 229] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 230] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 231] = "MetaProperty"; - SyntaxKind[SyntaxKind["SyntheticExpression"] = 232] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 206] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 207] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 208] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 209] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 210] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 211] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 212] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 213] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 214] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 215] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 216] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 217] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 218] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 219] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 220] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 221] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 222] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 223] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 224] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 225] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 226] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 227] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 228] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 229] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 230] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 231] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 232] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 233] = "MetaProperty"; + SyntaxKind[SyntaxKind["SyntheticExpression"] = 234] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["SatisfiesExpression"] = 235] = "SatisfiesExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 233] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 234] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 236] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 237] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 235] = "Block"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 236] = "EmptyStatement"; - SyntaxKind[SyntaxKind["VariableStatement"] = 237] = "VariableStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 238] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 239] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 240] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 241] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 242] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 243] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 244] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 245] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 246] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 247] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 248] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 249] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 250] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 251] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 252] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 253] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 254] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 255] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 256] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 257] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 258] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 259] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 260] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 261] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 262] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 263] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 264] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 265] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 266] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 267] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 268] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 269] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 270] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 271] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 272] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 273] = "NamedExports"; - SyntaxKind[SyntaxKind["NamespaceExport"] = 274] = "NamespaceExport"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 275] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 276] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 238] = "Block"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 239] = "EmptyStatement"; + SyntaxKind[SyntaxKind["VariableStatement"] = 240] = "VariableStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 241] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 242] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 243] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 244] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 245] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 246] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 247] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 248] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 249] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 250] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 251] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 252] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 253] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 254] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 255] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 256] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 257] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 258] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 259] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 260] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 261] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 262] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 263] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 264] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 265] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 266] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 267] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 268] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 269] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 270] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 271] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 272] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 273] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 274] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 275] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 276] = "NamedExports"; + SyntaxKind[SyntaxKind["NamespaceExport"] = 277] = "NamespaceExport"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 278] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 279] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 277] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 280] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 278] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 279] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 280] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 281] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxFragment"] = 282] = "JsxFragment"; - SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 283] = "JsxOpeningFragment"; - SyntaxKind[SyntaxKind["JsxClosingFragment"] = 284] = "JsxClosingFragment"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 285] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 286] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 287] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 288] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 281] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 282] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 283] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 284] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxFragment"] = 285] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 286] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 287] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 288] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 289] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 290] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 291] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 289] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 290] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 291] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 292] = "CatchClause"; - SyntaxKind[SyntaxKind["AssertClause"] = 293] = "AssertClause"; - SyntaxKind[SyntaxKind["AssertEntry"] = 294] = "AssertEntry"; - SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 295] = "ImportTypeAssertionContainer"; + SyntaxKind[SyntaxKind["CaseClause"] = 292] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 293] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 294] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 295] = "CatchClause"; + SyntaxKind[SyntaxKind["AssertClause"] = 296] = "AssertClause"; + SyntaxKind[SyntaxKind["AssertEntry"] = 297] = "AssertEntry"; + SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 298] = "ImportTypeAssertionContainer"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 296] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 297] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 298] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 299] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 300] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 301] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 299] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 302] = "EnumMember"; // Unparsed - SyntaxKind[SyntaxKind["UnparsedPrologue"] = 300] = "UnparsedPrologue"; - SyntaxKind[SyntaxKind["UnparsedPrepend"] = 301] = "UnparsedPrepend"; - SyntaxKind[SyntaxKind["UnparsedText"] = 302] = "UnparsedText"; - SyntaxKind[SyntaxKind["UnparsedInternalText"] = 303] = "UnparsedInternalText"; - SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 304] = "UnparsedSyntheticReference"; + SyntaxKind[SyntaxKind["UnparsedPrologue"] = 303] = "UnparsedPrologue"; + SyntaxKind[SyntaxKind["UnparsedPrepend"] = 304] = "UnparsedPrepend"; + SyntaxKind[SyntaxKind["UnparsedText"] = 305] = "UnparsedText"; + SyntaxKind[SyntaxKind["UnparsedInternalText"] = 306] = "UnparsedInternalText"; + SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 307] = "UnparsedSyntheticReference"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 305] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 306] = "Bundle"; - SyntaxKind[SyntaxKind["UnparsedSource"] = 307] = "UnparsedSource"; - SyntaxKind[SyntaxKind["InputFiles"] = 308] = "InputFiles"; + SyntaxKind[SyntaxKind["SourceFile"] = 308] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 309] = "Bundle"; + SyntaxKind[SyntaxKind["UnparsedSource"] = 310] = "UnparsedSource"; + SyntaxKind[SyntaxKind["InputFiles"] = 311] = "InputFiles"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 309] = "JSDocTypeExpression"; - SyntaxKind[SyntaxKind["JSDocNameReference"] = 310] = "JSDocNameReference"; - SyntaxKind[SyntaxKind["JSDocMemberName"] = 311] = "JSDocMemberName"; - SyntaxKind[SyntaxKind["JSDocAllType"] = 312] = "JSDocAllType"; - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 313] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 314] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 315] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 316] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType"; - SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 312] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocNameReference"] = 313] = "JSDocNameReference"; + SyntaxKind[SyntaxKind["JSDocMemberName"] = 314] = "JSDocMemberName"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 315] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 316] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 317] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 318] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 319] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 320] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 321] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocNamepathType"] = 322] = "JSDocNamepathType"; + SyntaxKind[SyntaxKind["JSDoc"] = 323] = "JSDoc"; /** @deprecated Use SyntaxKind.JSDoc */ - SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 322] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocSignature"] = 323] = "JSDocSignature"; - SyntaxKind[SyntaxKind["JSDocLink"] = 324] = "JSDocLink"; - SyntaxKind[SyntaxKind["JSDocLinkCode"] = 325] = "JSDocLinkCode"; - SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 326] = "JSDocLinkPlain"; - SyntaxKind[SyntaxKind["JSDocTag"] = 327] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 328] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 329] = "JSDocImplementsTag"; - SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 330] = "JSDocAuthorTag"; - SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 331] = "JSDocDeprecatedTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 332] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocPublicTag"] = 333] = "JSDocPublicTag"; - SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 334] = "JSDocPrivateTag"; - SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 335] = "JSDocProtectedTag"; - SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 336] = "JSDocReadonlyTag"; - SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 337] = "JSDocOverrideTag"; - SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 338] = "JSDocCallbackTag"; - SyntaxKind[SyntaxKind["JSDocEnumTag"] = 339] = "JSDocEnumTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 340] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 341] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocThisTag"] = 342] = "JSDocThisTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 343] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 344] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 345] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocSeeTag"] = 346] = "JSDocSeeTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 347] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocComment"] = 323] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocText"] = 324] = "JSDocText"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 325] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocSignature"] = 326] = "JSDocSignature"; + SyntaxKind[SyntaxKind["JSDocLink"] = 327] = "JSDocLink"; + SyntaxKind[SyntaxKind["JSDocLinkCode"] = 328] = "JSDocLinkCode"; + SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 329] = "JSDocLinkPlain"; + SyntaxKind[SyntaxKind["JSDocTag"] = 330] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 331] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 332] = "JSDocImplementsTag"; + SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 333] = "JSDocAuthorTag"; + SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 334] = "JSDocDeprecatedTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 335] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocPublicTag"] = 336] = "JSDocPublicTag"; + SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 337] = "JSDocPrivateTag"; + SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 338] = "JSDocProtectedTag"; + SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 339] = "JSDocReadonlyTag"; + SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 340] = "JSDocOverrideTag"; + SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 341] = "JSDocCallbackTag"; + SyntaxKind[SyntaxKind["JSDocEnumTag"] = 342] = "JSDocEnumTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 343] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 344] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocThisTag"] = 345] = "JSDocThisTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 346] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 347] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 348] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocSeeTag"] = 349] = "JSDocSeeTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 350] = "JSDocPropertyTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 348] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 351] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 349] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 350] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 351] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 352] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 353] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 354] = "SyntheticReferenceExpression"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 352] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 353] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 354] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 355] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 356] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 357] = "SyntheticReferenceExpression"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 355] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 358] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 63] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 78] = "LastAssignment"; @@ -4685,15 +4542,15 @@ var ts; SyntaxKind[SyntaxKind["FirstReservedWord"] = 81] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 116] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 81] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 160] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 162] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 117] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 125] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 177] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 200] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 179] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 202] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 78] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 160] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 162] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -4702,15 +4559,15 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 29] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 78] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstStatement"] = 237] = "FirstStatement"; - SyntaxKind[SyntaxKind["LastStatement"] = 253] = "LastStatement"; - SyntaxKind[SyntaxKind["FirstNode"] = 161] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 309] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 347] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 327] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstStatement"] = 240] = "FirstStatement"; + SyntaxKind[SyntaxKind["LastStatement"] = 256] = "LastStatement"; + SyntaxKind[SyntaxKind["FirstNode"] = 163] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 312] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 350] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 330] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 350] = "LastJSDocTagNode"; /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword"; - /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword"; + /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 162] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -4775,9 +4632,10 @@ var ts; ModifierFlags[ModifierFlags["Protected"] = 16] = "Protected"; ModifierFlags[ModifierFlags["Static"] = 32] = "Static"; ModifierFlags[ModifierFlags["Readonly"] = 64] = "Readonly"; - ModifierFlags[ModifierFlags["Abstract"] = 128] = "Abstract"; - ModifierFlags[ModifierFlags["Async"] = 256] = "Async"; - ModifierFlags[ModifierFlags["Default"] = 512] = "Default"; + ModifierFlags[ModifierFlags["Accessor"] = 128] = "Accessor"; + ModifierFlags[ModifierFlags["Abstract"] = 256] = "Abstract"; + ModifierFlags[ModifierFlags["Async"] = 512] = "Async"; + ModifierFlags[ModifierFlags["Default"] = 1024] = "Default"; ModifierFlags[ModifierFlags["Const"] = 2048] = "Const"; ModifierFlags[ModifierFlags["HasComputedJSDocModifiers"] = 4096] = "HasComputedJSDocModifiers"; ModifierFlags[ModifierFlags["Deprecated"] = 8192] = "Deprecated"; @@ -4790,10 +4648,10 @@ var ts; // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 16476] = "ParameterPropertyModifier"; ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier"; - ModifierFlags[ModifierFlags["TypeScriptModifier"] = 116958] = "TypeScriptModifier"; - ModifierFlags[ModifierFlags["ExportDefault"] = 513] = "ExportDefault"; - ModifierFlags[ModifierFlags["All"] = 257023] = "All"; - ModifierFlags[ModifierFlags["Modifier"] = 125951] = "Modifier"; + ModifierFlags[ModifierFlags["TypeScriptModifier"] = 117086] = "TypeScriptModifier"; + ModifierFlags[ModifierFlags["ExportDefault"] = 1025] = "ExportDefault"; + ModifierFlags[ModifierFlags["All"] = 258047] = "All"; + ModifierFlags[ModifierFlags["Modifier"] = 126975] = "Modifier"; })(ModifierFlags = ts.ModifierFlags || (ts.ModifierFlags = {})); var JsxFlags; (function (JsxFlags) { @@ -4989,6 +4847,7 @@ var ts; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyTuple"] = 524288] = "AllowEmptyTuple"; NodeBuilderFlags[NodeBuilderFlags["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType"; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType"; + /* @internal */ NodeBuilderFlags[NodeBuilderFlags["WriteComputedProps"] = 1073741824] = "WriteComputedProps"; // Errors (cont.) NodeBuilderFlags[NodeBuilderFlags["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths"; /* @internal */ NodeBuilderFlags[NodeBuilderFlags["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain"; @@ -5049,8 +4908,10 @@ var ts; SymbolFormatFlags[SymbolFormatFlags["AllowAnyNodeKind"] = 4] = "AllowAnyNodeKind"; // Prefer aliases which are not directly visible SymbolFormatFlags[SymbolFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 8] = "UseAliasDefinedOutsideCurrentScope"; + // { [E.A]: 1 } + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["WriteComputedProps"] = 16] = "WriteComputedProps"; // Skip building an accessible symbol chain - /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 16] = "DoNotIncludeSymbolChain"; + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 32] = "DoNotIncludeSymbolChain"; })(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); /* @internal */ var SymbolAccessibility; @@ -5164,6 +5025,7 @@ var ts; SymbolFlags[SymbolFlags["MethodExcludes"] = 103359] = "MethodExcludes"; SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes"; SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes"; + SymbolFlags[SymbolFlags["AccessorExcludes"] = 13247] = "AccessorExcludes"; SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes"; SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes"; SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes"; @@ -5247,8 +5109,8 @@ var ts; NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance"; NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic"; NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked"; - NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuper"] = 2048] = "AsyncMethodWithSuper"; - NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuperBinding"] = 4096] = "AsyncMethodWithSuperBinding"; + NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAccessInAsync"] = 2048] = "MethodWithSuperPropertyAccessInAsync"; + NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAssignmentInAsync"] = 4096] = "MethodWithSuperPropertyAssignmentInAsync"; NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments"; NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed"; NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass"; @@ -6290,7 +6152,6 @@ var ts; var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels); /* @internal */ ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels); - /* @internal */ function setCustomPollingValues(system) { if (!system.getEnvironmentVariable) { return; @@ -6333,7 +6194,6 @@ var ts; createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels); } } - ts.setCustomPollingValues = setCustomPollingValues; function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) { var definedValueCopyToIndex = pollIndex; // Max visit would be all elements of the queue @@ -6379,7 +6239,6 @@ var ts; } } } - /* @internal */ function createDynamicPriorityPollingWatchFile(host) { var watchedFiles = []; var changedFilesInLastPoll = []; @@ -6488,7 +6347,6 @@ var ts; pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval)); } } - ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile; function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) { // One file can have multiple watchers var fileWatcherCallbacks = ts.createMultiMap(); @@ -6567,42 +6425,38 @@ var ts; pollScheduled = host.setTimeout(pollQueue, PollingInterval.High); } } - /* @internal */ - function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) { - var cache = new ts.Map(); - var callbacksCache = ts.createMultiMap(); + function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) { var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - return function (fileName, callback, pollingInterval, options) { - var path = toCanonicalFileName(fileName); - var existing = cache.get(path); - if (existing) { - existing.refCount++; - } - else { - cache.set(path, { - watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options), - refCount: 1 - }); + var path = toCanonicalFileName(name); + var existing = cache.get(path); + if (existing) { + existing.callbacks.push(callback); + } + else { + cache.set(path, { + watcher: createWatcher(( + // Cant infer types correctly so lets satisfy checker + function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })), + callbacks: [callback] + }); + } + return { + close: function () { + var watcher = cache.get(path); + // Watcher is not expected to be undefined, but if it is normally its because + // exception was thrown somewhere else and watch state is not what it should be + if (!watcher) + return; + if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length) + return; + cache.delete(path); + ts.closeFileWatcherOf(watcher); } - callbacksCache.add(path, callback); - return { - close: function () { - var watcher = ts.Debug.checkDefined(cache.get(path)); - callbacksCache.remove(path, callback); - watcher.refCount--; - if (watcher.refCount) - return; - cache.delete(path); - ts.closeFileWatcherOf(watcher); - } - }; }; } - ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName; /** * Returns true if file status changed */ - /*@internal*/ function onWatchedFileStat(watchedFile, modifiedTime) { var oldTime = watchedFile.mtime.getTime(); var newTime = modifiedTime.getTime(); @@ -6614,7 +6468,6 @@ var ts; } return false; } - ts.onWatchedFileStat = onWatchedFileStat; /*@internal*/ function getFileWatcherEventKind(oldTime, newTime) { return oldTime === 0 @@ -6642,7 +6495,6 @@ var ts; * that means if this is recursive watcher, watch the children directories as well * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile) */ - /*@internal*/ function createDirectoryWatcherSupportingRecursive(_a) { var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout; var cache = new ts.Map(); @@ -6851,18 +6703,15 @@ var ts; return ts.stringContains(toCanonicalFilePath(path), searchPath); } } - ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive; /*@internal*/ var FileSystemEntryKind; (function (FileSystemEntryKind) { FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File"; FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory"; })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {})); - /*@internal*/ function createFileWatcherCallback(callback) { return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); }; } - ts.createFileWatcherCallback = createFileWatcherCallback; function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) { return function (eventName, _relativeFileName, modifiedTime) { if (eventName === "rename") { @@ -6896,7 +6745,10 @@ var ts; } /*@internal*/ function createSystemWatchFunctions(_a) { - var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatches = new ts.Map(); + var fsWatches = new ts.Map(); + var fsWatchesRecursive = new ts.Map(); var dynamicPollingWatchFile; var fixedChunkSizePollingWatchFile; var nonPollingWatchFile; @@ -6959,8 +6811,8 @@ var ts; return useNonPollingWatchers ? // Use notifications from FS to watch with falling back to fs.watchFile generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) : - // Default to do not use fixed polling interval - { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval }; + // Default to using fs events + { watchFile: ts.WatchFileKind.UseFsEvents }; } } function generateWatchFileOptions(watchFile, fallbackPolling, options) { @@ -7031,7 +6883,13 @@ var ts; }; } } + function pollingWatchFile(fileName, callback, pollingInterval, options) { + return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); }); + } function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { + return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); }); + } + function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { var lastDirectoryPartWithDirectorySeparator; var lastDirectoryPart; if (inodeWatching) { @@ -7210,7 +7068,7 @@ var ts; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); var _b = createSystemWatchFunctions({ - pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), + pollingWatchFileWorker: fsWatchFileWorker, getModifiedTime: getModifiedTime, setTimeout: setTimeout, clearTimeout: clearTimeout, @@ -7226,7 +7084,6 @@ var ts; tscWatchFile: process.env.TSC_WATCHFILE, useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER, tscWatchDirectory: process.env.TSC_WATCHDIRECTORY, - defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); }, inodeWatching: isLinuxOrMacOs, sysLog: sysLog, }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory; @@ -8030,12 +7887,9 @@ var ts; * Normalize path separators, converting `\` into `/`. */ function normalizeSlashes(path) { - var index = path.indexOf("\\"); - if (index === -1) { - return path; - } - backslashRegExp.lastIndex = index; // prime regex with known position - return path.replace(backslashRegExp, ts.directorySeparator); + return path.indexOf("\\") !== -1 + ? path.replace(backslashRegExp, ts.directorySeparator) + : path; } ts.normalizeSlashes = normalizeSlashes; /** @@ -8618,6 +8472,8 @@ var ts; A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."), _0_modifier_cannot_appear_on_a_type_parameter: diag(1273, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_parameter_1273", "'{0}' modifier cannot appear on a type parameter"), _0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"), + accessor_modifier_can_only_appear_on_a_property_declaration: diag(1275, ts.DiagnosticCategory.Error, "accessor_modifier_can_only_appear_on_a_property_declaration_1275", "'accessor' modifier can only appear on a property declaration."), + An_accessor_property_cannot_be_declared_optional: diag(1276, ts.DiagnosticCategory.Error, "An_accessor_property_cannot_be_declared_optional_1276", "An 'accessor' property cannot be declared optional."), with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."), await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."), The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."), @@ -8668,7 +8524,7 @@ var ts; An_enum_member_name_must_be_followed_by_a_or: diag(1357, ts.DiagnosticCategory.Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."), Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, ts.DiagnosticCategory.Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."), Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here: diag(1359, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."), - Class_constructor_may_not_be_a_generator: diag(1360, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1360", "Class constructor may not be a generator."), + Type_0_does_not_satisfy_the_expected_type_1: diag(1360, ts.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_expected_type_1_1360", "Type '{0}' does not satisfy the expected type '{1}'."), _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type: diag(1361, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."), _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type: diag(1362, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."), A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both: diag(1363, ts.DiagnosticCategory.Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."), @@ -8676,6 +8532,7 @@ var ts; Convert_all_re_exported_types_to_type_only_exports: diag(1365, ts.DiagnosticCategory.Message, "Convert_all_re_exported_types_to_type_only_exports_1365", "Convert all re-exported types to type-only exports"), Split_into_two_separate_import_declarations: diag(1366, ts.DiagnosticCategory.Message, "Split_into_two_separate_import_declarations_1366", "Split into two separate import declarations"), Split_all_invalid_type_only_imports: diag(1367, ts.DiagnosticCategory.Message, "Split_all_invalid_type_only_imports_1367", "Split all invalid type-only imports"), + Class_constructor_may_not_be_a_generator: diag(1368, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."), Did_you_mean_0: diag(1369, ts.DiagnosticCategory.Message, "Did_you_mean_0_1369", "Did you mean '{0}'?"), This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, ts.DiagnosticCategory.Error, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."), Convert_to_type_only_import: diag(1373, ts.DiagnosticCategory.Message, "Convert_to_type_only_import_1373", "Convert to type-only import"), @@ -8849,14 +8706,12 @@ var ts; The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."), The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."), The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."), - The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."), - The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."), The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."), Operator_0_cannot_be_applied_to_types_1_and_2: diag(2365, ts.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."), Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: diag(2366, ts.DiagnosticCategory.Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."), - This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367", "This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap."), + This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367", "This comparison appears to be unintentional because the types '{0}' and '{1}' have no overlap."), Type_parameter_name_cannot_be_0: diag(2368, ts.DiagnosticCategory.Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."), A_parameter_property_is_only_allowed_in_a_constructor_implementation: diag(2369, ts.DiagnosticCategory.Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."), A_rest_parameter_must_be_of_an_array_type: diag(2370, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."), @@ -9099,6 +8954,7 @@ var ts; Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."), Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."), Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."), + Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, ts.DiagnosticCategory.Error, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."), Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."), A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."), Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."), @@ -9279,6 +9135,7 @@ var ts; _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"), We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."), Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), + This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."), Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), @@ -9736,6 +9593,11 @@ var ts; Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."), Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"), Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"), + Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"), + Resolving_in_0_mode_with_conditions_1: diag(6402, ts.DiagnosticCategory.Message, "Resolving_in_0_mode_with_conditions_1_6402", "Resolving in {0} mode with conditions {1}."), + Matched_0_condition_1: diag(6403, ts.DiagnosticCategory.Message, "Matched_0_condition_1_6403", "Matched '{0}' condition '{1}'."), + Using_0_subpath_1_with_target_2: diag(6404, ts.DiagnosticCategory.Message, "Using_0_subpath_1_with_target_2_6404", "Using '{0}' subpath '{1}' with target '{2}'."), + Saw_non_matching_condition_0: diag(6405, ts.DiagnosticCategory.Message, "Saw_non_matching_condition_0_6405", "Saw non-matching condition '{0}'."), The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"), The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."), The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."), @@ -9978,6 +9840,7 @@ var ts; The_tag_was_first_specified_here: diag(8034, ts.DiagnosticCategory.Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."), You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."), You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."), + Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, ts.DiagnosticCategory.Error, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."), Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."), Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."), JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17000, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."), @@ -10051,6 +9914,8 @@ var ts; Remove_type_from_import_of_0_from_1: diag(90056, ts.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", "Remove 'type' from import of '{0}' from \"{1}\""), Add_import_from_0: diag(90057, ts.DiagnosticCategory.Message, "Add_import_from_0_90057", "Add import from \"{0}\""), Update_import_from_0: diag(90058, ts.DiagnosticCategory.Message, "Update_import_from_0_90058", "Update import from \"{0}\""), + Export_0_from_module_1: diag(90059, ts.DiagnosticCategory.Message, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"), + Export_all_referenced_locals: diag(90060, ts.DiagnosticCategory.Message, "Export_all_referenced_locals_90060", "Export all referenced locals"), Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"), Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"), Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"), @@ -10149,6 +10014,7 @@ var ts; Set_the_module_option_in_your_configuration_file_to_0: diag(95099, ts.DiagnosticCategory.Message, "Set_the_module_option_in_your_configuration_file_to_0_95099", "Set the 'module' option in your configuration file to '{0}'"), Convert_invalid_character_to_its_html_entity_code: diag(95100, ts.DiagnosticCategory.Message, "Convert_invalid_character_to_its_html_entity_code_95100", "Convert invalid character to its html entity code"), Convert_all_invalid_characters_to_HTML_entity_code: diag(95101, ts.DiagnosticCategory.Message, "Convert_all_invalid_characters_to_HTML_entity_code_95101", "Convert all invalid characters to HTML entity code"), + Convert_all_const_to_let: diag(95102, ts.DiagnosticCategory.Message, "Convert_all_const_to_let_95102", "Convert all 'const' to 'let'"), Convert_function_expression_0_to_arrow_function: diag(95105, ts.DiagnosticCategory.Message, "Convert_function_expression_0_to_arrow_function_95105", "Convert function expression '{0}' to arrow function"), Convert_function_declaration_0_to_arrow_function: diag(95106, ts.DiagnosticCategory.Message, "Convert_function_declaration_0_to_arrow_function_95106", "Convert function declaration '{0}' to arrow function"), Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"), @@ -10218,6 +10084,8 @@ var ts; Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"), Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"), Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"), + Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."), + Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."), No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."), Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."), JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"), @@ -10251,6 +10119,12 @@ var ts; _0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation: diag(18042, ts.DiagnosticCategory.Error, "_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation_18042", "'{0}' is a type and cannot be imported in JavaScript files. Use '{1}' in a JSDoc type annotation."), Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."), _0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."), + Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18045, ts.DiagnosticCategory.Error, "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045", "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."), + _0_is_of_type_unknown: diag(18046, ts.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."), + _0_is_possibly_null: diag(18047, ts.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."), + _0_is_possibly_undefined: diag(18048, ts.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."), + _0_is_possibly_null_or_undefined: diag(18049, ts.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."), + The_value_0_cannot_be_used_here: diag(18050, ts.DiagnosticCategory.Error, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."), }; })(ts || (ts = {})); var ts; @@ -10269,12 +10143,13 @@ var ts; /** @internal */ ts.textToKeywordObj = (_a = { abstract: 126 /* SyntaxKind.AbstractKeyword */, - any: 130 /* SyntaxKind.AnyKeyword */, - as: 127 /* SyntaxKind.AsKeyword */, - asserts: 128 /* SyntaxKind.AssertsKeyword */, - assert: 129 /* SyntaxKind.AssertKeyword */, - bigint: 158 /* SyntaxKind.BigIntKeyword */, - boolean: 133 /* SyntaxKind.BooleanKeyword */, + accessor: 127 /* SyntaxKind.AccessorKeyword */, + any: 131 /* SyntaxKind.AnyKeyword */, + as: 128 /* SyntaxKind.AsKeyword */, + asserts: 129 /* SyntaxKind.AssertsKeyword */, + assert: 130 /* SyntaxKind.AssertKeyword */, + bigint: 160 /* SyntaxKind.BigIntKeyword */, + boolean: 134 /* SyntaxKind.BooleanKeyword */, break: 81 /* SyntaxKind.BreakKeyword */, case: 82 /* SyntaxKind.CaseKeyword */, catch: 83 /* SyntaxKind.CatchKeyword */, @@ -10282,9 +10157,9 @@ var ts; continue: 86 /* SyntaxKind.ContinueKeyword */, const: 85 /* SyntaxKind.ConstKeyword */ }, - _a["" + "constructor"] = 134 /* SyntaxKind.ConstructorKeyword */, + _a["" + "constructor"] = 135 /* SyntaxKind.ConstructorKeyword */, _a.debugger = 87 /* SyntaxKind.DebuggerKeyword */, - _a.declare = 135 /* SyntaxKind.DeclareKeyword */, + _a.declare = 136 /* SyntaxKind.DeclareKeyword */, _a.default = 88 /* SyntaxKind.DefaultKeyword */, _a.delete = 89 /* SyntaxKind.DeleteKeyword */, _a.do = 90 /* SyntaxKind.DoKeyword */, @@ -10295,60 +10170,61 @@ var ts; _a.false = 95 /* SyntaxKind.FalseKeyword */, _a.finally = 96 /* SyntaxKind.FinallyKeyword */, _a.for = 97 /* SyntaxKind.ForKeyword */, - _a.from = 156 /* SyntaxKind.FromKeyword */, + _a.from = 158 /* SyntaxKind.FromKeyword */, _a.function = 98 /* SyntaxKind.FunctionKeyword */, - _a.get = 136 /* SyntaxKind.GetKeyword */, + _a.get = 137 /* SyntaxKind.GetKeyword */, _a.if = 99 /* SyntaxKind.IfKeyword */, _a.implements = 117 /* SyntaxKind.ImplementsKeyword */, _a.import = 100 /* SyntaxKind.ImportKeyword */, _a.in = 101 /* SyntaxKind.InKeyword */, - _a.infer = 137 /* SyntaxKind.InferKeyword */, + _a.infer = 138 /* SyntaxKind.InferKeyword */, _a.instanceof = 102 /* SyntaxKind.InstanceOfKeyword */, _a.interface = 118 /* SyntaxKind.InterfaceKeyword */, - _a.intrinsic = 138 /* SyntaxKind.IntrinsicKeyword */, - _a.is = 139 /* SyntaxKind.IsKeyword */, - _a.keyof = 140 /* SyntaxKind.KeyOfKeyword */, + _a.intrinsic = 139 /* SyntaxKind.IntrinsicKeyword */, + _a.is = 140 /* SyntaxKind.IsKeyword */, + _a.keyof = 141 /* SyntaxKind.KeyOfKeyword */, _a.let = 119 /* SyntaxKind.LetKeyword */, - _a.module = 141 /* SyntaxKind.ModuleKeyword */, - _a.namespace = 142 /* SyntaxKind.NamespaceKeyword */, - _a.never = 143 /* SyntaxKind.NeverKeyword */, + _a.module = 142 /* SyntaxKind.ModuleKeyword */, + _a.namespace = 143 /* SyntaxKind.NamespaceKeyword */, + _a.never = 144 /* SyntaxKind.NeverKeyword */, _a.new = 103 /* SyntaxKind.NewKeyword */, _a.null = 104 /* SyntaxKind.NullKeyword */, - _a.number = 147 /* SyntaxKind.NumberKeyword */, - _a.object = 148 /* SyntaxKind.ObjectKeyword */, + _a.number = 148 /* SyntaxKind.NumberKeyword */, + _a.object = 149 /* SyntaxKind.ObjectKeyword */, _a.package = 120 /* SyntaxKind.PackageKeyword */, _a.private = 121 /* SyntaxKind.PrivateKeyword */, _a.protected = 122 /* SyntaxKind.ProtectedKeyword */, _a.public = 123 /* SyntaxKind.PublicKeyword */, - _a.override = 159 /* SyntaxKind.OverrideKeyword */, - _a.out = 144 /* SyntaxKind.OutKeyword */, - _a.readonly = 145 /* SyntaxKind.ReadonlyKeyword */, - _a.require = 146 /* SyntaxKind.RequireKeyword */, - _a.global = 157 /* SyntaxKind.GlobalKeyword */, + _a.override = 161 /* SyntaxKind.OverrideKeyword */, + _a.out = 145 /* SyntaxKind.OutKeyword */, + _a.readonly = 146 /* SyntaxKind.ReadonlyKeyword */, + _a.require = 147 /* SyntaxKind.RequireKeyword */, + _a.global = 159 /* SyntaxKind.GlobalKeyword */, _a.return = 105 /* SyntaxKind.ReturnKeyword */, - _a.set = 149 /* SyntaxKind.SetKeyword */, + _a.satisfies = 150 /* SyntaxKind.SatisfiesKeyword */, + _a.set = 151 /* SyntaxKind.SetKeyword */, _a.static = 124 /* SyntaxKind.StaticKeyword */, - _a.string = 150 /* SyntaxKind.StringKeyword */, + _a.string = 152 /* SyntaxKind.StringKeyword */, _a.super = 106 /* SyntaxKind.SuperKeyword */, _a.switch = 107 /* SyntaxKind.SwitchKeyword */, - _a.symbol = 151 /* SyntaxKind.SymbolKeyword */, + _a.symbol = 153 /* SyntaxKind.SymbolKeyword */, _a.this = 108 /* SyntaxKind.ThisKeyword */, _a.throw = 109 /* SyntaxKind.ThrowKeyword */, _a.true = 110 /* SyntaxKind.TrueKeyword */, _a.try = 111 /* SyntaxKind.TryKeyword */, - _a.type = 152 /* SyntaxKind.TypeKeyword */, + _a.type = 154 /* SyntaxKind.TypeKeyword */, _a.typeof = 112 /* SyntaxKind.TypeOfKeyword */, - _a.undefined = 153 /* SyntaxKind.UndefinedKeyword */, - _a.unique = 154 /* SyntaxKind.UniqueKeyword */, - _a.unknown = 155 /* SyntaxKind.UnknownKeyword */, + _a.undefined = 155 /* SyntaxKind.UndefinedKeyword */, + _a.unique = 156 /* SyntaxKind.UniqueKeyword */, + _a.unknown = 157 /* SyntaxKind.UnknownKeyword */, _a.var = 113 /* SyntaxKind.VarKeyword */, _a.void = 114 /* SyntaxKind.VoidKeyword */, _a.while = 115 /* SyntaxKind.WhileKeyword */, _a.with = 116 /* SyntaxKind.WithKeyword */, _a.yield = 125 /* SyntaxKind.YieldKeyword */, - _a.async = 131 /* SyntaxKind.AsyncKeyword */, - _a.await = 132 /* SyntaxKind.AwaitKeyword */, - _a.of = 160 /* SyntaxKind.OfKeyword */, + _a.async = 132 /* SyntaxKind.AsyncKeyword */, + _a.await = 133 /* SyntaxKind.AwaitKeyword */, + _a.of = 162 /* SyntaxKind.OfKeyword */, _a); var textToKeyword = new ts.Map(ts.getEntries(ts.textToKeywordObj)); var textToToken = new ts.Map(ts.getEntries(__assign(__assign({}, ts.textToKeywordObj), { "{": 18 /* SyntaxKind.OpenBraceToken */, "}": 19 /* SyntaxKind.CloseBraceToken */, "(": 20 /* SyntaxKind.OpenParenToken */, ")": 21 /* SyntaxKind.CloseParenToken */, "[": 22 /* SyntaxKind.OpenBracketToken */, "]": 23 /* SyntaxKind.CloseBracketToken */, ".": 24 /* SyntaxKind.DotToken */, "...": 25 /* SyntaxKind.DotDotDotToken */, ";": 26 /* SyntaxKind.SemicolonToken */, ",": 27 /* SyntaxKind.CommaToken */, "<": 29 /* SyntaxKind.LessThanToken */, ">": 31 /* SyntaxKind.GreaterThanToken */, "<=": 32 /* SyntaxKind.LessThanEqualsToken */, ">=": 33 /* SyntaxKind.GreaterThanEqualsToken */, "==": 34 /* SyntaxKind.EqualsEqualsToken */, "!=": 35 /* SyntaxKind.ExclamationEqualsToken */, "===": 36 /* SyntaxKind.EqualsEqualsEqualsToken */, "!==": 37 /* SyntaxKind.ExclamationEqualsEqualsToken */, "=>": 38 /* SyntaxKind.EqualsGreaterThanToken */, "+": 39 /* SyntaxKind.PlusToken */, "-": 40 /* SyntaxKind.MinusToken */, "**": 42 /* SyntaxKind.AsteriskAsteriskToken */, "*": 41 /* SyntaxKind.AsteriskToken */, "/": 43 /* SyntaxKind.SlashToken */, "%": 44 /* SyntaxKind.PercentToken */, "++": 45 /* SyntaxKind.PlusPlusToken */, "--": 46 /* SyntaxKind.MinusMinusToken */, "<<": 47 /* SyntaxKind.LessThanLessThanToken */, ">": 48 /* SyntaxKind.GreaterThanGreaterThanToken */, ">>>": 49 /* SyntaxKind.GreaterThanGreaterThanGreaterThanToken */, "&": 50 /* SyntaxKind.AmpersandToken */, "|": 51 /* SyntaxKind.BarToken */, "^": 52 /* SyntaxKind.CaretToken */, "!": 53 /* SyntaxKind.ExclamationToken */, "~": 54 /* SyntaxKind.TildeToken */, "&&": 55 /* SyntaxKind.AmpersandAmpersandToken */, "||": 56 /* SyntaxKind.BarBarToken */, "?": 57 /* SyntaxKind.QuestionToken */, "??": 60 /* SyntaxKind.QuestionQuestionToken */, "?.": 28 /* SyntaxKind.QuestionDotToken */, ":": 58 /* SyntaxKind.ColonToken */, "=": 63 /* SyntaxKind.EqualsToken */, "+=": 64 /* SyntaxKind.PlusEqualsToken */, "-=": 65 /* SyntaxKind.MinusEqualsToken */, "*=": 66 /* SyntaxKind.AsteriskEqualsToken */, "**=": 67 /* SyntaxKind.AsteriskAsteriskEqualsToken */, "/=": 68 /* SyntaxKind.SlashEqualsToken */, "%=": 69 /* SyntaxKind.PercentEqualsToken */, "<<=": 70 /* SyntaxKind.LessThanLessThanEqualsToken */, ">>=": 71 /* SyntaxKind.GreaterThanGreaterThanEqualsToken */, ">>>=": 72 /* SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 73 /* SyntaxKind.AmpersandEqualsToken */, "|=": 74 /* SyntaxKind.BarEqualsToken */, "^=": 78 /* SyntaxKind.CaretEqualsToken */, "||=": 75 /* SyntaxKind.BarBarEqualsToken */, "&&=": 76 /* SyntaxKind.AmpersandAmpersandEqualsToken */, "??=": 77 /* SyntaxKind.QuestionQuestionEqualsToken */, "@": 59 /* SyntaxKind.AtToken */, "#": 62 /* SyntaxKind.HashToken */, "`": 61 /* SyntaxKind.BacktickToken */ }))); @@ -10471,7 +10347,7 @@ var ts; ts.stringToToken = stringToToken; /* @internal */ function computeLineStarts(text) { - var result = new Array(); + var result = []; var pos = 0; var lineStart = 0; while (pos < text.length) { @@ -11497,7 +11373,7 @@ var ts; return -1; } function peekExtendedUnicodeEscape() { - if (languageVersion >= 2 /* ScriptTarget.ES2015 */ && codePointAt(text, pos + 1) === 117 /* CharacterCodes.u */ && codePointAt(text, pos + 2) === 123 /* CharacterCodes.openBrace */) { + if (codePointAt(text, pos + 1) === 117 /* CharacterCodes.u */ && codePointAt(text, pos + 2) === 123 /* CharacterCodes.openBrace */) { var start_2 = pos; pos += 3; var escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false); @@ -12032,12 +11908,36 @@ var ts; pos++; return token = 0 /* SyntaxKind.Unknown */; } - if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) { + var charAfterHash = codePointAt(text, pos + 1); + if (charAfterHash === 92 /* CharacterCodes.backslash */) { + pos++; + var extendedCookedChar_1 = peekExtendedUnicodeEscape(); + if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) { + pos += 3; + tokenFlags |= 8 /* TokenFlags.ExtendedUnicodeEscape */; + tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + var cookedChar_1 = peekUnicodeEscape(); + if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) { + pos += 6; + tokenFlags |= 1024 /* TokenFlags.UnicodeEscape */; + tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + pos--; + } + if (isIdentifierStart(charAfterHash, languageVersion)) { pos++; - scanIdentifier(codePointAt(text, pos), languageVersion); + // We're relying on scanIdentifier's behavior and adjusting the token kind after the fact. + // Notably absent from this block is the fact that calling a function named "scanIdentifier", + // but identifiers don't include '#', and that function doesn't deal with it at all. + // This works because 'scanIdentifier' tries to reuse source characters and builds up substrings; + // however, it starts at the 'tokenPos' which includes the '#', and will "accidentally" prepend the '#' for us. + scanIdentifier(charAfterHash, languageVersion); } else { - tokenValue = String.fromCharCode(codePointAt(text, pos)); + tokenValue = "#"; error(ts.Diagnostics.Invalid_character, pos++, charSize(ch)); } return token = 80 /* SyntaxKind.PrivateIdentifier */; @@ -12788,9 +12688,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 163 /* SyntaxKind.TypeParameter */) { + if (d && d.kind === 165 /* SyntaxKind.TypeParameter */) { for (var current = d; current; current = current.parent) { - if (isFunctionLike(current) || isClassLike(current) || current.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (isFunctionLike(current) || isClassLike(current) || current.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return current; } } @@ -12798,7 +12698,7 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node, parent) { - return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 171 /* SyntaxKind.Constructor */; + return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 173 /* SyntaxKind.Constructor */; } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function isEmptyBindingPattern(node) { @@ -12828,14 +12728,14 @@ var ts; node = walkUpBindingElementsAndPatterns(node); } var flags = getFlags(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node && node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { flags |= getFlags(node); node = node.parent; } - if (node && node.kind === 237 /* SyntaxKind.VariableStatement */) { + if (node && node.kind === 240 /* SyntaxKind.VariableStatement */) { flags |= getFlags(node); } return flags; @@ -13008,30 +12908,30 @@ var ts; } // Covers remaining cases (returning undefined if none match). switch (hostNode.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: var expr = hostNode.expression; - if (expr.kind === 221 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (expr.kind === 223 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { expr = expr.left; } switch (expr.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return expr.name; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; } } break; - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { return getDeclarationIdentifier(hostNode.expression); } - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { if (isDeclaration(hostNode.statement) || isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -13068,16 +12968,16 @@ var ts; switch (declaration.kind) { case 79 /* SyntaxKind.Identifier */: return declaration; - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: { var name = declaration.name; - if (name.kind === 161 /* SyntaxKind.QualifiedName */) { + if (name.kind === 163 /* SyntaxKind.QualifiedName */) { return name.right; } break; } - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var expr_1 = declaration; switch (ts.getAssignmentDeclarationKind(expr_1)) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -13093,15 +12993,15 @@ var ts; return undefined; } } - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); - case 339 /* SyntaxKind.JSDocEnumTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return nameForNamelessJSDocTypedef(declaration); - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = declaration; if (ts.isBindableStaticElementAccessExpression(expr)) { return expr.argumentExpression; @@ -13145,7 +13045,7 @@ var ts; } ts.getDecorators = getDecorators; function getModifiers(node) { - if (ts.hasSyntacticModifier(node, 125951 /* ModifierFlags.Modifier */)) { + if (ts.hasSyntacticModifier(node, 126975 /* ModifierFlags.Modifier */)) { return ts.filter(node.modifiers, isModifier); } } @@ -13406,12 +13306,12 @@ var ts; /** Gets the text of a jsdoc comment, flattening links to their text. */ function getTextOfJSDocComment(comment) { return typeof comment === "string" ? comment - : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 321 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); + : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 324 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); } ts.getTextOfJSDocComment = getTextOfJSDocComment; function formatJSDocLink(link) { - var kind = link.kind === 324 /* SyntaxKind.JSDocLink */ ? "link" - : link.kind === 325 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" + var kind = link.kind === 327 /* SyntaxKind.JSDocLink */ ? "link" + : link.kind === 328 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" : "linkplain"; var name = link.name ? ts.entityNameToString(link.name) : ""; var space = link.name && link.text.startsWith("://") ? "" : " "; @@ -13432,7 +13332,7 @@ var ts; return ts.emptyArray; } if (ts.isJSDocTypeAlias(node)) { - ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDoc */); + ts.Debug.assert(node.parent.kind === 323 /* SyntaxKind.JSDoc */); return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; }); } if (node.typeParameters) { @@ -13467,7 +13367,7 @@ var ts; ts.isMemberName = isMemberName; /* @internal */ function isGetOrSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */ || node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */ || node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration; function isPropertyAccessChain(node) { @@ -13485,10 +13385,10 @@ var ts; function isOptionalChain(node) { var kind = node.kind; return !!(node.flags & 32 /* NodeFlags.OptionalChain */) && - (kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 207 /* SyntaxKind.ElementAccessExpression */ - || kind === 208 /* SyntaxKind.CallExpression */ - || kind === 230 /* SyntaxKind.NonNullExpression */); + (kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 209 /* SyntaxKind.ElementAccessExpression */ + || kind === 210 /* SyntaxKind.CallExpression */ + || kind === 232 /* SyntaxKind.NonNullExpression */); } ts.isOptionalChain = isOptionalChain; /* @internal */ @@ -13523,7 +13423,7 @@ var ts; } ts.isOutermostOptionalChain = isOutermostOptionalChain; function isNullishCoalesce(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; } ts.isNullishCoalesce = isNullishCoalesce; function isConstTypeReference(node) { @@ -13540,17 +13440,17 @@ var ts; } ts.isNonNullChain = isNonNullChain; function isBreakOrContinueStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */ || node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */ || node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isNamedExportBindings(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExportBindings = isNamedExportBindings; function isUnparsedTextLike(node) { switch (node.kind) { - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return true; default: return false; @@ -13559,12 +13459,12 @@ var ts; ts.isUnparsedTextLike = isUnparsedTextLike; function isUnparsedNode(node) { return isUnparsedTextLike(node) || - node.kind === 300 /* SyntaxKind.UnparsedPrologue */ || - node.kind === 304 /* SyntaxKind.UnparsedSyntheticReference */; + node.kind === 303 /* SyntaxKind.UnparsedPrologue */ || + node.kind === 307 /* SyntaxKind.UnparsedSyntheticReference */; } ts.isUnparsedNode = isUnparsedNode; function isJSDocPropertyLikeTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; // #endregion @@ -13580,7 +13480,7 @@ var ts; ts.isNode = isNode; /* @internal */ function isNodeKind(kind) { - return kind >= 161 /* SyntaxKind.FirstNode */; + return kind >= 163 /* SyntaxKind.FirstNode */; } ts.isNodeKind = isNodeKind; /** @@ -13589,7 +13489,7 @@ var ts; * Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail. */ function isTokenKind(kind) { - return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */; + return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 162 /* SyntaxKind.LastToken */; } ts.isTokenKind = isTokenKind; /** @@ -13604,7 +13504,7 @@ var ts; // Node Arrays /* @internal */ function isNodeArray(array) { - return array.hasOwnProperty("pos") && array.hasOwnProperty("end"); + return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end"); } ts.isNodeArray = isNodeArray; // Literals @@ -13620,11 +13520,11 @@ var ts; /** @internal */ function isLiteralExpressionOfObject(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; } return false; @@ -13652,13 +13552,13 @@ var ts; ts.isImportOrExportSpecifier = isImportOrExportSpecifier; function isTypeOnlyImportOrExportDeclaration(node) { switch (node.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return node.isTypeOnly || node.parent.parent.isTypeOnly; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.isTypeOnly; - case 267 /* SyntaxKind.ImportClause */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.isTypeOnly; default: return false; @@ -13679,6 +13579,11 @@ var ts; return ts.isIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; } ts.isGeneratedIdentifier = isGeneratedIdentifier; + /* @internal */ + function isGeneratedPrivateIdentifier(node) { + return ts.isPrivateIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; + } + ts.isGeneratedPrivateIdentifier = isGeneratedPrivateIdentifier; // Private Identifiers /*@internal*/ function isPrivateIdentifierClassElementDeclaration(node) { @@ -13695,19 +13600,20 @@ var ts; function isModifierKind(token) { switch (token) { case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 101 /* SyntaxKind.InKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; } return false; @@ -13720,7 +13626,10 @@ var ts; ts.isParameterPropertyModifier = isParameterPropertyModifier; /* @internal */ function isClassMemberModifier(idToken) { - return isParameterPropertyModifier(idToken) || idToken === 124 /* SyntaxKind.StaticKeyword */ || idToken === 159 /* SyntaxKind.OverrideKeyword */; + return isParameterPropertyModifier(idToken) || + idToken === 124 /* SyntaxKind.StaticKeyword */ || + idToken === 161 /* SyntaxKind.OverrideKeyword */ || + idToken === 127 /* SyntaxKind.AccessorKeyword */; } ts.isClassMemberModifier = isClassMemberModifier; function isModifier(node) { @@ -13729,7 +13638,7 @@ var ts; ts.isModifier = isModifier; function isEntityName(node) { var kind = node.kind; - return kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isEntityName = isEntityName; @@ -13739,14 +13648,14 @@ var ts; || kind === 80 /* SyntaxKind.PrivateIdentifier */ || kind === 10 /* SyntaxKind.StringLiteral */ || kind === 8 /* SyntaxKind.NumericLiteral */ - || kind === 162 /* SyntaxKind.ComputedPropertyName */; + || kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isPropertyName = isPropertyName; function isBindingName(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */ - || kind === 202 /* SyntaxKind.ArrayBindingPattern */; + || kind === 203 /* SyntaxKind.ObjectBindingPattern */ + || kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Functions @@ -13771,13 +13680,13 @@ var ts; ts.isBooleanLiteral = isBooleanLiteral; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -13786,14 +13695,14 @@ var ts; /* @internal */ function isFunctionLikeKind(kind) { switch (kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; default: return isFunctionLikeDeclarationKind(kind); @@ -13808,36 +13717,53 @@ var ts; // Classes function isClassElement(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 234 /* SyntaxKind.SemicolonClassElement */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */); + return node && (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isClassLike = isClassLike; function isAccessor(node) { - return node && (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */); + return node && (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */); } ts.isAccessor = isAccessor; + function isAutoAccessorPropertyDeclaration(node) { + return ts.isPropertyDeclaration(node) && ts.hasAccessorModifier(node); + } + ts.isAutoAccessorPropertyDeclaration = isAutoAccessorPropertyDeclaration; /* @internal */ function isMethodOrAccessor(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; } } ts.isMethodOrAccessor = isMethodOrAccessor; + /* @internal */ + function isNamedClassElement(node) { + switch (node.kind) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return true; + default: + return false; + } + } + ts.isNamedClassElement = isNamedClassElement; // Type members function isModifierLike(node) { return isModifier(node) || ts.isDecorator(node); @@ -13845,13 +13771,13 @@ var ts; ts.isModifierLike = isModifierLike; function isTypeElement(node) { var kind = node.kind; - return kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 174 /* SyntaxKind.CallSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 176 /* SyntaxKind.CallSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isTypeElement = isTypeElement; function isClassOrTypeElement(node) { @@ -13860,12 +13786,12 @@ var ts; ts.isClassOrTypeElement = isClassOrTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 298 /* SyntaxKind.SpreadAssignment */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 301 /* SyntaxKind.SpreadAssignment */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type @@ -13880,8 +13806,8 @@ var ts; ts.isTypeNode = isTypeNode; function isFunctionOrConstructorTypeNode(node) { switch (node.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; } return false; @@ -13892,8 +13818,8 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 202 /* SyntaxKind.ArrayBindingPattern */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return kind === 204 /* SyntaxKind.ArrayBindingPattern */ + || kind === 203 /* SyntaxKind.ObjectBindingPattern */; } return false; } @@ -13901,15 +13827,15 @@ var ts; /* @internal */ function isAssignmentPattern(node) { var kind = node.kind; - return kind === 204 /* SyntaxKind.ArrayLiteralExpression */ - || kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return kind === 206 /* SyntaxKind.ArrayLiteralExpression */ + || kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; /* @internal */ function isArrayBindingElement(node) { var kind = node.kind; - return kind === 203 /* SyntaxKind.BindingElement */ - || kind === 227 /* SyntaxKind.OmittedExpression */; + return kind === 205 /* SyntaxKind.BindingElement */ + || kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -13918,9 +13844,9 @@ var ts; /* @internal */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: return true; } return false; @@ -13941,8 +13867,8 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return true; } return false; @@ -13951,10 +13877,10 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentElement(node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty - case 298 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty + case 301 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty return true; } return false; @@ -13966,8 +13892,8 @@ var ts; /* @internal */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; } return false; @@ -13976,26 +13902,26 @@ var ts; /* @internal */ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */ - || kind === 200 /* SyntaxKind.ImportType */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */ + || kind === 202 /* SyntaxKind.ImportType */; } ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; // Expression function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: return true; default: return false; @@ -14003,12 +13929,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */ || node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */ || node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 223 /* SyntaxKind.TemplateExpression */ + return kind === 225 /* SyntaxKind.TemplateExpression */ || kind === 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; @@ -14019,19 +13945,19 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: // technically this is only an Expression if it's in a `#field in expr` BinaryExpression case 13 /* SyntaxKind.RegularExpressionLiteral */: @@ -14039,15 +13965,15 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 230 /* SyntaxKind.NonNullExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 231 /* SyntaxKind.MetaProperty */: + case 232 /* SyntaxKind.NonNullExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 233 /* SyntaxKind.MetaProperty */: case 100 /* SyntaxKind.ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: @@ -14061,13 +13987,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return true; default: return isLeftHandSideExpressionKind(kind); @@ -14076,9 +14002,9 @@ var ts; /* @internal */ function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; default: @@ -14097,15 +14023,16 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 221 /* SyntaxKind.BinaryExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 229 /* SyntaxKind.AsExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 223 /* SyntaxKind.BinaryExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 231 /* SyntaxKind.AsExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -14113,8 +14040,8 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 211 /* SyntaxKind.TypeAssertionExpression */ - || kind === 229 /* SyntaxKind.AsExpression */; + return kind === 213 /* SyntaxKind.TypeAssertionExpression */ + || kind === 231 /* SyntaxKind.AsExpression */; } ts.isAssertionExpression = isAssertionExpression; /* @internal */ @@ -14125,13 +14052,13 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -14160,7 +14087,7 @@ var ts; ts.isExternalModuleIndicator = isExternalModuleIndicator; /* @internal */ function isForInOrOfStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */ || node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */ || node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForInOrOfStatement = isForInOrOfStatement; // Element @@ -14184,115 +14111,115 @@ var ts; /* @internal */ function isModuleBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleBody = isModuleBody; /* @internal */ function isNamespaceBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isNamespaceBody = isNamespaceBody; /* @internal */ function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; /* @internal */ function isNamedImportBindings(node) { var kind = node.kind; - return kind === 269 /* SyntaxKind.NamedImports */ - || kind === 268 /* SyntaxKind.NamespaceImport */; + return kind === 272 /* SyntaxKind.NamedImports */ + || kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; /* @internal */ function isModuleOrEnumDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 203 /* SyntaxKind.BindingElement */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 299 /* SyntaxKind.EnumMember */ - || kind === 275 /* SyntaxKind.ExportSpecifier */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 267 /* SyntaxKind.ImportClause */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 270 /* SyntaxKind.ImportSpecifier */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 268 /* SyntaxKind.NamespaceImport */ - || kind === 274 /* SyntaxKind.NamespaceExport */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 254 /* SyntaxKind.VariableDeclaration */ - || kind === 345 /* SyntaxKind.JSDocTypedefTag */ - || kind === 338 /* SyntaxKind.JSDocCallbackTag */ - || kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 205 /* SyntaxKind.BindingElement */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 302 /* SyntaxKind.EnumMember */ + || kind === 278 /* SyntaxKind.ExportSpecifier */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 270 /* SyntaxKind.ImportClause */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 273 /* SyntaxKind.ImportSpecifier */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 271 /* SyntaxKind.NamespaceImport */ + || kind === 277 /* SyntaxKind.NamespaceExport */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 257 /* SyntaxKind.VariableDeclaration */ + || kind === 348 /* SyntaxKind.JSDocTypedefTag */ + || kind === 341 /* SyntaxKind.JSDocCallbackTag */ + || kind === 350 /* SyntaxKind.JSDocPropertyTag */; } function isDeclarationStatementKind(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 236 /* SyntaxKind.EmptyStatement */ - || kind === 243 /* SyntaxKind.ForInStatement */ - || kind === 244 /* SyntaxKind.ForOfStatement */ - || kind === 242 /* SyntaxKind.ForStatement */ - || kind === 239 /* SyntaxKind.IfStatement */ - || kind === 250 /* SyntaxKind.LabeledStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 249 /* SyntaxKind.SwitchStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 252 /* SyntaxKind.TryStatement */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 241 /* SyntaxKind.WhileStatement */ - || kind === 248 /* SyntaxKind.WithStatement */ - || kind === 349 /* SyntaxKind.NotEmittedStatement */ - || kind === 353 /* SyntaxKind.EndOfDeclarationMarker */ - || kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 239 /* SyntaxKind.EmptyStatement */ + || kind === 246 /* SyntaxKind.ForInStatement */ + || kind === 247 /* SyntaxKind.ForOfStatement */ + || kind === 245 /* SyntaxKind.ForStatement */ + || kind === 242 /* SyntaxKind.IfStatement */ + || kind === 253 /* SyntaxKind.LabeledStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 252 /* SyntaxKind.SwitchStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 255 /* SyntaxKind.TryStatement */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 244 /* SyntaxKind.WhileStatement */ + || kind === 251 /* SyntaxKind.WithStatement */ + || kind === 352 /* SyntaxKind.NotEmittedStatement */ + || kind === 356 /* SyntaxKind.EndOfDeclarationMarker */ + || kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { - return (node.parent && node.parent.kind !== 344 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { + return (node.parent && node.parent.kind !== 347 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); } return isDeclarationKind(node.kind); } @@ -14319,10 +14246,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 235 /* SyntaxKind.Block */) + if (node.kind !== 238 /* SyntaxKind.Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 252 /* SyntaxKind.TryStatement */ || node.parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (node.parent.kind === 255 /* SyntaxKind.TryStatement */ || node.parent.kind === 295 /* SyntaxKind.CatchClause */) { return false; } } @@ -14336,15 +14263,15 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 235 /* SyntaxKind.Block */; + || kind === 238 /* SyntaxKind.Block */; } ts.isStatementOrBlock = isStatementOrBlock; // Module references /* @internal */ function isModuleReference(node) { var kind = node.kind; - return kind === 277 /* SyntaxKind.ExternalModuleReference */ - || kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 280 /* SyntaxKind.ExternalModuleReference */ + || kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleReference = isModuleReference; @@ -14354,58 +14281,58 @@ var ts; var kind = node.kind; return kind === 108 /* SyntaxKind.ThisKeyword */ || kind === 79 /* SyntaxKind.Identifier */ - || kind === 206 /* SyntaxKind.PropertyAccessExpression */; + || kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; /* @internal */ function isJsxChild(node) { var kind = node.kind; - return kind === 278 /* SyntaxKind.JsxElement */ - || kind === 288 /* SyntaxKind.JsxExpression */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */ + return kind === 281 /* SyntaxKind.JsxElement */ + || kind === 291 /* SyntaxKind.JsxExpression */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || kind === 11 /* SyntaxKind.JsxText */ - || kind === 282 /* SyntaxKind.JsxFragment */; + || kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 10 /* SyntaxKind.StringLiteral */ - || kind === 288 /* SyntaxKind.JsxExpression */; + || kind === 291 /* SyntaxKind.JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 280 /* SyntaxKind.JsxOpeningElement */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return kind === 283 /* SyntaxKind.JsxOpeningElement */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 289 /* SyntaxKind.CaseClause */ - || kind === 290 /* SyntaxKind.DefaultClause */; + return kind === 292 /* SyntaxKind.CaseClause */ + || kind === 293 /* SyntaxKind.DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 309 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocNode */; + return node.kind >= 312 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */ - || node.kind === 319 /* SyntaxKind.JSDocNamepathType */ - || node.kind === 321 /* SyntaxKind.JSDocText */ + return node.kind === 323 /* SyntaxKind.JSDoc */ + || node.kind === 322 /* SyntaxKind.JSDocNamepathType */ + || node.kind === 324 /* SyntaxKind.JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) @@ -14415,15 +14342,15 @@ var ts; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 327 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocTagNode */; + return node.kind >= 330 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessor = isSetAccessor; function isGetAccessor(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessor = isGetAccessor; /** True if has jsdoc nodes attached to it. */ @@ -14449,12 +14376,12 @@ var ts; /** True if has initializer node attached to it. */ function hasOnlyExpressionInitializer(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: return true; default: return false; @@ -14462,12 +14389,12 @@ var ts; } ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */ || node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); + return node.kind === 288 /* SyntaxKind.JsxAttribute */ || node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); } ts.isObjectLiteralElement = isObjectLiteralElement; /* @internal */ function isTypeReferenceType(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -14500,7 +14427,7 @@ var ts; } ts.isStringLiteralLike = isStringLiteralLike; function isJSDocLinkLike(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */ || node.kind === 325 /* SyntaxKind.JSDocLinkCode */ || node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 327 /* SyntaxKind.JSDocLink */ || node.kind === 328 /* SyntaxKind.JSDocLinkCode */ || node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkLike = isJSDocLinkLike; function hasRestParameter(s) { @@ -14510,7 +14437,7 @@ var ts; ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type; - return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.dotDotDotToken !== undefined || !!type && type.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isRestParameter = isRestParameter; // #endregion @@ -14768,7 +14695,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 305 /* SyntaxKind.SourceFile */) { + while (node && node.kind !== 308 /* SyntaxKind.SourceFile */) { node = node.parent; } return node; @@ -14784,11 +14711,11 @@ var ts; ts.isPlainJsFile = isPlainJsFile; function isStatementWithLocals(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return true; } return false; @@ -14984,7 +14911,7 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 348 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { + if (node.kind === 351 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, @@ -15049,7 +14976,6 @@ var ts; return emitNode && emitNode.flags || 0; } ts.getEmitFlags = getEmitFlags; - ; function getScriptTargetFeatures() { return { es2015: { @@ -15222,7 +15148,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -15254,11 +15180,11 @@ var ts; ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return !!node && node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && (!node.body); + return !!node && node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || + return node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || ts.isFunctionLikeOrClassStaticBlockDeclaration(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -15275,9 +15201,9 @@ var ts; // - defined in the top level scope and source file is an external module // - defined inside ambient module declaration located in the top level scope and source file not an external module switch (node.parent.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node.parent); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -15332,26 +15258,30 @@ var ts; return false; } ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile; + function isAmbientPropertyDeclaration(node) { + return !!(node.flags & 16777216 /* NodeFlags.Ambient */) || hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); + } + ts.isAmbientPropertyDeclaration = isAmbientPropertyDeclaration; function isBlockScope(node, parentNode) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 292 /* SyntaxKind.CatchClause */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return !ts.isFunctionLikeOrClassStaticBlockDeclaration(parentNode); @@ -15361,9 +15291,9 @@ var ts; ts.isBlockScope = isBlockScope; function isDeclarationWithTypeParameters(node) { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 323 /* SyntaxKind.JSDocSignature */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 326 /* SyntaxKind.JSDocSignature */: return true; default: ts.assertType(node); @@ -15373,25 +15303,25 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isDeclarationWithTypeParameterChildren(node) { switch (node.kind) { - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: ts.assertType(node); @@ -15401,8 +15331,8 @@ var ts; ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren; function isAnyImportSyntax(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -15415,15 +15345,15 @@ var ts; ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire; function isLateVisibilityPaintedStatement(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return true; default: return false; @@ -15464,19 +15394,19 @@ var ts; } ts.getNameFromIndexInfo = getNameFromIndexInfo; function isComputedNonLiteralName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); } ts.isComputedNonLiteralName = isComputedNonLiteralName; function tryGetTextOfPropertyName(name) { switch (name.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - return name.escapedText; + return name.autoGenerateFlags ? undefined : name.escapedText; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: if (isStringOrNumericLiteralLike(name.expression)) return ts.escapeLeadingUnderscores(name.expression.text); return undefined; @@ -15496,16 +15426,16 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: case 79 /* SyntaxKind.Identifier */: return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (ts.isIdentifier(name.name) || ts.isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { return ts.Debug.assertNever(name.name); } - case 311 /* SyntaxKind.JSDocMemberName */: + case 314 /* SyntaxKind.JSDocMemberName */: return entityNameToString(name.left) + entityNameToString(name.right); default: return ts.Debug.assertNever(name); @@ -15595,7 +15525,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body && node.body.kind === 238 /* SyntaxKind.Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -15609,7 +15539,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -15618,29 +15548,29 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 268 /* SyntaxKind.NamespaceImport */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 271 /* SyntaxKind.NamespaceImport */: errorNode = node.name; break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: var start = ts.skipTrivia(sourceFile.text, node.pos); var end = node.statements.length > 0 ? node.statements[0].pos : node.end; return ts.createTextSpanFromBounds(start, end); @@ -15692,11 +15622,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; } ts.isImportCall = isImportCall; function isImportMeta(n) { @@ -15710,7 +15640,7 @@ var ts; } ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */ + return node.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.expression.kind === 10 /* SyntaxKind.StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -15738,13 +15668,13 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 164 /* SyntaxKind.Parameter */ || - node.kind === 163 /* SyntaxKind.TypeParameter */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 214 /* SyntaxKind.ArrowFunction */ || - node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */) ? + var commentRanges = (node.kind === 166 /* SyntaxKind.Parameter */ || + node.kind === 165 /* SyntaxKind.TypeParameter */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 216 /* SyntaxKind.ArrowFunction */ || + node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); // True if the comment starts with '/**' but not if it is '/**/' @@ -15760,48 +15690,48 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (177 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return true; case 114 /* SyntaxKind.VoidKeyword */: - return node.parent.kind !== 217 /* SyntaxKind.VoidExpression */; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + return node.parent.kind !== 219 /* SyntaxKind.VoidExpression */; + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 163 /* SyntaxKind.TypeParameter */: - return node.parent.kind === 195 /* SyntaxKind.MappedType */ || node.parent.kind === 190 /* SyntaxKind.InferType */; + case 165 /* SyntaxKind.TypeParameter */: + return node.parent.kind === 197 /* SyntaxKind.MappedType */ || node.parent.kind === 192 /* SyntaxKind.InferType */; // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case 79 /* SyntaxKind.Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); // falls through - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 108 /* SyntaxKind.ThisKeyword */: { var parent = node.parent; - if (parent.kind === 181 /* SyntaxKind.TypeQuery */) { + if (parent.kind === 183 /* SyntaxKind.TypeQuery */) { return false; } - if (parent.kind === 200 /* SyntaxKind.ImportType */) { + if (parent.kind === 202 /* SyntaxKind.ImportType */) { return !parent.isTypeOf; } // Do not recursively call isPartOfTypeNode on the parent. In the example: @@ -15810,40 +15740,40 @@ var ts; // // Calling isPartOfTypeNode would consider the qualified name A.B a type node. // Only C and A.B.C are type nodes. - if (177 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (parent.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent); - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return node === parent.constraint; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return node === parent.constraint; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return node === parent.type; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return node === parent.type; - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return node === parent.type; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return node === parent.type; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.contains(parent.typeArguments, node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -15868,23 +15798,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitor(node); - case 263 /* SyntaxKind.CaseBlock */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 266 /* SyntaxKind.CaseBlock */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return ts.forEachChild(node, traverse); } } @@ -15894,23 +15824,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, skip them to avoid the work. return; default: if (ts.isFunctionLike(node)) { - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. traverse(node.name.expression); @@ -15933,10 +15863,10 @@ var ts; * @param node The type node. */ function getRestParameterElementType(node) { - if (node && node.kind === 183 /* SyntaxKind.ArrayType */) { + if (node && node.kind === 185 /* SyntaxKind.ArrayType */) { return node.elementType; } - else if (node && node.kind === 178 /* SyntaxKind.TypeReference */) { + else if (node && node.kind === 180 /* SyntaxKind.TypeReference */) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -15946,12 +15876,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 182 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 184 /* SyntaxKind.TypeLiteral */: return node.members; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return node.properties; } } @@ -15959,14 +15889,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 299 /* SyntaxKind.EnumMember */: - case 164 /* SyntaxKind.Parameter */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 302 /* SyntaxKind.EnumMember */: + case 166 /* SyntaxKind.Parameter */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } } @@ -15978,8 +15908,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ - && node.parent.parent.kind === 237 /* SyntaxKind.VariableStatement */; + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ + && node.parent.parent.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isCommonJsExportedExpression(node) { @@ -16003,13 +15933,13 @@ var ts; ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return true; } return false; @@ -16020,7 +15950,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 250 /* SyntaxKind.LabeledStatement */) { + if (node.statement.kind !== 253 /* SyntaxKind.LabeledStatement */) { return node.statement; } node = node.statement; @@ -16028,17 +15958,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); + return node && node.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethodOrAccessor(node) { - return (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) && - (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || - node.parent.kind === 226 /* SyntaxKind.ClassExpression */); + return (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) && + (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || + node.parent.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethodOrAccessor = isObjectLiteralOrClassExpressionMethodOrAccessor; function isIdentifierTypePredicate(predicate) { @@ -16051,7 +15981,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return objectLiteral.properties.filter(function (property) { - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */) { var propName = tryGetTextOfPropertyName(property.name); return key === propName || (!!key2 && key2 === propName); } @@ -16113,14 +16043,14 @@ var ts; } ts.getContainingFunctionOrClassStaticBlock = getContainingFunctionOrClassStaticBlock; function getThisContainer(node, includeArrowFunctions) { - ts.Debug.assert(node.kind !== 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(node.kind !== 308 /* SyntaxKind.SourceFile */); while (true) { node = node.parent; if (!node) { return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that. } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -16135,9 +16065,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -16148,27 +16078,27 @@ var ts; node = node.parent; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (!includeArrowFunctions) { continue; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 305 /* SyntaxKind.SourceFile */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 308 /* SyntaxKind.SourceFile */: return node; } } @@ -16181,17 +16111,17 @@ var ts; switch (node.kind) { // Arrow functions use the same scope, but may do so in a "delayed" manner // For example, `const getThis = () => this` may be before a super() call in a derived constructor - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Object properties can have computed names; only method-like bodies start a new scope return true; default: @@ -16215,9 +16145,9 @@ var ts; var container = getThisContainer(node, /*includeArrowFunctions*/ false); if (container) { switch (container.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return container; } } @@ -16239,28 +16169,28 @@ var ts; return node; } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: node = node.parent; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (!stopOnFunctions) { continue; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return node; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -16276,14 +16206,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 213 /* SyntaxKind.FunctionExpression */ || func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 215 /* SyntaxKind.FunctionExpression */ || func.kind === 216 /* SyntaxKind.ArrowFunction */) { var prev = func; var parent = func.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { prev = parent; parent = parent.parent; } - if (parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === prev) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === prev) { return parent; } } @@ -16299,7 +16229,7 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperProperty = isSuperProperty; @@ -16308,7 +16238,7 @@ var ts; */ function isThisProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 108 /* SyntaxKind.ThisKeyword */; } ts.isThisProperty = isThisProperty; @@ -16327,15 +16257,15 @@ var ts; ts.isThisInitializedObjectBindingExpression = isThisInitializedObjectBindingExpression; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return node; } return undefined; @@ -16343,10 +16273,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return node.tag; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return node.tagName; default: return node.expression; @@ -16359,25 +16289,25 @@ var ts; return false; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // classes are valid targets return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + return parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 164 /* SyntaxKind.Parameter */: + && parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 166 /* SyntaxKind.Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; return parent.body !== undefined - && (parent.kind === 171 /* SyntaxKind.Constructor */ - || parent.kind === 169 /* SyntaxKind.MethodDeclaration */ - || parent.kind === 173 /* SyntaxKind.SetAccessor */) - && grandparent.kind === 257 /* SyntaxKind.ClassDeclaration */; + && (parent.kind === 173 /* SyntaxKind.Constructor */ + || parent.kind === 171 /* SyntaxKind.MethodDeclaration */ + || parent.kind === 175 /* SyntaxKind.SetAccessor */) + && grandparent.kind === 260 /* SyntaxKind.ClassDeclaration */; } return false; } @@ -16393,11 +16323,11 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217 - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217 default: return false; @@ -16413,9 +16343,9 @@ var ts; ts.classOrConstructorParameterIsDecorated = classOrConstructorParameterIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 280 /* SyntaxKind.JsxOpeningElement */ || - parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || - parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (parent.kind === 283 /* SyntaxKind.JsxOpeningElement */ || + parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || + parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return parent.tagName === node; } return false; @@ -16428,53 +16358,54 @@ var ts; case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 221 /* SyntaxKind.BinaryExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 223 /* SyntaxKind.TemplateExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 224 /* SyntaxKind.YieldExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 225 /* SyntaxKind.TemplateExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 226 /* SyntaxKind.YieldExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 233 /* SyntaxKind.MetaProperty */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return !ts.isHeritageClause(node.parent); - case 161 /* SyntaxKind.QualifiedName */: - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + case 163 /* SyntaxKind.QualifiedName */: + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); - case 311 /* SyntaxKind.JSDocMemberName */: + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + case 314 /* SyntaxKind.JSDocMemberName */: while (ts.isJSDocMemberName(node.parent)) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); case 80 /* SyntaxKind.PrivateIdentifier */: return ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; case 79 /* SyntaxKind.Identifier */: - if (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { + if (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { return true; } // falls through @@ -16492,60 +16423,62 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: return parent.initializer === node; - case 238 /* SyntaxKind.ExpressionStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 251 /* SyntaxKind.ThrowStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 254 /* SyntaxKind.ThrowStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forInStatement.expression === node; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return node === parent.expression; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node === parent.expression; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return node === parent.expression; - case 165 /* SyntaxKind.Decorator */: - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 167 /* SyntaxKind.Decorator */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 301 /* SyntaxKind.SpreadAssignment */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return parent.expression === node && !isPartOfTypeNode(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return parent.objectAssignmentInitializer === node; + case 235 /* SyntaxKind.SatisfiesExpression */: + return node === parent.expression; default: return isExpressionNode(parent); } } ts.isInExpressionContext = isInExpressionContext; function isPartOfTypeQuery(node) { - while (node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { + while (node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { node = node.parent; } - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isPartOfTypeQuery = isPartOfTypeQuery; function isNamespaceReexportDeclaration(node) { @@ -16553,7 +16486,7 @@ var ts; } ts.isNamespaceReexportDeclaration = isNamespaceReexportDeclaration; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -16566,7 +16499,7 @@ var ts; } ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJS(file) { @@ -16598,11 +16531,11 @@ var ts; ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && - (node.typeArguments[0].kind === 150 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */); + (node.typeArguments[0].kind === 152 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */); } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, requireStringLiteralLikeArgument) { - if (callExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (callExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -16711,11 +16644,11 @@ var ts; function getExpandoInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 213 /* SyntaxKind.FunctionExpression */ || e.kind === 214 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; + return e.kind === 215 /* SyntaxKind.FunctionExpression */ || e.kind === 216 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; } - if (initializer.kind === 213 /* SyntaxKind.FunctionExpression */ || - initializer.kind === 226 /* SyntaxKind.ClassExpression */ || - initializer.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (initializer.kind === 215 /* SyntaxKind.FunctionExpression */ || + initializer.kind === 228 /* SyntaxKind.ClassExpression */ || + initializer.kind === 216 /* SyntaxKind.ArrowFunction */) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -16961,7 +16894,7 @@ var ts; ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJSFile(expr) && - expr.parent && expr.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + expr.parent && expr.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && (!ts.isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!ts.getJSDocTypeTag(expr.parent); } @@ -16982,17 +16915,17 @@ var ts; return false; } var decl = symbol.valueDeclaration; - return decl.kind === 256 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); + return decl.kind === 259 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); } ts.isFunctionSymbol = isFunctionSymbol; function tryGetModuleSpecifierFromDeclaration(node) { var _a, _b; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0]; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike); default: ts.Debug.assertNever(node); @@ -17005,14 +16938,14 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function tryGetImportFromModuleSpecifier(node) { switch (node.parent.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.parent; - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return node.parent.parent; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return isImportCall(node.parent) || isRequireCall(node.parent, /*checkArg*/ false) ? node.parent : undefined; - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: ts.Debug.assert(ts.isStringLiteral(node)); return ts.tryCast(node.parent.parent, ts.isImportTypeNode); default: @@ -17022,16 +16955,16 @@ var ts; ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; - case 200 /* SyntaxKind.ImportType */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + return node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 202 /* SyntaxKind.ImportType */: return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return node.arguments[0]; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node.name.kind === 10 /* SyntaxKind.StringLiteral */ ? node.name : undefined; default: return ts.Debug.assertNever(node); @@ -17040,11 +16973,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.exportClause && ts.tryCast(node.exportClause, ts.isNamespaceExport); default: return ts.Debug.assertNever(node); @@ -17052,7 +16985,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function forEachImportClauseDeclaration(node, action) { @@ -17073,13 +17006,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return node.questionToken !== undefined; } } @@ -17093,7 +17026,7 @@ var ts; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function isJSDocTypeAlias(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 338 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 341 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocTypeAlias = isJSDocTypeAlias; function isTypeAlias(node) { @@ -17118,12 +17051,12 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return node.initializer; } } @@ -17135,7 +17068,7 @@ var ts; function getNestedModuleDeclaration(node) { return ts.isModuleDeclaration(node) && node.body && - node.body.kind === 261 /* SyntaxKind.ModuleDeclaration */ + node.body.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? node.body : undefined; } @@ -17150,11 +17083,11 @@ var ts; if (ts.hasJSDocNodes(node)) { result = ts.addRange(result, filterOwnedJSDocTags(hostNode, ts.last(node.jsDoc))); } - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocParameterTagsNoCache : ts.getJSDocParameterTags)(node)); break; } - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocTypeParameterTagsNoCache : ts.getJSDocTypeParameterTags)(node)); break; } @@ -17183,11 +17116,11 @@ var ts; } function getNextJSDocCommentLocation(node) { var parent = node.parent; - if (parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - parent.kind === 271 /* SyntaxKind.ExportAssignment */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 247 /* SyntaxKind.ReturnStatement */ || + if (parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + parent.kind === 274 /* SyntaxKind.ExportAssignment */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 250 /* SyntaxKind.ReturnStatement */ || getNestedModuleDeclaration(parent) || ts.isBinaryExpression(node) && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return parent; @@ -17297,34 +17230,34 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 63 /* SyntaxKind.EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* AssignmentKind.Definite */ : 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 45 /* SyntaxKind.PlusPlusToken */ || unaryOperator === 46 /* SyntaxKind.MinusMinusToken */ ? 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return parent.initializer === node ? 1 /* AssignmentKind.Definite */ : 0 /* AssignmentKind.None */; - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 232 /* SyntaxKind.NonNullExpression */: node = parent; break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: node = parent.parent; break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* AssignmentKind.None */; } node = parent.parent; break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (parent.name === node) { return 0 /* AssignmentKind.None */; } @@ -17351,22 +17284,22 @@ var ts; */ function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 237 /* SyntaxKind.VariableStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 238 /* SyntaxKind.Block */: + case 240 /* SyntaxKind.VariableStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return true; } return false; @@ -17383,11 +17316,11 @@ var ts; return node; } function walkUpParenthesizedTypes(node) { - return walkUp(node, 191 /* SyntaxKind.ParenthesizedType */); + return walkUp(node, 193 /* SyntaxKind.ParenthesizedType */); } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 212 /* SyntaxKind.ParenthesizedExpression */); + return walkUp(node, 214 /* SyntaxKind.ParenthesizedExpression */); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; /** @@ -17397,7 +17330,7 @@ var ts; */ function walkUpParenthesizedTypesAndGetParentAndChild(node) { var child; - while (node && node.kind === 191 /* SyntaxKind.ParenthesizedType */) { + while (node && node.kind === 193 /* SyntaxKind.ParenthesizedType */) { child = node; node = node.parent; } @@ -17419,11 +17352,11 @@ var ts; ts.skipParentheses = skipParentheses; // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped function isDeleteTarget(node) { - if (node.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 207 /* SyntaxKind.ElementAccessExpression */) { + if (node.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 209 /* SyntaxKind.ElementAccessExpression */) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node && node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -17476,7 +17409,7 @@ var ts; ts.getDeclarationFromName = getDeclarationFromName; function isLiteralComputedPropertyDeclarationName(node) { return isStringOrNumericLiteralLike(node) && - node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */ && + node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */ && ts.isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; @@ -17484,29 +17417,29 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: // Name on right hand side of dot in a type query or type reference return parent.right === node; - case 203 /* SyntaxKind.BindingElement */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 275 /* SyntaxKind.ExportSpecifier */: - case 285 /* SyntaxKind.JsxAttribute */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 288 /* SyntaxKind.JsxAttribute */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: // Any name in an export specifier or JSX Attribute or Jsx Element return true; } @@ -17529,14 +17462,14 @@ var ts; // const x = require("...").y // const { x } = require("...").y function isAliasSymbolDeclaration(node) { - if (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name || - node.kind === 268 /* SyntaxKind.NamespaceImport */ || - node.kind === 274 /* SyntaxKind.NamespaceExport */ || - node.kind === 270 /* SyntaxKind.ImportSpecifier */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { + if (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name || + node.kind === 271 /* SyntaxKind.NamespaceImport */ || + node.kind === 277 /* SyntaxKind.NamespaceExport */ || + node.kind === 273 /* SyntaxKind.ImportSpecifier */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { return true; } return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && exportAssignmentIsAlias(node) || @@ -17549,18 +17482,18 @@ var ts; ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getAliasDeclarationFromName(node) { switch (node.parent.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 271 /* SyntaxKind.ExportAssignment */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 274 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.parent; - } while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */); + } while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */); return getAliasDeclarationFromName(node); } } @@ -17579,7 +17512,7 @@ var ts; } ts.getExportAssignmentExpression = getExportAssignmentExpression; function getPropertyAssignmentAliasLikeExpression(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.initializer : + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.initializer : node.parent.right; } ts.getPropertyAssignmentAliasLikeExpression = getPropertyAssignmentAliasLikeExpression; @@ -17645,11 +17578,11 @@ var ts; } ts.getAncestor = getAncestor; function isKeyword(token) { - return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 160 /* SyntaxKind.LastKeyword */; + return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 162 /* SyntaxKind.LastKeyword */; } ts.isKeyword = isKeyword; function isContextualKeyword(token) { - return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 160 /* SyntaxKind.LastContextualKeyword */; + return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 162 /* SyntaxKind.LastContextualKeyword */; } ts.isContextualKeyword = isContextualKeyword; function isNonContextualKeyword(token) { @@ -17693,15 +17626,15 @@ var ts; } var flags = 0 /* FunctionFlags.Normal */; switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { flags |= 1 /* FunctionFlags.Generator */; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: - if (hasSyntacticModifier(node, 256 /* ModifierFlags.Async */)) { + case 216 /* SyntaxKind.ArrowFunction */: + if (hasSyntacticModifier(node, 512 /* ModifierFlags.Async */)) { flags |= 2 /* FunctionFlags.Async */; } break; @@ -17714,13 +17647,13 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return node.body !== undefined && node.asteriskToken === undefined - && hasSyntacticModifier(node, 256 /* ModifierFlags.Async */); + && hasSyntacticModifier(node, 512 /* ModifierFlags.Async */); } return false; } @@ -17747,7 +17680,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - if (!(name.kind === 162 /* SyntaxKind.ComputedPropertyName */ || name.kind === 207 /* SyntaxKind.ElementAccessExpression */)) { + if (!(name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || name.kind === 209 /* SyntaxKind.ElementAccessExpression */)) { return false; } var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression; @@ -17763,7 +17696,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameExpression = name.expression; if (isStringOrNumericLiteralLike(nameExpression)) { return ts.escapeLeadingUnderscores(nameExpression.text); @@ -17829,11 +17762,11 @@ var ts; ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 164 /* SyntaxKind.Parameter */; + return root.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 203 /* SyntaxKind.BindingElement */) { + while (node.kind === 205 /* SyntaxKind.BindingElement */) { node = node.parent.parent; } return node; @@ -17841,15 +17774,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 305 /* SyntaxKind.SourceFile */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 308 /* SyntaxKind.SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -17868,23 +17801,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 0 /* Associativity.Left */ : 1 /* Associativity.Right */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 1 /* Associativity.Right */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operator) { case 42 /* SyntaxKind.AsteriskAsteriskToken */: case 63 /* SyntaxKind.EqualsToken */: @@ -17911,15 +17844,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expression.kind === 223 /* SyntaxKind.BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 220 /* SyntaxKind.PostfixUnaryExpression */) { + else if (expression.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 222 /* SyntaxKind.PostfixUnaryExpression */) { return expression.operator; } else { @@ -18098,15 +18031,15 @@ var ts; })(OperatorPrecedence = ts.OperatorPrecedence || (ts.OperatorPrecedence = {})); function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return 0 /* OperatorPrecedence.Comma */; - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return 1 /* OperatorPrecedence.Spread */; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 2 /* OperatorPrecedence.Yield */; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return 4 /* OperatorPrecedence.Conditional */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operatorKind) { case 27 /* SyntaxKind.CommaToken */: return 0 /* OperatorPrecedence.Comma */; @@ -18131,26 +18064,27 @@ var ts; return getBinaryOperatorPrecedence(operatorKind); } // TODO: Should prefix `++` and `--` be moved to the `Update` precedence? - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return 16 /* OperatorPrecedence.Unary */; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return 17 /* OperatorPrecedence.Update */; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return 18 /* OperatorPrecedence.LeftHandSide */; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 19 /* OperatorPrecedence.Member */ : 18 /* OperatorPrecedence.LeftHandSide */; - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 233 /* SyntaxKind.MetaProperty */: return 19 /* OperatorPrecedence.Member */; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return 11 /* OperatorPrecedence.Relational */; case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: @@ -18162,19 +18096,19 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 225 /* SyntaxKind.TemplateExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: return 20 /* OperatorPrecedence.Primary */; default: return -1 /* OperatorPrecedence.Invalid */; @@ -18206,7 +18140,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: return 11 /* OperatorPrecedence.Relational */; case 47 /* SyntaxKind.LessThanLessThanToken */: case 48 /* SyntaxKind.GreaterThanGreaterThanToken */: @@ -18230,7 +18165,7 @@ var ts; function getSemanticJsxChildren(children) { return ts.filter(children, function (i) { switch (i.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !!i.expression; case 11 /* SyntaxKind.JsxText */: return !i.containsOnlyTriviaWhiteSpaces; @@ -18286,7 +18221,7 @@ var ts; } diagnostics = nonFileDiagnostics; } - ts.insertSorted(diagnostics, diagnostic, compareDiagnostics); + ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation); } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -18822,7 +18757,7 @@ var ts; while (ts.isQualifiedName(node.parent) && node.parent.left === node) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */; + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isThisInTypeQuery = isThisInTypeQuery; function identifierIsThisKeyword(id) { @@ -18837,10 +18772,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { + if (accessor.kind === 174 /* SyntaxKind.GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { setAccessor = accessor; } else { @@ -18860,10 +18795,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 172 /* SyntaxKind.GetAccessor */ && !getAccessor) { + if (member.kind === 174 /* SyntaxKind.GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && !setAccessor) { + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -18912,7 +18847,7 @@ var ts; ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations; /** template tags are only available when a typedef isn't already using them */ function isNonTypeAliasTemplate(tag) { - return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 320 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); + return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 323 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); } /** * Gets the effective type annotation of the value parameter of a set accessor. If the node @@ -19145,13 +19080,17 @@ var ts; } ts.hasOverrideModifier = hasOverrideModifier; function hasAbstractModifier(node) { - return hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + return hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); } ts.hasAbstractModifier = hasAbstractModifier; function hasAmbientModifier(node) { return hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); } ts.hasAmbientModifier = hasAmbientModifier; + function hasAccessorModifier(node) { + return hasSyntacticModifier(node, 128 /* ModifierFlags.Accessor */); + } + ts.hasAccessorModifier = hasAccessorModifier; function hasEffectiveReadonlyModifier(node) { return hasEffectiveModifier(node, 64 /* ModifierFlags.Readonly */); } @@ -19169,7 +19108,7 @@ var ts; } ts.getSelectedSyntacticModifierFlags = getSelectedSyntacticModifierFlags; function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) { - if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 162 /* SyntaxKind.LastToken */) { return 0 /* ModifierFlags.None */; } if (!(node.modifierFlagsCache & 536870912 /* ModifierFlags.HasComputedFlags */)) { @@ -19261,25 +19200,22 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: return 4 /* ModifierFlags.Public */; case 122 /* SyntaxKind.ProtectedKeyword */: return 16 /* ModifierFlags.Protected */; case 121 /* SyntaxKind.PrivateKeyword */: return 8 /* ModifierFlags.Private */; - case 126 /* SyntaxKind.AbstractKeyword */: return 128 /* ModifierFlags.Abstract */; + case 126 /* SyntaxKind.AbstractKeyword */: return 256 /* ModifierFlags.Abstract */; + case 127 /* SyntaxKind.AccessorKeyword */: return 128 /* ModifierFlags.Accessor */; case 93 /* SyntaxKind.ExportKeyword */: return 1 /* ModifierFlags.Export */; - case 135 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; + case 136 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; case 85 /* SyntaxKind.ConstKeyword */: return 2048 /* ModifierFlags.Const */; - case 88 /* SyntaxKind.DefaultKeyword */: return 512 /* ModifierFlags.Default */; - case 131 /* SyntaxKind.AsyncKeyword */: return 256 /* ModifierFlags.Async */; - case 145 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; - case 159 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; + case 88 /* SyntaxKind.DefaultKeyword */: return 1024 /* ModifierFlags.Default */; + case 132 /* SyntaxKind.AsyncKeyword */: return 512 /* ModifierFlags.Async */; + case 146 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; + case 161 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; case 101 /* SyntaxKind.InKeyword */: return 32768 /* ModifierFlags.In */; - case 144 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; - case 165 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; + case 145 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; + case 167 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; } return 0 /* ModifierFlags.None */; } ts.modifierToFlag = modifierToFlag; - function createModifiers(modifierFlags) { - return modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; - } - ts.createModifiers = createModifiers; function isLogicalOperator(token) { return token === 56 /* SyntaxKind.BarBarToken */ || token === 55 /* SyntaxKind.AmpersandAmpersandToken */ @@ -19329,8 +19265,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 205 /* SyntaxKind.ObjectLiteralExpression */ - || kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return kind === 207 /* SyntaxKind.ObjectLiteralExpression */ + || kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } return false; } @@ -19347,12 +19283,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 79 /* SyntaxKind.Identifier */); @@ -19364,9 +19300,9 @@ var ts; return node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 108 /* SyntaxKind.ThisKeyword */ || node.kind === 106 /* SyntaxKind.SuperKeyword */ - || node.kind === 231 /* SyntaxKind.MetaProperty */ - || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) - || node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); + || node.kind === 233 /* SyntaxKind.MetaProperty */ + || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) + || node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); } ts.isDottedName = isDottedName; function isPropertyAccessEntityNameExpression(node) { @@ -19397,8 +19333,8 @@ var ts; } ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isRightSideOfAccessExpression(node) { @@ -19413,12 +19349,12 @@ var ts; } ts.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName = isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName; function isEmptyObjectLiteral(expression) { - return expression.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + return expression.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && + return expression.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -19434,7 +19370,7 @@ var ts; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function isExportDefaultSymbol(symbol) { - return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 512 /* ModifierFlags.Default */); + return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 1024 /* ModifierFlags.Default */); } /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ function tryExtractTSExtension(fileName) { @@ -19579,21 +19515,17 @@ var ts; return getStringFromExpandedCharCodes(expandedCharCodes); } ts.base64decode = base64decode; + function readJsonOrUndefined(path, hostOrText) { + var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path); + if (!jsonText) + return undefined; + // gracefully handle if readFile fails or returns not JSON + var result = ts.parseConfigFileTextToJson(path, jsonText); + return !result.error ? result.config : undefined; + } + ts.readJsonOrUndefined = readJsonOrUndefined; function readJson(path, host) { - try { - var jsonText = host.readFile(path); - if (!jsonText) - return {}; - var result = ts.parseConfigFileTextToJson(path, jsonText); - if (result.error) { - return {}; - } - return result.config; - } - catch (e) { - // gracefully handle if readFile fails or returns not JSON - return {}; - } + return readJsonOrUndefined(path, host) || {}; } ts.readJson = readJson; function directoryProbablyExists(directoryName, host) { @@ -19752,8 +19684,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -19769,7 +19701,7 @@ var ts; } function isWatchSet(options) { // Firefox has Object.prototype.watch - return options.watch && options.hasOwnProperty("watch"); + return options.watch && ts.hasProperty(options, "watch"); } ts.isWatchSet = isWatchSet; function closeFileWatcher(watcher) { @@ -19833,35 +19765,35 @@ var ts; if (!parent) return 0 /* AccessKind.Read */; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return accessKind(parent); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var operator = parent.operator; return operator === 45 /* SyntaxKind.PlusPlusToken */ || operator === 46 /* SyntaxKind.MinusMinusToken */ ? writeOrReadWrite() : 0 /* AccessKind.Read */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ ? 1 /* AccessKind.Write */ : writeOrReadWrite() : 0 /* AccessKind.Read */; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node ? 0 /* AccessKind.Read */ : accessKind(parent); - case 296 /* SyntaxKind.PropertyAssignment */: { + case 299 /* SyntaxKind.PropertyAssignment */: { var parentAccess = accessKind(parent.parent); // In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write. return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess; } - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals. return node === parent.objectAssignmentInitializer ? 0 /* AccessKind.Read */ : accessKind(parent.parent); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return accessKind(parent); default: return 0 /* AccessKind.Read */; } function writeOrReadWrite() { // If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect. - return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 238 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; + return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 241 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; } } function reverseAccessKind(a) { @@ -19943,7 +19875,7 @@ var ts; function isAbstractConstructorSymbol(symbol) { if (symbol.flags & 32 /* SymbolFlags.Class */) { var declaration = getClassLikeDeclarationOfSymbol(symbol); - return !!declaration && hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + return !!declaration && hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); } return false; } @@ -20005,37 +19937,37 @@ var ts; } ts.isObjectTypeDeclaration = isObjectTypeDeclaration; function isTypeNodeKind(kind) { - return (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) - || kind === 130 /* SyntaxKind.AnyKeyword */ - || kind === 155 /* SyntaxKind.UnknownKeyword */ - || kind === 147 /* SyntaxKind.NumberKeyword */ - || kind === 158 /* SyntaxKind.BigIntKeyword */ - || kind === 148 /* SyntaxKind.ObjectKeyword */ - || kind === 133 /* SyntaxKind.BooleanKeyword */ - || kind === 150 /* SyntaxKind.StringKeyword */ - || kind === 151 /* SyntaxKind.SymbolKeyword */ + return (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) + || kind === 131 /* SyntaxKind.AnyKeyword */ + || kind === 157 /* SyntaxKind.UnknownKeyword */ + || kind === 148 /* SyntaxKind.NumberKeyword */ + || kind === 160 /* SyntaxKind.BigIntKeyword */ + || kind === 149 /* SyntaxKind.ObjectKeyword */ + || kind === 134 /* SyntaxKind.BooleanKeyword */ + || kind === 152 /* SyntaxKind.StringKeyword */ + || kind === 153 /* SyntaxKind.SymbolKeyword */ || kind === 114 /* SyntaxKind.VoidKeyword */ - || kind === 153 /* SyntaxKind.UndefinedKeyword */ - || kind === 143 /* SyntaxKind.NeverKeyword */ - || kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ - || kind === 312 /* SyntaxKind.JSDocAllType */ - || kind === 313 /* SyntaxKind.JSDocUnknownType */ - || kind === 314 /* SyntaxKind.JSDocNullableType */ - || kind === 315 /* SyntaxKind.JSDocNonNullableType */ - || kind === 316 /* SyntaxKind.JSDocOptionalType */ - || kind === 317 /* SyntaxKind.JSDocFunctionType */ - || kind === 318 /* SyntaxKind.JSDocVariadicType */; + || kind === 155 /* SyntaxKind.UndefinedKeyword */ + || kind === 144 /* SyntaxKind.NeverKeyword */ + || kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ + || kind === 315 /* SyntaxKind.JSDocAllType */ + || kind === 316 /* SyntaxKind.JSDocUnknownType */ + || kind === 317 /* SyntaxKind.JSDocNullableType */ + || kind === 318 /* SyntaxKind.JSDocNonNullableType */ + || kind === 319 /* SyntaxKind.JSDocOptionalType */ + || kind === 320 /* SyntaxKind.JSDocFunctionType */ + || kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isTypeNodeKind = isTypeNodeKind; function isAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isAccessExpression = isAccessExpression; function getNameOfAccessExpression(node) { - if (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { return node.name; } - ts.Debug.assert(node.kind === 207 /* SyntaxKind.ElementAccessExpression */); + ts.Debug.assert(node.kind === 209 /* SyntaxKind.ElementAccessExpression */); return node.argumentExpression; } ts.getNameOfAccessExpression = getNameOfAccessExpression; @@ -20050,7 +19982,7 @@ var ts; } ts.isBundleFileTextLike = isBundleFileTextLike; function isNamedImportsOrExports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 272 /* SyntaxKind.NamedImports */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedImportsOrExports = isNamedImportsOrExports; function getLeftmostAccessExpression(expr) { @@ -20065,13 +19997,13 @@ var ts; return walkAccessExpression(name.parent); } function walkAccessExpression(access) { - if (access.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (access.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var res = action(access.name); if (res !== undefined) { return res; } } - else if (access.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + else if (access.kind === 209 /* SyntaxKind.ElementAccessExpression */) { if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) { var res = action(access.argumentExpression); if (res !== undefined) { @@ -20098,28 +20030,29 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: node = node.operand; continue; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: node = node.left; continue; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: node = node.condition; continue; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: node = node.tag; continue; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (stopAtCallExpressions) { return node; } // falls through - case 229 /* SyntaxKind.AsExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: node = node.expression; continue; } @@ -21355,17 +21288,17 @@ var ts; return ts.isIdentifier(useSite) && ts.isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite; } function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { - while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } - if (hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */)) { + if (hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */)) { return true; } var containerKind = node.parent.parent.kind; - return containerKind === 258 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 182 /* SyntaxKind.TypeLiteral */; + return containerKind === 261 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 184 /* SyntaxKind.TypeLiteral */; } /** Returns true for an identifier in 1) an `implements` clause, and 2) an `extends` clause of an interface. */ function isIdentifierInNonEmittingHeritageClause(node) { @@ -21373,16 +21306,16 @@ var ts; return false; var heritageClause = ts.findAncestor(node.parent, function (parent) { switch (parent.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return false; default: return "quit"; } }); - return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 258 /* SyntaxKind.InterfaceDeclaration */; + return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 261 /* SyntaxKind.InterfaceDeclaration */; } function isIdentifierTypeReference(node) { return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName); @@ -21543,22 +21476,22 @@ var ts; if (!node.parent) return undefined; switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: var parent_1 = node.parent; - return parent_1.kind === 190 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; - case 164 /* SyntaxKind.Parameter */: + return parent_1.kind === 192 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; + case 166 /* SyntaxKind.Parameter */: return node.parent.parameters; - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return node.parent.templateSpans; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node.parent.templateSpans; - case 165 /* SyntaxKind.Decorator */: { + case 167 /* SyntaxKind.Decorator */: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return node.parent.heritageClauses; } var parent = node.parent; @@ -21566,45 +21499,45 @@ var ts; return ts.isJSDocTypeLiteral(node.parent) ? undefined : node.parent.tags; } switch (parent.kind) { - case 182 /* SyntaxKind.TypeLiteral */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.isTypeElement(node) ? parent.members : undefined; - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return parent.types; - case 184 /* SyntaxKind.TupleType */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 186 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return parent.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 286 /* SyntaxKind.JsxAttributes */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 289 /* SyntaxKind.JsxAttributes */: return parent.properties; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.isTypeNode(node) ? parent.typeArguments : parent.expression === node ? undefined : parent.arguments; - case 278 /* SyntaxKind.JsxElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 285 /* SyntaxKind.JsxFragment */: return ts.isJsxChild(node) ? parent.children : undefined; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return ts.isTypeNode(node) ? parent.typeArguments : undefined; - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: return parent.statements; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return parent.clauses; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.isClassElement(node) ? parent.members : undefined; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.isEnumMember(node) ? parent.members : undefined; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return parent.statements; } } @@ -21616,7 +21549,7 @@ var ts; if (ts.some(node.parameters, function (p) { return !getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { // If the first parameter is not an explicit 'this' parameter, then the function has // an implicit 'this' parameter which is subject to contextual typing. var parameter = ts.firstOrUndefined(node.parameters); @@ -21634,7 +21567,7 @@ var ts; } ts.isInfinityOrNaNString = isInfinityOrNaNString; function isCatchClauseVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function isParameterOrCatchClauseVariable(symbol) { @@ -21643,7 +21576,7 @@ var ts; } ts.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable; function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */ || node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */ || node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction; function escapeSnippetText(text) { @@ -21740,9 +21673,35 @@ var ts; ts.getNodeModulePathParts = getNodeModulePathParts; function getParameterTypeNode(parameter) { var _a; - return parameter.kind === 340 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; + return parameter.kind === 343 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; } ts.getParameterTypeNode = getParameterTypeNode; + function isTypeDeclaration(node) { + switch (node.kind) { + case 165 /* SyntaxKind.TypeParameter */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + return true; + case 270 /* SyntaxKind.ImportClause */: + return node.isTypeOnly; + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: + return node.parent.parent.isTypeOnly; + default: + return false; + } + } + ts.isTypeDeclaration = isTypeDeclaration; + function canHaveExportModifier(node) { + return ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) + || ts.isInterfaceDeclaration(node) || isTypeDeclaration(node) || (ts.isModuleDeclaration(node) && !isExternalModuleAugmentation(node) && !isGlobalScopeAugmentation(node)); + } + ts.canHaveExportModifier = canHaveExportModifier; })(ts || (ts = {})); /* @internal */ var ts; @@ -21751,13 +21710,11 @@ var ts; * Creates a `BaseNodeFactory` which can be used to create `Node` instances from the constructors provided by the object allocator. */ function createBaseNodeFactory() { - // tslint:disable variable-name var NodeConstructor; var TokenConstructor; var IdentifierConstructor; var PrivateIdentifierConstructor; var SourceFileConstructor; - // tslint:enable variable-name return { createBaseSourceFileNode: createBaseSourceFileNode, createBaseIdentifierNode: createBaseIdentifierNode, @@ -21865,10 +21822,10 @@ var ts; // // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve // the intended order of operations: `(a ** b) ** c` - var binaryOperatorPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(221 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(223 /* SyntaxKind.BinaryExpression */, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); - if (!isLeftSideOfBinary && operand.kind === 214 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { + if (!isLeftSideOfBinary && operand.kind === 216 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { // We need to parenthesize arrow functions on the right side to avoid it being // parsed as parenthesized expression: `a && (() => {})` return true; @@ -21880,7 +21837,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Associativity.Right */ - && operand.kind === 224 /* SyntaxKind.YieldExpression */) { + && operand.kind === 226 /* SyntaxKind.YieldExpression */) { return false; } return true; @@ -21949,13 +21906,15 @@ var ts; // (a|b)|c -> a|(b|c) -> a|b|c // (a&b)&c -> a&(b&c) -> a&b&c // (a^b)^c -> a^(b^c) -> a^b^c + // (a,b),c -> a,(b,c) -> a,b,c // // While addition is associative in mathematics, JavaScript's `+` is not // guaranteed to be associative as it is overloaded with string concatenation. return binaryOperator === 41 /* SyntaxKind.AsteriskToken */ || binaryOperator === 51 /* SyntaxKind.BarToken */ || binaryOperator === 50 /* SyntaxKind.AmpersandToken */ - || binaryOperator === 52 /* SyntaxKind.CaretToken */; + || binaryOperator === 52 /* SyntaxKind.CaretToken */ + || binaryOperator === 27 /* SyntaxKind.CommaToken */; } /** * This function determines whether an expression consists of a homogeneous set of @@ -21968,7 +21927,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -21994,7 +21953,7 @@ var ts; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = ts.skipPartiallyEmittedExpressions(operand); // If the resulting expression is already parenthesized, we do not need to do any further processing. - if (skipped.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (skipped.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -22011,7 +21970,7 @@ var ts; return ts.isCommaSequence(expression) ? factory.createParenthesizedExpression(expression) : expression; } function parenthesizeConditionOfConditionalExpression(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(222 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(224 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) !== 1 /* Comparison.GreaterThan */) { @@ -22044,8 +22003,8 @@ var ts; var needsParens = ts.isCommaSequence(check); if (!needsParens) { switch (ts.getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: needsParens = true; } } @@ -22058,9 +22017,9 @@ var ts; function parenthesizeExpressionOfNew(expression) { var leftmostExpr = ts.getLeftmostExpression(expression, /*stopAtCallExpressions*/ true); switch (leftmostExpr.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return factory.createParenthesizedExpression(expression); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return !leftmostExpr.arguments ? factory.createParenthesizedExpression(expression) : expression; // TODO(rbuckton): Verify this assertion holds @@ -22080,7 +22039,7 @@ var ts; // var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 209 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) + && (emittedExpression.kind !== 211 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) && (optionalChain || !ts.isOptionalChain(emittedExpression))) { // TODO(rbuckton): Verify whether this assertion holds. return expression; @@ -22103,7 +22062,7 @@ var ts; function parenthesizeExpressionForDisallowedComma(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } @@ -22112,21 +22071,21 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 213 /* SyntaxKind.FunctionExpression */ || kind === 214 /* SyntaxKind.ArrowFunction */) { + if (kind === 215 /* SyntaxKind.FunctionExpression */ || kind === 216 /* SyntaxKind.ArrowFunction */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. var updated = factory.updateCallExpression(emittedExpression, ts.setTextRange(factory.createParenthesizedExpression(callee), callee), emittedExpression.typeArguments, emittedExpression.arguments); return factory.restoreOuterExpressions(expression, updated, 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */); } } var leftmostExpressionKind = ts.getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind; - if (leftmostExpressionKind === 205 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 213 /* SyntaxKind.FunctionExpression */) { + if (leftmostExpressionKind === 207 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 215 /* SyntaxKind.FunctionExpression */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } return expression; } function parenthesizeConciseBodyOfArrowFunction(body) { - if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(body), body); } @@ -22144,16 +22103,16 @@ var ts; // - The true and false branch types (the second and third `Type` non-terminals, above) allow any type function parenthesizeCheckTypeOfConditionalType(checkType) { switch (checkType.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 189 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(checkType); } return checkType; } function parenthesizeExtendsTypeOfConditionalType(extendsType) { switch (extendsType.kind) { - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(extendsType); } return extendsType; @@ -22165,8 +22124,8 @@ var ts; // - A union type constituent has the same precedence as the check type of a conditional type function parenthesizeConstituentTypeOfUnionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 189 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeCheckTypeOfConditionalType(type); @@ -22181,8 +22140,8 @@ var ts; // - An intersection type constituent does not allow function, constructor, conditional, or union types (they must be parenthesized) function parenthesizeConstituentTypeOfIntersectionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfUnionType(type); @@ -22199,14 +22158,14 @@ var ts; // function parenthesizeOperandOfTypeOperator(type) { switch (type.kind) { - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfIntersectionType(type); } function parenthesizeOperandOfReadonlyTypeOperator(type) { switch (type.kind) { - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22226,9 +22185,9 @@ var ts; // function parenthesizeNonArrayTypeOfPostfixType(type) { switch (type.kind) { - case 190 /* SyntaxKind.InferType */: - case 193 /* SyntaxKind.TypeOperator */: - case 181 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 192 /* SyntaxKind.InferType */: + case 195 /* SyntaxKind.TypeOperator */: + case 183 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22422,11 +22381,11 @@ var ts; } function convertToAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -22520,6 +22479,8 @@ var ts; createUniqueName: createUniqueName, getGeneratedNameForNode: getGeneratedNameForNode, createPrivateIdentifier: createPrivateIdentifier, + createUniquePrivateName: createUniquePrivateName, + getGeneratedPrivateNameForNode: getGeneratedPrivateNameForNode, createToken: createToken, createSuper: createSuper, createThis: createThis, @@ -22682,6 +22643,8 @@ var ts; updateAsExpression: updateAsExpression, createNonNullExpression: createNonNullExpression, updateNonNullExpression: updateNonNullExpression, + createSatisfiesExpression: createSatisfiesExpression, + updateSatisfiesExpression: updateSatisfiesExpression, createNonNullChain: createNonNullChain, updateNonNullChain: updateNonNullChain, createMetaProperty: createMetaProperty, @@ -22779,18 +22742,18 @@ var ts; createExternalModuleReference: createExternalModuleReference, updateExternalModuleReference: updateExternalModuleReference, // lazily load factory members for JSDoc types with similar structure - get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312 /* SyntaxKind.JSDocAllType */); }, - get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313 /* SyntaxKind.JSDocUnknownType */); }, - get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, - get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, + get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(315 /* SyntaxKind.JSDocAllType */); }, + get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(316 /* SyntaxKind.JSDocUnknownType */); }, + get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, + get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, createJSDocFunctionType: createJSDocFunctionType, updateJSDocFunctionType: updateJSDocFunctionType, createJSDocTypeLiteral: createJSDocTypeLiteral, @@ -22826,30 +22789,30 @@ var ts; createJSDocLinkPlain: createJSDocLinkPlain, updateJSDocLinkPlain: updateJSDocLinkPlain, // lazily load factory members for JSDoc tags with similar structure - get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, - get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, + get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, + get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, createJSDocUnknownTag: createJSDocUnknownTag, updateJSDocUnknownTag: updateJSDocUnknownTag, createJSDocText: createJSDocText, @@ -23052,11 +23015,11 @@ var ts; // don't propagate child flags. if (name) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isIdentifier(name)) { node.transformFlags |= propagateIdentifierNameFlags(name); break; @@ -23205,23 +23168,29 @@ var ts; node.escapedText = ts.escapeLeadingUnderscores(text); return node; } - function createBaseGeneratedIdentifier(text, autoGenerateFlags) { + function createBaseGeneratedIdentifier(text, autoGenerateFlags, prefix, suffix) { var node = createBaseIdentifier(text, /*originalKeywordKind*/ undefined); node.autoGenerateFlags = autoGenerateFlags; node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; nextAutoGenerateId++; return node; } // @api - function createIdentifier(text, typeArguments, originalKeywordKind) { + function createIdentifier(text, typeArguments, originalKeywordKind, hasExtendedUnicodeEscape) { var node = createBaseIdentifier(text, originalKeywordKind); if (typeArguments) { // NOTE: we do not use `setChildren` here because typeArguments in an identifier do not contribute to transformations node.typeArguments = createNodeArray(typeArguments); } - if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { node.transformFlags |= 67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; } + if (hasExtendedUnicodeEscape) { + node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape; + node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; + } return node; } // @api @@ -23231,11 +23200,11 @@ var ts; : node; } // @api - function createTempVariable(recordTempVariable, reservedInNestedScopes) { + function createTempVariable(recordTempVariable, reservedInNestedScopes, prefix, suffix) { var flags = 1 /* GeneratedIdentifierFlags.Auto */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - var name = createBaseGeneratedIdentifier("", flags); + var name = createBaseGeneratedIdentifier("", flags, prefix, suffix); if (recordTempVariable) { recordTempVariable(name); } @@ -23247,34 +23216,69 @@ var ts; var flags = 2 /* GeneratedIdentifierFlags.Loop */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - return createBaseGeneratedIdentifier("", flags); + return createBaseGeneratedIdentifier("", flags, /*prefix*/ undefined, /*suffix*/ undefined); } /** Create a unique name based on the supplied text. */ // @api - function createUniqueName(text, flags) { + function createUniqueName(text, flags, prefix, suffix) { if (flags === void 0) { flags = 0 /* GeneratedIdentifierFlags.None */; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); ts.Debug.assert((flags & (16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */)) !== 32 /* GeneratedIdentifierFlags.FileLevel */, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"); - return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags); + return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags, prefix, suffix); } /** Create a unique name generated for a node. */ // @api - function getGeneratedNameForNode(node, flags) { + function getGeneratedNameForNode(node, flags, prefix, suffix) { if (flags === void 0) { flags = 0; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); - var name = createBaseGeneratedIdentifier(node && ts.isIdentifier(node) ? ts.idText(node) : "", 4 /* GeneratedIdentifierFlags.Node */ | flags); + var text = !node ? "" : + ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ false, prefix, node, suffix, ts.idText) : + "generated@".concat(ts.getNodeId(node)); + if (prefix || suffix) + flags |= 16 /* GeneratedIdentifierFlags.Optimistic */; + var name = createBaseGeneratedIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); name.original = node; return name; } + function createBasePrivateIdentifier(text) { + var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); + node.escapedText = ts.escapeLeadingUnderscores(text); + node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return node; + } // @api function createPrivateIdentifier(text) { if (!ts.startsWith(text, "#")) ts.Debug.fail("First character of private identifier must be #: " + text); - var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); - node.escapedText = ts.escapeLeadingUnderscores(text); - node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return createBasePrivateIdentifier(text); + } + function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags, prefix, suffix) { + var node = createBasePrivateIdentifier(text); + node.autoGenerateFlags = autoGenerateFlags; + node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; + nextAutoGenerateId++; return node; } + /** Create a unique name based on the supplied text. */ + // @api + function createUniquePrivateName(text, prefix, suffix) { + if (text && !ts.startsWith(text, "#")) + ts.Debug.fail("First character of private identifier must be #: " + text); + var autoGenerateFlags = 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */ | + (text ? 3 /* GeneratedIdentifierFlags.Unique */ : 1 /* GeneratedIdentifierFlags.Auto */); + return createBaseGeneratedPrivateIdentifier(text !== null && text !== void 0 ? text : "", autoGenerateFlags, prefix, suffix); + } + // @api + function getGeneratedPrivateNameForNode(node, prefix, suffix) { + var text = ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ true, prefix, node, suffix, ts.idText) : + "#generated@".concat(ts.getNodeId(node)); + var flags = prefix || suffix ? 16 /* GeneratedIdentifierFlags.Optimistic */ : 0 /* GeneratedIdentifierFlags.None */; + var name = createBaseGeneratedPrivateIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); + name.original = node; + return name; + } // // Punctuation // @@ -23282,14 +23286,14 @@ var ts; return baseFactory.createBaseTokenNode(kind); } function createToken(token) { - ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 160 /* SyntaxKind.LastToken */, "Invalid token"); + ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 162 /* SyntaxKind.LastToken */, "Invalid token"); ts.Debug.assert(token <= 14 /* SyntaxKind.FirstTemplateToken */ || token >= 17 /* SyntaxKind.LastTemplateToken */, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."); ts.Debug.assert(token <= 8 /* SyntaxKind.FirstLiteralToken */ || token >= 14 /* SyntaxKind.LastLiteralToken */, "Invalid token. Use 'createLiteralLikeNode' to create literals."); ts.Debug.assert(token !== 79 /* SyntaxKind.Identifier */, "Invalid token. Use 'createIdentifier' to create identifiers"); var node = createBaseToken(token); var transformFlags = 0 /* TransformFlags.None */; switch (token) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // 'async' modifier is ES2017 (async functions) or ES2018 (async generators) transformFlags = 256 /* TransformFlags.ContainsES2017 */ | @@ -23298,24 +23302,24 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. + case 157 /* SyntaxKind.UnknownKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. transformFlags = 1 /* TransformFlags.ContainsTypeScript */; break; case 106 /* SyntaxKind.SuperKeyword */: @@ -23324,6 +23328,9 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: transformFlags = 1024 /* TransformFlags.ContainsES2015 */; break; + case 127 /* SyntaxKind.AccessorKeyword */: + transformFlags = 16777216 /* TransformFlags.ContainsClassFields */; + break; case 108 /* SyntaxKind.ThisKeyword */: // 'this' indicates a lexical 'this' transformFlags = 16384 /* TransformFlags.ContainsLexicalThis */; @@ -23370,8 +23377,8 @@ var ts; if (flags & 1 /* ModifierFlags.Export */) result.push(createModifier(93 /* SyntaxKind.ExportKeyword */)); if (flags & 2 /* ModifierFlags.Ambient */) - result.push(createModifier(135 /* SyntaxKind.DeclareKeyword */)); - if (flags & 512 /* ModifierFlags.Default */) + result.push(createModifier(136 /* SyntaxKind.DeclareKeyword */)); + if (flags & 1024 /* ModifierFlags.Default */) result.push(createModifier(88 /* SyntaxKind.DefaultKeyword */)); if (flags & 2048 /* ModifierFlags.Const */) result.push(createModifier(85 /* SyntaxKind.ConstKeyword */)); @@ -23381,20 +23388,22 @@ var ts; result.push(createModifier(121 /* SyntaxKind.PrivateKeyword */)); if (flags & 16 /* ModifierFlags.Protected */) result.push(createModifier(122 /* SyntaxKind.ProtectedKeyword */)); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push(createModifier(126 /* SyntaxKind.AbstractKeyword */)); if (flags & 32 /* ModifierFlags.Static */) result.push(createModifier(124 /* SyntaxKind.StaticKeyword */)); if (flags & 16384 /* ModifierFlags.Override */) - result.push(createModifier(159 /* SyntaxKind.OverrideKeyword */)); + result.push(createModifier(161 /* SyntaxKind.OverrideKeyword */)); if (flags & 64 /* ModifierFlags.Readonly */) - result.push(createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); - if (flags & 256 /* ModifierFlags.Async */) - result.push(createModifier(131 /* SyntaxKind.AsyncKeyword */)); + result.push(createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); + if (flags & 128 /* ModifierFlags.Accessor */) + result.push(createModifier(127 /* SyntaxKind.AccessorKeyword */)); + if (flags & 512 /* ModifierFlags.Async */) + result.push(createModifier(132 /* SyntaxKind.AsyncKeyword */)); if (flags & 32768 /* ModifierFlags.In */) result.push(createModifier(101 /* SyntaxKind.InKeyword */)); if (flags & 65536 /* ModifierFlags.Out */) - result.push(createModifier(144 /* SyntaxKind.OutKeyword */)); + result.push(createModifier(145 /* SyntaxKind.OutKeyword */)); return result.length ? result : undefined; } // @@ -23402,7 +23411,7 @@ var ts; // // @api function createQualifiedName(left, right) { - var node = createBaseNode(161 /* SyntaxKind.QualifiedName */); + var node = createBaseNode(163 /* SyntaxKind.QualifiedName */); node.left = left; node.right = asName(right); node.transformFlags |= @@ -23419,7 +23428,7 @@ var ts; } // @api function createComputedPropertyName(expression) { - var node = createBaseNode(162 /* SyntaxKind.ComputedPropertyName */); + var node = createBaseNode(164 /* SyntaxKind.ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23438,7 +23447,7 @@ var ts; // // @api function createTypeParameterDeclaration(modifiers, name, constraint, defaultType) { - var node = createBaseNamedDeclaration(163 /* SyntaxKind.TypeParameter */, modifiers, name); + var node = createBaseNamedDeclaration(165 /* SyntaxKind.TypeParameter */, modifiers, name); node.constraint = constraint; node.default = defaultType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23455,7 +23464,7 @@ var ts; } // @api function createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(164 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + var node = createBaseVariableLikeDeclaration(166 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.dotDotDotToken = dotDotDotToken; node.questionToken = questionToken; if (ts.isThisIdentifier(node.name)) { @@ -23487,7 +23496,7 @@ var ts; } // @api function createDecorator(expression) { - var node = createBaseNode(165 /* SyntaxKind.Decorator */); + var node = createBaseNode(167 /* SyntaxKind.Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23507,7 +23516,7 @@ var ts; // // @api function createPropertySignature(modifiers, name, questionToken, type) { - var node = createBaseNamedDeclaration(166 /* SyntaxKind.PropertySignature */, modifiers, name); + var node = createBaseNamedDeclaration(168 /* SyntaxKind.PropertySignature */, modifiers, name); node.type = type; node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23533,7 +23542,7 @@ var ts; } // @api function createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(167 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); + var node = createBaseVariableLikeDeclaration(169 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); node.questionToken = questionOrExclamationToken && ts.isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= @@ -23561,7 +23570,7 @@ var ts; } // @api function createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(168 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(170 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23579,7 +23588,7 @@ var ts; } // @api function createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(169 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.questionToken = questionToken; node.transformFlags |= @@ -23589,7 +23598,7 @@ var ts; if (questionToken) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -23625,7 +23634,7 @@ var ts; } // @api function createClassStaticBlockDeclaration(body) { - var node = createBaseGenericNamedDeclaration(170 /* SyntaxKind.ClassStaticBlockDeclaration */, + var node = createBaseGenericNamedDeclaration(172 /* SyntaxKind.ClassStaticBlockDeclaration */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined); @@ -23651,7 +23660,7 @@ var ts; } // @api function createConstructorDeclaration(modifiers, parameters, body) { - var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.Constructor */, modifiers, + var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.Constructor */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); @@ -23680,7 +23689,7 @@ var ts; } // @api function createGetAccessorDeclaration(modifiers, name, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(172 /* SyntaxKind.GetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(174 /* SyntaxKind.GetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, type, body); // The following properties are used only to report grammar errors node.typeParameters = undefined; @@ -23704,7 +23713,7 @@ var ts; } // @api function createSetAccessorDeclaration(modifiers, name, parameters, body) { - var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.SetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(175 /* SyntaxKind.SetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); // The following properties are used only to report grammar errors @@ -23730,7 +23739,7 @@ var ts; } // @api function createCallSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(174 /* SyntaxKind.CallSignature */, + var node = createBaseSignatureDeclaration(176 /* SyntaxKind.CallSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23746,7 +23755,7 @@ var ts; } // @api function createConstructSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(175 /* SyntaxKind.ConstructSignature */, + var node = createBaseSignatureDeclaration(177 /* SyntaxKind.ConstructSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23762,7 +23771,7 @@ var ts; } // @api function createIndexSignature(modifiers, parameters, type) { - var node = createBaseSignatureDeclaration(176 /* SyntaxKind.IndexSignature */, modifiers, + var node = createBaseSignatureDeclaration(178 /* SyntaxKind.IndexSignature */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23778,7 +23787,7 @@ var ts; } // @api function createTemplateLiteralTypeSpan(type, literal) { - var node = createBaseNode(199 /* SyntaxKind.TemplateLiteralTypeSpan */); + var node = createBaseNode(201 /* SyntaxKind.TemplateLiteralTypeSpan */); node.type = type; node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23800,7 +23809,7 @@ var ts; } // @api function createTypePredicateNode(assertsModifier, parameterName, type) { - var node = createBaseNode(177 /* SyntaxKind.TypePredicate */); + var node = createBaseNode(179 /* SyntaxKind.TypePredicate */); node.assertsModifier = assertsModifier; node.parameterName = asName(parameterName); node.type = type; @@ -23817,7 +23826,7 @@ var ts; } // @api function createTypeReferenceNode(typeName, typeArguments) { - var node = createBaseNode(178 /* SyntaxKind.TypeReference */); + var node = createBaseNode(180 /* SyntaxKind.TypeReference */); node.typeName = asName(typeName); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(createNodeArray(typeArguments)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23832,7 +23841,7 @@ var ts; } // @api function createFunctionTypeNode(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(179 /* SyntaxKind.FunctionType */, + var node = createBaseSignatureDeclaration(181 /* SyntaxKind.FunctionType */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23865,7 +23874,7 @@ var ts; ts.Debug.fail("Incorrect number of arguments specified."); } function createConstructorTypeNode1(modifiers, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(180 /* SyntaxKind.ConstructorType */, modifiers, + var node = createBaseSignatureDeclaration(182 /* SyntaxKind.ConstructorType */, modifiers, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23898,7 +23907,7 @@ var ts; } // @api function createTypeQueryNode(exprName, typeArguments) { - var node = createBaseNode(181 /* SyntaxKind.TypeQuery */); + var node = createBaseNode(183 /* SyntaxKind.TypeQuery */); node.exprName = exprName; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23913,7 +23922,7 @@ var ts; } // @api function createTypeLiteralNode(members) { - var node = createBaseNode(182 /* SyntaxKind.TypeLiteral */); + var node = createBaseNode(184 /* SyntaxKind.TypeLiteral */); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23926,7 +23935,7 @@ var ts; } // @api function createArrayTypeNode(elementType) { - var node = createBaseNode(183 /* SyntaxKind.ArrayType */); + var node = createBaseNode(185 /* SyntaxKind.ArrayType */); node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23939,7 +23948,7 @@ var ts; } // @api function createTupleTypeNode(elements) { - var node = createBaseNode(184 /* SyntaxKind.TupleType */); + var node = createBaseNode(186 /* SyntaxKind.TupleType */); node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23952,7 +23961,7 @@ var ts; } // @api function createNamedTupleMember(dotDotDotToken, name, questionToken, type) { - var node = createBaseNode(197 /* SyntaxKind.NamedTupleMember */); + var node = createBaseNode(199 /* SyntaxKind.NamedTupleMember */); node.dotDotDotToken = dotDotDotToken; node.name = name; node.questionToken = questionToken; @@ -23971,7 +23980,7 @@ var ts; } // @api function createOptionalTypeNode(type) { - var node = createBaseNode(185 /* SyntaxKind.OptionalType */); + var node = createBaseNode(187 /* SyntaxKind.OptionalType */); node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23984,7 +23993,7 @@ var ts; } // @api function createRestTypeNode(type) { - var node = createBaseNode(186 /* SyntaxKind.RestType */); + var node = createBaseNode(188 /* SyntaxKind.RestType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24008,7 +24017,7 @@ var ts; } // @api function createUnionTypeNode(types) { - return createUnionOrIntersectionTypeNode(187 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); + return createUnionOrIntersectionTypeNode(189 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } // @api function updateUnionTypeNode(node, types) { @@ -24016,7 +24025,7 @@ var ts; } // @api function createIntersectionTypeNode(types) { - return createUnionOrIntersectionTypeNode(188 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); + return createUnionOrIntersectionTypeNode(190 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } // @api function updateIntersectionTypeNode(node, types) { @@ -24024,7 +24033,7 @@ var ts; } // @api function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { - var node = createBaseNode(189 /* SyntaxKind.ConditionalType */); + var node = createBaseNode(191 /* SyntaxKind.ConditionalType */); node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType); node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType); node.trueType = trueType; @@ -24043,7 +24052,7 @@ var ts; } // @api function createInferTypeNode(typeParameter) { - var node = createBaseNode(190 /* SyntaxKind.InferType */); + var node = createBaseNode(192 /* SyntaxKind.InferType */); node.typeParameter = typeParameter; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24056,7 +24065,7 @@ var ts; } // @api function createTemplateLiteralType(head, templateSpans) { - var node = createBaseNode(198 /* SyntaxKind.TemplateLiteralType */); + var node = createBaseNode(200 /* SyntaxKind.TemplateLiteralType */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24072,7 +24081,7 @@ var ts; // @api function createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf) { if (isTypeOf === void 0) { isTypeOf = false; } - var node = createBaseNode(200 /* SyntaxKind.ImportType */); + var node = createBaseNode(202 /* SyntaxKind.ImportType */); node.argument = argument; node.assertions = assertions; node.qualifier = qualifier; @@ -24094,7 +24103,7 @@ var ts; } // @api function createParenthesizedType(type) { - var node = createBaseNode(191 /* SyntaxKind.ParenthesizedType */); + var node = createBaseNode(193 /* SyntaxKind.ParenthesizedType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24107,15 +24116,15 @@ var ts; } // @api function createThisTypeNode() { - var node = createBaseNode(192 /* SyntaxKind.ThisType */); + var node = createBaseNode(194 /* SyntaxKind.ThisType */); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; } // @api function createTypeOperatorNode(operator, type) { - var node = createBaseNode(193 /* SyntaxKind.TypeOperator */); + var node = createBaseNode(195 /* SyntaxKind.TypeOperator */); node.operator = operator; - node.type = operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + node.type = operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : parenthesizerRules().parenthesizeOperandOfTypeOperator(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24129,7 +24138,7 @@ var ts; } // @api function createIndexedAccessTypeNode(objectType, indexType) { - var node = createBaseNode(194 /* SyntaxKind.IndexedAccessType */); + var node = createBaseNode(196 /* SyntaxKind.IndexedAccessType */); node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType); node.indexType = indexType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24144,7 +24153,7 @@ var ts; } // @api function createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members) { - var node = createBaseNode(195 /* SyntaxKind.MappedType */); + var node = createBaseNode(197 /* SyntaxKind.MappedType */); node.readonlyToken = readonlyToken; node.typeParameter = typeParameter; node.nameType = nameType; @@ -24167,7 +24176,7 @@ var ts; } // @api function createLiteralTypeNode(literal) { - var node = createBaseNode(196 /* SyntaxKind.LiteralType */); + var node = createBaseNode(198 /* SyntaxKind.LiteralType */); node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24183,7 +24192,7 @@ var ts; // // @api function createObjectBindingPattern(elements) { - var node = createBaseNode(201 /* SyntaxKind.ObjectBindingPattern */); + var node = createBaseNode(203 /* SyntaxKind.ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24204,7 +24213,7 @@ var ts; } // @api function createArrayBindingPattern(elements) { - var node = createBaseNode(202 /* SyntaxKind.ArrayBindingPattern */); + var node = createBaseNode(204 /* SyntaxKind.ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24220,7 +24229,7 @@ var ts; } // @api function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createBaseBindingLikeDeclaration(203 /* SyntaxKind.BindingElement */, + var node = createBaseBindingLikeDeclaration(205 /* SyntaxKind.BindingElement */, /*modifiers*/ undefined, name, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; @@ -24255,7 +24264,7 @@ var ts; } // @api function createArrayLiteralExpression(elements, multiLine) { - var node = createBaseExpression(204 /* SyntaxKind.ArrayLiteralExpression */); + var node = createBaseExpression(206 /* SyntaxKind.ArrayLiteralExpression */); // Ensure we add a trailing comma for something like `[NumericLiteral(1), NumericLiteral(2), OmittedExpresion]` so that // we end up with `[1, 2, ,]` instead of `[1, 2, ]` otherwise the `OmittedExpression` will just end up being treated like // a trailing comma. @@ -24274,7 +24283,7 @@ var ts; } // @api function createObjectLiteralExpression(properties, multiLine) { - var node = createBaseExpression(205 /* SyntaxKind.ObjectLiteralExpression */); + var node = createBaseExpression(207 /* SyntaxKind.ObjectLiteralExpression */); node.properties = createNodeArray(properties); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.properties); @@ -24288,7 +24297,7 @@ var ts; } // @api function createPropertyAccessExpression(expression, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.name = asName(name); node.transformFlags = @@ -24317,7 +24326,7 @@ var ts; } // @api function createPropertyAccessChain(expression, questionDotToken, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24344,7 +24353,7 @@ var ts; } // @api function createElementAccessExpression(expression, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.argumentExpression = asExpression(index); node.transformFlags |= @@ -24371,7 +24380,7 @@ var ts; } // @api function createElementAccessChain(expression, questionDotToken, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24396,7 +24405,7 @@ var ts; } // @api function createCallExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray)); @@ -24428,7 +24437,7 @@ var ts; } // @api function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24460,7 +24469,7 @@ var ts; } // @api function createNewExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(209 /* SyntaxKind.NewExpression */); + var node = createBaseExpression(211 /* SyntaxKind.NewExpression */); node.expression = parenthesizerRules().parenthesizeExpressionOfNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(argumentsArray) : undefined; @@ -24484,7 +24493,7 @@ var ts; } // @api function createTaggedTemplateExpression(tag, typeArguments, template) { - var node = createBaseExpression(210 /* SyntaxKind.TaggedTemplateExpression */); + var node = createBaseExpression(212 /* SyntaxKind.TaggedTemplateExpression */); node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.template = template; @@ -24511,7 +24520,7 @@ var ts; } // @api function createTypeAssertion(type, expression) { - var node = createBaseExpression(211 /* SyntaxKind.TypeAssertionExpression */); + var node = createBaseExpression(213 /* SyntaxKind.TypeAssertionExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.type = type; node.transformFlags |= @@ -24529,7 +24538,7 @@ var ts; } // @api function createParenthesizedExpression(expression) { - var node = createBaseExpression(212 /* SyntaxKind.ParenthesizedExpression */); + var node = createBaseExpression(214 /* SyntaxKind.ParenthesizedExpression */); node.expression = expression; node.transformFlags = propagateChildFlags(node.expression); return node; @@ -24542,13 +24551,13 @@ var ts; } // @api function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(213 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(215 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.asteriskToken); if (node.typeParameters) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -24575,13 +24584,13 @@ var ts; } // @api function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createBaseFunctionLikeDeclaration(214 /* SyntaxKind.ArrowFunction */, modifiers, + var node = createBaseFunctionLikeDeclaration(216 /* SyntaxKind.ArrowFunction */, modifiers, /*name*/ undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* SyntaxKind.EqualsGreaterThanToken */); node.transformFlags |= propagateChildFlags(node.equalsGreaterThanToken) | 1024 /* TransformFlags.ContainsES2015 */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { node.transformFlags |= 256 /* TransformFlags.ContainsES2017 */ | 16384 /* TransformFlags.ContainsLexicalThis */; } return node; @@ -24599,7 +24608,7 @@ var ts; } // @api function createDeleteExpression(expression) { - var node = createBaseExpression(215 /* SyntaxKind.DeleteExpression */); + var node = createBaseExpression(217 /* SyntaxKind.DeleteExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24612,7 +24621,7 @@ var ts; } // @api function createTypeOfExpression(expression) { - var node = createBaseExpression(216 /* SyntaxKind.TypeOfExpression */); + var node = createBaseExpression(218 /* SyntaxKind.TypeOfExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24625,7 +24634,7 @@ var ts; } // @api function createVoidExpression(expression) { - var node = createBaseExpression(217 /* SyntaxKind.VoidExpression */); + var node = createBaseExpression(219 /* SyntaxKind.VoidExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24638,7 +24647,7 @@ var ts; } // @api function createAwaitExpression(expression) { - var node = createBaseExpression(218 /* SyntaxKind.AwaitExpression */); + var node = createBaseExpression(220 /* SyntaxKind.AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24655,7 +24664,7 @@ var ts; } // @api function createPrefixUnaryExpression(operator, operand) { - var node = createBaseExpression(219 /* SyntaxKind.PrefixUnaryExpression */); + var node = createBaseExpression(221 /* SyntaxKind.PrefixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24677,7 +24686,7 @@ var ts; } // @api function createPostfixUnaryExpression(operand, operator) { - var node = createBaseExpression(220 /* SyntaxKind.PostfixUnaryExpression */); + var node = createBaseExpression(222 /* SyntaxKind.PostfixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24698,7 +24707,7 @@ var ts; } // @api function createBinaryExpression(left, operator, right) { - var node = createBaseExpression(221 /* SyntaxKind.BinaryExpression */); + var node = createBaseExpression(223 /* SyntaxKind.BinaryExpression */); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = parenthesizerRules().parenthesizeLeftSideOfBinary(operatorKind, left); @@ -24770,7 +24779,7 @@ var ts; } // @api function createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse) { - var node = createBaseExpression(222 /* SyntaxKind.ConditionalExpression */); + var node = createBaseExpression(224 /* SyntaxKind.ConditionalExpression */); node.condition = parenthesizerRules().parenthesizeConditionOfConditionalExpression(condition); node.questionToken = questionToken !== null && questionToken !== void 0 ? questionToken : createToken(57 /* SyntaxKind.QuestionToken */); node.whenTrue = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenTrue); @@ -24796,7 +24805,7 @@ var ts; } // @api function createTemplateExpression(head, templateSpans) { - var node = createBaseExpression(223 /* SyntaxKind.TemplateExpression */); + var node = createBaseExpression(225 /* SyntaxKind.TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= @@ -24866,7 +24875,7 @@ var ts; // @api function createYieldExpression(asteriskToken, expression) { ts.Debug.assert(!asteriskToken || !!expression, "A `YieldExpression` with an asteriskToken must have an expression."); - var node = createBaseExpression(224 /* SyntaxKind.YieldExpression */); + var node = createBaseExpression(226 /* SyntaxKind.YieldExpression */); node.expression = expression && parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.asteriskToken = asteriskToken; node.transformFlags |= @@ -24886,7 +24895,7 @@ var ts; } // @api function createSpreadElement(expression) { - var node = createBaseExpression(225 /* SyntaxKind.SpreadElement */); + var node = createBaseExpression(227 /* SyntaxKind.SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24902,7 +24911,7 @@ var ts; } // @api function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(226 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(228 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -24918,11 +24927,11 @@ var ts; } // @api function createOmittedExpression() { - return createBaseExpression(227 /* SyntaxKind.OmittedExpression */); + return createBaseExpression(229 /* SyntaxKind.OmittedExpression */); } // @api function createExpressionWithTypeArguments(expression, typeArguments) { - var node = createBaseNode(228 /* SyntaxKind.ExpressionWithTypeArguments */); + var node = createBaseNode(230 /* SyntaxKind.ExpressionWithTypeArguments */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= @@ -24940,7 +24949,7 @@ var ts; } // @api function createAsExpression(expression, type) { - var node = createBaseExpression(229 /* SyntaxKind.AsExpression */); + var node = createBaseExpression(231 /* SyntaxKind.AsExpression */); node.expression = expression; node.type = type; node.transformFlags |= @@ -24958,7 +24967,7 @@ var ts; } // @api function createNonNullExpression(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24975,8 +24984,26 @@ var ts; : node; } // @api + function createSatisfiesExpression(expression, type) { + var node = createBaseExpression(235 /* SyntaxKind.SatisfiesExpression */); + node.expression = expression; + node.type = type; + node.transformFlags |= + propagateChildFlags(node.expression) | + propagateChildFlags(node.type) | + 1 /* TransformFlags.ContainsTypeScript */; + return node; + } + // @api + function updateSatisfiesExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? update(createSatisfiesExpression(expression, type), node) + : node; + } + // @api function createNonNullChain(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.transformFlags |= @@ -24993,7 +25020,7 @@ var ts; } // @api function createMetaProperty(keywordToken, name) { - var node = createBaseExpression(231 /* SyntaxKind.MetaProperty */); + var node = createBaseExpression(233 /* SyntaxKind.MetaProperty */); node.keywordToken = keywordToken; node.name = name; node.transformFlags |= propagateChildFlags(node.name); @@ -25020,7 +25047,7 @@ var ts; // // @api function createTemplateSpan(expression, literal) { - var node = createBaseNode(233 /* SyntaxKind.TemplateSpan */); + var node = createBaseNode(236 /* SyntaxKind.TemplateSpan */); node.expression = expression; node.literal = literal; node.transformFlags |= @@ -25038,7 +25065,7 @@ var ts; } // @api function createSemicolonClassElement() { - var node = createBaseNode(234 /* SyntaxKind.SemicolonClassElement */); + var node = createBaseNode(237 /* SyntaxKind.SemicolonClassElement */); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -25047,7 +25074,7 @@ var ts; // // @api function createBlock(statements, multiLine) { - var node = createBaseNode(235 /* SyntaxKind.Block */); + var node = createBaseNode(238 /* SyntaxKind.Block */); node.statements = createNodeArray(statements); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.statements); @@ -25061,7 +25088,7 @@ var ts; } // @api function createVariableStatement(modifiers, declarationList) { - var node = createBaseDeclaration(237 /* SyntaxKind.VariableStatement */); + var node = createBaseDeclaration(240 /* SyntaxKind.VariableStatement */); node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; node.transformFlags |= @@ -25081,11 +25108,11 @@ var ts; } // @api function createEmptyStatement() { - return createBaseNode(236 /* SyntaxKind.EmptyStatement */); + return createBaseNode(239 /* SyntaxKind.EmptyStatement */); } // @api function createExpressionStatement(expression) { - var node = createBaseNode(238 /* SyntaxKind.ExpressionStatement */); + var node = createBaseNode(241 /* SyntaxKind.ExpressionStatement */); node.expression = parenthesizerRules().parenthesizeExpressionOfExpressionStatement(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -25098,7 +25125,7 @@ var ts; } // @api function createIfStatement(expression, thenStatement, elseStatement) { - var node = createBaseNode(239 /* SyntaxKind.IfStatement */); + var node = createBaseNode(242 /* SyntaxKind.IfStatement */); node.expression = expression; node.thenStatement = asEmbeddedStatement(thenStatement); node.elseStatement = asEmbeddedStatement(elseStatement); @@ -25118,7 +25145,7 @@ var ts; } // @api function createDoStatement(statement, expression) { - var node = createBaseNode(240 /* SyntaxKind.DoStatement */); + var node = createBaseNode(243 /* SyntaxKind.DoStatement */); node.statement = asEmbeddedStatement(statement); node.expression = expression; node.transformFlags |= @@ -25135,7 +25162,7 @@ var ts; } // @api function createWhileStatement(expression, statement) { - var node = createBaseNode(241 /* SyntaxKind.WhileStatement */); + var node = createBaseNode(244 /* SyntaxKind.WhileStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25152,7 +25179,7 @@ var ts; } // @api function createForStatement(initializer, condition, incrementor, statement) { - var node = createBaseNode(242 /* SyntaxKind.ForStatement */); + var node = createBaseNode(245 /* SyntaxKind.ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -25175,7 +25202,7 @@ var ts; } // @api function createForInStatement(initializer, expression, statement) { - var node = createBaseNode(243 /* SyntaxKind.ForInStatement */); + var node = createBaseNode(246 /* SyntaxKind.ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = asEmbeddedStatement(statement); @@ -25195,7 +25222,7 @@ var ts; } // @api function createForOfStatement(awaitModifier, initializer, expression, statement) { - var node = createBaseNode(244 /* SyntaxKind.ForOfStatement */); + var node = createBaseNode(247 /* SyntaxKind.ForOfStatement */); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); @@ -25221,7 +25248,7 @@ var ts; } // @api function createContinueStatement(label) { - var node = createBaseNode(245 /* SyntaxKind.ContinueStatement */); + var node = createBaseNode(248 /* SyntaxKind.ContinueStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25236,7 +25263,7 @@ var ts; } // @api function createBreakStatement(label) { - var node = createBaseNode(246 /* SyntaxKind.BreakStatement */); + var node = createBaseNode(249 /* SyntaxKind.BreakStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25251,7 +25278,7 @@ var ts; } // @api function createReturnStatement(expression) { - var node = createBaseNode(247 /* SyntaxKind.ReturnStatement */); + var node = createBaseNode(250 /* SyntaxKind.ReturnStatement */); node.expression = expression; // return in an ES2018 async generator must be awaited node.transformFlags |= @@ -25268,7 +25295,7 @@ var ts; } // @api function createWithStatement(expression, statement) { - var node = createBaseNode(248 /* SyntaxKind.WithStatement */); + var node = createBaseNode(251 /* SyntaxKind.WithStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25285,7 +25312,7 @@ var ts; } // @api function createSwitchStatement(expression, caseBlock) { - var node = createBaseNode(249 /* SyntaxKind.SwitchStatement */); + var node = createBaseNode(252 /* SyntaxKind.SwitchStatement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.caseBlock = caseBlock; node.transformFlags |= @@ -25302,7 +25329,7 @@ var ts; } // @api function createLabeledStatement(label, statement) { - var node = createBaseNode(250 /* SyntaxKind.LabeledStatement */); + var node = createBaseNode(253 /* SyntaxKind.LabeledStatement */); node.label = asName(label); node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25319,7 +25346,7 @@ var ts; } // @api function createThrowStatement(expression) { - var node = createBaseNode(251 /* SyntaxKind.ThrowStatement */); + var node = createBaseNode(254 /* SyntaxKind.ThrowStatement */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -25332,7 +25359,7 @@ var ts; } // @api function createTryStatement(tryBlock, catchClause, finallyBlock) { - var node = createBaseNode(252 /* SyntaxKind.TryStatement */); + var node = createBaseNode(255 /* SyntaxKind.TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -25352,11 +25379,11 @@ var ts; } // @api function createDebuggerStatement() { - return createBaseNode(253 /* SyntaxKind.DebuggerStatement */); + return createBaseNode(256 /* SyntaxKind.DebuggerStatement */); } // @api function createVariableDeclaration(name, exclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(254 /* SyntaxKind.VariableDeclaration */, + var node = createBaseVariableLikeDeclaration(257 /* SyntaxKind.VariableDeclaration */, /*modifiers*/ undefined, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.exclamationToken = exclamationToken; node.transformFlags |= propagateChildFlags(node.exclamationToken); @@ -25377,7 +25404,7 @@ var ts; // @api function createVariableDeclarationList(declarations, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseNode(255 /* SyntaxKind.VariableDeclarationList */); + var node = createBaseNode(258 /* SyntaxKind.VariableDeclarationList */); node.flags |= flags & 3 /* NodeFlags.BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= @@ -25398,7 +25425,7 @@ var ts; } // @api function createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(256 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(259 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; if (!node.body || ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -25407,7 +25434,7 @@ var ts; node.transformFlags |= propagateChildFlags(node.asteriskToken) | 4194304 /* TransformFlags.ContainsHoistedDeclarationOrCompletion */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -25444,7 +25471,7 @@ var ts; } // @api function createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(257 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(260 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); if (ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; } @@ -25468,7 +25495,7 @@ var ts; } // @api function createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseInterfaceOrClassLikeDeclaration(258 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); + var node = createBaseInterfaceOrClassLikeDeclaration(261 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25493,7 +25520,7 @@ var ts; } // @api function createTypeAliasDeclaration(modifiers, name, typeParameters, type) { - var node = createBaseGenericNamedDeclaration(259 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); + var node = createBaseGenericNamedDeclaration(262 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25517,7 +25544,7 @@ var ts; } // @api function createEnumDeclaration(modifiers, name, members) { - var node = createBaseNamedDeclaration(260 /* SyntaxKind.EnumDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(263 /* SyntaxKind.EnumDeclaration */, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= propagateChildrenFlags(node.members) | @@ -25544,7 +25571,7 @@ var ts; // @api function createModuleDeclaration(modifiers, name, body, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseDeclaration(261 /* SyntaxKind.ModuleDeclaration */); + var node = createBaseDeclaration(264 /* SyntaxKind.ModuleDeclaration */); node.modifiers = asNodeArray(modifiers); node.flags |= flags & (16 /* NodeFlags.Namespace */ | 4 /* NodeFlags.NestedNamespace */ | 1024 /* NodeFlags.GlobalAugmentation */); node.name = name; @@ -25580,7 +25607,7 @@ var ts; } // @api function createModuleBlock(statements) { - var node = createBaseNode(262 /* SyntaxKind.ModuleBlock */); + var node = createBaseNode(265 /* SyntaxKind.ModuleBlock */); node.statements = createNodeArray(statements); node.transformFlags |= propagateChildrenFlags(node.statements); return node; @@ -25593,7 +25620,7 @@ var ts; } // @api function createCaseBlock(clauses) { - var node = createBaseNode(263 /* SyntaxKind.CaseBlock */); + var node = createBaseNode(266 /* SyntaxKind.CaseBlock */); node.clauses = createNodeArray(clauses); node.transformFlags |= propagateChildrenFlags(node.clauses); return node; @@ -25606,7 +25633,7 @@ var ts; } // @api function createNamespaceExportDeclaration(name) { - var node = createBaseNamedDeclaration(264 /* SyntaxKind.NamespaceExportDeclaration */, + var node = createBaseNamedDeclaration(267 /* SyntaxKind.NamespaceExportDeclaration */, /*modifiers*/ undefined, name); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25629,7 +25656,7 @@ var ts; } // @api function createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference) { - var node = createBaseNamedDeclaration(265 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(268 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); node.isTypeOnly = isTypeOnly; node.moduleReference = moduleReference; node.transformFlags |= propagateChildFlags(node.moduleReference); @@ -25657,7 +25684,7 @@ var ts; } // @api function createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(266 /* SyntaxKind.ImportDeclaration */); + var node = createBaseDeclaration(269 /* SyntaxKind.ImportDeclaration */); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; @@ -25687,7 +25714,7 @@ var ts; } // @api function createImportClause(isTypeOnly, name, namedBindings) { - var node = createBaseNode(267 /* SyntaxKind.ImportClause */); + var node = createBaseNode(270 /* SyntaxKind.ImportClause */); node.isTypeOnly = isTypeOnly; node.name = name; node.namedBindings = namedBindings; @@ -25710,7 +25737,7 @@ var ts; } // @api function createAssertClause(elements, multiLine) { - var node = createBaseNode(293 /* SyntaxKind.AssertClause */); + var node = createBaseNode(296 /* SyntaxKind.AssertClause */); node.elements = createNodeArray(elements); node.multiLine = multiLine; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25725,7 +25752,7 @@ var ts; } // @api function createAssertEntry(name, value) { - var node = createBaseNode(294 /* SyntaxKind.AssertEntry */); + var node = createBaseNode(297 /* SyntaxKind.AssertEntry */); node.name = name; node.value = value; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25740,7 +25767,7 @@ var ts; } // @api function createImportTypeAssertionContainer(clause, multiLine) { - var node = createBaseNode(295 /* SyntaxKind.ImportTypeAssertionContainer */); + var node = createBaseNode(298 /* SyntaxKind.ImportTypeAssertionContainer */); node.assertClause = clause; node.multiLine = multiLine; return node; @@ -25754,7 +25781,7 @@ var ts; } // @api function createNamespaceImport(name) { - var node = createBaseNode(268 /* SyntaxKind.NamespaceImport */); + var node = createBaseNode(271 /* SyntaxKind.NamespaceImport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25768,7 +25795,7 @@ var ts; } // @api function createNamespaceExport(name) { - var node = createBaseNode(274 /* SyntaxKind.NamespaceExport */); + var node = createBaseNode(277 /* SyntaxKind.NamespaceExport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name) | @@ -25784,7 +25811,7 @@ var ts; } // @api function createNamedImports(elements) { - var node = createBaseNode(269 /* SyntaxKind.NamedImports */); + var node = createBaseNode(272 /* SyntaxKind.NamedImports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25798,7 +25825,7 @@ var ts; } // @api function createImportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(270 /* SyntaxKind.ImportSpecifier */); + var node = createBaseNode(273 /* SyntaxKind.ImportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = propertyName; node.name = name; @@ -25818,7 +25845,7 @@ var ts; } // @api function createExportAssignment(modifiers, isExportEquals, expression) { - var node = createBaseDeclaration(271 /* SyntaxKind.ExportAssignment */); + var node = createBaseDeclaration(274 /* SyntaxKind.ExportAssignment */); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = isExportEquals @@ -25845,7 +25872,7 @@ var ts; } // @api function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(272 /* SyntaxKind.ExportDeclaration */); + var node = createBaseDeclaration(275 /* SyntaxKind.ExportDeclaration */); node.modifiers = asNodeArray(modifiers); node.isTypeOnly = isTypeOnly; node.exportClause = exportClause; @@ -25878,7 +25905,7 @@ var ts; } // @api function createNamedExports(elements) { - var node = createBaseNode(273 /* SyntaxKind.NamedExports */); + var node = createBaseNode(276 /* SyntaxKind.NamedExports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25892,7 +25919,7 @@ var ts; } // @api function createExportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(275 /* SyntaxKind.ExportSpecifier */); + var node = createBaseNode(278 /* SyntaxKind.ExportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = asName(propertyName); node.name = asName(name); @@ -25912,7 +25939,7 @@ var ts; } // @api function createMissingDeclaration() { - var node = createBaseDeclaration(276 /* SyntaxKind.MissingDeclaration */); + var node = createBaseDeclaration(279 /* SyntaxKind.MissingDeclaration */); return node; } // @@ -25920,7 +25947,7 @@ var ts; // // @api function createExternalModuleReference(expression) { - var node = createBaseNode(277 /* SyntaxKind.ExternalModuleReference */); + var node = createBaseNode(280 /* SyntaxKind.ExternalModuleReference */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25978,7 +26005,7 @@ var ts; } // @api function createJSDocFunctionType(parameters, type) { - var node = createBaseSignatureDeclaration(317 /* SyntaxKind.JSDocFunctionType */, + var node = createBaseSignatureDeclaration(320 /* SyntaxKind.JSDocFunctionType */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); @@ -25994,7 +26021,7 @@ var ts; // @api function createJSDocTypeLiteral(propertyTags, isArrayType) { if (isArrayType === void 0) { isArrayType = false; } - var node = createBaseNode(322 /* SyntaxKind.JSDocTypeLiteral */); + var node = createBaseNode(325 /* SyntaxKind.JSDocTypeLiteral */); node.jsDocPropertyTags = asNodeArray(propertyTags); node.isArrayType = isArrayType; return node; @@ -26008,7 +26035,7 @@ var ts; } // @api function createJSDocTypeExpression(type) { - var node = createBaseNode(309 /* SyntaxKind.JSDocTypeExpression */); + var node = createBaseNode(312 /* SyntaxKind.JSDocTypeExpression */); node.type = type; return node; } @@ -26020,7 +26047,7 @@ var ts; } // @api function createJSDocSignature(typeParameters, parameters, type) { - var node = createBaseNode(323 /* SyntaxKind.JSDocSignature */); + var node = createBaseNode(326 /* SyntaxKind.JSDocSignature */); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; @@ -26049,7 +26076,7 @@ var ts; } // @api function createJSDocTemplateTag(tagName, constraint, typeParameters, comment) { - var node = createBaseJSDocTag(344 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); + var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); return node; @@ -26066,7 +26093,7 @@ var ts; } // @api function createJSDocTypedefTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(345 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); + var node = createBaseJSDocTag(348 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -26084,7 +26111,7 @@ var ts; } // @api function createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(340 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); + var node = createBaseJSDocTag(343 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -26105,7 +26132,7 @@ var ts; } // @api function createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); + var node = createBaseJSDocTag(350 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -26126,7 +26153,7 @@ var ts; } // @api function createJSDocCallbackTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(338 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); + var node = createBaseJSDocTag(341 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -26144,7 +26171,7 @@ var ts; } // @api function createJSDocAugmentsTag(tagName, className, comment) { - var node = createBaseJSDocTag(328 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); + var node = createBaseJSDocTag(331 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); node.class = className; return node; } @@ -26159,13 +26186,13 @@ var ts; } // @api function createJSDocImplementsTag(tagName, className, comment) { - var node = createBaseJSDocTag(329 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); + var node = createBaseJSDocTag(332 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); node.class = className; return node; } // @api function createJSDocSeeTag(tagName, name, comment) { - var node = createBaseJSDocTag(346 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); + var node = createBaseJSDocTag(349 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); node.name = name; return node; } @@ -26179,7 +26206,7 @@ var ts; } // @api function createJSDocNameReference(name) { - var node = createBaseNode(310 /* SyntaxKind.JSDocNameReference */); + var node = createBaseNode(313 /* SyntaxKind.JSDocNameReference */); node.name = name; return node; } @@ -26191,7 +26218,7 @@ var ts; } // @api function createJSDocMemberName(left, right) { - var node = createBaseNode(311 /* SyntaxKind.JSDocMemberName */); + var node = createBaseNode(314 /* SyntaxKind.JSDocMemberName */); node.left = left; node.right = right; node.transformFlags |= @@ -26208,7 +26235,7 @@ var ts; } // @api function createJSDocLink(name, text) { - var node = createBaseNode(324 /* SyntaxKind.JSDocLink */); + var node = createBaseNode(327 /* SyntaxKind.JSDocLink */); node.name = name; node.text = text; return node; @@ -26221,7 +26248,7 @@ var ts; } // @api function createJSDocLinkCode(name, text) { - var node = createBaseNode(325 /* SyntaxKind.JSDocLinkCode */); + var node = createBaseNode(328 /* SyntaxKind.JSDocLinkCode */); node.name = name; node.text = text; return node; @@ -26234,7 +26261,7 @@ var ts; } // @api function createJSDocLinkPlain(name, text) { - var node = createBaseNode(326 /* SyntaxKind.JSDocLinkPlain */); + var node = createBaseNode(329 /* SyntaxKind.JSDocLinkPlain */); node.name = name; node.text = text; return node; @@ -26306,7 +26333,7 @@ var ts; } // @api function createJSDocUnknownTag(tagName, comment) { - var node = createBaseJSDocTag(327 /* SyntaxKind.JSDocTag */, tagName, comment); + var node = createBaseJSDocTag(330 /* SyntaxKind.JSDocTag */, tagName, comment); return node; } // @api @@ -26318,7 +26345,7 @@ var ts; } // @api function createJSDocText(text) { - var node = createBaseNode(321 /* SyntaxKind.JSDocText */); + var node = createBaseNode(324 /* SyntaxKind.JSDocText */); node.text = text; return node; } @@ -26330,7 +26357,7 @@ var ts; } // @api function createJSDocComment(comment, tags) { - var node = createBaseNode(320 /* SyntaxKind.JSDoc */); + var node = createBaseNode(323 /* SyntaxKind.JSDoc */); node.comment = comment; node.tags = asNodeArray(tags); return node; @@ -26347,7 +26374,7 @@ var ts; // // @api function createJsxElement(openingElement, children, closingElement) { - var node = createBaseNode(278 /* SyntaxKind.JsxElement */); + var node = createBaseNode(281 /* SyntaxKind.JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -26368,7 +26395,7 @@ var ts; } // @api function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createBaseNode(279 /* SyntaxKind.JsxSelfClosingElement */); + var node = createBaseNode(282 /* SyntaxKind.JsxSelfClosingElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26392,7 +26419,7 @@ var ts; } // @api function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createBaseNode(280 /* SyntaxKind.JsxOpeningElement */); + var node = createBaseNode(283 /* SyntaxKind.JsxOpeningElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26416,7 +26443,7 @@ var ts; } // @api function createJsxClosingElement(tagName) { - var node = createBaseNode(281 /* SyntaxKind.JsxClosingElement */); + var node = createBaseNode(284 /* SyntaxKind.JsxClosingElement */); node.tagName = tagName; node.transformFlags |= propagateChildFlags(node.tagName) | @@ -26431,7 +26458,7 @@ var ts; } // @api function createJsxFragment(openingFragment, children, closingFragment) { - var node = createBaseNode(282 /* SyntaxKind.JsxFragment */); + var node = createBaseNode(285 /* SyntaxKind.JsxFragment */); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -26467,19 +26494,19 @@ var ts; } // @api function createJsxOpeningFragment() { - var node = createBaseNode(283 /* SyntaxKind.JsxOpeningFragment */); + var node = createBaseNode(286 /* SyntaxKind.JsxOpeningFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxJsxClosingFragment() { - var node = createBaseNode(284 /* SyntaxKind.JsxClosingFragment */); + var node = createBaseNode(287 /* SyntaxKind.JsxClosingFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxAttribute(name, initializer) { - var node = createBaseNode(285 /* SyntaxKind.JsxAttribute */); + var node = createBaseNode(288 /* SyntaxKind.JsxAttribute */); node.name = name; node.initializer = initializer; node.transformFlags |= @@ -26497,7 +26524,7 @@ var ts; } // @api function createJsxAttributes(properties) { - var node = createBaseNode(286 /* SyntaxKind.JsxAttributes */); + var node = createBaseNode(289 /* SyntaxKind.JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= propagateChildrenFlags(node.properties) | @@ -26512,7 +26539,7 @@ var ts; } // @api function createJsxSpreadAttribute(expression) { - var node = createBaseNode(287 /* SyntaxKind.JsxSpreadAttribute */); + var node = createBaseNode(290 /* SyntaxKind.JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | @@ -26527,7 +26554,7 @@ var ts; } // @api function createJsxExpression(dotDotDotToken, expression) { - var node = createBaseNode(288 /* SyntaxKind.JsxExpression */); + var node = createBaseNode(291 /* SyntaxKind.JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; node.transformFlags |= @@ -26547,7 +26574,7 @@ var ts; // // @api function createCaseClause(expression, statements) { - var node = createBaseNode(289 /* SyntaxKind.CaseClause */); + var node = createBaseNode(292 /* SyntaxKind.CaseClause */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.statements = createNodeArray(statements); node.transformFlags |= @@ -26564,7 +26591,7 @@ var ts; } // @api function createDefaultClause(statements) { - var node = createBaseNode(290 /* SyntaxKind.DefaultClause */); + var node = createBaseNode(293 /* SyntaxKind.DefaultClause */); node.statements = createNodeArray(statements); node.transformFlags = propagateChildrenFlags(node.statements); return node; @@ -26577,7 +26604,7 @@ var ts; } // @api function createHeritageClause(token, types) { - var node = createBaseNode(291 /* SyntaxKind.HeritageClause */); + var node = createBaseNode(294 /* SyntaxKind.HeritageClause */); node.token = token; node.types = createNodeArray(types); node.transformFlags |= propagateChildrenFlags(node.types); @@ -26601,7 +26628,7 @@ var ts; } // @api function createCatchClause(variableDeclaration, block) { - var node = createBaseNode(292 /* SyntaxKind.CatchClause */); + var node = createBaseNode(295 /* SyntaxKind.CatchClause */); if (typeof variableDeclaration === "string" || variableDeclaration && !ts.isVariableDeclaration(variableDeclaration)) { variableDeclaration = createVariableDeclaration(variableDeclaration, /*exclamationToken*/ undefined, @@ -26629,7 +26656,7 @@ var ts; // // @api function createPropertyAssignment(name, initializer) { - var node = createBaseNamedDeclaration(296 /* SyntaxKind.PropertyAssignment */, + var node = createBaseNamedDeclaration(299 /* SyntaxKind.PropertyAssignment */, /*modifiers*/ undefined, name); node.initializer = parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26661,7 +26688,7 @@ var ts; } // @api function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createBaseNamedDeclaration(297 /* SyntaxKind.ShorthandPropertyAssignment */, + var node = createBaseNamedDeclaration(300 /* SyntaxKind.ShorthandPropertyAssignment */, /*modifiers*/ undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= @@ -26695,7 +26722,7 @@ var ts; } // @api function createSpreadAssignment(expression) { - var node = createBaseNode(298 /* SyntaxKind.SpreadAssignment */); + var node = createBaseNode(301 /* SyntaxKind.SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -26714,7 +26741,7 @@ var ts; // // @api function createEnumMember(name, initializer) { - var node = createBaseNode(299 /* SyntaxKind.EnumMember */); + var node = createBaseNode(302 /* SyntaxKind.EnumMember */); node.name = asName(name); node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26735,7 +26762,7 @@ var ts; // // @api function createSourceFile(statements, endOfFileToken, flags) { - var node = baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */); + var node = baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */); node.statements = createNodeArray(statements); node.endOfFileToken = endOfFileToken; node.flags |= flags; @@ -26752,7 +26779,7 @@ var ts; return node; } function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) { - var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */)); + var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */)); for (var p in source) { if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p)) continue; @@ -26791,7 +26818,7 @@ var ts; // @api function createBundle(sourceFiles, prepends) { if (prepends === void 0) { prepends = ts.emptyArray; } - var node = createBaseNode(306 /* SyntaxKind.Bundle */); + var node = createBaseNode(309 /* SyntaxKind.Bundle */); node.prepends = prepends; node.sourceFiles = sourceFiles; return node; @@ -26806,7 +26833,7 @@ var ts; } // @api function createUnparsedSource(prologues, syntheticReferences, texts) { - var node = createBaseNode(307 /* SyntaxKind.UnparsedSource */); + var node = createBaseNode(310 /* SyntaxKind.UnparsedSource */); node.prologues = prologues; node.syntheticReferences = syntheticReferences; node.texts = texts; @@ -26824,28 +26851,28 @@ var ts; } // @api function createUnparsedPrologue(data) { - return createBaseUnparsedNode(300 /* SyntaxKind.UnparsedPrologue */, data); + return createBaseUnparsedNode(303 /* SyntaxKind.UnparsedPrologue */, data); } // @api function createUnparsedPrepend(data, texts) { - var node = createBaseUnparsedNode(301 /* SyntaxKind.UnparsedPrepend */, data); + var node = createBaseUnparsedNode(304 /* SyntaxKind.UnparsedPrepend */, data); node.texts = texts; return node; } // @api function createUnparsedTextLike(data, internal) { - return createBaseUnparsedNode(internal ? 303 /* SyntaxKind.UnparsedInternalText */ : 302 /* SyntaxKind.UnparsedText */, data); + return createBaseUnparsedNode(internal ? 306 /* SyntaxKind.UnparsedInternalText */ : 305 /* SyntaxKind.UnparsedText */, data); } // @api function createUnparsedSyntheticReference(section) { - var node = createBaseNode(304 /* SyntaxKind.UnparsedSyntheticReference */); + var node = createBaseNode(307 /* SyntaxKind.UnparsedSyntheticReference */); node.data = section.data; node.section = section; return node; } // @api function createInputFiles() { - var node = createBaseNode(308 /* SyntaxKind.InputFiles */); + var node = createBaseNode(311 /* SyntaxKind.InputFiles */); node.javascriptText = ""; node.declarationText = ""; return node; @@ -26856,7 +26883,7 @@ var ts; // @api function createSyntheticExpression(type, isSpread, tupleNameSource) { if (isSpread === void 0) { isSpread = false; } - var node = createBaseNode(232 /* SyntaxKind.SyntheticExpression */); + var node = createBaseNode(234 /* SyntaxKind.SyntheticExpression */); node.type = type; node.isSpread = isSpread; node.tupleNameSource = tupleNameSource; @@ -26864,7 +26891,7 @@ var ts; } // @api function createSyntaxList(children) { - var node = createBaseNode(348 /* SyntaxKind.SyntaxList */); + var node = createBaseNode(351 /* SyntaxKind.SyntaxList */); node._children = children; return node; } @@ -26879,7 +26906,7 @@ var ts; */ // @api function createNotEmittedStatement(original) { - var node = createBaseNode(349 /* SyntaxKind.NotEmittedStatement */); + var node = createBaseNode(352 /* SyntaxKind.NotEmittedStatement */); node.original = original; ts.setTextRange(node, original); return node; @@ -26893,7 +26920,7 @@ var ts; */ // @api function createPartiallyEmittedExpression(expression, original) { - var node = createBaseNode(350 /* SyntaxKind.PartiallyEmittedExpression */); + var node = createBaseNode(353 /* SyntaxKind.PartiallyEmittedExpression */); node.expression = expression; node.original = original; node.transformFlags |= @@ -26921,7 +26948,7 @@ var ts; } // @api function createCommaListExpression(elements) { - var node = createBaseNode(351 /* SyntaxKind.CommaListExpression */); + var node = createBaseNode(354 /* SyntaxKind.CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); node.transformFlags |= propagateChildrenFlags(node.elements); return node; @@ -26938,7 +26965,7 @@ var ts; */ // @api function createEndOfDeclarationMarker(original) { - var node = createBaseNode(353 /* SyntaxKind.EndOfDeclarationMarker */); + var node = createBaseNode(356 /* SyntaxKind.EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -26949,14 +26976,14 @@ var ts; */ // @api function createMergeDeclarationMarker(original) { - var node = createBaseNode(352 /* SyntaxKind.MergeDeclarationMarker */); + var node = createBaseNode(355 /* SyntaxKind.MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; } // @api function createSyntheticReferenceExpression(expression, thisArg) { - var node = createBaseNode(354 /* SyntaxKind.SyntheticReferenceExpression */); + var node = createBaseNode(357 /* SyntaxKind.SyntheticReferenceExpression */); node.expression = expression; node.thisArg = thisArg; node.transformFlags |= @@ -26978,7 +27005,7 @@ var ts; if (node === undefined) { return node; } - var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */) : + var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */) : ts.isIdentifier(node) ? baseFactory.createBaseIdentifierNode(79 /* SyntaxKind.Identifier */) : ts.isPrivateIdentifier(node) ? baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */) : !ts.isNodeKind(node.kind) ? baseFactory.createBaseTokenNode(node.kind) : @@ -26987,7 +27014,7 @@ var ts; clone.transformFlags = node.transformFlags; setOriginalNode(clone, node); for (var key in node) { - if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) { continue; } clone[key] = node[key]; @@ -27095,11 +27122,12 @@ var ts; } function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); - case 211 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 229 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); - case 230 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); + case 214 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); + case 213 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 231 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); + case 235 /* SyntaxKind.SatisfiesExpression */: return updateSatisfiesExpression(outerExpression, expression, outerExpression.type); + case 232 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -27153,13 +27181,13 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: return false; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -27585,24 +27613,24 @@ var ts; } function getDefaultTagNameForKind(kind) { switch (kind) { - case 343 /* SyntaxKind.JSDocTypeTag */: return "type"; - case 341 /* SyntaxKind.JSDocReturnTag */: return "returns"; - case 342 /* SyntaxKind.JSDocThisTag */: return "this"; - case 339 /* SyntaxKind.JSDocEnumTag */: return "enum"; - case 330 /* SyntaxKind.JSDocAuthorTag */: return "author"; - case 332 /* SyntaxKind.JSDocClassTag */: return "class"; - case 333 /* SyntaxKind.JSDocPublicTag */: return "public"; - case 334 /* SyntaxKind.JSDocPrivateTag */: return "private"; - case 335 /* SyntaxKind.JSDocProtectedTag */: return "protected"; - case 336 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; - case 337 /* SyntaxKind.JSDocOverrideTag */: return "override"; - case 344 /* SyntaxKind.JSDocTemplateTag */: return "template"; - case 345 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; - case 340 /* SyntaxKind.JSDocParameterTag */: return "param"; - case 347 /* SyntaxKind.JSDocPropertyTag */: return "prop"; - case 338 /* SyntaxKind.JSDocCallbackTag */: return "callback"; - case 328 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; - case 329 /* SyntaxKind.JSDocImplementsTag */: return "implements"; + case 346 /* SyntaxKind.JSDocTypeTag */: return "type"; + case 344 /* SyntaxKind.JSDocReturnTag */: return "returns"; + case 345 /* SyntaxKind.JSDocThisTag */: return "this"; + case 342 /* SyntaxKind.JSDocEnumTag */: return "enum"; + case 333 /* SyntaxKind.JSDocAuthorTag */: return "author"; + case 335 /* SyntaxKind.JSDocClassTag */: return "class"; + case 336 /* SyntaxKind.JSDocPublicTag */: return "public"; + case 337 /* SyntaxKind.JSDocPrivateTag */: return "private"; + case 338 /* SyntaxKind.JSDocProtectedTag */: return "protected"; + case 339 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; + case 340 /* SyntaxKind.JSDocOverrideTag */: return "override"; + case 347 /* SyntaxKind.JSDocTemplateTag */: return "template"; + case 348 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; + case 343 /* SyntaxKind.JSDocParameterTag */: return "param"; + case 350 /* SyntaxKind.JSDocPropertyTag */: return "prop"; + case 341 /* SyntaxKind.JSDocCallbackTag */: return "callback"; + case 331 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; + case 332 /* SyntaxKind.JSDocImplementsTag */: return "implements"; default: return ts.Debug.fail("Unsupported kind: ".concat(ts.Debug.formatSyntaxKind(kind))); } @@ -27618,11 +27646,9 @@ var ts; rawTextScanner.setText("`" + rawText + "`"); break; case 15 /* SyntaxKind.TemplateHead */: - // tslint:disable-next-line no-invalid-template-strings rawTextScanner.setText("`" + rawText + "${"); break; case 16 /* SyntaxKind.TemplateMiddle */: - // tslint:disable-next-line no-invalid-template-strings rawTextScanner.setText("}" + rawText + "${"); break; case 17 /* SyntaxKind.TemplateTail */: @@ -27682,69 +27708,70 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) { return -2 /* TransformFlags.TypeExcludes */; } switch (kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return -2147450880 /* TransformFlags.ArrayLiteralOrCallOrNewExcludes */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return -1941676032 /* TransformFlags.ModuleExcludes */; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return -2147483648 /* TransformFlags.ParameterExcludes */; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return -2072174592 /* TransformFlags.ArrowFunctionExcludes */; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return -1937940480 /* TransformFlags.FunctionExcludes */; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return -2146893824 /* TransformFlags.VariableDeclarationListExcludes */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return -2147344384 /* TransformFlags.ClassExcludes */; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return -1937948672 /* TransformFlags.ConstructorExcludes */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return -2013249536 /* TransformFlags.PropertyExcludes */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return -2005057536 /* TransformFlags.MethodOrAccessorExcludes */; - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 163 /* SyntaxKind.TypeParameter */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return -2 /* TransformFlags.TypeExcludes */; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return -2147278848 /* TransformFlags.ObjectLiteralExcludes */; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return -2147418112 /* TransformFlags.CatchClauseExcludes */; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return -2147450880 /* TransformFlags.BindingPatternExcludes */; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: case 106 /* SyntaxKind.SuperKeyword */: return -2147483648 /* TransformFlags.OuterExpressionExcludes */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return -2147483648 /* TransformFlags.PropertyAccessExcludes */; default: return -2147483648 /* TransformFlags.NodeExcludes */; @@ -27944,9 +27971,10 @@ var ts; }; var buildInfo_1; var getAndCacheBuildInfo_1 = function (getText) { + var _a; if (buildInfo_1 === undefined) { var result = getText(); - buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false; + buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false; } return buildInfo_1 || undefined; }; @@ -27979,7 +28007,6 @@ var ts; return node; } ts.createInputFiles = createInputFiles; - // tslint:disable-next-line variable-name var SourceMapSource; /** * Create an external source map source file reference @@ -28000,7 +28027,7 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine; + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine, snippetElement = sourceEmitNode.snippetElement; if (!destEmitNode) destEmitNode = {}; // We are using `.slice()` here in case `destEmitNode.leadingComments` is pushed to later. @@ -28026,6 +28053,8 @@ var ts; } if (startsOnNewLine !== undefined) destEmitNode.startsOnNewLine = startsOnNewLine; + if (snippetElement !== undefined) + destEmitNode.snippetElement = snippetElement; return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -28051,7 +28080,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = (_a = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)))) !== null && _a !== void 0 ? _a : ts.Debug.fail("Could not determine parsed source file."); @@ -28769,6 +28798,8 @@ var ts; // - The verb (`next`, `throw`, or `return` method) to delegate to the expression // of a `yield*`. // - The result of evaluating the verb delegated to the expression of a `yield*`. + // g A temporary variable that holds onto the generator object until the generator + // is started, allowing it to also act as the `suspendedStart` state. // // functions: // verb(n) Creates a bound callback to the `step` function for opcode `n`. @@ -28807,7 +28838,7 @@ var ts; importName: "__generator", scoped: false, priority: 6, - text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" + text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" }; // ES Module Helpers ts.createBindingHelper = { @@ -29129,22 +29160,22 @@ var ts; ts.isExportModifier = isExportModifier; /* @internal */ function isAsyncModifier(node) { - return node.kind === 131 /* SyntaxKind.AsyncKeyword */; + return node.kind === 132 /* SyntaxKind.AsyncKeyword */; } ts.isAsyncModifier = isAsyncModifier; /* @internal */ function isAssertsKeyword(node) { - return node.kind === 128 /* SyntaxKind.AssertsKeyword */; + return node.kind === 129 /* SyntaxKind.AssertsKeyword */; } ts.isAssertsKeyword = isAssertsKeyword; /* @internal */ function isAwaitKeyword(node) { - return node.kind === 132 /* SyntaxKind.AwaitKeyword */; + return node.kind === 133 /* SyntaxKind.AwaitKeyword */; } ts.isAwaitKeyword = isAwaitKeyword; /* @internal */ function isReadonlyKeyword(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */; } ts.isReadonlyKeyword = isReadonlyKeyword; /* @internal */ @@ -29159,9 +29190,14 @@ var ts; ts.isAbstractModifier = isAbstractModifier; /* @internal */ function isOverrideModifier(node) { - return node.kind === 159 /* SyntaxKind.OverrideKeyword */; + return node.kind === 161 /* SyntaxKind.OverrideKeyword */; } ts.isOverrideModifier = isOverrideModifier; + /* @internal */ + function isAccessorModifier(node) { + return node.kind === 127 /* SyntaxKind.AccessorKeyword */; + } + ts.isAccessorModifier = isAccessorModifier; /*@internal*/ function isSuperKeyword(node) { return node.kind === 106 /* SyntaxKind.SuperKeyword */; @@ -29174,605 +29210,609 @@ var ts; ts.isImportKeyword = isImportKeyword; // Names function isQualifiedName(node) { - return node.kind === 161 /* SyntaxKind.QualifiedName */; + return node.kind === 163 /* SyntaxKind.QualifiedName */; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return node.kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isComputedPropertyName = isComputedPropertyName; // Signature elements function isTypeParameterDeclaration(node) { - return node.kind === 163 /* SyntaxKind.TypeParameter */; + return node.kind === 165 /* SyntaxKind.TypeParameter */; } ts.isTypeParameterDeclaration = isTypeParameterDeclaration; // TODO(rbuckton): Rename to 'isParameterDeclaration' function isParameter(node) { - return node.kind === 164 /* SyntaxKind.Parameter */; + return node.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 165 /* SyntaxKind.Decorator */; + return node.kind === 167 /* SyntaxKind.Decorator */; } ts.isDecorator = isDecorator; // TypeMember function isPropertySignature(node) { - return node.kind === 166 /* SyntaxKind.PropertySignature */; + return node.kind === 168 /* SyntaxKind.PropertySignature */; } ts.isPropertySignature = isPropertySignature; function isPropertyDeclaration(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } ts.isPropertyDeclaration = isPropertyDeclaration; function isMethodSignature(node) { - return node.kind === 168 /* SyntaxKind.MethodSignature */; + return node.kind === 170 /* SyntaxKind.MethodSignature */; } ts.isMethodSignature = isMethodSignature; function isMethodDeclaration(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } ts.isMethodDeclaration = isMethodDeclaration; function isClassStaticBlockDeclaration(node) { - return node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } ts.isClassStaticBlockDeclaration = isClassStaticBlockDeclaration; function isConstructorDeclaration(node) { - return node.kind === 171 /* SyntaxKind.Constructor */; + return node.kind === 173 /* SyntaxKind.Constructor */; } ts.isConstructorDeclaration = isConstructorDeclaration; function isGetAccessorDeclaration(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessorDeclaration = isGetAccessorDeclaration; function isSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessorDeclaration = isSetAccessorDeclaration; function isCallSignatureDeclaration(node) { - return node.kind === 174 /* SyntaxKind.CallSignature */; + return node.kind === 176 /* SyntaxKind.CallSignature */; } ts.isCallSignatureDeclaration = isCallSignatureDeclaration; function isConstructSignatureDeclaration(node) { - return node.kind === 175 /* SyntaxKind.ConstructSignature */; + return node.kind === 177 /* SyntaxKind.ConstructSignature */; } ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration; function isIndexSignatureDeclaration(node) { - return node.kind === 176 /* SyntaxKind.IndexSignature */; + return node.kind === 178 /* SyntaxKind.IndexSignature */; } ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration; // Type function isTypePredicateNode(node) { - return node.kind === 177 /* SyntaxKind.TypePredicate */; + return node.kind === 179 /* SyntaxKind.TypePredicate */; } ts.isTypePredicateNode = isTypePredicateNode; function isTypeReferenceNode(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */; + return node.kind === 180 /* SyntaxKind.TypeReference */; } ts.isTypeReferenceNode = isTypeReferenceNode; function isFunctionTypeNode(node) { - return node.kind === 179 /* SyntaxKind.FunctionType */; + return node.kind === 181 /* SyntaxKind.FunctionType */; } ts.isFunctionTypeNode = isFunctionTypeNode; function isConstructorTypeNode(node) { - return node.kind === 180 /* SyntaxKind.ConstructorType */; + return node.kind === 182 /* SyntaxKind.ConstructorType */; } ts.isConstructorTypeNode = isConstructorTypeNode; function isTypeQueryNode(node) { - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isTypeQueryNode = isTypeQueryNode; function isTypeLiteralNode(node) { - return node.kind === 182 /* SyntaxKind.TypeLiteral */; + return node.kind === 184 /* SyntaxKind.TypeLiteral */; } ts.isTypeLiteralNode = isTypeLiteralNode; function isArrayTypeNode(node) { - return node.kind === 183 /* SyntaxKind.ArrayType */; + return node.kind === 185 /* SyntaxKind.ArrayType */; } ts.isArrayTypeNode = isArrayTypeNode; function isTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */; + return node.kind === 186 /* SyntaxKind.TupleType */; } ts.isTupleTypeNode = isTupleTypeNode; function isNamedTupleMember(node) { - return node.kind === 197 /* SyntaxKind.NamedTupleMember */; + return node.kind === 199 /* SyntaxKind.NamedTupleMember */; } ts.isNamedTupleMember = isNamedTupleMember; function isOptionalTypeNode(node) { - return node.kind === 185 /* SyntaxKind.OptionalType */; + return node.kind === 187 /* SyntaxKind.OptionalType */; } ts.isOptionalTypeNode = isOptionalTypeNode; function isRestTypeNode(node) { - return node.kind === 186 /* SyntaxKind.RestType */; + return node.kind === 188 /* SyntaxKind.RestType */; } ts.isRestTypeNode = isRestTypeNode; function isUnionTypeNode(node) { - return node.kind === 187 /* SyntaxKind.UnionType */; + return node.kind === 189 /* SyntaxKind.UnionType */; } ts.isUnionTypeNode = isUnionTypeNode; function isIntersectionTypeNode(node) { - return node.kind === 188 /* SyntaxKind.IntersectionType */; + return node.kind === 190 /* SyntaxKind.IntersectionType */; } ts.isIntersectionTypeNode = isIntersectionTypeNode; function isConditionalTypeNode(node) { - return node.kind === 189 /* SyntaxKind.ConditionalType */; + return node.kind === 191 /* SyntaxKind.ConditionalType */; } ts.isConditionalTypeNode = isConditionalTypeNode; function isInferTypeNode(node) { - return node.kind === 190 /* SyntaxKind.InferType */; + return node.kind === 192 /* SyntaxKind.InferType */; } ts.isInferTypeNode = isInferTypeNode; function isParenthesizedTypeNode(node) { - return node.kind === 191 /* SyntaxKind.ParenthesizedType */; + return node.kind === 193 /* SyntaxKind.ParenthesizedType */; } ts.isParenthesizedTypeNode = isParenthesizedTypeNode; function isThisTypeNode(node) { - return node.kind === 192 /* SyntaxKind.ThisType */; + return node.kind === 194 /* SyntaxKind.ThisType */; } ts.isThisTypeNode = isThisTypeNode; function isTypeOperatorNode(node) { - return node.kind === 193 /* SyntaxKind.TypeOperator */; + return node.kind === 195 /* SyntaxKind.TypeOperator */; } ts.isTypeOperatorNode = isTypeOperatorNode; function isIndexedAccessTypeNode(node) { - return node.kind === 194 /* SyntaxKind.IndexedAccessType */; + return node.kind === 196 /* SyntaxKind.IndexedAccessType */; } ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode; function isMappedTypeNode(node) { - return node.kind === 195 /* SyntaxKind.MappedType */; + return node.kind === 197 /* SyntaxKind.MappedType */; } ts.isMappedTypeNode = isMappedTypeNode; function isLiteralTypeNode(node) { - return node.kind === 196 /* SyntaxKind.LiteralType */; + return node.kind === 198 /* SyntaxKind.LiteralType */; } ts.isLiteralTypeNode = isLiteralTypeNode; function isImportTypeNode(node) { - return node.kind === 200 /* SyntaxKind.ImportType */; + return node.kind === 202 /* SyntaxKind.ImportType */; } ts.isImportTypeNode = isImportTypeNode; function isTemplateLiteralTypeSpan(node) { - return node.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */; + return node.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */; } ts.isTemplateLiteralTypeSpan = isTemplateLiteralTypeSpan; function isTemplateLiteralTypeNode(node) { - return node.kind === 198 /* SyntaxKind.TemplateLiteralType */; + return node.kind === 200 /* SyntaxKind.TemplateLiteralType */; } ts.isTemplateLiteralTypeNode = isTemplateLiteralTypeNode; // Binding patterns function isObjectBindingPattern(node) { - return node.kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return node.kind === 203 /* SyntaxKind.ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 202 /* SyntaxKind.ArrayBindingPattern */; + return node.kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 203 /* SyntaxKind.BindingElement */; + return node.kind === 205 /* SyntaxKind.BindingElement */; } ts.isBindingElement = isBindingElement; // Expression function isArrayLiteralExpression(node) { - return node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; + return node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertionExpression(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } ts.isTypeAssertionExpression = isTypeAssertionExpression; function isParenthesizedExpression(node) { - return node.kind === 212 /* SyntaxKind.ParenthesizedExpression */; + return node.kind === 214 /* SyntaxKind.ParenthesizedExpression */; } ts.isParenthesizedExpression = isParenthesizedExpression; function isFunctionExpression(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 216 /* SyntaxKind.TypeOfExpression */; + return node.kind === 218 /* SyntaxKind.TypeOfExpression */; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 217 /* SyntaxKind.VoidExpression */; + return node.kind === 219 /* SyntaxKind.VoidExpression */; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 218 /* SyntaxKind.AwaitExpression */; + return node.kind === 220 /* SyntaxKind.AwaitExpression */; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */; + return node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 220 /* SyntaxKind.PostfixUnaryExpression */; + return node.kind === 222 /* SyntaxKind.PostfixUnaryExpression */; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 222 /* SyntaxKind.ConditionalExpression */; + return node.kind === 224 /* SyntaxKind.ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 223 /* SyntaxKind.TemplateExpression */; + return node.kind === 225 /* SyntaxKind.TemplateExpression */; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 224 /* SyntaxKind.YieldExpression */; + return node.kind === 226 /* SyntaxKind.YieldExpression */; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 225 /* SyntaxKind.SpreadElement */; + return node.kind === 227 /* SyntaxKind.SpreadElement */; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 226 /* SyntaxKind.ClassExpression */; + return node.kind === 228 /* SyntaxKind.ClassExpression */; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 227 /* SyntaxKind.OmittedExpression */; + return node.kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 229 /* SyntaxKind.AsExpression */; + return node.kind === 231 /* SyntaxKind.AsExpression */; } ts.isAsExpression = isAsExpression; + function isSatisfiesExpression(node) { + return node.kind === 235 /* SyntaxKind.SatisfiesExpression */; + } + ts.isSatisfiesExpression = isSatisfiesExpression; function isNonNullExpression(node) { - return node.kind === 230 /* SyntaxKind.NonNullExpression */; + return node.kind === 232 /* SyntaxKind.NonNullExpression */; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 231 /* SyntaxKind.MetaProperty */; + return node.kind === 233 /* SyntaxKind.MetaProperty */; } ts.isMetaProperty = isMetaProperty; function isSyntheticExpression(node) { - return node.kind === 232 /* SyntaxKind.SyntheticExpression */; + return node.kind === 234 /* SyntaxKind.SyntheticExpression */; } ts.isSyntheticExpression = isSyntheticExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 350 /* SyntaxKind.PartiallyEmittedExpression */; + return node.kind === 353 /* SyntaxKind.PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isCommaListExpression(node) { - return node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaListExpression = isCommaListExpression; // Misc function isTemplateSpan(node) { - return node.kind === 233 /* SyntaxKind.TemplateSpan */; + return node.kind === 236 /* SyntaxKind.TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 234 /* SyntaxKind.SemicolonClassElement */; + return node.kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isSemicolonClassElement = isSemicolonClassElement; // Elements function isBlock(node) { - return node.kind === 235 /* SyntaxKind.Block */; + return node.kind === 238 /* SyntaxKind.Block */; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 237 /* SyntaxKind.VariableStatement */; + return node.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 236 /* SyntaxKind.EmptyStatement */; + return node.kind === 239 /* SyntaxKind.EmptyStatement */; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */; + return node.kind === 241 /* SyntaxKind.ExpressionStatement */; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 239 /* SyntaxKind.IfStatement */; + return node.kind === 242 /* SyntaxKind.IfStatement */; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 240 /* SyntaxKind.DoStatement */; + return node.kind === 243 /* SyntaxKind.DoStatement */; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 241 /* SyntaxKind.WhileStatement */; + return node.kind === 244 /* SyntaxKind.WhileStatement */; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 242 /* SyntaxKind.ForStatement */; + return node.kind === 245 /* SyntaxKind.ForStatement */; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */; } ts.isBreakStatement = isBreakStatement; function isReturnStatement(node) { - return node.kind === 247 /* SyntaxKind.ReturnStatement */; + return node.kind === 250 /* SyntaxKind.ReturnStatement */; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 248 /* SyntaxKind.WithStatement */; + return node.kind === 251 /* SyntaxKind.WithStatement */; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 249 /* SyntaxKind.SwitchStatement */; + return node.kind === 252 /* SyntaxKind.SwitchStatement */; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 250 /* SyntaxKind.LabeledStatement */; + return node.kind === 253 /* SyntaxKind.LabeledStatement */; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 251 /* SyntaxKind.ThrowStatement */; + return node.kind === 254 /* SyntaxKind.ThrowStatement */; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 252 /* SyntaxKind.TryStatement */; + return node.kind === 255 /* SyntaxKind.TryStatement */; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 253 /* SyntaxKind.DebuggerStatement */; + return node.kind === 256 /* SyntaxKind.DebuggerStatement */; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 255 /* SyntaxKind.VariableDeclarationList */; + return node.kind === 258 /* SyntaxKind.VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 256 /* SyntaxKind.FunctionDeclaration */; + return node.kind === 259 /* SyntaxKind.FunctionDeclaration */; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 257 /* SyntaxKind.ClassDeclaration */; + return node.kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return node.kind === 261 /* SyntaxKind.InterfaceDeclaration */; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */; + return node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 262 /* SyntaxKind.ModuleBlock */; + return node.kind === 265 /* SyntaxKind.ModuleBlock */; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 263 /* SyntaxKind.CaseBlock */; + return node.kind === 266 /* SyntaxKind.CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */; + return node.kind === 270 /* SyntaxKind.ImportClause */; } ts.isImportClause = isImportClause; function isImportTypeAssertionContainer(node) { - return node.kind === 295 /* SyntaxKind.ImportTypeAssertionContainer */; + return node.kind === 298 /* SyntaxKind.ImportTypeAssertionContainer */; } ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer; function isAssertClause(node) { - return node.kind === 293 /* SyntaxKind.AssertClause */; + return node.kind === 296 /* SyntaxKind.AssertClause */; } ts.isAssertClause = isAssertClause; function isAssertEntry(node) { - return node.kind === 294 /* SyntaxKind.AssertEntry */; + return node.kind === 297 /* SyntaxKind.AssertEntry */; } ts.isAssertEntry = isAssertEntry; function isNamespaceImport(node) { - return node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamespaceImport = isNamespaceImport; function isNamespaceExport(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */; } ts.isNamespaceExport = isNamespaceExport; function isNamedImports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */; + return node.kind === 272 /* SyntaxKind.NamedImports */; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 270 /* SyntaxKind.ImportSpecifier */; + return node.kind === 273 /* SyntaxKind.ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 271 /* SyntaxKind.ExportAssignment */; + return node.kind === 274 /* SyntaxKind.ExportAssignment */; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 272 /* SyntaxKind.ExportDeclaration */; + return node.kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 275 /* SyntaxKind.ExportSpecifier */; + return node.kind === 278 /* SyntaxKind.ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 276 /* SyntaxKind.MissingDeclaration */; + return node.kind === 279 /* SyntaxKind.MissingDeclaration */; } ts.isMissingDeclaration = isMissingDeclaration; function isNotEmittedStatement(node) { - return node.kind === 349 /* SyntaxKind.NotEmittedStatement */; + return node.kind === 352 /* SyntaxKind.NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ function isSyntheticReference(node) { - return node.kind === 354 /* SyntaxKind.SyntheticReferenceExpression */; + return node.kind === 357 /* SyntaxKind.SyntheticReferenceExpression */; } ts.isSyntheticReference = isSyntheticReference; /* @internal */ function isMergeDeclarationMarker(node) { - return node.kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return node.kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } ts.isMergeDeclarationMarker = isMergeDeclarationMarker; /* @internal */ function isEndOfDeclarationMarker(node) { - return node.kind === 353 /* SyntaxKind.EndOfDeclarationMarker */; + return node.kind === 356 /* SyntaxKind.EndOfDeclarationMarker */; } ts.isEndOfDeclarationMarker = isEndOfDeclarationMarker; // Module References function isExternalModuleReference(node) { - return node.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleReference = isExternalModuleReference; // JSX function isJsxElement(node) { - return node.kind === 278 /* SyntaxKind.JsxElement */; + return node.kind === 281 /* SyntaxKind.JsxElement */; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return node.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 280 /* SyntaxKind.JsxOpeningElement */; + return node.kind === 283 /* SyntaxKind.JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 281 /* SyntaxKind.JsxClosingElement */; + return node.kind === 284 /* SyntaxKind.JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 282 /* SyntaxKind.JsxFragment */; + return node.kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 283 /* SyntaxKind.JsxOpeningFragment */; + return node.kind === 286 /* SyntaxKind.JsxOpeningFragment */; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 284 /* SyntaxKind.JsxClosingFragment */; + return node.kind === 287 /* SyntaxKind.JsxClosingFragment */; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */; + return node.kind === 288 /* SyntaxKind.JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 286 /* SyntaxKind.JsxAttributes */; + return node.kind === 289 /* SyntaxKind.JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 288 /* SyntaxKind.JsxExpression */; + return node.kind === 291 /* SyntaxKind.JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 289 /* SyntaxKind.CaseClause */; + return node.kind === 292 /* SyntaxKind.CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 290 /* SyntaxKind.DefaultClause */; + return node.kind === 293 /* SyntaxKind.DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 291 /* SyntaxKind.HeritageClause */; + return node.kind === 294 /* SyntaxKind.HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 296 /* SyntaxKind.PropertyAssignment */; + return node.kind === 299 /* SyntaxKind.PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 298 /* SyntaxKind.SpreadAssignment */; + return node.kind === 301 /* SyntaxKind.SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } ts.isEnumMember = isEnumMember; // Unparsed // TODO(rbuckton): isUnparsedPrologue function isUnparsedPrepend(node) { - return node.kind === 301 /* SyntaxKind.UnparsedPrepend */; + return node.kind === 304 /* SyntaxKind.UnparsedPrepend */; } ts.isUnparsedPrepend = isUnparsedPrepend; // TODO(rbuckton): isUnparsedText @@ -29780,176 +29820,176 @@ var ts; // TODO(rbuckton): isUnparsedSyntheticReference // Top-level nodes function isSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */; + return node.kind === 308 /* SyntaxKind.SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 306 /* SyntaxKind.Bundle */; + return node.kind === 309 /* SyntaxKind.Bundle */; } ts.isBundle = isBundle; function isUnparsedSource(node) { - return node.kind === 307 /* SyntaxKind.UnparsedSource */; + return node.kind === 310 /* SyntaxKind.UnparsedSource */; } ts.isUnparsedSource = isUnparsedSource; // TODO(rbuckton): isInputFiles // JSDoc Elements function isJSDocTypeExpression(node) { - return node.kind === 309 /* SyntaxKind.JSDocTypeExpression */; + return node.kind === 312 /* SyntaxKind.JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocNameReference(node) { - return node.kind === 310 /* SyntaxKind.JSDocNameReference */; + return node.kind === 313 /* SyntaxKind.JSDocNameReference */; } ts.isJSDocNameReference = isJSDocNameReference; function isJSDocMemberName(node) { - return node.kind === 311 /* SyntaxKind.JSDocMemberName */; + return node.kind === 314 /* SyntaxKind.JSDocMemberName */; } ts.isJSDocMemberName = isJSDocMemberName; function isJSDocLink(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */; + return node.kind === 327 /* SyntaxKind.JSDocLink */; } ts.isJSDocLink = isJSDocLink; function isJSDocLinkCode(node) { - return node.kind === 325 /* SyntaxKind.JSDocLinkCode */; + return node.kind === 328 /* SyntaxKind.JSDocLinkCode */; } ts.isJSDocLinkCode = isJSDocLinkCode; function isJSDocLinkPlain(node) { - return node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkPlain = isJSDocLinkPlain; function isJSDocAllType(node) { - return node.kind === 312 /* SyntaxKind.JSDocAllType */; + return node.kind === 315 /* SyntaxKind.JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 313 /* SyntaxKind.JSDocUnknownType */; + return node.kind === 316 /* SyntaxKind.JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 314 /* SyntaxKind.JSDocNullableType */; + return node.kind === 317 /* SyntaxKind.JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 315 /* SyntaxKind.JSDocNonNullableType */; + return node.kind === 318 /* SyntaxKind.JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return node.kind === 319 /* SyntaxKind.JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 317 /* SyntaxKind.JSDocFunctionType */; + return node.kind === 320 /* SyntaxKind.JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDocNamepathType(node) { - return node.kind === 319 /* SyntaxKind.JSDocNamepathType */; + return node.kind === 322 /* SyntaxKind.JSDocNamepathType */; } ts.isJSDocNamepathType = isJSDocNamepathType; function isJSDoc(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */; + return node.kind === 323 /* SyntaxKind.JSDoc */; } ts.isJSDoc = isJSDoc; function isJSDocTypeLiteral(node) { - return node.kind === 322 /* SyntaxKind.JSDocTypeLiteral */; + return node.kind === 325 /* SyntaxKind.JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; function isJSDocSignature(node) { - return node.kind === 323 /* SyntaxKind.JSDocSignature */; + return node.kind === 326 /* SyntaxKind.JSDocSignature */; } ts.isJSDocSignature = isJSDocSignature; // JSDoc Tags function isJSDocAugmentsTag(node) { - return node.kind === 328 /* SyntaxKind.JSDocAugmentsTag */; + return node.kind === 331 /* SyntaxKind.JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocAuthorTag(node) { - return node.kind === 330 /* SyntaxKind.JSDocAuthorTag */; + return node.kind === 333 /* SyntaxKind.JSDocAuthorTag */; } ts.isJSDocAuthorTag = isJSDocAuthorTag; function isJSDocClassTag(node) { - return node.kind === 332 /* SyntaxKind.JSDocClassTag */; + return node.kind === 335 /* SyntaxKind.JSDocClassTag */; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocCallbackTag(node) { - return node.kind === 338 /* SyntaxKind.JSDocCallbackTag */; + return node.kind === 341 /* SyntaxKind.JSDocCallbackTag */; } ts.isJSDocCallbackTag = isJSDocCallbackTag; function isJSDocPublicTag(node) { - return node.kind === 333 /* SyntaxKind.JSDocPublicTag */; + return node.kind === 336 /* SyntaxKind.JSDocPublicTag */; } ts.isJSDocPublicTag = isJSDocPublicTag; function isJSDocPrivateTag(node) { - return node.kind === 334 /* SyntaxKind.JSDocPrivateTag */; + return node.kind === 337 /* SyntaxKind.JSDocPrivateTag */; } ts.isJSDocPrivateTag = isJSDocPrivateTag; function isJSDocProtectedTag(node) { - return node.kind === 335 /* SyntaxKind.JSDocProtectedTag */; + return node.kind === 338 /* SyntaxKind.JSDocProtectedTag */; } ts.isJSDocProtectedTag = isJSDocProtectedTag; function isJSDocReadonlyTag(node) { - return node.kind === 336 /* SyntaxKind.JSDocReadonlyTag */; + return node.kind === 339 /* SyntaxKind.JSDocReadonlyTag */; } ts.isJSDocReadonlyTag = isJSDocReadonlyTag; function isJSDocOverrideTag(node) { - return node.kind === 337 /* SyntaxKind.JSDocOverrideTag */; + return node.kind === 340 /* SyntaxKind.JSDocOverrideTag */; } ts.isJSDocOverrideTag = isJSDocOverrideTag; function isJSDocDeprecatedTag(node) { - return node.kind === 331 /* SyntaxKind.JSDocDeprecatedTag */; + return node.kind === 334 /* SyntaxKind.JSDocDeprecatedTag */; } ts.isJSDocDeprecatedTag = isJSDocDeprecatedTag; function isJSDocSeeTag(node) { - return node.kind === 346 /* SyntaxKind.JSDocSeeTag */; + return node.kind === 349 /* SyntaxKind.JSDocSeeTag */; } ts.isJSDocSeeTag = isJSDocSeeTag; function isJSDocEnumTag(node) { - return node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocEnumTag = isJSDocEnumTag; function isJSDocParameterTag(node) { - return node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 341 /* SyntaxKind.JSDocReturnTag */; + return node.kind === 344 /* SyntaxKind.JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocThisTag(node) { - return node.kind === 342 /* SyntaxKind.JSDocThisTag */; + return node.kind === 345 /* SyntaxKind.JSDocThisTag */; } ts.isJSDocThisTag = isJSDocThisTag; function isJSDocTypeTag(node) { - return node.kind === 343 /* SyntaxKind.JSDocTypeTag */; + return node.kind === 346 /* SyntaxKind.JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 344 /* SyntaxKind.JSDocTemplateTag */; + return node.kind === 347 /* SyntaxKind.JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocUnknownTag(node) { - return node.kind === 327 /* SyntaxKind.JSDocTag */; + return node.kind === 330 /* SyntaxKind.JSDocTag */; } ts.isJSDocUnknownTag = isJSDocUnknownTag; function isJSDocPropertyTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocImplementsTag(node) { - return node.kind === 329 /* SyntaxKind.JSDocImplementsTag */; + return node.kind === 332 /* SyntaxKind.JSDocImplementsTag */; } ts.isJSDocImplementsTag = isJSDocImplementsTag; // Synthesized list /* @internal */ function isSyntaxList(n) { - return n.kind === 348 /* SyntaxKind.SyntaxList */; + return n.kind === 351 /* SyntaxKind.SyntaxList */; } ts.isSyntaxList = isSyntaxList; })(ts || (ts = {})); @@ -30148,14 +30188,14 @@ var ts; ts.Debug.failBadSyntaxKind(property.name, "Private identifiers are not allowed in object literals."); } switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return createExpressionForAccessorDeclaration(factory, node.properties, property, receiver, !!node.multiLine); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return createExpressionForPropertyAssignment(factory, property, receiver); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(factory, property, receiver); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return createExpressionForMethodDeclaration(factory, property, receiver); } } @@ -30263,8 +30303,8 @@ var ts; } ts.startsWithUseStrict = startsWithUseStrict; function isCommaSequence(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || - node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || + node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaSequence = isCommaSequence; function isJSDocTypeAssertion(node) { @@ -30282,17 +30322,18 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 15 /* OuterExpressionKinds.All */; } switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: if (kinds & 16 /* OuterExpressionKinds.ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) { return false; } return (kinds & 1 /* OuterExpressionKinds.Parentheses */) !== 0; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return (kinds & 2 /* OuterExpressionKinds.TypeAssertions */) !== 0; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return (kinds & 4 /* OuterExpressionKinds.NonNullAssertions */) !== 0; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return (kinds & 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */) !== 0; } return false; @@ -30413,10 +30454,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : factory.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 266 /* SyntaxKind.ImportDeclaration */ && node.importClause) { + if (node.kind === 269 /* SyntaxKind.ImportDeclaration */ && node.importClause) { return factory.getGeneratedNameForNode(node); } - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { return factory.getGeneratedNameForNode(node); } return undefined; @@ -30535,7 +30576,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -30547,11 +30588,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -30583,12 +30624,12 @@ var ts; */ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 225 /* SyntaxKind.SpreadElement */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 227 /* SyntaxKind.SpreadElement */: + case 301 /* SyntaxKind.SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -30606,7 +30647,7 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -30621,7 +30662,7 @@ var ts; : propertyName; } break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -30636,7 +30677,7 @@ var ts; : propertyName; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` if (bindingElement.name && ts.isPrivateIdentifier(bindingElement.name)) { return ts.Debug.failBadSyntaxKind(bindingElement.name); @@ -30659,13 +30700,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -30686,46 +30727,46 @@ var ts; ts.getJSDocTypeAliasName = getJSDocTypeAliasName; function canHaveIllegalType(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalType = canHaveIllegalType; function canHaveIllegalTypeParameters(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalTypeParameters = canHaveIllegalTypeParameters; function canHaveIllegalDecorators(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.canHaveIllegalDecorators = canHaveIllegalDecorators; function canHaveIllegalModifiers(node) { var kind = node.kind; - return kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 179 /* SyntaxKind.FunctionType */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 181 /* SyntaxKind.FunctionType */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.canHaveIllegalModifiers = canHaveIllegalModifiers; ts.isTypeNodeOrTypeParameterDeclaration = ts.or(ts.isTypeNode, ts.isTypeParameterDeclaration); @@ -30999,6 +31040,83 @@ var ts; return ts.setTextRange(factory.createNodeArray([], nodes.hasTrailingComma), nodes); } ts.elideNodes = elideNodes; + /** + * Gets the node from which a name should be generated. + */ + function getNodeForGeneratedName(name) { + if (name.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) { + var autoGenerateId = name.autoGenerateId; + var node = name; + var original = node.original; + while (original) { + node = original; + // if "node" is a different generated name (having a different "autoGenerateId"), use it and stop traversing. + if (ts.isMemberName(node) + && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) + && node.autoGenerateId !== autoGenerateId) { + break; + } + original = node.original; + } + // otherwise, return the original node for the source + return node; + } + return name; + } + ts.getNodeForGeneratedName = getNodeForGeneratedName; + function formatGeneratedNamePart(part, generateName) { + return typeof part === "object" ? formatGeneratedName(/*privateName*/ false, part.prefix, part.node, part.suffix, generateName) : + typeof part === "string" ? part.length > 0 && part.charCodeAt(0) === 35 /* CharacterCodes.hash */ ? part.slice(1) : part : + ""; + } + ts.formatGeneratedNamePart = formatGeneratedNamePart; + function formatIdentifier(name, generateName) { + return typeof name === "string" ? name : + formatIdentifierWorker(name, ts.Debug.checkDefined(generateName)); + } + function formatIdentifierWorker(node, generateName) { + return ts.isGeneratedPrivateIdentifier(node) ? generateName(node).slice(1) : + ts.isGeneratedIdentifier(node) ? generateName(node) : + ts.isPrivateIdentifier(node) ? node.escapedText.slice(1) : + ts.idText(node); + } + function formatGeneratedName(privateName, prefix, baseName, suffix, generateName) { + prefix = formatGeneratedNamePart(prefix, generateName); + suffix = formatGeneratedNamePart(suffix, generateName); + baseName = formatIdentifier(baseName, generateName); + return "".concat(privateName ? "#" : "").concat(prefix).concat(baseName).concat(suffix); + } + ts.formatGeneratedName = formatGeneratedName; + /** + * Creates a private backing field for an `accessor` {@link PropertyDeclaration}. + */ + function createAccessorPropertyBackingField(factory, node, modifiers, initializer) { + return factory.updatePropertyDeclaration(node, modifiers, factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"), + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, initializer); + } + ts.createAccessorPropertyBackingField = createAccessorPropertyBackingField; + /** + * Creates a {@link GetAccessorDeclaration} that reads from a private backing field. + */ + function createAccessorPropertyGetRedirector(factory, node, modifiers, name) { + return factory.createGetAccessorDeclaration(modifiers, name, [], + /*type*/ undefined, factory.createBlock([ + factory.createReturnStatement(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"))) + ])); + } + ts.createAccessorPropertyGetRedirector = createAccessorPropertyGetRedirector; + /** + * Creates a {@link SetAccessorDeclaration} that writes to a private backing field. + */ + function createAccessorPropertySetRedirector(factory, node, modifiers, name) { + return factory.createSetAccessorDeclaration(modifiers, name, [factory.createParameterDeclaration( + /*modifiers*/ undefined, + /*dotdotDotToken*/ undefined, "value")], factory.createBlock([ + factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage")), factory.createIdentifier("value"))) + ])); + } + ts.createAccessorPropertySetRedirector = createAccessorPropertySetRedirector; })(ts || (ts = {})); var ts; (function (ts) { @@ -31008,47 +31126,48 @@ var ts; ts.setTextRange = setTextRange; function canHaveModifiers(node) { var kind = node.kind; - return kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 180 /* SyntaxKind.ConstructorType */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 272 /* SyntaxKind.ExportDeclaration */; + return kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 182 /* SyntaxKind.ConstructorType */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.canHaveModifiers = canHaveModifiers; function canHaveDecorators(node) { var kind = node.kind; - return kind === 164 /* SyntaxKind.Parameter */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 257 /* SyntaxKind.ClassDeclaration */; + return kind === 166 /* SyntaxKind.Parameter */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.canHaveDecorators = canHaveDecorators; })(ts || (ts = {})); var ts; (function (ts) { + var _a; var SignatureFlags; (function (SignatureFlags) { SignatureFlags[SignatureFlags["None"] = 0] = "None"; @@ -31136,6 +31255,718 @@ var ts; function isImportMeta(node) { return ts.isMetaProperty(node) && node.keywordToken === 100 /* SyntaxKind.ImportKeyword */ && node.name.escapedText === "meta"; } + var forEachChildTable = (_a = {}, + _a[163 /* SyntaxKind.QualifiedName */] = function forEachChildInQualifiedName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[165 /* SyntaxKind.TypeParameter */] = function forEachChildInTypeParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || + visitNode(cbNode, node.expression); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[166 /* SyntaxKind.Parameter */] = function forEachChildInParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[168 /* SyntaxKind.PropertySignature */] = function forEachChildInPropertySignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[299 /* SyntaxKind.PropertyAssignment */] = function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.initializer); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[205 /* SyntaxKind.BindingElement */] = function forEachChildInBindingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function forEachChildInIndexSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function forEachChildInConstructorType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[181 /* SyntaxKind.FunctionType */] = function forEachChildInFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[176 /* SyntaxKind.CallSignature */] = forEachChildInCallOrConstructSignature, + _a[177 /* SyntaxKind.ConstructSignature */] = forEachChildInCallOrConstructSignature, + _a[171 /* SyntaxKind.MethodDeclaration */] = function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function forEachChildInMethodSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[173 /* SyntaxKind.Constructor */] = function forEachChildInConstructor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function forEachChildInGetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function forEachChildInSetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function forEachChildInFunctionExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function forEachChildInArrowFunction(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.equalsGreaterThanToken) || + visitNode(cbNode, node.body); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.body); + }, + _a[180 /* SyntaxKind.TypeReference */] = function forEachChildInTypeReference(node, cbNode, cbNodes) { + return visitNode(cbNode, node.typeName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[179 /* SyntaxKind.TypePredicate */] = function forEachChildInTypePredicate(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertsModifier) || + visitNode(cbNode, node.parameterName) || + visitNode(cbNode, node.type); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function forEachChildInTypeQuery(node, cbNode, cbNodes) { + return visitNode(cbNode, node.exprName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function forEachChildInTypeLiteral(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.members); + }, + _a[185 /* SyntaxKind.ArrayType */] = function forEachChildInArrayType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.elementType); + }, + _a[186 /* SyntaxKind.TupleType */] = function forEachChildInTupleType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[189 /* SyntaxKind.UnionType */] = forEachChildInUnionOrIntersectionType, + _a[190 /* SyntaxKind.IntersectionType */] = forEachChildInUnionOrIntersectionType, + _a[191 /* SyntaxKind.ConditionalType */] = function forEachChildInConditionalType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.checkType) || + visitNode(cbNode, node.extendsType) || + visitNode(cbNode, node.trueType) || + visitNode(cbNode, node.falseType); + }, + _a[192 /* SyntaxKind.InferType */] = function forEachChildInInferType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.typeParameter); + }, + _a[202 /* SyntaxKind.ImportType */] = function forEachChildInImportType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.assertions) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertClause); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[195 /* SyntaxKind.TypeOperator */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[196 /* SyntaxKind.IndexedAccessType */] = function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.objectType) || + visitNode(cbNode, node.indexType); + }, + _a[197 /* SyntaxKind.MappedType */] = function forEachChildInMappedType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.readonlyToken) || + visitNode(cbNode, node.typeParameter) || + visitNode(cbNode, node.nameType) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[198 /* SyntaxKind.LiteralType */] = function forEachChildInLiteralType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.literal); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type); + }, + _a[203 /* SyntaxKind.ObjectBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.name); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.argumentExpression); + }, + _a[210 /* SyntaxKind.CallExpression */] = forEachChildInCallOrNewExpression, + _a[211 /* SyntaxKind.NewExpression */] = forEachChildInCallOrNewExpression, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.template); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function forEachChildInVoidExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function forEachChildInYieldExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + }, + _a[231 /* SyntaxKind.AsExpression */] = function forEachChildInAsExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.type); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function forEachChildInMetaProperty(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function forEachChildInSpreadElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[238 /* SyntaxKind.Block */] = forEachChildInBlock, + _a[265 /* SyntaxKind.ModuleBlock */] = forEachChildInBlock, + _a[308 /* SyntaxKind.SourceFile */] = function forEachChildInSourceFile(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function forEachChildInVariableStatement(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.declarations); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[242 /* SyntaxKind.IfStatement */] = function forEachChildInIfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + }, + _a[243 /* SyntaxKind.DoStatement */] = function forEachChildInDoStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function forEachChildInWhileStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[245 /* SyntaxKind.ForStatement */] = function forEachChildInForStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || + visitNode(cbNode, node.statement); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function forEachChildInForInStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function forEachChildInForOfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = forEachChildInContinueOrBreakStatement, + _a[249 /* SyntaxKind.BreakStatement */] = forEachChildInContinueOrBreakStatement, + _a[250 /* SyntaxKind.ReturnStatement */] = function forEachChildInReturnStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[251 /* SyntaxKind.WithStatement */] = function forEachChildInWithStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function forEachChildInCaseBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.clauses); + }, + _a[292 /* SyntaxKind.CaseClause */] = function forEachChildInCaseClause(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.statements); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function forEachChildInDefaultClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function forEachChildInThrowStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[255 /* SyntaxKind.TryStatement */] = function forEachChildInTryStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + }, + _a[295 /* SyntaxKind.CatchClause */] = function forEachChildInCatchClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); + }, + _a[167 /* SyntaxKind.Decorator */] = function forEachChildInDecorator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = forEachChildInClassDeclarationOrExpression, + _a[228 /* SyntaxKind.ClassExpression */] = forEachChildInClassDeclarationOrExpression, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[302 /* SyntaxKind.EnumMember */] = function forEachChildInEnumMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function forEachChildInImportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[270 /* SyntaxKind.ImportClause */] = function forEachChildInImportClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); + }, + _a[296 /* SyntaxKind.AssertClause */] = function forEachChildInAssertClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function forEachChildInAssertEntry(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.value); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNode(cbNode, node.name); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[272 /* SyntaxKind.NamedImports */] = forEachChildInNamedImportsOrExports, + _a[276 /* SyntaxKind.NamedExports */] = forEachChildInNamedImportsOrExports, + _a[275 /* SyntaxKind.ExportDeclaration */] = function forEachChildInExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[278 /* SyntaxKind.ExportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[274 /* SyntaxKind.ExportAssignment */] = function forEachChildInExportAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function forEachChildInTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[236 /* SyntaxKind.TemplateSpan */] = function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.literal); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.literal); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function forEachChildInHeritageClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[280 /* SyntaxKind.ExternalModuleReference */] = function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[279 /* SyntaxKind.MissingDeclaration */] = function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function forEachChildInCommaListExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[281 /* SyntaxKind.JsxElement */] = function forEachChildInJsxElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingElement) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingElement); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function forEachChildInJsxFragment(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[283 /* SyntaxKind.JsxOpeningElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[289 /* SyntaxKind.JsxAttributes */] = function forEachChildInJsxAttributes(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function forEachChildInJsxExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tagName); + }, + _a[187 /* SyntaxKind.OptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[188 /* SyntaxKind.RestType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[312 /* SyntaxKind.JSDocTypeExpression */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[318 /* SyntaxKind.JSDocNonNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[317 /* SyntaxKind.JSDocNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[319 /* SyntaxKind.JSDocOptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[321 /* SyntaxKind.JSDocVariadicType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[320 /* SyntaxKind.JSDocFunctionType */] = function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[323 /* SyntaxKind.JSDoc */] = function forEachChildInJSDoc(node, cbNode, cbNodes) { + return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + || visitNodes(cbNode, cbNodes, node.tags); + }, + _a[349 /* SyntaxKind.JSDocSeeTag */] = function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.name) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[313 /* SyntaxKind.JSDocNameReference */] = function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[314 /* SyntaxKind.JSDocMemberName */] = function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[343 /* SyntaxKind.JSDocParameterTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[350 /* SyntaxKind.JSDocPropertyTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[333 /* SyntaxKind.JSDocAuthorTag */] = function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[332 /* SyntaxKind.JSDocImplementsTag */] = function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[331 /* SyntaxKind.JSDocAugmentsTag */] = function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[347 /* SyntaxKind.JSDocTemplateTag */] = function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.constraint) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[348 /* SyntaxKind.JSDocTypedefTag */] = function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.typeExpression && + node.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ + ? visitNode(cbNode, node.typeExpression) || + visitNode(cbNode, node.fullName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + : visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); + }, + _a[341 /* SyntaxKind.JSDocCallbackTag */] = function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[344 /* SyntaxKind.JSDocReturnTag */] = forEachChildInJSDocReturnTag, + _a[346 /* SyntaxKind.JSDocTypeTag */] = forEachChildInJSDocReturnTag, + _a[345 /* SyntaxKind.JSDocThisTag */] = forEachChildInJSDocReturnTag, + _a[342 /* SyntaxKind.JSDocEnumTag */] = forEachChildInJSDocReturnTag, + _a[326 /* SyntaxKind.JSDocSignature */] = function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { + return ts.forEach(node.typeParameters, cbNode) || + ts.forEach(node.parameters, cbNode) || + visitNode(cbNode, node.type); + }, + _a[327 /* SyntaxKind.JSDocLink */] = forEachChildInJSDocLinkCodeOrPlain, + _a[328 /* SyntaxKind.JSDocLinkCode */] = forEachChildInJSDocLinkCodeOrPlain, + _a[329 /* SyntaxKind.JSDocLinkPlain */] = forEachChildInJSDocLinkCodeOrPlain, + _a[325 /* SyntaxKind.JSDocTypeLiteral */] = function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { + return ts.forEach(node.jsDocPropertyTags, cbNode); + }, + _a[330 /* SyntaxKind.JSDocTag */] = forEachChildInJSDocTag, + _a[335 /* SyntaxKind.JSDocClassTag */] = forEachChildInJSDocTag, + _a[336 /* SyntaxKind.JSDocPublicTag */] = forEachChildInJSDocTag, + _a[337 /* SyntaxKind.JSDocPrivateTag */] = forEachChildInJSDocTag, + _a[338 /* SyntaxKind.JSDocProtectedTag */] = forEachChildInJSDocTag, + _a[339 /* SyntaxKind.JSDocReadonlyTag */] = forEachChildInJSDocTag, + _a[334 /* SyntaxKind.JSDocDeprecatedTag */] = forEachChildInJSDocTag, + _a[340 /* SyntaxKind.JSDocOverrideTag */] = forEachChildInJSDocTag, + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = forEachChildInPartiallyEmittedExpression, + _a); + // shared + function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + } + function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + } + function forEachChildInParenthesizedTypeOrTypeOperator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInObjectOrArrayBindingPattern(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInCallOrNewExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + // TODO: should we separate these branches out? + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNodes(cbNode, cbNodes, node.arguments); + } + function forEachChildInBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + } + function forEachChildInContinueOrBreakStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label); + } + function forEachChildInClassDeclarationOrExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + } + function forEachChildInNamedImportsOrExports(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInImportOrExportSpecifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); + } + function forEachChildInJsxOpeningOrSelfClosingElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.attributes); + } + function forEachChildInOptionalRestOrJSDocParameterModifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInJSDocParameterOrPropertyTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.isNameFirst + ? visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression) + : visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name)) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocReturnTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + } + function forEachChildInJSDocTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) + || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + } /** * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, @@ -31150,563 +31981,11 @@ var ts; * that they appear in the source code. The language service depends on this property to locate nodes by position. */ function forEachChild(node, cbNode, cbNodes) { - if (!node || node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node === undefined || node.kind <= 162 /* SyntaxKind.LastToken */) { return; } - switch (node.kind) { - case 161 /* SyntaxKind.QualifiedName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 163 /* SyntaxKind.TypeParameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.default) || - visitNode(cbNode, node.expression); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.equalsToken) || - visitNode(cbNode, node.objectAssignmentInitializer); - case 298 /* SyntaxKind.SpreadAssignment */: - return visitNode(cbNode, node.expression); - case 164 /* SyntaxKind.Parameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 166 /* SyntaxKind.PropertySignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 296 /* SyntaxKind.PropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.initializer); - case 254 /* SyntaxKind.VariableDeclaration */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 203 /* SyntaxKind.BindingElement */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 176 /* SyntaxKind.IndexSignature */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 180 /* SyntaxKind.ConstructorType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 179 /* SyntaxKind.FunctionType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - return visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 169 /* SyntaxKind.MethodDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 168 /* SyntaxKind.MethodSignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 171 /* SyntaxKind.Constructor */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 172 /* SyntaxKind.GetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 173 /* SyntaxKind.SetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 256 /* SyntaxKind.FunctionDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 213 /* SyntaxKind.FunctionExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 214 /* SyntaxKind.ArrowFunction */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.equalsGreaterThanToken) || - visitNode(cbNode, node.body); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.body); - case 178 /* SyntaxKind.TypeReference */: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 177 /* SyntaxKind.TypePredicate */: - return visitNode(cbNode, node.assertsModifier) || - visitNode(cbNode, node.parameterName) || - visitNode(cbNode, node.type); - case 181 /* SyntaxKind.TypeQuery */: - return visitNode(cbNode, node.exprName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 182 /* SyntaxKind.TypeLiteral */: - return visitNodes(cbNode, cbNodes, node.members); - case 183 /* SyntaxKind.ArrayType */: - return visitNode(cbNode, node.elementType); - case 184 /* SyntaxKind.TupleType */: - return visitNodes(cbNode, cbNodes, node.elements); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - return visitNodes(cbNode, cbNodes, node.types); - case 189 /* SyntaxKind.ConditionalType */: - return visitNode(cbNode, node.checkType) || - visitNode(cbNode, node.extendsType) || - visitNode(cbNode, node.trueType) || - visitNode(cbNode, node.falseType); - case 190 /* SyntaxKind.InferType */: - return visitNode(cbNode, node.typeParameter); - case 200 /* SyntaxKind.ImportType */: - return visitNode(cbNode, node.argument) || - visitNode(cbNode, node.assertions) || - visitNode(cbNode, node.qualifier) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - return visitNode(cbNode, node.assertClause); - case 191 /* SyntaxKind.ParenthesizedType */: - case 193 /* SyntaxKind.TypeOperator */: - return visitNode(cbNode, node.type); - case 194 /* SyntaxKind.IndexedAccessType */: - return visitNode(cbNode, node.objectType) || - visitNode(cbNode, node.indexType); - case 195 /* SyntaxKind.MappedType */: - return visitNode(cbNode, node.readonlyToken) || - visitNode(cbNode, node.typeParameter) || - visitNode(cbNode, node.nameType) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNodes(cbNode, cbNodes, node.members); - case 196 /* SyntaxKind.LiteralType */: - return visitNode(cbNode, node.literal); - case 197 /* SyntaxKind.NamedTupleMember */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - return visitNodes(cbNode, cbNodes, node.elements); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.properties); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.name); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.argumentExpression); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNodes(cbNode, cbNodes, node.arguments); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.template); - case 211 /* SyntaxKind.TypeAssertionExpression */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); - case 212 /* SyntaxKind.ParenthesizedExpression */: - return visitNode(cbNode, node.expression); - case 215 /* SyntaxKind.DeleteExpression */: - return visitNode(cbNode, node.expression); - case 216 /* SyntaxKind.TypeOfExpression */: - return visitNode(cbNode, node.expression); - case 217 /* SyntaxKind.VoidExpression */: - return visitNode(cbNode, node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 224 /* SyntaxKind.YieldExpression */: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); - case 218 /* SyntaxKind.AwaitExpression */: - return visitNode(cbNode, node.expression); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 221 /* SyntaxKind.BinaryExpression */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); - case 229 /* SyntaxKind.AsExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.type); - case 230 /* SyntaxKind.NonNullExpression */: - return visitNode(cbNode, node.expression); - case 231 /* SyntaxKind.MetaProperty */: - return visitNode(cbNode, node.name); - case 222 /* SyntaxKind.ConditionalExpression */: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); - case 225 /* SyntaxKind.SpreadElement */: - return visitNode(cbNode, node.expression); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - return visitNodes(cbNode, cbNodes, node.statements); - case 305 /* SyntaxKind.SourceFile */: - return visitNodes(cbNode, cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); - case 237 /* SyntaxKind.VariableStatement */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); - case 255 /* SyntaxKind.VariableDeclarationList */: - return visitNodes(cbNode, cbNodes, node.declarations); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitNode(cbNode, node.expression); - case 239 /* SyntaxKind.IfStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); - case 240 /* SyntaxKind.DoStatement */: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); - case 241 /* SyntaxKind.WhileStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 242 /* SyntaxKind.ForStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || - visitNode(cbNode, node.statement); - case 243 /* SyntaxKind.ForInStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 244 /* SyntaxKind.ForOfStatement */: - return visitNode(cbNode, node.awaitModifier) || - visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return visitNode(cbNode, node.label); - case 247 /* SyntaxKind.ReturnStatement */: - return visitNode(cbNode, node.expression); - case 248 /* SyntaxKind.WithStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 249 /* SyntaxKind.SwitchStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 263 /* SyntaxKind.CaseBlock */: - return visitNodes(cbNode, cbNodes, node.clauses); - case 289 /* SyntaxKind.CaseClause */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.statements); - case 290 /* SyntaxKind.DefaultClause */: - return visitNodes(cbNode, cbNodes, node.statements); - case 250 /* SyntaxKind.LabeledStatement */: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); - case 251 /* SyntaxKind.ThrowStatement */: - return visitNode(cbNode, node.expression); - case 252 /* SyntaxKind.TryStatement */: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); - case 292 /* SyntaxKind.CatchClause */: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); - case 165 /* SyntaxKind.Decorator */: - return visitNode(cbNode, node.expression); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 258 /* SyntaxKind.InterfaceDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); - case 260 /* SyntaxKind.EnumDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.members); - case 299 /* SyntaxKind.EnumMember */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 261 /* SyntaxKind.ModuleDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 267 /* SyntaxKind.ImportClause */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); - case 293 /* SyntaxKind.AssertClause */: - return visitNodes(cbNode, cbNodes, node.elements); - case 294 /* SyntaxKind.AssertEntry */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.value); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNode(cbNode, node.name); - case 268 /* SyntaxKind.NamespaceImport */: - return visitNode(cbNode, node.name); - case 274 /* SyntaxKind.NamespaceExport */: - return visitNode(cbNode, node.name); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: - return visitNodes(cbNode, cbNodes, node.elements); - case 272 /* SyntaxKind.ExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); - case 271 /* SyntaxKind.ExportAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.expression); - case 223 /* SyntaxKind.TemplateExpression */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 233 /* SyntaxKind.TemplateSpan */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.literal); - case 198 /* SyntaxKind.TemplateLiteralType */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.literal); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitNode(cbNode, node.expression); - case 291 /* SyntaxKind.HeritageClause */: - return visitNodes(cbNode, cbNodes, node.types); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 277 /* SyntaxKind.ExternalModuleReference */: - return visitNode(cbNode, node.expression); - case 276 /* SyntaxKind.MissingDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers); - case 351 /* SyntaxKind.CommaListExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 278 /* SyntaxKind.JsxElement */: - return visitNode(cbNode, node.openingElement) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingElement); - case 282 /* SyntaxKind.JsxFragment */: - return visitNode(cbNode, node.openingFragment) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingFragment); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - return visitNode(cbNode, node.tagName) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.attributes); - case 286 /* SyntaxKind.JsxAttributes */: - return visitNodes(cbNode, cbNodes, node.properties); - case 285 /* SyntaxKind.JsxAttribute */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - return visitNode(cbNode, node.expression); - case 288 /* SyntaxKind.JsxExpression */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.expression); - case 281 /* SyntaxKind.JsxClosingElement */: - return visitNode(cbNode, node.tagName); - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - return visitNode(cbNode, node.type); - case 317 /* SyntaxKind.JSDocFunctionType */: - return visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 320 /* SyntaxKind.JSDoc */: - return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - || visitNodes(cbNode, cbNodes, node.tags); - case 346 /* SyntaxKind.JSDocSeeTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 310 /* SyntaxKind.JSDocNameReference */: - return visitNode(cbNode, node.name); - case 311 /* SyntaxKind.JSDocMemberName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - return visitNode(cbNode, node.tagName) || - (node.isNameFirst - ? visitNode(cbNode, node.name) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 330 /* SyntaxKind.JSDocAuthorTag */: - return visitNode(cbNode, node.tagName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 329 /* SyntaxKind.JSDocImplementsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 344 /* SyntaxKind.JSDocTemplateTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.constraint) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 345 /* SyntaxKind.JSDocTypedefTag */: - return visitNode(cbNode, node.tagName) || - (node.typeExpression && - node.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ - ? visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.fullName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 338 /* SyntaxKind.JSDocCallbackTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 323 /* SyntaxKind.JSDocSignature */: - return ts.forEach(node.typeParameters, cbNode) || - ts.forEach(node.parameters, cbNode) || - visitNode(cbNode, node.type); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: - return visitNode(cbNode, node.name); - case 322 /* SyntaxKind.JSDocTypeLiteral */: - return ts.forEach(node.jsDocPropertyTags, cbNode); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: - case 337 /* SyntaxKind.JSDocOverrideTag */: - return visitNode(cbNode, node.tagName) - || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - return visitNode(cbNode, node.expression); - } + var fn = forEachChildTable[node.kind]; + return fn === undefined ? undefined : fn(node, cbNode, cbNodes); } ts.forEachChild = forEachChild; /** @internal */ @@ -31753,7 +32032,7 @@ var ts; continue; return res; } - if (current.kind >= 161 /* SyntaxKind.FirstNode */) { + if (current.kind >= 163 /* SyntaxKind.FirstNode */) { // add children in reverse order to the queue, so popping gives the first child for (var _i = 0, _a = gatherPossibleChildren(current); _i < _a.length; _i++) { var child = _a[_i]; @@ -31863,13 +32142,11 @@ var ts; var scanner = ts.createScanner(99 /* ScriptTarget.Latest */, /*skipTrivia*/ true); var disallowInAndDecoratorContext = 4096 /* NodeFlags.DisallowInContext */ | 16384 /* NodeFlags.DecoratorContext */; // capture constructors in 'initializeState' to avoid null checks - // tslint:disable variable-name var NodeConstructor; var TokenConstructor; var IdentifierConstructor; var PrivateIdentifierConstructor; var SourceFileConstructor; - // tslint:enable variable-name function countNode(node) { nodeCount++; return node; @@ -32578,7 +32855,7 @@ var ts; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. - if (token() === 132 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { return false; } return token() > 116 /* SyntaxKind.LastReservedWord */; @@ -32824,7 +33101,7 @@ var ts; ts.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, "", "", /*templateFlags*/ undefined) : kind === 8 /* SyntaxKind.NumericLiteral */ ? factory.createNumericLiteral("", /*numericLiteralFlags*/ undefined) : kind === 10 /* SyntaxKind.StringLiteral */ ? factory.createStringLiteral("", /*isSingleQuote*/ undefined) : - kind === 276 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : + kind === 279 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : factory.createToken(kind); return finishNode(result, pos); } @@ -32845,8 +33122,9 @@ var ts; // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker var originalKeywordKind = token(); var text = internIdentifier(scanner.getTokenValue()); + var hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape(); nextTokenWithoutCheck(); - return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind), pos); + return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind, hasExtendedUnicodeEscape), pos); } if (token() === 80 /* SyntaxKind.PrivateIdentifier */) { parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); @@ -32923,7 +33201,7 @@ var ts; } function parsePrivateIdentifier() { var pos = getNodePos(); - var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText())); + var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue())); nextToken(); return finishNode(node, pos); } @@ -32947,15 +33225,16 @@ var ts; if (token() === 88 /* SyntaxKind.DefaultKeyword */) { return lookAhead(nextTokenCanFollowDefaultKeyword); } - if (token() === 152 /* SyntaxKind.TypeKeyword */) { + if (token() === 154 /* SyntaxKind.TypeKeyword */) { return lookAhead(nextTokenCanFollowExportModifier); } return canFollowExportModifier(); case 88 /* SyntaxKind.DefaultKeyword */: return nextTokenCanFollowDefaultKeyword(); + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: nextToken(); return canFollowModifier(); default: @@ -32964,7 +33243,7 @@ var ts; } function canFollowExportModifier() { return token() !== 41 /* SyntaxKind.AsteriskToken */ - && token() !== 127 /* SyntaxKind.AsKeyword */ + && token() !== 128 /* SyntaxKind.AsKeyword */ && token() !== 18 /* SyntaxKind.OpenBraceToken */ && canFollowModifier(); } @@ -32987,7 +33266,7 @@ var ts; return token() === 84 /* SyntaxKind.ClassKeyword */ || token() === 98 /* SyntaxKind.FunctionKeyword */ || token() === 118 /* SyntaxKind.InterfaceKeyword */ || (token() === 126 /* SyntaxKind.AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) || - (token() === 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); + (token() === 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } // True if positioned at the start of a list element function isListElement(parsingContext, inErrorRecovery) { @@ -33367,20 +33646,20 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 176 /* SyntaxKind.IndexSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 234 /* SyntaxKind.SemicolonClassElement */: + case 173 /* SyntaxKind.Constructor */: + case 178 /* SyntaxKind.IndexSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 237 /* SyntaxKind.SemicolonClassElement */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ && - methodDeclaration.name.originalKeywordKind === 134 /* SyntaxKind.ConstructorKeyword */; + methodDeclaration.name.originalKeywordKind === 135 /* SyntaxKind.ConstructorKeyword */; return !nameIsConstructor; } } @@ -33389,8 +33668,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return true; } } @@ -33399,58 +33678,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 238 /* SyntaxKind.ExpressionStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 236 /* SyntaxKind.EmptyStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 250 /* SyntaxKind.LabeledStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 174 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 176 /* SyntaxKind.CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind !== 257 /* SyntaxKind.VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -33471,7 +33750,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 164 /* SyntaxKind.Parameter */) { + if (node.kind !== 166 /* SyntaxKind.Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -33764,14 +34043,14 @@ var ts; // If true, we should abort parsing an error function. function typeHasArrowFunctionBlockingParseError(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return ts.nodeIsMissing(node.typeName); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: { + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: { var _a = node, parameters = _a.parameters, type = _a.type; return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); } - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return typeHasArrowFunctionBlockingParseError(node.type); default: return false; @@ -33850,7 +34129,7 @@ var ts; function parseJSDocType() { scanner.setInJSDocType(true); var pos = getNodePos(); - if (parseOptional(141 /* SyntaxKind.ModuleKeyword */)) { + if (parseOptional(142 /* SyntaxKind.ModuleKeyword */)) { // TODO(rbuckton): We never set the type for a JSDocNamepathType. What should we put here? var moduleTag = factory.createJSDocNamepathType(/*type*/ undefined); terminate: while (true) { @@ -34066,14 +34345,14 @@ var ts; function parseSignatureMember(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - if (kind === 175 /* SyntaxKind.ConstructSignature */) { + if (kind === 177 /* SyntaxKind.ConstructSignature */) { parseExpected(103 /* SyntaxKind.NewKeyword */); } var typeParameters = parseTypeParameters(); var parameters = parseParameters(4 /* SignatureFlags.Type */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ true); parseTypeMemberSemicolon(); - var node = kind === 174 /* SyntaxKind.CallSignature */ + var node = kind === 176 /* SyntaxKind.CallSignature */ ? factory.createCallSignature(typeParameters, parameters, type) : factory.createConstructSignature(typeParameters, parameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -34167,8 +34446,8 @@ var ts; // Return true if we have the start of a signature member if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || - token() === 136 /* SyntaxKind.GetKeyword */ || - token() === 149 /* SyntaxKind.SetKeyword */) { + token() === 137 /* SyntaxKind.GetKeyword */ || + token() === 151 /* SyntaxKind.SetKeyword */) { return true; } var idToken = false; @@ -34200,19 +34479,19 @@ var ts; } function parseTypeMember() { if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */) { - return parseSignatureMember(174 /* SyntaxKind.CallSignature */); + return parseSignatureMember(176 /* SyntaxKind.CallSignature */); } if (token() === 103 /* SyntaxKind.NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) { - return parseSignatureMember(175 /* SyntaxKind.ConstructSignature */); + return parseSignatureMember(177 /* SyntaxKind.ConstructSignature */); } var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 174 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 175 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers); @@ -34253,9 +34532,9 @@ var ts; function isStartOfMappedType() { nextToken(); if (token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { - return nextToken() === 145 /* SyntaxKind.ReadonlyKeyword */; + return nextToken() === 146 /* SyntaxKind.ReadonlyKeyword */; } - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */) { nextToken(); } return token() === 22 /* SyntaxKind.OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 101 /* SyntaxKind.InKeyword */; @@ -34271,15 +34550,15 @@ var ts; var pos = getNodePos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var readonlyToken; - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { readonlyToken = parseTokenNode(); - if (readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - parseExpected(145 /* SyntaxKind.ReadonlyKeyword */); + if (readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + parseExpected(146 /* SyntaxKind.ReadonlyKeyword */); } } parseExpected(22 /* SyntaxKind.OpenBracketToken */); var typeParameter = parseMappedTypeParameter(); - var nameType = parseOptional(127 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; + var nameType = parseOptional(128 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; parseExpected(23 /* SyntaxKind.CloseBracketToken */); var questionToken; if (token() === 57 /* SyntaxKind.QuestionToken */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { @@ -34393,7 +34672,7 @@ var ts; var openBracePosition = scanner.getTokenPos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var multiLine = scanner.hasPrecedingLineBreak(); - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); parseExpected(58 /* SyntaxKind.ColonToken */); var clause = parseAssertClause(/*skipAssertKeyword*/ true); if (!parseExpected(19 /* SyntaxKind.CloseBraceToken */)) { @@ -34426,16 +34705,16 @@ var ts; } function parseNonArrayType() { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. return tryParse(parseKeywordAndNoDot) || parseTypeReference(); case 66 /* SyntaxKind.AsteriskEqualsToken */: @@ -34468,7 +34747,7 @@ var ts; return parseTokenNode(); case 108 /* SyntaxKind.ThisKeyword */: { var thisKeyword = parseThisTypeNode(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { return parseThisTypePredicate(thisKeyword); } else { @@ -34485,7 +34764,7 @@ var ts; return parseParenthesizedType(); case 100 /* SyntaxKind.ImportKeyword */: return parseImportType(); - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference(); case 15 /* SyntaxKind.TemplateHead */: return parseTemplateType(); @@ -34495,21 +34774,21 @@ var ts; } function isStartOfType(inStartOfParameter) { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 18 /* SyntaxKind.OpenBraceToken */: case 22 /* SyntaxKind.OpenBracketToken */: case 29 /* SyntaxKind.LessThanToken */: @@ -34521,14 +34800,14 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 41 /* SyntaxKind.AsteriskToken */: case 57 /* SyntaxKind.QuestionToken */: case 53 /* SyntaxKind.ExclamationToken */: case 25 /* SyntaxKind.DotDotDotToken */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 100 /* SyntaxKind.ImportKeyword */: - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: return true; @@ -34605,17 +34884,17 @@ var ts; } function parseInferType() { var pos = getNodePos(); - parseExpected(137 /* SyntaxKind.InferKeyword */); + parseExpected(138 /* SyntaxKind.InferKeyword */); return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos); } function parseTypeOperatorOrHigher() { var operator = token(); switch (operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: return parseTypeOperator(operator); - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return parseInferType(); } return allowConditionalTypesAnd(parsePostfixTypeOrHigher); @@ -34735,16 +35014,16 @@ var ts; } function parseTypePredicatePrefix() { var id = parseIdentifier(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { nextToken(); return id; } } function parseAssertsTypePredicate() { var pos = getNodePos(); - var assertsModifier = parseExpectedToken(128 /* SyntaxKind.AssertsKeyword */); + var assertsModifier = parseExpectedToken(129 /* SyntaxKind.AssertsKeyword */); var parameterName = token() === 108 /* SyntaxKind.ThisKeyword */ ? parseThisTypeNode() : parseIdentifier(); - var type = parseOptional(139 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; + var type = parseOptional(140 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos); } function parseType() { @@ -34814,7 +35093,7 @@ var ts; case 45 /* SyntaxKind.PlusPlusToken */: case 46 /* SyntaxKind.MinusMinusToken */: case 29 /* SyntaxKind.LessThanToken */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: case 125 /* SyntaxKind.YieldKeyword */: case 80 /* SyntaxKind.PrivateIdentifier */: // Yield/await always starts an expression. Either it is an identifier (in which case @@ -35002,7 +35281,7 @@ var ts; // Unknown -> There *might* be a parenthesized arrow function here. // Speculatively look ahead to be sure, and rollback if not. function isParenthesizedArrowFunctionExpression() { - if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 132 /* SyntaxKind.AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token() === 38 /* SyntaxKind.EqualsGreaterThanToken */) { @@ -35015,7 +35294,7 @@ var ts; return 0 /* Tristate.False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0 /* Tristate.False */; @@ -35059,8 +35338,8 @@ var ts; // Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This // isn't actually allowed, but we want to treat it as a lambda so we can provide // a good error message. - if (ts.isModifierKind(second) && second !== 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { - if (nextToken() === 127 /* SyntaxKind.AsKeyword */) { + if (ts.isModifierKind(second) && second !== 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { + if (nextToken() === 128 /* SyntaxKind.AsKeyword */) { // https://github.com/microsoft/TypeScript/issues/44466 return 0 /* Tristate.False */; } @@ -35142,7 +35421,7 @@ var ts; } function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) { // We do a check here so that we won't be doing unnecessarily call to "lookAhead" - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* Tristate.True */) { var pos = getNodePos(); var asyncModifier = parseModifiersForArrowFunction(); @@ -35156,7 +35435,7 @@ var ts; // AsyncArrowFunctionExpression: // 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In] // 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In] - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); // If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function // but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher" @@ -35222,7 +35501,7 @@ var ts; // // So we need just a bit of lookahead to ensure that it can only be a signature. var unwrappedType = type; - while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 191 /* SyntaxKind.ParenthesizedType */) { + while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 193 /* SyntaxKind.ParenthesizedType */) { unwrappedType = unwrappedType.type; // Skip parens if need be } var hasJSDocFunctionType = unwrappedType && ts.isJSDocFunctionType(unwrappedType); @@ -35317,7 +35596,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand, pos); } function isInOrOfKeyword(t) { - return t === 101 /* SyntaxKind.InKeyword */ || t === 160 /* SyntaxKind.OfKeyword */; + return t === 101 /* SyntaxKind.InKeyword */ || t === 162 /* SyntaxKind.OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand, pos) { while (true) { @@ -35355,7 +35634,7 @@ var ts; if (token() === 101 /* SyntaxKind.InKeyword */ && inDisallowInContext()) { break; } - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */ || token() === 150 /* SyntaxKind.SatisfiesKeyword */) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -35365,8 +35644,10 @@ var ts; break; } else { + var keywordKind = token(); nextToken(); - leftOperand = makeAsExpression(leftOperand, parseType()); + leftOperand = keywordKind === 150 /* SyntaxKind.SatisfiesKeyword */ ? makeSatisfiesExpression(leftOperand, parseType()) : + makeAsExpression(leftOperand, parseType()); } } else { @@ -35381,6 +35662,9 @@ var ts; } return ts.getBinaryOperatorPrecedence(token()) > 0; } + function makeSatisfiesExpression(left, right) { + return finishNode(factory.createSatisfiesExpression(left, right), left.pos); + } function makeBinaryExpression(left, operatorToken, right, pos) { return finishNode(factory.createBinaryExpression(left, operatorToken, right), pos); } @@ -35404,7 +35688,7 @@ var ts; return finishNode(factory.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); } function isAwaitExpression() { - if (token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -35457,7 +35741,7 @@ var ts; if (token() === 42 /* SyntaxKind.AsteriskAsteriskToken */) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -35498,7 +35782,7 @@ var ts; // UnaryExpression (modified): // < type > UnaryExpression return parseTypeAssertion(); - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: if (isAwaitExpression()) { return parseAwaitExpression(); } @@ -35528,7 +35812,7 @@ var ts; case 89 /* SyntaxKind.DeleteKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: return false; case 29 /* SyntaxKind.LessThanToken */: // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression @@ -35711,11 +35995,11 @@ var ts; var pos = getNodePos(); var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (opening.kind === 283 /* SyntaxKind.JsxOpeningElement */) { var children = parseJsxChildren(opening); var closingElement = void 0; var lastChild = children[children.length - 1]; - if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 278 /* SyntaxKind.JsxElement */ + if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { // when an unclosed JsxOpeningElement incorrectly parses its parent's JsxClosingElement, @@ -35741,11 +36025,11 @@ var ts; } result = finishNode(factory.createJsxElement(opening, children, closingElement), pos); } - else if (opening.kind === 283 /* SyntaxKind.JsxOpeningFragment */) { + else if (opening.kind === 286 /* SyntaxKind.JsxOpeningFragment */) { result = finishNode(factory.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos); } else { - ts.Debug.assert(opening.kind === 279 /* SyntaxKind.JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 282 /* SyntaxKind.JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -35815,7 +36099,7 @@ var ts; break; list.push(child); if (ts.isJsxOpeningElement(openingTag) - && (child === null || child === void 0 ? void 0 : child.kind) === 278 /* SyntaxKind.JsxElement */ + && (child === null || child === void 0 ? void 0 : child.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { // stop after parsing a mismatched child like
...(
) in order to reattach the
higher @@ -36060,7 +36344,7 @@ var ts; } if (isTemplateStartOfTaggedTemplate()) { // Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments - expression = !questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? + expression = !questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest(pos, expression, questionDotToken, /*typeArguments*/ undefined); continue; @@ -36107,7 +36391,7 @@ var ts; } if (typeArguments || token() === 20 /* SyntaxKind.OpenParenToken */) { // Absorb type arguments into CallExpression when preceding expression is ExpressionWithTypeArguments - if (!questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (!questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36193,7 +36477,7 @@ var ts; return parseArrayLiteralExpression(); case 18 /* SyntaxKind.OpenBraceToken */: return parseObjectLiteralExpression(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. // If we encounter `async [no LineTerminator here] function` then this is an async // function; otherwise, its an identifier. @@ -36260,11 +36544,11 @@ var ts; } var decorators = parseDecorators(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); var tokenIsIdentifier = isIdentifier(); @@ -36352,7 +36636,7 @@ var ts; var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false); var typeArguments; // Absorb type arguments into NewExpression when preceding expression is ExpressionWithTypeArguments - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36456,7 +36740,7 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(97 /* SyntaxKind.ForKeyword */); - var awaitToken = parseOptionalToken(132 /* SyntaxKind.AwaitKeyword */); + var awaitToken = parseOptionalToken(133 /* SyntaxKind.AwaitKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var initializer; if (token() !== 26 /* SyntaxKind.SemicolonToken */) { @@ -36468,7 +36752,7 @@ var ts; } } var node; - if (awaitToken ? parseExpected(160 /* SyntaxKind.OfKeyword */) : parseOptional(160 /* SyntaxKind.OfKeyword */)) { + if (awaitToken ? parseExpected(162 /* SyntaxKind.OfKeyword */) : parseOptional(162 /* SyntaxKind.OfKeyword */)) { var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true); }); parseExpected(21 /* SyntaxKind.CloseParenToken */); node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement()); @@ -36495,10 +36779,10 @@ var ts; function parseBreakOrContinueStatement(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(kind === 246 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); + parseExpected(kind === 249 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); var label = canParseSemicolon() ? undefined : parseIdentifier(); parseSemicolon(); - var node = kind === 246 /* SyntaxKind.BreakStatement */ + var node = kind === 249 /* SyntaxKind.BreakStatement */ ? factory.createBreakStatement(label) : factory.createContinueStatement(label); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -36689,25 +36973,26 @@ var ts; // // could be legal, it would add complexity for very little gain. case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: nextToken(); return token() === 18 /* SyntaxKind.OpenBraceToken */ || token() === 79 /* SyntaxKind.Identifier */ || token() === 93 /* SyntaxKind.ExportKeyword */; case 100 /* SyntaxKind.ImportKeyword */: @@ -36716,12 +37001,12 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token()); case 93 /* SyntaxKind.ExportKeyword */: var currentToken_1 = nextToken(); - if (currentToken_1 === 152 /* SyntaxKind.TypeKeyword */) { + if (currentToken_1 === 154 /* SyntaxKind.TypeKeyword */) { currentToken_1 = lookAhead(nextToken); } if (currentToken_1 === 63 /* SyntaxKind.EqualsToken */ || currentToken_1 === 41 /* SyntaxKind.AsteriskToken */ || currentToken_1 === 18 /* SyntaxKind.OpenBraceToken */ || currentToken_1 === 88 /* SyntaxKind.DefaultKeyword */ || - currentToken_1 === 127 /* SyntaxKind.AsKeyword */) { + currentToken_1 === 128 /* SyntaxKind.AsKeyword */) { return true; } continue; @@ -36769,20 +37054,21 @@ var ts; case 85 /* SyntaxKind.ConstKeyword */: case 93 /* SyntaxKind.ExportKeyword */: return isStartOfDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; + case 127 /* SyntaxKind.AccessorKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -36825,9 +37111,9 @@ var ts; case 97 /* SyntaxKind.ForKeyword */: return parseForOrForInOrForOfStatement(); case 86 /* SyntaxKind.ContinueKeyword */: - return parseBreakOrContinueStatement(245 /* SyntaxKind.ContinueStatement */); + return parseBreakOrContinueStatement(248 /* SyntaxKind.ContinueStatement */); case 81 /* SyntaxKind.BreakKeyword */: - return parseBreakOrContinueStatement(246 /* SyntaxKind.BreakStatement */); + return parseBreakOrContinueStatement(249 /* SyntaxKind.BreakStatement */); case 105 /* SyntaxKind.ReturnKeyword */: return parseReturnStatement(); case 116 /* SyntaxKind.WithKeyword */: @@ -36846,12 +37132,12 @@ var ts; return parseDebuggerStatement(); case 59 /* SyntaxKind.AtToken */: return parseDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 93 /* SyntaxKind.ExportKeyword */: @@ -36860,9 +37146,10 @@ var ts; case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -36871,7 +37158,7 @@ var ts; return parseExpressionOrLabeledStatement(); } function isDeclareModifier(modifier) { - return modifier.kind === 135 /* SyntaxKind.DeclareKeyword */; + return modifier.kind === 136 /* SyntaxKind.DeclareKeyword */; } function parseDeclaration() { // `parseListElement` attempted to get the reused node at this position, @@ -36917,13 +37204,13 @@ var ts; return parseClassDeclaration(pos, hasJSDoc, decorators, modifiers); case 118 /* SyntaxKind.InterfaceKeyword */: return parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers); - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers); case 92 /* SyntaxKind.EnumKeyword */: return parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers); - case 157 /* SyntaxKind.GlobalKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers); case 100 /* SyntaxKind.ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36933,7 +37220,7 @@ var ts; case 88 /* SyntaxKind.DefaultKeyword */: case 63 /* SyntaxKind.EqualsToken */: return parseExportAssignment(pos, hasJSDoc, decorators, modifiers); - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: return parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers); default: return parseExportDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36942,7 +37229,7 @@ var ts; if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var missing = createMissingNode(276 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(279 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); missing.illegalDecorators = decorators; missing.modifiers = modifiers; @@ -37068,7 +37355,7 @@ var ts; // this context. // The checker will then give an error that there is an empty declaration list. var declarations; - if (token() === 160 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 162 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { declarations = createMissingList(); } else { @@ -37096,9 +37383,9 @@ var ts; parseExpected(98 /* SyntaxKind.FunctionKeyword */); var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); // We don't parse the name here in await context, instead we will report a grammar error in the checker. - var name = modifierFlags & 512 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); + var name = modifierFlags & 1024 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); var isGenerator = asteriskToken ? 1 /* SignatureFlags.Yield */ : 0 /* SignatureFlags.None */; - var isAsync = modifierFlags & 256 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; + var isAsync = modifierFlags & 512 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; var typeParameters = parseTypeParameters(); if (modifierFlags & 1 /* ModifierFlags.Export */) setAwaitContext(/*value*/ true); @@ -37111,8 +37398,8 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { - if (token() === 134 /* SyntaxKind.ConstructorKeyword */) { - return parseExpected(134 /* SyntaxKind.ConstructorKeyword */); + if (token() === 135 /* SyntaxKind.ConstructorKeyword */) { + return parseExpected(135 /* SyntaxKind.ConstructorKeyword */); } if (token() === 10 /* SyntaxKind.StringLiteral */ && lookAhead(nextToken) === 20 /* SyntaxKind.OpenParenToken */) { return tryParse(function () { @@ -37174,7 +37461,7 @@ var ts; var parameters = parseParameters(0 /* SignatureFlags.None */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ false); var body = parseFunctionBlockOrSemicolon(flags); - var node = kind === 172 /* SyntaxKind.GetAccessor */ + var node = kind === 174 /* SyntaxKind.GetAccessor */ ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body) : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body); // Keep track of `typeParameters` (for both) and `type` (for setters) if they were parsed those indicate grammar errors @@ -37218,7 +37505,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 149 /* SyntaxKind.SetKeyword */ || idToken === 136 /* SyntaxKind.GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 151 /* SyntaxKind.SetKeyword */ || idToken === 137 /* SyntaxKind.GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -37261,7 +37548,7 @@ var ts; return body; } function parseDecoratorExpression() { - if (inAwaitContext() && token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (inAwaitContext() && token() === 133 /* SyntaxKind.AwaitKeyword */) { // `@await` is is disallowed in an [Await] context, but can cause parsing to go off the rails // This simply parses the missing identifier and moves on. var pos = getNodePos(); @@ -37339,10 +37626,10 @@ var ts; } function parseModifiersForArrowFunction() { var modifiers; - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { var pos = getNodePos(); nextToken(); - var modifier = finishNode(factory.createToken(131 /* SyntaxKind.AsyncKeyword */), pos); + var modifier = finishNode(factory.createToken(132 /* SyntaxKind.AsyncKeyword */), pos); modifiers = createNodeArray([modifier], pos); } return modifiers; @@ -37359,13 +37646,13 @@ var ts; if (token() === 124 /* SyntaxKind.StaticKeyword */ && lookAhead(nextTokenIsOpenBrace)) { return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers); } - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } - if (token() === 134 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { + if (token() === 135 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers); if (constructorDeclaration) { return constructorDeclaration; @@ -37402,10 +37689,10 @@ var ts; return ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 226 /* SyntaxKind.ClassExpression */); + return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 228 /* SyntaxKind.ClassExpression */); } function parseClassDeclaration(pos, hasJSDoc, decorators, modifiers) { - return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 257 /* SyntaxKind.ClassDeclaration */); + return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 260 /* SyntaxKind.ClassDeclaration */); } function parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, kind) { var savedAwaitContext = inAwaitContext(); @@ -37427,7 +37714,7 @@ var ts; members = createMissingList(); } setAwaitContext(savedAwaitContext); - var node = kind === 257 /* SyntaxKind.ClassDeclaration */ + var node = kind === 260 /* SyntaxKind.ClassDeclaration */ ? factory.createClassDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members) : factory.createClassExpression(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -37464,7 +37751,7 @@ var ts; function parseExpressionWithTypeArguments() { var pos = getNodePos(); var expression = parseLeftHandSideExpressionOrHigher(); - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { return expression; } var typeArguments = tryParseTypeArguments(); @@ -37491,11 +37778,11 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(152 /* SyntaxKind.TypeKeyword */); + parseExpected(154 /* SyntaxKind.TypeKeyword */); var name = parseIdentifier(); var typeParameters = parseTypeParameters(); parseExpected(63 /* SyntaxKind.EqualsToken */); - var type = token() === 138 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); + var type = token() === 139 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); node.illegalDecorators = decorators; @@ -37554,7 +37841,7 @@ var ts; function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; var name; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // parse 'global' as name of global scope augmentation name = parseIdentifier(); flags |= 1024 /* NodeFlags.GlobalAugmentation */; @@ -37576,15 +37863,15 @@ var ts; } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } - else if (parseOptional(142 /* SyntaxKind.NamespaceKeyword */)) { + else if (parseOptional(143 /* SyntaxKind.NamespaceKeyword */)) { flags |= 16 /* NodeFlags.Namespace */; } else { - parseExpected(141 /* SyntaxKind.ModuleKeyword */); + parseExpected(142 /* SyntaxKind.ModuleKeyword */); if (token() === 10 /* SyntaxKind.StringLiteral */) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } @@ -37592,7 +37879,7 @@ var ts; return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags); } function isExternalModuleReference() { - return token() === 146 /* SyntaxKind.RequireKeyword */ && + return token() === 147 /* SyntaxKind.RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -37605,8 +37892,8 @@ var ts; return nextToken() === 43 /* SyntaxKind.SlashToken */; } function parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(127 /* SyntaxKind.AsKeyword */); - parseExpected(142 /* SyntaxKind.NamespaceKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); + parseExpected(143 /* SyntaxKind.NamespaceKeyword */); var name = parseIdentifier(); parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); @@ -37624,7 +37911,7 @@ var ts; identifier = parseIdentifier(); } var isTypeOnly = false; - if (token() !== 156 /* SyntaxKind.FromKeyword */ && + if (token() !== 158 /* SyntaxKind.FromKeyword */ && (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === "type" && (isIdentifier() || tokenAfterImportDefinitelyProducesImportDeclaration())) { isTypeOnly = true; @@ -37642,11 +37929,11 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ // import { ) { importClause = parseImportClause(identifier, afterImportPos, isTypeOnly); - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); } var moduleSpecifier = parseModuleSpecifier(); var assertClause; - if (token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -37664,7 +37951,7 @@ var ts; function parseAssertClause(skipAssertKeyword) { var pos = getNodePos(); if (!skipAssertKeyword) { - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); } var openBracePosition = scanner.getTokenPos(); if (parseExpected(18 /* SyntaxKind.OpenBraceToken */)) { @@ -37689,7 +37976,7 @@ var ts; function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() { // In `import id ___`, the current token decides whether to produce // an ImportDeclaration or ImportEqualsDeclaration. - return token() === 27 /* SyntaxKind.CommaToken */ || token() === 156 /* SyntaxKind.FromKeyword */; + return token() === 27 /* SyntaxKind.CommaToken */ || token() === 158 /* SyntaxKind.FromKeyword */; } function parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly) { parseExpected(63 /* SyntaxKind.EqualsToken */); @@ -37712,7 +37999,7 @@ var ts; var namedBindings; if (!identifier || parseOptional(27 /* SyntaxKind.CommaToken */)) { - namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(269 /* SyntaxKind.NamedImports */); + namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(272 /* SyntaxKind.NamedImports */); } return finishNode(factory.createImportClause(isTypeOnly, identifier, namedBindings), pos); } @@ -37723,7 +38010,7 @@ var ts; } function parseExternalModuleReference() { var pos = getNodePos(); - parseExpected(146 /* SyntaxKind.RequireKeyword */); + parseExpected(147 /* SyntaxKind.RequireKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var expression = parseModuleSpecifier(); parseExpected(21 /* SyntaxKind.CloseParenToken */); @@ -37747,7 +38034,7 @@ var ts; // * as ImportedBinding var pos = getNodePos(); parseExpected(41 /* SyntaxKind.AsteriskToken */); - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); var name = parseIdentifier(); return finishNode(factory.createNamespaceImport(name), pos); } @@ -37760,17 +38047,17 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - var node = kind === 269 /* SyntaxKind.NamedImports */ + var node = kind === 272 /* SyntaxKind.NamedImports */ ? factory.createNamedImports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseImportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)) : factory.createNamedExports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseExportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)); return finishNode(node, pos); } function parseExportSpecifier() { var hasJSDoc = hasPrecedingJSDocComment(); - return withJSDoc(parseImportOrExportSpecifier(275 /* SyntaxKind.ExportSpecifier */), hasJSDoc); + return withJSDoc(parseImportOrExportSpecifier(278 /* SyntaxKind.ExportSpecifier */), hasJSDoc); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(270 /* SyntaxKind.ImportSpecifier */); + return parseImportOrExportSpecifier(273 /* SyntaxKind.ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var pos = getNodePos(); @@ -37795,10 +38082,10 @@ var ts; // import { type as } from "mod"; - isTypeOnly: true, name: as // import { type as as } from "mod"; - isTypeOnly: false, name: as, propertyName: type // import { type as as as } from "mod"; - isTypeOnly: true, name: as, propertyName: as - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as ...? } var firstAs = parseIdentifierName(); - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as as ...? } var secondAs = parseIdentifierName(); if (ts.tokenIsIdentifierOrKeyword(token())) { @@ -37833,15 +38120,15 @@ var ts; name = parseNameWithKeywordCheck(); } } - if (canParseAsKeyword && token() === 127 /* SyntaxKind.AsKeyword */) { + if (canParseAsKeyword && token() === 128 /* SyntaxKind.AsKeyword */) { propertyName = name; - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); name = parseNameWithKeywordCheck(); } - if (kind === 270 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 273 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } - var node = kind === 270 /* SyntaxKind.ImportSpecifier */ + var node = kind === 273 /* SyntaxKind.ImportSpecifier */ ? factory.createImportSpecifier(isTypeOnly, propertyName, name) : factory.createExportSpecifier(isTypeOnly, propertyName, name); return finishNode(node, pos); @@ -37861,26 +38148,26 @@ var ts; var exportClause; var moduleSpecifier; var assertClause; - var isTypeOnly = parseOptional(152 /* SyntaxKind.TypeKeyword */); + var isTypeOnly = parseOptional(154 /* SyntaxKind.TypeKeyword */); var namespaceExportPos = getNodePos(); if (parseOptional(41 /* SyntaxKind.AsteriskToken */)) { - if (parseOptional(127 /* SyntaxKind.AsKeyword */)) { + if (parseOptional(128 /* SyntaxKind.AsKeyword */)) { exportClause = parseNamespaceExport(namespaceExportPos); } - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } else { - exportClause = parseNamedImportsOrExports(273 /* SyntaxKind.NamedExports */); + exportClause = parseNamedImportsOrExports(276 /* SyntaxKind.NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token() === 156 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(156 /* SyntaxKind.FromKeyword */); + if (token() === 158 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } } - if (moduleSpecifier && token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (moduleSpecifier && token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -38493,9 +38780,9 @@ var ts; } function isObjectOrObjectArrayTypeReference(node) { switch (node.kind) { - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isObjectOrObjectArrayTypeReference(node.elementType); default: return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; @@ -38527,12 +38814,12 @@ var ts; var child = void 0; var children = void 0; while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) { - if (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) { + if (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) { children = ts.append(children, child); } } if (children) { - var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */), pos); + var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */), pos); return finishNode(factory.createJSDocTypeExpression(literal), pos); } } @@ -38650,7 +38937,7 @@ var ts; var hasChildren = false; while (child = tryParse(function () { return parseChildPropertyTag(indent); })) { hasChildren = true; - if (child.kind === 343 /* SyntaxKind.JSDocTypeTag */) { + if (child.kind === 346 /* SyntaxKind.JSDocTypeTag */) { if (childTypeTag) { var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); if (lastError) { @@ -38667,7 +38954,7 @@ var ts; } } if (hasChildren) { - var isArrayType = typeExpression && typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */; + var isArrayType = typeExpression && typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */; var jsdocTypeLiteral = factory.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType); typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : @@ -38719,7 +39006,7 @@ var ts; var returnTag = tryParse(function () { if (parseOptionalJsdoc(59 /* SyntaxKind.AtToken */)) { var tag = parseTag(indent); - if (tag && tag.kind === 341 /* SyntaxKind.JSDocReturnTag */) { + if (tag && tag.kind === 344 /* SyntaxKind.JSDocReturnTag */) { return tag; } } @@ -38754,7 +39041,7 @@ var ts; case 59 /* SyntaxKind.AtToken */: if (canParseTag) { var child = tryParseChildTag(target, indent); - if (child && (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) && + if (child && (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) && target !== 4 /* PropertyLikeParse.CallbackParameter */ && name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; @@ -39724,6 +40011,7 @@ var ts; ["es2019.object", "lib.es2019.object.d.ts"], ["es2019.string", "lib.es2019.string.d.ts"], ["es2019.symbol", "lib.es2019.symbol.d.ts"], + ["es2019.intl", "lib.es2019.intl.d.ts"], ["es2020.bigint", "lib.es2020.bigint.d.ts"], ["es2020.date", "lib.es2020.date.d.ts"], ["es2020.promise", "lib.es2020.promise.d.ts"], @@ -39844,6 +40132,7 @@ var ts; shortName: "h", type: "boolean", showInSimplifiedHelpView: true, + isCommandLineOnly: true, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, defaultValueDescription: false, @@ -39852,6 +40141,8 @@ var ts; name: "help", shortName: "?", type: "boolean", + isCommandLineOnly: true, + category: ts.Diagnostics.Command_line_Options, defaultValueDescription: false, }, { @@ -41583,7 +41874,7 @@ var ts; var _a; var rootExpression = (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression; var knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : undefined; - if (rootExpression && rootExpression.kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (rootExpression && rootExpression.kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, rootExpression, ts.Diagnostics.The_root_value_of_a_0_file_must_be_an_object, ts.getBaseFileName(sourceFile.fileName) === "jsconfig.json" ? "jsconfig.json" : "tsconfig.json")); // Last-ditch error recovery. Somewhat useful because the JSON parser will recover from some parse errors by // synthesizing a top-level array literal expression. There's a reasonable chance the first element of that @@ -41623,7 +41914,7 @@ var ts; function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) { var result = returnValue ? {} : undefined; var _loop_4 = function (element) { - if (element.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (element.kind !== 299 /* SyntaxKind.PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); return "continue"; } @@ -41717,13 +42008,13 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: reportInvalidOptionValue(option && option.type !== "number"); return validateValue(Number(valueExpression.text)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (valueExpression.operator !== 40 /* SyntaxKind.MinusToken */ || valueExpression.operand.kind !== 8 /* SyntaxKind.NumericLiteral */) { break; // not valid JSON syntax } reportInvalidOptionValue(option && option.type !== "number"); return validateValue(-Number(valueExpression.operand.text)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; // Currently having element option declaration in the tsconfig with type "object" @@ -41740,7 +42031,7 @@ var ts; return validateValue(convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined, /*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined)); } - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: reportInvalidOptionValue(option && option.type !== "list"); return validateValue(convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element)); } @@ -41972,12 +42263,23 @@ var ts; } function writeConfigurations() { // Filter applicable options to place in the file - var categorizedOptions = ts.createMultiMap(); + var categorizedOptions = new ts.Map(); + // Set allowed categories in order + categorizedOptions.set(ts.Diagnostics.Projects, []); + categorizedOptions.set(ts.Diagnostics.Language_and_Environment, []); + categorizedOptions.set(ts.Diagnostics.Modules, []); + categorizedOptions.set(ts.Diagnostics.JavaScript_Support, []); + categorizedOptions.set(ts.Diagnostics.Emit, []); + categorizedOptions.set(ts.Diagnostics.Interop_Constraints, []); + categorizedOptions.set(ts.Diagnostics.Type_Checking, []); + categorizedOptions.set(ts.Diagnostics.Completeness, []); for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) { var option = optionDeclarations_1[_i]; - var category = option.category; if (isAllowedOptionForOutput(option)) { - categorizedOptions.add(ts.getLocaleSpecificMessage(category), option); + var listForCategory = categorizedOptions.get(option.category); + if (!listForCategory) + categorizedOptions.set(option.category, listForCategory = []); + listForCategory.push(option); } } // Serialize all options and their descriptions @@ -41988,7 +42290,7 @@ var ts; if (entries.length !== 0) { entries.push({ value: "" }); } - entries.push({ value: "/* ".concat(category, " */") }); + entries.push({ value: "/* ".concat(ts.getLocaleSpecificMessage(category), " */") }); for (var _i = 0, options_1 = options; _i < options_1.length; _i++) { var option = options_1[_i]; var optionName = void 0; @@ -42924,7 +43226,7 @@ var ts; function convertCompilerOptionsForTelemetry(opts) { var out = {}; for (var key in opts) { - if (opts.hasOwnProperty(key)) { + if (ts.hasProperty(opts, key)) { var type = getOptionFromName(key); if (type !== undefined) { // Ignore unknown options out[key] = getOptionValueWithEmptyStrings(opts[key], type); @@ -44030,6 +44332,9 @@ var ts; requestContainingDirectory: containingDirectory, reportDiagnostic: function (diag) { return void diagnostics.push(diag); }, }; + if (traceEnabled && ts.getEmitModuleResolutionKind(compilerOptions) >= ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) <= ts.ModuleResolutionKind.NodeNext) { + trace(host, ts.Diagnostics.Resolving_in_0_mode_with_conditions_1, features & NodeResolutionFeatures.EsmMode ? "ESM" : "CJS", conditions.map(function (c) { return "'".concat(c, "'"); }).join(", ")); + } var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); }); return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache); function tryResolve(extensions) { @@ -44619,7 +44924,7 @@ var ts; } if (mainExport) { var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false); - return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false); + return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false, "."); } } else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) { @@ -44699,7 +45004,7 @@ var ts; var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports); if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) { var target = lookupTable[moduleName]; - return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false); + return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false, moduleName); } var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys); for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) { @@ -44708,17 +45013,17 @@ var ts; var target = lookupTable[potentialTarget]; var starPos = potentialTarget.indexOf("*"); var subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos)); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget); } else if (ts.endsWith(potentialTarget, "*") && ts.startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) { var target = lookupTable[potentialTarget]; var subpath = moduleName.substring(potentialTarget.length - 1); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget); } else if (ts.startsWith(moduleName, potentialTarget)) { var target = lookupTable[potentialTarget]; var subpath = moduleName.substring(potentialTarget.length); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false, potentialTarget); } } function matchesPatternWithTrailer(target, name) { @@ -44735,7 +45040,7 @@ var ts; */ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) { return loadModuleFromTargetImportOrExport; - function loadModuleFromTargetImportOrExport(target, subpath, pattern) { + function loadModuleFromTargetImportOrExport(target, subpath, pattern, key) { if (typeof target === "string") { if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) { if (state.traceEnabled) { @@ -44746,6 +45051,8 @@ var ts; if (!ts.startsWith(target, "./")) { if (isImports && !ts.startsWith(target, "../") && !ts.startsWith(target, "/") && !ts.isRootedDiskPath(target)) { var combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath; + traceIfEnabled(state, ts.Diagnostics.Using_0_subpath_1_with_target_2, "imports", key, combinedLookup); + traceIfEnabled(state, ts.Diagnostics.Resolving_module_0_from_1, combinedLookup, scope.packageDirectory + "/"); var result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference); return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : undefined); } @@ -44772,6 +45079,9 @@ var ts; } return toSearchResult(/*value*/ undefined); } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Using_0_subpath_1_with_target_2, isImports ? "imports" : "exports", key, pattern ? target.replace(/\*/g, subpath) : target + subpath); + } var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath); var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports); if (inputLink) @@ -44781,14 +45091,18 @@ var ts; else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null if (!Array.isArray(target)) { for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) { - var key = _a[_i]; - if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) { - var subTarget = target[key]; - var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern); + var condition = _a[_i]; + if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) { + traceIfEnabled(state, ts.Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition); + var subTarget = target[condition]; + var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key); if (result) { return result; } } + else { + traceIfEnabled(state, ts.Diagnostics.Saw_non_matching_condition_0, condition); + } } return undefined; } @@ -44801,7 +45115,7 @@ var ts; } for (var _b = 0, target_2 = target; _b < target_2.length; _b++) { var elem = target_2[_b]; - var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern); + var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern, key); if (result) { return result; } @@ -44996,6 +45310,7 @@ var ts; } } function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) { + var _a; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName)); // First look for a nested package.json, as in `node_modules/foo/bar/package.json`. var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state); @@ -45010,13 +45325,7 @@ var ts; return withPackageId(packageInfo, fromDirectory); } } - var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest; var loader = function (extensions, candidate, onlyRecordFailures, state) { - var _a; - // package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them) - if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { - return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; - } var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo @@ -45029,19 +45338,24 @@ var ts; } return withPackageId(packageInfo, pathAndExtension); }; - if (rest !== "") { // If "rest" is empty, we just did this search above. - var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); - // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings. + var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest; + var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); + if (rest !== "") { + // Previous `packageInfo` may have been from a nested package.json; ensure we have the one from the package root now. packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.contents.versionPaths) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); - } - var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); - var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); - if (fromPaths) { - return fromPaths.value; - } + } + // package exports are higher priority than file/directory/typesVersions lookups and (and, if there's exports present, blocks them) + if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; + } + if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); + } + var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); + if (fromPaths) { + return fromPaths.value; } } return loader(extensions, candidate, !nodeModulesDirectoryExists, state); @@ -45217,6 +45531,15 @@ var ts; function toSearchResult(value) { return value !== undefined ? { value: value } : undefined; } + function traceIfEnabled(state, diagnostic) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + if (state.traceEnabled) { + trace.apply(void 0, __spreadArray([state.host, diagnostic], args, false)); + } + } })(ts || (ts = {})); /* @internal */ var ts; @@ -45251,26 +45574,26 @@ var ts; // A module is uninstantiated if it contains only switch (node.kind) { // 1. interface declarations, type alias declarations - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return 0 /* ModuleInstanceState.NonInstantiated */; // 2. const enum declarations - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (ts.isEnumConst(node)) { return 2 /* ModuleInstanceState.ConstEnumOnly */; } break; // 3. non-exported import declarations - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (!(ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */))) { return 0 /* ModuleInstanceState.NonInstantiated */; } break; // 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDeclaration = node; - if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 273 /* SyntaxKind.NamedExports */) { + if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 276 /* SyntaxKind.NamedExports */) { var state = 0 /* ModuleInstanceState.NonInstantiated */; for (var _i = 0, _a = exportDeclaration.exportClause.elements; _i < _a.length; _i++) { var specifier = _a[_i]; @@ -45286,7 +45609,7 @@ var ts; } break; // 5. other uninstantiated module declarations. - case 262 /* SyntaxKind.ModuleBlock */: { + case 265 /* SyntaxKind.ModuleBlock */: { var state_1 = 0 /* ModuleInstanceState.NonInstantiated */; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateCached(n, visited); @@ -45308,7 +45631,7 @@ var ts; }); return state_1; } - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(node, visited); case 79 /* SyntaxKind.Identifier */: // Only jsdoc typedef definition can exist in jsdoc namespace, and it should @@ -45509,7 +45832,7 @@ var ts; // Should not be called on a declaration with a computed property name, // unless it is a well known Symbol. function getDeclarationName(node) { - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) { return node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; } var name = ts.getNameOfDeclaration(node); @@ -45518,7 +45841,7 @@ var ts; var moduleName = ts.getTextOfIdentifierOrLiteral(name); return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"".concat(moduleName, "\"")); } - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { var nameExpression = name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteralLike(nameExpression)) { @@ -45544,36 +45867,36 @@ var ts; return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "__constructor" /* InternalSymbolName.Constructor */; - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return "__call" /* InternalSymbolName.Call */; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return "__new" /* InternalSymbolName.New */; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "__index" /* InternalSymbolName.Index */; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return "__export" /* InternalSymbolName.ExportStar */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // json file should behave as // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */) { // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* InternalSymbolName.New */ : "__call" /* InternalSymbolName.Call */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); + ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; @@ -45592,7 +45915,7 @@ var ts; */ function declareSymbol(symbolTable, parent, node, includes, excludes, isReplaceableByMethod, isComputedName) { ts.Debug.assert(isComputedName || !ts.hasDynamicName(node)); - var isDefaultExport = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; + var isDefaultExport = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; // The exported symbol for an export default function/class node is always named "default" var name = isComputedName ? "__computed" /* InternalSymbolName.Computed */ : isDefaultExport && parent ? "default" /* InternalSymbolName.Default */ @@ -45675,7 +45998,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (node.kind === 271 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { + (node.kind === 274 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; messageNeedsName_1 = false; multipleDefaultExports_1 = true; @@ -45714,7 +46037,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = !!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) || jsdocTreatAsExported(node); if (symbolFlags & 2097152 /* SymbolFlags.Alias */) { - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */ || (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */ || (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -45739,7 +46062,7 @@ var ts; if (ts.isJSDocTypeAlias(node)) ts.Debug.assert(ts.isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 64 /* NodeFlags.ExportContext */)) { - if (!container.locals || (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) && !getDeclarationName(node))) { + if (!container.locals || (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) && !getDeclarationName(node))) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default! } var exportKind = symbolFlags & 111551 /* SymbolFlags.Value */ ? 1048576 /* SymbolFlags.ExportValue */ : 0; @@ -45803,7 +46126,7 @@ var ts; // for it. We must clear this so we don't accidentally move any stale data forward from // a previous compilation. if (containerFlags & 1 /* ContainerFlags.IsContainer */) { - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -45825,10 +46148,10 @@ var ts; var saveActiveLabelList = activeLabelList; var saveHasExplicitReturn = hasExplicitReturn; var isImmediatelyInvoked = (containerFlags & 16 /* ContainerFlags.IsFunctionExpression */ && - !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Async */) && + !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Async */) && !node.asteriskToken && !!ts.getImmediatelyInvokedFunctionExpression(node)) || - node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; // A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave // similarly to break statements that exit to a label just past the statement body. if (!isImmediatelyInvoked) { @@ -45839,7 +46162,7 @@ var ts; } // We create a return control flow graph for IIFEs and constructors. For constructors // we use the return control flow graph in strict property initialization checks. - currentReturnTarget = isImmediatelyInvoked || node.kind === 171 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; + currentReturnTarget = isImmediatelyInvoked || node.kind === 173 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; currentExceptionTarget = undefined; currentBreakTarget = undefined; currentContinueTarget = undefined; @@ -45854,14 +46177,14 @@ var ts; node.flags |= 512 /* NodeFlags.HasExplicitReturn */; node.endFlowNode = currentFlow; } - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { node.flags |= emitFlags; node.endFlowNode = currentFlow; } if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); currentFlow = finishFlowLabel(currentReturnTarget); - if (node.kind === 171 /* SyntaxKind.Constructor */ || node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */))) { + if (node.kind === 173 /* SyntaxKind.Constructor */ || node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */))) { node.returnFlowNode = currentFlow; } } @@ -45888,8 +46211,8 @@ var ts; blockScopeContainer = savedBlockScopeContainer; } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -45912,59 +46235,59 @@ var ts; inAssignmentPattern = saveInAssignmentPattern; return; } - if (node.kind >= 237 /* SyntaxKind.FirstStatement */ && node.kind <= 253 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { + if (node.kind >= 240 /* SyntaxKind.FirstStatement */ && node.kind <= 256 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { node.flowNode = currentFlow; } switch (node.kind) { - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: bindWhileStatement(node); break; - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: bindDoStatement(node); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: bindForStatement(node); break; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: bindForInOrForOfStatement(node); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: bindIfStatement(node); break; - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: bindReturnOrThrow(node); break; - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: bindTryStatement(node); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: bindSwitchStatement(node); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: bindCaseBlock(node); break; - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: bindCaseClause(node); break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: bindExpressionStatement(node); break; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: bindLabeledStatement(node); break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { // Carry over whether we are in an assignment pattern to // binary expressions that could actually be an initializer @@ -45974,47 +46297,50 @@ var ts; } bindBinaryExpressionFlow(node); break; - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bindAccessExpressionFlow(node); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bindCallExpressionFlow(node); break; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: bindNonNullExpressionFlow(node); break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: bindJSDocTypeAlias(node); break; // In source files and blocks, bind functions first to match hoisting that occurs at runtime - case 305 /* SyntaxKind.SourceFile */: { + case 308 /* SyntaxKind.SourceFile */: { bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; } - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: bindEachFunctionsFirst(node.statements); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: bindBindingElementFlow(node); break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 225 /* SyntaxKind.SpreadElement */: + case 166 /* SyntaxKind.Parameter */: + bindParameterFlow(node); + break; + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 227 /* SyntaxKind.SpreadElement */: // Carry over whether we are in an assignment pattern of Object and Array literals // as well as their children that are valid assignment targets. inAssignmentPattern = saveInAssignmentPattern; @@ -46031,19 +46357,19 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: case 108 /* SyntaxKind.ThisKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return containsNarrowableReference(expr); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return hasNarrowableArgument(expr); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isNarrowingExpression(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 53 /* SyntaxKind.ExclamationToken */ && isNarrowingExpression(expr.operand); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return isNarrowingExpression(expr.expression); } return false; @@ -46067,7 +46393,7 @@ var ts; } } } - if (expr.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expr.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && containsNarrowableReference(expr.expression.expression)) { return true; } @@ -46100,9 +46426,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (expr.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: return isNarrowableOperand(expr.left); @@ -46178,26 +46504,26 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: + case 245 /* SyntaxKind.ForStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { + else if (node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { node = node.operand; } else { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */); } @@ -46243,7 +46569,7 @@ var ts; } function setContinueTarget(node, target) { var label = activeLabelList; - while (label && node.parent.kind === 250 /* SyntaxKind.LabeledStatement */) { + while (label && node.parent.kind === 253 /* SyntaxKind.LabeledStatement */) { label.continueTarget = target; label = label.next; node = node.parent; @@ -46294,12 +46620,12 @@ var ts; bind(node.expression); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.kind === 247 /* SyntaxKind.ForOfStatement */) { bind(node.awaitModifier); } addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -46321,7 +46647,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (node.kind === 250 /* SyntaxKind.ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -46338,7 +46664,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 246 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 249 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -46443,7 +46769,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 290 /* SyntaxKind.DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 293 /* SyntaxKind.DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). Note, we no longer need // this property in control flow analysis, it's there only for backwards compatibility. @@ -46491,7 +46817,7 @@ var ts; function maybeBindExpressionFlowIfCall(node) { // A top level or comma expression call expression with a dotted function name and at least one argument // is potentially an assertion and is therefore included in the control flow. - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { var call = node; if (call.expression.kind !== 106 /* SyntaxKind.SuperKeyword */ && ts.isDottedName(call.expression)) { currentFlow = createFlowCall(currentFlow, call); @@ -46517,7 +46843,7 @@ var ts; currentFlow = finishFlowLabel(postStatementLabel); } function bindDestructuringTargetFlow(node) { - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -46528,10 +46854,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowMutation(16 /* FlowFlags.Assignment */, currentFlow, node); } - else if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + else if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -46539,16 +46865,16 @@ var ts; } } } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (p.kind === 299 /* SyntaxKind.PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + else if (p.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (p.kind === 301 /* SyntaxKind.SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -46685,7 +47011,7 @@ var ts; var operator = node.operatorToken.kind; if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 209 /* SyntaxKind.ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46713,7 +47039,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -46751,24 +47077,42 @@ var ts; } } function bindBindingElementFlow(node) { - if (ts.isBindingPattern(node.name)) { - // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: - // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - bind(node.dotDotDotToken); - bind(node.propertyName); - bind(node.initializer); - bind(node.name); + // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: + // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + bind(node.dotDotDotToken); + bind(node.propertyName); + bindInitializer(node.initializer); + bind(node.name); + } + function bindParameterFlow(node) { + bindEach(node.modifiers); + bind(node.dotDotDotToken); + bind(node.questionToken); + bind(node.type); + bindInitializer(node.initializer); + bind(node.name); + } + // a BindingElement/Parameter does not have side effects if initializers are not evaluated and used. (see GH#49759) + function bindInitializer(node) { + if (!node) { + return; } - else { - bindEachChild(node); + var entryFlow = currentFlow; + bind(node); + if (entryFlow === unreachableFlow || entryFlow === currentFlow) { + return; } + var exitFlow = createBranchLabel(); + addAntecedent(exitFlow, entryFlow); + addAntecedent(exitFlow, currentFlow); + currentFlow = finishFlowLabel(exitFlow); } function bindJSDocTypeAlias(node) { bind(node.tagName); - if (node.kind !== 339 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { + if (node.kind !== 342 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { // don't bind the type name yet; that's delayed until delayedBindJSDocTypedefTag ts.setParent(node.fullName, node); ts.setParentRecursive(node.fullName, /*incremental*/ false); @@ -46780,7 +47124,7 @@ var ts; function bindJSDocClassTag(node) { bindEachChild(node); var host = ts.getHostSignatureFromJSDoc(node); - if (host && host.kind !== 169 /* SyntaxKind.MethodDeclaration */) { + if (host && host.kind !== 171 /* SyntaxKind.MethodDeclaration */) { addDeclarationToSymbol(host.symbol, host, 32 /* SymbolFlags.Class */); } } @@ -46793,15 +47137,15 @@ var ts; } function bindOptionalChainRest(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: bind(node.questionDotToken); bind(node.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bind(node.questionDotToken); bind(node.argumentExpression); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bind(node.questionDotToken); bindEach(node.typeArguments); bindEach(node.arguments); @@ -46866,7 +47210,7 @@ var ts; // an immediately invoked function expression (IIFE). Initialize the flowNode property to // the current control flow (which includes evaluation of the IIFE arguments). var expr = ts.skipParentheses(node.expression); - if (expr.kind === 213 /* SyntaxKind.FunctionExpression */ || expr.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (expr.kind === 215 /* SyntaxKind.FunctionExpression */ || expr.kind === 216 /* SyntaxKind.ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -46878,7 +47222,7 @@ var ts; } } } - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var propertyAccess = node.expression; if (ts.isIdentifier(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46887,55 +47231,55 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 286 /* SyntaxKind.JsxAttributes */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 289 /* SyntaxKind.JsxAttributes */: return 1 /* ContainerFlags.IsContainer */; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 64 /* ContainerFlags.IsInterface */; - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: - case 176 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: + case 178 /* SyntaxKind.IndexSignature */: return 1 /* ContainerFlags.IsContainer */ | 32 /* ContainerFlags.HasLocals */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 128 /* ContainerFlags.IsObjectLiteralOrClassExpressionMethodOrAccessor */; } // falls through - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 179 /* SyntaxKind.FunctionType */: - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 181 /* SyntaxKind.FunctionType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 16 /* ContainerFlags.IsFunctionExpression */; - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return 4 /* ContainerFlags.IsControlFlowContainer */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer ? 4 /* ContainerFlags.IsControlFlowContainer */ : 0; - case 292 /* SyntaxKind.CatchClause */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 263 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 266 /* SyntaxKind.CaseBlock */: return 2 /* ContainerFlags.IsBlockScopedContainer */; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -46968,46 +47312,46 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 286 /* SyntaxKind.JsxAttributes */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 289 /* SyntaxKind.JsxAttributes */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -47115,10 +47459,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -47215,7 +47559,7 @@ var ts; node.originalKeywordKind <= 125 /* SyntaxKind.LastFutureReservedWord */) { file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); } - else if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + else if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { if (ts.isExternalModule(file) && ts.isInTopLevelContext(node)) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, ts.declarationNameToString(node))); } @@ -47317,8 +47661,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 305 /* SyntaxKind.SourceFile */ && - blockScopeContainer.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && + if (blockScopeContainer.kind !== 308 /* SyntaxKind.SourceFile */ && + blockScopeContainer.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -47415,7 +47759,7 @@ var ts; // the current 'container' node when it changes. This helps us know which symbol table // a local should go into for example. Since terminal nodes are known not to have // children, as an optimization we don't process those. - if (node.kind > 160 /* SyntaxKind.LastToken */) { + if (node.kind > 162 /* SyntaxKind.LastToken */) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -47491,23 +47835,23 @@ var ts; } // falls through case 108 /* SyntaxKind.ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkContextualIdentifier(node); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: if (currentFlow && ts.isPartOfTypeQuery(node)) { node.flowNode = currentFlow; } break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: case 106 /* SyntaxKind.SuperKeyword */: node.flowNode = currentFlow; break; case 80 /* SyntaxKind.PrivateIdentifier */: return checkPrivateIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node; if (currentFlow && isNarrowableReference(expr)) { expr.flowNode = currentFlow; @@ -47522,7 +47866,7 @@ var ts; declareSymbol(file.locals, /*parent*/ undefined, expr.expression, 1 /* SymbolFlags.FunctionScopedVariable */ | 134217728 /* SymbolFlags.ModuleExports */, 111550 /* SymbolFlags.FunctionScopedVariableExcludes */); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var specialKind = ts.getAssignmentDeclarationKind(node); switch (specialKind) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -47558,78 +47902,78 @@ var ts; ts.Debug.fail("Unknown binary expression special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return checkStrictModeCatchClause(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* SyntaxKind.NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkStrictModeWithStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkStrictModeLabeledStatement(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: seenThisKeyword = true; return; - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: break; // Binding the children will handle everything - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return bindTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return bindParameter(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return bindVariableDeclarationOrBindingElement(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return bindPropertyWorker(node); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* SymbolFlags.EnumMember */, 900095 /* SymbolFlags.EnumMemberExcludes */); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* SymbolFlags.Signature */, 0 /* SymbolFlags.None */); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* SymbolFlags.Method */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), ts.isObjectLiteralMethod(node) ? 0 /* SymbolFlags.PropertyExcludes */ : 103359 /* SymbolFlags.MethodExcludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return bindFunctionDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* SymbolFlags.Constructor */, /*symbolExcludes:*/ 0 /* SymbolFlags.None */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* SymbolFlags.GetAccessor */, 46015 /* SymbolFlags.GetAccessorExcludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SymbolFlags.SetAccessor */, 78783 /* SymbolFlags.SetAccessorExcludes */); - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: + case 182 /* SyntaxKind.ConstructorType */: return bindFunctionOrConstructorType(node); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 195 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 197 /* SyntaxKind.MappedType */: return bindAnonymousTypeWorker(node); - case 332 /* SyntaxKind.JSDocClassTag */: + case 335 /* SyntaxKind.JSDocClassTag */: return bindJSDocClassTag(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return bindFunctionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: var assignmentKind = ts.getAssignmentDeclarationKind(node); switch (assignmentKind) { case 7 /* AssignmentDeclarationKind.ObjectDefinePropertyValue */: @@ -47648,70 +47992,73 @@ var ts; } break; // Members of classes, interfaces, and modules - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* SymbolFlags.Interface */, 788872 /* SymbolFlags.InterfaceExcludes */); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* SymbolFlags.TypeAlias */, 788968 /* SymbolFlags.TypeAliasExcludes */); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return bindEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return bindJsxAttributes(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return bindJsxAttribute(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); // Imports and exports - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 2097152 /* SymbolFlags.Alias */, 2097152 /* SymbolFlags.AliasExcludes */); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return bindImportClause(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return bindExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return bindExportAssignment(node); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (!ts.isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) { return; } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 340 /* SyntaxKind.JSDocParameterTag */: - if (node.parent.kind === 323 /* SyntaxKind.JSDocSignature */) { + case 343 /* SyntaxKind.JSDocParameterTag */: + if (node.parent.kind === 326 /* SyntaxKind.JSDocSignature */) { return bindParameter(node); } - if (node.parent.kind !== 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (node.parent.kind !== 325 /* SyntaxKind.JSDocTypeLiteral */) { break; } // falls through - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ ? 4 /* SymbolFlags.Property */ | 16777216 /* SymbolFlags.Optional */ : 4 /* SymbolFlags.Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* SymbolFlags.PropertyExcludes */); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return (delayedTypeAliases || (delayedTypeAliases = [])).push(node); } } function bindPropertyWorker(node) { - return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), 0 /* SymbolFlags.PropertyExcludes */); + var isAutoAccessor = ts.isAutoAccessorPropertyDeclaration(node); + var includes = isAutoAccessor ? 98304 /* SymbolFlags.Accessor */ : 4 /* SymbolFlags.Property */; + var excludes = isAutoAccessor ? 13247 /* SymbolFlags.AccessorExcludes */ : 0 /* SymbolFlags.PropertyExcludes */; + return bindPropertyOrMethodOrAccessor(node, includes | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), excludes); } function bindAnonymousTypeWorker(node) { return bindAnonymousDeclaration(node, 2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); @@ -47871,8 +48218,8 @@ var ts; } var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false); switch (thisContainer.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var constructorSymbol = thisContainer.symbol; // For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression. if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -47894,12 +48241,12 @@ var ts; addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, 32 /* SymbolFlags.Class */); } break; - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // this.foo assignment in a JavaScript class // Bind this property to the containing class var containingClass = thisContainer.parent; @@ -47911,7 +48258,7 @@ var ts; declareSymbol(symbolTable, containingClass.symbol, node, 4 /* SymbolFlags.Property */ | 67108864 /* SymbolFlags.Assignment */, 0 /* SymbolFlags.None */, /*isReplaceableByMethod*/ true); } break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script if (ts.hasDynamicName(node)) { break; @@ -47940,7 +48287,7 @@ var ts; if (node.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { bindThisPropertyAssignment(node); } - else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -47980,7 +48327,7 @@ var ts; } function bindObjectDefinePropertyAssignment(node) { var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]); - var isToplevel = node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + var isToplevel = node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false, /*containerIsClass*/ false); bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false); } @@ -48089,8 +48436,8 @@ var ts; } function isTopLevelNamespaceAssignment(propertyAccess) { return ts.isBinaryExpression(propertyAccess.parent) - ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 305 /* SyntaxKind.SourceFile */ - : propertyAccess.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 308 /* SyntaxKind.SourceFile */ + : propertyAccess.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; } function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) { var namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer); @@ -48169,7 +48516,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 257 /* SyntaxKind.ClassDeclaration */) { + if (node.kind === 260 /* SyntaxKind.ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* SymbolFlags.Class */, 899503 /* SymbolFlags.ClassExcludes */); } else { @@ -48211,7 +48558,7 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } if (!ts.isBindingPattern(node.name)) { - var possibleVariableDecl = node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; + var possibleVariableDecl = node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !ts.getJSDocTypeTag(node) && @@ -48239,7 +48586,7 @@ var ts; } } function bindParameter(node) { - if (node.kind === 340 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 323 /* SyntaxKind.JSDocSignature */) { + if (node.kind === 343 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 326 /* SyntaxKind.JSDocSignature */) { return; } if (inStrictMode && !(node.flags & 16777216 /* NodeFlags.Ambient */)) { @@ -48316,7 +48663,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 262144 /* SymbolFlags.TypeParameter */, 526824 /* SymbolFlags.TypeParameterExcludes */); } } - else if (node.parent.kind === 190 /* SyntaxKind.InferType */) { + else if (node.parent.kind === 192 /* SyntaxKind.InferType */) { var container_2 = getInferTypeContainer(node.parent); if (container_2) { if (!container_2.locals) { @@ -48344,11 +48691,11 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 236 /* SyntaxKind.EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 239 /* SyntaxKind.EmptyStatement */) || // report error on class declarations - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); + (node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); if (reportError) { currentFlow = reportedUnreachableFlow; if (!options.allowUnreachableCode) { @@ -48392,12 +48739,12 @@ var ts; } function isPurelyTypeDeclaration(s) { switch (s.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(s) !== 1 /* ModuleInstanceState.Instantiated */; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.hasSyntacticModifier(s, 2048 /* ModifierFlags.Const */); default: return false; @@ -48598,7 +48945,7 @@ var ts; // (their type resolved directly to the member deeply referenced) // So to get the intervening symbols, we need to check if there's a type // query node on any of the symbol's declarations and get symbols there - if (d.type && d.type.kind === 181 /* SyntaxKind.TypeQuery */) { + if (d.type && d.type.kind === 183 /* SyntaxKind.TypeQuery */) { var query = d.type; var entity = getResolvedSymbol(getFirstIdentifier(query.exprName)); visitSymbol(entity); @@ -48784,8 +49131,6 @@ var ts; IntersectionState[IntersectionState["None"] = 0] = "None"; IntersectionState[IntersectionState["Source"] = 1] = "Source"; IntersectionState[IntersectionState["Target"] = 2] = "Target"; - IntersectionState[IntersectionState["PropertyCheck"] = 4] = "PropertyCheck"; - IntersectionState[IntersectionState["InPropertyCheck"] = 8] = "InPropertyCheck"; })(IntersectionState || (IntersectionState = {})); var RecursionFlags; (function (RecursionFlags) { @@ -49009,6 +49354,7 @@ var ts; getTypeOfPropertyOfType: function (type, name) { return getTypeOfPropertyOfType(type, ts.escapeLeadingUnderscores(name)); }, getIndexInfoOfType: function (type, kind) { return getIndexInfoOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexInfosOfType: getIndexInfosOfType, + getIndexInfosOfIndexSymbol: getIndexInfosOfIndexSymbol, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: function (type, kind) { return getIndexTypeOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexType: function (type) { return getIndexType(type); }, @@ -49034,6 +49380,7 @@ var ts; signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, symbolToEntityName: nodeBuilder.symbolToEntityName, symbolToExpression: nodeBuilder.symbolToExpression, + symbolToNode: nodeBuilder.symbolToNode, symbolToTypeParameterDeclarations: nodeBuilder.symbolToTypeParameterDeclarations, symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration, typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration, @@ -49202,6 +49549,12 @@ var ts; getOptionalType: function () { return optionalType; }, getPromiseType: function () { return getGlobalPromiseType(/*reportErrors*/ false); }, getPromiseLikeType: function () { return getGlobalPromiseLikeType(/*reportErrors*/ false); }, + getAsyncIterableType: function () { + var type = getGlobalAsyncIterableType(/*reportErrors*/ false); + if (type === emptyGenericType) + return undefined; + return type; + }, isSymbolAccessible: isSymbolAccessible, isArrayType: isArrayType, isTupleType: isTupleType, @@ -49282,6 +49635,7 @@ var ts; isPropertyAccessible: isPropertyAccessible, getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration, getMemberOverrideModifierStatus: getMemberOverrideModifierStatus, + isTypeParameterPossiblyReferenced: isTypeParameterPossiblyReferenced, }; function runWithInferenceBlockedFromSourceNode(node, fn) { var containingCall = ts.findAncestor(node, ts.isCallLikeExpression); @@ -49401,7 +49755,8 @@ var ts; var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); emptyTypeLiteralSymbol.members = ts.createSymbolTable(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); - var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType; + var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); + var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType; var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); emptyGenericType.instantiations = new ts.Map(); var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); @@ -49515,6 +49870,8 @@ var ts; var deferredGlobalOmitSymbol; var deferredGlobalAwaitedSymbol; var deferredGlobalBigIntType; + var deferredGlobalNaNSymbol; + var deferredGlobalRecordSymbol; var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name var flowLoopStart = 0; var flowLoopCount = 0; @@ -49704,10 +50061,10 @@ var ts; } // Issue errors globally var file = ts.getSourceFileOfNode(location); - addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line local/no-in-operator return; } - addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line local/no-in-operator } function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) { var diagnostic = error(location, message, arg0, arg1, arg2, arg3); @@ -49936,7 +50293,7 @@ var ts; if (unidirectional === void 0) { unidirectional = false; } source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); - target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol); + target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol)); }); } function mergeModuleAugmentation(moduleName) { @@ -50024,7 +50381,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks()); } function isGlobalSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -50035,9 +50392,9 @@ var ts; return symbol; } if (symbol.flags & 2097152 /* SymbolFlags.Alias */) { - var target = resolveAlias(symbol); - // Unknown symbol means an error occurred in alias resolution, treat it as positive answer to avoid cascading errors - if (target === unknownSymbol || target.flags & meaning) { + var targetFlags = getAllSymbolFlags(symbol); + // `targetFlags` will be `SymbolFlags.All` if an error occurred in alias resolution; this avoids cascading errors + if (targetFlags & meaning) { return symbol; } } @@ -50083,17 +50440,17 @@ var ts; } if (declaration.pos <= usage.pos && !(ts.isPropertyDeclaration(declaration) && ts.isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) { // declaration is before usage - if (declaration.kind === 203 /* SyntaxKind.BindingElement */) { + if (declaration.kind === 205 /* SyntaxKind.BindingElement */) { // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) - var errorBindingElement = ts.getAncestor(usage, 203 /* SyntaxKind.BindingElement */); + var errorBindingElement = ts.getAncestor(usage, 205 /* SyntaxKind.BindingElement */); if (errorBindingElement) { return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || declaration.pos < errorBindingElement.pos; } // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 254 /* SyntaxKind.VariableDeclaration */), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 257 /* SyntaxKind.VariableDeclaration */), usage); } - else if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { + else if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } @@ -50123,12 +50480,12 @@ var ts; // or if usage is in a type context: // 1. inside a type query (typeof in type position) // 2. inside a jsdoc comment - if (usage.parent.kind === 275 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { + if (usage.parent.kind === 278 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { // export specifiers do not use the variable, they only make it available for use return true; } // When resolving symbols for exports, the `usage` location passed in can be the export site directly - if (usage.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { + if (usage.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { return true; } if (!!(usage.flags & 8388608 /* NodeFlags.JSDoc */) || isInTypeQuery(usage) || usageInTypeDeclaration()) { @@ -50150,9 +50507,9 @@ var ts; } function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { switch (declaration.parent.parent.kind) { - case 237 /* SyntaxKind.VariableStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 240 /* SyntaxKind.VariableStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, declContainer)) { @@ -50180,7 +50537,7 @@ var ts; var initializerOfProperty = propertyDeclaration.initializer === current; if (initializerOfProperty) { if (ts.isStatic(current.parent)) { - if (declaration.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (declaration.kind === 171 /* SyntaxKind.MethodDeclaration */) { return true; } if (ts.isPropertyDeclaration(declaration) && ts.getContainingClass(usage) === ts.getContainingClass(declaration)) { @@ -50195,7 +50552,7 @@ var ts; } } else { - var isDeclarationInstanceProperty = declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); + var isDeclarationInstanceProperty = declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { return true; } @@ -50218,19 +50575,19 @@ var ts; return "quit"; } switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // even when stopping at any property declaration, they need to come from the same class return stopAtAnyPropertyDeclaration && (ts.isPropertyDeclaration(declaration) && node.parent === declaration.parent || ts.isParameterPropertyDeclaration(declaration, declaration.parent) && node.parent === declaration.parent.parent) ? "quit" : true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; @@ -50270,18 +50627,18 @@ var ts; } function requiresScopeChangeWorker(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: // do not descend into these return false; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: return requiresScopeChangeWorker(node.name); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // static properties in classes introduce temporary variables if (ts.hasStaticModifier(node)) { return target < 99 /* ScriptTarget.ESNext */ || !useDefineForClassFields; @@ -50310,12 +50667,13 @@ var ts; * the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with * the given name can be found. * + * @param nameNotFoundMessage If defined, we will report errors found during resolve. * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters. */ - function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) { + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) { if (excludeGlobals === void 0) { excludeGlobals = false; } - if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; } - return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol); + if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; } + return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol); } function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) { var _a, _b, _c; @@ -50346,14 +50704,14 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 320 /* SyntaxKind.JSDoc */) { + if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 323 /* SyntaxKind.JSDoc */) { useResult = result.flags & 262144 /* SymbolFlags.TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || - lastLocation.kind === 340 /* SyntaxKind.JSDocParameterTag */ || - lastLocation.kind === 341 /* SyntaxKind.JSDocReturnTag */ || - lastLocation.kind === 163 /* SyntaxKind.TypeParameter */ + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || + lastLocation.kind === 343 /* SyntaxKind.JSDocParameterTag */ || + lastLocation.kind === 344 /* SyntaxKind.JSDocReturnTag */ || + lastLocation.kind === 165 /* SyntaxKind.TypeParameter */ // local types not visible outside the function body : false; } @@ -50368,13 +50726,13 @@ var ts; // however it is detected separately when checking initializers of parameters // to make sure that they reference no variables declared after them. useResult = - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || (lastLocation === location.type && !!ts.findAncestor(result.valueDeclaration, ts.isParameter)); } } } - else if (location.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (location.kind === 191 /* SyntaxKind.ConditionalType */) { // A type parameter declared using 'infer T' in a conditional type is visible only in // the true branch of the conditional type. useResult = lastLocation === location.trueType; @@ -50389,14 +50747,14 @@ var ts; } withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation); switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols; - if (location.kind === 305 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { + if (location.kind === 308 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports.get("default" /* InternalSymbolName.Default */)) { @@ -50420,7 +50778,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 /* SymbolFlags.Alias */ && - (ts.getDeclarationOfKind(moduleExport, 275 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 274 /* SyntaxKind.NamespaceExport */))) { + (ts.getDeclarationOfKind(moduleExport, 278 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 277 /* SyntaxKind.NamespaceExport */))) { break; } } @@ -50434,12 +50792,12 @@ var ts; } } break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (result = lookup(((_c = getSymbolOfNode(location)) === null || _c === void 0 ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* SymbolFlags.EnumMember */)) { break loop; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or @@ -50457,9 +50815,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals // These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would // trigger resolving late-bound names, which we may already be in the process of doing while we're here! @@ -50473,12 +50831,14 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type // parameter list is associated, with the exception of static member declarations in classes. - error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + } return undefined; } break loop; } - if (location.kind === 226 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { + if (location.kind === 228 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -50486,7 +50846,7 @@ var ts; } } break; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // The type parameters of a class are not in scope in the base class expression. if (lastLocation === location.expression && location.parent.token === 94 /* SyntaxKind.ExtendsKeyword */) { var container = location.parent.parent; @@ -50506,34 +50866,36 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) { - error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + } return undefined; } } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // when targeting ES6 or higher there is no 'arguments' in an arrow function // for lower compile targets the resolved symbol is used to emit an error if (ts.getEmitScriptTarget(compilerOptions) >= 2 /* ScriptTarget.ES2015 */) { break; } // falls through - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -50546,7 +50908,7 @@ var ts; } } break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -50555,7 +50917,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 164 /* SyntaxKind.Parameter */) { + if (location.parent && location.parent.kind === 166 /* SyntaxKind.Parameter */) { location = location.parent; } // @@ -50570,20 +50932,20 @@ var ts; // declare function y(x: T): any; // @param(1 as T) // <-- T should resolve to the type alias outside of class C // class C {} - if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 257 /* SyntaxKind.ClassDeclaration */)) { + if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 260 /* SyntaxKind.ClassDeclaration */)) { location = location.parent; } break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // js type aliases do not resolve names from their host, so skip past it var root = ts.getJSDocRoot(location); if (root) { location = root.parent; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (!associatedDeclarationForContainingInitializerOrBindingName) { @@ -50591,7 +50953,7 @@ var ts; } } break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (ts.isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) { @@ -50599,7 +50961,7 @@ var ts; } } break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: if (meaning & 262144 /* SymbolFlags.TypeParameter */) { var parameterName = location.typeParameter.name; if (parameterName && name === parameterName.escapedText) { @@ -50625,7 +50987,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(lastLocation.kind === 308 /* SyntaxKind.SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) { return lastLocation.symbol; } @@ -50665,8 +51027,8 @@ var ts; !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && + !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && - !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) { var suggestion = void 0; var suggestedLib = void 0; @@ -50707,7 +51069,7 @@ var ts; } return undefined; } - else if (checkAndReportErrorForInvalidInitializer()) { + else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) { return undefined; } // Perform extra checks only if error reporting was requested @@ -50753,9 +51115,9 @@ var ts; } } if (result && errorLocation && meaning & 111551 /* SymbolFlags.Value */ && result.flags & 2097152 /* SymbolFlags.Alias */ && !(result.flags & 111551 /* SymbolFlags.Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) { - var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result); + var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* SymbolFlags.Value */); if (typeOnlyDeclaration) { - var message = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ + var message = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; var unescapedName = ts.unescapeLeadingUnderscores(name); @@ -50769,31 +51131,31 @@ var ts; function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) { if (!typeOnlyDeclaration) return diagnostic; - return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); + return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); } function getIsDeferredContext(location, lastLocation) { - if (location.kind !== 214 /* SyntaxKind.ArrowFunction */ && location.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (location.kind !== 216 /* SyntaxKind.ArrowFunction */ && location.kind !== 215 /* SyntaxKind.FunctionExpression */) { // initializers in instance property declaration of class like entities are executed in constructor and thus deferred return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) || - (location.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred + (location.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred } if (lastLocation && lastLocation === location.name) { return false; } // generator functions and async functions are not inlined in control flow when immediately invoked - if (location.asteriskToken || ts.hasSyntacticModifier(location, 256 /* ModifierFlags.Async */)) { + if (location.asteriskToken || ts.hasSyntacticModifier(location, 512 /* ModifierFlags.Async */)) { return true; } return !ts.getImmediatelyInvokedFunctionExpression(location); } function isSelfReferenceLocation(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -50806,7 +51168,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - if (decl.kind === 163 /* SyntaxKind.TypeParameter */) { + if (decl.kind === 165 /* SyntaxKind.TypeParameter */) { var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent; if (parent === container) { return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); @@ -50863,9 +51225,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -50909,14 +51271,14 @@ var ts; return name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never" || name === "unknown"; } function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) { - if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { error(errorLocation, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name); return true; } return false; } function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) { - if (meaning & (111551 /* SymbolFlags.Value */ & ~1024 /* SymbolFlags.NamespaceModule */)) { + if (meaning & 111551 /* SymbolFlags.Value */) { if (isPrimitiveTypeName(name)) { if (isExtendedByInterface(errorLocation)) { error(errorLocation, ts.Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, ts.unescapeLeadingUnderscores(name)); @@ -50927,7 +51289,8 @@ var ts; return true; } var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); - if (symbol && !(symbol.flags & 1024 /* SymbolFlags.NamespaceModule */)) { + var allFlags = symbol && getAllSymbolFlags(symbol); + if (symbol && allFlags !== undefined && !(allFlags & 111551 /* SymbolFlags.Value */)) { var rawName = ts.unescapeLeadingUnderscores(name); if (isES2015OrLaterConstructorName(name)) { error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later, rawName); @@ -50975,16 +51338,16 @@ var ts; } return false; } - function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) { - if (meaning & (111551 /* SymbolFlags.Value */ & ~1024 /* SymbolFlags.NamespaceModule */ & ~788968 /* SymbolFlags.Type */)) { - var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); + function checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) { + if (meaning & (111551 /* SymbolFlags.Value */ & ~788968 /* SymbolFlags.Type */)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); if (symbol) { error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name)); return true; } } - else if (meaning & (788968 /* SymbolFlags.Type */ & ~1024 /* SymbolFlags.NamespaceModule */ & ~111551 /* SymbolFlags.Value */)) { - var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* SymbolFlags.ValueModule */ | 1024 /* SymbolFlags.NamespaceModule */) & ~788968 /* SymbolFlags.Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); + else if (meaning & (788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1536 /* SymbolFlags.Module */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); if (symbol) { error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name)); return true; @@ -51000,7 +51363,7 @@ var ts; return; } // Block-scoped variables cannot be used before their definition - var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 260 /* SyntaxKind.EnumDeclaration */); }); + var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 263 /* SyntaxKind.EnumDeclaration */); }); if (declaration === undefined) return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration"); if (!(declaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { @@ -51037,13 +51400,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return node.parent; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; default: return undefined; @@ -51068,24 +51431,24 @@ var ts; * const { x } = require ... */ function isAliasSymbolDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name - || node.kind === 268 /* SyntaxKind.NamespaceImport */ - || node.kind === 274 /* SyntaxKind.NamespaceExport */ - || node.kind === 270 /* SyntaxKind.ImportSpecifier */ - || node.kind === 275 /* SyntaxKind.ExportSpecifier */ - || node.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name + || node.kind === 271 /* SyntaxKind.NamespaceImport */ + || node.kind === 277 /* SyntaxKind.NamespaceExport */ + || node.kind === 273 /* SyntaxKind.ImportSpecifier */ + || node.kind === 278 /* SyntaxKind.ExportSpecifier */ + || node.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) || ts.isBinaryExpression(node) && ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && ts.exportAssignmentIsAlias(node) || ts.isAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && isAliasableOrJsExpression(node.parent.right) - || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || node.kind === 296 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) - || node.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) - || node.kind === 203 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); + || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || node.kind === 299 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) + || node.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) + || node.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } function isAliasableOrJsExpression(e) { return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e); @@ -51098,7 +51461,7 @@ var ts; ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : undefined; } - if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { var immediate = resolveExternalModuleName(node, ts.getExternalModuleRequireArgument(node) || ts.getExternalModuleImportEqualsDeclarationExpression(node)); var resolved_4 = resolveExternalModuleSymbol(immediate); markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved_4, /*overwriteEmpty*/ false); @@ -51111,7 +51474,7 @@ var ts; function checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved) { if (markSymbolOfAliasDeclarationIfTypeOnly(node, /*immediateTarget*/ undefined, resolved, /*overwriteEmpty*/ false) && !node.isTypeOnly) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfNode(node)); - var isExport = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */; + var isExport = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */; var message = isExport ? ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type; @@ -51130,7 +51493,7 @@ var ts; return resolved; } function isSyntacticDefault(node) { - return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); + return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); } function getUsageModeForExpression(usage) { return ts.isStringLiteralLike(usage) ? ts.getModeForUsageLocation(ts.getSourceFileOfNode(usage), usage) : undefined; @@ -51230,11 +51593,11 @@ var ts; } function getModuleSpecifierForImportOrExport(node) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; - case 268 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; - case 270 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; - case 275 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; + case 270 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; + case 278 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; default: return ts.Debug.assertNever(node); } } @@ -51503,31 +51866,31 @@ var ts; function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; } switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return getTargetOfNamespaceExport(node, dontRecursivelyResolve); - case 270 /* SyntaxKind.ImportSpecifier */: - case 203 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return getTargetOfExportSpecifier(node, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, dontRecursivelyResolve); - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return resolveEntityName(node.name, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ true, dontRecursivelyResolve); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return getTargetOfAccessExpression(node, dontRecursivelyResolve); default: return ts.Debug.fail(); @@ -51574,6 +51937,52 @@ var ts; } return undefined; } + /** + * Gets combined flags of a `symbol` and all alias targets it resolves to. `resolveAlias` + * is typically recursive over chains of aliases, but stops mid-chain if an alias is merged + * with another exported symbol, e.g. + * ```ts + * // a.ts + * export const a = 0; + * // b.ts + * export { a } from "./a"; + * export type a = number; + * // c.ts + * import { a } from "./b"; + * ``` + * Calling `resolveAlias` on the `a` in c.ts would stop at the merged symbol exported + * from b.ts, even though there is still more alias to resolve. Consequently, if we were + * trying to determine if the `a` in c.ts has a value meaning, looking at the flags on + * the local symbol and on the symbol returned by `resolveAlias` is not enough. + * @returns SymbolFlags.All if `symbol` is an alias that ultimately resolves to `unknown`; + * combined flags of all alias targets otherwise. + */ + function getAllSymbolFlags(symbol) { + var flags = symbol.flags; + var seenSymbols; + while (symbol.flags & 2097152 /* SymbolFlags.Alias */) { + var target = resolveAlias(symbol); + if (target === unknownSymbol) { + return 67108863 /* SymbolFlags.All */; + } + // Optimizations - try to avoid creating or adding to + // `seenSymbols` if possible + if (target === symbol || (seenSymbols === null || seenSymbols === void 0 ? void 0 : seenSymbols.has(target))) { + break; + } + if (target.flags & 2097152 /* SymbolFlags.Alias */) { + if (seenSymbols) { + seenSymbols.add(target); + } + else { + seenSymbols = new ts.Set([symbol, target]); + } + } + flags |= target.flags; + symbol = target; + } + return flags; + } /** * Marks a symbol as type-only if its declaration is syntactically type-only. * If it is not itself marked type-only, but resolves to a type-only alias @@ -51619,19 +52028,25 @@ var ts; return !!aliasDeclarationLinks.typeOnlyDeclaration; } /** Indicates that a symbol directly or indirectly resolves to a type-only import or export. */ - function getTypeOnlyAliasDeclaration(symbol) { + function getTypeOnlyAliasDeclaration(symbol, include) { if (!(symbol.flags & 2097152 /* SymbolFlags.Alias */)) { return undefined; } var links = getSymbolLinks(symbol); - return links.typeOnlyDeclaration || undefined; + if (include === undefined) { + return links.typeOnlyDeclaration || undefined; + } + if (links.typeOnlyDeclaration) { + return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : undefined; + } + return undefined; } function markExportAsReferenced(node) { var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target) { var markAlias = target === unknownSymbol || - ((target.flags & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol)); + ((getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)); if (markAlias) { markAliasSymbolAsReferenced(symbol); } @@ -51651,8 +52066,7 @@ var ts; // This way a chain of imports can be elided if ultimately the final input is only used in a type // position. if (ts.isInternalModuleImportEqualsDeclaration(node)) { - var target = resolveSymbol(symbol); - if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(resolveSymbol(symbol)) & 111551 /* SymbolFlags.Value */) { // import foo = checkExpressionCached(node.moduleReference); } @@ -51679,18 +52093,18 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 163 /* SyntaxKind.QualifiedName */) { return resolveEntityName(entityName, 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */); return resolveEntityName(entityName, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } function getFullyQualifiedName(symbol, containingLocation) { - return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); } function getContainingQualifiedNameNode(node) { while (ts.isQualifiedName(node.parent)) { @@ -51731,9 +52145,9 @@ var ts; return getMergedSymbol(symbolFromJSPrototype); } } - else if (name.kind === 161 /* SyntaxKind.QualifiedName */ || name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - var left = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; - var right = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : name.name; + else if (name.kind === 163 /* SyntaxKind.QualifiedName */ || name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + var left = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; + var right = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -51791,7 +52205,7 @@ var ts; throw ts.Debug.assertNever(name, "Unknown entity name kind."); } ts.Debug.assert((ts.getCheckFlags(symbol) & 1 /* CheckFlags.Instantiated */) === 0, "Should never get an instantiated symbol here."); - if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 271 /* SyntaxKind.ExportAssignment */)) { + if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 274 /* SyntaxKind.ExportAssignment */)) { markSymbolOfAliasDeclarationIfTypeOnly(ts.getAliasDeclarationFromName(name), symbol, /*finalTarget*/ undefined, /*overwriteEmpty*/ true); } return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); @@ -52114,7 +52528,7 @@ var ts; var _a; var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { - if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */)) { + if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */)) { var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop"; @@ -52474,13 +52888,13 @@ var ts; } function symbolIsValue(symbol, includeTypeOnlyMembers) { return !!(symbol.flags & 111551 /* SymbolFlags.Value */ || - symbol.flags & 2097152 /* SymbolFlags.Alias */ && resolveAlias(symbol).flags & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol))); + symbol.flags & 2097152 /* SymbolFlags.Alias */ && getAllSymbolFlags(symbol) & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol))); } function findConstructorDeclaration(node) { var members = node.members; for (var _i = 0, members_3 = members; _i < members_3.length; _i++) { var member = members_3[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -52588,12 +53002,12 @@ var ts; } } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var sym = getSymbolOfNode(location); // `sym` may not have exports if this module declaration is backed by the symbol for a `const` that's being rewritten // into a namespace - in such cases, it's best to just let the namespace appear empty (the const members couldn't have referred @@ -52602,9 +53016,9 @@ var ts; return { value: result }; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // Type parameters are bound into `members` lists so they can merge across declarations // This is troublesome, since in all other respects, they behave like locals :cries: // TODO: the below is shared with similar code in `resolveName` - in fact, rephrasing all this symbol @@ -52699,7 +53113,7 @@ var ts; && (isLocalNameLookup ? !ts.some(symbolFromSymbolTable.declarations, ts.isNamespaceReexportDeclaration) : true) // While exports are generally considered to be in scope, export-specifier declared symbols are _not_ // See similar comment in `resolveName` for details - && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */))) { + && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */))) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); var candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification); if (candidate) { @@ -52743,8 +53157,10 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; - if (symbolFromSymbolTable.flags & meaning) { + var shouldResolveAlias = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */)); + symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + var flags = shouldResolveAlias ? getAllSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags; + if (flags & meaning) { qualify = true; return true; } @@ -52758,10 +53174,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: continue; default: return false; @@ -52891,10 +53307,10 @@ var ts; return node && getSymbolOfNode(node); } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { - return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -52962,14 +53378,14 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 181 /* SyntaxKind.TypeQuery */ || - entityName.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || - entityName.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (entityName.parent.kind === 183 /* SyntaxKind.TypeQuery */ || + entityName.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || + entityName.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Typeof value meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } - else if (entityName.kind === 161 /* SyntaxKind.QualifiedName */ || entityName.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (entityName.kind === 163 /* SyntaxKind.QualifiedName */ || entityName.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* SymbolFlags.Namespace */; @@ -53005,15 +53421,18 @@ var ts; if (flags & 8 /* SymbolFormatFlags.UseAliasDefinedOutsideCurrentScope */) { nodeFlags |= 16384 /* NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope */; } - if (flags & 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { + if (flags & 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { nodeFlags |= 134217728 /* NodeBuilderFlags.DoNotIncludeSymbolChain */; } - var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToExpression : nodeBuilder.symbolToEntityName; + if (flags & 16 /* SymbolFormatFlags.WriteComputedProps */) { + nodeFlags |= 1073741824 /* NodeBuilderFlags.WriteComputedProps */; + } + var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName; return writer ? symbolToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(symbolToStringWorker); function symbolToStringWorker(writer) { var entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags); // TODO: GH#18217 // add neverAsciiEscape for GH#39027 - var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 305 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); + var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 308 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); printer.writeNode(4 /* EmitHint.Unspecified */, entity, /*sourceFile*/ sourceFile, writer); return writer; @@ -53025,10 +53444,10 @@ var ts; function signatureToStringWorker(writer) { var sigOutput; if (flags & 262144 /* TypeFormatFlags.WriteArrowStyleSignature */) { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 180 /* SyntaxKind.ConstructorType */ : 179 /* SyntaxKind.FunctionType */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 182 /* SyntaxKind.ConstructorType */ : 181 /* SyntaxKind.FunctionType */; } else { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 175 /* SyntaxKind.ConstructSignature */ : 174 /* SyntaxKind.CallSignature */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 177 /* SyntaxKind.ConstructSignature */ : 176 /* SyntaxKind.CallSignature */; } var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */); var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true }); @@ -53108,7 +53527,25 @@ var ts; symbolTableToDeclarationStatements: function (symbolTable, enclosingDeclaration, flags, tracker, bundled) { return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolTableToDeclarationStatements(symbolTable, context, bundled); }); }, + symbolToNode: function (symbol, meaning, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolToNode(symbol, context, meaning); }); + }, }; + function symbolToNode(symbol, context, meaning) { + if (context.flags & 1073741824 /* NodeBuilderFlags.WriteComputedProps */) { + if (symbol.valueDeclaration) { + var name = ts.getNameOfDeclaration(symbol.valueDeclaration); + if (name && ts.isComputedPropertyName(name)) + return name; + } + var nameType = getSymbolLinks(symbol).nameType; + if (nameType && nameType.flags & (1024 /* TypeFlags.EnumLiteral */ | 8192 /* TypeFlags.UniqueESSymbol */)) { + context.enclosingDeclaration = nameType.symbol.valueDeclaration; + return ts.factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning)); + } + } + return symbolToExpression(symbol, context, meaning); + } function withContext(enclosingDeclaration, flags, tracker, cb) { var _a, _b; ts.Debug.assert(enclosingDeclaration === undefined || (enclosingDeclaration.flags & 8 /* NodeFlags.Synthesized */) === 0); @@ -53193,7 +53630,7 @@ var ts; return undefined; // TODO: GH#18217 } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (!(context.flags & 536870912 /* NodeBuilderFlags.NoTypeReduction */)) { type = getReducedType(type); @@ -53203,29 +53640,29 @@ var ts; return ts.factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context)); } if (type === unresolvedType) { - return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); + return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 138 /* SyntaxKind.IntrinsicKeyword */ : 130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 139 /* SyntaxKind.IntrinsicKeyword */ : 131 /* SyntaxKind.AnyKeyword */); } if (type.flags & 2 /* TypeFlags.Unknown */) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (type.flags & 4 /* TypeFlags.String */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + return ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); } if (type.flags & 8 /* TypeFlags.Number */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(147 /* SyntaxKind.NumberKeyword */); + return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.NumberKeyword */); } if (type.flags & 64 /* TypeFlags.BigInt */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(158 /* SyntaxKind.BigIntKeyword */); + return ts.factory.createKeywordTypeNode(160 /* SyntaxKind.BigIntKeyword */); } if (type.flags & 16 /* TypeFlags.Boolean */ && !type.aliasSymbol) { context.approximateLength += 7; - return ts.factory.createKeywordTypeNode(133 /* SyntaxKind.BooleanKeyword */); + return ts.factory.createKeywordTypeNode(134 /* SyntaxKind.BooleanKeyword */); } if (type.flags & 1024 /* TypeFlags.EnumLiteral */ && !(type.flags & 1048576 /* TypeFlags.Union */)) { var parentSymbol = getParentOfSymbol(type.symbol); @@ -53279,7 +53716,7 @@ var ts; } } context.approximateLength += 13; - return ts.factory.createTypeOperatorNode(154 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */)); + return ts.factory.createTypeOperatorNode(156 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */)); } if (type.flags & 16384 /* TypeFlags.Void */) { context.approximateLength += 4; @@ -53287,7 +53724,7 @@ var ts; } if (type.flags & 32768 /* TypeFlags.Undefined */) { context.approximateLength += 9; - return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); } if (type.flags & 65536 /* TypeFlags.Null */) { context.approximateLength += 4; @@ -53295,15 +53732,15 @@ var ts; } if (type.flags & 131072 /* TypeFlags.Never */) { context.approximateLength += 5; - return ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */); + return ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */); } if (type.flags & 4096 /* TypeFlags.ESSymbol */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */); + return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */); } if (type.flags & 67108864 /* TypeFlags.NonPrimitive */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.ObjectKeyword */); + return ts.factory.createKeywordTypeNode(149 /* SyntaxKind.ObjectKeyword */); } if (ts.isThisTypeParameter(type)) { if (context.flags & 4194304 /* NodeBuilderFlags.InObjectTypeLiteral */) { @@ -53392,7 +53829,7 @@ var ts; var indexedType = type.type; context.approximateLength += 6; var indexTypeNode = typeToTypeNodeHelper(indexedType, context); - return ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); + return ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); } if (type.flags & 134217728 /* TypeFlags.TemplateLiteral */) { var texts_1 = type.texts; @@ -53444,7 +53881,7 @@ var ts; // On the other hand, // checkType extends infer T extends checkType ? T extends extendsType ? trueType : falseType : never; // may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS. - return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } var saveInferTypeParameters = context.inferTypeParameters; context.inferTypeParameters = type.root.inferTypeParameters; @@ -53486,7 +53923,7 @@ var ts; var name = typeParameterToName(newParam, context); newTypeVariable = ts.factory.createTypeReferenceNode(name); } - appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); + appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); } else { appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context); @@ -53502,7 +53939,7 @@ var ts; // wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting // type stays homomorphic var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper); - return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } return result; } @@ -53550,7 +53987,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* SymbolFlags.Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 305 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 262 /* SyntaxKind.ModuleBlock */; + return declaration.parent.kind === 308 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 265 /* SyntaxKind.ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -53639,12 +54076,12 @@ var ts; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { var signature = resolved.callSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 179 /* SyntaxKind.FunctionType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 181 /* SyntaxKind.FunctionType */, context); return signatureNode; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { var signature = resolved.constructSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 180 /* SyntaxKind.ConstructorType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 182 /* SyntaxKind.ConstructorType */, context); return signatureNode; } } @@ -53687,7 +54124,7 @@ var ts; } var elementType = typeToTypeNodeHelper(typeArguments[0], context); var arrayType = ts.factory.createArrayTypeNode(elementType); - return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, arrayType); + return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, arrayType); } else if (type.target.objectFlags & 8 /* ObjectFlags.Tuple */) { typeArguments = ts.sameMap(typeArguments, function (t, i) { return removeMissingType(t, !!(type.target.elementFlags[i] & 2 /* ElementFlags.Optional */)); }); @@ -53712,12 +54149,12 @@ var ts; } } var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode(tupleConstituentNodes), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } } if (context.encounteredError || (context.flags & 524288 /* NodeBuilderFlags.AllowEmptyTuple */)) { var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode([]), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } context.encounteredError = true; return undefined; // TODO: GH#18217 @@ -53824,13 +54261,13 @@ var ts; var typeElements = []; for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 174 /* SyntaxKind.CallSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 176 /* SyntaxKind.CallSignature */, context)); } for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; if (signature.flags & 4 /* SignatureFlags.Abstract */) continue; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 175 /* SyntaxKind.ConstructSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 177 /* SyntaxKind.ConstructSignature */, context)); } for (var _d = 0, _e = resolvedType.indexInfos; _d < _e.length; _d++) { var info = _e[_d]; @@ -53867,7 +54304,7 @@ var ts; if (!(context.flags & 1 /* NodeBuilderFlags.NoTruncation */)) { return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier("..."), /*typeArguments*/ undefined); } - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function shouldUsePlaceholderForProperty(propertySymbol, context) { var _a; @@ -53917,7 +54354,7 @@ var ts; var signatures = getSignaturesOfType(filterType(propertyType, function (t) { return !(t.flags & 32768 /* TypeFlags.Undefined */); }), 0 /* SignatureKind.Call */); for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) { var signature = signatures_1[_i]; - var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 168 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 170 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration)); } } @@ -53931,12 +54368,12 @@ var ts; context.reverseMappedStack || (context.reverseMappedStack = []); context.reverseMappedStack.push(propertySymbol); } - propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); if (propertyIsReverseMapped) { context.reverseMappedStack.pop(); } } - var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined; + var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined; if (modifiers) { context.approximateLength += 9; } @@ -53945,8 +54382,8 @@ var ts; } function preserveCommentsOn(node) { var _a; - if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; })) { - var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; }); + if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; })) { + var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; }); var commentText = ts.getTextOfJSDocComment(d.comment); if (commentText) { ts.setSyntheticLeadingComments(node, [{ kind: 3 /* SyntaxKind.MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); @@ -54045,7 +54482,7 @@ var ts; context.encounteredError = true; } context.approximateLength += (name.length + 4); - return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); + return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); } function signatureToSignatureDeclarationHelper(signature, kind, context, options) { var _a, _b, _c, _d; @@ -54063,7 +54500,7 @@ var ts; } var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0]; // If the expanded parameter list had a variadic in a non-trailing position, don't expand it - var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); + var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 173 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); var thisParameter = context.flags & 33554432 /* NodeBuilderFlags.OmitThisParameter */ ? undefined : tryGetThisParameterDeclaration(signature, context); if (thisParameter) { parameters.unshift(thisParameter); @@ -54072,7 +54509,7 @@ var ts; var typePredicate = getTypePredicateOfSignature(signature); if (typePredicate) { var assertsModifier = typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? - ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : + ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined; var parameterName = typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.setEmitFlags(ts.factory.createIdentifier(typePredicate.parameterName), 16777216 /* EmitFlags.NoAsciiEscaping */) : @@ -54086,28 +54523,28 @@ var ts; returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); } else if (!suppressAny) { - returnTypeNode = ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + returnTypeNode = ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } var modifiers = options === null || options === void 0 ? void 0 : options.modifiers; - if ((kind === 180 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { + if ((kind === 182 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { var flags = ts.modifiersToFlags(modifiers); - modifiers = ts.factory.createModifiersFromModifierFlags(flags | 128 /* ModifierFlags.Abstract */); - } - var node = kind === 174 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : - kind === 175 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : - kind === 168 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : - kind === 169 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 171 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : - kind === 172 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : - kind === 173 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : - kind === 176 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : - kind === 317 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : - kind === 179 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 180 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 256 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 213 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : - kind === 214 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : + modifiers = ts.factory.createModifiersFromModifierFlags(flags | 256 /* ModifierFlags.Abstract */); + } + var node = kind === 176 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : + kind === 177 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : + kind === 170 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : + kind === 171 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 173 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : + kind === 174 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : + kind === 175 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : + kind === 178 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : + kind === 320 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : + kind === 181 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 182 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 215 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : + kind === 216 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : ts.Debug.assertNever(kind); if (typeArguments) { node.typeArguments = ts.factory.createNodeArray(typeArguments); @@ -54144,9 +54581,9 @@ var ts; return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) { - var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 164 /* SyntaxKind.Parameter */); + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 166 /* SyntaxKind.Parameter */); if (!parameterDeclaration && !ts.isTransientSymbol(parameterSymbol)) { - parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 340 /* SyntaxKind.JSDocParameterTag */); + parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 343 /* SyntaxKind.JSDocParameterTag */); } var parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -54158,7 +54595,7 @@ var ts; var dotDotDotToken = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name), 16777216 /* EmitFlags.NoAsciiEscaping */) : - parameterDeclaration.name.kind === 161 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : + parameterDeclaration.name.kind === 163 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : ts.symbolName(parameterSymbol) : ts.symbolName(parameterSymbol); @@ -54322,11 +54759,11 @@ var ts; } function getSpecifierForModuleSymbol(symbol, context, overrideImportMode) { var _a; - var file = ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */); + var file = ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */); if (!file) { var equivalentFileSymbol = ts.firstDefined(symbol.declarations, function (d) { return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); }); if (equivalentFileSymbol) { - file = ts.getDeclarationOfKind(equivalentFileSymbol, 305 /* SyntaxKind.SourceFile */); + file = ts.getDeclarationOfKind(equivalentFileSymbol, 308 /* SyntaxKind.SourceFile */); } } if (file && file.moduleName !== undefined) { @@ -54794,17 +55231,17 @@ var ts; return transformed === existing ? ts.setTextRange(ts.factory.cloneNode(existing), existing) : transformed; function visitExistingNodeTreeSymbols(node) { // We don't _actually_ support jsdoc namepath types, emit `any` instead - if (ts.isJSDocAllType(node) || node.kind === 319 /* SyntaxKind.JSDocNamepathType */) { - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + if (ts.isJSDocAllType(node) || node.kind === 322 /* SyntaxKind.JSDocNamepathType */) { + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (ts.isJSDocUnknownType(node)) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (ts.isJSDocNullableType(node)) { return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createLiteralTypeNode(ts.factory.createNull())]); } if (ts.isJSDocOptionalType(node)) { - return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } if (ts.isJSDocNonNullableType(node)) { return ts.visitNode(node.type, visitExistingNodeTreeSymbols); @@ -54818,11 +55255,11 @@ var ts; var typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText); var overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : undefined; return ts.factory.createPropertySignature( - /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); })); } if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "") { - return ts.setOriginalNode(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), node); + return ts.setOriginalNode(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), node); } if ((ts.isExpressionWithTypeArguments(node) || ts.isTypeReferenceNode(node)) && ts.isJSDocIndexSignature(node)) { return ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature( @@ -54837,12 +55274,12 @@ var ts; return ts.factory.createConstructorTypeNode( /*modifiers*/ undefined, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } else { return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } } if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */, /*ignoreErrors*/ true))) { @@ -54910,8 +55347,8 @@ var ts; } } function symbolTableToDeclarationStatements(symbolTable, context, bundled) { - var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 169 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); - var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 168 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); + var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 171 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); + var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 170 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); // TODO: Use `setOriginalNode` on original declaration names where possible so these declarations see some kind of // declaration mapping // We save the enclosing declaration off here so it's not adjusted by well-meaning declaration @@ -55035,7 +55472,7 @@ var ts; // export {name} - look thru `statements` for `name`, and if all results can take an `export` modifier, do so and filter it var indices = ts.indicesOf(statements); var associatedIndices = ts.filter(indices, function (i) { return ts.nodeHasName(statements[i], e.name); }); - if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return canHaveExportModifier(statements[i]); })) { + if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return ts.canHaveExportModifier(statements[i]); })) { for (var _i = 0, associatedIndices_1 = associatedIndices; _i < associatedIndices_1.length; _i++) { var index_1 = associatedIndices_1[_i]; statements[index_1] = addExportModifier(statements[index_1]); @@ -55069,15 +55506,6 @@ var ts; } return statements; } - function canHaveExportModifier(node) { - return ts.isEnumDeclaration(node) || - ts.isVariableStatement(node) || - ts.isFunctionDeclaration(node) || - ts.isClassDeclaration(node) || - (ts.isModuleDeclaration(node) && !ts.isExternalModuleAugmentation(node) && !ts.isGlobalScopeAugmentation(node)) || - ts.isInterfaceDeclaration(node) || - isTypeDeclaration(node); - } function addExportModifier(node) { var flags = (ts.getEffectiveModifierFlags(node) | 1 /* ModifierFlags.Export */) & ~2 /* ModifierFlags.Ambient */; return ts.factory.updateModifiers(node, flags); @@ -55149,7 +55577,7 @@ var ts; if (needsPostExportDefault || needsExportDeclaration) { isPrivate = true; } - var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 512 /* ModifierFlags.Default */ : 0); + var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 1024 /* ModifierFlags.Default */ : 0); var isConstMergedWithNS = symbol.flags & 1536 /* SymbolFlags.Module */ && symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 1 /* SymbolFlags.FunctionScopedVariable */ | 4 /* SymbolFlags.Property */) && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */; @@ -55166,6 +55594,7 @@ var ts; && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */ && !(symbol.flags & 4194304 /* SymbolFlags.Prototype */) && !(symbol.flags & 32 /* SymbolFlags.Class */) + && !(symbol.flags & 8192 /* SymbolFlags.Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) { if (propertyAsAlias) { var createdExport = serializeMaybeAliasAssignment(symbol); @@ -55323,7 +55752,7 @@ var ts; (ts.isJSDocTypeAlias(context.enclosingDeclaration) ? ts.getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration); if (additionalModifierFlags & 1 /* ModifierFlags.Export */ && enclosingDeclaration_1 && (isExportingScope(enclosingDeclaration_1) || ts.isModuleDeclaration(enclosingDeclaration_1)) && - canHaveExportModifier(node)) { + ts.canHaveExportModifier(node)) { // Classes, namespaces, variables, functions, interfaces, and types should all be `export`ed in a module context if not private newModifierFlags |= 1 /* ModifierFlags.Export */; } @@ -55333,8 +55762,8 @@ var ts; // Classes, namespaces, variables, enums, and functions all need `declare` modifiers to be valid in a declaration file top-level scope newModifierFlags |= 2 /* ModifierFlags.Ambient */; } - if ((additionalModifierFlags & 512 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { - newModifierFlags |= 512 /* ModifierFlags.Default */; + if ((additionalModifierFlags & 1024 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { + newModifierFlags |= 1024 /* ModifierFlags.Default */; } if (newModifierFlags) { node = ts.factory.updateModifiers(node, newModifierFlags | ts.getEffectiveModifierFlags(node)); @@ -55368,8 +55797,8 @@ var ts; var baseTypes = getBaseTypes(interfaceType); var baseType = ts.length(baseTypes) ? getIntersectionType(baseTypes) : undefined; var members = ts.flatMap(getPropertiesOfType(interfaceType), function (p) { return serializePropertySymbolForInterface(p, baseType); }); - var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 174 /* SyntaxKind.CallSignature */); - var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 175 /* SyntaxKind.ConstructSignature */); + var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 176 /* SyntaxKind.CallSignature */); + var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 177 /* SyntaxKind.ConstructSignature */); var indexSignatures = serializeIndexSignatures(interfaceType, baseType); var heritageClauses = !ts.length(baseTypes) ? undefined : [ts.factory.createHeritageClause(94 /* SyntaxKind.ExtendsKeyword */, ts.mapDefined(baseTypes, function (b) { return trySerializeAsTypeReference(b, 111551 /* SymbolFlags.Value */); }))]; addResult(ts.factory.createInterfaceDeclaration( @@ -55379,7 +55808,7 @@ var ts; return !symbol.exports ? [] : ts.filter(ts.arrayFrom(symbol.exports.values()), isNamespaceMember); } function isTypeOnlyNamespace(symbol) { - return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m).flags & 111551 /* SymbolFlags.Value */); }); + return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* SymbolFlags.Value */); }); } function serializeModule(symbol, symbolName, modifierFlags) { var members = getNamespaceMembersForSerialization(symbol); @@ -55434,7 +55863,7 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var sig = signatures_2[_i]; // Each overload becomes a separate function declaration, in order - var decl = signatureToSignatureDeclarationHelper(sig, 256 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); + var decl = signatureToSignatureDeclarationHelper(sig, 259 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); addResult(ts.setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags); } // Module symbol emit will take care of module-y members, provided it has exports @@ -55592,7 +56021,7 @@ var ts; !ts.some(getSignaturesOfType(staticType, 1 /* SignatureKind.Construct */)); var constructors = isNonConstructableClassLikeInJsFile ? [ts.factory.createConstructorDeclaration(ts.factory.createModifiersFromModifierFlags(8 /* ModifierFlags.Private */), [], /*body*/ undefined)] : - serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 171 /* SyntaxKind.Constructor */); + serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 173 /* SyntaxKind.Constructor */); var indexSignatures = serializeIndexSignatures(classType, baseTypes[0]); context.enclosingDeclaration = oldEnclosing; addResult(ts.setTextRange(ts.factory.createClassDeclaration( @@ -55641,8 +56070,8 @@ var ts; var targetName = getInternalSymbolName(target, verbatimTargetName); includePrivateSymbol(target); // the target may be within the same scope - attempt to serialize it first switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 254 /* SyntaxKind.VariableDeclaration */) { + case 205 /* SyntaxKind.BindingElement */: + if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 257 /* SyntaxKind.VariableDeclaration */) { // const { SomeClass } = require('./lib'); var specifier_1 = getSpecifierForModuleSymbol(target.parent || target, context); // './lib' var propertyName = node.propertyName; @@ -55655,13 +56084,13 @@ var ts; // We don't know how to serialize this (nested?) binding element ts.Debug.failBadSyntaxKind(((_c = node.parent) === null || _c === void 0 ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization"); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 221 /* SyntaxKind.BinaryExpression */) { + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 223 /* SyntaxKind.BinaryExpression */) { // module.exports = { SomeClass } serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), targetName); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // commonjs require: const x = require('y') if (ts.isPropertyAccessExpression(node.initializer)) { // const x = require('y').z @@ -55679,7 +56108,7 @@ var ts; break; } // else fall through and treat commonjs require just like import= - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // This _specifically_ only exists to handle json declarations - where we make aliases, but since // we emit no declarations for the json document, must not refer to it in the declarations if (target.escapedName === "export=" /* InternalSymbolName.ExportEquals */ && ts.some(target.declarations, ts.isJsonSourceFile)) { @@ -55695,13 +56124,13 @@ var ts; ? symbolToName(target, context, 67108863 /* SymbolFlags.All */, /*expectsIdentifier*/ false) : ts.factory.createExternalModuleReference(ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))), isLocalImport ? modifierFlags : 0 /* ModifierFlags.None */); break; - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // export as namespace foo // TODO: Not part of a file's local or export symbol tables // Is bound into file.symbol.globalExports instead, which we don't currently traverse addResult(ts.factory.createNamespaceExportDeclaration(ts.idText(node.name)), 0 /* ModifierFlags.None */); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, ts.factory.createIdentifier(localName), /*namedBindings*/ undefined), // We use `target.parent || target` below as `target.parent` is unset when the target is a module which has been export assigned @@ -55710,17 +56139,17 @@ var ts; ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*importClause*/ undefined, ts.factory.createNamespaceImport(ts.factory.createIdentifier(localName))), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: addResult(ts.factory.createExportDeclaration( /*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamespaceExport(ts.factory.createIdentifier(localName)), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))), 0 /* ModifierFlags.None */); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause( /*isTypeOnly*/ false, @@ -55730,7 +56159,7 @@ var ts; ])), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: // does not use localName because the symbol name in this case refers to the name in the exports table, // which we must exactly preserve var specifier = node.parent.parent.moduleSpecifier; @@ -55738,12 +56167,12 @@ var ts; // another file serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: serializeMaybeAliasAssignment(symbol); break; - case 221 /* SyntaxKind.BinaryExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // Could be best encoded as though an export specifier or as though an export assignment // If name is default or export=, do an export assignment // Otherwise do an export specifier @@ -55887,7 +56316,7 @@ var ts; && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName)))) { return []; } - var flag = (modifierFlags & ~256 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); + var flag = (modifierFlags & ~512 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); var name = getPropertyNameNodeForSymbol(p, context); var firstPropertyLikeDecl = (_a = p.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.or(ts.isPropertyDeclaration, ts.isAccessor, ts.isVariableDeclaration, ts.isPropertySignature, ts.isBinaryExpression, ts.isPropertyAccessExpression)); if (p.flags & 98304 /* SymbolFlags.Accessor */ && useAccessors) { @@ -55909,7 +56338,7 @@ var ts; // This is an else/if as accessors and properties can't merge in TS, but might in JS // If this happens, we assume the accessor takes priority, as it imposes more constraints else if (p.flags & (4 /* SymbolFlags.Property */ | 3 /* SymbolFlags.Variable */ | 98304 /* SymbolFlags.Accessor */)) { - return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), + return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357 // interface members can't have initializers, however class members _can_ /*initializer*/ undefined), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts.or(ts.isPropertyDeclaration, ts.isVariableDeclaration))) || firstPropertyLikeDecl); @@ -56099,7 +56528,7 @@ var ts; if (flags === void 0) { flags = 16384 /* TypeFormatFlags.UseAliasDefinedOutsideCurrentScope */; } return writer ? typePredicateToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(typePredicateToStringWorker); function typePredicateToStringWorker(writer) { - var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 + var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 ); var printer = ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); @@ -56146,7 +56575,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ && type.symbol.declarations) { var node = ts.walkUpParenthesizedTypes(type.symbol.declarations[0].parent); - if (node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -56154,11 +56583,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 305 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); + return location.kind === 308 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); } function getNameOfSymbolFromNameType(symbol, context) { var nameType = getSymbolLinks(symbol).nameType; @@ -56217,17 +56646,17 @@ var ts; if (!declaration) { declaration = symbol.declarations[0]; // Declaration may be nameless, but we'll try anyway } - if (declaration.parent && declaration.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (declaration.parent && declaration.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { return ts.declarationNameToString(declaration.parent.name); } switch (declaration.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (context && !context.encounteredError && !(context.flags & 131072 /* NodeBuilderFlags.AllowAnonymousIdentifier */)) { context.encounteredError = true; } - return declaration.kind === 226 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; + return declaration.kind === 228 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; } } var name = getNameOfSymbolFromNameType(symbol, context); @@ -56244,28 +56673,28 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // Top-level jsdoc type aliases are considered exported // First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent)); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return isDeclarationVisible(node.parent.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; @@ -56273,55 +56702,55 @@ var ts; var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) && - !(node.kind !== 265 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 305 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { + !(node.kind !== 268 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 308 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 164 /* SyntaxKind.Parameter */: - case 262 /* SyntaxKind.ModuleBlock */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 178 /* SyntaxKind.TypeReference */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 166 /* SyntaxKind.Parameter */: + case 265 /* SyntaxKind.ModuleBlock */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 180 /* SyntaxKind.TypeReference */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: return false; // Type parameters are always visible - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: // Source file and namespace export are always visible // falls through - case 305 /* SyntaxKind.SourceFile */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return false; default: return false; @@ -56330,10 +56759,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.parent && node.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { exportSymbol = resolveName(node, node.escapedText, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false); } - else if (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + else if (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */); } var result; @@ -56440,12 +56869,12 @@ var ts; function getDeclarationContainer(node) { return ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 255 /* SyntaxKind.VariableDeclarationList */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 269 /* SyntaxKind.NamedImports */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 258 /* SyntaxKind.VariableDeclarationList */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 272 /* SyntaxKind.NamedImports */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: return false; default: return true; @@ -56575,23 +57004,23 @@ var ts; function getParentElementAccess(node) { var ancestor = node.parent.parent; switch (ancestor.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: return getSyntheticElementAccess(ancestor); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getSyntheticElementAccess(node.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ancestor.initializer; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ancestor.right; } } function getDestructuringPropertyName(node) { var parent = node.parent; - if (node.kind === 203 /* SyntaxKind.BindingElement */ && parent.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (node.kind === 205 /* SyntaxKind.BindingElement */ && parent.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { return getLiteralPropertyNameText(node.propertyName || node.name); } - if (node.kind === 296 /* SyntaxKind.PropertyAssignment */ || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.kind === 299 /* SyntaxKind.PropertyAssignment */ || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return getLiteralPropertyNameText(node.name); } return "" + parent.elements.indexOf(node); @@ -56621,7 +57050,7 @@ var ts; parentType = getTypeWithFacts(parentType, 524288 /* TypeFacts.NEUndefined */); } var type; - if (pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (declaration.dotDotDotToken) { parentType = getReducedType(parentType); if (parentType.flags & 2 /* TypeFlags.Unknown */ || !isValidSpreadType(parentType)) { @@ -56692,7 +57121,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, isProperty, isOptional) { if (isProperty === void 0) { isProperty = false; } @@ -56703,11 +57132,11 @@ var ts; function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, /*checkMode*/ checkMode))); return indexType.flags & (262144 /* TypeFlags.TypeParameter */ | 4194304 /* TypeFlags.Index */) ? getExtractStringType(indexType) : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -56718,7 +57147,7 @@ var ts; if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } - var isProperty = ts.isPropertyDeclaration(declaration) || ts.isPropertySignature(declaration); + var isProperty = ts.isPropertyDeclaration(declaration) && !ts.hasAccessorModifier(declaration) || ts.isPropertySignature(declaration); var isOptional = includeOptionality && (isProperty && !!declaration.questionToken || ts.isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) || isOptionalJSDocPropertyLikeTag(declaration)); @@ -56745,8 +57174,8 @@ var ts; if (ts.isParameter(declaration)) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 173 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { - var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 172 /* SyntaxKind.GetAccessor */); + if (func.kind === 175 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { + var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 174 /* SyntaxKind.GetAccessor */); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -56758,11 +57187,9 @@ var ts; return getReturnTypeOfSignature(getterSignature); } } - if (ts.isInJSFile(declaration)) { - var type_1 = getParameterTypeOfTypeTag(func, declaration); - if (type_1) - return type_1; - } + var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration); + if (parameterTypeOfTypeTag) + return parameterTypeOfTypeTag; // Use contextual parameter type if one is available var type = declaration.symbol.escapedName === "this" /* InternalSymbolName.This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration); if (type) { @@ -56823,7 +57250,7 @@ var ts; links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && ts.every(symbol.declarations, function (declaration) { return ts.isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && - (declaration.left.kind !== 207 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && + (declaration.left.kind !== 209 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration(/*declaredType*/ undefined, declaration, symbol, declaration); }); } @@ -56845,11 +57272,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var container = ts.getThisContainer(declaration, /*includeArrowFunctions*/ false); - if (container && (container.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { + if (container && (container.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { return container; } } - ; } /** Create a synthetic property access flow node after the last statement of the file */ function getFlowTypeFromCommonJSExport(symbol) { @@ -57142,9 +57568,9 @@ var ts; var thisContainer = ts.getThisContainer(expression, /*includeArrowFunctions*/ false); // Properties defined in a constructor (or base constructor, or javascript constructor function) don't get undefined added. // Function expressions that are assigned to the prototype count as methods. - return thisContainer.kind === 171 /* SyntaxKind.Constructor */ || - thisContainer.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (thisContainer.kind === 213 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + return thisContainer.kind === 173 /* SyntaxKind.Constructor */ || + thisContainer.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (thisContainer.kind === 215 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); } function getConstructorDefinedThisAssignmentTypes(types, declarations) { ts.Debug.assert(types.length === declarations.length); @@ -57214,7 +57640,7 @@ var ts; function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) { var elements = pattern.elements; var lastElement = ts.lastOrUndefined(elements); - var restElement = lastElement && lastElement.kind === 203 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; + var restElement = lastElement && lastElement.kind === 205 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; if (elements.length === 0 || elements.length === 1 && restElement) { return languageVersion >= 2 /* ScriptTarget.ES2015 */ ? createIterableType(anyType) : anyArrayType; } @@ -57239,7 +57665,7 @@ var ts; function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { if (includePatternInType === void 0) { includePatternInType = false; } if (reportErrors === void 0) { reportErrors = false; } - return pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + return pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -57287,7 +57713,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 164 /* SyntaxKind.Parameter */ ? root.parent : root; + var memberDeclaration = root.kind === 166 /* SyntaxKind.Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function tryGetTypeFromEffectiveTypeNode(node) { @@ -57342,9 +57768,9 @@ var ts; if (typeNode === undefined) { return useUnknownInCatchVariables ? unknownType : anyType; } - var type_2 = getTypeOfNode(typeNode); + var type_1 = getTypeOfNode(typeNode); // an errorType will make `checkTryStatement` issue an error - return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType; + return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType; } // Handle export default expressions if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) { @@ -57367,7 +57793,7 @@ var ts; return reportCircularityError(symbol); } var type; - if (declaration.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (declaration.kind === 274 /* SyntaxKind.ExportAssignment */) { type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); } else if (ts.isBinaryExpression(declaration) || @@ -57435,13 +57861,17 @@ var ts; } function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { - var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation; - } - else { - var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation; + switch (accessor.kind) { + case 174 /* SyntaxKind.GetAccessor */: + var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); + return getterTypeAnnotation; + case 175 /* SyntaxKind.SetAccessor */: + var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation; + case 169 /* SyntaxKind.PropertyDeclaration */: + ts.Debug.assert(ts.hasAccessorModifier(accessor)); + var accessorTypeAnnotation = ts.getEffectiveTypeAnnotationNode(accessor); + return accessorTypeAnnotation; } } return undefined; @@ -57463,14 +57893,17 @@ var ts; if (!pushTypeResolution(symbol, 0 /* TypeSystemPropertyName.Type */)) { return errorType; } - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); + var accessor = ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); // We try to resolve a getter type annotation, a setter type annotation, or a getter function // body return type inference, in that order. var type = getter && ts.isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || - getter && getter.body && getReturnTypeFromBody(getter); + getAnnotatedAccessorType(accessor) || + getter && getter.body && getReturnTypeFromBody(getter) || + accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration(accessor, /*includeOptionality*/ true); if (!type) { if (setter && !isPrivateWithinAmbient(setter)) { errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); @@ -57478,6 +57911,9 @@ var ts; else if (getter && !isPrivateWithinAmbient(getter)) { errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); } + else if (accessor && !isPrivateWithinAmbient(accessor)) { + errorOrSuggestion(noImplicitAny, accessor, ts.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), "any"); + } type = anyType; } if (!popTypeResolution()) { @@ -57487,6 +57923,9 @@ var ts; else if (getAnnotatedAccessorTypeNode(setter)) { error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } + else if (getAnnotatedAccessorTypeNode(accessor)) { + error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } else if (getter && noImplicitAny) { error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } @@ -57497,12 +57936,13 @@ var ts; return links.type; } function getWriteTypeOfAccessors(symbol) { + var _a; var links = getSymbolLinks(symbol); if (!links.writeType) { if (!pushTypeResolution(symbol, 8 /* TypeSystemPropertyName.WriteType */)) { return errorType; } - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var setter = (_a = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */)) !== null && _a !== void 0 ? _a : ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); var writeType = getAnnotatedAccessorType(setter); if (!popTypeResolution()) { if (getAnnotatedAccessorTypeNode(setter)) { @@ -57542,9 +57982,9 @@ var ts; if (symbol.flags & 1536 /* SymbolFlags.Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) { return anyType; } - else if (declaration && (declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || + else if (declaration && (declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || ts.isAccessExpression(declaration) && - declaration.parent.kind === 221 /* SyntaxKind.BinaryExpression */)) { + declaration.parent.kind === 223 /* SyntaxKind.BinaryExpression */)) { return getWidenedTypeForAssignmentDeclaration(symbol); } else if (symbol.flags & 512 /* SymbolFlags.ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) { @@ -57554,11 +57994,11 @@ var ts; return errorType; } var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* InternalSymbolName.ExportEquals */)); - var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); + var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); if (!popTypeResolution()) { return reportCircularityError(symbol); } - return type_3; + return type_2; } } var type = createObjectType(16 /* ObjectFlags.Anonymous */, symbol); @@ -57588,7 +58028,7 @@ var ts; links.type = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol.declarations) ? autoType : declaredType ? declaredType - : targetSymbol.flags & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol) + : getAllSymbolFlags(targetSymbol) & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol) : errorType; } return links.type; @@ -57609,7 +58049,7 @@ var ts; return errorType; } // Check if variable has initializer that circularly references the variable itself - if (noImplicitAny && (declaration.kind !== 164 /* SyntaxKind.Parameter */ || declaration.initializer)) { + if (noImplicitAny && (declaration.kind !== 166 /* SyntaxKind.Parameter */ || declaration.initializer)) { error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); } // Circularities could also result from parameters in function expressions that end up @@ -57741,46 +58181,46 @@ var ts; return undefined; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 195 /* SyntaxKind.MappedType */: - case 189 /* SyntaxKind.ConditionalType */: { + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 197 /* SyntaxKind.MappedType */: + case 191 /* SyntaxKind.ConditionalType */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); - if (node.kind === 195 /* SyntaxKind.MappedType */) { + if (node.kind === 197 /* SyntaxKind.MappedType */) { return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))); } - else if (node.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (node.kind === 191 /* SyntaxKind.ConditionalType */) { return ts.concatenate(outerTypeParameters, getInferTypeParameters(node)); } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node)); var thisType = includeThisTypes && - (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && + (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var paramSymbol = ts.getParameterSymbolFromJSDoc(node); if (paramSymbol) { node = paramSymbol.valueDeclaration; } break; - case 320 /* SyntaxKind.JSDoc */: { + case 323 /* SyntaxKind.JSDoc */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); return node.tags ? appendTypeParameters(outerTypeParameters, ts.flatMap(node.tags, function (t) { return ts.isJSDocTemplateTag(t) ? t.typeParameters : undefined; })) @@ -57791,7 +58231,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); ts.Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations"); return getOuterTypeParameters(declaration); } @@ -57804,9 +58244,9 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || - node.kind === 226 /* SyntaxKind.ClassExpression */ || + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || + node.kind === 228 /* SyntaxKind.ClassExpression */ || isJSConstructor(node) || ts.isTypeAlias(node)) { var declaration = node; @@ -57958,7 +58398,7 @@ var ts; if (!popTypeResolution() && type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { reportCircularBaseType(declaration, type); } } @@ -58054,7 +58494,7 @@ var ts; if (type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getReducedType(getTypeFromTypeNode(node)); @@ -58094,7 +58534,7 @@ var ts; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (declaration.flags & 128 /* NodeFlags.ContainsThis */) { return false; } @@ -58173,7 +58613,7 @@ var ts; } else { type = errorType; - if (declaration.kind === 339 /* SyntaxKind.JSDocEnumTag */) { + if (declaration.kind === 342 /* SyntaxKind.JSDocEnumTag */) { error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } else { @@ -58188,7 +58628,7 @@ var ts; if (ts.isStringLiteralLike(expr)) { return true; } - else if (expr.kind === 221 /* SyntaxKind.BinaryExpression */) { + else if (expr.kind === 223 /* SyntaxKind.BinaryExpression */) { return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right); } return false; @@ -58203,12 +58643,12 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; case 79 /* SyntaxKind.Identifier */: return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isStringConcatExpression(expr); default: return false; @@ -58223,7 +58663,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && ts.isStringLiteralLike(member.initializer)) { @@ -58252,7 +58692,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var value = getEnumMemberValue(member); @@ -58325,22 +58765,22 @@ var ts; */ function isThislessType(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 196 /* SyntaxKind.LiteralType */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 198 /* SyntaxKind.LiteralType */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isThislessType(node.elementType); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return !node.typeArguments || node.typeArguments.every(isThislessType); } return false; @@ -58366,7 +58806,7 @@ var ts; function isThislessFunctionLikeDeclaration(node) { var returnType = ts.getEffectiveReturnTypeNode(node); var typeParameters = ts.getEffectiveTypeParameterDeclarations(node); - return (node.kind === 171 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && + return (node.kind === 173 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); } @@ -58382,14 +58822,14 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return isThislessVariableLikeDeclaration(declaration); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return isThislessFunctionLikeDeclaration(declaration); } } @@ -58600,8 +59040,10 @@ var ts; if (members) { for (var _b = 0, members_5 = members; _b < members_5.length; _b++) { var member = members_5[_b]; - if (isStatic_1 === ts.hasStaticModifier(member) && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === ts.hasStaticModifier(member)) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58616,8 +59058,10 @@ var ts; || ts.isBinaryExpression(member) && isPossiblyAliasedThisProperty(member, assignmentKind) || assignmentKind === 9 /* AssignmentDeclarationKind.ObjectDefinePrototypeProperty */ || assignmentKind === 6 /* AssignmentDeclarationKind.Prototype */; // A straight `Prototype` assignment probably can never have a computed name - if (isStatic_1 === !isInstanceMember && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === !isInstanceMember) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58804,7 +59248,7 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); var declaration = ts.getClassLikeDeclarationOfSymbol(classType.symbol); - var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); if (baseSignatures.length === 0) { return [createSignature(undefined, classType.localTypeParameters, undefined, ts.emptyArray, classType, /*resolvedTypePredicate*/ undefined, 0, isAbstract ? 4 /* SignatureFlags.Abstract */ : 0 /* SignatureFlags.None */)]; } @@ -59426,8 +59870,8 @@ var ts; } function isMappedTypeWithKeyofConstraintDeclaration(type) { var constraintDeclaration = getConstraintDeclarationForMappedType(type); // TODO: GH#18217 - return constraintDeclaration.kind === 193 /* SyntaxKind.TypeOperator */ && - constraintDeclaration.operator === 140 /* SyntaxKind.KeyOfKeyword */; + return constraintDeclaration.kind === 195 /* SyntaxKind.TypeOperator */ && + constraintDeclaration.operator === 141 /* SyntaxKind.KeyOfKeyword */; } function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { @@ -59467,7 +59911,20 @@ var ts; return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(type) & 4 /* MappedTypeModifiers.IncludeOptional */); } function isGenericMappedType(type) { - return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) && isGenericIndexType(getConstraintTypeFromMappedType(type)); + if (ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) { + var constraint = getConstraintTypeFromMappedType(type); + if (isGenericIndexType(constraint)) { + return true; + } + // A mapped type is generic if the 'as' clause references generic types other than the iteration type. + // To determine this, we substitute the constraint type (that we now know isn't generic) for the iteration + // type and check whether the resulting type is generic. + var nameType = getNameTypeFromMappedType(type); + if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) { + return true; + } + } + return false; } function resolveStructuredTypeMembers(type) { if (!type.members) { @@ -59787,10 +60244,10 @@ var ts; var baseTypes = []; var different = false; for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type_4 = types_7[_i]; - var baseType = getBaseConstraint(type_4); + var type_3 = types_7[_i]; + var baseType = getBaseConstraint(type_3); if (baseType) { - if (baseType !== type_4) { + if (baseType !== type_3) { different = true; } baseTypes.push(baseType); @@ -59834,7 +60291,7 @@ var ts; return constraint && getBaseConstraint(constraint); } if (t.flags & 33554432 /* TypeFlags.Substitution */) { - return getBaseConstraint(t.substitute); + return getBaseConstraint(getSubstitutionIntersection(t)); } return t; } @@ -59937,7 +60394,7 @@ var ts; var indexTypes; var isUnion = containingType.flags & 1048576 /* TypeFlags.Union */; // Flags we want to propagate to the result if they exist in all source symbols - var optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */; + var optionalFlag; var syntheticFlag = 4 /* CheckFlags.SyntheticMethod */; var checkFlags = isUnion ? 0 : 8 /* CheckFlags.Readonly */; var mergedInstantiations = false; @@ -59948,11 +60405,14 @@ var ts; var prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment); var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0; if (prop) { - if (isUnion) { - optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */); - } - else { - optionalFlag &= prop.flags; + if (prop.flags & 106500 /* SymbolFlags.ClassMember */) { + optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : (optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */); + if (isUnion) { + optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */); + } + else { + optionalFlag &= prop.flags; + } } if (!singleProp) { singleProp = prop; @@ -59961,7 +60421,7 @@ var ts; var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp); // If the symbols are instances of one another with identical types - consider the symbols // equivalent and just use the first one, which thus allows us to avoid eliding private - // members when intersecting a (this-)instantiations of a class with it's raw base or another instance + // members when intersecting a (this-)instantiations of a class with its raw base or another instance if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) { // If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used // to do when we recorded multiple distinct symbols so that we still get, eg, `Array.length` printed @@ -60009,7 +60469,11 @@ var ts; } } } - if (!singleProp || isUnion && (propSet || checkFlags & 48 /* CheckFlags.Partial */) && checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */)) { + if (!singleProp || + isUnion && + (propSet || checkFlags & 48 /* CheckFlags.Partial */) && + checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */) && + !(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) { // No property was found, or, in a union, a property has a private or protected declaration in one // constituent, but is missing or has a different declaration in another constituent. return undefined; @@ -60067,7 +60531,7 @@ var ts; propTypes.push(type); } ts.addRange(propTypes, indexTypes); - var result = createSymbol(4 /* SymbolFlags.Property */ | optionalFlag, name, syntheticFlag | checkFlags); + var result = createSymbol(4 /* SymbolFlags.Property */ | (optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : 0), name, syntheticFlag | checkFlags); result.containingType = containingType; if (!hasNonUniformValueDeclaration && firstValueDeclaration) { result.valueDeclaration = firstValueDeclaration; @@ -60111,6 +60575,33 @@ var ts; } return property; } + function getCommonDeclarationsOfSymbols(symbols) { + var commonDeclarations; + var _loop_14 = function (symbol) { + if (!symbol.declarations) { + return { value: undefined }; + } + if (!commonDeclarations) { + commonDeclarations = new ts.Set(symbol.declarations); + return "continue"; + } + commonDeclarations.forEach(function (declaration) { + if (!ts.contains(symbol.declarations, declaration)) { + commonDeclarations.delete(declaration); + } + }); + if (commonDeclarations.size === 0) { + return { value: undefined }; + } + }; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var symbol = symbols_3[_i]; + var state_4 = _loop_14(symbol); + if (typeof state_4 === "object") + return state_4.value; + } + return commonDeclarations; + } function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) { var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment); // We need to filter out partial properties in union types @@ -60314,10 +60805,10 @@ var ts; function isJSDocOptionalParameter(node) { return ts.isInJSFile(node) && ( // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType - node.type && node.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ + node.type && node.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -60350,14 +60841,14 @@ var ts; return false; } function isOptionalPropertyDeclaration(node) { - return ts.isPropertyDeclaration(node) && node.questionToken; + return ts.isPropertyDeclaration(node) && !ts.hasAccessorModifier(node) && node.questionToken; } function isOptionalJSDocPropertyLikeTag(node) { if (!ts.isJSDocPropertyLikeTag(node)) { return false; } var isBracketed = node.isBracketed, typeExpression = node.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; } function createTypePredicate(kind, parameterName, parameterIndex, type) { return { kind: kind, parameterName: parameterName, parameterIndex: parameterIndex, type: type }; @@ -60439,7 +60930,7 @@ var ts; else { parameters.push(paramSymbol); } - if (type && type.kind === 196 /* SyntaxKind.LiteralType */) { + if (type && type.kind === 198 /* SyntaxKind.LiteralType */) { flags |= 2 /* SignatureFlags.HasLiteralTypes */; } // Record a new minimum argument count if this is not an optional parameter @@ -60452,24 +60943,24 @@ var ts; } } // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation - if ((declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) && + if ((declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) && hasBindableName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + var otherKind = declaration.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - var classType = declaration.kind === 171 /* SyntaxKind.Constructor */ ? + var classType = declaration.kind === 173 /* SyntaxKind.Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration); if (ts.hasRestParameter(declaration) || ts.isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) { flags |= 1 /* SignatureFlags.HasRestParameter */; } - if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */) || - ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 128 /* ModifierFlags.Abstract */)) { + if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */) || + ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 256 /* ModifierFlags.Abstract */)) { flags |= 4 /* SignatureFlags.Abstract */; } links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, @@ -60548,16 +61039,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node.escapedText === argumentsSymbol.escapedName && getReferencedValueSymbol(node) === argumentsSymbol; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && traverse(node.name); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return traverse(node.expression); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return traverse(node.initializer); default: return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse); @@ -60581,7 +61072,12 @@ var ts; continue; } } - result.push(getSignatureFromDeclaration(decl)); + // If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters. + // Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would supress checks that the two are compatible. + result.push((!ts.isFunctionExpressionOrArrowFunction(decl) && + !ts.isObjectLiteralMethod(decl) && + getSignatureOfTypeTag(decl)) || + getSignatureFromDeclaration(decl)); } return result; } @@ -60612,7 +61108,7 @@ var ts; else { var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration); var jsdocPredicate = void 0; - if (!type && ts.isInJSFile(signature.declaration)) { + if (!type) { var jsdocSignature = getSignatureOfTypeTag(signature.declaration); if (jsdocSignature && signature !== jsdocSignature) { jsdocPredicate = getTypePredicateOfSignature(jsdocSignature); @@ -60629,7 +61125,7 @@ var ts; function createTypePredicateFromTypePredicateNode(node, signature) { var parameterName = node.parameterName; var type = node.type && getTypeFromTypeNode(node.type); - return parameterName.kind === 192 /* SyntaxKind.ThisType */ ? + return parameterName.kind === 194 /* SyntaxKind.ThisType */ ? createTypePredicate(node.assertsModifier ? 2 /* TypePredicateKind.AssertsThis */ : 0 /* TypePredicateKind.This */, /*parameterName*/ undefined, /*parameterIndex*/ undefined, type) : createTypePredicate(node.assertsModifier ? 3 /* TypePredicateKind.AssertsIdentifier */ : 1 /* TypePredicateKind.Identifier */, parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type); } @@ -60675,7 +61171,7 @@ var ts; return signature.resolvedReturnType; } function getReturnTypeFromAnnotation(declaration) { - if (declaration.kind === 171 /* SyntaxKind.Constructor */) { + if (declaration.kind === 173 /* SyntaxKind.Constructor */) { return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)); } if (ts.isJSDocConstructSignature(declaration)) { @@ -60685,12 +61181,12 @@ var ts; if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration); if (jsDocType) { return jsDocType; } - var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 173 /* SyntaxKind.SetAccessor */); + var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 175 /* SyntaxKind.SetAccessor */); var setterType = getAnnotatedAccessorType(setter); if (setterType) { return setterType; @@ -60793,7 +61289,7 @@ var ts; if (!signature.isolatedSignatureType) { var kind = (_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind; // If declaration is undefined, it is likely to be the signature of the default constructor. - var isConstructor = kind === undefined || kind === 171 /* SyntaxKind.Constructor */ || kind === 175 /* SyntaxKind.ConstructSignature */ || kind === 180 /* SyntaxKind.ConstructorType */; + var isConstructor = kind === undefined || kind === 173 /* SyntaxKind.Constructor */ || kind === 177 /* SyntaxKind.ConstructSignature */ || kind === 182 /* SyntaxKind.ConstructorType */; var type = createObjectType(16 /* ObjectFlags.Anonymous */); type.members = emptySymbols; type.properties = ts.emptyArray; @@ -60820,7 +61316,7 @@ var ts; function getIndexInfosOfIndexSymbol(indexSymbol) { if (indexSymbol.declarations) { var indexInfos_4 = []; - var _loop_14 = function (declaration) { + var _loop_15 = function (declaration) { if (declaration.parameters.length === 1) { var parameter = declaration.parameters[0]; if (parameter.type) { @@ -60834,7 +61330,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_14(declaration); + _loop_15(declaration); } return indexInfos_4; } @@ -60851,14 +61347,14 @@ var ts; var _a; var inferences; if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) { - var _loop_15 = function (declaration) { - if (declaration.parent.kind === 190 /* SyntaxKind.InferType */) { + var _loop_16 = function (declaration) { + if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) { // When an 'infer T' declaration is immediately contained in a type reference node // (such as 'Foo'), T's constraint is inferred from the constraint of the // corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are // present, we form an intersection of the inferred constraint types. var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1]; - if (grandParent.kind === 178 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { + if (grandParent.kind === 180 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { var typeReference_1 = grandParent; var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1); if (typeParameters_1) { @@ -60885,27 +61381,27 @@ var ts; } // When an 'infer T' declaration is immediately contained in a rest parameter declaration, a rest type // or a named rest tuple element, we infer an 'unknown[]' constraint. - else if (grandParent.kind === 164 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || - grandParent.kind === 186 /* SyntaxKind.RestType */ || - grandParent.kind === 197 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { + else if (grandParent.kind === 166 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || + grandParent.kind === 188 /* SyntaxKind.RestType */ || + grandParent.kind === 199 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { inferences = ts.append(inferences, createArrayType(unknownType)); } // When an 'infer T' declaration is immediately contained in a string template type, we infer a 'string' // constraint. - else if (grandParent.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */) { + else if (grandParent.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */) { inferences = ts.append(inferences, stringType); } // When an 'infer T' declaration is in the constraint position of a mapped type, we infer a 'keyof any' // constraint. - else if (grandParent.kind === 163 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 195 /* SyntaxKind.MappedType */) { + else if (grandParent.kind === 165 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 197 /* SyntaxKind.MappedType */) { inferences = ts.append(inferences, keyofConstraintType); } // When an 'infer T' declaration is the template of a mapped type, and that mapped type is the extends // clause of a conditional whose check type is also a mapped type, give it a constraint equal to the template // of the check type's mapped type - else if (grandParent.kind === 195 /* SyntaxKind.MappedType */ && grandParent.type && - ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 189 /* SyntaxKind.ConditionalType */ && - grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 195 /* SyntaxKind.MappedType */ && + else if (grandParent.kind === 197 /* SyntaxKind.MappedType */ && grandParent.type && + ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 191 /* SyntaxKind.ConditionalType */ && + grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 197 /* SyntaxKind.MappedType */ && grandParent.parent.checkType.type) { var checkMappedType_1 = grandParent.parent.checkType; var nodeType = getTypeFromTypeNode(checkMappedType_1.type); @@ -60915,7 +61411,7 @@ var ts; }; for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - _loop_15(declaration); + _loop_16(declaration); } } return inferences && getIntersectionType(inferences); @@ -60937,7 +61433,7 @@ var ts; if (type.flags & 1 /* TypeFlags.Any */ && !isErrorType(type)) { // Allow errorType to propegate to keep downstream errors suppressed // use keyofConstraintType as the base constraint for mapped type key constraints (unknown isn;t assignable to that, but `any` was), // use unknown otherwise - type = constraintDeclaration.parent.parent.kind === 195 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; + type = constraintDeclaration.parent.parent.kind === 197 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; } typeParameter.constraint = type; } @@ -60946,7 +61442,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - var tp = ts.getDeclarationOfKind(typeParameter.symbol, 163 /* SyntaxKind.TypeParameter */); + var tp = ts.getDeclarationOfKind(typeParameter.symbol, 165 /* SyntaxKind.TypeParameter */); var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getEffectiveContainerForJSDocTemplateTag(tp.parent) : tp.parent; return host && getSymbolOfNode(host); } @@ -61032,8 +61528,8 @@ var ts; } var node = type.node; var typeArguments = !node ? ts.emptyArray : - node.kind === 178 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : - node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : + node.kind === 180 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : + node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); if (popTypeResolution()) { type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments; @@ -61075,7 +61571,7 @@ var ts; return errorType; } } - if (node.kind === 178 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { return createDeferredTypeReference(type, node, /*mapper*/ undefined); } // In a type reference, the outer type parameters of the referenced class or interface are automatically @@ -61146,9 +61642,9 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -61163,13 +61659,13 @@ var ts; return symbol.parent ? "".concat(getSymbolPath(symbol.parent), ".").concat(symbol.escapedName) : symbol.escapedName; } function getUnresolvedSymbolForEntityName(name) { - var identifier = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? name.name : + var identifier = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? name.name : name; var text = identifier.escapedText; if (text) { - var parentSymbol = name.kind === 161 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : + var parentSymbol = name.kind === 163 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : undefined; var path = parentSymbol ? "".concat(getSymbolPath(parentSymbol), ".").concat(text) : text; var result = unresolvedSymbols.get(path); @@ -61230,7 +61726,7 @@ var ts; var valueType = getTypeOfSymbol(symbol); var typeType = valueType; if (symbol.valueDeclaration) { - var isImportTypeWithQualifier = node.kind === 200 /* SyntaxKind.ImportType */ && node.qualifier; + var isImportTypeWithQualifier = node.kind === 202 /* SyntaxKind.ImportType */ && node.qualifier; // valueType might not have a symbol, eg, {import('./b').STRING_LITERAL} if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) { typeType = getTypeReferenceType(node, valueType.symbol); @@ -61240,23 +61736,27 @@ var ts; } return links.resolvedJSDocType; } - function getSubstitutionType(baseType, substitute) { - if (substitute.flags & 3 /* TypeFlags.AnyOrUnknown */ || substitute === baseType) { + function getSubstitutionType(baseType, constraint) { + if (constraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || constraint === baseType || + !isGenericType(baseType) && !isGenericType(constraint)) { return baseType; } - var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(substitute)); + var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(constraint)); var cached = substitutionTypes.get(id); if (cached) { return cached; } var result = createType(33554432 /* TypeFlags.Substitution */); result.baseType = baseType; - result.substitute = substitute; + result.constraint = constraint; substitutionTypes.set(id, result); return result; } + function getSubstitutionIntersection(substitutionType) { + return getIntersectionType([substitutionType.constraint, substitutionType.baseType]); + } function isUnaryTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 1; + return node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 1; } function getImpliedConstraint(type, checkNode, extendsNode) { return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) : @@ -61266,16 +61766,16 @@ var ts; function getConditionalFlowTypeOfType(type, node) { var constraints; var covariant = true; - while (node && !ts.isStatement(node) && node.kind !== 320 /* SyntaxKind.JSDoc */) { + while (node && !ts.isStatement(node) && node.kind !== 323 /* SyntaxKind.JSDoc */) { var parent = node.parent; // only consider variance flipped by parameter locations - `keyof` types would usually be considered variance inverting, but // often get used in indexed accesses where they behave sortof invariantly, but our checking is lax - if (parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 166 /* SyntaxKind.Parameter */) { covariant = !covariant; } // Always substitute on type parameters, regardless of variance, since even // in contravariant positions, they may rely on substituted constraints to be valid - if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 189 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { + if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 191 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { var constraint = getImpliedConstraint(type, parent.checkType, parent.extendsType); if (constraint) { constraints = ts.append(constraints, constraint); @@ -61283,7 +61783,7 @@ var ts; } // Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the // template type XXX, K has an added constraint of number | `${number}`. - else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 195 /* SyntaxKind.MappedType */ && node === parent.type) { + else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 197 /* SyntaxKind.MappedType */ && node === parent.type) { var mappedType = getTypeFromTypeNode(parent); if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { var typeParameter = getHomomorphicTypeVariable(mappedType); @@ -61297,10 +61797,10 @@ var ts; } node = parent; } - return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type; + return constraints ? getSubstitutionType(type, getIntersectionType(constraints)) : type; } function isJSDocTypeReference(node) { - return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 200 /* SyntaxKind.ImportType */); + return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 202 /* SyntaxKind.ImportType */); } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { @@ -61415,9 +61915,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declaration; } } @@ -61568,6 +62068,13 @@ var ts; function getGlobalBigIntType() { return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType; } + function getGlobalNaNSymbol() { + return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false))); + } + function getGlobalRecordSymbol() { + deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol); + return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol; + } /** * Instantiates a global type that is generic with some element type, and returns that instantiation. */ @@ -61585,11 +62092,11 @@ var ts; } function getTupleElementFlags(node) { switch (node.kind) { - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return 2 /* ElementFlags.Optional */; - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getRestTypeElementFlags(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return node.questionToken ? 2 /* ElementFlags.Optional */ : node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* ElementFlags.Required */; @@ -61607,14 +62114,14 @@ var ts; return readonly ? globalReadonlyArrayType : globalArrayType; } var elementFlags = ts.map(node.elements, getTupleElementFlags); - var missingName = ts.some(node.elements, function (e) { return e.kind !== 197 /* SyntaxKind.NamedTupleMember */; }); + var missingName = ts.some(node.elements, function (e) { return e.kind !== 199 /* SyntaxKind.NamedTupleMember */; }); return getTupleTargetType(elementFlags, readonly, /*associatedNames*/ missingName ? undefined : node.elements); } // Return true if the given type reference node is directly aliased or if it needs to be deferred // because it is possibly contained in a circular chain of eagerly resolved types. function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) { - return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 183 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : - node.kind === 184 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : + return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 185 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : + node.kind === 186 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || ts.some(node.typeArguments, mayResolveTypeAlias)); } // Return true when the given node is transitively contained in type constructs that eagerly @@ -61623,18 +62130,18 @@ var ts; function isResolvedByTypeAlias(node) { var parent = node.parent; switch (parent.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 189 /* SyntaxKind.ConditionalType */: - case 193 /* SyntaxKind.TypeOperator */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 191 /* SyntaxKind.ConditionalType */: + case 195 /* SyntaxKind.TypeOperator */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return isResolvedByTypeAlias(parent); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } return false; @@ -61643,28 +62150,28 @@ var ts; // of a type alias. function mayResolveTypeAlias(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */).flags & 524288 /* SymbolFlags.TypeAlias */); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return true; - case 193 /* SyntaxKind.TypeOperator */: - return node.operator !== 154 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 195 /* SyntaxKind.TypeOperator */: + return node.operator !== 156 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 319 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return mayResolveTypeAlias(node.type); - case 186 /* SyntaxKind.RestType */: - return node.type.kind !== 183 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 188 /* SyntaxKind.RestType */: + return node.type.kind !== 185 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return ts.some(node.types, mayResolveTypeAlias); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return mayResolveTypeAlias(node.checkType) || mayResolveTypeAlias(node.extendsType) || mayResolveTypeAlias(node.trueType) || mayResolveTypeAlias(node.falseType); } @@ -61677,19 +62184,19 @@ var ts; if (target === emptyGenericType) { links.resolvedType = emptyObjectType; } - else if (!(node.kind === 184 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { - links.resolvedType = node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : + else if (!(node.kind === 186 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { + links.resolvedType = node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : createDeferredTypeReference(target, node, /*mapper*/ undefined); } else { - var elementTypes = node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); + var elementTypes = node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); links.resolvedType = createNormalizedTypeReference(target, elementTypes); } } return links.resolvedType; } function isReadonlyTypeOperator(node) { - return ts.isTypeOperatorNode(node) && node.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + return ts.isTypeOperatorNode(node) && node.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } function createTupleType(elementTypes, elementFlags, readonly, namedMemberDeclarations) { if (readonly === void 0) { readonly = false; } @@ -61804,7 +62311,7 @@ var ts; var lastRequiredIndex = -1; var firstRestIndex = -1; var lastOptionalOrRestIndex = -1; - var _loop_16 = function (i) { + var _loop_17 = function (i) { var type = elementTypes[i]; var flags = target.elementFlags[i]; if (flags & 8 /* ElementFlags.Variadic */) { @@ -61834,9 +62341,9 @@ var ts; } }; for (var i = 0; i < elementTypes.length; i++) { - var state_4 = _loop_16(i); - if (typeof state_4 === "object") - return state_4.value; + var state_5 = _loop_17(i); + if (typeof state_5 === "object") + return state_5.value; } // Turn optional elements preceding the last required element into required elements for (var i = 0; i < lastRequiredIndex; i++) { @@ -61864,7 +62371,7 @@ var ts; if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) { lastOptionalOrRestIndex = expandedFlags.length; } - expandedTypes.push(type); + expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type); expandedFlags.push(flags); if (expandedDeclarations && declaration) { expandedDeclarations.push(declaration); @@ -62030,7 +62537,7 @@ var ts; var templates = ts.filter(types, isPatternLiteralType); if (templates.length) { var i = types.length; - var _loop_17 = function () { + var _loop_18 = function () { i--; var t = types[i]; if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) { @@ -62038,7 +62545,7 @@ var ts; } }; while (i > 0) { - _loop_17(); + _loop_18(); } } } @@ -62115,14 +62622,14 @@ var ts; var namedUnions = []; addNamedUnions(namedUnions, types); var reducedTypes = []; - var _loop_18 = function (t) { + var _loop_19 = function (t) { if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) { reducedTypes.push(t); } }; for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) { var t = typeSet_1[_i]; - _loop_18(t); + _loop_19(t); } if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) { return namedUnions[0]; @@ -62612,7 +63119,7 @@ var ts; type.flags & 16777216 /* TypeFlags.Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* TypeFlags.UnionOrIntersection */ | 134217728 /* TypeFlags.TemplateLiteral */) ? ts.every(type.types, isDistributive) : type.flags & 8388608 /* TypeFlags.IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.substitute) : + type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* TypeFlags.StringMapping */ ? isDistributive(type.type) : false; } @@ -62693,15 +63200,15 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { switch (node.operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); break; - case 154 /* SyntaxKind.UniqueKeyword */: - links.resolvedType = node.type.kind === 151 /* SyntaxKind.SymbolKeyword */ + case 156 /* SyntaxKind.UniqueKeyword */: + links.resolvedType = node.type.kind === 153 /* SyntaxKind.SymbolKeyword */ ? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent)) : errorType; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: links.resolvedType = getTypeFromTypeNode(node.type); break; default: @@ -62737,8 +63244,14 @@ var ts; return getStringLiteralType(text); } newTexts.push(text); - if (ts.every(newTexts, function (t) { return t === ""; }) && ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) { - return stringType; + if (ts.every(newTexts, function (t) { return t === ""; })) { + if (ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) { + return stringType; + } + // Normalize `${Mapping}` into Mapping + if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) { + return newTypes[0]; + } } var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join("")); var type = templateLiteralTypes.get(id); @@ -62797,12 +63310,14 @@ var ts; } function getStringMappingType(symbol, type) { return type.flags & (1048576 /* TypeFlags.Union */ | 131072 /* TypeFlags.Never */) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) : - // Mapping> === Mapping - type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type : - isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456 /* TypeFlags.StringMapping */) ? getTemplateLiteralType(["", ""], [type]) : type) : - type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : - type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) : - type; + type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : + type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) : + // Mapping> === Mapping + type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type : + type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 268435456 /* TypeFlags.StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : + // This handles Mapping<`${number}`> and Mapping<`${bigint}`> + isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) : + type; } function applyStringMapping(symbol, str) { switch (intrinsicTypeKinds.get(symbol.escapedName)) { @@ -62893,7 +63408,7 @@ var ts; } function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, accessNode, accessFlags) { var _a; - var accessExpression = accessNode && accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; var propName = accessNode && ts.isPrivateIdentifier(accessNode) ? undefined : getPropertyNameFromIndex(indexType, accessNode); if (propName !== undefined) { if (accessFlags & 256 /* AccessFlags.Contextual */) { @@ -62967,7 +63482,18 @@ var ts; return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; } errorIfWritingToReadonlyIndex(indexInfo); - return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; + // When accessing an enum object with its own type, + // e.g. E[E.A] for enum E { A }, undefined shouldn't + // be included in the result type + if ((accessFlags & 1 /* AccessFlags.IncludeUndefined */) && + !(objectType.symbol && + objectType.symbol.flags & (256 /* SymbolFlags.RegularEnum */ | 128 /* SymbolFlags.ConstEnum */) && + (indexType.symbol && + indexType.flags & 1024 /* TypeFlags.EnumLiteral */ && + getParentOfSymbol(indexType.symbol) === objectType.symbol))) { + return getUnionType([indexInfo.type, undefinedType]); + } + return indexInfo.type; } if (indexType.flags & 131072 /* TypeFlags.Never */) { return neverType; @@ -63064,16 +63590,17 @@ var ts; } } function getIndexNodeForAccessExpression(accessNode) { - return accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : - accessNode.kind === 194 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : - accessNode.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : + return accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : + accessNode.kind === 196 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : + accessNode.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : accessNode; } function isPatternLiteralPlaceholderType(type) { - return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || !!(type.flags & 268435456 /* TypeFlags.StringMapping */ && isPatternLiteralPlaceholderType(type.type)); + return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || isPatternLiteralType(type); } function isPatternLiteralType(type) { - return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType); + return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType) || + !!(type.flags & 268435456 /* TypeFlags.StringMapping */) && isPatternLiteralPlaceholderType(type.type); } function isGenericType(type) { return !!getGenericObjectFlags(type); @@ -63095,7 +63622,7 @@ var ts; if (type.flags & 33554432 /* TypeFlags.Substitution */) { if (!(type.objectFlags & 2097152 /* ObjectFlags.IsGenericTypeComputed */)) { type.objectFlags |= 2097152 /* ObjectFlags.IsGenericTypeComputed */ | - getGenericObjectFlags(type.substitute) | getGenericObjectFlags(type.baseType); + getGenericObjectFlags(type.baseType) | getGenericObjectFlags(type.constraint); } return type.objectFlags & 12582912 /* ObjectFlags.IsGenericType */; } @@ -63246,7 +63773,7 @@ var ts; // for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved // eagerly using the constraint type of 'this' at the given location. - if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 194 /* SyntaxKind.IndexedAccessType */ ? + if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 196 /* SyntaxKind.IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) { if (objectType.flags & 3 /* TypeFlags.AnyOrUnknown */) { @@ -63298,11 +63825,7 @@ var ts; var objectType = getTypeFromTypeNode(node.objectType); var indexType = getTypeFromTypeNode(node.indexType); var potentialAlias = getAliasSymbolForTypeNode(node); - var resolved = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); - links.resolvedType = resolved.flags & 8388608 /* TypeFlags.IndexedAccess */ && - resolved.objectType === objectType && - resolved.indexType === indexType ? - getConditionalFlowTypeOfType(resolved, node) : resolved; + links.resolvedType = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); } return links.resolvedType; } @@ -63356,18 +63879,23 @@ var ts; var result; var extraTypes; var tailCount = 0; - var _loop_19 = function () { + // We loop here for an immediately nested conditional type in the false position, effectively treating + // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for + // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of + // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive + // cases we increment the tail recursion counter and stop after 1000 iterations. + while (true) { if (tailCount === 1000) { error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); result = errorType; - return "break"; + break; } var isUnwrapped = isTypicalNondistributiveConditional(root); var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper); var checkTypeInstantiable = isGenericType(checkType); var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper); if (checkType === wildcardType || extendsType === wildcardType) { - return { value: wildcardType }; + return wildcardType; } var combinedMapper = void 0; if (root.inferTypeParameters) { @@ -63400,11 +63928,7 @@ var ts; } } } - // We skip inference of the possible `infer` types unles the `extendsType` _is_ an infer type - // if it was, it's trivial to say that extendsType = checkType, however such a pattern is used to - // "reset" the type being build up during constraint calculation and avoid making an apparently "infinite" constraint - // so in those cases we refain from performing inference and retain the uninfered type parameter - if (!checkTypeInstantiable || !ts.some(root.inferTypeParameters, function (t) { return t === extendsType; })) { + if (!checkTypeInstantiable) { // We don't want inferences from constraints as they may cause us to eagerly resolve the // conditional type instead of deferring resolution. Also, we always want strict function // types rules (i.e. proper contravariance) for inferences. @@ -63436,14 +63960,14 @@ var ts; var newRoot = falseType_1.root; if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) { root = newRoot; - return "continue"; + continue; } if (canTailRecurse(falseType_1, mapper)) { - return "continue"; + continue; } } result = instantiateType(falseType_1, mapper); - return "break"; + break; } // Return trueType for a definitely true extends check. We check instantiations of the two // types with type parameters mapped to their restrictive form, i.e. a form of the type parameter @@ -63454,10 +63978,10 @@ var ts; var trueType_1 = getTypeFromTypeNode(root.node.trueType); var trueMapper = combinedMapper || mapper; if (canTailRecurse(trueType_1, trueMapper)) { - return "continue"; + continue; } result = instantiateType(trueType_1, trueMapper); - return "break"; + break; } } // Return a deferred type for a check that is neither definitely true nor definitely false @@ -63469,19 +63993,7 @@ var ts; result.combinedMapper = combinedMapper; result.aliasSymbol = aliasSymbol || root.aliasSymbol; result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217 - return "break"; - }; - // We loop here for an immediately nested conditional type in the false position, effectively treating - // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for - // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of - // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive - // cases we increment the tail recursion counter and stop after 1000 iterations. - while (true) { - var state_5 = _loop_19(); - if (typeof state_5 === "object") - return state_5.value; - if (state_5 === "break") - break; + break; } return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result; // We tail-recurse for generic conditional types that (a) have not already been evaluated and cached, and @@ -63673,7 +64185,7 @@ var ts; } function getAliasSymbolForTypeNode(node) { var host = node.parent; - while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { host = host.parent; } return ts.isTypeAlias(host) ? getSymbolOfNode(host) : undefined; @@ -63918,7 +64430,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */)) { if (!ts.isStatic(container) && (!ts.isConstructorDeclaration(container) || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -63953,17 +64465,17 @@ var ts; } function getArrayElementTypeNode(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return getArrayElementTypeNode(node.type); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: if (node.elements.length === 1) { node = node.elements[0]; - if (node.kind === 186 /* SyntaxKind.RestType */ || node.kind === 197 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { + if (node.kind === 188 /* SyntaxKind.RestType */ || node.kind === 199 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { return getArrayElementTypeNode(node.type); } } break; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return node.elementType; } return undefined; @@ -63979,99 +64491,99 @@ var ts; } function getTypeFromTypeNodeWorker(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 131 /* SyntaxKind.AnyKeyword */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return anyType; - case 155 /* SyntaxKind.UnknownKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return unknownType; - case 150 /* SyntaxKind.StringKeyword */: + case 152 /* SyntaxKind.StringKeyword */: return stringType; - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return numberType; - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return bigintType; - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return booleanType; - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return esSymbolType; case 114 /* SyntaxKind.VoidKeyword */: return voidType; - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return undefinedType; case 104 /* SyntaxKind.NullKeyword */: // TODO(rbuckton): `NullKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service. return nullType; - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return neverType; - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return node.flags & 262144 /* NodeFlags.JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType; - case 138 /* SyntaxKind.IntrinsicKeyword */: + case 139 /* SyntaxKind.IntrinsicKeyword */: return intrinsicMarkerType; - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: // TODO(rbuckton): `ThisKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service and because of `isPartOfTypeNode`. return getTypeFromThisTypeNode(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return getTypeFromLiteralTypeNode(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getTypeFromTypeReference(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? voidType : booleanType; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return getTypeFromTypeQueryNode(node); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return getTypeFromArrayOrTupleTypeNode(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return getTypeFromOptionalTypeNode(node); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return getTypeFromUnionTypeNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return addOptionality(getTypeFromTypeNode(node.type)); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return getTypeFromNamedTupleTypeNode(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return getTypeFromTypeNode(node.type); - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getTypeFromRestTypeNode(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return getTypeFromMappedTypeNode(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getTypeFromConditionalTypeNode(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return getTypeFromInferTypeNode(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return getTypeFromTemplateTypeNode(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return getTypeFromImportTypeNode(node); // This function assumes that an identifier, qualified name, or property access expression is a type expression // Callers should first ensure this by calling `isPartOfTypeNode` // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var symbol = getSymbolAtLocation(node); return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; default: @@ -64178,8 +64690,8 @@ var ts; return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* TypeMapKind.Merged */, mapper, makeUnaryTypeMapper(source, target)); } function getRestrictiveTypeParameter(tp) { - return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), - tp.restrictiveInstantiation.constraint = unknownType, + return !tp.constraint && !getConstraintDeclaration(tp) || tp.constraint === noConstraintType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), + tp.restrictiveInstantiation.constraint = noConstraintType, tp.restrictiveInstantiation); } function cloneTypeParameter(typeParameter) { @@ -64293,17 +64805,18 @@ var ts; return type; } function maybeTypeParameterReference(node) { - return !(node.parent.kind === 178 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || - node.parent.kind === 200 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); + return !(node.parent.kind === 180 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || + node.parent.kind === 202 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); } function isTypeParameterPossiblyReferenced(tp, node) { - // If the type parameter doesn't have exactly one declaration, if there are invening statement blocks + // If the type parameter doesn't have exactly one declaration, if there are intervening statement blocks // between the node and the type parameter declaration, if the node contains actual references to the - // type parameter, or if the node contains type queries, we consider the type parameter possibly referenced. + // type parameter, or if the node contains type queries that we can't prove couldn't contain references to the type parameter, + // we consider the type parameter possibly referenced. if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container = tp.symbol.declarations[0].parent; for (var n = node; n !== container; n = n.parent) { - if (!n || n.kind === 235 /* SyntaxKind.Block */ || n.kind === 189 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { + if (!n || n.kind === 238 /* SyntaxKind.Block */ || n.kind === 191 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { return true; } } @@ -64312,15 +64825,36 @@ var ts; return true; function containsReference(node) { switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return !!tp.isThisType; case 79 /* SyntaxKind.Identifier */: return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && getTypeFromTypeNodeWorker(node) === tp; // use worker because we're looking for === equality - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: + var entityName = node.exprName; + var firstIdentifier = ts.getFirstIdentifier(entityName); + var firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); + var tpDeclaration = tp.symbol.declarations[0]; // There is exactly one declaration, otherwise `containsReference` is not called + var tpScope_1; + if (tpDeclaration.kind === 165 /* SyntaxKind.TypeParameter */) { // Type parameter is a regular type parameter, e.g. foo + tpScope_1 = tpDeclaration.parent; + } + else if (tp.isThisType) { + // Type parameter is the this type, and its declaration is the class declaration. + tpScope_1 = tpDeclaration; + } + else { + // Type parameter's declaration was unrecognized. + // This could happen if the type parameter comes from e.g. a JSDoc annotation, so we default to returning true. + return true; + } + if (firstIdentifierSymbol.declarations) { + return ts.some(firstIdentifierSymbol.declarations, function (idDecl) { return ts.isNodeDescendantOf(idDecl, tpScope_1); }) || + ts.some(node.typeArguments, containsReference); + } return true; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return !node.type && !!node.body || ts.some(node.typeParameters, containsReference) || ts.some(node.parameters, containsReference) || @@ -64542,17 +65076,18 @@ var ts; return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments); } if (flags & 33554432 /* TypeFlags.Substitution */) { - var maybeVariable = instantiateType(type.baseType, mapper); - if (maybeVariable.flags & 8650752 /* TypeFlags.TypeVariable */) { - return getSubstitutionType(maybeVariable, instantiateType(type.substitute, mapper)); + var newBaseType = instantiateType(type.baseType, mapper); + var newConstraint = instantiateType(type.constraint, mapper); + // A substitution type originates in the true branch of a conditional type and can be resolved + // to just the base type in the same cases as the conditional type resolves to its true branch + // (because the base type is then known to satisfy the constraint). + if (newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ && isGenericType(newConstraint)) { + return getSubstitutionType(newBaseType, newConstraint); } - else { - var sub = instantiateType(type.substitute, mapper); - if (sub.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) { - return maybeVariable; - } - return sub; + if (newConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(newBaseType), getRestrictiveInstantiation(newConstraint))) { + return newBaseType; } + return newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); } return type; } @@ -64601,35 +65136,35 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type return isContextSensitiveFunctionLikeDeclaration(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return ts.some(node.properties, isContextSensitive); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return ts.some(node.elements, isContextSensitive); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return isContextSensitive(node.initializer); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isContextSensitive(node.expression); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive); - case 285 /* SyntaxKind.JsxAttribute */: { + case 288 /* SyntaxKind.JsxAttribute */: { // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. var initializer = node.initializer; return !!initializer && isContextSensitive(initializer); } - case 288 /* SyntaxKind.JsxExpression */: { + case 291 /* SyntaxKind.JsxExpression */: { // It is possible to that node.expression is undefined (e.g
) var expression = node.expression; return !!expression && isContextSensitive(expression); @@ -64638,15 +65173,14 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return (!ts.isFunctionDeclaration(node) || ts.isInJSFile(node) && !!getTypeForDeclarationFromJSDocComment(node)) && - (ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node)); + return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node); } function hasContextSensitiveReturnExpression(node) { // TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value. - return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 /* SyntaxKind.Block */ && isContextSensitive(node.body); + return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 238 /* SyntaxKind.Block */ && isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { - return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && + return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { @@ -64747,23 +65281,23 @@ var ts; return true; } switch (node.kind) { - case 288 /* SyntaxKind.JsxExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 27 /* SyntaxKind.CommaToken */: return elaborateError(node.right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); } break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer); } return false; @@ -64972,7 +65506,7 @@ var ts; } function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) { switch (child.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: // child is of the type of the expression return { errorNode: child, innerExpression: child.expression, nameType: nameType }; case 11 /* SyntaxKind.JsxText */: @@ -64981,9 +65515,9 @@ var ts; } // child is a string return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() }; - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: // child is of type JSX.Element return { errorNode: child, innerExpression: child, nameType: nameType }; default: @@ -65131,11 +65665,11 @@ var ts; } _b = prop.kind; switch (_b) { - case 173 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; - case 172 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; - case 169 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; - case 296 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; + case 175 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; + case 174 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; + case 171 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; + case 299 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; } return [3 /*break*/, 6]; case 2: return [4 /*yield*/, { errorNode: prop.name, innerExpression: undefined, nameType: type }]; @@ -65208,8 +65742,8 @@ var ts; void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers); } var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; - var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 169 /* SyntaxKind.MethodDeclaration */ && - kind !== 168 /* SyntaxKind.MethodSignature */ && kind !== 171 /* SyntaxKind.Constructor */; + var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 171 /* SyntaxKind.MethodDeclaration */ && + kind !== 170 /* SyntaxKind.MethodSignature */ && kind !== 173 /* SyntaxKind.Constructor */; var result = -1 /* Ternary.True */; var sourceThisType = getThisTypeOfSignature(source); if (sourceThisType && sourceThisType !== voidType) { @@ -65506,7 +66040,7 @@ var ts; var t = isFreshLiteralType(type) ? type.regularType : ts.getObjectFlags(type) & 4 /* ObjectFlags.Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* TypeFlags.UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : type.substitute : + type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* TypeFlags.Simplifiable */ ? getSimplifiedType(type, writing) : type; if (t === type) @@ -65913,7 +66447,8 @@ var ts; return 0 /* Ternary.False */; } } - var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2 /* IntersectionState.Target */) && + var isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source)) && + !(intersectionState & 2 /* IntersectionState.Target */) && source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType && target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) && (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)); @@ -65940,27 +66475,6 @@ var ts; var result_7 = skipCaching ? unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) : recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags); - // For certain combinations involving intersections and optional, excess, or mismatched properties we need - // an extra property check where the intersection is viewed as a single object. The following are motivating - // examples that all should be errors, but aren't without this extra property check: - // - // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property - // - // declare let wrong: { a: { y: string } }; - // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type - // - // function foo(x: { a?: string }, y: T & { a: boolean }) { - // x = y; // Mismatched property in source intersection - // } - // - // We suppress recursive intersection property checks because they can generate lots of work when relating - // recursive intersections that are structurally similar but not exactly identical. See #37854. - if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) || - isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) { - inPropertyCheck = true; - result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* IntersectionState.PropertyCheck */, recursionFlags); - inPropertyCheck = false; - } if (result_7) { return result_7; } @@ -66165,11 +66679,15 @@ var ts; // parameter 'T extends 1 | 2', the intersection 'T & 1' should be reduced to '1' such that it doesn't // appear to be comparable to '2'. if (relation === comparableRelation && target.flags & 131068 /* TypeFlags.Primitive */) { - var constraints = ts.sameMap(source.types, getBaseConstraintOrType); + var constraints = ts.sameMap(source.types, function (t) { return t.flags & 465829888 /* TypeFlags.Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t; }); if (constraints !== source.types) { source = getIntersectionType(constraints); + if (source.flags & 131072 /* TypeFlags.Never */) { + return 0 /* Ternary.False */; + } if (!(source.flags & 2097152 /* TypeFlags.Intersection */)) { - return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); + return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false) || + isRelatedTo(target, source, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); } } } @@ -66354,8 +66872,7 @@ var ts; if (overflow) { return 0 /* Ternary.False */; } - var keyIntersectionState = intersectionState | (inPropertyCheck ? 8 /* IntersectionState.InPropertyCheck */ : 0); - var id = getRelationKey(source, target, keyIntersectionState, relation, /*ingnoreConstraints*/ false); + var id = getRelationKey(source, target, intersectionState, relation, /*ingnoreConstraints*/ false); var entry = relation.get(id); if (entry !== undefined) { if (reportErrors && entry & 2 /* RelationComparisonResult.Failed */ && !(entry & 4 /* RelationComparisonResult.Reported */)) { @@ -66385,7 +66902,7 @@ var ts; // A key that starts with "*" is an indication that we have type references that reference constrained // type parameters. For such keys we also check against the key we would have gotten if all type parameters // were unconstrained. - var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, /*ignoreConstraints*/ true) : undefined; + var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, intersectionState, relation, /*ignoreConstraints*/ true) : undefined; for (var i = 0; i < maybeCount; i++) { // If source and target are already being compared, consider them related with assumptions if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) { @@ -66472,7 +66989,7 @@ var ts; function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) { var saveErrorInfo = captureErrorCalculationState(); var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo); - if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) { + if (relation !== identityRelation) { // The combined constraint of an intersection type is the intersection of the constraints of // the constituents. When an intersection type contains instantiable types with union type // constraints, there are situations where we need to examine the combined constraint. One is @@ -66486,10 +67003,33 @@ var ts; // needs to have its constraint hoisted into an intersection with said type parameter, this way // the type param can be compared with itself in the target (with the influence of its constraint to match other parts) // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)` - var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */)); - if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself - // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this - result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); + if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) { + var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */)); + if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself + // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this + result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); + } + } + // For certain combinations involving intersections and optional, excess, or mismatched properties we need + // an extra property check where the intersection is viewed as a single object. The following are motivating + // examples that all should be errors, but aren't without this extra property check: + // + // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property + // + // declare let wrong: { a: { y: string } }; + // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type + // + // function foo(x: { a?: string }, y: T & { a: boolean }) { + // x = y; // Mismatched property in source intersection + // } + // + // We suppress recursive intersection property checks because they can generate lots of work when relating + // recursive intersections that are structurally similar but not exactly identical. See #37854. + if (result && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && !isGenericObjectType(target) && source.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) || + isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) { + inPropertyCheck = true; + result &= propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */); + inPropertyCheck = false; } } if (result) { @@ -66498,9 +67038,6 @@ var ts; return result; } function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) { - if (intersectionState & 4 /* IntersectionState.PropertyCheck */) { - return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */); - } var result; var originalErrorInfo; var varianceCheckFailed = false; @@ -66539,7 +67076,11 @@ var ts; } } if (sourceFlags & 33554432 /* TypeFlags.Substitution */) { - return isRelatedTo(source.substitute, target.substitute, 3 /* RecursionFlags.Both */, /*reportErrors*/ false); + if (result = isRelatedTo(source.baseType, target.baseType, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + if (result &= isRelatedTo(source.constraint, target.constraint, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + return result; + } + } } if (!(sourceFlags & 524288 /* TypeFlags.Object */)) { return 0 /* Ternary.False */; @@ -66597,7 +67138,7 @@ var ts; // with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!) var constraint = getConstraintOfTypeParameter(source); if (constraint && hasNonCircularBaseConstraint(source)) { - while (constraint && constraint.flags & 262144 /* TypeFlags.TypeParameter */) { + while (constraint && someType(constraint, function (c) { return !!(c.flags & 262144 /* TypeFlags.TypeParameter */); })) { if (result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false)) { return result; } @@ -67253,7 +67794,7 @@ var ts; return 0 /* Ternary.False */; } // When checking for comparability, be more lenient with optional properties. - if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) { + if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && targetProp.flags & 106500 /* SymbolFlags.ClassMember */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) { // TypeScript 1.0 spec (April 2014): 3.8.3 // S is a subtype of a type T, and T is a supertype of S if ... // S' and T are object types and, for each member M in T.. @@ -67291,7 +67832,7 @@ var ts; shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it } if (props.length === 1) { - var propName = symbolToString(unmatchedProperty); + var propName = symbolToString(unmatchedProperty, /*enclosingDeclaration*/ undefined, 0 /* SymbolFlags.None */, 4 /* SymbolFormatFlags.AllowAnyNodeKind */ | 16 /* SymbolFormatFlags.WriteComputedProps */); reportError.apply(void 0, __spreadArray([ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName], getTypeNamesForErrorDisplay(source, target), false)); if (ts.length(unmatchedProperty.declarations)) { associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName)); @@ -67540,7 +68081,7 @@ var ts; var targetSignature = ts.first(targetSignatures); result = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors, incompatibleReporter(sourceSignature, targetSignature)); if (!result && reportErrors && kind === 1 /* SignatureKind.Construct */ && (sourceObjectFlags & targetObjectFlags) && - (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 171 /* SyntaxKind.Constructor */)) { + (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 173 /* SyntaxKind.Constructor */)) { var constructSignatureToString = function (signature) { return signatureToString(signature, /*enclosingDeclaration*/ undefined, 262144 /* TypeFormatFlags.WriteArrowStyleSignature */, kind); }; @@ -68305,7 +68846,7 @@ var ts; var baseTypeNode = getBaseTypeNodeOfClass(target); // A base type expression may circularly reference the class itself (e.g. as an argument to function call), so we only // check for base types specified as simple qualified names. - if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 206 /* SyntaxKind.PropertyAccessExpression */) { + if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 208 /* SyntaxKind.PropertyAccessExpression */) { return undefined; } } @@ -68353,8 +68894,7 @@ var ts; return !!(type.flags & 109440 /* TypeFlags.Unit */); } function isUnitLikeType(type) { - return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.some(type.types, isUnitType) : - !!(type.flags & 109440 /* TypeFlags.Unit */); + return isUnitType(getBaseConstraintOrType(type)); } function extractUnitType(type) { return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.find(type.types, isUnitType) || type : type; @@ -68396,7 +68936,7 @@ var ts; if (!isLiteralOfContextualType(type, contextualType)) { type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type)); } - return type; + return getRegularTypeOfLiteralType(type); } function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) { if (type && isUnitType(type)) { @@ -68491,7 +69031,8 @@ var ts; function getOptionalType(type, isProperty) { if (isProperty === void 0) { isProperty = false; } ts.Debug.assert(strictNullChecks); - return type.flags & 32768 /* TypeFlags.Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]); + var missingOrUndefined = isProperty ? missingType : undefinedType; + return type.flags & 32768 /* TypeFlags.Undefined */ || type.flags & 1048576 /* TypeFlags.Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); } function getGlobalNonNullableTypeInstantiation(type) { if (!deferredGlobalNonNullableTypeAlias) { @@ -68780,12 +69321,12 @@ var ts; } var diagnostic; switch (declaration.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 223 /* SyntaxKind.BinaryExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: var param = declaration; if (ts.isIdentifier(param.name) && (ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) && @@ -68801,23 +69342,23 @@ var ts; noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; if (!noImplicitAny) { // Don't issue a suggestion for binding elements since the codefix doesn't yet support them. return; } break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (noImplicitAny && !declaration.name) { if (wideningKind === 3 /* WideningKind.GeneratorYield */) { error(declaration, ts.Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); @@ -68831,7 +69372,7 @@ var ts; wideningKind === 3 /* WideningKind.GeneratorYield */ ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type : ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: if (noImplicitAny) { error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); } @@ -68948,7 +69489,7 @@ var ts; if (context.intraExpressionInferenceSites) { for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) { var _b = _a[_i], node = _b.node, type = _b.type; - var contextualType = node.kind === 169 /* SyntaxKind.MethodDeclaration */ ? + var contextualType = node.kind === 171 /* SyntaxKind.MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* ContextFlags.NoConstraints */) : getContextualType(node, 2 /* ContextFlags.NoConstraints */); if (contextualType) { @@ -69011,8 +69552,8 @@ var ts; } function isNonGenericTopLevelType(type) { if (type.aliasSymbol && !type.aliasTypeArguments) { - var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 259 /* SyntaxKind.TypeAliasDeclaration */); - return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 305 /* SyntaxKind.SourceFile */ ? true : n.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); + var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 262 /* SyntaxKind.TypeAliasDeclaration */); + return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 308 /* SyntaxKind.SourceFile */ ? true : n.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); } return false; } @@ -69232,7 +69773,7 @@ var ts; && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) })); } function isMemberOfStringMapping(source, target) { - if (target.flags & (4 /* TypeFlags.String */ | 3 /* TypeFlags.AnyOrUnknown */)) { + if (target.flags & (4 /* TypeFlags.String */ | 1 /* TypeFlags.Any */)) { return true; } if (target.flags & 134217728 /* TypeFlags.TemplateLiteral */) { @@ -69546,7 +70087,7 @@ var ts; } else if (source.flags & 33554432 /* TypeFlags.Substitution */) { inferFromTypes(source.baseType, target); - inferWithPriority(source.substitute, target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority + inferWithPriority(getSubstitutionIntersection(source), target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority } else if (target.flags & 16777216 /* TypeFlags.Conditional */) { invokeOnce(source, target, inferToConditionalType); @@ -70028,7 +70569,7 @@ var ts; var saveBivariant = bivariant; var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; // Once we descend into a bivariant signature we remain bivariant for all nested inferences - bivariant = bivariant || kind === 169 /* SyntaxKind.MethodDeclaration */ || kind === 168 /* SyntaxKind.MethodSignature */ || kind === 171 /* SyntaxKind.Constructor */; + bivariant = bivariant || kind === 171 /* SyntaxKind.MethodDeclaration */ || kind === 170 /* SyntaxKind.MethodSignature */ || kind === 173 /* SyntaxKind.Constructor */; applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes); bivariant = saveBivariant; applyToReturnTypes(source, target, inferFromTypes); @@ -70227,7 +70768,7 @@ var ts; } // falls through default: - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; } else { @@ -70248,7 +70789,7 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.6.3 // A type query consists of the keyword typeof followed by an expression. // The expression is restricted to a single identifier or a sequence of identifiers separated by periods - return !!ts.findAncestor(node, function (n) { return n.kind === 181 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 161 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); + return !!ts.findAncestor(node, function (n) { return n.kind === 183 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 163 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); } // Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers // separated by dots). The key consists of the id of the symbol referenced by the @@ -70264,26 +70805,26 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: return "0|".concat(flowContainer ? getNodeId(flowContainer) : "-1", "|").concat(getTypeId(declaredType), "|").concat(getTypeId(initialType)); - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: var left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer); return left && left + "." + node.right.escapedText; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var propName = getAccessedPropertyName(node); if (propName !== undefined) { var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && key + "." + propName; } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: // Handle pseudo-references originating in getNarrowedTypeOfSymbol. return "".concat(getNodeId(node), "#").concat(getTypeId(declaredType)); } @@ -70291,16 +70832,16 @@ var ts; } function isMatchingReference(source, target) { switch (target.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isMatchingReference(source, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isAssignmentExpression(target) && isMatchingReference(source, target.left)) || (ts.isBinaryExpression(target) && target.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source, target.right)); } switch (source.kind) { - case 231 /* SyntaxKind.MetaProperty */: - return target.kind === 231 /* SyntaxKind.MetaProperty */ + case 233 /* SyntaxKind.MetaProperty */: + return target.kind === 233 /* SyntaxKind.MetaProperty */ && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; case 79 /* SyntaxKind.Identifier */: @@ -70308,26 +70849,26 @@ var ts; return ts.isThisInTypeQuery(source) ? target.kind === 108 /* SyntaxKind.ThisKeyword */ : target.kind === 79 /* SyntaxKind.Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 254 /* SyntaxKind.VariableDeclaration */ || target.kind === 203 /* SyntaxKind.BindingElement */) && + (target.kind === 257 /* SyntaxKind.VariableDeclaration */ || target.kind === 205 /* SyntaxKind.BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 108 /* SyntaxKind.ThisKeyword */: return target.kind === 108 /* SyntaxKind.ThisKeyword */; case 106 /* SyntaxKind.SuperKeyword */: return target.kind === 106 /* SyntaxKind.SuperKeyword */; - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isMatchingReference(source.expression, target); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var sourcePropertyName = getAccessedPropertyName(source); var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined; return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return ts.isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isBinaryExpression(source) && source.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source.right, target)); } return false; @@ -70358,7 +70899,7 @@ var ts; } if (ts.isEntityNameExpression(node.argumentExpression)) { var symbol = resolveEntityName(node.argumentExpression, 111551 /* SymbolFlags.Value */, /*ignoreErrors*/ true); - if (!symbol || !isConstVariable(symbol)) + if (!symbol || !(isConstVariable(symbol) || (symbol.flags & 8 /* SymbolFlags.EnumMember */))) return undefined; var declaration = symbol.valueDeclaration; if (declaration === undefined) @@ -70370,9 +70911,14 @@ var ts; return name; } } - if (ts.hasOnlyExpressionInitializer(declaration)) { + if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) { var initializer = ts.getEffectiveInitializer(declaration); - return initializer && tryGetNameFromType(getTypeOfExpression(initializer)); + if (initializer) { + return tryGetNameFromType(getTypeOfExpression(initializer)); + } + if (ts.isEnumMember(declaration)) { + return ts.getTextOfPropertyName(declaration.name); + } } } return undefined; @@ -70499,7 +71045,7 @@ var ts; } function getMatchingUnionConstituentForObjectLiteral(unionType, node) { var keyPropertyName = getKeyPropertyName(unionType); - var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && + var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); }); var propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); return propType && getConstituentTypeForKeyType(unionType, propType); @@ -70516,7 +71062,7 @@ var ts; } } } - if (expression.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expression.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isOrContainsMatchingReference(reference, expression.expression.expression)) { return true; } @@ -70716,15 +71262,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, type, undefinedType, /*errorNode*/ undefined) || errorType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; + return parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -70741,21 +71287,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return stringType; - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkRightHandSideOfForOf(parent) || errorType; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return undefinedType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return errorType; @@ -70763,7 +71309,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ ? + var type = pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -70781,30 +71327,30 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent) || errorType; } return errorType; } function getInitialType(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function isEmptyArrayAssignment(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.initializer && + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 203 /* SyntaxKind.BindingElement */ && node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + node.kind !== 205 /* SyntaxKind.BindingElement */ && node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 75 /* SyntaxKind.BarBarEqualsToken */: @@ -70819,13 +71365,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? + return parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); } return neverType; @@ -70844,13 +71390,13 @@ var ts; // Get the type names from all cases in a switch on `typeof`. The default clause and/or duplicate type names are // represented as undefined. Return undefined if one or more case clause expressions are not string literals. function getSwitchClauseTypeOfWitnesses(switchStatement) { - if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 289 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { + if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 292 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { return undefined; } var witnesses = []; for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { var clause = _a[_i]; - var text = clause.kind === 289 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; + var text = clause.kind === 292 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; witnesses.push(text && !ts.contains(witnesses, text) ? text : undefined); } return witnesses; @@ -71037,12 +71583,12 @@ var ts; var root = getReferenceRoot(node); var parent = root.parent; var isLengthPushOrUnshift = ts.isPropertyAccessExpression(parent) && (parent.name.escapedText === "length" || - parent.parent.kind === 208 /* SyntaxKind.CallExpression */ + parent.parent.kind === 210 /* SyntaxKind.CallExpression */ && ts.isIdentifier(parent.name) && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + var isElementAssignment = parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -71055,6 +71601,7 @@ var ts; ts.isInJSFile(node) && ts.hasInitializer(node) && node.initializer && ts.isFunctionExpressionOrArrowFunction(node.initializer) && ts.getEffectiveReturnTypeNode(node.initializer)); } function getExplicitTypeOfSymbol(symbol, diagnostic) { + symbol = resolveSymbol(symbol); if (symbol.flags & (16 /* SymbolFlags.Function */ | 8192 /* SymbolFlags.Method */ | 32 /* SymbolFlags.Class */ | 512 /* SymbolFlags.ValueModule */)) { return getTypeOfSymbol(symbol); } @@ -71070,7 +71617,7 @@ var ts; if (isDeclarationWithExplicitTypeAnnotation(declaration)) { return getTypeOfSymbol(symbol); } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var statement = declaration.parent.parent; var expressionType = getTypeOfDottedName(statement.expression, /*diagnostic*/ undefined); if (expressionType) { @@ -71093,12 +71640,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: var symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node)); - return getExplicitTypeOfSymbol(symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol, diagnostic); + return getExplicitTypeOfSymbol(symbol, diagnostic); case 108 /* SyntaxKind.ThisKeyword */: return getExplicitThisType(node); case 106 /* SyntaxKind.SuperKeyword */: return checkSuperExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var type = getTypeOfDottedName(node.expression, diagnostic); if (type) { var name = node.name; @@ -71116,7 +71663,7 @@ var ts; } return undefined; } - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getTypeOfDottedName(node.expression, diagnostic); } } @@ -71130,7 +71677,7 @@ var ts; // circularities in control flow analysis, we use getTypeOfDottedName when resolving the call // target expression of an assertion. var funcType = void 0; - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { funcType = getTypeOfDottedName(node.expression, /*diagnostic*/ undefined); } else if (node.expression.kind !== 106 /* SyntaxKind.SuperKeyword */) { @@ -71174,7 +71721,7 @@ var ts; } function isFalseExpression(expr) { var node = ts.skipParentheses(expr, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || + return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ && isFalseExpression(node.left) && isFalseExpression(node.right)); } function isReachableFlowNodeWorker(flow, noCacheCheck) { @@ -71295,8 +71842,8 @@ var ts; var symbol = getResolvedSymbol(node); return isConstVariable(symbol) || ts.isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // The resolvedSymbol property is initialized by checkPropertyAccess or checkElementAccess before we get here. return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol); } @@ -71323,7 +71870,7 @@ var ts; // on empty arrays are possible without implicit any errors and new element types can be inferred without // type mismatch errors. var resultType = ts.getObjectFlags(evolvedType) & 256 /* ObjectFlags.EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 230 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 232 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { return declaredType; } // The non-null unknown type should never escape control flow analysis. @@ -71408,8 +71955,8 @@ var ts; // Check if we should continue with the control flow of the containing function. var container = flow.node; if (container && container !== flowContainer && - reference.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && - reference.kind !== 207 /* SyntaxKind.ElementAccessExpression */ && + reference.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && + reference.kind !== 209 /* SyntaxKind.ElementAccessExpression */ && reference.kind !== 108 /* SyntaxKind.ThisKeyword */) { flow = container.flowNode; continue; @@ -71434,7 +71981,7 @@ var ts; } function getInitialOrAssignedType(flow) { var node = flow.node; - return getNarrowableTypeForReference(node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */ ? + return getNarrowableTypeForReference(node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */ ? getInitialType(node) : getAssignedType(node), reference); } @@ -71474,14 +72021,14 @@ var ts; // in which case we continue control flow analysis back to the function's declaration if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) { var init = ts.getDeclaredExpandoInitializer(node); - if (init && (init.kind === 213 /* SyntaxKind.FunctionExpression */ || init.kind === 214 /* SyntaxKind.ArrowFunction */)) { + if (init && (init.kind === 215 /* SyntaxKind.FunctionExpression */ || init.kind === 216 /* SyntaxKind.ArrowFunction */)) { return getTypeAtFlowNode(flow.antecedent); } } return declaredType; } // for (const _ in ref) acts as a nonnull on ref - if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { + if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)))); } // Assignment doesn't affect reference @@ -71492,7 +72039,7 @@ var ts; if (node.kind === 95 /* SyntaxKind.FalseKeyword */) { return unreachableNeverType; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { if (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */) { return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right); } @@ -71523,7 +72070,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 208 /* SyntaxKind.CallExpression */ ? + var expr = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -71531,7 +72078,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256 /* ObjectFlags.EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -71579,15 +72126,15 @@ var ts; if (isMatchingReference(reference, expr)) { type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { - type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { + type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } else { if (strictNullChecks) { if (optionalChainContainsReference(expr, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & (32768 /* TypeFlags.Undefined */ | 131072 /* TypeFlags.Never */)); }); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & 131072 /* TypeFlags.Never */ || t.flags & 128 /* TypeFlags.StringLiteral */ && t.value === "undefined"); }); } } @@ -71815,7 +72362,7 @@ var ts; var narrowedPropType = narrowType(propType); return filterType(type, function (t) { var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName); - return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); + return !(discriminantType.flags & 131072 /* TypeFlags.Never */) && !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); }); } function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { @@ -71857,18 +72404,26 @@ var ts; } function isTypePresencePossible(type, propName, assumeTrue) { var prop = getPropertyOfType(type, propName); - if (prop) { - return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue; - } - return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue; - } - function narrowByInKeyword(type, name, assumeTrue) { - if (type.flags & 1048576 /* TypeFlags.Union */ - || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type)) - || ts.isThisTypeParameter(type) - || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) { + return prop ? + !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue : + !!getApplicableIndexInfoForName(type, propName) || !assumeTrue; + } + function narrowTypeByInKeyword(type, nameType, assumeTrue) { + var name = getPropertyNameFromType(nameType); + var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); }); + if (isKnownProperty) { + // If the check is for a known property (i.e. a property declared in some constituent of + // the target type), we filter the target type by presence of absence of the property. return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); }); } + if (assumeTrue) { + // If the check is for an unknown property, we intersect the target type with `Record`, + // where X is the name of the property. + var recordSymbol = getGlobalRecordSymbol(); + if (recordSymbol) { + return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]); + } + } return type; } function narrowTypeByBinaryExpression(type, expr, assumeTrue) { @@ -71885,10 +72440,10 @@ var ts; var operator = expr.operatorToken.kind; var left = getReferenceCandidate(expr.left); var right = getReferenceCandidate(expr.right); - if (left.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { + if (left.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { return narrowTypeByTypeof(type, left, operator, right, assumeTrue); } - if (right.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { + if (right.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { return narrowTypeByTypeof(type, right, operator, left, assumeTrue); } if (isMatchingReference(reference, left)) { @@ -71927,15 +72482,14 @@ var ts; return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue); } var target = getReferenceCandidate(expr.right); - var leftType = getTypeOfNode(expr.left); - if (leftType.flags & 128 /* TypeFlags.StringLiteral */) { - var name = ts.escapeLeadingUnderscores(leftType.value); + var leftType = getTypeOfExpression(expr.left); + if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) { if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) && - getAccessedPropertyName(reference) === name) { + getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) { return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */); } if (isMatchingReference(reference, target)) { - return narrowByInKeyword(type, name, assumeTrue); + return narrowTypeByInKeyword(type, leftType, assumeTrue); } } break; @@ -71997,24 +72551,11 @@ var ts; assumeTrue = !assumeTrue; } var valueType = getTypeOfExpression(value); - if (((type.flags & 2 /* TypeFlags.Unknown */) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304 /* TypeFlags.Nullable */)) && - assumeTrue && - (operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) { - if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) { - return valueType; - } - if (valueType.flags & 524288 /* TypeFlags.Object */) { - return nonPrimitiveType; - } - if (type.flags & 2 /* TypeFlags.Unknown */) { - return type; - } - } + var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; if (valueType.flags & 98304 /* TypeFlags.Nullable */) { if (!strictNullChecks) { return type; } - var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; var facts = doubleEquals ? assumeTrue ? 262144 /* TypeFacts.EQUndefinedOrNull */ : 2097152 /* TypeFacts.NEUndefinedOrNull */ : valueType.flags & 65536 /* TypeFlags.Null */ ? @@ -72023,10 +72564,16 @@ var ts; return getAdjustedTypeWithFacts(type, facts); } if (assumeTrue) { - var filterFn = operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? - function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); } : - function (t) { return areTypesComparable(t, valueType); }; - return replacePrimitivesWithLiterals(filterType(type, filterFn), valueType); + if (!doubleEquals && (type.flags & 2 /* TypeFlags.Unknown */ || someType(type, isEmptyAnonymousObjectType))) { + if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) { + return valueType; + } + if (valueType.flags & 524288 /* TypeFlags.Object */) { + return nonPrimitiveType; + } + } + var filteredType = filterType(type, function (t) { return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); }); + return replacePrimitivesWithLiterals(filteredType, valueType); } if (isUnitType(valueType)) { return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); }); @@ -72040,11 +72587,18 @@ var ts; } var target = getReferenceCandidate(typeOfExpr.expression); if (!isMatchingReference(reference, target)) { + var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type); + if (propertyAccess) { + return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); }); + } if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) { return getAdjustedTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */); } return type; } + return narrowTypeByLiteralExpression(type, literal, assumeTrue); + } + function narrowTypeByLiteralExpression(type, literal, assumeTrue) { return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeFacts.TypeofNEHostObject */); @@ -72124,13 +72678,13 @@ var ts; neverType; }); } - function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) { + function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) { var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement); if (!witnesses) { return type; } // Equal start and end denotes implicit fallthrough; undefined marks explicit default clause. - var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 290 /* SyntaxKind.DefaultClause */; }); + var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 293 /* SyntaxKind.DefaultClause */; }); var hasDefaultClause = clauseStart === clauseEnd || (defaultIndex >= clauseStart && defaultIndex < clauseEnd); if (hasDefaultClause) { // In the default clause we filter constituents down to those that are not-equal to all handled cases. @@ -72334,17 +72888,17 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return narrowTypeByCallExpression(type, expr, assumeTrue); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return narrowType(type, expr.expression, assumeTrue); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (expr.operator === 53 /* SyntaxKind.ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -72393,9 +72947,9 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 262 /* SyntaxKind.ModuleBlock */ || - node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 265 /* SyntaxKind.ModuleBlock */ || + node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; }); } // Check if a parameter or catch variable is assigned anywhere @@ -72438,7 +72992,7 @@ var ts; function removeOptionalityFromDeclaredType(declaredType, declaration) { if (pushTypeResolution(declaration.symbol, 2 /* TypeSystemPropertyName.DeclaredType */)) { var annotationIncludesUndefined = strictNullChecks && - declaration.kind === 164 /* SyntaxKind.Parameter */ && + declaration.kind === 166 /* SyntaxKind.Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* TypeFacts.IsUndefined */ && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* TypeFacts.IsUndefined */); @@ -72455,10 +73009,10 @@ var ts; // In an element access obj[x], we consider obj to be in a constraint position, except when obj is of // a generic type without a nullable constraint and x is a generic type. This is because when both obj // and x are of generic types T and K, we want the resulting type to be T[K]. - return parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 161 /* SyntaxKind.QualifiedName */ || - parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === node || - parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && + return parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 163 /* SyntaxKind.QualifiedName */ || + parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === node || + parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression))); } function isGenericTypeWithUnionConstraint(type) { @@ -72512,15 +73066,15 @@ var ts; }); } function markAliasReferenced(symbol, location) { - if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) { var target = resolveAlias(symbol); - if (target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(target) & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */)) { // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled // (because the const enum value will not be inlined), or if (2) the alias is an export // of a const enum declaration that will be preserved. if (compilerOptions.isolatedModules || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) || - !isConstEnumOrConstEnumOnlyModule(target)) { + !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) { markAliasSymbolAsReferenced(symbol); } else { @@ -72557,15 +73111,16 @@ var ts; // destructuring from the narrowed parent type. if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) { var parent = declaration.parent.parent; - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 166 /* SyntaxKind.Parameter */) { var links = getNodeLinks(parent); if (!(links.flags & 268435456 /* NodeCheckFlags.InCheckIdentifier */)) { links.flags |= 268435456 /* NodeCheckFlags.InCheckIdentifier */; var parentType = getTypeForBindingElementParent(parent, 0 /* CheckMode.Normal */); + var parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~268435456 /* NodeCheckFlags.InCheckIdentifier */; - if (parentType && parentType.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 164 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { + if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 166 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { var pattern = declaration.parent; - var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, /*flowContainer*/ undefined, location.flowNode); + var narrowedType = getFlowTypeOfReference(pattern, parentTypeConstraint, parentTypeConstraint, /*flowContainer*/ undefined, location.flowNode); if (narrowedType.flags & 131072 /* TypeFlags.Never */) { return neverType; } @@ -72632,10 +73187,10 @@ var ts; } var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ScriptTarget.ES2015 */) { - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } - else if (ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + else if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } @@ -72655,7 +73210,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -72667,12 +73222,12 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (declaration.kind === 228 /* SyntaxKind.ClassExpression */) { // When we emit a class expression with static members that contain a reference // to the constructor in the initializer, we will need to substitute that // binding with an alias as the class name is not in scope. var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); - while (container.kind !== 305 /* SyntaxKind.SourceFile */) { + while (container.kind !== 308 /* SyntaxKind.SourceFile */) { if (container.parent === declaration) { if (ts.isPropertyDeclaration(container) && ts.isStatic(container) || ts.isClassStaticBlockDeclaration(container)) { getNodeLinks(declaration).flags |= 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; @@ -72730,7 +73285,7 @@ var ts; // The declaration container is the innermost function that encloses the declaration of the variable // or parameter. The flow container is the innermost function starting with which we analyze the control // flow graph to determine the control flow based type. - var isParameter = ts.getRootDeclaration(declaration).kind === 164 /* SyntaxKind.Parameter */; + var isParameter = ts.getRootDeclaration(declaration).kind === 166 /* SyntaxKind.Parameter */; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; @@ -72739,19 +73294,19 @@ var ts; // When the control flow originates in a function expression or arrow function and we are referencing // a const variable or parameter from an outer function, we extend the origin of the control flow // analysis to include the immediately enclosing function. - while (flowContainer !== declarationContainer && (flowContainer.kind === 213 /* SyntaxKind.FunctionExpression */ || - flowContainer.kind === 214 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* SyntaxKind.FunctionExpression */ || + flowContainer.kind === 216 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } // We only look for uninitialized variables in strict null checking mode, and only when we can analyze // the entire control flow graph from the variable's declaration (i.e. when the flow container and // declaration container are the same). - var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) || + var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* TypeFlags.AnyOrUnknown */ | 16384 /* TypeFlags.Void */)) !== 0 || - isInTypeQuery(node) || node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) || - node.parent.kind === 230 /* SyntaxKind.NonNullExpression */ || - declaration.kind === 254 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) || + node.parent.kind === 232 /* SyntaxKind.NonNullExpression */ || + declaration.kind === 257 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* NodeFlags.Ambient */; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -72776,6 +73331,12 @@ var ts; } return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } + function isSameScopedBindingElement(node, declaration) { + if (ts.isBindingElement(declaration)) { + var bindingElement = ts.findAncestor(node, ts.isBindingElement); + return bindingElement && ts.getRootDeclaration(bindingElement) === ts.getRootDeclaration(declaration); + } + } function shouldMarkIdentifierAliasReferenced(node) { var _a; var parent = node.parent; @@ -72809,7 +73370,7 @@ var ts; (symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 32 /* SymbolFlags.Class */)) === 0 || !symbol.valueDeclaration || ts.isSourceFile(symbol.valueDeclaration) || - symbol.valueDeclaration.parent.kind === 292 /* SyntaxKind.CatchClause */) { + symbol.valueDeclaration.parent.kind === 295 /* SyntaxKind.CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -72824,7 +73385,7 @@ var ts; // mark iteration statement as containing block-scoped binding captured in some function var capturesBlockScopeBindingInLoopBody = true; if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container) { var part = getPartOfForStatementContainingNode(node.parent, container); if (part) { @@ -72845,7 +73406,7 @@ var ts; // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 4194304 /* NodeCheckFlags.NeedsLoopOutParameter */; } @@ -72864,7 +73425,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { // skip parenthesized nodes var current = node; - while (current.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (current.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -72872,7 +73433,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */)) { + else if ((current.parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; } @@ -72885,7 +73446,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* NodeCheckFlags.LexicalThis */; - if (container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || container.kind === 173 /* SyntaxKind.Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* NodeCheckFlags.CaptureThis */; } @@ -72932,31 +73493,31 @@ var ts; // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var capturedByArrowFunction = false; - if (container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); capturedByArrowFunction = true; } checkThisInStaticClassFieldInitializerInDecoratedClass(node, container); switch (container.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -73044,7 +73605,7 @@ var ts; } function getClassNameFromPrototypeMethod(container) { // Check if it's the RHS of a x.prototype.y = function [name]() { .... } - if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isBinaryExpression(container.parent) && ts.getAssignmentDeclarationKind(container.parent) === 3 /* AssignmentDeclarationKind.PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = container' @@ -73054,16 +73615,16 @@ var ts; .expression; // x } // x.prototype = { method() { } } - else if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && - container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && + container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.left.expression; } // x.prototype = { method: function() { } } - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && - container.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && - container.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && + container.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && + container.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.parent.left.expression; @@ -73071,7 +73632,7 @@ var ts; // Object.defineProperty(x, "method", { value: function() { } }); // Object.defineProperty(x, "method", { set: (x: () => void) => void }); // Object.defineProperty(x, "method", { get: () => function() { }) }); - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isPropertyAssignment(container.parent) && ts.isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && @@ -73096,7 +73657,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 317 /* SyntaxKind.JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 320 /* SyntaxKind.JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -73110,19 +73671,24 @@ var ts; } } function isInConstructorArgumentInitializer(node, constructorDecl) { - return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 164 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); + return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 166 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 208 /* SyntaxKind.CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 210 /* SyntaxKind.CallExpression */ && node.parent.expression === node; var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var container = immediateContainer; var needToCaptureLexicalThis = false; + var inAsyncFunction = false; // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - while (container && container.kind === 214 /* SyntaxKind.ArrowFunction */) { + while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) { + if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) + inAsyncFunction = true; container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */; } + if (container && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) + inAsyncFunction = true; } var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; @@ -73132,14 +73698,14 @@ var ts; // class B { // [super.foo()]() {} // } - var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 162 /* SyntaxKind.ComputedPropertyName */; }); - if (current && current.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 164 /* SyntaxKind.ComputedPropertyName */; }); + if (current && current.kind === 164 /* SyntaxKind.ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -73147,7 +73713,7 @@ var ts; } return errorType; } - if (!isCallExpression && immediateContainer.kind === 171 /* SyntaxKind.Constructor */) { + if (!isCallExpression && immediateContainer.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if (ts.isStatic(container) || isCallExpression) { @@ -73228,12 +73794,12 @@ var ts; // as a call expression cannot be used as the target of a destructuring assignment while a property access can. // // For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations. - if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && inAsyncFunction) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { - getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */; + getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */; } else { - getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.AsyncMethodWithSuper */; + getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */; } } if (needToCaptureLexicalThis) { @@ -73242,7 +73808,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return errorType; @@ -73263,7 +73829,7 @@ var ts; if (!baseClassType) { return errorType; } - if (container.kind === 171 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 173 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return errorType; @@ -73278,7 +73844,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 173 /* SyntaxKind.Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -73286,23 +73852,23 @@ var ts; // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor // topmost container must be something that is directly nested in the class declaration\object literal expression - if (ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (ts.isStatic(container)) { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } else { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 166 /* SyntaxKind.PropertySignature */ || - container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 168 /* SyntaxKind.PropertySignature */ || + container.kind === 173 /* SyntaxKind.Constructor */; } } } @@ -73310,10 +73876,10 @@ var ts; } } function getContainingObjectLiteral(func) { - return (func.kind === 169 /* SyntaxKind.MethodDeclaration */ || - func.kind === 172 /* SyntaxKind.GetAccessor */ || - func.kind === 173 /* SyntaxKind.SetAccessor */) && func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : - func.kind === 213 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : + return (func.kind === 171 /* SyntaxKind.MethodDeclaration */ || + func.kind === 174 /* SyntaxKind.GetAccessor */ || + func.kind === 175 /* SyntaxKind.SetAccessor */) && func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : + func.kind === 215 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -73325,7 +73891,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -73352,7 +73918,7 @@ var ts; if (thisType) { return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); } - if (literal.parent.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (literal.parent.kind !== 299 /* SyntaxKind.PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -73366,7 +73932,7 @@ var ts; // In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the // contextual type for 'this' is 'obj'. var parent = ts.walkUpParenthesizedExpressions(func.parent); - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { var target = parent.left; if (ts.isAccessExpression(target)) { var expression = target.expression; @@ -73419,11 +73985,11 @@ var ts; return getTypeFromTypeNode(typeNode); } switch (declaration.kind) { - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return getContextuallyTypedParameterType(declaration); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForBindingElement(declaration, contextFlags); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isStatic(declaration)) { return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags); } @@ -73434,10 +74000,10 @@ var ts; var parent = declaration.parent.parent; var name = declaration.propertyName || declaration.name; var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || - parent.kind !== 203 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); + parent.kind !== 205 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name)) return undefined; - if (parent.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (parent.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { var index = ts.indexOfNode(declaration.parent.elements, declaration); if (index < 0) return undefined; @@ -73594,7 +74160,7 @@ var ts; getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (template.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -73713,9 +74279,11 @@ var ts; case 1 /* AssignmentDeclarationKind.ExportsProperty */: case 6 /* AssignmentDeclarationKind.Prototype */: case 3 /* AssignmentDeclarationKind.PrototypeProperty */: - var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; - // falls through case 2 /* AssignmentDeclarationKind.ModuleExports */: + var valueDeclaration = void 0; + if (kind !== 2 /* AssignmentDeclarationKind.ModuleExports */) { + valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; + } valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration); var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration); return annotated ? getTypeFromTypeNode(annotated) : undefined; @@ -73892,21 +74460,21 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 79 /* SyntaxKind.Identifier */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isPossiblyDiscriminantValue(node.expression); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !node.expression || isPossiblyDiscriminantValue(node.expression); } return false; } function discriminateContextualTypeByObjectMembers(node, contextualType) { - return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } function discriminateContextualTypeByJSXAttributes(node, contextualType) { - return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 285 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 288 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. @@ -73927,9 +74495,10 @@ var ts; function instantiateContextualType(contextualType, node, contextFlags) { if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* TypeFlags.Instantiable */)) { var inferenceContext = getInferenceContext(node); - // If no inferences have been made, nothing is gained from instantiating as type parameters - // would just be replaced with their defaults similar to the apparent type. - if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidates)) { + // If no inferences have been made, and none of the type parameters for which we are inferring + // specify default types, nothing is gained from instantiating as type parameters would just be + // replaced with their constraints similar to the apparent type. + if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) { // For contextual signatures we incorporate all inferences made so far, e.g. from return // types as well as arguments to the left in a function call. return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper); @@ -73989,60 +74558,62 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForInitializerExpression(node, contextFlags); - case 214 /* SyntaxKind.ArrowFunction */: - case 247 /* SyntaxKind.ReturnStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 250 /* SyntaxKind.ReturnStatement */: return getContextualTypeForReturnExpression(node, contextFlags); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return getContextualTypeForYieldOperand(parent, contextFlags); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return getContextualTypeForAwaitOperand(parent, contextFlags); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return getContextualTypeForArgument(parent, node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return ts.isConstTypeReference(parent.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(parent.type); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getContextualTypeForBinaryOperand(node, contextFlags); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent, contextFlags); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return getContextualType(parent.parent, contextFlags); - case 204 /* SyntaxKind.ArrayLiteralExpression */: { + case 206 /* SyntaxKind.ArrayLiteralExpression */: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return getContextualTypeForConditionalOperand(node, contextFlags); - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 223 /* SyntaxKind.TemplateExpression */); + case 236 /* SyntaxKind.TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 225 /* SyntaxKind.TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { // Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast. var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return !tag ? getContextualType(parent, contextFlags) : ts.isJSDocTypeTag(tag) && ts.isConstTypeReference(tag.typeExpression.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(tag.typeExpression.type); } - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return getContextualType(parent, contextFlags); - case 271 /* SyntaxKind.ExportAssignment */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return getTypeFromTypeNode(parent.type); + case 274 /* SyntaxKind.ExportAssignment */: return tryGetTypeFromEffectiveTypeNode(parent); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return getContextualTypeForJsxExpression(parent, contextFlags); - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent, contextFlags); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getContextualJsxElementAttributesType(parent, contextFlags); } return undefined; @@ -74168,9 +74739,16 @@ var ts; if (!isErrorType(intrinsicClassAttribs)) { var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); var hostClassType = getReturnTypeOfSignature(sig); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context))) - : intrinsicClassAttribs, apparentAttributesType); + var libraryManagedAttributeType = void 0; + if (typeParams) { + // apply JSX.IntrinsicClassElements + var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context)); + libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs)); + } + // or JSX.IntrinsicClassElements has no generics. + else + libraryManagedAttributeType = intrinsicClassAttribs; + apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType); } var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (!isErrorType(intrinsicAttribs)) { @@ -74293,7 +74871,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var typeTagSignature = getSignatureOfTypeTag(node); if (typeTagSignature) { return typeTagSignature; @@ -74341,8 +74919,8 @@ var ts; return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type; } function hasDefaultValue(node) { - return (node.kind === 203 /* SyntaxKind.BindingElement */ && !!node.initializer) || - (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); + return (node.kind === 205 /* SyntaxKind.BindingElement */ && !!node.initializer) || + (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); } function checkArrayLiteral(node, checkMode, forceTuple) { var elements = node.elements; @@ -74355,7 +74933,7 @@ var ts; var hasOmittedExpression = false; for (var i = 0; i < elementCount; i++) { var e = elements[i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 /* ExternalEmitHelpers.SpreadIncludes */ : 1024 /* ExternalEmitHelpers.SpreadArray */); } @@ -74388,7 +74966,7 @@ var ts; elementFlags.push(4 /* ElementFlags.Rest */); } } - else if (exactOptionalPropertyTypes && e.kind === 227 /* SyntaxKind.OmittedExpression */) { + else if (exactOptionalPropertyTypes && e.kind === 229 /* SyntaxKind.OmittedExpression */) { hasOmittedExpression = true; elementTypes.push(missingType); elementFlags.push(2 /* ElementFlags.Optional */); @@ -74428,7 +75006,7 @@ var ts; } function isNumericName(name) { switch (name.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return isNumericComputedName(name); case 79 /* SyntaxKind.Identifier */: return ts.isNumericLiteralName(name.escapedText); @@ -74449,7 +75027,7 @@ var ts; if (!links.resolvedType) { if ((ts.isTypeLiteralNode(node.parent.parent) || ts.isClassLike(node.parent.parent) || ts.isInterfaceDeclaration(node.parent.parent)) && ts.isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ - && node.parent.kind !== 172 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 173 /* SyntaxKind.SetAccessor */) { + && node.parent.kind !== 174 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 175 /* SyntaxKind.SetAccessor */) { return links.resolvedType = errorType; } links.resolvedType = checkExpression(node.expression); @@ -74522,7 +75100,7 @@ var ts; var spread = emptyObjectType; var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 205 /* SyntaxKind.ObjectLiteralExpression */); + (contextualType.pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 207 /* SyntaxKind.ObjectLiteralExpression */); var inConstContext = isConstContext(node); var checkFlags = inConstContext ? 8 /* CheckFlags.Readonly */ : 0; var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node); @@ -74546,16 +75124,16 @@ var ts; for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var memberDecl = _c[_b]; var member = getSymbolOfNode(memberDecl); - var computedNameType = memberDecl.name && memberDecl.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? + var computedNameType = memberDecl.name && memberDecl.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : undefined; - if (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ || + if (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { - var type = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : + var type = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`. // we don't want to say "could not find 'a'". - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode); if (isInJavascript) { var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); @@ -74578,8 +75156,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* SymbolFlags.Optional */; } @@ -74605,14 +75183,14 @@ var ts; member = prop; allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop); if (contextualType && checkMode && checkMode & 2 /* CheckMode.Inferential */ && !(checkMode & 4 /* CheckMode.SkipContextSensitive */) && - (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 169 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { + (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 171 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { var inferenceContext = getInferenceContext(node); ts.Debug.assert(inferenceContext); // In CheckMode.Inferential we should always have an inference context - var inferenceNode = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; + var inferenceNode = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type); } } - else if (memberDecl.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (memberDecl.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* ExternalEmitHelpers.Assign */); } @@ -74648,7 +75226,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 172 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 173 /* SyntaxKind.SetAccessor */); + ts.Debug.assert(memberDecl.kind === 174 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 175 /* SyntaxKind.SetAccessor */); checkNodeDeferred(memberDecl); } if (computedNameType && !(computedNameType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */)) { @@ -74675,16 +75253,30 @@ var ts; // If object literal is contextually typed by the implied type of a binding pattern, augment the result // type with those properties for which the binding pattern specifies a default value. // If the object literal is spread into another object literal, skip this step and let the top-level object - // literal handle it instead. - if (contextualTypeHasPattern && node.parent.kind !== 298 /* SyntaxKind.SpreadAssignment */) { - for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { - var prop = _e[_d]; - if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { - if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { - error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + // literal handle it instead. Note that this might require full traversal to the root pattern's parent + // as it's the guaranteed to be the common ancestor of the pattern node and the current object node. + // It's not possible to check if the immediate parent node is a spread assignment + // since the type flows in non-obvious ways through conditional expressions, IIFEs and more. + if (contextualTypeHasPattern) { + var rootPatternParent_1 = ts.findAncestor(contextualType.pattern.parent, function (n) { + return n.kind === 257 /* SyntaxKind.VariableDeclaration */ || + n.kind === 223 /* SyntaxKind.BinaryExpression */ || + n.kind === 166 /* SyntaxKind.Parameter */; + }); + var spreadOrOutsideRootObject = ts.findAncestor(node, function (n) { + return n === rootPatternParent_1 || + n.kind === 301 /* SyntaxKind.SpreadAssignment */; + }); + if (spreadOrOutsideRootObject.kind !== 301 /* SyntaxKind.SpreadAssignment */) { + for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { + var prop = _e[_d]; + if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { + if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable.set(prop.escapedName, prop); + propertiesArray.push(prop); } - propertiesTable.set(prop.escapedName, prop); - propertiesArray.push(prop); } } } @@ -74792,6 +75384,7 @@ var ts; */ function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) { var attributes = openingLikeElement.attributes; + var attributesType = getContextualType(attributes, 0 /* ContextFlags.None */); var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined; var attributesTable = ts.createSymbolTable(); var spread = emptyJsxObjectType; @@ -74819,9 +75412,15 @@ var ts; if (attributeDecl.name.escapedText === jsxChildrenPropertyName) { explicitlySpecifyChildrenAttribute = true; } + if (attributesType) { + var prop = getPropertyOfType(attributesType, member.escapedName); + if (prop && prop.declarations && isDeprecatedSymbol(prop)) { + addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText); + } + } } else { - ts.Debug.assert(attributeDecl.kind === 287 /* SyntaxKind.JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 290 /* SyntaxKind.JsxSpreadAttribute */); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false); attributesTable = ts.createSymbolTable(); @@ -74848,7 +75447,7 @@ var ts; } } // Handle children attribute - var parent = openingLikeElement.parent.kind === 278 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 281 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; // We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { var childrenTypes = checkJsxChildren(parent, checkMode); @@ -74905,7 +75504,7 @@ var ts; childrenTypes.push(stringType); } } - else if (child.kind === 288 /* SyntaxKind.JsxExpression */ && !child.expression) { + else if (child.kind === 291 /* SyntaxKind.JsxExpression */ && !child.expression) { continue; // empty jsx expressions don't *really* count as present children } else { @@ -75337,9 +75936,9 @@ var ts; function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError) { if (reportError === void 0) { reportError = true; } var errorNode = !reportError ? undefined : - node.kind === 161 /* SyntaxKind.QualifiedName */ ? node.right : - node.kind === 200 /* SyntaxKind.ImportType */ ? node : - node.kind === 203 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; + node.kind === 163 /* SyntaxKind.QualifiedName */ ? node.right : + node.kind === 202 /* SyntaxKind.ImportType */ ? node : + node.kind === 205 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode); } /** @@ -75370,7 +75969,7 @@ var ts; return false; } } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { // A method cannot be accessed in a super property access if the method is abstract. // This error could mask a private property access error. But, a member // cannot simultaneously be private and abstract, so this will trigger an @@ -75382,7 +75981,7 @@ var ts; } } // Referencing abstract properties within their own constructors is not allowed - if ((flags & 128 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && + if ((flags & 256 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && (ts.isThisProperty(location) || ts.isThisInitializedObjectBindingExpression(location) || ts.isObjectBindingPattern(location.parent) && ts.isThisInitializedDeclaration(location.parent.parent))) { var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) { @@ -75476,10 +76075,27 @@ var ts; return isNullableType(type) ? getNonNullableType(type) : type; } function reportObjectPossiblyNullOrUndefinedError(node, facts) { - error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); + var nodeText = ts.isEntityNameExpression(node) ? ts.entityNameToString(node) : undefined; + if (node.kind === 104 /* SyntaxKind.NullKeyword */) { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "null"); + return; + } + if (nodeText !== undefined && nodeText.length < 100) { + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "undefined"); + return; + } + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics._0_is_possibly_null_or_undefined : + ts.Diagnostics._0_is_possibly_undefined : + ts.Diagnostics._0_is_possibly_null, nodeText); + } + else { + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } } function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) { error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? @@ -75489,6 +76105,13 @@ var ts; } function checkNonNullTypeWithReporter(type, node, reportError) { if (strictNullChecks && type.flags & 2 /* TypeFlags.Unknown */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_of_type_unknown, nodeText); + return errorType; + } + } error(node, ts.Diagnostics.Object_is_of_type_unknown); return errorType; } @@ -75506,6 +76129,17 @@ var ts; function checkNonNullNonVoidType(type, node) { var nonNullType = checkNonNullType(type, node); if (nonNullType.flags & 16384 /* TypeFlags.Void */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, nodeText); + return nonNullType; + } + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_possibly_undefined, nodeText); + return nonNullType; + } + } error(node, ts.Diagnostics.Object_is_possibly_undefined); } return nonNullType; @@ -75524,7 +76158,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, leftType, node.right, checkMode); } function isMethodAccessForCall(node) { - while (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.parent; } return ts.isCallOrNewExpression(node.parent) && node.parent.expression === node; @@ -75664,7 +76298,7 @@ var ts; } return isErrorType(apparentType) ? errorType : apparentType; } - prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 161 /* SyntaxKind.QualifiedName */); + prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 163 /* SyntaxKind.QualifiedName */); } // In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums. // `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined @@ -75674,7 +76308,7 @@ var ts; // 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and // 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`. if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules || - !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 299 /* SyntaxKind.EnumMember */)) || + !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 302 /* SyntaxKind.EnumMember */)) || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { markAliasReferenced(parentSymbol, node); } @@ -75776,7 +76410,7 @@ var ts; if (declaration && isPropertyWithoutInitializer(declaration)) { if (!ts.isStatic(declaration)) { var flowContainer = getControlFlowContainer(node); - if (flowContainer.kind === 171 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { + if (flowContainer.kind === 173 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { assumeUninitialized = true; } } @@ -75811,8 +76445,8 @@ var ts; && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) { diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName); } - else if (valueDeclaration.kind === 257 /* SyntaxKind.ClassDeclaration */ && - node.parent.kind !== 178 /* SyntaxKind.TypeReference */ && + else if (valueDeclaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && + node.parent.kind !== 180 /* SyntaxKind.TypeReference */ && !(valueDeclaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName); @@ -75824,25 +76458,25 @@ var ts; function isInPropertyInitializerOrClassStaticBlock(node) { return !!ts.findAncestor(node, function (node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 298 /* SyntaxKind.SpreadAssignment */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 233 /* SyntaxKind.TemplateSpan */: - case 288 /* SyntaxKind.JsxExpression */: - case 285 /* SyntaxKind.JsxAttribute */: - case 286 /* SyntaxKind.JsxAttributes */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 291 /* SyntaxKind.HeritageClause */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 301 /* SyntaxKind.SpreadAssignment */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 236 /* SyntaxKind.TemplateSpan */: + case 291 /* SyntaxKind.JsxExpression */: + case 288 /* SyntaxKind.JsxAttribute */: + case 289 /* SyntaxKind.JsxAttributes */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 294 /* SyntaxKind.HeritageClause */: return false; - case 214 /* SyntaxKind.ArrowFunction */: - case 238 /* SyntaxKind.ExpressionStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.isBlock(node.parent) && ts.isClassStaticBlockDeclaration(node.parent.parent) ? true : "quit"; default: return ts.isExpressionNode(node) ? false : "quit"; @@ -76037,7 +76671,6 @@ var ts; } return false; } - ; var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get"; if (!hasProp(suggestedMethod)) { return undefined; @@ -76117,11 +76750,11 @@ var ts; } function isValidPropertyAccess(node, propertyName) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return isValidPropertyAccessWithType(node, node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression))); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getWidenedType(checkExpression(node.left))); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getTypeFromTypeNode(node)); } } @@ -76136,7 +76769,7 @@ var ts; * @param property the accessed property's symbol. */ function isValidPropertyAccessForCompletions(node, type, property) { - return isPropertyAccessible(node, node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, + return isPropertyAccessible(node, node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, /* isWrite */ false, type, property); // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context. } @@ -76176,7 +76809,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -76205,7 +76838,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 243 /* SyntaxKind.ForInStatement */ && + if (node.kind === 246 /* SyntaxKind.ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -76254,13 +76887,13 @@ var ts; // This gets us diagnostics for the type arguments and marks them as referenced. ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { checkExpression(node.template); } else if (ts.isJsxOpeningLikeElement(node)) { checkExpression(node.attributes); } - else if (node.kind !== 165 /* SyntaxKind.Decorator */) { + else if (node.kind !== 167 /* SyntaxKind.Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -76324,7 +76957,7 @@ var ts; } } function isSpreadArgument(arg) { - return !!arg && (arg.kind === 225 /* SyntaxKind.SpreadElement */ || arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); + return !!arg && (arg.kind === 227 /* SyntaxKind.SpreadElement */ || arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); } function getSpreadArgumentIndex(args) { return ts.findIndex(args, isSpreadArgument); @@ -76341,9 +76974,9 @@ var ts; var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments var effectiveParameterCount = getParameterCount(signature); var effectiveMinimumArguments = getMinArgumentCount(signature); - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { argCount = args.length; - if (node.template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (node.template.kind === 225 /* SyntaxKind.TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var lastSpan = ts.last(node.template.templateSpans); // we should always have at least one span. @@ -76358,7 +76991,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 165 /* SyntaxKind.Decorator */) { + else if (node.kind === 167 /* SyntaxKind.Decorator */) { argCount = getDecoratorArgumentCount(node, signature); } else if (ts.isJsxOpeningLikeElement(node)) { @@ -76372,7 +77005,7 @@ var ts; } else if (!node.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(node.kind === 209 /* SyntaxKind.NewExpression */); + ts.Debug.assert(node.kind === 211 /* SyntaxKind.NewExpression */); return getMinArgumentCount(signature) === 0; } else { @@ -76475,7 +77108,7 @@ var ts; // example, given a 'function wrap(cb: (x: T) => U): (x: T) => U' and a call expression // 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the // return type of 'wrap'. - if (node.kind !== 165 /* SyntaxKind.Decorator */) { + if (node.kind !== 167 /* SyntaxKind.Decorator */) { var skipBindingPatterns = ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }); var contextualType = getContextualType(node, skipBindingPatterns ? 8 /* ContextFlags.SkipBindingPatterns */ : 0 /* ContextFlags.None */); if (contextualType) { @@ -76539,7 +77172,7 @@ var ts; } for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { var paramType = getTypeAtPosition(signature, i); if (couldContainTypeVariables(paramType)) { var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); @@ -76565,7 +77198,7 @@ var ts; if (isSpreadArgument(arg)) { // We are inferring from a spread expression in the last argument position, i.e. both the parameter // and the argument are ...x forms. - return getMutableArrayOrTupleType(arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : + return getMutableArrayOrTupleType(arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode)); } } @@ -76575,13 +77208,13 @@ var ts; for (var i = index; i < argCount; i++) { var arg = args[i]; if (isSpreadArgument(arg)) { - var spreadType = arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); + var spreadType = arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); if (isArrayLikeType(spreadType)) { types.push(spreadType); flags.push(8 /* ElementFlags.Variadic */); } else { - types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 225 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); + types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 227 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); flags.push(4 /* ElementFlags.Rest */); } } @@ -76592,7 +77225,7 @@ var ts; types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(1 /* ElementFlags.Required */); } - if (arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { + if (arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { names.push(arg.tupleNameSource); } } @@ -76736,7 +77369,7 @@ var ts; return undefined; } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 209 /* SyntaxKind.NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 211 /* SyntaxKind.NewExpression */) { // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. // If the expression is a new expression, then the check is skipped. @@ -76754,7 +77387,7 @@ var ts; var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = checkExpressionWithContextualType(arg, paramType, /*inferenceContext*/ undefined, checkMode); // If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive), @@ -76799,8 +77432,8 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - var expression = node.kind === 208 /* SyntaxKind.CallExpression */ ? node.expression : - node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; + var expression = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression : + node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; if (expression) { var callee = ts.skipOuterExpressions(expression); if (ts.isAccessExpression(callee)) { @@ -76818,17 +77451,17 @@ var ts; * Returns the effective arguments for an expression that works like a function invocation. */ function getEffectiveCallArguments(node) { - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var template = node.template; var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args_3.push(span.expression); }); } return args_3; } - if (node.kind === 165 /* SyntaxKind.Decorator */) { + if (node.kind === 167 /* SyntaxKind.Decorator */) { return getEffectiveDecoratorArguments(node); } if (ts.isJsxOpeningLikeElement(node)) { @@ -76842,7 +77475,7 @@ var ts; var _loop_26 = function (i) { var arg = args[i]; // We can call checkExpressionCached because spread expressions never have a contextual type. - var spreadType = arg.kind === 225 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); + var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); if (spreadType && isTupleType(spreadType)) { ts.forEach(getTypeArguments(spreadType), function (t, i) { var _a; @@ -76869,30 +77502,30 @@ var ts; var parent = node.parent; var expr = node.expression; switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class). return [ createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent))) ]; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts). var func = parent.parent; return [ - createSyntheticExpression(expr, parent.parent.kind === 171 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), + createSyntheticExpression(expr, parent.parent.kind === 173 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), createSyntheticExpression(expr, anyType), createSyntheticExpression(expr, numberType) ]; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators // for ES3, we will only pass two arguments. - var hasPropDesc = parent.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && languageVersion !== 0 /* ScriptTarget.ES3 */; + var hasPropDesc = languageVersion !== 0 /* ScriptTarget.ES3 */ && (!ts.isPropertyDeclaration(parent) || ts.hasAccessorModifier(parent)); return [ createSyntheticExpression(expr, getParentTypeOfClassElement(parent)), createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)), @@ -76906,17 +77539,17 @@ var ts; */ function getDecoratorArgumentCount(node, signature) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return 1; - case 167 /* SyntaxKind.PropertyDeclaration */: - return 2; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return ts.hasAccessorModifier(node.parent) ? 3 : 2; + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // For ES3 or decorators with only two parameters we supply only two arguments return languageVersion === 0 /* ScriptTarget.ES3 */ || signature.parameters.length <= 2 ? 2 : 3; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return 3; default: return ts.Debug.fail(); @@ -77058,8 +77691,8 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, fallbackError) { - var isTaggedTemplate = node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; - var isDecorator = node.kind === 165 /* SyntaxKind.Decorator */; + var isTaggedTemplate = node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; + var isDecorator = node.kind === 167 /* SyntaxKind.Decorator */; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var reportErrors = !candidatesOutArray; var typeArguments; @@ -77122,7 +77755,7 @@ var ts; var result; // If we are in signature help, a trailing comma indicates that we intend to provide another argument, // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments. - var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 208 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 210 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument // expression is a subtype of each corresponding parameter type, the return type of the first @@ -77611,7 +78244,7 @@ var ts; return resolveErrorCall(node); } var valueDecl = expressionType.symbol && ts.getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && ts.hasSyntacticModifier(valueDecl, 128 /* ModifierFlags.Abstract */)) { + if (valueDecl && ts.hasSyntacticModifier(valueDecl, 256 /* ModifierFlags.Abstract */)) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class); return resolveErrorCall(node); } @@ -77682,7 +78315,7 @@ var ts; var declaration = signature.declaration; var modifiers = ts.getSelectedEffectiveModifierFlags(declaration, 24 /* ModifierFlags.NonPublicAccessibilityModifier */); // (1) Public constructors and (2) constructor functions are always accessible. - if (!modifiers || declaration.kind !== 171 /* SyntaxKind.Constructor */) { + if (!modifiers || declaration.kind !== 173 /* SyntaxKind.Constructor */) { return true; } var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(declaration.parent.symbol); @@ -77826,16 +78459,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; default: return ts.Debug.fail(); @@ -77881,7 +78514,7 @@ var ts; // file would probably be preferable. var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968 /* SymbolFlags.Type */); var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968 /* SymbolFlags.Type */, node); - var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); var parameterSymbol = createSymbol(1 /* SymbolFlags.FunctionScopedVariable */, "props"); parameterSymbol.type = result; return createSignature(declaration, @@ -77930,16 +78563,16 @@ var ts; } function resolveSignature(node, candidatesOutArray, checkMode) { switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return resolveCallExpression(node, candidatesOutArray, checkMode); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return resolveNewExpression(node, candidatesOutArray, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return resolveDecorator(node, candidatesOutArray, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode); } throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); @@ -77983,12 +78616,15 @@ var ts; return false; } var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node : - ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : + (ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : undefined; if (func) { - // If the node has a @class tag, treat it like a constructor. + // If the node has a @class or @constructor tag, treat it like a constructor. if (ts.getJSDocClassTag(node)) return true; + // If the node is a property of an object literal. + if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent))) + return false; // If the symbol of the node has members, treat it like a constructor. var symbol = getSymbolOfNode(func); return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size); @@ -78071,7 +78707,7 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { parent = parent.parent; } if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -78097,12 +78733,12 @@ var ts; if (node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { return voidType; } - if (node.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.kind === 211 /* SyntaxKind.NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 171 /* SyntaxKind.Constructor */ && - declaration.kind !== 175 /* SyntaxKind.ConstructSignature */ && - declaration.kind !== 180 /* SyntaxKind.ConstructorType */ && + declaration.kind !== 173 /* SyntaxKind.Constructor */ && + declaration.kind !== 177 /* SyntaxKind.ConstructSignature */ && + declaration.kind !== 182 /* SyntaxKind.ConstructorType */ && !ts.isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any @@ -78122,7 +78758,7 @@ var ts; if (returnType.flags & 12288 /* TypeFlags.ESSymbolLike */ && isSymbolOrSymbolForCall(node)) { return getESSymbolLikeTypeForNode(ts.walkUpParenthesizedExpressions(node.parent)); } - if (node.kind === 208 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + if (node.kind === 210 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && returnType.flags & 16384 /* TypeFlags.Void */ && getTypePredicateOfSignature(signature)) { if (!ts.isDottedName(node.expression)) { error(node.expression, ts.Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); @@ -78152,20 +78788,20 @@ var ts; function getDeprecatedSuggestionNode(node) { node = ts.skipParentheses(node); switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 165 /* SyntaxKind.Decorator */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 167 /* SyntaxKind.Decorator */: + case 211 /* SyntaxKind.NewExpression */: return getDeprecatedSuggestionNode(node.expression); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return getDeprecatedSuggestionNode(node.tag); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getDeprecatedSuggestionNode(node.tagName); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.argumentExpression; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: var typeReference = node; return ts.isQualifiedName(typeReference.typeName) ? typeReference.typeName.right : typeReference; default: @@ -78236,8 +78872,8 @@ var ts; if (hasDefaultOnly && type && !isErrorType(type)) { var synthType = type; if (!synthType.defaultOnlyType) { - var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); - synthType.defaultOnlyType = type_5; + var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); + synthType.defaultOnlyType = type_4; } return synthType.defaultOnlyType; } @@ -78280,9 +78916,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* SymbolFlags.Function */ - ? 256 /* SyntaxKind.FunctionDeclaration */ + ? 259 /* SyntaxKind.FunctionDeclaration */ : resolvedRequire.flags & 3 /* SymbolFlags.Variable */ - ? 254 /* SyntaxKind.VariableDeclaration */ + ? 257 /* SyntaxKind.VariableDeclaration */ : 0 /* SyntaxKind.Unknown */; if (targetDeclarationKind !== 0 /* SyntaxKind.Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -78302,7 +78938,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkAssertion(node) { - if (node.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { var file = ts.getSourceFileOfNode(node); if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts" /* Extension.Cts */, ".mts" /* Extension.Mts */])) { grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead); @@ -78318,25 +78954,25 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isValidConstAssertionArgument(node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var op = node.operator; var arg = node.operand; return op === 40 /* SyntaxKind.MinusToken */ && (arg.kind === 8 /* SyntaxKind.NumericLiteral */ || arg.kind === 9 /* SyntaxKind.BigIntLiteral */) || op === 39 /* SyntaxKind.PlusToken */ && arg.kind === 8 /* SyntaxKind.NumericLiteral */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node.expression; var symbol = getTypeOfNode(expr).symbol; if (symbol && symbol.flags & 2097152 /* SymbolFlags.Alias */) { symbol = resolveAlias(symbol); } - return !!(symbol && (symbol.flags & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */); + return !!(symbol && (getAllSymbolFlags(symbol) & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */); } return false; } @@ -78372,7 +79008,7 @@ var ts; } function checkExpressionWithTypeArguments(node) { checkGrammarExpressionWithTypeArguments(node); - var exprType = node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : + var exprType = node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); var typeArguments = node.typeArguments; @@ -78436,6 +79072,16 @@ var ts; }); } } + function checkSatisfiesExpression(node) { + checkSourceElement(node.type); + var targetType = getTypeFromTypeNode(node.type); + if (isErrorType(targetType)) { + return targetType; + } + var exprType = checkExpression(node.expression); + checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, node.type, node.expression, ts.Diagnostics.Type_0_does_not_satisfy_the_expected_type_1); + return exprType; + } function checkMetaProperty(node) { checkGrammarMetaProperty(node); if (node.keywordToken === 103 /* SyntaxKind.NewKeyword */) { @@ -78463,7 +79109,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return errorType; } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -78515,7 +79161,7 @@ var ts; } function getParameterIdentifierNameAtPosition(signature, pos) { var _a; - if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 317 /* SyntaxKind.JSDocFunctionType */) { + if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDocFunctionType */) { return undefined; } var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78547,7 +79193,7 @@ var ts; return symbol.valueDeclaration && ts.isParameter(symbol.valueDeclaration) && ts.isIdentifier(symbol.valueDeclaration.name); } function isValidDeclarationForTupleLabel(d) { - return d.kind === 197 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); + return d.kind === 199 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); } function getNameableDeclarationAtPosition(signature, pos) { var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78839,7 +79485,7 @@ var ts; var yieldType; var nextType; var fallbackReturnType = voidType; - if (func.body.kind !== 235 /* SyntaxKind.Block */) { // Async or normal arrow function + if (func.body.kind !== 238 /* SyntaxKind.Block */) { // Async or normal arrow function returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* CheckMode.SkipGenericFunctions */); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -78988,15 +79634,25 @@ var ts; } function isExhaustiveSwitchStatement(node) { var links = getNodeLinks(node); - return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node)); + if (links.isExhaustive === undefined) { + links.isExhaustive = 0; // Indicate resolution is in process + var exhaustive = computeExhaustiveSwitchStatement(node); + if (links.isExhaustive === 0) { + links.isExhaustive = exhaustive; + } + } + else if (links.isExhaustive === 0) { + links.isExhaustive = false; // Resolve circularity to false + } + return links.isExhaustive; } function computeExhaustiveSwitchStatement(node) { - if (node.expression.kind === 216 /* SyntaxKind.TypeOfExpression */) { + if (node.expression.kind === 218 /* SyntaxKind.TypeOfExpression */) { var witnesses = getSwitchClauseTypeOfWitnesses(node); if (!witnesses) { return false; } - var operandConstraint = getBaseConstraintOrType(getTypeOfExpression(node.expression.expression)); + var operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression)); // Get the not-equal flags for all handled cases. var notEqualFacts_2 = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses); if (operandConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */) { @@ -79006,7 +79662,7 @@ var ts; // A missing not-equal flag indicates that the type wasn't handled by some case. return !someType(operandConstraint, function (t) { return (getTypeFacts(t) & notEqualFacts_2) === notEqualFacts_2; }); } - var type = getTypeOfExpression(node.expression); + var type = checkExpressionCached(node.expression); if (!isLiteralType(type)) { return false; } @@ -79057,11 +79713,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: - return func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + case 171 /* SyntaxKind.MethodDeclaration */: + return func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; default: return false; } @@ -79087,7 +79743,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (func.kind === 168 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 235 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { + if (func.kind === 170 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 238 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 512 /* NodeFlags.HasExplicitReturn */; @@ -79121,7 +79777,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); checkNodeDeferred(node); if (ts.isFunctionExpression(node)) { checkCollisionsForDeclarationName(node, node.name); @@ -79148,7 +79804,7 @@ var ts; } // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (!hasGrammarError && node.kind === 215 /* SyntaxKind.FunctionExpression */) { checkGrammarForGenerator(node); } contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -79199,7 +79855,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var functionFlags = ts.getFunctionFlags(node); var returnType = getReturnTypeFromAnnotation(node); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); @@ -79212,7 +79868,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body.kind === 238 /* SyntaxKind.Block */) { checkSourceElement(node.body); } else { @@ -79302,7 +79958,7 @@ var ts; expr.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var ctor = ts.getContainingFunction(expr); - if (!(ctor && (ctor.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { + if (!(ctor && (ctor.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { return true; } if (symbol.valueDeclaration) { @@ -79327,7 +79983,7 @@ var ts; var symbol_2 = getNodeLinks(node).resolvedSymbol; if (symbol_2.flags & 2097152 /* SymbolFlags.Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol_2); - return !!declaration && declaration.kind === 268 /* SyntaxKind.NamespaceImport */; + return !!declaration && declaration.kind === 271 /* SyntaxKind.NamespaceImport */; } } } @@ -79427,7 +80083,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); - if (container && container.kind !== 171 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { + if (container && container.kind !== 173 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); } @@ -79595,6 +80251,9 @@ var ts; } return booleanType; } + function hasEmptyObjectIntersection(type) { + return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); }); + } function checkInExpression(left, right, leftType, rightType) { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; @@ -79611,40 +80270,20 @@ var ts; } } else { - leftType = checkNonNullType(leftType, left); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // Require the left operand to be of type Any, the String primitive type, or the Number primitive type. - if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) || - isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) { - error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol); + // The type of the lef operand must be assignable to string, number, or symbol. + checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left); + } + // The type of the right operand must be assignable to 'object'. + if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) { + // The {} type is assignable to the object type, yet {} might represent a primitive type. Here we + // detect and error on {} that results from narrowing the unknown type, as well as intersections + // that include {} (we know that the other types in such intersections are assignable to object + // since we already checked for that). + if (hasEmptyObjectIntersection(rightType)) { + error(right, ts.Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType)); } } - rightType = checkNonNullType(rightType, right); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // The in operator requires the right operand to be - // - // 1. assignable to the non-primitive type, - // 2. an unconstrained type parameter, - // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the - // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the - // non-primitive type, or - // 4. a type parameter whose constraint is - // i. an object type, - // ii. the non-primitive type, or - // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type. - // - // The divergent behavior for type parameters and unions containing type parameters is a workaround for type - // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance - // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error - // unless *all* instantiations would result in an error. - // // The result is always of the Boolean primitive type. - var rightTypeConstraint = getConstraintOfType(rightType); - if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) { - error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive); - } return booleanType; } function checkObjectLiteralAssignment(node, sourceType, rightIsThis) { @@ -79662,7 +80301,7 @@ var ts; if (rightIsThis === void 0) { rightIsThis = false; } var properties = node.properties; var property = properties[propertyIndex]; - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */ || property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */ || property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var name = property.name; var exprType = getLiteralTypeFromPropertyName(name); if (isTypeUsableAsPropertyName(exprType)) { @@ -79675,9 +80314,9 @@ var ts; } var elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* AccessFlags.ExpressionPosition */, name); var type = getFlowTypeOfDestructuring(property, elementType); - return checkDestructuringAssignment(property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); + return checkDestructuringAssignment(property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); } - else if (property.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (property.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (propertyIndex < properties.length - 1) { error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } @@ -79715,7 +80354,7 @@ var ts; var inBoundsType = compilerOptions.noUncheckedIndexedAccess ? undefined : possiblyOutOfBoundsType; for (var i = 0; i < elements.length; i++) { var type = possiblyOutOfBoundsType; - if (node.elements[i].kind === 225 /* SyntaxKind.SpreadElement */) { + if (node.elements[i].kind === 227 /* SyntaxKind.SpreadElement */) { type = inBoundsType = inBoundsType !== null && inBoundsType !== void 0 ? inBoundsType : (checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, sourceType, undefinedType, node) || errorType); } checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode); @@ -79725,8 +80364,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 227 /* SyntaxKind.OmittedExpression */) { - if (element.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (element.kind !== 229 /* SyntaxKind.OmittedExpression */) { + if (element.kind !== 227 /* SyntaxKind.SpreadElement */) { var indexType = getNumberLiteralType(elementIndex); if (isArrayLikeType(sourceType)) { // We create a synthetic expression so that getIndexedAccessType doesn't get confused @@ -79744,7 +80383,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 221 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (restExpression.kind === 223 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -79760,7 +80399,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) { var target; - if (exprOrAssignment.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -79776,7 +80415,7 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 221 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (target.kind === 223 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { checkBinaryExpression(target, checkMode); target = target.left; // A default value is specified, so remove undefined from the final type. @@ -79784,20 +80423,20 @@ var ts; sourceType = getTypeWithFacts(sourceType, 524288 /* TypeFacts.NEUndefined */); } } - if (target.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (target.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, rightIsThis); } - if (target.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + if (target.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, checkMode); } return checkReferenceAssignment(target, sourceType, checkMode); } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var error = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; - var optionalError = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var optionalError = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; if (checkReferenceExpression(target, error, optionalError)) { @@ -79822,36 +80461,36 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 10 /* SyntaxKind.StringLiteral */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: return true; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -79863,9 +80502,9 @@ var ts; } return false; // Some forms listed here for clarity - case 217 /* SyntaxKind.VoidExpression */: // Explicit opt-out - case 211 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 229 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings + case 219 /* SyntaxKind.VoidExpression */: // Explicit opt-out + case 213 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 231 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -79902,7 +80541,7 @@ var ts; } checkGrammarNullishCoalesceWithLogicalExpression(node); var operator = node.operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { state.skip = true; setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === 108 /* SyntaxKind.ThisKeyword */)); return state; @@ -79924,11 +80563,11 @@ var ts; if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */ || operator === 56 /* SyntaxKind.BarBarToken */ || operator === 60 /* SyntaxKind.QuestionQuestionToken */) { if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */) { var parent = node.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)) { parent = parent.parent; } - checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined); + checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined); } checkTruthinessOfType(leftType, node.left); } @@ -79999,7 +80638,7 @@ var ts; // expression-wide checks and does not use a work stack to fold nested binary expressions into the same callstack frame function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 108 /* SyntaxKind.ThisKeyword */); } var leftType; @@ -80155,6 +80794,7 @@ var ts; var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */; error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true"); } + checkNaNEquality(errorNode, operator, left, right); reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); }); return booleanType; case 102 /* SyntaxKind.InstanceOfKeyword */: @@ -80350,20 +80990,35 @@ var ts; } } function tryGiveBetterPrimaryError(errNode, maybeMissingAwait, leftStr, rightStr) { - var typeName; switch (operatorToken.kind) { case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: case 34 /* SyntaxKind.EqualsEqualsToken */: - typeName = "false"; - break; case 37 /* SyntaxKind.ExclamationEqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: - typeName = "true"; + return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap, leftStr, rightStr); + default: + return undefined; } - if (typeName) { - return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, typeName, leftStr, rightStr); + } + function checkNaNEquality(errorNode, operator, left, right) { + var isLeftNaN = isGlobalNaN(ts.skipParentheses(left)); + var isRightNaN = isGlobalNaN(ts.skipParentheses(right)); + if (isLeftNaN || isRightNaN) { + var err = error(errorNode, ts.Diagnostics.This_condition_will_always_return_0, ts.tokenToString(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? 95 /* SyntaxKind.FalseKeyword */ : 110 /* SyntaxKind.TrueKeyword */)); + if (isLeftNaN && isRightNaN) + return; + var operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? ts.tokenToString(53 /* SyntaxKind.ExclamationToken */) : ""; + var location = isLeftNaN ? right : left; + var expression = ts.skipParentheses(location); + ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")"))); } - return undefined; + } + function isGlobalNaN(expr) { + if (ts.isIdentifier(expr) && expr.escapedText === "NaN") { + var globalNaNSymbol = getGlobalNaNSymbol(); + return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr); + } + return false; } } function getBaseTypesIfUnrelated(leftType, rightType, isRelated) { @@ -80444,8 +81099,8 @@ var ts; } } function checkConditionalExpression(node, checkMode) { - checkTruthinessExpression(node.condition); - checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue); + var type = checkTruthinessExpression(node.condition); + checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue); var type1 = checkExpression(node.whenTrue, checkMode); var type2 = checkExpression(node.whenFalse, checkMode); return getUnionType([type1, type2], 2 /* UnionReduction.Subtype */); @@ -80474,7 +81129,7 @@ var ts; type.flags & 58982400 /* TypeFlags.InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* TypeFlags.StringLike */)); } function getContextNode(node) { - if (node.kind === 286 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { + if (node.kind === 289 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { return node.parent.parent; // Needs to be the root JsxElement, so it encompasses the attributes _and_ the children (which are essentially part of the attributes) } return node; @@ -80528,8 +81183,8 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */ || - node.kind === 229 /* SyntaxKind.AsExpression */ || + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */ || + node.kind === 231 /* SyntaxKind.AsExpression */ || ts.isJSDocTypeAssertion(node); } function checkDeclarationInitializer(declaration, checkMode, contextualType) { @@ -80538,7 +81193,7 @@ var ts; (contextualType ? checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, checkMode || 0 /* CheckMode.Normal */) : checkExpressionCached(initializer, checkMode)); - return ts.isParameter(declaration) && declaration.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && + return ts.isParameter(declaration) && declaration.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; } @@ -80548,7 +81203,7 @@ var ts; var elementFlags = type.target.elementFlags.slice(); for (var i = getTypeReferenceArity(type); i < patternElements.length; i++) { var e = patternElements[i]; - if (i < patternElements.length - 1 || !(e.kind === 203 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { + if (i < patternElements.length - 1 || !(e.kind === 205 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { elementTypes.push(!ts.isOmittedExpression(e) && hasDefaultValue(e) ? getTypeFromBindingElement(e, /*includePatternInType*/ false, /*reportErrors*/ false) : anyType); elementFlags.push(2 /* ElementFlags.Optional */); if (!ts.isOmittedExpression(e) && !hasDefaultValue(e)) { @@ -80616,7 +81271,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, checkMode); @@ -80627,7 +81282,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -80701,6 +81356,9 @@ var ts; function hasInferenceCandidates(info) { return !!(info.candidates || info.contraCandidates); } + function hasInferenceCandidatesOrDefault(info) { + return !!(info.candidates || info.contraCandidates || hasTypeParameterDefault(info.typeParameter)); + } function hasOverlappingInferences(a, b) { for (var i = 0; i < a.length; i++) { if (hasInferenceCandidates(a[i]) && hasInferenceCandidates(b[i])) { @@ -80870,11 +81528,11 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || - (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || - (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums + var ok = (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || + (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || + (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query); } @@ -80899,9 +81557,9 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -80932,80 +81590,82 @@ var ts; return trueType; case 95 /* SyntaxKind.FalseKeyword */: return falseType; - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return checkTemplateExpression(node); case 13 /* SyntaxKind.RegularExpressionLiteral */: return globalRegExpType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return checkArrayLiteral(node, checkMode, forceTuple); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return checkObjectLiteral(node, checkMode); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return checkPropertyAccessExpression(node, checkMode); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return checkQualifiedName(node, checkMode); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return checkIndexedAccess(node, checkMode); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (node.expression.kind === 100 /* SyntaxKind.ImportKeyword */) { return checkImportCallExpression(node); } // falls through - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checkCallExpression(node, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return checkParenthesizedExpression(node, checkMode); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return checkClassExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return checkTypeOfExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return checkAssertion(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return checkNonNullAssertion(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return checkExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return checkSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return checkMetaProperty(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkDeleteExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return checkVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return checkAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checkBinaryExpression(node, checkMode); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return checkConditionalExpression(node, checkMode); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return checkSpreadExpression(node, checkMode); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return undefinedWideningType; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return checkYieldExpression(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return checkSyntheticExpression(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return checkJsxExpression(node, checkMode); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return checkJsxElement(node, checkMode); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return checkJsxSelfClosingElement(node, checkMode); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return checkJsxFragment(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return checkJsxAttributes(node, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return errorType; @@ -81064,10 +81724,10 @@ var ts; checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); if (ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { - if (!(func.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } - if (func.kind === 171 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { + if (func.kind === 173 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); } } @@ -81078,13 +81738,13 @@ var ts; if (func.parameters.indexOf(node) !== 0) { error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } - if (func.kind === 171 /* SyntaxKind.Constructor */ || func.kind === 175 /* SyntaxKind.ConstructSignature */ || func.kind === 180 /* SyntaxKind.ConstructorType */) { + if (func.kind === 173 /* SyntaxKind.Constructor */ || func.kind === 177 /* SyntaxKind.ConstructSignature */ || func.kind === 182 /* SyntaxKind.ConstructorType */) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter); } - if (func.kind === 172 /* SyntaxKind.GetAccessor */ || func.kind === 173 /* SyntaxKind.SetAccessor */) { + if (func.kind === 174 /* SyntaxKind.GetAccessor */ || func.kind === 175 /* SyntaxKind.SetAccessor */) { error(node, ts.Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); } } @@ -81142,13 +81802,13 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 179 /* SyntaxKind.FunctionType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 181 /* SyntaxKind.FunctionType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var parent = node.parent; if (node === parent.type) { return parent; @@ -81166,7 +81826,7 @@ var ts; error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + else if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -81175,13 +81835,13 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 176 /* SyntaxKind.IndexSignature */) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */) { checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === 179 /* SyntaxKind.FunctionType */ || node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 180 /* SyntaxKind.ConstructorType */ || - node.kind === 174 /* SyntaxKind.CallSignature */ || node.kind === 171 /* SyntaxKind.Constructor */ || - node.kind === 175 /* SyntaxKind.ConstructSignature */) { + else if (node.kind === 181 /* SyntaxKind.FunctionType */ || node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 182 /* SyntaxKind.ConstructorType */ || + node.kind === 176 /* SyntaxKind.CallSignature */ || node.kind === 173 /* SyntaxKind.Constructor */ || + node.kind === 177 /* SyntaxKind.ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } var functionFlags = ts.getFunctionFlags(node); @@ -81213,10 +81873,10 @@ var ts; var returnTypeNode = ts.getEffectiveReturnTypeNode(node); if (noImplicitAny && !returnTypeNode) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -81246,7 +81906,7 @@ var ts; checkAsyncFunctionReturnType(node, returnTypeNode); } } - if (node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 317 /* SyntaxKind.JSDocFunctionType */) { + if (node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 320 /* SyntaxKind.JSDocFunctionType */) { registerForUnusedIdentifiersCheck(node); } } @@ -81258,7 +81918,7 @@ var ts; var privateIdentifiers = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */) { + if (member.kind === 173 /* SyntaxKind.Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param, member) && !ts.isBindingPattern(param.name)) { @@ -81280,16 +81940,16 @@ var ts; var memberName = name && ts.getPropertyNameForPropertyNameNode(name); if (memberName) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: addName(names, name, memberName, 1 /* DeclarationMeaning.GetAccessor */ | privateStaticFlags); break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: addName(names, name, memberName, 2 /* DeclarationMeaning.SetAccessor */ | privateStaticFlags); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: addName(names, name, memberName, 3 /* DeclarationMeaning.GetOrSetAccessor */ | privateStaticFlags); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: addName(names, name, memberName, 8 /* DeclarationMeaning.Method */ | privateStaticFlags); break; } @@ -81361,7 +82021,7 @@ var ts; var names = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 166 /* SyntaxKind.PropertySignature */) { + if (member.kind === 168 /* SyntaxKind.PropertySignature */) { var memberName = void 0; var name = member.name; switch (name.kind) { @@ -81386,7 +82046,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -81434,7 +82094,7 @@ var ts; checkVariableLikeDeclaration(node); setNodeLinksForPrivateIdentifierScope(node); // property signatures already report "initializer not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { error(node, ts.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -81454,7 +82114,7 @@ var ts; // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration checkFunctionOrMethodDeclaration(node); // method signatures already report "implementation not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.body) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } // Private named methods are only allowed in class declarations @@ -81507,7 +82167,7 @@ var ts; if (ts.isPrivateIdentifierClassElementDeclaration(n)) { return true; } - return n.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return n.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(n) && !!n.initializer; } @@ -81590,7 +82250,7 @@ var ts; checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { if (!(node.flags & 16777216 /* NodeFlags.Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 256 /* NodeFlags.HasImplicitReturn */)) { if (!(node.flags & 512 /* NodeFlags.HasExplicitReturn */)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); @@ -81600,20 +82260,20 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. var symbol = getSymbolOfNode(node); - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); if (getter && setter && !(getNodeCheckFlags(getter) & 1 /* NodeCheckFlags.TypeChecked */)) { getNodeLinks(getter).flags |= 1 /* NodeCheckFlags.TypeChecked */; var getterFlags = ts.getEffectiveModifierFlags(getter); var setterFlags = ts.getEffectiveModifierFlags(setter); - if ((getterFlags & 128 /* ModifierFlags.Abstract */) !== (setterFlags & 128 /* ModifierFlags.Abstract */)) { + if ((getterFlags & 256 /* ModifierFlags.Abstract */) !== (setterFlags & 256 /* ModifierFlags.Abstract */)) { error(getter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); error(setter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } @@ -81630,7 +82290,7 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } @@ -81676,7 +82336,7 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); - if (node.kind === 178 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } ts.forEach(node.typeArguments, checkSourceElement); @@ -81692,7 +82352,7 @@ var ts; } var symbol = getNodeLinks(node).resolvedSymbol; if (symbol) { - if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) { + if (ts.some(symbol.declarations, function (d) { return ts.isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) { addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName); } if (type.flags & 32 /* TypeFlags.Enum */ && symbol.flags & 8 /* SymbolFlags.EnumMember */) { @@ -81734,7 +82394,7 @@ var ts; var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember); for (var _i = 0, elementTypes_1 = elementTypes; _i < elementTypes_1.length; _i++) { var e = elementTypes_1[_i]; - if (e.kind !== 197 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { + if (e.kind !== 199 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); break; } @@ -81783,7 +82443,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) { - if (accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(objectType) & 1 /* MappedTypeModifiers.IncludeReadonly */) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -81848,7 +82508,7 @@ var ts; ts.forEachChild(node, checkSourceElement); } function checkInferType(node) { - if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 189 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { + if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 191 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter); @@ -81858,7 +82518,7 @@ var ts; if (!links.typeParametersChecked) { links.typeParametersChecked = true; var typeParameter = getDeclaredTypeOfTypeParameter(symbol); - var declarations = ts.getDeclarationsOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var declarations = ts.getDeclarationsOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) { // Report an error on every conflicting declaration. var name = symbolToString(symbol); @@ -81899,10 +82559,10 @@ var ts; if (node.dotDotDotToken && node.questionToken) { grammarErrorOnNode(node, ts.Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); } - if (node.type.kind === 185 /* SyntaxKind.OptionalType */) { + if (node.type.kind === 187 /* SyntaxKind.OptionalType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type); } - if (node.type.kind === 186 /* SyntaxKind.RestType */) { + if (node.type.kind === 188 /* SyntaxKind.RestType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); } checkSourceElement(node.type); @@ -81915,9 +82575,9 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */ && - n.parent.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - n.parent.kind !== 226 /* SyntaxKind.ClassExpression */ && + if (n.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */ && + n.parent.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + n.parent.kind !== 228 /* SyntaxKind.ClassExpression */ && n.flags & 16777216 /* NodeFlags.Ambient */) { if (!(flags & 2 /* ModifierFlags.Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) { // It is nested in an ambient context, which means it is automatically exported @@ -81957,7 +82617,7 @@ var ts; else if (deviation & (8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { error(ts.getNameOfDeclaration(o) || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } - else if (deviation & 128 /* ModifierFlags.Abstract */) { + else if (deviation & 256 /* ModifierFlags.Abstract */) { error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); @@ -81974,7 +82634,7 @@ var ts; }); } } - var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 128 /* ModifierFlags.Abstract */; + var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 256 /* ModifierFlags.Abstract */; var someNodeFlags = 0 /* ModifierFlags.None */; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -82013,7 +82673,7 @@ var ts; // Both are literal property names that are the same. ts.isPropertyNameLiteral(node.name) && ts.isPropertyNameLiteral(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) { - var reportError = (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */) && + var reportError = (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */) && ts.isStatic(node) !== ts.isStatic(subsequentNode); // we can get here in two cases // 1. mixed static and instance class members @@ -82038,7 +82698,7 @@ var ts; else { // Report different errors regarding non-consecutive blocks of declarations depending on whether // the node in question is abstract. - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -82055,7 +82715,7 @@ var ts; var current = declarations_5[_i]; var node = current; var inAmbientContext = node.flags & 16777216 /* NodeFlags.Ambient */; - var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) || inAmbientContext; + var inAmbientContextOrInterface = node.parent && (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -82066,10 +82726,10 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if ((node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { + if ((node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { hasNonAmbientClass = true; } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */ || node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */ || node.kind === 173 /* SyntaxKind.Constructor */) { functionDeclarations.push(node); var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; @@ -82114,12 +82774,12 @@ var ts; }); } if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* SymbolFlags.Function */ && declarations) { - var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 257 /* SyntaxKind.ClassDeclaration */; }) + var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 260 /* SyntaxKind.ClassDeclaration */; }) .map(function (d) { return ts.createDiagnosticForNode(d, ts.Diagnostics.Consider_adding_a_declare_modifier_to_this_class); }); ts.forEach(declarations, function (declaration) { - var diagnostic = declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + var diagnostic = declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ ? ts.Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 - : declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ + : declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : undefined; if (diagnostic) { @@ -82129,7 +82789,7 @@ var ts; } // Abstract methods can't have an implementation -- in particular, they don't need one. if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 128 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { + !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 256 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -82175,9 +82835,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */); + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */); if (effectiveDeclarationFlags & 1 /* ModifierFlags.Export */) { - if (effectiveDeclarationFlags & 512 /* ModifierFlags.Default */) { + if (effectiveDeclarationFlags & 1024 /* ModifierFlags.Default */) { defaultExportedDeclarationSpaces |= declarationSpaces; } else { @@ -82210,26 +82870,26 @@ var ts; function getDeclarationSpaces(decl) { var d = decl; switch (d.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // A jsdoc typedef and callback are, by definition, type aliases. // falls through - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return 2 /* DeclarationSpaces.ExportType */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* ModuleInstanceState.NonInstantiated */ ? 4 /* DeclarationSpaces.ExportNamespace */ | 1 /* DeclarationSpaces.ExportValue */ : 4 /* DeclarationSpaces.ExportNamespace */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */ | 4 /* DeclarationSpaces.ExportNamespace */; - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: var node_2 = d; var expression = ts.isExportAssignment(node_2) ? node_2.expression : node_2.right; // Export assigned entity name expressions act as aliases and should fall through, otherwise they export values @@ -82239,19 +82899,19 @@ var ts; d = expression; // The below options all declare an Alias, which is allowed to merge with other values within the importing module. // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: var result_12 = 0 /* DeclarationSpaces.None */; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_12 |= getDeclarationSpaces(d); }); return result_12; - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 case 79 /* SyntaxKind.Identifier */: // https://github.com/microsoft/TypeScript/issues/36098 // Identifiers are used as declarations of assignment declarations whose parents may be // SyntaxKind.CallExpression - `Object.defineProperty(thing, "aField", {value: 42});` @@ -82295,7 +82955,7 @@ var ts; return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0]; } // primitives with a `{ then() }` won't be unwrapped/adopted. - if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { return undefined; } var thenFunction = getTypeOfPropertyOfType(type, "then"); // TODO: GH#18217 @@ -82362,7 +83022,7 @@ var ts; * Determines whether a type is an object with a callable `then` member. */ function isThenableType(type) { - if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { // primitive types cannot be considered "thenable" since they are not objects. return false; } @@ -82396,7 +83056,7 @@ var ts; // We only need `Awaited` if `T` is a type variable that has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`, // or is promise-like. if (baseConstraint ? - baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) : + baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) : maybeTypeOfKind(type, 8650752 /* TypeFlags.TypeVariable */)) { return true; } @@ -82664,20 +83324,20 @@ var ts; var headMessage; var expectedReturnType; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: headMessage = ts.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; expectedReturnType = voidType; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); @@ -82736,15 +83396,15 @@ var ts; function getEntityNameForDecoratorMetadata(node) { if (node) { switch (node.kind) { - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: return getEntityNameForDecoratorMetadataFromTypeList(node.types); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return getEntityNameForDecoratorMetadata(node.type); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; } } @@ -82753,13 +83413,13 @@ var ts; var commonEntityName; for (var _i = 0, types_21 = types; _i < types_21.length; _i++) { var typeNode = types_21[_i]; - while (typeNode.kind === 191 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 197 /* SyntaxKind.NamedTupleMember */) { + while (typeNode.kind === 193 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 199 /* SyntaxKind.NamedTupleMember */) { typeNode = typeNode.type; // Skip parens if need be } - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { continue; // Always elide `never` from the union/intersection if possible } - if (!strictNullChecks && (typeNode.kind === 196 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && (typeNode.kind === 198 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var individualEntityName = getEntityNameForDecoratorMetadata(typeNode); @@ -82805,14 +83465,14 @@ var ts; return; } checkExternalEmitHelpers(firstDecorator, 8 /* ExternalEmitHelpers.Decorate */); - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { checkExternalEmitHelpers(firstDecorator, 32 /* ExternalEmitHelpers.Param */); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16 /* ExternalEmitHelpers.Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -82821,23 +83481,23 @@ var ts; } } break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - var otherKind = node.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + var otherKind = node.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node)); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node)); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); var containingSignature = node.parent; for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) { @@ -82939,7 +83599,7 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; default: return undefined; @@ -82953,7 +83613,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -82979,7 +83639,7 @@ var ts; checkFunctionOrConstructorSymbol(symbol); } } - var body = node.kind === 168 /* SyntaxKind.MethodSignature */ ? undefined : node.body; + var body = node.kind === 170 /* SyntaxKind.MethodSignature */ ? undefined : node.body; checkSourceElement(body); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node)); addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics); @@ -83025,42 +83685,42 @@ var ts; for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) { var node = potentiallyUnusedIdentifiers_1[_i]; switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: checkUnusedClassMembers(node, addDiagnostic); checkUnusedTypeParameters(node, addDiagnostic); break; - case 305 /* SyntaxKind.SourceFile */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 308 /* SyntaxKind.SourceFile */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: checkUnusedLocalsAndParameters(node, addDiagnostic); break; - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.body) { // Don't report unused parameters in overloads checkUnusedLocalsAndParameters(node, addDiagnostic); } checkUnusedTypeParameters(node, addDiagnostic); break; - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: checkUnusedTypeParameters(node, addDiagnostic); break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: checkUnusedInferTypeParameter(node, addDiagnostic); break; default: @@ -83070,7 +83730,7 @@ var ts; } function errorUnusedLocal(declaration, name, addDiagnostic) { var node = ts.getNameOfDeclaration(declaration) || declaration; - var message = isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read; + var message = ts.isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read; addDiagnostic(declaration, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(node, message, name)); } function isIdentifierThatStartsWithUnderscore(node) { @@ -83080,11 +83740,11 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { // Already would have reported an error on the getter. break; } @@ -83095,7 +83755,7 @@ var ts; addDiagnostic(member, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.hasSyntacticModifier(parameter, 8 /* ModifierFlags.Private */)) { @@ -83103,9 +83763,9 @@ var ts; } } break; - case 176 /* SyntaxKind.IndexSignature */: - case 234 /* SyntaxKind.SemicolonClassElement */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 237 /* SyntaxKind.SemicolonClassElement */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Can't be private break; default: @@ -83133,7 +83793,7 @@ var ts; continue; var name = ts.idText(typeParameter.name); var parent = typeParameter.parent; - if (parent.kind !== 190 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { + if (parent.kind !== 192 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { if (ts.tryAddToSet(seenParentsWithEveryUnused, parent)) { var sourceFile = ts.getSourceFileOfNode(parent); var range = ts.isJSDocTemplateTag(parent) @@ -83239,7 +83899,7 @@ var ts; var importDecl = importClause.parent; var nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? - (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) + (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) : 0); if (nDeclarations === unuseds.length) { addDiagnostic(importDecl, 0 /* UnusedKind.Local */, unuseds.length === 1 @@ -83257,7 +83917,7 @@ var ts; var bindingPattern = _a[0], bindingElements = _a[1]; var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* UnusedKind.Parameter */ : 0 /* UnusedKind.Local */; if (bindingPattern.elements.length === bindingElements.length) { - if (bindingElements.length === 1 && bindingPattern.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (bindingElements.length === 1 && bindingPattern.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId); } else { @@ -83278,7 +83938,7 @@ var ts; if (declarationList.declarations.length === declarations.length) { addDiagnostic(declarationList, 0 /* UnusedKind.Local */, declarations.length === 1 ? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name)) - : ts.createDiagnosticForNode(declarationList.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); + : ts.createDiagnosticForNode(declarationList.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); } else { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -83308,22 +83968,22 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return ts.idText(name); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name); default: return ts.Debug.assertNever(name); } } function isImportedDeclaration(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */ || node.kind === 270 /* SyntaxKind.ImportSpecifier */ || node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 270 /* SyntaxKind.ImportClause */ || node.kind === 273 /* SyntaxKind.ImportSpecifier */ || node.kind === 271 /* SyntaxKind.NamespaceImport */; } function importClauseFromImported(decl) { - return decl.kind === 267 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 268 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; + return decl.kind === 270 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 271 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 235 /* SyntaxKind.Block */) { + if (node.kind === 238 /* SyntaxKind.Block */) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -83358,13 +84018,13 @@ var ts; if ((identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) !== name) { return false; } - if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */ || - node.kind === 168 /* SyntaxKind.MethodSignature */ || - node.kind === 172 /* SyntaxKind.GetAccessor */ || - node.kind === 173 /* SyntaxKind.SetAccessor */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */ || + node.kind === 170 /* SyntaxKind.MethodSignature */ || + node.kind === 174 /* SyntaxKind.GetAccessor */ || + node.kind === 175 /* SyntaxKind.SetAccessor */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */) { // it is ok to have member named '_super', '_this', `Promise`, etc. - member access is always qualified return false; } @@ -83430,7 +84090,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83445,7 +84105,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83545,7 +84205,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -83557,17 +84217,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* SymbolFlags.BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* NodeFlags.BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); - var container = varDeclList.parent.kind === 237 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); + var container = varDeclList.parent.kind === 240 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || - container.kind === 262 /* SyntaxKind.ModuleBlock */ || - container.kind === 261 /* SyntaxKind.ModuleDeclaration */ || - container.kind === 305 /* SyntaxKind.SourceFile */); + (container.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || + container.kind === 265 /* SyntaxKind.ModuleBlock */ || + container.kind === 264 /* SyntaxKind.ModuleDeclaration */ || + container.kind === 308 /* SyntaxKind.SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -83598,7 +84258,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); if (ts.hasOnlyExpressionInitializer(node) && node.initializer) { checkExpressionCached(node.initializer); @@ -83620,7 +84280,7 @@ var ts; checkExternalEmitHelpers(node, 4 /* ExternalEmitHelpers.Rest */); } // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access @@ -83642,7 +84302,7 @@ var ts; } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { + if (node.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* ExternalEmitHelpers.Read */); } ts.forEach(node.name.elements, checkSourceElement); @@ -83654,7 +84314,7 @@ var ts; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { - var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */; + var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */; var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression)); if (needCheckInitializer || needCheckWidenedType) { // Don't validate for-in initializer as it is already an error @@ -83682,7 +84342,7 @@ var ts; } // For a commonjs `const x = require`, validate the alias and exit var symbol = getSymbolOfNode(node); - if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { + if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 205 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { checkAliasSymbol(node); return; } @@ -83696,7 +84356,7 @@ var ts; ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) && !!((_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.size); - if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */) { + if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */) { checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined); } } @@ -83722,10 +84382,10 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionsForDeclarationName(node, node.name); @@ -83733,7 +84393,7 @@ var ts; } function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) { var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration); - var message = nextDeclaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 166 /* SyntaxKind.PropertySignature */ + var message = nextDeclaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 168 /* SyntaxKind.PropertySignature */ ? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; var declName = ts.declarationNameToString(nextDeclarationName); @@ -83743,8 +84403,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 164 /* SyntaxKind.Parameter */ && right.kind === 254 /* SyntaxKind.VariableDeclaration */) || - (left.kind === 254 /* SyntaxKind.VariableDeclaration */ && right.kind === 164 /* SyntaxKind.Parameter */)) { + if ((left.kind === 166 /* SyntaxKind.Parameter */ && right.kind === 257 /* SyntaxKind.VariableDeclaration */) || + (left.kind === 257 /* SyntaxKind.VariableDeclaration */ && right.kind === 166 /* SyntaxKind.Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -83753,8 +84413,8 @@ var ts; } var interestingFlags = 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | - 256 /* ModifierFlags.Async */ | - 128 /* ModifierFlags.Abstract */ | + 512 /* ModifierFlags.Async */ | + 256 /* ModifierFlags.Abstract */ | 64 /* ModifierFlags.Readonly */ | 32 /* ModifierFlags.Static */; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); @@ -83783,15 +84443,15 @@ var ts; function checkIfStatement(node) { // Grammar checking checkGrammarStatementInAmbientContext(node); - checkTruthinessExpression(node.expression); - checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement); + var type = checkTruthinessExpression(node.expression); + checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 236 /* SyntaxKind.EmptyStatement */) { + if (node.thenStatement.kind === 239 /* SyntaxKind.EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); } - function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) { + function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) { if (!strictNullChecks) return; helper(condExpr, body); @@ -83806,7 +84466,7 @@ var ts; : condExpr; if (ts.isModuleExportsAccessExpression(location)) return; - var type = checkTruthinessExpression(location); + var type = location === condExpr ? condType : checkTruthinessExpression(location); var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression); if (!(getTypeFacts(type) & 4194304 /* TypeFacts.Truthy */) || isPropertyExpressionCast) return; @@ -83920,12 +84580,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -83965,14 +84625,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node); // There may be a destructuring assignment on the left side - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -84004,7 +84664,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -84018,7 +84678,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -84500,7 +85160,16 @@ var ts; var message = allowAsyncIterables ? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator : ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator; - return errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type)); + var suggestAwait = + // for (const x of Promise<...>) or [...Promise<...>] + !!getAwaitedTypeOfPromise(type) + // for (const x of AsyncIterable<...>) + || (!allowAsyncIterables && + ts.isForOfStatement(errorNode.parent) && + errorNode.parent.expression === errorNode && + getGlobalAsyncIterableType(/** reportErrors */ false) !== emptyGenericType && + isTypeAssignableTo(type, getGlobalAsyncIterableType(/** reportErrors */ false))); + return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type)); } /** * Gets the *yield*, *return*, and *next* types from an `Iterator`-like or `AsyncIterator`-like type. @@ -84818,12 +85487,12 @@ var ts; var functionFlags = ts.getFunctionFlags(container); if (strictNullChecks || node.expression || returnType.flags & 131072 /* TypeFlags.Never */) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (container.kind === 173 /* SyntaxKind.SetAccessor */) { + if (container.kind === 175 /* SyntaxKind.SetAccessor */) { if (node.expression) { error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -84841,7 +85510,7 @@ var ts; } } } - else if (container.kind !== 171 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { + else if (container.kind !== 173 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { // The function has a return type, but the return statement doesn't have an expression. error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -84870,7 +85539,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -84879,7 +85548,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause)); } ts.forEach(clause.statements, checkSourceElement); @@ -84916,7 +85585,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 250 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { + if (current.kind === 253 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -85011,9 +85680,9 @@ var ts; return; } var indexInfos = getApplicableIndexInfos(type, propNameType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; - var propDeclaration = declaration && declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || - name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || + name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined; var _loop_30 = function (info) { var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; @@ -85038,7 +85707,7 @@ var ts; function checkIndexConstraintForIndexSignature(type, checkInfo) { var declaration = checkInfo.declaration; var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined; var _loop_31 = function (info) { if (info === checkInfo) @@ -85110,7 +85779,7 @@ var ts; } else { ts.forEach(jsdocParameters, function (_a, index) { - var name = _a.name; + var name = _a.name, isNameFirst = _a.isNameFirst; if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) { return; } @@ -85120,7 +85789,9 @@ var ts; } } else { - errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name)); + if (!isNameFirst) { + errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name)); + } } }); } @@ -85158,7 +85829,7 @@ var ts; function checkTypeParametersNotReferenced(root, typeParameters, index) { visit(root); function visit(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */) { var type = getTypeFromTypeReference(node); if (type.flags & 262144 /* TypeFlags.TypeParameter */) { for (var i = index; i < typeParameters.length; i++) { @@ -85248,7 +85919,7 @@ var ts; if (firstDecorator && ts.some(node.members, function (p) { return ts.hasStaticModifier(p) && ts.isPrivateIdentifierClassElementDeclaration(p); })) { grammarErrorOnNode(firstDecorator, ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator); } - if (!node.name && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (!node.name && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -85315,7 +85986,7 @@ var ts; } else { var constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); - if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(node.name || node, ts.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract); } } @@ -85550,7 +86221,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 257 /* SyntaxKind.ClassDeclaration */ || d.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return d.kind === 260 /* SyntaxKind.ClassDeclaration */ || d.kind === 261 /* SyntaxKind.InterfaceDeclaration */; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -85591,7 +86262,7 @@ var ts; // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. - if (baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 128 /* ModifierFlags.Abstract */))) { + if (baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 256 /* ModifierFlags.Abstract */))) { // Searches other base types for a declaration that would satisfy the inherited abstract member. // (The class may have more than one base type via declaration merging with an interface with the // same name.) @@ -85605,7 +86276,7 @@ var ts; return "continue-basePropertyCheck"; } } - if (derivedClassDecl.kind === 226 /* SyntaxKind.ClassExpression */) { + if (derivedClassDecl.kind === 228 /* SyntaxKind.ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -85640,11 +86311,11 @@ var ts; error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type)); } else if (useDefineForClassFields) { - var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); + var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); if (uninitialized && !(derived.flags & 33554432 /* SymbolFlags.Transient */) - && !(baseDeclarationFlags & 128 /* ModifierFlags.Abstract */) - && !(derivedDeclarationFlags & 128 /* ModifierFlags.Abstract */) + && !(baseDeclarationFlags & 256 /* ModifierFlags.Abstract */) + && !(derivedDeclarationFlags & 256 /* ModifierFlags.Abstract */) && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* NodeFlags.Ambient */); }))) { var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol)); var propName = uninitialized.name; @@ -85687,7 +86358,7 @@ var ts; } } function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) { - return baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) + return baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) || ts.isInterfaceDeclaration(declaration.parent); } function getNonInheritedProperties(type, baseTypes, properties) { @@ -85769,7 +86440,7 @@ var ts; } } function isPropertyWithoutInitializer(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; @@ -85812,7 +86483,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -85845,7 +86516,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); checkExportsOnMergedDeclarations(node); checkTypeParameters(node.typeParameters); - if (node.type.kind === 138 /* SyntaxKind.IntrinsicKeyword */) { + if (node.type.kind === 139 /* SyntaxKind.IntrinsicKeyword */) { if (!intrinsicTypeKinds.has(node.name.escapedText) || ts.length(node.typeParameters) !== 1) { error(node.type, ts.Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); } @@ -85931,7 +86602,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -85941,7 +86612,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -85970,7 +86641,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: checkGrammarNumericLiteral(expr); return +expr.text; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return evaluate(expr.expression); case 79 /* SyntaxKind.Identifier */: var identifier = expr; @@ -85978,13 +86649,13 @@ var ts; return +(identifier.escapedText); } return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (isConstantMemberAccess(expr)) { var type = getTypeOfExpression(expr.expression); if (type.symbol && type.symbol.flags & 384 /* SymbolFlags.Enum */) { var name = void 0; - if (expr.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (expr.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { name = expr.name.escapedText; } else { @@ -86021,8 +86692,8 @@ var ts; return false; } return node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || - node.kind === 207 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && + node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || + node.kind === 209 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && ts.isStringLiteralLike(node.argumentExpression); } function checkEnumDeclaration(node) { @@ -86056,7 +86727,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -86085,8 +86756,8 @@ var ts; if (declarations) { for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; - if ((declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || - (declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || + (declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { return declaration; } @@ -86157,7 +86828,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 257 /* SyntaxKind.ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 260 /* SyntaxKind.ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* NodeCheckFlags.LexicalModuleMergesWithClass */; @@ -86200,56 +86871,43 @@ var ts; } } function checkModuleAugmentationElement(node, isGlobalAugmentation) { - var _a; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement - for (var _i = 0, _b = node.declarationList.declarations; _i < _b.length; _i++) { - var decl = _b[_i]; + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 203 /* SyntaxKind.BindingElement */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: var name = node.name; if (ts.isBindingPattern(name)) { - for (var _c = 0, _d = name.elements; _c < _d.length; _c++) { - var el = _d[_c]; + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { + var el = _c[_b]; // mark individual names in binding pattern checkModuleAugmentationElement(el, isGlobalAugmentation); } break; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } - var symbol = getSymbolOfNode(node); - if (symbol) { - // module augmentations cannot introduce new names on the top level scope of the module - // this is done it two steps - // 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error - // 2. main check - report error if value declaration of the parent symbol is module augmentation) - var reportError = !(symbol.flags & 33554432 /* SymbolFlags.Transient */); - if (!reportError) { - // symbol should not originate in augmentation - reportError = !!((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.declarations) && ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); - } - } break; } } @@ -86257,12 +86915,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { if (ts.isModuleExportsAccessExpression(node.expression) && !ts.isPrivateIdentifier(node.name)) { return node.name; @@ -86282,9 +86940,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 272 /* SyntaxKind.ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 275 /* SyntaxKind.ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -86331,8 +86989,8 @@ var ts; var errorNode = ts.isImportOrExportSpecifier(node) ? node.propertyName || node.name : ts.isNamedDeclaration(node) ? node.name : node; - ts.Debug.assert(node.kind !== 274 /* SyntaxKind.NamespaceExport */); - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */) { + ts.Debug.assert(node.kind !== 277 /* SyntaxKind.NamespaceExport */); + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */) { var diag = error(errorNode, ts.Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files); var alreadyExportedSymbol = (_b = (_a = ts.getSourceFileOfNode(node).symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.get((node.propertyName || node.name).escapedText); if (alreadyExportedSymbol === target) { @@ -86343,7 +87001,7 @@ var ts; } } else { - ts.Debug.assert(node.kind !== 254 /* SyntaxKind.VariableDeclaration */); + ts.Debug.assert(node.kind !== 257 /* SyntaxKind.VariableDeclaration */); var importDeclaration = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)); var moduleSpecifier = (_e = (importDeclaration && ((_d = ts.tryGetModuleSpecifierFromDeclaration(importDeclaration)) === null || _d === void 0 ? void 0 : _d.text))) !== null && _e !== void 0 ? _e : "..."; var importedIdentifier = ts.unescapeLeadingUnderscores(ts.isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName); @@ -86351,11 +87009,12 @@ var ts; } return; } + var targetFlags = getAllSymbolFlags(target); var excludedMeanings = (symbol.flags & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */) ? 111551 /* SymbolFlags.Value */ : 0) | (symbol.flags & 788968 /* SymbolFlags.Type */ ? 788968 /* SymbolFlags.Type */ : 0) | (symbol.flags & 1920 /* SymbolFlags.Namespace */ ? 1920 /* SymbolFlags.Namespace */ : 0); - if (target.flags & excludedMeanings) { - var message = node.kind === 275 /* SyntaxKind.ExportSpecifier */ ? + if (targetFlags & excludedMeanings) { + var message = node.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -86364,26 +87023,26 @@ var ts; && !ts.isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 16777216 /* NodeFlags.Ambient */)) { var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol); - var isType = !(target.flags & 111551 /* SymbolFlags.Value */); + var isType = !(targetFlags & 111551 /* SymbolFlags.Value */); if (isType || typeOnlyAlias) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { if (compilerOptions.preserveValueImports) { ts.Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name"); var message = isType ? ts.Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled : ts.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled; - var name = ts.idText(node.kind === 270 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); + var name = ts.idText(node.kind === 273 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name); } - if (isType && node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { + if (isType && node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided); } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // Don't allow re-exporting an export that will be elided when `--isolatedModules` is set. // The exception is that `import type { A } from './a'; export { A }` is allowed // because single-file analysis can determine that the export should be dropped. @@ -86442,7 +87101,7 @@ var ts; function checkImportBinding(node) { checkCollisionsForDeclarationName(node, node.name); checkAliasSymbol(node); - if (node.kind === 270 /* SyntaxKind.ImportSpecifier */ && + if (node.kind === 273 /* SyntaxKind.ImportSpecifier */ && ts.idText(node.propertyName || node.name) === "default" && ts.getESModuleInterop(compilerOptions) && moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) { @@ -86492,7 +87151,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { checkImportBinding(importClause.namedBindings); if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && ts.getESModuleInterop(compilerOptions)) { // import * as ns from "foo"; @@ -86521,17 +87180,18 @@ var ts; if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */) { + if (node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { - if (target.flags & 111551 /* SymbolFlags.Value */) { + var targetFlags = getAllSymbolFlags(target); + if (targetFlags & 111551 /* SymbolFlags.Value */) { // Target is a value symbol, check that it is not hidden by a local declaration with the same name var moduleName = ts.getFirstIdentifier(node.moduleReference); if (!(resolveEntityName(moduleName, 111551 /* SymbolFlags.Value */ | 1920 /* SymbolFlags.Namespace */).flags & 1920 /* SymbolFlags.Namespace */)) { error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName)); } } - if (target.flags & 788968 /* SymbolFlags.Type */) { + if (targetFlags & 788968 /* SymbolFlags.Type */) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0); } } @@ -86564,10 +87224,10 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* NodeFlags.Ambient */; - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -86602,7 +87262,7 @@ var ts; function checkGrammarExportDeclaration(node) { var _a; if (node.isTypeOnly) { - if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 273 /* SyntaxKind.NamedExports */) { + if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 276 /* SyntaxKind.NamedExports */) { return checkGrammarNamedImportsOrExports(node.exportClause); } else { @@ -86612,7 +87272,7 @@ var ts; return false; } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 305 /* SyntaxKind.SourceFile */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 308 /* SyntaxKind.SourceFile */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -86670,7 +87330,7 @@ var ts; markExportAsReferenced(node); } var target = symbol && (symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol); - if (!target || target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (!target || getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) { checkExpressionCached(node.propertyName || node.name); } } @@ -86692,8 +87352,8 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -86717,7 +87377,7 @@ var ts; markAliasReferenced(sym, id); // If not a value, we're interpreting the identifier as a type export, along the lines of (`export { Id as default }`) var target = sym.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(sym) : sym; - if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) { // However if it is a value, we need to check it's being used correctly checkExpressionCached(node.expression); } @@ -86825,181 +87485,181 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } - if (kind >= 237 /* SyntaxKind.FirstStatement */ && kind <= 253 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { + if (kind >= 240 /* SyntaxKind.FirstStatement */ && kind <= 256 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, ts.Diagnostics.Unreachable_code_detected); } switch (kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return checkTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return checkParameter(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return checkPropertyDeclaration(node); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checkPropertySignature(node); - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return checkSignatureDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return checkMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return checkClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return checkConstructorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return checkAccessorDeclaration(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return checkTypeReferenceNode(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return checkTypePredicate(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return checkTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return checkTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return checkArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return checkTupleType(node); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return checkUnionOrIntersectionType(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: return checkSourceElement(node.type); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return checkThisType(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return checkTypeOperator(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return checkConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return checkInferType(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return checkTemplateLiteralType(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return checkImportType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return checkNamedTupleMember(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return checkJSDocImplementsTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return checkJSDocTypeAliasTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return checkJSDocTemplateTag(node); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return checkJSDocTypeTag(node); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: + case 327 /* SyntaxKind.JSDocLink */: + case 328 /* SyntaxKind.JSDocLinkCode */: + case 329 /* SyntaxKind.JSDocLinkPlain */: return checkJSDocLinkLikeTag(node); - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return checkJSDocParameterTag(node); - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return checkJSDocPropertyTag(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: checkJSDocFunctionType(node); // falls through - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: checkJSDocVariadicType(node); return; - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return checkSourceElement(node.type); - case 333 /* SyntaxKind.JSDocPublicTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: return checkJSDocAccessibilityModifiers(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return checkIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return checkMappedType(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return checkFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return checkBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return checkVariableStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return checkExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return checkIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return checkDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return checkWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return checkForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return checkForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: return checkBreakOrContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return checkReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return checkSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return checkThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return checkTryStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checkVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return checkBindingElement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return checkClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return checkEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return checkModuleDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return checkImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return checkExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return checkExportAssignment(node); - case 236 /* SyntaxKind.EmptyStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -87106,36 +87766,36 @@ var ts; currentNode = node; instantiationCount = 0; switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: // These node kinds are deferred checked when overload resolution fails // To save on work, we ensure the arguments are checked just once, in // a deferred way resolveUntypedCall(node); break; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: checkAccessorDeclaration(node); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: checkClassExpressionDeferred(node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: checkTypeParameterDeferred(node); break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: checkJsxSelfClosingElementDeferred(node); break; - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: checkJsxElementDeferred(node); break; } @@ -87308,17 +87968,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalModule(location)) break; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: copyLocallyVisibleExportSymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* SymbolFlags.ModuleMember */); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* SymbolFlags.EnumMember */); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); @@ -87326,8 +87986,8 @@ var ts; // this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration. // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -87336,7 +87996,7 @@ var ts; copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968 /* SymbolFlags.Type */); } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -87380,7 +88040,7 @@ var ts; if (meaning) { source.forEach(function (symbol) { // Similar condition as in `resolveNameHelper` - if (!ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 274 /* SyntaxKind.NamespaceExport */)) { + if (!ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 277 /* SyntaxKind.NamespaceExport */)) { copySymbol(symbol, meaning); } }); @@ -87389,41 +88049,21 @@ var ts; } function isTypeDeclarationName(name) { return name.kind === 79 /* SyntaxKind.Identifier */ && - isTypeDeclaration(name.parent) && + ts.isTypeDeclaration(name.parent) && ts.getNameOfDeclaration(name.parent) === name; } - function isTypeDeclaration(node) { - switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - return true; - case 267 /* SyntaxKind.ImportClause */: - return node.isTypeOnly; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - return node.parent.parent.isTypeOnly; - default: - return false; - } - } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 178 /* SyntaxKind.TypeReference */; + return node.parent.kind === 180 /* SyntaxKind.TypeReference */; } function isHeritageClauseElementIdentifier(node) { - while (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - return node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -87451,13 +88091,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (nodeOnRightSide.parent.kind === 163 /* SyntaxKind.QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } - if (nodeOnRightSide.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } return undefined; @@ -87483,7 +88123,7 @@ var ts; node = parent; parent = parent.parent; } - if (parent && parent.kind === 200 /* SyntaxKind.ImportType */ && parent.qualifier === node) { + if (parent && parent.kind === 202 /* SyntaxKind.ImportType */ && parent.qualifier === node) { return parent; } return undefined; @@ -87493,7 +88133,7 @@ var ts; return getSymbolOfNode(name.parent); } if (ts.isInJSFile(name) && - name.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + name.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && name.parent === name.parent.parent.left) { // Check if this is a special property assignment if (!ts.isPrivateIdentifier(name) && !ts.isJSDocMemberName(name)) { @@ -87503,7 +88143,7 @@ var ts; } } } - if (name.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { + if (name.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { // Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression var success = resolveEntityName(name, /*all meanings*/ 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*ignoreErrors*/ true); @@ -87513,7 +88153,7 @@ var ts; } else if (ts.isEntityName(name) && isInRightSideOfImportOrExportAssignment(name)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(name, 265 /* SyntaxKind.ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(name, 268 /* SyntaxKind.ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(name, /*dontResolveAlias*/ true); } @@ -87531,7 +88171,7 @@ var ts; if (isHeritageClauseElementIdentifier(name)) { var meaning = 0 /* SymbolFlags.None */; // In an interface or class, we're definitely interested in a type. - if (name.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (name.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { meaning = 788968 /* SymbolFlags.Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) { @@ -87547,10 +88187,10 @@ var ts; return entityNameSymbol; } } - if (name.parent.kind === 340 /* SyntaxKind.JSDocParameterTag */) { + if (name.parent.kind === 343 /* SyntaxKind.JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(name.parent); } - if (name.parent.kind === 163 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 344 /* SyntaxKind.JSDocTemplateTag */) { + if (name.parent.kind === 165 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 347 /* SyntaxKind.JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJSFile(name)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(name.parent); return typeParameter && typeParameter.symbol; @@ -87574,18 +88214,53 @@ var ts; return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container)); } } + if (result && isJSDoc_1) { + var container = ts.getJSDocHost(name); + if (container && ts.isEnumMember(container) && container === result.valueDeclaration) { + return resolveEntityName(name, meaning, /*ignoreErrors*/ true, /* dontResolveAlias */ true, ts.getSourceFileOfNode(container)) || result; + } + } return result; } else if (ts.isPrivateIdentifier(name)) { return getSymbolForPrivateIdentifierExpression(name); } - else if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 161 /* SyntaxKind.QualifiedName */) { + else if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 163 /* SyntaxKind.QualifiedName */) { var links = getNodeLinks(name); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { checkPropertyAccessExpression(name, 0 /* CheckMode.Normal */); + if (!links.resolvedSymbol) { + var expressionType = checkExpressionCached(name.expression); + var infos = getApplicableIndexInfos(expressionType, getLiteralTypeFromPropertyName(name.name)); + if (infos.length && expressionType.members) { + var resolved = resolveStructuredTypeMembers(expressionType); + var symbol = resolved.members.get("__index" /* InternalSymbolName.Index */); + if (infos === getIndexInfosOfType(expressionType)) { + links.resolvedSymbol = symbol; + } + else if (symbol) { + var symbolLinks_1 = getSymbolLinks(symbol); + var declarationList = ts.mapDefined(infos, function (i) { return i.declaration; }); + var nodeListId = ts.map(declarationList, getNodeId).join(","); + if (!symbolLinks_1.filteredIndexSymbolCache) { + symbolLinks_1.filteredIndexSymbolCache = new ts.Map(); + } + if (symbolLinks_1.filteredIndexSymbolCache.has(nodeListId)) { + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + else { + var copy = createSymbol(131072 /* SymbolFlags.Signature */, "__index" /* InternalSymbolName.Index */); + copy.declarations = ts.mapDefined(infos, function (i) { return i.declaration; }); + copy.parent = expressionType.aliasSymbol ? expressionType.aliasSymbol : expressionType.symbol ? expressionType.symbol : getSymbolAtLocation(copy.declarations[0].parent); + symbolLinks_1.filteredIndexSymbolCache.set(nodeListId, copy); + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + } + } + } } else { checkQualifiedName(name, 0 /* CheckMode.Normal */); @@ -87600,11 +88275,11 @@ var ts; } } else if (isTypeReferenceIdentifier(name)) { - var meaning = name.parent.kind === 178 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; + var meaning = name.parent.kind === 180 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; var symbol = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name); } - if (name.parent.kind === 177 /* SyntaxKind.TypePredicate */) { + if (name.parent.kind === 179 /* SyntaxKind.TypePredicate */) { return resolveEntityName(name, /*meaning*/ 1 /* SymbolFlags.FunctionScopedVariable */); } return undefined; @@ -87638,7 +88313,7 @@ var ts; } } function getSymbolAtLocation(node, ignoreErrors) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } var parent = node.parent; @@ -87661,8 +88336,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } - else if (parent.kind === 203 /* SyntaxKind.BindingElement */ && - grandParent.kind === 201 /* SyntaxKind.ObjectBindingPattern */ && + else if (parent.kind === 205 /* SyntaxKind.BindingElement */ && + grandParent.kind === 203 /* SyntaxKind.ObjectBindingPattern */ && node === parent.propertyName) { var typeOfPattern = getTypeOfNode(grandParent); var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText); @@ -87689,8 +88364,8 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: if (!ts.isThisInTypeQuery(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } @@ -87707,14 +88382,14 @@ var ts; return checkExpression(node).symbol; } // falls through - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return getTypeFromThisTypeNode(node).symbol; case 106 /* SyntaxKind.SuperKeyword */: return checkExpression(node).symbol; - case 134 /* SyntaxKind.ConstructorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 171 /* SyntaxKind.Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 173 /* SyntaxKind.Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -87725,7 +88400,7 @@ var ts; // 3). Dynamic import call or require in javascript // 4). type A = import("./f/*gotToDefinitionHere*/oo") if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 272 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || + ((node.parent.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 275 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || ((ts.isInJSFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent)) || (ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) { return resolveExternalModuleName(node, node, ignoreErrors); @@ -87747,14 +88422,14 @@ var ts; case 38 /* SyntaxKind.EqualsGreaterThanToken */: case 84 /* SyntaxKind.ClassKeyword */: return getSymbolOfNode(node.parent); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : undefined; case 93 /* SyntaxKind.ExportKeyword */: return ts.isExportAssignment(node.parent) ? ts.Debug.checkDefined(node.parent.symbol) : undefined; case 100 /* SyntaxKind.ImportKeyword */: case 103 /* SyntaxKind.NewKeyword */: return ts.isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : undefined; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return checkExpression(node).symbol; default: return undefined; @@ -87770,7 +88445,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (location && location.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 111551 /* SymbolFlags.Value */ | 2097152 /* SymbolFlags.Alias */); } return undefined; @@ -87809,7 +88484,7 @@ var ts; var baseType = ts.firstOrUndefined(getBaseTypes(classType)); return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType; } - if (isTypeDeclaration(node)) { + if (ts.isTypeDeclaration(node)) { // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); @@ -87852,23 +88527,23 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfAssignmentPattern(expr) { - ts.Debug.assert(expr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (expr.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expr.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (expr.parent.kind === 299 /* SyntaxKind.PropertyAssignment */) { var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression); var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType; var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent); @@ -87916,7 +88591,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 10 /* SyntaxKind.StringLiteral */: return getStringLiteralType(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameType = checkComputedPropertyName(name); return isTypeAssignableToKind(nameType, 12288 /* TypeFlags.ESSymbolLike */) ? nameType : stringType; default: @@ -88004,7 +88679,7 @@ var ts; return symbolLinks.exportsSomeValue; function isValue(s) { s = resolveSymbol(s); - return s && !!(s.flags & 111551 /* SymbolFlags.Value */); + return s && !!(getAllSymbolFlags(s) & 111551 /* SymbolFlags.Value */); } } function isNameOfModuleOrEnumDeclaration(node) { @@ -88034,7 +88709,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 305 /* SyntaxKind.SourceFile */) { + if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 308 /* SyntaxKind.SourceFile */) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -88054,10 +88729,10 @@ var ts; } var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier); if (node) { - var symbol = getReferencedValueSymbol(node); + var symbol = getReferencedValueOrAliasSymbol(node); // We should only get the declaration of an alias if there isn't a local value // declaration for the symbol - if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) { return getDeclarationOfAliasSymbol(symbol); } } @@ -88066,7 +88741,7 @@ var ts; function isSymbolOfDestructuredElementOfCatchBinding(symbol) { return symbol.valueDeclaration && ts.isBindingElement(symbol.valueDeclaration) - && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 292 /* SyntaxKind.CatchClause */; + && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 295 /* SyntaxKind.CatchClause */; } function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 /* SymbolFlags.BlockScoped */ && symbol.valueDeclaration && !ts.isSourceFile(symbol.valueDeclaration)) { @@ -88097,7 +88772,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 235 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 238 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -88138,19 +88813,19 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: var symbol = getSymbolOfNode(node); - return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol); - case 272 /* SyntaxKind.ExportDeclaration */: + return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */); + case 275 /* SyntaxKind.ExportDeclaration */: var exportClause = node.exportClause; return !!exportClause && (ts.isNamespaceExport(exportClause) || ts.some(exportClause.elements, isValueAliasDeclaration)); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return node.expression && node.expression.kind === 79 /* SyntaxKind.Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; @@ -88159,7 +88834,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(nodeIn) { var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -88167,6 +88842,7 @@ var ts; return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference); } function isAliasResolvedToValue(symbol) { + var _a; if (!symbol) { return false; } @@ -88176,7 +88852,7 @@ var ts; } // const enums and modules that contain only const enums are not considered values from the emit perspective // unless 'preserveConstEnums' option is set to true - return !!(target.flags & 111551 /* SymbolFlags.Value */) && + return !!(((_a = getAllSymbolFlags(target)) !== null && _a !== void 0 ? _a : -1) & 111551 /* SymbolFlags.Value */) && (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target)); } function isConstEnumOrConstEnumOnlyModule(s) { @@ -88191,7 +88867,7 @@ var ts; } var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217 if (target && ts.getEffectiveModifierFlags(node) & 1 /* ModifierFlags.Export */ && - target.flags & 111551 /* SymbolFlags.Value */ && + getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */ && (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) { // An `export import ... =` of a value symbol is always considered referenced return true; @@ -88269,15 +88945,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 299 /* SyntaxKind.EnumMember */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 302 /* SyntaxKind.EnumMember */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return true; } return false; } function getConstantValue(node) { - if (node.kind === 299 /* SyntaxKind.EnumMember */) { + if (node.kind === 302 /* SyntaxKind.EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -88370,7 +89046,7 @@ var ts; function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) { var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor); if (!declaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } // Get type of the symbol if this is the valid symbol otherwise get type at location var symbol = getSymbolOfNode(declaration); @@ -88389,7 +89065,7 @@ var ts; function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) { var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike); if (!signatureDeclaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var signature = getSignatureFromDeclaration(signatureDeclaration); return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88397,7 +89073,7 @@ var ts; function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) { var expr = ts.getParseTreeNode(exprIn, ts.isExpression); if (!expr) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var type = getWidenedType(getRegularTypeOfExpression(expr)); return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88421,6 +89097,25 @@ var ts; } return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); } + /** + * Get either a value-meaning symbol or an alias symbol. + * Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol, + * we call `resolveName` to find a symbol. + * This is because when caching the resolved symbol, we only consider value symbols, but here + * we want to also get an alias symbol if one exists. + */ + function getReferencedValueOrAliasSymbol(reference) { + var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; + if (resolvedSymbol && resolvedSymbol !== unknownSymbol) { + return resolvedSymbol; + } + return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, + /*nodeNotFoundMessage*/ undefined, + /*nameArg*/ undefined, + /*isUse*/ true, + /*excludeGlobals*/ undefined, + /*getSpellingSuggestions*/ undefined); + } function getReferencedValueDeclaration(referenceIn) { if (!ts.isGeneratedIdentifier(referenceIn)) { var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier); @@ -88554,12 +89249,12 @@ var ts; getJsxFragmentFactoryEntity: getJsxFragmentFactoryEntity, getAllAccessorDeclarations: function (accessor) { accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); // TODO: GH#18217 - var otherKind = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? 172 /* SyntaxKind.GetAccessor */ : 173 /* SyntaxKind.SetAccessor */; + var otherKind = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? 174 /* SyntaxKind.GetAccessor */ : 175 /* SyntaxKind.SetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind); var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor; var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor; - var setAccessor = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; - var getAccessor = accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; + var setAccessor = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; + var getAccessor = accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; return { firstAccessor: firstAccessor, secondAccessor: secondAccessor, @@ -88575,7 +89270,7 @@ var ts; }, getDeclarationStatementsForSourceFile: function (node, flags, tracker, bundled) { var n = ts.getParseTreeNode(node); - ts.Debug.assert(n && n.kind === 305 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); + ts.Debug.assert(n && n.kind === 308 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); var sym = getSymbolOfNode(node); if (!sym) { return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker, bundled); @@ -88612,7 +89307,7 @@ var ts; return false; } function isInHeritageClause(node) { - return node.parent && node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */; + return node.parent && node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */; } // defined here to avoid outer scope pollution function getTypeReferenceDirectivesForEntityName(node) { @@ -88625,12 +89320,12 @@ var ts; // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries var meaning; - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } else { meaning = 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */; - if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { + if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } } @@ -88679,7 +89374,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 305 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 308 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -88707,12 +89402,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); // TODO: GH#18217 if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 305 /* SyntaxKind.SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 308 /* SyntaxKind.SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -88924,14 +89619,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) { - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (ts.hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -88950,26 +89645,26 @@ var ts; var modifier = _a[_i]; if (ts.isDecorator(modifier)) continue; - if (modifier.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.kind === 166 /* SyntaxKind.PropertySignature */ || node.kind === 168 /* SyntaxKind.MethodSignature */) { + if (modifier.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.kind === 168 /* SyntaxKind.PropertySignature */ || node.kind === 170 /* SyntaxKind.MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 176 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } - if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 144 /* SyntaxKind.OutKeyword */) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 145 /* SyntaxKind.OutKeyword */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 85 /* SyntaxKind.ConstKeyword */: - if (node.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(85 /* SyntaxKind.ConstKeyword */)); } break; - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "override"); @@ -88980,7 +89675,10 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor"); + } + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); } flags |= 16384 /* ModifierFlags.Override */; @@ -88999,16 +89697,19 @@ var ts; else if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor"); + } else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { if (modifier.kind === 121 /* SyntaxKind.PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } @@ -89028,16 +89729,19 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); + } + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -89046,11 +89750,26 @@ var ts; flags |= 32 /* ModifierFlags.Static */; lastStatic = modifier; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "accessor"); + } + else if (flags & 64 /* ModifierFlags.Readonly */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); + } + else if (flags & 2 /* ModifierFlags.Ambient */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); + } + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */) { + return grammarErrorOnNode(modifier, ts.Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); + } + flags |= 128 /* ModifierFlags.Accessor */; + break; + case 146 /* SyntaxKind.ReadonlyKeyword */: if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */ && node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 164 /* SyntaxKind.Parameter */) { + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */ && node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 166 /* SyntaxKind.Parameter */) { // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } @@ -89063,35 +89782,35 @@ var ts; else if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (ts.isClassLike(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* ModifierFlags.Export */; break; case 88 /* SyntaxKind.DefaultKeyword */: - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } else if (!(flags & 1 /* ModifierFlags.Export */)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); } - flags |= 512 /* ModifierFlags.Default */; + flags |= 1024 /* ModifierFlags.Default */; break; - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -89100,10 +89819,10 @@ var ts; else if (ts.isClassLike(node.parent) && !ts.isPropertyDeclaration(node)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } else if (ts.isPrivateIdentifierClassElementDeclaration(node)) { @@ -89113,18 +89832,18 @@ var ts; lastDeclare = modifier; break; case 126 /* SyntaxKind.AbstractKeyword */: - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - node.kind !== 180 /* SyntaxKind.ConstructorType */) { - if (node.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - node.kind !== 172 /* SyntaxKind.GetAccessor */ && - node.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (node.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + node.kind !== 182 /* SyntaxKind.ConstructorType */) { + if (node.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + node.kind !== 174 /* SyntaxKind.GetAccessor */ && + node.kind !== 175 /* SyntaxKind.SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */))) { + if (!(node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* ModifierFlags.Static */) { @@ -89133,39 +89852,42 @@ var ts; if (flags & 8 /* ModifierFlags.Private */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } - if (flags & 256 /* ModifierFlags.Async */ && lastAsync) { + if (flags & 512 /* ModifierFlags.Async */ && lastAsync) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); } + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); + } } if (ts.isNamedDeclaration(node) && node.name.kind === 80 /* SyntaxKind.PrivateIdentifier */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); } - flags |= 128 /* ModifierFlags.Abstract */; + flags |= 256 /* ModifierFlags.Abstract */; break; - case 131 /* SyntaxKind.AsyncKeyword */: - if (flags & 256 /* ModifierFlags.Async */) { + case 132 /* SyntaxKind.AsyncKeyword */: + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* ModifierFlags.Ambient */ || node.parent.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } - flags |= 256 /* ModifierFlags.Async */; + flags |= 512 /* ModifierFlags.Async */; lastAsync = modifier; break; case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: var inOutFlag = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? 32768 /* ModifierFlags.In */ : 65536 /* ModifierFlags.Out */; var inOutText = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? "in" : "out"; - if (node.kind !== 163 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { + if (node.kind !== 165 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); } if (flags & inOutFlag) { @@ -89178,28 +89900,28 @@ var ts; break; } } - if (node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 173 /* SyntaxKind.Constructor */) { if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(lastOverride, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override"); // TODO: GH#18217 } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return false; } - else if ((node.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { + else if ((node.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return checkGrammarAsyncModifier(node, lastAsync); } return false; @@ -89217,47 +89939,47 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 179 /* SyntaxKind.FunctionType */: - case 276 /* SyntaxKind.MissingDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 279 /* SyntaxKind.MissingDeclaration */: return true; default: - if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return false; } switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - return nodeHasAnyModifiersExcept(node, 131 /* SyntaxKind.AsyncKeyword */); - case 257 /* SyntaxKind.ClassDeclaration */: - case 180 /* SyntaxKind.ConstructorType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + return nodeHasAnyModifiersExcept(node, 132 /* SyntaxKind.AsyncKeyword */); + case 260 /* SyntaxKind.ClassDeclaration */: + case 182 /* SyntaxKind.ConstructorType */: return nodeHasAnyModifiersExcept(node, 126 /* SyntaxKind.AbstractKeyword */); - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 85 /* SyntaxKind.ConstKeyword */); default: ts.Debug.assertNever(node); @@ -89275,10 +89997,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); @@ -89507,20 +90229,20 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 221 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { + if (computedPropertyName.expression.kind === 223 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } return false; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.Debug.assert(node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */); if (node.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -89539,7 +90261,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (prop.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (inDestructuring) { // a rest property cannot be destructured any further var expression = ts.skipParentheses(prop.expression); @@ -89550,11 +90272,11 @@ var ts; continue; } var name = prop.name; - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern); @@ -89566,7 +90288,7 @@ var ts; if (ts.canHaveModifiers(prop) && prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (ts.isModifier(mod) && (mod.kind !== 131 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 169 /* SyntaxKind.MethodDeclaration */)) { + if (ts.isModifier(mod) && (mod.kind !== 132 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 171 /* SyntaxKind.MethodDeclaration */)) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -89587,8 +90309,8 @@ var ts; // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; switch (prop.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); @@ -89597,13 +90319,13 @@ var ts; } currentKind = 4 /* DeclarationMeaning.PropertyAssignment */; break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: currentKind = 8 /* DeclarationMeaning.Method */; break; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: currentKind = 1 /* DeclarationMeaning.GetAccessor */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: currentKind = 2 /* DeclarationMeaning.SetAccessor */; break; default: @@ -89646,7 +90368,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (attr.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { continue; } var name = attr.name, initializer = attr.initializer; @@ -89656,7 +90378,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 288 /* SyntaxKind.JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 291 /* SyntaxKind.JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -89691,7 +90413,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 244 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 247 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { if (!(forInOrOfStatement.flags & 32768 /* NodeFlags.AwaitContext */)) { var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement); if (ts.isInTopLevelContext(forInOrOfStatement)) { @@ -89725,7 +90447,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); var func = ts.getContainingFunction(forInOrOfStatement); - if (func && func.kind !== 171 /* SyntaxKind.Constructor */) { + if (func && func.kind !== 173 /* SyntaxKind.Constructor */) { ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* FunctionFlags.Async */) === 0, "Enclosing function should never be an async function."); var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); @@ -89742,7 +90464,7 @@ var ts; grammarErrorOnNode(forInOrOfStatement.initializer, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); return false; } - if (forInOrOfStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -89757,20 +90479,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -89780,22 +90502,22 @@ var ts; return false; } function checkGrammarAccessor(accessor) { - if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 182 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 184 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */)) { if (languageVersion < 1 /* ScriptTarget.ES5 */) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(accessor.name)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } - if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } if (accessor.body) { - if (ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); } - if (accessor.parent.kind === 182 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (accessor.parent.kind === 184 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return grammarErrorOnNode(accessor.body, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } } @@ -89803,11 +90525,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? + return grammarErrorOnNode(accessor.name, accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -89829,17 +90551,17 @@ var ts; * A set accessor has one parameter or a `this` parameter and one more parameter. */ function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { return ts.getThisParameter(accessor); } } function checkGrammarTypeOperatorNode(node) { - if (node.operator === 154 /* SyntaxKind.UniqueKeyword */) { - if (node.type.kind !== 151 /* SyntaxKind.SymbolKeyword */) { - return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + if (node.operator === 156 /* SyntaxKind.UniqueKeyword */) { + if (node.type.kind !== 153 /* SyntaxKind.SymbolKeyword */) { + return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } var parent = ts.walkUpParenthesizedTypes(node.parent); if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) { @@ -89849,7 +90571,7 @@ var ts; } } switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: var decl = parent; if (decl.name.kind !== 79 /* SyntaxKind.Identifier */) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -89861,13 +90583,13 @@ var ts; return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (!ts.isStatic(parent) || !ts.hasEffectiveReadonlyModifier(parent)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (!ts.hasSyntacticModifier(parent, 64 /* ModifierFlags.Readonly */)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); } @@ -89876,9 +90598,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here); } } - else if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.type.kind !== 183 /* SyntaxKind.ArrayType */ && node.type.kind !== 184 /* SyntaxKind.TupleType */) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + else if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.type.kind !== 185 /* SyntaxKind.ArrayType */ && node.type.kind !== 186 /* SyntaxKind.TupleType */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } } } @@ -89891,10 +90613,10 @@ var ts; if (checkGrammarFunctionLikeDeclaration(node)) { return true; } - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */) { - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */) { + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 131 /* SyntaxKind.AsyncKeyword */)) { + if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 132 /* SyntaxKind.AsyncKeyword */)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { @@ -89923,14 +90645,14 @@ var ts; if (node.flags & 16777216 /* NodeFlags.Ambient */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !node.body) { + else if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !node.body) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) { + else if (node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } @@ -89941,11 +90663,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: if (node.label && current.label.escapedText === node.label.escapedText) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 245 /* SyntaxKind.ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 248 /* SyntaxKind.ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -89953,8 +90675,8 @@ var ts; return false; } break; - case 249 /* SyntaxKind.SwitchStatement */: - if (node.kind === 246 /* SyntaxKind.BreakStatement */ && !node.label) { + case 252 /* SyntaxKind.SwitchStatement */: + if (node.kind === 249 /* SyntaxKind.BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -89969,13 +90691,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -89999,12 +90721,12 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return ts.isStringOrNumericLiteralLike(expr) || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; } function isBigIntLiteralExpression(expr) { return expr.kind === 9 /* SyntaxKind.BigIntLiteral */ || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 9 /* SyntaxKind.BigIntLiteral */; } function isSimpleLiteralEnumReference(expr) { @@ -90032,7 +90754,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 247 /* SyntaxKind.ForOfStatement */) { if (node.flags & 16777216 /* NodeFlags.Ambient */) { checkAmbientInitializer(node); } @@ -90045,7 +90767,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 237 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { + if (node.exclamationToken && (node.parent.parent.kind !== 240 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { var message = node.initializer ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type @@ -90112,15 +90834,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return false; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -90214,8 +90936,14 @@ var ts; if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(node.name)) { return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } + if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isAutoAccessorPropertyDeclaration(node)) { + return grammarErrorOnNode(node.name, ts.Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (ts.isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_accessor_property_cannot_be_declared_optional)) { + return true; + } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } @@ -90261,14 +90989,14 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */)) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); @@ -90276,7 +91004,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 237 /* SyntaxKind.VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 240 /* SyntaxKind.VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -90299,7 +91027,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 235 /* SyntaxKind.Block */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 238 /* SyntaxKind.Block */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { var links_2 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_2.hasReportedStatementInAmbientContext) { @@ -90321,10 +91049,10 @@ var ts; if (languageVersion >= 1 /* ScriptTarget.ES5 */) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 196 /* SyntaxKind.LiteralType */)) { + else if (ts.isChildOfNodeWithKind(node, 198 /* SyntaxKind.LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 299 /* SyntaxKind.EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 302 /* SyntaxKind.EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -90396,7 +91124,7 @@ var ts; if (node.isTypeOnly && node.name && node.namedBindings) { return grammarErrorOnNode(node, ts.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both); } - if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 269 /* SyntaxKind.NamedImports */) { + if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 272 /* SyntaxKind.NamedImports */) { return checkGrammarNamedImportsOrExports(node.namedBindings); } return false; @@ -90404,7 +91132,7 @@ var ts; function checkGrammarNamedImportsOrExports(namedBindings) { return !!ts.forEach(namedBindings.elements, function (specifier) { if (specifier.isTypeOnly) { - return grammarErrorOnFirstToken(specifier, specifier.kind === 270 /* SyntaxKind.ImportSpecifier */ + return grammarErrorOnFirstToken(specifier, specifier.kind === 273 /* SyntaxKind.ImportSpecifier */ ? ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement); } @@ -90527,14 +91255,14 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 169 /* SyntaxKind.MethodDeclaration */) || + return (declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 171 /* SyntaxKind.MethodDeclaration */) || !!declaration.body; } /** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */ function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -90570,6 +91298,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var _a; function visitNode(node, visitor, test, lift) { if (node === undefined || visitor === undefined) { return node; @@ -90636,7 +91365,6 @@ var ts; return nodes; } ts.visitNodes = visitNodes; - /* @internal */ function visitArray(nodes, visitor, test, start, count) { if (nodes === undefined) { return nodes; @@ -90784,12 +91512,10 @@ var ts; return updated; } ts.visitFunctionBody = visitFunctionBody; - /** - * Visits an iteration body, adding any block-scoped variables required by the transformation. - */ - function visitIterationBody(body, visitor, context) { + function visitIterationBody(body, visitor, context, nodeVisitor) { + if (nodeVisitor === void 0) { nodeVisitor = visitNode; } context.startBlockScope(); - var updated = visitNode(body, visitor, ts.isStatement, context.factory.liftToBlock); + var updated = nodeVisitor(body, visitor, ts.isStatement, context.factory.liftToBlock); var declarations = context.endBlockScope(); if (ts.some(declarations)) { if (ts.isBlock(updated)) { @@ -90808,456 +91534,446 @@ var ts; if (node === undefined) { return undefined; } - var kind = node.kind; - // No need to visit nodes with no children. - if ((kind > 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */) || kind === 192 /* SyntaxKind.ThisType */) { - return node; - } - var factory = context.factory; - switch (kind) { - // Names - case 79 /* SyntaxKind.Identifier */: - ts.Debug.type(node); - return factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); - case 161 /* SyntaxKind.QualifiedName */: - ts.Debug.type(node); - return factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); - case 162 /* SyntaxKind.ComputedPropertyName */: - ts.Debug.type(node); - return factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Signature elements - case 163 /* SyntaxKind.TypeParameter */: - ts.Debug.type(node); - return factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); - case 164 /* SyntaxKind.Parameter */: - ts.Debug.type(node); - return factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 165 /* SyntaxKind.Decorator */: - ts.Debug.type(node); - return factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Type elements - case 166 /* SyntaxKind.PropertySignature */: - ts.Debug.type(node); - return factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 167 /* SyntaxKind.PropertyDeclaration */: - ts.Debug.type(node); - return factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), - // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too - nodeVisitor(node.questionToken || node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 168 /* SyntaxKind.MethodSignature */: - ts.Debug.type(node); - return factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 169 /* SyntaxKind.MethodDeclaration */: - ts.Debug.type(node); - return factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 171 /* SyntaxKind.Constructor */: - ts.Debug.type(node); - return factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 172 /* SyntaxKind.GetAccessor */: - ts.Debug.type(node); - return factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 173 /* SyntaxKind.SetAccessor */: - ts.Debug.type(node); - return factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - ts.Debug.type(node); - context.startLexicalEnvironment(); - context.suspendLexicalEnvironment(); - return factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 174 /* SyntaxKind.CallSignature */: - ts.Debug.type(node); - return factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 175 /* SyntaxKind.ConstructSignature */: - ts.Debug.type(node); - return factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 176 /* SyntaxKind.IndexSignature */: - ts.Debug.type(node); - return factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - // Types - case 177 /* SyntaxKind.TypePredicate */: - ts.Debug.type(node); - return factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 178 /* SyntaxKind.TypeReference */: - ts.Debug.type(node); - return factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 179 /* SyntaxKind.FunctionType */: - ts.Debug.type(node); - return factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 180 /* SyntaxKind.ConstructorType */: - ts.Debug.type(node); - return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 181 /* SyntaxKind.TypeQuery */: - ts.Debug.type(node); - return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 182 /* SyntaxKind.TypeLiteral */: - ts.Debug.type(node); - return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 183 /* SyntaxKind.ArrayType */: - ts.Debug.type(node); - return factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); - case 184 /* SyntaxKind.TupleType */: - ts.Debug.type(node); - return factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); - case 185 /* SyntaxKind.OptionalType */: - ts.Debug.type(node); - return factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 186 /* SyntaxKind.RestType */: - ts.Debug.type(node); - return factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 187 /* SyntaxKind.UnionType */: - ts.Debug.type(node); - return factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 188 /* SyntaxKind.IntersectionType */: - ts.Debug.type(node); - return factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 189 /* SyntaxKind.ConditionalType */: - ts.Debug.type(node); - return factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); - case 190 /* SyntaxKind.InferType */: - ts.Debug.type(node); - return factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); - case 200 /* SyntaxKind.ImportType */: - ts.Debug.type(node); - return factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isNode), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - ts.Debug.type(node); - return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine); - case 197 /* SyntaxKind.NamedTupleMember */: - ts.Debug.type(node); - return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 191 /* SyntaxKind.ParenthesizedType */: - ts.Debug.type(node); - return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 193 /* SyntaxKind.TypeOperator */: - ts.Debug.type(node); - return factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 194 /* SyntaxKind.IndexedAccessType */: - ts.Debug.type(node); - return factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); - case 195 /* SyntaxKind.MappedType */: - ts.Debug.type(node); - return factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 196 /* SyntaxKind.LiteralType */: - ts.Debug.type(node); - return factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); - case 198 /* SyntaxKind.TemplateLiteralType */: - ts.Debug.type(node); - return factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - ts.Debug.type(node); - return factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: - ts.Debug.type(node); - return factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); - case 202 /* SyntaxKind.ArrayBindingPattern */: - ts.Debug.type(node); - return factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); - case 203 /* SyntaxKind.BindingElement */: - ts.Debug.type(node); - return factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Expression - case 204 /* SyntaxKind.ArrayLiteralExpression */: - ts.Debug.type(node); - return factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - ts.Debug.type(node); - return factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 206 /* SyntaxKind.PropertyAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)); - } - ts.Debug.type(node); - return factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); - case 207 /* SyntaxKind.ElementAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - case 208 /* SyntaxKind.CallExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 209 /* SyntaxKind.NewExpression */: - ts.Debug.type(node); - return factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - ts.Debug.type(node); - return factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); - case 211 /* SyntaxKind.TypeAssertionExpression */: - ts.Debug.type(node); - return factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 212 /* SyntaxKind.ParenthesizedExpression */: - ts.Debug.type(node); - return factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 213 /* SyntaxKind.FunctionExpression */: - ts.Debug.type(node); - return factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 214 /* SyntaxKind.ArrowFunction */: - ts.Debug.type(node); - return factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 215 /* SyntaxKind.DeleteExpression */: - ts.Debug.type(node); - return factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 216 /* SyntaxKind.TypeOfExpression */: - ts.Debug.type(node); - return factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 217 /* SyntaxKind.VoidExpression */: - ts.Debug.type(node); - return factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 218 /* SyntaxKind.AwaitExpression */: - ts.Debug.type(node); - return factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 221 /* SyntaxKind.BinaryExpression */: - ts.Debug.type(node); - return factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); - case 222 /* SyntaxKind.ConditionalExpression */: - ts.Debug.type(node); - return factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); - case 223 /* SyntaxKind.TemplateExpression */: - ts.Debug.type(node); - return factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); - case 224 /* SyntaxKind.YieldExpression */: - ts.Debug.type(node); - return factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 225 /* SyntaxKind.SpreadElement */: - ts.Debug.type(node); - return factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 226 /* SyntaxKind.ClassExpression */: - ts.Debug.type(node); - return factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - ts.Debug.type(node); - return factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 229 /* SyntaxKind.AsExpression */: - ts.Debug.type(node); - return factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 230 /* SyntaxKind.NonNullExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 231 /* SyntaxKind.MetaProperty */: - ts.Debug.type(node); - return factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Misc - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.type(node); - return factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Element - case 235 /* SyntaxKind.Block */: - ts.Debug.type(node); - return factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 237 /* SyntaxKind.VariableStatement */: - ts.Debug.type(node); - return factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 238 /* SyntaxKind.ExpressionStatement */: - ts.Debug.type(node); - return factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 239 /* SyntaxKind.IfStatement */: - ts.Debug.type(node); - return factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, factory.liftToBlock)); - case 240 /* SyntaxKind.DoStatement */: - ts.Debug.type(node); - return factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 241 /* SyntaxKind.WhileStatement */: - ts.Debug.type(node); - return factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 242 /* SyntaxKind.ForStatement */: - ts.Debug.type(node); - return factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 243 /* SyntaxKind.ForInStatement */: - ts.Debug.type(node); - return factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 244 /* SyntaxKind.ForOfStatement */: - ts.Debug.type(node); - return factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 245 /* SyntaxKind.ContinueStatement */: - ts.Debug.type(node); - return factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 246 /* SyntaxKind.BreakStatement */: - ts.Debug.type(node); - return factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 247 /* SyntaxKind.ReturnStatement */: - ts.Debug.type(node); - return factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 248 /* SyntaxKind.WithStatement */: - ts.Debug.type(node); - return factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 249 /* SyntaxKind.SwitchStatement */: - ts.Debug.type(node); - return factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); - case 250 /* SyntaxKind.LabeledStatement */: - ts.Debug.type(node); - return factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 251 /* SyntaxKind.ThrowStatement */: - ts.Debug.type(node); - return factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 252 /* SyntaxKind.TryStatement */: - ts.Debug.type(node); - return factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); - case 254 /* SyntaxKind.VariableDeclaration */: - ts.Debug.type(node); - return factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 255 /* SyntaxKind.VariableDeclarationList */: - ts.Debug.type(node); - return factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); - case 256 /* SyntaxKind.FunctionDeclaration */: - ts.Debug.type(node); - return factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 257 /* SyntaxKind.ClassDeclaration */: - ts.Debug.type(node); - return factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 258 /* SyntaxKind.InterfaceDeclaration */: - ts.Debug.type(node); - return factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - ts.Debug.type(node); - return factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 260 /* SyntaxKind.EnumDeclaration */: - ts.Debug.type(node); - return factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); - case 261 /* SyntaxKind.ModuleDeclaration */: - ts.Debug.type(node); - return factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); - case 262 /* SyntaxKind.ModuleBlock */: - ts.Debug.type(node); - return factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 263 /* SyntaxKind.CaseBlock */: - ts.Debug.type(node); - return factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - ts.Debug.type(node); - return factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - ts.Debug.type(node); - return factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); - case 266 /* SyntaxKind.ImportDeclaration */: - ts.Debug.type(node); - return factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 293 /* SyntaxKind.AssertClause */: - ts.Debug.type(node); - return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); - case 294 /* SyntaxKind.AssertEntry */: - ts.Debug.type(node); - return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode)); - case 267 /* SyntaxKind.ImportClause */: - ts.Debug.type(node); - return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); - case 268 /* SyntaxKind.NamespaceImport */: - ts.Debug.type(node); - return factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 274 /* SyntaxKind.NamespaceExport */: - ts.Debug.type(node); - return factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 269 /* SyntaxKind.NamedImports */: - ts.Debug.type(node); - return factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); - case 270 /* SyntaxKind.ImportSpecifier */: - ts.Debug.type(node); - return factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 271 /* SyntaxKind.ExportAssignment */: - ts.Debug.type(node); - return factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 272 /* SyntaxKind.ExportDeclaration */: - ts.Debug.type(node); - return factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 273 /* SyntaxKind.NamedExports */: - ts.Debug.type(node); - return factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); - case 275 /* SyntaxKind.ExportSpecifier */: - ts.Debug.type(node); - return factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: - ts.Debug.type(node); - return factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // JSX - case 278 /* SyntaxKind.JsxElement */: - ts.Debug.type(node); - return factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - ts.Debug.type(node); - return factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 280 /* SyntaxKind.JsxOpeningElement */: - ts.Debug.type(node); - return factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 281 /* SyntaxKind.JsxClosingElement */: - ts.Debug.type(node); - return factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 282 /* SyntaxKind.JsxFragment */: - ts.Debug.type(node); - return factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 285 /* SyntaxKind.JsxAttribute */: - ts.Debug.type(node); - return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 286 /* SyntaxKind.JsxAttributes */: - ts.Debug.type(node); - return factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - ts.Debug.type(node); - return factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 288 /* SyntaxKind.JsxExpression */: - ts.Debug.type(node); - return factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Clauses - case 289 /* SyntaxKind.CaseClause */: - ts.Debug.type(node); - return factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 290 /* SyntaxKind.DefaultClause */: - ts.Debug.type(node); - return factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 291 /* SyntaxKind.HeritageClause */: - ts.Debug.type(node); - return factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 292 /* SyntaxKind.CatchClause */: - ts.Debug.type(node); - return factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); - // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: - ts.Debug.type(node); - return factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - ts.Debug.type(node); - return factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 298 /* SyntaxKind.SpreadAssignment */: - ts.Debug.type(node); - return factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Enum - case 299 /* SyntaxKind.EnumMember */: - ts.Debug.type(node); - return factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: - ts.Debug.type(node); - return factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context)); - // Transformation nodes - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - ts.Debug.type(node); - return factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 351 /* SyntaxKind.CommaListExpression */: - ts.Debug.type(node); - return factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - default: - // No need to visit nodes with no children. - return node; - } + var fn = visitEachChildTable[node.kind]; + return fn === undefined ? node : fn(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor); } ts.visitEachChild = visitEachChild; + // NOTE: Before you can add a new method to `visitEachChildTable`, you must first ensure the `Node` subtype you + // wish to add is defined in the `HasChildren` union in types.ts. + var visitEachChildTable = (_a = {}, + _a[79 /* SyntaxKind.Identifier */] = function visitEachChildOfIdentifier(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); + }, + _a[163 /* SyntaxKind.QualifiedName */] = function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Signature elements + _a[165 /* SyntaxKind.TypeParameter */] = function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); + }, + _a[166 /* SyntaxKind.Parameter */] = function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[167 /* SyntaxKind.Decorator */] = function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Type elements + _a[168 /* SyntaxKind.PropertySignature */] = function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + var _a; + return context.factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), + // QuestionToken and ExclamationToken are mutually exclusive in PropertyDeclaration + nodeVisitor((_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[171 /* SyntaxKind.MethodDeclaration */] = function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[173 /* SyntaxKind.Constructor */] = function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + context.startLexicalEnvironment(); + context.suspendLexicalEnvironment(); + return context.factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[176 /* SyntaxKind.CallSignature */] = function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[177 /* SyntaxKind.ConstructSignature */] = function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + // Types + _a[179 /* SyntaxKind.TypePredicate */] = function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[180 /* SyntaxKind.TypeReference */] = function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[181 /* SyntaxKind.FunctionType */] = function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[185 /* SyntaxKind.ArrayType */] = function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); + }, + _a[186 /* SyntaxKind.TupleType */] = function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); + }, + _a[187 /* SyntaxKind.OptionalType */] = function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[188 /* SyntaxKind.RestType */] = function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[189 /* SyntaxKind.UnionType */] = function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[190 /* SyntaxKind.IntersectionType */] = function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[191 /* SyntaxKind.ConditionalType */] = function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); + }, + _a[192 /* SyntaxKind.InferType */] = function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + }, + _a[202 /* SyntaxKind.ImportType */] = function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isImportTypeAssertionContainer), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isAssertClause), node.multiLine); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[195 /* SyntaxKind.TypeOperator */] = function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[196 /* SyntaxKind.IndexedAccessType */] = function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); + }, + _a[197 /* SyntaxKind.MappedType */] = function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[198 /* SyntaxKind.LiteralType */] = function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Binding patterns + _a[203 /* SyntaxKind.ObjectBindingPattern */] = function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); + }, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + }, + _a[205 /* SyntaxKind.BindingElement */] = function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Expression + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isPropertyAccessChain(node) ? + context.factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)) : + context.factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isElementAccessChain(node) ? + context.factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)) : + context.factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); + }, + _a[210 /* SyntaxKind.CallExpression */] = function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isCallChain(node) ? + context.factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)) : + context.factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[211 /* SyntaxKind.NewExpression */] = function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[228 /* SyntaxKind.ClassExpression */] = function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[231 /* SyntaxKind.AsExpression */] = function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSatisfiesExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return ts.isOptionalChain(node) ? + context.factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)) : + context.factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Misc + _a[236 /* SyntaxKind.TemplateSpan */] = function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Element + _a[238 /* SyntaxKind.Block */] = function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[242 /* SyntaxKind.IfStatement */] = function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, context.factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[243 /* SyntaxKind.DoStatement */] = function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context, nodeVisitor), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[245 /* SyntaxKind.ForStatement */] = function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[249 /* SyntaxKind.BreakStatement */] = function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[250 /* SyntaxKind.ReturnStatement */] = function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[251 /* SyntaxKind.WithStatement */] = function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[255 /* SyntaxKind.TryStatement */] = function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); + }, + _a[265 /* SyntaxKind.ModuleBlock */] = function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[296 /* SyntaxKind.AssertClause */] = function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpression)); + }, + _a[270 /* SyntaxKind.ImportClause */] = function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[272 /* SyntaxKind.NamedImports */] = function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[274 /* SyntaxKind.ExportAssignment */] = function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[275 /* SyntaxKind.ExportDeclaration */] = function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[276 /* SyntaxKind.NamedExports */] = function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + }, + _a[278 /* SyntaxKind.ExportSpecifier */] = function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Module references + _a[280 /* SyntaxKind.ExternalModuleReference */] = function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // JSX + _a[281 /* SyntaxKind.JsxElement */] = function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[283 /* SyntaxKind.JsxOpeningElement */] = function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + }, + _a[289 /* SyntaxKind.JsxAttributes */] = function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Clauses + _a[292 /* SyntaxKind.CaseClause */] = function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + }, + _a[295 /* SyntaxKind.CatchClause */] = function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); + }, + // Property assignments + _a[299 /* SyntaxKind.PropertyAssignment */] = function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Enum + _a[302 /* SyntaxKind.EnumMember */] = function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Top-level nodes + _a[308 /* SyntaxKind.SourceFile */] = function visitEachChildOfSourceFile(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context, /*start*/ undefined, /*ensureUseStrict*/ undefined, nodesVisitor)); + }, + // Transformation nodes + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a); /** * Extracts the single node from a NodeArray. * @@ -91325,7 +92041,7 @@ var ts; exit(); return sourceIndex; } - /* eslint-disable boolean-trivia, no-null/no-null */ + /* eslint-disable local/boolean-trivia, no-null/no-null */ function setSourceContent(sourceIndex, content) { enter(); if (content !== null) { @@ -91338,7 +92054,7 @@ var ts; } exit(); } - /* eslint-enable boolean-trivia, no-null/no-null */ + /* eslint-enable local/boolean-trivia, no-null/no-null */ function addName(name) { enter(); if (!nameToNameIndexMap) @@ -91940,7 +92656,7 @@ var ts; function chainBundle(context, transformSourceFile) { return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -91991,7 +92707,7 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" @@ -92004,13 +92720,13 @@ var ts; hasImportDefault = true; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - if (node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + if (node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -92041,13 +92757,13 @@ var ts; addExportedNamesForExportDeclaration(node); } break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { for (var _b = 0, _c = node.declarationList.declarations; _b < _c.length; _b++) { var decl = _c[_b]; @@ -92055,9 +92771,9 @@ var ts; } } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default function() { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -92075,9 +92791,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default class { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -92255,7 +92971,7 @@ var ts; * @param isStatic A value indicating whether the member should be a static or instance member. */ function isInitializedProperty(member) { - return member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + return member.kind === 169 /* SyntaxKind.PropertyDeclaration */ && member.initializer !== undefined; } ts.isInitializedProperty = isInitializedProperty; @@ -92265,7 +92981,7 @@ var ts; * @param member The class element node. */ function isNonStaticMethodOrAccessorWithPrivateName(member) { - return !ts.isStatic(member) && ts.isMethodOrAccessor(member) && ts.isPrivateIdentifier(member.name); + return !ts.isStatic(member) && (ts.isMethodOrAccessor(member) || ts.isAutoAccessorPropertyDeclaration(member)) && ts.isPrivateIdentifier(member.name); } ts.isNonStaticMethodOrAccessorWithPrivateName = isNonStaticMethodOrAccessorWithPrivateName; /** @@ -92319,12 +93035,12 @@ var ts; */ function getAllDecoratorsOfClassElement(member, parent) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return getAllDecoratorsOfAccessors(member, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -92985,8 +93701,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -93006,14 +93722,14 @@ var ts; var applicableSubstitutions; return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { return transformBundle(node); } return transformSourceFile(node); } function transformBundle(node) { return factory.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { return ts.createUnparsedSourceFile(prepend, "js"); } return prepend; @@ -93062,15 +93778,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 262 /* SyntaxKind.ModuleBlock */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 265 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: currentLexicalScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */)) { break; } @@ -93082,7 +93798,7 @@ var ts; // These nodes should always have names unless they are default-exports; // however, class declaration parsing allows for undefined names, so syntactically invalid // programs may also have an undefined name. - ts.Debug.assert(node.kind === 257 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)); + ts.Debug.assert(node.kind === 260 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)); } break; } @@ -93121,10 +93837,10 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitElidableStatement(node); default: return visitorWorker(node); @@ -93145,13 +93861,13 @@ var ts; return node; } switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -93171,11 +93887,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ || - (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && - node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */)) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ || + (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && + node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -93199,27 +93915,27 @@ var ts; */ function classElementVisitorWorker(node, parent) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructor(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Property declarations are not TypeScript syntax, but they must be visited // for the decorator transformation. return visitPropertyDeclaration(node, parent); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.visitEachChild(node, visitor, context); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return node; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Index signatures are elided return; default: @@ -93231,17 +93947,17 @@ var ts; } function objectLiteralElementVisitorWorker(node, parent) { switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return visitor(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); @@ -93252,7 +93968,7 @@ var ts; function modifierVisitor(node) { if (ts.isDecorator(node)) return undefined; - if (ts.modifierToFlag(node.kind) & 116958 /* ModifierFlags.TypeScriptModifier */) { + if (ts.modifierToFlag(node.kind) & 117086 /* ModifierFlags.TypeScriptModifier */) { return undefined; } else if (currentNamespace && node.kind === 93 /* SyntaxKind.ExportKeyword */) { @@ -93280,58 +93996,58 @@ var ts; case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: // TypeScript accessibility and readonly modifiers are elided // falls through - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 177 /* SyntaxKind.TypePredicate */: - case 163 /* SyntaxKind.TypeParameter */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 179 /* SyntaxKind.TypePredicate */: + case 165 /* SyntaxKind.TypeParameter */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 181 /* SyntaxKind.TypeQuery */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 189 /* SyntaxKind.ConditionalType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 192 /* SyntaxKind.ThisType */: - case 193 /* SyntaxKind.TypeOperator */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 196 /* SyntaxKind.LiteralType */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 183 /* SyntaxKind.TypeQuery */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 191 /* SyntaxKind.ConditionalType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 194 /* SyntaxKind.ThisType */: + case 195 /* SyntaxKind.TypeOperator */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 198 /* SyntaxKind.LiteralType */: // TypeScript type nodes are elided. // falls through - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // TypeScript index signatures are elided. return undefined; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // TypeScript type-only declarations are elided. return factory.createNotEmittedStatement(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // TypeScript namespace export declarations are elided. return undefined; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return factory.createNotEmittedStatement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // This may be a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93341,7 +94057,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // This may be a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93351,34 +94067,34 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: // This may be a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.Debug.fail("Class and object literal elements must be visited with their respective visitors"); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // This may be a parameter declaration with TypeScript syntax extensions. // // TypeScript parameter declaration syntax extensions include: @@ -93388,40 +94104,42 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return visitSatisfiesExpression(node); + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return visitJsxJsxOpeningElement(node); default: // node contains some other TypeScript syntax @@ -93691,10 +94409,10 @@ var ts; */ function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */; + return kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */; } /** * Determines whether to emit the "design:returntype" metadata based on the node's kind. @@ -93704,7 +94422,7 @@ var ts; * @param node The node to test. */ function shouldAddReturnTypeMetadata(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } /** * Determines whether to emit the "design:paramtypes" metadata based on the node's kind. @@ -93715,12 +94433,12 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; } return false; @@ -93810,7 +94528,7 @@ var ts; return !ts.nodeIsMissing(node.body); } function visitPropertyDeclaration(node, parent) { - var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); if (isAmbient && !ts.hasDecorators(node)) { return undefined; } @@ -93918,7 +94636,7 @@ var ts; * @param node The declaration node. */ function shouldEmitAccessorDeclaration(node) { - return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)); + return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)); } function visitGetAccessor(node, parent) { if (!(node.transformFlags & 1 /* TransformFlags.ContainsTypeScript */)) { @@ -94060,6 +94778,10 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); return factory.createPartiallyEmittedExpression(expression, node); } + function visitSatisfiesExpression(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } function visitCallExpression(node) { return factory.updateCallExpression(node, ts.visitNode(node.expression, visitor, ts.isExpression), /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); @@ -94273,12 +94995,12 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = factory.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), factory.createVariableDeclarationList([ factory.createVariableDeclaration(factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentLexicalScope.kind === 305 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); + ], currentLexicalScope.kind === 308 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind === 263 /* SyntaxKind.EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -94403,7 +95125,7 @@ var ts; var statementsLocation; var blockLocation; if (node.body) { - if (node.body.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (node.body.kind === 265 /* SyntaxKind.ModuleBlock */) { saveStateAndInvoke(node.body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = node.body.statements; blockLocation = node.body; @@ -94450,13 +95172,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (!node.body || node.body.kind !== 262 /* SyntaxKind.ModuleBlock */) { + if (!node.body || node.body.kind !== 265 /* SyntaxKind.ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* EmitFlags.NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -94503,7 +95225,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (node.kind === 271 /* SyntaxKind.NamespaceImport */) { // Elide a namespace import if it is not referenced. return shouldEmitAliasDeclaration(node) ? node : undefined; } @@ -94661,7 +95383,7 @@ var ts; */ function isNamedExternalModuleExport(node) { return isExternalModuleExport(node) - && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } /** * Gets a value indicating whether the node is the default export of an external module. @@ -94670,7 +95392,7 @@ var ts; */ function isDefaultExternalModuleExport(node) { return isExternalModuleExport(node) - && ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } function addExportMemberAssignment(statements, node) { var expression = factory.createAssignment(factory.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), factory.getLocalName(node)); @@ -94715,16 +95437,16 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(79 /* SyntaxKind.Identifier */); - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(261 /* SyntaxKind.ModuleDeclaration */); + context.enableEmitNotification(264 /* SyntaxKind.ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 261 /* SyntaxKind.ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 260 /* SyntaxKind.EnumDeclaration */; + return ts.getOriginalNode(node).kind === 263 /* SyntaxKind.EnumDeclaration */; } /** * Hook for node emit. @@ -94785,9 +95507,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -94802,9 +95524,9 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 305 /* SyntaxKind.SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 261 /* SyntaxKind.ModuleDeclaration */) || - (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 260 /* SyntaxKind.EnumDeclaration */); + if (container && container.kind !== 308 /* SyntaxKind.SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 264 /* SyntaxKind.ModuleDeclaration */) || + (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 263 /* SyntaxKind.EnumDeclaration */); if (substitute) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(container), node), /*location*/ node); @@ -94843,9 +95565,10 @@ var ts; return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined; } function shouldEmitAliasDeclaration(node) { - return compilerOptions.preserveValueImports - ? resolver.isValueAliasDeclaration(node) - : resolver.isReferencedAliasDeclaration(node); + return ts.isInJSFile(node) || + (compilerOptions.preserveValueImports + ? resolver.isValueAliasDeclaration(node) + : resolver.isReferencedAliasDeclaration(node)); } } ts.transformTypeScript = transformTypeScript; @@ -94893,13 +95616,24 @@ var ts; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions); + // Always transform field initializers using Set semantics when `useDefineForClassFields: false`. + var shouldTransformInitializersUsingSet = !useDefineForClassFields; + // Transform field initializers using Define semantics when `useDefineForClassFields: true` and target < ES2022. + var shouldTransformInitializersUsingDefine = useDefineForClassFields && languageVersion < 9 /* ScriptTarget.ES2022 */; + var shouldTransformInitializers = shouldTransformInitializersUsingSet || shouldTransformInitializersUsingDefine; + // We need to transform private members and class static blocks when target < ES2022. var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* ScriptTarget.ES2022 */; + // We need to transform `accessor` fields when target < ESNext + var shouldTransformAutoAccessors = languageVersion < 99 /* ScriptTarget.ESNext */; // We need to transform `this` in a static initializer into a reference to the class - // when targeting < ES2022 since the assignment will be moved outside of the class body. + // when target < ES2022 since the assignment will be moved outside of the class body. var shouldTransformThisInStaticInitializers = languageVersion < 9 /* ScriptTarget.ES2022 */; - // We don't need to transform `super` property access when targeting ES5, ES3 because + // We don't need to transform `super` property access when target <= ES5 because // the es2015 transformation handles those. var shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2 /* ScriptTarget.ES2015 */; + var shouldTransformAnything = shouldTransformInitializers || + shouldTransformPrivateElementsOrClassStaticBlocks || + shouldTransformAutoAccessors; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -94919,98 +95653,149 @@ var ts; var classLexicalEnvironmentStack = []; var classLexicalEnvironmentMap = new ts.Map(); var currentClassLexicalEnvironment; + var currentClassContainer; var currentComputedPropertyNameClassLexicalEnvironment; var currentStaticPropertyDeclarationOrStaticBlock; return ts.chainBundle(context, transformSourceFile); function transformSourceFile(node) { - var options = context.getCompilerOptions(); - if (node.isDeclarationFile - || useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9 /* ScriptTarget.ES2022 */) { + if (node.isDeclarationFile || !shouldTransformAnything) { return node; } var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); return visited; } - function visitorWorker(node, valueIsDiscarded) { - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) { - switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - return visitClassLike(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: - return visitVariableStatement(node); - case 80 /* SyntaxKind.PrivateIdentifier */: - return visitPrivateIdentifier(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitClassStaticBlockDeclaration(node); - } + function visitor(node) { + if (!(node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) && + !(node.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */)) { + return node; } - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */ || - node.transformFlags & 134217728 /* TransformFlags.ContainsLexicalSuper */ && - shouldTransformSuperInStaticInitializers && - currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: - return visitBinaryExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: - return visitCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitElementAccessExpression(node); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitExpressionStatement(node); - case 242 /* SyntaxKind.ForStatement */: - return visitForStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = undefined; - var result = ts.visitEachChild(node, visitor, context); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; - return result; - } + switch (node.kind) { + case 127 /* SyntaxKind.AccessorKeyword */: + return shouldTransformAutoAccessors ? undefined : node; + case 260 /* SyntaxKind.ClassDeclaration */: + return visitClassDeclaration(node); + case 228 /* SyntaxKind.ClassExpression */: + return visitClassExpression(node); + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + return visitClassStaticBlockDeclaration(node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return visitPropertyDeclaration(node); + case 240 /* SyntaxKind.VariableStatement */: + return visitVariableStatement(node); + case 80 /* SyntaxKind.PrivateIdentifier */: + return visitPrivateIdentifier(node); + case 208 /* SyntaxKind.PropertyAccessExpression */: + return visitPropertyAccessExpression(node); + case 209 /* SyntaxKind.ElementAccessExpression */: + return visitElementAccessExpression(node); + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ false); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ false); + case 210 /* SyntaxKind.CallExpression */: + return visitCallExpression(node); + case 241 /* SyntaxKind.ExpressionStatement */: + return visitExpressionStatement(node); + case 212 /* SyntaxKind.TaggedTemplateExpression */: + return visitTaggedTemplateExpression(node); + case 245 /* SyntaxKind.ForStatement */: + return visitForStatement(node); + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + // If we are descending into a new scope, clear the current static property or block + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, fallbackVisitor, node); } + default: + return fallbackVisitor(node); } + } + function fallbackVisitor(node) { return ts.visitEachChild(node, visitor, context); } + /** + * Visits a node in an expression whose result is discarded. + */ function discardedValueVisitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ true); - } - function visitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ false); + switch (node.kind) { + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ true); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ true); + default: + return visitor(node); + } } + /** + * Visits a node in a {@link HeritageClause}. + */ function heritageClauseVisitor(node) { switch (node.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return ts.visitEachChild(node, heritageClauseVisitor, context); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitExpressionWithTypeArguments(node); + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + return visitExpressionWithTypeArgumentsInHeritageClause(node); + default: + return visitor(node); } - return visitor(node); } - function visitorDestructuringTarget(node) { + /** + * Visits the assignment target of a destructuring assignment. + */ + function assignmentTargetVisitor(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitAssignmentPattern(node); default: return visitor(node); } } + /** + * Visits a member of a class. + */ + function classElementVisitor(node) { + switch (node.kind) { + case 173 /* SyntaxKind.Constructor */: + return visitConstructorDeclaration(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitMethodOrAccessorDeclaration, node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitPropertyDeclaration, node); + case 164 /* SyntaxKind.ComputedPropertyName */: + return visitComputedPropertyName(node); + case 237 /* SyntaxKind.SemicolonClassElement */: + return node; + default: + return visitor(node); + } + } + /** + * Visits the results of an auto-accessor field transformation in a second pass. + */ + function accessorFieldResultVisitor(node) { + switch (node.kind) { + case 169 /* SyntaxKind.PropertyDeclaration */: + return transformFieldInitializer(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return classElementVisitor(node); + default: + ts.Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); + break; + } + } /** * If we visit a private name, this means it is an undeclared private name. * Replace it with an empty identifier to indicate a problem with the code, @@ -95026,17 +95811,15 @@ var ts; } return ts.setOriginalNode(factory.createIdentifier(""), node); } + function isPrivateIdentifierInExpression(node) { + return ts.isPrivateIdentifier(node.left) + && node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; + } /** * Visits `#id in expr` */ - function visitPrivateIdentifierInInExpression(node) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return node; - } - var privId = node.left; - ts.Debug.assertNode(privId, ts.isPrivateIdentifier); - ts.Debug.assert(node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */); - var info = accessPrivateIdentifier(privId); + function transformPrivateIdentifierInInExpression(node) { + var info = accessPrivateIdentifier(node.left); if (info) { var receiver = ts.visitNode(node.right, visitor, ts.isExpression); return ts.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node); @@ -95044,31 +95827,6 @@ var ts; // Private name has not been declared. Subsequent transformers will handle this error return ts.visitEachChild(node, visitor, context); } - /** - * Visits the members of a class that has fields. - * - * @param node The node to visit. - */ - function classElementVisitor(node) { - switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - // Constructors for classes using class fields are transformed in - // `visitClassDeclaration` or `visitClassExpression`. - return undefined; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - return visitMethodOrAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitComputedPropertyName(node); - case 234 /* SyntaxKind.SemicolonClassElement */: - return node; - default: - return visitor(node); - } - } function visitVariableStatement(node) { var savedPendingStatements = pendingStatements; pendingStatements = []; @@ -95078,15 +95836,24 @@ var ts; pendingStatements = savedPendingStatements; return statement; } - function visitComputedPropertyName(name) { - var node = ts.visitEachChild(name, visitor, context); + function visitComputedPropertyName(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (ts.some(pendingExpressions)) { - var expressions = pendingExpressions; - expressions.push(node.expression); - pendingExpressions = []; - node = factory.updateComputedPropertyName(node, factory.inlineExpressions(expressions)); + if (ts.isParenthesizedExpression(expression)) { + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression.expression], false))); + } + else { + expression = factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression], false)); + } + pendingExpressions = undefined; } - return node; + return factory.updateComputedPropertyName(node, expression); + } + function visitConstructorDeclaration(node) { + if (currentClassContainer) { + return transformConstructor(node, currentClassContainer); + } + return fallbackVisitor(node); } function visitMethodOrAccessorDeclaration(node) { ts.Debug.assert(!ts.hasDecorators(node)); @@ -95101,13 +95868,20 @@ var ts; } var functionName = getHoistedFunctionName(node); if (functionName) { - getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m); }), node.asteriskToken, functionName, - /* typeParameters */ undefined, ts.visitParameterList(node.parameters, classElementVisitor, context), - /* type */ undefined, ts.visitFunctionBody(node.body, classElementVisitor, context)))); + getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m) && !ts.isAccessorModifier(m); }), node.asteriskToken, functionName, + /* typeParameters */ undefined, ts.visitParameterList(node.parameters, visitor, context), + /* type */ undefined, ts.visitFunctionBody(node.body, visitor, context)))); } // remove method declaration from class return undefined; } + function setCurrentStaticPropertyDeclarationOrStaticBlockAnd(current, visitor, arg) { + var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + currentStaticPropertyDeclarationOrStaticBlock = current; + var result = visitor(arg); + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return result; + } function getHoistedFunctionName(node) { ts.Debug.assert(ts.isPrivateIdentifier(node.name)); var info = accessPrivateIdentifier(node.name); @@ -95124,49 +95898,104 @@ var ts; } } } - function visitPropertyDeclaration(node) { - ts.Debug.assert(!ts.hasDecorators(node)); - if (ts.isPrivateIdentifier(node.name)) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - if (ts.isStatic(node)) { - // static fields are left as is - return ts.visitEachChild(node, visitor, context); - } - // Initializer is elided as the field is initialized in transformConstructor. - return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*questionOrExclamationToken*/ undefined, - /*type*/ undefined, - /*initializer*/ undefined); - } - // leave invalid code untransformed + function transformAutoAccessor(node) { + // transforms: + // accessor x = 1; + // into: + // #x = 1; + // get x() { return this.#x; } + // set x(value) { this.#x = value; } + ts.Debug.assertEachNode(node.modifiers, ts.isModifier); + var commentRange = ts.getCommentRange(node); + var sourceMapRange = ts.getSourceMapRange(node); + // Since we're creating two declarations where there was previously one, cache + // the expression for any computed property names. + var name = node.name; + var getterName = name; + var setterName = name; + if (ts.isComputedPropertyName(name) && !ts.isSimpleInlineableExpression(name.expression)) { + var temp = factory.createTempVariable(hoistVariableDeclaration); + ts.setSourceMapRange(temp, name.expression); + var expression = ts.visitNode(name.expression, visitor, ts.isExpression); + var assignment = factory.createAssignment(temp, expression); + ts.setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp])); + setterName = factory.updateComputedPropertyName(name, temp); + } + var backingField = ts.createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); + ts.setOriginalNode(backingField, node); + ts.setEmitFlags(backingField, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(backingField, sourceMapRange); + var getter = ts.createAccessorPropertyGetRedirector(factory, node, node.modifiers, getterName); + ts.setOriginalNode(getter, node); + ts.setCommentRange(getter, commentRange); + ts.setSourceMapRange(getter, sourceMapRange); + var setter = ts.createAccessorPropertySetRedirector(factory, node, node.modifiers, setterName); + ts.setOriginalNode(setter, node); + ts.setEmitFlags(setter, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(setter, sourceMapRange); + return ts.visitArray([backingField, getter, setter], accessorFieldResultVisitor, ts.isClassElement); + } + function transformPrivateFieldInitializer(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + // If we are transforming private elements into WeakMap/WeakSet, we should elide the node. var info = accessPrivateIdentifier(node.name); ts.Debug.assert(info, "Undeclared private name for property declaration."); - if (!info.isValid) { - return node; - } - } - // Create a temporary variable to store a computed property name (if necessary). - // If it's not inlineable, then we emit an expression after the class which assigns - // the property name to the temporary variable. - var expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer || useDefineForClassFields); - if (expr && !ts.isSimpleInlineableExpression(expr)) { - getPendingExpressions().push(expr); + // Leave invalid code untransformed; otherwise, elide the node as it is transformed elsewhere. + return info.isValid ? undefined : node; + } + if (shouldTransformInitializersUsingSet && !ts.isStatic(node)) { + // If we are transforming initializers using Set semantics we will elide the initializer as it will + // be moved to the constructor to preserve evaluation order next to public instance fields. We don't + // need to do this transformation for private static fields since public static fields can be + // transformed into `static {}` blocks. + return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + /*initializer*/ undefined); } - if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) { - var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); - if (initializerStatement) { - var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); - ts.setOriginalNode(staticBlock, node); - ts.setCommentRange(staticBlock, node); - // Set the comment range for the statement to an empty synthetic range - // and drop synthetic comments from the statement to avoid printing them twice. - ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); - ts.setSyntheticLeadingComments(initializerStatement, undefined); - ts.setSyntheticTrailingComments(initializerStatement, undefined); - return staticBlock; + return ts.visitEachChild(node, visitor, context); + } + function transformPublicFieldInitializer(node) { + if (shouldTransformInitializers) { + // Create a temporary variable to store a computed property name (if necessary). + // If it's not inlineable, then we emit an expression after the class which assigns + // the property name to the temporary variable. + var expr = getPropertyNameExpressionIfNeeded(node.name, /*shouldHoist*/ !!node.initializer || useDefineForClassFields); + if (expr) { + getPendingExpressions().push(expr); + } + if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks) { + var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); + if (initializerStatement) { + var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); + ts.setOriginalNode(staticBlock, node); + ts.setCommentRange(staticBlock, node); + // Set the comment range for the statement to an empty synthetic range + // and drop synthetic comments from the statement to avoid printing them twice. + ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); + ts.setSyntheticLeadingComments(initializerStatement, undefined); + ts.setSyntheticTrailingComments(initializerStatement, undefined); + return staticBlock; + } } + return undefined; } - return undefined; + return ts.visitEachChild(node, classElementVisitor, context); + } + function transformFieldInitializer(node) { + ts.Debug.assert(!ts.hasDecorators(node), "Decorators should already have been transformed and elided."); + return ts.isPrivateIdentifierClassElementDeclaration(node) ? + transformPrivateFieldInitializer(node) : + transformPublicFieldInitializer(node); + } + function visitPropertyDeclaration(node) { + // If this is an auto-accessor, we defer to `transformAutoAccessor`. That function + // will in turn call `transformFieldInitializer` as needed. + if (shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(node)) { + return transformAutoAccessor(node); + } + return transformFieldInitializer(node); } function createPrivateIdentifierAccess(info, receiver) { return createPrivateIdentifierAccessHelper(info, ts.visitNode(receiver, visitor, ts.isExpression)); @@ -95230,9 +96059,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) { - if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || node.operator === 46 /* SyntaxKind.MinusMinusToken */) { + if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || + node.operator === 46 /* SyntaxKind.MinusMinusToken */) { var operand = ts.skipParentheses(node.operand); - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(operand)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(operand)) { var info = void 0; if (info = accessPrivateIdentifier(operand.name)) { var receiver = ts.visitNode(operand.expression, visitor, ts.isExpression); @@ -95321,7 +96152,9 @@ var ts; return { readExpression: readExpression, initializeExpression: initializeExpression }; } function visitCallExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + // obj.#x() // Transform call expressions of private names to properly bind the `this` parameter. var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; if (ts.isCallChain(node)) { @@ -95336,6 +96169,8 @@ var ts; ts.isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.classConstructor)) { + // super.x() + // super[x]() // converts `super.f(...)` into `Reflect.get(_baseTemp, "f", _classTemp).call(_classTemp, ...)` var invocation = factory.createFunctionCallCall(ts.visitNode(node.expression, visitor, ts.isExpression), currentClassLexicalEnvironment.classConstructor, ts.visitNodes(node.arguments, visitor, ts.isExpression)); ts.setOriginalNode(invocation, node); @@ -95345,7 +96180,8 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitTaggedTemplateExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { // Bind the `this` correctly for tagged template literals when the tag is a private identifier property access. var _a = factory.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; return factory.updateTaggedTemplateExpression(node, factory.createCallExpression(factory.createPropertyAccessExpression(ts.visitNode(target, visitor), "bind"), @@ -95371,11 +96207,8 @@ var ts; classLexicalEnvironmentMap.set(ts.getOriginalNodeId(node), currentClassLexicalEnvironment); } startLexicalEnvironment(); - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = node; - var statements = ts.visitNodes(node.body.statements, visitor, ts.isStatement); + var statements = setCurrentStaticPropertyDeclarationOrStaticBlockAnd(node, function (statements) { return ts.visitNodes(statements, visitor, ts.isStatement); }, node.body.statements); statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; var iife = factory.createImmediatelyInvokedArrowFunction(statements); ts.setOriginalNode(iife, node); ts.setTextRange(iife, node); @@ -95385,9 +96218,12 @@ var ts; } function visitBinaryExpression(node, valueIsDiscarded) { if (ts.isDestructuringAssignment(node)) { + // ({ x: obj.#x } = ...) + // ({ x: super.x } = ...) + // ({ x: super[x] } = ...) var savedPendingExpressions = pendingExpressions; pendingExpressions = undefined; - node = factory.updateBinaryExpression(node, ts.visitNode(node.left, visitorDestructuringTarget), node.operatorToken, ts.visitNode(node.right, visitor)); + node = factory.updateBinaryExpression(node, ts.visitNode(node.left, assignmentTargetVisitor), node.operatorToken, ts.visitNode(node.right, visitor)); var expr = ts.some(pendingExpressions) ? factory.inlineExpressions(ts.compact(__spreadArray(__spreadArray([], pendingExpressions, true), [node], false))) : node; @@ -95395,7 +96231,9 @@ var ts; return expr; } if (ts.isAssignmentExpression(node)) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + // obj.#x = ... var info = accessPrivateIdentifier(node.left.name); if (info) { return ts.setTextRange(ts.setOriginalNode(createPrivateIdentifierAssignment(info, node.left.expression, node.right, node.operatorToken.kind), node), node); @@ -95405,6 +96243,10 @@ var ts; ts.isSuperProperty(node.left) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + // super.x = ... + // super[x] = ... + // super.x += ... + // super.x -= ... var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts; if (facts & 1 /* ClassFacts.ClassWasDecorated */) { return factory.updateBinaryExpression(node, visitInvalidSuperProperty(node.left), node.operatorToken, ts.visitNode(node.right, visitor, ts.isExpression)); @@ -95448,8 +96290,10 @@ var ts; } } } - if (node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ && ts.isPrivateIdentifier(node.left)) { - return visitPrivateIdentifierInInExpression(node); + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierInExpression(node)) { + // #x in obj + return transformPrivateIdentifierInInExpression(node); } return ts.visitEachChild(node, visitor, context); } @@ -95474,36 +96318,6 @@ var ts; ts.Debug.assertNever(info, "Unknown private element type"); } } - /** - * Set up the environment for a class. - */ - function visitClassLike(node) { - if (!ts.forEach(node.members, doesClassElementNeedTransform)) { - return ts.visitEachChild(node, visitor, context); - } - var savedPendingExpressions = pendingExpressions; - pendingExpressions = undefined; - startClassLexicalEnvironment(); - if (shouldTransformPrivateElementsOrClassStaticBlocks) { - var name = ts.getNameOfDeclaration(node); - if (name && ts.isIdentifier(name)) { - getPrivateIdentifierEnvironment().className = ts.idText(name); - } - var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); - if (ts.some(privateInstanceMethodsAndAccessors)) { - getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); - } - } - var result = ts.isClassDeclaration(node) ? - visitClassDeclaration(node) : - visitClassExpression(node); - endClassLexicalEnvironment(); - pendingExpressions = savedPendingExpressions; - return result; - } - function doesClassElementNeedTransform(node) { - return ts.isPropertyDeclaration(node) || ts.isClassStaticBlockDeclaration(node) || (shouldTransformPrivateElementsOrClassStaticBlocks && node.name && ts.isPrivateIdentifier(node.name)); - } function getPrivateInstanceMethodsAndAccessors(node) { return ts.filter(node.members, ts.isNonStaticMethodOrAccessorWithPrivateName); } @@ -95517,7 +96331,7 @@ var ts; var member = _a[_i]; if (!ts.isStatic(member)) continue; - if (member.name && ts.isPrivateIdentifier(member.name) && shouldTransformPrivateElementsOrClassStaticBlocks) { + if (member.name && (ts.isPrivateIdentifier(member.name) || ts.isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) { facts |= 2 /* ClassFacts.NeedsClassConstructorReference */; } if (ts.isPropertyDeclaration(member) || ts.isClassStaticBlockDeclaration(member)) { @@ -95536,7 +96350,7 @@ var ts; } return facts; } - function visitExpressionWithTypeArguments(node) { + function visitExpressionWithTypeArgumentsInHeritageClause(node) { var facts = (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.facts) || 0 /* ClassFacts.None */; if (facts & 4 /* ClassFacts.NeedsClassSuperReference */) { var temp = factory.createTempVariable(hoistVariableDeclaration, /*reserveInNestedScopes*/ true); @@ -95546,7 +96360,22 @@ var ts; } return ts.visitEachChild(node, visitor, context); } - function visitClassDeclaration(node) { + function visitInNewClassLexicalEnvironment(node, visitor) { + var savedCurrentClassContainer = currentClassContainer; + var savedPendingExpressions = pendingExpressions; + currentClassContainer = node; + pendingExpressions = undefined; + startClassLexicalEnvironment(); + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + var name = ts.getNameOfDeclaration(node); + if (name && ts.isIdentifier(name)) { + getPrivateIdentifierEnvironment().className = name; + } + var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); + if (ts.some(privateInstanceMethodsAndAccessors)) { + getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); + } + } var facts = getClassFacts(node); if (facts) { getClassLexicalEnvironment().facts = facts; @@ -95554,6 +96383,16 @@ var ts; if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { enableSubstitutionForClassStaticThisOrSuperReference(); } + var result = visitor(node, facts); + endClassLexicalEnvironment(); + currentClassContainer = savedCurrentClassContainer; + pendingExpressions = savedPendingExpressions; + return result; + } + function visitClassDeclaration(node) { + return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); + } + function visitClassDeclarationInNewClassLexicalEnvironment(node, facts) { // If a class has private static fields, or a static field has a `this` or `super` reference, // then we need to allocate a temp variable to hold on to that reference. var pendingClassReferenceAssignment; @@ -95562,12 +96401,16 @@ var ts; getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); - var statements = [ - factory.updateClassDeclaration(node, node.modifiers, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) - ]; + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classDecl = factory.updateClassDeclaration(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var statements = []; + if (prologue) { + statements.push(factory.createExpressionStatement(prologue)); + } + statements.push(classDecl); if (pendingClassReferenceAssignment) { getPendingExpressions().unshift(pendingClassReferenceAssignment); } @@ -95575,25 +96418,23 @@ var ts; if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); } - // Emit static property assignment. Because classDeclaration is lexically evaluated, - // it is safe to emit static property assignment after classDeclaration - // From ES6 specification: - // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using - // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. - var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); - if (ts.some(staticProperties)) { - addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + if (shouldTransformInitializersUsingSet || shouldTransformPrivateElementsOrClassStaticBlocks) { + // Emit static property assignment. Because classDeclaration is lexically evaluated, + // it is safe to emit static property assignment after classDeclaration + // From ES6 specification: + // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using + // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. + var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); + if (ts.some(staticProperties)) { + addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + } } return statements; } function visitClassExpression(node) { - var facts = getClassFacts(node); - if (facts) { - getClassLexicalEnvironment().facts = facts; - } - if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { - enableSubstitutionForClassStaticThisOrSuperReference(); - } + return visitInNewClassLexicalEnvironment(node, visitClassExpressionInNewClassLexicalEnvironment); + } + function visitClassExpressionInNewClassLexicalEnvironment(node, facts) { // If this class expression is a transformation of a decorated class declaration, // then we want to output the pendingExpressions as statements, not as inlined // expressions with the class statement. @@ -95603,8 +96444,6 @@ var ts; // these statements after the class expression variable statement. var isDecoratedClassDeclaration = !!(facts & 1 /* ClassFacts.ClassWasDecorated */); var staticPropertiesOrClassStaticBlocks = ts.getStaticPropertiesAndClassStaticBlock(node); - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; var temp; function createClassTempVar() { @@ -95617,9 +96456,23 @@ var ts; temp = createClassTempVar(); getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); } - var classExpression = factory.updateClassExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)); - var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(staticPropertiesOrClassStaticBlocks, function (p) { return ts.isClassStaticBlockDeclaration(p) || !!p.initializer || ts.isPrivateIdentifier(p.name); }); + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classExpression = factory.updateClassExpression(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var expressions = []; + if (prologue) { + expressions.push(prologue); + } + // Static initializers are transformed to `static {}` blocks when `useDefineForClassFields: false` + // and not also transforming static blocks. + var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && + ts.some(staticPropertiesOrClassStaticBlocks, function (node) { + return ts.isClassStaticBlockDeclaration(node) || + ts.isPrivateIdentifierClassElementDeclaration(node) || + shouldTransformInitializers && ts.isInitializedProperty(node); + }); if (hasTransformableStatics || ts.some(pendingExpressions)) { if (isDecoratedClassDeclaration) { ts.Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); @@ -95631,12 +96484,16 @@ var ts; addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); } if (temp) { - return factory.inlineExpressions([factory.createAssignment(temp, classExpression), temp]); + expressions.push(ts.startOnNewLine(factory.createAssignment(temp, classExpression)), ts.startOnNewLine(temp)); + } + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } } - return classExpression; } else { - var expressions = []; temp || (temp = createClassTempVar()); if (isClassWithConstructorReference) { // record an alias as the class name is not in scope for statics. @@ -95653,45 +96510,87 @@ var ts; ts.addRange(expressions, ts.map(pendingExpressions, ts.startOnNewLine)); ts.addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); expressions.push(ts.startOnNewLine(temp)); - return factory.inlineExpressions(expressions); } } - return classExpression; + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } + } + return factory.inlineExpressions(expressions); } function visitClassStaticBlockDeclaration(node) { if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return ts.visitEachChild(node, classElementVisitor, context); + return ts.visitEachChild(node, visitor, context); } // ClassStaticBlockDeclaration for classes are transformed in `visitClassDeclaration` or `visitClassExpression`. return undefined; } - function transformClassMembers(node, isDerivedClass) { - var members = []; + function transformClassMembers(node) { + // Declare private names if (shouldTransformPrivateElementsOrClassStaticBlocks) { - // Declare private names. for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (ts.isPrivateIdentifierClassElementDeclaration(member)) { - addPrivateIdentifierToEnvironment(member); + addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); } } if (ts.some(getPrivateInstanceMethodsAndAccessors(node))) { createBrandCheckWeakSetForPrivateMethods(); } + if (shouldTransformAutoAccessors) { + for (var _b = 0, _c = node.members; _b < _c.length; _b++) { + var member = _c[_b]; + if (ts.isAutoAccessorPropertyDeclaration(member)) { + var storageName = factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"); + addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + } + } + } } - var constructor = transformConstructor(node, isDerivedClass); - var visitedMembers = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); - if (constructor) { - members.push(constructor); + var members = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); + // Create a synthetic constructor if necessary + var syntheticConstructor; + if (!ts.some(members, ts.isConstructorDeclaration)) { + syntheticConstructor = transformConstructor(/*constructor*/ undefined, node); } + var prologue; + // If there are pending expressions create a class static block in which to evaluate them, but only if + // class static blocks are not also being transformed. This block will be injected at the top of the class + // to ensure that expressions from computed property names are evaluated before any other static + // initializers. + var syntheticStaticBlock; if (!shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(pendingExpressions)) { - members.push(factory.createClassStaticBlockDeclaration(factory.createBlock([ - factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)) - ]))); + var statement = factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)); + if (statement.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */) { + // If there are `this` or `super` references from computed property names, shift the expression + // into an arrow function to be evaluated in the outer scope so that `this` and `super` are + // properly captured. + var temp = factory.createTempVariable(hoistVariableDeclaration); + var arrow = factory.createArrowFunction( + /*modifiers*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, + /*equalsGreaterThanToken*/ undefined, factory.createBlock([statement])); + prologue = factory.createAssignment(temp, arrow); + statement = factory.createExpressionStatement(factory.createCallExpression(temp, /*typeArguments*/ undefined, [])); + } + var block = factory.createBlock([statement]); + syntheticStaticBlock = factory.createClassStaticBlockDeclaration(block); pendingExpressions = undefined; } - ts.addRange(members, visitedMembers); - return ts.setTextRange(factory.createNodeArray(members), /*location*/ node.members); + // If we created a synthetic constructor or class static block, add them to the visited members + // and return a new array. + if (syntheticConstructor || syntheticStaticBlock) { + var membersArray = void 0; + membersArray = ts.append(membersArray, syntheticConstructor); + membersArray = ts.append(membersArray, syntheticStaticBlock); + membersArray = ts.addRange(membersArray, members); + members = ts.setTextRange(factory.createNodeArray(membersArray), /*location*/ node.members); + } + return { members: members, prologue: prologue }; } function createBrandCheckWeakSetForPrivateMethods() { var weakSetName = getPrivateIdentifierEnvironment().weakSetName; @@ -95700,35 +96599,38 @@ var ts; /*typeArguments*/ undefined, []))); } function isClassElementThatRequiresConstructorStatement(member) { - if (ts.isStatic(member) || ts.hasSyntacticModifier(ts.getOriginalNode(member), 128 /* ModifierFlags.Abstract */)) { + if (ts.isStatic(member) || ts.hasAbstractModifier(ts.getOriginalNode(member))) { return false; } - if (useDefineForClassFields) { - // If we are using define semantics and targeting ESNext or higher, - // then we don't need to transform any class properties. - return languageVersion < 9 /* ScriptTarget.ES2022 */; - } - return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member); + return shouldTransformInitializersUsingDefine && ts.isPropertyDeclaration(member) || + shouldTransformInitializersUsingSet && ts.isInitializedProperty(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(member); } - function transformConstructor(node, isDerivedClass) { - var constructor = ts.visitNode(ts.getFirstConstructorWithBody(node), visitor, ts.isConstructorDeclaration); - var elements = node.members.filter(isClassElementThatRequiresConstructorStatement); - if (!ts.some(elements)) { + function transformConstructor(constructor, container) { + constructor = ts.visitNode(constructor, visitor, ts.isConstructorDeclaration); + if (!ts.some(container.members, isClassElementThatRequiresConstructorStatement)) { return constructor; } + var extendsClauseElement = ts.getEffectiveBaseTypeNode(container); + var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var parameters = ts.visitParameterList(constructor ? constructor.parameters : undefined, visitor, context); - var body = transformConstructorBody(node, constructor, isDerivedClass); + var body = transformConstructorBody(container, constructor, isDerivedClass); if (!body) { - return undefined; + return constructor; + } + if (constructor) { + ts.Debug.assert(parameters); + return factory.updateConstructorDeclaration(constructor, /*modifiers*/ undefined, parameters, body); } return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration( - /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || node), constructor)); + /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || container), constructor)); } function transformConstructorBody(node, constructor, isDerivedClass) { - var _a; + var _a, _b; var properties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ false); if (!useDefineForClassFields) { - properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name); }); + properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name) || ts.hasAccessorModifier(property); }); } var privateMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); var needsConstructorBody = ts.some(properties) || ts.some(privateMethodsAndAccessors); @@ -95780,8 +96682,8 @@ var ts; statements = statements.filter(function (statement) { return !ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor); }); } else { - for (var _i = 0, _b = constructor.body.statements; _i < _b.length; _i++) { - var statement = _b[_i]; + for (var _i = 0, _c = constructor.body.statements; _i < _c.length; _i++) { + var statement = _c[_i]; if (ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { parameterPropertyDeclarationCount++; } @@ -95813,9 +96715,14 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue)); } statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + if (statements.length === 0 && !constructor) { + return undefined; + } + var multiLine = (constructor === null || constructor === void 0 ? void 0 : constructor.body) && constructor.body.statements.length >= statements.length ? + (_b = constructor.body.multiLine) !== null && _b !== void 0 ? _b : statements.length > 0 : + statements.length > 0; return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), - /*location*/ constructor ? constructor.body.statements : node.members), - /*multiLine*/ true), + /*location*/ constructor ? constructor.body.statements : node.members), multiLine), /*location*/ constructor ? constructor.body : undefined); function visitBodyStatement(statement) { if (useDefineForClassFields && ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { @@ -95851,9 +96758,10 @@ var ts; return undefined; } var statement = factory.createExpressionStatement(expression); + ts.setOriginalNode(statement, property); + ts.addEmitFlags(statement, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); - ts.setOriginalNode(statement, property); // `setOriginalNode` *copies* the `emitNode` from `property`, so now both // `statement` and `expression` have a copy of the synthesized comments. // Drop the comments from expression to avoid printing them twice. @@ -95876,9 +96784,10 @@ var ts; continue; } ts.startOnNewLine(expression); + ts.setOriginalNode(expression, property); + ts.addEmitFlags(expression, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); ts.setCommentRange(expression, property); - ts.setOriginalNode(expression, property); expressions.push(expression); } return expressions; @@ -95905,9 +96814,11 @@ var ts; var _a; // We generate a name here in order to reuse the value cached by the relocated computed name expression (which uses the same generated name) var emitAssignment = !useDefineForClassFields; - var propertyName = ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) - ? factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) - : property.name; + var propertyName = ts.hasAccessorModifier(property) ? + factory.getGeneratedPrivateNameForNode(property.name) : + ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) ? + factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) : + property.name; if (ts.hasStaticModifier(property)) { currentStaticPropertyDeclarationOrStaticBlock = property; } @@ -95934,7 +96845,7 @@ var ts; return undefined; } var propertyOriginalNode = ts.getOriginalNode(property); - if (ts.hasSyntacticModifier(propertyOriginalNode, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(propertyOriginalNode, 256 /* ModifierFlags.Abstract */)) { return undefined; } var initializer = property.initializer || emitAssignment ? (_a = ts.visitNode(property.initializer, visitor, ts.isExpression)) !== null && _a !== void 0 ? _a : factory.createVoidZero() @@ -95968,17 +96879,17 @@ var ts; // substitute `this` in a static field initializer context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); // these push a new lexical environment that is not the class lexical environment - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // these push a new lexical environment that is not the class lexical environment, except // when they have a computed property name - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(167 /* SyntaxKind.PropertyDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(169 /* SyntaxKind.PropertyDeclaration */); // class lexical environments are restored when entering a computed property name - context.enableEmitNotification(162 /* SyntaxKind.ComputedPropertyName */); + context.enableEmitNotification(164 /* SyntaxKind.ComputedPropertyName */); } } /** @@ -96017,13 +96928,13 @@ var ts; } } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (ts.isArrowFunction(original) || ts.getEmitFlags(node) & 262144 /* EmitFlags.AsyncFunctionBody */) { break; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = undefined; @@ -96033,10 +96944,10 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentComputedPropertyNameClassLexicalEnvironment = currentClassLexicalEnvironment; @@ -96046,7 +96957,7 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 162 /* SyntaxKind.ComputedPropertyName */: { + case 164 /* SyntaxKind.ComputedPropertyName */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; @@ -96160,149 +97071,138 @@ var ts; function getPrivateIdentifierEnvironment() { var lex = getClassLexicalEnvironment(); lex.privateIdentifierEnvironment || (lex.privateIdentifierEnvironment = { - className: "", - identifiers: new ts.Map() + className: undefined, + weakSetName: undefined, + identifiers: undefined, + generatedIdentifiers: undefined, }); return lex.privateIdentifierEnvironment; } function getPendingExpressions() { - return pendingExpressions || (pendingExpressions = []); + return pendingExpressions !== null && pendingExpressions !== void 0 ? pendingExpressions : (pendingExpressions = []); } - function addPrivateIdentifierToEnvironment(node) { - var _a; - var text = ts.getTextOfPropertyName(node.name); - var lex = getClassLexicalEnvironment(); - var classConstructor = lex.classConstructor; - var privateEnv = getPrivateIdentifierEnvironment(); - var weakSetName = privateEnv.weakSetName; - var assignmentExpressions = []; - var privateName = node.name.escapedText; - var previousInfo = privateEnv.identifiers.get(privateName); - var isValid = !isReservedPrivateName(node.name) && previousInfo === undefined; - if (ts.hasStaticModifier(node)) { - ts.Debug.assert(classConstructor, "weakSetName should be set in private identifier environment"); - if (ts.isPropertyDeclaration(node)) { - var variableName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f" /* PrivateIdentifierKind.Field */, - variableName: variableName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isMethodDeclaration(node)) { - var functionName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: functionName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isGetAccessorDeclaration(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else if (ts.isSetAccessorDeclaration(node)) { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else { - ts.Debug.assertNever(node, "Unknown class element type."); - } + function addPrivateIdentifierClassElementToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + if (ts.isAutoAccessorPropertyDeclaration(node)) { + addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isPropertyDeclaration(node)) { - var weakMapName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { + addPrivateIdentifierPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isMethodDeclaration(node)) { + addPrivateIdentifierMethodDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isGetAccessorDeclaration(node)) { + addPrivateIdentifierGetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isSetAccessorDeclaration(node)) { + addPrivateIdentifierSetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + } + function addPrivateIdentifierPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + if (isStatic) { + ts.Debug.assert(lex.classConstructor, "classConstructor should be set in private identifier environment"); + var variableName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f" /* PrivateIdentifierKind.Field */, + brandCheckIdentifier: lex.classConstructor, + variableName: variableName, + isStatic: true, + isValid: isValid, + }); + } + else { + var weakMapName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { kind: "f" /* PrivateIdentifierKind.Field */, brandCheckIdentifier: weakMapName, - isStatic: false, variableName: undefined, + isStatic: false, isValid: isValid, }); - assignmentExpressions.push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), + getPendingExpressions().push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), /*typeArguments*/ undefined, []))); } - else if (ts.isMethodDeclaration(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: createHoistedVariableForPrivateName(text, node), - brandCheckIdentifier: weakSetName, - isStatic: false, + } + function addPrivateIdentifierMethodDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var methodName = createHoistedVariableForPrivateName(name); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "m" /* PrivateIdentifierKind.Method */, + methodName: methodName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierGetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.getterName) { + previousInfo.getterName = getterName; + } + else { + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: undefined, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, isValid: isValid, }); } - else if (ts.isAccessor(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - if (ts.isGetAccessor(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } - else { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } + } + function addPrivateIdentifierSetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.setterName) { + previousInfo.setterName = setterName; } else { - ts.Debug.assertNever(node, "Unknown class element type."); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: undefined, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); } - (_a = getPendingExpressions()).push.apply(_a, assignmentExpressions); } - function createHoistedVariableForClass(name, node) { + function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierToEnvironment(node, name, addDeclaration) { + var lex = getClassLexicalEnvironment(); + var privateEnv = getPrivateIdentifierEnvironment(); + var previousInfo = getPrivateIdentifier(privateEnv, name); + var isStatic = ts.hasStaticModifier(node); + var isValid = !isReservedPrivateName(name) && previousInfo === undefined; + addDeclaration(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + function createHoistedVariableForClass(name, node, suffix) { var className = getPrivateIdentifierEnvironment().className; - var prefix = className ? "_".concat(className) : ""; - var identifier = factory.createUniqueName("".concat(prefix, "_").concat(name), 16 /* GeneratedIdentifierFlags.Optimistic */); + var prefix = className ? { prefix: "_", node: className, suffix: "_" } : "_"; + var identifier = typeof name === "object" ? factory.getGeneratedNameForNode(name, 16 /* GeneratedIdentifierFlags.Optimistic */ | 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */, prefix, suffix) : + typeof name === "string" ? factory.createUniqueName(name, 16 /* GeneratedIdentifierFlags.Optimistic */, prefix, suffix) : + factory.createTempVariable(/*recordTempVariable*/ undefined, /*reserveInNestedScopes*/ true, prefix, suffix); if (resolver.getNodeCheckFlags(node) & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */) { addBlockScopedVariable(identifier); } @@ -96311,13 +97211,33 @@ var ts; } return identifier; } - function createHoistedVariableForPrivateName(privateName, node) { - return createHoistedVariableForClass(privateName.substring(1), node.name); + function createHoistedVariableForPrivateName(name, suffix) { + var _a; + var text = ts.tryGetTextOfPropertyName(name); + return createHoistedVariableForClass((_a = text === null || text === void 0 ? void 0 : text.substring(1)) !== null && _a !== void 0 ? _a : name, name, suffix); } + /** + * Access an already defined {@link PrivateIdentifier} in the current {@link PrivateIdentifierEnvironment}. + * + * @seealso {@link addPrivateIdentifierToEnvironment} + */ function accessPrivateIdentifier(name) { - var _a; + if (ts.isGeneratedPrivateIdentifier(name)) { + return accessGeneratedPrivateIdentifier(name); + } + else { + return accessPrivateIdentifierByText(name.escapedText); + } + } + function accessPrivateIdentifierByText(text) { + return accessPrivateIdentifierWorker(getPrivateIdentifierInfo, text); + } + function accessGeneratedPrivateIdentifier(name) { + return accessPrivateIdentifierWorker(getGeneratedPrivateIdentifierInfo, ts.getNodeForGeneratedName(name)); + } + function accessPrivateIdentifierWorker(getPrivateIdentifierInfo, privateIdentifierKey) { if (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.privateIdentifierEnvironment) { - var info = currentClassLexicalEnvironment.privateIdentifierEnvironment.identifiers.get(name.escapedText); + var info = getPrivateIdentifierInfo(currentClassLexicalEnvironment.privateIdentifierEnvironment, privateIdentifierKey); if (info) { return info; } @@ -96327,9 +97247,11 @@ var ts; if (!env) { continue; } - var info = (_a = env.privateIdentifierEnvironment) === null || _a === void 0 ? void 0 : _a.identifiers.get(name.escapedText); - if (info) { - return info; + if (env.privateIdentifierEnvironment) { + var info = getPrivateIdentifierInfo(env.privateIdentifierEnvironment, privateIdentifierKey); + if (info) { + return info; + } } } return undefined; @@ -96386,7 +97308,7 @@ var ts; } } } - return ts.visitNode(node, visitorDestructuringTarget); + return ts.visitNode(node, assignmentTargetVisitor); } function visitObjectAssignmentTarget(node) { if (ts.isObjectBindingOrAssignmentElement(node) && !ts.isShorthandPropertyAssignment(node)) { @@ -96419,10 +97341,10 @@ var ts; var initializer = ts.getInitializerOfBindingOrAssignmentElement(node); return factory.updatePropertyAssignment(node, ts.visitNode(node.name, visitor, ts.isPropertyName), wrapped ? initializer ? factory.createAssignment(wrapped, ts.visitNode(initializer, visitor)) : wrapped : - ts.visitNode(node.initializer, visitorDestructuringTarget, ts.isExpression)); + ts.visitNode(node.initializer, assignmentTargetVisitor, ts.isExpression)); } if (ts.isSpreadAssignment(node)) { - return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, visitorDestructuringTarget, ts.isExpression)); + return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, assignmentTargetVisitor, ts.isExpression)); } ts.Debug.assert(wrapped === undefined, "Should not have generated a wrapped target"); } @@ -96468,7 +97390,31 @@ var ts; /*typeArguments*/ undefined, [receiver]); } function isReservedPrivateName(node) { - return node.escapedText === "#constructor"; + return !ts.isGeneratedPrivateIdentifier(node) && node.escapedText === "#constructor"; + } + function getPrivateIdentifier(privateEnv, name) { + return ts.isGeneratedPrivateIdentifier(name) ? + getGeneratedPrivateIdentifierInfo(privateEnv, ts.getNodeForGeneratedName(name)) : + getPrivateIdentifierInfo(privateEnv, name.escapedText); + } + function setPrivateIdentifier(privateEnv, name, info) { + var _a, _b; + if (ts.isGeneratedPrivateIdentifier(name)) { + (_a = privateEnv.generatedIdentifiers) !== null && _a !== void 0 ? _a : (privateEnv.generatedIdentifiers = new ts.Map()); + privateEnv.generatedIdentifiers.set(ts.getNodeForGeneratedName(name), info); + } + else { + (_b = privateEnv.identifiers) !== null && _b !== void 0 ? _b : (privateEnv.identifiers = new ts.Map()); + privateEnv.identifiers.set(name.escapedText, info); + } + } + function getPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.identifiers) === null || _a === void 0 ? void 0 : _a.get(key); + } + function getGeneratedPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.generatedIdentifiers) === null || _a === void 0 ? void 0 : _a.get(key); } })(ts || (ts = {})); /*@internal*/ @@ -96509,15 +97455,15 @@ var ts; */ function serializeTypeOfNode(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: return serializeTypeNode(node.type); - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return serializeTypeNode(getAccessorTypeNode(node)); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createIdentifier("Function"); default: return ts.factory.createVoidZero(); @@ -96553,7 +97499,7 @@ var ts; return ts.factory.createArrayLiteralExpression(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (container && node.kind === 174 /* SyntaxKind.GetAccessor */) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -96599,66 +97545,66 @@ var ts; node = ts.skipTypeParentheses(node); switch (node.kind) { case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return ts.factory.createVoidZero(); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return ts.factory.createIdentifier("Function"); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return ts.factory.createIdentifier("Array"); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? ts.factory.createVoidZero() : ts.factory.createIdentifier("Boolean"); - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return ts.factory.createIdentifier("Boolean"); - case 198 /* SyntaxKind.TemplateLiteralType */: - case 150 /* SyntaxKind.StringKeyword */: + case 200 /* SyntaxKind.TemplateLiteralType */: + case 152 /* SyntaxKind.StringKeyword */: return ts.factory.createIdentifier("String"); - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return ts.factory.createIdentifier("Object"); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return serializeLiteralOfLiteralTypeNode(node.literal); - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return ts.factory.createIdentifier("Number"); - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return getGlobalConstructor("BigInt", 7 /* ScriptTarget.ES2020 */); - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return getGlobalConstructor("Symbol", 2 /* ScriptTarget.ES2015 */); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return serializeTypeReferenceNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ true); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ false); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return serializeUnionOrIntersectionConstituents([node.trueType, node.falseType], /*isIntersection*/ false); - case 193 /* SyntaxKind.TypeOperator */: - if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + case 195 /* SyntaxKind.TypeOperator */: + if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { return serializeTypeNode(node.type); } break; - case 181 /* SyntaxKind.TypeQuery */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 192 /* SyntaxKind.ThisType */: - case 200 /* SyntaxKind.ImportType */: + case 183 /* SyntaxKind.TypeQuery */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 194 /* SyntaxKind.ThisType */: + case 202 /* SyntaxKind.ImportType */: break; // handle JSDoc types from an invalid parse - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - case 319 /* SyntaxKind.JSDocNamepathType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 321 /* SyntaxKind.JSDocVariadicType */: + case 322 /* SyntaxKind.JSDocNamepathType */: break; - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return serializeTypeNode(node.type); default: return ts.Debug.failBadSyntaxKind(node); @@ -96670,7 +97616,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.factory.createIdentifier("String"); - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; switch (operand.kind) { case 8 /* SyntaxKind.NumericLiteral */: @@ -96699,20 +97645,20 @@ var ts; for (var _i = 0, types_22 = types; _i < types_22.length; _i++) { var typeNode = types_22[_i]; typeNode = ts.skipTypeParentheses(typeNode); - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { if (isIntersection) return ts.factory.createVoidZero(); // Reduce to `never` in an intersection continue; // Elide `never` in a union } - if (typeNode.kind === 155 /* SyntaxKind.UnknownKeyword */) { + if (typeNode.kind === 157 /* SyntaxKind.UnknownKeyword */) { if (!isIntersection) return ts.factory.createIdentifier("Object"); // Reduce to `unknown` in a union continue; // Elide `unknown` in an intersection } - if (typeNode.kind === 130 /* SyntaxKind.AnyKeyword */) { + if (typeNode.kind === 131 /* SyntaxKind.AnyKeyword */) { return ts.factory.createIdentifier("Object"); // Reduce to `any` in a union or intersection } - if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var serializedConstituent = serializeTypeNode(typeNode); @@ -96860,7 +97806,7 @@ var ts; name.original = undefined; ts.setParent(name, ts.getParseTreeNode(currentLexicalScope)); // ensure the parent is set to a parse tree node. return name; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return serializeQualifiedNameAsExpression(node); } } @@ -96915,24 +97861,24 @@ var ts; return node; } switch (node.kind) { - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are elided. They will be emitted as part of `visitClassDeclaration`. return undefined; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructorDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitSetAccessorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return visitGetAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return visitPropertyDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameterDeclaration(node); default: return ts.visitEachChild(node, visitor, context); @@ -97288,7 +98234,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ !ts.hasSyntacticModifier(member, 2 /* ModifierFlags.Ambient */)); var descriptor = languageVersion > 0 /* ScriptTarget.ES3 */ - ? member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + ? ts.isPropertyDeclaration(member) && !ts.hasAccessorModifier(member) // We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it // should not invoke `Object.getOwnPropertyDescriptor`. ? factory.createVoidZero() @@ -97551,34 +98497,37 @@ var ts; return node; } switch (node.kind) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 return undefined; - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitMethodDeclaration, node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionDeclaration, node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionExpression, node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithContext(1 /* ContextFlags.NonTopLevel */, visitArrowFunction, node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 174 /* SyntaxKind.GetAccessor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitGetAccessorDeclaration, node); + case 175 /* SyntaxKind.SetAccessor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitSetAccessorDeclaration, node); + case 173 /* SyntaxKind.Constructor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitConstructorDeclaration, node); + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node); default: return ts.visitEachChild(node, visitor, context); @@ -97587,27 +98536,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatementInAsyncBody(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatementInAsyncBody(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatementInAsyncBody(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatementInAsyncBody(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClauseInAsyncBody(node); - case 235 /* SyntaxKind.Block */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 250 /* SyntaxKind.LabeledStatement */: + case 238 /* SyntaxKind.Block */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -97677,6 +98626,9 @@ var ts; return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression( /*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node); } + function visitConstructorDeclaration(node) { + return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node)); + } /** * Visits a MethodDeclaration node. * @@ -97691,7 +98643,14 @@ var ts; /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* FunctionFlags.Async */ ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : transformMethodBody(node)); + } + function visitGetAccessorDeclaration(node) { + return factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformMethodBody(node)); + } + function visitSetAccessorDeclaration(node) { + return factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node)); } /** * Visits a FunctionDeclaration node. @@ -97805,12 +98764,48 @@ var ts; } return false; } + function transformMethodBody(node) { + ts.Debug.assertIsDefined(node.body); + var savedCapturedSuperProperties = capturedSuperProperties; + var savedHasSuperElementAccess = hasSuperElementAccess; + capturedSuperProperties = new ts.Set(); + hasSuperElementAccess = false; + var updated = ts.visitFunctionBody(node.body, visitor, context); + // Minor optimization, emit `_super` helper to capture `super` access in an arrow. + // This step isn't needed if we eventually transform this to ES5. + var originalMethod = ts.getOriginalNode(node, ts.isFunctionLikeDeclaration); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && + resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) && + (ts.getFunctionFlags(originalMethod) & 3 /* FunctionFlags.AsyncGenerator */) !== 3 /* FunctionFlags.AsyncGenerator */; + if (emitSuperHelpers) { + enableSubstitutionForAsyncMethodsWithSuper(); + if (capturedSuperProperties.size) { + var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties); + substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true; + var statements = updated.statements.slice(); + ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]); + updated = factory.updateBlock(updated, statements); + } + if (hasSuperElementAccess) { + // Emit helpers for super element access expressions (`super[x]`). + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { + ts.addEmitHelper(updated, ts.advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { + ts.addEmitHelper(updated, ts.asyncSuperHelper); + } + } + } + capturedSuperProperties = savedCapturedSuperProperties; + hasSuperElementAccess = savedHasSuperElementAccess; + return updated; + } function transformAsyncFunctionBody(node) { resumeLexicalEnvironment(); var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ScriptTarget.ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 214 /* SyntaxKind.ArrowFunction */; + var isArrowFunction = node.kind === 216 /* SyntaxKind.ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* NodeCheckFlags.CaptureArguments */) !== 0; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current @@ -97837,7 +98832,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); // Minor optimization, emit `_super` helper to capture `super` access in an arrow. // This step isn't needed if we eventually transform this to ES5. - var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */ | 2048 /* NodeCheckFlags.AsyncMethodWithSuper */); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */); if (emitSuperHelpers) { enableSubstitutionForAsyncMethodsWithSuper(); if (capturedSuperProperties.size) { @@ -97850,10 +98845,10 @@ var ts; ts.setTextRange(block, node.body); if (emitSuperHelpers && hasSuperElementAccess) { // Emit helpers for super element access expressions (`super[x]`). - if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); } - else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) { + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { ts.addEmitHelper(block, ts.asyncSuperHelper); } } @@ -97901,17 +98896,17 @@ var ts; enabledSubstitutions |= 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -97925,7 +98920,7 @@ var ts; // If we need to support substitutions for `super` in an async method, // we should track it here. if (enabledSubstitutions & 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) { - var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */); + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */); if (superContainerFlags !== enclosingSuperContainerFlags) { var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; enclosingSuperContainerFlags = superContainerFlags; @@ -97959,11 +98954,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -97995,14 +98990,14 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { - if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createUniqueName("_superIndex", 16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */), /*typeArguments*/ undefined, [argumentExpression]), "value"), location); } @@ -98017,7 +99012,7 @@ var ts; function createSuperAccessVariableStatement(factory, resolver, node, names) { // Create a variable declaration with a getter/setter (if binding) definition for each name: // const _super = Object.create(null, { x: { get: () => super.x, set: (v) => super.x = v }, ... }); - var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) !== 0; + var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) !== 0; var accessors = []; names.forEach(function (_, key) { var name = ts.unescapeLeadingUnderscores(key); @@ -98156,7 +99151,7 @@ var ts; return visitorWorker(node, /*expressionResultIsUnused*/ true); } function visitorNoAsyncModifier(node) { - if (node.kind === 131 /* SyntaxKind.AsyncKeyword */) { + if (node.kind === 132 /* SyntaxKind.AsyncKeyword */) { return undefined; } return node; @@ -98182,70 +99177,70 @@ var ts; return node; } switch (node.kind) { - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: return doWithHierarchyFacts(visitDefault, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return doWithHierarchyFacts(visitForStatement, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return doWithHierarchyFacts(visitConstructorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithHierarchyFacts(visitMethodDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return doWithHierarchyFacts(visitGetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return doWithHierarchyFacts(visitSetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithHierarchyFacts(visitFunctionDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithHierarchyFacts(visitFunctionExpression, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithHierarchyFacts(visitArrowFunction, node, 2 /* HierarchyFacts.ArrowFunctionExcludes */, 0 /* HierarchyFacts.ArrowFunctionIncludes */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithHierarchyFacts(visitDefault, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); default: return ts.visitEachChild(node, visitor, context); @@ -98281,7 +99276,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2 /* FunctionFlags.Async */) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 244 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { + if (statement.kind === 247 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { return visitForOfStatement(statement, node); } return factory.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement, factory.liftToBlock), node); @@ -98293,7 +99288,7 @@ var ts; var objects = []; for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) { var e = elements_5[_i]; - if (e.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (e.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (chunkObject) { objects.push(factory.createObjectLiteralExpression(chunkObject)); chunkObject = undefined; @@ -98302,7 +99297,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 296 /* SyntaxKind.PropertyAssignment */ + chunkObject = ts.append(chunkObject, e.kind === 299 /* SyntaxKind.PropertyAssignment */ ? factory.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -98336,7 +99331,7 @@ var ts; // If we translate the above to `__assign({}, k, l)`, the `l` will evaluate before `k` is spread and we // end up with `{ a: 1, b: 2, c: 3 }` var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { objects.unshift(factory.createObjectLiteralExpression()); } var expression = objects[0]; @@ -98510,11 +99505,22 @@ var ts; } return node; } - function convertForOfStatementHead(node, boundValue) { - var binding = ts.createForOfBindingStatement(factory, node.initializer, boundValue); + function convertForOfStatementHead(node, boundValue, nonUserCode) { + var value = factory.createTempVariable(hoistVariableDeclaration); + var iteratorValueExpression = factory.createAssignment(value, boundValue); + var iteratorValueStatement = factory.createExpressionStatement(iteratorValueExpression); + ts.setSourceMapRange(iteratorValueStatement, node.expression); + var exitNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createFalse()); + var exitNonUserCodeStatement = factory.createExpressionStatement(exitNonUserCodeExpression); + ts.setSourceMapRange(exitNonUserCodeStatement, node.expression); + var enterNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createTrue()); + var enterNonUserCodeStatement = factory.createExpressionStatement(enterNonUserCodeExpression); + ts.setSourceMapRange(exitNonUserCodeStatement, node.expression); + var statements = []; + var binding = ts.createForOfBindingStatement(factory, node.initializer, value); + statements.push(ts.visitNode(binding, visitor, ts.isStatement)); var bodyLocation; var statementsLocation; - var statements = [ts.visitNode(binding, visitor, ts.isStatement)]; var statement = ts.visitIterationBody(node.statement, visitor, context); if (ts.isBlock(statement)) { ts.addRange(statements, statement.statements); @@ -98524,8 +99530,16 @@ var ts; else { statements.push(statement); } - return ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), + var body = ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), /*multiLine*/ true), bodyLocation), 48 /* EmitFlags.NoSourceMap */ | 384 /* EmitFlags.NoTokenSourceMaps */); + return factory.createBlock([ + iteratorValueStatement, + exitNonUserCodeStatement, + factory.createTryStatement(body, + /*catchClause*/ undefined, factory.createBlock([ + enterNonUserCodeStatement + ])) + ]); } function createDownlevelAwait(expression) { return enclosingFunctionFlags & 1 /* FunctionFlags.Generator */ @@ -98536,6 +99550,8 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isExpression); var iterator = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(expression) : factory.createTempVariable(/*recordTempVariable*/ undefined); var result = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(iterator) : factory.createTempVariable(/*recordTempVariable*/ undefined); + var nonUserCode = factory.createTempVariable(/*recordTempVariable*/ undefined); + var done = factory.createTempVariable(hoistVariableDeclaration); var errorRecord = factory.createUniqueName("e"); var catchVariable = factory.getGeneratedNameForNode(errorRecord); var returnMethod = factory.createTempVariable(/*recordTempVariable*/ undefined); @@ -98552,12 +99568,17 @@ var ts; callValues; var forStatement = ts.setEmitFlags(ts.setTextRange(factory.createForStatement( /*initializer*/ ts.setEmitFlags(ts.setTextRange(factory.createVariableDeclarationList([ + factory.createVariableDeclaration(nonUserCode, /*exclamationToken*/ undefined, /*type*/ undefined, factory.createTrue()), ts.setTextRange(factory.createVariableDeclaration(iterator, /*exclamationToken*/ undefined, /*type*/ undefined, initializer), node.expression), factory.createVariableDeclaration(result) ]), node.expression), 2097152 /* EmitFlags.NoHoisting */), - /*condition*/ factory.createComma(factory.createAssignment(result, createDownlevelAwait(callNext)), factory.createLogicalNot(getDone)), + /*condition*/ factory.inlineExpressions([ + factory.createAssignment(result, createDownlevelAwait(callNext)), + factory.createAssignment(done, getDone), + factory.createLogicalNot(done) + ]), /*incrementor*/ undefined, - /*statement*/ convertForOfStatementHead(node, getValue)), + /*statement*/ convertForOfStatementHead(node, getValue, nonUserCode)), /*location*/ node), 256 /* EmitFlags.NoTokenTrailingSourceMaps */); ts.setOriginalNode(forStatement, node); return factory.createTryStatement(factory.createBlock([ @@ -98569,7 +99590,7 @@ var ts; ]), 1 /* EmitFlags.SingleLine */)), factory.createBlock([ factory.createTryStatement( /*tryBlock*/ factory.createBlock([ - ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(result, factory.createLogicalNot(getDone)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), 1 /* EmitFlags.SingleLine */) + ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(factory.createLogicalNot(nonUserCode), factory.createLogicalNot(done)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), 1 /* EmitFlags.SingleLine */) ]), /*catchClause*/ undefined, /*finallyBlock*/ ts.setEmitFlags(factory.createBlock([ @@ -98725,7 +99746,7 @@ var ts; /*type*/ undefined, factory.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !!(hierarchyFacts & 1 /* HierarchyFacts.HasLexicalThis */))); // Minor optimization, emit `_super` helper to capture `super` access in an arrow. // This step isn't needed if we eventually transform this to ES5. - var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */ | 2048 /* NodeCheckFlags.AsyncMethodWithSuper */); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */); if (emitSuperHelpers) { enableSubstitutionForAsyncMethodsWithSuper(); var variableStatement = ts.createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties); @@ -98736,10 +99757,10 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var block = factory.updateBlock(node.body, statements); if (emitSuperHelpers && hasSuperElementAccess) { - if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); } - else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) { + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { ts.addEmitHelper(block, ts.asyncSuperHelper); } } @@ -98844,17 +99865,17 @@ var ts; enabledSubstitutions |= 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -98868,7 +99889,7 @@ var ts; // If we need to support substitutions for `super` in an async method, // we should track it here. if (enabledSubstitutions & 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) { - var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */); + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */); if (superContainerFlags !== enclosingSuperContainerFlags) { var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; enclosingSuperContainerFlags = superContainerFlags; @@ -98902,11 +99923,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -98938,14 +99959,14 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { - if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createIdentifier("_superIndex"), /*typeArguments*/ undefined, [argumentExpression]), "value"), location); } @@ -98974,7 +99995,7 @@ var ts; return node; } switch (node.kind) { - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -99006,25 +100027,25 @@ var ts; return node; } switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { var updated = visitNonOptionalCallExpression(node, /*captureThisArg*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (ts.isOptionalChain(node)) { var updated = visitOptionalExpression(node, /*captureThisArg*/ false, /*isDelete*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } return ts.visitEachChild(node, visitor, context); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) { return transformNullishCoalescingExpression(node); } return ts.visitEachChild(node, visitor, context); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return visitDeleteExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99066,7 +100087,7 @@ var ts; thisArg = expression; } } - expression = node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + expression = node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.updatePropertyAccessExpression(node, expression, ts.visitNode(node.name, visitor, ts.isIdentifier)) : factory.updateElementAccessExpression(node, expression, ts.visitNode(node.argumentExpression, visitor, ts.isExpression)); return thisArg ? factory.createSyntheticReferenceExpression(expression, thisArg) : expression; @@ -99089,10 +100110,10 @@ var ts; } function visitNonOptionalExpression(node, captureThisArg, isDelete) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); - case 208 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); + case 210 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); default: return ts.visitNode(node, visitor, ts.isExpression); } } @@ -99111,8 +100132,8 @@ var ts; for (var i = 0; i < chain.length; i++) { var segment = chain[i]; switch (segment.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (i === chain.length - 1 && captureThisArg) { if (!ts.isSimpleCopiableExpression(rightExpression)) { thisArg = factory.createTempVariable(hoistVariableDeclaration); @@ -99122,11 +100143,11 @@ var ts; thisArg = rightExpression; } } - rightExpression = segment.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + rightExpression = segment.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.createPropertyAccessExpression(rightExpression, ts.visitNode(segment.name, visitor, ts.isIdentifier)) : factory.createElementAccessExpression(rightExpression, ts.visitNode(segment.argumentExpression, visitor, ts.isExpression)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (i === 0 && leftThisArg) { if (!ts.isGeneratedIdentifier(leftThisArg)) { leftThisArg = factory.cloneNode(leftThisArg); @@ -99187,7 +100208,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryExpression = node; if (ts.isLogicalOrCoalescingAssignmentExpression(binaryExpression)) { return transformLogicalAssignment(binaryExpression); @@ -99356,13 +100377,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ false); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99372,13 +100393,13 @@ var ts; switch (node.kind) { case 11 /* SyntaxKind.JsxText */: return visitJsxText(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ true); default: return ts.Debug.failBadSyntaxKind(node); @@ -99559,7 +100580,7 @@ var ts; var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote); return ts.setTextRange(literal, node); } - if (node.kind === 288 /* SyntaxKind.JsxExpression */) { + if (node.kind === 291 /* SyntaxKind.JsxExpression */) { if (node.expression === undefined) { return factory.createTrue(); } @@ -99660,7 +100681,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 278 /* SyntaxKind.JsxElement */) { + if (node.kind === 281 /* SyntaxKind.JsxElement */) { return getTagName(node.openingElement); } else { @@ -99967,7 +100988,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -100192,7 +101213,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return (hierarchyFacts & 8192 /* HierarchyFacts.ConstructorWithCapturedSuper */) !== 0 - && node.kind === 247 /* SyntaxKind.ReturnStatement */ + && node.kind === 250 /* SyntaxKind.ReturnStatement */ && !node.expression; } function isOrMayContainReturnCompletion(node) { @@ -100246,65 +101267,65 @@ var ts; switch (node.kind) { case 124 /* SyntaxKind.StaticKeyword */: return undefined; // elide static keyword - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return visitArrowFunction(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); case 79 /* SyntaxKind.Identifier */: return visitIdentifier(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return visitVariableDeclarationList(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node, /*isFunctionBody*/ false); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitBreakOrContinueStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*outermostLabeledStatement*/ undefined); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return visitComputedPropertyName(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: @@ -100315,30 +101336,30 @@ var ts; return visitStringLiteral(node); case 8 /* SyntaxKind.NumericLiteral */: return visitNumericLiteral(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return visitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return visitSpreadElement(node); case 106 /* SyntaxKind.SuperKeyword */: return visitSuperKeyword(/*isExpressionOfCall*/ false); case 108 /* SyntaxKind.ThisKeyword */: return visitThisKeyword(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return visitMetaProperty(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -100414,11 +101435,13 @@ var ts; return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context); } function visitIdentifier(node) { - if (!convertedLoopState) { - return node; + if (convertedLoopState) { + if (resolver.isArgumentsLocalBinding(node)) { + return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments")); + } } - if (resolver.isArgumentsLocalBinding(node)) { - return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments")); + if (node.hasExtendedUnicodeEscape) { + return ts.setOriginalNode(ts.setTextRange(factory.createIdentifier(ts.unescapeLeadingUnderscores(node.escapedText)), node), node); } return node; } @@ -100428,14 +101451,14 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 246 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; + var jump = node.kind === 249 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; var label = node.label; if (!label) { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Jump.Break */; labelMarker = "break"; } @@ -100446,7 +101469,7 @@ var ts; } } else { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { labelMarker = "break-".concat(label.escapedText); setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(label), labelMarker); } @@ -100502,7 +101525,7 @@ var ts; statements.push(statement); // Add an `export default` statement for default exports (for `--target es5 --module es6`) if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - var exportStatement = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) + var exportStatement = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? factory.createExportDefault(factory.getLocalName(node)) : factory.createExternalModuleExport(factory.getLocalName(node)); ts.setOriginalNode(exportStatement, statement); @@ -100871,11 +101894,11 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (statement.kind === 250 /* SyntaxKind.ReturnStatement */) { return true; } // An if-statement with two covered branches is covered. - else if (statement.kind === 239 /* SyntaxKind.IfStatement */) { + else if (statement.kind === 242 /* SyntaxKind.IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && @@ -100883,7 +101906,7 @@ var ts; } } // A block is covered if it has a last statement which is covered. - else if (statement.kind === 235 /* SyntaxKind.Block */) { + else if (statement.kind === 238 /* SyntaxKind.Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -101083,7 +102106,7 @@ var ts; * @param node A node. */ function insertCaptureThisForNodeIfNeeded(statements, node) { - if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 216 /* SyntaxKind.ArrowFunction */) { insertCaptureThisForNode(statements, node, factory.createThis()); return true; } @@ -101117,22 +102140,22 @@ var ts; if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */) { var newTarget = void 0; switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return statements; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Methods and accessors cannot be constructors, so 'new.target' will // always return 'undefined'. newTarget = factory.createVoidZero(); break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Class constructors can only be called with `new`, so `this.constructor` // should be relatively safe to use. newTarget = factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), "constructor"); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: // Functions can be called or constructed, and may have a `this` due to // being a member or when calling an imported function via `other_1.f()`. newTarget = factory.createConditionalExpression(factory.createLogicalAnd(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), factory.createBinaryExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), 102 /* SyntaxKind.InstanceOfKeyword */, factory.getLocalName(node))), @@ -101167,21 +102190,21 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Constructors are handled in visitClassExpression/visitClassDeclaration break; default: @@ -101380,7 +102403,7 @@ var ts; : enterSubtree(32670 /* HierarchyFacts.FunctionExcludes */, 65 /* HierarchyFacts.FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) { + if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) { name = factory.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 98304 /* HierarchyFacts.FunctionSubtreeExcludes */, 0 /* HierarchyFacts.None */); @@ -101426,7 +102449,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 214 /* SyntaxKind.ArrowFunction */); + ts.Debug.assert(node.kind === 216 /* SyntaxKind.ArrowFunction */); // To align with the old emitter, we use a synthetic end position on the location // for the statement list we synthesize when we down-level an arrow function with // an expression function body. This prevents both comments and source maps from @@ -101733,14 +102756,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -101926,7 +102949,7 @@ var ts; var property = properties[i]; if ((property.transformFlags & 1048576 /* TransformFlags.ContainsYield */ && hierarchyFacts & 4 /* HierarchyFacts.AsyncFunctionBody */) - || (hasComputed = ts.Debug.checkDefined(property.name).kind === 162 /* SyntaxKind.ComputedPropertyName */)) { + || (hasComputed = ts.Debug.checkDefined(property.name).kind === 164 /* SyntaxKind.ComputedPropertyName */)) { numInitialProperties = i; break; } @@ -102042,11 +103065,11 @@ var ts; } function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); - case 243 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); - case 244 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); - case 240 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); - case 241 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); + case 245 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); + case 246 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); + case 247 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); + case 243 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); + case 244 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected"); } } @@ -102071,11 +103094,11 @@ var ts; function createConvertedLoopState(node) { var loopInitializer; switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer && initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -102491,20 +103514,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine)); } break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -102611,7 +103634,7 @@ var ts; var updated; var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { updated = factory.updateGetAccessorDeclaration(node, node.modifiers, node.name, parameters, node.type, body); } else { @@ -103071,13 +104094,13 @@ var ts; if ((enabledSubstitutions & 1 /* ES2015SubstitutionFlags.CapturedThis */) === 0) { enabledSubstitutions |= 1 /* ES2015SubstitutionFlags.CapturedThis */; context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(214 /* SyntaxKind.ArrowFunction */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(216 /* SyntaxKind.ArrowFunction */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); } } /** @@ -103118,10 +104141,10 @@ var ts; */ function isNameOfDeclarationWithCollidingName(node) { switch (node.parent.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return node.parent.name === node && resolver.isDeclarationWithCollidingName(node.parent); } @@ -103203,11 +104226,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 238 /* SyntaxKind.ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 241 /* SyntaxKind.ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -103215,7 +104238,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 227 /* SyntaxKind.SpreadElement */) { return false; } var expression = callArgument.expression; @@ -103241,15 +104264,15 @@ var ts; if (compilerOptions.jsx === 1 /* JsxEmit.Preserve */ || compilerOptions.jsx === 3 /* JsxEmit.ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(280 /* SyntaxKind.JsxOpeningElement */); - context.enableEmitNotification(281 /* SyntaxKind.JsxClosingElement */); - context.enableEmitNotification(279 /* SyntaxKind.JsxSelfClosingElement */); + context.enableEmitNotification(283 /* SyntaxKind.JsxOpeningElement */); + context.enableEmitNotification(284 /* SyntaxKind.JsxClosingElement */); + context.enableEmitNotification(282 /* SyntaxKind.JsxSelfClosingElement */); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(296 /* SyntaxKind.PropertyAssignment */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(299 /* SyntaxKind.PropertyAssignment */); return ts.chainBundle(context, transformSourceFile); /** * Transforms an ES5 source file to ES3. @@ -103268,9 +104291,9 @@ var ts; */ function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -103605,13 +104628,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -103624,24 +104647,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return visitBreakStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 1048576 /* TransformFlags.ContainsYield */) { @@ -103662,23 +104685,23 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return visitConditionalExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -103691,9 +104714,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -103900,7 +104923,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // [source] // a.b = yield; // @@ -103912,7 +104935,7 @@ var ts; // _a.b = %sent%; target = factory.updatePropertyAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // [source] // a[b] = yield; // @@ -104306,35 +105329,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return transformAndEmitBlock(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return transformAndEmitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return transformAndEmitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return transformAndEmitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return transformAndEmitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return transformAndEmitForInStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return transformAndEmitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return transformAndEmitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return transformAndEmitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return transformAndEmitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return transformAndEmitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -104565,7 +105588,6 @@ var ts; return node; } function transformAndEmitForInStatement(node) { - // TODO(rbuckton): Source map locations if (containsYield(node)) { // [source] // for (var p in o) { @@ -104573,34 +105595,41 @@ var ts; // } // // [intermediate] - // .local _a, _b, _i - // _a = []; - // for (_b in o) _a.push(_b); + // .local _b, _a, _c, _i + // _b = []; + // _a = o; + // for (_c in _a) _b.push(_c); // _i = 0; // .loop incrementLabel, endLoopLabel // .mark conditionLabel - // .brfalse endLoopLabel, (_i < _a.length) - // p = _a[_i]; + // .brfalse endLoopLabel, (_i < _b.length) + // _c = _b[_i]; + // .brfalse incrementLabel, (_c in _a) + // p = _c; // /*body*/ // .mark incrementLabel - // _b++; + // _c++; // .br conditionLabel // .endloop // .mark endLoopLabel - var keysArray = declareLocal(); // _a - var key = declareLocal(); // _b + var obj = declareLocal(); // _a + var keysArray = declareLocal(); // _b + var key = declareLocal(); // _c var keysIndex = factory.createLoopVariable(); // _i var initializer = node.initializer; hoistVariableDeclaration(keysIndex); + emitAssignment(obj, ts.visitNode(node.expression, visitor, ts.isExpression)); emitAssignment(keysArray, factory.createArrayLiteralExpression()); - emitStatement(factory.createForInStatement(key, ts.visitNode(node.expression, visitor, ts.isExpression), factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"), + emitStatement(factory.createForInStatement(key, obj, factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"), /*typeArguments*/ undefined, [key])))); emitAssignment(keysIndex, factory.createNumericLiteral(0)); var conditionLabel = defineLabel(); var incrementLabel = defineLabel(); - var endLabel = beginLoopBlock(incrementLabel); + var endLoopLabel = beginLoopBlock(incrementLabel); markLabel(conditionLabel); - emitBreakWhenFalse(endLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length"))); + emitBreakWhenFalse(endLoopLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length"))); + emitAssignment(key, factory.createElementAccessExpression(keysArray, keysIndex)); + emitBreakWhenFalse(incrementLabel, factory.createBinaryExpression(key, 101 /* SyntaxKind.InKeyword */, obj)); var variable = void 0; if (ts.isVariableDeclarationList(initializer)) { for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { @@ -104613,7 +105642,7 @@ var ts; variable = ts.visitNode(initializer, visitor, ts.isExpression); ts.Debug.assert(ts.isLeftHandSideExpression(variable)); } - emitAssignment(variable, factory.createElementAccessExpression(keysArray, keysIndex)); + emitAssignment(variable, key); transformAndEmitEmbeddedStatement(node.statement); markLabel(incrementLabel); emitStatement(factory.createExpressionStatement(factory.createPostfixIncrement(keysIndex))); @@ -104764,7 +105793,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -104777,7 +105806,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -105937,12 +106966,12 @@ var ts; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. - context.enableSubstitution(210 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(212 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. @@ -106270,23 +107299,23 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -106299,26 +107328,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node) && currentSourceFile.impliedNodeFormat === undefined) { return visitImportCallExpression(node); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -106334,24 +107363,24 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var elem = _a[_i]; switch (elem.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (destructuringNeedsFlattening(elem.initializer)) { return true; } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (destructuringNeedsFlattening(elem.name)) { return true; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: if (destructuringNeedsFlattening(elem.expression)) { return true; } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return false; default: ts.Debug.assertNever(elem, "Unhandled object member kind"); } @@ -106454,7 +107483,7 @@ var ts; return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis); case ts.ModuleKind.CommonJS: default: - return createImportCallExpressionCommonJS(argument, containsLexicalThis); + return createImportCallExpressionCommonJS(argument); } } function createImportCallExpressionUMD(arg, containsLexicalThis) { @@ -106477,7 +107506,7 @@ var ts; return factory.createConditionalExpression( /*condition*/ factory.createIdentifier("__syncRequire"), /*questionToken*/ undefined, - /*whenTrue*/ createImportCallExpressionCommonJS(arg, containsLexicalThis), + /*whenTrue*/ createImportCallExpressionCommonJS(arg), /*colonToken*/ undefined, /*whenFalse*/ createImportCallExpressionAMD(argClone, containsLexicalThis)); } @@ -106486,7 +107515,7 @@ var ts; return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression( /*condition*/ factory.createIdentifier("__syncRequire"), /*questionToken*/ undefined, - /*whenTrue*/ createImportCallExpressionCommonJS(temp, containsLexicalThis), + /*whenTrue*/ createImportCallExpressionCommonJS(temp, /* isInlineable */ true), /*colonToken*/ undefined, /*whenFalse*/ createImportCallExpressionAMD(temp, containsLexicalThis))); } @@ -106536,14 +107565,20 @@ var ts; } return promise; } - function createImportCallExpressionCommonJS(arg, containsLexicalThis) { - // import("./blah") + function createImportCallExpressionCommonJS(arg, isInlineable) { + // import(x) // emit as - // Promise.resolve().then(function () { return require(x); }) /*CommonJs Require*/ + // var _a; + // (_a = x, Promise.resolve().then(() => require(_a)) /*CommonJs Require*/ // We have to wrap require in then callback so that require is done in asynchronously // if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately - var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []); - var requireCall = factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []); + // If the arg is not inlineable, we have to evaluate it in the current scope with a temp var + var temp = arg && !ts.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined; + var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), + /*typeArguments*/ undefined, + /*argumentsArray*/ []); + var requireCall = factory.createCallExpression(factory.createIdentifier("require"), + /*typeArguments*/ undefined, temp ? [temp] : arg ? [arg] : []); if (ts.getESModuleInterop(compilerOptions)) { requireCall = emitHelpers().createImportStarHelper(requireCall); } @@ -106564,14 +107599,9 @@ var ts; /*typeParameters*/ undefined, /*parameters*/ [], /*type*/ undefined, factory.createBlock([factory.createReturnStatement(requireCall)])); - // if there is a lexical 'this' in the import call arguments, ensure we indicate - // that this new function expression indicates it captures 'this' so that the - // es2015 transformer will properly substitute 'this' with '_this'. - if (containsLexicalThis) { - ts.setEmitFlags(func, 8 /* EmitFlags.CapturesThis */); - } } - return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]); + var downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]); + return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]); } function getHelperExpressionForExport(node, innerExpr) { if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864 /* EmitFlags.NeverApplyImportHelper */) { @@ -106937,7 +107967,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -106992,10 +108022,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding, /* liveBinding */ true); @@ -107079,7 +108109,7 @@ var ts; return statements; } if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); statements = appendExportStatement(statements, exportName, factory.getLocalName(decl), /*location*/ decl); } if (decl.name) { @@ -107208,7 +108238,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; previousOnEmitNode(hint, node, emitCallback); @@ -107270,11 +108300,11 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return substituteTaggedTemplateExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); } return node; @@ -107318,7 +108348,7 @@ var ts; } else if (!(ts.isGeneratedIdentifier(node) && !(node.autoGenerateFlags & 64 /* GeneratedIdentifierFlags.AllowNameSubstitution */)) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(node)), /*location*/ node); } @@ -107408,10 +108438,10 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(231 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(233 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var exportFunctionsMap = []; // The export function associated with a source file. @@ -107601,7 +108631,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var exportStarFunction = addExportStarIfNeeded(statements); // TODO: GH#18217 var modifiers = node.transformFlags & 2097152 /* TransformFlags.ContainsAwait */ ? - factory.createModifiersFromModifierFlags(256 /* ModifierFlags.Async */) : + factory.createModifiersFromModifierFlags(512 /* ModifierFlags.Async */) : undefined; var moduleObject = factory.createObjectLiteralExpression([ factory.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), @@ -107635,7 +108665,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 272 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 275 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -107724,19 +108754,26 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(factory, entry, currentSourceFile); // TODO: GH#18217 switch (entry.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName))); + if (ts.hasSyntacticModifier(entry, 1 /* ModifierFlags.Export */)) { + statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction, + /*typeArguments*/ undefined, [ + factory.createStringLiteral(ts.idText(importVariableName)), + parameterName, + ]))); + } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { if (ts.isNamedExports(entry.exportClause)) { @@ -107795,13 +108832,13 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); default: return topLevelNestedVisitor(node); @@ -107980,7 +109017,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 2097152 /* EmitFlags.NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 305 /* SyntaxKind.SourceFile */ + && (enclosingBlockScopedContainer.kind === 308 /* SyntaxKind.SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* NodeFlags.BlockScoped */) === 0); } /** @@ -108044,7 +109081,7 @@ var ts; // // To balance the declaration, we defer the exports of the elided variable // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasSyntacticModifier(node.original, 1 /* ModifierFlags.Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -108106,10 +109143,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -108204,7 +109241,7 @@ var ts; } var excludeName; if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; statements = appendExportStatement(statements, exportName, factory.getLocalName(decl)); excludeName = ts.getTextOfIdentifierOrLiteral(exportName); } @@ -108289,43 +109326,43 @@ var ts; */ function topLevelNestedVisitor(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ true); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return visitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return visitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return visitDefaultClause(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return visitTryStatement(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -108511,26 +109548,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node)) { return visitImportCallExpression(node); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -108610,7 +109647,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 305 /* SyntaxKind.SourceFile */; + return container !== undefined && container.kind === 308 /* SyntaxKind.SourceFile */; } else { return false; @@ -108688,7 +109725,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -108738,7 +109775,7 @@ var ts; */ function substituteUnspecified(node) { switch (node.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return substituteShorthandPropertyAssignment(node); } return node; @@ -108775,9 +109812,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return substituteMetaProperty(node); } return node; @@ -108867,7 +109904,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { exportedNames = ts.append(exportedNames, factory.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -108910,7 +109947,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); context.enableSubstitution(79 /* SyntaxKind.Identifier */); var helperNameSubstitutions; var currentSourceFile; @@ -108950,14 +109987,14 @@ var ts; } function visitor(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // Though an error in es2020 modules, in node-flavor es2020 modules, we can helpfully transform this to a synthetic `require` call // To give easy access to a synchronous `require` in node-flavor esm. We do the transform even in scenarios where we error, but `import.meta.url` // is available, just because the output is reasonable for a node-like runtime. return ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.Node16 ? visitImportEqualsDeclaration(node) : undefined; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDecl = node; return visitExportDeclaration(exportDecl); } @@ -109114,8 +110151,8 @@ var ts; var cjsOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(305 /* SyntaxKind.SourceFile */); - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableSubstitution(308 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); var currentSourceFile; return transformSourceFileOrBundle; function onSubstituteNode(hint, node) { @@ -109162,7 +110199,7 @@ var ts; return result; } function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -109222,7 +110259,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109251,7 +110288,7 @@ var ts; ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109298,7 +110335,7 @@ var ts; return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: ".concat(ts.Debug.formatSyntaxKind(node.kind))); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109307,8 +110344,8 @@ var ts; } // This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit // The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all. - else if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 166 /* SyntaxKind.PropertySignature */ || - (node.kind === 164 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { + else if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 168 /* SyntaxKind.PropertySignature */ || + (node.kind === 166 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { // TODO(jfreeman): Deal with computed properties in error reporting. if (ts.isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? @@ -109317,7 +110354,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 166 /* SyntaxKind.Parameter */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109342,7 +110379,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Getters can infer the return type from the returned expression, but setters cannot, so the // "_from_external_module_1_but_cannot_be_named" case cannot occur. if (ts.isStatic(node)) { @@ -109381,26 +110418,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109408,7 +110445,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109422,7 +110459,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109447,30 +110484,30 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109478,7 +110515,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109491,15 +110528,15 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 256 /* SyntaxKind.FunctionDeclaration */: - case 179 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109513,39 +110550,39 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1; break; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 179 /* SyntaxKind.FunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -109611,7 +110648,7 @@ var ts; } function isInternalDeclaration(node, currentSourceFile) { var parseTreeNode = ts.getParseTreeNode(node); - if (parseTreeNode && parseTreeNode.kind === 164 /* SyntaxKind.Parameter */) { + if (parseTreeNode && parseTreeNode.kind === 166 /* SyntaxKind.Parameter */) { var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode); var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined; var text = currentSourceFile.text; @@ -109787,7 +110824,7 @@ var ts; var _a; var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; }); var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; }); - if (augmentingDeclarations) { + if (primaryDeclaration && augmentingDeclarations) { for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) { var augmentations = augmentingDeclarations_1[_i]; context.addDiagnostic(ts.addRelatedInfo(ts.createDiagnosticForNode(augmentations, ts.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts.createDiagnosticForNode(primaryDeclaration, ts.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file))); @@ -109817,10 +110854,10 @@ var ts; return result; } function transformRoot(node) { - if (node.kind === 305 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { + if (node.kind === 308 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { return node; } - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { isBundledEmit = true; refs = new ts.Map(); libs = new ts.Map(); @@ -109843,14 +110880,14 @@ var ts; resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) needsDeclare = false; var statements = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile, /*bundled*/ true)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); + var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); return newFile; } needsDeclare = true; var updated = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); return factory.updateSourceFile(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); }), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal); hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib; collectReferences(sourceFile, refs); @@ -109991,7 +111028,7 @@ var ts; return name; } else { - if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { return factory.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -109999,7 +111036,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (elem.kind === 229 /* SyntaxKind.OmittedExpression */) { return elem; } if (elem.propertyName && ts.isIdentifier(elem.propertyName) && ts.isIdentifier(elem.name) && !elem.symbol.isReferenced) { @@ -110041,19 +111078,19 @@ var ts; // Literal const declarations will have an initializer ensured rather than a type return; } - var shouldUseResolverType = node.kind === 164 /* SyntaxKind.Parameter */ && + var shouldUseResolverType = node.kind === 166 /* SyntaxKind.Parameter */ && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); if (type && !shouldUseResolverType) { return ts.visitNode(type, visitDeclarationSubtree); } if (!ts.getParseTreeNode(node)) { - return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now // (The inferred type here will be void, but the old declaration emitter printed `any`, so this replicates that) - return factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } errorNameNode = node.name; var oldDiag; @@ -110061,12 +111098,12 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } - if (node.kind === 164 /* SyntaxKind.Parameter */ - || node.kind === 167 /* SyntaxKind.PropertyDeclaration */ - || node.kind === 166 /* SyntaxKind.PropertySignature */) { + if (node.kind === 166 /* SyntaxKind.Parameter */ + || node.kind === 169 /* SyntaxKind.PropertyDeclaration */ + || node.kind === 168 /* SyntaxKind.PropertySignature */) { if (ts.isPropertySignature(node) || !node.initializer) return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType)); return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); @@ -110077,28 +111114,28 @@ var ts; if (!suppressNewDiagnosticContexts) { getSymbolAccessibilityDiagnostic = oldDiag; } - return returnValue || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return returnValue || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return !resolver.isDeclarationVisible(node); // The following should be doing their own visibility checks based on filtering their members - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !getBindingNameVisible(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; } return false; @@ -110187,7 +111224,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return undefined; // TODO: GH#18217 - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 200 /* SyntaxKind.ImportType */); + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 202 /* SyntaxKind.ImportType */); if (ts.isStringLiteralLike(input)) { if (isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); @@ -110207,7 +111244,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (decl.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // Rewrite external module names if necessary var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return factory.updateImportEqualsDeclaration(decl, decl.modifiers, decl.isTypeOnly, decl.name, factory.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))); @@ -110232,7 +111269,7 @@ var ts; return visibleDefaultBinding && factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); } - if (decl.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (decl.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // Namespace import (optionally with visible default) var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined; return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined; @@ -110335,7 +111372,7 @@ var ts; // We'd see a TDZ violation at runtime var canProduceDiagnostic = ts.canProduceDiagnostics(input); var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 182 /* SyntaxKind.TypeLiteral */ || input.kind === 195 /* SyntaxKind.MappedType */) && input.parent.kind !== 259 /* SyntaxKind.TypeAliasDeclaration */); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 184 /* SyntaxKind.TypeLiteral */ || input.kind === 197 /* SyntaxKind.MappedType */) && input.parent.kind !== 262 /* SyntaxKind.TypeAliasDeclaration */); // Emit methods which are private as properties with no type information if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) { if (ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)) { @@ -110356,28 +111393,28 @@ var ts; } if (isProcessedComponent(input)) { switch (input.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments)); } - case 178 /* SyntaxKind.TypeReference */: { + case 180 /* SyntaxKind.TypeReference */: { checkEntityNameVisibility(input.typeName, enclosingDeclaration); var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); } - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return cleanup(factory.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { // A constructor declaration may not have a type annotation var ctor = factory.createConstructorDeclaration( /*modifiers*/ ensureModifiers(input), updateParamsList(input, input.parameters, 0 /* ModifierFlags.None */), /*body*/ undefined); return cleanup(ctor); } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110386,7 +111423,7 @@ var ts; /*body*/ undefined); return cleanup(sig); } - case 172 /* SyntaxKind.GetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110394,36 +111431,36 @@ var ts; return cleanup(factory.updateGetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), ensureType(input, accessorType), /*body*/ undefined)); } - case 173 /* SyntaxKind.SetAccessor */: { + case 175 /* SyntaxKind.SetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateSetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), /*body*/ undefined)); } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertyDeclaration(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type), ensureNoInitializer(input))); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type))); - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateMethodSignature(input, ensureModifiers(input), input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { return cleanup(factory.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 176 /* SyntaxKind.IndexSignature */: { - return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */))); + case 178 /* SyntaxKind.IndexSignature */: { + return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */))); } - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -110431,13 +111468,13 @@ var ts; suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types return cleanup(factory.updateVariableDeclaration(input, input.name, /*exclamationToken*/ undefined, ensureType(input, input.type), ensureNoInitializer(input))); } - case 163 /* SyntaxKind.TypeParameter */: { + case 165 /* SyntaxKind.TypeParameter */: { if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) { return cleanup(factory.updateTypeParameterDeclaration(input, input.modifiers, input.name, /*constraint*/ undefined, /*defaultType*/ undefined)); } return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context)); } - case 189 /* SyntaxKind.ConditionalType */: { + case 191 /* SyntaxKind.ConditionalType */: { // We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration // just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type. var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree); @@ -110449,13 +111486,13 @@ var ts; var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree); return cleanup(factory.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); } - case 179 /* SyntaxKind.FunctionType */: { + case 181 /* SyntaxKind.FunctionType */: { return cleanup(factory.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 180 /* SyntaxKind.ConstructorType */: { + case 182 /* SyntaxKind.ConstructorType */: { return cleanup(factory.updateConstructorTypeNode(input, ensureModifiers(input), ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 200 /* SyntaxKind.ImportType */: { + case 202 /* SyntaxKind.ImportType */: { if (!ts.isLiteralImportTypeNode(input)) return cleanup(input); return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); @@ -110487,7 +111524,7 @@ var ts; } } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); + return node.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); } function visitDeclarationStatements(input) { if (!isPreservedDeclarationStatement(input)) { @@ -110497,7 +111534,7 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -110506,7 +111543,7 @@ var ts; // Rewrite external module names if necessary return factory.updateExportDeclaration(input, input.modifiers, input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), ts.getResolutionModeOverrideForClause(input.assertClause) ? input.assertClause : undefined); } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { // Always visible if the parent node isn't dropped for being not visible if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; @@ -110524,7 +111561,7 @@ var ts; errorFallbackNode = input; var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); errorFallbackNode = undefined; - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); preserveJsDoc(statement, input); ts.removeAllComments(input); return [statement, factory.updateExportAssignment(input, input.modifiers, newId)]; @@ -110537,12 +111574,12 @@ var ts; return input; } function stripExportModifiers(statement) { - if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 512 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { + if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 1024 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { // `export import` statements should remain as-is, as imports are _not_ implicitly exported in an ambient namespace // Likewise, `export default` classes and the like and just be `default`, so we preserve their `export` modifiers, too return statement; } - var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (257023 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); + var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (258047 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); return factory.updateModifiers(statement, modifiers); } function transformTopLevelDeclaration(input) { @@ -110553,10 +111590,10 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { return transformImportEqualsDeclaration(input); } - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { return transformImportDeclaration(input); } } @@ -110577,12 +111614,16 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 259 /* SyntaxKind.TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all - return cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 258 /* SyntaxKind.InterfaceDeclaration */: { + case 262 /* SyntaxKind.TypeAliasDeclaration */: { + needsDeclare = false; + var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); + needsDeclare = previousNeedsDeclare; + return clean; + } + case 261 /* SyntaxKind.InterfaceDeclaration */: { return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { // Generators lose their generator-ness, excepting their return type var clean = cleanup(factory.updateFunctionDeclaration(input, ensureModifiers(input), /*asteriskToken*/ undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), @@ -110623,10 +111664,10 @@ var ts; })))); } var namespaceDecl = factory.createModuleDeclaration(ensureModifiers(input), input.name, factory.createModuleBlock(declarations), 16 /* NodeFlags.Namespace */); - if (!ts.hasEffectiveModifier(clean, 512 /* ModifierFlags.Default */)) { + if (!ts.hasEffectiveModifier(clean, 1024 /* ModifierFlags.Default */)) { return [clean, namespaceDecl]; } - var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~513 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); + var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~1025 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); var cleanDeclaration = factory.updateFunctionDeclaration(clean, modifiers, /*asteriskToken*/ undefined, clean.name, clean.typeParameters, clean.parameters, clean.type, /*body*/ undefined); @@ -110644,10 +111685,10 @@ var ts; return clean; } } - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 264 /* SyntaxKind.ModuleDeclaration */: { needsDeclare = false; var inner = input.body; - if (inner && inner.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (inner && inner.kind === 265 /* SyntaxKind.ModuleBlock */) { var oldNeedsScopeFix = needsScopeFixMarker; var oldHasScopeFix = resultHasScopeMarker; resultHasScopeMarker = false; @@ -110688,7 +111729,7 @@ var ts; return cleanup(factory.updateModuleDeclaration(input, mods, input.name, body)); } } - case 257 /* SyntaxKind.ClassDeclaration */: { + case 260 /* SyntaxKind.ClassDeclaration */: { errorNameNode = input.name; errorFallbackNode = input; var modifiers = factory.createNodeArray(ensureModifiers(input)); @@ -110750,7 +111791,7 @@ var ts; typeName: input.name }); }; var varDecl = factory.createVariableDeclaration(newId_1, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); var heritageClauses = factory.createNodeArray(ts.map(input.heritageClauses, function (clause) { if (clause.token === 94 /* SyntaxKind.ExtendsKeyword */) { var oldDiag_2 = getSymbolAccessibilityDiagnostic; @@ -110768,10 +111809,10 @@ var ts; return cleanup(factory.updateClassDeclaration(input, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { return cleanup(transformVariableStatement(input)); } - case 260 /* SyntaxKind.EnumDeclaration */: { + case 263 /* SyntaxKind.EnumDeclaration */: { return cleanup(factory.updateEnumDeclaration(input, factory.createNodeArray(ensureModifiers(input)), input.name, factory.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -110790,7 +111831,7 @@ var ts; if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - if (input.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (input.kind === 264 /* SyntaxKind.ModuleDeclaration */) { needsDeclare = previousNeedsDeclare; } if (node === input) { @@ -110813,7 +111854,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (e.kind === 229 /* SyntaxKind.OmittedExpression */) { return; } if (e.name) { @@ -110861,9 +111902,9 @@ var ts; return factory.createModifiersFromModifierFlags(newFlags); } function ensureModifierFlags(node) { - var mask = 257023 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 256 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files + var mask = 258047 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 512 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* ModifierFlags.Ambient */ : 0 /* ModifierFlags.None */; - var parentIsFile = node.parent.kind === 305 /* SyntaxKind.SourceFile */; + var parentIsFile = node.parent.kind === 308 /* SyntaxKind.SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= 2 /* ModifierFlags.Ambient */; additions = 0 /* ModifierFlags.None */; @@ -110892,7 +111933,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return true; } return false; @@ -110902,22 +111943,22 @@ var ts; return ts.factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); } function maskModifierFlags(node, modifierMask, modifierAdditions) { - if (modifierMask === void 0) { modifierMask = 257023 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } + if (modifierMask === void 0) { modifierMask = 258047 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } if (modifierAdditions === void 0) { modifierAdditions = 0 /* ModifierFlags.None */; } var flags = (ts.getEffectiveModifierFlags(node) & modifierMask) | modifierAdditions; - if (flags & 512 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { + if (flags & 1024 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { // A non-exported default is a nonsequitor - we usually try to remove all export modifiers // from statements in ambient declarations; but a default export must retain its export modifier to be syntactically valid flags ^= 1 /* ModifierFlags.Export */; } - if (flags & 512 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { + if (flags & 1024 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { flags ^= 2 /* ModifierFlags.Ambient */; // `declare` is never required alongside `default` (and would be an error if printed) } return flags; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 172 /* SyntaxKind.GetAccessor */ + return accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -110926,52 +111967,52 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return !ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */); - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } return false; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return true; } return false; } function isProcessedComponent(node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 254 /* SyntaxKind.VariableDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: - case 189 /* SyntaxKind.ConditionalType */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 200 /* SyntaxKind.ImportType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 191 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 202 /* SyntaxKind.ImportType */: return true; } return false; @@ -111111,7 +112152,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, factory, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(355 /* SyntaxKind.Count */); + var enabledSyntaxKindFeatures = new Array(358 /* SyntaxKind.Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentStatements; @@ -111193,7 +112234,7 @@ var ts; var transformed = []; for (var _a = 0, nodes_3 = nodes; _a < nodes_3.length; _a++) { var node = nodes_3[_a]; - ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 305 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); + ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 308 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); transformed.push((allowDtsFiles ? transformation : transformRoot)(node)); ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop(); } @@ -111599,7 +112640,7 @@ var ts; /*@internal*/ function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 306 /* SyntaxKind.Bundle */) { + if (sourceFile.kind === 309 /* SyntaxKind.Bundle */) { return getOutputPathsForBundle(options, forceDtsPaths); } else { @@ -111968,8 +113009,8 @@ var ts; } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) { var sourceFileOrBundle = transform.transformed[0]; - var bundle = sourceFileOrBundle.kind === 306 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 309 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; var sourceMapGenerator; if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) { @@ -112019,7 +113060,7 @@ var ts; } function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) { return (mapOptions.sourceMap || mapOptions.inlineSourceMap) - && (sourceFileOrBundle.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); + && (sourceFileOrBundle.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); } function getSourceRoot(mapOptions) { // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the @@ -112082,8 +113123,8 @@ var ts; } ts.getBuildInfoText = getBuildInfoText; /*@internal*/ - function getBuildInfo(buildInfoText) { - return JSON.parse(buildInfoText); + function getBuildInfo(buildInfoFile, buildInfoText) { + return ts.readJsonOrUndefined(buildInfoFile, buildInfoText); } ts.getBuildInfo = getBuildInfo; /*@internal*/ @@ -112161,17 +113202,16 @@ var ts; var buildInfo; if (host.getBuildInfo) { // If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo - var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); - if (!hostBuildInfo) - return buildInfoPath; - buildInfo = hostBuildInfo; + buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); } else { var buildInfoText = host.readFile(buildInfoPath); if (!buildInfoText) return buildInfoPath; - buildInfo = getBuildInfo(buildInfoText); + buildInfo = getBuildInfo(buildInfoPath, buildInfoText); } + if (!buildInfo) + return buildInfoPath; if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts)) return buildInfoPath; var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath)); @@ -112297,6 +113337,10 @@ var ts; var nodeIdToGeneratedName; // Map of generated names for specific nodes. var autoGeneratedIdToGeneratedName; // Map of generated names for temp and loop variables. var generatedNames; // Set of names generated by the NameGenerator. + var formattedNameTempFlagsStack; + var formattedNameTempFlags; + var privateNameTempFlagsStack; // Stack of enclosing name generation scopes. + var privateNameTempFlags; // TempFlags for the current name generation scope. var tempFlagsStack; // Stack of enclosing name generation scopes. var tempFlags; // TempFlags for the current name generation scope. var reservedNamesStack; // Stack of TempFlags reserved in enclosing name generation scopes. @@ -112362,9 +113406,9 @@ var ts; break; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: return printFile(node); - case 306 /* SyntaxKind.Bundle */: return printBundle(node); - case 307 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); + case 308 /* SyntaxKind.SourceFile */: return printFile(node); + case 309 /* SyntaxKind.Bundle */: return printBundle(node); + case 310 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -112555,6 +113599,10 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNames = new ts.Set(); + formattedNameTempFlagsStack = []; + formattedNameTempFlags = new ts.Map(); + privateNameTempFlagsStack = []; + privateNameTempFlags = 0 /* TempFlags.Auto */; tempFlagsStack = []; tempFlags = 0 /* TempFlags.Auto */; reservedNamesStack = []; @@ -112698,315 +113746,315 @@ var ts; return emitPrivateIdentifier(node); // Parse tree nodes // Names - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return emitQualifiedName(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return emitComputedPropertyName(node); // Signature elements - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return emitTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return emitParameter(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return emitDecorator(node); // Type members - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return emitPropertySignature(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return emitPropertyDeclaration(node); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return emitMethodSignature(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return emitMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return emitClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return emitConstructor(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return emitAccessorDeclaration(node); - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return emitCallSignature(node); - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return emitConstructSignature(node); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return emitIndexSignature(node); // Types - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return emitTypePredicate(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return emitTypeReference(node); - case 179 /* SyntaxKind.FunctionType */: + case 181 /* SyntaxKind.FunctionType */: return emitFunctionType(node); - case 180 /* SyntaxKind.ConstructorType */: + case 182 /* SyntaxKind.ConstructorType */: return emitConstructorType(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return emitTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return emitTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return emitArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return emitTupleType(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return emitOptionalType(node); // SyntaxKind.RestType is handled below - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return emitUnionType(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return emitIntersectionType(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return emitConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return emitInferType(node); - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return emitParenthesizedType(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return emitThisType(); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return emitTypeOperator(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return emitIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return emitMappedType(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return emitLiteralType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return emitNamedTupleMember(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return emitTemplateType(node); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return emitTemplateTypeSpan(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return emitImportTypeNode(node); // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return emitBindingElement(node); // Misc - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return emitTemplateSpan(node); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return emitBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return emitVariableStatement(node); - case 236 /* SyntaxKind.EmptyStatement */: + case 239 /* SyntaxKind.EmptyStatement */: return emitEmptyStatement(/*isEmbeddedStatement*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return emitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return emitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return emitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return emitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return emitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return emitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return emitForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return emitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return emitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return emitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return emitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return emitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return emitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return emitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return emitTryStatement(node); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return emitVariableDeclaration(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return emitVariableDeclarationList(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return emitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return emitClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return emitEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return emitModuleDeclaration(node); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return emitModuleBlock(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return emitCaseBlock(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return emitNamespaceExportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return emitImportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return emitImportClause(node); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return emitNamespaceImport(node); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return emitNamespaceExport(node); - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: return emitNamedImports(node); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return emitImportSpecifier(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return emitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return emitExportDeclaration(node); - case 273 /* SyntaxKind.NamedExports */: + case 276 /* SyntaxKind.NamedExports */: return emitNamedExports(node); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return emitExportSpecifier(node); - case 293 /* SyntaxKind.AssertClause */: + case 296 /* SyntaxKind.AssertClause */: return emitAssertClause(node); - case 294 /* SyntaxKind.AssertEntry */: + case 297 /* SyntaxKind.AssertEntry */: return emitAssertEntry(node); - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return; // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 11 /* SyntaxKind.JsxText */: return emitJsxText(node); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: return emitJsxOpeningElementOrFragment(node); - case 281 /* SyntaxKind.JsxClosingElement */: - case 284 /* SyntaxKind.JsxClosingFragment */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 287 /* SyntaxKind.JsxClosingFragment */: return emitJsxClosingElementOrFragment(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return emitJsxAttribute(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return emitJsxAttributes(node); - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return emitJsxExpression(node); // Clauses - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return emitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return emitDefaultClause(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return emitHeritageClause(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return emitCatchClause(node); // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return emitPropertyAssignment(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return emitEnumMember(node); // Unparsed - case 300 /* SyntaxKind.UnparsedPrologue */: + case 303 /* SyntaxKind.UnparsedPrologue */: return writeUnparsedNode(node); - case 307 /* SyntaxKind.UnparsedSource */: - case 301 /* SyntaxKind.UnparsedPrepend */: + case 310 /* SyntaxKind.UnparsedSource */: + case 304 /* SyntaxKind.UnparsedPrepend */: return emitUnparsedSourceOrPrepend(node); - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return emitUnparsedTextLike(node); - case 304 /* SyntaxKind.UnparsedSyntheticReference */: + case 307 /* SyntaxKind.UnparsedSyntheticReference */: return emitUnparsedSyntheticReference(node); // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return emitSourceFile(node); - case 306 /* SyntaxKind.Bundle */: + case 309 /* SyntaxKind.Bundle */: return ts.Debug.fail("Bundles should be printed using printBundle"); // SyntaxKind.UnparsedSource (handled above) - case 308 /* SyntaxKind.InputFiles */: + case 311 /* SyntaxKind.InputFiles */: return ts.Debug.fail("InputFiles should not be printed"); // JSDoc nodes (only used in codefixes currently) - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return emitJSDocTypeExpression(node); - case 310 /* SyntaxKind.JSDocNameReference */: + case 313 /* SyntaxKind.JSDocNameReference */: return emitJSDocNameReference(node); - case 312 /* SyntaxKind.JSDocAllType */: + case 315 /* SyntaxKind.JSDocAllType */: return writePunctuation("*"); - case 313 /* SyntaxKind.JSDocUnknownType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return writePunctuation("?"); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return emitJSDocNullableType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return emitJSDocOptionalType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return emitJSDocFunctionType(node); - case 186 /* SyntaxKind.RestType */: - case 318 /* SyntaxKind.JSDocVariadicType */: + case 188 /* SyntaxKind.RestType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return emitRestOrJSDocVariadicType(node); - case 319 /* SyntaxKind.JSDocNamepathType */: + case 322 /* SyntaxKind.JSDocNamepathType */: return; - case 320 /* SyntaxKind.JSDoc */: + case 323 /* SyntaxKind.JSDoc */: return emitJSDoc(node); - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: return emitJSDocTypeLiteral(node); - case 323 /* SyntaxKind.JSDocSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return emitJSDocSignature(node); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 337 /* SyntaxKind.JSDocOverrideTag */: + case 330 /* SyntaxKind.JSDocTag */: + case 335 /* SyntaxKind.JSDocClassTag */: + case 340 /* SyntaxKind.JSDocOverrideTag */: return emitJSDocSimpleTag(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return emitJSDocHeritageTag(node); - case 330 /* SyntaxKind.JSDocAuthorTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: + case 333 /* SyntaxKind.JSDocAuthorTag */: + case 334 /* SyntaxKind.JSDocDeprecatedTag */: return; // SyntaxKind.JSDocClassTag (see JSDocTag, above) - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 339 /* SyntaxKind.JSDocReadonlyTag */: return; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return emitJSDocCallbackTag(node); // SyntaxKind.JSDocEnumTag (see below) - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return emitJSDocPropertyLikeTag(node); - case 339 /* SyntaxKind.JSDocEnumTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return emitJSDocSimpleTypedTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return emitJSDocTemplateTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return emitJSDocTypedefTag(node); - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: return emitJSDocSeeTag(node); // SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above) // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 352 /* SyntaxKind.NotEmittedStatement */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return; } if (ts.isExpression(node)) { @@ -113038,85 +114086,87 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: return emitPrivateIdentifier(node); // Expressions - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return emitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return emitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return emitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return emitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return emitArrowFunction(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return emitDeleteExpression(node); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return emitTypeOfExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return emitVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return emitAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return emitBinaryExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return emitConditionalExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return emitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return emitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return emitSpreadElement(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return emitClassExpression(node); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: return emitAsExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return emitNonNullExpression(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return emitSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return emitMetaProperty(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return ts.Debug.fail("SyntheticExpression should never be printed."); // JSX - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return emitJsxElement(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return emitJsxFragment(node); // Synthesized list - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.Debug.fail("SyntaxList should not be printed"); // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: + case 352 /* SyntaxKind.NotEmittedStatement */: return; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return emitCommaList(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return; - case 354 /* SyntaxKind.SyntheticReferenceExpression */: + case 357 /* SyntaxKind.SyntheticReferenceExpression */: return ts.Debug.fail("SyntheticReferenceExpression should not be printed"); } } @@ -113164,7 +114214,7 @@ var ts; } function emitHelpers(node) { var helpersEmitted = false; - var bundle = node.kind === 306 /* SyntaxKind.Bundle */ ? node : undefined; + var bundle = node.kind === 309 /* SyntaxKind.Bundle */ ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -113264,7 +114314,7 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 302 /* SyntaxKind.UnparsedText */ ? + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 305 /* SyntaxKind.UnparsedText */ ? "text" /* BundleFileSectionKind.Text */ : "internal" /* BundleFileSectionKind.Internal */); } @@ -113301,7 +114351,7 @@ var ts; } function emitTabStop(hint, node, snippet) { // A tab stop should only be attached to an empty node, i.e. a node that doesn't emit any text. - ts.Debug.assert(node.kind === 236 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); + ts.Debug.assert(node.kind === 239 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); ts.Debug.assert(hint !== 5 /* EmitHint.EmbeddedStatement */, "A tab stop cannot be attached to an embedded statement."); nonEscapingWrite("$".concat(snippet.order)); } @@ -113362,7 +114412,7 @@ var ts; emit(node.dotDotDotToken); emitNodeWithWriter(node.name, writeParameter); emit(node.questionToken); - if (node.parent && node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */ && !node.name) { + if (node.parent && node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */ && !node.name) { emit(node.type); } else { @@ -113423,7 +114473,7 @@ var ts; } function emitAccessorDeclaration(node) { emitDecoratorsAndModifiers(node, node.modifiers); - writeKeyword(node.kind === 172 /* SyntaxKind.GetAccessor */ ? "get" : "set"); + writeKeyword(node.kind === 174 /* SyntaxKind.GetAccessor */ ? "get" : "set"); writeSpace(); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); @@ -113596,7 +114646,7 @@ var ts; function emitTypeOperator(node) { writeTokenText(node.operator, writeKeyword); writeSpace(); - var parenthesizerRule = node.operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + var parenthesizerRule = node.operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : parenthesizer.parenthesizeOperandOfTypeOperator; emit(node.type, parenthesizerRule); @@ -113619,7 +114669,7 @@ var ts; } if (node.readonlyToken) { emit(node.readonlyToken); - if (node.readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { + if (node.readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { writeKeyword("readonly"); } writeSpace(); @@ -113865,7 +114915,7 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } function emitAwaitExpression(node) { - emitTokenWithComment(132 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(133 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } @@ -113890,7 +114940,7 @@ var ts; // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. var operand = node.operand; - return operand.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ + return operand.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && ((node.operator === 39 /* SyntaxKind.PlusToken */ && (operand.operator === 39 /* SyntaxKind.PlusToken */ || operand.operator === 45 /* SyntaxKind.PlusPlusToken */)) || (node.operator === 40 /* SyntaxKind.MinusToken */ && (operand.operator === 40 /* SyntaxKind.MinusToken */ || operand.operator === 46 /* SyntaxKind.MinusMinusToken */))); } @@ -114038,6 +115088,15 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); writeOperator("!"); } + function emitSatisfiesExpression(node) { + emitExpression(node.expression, /*parenthesizerRules*/ undefined); + if (node.type) { + writeSpace(); + writeKeyword("satisfies"); + writeSpace(); + emit(node.type); + } + } function emitMetaProperty(node) { writeToken(node.keywordToken, node.pos, writePunctuation); writePunctuation("."); @@ -114095,7 +115154,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node, node.thenStatement, node.elseStatement); emitTokenWithComment(91 /* SyntaxKind.ElseKeyword */, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 239 /* SyntaxKind.IfStatement */) { + if (node.elseStatement.kind === 242 /* SyntaxKind.IfStatement */) { writeSpace(); emit(node.elseStatement); } @@ -114158,7 +115217,7 @@ var ts; emitTokenWithComment(20 /* SyntaxKind.OpenParenToken */, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(160 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); + emitTokenWithComment(162 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitTokenWithComment(21 /* SyntaxKind.CloseParenToken */, node.expression.end, writePunctuation, node); @@ -114166,7 +115225,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { emit(node); } else { @@ -114203,7 +115262,7 @@ var ts; } pos = writeTokenText(token, writer, pos); if (isSimilarNode && contextNode.end !== pos) { - var isJsxExprContext = contextNode.kind === 288 /* SyntaxKind.JsxExpression */; + var isJsxExprContext = contextNode.kind === 291 /* SyntaxKind.JsxExpression */; emitTrailingCommentsOfPosition(pos, /*prefixSpace*/ !isJsxExprContext, /*forceNoNewline*/ isJsxExprContext); } return pos; @@ -114513,7 +115572,7 @@ var ts; emitTokenWithComment(100 /* SyntaxKind.ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114538,7 +115597,7 @@ var ts; if (node.importClause) { emit(node.importClause); writeSpace(); - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); writeSpace(); } emitExpression(node.moduleSpecifier); @@ -114549,7 +115608,7 @@ var ts; } function emitImportClause(node) { if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114562,7 +115621,7 @@ var ts; function emitNamespaceImport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114588,10 +115647,11 @@ var ts; writeTrailingSemicolon(); } function emitExportDeclaration(node) { + emitModifiers(node, node.modifiers); var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - nextPos = emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); writeSpace(); } if (node.exportClause) { @@ -114603,7 +115663,7 @@ var ts; if (node.moduleSpecifier) { writeSpace(); var fromPos = node.exportClause ? node.exportClause.end : nextPos; - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); writeSpace(); emitExpression(node.moduleSpecifier); } @@ -114613,7 +115673,7 @@ var ts; writeTrailingSemicolon(); } function emitAssertClause(node) { - emitTokenWithComment(129 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(130 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); writeSpace(); var elements = node.elements; emitList(node, elements, 526226 /* ListFormat.ImportClauseEntries */); @@ -114633,9 +115693,9 @@ var ts; function emitNamespaceExportDeclaration(node) { var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(142 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(143 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); writeSpace(); emit(node.name); writeTrailingSemicolon(); @@ -114643,7 +115703,7 @@ var ts; function emitNamespaceExport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114666,7 +115726,7 @@ var ts; if (node.propertyName) { emit(node.propertyName); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114887,7 +115947,7 @@ var ts; } } if (node.tags) { - if (node.tags.length === 1 && node.tags[0].kind === 343 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { + if (node.tags.length === 1 && node.tags[0].kind === 346 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { writeSpace(); emit(node.tags[0]); } @@ -114932,7 +115992,7 @@ var ts; function emitJSDocTypedefTag(tag) { emitJSDocTagName(tag.tagName); if (tag.typeExpression) { - if (tag.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */) { + if (tag.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */) { emitJSDocTypeExpression(tag.typeExpression); } else { @@ -114951,7 +116011,7 @@ var ts; emit(tag.fullName); } emitJSDocComment(tag.comment); - if (tag.typeExpression && tag.typeExpression.kind === 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (tag.typeExpression && tag.typeExpression.kind === 325 /* SyntaxKind.JSDocTypeLiteral */) { emitJSDocTypeLiteral(tag.typeExpression); } } @@ -115884,13 +116944,13 @@ var ts; && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile)); } function skipSynthesizedParentheses(node) { - while (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; } function getTextOfNode(node, includeTrivia) { - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.isGeneratedPrivateIdentifier(node)) { return generateName(node); } if (ts.isStringLiteral(node) && node.textSourceNode) { @@ -115914,7 +116974,7 @@ var ts; function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) { if (node.kind === 10 /* SyntaxKind.StringLiteral */ && node.textSourceNode) { var textSourceNode = node.textSourceNode; - if (ts.isIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { + if (ts.isIdentifier(textSourceNode) || ts.isPrivateIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { var text = ts.isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode); return jsxAttributeEscape ? "\"".concat(ts.escapeJsxAttributeString(text), "\"") : neverAsciiEscape || (ts.getEmitFlags(node) & 16777216 /* EmitFlags.NoAsciiEscaping */) ? "\"".concat(ts.escapeString(text), "\"") : @@ -115938,7 +116998,11 @@ var ts; return; } tempFlagsStack.push(tempFlags); - tempFlags = 0; + tempFlags = 0 /* TempFlags.Auto */; + privateNameTempFlagsStack.push(privateNameTempFlags); + privateNameTempFlags = 0 /* TempFlags.Auto */; + formattedNameTempFlagsStack.push(formattedNameTempFlags); + formattedNameTempFlags = undefined; reservedNamesStack.push(reservedNames); } /** @@ -115949,6 +117013,8 @@ var ts; return; } tempFlags = tempFlagsStack.pop(); + privateNameTempFlags = privateNameTempFlagsStack.pop(); + formattedNameTempFlags = formattedNameTempFlagsStack.pop(); reservedNames = reservedNamesStack.pop(); } function reserveNameInNestedScopes(name) { @@ -115961,84 +117027,84 @@ var ts; if (!node) return; switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: ts.forEach(node.statements, generateNames); break; - case 250 /* SyntaxKind.LabeledStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: generateNames(node.statement); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: generateNames(node.thenStatement); generateNames(node.elseStatement); break; - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: generateNames(node.initializer); generateNames(node.statement); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: generateNames(node.caseBlock); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: ts.forEach(node.clauses, generateNames); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: ts.forEach(node.statements, generateNames); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: generateNames(node.tryBlock); generateNames(node.catchClause); generateNames(node.finallyBlock); break; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: generateNames(node.variableDeclaration); generateNames(node.block); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: generateNames(node.declarationList); break; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: ts.forEach(node.declarations, generateNames); break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: generateNameIfNeeded(node.name); break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: generateNameIfNeeded(node.name); if (ts.getEmitFlags(node) & 524288 /* EmitFlags.ReuseTempVariableScope */) { ts.forEach(node.parameters, generateNames); generateNames(node.body); } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: ts.forEach(node.elements, generateNames); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: generateNames(node.importClause); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: generateNameIfNeeded(node.name); generateNames(node.namedBindings); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: generateNameIfNeeded(node.name); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: generateNameIfNeeded(node.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: ts.forEach(node.elements, generateNames); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: generateNameIfNeeded(node.propertyName || node.name); break; } @@ -116047,19 +117113,19 @@ var ts; if (!node) return; switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: generateNameIfNeeded(node.name); break; } } function generateNameIfNeeded(name) { if (name) { - if (ts.isGeneratedIdentifier(name)) { + if (ts.isGeneratedIdentifier(name) || ts.isGeneratedPrivateIdentifier(name)) { generateName(name); } else if (ts.isBindingPattern(name)) { @@ -116074,7 +117140,7 @@ var ts; if ((name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) === 4 /* GeneratedIdentifierFlags.Node */) { // Node names generate unique names based on their original node // and are cached based on that node's id. - return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags); + return generateNameCached(ts.getNodeForGeneratedName(name), ts.isPrivateIdentifier(name), name.autoGenerateFlags, name.autoGeneratePrefix, name.autoGenerateSuffix); } else { // Auto, Loop, and Unique names are cached based on their unique @@ -116083,9 +117149,9 @@ var ts; return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name)); } } - function generateNameCached(node, flags) { + function generateNameCached(node, privateName, flags, prefix, suffix) { var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags)); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags !== null && flags !== void 0 ? flags : 0 /* GeneratedIdentifierFlags.None */, ts.formatGeneratedNamePart(prefix, generateName), ts.formatGeneratedNamePart(suffix))); } /** * Returns a value indicating whether a name is unique globally, within the current file, @@ -116117,20 +117183,53 @@ var ts; } return true; } + function getTempFlags(formattedNameKey) { + var _a; + switch (formattedNameKey) { + case "": + return tempFlags; + case "#": + return privateNameTempFlags; + default: + return (_a = formattedNameTempFlags === null || formattedNameTempFlags === void 0 ? void 0 : formattedNameTempFlags.get(formattedNameKey)) !== null && _a !== void 0 ? _a : 0 /* TempFlags.Auto */; + } + } + function setTempFlags(formattedNameKey, flags) { + switch (formattedNameKey) { + case "": + tempFlags = flags; + break; + case "#": + privateNameTempFlags = flags; + break; + default: + formattedNameTempFlags !== null && formattedNameTempFlags !== void 0 ? formattedNameTempFlags : (formattedNameTempFlags = new ts.Map()); + formattedNameTempFlags.set(formattedNameKey, flags); + break; + } + } /** * Return the next available name in the pattern _a ... _z, _0, _1, ... * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. * Note that names generated by makeTempVariableName and makeUniqueName will never conflict. */ - function makeTempVariableName(flags, reservedInNestedScopes) { + function makeTempVariableName(flags, reservedInNestedScopes, privateName, prefix, suffix) { + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } + // Generate a key to use to acquire a TempFlags counter based on the fixed portions of the generated name. + var key = ts.formatGeneratedName(privateName, prefix, "", suffix); + var tempFlags = getTempFlags(key); if (flags && !(tempFlags & flags)) { var name = flags === 268435456 /* TempFlags._i */ ? "_i" : "_n"; - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { tempFlags |= flags; if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } while (true) { @@ -116141,11 +117240,13 @@ var ts; var name = count < 26 ? "_" + String.fromCharCode(97 /* CharacterCodes.a */ + count) : "_" + (count - 26); - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } } @@ -116157,17 +117258,24 @@ var ts; * makeUniqueName are guaranteed to never conflict. * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1' */ - function makeUniqueName(baseName, checkFn, optimistic, scoped) { + function makeUniqueName(baseName, checkFn, optimistic, scoped, privateName, prefix, suffix) { if (checkFn === void 0) { checkFn = isUniqueName; } + if (baseName.length > 0 && baseName.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + baseName = baseName.slice(1); + } + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } if (optimistic) { - if (checkFn(baseName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(baseName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(baseName); + generatedNames.add(fullName); } - return baseName; + return fullName; } } // Find the first unique 'name_n', where n is a positive number @@ -116176,21 +117284,21 @@ var ts; } var i = 1; while (true) { - var generatedName = baseName + i; - if (checkFn(generatedName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName + i, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(generatedName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(generatedName); + generatedNames.add(fullName); } - return generatedName; + return fullName; } i++; } } function makeFileLevelOptimisticUniqueName(name) { - return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true); + return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a ModuleDeclaration or EnumDeclaration. @@ -116198,7 +117306,7 @@ var ts; function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); // Use module/enum name itself if it is unique, otherwise make a unique variation - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + return isUniqueLocalName(name, node) ? name : makeUniqueName(name, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for an ImportDeclaration or ExportDeclaration. @@ -116207,89 +117315,76 @@ var ts; var expr = ts.getExternalModuleName(node); // TODO: GH#18217 var baseName = ts.isStringLiteral(expr) ? ts.makeIdentifierFromModuleName(expr.text) : "module"; - return makeUniqueName(baseName); + return makeUniqueName(baseName, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a default export. */ function generateNameForExportDefault() { - return makeUniqueName("default"); + return makeUniqueName("default", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a class expression. */ function generateNameForClassExpression() { - return makeUniqueName("class"); + return makeUniqueName("class", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } - function generateNameForMethodOrAccessor(node) { + function generateNameForMethodOrAccessor(node, privateName, prefix, suffix) { if (ts.isIdentifier(node.name)) { - return generateNameCached(node.name); + return generateNameCached(node.name, privateName); } - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reservedInNestedScopes*/ false, privateName, prefix, suffix); } /** * Generates a unique name from a node. */ - function generateNameForNode(node, flags) { + function generateNameForNode(node, privateName, flags, prefix, suffix) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 80 /* SyntaxKind.PrivateIdentifier */: + return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), privateName, prefix, suffix); + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForModuleOrEnum(node); - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForImportOrExportDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForExportDefault(); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForClassExpression(); - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return generateNameForMethodOrAccessor(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true); + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return generateNameForMethodOrAccessor(node, privateName, prefix, suffix); + case 164 /* SyntaxKind.ComputedPropertyName */: + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true, privateName, prefix, suffix); default: - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ false, privateName, prefix, suffix); } } /** * Generates a unique identifier for a node. */ function makeName(name) { + var prefix = ts.formatGeneratedNamePart(name.autoGeneratePrefix, generateName); + var suffix = ts.formatGeneratedNamePart(name.autoGenerateSuffix); switch (name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) { case 1 /* GeneratedIdentifierFlags.Auto */: - return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); case 2 /* GeneratedIdentifierFlags.Loop */: - return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + ts.Debug.assertNode(name, ts.isIdentifier); + return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), /*privateName*/ false, prefix, suffix); case 3 /* GeneratedIdentifierFlags.Unique */: - return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); - } - return ts.Debug.fail("Unsupported GeneratedIdentifierKind."); - } - /** - * Gets the node from which a name should be generated. - */ - function getNodeForGeneratedName(name) { - var autoGenerateId = name.autoGenerateId; - var node = name; - var original = node.original; - while (original) { - node = original; - // if "node" is a different generated name (having a different - // "autoGenerateId"), use it and stop traversing. - if (ts.isIdentifier(node) - && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) - && node.autoGenerateId !== autoGenerateId) { - break; - } - original = node.original; + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); } - // otherwise, return the original node for the source; - return node; + return ts.Debug.fail("Unsupported GeneratedIdentifierKind: ".concat(ts.Debug.formatEnum(name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */, ts.GeneratedIdentifierFlags, /*isFlags*/ true), ".")); } // Comments function pipelineEmitWithComments(hint, node) { @@ -116335,7 +117430,7 @@ var ts; // Emit leading comments if the position is not synthesized and the node // has not opted out from emitting leading comments. if (!skipLeadingComments) { - emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 349 /* SyntaxKind.NotEmittedStatement */); + emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 352 /* SyntaxKind.NotEmittedStatement */); } if (!skipLeadingComments || (pos >= 0 && (emitFlags & 512 /* EmitFlags.NoLeadingComments */) !== 0)) { // Advance the container position if comments get emitted or if they've been disabled explicitly using NoLeadingComments. @@ -116346,7 +117441,7 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -116365,7 +117460,7 @@ var ts; declarationListContainerEnd = savedDeclarationListContainerEnd; // Emit trailing comments if the position is not synthesized and the node // has not opted out from emitting leading comments and is an emitted node. - if (!skipTrailingComments && node.kind !== 349 /* SyntaxKind.NotEmittedStatement */) { + if (!skipTrailingComments && node.kind !== 352 /* SyntaxKind.NotEmittedStatement */) { emitTrailingComments(end); } } @@ -116646,7 +117741,7 @@ var ts; } else { var source = sourceMapRange.source || sourceMapSource; - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 16 /* EmitFlags.NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos)); @@ -116664,7 +117759,7 @@ var ts; if (emitFlags & 64 /* EmitFlags.NoNestedSourceMaps */) { sourceMapsDisabled = false; } - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 32 /* EmitFlags.NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end); @@ -116829,7 +117924,16 @@ var ts; return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath)); } function getCachedFileSystemEntriesForBaseDir(path) { - return getCachedFileSystemEntries(ts.getDirectoryPath(path)); + var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path)); + if (!entries) { + return entries; + } + // If we're looking for the base directory, we're definitely going to search the entries + if (!entries.sortedAndCanonicalizedFiles) { + entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort(); + entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort(); + } + return entries; } function getBaseNameOfFileName(fileName) { return ts.getBaseFileName(ts.normalizePath(fileName)); @@ -116872,21 +117976,10 @@ var ts; return undefined; } } - function fileNameEqual(name1, name2) { - return getCanonicalFileName(name1) === getCanonicalFileName(name2); - } function hasEntry(entries, name) { - return ts.some(entries, function (file) { return fileNameEqual(file, name); }); - } - function updateFileSystemEntry(entries, baseName, isValid) { - if (hasEntry(entries, baseName)) { - if (!isValid) { - return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); }); - } - } - else if (isValid) { - return entries.push(baseName); - } + // Case-sensitive comparison since already canonicalized + var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive); + return index >= 0; } function writeFile(fileName, data, writeByteOrderMark) { var path = toPath(fileName); @@ -116899,7 +117992,7 @@ var ts; function fileExists(fileName) { var path = toPath(fileName); var result = getCachedFileSystemEntriesForBaseDir(path); - return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) || + return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) || host.fileExists(fileName); } function directoryExists(dirPath) { @@ -116909,9 +118002,14 @@ var ts; function createDirectory(dirPath) { var path = toPath(dirPath); var result = getCachedFileSystemEntriesForBaseDir(path); - var baseFileName = getBaseNameOfFileName(dirPath); if (result) { - updateFileSystemEntry(result.directories, baseFileName, /*isValid*/ true); + var baseName = getBaseNameOfFileName(dirPath); + var canonicalizedBaseName = getCanonicalFileName(baseName); + var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories; + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + result.directories.push(baseName); + } } host.createDirectory(dirPath); } @@ -116980,7 +118078,7 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) { // Folder added or removed, clear the cache instead of updating the folder and its structure clearCache(); } @@ -117000,7 +118098,23 @@ var ts; } } function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) { - updateFileSystemEntry(parentResult.files, baseName, fileExists); + var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles; + var canonicalizedBaseName = getCanonicalFileName(baseName); + if (fileExists) { + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + parentResult.files.push(baseName); + } + } + else { + // Case-sensitive comparison since already canonicalized + var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive); + if (sortedIndex >= 0) { + canonicalizedFiles.splice(sortedIndex, 1); + var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; }); + parentResult.files.splice(unsortedIndex, 1); + } + } } function clearCache() { cachedReadDirectoryResult.clear(); @@ -117480,14 +118594,16 @@ var ts; } return setReadFileCache(key, fileName); }; - var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersion, onError, shouldCreateNewSourceFile) { + var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) { var key = toPath(fileName); - var value = sourceFileCache.get(key); + var impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : undefined; + var forImpliedNodeFormat = sourceFileCache.get(impliedNodeFormat); + var value = forImpliedNodeFormat === null || forImpliedNodeFormat === void 0 ? void 0 : forImpliedNodeFormat.get(key); if (value) return value; - var sourceFile = getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile); + var sourceFile = getSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile); if (sourceFile && (ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Extension.Json */))) { - sourceFileCache.set(key, sourceFile); + sourceFileCache.set(impliedNodeFormat, (forImpliedNodeFormat || new ts.Map()).set(key, sourceFile)); } return sourceFile; } : undefined; @@ -117512,13 +118628,15 @@ var ts; var value = readFileCache.get(key); if (value !== undefined && value !== data) { readFileCache.delete(key); - sourceFileCache.delete(key); + sourceFileCache.forEach(function (map) { return map.delete(key); }); } else if (getSourceFileWithCache) { - var sourceFile = sourceFileCache.get(key); - if (sourceFile && sourceFile.text !== data) { - sourceFileCache.delete(key); - } + sourceFileCache.forEach(function (map) { + var sourceFile = map.get(key); + if (sourceFile && sourceFile.text !== data) { + map.delete(key); + } + }); } originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false)); }; @@ -117760,7 +118878,6 @@ var ts; return resolutions; } ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache; - ; /** * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file. @@ -117960,7 +119077,7 @@ var ts; * Determines if program structure is upto date or needs to be recreated */ /* @internal */ - function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { + function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { // If we haven't created a program yet or have changed automatic type directives, then it is not up-to-date if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames())) return false; @@ -117988,7 +119105,7 @@ var ts; return true; function sourceFileNotUptoDate(sourceFile) { return !sourceFileVersionUptoDate(sourceFile) || - hasInvalidatedResolution(sourceFile.path); + hasInvalidatedResolutions(sourceFile.path); } function sourceFileVersionUptoDate(sourceFile) { return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName); @@ -118234,7 +119351,7 @@ var ts; var moduleResolutionCache; var typeReferenceDirectiveResolutionCache; var actualResolveModuleNamesWorker; - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; if (host.resolveModuleNames) { actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) { // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. @@ -118681,7 +119798,7 @@ var ts; for (var i = 0; i < moduleNames.length; i++) { var moduleName = moduleNames[i]; // If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions - if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) { + if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) { var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i)); if (oldResolvedModule) { if (ts.isTraceEnabled(options, host)) { @@ -118917,7 +120034,7 @@ var ts; // tentatively approve the file modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); } - else if (hasInvalidatedResolution(oldSourceFile.path)) { + else if (hasInvalidatedResolutions(oldSourceFile.path)) { // 'module/types' references could have changed structureIsReused = 1 /* StructureIsReused.SafeModules */; // add file to the modified list so that we will resolve it later @@ -119305,22 +120422,22 @@ var ts; // Return directly from the case if the given node doesnt want to visit each child // Otherwise break to visit each child switch (parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); return "skip"; } // falls through - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 257 /* SyntaxKind.VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); @@ -119328,65 +120445,68 @@ var ts; } } switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type")); return "skip"; } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type")); return "skip"; } break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, ts.isImportSpecifier(node) ? "import...type" : "export...type")); return "skip"; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_TypeScript_files)); return "skip"; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: var heritageClause = node; if (heritageClause.token === 117 /* SyntaxKind.ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: var interfaceKeyword = ts.tokenToString(118 /* SyntaxKind.InterfaceKeyword */); ts.Debug.assertIsDefined(interfaceKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword)); return "skip"; - case 261 /* SyntaxKind.ModuleDeclaration */: - var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(142 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(141 /* SyntaxKind.ModuleKeyword */); + case 264 /* SyntaxKind.ModuleDeclaration */: + var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(143 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(142 /* SyntaxKind.ModuleKeyword */); ts.Debug.assertIsDefined(moduleKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); return "skip"; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); return "skip"; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumKeyword = ts.Debug.checkDefined(ts.tokenToString(92 /* SyntaxKind.EnumKeyword */)); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); return "skip"; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 213 /* SyntaxKind.TypeAssertionExpression */: ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. } } @@ -119395,53 +120515,55 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)); } switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); return "skip"; } // falls through - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - checkModifiers(parent.modifiers, parent.kind === 237 /* SyntaxKind.VariableStatement */); + checkModifiers(parent.modifiers, parent.kind === 240 /* SyntaxKind.VariableStatement */); return "skip"; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Check modifiers of property declaration if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; - if (ts.isModifier(modifier) && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */) { + if (ts.isModifier(modifier) + && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ + && modifier.kind !== 127 /* SyntaxKind.AccessorKeyword */) { diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); } } return "skip"; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Check modifiers of parameter declaration if (nodes === parent.modifiers && ts.some(nodes, ts.isModifier)) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); @@ -119463,18 +120585,19 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); break; // These are all legal modifiers. case 124 /* SyntaxKind.StaticKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: } } } @@ -120399,10 +121522,12 @@ var ts; if (options.preserveConstEnums === false) { createDiagnosticForOptionName(ts.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled, "preserveConstEnums", "isolatedModules"); } - var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* ScriptKind.JSON */; }); - if (firstNonExternalModuleSourceFile) { - var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(firstNonExternalModuleSourceFile.fileName))); + for (var _a = 0, files_5 = files; _a < files_5.length; _a++) { + var file = files_5[_a]; + if (!ts.isExternalModule(file) && !ts.isSourceFileJS(file) && !file.isDeclarationFile && file.scriptKind !== 6 /* ScriptKind.JSON */) { + var span = ts.getErrorSpanForNode(file, file); + programDiagnostics.add(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(file.fileName))); + } } } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ScriptTarget.ES2015 */ && options.module === ts.ModuleKind.None) { @@ -121653,10 +122778,16 @@ var ts; var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined; var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile && !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions); + // We can only reuse emit signatures (i.e. .d.ts signatures) if the .d.ts file is unchanged, + // which will eg be depedent on change in options like declarationDir and outDir options are unchanged. + // We need to look in oldState.compilerOptions, rather than oldCompilerOptions (i.e.we need to disregard useOldState) because + // oldCompilerOptions can be undefined if there was change in say module from None to some other option + // which would make useOldState as false since we can now use reference maps that are needed to track what to emit, what to check etc + // but that option change does not affect d.ts file name so emitSignatures should still be reused. var canCopyEmitSignatures = compilerOptions.composite && (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) && !outFilePath && - !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions); + !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions); if (useOldState) { // Copy old state's changed files set (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); }); @@ -122871,7 +124002,7 @@ var ts; var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* CharacterCodes.slash */; if (isNonDirectorySeparatorRoot && dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths - pathPartForUserCheck.search(/[a-zA-z]\$\//) === 0) { // Dos style nextPart + pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) { // Dos style nextPart nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, nextDirectorySeparator + 1); if (nextDirectorySeparator === -1) { // ignore "//vda1cs4850/c$/folderAtRoot" @@ -122955,7 +124086,7 @@ var ts; invalidateResolutionOfFile: invalidateResolutionOfFile, invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations, setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports, - createHasInvalidatedResolution: createHasInvalidatedResolution, + createHasInvalidatedResolutions: createHasInvalidatedResolutions, isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports, updateTypeRootsWatch: updateTypeRootsWatch, closeTypeRootsWatch: closeTypeRootsWatch, @@ -123010,17 +124141,13 @@ var ts; var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path); return !!value && !!value.length; } - function createHasInvalidatedResolution(forceAllFilesAsInvalidated) { + function createHasInvalidatedResolutions(customHasInvalidatedResolutions) { // Ensure pending resolutions are applied invalidateResolutionsOfFailedLookupLocations(); - if (forceAllFilesAsInvalidated) { - // Any file asked would have invalidated resolution - filesWithInvalidatedResolutions = undefined; - return ts.returnTrue; - } var collected = filesWithInvalidatedResolutions; filesWithInvalidatedResolutions = undefined; - return function (path) { return (!!collected && collected.has(path)) || + return function (path) { return customHasInvalidatedResolutions(path) || + !!(collected === null || collected === void 0 ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path); }; } function startCachingPerDirectoryResolution() { @@ -124381,15 +125508,21 @@ var ts; return undefined; } function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) { - var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); - if (normalizedTargetPath === undefined) { + var normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); + if (normalizedTargetPaths === undefined) { + return undefined; + } + var normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); + var relativePaths = ts.flatMap(normalizedSourcePaths, function (sourcePath) { + return ts.map(normalizedTargetPaths, function (targetPath) { return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)); }); + }); + var shortest = ts.min(relativePaths, ts.compareNumberOfDirectorySeparators); + if (!shortest) { return undefined; } - var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); - var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath; return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs - ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions) - : ts.removeFileExtension(relativePath); + ? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions) + : ts.removeFileExtension(shortest); } function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) { var path = _a.path, isRedirect = _a.isRedirect; @@ -124526,8 +125659,8 @@ var ts; } } } - function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) { - return ts.firstDefined(rootDirs, function (rootDir) { + function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) { + return ts.mapDefined(rootDirs, function (rootDir) { var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName); return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath; }); @@ -125238,18 +126371,14 @@ var ts; if (host.getBuildInfo) { // host provides buildinfo, get it from there. This allows host to cache it buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath); - if (!buildInfo) - return undefined; } else { var content = host.readFile(buildInfoPath); if (!content) return undefined; - buildInfo = ts.getBuildInfo(content); + buildInfo = ts.getBuildInfo(buildInfoPath, content); } - if (buildInfo.version !== ts.version) - return undefined; - if (!buildInfo.program) + if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program) return undefined; return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host); } @@ -125404,6 +126533,10 @@ var ts; ts.maybeBind(host, host.getModuleResolutionCache) : (function () { return resolutionCache.getModuleResolutionCache(); }); var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; + // All resolutions are invalid if user provided resolutions and didnt supply hasInvalidatedResolutions + var customHasInvalidatedResolutions = userProvidedResolution ? + ts.maybeBind(host, host.hasInvalidatedResolutions) || ts.returnTrue : + ts.returnFalse; builderProgram = readBuilderProgram(compilerOptions, compilerHost); synchronizeProgram(); // Update the wild card directory watch @@ -125469,9 +126602,9 @@ var ts; resolutionCache.clear(); } } - // All resolutions are invalid if user provided resolutions - var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + var hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions); + var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile; + if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { if (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -125484,15 +126617,20 @@ var ts; if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); } - createNewProgram(hasInvalidatedResolution); + createNewProgram(hasInvalidatedResolutions); } reportFileChangeDetectedOnCreateProgram = false; if (host.afterProgramCreate && program !== builderProgram) { host.afterProgramCreate(builderProgram); } + compilerHost.readFile = originalReadFile; + compilerHost.fileExists = originalFileExists; + compilerHost.directoryExists = originalDirectoryExists; + compilerHost.createDirectory = originalCreateDirectory; + compilerHost.writeFile = originalWriteFile; return builderProgram; } - function createNewProgram(hasInvalidatedResolution) { + function createNewProgram(hasInvalidatedResolutions) { // Compile the program writeLog("CreatingProgramWith::"); writeLog(" roots: ".concat(JSON.stringify(rootFileNames))); @@ -125503,7 +126641,7 @@ var ts; hasChangedCompilerOptions = false; hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); - compilerHost.hasInvalidatedResolution = hasInvalidatedResolution; + compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; var oldProgram = getCurrentProgram(); builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences); @@ -125967,19 +127105,20 @@ var ts; */ UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend"; UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream"; - UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo"; - UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate"; - UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked"; - UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream"; - UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate"; - UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText"; + UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream"; + UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo"; + UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate"; + UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked"; + UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream"; + UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate"; + UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText"; /** * Projects with no outputs (i.e. "solution" files) */ - UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly"; - UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild"; + UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly"; + UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild"; })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {})); function resolveConfigFileProjectName(project) { if (ts.fileExtensionIs(project, ".json" /* Extension.Json */)) { @@ -126197,6 +127336,7 @@ var ts; if (value) { return isParsedCommandLine(value) ? value : undefined; } + ts.performance.mark("SolutionBuilder::beforeConfigFileParsing"); var diagnostic; var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host; var parsed; @@ -126211,6 +127351,8 @@ var ts; parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop; } configFileCache.set(configFilePath, parsed || diagnostic); + ts.performance.mark("SolutionBuilder::afterConfigFileParsing"); + ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing"); return parsed; } function resolveProjectName(state, name) { @@ -126410,6 +127552,7 @@ var ts; if (updateOutputFileStampsPending) { updateOutputTimestamps(state, config, projectPath); } + ts.performance.mark("SolutionBuilder::Timestamps only updates"); return doneInvalidatedProject(state, projectPath); } }; @@ -126503,6 +127646,10 @@ var ts; }; function done(cancellationToken, writeFile, customTransformers) { executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers); + if (kind === InvalidatedProjectKind.Build) + ts.performance.mark("SolutionBuilder::Projects built"); + else + ts.performance.mark("SolutionBuilder::Bundles updated"); return doneInvalidatedProject(state, projectPath); } function withProgramOrUndefined(action) { @@ -126681,13 +127828,13 @@ var ts; var emitterDiagnostics = ts.createDiagnosticCollection(); var emittedOutputs = new ts.Map(); var resultFlags = BuildResultFlags.DeclarationOutputUnchanged; - var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo; + var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined; outputFiles.forEach(function (_a) { var _b, _c; var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo; emittedOutputs.set(toPath(state, name), name); if (buildInfo) { - if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { + if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; } setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags); @@ -126980,8 +128127,7 @@ var ts; return existing.buildInfo || undefined; } var value = state.readFileWithCache(buildInfoPath); - var buildInfo = value ? ts.getBuildInfo(value) : undefined; - ts.Debug.assert(modifiedTime || !buildInfo); + var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined; state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime }); return buildInfo; } @@ -127066,7 +128212,14 @@ var ts; missingOutputFileName: buildInfoPath }; } - var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime)); + var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime); + if (!buildInfo) { + // Error reading buildInfo + return { + type: ts.UpToDateStatusType.ErrorReadingFile, + fileName: buildInfoPath + }; + } if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) { return { type: ts.UpToDateStatusType.TsVersionOutputOfDate, @@ -127075,8 +128228,15 @@ var ts; } if (buildInfo.program) { // If there are pending changes that are not emitted, project is out of date + // When there are syntax errors, changeFileSet will have list of files changed (irrespective of noEmit) + // But in case of semantic error we need special treatment. + // Checking presence of affectedFilesPendingEmit list is fast and good way to tell if there were semantic errors and file emit was blocked + // But if noEmit is true, affectedFilesPendingEmit will have file list even if there are no semantic errors to preserve list of files to be emitted when running with noEmit false + // So with noEmit set to true, check on semantic diagnostics needs to be explicit as oppose to when it is false when only files pending emit is sufficient if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) || - (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) { + (!project.options.noEmit ? + (_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length : + ts.some(buildInfo.program.semanticDiagnosticsPerFile, ts.isArray))) { return { type: ts.UpToDateStatusType.OutOfDateBuildInfo, buildInfoFile: buildInfoPath @@ -127251,7 +128411,10 @@ var ts; if (prior !== undefined) { return prior; } + ts.performance.mark("SolutionBuilder::beforeUpToDateCheck"); var actual = getUpToDateStatusWorker(state, project, resolvedPath); + ts.performance.mark("SolutionBuilder::afterUpToDateCheck"); + ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck"); state.projectStatus.set(resolvedPath, actual); return actual; } @@ -127389,6 +128552,13 @@ var ts; } } function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + return result; + } + function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127416,6 +128586,13 @@ var ts; : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } function clean(state, project, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeClean"); + var result = cleanWorker(state, project, onlyReferences); + ts.performance.mark("SolutionBuilder::afterClean"); + ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean"); + return result; + } + function cleanWorker(state, project, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127489,6 +128666,14 @@ var ts; state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected); } function buildNextInvalidatedProject(state, changeDetected) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + if (buildOrder) + reportErrorSummary(state, buildOrder); + } + function buildNextInvalidatedProjectWorker(state, changeDetected) { state.timerToBuildInvalidatedProject = undefined; if (state.reportFileChangeDetected) { state.reportFileChangeDetected = false; @@ -127521,7 +128706,7 @@ var ts; } } disableCache(state); - reportErrorSummary(state, buildOrder); + return buildOrder; } function watchConfigFile(state, resolved, resolvedPath, parsed) { if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath)) @@ -127576,6 +128761,7 @@ var ts; function startWatching(state, buildOrder) { if (!state.watchAllProjectsPending) return; + ts.performance.mark("SolutionBuilder::beforeWatcherCreation"); state.watchAllProjectsPending = false; for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) { var resolved = _a[_i]; @@ -127593,6 +128779,8 @@ var ts; watchPackageJsonFiles(state, resolved, resolvedPath, cfg); } } + ts.performance.mark("SolutionBuilder::afterWatcherCreation"); + ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation"); } function stopWatching(state) { ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher); @@ -127706,6 +128894,8 @@ var ts; return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName)); case ts.UpToDateStatusType.OutputMissing: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName)); + case ts.UpToDateStatusType.ErrorReadingFile: + return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName)); case ts.UpToDateStatusType.OutOfDateBuildInfo: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile)); case ts.UpToDateStatusType.UpToDate: @@ -128227,6 +129417,12 @@ var ts; SemanticClassificationFormat["Original"] = "original"; SemanticClassificationFormat["TwentyTwenty"] = "2020"; })(SemanticClassificationFormat = ts.SemanticClassificationFormat || (ts.SemanticClassificationFormat = {})); + var OrganizeImportsMode; + (function (OrganizeImportsMode) { + OrganizeImportsMode["All"] = "All"; + OrganizeImportsMode["SortAndCombine"] = "SortAndCombine"; + OrganizeImportsMode["RemoveUnused"] = "RemoveUnused"; + })(OrganizeImportsMode = ts.OrganizeImportsMode || (ts.OrganizeImportsMode = {})); var CompletionTriggerKind; (function (CompletionTriggerKind) { /** Completion was triggered by typing an identifier, manual invocation (e.g Ctrl+Space) or via API. */ @@ -128413,6 +129609,8 @@ var ts; * interface Y { foo:number; } */ ScriptElementKind["memberVariableElement"] = "property"; + /** class X { [public|private]* accessor foo: number; } */ + ScriptElementKind["memberAccessorVariableElement"] = "accessor"; /** * class X { constructor() { } } * class X { static { } } @@ -128545,37 +129743,37 @@ var ts; })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})); function getMeaningFromDeclaration(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.isInJSFile(node) && ts.getJSDocEnumTag(node) ? 7 /* SemanticMeaning.All */ : 1 /* SemanticMeaning.Value */; - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 292 /* SyntaxKind.CatchClause */: - case 285 /* SyntaxKind.JsxAttribute */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 295 /* SyntaxKind.CatchClause */: + case 288 /* SyntaxKind.JsxAttribute */: return 1 /* SemanticMeaning.Value */; - case 163 /* SyntaxKind.TypeParameter */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 165 /* SyntaxKind.TypeParameter */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: return 2 /* SemanticMeaning.Type */; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: // If it has no name node, it shares the name with the value declaration below it. return node.name === undefined ? 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */ : 2 /* SemanticMeaning.Type */; - case 299 /* SyntaxKind.EnumMember */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: return 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } @@ -128585,16 +129783,16 @@ var ts; else { return 4 /* SemanticMeaning.Namespace */; } - case 260 /* SyntaxKind.EnumDeclaration */: - case 269 /* SyntaxKind.NamedImports */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 272 /* SyntaxKind.NamedImports */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return 7 /* SemanticMeaning.All */; // An external module can be a Value - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } return 7 /* SemanticMeaning.All */; @@ -128603,7 +129801,7 @@ var ts; function getMeaningFromLocation(node) { node = getAdjustedReferenceLocation(node); var parent = node.parent; - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return 1 /* SemanticMeaning.Value */; } else if (ts.isExportAssignment(parent) @@ -128646,11 +129844,11 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - var name = node.kind === 161 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; - return name && name.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; + var name = node.kind === 163 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; + return name && name.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; } function isInRightSideOfInternalImportEqualsDeclaration(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -128662,27 +129860,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { - while (root.parent && root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { + while (root.parent && root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 178 /* SyntaxKind.TypeReference */ && !isLastClause; + return root.parent.kind === 180 /* SyntaxKind.TypeReference */ && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */) { + if (!isLastClause && root.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 257 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || - (decl.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); + return (decl.kind === 260 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || + (decl.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); } return false; } @@ -128693,15 +129891,15 @@ var ts; switch (node.kind) { case 108 /* SyntaxKind.ThisKeyword */: return !ts.isExpressionNode(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return true; } switch (node.parent.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return true; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return !node.parent.isTypeOf; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isPartOfTypeNode(node.parent); } return false; @@ -128768,7 +129966,7 @@ var ts; ts.climbPastPropertyOrElementAccess = climbPastPropertyOrElementAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 250 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { + if (referenceNode.kind === 253 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -128829,22 +130027,22 @@ var ts; ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { switch (node.parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.getNameOfDeclaration(node.parent) === node; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.parent.argumentExpression === node; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return true; - case 196 /* SyntaxKind.LiteralType */: - return node.parent.parent.kind === 194 /* SyntaxKind.IndexedAccessType */; + case 198 /* SyntaxKind.LiteralType */: + return node.parent.parent.kind === 196 /* SyntaxKind.IndexedAccessType */; default: return false; } @@ -128868,17 +130066,17 @@ var ts; return undefined; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node; } } @@ -128886,56 +130084,56 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node) ? "module" /* ScriptElementKind.moduleElement */ : "script" /* ScriptElementKind.scriptElement */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return "module" /* ScriptElementKind.moduleElement */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return "class" /* ScriptElementKind.classElement */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return "type" /* ScriptElementKind.typeElement */; - case 260 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; - case 254 /* SyntaxKind.VariableDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; + case 257 /* SyntaxKind.VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return "function" /* ScriptElementKind.functionElement */; - case 172 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; - case 173 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; + case 175 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return "method" /* ScriptElementKind.memberFunctionElement */; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: var initializer = node.initializer; return ts.isFunctionLike(initializer) ? "method" /* ScriptElementKind.memberFunctionElement */ : "property" /* ScriptElementKind.memberVariableElement */; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return "property" /* ScriptElementKind.memberVariableElement */; - case 176 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; - case 175 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; - case 174 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; + case 177 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; + case 176 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return "constructor" /* ScriptElementKind.constructorImplementationElement */; - case 163 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; - case 299 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; - case 164 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: + case 165 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; + case 302 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; + case 166 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: return "alias" /* ScriptElementKind.alias */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var kind = ts.getAssignmentDeclarationKind(node); var right = node.right; switch (kind) { @@ -128964,7 +130162,7 @@ var ts; } case 79 /* SyntaxKind.Identifier */: return ts.isImportClause(node.parent) ? "alias" /* ScriptElementKind.alias */ : "" /* ScriptElementKind.unknown */; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: var scriptKind = getNodeKind(node.expression); // If the expression didn't come back with something (like it does for an identifiers) return scriptKind === "" /* ScriptElementKind.unknown */ ? "const" /* ScriptElementKind.constElement */ : scriptKind; @@ -128987,7 +130185,7 @@ var ts; return true; case 79 /* SyntaxKind.Identifier */: // 'this' as a parameter - return ts.identifierIsThisKeyword(node) && node.parent.kind === 164 /* SyntaxKind.Parameter */; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 166 /* SyntaxKind.Parameter */; default: return false; } @@ -129052,42 +130250,42 @@ var ts; return false; } switch (n.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 182 /* SyntaxKind.TypeLiteral */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 263 /* SyntaxKind.CaseBlock */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 184 /* SyntaxKind.TypeLiteral */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 266 /* SyntaxKind.CaseBlock */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return nodeEndsWith(n, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return isCompletedNode(n.block, sourceFile); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: if (!n.arguments) { return true; } // falls through - case 208 /* SyntaxKind.CallExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 191 /* SyntaxKind.ParenthesizedType */: + case 210 /* SyntaxKind.CallExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: return nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 216 /* SyntaxKind.ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -129097,65 +130295,65 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return !!n.body && isCompletedNode(n.body, sourceFile); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 26 /* SyntaxKind.SemicolonToken */, sourceFile); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 184 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 186 /* SyntaxKind.TupleType */: return nodeEndsWith(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; return hasChildOfKind(n, 115 /* SyntaxKind.WhileKeyword */, sourceFile) ? nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile) : isCompletedNode(n.statement, sourceFile); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 216 /* SyntaxKind.TypeOfExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 225 /* SyntaxKind.SpreadElement */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 227 /* SyntaxKind.SpreadElement */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.nodeIsPresent(n.moduleSpecifier); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -129270,6 +130468,8 @@ var ts; return lastTypeNode; } function getContextualTypeFromParentOrAncestorTypeNode(node, checker) { + if (node.flags & (8388608 /* NodeFlags.JSDoc */ & ~262144 /* NodeFlags.JavaScriptFile */)) + return undefined; var contextualType = getContextualTypeFromParent(node, checker); if (contextualType) return contextualType; @@ -129280,13 +130480,13 @@ var ts; function getAdjustedLocationForDeclaration(node, forRename) { if (!forRename) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return getAdjustedLocationForClass(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return getAdjustedLocationForFunction(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return node; } } @@ -129381,11 +130581,11 @@ var ts; node.kind === 98 /* SyntaxKind.FunctionKeyword */ ? ts.isFunctionDeclaration(parent) || ts.isFunctionExpression(node) : node.kind === 118 /* SyntaxKind.InterfaceKeyword */ ? ts.isInterfaceDeclaration(parent) : node.kind === 92 /* SyntaxKind.EnumKeyword */ ? ts.isEnumDeclaration(parent) : - node.kind === 152 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : - node.kind === 142 /* SyntaxKind.NamespaceKeyword */ || node.kind === 141 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : + node.kind === 154 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : + node.kind === 143 /* SyntaxKind.NamespaceKeyword */ || node.kind === 142 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : node.kind === 100 /* SyntaxKind.ImportKeyword */ ? ts.isImportEqualsDeclaration(parent) : - node.kind === 136 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : - node.kind === 149 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { + node.kind === 137 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : + node.kind === 151 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { var location = getAdjustedLocationForDeclaration(parent, forRename); if (location) { return location; @@ -129399,7 +130599,7 @@ var ts; return decl.name; } } - if (node.kind === 152 /* SyntaxKind.TypeKeyword */) { + if (node.kind === 154 /* SyntaxKind.TypeKeyword */) { // import /**/type [|name|] from ...; // import /**/type { [|name|] } from ...; // import /**/type { propertyName as [|name|] } from ...; @@ -129425,7 +130625,7 @@ var ts; // import * /**/as [|name|] ... // export { propertyName /**/as [|name|] } ... // export * /**/as [|name|] ... - if (node.kind === 127 /* SyntaxKind.AsKeyword */) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */) { if (ts.isImportSpecifier(parent) && parent.propertyName || ts.isExportSpecifier(parent) && parent.propertyName || ts.isNamespaceImport(parent) || @@ -129466,12 +130666,12 @@ var ts; } } // import name = /**/require("[|module|]"); - if (node.kind === 146 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { + if (node.kind === 147 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { return parent.expression; } // import ... /**/from "[|module|]"; // export ... /**/from "[|module|]"; - if (node.kind === 156 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { + if (node.kind === 158 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { return parent.moduleSpecifier; } // class ... /**/extends [|name|] ... @@ -129496,7 +130696,7 @@ var ts; } } // ... T extends /**/infer [|U|] ? ... - if (node.kind === 137 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { + if (node.kind === 138 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { return parent.typeParameter.name; } // { [ [|K|] /**/in keyof T]: ... } @@ -129504,12 +130704,12 @@ var ts; return parent.name; } // /**/keyof [|T|] - if (node.kind === 140 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 140 /* SyntaxKind.KeyOfKeyword */ && + if (node.kind === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // /**/readonly [|name|][] - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */ && + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isArrayTypeNode(parent.type) && ts.isTypeReferenceNode(parent.type.elementType)) { return parent.type.elementType.typeName; } @@ -129527,7 +130727,7 @@ var ts; if (node.kind === 103 /* SyntaxKind.NewKeyword */ && ts.isNewExpression(parent) || node.kind === 114 /* SyntaxKind.VoidKeyword */ && ts.isVoidExpression(parent) || node.kind === 112 /* SyntaxKind.TypeOfKeyword */ && ts.isTypeOfExpression(parent) || - node.kind === 132 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || + node.kind === 133 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || node.kind === 125 /* SyntaxKind.YieldKeyword */ && ts.isYieldExpression(parent) || node.kind === 89 /* SyntaxKind.DeleteKeyword */ && ts.isDeleteExpression(parent)) { if (parent.expression) { @@ -129540,13 +130740,13 @@ var ts; return ts.skipOuterExpressions(parent.right); } // left /**/as [|name|] - if (node.kind === 127 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // for (... /**/in [|name|]) // for (... /**/of [|name|]) if (node.kind === 101 /* SyntaxKind.InKeyword */ && ts.isForInStatement(parent) || - node.kind === 160 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { + node.kind === 162 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { return ts.skipOuterExpressions(parent.expression); } } @@ -129778,7 +130978,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 305 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 308 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -129809,7 +131009,7 @@ var ts; for (var i = exclusiveStartPosition - 1; i >= 0; i--) { var child = children[i]; if (isWhiteSpaceOnlyJsxText(child)) { - if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { ts.Debug.fail("`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`"); } } @@ -129853,17 +131053,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
|
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return true; } return false; @@ -129894,7 +131094,7 @@ var ts; function isInsideJsxElement(sourceFile, position) { function isInsideJsxElementTraversal(node) { while (node) { - if (node.kind >= 279 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 288 /* SyntaxKind.JsxExpression */ + if (node.kind >= 282 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 291 /* SyntaxKind.JsxExpression */ || node.kind === 11 /* SyntaxKind.JsxText */ || node.kind === 29 /* SyntaxKind.LessThanToken */ || node.kind === 31 /* SyntaxKind.GreaterThanToken */ @@ -129904,7 +131104,7 @@ var ts; || node.kind === 43 /* SyntaxKind.SlashToken */) { node = node.parent; } - else if (node.kind === 278 /* SyntaxKind.JsxElement */) { + else if (node.kind === 281 /* SyntaxKind.JsxElement */) { if (position > node.getStart(sourceFile)) return true; node = node.parent; @@ -130052,7 +131252,7 @@ var ts; // falls through case 112 /* SyntaxKind.TypeOfKeyword */: case 94 /* SyntaxKind.ExtendsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: case 24 /* SyntaxKind.DotToken */: case 51 /* SyntaxKind.BarToken */: case 57 /* SyntaxKind.QuestionToken */: @@ -130073,7 +131273,7 @@ var ts; /** * Returns true if the cursor at position in sourceFile is within a comment. * - * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position) + * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position)` * @param predicate Additional predicate to test on the comment range. */ function isInComment(sourceFile, position, tokenAtPosition) { @@ -130104,7 +131304,7 @@ var ts; result.push("public" /* ScriptElementKindModifier.publicMemberModifier */); if (flags & 32 /* ModifierFlags.Static */ || ts.isClassStaticBlockDeclaration(node)) result.push("static" /* ScriptElementKindModifier.staticModifier */); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push("abstract" /* ScriptElementKindModifier.abstractModifier */); if (flags & 1 /* ModifierFlags.Export */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); @@ -130112,16 +131312,16 @@ var ts; result.push("deprecated" /* ScriptElementKindModifier.deprecatedModifier */); if (node.flags & 16777216 /* NodeFlags.Ambient */) result.push("declare" /* ScriptElementKindModifier.ambientModifier */); - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); return result.length > 0 ? result.join(",") : "" /* ScriptElementKindModifier.none */; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 210 /* SyntaxKind.CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return node.typeParameters; } return undefined; @@ -130166,18 +131366,18 @@ var ts; } ts.cloneCompilerOptions = cloneCompilerOptions; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || - node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || + node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + if (node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return true; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -130185,7 +131385,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -130247,32 +131447,32 @@ var ts; } ts.createTextChange = createTextChange; ts.typeKeywords = [ - 130 /* SyntaxKind.AnyKeyword */, - 128 /* SyntaxKind.AssertsKeyword */, - 158 /* SyntaxKind.BigIntKeyword */, - 133 /* SyntaxKind.BooleanKeyword */, + 131 /* SyntaxKind.AnyKeyword */, + 129 /* SyntaxKind.AssertsKeyword */, + 160 /* SyntaxKind.BigIntKeyword */, + 134 /* SyntaxKind.BooleanKeyword */, 95 /* SyntaxKind.FalseKeyword */, - 137 /* SyntaxKind.InferKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 143 /* SyntaxKind.NeverKeyword */, + 138 /* SyntaxKind.InferKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 144 /* SyntaxKind.NeverKeyword */, 104 /* SyntaxKind.NullKeyword */, - 147 /* SyntaxKind.NumberKeyword */, - 148 /* SyntaxKind.ObjectKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 150 /* SyntaxKind.StringKeyword */, - 151 /* SyntaxKind.SymbolKeyword */, + 148 /* SyntaxKind.NumberKeyword */, + 149 /* SyntaxKind.ObjectKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 152 /* SyntaxKind.StringKeyword */, + 153 /* SyntaxKind.SymbolKeyword */, 110 /* SyntaxKind.TrueKeyword */, 114 /* SyntaxKind.VoidKeyword */, - 153 /* SyntaxKind.UndefinedKeyword */, - 154 /* SyntaxKind.UniqueKeyword */, - 155 /* SyntaxKind.UnknownKeyword */, + 155 /* SyntaxKind.UndefinedKeyword */, + 156 /* SyntaxKind.UniqueKeyword */, + 157 /* SyntaxKind.UnknownKeyword */, ]; function isTypeKeyword(kind) { return ts.contains(ts.typeKeywords, kind); } ts.isTypeKeyword = isTypeKeyword; function isTypeKeywordToken(node) { - return node.kind === 152 /* SyntaxKind.TypeKeyword */; + return node.kind === 154 /* SyntaxKind.TypeKeyword */; } ts.isTypeKeywordToken = isTypeKeywordToken; function isTypeKeywordTokenOrIdentifier(node) { @@ -130309,7 +131509,7 @@ var ts; } ts.skipConstraint = skipConstraint; function getNameFromPropertyName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ // treat computed property names where expression is string/numeric literal as just string/numeric literal ? ts.isStringOrNumericLiteralLike(name.expression) ? name.expression.text : undefined : ts.isPrivateIdentifier(name) ? ts.idText(name) : ts.getTextOfIdentifierOrLiteral(name); @@ -130459,7 +131659,7 @@ var ts; ts.findModifier = findModifier; function insertImports(changes, sourceFile, imports, blankLineBetween) { var decl = ts.isArray(imports) ? imports[0] : imports; - var importKindPredicate = decl.kind === 237 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; + var importKindPredicate = decl.kind === 240 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; var existingImportStatements = ts.filter(sourceFile.statements, importKindPredicate); var sortedNewImports = ts.isArray(imports) ? ts.stableSort(imports, ts.OrganizeImports.compareImportsOrRequireStatements) : [imports]; if (!existingImportStatements.length) { @@ -131133,15 +132333,15 @@ var ts; function getContextualTypeFromParent(node, checker) { var parent = node.parent; switch (parent.kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checker.getContextualType(parent); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var _a = parent, left = _a.left, operatorToken = _a.operatorToken, right = _a.right; return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node); } - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return parent.expression === node ? getSwitchedType(parent, checker) : undefined; default: return checker.getContextualType(node); @@ -131171,8 +132371,8 @@ var ts; switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return true; default: return false; @@ -131206,38 +132406,38 @@ var ts; } ts.getTypeNodeIfAccessible = getTypeNodeIfAccessible; function syntaxRequiresTrailingCommaOrSemicolonOrASI(kind) { - return kind === 174 /* SyntaxKind.CallSignature */ - || kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */; + return kind === 176 /* SyntaxKind.CallSignature */ + || kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */; } function syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind) { - return kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 264 /* SyntaxKind.ModuleDeclaration */; } function syntaxRequiresTrailingSemicolonOrASI(kind) { - return kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.syntaxRequiresTrailingSemicolonOrASI = syntaxRequiresTrailingSemicolonOrASI; ts.syntaxMayBeASICandidate = ts.or(syntaxRequiresTrailingCommaOrSemicolonOrASI, syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI, syntaxRequiresTrailingModuleBlockOrSemicolonOrASI, syntaxRequiresTrailingSemicolonOrASI); @@ -131267,7 +132467,7 @@ var ts; return false; } // See comment in parser’s `parseDoStatement` - if (node.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.kind === 243 /* SyntaxKind.DoStatement */) { return true; } var topNode = ts.findAncestor(node, function (ancestor) { return !ancestor.parent; }); @@ -131756,6 +132956,10 @@ var ts; return jsx === 2 /* JsxEmit.React */ || jsx === 3 /* JsxEmit.ReactNative */; } ts.jsxModeNeedsExplicitImport = jsxModeNeedsExplicitImport; + function isSourceFileFromLibrary(program, node) { + return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node); + } + ts.isSourceFileFromLibrary = isSourceFileFromLibrary; // #endregion })(ts || (ts = {})); /*@internal*/ @@ -131871,14 +133075,16 @@ var ts; search: function (importingFile, preferCapitalized, matches, action) { if (importingFile !== usableByFileName) return; - exportInfo.forEach(function (info, key) { + return ts.forEachEntry(exportInfo, function (info, key) { var _a = parseKey(key), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName; var name = preferCapitalized && info[0].capitalizedSymbolName || symbolName; if (matches(name, info[0].targetFlags)) { var rehydrated = info.map(rehydrateCachedInfo); var filtered = rehydrated.filter(function (r, i) { return isNotShadowedByDeeperNodeModulesPackage(r, info[i].packageName); }); if (filtered.length) { - action(filtered, name, !!ambientModuleName, key); + var res = action(filtered, name, !!ambientModuleName, key); + if (res !== undefined) + return res; } } }); @@ -132266,11 +133472,11 @@ var ts; angleBracketStack--; } break; - case 130 /* SyntaxKind.AnyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, @@ -132459,10 +133665,11 @@ var ts; return true; } switch (keyword2) { - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: return true; // Allow things like "public get", "public constructor" and "public static". default: return false; // Any other keyword following "public" is actually an identifier, not a real keyword. @@ -132509,7 +133716,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: case 34 /* SyntaxKind.EqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: @@ -132605,13 +133813,13 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -132833,46 +134041,46 @@ var ts; pos = tag.tagName.end; var commentStart = tag.tagName.end; switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var param = tag; processJSDocParameterTag(param); commentStart = param.isNameFirst && ((_a = param.typeExpression) === null || _a === void 0 ? void 0 : _a.end) || param.name.end; break; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var prop = tag; commentStart = prop.isNameFirst && ((_b = prop.typeExpression) === null || _b === void 0 ? void 0 : _b.end) || prop.name.end; break; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: processJSDocTemplateTag(tag); pos = tag.end; commentStart = tag.typeParameters.end; break; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: var type = tag; - commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 309 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; + commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 312 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; break; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: commentStart = tag.typeExpression.end; break; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = tag.typeExpression.end; break; - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: commentStart = tag.typeExpression.end; break; - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = ((_f = tag.typeExpression) === null || _f === void 0 ? void 0 : _f.end) || commentStart; break; - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: commentStart = ((_g = tag.name) === null || _g === void 0 ? void 0 : _g.end) || commentStart; break; - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: commentStart = tag.class.end; break; } @@ -132919,7 +134127,7 @@ var ts; // defined in `ts.commentPragmas` would be excessive, but we can avoid // some obvious false positives (e.g. in XML-like doc comments) by // checking the element name. - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!match[3] || !(match[3] in ts.commentPragmas)) { return false; } @@ -133029,22 +134237,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* ClassificationType.jsxOpenTagName */; } break; - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* ClassificationType.jsxCloseTagName */; } break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* ClassificationType.jsxSelfClosingTagName */; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: if (token.parent.name === token) { return 22 /* ClassificationType.jsxAttribute */; } @@ -133073,17 +134281,17 @@ var ts; var parent = token.parent; if (tokenKind === 63 /* SyntaxKind.EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 164 /* SyntaxKind.Parameter */ || - parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 166 /* SyntaxKind.Parameter */ || + parent.kind === 288 /* SyntaxKind.JsxAttribute */) { return 5 /* ClassificationType.operator */; } } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ || - parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || - parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */ || - parent.kind === 222 /* SyntaxKind.ConditionalExpression */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ || + parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || + parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */ || + parent.kind === 224 /* SyntaxKind.ConditionalExpression */) { return 5 /* ClassificationType.operator */; } } @@ -133096,7 +134304,7 @@ var ts; return 25 /* ClassificationType.bigintLiteral */; } else if (tokenKind === 10 /* SyntaxKind.StringLiteral */) { - return token && token.parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; + return token && token.parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; } else if (tokenKind === 13 /* SyntaxKind.RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -133112,32 +134320,32 @@ var ts; else if (tokenKind === 79 /* SyntaxKind.Identifier */) { if (token) { switch (token.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (token.parent.name === token) { return 11 /* ClassificationType.className */; } return; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: if (token.parent.name === token) { return 15 /* ClassificationType.typeParameterName */; } return; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* ClassificationType.interfaceName */; } return; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (token.parent.name === token) { return 12 /* ClassificationType.enumName */; } return; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (token.parent.name === token) { return 14 /* ClassificationType.moduleName */; } return; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (token.parent.name === token) { return ts.isThisIdentifier(token) ? 3 /* ClassificationType.keyword */ : 17 /* ClassificationType.parameterName */; } @@ -133242,13 +134450,13 @@ var ts; var inJSXElement = false; function visit(node) { switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!node || !ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) { @@ -133288,7 +134496,7 @@ var ts; if (modifiers & 32 /* ModifierFlags.Static */) { modifierSet |= 1 << 1 /* TokenModifier.static */; } - if (modifiers & 256 /* ModifierFlags.Async */) { + if (modifiers & 512 /* ModifierFlags.Async */) { modifierSet |= 1 << 2 /* TokenModifier.async */; } if (typeIdx !== 0 /* TokenType.class */ && typeIdx !== 2 /* TokenType.interface */) { @@ -133394,25 +134602,25 @@ var ts; return (ts.isQualifiedName(node.parent) && node.parent.right === node) || (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node); } var tokenFromDeclarationMapping = new ts.Map([ - [254 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], - [164 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], - [167 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], - [261 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], - [260 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], - [299 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], - [257 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], - [169 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], - [256 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], - [213 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], - [168 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], - [172 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], - [173 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], - [166 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], - [258 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], - [259 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], - [163 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], - [296 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], - [297 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] + [257 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], + [166 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], + [169 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], + [264 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], + [263 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], + [302 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], + [260 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], + [171 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], + [259 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], + [215 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], + [170 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], + [174 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], + [175 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], + [168 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], + [261 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], + [262 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], + [165 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], + [299 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], + [300 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] ]); })(v2020 = classifier.v2020 || (classifier.v2020 = {})); })(classifier = ts.classifier || (ts.classifier = {})); @@ -133546,18 +134754,18 @@ var ts; function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host, preferences) { var parent = walkUpParentheses(node.parent); switch (parent.kind) { - case 196 /* SyntaxKind.LiteralType */: { + case 198 /* SyntaxKind.LiteralType */: { var grandParent_1 = walkUpParentheses(parent.parent); switch (grandParent_1.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: { var typeArgument = ts.findAncestor(parent, function (n) { return n.parent === grandParent_1; }); if (typeArgument) { return { kind: 2 /* StringLiteralCompletionKind.Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false }; } return undefined; } - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: // Get all apparent property names // i.e. interface Foo { // foo: string; @@ -133569,9 +134777,9 @@ var ts; return undefined; } return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType)); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return { kind: 0 /* StringLiteralCompletionKind.Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; - case 187 /* SyntaxKind.UnionType */: { + case 189 /* SyntaxKind.UnionType */: { if (!ts.isTypeReferenceNode(grandParent_1.parent)) { return undefined; } @@ -133583,7 +134791,7 @@ var ts; return undefined; } } - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isObjectLiteralExpression(parent.parent) && parent.name === node) { // Get quoted name of properties of the object literal expression // i.e. interface ConfigFiles { @@ -133600,7 +134808,7 @@ var ts; return stringLiteralCompletionsForObjectLiteral(typeChecker, parent.parent); } return fromContextualType(); - case 207 /* SyntaxKind.ElementAccessExpression */: { + case 209 /* SyntaxKind.ElementAccessExpression */: { var _b = parent, expression = _b.expression, argumentExpression = _b.argumentExpression; if (node === ts.skipParentheses(argumentExpression)) { // Get all names of properties on the expression @@ -133613,20 +134821,20 @@ var ts; } return undefined; } - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 285 /* SyntaxKind.JsxAttribute */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 288 /* SyntaxKind.JsxAttribute */: if (!isRequireCallArgument(node) && !ts.isImportCall(parent)) { - var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); + var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); // Get string literal completions from specialized signatures of the target // i.e. declare function f(a: 'A'); // f("/*completion position*/") - return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) : fromContextualType(); + return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(); } // falls through (is `require("")` or `require(""` or `import("")`) - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 277 /* SyntaxKind.ExternalModuleReference */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 280 /* SyntaxKind.ExternalModuleReference */: // Get all known external module names or complete a path to a module // i.e. import * as ns from "/*completion position*/"; // var y = import("/*completion position*/"); @@ -133645,9 +134853,9 @@ var ts; } function walkUpParentheses(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return ts.walkUpParenthesizedTypes(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return ts.walkUpParenthesizedExpressions(node); default: return node; @@ -133677,7 +134885,7 @@ var ts; isNewIdentifier = isNewIdentifier || !!(type.flags & 4 /* TypeFlags.String */); return getStringLiteralTypes(type, uniques); }); - return { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier }; + return ts.length(types) ? { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier } : undefined; } function stringLiteralCompletionsFromProperties(type) { return type && { @@ -134195,7 +135403,7 @@ var ts; if (!dependencies) continue; for (var dep in dependencies) { - if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { + if (ts.hasProperty(dependencies, dep) && !ts.startsWith(dep, "@types/")) { result.push(dep); } } @@ -134570,7 +135778,7 @@ var ts; } function keywordFiltersFromSyntaxKind(keywordCompletion) { switch (keywordCompletion) { - case 152 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; + case 154 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; default: ts.Debug.fail("Unknown mapping from SyntaxKind to KeywordCompletionFilters"); } } @@ -134579,7 +135787,7 @@ var ts; return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* SyntaxKind.Identifier */ ? ts.createTextSpanFromNode(location) : undefined; } function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) { - var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importCompletionNode = completionData.importCompletionNode, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; + var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importStatementCompletion = completionData.importStatementCompletion, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; // Verify if the file is JSX language variant if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* LanguageVariant.JSX */) { var completionInfo = getJsxClosingTagCompletion(location, sourceFile); @@ -134593,7 +135801,7 @@ var ts; return undefined; } var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, - /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); + /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); if (keywordFilters !== 0 /* KeywordCompletionFilters.None */) { for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) { var keywordEntry = _a[_i]; @@ -134646,12 +135854,12 @@ var ts; // We wanna walk up the tree till we find a JSX closing element var jsxClosingElement = ts.findAncestor(location, function (node) { switch (node.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: return true; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return false; default: return "quit"; @@ -134711,7 +135919,7 @@ var ts; function createCompletionEntryForLiteral(sourceFile, preferences, literal) { return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* ScriptElementKind.string */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.LocationPriority }; } - function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { + function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { var _a, _b; var insertText; var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken); @@ -134767,8 +135975,8 @@ var ts; } if (originIsResolvedExport(origin)) { sourceDisplay = [ts.textPart(origin.moduleSpecifier)]; - if (importCompletionNode) { - (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); + if (importStatementCompletion) { + (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined; } } @@ -134778,7 +135986,7 @@ var ts; if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* CompletionKind.MemberLike */ && - isClassLikeMemberCompletion(symbol, location)) { + isClassLikeMemberCompletion(symbol, location, sourceFile)) { var importAdder = void 0; (_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder, replacementSpan = _b.replacementSpan); sortText = Completions.SortText.ClassMemberSnippets; // sortText has to be lower priority than the sortText for keywords. See #47852. @@ -134823,7 +136031,7 @@ var ts; } if (originIsExport(origin) || originIsResolvedExport(origin)) { data = originToCompletionEntryData(origin); - hasAction = !importCompletionNode; + hasAction = !importStatementCompletion; } // TODO(drosen): Right now we just permit *all* semantic meanings when calling // 'getSymbolKind' which is permissible given that it is backwards compatible; but @@ -134846,11 +136054,11 @@ var ts; labelDetails: labelDetails, isSnippet: isSnippet, isPackageJsonImport: originIsPackageJsonImport(origin) || undefined, - isImportStatementCompletion: !!importCompletionNode || undefined, + isImportStatementCompletion: !!importStatementCompletion || undefined, data: data, }; } - function isClassLikeMemberCompletion(symbol, location) { + function isClassLikeMemberCompletion(symbol, location, sourceFile) { // TODO: support JS files. if (ts.isInJSFile(location)) { return false; @@ -134884,6 +136092,7 @@ var ts; location.parent.parent && ts.isClassElement(location.parent) && location === location.parent.name && + location.parent.getLastToken(sourceFile) === location.parent.name && ts.isClassLike(location.parent.parent)) || (location.parent && ts.isSyntaxList(location) && @@ -134925,7 +136134,7 @@ var ts; // Whether the suggested member should be abstract. // e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`. var _a = getPresentModifiers(contextToken), presentModifiers = _a.modifiers, modifiersSpan = _a.span; - var isAbstract = !!(presentModifiers & 128 /* ModifierFlags.Abstract */); + var isAbstract = !!(presentModifiers & 256 /* ModifierFlags.Abstract */); var completionNodes = []; ts.codefix.addNewNodeForMemberSymbol(symbol, classLikeDeclaration, sourceFile, { program: program, host: host }, preferences, importAdder, // `addNewNodeForMemberSymbol` calls this callback function for each new member node @@ -134938,7 +136147,7 @@ var ts; function (node) { var requiredModifiers = 0 /* ModifierFlags.None */; if (isAbstract) { - requiredModifiers |= 128 /* ModifierFlags.Abstract */; + requiredModifiers |= 256 /* ModifierFlags.Abstract */; } if (ts.isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* MemberOverrideStatus.NeedsOverride */) { @@ -134999,7 +136208,7 @@ var ts; span = ts.createTextSpanFromNode(contextToken); } if (ts.isPropertyDeclaration(contextToken.parent)) { - modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 125951 /* ModifierFlags.Modifier */; + modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 126975 /* ModifierFlags.Modifier */; span = ts.createTextSpanFromNode(contextToken.parent); } return { modifiers: modifiers, span: span }; @@ -135048,7 +136257,6 @@ var ts; var labelDetails = { detail: signaturePrinter.printNode(4 /* EmitHint.Unspecified */, methodSignature, sourceFile) }; return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails }; } - ; function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) { var declarations = symbol.getDeclarations(); if (!(declarations && declarations.length)) { @@ -135061,10 +136269,10 @@ var ts; var quotePreference = ts.getQuotePreference(sourceFile, preferences); var builderFlags = 33554432 /* NodeBuilderFlags.OmitThisParameter */ | (quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : 0 /* NodeBuilderFlags.None */); switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: { var effectiveType = type.flags & 1048576 /* TypeFlags.Union */ && type.types.length < 10 ? checker.getUnionType(type.types, 2 /* UnionReduction.Subtype */) : type; @@ -135098,7 +136306,8 @@ var ts; } var parameters = typeNode.parameters.map(function (typedParam) { return ts.factory.createParameterDeclaration( - /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, typedParam.questionToken, + /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, + /*questionToken*/ undefined, /*type*/ undefined, typedParam.initializer); }); return ts.factory.createMethodDeclaration( @@ -135218,20 +136427,17 @@ var ts; }; return unresolvedOrigin; } - function getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences) { - var _a, _b, _c; - var sourceFile = importCompletionNode.getSourceFile(); - var replacementSpan = ts.createTextSpanFromNode(ts.findAncestor(importCompletionNode, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)) || importCompletionNode, sourceFile); + function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) { + var replacementSpan = importStatementCompletion.replacementSpan; var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier); var exportKind = origin.isDefaultExport ? 1 /* ExportKind.Default */ : origin.exportName === "export=" /* InternalSymbolName.ExportEquals */ ? 2 /* ExportKind.ExportEquals */ : 0 /* ExportKind.Named */; var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : ""; var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options, /*forceImportKeyword*/ true); - var isTopLevelTypeOnly = ((_b = (_a = ts.tryCast(importCompletionNode, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || ((_c = ts.tryCast(importCompletionNode, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly); - var isImportSpecifierTypeOnly = couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); - var topLevelTypeOnlyText = isTopLevelTypeOnly ? " ".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : " "; - var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : ""; + var isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier; + var topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " "; + var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : ""; var suffix = useSemicolons ? ";" : ""; switch (importKind) { case 3 /* ImportKind.CommonJS */: return { replacementSpan: replacementSpan, insertText: "import".concat(topLevelTypeOnlyText).concat(ts.escapeSnippetText(name)).concat(tabStop, " = require(").concat(quotedModuleSpecifier, ")").concat(suffix) }; @@ -135264,7 +136470,7 @@ var ts; return CompletionSource.TypeOnlyAlias; } } - function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { + function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { var _a; var start = ts.timestamp(); var variableDeclaration = getVariableDeclaration(location); @@ -135285,7 +136491,7 @@ var ts; var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess; var originalSortText = (_a = symbolToSortTextMap === null || symbolToSortTextMap === void 0 ? void 0 : symbolToSortTextMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : Completions.SortText.LocationPriority; var sortText = (isDeprecated(symbol, typeChecker) ? Completions.SortText.Deprecated(originalSortText) : originalSortText); - var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); + var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); if (!entry) { continue; } @@ -135445,7 +136651,7 @@ var ts; } case "symbol": { var symbol = symbolCompletion.symbol, location = symbolCompletion.location, contextToken_2 = symbolCompletion.contextToken, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken; - var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; + var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); // TODO: GH#18217 } case "literal": { @@ -135474,9 +136680,9 @@ var ts; return { name: name, kindModifiers: kindModifiers, kind: kind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source, sourceDisplay: source }; } Completions.createCompletionDetails = createCompletionDetails; - function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) { + function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) { if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) { - if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementNode) { + if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) { // Import statement completion: 'import c|' return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] }; } @@ -135506,7 +136712,7 @@ var ts; var moduleSymbol = origin.moduleSymbol; var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker)); var isJsxOpeningTagName = (contextToken === null || contextToken === void 0 ? void 0 : contextToken.kind) === 29 /* SyntaxKind.LessThanToken */ && ts.isJsxOpeningLikeElement(contextToken.parent); - var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; + var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences, cancellationToken), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier); return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] }; } @@ -135549,11 +136755,11 @@ var ts; return ts.getContextualTypeFromParent(previousToken, checker); case 63 /* SyntaxKind.EqualsToken */: switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.getContextualType(parent.initializer); // TODO: GH#18217 - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checker.getTypeAtLocation(parent.left); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return checker.getContextualTypeForJsxAttribute(parent); default: return undefined; @@ -135584,7 +136790,7 @@ var ts; } function isModuleSymbol(symbol) { var _a; - return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 305 /* SyntaxKind.SourceFile */; })); + return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 308 /* SyntaxKind.SourceFile */; })); } function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) { var typeChecker = program.getTypeChecker(); @@ -135641,7 +136847,7 @@ var ts; currentToken = ts.getTokenAtPosition(sourceFile, position); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 347 /* SyntaxKind.JSDocPropertyTag */ || + (currentToken.parent.kind !== 350 /* SyntaxKind.JSDocPropertyTag */ || currentToken.parent.name !== currentToken))) { // Use as type location if inside tag's type expression insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression); @@ -135677,34 +136883,34 @@ var ts; var isStartingCloseTag = false; var isJsxInitializer = false; var isJsxIdentifierExpected = false; - var importCompletionNode; + var importStatementCompletion; var location = ts.getTouchingPropertyName(sourceFile, position); var keywordFilters = 0 /* KeywordCompletionFilters.None */; var isNewIdentifierLocation = false; var flags = 0 /* CompletionInfoFlags.None */; if (contextToken) { - var importStatementCompletion = getImportStatementCompletionInfo(contextToken); - isNewIdentifierLocation = importStatementCompletion.isNewIdentifierLocation; - if (importStatementCompletion.keywordCompletion) { - if (importStatementCompletion.isKeywordOnlyCompletion) { + var importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken); + if (importStatementCompletionInfo.keywordCompletion) { + if (importStatementCompletionInfo.isKeywordOnlyCompletion) { return { kind: 4 /* CompletionDataKind.Keywords */, - keywordCompletions: [keywordToCompletionEntry(importStatementCompletion.keywordCompletion)], - isNewIdentifierLocation: isNewIdentifierLocation, + keywordCompletions: [keywordToCompletionEntry(importStatementCompletionInfo.keywordCompletion)], + isNewIdentifierLocation: importStatementCompletionInfo.isNewIdentifierLocation, }; } - keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletion.keywordCompletion); + keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletionInfo.keywordCompletion); } - if (importStatementCompletion.replacementNode && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { + if (importStatementCompletionInfo.replacementSpan && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { // Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier` // added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients // to opt in with the `includeCompletionsForImportStatements` user preference. - importCompletionNode = importStatementCompletion.replacementNode; flags |= 2 /* CompletionInfoFlags.IsImportStatementCompletion */; + importStatementCompletion = importStatementCompletionInfo; + isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation; } // Bail out if this is a known invalid completion location - if (!importCompletionNode && isCompletionListBlocker(contextToken)) { + if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) { log("Returning an empty list because completion was requested in an invalid position."); return keywordFilters ? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation()) @@ -135715,7 +136921,7 @@ var ts; isRightOfDot = contextToken.kind === 24 /* SyntaxKind.DotToken */; isRightOfQuestionDot = contextToken.kind === 28 /* SyntaxKind.QuestionDotToken */; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; var leftmostAccessExpression = ts.getLeftmostAccessExpression(propertyAccessToConvert); @@ -135731,16 +136937,16 @@ var ts; return undefined; } break; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: node = parent.left; break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: node = parent.name; break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: node = parent; break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: node = parent.getFirstToken(sourceFile); ts.Debug.assert(node.kind === 100 /* SyntaxKind.ImportKeyword */ || node.kind === 103 /* SyntaxKind.NewKeyword */); break; @@ -135750,11 +136956,11 @@ var ts; return undefined; } } - else if (!importCompletionNode && sourceFile.languageVariant === 1 /* LanguageVariant.JSX */) { + else if (!importStatementCompletion) { // // If the tagname is a property access expression, we will then walk up to the top most of property access expression. // Then, try to get a JSX container and its associated attributes type. - if (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { contextToken = parent; parent = parent.parent; } @@ -135762,46 +136968,46 @@ var ts; if (currentToken.parent === location) { switch (currentToken.kind) { case 31 /* SyntaxKind.GreaterThanToken */: - if (currentToken.parent.kind === 278 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (currentToken.parent.kind === 281 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { location = currentToken; } break; case 43 /* SyntaxKind.SlashToken */: - if (currentToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { + if (currentToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { location = currentToken; } break; } } switch (parent.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (contextToken.kind === 43 /* SyntaxKind.SlashToken */) { isStartingCloseTag = true; location = contextToken; } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (!binaryExpressionMayBeOpenTag(parent)) { break; } // falls through - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: isJsxIdentifierExpected = true; if (contextToken.kind === 29 /* SyntaxKind.LessThanToken */) { isRightOfOpenTag = true; location = contextToken; } break; - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: // For `
`, `parent` will be `{true}` and `previousToken` will be `}` if (previousToken.kind === 19 /* SyntaxKind.CloseBraceToken */ && currentToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { isJsxIdentifierExpected = true; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: // For `
`, `parent` will be JsxAttribute and `previousToken` will be its initializer if (parent.initializer === previousToken && previousToken.end < position) { @@ -135893,19 +137099,19 @@ var ts; isTypeOnlyLocation: isTypeOnlyLocation, isJsxIdentifierExpected: isJsxIdentifierExpected, isRightOfOpenTag: isRightOfOpenTag, - importCompletionNode: importCompletionNode, + importStatementCompletion: importStatementCompletion, hasUnresolvedAutoImports: hasUnresolvedAutoImports, flags: flags, }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return true; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return !!tag.constraint; default: return false; @@ -135914,7 +137120,7 @@ var ts; function tryGetTypeExpressionFromTag(tag) { if (isTagWithTypeExpression(tag)) { var typeExpression = ts.isJSDocTemplateTag(tag) ? tag.constraint : tag.typeExpression; - return typeExpression && typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; + return typeExpression && typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; } return undefined; } @@ -135957,7 +137163,7 @@ var ts; // If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods). if (!isTypeLocation && symbol.declarations && - symbol.declarations.some(function (d) { return d.kind !== 305 /* SyntaxKind.SourceFile */ && d.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 260 /* SyntaxKind.EnumDeclaration */; })) { + symbol.declarations.some(function (d) { return d.kind !== 308 /* SyntaxKind.SourceFile */ && d.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 263 /* SyntaxKind.EnumDeclaration */; })) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node).getNonOptionalType(); var insertQuestionDot = false; if (type.isNullableType()) { @@ -136003,7 +137209,7 @@ var ts; if (isRightOfQuestionDot && ts.some(type.getCallSignatures())) { isNewIdentifierLocation = true; } - var propertyAccess = node.kind === 200 /* SyntaxKind.ImportType */ ? node : node.parent; + var propertyAccess = node.kind === 202 /* SyntaxKind.ImportType */ ? node : node.parent; if (inCheckedFile) { for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { var symbol = _a[_i]; @@ -136147,7 +137353,7 @@ var ts; return 1 /* GlobalsSearch.Success */; } function tryGetImportCompletionSymbols() { - if (!importCompletionNode) + if (!importStatementCompletion) return 0 /* GlobalsSearch.Continue */; isNewIdentifierLocation = true; collectAutoImports(); @@ -136210,7 +137416,7 @@ var ts; } } // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions` - if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 305 /* SyntaxKind.SourceFile */) { + if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 308 /* SyntaxKind.SourceFile */) { var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false, ts.isClassLike(scopeNode.parent) ? scopeNode : undefined); if (thisType && !isProbablyGlobalType(thisType, sourceFile, typeChecker)) { for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) { @@ -136230,7 +137436,7 @@ var ts; } function shouldOfferImportCompletions() { // If already typing an import statement, provide completions for it. - if (importCompletionNode) + if (importStatementCompletion) return true; // If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols if (isNonContextualObjectLiteral) @@ -136249,10 +137455,10 @@ var ts; } function isSnippetScope(scopeNode) { switch (scopeNode.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 223 /* SyntaxKind.TemplateExpression */: - case 288 /* SyntaxKind.JsxExpression */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 225 /* SyntaxKind.TemplateExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 238 /* SyntaxKind.Block */: return true; default: return ts.isStatement(scopeNode); @@ -136260,7 +137466,7 @@ var ts; } function isTypeOnlyCompletion() { return insideJsDocTagTypeExpression - || !!importCompletionNode && ts.isTypeOnlyImportOrExportDeclaration(location.parent) + || !!importStatementCompletion && ts.isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || ts.isPartOfTypeNode(location) @@ -136269,28 +137475,30 @@ var ts; function isContextTokenValueLocation(contextToken) { return contextToken && ((contextToken.kind === 112 /* SyntaxKind.TypeOfKeyword */ && - (contextToken.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || - (contextToken.kind === 128 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 177 /* SyntaxKind.TypePredicate */)); + (contextToken.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || + (contextToken.kind === 129 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 179 /* SyntaxKind.TypePredicate */)); } function isContextTokenTypeLocation(contextToken) { if (contextToken) { var parentKind = contextToken.parent.kind; switch (contextToken.kind) { case 58 /* SyntaxKind.ColonToken */: - return parentKind === 167 /* SyntaxKind.PropertyDeclaration */ || - parentKind === 166 /* SyntaxKind.PropertySignature */ || - parentKind === 164 /* SyntaxKind.Parameter */ || - parentKind === 254 /* SyntaxKind.VariableDeclaration */ || + return parentKind === 169 /* SyntaxKind.PropertyDeclaration */ || + parentKind === 168 /* SyntaxKind.PropertySignature */ || + parentKind === 166 /* SyntaxKind.Parameter */ || + parentKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(parentKind); case 63 /* SyntaxKind.EqualsToken */: - return parentKind === 259 /* SyntaxKind.TypeAliasDeclaration */; - case 127 /* SyntaxKind.AsKeyword */: - return parentKind === 229 /* SyntaxKind.AsExpression */; + return parentKind === 262 /* SyntaxKind.TypeAliasDeclaration */; + case 128 /* SyntaxKind.AsKeyword */: + return parentKind === 231 /* SyntaxKind.AsExpression */; case 29 /* SyntaxKind.LessThanToken */: - return parentKind === 178 /* SyntaxKind.TypeReference */ || - parentKind === 211 /* SyntaxKind.TypeAssertionExpression */; + return parentKind === 180 /* SyntaxKind.TypeReference */ || + parentKind === 213 /* SyntaxKind.TypeAssertionExpression */; case 94 /* SyntaxKind.ExtendsKeyword */: - return parentKind === 163 /* SyntaxKind.TypeParameter */; + return parentKind === 165 /* SyntaxKind.TypeParameter */; + case 150 /* SyntaxKind.SatisfiesKeyword */: + return parentKind === 235 /* SyntaxKind.SatisfiesExpression */; } } return false; @@ -136308,8 +137516,7 @@ var ts; flags |= 1 /* CompletionInfoFlags.MayIncludeAutoImports */; // import { type | -> token text should be blank var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken - && importCompletionNode - && couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); + && importStatementCompletion; var lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" : previousToken && ts.isIdentifier(previousToken) ? previousToken.text.toLowerCase() : ""; @@ -136317,14 +137524,14 @@ var ts; var exportInfo = ts.getExportInfoMap(sourceFile, host, program, preferences, cancellationToken); var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host); var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host); - resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importCompletionNode, ts.isValidTypeOnlyAliasUseSite(location), function (context) { + resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importStatementCompletion, ts.isValidTypeOnlyAliasUseSite(location), function (context) { exportInfo.search(sourceFile.path, /*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) { if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings()))) return false; if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName)) return false; - if (!isTypeOnlyLocation && !importCompletionNode && !(targetFlags & 111551 /* SymbolFlags.Value */)) + if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & 111551 /* SymbolFlags.Value */)) return false; if (isTypeOnlyLocation && !(targetFlags & (1536 /* SymbolFlags.Module */ | 788968 /* SymbolFlags.Type */))) return false; @@ -136405,7 +137612,7 @@ var ts; return; } symbolToOriginInfoMap[symbols.length] = origin; - symbolToSortTextMap[symbolId] = importCompletionNode ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; + symbolToSortTextMap[symbolId] = importStatementCompletion ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; symbols.push(symbol); } /* Mutates `symbols` and `symbolToOriginInfoMap`. */ @@ -136481,18 +137688,18 @@ var ts; // - contextToken: GreaterThanToken (before cursor) // - location: JsxSelfClosingElement or JsxOpeningElement // - contextToken.parent === location - if (location === contextToken.parent && (location.kind === 280 /* SyntaxKind.JsxOpeningElement */ || location.kind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (location === contextToken.parent && (location.kind === 283 /* SyntaxKind.JsxOpeningElement */ || location.kind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { return false; } - if (contextToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (contextToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { //
/**/ // - contextToken: GreaterThanToken (before cursor) // - location: JSXElement // - different parents (JSXOpeningElement, JSXElement) - return location.parent.kind !== 280 /* SyntaxKind.JsxOpeningElement */; + return location.parent.kind !== 283 /* SyntaxKind.JsxOpeningElement */; } - if (contextToken.parent.kind === 281 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { - return !!contextToken.parent.parent && contextToken.parent.parent.kind === 278 /* SyntaxKind.JsxElement */; + if (contextToken.parent.kind === 284 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { + return !!contextToken.parent.parent && contextToken.parent.parent.kind === 281 /* SyntaxKind.JsxElement */; } } return false; @@ -136504,44 +137711,44 @@ var ts; // Previous token may have been a keyword that was converted to an identifier. switch (tokenKind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( a, | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a, | - || containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [a, | - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */ // const x = (a, | - || containingNodeKind === 179 /* SyntaxKind.FunctionType */ // var x: (s: string, list| - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( a, | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a, | + || containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [a, | + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */ // const x = (a, | + || containingNodeKind === 181 /* SyntaxKind.FunctionType */ // var x: (s: string, list| + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( | - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a| - || containingNodeKind === 212 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| - || containingNodeKind === 191 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( | + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a| + || containingNodeKind === 214 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 193 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [ | - || containingNodeKind === 176 /* SyntaxKind.IndexSignature */ // [ | : string ] - || containingNodeKind === 162 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ - case 141 /* SyntaxKind.ModuleKeyword */: // module | - case 142 /* SyntaxKind.NamespaceKeyword */: // namespace | + return containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [ | + || containingNodeKind === 178 /* SyntaxKind.IndexSignature */ // [ | : string ] + || containingNodeKind === 164 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ + case 142 /* SyntaxKind.ModuleKeyword */: // module | + case 143 /* SyntaxKind.NamespaceKeyword */: // namespace | case 100 /* SyntaxKind.ImportKeyword */: // import | return true; case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 261 /* SyntaxKind.ModuleDeclaration */; // module A.| + return containingNodeKind === 264 /* SyntaxKind.ModuleDeclaration */; // module A.| case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ // class A { | - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ // class A { | + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | case 63 /* SyntaxKind.EqualsToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ // const x = a| - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */; // x = a| + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ // const x = a| + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */; // x = a| case 15 /* SyntaxKind.TemplateHead */: - return containingNodeKind === 223 /* SyntaxKind.TemplateExpression */; // `aa ${| + return containingNodeKind === 225 /* SyntaxKind.TemplateExpression */; // `aa ${| case 16 /* SyntaxKind.TemplateMiddle */: - return containingNodeKind === 233 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| - case 131 /* SyntaxKind.AsyncKeyword */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() - || containingNodeKind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| + return containingNodeKind === 236 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| + case 132 /* SyntaxKind.AsyncKeyword */: + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() + || containingNodeKind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| case 41 /* SyntaxKind.AsteriskToken */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| } if (isClassMemberCompletionKeyword(tokenKind)) { return true; @@ -136591,7 +137798,7 @@ var ts; completionKind = 0 /* CompletionKind.ObjectPropertyDeclaration */; var typeMembers; var existingMembers; - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { var instantiatedType = tryGetObjectLiteralContextualType(objectLikeContainer, typeChecker); // Check completions for Object property value shorthand if (instantiatedType === undefined) { @@ -136616,7 +137823,7 @@ var ts; } } else { - ts.Debug.assert(objectLikeContainer.kind === 201 /* SyntaxKind.ObjectBindingPattern */); + ts.Debug.assert(objectLikeContainer.kind === 203 /* SyntaxKind.ObjectBindingPattern */); // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -136627,12 +137834,12 @@ var ts; // through type declaration or inference. // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed - // type of parameter will flow in from the contextual type of the function - var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */; - if (!canGetType && rootDeclaration.kind === 164 /* SyntaxKind.Parameter */) { + var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */; + if (!canGetType && rootDeclaration.kind === 166 /* SyntaxKind.Parameter */) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); } - else if (rootDeclaration.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (rootDeclaration.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 175 /* SyntaxKind.SetAccessor */) { canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -136651,7 +137858,7 @@ var ts; var filteredMembers = filterObjectMembersList(typeMembers, ts.Debug.checkDefined(existingMembers)); symbols = ts.concatenate(symbols, filteredMembers); setSortTextToOptionalMember(); - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && preferences.includeCompletionsWithObjectLiteralMethodSnippets && preferences.includeCompletionsWithInsertText) { transformObjectLiteralMembersSortText(symbolsStartIndex); @@ -136686,10 +137893,10 @@ var ts; keywordFilters = 8 /* KeywordCompletionFilters.TypeKeyword */; } // try to show exported member for imported/re-exported module - var moduleSpecifier = (namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; + var moduleSpecifier = (namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; if (!moduleSpecifier) { isNewIdentifierLocation = true; - return namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; + return namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; } var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); // TODO: GH#18217 if (!moduleSpecifierSymbol) { @@ -136834,11 +138041,11 @@ var ts; case 30 /* SyntaxKind.LessThanSlashToken */: case 43 /* SyntaxKind.SlashToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 286 /* SyntaxKind.JsxAttributes */: - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - if (parent && (parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 280 /* SyntaxKind.JsxOpeningElement */)) { + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 289 /* SyntaxKind.JsxAttributes */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + if (parent && (parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 283 /* SyntaxKind.JsxOpeningElement */)) { if (contextToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { var precedingToken = ts.findPrecedingToken(contextToken.pos, sourceFile, /*startNode*/ undefined); if (!parent.typeArguments || (precedingToken && precedingToken.kind === 43 /* SyntaxKind.SlashToken */)) @@ -136846,7 +138053,7 @@ var ts; } return parent; } - else if (parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + else if (parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136858,7 +138065,7 @@ var ts; // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 10 /* SyntaxKind.StringLiteral */: - if (parent && ((parent.kind === 285 /* SyntaxKind.JsxAttribute */) || (parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */))) { + if (parent && ((parent.kind === 288 /* SyntaxKind.JsxAttribute */) || (parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */))) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136868,8 +138075,8 @@ var ts; break; case 19 /* SyntaxKind.CloseBraceToken */: if (parent && - parent.kind === 288 /* SyntaxKind.JsxExpression */ && - parent.parent && parent.parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + parent.kind === 291 /* SyntaxKind.JsxExpression */ && + parent.parent && parent.parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136877,7 +138084,7 @@ var ts; // each JsxAttribute can have initializer as JsxExpression return parent.parent.parent.parent; } - if (parent && parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (parent && parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136897,54 +138104,54 @@ var ts; var containingNodeKind = parent.kind; switch (contextToken.kind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ || + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ || isVariableDeclarationListButNotTypeArgument(contextToken) || - containingNodeKind === 237 /* SyntaxKind.VariableStatement */ || - containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | + containingNodeKind === 240 /* SyntaxKind.VariableStatement */ || + containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | isFunctionLikeButNotConstructor(containingNodeKind) || - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A= contextToken.pos); case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [.| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [.| case 58 /* SyntaxKind.ColonToken */: - return containingNodeKind === 203 /* SyntaxKind.BindingElement */; // var {x :html| + return containingNodeKind === 205 /* SyntaxKind.BindingElement */; // var {x :html| case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [x| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [x| case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 292 /* SyntaxKind.CatchClause */ || + return containingNodeKind === 295 /* SyntaxKind.CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */; // enum a { | + return containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */; // enum a { | case 29 /* SyntaxKind.LessThanToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ || // class A< | - containingNodeKind === 226 /* SyntaxKind.ClassExpression */ || // var C = class D< | - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | - containingNodeKind === 259 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ || // class A< | + containingNodeKind === 228 /* SyntaxKind.ClassExpression */ || // var C = class D< | + containingNodeKind === 261 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | + containingNodeKind === 262 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | ts.isFunctionLikeKind(containingNodeKind); case 124 /* SyntaxKind.StaticKeyword */: - return containingNodeKind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); + return containingNodeKind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); case 25 /* SyntaxKind.DotDotDotToken */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ || - (!!parent.parent && parent.parent.kind === 202 /* SyntaxKind.ArrayBindingPattern */); // var [...z| + return containingNodeKind === 166 /* SyntaxKind.Parameter */ || + (!!parent.parent && parent.parent.kind === 204 /* SyntaxKind.ArrayBindingPattern */); // var [...z| case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); - case 127 /* SyntaxKind.AsKeyword */: - return containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ || - containingNodeKind === 275 /* SyntaxKind.ExportSpecifier */ || - containingNodeKind === 268 /* SyntaxKind.NamespaceImport */; - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + return containingNodeKind === 166 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); + case 128 /* SyntaxKind.AsKeyword */: + return containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ || + containingNodeKind === 278 /* SyntaxKind.ExportSpecifier */ || + containingNodeKind === 271 /* SyntaxKind.NamespaceImport */; + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: return !isFromObjectTypeDeclaration(contextToken); case 79 /* SyntaxKind.Identifier */: - if (containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ && + if (containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ && contextToken === parent.name && contextToken.text === "type") { // import { type | } @@ -136959,11 +138166,11 @@ var ts; case 100 /* SyntaxKind.ImportKeyword */: case 119 /* SyntaxKind.LetKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return true; - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: // import { type foo| } - return containingNodeKind !== 270 /* SyntaxKind.ImportSpecifier */; + return containingNodeKind !== 273 /* SyntaxKind.ImportSpecifier */; case 41 /* SyntaxKind.AsteriskToken */: return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent); } @@ -136988,7 +138195,7 @@ var ts; case 126 /* SyntaxKind.AbstractKeyword */: case 84 /* SyntaxKind.ClassKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 98 /* SyntaxKind.FunctionKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: @@ -136999,7 +138206,7 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: case 113 /* SyntaxKind.VarKeyword */: return true; - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return ts.isPropertyDeclaration(contextToken.parent); } // If we are inside a class declaration, and `constructor` is totally not present, @@ -137008,7 +138215,7 @@ var ts; if (ancestorClassLike && contextToken === previousToken && isPreviousPropertyDeclarationTerminated(contextToken, position)) { return false; // Don't block completions. } - var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 167 /* SyntaxKind.PropertyDeclaration */); + var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 169 /* SyntaxKind.PropertyDeclaration */); // If we are inside a class declaration and typing `constructor` after property declaration... if (ancestorPropertyDeclaraion && contextToken !== previousToken @@ -137040,7 +138247,7 @@ var ts; || !ts.positionsAreOnSameLine(contextToken.end, position, sourceFile)); } function isFunctionLikeButNotConstructor(kind) { - return ts.isFunctionLikeKind(kind) && kind !== 171 /* SyntaxKind.Constructor */; + return ts.isFunctionLikeKind(kind) && kind !== 173 /* SyntaxKind.Constructor */; } function isDotOfNumericLiteral(contextToken) { if (contextToken.kind === 8 /* SyntaxKind.NumericLiteral */) { @@ -137050,7 +138257,7 @@ var ts; return false; } function isVariableDeclarationListButNotTypeArgument(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && !ts.isPossiblyTypeArgumentPosition(node, sourceFile, typeChecker); } /** @@ -137068,13 +138275,13 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 296 /* SyntaxKind.PropertyAssignment */ && - m.kind !== 297 /* SyntaxKind.ShorthandPropertyAssignment */ && - m.kind !== 203 /* SyntaxKind.BindingElement */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */ && - m.kind !== 298 /* SyntaxKind.SpreadAssignment */) { + if (m.kind !== 299 /* SyntaxKind.PropertyAssignment */ && + m.kind !== 300 /* SyntaxKind.ShorthandPropertyAssignment */ && + m.kind !== 205 /* SyntaxKind.BindingElement */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */ && + m.kind !== 301 /* SyntaxKind.SpreadAssignment */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -137165,10 +138372,10 @@ var ts; for (var _i = 0, existingMembers_2 = existingMembers; _i < existingMembers_2.length; _i++) { var m = existingMembers_2[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (m.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -137210,7 +138417,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (attr.kind === 288 /* SyntaxKind.JsxAttribute */) { seenNames.add(attr.name.escapedText); } else if (ts.isJsxSpreadAttribute(attr)) { @@ -137308,7 +138515,7 @@ var ts; var _keywordCompletions = []; var allKeywordsCompletions = ts.memoize(function () { var res = []; - for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 160 /* SyntaxKind.LastKeyword */; i++) { + for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 162 /* SyntaxKind.LastKeyword */; i++) { res.push({ name: ts.tokenToString(i), kind: "keyword" /* ScriptElementKind.keyword */, @@ -137334,12 +138541,12 @@ var ts; return false; case 1 /* KeywordCompletionFilters.All */: return isFunctionLikeBodyKeyword(kind) - || kind === 135 /* SyntaxKind.DeclareKeyword */ - || kind === 141 /* SyntaxKind.ModuleKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ - || kind === 142 /* SyntaxKind.NamespaceKeyword */ + || kind === 136 /* SyntaxKind.DeclareKeyword */ + || kind === 142 /* SyntaxKind.ModuleKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ + || kind === 143 /* SyntaxKind.NamespaceKeyword */ || kind === 126 /* SyntaxKind.AbstractKeyword */ - || ts.isTypeKeyword(kind) && kind !== 153 /* SyntaxKind.UndefinedKeyword */; + || ts.isTypeKeyword(kind) && kind !== 155 /* SyntaxKind.UndefinedKeyword */; case 5 /* KeywordCompletionFilters.FunctionLikeBodyKeywords */: return isFunctionLikeBodyKeyword(kind); case 2 /* KeywordCompletionFilters.ClassElementKeywords */: @@ -137353,7 +138560,7 @@ var ts; case 7 /* KeywordCompletionFilters.TypeKeywords */: return ts.isTypeKeyword(kind); case 8 /* KeywordCompletionFilters.TypeKeyword */: - return kind === 152 /* SyntaxKind.TypeKeyword */; + return kind === 154 /* SyntaxKind.TypeKeyword */; default: return ts.Debug.assertNever(keywordFilter); } @@ -137362,59 +138569,61 @@ var ts; function isTypeScriptOnlyKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: case 117 /* SyntaxKind.ImplementsKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 139 /* SyntaxKind.IsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 140 /* SyntaxKind.IsKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return true; default: return false; } } function isInterfaceOrTypeLiteralCompletionKeyword(kind) { - return kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return kind === 146 /* SyntaxKind.ReadonlyKeyword */; } function isClassMemberCompletionKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; default: return ts.isClassMemberModifier(kind); } } function isFunctionLikeBodyKeyword(kind) { - return kind === 131 /* SyntaxKind.AsyncKeyword */ - || kind === 132 /* SyntaxKind.AwaitKeyword */ - || kind === 127 /* SyntaxKind.AsKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ + return kind === 132 /* SyntaxKind.AsyncKeyword */ + || kind === 133 /* SyntaxKind.AwaitKeyword */ + || kind === 128 /* SyntaxKind.AsKeyword */ + || kind === 150 /* SyntaxKind.SatisfiesKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); } function keywordForNode(node) { @@ -137439,7 +138648,7 @@ var ts; && contextToken === parent.moduleSpecifier && tokenLine === currentLine) { entries.push({ - name: ts.tokenToString(129 /* SyntaxKind.AssertKeyword */), + name: ts.tokenToString(130 /* SyntaxKind.AssertKeyword */), kind: "keyword" /* ScriptElementKind.keyword */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.GlobalsOrKeywords, @@ -137505,7 +138714,7 @@ var ts; function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) { // class c { method() { } | method2() { } } switch (location.kind) { - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.tryCast(location.parent, ts.isObjectTypeDeclaration); case 1 /* SyntaxKind.EndOfFileToken */: var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration); @@ -137531,7 +138740,7 @@ var ts; if (!contextToken) return undefined; // class C { blah; constructor/**/ } and so on - if (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ + if (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ // class C { blah \n constructor/**/ } || (ts.isIdentifier(contextToken) && ts.isPropertyDeclaration(contextToken.parent) && ts.isClassLike(location))) { return ts.findAncestor(contextToken, ts.isClassLike); @@ -137574,7 +138783,7 @@ var ts; case 26 /* SyntaxKind.SemicolonToken */: case 27 /* SyntaxKind.CommaToken */: case 79 /* SyntaxKind.Identifier */: - if (parent.kind === 166 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { + if (parent.kind === 168 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { return parent.parent; } break; @@ -137591,11 +138800,11 @@ var ts; if (!t) return undefined; switch (node.kind) { - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checker.getTypeOfPropertyOfContextualType(t, node.symbol.escapedName); - case 188 /* SyntaxKind.IntersectionType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 189 /* SyntaxKind.UnionType */: return t; } } @@ -137623,7 +138832,7 @@ var ts; ? !!ts.tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 43 /* SyntaxKind.SlashToken */ && ts.isJsxClosingElement(contextToken.parent)); case " ": - return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 305 /* SyntaxKind.SourceFile */; + return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 308 /* SyntaxKind.SourceFile */; default: return ts.Debug.assertNever(triggerCharacter); } @@ -137670,21 +138879,22 @@ var ts; return undefined; } function getImportStatementCompletionInfo(contextToken) { + var _a, _b, _c; var keywordCompletion; var isKeywordOnlyCompletion = false; var candidate = getCandidate(); return { isKeywordOnlyCompletion: isKeywordOnlyCompletion, keywordCompletion: keywordCompletion, - isNewIdentifierLocation: !!(candidate || keywordCompletion === 152 /* SyntaxKind.TypeKeyword */), - replacementNode: candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) - ? candidate - : undefined + isNewIdentifierLocation: !!(candidate || keywordCompletion === 154 /* SyntaxKind.TypeKeyword */), + isTopLevelTypeOnly: !!((_b = (_a = ts.tryCast(candidate, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || !!((_c = ts.tryCast(candidate, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly), + couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken), + replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate), }; function getCandidate() { var parent = contextToken.parent; if (ts.isImportEqualsDeclaration(parent)) { - keywordCompletion = contextToken.kind === 152 /* SyntaxKind.TypeKeyword */ ? undefined : 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = contextToken.kind === 154 /* SyntaxKind.TypeKeyword */ ? undefined : 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleReference) ? parent : undefined; } if (couldBeTypeOnlyImportSpecifier(parent, contextToken) && canCompleteFromNamedBindings(parent.parent)) { @@ -137694,13 +138904,13 @@ var ts; if (!parent.parent.isTypeOnly && (contextToken.kind === 18 /* SyntaxKind.OpenBraceToken */ || contextToken.kind === 100 /* SyntaxKind.ImportKeyword */ || contextToken.kind === 27 /* SyntaxKind.CommaToken */)) { - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; } if (canCompleteFromNamedBindings(parent)) { // At `import { ... } |` or `import * as Foo |`, the only possible completion is `from` if (contextToken.kind === 19 /* SyntaxKind.CloseBraceToken */ || contextToken.kind === 79 /* SyntaxKind.Identifier */) { isKeywordOnlyCompletion = true; - keywordCompletion = 156 /* SyntaxKind.FromKeyword */; + keywordCompletion = 158 /* SyntaxKind.FromKeyword */; } else { return parent.parent.parent; @@ -137710,25 +138920,82 @@ var ts; } if (ts.isImportKeyword(contextToken) && ts.isSourceFile(parent)) { // A lone import keyword with nothing following it does not parse as a statement at all - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return contextToken; } if (ts.isImportKeyword(contextToken) && ts.isImportDeclaration(parent)) { // `import s| from` - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleSpecifier) ? parent : undefined; } return undefined; } } + function getSingleLineReplacementSpanForImportCompletionNode(node) { + var _a, _b, _c; + if (!node) + return undefined; + var top = (_a = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration))) !== null && _a !== void 0 ? _a : node; + var sourceFile = top.getSourceFile(); + if (ts.rangeIsOnSingleLine(top, sourceFile)) { + return ts.createTextSpanFromNode(top, sourceFile); + } + // ImportKeyword was necessarily on one line; ImportSpecifier was necessarily parented in an ImportDeclaration + ts.Debug.assert(top.kind !== 100 /* SyntaxKind.ImportKeyword */ && top.kind !== 273 /* SyntaxKind.ImportSpecifier */); + // Guess which point in the import might actually be a later statement parsed as part of the import + // during parser recovery - either in the middle of named imports, or the module specifier. + var potentialSplitPoint = top.kind === 269 /* SyntaxKind.ImportDeclaration */ + ? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings)) !== null && _c !== void 0 ? _c : top.moduleSpecifier + : top.moduleReference; + var withoutModuleSpecifier = { + pos: top.getFirstToken().getStart(), + end: potentialSplitPoint.pos, + }; + // The module specifier/reference was previously found to be missing, empty, or + // not a string literal - in this last case, it's likely that statement on a following + // line was parsed as the module specifier of a partially-typed import, e.g. + // import Foo| + // interface Blah {} + // This appears to be a multiline-import, and editors can't replace multiple lines. + // But if everything but the "module specifier" is on one line, by this point we can + // assume that the "module specifier" is actually just another statement, and return + // the single-line range of the import excluding that probable statement. + if (ts.rangeIsOnSingleLine(withoutModuleSpecifier, sourceFile)) { + return ts.createTextSpanFromRange(withoutModuleSpecifier); + } + } + // Tries to identify the first named import that is not really a named import, but rather + // just parser recovery for a situation like: + // import { Foo| + // interface Bar {} + // in which `Foo`, `interface`, and `Bar` are all parsed as import specifiers. The caller + // will also check if this token is on a separate line from the rest of the import. + function getPotentiallyInvalidImportSpecifier(namedBindings) { + var _a; + return ts.find((_a = ts.tryCast(namedBindings, ts.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements, function (e) { + var _a; + return !e.propertyName && + ts.isStringANonContextualKeyword(e.name.text) && + ((_a = ts.findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) === null || _a === void 0 ? void 0 : _a.kind) !== 27 /* SyntaxKind.CommaToken */; + }); + } function couldBeTypeOnlyImportSpecifier(importSpecifier, contextToken) { return ts.isImportSpecifier(importSpecifier) && (importSpecifier.isTypeOnly || contextToken === importSpecifier.name && ts.isTypeKeywordTokenOrIdentifier(contextToken)); } function canCompleteFromNamedBindings(namedBindings) { - return isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) - && (ts.isNamespaceImport(namedBindings) || namedBindings.elements.length < 2) - && !namedBindings.parent.name; + if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) { + return false; + } + if (ts.isNamedImports(namedBindings)) { + // We can only complete on named imports if there are no other named imports already, + // but parser recovery sometimes puts later statements in the named imports list, so + // we try to only consider the probably-valid ones. + var invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings); + var validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length; + return validImports < 2; + } + return true; } function isModuleSpecifierMissingOrEmpty(specifier) { var _a; @@ -137747,7 +139014,6 @@ var ts; function isArrowFunctionBody(node) { return node.parent && ts.isArrowFunction(node.parent) && node.parent.body === node; } - ; /** True if symbol is a type or a module containing at least one type. */ function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) { if (seenModules === void 0) { seenModules = new ts.Map(); } @@ -137896,14 +139162,14 @@ var ts; case 115 /* SyntaxKind.WhileKeyword */: case 90 /* SyntaxKind.DoKeyword */: return useParent(node.parent, function (n) { return ts.isIterationStatement(n, /*lookInLabeledStatements*/ true); }, getLoopBreakContinueOccurrences); - case 134 /* SyntaxKind.ConstructorKeyword */: - return getFromAllDeclarations(ts.isConstructorDeclaration, [134 /* SyntaxKind.ConstructorKeyword */]); - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - return getFromAllDeclarations(ts.isAccessor, [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */]); - case 132 /* SyntaxKind.AwaitKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + return getFromAllDeclarations(ts.isConstructorDeclaration, [135 /* SyntaxKind.ConstructorKeyword */]); + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + return getFromAllDeclarations(ts.isAccessor, [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */]); + case 133 /* SyntaxKind.AwaitKeyword */: return useParent(node.parent, ts.isAwaitExpression, getAsyncAndAwaitOccurrences); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return highlightSpans(getAsyncAndAwaitOccurrences(node)); case 125 /* SyntaxKind.YieldKeyword */: return highlightSpans(getYieldOccurrences(node)); @@ -137950,7 +139216,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (ts.isFunctionBlock(parent) || parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } // A throw-statement is only owned by a try-statement if the try-statement has @@ -137982,16 +139248,16 @@ var ts; function getBreakOrContinueOwner(statement) { return ts.findAncestor(statement, function (node) { switch (node.kind) { - case 249 /* SyntaxKind.SwitchStatement */: - if (statement.kind === 245 /* SyntaxKind.ContinueStatement */) { + case 252 /* SyntaxKind.SwitchStatement */: + if (statement.kind === 248 /* SyntaxKind.ContinueStatement */) { return false; } // falls through - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return !statement.label || isLabeledBy(node, statement.label.escapedText); default: // Don't cross function boundaries. @@ -138007,26 +139273,26 @@ var ts; // Types of node whose children might have modifiers. var container = declaration.parent; switch (container.kind) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // Container is either a class declaration or the declaration is a classDeclaration - if (modifierFlag & 128 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { + if (modifierFlag & 256 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { return __spreadArray(__spreadArray([], declaration.members, true), [declaration], false); } else { return container.statements; } - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return __spreadArray(__spreadArray([], container.parameters, true), (ts.isClassLike(container.parent) ? container.parent.members : []), true); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: var nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. @@ -138036,12 +139302,12 @@ var ts; return __spreadArray(__spreadArray([], nodes, true), constructor.parameters, true); } } - else if (modifierFlag & 128 /* ModifierFlags.Abstract */) { + else if (modifierFlag & 256 /* ModifierFlags.Abstract */) { return __spreadArray(__spreadArray([], nodes, true), [container], false); } return nodes; // Syntactically invalid positions that the parser might produce anyway - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return undefined; default: ts.Debug.assertNever(container, "Invalid container kind."); @@ -138062,7 +139328,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 97 /* SyntaxKind.ForKeyword */, 115 /* SyntaxKind.WhileKeyword */, 90 /* SyntaxKind.DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 240 /* SyntaxKind.DoStatement */) { + if (loopNode.kind === 243 /* SyntaxKind.DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 115 /* SyntaxKind.WhileKeyword */)) { @@ -138082,13 +139348,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -138161,13 +139427,13 @@ var ts; var keywords = []; if (func.modifiers) { func.modifiers.forEach(function (modifier) { - pushKeywordIf(keywords, modifier, 131 /* SyntaxKind.AsyncKeyword */); + pushKeywordIf(keywords, modifier, 132 /* SyntaxKind.AsyncKeyword */); }); } ts.forEachChild(func, function (child) { traverseWithoutCrossingFunction(child, function (node) { if (ts.isAwaitExpression(node)) { - pushKeywordIf(keywords, node.getFirstToken(), 132 /* SyntaxKind.AwaitKeyword */); + pushKeywordIf(keywords, node.getFirstToken(), 133 /* SyntaxKind.AwaitKeyword */); } }); }); @@ -138551,14 +139817,14 @@ var ts; if (cancellationToken) cancellationToken.throwIfCancellationRequested(); switch (direct.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(direct)) { handleImportCall(direct); break; } if (!isAvailableThroughGlobal) { var parent = direct.parent; - if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { var name = parent.name; if (name.kind === 79 /* SyntaxKind.Identifier */) { directImports.push(name); @@ -138569,25 +139835,25 @@ var ts; break; case 79 /* SyntaxKind.Identifier */: // for 'const x = require("y"); break; // TODO: GH#23879 - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: handleNamespaceImport(direct, direct.name, ts.hasSyntacticModifier(direct, 1 /* ModifierFlags.Export */), /*alreadyAddedDirect*/ false); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: directImports.push(direct); var namedBindings = direct.importClause && direct.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings && namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { handleNamespaceImport(direct, namedBindings.name, /*isReExport*/ false, /*alreadyAddedDirect*/ true); } else if (!isAvailableThroughGlobal && ts.isDefaultImport(direct)) { addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); // Add a check for indirect uses to handle synthetic default imports } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (!direct.exportClause) { // This is `export * from "foo"`, so imports of this module may import the export too. handleDirectImports(getContainingModuleSymbol(direct, checker)); } - else if (direct.exportClause.kind === 274 /* SyntaxKind.NamespaceExport */) { + else if (direct.exportClause.kind === 277 /* SyntaxKind.NamespaceExport */) { // `export * as foo from "foo"` add to indirect uses addIndirectUser(getSourceFileLikeForImportDeclaration(direct), /** addTransitiveDependencies */ true); } @@ -138596,9 +139862,9 @@ var ts; directImports.push(direct); } break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: // Only check for typeof import('xyz') - if (direct.isTypeOf && !direct.qualifier && isExported(direct)) { + if (!isAvailableThroughGlobal && direct.isTypeOf && !direct.qualifier && isExported(direct)) { addIndirectUser(direct.getSourceFile(), /** addTransitiveDependencies */ true); } directImports.push(direct); @@ -138629,7 +139895,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 261 /* SyntaxKind.ModuleDeclaration */); + ts.Debug.assert(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 264 /* SyntaxKind.ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUser(sourceFileLike, /** addTransitiveDependencies */ true); } @@ -138685,7 +139951,7 @@ var ts; } return { importSearches: importSearches, singleReferences: singleReferences }; function handleImport(decl) { - if (decl.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (decl.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { if (isExternalModuleImportEquals(decl)) { handleNamespaceImportLike(decl.name); } @@ -138695,7 +139961,7 @@ var ts; handleNamespaceImportLike(decl); return; } - if (decl.kind === 200 /* SyntaxKind.ImportType */) { + if (decl.kind === 202 /* SyntaxKind.ImportType */) { if (decl.qualifier) { var firstIdentifier = ts.getFirstIdentifier(decl.qualifier); if (firstIdentifier.escapedText === ts.symbolName(exportSymbol)) { @@ -138711,7 +139977,7 @@ var ts; if (decl.moduleSpecifier.kind !== 10 /* SyntaxKind.StringLiteral */) { return; } - if (decl.kind === 272 /* SyntaxKind.ExportDeclaration */) { + if (decl.kind === 275 /* SyntaxKind.ExportDeclaration */) { if (decl.exportClause && ts.isNamedExports(decl.exportClause)) { searchForNamedImport(decl.exportClause); } @@ -138720,10 +139986,10 @@ var ts; var _a = decl.importClause || { name: undefined, namedBindings: undefined }, name = _a.name, namedBindings = _a.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: handleNamespaceImportLike(namedBindings.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: // 'default' might be accessed as a named import `{ default as foo }`. if (exportKind === 0 /* ExportKind.Named */ || exportKind === 1 /* ExportKind.Default */) { searchForNamedImport(namedBindings); @@ -138773,7 +140039,7 @@ var ts; } } else { - var localSymbol = element.kind === 275 /* SyntaxKind.ExportSpecifier */ && element.propertyName + var localSymbol = element.kind === 278 /* SyntaxKind.ExportSpecifier */ && element.propertyName ? checker.getExportSpecifierLocalTargetSymbol(element) // For re-exporting under a different name, we want to get the re-exported symbol. : checker.getSymbolAtLocation(name); addSearch(name, localSymbol); @@ -138802,7 +140068,7 @@ var ts; for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { var referencingFile = sourceFiles_1[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 305 /* SyntaxKind.SourceFile */) { + if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 308 /* SyntaxKind.SourceFile */) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -138850,7 +140116,7 @@ var ts; } /** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */ function forEachPossibleImportOrExportStatement(sourceFileLike, action) { - return ts.forEach(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -138865,15 +140131,15 @@ var ts; else { forEachPossibleImportOrExportStatement(sourceFile, function (statement) { switch (statement.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: { var decl = statement; if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) { action(decl, decl.moduleSpecifier); } break; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { var decl = statement; if (isExternalModuleImportEquals(decl)) { action(decl, decl.moduleReference.expression); @@ -138898,7 +140164,7 @@ var ts; var parent = node.parent; var grandparent = parent.parent; if (symbol.exportSymbol) { - if (parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { // When accessing an export of a JS module, there's no alias. The symbol will still be flagged as an export even though we're at the use. // So check that we are at the declaration. return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === parent; })) && ts.isBinaryExpression(grandparent) @@ -138982,6 +140248,8 @@ var ts; // Similarly, skip past the symbol for 'export =' if (importedSymbol.escapedName === "export=") { importedSymbol = getExportEqualsLocalSymbol(importedSymbol, checker); + if (importedSymbol === undefined) + return undefined; } // If the import has a different name than the export, do not continue searching. // If `importedName` is undefined, do continue searching as the export is anonymous. @@ -138997,25 +140265,25 @@ var ts; } // Not meant for use with export specifiers or export assignment. function getExportKindForDeclaration(node) { - return ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; + return ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; } } FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol; function getExportEqualsLocalSymbol(importedSymbol, checker) { if (importedSymbol.flags & 2097152 /* SymbolFlags.Alias */) { - return ts.Debug.checkDefined(checker.getImmediateAliasedSymbol(importedSymbol)); + return checker.getImmediateAliasedSymbol(importedSymbol); } var decl = ts.Debug.checkDefined(importedSymbol.valueDeclaration); if (ts.isExportAssignment(decl)) { // `export = class {}` - return ts.Debug.checkDefined(decl.expression.symbol); + return decl.expression.symbol; } else if (ts.isBinaryExpression(decl)) { // `module.exports = class {}` - return ts.Debug.checkDefined(decl.right.symbol); + return decl.right.symbol; } else if (ts.isSourceFile(decl)) { // json module - return ts.Debug.checkDefined(decl.symbol); + return decl.symbol; } - return ts.Debug.fail(); + return undefined; } // If a reference is a class expression, the exported node would be its parent. // If a reference is a variable declaration, the exported node would be the variable statement. @@ -139032,16 +140300,16 @@ var ts; function isNodeImport(node) { var parent = node.parent; switch (parent.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return parent.name === node && isExternalModuleImportEquals(parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: // For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`. return !parent.propertyName; - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: ts.Debug.assert(parent.name === node); return true; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent.parent.parent); default: return false; @@ -139082,21 +140350,21 @@ var ts; return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); } function getSourceFileLikeForImportDeclaration(node) { - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } - ts.Debug.assert(parent.kind === 262 /* SyntaxKind.ModuleBlock */); + ts.Debug.assert(parent.kind === 265 /* SyntaxKind.ModuleBlock */); return ts.cast(parent.parent, isAmbientModuleDeclaration); } function isAmbientModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; } function isExternalModuleImportEquals(eq) { - return eq.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; + return eq.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); @@ -139190,7 +140458,7 @@ var ts; ((ts.isImportOrExportSpecifier(node.parent) || ts.isBindingElement(node.parent)) && node.parent.propertyName === node) || // Is default export - (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 513 /* ModifierFlags.ExportDefault */))) { + (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 1025 /* ModifierFlags.ExportDefault */))) { return getContextNode(node.parent); } return undefined; @@ -139199,7 +140467,7 @@ var ts; if (!node) return undefined; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !ts.isVariableDeclarationList(node.parent) || node.parent.declarations.length !== 1 ? node : ts.isVariableStatement(node.parent.parent) ? @@ -139207,28 +140475,28 @@ var ts; ts.isForInOrOfStatement(node.parent.parent) ? getContextNode(node.parent.parent) : node.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextNode(node.parent.parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 267 /* SyntaxKind.ImportClause */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ts.isExpressionStatement(node.parent) ? node.parent : node; - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return { start: node.initializer, end: node.expression }; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent) ? getContextNode(ts.findAncestor(node.parent, function (node) { return ts.isBinaryExpression(node) || ts.isForInOrOfStatement(node); @@ -139289,15 +140557,15 @@ var ts; return node.kind === 88 /* SyntaxKind.DefaultKeyword */ || !!ts.getDeclarationFromName(node) || ts.isLiteralComputedPropertyDeclarationName(node) - || (node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); + || (node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); } function getImplementationsAtPosition(program, cancellationToken, sourceFiles, sourceFile, position) { var node = ts.getTouchingPropertyName(sourceFile, position); var referenceEntries; var entries = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position); - if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || node.parent.kind === 203 /* SyntaxKind.BindingElement */ - || node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ + if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || node.parent.kind === 205 /* SyntaxKind.BindingElement */ + || node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ || node.kind === 106 /* SyntaxKind.SuperKeyword */) { referenceEntries = entries && __spreadArray([], entries, true); } @@ -139321,13 +140589,13 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return undefined; } var checker = program.getTypeChecker(); // If invoked directly on a shorthand property assignment, then return // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var result_2 = []; Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_2.push(nodeEntry(node)); }); return result_2; @@ -139503,13 +140771,13 @@ var ts; if (symbol) { return getDefinitionKindAndDisplayParts(symbol, checker, node); } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return { kind: "interface" /* ScriptElementKind.interfaceElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] }; } - else if (node.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (node.kind === 228 /* SyntaxKind.ClassExpression */) { return { kind: "local class" /* ScriptElementKind.localClassElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] @@ -139563,7 +140831,7 @@ var ts; var source = ts.getDeclarationFromName(node) || (node.kind === 88 /* SyntaxKind.DefaultKeyword */ ? node.parent : ts.isLiteralComputedPropertyDeclarationName(node) ? node.parent.parent - : node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent + : node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent : undefined); var commonjsSource = source && ts.isBinaryExpression(source) ? source.left : undefined; return !!(source && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === source || d === commonjsSource; }))); @@ -139578,47 +140846,47 @@ var ts; if (!!(decl.flags & 16777216 /* NodeFlags.Ambient */)) return true; switch (decl.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: case 88 /* SyntaxKind.DefaultKeyword */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: // default import - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 285 /* SyntaxKind.JsxAttribute */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: - case 164 /* SyntaxKind.Parameter */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: // default import + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 288 /* SyntaxKind.JsxAttribute */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: + case 166 /* SyntaxKind.Parameter */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // In `({ x: y } = 0);`, `x` is not a write access. (Won't call this function for `y`.) return !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(decl.parent); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return !!decl.body; - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return !!decl.initializer || ts.isCatchClause(decl.parent); - case 168 /* SyntaxKind.MethodSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 170 /* SyntaxKind.MethodSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return false; default: return ts.Debug.failBadSyntaxKind(decl); @@ -139844,10 +141112,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.) break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (sourceFilesSet.has(decl.getSourceFile().fileName)) { references.push(nodeEntry(decl.name)); } @@ -139876,9 +141144,9 @@ var ts; } /** As in a `readonly prop: any` or `constructor(readonly prop: any)`, not a `readonly any[]`. */ function isReadonlyTypeOperator(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(node.parent) - && node.parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + && node.parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } /** getReferencedSymbols for special node kinds. */ function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) { @@ -139889,12 +141157,12 @@ var ts; } // A modifier readonly (like on a property declaration) is not special; // a readonly type keyword (like `readonly string[]`) is. - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { return undefined; } // Likewise, when we *are* looking for a special keyword, make sure we // *don’t* include readonly member modifiers. - return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); } if (ts.isImportMeta(node.parent) && node.parent.name === node) { return getAllReferencesForImportMeta(sourceFiles, cancellationToken); @@ -139961,8 +141229,8 @@ var ts; } function getSpecialSearchKind(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 173 /* SyntaxKind.Constructor */: + case 135 /* SyntaxKind.ConstructorKeyword */: return 1 /* SpecialSearchKind.Constructor */; case 79 /* SyntaxKind.Identifier */: if (ts.isClassLike(node.parent)) { @@ -140210,7 +141478,7 @@ var ts; // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 213 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 226 /* SyntaxKind.ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 215 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 228 /* SyntaxKind.ClassExpression */)) { return valueDeclaration; } if (!declarations) { @@ -140220,7 +141488,7 @@ var ts; if (flags & (4 /* SymbolFlags.Property */ | 8192 /* SymbolFlags.Method */)) { var privateDeclaration = ts.find(declarations, function (d) { return ts.hasEffectiveModifier(d, 8 /* ModifierFlags.Private */) || ts.isPrivateIdentifierClassElementDeclaration(d); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 257 /* SyntaxKind.ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 260 /* SyntaxKind.ClassDeclaration */); } // Else this is a public property and could be accessed from anywhere. return undefined; @@ -140249,7 +141517,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (!container || container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -140507,7 +141775,7 @@ var ts; } // Use the parent symbol if the location is commonjs require syntax on javascript files only. if (ts.isInJSFile(referenceLocation) - && referenceLocation.parent.kind === 203 /* SyntaxKind.BindingElement */ + && referenceLocation.parent.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent.parent.parent)) { referenceSymbol = referenceLocation.parent.symbol; // The parent will not have a symbol if it's an ObjectBindingPattern (when destructuring is used). In @@ -140614,7 +141882,7 @@ var ts; } } function addReference(referenceLocation, relatedSymbol, state) { - var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line no-in-operator + var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line local/no-in-operator // if rename symbol from default export anonymous function, for example `export default function() {}`, we do not need to add reference if (state.options.use === 2 /* FindReferencesUse.Rename */ && referenceLocation.kind === 88 /* SyntaxKind.DefaultKeyword */) { return; @@ -140680,15 +141948,15 @@ var ts; if (constructorSymbol && constructorSymbol.declarations) { for (var _i = 0, _a = constructorSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - var ctrKeyword = ts.findChildOfKind(decl, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */ && !!ctrKeyword); + var ctrKeyword = ts.findChildOfKind(decl, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */ && !!ctrKeyword); addNode(ctrKeyword); } } if (classSymbol.exports) { classSymbol.exports.forEach(function (member) { var decl = member.valueDeclaration; - if (decl && decl.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (decl && decl.kind === 171 /* SyntaxKind.MethodDeclaration */) { var body = decl.body; if (body) { forEachDescendantOfKind(body, 108 /* SyntaxKind.ThisKeyword */, function (thisKeyword) { @@ -140712,7 +141980,7 @@ var ts; } for (var _i = 0, _a = constructor.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */); var body = decl.body; if (body) { forEachDescendantOfKind(body, 106 /* SyntaxKind.SuperKeyword */, function (node) { @@ -140742,7 +142010,7 @@ var ts; if (refNode.kind !== 79 /* SyntaxKind.Identifier */) { return; } - if (refNode.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } @@ -140762,7 +142030,7 @@ var ts; } else if (ts.isFunctionLike(typeHavingNode) && typeHavingNode.body) { var body = typeHavingNode.body; - if (body.kind === 235 /* SyntaxKind.Block */) { + if (body.kind === 238 /* SyntaxKind.Block */) { ts.forEachReturnStatement(body, function (returnStatement) { if (returnStatement.expression) addIfImplementation(returnStatement.expression); @@ -140790,13 +142058,13 @@ var ts; */ function isImplementationExpression(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isImplementationExpression(node.expression); - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; default: return false; @@ -140849,13 +142117,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -140876,43 +142144,43 @@ var ts; return [{ definition: { type: 0 /* DefinitionKind.Symbol */, symbol: searchSpaceNode.symbol }, references: references }]; } function isParameterName(node) { - return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 164 /* SyntaxKind.Parameter */ && node.parent.name === node; + return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 166 /* SyntaxKind.Parameter */ && node.parent.name === node; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning object literals break; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) { return undefined; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. default: return undefined; } - var references = ts.flatMap(searchSpaceNode.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { + var references = ts.flatMap(searchSpaceNode.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { cancellationToken.throwIfCancellationRequested(); return getPossibleSymbolReferenceNodes(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(function (node) { if (!ts.isThis(node)) { @@ -140920,20 +142188,20 @@ var ts; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return searchSpaceNode.symbol === container.symbol; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol; - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // Make sure the container belongs to the same class/object literals // and has the appropriate static modifier from the original container. return container.parent && searchSpaceNode.symbol === container.parent.symbol && ts.isStatic(container) === !!staticFlag; - case 305 /* SyntaxKind.SourceFile */: - return container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); + case 308 /* SyntaxKind.SourceFile */: + return container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); } }); }).map(function (n) { return nodeEntry(n); }); @@ -141044,7 +142312,7 @@ var ts; ts.Debug.assert(paramProps.length === 2 && !!(paramProps[0].flags & 1 /* SymbolFlags.FunctionScopedVariable */) && !!(paramProps[1].flags & 4 /* SymbolFlags.Property */)); // is [parameter, property] return fromRoot(symbol.flags & 1 /* SymbolFlags.FunctionScopedVariable */ ? paramProps[1] : paramProps[0]); } - var exportSpecifier = ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */); + var exportSpecifier = ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */); if (!isForRenamePopulateSearchSymbolSet || exportSpecifier && !exportSpecifier.propertyName) { var localSymbol = exportSpecifier && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier); if (localSymbol) { @@ -141089,7 +142357,7 @@ var ts; }); } function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) { - var bindingElement = ts.getDeclarationOfKind(symbol, 203 /* SyntaxKind.BindingElement */); + var bindingElement = ts.getDeclarationOfKind(symbol, 205 /* SyntaxKind.BindingElement */); if (bindingElement && ts.isObjectBindingElementWithoutPropertyName(bindingElement)) { return ts.getPropertySymbolFromBindingElement(checker, bindingElement); } @@ -141352,16 +142620,16 @@ var ts; return; } switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return (_a = ts.getAssignedName(node.parent)) === null || _a === void 0 ? void 0 : _a.getText(); } return (_b = ts.getNameOfDeclaration(node.parent)) === null || _b === void 0 ? void 0 : _b.getText(); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isModuleBlock(node.parent) && ts.isIdentifier(node.parent.parent.name)) { return node.parent.parent.name.getText(); } @@ -141576,61 +142844,65 @@ var ts; } switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // do not descend into nodes that cannot contain callable nodes return; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: recordCallSite(node); return; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // do not descend into the type side of an assertion collect(node.expression); return; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: // do not descend into the type of a variable or parameter declaration collect(node.name); collect(node.initializer); return; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: // do not descend into the type arguments of a call expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: // do not descend into the type arguments of a new expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // do not descend into the type arguments of a tagged template expression recordCallSite(node); collect(node.tag); collect(node.template); return; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // do not descend into the type arguments of a JsxOpeningLikeElement recordCallSite(node); collect(node.tagName); collect(node.attributes); return; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: recordCallSite(node); collect(node.expression); return; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: recordCallSite(node); ts.forEachChild(node, collect); break; + case 235 /* SyntaxKind.SatisfiesExpression */: + // do not descend into the type side of an assertion + collect(node.expression); + return; } if (ts.isPartOfTypeNode(node)) { // do not descend into types @@ -141685,25 +142957,25 @@ var ts; var callSites = []; var collect = createCallSiteCollector(program, callSites); switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: collectCallSitesOfSourceFile(node, collect); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: collectCallSitesOfModuleDeclaration(node, collect); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: collectCallSitesOfFunctionLikeDeclaration(program.getTypeChecker(), node, collect); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: collectCallSitesOfClassLikeDeclaration(node, collect); break; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: collectCallSitesOfClassStaticBlockDeclaration(node, collect); break; default: @@ -141974,7 +143246,7 @@ var ts; } var parent = node.parent; var typeChecker = program.getTypeChecker(); - if (node.kind === 159 /* SyntaxKind.OverrideKeyword */ || (ts.isIdentifier(node) && ts.isJSDocOverrideTag(parent) && parent.tagName === node)) { + if (node.kind === 161 /* SyntaxKind.OverrideKeyword */ || (ts.isIdentifier(node) && ts.isJSDocOverrideTag(parent) && parent.tagName === node)) { return getDefinitionFromOverriddenMember(typeChecker, node) || ts.emptyArray; } // Labels @@ -141982,6 +143254,12 @@ var ts; var label = ts.getTargetLabel(node.parent, node.text); return label ? [createDefinitionInfoFromName(typeChecker, label, "label" /* ScriptElementKind.label */, node.text, /*containerName*/ undefined)] : undefined; // TODO: GH#18217 } + if (node.kind === 105 /* SyntaxKind.ReturnKeyword */) { + var functionDeclaration = ts.findAncestor(node.parent, function (n) { + return ts.isClassStaticBlockDeclaration(n) ? "quit" : ts.isFunctionLikeDeclaration(n); + }); + return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : undefined; + } if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) { var classDecl = node.parent.parent; var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution; @@ -142050,7 +143328,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node, /*unverified*/ false, failedAliasResolution); }) : ts.emptyArray; return ts.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts.emptyArray); @@ -142117,13 +143395,16 @@ var ts; if (!baseDeclaration) return; var baseTypeNode = ts.getEffectiveBaseTypeNode(baseDeclaration); - var baseType = baseTypeNode ? typeChecker.getTypeAtLocation(baseTypeNode) : undefined; - if (!baseType) + if (!baseTypeNode) + return; + var expression = ts.skipParentheses(baseTypeNode.expression); + var base = ts.isClassExpression(expression) ? expression.symbol : typeChecker.getSymbolAtLocation(expression); + if (!base) return; var name = ts.unescapeLeadingUnderscores(ts.getTextOfPropertyName(classElement.name)); var symbol = ts.hasStaticModifier(classElement) - ? typeChecker.getPropertyOfType(typeChecker.getTypeOfSymbolAtLocation(baseType.symbol, baseDeclaration), name) - : typeChecker.getPropertyOfType(baseType, name); + ? typeChecker.getPropertyOfType(typeChecker.getTypeOfSymbol(base), name) + : typeChecker.getPropertyOfType(typeChecker.getDeclaredTypeOfSymbol(base), name); if (!symbol) return; return getDefinitionFromSymbol(typeChecker, symbol, node); @@ -142256,7 +143537,7 @@ var ts; if (node.parent === declaration) { return true; } - if (declaration.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (declaration.kind === 271 /* SyntaxKind.NamespaceImport */) { return false; } return true; @@ -142298,7 +143579,7 @@ var ts; function getConstructSignatureDefinition() { // Applicable only if we are in a new expression, or we are on a constructor declaration // and in either case the symbol has a construct signature definition, i.e. class - if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 134 /* SyntaxKind.ConstructorKeyword */)) { + if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 135 /* SyntaxKind.ConstructorKeyword */)) { var cls = ts.find(filteredDeclarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration"); return getSignatureDefinition(cls.members, /*selectConstructors*/ true); } @@ -142350,22 +143631,22 @@ var ts; return isDefinitionVisible(checker, declaration.parent); // Handle some exceptions here like arrow function, members of class and object literal expression which are technically not visible but we want the definition to be determined by its parent switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // Private/protected properties/methods are not visible if (ts.hasEffectiveModifier(declaration, 8 /* ModifierFlags.Private */)) return false; // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: return isDefinitionVisible(checker, declaration.parent); default: return false; @@ -142403,9 +143684,9 @@ var ts; } function isConstructorLike(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return true; default: return false; @@ -142511,17 +143792,17 @@ var ts; ts.forEachUnique(declarations, function (declaration) { for (var _i = 0, _a = getCommentHavingNodes(declaration); _i < _a.length; _i++) { var jsdoc = _a[_i]; - var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 327 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); + var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 330 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @typedefs are themselves declarations with associated comments // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation if (jsdoc.comment === undefined && !inheritDoc || ts.isJSDoc(jsdoc) - && declaration.kind !== 345 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 338 /* SyntaxKind.JSDocCallbackTag */ + && declaration.kind !== 348 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 341 /* SyntaxKind.JSDocCallbackTag */ && jsdoc.tags - && jsdoc.tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !jsdoc.tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + && jsdoc.tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !jsdoc.tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { continue; } var newparts = jsdoc.comment ? getDisplayPartsFromComment(jsdoc.comment, checker) : []; @@ -142541,11 +143822,11 @@ var ts; } function getCommentHavingNodes(declaration) { switch (declaration.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return [declaration]; - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return [declaration, declaration.parent]; default: return ts.getJSDocCommentsAndTags(declaration); @@ -142559,8 +143840,8 @@ var ts; // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation - if (tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + if (tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { return; } for (var _i = 0, tags_1 = tags; _i < tags_1.length; _i++) { @@ -142575,17 +143856,17 @@ var ts; if (typeof comment === "string") { return [ts.textPart(comment)]; } - return ts.flatMap(comment, function (node) { return node.kind === 321 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); + return ts.flatMap(comment, function (node) { return node.kind === 324 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); } function getCommentDisplayParts(tag, checker) { var comment = tag.comment, kind = tag.kind; var namePart = getTagNameDisplayPart(kind); switch (kind) { - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return withNode(tag.class); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return withNode(tag.class); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: var templateTag = tag; var displayParts_3 = []; if (templateTag.constraint) { @@ -142607,13 +143888,13 @@ var ts; displayParts_3.push.apply(displayParts_3, __spreadArray([ts.spacePart()], getDisplayPartsFromComment(comment, checker), true)); } return displayParts_3; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return withNode(tag.typeExpression); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: - case 346 /* SyntaxKind.JSDocSeeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: var name = tag.name; return name ? withNode(name) : comment === undefined ? undefined @@ -142640,14 +143921,14 @@ var ts; } function getTagNameDisplayPart(kind) { switch (kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return ts.parameterNamePart; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return ts.propertyNamePart; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return ts.typeParameterNamePart; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return ts.typeAliasNamePart; default: return ts.textPart; @@ -142818,43 +144099,48 @@ var ts; } function getCommentOwnerInfoWorker(commentOwner, options) { switch (commentOwner.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: var host = commentOwner; return { commentOwner: commentOwner, parameters: host.parameters, hasReturn: hasReturn(host, options) }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getCommentOwnerInfoWorker(commentOwner.initializer, options); - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return { commentOwner: commentOwner }; - case 237 /* SyntaxKind.VariableStatement */: { + case 168 /* SyntaxKind.PropertySignature */: { + var host_1 = commentOwner; + return host_1.type && ts.isFunctionTypeNode(host_1.type) + ? { commentOwner: commentOwner, parameters: host_1.type.parameters, hasReturn: hasReturn(host_1.type, options) } + : { commentOwner: commentOwner }; + } + case 240 /* SyntaxKind.VariableStatement */: { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; - var host_1 = varDeclarations.length === 1 && varDeclarations[0].initializer + var host_2 = varDeclarations.length === 1 && varDeclarations[0].initializer ? getRightHandSideOfAssignment(varDeclarations[0].initializer) : undefined; - return host_1 - ? { commentOwner: commentOwner, parameters: host_1.parameters, hasReturn: hasReturn(host_1, options) } + return host_2 + ? { commentOwner: commentOwner, parameters: host_2.parameters, hasReturn: hasReturn(host_2, options) } : { commentOwner: commentOwner }; } - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return "quit"; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - return commentOwner.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; - case 238 /* SyntaxKind.ExpressionStatement */: + return commentOwner.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; + case 241 /* SyntaxKind.ExpressionStatement */: return getCommentOwnerInfoWorker(commentOwner.expression, options); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var be = commentOwner; if (ts.getAssignmentDeclarationKind(be) === 0 /* AssignmentDeclarationKind.None */) { return "quit"; @@ -142863,7 +144149,7 @@ var ts; ? { commentOwner: commentOwner, parameters: be.right.parameters, hasReturn: hasReturn(be.right, options) } : { commentOwner: commentOwner }; } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: var init = commentOwner.initializer; if (init && (ts.isFunctionExpression(init) || ts.isArrowFunction(init))) { return { commentOwner: commentOwner, parameters: init.parameters, hasReturn: hasReturn(init, options) }; @@ -142872,18 +144158,18 @@ var ts; } function hasReturn(node, options) { return !!(options === null || options === void 0 ? void 0 : options.generateReturnInDocTemplate) && - (ts.isArrowFunction(node) && ts.isExpression(node.body) + (ts.isFunctionTypeNode(node) || ts.isArrowFunction(node) && ts.isExpression(node.body) || ts.isFunctionLikeDeclaration(node) && node.body && ts.isBlock(node.body) && !!ts.forEachReturnStatement(node.body, function (n) { return n; })); } function getRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (rightHandSide.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return rightHandSide; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return ts.find(rightHandSide.members, ts.isConstructorDeclaration); } } @@ -142942,9 +144228,9 @@ var ts; } function shouldKeepItem(declaration, checker) { switch (declaration.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var importer = checker.getSymbolAtLocation(declaration.name); // TODO: GH#18217 var imported = checker.getAliasedSymbol(importer); return importer.escapedName !== imported.escapedName; @@ -142954,7 +144240,7 @@ var ts; } function tryAddSingleDeclarationName(declaration, containers) { var name = ts.getNameOfDeclaration(declaration); - return !!name && (pushLiteral(name, containers) || name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); + return !!name && (pushLiteral(name, containers) || name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); } // Only added the names of computed properties if they're simple dotted expressions, like: // @@ -142971,7 +144257,7 @@ var ts; // First, if we started with a computed property name, then add all but the last // portion into the container array. var name = ts.getNameOfDeclaration(declaration); - if (name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { + if (name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { return ts.emptyArray; } // Don't include the last portion. @@ -143188,7 +144474,7 @@ var ts; */ function hasNavigationBarName(node) { return !ts.hasDynamicName(node) || - (node.kind !== 221 /* SyntaxKind.BinaryExpression */ && + (node.kind !== 223 /* SyntaxKind.BinaryExpression */ && ts.isPropertyAccessExpression(node.name.expression) && ts.isIdentifier(node.name.expression.expression) && ts.idText(node.name.expression.expression) === "Symbol"); @@ -143201,7 +144487,7 @@ var ts; return; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Get parameter properties, and treat them as being on the *same* level as the constructor, not under it. var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); @@ -143213,25 +144499,25 @@ var ts; } } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 170 /* SyntaxKind.MethodSignature */: if (hasNavigationBarName(node)) { addNodeWithRecursiveChild(node, node.body); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (hasNavigationBarName(node)) { addNodeWithRecursiveInitializer(node); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (hasNavigationBarName(node)) { addLeafNode(node); } break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -143243,7 +144529,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -143254,17 +144540,17 @@ var ts; } } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: addNodeWithRecursiveChild(node, node.name); break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: var expression = node.expression; // Use the expression as the name of the SpreadAssignment, otherwise show as . ts.isIdentifier(expression) ? addLeafNode(node, expression) : addLeafNode(node); break; - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: { + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: { var child = node; if (ts.isBindingPattern(child.name)) { addChildrenRecursively(child.name); @@ -143274,7 +144560,7 @@ var ts; } break; } - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: var nameNode = node.name; // If we see a function declaration track as a possible ES5 class if (nameNode && ts.isIdentifier(nameNode)) { @@ -143282,11 +144568,11 @@ var ts; } addNodeWithRecursiveChild(node, node.body); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: startNode(node); for (var _e = 0, _f = node.members; _e < _f.length; _e++) { var member = _f[_e]; @@ -143296,9 +144582,9 @@ var ts; } endNode(); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: startNode(node); for (var _g = 0, _h = node.members; _g < _h.length; _g++) { var member = _h[_g]; @@ -143306,10 +144592,10 @@ var ts; } endNode(); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression_1 = node.expression; var child = ts.isObjectLiteralExpression(expression_1) || ts.isCallExpression(expression_1) ? expression_1 : ts.isArrowFunction(expression_1) || ts.isFunctionExpression(expression_1) ? expression_1.body : undefined; @@ -143323,16 +144609,16 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 176 /* SyntaxKind.IndexSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: addLeafNode(node); break; - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var special = ts.getAssignmentDeclarationKind(node); switch (special) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -143572,12 +144858,12 @@ var ts; return false; } switch (a.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.isStatic(a) === ts.isStatic(b); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return areSameModule(a, b) && getFullyQualifiedModuleName(a) === getFullyQualifiedModuleName(b); default: @@ -143599,7 +144885,7 @@ var ts; if (!a.body || !b.body) { return a.body === b.body; } - return a.body.kind === b.body.kind && (a.body.kind !== 261 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); + return a.body.kind === b.body.kind && (a.body.kind !== 264 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); } /** Merge source into target. Source should be thrown away after this is called. */ function merge(target, source) { @@ -143629,7 +144915,7 @@ var ts; * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return getModuleName(node); } var declName = ts.getNameOfDeclaration(node); @@ -143638,16 +144924,16 @@ var ts; return propertyName && ts.unescapeLeadingUnderscores(propertyName); } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: return getFunctionOrClassName(node); default: return undefined; } } function getItemName(node, name) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return cleanText(getModuleName(node)); } if (name) { @@ -143659,32 +144945,32 @@ var ts; } } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"".concat(ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))), "\"") : ""; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return ts.isExportAssignment(node) && node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } // We may get a string with newlines or other whitespace in the case of an object dereference // (eg: "app\n.onactivated"), so we should remove the whitespace for readability in the // navigation bar. return getFunctionOrClassName(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return "new()"; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return "()"; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "[]"; default: return ""; @@ -143717,19 +145003,19 @@ var ts; } // Some nodes are otherwise important enough to always include in the primary navigation menu. switch (navigationBarNodeKind(item)) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 305 /* SyntaxKind.SourceFile */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return true; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -143739,10 +145025,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: return true; default: return false; @@ -143804,7 +145090,7 @@ var ts; function getFullyQualifiedModuleName(moduleDeclaration) { // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = [ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)]; - while (moduleDeclaration.body && moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } @@ -143818,13 +145104,13 @@ var ts; return decl.body && ts.isModuleDeclaration(decl.body) ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return !member.name || member.name.kind === 164 /* SyntaxKind.ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); } function getModifiers(node) { - if (node.parent && node.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.parent && node.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } return ts.getNodeModifiers(node); @@ -143847,7 +145133,7 @@ var ts; return nodeText(parent.name); } // Default exports are named "default" - else if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + else if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } else if (ts.isClassLike(node)) { @@ -143882,9 +145168,9 @@ var ts; } function isFunctionOrClassExpression(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; default: return false; @@ -143913,23 +145199,39 @@ var ts; * 2) Coalescing imports from the same module * 3) Sorting imports */ - function organizeImports(sourceFile, formatContext, host, program, preferences, skipDestructiveCodeActions) { + function organizeImports(sourceFile, formatContext, host, program, preferences, mode) { var changeTracker = ts.textChanges.ChangeTracker.fromContext({ host: host, formatContext: formatContext, preferences: preferences }); - var coalesceAndOrganizeImports = function (importGroup) { return ts.stableSort(coalesceImports(removeUnusedImports(importGroup, sourceFile, program, skipDestructiveCodeActions)), function (s1, s2) { return compareImportsOrRequireStatements(s1, s2); }); }; + var shouldSort = mode === "SortAndCombine" /* OrganizeImportsMode.SortAndCombine */ || mode === "All" /* OrganizeImportsMode.All */; + var shouldCombine = shouldSort; // These are currently inseparable, but I draw a distinction for clarity and in case we add modes in the future. + var shouldRemove = mode === "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */ || mode === "All" /* OrganizeImportsMode.All */; + var maybeRemove = shouldRemove ? removeUnusedImports : ts.identity; + var maybeCoalesce = shouldCombine ? coalesceImports : ts.identity; + var processImportsOfSameModuleSpecifier = function (importGroup) { + var processedDeclarations = maybeCoalesce(maybeRemove(importGroup, sourceFile, program)); + return shouldSort + ? ts.stableSort(processedDeclarations, function (s1, s2) { return compareImportsOrRequireStatements(s1, s2); }) + : processedDeclarations; + }; // All of the old ImportDeclarations in the file, in syntactic order. var topLevelImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, sourceFile.statements.filter(ts.isImportDeclaration)); - topLevelImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, coalesceAndOrganizeImports); }); - // All of the old ExportDeclarations in the file, in syntactic order. - var topLevelExportDecls = sourceFile.statements.filter(ts.isExportDeclaration); - organizeImportsWorker(topLevelExportDecls, coalesceExports); + topLevelImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier); }); + // Exports are always used + if (mode !== "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */) { + // All of the old ExportDeclarations in the file, in syntactic order. + var topLevelExportDecls = sourceFile.statements.filter(ts.isExportDeclaration); + organizeImportsWorker(topLevelExportDecls, coalesceExports); + } for (var _i = 0, _a = sourceFile.statements.filter(ts.isAmbientModule); _i < _a.length; _i++) { var ambientModule = _a[_i]; if (!ambientModule.body) continue; var ambientModuleImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(ts.isImportDeclaration)); - ambientModuleImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, coalesceAndOrganizeImports); }); - var ambientModuleExportDecls = ambientModule.body.statements.filter(ts.isExportDeclaration); - organizeImportsWorker(ambientModuleExportDecls, coalesceExports); + ambientModuleImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier); }); + // Exports are always used + if (mode !== "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */) { + var ambientModuleExportDecls = ambientModule.body.statements.filter(ts.isExportDeclaration); + organizeImportsWorker(ambientModuleExportDecls, coalesceExports); + } } return changeTracker.getChanges(); function organizeImportsWorker(oldImportDecls, coalesce) { @@ -143942,8 +145244,12 @@ var ts; // Consider: we could do a more careful check that this trivia is actually a header, // but the consequences of being wrong are very minor. ts.suppressLeadingTrivia(oldImportDecls[0]); - var oldImportGroups = ts.group(oldImportDecls, function (importDecl) { return getExternalModuleName(importDecl.moduleSpecifier); }); - var sortedImportGroups = ts.stableSort(oldImportGroups, function (group1, group2) { return compareModuleSpecifiers(group1[0].moduleSpecifier, group2[0].moduleSpecifier); }); + var oldImportGroups = shouldCombine + ? ts.group(oldImportDecls, function (importDecl) { return getExternalModuleName(importDecl.moduleSpecifier); }) + : [oldImportDecls]; + var sortedImportGroups = shouldSort + ? ts.stableSort(oldImportGroups, function (group1, group2) { return compareModuleSpecifiers(group1[0].moduleSpecifier, group2[0].moduleSpecifier); }) + : oldImportGroups; var newImportDecls = ts.flatMap(sortedImportGroups, function (importGroup) { return getExternalModuleName(importGroup[0].moduleSpecifier) ? coalesce(importGroup) @@ -144007,11 +145313,7 @@ var ts; } return false; } - function removeUnusedImports(oldImports, sourceFile, program, skipDestructiveCodeActions) { - // As a precaution, consider unused import detection to be destructive (GH #43051) - if (skipDestructiveCodeActions) { - return oldImports; - } + function removeUnusedImports(oldImports, sourceFile, program) { var typeChecker = program.getTypeChecker(); var compilerOptions = program.getCompilerOptions(); var jsxNamespace = typeChecker.getJsxNamespace(sourceFile); @@ -144285,11 +145587,11 @@ var ts; function getModuleSpecifierExpression(declaration) { var _a; switch (declaration.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return (_a = ts.tryCast(declaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return declaration.moduleSpecifier; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return declaration.declarationList.declarations[0].initializer.arguments[0]; } } @@ -144328,19 +145630,19 @@ var ts; function getImportKindOrder(s1) { var _a; switch (s1.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!s1.importClause) return 0; if (s1.importClause.isTypeOnly) return 1; - if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 268 /* SyntaxKind.NamespaceImport */) + if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 271 /* SyntaxKind.NamespaceImport */) return 2; if (s1.importClause.name) return 3; return 4; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return 5; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return 6; } } @@ -144529,7 +145831,7 @@ var ts; } function getOutliningSpanForNode(n, sourceFile) { switch (n.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionLike(n.parent)) { return functionSpan(n.parent, n, sourceFile); } @@ -144537,16 +145839,16 @@ var ts; // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. switch (n.parent.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 243 /* SyntaxKind.DoStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 295 /* SyntaxKind.CatchClause */: return spanForNode(n.parent); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // Could be the try-block, or the finally-block. var tryStatement = n.parent; if (tryStatement.tryBlock === n) { @@ -144563,42 +145865,42 @@ var ts; // the span of the block, independent of any parent span. return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile), "code" /* OutliningSpanKind.Code */); } - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanForNode(n.parent); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 263 /* SyntaxKind.CaseBlock */: - case 182 /* SyntaxKind.TypeLiteral */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 266 /* SyntaxKind.CaseBlock */: + case 184 /* SyntaxKind.TypeLiteral */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return spanForNode(n); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isTupleTypeNode(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return spanForNodeArray(n.statements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return spanForObjectOrArrayLiteral(n); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return spanForObjectOrArrayLiteral(n, 22 /* SyntaxKind.OpenBracketToken */); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return spanForJSXElement(n); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return spanForJSXFragment(n); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return spanForJSXAttributes(n.attributes); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return spanForTemplateLiteral(n); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isBindingElement(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return spanForArrowFunction(n); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return spanForCallExpression(n); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanForParenthesizedExpression(n); } function spanForCallExpression(node) { @@ -144671,7 +145973,7 @@ var ts; function functionSpan(node, body, sourceFile) { var openToken = tryGetFunctionOpenToken(node, body, sourceFile); var closeToken = ts.findChildOfKind(body, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 214 /* SyntaxKind.ArrowFunction */); + return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 216 /* SyntaxKind.ArrowFunction */); } function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart) { if (autoCollapse === void 0) { autoCollapse = false; } @@ -144867,7 +146169,7 @@ var ts; return bestMatch; } function betterMatch(a, b) { - return ts.min(a, b, compareMatches); + return ts.min([a, b], compareMatches); } function compareMatches(a, b) { return a === undefined ? 1 /* Comparison.GreaterThan */ : b === undefined ? -1 /* Comparison.LessThan */ @@ -145215,10 +146517,10 @@ var ts; */ function tryConsumeDeclare() { var token = ts.scanner.getToken(); - if (token === 135 /* SyntaxKind.DeclareKeyword */) { + if (token === 136 /* SyntaxKind.DeclareKeyword */) { // declare module "mod" token = nextToken(); - if (token === 141 /* SyntaxKind.ModuleKeyword */) { + if (token === 142 /* SyntaxKind.ModuleKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { recordAmbientExternalModule(); @@ -145252,10 +146554,10 @@ var ts; return true; } else { - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); - return token !== 156 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || + return token !== 158 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || token === 18 /* SyntaxKind.OpenBraceToken */ || token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)); @@ -145266,7 +146568,7 @@ var ts; } if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import d from "mod"; @@ -145297,7 +146599,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import {a as A} from "mod"; @@ -145309,11 +146611,11 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 127 /* SyntaxKind.AsKeyword */) { + if (token === 128 /* SyntaxKind.AsKeyword */) { token = nextToken(); if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import * as NS from "mod" @@ -145334,7 +146636,7 @@ var ts; if (token === 93 /* SyntaxKind.ExportKeyword */) { markAsExternalModuleIfTopLevel(); token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 41 /* SyntaxKind.AsteriskToken */ || @@ -145353,7 +146655,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export {a as A} from "mod"; @@ -145365,7 +146667,7 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export * from "mod" @@ -145375,7 +146677,7 @@ var ts; } else if (token === 100 /* SyntaxKind.ImportKeyword */) { token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 79 /* SyntaxKind.Identifier */ || @@ -145401,7 +146703,7 @@ var ts; function tryConsumeRequireCall(skipCurrentToken, allowTemplateLiterals) { if (allowTemplateLiterals === void 0) { allowTemplateLiterals = false; } var token = skipCurrentToken ? nextToken() : ts.scanner.getToken(); - if (token === 146 /* SyntaxKind.RequireKeyword */) { + if (token === 147 /* SyntaxKind.RequireKeyword */) { token = nextToken(); if (token === 20 /* SyntaxKind.OpenParenToken */) { token = nextToken(); @@ -145476,8 +146778,8 @@ var ts; } if (ts.scanner.getToken() === 15 /* SyntaxKind.TemplateHead */) { var stack = [ts.scanner.getToken()]; - var token = ts.scanner.scan(); loop: while (ts.length(stack)) { + var token = ts.scanner.scan(); switch (token) { case 1 /* SyntaxKind.EndOfFileToken */: break loop; @@ -145505,7 +146807,6 @@ var ts; } break; } - token = ts.scanner.scan(); } nextToken(); } @@ -145613,7 +146914,7 @@ var ts; return getRenameInfoError(wouldRenameNodeModules); } var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) + var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) ? ts.stripQuotes(ts.getTextOfIdentifierOrLiteral(node)) : undefined; var displayName = specifierName || typeChecker.symbolToString(symbol); @@ -145758,6 +147059,10 @@ var ts; pushSelectionCommentRange(comment.pos, comment.end); } if (positionShouldSnapToNode(sourceFile, pos, node)) { + if (ts.isFunctionBody(node) + && ts.isFunctionLikeDeclaration(parentNode) && !ts.positionsAreOnSameLine(node.getStart(sourceFile), node.getEnd(), sourceFile)) { + pushSelectionRange(node.getStart(sourceFile), node.getEnd()); + } // 1. Blocks are effectively redundant with SyntaxLists. // 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping // of things that should be considered independently. @@ -145895,14 +147200,14 @@ var ts; ts.Debug.assertEqual(closeBraceToken.kind, 19 /* SyntaxKind.CloseBraceToken */); // Group `-/+readonly` and `-/+?` var groupedWithPlusMinusTokens = groupChildren(children, function (child) { - return child === node.readonlyToken || child.kind === 145 /* SyntaxKind.ReadonlyKeyword */ || + return child === node.readonlyToken || child.kind === 146 /* SyntaxKind.ReadonlyKeyword */ || child === node.questionToken || child.kind === 57 /* SyntaxKind.QuestionToken */; }); // Group type parameter with surrounding brackets var groupedWithBrackets = groupChildren(groupedWithPlusMinusTokens, function (_a) { var kind = _a.kind; return kind === 22 /* SyntaxKind.OpenBracketToken */ || - kind === 163 /* SyntaxKind.TypeParameter */ || + kind === 165 /* SyntaxKind.TypeParameter */ || kind === 23 /* SyntaxKind.CloseBracketToken */; }); return [ @@ -145920,7 +147225,7 @@ var ts; var children = groupChildren(node.getChildren(), function (child) { return child === node.name || ts.contains(node.modifiers, child); }); - var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDoc */ ? children[0] : undefined; + var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 323 /* SyntaxKind.JSDoc */ ? children[0] : undefined; var withJSDocSeparated = firstJSDocChild ? children.slice(1) : children; var splittedChildren = splitChildren(withJSDocSeparated, function (_a) { var kind = _a.kind; @@ -146019,22 +147324,22 @@ var ts; return kind === 18 /* SyntaxKind.OpenBraceToken */ || kind === 22 /* SyntaxKind.OpenBracketToken */ || kind === 20 /* SyntaxKind.OpenParenToken */ - || kind === 280 /* SyntaxKind.JsxOpeningElement */; + || kind === 283 /* SyntaxKind.JsxOpeningElement */; } function isListCloser(token) { var kind = token && token.kind; return kind === 19 /* SyntaxKind.CloseBraceToken */ || kind === 23 /* SyntaxKind.CloseBracketToken */ || kind === 21 /* SyntaxKind.CloseParenToken */ - || kind === 281 /* SyntaxKind.JsxClosingElement */; + || kind === 284 /* SyntaxKind.JsxClosingElement */; } function getEndPos(sourceFile, node) { switch (node.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 342 /* SyntaxKind.JSDocThisTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 345 /* SyntaxKind.JSDocThisTag */: return sourceFile.getLineEndOfPosition(node.getStart()); default: return node.getEnd(); @@ -146244,10 +147549,10 @@ var ts; } return undefined; } - else if (ts.isTemplateHead(node) && parent.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + else if (ts.isTemplateHead(node) && parent.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var templateExpression = parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 223 /* SyntaxKind.TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 225 /* SyntaxKind.TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } @@ -146319,17 +147624,17 @@ var ts; return undefined; var parent = startingToken.parent; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: var info = getArgumentOrParameterListInfo(startingToken, position, sourceFile); if (!info) return undefined; var argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan; var contextualType = ts.isMethodDeclaration(parent) ? checker.getContextualTypeForObjectLiteralElement(parent) : checker.getContextualType(parent); return contextualType && { contextualType: contextualType, argumentIndex: argumentIndex, argumentCount: argumentCount, argumentsSpan: argumentsSpan }; - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var highestBinary = getHighestBinary(parent); var contextualType_1 = checker.getContextualType(highestBinary); var argumentIndex_1 = startingToken.kind === 20 /* SyntaxKind.OpenParenToken */ ? 0 : countBinaryExpressionParameters(parent) - 1; @@ -146400,11 +147705,11 @@ var ts; // not enough to put us in the substitution expression; we should consider ourselves part of // the *next* span's expression by offsetting the index (argIndex = (spanIndex + 1) + 1). // - /* eslint-disable no-double-space */ + /* eslint-disable local/no-double-space */ // Example: f `# abcd $#{# 1 + 1# }# efghi ${ #"#hello"# } # ` // ^ ^ ^ ^ ^ ^ ^ ^ ^ // Case: 1 1 3 2 1 3 2 2 1 - /* eslint-enable no-double-space */ + /* eslint-enable local/no-double-space */ ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."); if (ts.isTemplateLiteralToken(node)) { if (ts.isInsideTemplateLiteral(node, position, sourceFile)) { @@ -146453,7 +147758,7 @@ var ts; // | | // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { var lastSpan = ts.last(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -146658,14 +147963,14 @@ var ts; return; } switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) { @@ -146809,7 +148114,7 @@ var ts; } function isHintableLiteral(node) { switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; return ts.isLiteralExpression(operand) || ts.isIdentifier(operand) && ts.isInfinityOrNaNString(operand.escapedText); } @@ -146817,7 +148122,7 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; case 79 /* SyntaxKind.Identifier */: { var name = node.escapedText; @@ -147138,11 +148443,11 @@ var ts; function containsTopLevelCommonjs(sourceFile) { return sourceFile.statements.some(function (statement) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return statement.declarationList.declarations.some(function (decl) { return !!decl.initializer && ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), /*checkArgumentIsStringLiteralLike*/ true); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; if (!ts.isBinaryExpression(expression)) return ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true); @@ -147159,12 +148464,12 @@ var ts; } function importNameForConvertToDefaultImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier; - return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) + return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; default: return undefined; @@ -147240,20 +148545,20 @@ var ts; // should be kept up to date with getTransformationBody in convertToAsyncFunction.ts function isFixablePromiseArgument(arg, checker) { switch (arg.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var functionFlags = ts.getFunctionFlags(arg); if (functionFlags & 1 /* FunctionFlags.Generator */) { return false; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true); // falls through case 104 /* SyntaxKind.NullKeyword */: return true; case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var symbol = checker.getSymbolAtLocation(arg); if (!symbol) { return false; @@ -147270,24 +148575,24 @@ var ts; } function canBeConvertedToClass(node, checker) { var _a, _b, _c, _d; - if (node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (node.kind === 215 /* SyntaxKind.FunctionExpression */) { if (ts.isVariableDeclaration(node.parent) && ((_a = node.symbol.members) === null || _a === void 0 ? void 0 : _a.size)) { return true; } var symbol = checker.getSymbolOfExpando(node, /*allowDeclaration*/ false); return !!(symbol && (((_b = symbol.exports) === null || _b === void 0 ? void 0 : _b.size) || ((_c = symbol.members) === null || _c === void 0 ? void 0 : _c.size))); } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */) { return !!((_d = node.symbol.members) === null || _d === void 0 ? void 0 : _d.size); } return false; } function canBeConvertedToAsync(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -147309,7 +148614,7 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* SymbolFlags.Class */) { - return ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */) ? "local class" /* ScriptElementKind.localClassElement */ : "class" /* ScriptElementKind.classElement */; } if (flags & 384 /* SymbolFlags.Enum */) @@ -147372,6 +148677,8 @@ var ts; return "method" /* ScriptElementKind.memberFunctionElement */; if (flags & 16384 /* SymbolFlags.Constructor */) return "constructor" /* ScriptElementKind.constructorImplementationElement */; + if (flags & 131072 /* SymbolFlags.Signature */) + return "index" /* ScriptElementKind.indexSignatureElement */; if (flags & 4 /* SymbolFlags.Property */) { if (flags & 33554432 /* SymbolFlags.Transient */ && symbol.checkFlags & 6 /* CheckFlags.Synthetic */) { // If union property is result of union of non method (property/accessors/variables), it is labeled as property @@ -147455,12 +148762,15 @@ var ts; var declaration = ts.find(symbol.declarations, function (declaration) { return declaration.name === location; }); if (declaration) { switch (declaration.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: symbolKind = "getter" /* ScriptElementKind.memberGetAccessorElement */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: symbolKind = "setter" /* ScriptElementKind.memberSetAccessorElement */; break; + case 169 /* SyntaxKind.PropertyDeclaration */: + symbolKind = "accessor" /* ScriptElementKind.memberAccessorVariableElement */; + break; default: ts.Debug.assertNever(declaration); } @@ -147471,7 +148781,7 @@ var ts; } var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); - if (location.parent && location.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -147491,7 +148801,7 @@ var ts; } if (callExpressionLike) { signature = typeChecker.getResolvedSignature(callExpressionLike); // TODO: GH#18217 - var useConstructSignatures = callExpressionLike.kind === 209 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); + var useConstructSignatures = callExpressionLike.kind === 211 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (signature && !ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -147555,29 +148865,29 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* SymbolFlags.Accessor */)) || // name of function declaration - (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 171 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration + (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 173 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration // get the signature from the declaration and write it var functionDeclaration_1 = location.parent; // Use function declaration to write the signatures only if the symbol corresponding to this declaration var locationIsSymbolDeclaration = symbol.declarations && ts.find(symbol.declarations, function (declaration) { - return declaration === (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); + return declaration === (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); }); if (locationIsSymbolDeclaration) { - var allSignatures = functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration_1)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration_1); // TODO: GH#18217 } else { signature = allSignatures[0]; } - if (functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */) { + if (functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */) { // show (constructor) Type(...) signature symbolKind = "constructor" /* ScriptElementKind.constructorImplementationElement */; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 174 /* SyntaxKind.CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 176 /* SyntaxKind.CallSignature */ && !(type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ || type.symbol.flags & 4096 /* SymbolFlags.ObjectLiteral */) ? type.symbol : symbol, symbolKind); } if (signature) { @@ -147590,7 +148900,7 @@ var ts; } if (symbolFlags & 32 /* SymbolFlags.Class */ && !hasAddedSymbolInfo && !isThisExpression) { addAliasPrefixIfNecessary(); - if (ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -147613,7 +148923,7 @@ var ts; } if ((symbolFlags & 524288 /* SymbolFlags.TypeAlias */) && (semanticMeaning & 2 /* SemanticMeaning.Type */)) { prefixNextMeaning(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -147634,9 +148944,9 @@ var ts; } if (symbolFlags & 1536 /* SymbolFlags.Module */ && !isThisExpression) { prefixNextMeaning(); - var declaration = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 264 /* SyntaxKind.ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 79 /* SyntaxKind.Identifier */; - displayParts.push(ts.keywordPart(isNamespace ? 142 /* SyntaxKind.NamespaceKeyword */ : 141 /* SyntaxKind.ModuleKeyword */)); + displayParts.push(ts.keywordPart(isNamespace ? 143 /* SyntaxKind.NamespaceKeyword */ : 142 /* SyntaxKind.ModuleKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } @@ -147655,7 +148965,7 @@ var ts; } else { // Method/function type parameter - var decl = ts.getDeclarationOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var decl = ts.getDeclarationOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (decl === undefined) return ts.Debug.fail(); var declaration = decl.parent; @@ -147663,21 +148973,21 @@ var ts; if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); // TODO: GH#18217 - if (declaration.kind === 175 /* SyntaxKind.ConstructSignature */) { + if (declaration.kind === 177 /* SyntaxKind.ConstructSignature */) { displayParts.push(ts.keywordPart(103 /* SyntaxKind.NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 174 /* SyntaxKind.CallSignature */ && declaration.name) { + else if (declaration.kind !== 176 /* SyntaxKind.CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* TypeFormatFlags.WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + else if (declaration.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path addInPrefix(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -147689,7 +148999,7 @@ var ts; symbolKind = "enum member" /* ScriptElementKind.enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]; - if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 299 /* SyntaxKind.EnumMember */) { + if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 302 /* SyntaxKind.EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -147725,17 +149035,17 @@ var ts; } if (symbol.declarations) { switch (symbol.declarations[0].kind) { - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(142 /* SyntaxKind.NamespaceKeyword */)); + displayParts.push(ts.keywordPart(143 /* SyntaxKind.NamespaceKeyword */)); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 63 /* SyntaxKind.EqualsToken */ : 88 /* SyntaxKind.DefaultKeyword */)); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); break; default: @@ -147745,13 +149055,13 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); displayParts.push(ts.operatorPart(63 /* SyntaxKind.EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(146 /* SyntaxKind.RequireKeyword */)); + displayParts.push(ts.keywordPart(147 /* SyntaxKind.RequireKeyword */)); displayParts.push(ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)); @@ -147781,16 +149091,18 @@ var ts; } // For properties, variables and local vars: show the type if (symbolKind === "property" /* ScriptElementKind.memberVariableElement */ || + symbolKind === "accessor" /* ScriptElementKind.memberAccessorVariableElement */ || symbolKind === "getter" /* ScriptElementKind.memberGetAccessorElement */ || symbolKind === "setter" /* ScriptElementKind.memberSetAccessorElement */ || symbolKind === "JSX attribute" /* ScriptElementKind.jsxAttribute */ || symbolFlags & 3 /* SymbolFlags.Variable */ || symbolKind === "local var" /* ScriptElementKind.localVariableElement */ || + symbolKind === "index" /* ScriptElementKind.indexSignatureElement */ || isThisExpression) { displayParts.push(ts.punctuationPart(58 /* SyntaxKind.ColonToken */)); displayParts.push(ts.spacePart()); // If the type is type parameter, format it specially - if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */) { + if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */ && symbolKind !== "index" /* ScriptElementKind.indexSignatureElement */) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { var param = typeChecker.typeParameterToDeclaration(type, enclosingDeclaration, symbolDisplayNodeBuilderFlags); getPrinter().writeNode(4 /* EmitHint.Unspecified */, param, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosingDeclaration)), writer); @@ -147834,10 +149146,10 @@ var ts; // For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 305 /* SyntaxKind.SourceFile */; })) { + if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 308 /* SyntaxKind.SourceFile */; })) { for (var _i = 0, _b = symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - if (!declaration.parent || declaration.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -147898,10 +149210,34 @@ var ts; displayParts.push(ts.spacePart()); } function addFullSymbolName(symbolToDisplay, enclosingDeclaration) { + var indexInfos; if (alias && symbolToDisplay === symbol) { symbolToDisplay = alias; } - var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + if (symbolKind === "index" /* ScriptElementKind.indexSignatureElement */) { + indexInfos = typeChecker.getIndexInfosOfIndexSymbol(symbolToDisplay); + } + var fullSymbolDisplayParts = []; + if (symbolToDisplay.flags & 131072 /* SymbolFlags.Signature */ && indexInfos) { + if (symbolToDisplay.parent) { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay.parent); + } + fullSymbolDisplayParts.push(ts.punctuationPart(22 /* SyntaxKind.OpenBracketToken */)); + //Needed to handle more than one type of index + indexInfos.forEach(function (info, i) { + //Needed to handle template literals + fullSymbolDisplayParts.push.apply(fullSymbolDisplayParts, ts.typeToDisplayParts(typeChecker, info.keyType)); + if (i !== indexInfos.length - 1) { + fullSymbolDisplayParts.push(ts.spacePart()); + fullSymbolDisplayParts.push(ts.punctuationPart(51 /* SyntaxKind.BarToken */)); + fullSymbolDisplayParts.push(ts.spacePart()); + } + }); + fullSymbolDisplayParts.push(ts.punctuationPart(23 /* SyntaxKind.CloseBracketToken */)); + } + else { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + } ts.addRange(displayParts, fullSymbolDisplayParts); if (symbol.flags & 16777216 /* SymbolFlags.Optional */) { displayParts.push(ts.punctuationPart(57 /* SyntaxKind.QuestionToken */)); @@ -147949,7 +149285,7 @@ var ts; tags = signature.getJsDocTags(); if (allSignatures.length > 1 && documentation.length === 0 && tags.length === 0) { documentation = allSignatures[0].getDocumentationComment(typeChecker); - tags = allSignatures[0].getJsDocTags(); + tags = allSignatures[0].getJsDocTags().filter(function (tag) { return tag.name !== "deprecated"; }); // should only include @deprecated JSDoc tag on the first overload (#49368) } } function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { @@ -147967,16 +149303,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (declaration.kind === 215 /* SyntaxKind.FunctionExpression */) { return true; } - if (declaration.kind !== 254 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */) { + if (declaration.kind !== 257 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block - if (parent.kind === 305 /* SyntaxKind.SourceFile */ || parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ || parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return false; } } @@ -148281,10 +149617,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 285 /* SyntaxKind.JsxAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 288 /* SyntaxKind.JsxAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // May parse an identifier like `module-layout`; that will be scanned as a keyword at first, but we should parse the whole thing to get an identifier. return ts.isKeyword(node.kind) || node.kind === 79 /* SyntaxKind.Identifier */; } @@ -148292,7 +149628,7 @@ var ts; return false; } function shouldRescanJsxText(node) { - return ts.isJsxText(node); + return ts.isJsxText(node) || ts.isJsxElement(node) && (lastTokenInfo === null || lastTokenInfo === void 0 ? void 0 : lastTokenInfo.token.kind) === 11 /* SyntaxKind.JsxText */; } function shouldRescanSlashToken(container) { return container.kind === 13 /* SyntaxKind.RegularExpressionLiteral */; @@ -148477,7 +149813,7 @@ var ts; (function (formatting) { function getAllRules() { var allTokens = []; - for (var token = 0 /* SyntaxKind.FirstToken */; token <= 160 /* SyntaxKind.LastToken */; token++) { + for (var token = 0 /* SyntaxKind.FirstToken */; token <= 162 /* SyntaxKind.LastToken */; token++) { if (token !== 1 /* SyntaxKind.EndOfFileToken */) { allTokens.push(token); } @@ -148492,9 +149828,9 @@ var ts; var anyToken = { tokens: allTokens, isSpecific: false }; var anyTokenIncludingMultilineComments = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [3 /* SyntaxKind.MultiLineCommentTrivia */], false)); var anyTokenIncludingEOF = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [1 /* SyntaxKind.EndOfFileToken */], false)); - var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 160 /* SyntaxKind.LastKeyword */); + var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 162 /* SyntaxKind.LastKeyword */); var binaryOperators = tokenRangeFromRange(29 /* SyntaxKind.FirstBinaryOperator */, 78 /* SyntaxKind.LastBinaryOperator */); - var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 160 /* SyntaxKind.OfKeyword */, 127 /* SyntaxKind.AsKeyword */, 139 /* SyntaxKind.IsKeyword */]; + var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 162 /* SyntaxKind.OfKeyword */, 128 /* SyntaxKind.AsKeyword */, 140 /* SyntaxKind.IsKeyword */]; var unaryPrefixOperators = [45 /* SyntaxKind.PlusPlusToken */, 46 /* SyntaxKind.MinusMinusToken */, 54 /* SyntaxKind.TildeToken */, 53 /* SyntaxKind.ExclamationToken */]; var unaryPrefixExpressions = [ 8 /* SyntaxKind.NumericLiteral */, 9 /* SyntaxKind.BigIntLiteral */, 79 /* SyntaxKind.Identifier */, 20 /* SyntaxKind.OpenParenToken */, @@ -148525,7 +149861,7 @@ var ts; rule("SpaceAfterQuestionMarkInConditionalOperator", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext, isConditionalOperatorContext], 4 /* RuleAction.InsertSpace */), // in other cases there should be no space between '?' and next token rule("NoSpaceAfterQuestionMark", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext, isNotPropertyAccessOnIntegerLiteral], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterDot", [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceBetweenImportParenInImportType", 100 /* SyntaxKind.ImportKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 16 /* RuleAction.DeleteSpace */), // Special handling of unary operators. @@ -148568,11 +149904,11 @@ var ts; // Though, we do extra check on the context to make sure we are dealing with get/set node. Example: // get x() {} // set x(val) {} - rule("SpaceAfterGetSetInMember", [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterGetSetInMember", [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenYieldKeywordAndStar", 125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 16 /* RuleAction.DeleteSpace */), rule("SpaceBetweenYieldOrYieldStarAndOperand", [125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenReturnAndSemicolon", 105 /* SyntaxKind.ReturnKeyword */, 26 /* SyntaxKind.SemicolonToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 132 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 133 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterLetConstInVariableDeclaration", [119 /* SyntaxKind.LetKeyword */, 85 /* SyntaxKind.ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBeforeOpenParenInFuncCall", anyToken, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], 16 /* RuleAction.DeleteSpace */), // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. @@ -148580,8 +149916,8 @@ var ts; rule("SpaceAfterBinaryKeywordOperator", binaryKeywordOperators, anyToken, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterVoidOperator", 114 /* SyntaxKind.VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 4 /* RuleAction.InsertSpace */), // Async-await - rule("SpaceBetweenAsyncAndOpenParen", 131 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBetweenAsyncAndFunctionKeyword", 131 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndOpenParen", 132 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndFunctionKeyword", 132 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Template string rule("NoSpaceBetweenTagAndTemplateString", [79 /* SyntaxKind.Identifier */, 21 /* SyntaxKind.CloseParenToken */], [14 /* SyntaxKind.NoSubstitutionTemplateLiteral */, 15 /* SyntaxKind.TemplateHead */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // JSX opening elements @@ -148592,34 +149928,35 @@ var ts; rule("NoSpaceAfterEqualInJsxAttribute", 63 /* SyntaxKind.EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // TypeScript-specific rules // Use of module as a function call. e.g.: import m2 = module("m2"); - rule("NoSpaceAfterModuleImport", [141 /* SyntaxKind.ModuleKeyword */, 146 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceAfterModuleImport", [142 /* SyntaxKind.ModuleKeyword */, 147 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // Add a space around certain TypeScript keywords rule("SpaceAfterCertainTypeScriptKeywords", [ 126 /* SyntaxKind.AbstractKeyword */, + 127 /* SyntaxKind.AccessorKeyword */, 84 /* SyntaxKind.ClassKeyword */, - 135 /* SyntaxKind.DeclareKeyword */, + 136 /* SyntaxKind.DeclareKeyword */, 88 /* SyntaxKind.DefaultKeyword */, 92 /* SyntaxKind.EnumKeyword */, 93 /* SyntaxKind.ExportKeyword */, 94 /* SyntaxKind.ExtendsKeyword */, - 136 /* SyntaxKind.GetKeyword */, + 137 /* SyntaxKind.GetKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 100 /* SyntaxKind.ImportKeyword */, 118 /* SyntaxKind.InterfaceKeyword */, - 141 /* SyntaxKind.ModuleKeyword */, - 142 /* SyntaxKind.NamespaceKeyword */, + 142 /* SyntaxKind.ModuleKeyword */, + 143 /* SyntaxKind.NamespaceKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 123 /* SyntaxKind.PublicKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 151 /* SyntaxKind.SetKeyword */, 124 /* SyntaxKind.StaticKeyword */, - 152 /* SyntaxKind.TypeKeyword */, - 156 /* SyntaxKind.FromKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 137 /* SyntaxKind.InferKeyword */, + 154 /* SyntaxKind.TypeKeyword */, + 158 /* SyntaxKind.FromKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 138 /* SyntaxKind.InferKeyword */, ], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 156 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 158 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { rule("SpaceAfterModuleName", 10 /* SyntaxKind.StringLiteral */, 18 /* SyntaxKind.OpenBraceToken */, [isModuleDeclContext], 4 /* RuleAction.InsertSpace */), // Lambda expressions @@ -148650,8 +149987,8 @@ var ts; 123 /* SyntaxKind.PublicKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 136 /* SyntaxKind.GetKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 137 /* SyntaxKind.GetKeyword */, + 151 /* SyntaxKind.SetKeyword */, 22 /* SyntaxKind.OpenBracketToken */, 41 /* SyntaxKind.AsteriskToken */, ], [isEndOfDecoratorContextOnSameLine], 4 /* RuleAction.InsertSpace */), @@ -148662,8 +149999,8 @@ var ts; // These rules are applied after high priority var userConfigurableRules = [ // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - rule("SpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("NoSpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("SpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("NoSpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket, isNextTokenNotCloseParen], 4 /* RuleAction.InsertSpace */), rule("NoSpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], 16 /* RuleAction.DeleteSpace */), // Insert space after function keyword for anonymous functions @@ -148737,11 +150074,11 @@ var ts; rule("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 18 /* SyntaxKind.OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 4 /* RuleAction.InsertSpace */, 1 /* RuleFlags.CanDeleteNewLines */), rule("NoSpaceBeforeComma", anyToken, 27 /* SyntaxKind.CommaToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // No space before and after indexer `x[]` - rule("NoSpaceBeforeOpenBracket", anyTokenExcept(131 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeOpenBracket", anyTokenExcept(132 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterCloseBracket", 23 /* SyntaxKind.CloseBracketToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterSemicolon", 26 /* SyntaxKind.SemicolonToken */, anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Remove extra space between for and await - rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 132 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 133 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] rule("SpaceBetweenStatements", [21 /* SyntaxKind.CloseParenToken */, 90 /* SyntaxKind.DoKeyword */, 91 /* SyntaxKind.ElseKeyword */, 82 /* SyntaxKind.CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 4 /* RuleAction.InsertSpace */), @@ -148790,69 +150127,70 @@ var ts; return function (context) { return context.options && context.options[optionName] === optionValue; }; } function isOptionEnabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !!context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !!context.options[optionName]; }; } function isOptionDisabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !context.options[optionName]; }; } function isOptionDisabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName]; }; } function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; } function isOptionEnabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !!context.options[optionName]; }; } function isForContext(context) { - return context.contextNode.kind === 242 /* SyntaxKind.ForStatement */; + return context.contextNode.kind === 245 /* SyntaxKind.ForStatement */; } function isNotForContext(context) { return !isForContext(context); } function isBinaryOpContext(context) { switch (context.contextNode.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return context.contextNode.operatorToken.kind !== 27 /* SyntaxKind.CommaToken */; - case 222 /* SyntaxKind.ConditionalExpression */: - case 189 /* SyntaxKind.ConditionalType */: - case 229 /* SyntaxKind.AsExpression */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 177 /* SyntaxKind.TypePredicate */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 191 /* SyntaxKind.ConditionalType */: + case 231 /* SyntaxKind.AsExpression */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 179 /* SyntaxKind.TypePredicate */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // equals in type X = ... // falls through - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // equal in import a = module('a'); // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // equal in export = 1 // falls through - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // equal in let a = 0 // falls through - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // equal in p = 0 // falls through - case 164 /* SyntaxKind.Parameter */: - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // "in" keyword in for (let x in []) { } - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // "in" keyword in [P in keyof T]: T[P] // falls through - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return context.currentTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.nextTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 244 /* SyntaxKind.ForOfStatement */: - return context.currentTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */; + case 247 /* SyntaxKind.ForOfStatement */: + return context.currentTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */; } return false; } @@ -148864,22 +150202,22 @@ var ts; } function isTypeAnnotationContext(context) { var contextKind = context.contextNode.kind; - return contextKind === 167 /* SyntaxKind.PropertyDeclaration */ || - contextKind === 166 /* SyntaxKind.PropertySignature */ || - contextKind === 164 /* SyntaxKind.Parameter */ || - contextKind === 254 /* SyntaxKind.VariableDeclaration */ || + return contextKind === 169 /* SyntaxKind.PropertyDeclaration */ || + contextKind === 168 /* SyntaxKind.PropertySignature */ || + contextKind === 166 /* SyntaxKind.Parameter */ || + contextKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(contextKind); } function isConditionalOperatorContext(context) { - return context.contextNode.kind === 222 /* SyntaxKind.ConditionalExpression */ || - context.contextNode.kind === 189 /* SyntaxKind.ConditionalType */; + return context.contextNode.kind === 224 /* SyntaxKind.ConditionalExpression */ || + context.contextNode.kind === 191 /* SyntaxKind.ConditionalType */; } function isSameLineTokenOrBeforeBlockContext(context) { return context.TokensAreOnSameLine() || isBeforeBlockContext(context); } function isBraceWrappedContext(context) { - return context.contextNode.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || - context.contextNode.kind === 195 /* SyntaxKind.MappedType */ || + return context.contextNode.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || + context.contextNode.kind === 197 /* SyntaxKind.MappedType */ || isSingleLineBlockContext(context); } // This check is done before an open brace in a control construct, a function, or a typescript block declaration @@ -148905,34 +150243,34 @@ var ts; return true; } switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 265 /* SyntaxKind.ModuleBlock */: return true; } return false; } function isFunctionDeclContext(context) { switch (context.contextNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: // falls through - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // case SyntaxKind.MethodSignature: // falls through - case 174 /* SyntaxKind.CallSignature */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: // falls through - case 258 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one + case 261 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one return true; } return false; @@ -148941,40 +150279,40 @@ var ts; return !isFunctionDeclContext(context); } function isFunctionDeclarationOrFunctionExpressionContext(context) { - return context.contextNode.kind === 256 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 213 /* SyntaxKind.FunctionExpression */; + return context.contextNode.kind === 259 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 215 /* SyntaxKind.FunctionExpression */; } function isTypeScriptDeclWithBlockContext(context) { return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 273 /* SyntaxKind.NamedExports */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 269 /* SyntaxKind.NamedImports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 276 /* SyntaxKind.NamedExports */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 272 /* SyntaxKind.NamedImports */: return true; } return false; } function isAfterCodeBlockContext(context) { switch (context.currentTokenParent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 292 /* SyntaxKind.CatchClause */: - case 262 /* SyntaxKind.ModuleBlock */: - case 249 /* SyntaxKind.SwitchStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 295 /* SyntaxKind.CatchClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 252 /* SyntaxKind.SwitchStatement */: return true; - case 235 /* SyntaxKind.Block */: { + case 238 /* SyntaxKind.Block */: { var blockParent = context.currentTokenParent.parent; // In a codefix scenario, we can't rely on parents being set. So just always return true. - if (!blockParent || blockParent.kind !== 214 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (!blockParent || blockParent.kind !== 216 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 215 /* SyntaxKind.FunctionExpression */) { return true; } } @@ -148983,32 +150321,32 @@ var ts; } function isControlDeclContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 248 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 251 /* SyntaxKind.WithStatement */: // TODO // case SyntaxKind.ElseClause: // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return true; default: return false; } } function isObjectContext(context) { - return context.contextNode.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return context.contextNode.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } function isFunctionCallContext(context) { - return context.contextNode.kind === 208 /* SyntaxKind.CallExpression */; + return context.contextNode.kind === 210 /* SyntaxKind.CallExpression */; } function isNewContext(context) { - return context.contextNode.kind === 209 /* SyntaxKind.NewExpression */; + return context.contextNode.kind === 211 /* SyntaxKind.NewExpression */; } function isFunctionCallOrNewContext(context) { return isFunctionCallContext(context) || isNewContext(context); @@ -149023,10 +150361,10 @@ var ts; return context.nextTokenSpan.kind !== 21 /* SyntaxKind.CloseParenToken */; } function isArrowFunctionContext(context) { - return context.contextNode.kind === 214 /* SyntaxKind.ArrowFunction */; + return context.contextNode.kind === 216 /* SyntaxKind.ArrowFunction */; } function isImportTypeContext(context) { - return context.contextNode.kind === 200 /* SyntaxKind.ImportType */; + return context.contextNode.kind === 202 /* SyntaxKind.ImportType */; } function isNonJsxSameLineTokenContext(context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; @@ -149035,19 +150373,19 @@ var ts; return context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; } function isNonJsxElementOrFragmentContext(context) { - return context.contextNode.kind !== 278 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 282 /* SyntaxKind.JsxFragment */; + return context.contextNode.kind !== 281 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 285 /* SyntaxKind.JsxFragment */; } function isJsxExpressionContext(context) { - return context.contextNode.kind === 288 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return context.contextNode.kind === 291 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } function isNextTokenParentJsxAttribute(context) { - return context.nextTokenParent.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.nextTokenParent.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxAttributeContext(context) { - return context.contextNode.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.contextNode.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxSelfClosingElementContext(context) { - return context.contextNode.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return context.contextNode.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } function isNotBeforeBlockInFunctionDeclarationContext(context) { return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); @@ -149059,48 +150397,48 @@ var ts; !nodeIsInDecoratorContext(context.nextTokenParent); } function nodeIsInDecoratorContext(node) { - while (ts.isExpressionNode(node)) { + while (node && ts.isExpression(node)) { node = node.parent; } - return node.kind === 165 /* SyntaxKind.Decorator */; + return node && node.kind === 167 /* SyntaxKind.Decorator */; } function isStartOfVariableDeclarationList(context) { - return context.currentTokenParent.kind === 255 /* SyntaxKind.VariableDeclarationList */ && + return context.currentTokenParent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } function isNotFormatOnEnter(context) { return context.formattingRequestKind !== 2 /* FormattingRequestKind.FormatOnEnter */; } function isModuleDeclContext(context) { - return context.contextNode.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return context.contextNode.kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isObjectTypeContext(context) { - return context.contextNode.kind === 182 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 184 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; } function isConstructorSignatureContext(context) { - return context.contextNode.kind === 175 /* SyntaxKind.ConstructSignature */; + return context.contextNode.kind === 177 /* SyntaxKind.ConstructSignature */; } function isTypeArgumentOrParameterOrAssertion(token, parent) { if (token.kind !== 29 /* SyntaxKind.LessThanToken */ && token.kind !== 31 /* SyntaxKind.GreaterThanToken */) { return false; } switch (parent.kind) { - case 178 /* SyntaxKind.TypeReference */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return true; default: return false; @@ -149111,28 +150449,28 @@ var ts; isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); } function isTypeAssertionContext(context) { - return context.contextNode.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return context.contextNode.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } function isVoidOpContext(context) { - return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 217 /* SyntaxKind.VoidExpression */; + return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 219 /* SyntaxKind.VoidExpression */; } function isYieldOrYieldStarWithOperand(context) { - return context.contextNode.kind === 224 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 226 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; } function isNonNullAssertionContext(context) { - return context.contextNode.kind === 230 /* SyntaxKind.NonNullExpression */; + return context.contextNode.kind === 232 /* SyntaxKind.NonNullExpression */; } function isNotStatementConditionContext(context) { return !isStatementConditionContext(context); } function isStatementConditionContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; default: return false; @@ -149157,12 +150495,12 @@ var ts; return nextTokenKind === 19 /* SyntaxKind.CloseBraceToken */ || nextTokenKind === 1 /* SyntaxKind.EndOfFileToken */; } - if (nextTokenKind === 234 /* SyntaxKind.SemicolonClassElement */ || + if (nextTokenKind === 237 /* SyntaxKind.SemicolonClassElement */ || nextTokenKind === 26 /* SyntaxKind.SemicolonToken */) { return false; } - if (context.contextNode.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - context.contextNode.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (context.contextNode.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + context.contextNode.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Can’t remove semicolon after `foo`; it would parse as a method declaration: // // interface I { @@ -149176,9 +150514,9 @@ var ts; if (ts.isPropertyDeclaration(context.currentTokenParent)) { return !context.currentTokenParent.initializer; } - return context.currentTokenParent.kind !== 242 /* SyntaxKind.ForStatement */ - && context.currentTokenParent.kind !== 236 /* SyntaxKind.EmptyStatement */ - && context.currentTokenParent.kind !== 234 /* SyntaxKind.SemicolonClassElement */ + return context.currentTokenParent.kind !== 245 /* SyntaxKind.ForStatement */ + && context.currentTokenParent.kind !== 239 /* SyntaxKind.EmptyStatement */ + && context.currentTokenParent.kind !== 237 /* SyntaxKind.SemicolonClassElement */ && nextTokenKind !== 22 /* SyntaxKind.OpenBracketToken */ && nextTokenKind !== 20 /* SyntaxKind.OpenParenToken */ && nextTokenKind !== 39 /* SyntaxKind.PlusToken */ @@ -149186,7 +150524,7 @@ var ts; && nextTokenKind !== 43 /* SyntaxKind.SlashToken */ && nextTokenKind !== 13 /* SyntaxKind.RegularExpressionLiteral */ && nextTokenKind !== 27 /* SyntaxKind.CommaToken */ - && nextTokenKind !== 223 /* SyntaxKind.TemplateExpression */ + && nextTokenKind !== 225 /* SyntaxKind.TemplateExpression */ && nextTokenKind !== 15 /* SyntaxKind.TemplateHead */ && nextTokenKind !== 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */ && nextTokenKind !== 24 /* SyntaxKind.DotToken */; @@ -149194,6 +150532,11 @@ var ts; function isSemicolonInsertionContext(context) { return ts.positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile); } + function isNotPropertyAccessOnIntegerLiteral(context) { + return !ts.isPropertyAccessExpression(context.contextNode) + || !ts.isNumericLiteral(context.contextNode.expression) + || context.contextNode.expression.getText().indexOf(".") !== -1; + } })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); /* @internal */ @@ -149277,12 +150620,12 @@ var ts; return map; } function getRuleBucketIndex(row, column) { - ts.Debug.assert(row <= 160 /* SyntaxKind.LastKeyword */ && column <= 160 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 162 /* SyntaxKind.LastKeyword */ && column <= 162 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); return (row * mapRowLength) + column; } var maskBitSize = 5; var mask = 31; // MaskBitSize bits - var mapRowLength = 160 /* SyntaxKind.LastToken */ + 1; + var mapRowLength = 162 /* SyntaxKind.LastToken */ + 1; var RulesPosition; (function (RulesPosition) { RulesPosition[RulesPosition["StopRulesSpecific"] = 0] = "StopRulesSpecific"; @@ -149470,17 +150813,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var body = parent.body; - return !!body && body.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + return !!body && body.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -149743,19 +151086,19 @@ var ts; return modifier.kind; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; - case 256 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; - case 260 /* SyntaxKind.EnumDeclaration */: return 260 /* SyntaxKind.EnumDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: return 136 /* SyntaxKind.GetKeyword */; - case 173 /* SyntaxKind.SetAccessor */: return 149 /* SyntaxKind.SetKeyword */; - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; + case 261 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; + case 259 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; + case 263 /* SyntaxKind.EnumDeclaration */: return 263 /* SyntaxKind.EnumDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: return 137 /* SyntaxKind.GetKeyword */; + case 175 /* SyntaxKind.SetAccessor */: return 151 /* SyntaxKind.SetKeyword */; + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { return 41 /* SyntaxKind.AsteriskToken */; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: var name = ts.getNameOfDeclaration(node); if (name) { return name.kind; @@ -149812,15 +151155,15 @@ var ts; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: switch (container.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return false; } break; case 22 /* SyntaxKind.OpenBracketToken */: case 23 /* SyntaxKind.CloseBracketToken */: - if (container.kind !== 195 /* SyntaxKind.MappedType */) { + if (container.kind !== 197 /* SyntaxKind.MappedType */) { return false; } break; @@ -149924,11 +151267,11 @@ var ts; return inheritedIndentation; } } - var effectiveParentStartLine = child.kind === 165 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 167 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { + if (isFirstListItem && parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -150386,18 +151729,18 @@ var ts; formatting.getRangeOfEnclosingComment = getRangeOfEnclosingComment; function getOpenTokenForList(node, list) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -150405,8 +151748,8 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -150414,24 +151757,24 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 178 /* SyntaxKind.TypeReference */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 181 /* SyntaxKind.TypeQuery */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 200 /* SyntaxKind.ImportType */: + case 180 /* SyntaxKind.TypeReference */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 183 /* SyntaxKind.TypeQuery */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 202 /* SyntaxKind.ImportType */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return 18 /* SyntaxKind.OpenBraceToken */; } return 0 /* SyntaxKind.Unknown */; @@ -150567,11 +151910,11 @@ var ts; // y: undefined, // } // ``` - var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; if (options.indentStyle === ts.IndentStyle.Block || isObjectLiteral) { return getBlockIndent(sourceFile, position, options); } - if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Value.Unknown */) { @@ -150581,7 +151924,7 @@ var ts; var containerList = getListByPosition(position, precedingToken.parent, sourceFile); // use list position if the preceding token is before any list items if (containerList && !ts.rangeContainsRange(containerList, precedingToken)) { - var useTheSameBaseIndentation = [213 /* SyntaxKind.FunctionExpression */, 214 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; + var useTheSameBaseIndentation = [215 /* SyntaxKind.FunctionExpression */, 216 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; var indentSize = useTheSameBaseIndentation ? 0 : options.indentSize; return getActualIndentationForListStartLine(containerList, sourceFile, options) + indentSize; // TODO: GH#18217 } @@ -150746,7 +152089,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 305 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); + (parent.kind === 308 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Value.Unknown */; } @@ -150794,7 +152137,7 @@ var ts; } SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 239 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 242 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 91 /* SyntaxKind.ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -150875,42 +152218,42 @@ var ts; } function getListByRange(start, end, node, sourceFile) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getList(node.typeArguments); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return getList(node.properties); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getList(node.elements); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return getList(node.members); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return getList(node.typeParameters) || getList(node.parameters); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return getList(node.parameters); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return getList(node.typeParameters); - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: return getList(node.typeArguments) || getList(node.arguments); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return getList(node.declarations); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return getList(node.elements); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return getList(node.elements); } function getList(list) { @@ -150933,7 +152276,7 @@ var ts; return findColumnForFirstNonWhitespaceCharacterInLine(sourceFile.getLineAndCharacterOfPosition(list.pos), sourceFile, options); } function getActualIndentationForListItem(node, sourceFile, options, listIndentsChild) { - if (node.parent && node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.parent && node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // VariableDeclarationList has no wrapping tokens return -1 /* Value.Unknown */; } @@ -151006,96 +152349,96 @@ var ts; function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) { var childKind = child ? child.kind : 0 /* SyntaxKind.Unknown */; switch (parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 195 /* SyntaxKind.MappedType */: - case 184 /* SyntaxKind.TupleType */: - case 263 /* SyntaxKind.CaseBlock */: - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 237 /* SyntaxKind.VariableStatement */: - case 271 /* SyntaxKind.ExportAssignment */: - case 247 /* SyntaxKind.ReturnStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 288 /* SyntaxKind.JsxExpression */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 164 /* SyntaxKind.Parameter */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 273 /* SyntaxKind.NamedExports */: - case 269 /* SyntaxKind.NamedImports */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 197 /* SyntaxKind.MappedType */: + case 186 /* SyntaxKind.TupleType */: + case 266 /* SyntaxKind.CaseBlock */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 240 /* SyntaxKind.VariableStatement */: + case 274 /* SyntaxKind.ExportAssignment */: + case 250 /* SyntaxKind.ReturnStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 291 /* SyntaxKind.JsxExpression */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 166 /* SyntaxKind.Parameter */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 276 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: - if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 205 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 + case 257 /* SyntaxKind.VariableDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: + if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 return rangeIsOnOneLine(sourceFile, child); } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 278 /* SyntaxKind.JsxElement */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 281 /* SyntaxKind.JsxElement */) { var parentStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, parent.pos)).line; var childStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, child.pos)).line; return parentStartLine !== childStartLine; } - if (parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { return true; } break; - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return childKind !== 235 /* SyntaxKind.Block */; - case 214 /* SyntaxKind.ArrowFunction */: - if (sourceFile && childKind === 212 /* SyntaxKind.ParenthesizedExpression */) { + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return childKind !== 238 /* SyntaxKind.Block */; + case 216 /* SyntaxKind.ArrowFunction */: + if (sourceFile && childKind === 214 /* SyntaxKind.ParenthesizedExpression */) { return rangeIsOnOneLine(sourceFile, child); } - return childKind !== 235 /* SyntaxKind.Block */; - case 272 /* SyntaxKind.ExportDeclaration */: - return childKind !== 273 /* SyntaxKind.NamedExports */; - case 266 /* SyntaxKind.ImportDeclaration */: - return childKind !== 267 /* SyntaxKind.ImportClause */ || - (!!child.namedBindings && child.namedBindings.kind !== 269 /* SyntaxKind.NamedImports */); - case 278 /* SyntaxKind.JsxElement */: - return childKind !== 281 /* SyntaxKind.JsxClosingElement */; - case 282 /* SyntaxKind.JsxFragment */: - return childKind !== 284 /* SyntaxKind.JsxClosingFragment */; - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: - if (childKind === 182 /* SyntaxKind.TypeLiteral */ || childKind === 184 /* SyntaxKind.TupleType */) { + return childKind !== 238 /* SyntaxKind.Block */; + case 275 /* SyntaxKind.ExportDeclaration */: + return childKind !== 276 /* SyntaxKind.NamedExports */; + case 269 /* SyntaxKind.ImportDeclaration */: + return childKind !== 270 /* SyntaxKind.ImportClause */ || + (!!child.namedBindings && child.namedBindings.kind !== 272 /* SyntaxKind.NamedImports */); + case 281 /* SyntaxKind.JsxElement */: + return childKind !== 284 /* SyntaxKind.JsxClosingElement */; + case 285 /* SyntaxKind.JsxFragment */: + return childKind !== 287 /* SyntaxKind.JsxClosingFragment */; + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + if (childKind === 184 /* SyntaxKind.TypeLiteral */ || childKind === 186 /* SyntaxKind.TupleType */) { return false; } break; @@ -151106,11 +152449,11 @@ var ts; SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; function isControlFlowEndingStatement(kind, parent) { switch (kind) { - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return parent.kind !== 235 /* SyntaxKind.Block */; + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + return parent.kind !== 238 /* SyntaxKind.Block */; default: return false; } @@ -151327,7 +152670,7 @@ var ts; * Checks if 'candidate' argument is a legal separator in the list that contains 'node' as an element */ function isSeparator(node, candidate) { - return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)); + return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)); } function isThisTypeAnnotatable(containingFunction) { return ts.isFunctionExpression(containingFunction) || ts.isFunctionDeclaration(containingFunction); @@ -151559,7 +152902,7 @@ var ts; } } else { - endNode = (_a = (node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; + endNode = (_a = (node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; } this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " }); return true; @@ -151725,18 +153068,18 @@ var ts; }; ChangeTracker.prototype.getInsertNodeAfterOptionsWorker = function (node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return { prefix: this.newLineCharacter, suffix: this.newLineCharacter }; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: case 10 /* SyntaxKind.StringLiteral */: case 79 /* SyntaxKind.Identifier */: return { prefix: ", " }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return { suffix: "," + this.newLineCharacter }; case 93 /* SyntaxKind.ExportKeyword */: return { prefix: " " }; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return {}; default: ts.Debug.assert(ts.isStatement(node) || ts.isClassOrTypeElement(node)); // Else we haven't handled this kind of node yet -- add it @@ -151745,7 +153088,7 @@ var ts; }; ChangeTracker.prototype.insertName = function (sourceFile, node, name) { ts.Debug.assert(!node.name); - if (node.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind === 216 /* SyntaxKind.ArrowFunction */) { var arrow = ts.findChildOfKind(node, 38 /* SyntaxKind.EqualsGreaterThanToken */, sourceFile); var lparen = ts.findChildOfKind(node, 20 /* SyntaxKind.OpenParenToken */, sourceFile); if (lparen) { @@ -151759,14 +153102,14 @@ var ts; // Replacing full range of arrow to get rid of the leading space -- replace ` =>` with `)` this.replaceRange(sourceFile, arrow, ts.factory.createToken(21 /* SyntaxKind.CloseParenToken */)); } - if (node.body.kind !== 235 /* SyntaxKind.Block */) { + if (node.body.kind !== 238 /* SyntaxKind.Block */) { // `() => 0` => `function f() { return 0; }` this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.factory.createToken(18 /* SyntaxKind.OpenBraceToken */), ts.factory.createToken(105 /* SyntaxKind.ReturnKeyword */)], { joiner: " ", suffix: " " }); this.insertNodesAt(sourceFile, node.body.end, [ts.factory.createToken(26 /* SyntaxKind.SemicolonToken */), ts.factory.createToken(19 /* SyntaxKind.CloseBraceToken */)], { joiner: " " }); } } else { - var pos = ts.findChildOfKind(node, node.kind === 213 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; + var pos = ts.findChildOfKind(node, node.kind === 215 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; this.insertNodeAt(sourceFile, pos, ts.factory.createIdentifier(name), { prefix: " " }); } }; @@ -151943,10 +153286,10 @@ var ts; }()); textChanges_3.ChangeTracker = ChangeTracker; function updateJSDocHost(parent) { - if (parent.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (parent.kind !== 216 /* SyntaxKind.ArrowFunction */) { return parent; } - var jsDocNode = parent.parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ ? + var jsDocNode = parent.parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ ? parent.parent : parent.parent.parent; jsDocNode.jsDoc = parent.jsDoc; @@ -151958,16 +153301,16 @@ var ts; return undefined; } switch (oldTag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 343 /* SyntaxKind.JSDocParameterTag */: { var oldParam = oldTag; var newParam = newTag; return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText ? ts.factory.createJSDocParameterTag(/*tagName*/ undefined, newParam.name, /*isBracketed*/ false, newParam.typeExpression, newParam.isNameFirst, oldParam.comment) : undefined; } - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: return ts.factory.createJSDocReturnTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return ts.factory.createJSDocTypeTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); } } @@ -151975,6 +153318,26 @@ var ts; function startPositionToDeleteNodeInList(sourceFile, node) { return ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, { leadingTriviaOption: LeadingTriviaOption.IncludeAll }), /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); } + function endPositionToDeleteNodeInList(sourceFile, node, prevNode, nextNode) { + var end = startPositionToDeleteNodeInList(sourceFile, nextNode); + if (prevNode === undefined || ts.positionsAreOnSameLine(getAdjustedEndPosition(sourceFile, node, {}), end, sourceFile)) { + return end; + } + var token = ts.findPrecedingToken(nextNode.getStart(sourceFile), sourceFile); + if (isSeparator(node, token)) { + var prevToken = ts.findPrecedingToken(node.getStart(sourceFile), sourceFile); + if (isSeparator(prevNode, prevToken)) { + var pos = ts.skipTrivia(sourceFile.text, token.getEnd(), /*stopAfterLineBreak*/ true, /*stopAtComments*/ true); + if (ts.positionsAreOnSameLine(prevToken.getStart(sourceFile), token.getStart(sourceFile), sourceFile)) { + return ts.isLineBreak(sourceFile.text.charCodeAt(pos - 1)) ? pos - 1 : pos; + } + if (ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + return pos; + } + } + } + return end; + } function getClassOrObjectBraceEnds(cls, sourceFile) { var open = ts.findChildOfKind(cls, 18 /* SyntaxKind.OpenBraceToken */, sourceFile); var close = ts.findChildOfKind(cls, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); @@ -152361,14 +153724,14 @@ var ts; } textChanges_3.isValidLocationToAddComment = isValidLocationToAddComment; function needSemicolonBetween(a, b) { - return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[` } var deleteDeclaration; (function (deleteDeclaration_1) { function deleteDeclaration(changes, deletedNodesInLists, sourceFile, node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: { + case 166 /* SyntaxKind.Parameter */: { var oldFunction = node.parent; if (ts.isArrowFunction(oldFunction) && oldFunction.parameters.length === 1 && @@ -152383,17 +153746,17 @@ var ts; } break; } - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var isFirstImport = sourceFile.imports.length && node === ts.first(sourceFile.imports).parent || node === ts.find(sourceFile.statements, ts.isAnyImportSyntax); // For first import, leave header comment in place, otherwise only delete JSDoc comments deleteNode(changes, sourceFile, node, { leadingTriviaOption: isFirstImport ? LeadingTriviaOption.Exclude : ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine, }); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: var pattern = node.parent; - var preserveComma = pattern.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); + var preserveComma = pattern.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); if (preserveComma) { deleteNode(changes, sourceFile, node); } @@ -152401,13 +153764,13 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: var namedImports = node.parent; if (namedImports.elements.length === 1) { deleteImportBinding(changes, sourceFile, namedImports); @@ -152416,7 +153779,7 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: deleteImportBinding(changes, sourceFile, node); break; case 26 /* SyntaxKind.SemicolonToken */: @@ -152425,8 +153788,8 @@ var ts; case 98 /* SyntaxKind.FunctionKeyword */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: LeadingTriviaOption.Exclude }); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -152477,13 +153840,13 @@ var ts; // Delete the entire import declaration // |import * as ns from './file'| // |import { a } from './file'| - var importDecl = ts.getAncestor(node, 266 /* SyntaxKind.ImportDeclaration */); + var importDecl = ts.getAncestor(node, 269 /* SyntaxKind.ImportDeclaration */); deleteNode(changes, sourceFile, importDecl); } } function deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node) { var parent = node.parent; - if (parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (parent.kind === 295 /* SyntaxKind.CatchClause */) { // TODO: There's currently no unused diagnostic for this, could be a suggestion changes.deleteNodeRange(sourceFile, ts.findChildOfKind(parent, 20 /* SyntaxKind.OpenParenToken */, sourceFile), ts.findChildOfKind(parent, 21 /* SyntaxKind.CloseParenToken */, sourceFile)); return; @@ -152494,14 +153857,14 @@ var ts; } var gp = parent.parent; switch (gp.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: changes.replaceNode(sourceFile, node, ts.factory.createObjectLiteralExpression()); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: deleteNode(changes, sourceFile, parent); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: deleteNode(changes, sourceFile, gp, { leadingTriviaOption: ts.hasJSDocNodes(gp) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -152532,7 +153895,7 @@ var ts; deletedNodesInLists.add(node); changes.deleteRange(sourceFile, { pos: startPositionToDeleteNodeInList(sourceFile, node), - end: index === containingList.length - 1 ? getAdjustedEndPosition(sourceFile, node, {}) : startPositionToDeleteNodeInList(sourceFile, containingList[index + 1]), + end: index === containingList.length - 1 ? getAdjustedEndPosition(sourceFile, node, {}) : endPositionToDeleteNodeInList(sourceFile, node, containingList[index - 1], containingList[index + 1]), }); } })(textChanges = ts.textChanges || (ts.textChanges = {})); @@ -152688,8 +154051,8 @@ var ts; }); function makeChange(changeTracker, sourceFile, assertion) { var replacement = ts.isAsExpression(assertion) - ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)) - : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), assertion.expression); + ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)) + : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), assertion.expression); changeTracker.replaceNode(sourceFile, assertion.expression, replacement); } function getAssertion(sourceFile, pos) { @@ -152773,7 +154136,7 @@ var ts; } } fixedDeclarations === null || fixedDeclarations === void 0 ? void 0 : fixedDeclarations.add(ts.getNodeId(insertionSite)); - var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 256 /* ModifierFlags.Async */))); + var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 512 /* ModifierFlags.Async */))); changeTracker.replaceNode(sourceFile, insertionSite, cloneWithModifier); } function getFixableErrorSpanDeclaration(sourceFile, span) { @@ -152819,7 +154182,7 @@ var ts; ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_type_1.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2.code, - ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap.code, + ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap.code, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined.code, ts.Diagnostics.Type_0_is_not_an_array_type.code, ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type.code, @@ -152917,7 +154280,7 @@ var ts; } var declaration = ts.tryCast(symbol.valueDeclaration, ts.isVariableDeclaration); var variableName = declaration && ts.tryCast(declaration.name, ts.isIdentifier); - var variableStatement = ts.getAncestor(declaration, 237 /* SyntaxKind.VariableStatement */); + var variableStatement = ts.getAncestor(declaration, 240 /* SyntaxKind.VariableStatement */); if (!declaration || !variableStatement || declaration.type || !declaration.initializer || @@ -152995,13 +154358,22 @@ var ts; function isInsideAwaitableBody(node) { return node.kind & 32768 /* NodeFlags.AwaitContext */ || !!ts.findAncestor(node, function (ancestor) { return ancestor.parent && ts.isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || - ts.isBlock(ancestor) && (ancestor.parent.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - ancestor.parent.kind === 213 /* SyntaxKind.FunctionExpression */ || - ancestor.parent.kind === 214 /* SyntaxKind.ArrowFunction */ || - ancestor.parent.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.isBlock(ancestor) && (ancestor.parent.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + ancestor.parent.kind === 215 /* SyntaxKind.FunctionExpression */ || + ancestor.parent.kind === 216 /* SyntaxKind.ArrowFunction */ || + ancestor.parent.kind === 171 /* SyntaxKind.MethodDeclaration */); }); } function makeChange(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) { + if (ts.isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) { + var exprType = checker.getTypeAtLocation(insertionSite); + var asyncIter = checker.getAsyncIterableType(); + if (asyncIter && checker.isTypeAssignableTo(exprType, asyncIter)) { + var forOf = insertionSite.parent; + changeTracker.replaceNode(sourceFile, forOf, ts.factory.updateForOfStatement(forOf, ts.factory.createToken(133 /* SyntaxKind.AwaitKeyword */), forOf.initializer, forOf.expression, forOf.statement)); + return; + } + } if (ts.isBinaryExpression(insertionSite)) { for (var _i = 0, _a = [insertionSite.left, insertionSite.right]; _i < _a.length; _i++) { var side = _a[_i]; @@ -153117,10 +154489,10 @@ var ts; function isPossiblyPartOfDestructuring(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return true; default: return false; @@ -153135,7 +154507,7 @@ var ts; function isPossiblyPartOfCommaSeperatedInitializer(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: case 27 /* SyntaxKind.CommaToken */: return true; default: @@ -153184,9 +154556,9 @@ var ts; return; } var declaration = token.parent; - if (declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + if (declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && (!fixedNodes || ts.tryAddToSet(fixedNodes, declaration))) { - changeTracker.insertModifierBefore(sourceFile, 135 /* SyntaxKind.DeclareKeyword */, declaration); + changeTracker.insertModifierBefore(sourceFile, 136 /* SyntaxKind.DeclareKeyword */, declaration); } } })(codefix = ts.codefix || (ts.codefix = {})); @@ -153340,7 +154712,7 @@ var ts; var add = toAdd_1[_i]; var d = add.valueDeclaration; if (d && (ts.isPropertySignature(d) || ts.isPropertyDeclaration(d)) && d.type) { - var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 187 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ + var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 189 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ ts.factory.createTypeReferenceNode("undefined") ], false)); changes.replaceNode(d.getSourceFile(), d.type, t); @@ -153420,26 +154792,26 @@ var ts; } function isDeclarationWithType(node) { return ts.isFunctionLikeDeclaration(node) || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } function transformJSDocType(node) { switch (node.kind) { - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return ts.factory.createTypeReferenceNode("any", ts.emptyArray); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return transformJSDocOptionalType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return transformJSDocType(node.type); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return transformJSDocNullableType(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return transformJSDocVariadicType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return transformJSDocFunctionType(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return transformJSDocTypeReference(node); default: var visited = ts.visitEachChild(node, transformJSDocType, ts.nullTransformationContext); @@ -153460,11 +154832,11 @@ var ts; var _a; // TODO: This does not properly handle `function(new:C, string)` per https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System#the-javascript-type-language // however we do handle it correctly in `serializeTypeForDeclaration` in checker.ts - return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 318 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 + var isRest = node.type.kind === 321 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : node.dotDotDotToken; return ts.factory.createParameterDeclaration(node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -153503,8 +154875,8 @@ var ts; function transformJSDocIndexSignature(node) { var index = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, - /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "n" : "s", - /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), + /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "n" : "s", + /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), /*initializer*/ undefined); var indexSignature = ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature(/*modifiers*/ undefined, [index], node.typeArguments[1])]); ts.setEmitFlags(indexSignature, 1 /* EmitFlags.SingleLine */); @@ -153539,8 +154911,8 @@ var ts; return undefined; } var ctorDeclaration = ctorSymbol.valueDeclaration; - if (ts.isFunctionDeclaration(ctorDeclaration)) { - changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunctionDeclaration(ctorDeclaration)); + if (ts.isFunctionDeclaration(ctorDeclaration) || ts.isFunctionExpression(ctorDeclaration)) { + changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunction(ctorDeclaration)); } else if (ts.isVariableDeclaration(ctorDeclaration)) { var classDeclaration = createClassFromVariableDeclaration(ctorDeclaration); @@ -153644,7 +155016,7 @@ var ts; return; } // delete the entire statement if this expression is the sole expression to take care of the semicolon at the end - var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ + var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ ? assignmentBinaryExpression.parent : assignmentBinaryExpression; changes.delete(sourceFile, nodeToDelete); if (!assignmentExpr) { @@ -153696,7 +155068,7 @@ var ts; return createArrowFunctionExpressionMember(members, expression, name); } function createFunctionExpressionMember(members, functionExpression, name) { - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -153707,14 +155079,14 @@ var ts; var arrowFunctionBody = arrowFunction.body; var bodyBlock; // case 1: () => { return [1,2,3] } - if (arrowFunctionBody.kind === 235 /* SyntaxKind.Block */) { + if (arrowFunctionBody.kind === 238 /* SyntaxKind.Block */) { bodyBlock = arrowFunctionBody; } // case 2: () => [1,2,3] else { bodyBlock = ts.factory.createBlock([ts.factory.createReturnStatement(arrowFunctionBody)]); } - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -153737,7 +155109,7 @@ var ts; // Don't call copyComments here because we'll already leave them in place return cls; } - function createClassFromFunctionDeclaration(node) { + function createClassFromFunction(node) { var memberElements = createClassElementsFromSymbol(ctorSymbol); if (node.body) { memberElements.unshift(ts.factory.createConstructorDeclaration(/*modifiers*/ undefined, node.parameters, node.body)); @@ -153827,7 +155199,7 @@ var ts; return; } var pos = ts.skipTrivia(sourceFile.text, ts.moveRangePastModifiers(functionToConvert).pos); - changes.insertModifierAt(sourceFile, pos, 131 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); + changes.insertModifierAt(sourceFile, pos, 132 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); var _loop_12 = function (returnStatement) { ts.forEachChild(returnStatement, function visit(node) { if (ts.isCallExpression(node)) { @@ -154233,7 +155605,7 @@ var ts; case 104 /* SyntaxKind.NullKeyword */: // do not produce a transformed statement for a null argument break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 79 /* SyntaxKind.Identifier */: // identifier includes undefined if (!inputArgName) { // undefined was argument passed to promise handler @@ -154255,8 +155627,8 @@ var ts; continuationArgName.types.push(transformer.checker.getAwaitedType(returnType) || returnType); } return varDeclOrAssignment; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: { + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: { var funcBody = func.body; var returnType_1 = (_a = getLastCallSignature(transformer.checker.getTypeAtLocation(func), transformer.checker)) === null || _a === void 0 ? void 0 : _a.getReturnType(); // Arrow functions with block bodies { } will enter this control flow @@ -154425,7 +155797,7 @@ var ts; name = getMapEntryOrDefault(funcNode.name); } // return undefined argName when arg is null or undefined - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!name || "identifier" in name && name.identifier.text === "undefined") { return undefined; } @@ -154534,10 +155906,10 @@ var ts; } var importNode = ts.importFromModuleSpecifier(moduleSpecifier); switch (importNode.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.replaceNode(importingFile, importNode, ts.makeImport(importNode.name, /*namedImports*/ undefined, moduleSpecifier, quotePreference)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isRequireCall(importNode, /*checkArgumentIsStringLiteralLike*/ false)) { changes.replaceNode(importingFile, importNode, ts.factory.createPropertyAccessExpression(ts.getSynthesizedDeepClone(importNode), "default")); } @@ -154604,20 +155976,20 @@ var ts; } function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, useSitesToUnqualify, quotePreference) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference); return false; - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; switch (expression.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { if (ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true)) { // For side-effecting require() call, just make a side-effecting import. changes.replaceNode(sourceFile, statement, ts.makeImport(/*name*/ undefined, /*namedImports*/ undefined, expression.arguments[0], quotePreference)); } return false; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var operatorToken = expression.operatorToken; return operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports, useSitesToUnqualify); } @@ -154666,8 +156038,8 @@ var ts; /** Converts `const name = require("moduleSpecifier").propertyName` */ function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: { // `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;` var tmp = makeUniqueName(propertyName, identifiers); return convertedImports([ @@ -154718,16 +156090,16 @@ var ts; function tryChangeModuleExportsObject(object, useSitesToUnqualify) { var statements = ts.mapAllOrFail(object.properties, function (prop) { switch (prop.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`. // falls through - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return undefined; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer, useSitesToUnqualify); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)], prop, useSitesToUnqualify); default: ts.Debug.assertNever(prop, "Convert to ES6 got invalid prop kind ".concat(prop.kind)); @@ -154791,7 +156163,7 @@ var ts; function convertExportsDotXEquals_replaceNode(name, exported, useSitesToUnqualify) { var modifiers = [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)]; switch (exported.kind) { - case 213 /* SyntaxKind.FunctionExpression */: { + case 215 /* SyntaxKind.FunctionExpression */: { var expressionName = exported.name; if (expressionName && expressionName.text !== name) { // `exports.f = function g() {}` -> `export const f = function g() {}` @@ -154799,10 +156171,10 @@ var ts; } } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // `exports.f = function() {}` --> `export function f() {}` return functionExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // `exports.C = class {}` --> `export class C {}` return classExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); default: @@ -154822,7 +156194,7 @@ var ts; : ts.getSynthesizedDeepCloneWithReplacements(nodeOrNodes, /*includeTrivia*/ true, replaceNode); function replaceNode(original) { // We are replacing `mod.SomeExport` wih `SomeExport`, so we only need to look at PropertyAccessExpressions - if (original.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (original.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var replacement = useSitesToUnqualify.get(original); // Remove entry from `useSitesToUnqualify` so the refactor knows it's taken care of by the parent statement we're replacing useSitesToUnqualify.delete(original); @@ -154837,7 +156209,7 @@ var ts; */ function convertSingleImport(name, moduleSpecifier, checker, identifiers, target, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { var importSpecifiers = ts.mapAllOrFail(name.elements, function (e) { return e.dotDotDotToken || e.initializer || e.propertyName && !ts.isIdentifier(e.propertyName) || !ts.isIdentifier(e.name) ? undefined @@ -154848,7 +156220,7 @@ var ts; } } // falls through -- object destructuring has an interesting pattern and must be a variable declaration - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 204 /* SyntaxKind.ArrayBindingPattern */: { /* import x from "x"; const [a, b, c] = x; @@ -154941,11 +156313,11 @@ var ts; function isFreeIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return parent.propertyName !== node; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return parent.propertyName !== node; default: return true; @@ -155056,7 +156428,7 @@ var ts; var exportDeclaration = exportClause.parent; var typeExportSpecifiers = getTypeExportSpecifiers(exportSpecifier, context); if (typeExportSpecifiers.length === exportClause.elements.length) { - changes.insertModifierBefore(context.sourceFile, 152 /* SyntaxKind.TypeKeyword */, exportClause); + changes.insertModifierBefore(context.sourceFile, 154 /* SyntaxKind.TypeKeyword */, exportClause); } else { var valueExportDeclaration = ts.factory.updateExportDeclaration(exportDeclaration, exportDeclaration.modifiers, @@ -155292,27 +156664,29 @@ var ts; errorCodes: errorCodes, getCodeActions: function (context) { var errorCode = context.errorCode, preferences = context.preferences, sourceFile = context.sourceFile, span = context.span, program = context.program; - var info = getFixesInfo(context, errorCode, span.start, /*useAutoImportProvider*/ true); + var info = getFixInfos(context, errorCode, span.start, /*useAutoImportProvider*/ true); if (!info) return undefined; - var fixes = info.fixes, symbolName = info.symbolName, errorIdentifierText = info.errorIdentifierText; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - return fixes.map(function (fix) { return codeActionForFix(context, sourceFile, symbolName, fix, - /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); }); + return info.map(function (_a) { + var fix = _a.fix, symbolName = _a.symbolName, errorIdentifierText = _a.errorIdentifierText; + return codeActionForFix(context, sourceFile, symbolName, fix, + /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); + }); }, fixIds: [importFixId], getAllCodeActions: function (context) { - var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host; - var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host); + var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host, cancellationToken = context.cancellationToken; + var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host, cancellationToken); codefix.eachDiagnostic(context, errorCodes, function (diag) { return importAdder.addImportFromDiagnostic(diag, context); }); return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, importAdder.writeFixes)); }, }); - function createImportAdder(sourceFile, program, preferences, host) { - return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host); + function createImportAdder(sourceFile, program, preferences, host, cancellationToken) { + return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host, cancellationToken); } codefix.createImportAdder = createImportAdder; - function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host) { + function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host, cancellationToken) { var compilerOptions = program.getCompilerOptions(); // Namespace fixes don't conflict, so just build a list. var addToNamespace = []; @@ -155323,27 +156697,26 @@ var ts; var newImports = new ts.Map(); return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes }; function addImportFromDiagnostic(diagnostic, context) { - var info = getFixesInfo(context, diagnostic.code, diagnostic.start, useAutoImportProvider); - if (!info || !info.fixes.length) + var info = getFixInfos(context, diagnostic.code, diagnostic.start, useAutoImportProvider); + if (!info || !info.length) return; - addImport(info); + addImport(ts.first(info)); } function addImportFromExportedSymbol(exportedSymbol, isValidTypeOnlyUseSite) { var moduleSymbol = ts.Debug.checkDefined(exportedSymbol.parent); var symbolName = ts.getNameForExportedSymbol(exportedSymbol, ts.getEmitScriptTarget(compilerOptions)); var checker = program.getTypeChecker(); var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker)); - var exportInfo = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider); + var exportInfo = getAllExportInfoForSymbol(sourceFile, symbol, symbolName, /*isJsxTagName*/ false, program, host, preferences, cancellationToken); var useRequire = shouldUseRequire(sourceFile, program); - var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); + var fix = getImportFixForSymbol(sourceFile, ts.Debug.checkDefined(exportInfo), moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); if (fix) { - addImport({ fixes: [fix], symbolName: symbolName, errorIdentifierText: undefined }); + addImport({ fix: fix, symbolName: symbolName, errorIdentifierText: undefined }); } } function addImport(info) { var _a, _b; - var fixes = info.fixes, symbolName = info.symbolName; - var fix = ts.first(fixes); + var fix = info.fix, symbolName = info.symbolName; switch (fix.kind) { case 0 /* ImportFixKind.UseNamespace */: addToNamespace.push(fix); @@ -155510,11 +156883,12 @@ var ts; AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required"; AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed"; })(AddAsTypeOnly || (AddAsTypeOnly = {})); - function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences) { + function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) { var compilerOptions = program.getCompilerOptions(); var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name)) - ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] - : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, isJsxTagName, host, program, preferences, /*useAutoImportProvider*/ true); + ? [getSingleExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] + : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName, isJsxTagName, program, host, preferences, cancellationToken); + ts.Debug.assertIsDefined(exportInfos); var useRequire = shouldUseRequire(sourceFile, program); var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position)); var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, { symbolName: symbolName, position: position }, isValidTypeOnlyUseSite, useRequire, host, preferences)); @@ -155527,7 +156901,7 @@ var ts; codefix.getImportCompletionAction = getImportCompletionAction; function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) { var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions); + var symbolName = ts.single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions)); var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program); var includeSymbolNameInDescription = symbolName !== symbolToken.text; return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* QuotePreference.Double */, compilerOptions)); @@ -155542,7 +156916,16 @@ var ts; var description = _a.description, changes = _a.changes, commands = _a.commands; return { description: description, changes: changes, commands: commands }; } - function getSymbolExportInfoForSymbol(symbol, moduleSymbol, program, host) { + function getAllExportInfoForSymbol(importingFile, symbol, symbolName, preferCapitalized, program, host, preferences, cancellationToken) { + var getChecker = createGetChecker(program, host); + return ts.getExportInfoMap(importingFile, host, program, preferences, cancellationToken) + .search(importingFile.path, preferCapitalized, function (name) { return name === symbolName; }, function (info) { + if (ts.skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol) { + return info; + } + }); + } + function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) { var _a, _b; var compilerOptions = program.getCompilerOptions(); var mainProgramInfo = getInfoWithChecker(program.getTypeChecker(), /*isFromPackageJson*/ false); @@ -155562,35 +156945,6 @@ var ts; } } } - function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, isJsxTagName, host, program, preferences, useAutoImportProvider) { - var result = []; - var compilerOptions = program.getCompilerOptions(); - var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) { - return ts.createModuleSpecifierResolutionHost(isFromPackageJson ? host.getPackageJsonAutoImportProvider() : program, host); - }); - ts.forEachExternalModuleToImportFrom(program, host, preferences, useAutoImportProvider, function (moduleSymbol, moduleFile, program, isFromPackageJson) { - var checker = program.getTypeChecker(); - // Don't import from a re-export when looking "up" like to `./index` or `../index`. - if (moduleFile && moduleSymbol !== exportingModuleSymbol && ts.startsWith(importingFile.fileName, ts.getDirectoryPath(moduleFile.fileName))) { - return; - } - var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions); - if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: defaultInfo.symbol, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: defaultInfo.exportKind, targetFlags: ts.skipAlias(defaultInfo.symbol, checker).flags, isFromPackageJson: isFromPackageJson }); - } - for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) { - var exported = _a[_i]; - if (exported.name === symbolName && checker.getMergedSymbol(ts.skipAlias(exported, checker)) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: exported, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: 0 /* ExportKind.Named */, targetFlags: ts.skipAlias(exported, checker).flags, isFromPackageJson: isFromPackageJson }); - } - } - }); - return result; - function isImportable(program, moduleFile, isFromPackageJson) { - var _a; - return !moduleFile || ts.isImportableFile(program, importingFile, moduleFile, preferences, /*packageJsonFilter*/ undefined, getModuleSpecifierResolutionHost(isFromPackageJson), (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host)); - } - } function getImportFixes(exportInfos, useNamespaceInfo, /** undefined only for missing JSX namespace */ isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap, fromCacheOnly) { @@ -155641,11 +156995,11 @@ var ts; function getTargetModuleFromNamespaceLikeImport(declaration, checker) { var _a; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.resolveExternalModuleName(declaration.initializer.arguments[0]); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checker.getAliasedSymbol(declaration.symbol); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var namespaceImport = ts.tryCast((_a = declaration.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings, ts.isNamespaceImport); return namespaceImport && checker.getAliasedSymbol(namespaceImport.symbol); default: @@ -155655,11 +157009,11 @@ var ts; function getNamespaceLikeImportText(declaration) { var _a, _b, _c; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.tryCast(declaration.name, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return declaration.name.text; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return (_c = ts.tryCast((_b = declaration.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings, ts.isNamespaceImport)) === null || _c === void 0 ? void 0 : _c.name.text; default: return ts.Debug.assertNever(declaration); @@ -155686,12 +157040,12 @@ var ts; function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, compilerOptions) { return ts.firstDefined(existingImports, function (_a) { var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags; - if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // These kinds of imports are not combinable with anything return undefined; } - if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { - return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { + return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? { kind: 2 /* ImportFixKind.AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind: importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* AddAsTypeOnly.NotAllowed */ } : undefined; } @@ -155712,7 +157066,7 @@ var ts; )) return undefined; if (importKind === 0 /* ImportKind.Named */ && - (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 268 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import + (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 271 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import ) return undefined; return { @@ -155735,7 +157089,7 @@ var ts; (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i.parent); } } - else if (i.kind === 266 /* SyntaxKind.ImportDeclaration */ || i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (i.kind === 269 /* SyntaxKind.ImportDeclaration */ || i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); if (moduleSymbol) { (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i); @@ -155784,11 +157138,14 @@ var ts; // 5. Literally nothing to go on return true; } + function createGetChecker(program, host) { + return ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + } function getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfo, host, preferences, fromCacheOnly) { var isJs = ts.isSourceFileJS(sourceFile); var compilerOptions = program.getCompilerOptions(); var moduleSpecifierResolutionHost = ts.createModuleSpecifierResolutionHost(program, host); - var getChecker = ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + var getChecker = createGetChecker(program, host); var rejectNodeModulesRelativePaths = ts.moduleResolutionUsesNodeModules(ts.getEmitModuleResolutionKind(compilerOptions)); var getModuleSpecifiers = fromCacheOnly ? function (moduleSymbol) { return ({ moduleSpecifiers: ts.moduleSpecifiers.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }); } @@ -155832,7 +157189,7 @@ var ts; return { kind: 3 /* ImportFixKind.AddNew */, moduleSpecifier: moduleSpecifier, importKind: importKind, addAsTypeOnly: addAsTypeOnly, useRequire: useRequire }; } } - function getFixesInfo(context, errorCode, pos, useAutoImportProvider) { + function getFixInfos(context, errorCode, pos, useAutoImportProvider) { var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos); var info; if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { @@ -155842,19 +157199,23 @@ var ts; return undefined; } else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) { - var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions()); + var symbolName_1 = ts.single(getSymbolNamesToImport(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions())); var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program); - return fix && { fixes: [fix], symbolName: symbolName_1, errorIdentifierText: symbolToken.text }; + return fix && [{ fix: fix, symbolName: symbolName_1, errorIdentifierText: symbolToken.text }]; } else { info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider); } var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host); - return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter, context.host) }); + return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host); } - function sortFixes(fixes, sourceFile, program, packageJsonImportFilter, host) { + function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host) { var _toPath = function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); }; - return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); }); + return ts.sort(fixes, function (a, b) { + return ts.compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || + ts.compareValues(a.fix.kind, b.fix.kind) || + compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); + }); } function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) { if (!ts.some(fixes)) @@ -155905,7 +157266,6 @@ var ts; return 0 /* Comparison.EqualTo */; } function getFixesInfoForUMDImport(_a, token) { - var _b; var sourceFile = _a.sourceFile, program = _a.program, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var umdSymbol = getUmdSymbol(token, checker); @@ -155917,7 +157277,7 @@ var ts; var useRequire = shouldUseRequire(sourceFile, program); var position = ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined; var fixes = getImportFixes(exportInfo, position ? { position: position, symbolName: symbolName } : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences).fixes; - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: (_b = ts.tryCast(token, ts.isIdentifier)) === null || _b === void 0 ? void 0 : _b.text }; + return fixes.map(function (fix) { var _a; return ({ fix: fix, symbolName: symbolName, errorIdentifierText: (_a = ts.tryCast(token, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text }); }); } function getUmdSymbol(token, checker) { // try the identifier to see if it is the umd symbol @@ -155978,19 +157338,20 @@ var ts; var sourceFile = _a.sourceFile, program = _a.program, cancellationToken = _a.cancellationToken, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, checker, symbolToken, compilerOptions); - // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. - if (symbolName === "default" /* InternalSymbolName.Default */) { - return undefined; - } - var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); - var useRequire = shouldUseRequire(sourceFile, program); - var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); - var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { - var _ = _a[0], exportInfos = _a[1]; - return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; - })); - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: symbolToken.text }; + return ts.flatMap(getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions), function (symbolName) { + // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. + if (symbolName === "default" /* InternalSymbolName.Default */) { + return undefined; + } + var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); + var useRequire = shouldUseRequire(sourceFile, program); + var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); + var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { + var _ = _a[0], exportInfos = _a[1]; + return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; + })); + return fixes.map(function (fix) { return ({ fix: fix, symbolName: symbolName, errorIdentifierText: symbolToken.text, isJsxNamespaceFix: symbolName !== symbolToken.text }); }); + }); } function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) { var checker = program.getTypeChecker(); @@ -156002,15 +157363,16 @@ var ts; return undefined; return { kind: 4 /* ImportFixKind.PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration }; } - function getSymbolName(sourceFile, checker, symbolToken, compilerOptions) { + function getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions) { var parent = symbolToken.parent; if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && ts.jsxModeNeedsExplicitImport(compilerOptions.jsx)) { var jsxNamespace = checker.getJsxNamespace(sourceFile); if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) { - return jsxNamespace; + var needsComponentNameFix = !ts.isIntrinsicJsxName(symbolToken.text) && !checker.resolveName(symbolToken.text, symbolToken, 111551 /* SymbolFlags.Value */, /*excludeGlobals*/ false); + return needsComponentNameFix ? [symbolToken.text, jsxNamespace] : [jsxNamespace]; } } - return symbolToken.text; + return [symbolToken.text]; } function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) { if (ts.isIntrinsicJsxName(symbolToken.text)) @@ -156119,7 +157481,7 @@ var ts; case 4 /* ImportFixKind.PromoteTypeOnly */: { var typeOnlyAliasDeclaration = fix.typeOnlyAliasDeclaration; var promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile); - return promotedDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ + return promotedDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ ? [ts.Diagnostics.Remove_type_from_import_of_0_from_1, symbolName, getModuleSpecifierText(promotedDeclaration.parent.parent)] : [ts.Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)]; } @@ -156129,7 +157491,7 @@ var ts; } function getModuleSpecifierText(promotedDeclaration) { var _a, _b; - return promotedDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ + return promotedDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? ((_b = ts.tryCast((_a = ts.tryCast(promotedDeclaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression, ts.isStringLiteralLike)) === null || _b === void 0 ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : ts.cast(promotedDeclaration.parent.moduleSpecifier, ts.isStringLiteral).text; } @@ -156137,7 +157499,7 @@ var ts; // See comment in `doAddExistingFix` on constant with the same name. var convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules; switch (aliasDeclaration.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: if (aliasDeclaration.isTypeOnly) { if (aliasDeclaration.parent.elements.length > 1 && ts.OrganizeImports.importSpecifiersAreSorted(aliasDeclaration.parent.elements)) { changes.delete(sourceFile, aliasDeclaration); @@ -156155,13 +157517,13 @@ var ts; promoteImportClause(aliasDeclaration.parent.parent); return aliasDeclaration.parent.parent; } - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: promoteImportClause(aliasDeclaration); return aliasDeclaration; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: promoteImportClause(aliasDeclaration.parent); return aliasDeclaration.parent; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.deleteRange(sourceFile, aliasDeclaration.getChildAt(1)); return aliasDeclaration; default: @@ -156173,7 +157535,7 @@ var ts; var namedImports = ts.tryCast(importClause.namedBindings, ts.isNamedImports); if (namedImports && namedImports.elements.length > 1) { if (ts.OrganizeImports.importSpecifiersAreSorted(namedImports.elements) && - aliasDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && + aliasDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && namedImports.elements.indexOf(aliasDeclaration) !== 0) { // The import specifier being promoted will be the only non-type-only, // import in the NamedImports, so it should be moved to the front. @@ -156183,7 +157545,7 @@ var ts; for (var _i = 0, _a = namedImports.elements; _i < _a.length; _i++) { var element = _a[_i]; if (element !== aliasDeclaration && !element.isTypeOnly) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, element); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, element); } } } @@ -156192,7 +157554,7 @@ var ts; } function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, compilerOptions) { var _a; - if (clause.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (clause.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (defaultImport) { addElementToBindingPattern(clause, defaultImport.name, "default"); } @@ -156253,7 +157615,7 @@ var ts; if (convertExistingToTypeOnly && existingSpecifiers) { for (var _d = 0, existingSpecifiers_1 = existingSpecifiers; _d < existingSpecifiers_1.length; _d++) { var specifier = existingSpecifiers_1[_d]; - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, specifier); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, specifier); } } } @@ -156428,7 +157790,7 @@ var ts; var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; }); if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) return; - var declaration = findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + var declaration = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); if (declaration === undefined) return; if (ts.isIdentifier(declaration) && ts.isTypeParameterDeclaration(declaration.parent)) { @@ -156462,14 +157824,6 @@ var ts; } } } - function findAncestorMatchingSpan(sourceFile, span) { - var end = ts.textSpanEnd(span); - var token = ts.getTokenAtPosition(sourceFile, span.start); - while (token.end < end) { - token = token.parent; - } - return token; - } function tryGetConstraintFromDiagnosticMessage(messageText) { var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/`extends (.*)`/) || [], _ = _a[0], constraint = _a[1]; return constraint; @@ -156613,7 +157967,7 @@ var ts; accessibilityModifier ? accessibilityModifier.end : lastDecorator ? ts.skipTrivia(sourceFile.text, lastDecorator.end) : classElement.getStart(sourceFile); var options = accessibilityModifier || staticModifier || abstractModifier ? { prefix: " " } : { suffix: " " }; - changeTracker.insertModifierAt(sourceFile, modifierPos, 159 /* SyntaxKind.OverrideKeyword */, options); + changeTracker.insertModifierAt(sourceFile, modifierPos, 161 /* SyntaxKind.OverrideKeyword */, options); } function doRemoveOverrideModifierChange(changeTracker, sourceFile, pos) { var classElement = findContainerClassElementLike(sourceFile, pos); @@ -156627,13 +157981,13 @@ var ts; } function isClassElementLikeHasJSDoc(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.isParameterPropertyDeclaration(node, node.parent); default: return false; @@ -156745,6 +158099,143 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + var fixId = "fixImportNonExportedMember"; + var errorCodes = [ + ts.Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported.code, + ]; + codefix.registerCodeFix({ + errorCodes: errorCodes, + fixIds: [fixId], + getCodeActions: function (context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getInfo(sourceFile, span.start, program); + if (info === undefined) + return undefined; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, program, info); }); + return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId, ts.Diagnostics.Export_all_referenced_locals)]; + }, + getAllCodeActions: function (context) { + var program = context.program; + return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) { + var exports = new ts.Map(); + codefix.eachDiagnostic(context, errorCodes, function (diag) { + var info = getInfo(diag.file, diag.start, program); + if (info === undefined) + return undefined; + var exportName = info.exportName, node = info.node, moduleSourceFile = info.moduleSourceFile; + if (tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly) === undefined && ts.canHaveExportModifier(node)) { + changes.insertExportModifier(moduleSourceFile, node); + } + else { + var moduleExports = exports.get(moduleSourceFile) || { typeOnlyExports: [], exports: [] }; + if (exportName.isTypeOnly) { + moduleExports.typeOnlyExports.push(exportName); + } + else { + moduleExports.exports.push(exportName); + } + exports.set(moduleSourceFile, moduleExports); + } + }); + exports.forEach(function (moduleExports, moduleSourceFile) { + var exportDeclaration = tryGetExportDeclaration(moduleSourceFile, /*isTypeOnly*/ true); + if (exportDeclaration && exportDeclaration.isTypeOnly) { + doChanges(changes, program, moduleSourceFile, moduleExports.typeOnlyExports, exportDeclaration); + doChanges(changes, program, moduleSourceFile, moduleExports.exports, tryGetExportDeclaration(moduleSourceFile, /*isTypeOnly*/ false)); + } + else { + doChanges(changes, program, moduleSourceFile, __spreadArray(__spreadArray([], moduleExports.exports, true), moduleExports.typeOnlyExports, true), exportDeclaration); + } + }); + })); + } + }); + function getInfo(sourceFile, pos, program) { + var _a; + var token = ts.getTokenAtPosition(sourceFile, pos); + if (ts.isIdentifier(token)) { + var importDeclaration = ts.findAncestor(token, ts.isImportDeclaration); + if (importDeclaration === undefined) + return undefined; + var moduleSpecifier = ts.isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : undefined; + if (moduleSpecifier === undefined) + return undefined; + var resolvedModule = ts.getResolvedModule(sourceFile, moduleSpecifier, /*mode*/ undefined); + if (resolvedModule === undefined) + return undefined; + var moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName); + if (moduleSourceFile === undefined || ts.isSourceFileFromLibrary(program, moduleSourceFile)) + return undefined; + var moduleSymbol = moduleSourceFile.symbol; + var locals = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals; + if (locals === undefined) + return undefined; + var localSymbol = locals.get(token.escapedText); + if (localSymbol === undefined) + return undefined; + var node = getNodeOfSymbol(localSymbol); + if (node === undefined) + return undefined; + var exportName = { node: token, isTypeOnly: ts.isTypeDeclaration(node) }; + return { exportName: exportName, node: node, moduleSourceFile: moduleSourceFile, moduleSpecifier: moduleSpecifier }; + } + return undefined; + } + function doChange(changes, program, _a) { + var exportName = _a.exportName, node = _a.node, moduleSourceFile = _a.moduleSourceFile; + var exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly); + if (exportDeclaration) { + updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]); + } + else if (ts.canHaveExportModifier(node)) { + changes.insertExportModifier(moduleSourceFile, node); + } + else { + createExport(changes, program, moduleSourceFile, [exportName]); + } + } + function doChanges(changes, program, sourceFile, moduleExports, node) { + if (ts.length(moduleExports)) { + if (node) { + updateExport(changes, program, sourceFile, node, moduleExports); + } + else { + createExport(changes, program, sourceFile, moduleExports); + } + } + } + function tryGetExportDeclaration(sourceFile, isTypeOnly) { + var predicate = function (node) { + return ts.isExportDeclaration(node) && (isTypeOnly && node.isTypeOnly || !node.isTypeOnly); + }; + return ts.findLast(sourceFile.statements, predicate); + } + function updateExport(changes, program, sourceFile, node, names) { + var namedExports = node.exportClause && ts.isNamedExports(node.exportClause) ? node.exportClause.elements : ts.factory.createNodeArray([]); + var allowTypeModifier = !node.isTypeOnly && !!(program.getCompilerOptions().isolatedModules || ts.find(namedExports, function (e) { return e.isTypeOnly; })); + changes.replaceNode(sourceFile, node, ts.factory.updateExportDeclaration(node, node.modifiers, node.isTypeOnly, ts.factory.createNamedExports(ts.factory.createNodeArray(__spreadArray(__spreadArray([], namedExports, true), createExportSpecifiers(names, allowTypeModifier), true), /*hasTrailingComma*/ namedExports.hasTrailingComma)), node.moduleSpecifier, node.assertClause)); + } + function createExport(changes, program, sourceFile, names) { + changes.insertNodeAtEndOfScope(sourceFile, sourceFile, ts.factory.createExportDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamedExports(createExportSpecifiers(names, /*allowTypeModifier*/ !!program.getCompilerOptions().isolatedModules)), /*moduleSpecifier*/ undefined, /*assertClause*/ undefined)); + } + function createExportSpecifiers(names, allowTypeModifier) { + return ts.factory.createNodeArray(ts.map(names, function (n) { return ts.factory.createExportSpecifier(allowTypeModifier && n.isTypeOnly, /*propertyName*/ undefined, n.node); })); + } + function getNodeOfSymbol(symbol) { + if (symbol.valueDeclaration === undefined) { + return ts.firstOrUndefined(symbol.declarations); + } + var declaration = symbol.valueDeclaration; + var variableStatement = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : undefined; + return variableStatement && ts.length(variableStatement.declarationList.declarations) === 1 ? variableStatement : declaration; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -156765,7 +158256,7 @@ var ts; }); function getNamedTupleMember(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); - return ts.findAncestor(token, function (t) { return t.kind === 197 /* SyntaxKind.NamedTupleMember */; }); + return ts.findAncestor(token, function (t) { return t.kind === 199 /* SyntaxKind.NamedTupleMember */; }); } function doChange(changes, sourceFile, namedTupleMember) { if (!namedTupleMember) { @@ -156774,11 +158265,11 @@ var ts; var unwrappedType = namedTupleMember.type; var sawOptional = false; var sawRest = false; - while (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 186 /* SyntaxKind.RestType */ || unwrappedType.kind === 191 /* SyntaxKind.ParenthesizedType */) { - if (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */) { + while (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 188 /* SyntaxKind.RestType */ || unwrappedType.kind === 193 /* SyntaxKind.ParenthesizedType */) { + if (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */) { sawOptional = true; } - else if (unwrappedType.kind === 186 /* SyntaxKind.RestType */) { + else if (unwrappedType.kind === 188 /* SyntaxKind.RestType */) { sawRest = true; } unwrappedType = unwrappedType.type; @@ -157049,7 +158540,7 @@ var ts; if (isFunctionType) { var sig = checker.getSignatureFromDeclaration(declaration); if (sig) { - if (ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Async */)) { + if (ts.hasSyntacticModifier(declaration, 512 /* ModifierFlags.Async */)) { exprType = checker.createPromiseType(exprType); } var newSig = checker.createSignature(declaration, sig.typeParameters, sig.thisParameter, sig.parameters, exprType, @@ -157093,19 +158584,19 @@ var ts; } function getVariableLikeInitializer(declaration) { switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: return declaration.initializer; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return declaration.initializer && (ts.isJsxExpression(declaration.initializer) ? declaration.initializer.expression : undefined); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return undefined; } } @@ -157159,6 +158650,15 @@ var ts; ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code, ts.Diagnostics.Cannot_find_name_0.code ]; + var InfoKind; + (function (InfoKind) { + InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; + InfoKind[InfoKind["Enum"] = 1] = "Enum"; + InfoKind[InfoKind["Function"] = 2] = "Function"; + InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; + InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; + InfoKind[InfoKind["Signature"] = 5] = "Signature"; + })(InfoKind || (InfoKind = {})); codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { @@ -157167,19 +158667,19 @@ var ts; if (!info) { return undefined; } - if (info.kind === 3 /* InfoKind.ObjectLiteral */) { + if (info.kind === InfoKind.ObjectLiteral) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addObjectLiteralProperties(t, context, info); }); return [codefix.createCodeFixAction(fixMissingProperties, changes, ts.Diagnostics.Add_missing_properties, fixMissingProperties, ts.Diagnostics.Add_all_missing_properties)]; } - if (info.kind === 4 /* InfoKind.JsxAttributes */) { + if (info.kind === InfoKind.JsxAttributes) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addJsxAttributes(t, context, info); }); return [codefix.createCodeFixAction(fixMissingAttributes, changes, ts.Diagnostics.Add_missing_attributes, fixMissingAttributes, ts.Diagnostics.Add_all_missing_attributes)]; } - if (info.kind === 2 /* InfoKind.Function */) { + if (info.kind === InfoKind.Function || info.kind === InfoKind.Signature) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addFunctionDeclaration(t, context, info); }); return [codefix.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts.Diagnostics.Add_all_missing_function_declarations)]; } - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addEnumMemberDeclaration(t, context.program.getTypeChecker(), info); }); return [codefix.createCodeFixAction(fixMissingMember, changes, [ts.Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members)]; } @@ -157197,20 +158697,20 @@ var ts; if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) { return; } - if (fixId === fixMissingFunctionDeclaration && info.kind === 2 /* InfoKind.Function */) { + if (fixId === fixMissingFunctionDeclaration && (info.kind === InfoKind.Function || info.kind === InfoKind.Signature)) { addFunctionDeclaration(changes, context, info); } - else if (fixId === fixMissingProperties && info.kind === 3 /* InfoKind.ObjectLiteral */) { + else if (fixId === fixMissingProperties && info.kind === InfoKind.ObjectLiteral) { addObjectLiteralProperties(changes, context, info); } - else if (fixId === fixMissingAttributes && info.kind === 4 /* InfoKind.JsxAttributes */) { + else if (fixId === fixMissingAttributes && info.kind === InfoKind.JsxAttributes) { addJsxAttributes(changes, context, info); } else { - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { addEnumMemberDeclaration(changes, checker, info); } - if (info.kind === 0 /* InfoKind.TypeLikeDeclaration */) { + if (info.kind === InfoKind.TypeLikeDeclaration) { var parentDeclaration = info.parentDeclaration, token_1 = info.token; var infos = ts.getOrUpdate(typeDeclToMembers, parentDeclaration, function () { return []; }); if (!infos.some(function (i) { return i.token.text === token_1.text; })) { @@ -157254,14 +158754,6 @@ var ts; })); }, }); - var InfoKind; - (function (InfoKind) { - InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; - InfoKind[InfoKind["Enum"] = 1] = "Enum"; - InfoKind[InfoKind["Function"] = 2] = "Function"; - InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; - InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; - })(InfoKind || (InfoKind = {})); function getInfo(sourceFile, tokenPos, errorCode, checker, program) { // The identifier of the missing property. eg: // this.missing = 1; @@ -157274,7 +158766,7 @@ var ts; var argIndex = ts.findIndex(parent.parent.arguments, function (arg) { return arg === parent; }); if (argIndex < 0) return undefined; - var signature = ts.singleOrUndefined(checker.getSignaturesOfType(checker.getTypeAtLocation(parent.parent.expression), 0 /* SignatureKind.Call */)); + var signature = checker.getResolvedSignature(parent.parent); if (!(signature && signature.declaration && signature.parameters[argIndex])) return undefined; var param = signature.parameters[argIndex].valueDeclaration; @@ -157283,7 +158775,7 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getParameterType(signature, argIndex), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: param.name, properties: properties, parentDeclaration: parent }; + return { kind: InfoKind.ObjectLiteral, token: param.name, properties: properties, parentDeclaration: parent }; } if (!ts.isMemberName(token)) return undefined; @@ -157291,17 +158783,26 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent.initializer), checker.getTypeAtLocation(token), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: token, properties: properties, parentDeclaration: parent.initializer }; + return { kind: InfoKind.ObjectLiteral, token: token, properties: properties, parentDeclaration: parent.initializer }; } if (ts.isIdentifier(token) && ts.isJsxOpeningLikeElement(token.parent)) { var target = ts.getEmitScriptTarget(program.getCompilerOptions()); var attributes = getUnmatchedAttributes(checker, target, token.parent); if (!ts.length(attributes)) return undefined; - return { kind: 4 /* InfoKind.JsxAttributes */, token: token, attributes: attributes, parentDeclaration: token.parent }; + return { kind: InfoKind.JsxAttributes, token: token, attributes: attributes, parentDeclaration: token.parent }; } - if (ts.isIdentifier(token) && ts.isCallExpression(parent) && parent.expression === token) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: sourceFile }; + if (ts.isIdentifier(token)) { + var type = checker.getContextualType(token); + if (type && ts.getObjectFlags(type) & 16 /* ObjectFlags.Anonymous */) { + var signature = ts.firstOrUndefined(checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */)); + if (signature === undefined) + return undefined; + return { kind: InfoKind.Signature, token: token, signature: signature, sourceFile: sourceFile, parentDeclaration: findScope(token) }; + } + if (ts.isCallExpression(parent) && parent.expression === token) { + return { kind: InfoKind.Function, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: findScope(token) }; + } } if (!ts.isPropertyAccessExpression(parent)) return undefined; @@ -157312,14 +158813,14 @@ var ts; if (ts.isIdentifier(token) && ts.isCallExpression(parent.parent)) { var moduleDeclaration = ts.find(symbol.declarations, ts.isModuleDeclaration); var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile(); - if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; + if (moduleDeclaration && moduleDeclarationSourceFile && !ts.isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) { + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; } var moduleSourceFile = ts.find(symbol.declarations, ts.isSourceFile); if (sourceFile.commonJsModuleIndicator) return undefined; - if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; + if (moduleSourceFile && !ts.isSourceFileFromLibrary(program, moduleSourceFile)) { + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; } } var classDeclaration = ts.find(symbol.declarations, ts.isClassLike); @@ -157328,7 +158829,7 @@ var ts; return undefined; // Prefer to change the class instead of the interface if they are merged var declaration = classDeclaration || ts.find(symbol.declarations, function (d) { return ts.isInterfaceDeclaration(d) || ts.isTypeLiteralNode(d); }); - if (declaration && !isSourceFileFromLibrary(program, declaration.getSourceFile())) { + if (declaration && !ts.isSourceFileFromLibrary(program, declaration.getSourceFile())) { var makeStatic = !ts.isTypeLiteralNode(declaration) && (leftExpressionType.target || leftExpressionType) !== checker.getDeclaredTypeOfSymbol(symbol); if (makeStatic && (ts.isPrivateIdentifier(token) || ts.isInterfaceDeclaration(declaration))) return undefined; @@ -157337,17 +158838,14 @@ var ts; (makeStatic ? 32 /* ModifierFlags.Static */ : 0 /* ModifierFlags.None */) | (ts.startsWithUnderscore(token.text) ? 8 /* ModifierFlags.Private */ : 0 /* ModifierFlags.None */); var isJSFile = ts.isSourceFileJS(declSourceFile); var call = ts.tryCast(parent.parent, ts.isCallExpression); - return { kind: 0 /* InfoKind.TypeLikeDeclaration */, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; + return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; } var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration); - if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { - return { kind: 1 /* InfoKind.Enum */, token: token, parentDeclaration: enumDeclaration }; + if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !ts.isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { + return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration }; } return undefined; } - function isSourceFileFromLibrary(program, node) { - return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node); - } function getActionsForMissingMemberDeclaration(context, info) { return info.isJSFile ? ts.singleElementArray(createActionForAddMissingMemberInJavascriptFile(context, info)) : createActionsForAddMissingMemberInTypeScriptFile(context, info); @@ -157368,7 +158866,7 @@ var ts; function addMissingMemberInJs(changeTracker, sourceFile, classDeclaration, token, makeStatic) { var tokenName = token.text; if (makeStatic) { - if (classDeclaration.kind === 226 /* SyntaxKind.ClassExpression */) { + if (classDeclaration.kind === 228 /* SyntaxKind.ClassExpression */) { return; } var className = classDeclaration.name.getText(); @@ -157419,7 +158917,7 @@ var ts; } function getTypeNode(checker, node, token) { var typeNode; - if (token.parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (token.parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var binaryExpression = token.parent.parent; var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left; var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression))); @@ -157429,7 +158927,7 @@ var ts; var contextualType = checker.getContextualType(token.parent); typeNode = contextualType ? checker.typeToTypeNode(contextualType, /*enclosingDeclaration*/ undefined, 1 /* NodeBuilderFlags.NoTruncation */) : undefined; } - return typeNode || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return typeNode || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function addPropertyDeclaration(changeTracker, sourceFile, node, tokenName, typeNode, modifierFlags) { var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; @@ -157457,7 +158955,7 @@ var ts; } function createAddIndexSignatureAction(context, sourceFile, node, tokenName, typeNode) { // Index signatures cannot have the static modifier. - var stringTypeNode = ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + var stringTypeNode = ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); var indexingParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "x", @@ -157488,7 +158986,7 @@ var ts; } function addMethodDeclaration(context, changes, callExpression, name, modifierFlags, parentDeclaration, sourceFile) { var importAdder = codefix.createImportAdder(sourceFile, context.program, context.preferences, context.host); - var kind = ts.isClassLike(parentDeclaration) ? 169 /* SyntaxKind.MethodDeclaration */ : 168 /* SyntaxKind.MethodSignature */; + var kind = ts.isClassLike(parentDeclaration) ? 171 /* SyntaxKind.MethodDeclaration */ : 170 /* SyntaxKind.MethodSignature */; var signatureDeclaration = codefix.createSignatureDeclarationFromCallExpression(kind, context, importAdder, callExpression, name, modifierFlags, parentDeclaration); var containingMethodDeclaration = tryGetContainingMethodDeclaration(parentDeclaration, callExpression); if (containingMethodDeclaration) { @@ -157517,9 +159015,17 @@ var ts; }); } function addFunctionDeclaration(changes, context, info) { + var quotePreference = ts.getQuotePreference(context.sourceFile, context.preferences); var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host); - var functionDeclaration = codefix.createSignatureDeclarationFromCallExpression(256 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration); - changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); + var functionDeclaration = info.kind === InfoKind.Function + ? codefix.createSignatureDeclarationFromCallExpression(259 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration) + : codefix.createSignatureDeclarationFromSignature(259 /* SyntaxKind.FunctionDeclaration */, context, quotePreference, info.signature, codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), info.token, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ undefined, importAdder); + if (functionDeclaration === undefined) { + ts.Debug.fail("fixMissingFunctionDeclaration codefix got unexpected error."); + } + ts.isReturnStatement(info.parentDeclaration) + ? changes.insertNodeBefore(info.sourceFile, info.parentDeclaration, functionDeclaration, /*blankLineBetween*/ true) + : changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); importAdder.writeFixes(changes); } function addJsxAttributes(changes, context, info) { @@ -157615,7 +159121,7 @@ var ts; var signature = checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */); if (signature === undefined) return createUndefined(); - var func = codefix.createSignatureDeclarationFromSignature(213 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); + var func = codefix.createSignatureDeclarationFromSignature(215 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); return func !== null && func !== void 0 ? func : createUndefined(); } if (ts.getObjectFlags(type) & 1 /* ObjectFlags.Class */) { @@ -157669,14 +159175,21 @@ var ts; return declaration && declaration.parent === node ? declaration : undefined; } function createPropertyNameFromSymbol(symbol, target, quotePreference, checker) { - if (ts.isTransientSymbol(symbol) && symbol.nameType && symbol.nameType.flags & 8192 /* TypeFlags.UniqueESSymbol */) { - var expression = checker.symbolToExpression(symbol.nameType.symbol, 111551 /* SymbolFlags.Value */, symbol.valueDeclaration, 1048576 /* NodeBuilderFlags.AllowUniqueESSymbolType */); - if (expression) { - return ts.factory.createComputedPropertyName(expression); - } + if (ts.isTransientSymbol(symbol)) { + var prop = checker.symbolToNode(symbol, 111551 /* SymbolFlags.Value */, /*enclosingDeclaration*/ undefined, 1073741824 /* NodeBuilderFlags.WriteComputedProps */); + if (prop && ts.isComputedPropertyName(prop)) + return prop; } return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* QuotePreference.Single */); } + function findScope(node) { + if (ts.findAncestor(node, ts.isJsxExpression)) { + var returnStatement = ts.findAncestor(node.parent, ts.isReturnStatement); + if (returnStatement) + return returnStatement; + } + return ts.getSourceFileOfNode(node); + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -157827,7 +159340,7 @@ var ts; // See `codeFixClassExtendAbstractProtectedProperty.ts` in https://github.com/Microsoft/TypeScript/pull/11547/files // (now named `codeFixClassExtendAbstractPrivateProperty.ts`) var flags = ts.getSyntacticModifierFlags(ts.first(symbol.getDeclarations())); - return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 128 /* ModifierFlags.Abstract */); + return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 256 /* ModifierFlags.Abstract */); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -157990,6 +159503,63 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + var fixId = "fixNaNEquality"; + var errorCodes = [ + ts.Diagnostics.This_condition_will_always_return_0.code, + ]; + codefix.registerCodeFix({ + errorCodes: errorCodes, + getCodeActions: function (context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getInfo(program, sourceFile, span); + if (info === undefined) + return; + var suggestion = info.suggestion, expression = info.expression, arg = info.arg; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, arg, expression); }); + return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Use_0, suggestion], fixId, ts.Diagnostics.Use_Number_isNaN_in_all_conditions)]; + }, + fixIds: [fixId], + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(context.program, diag.file, ts.createTextSpan(diag.start, diag.length)); + if (info) { + doChange(changes, diag.file, info.arg, info.expression); + } + }); + } + }); + function getInfo(program, sourceFile, span) { + var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; }); + if (diag === undefined || diag.relatedInformation === undefined) + return; + var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.Did_you_mean_0.code; }); + if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) + return; + var token = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + if (token === undefined) + return; + if (ts.isExpression(token) && ts.isBinaryExpression(token.parent)) { + return { suggestion: getSuggestion(related.messageText), expression: token.parent, arg: token }; + } + return undefined; + } + function doChange(changes, sourceFile, arg, expression) { + var callExpression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("Number"), ts.factory.createIdentifier("isNaN")), /*typeArguments*/ undefined, [arg]); + var operator = expression.operatorToken.kind; + changes.replaceNode(sourceFile, expression, operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ + ? ts.factory.createPrefixUnaryExpression(53 /* SyntaxKind.ExclamationToken */, callExpression) : callExpression); + } + function getSuggestion(messageText) { + var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [], _ = _a[0], suggestion = _a[1]; + return suggestion; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -158307,7 +159877,7 @@ var ts; var importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start); if (!importDeclaration) return; - var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); + var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); var typeOnlyChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program); }); var actions; if (namespaceChanges.length) { @@ -158322,7 +159892,7 @@ var ts; }); function getImportDeclaration(sourceFile, program, start) { var identifier = ts.tryCast(ts.getTokenAtPosition(sourceFile, start), ts.isIdentifier); - if (!identifier || identifier.parent.kind !== 178 /* SyntaxKind.TypeReference */) + if (!identifier || identifier.parent.kind !== 180 /* SyntaxKind.TypeReference */) return; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(identifier); @@ -158334,11 +159904,11 @@ var ts; // new type-only import declaration, but honestly I doubt anyone will ever use this // codefix at all, so it's probably not worth the lines of code. function doTypeOnlyImportChange(changes, sourceFile, importDeclaration, program) { - if (importDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importDeclaration.name); + if (importDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importDeclaration.name); return; } - var importClause = importDeclaration.kind === 267 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; + var importClause = importDeclaration.kind === 270 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; if (importClause.name && importClause.namedBindings) { // Cannot convert an import with a default import and named bindings to type-only // (it's a grammar error). @@ -158355,7 +159925,7 @@ var ts; // Don't convert it to type-only. return; } - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importClause); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importClause); } function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) { ts.refactor.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent); @@ -158433,7 +160003,7 @@ var ts; ]; } var result = []; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return changeInferToUnknown(t, sourceFile, token); }); var name = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name.text; result.push(codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Replace_infer_0_with_unknown, name], fixIdInfer, ts.Diagnostics.Replace_all_unused_infer_with_unknown)); @@ -158475,7 +160045,7 @@ var ts; break; } case fixIdDelete: { - if (token.kind === 137 /* SyntaxKind.InferKeyword */ || isImport(token)) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */ || isImport(token)) { break; // Can't delete } else if (ts.isJSDocTemplateTag(token)) { @@ -158504,7 +160074,7 @@ var ts; break; } case fixIdInfer: - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { changeInferToUnknown(changes, sourceFile, token); } break; @@ -158515,7 +160085,7 @@ var ts; }, }); function changeInferToUnknown(changes, sourceFile, token) { - changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)); + changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)); } function createDeleteFix(changes, diag) { return codefix.createCodeFixAction(fixName, changes, diag, fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations); @@ -158525,7 +160095,7 @@ var ts; } function isImport(token) { return token.kind === 100 /* SyntaxKind.ImportKeyword */ - || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 270 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 267 /* SyntaxKind.ImportClause */); + || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 273 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 270 /* SyntaxKind.ImportClause */); } /** Sometimes the diagnostic span is an entire ImportDeclaration, so we should remove the whole thing. */ function tryGetFullImport(token) { @@ -158535,7 +160105,7 @@ var ts; return ts.isVariableDeclarationList(token.parent) && ts.first(token.parent.getChildren(sourceFile)) === token; } function deleteEntireVariableStatement(changes, sourceFile, node) { - changes.delete(sourceFile, node.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? node.parent : node); + changes.delete(sourceFile, node.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? node.parent : node); } function deleteDestructuringElements(changes, sourceFile, node) { ts.forEach(node.elements, function (n) { return changes.delete(sourceFile, n); }); @@ -158544,7 +160114,7 @@ var ts; // Don't offer to prefix a property. if (errorCode === ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code) return; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { token = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name; } if (ts.isIdentifier(token) && canPrefix(token)) { @@ -158560,14 +160130,14 @@ var ts; } function canPrefix(token) { switch (token.parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var varDecl = token.parent; switch (varDecl.parent.parent.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return true; } } @@ -158622,8 +160192,8 @@ var ts; function mayDeleteParameter(checker, sourceFile, parameter, sourceFiles, program, cancellationToken, isFixAll) { var parent = parameter.parent; switch (parent.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: var index = parent.parameters.indexOf(parameter); var referent = ts.isMethodDeclaration(parent) ? parent.name : parent; var entries = ts.FindAllReferences.Core.getReferencedSymbolsForNode(parent.pos, referent, program, sourceFiles, cancellationToken); @@ -158653,20 +160223,20 @@ var ts; } } return true; - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { if (parent.name && isCallbackLike(checker, sourceFile, parent.name)) { return isLastParameter(parent, parameter, isFixAll); } return true; } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: // Can't remove a non-last parameter in a callback. Can remove a parameter in code-fix-all if future parameters are also unused. return isLastParameter(parent, parameter, isFixAll); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Setter must have a parameter return false; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Getter cannot have parameters return true; default: @@ -158727,7 +160297,7 @@ var ts; var container = (ts.isBlock(statement.parent) ? statement.parent : statement).parent; if (!ts.isBlock(statement.parent) || statement === ts.first(statement.parent.statements)) { switch (container.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (container.elseStatement) { if (ts.isBlock(statement.parent)) { break; @@ -158738,8 +160308,8 @@ var ts; return; } // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: changes.delete(sourceFile, container); return; } @@ -158812,7 +160382,7 @@ var ts; var typeNode = info.typeNode, type = info.type; var original = typeNode.getText(sourceFile); var actions = [fix(type, fixIdPlain, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)]; - if (typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */) { + if (typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */) { // for nullable types, suggest the flow-compatible `T | null | undefined` // in addition to the jsdoc/closure-compatible `T | null` actions.push(fix(checker.getNullableType(type, 32768 /* TypeFlags.Undefined */), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)); @@ -158832,7 +160402,7 @@ var ts; if (!info) return; var typeNode = info.typeNode, type = info.type; - var fixedType = typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; + var fixedType = typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; doChange(changes, sourceFile, typeNode, fixedType, checker); }); } @@ -158849,22 +160419,22 @@ var ts; // NOTE: Some locations are not handled yet: // MappedTypeNode.typeParameters and SignatureDeclaration.typeParameters, as well as CallExpression.typeArguments switch (node.kind) { - case 229 /* SyntaxKind.AsExpression */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 176 /* SyntaxKind.IndexSignature */: - case 195 /* SyntaxKind.MappedType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 231 /* SyntaxKind.AsExpression */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 178 /* SyntaxKind.IndexSignature */: + case 197 /* SyntaxKind.MappedType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; default: return false; @@ -158967,14 +160537,14 @@ var ts; } var insertBefore; switch (containingFunction.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: insertBefore = containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: insertBefore = ts.findChildOfKind(containingFunction, 98 /* SyntaxKind.FunctionKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: var kind = containingFunction.typeParameters ? 29 /* SyntaxKind.LessThanToken */ : 20 /* SyntaxKind.OpenParenToken */; insertBefore = ts.findChildOfKind(containingFunction, kind, sourceFile) || ts.first(containingFunction.parameters); break; @@ -158994,7 +160564,7 @@ var ts; changes.replaceNode(sourceFile, returnType, ts.factory.createTypeReferenceNode("Promise", ts.factory.createNodeArray([returnType]))); } } - changes.insertModifierBefore(sourceFile, 131 /* SyntaxKind.AsyncKeyword */, insertBefore); + changes.insertModifierBefore(sourceFile, 132 /* SyntaxKind.AsyncKeyword */, insertBefore); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -159310,7 +160880,7 @@ var ts; function annotate(changes, importAdder, sourceFile, declaration, type, program, host) { var typeNode = ts.getTypeNodeIfAccessible(type, declaration, program, host); if (typeNode) { - if (ts.isInJSFile(sourceFile) && declaration.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (ts.isInJSFile(sourceFile) && declaration.kind !== 168 /* SyntaxKind.PropertySignature */) { var parent = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : declaration; if (!parent) { return; @@ -159397,19 +160967,19 @@ var ts; function getFunctionReferences(containingFunction, sourceFile, program, cancellationToken) { var searchToken; switch (containingFunction.kind) { - case 171 /* SyntaxKind.Constructor */: - searchToken = ts.findChildOfKind(containingFunction, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); + case 173 /* SyntaxKind.Constructor */: + searchToken = ts.findChildOfKind(containingFunction, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: var parent = containingFunction.parent; searchToken = (ts.isVariableDeclaration(parent) || ts.isPropertyDeclaration(parent)) && ts.isIdentifier(parent.name) ? parent.name : containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: searchToken = containingFunction.name; break; } @@ -159551,24 +161121,24 @@ var ts; node = node.parent; } switch (node.parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: inferTypeFromExpressionStatement(node, usage); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: usage.isNumber = true; break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: inferTypeFromPrefixUnaryExpression(node.parent, usage); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: inferTypeFromBinaryExpression(node, node.parent, usage); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: inferTypeFromSwitchStatementLabel(node.parent, usage); break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.parent.expression === node) { inferTypeFromCallExpression(node.parent, usage); } @@ -159576,20 +161146,20 @@ var ts; inferTypeFromContextualType(node, usage); } break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: inferTypeFromPropertyAccessExpression(node.parent, usage); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: inferTypeFromPropertyElementExpression(node.parent, node, usage); break; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: inferTypeFromPropertyAssignment(node.parent, usage); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: inferTypeFromPropertyDeclaration(node.parent, usage); break; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var _a = node.parent, name = _a.name, initializer = _a.initializer; if (node === name) { if (initializer) { // This can happen for `let x = null;` which still has an implicit-any error. @@ -159711,7 +161281,7 @@ var ts; case 56 /* SyntaxKind.BarBarToken */: case 60 /* SyntaxKind.QuestionQuestionToken */: if (node === parent.left && - (node.parent.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { + (node.parent.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { // var x = x || {}; // TODO: use getFalsyflagsOfType addCandidateType(usage, checker.getTypeAtLocation(parent.right)); @@ -159739,7 +161309,7 @@ var ts; } } calculateUsageOfNode(parent, call.return_); - if (parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */) { (usage.calls || (usage.calls = [])).push(call); } else { @@ -160193,25 +161763,44 @@ var ts; * @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub. */ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) { + var _a; if (preserveOptional === void 0) { preserveOptional = 3 /* PreserveOptionalFlags.All */; } if (isAmbient === void 0) { isAmbient = false; } var declarations = symbol.getDeclarations(); - if (!(declarations && declarations.length)) { - return undefined; - } + var declaration = declarations === null || declarations === void 0 ? void 0 : declarations[0]; var checker = context.program.getTypeChecker(); var scriptTarget = ts.getEmitScriptTarget(context.program.getCompilerOptions()); - var declaration = declarations[0]; - var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); - var visibilityModifier = createVisibilityModifier(ts.getEffectiveModifierFlags(declaration)); - var modifiers = visibilityModifier ? ts.factory.createNodeArray([visibilityModifier]) : undefined; + /** + * (#49811) + * Note that there are cases in which the symbol declaration is not present. For example, in the code below both + * `MappedIndirect.ax` and `MappedIndirect.ay` have no declaration node attached (due to their mapped-type + * parent): + * + * ```ts + * type Base = { ax: number; ay: string }; + * type BaseKeys = keyof Base; + * type MappedIndirect = { [K in BaseKeys]: boolean }; + * ``` + * + * In such cases, we assume the declaration to be a `PropertySignature`. + */ + var kind = (_a = declaration === null || declaration === void 0 ? void 0 : declaration.kind) !== null && _a !== void 0 ? _a : 168 /* SyntaxKind.PropertySignature */; + var declarationName = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); + var effectiveModifierFlags = declaration ? ts.getEffectiveModifierFlags(declaration) : 0 /* ModifierFlags.None */; + var modifierFlags = effectiveModifierFlags & 4 /* ModifierFlags.Public */ ? 4 /* ModifierFlags.Public */ : + effectiveModifierFlags & 16 /* ModifierFlags.Protected */ ? 16 /* ModifierFlags.Protected */ : + 0 /* ModifierFlags.None */; + if (declaration && ts.isAutoAccessorPropertyDeclaration(declaration)) { + modifierFlags |= 128 /* ModifierFlags.Accessor */; + } + var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); var optional = !!(symbol.flags & 16777216 /* SymbolFlags.Optional */); var ambient = !!(enclosingDeclaration.flags & 16777216 /* NodeFlags.Ambient */) || isAmbient; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: + switch (kind) { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: var flags = quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : undefined; var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context)); if (importAdder) { @@ -160221,11 +161810,12 @@ var ts; importSymbols(importAdder, importableReference.symbols); } } - addClassElement(ts.factory.createPropertyDeclaration(modifiers, name, optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, + addClassElement(ts.factory.createPropertyDeclaration(modifiers, declaration ? createName(declarationName) : symbol.getName(), optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, /*initializer*/ undefined)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + ts.Debug.assertIsDefined(declarations); var typeNode_1 = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context)); var allAccessors = ts.getAllAccessorDeclarations(declarations, declaration); var orderedAccessors = allAccessors.secondAccessor @@ -160241,19 +161831,19 @@ var ts; for (var _i = 0, orderedAccessors_1 = orderedAccessors; _i < orderedAccessors_1.length; _i++) { var accessor = orderedAccessors_1[_i]; if (ts.isGetAccessorDeclaration(accessor)) { - addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, createName(declarationName), ts.emptyArray, createTypeNode(typeNode_1), createBody(body, quotePreference, ambient))); } else { ts.Debug.assertNode(accessor, ts.isSetAccessorDeclaration, "The counterpart to a getter should be a setter"); var parameter = ts.getSetAccessorValueParameter(accessor); var parameterName = parameter && ts.isIdentifier(parameter.name) ? ts.idText(parameter.name) : undefined; - addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, createName(declarationName), createDummyParameters(1, [parameterName], [createTypeNode(typeNode_1)], 1, /*inJs*/ false), createBody(body, quotePreference, ambient))); } } break; } - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: // The signature for the implementation appears as an entry in `signatures` iff // there is only one signature. // If there are overloads and an implementation signature, it appears as an @@ -160261,6 +161851,7 @@ var ts; // If there is more than one overload but no implementation signature // (eg: an abstract method or interface declaration), there is a 1-1 // correspondence of declarations and signatures. + ts.Debug.assertIsDefined(declarations); var signatures = type.isUnion() ? ts.flatMap(type.types, function (t) { return t.getCallSignatures(); }) : type.getCallSignatures(); if (!ts.some(signatures)) { break; @@ -160268,31 +161859,41 @@ var ts; if (declarations.length === 1) { ts.Debug.assert(signatures.length === 1, "One declaration implies one signature"); var signature = signatures[0]; - outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference, ambient)); break; } - for (var _a = 0, signatures_1 = signatures; _a < signatures_1.length; _a++) { - var signature = signatures_1[_a]; + for (var _b = 0, signatures_1 = signatures; _b < signatures_1.length; _b++) { + var signature = signatures_1[_b]; // Ensure nodes are fresh so they can have different positions when going through formatting. - outputMethod(quotePreference, signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName)); } if (!ambient) { if (declarations.length > signatures.length) { var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); - outputMethod(quotePreference, signature, modifiers, name, body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference)); } else { ts.Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count"); - addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); + addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, createName(declarationName), optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); } } break; } function outputMethod(quotePreference, signature, modifiers, name, body) { - var method = createSignatureDeclarationFromSignature(169 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); + var method = createSignatureDeclarationFromSignature(171 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); if (method) addClassElement(method); } + function createName(node) { + return ts.getSynthesizedDeepClone(node, /*includeTrivia*/ false); + } + function createBody(block, quotePreference, ambient) { + return ambient ? undefined : + ts.getSynthesizedDeepClone(block, /*includeTrivia*/ false) || createStubbedMethodBody(quotePreference); + } + function createTypeNode(typeNode) { + return ts.getSynthesizedDeepClone(typeNode, /*includeTrivia*/ false); + } } codefix.addNewNodeForMemberSymbol = addNewNodeForMemberSymbol; function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) { @@ -160366,6 +161967,9 @@ var ts; if (ts.isMethodDeclaration(signatureDeclaration)) { return ts.factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name !== null && name !== void 0 ? name : ts.factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body); } + if (ts.isFunctionDeclaration(signatureDeclaration)) { + return ts.factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, ts.tryCast(name, ts.isIdentifier), typeParameters, parameters, type, body !== null && body !== void 0 ? body : signatureDeclaration.body); + } return undefined; } codefix.createSignatureDeclarationFromSignature = createSignatureDeclarationFromSignature; @@ -160394,13 +161998,13 @@ var ts; ? undefined : checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker); switch (kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createMethodDeclaration(modifiers, asteriskToken, name, /*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference)); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return ts.factory.createMethodSignature(modifiers, name, - /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */) : type); - case 256 /* SyntaxKind.FunctionDeclaration */: + /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */) : type); + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference)); default: ts.Debug.fail("Unexpected kind"); @@ -160537,7 +162141,7 @@ var ts; /*dotDotDotToken*/ undefined, /*name*/ parameterName + (parameterNameCount || ""), /*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, - /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), + /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), /*initializer*/ undefined); parameters.push(newParameter); } @@ -160567,7 +162171,7 @@ var ts; if (someSigHasRestParameter) { var restParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest", - /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)), + /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)), /*initializer*/ undefined); parameters.push(restParameter); } @@ -160595,15 +162199,6 @@ var ts; /*multiline*/ true); } codefix.createStubbedBody = createStubbedBody; - function createVisibilityModifier(flags) { - if (flags & 4 /* ModifierFlags.Public */) { - return ts.factory.createToken(123 /* SyntaxKind.PublicKeyword */); - } - else if (flags & 16 /* ModifierFlags.Protected */) { - return ts.factory.createToken(122 /* SyntaxKind.ProtectedKeyword */); - } - return undefined; - } function setJsonCompilerOptionValues(changeTracker, configFile, options) { var tsconfigObjectLiteral = ts.getTsConfigObjectLiteralExpression(configFile); if (!tsconfigObjectLiteral) @@ -160682,6 +162277,15 @@ var ts; symbols.forEach(function (s) { return importAdder.addImportFromExportedSymbol(s, /*isValidTypeOnlyUseSite*/ true); }); } codefix.importSymbols = importSymbols; + function findAncestorMatchingSpan(sourceFile, span) { + var end = ts.textSpanEnd(span); + var token = ts.getTokenAtPosition(sourceFile, span.start); + while (token.end < end) { + token = token.parent; + } + return token; + } + codefix.findAncestorMatchingSpan = findAncestorMatchingSpan; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -160704,13 +162308,13 @@ var ts; if (ts.isClassLike(container)) { var modifierFlags = ts.getEffectiveModifierFlags(declaration); if (ts.isSourceFileJS(file)) { - var modifiers = ts.createModifiers(modifierFlags); + var modifiers = ts.factory.createModifiersFromModifierFlags(modifierFlags); accessorModifiers = modifiers; fieldModifiers = modifiers; } else { - accessorModifiers = ts.createModifiers(prepareModifierFlagsForAccessor(modifierFlags)); - fieldModifiers = ts.createModifiers(prepareModifierFlagsForField(modifierFlags)); + accessorModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForAccessor(modifierFlags)); + fieldModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForField(modifierFlags)); } if (ts.canHaveDecorators(declaration)) { fieldModifiers = ts.concatenate(ts.getDecorators(declaration), fieldModifiers); @@ -160779,7 +162383,7 @@ var ts; error: ts.getLocaleSpecificMessage(ts.Diagnostics.Name_is_not_valid) }; } - if (((ts.getEffectiveModifierFlags(declaration) & 125951 /* ModifierFlags.Modifier */) | meaning) !== meaning) { + if (((ts.getEffectiveModifierFlags(declaration) & 126975 /* ModifierFlags.Modifier */) | meaning) !== meaning) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_property_with_modifier) }; @@ -160792,7 +162396,7 @@ var ts; isStatic: ts.hasStaticModifier(declaration), isReadonly: ts.hasEffectiveReadonlyModifier(declaration), type: getDeclarationType(declaration, program), - container: declaration.kind === 164 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, + container: declaration.kind === 166 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, originalName: declaration.name.text, declaration: declaration, fieldName: fieldName, @@ -160866,7 +162470,7 @@ var ts; var type = typeChecker.getTypeFromTypeNode(typeNode); if (!typeChecker.isTypeAssignableTo(typeChecker.getUndefinedType(), type)) { var types = ts.isUnionTypeNode(typeNode) ? typeNode.types : [typeNode]; - return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)], false)); + return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)], false)); } } return typeNode; @@ -160924,7 +162528,7 @@ var ts; }); function getActionsForUsageOfInvalidImport(context) { var sourceFile = context.sourceFile; - var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 208 /* SyntaxKind.CallExpression */ : 209 /* SyntaxKind.NewExpression */; + var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 210 /* SyntaxKind.CallExpression */ : 211 /* SyntaxKind.NewExpression */; var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start), function (a) { return a.kind === targetKind; }); if (!node) { return []; @@ -161050,7 +162654,7 @@ var ts; return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_undefined_type_to_property_0, info.prop.name.getText()], fixIdAddUndefinedType, ts.Diagnostics.Add_undefined_type_to_all_uninitialized_properties); } function addUndefinedType(changeTracker, sourceFile, info) { - var undefinedTypeNode = ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + var undefinedTypeNode = ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); var types = ts.isUnionTypeNode(info.type) ? info.type.types.concat(undefinedTypeNode) : [info.type, undefinedTypeNode]; var unionTypeNode = ts.factory.createUnionTypeNode(types); if (info.isJs) { @@ -161096,7 +162700,7 @@ var ts; } else if (type.isClass()) { var classDeclaration = ts.getClassLikeDeclarationOfSymbol(type.symbol); - if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 128 /* ModifierFlags.Abstract */)) + if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 256 /* ModifierFlags.Abstract */)) return undefined; var constructorDeclaration = ts.getFirstConstructorWithBody(classDeclaration); if (constructorDeclaration && constructorDeclaration.parameters.length) @@ -161273,7 +162877,7 @@ var ts; function getImportTypeNode(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); ts.Debug.assert(token.kind === 100 /* SyntaxKind.ImportKeyword */, "This token should be an ImportKeyword"); - ts.Debug.assert(token.parent.kind === 200 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); + ts.Debug.assert(token.parent.kind === 202 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); return token.parent; } function doChange(changes, sourceFile, importType) { @@ -161402,7 +163006,7 @@ var ts; var otherMembers = members.filter(function (member) { return !ts.isIndexSignatureDeclaration(member); }); var parameter = ts.first(indexSignature.parameters); var mappedTypeParameter = ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.cast(parameter.name, ts.isIdentifier), parameter.type); - var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, + var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, /*nameType*/ undefined, indexSignature.questionToken, indexSignature.type, /*members*/ undefined); var intersectionType = ts.factory.createIntersectionTypeNode(__spreadArray(__spreadArray(__spreadArray([], ts.getAllSuperTypeNodes(container), true), [ @@ -161460,7 +163064,7 @@ var ts; }, }); function makeChange(changeTracker, sourceFile, span) { - var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 132 /* SyntaxKind.AwaitKeyword */; }); + var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 133 /* SyntaxKind.AwaitKeyword */; }); var awaitExpression = awaitKeyword && ts.tryCast(awaitKeyword.parent, ts.isAwaitExpression); if (!awaitExpression) { return; @@ -161527,28 +163131,45 @@ var ts; errorCodes: errorCodes, getCodeActions: function getCodeActionsToConvertConstToLet(context) { var sourceFile = context.sourceFile, span = context.span, program = context.program; - var range = getConstTokenRange(sourceFile, span.start, program); - if (range === undefined) + var info = getInfo(sourceFile, span.start, program); + if (info === undefined) return; - var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, range); }); - return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_const_to_let)]; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, info.token); }); + return [codefix.createCodeFixActionMaybeFixAll(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_all_const_to_let)]; + }, + getAllCodeActions: function (context) { + var program = context.program; + var seen = new ts.Map(); + return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) { + codefix.eachDiagnostic(context, errorCodes, function (diag) { + var info = getInfo(diag.file, diag.start, program); + if (info) { + if (ts.addToSeen(seen, ts.getSymbolId(info.symbol))) { + return doChange(changes, diag.file, info.token); + } + } + return undefined; + }); + })); }, fixIds: [fixId] }); - function getConstTokenRange(sourceFile, pos, program) { + function getInfo(sourceFile, pos, program) { var _a; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(ts.getTokenAtPosition(sourceFile, pos)); + if (symbol === undefined) + return; var declaration = ts.tryCast((_a = symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.parent, ts.isVariableDeclarationList); if (declaration === undefined) return; var constToken = ts.findChildOfKind(declaration, 85 /* SyntaxKind.ConstKeyword */, sourceFile); if (constToken === undefined) return; - return ts.createRange(constToken.pos, constToken.end); + return { symbol: symbol, token: constToken }; } - function doChange(changes, sourceFile, range) { - changes.replaceRangeWithText(sourceFile, range, "let"); + function doChange(changes, sourceFile, token) { + changes.replaceNode(sourceFile, token, ts.factory.createToken(119 /* SyntaxKind.LetKeyword */)); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -161723,7 +163344,6 @@ var ts; return { edits: edits, renameFilename: undefined, renameLocation: undefined }; }, }); - ; function getInfo(context, considerPartialSpans) { if (considerPartialSpans === void 0) { considerPartialSpans = true; } var file = context.file, program = context.program; @@ -161735,8 +163355,8 @@ var ts; } var checker = program.getTypeChecker(); var exportingModuleSymbol = getExportingModuleSymbol(exportNode, checker); - var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 513 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); - var wasDefault = !!(flags & 512 /* ModifierFlags.Default */); + var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 1025 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); + var wasDefault = !!(flags & 1024 /* ModifierFlags.Default */); // If source file already has a default export, don't offer refactor. if (!(flags & 1 /* ModifierFlags.Export */) || !wasDefault && exportingModuleSymbol.exports.has("default" /* InternalSymbolName.Default */)) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.This_file_already_has_a_default_export) }; @@ -161746,19 +163366,19 @@ var ts; : { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_named_export) }; }; switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: { var node = exportNode; if (!node.name) return undefined; return noSymbolError(node.name) || { exportNode: node, exportName: node.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { var vs = exportNode; // Must be `export const x = something;`. if (!(vs.declarationList.flags & 2 /* NodeFlags.Const */) || vs.declarationList.declarations.length !== 1) { @@ -161771,7 +163391,7 @@ var ts; return noSymbolError(decl.name) || { exportNode: vs, exportName: decl.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var node = exportNode; if (node.isExportEquals) return undefined; @@ -161801,12 +163421,12 @@ var ts; else { var exportKeyword = ts.Debug.checkDefined(ts.findModifier(exportNode, 93 /* SyntaxKind.ExportKeyword */), "Should find an export keyword in modifier list"); switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.factory.createToken(88 /* SyntaxKind.DefaultKeyword */)); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // If 'x' isn't used in this file and doesn't have type definition, `export const x = 0;` --> `export default 0;` var decl = ts.first(exportNode.declarationList.declarations); if (!ts.FindAllReferences.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile) && !decl.type) { @@ -161815,9 +163435,9 @@ var ts; break; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // `export type T = number;` -> `type T = number; export default T;` changes.deleteModifier(exportingSourceFile, exportKeyword); changes.insertNodeAfter(exportingSourceFile, exportNode, ts.factory.createExportDefault(ts.factory.createIdentifier(exportName.text))); @@ -161846,18 +163466,18 @@ var ts; function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.default` --> `a.foo` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier(exportName)); break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: { var spec = parent; // `default as foo` --> `foo`, `default as bar` --> `foo as bar` changes.replaceNode(importingSourceFile, spec, makeImportSpecifier(exportName, spec.name.text)); break; } - case 267 /* SyntaxKind.ImportClause */: { + case 270 /* SyntaxKind.ImportClause */: { var clause = parent; ts.Debug.assert(clause.name === ref, "Import clause name should match provided ref"); var spec = makeImportSpecifier(exportName, ref.text); @@ -161866,7 +163486,7 @@ var ts; // `import foo from "./a";` --> `import { foo } from "./a";` changes.replaceNode(importingSourceFile, ref, ts.factory.createNamedImports([spec])); } - else if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + else if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // `import foo, * as a from "./a";` --> `import * as a from ".a/"; import { foo } from "./a";` changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) }); var quotePreference = ts.isStringLiteral(clause.parent.moduleSpecifier) ? ts.quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1 /* QuotePreference.Double */; @@ -161880,7 +163500,7 @@ var ts; } break; } - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: var importTypeNode = parent; changes.replaceNode(importingSourceFile, parent, ts.factory.createImportTypeNode(importTypeNode.argument, importTypeNode.assertions, ts.factory.createIdentifier(exportName), importTypeNode.typeArguments, importTypeNode.isTypeOf)); break; @@ -161891,11 +163511,11 @@ var ts; function changeNamedToDefaultImport(importingSourceFile, ref, changes) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.foo` --> `a.default` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier("default")); break; - case 270 /* SyntaxKind.ImportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: { // `import { foo } from "./a";` --> `import foo from "./a";` // `import { foo as bar } from "./a";` --> `import bar from "./a";` var defaultImport = ts.factory.createIdentifier(parent.name.text); @@ -161908,7 +163528,7 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // `export { foo } from "./a";` --> `export { default as foo } from "./a";` // `export { foo as bar } from "./a";` --> `export { default as bar } from "./a";` // `export { foo as default } from "./a";` --> `export { default } from "./a";` @@ -162009,7 +163629,7 @@ var ts; if (!importClause.namedBindings) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_namespace_import_or_named_imports) }; } - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return { convertTo: 0 /* ImportKind.Named */, import: importClause.namedBindings }; } var shouldUseDefault = getShouldUseDefault(context.program, importClause); @@ -162200,7 +163820,6 @@ var ts; }); return { edits: edits, renameFilename: undefined, renameLocation: undefined }; } - ; function isValidExpression(node) { return ts.isBinaryExpression(node) || ts.isConditionalExpression(node); } @@ -162248,7 +163867,6 @@ var ts; if (expression.operatorToken.kind !== 55 /* SyntaxKind.AmpersandAmpersandToken */) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_logical_AND_access_chains) }; } - ; var finalExpression = getFinalExpressionInChain(expression.right); if (!finalExpression) return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_convertible_access_expression) }; @@ -162458,27 +164076,27 @@ var ts; var lastDeclaration = signatureDecls[signatureDecls.length - 1]; var updated = lastDeclaration; switch (lastDeclaration.kind) { - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { updated = ts.factory.updateMethodSignature(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { updated = ts.factory.updateMethodDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { updated = ts.factory.updateCallSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { updated = ts.factory.updateConstructorDeclaration(lastDeclaration, lastDeclaration.modifiers, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.body); break; } - case 175 /* SyntaxKind.ConstructSignature */: { + case 177 /* SyntaxKind.ConstructSignature */: { updated = ts.factory.updateConstructSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { updated = ts.factory.updateFunctionDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } @@ -162509,7 +164127,7 @@ var ts; } function convertParameterToNamedTupleMember(p) { ts.Debug.assert(ts.isIdentifier(p.name)); // This is checked during refactoring applicability checking - var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)), p); + var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)), p); var parameterDocComment = p.symbol && p.symbol.getDocumentationComment(checker); if (parameterDocComment) { var newComment = ts.displayPartsToString(parameterDocComment); @@ -162529,12 +164147,12 @@ var ts; } function isConvertableSignatureDeclaration(d) { switch (d.kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: return true; } return false; @@ -162653,8 +164271,8 @@ var ts; var i = 0; for (var _i = 0, extractions_1 = extractions; _i < extractions_1.length; _i++) { var _a = extractions_1[_i], functionExtraction = _a.functionExtraction, constantExtraction = _a.constantExtraction; - var description = functionExtraction.description; if (refactor.refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) { + var description = functionExtraction.description; if (functionExtraction.errors.length === 0) { // Don't issue refactorings with duplicated names. // Scopes come back in "innermost first" order, so extractions will @@ -162678,15 +164296,15 @@ var ts; } } if (refactor.refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) { + var description = constantExtraction.description; if (constantExtraction.errors.length === 0) { // Don't issue refactorings with duplicated names. // Scopes come back in "innermost first" order, so extractions will // preferentially go into nearer scopes - var description_1 = constantExtraction.description; - if (!usedConstantNames.has(description_1)) { - usedConstantNames.set(description_1, true); + if (!usedConstantNames.has(description)) { + usedConstantNames.set(description, true); constantActions.push({ - description: description_1, + description: description, name: "constant_scope_".concat(i), kind: extractConstantAction.kind }); @@ -162831,7 +164449,6 @@ var ts; var start = cursorRequest ? getExtractableParent(startToken) : ts.getParentNodeInSpan(startToken, sourceFile, adjustedSpan); // Do the same for the ending position var end = cursorRequest ? start : ts.getParentNodeInSpan(endToken, sourceFile, adjustedSpan); - var declarations = []; // We'll modify these flags as we walk the tree to collect data // about what things need to be done as part of the extraction. var rangeFacts = RangeFacts.None; @@ -162874,7 +164491,7 @@ var ts; // the expression. return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] }; } - return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; + return { targetRange: { range: statements, facts: rangeFacts, thisNode: thisNode } }; } if (ts.isReturnStatement(start) && !start.expression) { // Makes no sense to extract an expression-less return statement. @@ -162886,7 +164503,7 @@ var ts; if (errors) { return { errors: errors }; } - return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; // TODO: GH#18217 + return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, thisNode: thisNode } }; // TODO: GH#18217 /** * Attempt to refine the extraction node (generally, by shrinking it) to produce better results. * @param node The unrefined extraction node. @@ -162898,10 +164515,10 @@ var ts; } } else if (ts.isVariableStatement(node) || ts.isVariableDeclarationList(node)) { - var declarations_6 = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations; + var declarations = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations; var numInitializers = 0; var lastInitializer = void 0; - for (var _i = 0, declarations_5 = declarations_6; _i < declarations_5.length; _i++) { + for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; if (declaration.initializer) { numInitializers++; @@ -162929,20 +164546,20 @@ var ts; function checkForStaticContext(nodeToCheck, containingClass) { var current = nodeToCheck; while (current !== containingClass) { - if (current.kind === 167 /* SyntaxKind.PropertyDeclaration */) { + if (current.kind === 169 /* SyntaxKind.PropertyDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 164 /* SyntaxKind.Parameter */) { + else if (current.kind === 166 /* SyntaxKind.Parameter */) { var ctorOrMethod = ts.getContainingFunction(current); - if (ctorOrMethod.kind === 171 /* SyntaxKind.Constructor */) { + if (ctorOrMethod.kind === 173 /* SyntaxKind.Constructor */) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 169 /* SyntaxKind.MethodDeclaration */) { + else if (current.kind === 171 /* SyntaxKind.MethodDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } @@ -162980,9 +164597,9 @@ var ts; visit(nodeToCheck); if (rangeFacts & RangeFacts.UsesThis) { var container = ts.getThisContainer(nodeToCheck, /** includeArrowFunctions */ false); - if (container.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) || - container.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (container.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) || + container.kind === 215 /* SyntaxKind.FunctionExpression */) { rangeFacts |= RangeFacts.UsesThisInFunction; } } @@ -162993,7 +164610,7 @@ var ts; return true; } if (ts.isDeclaration(node)) { - var declaringNode = (node.kind === 254 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; + var declaringNode = (node.kind === 257 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; if (ts.hasSyntacticModifier(declaringNode, 1 /* ModifierFlags.Export */)) { // TODO: GH#18217 Silly to use `errors ||` since it's definitely not defined (see top of `visit`) // Also, if we're only pushing one error, just use `let error: Diagnostic | undefined`! @@ -163001,20 +164618,19 @@ var ts; (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; } - declarations.push(node.symbol); } // Some things can't be extracted in certain situations switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport)); return true; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; case 106 /* SyntaxKind.SuperKeyword */: // For a super *constructor call*, we have to be extracting the entire class, // but a super *method call* simply implies a 'this' reference - if (node.parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.parent.kind === 210 /* SyntaxKind.CallExpression */) { // Super constructor call var containingClass_1 = ts.getContainingClass(node); if (containingClass_1 === undefined || containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) { @@ -163027,7 +164643,7 @@ var ts; thisNode = node; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // check if arrow function uses this ts.forEachChild(node, function check(n) { if (ts.isThis(n)) { @@ -163042,39 +164658,39 @@ var ts; } }); // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) { // You cannot extract global declarations (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope)); } // falls through - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // do not dive into functions or classes return false; } var savedPermittedJumps = permittedJumps; switch (node.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: permittedJumps &= ~4 /* PermittedJumps.Return */; break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // forbid all jumps inside try blocks permittedJumps = 0 /* PermittedJumps.None */; break; - case 235 /* SyntaxKind.Block */: - if (node.parent && node.parent.kind === 252 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { + case 238 /* SyntaxKind.Block */: + if (node.parent && node.parent.kind === 255 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { // allow unconditional returns from finally blocks permittedJumps = 4 /* PermittedJumps.Return */; } break; - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: // allow unlabeled break inside case clauses permittedJumps |= 1 /* PermittedJumps.Break */; break; @@ -163086,20 +164702,20 @@ var ts; break; } switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: rangeFacts |= RangeFacts.UsesThis; thisNode = node; break; - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { var label = node.label; (seenLabels || (seenLabels = [])).push(label.escapedText); ts.forEachChild(node, visit); seenLabels.pop(); break; } - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: { + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: { var label = node.label; if (label) { if (!ts.contains(seenLabels, label.escapedText)) { @@ -163108,20 +164724,20 @@ var ts; } } else { - if (!(permittedJumps & (node.kind === 246 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { + if (!(permittedJumps & (node.kind === 249 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { // attempt to break or continue in a forbidden context (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); } } break; } - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: rangeFacts |= RangeFacts.IsAsyncFunction; break; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: rangeFacts |= RangeFacts.IsGenerator; break; - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: if (permittedJumps & 4 /* PermittedJumps.Return */) { rangeFacts |= RangeFacts.HasReturn; } @@ -163191,7 +164807,7 @@ var ts; while (true) { current = current.parent; // A function parameter's initializer is actually in the outer scope, not the function declaration - if (current.kind === 164 /* SyntaxKind.Parameter */) { + if (current.kind === 166 /* SyntaxKind.Parameter */) { // Skip all the way to the outer scope of the function that declared this parameter current = ts.findAncestor(current, function (parent) { return ts.isFunctionLikeDeclaration(parent); }).parent; } @@ -163202,7 +164818,7 @@ var ts; // * Module/namespace or source file if (isScope(current)) { scopes.push(current); - if (current.kind === 305 /* SyntaxKind.SourceFile */) { + if (current.kind === 308 /* SyntaxKind.SourceFile */) { return scopes; } } @@ -163292,32 +164908,32 @@ var ts; } function getDescriptionForFunctionLikeDeclaration(scope) { switch (scope.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return scope.name ? "function '".concat(scope.name.text, "'") : ts.ANONYMOUS; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return "arrow function"; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return "method '".concat(scope.name.getText(), "'"); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return "'get ".concat(scope.name.getText(), "'"); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return "'set ".concat(scope.name.getText(), "'"); default: throw ts.Debug.assertNever(scope, "Unexpected scope kind ".concat(scope.kind)); } } function getDescriptionForClassLikeDeclaration(scope) { - return scope.kind === 257 /* SyntaxKind.ClassDeclaration */ + return scope.kind === 260 /* SyntaxKind.ClassDeclaration */ ? scope.name ? "class '".concat(scope.name.text, "'") : "anonymous class declaration" : scope.name ? "class expression '".concat(scope.name.text, "'") : "anonymous class expression"; } function getDescriptionForModuleLikeDeclaration(scope) { - return scope.kind === 262 /* SyntaxKind.ModuleBlock */ + return scope.kind === 265 /* SyntaxKind.ModuleBlock */ ? "namespace '".concat(scope.parent.name.getText(), "'") : scope.externalModuleIndicator ? 0 /* SpecialScope.Module */ : 1 /* SpecialScope.Global */; } @@ -163390,7 +165006,7 @@ var ts; modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } if (range.facts & RangeFacts.IsAsyncFunction) { - modifiers.push(ts.factory.createModifier(131 /* SyntaxKind.AsyncKeyword */)); + modifiers.push(ts.factory.createModifier(132 /* SyntaxKind.AsyncKeyword */)); } newFunction = ts.factory.createMethodDeclaration(modifiers.length ? modifiers : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, /*questionToken*/ undefined, typeParameters, parameters, returnType, body); @@ -163404,7 +165020,7 @@ var ts; /*questionToken*/ undefined, checker.typeToTypeNode(checker.getTypeAtLocation(range.thisNode), scope, 1 /* NodeBuilderFlags.NoTruncation */), /*initializer*/ undefined)); } - newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(131 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); + newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(132 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); } var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); var minInsertionPos = (isReadonlyArray(range.range) ? ts.last(range.range) : range.range).end; @@ -163552,9 +165168,9 @@ var ts; while (ts.isParenthesizedTypeNode(withoutParens)) { withoutParens = withoutParens.type; } - return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 153 /* SyntaxKind.UndefinedKeyword */; }) + return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 155 /* SyntaxKind.UndefinedKeyword */; }) ? clone - : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } } /** @@ -163585,7 +165201,7 @@ var ts; if (rangeFacts & RangeFacts.InStaticRegion) { modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } - modifiers.push(ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); + modifiers.push(ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); var newVariable = ts.factory.createPropertyDeclaration(modifiers, localNameText, /*questionToken*/ undefined, variableType, initializer); var localReference = ts.factory.createPropertyAccessExpression(rangeFacts & RangeFacts.InStaticRegion @@ -163616,7 +165232,7 @@ var ts; var localReference = ts.factory.createIdentifier(localNameText); changeTracker.replaceNode(context.file, node, localReference); } - else if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { + else if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { // If the parent is an expression statement and the target scope is the immediately enclosing one, // replace the statement with the declaration. var newVariableStatement = ts.factory.createVariableStatement( @@ -163635,7 +165251,7 @@ var ts; changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ false); } // Consume - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { // If the parent is an expression statement, delete it. changeTracker.delete(context.file, node.parent); } @@ -164281,30 +165897,30 @@ var ts; function isExtractableExpression(node) { var parent = node.parent; switch (parent.kind) { - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return false; } switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: - return parent.kind !== 266 /* SyntaxKind.ImportDeclaration */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */; - case 225 /* SyntaxKind.SpreadElement */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 203 /* SyntaxKind.BindingElement */: + return parent.kind !== 269 /* SyntaxKind.ImportDeclaration */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */; + case 227 /* SyntaxKind.SpreadElement */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 205 /* SyntaxKind.BindingElement */: return false; case 79 /* SyntaxKind.Identifier */: - return parent.kind !== 203 /* SyntaxKind.BindingElement */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */ && - parent.kind !== 275 /* SyntaxKind.ExportSpecifier */; + return parent.kind !== 205 /* SyntaxKind.BindingElement */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */ && + parent.kind !== 278 /* SyntaxKind.ExportSpecifier */; } return true; } function isBlockLike(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 305 /* SyntaxKind.SourceFile */: - case 262 /* SyntaxKind.ModuleBlock */: - case 289 /* SyntaxKind.CaseClause */: + case 238 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 265 /* SyntaxKind.ModuleBlock */: + case 292 /* SyntaxKind.CaseClause */: return true; default: return false; @@ -164592,7 +166208,6 @@ var ts; (function (ts) { var refactor; (function (refactor) { - ; /** * Checks if some refactor info has refactor error info. */ @@ -164697,15 +166312,14 @@ var ts; // Imports will be copied to the new file anyway, and may still be needed in the old file. // Prologue directives will be copied to the new file and should be left in the old file. return !isPureImport(statement) && !ts.isPrologueDirective(statement); - ; } function isPureImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return true; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return !ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return node.declarationList.declarations.every(function (d) { return !!d.initializer && ts.isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true); }); default: return false; @@ -164728,7 +166342,7 @@ var ts; function getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, newModuleName, preferences) { var checker = program.getTypeChecker(); var prologueDirectives = ts.takeWhile(oldFile.statements, ts.isPrologueDirective); - if (!oldFile.externalModuleIndicator && !oldFile.commonJsModuleIndicator) { + if (oldFile.externalModuleIndicator === undefined && oldFile.commonJsModuleIndicator === undefined && usage.oldImportsNeededByNewFile.size() === 0) { deleteMovedStatements(oldFile, toMove.ranges, changes); return __spreadArray(__spreadArray([], prologueDirectives, true), toMove.all, true); } @@ -164801,12 +166415,12 @@ var ts; } function getNamespaceLikeImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? + case 269 /* SyntaxKind.ImportDeclaration */: + return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? node.importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.tryCast(node.name, ts.isIdentifier); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); @@ -164837,21 +166451,21 @@ var ts; var newNamespaceId = ts.factory.createIdentifier(newNamespaceName); var newModuleString = ts.factory.createStringLiteral(newModuleSpecifier); switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, ts.factory.createNamespaceImport(newNamespaceId)), newModuleString, /*assertClause*/ undefined); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.createImportEqualsDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, newNamespaceId, ts.factory.createExternalModuleReference(newModuleString)); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.factory.createVariableDeclaration(newNamespaceId, /*exclamationToken*/ undefined, /*type*/ undefined, createRequireCall(newModuleString)); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); } } function moduleSpecifierFromImport(i) { - return (i.kind === 266 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier - : i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression + return (i.kind === 269 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier + : i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression : i.initializer.arguments[0]); } function forEachImportInStatement(statement, cb) { @@ -164921,15 +166535,15 @@ var ts; } function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) { switch (importDecl.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (isUnused(importDecl.name)) { changes.delete(sourceFile, importDecl); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused); break; default: @@ -164942,7 +166556,7 @@ var ts; var _a = importDecl.importClause, name = _a.name, namedBindings = _a.namedBindings; var defaultUnused = !name || isUnused(name); var namedBindingsUnused = !namedBindings || - (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); + (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); if (defaultUnused && namedBindingsUnused) { changes.delete(sourceFile, importDecl); } @@ -164954,7 +166568,7 @@ var ts; if (namedBindingsUnused) { changes.replaceNode(sourceFile, importDecl.importClause, ts.factory.updateImportClause(importDecl.importClause, importDecl.importClause.isTypeOnly, name, /*namedBindings*/ undefined)); } - else if (namedBindings.kind === 269 /* SyntaxKind.NamedImports */) { + else if (namedBindings.kind === 272 /* SyntaxKind.NamedImports */) { for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) { var element = _b[_i]; if (isUnused(element.name)) @@ -164969,12 +166583,17 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: if (isUnused(name)) { - changes.delete(sourceFile, name); + if (varDecl.initializer && ts.isRequireCall(varDecl.initializer, /*requireStringLiteralLikeArgument*/ true)) { + changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && ts.length(varDecl.parent.declarations) === 1 ? varDecl.parent.parent : varDecl); + } + else { + changes.delete(sourceFile, name); + } } break; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: break; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: if (name.elements.every(function (e) { return ts.isIdentifier(e.name) && isUnused(e.name); })) { changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl); } @@ -165016,7 +166635,7 @@ var ts; if (markSeenTop(top)) { addExportToChanges(oldFile, top, name, changes, useEsModuleSyntax); } - if (ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */)) { oldFileDefault = name; } else { @@ -165104,14 +166723,14 @@ var ts; // Below should all be utilities function isInImport(decl) { switch (decl.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return isVariableDeclarationInImport(decl); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); default: return false; @@ -165123,7 +166742,7 @@ var ts; } function filterImport(i, moduleSpecifier, keep) { switch (i.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { var clause = i.importClause; if (!clause) return undefined; @@ -165133,9 +166752,9 @@ var ts; ? ts.factory.createImportDeclaration(/*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, defaultImport, namedBindings), moduleSpecifier, /*assertClause*/ undefined) : undefined; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return keep(i.name) ? i : undefined; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var name = filterBindingName(i.name, keep); return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : undefined; } @@ -165144,7 +166763,7 @@ var ts; } } function filterNamedBindings(namedBindings, keep) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return keep(namedBindings.name) ? namedBindings : undefined; } else { @@ -165156,9 +166775,9 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return keep(name) ? name : undefined; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return name; - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { // We can't handle nested destructurings or property names well here, so just copy them all. var newElements = name.elements.filter(function (prop) { return prop.propertyName || !ts.isIdentifier(prop.name) || keep(prop.name); }); return newElements.length ? ts.factory.createObjectBindingPattern(newElements) : undefined; @@ -165201,6 +166820,9 @@ var ts; ts.copyEntries(this.map, clone.map); return clone; }; + SymbolSet.prototype.size = function () { + return this.map.size; + }; return SymbolSet; }()); function isTopLevelDeclaration(node) { @@ -165215,13 +166837,13 @@ var ts; } function isNonVariableTopLevelDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -165229,17 +166851,17 @@ var ts; } function forEachTopLevelDeclaration(statement, cb) { switch (statement.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return cb(statement); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.firstDefined(statement.declarationList.declarations, function (decl) { return forEachTopLevelDeclarationInBindingName(decl.name, cb); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; return ts.isBinaryExpression(expression) && ts.getAssignmentDeclarationKind(expression) === 1 /* AssignmentDeclarationKind.ExportsProperty */ ? cb(statement) @@ -165251,8 +166873,8 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return cb(ts.cast(name.parent, function (x) { return ts.isVariableDeclaration(x) || ts.isBindingElement(x); })); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return ts.firstDefined(name.elements, function (em) { return ts.isOmittedExpression(em) ? undefined : forEachTopLevelDeclarationInBindingName(em.name, cb); }); default: return ts.Debug.assertNever(name, "Unexpected name kind ".concat(name.kind)); @@ -165263,9 +166885,9 @@ var ts; } function getTopLevelDeclarationStatement(d) { switch (d.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return d.parent.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getTopLevelDeclarationStatement(ts.cast(d.parent.parent, function (p) { return ts.isVariableDeclaration(p) || ts.isBindingElement(p); })); default: return d; @@ -165289,7 +166911,8 @@ var ts; if (useEs6Exports) { return !ts.isExpressionStatement(decl) && ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */) || !!(name && ((_a = sourceFile.symbol.exports) === null || _a === void 0 ? void 0 : _a.has(name.escapedText))); } - return getNamesToExportInCommonJS(decl).some(function (name) { return sourceFile.symbol.exports.has(ts.escapeLeadingUnderscores(name)); }); + return !!sourceFile.symbol && !!sourceFile.symbol.exports && + getNamesToExportInCommonJS(decl).some(function (name) { return sourceFile.symbol.exports.has(ts.escapeLeadingUnderscores(name)); }); } function addExport(decl, useEs6Exports) { return useEs6Exports ? [addEs6Export(decl)] : addCommonjsExport(decl); @@ -165297,24 +166920,24 @@ var ts; function addEs6Export(d) { var modifiers = ts.canHaveModifiers(d) ? ts.concatenate([ts.factory.createModifier(93 /* SyntaxKind.ExportKeyword */)], ts.getModifiers(d)) : undefined; switch (d.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.updateFunctionDeclaration(d, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var decorators = ts.canHaveDecorators(d) ? ts.getDecorators(d) : undefined; return ts.factory.updateClassDeclaration(d, ts.concatenate(decorators, modifiers), d.name, d.typeParameters, d.heritageClauses, d.members); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.factory.updateVariableStatement(d, modifiers, d.declarationList); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.factory.updateModuleDeclaration(d, modifiers, d.name, d.body); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.factory.updateEnumDeclaration(d, modifiers, d.name, d.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return ts.factory.updateTypeAliasDeclaration(d, modifiers, d.name, d.typeParameters, d.type); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.factory.updateInterfaceDeclaration(d, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.updateImportEqualsDeclaration(d, modifiers, d.isTypeOnly, d.name, d.moduleReference); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(d, "Unexpected declaration kind ".concat(d.kind)); @@ -165325,18 +166948,18 @@ var ts; } function getNamesToExportInCommonJS(decl) { switch (decl.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return [decl.name.text]; // TODO: GH#18217 - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.mapDefined(decl.declarationList.declarations, function (d) { return ts.isIdentifier(d.name) ? d.name.text : undefined; }); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.emptyArray; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail("Can't export an ExpressionStatement"); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(decl, "Unexpected decl kind ".concat(decl.kind)); @@ -165677,15 +167300,15 @@ var ts; var parent = functionReference.parent; switch (parent.kind) { // foo(...) or super(...) or new Foo(...) - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: var callOrNewExpression = ts.tryCast(parent, ts.isCallOrNewExpression); if (callOrNewExpression && callOrNewExpression.expression === functionReference) { return callOrNewExpression; } break; // x.foo(...) - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) { var callOrNewExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallOrNewExpression); @@ -165695,7 +167318,7 @@ var ts; } break; // x["foo"](...) - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) { var callOrNewExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallOrNewExpression); @@ -165714,14 +167337,14 @@ var ts; var parent = reference.parent; switch (parent.kind) { // `C.foo` - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.expression === reference) { return propertyAccessExpression; } break; // `C["foo"]` - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.expression === reference) { return elementAccessExpression; @@ -165767,16 +167390,16 @@ var ts; if (!isValidParameterNodeArray(functionDeclaration.parameters, checker)) return false; switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralExpression(functionDeclaration.parent)) { var contextualSymbol = getSymbolForContextualType(functionDeclaration.name, checker); // don't offer the refactor when there are multiple signatures since we won't know which ones the user wants to change return ((_a = contextualSymbol === null || contextualSymbol === void 0 ? void 0 : contextualSymbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 && isSingleImplementation(functionDeclaration, checker); } return isSingleImplementation(functionDeclaration, checker); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (ts.isClassDeclaration(functionDeclaration.parent)) { return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker); } @@ -165784,8 +167407,8 @@ var ts; return isValidVariableDeclaration(functionDeclaration.parent.parent) && isSingleImplementation(functionDeclaration, checker); } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return isValidVariableDeclaration(functionDeclaration.parent); } return false; @@ -165933,7 +167556,7 @@ var ts; } function getClassNames(constructorDeclaration) { switch (constructorDeclaration.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = constructorDeclaration.parent; if (classDeclaration.name) return [classDeclaration.name]; @@ -165941,7 +167564,7 @@ var ts; // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(classDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless class declaration should be a default export"); return [defaultModifier]; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var classExpression = constructorDeclaration.parent; var variableDeclaration = constructorDeclaration.parent.parent; var className = classExpression.name; @@ -165952,25 +167575,25 @@ var ts; } function getFunctionNames(functionDeclaration) { switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (functionDeclaration.name) return [functionDeclaration.name]; // If the function declaration doesn't have a name, it should have a default modifier. // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(functionDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless function declaration should be a default export"); return [defaultModifier]; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return [functionDeclaration.name]; - case 171 /* SyntaxKind.Constructor */: - var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 134 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); - if (functionDeclaration.parent.kind === 226 /* SyntaxKind.ClassExpression */) { + case 173 /* SyntaxKind.Constructor */: + var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 135 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); + if (functionDeclaration.parent.kind === 228 /* SyntaxKind.ClassExpression */) { var variableDeclaration = functionDeclaration.parent.parent; return [variableDeclaration.name, ctrKeyword]; } return [ctrKeyword]; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return [functionDeclaration.parent.name]; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (functionDeclaration.name) return [functionDeclaration.name, functionDeclaration.parent.name]; return [functionDeclaration.parent.name]; @@ -166061,11 +167684,11 @@ var ts; function getParentBinaryExpression(expr) { var container = ts.findAncestor(expr.parent, function (n) { switch (n.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return false; - case 223 /* SyntaxKind.TemplateExpression */: - case 221 /* SyntaxKind.BinaryExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return !(ts.isBinaryExpression(n.parent) && isNotEqualsOperator(n.parent)); default: return "quit"; @@ -166513,10 +168136,10 @@ var ts; } function isConvertibleDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return true; default: return false; @@ -166561,7 +168184,7 @@ var ts; this.kind = kind; } NodeObject.prototype.assertHasRealPosition = function (message) { - // eslint-disable-next-line debug-assert + // eslint-disable-next-line local/debug-assert ts.Debug.assert(!ts.positionIsSynthesized(this.pos) && !ts.positionIsSynthesized(this.end), message || "Node must have a real position for this operation"); }; NodeObject.prototype.getSourceFile = function () { @@ -166618,8 +168241,8 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 309 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 347 /* SyntaxKind.LastJSDocNode */; }); - return child.kind < 161 /* SyntaxKind.FirstNode */ ? + var child = ts.find(children, function (kid) { return kid.kind < 312 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 350 /* SyntaxKind.LastJSDocNode */; }); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getFirstToken(sourceFile); }; @@ -166630,7 +168253,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 161 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); }; NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) { return ts.forEachChild(this, cbNode, cbNodeArray); @@ -166690,7 +168313,7 @@ var ts; } } function createSyntaxList(nodes, parent) { - var list = createNode(348 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); + var list = createNode(351 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { @@ -167039,7 +168662,7 @@ var ts; var _a; if (!seenSymbols_1.has(symbol)) { seenSymbols_1.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualJsDocTags(declaration, checker); } return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : undefined; @@ -167049,8 +168672,8 @@ var ts; tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true); } }; - for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { - var declaration = declarations_7[_i]; + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; _loop_20(declaration); } } @@ -167066,7 +168689,7 @@ var ts; var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) { if (!seenSymbols_2.has(symbol)) { seenSymbols_2.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualDocumentationComment(declaration, checker); } return symbol.getDocumentationComment(checker); @@ -167076,8 +168699,8 @@ var ts; if (inheritedDocs) doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc); }; - for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { - var declaration = declarations_8[_i]; + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; _loop_21(declaration); } } @@ -167085,7 +168708,7 @@ var ts; } function findBaseOfDeclaration(checker, declaration, cb) { var _a; - var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; + var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; if (!classOrInterfaceDeclaration) return; var isStaticMember = ts.hasStaticModifier(declaration); @@ -167100,7 +168723,7 @@ var ts; __extends(SourceFileObject, _super); function SourceFileObject(kind, pos, end) { var _this = _super.call(this, kind, pos, end) || this; - _this.kind = 305 /* SyntaxKind.SourceFile */; + _this.kind = 308 /* SyntaxKind.SourceFile */; return _this; } SourceFileObject.prototype.update = function (newText, textChangeRange) { @@ -167159,10 +168782,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -167182,31 +168805,31 @@ var ts; } ts.forEachChild(node, visit); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 184 /* SyntaxKind.TypeLiteral */: addDeclaration(node); ts.forEachChild(node, visit); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Only consider parameter properties if (!ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { break; } // falls through - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -167217,12 +168840,12 @@ var ts; } } // falls through - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: addDeclaration(node); break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; var exportDeclaration = node; @@ -167235,7 +168858,7 @@ var ts; } } break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -167247,7 +168870,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -167256,7 +168879,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) !== 0 /* AssignmentDeclarationKind.None */) { addDeclaration(node); } @@ -167602,7 +169225,7 @@ var ts; var rootFileNames = host.getScriptFileNames().slice(); // Get a fresh cache of the host information var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; var hasChangedAutomaticTypeDirectiveNames = ts.maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames); var projectReferences = (_b = host.getProjectReferences) === null || _b === void 0 ? void 0 : _b.call(host); var parsedCommandLines; @@ -167633,7 +169256,7 @@ var ts; }, onReleaseOldSourceFile: onReleaseOldSourceFile, onReleaseParsedCommandLine: onReleaseParsedCommandLine, - hasInvalidatedResolution: hasInvalidatedResolution, + hasInvalidatedResolutions: hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames, trace: ts.maybeBind(host, host.trace), resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames), @@ -167668,8 +169291,12 @@ var ts; getCurrentDirectory: compilerHost.getCurrentDirectory, onUnRecoverableConfigFileDiagnostic: ts.noop, }; + // The call to isProgramUptoDate below may refer back to documentRegistryBucketKey; + // calculate this early so it's not undefined if downleveled to a var (or, if emitted + // as a const variable without downleveling, doesn't crash). + var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); // If the program is already up-to-date, we can reuse it - if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { return; } // IMPORTANT - It is critical from this moment onward that we do not check @@ -167677,7 +169304,6 @@ var ts; // instance. If we cancel midway through, we may end up in an inconsistent state where // the program points to old source files that have been invalidated because of // incremental parsing. - var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); var options = { rootNames: rootFileNames, options: newSettings, @@ -167973,16 +169599,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return !ts.isLabelName(node) && !ts.isTagName(node) && !ts.isConstTypeReference(node.parent); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: // Don't return quickInfo if inside the comment in `a/**/.b` return !ts.isInComment(sourceFile, position); case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 106 /* SyntaxKind.SuperKeyword */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return true; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return ts.isImportMeta(node); default: return false; @@ -168089,15 +169715,15 @@ var ts; return undefined; } switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: case 10 /* SyntaxKind.StringLiteral */: case 95 /* SyntaxKind.FalseKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 106 /* SyntaxKind.SuperKeyword */: case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 79 /* SyntaxKind.Identifier */: break; // Cant create the text span @@ -168114,7 +169740,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -168244,12 +169870,14 @@ var ts; return ts.codefix.getAllFixes({ fixId: fixId, sourceFile: sourceFile, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences }); } function organizeImports(args, formatOptions, preferences) { + var _a; if (preferences === void 0) { preferences = ts.emptyOptions; } synchronizeHostData(); ts.Debug.assert(args.type === "file"); var sourceFile = getValidSourceFile(args.fileName); var formatContext = ts.formatting.getFormatContext(formatOptions, host); - return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences, args.skipDestructiveCodeActions); + var mode = (_a = args.mode) !== null && _a !== void 0 ? _a : (args.skipDestructiveCodeActions ? "SortAndCombine" /* OrganizeImportsMode.SortAndCombine */ : "All" /* OrganizeImportsMode.All */); + return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences, mode); } function getEditsForFileRename(oldFilePath, newFilePath, formatOptions, preferences) { if (preferences === void 0) { preferences = ts.emptyOptions; } @@ -168863,7 +170491,7 @@ var ts; */ function literalIsName(node) { return ts.isDeclarationName(node) || - node.parent.kind === 277 /* SyntaxKind.ExternalModuleReference */ || + node.parent.kind === 280 /* SyntaxKind.ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node); } @@ -168881,13 +170509,13 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined; } // falls through case 79 /* SyntaxKind.Identifier */: return ts.isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 286 /* SyntaxKind.JsxAttributes */) && + (node.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 289 /* SyntaxKind.JsxAttributes */) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -168929,7 +170557,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.argumentExpression === node; } /** @@ -169022,114 +170650,114 @@ var ts; if (node) { var parent = node.parent; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return spanInVariableDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return spanInParameterDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return spanInFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanInBlock(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInBlock(node.block); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: // span in statement return spanInNode(node.statement); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return spanInForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 203 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 205 /* SyntaxKind.BindingElement */: // span on complete node return textSpan(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: // span in statement return spanInNode(node.statement); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return spanInNodeArray(parent.modifiers, node, ts.isDecorator); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return undefined; // Tokens: case 26 /* SyntaxKind.SemicolonToken */: @@ -169159,7 +170787,7 @@ var ts; case 83 /* SyntaxKind.CatchKeyword */: case 96 /* SyntaxKind.FinallyKeyword */: return spanInNextNode(node); - case 160 /* SyntaxKind.OfKeyword */: + case 162 /* SyntaxKind.OfKeyword */: return spanInOfKeyword(node); default: // Destructuring pattern in destructuring assignment @@ -169172,13 +170800,13 @@ var ts; // `a` or `...c` or `d: x` from // `[a, b, ...c]` or `{ a, b }` or `{ d: x }` from destructuring pattern if ((node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 225 /* SyntaxKind.SpreadElement */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) && + node.kind === 227 /* SyntaxKind.SpreadElement */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(parent)) { return textSpan(node); } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { var _a = node, left = _a.left, operatorToken = _a.operatorToken; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of @@ -169200,22 +170828,22 @@ var ts; } if (ts.isExpressionNode(node)) { switch (parent.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return textSpan(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -169224,21 +170852,21 @@ var ts; } } switch (node.parent.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // If this is name of property assignment, set breakpoint in the initializer if (node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } break; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: // Breakpoint in type assertion goes to its operand if (node.parent.type === node) { return spanInNextNode(node.parent.type); } break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: { // initializer of variable/parameter declaration go to previous node var _b = node.parent, initializer = _b.initializer, type = _b.type; if (initializer === node || type === node || ts.isAssignmentOperator(node.kind)) { @@ -169246,7 +170874,7 @@ var ts; } break; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var left = node.parent.left; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) { // If initializer of destructuring assignment move to previous token @@ -169276,7 +170904,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } var parent = variableDeclaration.parent; @@ -169288,7 +170916,7 @@ var ts; // or its declaration from 'for of' if ((ts.hasOnlyExpressionInitializer(variableDeclaration) && variableDeclaration.initializer) || ts.hasSyntacticModifier(variableDeclaration, 1 /* ModifierFlags.Export */) || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } if (ts.isVariableDeclarationList(variableDeclaration.parent) && @@ -169329,7 +170957,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasSyntacticModifier(functionDeclaration, 1 /* ModifierFlags.Export */) || - (functionDeclaration.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 171 /* SyntaxKind.Constructor */); + (functionDeclaration.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 173 /* SyntaxKind.Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -169352,26 +170980,26 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -169396,21 +171024,21 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 203 /* SyntaxKind.BindingElement */) { + if (bindingPattern.parent.kind === 205 /* SyntaxKind.BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 202 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 201 /* SyntaxKind.ObjectBindingPattern */); - var elements = node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + ts.Debug.assert(node.kind !== 204 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 203 /* SyntaxKind.ObjectBindingPattern */); + var elements = node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -169418,18 +171046,18 @@ var ts; // just nested element in another destructuring assignment // set breakpoint on assignment when parent is destructuring assignment // Otherwise set breakpoint for this element - return textSpan(node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -169437,25 +171065,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // Span on close brace token return textSpan(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -169463,7 +171091,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -169479,7 +171107,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -169494,12 +171122,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead - node.parent.kind === 208 /* SyntaxKind.CallExpression */ || - node.parent.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead + node.parent.kind === 210 /* SyntaxKind.CallExpression */ || + node.parent.kind === 211 /* SyntaxKind.NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -169508,21 +171136,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -169532,20 +171160,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.parent.kind === 164 /* SyntaxKind.Parameter */) { + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.parent.kind === 166 /* SyntaxKind.Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.parent.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -169553,7 +171181,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -169602,7 +171230,7 @@ var debugObjectHost = (function () { return this; })(); // We need to use 'null' to interface with the managed side. -/* eslint-disable no-in-operator */ +/* eslint-disable local/no-in-operator */ /* @internal */ var ts; (function (ts) { @@ -170402,7 +172030,7 @@ var ts; }()); ts.TypeScriptServicesFactory = TypeScriptServicesFactory; })(ts || (ts = {})); -/* eslint-enable no-in-operator */ +/* eslint-enable local/no-in-operator */ // We polyfill `globalThis` here so re can reliably patch the global scope // in the contexts we want to in the same way across script and module formats /* eslint-enable no-var */ @@ -171172,7 +172800,7 @@ var ts; if (typeof value === "number") { return ts.factory.createNumericLiteral(value); } - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (typeof value === "object" && "base10Value" in value) { // PseudoBigInt return ts.factory.createBigIntLiteral(value); } @@ -171200,7 +172828,7 @@ var ts; } else { type = operatorOrType; - operator = 140 /* SyntaxKind.KeyOfKeyword */; + operator = 141 /* SyntaxKind.KeyOfKeyword */; } return ts.factory.createTypeOperatorNode(operator, type); }, factoryDeprecation); @@ -171378,7 +173006,7 @@ var ts; ts.createNode = ts.Debug.deprecate(function createNode(kind, pos, end) { if (pos === void 0) { pos = 0; } if (end === void 0) { end = 0; } - return ts.setTextRangePosEnd(kind === 305 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : + return ts.setTextRangePosEnd(kind === 308 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : kind === 79 /* SyntaxKind.Identifier */ ? ts.parseBaseNodeFactory.createBaseIdentifierNode(kind) : kind === 80 /* SyntaxKind.PrivateIdentifier */ ? ts.parseBaseNodeFactory.createBasePrivateIdentifierNode(kind) : !ts.isNodeKind(kind) ? ts.parseBaseNodeFactory.createBaseTokenNode(kind) : @@ -171408,7 +173036,7 @@ var ts; (function (ts) { /** @deprecated Use `isTypeAssertionExpression` instead. */ ts.isTypeAssertion = ts.Debug.deprecate(function isTypeAssertion(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; }, { since: "4.0", warnAfter: "4.1", diff --git a/node_modules/typescript/lib/typescriptServices.d.ts b/node_modules/typescript/lib/typescriptServices.d.ts index 9309fde2d..91b7c1f90 100644 --- a/node_modules/typescript/lib/typescriptServices.d.ts +++ b/node_modules/typescript/lib/typescriptServices.d.ts @@ -14,7 +14,7 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { - const versionMajorMinor = "4.8"; + const versionMajorMinor = "4.9"; /** The version of the TypeScript compiler release */ const version: string; /** @@ -232,237 +232,240 @@ declare namespace ts { StaticKeyword = 124, YieldKeyword = 125, AbstractKeyword = 126, - AsKeyword = 127, - AssertsKeyword = 128, - AssertKeyword = 129, - AnyKeyword = 130, - AsyncKeyword = 131, - AwaitKeyword = 132, - BooleanKeyword = 133, - ConstructorKeyword = 134, - DeclareKeyword = 135, - GetKeyword = 136, - InferKeyword = 137, - IntrinsicKeyword = 138, - IsKeyword = 139, - KeyOfKeyword = 140, - ModuleKeyword = 141, - NamespaceKeyword = 142, - NeverKeyword = 143, - OutKeyword = 144, - ReadonlyKeyword = 145, - RequireKeyword = 146, - NumberKeyword = 147, - ObjectKeyword = 148, - SetKeyword = 149, - StringKeyword = 150, - SymbolKeyword = 151, - TypeKeyword = 152, - UndefinedKeyword = 153, - UniqueKeyword = 154, - UnknownKeyword = 155, - FromKeyword = 156, - GlobalKeyword = 157, - BigIntKeyword = 158, - OverrideKeyword = 159, - OfKeyword = 160, - QualifiedName = 161, - ComputedPropertyName = 162, - TypeParameter = 163, - Parameter = 164, - Decorator = 165, - PropertySignature = 166, - PropertyDeclaration = 167, - MethodSignature = 168, - MethodDeclaration = 169, - ClassStaticBlockDeclaration = 170, - Constructor = 171, - GetAccessor = 172, - SetAccessor = 173, - CallSignature = 174, - ConstructSignature = 175, - IndexSignature = 176, - TypePredicate = 177, - TypeReference = 178, - FunctionType = 179, - ConstructorType = 180, - TypeQuery = 181, - TypeLiteral = 182, - ArrayType = 183, - TupleType = 184, - OptionalType = 185, - RestType = 186, - UnionType = 187, - IntersectionType = 188, - ConditionalType = 189, - InferType = 190, - ParenthesizedType = 191, - ThisType = 192, - TypeOperator = 193, - IndexedAccessType = 194, - MappedType = 195, - LiteralType = 196, - NamedTupleMember = 197, - TemplateLiteralType = 198, - TemplateLiteralTypeSpan = 199, - ImportType = 200, - ObjectBindingPattern = 201, - ArrayBindingPattern = 202, - BindingElement = 203, - ArrayLiteralExpression = 204, - ObjectLiteralExpression = 205, - PropertyAccessExpression = 206, - ElementAccessExpression = 207, - CallExpression = 208, - NewExpression = 209, - TaggedTemplateExpression = 210, - TypeAssertionExpression = 211, - ParenthesizedExpression = 212, - FunctionExpression = 213, - ArrowFunction = 214, - DeleteExpression = 215, - TypeOfExpression = 216, - VoidExpression = 217, - AwaitExpression = 218, - PrefixUnaryExpression = 219, - PostfixUnaryExpression = 220, - BinaryExpression = 221, - ConditionalExpression = 222, - TemplateExpression = 223, - YieldExpression = 224, - SpreadElement = 225, - ClassExpression = 226, - OmittedExpression = 227, - ExpressionWithTypeArguments = 228, - AsExpression = 229, - NonNullExpression = 230, - MetaProperty = 231, - SyntheticExpression = 232, - TemplateSpan = 233, - SemicolonClassElement = 234, - Block = 235, - EmptyStatement = 236, - VariableStatement = 237, - ExpressionStatement = 238, - IfStatement = 239, - DoStatement = 240, - WhileStatement = 241, - ForStatement = 242, - ForInStatement = 243, - ForOfStatement = 244, - ContinueStatement = 245, - BreakStatement = 246, - ReturnStatement = 247, - WithStatement = 248, - SwitchStatement = 249, - LabeledStatement = 250, - ThrowStatement = 251, - TryStatement = 252, - DebuggerStatement = 253, - VariableDeclaration = 254, - VariableDeclarationList = 255, - FunctionDeclaration = 256, - ClassDeclaration = 257, - InterfaceDeclaration = 258, - TypeAliasDeclaration = 259, - EnumDeclaration = 260, - ModuleDeclaration = 261, - ModuleBlock = 262, - CaseBlock = 263, - NamespaceExportDeclaration = 264, - ImportEqualsDeclaration = 265, - ImportDeclaration = 266, - ImportClause = 267, - NamespaceImport = 268, - NamedImports = 269, - ImportSpecifier = 270, - ExportAssignment = 271, - ExportDeclaration = 272, - NamedExports = 273, - NamespaceExport = 274, - ExportSpecifier = 275, - MissingDeclaration = 276, - ExternalModuleReference = 277, - JsxElement = 278, - JsxSelfClosingElement = 279, - JsxOpeningElement = 280, - JsxClosingElement = 281, - JsxFragment = 282, - JsxOpeningFragment = 283, - JsxClosingFragment = 284, - JsxAttribute = 285, - JsxAttributes = 286, - JsxSpreadAttribute = 287, - JsxExpression = 288, - CaseClause = 289, - DefaultClause = 290, - HeritageClause = 291, - CatchClause = 292, - AssertClause = 293, - AssertEntry = 294, - ImportTypeAssertionContainer = 295, - PropertyAssignment = 296, - ShorthandPropertyAssignment = 297, - SpreadAssignment = 298, - EnumMember = 299, - UnparsedPrologue = 300, - UnparsedPrepend = 301, - UnparsedText = 302, - UnparsedInternalText = 303, - UnparsedSyntheticReference = 304, - SourceFile = 305, - Bundle = 306, - UnparsedSource = 307, - InputFiles = 308, - JSDocTypeExpression = 309, - JSDocNameReference = 310, - JSDocMemberName = 311, - JSDocAllType = 312, - JSDocUnknownType = 313, - JSDocNullableType = 314, - JSDocNonNullableType = 315, - JSDocOptionalType = 316, - JSDocFunctionType = 317, - JSDocVariadicType = 318, - JSDocNamepathType = 319, - JSDoc = 320, + AccessorKeyword = 127, + AsKeyword = 128, + AssertsKeyword = 129, + AssertKeyword = 130, + AnyKeyword = 131, + AsyncKeyword = 132, + AwaitKeyword = 133, + BooleanKeyword = 134, + ConstructorKeyword = 135, + DeclareKeyword = 136, + GetKeyword = 137, + InferKeyword = 138, + IntrinsicKeyword = 139, + IsKeyword = 140, + KeyOfKeyword = 141, + ModuleKeyword = 142, + NamespaceKeyword = 143, + NeverKeyword = 144, + OutKeyword = 145, + ReadonlyKeyword = 146, + RequireKeyword = 147, + NumberKeyword = 148, + ObjectKeyword = 149, + SatisfiesKeyword = 150, + SetKeyword = 151, + StringKeyword = 152, + SymbolKeyword = 153, + TypeKeyword = 154, + UndefinedKeyword = 155, + UniqueKeyword = 156, + UnknownKeyword = 157, + FromKeyword = 158, + GlobalKeyword = 159, + BigIntKeyword = 160, + OverrideKeyword = 161, + OfKeyword = 162, + QualifiedName = 163, + ComputedPropertyName = 164, + TypeParameter = 165, + Parameter = 166, + Decorator = 167, + PropertySignature = 168, + PropertyDeclaration = 169, + MethodSignature = 170, + MethodDeclaration = 171, + ClassStaticBlockDeclaration = 172, + Constructor = 173, + GetAccessor = 174, + SetAccessor = 175, + CallSignature = 176, + ConstructSignature = 177, + IndexSignature = 178, + TypePredicate = 179, + TypeReference = 180, + FunctionType = 181, + ConstructorType = 182, + TypeQuery = 183, + TypeLiteral = 184, + ArrayType = 185, + TupleType = 186, + OptionalType = 187, + RestType = 188, + UnionType = 189, + IntersectionType = 190, + ConditionalType = 191, + InferType = 192, + ParenthesizedType = 193, + ThisType = 194, + TypeOperator = 195, + IndexedAccessType = 196, + MappedType = 197, + LiteralType = 198, + NamedTupleMember = 199, + TemplateLiteralType = 200, + TemplateLiteralTypeSpan = 201, + ImportType = 202, + ObjectBindingPattern = 203, + ArrayBindingPattern = 204, + BindingElement = 205, + ArrayLiteralExpression = 206, + ObjectLiteralExpression = 207, + PropertyAccessExpression = 208, + ElementAccessExpression = 209, + CallExpression = 210, + NewExpression = 211, + TaggedTemplateExpression = 212, + TypeAssertionExpression = 213, + ParenthesizedExpression = 214, + FunctionExpression = 215, + ArrowFunction = 216, + DeleteExpression = 217, + TypeOfExpression = 218, + VoidExpression = 219, + AwaitExpression = 220, + PrefixUnaryExpression = 221, + PostfixUnaryExpression = 222, + BinaryExpression = 223, + ConditionalExpression = 224, + TemplateExpression = 225, + YieldExpression = 226, + SpreadElement = 227, + ClassExpression = 228, + OmittedExpression = 229, + ExpressionWithTypeArguments = 230, + AsExpression = 231, + NonNullExpression = 232, + MetaProperty = 233, + SyntheticExpression = 234, + SatisfiesExpression = 235, + TemplateSpan = 236, + SemicolonClassElement = 237, + Block = 238, + EmptyStatement = 239, + VariableStatement = 240, + ExpressionStatement = 241, + IfStatement = 242, + DoStatement = 243, + WhileStatement = 244, + ForStatement = 245, + ForInStatement = 246, + ForOfStatement = 247, + ContinueStatement = 248, + BreakStatement = 249, + ReturnStatement = 250, + WithStatement = 251, + SwitchStatement = 252, + LabeledStatement = 253, + ThrowStatement = 254, + TryStatement = 255, + DebuggerStatement = 256, + VariableDeclaration = 257, + VariableDeclarationList = 258, + FunctionDeclaration = 259, + ClassDeclaration = 260, + InterfaceDeclaration = 261, + TypeAliasDeclaration = 262, + EnumDeclaration = 263, + ModuleDeclaration = 264, + ModuleBlock = 265, + CaseBlock = 266, + NamespaceExportDeclaration = 267, + ImportEqualsDeclaration = 268, + ImportDeclaration = 269, + ImportClause = 270, + NamespaceImport = 271, + NamedImports = 272, + ImportSpecifier = 273, + ExportAssignment = 274, + ExportDeclaration = 275, + NamedExports = 276, + NamespaceExport = 277, + ExportSpecifier = 278, + MissingDeclaration = 279, + ExternalModuleReference = 280, + JsxElement = 281, + JsxSelfClosingElement = 282, + JsxOpeningElement = 283, + JsxClosingElement = 284, + JsxFragment = 285, + JsxOpeningFragment = 286, + JsxClosingFragment = 287, + JsxAttribute = 288, + JsxAttributes = 289, + JsxSpreadAttribute = 290, + JsxExpression = 291, + CaseClause = 292, + DefaultClause = 293, + HeritageClause = 294, + CatchClause = 295, + AssertClause = 296, + AssertEntry = 297, + ImportTypeAssertionContainer = 298, + PropertyAssignment = 299, + ShorthandPropertyAssignment = 300, + SpreadAssignment = 301, + EnumMember = 302, + UnparsedPrologue = 303, + UnparsedPrepend = 304, + UnparsedText = 305, + UnparsedInternalText = 306, + UnparsedSyntheticReference = 307, + SourceFile = 308, + Bundle = 309, + UnparsedSource = 310, + InputFiles = 311, + JSDocTypeExpression = 312, + JSDocNameReference = 313, + JSDocMemberName = 314, + JSDocAllType = 315, + JSDocUnknownType = 316, + JSDocNullableType = 317, + JSDocNonNullableType = 318, + JSDocOptionalType = 319, + JSDocFunctionType = 320, + JSDocVariadicType = 321, + JSDocNamepathType = 322, + JSDoc = 323, /** @deprecated Use SyntaxKind.JSDoc */ - JSDocComment = 320, - JSDocText = 321, - JSDocTypeLiteral = 322, - JSDocSignature = 323, - JSDocLink = 324, - JSDocLinkCode = 325, - JSDocLinkPlain = 326, - JSDocTag = 327, - JSDocAugmentsTag = 328, - JSDocImplementsTag = 329, - JSDocAuthorTag = 330, - JSDocDeprecatedTag = 331, - JSDocClassTag = 332, - JSDocPublicTag = 333, - JSDocPrivateTag = 334, - JSDocProtectedTag = 335, - JSDocReadonlyTag = 336, - JSDocOverrideTag = 337, - JSDocCallbackTag = 338, - JSDocEnumTag = 339, - JSDocParameterTag = 340, - JSDocReturnTag = 341, - JSDocThisTag = 342, - JSDocTypeTag = 343, - JSDocTemplateTag = 344, - JSDocTypedefTag = 345, - JSDocSeeTag = 346, - JSDocPropertyTag = 347, - SyntaxList = 348, - NotEmittedStatement = 349, - PartiallyEmittedExpression = 350, - CommaListExpression = 351, - MergeDeclarationMarker = 352, - EndOfDeclarationMarker = 353, - SyntheticReferenceExpression = 354, - Count = 355, + JSDocComment = 323, + JSDocText = 324, + JSDocTypeLiteral = 325, + JSDocSignature = 326, + JSDocLink = 327, + JSDocLinkCode = 328, + JSDocLinkPlain = 329, + JSDocTag = 330, + JSDocAugmentsTag = 331, + JSDocImplementsTag = 332, + JSDocAuthorTag = 333, + JSDocDeprecatedTag = 334, + JSDocClassTag = 335, + JSDocPublicTag = 336, + JSDocPrivateTag = 337, + JSDocProtectedTag = 338, + JSDocReadonlyTag = 339, + JSDocOverrideTag = 340, + JSDocCallbackTag = 341, + JSDocEnumTag = 342, + JSDocParameterTag = 343, + JSDocReturnTag = 344, + JSDocThisTag = 345, + JSDocTypeTag = 346, + JSDocTemplateTag = 347, + JSDocTypedefTag = 348, + JSDocSeeTag = 349, + JSDocPropertyTag = 350, + SyntaxList = 351, + NotEmittedStatement = 352, + PartiallyEmittedExpression = 353, + CommaListExpression = 354, + MergeDeclarationMarker = 355, + EndOfDeclarationMarker = 356, + SyntheticReferenceExpression = 357, + Count = 358, FirstAssignment = 63, LastAssignment = 78, FirstCompoundAssignment = 64, @@ -470,15 +473,15 @@ declare namespace ts { FirstReservedWord = 81, LastReservedWord = 116, FirstKeyword = 81, - LastKeyword = 160, + LastKeyword = 162, FirstFutureReservedWord = 117, LastFutureReservedWord = 125, - FirstTypeNode = 177, - LastTypeNode = 200, + FirstTypeNode = 179, + LastTypeNode = 202, FirstPunctuation = 18, LastPunctuation = 78, FirstToken = 0, - LastToken = 160, + LastToken = 162, FirstTriviaToken = 2, LastTriviaToken = 7, FirstLiteralToken = 8, @@ -487,20 +490,20 @@ declare namespace ts { LastTemplateToken = 17, FirstBinaryOperator = 29, LastBinaryOperator = 78, - FirstStatement = 237, - LastStatement = 253, - FirstNode = 161, - FirstJSDocNode = 309, - LastJSDocNode = 347, - FirstJSDocTagNode = 327, - LastJSDocTagNode = 347, + FirstStatement = 240, + LastStatement = 256, + FirstNode = 163, + FirstJSDocNode = 312, + LastJSDocNode = 350, + FirstJSDocTagNode = 330, + LastJSDocTagNode = 350, } export type TriviaSyntaxKind = SyntaxKind.SingleLineCommentTrivia | SyntaxKind.MultiLineCommentTrivia | SyntaxKind.NewLineTrivia | SyntaxKind.WhitespaceTrivia | SyntaxKind.ShebangTrivia | SyntaxKind.ConflictMarkerTrivia; export type LiteralSyntaxKind = SyntaxKind.NumericLiteral | SyntaxKind.BigIntLiteral | SyntaxKind.StringLiteral | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.RegularExpressionLiteral | SyntaxKind.NoSubstitutionTemplateLiteral; export type PseudoLiteralSyntaxKind = SyntaxKind.TemplateHead | SyntaxKind.TemplateMiddle | SyntaxKind.TemplateTail; export type PunctuationSyntaxKind = SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.OpenParenToken | SyntaxKind.CloseParenToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.DotToken | SyntaxKind.DotDotDotToken | SyntaxKind.SemicolonToken | SyntaxKind.CommaToken | SyntaxKind.QuestionDotToken | SyntaxKind.LessThanToken | SyntaxKind.LessThanSlashToken | SyntaxKind.GreaterThanToken | SyntaxKind.LessThanEqualsToken | SyntaxKind.GreaterThanEqualsToken | SyntaxKind.EqualsEqualsToken | SyntaxKind.ExclamationEqualsToken | SyntaxKind.EqualsEqualsEqualsToken | SyntaxKind.ExclamationEqualsEqualsToken | SyntaxKind.EqualsGreaterThanToken | SyntaxKind.PlusToken | SyntaxKind.MinusToken | SyntaxKind.AsteriskToken | SyntaxKind.AsteriskAsteriskToken | SyntaxKind.SlashToken | SyntaxKind.PercentToken | SyntaxKind.PlusPlusToken | SyntaxKind.MinusMinusToken | SyntaxKind.LessThanLessThanToken | SyntaxKind.GreaterThanGreaterThanToken | SyntaxKind.GreaterThanGreaterThanGreaterThanToken | SyntaxKind.AmpersandToken | SyntaxKind.BarToken | SyntaxKind.CaretToken | SyntaxKind.ExclamationToken | SyntaxKind.TildeToken | SyntaxKind.AmpersandAmpersandToken | SyntaxKind.BarBarToken | SyntaxKind.QuestionQuestionToken | SyntaxKind.QuestionToken | SyntaxKind.ColonToken | SyntaxKind.AtToken | SyntaxKind.BacktickToken | SyntaxKind.HashToken | SyntaxKind.EqualsToken | SyntaxKind.PlusEqualsToken | SyntaxKind.MinusEqualsToken | SyntaxKind.AsteriskEqualsToken | SyntaxKind.AsteriskAsteriskEqualsToken | SyntaxKind.SlashEqualsToken | SyntaxKind.PercentEqualsToken | SyntaxKind.LessThanLessThanEqualsToken | SyntaxKind.GreaterThanGreaterThanEqualsToken | SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken | SyntaxKind.AmpersandEqualsToken | SyntaxKind.BarEqualsToken | SyntaxKind.CaretEqualsToken; - export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; - export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; + export type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.AssertsKeyword | SyntaxKind.AssertKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InferKeyword | SyntaxKind.InKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.OfKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.RequireKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SatisfiesKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword; + export type ModifierSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AccessorKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.ConstKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.ExportKeyword | SyntaxKind.InKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.OutKeyword | SyntaxKind.OverrideKeyword | SyntaxKind.StaticKeyword; export type KeywordTypeSyntaxKind = SyntaxKind.AnyKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.IntrinsicKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.StringKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VoidKeyword; export type TokenSyntaxKind = SyntaxKind.Unknown | SyntaxKind.EndOfFileToken | TriviaSyntaxKind | LiteralSyntaxKind | PseudoLiteralSyntaxKind | PunctuationSyntaxKind | SyntaxKind.Identifier | KeywordSyntaxKind; export type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken; @@ -545,9 +548,10 @@ declare namespace ts { Protected = 16, Static = 32, Readonly = 64, - Abstract = 128, - Async = 256, - Default = 512, + Accessor = 128, + Abstract = 256, + Async = 512, + Default = 1024, Const = 2048, HasComputedJSDocModifiers = 4096, Deprecated = 8192, @@ -559,10 +563,10 @@ declare namespace ts { AccessibilityModifier = 28, ParameterPropertyModifier = 16476, NonPublicAccessibilityModifier = 24, - TypeScriptModifier = 116958, - ExportDefault = 513, - All = 257023, - Modifier = 125951 + TypeScriptModifier = 117086, + ExportDefault = 1025, + All = 258047, + Modifier = 126975 } export enum JsxFlags { None = 0, @@ -618,6 +622,7 @@ declare namespace ts { export interface ModifierToken extends KeywordToken { } export type AbstractKeyword = ModifierToken; + export type AccessorKeyword = ModifierToken; export type AsyncKeyword = ModifierToken; export type ConstKeyword = ModifierToken; export type DeclareKeyword = ModifierToken; @@ -633,11 +638,11 @@ declare namespace ts { export type StaticKeyword = ModifierToken; /** @deprecated Use `ReadonlyKeyword` instead. */ export type ReadonlyToken = ReadonlyKeyword; - export type Modifier = AbstractKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; + export type Modifier = AbstractKeyword | AccessorKeyword | AsyncKeyword | ConstKeyword | DeclareKeyword | DefaultKeyword | ExportKeyword | InKeyword | PrivateKeyword | ProtectedKeyword | PublicKeyword | OutKeyword | OverrideKeyword | ReadonlyKeyword | StaticKeyword; export type ModifierLike = Modifier | Decorator; export type AccessibilityModifier = PublicKeyword | PrivateKeyword | ProtectedKeyword; export type ParameterPropertyModifier = AccessibilityModifier | ReadonlyKeyword; - export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword; + export type ClassMemberModifier = AccessibilityModifier | ReadonlyKeyword | StaticKeyword | AccessorKeyword; export type ModifiersArray = NodeArray; export enum GeneratedIdentifierFlags { None = 0, @@ -764,6 +769,9 @@ declare namespace ts { readonly type?: TypeNode; readonly initializer?: Expression; } + export interface AutoAccessorPropertyDeclaration extends PropertyDeclaration { + _autoAccessorBrand: any; + } export interface ObjectLiteralElement extends NamedDeclaration { _objectLiteralBrand: any; readonly name?: PropertyName; @@ -1340,6 +1348,11 @@ declare namespace ts { readonly type: TypeNode; readonly expression: UnaryExpression; } + export interface SatisfiesExpression extends Expression { + readonly kind: SyntaxKind.SatisfiesExpression; + readonly expression: Expression; + readonly type: TypeNode; + } export type AssertionExpression = TypeAssertion | AsExpression; export interface NonNullExpression extends LeftHandSideExpression { readonly kind: SyntaxKind.NonNullExpression; @@ -2316,6 +2329,7 @@ declare namespace ts { getPrivateIdentifierPropertyOfType(leftType: Type, name: string, location: Node): Symbol | undefined; getIndexInfoOfType(type: Type, kind: IndexKind): IndexInfo | undefined; getIndexInfosOfType(type: Type): readonly IndexInfo[]; + getIndexInfosOfIndexSymbol: (indexSymbol: Symbol) => IndexInfo[]; getSignaturesOfType(type: Type, kind: SignatureKind): readonly Signature[]; getIndexTypeOfType(type: Type, kind: IndexKind): Type | undefined; getBaseTypes(type: InterfaceType): BaseType[]; @@ -2562,6 +2576,7 @@ declare namespace ts { MethodExcludes = 103359, GetAccessorExcludes = 46015, SetAccessorExcludes = 78783, + AccessorExcludes = 13247, TypeParameterExcludes = 526824, TypeAliasExcludes = 788968, AliasExcludes = 2097152, @@ -2832,7 +2847,7 @@ declare namespace ts { export interface SubstitutionType extends InstantiableType { objectFlags: ObjectFlags; baseType: Type; - substitute: Type; + constraint: Type; } export enum SignatureKind { Call = 0, @@ -3305,6 +3320,8 @@ declare namespace ts { */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; getEnvironmentVariable?(name: string): string | undefined; + /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ + hasInvalidatedResolutions?(filePath: Path): boolean; createHash?(data: string): string; getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined; } @@ -3387,7 +3404,7 @@ declare namespace ts { createNumericLiteral(value: string | number, numericLiteralFlags?: TokenFlags): NumericLiteral; createBigIntLiteral(value: string | PseudoBigInt): BigIntLiteral; createStringLiteral(text: string, isSingleQuote?: boolean): StringLiteral; - createStringLiteralFromNode(sourceNode: PropertyNameLiteral, isSingleQuote?: boolean): StringLiteral; + createStringLiteralFromNode(sourceNode: PropertyNameLiteral | PrivateIdentifier, isSingleQuote?: boolean): StringLiteral; createRegularExpressionLiteral(text: string): RegularExpressionLiteral; createIdentifier(text: string): Identifier; /** @@ -3412,6 +3429,8 @@ declare namespace ts { /** Create a unique name generated for a node. */ getGeneratedNameForNode(node: Node | undefined, flags?: GeneratedIdentifierFlags): Identifier; createPrivateIdentifier(text: string): PrivateIdentifier; + createUniquePrivateName(text?: string): PrivateIdentifier; + getGeneratedPrivateNameForNode(node: Node): PrivateIdentifier; createToken(token: SyntaxKind.SuperKeyword): SuperExpression; createToken(token: SyntaxKind.ThisKeyword): ThisExpression; createToken(token: SyntaxKind.NullKeyword): NullLiteral; @@ -3587,6 +3606,8 @@ declare namespace ts { updateNonNullChain(node: NonNullChain, expression: Expression): NonNullChain; createMetaProperty(keywordToken: MetaProperty["keywordToken"], name: Identifier): MetaProperty; updateMetaProperty(node: MetaProperty, name: Identifier): MetaProperty; + createSatisfiesExpression(expression: Expression, type: TypeNode): SatisfiesExpression; + updateSatisfiesExpression(node: SatisfiesExpression, expression: Expression, type: TypeNode): SatisfiesExpression; createTemplateSpan(expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; updateTemplateSpan(node: TemplateSpan, expression: Expression, literal: TemplateMiddle | TemplateTail): TemplateSpan; createSemicolonClassElement(): SemicolonClassElement; @@ -3948,7 +3969,7 @@ declare namespace ts { (nodes: NodeArray, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray; (nodes: NodeArray | undefined, visitor: Visitor | undefined, test?: (node: Node) => boolean, start?: number, count?: number): NodeArray | undefined; } - export type VisitResult = T | T[] | undefined; + export type VisitResult = T | readonly T[] | undefined; export interface Printer { /** * Print a node and its subtree as-is, without any emit transformations. @@ -4515,6 +4536,7 @@ declare namespace ts { function isClassElement(node: Node): node is ClassElement; function isClassLike(node: Node): node is ClassLikeDeclaration; function isAccessor(node: Node): node is AccessorDeclaration; + function isAutoAccessorPropertyDeclaration(node: Node): node is AutoAccessorPropertyDeclaration; function isModifierLike(node: Node): node is ModifierLike; function isTypeElement(node: Node): node is TypeElement; function isClassOrTypeElement(node: Node): node is ClassElement | TypeElement; @@ -4716,6 +4738,7 @@ declare namespace ts { function isOmittedExpression(node: Node): node is OmittedExpression; function isExpressionWithTypeArguments(node: Node): node is ExpressionWithTypeArguments; function isAsExpression(node: Node): node is AsExpression; + function isSatisfiesExpression(node: Node): node is SatisfiesExpression; function isNonNullExpression(node: Node): node is NonNullExpression; function isMetaProperty(node: Node): node is MetaProperty; function isSyntheticExpression(node: Node): node is SyntheticExpression; @@ -5376,9 +5399,9 @@ declare namespace ts { /** If provided, called with Diagnostic message that informs about change in watch status */ onWatchStatusChange?(diagnostic: Diagnostic, newLine: string, options: CompilerOptions, errorCount?: number): void; /** Used to watch changes in source files, missing files needed to update the program or config file */ - watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: CompilerOptions): FileWatcher; + watchFile(path: string, callback: FileWatcherCallback, pollingInterval?: number, options?: WatchOptions): FileWatcher; /** Used to watch resolved module's failed lookup locations, config file specs, type roots where auto type reference directives are added */ - watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: CompilerOptions): FileWatcher; + watchDirectory(path: string, callback: DirectoryWatcherCallback, recursive?: boolean, options?: WatchOptions): FileWatcher; /** If provided, will be used to set delayed compilation, so that multiple changes in short span are compiled together */ setTimeout?(callback: (...args: any[]) => void, ms: number, ...args: any[]): any; /** If provided, will be used to reset existing delayed compilation */ @@ -5421,6 +5444,8 @@ declare namespace ts { resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[]; /** If provided, used to resolve type reference directives, otherwise typescript's default resolution */ resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[]; + /** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */ + hasInvalidatedResolutions?(filePath: Path): boolean; /** * Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it */ @@ -6007,8 +6032,15 @@ declare namespace ts { type: "file"; fileName: string; } + enum OrganizeImportsMode { + All = "All", + SortAndCombine = "SortAndCombine", + RemoveUnused = "RemoveUnused" + } interface OrganizeImportsArgs extends CombinedCodeFixScope { + /** @deprecated Use `mode` instead */ skipDestructiveCodeActions?: boolean; + mode?: OrganizeImportsMode; } type CompletionsTriggerCharacter = "." | '"' | "'" | "`" | "/" | "@" | "<" | "#" | " "; enum CompletionTriggerKind { @@ -6526,7 +6558,7 @@ declare namespace ts { isGlobalCompletion: boolean; isMemberCompletion: boolean; /** - * In the absence of `CompletionEntry["replacementSpan"], the editor may choose whether to use + * In the absence of `CompletionEntry["replacementSpan"]`, the editor may choose whether to use * this span or its default one. If `CompletionEntry["replacementSpan"]` is defined, that span * must be used to commit that completion entry. */ @@ -6739,6 +6771,8 @@ declare namespace ts { * interface Y { foo:number; } */ memberVariableElement = "property", + /** class X { [public|private]* accessor foo: number; } */ + memberAccessorVariableElement = "accessor", /** * class X { constructor() { } } * class X { static { } } @@ -7018,7 +7052,7 @@ declare namespace ts { (text: string, isSingleQuote?: boolean | undefined, hasExtendedUnicodeEscape?: boolean | undefined): StringLiteral; }; /** @deprecated Use `factory.createStringLiteralFromNode` or the factory supplied by your transformation context instead. */ - const createStringLiteralFromNode: (sourceNode: PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral; + const createStringLiteralFromNode: (sourceNode: PrivateIdentifier | PropertyNameLiteral, isSingleQuote?: boolean | undefined) => StringLiteral; /** @deprecated Use `factory.createRegularExpressionLiteral` or the factory supplied by your transformation context instead. */ const createRegularExpressionLiteral: (text: string) => RegularExpressionLiteral; /** @deprecated Use `factory.createLoopVariable` or the factory supplied by your transformation context instead. */ diff --git a/node_modules/typescript/lib/typescriptServices.js b/node_modules/typescript/lib/typescriptServices.js index 955e00658..272258455 100644 --- a/node_modules/typescript/lib/typescriptServices.js +++ b/node_modules/typescript/lib/typescriptServices.js @@ -44,7 +44,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); - while (_) try { + while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { @@ -91,210 +91,15 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -/* @internal */ -var ts; -(function (ts) { - function createMapData() { - var sentinel = {}; - sentinel.prev = sentinel; - return { head: sentinel, tail: sentinel, size: 0 }; - } - function createMapEntry(key, value) { - return { key: key, value: value, next: undefined, prev: undefined }; - } - function sameValueZero(x, y) { - // Treats -0 === 0 and NaN === NaN - return x === y || x !== x && y !== y; - } - function getPrev(entry) { - var prev = entry.prev; - // Entries without a 'prev' have been removed from the map. - // An entry whose 'prev' points to itself is the head of the list and is invalid here. - if (!prev || prev === entry) - throw new Error("Illegal state"); - return prev; - } - function getNext(entry) { - while (entry) { - // Entries without a 'prev' have been removed from the map. Their 'next' - // pointer should point to the previous entry prior to deletion and - // that entry should be skipped to resume iteration. - var skipNext = !entry.prev; - entry = entry.next; - if (skipNext) { - continue; - } - return entry; - } - } - function getEntry(data, key) { - // We walk backwards from 'tail' to prioritize recently added entries. - // We skip 'head' because it is an empty entry used to track iteration start. - for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) { - if (sameValueZero(entry.key, key)) { - return entry; - } - } - } - function addOrUpdateEntry(data, key, value) { - var existing = getEntry(data, key); - if (existing) { - existing.value = value; - return; - } - var entry = createMapEntry(key, value); - entry.prev = data.tail; - data.tail.next = entry; - data.tail = entry; - data.size++; - return entry; - } - function deleteEntry(data, key) { - // We walk backwards from 'tail' to prioritize recently added entries. - // We skip 'head' because it is an empty entry used to track iteration start. - for (var entry = data.tail; entry !== data.head; entry = getPrev(entry)) { - // all entries in the map should have a 'prev' pointer. - if (entry.prev === undefined) - throw new Error("Illegal state"); - if (sameValueZero(entry.key, key)) { - if (entry.next) { - entry.next.prev = entry.prev; - } - else { - // an entry in the map without a 'next' pointer must be the 'tail'. - if (data.tail !== entry) - throw new Error("Illegal state"); - data.tail = entry.prev; - } - entry.prev.next = entry.next; - entry.next = entry.prev; - entry.prev = undefined; - data.size--; - return entry; - } - } - } - function clearEntries(data) { - var node = data.tail; - while (node !== data.head) { - var prev = getPrev(node); - node.next = data.head; - node.prev = undefined; - node = prev; - } - data.head.next = undefined; - data.tail = data.head; - data.size = 0; - } - function forEachEntry(data, action) { - var entry = data.head; - while (entry) { - entry = getNext(entry); - if (entry) { - action(entry.value, entry.key); - } - } - } - function forEachIteration(iterator, action) { - if (iterator) { - for (var step = iterator.next(); !step.done; step = iterator.next()) { - action(step.value); - } - } - } - function createIteratorData(data, selector) { - return { current: data.head, selector: selector }; - } - function iteratorNext(data) { - // Navigate to the next entry. - data.current = getNext(data.current); - if (data.current) { - return { value: data.selector(data.current.key, data.current.value), done: false }; - } - else { - return { value: undefined, done: true }; - } - } - /* @internal */ - var ShimCollections; - (function (ShimCollections) { - function createMapShim(getIterator) { - var MapIterator = /** @class */ (function () { - function MapIterator(data, selector) { - this._data = createIteratorData(data, selector); - } - MapIterator.prototype.next = function () { return iteratorNext(this._data); }; - return MapIterator; - }()); - return /** @class */ (function () { - function Map(iterable) { - var _this = this; - this._mapData = createMapData(); - forEachIteration(getIterator(iterable), function (_a) { - var key = _a[0], value = _a[1]; - return _this.set(key, value); - }); - } - Object.defineProperty(Map.prototype, "size", { - get: function () { return this._mapData.size; }, - enumerable: false, - configurable: true - }); - Map.prototype.get = function (key) { var _a; return (_a = getEntry(this._mapData, key)) === null || _a === void 0 ? void 0 : _a.value; }; - Map.prototype.set = function (key, value) { return addOrUpdateEntry(this._mapData, key, value), this; }; - Map.prototype.has = function (key) { return !!getEntry(this._mapData, key); }; - Map.prototype.delete = function (key) { return !!deleteEntry(this._mapData, key); }; - Map.prototype.clear = function () { clearEntries(this._mapData); }; - Map.prototype.keys = function () { return new MapIterator(this._mapData, function (key, _value) { return key; }); }; - Map.prototype.values = function () { return new MapIterator(this._mapData, function (_key, value) { return value; }); }; - Map.prototype.entries = function () { return new MapIterator(this._mapData, function (key, value) { return [key, value]; }); }; - Map.prototype.forEach = function (action) { forEachEntry(this._mapData, action); }; - return Map; - }()); - } - ShimCollections.createMapShim = createMapShim; - function createSetShim(getIterator) { - var SetIterator = /** @class */ (function () { - function SetIterator(data, selector) { - this._data = createIteratorData(data, selector); - } - SetIterator.prototype.next = function () { return iteratorNext(this._data); }; - return SetIterator; - }()); - return /** @class */ (function () { - function Set(iterable) { - var _this = this; - this._mapData = createMapData(); - forEachIteration(getIterator(iterable), function (value) { return _this.add(value); }); - } - Object.defineProperty(Set.prototype, "size", { - get: function () { return this._mapData.size; }, - enumerable: false, - configurable: true - }); - Set.prototype.add = function (value) { return addOrUpdateEntry(this._mapData, value, value), this; }; - Set.prototype.has = function (value) { return !!getEntry(this._mapData, value); }; - Set.prototype.delete = function (value) { return !!deleteEntry(this._mapData, value); }; - Set.prototype.clear = function () { clearEntries(this._mapData); }; - Set.prototype.keys = function () { return new SetIterator(this._mapData, function (key, _value) { return key; }); }; - Set.prototype.values = function () { return new SetIterator(this._mapData, function (_key, value) { return value; }); }; - Set.prototype.entries = function () { return new SetIterator(this._mapData, function (key, value) { return [key, value]; }); }; - Set.prototype.forEach = function (action) { forEachEntry(this._mapData, action); }; - return Set; - }()); - } - ShimCollections.createSetShim = createSetShim; - })(ShimCollections = ts.ShimCollections || (ts.ShimCollections = {})); -})(ts || (ts = {})); var ts; (function (ts) { // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configurePrerelease` too. - ts.versionMajorMinor = "4.8"; + ts.versionMajorMinor = "4.9"; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.8.4"; + ts.version = "".concat(ts.versionMajorMinor, ".3"); /* @internal */ var Comparison; (function (Comparison) { @@ -315,8 +120,12 @@ var ts; function tryGetNativeMap() { // Internet Explorer's Map doesn't support iteration, so don't use it. var gMap = globals === null || globals === void 0 ? void 0 : globals.Map; - // eslint-disable-next-line no-in-operator - return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + if (!constructor) { + throw new Error("No compatible Map implementation found."); + } + return constructor; } NativeCollections.tryGetNativeMap = tryGetNativeMap; /** @@ -325,24 +134,19 @@ var ts; function tryGetNativeSet() { // Internet Explorer's Set doesn't support iteration, so don't use it. var gSet = globals === null || globals === void 0 ? void 0 : globals.Set; - // eslint-disable-next-line no-in-operator - return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + if (!constructor) { + throw new Error("No compatible Set implementation found."); + } + return constructor; } NativeCollections.tryGetNativeSet = tryGetNativeSet; })(NativeCollections || (NativeCollections = {})); /* @internal */ - ts.Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim"); - /* @internal */ - ts.Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim"); + ts.Map = NativeCollections.tryGetNativeMap(); /* @internal */ - function getCollectionImplementation(name, nativeFactory, shimFactory) { - var _a; - // NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it. - var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator); - if (constructor) - return constructor; - throw new Error("TypeScript requires an environment that provides a compatible native ".concat(name, " implementation.")); - } + ts.Set = NativeCollections.tryGetNativeSet(); })(ts || (ts = {})); /* @internal */ var ts; @@ -1058,15 +862,18 @@ var ts; function insertSorted(array, insert, compare, allowDuplicates) { if (array.length === 0) { array.push(insert); - return; + return true; } var insertIndex = binarySearch(array, insert, identity, compare); if (insertIndex < 0) { array.splice(~insertIndex, 0, insert); + return true; } - else if (allowDuplicates) { + if (allowDuplicates) { array.splice(insertIndex, 0, insert); + return true; } + return false; } ts.insertSorted = insertSorted; function sortAndDeduplicate(array, comparer, equalityComparer) { @@ -1346,6 +1153,13 @@ var ts; : undefined; } ts.singleOrUndefined = singleOrUndefined; + /** + * Returns the only element of an array if it contains only one element; throws otherwise. + */ + function single(array) { + return ts.Debug.checkDefined(singleOrUndefined(array)); + } + ts.single = single; function singleOrMany(array) { return array && array.length === 1 ? array[0] @@ -2077,8 +1891,8 @@ var ts; return compareValues(a === null || a === void 0 ? void 0 : a.start, b === null || b === void 0 ? void 0 : b.start) || compareValues(a === null || a === void 0 ? void 0 : a.length, b === null || b === void 0 ? void 0 : b.length); } ts.compareTextSpans = compareTextSpans; - function min(a, b, compare) { - return compare(a, b) === -1 /* Comparison.LessThan */ ? a : b; + function min(items, compare) { + return reduceLeft(items, function (x, y) { return compare(x, y) === -1 /* Comparison.LessThan */ ? x : y; }); } ts.min = min; /** @@ -2869,7 +2683,7 @@ var ts; if (typeof func !== "function") { return ""; } - else if (func.hasOwnProperty("name")) { + else if (ts.hasProperty(func, "name")) { return func.name; } else { @@ -3019,7 +2833,7 @@ var ts; Debug.formatControlFlowGraph = formatControlFlowGraph; var flowNodeProto; function attachFlowNodeDebugInfoWorker(flowNode) { - if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line no-in-operator + if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line local/no-in-operator Object.defineProperties(flowNode, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -3065,7 +2879,7 @@ var ts; Debug.attachFlowNodeDebugInfo = attachFlowNodeDebugInfo; var nodeArrayProto; function attachNodeArrayDebugInfoWorker(array) { - if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line no-in-operator + if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line local/no-in-operator Object.defineProperties(array, { __tsDebuggerDisplay: { value: function (defaultValue) { @@ -3194,7 +3008,7 @@ var ts; ]; for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) { var ctor = nodeConstructors_1[_i]; - if (!ctor.prototype.hasOwnProperty("__debugKind")) { + if (!ts.hasProperty(ctor.prototype, "__debugKind")) { Object.defineProperties(ctor.prototype, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -3391,11 +3205,13 @@ var ts; // > alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric identifiers // > MUST NOT include leading zeroes. var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-][a-z0-9-]*))*$/i; + var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i; // https://semver.org/#spec-item-10 // > Build metadata MAY be denoted by appending a plus sign and a series of dot separated // > identifiers immediately following the patch or pre-release version. Identifiers MUST // > comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i; + var buildPartRegExp = /^[a-z0-9-]+$/i; // https://semver.org/#spec-item-9 // > Numeric identifiers MUST NOT include leading zeroes. var numericIdentifierRegExp = /^(0|[1-9]\d*)$/; @@ -3415,13 +3231,15 @@ var ts; ts.Debug.assert(major >= 0, "Invalid argument: major"); ts.Debug.assert(minor >= 0, "Invalid argument: minor"); ts.Debug.assert(patch >= 0, "Invalid argument: patch"); - ts.Debug.assert(!prerelease || prereleaseRegExp.test(prerelease), "Invalid argument: prerelease"); - ts.Debug.assert(!build || buildRegExp.test(build), "Invalid argument: build"); + var prereleaseArray = prerelease ? ts.isArray(prerelease) ? prerelease : prerelease.split(".") : ts.emptyArray; + var buildArray = build ? ts.isArray(build) ? build : build.split(".") : ts.emptyArray; + ts.Debug.assert(ts.every(prereleaseArray, function (s) { return prereleasePartRegExp.test(s); }), "Invalid argument: prerelease"); + ts.Debug.assert(ts.every(buildArray, function (s) { return buildPartRegExp.test(s); }), "Invalid argument: build"); this.major = major; this.minor = minor; this.patch = patch; - this.prerelease = prerelease ? prerelease.split(".") : ts.emptyArray; - this.build = build ? build.split(".") : ts.emptyArray; + this.prerelease = prereleaseArray; + this.build = buildArray; } Version.tryParse = function (text) { var result = tryParseComponents(text); @@ -3460,6 +3278,10 @@ var ts; default: return ts.Debug.assertNever(field); } }; + Version.prototype.with = function (fields) { + var _a = fields.major, major = _a === void 0 ? this.major : _a, _b = fields.minor, minor = _b === void 0 ? this.minor : _b, _c = fields.patch, patch = _c === void 0 ? this.patch : _c, _d = fields.prerelease, prerelease = _d === void 0 ? this.prerelease : _d, _e = fields.build, build = _e === void 0 ? this.build : _e; + return new Version(major, minor, patch, prerelease, build); + }; Version.prototype.toString = function () { var result = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch); if (ts.some(this.prerelease)) @@ -3468,7 +3290,7 @@ var ts; result += "+".concat(this.build.join(".")); return result; }; - Version.zero = new Version(0, 0, 0); + Version.zero = new Version(0, 0, 0, ["0"]); return Version; }()); ts.Version = Version; @@ -3551,6 +3373,10 @@ var ts; } return undefined; }; + /** + * Tests whether a version matches the range. This is equivalent to `satisfies(version, range, { includePrerelease: true })`. + * in `node-semver`. + */ VersionRange.prototype.test = function (version) { if (typeof version === "string") version = new Version(version); @@ -3661,19 +3487,20 @@ var ts; break; case "<": case ">=": - comparators.push(createComparator(operator, version)); + comparators.push(isWildcard(minor) || isWildcard(patch) ? createComparator(operator, version.with({ prerelease: "0" })) : + createComparator(operator, version)); break; case "<=": case ">": - comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major")) : - isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor")) : + comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major").with({ prerelease: "0" })) : + isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor").with({ prerelease: "0" })) : createComparator(operator, version)); break; case "=": case undefined: if (isWildcard(minor) || isWildcard(patch)) { - comparators.push(createComparator(">=", version)); - comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor"))); + comparators.push(createComparator(">=", version.with({ prerelease: "0" }))); + comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor").with({ prerelease: "0" }))); } else { comparators.push(createComparator("=", version)); @@ -3747,6 +3574,8 @@ var ts; typeof performance.mark === "function" && typeof performance.measure === "function" && typeof performance.now === "function" && + typeof performance.clearMarks === "function" && + typeof performance.clearMeasures === "function" && typeof PerformanceObserver === "function"; } function tryGetWebPerformanceHooks() { @@ -3791,7 +3620,9 @@ var ts; if (end === "__performance.measure-fix__") { nodePerformance_1.clearMarks("__performance.measure-fix__"); } - } + }, + clearMarks: function (name) { return nodePerformance_1.clearMarks(name); }, + clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); }, }; } return { @@ -3924,6 +3755,30 @@ var ts; durations.forEach(function (duration, measureName) { return cb(measureName, duration); }); } performance.forEachMeasure = forEachMeasure; + function forEachMark(cb) { + marks.forEach(function (_time, markName) { return cb(markName); }); + } + performance.forEachMark = forEachMark; + function clearMeasures(name) { + if (name !== undefined) + durations.delete(name); + else + durations.clear(); + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name); + } + performance.clearMeasures = clearMeasures; + function clearMarks(name) { + if (name !== undefined) { + counts.delete(name); + marks.delete(name); + } + else { + counts.clear(); + marks.clear(); + } + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name); + } + performance.clearMarks = clearMarks; /** * Indicates whether the performance API is enabled. */ @@ -4021,7 +3876,6 @@ var ts; var typeCatalog = []; // NB: id is index + 1 var legendPath; var legend = []; - ; /** Starts tracing for the given project. */ function startTracing(tracingMode, traceDir, configFilePath) { ts.Debug.assert(!ts.tracing, "Tracing already started"); @@ -4226,7 +4080,7 @@ var ts; var substitutionType = type; substitutionProperties = { substitutionBaseType: (_o = substitutionType.baseType) === null || _o === void 0 ? void 0 : _o.id, - substituteType: (_p = substitutionType.substitute) === null || _p === void 0 ? void 0 : _p.id, + constraintType: (_p = substitutionType.constraint) === null || _p === void 0 ? void 0 : _p.id, }; } var reverseMappedProperties = {}; @@ -4426,257 +4280,260 @@ var ts; SyntaxKind[SyntaxKind["YieldKeyword"] = 125] = "YieldKeyword"; // Contextual keywords SyntaxKind[SyntaxKind["AbstractKeyword"] = 126] = "AbstractKeyword"; - SyntaxKind[SyntaxKind["AsKeyword"] = 127] = "AsKeyword"; - SyntaxKind[SyntaxKind["AssertsKeyword"] = 128] = "AssertsKeyword"; - SyntaxKind[SyntaxKind["AssertKeyword"] = 129] = "AssertKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 130] = "AnyKeyword"; - SyntaxKind[SyntaxKind["AsyncKeyword"] = 131] = "AsyncKeyword"; - SyntaxKind[SyntaxKind["AwaitKeyword"] = 132] = "AwaitKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 133] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 134] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 135] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 136] = "GetKeyword"; - SyntaxKind[SyntaxKind["InferKeyword"] = 137] = "InferKeyword"; - SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 138] = "IntrinsicKeyword"; - SyntaxKind[SyntaxKind["IsKeyword"] = 139] = "IsKeyword"; - SyntaxKind[SyntaxKind["KeyOfKeyword"] = 140] = "KeyOfKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 141] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["NamespaceKeyword"] = 142] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["NeverKeyword"] = 143] = "NeverKeyword"; - SyntaxKind[SyntaxKind["OutKeyword"] = 144] = "OutKeyword"; - SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 145] = "ReadonlyKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 146] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 147] = "NumberKeyword"; - SyntaxKind[SyntaxKind["ObjectKeyword"] = 148] = "ObjectKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 149] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 150] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 151] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 152] = "TypeKeyword"; - SyntaxKind[SyntaxKind["UndefinedKeyword"] = 153] = "UndefinedKeyword"; - SyntaxKind[SyntaxKind["UniqueKeyword"] = 154] = "UniqueKeyword"; - SyntaxKind[SyntaxKind["UnknownKeyword"] = 155] = "UnknownKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 156] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 157] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["BigIntKeyword"] = 158] = "BigIntKeyword"; - SyntaxKind[SyntaxKind["OverrideKeyword"] = 159] = "OverrideKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 160] = "OfKeyword"; + SyntaxKind[SyntaxKind["AccessorKeyword"] = 127] = "AccessorKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 128] = "AsKeyword"; + SyntaxKind[SyntaxKind["AssertsKeyword"] = 129] = "AssertsKeyword"; + SyntaxKind[SyntaxKind["AssertKeyword"] = 130] = "AssertKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 131] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 132] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 133] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 134] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 135] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 136] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 137] = "GetKeyword"; + SyntaxKind[SyntaxKind["InferKeyword"] = 138] = "InferKeyword"; + SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 139] = "IntrinsicKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 140] = "IsKeyword"; + SyntaxKind[SyntaxKind["KeyOfKeyword"] = 141] = "KeyOfKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 142] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 143] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["NeverKeyword"] = 144] = "NeverKeyword"; + SyntaxKind[SyntaxKind["OutKeyword"] = 145] = "OutKeyword"; + SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 146] = "ReadonlyKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 147] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 148] = "NumberKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 149] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SatisfiesKeyword"] = 150] = "SatisfiesKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 151] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 152] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 153] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 154] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 155] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["UniqueKeyword"] = 156] = "UniqueKeyword"; + SyntaxKind[SyntaxKind["UnknownKeyword"] = 157] = "UnknownKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 158] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 159] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["BigIntKeyword"] = 160] = "BigIntKeyword"; + SyntaxKind[SyntaxKind["OverrideKeyword"] = 161] = "OverrideKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 162] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 161] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 162] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 163] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 164] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 163] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 164] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 165] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 165] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 166] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 167] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 166] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 167] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 168] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 169] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 170] = "ClassStaticBlockDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 171] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 172] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 173] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 174] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 175] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 176] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 168] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 169] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 170] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 171] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 172] = "ClassStaticBlockDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 173] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 174] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 175] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 176] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 177] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 178] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 177] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 178] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 179] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 180] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 181] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 182] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 183] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 184] = "TupleType"; - SyntaxKind[SyntaxKind["OptionalType"] = 185] = "OptionalType"; - SyntaxKind[SyntaxKind["RestType"] = 186] = "RestType"; - SyntaxKind[SyntaxKind["UnionType"] = 187] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 188] = "IntersectionType"; - SyntaxKind[SyntaxKind["ConditionalType"] = 189] = "ConditionalType"; - SyntaxKind[SyntaxKind["InferType"] = 190] = "InferType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 191] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 192] = "ThisType"; - SyntaxKind[SyntaxKind["TypeOperator"] = 193] = "TypeOperator"; - SyntaxKind[SyntaxKind["IndexedAccessType"] = 194] = "IndexedAccessType"; - SyntaxKind[SyntaxKind["MappedType"] = 195] = "MappedType"; - SyntaxKind[SyntaxKind["LiteralType"] = 196] = "LiteralType"; - SyntaxKind[SyntaxKind["NamedTupleMember"] = 197] = "NamedTupleMember"; - SyntaxKind[SyntaxKind["TemplateLiteralType"] = 198] = "TemplateLiteralType"; - SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 199] = "TemplateLiteralTypeSpan"; - SyntaxKind[SyntaxKind["ImportType"] = 200] = "ImportType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 179] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 180] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 181] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 182] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 183] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 184] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 185] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 186] = "TupleType"; + SyntaxKind[SyntaxKind["OptionalType"] = 187] = "OptionalType"; + SyntaxKind[SyntaxKind["RestType"] = 188] = "RestType"; + SyntaxKind[SyntaxKind["UnionType"] = 189] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 190] = "IntersectionType"; + SyntaxKind[SyntaxKind["ConditionalType"] = 191] = "ConditionalType"; + SyntaxKind[SyntaxKind["InferType"] = 192] = "InferType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 193] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 194] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 195] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 196] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 197] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 198] = "LiteralType"; + SyntaxKind[SyntaxKind["NamedTupleMember"] = 199] = "NamedTupleMember"; + SyntaxKind[SyntaxKind["TemplateLiteralType"] = 200] = "TemplateLiteralType"; + SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 201] = "TemplateLiteralTypeSpan"; + SyntaxKind[SyntaxKind["ImportType"] = 202] = "ImportType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 201] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 202] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 203] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 203] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 204] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 205] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 204] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 205] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 206] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 207] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 208] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 209] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 210] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 211] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 212] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 213] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 214] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 215] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 216] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 217] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 218] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 219] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 220] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 221] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 222] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 223] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 224] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 225] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 226] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 227] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 228] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 229] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 230] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 231] = "MetaProperty"; - SyntaxKind[SyntaxKind["SyntheticExpression"] = 232] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 206] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 207] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 208] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 209] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 210] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 211] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 212] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 213] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 214] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 215] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 216] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 217] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 218] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 219] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 220] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 221] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 222] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 223] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 224] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 225] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 226] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 227] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 228] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 229] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 230] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 231] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 232] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 233] = "MetaProperty"; + SyntaxKind[SyntaxKind["SyntheticExpression"] = 234] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["SatisfiesExpression"] = 235] = "SatisfiesExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 233] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 234] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 236] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 237] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 235] = "Block"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 236] = "EmptyStatement"; - SyntaxKind[SyntaxKind["VariableStatement"] = 237] = "VariableStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 238] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 239] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 240] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 241] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 242] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 243] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 244] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 245] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 246] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 247] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 248] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 249] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 250] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 251] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 252] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 253] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 254] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 255] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 256] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 257] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 258] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 259] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 260] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 261] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 262] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 263] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 264] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 265] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 266] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 267] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 268] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 269] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 270] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 271] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 272] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 273] = "NamedExports"; - SyntaxKind[SyntaxKind["NamespaceExport"] = 274] = "NamespaceExport"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 275] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 276] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 238] = "Block"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 239] = "EmptyStatement"; + SyntaxKind[SyntaxKind["VariableStatement"] = 240] = "VariableStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 241] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 242] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 243] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 244] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 245] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 246] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 247] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 248] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 249] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 250] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 251] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 252] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 253] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 254] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 255] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 256] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 257] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 258] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 259] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 260] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 261] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 262] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 263] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 264] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 265] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 266] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 267] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 268] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 269] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 270] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 271] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 272] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 273] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 274] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 275] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 276] = "NamedExports"; + SyntaxKind[SyntaxKind["NamespaceExport"] = 277] = "NamespaceExport"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 278] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 279] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 277] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 280] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 278] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 279] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 280] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 281] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxFragment"] = 282] = "JsxFragment"; - SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 283] = "JsxOpeningFragment"; - SyntaxKind[SyntaxKind["JsxClosingFragment"] = 284] = "JsxClosingFragment"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 285] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 286] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 287] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 288] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 281] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 282] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 283] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 284] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxFragment"] = 285] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 286] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 287] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 288] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 289] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 290] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 291] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 289] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 290] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 291] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 292] = "CatchClause"; - SyntaxKind[SyntaxKind["AssertClause"] = 293] = "AssertClause"; - SyntaxKind[SyntaxKind["AssertEntry"] = 294] = "AssertEntry"; - SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 295] = "ImportTypeAssertionContainer"; + SyntaxKind[SyntaxKind["CaseClause"] = 292] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 293] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 294] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 295] = "CatchClause"; + SyntaxKind[SyntaxKind["AssertClause"] = 296] = "AssertClause"; + SyntaxKind[SyntaxKind["AssertEntry"] = 297] = "AssertEntry"; + SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 298] = "ImportTypeAssertionContainer"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 296] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 297] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 298] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 299] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 300] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 301] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 299] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 302] = "EnumMember"; // Unparsed - SyntaxKind[SyntaxKind["UnparsedPrologue"] = 300] = "UnparsedPrologue"; - SyntaxKind[SyntaxKind["UnparsedPrepend"] = 301] = "UnparsedPrepend"; - SyntaxKind[SyntaxKind["UnparsedText"] = 302] = "UnparsedText"; - SyntaxKind[SyntaxKind["UnparsedInternalText"] = 303] = "UnparsedInternalText"; - SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 304] = "UnparsedSyntheticReference"; + SyntaxKind[SyntaxKind["UnparsedPrologue"] = 303] = "UnparsedPrologue"; + SyntaxKind[SyntaxKind["UnparsedPrepend"] = 304] = "UnparsedPrepend"; + SyntaxKind[SyntaxKind["UnparsedText"] = 305] = "UnparsedText"; + SyntaxKind[SyntaxKind["UnparsedInternalText"] = 306] = "UnparsedInternalText"; + SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 307] = "UnparsedSyntheticReference"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 305] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 306] = "Bundle"; - SyntaxKind[SyntaxKind["UnparsedSource"] = 307] = "UnparsedSource"; - SyntaxKind[SyntaxKind["InputFiles"] = 308] = "InputFiles"; + SyntaxKind[SyntaxKind["SourceFile"] = 308] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 309] = "Bundle"; + SyntaxKind[SyntaxKind["UnparsedSource"] = 310] = "UnparsedSource"; + SyntaxKind[SyntaxKind["InputFiles"] = 311] = "InputFiles"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 309] = "JSDocTypeExpression"; - SyntaxKind[SyntaxKind["JSDocNameReference"] = 310] = "JSDocNameReference"; - SyntaxKind[SyntaxKind["JSDocMemberName"] = 311] = "JSDocMemberName"; - SyntaxKind[SyntaxKind["JSDocAllType"] = 312] = "JSDocAllType"; - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 313] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 314] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 315] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 316] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType"; - SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 312] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocNameReference"] = 313] = "JSDocNameReference"; + SyntaxKind[SyntaxKind["JSDocMemberName"] = 314] = "JSDocMemberName"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 315] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 316] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 317] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 318] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 319] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 320] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 321] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocNamepathType"] = 322] = "JSDocNamepathType"; + SyntaxKind[SyntaxKind["JSDoc"] = 323] = "JSDoc"; /** @deprecated Use SyntaxKind.JSDoc */ - SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 322] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocSignature"] = 323] = "JSDocSignature"; - SyntaxKind[SyntaxKind["JSDocLink"] = 324] = "JSDocLink"; - SyntaxKind[SyntaxKind["JSDocLinkCode"] = 325] = "JSDocLinkCode"; - SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 326] = "JSDocLinkPlain"; - SyntaxKind[SyntaxKind["JSDocTag"] = 327] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 328] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 329] = "JSDocImplementsTag"; - SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 330] = "JSDocAuthorTag"; - SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 331] = "JSDocDeprecatedTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 332] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocPublicTag"] = 333] = "JSDocPublicTag"; - SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 334] = "JSDocPrivateTag"; - SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 335] = "JSDocProtectedTag"; - SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 336] = "JSDocReadonlyTag"; - SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 337] = "JSDocOverrideTag"; - SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 338] = "JSDocCallbackTag"; - SyntaxKind[SyntaxKind["JSDocEnumTag"] = 339] = "JSDocEnumTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 340] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 341] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocThisTag"] = 342] = "JSDocThisTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 343] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 344] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 345] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocSeeTag"] = 346] = "JSDocSeeTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 347] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocComment"] = 323] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocText"] = 324] = "JSDocText"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 325] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocSignature"] = 326] = "JSDocSignature"; + SyntaxKind[SyntaxKind["JSDocLink"] = 327] = "JSDocLink"; + SyntaxKind[SyntaxKind["JSDocLinkCode"] = 328] = "JSDocLinkCode"; + SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 329] = "JSDocLinkPlain"; + SyntaxKind[SyntaxKind["JSDocTag"] = 330] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 331] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 332] = "JSDocImplementsTag"; + SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 333] = "JSDocAuthorTag"; + SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 334] = "JSDocDeprecatedTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 335] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocPublicTag"] = 336] = "JSDocPublicTag"; + SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 337] = "JSDocPrivateTag"; + SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 338] = "JSDocProtectedTag"; + SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 339] = "JSDocReadonlyTag"; + SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 340] = "JSDocOverrideTag"; + SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 341] = "JSDocCallbackTag"; + SyntaxKind[SyntaxKind["JSDocEnumTag"] = 342] = "JSDocEnumTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 343] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 344] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocThisTag"] = 345] = "JSDocThisTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 346] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 347] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 348] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocSeeTag"] = 349] = "JSDocSeeTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 350] = "JSDocPropertyTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 348] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 351] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 349] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 350] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 351] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 352] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 353] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 354] = "SyntheticReferenceExpression"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 352] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 353] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 354] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 355] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 356] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 357] = "SyntheticReferenceExpression"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 355] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 358] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 63] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 78] = "LastAssignment"; @@ -4685,15 +4542,15 @@ var ts; SyntaxKind[SyntaxKind["FirstReservedWord"] = 81] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 116] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 81] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 160] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 162] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 117] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 125] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 177] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 200] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 179] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 202] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 78] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 160] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 162] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -4702,15 +4559,15 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 29] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 78] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstStatement"] = 237] = "FirstStatement"; - SyntaxKind[SyntaxKind["LastStatement"] = 253] = "LastStatement"; - SyntaxKind[SyntaxKind["FirstNode"] = 161] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 309] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 347] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 327] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstStatement"] = 240] = "FirstStatement"; + SyntaxKind[SyntaxKind["LastStatement"] = 256] = "LastStatement"; + SyntaxKind[SyntaxKind["FirstNode"] = 163] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 312] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 350] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 330] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 350] = "LastJSDocTagNode"; /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword"; - /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword"; + /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 162] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -4775,9 +4632,10 @@ var ts; ModifierFlags[ModifierFlags["Protected"] = 16] = "Protected"; ModifierFlags[ModifierFlags["Static"] = 32] = "Static"; ModifierFlags[ModifierFlags["Readonly"] = 64] = "Readonly"; - ModifierFlags[ModifierFlags["Abstract"] = 128] = "Abstract"; - ModifierFlags[ModifierFlags["Async"] = 256] = "Async"; - ModifierFlags[ModifierFlags["Default"] = 512] = "Default"; + ModifierFlags[ModifierFlags["Accessor"] = 128] = "Accessor"; + ModifierFlags[ModifierFlags["Abstract"] = 256] = "Abstract"; + ModifierFlags[ModifierFlags["Async"] = 512] = "Async"; + ModifierFlags[ModifierFlags["Default"] = 1024] = "Default"; ModifierFlags[ModifierFlags["Const"] = 2048] = "Const"; ModifierFlags[ModifierFlags["HasComputedJSDocModifiers"] = 4096] = "HasComputedJSDocModifiers"; ModifierFlags[ModifierFlags["Deprecated"] = 8192] = "Deprecated"; @@ -4790,10 +4648,10 @@ var ts; // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 16476] = "ParameterPropertyModifier"; ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier"; - ModifierFlags[ModifierFlags["TypeScriptModifier"] = 116958] = "TypeScriptModifier"; - ModifierFlags[ModifierFlags["ExportDefault"] = 513] = "ExportDefault"; - ModifierFlags[ModifierFlags["All"] = 257023] = "All"; - ModifierFlags[ModifierFlags["Modifier"] = 125951] = "Modifier"; + ModifierFlags[ModifierFlags["TypeScriptModifier"] = 117086] = "TypeScriptModifier"; + ModifierFlags[ModifierFlags["ExportDefault"] = 1025] = "ExportDefault"; + ModifierFlags[ModifierFlags["All"] = 258047] = "All"; + ModifierFlags[ModifierFlags["Modifier"] = 126975] = "Modifier"; })(ModifierFlags = ts.ModifierFlags || (ts.ModifierFlags = {})); var JsxFlags; (function (JsxFlags) { @@ -4989,6 +4847,7 @@ var ts; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyTuple"] = 524288] = "AllowEmptyTuple"; NodeBuilderFlags[NodeBuilderFlags["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType"; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType"; + /* @internal */ NodeBuilderFlags[NodeBuilderFlags["WriteComputedProps"] = 1073741824] = "WriteComputedProps"; // Errors (cont.) NodeBuilderFlags[NodeBuilderFlags["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths"; /* @internal */ NodeBuilderFlags[NodeBuilderFlags["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain"; @@ -5049,8 +4908,10 @@ var ts; SymbolFormatFlags[SymbolFormatFlags["AllowAnyNodeKind"] = 4] = "AllowAnyNodeKind"; // Prefer aliases which are not directly visible SymbolFormatFlags[SymbolFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 8] = "UseAliasDefinedOutsideCurrentScope"; + // { [E.A]: 1 } + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["WriteComputedProps"] = 16] = "WriteComputedProps"; // Skip building an accessible symbol chain - /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 16] = "DoNotIncludeSymbolChain"; + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 32] = "DoNotIncludeSymbolChain"; })(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); /* @internal */ var SymbolAccessibility; @@ -5164,6 +5025,7 @@ var ts; SymbolFlags[SymbolFlags["MethodExcludes"] = 103359] = "MethodExcludes"; SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes"; SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes"; + SymbolFlags[SymbolFlags["AccessorExcludes"] = 13247] = "AccessorExcludes"; SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes"; SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes"; SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes"; @@ -5247,8 +5109,8 @@ var ts; NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance"; NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic"; NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked"; - NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuper"] = 2048] = "AsyncMethodWithSuper"; - NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuperBinding"] = 4096] = "AsyncMethodWithSuperBinding"; + NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAccessInAsync"] = 2048] = "MethodWithSuperPropertyAccessInAsync"; + NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAssignmentInAsync"] = 4096] = "MethodWithSuperPropertyAssignmentInAsync"; NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments"; NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed"; NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass"; @@ -6290,7 +6152,6 @@ var ts; var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels); /* @internal */ ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels); - /* @internal */ function setCustomPollingValues(system) { if (!system.getEnvironmentVariable) { return; @@ -6333,7 +6194,6 @@ var ts; createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels); } } - ts.setCustomPollingValues = setCustomPollingValues; function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) { var definedValueCopyToIndex = pollIndex; // Max visit would be all elements of the queue @@ -6379,7 +6239,6 @@ var ts; } } } - /* @internal */ function createDynamicPriorityPollingWatchFile(host) { var watchedFiles = []; var changedFilesInLastPoll = []; @@ -6488,7 +6347,6 @@ var ts; pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval)); } } - ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile; function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) { // One file can have multiple watchers var fileWatcherCallbacks = ts.createMultiMap(); @@ -6567,42 +6425,38 @@ var ts; pollScheduled = host.setTimeout(pollQueue, PollingInterval.High); } } - /* @internal */ - function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) { - var cache = new ts.Map(); - var callbacksCache = ts.createMultiMap(); + function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) { var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - return function (fileName, callback, pollingInterval, options) { - var path = toCanonicalFileName(fileName); - var existing = cache.get(path); - if (existing) { - existing.refCount++; - } - else { - cache.set(path, { - watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options), - refCount: 1 - }); + var path = toCanonicalFileName(name); + var existing = cache.get(path); + if (existing) { + existing.callbacks.push(callback); + } + else { + cache.set(path, { + watcher: createWatcher(( + // Cant infer types correctly so lets satisfy checker + function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })), + callbacks: [callback] + }); + } + return { + close: function () { + var watcher = cache.get(path); + // Watcher is not expected to be undefined, but if it is normally its because + // exception was thrown somewhere else and watch state is not what it should be + if (!watcher) + return; + if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length) + return; + cache.delete(path); + ts.closeFileWatcherOf(watcher); } - callbacksCache.add(path, callback); - return { - close: function () { - var watcher = ts.Debug.checkDefined(cache.get(path)); - callbacksCache.remove(path, callback); - watcher.refCount--; - if (watcher.refCount) - return; - cache.delete(path); - ts.closeFileWatcherOf(watcher); - } - }; }; } - ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName; /** * Returns true if file status changed */ - /*@internal*/ function onWatchedFileStat(watchedFile, modifiedTime) { var oldTime = watchedFile.mtime.getTime(); var newTime = modifiedTime.getTime(); @@ -6614,7 +6468,6 @@ var ts; } return false; } - ts.onWatchedFileStat = onWatchedFileStat; /*@internal*/ function getFileWatcherEventKind(oldTime, newTime) { return oldTime === 0 @@ -6642,7 +6495,6 @@ var ts; * that means if this is recursive watcher, watch the children directories as well * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile) */ - /*@internal*/ function createDirectoryWatcherSupportingRecursive(_a) { var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout; var cache = new ts.Map(); @@ -6851,18 +6703,15 @@ var ts; return ts.stringContains(toCanonicalFilePath(path), searchPath); } } - ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive; /*@internal*/ var FileSystemEntryKind; (function (FileSystemEntryKind) { FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File"; FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory"; })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {})); - /*@internal*/ function createFileWatcherCallback(callback) { return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); }; } - ts.createFileWatcherCallback = createFileWatcherCallback; function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) { return function (eventName, _relativeFileName, modifiedTime) { if (eventName === "rename") { @@ -6896,7 +6745,10 @@ var ts; } /*@internal*/ function createSystemWatchFunctions(_a) { - var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatches = new ts.Map(); + var fsWatches = new ts.Map(); + var fsWatchesRecursive = new ts.Map(); var dynamicPollingWatchFile; var fixedChunkSizePollingWatchFile; var nonPollingWatchFile; @@ -6959,8 +6811,8 @@ var ts; return useNonPollingWatchers ? // Use notifications from FS to watch with falling back to fs.watchFile generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) : - // Default to do not use fixed polling interval - { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval }; + // Default to using fs events + { watchFile: ts.WatchFileKind.UseFsEvents }; } } function generateWatchFileOptions(watchFile, fallbackPolling, options) { @@ -7031,7 +6883,13 @@ var ts; }; } } + function pollingWatchFile(fileName, callback, pollingInterval, options) { + return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); }); + } function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { + return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); }); + } + function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { var lastDirectoryPartWithDirectorySeparator; var lastDirectoryPart; if (inodeWatching) { @@ -7210,7 +7068,7 @@ var ts; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); var _b = createSystemWatchFunctions({ - pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), + pollingWatchFileWorker: fsWatchFileWorker, getModifiedTime: getModifiedTime, setTimeout: setTimeout, clearTimeout: clearTimeout, @@ -7226,7 +7084,6 @@ var ts; tscWatchFile: process.env.TSC_WATCHFILE, useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER, tscWatchDirectory: process.env.TSC_WATCHDIRECTORY, - defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); }, inodeWatching: isLinuxOrMacOs, sysLog: sysLog, }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory; @@ -8030,12 +7887,9 @@ var ts; * Normalize path separators, converting `\` into `/`. */ function normalizeSlashes(path) { - var index = path.indexOf("\\"); - if (index === -1) { - return path; - } - backslashRegExp.lastIndex = index; // prime regex with known position - return path.replace(backslashRegExp, ts.directorySeparator); + return path.indexOf("\\") !== -1 + ? path.replace(backslashRegExp, ts.directorySeparator) + : path; } ts.normalizeSlashes = normalizeSlashes; /** @@ -8618,6 +8472,8 @@ var ts; A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."), _0_modifier_cannot_appear_on_a_type_parameter: diag(1273, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_parameter_1273", "'{0}' modifier cannot appear on a type parameter"), _0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"), + accessor_modifier_can_only_appear_on_a_property_declaration: diag(1275, ts.DiagnosticCategory.Error, "accessor_modifier_can_only_appear_on_a_property_declaration_1275", "'accessor' modifier can only appear on a property declaration."), + An_accessor_property_cannot_be_declared_optional: diag(1276, ts.DiagnosticCategory.Error, "An_accessor_property_cannot_be_declared_optional_1276", "An 'accessor' property cannot be declared optional."), with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."), await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."), The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."), @@ -8668,7 +8524,7 @@ var ts; An_enum_member_name_must_be_followed_by_a_or: diag(1357, ts.DiagnosticCategory.Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."), Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, ts.DiagnosticCategory.Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."), Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here: diag(1359, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."), - Class_constructor_may_not_be_a_generator: diag(1360, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1360", "Class constructor may not be a generator."), + Type_0_does_not_satisfy_the_expected_type_1: diag(1360, ts.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_expected_type_1_1360", "Type '{0}' does not satisfy the expected type '{1}'."), _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type: diag(1361, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."), _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type: diag(1362, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."), A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both: diag(1363, ts.DiagnosticCategory.Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."), @@ -8676,6 +8532,7 @@ var ts; Convert_all_re_exported_types_to_type_only_exports: diag(1365, ts.DiagnosticCategory.Message, "Convert_all_re_exported_types_to_type_only_exports_1365", "Convert all re-exported types to type-only exports"), Split_into_two_separate_import_declarations: diag(1366, ts.DiagnosticCategory.Message, "Split_into_two_separate_import_declarations_1366", "Split into two separate import declarations"), Split_all_invalid_type_only_imports: diag(1367, ts.DiagnosticCategory.Message, "Split_all_invalid_type_only_imports_1367", "Split all invalid type-only imports"), + Class_constructor_may_not_be_a_generator: diag(1368, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."), Did_you_mean_0: diag(1369, ts.DiagnosticCategory.Message, "Did_you_mean_0_1369", "Did you mean '{0}'?"), This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, ts.DiagnosticCategory.Error, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."), Convert_to_type_only_import: diag(1373, ts.DiagnosticCategory.Message, "Convert_to_type_only_import_1373", "Convert to type-only import"), @@ -8849,14 +8706,12 @@ var ts; The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."), The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."), The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."), - The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."), - The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."), The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."), Operator_0_cannot_be_applied_to_types_1_and_2: diag(2365, ts.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."), Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: diag(2366, ts.DiagnosticCategory.Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."), - This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367", "This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap."), + This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367", "This comparison appears to be unintentional because the types '{0}' and '{1}' have no overlap."), Type_parameter_name_cannot_be_0: diag(2368, ts.DiagnosticCategory.Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."), A_parameter_property_is_only_allowed_in_a_constructor_implementation: diag(2369, ts.DiagnosticCategory.Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."), A_rest_parameter_must_be_of_an_array_type: diag(2370, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."), @@ -9099,6 +8954,7 @@ var ts; Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."), Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."), Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."), + Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, ts.DiagnosticCategory.Error, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."), Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."), A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."), Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."), @@ -9279,6 +9135,7 @@ var ts; _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"), We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."), Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), + This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."), Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), @@ -9736,6 +9593,11 @@ var ts; Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."), Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"), Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"), + Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"), + Resolving_in_0_mode_with_conditions_1: diag(6402, ts.DiagnosticCategory.Message, "Resolving_in_0_mode_with_conditions_1_6402", "Resolving in {0} mode with conditions {1}."), + Matched_0_condition_1: diag(6403, ts.DiagnosticCategory.Message, "Matched_0_condition_1_6403", "Matched '{0}' condition '{1}'."), + Using_0_subpath_1_with_target_2: diag(6404, ts.DiagnosticCategory.Message, "Using_0_subpath_1_with_target_2_6404", "Using '{0}' subpath '{1}' with target '{2}'."), + Saw_non_matching_condition_0: diag(6405, ts.DiagnosticCategory.Message, "Saw_non_matching_condition_0_6405", "Saw non-matching condition '{0}'."), The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"), The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."), The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."), @@ -9978,6 +9840,7 @@ var ts; The_tag_was_first_specified_here: diag(8034, ts.DiagnosticCategory.Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."), You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."), You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."), + Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, ts.DiagnosticCategory.Error, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."), Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."), Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."), JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17000, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."), @@ -10051,6 +9914,8 @@ var ts; Remove_type_from_import_of_0_from_1: diag(90056, ts.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", "Remove 'type' from import of '{0}' from \"{1}\""), Add_import_from_0: diag(90057, ts.DiagnosticCategory.Message, "Add_import_from_0_90057", "Add import from \"{0}\""), Update_import_from_0: diag(90058, ts.DiagnosticCategory.Message, "Update_import_from_0_90058", "Update import from \"{0}\""), + Export_0_from_module_1: diag(90059, ts.DiagnosticCategory.Message, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"), + Export_all_referenced_locals: diag(90060, ts.DiagnosticCategory.Message, "Export_all_referenced_locals_90060", "Export all referenced locals"), Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"), Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"), Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"), @@ -10149,6 +10014,7 @@ var ts; Set_the_module_option_in_your_configuration_file_to_0: diag(95099, ts.DiagnosticCategory.Message, "Set_the_module_option_in_your_configuration_file_to_0_95099", "Set the 'module' option in your configuration file to '{0}'"), Convert_invalid_character_to_its_html_entity_code: diag(95100, ts.DiagnosticCategory.Message, "Convert_invalid_character_to_its_html_entity_code_95100", "Convert invalid character to its html entity code"), Convert_all_invalid_characters_to_HTML_entity_code: diag(95101, ts.DiagnosticCategory.Message, "Convert_all_invalid_characters_to_HTML_entity_code_95101", "Convert all invalid characters to HTML entity code"), + Convert_all_const_to_let: diag(95102, ts.DiagnosticCategory.Message, "Convert_all_const_to_let_95102", "Convert all 'const' to 'let'"), Convert_function_expression_0_to_arrow_function: diag(95105, ts.DiagnosticCategory.Message, "Convert_function_expression_0_to_arrow_function_95105", "Convert function expression '{0}' to arrow function"), Convert_function_declaration_0_to_arrow_function: diag(95106, ts.DiagnosticCategory.Message, "Convert_function_declaration_0_to_arrow_function_95106", "Convert function declaration '{0}' to arrow function"), Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"), @@ -10218,6 +10084,8 @@ var ts; Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"), Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"), Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"), + Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."), + Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."), No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."), Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."), JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"), @@ -10251,6 +10119,12 @@ var ts; _0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation: diag(18042, ts.DiagnosticCategory.Error, "_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation_18042", "'{0}' is a type and cannot be imported in JavaScript files. Use '{1}' in a JSDoc type annotation."), Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."), _0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."), + Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18045, ts.DiagnosticCategory.Error, "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045", "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."), + _0_is_of_type_unknown: diag(18046, ts.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."), + _0_is_possibly_null: diag(18047, ts.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."), + _0_is_possibly_undefined: diag(18048, ts.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."), + _0_is_possibly_null_or_undefined: diag(18049, ts.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."), + The_value_0_cannot_be_used_here: diag(18050, ts.DiagnosticCategory.Error, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."), }; })(ts || (ts = {})); var ts; @@ -10269,12 +10143,13 @@ var ts; /** @internal */ ts.textToKeywordObj = (_a = { abstract: 126 /* SyntaxKind.AbstractKeyword */, - any: 130 /* SyntaxKind.AnyKeyword */, - as: 127 /* SyntaxKind.AsKeyword */, - asserts: 128 /* SyntaxKind.AssertsKeyword */, - assert: 129 /* SyntaxKind.AssertKeyword */, - bigint: 158 /* SyntaxKind.BigIntKeyword */, - boolean: 133 /* SyntaxKind.BooleanKeyword */, + accessor: 127 /* SyntaxKind.AccessorKeyword */, + any: 131 /* SyntaxKind.AnyKeyword */, + as: 128 /* SyntaxKind.AsKeyword */, + asserts: 129 /* SyntaxKind.AssertsKeyword */, + assert: 130 /* SyntaxKind.AssertKeyword */, + bigint: 160 /* SyntaxKind.BigIntKeyword */, + boolean: 134 /* SyntaxKind.BooleanKeyword */, break: 81 /* SyntaxKind.BreakKeyword */, case: 82 /* SyntaxKind.CaseKeyword */, catch: 83 /* SyntaxKind.CatchKeyword */, @@ -10282,9 +10157,9 @@ var ts; continue: 86 /* SyntaxKind.ContinueKeyword */, const: 85 /* SyntaxKind.ConstKeyword */ }, - _a["" + "constructor"] = 134 /* SyntaxKind.ConstructorKeyword */, + _a["" + "constructor"] = 135 /* SyntaxKind.ConstructorKeyword */, _a.debugger = 87 /* SyntaxKind.DebuggerKeyword */, - _a.declare = 135 /* SyntaxKind.DeclareKeyword */, + _a.declare = 136 /* SyntaxKind.DeclareKeyword */, _a.default = 88 /* SyntaxKind.DefaultKeyword */, _a.delete = 89 /* SyntaxKind.DeleteKeyword */, _a.do = 90 /* SyntaxKind.DoKeyword */, @@ -10295,60 +10170,61 @@ var ts; _a.false = 95 /* SyntaxKind.FalseKeyword */, _a.finally = 96 /* SyntaxKind.FinallyKeyword */, _a.for = 97 /* SyntaxKind.ForKeyword */, - _a.from = 156 /* SyntaxKind.FromKeyword */, + _a.from = 158 /* SyntaxKind.FromKeyword */, _a.function = 98 /* SyntaxKind.FunctionKeyword */, - _a.get = 136 /* SyntaxKind.GetKeyword */, + _a.get = 137 /* SyntaxKind.GetKeyword */, _a.if = 99 /* SyntaxKind.IfKeyword */, _a.implements = 117 /* SyntaxKind.ImplementsKeyword */, _a.import = 100 /* SyntaxKind.ImportKeyword */, _a.in = 101 /* SyntaxKind.InKeyword */, - _a.infer = 137 /* SyntaxKind.InferKeyword */, + _a.infer = 138 /* SyntaxKind.InferKeyword */, _a.instanceof = 102 /* SyntaxKind.InstanceOfKeyword */, _a.interface = 118 /* SyntaxKind.InterfaceKeyword */, - _a.intrinsic = 138 /* SyntaxKind.IntrinsicKeyword */, - _a.is = 139 /* SyntaxKind.IsKeyword */, - _a.keyof = 140 /* SyntaxKind.KeyOfKeyword */, + _a.intrinsic = 139 /* SyntaxKind.IntrinsicKeyword */, + _a.is = 140 /* SyntaxKind.IsKeyword */, + _a.keyof = 141 /* SyntaxKind.KeyOfKeyword */, _a.let = 119 /* SyntaxKind.LetKeyword */, - _a.module = 141 /* SyntaxKind.ModuleKeyword */, - _a.namespace = 142 /* SyntaxKind.NamespaceKeyword */, - _a.never = 143 /* SyntaxKind.NeverKeyword */, + _a.module = 142 /* SyntaxKind.ModuleKeyword */, + _a.namespace = 143 /* SyntaxKind.NamespaceKeyword */, + _a.never = 144 /* SyntaxKind.NeverKeyword */, _a.new = 103 /* SyntaxKind.NewKeyword */, _a.null = 104 /* SyntaxKind.NullKeyword */, - _a.number = 147 /* SyntaxKind.NumberKeyword */, - _a.object = 148 /* SyntaxKind.ObjectKeyword */, + _a.number = 148 /* SyntaxKind.NumberKeyword */, + _a.object = 149 /* SyntaxKind.ObjectKeyword */, _a.package = 120 /* SyntaxKind.PackageKeyword */, _a.private = 121 /* SyntaxKind.PrivateKeyword */, _a.protected = 122 /* SyntaxKind.ProtectedKeyword */, _a.public = 123 /* SyntaxKind.PublicKeyword */, - _a.override = 159 /* SyntaxKind.OverrideKeyword */, - _a.out = 144 /* SyntaxKind.OutKeyword */, - _a.readonly = 145 /* SyntaxKind.ReadonlyKeyword */, - _a.require = 146 /* SyntaxKind.RequireKeyword */, - _a.global = 157 /* SyntaxKind.GlobalKeyword */, + _a.override = 161 /* SyntaxKind.OverrideKeyword */, + _a.out = 145 /* SyntaxKind.OutKeyword */, + _a.readonly = 146 /* SyntaxKind.ReadonlyKeyword */, + _a.require = 147 /* SyntaxKind.RequireKeyword */, + _a.global = 159 /* SyntaxKind.GlobalKeyword */, _a.return = 105 /* SyntaxKind.ReturnKeyword */, - _a.set = 149 /* SyntaxKind.SetKeyword */, + _a.satisfies = 150 /* SyntaxKind.SatisfiesKeyword */, + _a.set = 151 /* SyntaxKind.SetKeyword */, _a.static = 124 /* SyntaxKind.StaticKeyword */, - _a.string = 150 /* SyntaxKind.StringKeyword */, + _a.string = 152 /* SyntaxKind.StringKeyword */, _a.super = 106 /* SyntaxKind.SuperKeyword */, _a.switch = 107 /* SyntaxKind.SwitchKeyword */, - _a.symbol = 151 /* SyntaxKind.SymbolKeyword */, + _a.symbol = 153 /* SyntaxKind.SymbolKeyword */, _a.this = 108 /* SyntaxKind.ThisKeyword */, _a.throw = 109 /* SyntaxKind.ThrowKeyword */, _a.true = 110 /* SyntaxKind.TrueKeyword */, _a.try = 111 /* SyntaxKind.TryKeyword */, - _a.type = 152 /* SyntaxKind.TypeKeyword */, + _a.type = 154 /* SyntaxKind.TypeKeyword */, _a.typeof = 112 /* SyntaxKind.TypeOfKeyword */, - _a.undefined = 153 /* SyntaxKind.UndefinedKeyword */, - _a.unique = 154 /* SyntaxKind.UniqueKeyword */, - _a.unknown = 155 /* SyntaxKind.UnknownKeyword */, + _a.undefined = 155 /* SyntaxKind.UndefinedKeyword */, + _a.unique = 156 /* SyntaxKind.UniqueKeyword */, + _a.unknown = 157 /* SyntaxKind.UnknownKeyword */, _a.var = 113 /* SyntaxKind.VarKeyword */, _a.void = 114 /* SyntaxKind.VoidKeyword */, _a.while = 115 /* SyntaxKind.WhileKeyword */, _a.with = 116 /* SyntaxKind.WithKeyword */, _a.yield = 125 /* SyntaxKind.YieldKeyword */, - _a.async = 131 /* SyntaxKind.AsyncKeyword */, - _a.await = 132 /* SyntaxKind.AwaitKeyword */, - _a.of = 160 /* SyntaxKind.OfKeyword */, + _a.async = 132 /* SyntaxKind.AsyncKeyword */, + _a.await = 133 /* SyntaxKind.AwaitKeyword */, + _a.of = 162 /* SyntaxKind.OfKeyword */, _a); var textToKeyword = new ts.Map(ts.getEntries(ts.textToKeywordObj)); var textToToken = new ts.Map(ts.getEntries(__assign(__assign({}, ts.textToKeywordObj), { "{": 18 /* SyntaxKind.OpenBraceToken */, "}": 19 /* SyntaxKind.CloseBraceToken */, "(": 20 /* SyntaxKind.OpenParenToken */, ")": 21 /* SyntaxKind.CloseParenToken */, "[": 22 /* SyntaxKind.OpenBracketToken */, "]": 23 /* SyntaxKind.CloseBracketToken */, ".": 24 /* SyntaxKind.DotToken */, "...": 25 /* SyntaxKind.DotDotDotToken */, ";": 26 /* SyntaxKind.SemicolonToken */, ",": 27 /* SyntaxKind.CommaToken */, "<": 29 /* SyntaxKind.LessThanToken */, ">": 31 /* SyntaxKind.GreaterThanToken */, "<=": 32 /* SyntaxKind.LessThanEqualsToken */, ">=": 33 /* SyntaxKind.GreaterThanEqualsToken */, "==": 34 /* SyntaxKind.EqualsEqualsToken */, "!=": 35 /* SyntaxKind.ExclamationEqualsToken */, "===": 36 /* SyntaxKind.EqualsEqualsEqualsToken */, "!==": 37 /* SyntaxKind.ExclamationEqualsEqualsToken */, "=>": 38 /* SyntaxKind.EqualsGreaterThanToken */, "+": 39 /* SyntaxKind.PlusToken */, "-": 40 /* SyntaxKind.MinusToken */, "**": 42 /* SyntaxKind.AsteriskAsteriskToken */, "*": 41 /* SyntaxKind.AsteriskToken */, "/": 43 /* SyntaxKind.SlashToken */, "%": 44 /* SyntaxKind.PercentToken */, "++": 45 /* SyntaxKind.PlusPlusToken */, "--": 46 /* SyntaxKind.MinusMinusToken */, "<<": 47 /* SyntaxKind.LessThanLessThanToken */, ">": 48 /* SyntaxKind.GreaterThanGreaterThanToken */, ">>>": 49 /* SyntaxKind.GreaterThanGreaterThanGreaterThanToken */, "&": 50 /* SyntaxKind.AmpersandToken */, "|": 51 /* SyntaxKind.BarToken */, "^": 52 /* SyntaxKind.CaretToken */, "!": 53 /* SyntaxKind.ExclamationToken */, "~": 54 /* SyntaxKind.TildeToken */, "&&": 55 /* SyntaxKind.AmpersandAmpersandToken */, "||": 56 /* SyntaxKind.BarBarToken */, "?": 57 /* SyntaxKind.QuestionToken */, "??": 60 /* SyntaxKind.QuestionQuestionToken */, "?.": 28 /* SyntaxKind.QuestionDotToken */, ":": 58 /* SyntaxKind.ColonToken */, "=": 63 /* SyntaxKind.EqualsToken */, "+=": 64 /* SyntaxKind.PlusEqualsToken */, "-=": 65 /* SyntaxKind.MinusEqualsToken */, "*=": 66 /* SyntaxKind.AsteriskEqualsToken */, "**=": 67 /* SyntaxKind.AsteriskAsteriskEqualsToken */, "/=": 68 /* SyntaxKind.SlashEqualsToken */, "%=": 69 /* SyntaxKind.PercentEqualsToken */, "<<=": 70 /* SyntaxKind.LessThanLessThanEqualsToken */, ">>=": 71 /* SyntaxKind.GreaterThanGreaterThanEqualsToken */, ">>>=": 72 /* SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 73 /* SyntaxKind.AmpersandEqualsToken */, "|=": 74 /* SyntaxKind.BarEqualsToken */, "^=": 78 /* SyntaxKind.CaretEqualsToken */, "||=": 75 /* SyntaxKind.BarBarEqualsToken */, "&&=": 76 /* SyntaxKind.AmpersandAmpersandEqualsToken */, "??=": 77 /* SyntaxKind.QuestionQuestionEqualsToken */, "@": 59 /* SyntaxKind.AtToken */, "#": 62 /* SyntaxKind.HashToken */, "`": 61 /* SyntaxKind.BacktickToken */ }))); @@ -10471,7 +10347,7 @@ var ts; ts.stringToToken = stringToToken; /* @internal */ function computeLineStarts(text) { - var result = new Array(); + var result = []; var pos = 0; var lineStart = 0; while (pos < text.length) { @@ -11497,7 +11373,7 @@ var ts; return -1; } function peekExtendedUnicodeEscape() { - if (languageVersion >= 2 /* ScriptTarget.ES2015 */ && codePointAt(text, pos + 1) === 117 /* CharacterCodes.u */ && codePointAt(text, pos + 2) === 123 /* CharacterCodes.openBrace */) { + if (codePointAt(text, pos + 1) === 117 /* CharacterCodes.u */ && codePointAt(text, pos + 2) === 123 /* CharacterCodes.openBrace */) { var start_2 = pos; pos += 3; var escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false); @@ -12032,12 +11908,36 @@ var ts; pos++; return token = 0 /* SyntaxKind.Unknown */; } - if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) { + var charAfterHash = codePointAt(text, pos + 1); + if (charAfterHash === 92 /* CharacterCodes.backslash */) { + pos++; + var extendedCookedChar_1 = peekExtendedUnicodeEscape(); + if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) { + pos += 3; + tokenFlags |= 8 /* TokenFlags.ExtendedUnicodeEscape */; + tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + var cookedChar_1 = peekUnicodeEscape(); + if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) { + pos += 6; + tokenFlags |= 1024 /* TokenFlags.UnicodeEscape */; + tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + pos--; + } + if (isIdentifierStart(charAfterHash, languageVersion)) { pos++; - scanIdentifier(codePointAt(text, pos), languageVersion); + // We're relying on scanIdentifier's behavior and adjusting the token kind after the fact. + // Notably absent from this block is the fact that calling a function named "scanIdentifier", + // but identifiers don't include '#', and that function doesn't deal with it at all. + // This works because 'scanIdentifier' tries to reuse source characters and builds up substrings; + // however, it starts at the 'tokenPos' which includes the '#', and will "accidentally" prepend the '#' for us. + scanIdentifier(charAfterHash, languageVersion); } else { - tokenValue = String.fromCharCode(codePointAt(text, pos)); + tokenValue = "#"; error(ts.Diagnostics.Invalid_character, pos++, charSize(ch)); } return token = 80 /* SyntaxKind.PrivateIdentifier */; @@ -12788,9 +12688,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 163 /* SyntaxKind.TypeParameter */) { + if (d && d.kind === 165 /* SyntaxKind.TypeParameter */) { for (var current = d; current; current = current.parent) { - if (isFunctionLike(current) || isClassLike(current) || current.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (isFunctionLike(current) || isClassLike(current) || current.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return current; } } @@ -12798,7 +12698,7 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node, parent) { - return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 171 /* SyntaxKind.Constructor */; + return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 173 /* SyntaxKind.Constructor */; } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function isEmptyBindingPattern(node) { @@ -12828,14 +12728,14 @@ var ts; node = walkUpBindingElementsAndPatterns(node); } var flags = getFlags(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node && node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { flags |= getFlags(node); node = node.parent; } - if (node && node.kind === 237 /* SyntaxKind.VariableStatement */) { + if (node && node.kind === 240 /* SyntaxKind.VariableStatement */) { flags |= getFlags(node); } return flags; @@ -13008,30 +12908,30 @@ var ts; } // Covers remaining cases (returning undefined if none match). switch (hostNode.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: var expr = hostNode.expression; - if (expr.kind === 221 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (expr.kind === 223 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { expr = expr.left; } switch (expr.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return expr.name; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; } } break; - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { return getDeclarationIdentifier(hostNode.expression); } - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { if (isDeclaration(hostNode.statement) || isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -13068,16 +12968,16 @@ var ts; switch (declaration.kind) { case 79 /* SyntaxKind.Identifier */: return declaration; - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: { var name = declaration.name; - if (name.kind === 161 /* SyntaxKind.QualifiedName */) { + if (name.kind === 163 /* SyntaxKind.QualifiedName */) { return name.right; } break; } - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var expr_1 = declaration; switch (ts.getAssignmentDeclarationKind(expr_1)) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -13093,15 +12993,15 @@ var ts; return undefined; } } - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); - case 339 /* SyntaxKind.JSDocEnumTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return nameForNamelessJSDocTypedef(declaration); - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = declaration; if (ts.isBindableStaticElementAccessExpression(expr)) { return expr.argumentExpression; @@ -13145,7 +13045,7 @@ var ts; } ts.getDecorators = getDecorators; function getModifiers(node) { - if (ts.hasSyntacticModifier(node, 125951 /* ModifierFlags.Modifier */)) { + if (ts.hasSyntacticModifier(node, 126975 /* ModifierFlags.Modifier */)) { return ts.filter(node.modifiers, isModifier); } } @@ -13406,12 +13306,12 @@ var ts; /** Gets the text of a jsdoc comment, flattening links to their text. */ function getTextOfJSDocComment(comment) { return typeof comment === "string" ? comment - : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 321 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); + : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 324 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); } ts.getTextOfJSDocComment = getTextOfJSDocComment; function formatJSDocLink(link) { - var kind = link.kind === 324 /* SyntaxKind.JSDocLink */ ? "link" - : link.kind === 325 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" + var kind = link.kind === 327 /* SyntaxKind.JSDocLink */ ? "link" + : link.kind === 328 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" : "linkplain"; var name = link.name ? ts.entityNameToString(link.name) : ""; var space = link.name && link.text.startsWith("://") ? "" : " "; @@ -13432,7 +13332,7 @@ var ts; return ts.emptyArray; } if (ts.isJSDocTypeAlias(node)) { - ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDoc */); + ts.Debug.assert(node.parent.kind === 323 /* SyntaxKind.JSDoc */); return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; }); } if (node.typeParameters) { @@ -13467,7 +13367,7 @@ var ts; ts.isMemberName = isMemberName; /* @internal */ function isGetOrSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */ || node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */ || node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration; function isPropertyAccessChain(node) { @@ -13485,10 +13385,10 @@ var ts; function isOptionalChain(node) { var kind = node.kind; return !!(node.flags & 32 /* NodeFlags.OptionalChain */) && - (kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 207 /* SyntaxKind.ElementAccessExpression */ - || kind === 208 /* SyntaxKind.CallExpression */ - || kind === 230 /* SyntaxKind.NonNullExpression */); + (kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 209 /* SyntaxKind.ElementAccessExpression */ + || kind === 210 /* SyntaxKind.CallExpression */ + || kind === 232 /* SyntaxKind.NonNullExpression */); } ts.isOptionalChain = isOptionalChain; /* @internal */ @@ -13523,7 +13423,7 @@ var ts; } ts.isOutermostOptionalChain = isOutermostOptionalChain; function isNullishCoalesce(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; } ts.isNullishCoalesce = isNullishCoalesce; function isConstTypeReference(node) { @@ -13540,17 +13440,17 @@ var ts; } ts.isNonNullChain = isNonNullChain; function isBreakOrContinueStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */ || node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */ || node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isNamedExportBindings(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExportBindings = isNamedExportBindings; function isUnparsedTextLike(node) { switch (node.kind) { - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return true; default: return false; @@ -13559,12 +13459,12 @@ var ts; ts.isUnparsedTextLike = isUnparsedTextLike; function isUnparsedNode(node) { return isUnparsedTextLike(node) || - node.kind === 300 /* SyntaxKind.UnparsedPrologue */ || - node.kind === 304 /* SyntaxKind.UnparsedSyntheticReference */; + node.kind === 303 /* SyntaxKind.UnparsedPrologue */ || + node.kind === 307 /* SyntaxKind.UnparsedSyntheticReference */; } ts.isUnparsedNode = isUnparsedNode; function isJSDocPropertyLikeTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; // #endregion @@ -13580,7 +13480,7 @@ var ts; ts.isNode = isNode; /* @internal */ function isNodeKind(kind) { - return kind >= 161 /* SyntaxKind.FirstNode */; + return kind >= 163 /* SyntaxKind.FirstNode */; } ts.isNodeKind = isNodeKind; /** @@ -13589,7 +13489,7 @@ var ts; * Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail. */ function isTokenKind(kind) { - return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */; + return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 162 /* SyntaxKind.LastToken */; } ts.isTokenKind = isTokenKind; /** @@ -13604,7 +13504,7 @@ var ts; // Node Arrays /* @internal */ function isNodeArray(array) { - return array.hasOwnProperty("pos") && array.hasOwnProperty("end"); + return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end"); } ts.isNodeArray = isNodeArray; // Literals @@ -13620,11 +13520,11 @@ var ts; /** @internal */ function isLiteralExpressionOfObject(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; } return false; @@ -13652,13 +13552,13 @@ var ts; ts.isImportOrExportSpecifier = isImportOrExportSpecifier; function isTypeOnlyImportOrExportDeclaration(node) { switch (node.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return node.isTypeOnly || node.parent.parent.isTypeOnly; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.isTypeOnly; - case 267 /* SyntaxKind.ImportClause */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.isTypeOnly; default: return false; @@ -13679,6 +13579,11 @@ var ts; return ts.isIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; } ts.isGeneratedIdentifier = isGeneratedIdentifier; + /* @internal */ + function isGeneratedPrivateIdentifier(node) { + return ts.isPrivateIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; + } + ts.isGeneratedPrivateIdentifier = isGeneratedPrivateIdentifier; // Private Identifiers /*@internal*/ function isPrivateIdentifierClassElementDeclaration(node) { @@ -13695,19 +13600,20 @@ var ts; function isModifierKind(token) { switch (token) { case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 101 /* SyntaxKind.InKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; } return false; @@ -13720,7 +13626,10 @@ var ts; ts.isParameterPropertyModifier = isParameterPropertyModifier; /* @internal */ function isClassMemberModifier(idToken) { - return isParameterPropertyModifier(idToken) || idToken === 124 /* SyntaxKind.StaticKeyword */ || idToken === 159 /* SyntaxKind.OverrideKeyword */; + return isParameterPropertyModifier(idToken) || + idToken === 124 /* SyntaxKind.StaticKeyword */ || + idToken === 161 /* SyntaxKind.OverrideKeyword */ || + idToken === 127 /* SyntaxKind.AccessorKeyword */; } ts.isClassMemberModifier = isClassMemberModifier; function isModifier(node) { @@ -13729,7 +13638,7 @@ var ts; ts.isModifier = isModifier; function isEntityName(node) { var kind = node.kind; - return kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isEntityName = isEntityName; @@ -13739,14 +13648,14 @@ var ts; || kind === 80 /* SyntaxKind.PrivateIdentifier */ || kind === 10 /* SyntaxKind.StringLiteral */ || kind === 8 /* SyntaxKind.NumericLiteral */ - || kind === 162 /* SyntaxKind.ComputedPropertyName */; + || kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isPropertyName = isPropertyName; function isBindingName(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */ - || kind === 202 /* SyntaxKind.ArrayBindingPattern */; + || kind === 203 /* SyntaxKind.ObjectBindingPattern */ + || kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Functions @@ -13771,13 +13680,13 @@ var ts; ts.isBooleanLiteral = isBooleanLiteral; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -13786,14 +13695,14 @@ var ts; /* @internal */ function isFunctionLikeKind(kind) { switch (kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; default: return isFunctionLikeDeclarationKind(kind); @@ -13808,36 +13717,53 @@ var ts; // Classes function isClassElement(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 234 /* SyntaxKind.SemicolonClassElement */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */); + return node && (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isClassLike = isClassLike; function isAccessor(node) { - return node && (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */); + return node && (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */); } ts.isAccessor = isAccessor; + function isAutoAccessorPropertyDeclaration(node) { + return ts.isPropertyDeclaration(node) && ts.hasAccessorModifier(node); + } + ts.isAutoAccessorPropertyDeclaration = isAutoAccessorPropertyDeclaration; /* @internal */ function isMethodOrAccessor(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; } } ts.isMethodOrAccessor = isMethodOrAccessor; + /* @internal */ + function isNamedClassElement(node) { + switch (node.kind) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return true; + default: + return false; + } + } + ts.isNamedClassElement = isNamedClassElement; // Type members function isModifierLike(node) { return isModifier(node) || ts.isDecorator(node); @@ -13845,13 +13771,13 @@ var ts; ts.isModifierLike = isModifierLike; function isTypeElement(node) { var kind = node.kind; - return kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 174 /* SyntaxKind.CallSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 176 /* SyntaxKind.CallSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isTypeElement = isTypeElement; function isClassOrTypeElement(node) { @@ -13860,12 +13786,12 @@ var ts; ts.isClassOrTypeElement = isClassOrTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 298 /* SyntaxKind.SpreadAssignment */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 301 /* SyntaxKind.SpreadAssignment */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type @@ -13880,8 +13806,8 @@ var ts; ts.isTypeNode = isTypeNode; function isFunctionOrConstructorTypeNode(node) { switch (node.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; } return false; @@ -13892,8 +13818,8 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 202 /* SyntaxKind.ArrayBindingPattern */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return kind === 204 /* SyntaxKind.ArrayBindingPattern */ + || kind === 203 /* SyntaxKind.ObjectBindingPattern */; } return false; } @@ -13901,15 +13827,15 @@ var ts; /* @internal */ function isAssignmentPattern(node) { var kind = node.kind; - return kind === 204 /* SyntaxKind.ArrayLiteralExpression */ - || kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return kind === 206 /* SyntaxKind.ArrayLiteralExpression */ + || kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; /* @internal */ function isArrayBindingElement(node) { var kind = node.kind; - return kind === 203 /* SyntaxKind.BindingElement */ - || kind === 227 /* SyntaxKind.OmittedExpression */; + return kind === 205 /* SyntaxKind.BindingElement */ + || kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -13918,9 +13844,9 @@ var ts; /* @internal */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: return true; } return false; @@ -13941,8 +13867,8 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return true; } return false; @@ -13951,10 +13877,10 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentElement(node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty - case 298 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty + case 301 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty return true; } return false; @@ -13966,8 +13892,8 @@ var ts; /* @internal */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; } return false; @@ -13976,26 +13902,26 @@ var ts; /* @internal */ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */ - || kind === 200 /* SyntaxKind.ImportType */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */ + || kind === 202 /* SyntaxKind.ImportType */; } ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; // Expression function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: return true; default: return false; @@ -14003,12 +13929,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */ || node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */ || node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 223 /* SyntaxKind.TemplateExpression */ + return kind === 225 /* SyntaxKind.TemplateExpression */ || kind === 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; @@ -14019,19 +13945,19 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: // technically this is only an Expression if it's in a `#field in expr` BinaryExpression case 13 /* SyntaxKind.RegularExpressionLiteral */: @@ -14039,15 +13965,15 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 230 /* SyntaxKind.NonNullExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 231 /* SyntaxKind.MetaProperty */: + case 232 /* SyntaxKind.NonNullExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 233 /* SyntaxKind.MetaProperty */: case 100 /* SyntaxKind.ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: @@ -14061,13 +13987,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return true; default: return isLeftHandSideExpressionKind(kind); @@ -14076,9 +14002,9 @@ var ts; /* @internal */ function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; default: @@ -14097,15 +14023,16 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 221 /* SyntaxKind.BinaryExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 229 /* SyntaxKind.AsExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 223 /* SyntaxKind.BinaryExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 231 /* SyntaxKind.AsExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -14113,8 +14040,8 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 211 /* SyntaxKind.TypeAssertionExpression */ - || kind === 229 /* SyntaxKind.AsExpression */; + return kind === 213 /* SyntaxKind.TypeAssertionExpression */ + || kind === 231 /* SyntaxKind.AsExpression */; } ts.isAssertionExpression = isAssertionExpression; /* @internal */ @@ -14125,13 +14052,13 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -14160,7 +14087,7 @@ var ts; ts.isExternalModuleIndicator = isExternalModuleIndicator; /* @internal */ function isForInOrOfStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */ || node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */ || node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForInOrOfStatement = isForInOrOfStatement; // Element @@ -14184,115 +14111,115 @@ var ts; /* @internal */ function isModuleBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleBody = isModuleBody; /* @internal */ function isNamespaceBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isNamespaceBody = isNamespaceBody; /* @internal */ function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; /* @internal */ function isNamedImportBindings(node) { var kind = node.kind; - return kind === 269 /* SyntaxKind.NamedImports */ - || kind === 268 /* SyntaxKind.NamespaceImport */; + return kind === 272 /* SyntaxKind.NamedImports */ + || kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; /* @internal */ function isModuleOrEnumDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 203 /* SyntaxKind.BindingElement */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 299 /* SyntaxKind.EnumMember */ - || kind === 275 /* SyntaxKind.ExportSpecifier */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 267 /* SyntaxKind.ImportClause */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 270 /* SyntaxKind.ImportSpecifier */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 268 /* SyntaxKind.NamespaceImport */ - || kind === 274 /* SyntaxKind.NamespaceExport */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 254 /* SyntaxKind.VariableDeclaration */ - || kind === 345 /* SyntaxKind.JSDocTypedefTag */ - || kind === 338 /* SyntaxKind.JSDocCallbackTag */ - || kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 205 /* SyntaxKind.BindingElement */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 302 /* SyntaxKind.EnumMember */ + || kind === 278 /* SyntaxKind.ExportSpecifier */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 270 /* SyntaxKind.ImportClause */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 273 /* SyntaxKind.ImportSpecifier */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 271 /* SyntaxKind.NamespaceImport */ + || kind === 277 /* SyntaxKind.NamespaceExport */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 257 /* SyntaxKind.VariableDeclaration */ + || kind === 348 /* SyntaxKind.JSDocTypedefTag */ + || kind === 341 /* SyntaxKind.JSDocCallbackTag */ + || kind === 350 /* SyntaxKind.JSDocPropertyTag */; } function isDeclarationStatementKind(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 236 /* SyntaxKind.EmptyStatement */ - || kind === 243 /* SyntaxKind.ForInStatement */ - || kind === 244 /* SyntaxKind.ForOfStatement */ - || kind === 242 /* SyntaxKind.ForStatement */ - || kind === 239 /* SyntaxKind.IfStatement */ - || kind === 250 /* SyntaxKind.LabeledStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 249 /* SyntaxKind.SwitchStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 252 /* SyntaxKind.TryStatement */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 241 /* SyntaxKind.WhileStatement */ - || kind === 248 /* SyntaxKind.WithStatement */ - || kind === 349 /* SyntaxKind.NotEmittedStatement */ - || kind === 353 /* SyntaxKind.EndOfDeclarationMarker */ - || kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 239 /* SyntaxKind.EmptyStatement */ + || kind === 246 /* SyntaxKind.ForInStatement */ + || kind === 247 /* SyntaxKind.ForOfStatement */ + || kind === 245 /* SyntaxKind.ForStatement */ + || kind === 242 /* SyntaxKind.IfStatement */ + || kind === 253 /* SyntaxKind.LabeledStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 252 /* SyntaxKind.SwitchStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 255 /* SyntaxKind.TryStatement */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 244 /* SyntaxKind.WhileStatement */ + || kind === 251 /* SyntaxKind.WithStatement */ + || kind === 352 /* SyntaxKind.NotEmittedStatement */ + || kind === 356 /* SyntaxKind.EndOfDeclarationMarker */ + || kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { - return (node.parent && node.parent.kind !== 344 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { + return (node.parent && node.parent.kind !== 347 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); } return isDeclarationKind(node.kind); } @@ -14319,10 +14246,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 235 /* SyntaxKind.Block */) + if (node.kind !== 238 /* SyntaxKind.Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 252 /* SyntaxKind.TryStatement */ || node.parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (node.parent.kind === 255 /* SyntaxKind.TryStatement */ || node.parent.kind === 295 /* SyntaxKind.CatchClause */) { return false; } } @@ -14336,15 +14263,15 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 235 /* SyntaxKind.Block */; + || kind === 238 /* SyntaxKind.Block */; } ts.isStatementOrBlock = isStatementOrBlock; // Module references /* @internal */ function isModuleReference(node) { var kind = node.kind; - return kind === 277 /* SyntaxKind.ExternalModuleReference */ - || kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 280 /* SyntaxKind.ExternalModuleReference */ + || kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleReference = isModuleReference; @@ -14354,58 +14281,58 @@ var ts; var kind = node.kind; return kind === 108 /* SyntaxKind.ThisKeyword */ || kind === 79 /* SyntaxKind.Identifier */ - || kind === 206 /* SyntaxKind.PropertyAccessExpression */; + || kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; /* @internal */ function isJsxChild(node) { var kind = node.kind; - return kind === 278 /* SyntaxKind.JsxElement */ - || kind === 288 /* SyntaxKind.JsxExpression */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */ + return kind === 281 /* SyntaxKind.JsxElement */ + || kind === 291 /* SyntaxKind.JsxExpression */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || kind === 11 /* SyntaxKind.JsxText */ - || kind === 282 /* SyntaxKind.JsxFragment */; + || kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 10 /* SyntaxKind.StringLiteral */ - || kind === 288 /* SyntaxKind.JsxExpression */; + || kind === 291 /* SyntaxKind.JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 280 /* SyntaxKind.JsxOpeningElement */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return kind === 283 /* SyntaxKind.JsxOpeningElement */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 289 /* SyntaxKind.CaseClause */ - || kind === 290 /* SyntaxKind.DefaultClause */; + return kind === 292 /* SyntaxKind.CaseClause */ + || kind === 293 /* SyntaxKind.DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 309 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocNode */; + return node.kind >= 312 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */ - || node.kind === 319 /* SyntaxKind.JSDocNamepathType */ - || node.kind === 321 /* SyntaxKind.JSDocText */ + return node.kind === 323 /* SyntaxKind.JSDoc */ + || node.kind === 322 /* SyntaxKind.JSDocNamepathType */ + || node.kind === 324 /* SyntaxKind.JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) @@ -14415,15 +14342,15 @@ var ts; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 327 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocTagNode */; + return node.kind >= 330 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessor = isSetAccessor; function isGetAccessor(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessor = isGetAccessor; /** True if has jsdoc nodes attached to it. */ @@ -14449,12 +14376,12 @@ var ts; /** True if has initializer node attached to it. */ function hasOnlyExpressionInitializer(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: return true; default: return false; @@ -14462,12 +14389,12 @@ var ts; } ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */ || node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); + return node.kind === 288 /* SyntaxKind.JsxAttribute */ || node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); } ts.isObjectLiteralElement = isObjectLiteralElement; /* @internal */ function isTypeReferenceType(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -14500,7 +14427,7 @@ var ts; } ts.isStringLiteralLike = isStringLiteralLike; function isJSDocLinkLike(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */ || node.kind === 325 /* SyntaxKind.JSDocLinkCode */ || node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 327 /* SyntaxKind.JSDocLink */ || node.kind === 328 /* SyntaxKind.JSDocLinkCode */ || node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkLike = isJSDocLinkLike; function hasRestParameter(s) { @@ -14510,7 +14437,7 @@ var ts; ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type; - return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.dotDotDotToken !== undefined || !!type && type.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isRestParameter = isRestParameter; // #endregion @@ -14768,7 +14695,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 305 /* SyntaxKind.SourceFile */) { + while (node && node.kind !== 308 /* SyntaxKind.SourceFile */) { node = node.parent; } return node; @@ -14784,11 +14711,11 @@ var ts; ts.isPlainJsFile = isPlainJsFile; function isStatementWithLocals(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return true; } return false; @@ -14984,7 +14911,7 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 348 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { + if (node.kind === 351 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, @@ -15049,7 +14976,6 @@ var ts; return emitNode && emitNode.flags || 0; } ts.getEmitFlags = getEmitFlags; - ; function getScriptTargetFeatures() { return { es2015: { @@ -15222,7 +15148,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -15254,11 +15180,11 @@ var ts; ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return !!node && node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && (!node.body); + return !!node && node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || + return node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || ts.isFunctionLikeOrClassStaticBlockDeclaration(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -15275,9 +15201,9 @@ var ts; // - defined in the top level scope and source file is an external module // - defined inside ambient module declaration located in the top level scope and source file not an external module switch (node.parent.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node.parent); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -15332,26 +15258,30 @@ var ts; return false; } ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile; + function isAmbientPropertyDeclaration(node) { + return !!(node.flags & 16777216 /* NodeFlags.Ambient */) || hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); + } + ts.isAmbientPropertyDeclaration = isAmbientPropertyDeclaration; function isBlockScope(node, parentNode) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 292 /* SyntaxKind.CatchClause */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return !ts.isFunctionLikeOrClassStaticBlockDeclaration(parentNode); @@ -15361,9 +15291,9 @@ var ts; ts.isBlockScope = isBlockScope; function isDeclarationWithTypeParameters(node) { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 323 /* SyntaxKind.JSDocSignature */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 326 /* SyntaxKind.JSDocSignature */: return true; default: ts.assertType(node); @@ -15373,25 +15303,25 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isDeclarationWithTypeParameterChildren(node) { switch (node.kind) { - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: ts.assertType(node); @@ -15401,8 +15331,8 @@ var ts; ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren; function isAnyImportSyntax(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -15415,15 +15345,15 @@ var ts; ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire; function isLateVisibilityPaintedStatement(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return true; default: return false; @@ -15464,19 +15394,19 @@ var ts; } ts.getNameFromIndexInfo = getNameFromIndexInfo; function isComputedNonLiteralName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); } ts.isComputedNonLiteralName = isComputedNonLiteralName; function tryGetTextOfPropertyName(name) { switch (name.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - return name.escapedText; + return name.autoGenerateFlags ? undefined : name.escapedText; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: if (isStringOrNumericLiteralLike(name.expression)) return ts.escapeLeadingUnderscores(name.expression.text); return undefined; @@ -15496,16 +15426,16 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: case 79 /* SyntaxKind.Identifier */: return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (ts.isIdentifier(name.name) || ts.isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { return ts.Debug.assertNever(name.name); } - case 311 /* SyntaxKind.JSDocMemberName */: + case 314 /* SyntaxKind.JSDocMemberName */: return entityNameToString(name.left) + entityNameToString(name.right); default: return ts.Debug.assertNever(name); @@ -15595,7 +15525,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body && node.body.kind === 238 /* SyntaxKind.Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -15609,7 +15539,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -15618,29 +15548,29 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 268 /* SyntaxKind.NamespaceImport */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 271 /* SyntaxKind.NamespaceImport */: errorNode = node.name; break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: var start = ts.skipTrivia(sourceFile.text, node.pos); var end = node.statements.length > 0 ? node.statements[0].pos : node.end; return ts.createTextSpanFromBounds(start, end); @@ -15692,11 +15622,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; } ts.isImportCall = isImportCall; function isImportMeta(n) { @@ -15710,7 +15640,7 @@ var ts; } ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */ + return node.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.expression.kind === 10 /* SyntaxKind.StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -15738,13 +15668,13 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 164 /* SyntaxKind.Parameter */ || - node.kind === 163 /* SyntaxKind.TypeParameter */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 214 /* SyntaxKind.ArrowFunction */ || - node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */) ? + var commentRanges = (node.kind === 166 /* SyntaxKind.Parameter */ || + node.kind === 165 /* SyntaxKind.TypeParameter */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 216 /* SyntaxKind.ArrowFunction */ || + node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); // True if the comment starts with '/**' but not if it is '/**/' @@ -15760,48 +15690,48 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (177 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return true; case 114 /* SyntaxKind.VoidKeyword */: - return node.parent.kind !== 217 /* SyntaxKind.VoidExpression */; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + return node.parent.kind !== 219 /* SyntaxKind.VoidExpression */; + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 163 /* SyntaxKind.TypeParameter */: - return node.parent.kind === 195 /* SyntaxKind.MappedType */ || node.parent.kind === 190 /* SyntaxKind.InferType */; + case 165 /* SyntaxKind.TypeParameter */: + return node.parent.kind === 197 /* SyntaxKind.MappedType */ || node.parent.kind === 192 /* SyntaxKind.InferType */; // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case 79 /* SyntaxKind.Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); // falls through - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 108 /* SyntaxKind.ThisKeyword */: { var parent = node.parent; - if (parent.kind === 181 /* SyntaxKind.TypeQuery */) { + if (parent.kind === 183 /* SyntaxKind.TypeQuery */) { return false; } - if (parent.kind === 200 /* SyntaxKind.ImportType */) { + if (parent.kind === 202 /* SyntaxKind.ImportType */) { return !parent.isTypeOf; } // Do not recursively call isPartOfTypeNode on the parent. In the example: @@ -15810,40 +15740,40 @@ var ts; // // Calling isPartOfTypeNode would consider the qualified name A.B a type node. // Only C and A.B.C are type nodes. - if (177 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (parent.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent); - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return node === parent.constraint; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return node === parent.constraint; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return node === parent.type; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return node === parent.type; - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return node === parent.type; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return node === parent.type; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.contains(parent.typeArguments, node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -15868,23 +15798,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitor(node); - case 263 /* SyntaxKind.CaseBlock */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 266 /* SyntaxKind.CaseBlock */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return ts.forEachChild(node, traverse); } } @@ -15894,23 +15824,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, skip them to avoid the work. return; default: if (ts.isFunctionLike(node)) { - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. traverse(node.name.expression); @@ -15933,10 +15863,10 @@ var ts; * @param node The type node. */ function getRestParameterElementType(node) { - if (node && node.kind === 183 /* SyntaxKind.ArrayType */) { + if (node && node.kind === 185 /* SyntaxKind.ArrayType */) { return node.elementType; } - else if (node && node.kind === 178 /* SyntaxKind.TypeReference */) { + else if (node && node.kind === 180 /* SyntaxKind.TypeReference */) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -15946,12 +15876,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 182 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 184 /* SyntaxKind.TypeLiteral */: return node.members; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return node.properties; } } @@ -15959,14 +15889,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 299 /* SyntaxKind.EnumMember */: - case 164 /* SyntaxKind.Parameter */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 302 /* SyntaxKind.EnumMember */: + case 166 /* SyntaxKind.Parameter */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } } @@ -15978,8 +15908,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ - && node.parent.parent.kind === 237 /* SyntaxKind.VariableStatement */; + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ + && node.parent.parent.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isCommonJsExportedExpression(node) { @@ -16003,13 +15933,13 @@ var ts; ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return true; } return false; @@ -16020,7 +15950,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 250 /* SyntaxKind.LabeledStatement */) { + if (node.statement.kind !== 253 /* SyntaxKind.LabeledStatement */) { return node.statement; } node = node.statement; @@ -16028,17 +15958,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); + return node && node.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethodOrAccessor(node) { - return (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) && - (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || - node.parent.kind === 226 /* SyntaxKind.ClassExpression */); + return (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) && + (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || + node.parent.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethodOrAccessor = isObjectLiteralOrClassExpressionMethodOrAccessor; function isIdentifierTypePredicate(predicate) { @@ -16051,7 +15981,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return objectLiteral.properties.filter(function (property) { - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */) { var propName = tryGetTextOfPropertyName(property.name); return key === propName || (!!key2 && key2 === propName); } @@ -16113,14 +16043,14 @@ var ts; } ts.getContainingFunctionOrClassStaticBlock = getContainingFunctionOrClassStaticBlock; function getThisContainer(node, includeArrowFunctions) { - ts.Debug.assert(node.kind !== 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(node.kind !== 308 /* SyntaxKind.SourceFile */); while (true) { node = node.parent; if (!node) { return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that. } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -16135,9 +16065,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -16148,27 +16078,27 @@ var ts; node = node.parent; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (!includeArrowFunctions) { continue; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 305 /* SyntaxKind.SourceFile */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 308 /* SyntaxKind.SourceFile */: return node; } } @@ -16181,17 +16111,17 @@ var ts; switch (node.kind) { // Arrow functions use the same scope, but may do so in a "delayed" manner // For example, `const getThis = () => this` may be before a super() call in a derived constructor - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Object properties can have computed names; only method-like bodies start a new scope return true; default: @@ -16215,9 +16145,9 @@ var ts; var container = getThisContainer(node, /*includeArrowFunctions*/ false); if (container) { switch (container.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return container; } } @@ -16239,28 +16169,28 @@ var ts; return node; } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: node = node.parent; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (!stopOnFunctions) { continue; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return node; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -16276,14 +16206,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 213 /* SyntaxKind.FunctionExpression */ || func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 215 /* SyntaxKind.FunctionExpression */ || func.kind === 216 /* SyntaxKind.ArrowFunction */) { var prev = func; var parent = func.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { prev = parent; parent = parent.parent; } - if (parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === prev) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === prev) { return parent; } } @@ -16299,7 +16229,7 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperProperty = isSuperProperty; @@ -16308,7 +16238,7 @@ var ts; */ function isThisProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 108 /* SyntaxKind.ThisKeyword */; } ts.isThisProperty = isThisProperty; @@ -16327,15 +16257,15 @@ var ts; ts.isThisInitializedObjectBindingExpression = isThisInitializedObjectBindingExpression; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return node; } return undefined; @@ -16343,10 +16273,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return node.tag; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return node.tagName; default: return node.expression; @@ -16359,25 +16289,25 @@ var ts; return false; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // classes are valid targets return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + return parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 164 /* SyntaxKind.Parameter */: + && parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 166 /* SyntaxKind.Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; return parent.body !== undefined - && (parent.kind === 171 /* SyntaxKind.Constructor */ - || parent.kind === 169 /* SyntaxKind.MethodDeclaration */ - || parent.kind === 173 /* SyntaxKind.SetAccessor */) - && grandparent.kind === 257 /* SyntaxKind.ClassDeclaration */; + && (parent.kind === 173 /* SyntaxKind.Constructor */ + || parent.kind === 171 /* SyntaxKind.MethodDeclaration */ + || parent.kind === 175 /* SyntaxKind.SetAccessor */) + && grandparent.kind === 260 /* SyntaxKind.ClassDeclaration */; } return false; } @@ -16393,11 +16323,11 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217 - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217 default: return false; @@ -16413,9 +16343,9 @@ var ts; ts.classOrConstructorParameterIsDecorated = classOrConstructorParameterIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 280 /* SyntaxKind.JsxOpeningElement */ || - parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || - parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (parent.kind === 283 /* SyntaxKind.JsxOpeningElement */ || + parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || + parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return parent.tagName === node; } return false; @@ -16428,53 +16358,54 @@ var ts; case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 221 /* SyntaxKind.BinaryExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 223 /* SyntaxKind.TemplateExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 224 /* SyntaxKind.YieldExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 225 /* SyntaxKind.TemplateExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 226 /* SyntaxKind.YieldExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 233 /* SyntaxKind.MetaProperty */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return !ts.isHeritageClause(node.parent); - case 161 /* SyntaxKind.QualifiedName */: - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + case 163 /* SyntaxKind.QualifiedName */: + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); - case 311 /* SyntaxKind.JSDocMemberName */: + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + case 314 /* SyntaxKind.JSDocMemberName */: while (ts.isJSDocMemberName(node.parent)) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); case 80 /* SyntaxKind.PrivateIdentifier */: return ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; case 79 /* SyntaxKind.Identifier */: - if (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { + if (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { return true; } // falls through @@ -16492,60 +16423,62 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: return parent.initializer === node; - case 238 /* SyntaxKind.ExpressionStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 251 /* SyntaxKind.ThrowStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 254 /* SyntaxKind.ThrowStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forInStatement.expression === node; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return node === parent.expression; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node === parent.expression; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return node === parent.expression; - case 165 /* SyntaxKind.Decorator */: - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 167 /* SyntaxKind.Decorator */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 301 /* SyntaxKind.SpreadAssignment */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return parent.expression === node && !isPartOfTypeNode(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return parent.objectAssignmentInitializer === node; + case 235 /* SyntaxKind.SatisfiesExpression */: + return node === parent.expression; default: return isExpressionNode(parent); } } ts.isInExpressionContext = isInExpressionContext; function isPartOfTypeQuery(node) { - while (node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { + while (node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { node = node.parent; } - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isPartOfTypeQuery = isPartOfTypeQuery; function isNamespaceReexportDeclaration(node) { @@ -16553,7 +16486,7 @@ var ts; } ts.isNamespaceReexportDeclaration = isNamespaceReexportDeclaration; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -16566,7 +16499,7 @@ var ts; } ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJS(file) { @@ -16598,11 +16531,11 @@ var ts; ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && - (node.typeArguments[0].kind === 150 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */); + (node.typeArguments[0].kind === 152 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */); } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, requireStringLiteralLikeArgument) { - if (callExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (callExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -16711,11 +16644,11 @@ var ts; function getExpandoInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 213 /* SyntaxKind.FunctionExpression */ || e.kind === 214 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; + return e.kind === 215 /* SyntaxKind.FunctionExpression */ || e.kind === 216 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; } - if (initializer.kind === 213 /* SyntaxKind.FunctionExpression */ || - initializer.kind === 226 /* SyntaxKind.ClassExpression */ || - initializer.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (initializer.kind === 215 /* SyntaxKind.FunctionExpression */ || + initializer.kind === 228 /* SyntaxKind.ClassExpression */ || + initializer.kind === 216 /* SyntaxKind.ArrowFunction */) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -16961,7 +16894,7 @@ var ts; ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJSFile(expr) && - expr.parent && expr.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + expr.parent && expr.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && (!ts.isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!ts.getJSDocTypeTag(expr.parent); } @@ -16982,17 +16915,17 @@ var ts; return false; } var decl = symbol.valueDeclaration; - return decl.kind === 256 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); + return decl.kind === 259 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); } ts.isFunctionSymbol = isFunctionSymbol; function tryGetModuleSpecifierFromDeclaration(node) { var _a, _b; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0]; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike); default: ts.Debug.assertNever(node); @@ -17005,14 +16938,14 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function tryGetImportFromModuleSpecifier(node) { switch (node.parent.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.parent; - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return node.parent.parent; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return isImportCall(node.parent) || isRequireCall(node.parent, /*checkArg*/ false) ? node.parent : undefined; - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: ts.Debug.assert(ts.isStringLiteral(node)); return ts.tryCast(node.parent.parent, ts.isImportTypeNode); default: @@ -17022,16 +16955,16 @@ var ts; ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; - case 200 /* SyntaxKind.ImportType */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + return node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 202 /* SyntaxKind.ImportType */: return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return node.arguments[0]; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node.name.kind === 10 /* SyntaxKind.StringLiteral */ ? node.name : undefined; default: return ts.Debug.assertNever(node); @@ -17040,11 +16973,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.exportClause && ts.tryCast(node.exportClause, ts.isNamespaceExport); default: return ts.Debug.assertNever(node); @@ -17052,7 +16985,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function forEachImportClauseDeclaration(node, action) { @@ -17073,13 +17006,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return node.questionToken !== undefined; } } @@ -17093,7 +17026,7 @@ var ts; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function isJSDocTypeAlias(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 338 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 341 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocTypeAlias = isJSDocTypeAlias; function isTypeAlias(node) { @@ -17118,12 +17051,12 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return node.initializer; } } @@ -17135,7 +17068,7 @@ var ts; function getNestedModuleDeclaration(node) { return ts.isModuleDeclaration(node) && node.body && - node.body.kind === 261 /* SyntaxKind.ModuleDeclaration */ + node.body.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? node.body : undefined; } @@ -17150,11 +17083,11 @@ var ts; if (ts.hasJSDocNodes(node)) { result = ts.addRange(result, filterOwnedJSDocTags(hostNode, ts.last(node.jsDoc))); } - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocParameterTagsNoCache : ts.getJSDocParameterTags)(node)); break; } - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocTypeParameterTagsNoCache : ts.getJSDocTypeParameterTags)(node)); break; } @@ -17183,11 +17116,11 @@ var ts; } function getNextJSDocCommentLocation(node) { var parent = node.parent; - if (parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - parent.kind === 271 /* SyntaxKind.ExportAssignment */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 247 /* SyntaxKind.ReturnStatement */ || + if (parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + parent.kind === 274 /* SyntaxKind.ExportAssignment */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 250 /* SyntaxKind.ReturnStatement */ || getNestedModuleDeclaration(parent) || ts.isBinaryExpression(node) && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return parent; @@ -17297,34 +17230,34 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 63 /* SyntaxKind.EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* AssignmentKind.Definite */ : 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 45 /* SyntaxKind.PlusPlusToken */ || unaryOperator === 46 /* SyntaxKind.MinusMinusToken */ ? 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return parent.initializer === node ? 1 /* AssignmentKind.Definite */ : 0 /* AssignmentKind.None */; - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 232 /* SyntaxKind.NonNullExpression */: node = parent; break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: node = parent.parent; break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* AssignmentKind.None */; } node = parent.parent; break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (parent.name === node) { return 0 /* AssignmentKind.None */; } @@ -17351,22 +17284,22 @@ var ts; */ function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 237 /* SyntaxKind.VariableStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 238 /* SyntaxKind.Block */: + case 240 /* SyntaxKind.VariableStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return true; } return false; @@ -17383,11 +17316,11 @@ var ts; return node; } function walkUpParenthesizedTypes(node) { - return walkUp(node, 191 /* SyntaxKind.ParenthesizedType */); + return walkUp(node, 193 /* SyntaxKind.ParenthesizedType */); } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 212 /* SyntaxKind.ParenthesizedExpression */); + return walkUp(node, 214 /* SyntaxKind.ParenthesizedExpression */); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; /** @@ -17397,7 +17330,7 @@ var ts; */ function walkUpParenthesizedTypesAndGetParentAndChild(node) { var child; - while (node && node.kind === 191 /* SyntaxKind.ParenthesizedType */) { + while (node && node.kind === 193 /* SyntaxKind.ParenthesizedType */) { child = node; node = node.parent; } @@ -17419,11 +17352,11 @@ var ts; ts.skipParentheses = skipParentheses; // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped function isDeleteTarget(node) { - if (node.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 207 /* SyntaxKind.ElementAccessExpression */) { + if (node.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 209 /* SyntaxKind.ElementAccessExpression */) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node && node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -17476,7 +17409,7 @@ var ts; ts.getDeclarationFromName = getDeclarationFromName; function isLiteralComputedPropertyDeclarationName(node) { return isStringOrNumericLiteralLike(node) && - node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */ && + node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */ && ts.isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; @@ -17484,29 +17417,29 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: // Name on right hand side of dot in a type query or type reference return parent.right === node; - case 203 /* SyntaxKind.BindingElement */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 275 /* SyntaxKind.ExportSpecifier */: - case 285 /* SyntaxKind.JsxAttribute */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 288 /* SyntaxKind.JsxAttribute */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: // Any name in an export specifier or JSX Attribute or Jsx Element return true; } @@ -17529,14 +17462,14 @@ var ts; // const x = require("...").y // const { x } = require("...").y function isAliasSymbolDeclaration(node) { - if (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name || - node.kind === 268 /* SyntaxKind.NamespaceImport */ || - node.kind === 274 /* SyntaxKind.NamespaceExport */ || - node.kind === 270 /* SyntaxKind.ImportSpecifier */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { + if (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name || + node.kind === 271 /* SyntaxKind.NamespaceImport */ || + node.kind === 277 /* SyntaxKind.NamespaceExport */ || + node.kind === 273 /* SyntaxKind.ImportSpecifier */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { return true; } return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && exportAssignmentIsAlias(node) || @@ -17549,18 +17482,18 @@ var ts; ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getAliasDeclarationFromName(node) { switch (node.parent.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 271 /* SyntaxKind.ExportAssignment */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 274 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.parent; - } while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */); + } while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */); return getAliasDeclarationFromName(node); } } @@ -17579,7 +17512,7 @@ var ts; } ts.getExportAssignmentExpression = getExportAssignmentExpression; function getPropertyAssignmentAliasLikeExpression(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.initializer : + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.initializer : node.parent.right; } ts.getPropertyAssignmentAliasLikeExpression = getPropertyAssignmentAliasLikeExpression; @@ -17645,11 +17578,11 @@ var ts; } ts.getAncestor = getAncestor; function isKeyword(token) { - return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 160 /* SyntaxKind.LastKeyword */; + return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 162 /* SyntaxKind.LastKeyword */; } ts.isKeyword = isKeyword; function isContextualKeyword(token) { - return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 160 /* SyntaxKind.LastContextualKeyword */; + return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 162 /* SyntaxKind.LastContextualKeyword */; } ts.isContextualKeyword = isContextualKeyword; function isNonContextualKeyword(token) { @@ -17693,15 +17626,15 @@ var ts; } var flags = 0 /* FunctionFlags.Normal */; switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { flags |= 1 /* FunctionFlags.Generator */; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: - if (hasSyntacticModifier(node, 256 /* ModifierFlags.Async */)) { + case 216 /* SyntaxKind.ArrowFunction */: + if (hasSyntacticModifier(node, 512 /* ModifierFlags.Async */)) { flags |= 2 /* FunctionFlags.Async */; } break; @@ -17714,13 +17647,13 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return node.body !== undefined && node.asteriskToken === undefined - && hasSyntacticModifier(node, 256 /* ModifierFlags.Async */); + && hasSyntacticModifier(node, 512 /* ModifierFlags.Async */); } return false; } @@ -17747,7 +17680,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - if (!(name.kind === 162 /* SyntaxKind.ComputedPropertyName */ || name.kind === 207 /* SyntaxKind.ElementAccessExpression */)) { + if (!(name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || name.kind === 209 /* SyntaxKind.ElementAccessExpression */)) { return false; } var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression; @@ -17763,7 +17696,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameExpression = name.expression; if (isStringOrNumericLiteralLike(nameExpression)) { return ts.escapeLeadingUnderscores(nameExpression.text); @@ -17829,11 +17762,11 @@ var ts; ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 164 /* SyntaxKind.Parameter */; + return root.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 203 /* SyntaxKind.BindingElement */) { + while (node.kind === 205 /* SyntaxKind.BindingElement */) { node = node.parent.parent; } return node; @@ -17841,15 +17774,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 305 /* SyntaxKind.SourceFile */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 308 /* SyntaxKind.SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -17868,23 +17801,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 0 /* Associativity.Left */ : 1 /* Associativity.Right */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 1 /* Associativity.Right */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operator) { case 42 /* SyntaxKind.AsteriskAsteriskToken */: case 63 /* SyntaxKind.EqualsToken */: @@ -17911,15 +17844,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expression.kind === 223 /* SyntaxKind.BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 220 /* SyntaxKind.PostfixUnaryExpression */) { + else if (expression.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 222 /* SyntaxKind.PostfixUnaryExpression */) { return expression.operator; } else { @@ -18098,15 +18031,15 @@ var ts; })(OperatorPrecedence = ts.OperatorPrecedence || (ts.OperatorPrecedence = {})); function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return 0 /* OperatorPrecedence.Comma */; - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return 1 /* OperatorPrecedence.Spread */; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 2 /* OperatorPrecedence.Yield */; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return 4 /* OperatorPrecedence.Conditional */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operatorKind) { case 27 /* SyntaxKind.CommaToken */: return 0 /* OperatorPrecedence.Comma */; @@ -18131,26 +18064,27 @@ var ts; return getBinaryOperatorPrecedence(operatorKind); } // TODO: Should prefix `++` and `--` be moved to the `Update` precedence? - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return 16 /* OperatorPrecedence.Unary */; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return 17 /* OperatorPrecedence.Update */; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return 18 /* OperatorPrecedence.LeftHandSide */; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 19 /* OperatorPrecedence.Member */ : 18 /* OperatorPrecedence.LeftHandSide */; - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 233 /* SyntaxKind.MetaProperty */: return 19 /* OperatorPrecedence.Member */; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return 11 /* OperatorPrecedence.Relational */; case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: @@ -18162,19 +18096,19 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 225 /* SyntaxKind.TemplateExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: return 20 /* OperatorPrecedence.Primary */; default: return -1 /* OperatorPrecedence.Invalid */; @@ -18206,7 +18140,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: return 11 /* OperatorPrecedence.Relational */; case 47 /* SyntaxKind.LessThanLessThanToken */: case 48 /* SyntaxKind.GreaterThanGreaterThanToken */: @@ -18230,7 +18165,7 @@ var ts; function getSemanticJsxChildren(children) { return ts.filter(children, function (i) { switch (i.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !!i.expression; case 11 /* SyntaxKind.JsxText */: return !i.containsOnlyTriviaWhiteSpaces; @@ -18286,7 +18221,7 @@ var ts; } diagnostics = nonFileDiagnostics; } - ts.insertSorted(diagnostics, diagnostic, compareDiagnostics); + ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation); } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -18822,7 +18757,7 @@ var ts; while (ts.isQualifiedName(node.parent) && node.parent.left === node) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */; + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isThisInTypeQuery = isThisInTypeQuery; function identifierIsThisKeyword(id) { @@ -18837,10 +18772,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { + if (accessor.kind === 174 /* SyntaxKind.GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { setAccessor = accessor; } else { @@ -18860,10 +18795,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 172 /* SyntaxKind.GetAccessor */ && !getAccessor) { + if (member.kind === 174 /* SyntaxKind.GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && !setAccessor) { + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -18912,7 +18847,7 @@ var ts; ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations; /** template tags are only available when a typedef isn't already using them */ function isNonTypeAliasTemplate(tag) { - return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 320 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); + return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 323 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); } /** * Gets the effective type annotation of the value parameter of a set accessor. If the node @@ -19145,13 +19080,17 @@ var ts; } ts.hasOverrideModifier = hasOverrideModifier; function hasAbstractModifier(node) { - return hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + return hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); } ts.hasAbstractModifier = hasAbstractModifier; function hasAmbientModifier(node) { return hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); } ts.hasAmbientModifier = hasAmbientModifier; + function hasAccessorModifier(node) { + return hasSyntacticModifier(node, 128 /* ModifierFlags.Accessor */); + } + ts.hasAccessorModifier = hasAccessorModifier; function hasEffectiveReadonlyModifier(node) { return hasEffectiveModifier(node, 64 /* ModifierFlags.Readonly */); } @@ -19169,7 +19108,7 @@ var ts; } ts.getSelectedSyntacticModifierFlags = getSelectedSyntacticModifierFlags; function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) { - if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 162 /* SyntaxKind.LastToken */) { return 0 /* ModifierFlags.None */; } if (!(node.modifierFlagsCache & 536870912 /* ModifierFlags.HasComputedFlags */)) { @@ -19261,25 +19200,22 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: return 4 /* ModifierFlags.Public */; case 122 /* SyntaxKind.ProtectedKeyword */: return 16 /* ModifierFlags.Protected */; case 121 /* SyntaxKind.PrivateKeyword */: return 8 /* ModifierFlags.Private */; - case 126 /* SyntaxKind.AbstractKeyword */: return 128 /* ModifierFlags.Abstract */; + case 126 /* SyntaxKind.AbstractKeyword */: return 256 /* ModifierFlags.Abstract */; + case 127 /* SyntaxKind.AccessorKeyword */: return 128 /* ModifierFlags.Accessor */; case 93 /* SyntaxKind.ExportKeyword */: return 1 /* ModifierFlags.Export */; - case 135 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; + case 136 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; case 85 /* SyntaxKind.ConstKeyword */: return 2048 /* ModifierFlags.Const */; - case 88 /* SyntaxKind.DefaultKeyword */: return 512 /* ModifierFlags.Default */; - case 131 /* SyntaxKind.AsyncKeyword */: return 256 /* ModifierFlags.Async */; - case 145 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; - case 159 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; + case 88 /* SyntaxKind.DefaultKeyword */: return 1024 /* ModifierFlags.Default */; + case 132 /* SyntaxKind.AsyncKeyword */: return 512 /* ModifierFlags.Async */; + case 146 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; + case 161 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; case 101 /* SyntaxKind.InKeyword */: return 32768 /* ModifierFlags.In */; - case 144 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; - case 165 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; + case 145 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; + case 167 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; } return 0 /* ModifierFlags.None */; } ts.modifierToFlag = modifierToFlag; - function createModifiers(modifierFlags) { - return modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; - } - ts.createModifiers = createModifiers; function isLogicalOperator(token) { return token === 56 /* SyntaxKind.BarBarToken */ || token === 55 /* SyntaxKind.AmpersandAmpersandToken */ @@ -19329,8 +19265,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 205 /* SyntaxKind.ObjectLiteralExpression */ - || kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return kind === 207 /* SyntaxKind.ObjectLiteralExpression */ + || kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } return false; } @@ -19347,12 +19283,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 79 /* SyntaxKind.Identifier */); @@ -19364,9 +19300,9 @@ var ts; return node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 108 /* SyntaxKind.ThisKeyword */ || node.kind === 106 /* SyntaxKind.SuperKeyword */ - || node.kind === 231 /* SyntaxKind.MetaProperty */ - || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) - || node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); + || node.kind === 233 /* SyntaxKind.MetaProperty */ + || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) + || node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); } ts.isDottedName = isDottedName; function isPropertyAccessEntityNameExpression(node) { @@ -19397,8 +19333,8 @@ var ts; } ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isRightSideOfAccessExpression(node) { @@ -19413,12 +19349,12 @@ var ts; } ts.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName = isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName; function isEmptyObjectLiteral(expression) { - return expression.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + return expression.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && + return expression.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -19434,7 +19370,7 @@ var ts; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function isExportDefaultSymbol(symbol) { - return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 512 /* ModifierFlags.Default */); + return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 1024 /* ModifierFlags.Default */); } /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ function tryExtractTSExtension(fileName) { @@ -19579,21 +19515,17 @@ var ts; return getStringFromExpandedCharCodes(expandedCharCodes); } ts.base64decode = base64decode; + function readJsonOrUndefined(path, hostOrText) { + var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path); + if (!jsonText) + return undefined; + // gracefully handle if readFile fails or returns not JSON + var result = ts.parseConfigFileTextToJson(path, jsonText); + return !result.error ? result.config : undefined; + } + ts.readJsonOrUndefined = readJsonOrUndefined; function readJson(path, host) { - try { - var jsonText = host.readFile(path); - if (!jsonText) - return {}; - var result = ts.parseConfigFileTextToJson(path, jsonText); - if (result.error) { - return {}; - } - return result.config; - } - catch (e) { - // gracefully handle if readFile fails or returns not JSON - return {}; - } + return readJsonOrUndefined(path, host) || {}; } ts.readJson = readJson; function directoryProbablyExists(directoryName, host) { @@ -19752,8 +19684,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -19769,7 +19701,7 @@ var ts; } function isWatchSet(options) { // Firefox has Object.prototype.watch - return options.watch && options.hasOwnProperty("watch"); + return options.watch && ts.hasProperty(options, "watch"); } ts.isWatchSet = isWatchSet; function closeFileWatcher(watcher) { @@ -19833,35 +19765,35 @@ var ts; if (!parent) return 0 /* AccessKind.Read */; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return accessKind(parent); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var operator = parent.operator; return operator === 45 /* SyntaxKind.PlusPlusToken */ || operator === 46 /* SyntaxKind.MinusMinusToken */ ? writeOrReadWrite() : 0 /* AccessKind.Read */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ ? 1 /* AccessKind.Write */ : writeOrReadWrite() : 0 /* AccessKind.Read */; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node ? 0 /* AccessKind.Read */ : accessKind(parent); - case 296 /* SyntaxKind.PropertyAssignment */: { + case 299 /* SyntaxKind.PropertyAssignment */: { var parentAccess = accessKind(parent.parent); // In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write. return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess; } - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals. return node === parent.objectAssignmentInitializer ? 0 /* AccessKind.Read */ : accessKind(parent.parent); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return accessKind(parent); default: return 0 /* AccessKind.Read */; } function writeOrReadWrite() { // If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect. - return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 238 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; + return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 241 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; } } function reverseAccessKind(a) { @@ -19943,7 +19875,7 @@ var ts; function isAbstractConstructorSymbol(symbol) { if (symbol.flags & 32 /* SymbolFlags.Class */) { var declaration = getClassLikeDeclarationOfSymbol(symbol); - return !!declaration && hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + return !!declaration && hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); } return false; } @@ -20005,37 +19937,37 @@ var ts; } ts.isObjectTypeDeclaration = isObjectTypeDeclaration; function isTypeNodeKind(kind) { - return (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) - || kind === 130 /* SyntaxKind.AnyKeyword */ - || kind === 155 /* SyntaxKind.UnknownKeyword */ - || kind === 147 /* SyntaxKind.NumberKeyword */ - || kind === 158 /* SyntaxKind.BigIntKeyword */ - || kind === 148 /* SyntaxKind.ObjectKeyword */ - || kind === 133 /* SyntaxKind.BooleanKeyword */ - || kind === 150 /* SyntaxKind.StringKeyword */ - || kind === 151 /* SyntaxKind.SymbolKeyword */ + return (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) + || kind === 131 /* SyntaxKind.AnyKeyword */ + || kind === 157 /* SyntaxKind.UnknownKeyword */ + || kind === 148 /* SyntaxKind.NumberKeyword */ + || kind === 160 /* SyntaxKind.BigIntKeyword */ + || kind === 149 /* SyntaxKind.ObjectKeyword */ + || kind === 134 /* SyntaxKind.BooleanKeyword */ + || kind === 152 /* SyntaxKind.StringKeyword */ + || kind === 153 /* SyntaxKind.SymbolKeyword */ || kind === 114 /* SyntaxKind.VoidKeyword */ - || kind === 153 /* SyntaxKind.UndefinedKeyword */ - || kind === 143 /* SyntaxKind.NeverKeyword */ - || kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ - || kind === 312 /* SyntaxKind.JSDocAllType */ - || kind === 313 /* SyntaxKind.JSDocUnknownType */ - || kind === 314 /* SyntaxKind.JSDocNullableType */ - || kind === 315 /* SyntaxKind.JSDocNonNullableType */ - || kind === 316 /* SyntaxKind.JSDocOptionalType */ - || kind === 317 /* SyntaxKind.JSDocFunctionType */ - || kind === 318 /* SyntaxKind.JSDocVariadicType */; + || kind === 155 /* SyntaxKind.UndefinedKeyword */ + || kind === 144 /* SyntaxKind.NeverKeyword */ + || kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ + || kind === 315 /* SyntaxKind.JSDocAllType */ + || kind === 316 /* SyntaxKind.JSDocUnknownType */ + || kind === 317 /* SyntaxKind.JSDocNullableType */ + || kind === 318 /* SyntaxKind.JSDocNonNullableType */ + || kind === 319 /* SyntaxKind.JSDocOptionalType */ + || kind === 320 /* SyntaxKind.JSDocFunctionType */ + || kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isTypeNodeKind = isTypeNodeKind; function isAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isAccessExpression = isAccessExpression; function getNameOfAccessExpression(node) { - if (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { return node.name; } - ts.Debug.assert(node.kind === 207 /* SyntaxKind.ElementAccessExpression */); + ts.Debug.assert(node.kind === 209 /* SyntaxKind.ElementAccessExpression */); return node.argumentExpression; } ts.getNameOfAccessExpression = getNameOfAccessExpression; @@ -20050,7 +19982,7 @@ var ts; } ts.isBundleFileTextLike = isBundleFileTextLike; function isNamedImportsOrExports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 272 /* SyntaxKind.NamedImports */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedImportsOrExports = isNamedImportsOrExports; function getLeftmostAccessExpression(expr) { @@ -20065,13 +19997,13 @@ var ts; return walkAccessExpression(name.parent); } function walkAccessExpression(access) { - if (access.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (access.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var res = action(access.name); if (res !== undefined) { return res; } } - else if (access.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + else if (access.kind === 209 /* SyntaxKind.ElementAccessExpression */) { if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) { var res = action(access.argumentExpression); if (res !== undefined) { @@ -20098,28 +20030,29 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: node = node.operand; continue; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: node = node.left; continue; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: node = node.condition; continue; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: node = node.tag; continue; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (stopAtCallExpressions) { return node; } // falls through - case 229 /* SyntaxKind.AsExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: node = node.expression; continue; } @@ -21355,17 +21288,17 @@ var ts; return ts.isIdentifier(useSite) && ts.isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite; } function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { - while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } - if (hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */)) { + if (hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */)) { return true; } var containerKind = node.parent.parent.kind; - return containerKind === 258 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 182 /* SyntaxKind.TypeLiteral */; + return containerKind === 261 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 184 /* SyntaxKind.TypeLiteral */; } /** Returns true for an identifier in 1) an `implements` clause, and 2) an `extends` clause of an interface. */ function isIdentifierInNonEmittingHeritageClause(node) { @@ -21373,16 +21306,16 @@ var ts; return false; var heritageClause = ts.findAncestor(node.parent, function (parent) { switch (parent.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return false; default: return "quit"; } }); - return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 258 /* SyntaxKind.InterfaceDeclaration */; + return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 261 /* SyntaxKind.InterfaceDeclaration */; } function isIdentifierTypeReference(node) { return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName); @@ -21543,22 +21476,22 @@ var ts; if (!node.parent) return undefined; switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: var parent_1 = node.parent; - return parent_1.kind === 190 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; - case 164 /* SyntaxKind.Parameter */: + return parent_1.kind === 192 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; + case 166 /* SyntaxKind.Parameter */: return node.parent.parameters; - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return node.parent.templateSpans; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node.parent.templateSpans; - case 165 /* SyntaxKind.Decorator */: { + case 167 /* SyntaxKind.Decorator */: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return node.parent.heritageClauses; } var parent = node.parent; @@ -21566,45 +21499,45 @@ var ts; return ts.isJSDocTypeLiteral(node.parent) ? undefined : node.parent.tags; } switch (parent.kind) { - case 182 /* SyntaxKind.TypeLiteral */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.isTypeElement(node) ? parent.members : undefined; - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return parent.types; - case 184 /* SyntaxKind.TupleType */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 186 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return parent.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 286 /* SyntaxKind.JsxAttributes */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 289 /* SyntaxKind.JsxAttributes */: return parent.properties; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.isTypeNode(node) ? parent.typeArguments : parent.expression === node ? undefined : parent.arguments; - case 278 /* SyntaxKind.JsxElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 285 /* SyntaxKind.JsxFragment */: return ts.isJsxChild(node) ? parent.children : undefined; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return ts.isTypeNode(node) ? parent.typeArguments : undefined; - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: return parent.statements; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return parent.clauses; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.isClassElement(node) ? parent.members : undefined; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.isEnumMember(node) ? parent.members : undefined; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return parent.statements; } } @@ -21616,7 +21549,7 @@ var ts; if (ts.some(node.parameters, function (p) { return !getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { // If the first parameter is not an explicit 'this' parameter, then the function has // an implicit 'this' parameter which is subject to contextual typing. var parameter = ts.firstOrUndefined(node.parameters); @@ -21634,7 +21567,7 @@ var ts; } ts.isInfinityOrNaNString = isInfinityOrNaNString; function isCatchClauseVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function isParameterOrCatchClauseVariable(symbol) { @@ -21643,7 +21576,7 @@ var ts; } ts.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable; function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */ || node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */ || node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction; function escapeSnippetText(text) { @@ -21740,9 +21673,35 @@ var ts; ts.getNodeModulePathParts = getNodeModulePathParts; function getParameterTypeNode(parameter) { var _a; - return parameter.kind === 340 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; + return parameter.kind === 343 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; } ts.getParameterTypeNode = getParameterTypeNode; + function isTypeDeclaration(node) { + switch (node.kind) { + case 165 /* SyntaxKind.TypeParameter */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + return true; + case 270 /* SyntaxKind.ImportClause */: + return node.isTypeOnly; + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: + return node.parent.parent.isTypeOnly; + default: + return false; + } + } + ts.isTypeDeclaration = isTypeDeclaration; + function canHaveExportModifier(node) { + return ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) + || ts.isInterfaceDeclaration(node) || isTypeDeclaration(node) || (ts.isModuleDeclaration(node) && !isExternalModuleAugmentation(node) && !isGlobalScopeAugmentation(node)); + } + ts.canHaveExportModifier = canHaveExportModifier; })(ts || (ts = {})); /* @internal */ var ts; @@ -21751,13 +21710,11 @@ var ts; * Creates a `BaseNodeFactory` which can be used to create `Node` instances from the constructors provided by the object allocator. */ function createBaseNodeFactory() { - // tslint:disable variable-name var NodeConstructor; var TokenConstructor; var IdentifierConstructor; var PrivateIdentifierConstructor; var SourceFileConstructor; - // tslint:enable variable-name return { createBaseSourceFileNode: createBaseSourceFileNode, createBaseIdentifierNode: createBaseIdentifierNode, @@ -21865,10 +21822,10 @@ var ts; // // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve // the intended order of operations: `(a ** b) ** c` - var binaryOperatorPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(221 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(223 /* SyntaxKind.BinaryExpression */, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); - if (!isLeftSideOfBinary && operand.kind === 214 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { + if (!isLeftSideOfBinary && operand.kind === 216 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { // We need to parenthesize arrow functions on the right side to avoid it being // parsed as parenthesized expression: `a && (() => {})` return true; @@ -21880,7 +21837,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Associativity.Right */ - && operand.kind === 224 /* SyntaxKind.YieldExpression */) { + && operand.kind === 226 /* SyntaxKind.YieldExpression */) { return false; } return true; @@ -21949,13 +21906,15 @@ var ts; // (a|b)|c -> a|(b|c) -> a|b|c // (a&b)&c -> a&(b&c) -> a&b&c // (a^b)^c -> a^(b^c) -> a^b^c + // (a,b),c -> a,(b,c) -> a,b,c // // While addition is associative in mathematics, JavaScript's `+` is not // guaranteed to be associative as it is overloaded with string concatenation. return binaryOperator === 41 /* SyntaxKind.AsteriskToken */ || binaryOperator === 51 /* SyntaxKind.BarToken */ || binaryOperator === 50 /* SyntaxKind.AmpersandToken */ - || binaryOperator === 52 /* SyntaxKind.CaretToken */; + || binaryOperator === 52 /* SyntaxKind.CaretToken */ + || binaryOperator === 27 /* SyntaxKind.CommaToken */; } /** * This function determines whether an expression consists of a homogeneous set of @@ -21968,7 +21927,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -21994,7 +21953,7 @@ var ts; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = ts.skipPartiallyEmittedExpressions(operand); // If the resulting expression is already parenthesized, we do not need to do any further processing. - if (skipped.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (skipped.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -22011,7 +21970,7 @@ var ts; return ts.isCommaSequence(expression) ? factory.createParenthesizedExpression(expression) : expression; } function parenthesizeConditionOfConditionalExpression(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(222 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(224 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) !== 1 /* Comparison.GreaterThan */) { @@ -22044,8 +22003,8 @@ var ts; var needsParens = ts.isCommaSequence(check); if (!needsParens) { switch (ts.getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: needsParens = true; } } @@ -22058,9 +22017,9 @@ var ts; function parenthesizeExpressionOfNew(expression) { var leftmostExpr = ts.getLeftmostExpression(expression, /*stopAtCallExpressions*/ true); switch (leftmostExpr.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return factory.createParenthesizedExpression(expression); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return !leftmostExpr.arguments ? factory.createParenthesizedExpression(expression) : expression; // TODO(rbuckton): Verify this assertion holds @@ -22080,7 +22039,7 @@ var ts; // var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 209 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) + && (emittedExpression.kind !== 211 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) && (optionalChain || !ts.isOptionalChain(emittedExpression))) { // TODO(rbuckton): Verify whether this assertion holds. return expression; @@ -22103,7 +22062,7 @@ var ts; function parenthesizeExpressionForDisallowedComma(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } @@ -22112,21 +22071,21 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 213 /* SyntaxKind.FunctionExpression */ || kind === 214 /* SyntaxKind.ArrowFunction */) { + if (kind === 215 /* SyntaxKind.FunctionExpression */ || kind === 216 /* SyntaxKind.ArrowFunction */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. var updated = factory.updateCallExpression(emittedExpression, ts.setTextRange(factory.createParenthesizedExpression(callee), callee), emittedExpression.typeArguments, emittedExpression.arguments); return factory.restoreOuterExpressions(expression, updated, 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */); } } var leftmostExpressionKind = ts.getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind; - if (leftmostExpressionKind === 205 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 213 /* SyntaxKind.FunctionExpression */) { + if (leftmostExpressionKind === 207 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 215 /* SyntaxKind.FunctionExpression */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } return expression; } function parenthesizeConciseBodyOfArrowFunction(body) { - if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(body), body); } @@ -22144,16 +22103,16 @@ var ts; // - The true and false branch types (the second and third `Type` non-terminals, above) allow any type function parenthesizeCheckTypeOfConditionalType(checkType) { switch (checkType.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 189 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(checkType); } return checkType; } function parenthesizeExtendsTypeOfConditionalType(extendsType) { switch (extendsType.kind) { - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(extendsType); } return extendsType; @@ -22165,8 +22124,8 @@ var ts; // - A union type constituent has the same precedence as the check type of a conditional type function parenthesizeConstituentTypeOfUnionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 189 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeCheckTypeOfConditionalType(type); @@ -22181,8 +22140,8 @@ var ts; // - An intersection type constituent does not allow function, constructor, conditional, or union types (they must be parenthesized) function parenthesizeConstituentTypeOfIntersectionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfUnionType(type); @@ -22199,14 +22158,14 @@ var ts; // function parenthesizeOperandOfTypeOperator(type) { switch (type.kind) { - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfIntersectionType(type); } function parenthesizeOperandOfReadonlyTypeOperator(type) { switch (type.kind) { - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22226,9 +22185,9 @@ var ts; // function parenthesizeNonArrayTypeOfPostfixType(type) { switch (type.kind) { - case 190 /* SyntaxKind.InferType */: - case 193 /* SyntaxKind.TypeOperator */: - case 181 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 192 /* SyntaxKind.InferType */: + case 195 /* SyntaxKind.TypeOperator */: + case 183 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22422,11 +22381,11 @@ var ts; } function convertToAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -22520,6 +22479,8 @@ var ts; createUniqueName: createUniqueName, getGeneratedNameForNode: getGeneratedNameForNode, createPrivateIdentifier: createPrivateIdentifier, + createUniquePrivateName: createUniquePrivateName, + getGeneratedPrivateNameForNode: getGeneratedPrivateNameForNode, createToken: createToken, createSuper: createSuper, createThis: createThis, @@ -22682,6 +22643,8 @@ var ts; updateAsExpression: updateAsExpression, createNonNullExpression: createNonNullExpression, updateNonNullExpression: updateNonNullExpression, + createSatisfiesExpression: createSatisfiesExpression, + updateSatisfiesExpression: updateSatisfiesExpression, createNonNullChain: createNonNullChain, updateNonNullChain: updateNonNullChain, createMetaProperty: createMetaProperty, @@ -22779,18 +22742,18 @@ var ts; createExternalModuleReference: createExternalModuleReference, updateExternalModuleReference: updateExternalModuleReference, // lazily load factory members for JSDoc types with similar structure - get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312 /* SyntaxKind.JSDocAllType */); }, - get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313 /* SyntaxKind.JSDocUnknownType */); }, - get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, - get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, + get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(315 /* SyntaxKind.JSDocAllType */); }, + get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(316 /* SyntaxKind.JSDocUnknownType */); }, + get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, + get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, createJSDocFunctionType: createJSDocFunctionType, updateJSDocFunctionType: updateJSDocFunctionType, createJSDocTypeLiteral: createJSDocTypeLiteral, @@ -22826,30 +22789,30 @@ var ts; createJSDocLinkPlain: createJSDocLinkPlain, updateJSDocLinkPlain: updateJSDocLinkPlain, // lazily load factory members for JSDoc tags with similar structure - get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, - get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, + get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, + get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, createJSDocUnknownTag: createJSDocUnknownTag, updateJSDocUnknownTag: updateJSDocUnknownTag, createJSDocText: createJSDocText, @@ -23052,11 +23015,11 @@ var ts; // don't propagate child flags. if (name) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isIdentifier(name)) { node.transformFlags |= propagateIdentifierNameFlags(name); break; @@ -23205,23 +23168,29 @@ var ts; node.escapedText = ts.escapeLeadingUnderscores(text); return node; } - function createBaseGeneratedIdentifier(text, autoGenerateFlags) { + function createBaseGeneratedIdentifier(text, autoGenerateFlags, prefix, suffix) { var node = createBaseIdentifier(text, /*originalKeywordKind*/ undefined); node.autoGenerateFlags = autoGenerateFlags; node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; nextAutoGenerateId++; return node; } // @api - function createIdentifier(text, typeArguments, originalKeywordKind) { + function createIdentifier(text, typeArguments, originalKeywordKind, hasExtendedUnicodeEscape) { var node = createBaseIdentifier(text, originalKeywordKind); if (typeArguments) { // NOTE: we do not use `setChildren` here because typeArguments in an identifier do not contribute to transformations node.typeArguments = createNodeArray(typeArguments); } - if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { node.transformFlags |= 67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; } + if (hasExtendedUnicodeEscape) { + node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape; + node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; + } return node; } // @api @@ -23231,11 +23200,11 @@ var ts; : node; } // @api - function createTempVariable(recordTempVariable, reservedInNestedScopes) { + function createTempVariable(recordTempVariable, reservedInNestedScopes, prefix, suffix) { var flags = 1 /* GeneratedIdentifierFlags.Auto */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - var name = createBaseGeneratedIdentifier("", flags); + var name = createBaseGeneratedIdentifier("", flags, prefix, suffix); if (recordTempVariable) { recordTempVariable(name); } @@ -23247,34 +23216,69 @@ var ts; var flags = 2 /* GeneratedIdentifierFlags.Loop */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - return createBaseGeneratedIdentifier("", flags); + return createBaseGeneratedIdentifier("", flags, /*prefix*/ undefined, /*suffix*/ undefined); } /** Create a unique name based on the supplied text. */ // @api - function createUniqueName(text, flags) { + function createUniqueName(text, flags, prefix, suffix) { if (flags === void 0) { flags = 0 /* GeneratedIdentifierFlags.None */; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); ts.Debug.assert((flags & (16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */)) !== 32 /* GeneratedIdentifierFlags.FileLevel */, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"); - return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags); + return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags, prefix, suffix); } /** Create a unique name generated for a node. */ // @api - function getGeneratedNameForNode(node, flags) { + function getGeneratedNameForNode(node, flags, prefix, suffix) { if (flags === void 0) { flags = 0; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); - var name = createBaseGeneratedIdentifier(node && ts.isIdentifier(node) ? ts.idText(node) : "", 4 /* GeneratedIdentifierFlags.Node */ | flags); + var text = !node ? "" : + ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ false, prefix, node, suffix, ts.idText) : + "generated@".concat(ts.getNodeId(node)); + if (prefix || suffix) + flags |= 16 /* GeneratedIdentifierFlags.Optimistic */; + var name = createBaseGeneratedIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); name.original = node; return name; } + function createBasePrivateIdentifier(text) { + var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); + node.escapedText = ts.escapeLeadingUnderscores(text); + node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return node; + } // @api function createPrivateIdentifier(text) { if (!ts.startsWith(text, "#")) ts.Debug.fail("First character of private identifier must be #: " + text); - var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); - node.escapedText = ts.escapeLeadingUnderscores(text); - node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return createBasePrivateIdentifier(text); + } + function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags, prefix, suffix) { + var node = createBasePrivateIdentifier(text); + node.autoGenerateFlags = autoGenerateFlags; + node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; + nextAutoGenerateId++; return node; } + /** Create a unique name based on the supplied text. */ + // @api + function createUniquePrivateName(text, prefix, suffix) { + if (text && !ts.startsWith(text, "#")) + ts.Debug.fail("First character of private identifier must be #: " + text); + var autoGenerateFlags = 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */ | + (text ? 3 /* GeneratedIdentifierFlags.Unique */ : 1 /* GeneratedIdentifierFlags.Auto */); + return createBaseGeneratedPrivateIdentifier(text !== null && text !== void 0 ? text : "", autoGenerateFlags, prefix, suffix); + } + // @api + function getGeneratedPrivateNameForNode(node, prefix, suffix) { + var text = ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ true, prefix, node, suffix, ts.idText) : + "#generated@".concat(ts.getNodeId(node)); + var flags = prefix || suffix ? 16 /* GeneratedIdentifierFlags.Optimistic */ : 0 /* GeneratedIdentifierFlags.None */; + var name = createBaseGeneratedPrivateIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); + name.original = node; + return name; + } // // Punctuation // @@ -23282,14 +23286,14 @@ var ts; return baseFactory.createBaseTokenNode(kind); } function createToken(token) { - ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 160 /* SyntaxKind.LastToken */, "Invalid token"); + ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 162 /* SyntaxKind.LastToken */, "Invalid token"); ts.Debug.assert(token <= 14 /* SyntaxKind.FirstTemplateToken */ || token >= 17 /* SyntaxKind.LastTemplateToken */, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."); ts.Debug.assert(token <= 8 /* SyntaxKind.FirstLiteralToken */ || token >= 14 /* SyntaxKind.LastLiteralToken */, "Invalid token. Use 'createLiteralLikeNode' to create literals."); ts.Debug.assert(token !== 79 /* SyntaxKind.Identifier */, "Invalid token. Use 'createIdentifier' to create identifiers"); var node = createBaseToken(token); var transformFlags = 0 /* TransformFlags.None */; switch (token) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // 'async' modifier is ES2017 (async functions) or ES2018 (async generators) transformFlags = 256 /* TransformFlags.ContainsES2017 */ | @@ -23298,24 +23302,24 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. + case 157 /* SyntaxKind.UnknownKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. transformFlags = 1 /* TransformFlags.ContainsTypeScript */; break; case 106 /* SyntaxKind.SuperKeyword */: @@ -23324,6 +23328,9 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: transformFlags = 1024 /* TransformFlags.ContainsES2015 */; break; + case 127 /* SyntaxKind.AccessorKeyword */: + transformFlags = 16777216 /* TransformFlags.ContainsClassFields */; + break; case 108 /* SyntaxKind.ThisKeyword */: // 'this' indicates a lexical 'this' transformFlags = 16384 /* TransformFlags.ContainsLexicalThis */; @@ -23370,8 +23377,8 @@ var ts; if (flags & 1 /* ModifierFlags.Export */) result.push(createModifier(93 /* SyntaxKind.ExportKeyword */)); if (flags & 2 /* ModifierFlags.Ambient */) - result.push(createModifier(135 /* SyntaxKind.DeclareKeyword */)); - if (flags & 512 /* ModifierFlags.Default */) + result.push(createModifier(136 /* SyntaxKind.DeclareKeyword */)); + if (flags & 1024 /* ModifierFlags.Default */) result.push(createModifier(88 /* SyntaxKind.DefaultKeyword */)); if (flags & 2048 /* ModifierFlags.Const */) result.push(createModifier(85 /* SyntaxKind.ConstKeyword */)); @@ -23381,20 +23388,22 @@ var ts; result.push(createModifier(121 /* SyntaxKind.PrivateKeyword */)); if (flags & 16 /* ModifierFlags.Protected */) result.push(createModifier(122 /* SyntaxKind.ProtectedKeyword */)); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push(createModifier(126 /* SyntaxKind.AbstractKeyword */)); if (flags & 32 /* ModifierFlags.Static */) result.push(createModifier(124 /* SyntaxKind.StaticKeyword */)); if (flags & 16384 /* ModifierFlags.Override */) - result.push(createModifier(159 /* SyntaxKind.OverrideKeyword */)); + result.push(createModifier(161 /* SyntaxKind.OverrideKeyword */)); if (flags & 64 /* ModifierFlags.Readonly */) - result.push(createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); - if (flags & 256 /* ModifierFlags.Async */) - result.push(createModifier(131 /* SyntaxKind.AsyncKeyword */)); + result.push(createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); + if (flags & 128 /* ModifierFlags.Accessor */) + result.push(createModifier(127 /* SyntaxKind.AccessorKeyword */)); + if (flags & 512 /* ModifierFlags.Async */) + result.push(createModifier(132 /* SyntaxKind.AsyncKeyword */)); if (flags & 32768 /* ModifierFlags.In */) result.push(createModifier(101 /* SyntaxKind.InKeyword */)); if (flags & 65536 /* ModifierFlags.Out */) - result.push(createModifier(144 /* SyntaxKind.OutKeyword */)); + result.push(createModifier(145 /* SyntaxKind.OutKeyword */)); return result.length ? result : undefined; } // @@ -23402,7 +23411,7 @@ var ts; // // @api function createQualifiedName(left, right) { - var node = createBaseNode(161 /* SyntaxKind.QualifiedName */); + var node = createBaseNode(163 /* SyntaxKind.QualifiedName */); node.left = left; node.right = asName(right); node.transformFlags |= @@ -23419,7 +23428,7 @@ var ts; } // @api function createComputedPropertyName(expression) { - var node = createBaseNode(162 /* SyntaxKind.ComputedPropertyName */); + var node = createBaseNode(164 /* SyntaxKind.ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23438,7 +23447,7 @@ var ts; // // @api function createTypeParameterDeclaration(modifiers, name, constraint, defaultType) { - var node = createBaseNamedDeclaration(163 /* SyntaxKind.TypeParameter */, modifiers, name); + var node = createBaseNamedDeclaration(165 /* SyntaxKind.TypeParameter */, modifiers, name); node.constraint = constraint; node.default = defaultType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23455,7 +23464,7 @@ var ts; } // @api function createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(164 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + var node = createBaseVariableLikeDeclaration(166 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.dotDotDotToken = dotDotDotToken; node.questionToken = questionToken; if (ts.isThisIdentifier(node.name)) { @@ -23487,7 +23496,7 @@ var ts; } // @api function createDecorator(expression) { - var node = createBaseNode(165 /* SyntaxKind.Decorator */); + var node = createBaseNode(167 /* SyntaxKind.Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23507,7 +23516,7 @@ var ts; // // @api function createPropertySignature(modifiers, name, questionToken, type) { - var node = createBaseNamedDeclaration(166 /* SyntaxKind.PropertySignature */, modifiers, name); + var node = createBaseNamedDeclaration(168 /* SyntaxKind.PropertySignature */, modifiers, name); node.type = type; node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23533,7 +23542,7 @@ var ts; } // @api function createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(167 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); + var node = createBaseVariableLikeDeclaration(169 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); node.questionToken = questionOrExclamationToken && ts.isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= @@ -23561,7 +23570,7 @@ var ts; } // @api function createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(168 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(170 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23579,7 +23588,7 @@ var ts; } // @api function createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(169 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.questionToken = questionToken; node.transformFlags |= @@ -23589,7 +23598,7 @@ var ts; if (questionToken) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -23625,7 +23634,7 @@ var ts; } // @api function createClassStaticBlockDeclaration(body) { - var node = createBaseGenericNamedDeclaration(170 /* SyntaxKind.ClassStaticBlockDeclaration */, + var node = createBaseGenericNamedDeclaration(172 /* SyntaxKind.ClassStaticBlockDeclaration */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined); @@ -23651,7 +23660,7 @@ var ts; } // @api function createConstructorDeclaration(modifiers, parameters, body) { - var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.Constructor */, modifiers, + var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.Constructor */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); @@ -23680,7 +23689,7 @@ var ts; } // @api function createGetAccessorDeclaration(modifiers, name, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(172 /* SyntaxKind.GetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(174 /* SyntaxKind.GetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, type, body); // The following properties are used only to report grammar errors node.typeParameters = undefined; @@ -23704,7 +23713,7 @@ var ts; } // @api function createSetAccessorDeclaration(modifiers, name, parameters, body) { - var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.SetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(175 /* SyntaxKind.SetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); // The following properties are used only to report grammar errors @@ -23730,7 +23739,7 @@ var ts; } // @api function createCallSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(174 /* SyntaxKind.CallSignature */, + var node = createBaseSignatureDeclaration(176 /* SyntaxKind.CallSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23746,7 +23755,7 @@ var ts; } // @api function createConstructSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(175 /* SyntaxKind.ConstructSignature */, + var node = createBaseSignatureDeclaration(177 /* SyntaxKind.ConstructSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23762,7 +23771,7 @@ var ts; } // @api function createIndexSignature(modifiers, parameters, type) { - var node = createBaseSignatureDeclaration(176 /* SyntaxKind.IndexSignature */, modifiers, + var node = createBaseSignatureDeclaration(178 /* SyntaxKind.IndexSignature */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23778,7 +23787,7 @@ var ts; } // @api function createTemplateLiteralTypeSpan(type, literal) { - var node = createBaseNode(199 /* SyntaxKind.TemplateLiteralTypeSpan */); + var node = createBaseNode(201 /* SyntaxKind.TemplateLiteralTypeSpan */); node.type = type; node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23800,7 +23809,7 @@ var ts; } // @api function createTypePredicateNode(assertsModifier, parameterName, type) { - var node = createBaseNode(177 /* SyntaxKind.TypePredicate */); + var node = createBaseNode(179 /* SyntaxKind.TypePredicate */); node.assertsModifier = assertsModifier; node.parameterName = asName(parameterName); node.type = type; @@ -23817,7 +23826,7 @@ var ts; } // @api function createTypeReferenceNode(typeName, typeArguments) { - var node = createBaseNode(178 /* SyntaxKind.TypeReference */); + var node = createBaseNode(180 /* SyntaxKind.TypeReference */); node.typeName = asName(typeName); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(createNodeArray(typeArguments)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23832,7 +23841,7 @@ var ts; } // @api function createFunctionTypeNode(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(179 /* SyntaxKind.FunctionType */, + var node = createBaseSignatureDeclaration(181 /* SyntaxKind.FunctionType */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23865,7 +23874,7 @@ var ts; ts.Debug.fail("Incorrect number of arguments specified."); } function createConstructorTypeNode1(modifiers, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(180 /* SyntaxKind.ConstructorType */, modifiers, + var node = createBaseSignatureDeclaration(182 /* SyntaxKind.ConstructorType */, modifiers, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23898,7 +23907,7 @@ var ts; } // @api function createTypeQueryNode(exprName, typeArguments) { - var node = createBaseNode(181 /* SyntaxKind.TypeQuery */); + var node = createBaseNode(183 /* SyntaxKind.TypeQuery */); node.exprName = exprName; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23913,7 +23922,7 @@ var ts; } // @api function createTypeLiteralNode(members) { - var node = createBaseNode(182 /* SyntaxKind.TypeLiteral */); + var node = createBaseNode(184 /* SyntaxKind.TypeLiteral */); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23926,7 +23935,7 @@ var ts; } // @api function createArrayTypeNode(elementType) { - var node = createBaseNode(183 /* SyntaxKind.ArrayType */); + var node = createBaseNode(185 /* SyntaxKind.ArrayType */); node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23939,7 +23948,7 @@ var ts; } // @api function createTupleTypeNode(elements) { - var node = createBaseNode(184 /* SyntaxKind.TupleType */); + var node = createBaseNode(186 /* SyntaxKind.TupleType */); node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23952,7 +23961,7 @@ var ts; } // @api function createNamedTupleMember(dotDotDotToken, name, questionToken, type) { - var node = createBaseNode(197 /* SyntaxKind.NamedTupleMember */); + var node = createBaseNode(199 /* SyntaxKind.NamedTupleMember */); node.dotDotDotToken = dotDotDotToken; node.name = name; node.questionToken = questionToken; @@ -23971,7 +23980,7 @@ var ts; } // @api function createOptionalTypeNode(type) { - var node = createBaseNode(185 /* SyntaxKind.OptionalType */); + var node = createBaseNode(187 /* SyntaxKind.OptionalType */); node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23984,7 +23993,7 @@ var ts; } // @api function createRestTypeNode(type) { - var node = createBaseNode(186 /* SyntaxKind.RestType */); + var node = createBaseNode(188 /* SyntaxKind.RestType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24008,7 +24017,7 @@ var ts; } // @api function createUnionTypeNode(types) { - return createUnionOrIntersectionTypeNode(187 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); + return createUnionOrIntersectionTypeNode(189 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } // @api function updateUnionTypeNode(node, types) { @@ -24016,7 +24025,7 @@ var ts; } // @api function createIntersectionTypeNode(types) { - return createUnionOrIntersectionTypeNode(188 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); + return createUnionOrIntersectionTypeNode(190 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } // @api function updateIntersectionTypeNode(node, types) { @@ -24024,7 +24033,7 @@ var ts; } // @api function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { - var node = createBaseNode(189 /* SyntaxKind.ConditionalType */); + var node = createBaseNode(191 /* SyntaxKind.ConditionalType */); node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType); node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType); node.trueType = trueType; @@ -24043,7 +24052,7 @@ var ts; } // @api function createInferTypeNode(typeParameter) { - var node = createBaseNode(190 /* SyntaxKind.InferType */); + var node = createBaseNode(192 /* SyntaxKind.InferType */); node.typeParameter = typeParameter; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24056,7 +24065,7 @@ var ts; } // @api function createTemplateLiteralType(head, templateSpans) { - var node = createBaseNode(198 /* SyntaxKind.TemplateLiteralType */); + var node = createBaseNode(200 /* SyntaxKind.TemplateLiteralType */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24072,7 +24081,7 @@ var ts; // @api function createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf) { if (isTypeOf === void 0) { isTypeOf = false; } - var node = createBaseNode(200 /* SyntaxKind.ImportType */); + var node = createBaseNode(202 /* SyntaxKind.ImportType */); node.argument = argument; node.assertions = assertions; node.qualifier = qualifier; @@ -24094,7 +24103,7 @@ var ts; } // @api function createParenthesizedType(type) { - var node = createBaseNode(191 /* SyntaxKind.ParenthesizedType */); + var node = createBaseNode(193 /* SyntaxKind.ParenthesizedType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24107,15 +24116,15 @@ var ts; } // @api function createThisTypeNode() { - var node = createBaseNode(192 /* SyntaxKind.ThisType */); + var node = createBaseNode(194 /* SyntaxKind.ThisType */); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; } // @api function createTypeOperatorNode(operator, type) { - var node = createBaseNode(193 /* SyntaxKind.TypeOperator */); + var node = createBaseNode(195 /* SyntaxKind.TypeOperator */); node.operator = operator; - node.type = operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + node.type = operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : parenthesizerRules().parenthesizeOperandOfTypeOperator(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24129,7 +24138,7 @@ var ts; } // @api function createIndexedAccessTypeNode(objectType, indexType) { - var node = createBaseNode(194 /* SyntaxKind.IndexedAccessType */); + var node = createBaseNode(196 /* SyntaxKind.IndexedAccessType */); node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType); node.indexType = indexType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -24144,7 +24153,7 @@ var ts; } // @api function createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members) { - var node = createBaseNode(195 /* SyntaxKind.MappedType */); + var node = createBaseNode(197 /* SyntaxKind.MappedType */); node.readonlyToken = readonlyToken; node.typeParameter = typeParameter; node.nameType = nameType; @@ -24167,7 +24176,7 @@ var ts; } // @api function createLiteralTypeNode(literal) { - var node = createBaseNode(196 /* SyntaxKind.LiteralType */); + var node = createBaseNode(198 /* SyntaxKind.LiteralType */); node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -24183,7 +24192,7 @@ var ts; // // @api function createObjectBindingPattern(elements) { - var node = createBaseNode(201 /* SyntaxKind.ObjectBindingPattern */); + var node = createBaseNode(203 /* SyntaxKind.ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24204,7 +24213,7 @@ var ts; } // @api function createArrayBindingPattern(elements) { - var node = createBaseNode(202 /* SyntaxKind.ArrayBindingPattern */); + var node = createBaseNode(204 /* SyntaxKind.ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24220,7 +24229,7 @@ var ts; } // @api function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createBaseBindingLikeDeclaration(203 /* SyntaxKind.BindingElement */, + var node = createBaseBindingLikeDeclaration(205 /* SyntaxKind.BindingElement */, /*modifiers*/ undefined, name, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; @@ -24255,7 +24264,7 @@ var ts; } // @api function createArrayLiteralExpression(elements, multiLine) { - var node = createBaseExpression(204 /* SyntaxKind.ArrayLiteralExpression */); + var node = createBaseExpression(206 /* SyntaxKind.ArrayLiteralExpression */); // Ensure we add a trailing comma for something like `[NumericLiteral(1), NumericLiteral(2), OmittedExpresion]` so that // we end up with `[1, 2, ,]` instead of `[1, 2, ]` otherwise the `OmittedExpression` will just end up being treated like // a trailing comma. @@ -24274,7 +24283,7 @@ var ts; } // @api function createObjectLiteralExpression(properties, multiLine) { - var node = createBaseExpression(205 /* SyntaxKind.ObjectLiteralExpression */); + var node = createBaseExpression(207 /* SyntaxKind.ObjectLiteralExpression */); node.properties = createNodeArray(properties); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.properties); @@ -24288,7 +24297,7 @@ var ts; } // @api function createPropertyAccessExpression(expression, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.name = asName(name); node.transformFlags = @@ -24317,7 +24326,7 @@ var ts; } // @api function createPropertyAccessChain(expression, questionDotToken, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24344,7 +24353,7 @@ var ts; } // @api function createElementAccessExpression(expression, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.argumentExpression = asExpression(index); node.transformFlags |= @@ -24371,7 +24380,7 @@ var ts; } // @api function createElementAccessChain(expression, questionDotToken, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24396,7 +24405,7 @@ var ts; } // @api function createCallExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray)); @@ -24428,7 +24437,7 @@ var ts; } // @api function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24460,7 +24469,7 @@ var ts; } // @api function createNewExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(209 /* SyntaxKind.NewExpression */); + var node = createBaseExpression(211 /* SyntaxKind.NewExpression */); node.expression = parenthesizerRules().parenthesizeExpressionOfNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(argumentsArray) : undefined; @@ -24484,7 +24493,7 @@ var ts; } // @api function createTaggedTemplateExpression(tag, typeArguments, template) { - var node = createBaseExpression(210 /* SyntaxKind.TaggedTemplateExpression */); + var node = createBaseExpression(212 /* SyntaxKind.TaggedTemplateExpression */); node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.template = template; @@ -24511,7 +24520,7 @@ var ts; } // @api function createTypeAssertion(type, expression) { - var node = createBaseExpression(211 /* SyntaxKind.TypeAssertionExpression */); + var node = createBaseExpression(213 /* SyntaxKind.TypeAssertionExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.type = type; node.transformFlags |= @@ -24529,7 +24538,7 @@ var ts; } // @api function createParenthesizedExpression(expression) { - var node = createBaseExpression(212 /* SyntaxKind.ParenthesizedExpression */); + var node = createBaseExpression(214 /* SyntaxKind.ParenthesizedExpression */); node.expression = expression; node.transformFlags = propagateChildFlags(node.expression); return node; @@ -24542,13 +24551,13 @@ var ts; } // @api function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(213 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(215 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.asteriskToken); if (node.typeParameters) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -24575,13 +24584,13 @@ var ts; } // @api function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createBaseFunctionLikeDeclaration(214 /* SyntaxKind.ArrowFunction */, modifiers, + var node = createBaseFunctionLikeDeclaration(216 /* SyntaxKind.ArrowFunction */, modifiers, /*name*/ undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* SyntaxKind.EqualsGreaterThanToken */); node.transformFlags |= propagateChildFlags(node.equalsGreaterThanToken) | 1024 /* TransformFlags.ContainsES2015 */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { node.transformFlags |= 256 /* TransformFlags.ContainsES2017 */ | 16384 /* TransformFlags.ContainsLexicalThis */; } return node; @@ -24599,7 +24608,7 @@ var ts; } // @api function createDeleteExpression(expression) { - var node = createBaseExpression(215 /* SyntaxKind.DeleteExpression */); + var node = createBaseExpression(217 /* SyntaxKind.DeleteExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24612,7 +24621,7 @@ var ts; } // @api function createTypeOfExpression(expression) { - var node = createBaseExpression(216 /* SyntaxKind.TypeOfExpression */); + var node = createBaseExpression(218 /* SyntaxKind.TypeOfExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24625,7 +24634,7 @@ var ts; } // @api function createVoidExpression(expression) { - var node = createBaseExpression(217 /* SyntaxKind.VoidExpression */); + var node = createBaseExpression(219 /* SyntaxKind.VoidExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24638,7 +24647,7 @@ var ts; } // @api function createAwaitExpression(expression) { - var node = createBaseExpression(218 /* SyntaxKind.AwaitExpression */); + var node = createBaseExpression(220 /* SyntaxKind.AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24655,7 +24664,7 @@ var ts; } // @api function createPrefixUnaryExpression(operator, operand) { - var node = createBaseExpression(219 /* SyntaxKind.PrefixUnaryExpression */); + var node = createBaseExpression(221 /* SyntaxKind.PrefixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24677,7 +24686,7 @@ var ts; } // @api function createPostfixUnaryExpression(operand, operator) { - var node = createBaseExpression(220 /* SyntaxKind.PostfixUnaryExpression */); + var node = createBaseExpression(222 /* SyntaxKind.PostfixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24698,7 +24707,7 @@ var ts; } // @api function createBinaryExpression(left, operator, right) { - var node = createBaseExpression(221 /* SyntaxKind.BinaryExpression */); + var node = createBaseExpression(223 /* SyntaxKind.BinaryExpression */); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = parenthesizerRules().parenthesizeLeftSideOfBinary(operatorKind, left); @@ -24770,7 +24779,7 @@ var ts; } // @api function createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse) { - var node = createBaseExpression(222 /* SyntaxKind.ConditionalExpression */); + var node = createBaseExpression(224 /* SyntaxKind.ConditionalExpression */); node.condition = parenthesizerRules().parenthesizeConditionOfConditionalExpression(condition); node.questionToken = questionToken !== null && questionToken !== void 0 ? questionToken : createToken(57 /* SyntaxKind.QuestionToken */); node.whenTrue = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenTrue); @@ -24796,7 +24805,7 @@ var ts; } // @api function createTemplateExpression(head, templateSpans) { - var node = createBaseExpression(223 /* SyntaxKind.TemplateExpression */); + var node = createBaseExpression(225 /* SyntaxKind.TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= @@ -24866,7 +24875,7 @@ var ts; // @api function createYieldExpression(asteriskToken, expression) { ts.Debug.assert(!asteriskToken || !!expression, "A `YieldExpression` with an asteriskToken must have an expression."); - var node = createBaseExpression(224 /* SyntaxKind.YieldExpression */); + var node = createBaseExpression(226 /* SyntaxKind.YieldExpression */); node.expression = expression && parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.asteriskToken = asteriskToken; node.transformFlags |= @@ -24886,7 +24895,7 @@ var ts; } // @api function createSpreadElement(expression) { - var node = createBaseExpression(225 /* SyntaxKind.SpreadElement */); + var node = createBaseExpression(227 /* SyntaxKind.SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24902,7 +24911,7 @@ var ts; } // @api function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(226 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(228 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -24918,11 +24927,11 @@ var ts; } // @api function createOmittedExpression() { - return createBaseExpression(227 /* SyntaxKind.OmittedExpression */); + return createBaseExpression(229 /* SyntaxKind.OmittedExpression */); } // @api function createExpressionWithTypeArguments(expression, typeArguments) { - var node = createBaseNode(228 /* SyntaxKind.ExpressionWithTypeArguments */); + var node = createBaseNode(230 /* SyntaxKind.ExpressionWithTypeArguments */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= @@ -24940,7 +24949,7 @@ var ts; } // @api function createAsExpression(expression, type) { - var node = createBaseExpression(229 /* SyntaxKind.AsExpression */); + var node = createBaseExpression(231 /* SyntaxKind.AsExpression */); node.expression = expression; node.type = type; node.transformFlags |= @@ -24958,7 +24967,7 @@ var ts; } // @api function createNonNullExpression(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24975,8 +24984,26 @@ var ts; : node; } // @api + function createSatisfiesExpression(expression, type) { + var node = createBaseExpression(235 /* SyntaxKind.SatisfiesExpression */); + node.expression = expression; + node.type = type; + node.transformFlags |= + propagateChildFlags(node.expression) | + propagateChildFlags(node.type) | + 1 /* TransformFlags.ContainsTypeScript */; + return node; + } + // @api + function updateSatisfiesExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? update(createSatisfiesExpression(expression, type), node) + : node; + } + // @api function createNonNullChain(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.transformFlags |= @@ -24993,7 +25020,7 @@ var ts; } // @api function createMetaProperty(keywordToken, name) { - var node = createBaseExpression(231 /* SyntaxKind.MetaProperty */); + var node = createBaseExpression(233 /* SyntaxKind.MetaProperty */); node.keywordToken = keywordToken; node.name = name; node.transformFlags |= propagateChildFlags(node.name); @@ -25020,7 +25047,7 @@ var ts; // // @api function createTemplateSpan(expression, literal) { - var node = createBaseNode(233 /* SyntaxKind.TemplateSpan */); + var node = createBaseNode(236 /* SyntaxKind.TemplateSpan */); node.expression = expression; node.literal = literal; node.transformFlags |= @@ -25038,7 +25065,7 @@ var ts; } // @api function createSemicolonClassElement() { - var node = createBaseNode(234 /* SyntaxKind.SemicolonClassElement */); + var node = createBaseNode(237 /* SyntaxKind.SemicolonClassElement */); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -25047,7 +25074,7 @@ var ts; // // @api function createBlock(statements, multiLine) { - var node = createBaseNode(235 /* SyntaxKind.Block */); + var node = createBaseNode(238 /* SyntaxKind.Block */); node.statements = createNodeArray(statements); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.statements); @@ -25061,7 +25088,7 @@ var ts; } // @api function createVariableStatement(modifiers, declarationList) { - var node = createBaseDeclaration(237 /* SyntaxKind.VariableStatement */); + var node = createBaseDeclaration(240 /* SyntaxKind.VariableStatement */); node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; node.transformFlags |= @@ -25081,11 +25108,11 @@ var ts; } // @api function createEmptyStatement() { - return createBaseNode(236 /* SyntaxKind.EmptyStatement */); + return createBaseNode(239 /* SyntaxKind.EmptyStatement */); } // @api function createExpressionStatement(expression) { - var node = createBaseNode(238 /* SyntaxKind.ExpressionStatement */); + var node = createBaseNode(241 /* SyntaxKind.ExpressionStatement */); node.expression = parenthesizerRules().parenthesizeExpressionOfExpressionStatement(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -25098,7 +25125,7 @@ var ts; } // @api function createIfStatement(expression, thenStatement, elseStatement) { - var node = createBaseNode(239 /* SyntaxKind.IfStatement */); + var node = createBaseNode(242 /* SyntaxKind.IfStatement */); node.expression = expression; node.thenStatement = asEmbeddedStatement(thenStatement); node.elseStatement = asEmbeddedStatement(elseStatement); @@ -25118,7 +25145,7 @@ var ts; } // @api function createDoStatement(statement, expression) { - var node = createBaseNode(240 /* SyntaxKind.DoStatement */); + var node = createBaseNode(243 /* SyntaxKind.DoStatement */); node.statement = asEmbeddedStatement(statement); node.expression = expression; node.transformFlags |= @@ -25135,7 +25162,7 @@ var ts; } // @api function createWhileStatement(expression, statement) { - var node = createBaseNode(241 /* SyntaxKind.WhileStatement */); + var node = createBaseNode(244 /* SyntaxKind.WhileStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25152,7 +25179,7 @@ var ts; } // @api function createForStatement(initializer, condition, incrementor, statement) { - var node = createBaseNode(242 /* SyntaxKind.ForStatement */); + var node = createBaseNode(245 /* SyntaxKind.ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -25175,7 +25202,7 @@ var ts; } // @api function createForInStatement(initializer, expression, statement) { - var node = createBaseNode(243 /* SyntaxKind.ForInStatement */); + var node = createBaseNode(246 /* SyntaxKind.ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = asEmbeddedStatement(statement); @@ -25195,7 +25222,7 @@ var ts; } // @api function createForOfStatement(awaitModifier, initializer, expression, statement) { - var node = createBaseNode(244 /* SyntaxKind.ForOfStatement */); + var node = createBaseNode(247 /* SyntaxKind.ForOfStatement */); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); @@ -25221,7 +25248,7 @@ var ts; } // @api function createContinueStatement(label) { - var node = createBaseNode(245 /* SyntaxKind.ContinueStatement */); + var node = createBaseNode(248 /* SyntaxKind.ContinueStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25236,7 +25263,7 @@ var ts; } // @api function createBreakStatement(label) { - var node = createBaseNode(246 /* SyntaxKind.BreakStatement */); + var node = createBaseNode(249 /* SyntaxKind.BreakStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25251,7 +25278,7 @@ var ts; } // @api function createReturnStatement(expression) { - var node = createBaseNode(247 /* SyntaxKind.ReturnStatement */); + var node = createBaseNode(250 /* SyntaxKind.ReturnStatement */); node.expression = expression; // return in an ES2018 async generator must be awaited node.transformFlags |= @@ -25268,7 +25295,7 @@ var ts; } // @api function createWithStatement(expression, statement) { - var node = createBaseNode(248 /* SyntaxKind.WithStatement */); + var node = createBaseNode(251 /* SyntaxKind.WithStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25285,7 +25312,7 @@ var ts; } // @api function createSwitchStatement(expression, caseBlock) { - var node = createBaseNode(249 /* SyntaxKind.SwitchStatement */); + var node = createBaseNode(252 /* SyntaxKind.SwitchStatement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.caseBlock = caseBlock; node.transformFlags |= @@ -25302,7 +25329,7 @@ var ts; } // @api function createLabeledStatement(label, statement) { - var node = createBaseNode(250 /* SyntaxKind.LabeledStatement */); + var node = createBaseNode(253 /* SyntaxKind.LabeledStatement */); node.label = asName(label); node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25319,7 +25346,7 @@ var ts; } // @api function createThrowStatement(expression) { - var node = createBaseNode(251 /* SyntaxKind.ThrowStatement */); + var node = createBaseNode(254 /* SyntaxKind.ThrowStatement */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -25332,7 +25359,7 @@ var ts; } // @api function createTryStatement(tryBlock, catchClause, finallyBlock) { - var node = createBaseNode(252 /* SyntaxKind.TryStatement */); + var node = createBaseNode(255 /* SyntaxKind.TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -25352,11 +25379,11 @@ var ts; } // @api function createDebuggerStatement() { - return createBaseNode(253 /* SyntaxKind.DebuggerStatement */); + return createBaseNode(256 /* SyntaxKind.DebuggerStatement */); } // @api function createVariableDeclaration(name, exclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(254 /* SyntaxKind.VariableDeclaration */, + var node = createBaseVariableLikeDeclaration(257 /* SyntaxKind.VariableDeclaration */, /*modifiers*/ undefined, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.exclamationToken = exclamationToken; node.transformFlags |= propagateChildFlags(node.exclamationToken); @@ -25377,7 +25404,7 @@ var ts; // @api function createVariableDeclarationList(declarations, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseNode(255 /* SyntaxKind.VariableDeclarationList */); + var node = createBaseNode(258 /* SyntaxKind.VariableDeclarationList */); node.flags |= flags & 3 /* NodeFlags.BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= @@ -25398,7 +25425,7 @@ var ts; } // @api function createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(256 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(259 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; if (!node.body || ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -25407,7 +25434,7 @@ var ts; node.transformFlags |= propagateChildFlags(node.asteriskToken) | 4194304 /* TransformFlags.ContainsHoistedDeclarationOrCompletion */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -25444,7 +25471,7 @@ var ts; } // @api function createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(257 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(260 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); if (ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; } @@ -25468,7 +25495,7 @@ var ts; } // @api function createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseInterfaceOrClassLikeDeclaration(258 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); + var node = createBaseInterfaceOrClassLikeDeclaration(261 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25493,7 +25520,7 @@ var ts; } // @api function createTypeAliasDeclaration(modifiers, name, typeParameters, type) { - var node = createBaseGenericNamedDeclaration(259 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); + var node = createBaseGenericNamedDeclaration(262 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25517,7 +25544,7 @@ var ts; } // @api function createEnumDeclaration(modifiers, name, members) { - var node = createBaseNamedDeclaration(260 /* SyntaxKind.EnumDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(263 /* SyntaxKind.EnumDeclaration */, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= propagateChildrenFlags(node.members) | @@ -25544,7 +25571,7 @@ var ts; // @api function createModuleDeclaration(modifiers, name, body, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseDeclaration(261 /* SyntaxKind.ModuleDeclaration */); + var node = createBaseDeclaration(264 /* SyntaxKind.ModuleDeclaration */); node.modifiers = asNodeArray(modifiers); node.flags |= flags & (16 /* NodeFlags.Namespace */ | 4 /* NodeFlags.NestedNamespace */ | 1024 /* NodeFlags.GlobalAugmentation */); node.name = name; @@ -25580,7 +25607,7 @@ var ts; } // @api function createModuleBlock(statements) { - var node = createBaseNode(262 /* SyntaxKind.ModuleBlock */); + var node = createBaseNode(265 /* SyntaxKind.ModuleBlock */); node.statements = createNodeArray(statements); node.transformFlags |= propagateChildrenFlags(node.statements); return node; @@ -25593,7 +25620,7 @@ var ts; } // @api function createCaseBlock(clauses) { - var node = createBaseNode(263 /* SyntaxKind.CaseBlock */); + var node = createBaseNode(266 /* SyntaxKind.CaseBlock */); node.clauses = createNodeArray(clauses); node.transformFlags |= propagateChildrenFlags(node.clauses); return node; @@ -25606,7 +25633,7 @@ var ts; } // @api function createNamespaceExportDeclaration(name) { - var node = createBaseNamedDeclaration(264 /* SyntaxKind.NamespaceExportDeclaration */, + var node = createBaseNamedDeclaration(267 /* SyntaxKind.NamespaceExportDeclaration */, /*modifiers*/ undefined, name); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25629,7 +25656,7 @@ var ts; } // @api function createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference) { - var node = createBaseNamedDeclaration(265 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(268 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); node.isTypeOnly = isTypeOnly; node.moduleReference = moduleReference; node.transformFlags |= propagateChildFlags(node.moduleReference); @@ -25657,7 +25684,7 @@ var ts; } // @api function createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(266 /* SyntaxKind.ImportDeclaration */); + var node = createBaseDeclaration(269 /* SyntaxKind.ImportDeclaration */); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; @@ -25687,7 +25714,7 @@ var ts; } // @api function createImportClause(isTypeOnly, name, namedBindings) { - var node = createBaseNode(267 /* SyntaxKind.ImportClause */); + var node = createBaseNode(270 /* SyntaxKind.ImportClause */); node.isTypeOnly = isTypeOnly; node.name = name; node.namedBindings = namedBindings; @@ -25710,7 +25737,7 @@ var ts; } // @api function createAssertClause(elements, multiLine) { - var node = createBaseNode(293 /* SyntaxKind.AssertClause */); + var node = createBaseNode(296 /* SyntaxKind.AssertClause */); node.elements = createNodeArray(elements); node.multiLine = multiLine; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25725,7 +25752,7 @@ var ts; } // @api function createAssertEntry(name, value) { - var node = createBaseNode(294 /* SyntaxKind.AssertEntry */); + var node = createBaseNode(297 /* SyntaxKind.AssertEntry */); node.name = name; node.value = value; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25740,7 +25767,7 @@ var ts; } // @api function createImportTypeAssertionContainer(clause, multiLine) { - var node = createBaseNode(295 /* SyntaxKind.ImportTypeAssertionContainer */); + var node = createBaseNode(298 /* SyntaxKind.ImportTypeAssertionContainer */); node.assertClause = clause; node.multiLine = multiLine; return node; @@ -25754,7 +25781,7 @@ var ts; } // @api function createNamespaceImport(name) { - var node = createBaseNode(268 /* SyntaxKind.NamespaceImport */); + var node = createBaseNode(271 /* SyntaxKind.NamespaceImport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25768,7 +25795,7 @@ var ts; } // @api function createNamespaceExport(name) { - var node = createBaseNode(274 /* SyntaxKind.NamespaceExport */); + var node = createBaseNode(277 /* SyntaxKind.NamespaceExport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name) | @@ -25784,7 +25811,7 @@ var ts; } // @api function createNamedImports(elements) { - var node = createBaseNode(269 /* SyntaxKind.NamedImports */); + var node = createBaseNode(272 /* SyntaxKind.NamedImports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25798,7 +25825,7 @@ var ts; } // @api function createImportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(270 /* SyntaxKind.ImportSpecifier */); + var node = createBaseNode(273 /* SyntaxKind.ImportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = propertyName; node.name = name; @@ -25818,7 +25845,7 @@ var ts; } // @api function createExportAssignment(modifiers, isExportEquals, expression) { - var node = createBaseDeclaration(271 /* SyntaxKind.ExportAssignment */); + var node = createBaseDeclaration(274 /* SyntaxKind.ExportAssignment */); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = isExportEquals @@ -25845,7 +25872,7 @@ var ts; } // @api function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(272 /* SyntaxKind.ExportDeclaration */); + var node = createBaseDeclaration(275 /* SyntaxKind.ExportDeclaration */); node.modifiers = asNodeArray(modifiers); node.isTypeOnly = isTypeOnly; node.exportClause = exportClause; @@ -25878,7 +25905,7 @@ var ts; } // @api function createNamedExports(elements) { - var node = createBaseNode(273 /* SyntaxKind.NamedExports */); + var node = createBaseNode(276 /* SyntaxKind.NamedExports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25892,7 +25919,7 @@ var ts; } // @api function createExportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(275 /* SyntaxKind.ExportSpecifier */); + var node = createBaseNode(278 /* SyntaxKind.ExportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = asName(propertyName); node.name = asName(name); @@ -25912,7 +25939,7 @@ var ts; } // @api function createMissingDeclaration() { - var node = createBaseDeclaration(276 /* SyntaxKind.MissingDeclaration */); + var node = createBaseDeclaration(279 /* SyntaxKind.MissingDeclaration */); return node; } // @@ -25920,7 +25947,7 @@ var ts; // // @api function createExternalModuleReference(expression) { - var node = createBaseNode(277 /* SyntaxKind.ExternalModuleReference */); + var node = createBaseNode(280 /* SyntaxKind.ExternalModuleReference */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25978,7 +26005,7 @@ var ts; } // @api function createJSDocFunctionType(parameters, type) { - var node = createBaseSignatureDeclaration(317 /* SyntaxKind.JSDocFunctionType */, + var node = createBaseSignatureDeclaration(320 /* SyntaxKind.JSDocFunctionType */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); @@ -25994,7 +26021,7 @@ var ts; // @api function createJSDocTypeLiteral(propertyTags, isArrayType) { if (isArrayType === void 0) { isArrayType = false; } - var node = createBaseNode(322 /* SyntaxKind.JSDocTypeLiteral */); + var node = createBaseNode(325 /* SyntaxKind.JSDocTypeLiteral */); node.jsDocPropertyTags = asNodeArray(propertyTags); node.isArrayType = isArrayType; return node; @@ -26008,7 +26035,7 @@ var ts; } // @api function createJSDocTypeExpression(type) { - var node = createBaseNode(309 /* SyntaxKind.JSDocTypeExpression */); + var node = createBaseNode(312 /* SyntaxKind.JSDocTypeExpression */); node.type = type; return node; } @@ -26020,7 +26047,7 @@ var ts; } // @api function createJSDocSignature(typeParameters, parameters, type) { - var node = createBaseNode(323 /* SyntaxKind.JSDocSignature */); + var node = createBaseNode(326 /* SyntaxKind.JSDocSignature */); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; @@ -26049,7 +26076,7 @@ var ts; } // @api function createJSDocTemplateTag(tagName, constraint, typeParameters, comment) { - var node = createBaseJSDocTag(344 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); + var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); return node; @@ -26066,7 +26093,7 @@ var ts; } // @api function createJSDocTypedefTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(345 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); + var node = createBaseJSDocTag(348 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -26084,7 +26111,7 @@ var ts; } // @api function createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(340 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); + var node = createBaseJSDocTag(343 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -26105,7 +26132,7 @@ var ts; } // @api function createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); + var node = createBaseJSDocTag(350 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -26126,7 +26153,7 @@ var ts; } // @api function createJSDocCallbackTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(338 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); + var node = createBaseJSDocTag(341 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -26144,7 +26171,7 @@ var ts; } // @api function createJSDocAugmentsTag(tagName, className, comment) { - var node = createBaseJSDocTag(328 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); + var node = createBaseJSDocTag(331 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); node.class = className; return node; } @@ -26159,13 +26186,13 @@ var ts; } // @api function createJSDocImplementsTag(tagName, className, comment) { - var node = createBaseJSDocTag(329 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); + var node = createBaseJSDocTag(332 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); node.class = className; return node; } // @api function createJSDocSeeTag(tagName, name, comment) { - var node = createBaseJSDocTag(346 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); + var node = createBaseJSDocTag(349 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); node.name = name; return node; } @@ -26179,7 +26206,7 @@ var ts; } // @api function createJSDocNameReference(name) { - var node = createBaseNode(310 /* SyntaxKind.JSDocNameReference */); + var node = createBaseNode(313 /* SyntaxKind.JSDocNameReference */); node.name = name; return node; } @@ -26191,7 +26218,7 @@ var ts; } // @api function createJSDocMemberName(left, right) { - var node = createBaseNode(311 /* SyntaxKind.JSDocMemberName */); + var node = createBaseNode(314 /* SyntaxKind.JSDocMemberName */); node.left = left; node.right = right; node.transformFlags |= @@ -26208,7 +26235,7 @@ var ts; } // @api function createJSDocLink(name, text) { - var node = createBaseNode(324 /* SyntaxKind.JSDocLink */); + var node = createBaseNode(327 /* SyntaxKind.JSDocLink */); node.name = name; node.text = text; return node; @@ -26221,7 +26248,7 @@ var ts; } // @api function createJSDocLinkCode(name, text) { - var node = createBaseNode(325 /* SyntaxKind.JSDocLinkCode */); + var node = createBaseNode(328 /* SyntaxKind.JSDocLinkCode */); node.name = name; node.text = text; return node; @@ -26234,7 +26261,7 @@ var ts; } // @api function createJSDocLinkPlain(name, text) { - var node = createBaseNode(326 /* SyntaxKind.JSDocLinkPlain */); + var node = createBaseNode(329 /* SyntaxKind.JSDocLinkPlain */); node.name = name; node.text = text; return node; @@ -26306,7 +26333,7 @@ var ts; } // @api function createJSDocUnknownTag(tagName, comment) { - var node = createBaseJSDocTag(327 /* SyntaxKind.JSDocTag */, tagName, comment); + var node = createBaseJSDocTag(330 /* SyntaxKind.JSDocTag */, tagName, comment); return node; } // @api @@ -26318,7 +26345,7 @@ var ts; } // @api function createJSDocText(text) { - var node = createBaseNode(321 /* SyntaxKind.JSDocText */); + var node = createBaseNode(324 /* SyntaxKind.JSDocText */); node.text = text; return node; } @@ -26330,7 +26357,7 @@ var ts; } // @api function createJSDocComment(comment, tags) { - var node = createBaseNode(320 /* SyntaxKind.JSDoc */); + var node = createBaseNode(323 /* SyntaxKind.JSDoc */); node.comment = comment; node.tags = asNodeArray(tags); return node; @@ -26347,7 +26374,7 @@ var ts; // // @api function createJsxElement(openingElement, children, closingElement) { - var node = createBaseNode(278 /* SyntaxKind.JsxElement */); + var node = createBaseNode(281 /* SyntaxKind.JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -26368,7 +26395,7 @@ var ts; } // @api function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createBaseNode(279 /* SyntaxKind.JsxSelfClosingElement */); + var node = createBaseNode(282 /* SyntaxKind.JsxSelfClosingElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26392,7 +26419,7 @@ var ts; } // @api function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createBaseNode(280 /* SyntaxKind.JsxOpeningElement */); + var node = createBaseNode(283 /* SyntaxKind.JsxOpeningElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26416,7 +26443,7 @@ var ts; } // @api function createJsxClosingElement(tagName) { - var node = createBaseNode(281 /* SyntaxKind.JsxClosingElement */); + var node = createBaseNode(284 /* SyntaxKind.JsxClosingElement */); node.tagName = tagName; node.transformFlags |= propagateChildFlags(node.tagName) | @@ -26431,7 +26458,7 @@ var ts; } // @api function createJsxFragment(openingFragment, children, closingFragment) { - var node = createBaseNode(282 /* SyntaxKind.JsxFragment */); + var node = createBaseNode(285 /* SyntaxKind.JsxFragment */); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -26467,19 +26494,19 @@ var ts; } // @api function createJsxOpeningFragment() { - var node = createBaseNode(283 /* SyntaxKind.JsxOpeningFragment */); + var node = createBaseNode(286 /* SyntaxKind.JsxOpeningFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxJsxClosingFragment() { - var node = createBaseNode(284 /* SyntaxKind.JsxClosingFragment */); + var node = createBaseNode(287 /* SyntaxKind.JsxClosingFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxAttribute(name, initializer) { - var node = createBaseNode(285 /* SyntaxKind.JsxAttribute */); + var node = createBaseNode(288 /* SyntaxKind.JsxAttribute */); node.name = name; node.initializer = initializer; node.transformFlags |= @@ -26497,7 +26524,7 @@ var ts; } // @api function createJsxAttributes(properties) { - var node = createBaseNode(286 /* SyntaxKind.JsxAttributes */); + var node = createBaseNode(289 /* SyntaxKind.JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= propagateChildrenFlags(node.properties) | @@ -26512,7 +26539,7 @@ var ts; } // @api function createJsxSpreadAttribute(expression) { - var node = createBaseNode(287 /* SyntaxKind.JsxSpreadAttribute */); + var node = createBaseNode(290 /* SyntaxKind.JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | @@ -26527,7 +26554,7 @@ var ts; } // @api function createJsxExpression(dotDotDotToken, expression) { - var node = createBaseNode(288 /* SyntaxKind.JsxExpression */); + var node = createBaseNode(291 /* SyntaxKind.JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; node.transformFlags |= @@ -26547,7 +26574,7 @@ var ts; // // @api function createCaseClause(expression, statements) { - var node = createBaseNode(289 /* SyntaxKind.CaseClause */); + var node = createBaseNode(292 /* SyntaxKind.CaseClause */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.statements = createNodeArray(statements); node.transformFlags |= @@ -26564,7 +26591,7 @@ var ts; } // @api function createDefaultClause(statements) { - var node = createBaseNode(290 /* SyntaxKind.DefaultClause */); + var node = createBaseNode(293 /* SyntaxKind.DefaultClause */); node.statements = createNodeArray(statements); node.transformFlags = propagateChildrenFlags(node.statements); return node; @@ -26577,7 +26604,7 @@ var ts; } // @api function createHeritageClause(token, types) { - var node = createBaseNode(291 /* SyntaxKind.HeritageClause */); + var node = createBaseNode(294 /* SyntaxKind.HeritageClause */); node.token = token; node.types = createNodeArray(types); node.transformFlags |= propagateChildrenFlags(node.types); @@ -26601,7 +26628,7 @@ var ts; } // @api function createCatchClause(variableDeclaration, block) { - var node = createBaseNode(292 /* SyntaxKind.CatchClause */); + var node = createBaseNode(295 /* SyntaxKind.CatchClause */); if (typeof variableDeclaration === "string" || variableDeclaration && !ts.isVariableDeclaration(variableDeclaration)) { variableDeclaration = createVariableDeclaration(variableDeclaration, /*exclamationToken*/ undefined, @@ -26629,7 +26656,7 @@ var ts; // // @api function createPropertyAssignment(name, initializer) { - var node = createBaseNamedDeclaration(296 /* SyntaxKind.PropertyAssignment */, + var node = createBaseNamedDeclaration(299 /* SyntaxKind.PropertyAssignment */, /*modifiers*/ undefined, name); node.initializer = parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26661,7 +26688,7 @@ var ts; } // @api function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createBaseNamedDeclaration(297 /* SyntaxKind.ShorthandPropertyAssignment */, + var node = createBaseNamedDeclaration(300 /* SyntaxKind.ShorthandPropertyAssignment */, /*modifiers*/ undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= @@ -26695,7 +26722,7 @@ var ts; } // @api function createSpreadAssignment(expression) { - var node = createBaseNode(298 /* SyntaxKind.SpreadAssignment */); + var node = createBaseNode(301 /* SyntaxKind.SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -26714,7 +26741,7 @@ var ts; // // @api function createEnumMember(name, initializer) { - var node = createBaseNode(299 /* SyntaxKind.EnumMember */); + var node = createBaseNode(302 /* SyntaxKind.EnumMember */); node.name = asName(name); node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26735,7 +26762,7 @@ var ts; // // @api function createSourceFile(statements, endOfFileToken, flags) { - var node = baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */); + var node = baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */); node.statements = createNodeArray(statements); node.endOfFileToken = endOfFileToken; node.flags |= flags; @@ -26752,7 +26779,7 @@ var ts; return node; } function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) { - var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */)); + var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */)); for (var p in source) { if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p)) continue; @@ -26791,7 +26818,7 @@ var ts; // @api function createBundle(sourceFiles, prepends) { if (prepends === void 0) { prepends = ts.emptyArray; } - var node = createBaseNode(306 /* SyntaxKind.Bundle */); + var node = createBaseNode(309 /* SyntaxKind.Bundle */); node.prepends = prepends; node.sourceFiles = sourceFiles; return node; @@ -26806,7 +26833,7 @@ var ts; } // @api function createUnparsedSource(prologues, syntheticReferences, texts) { - var node = createBaseNode(307 /* SyntaxKind.UnparsedSource */); + var node = createBaseNode(310 /* SyntaxKind.UnparsedSource */); node.prologues = prologues; node.syntheticReferences = syntheticReferences; node.texts = texts; @@ -26824,28 +26851,28 @@ var ts; } // @api function createUnparsedPrologue(data) { - return createBaseUnparsedNode(300 /* SyntaxKind.UnparsedPrologue */, data); + return createBaseUnparsedNode(303 /* SyntaxKind.UnparsedPrologue */, data); } // @api function createUnparsedPrepend(data, texts) { - var node = createBaseUnparsedNode(301 /* SyntaxKind.UnparsedPrepend */, data); + var node = createBaseUnparsedNode(304 /* SyntaxKind.UnparsedPrepend */, data); node.texts = texts; return node; } // @api function createUnparsedTextLike(data, internal) { - return createBaseUnparsedNode(internal ? 303 /* SyntaxKind.UnparsedInternalText */ : 302 /* SyntaxKind.UnparsedText */, data); + return createBaseUnparsedNode(internal ? 306 /* SyntaxKind.UnparsedInternalText */ : 305 /* SyntaxKind.UnparsedText */, data); } // @api function createUnparsedSyntheticReference(section) { - var node = createBaseNode(304 /* SyntaxKind.UnparsedSyntheticReference */); + var node = createBaseNode(307 /* SyntaxKind.UnparsedSyntheticReference */); node.data = section.data; node.section = section; return node; } // @api function createInputFiles() { - var node = createBaseNode(308 /* SyntaxKind.InputFiles */); + var node = createBaseNode(311 /* SyntaxKind.InputFiles */); node.javascriptText = ""; node.declarationText = ""; return node; @@ -26856,7 +26883,7 @@ var ts; // @api function createSyntheticExpression(type, isSpread, tupleNameSource) { if (isSpread === void 0) { isSpread = false; } - var node = createBaseNode(232 /* SyntaxKind.SyntheticExpression */); + var node = createBaseNode(234 /* SyntaxKind.SyntheticExpression */); node.type = type; node.isSpread = isSpread; node.tupleNameSource = tupleNameSource; @@ -26864,7 +26891,7 @@ var ts; } // @api function createSyntaxList(children) { - var node = createBaseNode(348 /* SyntaxKind.SyntaxList */); + var node = createBaseNode(351 /* SyntaxKind.SyntaxList */); node._children = children; return node; } @@ -26879,7 +26906,7 @@ var ts; */ // @api function createNotEmittedStatement(original) { - var node = createBaseNode(349 /* SyntaxKind.NotEmittedStatement */); + var node = createBaseNode(352 /* SyntaxKind.NotEmittedStatement */); node.original = original; ts.setTextRange(node, original); return node; @@ -26893,7 +26920,7 @@ var ts; */ // @api function createPartiallyEmittedExpression(expression, original) { - var node = createBaseNode(350 /* SyntaxKind.PartiallyEmittedExpression */); + var node = createBaseNode(353 /* SyntaxKind.PartiallyEmittedExpression */); node.expression = expression; node.original = original; node.transformFlags |= @@ -26921,7 +26948,7 @@ var ts; } // @api function createCommaListExpression(elements) { - var node = createBaseNode(351 /* SyntaxKind.CommaListExpression */); + var node = createBaseNode(354 /* SyntaxKind.CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); node.transformFlags |= propagateChildrenFlags(node.elements); return node; @@ -26938,7 +26965,7 @@ var ts; */ // @api function createEndOfDeclarationMarker(original) { - var node = createBaseNode(353 /* SyntaxKind.EndOfDeclarationMarker */); + var node = createBaseNode(356 /* SyntaxKind.EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -26949,14 +26976,14 @@ var ts; */ // @api function createMergeDeclarationMarker(original) { - var node = createBaseNode(352 /* SyntaxKind.MergeDeclarationMarker */); + var node = createBaseNode(355 /* SyntaxKind.MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; } // @api function createSyntheticReferenceExpression(expression, thisArg) { - var node = createBaseNode(354 /* SyntaxKind.SyntheticReferenceExpression */); + var node = createBaseNode(357 /* SyntaxKind.SyntheticReferenceExpression */); node.expression = expression; node.thisArg = thisArg; node.transformFlags |= @@ -26978,7 +27005,7 @@ var ts; if (node === undefined) { return node; } - var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */) : + var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */) : ts.isIdentifier(node) ? baseFactory.createBaseIdentifierNode(79 /* SyntaxKind.Identifier */) : ts.isPrivateIdentifier(node) ? baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */) : !ts.isNodeKind(node.kind) ? baseFactory.createBaseTokenNode(node.kind) : @@ -26987,7 +27014,7 @@ var ts; clone.transformFlags = node.transformFlags; setOriginalNode(clone, node); for (var key in node) { - if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) { continue; } clone[key] = node[key]; @@ -27095,11 +27122,12 @@ var ts; } function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); - case 211 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 229 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); - case 230 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); + case 214 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); + case 213 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 231 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); + case 235 /* SyntaxKind.SatisfiesExpression */: return updateSatisfiesExpression(outerExpression, expression, outerExpression.type); + case 232 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -27153,13 +27181,13 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: return false; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -27585,24 +27613,24 @@ var ts; } function getDefaultTagNameForKind(kind) { switch (kind) { - case 343 /* SyntaxKind.JSDocTypeTag */: return "type"; - case 341 /* SyntaxKind.JSDocReturnTag */: return "returns"; - case 342 /* SyntaxKind.JSDocThisTag */: return "this"; - case 339 /* SyntaxKind.JSDocEnumTag */: return "enum"; - case 330 /* SyntaxKind.JSDocAuthorTag */: return "author"; - case 332 /* SyntaxKind.JSDocClassTag */: return "class"; - case 333 /* SyntaxKind.JSDocPublicTag */: return "public"; - case 334 /* SyntaxKind.JSDocPrivateTag */: return "private"; - case 335 /* SyntaxKind.JSDocProtectedTag */: return "protected"; - case 336 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; - case 337 /* SyntaxKind.JSDocOverrideTag */: return "override"; - case 344 /* SyntaxKind.JSDocTemplateTag */: return "template"; - case 345 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; - case 340 /* SyntaxKind.JSDocParameterTag */: return "param"; - case 347 /* SyntaxKind.JSDocPropertyTag */: return "prop"; - case 338 /* SyntaxKind.JSDocCallbackTag */: return "callback"; - case 328 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; - case 329 /* SyntaxKind.JSDocImplementsTag */: return "implements"; + case 346 /* SyntaxKind.JSDocTypeTag */: return "type"; + case 344 /* SyntaxKind.JSDocReturnTag */: return "returns"; + case 345 /* SyntaxKind.JSDocThisTag */: return "this"; + case 342 /* SyntaxKind.JSDocEnumTag */: return "enum"; + case 333 /* SyntaxKind.JSDocAuthorTag */: return "author"; + case 335 /* SyntaxKind.JSDocClassTag */: return "class"; + case 336 /* SyntaxKind.JSDocPublicTag */: return "public"; + case 337 /* SyntaxKind.JSDocPrivateTag */: return "private"; + case 338 /* SyntaxKind.JSDocProtectedTag */: return "protected"; + case 339 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; + case 340 /* SyntaxKind.JSDocOverrideTag */: return "override"; + case 347 /* SyntaxKind.JSDocTemplateTag */: return "template"; + case 348 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; + case 343 /* SyntaxKind.JSDocParameterTag */: return "param"; + case 350 /* SyntaxKind.JSDocPropertyTag */: return "prop"; + case 341 /* SyntaxKind.JSDocCallbackTag */: return "callback"; + case 331 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; + case 332 /* SyntaxKind.JSDocImplementsTag */: return "implements"; default: return ts.Debug.fail("Unsupported kind: ".concat(ts.Debug.formatSyntaxKind(kind))); } @@ -27618,11 +27646,9 @@ var ts; rawTextScanner.setText("`" + rawText + "`"); break; case 15 /* SyntaxKind.TemplateHead */: - // tslint:disable-next-line no-invalid-template-strings rawTextScanner.setText("`" + rawText + "${"); break; case 16 /* SyntaxKind.TemplateMiddle */: - // tslint:disable-next-line no-invalid-template-strings rawTextScanner.setText("}" + rawText + "${"); break; case 17 /* SyntaxKind.TemplateTail */: @@ -27682,69 +27708,70 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) { return -2 /* TransformFlags.TypeExcludes */; } switch (kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return -2147450880 /* TransformFlags.ArrayLiteralOrCallOrNewExcludes */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return -1941676032 /* TransformFlags.ModuleExcludes */; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return -2147483648 /* TransformFlags.ParameterExcludes */; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return -2072174592 /* TransformFlags.ArrowFunctionExcludes */; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return -1937940480 /* TransformFlags.FunctionExcludes */; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return -2146893824 /* TransformFlags.VariableDeclarationListExcludes */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return -2147344384 /* TransformFlags.ClassExcludes */; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return -1937948672 /* TransformFlags.ConstructorExcludes */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return -2013249536 /* TransformFlags.PropertyExcludes */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return -2005057536 /* TransformFlags.MethodOrAccessorExcludes */; - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 163 /* SyntaxKind.TypeParameter */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return -2 /* TransformFlags.TypeExcludes */; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return -2147278848 /* TransformFlags.ObjectLiteralExcludes */; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return -2147418112 /* TransformFlags.CatchClauseExcludes */; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return -2147450880 /* TransformFlags.BindingPatternExcludes */; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: case 106 /* SyntaxKind.SuperKeyword */: return -2147483648 /* TransformFlags.OuterExpressionExcludes */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return -2147483648 /* TransformFlags.PropertyAccessExcludes */; default: return -2147483648 /* TransformFlags.NodeExcludes */; @@ -27944,9 +27971,10 @@ var ts; }; var buildInfo_1; var getAndCacheBuildInfo_1 = function (getText) { + var _a; if (buildInfo_1 === undefined) { var result = getText(); - buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false; + buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false; } return buildInfo_1 || undefined; }; @@ -27979,7 +28007,6 @@ var ts; return node; } ts.createInputFiles = createInputFiles; - // tslint:disable-next-line variable-name var SourceMapSource; /** * Create an external source map source file reference @@ -28000,7 +28027,7 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine; + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine, snippetElement = sourceEmitNode.snippetElement; if (!destEmitNode) destEmitNode = {}; // We are using `.slice()` here in case `destEmitNode.leadingComments` is pushed to later. @@ -28026,6 +28053,8 @@ var ts; } if (startsOnNewLine !== undefined) destEmitNode.startsOnNewLine = startsOnNewLine; + if (snippetElement !== undefined) + destEmitNode.snippetElement = snippetElement; return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -28051,7 +28080,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = (_a = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)))) !== null && _a !== void 0 ? _a : ts.Debug.fail("Could not determine parsed source file."); @@ -28769,6 +28798,8 @@ var ts; // - The verb (`next`, `throw`, or `return` method) to delegate to the expression // of a `yield*`. // - The result of evaluating the verb delegated to the expression of a `yield*`. + // g A temporary variable that holds onto the generator object until the generator + // is started, allowing it to also act as the `suspendedStart` state. // // functions: // verb(n) Creates a bound callback to the `step` function for opcode `n`. @@ -28807,7 +28838,7 @@ var ts; importName: "__generator", scoped: false, priority: 6, - text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" + text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" }; // ES Module Helpers ts.createBindingHelper = { @@ -29129,22 +29160,22 @@ var ts; ts.isExportModifier = isExportModifier; /* @internal */ function isAsyncModifier(node) { - return node.kind === 131 /* SyntaxKind.AsyncKeyword */; + return node.kind === 132 /* SyntaxKind.AsyncKeyword */; } ts.isAsyncModifier = isAsyncModifier; /* @internal */ function isAssertsKeyword(node) { - return node.kind === 128 /* SyntaxKind.AssertsKeyword */; + return node.kind === 129 /* SyntaxKind.AssertsKeyword */; } ts.isAssertsKeyword = isAssertsKeyword; /* @internal */ function isAwaitKeyword(node) { - return node.kind === 132 /* SyntaxKind.AwaitKeyword */; + return node.kind === 133 /* SyntaxKind.AwaitKeyword */; } ts.isAwaitKeyword = isAwaitKeyword; /* @internal */ function isReadonlyKeyword(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */; } ts.isReadonlyKeyword = isReadonlyKeyword; /* @internal */ @@ -29159,9 +29190,14 @@ var ts; ts.isAbstractModifier = isAbstractModifier; /* @internal */ function isOverrideModifier(node) { - return node.kind === 159 /* SyntaxKind.OverrideKeyword */; + return node.kind === 161 /* SyntaxKind.OverrideKeyword */; } ts.isOverrideModifier = isOverrideModifier; + /* @internal */ + function isAccessorModifier(node) { + return node.kind === 127 /* SyntaxKind.AccessorKeyword */; + } + ts.isAccessorModifier = isAccessorModifier; /*@internal*/ function isSuperKeyword(node) { return node.kind === 106 /* SyntaxKind.SuperKeyword */; @@ -29174,605 +29210,609 @@ var ts; ts.isImportKeyword = isImportKeyword; // Names function isQualifiedName(node) { - return node.kind === 161 /* SyntaxKind.QualifiedName */; + return node.kind === 163 /* SyntaxKind.QualifiedName */; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return node.kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isComputedPropertyName = isComputedPropertyName; // Signature elements function isTypeParameterDeclaration(node) { - return node.kind === 163 /* SyntaxKind.TypeParameter */; + return node.kind === 165 /* SyntaxKind.TypeParameter */; } ts.isTypeParameterDeclaration = isTypeParameterDeclaration; // TODO(rbuckton): Rename to 'isParameterDeclaration' function isParameter(node) { - return node.kind === 164 /* SyntaxKind.Parameter */; + return node.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 165 /* SyntaxKind.Decorator */; + return node.kind === 167 /* SyntaxKind.Decorator */; } ts.isDecorator = isDecorator; // TypeMember function isPropertySignature(node) { - return node.kind === 166 /* SyntaxKind.PropertySignature */; + return node.kind === 168 /* SyntaxKind.PropertySignature */; } ts.isPropertySignature = isPropertySignature; function isPropertyDeclaration(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } ts.isPropertyDeclaration = isPropertyDeclaration; function isMethodSignature(node) { - return node.kind === 168 /* SyntaxKind.MethodSignature */; + return node.kind === 170 /* SyntaxKind.MethodSignature */; } ts.isMethodSignature = isMethodSignature; function isMethodDeclaration(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } ts.isMethodDeclaration = isMethodDeclaration; function isClassStaticBlockDeclaration(node) { - return node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } ts.isClassStaticBlockDeclaration = isClassStaticBlockDeclaration; function isConstructorDeclaration(node) { - return node.kind === 171 /* SyntaxKind.Constructor */; + return node.kind === 173 /* SyntaxKind.Constructor */; } ts.isConstructorDeclaration = isConstructorDeclaration; function isGetAccessorDeclaration(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessorDeclaration = isGetAccessorDeclaration; function isSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessorDeclaration = isSetAccessorDeclaration; function isCallSignatureDeclaration(node) { - return node.kind === 174 /* SyntaxKind.CallSignature */; + return node.kind === 176 /* SyntaxKind.CallSignature */; } ts.isCallSignatureDeclaration = isCallSignatureDeclaration; function isConstructSignatureDeclaration(node) { - return node.kind === 175 /* SyntaxKind.ConstructSignature */; + return node.kind === 177 /* SyntaxKind.ConstructSignature */; } ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration; function isIndexSignatureDeclaration(node) { - return node.kind === 176 /* SyntaxKind.IndexSignature */; + return node.kind === 178 /* SyntaxKind.IndexSignature */; } ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration; // Type function isTypePredicateNode(node) { - return node.kind === 177 /* SyntaxKind.TypePredicate */; + return node.kind === 179 /* SyntaxKind.TypePredicate */; } ts.isTypePredicateNode = isTypePredicateNode; function isTypeReferenceNode(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */; + return node.kind === 180 /* SyntaxKind.TypeReference */; } ts.isTypeReferenceNode = isTypeReferenceNode; function isFunctionTypeNode(node) { - return node.kind === 179 /* SyntaxKind.FunctionType */; + return node.kind === 181 /* SyntaxKind.FunctionType */; } ts.isFunctionTypeNode = isFunctionTypeNode; function isConstructorTypeNode(node) { - return node.kind === 180 /* SyntaxKind.ConstructorType */; + return node.kind === 182 /* SyntaxKind.ConstructorType */; } ts.isConstructorTypeNode = isConstructorTypeNode; function isTypeQueryNode(node) { - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isTypeQueryNode = isTypeQueryNode; function isTypeLiteralNode(node) { - return node.kind === 182 /* SyntaxKind.TypeLiteral */; + return node.kind === 184 /* SyntaxKind.TypeLiteral */; } ts.isTypeLiteralNode = isTypeLiteralNode; function isArrayTypeNode(node) { - return node.kind === 183 /* SyntaxKind.ArrayType */; + return node.kind === 185 /* SyntaxKind.ArrayType */; } ts.isArrayTypeNode = isArrayTypeNode; function isTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */; + return node.kind === 186 /* SyntaxKind.TupleType */; } ts.isTupleTypeNode = isTupleTypeNode; function isNamedTupleMember(node) { - return node.kind === 197 /* SyntaxKind.NamedTupleMember */; + return node.kind === 199 /* SyntaxKind.NamedTupleMember */; } ts.isNamedTupleMember = isNamedTupleMember; function isOptionalTypeNode(node) { - return node.kind === 185 /* SyntaxKind.OptionalType */; + return node.kind === 187 /* SyntaxKind.OptionalType */; } ts.isOptionalTypeNode = isOptionalTypeNode; function isRestTypeNode(node) { - return node.kind === 186 /* SyntaxKind.RestType */; + return node.kind === 188 /* SyntaxKind.RestType */; } ts.isRestTypeNode = isRestTypeNode; function isUnionTypeNode(node) { - return node.kind === 187 /* SyntaxKind.UnionType */; + return node.kind === 189 /* SyntaxKind.UnionType */; } ts.isUnionTypeNode = isUnionTypeNode; function isIntersectionTypeNode(node) { - return node.kind === 188 /* SyntaxKind.IntersectionType */; + return node.kind === 190 /* SyntaxKind.IntersectionType */; } ts.isIntersectionTypeNode = isIntersectionTypeNode; function isConditionalTypeNode(node) { - return node.kind === 189 /* SyntaxKind.ConditionalType */; + return node.kind === 191 /* SyntaxKind.ConditionalType */; } ts.isConditionalTypeNode = isConditionalTypeNode; function isInferTypeNode(node) { - return node.kind === 190 /* SyntaxKind.InferType */; + return node.kind === 192 /* SyntaxKind.InferType */; } ts.isInferTypeNode = isInferTypeNode; function isParenthesizedTypeNode(node) { - return node.kind === 191 /* SyntaxKind.ParenthesizedType */; + return node.kind === 193 /* SyntaxKind.ParenthesizedType */; } ts.isParenthesizedTypeNode = isParenthesizedTypeNode; function isThisTypeNode(node) { - return node.kind === 192 /* SyntaxKind.ThisType */; + return node.kind === 194 /* SyntaxKind.ThisType */; } ts.isThisTypeNode = isThisTypeNode; function isTypeOperatorNode(node) { - return node.kind === 193 /* SyntaxKind.TypeOperator */; + return node.kind === 195 /* SyntaxKind.TypeOperator */; } ts.isTypeOperatorNode = isTypeOperatorNode; function isIndexedAccessTypeNode(node) { - return node.kind === 194 /* SyntaxKind.IndexedAccessType */; + return node.kind === 196 /* SyntaxKind.IndexedAccessType */; } ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode; function isMappedTypeNode(node) { - return node.kind === 195 /* SyntaxKind.MappedType */; + return node.kind === 197 /* SyntaxKind.MappedType */; } ts.isMappedTypeNode = isMappedTypeNode; function isLiteralTypeNode(node) { - return node.kind === 196 /* SyntaxKind.LiteralType */; + return node.kind === 198 /* SyntaxKind.LiteralType */; } ts.isLiteralTypeNode = isLiteralTypeNode; function isImportTypeNode(node) { - return node.kind === 200 /* SyntaxKind.ImportType */; + return node.kind === 202 /* SyntaxKind.ImportType */; } ts.isImportTypeNode = isImportTypeNode; function isTemplateLiteralTypeSpan(node) { - return node.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */; + return node.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */; } ts.isTemplateLiteralTypeSpan = isTemplateLiteralTypeSpan; function isTemplateLiteralTypeNode(node) { - return node.kind === 198 /* SyntaxKind.TemplateLiteralType */; + return node.kind === 200 /* SyntaxKind.TemplateLiteralType */; } ts.isTemplateLiteralTypeNode = isTemplateLiteralTypeNode; // Binding patterns function isObjectBindingPattern(node) { - return node.kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return node.kind === 203 /* SyntaxKind.ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 202 /* SyntaxKind.ArrayBindingPattern */; + return node.kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 203 /* SyntaxKind.BindingElement */; + return node.kind === 205 /* SyntaxKind.BindingElement */; } ts.isBindingElement = isBindingElement; // Expression function isArrayLiteralExpression(node) { - return node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; + return node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertionExpression(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } ts.isTypeAssertionExpression = isTypeAssertionExpression; function isParenthesizedExpression(node) { - return node.kind === 212 /* SyntaxKind.ParenthesizedExpression */; + return node.kind === 214 /* SyntaxKind.ParenthesizedExpression */; } ts.isParenthesizedExpression = isParenthesizedExpression; function isFunctionExpression(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 216 /* SyntaxKind.TypeOfExpression */; + return node.kind === 218 /* SyntaxKind.TypeOfExpression */; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 217 /* SyntaxKind.VoidExpression */; + return node.kind === 219 /* SyntaxKind.VoidExpression */; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 218 /* SyntaxKind.AwaitExpression */; + return node.kind === 220 /* SyntaxKind.AwaitExpression */; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */; + return node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 220 /* SyntaxKind.PostfixUnaryExpression */; + return node.kind === 222 /* SyntaxKind.PostfixUnaryExpression */; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 222 /* SyntaxKind.ConditionalExpression */; + return node.kind === 224 /* SyntaxKind.ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 223 /* SyntaxKind.TemplateExpression */; + return node.kind === 225 /* SyntaxKind.TemplateExpression */; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 224 /* SyntaxKind.YieldExpression */; + return node.kind === 226 /* SyntaxKind.YieldExpression */; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 225 /* SyntaxKind.SpreadElement */; + return node.kind === 227 /* SyntaxKind.SpreadElement */; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 226 /* SyntaxKind.ClassExpression */; + return node.kind === 228 /* SyntaxKind.ClassExpression */; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 227 /* SyntaxKind.OmittedExpression */; + return node.kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 229 /* SyntaxKind.AsExpression */; + return node.kind === 231 /* SyntaxKind.AsExpression */; } ts.isAsExpression = isAsExpression; + function isSatisfiesExpression(node) { + return node.kind === 235 /* SyntaxKind.SatisfiesExpression */; + } + ts.isSatisfiesExpression = isSatisfiesExpression; function isNonNullExpression(node) { - return node.kind === 230 /* SyntaxKind.NonNullExpression */; + return node.kind === 232 /* SyntaxKind.NonNullExpression */; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 231 /* SyntaxKind.MetaProperty */; + return node.kind === 233 /* SyntaxKind.MetaProperty */; } ts.isMetaProperty = isMetaProperty; function isSyntheticExpression(node) { - return node.kind === 232 /* SyntaxKind.SyntheticExpression */; + return node.kind === 234 /* SyntaxKind.SyntheticExpression */; } ts.isSyntheticExpression = isSyntheticExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 350 /* SyntaxKind.PartiallyEmittedExpression */; + return node.kind === 353 /* SyntaxKind.PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isCommaListExpression(node) { - return node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaListExpression = isCommaListExpression; // Misc function isTemplateSpan(node) { - return node.kind === 233 /* SyntaxKind.TemplateSpan */; + return node.kind === 236 /* SyntaxKind.TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 234 /* SyntaxKind.SemicolonClassElement */; + return node.kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isSemicolonClassElement = isSemicolonClassElement; // Elements function isBlock(node) { - return node.kind === 235 /* SyntaxKind.Block */; + return node.kind === 238 /* SyntaxKind.Block */; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 237 /* SyntaxKind.VariableStatement */; + return node.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 236 /* SyntaxKind.EmptyStatement */; + return node.kind === 239 /* SyntaxKind.EmptyStatement */; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */; + return node.kind === 241 /* SyntaxKind.ExpressionStatement */; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 239 /* SyntaxKind.IfStatement */; + return node.kind === 242 /* SyntaxKind.IfStatement */; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 240 /* SyntaxKind.DoStatement */; + return node.kind === 243 /* SyntaxKind.DoStatement */; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 241 /* SyntaxKind.WhileStatement */; + return node.kind === 244 /* SyntaxKind.WhileStatement */; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 242 /* SyntaxKind.ForStatement */; + return node.kind === 245 /* SyntaxKind.ForStatement */; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */; } ts.isBreakStatement = isBreakStatement; function isReturnStatement(node) { - return node.kind === 247 /* SyntaxKind.ReturnStatement */; + return node.kind === 250 /* SyntaxKind.ReturnStatement */; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 248 /* SyntaxKind.WithStatement */; + return node.kind === 251 /* SyntaxKind.WithStatement */; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 249 /* SyntaxKind.SwitchStatement */; + return node.kind === 252 /* SyntaxKind.SwitchStatement */; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 250 /* SyntaxKind.LabeledStatement */; + return node.kind === 253 /* SyntaxKind.LabeledStatement */; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 251 /* SyntaxKind.ThrowStatement */; + return node.kind === 254 /* SyntaxKind.ThrowStatement */; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 252 /* SyntaxKind.TryStatement */; + return node.kind === 255 /* SyntaxKind.TryStatement */; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 253 /* SyntaxKind.DebuggerStatement */; + return node.kind === 256 /* SyntaxKind.DebuggerStatement */; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 255 /* SyntaxKind.VariableDeclarationList */; + return node.kind === 258 /* SyntaxKind.VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 256 /* SyntaxKind.FunctionDeclaration */; + return node.kind === 259 /* SyntaxKind.FunctionDeclaration */; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 257 /* SyntaxKind.ClassDeclaration */; + return node.kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return node.kind === 261 /* SyntaxKind.InterfaceDeclaration */; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */; + return node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 262 /* SyntaxKind.ModuleBlock */; + return node.kind === 265 /* SyntaxKind.ModuleBlock */; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 263 /* SyntaxKind.CaseBlock */; + return node.kind === 266 /* SyntaxKind.CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */; + return node.kind === 270 /* SyntaxKind.ImportClause */; } ts.isImportClause = isImportClause; function isImportTypeAssertionContainer(node) { - return node.kind === 295 /* SyntaxKind.ImportTypeAssertionContainer */; + return node.kind === 298 /* SyntaxKind.ImportTypeAssertionContainer */; } ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer; function isAssertClause(node) { - return node.kind === 293 /* SyntaxKind.AssertClause */; + return node.kind === 296 /* SyntaxKind.AssertClause */; } ts.isAssertClause = isAssertClause; function isAssertEntry(node) { - return node.kind === 294 /* SyntaxKind.AssertEntry */; + return node.kind === 297 /* SyntaxKind.AssertEntry */; } ts.isAssertEntry = isAssertEntry; function isNamespaceImport(node) { - return node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamespaceImport = isNamespaceImport; function isNamespaceExport(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */; } ts.isNamespaceExport = isNamespaceExport; function isNamedImports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */; + return node.kind === 272 /* SyntaxKind.NamedImports */; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 270 /* SyntaxKind.ImportSpecifier */; + return node.kind === 273 /* SyntaxKind.ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 271 /* SyntaxKind.ExportAssignment */; + return node.kind === 274 /* SyntaxKind.ExportAssignment */; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 272 /* SyntaxKind.ExportDeclaration */; + return node.kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 275 /* SyntaxKind.ExportSpecifier */; + return node.kind === 278 /* SyntaxKind.ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 276 /* SyntaxKind.MissingDeclaration */; + return node.kind === 279 /* SyntaxKind.MissingDeclaration */; } ts.isMissingDeclaration = isMissingDeclaration; function isNotEmittedStatement(node) { - return node.kind === 349 /* SyntaxKind.NotEmittedStatement */; + return node.kind === 352 /* SyntaxKind.NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ function isSyntheticReference(node) { - return node.kind === 354 /* SyntaxKind.SyntheticReferenceExpression */; + return node.kind === 357 /* SyntaxKind.SyntheticReferenceExpression */; } ts.isSyntheticReference = isSyntheticReference; /* @internal */ function isMergeDeclarationMarker(node) { - return node.kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return node.kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } ts.isMergeDeclarationMarker = isMergeDeclarationMarker; /* @internal */ function isEndOfDeclarationMarker(node) { - return node.kind === 353 /* SyntaxKind.EndOfDeclarationMarker */; + return node.kind === 356 /* SyntaxKind.EndOfDeclarationMarker */; } ts.isEndOfDeclarationMarker = isEndOfDeclarationMarker; // Module References function isExternalModuleReference(node) { - return node.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleReference = isExternalModuleReference; // JSX function isJsxElement(node) { - return node.kind === 278 /* SyntaxKind.JsxElement */; + return node.kind === 281 /* SyntaxKind.JsxElement */; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return node.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 280 /* SyntaxKind.JsxOpeningElement */; + return node.kind === 283 /* SyntaxKind.JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 281 /* SyntaxKind.JsxClosingElement */; + return node.kind === 284 /* SyntaxKind.JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 282 /* SyntaxKind.JsxFragment */; + return node.kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 283 /* SyntaxKind.JsxOpeningFragment */; + return node.kind === 286 /* SyntaxKind.JsxOpeningFragment */; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 284 /* SyntaxKind.JsxClosingFragment */; + return node.kind === 287 /* SyntaxKind.JsxClosingFragment */; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */; + return node.kind === 288 /* SyntaxKind.JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 286 /* SyntaxKind.JsxAttributes */; + return node.kind === 289 /* SyntaxKind.JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 288 /* SyntaxKind.JsxExpression */; + return node.kind === 291 /* SyntaxKind.JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 289 /* SyntaxKind.CaseClause */; + return node.kind === 292 /* SyntaxKind.CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 290 /* SyntaxKind.DefaultClause */; + return node.kind === 293 /* SyntaxKind.DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 291 /* SyntaxKind.HeritageClause */; + return node.kind === 294 /* SyntaxKind.HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 296 /* SyntaxKind.PropertyAssignment */; + return node.kind === 299 /* SyntaxKind.PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 298 /* SyntaxKind.SpreadAssignment */; + return node.kind === 301 /* SyntaxKind.SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } ts.isEnumMember = isEnumMember; // Unparsed // TODO(rbuckton): isUnparsedPrologue function isUnparsedPrepend(node) { - return node.kind === 301 /* SyntaxKind.UnparsedPrepend */; + return node.kind === 304 /* SyntaxKind.UnparsedPrepend */; } ts.isUnparsedPrepend = isUnparsedPrepend; // TODO(rbuckton): isUnparsedText @@ -29780,176 +29820,176 @@ var ts; // TODO(rbuckton): isUnparsedSyntheticReference // Top-level nodes function isSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */; + return node.kind === 308 /* SyntaxKind.SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 306 /* SyntaxKind.Bundle */; + return node.kind === 309 /* SyntaxKind.Bundle */; } ts.isBundle = isBundle; function isUnparsedSource(node) { - return node.kind === 307 /* SyntaxKind.UnparsedSource */; + return node.kind === 310 /* SyntaxKind.UnparsedSource */; } ts.isUnparsedSource = isUnparsedSource; // TODO(rbuckton): isInputFiles // JSDoc Elements function isJSDocTypeExpression(node) { - return node.kind === 309 /* SyntaxKind.JSDocTypeExpression */; + return node.kind === 312 /* SyntaxKind.JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocNameReference(node) { - return node.kind === 310 /* SyntaxKind.JSDocNameReference */; + return node.kind === 313 /* SyntaxKind.JSDocNameReference */; } ts.isJSDocNameReference = isJSDocNameReference; function isJSDocMemberName(node) { - return node.kind === 311 /* SyntaxKind.JSDocMemberName */; + return node.kind === 314 /* SyntaxKind.JSDocMemberName */; } ts.isJSDocMemberName = isJSDocMemberName; function isJSDocLink(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */; + return node.kind === 327 /* SyntaxKind.JSDocLink */; } ts.isJSDocLink = isJSDocLink; function isJSDocLinkCode(node) { - return node.kind === 325 /* SyntaxKind.JSDocLinkCode */; + return node.kind === 328 /* SyntaxKind.JSDocLinkCode */; } ts.isJSDocLinkCode = isJSDocLinkCode; function isJSDocLinkPlain(node) { - return node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkPlain = isJSDocLinkPlain; function isJSDocAllType(node) { - return node.kind === 312 /* SyntaxKind.JSDocAllType */; + return node.kind === 315 /* SyntaxKind.JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 313 /* SyntaxKind.JSDocUnknownType */; + return node.kind === 316 /* SyntaxKind.JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 314 /* SyntaxKind.JSDocNullableType */; + return node.kind === 317 /* SyntaxKind.JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 315 /* SyntaxKind.JSDocNonNullableType */; + return node.kind === 318 /* SyntaxKind.JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return node.kind === 319 /* SyntaxKind.JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 317 /* SyntaxKind.JSDocFunctionType */; + return node.kind === 320 /* SyntaxKind.JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDocNamepathType(node) { - return node.kind === 319 /* SyntaxKind.JSDocNamepathType */; + return node.kind === 322 /* SyntaxKind.JSDocNamepathType */; } ts.isJSDocNamepathType = isJSDocNamepathType; function isJSDoc(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */; + return node.kind === 323 /* SyntaxKind.JSDoc */; } ts.isJSDoc = isJSDoc; function isJSDocTypeLiteral(node) { - return node.kind === 322 /* SyntaxKind.JSDocTypeLiteral */; + return node.kind === 325 /* SyntaxKind.JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; function isJSDocSignature(node) { - return node.kind === 323 /* SyntaxKind.JSDocSignature */; + return node.kind === 326 /* SyntaxKind.JSDocSignature */; } ts.isJSDocSignature = isJSDocSignature; // JSDoc Tags function isJSDocAugmentsTag(node) { - return node.kind === 328 /* SyntaxKind.JSDocAugmentsTag */; + return node.kind === 331 /* SyntaxKind.JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocAuthorTag(node) { - return node.kind === 330 /* SyntaxKind.JSDocAuthorTag */; + return node.kind === 333 /* SyntaxKind.JSDocAuthorTag */; } ts.isJSDocAuthorTag = isJSDocAuthorTag; function isJSDocClassTag(node) { - return node.kind === 332 /* SyntaxKind.JSDocClassTag */; + return node.kind === 335 /* SyntaxKind.JSDocClassTag */; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocCallbackTag(node) { - return node.kind === 338 /* SyntaxKind.JSDocCallbackTag */; + return node.kind === 341 /* SyntaxKind.JSDocCallbackTag */; } ts.isJSDocCallbackTag = isJSDocCallbackTag; function isJSDocPublicTag(node) { - return node.kind === 333 /* SyntaxKind.JSDocPublicTag */; + return node.kind === 336 /* SyntaxKind.JSDocPublicTag */; } ts.isJSDocPublicTag = isJSDocPublicTag; function isJSDocPrivateTag(node) { - return node.kind === 334 /* SyntaxKind.JSDocPrivateTag */; + return node.kind === 337 /* SyntaxKind.JSDocPrivateTag */; } ts.isJSDocPrivateTag = isJSDocPrivateTag; function isJSDocProtectedTag(node) { - return node.kind === 335 /* SyntaxKind.JSDocProtectedTag */; + return node.kind === 338 /* SyntaxKind.JSDocProtectedTag */; } ts.isJSDocProtectedTag = isJSDocProtectedTag; function isJSDocReadonlyTag(node) { - return node.kind === 336 /* SyntaxKind.JSDocReadonlyTag */; + return node.kind === 339 /* SyntaxKind.JSDocReadonlyTag */; } ts.isJSDocReadonlyTag = isJSDocReadonlyTag; function isJSDocOverrideTag(node) { - return node.kind === 337 /* SyntaxKind.JSDocOverrideTag */; + return node.kind === 340 /* SyntaxKind.JSDocOverrideTag */; } ts.isJSDocOverrideTag = isJSDocOverrideTag; function isJSDocDeprecatedTag(node) { - return node.kind === 331 /* SyntaxKind.JSDocDeprecatedTag */; + return node.kind === 334 /* SyntaxKind.JSDocDeprecatedTag */; } ts.isJSDocDeprecatedTag = isJSDocDeprecatedTag; function isJSDocSeeTag(node) { - return node.kind === 346 /* SyntaxKind.JSDocSeeTag */; + return node.kind === 349 /* SyntaxKind.JSDocSeeTag */; } ts.isJSDocSeeTag = isJSDocSeeTag; function isJSDocEnumTag(node) { - return node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocEnumTag = isJSDocEnumTag; function isJSDocParameterTag(node) { - return node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 341 /* SyntaxKind.JSDocReturnTag */; + return node.kind === 344 /* SyntaxKind.JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocThisTag(node) { - return node.kind === 342 /* SyntaxKind.JSDocThisTag */; + return node.kind === 345 /* SyntaxKind.JSDocThisTag */; } ts.isJSDocThisTag = isJSDocThisTag; function isJSDocTypeTag(node) { - return node.kind === 343 /* SyntaxKind.JSDocTypeTag */; + return node.kind === 346 /* SyntaxKind.JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 344 /* SyntaxKind.JSDocTemplateTag */; + return node.kind === 347 /* SyntaxKind.JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocUnknownTag(node) { - return node.kind === 327 /* SyntaxKind.JSDocTag */; + return node.kind === 330 /* SyntaxKind.JSDocTag */; } ts.isJSDocUnknownTag = isJSDocUnknownTag; function isJSDocPropertyTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocImplementsTag(node) { - return node.kind === 329 /* SyntaxKind.JSDocImplementsTag */; + return node.kind === 332 /* SyntaxKind.JSDocImplementsTag */; } ts.isJSDocImplementsTag = isJSDocImplementsTag; // Synthesized list /* @internal */ function isSyntaxList(n) { - return n.kind === 348 /* SyntaxKind.SyntaxList */; + return n.kind === 351 /* SyntaxKind.SyntaxList */; } ts.isSyntaxList = isSyntaxList; })(ts || (ts = {})); @@ -30148,14 +30188,14 @@ var ts; ts.Debug.failBadSyntaxKind(property.name, "Private identifiers are not allowed in object literals."); } switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return createExpressionForAccessorDeclaration(factory, node.properties, property, receiver, !!node.multiLine); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return createExpressionForPropertyAssignment(factory, property, receiver); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(factory, property, receiver); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return createExpressionForMethodDeclaration(factory, property, receiver); } } @@ -30263,8 +30303,8 @@ var ts; } ts.startsWithUseStrict = startsWithUseStrict; function isCommaSequence(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || - node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || + node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaSequence = isCommaSequence; function isJSDocTypeAssertion(node) { @@ -30282,17 +30322,18 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 15 /* OuterExpressionKinds.All */; } switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: if (kinds & 16 /* OuterExpressionKinds.ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) { return false; } return (kinds & 1 /* OuterExpressionKinds.Parentheses */) !== 0; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return (kinds & 2 /* OuterExpressionKinds.TypeAssertions */) !== 0; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return (kinds & 4 /* OuterExpressionKinds.NonNullAssertions */) !== 0; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return (kinds & 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */) !== 0; } return false; @@ -30413,10 +30454,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : factory.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 266 /* SyntaxKind.ImportDeclaration */ && node.importClause) { + if (node.kind === 269 /* SyntaxKind.ImportDeclaration */ && node.importClause) { return factory.getGeneratedNameForNode(node); } - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { return factory.getGeneratedNameForNode(node); } return undefined; @@ -30535,7 +30576,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -30547,11 +30588,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -30583,12 +30624,12 @@ var ts; */ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 225 /* SyntaxKind.SpreadElement */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 227 /* SyntaxKind.SpreadElement */: + case 301 /* SyntaxKind.SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -30606,7 +30647,7 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -30621,7 +30662,7 @@ var ts; : propertyName; } break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -30636,7 +30677,7 @@ var ts; : propertyName; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` if (bindingElement.name && ts.isPrivateIdentifier(bindingElement.name)) { return ts.Debug.failBadSyntaxKind(bindingElement.name); @@ -30659,13 +30700,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -30686,46 +30727,46 @@ var ts; ts.getJSDocTypeAliasName = getJSDocTypeAliasName; function canHaveIllegalType(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalType = canHaveIllegalType; function canHaveIllegalTypeParameters(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalTypeParameters = canHaveIllegalTypeParameters; function canHaveIllegalDecorators(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.canHaveIllegalDecorators = canHaveIllegalDecorators; function canHaveIllegalModifiers(node) { var kind = node.kind; - return kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 179 /* SyntaxKind.FunctionType */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 181 /* SyntaxKind.FunctionType */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.canHaveIllegalModifiers = canHaveIllegalModifiers; ts.isTypeNodeOrTypeParameterDeclaration = ts.or(ts.isTypeNode, ts.isTypeParameterDeclaration); @@ -30999,6 +31040,83 @@ var ts; return ts.setTextRange(factory.createNodeArray([], nodes.hasTrailingComma), nodes); } ts.elideNodes = elideNodes; + /** + * Gets the node from which a name should be generated. + */ + function getNodeForGeneratedName(name) { + if (name.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) { + var autoGenerateId = name.autoGenerateId; + var node = name; + var original = node.original; + while (original) { + node = original; + // if "node" is a different generated name (having a different "autoGenerateId"), use it and stop traversing. + if (ts.isMemberName(node) + && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) + && node.autoGenerateId !== autoGenerateId) { + break; + } + original = node.original; + } + // otherwise, return the original node for the source + return node; + } + return name; + } + ts.getNodeForGeneratedName = getNodeForGeneratedName; + function formatGeneratedNamePart(part, generateName) { + return typeof part === "object" ? formatGeneratedName(/*privateName*/ false, part.prefix, part.node, part.suffix, generateName) : + typeof part === "string" ? part.length > 0 && part.charCodeAt(0) === 35 /* CharacterCodes.hash */ ? part.slice(1) : part : + ""; + } + ts.formatGeneratedNamePart = formatGeneratedNamePart; + function formatIdentifier(name, generateName) { + return typeof name === "string" ? name : + formatIdentifierWorker(name, ts.Debug.checkDefined(generateName)); + } + function formatIdentifierWorker(node, generateName) { + return ts.isGeneratedPrivateIdentifier(node) ? generateName(node).slice(1) : + ts.isGeneratedIdentifier(node) ? generateName(node) : + ts.isPrivateIdentifier(node) ? node.escapedText.slice(1) : + ts.idText(node); + } + function formatGeneratedName(privateName, prefix, baseName, suffix, generateName) { + prefix = formatGeneratedNamePart(prefix, generateName); + suffix = formatGeneratedNamePart(suffix, generateName); + baseName = formatIdentifier(baseName, generateName); + return "".concat(privateName ? "#" : "").concat(prefix).concat(baseName).concat(suffix); + } + ts.formatGeneratedName = formatGeneratedName; + /** + * Creates a private backing field for an `accessor` {@link PropertyDeclaration}. + */ + function createAccessorPropertyBackingField(factory, node, modifiers, initializer) { + return factory.updatePropertyDeclaration(node, modifiers, factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"), + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, initializer); + } + ts.createAccessorPropertyBackingField = createAccessorPropertyBackingField; + /** + * Creates a {@link GetAccessorDeclaration} that reads from a private backing field. + */ + function createAccessorPropertyGetRedirector(factory, node, modifiers, name) { + return factory.createGetAccessorDeclaration(modifiers, name, [], + /*type*/ undefined, factory.createBlock([ + factory.createReturnStatement(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"))) + ])); + } + ts.createAccessorPropertyGetRedirector = createAccessorPropertyGetRedirector; + /** + * Creates a {@link SetAccessorDeclaration} that writes to a private backing field. + */ + function createAccessorPropertySetRedirector(factory, node, modifiers, name) { + return factory.createSetAccessorDeclaration(modifiers, name, [factory.createParameterDeclaration( + /*modifiers*/ undefined, + /*dotdotDotToken*/ undefined, "value")], factory.createBlock([ + factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage")), factory.createIdentifier("value"))) + ])); + } + ts.createAccessorPropertySetRedirector = createAccessorPropertySetRedirector; })(ts || (ts = {})); var ts; (function (ts) { @@ -31008,47 +31126,48 @@ var ts; ts.setTextRange = setTextRange; function canHaveModifiers(node) { var kind = node.kind; - return kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 180 /* SyntaxKind.ConstructorType */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 272 /* SyntaxKind.ExportDeclaration */; + return kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 182 /* SyntaxKind.ConstructorType */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.canHaveModifiers = canHaveModifiers; function canHaveDecorators(node) { var kind = node.kind; - return kind === 164 /* SyntaxKind.Parameter */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 257 /* SyntaxKind.ClassDeclaration */; + return kind === 166 /* SyntaxKind.Parameter */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.canHaveDecorators = canHaveDecorators; })(ts || (ts = {})); var ts; (function (ts) { + var _a; var SignatureFlags; (function (SignatureFlags) { SignatureFlags[SignatureFlags["None"] = 0] = "None"; @@ -31136,6 +31255,718 @@ var ts; function isImportMeta(node) { return ts.isMetaProperty(node) && node.keywordToken === 100 /* SyntaxKind.ImportKeyword */ && node.name.escapedText === "meta"; } + var forEachChildTable = (_a = {}, + _a[163 /* SyntaxKind.QualifiedName */] = function forEachChildInQualifiedName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[165 /* SyntaxKind.TypeParameter */] = function forEachChildInTypeParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || + visitNode(cbNode, node.expression); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[166 /* SyntaxKind.Parameter */] = function forEachChildInParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[168 /* SyntaxKind.PropertySignature */] = function forEachChildInPropertySignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[299 /* SyntaxKind.PropertyAssignment */] = function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.initializer); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[205 /* SyntaxKind.BindingElement */] = function forEachChildInBindingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function forEachChildInIndexSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function forEachChildInConstructorType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[181 /* SyntaxKind.FunctionType */] = function forEachChildInFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[176 /* SyntaxKind.CallSignature */] = forEachChildInCallOrConstructSignature, + _a[177 /* SyntaxKind.ConstructSignature */] = forEachChildInCallOrConstructSignature, + _a[171 /* SyntaxKind.MethodDeclaration */] = function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function forEachChildInMethodSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[173 /* SyntaxKind.Constructor */] = function forEachChildInConstructor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function forEachChildInGetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function forEachChildInSetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function forEachChildInFunctionExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function forEachChildInArrowFunction(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.equalsGreaterThanToken) || + visitNode(cbNode, node.body); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.body); + }, + _a[180 /* SyntaxKind.TypeReference */] = function forEachChildInTypeReference(node, cbNode, cbNodes) { + return visitNode(cbNode, node.typeName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[179 /* SyntaxKind.TypePredicate */] = function forEachChildInTypePredicate(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertsModifier) || + visitNode(cbNode, node.parameterName) || + visitNode(cbNode, node.type); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function forEachChildInTypeQuery(node, cbNode, cbNodes) { + return visitNode(cbNode, node.exprName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function forEachChildInTypeLiteral(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.members); + }, + _a[185 /* SyntaxKind.ArrayType */] = function forEachChildInArrayType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.elementType); + }, + _a[186 /* SyntaxKind.TupleType */] = function forEachChildInTupleType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[189 /* SyntaxKind.UnionType */] = forEachChildInUnionOrIntersectionType, + _a[190 /* SyntaxKind.IntersectionType */] = forEachChildInUnionOrIntersectionType, + _a[191 /* SyntaxKind.ConditionalType */] = function forEachChildInConditionalType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.checkType) || + visitNode(cbNode, node.extendsType) || + visitNode(cbNode, node.trueType) || + visitNode(cbNode, node.falseType); + }, + _a[192 /* SyntaxKind.InferType */] = function forEachChildInInferType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.typeParameter); + }, + _a[202 /* SyntaxKind.ImportType */] = function forEachChildInImportType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.assertions) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertClause); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[195 /* SyntaxKind.TypeOperator */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[196 /* SyntaxKind.IndexedAccessType */] = function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.objectType) || + visitNode(cbNode, node.indexType); + }, + _a[197 /* SyntaxKind.MappedType */] = function forEachChildInMappedType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.readonlyToken) || + visitNode(cbNode, node.typeParameter) || + visitNode(cbNode, node.nameType) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[198 /* SyntaxKind.LiteralType */] = function forEachChildInLiteralType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.literal); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type); + }, + _a[203 /* SyntaxKind.ObjectBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.name); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.argumentExpression); + }, + _a[210 /* SyntaxKind.CallExpression */] = forEachChildInCallOrNewExpression, + _a[211 /* SyntaxKind.NewExpression */] = forEachChildInCallOrNewExpression, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.template); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function forEachChildInVoidExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function forEachChildInYieldExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + }, + _a[231 /* SyntaxKind.AsExpression */] = function forEachChildInAsExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.type); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function forEachChildInMetaProperty(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function forEachChildInSpreadElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[238 /* SyntaxKind.Block */] = forEachChildInBlock, + _a[265 /* SyntaxKind.ModuleBlock */] = forEachChildInBlock, + _a[308 /* SyntaxKind.SourceFile */] = function forEachChildInSourceFile(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function forEachChildInVariableStatement(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.declarations); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[242 /* SyntaxKind.IfStatement */] = function forEachChildInIfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + }, + _a[243 /* SyntaxKind.DoStatement */] = function forEachChildInDoStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function forEachChildInWhileStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[245 /* SyntaxKind.ForStatement */] = function forEachChildInForStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || + visitNode(cbNode, node.statement); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function forEachChildInForInStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function forEachChildInForOfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = forEachChildInContinueOrBreakStatement, + _a[249 /* SyntaxKind.BreakStatement */] = forEachChildInContinueOrBreakStatement, + _a[250 /* SyntaxKind.ReturnStatement */] = function forEachChildInReturnStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[251 /* SyntaxKind.WithStatement */] = function forEachChildInWithStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function forEachChildInCaseBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.clauses); + }, + _a[292 /* SyntaxKind.CaseClause */] = function forEachChildInCaseClause(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.statements); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function forEachChildInDefaultClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function forEachChildInThrowStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[255 /* SyntaxKind.TryStatement */] = function forEachChildInTryStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + }, + _a[295 /* SyntaxKind.CatchClause */] = function forEachChildInCatchClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); + }, + _a[167 /* SyntaxKind.Decorator */] = function forEachChildInDecorator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = forEachChildInClassDeclarationOrExpression, + _a[228 /* SyntaxKind.ClassExpression */] = forEachChildInClassDeclarationOrExpression, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[302 /* SyntaxKind.EnumMember */] = function forEachChildInEnumMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function forEachChildInImportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[270 /* SyntaxKind.ImportClause */] = function forEachChildInImportClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); + }, + _a[296 /* SyntaxKind.AssertClause */] = function forEachChildInAssertClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function forEachChildInAssertEntry(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.value); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNode(cbNode, node.name); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[272 /* SyntaxKind.NamedImports */] = forEachChildInNamedImportsOrExports, + _a[276 /* SyntaxKind.NamedExports */] = forEachChildInNamedImportsOrExports, + _a[275 /* SyntaxKind.ExportDeclaration */] = function forEachChildInExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[278 /* SyntaxKind.ExportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[274 /* SyntaxKind.ExportAssignment */] = function forEachChildInExportAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function forEachChildInTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[236 /* SyntaxKind.TemplateSpan */] = function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.literal); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.literal); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function forEachChildInHeritageClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[280 /* SyntaxKind.ExternalModuleReference */] = function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[279 /* SyntaxKind.MissingDeclaration */] = function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function forEachChildInCommaListExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[281 /* SyntaxKind.JsxElement */] = function forEachChildInJsxElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingElement) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingElement); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function forEachChildInJsxFragment(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[283 /* SyntaxKind.JsxOpeningElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[289 /* SyntaxKind.JsxAttributes */] = function forEachChildInJsxAttributes(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function forEachChildInJsxExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tagName); + }, + _a[187 /* SyntaxKind.OptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[188 /* SyntaxKind.RestType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[312 /* SyntaxKind.JSDocTypeExpression */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[318 /* SyntaxKind.JSDocNonNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[317 /* SyntaxKind.JSDocNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[319 /* SyntaxKind.JSDocOptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[321 /* SyntaxKind.JSDocVariadicType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[320 /* SyntaxKind.JSDocFunctionType */] = function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[323 /* SyntaxKind.JSDoc */] = function forEachChildInJSDoc(node, cbNode, cbNodes) { + return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + || visitNodes(cbNode, cbNodes, node.tags); + }, + _a[349 /* SyntaxKind.JSDocSeeTag */] = function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.name) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[313 /* SyntaxKind.JSDocNameReference */] = function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[314 /* SyntaxKind.JSDocMemberName */] = function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[343 /* SyntaxKind.JSDocParameterTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[350 /* SyntaxKind.JSDocPropertyTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[333 /* SyntaxKind.JSDocAuthorTag */] = function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[332 /* SyntaxKind.JSDocImplementsTag */] = function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[331 /* SyntaxKind.JSDocAugmentsTag */] = function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[347 /* SyntaxKind.JSDocTemplateTag */] = function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.constraint) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[348 /* SyntaxKind.JSDocTypedefTag */] = function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.typeExpression && + node.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ + ? visitNode(cbNode, node.typeExpression) || + visitNode(cbNode, node.fullName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + : visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); + }, + _a[341 /* SyntaxKind.JSDocCallbackTag */] = function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[344 /* SyntaxKind.JSDocReturnTag */] = forEachChildInJSDocReturnTag, + _a[346 /* SyntaxKind.JSDocTypeTag */] = forEachChildInJSDocReturnTag, + _a[345 /* SyntaxKind.JSDocThisTag */] = forEachChildInJSDocReturnTag, + _a[342 /* SyntaxKind.JSDocEnumTag */] = forEachChildInJSDocReturnTag, + _a[326 /* SyntaxKind.JSDocSignature */] = function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { + return ts.forEach(node.typeParameters, cbNode) || + ts.forEach(node.parameters, cbNode) || + visitNode(cbNode, node.type); + }, + _a[327 /* SyntaxKind.JSDocLink */] = forEachChildInJSDocLinkCodeOrPlain, + _a[328 /* SyntaxKind.JSDocLinkCode */] = forEachChildInJSDocLinkCodeOrPlain, + _a[329 /* SyntaxKind.JSDocLinkPlain */] = forEachChildInJSDocLinkCodeOrPlain, + _a[325 /* SyntaxKind.JSDocTypeLiteral */] = function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { + return ts.forEach(node.jsDocPropertyTags, cbNode); + }, + _a[330 /* SyntaxKind.JSDocTag */] = forEachChildInJSDocTag, + _a[335 /* SyntaxKind.JSDocClassTag */] = forEachChildInJSDocTag, + _a[336 /* SyntaxKind.JSDocPublicTag */] = forEachChildInJSDocTag, + _a[337 /* SyntaxKind.JSDocPrivateTag */] = forEachChildInJSDocTag, + _a[338 /* SyntaxKind.JSDocProtectedTag */] = forEachChildInJSDocTag, + _a[339 /* SyntaxKind.JSDocReadonlyTag */] = forEachChildInJSDocTag, + _a[334 /* SyntaxKind.JSDocDeprecatedTag */] = forEachChildInJSDocTag, + _a[340 /* SyntaxKind.JSDocOverrideTag */] = forEachChildInJSDocTag, + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = forEachChildInPartiallyEmittedExpression, + _a); + // shared + function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + } + function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + } + function forEachChildInParenthesizedTypeOrTypeOperator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInObjectOrArrayBindingPattern(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInCallOrNewExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + // TODO: should we separate these branches out? + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNodes(cbNode, cbNodes, node.arguments); + } + function forEachChildInBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + } + function forEachChildInContinueOrBreakStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label); + } + function forEachChildInClassDeclarationOrExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + } + function forEachChildInNamedImportsOrExports(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInImportOrExportSpecifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); + } + function forEachChildInJsxOpeningOrSelfClosingElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.attributes); + } + function forEachChildInOptionalRestOrJSDocParameterModifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInJSDocParameterOrPropertyTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.isNameFirst + ? visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression) + : visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name)) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocReturnTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + } + function forEachChildInJSDocTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) + || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + } /** * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, @@ -31150,563 +31981,11 @@ var ts; * that they appear in the source code. The language service depends on this property to locate nodes by position. */ function forEachChild(node, cbNode, cbNodes) { - if (!node || node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node === undefined || node.kind <= 162 /* SyntaxKind.LastToken */) { return; } - switch (node.kind) { - case 161 /* SyntaxKind.QualifiedName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 163 /* SyntaxKind.TypeParameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.default) || - visitNode(cbNode, node.expression); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.equalsToken) || - visitNode(cbNode, node.objectAssignmentInitializer); - case 298 /* SyntaxKind.SpreadAssignment */: - return visitNode(cbNode, node.expression); - case 164 /* SyntaxKind.Parameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 166 /* SyntaxKind.PropertySignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 296 /* SyntaxKind.PropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.initializer); - case 254 /* SyntaxKind.VariableDeclaration */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 203 /* SyntaxKind.BindingElement */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 176 /* SyntaxKind.IndexSignature */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 180 /* SyntaxKind.ConstructorType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 179 /* SyntaxKind.FunctionType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - return visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 169 /* SyntaxKind.MethodDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 168 /* SyntaxKind.MethodSignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 171 /* SyntaxKind.Constructor */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 172 /* SyntaxKind.GetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 173 /* SyntaxKind.SetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 256 /* SyntaxKind.FunctionDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 213 /* SyntaxKind.FunctionExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 214 /* SyntaxKind.ArrowFunction */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.equalsGreaterThanToken) || - visitNode(cbNode, node.body); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.body); - case 178 /* SyntaxKind.TypeReference */: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 177 /* SyntaxKind.TypePredicate */: - return visitNode(cbNode, node.assertsModifier) || - visitNode(cbNode, node.parameterName) || - visitNode(cbNode, node.type); - case 181 /* SyntaxKind.TypeQuery */: - return visitNode(cbNode, node.exprName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 182 /* SyntaxKind.TypeLiteral */: - return visitNodes(cbNode, cbNodes, node.members); - case 183 /* SyntaxKind.ArrayType */: - return visitNode(cbNode, node.elementType); - case 184 /* SyntaxKind.TupleType */: - return visitNodes(cbNode, cbNodes, node.elements); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - return visitNodes(cbNode, cbNodes, node.types); - case 189 /* SyntaxKind.ConditionalType */: - return visitNode(cbNode, node.checkType) || - visitNode(cbNode, node.extendsType) || - visitNode(cbNode, node.trueType) || - visitNode(cbNode, node.falseType); - case 190 /* SyntaxKind.InferType */: - return visitNode(cbNode, node.typeParameter); - case 200 /* SyntaxKind.ImportType */: - return visitNode(cbNode, node.argument) || - visitNode(cbNode, node.assertions) || - visitNode(cbNode, node.qualifier) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - return visitNode(cbNode, node.assertClause); - case 191 /* SyntaxKind.ParenthesizedType */: - case 193 /* SyntaxKind.TypeOperator */: - return visitNode(cbNode, node.type); - case 194 /* SyntaxKind.IndexedAccessType */: - return visitNode(cbNode, node.objectType) || - visitNode(cbNode, node.indexType); - case 195 /* SyntaxKind.MappedType */: - return visitNode(cbNode, node.readonlyToken) || - visitNode(cbNode, node.typeParameter) || - visitNode(cbNode, node.nameType) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNodes(cbNode, cbNodes, node.members); - case 196 /* SyntaxKind.LiteralType */: - return visitNode(cbNode, node.literal); - case 197 /* SyntaxKind.NamedTupleMember */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - return visitNodes(cbNode, cbNodes, node.elements); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.properties); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.name); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.argumentExpression); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNodes(cbNode, cbNodes, node.arguments); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.template); - case 211 /* SyntaxKind.TypeAssertionExpression */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); - case 212 /* SyntaxKind.ParenthesizedExpression */: - return visitNode(cbNode, node.expression); - case 215 /* SyntaxKind.DeleteExpression */: - return visitNode(cbNode, node.expression); - case 216 /* SyntaxKind.TypeOfExpression */: - return visitNode(cbNode, node.expression); - case 217 /* SyntaxKind.VoidExpression */: - return visitNode(cbNode, node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 224 /* SyntaxKind.YieldExpression */: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); - case 218 /* SyntaxKind.AwaitExpression */: - return visitNode(cbNode, node.expression); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 221 /* SyntaxKind.BinaryExpression */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); - case 229 /* SyntaxKind.AsExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.type); - case 230 /* SyntaxKind.NonNullExpression */: - return visitNode(cbNode, node.expression); - case 231 /* SyntaxKind.MetaProperty */: - return visitNode(cbNode, node.name); - case 222 /* SyntaxKind.ConditionalExpression */: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); - case 225 /* SyntaxKind.SpreadElement */: - return visitNode(cbNode, node.expression); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - return visitNodes(cbNode, cbNodes, node.statements); - case 305 /* SyntaxKind.SourceFile */: - return visitNodes(cbNode, cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); - case 237 /* SyntaxKind.VariableStatement */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); - case 255 /* SyntaxKind.VariableDeclarationList */: - return visitNodes(cbNode, cbNodes, node.declarations); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitNode(cbNode, node.expression); - case 239 /* SyntaxKind.IfStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); - case 240 /* SyntaxKind.DoStatement */: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); - case 241 /* SyntaxKind.WhileStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 242 /* SyntaxKind.ForStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || - visitNode(cbNode, node.statement); - case 243 /* SyntaxKind.ForInStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 244 /* SyntaxKind.ForOfStatement */: - return visitNode(cbNode, node.awaitModifier) || - visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return visitNode(cbNode, node.label); - case 247 /* SyntaxKind.ReturnStatement */: - return visitNode(cbNode, node.expression); - case 248 /* SyntaxKind.WithStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 249 /* SyntaxKind.SwitchStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 263 /* SyntaxKind.CaseBlock */: - return visitNodes(cbNode, cbNodes, node.clauses); - case 289 /* SyntaxKind.CaseClause */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.statements); - case 290 /* SyntaxKind.DefaultClause */: - return visitNodes(cbNode, cbNodes, node.statements); - case 250 /* SyntaxKind.LabeledStatement */: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); - case 251 /* SyntaxKind.ThrowStatement */: - return visitNode(cbNode, node.expression); - case 252 /* SyntaxKind.TryStatement */: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); - case 292 /* SyntaxKind.CatchClause */: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); - case 165 /* SyntaxKind.Decorator */: - return visitNode(cbNode, node.expression); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 258 /* SyntaxKind.InterfaceDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); - case 260 /* SyntaxKind.EnumDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.members); - case 299 /* SyntaxKind.EnumMember */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 261 /* SyntaxKind.ModuleDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 267 /* SyntaxKind.ImportClause */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); - case 293 /* SyntaxKind.AssertClause */: - return visitNodes(cbNode, cbNodes, node.elements); - case 294 /* SyntaxKind.AssertEntry */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.value); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNode(cbNode, node.name); - case 268 /* SyntaxKind.NamespaceImport */: - return visitNode(cbNode, node.name); - case 274 /* SyntaxKind.NamespaceExport */: - return visitNode(cbNode, node.name); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: - return visitNodes(cbNode, cbNodes, node.elements); - case 272 /* SyntaxKind.ExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); - case 271 /* SyntaxKind.ExportAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.expression); - case 223 /* SyntaxKind.TemplateExpression */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 233 /* SyntaxKind.TemplateSpan */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.literal); - case 198 /* SyntaxKind.TemplateLiteralType */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.literal); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitNode(cbNode, node.expression); - case 291 /* SyntaxKind.HeritageClause */: - return visitNodes(cbNode, cbNodes, node.types); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 277 /* SyntaxKind.ExternalModuleReference */: - return visitNode(cbNode, node.expression); - case 276 /* SyntaxKind.MissingDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers); - case 351 /* SyntaxKind.CommaListExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 278 /* SyntaxKind.JsxElement */: - return visitNode(cbNode, node.openingElement) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingElement); - case 282 /* SyntaxKind.JsxFragment */: - return visitNode(cbNode, node.openingFragment) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingFragment); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - return visitNode(cbNode, node.tagName) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.attributes); - case 286 /* SyntaxKind.JsxAttributes */: - return visitNodes(cbNode, cbNodes, node.properties); - case 285 /* SyntaxKind.JsxAttribute */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - return visitNode(cbNode, node.expression); - case 288 /* SyntaxKind.JsxExpression */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.expression); - case 281 /* SyntaxKind.JsxClosingElement */: - return visitNode(cbNode, node.tagName); - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - return visitNode(cbNode, node.type); - case 317 /* SyntaxKind.JSDocFunctionType */: - return visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 320 /* SyntaxKind.JSDoc */: - return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - || visitNodes(cbNode, cbNodes, node.tags); - case 346 /* SyntaxKind.JSDocSeeTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 310 /* SyntaxKind.JSDocNameReference */: - return visitNode(cbNode, node.name); - case 311 /* SyntaxKind.JSDocMemberName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - return visitNode(cbNode, node.tagName) || - (node.isNameFirst - ? visitNode(cbNode, node.name) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 330 /* SyntaxKind.JSDocAuthorTag */: - return visitNode(cbNode, node.tagName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 329 /* SyntaxKind.JSDocImplementsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 344 /* SyntaxKind.JSDocTemplateTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.constraint) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 345 /* SyntaxKind.JSDocTypedefTag */: - return visitNode(cbNode, node.tagName) || - (node.typeExpression && - node.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ - ? visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.fullName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 338 /* SyntaxKind.JSDocCallbackTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 323 /* SyntaxKind.JSDocSignature */: - return ts.forEach(node.typeParameters, cbNode) || - ts.forEach(node.parameters, cbNode) || - visitNode(cbNode, node.type); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: - return visitNode(cbNode, node.name); - case 322 /* SyntaxKind.JSDocTypeLiteral */: - return ts.forEach(node.jsDocPropertyTags, cbNode); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: - case 337 /* SyntaxKind.JSDocOverrideTag */: - return visitNode(cbNode, node.tagName) - || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - return visitNode(cbNode, node.expression); - } + var fn = forEachChildTable[node.kind]; + return fn === undefined ? undefined : fn(node, cbNode, cbNodes); } ts.forEachChild = forEachChild; /** @internal */ @@ -31753,7 +32032,7 @@ var ts; continue; return res; } - if (current.kind >= 161 /* SyntaxKind.FirstNode */) { + if (current.kind >= 163 /* SyntaxKind.FirstNode */) { // add children in reverse order to the queue, so popping gives the first child for (var _i = 0, _a = gatherPossibleChildren(current); _i < _a.length; _i++) { var child = _a[_i]; @@ -31863,13 +32142,11 @@ var ts; var scanner = ts.createScanner(99 /* ScriptTarget.Latest */, /*skipTrivia*/ true); var disallowInAndDecoratorContext = 4096 /* NodeFlags.DisallowInContext */ | 16384 /* NodeFlags.DecoratorContext */; // capture constructors in 'initializeState' to avoid null checks - // tslint:disable variable-name var NodeConstructor; var TokenConstructor; var IdentifierConstructor; var PrivateIdentifierConstructor; var SourceFileConstructor; - // tslint:enable variable-name function countNode(node) { nodeCount++; return node; @@ -32578,7 +32855,7 @@ var ts; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. - if (token() === 132 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { return false; } return token() > 116 /* SyntaxKind.LastReservedWord */; @@ -32824,7 +33101,7 @@ var ts; ts.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, "", "", /*templateFlags*/ undefined) : kind === 8 /* SyntaxKind.NumericLiteral */ ? factory.createNumericLiteral("", /*numericLiteralFlags*/ undefined) : kind === 10 /* SyntaxKind.StringLiteral */ ? factory.createStringLiteral("", /*isSingleQuote*/ undefined) : - kind === 276 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : + kind === 279 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : factory.createToken(kind); return finishNode(result, pos); } @@ -32845,8 +33122,9 @@ var ts; // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker var originalKeywordKind = token(); var text = internIdentifier(scanner.getTokenValue()); + var hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape(); nextTokenWithoutCheck(); - return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind), pos); + return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind, hasExtendedUnicodeEscape), pos); } if (token() === 80 /* SyntaxKind.PrivateIdentifier */) { parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); @@ -32923,7 +33201,7 @@ var ts; } function parsePrivateIdentifier() { var pos = getNodePos(); - var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText())); + var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue())); nextToken(); return finishNode(node, pos); } @@ -32947,15 +33225,16 @@ var ts; if (token() === 88 /* SyntaxKind.DefaultKeyword */) { return lookAhead(nextTokenCanFollowDefaultKeyword); } - if (token() === 152 /* SyntaxKind.TypeKeyword */) { + if (token() === 154 /* SyntaxKind.TypeKeyword */) { return lookAhead(nextTokenCanFollowExportModifier); } return canFollowExportModifier(); case 88 /* SyntaxKind.DefaultKeyword */: return nextTokenCanFollowDefaultKeyword(); + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: nextToken(); return canFollowModifier(); default: @@ -32964,7 +33243,7 @@ var ts; } function canFollowExportModifier() { return token() !== 41 /* SyntaxKind.AsteriskToken */ - && token() !== 127 /* SyntaxKind.AsKeyword */ + && token() !== 128 /* SyntaxKind.AsKeyword */ && token() !== 18 /* SyntaxKind.OpenBraceToken */ && canFollowModifier(); } @@ -32987,7 +33266,7 @@ var ts; return token() === 84 /* SyntaxKind.ClassKeyword */ || token() === 98 /* SyntaxKind.FunctionKeyword */ || token() === 118 /* SyntaxKind.InterfaceKeyword */ || (token() === 126 /* SyntaxKind.AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) || - (token() === 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); + (token() === 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } // True if positioned at the start of a list element function isListElement(parsingContext, inErrorRecovery) { @@ -33367,20 +33646,20 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 176 /* SyntaxKind.IndexSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 234 /* SyntaxKind.SemicolonClassElement */: + case 173 /* SyntaxKind.Constructor */: + case 178 /* SyntaxKind.IndexSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 237 /* SyntaxKind.SemicolonClassElement */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ && - methodDeclaration.name.originalKeywordKind === 134 /* SyntaxKind.ConstructorKeyword */; + methodDeclaration.name.originalKeywordKind === 135 /* SyntaxKind.ConstructorKeyword */; return !nameIsConstructor; } } @@ -33389,8 +33668,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return true; } } @@ -33399,58 +33678,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 238 /* SyntaxKind.ExpressionStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 236 /* SyntaxKind.EmptyStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 250 /* SyntaxKind.LabeledStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 174 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 176 /* SyntaxKind.CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind !== 257 /* SyntaxKind.VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -33471,7 +33750,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 164 /* SyntaxKind.Parameter */) { + if (node.kind !== 166 /* SyntaxKind.Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -33764,14 +34043,14 @@ var ts; // If true, we should abort parsing an error function. function typeHasArrowFunctionBlockingParseError(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return ts.nodeIsMissing(node.typeName); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: { + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: { var _a = node, parameters = _a.parameters, type = _a.type; return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); } - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return typeHasArrowFunctionBlockingParseError(node.type); default: return false; @@ -33850,7 +34129,7 @@ var ts; function parseJSDocType() { scanner.setInJSDocType(true); var pos = getNodePos(); - if (parseOptional(141 /* SyntaxKind.ModuleKeyword */)) { + if (parseOptional(142 /* SyntaxKind.ModuleKeyword */)) { // TODO(rbuckton): We never set the type for a JSDocNamepathType. What should we put here? var moduleTag = factory.createJSDocNamepathType(/*type*/ undefined); terminate: while (true) { @@ -34066,14 +34345,14 @@ var ts; function parseSignatureMember(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - if (kind === 175 /* SyntaxKind.ConstructSignature */) { + if (kind === 177 /* SyntaxKind.ConstructSignature */) { parseExpected(103 /* SyntaxKind.NewKeyword */); } var typeParameters = parseTypeParameters(); var parameters = parseParameters(4 /* SignatureFlags.Type */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ true); parseTypeMemberSemicolon(); - var node = kind === 174 /* SyntaxKind.CallSignature */ + var node = kind === 176 /* SyntaxKind.CallSignature */ ? factory.createCallSignature(typeParameters, parameters, type) : factory.createConstructSignature(typeParameters, parameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -34167,8 +34446,8 @@ var ts; // Return true if we have the start of a signature member if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || - token() === 136 /* SyntaxKind.GetKeyword */ || - token() === 149 /* SyntaxKind.SetKeyword */) { + token() === 137 /* SyntaxKind.GetKeyword */ || + token() === 151 /* SyntaxKind.SetKeyword */) { return true; } var idToken = false; @@ -34200,19 +34479,19 @@ var ts; } function parseTypeMember() { if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */) { - return parseSignatureMember(174 /* SyntaxKind.CallSignature */); + return parseSignatureMember(176 /* SyntaxKind.CallSignature */); } if (token() === 103 /* SyntaxKind.NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) { - return parseSignatureMember(175 /* SyntaxKind.ConstructSignature */); + return parseSignatureMember(177 /* SyntaxKind.ConstructSignature */); } var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 174 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 175 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers); @@ -34253,9 +34532,9 @@ var ts; function isStartOfMappedType() { nextToken(); if (token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { - return nextToken() === 145 /* SyntaxKind.ReadonlyKeyword */; + return nextToken() === 146 /* SyntaxKind.ReadonlyKeyword */; } - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */) { nextToken(); } return token() === 22 /* SyntaxKind.OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 101 /* SyntaxKind.InKeyword */; @@ -34271,15 +34550,15 @@ var ts; var pos = getNodePos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var readonlyToken; - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { readonlyToken = parseTokenNode(); - if (readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - parseExpected(145 /* SyntaxKind.ReadonlyKeyword */); + if (readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + parseExpected(146 /* SyntaxKind.ReadonlyKeyword */); } } parseExpected(22 /* SyntaxKind.OpenBracketToken */); var typeParameter = parseMappedTypeParameter(); - var nameType = parseOptional(127 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; + var nameType = parseOptional(128 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; parseExpected(23 /* SyntaxKind.CloseBracketToken */); var questionToken; if (token() === 57 /* SyntaxKind.QuestionToken */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { @@ -34393,7 +34672,7 @@ var ts; var openBracePosition = scanner.getTokenPos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var multiLine = scanner.hasPrecedingLineBreak(); - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); parseExpected(58 /* SyntaxKind.ColonToken */); var clause = parseAssertClause(/*skipAssertKeyword*/ true); if (!parseExpected(19 /* SyntaxKind.CloseBraceToken */)) { @@ -34426,16 +34705,16 @@ var ts; } function parseNonArrayType() { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. return tryParse(parseKeywordAndNoDot) || parseTypeReference(); case 66 /* SyntaxKind.AsteriskEqualsToken */: @@ -34468,7 +34747,7 @@ var ts; return parseTokenNode(); case 108 /* SyntaxKind.ThisKeyword */: { var thisKeyword = parseThisTypeNode(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { return parseThisTypePredicate(thisKeyword); } else { @@ -34485,7 +34764,7 @@ var ts; return parseParenthesizedType(); case 100 /* SyntaxKind.ImportKeyword */: return parseImportType(); - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference(); case 15 /* SyntaxKind.TemplateHead */: return parseTemplateType(); @@ -34495,21 +34774,21 @@ var ts; } function isStartOfType(inStartOfParameter) { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 18 /* SyntaxKind.OpenBraceToken */: case 22 /* SyntaxKind.OpenBracketToken */: case 29 /* SyntaxKind.LessThanToken */: @@ -34521,14 +34800,14 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 41 /* SyntaxKind.AsteriskToken */: case 57 /* SyntaxKind.QuestionToken */: case 53 /* SyntaxKind.ExclamationToken */: case 25 /* SyntaxKind.DotDotDotToken */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 100 /* SyntaxKind.ImportKeyword */: - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: return true; @@ -34605,17 +34884,17 @@ var ts; } function parseInferType() { var pos = getNodePos(); - parseExpected(137 /* SyntaxKind.InferKeyword */); + parseExpected(138 /* SyntaxKind.InferKeyword */); return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos); } function parseTypeOperatorOrHigher() { var operator = token(); switch (operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: return parseTypeOperator(operator); - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return parseInferType(); } return allowConditionalTypesAnd(parsePostfixTypeOrHigher); @@ -34735,16 +35014,16 @@ var ts; } function parseTypePredicatePrefix() { var id = parseIdentifier(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { nextToken(); return id; } } function parseAssertsTypePredicate() { var pos = getNodePos(); - var assertsModifier = parseExpectedToken(128 /* SyntaxKind.AssertsKeyword */); + var assertsModifier = parseExpectedToken(129 /* SyntaxKind.AssertsKeyword */); var parameterName = token() === 108 /* SyntaxKind.ThisKeyword */ ? parseThisTypeNode() : parseIdentifier(); - var type = parseOptional(139 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; + var type = parseOptional(140 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos); } function parseType() { @@ -34814,7 +35093,7 @@ var ts; case 45 /* SyntaxKind.PlusPlusToken */: case 46 /* SyntaxKind.MinusMinusToken */: case 29 /* SyntaxKind.LessThanToken */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: case 125 /* SyntaxKind.YieldKeyword */: case 80 /* SyntaxKind.PrivateIdentifier */: // Yield/await always starts an expression. Either it is an identifier (in which case @@ -35002,7 +35281,7 @@ var ts; // Unknown -> There *might* be a parenthesized arrow function here. // Speculatively look ahead to be sure, and rollback if not. function isParenthesizedArrowFunctionExpression() { - if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 132 /* SyntaxKind.AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token() === 38 /* SyntaxKind.EqualsGreaterThanToken */) { @@ -35015,7 +35294,7 @@ var ts; return 0 /* Tristate.False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0 /* Tristate.False */; @@ -35059,8 +35338,8 @@ var ts; // Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This // isn't actually allowed, but we want to treat it as a lambda so we can provide // a good error message. - if (ts.isModifierKind(second) && second !== 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { - if (nextToken() === 127 /* SyntaxKind.AsKeyword */) { + if (ts.isModifierKind(second) && second !== 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { + if (nextToken() === 128 /* SyntaxKind.AsKeyword */) { // https://github.com/microsoft/TypeScript/issues/44466 return 0 /* Tristate.False */; } @@ -35142,7 +35421,7 @@ var ts; } function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) { // We do a check here so that we won't be doing unnecessarily call to "lookAhead" - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* Tristate.True */) { var pos = getNodePos(); var asyncModifier = parseModifiersForArrowFunction(); @@ -35156,7 +35435,7 @@ var ts; // AsyncArrowFunctionExpression: // 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In] // 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In] - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); // If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function // but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher" @@ -35222,7 +35501,7 @@ var ts; // // So we need just a bit of lookahead to ensure that it can only be a signature. var unwrappedType = type; - while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 191 /* SyntaxKind.ParenthesizedType */) { + while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 193 /* SyntaxKind.ParenthesizedType */) { unwrappedType = unwrappedType.type; // Skip parens if need be } var hasJSDocFunctionType = unwrappedType && ts.isJSDocFunctionType(unwrappedType); @@ -35317,7 +35596,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand, pos); } function isInOrOfKeyword(t) { - return t === 101 /* SyntaxKind.InKeyword */ || t === 160 /* SyntaxKind.OfKeyword */; + return t === 101 /* SyntaxKind.InKeyword */ || t === 162 /* SyntaxKind.OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand, pos) { while (true) { @@ -35355,7 +35634,7 @@ var ts; if (token() === 101 /* SyntaxKind.InKeyword */ && inDisallowInContext()) { break; } - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */ || token() === 150 /* SyntaxKind.SatisfiesKeyword */) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -35365,8 +35644,10 @@ var ts; break; } else { + var keywordKind = token(); nextToken(); - leftOperand = makeAsExpression(leftOperand, parseType()); + leftOperand = keywordKind === 150 /* SyntaxKind.SatisfiesKeyword */ ? makeSatisfiesExpression(leftOperand, parseType()) : + makeAsExpression(leftOperand, parseType()); } } else { @@ -35381,6 +35662,9 @@ var ts; } return ts.getBinaryOperatorPrecedence(token()) > 0; } + function makeSatisfiesExpression(left, right) { + return finishNode(factory.createSatisfiesExpression(left, right), left.pos); + } function makeBinaryExpression(left, operatorToken, right, pos) { return finishNode(factory.createBinaryExpression(left, operatorToken, right), pos); } @@ -35404,7 +35688,7 @@ var ts; return finishNode(factory.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); } function isAwaitExpression() { - if (token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -35457,7 +35741,7 @@ var ts; if (token() === 42 /* SyntaxKind.AsteriskAsteriskToken */) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -35498,7 +35782,7 @@ var ts; // UnaryExpression (modified): // < type > UnaryExpression return parseTypeAssertion(); - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: if (isAwaitExpression()) { return parseAwaitExpression(); } @@ -35528,7 +35812,7 @@ var ts; case 89 /* SyntaxKind.DeleteKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: return false; case 29 /* SyntaxKind.LessThanToken */: // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression @@ -35711,11 +35995,11 @@ var ts; var pos = getNodePos(); var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (opening.kind === 283 /* SyntaxKind.JsxOpeningElement */) { var children = parseJsxChildren(opening); var closingElement = void 0; var lastChild = children[children.length - 1]; - if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 278 /* SyntaxKind.JsxElement */ + if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { // when an unclosed JsxOpeningElement incorrectly parses its parent's JsxClosingElement, @@ -35741,11 +36025,11 @@ var ts; } result = finishNode(factory.createJsxElement(opening, children, closingElement), pos); } - else if (opening.kind === 283 /* SyntaxKind.JsxOpeningFragment */) { + else if (opening.kind === 286 /* SyntaxKind.JsxOpeningFragment */) { result = finishNode(factory.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos); } else { - ts.Debug.assert(opening.kind === 279 /* SyntaxKind.JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 282 /* SyntaxKind.JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -35815,7 +36099,7 @@ var ts; break; list.push(child); if (ts.isJsxOpeningElement(openingTag) - && (child === null || child === void 0 ? void 0 : child.kind) === 278 /* SyntaxKind.JsxElement */ + && (child === null || child === void 0 ? void 0 : child.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { // stop after parsing a mismatched child like
...(
) in order to reattach the
higher @@ -36060,7 +36344,7 @@ var ts; } if (isTemplateStartOfTaggedTemplate()) { // Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments - expression = !questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? + expression = !questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest(pos, expression, questionDotToken, /*typeArguments*/ undefined); continue; @@ -36107,7 +36391,7 @@ var ts; } if (typeArguments || token() === 20 /* SyntaxKind.OpenParenToken */) { // Absorb type arguments into CallExpression when preceding expression is ExpressionWithTypeArguments - if (!questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (!questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36193,7 +36477,7 @@ var ts; return parseArrayLiteralExpression(); case 18 /* SyntaxKind.OpenBraceToken */: return parseObjectLiteralExpression(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. // If we encounter `async [no LineTerminator here] function` then this is an async // function; otherwise, its an identifier. @@ -36260,11 +36544,11 @@ var ts; } var decorators = parseDecorators(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); var tokenIsIdentifier = isIdentifier(); @@ -36352,7 +36636,7 @@ var ts; var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false); var typeArguments; // Absorb type arguments into NewExpression when preceding expression is ExpressionWithTypeArguments - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36456,7 +36740,7 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(97 /* SyntaxKind.ForKeyword */); - var awaitToken = parseOptionalToken(132 /* SyntaxKind.AwaitKeyword */); + var awaitToken = parseOptionalToken(133 /* SyntaxKind.AwaitKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var initializer; if (token() !== 26 /* SyntaxKind.SemicolonToken */) { @@ -36468,7 +36752,7 @@ var ts; } } var node; - if (awaitToken ? parseExpected(160 /* SyntaxKind.OfKeyword */) : parseOptional(160 /* SyntaxKind.OfKeyword */)) { + if (awaitToken ? parseExpected(162 /* SyntaxKind.OfKeyword */) : parseOptional(162 /* SyntaxKind.OfKeyword */)) { var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true); }); parseExpected(21 /* SyntaxKind.CloseParenToken */); node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement()); @@ -36495,10 +36779,10 @@ var ts; function parseBreakOrContinueStatement(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(kind === 246 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); + parseExpected(kind === 249 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); var label = canParseSemicolon() ? undefined : parseIdentifier(); parseSemicolon(); - var node = kind === 246 /* SyntaxKind.BreakStatement */ + var node = kind === 249 /* SyntaxKind.BreakStatement */ ? factory.createBreakStatement(label) : factory.createContinueStatement(label); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -36689,25 +36973,26 @@ var ts; // // could be legal, it would add complexity for very little gain. case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: nextToken(); return token() === 18 /* SyntaxKind.OpenBraceToken */ || token() === 79 /* SyntaxKind.Identifier */ || token() === 93 /* SyntaxKind.ExportKeyword */; case 100 /* SyntaxKind.ImportKeyword */: @@ -36716,12 +37001,12 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token()); case 93 /* SyntaxKind.ExportKeyword */: var currentToken_1 = nextToken(); - if (currentToken_1 === 152 /* SyntaxKind.TypeKeyword */) { + if (currentToken_1 === 154 /* SyntaxKind.TypeKeyword */) { currentToken_1 = lookAhead(nextToken); } if (currentToken_1 === 63 /* SyntaxKind.EqualsToken */ || currentToken_1 === 41 /* SyntaxKind.AsteriskToken */ || currentToken_1 === 18 /* SyntaxKind.OpenBraceToken */ || currentToken_1 === 88 /* SyntaxKind.DefaultKeyword */ || - currentToken_1 === 127 /* SyntaxKind.AsKeyword */) { + currentToken_1 === 128 /* SyntaxKind.AsKeyword */) { return true; } continue; @@ -36769,20 +37054,21 @@ var ts; case 85 /* SyntaxKind.ConstKeyword */: case 93 /* SyntaxKind.ExportKeyword */: return isStartOfDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; + case 127 /* SyntaxKind.AccessorKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -36825,9 +37111,9 @@ var ts; case 97 /* SyntaxKind.ForKeyword */: return parseForOrForInOrForOfStatement(); case 86 /* SyntaxKind.ContinueKeyword */: - return parseBreakOrContinueStatement(245 /* SyntaxKind.ContinueStatement */); + return parseBreakOrContinueStatement(248 /* SyntaxKind.ContinueStatement */); case 81 /* SyntaxKind.BreakKeyword */: - return parseBreakOrContinueStatement(246 /* SyntaxKind.BreakStatement */); + return parseBreakOrContinueStatement(249 /* SyntaxKind.BreakStatement */); case 105 /* SyntaxKind.ReturnKeyword */: return parseReturnStatement(); case 116 /* SyntaxKind.WithKeyword */: @@ -36846,12 +37132,12 @@ var ts; return parseDebuggerStatement(); case 59 /* SyntaxKind.AtToken */: return parseDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 93 /* SyntaxKind.ExportKeyword */: @@ -36860,9 +37146,10 @@ var ts; case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -36871,7 +37158,7 @@ var ts; return parseExpressionOrLabeledStatement(); } function isDeclareModifier(modifier) { - return modifier.kind === 135 /* SyntaxKind.DeclareKeyword */; + return modifier.kind === 136 /* SyntaxKind.DeclareKeyword */; } function parseDeclaration() { // `parseListElement` attempted to get the reused node at this position, @@ -36917,13 +37204,13 @@ var ts; return parseClassDeclaration(pos, hasJSDoc, decorators, modifiers); case 118 /* SyntaxKind.InterfaceKeyword */: return parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers); - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers); case 92 /* SyntaxKind.EnumKeyword */: return parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers); - case 157 /* SyntaxKind.GlobalKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers); case 100 /* SyntaxKind.ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36933,7 +37220,7 @@ var ts; case 88 /* SyntaxKind.DefaultKeyword */: case 63 /* SyntaxKind.EqualsToken */: return parseExportAssignment(pos, hasJSDoc, decorators, modifiers); - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: return parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers); default: return parseExportDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36942,7 +37229,7 @@ var ts; if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var missing = createMissingNode(276 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(279 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); missing.illegalDecorators = decorators; missing.modifiers = modifiers; @@ -37068,7 +37355,7 @@ var ts; // this context. // The checker will then give an error that there is an empty declaration list. var declarations; - if (token() === 160 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 162 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { declarations = createMissingList(); } else { @@ -37096,9 +37383,9 @@ var ts; parseExpected(98 /* SyntaxKind.FunctionKeyword */); var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); // We don't parse the name here in await context, instead we will report a grammar error in the checker. - var name = modifierFlags & 512 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); + var name = modifierFlags & 1024 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); var isGenerator = asteriskToken ? 1 /* SignatureFlags.Yield */ : 0 /* SignatureFlags.None */; - var isAsync = modifierFlags & 256 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; + var isAsync = modifierFlags & 512 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; var typeParameters = parseTypeParameters(); if (modifierFlags & 1 /* ModifierFlags.Export */) setAwaitContext(/*value*/ true); @@ -37111,8 +37398,8 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { - if (token() === 134 /* SyntaxKind.ConstructorKeyword */) { - return parseExpected(134 /* SyntaxKind.ConstructorKeyword */); + if (token() === 135 /* SyntaxKind.ConstructorKeyword */) { + return parseExpected(135 /* SyntaxKind.ConstructorKeyword */); } if (token() === 10 /* SyntaxKind.StringLiteral */ && lookAhead(nextToken) === 20 /* SyntaxKind.OpenParenToken */) { return tryParse(function () { @@ -37174,7 +37461,7 @@ var ts; var parameters = parseParameters(0 /* SignatureFlags.None */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ false); var body = parseFunctionBlockOrSemicolon(flags); - var node = kind === 172 /* SyntaxKind.GetAccessor */ + var node = kind === 174 /* SyntaxKind.GetAccessor */ ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body) : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body); // Keep track of `typeParameters` (for both) and `type` (for setters) if they were parsed those indicate grammar errors @@ -37218,7 +37505,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 149 /* SyntaxKind.SetKeyword */ || idToken === 136 /* SyntaxKind.GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 151 /* SyntaxKind.SetKeyword */ || idToken === 137 /* SyntaxKind.GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -37261,7 +37548,7 @@ var ts; return body; } function parseDecoratorExpression() { - if (inAwaitContext() && token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (inAwaitContext() && token() === 133 /* SyntaxKind.AwaitKeyword */) { // `@await` is is disallowed in an [Await] context, but can cause parsing to go off the rails // This simply parses the missing identifier and moves on. var pos = getNodePos(); @@ -37339,10 +37626,10 @@ var ts; } function parseModifiersForArrowFunction() { var modifiers; - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { var pos = getNodePos(); nextToken(); - var modifier = finishNode(factory.createToken(131 /* SyntaxKind.AsyncKeyword */), pos); + var modifier = finishNode(factory.createToken(132 /* SyntaxKind.AsyncKeyword */), pos); modifiers = createNodeArray([modifier], pos); } return modifiers; @@ -37359,13 +37646,13 @@ var ts; if (token() === 124 /* SyntaxKind.StaticKeyword */ && lookAhead(nextTokenIsOpenBrace)) { return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers); } - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } - if (token() === 134 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { + if (token() === 135 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers); if (constructorDeclaration) { return constructorDeclaration; @@ -37402,10 +37689,10 @@ var ts; return ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 226 /* SyntaxKind.ClassExpression */); + return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 228 /* SyntaxKind.ClassExpression */); } function parseClassDeclaration(pos, hasJSDoc, decorators, modifiers) { - return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 257 /* SyntaxKind.ClassDeclaration */); + return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 260 /* SyntaxKind.ClassDeclaration */); } function parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, kind) { var savedAwaitContext = inAwaitContext(); @@ -37427,7 +37714,7 @@ var ts; members = createMissingList(); } setAwaitContext(savedAwaitContext); - var node = kind === 257 /* SyntaxKind.ClassDeclaration */ + var node = kind === 260 /* SyntaxKind.ClassDeclaration */ ? factory.createClassDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members) : factory.createClassExpression(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -37464,7 +37751,7 @@ var ts; function parseExpressionWithTypeArguments() { var pos = getNodePos(); var expression = parseLeftHandSideExpressionOrHigher(); - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { return expression; } var typeArguments = tryParseTypeArguments(); @@ -37491,11 +37778,11 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(152 /* SyntaxKind.TypeKeyword */); + parseExpected(154 /* SyntaxKind.TypeKeyword */); var name = parseIdentifier(); var typeParameters = parseTypeParameters(); parseExpected(63 /* SyntaxKind.EqualsToken */); - var type = token() === 138 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); + var type = token() === 139 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); node.illegalDecorators = decorators; @@ -37554,7 +37841,7 @@ var ts; function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; var name; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // parse 'global' as name of global scope augmentation name = parseIdentifier(); flags |= 1024 /* NodeFlags.GlobalAugmentation */; @@ -37576,15 +37863,15 @@ var ts; } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } - else if (parseOptional(142 /* SyntaxKind.NamespaceKeyword */)) { + else if (parseOptional(143 /* SyntaxKind.NamespaceKeyword */)) { flags |= 16 /* NodeFlags.Namespace */; } else { - parseExpected(141 /* SyntaxKind.ModuleKeyword */); + parseExpected(142 /* SyntaxKind.ModuleKeyword */); if (token() === 10 /* SyntaxKind.StringLiteral */) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } @@ -37592,7 +37879,7 @@ var ts; return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags); } function isExternalModuleReference() { - return token() === 146 /* SyntaxKind.RequireKeyword */ && + return token() === 147 /* SyntaxKind.RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -37605,8 +37892,8 @@ var ts; return nextToken() === 43 /* SyntaxKind.SlashToken */; } function parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(127 /* SyntaxKind.AsKeyword */); - parseExpected(142 /* SyntaxKind.NamespaceKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); + parseExpected(143 /* SyntaxKind.NamespaceKeyword */); var name = parseIdentifier(); parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); @@ -37624,7 +37911,7 @@ var ts; identifier = parseIdentifier(); } var isTypeOnly = false; - if (token() !== 156 /* SyntaxKind.FromKeyword */ && + if (token() !== 158 /* SyntaxKind.FromKeyword */ && (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === "type" && (isIdentifier() || tokenAfterImportDefinitelyProducesImportDeclaration())) { isTypeOnly = true; @@ -37642,11 +37929,11 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ // import { ) { importClause = parseImportClause(identifier, afterImportPos, isTypeOnly); - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); } var moduleSpecifier = parseModuleSpecifier(); var assertClause; - if (token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -37664,7 +37951,7 @@ var ts; function parseAssertClause(skipAssertKeyword) { var pos = getNodePos(); if (!skipAssertKeyword) { - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); } var openBracePosition = scanner.getTokenPos(); if (parseExpected(18 /* SyntaxKind.OpenBraceToken */)) { @@ -37689,7 +37976,7 @@ var ts; function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() { // In `import id ___`, the current token decides whether to produce // an ImportDeclaration or ImportEqualsDeclaration. - return token() === 27 /* SyntaxKind.CommaToken */ || token() === 156 /* SyntaxKind.FromKeyword */; + return token() === 27 /* SyntaxKind.CommaToken */ || token() === 158 /* SyntaxKind.FromKeyword */; } function parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly) { parseExpected(63 /* SyntaxKind.EqualsToken */); @@ -37712,7 +37999,7 @@ var ts; var namedBindings; if (!identifier || parseOptional(27 /* SyntaxKind.CommaToken */)) { - namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(269 /* SyntaxKind.NamedImports */); + namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(272 /* SyntaxKind.NamedImports */); } return finishNode(factory.createImportClause(isTypeOnly, identifier, namedBindings), pos); } @@ -37723,7 +38010,7 @@ var ts; } function parseExternalModuleReference() { var pos = getNodePos(); - parseExpected(146 /* SyntaxKind.RequireKeyword */); + parseExpected(147 /* SyntaxKind.RequireKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var expression = parseModuleSpecifier(); parseExpected(21 /* SyntaxKind.CloseParenToken */); @@ -37747,7 +38034,7 @@ var ts; // * as ImportedBinding var pos = getNodePos(); parseExpected(41 /* SyntaxKind.AsteriskToken */); - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); var name = parseIdentifier(); return finishNode(factory.createNamespaceImport(name), pos); } @@ -37760,17 +38047,17 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - var node = kind === 269 /* SyntaxKind.NamedImports */ + var node = kind === 272 /* SyntaxKind.NamedImports */ ? factory.createNamedImports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseImportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)) : factory.createNamedExports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseExportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)); return finishNode(node, pos); } function parseExportSpecifier() { var hasJSDoc = hasPrecedingJSDocComment(); - return withJSDoc(parseImportOrExportSpecifier(275 /* SyntaxKind.ExportSpecifier */), hasJSDoc); + return withJSDoc(parseImportOrExportSpecifier(278 /* SyntaxKind.ExportSpecifier */), hasJSDoc); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(270 /* SyntaxKind.ImportSpecifier */); + return parseImportOrExportSpecifier(273 /* SyntaxKind.ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var pos = getNodePos(); @@ -37795,10 +38082,10 @@ var ts; // import { type as } from "mod"; - isTypeOnly: true, name: as // import { type as as } from "mod"; - isTypeOnly: false, name: as, propertyName: type // import { type as as as } from "mod"; - isTypeOnly: true, name: as, propertyName: as - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as ...? } var firstAs = parseIdentifierName(); - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as as ...? } var secondAs = parseIdentifierName(); if (ts.tokenIsIdentifierOrKeyword(token())) { @@ -37833,15 +38120,15 @@ var ts; name = parseNameWithKeywordCheck(); } } - if (canParseAsKeyword && token() === 127 /* SyntaxKind.AsKeyword */) { + if (canParseAsKeyword && token() === 128 /* SyntaxKind.AsKeyword */) { propertyName = name; - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); name = parseNameWithKeywordCheck(); } - if (kind === 270 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 273 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } - var node = kind === 270 /* SyntaxKind.ImportSpecifier */ + var node = kind === 273 /* SyntaxKind.ImportSpecifier */ ? factory.createImportSpecifier(isTypeOnly, propertyName, name) : factory.createExportSpecifier(isTypeOnly, propertyName, name); return finishNode(node, pos); @@ -37861,26 +38148,26 @@ var ts; var exportClause; var moduleSpecifier; var assertClause; - var isTypeOnly = parseOptional(152 /* SyntaxKind.TypeKeyword */); + var isTypeOnly = parseOptional(154 /* SyntaxKind.TypeKeyword */); var namespaceExportPos = getNodePos(); if (parseOptional(41 /* SyntaxKind.AsteriskToken */)) { - if (parseOptional(127 /* SyntaxKind.AsKeyword */)) { + if (parseOptional(128 /* SyntaxKind.AsKeyword */)) { exportClause = parseNamespaceExport(namespaceExportPos); } - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } else { - exportClause = parseNamedImportsOrExports(273 /* SyntaxKind.NamedExports */); + exportClause = parseNamedImportsOrExports(276 /* SyntaxKind.NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token() === 156 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(156 /* SyntaxKind.FromKeyword */); + if (token() === 158 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } } - if (moduleSpecifier && token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (moduleSpecifier && token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -38493,9 +38780,9 @@ var ts; } function isObjectOrObjectArrayTypeReference(node) { switch (node.kind) { - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isObjectOrObjectArrayTypeReference(node.elementType); default: return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; @@ -38527,12 +38814,12 @@ var ts; var child = void 0; var children = void 0; while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) { - if (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) { + if (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) { children = ts.append(children, child); } } if (children) { - var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */), pos); + var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */), pos); return finishNode(factory.createJSDocTypeExpression(literal), pos); } } @@ -38650,7 +38937,7 @@ var ts; var hasChildren = false; while (child = tryParse(function () { return parseChildPropertyTag(indent); })) { hasChildren = true; - if (child.kind === 343 /* SyntaxKind.JSDocTypeTag */) { + if (child.kind === 346 /* SyntaxKind.JSDocTypeTag */) { if (childTypeTag) { var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); if (lastError) { @@ -38667,7 +38954,7 @@ var ts; } } if (hasChildren) { - var isArrayType = typeExpression && typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */; + var isArrayType = typeExpression && typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */; var jsdocTypeLiteral = factory.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType); typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : @@ -38719,7 +39006,7 @@ var ts; var returnTag = tryParse(function () { if (parseOptionalJsdoc(59 /* SyntaxKind.AtToken */)) { var tag = parseTag(indent); - if (tag && tag.kind === 341 /* SyntaxKind.JSDocReturnTag */) { + if (tag && tag.kind === 344 /* SyntaxKind.JSDocReturnTag */) { return tag; } } @@ -38754,7 +39041,7 @@ var ts; case 59 /* SyntaxKind.AtToken */: if (canParseTag) { var child = tryParseChildTag(target, indent); - if (child && (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) && + if (child && (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) && target !== 4 /* PropertyLikeParse.CallbackParameter */ && name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; @@ -39724,6 +40011,7 @@ var ts; ["es2019.object", "lib.es2019.object.d.ts"], ["es2019.string", "lib.es2019.string.d.ts"], ["es2019.symbol", "lib.es2019.symbol.d.ts"], + ["es2019.intl", "lib.es2019.intl.d.ts"], ["es2020.bigint", "lib.es2020.bigint.d.ts"], ["es2020.date", "lib.es2020.date.d.ts"], ["es2020.promise", "lib.es2020.promise.d.ts"], @@ -39844,6 +40132,7 @@ var ts; shortName: "h", type: "boolean", showInSimplifiedHelpView: true, + isCommandLineOnly: true, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, defaultValueDescription: false, @@ -39852,6 +40141,8 @@ var ts; name: "help", shortName: "?", type: "boolean", + isCommandLineOnly: true, + category: ts.Diagnostics.Command_line_Options, defaultValueDescription: false, }, { @@ -41583,7 +41874,7 @@ var ts; var _a; var rootExpression = (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression; var knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : undefined; - if (rootExpression && rootExpression.kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (rootExpression && rootExpression.kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, rootExpression, ts.Diagnostics.The_root_value_of_a_0_file_must_be_an_object, ts.getBaseFileName(sourceFile.fileName) === "jsconfig.json" ? "jsconfig.json" : "tsconfig.json")); // Last-ditch error recovery. Somewhat useful because the JSON parser will recover from some parse errors by // synthesizing a top-level array literal expression. There's a reasonable chance the first element of that @@ -41623,7 +41914,7 @@ var ts; function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) { var result = returnValue ? {} : undefined; var _loop_4 = function (element) { - if (element.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (element.kind !== 299 /* SyntaxKind.PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); return "continue"; } @@ -41717,13 +42008,13 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: reportInvalidOptionValue(option && option.type !== "number"); return validateValue(Number(valueExpression.text)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (valueExpression.operator !== 40 /* SyntaxKind.MinusToken */ || valueExpression.operand.kind !== 8 /* SyntaxKind.NumericLiteral */) { break; // not valid JSON syntax } reportInvalidOptionValue(option && option.type !== "number"); return validateValue(-Number(valueExpression.operand.text)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; // Currently having element option declaration in the tsconfig with type "object" @@ -41740,7 +42031,7 @@ var ts; return validateValue(convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined, /*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined)); } - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: reportInvalidOptionValue(option && option.type !== "list"); return validateValue(convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element)); } @@ -41972,12 +42263,23 @@ var ts; } function writeConfigurations() { // Filter applicable options to place in the file - var categorizedOptions = ts.createMultiMap(); + var categorizedOptions = new ts.Map(); + // Set allowed categories in order + categorizedOptions.set(ts.Diagnostics.Projects, []); + categorizedOptions.set(ts.Diagnostics.Language_and_Environment, []); + categorizedOptions.set(ts.Diagnostics.Modules, []); + categorizedOptions.set(ts.Diagnostics.JavaScript_Support, []); + categorizedOptions.set(ts.Diagnostics.Emit, []); + categorizedOptions.set(ts.Diagnostics.Interop_Constraints, []); + categorizedOptions.set(ts.Diagnostics.Type_Checking, []); + categorizedOptions.set(ts.Diagnostics.Completeness, []); for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) { var option = optionDeclarations_1[_i]; - var category = option.category; if (isAllowedOptionForOutput(option)) { - categorizedOptions.add(ts.getLocaleSpecificMessage(category), option); + var listForCategory = categorizedOptions.get(option.category); + if (!listForCategory) + categorizedOptions.set(option.category, listForCategory = []); + listForCategory.push(option); } } // Serialize all options and their descriptions @@ -41988,7 +42290,7 @@ var ts; if (entries.length !== 0) { entries.push({ value: "" }); } - entries.push({ value: "/* ".concat(category, " */") }); + entries.push({ value: "/* ".concat(ts.getLocaleSpecificMessage(category), " */") }); for (var _i = 0, options_1 = options; _i < options_1.length; _i++) { var option = options_1[_i]; var optionName = void 0; @@ -42924,7 +43226,7 @@ var ts; function convertCompilerOptionsForTelemetry(opts) { var out = {}; for (var key in opts) { - if (opts.hasOwnProperty(key)) { + if (ts.hasProperty(opts, key)) { var type = getOptionFromName(key); if (type !== undefined) { // Ignore unknown options out[key] = getOptionValueWithEmptyStrings(opts[key], type); @@ -44030,6 +44332,9 @@ var ts; requestContainingDirectory: containingDirectory, reportDiagnostic: function (diag) { return void diagnostics.push(diag); }, }; + if (traceEnabled && ts.getEmitModuleResolutionKind(compilerOptions) >= ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) <= ts.ModuleResolutionKind.NodeNext) { + trace(host, ts.Diagnostics.Resolving_in_0_mode_with_conditions_1, features & NodeResolutionFeatures.EsmMode ? "ESM" : "CJS", conditions.map(function (c) { return "'".concat(c, "'"); }).join(", ")); + } var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); }); return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache); function tryResolve(extensions) { @@ -44619,7 +44924,7 @@ var ts; } if (mainExport) { var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false); - return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false); + return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false, "."); } } else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) { @@ -44699,7 +45004,7 @@ var ts; var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports); if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) { var target = lookupTable[moduleName]; - return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false); + return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false, moduleName); } var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys); for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) { @@ -44708,17 +45013,17 @@ var ts; var target = lookupTable[potentialTarget]; var starPos = potentialTarget.indexOf("*"); var subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos)); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget); } else if (ts.endsWith(potentialTarget, "*") && ts.startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) { var target = lookupTable[potentialTarget]; var subpath = moduleName.substring(potentialTarget.length - 1); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget); } else if (ts.startsWith(moduleName, potentialTarget)) { var target = lookupTable[potentialTarget]; var subpath = moduleName.substring(potentialTarget.length); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false, potentialTarget); } } function matchesPatternWithTrailer(target, name) { @@ -44735,7 +45040,7 @@ var ts; */ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) { return loadModuleFromTargetImportOrExport; - function loadModuleFromTargetImportOrExport(target, subpath, pattern) { + function loadModuleFromTargetImportOrExport(target, subpath, pattern, key) { if (typeof target === "string") { if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) { if (state.traceEnabled) { @@ -44746,6 +45051,8 @@ var ts; if (!ts.startsWith(target, "./")) { if (isImports && !ts.startsWith(target, "../") && !ts.startsWith(target, "/") && !ts.isRootedDiskPath(target)) { var combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath; + traceIfEnabled(state, ts.Diagnostics.Using_0_subpath_1_with_target_2, "imports", key, combinedLookup); + traceIfEnabled(state, ts.Diagnostics.Resolving_module_0_from_1, combinedLookup, scope.packageDirectory + "/"); var result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference); return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : undefined); } @@ -44772,6 +45079,9 @@ var ts; } return toSearchResult(/*value*/ undefined); } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Using_0_subpath_1_with_target_2, isImports ? "imports" : "exports", key, pattern ? target.replace(/\*/g, subpath) : target + subpath); + } var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath); var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports); if (inputLink) @@ -44781,14 +45091,18 @@ var ts; else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null if (!Array.isArray(target)) { for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) { - var key = _a[_i]; - if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) { - var subTarget = target[key]; - var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern); + var condition = _a[_i]; + if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) { + traceIfEnabled(state, ts.Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition); + var subTarget = target[condition]; + var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key); if (result) { return result; } } + else { + traceIfEnabled(state, ts.Diagnostics.Saw_non_matching_condition_0, condition); + } } return undefined; } @@ -44801,7 +45115,7 @@ var ts; } for (var _b = 0, target_2 = target; _b < target_2.length; _b++) { var elem = target_2[_b]; - var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern); + var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern, key); if (result) { return result; } @@ -44996,6 +45310,7 @@ var ts; } } function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) { + var _a; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName)); // First look for a nested package.json, as in `node_modules/foo/bar/package.json`. var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state); @@ -45010,13 +45325,7 @@ var ts; return withPackageId(packageInfo, fromDirectory); } } - var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest; var loader = function (extensions, candidate, onlyRecordFailures, state) { - var _a; - // package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them) - if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { - return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; - } var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo @@ -45029,19 +45338,24 @@ var ts; } return withPackageId(packageInfo, pathAndExtension); }; - if (rest !== "") { // If "rest" is empty, we just did this search above. - var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); - // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings. + var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest; + var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); + if (rest !== "") { + // Previous `packageInfo` may have been from a nested package.json; ensure we have the one from the package root now. packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.contents.versionPaths) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); - } - var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); - var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); - if (fromPaths) { - return fromPaths.value; - } + } + // package exports are higher priority than file/directory/typesVersions lookups and (and, if there's exports present, blocks them) + if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; + } + if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); + } + var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); + if (fromPaths) { + return fromPaths.value; } } return loader(extensions, candidate, !nodeModulesDirectoryExists, state); @@ -45217,6 +45531,15 @@ var ts; function toSearchResult(value) { return value !== undefined ? { value: value } : undefined; } + function traceIfEnabled(state, diagnostic) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + if (state.traceEnabled) { + trace.apply(void 0, __spreadArray([state.host, diagnostic], args, false)); + } + } })(ts || (ts = {})); /* @internal */ var ts; @@ -45251,26 +45574,26 @@ var ts; // A module is uninstantiated if it contains only switch (node.kind) { // 1. interface declarations, type alias declarations - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return 0 /* ModuleInstanceState.NonInstantiated */; // 2. const enum declarations - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (ts.isEnumConst(node)) { return 2 /* ModuleInstanceState.ConstEnumOnly */; } break; // 3. non-exported import declarations - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (!(ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */))) { return 0 /* ModuleInstanceState.NonInstantiated */; } break; // 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDeclaration = node; - if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 273 /* SyntaxKind.NamedExports */) { + if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 276 /* SyntaxKind.NamedExports */) { var state = 0 /* ModuleInstanceState.NonInstantiated */; for (var _i = 0, _a = exportDeclaration.exportClause.elements; _i < _a.length; _i++) { var specifier = _a[_i]; @@ -45286,7 +45609,7 @@ var ts; } break; // 5. other uninstantiated module declarations. - case 262 /* SyntaxKind.ModuleBlock */: { + case 265 /* SyntaxKind.ModuleBlock */: { var state_1 = 0 /* ModuleInstanceState.NonInstantiated */; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateCached(n, visited); @@ -45308,7 +45631,7 @@ var ts; }); return state_1; } - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(node, visited); case 79 /* SyntaxKind.Identifier */: // Only jsdoc typedef definition can exist in jsdoc namespace, and it should @@ -45509,7 +45832,7 @@ var ts; // Should not be called on a declaration with a computed property name, // unless it is a well known Symbol. function getDeclarationName(node) { - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) { return node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; } var name = ts.getNameOfDeclaration(node); @@ -45518,7 +45841,7 @@ var ts; var moduleName = ts.getTextOfIdentifierOrLiteral(name); return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"".concat(moduleName, "\"")); } - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { var nameExpression = name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteralLike(nameExpression)) { @@ -45544,36 +45867,36 @@ var ts; return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "__constructor" /* InternalSymbolName.Constructor */; - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return "__call" /* InternalSymbolName.Call */; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return "__new" /* InternalSymbolName.New */; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "__index" /* InternalSymbolName.Index */; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return "__export" /* InternalSymbolName.ExportStar */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // json file should behave as // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */) { // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* InternalSymbolName.New */ : "__call" /* InternalSymbolName.Call */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); + ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; @@ -45592,7 +45915,7 @@ var ts; */ function declareSymbol(symbolTable, parent, node, includes, excludes, isReplaceableByMethod, isComputedName) { ts.Debug.assert(isComputedName || !ts.hasDynamicName(node)); - var isDefaultExport = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; + var isDefaultExport = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; // The exported symbol for an export default function/class node is always named "default" var name = isComputedName ? "__computed" /* InternalSymbolName.Computed */ : isDefaultExport && parent ? "default" /* InternalSymbolName.Default */ @@ -45675,7 +45998,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (node.kind === 271 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { + (node.kind === 274 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; messageNeedsName_1 = false; multipleDefaultExports_1 = true; @@ -45714,7 +46037,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = !!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) || jsdocTreatAsExported(node); if (symbolFlags & 2097152 /* SymbolFlags.Alias */) { - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */ || (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */ || (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -45739,7 +46062,7 @@ var ts; if (ts.isJSDocTypeAlias(node)) ts.Debug.assert(ts.isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 64 /* NodeFlags.ExportContext */)) { - if (!container.locals || (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) && !getDeclarationName(node))) { + if (!container.locals || (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) && !getDeclarationName(node))) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default! } var exportKind = symbolFlags & 111551 /* SymbolFlags.Value */ ? 1048576 /* SymbolFlags.ExportValue */ : 0; @@ -45803,7 +46126,7 @@ var ts; // for it. We must clear this so we don't accidentally move any stale data forward from // a previous compilation. if (containerFlags & 1 /* ContainerFlags.IsContainer */) { - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -45825,10 +46148,10 @@ var ts; var saveActiveLabelList = activeLabelList; var saveHasExplicitReturn = hasExplicitReturn; var isImmediatelyInvoked = (containerFlags & 16 /* ContainerFlags.IsFunctionExpression */ && - !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Async */) && + !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Async */) && !node.asteriskToken && !!ts.getImmediatelyInvokedFunctionExpression(node)) || - node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; // A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave // similarly to break statements that exit to a label just past the statement body. if (!isImmediatelyInvoked) { @@ -45839,7 +46162,7 @@ var ts; } // We create a return control flow graph for IIFEs and constructors. For constructors // we use the return control flow graph in strict property initialization checks. - currentReturnTarget = isImmediatelyInvoked || node.kind === 171 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; + currentReturnTarget = isImmediatelyInvoked || node.kind === 173 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; currentExceptionTarget = undefined; currentBreakTarget = undefined; currentContinueTarget = undefined; @@ -45854,14 +46177,14 @@ var ts; node.flags |= 512 /* NodeFlags.HasExplicitReturn */; node.endFlowNode = currentFlow; } - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { node.flags |= emitFlags; node.endFlowNode = currentFlow; } if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); currentFlow = finishFlowLabel(currentReturnTarget); - if (node.kind === 171 /* SyntaxKind.Constructor */ || node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */))) { + if (node.kind === 173 /* SyntaxKind.Constructor */ || node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */))) { node.returnFlowNode = currentFlow; } } @@ -45888,8 +46211,8 @@ var ts; blockScopeContainer = savedBlockScopeContainer; } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -45912,59 +46235,59 @@ var ts; inAssignmentPattern = saveInAssignmentPattern; return; } - if (node.kind >= 237 /* SyntaxKind.FirstStatement */ && node.kind <= 253 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { + if (node.kind >= 240 /* SyntaxKind.FirstStatement */ && node.kind <= 256 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { node.flowNode = currentFlow; } switch (node.kind) { - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: bindWhileStatement(node); break; - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: bindDoStatement(node); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: bindForStatement(node); break; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: bindForInOrForOfStatement(node); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: bindIfStatement(node); break; - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: bindReturnOrThrow(node); break; - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: bindTryStatement(node); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: bindSwitchStatement(node); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: bindCaseBlock(node); break; - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: bindCaseClause(node); break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: bindExpressionStatement(node); break; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: bindLabeledStatement(node); break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { // Carry over whether we are in an assignment pattern to // binary expressions that could actually be an initializer @@ -45974,47 +46297,50 @@ var ts; } bindBinaryExpressionFlow(node); break; - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bindAccessExpressionFlow(node); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bindCallExpressionFlow(node); break; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: bindNonNullExpressionFlow(node); break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: bindJSDocTypeAlias(node); break; // In source files and blocks, bind functions first to match hoisting that occurs at runtime - case 305 /* SyntaxKind.SourceFile */: { + case 308 /* SyntaxKind.SourceFile */: { bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; } - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: bindEachFunctionsFirst(node.statements); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: bindBindingElementFlow(node); break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 225 /* SyntaxKind.SpreadElement */: + case 166 /* SyntaxKind.Parameter */: + bindParameterFlow(node); + break; + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 227 /* SyntaxKind.SpreadElement */: // Carry over whether we are in an assignment pattern of Object and Array literals // as well as their children that are valid assignment targets. inAssignmentPattern = saveInAssignmentPattern; @@ -46031,19 +46357,19 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: case 108 /* SyntaxKind.ThisKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return containsNarrowableReference(expr); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return hasNarrowableArgument(expr); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isNarrowingExpression(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 53 /* SyntaxKind.ExclamationToken */ && isNarrowingExpression(expr.operand); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return isNarrowingExpression(expr.expression); } return false; @@ -46067,7 +46393,7 @@ var ts; } } } - if (expr.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expr.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && containsNarrowableReference(expr.expression.expression)) { return true; } @@ -46100,9 +46426,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (expr.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: return isNarrowableOperand(expr.left); @@ -46178,26 +46504,26 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: + case 245 /* SyntaxKind.ForStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { + else if (node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { node = node.operand; } else { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */); } @@ -46243,7 +46569,7 @@ var ts; } function setContinueTarget(node, target) { var label = activeLabelList; - while (label && node.parent.kind === 250 /* SyntaxKind.LabeledStatement */) { + while (label && node.parent.kind === 253 /* SyntaxKind.LabeledStatement */) { label.continueTarget = target; label = label.next; node = node.parent; @@ -46294,12 +46620,12 @@ var ts; bind(node.expression); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.kind === 247 /* SyntaxKind.ForOfStatement */) { bind(node.awaitModifier); } addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -46321,7 +46647,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (node.kind === 250 /* SyntaxKind.ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -46338,7 +46664,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 246 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 249 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -46443,7 +46769,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 290 /* SyntaxKind.DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 293 /* SyntaxKind.DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). Note, we no longer need // this property in control flow analysis, it's there only for backwards compatibility. @@ -46491,7 +46817,7 @@ var ts; function maybeBindExpressionFlowIfCall(node) { // A top level or comma expression call expression with a dotted function name and at least one argument // is potentially an assertion and is therefore included in the control flow. - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { var call = node; if (call.expression.kind !== 106 /* SyntaxKind.SuperKeyword */ && ts.isDottedName(call.expression)) { currentFlow = createFlowCall(currentFlow, call); @@ -46517,7 +46843,7 @@ var ts; currentFlow = finishFlowLabel(postStatementLabel); } function bindDestructuringTargetFlow(node) { - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -46528,10 +46854,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowMutation(16 /* FlowFlags.Assignment */, currentFlow, node); } - else if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + else if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -46539,16 +46865,16 @@ var ts; } } } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (p.kind === 299 /* SyntaxKind.PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + else if (p.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (p.kind === 301 /* SyntaxKind.SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -46685,7 +47011,7 @@ var ts; var operator = node.operatorToken.kind; if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 209 /* SyntaxKind.ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46713,7 +47039,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -46751,24 +47077,42 @@ var ts; } } function bindBindingElementFlow(node) { - if (ts.isBindingPattern(node.name)) { - // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: - // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - bind(node.dotDotDotToken); - bind(node.propertyName); - bind(node.initializer); - bind(node.name); + // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: + // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + bind(node.dotDotDotToken); + bind(node.propertyName); + bindInitializer(node.initializer); + bind(node.name); + } + function bindParameterFlow(node) { + bindEach(node.modifiers); + bind(node.dotDotDotToken); + bind(node.questionToken); + bind(node.type); + bindInitializer(node.initializer); + bind(node.name); + } + // a BindingElement/Parameter does not have side effects if initializers are not evaluated and used. (see GH#49759) + function bindInitializer(node) { + if (!node) { + return; } - else { - bindEachChild(node); + var entryFlow = currentFlow; + bind(node); + if (entryFlow === unreachableFlow || entryFlow === currentFlow) { + return; } + var exitFlow = createBranchLabel(); + addAntecedent(exitFlow, entryFlow); + addAntecedent(exitFlow, currentFlow); + currentFlow = finishFlowLabel(exitFlow); } function bindJSDocTypeAlias(node) { bind(node.tagName); - if (node.kind !== 339 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { + if (node.kind !== 342 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { // don't bind the type name yet; that's delayed until delayedBindJSDocTypedefTag ts.setParent(node.fullName, node); ts.setParentRecursive(node.fullName, /*incremental*/ false); @@ -46780,7 +47124,7 @@ var ts; function bindJSDocClassTag(node) { bindEachChild(node); var host = ts.getHostSignatureFromJSDoc(node); - if (host && host.kind !== 169 /* SyntaxKind.MethodDeclaration */) { + if (host && host.kind !== 171 /* SyntaxKind.MethodDeclaration */) { addDeclarationToSymbol(host.symbol, host, 32 /* SymbolFlags.Class */); } } @@ -46793,15 +47137,15 @@ var ts; } function bindOptionalChainRest(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: bind(node.questionDotToken); bind(node.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bind(node.questionDotToken); bind(node.argumentExpression); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bind(node.questionDotToken); bindEach(node.typeArguments); bindEach(node.arguments); @@ -46866,7 +47210,7 @@ var ts; // an immediately invoked function expression (IIFE). Initialize the flowNode property to // the current control flow (which includes evaluation of the IIFE arguments). var expr = ts.skipParentheses(node.expression); - if (expr.kind === 213 /* SyntaxKind.FunctionExpression */ || expr.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (expr.kind === 215 /* SyntaxKind.FunctionExpression */ || expr.kind === 216 /* SyntaxKind.ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -46878,7 +47222,7 @@ var ts; } } } - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var propertyAccess = node.expression; if (ts.isIdentifier(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46887,55 +47231,55 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 286 /* SyntaxKind.JsxAttributes */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 289 /* SyntaxKind.JsxAttributes */: return 1 /* ContainerFlags.IsContainer */; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 64 /* ContainerFlags.IsInterface */; - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: - case 176 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: + case 178 /* SyntaxKind.IndexSignature */: return 1 /* ContainerFlags.IsContainer */ | 32 /* ContainerFlags.HasLocals */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 128 /* ContainerFlags.IsObjectLiteralOrClassExpressionMethodOrAccessor */; } // falls through - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 179 /* SyntaxKind.FunctionType */: - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 181 /* SyntaxKind.FunctionType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 16 /* ContainerFlags.IsFunctionExpression */; - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return 4 /* ContainerFlags.IsControlFlowContainer */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer ? 4 /* ContainerFlags.IsControlFlowContainer */ : 0; - case 292 /* SyntaxKind.CatchClause */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 263 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 266 /* SyntaxKind.CaseBlock */: return 2 /* ContainerFlags.IsBlockScopedContainer */; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -46968,46 +47312,46 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 286 /* SyntaxKind.JsxAttributes */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 289 /* SyntaxKind.JsxAttributes */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -47115,10 +47459,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -47215,7 +47559,7 @@ var ts; node.originalKeywordKind <= 125 /* SyntaxKind.LastFutureReservedWord */) { file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); } - else if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + else if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { if (ts.isExternalModule(file) && ts.isInTopLevelContext(node)) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, ts.declarationNameToString(node))); } @@ -47317,8 +47661,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 305 /* SyntaxKind.SourceFile */ && - blockScopeContainer.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && + if (blockScopeContainer.kind !== 308 /* SyntaxKind.SourceFile */ && + blockScopeContainer.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -47415,7 +47759,7 @@ var ts; // the current 'container' node when it changes. This helps us know which symbol table // a local should go into for example. Since terminal nodes are known not to have // children, as an optimization we don't process those. - if (node.kind > 160 /* SyntaxKind.LastToken */) { + if (node.kind > 162 /* SyntaxKind.LastToken */) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -47491,23 +47835,23 @@ var ts; } // falls through case 108 /* SyntaxKind.ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkContextualIdentifier(node); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: if (currentFlow && ts.isPartOfTypeQuery(node)) { node.flowNode = currentFlow; } break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: case 106 /* SyntaxKind.SuperKeyword */: node.flowNode = currentFlow; break; case 80 /* SyntaxKind.PrivateIdentifier */: return checkPrivateIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node; if (currentFlow && isNarrowableReference(expr)) { expr.flowNode = currentFlow; @@ -47522,7 +47866,7 @@ var ts; declareSymbol(file.locals, /*parent*/ undefined, expr.expression, 1 /* SymbolFlags.FunctionScopedVariable */ | 134217728 /* SymbolFlags.ModuleExports */, 111550 /* SymbolFlags.FunctionScopedVariableExcludes */); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var specialKind = ts.getAssignmentDeclarationKind(node); switch (specialKind) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -47558,78 +47902,78 @@ var ts; ts.Debug.fail("Unknown binary expression special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return checkStrictModeCatchClause(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* SyntaxKind.NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkStrictModeWithStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkStrictModeLabeledStatement(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: seenThisKeyword = true; return; - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: break; // Binding the children will handle everything - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return bindTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return bindParameter(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return bindVariableDeclarationOrBindingElement(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return bindPropertyWorker(node); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* SymbolFlags.EnumMember */, 900095 /* SymbolFlags.EnumMemberExcludes */); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* SymbolFlags.Signature */, 0 /* SymbolFlags.None */); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* SymbolFlags.Method */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), ts.isObjectLiteralMethod(node) ? 0 /* SymbolFlags.PropertyExcludes */ : 103359 /* SymbolFlags.MethodExcludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return bindFunctionDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* SymbolFlags.Constructor */, /*symbolExcludes:*/ 0 /* SymbolFlags.None */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* SymbolFlags.GetAccessor */, 46015 /* SymbolFlags.GetAccessorExcludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SymbolFlags.SetAccessor */, 78783 /* SymbolFlags.SetAccessorExcludes */); - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: + case 182 /* SyntaxKind.ConstructorType */: return bindFunctionOrConstructorType(node); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 195 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 197 /* SyntaxKind.MappedType */: return bindAnonymousTypeWorker(node); - case 332 /* SyntaxKind.JSDocClassTag */: + case 335 /* SyntaxKind.JSDocClassTag */: return bindJSDocClassTag(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return bindFunctionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: var assignmentKind = ts.getAssignmentDeclarationKind(node); switch (assignmentKind) { case 7 /* AssignmentDeclarationKind.ObjectDefinePropertyValue */: @@ -47648,70 +47992,73 @@ var ts; } break; // Members of classes, interfaces, and modules - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* SymbolFlags.Interface */, 788872 /* SymbolFlags.InterfaceExcludes */); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* SymbolFlags.TypeAlias */, 788968 /* SymbolFlags.TypeAliasExcludes */); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return bindEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return bindJsxAttributes(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return bindJsxAttribute(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); // Imports and exports - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 2097152 /* SymbolFlags.Alias */, 2097152 /* SymbolFlags.AliasExcludes */); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return bindImportClause(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return bindExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return bindExportAssignment(node); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (!ts.isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) { return; } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 340 /* SyntaxKind.JSDocParameterTag */: - if (node.parent.kind === 323 /* SyntaxKind.JSDocSignature */) { + case 343 /* SyntaxKind.JSDocParameterTag */: + if (node.parent.kind === 326 /* SyntaxKind.JSDocSignature */) { return bindParameter(node); } - if (node.parent.kind !== 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (node.parent.kind !== 325 /* SyntaxKind.JSDocTypeLiteral */) { break; } // falls through - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ ? 4 /* SymbolFlags.Property */ | 16777216 /* SymbolFlags.Optional */ : 4 /* SymbolFlags.Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* SymbolFlags.PropertyExcludes */); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return (delayedTypeAliases || (delayedTypeAliases = [])).push(node); } } function bindPropertyWorker(node) { - return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), 0 /* SymbolFlags.PropertyExcludes */); + var isAutoAccessor = ts.isAutoAccessorPropertyDeclaration(node); + var includes = isAutoAccessor ? 98304 /* SymbolFlags.Accessor */ : 4 /* SymbolFlags.Property */; + var excludes = isAutoAccessor ? 13247 /* SymbolFlags.AccessorExcludes */ : 0 /* SymbolFlags.PropertyExcludes */; + return bindPropertyOrMethodOrAccessor(node, includes | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), excludes); } function bindAnonymousTypeWorker(node) { return bindAnonymousDeclaration(node, 2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); @@ -47871,8 +48218,8 @@ var ts; } var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false); switch (thisContainer.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var constructorSymbol = thisContainer.symbol; // For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression. if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -47894,12 +48241,12 @@ var ts; addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, 32 /* SymbolFlags.Class */); } break; - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // this.foo assignment in a JavaScript class // Bind this property to the containing class var containingClass = thisContainer.parent; @@ -47911,7 +48258,7 @@ var ts; declareSymbol(symbolTable, containingClass.symbol, node, 4 /* SymbolFlags.Property */ | 67108864 /* SymbolFlags.Assignment */, 0 /* SymbolFlags.None */, /*isReplaceableByMethod*/ true); } break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script if (ts.hasDynamicName(node)) { break; @@ -47940,7 +48287,7 @@ var ts; if (node.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { bindThisPropertyAssignment(node); } - else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -47980,7 +48327,7 @@ var ts; } function bindObjectDefinePropertyAssignment(node) { var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]); - var isToplevel = node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + var isToplevel = node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false, /*containerIsClass*/ false); bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false); } @@ -48089,8 +48436,8 @@ var ts; } function isTopLevelNamespaceAssignment(propertyAccess) { return ts.isBinaryExpression(propertyAccess.parent) - ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 305 /* SyntaxKind.SourceFile */ - : propertyAccess.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 308 /* SyntaxKind.SourceFile */ + : propertyAccess.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; } function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) { var namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer); @@ -48169,7 +48516,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 257 /* SyntaxKind.ClassDeclaration */) { + if (node.kind === 260 /* SyntaxKind.ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* SymbolFlags.Class */, 899503 /* SymbolFlags.ClassExcludes */); } else { @@ -48211,7 +48558,7 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } if (!ts.isBindingPattern(node.name)) { - var possibleVariableDecl = node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; + var possibleVariableDecl = node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !ts.getJSDocTypeTag(node) && @@ -48239,7 +48586,7 @@ var ts; } } function bindParameter(node) { - if (node.kind === 340 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 323 /* SyntaxKind.JSDocSignature */) { + if (node.kind === 343 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 326 /* SyntaxKind.JSDocSignature */) { return; } if (inStrictMode && !(node.flags & 16777216 /* NodeFlags.Ambient */)) { @@ -48316,7 +48663,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 262144 /* SymbolFlags.TypeParameter */, 526824 /* SymbolFlags.TypeParameterExcludes */); } } - else if (node.parent.kind === 190 /* SyntaxKind.InferType */) { + else if (node.parent.kind === 192 /* SyntaxKind.InferType */) { var container_2 = getInferTypeContainer(node.parent); if (container_2) { if (!container_2.locals) { @@ -48344,11 +48691,11 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 236 /* SyntaxKind.EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 239 /* SyntaxKind.EmptyStatement */) || // report error on class declarations - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); + (node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); if (reportError) { currentFlow = reportedUnreachableFlow; if (!options.allowUnreachableCode) { @@ -48392,12 +48739,12 @@ var ts; } function isPurelyTypeDeclaration(s) { switch (s.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(s) !== 1 /* ModuleInstanceState.Instantiated */; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.hasSyntacticModifier(s, 2048 /* ModifierFlags.Const */); default: return false; @@ -48598,7 +48945,7 @@ var ts; // (their type resolved directly to the member deeply referenced) // So to get the intervening symbols, we need to check if there's a type // query node on any of the symbol's declarations and get symbols there - if (d.type && d.type.kind === 181 /* SyntaxKind.TypeQuery */) { + if (d.type && d.type.kind === 183 /* SyntaxKind.TypeQuery */) { var query = d.type; var entity = getResolvedSymbol(getFirstIdentifier(query.exprName)); visitSymbol(entity); @@ -48784,8 +49131,6 @@ var ts; IntersectionState[IntersectionState["None"] = 0] = "None"; IntersectionState[IntersectionState["Source"] = 1] = "Source"; IntersectionState[IntersectionState["Target"] = 2] = "Target"; - IntersectionState[IntersectionState["PropertyCheck"] = 4] = "PropertyCheck"; - IntersectionState[IntersectionState["InPropertyCheck"] = 8] = "InPropertyCheck"; })(IntersectionState || (IntersectionState = {})); var RecursionFlags; (function (RecursionFlags) { @@ -49009,6 +49354,7 @@ var ts; getTypeOfPropertyOfType: function (type, name) { return getTypeOfPropertyOfType(type, ts.escapeLeadingUnderscores(name)); }, getIndexInfoOfType: function (type, kind) { return getIndexInfoOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexInfosOfType: getIndexInfosOfType, + getIndexInfosOfIndexSymbol: getIndexInfosOfIndexSymbol, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: function (type, kind) { return getIndexTypeOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexType: function (type) { return getIndexType(type); }, @@ -49034,6 +49380,7 @@ var ts; signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, symbolToEntityName: nodeBuilder.symbolToEntityName, symbolToExpression: nodeBuilder.symbolToExpression, + symbolToNode: nodeBuilder.symbolToNode, symbolToTypeParameterDeclarations: nodeBuilder.symbolToTypeParameterDeclarations, symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration, typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration, @@ -49202,6 +49549,12 @@ var ts; getOptionalType: function () { return optionalType; }, getPromiseType: function () { return getGlobalPromiseType(/*reportErrors*/ false); }, getPromiseLikeType: function () { return getGlobalPromiseLikeType(/*reportErrors*/ false); }, + getAsyncIterableType: function () { + var type = getGlobalAsyncIterableType(/*reportErrors*/ false); + if (type === emptyGenericType) + return undefined; + return type; + }, isSymbolAccessible: isSymbolAccessible, isArrayType: isArrayType, isTupleType: isTupleType, @@ -49282,6 +49635,7 @@ var ts; isPropertyAccessible: isPropertyAccessible, getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration, getMemberOverrideModifierStatus: getMemberOverrideModifierStatus, + isTypeParameterPossiblyReferenced: isTypeParameterPossiblyReferenced, }; function runWithInferenceBlockedFromSourceNode(node, fn) { var containingCall = ts.findAncestor(node, ts.isCallLikeExpression); @@ -49401,7 +49755,8 @@ var ts; var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); emptyTypeLiteralSymbol.members = ts.createSymbolTable(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); - var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType; + var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); + var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType; var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); emptyGenericType.instantiations = new ts.Map(); var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); @@ -49515,6 +49870,8 @@ var ts; var deferredGlobalOmitSymbol; var deferredGlobalAwaitedSymbol; var deferredGlobalBigIntType; + var deferredGlobalNaNSymbol; + var deferredGlobalRecordSymbol; var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name var flowLoopStart = 0; var flowLoopCount = 0; @@ -49704,10 +50061,10 @@ var ts; } // Issue errors globally var file = ts.getSourceFileOfNode(location); - addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line local/no-in-operator return; } - addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line local/no-in-operator } function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) { var diagnostic = error(location, message, arg0, arg1, arg2, arg3); @@ -49936,7 +50293,7 @@ var ts; if (unidirectional === void 0) { unidirectional = false; } source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); - target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol); + target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol)); }); } function mergeModuleAugmentation(moduleName) { @@ -50024,7 +50381,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks()); } function isGlobalSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -50035,9 +50392,9 @@ var ts; return symbol; } if (symbol.flags & 2097152 /* SymbolFlags.Alias */) { - var target = resolveAlias(symbol); - // Unknown symbol means an error occurred in alias resolution, treat it as positive answer to avoid cascading errors - if (target === unknownSymbol || target.flags & meaning) { + var targetFlags = getAllSymbolFlags(symbol); + // `targetFlags` will be `SymbolFlags.All` if an error occurred in alias resolution; this avoids cascading errors + if (targetFlags & meaning) { return symbol; } } @@ -50083,17 +50440,17 @@ var ts; } if (declaration.pos <= usage.pos && !(ts.isPropertyDeclaration(declaration) && ts.isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) { // declaration is before usage - if (declaration.kind === 203 /* SyntaxKind.BindingElement */) { + if (declaration.kind === 205 /* SyntaxKind.BindingElement */) { // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) - var errorBindingElement = ts.getAncestor(usage, 203 /* SyntaxKind.BindingElement */); + var errorBindingElement = ts.getAncestor(usage, 205 /* SyntaxKind.BindingElement */); if (errorBindingElement) { return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || declaration.pos < errorBindingElement.pos; } // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 254 /* SyntaxKind.VariableDeclaration */), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 257 /* SyntaxKind.VariableDeclaration */), usage); } - else if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { + else if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } @@ -50123,12 +50480,12 @@ var ts; // or if usage is in a type context: // 1. inside a type query (typeof in type position) // 2. inside a jsdoc comment - if (usage.parent.kind === 275 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { + if (usage.parent.kind === 278 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { // export specifiers do not use the variable, they only make it available for use return true; } // When resolving symbols for exports, the `usage` location passed in can be the export site directly - if (usage.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { + if (usage.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { return true; } if (!!(usage.flags & 8388608 /* NodeFlags.JSDoc */) || isInTypeQuery(usage) || usageInTypeDeclaration()) { @@ -50150,9 +50507,9 @@ var ts; } function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { switch (declaration.parent.parent.kind) { - case 237 /* SyntaxKind.VariableStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 240 /* SyntaxKind.VariableStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, declContainer)) { @@ -50180,7 +50537,7 @@ var ts; var initializerOfProperty = propertyDeclaration.initializer === current; if (initializerOfProperty) { if (ts.isStatic(current.parent)) { - if (declaration.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (declaration.kind === 171 /* SyntaxKind.MethodDeclaration */) { return true; } if (ts.isPropertyDeclaration(declaration) && ts.getContainingClass(usage) === ts.getContainingClass(declaration)) { @@ -50195,7 +50552,7 @@ var ts; } } else { - var isDeclarationInstanceProperty = declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); + var isDeclarationInstanceProperty = declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { return true; } @@ -50218,19 +50575,19 @@ var ts; return "quit"; } switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // even when stopping at any property declaration, they need to come from the same class return stopAtAnyPropertyDeclaration && (ts.isPropertyDeclaration(declaration) && node.parent === declaration.parent || ts.isParameterPropertyDeclaration(declaration, declaration.parent) && node.parent === declaration.parent.parent) ? "quit" : true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; @@ -50270,18 +50627,18 @@ var ts; } function requiresScopeChangeWorker(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: // do not descend into these return false; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: return requiresScopeChangeWorker(node.name); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // static properties in classes introduce temporary variables if (ts.hasStaticModifier(node)) { return target < 99 /* ScriptTarget.ESNext */ || !useDefineForClassFields; @@ -50310,12 +50667,13 @@ var ts; * the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with * the given name can be found. * + * @param nameNotFoundMessage If defined, we will report errors found during resolve. * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters. */ - function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) { + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) { if (excludeGlobals === void 0) { excludeGlobals = false; } - if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; } - return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol); + if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; } + return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol); } function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) { var _a, _b, _c; @@ -50346,14 +50704,14 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 320 /* SyntaxKind.JSDoc */) { + if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 323 /* SyntaxKind.JSDoc */) { useResult = result.flags & 262144 /* SymbolFlags.TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || - lastLocation.kind === 340 /* SyntaxKind.JSDocParameterTag */ || - lastLocation.kind === 341 /* SyntaxKind.JSDocReturnTag */ || - lastLocation.kind === 163 /* SyntaxKind.TypeParameter */ + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || + lastLocation.kind === 343 /* SyntaxKind.JSDocParameterTag */ || + lastLocation.kind === 344 /* SyntaxKind.JSDocReturnTag */ || + lastLocation.kind === 165 /* SyntaxKind.TypeParameter */ // local types not visible outside the function body : false; } @@ -50368,13 +50726,13 @@ var ts; // however it is detected separately when checking initializers of parameters // to make sure that they reference no variables declared after them. useResult = - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || (lastLocation === location.type && !!ts.findAncestor(result.valueDeclaration, ts.isParameter)); } } } - else if (location.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (location.kind === 191 /* SyntaxKind.ConditionalType */) { // A type parameter declared using 'infer T' in a conditional type is visible only in // the true branch of the conditional type. useResult = lastLocation === location.trueType; @@ -50389,14 +50747,14 @@ var ts; } withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation); switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols; - if (location.kind === 305 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { + if (location.kind === 308 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports.get("default" /* InternalSymbolName.Default */)) { @@ -50420,7 +50778,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 /* SymbolFlags.Alias */ && - (ts.getDeclarationOfKind(moduleExport, 275 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 274 /* SyntaxKind.NamespaceExport */))) { + (ts.getDeclarationOfKind(moduleExport, 278 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 277 /* SyntaxKind.NamespaceExport */))) { break; } } @@ -50434,12 +50792,12 @@ var ts; } } break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (result = lookup(((_c = getSymbolOfNode(location)) === null || _c === void 0 ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* SymbolFlags.EnumMember */)) { break loop; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or @@ -50457,9 +50815,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals // These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would // trigger resolving late-bound names, which we may already be in the process of doing while we're here! @@ -50473,12 +50831,14 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type // parameter list is associated, with the exception of static member declarations in classes. - error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + } return undefined; } break loop; } - if (location.kind === 226 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { + if (location.kind === 228 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -50486,7 +50846,7 @@ var ts; } } break; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // The type parameters of a class are not in scope in the base class expression. if (lastLocation === location.expression && location.parent.token === 94 /* SyntaxKind.ExtendsKeyword */) { var container = location.parent.parent; @@ -50506,34 +50866,36 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) { - error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + } return undefined; } } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // when targeting ES6 or higher there is no 'arguments' in an arrow function // for lower compile targets the resolved symbol is used to emit an error if (ts.getEmitScriptTarget(compilerOptions) >= 2 /* ScriptTarget.ES2015 */) { break; } // falls through - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -50546,7 +50908,7 @@ var ts; } } break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -50555,7 +50917,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 164 /* SyntaxKind.Parameter */) { + if (location.parent && location.parent.kind === 166 /* SyntaxKind.Parameter */) { location = location.parent; } // @@ -50570,20 +50932,20 @@ var ts; // declare function y(x: T): any; // @param(1 as T) // <-- T should resolve to the type alias outside of class C // class C {} - if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 257 /* SyntaxKind.ClassDeclaration */)) { + if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 260 /* SyntaxKind.ClassDeclaration */)) { location = location.parent; } break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // js type aliases do not resolve names from their host, so skip past it var root = ts.getJSDocRoot(location); if (root) { location = root.parent; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (!associatedDeclarationForContainingInitializerOrBindingName) { @@ -50591,7 +50953,7 @@ var ts; } } break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (ts.isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) { @@ -50599,7 +50961,7 @@ var ts; } } break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: if (meaning & 262144 /* SymbolFlags.TypeParameter */) { var parameterName = location.typeParameter.name; if (parameterName && name === parameterName.escapedText) { @@ -50625,7 +50987,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(lastLocation.kind === 308 /* SyntaxKind.SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) { return lastLocation.symbol; } @@ -50665,8 +51027,8 @@ var ts; !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && + !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && - !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) { var suggestion = void 0; var suggestedLib = void 0; @@ -50707,7 +51069,7 @@ var ts; } return undefined; } - else if (checkAndReportErrorForInvalidInitializer()) { + else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) { return undefined; } // Perform extra checks only if error reporting was requested @@ -50753,9 +51115,9 @@ var ts; } } if (result && errorLocation && meaning & 111551 /* SymbolFlags.Value */ && result.flags & 2097152 /* SymbolFlags.Alias */ && !(result.flags & 111551 /* SymbolFlags.Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) { - var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result); + var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* SymbolFlags.Value */); if (typeOnlyDeclaration) { - var message = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ + var message = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; var unescapedName = ts.unescapeLeadingUnderscores(name); @@ -50769,31 +51131,31 @@ var ts; function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) { if (!typeOnlyDeclaration) return diagnostic; - return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); + return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); } function getIsDeferredContext(location, lastLocation) { - if (location.kind !== 214 /* SyntaxKind.ArrowFunction */ && location.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (location.kind !== 216 /* SyntaxKind.ArrowFunction */ && location.kind !== 215 /* SyntaxKind.FunctionExpression */) { // initializers in instance property declaration of class like entities are executed in constructor and thus deferred return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) || - (location.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred + (location.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred } if (lastLocation && lastLocation === location.name) { return false; } // generator functions and async functions are not inlined in control flow when immediately invoked - if (location.asteriskToken || ts.hasSyntacticModifier(location, 256 /* ModifierFlags.Async */)) { + if (location.asteriskToken || ts.hasSyntacticModifier(location, 512 /* ModifierFlags.Async */)) { return true; } return !ts.getImmediatelyInvokedFunctionExpression(location); } function isSelfReferenceLocation(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -50806,7 +51168,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - if (decl.kind === 163 /* SyntaxKind.TypeParameter */) { + if (decl.kind === 165 /* SyntaxKind.TypeParameter */) { var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent; if (parent === container) { return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); @@ -50863,9 +51225,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -50909,14 +51271,14 @@ var ts; return name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never" || name === "unknown"; } function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) { - if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { error(errorLocation, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name); return true; } return false; } function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) { - if (meaning & (111551 /* SymbolFlags.Value */ & ~1024 /* SymbolFlags.NamespaceModule */)) { + if (meaning & 111551 /* SymbolFlags.Value */) { if (isPrimitiveTypeName(name)) { if (isExtendedByInterface(errorLocation)) { error(errorLocation, ts.Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, ts.unescapeLeadingUnderscores(name)); @@ -50927,7 +51289,8 @@ var ts; return true; } var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); - if (symbol && !(symbol.flags & 1024 /* SymbolFlags.NamespaceModule */)) { + var allFlags = symbol && getAllSymbolFlags(symbol); + if (symbol && allFlags !== undefined && !(allFlags & 111551 /* SymbolFlags.Value */)) { var rawName = ts.unescapeLeadingUnderscores(name); if (isES2015OrLaterConstructorName(name)) { error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later, rawName); @@ -50975,16 +51338,16 @@ var ts; } return false; } - function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) { - if (meaning & (111551 /* SymbolFlags.Value */ & ~1024 /* SymbolFlags.NamespaceModule */ & ~788968 /* SymbolFlags.Type */)) { - var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); + function checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) { + if (meaning & (111551 /* SymbolFlags.Value */ & ~788968 /* SymbolFlags.Type */)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); if (symbol) { error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name)); return true; } } - else if (meaning & (788968 /* SymbolFlags.Type */ & ~1024 /* SymbolFlags.NamespaceModule */ & ~111551 /* SymbolFlags.Value */)) { - var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* SymbolFlags.ValueModule */ | 1024 /* SymbolFlags.NamespaceModule */) & ~788968 /* SymbolFlags.Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); + else if (meaning & (788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1536 /* SymbolFlags.Module */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); if (symbol) { error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name)); return true; @@ -51000,7 +51363,7 @@ var ts; return; } // Block-scoped variables cannot be used before their definition - var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 260 /* SyntaxKind.EnumDeclaration */); }); + var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 263 /* SyntaxKind.EnumDeclaration */); }); if (declaration === undefined) return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration"); if (!(declaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { @@ -51037,13 +51400,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return node.parent; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; default: return undefined; @@ -51068,24 +51431,24 @@ var ts; * const { x } = require ... */ function isAliasSymbolDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name - || node.kind === 268 /* SyntaxKind.NamespaceImport */ - || node.kind === 274 /* SyntaxKind.NamespaceExport */ - || node.kind === 270 /* SyntaxKind.ImportSpecifier */ - || node.kind === 275 /* SyntaxKind.ExportSpecifier */ - || node.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name + || node.kind === 271 /* SyntaxKind.NamespaceImport */ + || node.kind === 277 /* SyntaxKind.NamespaceExport */ + || node.kind === 273 /* SyntaxKind.ImportSpecifier */ + || node.kind === 278 /* SyntaxKind.ExportSpecifier */ + || node.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) || ts.isBinaryExpression(node) && ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && ts.exportAssignmentIsAlias(node) || ts.isAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && isAliasableOrJsExpression(node.parent.right) - || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || node.kind === 296 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) - || node.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) - || node.kind === 203 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); + || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || node.kind === 299 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) + || node.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) + || node.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } function isAliasableOrJsExpression(e) { return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e); @@ -51098,7 +51461,7 @@ var ts; ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : undefined; } - if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { var immediate = resolveExternalModuleName(node, ts.getExternalModuleRequireArgument(node) || ts.getExternalModuleImportEqualsDeclarationExpression(node)); var resolved_4 = resolveExternalModuleSymbol(immediate); markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved_4, /*overwriteEmpty*/ false); @@ -51111,7 +51474,7 @@ var ts; function checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved) { if (markSymbolOfAliasDeclarationIfTypeOnly(node, /*immediateTarget*/ undefined, resolved, /*overwriteEmpty*/ false) && !node.isTypeOnly) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfNode(node)); - var isExport = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */; + var isExport = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */; var message = isExport ? ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type; @@ -51130,7 +51493,7 @@ var ts; return resolved; } function isSyntacticDefault(node) { - return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); + return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); } function getUsageModeForExpression(usage) { return ts.isStringLiteralLike(usage) ? ts.getModeForUsageLocation(ts.getSourceFileOfNode(usage), usage) : undefined; @@ -51230,11 +51593,11 @@ var ts; } function getModuleSpecifierForImportOrExport(node) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; - case 268 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; - case 270 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; - case 275 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; + case 270 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; + case 278 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; default: return ts.Debug.assertNever(node); } } @@ -51503,31 +51866,31 @@ var ts; function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; } switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return getTargetOfNamespaceExport(node, dontRecursivelyResolve); - case 270 /* SyntaxKind.ImportSpecifier */: - case 203 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return getTargetOfExportSpecifier(node, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, dontRecursivelyResolve); - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return resolveEntityName(node.name, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ true, dontRecursivelyResolve); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return getTargetOfAccessExpression(node, dontRecursivelyResolve); default: return ts.Debug.fail(); @@ -51574,6 +51937,52 @@ var ts; } return undefined; } + /** + * Gets combined flags of a `symbol` and all alias targets it resolves to. `resolveAlias` + * is typically recursive over chains of aliases, but stops mid-chain if an alias is merged + * with another exported symbol, e.g. + * ```ts + * // a.ts + * export const a = 0; + * // b.ts + * export { a } from "./a"; + * export type a = number; + * // c.ts + * import { a } from "./b"; + * ``` + * Calling `resolveAlias` on the `a` in c.ts would stop at the merged symbol exported + * from b.ts, even though there is still more alias to resolve. Consequently, if we were + * trying to determine if the `a` in c.ts has a value meaning, looking at the flags on + * the local symbol and on the symbol returned by `resolveAlias` is not enough. + * @returns SymbolFlags.All if `symbol` is an alias that ultimately resolves to `unknown`; + * combined flags of all alias targets otherwise. + */ + function getAllSymbolFlags(symbol) { + var flags = symbol.flags; + var seenSymbols; + while (symbol.flags & 2097152 /* SymbolFlags.Alias */) { + var target = resolveAlias(symbol); + if (target === unknownSymbol) { + return 67108863 /* SymbolFlags.All */; + } + // Optimizations - try to avoid creating or adding to + // `seenSymbols` if possible + if (target === symbol || (seenSymbols === null || seenSymbols === void 0 ? void 0 : seenSymbols.has(target))) { + break; + } + if (target.flags & 2097152 /* SymbolFlags.Alias */) { + if (seenSymbols) { + seenSymbols.add(target); + } + else { + seenSymbols = new ts.Set([symbol, target]); + } + } + flags |= target.flags; + symbol = target; + } + return flags; + } /** * Marks a symbol as type-only if its declaration is syntactically type-only. * If it is not itself marked type-only, but resolves to a type-only alias @@ -51619,19 +52028,25 @@ var ts; return !!aliasDeclarationLinks.typeOnlyDeclaration; } /** Indicates that a symbol directly or indirectly resolves to a type-only import or export. */ - function getTypeOnlyAliasDeclaration(symbol) { + function getTypeOnlyAliasDeclaration(symbol, include) { if (!(symbol.flags & 2097152 /* SymbolFlags.Alias */)) { return undefined; } var links = getSymbolLinks(symbol); - return links.typeOnlyDeclaration || undefined; + if (include === undefined) { + return links.typeOnlyDeclaration || undefined; + } + if (links.typeOnlyDeclaration) { + return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : undefined; + } + return undefined; } function markExportAsReferenced(node) { var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target) { var markAlias = target === unknownSymbol || - ((target.flags & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol)); + ((getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)); if (markAlias) { markAliasSymbolAsReferenced(symbol); } @@ -51651,8 +52066,7 @@ var ts; // This way a chain of imports can be elided if ultimately the final input is only used in a type // position. if (ts.isInternalModuleImportEqualsDeclaration(node)) { - var target = resolveSymbol(symbol); - if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(resolveSymbol(symbol)) & 111551 /* SymbolFlags.Value */) { // import foo = checkExpressionCached(node.moduleReference); } @@ -51679,18 +52093,18 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 163 /* SyntaxKind.QualifiedName */) { return resolveEntityName(entityName, 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */); return resolveEntityName(entityName, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } function getFullyQualifiedName(symbol, containingLocation) { - return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); } function getContainingQualifiedNameNode(node) { while (ts.isQualifiedName(node.parent)) { @@ -51731,9 +52145,9 @@ var ts; return getMergedSymbol(symbolFromJSPrototype); } } - else if (name.kind === 161 /* SyntaxKind.QualifiedName */ || name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - var left = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; - var right = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : name.name; + else if (name.kind === 163 /* SyntaxKind.QualifiedName */ || name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + var left = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; + var right = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -51791,7 +52205,7 @@ var ts; throw ts.Debug.assertNever(name, "Unknown entity name kind."); } ts.Debug.assert((ts.getCheckFlags(symbol) & 1 /* CheckFlags.Instantiated */) === 0, "Should never get an instantiated symbol here."); - if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 271 /* SyntaxKind.ExportAssignment */)) { + if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 274 /* SyntaxKind.ExportAssignment */)) { markSymbolOfAliasDeclarationIfTypeOnly(ts.getAliasDeclarationFromName(name), symbol, /*finalTarget*/ undefined, /*overwriteEmpty*/ true); } return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); @@ -52114,7 +52528,7 @@ var ts; var _a; var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { - if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */)) { + if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */)) { var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop"; @@ -52474,13 +52888,13 @@ var ts; } function symbolIsValue(symbol, includeTypeOnlyMembers) { return !!(symbol.flags & 111551 /* SymbolFlags.Value */ || - symbol.flags & 2097152 /* SymbolFlags.Alias */ && resolveAlias(symbol).flags & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol))); + symbol.flags & 2097152 /* SymbolFlags.Alias */ && getAllSymbolFlags(symbol) & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol))); } function findConstructorDeclaration(node) { var members = node.members; for (var _i = 0, members_3 = members; _i < members_3.length; _i++) { var member = members_3[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -52588,12 +53002,12 @@ var ts; } } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var sym = getSymbolOfNode(location); // `sym` may not have exports if this module declaration is backed by the symbol for a `const` that's being rewritten // into a namespace - in such cases, it's best to just let the namespace appear empty (the const members couldn't have referred @@ -52602,9 +53016,9 @@ var ts; return { value: result }; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // Type parameters are bound into `members` lists so they can merge across declarations // This is troublesome, since in all other respects, they behave like locals :cries: // TODO: the below is shared with similar code in `resolveName` - in fact, rephrasing all this symbol @@ -52699,7 +53113,7 @@ var ts; && (isLocalNameLookup ? !ts.some(symbolFromSymbolTable.declarations, ts.isNamespaceReexportDeclaration) : true) // While exports are generally considered to be in scope, export-specifier declared symbols are _not_ // See similar comment in `resolveName` for details - && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */))) { + && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */))) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); var candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification); if (candidate) { @@ -52743,8 +53157,10 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; - if (symbolFromSymbolTable.flags & meaning) { + var shouldResolveAlias = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */)); + symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + var flags = shouldResolveAlias ? getAllSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags; + if (flags & meaning) { qualify = true; return true; } @@ -52758,10 +53174,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: continue; default: return false; @@ -52891,10 +53307,10 @@ var ts; return node && getSymbolOfNode(node); } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { - return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -52962,14 +53378,14 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 181 /* SyntaxKind.TypeQuery */ || - entityName.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || - entityName.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (entityName.parent.kind === 183 /* SyntaxKind.TypeQuery */ || + entityName.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || + entityName.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Typeof value meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } - else if (entityName.kind === 161 /* SyntaxKind.QualifiedName */ || entityName.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (entityName.kind === 163 /* SyntaxKind.QualifiedName */ || entityName.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* SymbolFlags.Namespace */; @@ -53005,15 +53421,18 @@ var ts; if (flags & 8 /* SymbolFormatFlags.UseAliasDefinedOutsideCurrentScope */) { nodeFlags |= 16384 /* NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope */; } - if (flags & 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { + if (flags & 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { nodeFlags |= 134217728 /* NodeBuilderFlags.DoNotIncludeSymbolChain */; } - var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToExpression : nodeBuilder.symbolToEntityName; + if (flags & 16 /* SymbolFormatFlags.WriteComputedProps */) { + nodeFlags |= 1073741824 /* NodeBuilderFlags.WriteComputedProps */; + } + var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName; return writer ? symbolToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(symbolToStringWorker); function symbolToStringWorker(writer) { var entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags); // TODO: GH#18217 // add neverAsciiEscape for GH#39027 - var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 305 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); + var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 308 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); printer.writeNode(4 /* EmitHint.Unspecified */, entity, /*sourceFile*/ sourceFile, writer); return writer; @@ -53025,10 +53444,10 @@ var ts; function signatureToStringWorker(writer) { var sigOutput; if (flags & 262144 /* TypeFormatFlags.WriteArrowStyleSignature */) { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 180 /* SyntaxKind.ConstructorType */ : 179 /* SyntaxKind.FunctionType */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 182 /* SyntaxKind.ConstructorType */ : 181 /* SyntaxKind.FunctionType */; } else { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 175 /* SyntaxKind.ConstructSignature */ : 174 /* SyntaxKind.CallSignature */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 177 /* SyntaxKind.ConstructSignature */ : 176 /* SyntaxKind.CallSignature */; } var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */); var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true }); @@ -53108,7 +53527,25 @@ var ts; symbolTableToDeclarationStatements: function (symbolTable, enclosingDeclaration, flags, tracker, bundled) { return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolTableToDeclarationStatements(symbolTable, context, bundled); }); }, + symbolToNode: function (symbol, meaning, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolToNode(symbol, context, meaning); }); + }, }; + function symbolToNode(symbol, context, meaning) { + if (context.flags & 1073741824 /* NodeBuilderFlags.WriteComputedProps */) { + if (symbol.valueDeclaration) { + var name = ts.getNameOfDeclaration(symbol.valueDeclaration); + if (name && ts.isComputedPropertyName(name)) + return name; + } + var nameType = getSymbolLinks(symbol).nameType; + if (nameType && nameType.flags & (1024 /* TypeFlags.EnumLiteral */ | 8192 /* TypeFlags.UniqueESSymbol */)) { + context.enclosingDeclaration = nameType.symbol.valueDeclaration; + return ts.factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning)); + } + } + return symbolToExpression(symbol, context, meaning); + } function withContext(enclosingDeclaration, flags, tracker, cb) { var _a, _b; ts.Debug.assert(enclosingDeclaration === undefined || (enclosingDeclaration.flags & 8 /* NodeFlags.Synthesized */) === 0); @@ -53193,7 +53630,7 @@ var ts; return undefined; // TODO: GH#18217 } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (!(context.flags & 536870912 /* NodeBuilderFlags.NoTypeReduction */)) { type = getReducedType(type); @@ -53203,29 +53640,29 @@ var ts; return ts.factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context)); } if (type === unresolvedType) { - return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); + return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 138 /* SyntaxKind.IntrinsicKeyword */ : 130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 139 /* SyntaxKind.IntrinsicKeyword */ : 131 /* SyntaxKind.AnyKeyword */); } if (type.flags & 2 /* TypeFlags.Unknown */) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (type.flags & 4 /* TypeFlags.String */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + return ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); } if (type.flags & 8 /* TypeFlags.Number */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(147 /* SyntaxKind.NumberKeyword */); + return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.NumberKeyword */); } if (type.flags & 64 /* TypeFlags.BigInt */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(158 /* SyntaxKind.BigIntKeyword */); + return ts.factory.createKeywordTypeNode(160 /* SyntaxKind.BigIntKeyword */); } if (type.flags & 16 /* TypeFlags.Boolean */ && !type.aliasSymbol) { context.approximateLength += 7; - return ts.factory.createKeywordTypeNode(133 /* SyntaxKind.BooleanKeyword */); + return ts.factory.createKeywordTypeNode(134 /* SyntaxKind.BooleanKeyword */); } if (type.flags & 1024 /* TypeFlags.EnumLiteral */ && !(type.flags & 1048576 /* TypeFlags.Union */)) { var parentSymbol = getParentOfSymbol(type.symbol); @@ -53279,7 +53716,7 @@ var ts; } } context.approximateLength += 13; - return ts.factory.createTypeOperatorNode(154 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */)); + return ts.factory.createTypeOperatorNode(156 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */)); } if (type.flags & 16384 /* TypeFlags.Void */) { context.approximateLength += 4; @@ -53287,7 +53724,7 @@ var ts; } if (type.flags & 32768 /* TypeFlags.Undefined */) { context.approximateLength += 9; - return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); } if (type.flags & 65536 /* TypeFlags.Null */) { context.approximateLength += 4; @@ -53295,15 +53732,15 @@ var ts; } if (type.flags & 131072 /* TypeFlags.Never */) { context.approximateLength += 5; - return ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */); + return ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */); } if (type.flags & 4096 /* TypeFlags.ESSymbol */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */); + return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */); } if (type.flags & 67108864 /* TypeFlags.NonPrimitive */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.ObjectKeyword */); + return ts.factory.createKeywordTypeNode(149 /* SyntaxKind.ObjectKeyword */); } if (ts.isThisTypeParameter(type)) { if (context.flags & 4194304 /* NodeBuilderFlags.InObjectTypeLiteral */) { @@ -53392,7 +53829,7 @@ var ts; var indexedType = type.type; context.approximateLength += 6; var indexTypeNode = typeToTypeNodeHelper(indexedType, context); - return ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); + return ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); } if (type.flags & 134217728 /* TypeFlags.TemplateLiteral */) { var texts_1 = type.texts; @@ -53444,7 +53881,7 @@ var ts; // On the other hand, // checkType extends infer T extends checkType ? T extends extendsType ? trueType : falseType : never; // may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS. - return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } var saveInferTypeParameters = context.inferTypeParameters; context.inferTypeParameters = type.root.inferTypeParameters; @@ -53486,7 +53923,7 @@ var ts; var name = typeParameterToName(newParam, context); newTypeVariable = ts.factory.createTypeReferenceNode(name); } - appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); + appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); } else { appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context); @@ -53502,7 +53939,7 @@ var ts; // wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting // type stays homomorphic var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper); - return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } return result; } @@ -53550,7 +53987,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* SymbolFlags.Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 305 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 262 /* SyntaxKind.ModuleBlock */; + return declaration.parent.kind === 308 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 265 /* SyntaxKind.ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -53639,12 +54076,12 @@ var ts; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { var signature = resolved.callSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 179 /* SyntaxKind.FunctionType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 181 /* SyntaxKind.FunctionType */, context); return signatureNode; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { var signature = resolved.constructSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 180 /* SyntaxKind.ConstructorType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 182 /* SyntaxKind.ConstructorType */, context); return signatureNode; } } @@ -53687,7 +54124,7 @@ var ts; } var elementType = typeToTypeNodeHelper(typeArguments[0], context); var arrayType = ts.factory.createArrayTypeNode(elementType); - return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, arrayType); + return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, arrayType); } else if (type.target.objectFlags & 8 /* ObjectFlags.Tuple */) { typeArguments = ts.sameMap(typeArguments, function (t, i) { return removeMissingType(t, !!(type.target.elementFlags[i] & 2 /* ElementFlags.Optional */)); }); @@ -53712,12 +54149,12 @@ var ts; } } var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode(tupleConstituentNodes), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } } if (context.encounteredError || (context.flags & 524288 /* NodeBuilderFlags.AllowEmptyTuple */)) { var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode([]), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } context.encounteredError = true; return undefined; // TODO: GH#18217 @@ -53824,13 +54261,13 @@ var ts; var typeElements = []; for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 174 /* SyntaxKind.CallSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 176 /* SyntaxKind.CallSignature */, context)); } for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; if (signature.flags & 4 /* SignatureFlags.Abstract */) continue; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 175 /* SyntaxKind.ConstructSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 177 /* SyntaxKind.ConstructSignature */, context)); } for (var _d = 0, _e = resolvedType.indexInfos; _d < _e.length; _d++) { var info = _e[_d]; @@ -53867,7 +54304,7 @@ var ts; if (!(context.flags & 1 /* NodeBuilderFlags.NoTruncation */)) { return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier("..."), /*typeArguments*/ undefined); } - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function shouldUsePlaceholderForProperty(propertySymbol, context) { var _a; @@ -53917,7 +54354,7 @@ var ts; var signatures = getSignaturesOfType(filterType(propertyType, function (t) { return !(t.flags & 32768 /* TypeFlags.Undefined */); }), 0 /* SignatureKind.Call */); for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) { var signature = signatures_1[_i]; - var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 168 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 170 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration)); } } @@ -53931,12 +54368,12 @@ var ts; context.reverseMappedStack || (context.reverseMappedStack = []); context.reverseMappedStack.push(propertySymbol); } - propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); if (propertyIsReverseMapped) { context.reverseMappedStack.pop(); } } - var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined; + var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined; if (modifiers) { context.approximateLength += 9; } @@ -53945,8 +54382,8 @@ var ts; } function preserveCommentsOn(node) { var _a; - if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; })) { - var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; }); + if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; })) { + var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; }); var commentText = ts.getTextOfJSDocComment(d.comment); if (commentText) { ts.setSyntheticLeadingComments(node, [{ kind: 3 /* SyntaxKind.MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); @@ -54045,7 +54482,7 @@ var ts; context.encounteredError = true; } context.approximateLength += (name.length + 4); - return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); + return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); } function signatureToSignatureDeclarationHelper(signature, kind, context, options) { var _a, _b, _c, _d; @@ -54063,7 +54500,7 @@ var ts; } var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0]; // If the expanded parameter list had a variadic in a non-trailing position, don't expand it - var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); + var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 173 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); var thisParameter = context.flags & 33554432 /* NodeBuilderFlags.OmitThisParameter */ ? undefined : tryGetThisParameterDeclaration(signature, context); if (thisParameter) { parameters.unshift(thisParameter); @@ -54072,7 +54509,7 @@ var ts; var typePredicate = getTypePredicateOfSignature(signature); if (typePredicate) { var assertsModifier = typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? - ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : + ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined; var parameterName = typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.setEmitFlags(ts.factory.createIdentifier(typePredicate.parameterName), 16777216 /* EmitFlags.NoAsciiEscaping */) : @@ -54086,28 +54523,28 @@ var ts; returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); } else if (!suppressAny) { - returnTypeNode = ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + returnTypeNode = ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } var modifiers = options === null || options === void 0 ? void 0 : options.modifiers; - if ((kind === 180 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { + if ((kind === 182 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { var flags = ts.modifiersToFlags(modifiers); - modifiers = ts.factory.createModifiersFromModifierFlags(flags | 128 /* ModifierFlags.Abstract */); - } - var node = kind === 174 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : - kind === 175 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : - kind === 168 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : - kind === 169 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 171 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : - kind === 172 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : - kind === 173 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : - kind === 176 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : - kind === 317 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : - kind === 179 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 180 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 256 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 213 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : - kind === 214 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : + modifiers = ts.factory.createModifiersFromModifierFlags(flags | 256 /* ModifierFlags.Abstract */); + } + var node = kind === 176 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : + kind === 177 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : + kind === 170 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : + kind === 171 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 173 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : + kind === 174 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : + kind === 175 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : + kind === 178 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : + kind === 320 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : + kind === 181 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 182 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 215 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : + kind === 216 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : ts.Debug.assertNever(kind); if (typeArguments) { node.typeArguments = ts.factory.createNodeArray(typeArguments); @@ -54144,9 +54581,9 @@ var ts; return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) { - var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 164 /* SyntaxKind.Parameter */); + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 166 /* SyntaxKind.Parameter */); if (!parameterDeclaration && !ts.isTransientSymbol(parameterSymbol)) { - parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 340 /* SyntaxKind.JSDocParameterTag */); + parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 343 /* SyntaxKind.JSDocParameterTag */); } var parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -54158,7 +54595,7 @@ var ts; var dotDotDotToken = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name), 16777216 /* EmitFlags.NoAsciiEscaping */) : - parameterDeclaration.name.kind === 161 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : + parameterDeclaration.name.kind === 163 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : ts.symbolName(parameterSymbol) : ts.symbolName(parameterSymbol); @@ -54322,11 +54759,11 @@ var ts; } function getSpecifierForModuleSymbol(symbol, context, overrideImportMode) { var _a; - var file = ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */); + var file = ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */); if (!file) { var equivalentFileSymbol = ts.firstDefined(symbol.declarations, function (d) { return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); }); if (equivalentFileSymbol) { - file = ts.getDeclarationOfKind(equivalentFileSymbol, 305 /* SyntaxKind.SourceFile */); + file = ts.getDeclarationOfKind(equivalentFileSymbol, 308 /* SyntaxKind.SourceFile */); } } if (file && file.moduleName !== undefined) { @@ -54794,17 +55231,17 @@ var ts; return transformed === existing ? ts.setTextRange(ts.factory.cloneNode(existing), existing) : transformed; function visitExistingNodeTreeSymbols(node) { // We don't _actually_ support jsdoc namepath types, emit `any` instead - if (ts.isJSDocAllType(node) || node.kind === 319 /* SyntaxKind.JSDocNamepathType */) { - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + if (ts.isJSDocAllType(node) || node.kind === 322 /* SyntaxKind.JSDocNamepathType */) { + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (ts.isJSDocUnknownType(node)) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (ts.isJSDocNullableType(node)) { return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createLiteralTypeNode(ts.factory.createNull())]); } if (ts.isJSDocOptionalType(node)) { - return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } if (ts.isJSDocNonNullableType(node)) { return ts.visitNode(node.type, visitExistingNodeTreeSymbols); @@ -54818,11 +55255,11 @@ var ts; var typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText); var overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : undefined; return ts.factory.createPropertySignature( - /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); })); } if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "") { - return ts.setOriginalNode(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), node); + return ts.setOriginalNode(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), node); } if ((ts.isExpressionWithTypeArguments(node) || ts.isTypeReferenceNode(node)) && ts.isJSDocIndexSignature(node)) { return ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature( @@ -54837,12 +55274,12 @@ var ts; return ts.factory.createConstructorTypeNode( /*modifiers*/ undefined, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } else { return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } } if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */, /*ignoreErrors*/ true))) { @@ -54910,8 +55347,8 @@ var ts; } } function symbolTableToDeclarationStatements(symbolTable, context, bundled) { - var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 169 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); - var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 168 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); + var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 171 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); + var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 170 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); // TODO: Use `setOriginalNode` on original declaration names where possible so these declarations see some kind of // declaration mapping // We save the enclosing declaration off here so it's not adjusted by well-meaning declaration @@ -55035,7 +55472,7 @@ var ts; // export {name} - look thru `statements` for `name`, and if all results can take an `export` modifier, do so and filter it var indices = ts.indicesOf(statements); var associatedIndices = ts.filter(indices, function (i) { return ts.nodeHasName(statements[i], e.name); }); - if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return canHaveExportModifier(statements[i]); })) { + if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return ts.canHaveExportModifier(statements[i]); })) { for (var _i = 0, associatedIndices_1 = associatedIndices; _i < associatedIndices_1.length; _i++) { var index_1 = associatedIndices_1[_i]; statements[index_1] = addExportModifier(statements[index_1]); @@ -55069,15 +55506,6 @@ var ts; } return statements; } - function canHaveExportModifier(node) { - return ts.isEnumDeclaration(node) || - ts.isVariableStatement(node) || - ts.isFunctionDeclaration(node) || - ts.isClassDeclaration(node) || - (ts.isModuleDeclaration(node) && !ts.isExternalModuleAugmentation(node) && !ts.isGlobalScopeAugmentation(node)) || - ts.isInterfaceDeclaration(node) || - isTypeDeclaration(node); - } function addExportModifier(node) { var flags = (ts.getEffectiveModifierFlags(node) | 1 /* ModifierFlags.Export */) & ~2 /* ModifierFlags.Ambient */; return ts.factory.updateModifiers(node, flags); @@ -55149,7 +55577,7 @@ var ts; if (needsPostExportDefault || needsExportDeclaration) { isPrivate = true; } - var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 512 /* ModifierFlags.Default */ : 0); + var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 1024 /* ModifierFlags.Default */ : 0); var isConstMergedWithNS = symbol.flags & 1536 /* SymbolFlags.Module */ && symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 1 /* SymbolFlags.FunctionScopedVariable */ | 4 /* SymbolFlags.Property */) && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */; @@ -55166,6 +55594,7 @@ var ts; && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */ && !(symbol.flags & 4194304 /* SymbolFlags.Prototype */) && !(symbol.flags & 32 /* SymbolFlags.Class */) + && !(symbol.flags & 8192 /* SymbolFlags.Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) { if (propertyAsAlias) { var createdExport = serializeMaybeAliasAssignment(symbol); @@ -55323,7 +55752,7 @@ var ts; (ts.isJSDocTypeAlias(context.enclosingDeclaration) ? ts.getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration); if (additionalModifierFlags & 1 /* ModifierFlags.Export */ && enclosingDeclaration_1 && (isExportingScope(enclosingDeclaration_1) || ts.isModuleDeclaration(enclosingDeclaration_1)) && - canHaveExportModifier(node)) { + ts.canHaveExportModifier(node)) { // Classes, namespaces, variables, functions, interfaces, and types should all be `export`ed in a module context if not private newModifierFlags |= 1 /* ModifierFlags.Export */; } @@ -55333,8 +55762,8 @@ var ts; // Classes, namespaces, variables, enums, and functions all need `declare` modifiers to be valid in a declaration file top-level scope newModifierFlags |= 2 /* ModifierFlags.Ambient */; } - if ((additionalModifierFlags & 512 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { - newModifierFlags |= 512 /* ModifierFlags.Default */; + if ((additionalModifierFlags & 1024 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { + newModifierFlags |= 1024 /* ModifierFlags.Default */; } if (newModifierFlags) { node = ts.factory.updateModifiers(node, newModifierFlags | ts.getEffectiveModifierFlags(node)); @@ -55368,8 +55797,8 @@ var ts; var baseTypes = getBaseTypes(interfaceType); var baseType = ts.length(baseTypes) ? getIntersectionType(baseTypes) : undefined; var members = ts.flatMap(getPropertiesOfType(interfaceType), function (p) { return serializePropertySymbolForInterface(p, baseType); }); - var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 174 /* SyntaxKind.CallSignature */); - var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 175 /* SyntaxKind.ConstructSignature */); + var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 176 /* SyntaxKind.CallSignature */); + var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 177 /* SyntaxKind.ConstructSignature */); var indexSignatures = serializeIndexSignatures(interfaceType, baseType); var heritageClauses = !ts.length(baseTypes) ? undefined : [ts.factory.createHeritageClause(94 /* SyntaxKind.ExtendsKeyword */, ts.mapDefined(baseTypes, function (b) { return trySerializeAsTypeReference(b, 111551 /* SymbolFlags.Value */); }))]; addResult(ts.factory.createInterfaceDeclaration( @@ -55379,7 +55808,7 @@ var ts; return !symbol.exports ? [] : ts.filter(ts.arrayFrom(symbol.exports.values()), isNamespaceMember); } function isTypeOnlyNamespace(symbol) { - return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m).flags & 111551 /* SymbolFlags.Value */); }); + return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* SymbolFlags.Value */); }); } function serializeModule(symbol, symbolName, modifierFlags) { var members = getNamespaceMembersForSerialization(symbol); @@ -55434,7 +55863,7 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var sig = signatures_2[_i]; // Each overload becomes a separate function declaration, in order - var decl = signatureToSignatureDeclarationHelper(sig, 256 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); + var decl = signatureToSignatureDeclarationHelper(sig, 259 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); addResult(ts.setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags); } // Module symbol emit will take care of module-y members, provided it has exports @@ -55592,7 +56021,7 @@ var ts; !ts.some(getSignaturesOfType(staticType, 1 /* SignatureKind.Construct */)); var constructors = isNonConstructableClassLikeInJsFile ? [ts.factory.createConstructorDeclaration(ts.factory.createModifiersFromModifierFlags(8 /* ModifierFlags.Private */), [], /*body*/ undefined)] : - serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 171 /* SyntaxKind.Constructor */); + serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 173 /* SyntaxKind.Constructor */); var indexSignatures = serializeIndexSignatures(classType, baseTypes[0]); context.enclosingDeclaration = oldEnclosing; addResult(ts.setTextRange(ts.factory.createClassDeclaration( @@ -55641,8 +56070,8 @@ var ts; var targetName = getInternalSymbolName(target, verbatimTargetName); includePrivateSymbol(target); // the target may be within the same scope - attempt to serialize it first switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 254 /* SyntaxKind.VariableDeclaration */) { + case 205 /* SyntaxKind.BindingElement */: + if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 257 /* SyntaxKind.VariableDeclaration */) { // const { SomeClass } = require('./lib'); var specifier_1 = getSpecifierForModuleSymbol(target.parent || target, context); // './lib' var propertyName = node.propertyName; @@ -55655,13 +56084,13 @@ var ts; // We don't know how to serialize this (nested?) binding element ts.Debug.failBadSyntaxKind(((_c = node.parent) === null || _c === void 0 ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization"); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 221 /* SyntaxKind.BinaryExpression */) { + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 223 /* SyntaxKind.BinaryExpression */) { // module.exports = { SomeClass } serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), targetName); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // commonjs require: const x = require('y') if (ts.isPropertyAccessExpression(node.initializer)) { // const x = require('y').z @@ -55679,7 +56108,7 @@ var ts; break; } // else fall through and treat commonjs require just like import= - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // This _specifically_ only exists to handle json declarations - where we make aliases, but since // we emit no declarations for the json document, must not refer to it in the declarations if (target.escapedName === "export=" /* InternalSymbolName.ExportEquals */ && ts.some(target.declarations, ts.isJsonSourceFile)) { @@ -55695,13 +56124,13 @@ var ts; ? symbolToName(target, context, 67108863 /* SymbolFlags.All */, /*expectsIdentifier*/ false) : ts.factory.createExternalModuleReference(ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))), isLocalImport ? modifierFlags : 0 /* ModifierFlags.None */); break; - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // export as namespace foo // TODO: Not part of a file's local or export symbol tables // Is bound into file.symbol.globalExports instead, which we don't currently traverse addResult(ts.factory.createNamespaceExportDeclaration(ts.idText(node.name)), 0 /* ModifierFlags.None */); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, ts.factory.createIdentifier(localName), /*namedBindings*/ undefined), // We use `target.parent || target` below as `target.parent` is unset when the target is a module which has been export assigned @@ -55710,17 +56139,17 @@ var ts; ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*importClause*/ undefined, ts.factory.createNamespaceImport(ts.factory.createIdentifier(localName))), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: addResult(ts.factory.createExportDeclaration( /*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamespaceExport(ts.factory.createIdentifier(localName)), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))), 0 /* ModifierFlags.None */); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause( /*isTypeOnly*/ false, @@ -55730,7 +56159,7 @@ var ts; ])), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: // does not use localName because the symbol name in this case refers to the name in the exports table, // which we must exactly preserve var specifier = node.parent.parent.moduleSpecifier; @@ -55738,12 +56167,12 @@ var ts; // another file serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: serializeMaybeAliasAssignment(symbol); break; - case 221 /* SyntaxKind.BinaryExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // Could be best encoded as though an export specifier or as though an export assignment // If name is default or export=, do an export assignment // Otherwise do an export specifier @@ -55887,7 +56316,7 @@ var ts; && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName)))) { return []; } - var flag = (modifierFlags & ~256 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); + var flag = (modifierFlags & ~512 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); var name = getPropertyNameNodeForSymbol(p, context); var firstPropertyLikeDecl = (_a = p.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.or(ts.isPropertyDeclaration, ts.isAccessor, ts.isVariableDeclaration, ts.isPropertySignature, ts.isBinaryExpression, ts.isPropertyAccessExpression)); if (p.flags & 98304 /* SymbolFlags.Accessor */ && useAccessors) { @@ -55909,7 +56338,7 @@ var ts; // This is an else/if as accessors and properties can't merge in TS, but might in JS // If this happens, we assume the accessor takes priority, as it imposes more constraints else if (p.flags & (4 /* SymbolFlags.Property */ | 3 /* SymbolFlags.Variable */ | 98304 /* SymbolFlags.Accessor */)) { - return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), + return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357 // interface members can't have initializers, however class members _can_ /*initializer*/ undefined), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts.or(ts.isPropertyDeclaration, ts.isVariableDeclaration))) || firstPropertyLikeDecl); @@ -56099,7 +56528,7 @@ var ts; if (flags === void 0) { flags = 16384 /* TypeFormatFlags.UseAliasDefinedOutsideCurrentScope */; } return writer ? typePredicateToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(typePredicateToStringWorker); function typePredicateToStringWorker(writer) { - var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 + var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 ); var printer = ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); @@ -56146,7 +56575,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ && type.symbol.declarations) { var node = ts.walkUpParenthesizedTypes(type.symbol.declarations[0].parent); - if (node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -56154,11 +56583,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 305 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); + return location.kind === 308 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); } function getNameOfSymbolFromNameType(symbol, context) { var nameType = getSymbolLinks(symbol).nameType; @@ -56217,17 +56646,17 @@ var ts; if (!declaration) { declaration = symbol.declarations[0]; // Declaration may be nameless, but we'll try anyway } - if (declaration.parent && declaration.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (declaration.parent && declaration.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { return ts.declarationNameToString(declaration.parent.name); } switch (declaration.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (context && !context.encounteredError && !(context.flags & 131072 /* NodeBuilderFlags.AllowAnonymousIdentifier */)) { context.encounteredError = true; } - return declaration.kind === 226 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; + return declaration.kind === 228 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; } } var name = getNameOfSymbolFromNameType(symbol, context); @@ -56244,28 +56673,28 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // Top-level jsdoc type aliases are considered exported // First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent)); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return isDeclarationVisible(node.parent.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; @@ -56273,55 +56702,55 @@ var ts; var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) && - !(node.kind !== 265 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 305 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { + !(node.kind !== 268 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 308 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 164 /* SyntaxKind.Parameter */: - case 262 /* SyntaxKind.ModuleBlock */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 178 /* SyntaxKind.TypeReference */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 166 /* SyntaxKind.Parameter */: + case 265 /* SyntaxKind.ModuleBlock */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 180 /* SyntaxKind.TypeReference */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: return false; // Type parameters are always visible - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: // Source file and namespace export are always visible // falls through - case 305 /* SyntaxKind.SourceFile */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return false; default: return false; @@ -56330,10 +56759,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.parent && node.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { exportSymbol = resolveName(node, node.escapedText, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false); } - else if (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + else if (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */); } var result; @@ -56440,12 +56869,12 @@ var ts; function getDeclarationContainer(node) { return ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 255 /* SyntaxKind.VariableDeclarationList */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 269 /* SyntaxKind.NamedImports */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 258 /* SyntaxKind.VariableDeclarationList */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 272 /* SyntaxKind.NamedImports */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: return false; default: return true; @@ -56575,23 +57004,23 @@ var ts; function getParentElementAccess(node) { var ancestor = node.parent.parent; switch (ancestor.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: return getSyntheticElementAccess(ancestor); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getSyntheticElementAccess(node.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ancestor.initializer; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ancestor.right; } } function getDestructuringPropertyName(node) { var parent = node.parent; - if (node.kind === 203 /* SyntaxKind.BindingElement */ && parent.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (node.kind === 205 /* SyntaxKind.BindingElement */ && parent.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { return getLiteralPropertyNameText(node.propertyName || node.name); } - if (node.kind === 296 /* SyntaxKind.PropertyAssignment */ || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.kind === 299 /* SyntaxKind.PropertyAssignment */ || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return getLiteralPropertyNameText(node.name); } return "" + parent.elements.indexOf(node); @@ -56621,7 +57050,7 @@ var ts; parentType = getTypeWithFacts(parentType, 524288 /* TypeFacts.NEUndefined */); } var type; - if (pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (declaration.dotDotDotToken) { parentType = getReducedType(parentType); if (parentType.flags & 2 /* TypeFlags.Unknown */ || !isValidSpreadType(parentType)) { @@ -56692,7 +57121,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, isProperty, isOptional) { if (isProperty === void 0) { isProperty = false; } @@ -56703,11 +57132,11 @@ var ts; function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, /*checkMode*/ checkMode))); return indexType.flags & (262144 /* TypeFlags.TypeParameter */ | 4194304 /* TypeFlags.Index */) ? getExtractStringType(indexType) : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -56718,7 +57147,7 @@ var ts; if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } - var isProperty = ts.isPropertyDeclaration(declaration) || ts.isPropertySignature(declaration); + var isProperty = ts.isPropertyDeclaration(declaration) && !ts.hasAccessorModifier(declaration) || ts.isPropertySignature(declaration); var isOptional = includeOptionality && (isProperty && !!declaration.questionToken || ts.isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) || isOptionalJSDocPropertyLikeTag(declaration)); @@ -56745,8 +57174,8 @@ var ts; if (ts.isParameter(declaration)) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 173 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { - var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 172 /* SyntaxKind.GetAccessor */); + if (func.kind === 175 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { + var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 174 /* SyntaxKind.GetAccessor */); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -56758,11 +57187,9 @@ var ts; return getReturnTypeOfSignature(getterSignature); } } - if (ts.isInJSFile(declaration)) { - var type_1 = getParameterTypeOfTypeTag(func, declaration); - if (type_1) - return type_1; - } + var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration); + if (parameterTypeOfTypeTag) + return parameterTypeOfTypeTag; // Use contextual parameter type if one is available var type = declaration.symbol.escapedName === "this" /* InternalSymbolName.This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration); if (type) { @@ -56823,7 +57250,7 @@ var ts; links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && ts.every(symbol.declarations, function (declaration) { return ts.isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && - (declaration.left.kind !== 207 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && + (declaration.left.kind !== 209 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration(/*declaredType*/ undefined, declaration, symbol, declaration); }); } @@ -56845,11 +57272,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var container = ts.getThisContainer(declaration, /*includeArrowFunctions*/ false); - if (container && (container.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { + if (container && (container.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { return container; } } - ; } /** Create a synthetic property access flow node after the last statement of the file */ function getFlowTypeFromCommonJSExport(symbol) { @@ -57142,9 +57568,9 @@ var ts; var thisContainer = ts.getThisContainer(expression, /*includeArrowFunctions*/ false); // Properties defined in a constructor (or base constructor, or javascript constructor function) don't get undefined added. // Function expressions that are assigned to the prototype count as methods. - return thisContainer.kind === 171 /* SyntaxKind.Constructor */ || - thisContainer.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (thisContainer.kind === 213 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + return thisContainer.kind === 173 /* SyntaxKind.Constructor */ || + thisContainer.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (thisContainer.kind === 215 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); } function getConstructorDefinedThisAssignmentTypes(types, declarations) { ts.Debug.assert(types.length === declarations.length); @@ -57214,7 +57640,7 @@ var ts; function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) { var elements = pattern.elements; var lastElement = ts.lastOrUndefined(elements); - var restElement = lastElement && lastElement.kind === 203 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; + var restElement = lastElement && lastElement.kind === 205 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; if (elements.length === 0 || elements.length === 1 && restElement) { return languageVersion >= 2 /* ScriptTarget.ES2015 */ ? createIterableType(anyType) : anyArrayType; } @@ -57239,7 +57665,7 @@ var ts; function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { if (includePatternInType === void 0) { includePatternInType = false; } if (reportErrors === void 0) { reportErrors = false; } - return pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + return pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -57287,7 +57713,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 164 /* SyntaxKind.Parameter */ ? root.parent : root; + var memberDeclaration = root.kind === 166 /* SyntaxKind.Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function tryGetTypeFromEffectiveTypeNode(node) { @@ -57342,9 +57768,9 @@ var ts; if (typeNode === undefined) { return useUnknownInCatchVariables ? unknownType : anyType; } - var type_2 = getTypeOfNode(typeNode); + var type_1 = getTypeOfNode(typeNode); // an errorType will make `checkTryStatement` issue an error - return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType; + return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType; } // Handle export default expressions if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) { @@ -57367,7 +57793,7 @@ var ts; return reportCircularityError(symbol); } var type; - if (declaration.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (declaration.kind === 274 /* SyntaxKind.ExportAssignment */) { type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); } else if (ts.isBinaryExpression(declaration) || @@ -57435,13 +57861,17 @@ var ts; } function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { - var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation; - } - else { - var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation; + switch (accessor.kind) { + case 174 /* SyntaxKind.GetAccessor */: + var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); + return getterTypeAnnotation; + case 175 /* SyntaxKind.SetAccessor */: + var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation; + case 169 /* SyntaxKind.PropertyDeclaration */: + ts.Debug.assert(ts.hasAccessorModifier(accessor)); + var accessorTypeAnnotation = ts.getEffectiveTypeAnnotationNode(accessor); + return accessorTypeAnnotation; } } return undefined; @@ -57463,14 +57893,17 @@ var ts; if (!pushTypeResolution(symbol, 0 /* TypeSystemPropertyName.Type */)) { return errorType; } - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); + var accessor = ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); // We try to resolve a getter type annotation, a setter type annotation, or a getter function // body return type inference, in that order. var type = getter && ts.isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || - getter && getter.body && getReturnTypeFromBody(getter); + getAnnotatedAccessorType(accessor) || + getter && getter.body && getReturnTypeFromBody(getter) || + accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration(accessor, /*includeOptionality*/ true); if (!type) { if (setter && !isPrivateWithinAmbient(setter)) { errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); @@ -57478,6 +57911,9 @@ var ts; else if (getter && !isPrivateWithinAmbient(getter)) { errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); } + else if (accessor && !isPrivateWithinAmbient(accessor)) { + errorOrSuggestion(noImplicitAny, accessor, ts.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), "any"); + } type = anyType; } if (!popTypeResolution()) { @@ -57487,6 +57923,9 @@ var ts; else if (getAnnotatedAccessorTypeNode(setter)) { error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } + else if (getAnnotatedAccessorTypeNode(accessor)) { + error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } else if (getter && noImplicitAny) { error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } @@ -57497,12 +57936,13 @@ var ts; return links.type; } function getWriteTypeOfAccessors(symbol) { + var _a; var links = getSymbolLinks(symbol); if (!links.writeType) { if (!pushTypeResolution(symbol, 8 /* TypeSystemPropertyName.WriteType */)) { return errorType; } - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var setter = (_a = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */)) !== null && _a !== void 0 ? _a : ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); var writeType = getAnnotatedAccessorType(setter); if (!popTypeResolution()) { if (getAnnotatedAccessorTypeNode(setter)) { @@ -57542,9 +57982,9 @@ var ts; if (symbol.flags & 1536 /* SymbolFlags.Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) { return anyType; } - else if (declaration && (declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || + else if (declaration && (declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || ts.isAccessExpression(declaration) && - declaration.parent.kind === 221 /* SyntaxKind.BinaryExpression */)) { + declaration.parent.kind === 223 /* SyntaxKind.BinaryExpression */)) { return getWidenedTypeForAssignmentDeclaration(symbol); } else if (symbol.flags & 512 /* SymbolFlags.ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) { @@ -57554,11 +57994,11 @@ var ts; return errorType; } var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* InternalSymbolName.ExportEquals */)); - var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); + var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); if (!popTypeResolution()) { return reportCircularityError(symbol); } - return type_3; + return type_2; } } var type = createObjectType(16 /* ObjectFlags.Anonymous */, symbol); @@ -57588,7 +58028,7 @@ var ts; links.type = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol.declarations) ? autoType : declaredType ? declaredType - : targetSymbol.flags & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol) + : getAllSymbolFlags(targetSymbol) & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol) : errorType; } return links.type; @@ -57609,7 +58049,7 @@ var ts; return errorType; } // Check if variable has initializer that circularly references the variable itself - if (noImplicitAny && (declaration.kind !== 164 /* SyntaxKind.Parameter */ || declaration.initializer)) { + if (noImplicitAny && (declaration.kind !== 166 /* SyntaxKind.Parameter */ || declaration.initializer)) { error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); } // Circularities could also result from parameters in function expressions that end up @@ -57741,46 +58181,46 @@ var ts; return undefined; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 195 /* SyntaxKind.MappedType */: - case 189 /* SyntaxKind.ConditionalType */: { + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 197 /* SyntaxKind.MappedType */: + case 191 /* SyntaxKind.ConditionalType */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); - if (node.kind === 195 /* SyntaxKind.MappedType */) { + if (node.kind === 197 /* SyntaxKind.MappedType */) { return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))); } - else if (node.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (node.kind === 191 /* SyntaxKind.ConditionalType */) { return ts.concatenate(outerTypeParameters, getInferTypeParameters(node)); } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node)); var thisType = includeThisTypes && - (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && + (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var paramSymbol = ts.getParameterSymbolFromJSDoc(node); if (paramSymbol) { node = paramSymbol.valueDeclaration; } break; - case 320 /* SyntaxKind.JSDoc */: { + case 323 /* SyntaxKind.JSDoc */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); return node.tags ? appendTypeParameters(outerTypeParameters, ts.flatMap(node.tags, function (t) { return ts.isJSDocTemplateTag(t) ? t.typeParameters : undefined; })) @@ -57791,7 +58231,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); ts.Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations"); return getOuterTypeParameters(declaration); } @@ -57804,9 +58244,9 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || - node.kind === 226 /* SyntaxKind.ClassExpression */ || + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || + node.kind === 228 /* SyntaxKind.ClassExpression */ || isJSConstructor(node) || ts.isTypeAlias(node)) { var declaration = node; @@ -57958,7 +58398,7 @@ var ts; if (!popTypeResolution() && type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { reportCircularBaseType(declaration, type); } } @@ -58054,7 +58494,7 @@ var ts; if (type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getReducedType(getTypeFromTypeNode(node)); @@ -58094,7 +58534,7 @@ var ts; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (declaration.flags & 128 /* NodeFlags.ContainsThis */) { return false; } @@ -58173,7 +58613,7 @@ var ts; } else { type = errorType; - if (declaration.kind === 339 /* SyntaxKind.JSDocEnumTag */) { + if (declaration.kind === 342 /* SyntaxKind.JSDocEnumTag */) { error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } else { @@ -58188,7 +58628,7 @@ var ts; if (ts.isStringLiteralLike(expr)) { return true; } - else if (expr.kind === 221 /* SyntaxKind.BinaryExpression */) { + else if (expr.kind === 223 /* SyntaxKind.BinaryExpression */) { return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right); } return false; @@ -58203,12 +58643,12 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; case 79 /* SyntaxKind.Identifier */: return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isStringConcatExpression(expr); default: return false; @@ -58223,7 +58663,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && ts.isStringLiteralLike(member.initializer)) { @@ -58252,7 +58692,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var value = getEnumMemberValue(member); @@ -58325,22 +58765,22 @@ var ts; */ function isThislessType(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 196 /* SyntaxKind.LiteralType */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 198 /* SyntaxKind.LiteralType */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isThislessType(node.elementType); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return !node.typeArguments || node.typeArguments.every(isThislessType); } return false; @@ -58366,7 +58806,7 @@ var ts; function isThislessFunctionLikeDeclaration(node) { var returnType = ts.getEffectiveReturnTypeNode(node); var typeParameters = ts.getEffectiveTypeParameterDeclarations(node); - return (node.kind === 171 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && + return (node.kind === 173 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); } @@ -58382,14 +58822,14 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return isThislessVariableLikeDeclaration(declaration); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return isThislessFunctionLikeDeclaration(declaration); } } @@ -58600,8 +59040,10 @@ var ts; if (members) { for (var _b = 0, members_5 = members; _b < members_5.length; _b++) { var member = members_5[_b]; - if (isStatic_1 === ts.hasStaticModifier(member) && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === ts.hasStaticModifier(member)) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58616,8 +59058,10 @@ var ts; || ts.isBinaryExpression(member) && isPossiblyAliasedThisProperty(member, assignmentKind) || assignmentKind === 9 /* AssignmentDeclarationKind.ObjectDefinePrototypeProperty */ || assignmentKind === 6 /* AssignmentDeclarationKind.Prototype */; // A straight `Prototype` assignment probably can never have a computed name - if (isStatic_1 === !isInstanceMember && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === !isInstanceMember) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58804,7 +59248,7 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); var declaration = ts.getClassLikeDeclarationOfSymbol(classType.symbol); - var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); if (baseSignatures.length === 0) { return [createSignature(undefined, classType.localTypeParameters, undefined, ts.emptyArray, classType, /*resolvedTypePredicate*/ undefined, 0, isAbstract ? 4 /* SignatureFlags.Abstract */ : 0 /* SignatureFlags.None */)]; } @@ -59426,8 +59870,8 @@ var ts; } function isMappedTypeWithKeyofConstraintDeclaration(type) { var constraintDeclaration = getConstraintDeclarationForMappedType(type); // TODO: GH#18217 - return constraintDeclaration.kind === 193 /* SyntaxKind.TypeOperator */ && - constraintDeclaration.operator === 140 /* SyntaxKind.KeyOfKeyword */; + return constraintDeclaration.kind === 195 /* SyntaxKind.TypeOperator */ && + constraintDeclaration.operator === 141 /* SyntaxKind.KeyOfKeyword */; } function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { @@ -59467,7 +59911,20 @@ var ts; return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(type) & 4 /* MappedTypeModifiers.IncludeOptional */); } function isGenericMappedType(type) { - return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) && isGenericIndexType(getConstraintTypeFromMappedType(type)); + if (ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) { + var constraint = getConstraintTypeFromMappedType(type); + if (isGenericIndexType(constraint)) { + return true; + } + // A mapped type is generic if the 'as' clause references generic types other than the iteration type. + // To determine this, we substitute the constraint type (that we now know isn't generic) for the iteration + // type and check whether the resulting type is generic. + var nameType = getNameTypeFromMappedType(type); + if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) { + return true; + } + } + return false; } function resolveStructuredTypeMembers(type) { if (!type.members) { @@ -59787,10 +60244,10 @@ var ts; var baseTypes = []; var different = false; for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type_4 = types_7[_i]; - var baseType = getBaseConstraint(type_4); + var type_3 = types_7[_i]; + var baseType = getBaseConstraint(type_3); if (baseType) { - if (baseType !== type_4) { + if (baseType !== type_3) { different = true; } baseTypes.push(baseType); @@ -59834,7 +60291,7 @@ var ts; return constraint && getBaseConstraint(constraint); } if (t.flags & 33554432 /* TypeFlags.Substitution */) { - return getBaseConstraint(t.substitute); + return getBaseConstraint(getSubstitutionIntersection(t)); } return t; } @@ -59937,7 +60394,7 @@ var ts; var indexTypes; var isUnion = containingType.flags & 1048576 /* TypeFlags.Union */; // Flags we want to propagate to the result if they exist in all source symbols - var optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */; + var optionalFlag; var syntheticFlag = 4 /* CheckFlags.SyntheticMethod */; var checkFlags = isUnion ? 0 : 8 /* CheckFlags.Readonly */; var mergedInstantiations = false; @@ -59948,11 +60405,14 @@ var ts; var prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment); var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0; if (prop) { - if (isUnion) { - optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */); - } - else { - optionalFlag &= prop.flags; + if (prop.flags & 106500 /* SymbolFlags.ClassMember */) { + optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : (optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */); + if (isUnion) { + optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */); + } + else { + optionalFlag &= prop.flags; + } } if (!singleProp) { singleProp = prop; @@ -59961,7 +60421,7 @@ var ts; var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp); // If the symbols are instances of one another with identical types - consider the symbols // equivalent and just use the first one, which thus allows us to avoid eliding private - // members when intersecting a (this-)instantiations of a class with it's raw base or another instance + // members when intersecting a (this-)instantiations of a class with its raw base or another instance if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) { // If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used // to do when we recorded multiple distinct symbols so that we still get, eg, `Array.length` printed @@ -60009,7 +60469,11 @@ var ts; } } } - if (!singleProp || isUnion && (propSet || checkFlags & 48 /* CheckFlags.Partial */) && checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */)) { + if (!singleProp || + isUnion && + (propSet || checkFlags & 48 /* CheckFlags.Partial */) && + checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */) && + !(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) { // No property was found, or, in a union, a property has a private or protected declaration in one // constituent, but is missing or has a different declaration in another constituent. return undefined; @@ -60067,7 +60531,7 @@ var ts; propTypes.push(type); } ts.addRange(propTypes, indexTypes); - var result = createSymbol(4 /* SymbolFlags.Property */ | optionalFlag, name, syntheticFlag | checkFlags); + var result = createSymbol(4 /* SymbolFlags.Property */ | (optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : 0), name, syntheticFlag | checkFlags); result.containingType = containingType; if (!hasNonUniformValueDeclaration && firstValueDeclaration) { result.valueDeclaration = firstValueDeclaration; @@ -60111,6 +60575,33 @@ var ts; } return property; } + function getCommonDeclarationsOfSymbols(symbols) { + var commonDeclarations; + var _loop_14 = function (symbol) { + if (!symbol.declarations) { + return { value: undefined }; + } + if (!commonDeclarations) { + commonDeclarations = new ts.Set(symbol.declarations); + return "continue"; + } + commonDeclarations.forEach(function (declaration) { + if (!ts.contains(symbol.declarations, declaration)) { + commonDeclarations.delete(declaration); + } + }); + if (commonDeclarations.size === 0) { + return { value: undefined }; + } + }; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var symbol = symbols_3[_i]; + var state_4 = _loop_14(symbol); + if (typeof state_4 === "object") + return state_4.value; + } + return commonDeclarations; + } function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) { var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment); // We need to filter out partial properties in union types @@ -60314,10 +60805,10 @@ var ts; function isJSDocOptionalParameter(node) { return ts.isInJSFile(node) && ( // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType - node.type && node.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ + node.type && node.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -60350,14 +60841,14 @@ var ts; return false; } function isOptionalPropertyDeclaration(node) { - return ts.isPropertyDeclaration(node) && node.questionToken; + return ts.isPropertyDeclaration(node) && !ts.hasAccessorModifier(node) && node.questionToken; } function isOptionalJSDocPropertyLikeTag(node) { if (!ts.isJSDocPropertyLikeTag(node)) { return false; } var isBracketed = node.isBracketed, typeExpression = node.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; } function createTypePredicate(kind, parameterName, parameterIndex, type) { return { kind: kind, parameterName: parameterName, parameterIndex: parameterIndex, type: type }; @@ -60439,7 +60930,7 @@ var ts; else { parameters.push(paramSymbol); } - if (type && type.kind === 196 /* SyntaxKind.LiteralType */) { + if (type && type.kind === 198 /* SyntaxKind.LiteralType */) { flags |= 2 /* SignatureFlags.HasLiteralTypes */; } // Record a new minimum argument count if this is not an optional parameter @@ -60452,24 +60943,24 @@ var ts; } } // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation - if ((declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) && + if ((declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) && hasBindableName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + var otherKind = declaration.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - var classType = declaration.kind === 171 /* SyntaxKind.Constructor */ ? + var classType = declaration.kind === 173 /* SyntaxKind.Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration); if (ts.hasRestParameter(declaration) || ts.isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) { flags |= 1 /* SignatureFlags.HasRestParameter */; } - if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */) || - ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 128 /* ModifierFlags.Abstract */)) { + if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */) || + ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 256 /* ModifierFlags.Abstract */)) { flags |= 4 /* SignatureFlags.Abstract */; } links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, @@ -60548,16 +61039,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node.escapedText === argumentsSymbol.escapedName && getReferencedValueSymbol(node) === argumentsSymbol; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && traverse(node.name); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return traverse(node.expression); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return traverse(node.initializer); default: return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse); @@ -60581,7 +61072,12 @@ var ts; continue; } } - result.push(getSignatureFromDeclaration(decl)); + // If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters. + // Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would supress checks that the two are compatible. + result.push((!ts.isFunctionExpressionOrArrowFunction(decl) && + !ts.isObjectLiteralMethod(decl) && + getSignatureOfTypeTag(decl)) || + getSignatureFromDeclaration(decl)); } return result; } @@ -60612,7 +61108,7 @@ var ts; else { var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration); var jsdocPredicate = void 0; - if (!type && ts.isInJSFile(signature.declaration)) { + if (!type) { var jsdocSignature = getSignatureOfTypeTag(signature.declaration); if (jsdocSignature && signature !== jsdocSignature) { jsdocPredicate = getTypePredicateOfSignature(jsdocSignature); @@ -60629,7 +61125,7 @@ var ts; function createTypePredicateFromTypePredicateNode(node, signature) { var parameterName = node.parameterName; var type = node.type && getTypeFromTypeNode(node.type); - return parameterName.kind === 192 /* SyntaxKind.ThisType */ ? + return parameterName.kind === 194 /* SyntaxKind.ThisType */ ? createTypePredicate(node.assertsModifier ? 2 /* TypePredicateKind.AssertsThis */ : 0 /* TypePredicateKind.This */, /*parameterName*/ undefined, /*parameterIndex*/ undefined, type) : createTypePredicate(node.assertsModifier ? 3 /* TypePredicateKind.AssertsIdentifier */ : 1 /* TypePredicateKind.Identifier */, parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type); } @@ -60675,7 +61171,7 @@ var ts; return signature.resolvedReturnType; } function getReturnTypeFromAnnotation(declaration) { - if (declaration.kind === 171 /* SyntaxKind.Constructor */) { + if (declaration.kind === 173 /* SyntaxKind.Constructor */) { return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)); } if (ts.isJSDocConstructSignature(declaration)) { @@ -60685,12 +61181,12 @@ var ts; if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration); if (jsDocType) { return jsDocType; } - var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 173 /* SyntaxKind.SetAccessor */); + var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 175 /* SyntaxKind.SetAccessor */); var setterType = getAnnotatedAccessorType(setter); if (setterType) { return setterType; @@ -60793,7 +61289,7 @@ var ts; if (!signature.isolatedSignatureType) { var kind = (_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind; // If declaration is undefined, it is likely to be the signature of the default constructor. - var isConstructor = kind === undefined || kind === 171 /* SyntaxKind.Constructor */ || kind === 175 /* SyntaxKind.ConstructSignature */ || kind === 180 /* SyntaxKind.ConstructorType */; + var isConstructor = kind === undefined || kind === 173 /* SyntaxKind.Constructor */ || kind === 177 /* SyntaxKind.ConstructSignature */ || kind === 182 /* SyntaxKind.ConstructorType */; var type = createObjectType(16 /* ObjectFlags.Anonymous */); type.members = emptySymbols; type.properties = ts.emptyArray; @@ -60820,7 +61316,7 @@ var ts; function getIndexInfosOfIndexSymbol(indexSymbol) { if (indexSymbol.declarations) { var indexInfos_4 = []; - var _loop_14 = function (declaration) { + var _loop_15 = function (declaration) { if (declaration.parameters.length === 1) { var parameter = declaration.parameters[0]; if (parameter.type) { @@ -60834,7 +61330,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_14(declaration); + _loop_15(declaration); } return indexInfos_4; } @@ -60851,14 +61347,14 @@ var ts; var _a; var inferences; if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) { - var _loop_15 = function (declaration) { - if (declaration.parent.kind === 190 /* SyntaxKind.InferType */) { + var _loop_16 = function (declaration) { + if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) { // When an 'infer T' declaration is immediately contained in a type reference node // (such as 'Foo'), T's constraint is inferred from the constraint of the // corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are // present, we form an intersection of the inferred constraint types. var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1]; - if (grandParent.kind === 178 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { + if (grandParent.kind === 180 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { var typeReference_1 = grandParent; var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1); if (typeParameters_1) { @@ -60885,27 +61381,27 @@ var ts; } // When an 'infer T' declaration is immediately contained in a rest parameter declaration, a rest type // or a named rest tuple element, we infer an 'unknown[]' constraint. - else if (grandParent.kind === 164 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || - grandParent.kind === 186 /* SyntaxKind.RestType */ || - grandParent.kind === 197 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { + else if (grandParent.kind === 166 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || + grandParent.kind === 188 /* SyntaxKind.RestType */ || + grandParent.kind === 199 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { inferences = ts.append(inferences, createArrayType(unknownType)); } // When an 'infer T' declaration is immediately contained in a string template type, we infer a 'string' // constraint. - else if (grandParent.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */) { + else if (grandParent.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */) { inferences = ts.append(inferences, stringType); } // When an 'infer T' declaration is in the constraint position of a mapped type, we infer a 'keyof any' // constraint. - else if (grandParent.kind === 163 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 195 /* SyntaxKind.MappedType */) { + else if (grandParent.kind === 165 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 197 /* SyntaxKind.MappedType */) { inferences = ts.append(inferences, keyofConstraintType); } // When an 'infer T' declaration is the template of a mapped type, and that mapped type is the extends // clause of a conditional whose check type is also a mapped type, give it a constraint equal to the template // of the check type's mapped type - else if (grandParent.kind === 195 /* SyntaxKind.MappedType */ && grandParent.type && - ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 189 /* SyntaxKind.ConditionalType */ && - grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 195 /* SyntaxKind.MappedType */ && + else if (grandParent.kind === 197 /* SyntaxKind.MappedType */ && grandParent.type && + ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 191 /* SyntaxKind.ConditionalType */ && + grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 197 /* SyntaxKind.MappedType */ && grandParent.parent.checkType.type) { var checkMappedType_1 = grandParent.parent.checkType; var nodeType = getTypeFromTypeNode(checkMappedType_1.type); @@ -60915,7 +61411,7 @@ var ts; }; for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - _loop_15(declaration); + _loop_16(declaration); } } return inferences && getIntersectionType(inferences); @@ -60937,7 +61433,7 @@ var ts; if (type.flags & 1 /* TypeFlags.Any */ && !isErrorType(type)) { // Allow errorType to propegate to keep downstream errors suppressed // use keyofConstraintType as the base constraint for mapped type key constraints (unknown isn;t assignable to that, but `any` was), // use unknown otherwise - type = constraintDeclaration.parent.parent.kind === 195 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; + type = constraintDeclaration.parent.parent.kind === 197 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; } typeParameter.constraint = type; } @@ -60946,7 +61442,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - var tp = ts.getDeclarationOfKind(typeParameter.symbol, 163 /* SyntaxKind.TypeParameter */); + var tp = ts.getDeclarationOfKind(typeParameter.symbol, 165 /* SyntaxKind.TypeParameter */); var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getEffectiveContainerForJSDocTemplateTag(tp.parent) : tp.parent; return host && getSymbolOfNode(host); } @@ -61032,8 +61528,8 @@ var ts; } var node = type.node; var typeArguments = !node ? ts.emptyArray : - node.kind === 178 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : - node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : + node.kind === 180 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : + node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); if (popTypeResolution()) { type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments; @@ -61075,7 +61571,7 @@ var ts; return errorType; } } - if (node.kind === 178 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { return createDeferredTypeReference(type, node, /*mapper*/ undefined); } // In a type reference, the outer type parameters of the referenced class or interface are automatically @@ -61146,9 +61642,9 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -61163,13 +61659,13 @@ var ts; return symbol.parent ? "".concat(getSymbolPath(symbol.parent), ".").concat(symbol.escapedName) : symbol.escapedName; } function getUnresolvedSymbolForEntityName(name) { - var identifier = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? name.name : + var identifier = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? name.name : name; var text = identifier.escapedText; if (text) { - var parentSymbol = name.kind === 161 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : + var parentSymbol = name.kind === 163 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : undefined; var path = parentSymbol ? "".concat(getSymbolPath(parentSymbol), ".").concat(text) : text; var result = unresolvedSymbols.get(path); @@ -61230,7 +61726,7 @@ var ts; var valueType = getTypeOfSymbol(symbol); var typeType = valueType; if (symbol.valueDeclaration) { - var isImportTypeWithQualifier = node.kind === 200 /* SyntaxKind.ImportType */ && node.qualifier; + var isImportTypeWithQualifier = node.kind === 202 /* SyntaxKind.ImportType */ && node.qualifier; // valueType might not have a symbol, eg, {import('./b').STRING_LITERAL} if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) { typeType = getTypeReferenceType(node, valueType.symbol); @@ -61240,23 +61736,27 @@ var ts; } return links.resolvedJSDocType; } - function getSubstitutionType(baseType, substitute) { - if (substitute.flags & 3 /* TypeFlags.AnyOrUnknown */ || substitute === baseType) { + function getSubstitutionType(baseType, constraint) { + if (constraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || constraint === baseType || + !isGenericType(baseType) && !isGenericType(constraint)) { return baseType; } - var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(substitute)); + var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(constraint)); var cached = substitutionTypes.get(id); if (cached) { return cached; } var result = createType(33554432 /* TypeFlags.Substitution */); result.baseType = baseType; - result.substitute = substitute; + result.constraint = constraint; substitutionTypes.set(id, result); return result; } + function getSubstitutionIntersection(substitutionType) { + return getIntersectionType([substitutionType.constraint, substitutionType.baseType]); + } function isUnaryTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 1; + return node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 1; } function getImpliedConstraint(type, checkNode, extendsNode) { return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) : @@ -61266,16 +61766,16 @@ var ts; function getConditionalFlowTypeOfType(type, node) { var constraints; var covariant = true; - while (node && !ts.isStatement(node) && node.kind !== 320 /* SyntaxKind.JSDoc */) { + while (node && !ts.isStatement(node) && node.kind !== 323 /* SyntaxKind.JSDoc */) { var parent = node.parent; // only consider variance flipped by parameter locations - `keyof` types would usually be considered variance inverting, but // often get used in indexed accesses where they behave sortof invariantly, but our checking is lax - if (parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 166 /* SyntaxKind.Parameter */) { covariant = !covariant; } // Always substitute on type parameters, regardless of variance, since even // in contravariant positions, they may rely on substituted constraints to be valid - if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 189 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { + if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 191 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { var constraint = getImpliedConstraint(type, parent.checkType, parent.extendsType); if (constraint) { constraints = ts.append(constraints, constraint); @@ -61283,7 +61783,7 @@ var ts; } // Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the // template type XXX, K has an added constraint of number | `${number}`. - else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 195 /* SyntaxKind.MappedType */ && node === parent.type) { + else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 197 /* SyntaxKind.MappedType */ && node === parent.type) { var mappedType = getTypeFromTypeNode(parent); if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { var typeParameter = getHomomorphicTypeVariable(mappedType); @@ -61297,10 +61797,10 @@ var ts; } node = parent; } - return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type; + return constraints ? getSubstitutionType(type, getIntersectionType(constraints)) : type; } function isJSDocTypeReference(node) { - return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 200 /* SyntaxKind.ImportType */); + return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 202 /* SyntaxKind.ImportType */); } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { @@ -61415,9 +61915,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declaration; } } @@ -61568,6 +62068,13 @@ var ts; function getGlobalBigIntType() { return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType; } + function getGlobalNaNSymbol() { + return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false))); + } + function getGlobalRecordSymbol() { + deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol); + return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol; + } /** * Instantiates a global type that is generic with some element type, and returns that instantiation. */ @@ -61585,11 +62092,11 @@ var ts; } function getTupleElementFlags(node) { switch (node.kind) { - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return 2 /* ElementFlags.Optional */; - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getRestTypeElementFlags(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return node.questionToken ? 2 /* ElementFlags.Optional */ : node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* ElementFlags.Required */; @@ -61607,14 +62114,14 @@ var ts; return readonly ? globalReadonlyArrayType : globalArrayType; } var elementFlags = ts.map(node.elements, getTupleElementFlags); - var missingName = ts.some(node.elements, function (e) { return e.kind !== 197 /* SyntaxKind.NamedTupleMember */; }); + var missingName = ts.some(node.elements, function (e) { return e.kind !== 199 /* SyntaxKind.NamedTupleMember */; }); return getTupleTargetType(elementFlags, readonly, /*associatedNames*/ missingName ? undefined : node.elements); } // Return true if the given type reference node is directly aliased or if it needs to be deferred // because it is possibly contained in a circular chain of eagerly resolved types. function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) { - return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 183 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : - node.kind === 184 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : + return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 185 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : + node.kind === 186 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || ts.some(node.typeArguments, mayResolveTypeAlias)); } // Return true when the given node is transitively contained in type constructs that eagerly @@ -61623,18 +62130,18 @@ var ts; function isResolvedByTypeAlias(node) { var parent = node.parent; switch (parent.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 189 /* SyntaxKind.ConditionalType */: - case 193 /* SyntaxKind.TypeOperator */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 191 /* SyntaxKind.ConditionalType */: + case 195 /* SyntaxKind.TypeOperator */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return isResolvedByTypeAlias(parent); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } return false; @@ -61643,28 +62150,28 @@ var ts; // of a type alias. function mayResolveTypeAlias(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */).flags & 524288 /* SymbolFlags.TypeAlias */); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return true; - case 193 /* SyntaxKind.TypeOperator */: - return node.operator !== 154 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 195 /* SyntaxKind.TypeOperator */: + return node.operator !== 156 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 319 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return mayResolveTypeAlias(node.type); - case 186 /* SyntaxKind.RestType */: - return node.type.kind !== 183 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 188 /* SyntaxKind.RestType */: + return node.type.kind !== 185 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return ts.some(node.types, mayResolveTypeAlias); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return mayResolveTypeAlias(node.checkType) || mayResolveTypeAlias(node.extendsType) || mayResolveTypeAlias(node.trueType) || mayResolveTypeAlias(node.falseType); } @@ -61677,19 +62184,19 @@ var ts; if (target === emptyGenericType) { links.resolvedType = emptyObjectType; } - else if (!(node.kind === 184 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { - links.resolvedType = node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : + else if (!(node.kind === 186 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { + links.resolvedType = node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : createDeferredTypeReference(target, node, /*mapper*/ undefined); } else { - var elementTypes = node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); + var elementTypes = node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); links.resolvedType = createNormalizedTypeReference(target, elementTypes); } } return links.resolvedType; } function isReadonlyTypeOperator(node) { - return ts.isTypeOperatorNode(node) && node.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + return ts.isTypeOperatorNode(node) && node.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } function createTupleType(elementTypes, elementFlags, readonly, namedMemberDeclarations) { if (readonly === void 0) { readonly = false; } @@ -61804,7 +62311,7 @@ var ts; var lastRequiredIndex = -1; var firstRestIndex = -1; var lastOptionalOrRestIndex = -1; - var _loop_16 = function (i) { + var _loop_17 = function (i) { var type = elementTypes[i]; var flags = target.elementFlags[i]; if (flags & 8 /* ElementFlags.Variadic */) { @@ -61834,9 +62341,9 @@ var ts; } }; for (var i = 0; i < elementTypes.length; i++) { - var state_4 = _loop_16(i); - if (typeof state_4 === "object") - return state_4.value; + var state_5 = _loop_17(i); + if (typeof state_5 === "object") + return state_5.value; } // Turn optional elements preceding the last required element into required elements for (var i = 0; i < lastRequiredIndex; i++) { @@ -61864,7 +62371,7 @@ var ts; if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) { lastOptionalOrRestIndex = expandedFlags.length; } - expandedTypes.push(type); + expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type); expandedFlags.push(flags); if (expandedDeclarations && declaration) { expandedDeclarations.push(declaration); @@ -62030,7 +62537,7 @@ var ts; var templates = ts.filter(types, isPatternLiteralType); if (templates.length) { var i = types.length; - var _loop_17 = function () { + var _loop_18 = function () { i--; var t = types[i]; if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) { @@ -62038,7 +62545,7 @@ var ts; } }; while (i > 0) { - _loop_17(); + _loop_18(); } } } @@ -62115,14 +62622,14 @@ var ts; var namedUnions = []; addNamedUnions(namedUnions, types); var reducedTypes = []; - var _loop_18 = function (t) { + var _loop_19 = function (t) { if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) { reducedTypes.push(t); } }; for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) { var t = typeSet_1[_i]; - _loop_18(t); + _loop_19(t); } if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) { return namedUnions[0]; @@ -62612,7 +63119,7 @@ var ts; type.flags & 16777216 /* TypeFlags.Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* TypeFlags.UnionOrIntersection */ | 134217728 /* TypeFlags.TemplateLiteral */) ? ts.every(type.types, isDistributive) : type.flags & 8388608 /* TypeFlags.IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.substitute) : + type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* TypeFlags.StringMapping */ ? isDistributive(type.type) : false; } @@ -62693,15 +63200,15 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { switch (node.operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); break; - case 154 /* SyntaxKind.UniqueKeyword */: - links.resolvedType = node.type.kind === 151 /* SyntaxKind.SymbolKeyword */ + case 156 /* SyntaxKind.UniqueKeyword */: + links.resolvedType = node.type.kind === 153 /* SyntaxKind.SymbolKeyword */ ? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent)) : errorType; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: links.resolvedType = getTypeFromTypeNode(node.type); break; default: @@ -62737,8 +63244,14 @@ var ts; return getStringLiteralType(text); } newTexts.push(text); - if (ts.every(newTexts, function (t) { return t === ""; }) && ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) { - return stringType; + if (ts.every(newTexts, function (t) { return t === ""; })) { + if (ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) { + return stringType; + } + // Normalize `${Mapping}` into Mapping + if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) { + return newTypes[0]; + } } var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join("")); var type = templateLiteralTypes.get(id); @@ -62797,12 +63310,14 @@ var ts; } function getStringMappingType(symbol, type) { return type.flags & (1048576 /* TypeFlags.Union */ | 131072 /* TypeFlags.Never */) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) : - // Mapping> === Mapping - type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type : - isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456 /* TypeFlags.StringMapping */) ? getTemplateLiteralType(["", ""], [type]) : type) : - type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : - type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) : - type; + type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : + type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) : + // Mapping> === Mapping + type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type : + type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 268435456 /* TypeFlags.StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : + // This handles Mapping<`${number}`> and Mapping<`${bigint}`> + isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) : + type; } function applyStringMapping(symbol, str) { switch (intrinsicTypeKinds.get(symbol.escapedName)) { @@ -62893,7 +63408,7 @@ var ts; } function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, accessNode, accessFlags) { var _a; - var accessExpression = accessNode && accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; var propName = accessNode && ts.isPrivateIdentifier(accessNode) ? undefined : getPropertyNameFromIndex(indexType, accessNode); if (propName !== undefined) { if (accessFlags & 256 /* AccessFlags.Contextual */) { @@ -62967,7 +63482,18 @@ var ts; return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; } errorIfWritingToReadonlyIndex(indexInfo); - return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; + // When accessing an enum object with its own type, + // e.g. E[E.A] for enum E { A }, undefined shouldn't + // be included in the result type + if ((accessFlags & 1 /* AccessFlags.IncludeUndefined */) && + !(objectType.symbol && + objectType.symbol.flags & (256 /* SymbolFlags.RegularEnum */ | 128 /* SymbolFlags.ConstEnum */) && + (indexType.symbol && + indexType.flags & 1024 /* TypeFlags.EnumLiteral */ && + getParentOfSymbol(indexType.symbol) === objectType.symbol))) { + return getUnionType([indexInfo.type, undefinedType]); + } + return indexInfo.type; } if (indexType.flags & 131072 /* TypeFlags.Never */) { return neverType; @@ -63064,16 +63590,17 @@ var ts; } } function getIndexNodeForAccessExpression(accessNode) { - return accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : - accessNode.kind === 194 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : - accessNode.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : + return accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : + accessNode.kind === 196 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : + accessNode.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : accessNode; } function isPatternLiteralPlaceholderType(type) { - return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || !!(type.flags & 268435456 /* TypeFlags.StringMapping */ && isPatternLiteralPlaceholderType(type.type)); + return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || isPatternLiteralType(type); } function isPatternLiteralType(type) { - return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType); + return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType) || + !!(type.flags & 268435456 /* TypeFlags.StringMapping */) && isPatternLiteralPlaceholderType(type.type); } function isGenericType(type) { return !!getGenericObjectFlags(type); @@ -63095,7 +63622,7 @@ var ts; if (type.flags & 33554432 /* TypeFlags.Substitution */) { if (!(type.objectFlags & 2097152 /* ObjectFlags.IsGenericTypeComputed */)) { type.objectFlags |= 2097152 /* ObjectFlags.IsGenericTypeComputed */ | - getGenericObjectFlags(type.substitute) | getGenericObjectFlags(type.baseType); + getGenericObjectFlags(type.baseType) | getGenericObjectFlags(type.constraint); } return type.objectFlags & 12582912 /* ObjectFlags.IsGenericType */; } @@ -63246,7 +63773,7 @@ var ts; // for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved // eagerly using the constraint type of 'this' at the given location. - if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 194 /* SyntaxKind.IndexedAccessType */ ? + if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 196 /* SyntaxKind.IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) { if (objectType.flags & 3 /* TypeFlags.AnyOrUnknown */) { @@ -63298,11 +63825,7 @@ var ts; var objectType = getTypeFromTypeNode(node.objectType); var indexType = getTypeFromTypeNode(node.indexType); var potentialAlias = getAliasSymbolForTypeNode(node); - var resolved = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); - links.resolvedType = resolved.flags & 8388608 /* TypeFlags.IndexedAccess */ && - resolved.objectType === objectType && - resolved.indexType === indexType ? - getConditionalFlowTypeOfType(resolved, node) : resolved; + links.resolvedType = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); } return links.resolvedType; } @@ -63356,18 +63879,23 @@ var ts; var result; var extraTypes; var tailCount = 0; - var _loop_19 = function () { + // We loop here for an immediately nested conditional type in the false position, effectively treating + // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for + // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of + // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive + // cases we increment the tail recursion counter and stop after 1000 iterations. + while (true) { if (tailCount === 1000) { error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); result = errorType; - return "break"; + break; } var isUnwrapped = isTypicalNondistributiveConditional(root); var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper); var checkTypeInstantiable = isGenericType(checkType); var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper); if (checkType === wildcardType || extendsType === wildcardType) { - return { value: wildcardType }; + return wildcardType; } var combinedMapper = void 0; if (root.inferTypeParameters) { @@ -63400,11 +63928,7 @@ var ts; } } } - // We skip inference of the possible `infer` types unles the `extendsType` _is_ an infer type - // if it was, it's trivial to say that extendsType = checkType, however such a pattern is used to - // "reset" the type being build up during constraint calculation and avoid making an apparently "infinite" constraint - // so in those cases we refain from performing inference and retain the uninfered type parameter - if (!checkTypeInstantiable || !ts.some(root.inferTypeParameters, function (t) { return t === extendsType; })) { + if (!checkTypeInstantiable) { // We don't want inferences from constraints as they may cause us to eagerly resolve the // conditional type instead of deferring resolution. Also, we always want strict function // types rules (i.e. proper contravariance) for inferences. @@ -63436,14 +63960,14 @@ var ts; var newRoot = falseType_1.root; if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) { root = newRoot; - return "continue"; + continue; } if (canTailRecurse(falseType_1, mapper)) { - return "continue"; + continue; } } result = instantiateType(falseType_1, mapper); - return "break"; + break; } // Return trueType for a definitely true extends check. We check instantiations of the two // types with type parameters mapped to their restrictive form, i.e. a form of the type parameter @@ -63454,10 +63978,10 @@ var ts; var trueType_1 = getTypeFromTypeNode(root.node.trueType); var trueMapper = combinedMapper || mapper; if (canTailRecurse(trueType_1, trueMapper)) { - return "continue"; + continue; } result = instantiateType(trueType_1, trueMapper); - return "break"; + break; } } // Return a deferred type for a check that is neither definitely true nor definitely false @@ -63469,19 +63993,7 @@ var ts; result.combinedMapper = combinedMapper; result.aliasSymbol = aliasSymbol || root.aliasSymbol; result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217 - return "break"; - }; - // We loop here for an immediately nested conditional type in the false position, effectively treating - // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for - // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of - // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive - // cases we increment the tail recursion counter and stop after 1000 iterations. - while (true) { - var state_5 = _loop_19(); - if (typeof state_5 === "object") - return state_5.value; - if (state_5 === "break") - break; + break; } return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result; // We tail-recurse for generic conditional types that (a) have not already been evaluated and cached, and @@ -63673,7 +64185,7 @@ var ts; } function getAliasSymbolForTypeNode(node) { var host = node.parent; - while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { host = host.parent; } return ts.isTypeAlias(host) ? getSymbolOfNode(host) : undefined; @@ -63918,7 +64430,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */)) { if (!ts.isStatic(container) && (!ts.isConstructorDeclaration(container) || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -63953,17 +64465,17 @@ var ts; } function getArrayElementTypeNode(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return getArrayElementTypeNode(node.type); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: if (node.elements.length === 1) { node = node.elements[0]; - if (node.kind === 186 /* SyntaxKind.RestType */ || node.kind === 197 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { + if (node.kind === 188 /* SyntaxKind.RestType */ || node.kind === 199 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { return getArrayElementTypeNode(node.type); } } break; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return node.elementType; } return undefined; @@ -63979,99 +64491,99 @@ var ts; } function getTypeFromTypeNodeWorker(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 131 /* SyntaxKind.AnyKeyword */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return anyType; - case 155 /* SyntaxKind.UnknownKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return unknownType; - case 150 /* SyntaxKind.StringKeyword */: + case 152 /* SyntaxKind.StringKeyword */: return stringType; - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return numberType; - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return bigintType; - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return booleanType; - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return esSymbolType; case 114 /* SyntaxKind.VoidKeyword */: return voidType; - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return undefinedType; case 104 /* SyntaxKind.NullKeyword */: // TODO(rbuckton): `NullKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service. return nullType; - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return neverType; - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return node.flags & 262144 /* NodeFlags.JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType; - case 138 /* SyntaxKind.IntrinsicKeyword */: + case 139 /* SyntaxKind.IntrinsicKeyword */: return intrinsicMarkerType; - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: // TODO(rbuckton): `ThisKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service and because of `isPartOfTypeNode`. return getTypeFromThisTypeNode(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return getTypeFromLiteralTypeNode(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getTypeFromTypeReference(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? voidType : booleanType; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return getTypeFromTypeQueryNode(node); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return getTypeFromArrayOrTupleTypeNode(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return getTypeFromOptionalTypeNode(node); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return getTypeFromUnionTypeNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return addOptionality(getTypeFromTypeNode(node.type)); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return getTypeFromNamedTupleTypeNode(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return getTypeFromTypeNode(node.type); - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getTypeFromRestTypeNode(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return getTypeFromMappedTypeNode(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getTypeFromConditionalTypeNode(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return getTypeFromInferTypeNode(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return getTypeFromTemplateTypeNode(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return getTypeFromImportTypeNode(node); // This function assumes that an identifier, qualified name, or property access expression is a type expression // Callers should first ensure this by calling `isPartOfTypeNode` // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var symbol = getSymbolAtLocation(node); return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; default: @@ -64178,8 +64690,8 @@ var ts; return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* TypeMapKind.Merged */, mapper, makeUnaryTypeMapper(source, target)); } function getRestrictiveTypeParameter(tp) { - return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), - tp.restrictiveInstantiation.constraint = unknownType, + return !tp.constraint && !getConstraintDeclaration(tp) || tp.constraint === noConstraintType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), + tp.restrictiveInstantiation.constraint = noConstraintType, tp.restrictiveInstantiation); } function cloneTypeParameter(typeParameter) { @@ -64293,17 +64805,18 @@ var ts; return type; } function maybeTypeParameterReference(node) { - return !(node.parent.kind === 178 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || - node.parent.kind === 200 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); + return !(node.parent.kind === 180 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || + node.parent.kind === 202 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); } function isTypeParameterPossiblyReferenced(tp, node) { - // If the type parameter doesn't have exactly one declaration, if there are invening statement blocks + // If the type parameter doesn't have exactly one declaration, if there are intervening statement blocks // between the node and the type parameter declaration, if the node contains actual references to the - // type parameter, or if the node contains type queries, we consider the type parameter possibly referenced. + // type parameter, or if the node contains type queries that we can't prove couldn't contain references to the type parameter, + // we consider the type parameter possibly referenced. if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container = tp.symbol.declarations[0].parent; for (var n = node; n !== container; n = n.parent) { - if (!n || n.kind === 235 /* SyntaxKind.Block */ || n.kind === 189 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { + if (!n || n.kind === 238 /* SyntaxKind.Block */ || n.kind === 191 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { return true; } } @@ -64312,15 +64825,36 @@ var ts; return true; function containsReference(node) { switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return !!tp.isThisType; case 79 /* SyntaxKind.Identifier */: return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && getTypeFromTypeNodeWorker(node) === tp; // use worker because we're looking for === equality - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: + var entityName = node.exprName; + var firstIdentifier = ts.getFirstIdentifier(entityName); + var firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); + var tpDeclaration = tp.symbol.declarations[0]; // There is exactly one declaration, otherwise `containsReference` is not called + var tpScope_1; + if (tpDeclaration.kind === 165 /* SyntaxKind.TypeParameter */) { // Type parameter is a regular type parameter, e.g. foo + tpScope_1 = tpDeclaration.parent; + } + else if (tp.isThisType) { + // Type parameter is the this type, and its declaration is the class declaration. + tpScope_1 = tpDeclaration; + } + else { + // Type parameter's declaration was unrecognized. + // This could happen if the type parameter comes from e.g. a JSDoc annotation, so we default to returning true. + return true; + } + if (firstIdentifierSymbol.declarations) { + return ts.some(firstIdentifierSymbol.declarations, function (idDecl) { return ts.isNodeDescendantOf(idDecl, tpScope_1); }) || + ts.some(node.typeArguments, containsReference); + } return true; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return !node.type && !!node.body || ts.some(node.typeParameters, containsReference) || ts.some(node.parameters, containsReference) || @@ -64542,17 +65076,18 @@ var ts; return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments); } if (flags & 33554432 /* TypeFlags.Substitution */) { - var maybeVariable = instantiateType(type.baseType, mapper); - if (maybeVariable.flags & 8650752 /* TypeFlags.TypeVariable */) { - return getSubstitutionType(maybeVariable, instantiateType(type.substitute, mapper)); + var newBaseType = instantiateType(type.baseType, mapper); + var newConstraint = instantiateType(type.constraint, mapper); + // A substitution type originates in the true branch of a conditional type and can be resolved + // to just the base type in the same cases as the conditional type resolves to its true branch + // (because the base type is then known to satisfy the constraint). + if (newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ && isGenericType(newConstraint)) { + return getSubstitutionType(newBaseType, newConstraint); } - else { - var sub = instantiateType(type.substitute, mapper); - if (sub.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) { - return maybeVariable; - } - return sub; + if (newConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(newBaseType), getRestrictiveInstantiation(newConstraint))) { + return newBaseType; } + return newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); } return type; } @@ -64601,35 +65136,35 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type return isContextSensitiveFunctionLikeDeclaration(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return ts.some(node.properties, isContextSensitive); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return ts.some(node.elements, isContextSensitive); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return isContextSensitive(node.initializer); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isContextSensitive(node.expression); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive); - case 285 /* SyntaxKind.JsxAttribute */: { + case 288 /* SyntaxKind.JsxAttribute */: { // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. var initializer = node.initializer; return !!initializer && isContextSensitive(initializer); } - case 288 /* SyntaxKind.JsxExpression */: { + case 291 /* SyntaxKind.JsxExpression */: { // It is possible to that node.expression is undefined (e.g
) var expression = node.expression; return !!expression && isContextSensitive(expression); @@ -64638,15 +65173,14 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return (!ts.isFunctionDeclaration(node) || ts.isInJSFile(node) && !!getTypeForDeclarationFromJSDocComment(node)) && - (ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node)); + return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node); } function hasContextSensitiveReturnExpression(node) { // TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value. - return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 /* SyntaxKind.Block */ && isContextSensitive(node.body); + return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 238 /* SyntaxKind.Block */ && isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { - return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && + return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { @@ -64747,23 +65281,23 @@ var ts; return true; } switch (node.kind) { - case 288 /* SyntaxKind.JsxExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 27 /* SyntaxKind.CommaToken */: return elaborateError(node.right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); } break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer); } return false; @@ -64972,7 +65506,7 @@ var ts; } function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) { switch (child.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: // child is of the type of the expression return { errorNode: child, innerExpression: child.expression, nameType: nameType }; case 11 /* SyntaxKind.JsxText */: @@ -64981,9 +65515,9 @@ var ts; } // child is a string return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() }; - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: // child is of type JSX.Element return { errorNode: child, innerExpression: child, nameType: nameType }; default: @@ -65131,11 +65665,11 @@ var ts; } _b = prop.kind; switch (_b) { - case 173 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; - case 172 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; - case 169 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; - case 296 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; + case 175 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; + case 174 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; + case 171 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; + case 299 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; } return [3 /*break*/, 6]; case 2: return [4 /*yield*/, { errorNode: prop.name, innerExpression: undefined, nameType: type }]; @@ -65208,8 +65742,8 @@ var ts; void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers); } var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; - var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 169 /* SyntaxKind.MethodDeclaration */ && - kind !== 168 /* SyntaxKind.MethodSignature */ && kind !== 171 /* SyntaxKind.Constructor */; + var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 171 /* SyntaxKind.MethodDeclaration */ && + kind !== 170 /* SyntaxKind.MethodSignature */ && kind !== 173 /* SyntaxKind.Constructor */; var result = -1 /* Ternary.True */; var sourceThisType = getThisTypeOfSignature(source); if (sourceThisType && sourceThisType !== voidType) { @@ -65506,7 +66040,7 @@ var ts; var t = isFreshLiteralType(type) ? type.regularType : ts.getObjectFlags(type) & 4 /* ObjectFlags.Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* TypeFlags.UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : type.substitute : + type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* TypeFlags.Simplifiable */ ? getSimplifiedType(type, writing) : type; if (t === type) @@ -65913,7 +66447,8 @@ var ts; return 0 /* Ternary.False */; } } - var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2 /* IntersectionState.Target */) && + var isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source)) && + !(intersectionState & 2 /* IntersectionState.Target */) && source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType && target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) && (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)); @@ -65940,27 +66475,6 @@ var ts; var result_7 = skipCaching ? unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) : recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags); - // For certain combinations involving intersections and optional, excess, or mismatched properties we need - // an extra property check where the intersection is viewed as a single object. The following are motivating - // examples that all should be errors, but aren't without this extra property check: - // - // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property - // - // declare let wrong: { a: { y: string } }; - // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type - // - // function foo(x: { a?: string }, y: T & { a: boolean }) { - // x = y; // Mismatched property in source intersection - // } - // - // We suppress recursive intersection property checks because they can generate lots of work when relating - // recursive intersections that are structurally similar but not exactly identical. See #37854. - if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) || - isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) { - inPropertyCheck = true; - result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* IntersectionState.PropertyCheck */, recursionFlags); - inPropertyCheck = false; - } if (result_7) { return result_7; } @@ -66165,11 +66679,15 @@ var ts; // parameter 'T extends 1 | 2', the intersection 'T & 1' should be reduced to '1' such that it doesn't // appear to be comparable to '2'. if (relation === comparableRelation && target.flags & 131068 /* TypeFlags.Primitive */) { - var constraints = ts.sameMap(source.types, getBaseConstraintOrType); + var constraints = ts.sameMap(source.types, function (t) { return t.flags & 465829888 /* TypeFlags.Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t; }); if (constraints !== source.types) { source = getIntersectionType(constraints); + if (source.flags & 131072 /* TypeFlags.Never */) { + return 0 /* Ternary.False */; + } if (!(source.flags & 2097152 /* TypeFlags.Intersection */)) { - return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); + return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false) || + isRelatedTo(target, source, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); } } } @@ -66354,8 +66872,7 @@ var ts; if (overflow) { return 0 /* Ternary.False */; } - var keyIntersectionState = intersectionState | (inPropertyCheck ? 8 /* IntersectionState.InPropertyCheck */ : 0); - var id = getRelationKey(source, target, keyIntersectionState, relation, /*ingnoreConstraints*/ false); + var id = getRelationKey(source, target, intersectionState, relation, /*ingnoreConstraints*/ false); var entry = relation.get(id); if (entry !== undefined) { if (reportErrors && entry & 2 /* RelationComparisonResult.Failed */ && !(entry & 4 /* RelationComparisonResult.Reported */)) { @@ -66385,7 +66902,7 @@ var ts; // A key that starts with "*" is an indication that we have type references that reference constrained // type parameters. For such keys we also check against the key we would have gotten if all type parameters // were unconstrained. - var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, /*ignoreConstraints*/ true) : undefined; + var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, intersectionState, relation, /*ignoreConstraints*/ true) : undefined; for (var i = 0; i < maybeCount; i++) { // If source and target are already being compared, consider them related with assumptions if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) { @@ -66472,7 +66989,7 @@ var ts; function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) { var saveErrorInfo = captureErrorCalculationState(); var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo); - if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) { + if (relation !== identityRelation) { // The combined constraint of an intersection type is the intersection of the constraints of // the constituents. When an intersection type contains instantiable types with union type // constraints, there are situations where we need to examine the combined constraint. One is @@ -66486,10 +67003,33 @@ var ts; // needs to have its constraint hoisted into an intersection with said type parameter, this way // the type param can be compared with itself in the target (with the influence of its constraint to match other parts) // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)` - var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */)); - if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself - // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this - result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); + if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) { + var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */)); + if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself + // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this + result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); + } + } + // For certain combinations involving intersections and optional, excess, or mismatched properties we need + // an extra property check where the intersection is viewed as a single object. The following are motivating + // examples that all should be errors, but aren't without this extra property check: + // + // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property + // + // declare let wrong: { a: { y: string } }; + // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type + // + // function foo(x: { a?: string }, y: T & { a: boolean }) { + // x = y; // Mismatched property in source intersection + // } + // + // We suppress recursive intersection property checks because they can generate lots of work when relating + // recursive intersections that are structurally similar but not exactly identical. See #37854. + if (result && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && !isGenericObjectType(target) && source.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) || + isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) { + inPropertyCheck = true; + result &= propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */); + inPropertyCheck = false; } } if (result) { @@ -66498,9 +67038,6 @@ var ts; return result; } function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) { - if (intersectionState & 4 /* IntersectionState.PropertyCheck */) { - return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */); - } var result; var originalErrorInfo; var varianceCheckFailed = false; @@ -66539,7 +67076,11 @@ var ts; } } if (sourceFlags & 33554432 /* TypeFlags.Substitution */) { - return isRelatedTo(source.substitute, target.substitute, 3 /* RecursionFlags.Both */, /*reportErrors*/ false); + if (result = isRelatedTo(source.baseType, target.baseType, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + if (result &= isRelatedTo(source.constraint, target.constraint, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + return result; + } + } } if (!(sourceFlags & 524288 /* TypeFlags.Object */)) { return 0 /* Ternary.False */; @@ -66597,7 +67138,7 @@ var ts; // with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!) var constraint = getConstraintOfTypeParameter(source); if (constraint && hasNonCircularBaseConstraint(source)) { - while (constraint && constraint.flags & 262144 /* TypeFlags.TypeParameter */) { + while (constraint && someType(constraint, function (c) { return !!(c.flags & 262144 /* TypeFlags.TypeParameter */); })) { if (result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false)) { return result; } @@ -67253,7 +67794,7 @@ var ts; return 0 /* Ternary.False */; } // When checking for comparability, be more lenient with optional properties. - if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) { + if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && targetProp.flags & 106500 /* SymbolFlags.ClassMember */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) { // TypeScript 1.0 spec (April 2014): 3.8.3 // S is a subtype of a type T, and T is a supertype of S if ... // S' and T are object types and, for each member M in T.. @@ -67291,7 +67832,7 @@ var ts; shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it } if (props.length === 1) { - var propName = symbolToString(unmatchedProperty); + var propName = symbolToString(unmatchedProperty, /*enclosingDeclaration*/ undefined, 0 /* SymbolFlags.None */, 4 /* SymbolFormatFlags.AllowAnyNodeKind */ | 16 /* SymbolFormatFlags.WriteComputedProps */); reportError.apply(void 0, __spreadArray([ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName], getTypeNamesForErrorDisplay(source, target), false)); if (ts.length(unmatchedProperty.declarations)) { associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName)); @@ -67540,7 +68081,7 @@ var ts; var targetSignature = ts.first(targetSignatures); result = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors, incompatibleReporter(sourceSignature, targetSignature)); if (!result && reportErrors && kind === 1 /* SignatureKind.Construct */ && (sourceObjectFlags & targetObjectFlags) && - (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 171 /* SyntaxKind.Constructor */)) { + (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 173 /* SyntaxKind.Constructor */)) { var constructSignatureToString = function (signature) { return signatureToString(signature, /*enclosingDeclaration*/ undefined, 262144 /* TypeFormatFlags.WriteArrowStyleSignature */, kind); }; @@ -68305,7 +68846,7 @@ var ts; var baseTypeNode = getBaseTypeNodeOfClass(target); // A base type expression may circularly reference the class itself (e.g. as an argument to function call), so we only // check for base types specified as simple qualified names. - if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 206 /* SyntaxKind.PropertyAccessExpression */) { + if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 208 /* SyntaxKind.PropertyAccessExpression */) { return undefined; } } @@ -68353,8 +68894,7 @@ var ts; return !!(type.flags & 109440 /* TypeFlags.Unit */); } function isUnitLikeType(type) { - return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.some(type.types, isUnitType) : - !!(type.flags & 109440 /* TypeFlags.Unit */); + return isUnitType(getBaseConstraintOrType(type)); } function extractUnitType(type) { return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.find(type.types, isUnitType) || type : type; @@ -68396,7 +68936,7 @@ var ts; if (!isLiteralOfContextualType(type, contextualType)) { type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type)); } - return type; + return getRegularTypeOfLiteralType(type); } function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) { if (type && isUnitType(type)) { @@ -68491,7 +69031,8 @@ var ts; function getOptionalType(type, isProperty) { if (isProperty === void 0) { isProperty = false; } ts.Debug.assert(strictNullChecks); - return type.flags & 32768 /* TypeFlags.Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]); + var missingOrUndefined = isProperty ? missingType : undefinedType; + return type.flags & 32768 /* TypeFlags.Undefined */ || type.flags & 1048576 /* TypeFlags.Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); } function getGlobalNonNullableTypeInstantiation(type) { if (!deferredGlobalNonNullableTypeAlias) { @@ -68780,12 +69321,12 @@ var ts; } var diagnostic; switch (declaration.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 223 /* SyntaxKind.BinaryExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: var param = declaration; if (ts.isIdentifier(param.name) && (ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) && @@ -68801,23 +69342,23 @@ var ts; noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; if (!noImplicitAny) { // Don't issue a suggestion for binding elements since the codefix doesn't yet support them. return; } break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (noImplicitAny && !declaration.name) { if (wideningKind === 3 /* WideningKind.GeneratorYield */) { error(declaration, ts.Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); @@ -68831,7 +69372,7 @@ var ts; wideningKind === 3 /* WideningKind.GeneratorYield */ ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type : ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: if (noImplicitAny) { error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); } @@ -68948,7 +69489,7 @@ var ts; if (context.intraExpressionInferenceSites) { for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) { var _b = _a[_i], node = _b.node, type = _b.type; - var contextualType = node.kind === 169 /* SyntaxKind.MethodDeclaration */ ? + var contextualType = node.kind === 171 /* SyntaxKind.MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* ContextFlags.NoConstraints */) : getContextualType(node, 2 /* ContextFlags.NoConstraints */); if (contextualType) { @@ -69011,8 +69552,8 @@ var ts; } function isNonGenericTopLevelType(type) { if (type.aliasSymbol && !type.aliasTypeArguments) { - var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 259 /* SyntaxKind.TypeAliasDeclaration */); - return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 305 /* SyntaxKind.SourceFile */ ? true : n.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); + var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 262 /* SyntaxKind.TypeAliasDeclaration */); + return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 308 /* SyntaxKind.SourceFile */ ? true : n.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); } return false; } @@ -69232,7 +69773,7 @@ var ts; && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) })); } function isMemberOfStringMapping(source, target) { - if (target.flags & (4 /* TypeFlags.String */ | 3 /* TypeFlags.AnyOrUnknown */)) { + if (target.flags & (4 /* TypeFlags.String */ | 1 /* TypeFlags.Any */)) { return true; } if (target.flags & 134217728 /* TypeFlags.TemplateLiteral */) { @@ -69546,7 +70087,7 @@ var ts; } else if (source.flags & 33554432 /* TypeFlags.Substitution */) { inferFromTypes(source.baseType, target); - inferWithPriority(source.substitute, target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority + inferWithPriority(getSubstitutionIntersection(source), target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority } else if (target.flags & 16777216 /* TypeFlags.Conditional */) { invokeOnce(source, target, inferToConditionalType); @@ -70028,7 +70569,7 @@ var ts; var saveBivariant = bivariant; var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; // Once we descend into a bivariant signature we remain bivariant for all nested inferences - bivariant = bivariant || kind === 169 /* SyntaxKind.MethodDeclaration */ || kind === 168 /* SyntaxKind.MethodSignature */ || kind === 171 /* SyntaxKind.Constructor */; + bivariant = bivariant || kind === 171 /* SyntaxKind.MethodDeclaration */ || kind === 170 /* SyntaxKind.MethodSignature */ || kind === 173 /* SyntaxKind.Constructor */; applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes); bivariant = saveBivariant; applyToReturnTypes(source, target, inferFromTypes); @@ -70227,7 +70768,7 @@ var ts; } // falls through default: - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; } else { @@ -70248,7 +70789,7 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.6.3 // A type query consists of the keyword typeof followed by an expression. // The expression is restricted to a single identifier or a sequence of identifiers separated by periods - return !!ts.findAncestor(node, function (n) { return n.kind === 181 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 161 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); + return !!ts.findAncestor(node, function (n) { return n.kind === 183 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 163 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); } // Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers // separated by dots). The key consists of the id of the symbol referenced by the @@ -70264,26 +70805,26 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: return "0|".concat(flowContainer ? getNodeId(flowContainer) : "-1", "|").concat(getTypeId(declaredType), "|").concat(getTypeId(initialType)); - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: var left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer); return left && left + "." + node.right.escapedText; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var propName = getAccessedPropertyName(node); if (propName !== undefined) { var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && key + "." + propName; } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: // Handle pseudo-references originating in getNarrowedTypeOfSymbol. return "".concat(getNodeId(node), "#").concat(getTypeId(declaredType)); } @@ -70291,16 +70832,16 @@ var ts; } function isMatchingReference(source, target) { switch (target.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isMatchingReference(source, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isAssignmentExpression(target) && isMatchingReference(source, target.left)) || (ts.isBinaryExpression(target) && target.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source, target.right)); } switch (source.kind) { - case 231 /* SyntaxKind.MetaProperty */: - return target.kind === 231 /* SyntaxKind.MetaProperty */ + case 233 /* SyntaxKind.MetaProperty */: + return target.kind === 233 /* SyntaxKind.MetaProperty */ && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; case 79 /* SyntaxKind.Identifier */: @@ -70308,26 +70849,26 @@ var ts; return ts.isThisInTypeQuery(source) ? target.kind === 108 /* SyntaxKind.ThisKeyword */ : target.kind === 79 /* SyntaxKind.Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 254 /* SyntaxKind.VariableDeclaration */ || target.kind === 203 /* SyntaxKind.BindingElement */) && + (target.kind === 257 /* SyntaxKind.VariableDeclaration */ || target.kind === 205 /* SyntaxKind.BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 108 /* SyntaxKind.ThisKeyword */: return target.kind === 108 /* SyntaxKind.ThisKeyword */; case 106 /* SyntaxKind.SuperKeyword */: return target.kind === 106 /* SyntaxKind.SuperKeyword */; - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isMatchingReference(source.expression, target); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var sourcePropertyName = getAccessedPropertyName(source); var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined; return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return ts.isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isBinaryExpression(source) && source.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source.right, target)); } return false; @@ -70358,7 +70899,7 @@ var ts; } if (ts.isEntityNameExpression(node.argumentExpression)) { var symbol = resolveEntityName(node.argumentExpression, 111551 /* SymbolFlags.Value */, /*ignoreErrors*/ true); - if (!symbol || !isConstVariable(symbol)) + if (!symbol || !(isConstVariable(symbol) || (symbol.flags & 8 /* SymbolFlags.EnumMember */))) return undefined; var declaration = symbol.valueDeclaration; if (declaration === undefined) @@ -70370,9 +70911,14 @@ var ts; return name; } } - if (ts.hasOnlyExpressionInitializer(declaration)) { + if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) { var initializer = ts.getEffectiveInitializer(declaration); - return initializer && tryGetNameFromType(getTypeOfExpression(initializer)); + if (initializer) { + return tryGetNameFromType(getTypeOfExpression(initializer)); + } + if (ts.isEnumMember(declaration)) { + return ts.getTextOfPropertyName(declaration.name); + } } } return undefined; @@ -70499,7 +71045,7 @@ var ts; } function getMatchingUnionConstituentForObjectLiteral(unionType, node) { var keyPropertyName = getKeyPropertyName(unionType); - var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && + var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); }); var propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); return propType && getConstituentTypeForKeyType(unionType, propType); @@ -70516,7 +71062,7 @@ var ts; } } } - if (expression.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expression.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isOrContainsMatchingReference(reference, expression.expression.expression)) { return true; } @@ -70716,15 +71262,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, type, undefinedType, /*errorNode*/ undefined) || errorType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; + return parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -70741,21 +71287,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return stringType; - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkRightHandSideOfForOf(parent) || errorType; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return undefinedType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return errorType; @@ -70763,7 +71309,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ ? + var type = pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -70781,30 +71327,30 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent) || errorType; } return errorType; } function getInitialType(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function isEmptyArrayAssignment(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.initializer && + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 203 /* SyntaxKind.BindingElement */ && node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + node.kind !== 205 /* SyntaxKind.BindingElement */ && node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 75 /* SyntaxKind.BarBarEqualsToken */: @@ -70819,13 +71365,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? + return parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); } return neverType; @@ -70844,13 +71390,13 @@ var ts; // Get the type names from all cases in a switch on `typeof`. The default clause and/or duplicate type names are // represented as undefined. Return undefined if one or more case clause expressions are not string literals. function getSwitchClauseTypeOfWitnesses(switchStatement) { - if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 289 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { + if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 292 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { return undefined; } var witnesses = []; for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { var clause = _a[_i]; - var text = clause.kind === 289 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; + var text = clause.kind === 292 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; witnesses.push(text && !ts.contains(witnesses, text) ? text : undefined); } return witnesses; @@ -71037,12 +71583,12 @@ var ts; var root = getReferenceRoot(node); var parent = root.parent; var isLengthPushOrUnshift = ts.isPropertyAccessExpression(parent) && (parent.name.escapedText === "length" || - parent.parent.kind === 208 /* SyntaxKind.CallExpression */ + parent.parent.kind === 210 /* SyntaxKind.CallExpression */ && ts.isIdentifier(parent.name) && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + var isElementAssignment = parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -71055,6 +71601,7 @@ var ts; ts.isInJSFile(node) && ts.hasInitializer(node) && node.initializer && ts.isFunctionExpressionOrArrowFunction(node.initializer) && ts.getEffectiveReturnTypeNode(node.initializer)); } function getExplicitTypeOfSymbol(symbol, diagnostic) { + symbol = resolveSymbol(symbol); if (symbol.flags & (16 /* SymbolFlags.Function */ | 8192 /* SymbolFlags.Method */ | 32 /* SymbolFlags.Class */ | 512 /* SymbolFlags.ValueModule */)) { return getTypeOfSymbol(symbol); } @@ -71070,7 +71617,7 @@ var ts; if (isDeclarationWithExplicitTypeAnnotation(declaration)) { return getTypeOfSymbol(symbol); } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var statement = declaration.parent.parent; var expressionType = getTypeOfDottedName(statement.expression, /*diagnostic*/ undefined); if (expressionType) { @@ -71093,12 +71640,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: var symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node)); - return getExplicitTypeOfSymbol(symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol, diagnostic); + return getExplicitTypeOfSymbol(symbol, diagnostic); case 108 /* SyntaxKind.ThisKeyword */: return getExplicitThisType(node); case 106 /* SyntaxKind.SuperKeyword */: return checkSuperExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var type = getTypeOfDottedName(node.expression, diagnostic); if (type) { var name = node.name; @@ -71116,7 +71663,7 @@ var ts; } return undefined; } - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getTypeOfDottedName(node.expression, diagnostic); } } @@ -71130,7 +71677,7 @@ var ts; // circularities in control flow analysis, we use getTypeOfDottedName when resolving the call // target expression of an assertion. var funcType = void 0; - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { funcType = getTypeOfDottedName(node.expression, /*diagnostic*/ undefined); } else if (node.expression.kind !== 106 /* SyntaxKind.SuperKeyword */) { @@ -71174,7 +71721,7 @@ var ts; } function isFalseExpression(expr) { var node = ts.skipParentheses(expr, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || + return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ && isFalseExpression(node.left) && isFalseExpression(node.right)); } function isReachableFlowNodeWorker(flow, noCacheCheck) { @@ -71295,8 +71842,8 @@ var ts; var symbol = getResolvedSymbol(node); return isConstVariable(symbol) || ts.isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // The resolvedSymbol property is initialized by checkPropertyAccess or checkElementAccess before we get here. return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol); } @@ -71323,7 +71870,7 @@ var ts; // on empty arrays are possible without implicit any errors and new element types can be inferred without // type mismatch errors. var resultType = ts.getObjectFlags(evolvedType) & 256 /* ObjectFlags.EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 230 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 232 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { return declaredType; } // The non-null unknown type should never escape control flow analysis. @@ -71408,8 +71955,8 @@ var ts; // Check if we should continue with the control flow of the containing function. var container = flow.node; if (container && container !== flowContainer && - reference.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && - reference.kind !== 207 /* SyntaxKind.ElementAccessExpression */ && + reference.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && + reference.kind !== 209 /* SyntaxKind.ElementAccessExpression */ && reference.kind !== 108 /* SyntaxKind.ThisKeyword */) { flow = container.flowNode; continue; @@ -71434,7 +71981,7 @@ var ts; } function getInitialOrAssignedType(flow) { var node = flow.node; - return getNarrowableTypeForReference(node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */ ? + return getNarrowableTypeForReference(node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */ ? getInitialType(node) : getAssignedType(node), reference); } @@ -71474,14 +72021,14 @@ var ts; // in which case we continue control flow analysis back to the function's declaration if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) { var init = ts.getDeclaredExpandoInitializer(node); - if (init && (init.kind === 213 /* SyntaxKind.FunctionExpression */ || init.kind === 214 /* SyntaxKind.ArrowFunction */)) { + if (init && (init.kind === 215 /* SyntaxKind.FunctionExpression */ || init.kind === 216 /* SyntaxKind.ArrowFunction */)) { return getTypeAtFlowNode(flow.antecedent); } } return declaredType; } // for (const _ in ref) acts as a nonnull on ref - if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { + if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)))); } // Assignment doesn't affect reference @@ -71492,7 +72039,7 @@ var ts; if (node.kind === 95 /* SyntaxKind.FalseKeyword */) { return unreachableNeverType; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { if (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */) { return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right); } @@ -71523,7 +72070,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 208 /* SyntaxKind.CallExpression */ ? + var expr = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -71531,7 +72078,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256 /* ObjectFlags.EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -71579,15 +72126,15 @@ var ts; if (isMatchingReference(reference, expr)) { type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { - type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { + type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } else { if (strictNullChecks) { if (optionalChainContainsReference(expr, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & (32768 /* TypeFlags.Undefined */ | 131072 /* TypeFlags.Never */)); }); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & 131072 /* TypeFlags.Never */ || t.flags & 128 /* TypeFlags.StringLiteral */ && t.value === "undefined"); }); } } @@ -71815,7 +72362,7 @@ var ts; var narrowedPropType = narrowType(propType); return filterType(type, function (t) { var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName); - return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); + return !(discriminantType.flags & 131072 /* TypeFlags.Never */) && !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); }); } function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { @@ -71857,18 +72404,26 @@ var ts; } function isTypePresencePossible(type, propName, assumeTrue) { var prop = getPropertyOfType(type, propName); - if (prop) { - return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue; - } - return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue; - } - function narrowByInKeyword(type, name, assumeTrue) { - if (type.flags & 1048576 /* TypeFlags.Union */ - || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type)) - || ts.isThisTypeParameter(type) - || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) { + return prop ? + !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue : + !!getApplicableIndexInfoForName(type, propName) || !assumeTrue; + } + function narrowTypeByInKeyword(type, nameType, assumeTrue) { + var name = getPropertyNameFromType(nameType); + var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); }); + if (isKnownProperty) { + // If the check is for a known property (i.e. a property declared in some constituent of + // the target type), we filter the target type by presence of absence of the property. return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); }); } + if (assumeTrue) { + // If the check is for an unknown property, we intersect the target type with `Record`, + // where X is the name of the property. + var recordSymbol = getGlobalRecordSymbol(); + if (recordSymbol) { + return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]); + } + } return type; } function narrowTypeByBinaryExpression(type, expr, assumeTrue) { @@ -71885,10 +72440,10 @@ var ts; var operator = expr.operatorToken.kind; var left = getReferenceCandidate(expr.left); var right = getReferenceCandidate(expr.right); - if (left.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { + if (left.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { return narrowTypeByTypeof(type, left, operator, right, assumeTrue); } - if (right.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { + if (right.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { return narrowTypeByTypeof(type, right, operator, left, assumeTrue); } if (isMatchingReference(reference, left)) { @@ -71927,15 +72482,14 @@ var ts; return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue); } var target = getReferenceCandidate(expr.right); - var leftType = getTypeOfNode(expr.left); - if (leftType.flags & 128 /* TypeFlags.StringLiteral */) { - var name = ts.escapeLeadingUnderscores(leftType.value); + var leftType = getTypeOfExpression(expr.left); + if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) { if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) && - getAccessedPropertyName(reference) === name) { + getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) { return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */); } if (isMatchingReference(reference, target)) { - return narrowByInKeyword(type, name, assumeTrue); + return narrowTypeByInKeyword(type, leftType, assumeTrue); } } break; @@ -71997,24 +72551,11 @@ var ts; assumeTrue = !assumeTrue; } var valueType = getTypeOfExpression(value); - if (((type.flags & 2 /* TypeFlags.Unknown */) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304 /* TypeFlags.Nullable */)) && - assumeTrue && - (operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) { - if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) { - return valueType; - } - if (valueType.flags & 524288 /* TypeFlags.Object */) { - return nonPrimitiveType; - } - if (type.flags & 2 /* TypeFlags.Unknown */) { - return type; - } - } + var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; if (valueType.flags & 98304 /* TypeFlags.Nullable */) { if (!strictNullChecks) { return type; } - var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; var facts = doubleEquals ? assumeTrue ? 262144 /* TypeFacts.EQUndefinedOrNull */ : 2097152 /* TypeFacts.NEUndefinedOrNull */ : valueType.flags & 65536 /* TypeFlags.Null */ ? @@ -72023,10 +72564,16 @@ var ts; return getAdjustedTypeWithFacts(type, facts); } if (assumeTrue) { - var filterFn = operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? - function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); } : - function (t) { return areTypesComparable(t, valueType); }; - return replacePrimitivesWithLiterals(filterType(type, filterFn), valueType); + if (!doubleEquals && (type.flags & 2 /* TypeFlags.Unknown */ || someType(type, isEmptyAnonymousObjectType))) { + if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) { + return valueType; + } + if (valueType.flags & 524288 /* TypeFlags.Object */) { + return nonPrimitiveType; + } + } + var filteredType = filterType(type, function (t) { return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); }); + return replacePrimitivesWithLiterals(filteredType, valueType); } if (isUnitType(valueType)) { return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); }); @@ -72040,11 +72587,18 @@ var ts; } var target = getReferenceCandidate(typeOfExpr.expression); if (!isMatchingReference(reference, target)) { + var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type); + if (propertyAccess) { + return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); }); + } if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) { return getAdjustedTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */); } return type; } + return narrowTypeByLiteralExpression(type, literal, assumeTrue); + } + function narrowTypeByLiteralExpression(type, literal, assumeTrue) { return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeFacts.TypeofNEHostObject */); @@ -72124,13 +72678,13 @@ var ts; neverType; }); } - function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) { + function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) { var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement); if (!witnesses) { return type; } // Equal start and end denotes implicit fallthrough; undefined marks explicit default clause. - var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 290 /* SyntaxKind.DefaultClause */; }); + var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 293 /* SyntaxKind.DefaultClause */; }); var hasDefaultClause = clauseStart === clauseEnd || (defaultIndex >= clauseStart && defaultIndex < clauseEnd); if (hasDefaultClause) { // In the default clause we filter constituents down to those that are not-equal to all handled cases. @@ -72334,17 +72888,17 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return narrowTypeByCallExpression(type, expr, assumeTrue); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return narrowType(type, expr.expression, assumeTrue); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (expr.operator === 53 /* SyntaxKind.ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -72393,9 +72947,9 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 262 /* SyntaxKind.ModuleBlock */ || - node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 265 /* SyntaxKind.ModuleBlock */ || + node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; }); } // Check if a parameter or catch variable is assigned anywhere @@ -72438,7 +72992,7 @@ var ts; function removeOptionalityFromDeclaredType(declaredType, declaration) { if (pushTypeResolution(declaration.symbol, 2 /* TypeSystemPropertyName.DeclaredType */)) { var annotationIncludesUndefined = strictNullChecks && - declaration.kind === 164 /* SyntaxKind.Parameter */ && + declaration.kind === 166 /* SyntaxKind.Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* TypeFacts.IsUndefined */ && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* TypeFacts.IsUndefined */); @@ -72455,10 +73009,10 @@ var ts; // In an element access obj[x], we consider obj to be in a constraint position, except when obj is of // a generic type without a nullable constraint and x is a generic type. This is because when both obj // and x are of generic types T and K, we want the resulting type to be T[K]. - return parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 161 /* SyntaxKind.QualifiedName */ || - parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === node || - parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && + return parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 163 /* SyntaxKind.QualifiedName */ || + parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === node || + parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression))); } function isGenericTypeWithUnionConstraint(type) { @@ -72512,15 +73066,15 @@ var ts; }); } function markAliasReferenced(symbol, location) { - if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) { var target = resolveAlias(symbol); - if (target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(target) & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */)) { // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled // (because the const enum value will not be inlined), or if (2) the alias is an export // of a const enum declaration that will be preserved. if (compilerOptions.isolatedModules || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) || - !isConstEnumOrConstEnumOnlyModule(target)) { + !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) { markAliasSymbolAsReferenced(symbol); } else { @@ -72557,15 +73111,16 @@ var ts; // destructuring from the narrowed parent type. if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) { var parent = declaration.parent.parent; - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 166 /* SyntaxKind.Parameter */) { var links = getNodeLinks(parent); if (!(links.flags & 268435456 /* NodeCheckFlags.InCheckIdentifier */)) { links.flags |= 268435456 /* NodeCheckFlags.InCheckIdentifier */; var parentType = getTypeForBindingElementParent(parent, 0 /* CheckMode.Normal */); + var parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~268435456 /* NodeCheckFlags.InCheckIdentifier */; - if (parentType && parentType.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 164 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { + if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 166 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { var pattern = declaration.parent; - var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, /*flowContainer*/ undefined, location.flowNode); + var narrowedType = getFlowTypeOfReference(pattern, parentTypeConstraint, parentTypeConstraint, /*flowContainer*/ undefined, location.flowNode); if (narrowedType.flags & 131072 /* TypeFlags.Never */) { return neverType; } @@ -72632,10 +73187,10 @@ var ts; } var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ScriptTarget.ES2015 */) { - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } - else if (ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + else if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } @@ -72655,7 +73210,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -72667,12 +73222,12 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (declaration.kind === 228 /* SyntaxKind.ClassExpression */) { // When we emit a class expression with static members that contain a reference // to the constructor in the initializer, we will need to substitute that // binding with an alias as the class name is not in scope. var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); - while (container.kind !== 305 /* SyntaxKind.SourceFile */) { + while (container.kind !== 308 /* SyntaxKind.SourceFile */) { if (container.parent === declaration) { if (ts.isPropertyDeclaration(container) && ts.isStatic(container) || ts.isClassStaticBlockDeclaration(container)) { getNodeLinks(declaration).flags |= 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; @@ -72730,7 +73285,7 @@ var ts; // The declaration container is the innermost function that encloses the declaration of the variable // or parameter. The flow container is the innermost function starting with which we analyze the control // flow graph to determine the control flow based type. - var isParameter = ts.getRootDeclaration(declaration).kind === 164 /* SyntaxKind.Parameter */; + var isParameter = ts.getRootDeclaration(declaration).kind === 166 /* SyntaxKind.Parameter */; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; @@ -72739,19 +73294,19 @@ var ts; // When the control flow originates in a function expression or arrow function and we are referencing // a const variable or parameter from an outer function, we extend the origin of the control flow // analysis to include the immediately enclosing function. - while (flowContainer !== declarationContainer && (flowContainer.kind === 213 /* SyntaxKind.FunctionExpression */ || - flowContainer.kind === 214 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* SyntaxKind.FunctionExpression */ || + flowContainer.kind === 216 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } // We only look for uninitialized variables in strict null checking mode, and only when we can analyze // the entire control flow graph from the variable's declaration (i.e. when the flow container and // declaration container are the same). - var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) || + var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* TypeFlags.AnyOrUnknown */ | 16384 /* TypeFlags.Void */)) !== 0 || - isInTypeQuery(node) || node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) || - node.parent.kind === 230 /* SyntaxKind.NonNullExpression */ || - declaration.kind === 254 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) || + node.parent.kind === 232 /* SyntaxKind.NonNullExpression */ || + declaration.kind === 257 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* NodeFlags.Ambient */; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -72776,6 +73331,12 @@ var ts; } return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } + function isSameScopedBindingElement(node, declaration) { + if (ts.isBindingElement(declaration)) { + var bindingElement = ts.findAncestor(node, ts.isBindingElement); + return bindingElement && ts.getRootDeclaration(bindingElement) === ts.getRootDeclaration(declaration); + } + } function shouldMarkIdentifierAliasReferenced(node) { var _a; var parent = node.parent; @@ -72809,7 +73370,7 @@ var ts; (symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 32 /* SymbolFlags.Class */)) === 0 || !symbol.valueDeclaration || ts.isSourceFile(symbol.valueDeclaration) || - symbol.valueDeclaration.parent.kind === 292 /* SyntaxKind.CatchClause */) { + symbol.valueDeclaration.parent.kind === 295 /* SyntaxKind.CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -72824,7 +73385,7 @@ var ts; // mark iteration statement as containing block-scoped binding captured in some function var capturesBlockScopeBindingInLoopBody = true; if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container) { var part = getPartOfForStatementContainingNode(node.parent, container); if (part) { @@ -72845,7 +73406,7 @@ var ts; // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 4194304 /* NodeCheckFlags.NeedsLoopOutParameter */; } @@ -72864,7 +73425,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { // skip parenthesized nodes var current = node; - while (current.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (current.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -72872,7 +73433,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */)) { + else if ((current.parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; } @@ -72885,7 +73446,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* NodeCheckFlags.LexicalThis */; - if (container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || container.kind === 173 /* SyntaxKind.Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* NodeCheckFlags.CaptureThis */; } @@ -72932,31 +73493,31 @@ var ts; // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var capturedByArrowFunction = false; - if (container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); capturedByArrowFunction = true; } checkThisInStaticClassFieldInitializerInDecoratedClass(node, container); switch (container.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -73044,7 +73605,7 @@ var ts; } function getClassNameFromPrototypeMethod(container) { // Check if it's the RHS of a x.prototype.y = function [name]() { .... } - if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isBinaryExpression(container.parent) && ts.getAssignmentDeclarationKind(container.parent) === 3 /* AssignmentDeclarationKind.PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = container' @@ -73054,16 +73615,16 @@ var ts; .expression; // x } // x.prototype = { method() { } } - else if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && - container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && + container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.left.expression; } // x.prototype = { method: function() { } } - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && - container.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && - container.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && + container.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && + container.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.parent.left.expression; @@ -73071,7 +73632,7 @@ var ts; // Object.defineProperty(x, "method", { value: function() { } }); // Object.defineProperty(x, "method", { set: (x: () => void) => void }); // Object.defineProperty(x, "method", { get: () => function() { }) }); - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isPropertyAssignment(container.parent) && ts.isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && @@ -73096,7 +73657,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 317 /* SyntaxKind.JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 320 /* SyntaxKind.JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -73110,19 +73671,24 @@ var ts; } } function isInConstructorArgumentInitializer(node, constructorDecl) { - return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 164 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); + return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 166 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 208 /* SyntaxKind.CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 210 /* SyntaxKind.CallExpression */ && node.parent.expression === node; var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var container = immediateContainer; var needToCaptureLexicalThis = false; + var inAsyncFunction = false; // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - while (container && container.kind === 214 /* SyntaxKind.ArrowFunction */) { + while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) { + if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) + inAsyncFunction = true; container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */; } + if (container && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) + inAsyncFunction = true; } var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; @@ -73132,14 +73698,14 @@ var ts; // class B { // [super.foo()]() {} // } - var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 162 /* SyntaxKind.ComputedPropertyName */; }); - if (current && current.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 164 /* SyntaxKind.ComputedPropertyName */; }); + if (current && current.kind === 164 /* SyntaxKind.ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -73147,7 +73713,7 @@ var ts; } return errorType; } - if (!isCallExpression && immediateContainer.kind === 171 /* SyntaxKind.Constructor */) { + if (!isCallExpression && immediateContainer.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if (ts.isStatic(container) || isCallExpression) { @@ -73228,12 +73794,12 @@ var ts; // as a call expression cannot be used as the target of a destructuring assignment while a property access can. // // For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations. - if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && inAsyncFunction) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { - getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */; + getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */; } else { - getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.AsyncMethodWithSuper */; + getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */; } } if (needToCaptureLexicalThis) { @@ -73242,7 +73808,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return errorType; @@ -73263,7 +73829,7 @@ var ts; if (!baseClassType) { return errorType; } - if (container.kind === 171 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 173 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return errorType; @@ -73278,7 +73844,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 173 /* SyntaxKind.Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -73286,23 +73852,23 @@ var ts; // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor // topmost container must be something that is directly nested in the class declaration\object literal expression - if (ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (ts.isStatic(container)) { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } else { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 166 /* SyntaxKind.PropertySignature */ || - container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 168 /* SyntaxKind.PropertySignature */ || + container.kind === 173 /* SyntaxKind.Constructor */; } } } @@ -73310,10 +73876,10 @@ var ts; } } function getContainingObjectLiteral(func) { - return (func.kind === 169 /* SyntaxKind.MethodDeclaration */ || - func.kind === 172 /* SyntaxKind.GetAccessor */ || - func.kind === 173 /* SyntaxKind.SetAccessor */) && func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : - func.kind === 213 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : + return (func.kind === 171 /* SyntaxKind.MethodDeclaration */ || + func.kind === 174 /* SyntaxKind.GetAccessor */ || + func.kind === 175 /* SyntaxKind.SetAccessor */) && func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : + func.kind === 215 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -73325,7 +73891,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -73352,7 +73918,7 @@ var ts; if (thisType) { return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); } - if (literal.parent.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (literal.parent.kind !== 299 /* SyntaxKind.PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -73366,7 +73932,7 @@ var ts; // In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the // contextual type for 'this' is 'obj'. var parent = ts.walkUpParenthesizedExpressions(func.parent); - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { var target = parent.left; if (ts.isAccessExpression(target)) { var expression = target.expression; @@ -73419,11 +73985,11 @@ var ts; return getTypeFromTypeNode(typeNode); } switch (declaration.kind) { - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return getContextuallyTypedParameterType(declaration); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForBindingElement(declaration, contextFlags); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isStatic(declaration)) { return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags); } @@ -73434,10 +74000,10 @@ var ts; var parent = declaration.parent.parent; var name = declaration.propertyName || declaration.name; var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || - parent.kind !== 203 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); + parent.kind !== 205 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name)) return undefined; - if (parent.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (parent.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { var index = ts.indexOfNode(declaration.parent.elements, declaration); if (index < 0) return undefined; @@ -73594,7 +74160,7 @@ var ts; getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (template.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -73713,9 +74279,11 @@ var ts; case 1 /* AssignmentDeclarationKind.ExportsProperty */: case 6 /* AssignmentDeclarationKind.Prototype */: case 3 /* AssignmentDeclarationKind.PrototypeProperty */: - var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; - // falls through case 2 /* AssignmentDeclarationKind.ModuleExports */: + var valueDeclaration = void 0; + if (kind !== 2 /* AssignmentDeclarationKind.ModuleExports */) { + valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; + } valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration); var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration); return annotated ? getTypeFromTypeNode(annotated) : undefined; @@ -73892,21 +74460,21 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 79 /* SyntaxKind.Identifier */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isPossiblyDiscriminantValue(node.expression); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !node.expression || isPossiblyDiscriminantValue(node.expression); } return false; } function discriminateContextualTypeByObjectMembers(node, contextualType) { - return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } function discriminateContextualTypeByJSXAttributes(node, contextualType) { - return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 285 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 288 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. @@ -73927,9 +74495,10 @@ var ts; function instantiateContextualType(contextualType, node, contextFlags) { if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* TypeFlags.Instantiable */)) { var inferenceContext = getInferenceContext(node); - // If no inferences have been made, nothing is gained from instantiating as type parameters - // would just be replaced with their defaults similar to the apparent type. - if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidates)) { + // If no inferences have been made, and none of the type parameters for which we are inferring + // specify default types, nothing is gained from instantiating as type parameters would just be + // replaced with their constraints similar to the apparent type. + if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) { // For contextual signatures we incorporate all inferences made so far, e.g. from return // types as well as arguments to the left in a function call. return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper); @@ -73989,60 +74558,62 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForInitializerExpression(node, contextFlags); - case 214 /* SyntaxKind.ArrowFunction */: - case 247 /* SyntaxKind.ReturnStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 250 /* SyntaxKind.ReturnStatement */: return getContextualTypeForReturnExpression(node, contextFlags); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return getContextualTypeForYieldOperand(parent, contextFlags); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return getContextualTypeForAwaitOperand(parent, contextFlags); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return getContextualTypeForArgument(parent, node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return ts.isConstTypeReference(parent.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(parent.type); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getContextualTypeForBinaryOperand(node, contextFlags); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent, contextFlags); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return getContextualType(parent.parent, contextFlags); - case 204 /* SyntaxKind.ArrayLiteralExpression */: { + case 206 /* SyntaxKind.ArrayLiteralExpression */: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return getContextualTypeForConditionalOperand(node, contextFlags); - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 223 /* SyntaxKind.TemplateExpression */); + case 236 /* SyntaxKind.TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 225 /* SyntaxKind.TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { // Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast. var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return !tag ? getContextualType(parent, contextFlags) : ts.isJSDocTypeTag(tag) && ts.isConstTypeReference(tag.typeExpression.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(tag.typeExpression.type); } - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return getContextualType(parent, contextFlags); - case 271 /* SyntaxKind.ExportAssignment */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return getTypeFromTypeNode(parent.type); + case 274 /* SyntaxKind.ExportAssignment */: return tryGetTypeFromEffectiveTypeNode(parent); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return getContextualTypeForJsxExpression(parent, contextFlags); - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent, contextFlags); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getContextualJsxElementAttributesType(parent, contextFlags); } return undefined; @@ -74168,9 +74739,16 @@ var ts; if (!isErrorType(intrinsicClassAttribs)) { var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); var hostClassType = getReturnTypeOfSignature(sig); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context))) - : intrinsicClassAttribs, apparentAttributesType); + var libraryManagedAttributeType = void 0; + if (typeParams) { + // apply JSX.IntrinsicClassElements + var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context)); + libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs)); + } + // or JSX.IntrinsicClassElements has no generics. + else + libraryManagedAttributeType = intrinsicClassAttribs; + apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType); } var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (!isErrorType(intrinsicAttribs)) { @@ -74293,7 +74871,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var typeTagSignature = getSignatureOfTypeTag(node); if (typeTagSignature) { return typeTagSignature; @@ -74341,8 +74919,8 @@ var ts; return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type; } function hasDefaultValue(node) { - return (node.kind === 203 /* SyntaxKind.BindingElement */ && !!node.initializer) || - (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); + return (node.kind === 205 /* SyntaxKind.BindingElement */ && !!node.initializer) || + (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); } function checkArrayLiteral(node, checkMode, forceTuple) { var elements = node.elements; @@ -74355,7 +74933,7 @@ var ts; var hasOmittedExpression = false; for (var i = 0; i < elementCount; i++) { var e = elements[i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 /* ExternalEmitHelpers.SpreadIncludes */ : 1024 /* ExternalEmitHelpers.SpreadArray */); } @@ -74388,7 +74966,7 @@ var ts; elementFlags.push(4 /* ElementFlags.Rest */); } } - else if (exactOptionalPropertyTypes && e.kind === 227 /* SyntaxKind.OmittedExpression */) { + else if (exactOptionalPropertyTypes && e.kind === 229 /* SyntaxKind.OmittedExpression */) { hasOmittedExpression = true; elementTypes.push(missingType); elementFlags.push(2 /* ElementFlags.Optional */); @@ -74428,7 +75006,7 @@ var ts; } function isNumericName(name) { switch (name.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return isNumericComputedName(name); case 79 /* SyntaxKind.Identifier */: return ts.isNumericLiteralName(name.escapedText); @@ -74449,7 +75027,7 @@ var ts; if (!links.resolvedType) { if ((ts.isTypeLiteralNode(node.parent.parent) || ts.isClassLike(node.parent.parent) || ts.isInterfaceDeclaration(node.parent.parent)) && ts.isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ - && node.parent.kind !== 172 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 173 /* SyntaxKind.SetAccessor */) { + && node.parent.kind !== 174 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 175 /* SyntaxKind.SetAccessor */) { return links.resolvedType = errorType; } links.resolvedType = checkExpression(node.expression); @@ -74522,7 +75100,7 @@ var ts; var spread = emptyObjectType; var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 205 /* SyntaxKind.ObjectLiteralExpression */); + (contextualType.pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 207 /* SyntaxKind.ObjectLiteralExpression */); var inConstContext = isConstContext(node); var checkFlags = inConstContext ? 8 /* CheckFlags.Readonly */ : 0; var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node); @@ -74546,16 +75124,16 @@ var ts; for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var memberDecl = _c[_b]; var member = getSymbolOfNode(memberDecl); - var computedNameType = memberDecl.name && memberDecl.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? + var computedNameType = memberDecl.name && memberDecl.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : undefined; - if (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ || + if (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { - var type = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : + var type = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`. // we don't want to say "could not find 'a'". - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode); if (isInJavascript) { var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); @@ -74578,8 +75156,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* SymbolFlags.Optional */; } @@ -74605,14 +75183,14 @@ var ts; member = prop; allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop); if (contextualType && checkMode && checkMode & 2 /* CheckMode.Inferential */ && !(checkMode & 4 /* CheckMode.SkipContextSensitive */) && - (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 169 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { + (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 171 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { var inferenceContext = getInferenceContext(node); ts.Debug.assert(inferenceContext); // In CheckMode.Inferential we should always have an inference context - var inferenceNode = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; + var inferenceNode = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type); } } - else if (memberDecl.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (memberDecl.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* ExternalEmitHelpers.Assign */); } @@ -74648,7 +75226,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 172 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 173 /* SyntaxKind.SetAccessor */); + ts.Debug.assert(memberDecl.kind === 174 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 175 /* SyntaxKind.SetAccessor */); checkNodeDeferred(memberDecl); } if (computedNameType && !(computedNameType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */)) { @@ -74675,16 +75253,30 @@ var ts; // If object literal is contextually typed by the implied type of a binding pattern, augment the result // type with those properties for which the binding pattern specifies a default value. // If the object literal is spread into another object literal, skip this step and let the top-level object - // literal handle it instead. - if (contextualTypeHasPattern && node.parent.kind !== 298 /* SyntaxKind.SpreadAssignment */) { - for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { - var prop = _e[_d]; - if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { - if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { - error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + // literal handle it instead. Note that this might require full traversal to the root pattern's parent + // as it's the guaranteed to be the common ancestor of the pattern node and the current object node. + // It's not possible to check if the immediate parent node is a spread assignment + // since the type flows in non-obvious ways through conditional expressions, IIFEs and more. + if (contextualTypeHasPattern) { + var rootPatternParent_1 = ts.findAncestor(contextualType.pattern.parent, function (n) { + return n.kind === 257 /* SyntaxKind.VariableDeclaration */ || + n.kind === 223 /* SyntaxKind.BinaryExpression */ || + n.kind === 166 /* SyntaxKind.Parameter */; + }); + var spreadOrOutsideRootObject = ts.findAncestor(node, function (n) { + return n === rootPatternParent_1 || + n.kind === 301 /* SyntaxKind.SpreadAssignment */; + }); + if (spreadOrOutsideRootObject.kind !== 301 /* SyntaxKind.SpreadAssignment */) { + for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { + var prop = _e[_d]; + if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { + if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable.set(prop.escapedName, prop); + propertiesArray.push(prop); } - propertiesTable.set(prop.escapedName, prop); - propertiesArray.push(prop); } } } @@ -74792,6 +75384,7 @@ var ts; */ function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) { var attributes = openingLikeElement.attributes; + var attributesType = getContextualType(attributes, 0 /* ContextFlags.None */); var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined; var attributesTable = ts.createSymbolTable(); var spread = emptyJsxObjectType; @@ -74819,9 +75412,15 @@ var ts; if (attributeDecl.name.escapedText === jsxChildrenPropertyName) { explicitlySpecifyChildrenAttribute = true; } + if (attributesType) { + var prop = getPropertyOfType(attributesType, member.escapedName); + if (prop && prop.declarations && isDeprecatedSymbol(prop)) { + addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText); + } + } } else { - ts.Debug.assert(attributeDecl.kind === 287 /* SyntaxKind.JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 290 /* SyntaxKind.JsxSpreadAttribute */); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false); attributesTable = ts.createSymbolTable(); @@ -74848,7 +75447,7 @@ var ts; } } // Handle children attribute - var parent = openingLikeElement.parent.kind === 278 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 281 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; // We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { var childrenTypes = checkJsxChildren(parent, checkMode); @@ -74905,7 +75504,7 @@ var ts; childrenTypes.push(stringType); } } - else if (child.kind === 288 /* SyntaxKind.JsxExpression */ && !child.expression) { + else if (child.kind === 291 /* SyntaxKind.JsxExpression */ && !child.expression) { continue; // empty jsx expressions don't *really* count as present children } else { @@ -75337,9 +75936,9 @@ var ts; function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError) { if (reportError === void 0) { reportError = true; } var errorNode = !reportError ? undefined : - node.kind === 161 /* SyntaxKind.QualifiedName */ ? node.right : - node.kind === 200 /* SyntaxKind.ImportType */ ? node : - node.kind === 203 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; + node.kind === 163 /* SyntaxKind.QualifiedName */ ? node.right : + node.kind === 202 /* SyntaxKind.ImportType */ ? node : + node.kind === 205 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode); } /** @@ -75370,7 +75969,7 @@ var ts; return false; } } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { // A method cannot be accessed in a super property access if the method is abstract. // This error could mask a private property access error. But, a member // cannot simultaneously be private and abstract, so this will trigger an @@ -75382,7 +75981,7 @@ var ts; } } // Referencing abstract properties within their own constructors is not allowed - if ((flags & 128 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && + if ((flags & 256 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && (ts.isThisProperty(location) || ts.isThisInitializedObjectBindingExpression(location) || ts.isObjectBindingPattern(location.parent) && ts.isThisInitializedDeclaration(location.parent.parent))) { var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) { @@ -75476,10 +76075,27 @@ var ts; return isNullableType(type) ? getNonNullableType(type) : type; } function reportObjectPossiblyNullOrUndefinedError(node, facts) { - error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); + var nodeText = ts.isEntityNameExpression(node) ? ts.entityNameToString(node) : undefined; + if (node.kind === 104 /* SyntaxKind.NullKeyword */) { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "null"); + return; + } + if (nodeText !== undefined && nodeText.length < 100) { + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "undefined"); + return; + } + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics._0_is_possibly_null_or_undefined : + ts.Diagnostics._0_is_possibly_undefined : + ts.Diagnostics._0_is_possibly_null, nodeText); + } + else { + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } } function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) { error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? @@ -75489,6 +76105,13 @@ var ts; } function checkNonNullTypeWithReporter(type, node, reportError) { if (strictNullChecks && type.flags & 2 /* TypeFlags.Unknown */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_of_type_unknown, nodeText); + return errorType; + } + } error(node, ts.Diagnostics.Object_is_of_type_unknown); return errorType; } @@ -75506,6 +76129,17 @@ var ts; function checkNonNullNonVoidType(type, node) { var nonNullType = checkNonNullType(type, node); if (nonNullType.flags & 16384 /* TypeFlags.Void */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, nodeText); + return nonNullType; + } + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_possibly_undefined, nodeText); + return nonNullType; + } + } error(node, ts.Diagnostics.Object_is_possibly_undefined); } return nonNullType; @@ -75524,7 +76158,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, leftType, node.right, checkMode); } function isMethodAccessForCall(node) { - while (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.parent; } return ts.isCallOrNewExpression(node.parent) && node.parent.expression === node; @@ -75664,7 +76298,7 @@ var ts; } return isErrorType(apparentType) ? errorType : apparentType; } - prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 161 /* SyntaxKind.QualifiedName */); + prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 163 /* SyntaxKind.QualifiedName */); } // In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums. // `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined @@ -75674,7 +76308,7 @@ var ts; // 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and // 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`. if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules || - !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 299 /* SyntaxKind.EnumMember */)) || + !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 302 /* SyntaxKind.EnumMember */)) || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { markAliasReferenced(parentSymbol, node); } @@ -75776,7 +76410,7 @@ var ts; if (declaration && isPropertyWithoutInitializer(declaration)) { if (!ts.isStatic(declaration)) { var flowContainer = getControlFlowContainer(node); - if (flowContainer.kind === 171 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { + if (flowContainer.kind === 173 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { assumeUninitialized = true; } } @@ -75811,8 +76445,8 @@ var ts; && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) { diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName); } - else if (valueDeclaration.kind === 257 /* SyntaxKind.ClassDeclaration */ && - node.parent.kind !== 178 /* SyntaxKind.TypeReference */ && + else if (valueDeclaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && + node.parent.kind !== 180 /* SyntaxKind.TypeReference */ && !(valueDeclaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName); @@ -75824,25 +76458,25 @@ var ts; function isInPropertyInitializerOrClassStaticBlock(node) { return !!ts.findAncestor(node, function (node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 298 /* SyntaxKind.SpreadAssignment */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 233 /* SyntaxKind.TemplateSpan */: - case 288 /* SyntaxKind.JsxExpression */: - case 285 /* SyntaxKind.JsxAttribute */: - case 286 /* SyntaxKind.JsxAttributes */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 291 /* SyntaxKind.HeritageClause */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 301 /* SyntaxKind.SpreadAssignment */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 236 /* SyntaxKind.TemplateSpan */: + case 291 /* SyntaxKind.JsxExpression */: + case 288 /* SyntaxKind.JsxAttribute */: + case 289 /* SyntaxKind.JsxAttributes */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 294 /* SyntaxKind.HeritageClause */: return false; - case 214 /* SyntaxKind.ArrowFunction */: - case 238 /* SyntaxKind.ExpressionStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.isBlock(node.parent) && ts.isClassStaticBlockDeclaration(node.parent.parent) ? true : "quit"; default: return ts.isExpressionNode(node) ? false : "quit"; @@ -76037,7 +76671,6 @@ var ts; } return false; } - ; var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get"; if (!hasProp(suggestedMethod)) { return undefined; @@ -76117,11 +76750,11 @@ var ts; } function isValidPropertyAccess(node, propertyName) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return isValidPropertyAccessWithType(node, node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression))); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getWidenedType(checkExpression(node.left))); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getTypeFromTypeNode(node)); } } @@ -76136,7 +76769,7 @@ var ts; * @param property the accessed property's symbol. */ function isValidPropertyAccessForCompletions(node, type, property) { - return isPropertyAccessible(node, node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, + return isPropertyAccessible(node, node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, /* isWrite */ false, type, property); // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context. } @@ -76176,7 +76809,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -76205,7 +76838,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 243 /* SyntaxKind.ForInStatement */ && + if (node.kind === 246 /* SyntaxKind.ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -76254,13 +76887,13 @@ var ts; // This gets us diagnostics for the type arguments and marks them as referenced. ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { checkExpression(node.template); } else if (ts.isJsxOpeningLikeElement(node)) { checkExpression(node.attributes); } - else if (node.kind !== 165 /* SyntaxKind.Decorator */) { + else if (node.kind !== 167 /* SyntaxKind.Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -76324,7 +76957,7 @@ var ts; } } function isSpreadArgument(arg) { - return !!arg && (arg.kind === 225 /* SyntaxKind.SpreadElement */ || arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); + return !!arg && (arg.kind === 227 /* SyntaxKind.SpreadElement */ || arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); } function getSpreadArgumentIndex(args) { return ts.findIndex(args, isSpreadArgument); @@ -76341,9 +76974,9 @@ var ts; var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments var effectiveParameterCount = getParameterCount(signature); var effectiveMinimumArguments = getMinArgumentCount(signature); - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { argCount = args.length; - if (node.template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (node.template.kind === 225 /* SyntaxKind.TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var lastSpan = ts.last(node.template.templateSpans); // we should always have at least one span. @@ -76358,7 +76991,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 165 /* SyntaxKind.Decorator */) { + else if (node.kind === 167 /* SyntaxKind.Decorator */) { argCount = getDecoratorArgumentCount(node, signature); } else if (ts.isJsxOpeningLikeElement(node)) { @@ -76372,7 +77005,7 @@ var ts; } else if (!node.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(node.kind === 209 /* SyntaxKind.NewExpression */); + ts.Debug.assert(node.kind === 211 /* SyntaxKind.NewExpression */); return getMinArgumentCount(signature) === 0; } else { @@ -76475,7 +77108,7 @@ var ts; // example, given a 'function wrap(cb: (x: T) => U): (x: T) => U' and a call expression // 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the // return type of 'wrap'. - if (node.kind !== 165 /* SyntaxKind.Decorator */) { + if (node.kind !== 167 /* SyntaxKind.Decorator */) { var skipBindingPatterns = ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }); var contextualType = getContextualType(node, skipBindingPatterns ? 8 /* ContextFlags.SkipBindingPatterns */ : 0 /* ContextFlags.None */); if (contextualType) { @@ -76539,7 +77172,7 @@ var ts; } for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { var paramType = getTypeAtPosition(signature, i); if (couldContainTypeVariables(paramType)) { var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); @@ -76565,7 +77198,7 @@ var ts; if (isSpreadArgument(arg)) { // We are inferring from a spread expression in the last argument position, i.e. both the parameter // and the argument are ...x forms. - return getMutableArrayOrTupleType(arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : + return getMutableArrayOrTupleType(arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode)); } } @@ -76575,13 +77208,13 @@ var ts; for (var i = index; i < argCount; i++) { var arg = args[i]; if (isSpreadArgument(arg)) { - var spreadType = arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); + var spreadType = arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); if (isArrayLikeType(spreadType)) { types.push(spreadType); flags.push(8 /* ElementFlags.Variadic */); } else { - types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 225 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); + types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 227 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); flags.push(4 /* ElementFlags.Rest */); } } @@ -76592,7 +77225,7 @@ var ts; types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(1 /* ElementFlags.Required */); } - if (arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { + if (arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { names.push(arg.tupleNameSource); } } @@ -76736,7 +77369,7 @@ var ts; return undefined; } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 209 /* SyntaxKind.NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 211 /* SyntaxKind.NewExpression */) { // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. // If the expression is a new expression, then the check is skipped. @@ -76754,7 +77387,7 @@ var ts; var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = checkExpressionWithContextualType(arg, paramType, /*inferenceContext*/ undefined, checkMode); // If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive), @@ -76799,8 +77432,8 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - var expression = node.kind === 208 /* SyntaxKind.CallExpression */ ? node.expression : - node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; + var expression = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression : + node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; if (expression) { var callee = ts.skipOuterExpressions(expression); if (ts.isAccessExpression(callee)) { @@ -76818,17 +77451,17 @@ var ts; * Returns the effective arguments for an expression that works like a function invocation. */ function getEffectiveCallArguments(node) { - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var template = node.template; var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args_3.push(span.expression); }); } return args_3; } - if (node.kind === 165 /* SyntaxKind.Decorator */) { + if (node.kind === 167 /* SyntaxKind.Decorator */) { return getEffectiveDecoratorArguments(node); } if (ts.isJsxOpeningLikeElement(node)) { @@ -76842,7 +77475,7 @@ var ts; var _loop_26 = function (i) { var arg = args[i]; // We can call checkExpressionCached because spread expressions never have a contextual type. - var spreadType = arg.kind === 225 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); + var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); if (spreadType && isTupleType(spreadType)) { ts.forEach(getTypeArguments(spreadType), function (t, i) { var _a; @@ -76869,30 +77502,30 @@ var ts; var parent = node.parent; var expr = node.expression; switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class). return [ createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent))) ]; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts). var func = parent.parent; return [ - createSyntheticExpression(expr, parent.parent.kind === 171 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), + createSyntheticExpression(expr, parent.parent.kind === 173 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), createSyntheticExpression(expr, anyType), createSyntheticExpression(expr, numberType) ]; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators // for ES3, we will only pass two arguments. - var hasPropDesc = parent.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && languageVersion !== 0 /* ScriptTarget.ES3 */; + var hasPropDesc = languageVersion !== 0 /* ScriptTarget.ES3 */ && (!ts.isPropertyDeclaration(parent) || ts.hasAccessorModifier(parent)); return [ createSyntheticExpression(expr, getParentTypeOfClassElement(parent)), createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)), @@ -76906,17 +77539,17 @@ var ts; */ function getDecoratorArgumentCount(node, signature) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return 1; - case 167 /* SyntaxKind.PropertyDeclaration */: - return 2; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return ts.hasAccessorModifier(node.parent) ? 3 : 2; + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // For ES3 or decorators with only two parameters we supply only two arguments return languageVersion === 0 /* ScriptTarget.ES3 */ || signature.parameters.length <= 2 ? 2 : 3; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return 3; default: return ts.Debug.fail(); @@ -77058,8 +77691,8 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, fallbackError) { - var isTaggedTemplate = node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; - var isDecorator = node.kind === 165 /* SyntaxKind.Decorator */; + var isTaggedTemplate = node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; + var isDecorator = node.kind === 167 /* SyntaxKind.Decorator */; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var reportErrors = !candidatesOutArray; var typeArguments; @@ -77122,7 +77755,7 @@ var ts; var result; // If we are in signature help, a trailing comma indicates that we intend to provide another argument, // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments. - var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 208 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 210 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument // expression is a subtype of each corresponding parameter type, the return type of the first @@ -77611,7 +78244,7 @@ var ts; return resolveErrorCall(node); } var valueDecl = expressionType.symbol && ts.getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && ts.hasSyntacticModifier(valueDecl, 128 /* ModifierFlags.Abstract */)) { + if (valueDecl && ts.hasSyntacticModifier(valueDecl, 256 /* ModifierFlags.Abstract */)) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class); return resolveErrorCall(node); } @@ -77682,7 +78315,7 @@ var ts; var declaration = signature.declaration; var modifiers = ts.getSelectedEffectiveModifierFlags(declaration, 24 /* ModifierFlags.NonPublicAccessibilityModifier */); // (1) Public constructors and (2) constructor functions are always accessible. - if (!modifiers || declaration.kind !== 171 /* SyntaxKind.Constructor */) { + if (!modifiers || declaration.kind !== 173 /* SyntaxKind.Constructor */) { return true; } var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(declaration.parent.symbol); @@ -77826,16 +78459,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; default: return ts.Debug.fail(); @@ -77881,7 +78514,7 @@ var ts; // file would probably be preferable. var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968 /* SymbolFlags.Type */); var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968 /* SymbolFlags.Type */, node); - var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); var parameterSymbol = createSymbol(1 /* SymbolFlags.FunctionScopedVariable */, "props"); parameterSymbol.type = result; return createSignature(declaration, @@ -77930,16 +78563,16 @@ var ts; } function resolveSignature(node, candidatesOutArray, checkMode) { switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return resolveCallExpression(node, candidatesOutArray, checkMode); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return resolveNewExpression(node, candidatesOutArray, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return resolveDecorator(node, candidatesOutArray, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode); } throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); @@ -77983,12 +78616,15 @@ var ts; return false; } var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node : - ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : + (ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : undefined; if (func) { - // If the node has a @class tag, treat it like a constructor. + // If the node has a @class or @constructor tag, treat it like a constructor. if (ts.getJSDocClassTag(node)) return true; + // If the node is a property of an object literal. + if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent))) + return false; // If the symbol of the node has members, treat it like a constructor. var symbol = getSymbolOfNode(func); return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size); @@ -78071,7 +78707,7 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { parent = parent.parent; } if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -78097,12 +78733,12 @@ var ts; if (node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { return voidType; } - if (node.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.kind === 211 /* SyntaxKind.NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 171 /* SyntaxKind.Constructor */ && - declaration.kind !== 175 /* SyntaxKind.ConstructSignature */ && - declaration.kind !== 180 /* SyntaxKind.ConstructorType */ && + declaration.kind !== 173 /* SyntaxKind.Constructor */ && + declaration.kind !== 177 /* SyntaxKind.ConstructSignature */ && + declaration.kind !== 182 /* SyntaxKind.ConstructorType */ && !ts.isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any @@ -78122,7 +78758,7 @@ var ts; if (returnType.flags & 12288 /* TypeFlags.ESSymbolLike */ && isSymbolOrSymbolForCall(node)) { return getESSymbolLikeTypeForNode(ts.walkUpParenthesizedExpressions(node.parent)); } - if (node.kind === 208 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + if (node.kind === 210 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && returnType.flags & 16384 /* TypeFlags.Void */ && getTypePredicateOfSignature(signature)) { if (!ts.isDottedName(node.expression)) { error(node.expression, ts.Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); @@ -78152,20 +78788,20 @@ var ts; function getDeprecatedSuggestionNode(node) { node = ts.skipParentheses(node); switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 165 /* SyntaxKind.Decorator */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 167 /* SyntaxKind.Decorator */: + case 211 /* SyntaxKind.NewExpression */: return getDeprecatedSuggestionNode(node.expression); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return getDeprecatedSuggestionNode(node.tag); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getDeprecatedSuggestionNode(node.tagName); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.argumentExpression; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: var typeReference = node; return ts.isQualifiedName(typeReference.typeName) ? typeReference.typeName.right : typeReference; default: @@ -78236,8 +78872,8 @@ var ts; if (hasDefaultOnly && type && !isErrorType(type)) { var synthType = type; if (!synthType.defaultOnlyType) { - var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); - synthType.defaultOnlyType = type_5; + var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); + synthType.defaultOnlyType = type_4; } return synthType.defaultOnlyType; } @@ -78280,9 +78916,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* SymbolFlags.Function */ - ? 256 /* SyntaxKind.FunctionDeclaration */ + ? 259 /* SyntaxKind.FunctionDeclaration */ : resolvedRequire.flags & 3 /* SymbolFlags.Variable */ - ? 254 /* SyntaxKind.VariableDeclaration */ + ? 257 /* SyntaxKind.VariableDeclaration */ : 0 /* SyntaxKind.Unknown */; if (targetDeclarationKind !== 0 /* SyntaxKind.Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -78302,7 +78938,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkAssertion(node) { - if (node.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { var file = ts.getSourceFileOfNode(node); if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts" /* Extension.Cts */, ".mts" /* Extension.Mts */])) { grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead); @@ -78318,25 +78954,25 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isValidConstAssertionArgument(node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var op = node.operator; var arg = node.operand; return op === 40 /* SyntaxKind.MinusToken */ && (arg.kind === 8 /* SyntaxKind.NumericLiteral */ || arg.kind === 9 /* SyntaxKind.BigIntLiteral */) || op === 39 /* SyntaxKind.PlusToken */ && arg.kind === 8 /* SyntaxKind.NumericLiteral */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node.expression; var symbol = getTypeOfNode(expr).symbol; if (symbol && symbol.flags & 2097152 /* SymbolFlags.Alias */) { symbol = resolveAlias(symbol); } - return !!(symbol && (symbol.flags & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */); + return !!(symbol && (getAllSymbolFlags(symbol) & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */); } return false; } @@ -78372,7 +79008,7 @@ var ts; } function checkExpressionWithTypeArguments(node) { checkGrammarExpressionWithTypeArguments(node); - var exprType = node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : + var exprType = node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); var typeArguments = node.typeArguments; @@ -78436,6 +79072,16 @@ var ts; }); } } + function checkSatisfiesExpression(node) { + checkSourceElement(node.type); + var targetType = getTypeFromTypeNode(node.type); + if (isErrorType(targetType)) { + return targetType; + } + var exprType = checkExpression(node.expression); + checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, node.type, node.expression, ts.Diagnostics.Type_0_does_not_satisfy_the_expected_type_1); + return exprType; + } function checkMetaProperty(node) { checkGrammarMetaProperty(node); if (node.keywordToken === 103 /* SyntaxKind.NewKeyword */) { @@ -78463,7 +79109,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return errorType; } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -78515,7 +79161,7 @@ var ts; } function getParameterIdentifierNameAtPosition(signature, pos) { var _a; - if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 317 /* SyntaxKind.JSDocFunctionType */) { + if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDocFunctionType */) { return undefined; } var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78547,7 +79193,7 @@ var ts; return symbol.valueDeclaration && ts.isParameter(symbol.valueDeclaration) && ts.isIdentifier(symbol.valueDeclaration.name); } function isValidDeclarationForTupleLabel(d) { - return d.kind === 197 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); + return d.kind === 199 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); } function getNameableDeclarationAtPosition(signature, pos) { var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78839,7 +79485,7 @@ var ts; var yieldType; var nextType; var fallbackReturnType = voidType; - if (func.body.kind !== 235 /* SyntaxKind.Block */) { // Async or normal arrow function + if (func.body.kind !== 238 /* SyntaxKind.Block */) { // Async or normal arrow function returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* CheckMode.SkipGenericFunctions */); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -78988,15 +79634,25 @@ var ts; } function isExhaustiveSwitchStatement(node) { var links = getNodeLinks(node); - return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node)); + if (links.isExhaustive === undefined) { + links.isExhaustive = 0; // Indicate resolution is in process + var exhaustive = computeExhaustiveSwitchStatement(node); + if (links.isExhaustive === 0) { + links.isExhaustive = exhaustive; + } + } + else if (links.isExhaustive === 0) { + links.isExhaustive = false; // Resolve circularity to false + } + return links.isExhaustive; } function computeExhaustiveSwitchStatement(node) { - if (node.expression.kind === 216 /* SyntaxKind.TypeOfExpression */) { + if (node.expression.kind === 218 /* SyntaxKind.TypeOfExpression */) { var witnesses = getSwitchClauseTypeOfWitnesses(node); if (!witnesses) { return false; } - var operandConstraint = getBaseConstraintOrType(getTypeOfExpression(node.expression.expression)); + var operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression)); // Get the not-equal flags for all handled cases. var notEqualFacts_2 = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses); if (operandConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */) { @@ -79006,7 +79662,7 @@ var ts; // A missing not-equal flag indicates that the type wasn't handled by some case. return !someType(operandConstraint, function (t) { return (getTypeFacts(t) & notEqualFacts_2) === notEqualFacts_2; }); } - var type = getTypeOfExpression(node.expression); + var type = checkExpressionCached(node.expression); if (!isLiteralType(type)) { return false; } @@ -79057,11 +79713,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: - return func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + case 171 /* SyntaxKind.MethodDeclaration */: + return func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; default: return false; } @@ -79087,7 +79743,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (func.kind === 168 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 235 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { + if (func.kind === 170 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 238 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 512 /* NodeFlags.HasExplicitReturn */; @@ -79121,7 +79777,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); checkNodeDeferred(node); if (ts.isFunctionExpression(node)) { checkCollisionsForDeclarationName(node, node.name); @@ -79148,7 +79804,7 @@ var ts; } // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (!hasGrammarError && node.kind === 215 /* SyntaxKind.FunctionExpression */) { checkGrammarForGenerator(node); } contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -79199,7 +79855,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var functionFlags = ts.getFunctionFlags(node); var returnType = getReturnTypeFromAnnotation(node); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); @@ -79212,7 +79868,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body.kind === 238 /* SyntaxKind.Block */) { checkSourceElement(node.body); } else { @@ -79302,7 +79958,7 @@ var ts; expr.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var ctor = ts.getContainingFunction(expr); - if (!(ctor && (ctor.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { + if (!(ctor && (ctor.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { return true; } if (symbol.valueDeclaration) { @@ -79327,7 +79983,7 @@ var ts; var symbol_2 = getNodeLinks(node).resolvedSymbol; if (symbol_2.flags & 2097152 /* SymbolFlags.Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol_2); - return !!declaration && declaration.kind === 268 /* SyntaxKind.NamespaceImport */; + return !!declaration && declaration.kind === 271 /* SyntaxKind.NamespaceImport */; } } } @@ -79427,7 +80083,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); - if (container && container.kind !== 171 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { + if (container && container.kind !== 173 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); } @@ -79595,6 +80251,9 @@ var ts; } return booleanType; } + function hasEmptyObjectIntersection(type) { + return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); }); + } function checkInExpression(left, right, leftType, rightType) { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; @@ -79611,40 +80270,20 @@ var ts; } } else { - leftType = checkNonNullType(leftType, left); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // Require the left operand to be of type Any, the String primitive type, or the Number primitive type. - if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) || - isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) { - error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol); + // The type of the lef operand must be assignable to string, number, or symbol. + checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left); + } + // The type of the right operand must be assignable to 'object'. + if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) { + // The {} type is assignable to the object type, yet {} might represent a primitive type. Here we + // detect and error on {} that results from narrowing the unknown type, as well as intersections + // that include {} (we know that the other types in such intersections are assignable to object + // since we already checked for that). + if (hasEmptyObjectIntersection(rightType)) { + error(right, ts.Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType)); } } - rightType = checkNonNullType(rightType, right); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // The in operator requires the right operand to be - // - // 1. assignable to the non-primitive type, - // 2. an unconstrained type parameter, - // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the - // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the - // non-primitive type, or - // 4. a type parameter whose constraint is - // i. an object type, - // ii. the non-primitive type, or - // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type. - // - // The divergent behavior for type parameters and unions containing type parameters is a workaround for type - // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance - // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error - // unless *all* instantiations would result in an error. - // // The result is always of the Boolean primitive type. - var rightTypeConstraint = getConstraintOfType(rightType); - if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) { - error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive); - } return booleanType; } function checkObjectLiteralAssignment(node, sourceType, rightIsThis) { @@ -79662,7 +80301,7 @@ var ts; if (rightIsThis === void 0) { rightIsThis = false; } var properties = node.properties; var property = properties[propertyIndex]; - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */ || property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */ || property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var name = property.name; var exprType = getLiteralTypeFromPropertyName(name); if (isTypeUsableAsPropertyName(exprType)) { @@ -79675,9 +80314,9 @@ var ts; } var elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* AccessFlags.ExpressionPosition */, name); var type = getFlowTypeOfDestructuring(property, elementType); - return checkDestructuringAssignment(property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); + return checkDestructuringAssignment(property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); } - else if (property.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (property.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (propertyIndex < properties.length - 1) { error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } @@ -79715,7 +80354,7 @@ var ts; var inBoundsType = compilerOptions.noUncheckedIndexedAccess ? undefined : possiblyOutOfBoundsType; for (var i = 0; i < elements.length; i++) { var type = possiblyOutOfBoundsType; - if (node.elements[i].kind === 225 /* SyntaxKind.SpreadElement */) { + if (node.elements[i].kind === 227 /* SyntaxKind.SpreadElement */) { type = inBoundsType = inBoundsType !== null && inBoundsType !== void 0 ? inBoundsType : (checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, sourceType, undefinedType, node) || errorType); } checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode); @@ -79725,8 +80364,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 227 /* SyntaxKind.OmittedExpression */) { - if (element.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (element.kind !== 229 /* SyntaxKind.OmittedExpression */) { + if (element.kind !== 227 /* SyntaxKind.SpreadElement */) { var indexType = getNumberLiteralType(elementIndex); if (isArrayLikeType(sourceType)) { // We create a synthetic expression so that getIndexedAccessType doesn't get confused @@ -79744,7 +80383,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 221 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (restExpression.kind === 223 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -79760,7 +80399,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) { var target; - if (exprOrAssignment.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -79776,7 +80415,7 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 221 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (target.kind === 223 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { checkBinaryExpression(target, checkMode); target = target.left; // A default value is specified, so remove undefined from the final type. @@ -79784,20 +80423,20 @@ var ts; sourceType = getTypeWithFacts(sourceType, 524288 /* TypeFacts.NEUndefined */); } } - if (target.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (target.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, rightIsThis); } - if (target.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + if (target.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, checkMode); } return checkReferenceAssignment(target, sourceType, checkMode); } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var error = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; - var optionalError = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var optionalError = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; if (checkReferenceExpression(target, error, optionalError)) { @@ -79822,36 +80461,36 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 10 /* SyntaxKind.StringLiteral */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: return true; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -79863,9 +80502,9 @@ var ts; } return false; // Some forms listed here for clarity - case 217 /* SyntaxKind.VoidExpression */: // Explicit opt-out - case 211 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 229 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings + case 219 /* SyntaxKind.VoidExpression */: // Explicit opt-out + case 213 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 231 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -79902,7 +80541,7 @@ var ts; } checkGrammarNullishCoalesceWithLogicalExpression(node); var operator = node.operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { state.skip = true; setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === 108 /* SyntaxKind.ThisKeyword */)); return state; @@ -79924,11 +80563,11 @@ var ts; if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */ || operator === 56 /* SyntaxKind.BarBarToken */ || operator === 60 /* SyntaxKind.QuestionQuestionToken */) { if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */) { var parent = node.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)) { parent = parent.parent; } - checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined); + checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined); } checkTruthinessOfType(leftType, node.left); } @@ -79999,7 +80638,7 @@ var ts; // expression-wide checks and does not use a work stack to fold nested binary expressions into the same callstack frame function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 108 /* SyntaxKind.ThisKeyword */); } var leftType; @@ -80155,6 +80794,7 @@ var ts; var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */; error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true"); } + checkNaNEquality(errorNode, operator, left, right); reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); }); return booleanType; case 102 /* SyntaxKind.InstanceOfKeyword */: @@ -80350,20 +80990,35 @@ var ts; } } function tryGiveBetterPrimaryError(errNode, maybeMissingAwait, leftStr, rightStr) { - var typeName; switch (operatorToken.kind) { case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: case 34 /* SyntaxKind.EqualsEqualsToken */: - typeName = "false"; - break; case 37 /* SyntaxKind.ExclamationEqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: - typeName = "true"; + return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap, leftStr, rightStr); + default: + return undefined; } - if (typeName) { - return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, typeName, leftStr, rightStr); + } + function checkNaNEquality(errorNode, operator, left, right) { + var isLeftNaN = isGlobalNaN(ts.skipParentheses(left)); + var isRightNaN = isGlobalNaN(ts.skipParentheses(right)); + if (isLeftNaN || isRightNaN) { + var err = error(errorNode, ts.Diagnostics.This_condition_will_always_return_0, ts.tokenToString(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? 95 /* SyntaxKind.FalseKeyword */ : 110 /* SyntaxKind.TrueKeyword */)); + if (isLeftNaN && isRightNaN) + return; + var operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? ts.tokenToString(53 /* SyntaxKind.ExclamationToken */) : ""; + var location = isLeftNaN ? right : left; + var expression = ts.skipParentheses(location); + ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")"))); } - return undefined; + } + function isGlobalNaN(expr) { + if (ts.isIdentifier(expr) && expr.escapedText === "NaN") { + var globalNaNSymbol = getGlobalNaNSymbol(); + return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr); + } + return false; } } function getBaseTypesIfUnrelated(leftType, rightType, isRelated) { @@ -80444,8 +81099,8 @@ var ts; } } function checkConditionalExpression(node, checkMode) { - checkTruthinessExpression(node.condition); - checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue); + var type = checkTruthinessExpression(node.condition); + checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue); var type1 = checkExpression(node.whenTrue, checkMode); var type2 = checkExpression(node.whenFalse, checkMode); return getUnionType([type1, type2], 2 /* UnionReduction.Subtype */); @@ -80474,7 +81129,7 @@ var ts; type.flags & 58982400 /* TypeFlags.InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* TypeFlags.StringLike */)); } function getContextNode(node) { - if (node.kind === 286 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { + if (node.kind === 289 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { return node.parent.parent; // Needs to be the root JsxElement, so it encompasses the attributes _and_ the children (which are essentially part of the attributes) } return node; @@ -80528,8 +81183,8 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */ || - node.kind === 229 /* SyntaxKind.AsExpression */ || + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */ || + node.kind === 231 /* SyntaxKind.AsExpression */ || ts.isJSDocTypeAssertion(node); } function checkDeclarationInitializer(declaration, checkMode, contextualType) { @@ -80538,7 +81193,7 @@ var ts; (contextualType ? checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, checkMode || 0 /* CheckMode.Normal */) : checkExpressionCached(initializer, checkMode)); - return ts.isParameter(declaration) && declaration.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && + return ts.isParameter(declaration) && declaration.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; } @@ -80548,7 +81203,7 @@ var ts; var elementFlags = type.target.elementFlags.slice(); for (var i = getTypeReferenceArity(type); i < patternElements.length; i++) { var e = patternElements[i]; - if (i < patternElements.length - 1 || !(e.kind === 203 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { + if (i < patternElements.length - 1 || !(e.kind === 205 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { elementTypes.push(!ts.isOmittedExpression(e) && hasDefaultValue(e) ? getTypeFromBindingElement(e, /*includePatternInType*/ false, /*reportErrors*/ false) : anyType); elementFlags.push(2 /* ElementFlags.Optional */); if (!ts.isOmittedExpression(e) && !hasDefaultValue(e)) { @@ -80616,7 +81271,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, checkMode); @@ -80627,7 +81282,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -80701,6 +81356,9 @@ var ts; function hasInferenceCandidates(info) { return !!(info.candidates || info.contraCandidates); } + function hasInferenceCandidatesOrDefault(info) { + return !!(info.candidates || info.contraCandidates || hasTypeParameterDefault(info.typeParameter)); + } function hasOverlappingInferences(a, b) { for (var i = 0; i < a.length; i++) { if (hasInferenceCandidates(a[i]) && hasInferenceCandidates(b[i])) { @@ -80870,11 +81528,11 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || - (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || - (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums + var ok = (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || + (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || + (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query); } @@ -80899,9 +81557,9 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -80932,80 +81590,82 @@ var ts; return trueType; case 95 /* SyntaxKind.FalseKeyword */: return falseType; - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return checkTemplateExpression(node); case 13 /* SyntaxKind.RegularExpressionLiteral */: return globalRegExpType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return checkArrayLiteral(node, checkMode, forceTuple); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return checkObjectLiteral(node, checkMode); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return checkPropertyAccessExpression(node, checkMode); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return checkQualifiedName(node, checkMode); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return checkIndexedAccess(node, checkMode); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (node.expression.kind === 100 /* SyntaxKind.ImportKeyword */) { return checkImportCallExpression(node); } // falls through - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checkCallExpression(node, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return checkParenthesizedExpression(node, checkMode); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return checkClassExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return checkTypeOfExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return checkAssertion(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return checkNonNullAssertion(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return checkExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return checkSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return checkMetaProperty(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkDeleteExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return checkVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return checkAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checkBinaryExpression(node, checkMode); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return checkConditionalExpression(node, checkMode); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return checkSpreadExpression(node, checkMode); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return undefinedWideningType; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return checkYieldExpression(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return checkSyntheticExpression(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return checkJsxExpression(node, checkMode); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return checkJsxElement(node, checkMode); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return checkJsxSelfClosingElement(node, checkMode); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return checkJsxFragment(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return checkJsxAttributes(node, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return errorType; @@ -81064,10 +81724,10 @@ var ts; checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); if (ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { - if (!(func.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } - if (func.kind === 171 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { + if (func.kind === 173 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); } } @@ -81078,13 +81738,13 @@ var ts; if (func.parameters.indexOf(node) !== 0) { error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } - if (func.kind === 171 /* SyntaxKind.Constructor */ || func.kind === 175 /* SyntaxKind.ConstructSignature */ || func.kind === 180 /* SyntaxKind.ConstructorType */) { + if (func.kind === 173 /* SyntaxKind.Constructor */ || func.kind === 177 /* SyntaxKind.ConstructSignature */ || func.kind === 182 /* SyntaxKind.ConstructorType */) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter); } - if (func.kind === 172 /* SyntaxKind.GetAccessor */ || func.kind === 173 /* SyntaxKind.SetAccessor */) { + if (func.kind === 174 /* SyntaxKind.GetAccessor */ || func.kind === 175 /* SyntaxKind.SetAccessor */) { error(node, ts.Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); } } @@ -81142,13 +81802,13 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 179 /* SyntaxKind.FunctionType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 181 /* SyntaxKind.FunctionType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var parent = node.parent; if (node === parent.type) { return parent; @@ -81166,7 +81826,7 @@ var ts; error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + else if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -81175,13 +81835,13 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 176 /* SyntaxKind.IndexSignature */) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */) { checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === 179 /* SyntaxKind.FunctionType */ || node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 180 /* SyntaxKind.ConstructorType */ || - node.kind === 174 /* SyntaxKind.CallSignature */ || node.kind === 171 /* SyntaxKind.Constructor */ || - node.kind === 175 /* SyntaxKind.ConstructSignature */) { + else if (node.kind === 181 /* SyntaxKind.FunctionType */ || node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 182 /* SyntaxKind.ConstructorType */ || + node.kind === 176 /* SyntaxKind.CallSignature */ || node.kind === 173 /* SyntaxKind.Constructor */ || + node.kind === 177 /* SyntaxKind.ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } var functionFlags = ts.getFunctionFlags(node); @@ -81213,10 +81873,10 @@ var ts; var returnTypeNode = ts.getEffectiveReturnTypeNode(node); if (noImplicitAny && !returnTypeNode) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -81246,7 +81906,7 @@ var ts; checkAsyncFunctionReturnType(node, returnTypeNode); } } - if (node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 317 /* SyntaxKind.JSDocFunctionType */) { + if (node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 320 /* SyntaxKind.JSDocFunctionType */) { registerForUnusedIdentifiersCheck(node); } } @@ -81258,7 +81918,7 @@ var ts; var privateIdentifiers = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */) { + if (member.kind === 173 /* SyntaxKind.Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param, member) && !ts.isBindingPattern(param.name)) { @@ -81280,16 +81940,16 @@ var ts; var memberName = name && ts.getPropertyNameForPropertyNameNode(name); if (memberName) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: addName(names, name, memberName, 1 /* DeclarationMeaning.GetAccessor */ | privateStaticFlags); break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: addName(names, name, memberName, 2 /* DeclarationMeaning.SetAccessor */ | privateStaticFlags); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: addName(names, name, memberName, 3 /* DeclarationMeaning.GetOrSetAccessor */ | privateStaticFlags); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: addName(names, name, memberName, 8 /* DeclarationMeaning.Method */ | privateStaticFlags); break; } @@ -81361,7 +82021,7 @@ var ts; var names = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 166 /* SyntaxKind.PropertySignature */) { + if (member.kind === 168 /* SyntaxKind.PropertySignature */) { var memberName = void 0; var name = member.name; switch (name.kind) { @@ -81386,7 +82046,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -81434,7 +82094,7 @@ var ts; checkVariableLikeDeclaration(node); setNodeLinksForPrivateIdentifierScope(node); // property signatures already report "initializer not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { error(node, ts.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -81454,7 +82114,7 @@ var ts; // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration checkFunctionOrMethodDeclaration(node); // method signatures already report "implementation not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.body) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } // Private named methods are only allowed in class declarations @@ -81507,7 +82167,7 @@ var ts; if (ts.isPrivateIdentifierClassElementDeclaration(n)) { return true; } - return n.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return n.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(n) && !!n.initializer; } @@ -81590,7 +82250,7 @@ var ts; checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { if (!(node.flags & 16777216 /* NodeFlags.Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 256 /* NodeFlags.HasImplicitReturn */)) { if (!(node.flags & 512 /* NodeFlags.HasExplicitReturn */)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); @@ -81600,20 +82260,20 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. var symbol = getSymbolOfNode(node); - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); if (getter && setter && !(getNodeCheckFlags(getter) & 1 /* NodeCheckFlags.TypeChecked */)) { getNodeLinks(getter).flags |= 1 /* NodeCheckFlags.TypeChecked */; var getterFlags = ts.getEffectiveModifierFlags(getter); var setterFlags = ts.getEffectiveModifierFlags(setter); - if ((getterFlags & 128 /* ModifierFlags.Abstract */) !== (setterFlags & 128 /* ModifierFlags.Abstract */)) { + if ((getterFlags & 256 /* ModifierFlags.Abstract */) !== (setterFlags & 256 /* ModifierFlags.Abstract */)) { error(getter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); error(setter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } @@ -81630,7 +82290,7 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } @@ -81676,7 +82336,7 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); - if (node.kind === 178 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } ts.forEach(node.typeArguments, checkSourceElement); @@ -81692,7 +82352,7 @@ var ts; } var symbol = getNodeLinks(node).resolvedSymbol; if (symbol) { - if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) { + if (ts.some(symbol.declarations, function (d) { return ts.isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) { addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName); } if (type.flags & 32 /* TypeFlags.Enum */ && symbol.flags & 8 /* SymbolFlags.EnumMember */) { @@ -81734,7 +82394,7 @@ var ts; var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember); for (var _i = 0, elementTypes_1 = elementTypes; _i < elementTypes_1.length; _i++) { var e = elementTypes_1[_i]; - if (e.kind !== 197 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { + if (e.kind !== 199 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); break; } @@ -81783,7 +82443,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) { - if (accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(objectType) & 1 /* MappedTypeModifiers.IncludeReadonly */) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -81848,7 +82508,7 @@ var ts; ts.forEachChild(node, checkSourceElement); } function checkInferType(node) { - if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 189 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { + if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 191 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter); @@ -81858,7 +82518,7 @@ var ts; if (!links.typeParametersChecked) { links.typeParametersChecked = true; var typeParameter = getDeclaredTypeOfTypeParameter(symbol); - var declarations = ts.getDeclarationsOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var declarations = ts.getDeclarationsOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) { // Report an error on every conflicting declaration. var name = symbolToString(symbol); @@ -81899,10 +82559,10 @@ var ts; if (node.dotDotDotToken && node.questionToken) { grammarErrorOnNode(node, ts.Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); } - if (node.type.kind === 185 /* SyntaxKind.OptionalType */) { + if (node.type.kind === 187 /* SyntaxKind.OptionalType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type); } - if (node.type.kind === 186 /* SyntaxKind.RestType */) { + if (node.type.kind === 188 /* SyntaxKind.RestType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); } checkSourceElement(node.type); @@ -81915,9 +82575,9 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */ && - n.parent.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - n.parent.kind !== 226 /* SyntaxKind.ClassExpression */ && + if (n.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */ && + n.parent.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + n.parent.kind !== 228 /* SyntaxKind.ClassExpression */ && n.flags & 16777216 /* NodeFlags.Ambient */) { if (!(flags & 2 /* ModifierFlags.Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) { // It is nested in an ambient context, which means it is automatically exported @@ -81957,7 +82617,7 @@ var ts; else if (deviation & (8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { error(ts.getNameOfDeclaration(o) || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } - else if (deviation & 128 /* ModifierFlags.Abstract */) { + else if (deviation & 256 /* ModifierFlags.Abstract */) { error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); @@ -81974,7 +82634,7 @@ var ts; }); } } - var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 128 /* ModifierFlags.Abstract */; + var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 256 /* ModifierFlags.Abstract */; var someNodeFlags = 0 /* ModifierFlags.None */; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -82013,7 +82673,7 @@ var ts; // Both are literal property names that are the same. ts.isPropertyNameLiteral(node.name) && ts.isPropertyNameLiteral(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) { - var reportError = (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */) && + var reportError = (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */) && ts.isStatic(node) !== ts.isStatic(subsequentNode); // we can get here in two cases // 1. mixed static and instance class members @@ -82038,7 +82698,7 @@ var ts; else { // Report different errors regarding non-consecutive blocks of declarations depending on whether // the node in question is abstract. - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -82055,7 +82715,7 @@ var ts; var current = declarations_5[_i]; var node = current; var inAmbientContext = node.flags & 16777216 /* NodeFlags.Ambient */; - var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) || inAmbientContext; + var inAmbientContextOrInterface = node.parent && (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -82066,10 +82726,10 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if ((node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { + if ((node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { hasNonAmbientClass = true; } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */ || node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */ || node.kind === 173 /* SyntaxKind.Constructor */) { functionDeclarations.push(node); var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; @@ -82114,12 +82774,12 @@ var ts; }); } if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* SymbolFlags.Function */ && declarations) { - var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 257 /* SyntaxKind.ClassDeclaration */; }) + var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 260 /* SyntaxKind.ClassDeclaration */; }) .map(function (d) { return ts.createDiagnosticForNode(d, ts.Diagnostics.Consider_adding_a_declare_modifier_to_this_class); }); ts.forEach(declarations, function (declaration) { - var diagnostic = declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + var diagnostic = declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ ? ts.Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 - : declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ + : declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : undefined; if (diagnostic) { @@ -82129,7 +82789,7 @@ var ts; } // Abstract methods can't have an implementation -- in particular, they don't need one. if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 128 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { + !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 256 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -82175,9 +82835,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */); + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */); if (effectiveDeclarationFlags & 1 /* ModifierFlags.Export */) { - if (effectiveDeclarationFlags & 512 /* ModifierFlags.Default */) { + if (effectiveDeclarationFlags & 1024 /* ModifierFlags.Default */) { defaultExportedDeclarationSpaces |= declarationSpaces; } else { @@ -82210,26 +82870,26 @@ var ts; function getDeclarationSpaces(decl) { var d = decl; switch (d.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // A jsdoc typedef and callback are, by definition, type aliases. // falls through - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return 2 /* DeclarationSpaces.ExportType */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* ModuleInstanceState.NonInstantiated */ ? 4 /* DeclarationSpaces.ExportNamespace */ | 1 /* DeclarationSpaces.ExportValue */ : 4 /* DeclarationSpaces.ExportNamespace */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */ | 4 /* DeclarationSpaces.ExportNamespace */; - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: var node_2 = d; var expression = ts.isExportAssignment(node_2) ? node_2.expression : node_2.right; // Export assigned entity name expressions act as aliases and should fall through, otherwise they export values @@ -82239,19 +82899,19 @@ var ts; d = expression; // The below options all declare an Alias, which is allowed to merge with other values within the importing module. // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: var result_12 = 0 /* DeclarationSpaces.None */; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_12 |= getDeclarationSpaces(d); }); return result_12; - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 case 79 /* SyntaxKind.Identifier */: // https://github.com/microsoft/TypeScript/issues/36098 // Identifiers are used as declarations of assignment declarations whose parents may be // SyntaxKind.CallExpression - `Object.defineProperty(thing, "aField", {value: 42});` @@ -82295,7 +82955,7 @@ var ts; return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0]; } // primitives with a `{ then() }` won't be unwrapped/adopted. - if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { return undefined; } var thenFunction = getTypeOfPropertyOfType(type, "then"); // TODO: GH#18217 @@ -82362,7 +83022,7 @@ var ts; * Determines whether a type is an object with a callable `then` member. */ function isThenableType(type) { - if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { // primitive types cannot be considered "thenable" since they are not objects. return false; } @@ -82396,7 +83056,7 @@ var ts; // We only need `Awaited` if `T` is a type variable that has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`, // or is promise-like. if (baseConstraint ? - baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) : + baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) : maybeTypeOfKind(type, 8650752 /* TypeFlags.TypeVariable */)) { return true; } @@ -82664,20 +83324,20 @@ var ts; var headMessage; var expectedReturnType; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: headMessage = ts.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; expectedReturnType = voidType; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); @@ -82736,15 +83396,15 @@ var ts; function getEntityNameForDecoratorMetadata(node) { if (node) { switch (node.kind) { - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: return getEntityNameForDecoratorMetadataFromTypeList(node.types); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return getEntityNameForDecoratorMetadata(node.type); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; } } @@ -82753,13 +83413,13 @@ var ts; var commonEntityName; for (var _i = 0, types_21 = types; _i < types_21.length; _i++) { var typeNode = types_21[_i]; - while (typeNode.kind === 191 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 197 /* SyntaxKind.NamedTupleMember */) { + while (typeNode.kind === 193 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 199 /* SyntaxKind.NamedTupleMember */) { typeNode = typeNode.type; // Skip parens if need be } - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { continue; // Always elide `never` from the union/intersection if possible } - if (!strictNullChecks && (typeNode.kind === 196 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && (typeNode.kind === 198 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var individualEntityName = getEntityNameForDecoratorMetadata(typeNode); @@ -82805,14 +83465,14 @@ var ts; return; } checkExternalEmitHelpers(firstDecorator, 8 /* ExternalEmitHelpers.Decorate */); - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { checkExternalEmitHelpers(firstDecorator, 32 /* ExternalEmitHelpers.Param */); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16 /* ExternalEmitHelpers.Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -82821,23 +83481,23 @@ var ts; } } break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - var otherKind = node.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + var otherKind = node.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node)); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node)); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); var containingSignature = node.parent; for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) { @@ -82939,7 +83599,7 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; default: return undefined; @@ -82953,7 +83613,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -82979,7 +83639,7 @@ var ts; checkFunctionOrConstructorSymbol(symbol); } } - var body = node.kind === 168 /* SyntaxKind.MethodSignature */ ? undefined : node.body; + var body = node.kind === 170 /* SyntaxKind.MethodSignature */ ? undefined : node.body; checkSourceElement(body); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node)); addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics); @@ -83025,42 +83685,42 @@ var ts; for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) { var node = potentiallyUnusedIdentifiers_1[_i]; switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: checkUnusedClassMembers(node, addDiagnostic); checkUnusedTypeParameters(node, addDiagnostic); break; - case 305 /* SyntaxKind.SourceFile */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 308 /* SyntaxKind.SourceFile */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: checkUnusedLocalsAndParameters(node, addDiagnostic); break; - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.body) { // Don't report unused parameters in overloads checkUnusedLocalsAndParameters(node, addDiagnostic); } checkUnusedTypeParameters(node, addDiagnostic); break; - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: checkUnusedTypeParameters(node, addDiagnostic); break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: checkUnusedInferTypeParameter(node, addDiagnostic); break; default: @@ -83070,7 +83730,7 @@ var ts; } function errorUnusedLocal(declaration, name, addDiagnostic) { var node = ts.getNameOfDeclaration(declaration) || declaration; - var message = isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read; + var message = ts.isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read; addDiagnostic(declaration, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(node, message, name)); } function isIdentifierThatStartsWithUnderscore(node) { @@ -83080,11 +83740,11 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { // Already would have reported an error on the getter. break; } @@ -83095,7 +83755,7 @@ var ts; addDiagnostic(member, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.hasSyntacticModifier(parameter, 8 /* ModifierFlags.Private */)) { @@ -83103,9 +83763,9 @@ var ts; } } break; - case 176 /* SyntaxKind.IndexSignature */: - case 234 /* SyntaxKind.SemicolonClassElement */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 237 /* SyntaxKind.SemicolonClassElement */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Can't be private break; default: @@ -83133,7 +83793,7 @@ var ts; continue; var name = ts.idText(typeParameter.name); var parent = typeParameter.parent; - if (parent.kind !== 190 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { + if (parent.kind !== 192 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { if (ts.tryAddToSet(seenParentsWithEveryUnused, parent)) { var sourceFile = ts.getSourceFileOfNode(parent); var range = ts.isJSDocTemplateTag(parent) @@ -83239,7 +83899,7 @@ var ts; var importDecl = importClause.parent; var nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? - (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) + (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) : 0); if (nDeclarations === unuseds.length) { addDiagnostic(importDecl, 0 /* UnusedKind.Local */, unuseds.length === 1 @@ -83257,7 +83917,7 @@ var ts; var bindingPattern = _a[0], bindingElements = _a[1]; var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* UnusedKind.Parameter */ : 0 /* UnusedKind.Local */; if (bindingPattern.elements.length === bindingElements.length) { - if (bindingElements.length === 1 && bindingPattern.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (bindingElements.length === 1 && bindingPattern.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId); } else { @@ -83278,7 +83938,7 @@ var ts; if (declarationList.declarations.length === declarations.length) { addDiagnostic(declarationList, 0 /* UnusedKind.Local */, declarations.length === 1 ? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name)) - : ts.createDiagnosticForNode(declarationList.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); + : ts.createDiagnosticForNode(declarationList.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); } else { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -83308,22 +83968,22 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return ts.idText(name); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name); default: return ts.Debug.assertNever(name); } } function isImportedDeclaration(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */ || node.kind === 270 /* SyntaxKind.ImportSpecifier */ || node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 270 /* SyntaxKind.ImportClause */ || node.kind === 273 /* SyntaxKind.ImportSpecifier */ || node.kind === 271 /* SyntaxKind.NamespaceImport */; } function importClauseFromImported(decl) { - return decl.kind === 267 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 268 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; + return decl.kind === 270 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 271 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 235 /* SyntaxKind.Block */) { + if (node.kind === 238 /* SyntaxKind.Block */) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -83358,13 +84018,13 @@ var ts; if ((identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) !== name) { return false; } - if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */ || - node.kind === 168 /* SyntaxKind.MethodSignature */ || - node.kind === 172 /* SyntaxKind.GetAccessor */ || - node.kind === 173 /* SyntaxKind.SetAccessor */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */ || + node.kind === 170 /* SyntaxKind.MethodSignature */ || + node.kind === 174 /* SyntaxKind.GetAccessor */ || + node.kind === 175 /* SyntaxKind.SetAccessor */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */) { // it is ok to have member named '_super', '_this', `Promise`, etc. - member access is always qualified return false; } @@ -83430,7 +84090,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83445,7 +84105,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83545,7 +84205,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -83557,17 +84217,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* SymbolFlags.BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* NodeFlags.BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); - var container = varDeclList.parent.kind === 237 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); + var container = varDeclList.parent.kind === 240 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || - container.kind === 262 /* SyntaxKind.ModuleBlock */ || - container.kind === 261 /* SyntaxKind.ModuleDeclaration */ || - container.kind === 305 /* SyntaxKind.SourceFile */); + (container.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || + container.kind === 265 /* SyntaxKind.ModuleBlock */ || + container.kind === 264 /* SyntaxKind.ModuleDeclaration */ || + container.kind === 308 /* SyntaxKind.SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -83598,7 +84258,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); if (ts.hasOnlyExpressionInitializer(node) && node.initializer) { checkExpressionCached(node.initializer); @@ -83620,7 +84280,7 @@ var ts; checkExternalEmitHelpers(node, 4 /* ExternalEmitHelpers.Rest */); } // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access @@ -83642,7 +84302,7 @@ var ts; } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { + if (node.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* ExternalEmitHelpers.Read */); } ts.forEach(node.name.elements, checkSourceElement); @@ -83654,7 +84314,7 @@ var ts; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { - var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */; + var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */; var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression)); if (needCheckInitializer || needCheckWidenedType) { // Don't validate for-in initializer as it is already an error @@ -83682,7 +84342,7 @@ var ts; } // For a commonjs `const x = require`, validate the alias and exit var symbol = getSymbolOfNode(node); - if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { + if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 205 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { checkAliasSymbol(node); return; } @@ -83696,7 +84356,7 @@ var ts; ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) && !!((_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.size); - if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */) { + if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */) { checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined); } } @@ -83722,10 +84382,10 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionsForDeclarationName(node, node.name); @@ -83733,7 +84393,7 @@ var ts; } function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) { var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration); - var message = nextDeclaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 166 /* SyntaxKind.PropertySignature */ + var message = nextDeclaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 168 /* SyntaxKind.PropertySignature */ ? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; var declName = ts.declarationNameToString(nextDeclarationName); @@ -83743,8 +84403,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 164 /* SyntaxKind.Parameter */ && right.kind === 254 /* SyntaxKind.VariableDeclaration */) || - (left.kind === 254 /* SyntaxKind.VariableDeclaration */ && right.kind === 164 /* SyntaxKind.Parameter */)) { + if ((left.kind === 166 /* SyntaxKind.Parameter */ && right.kind === 257 /* SyntaxKind.VariableDeclaration */) || + (left.kind === 257 /* SyntaxKind.VariableDeclaration */ && right.kind === 166 /* SyntaxKind.Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -83753,8 +84413,8 @@ var ts; } var interestingFlags = 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | - 256 /* ModifierFlags.Async */ | - 128 /* ModifierFlags.Abstract */ | + 512 /* ModifierFlags.Async */ | + 256 /* ModifierFlags.Abstract */ | 64 /* ModifierFlags.Readonly */ | 32 /* ModifierFlags.Static */; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); @@ -83783,15 +84443,15 @@ var ts; function checkIfStatement(node) { // Grammar checking checkGrammarStatementInAmbientContext(node); - checkTruthinessExpression(node.expression); - checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement); + var type = checkTruthinessExpression(node.expression); + checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 236 /* SyntaxKind.EmptyStatement */) { + if (node.thenStatement.kind === 239 /* SyntaxKind.EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); } - function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) { + function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) { if (!strictNullChecks) return; helper(condExpr, body); @@ -83806,7 +84466,7 @@ var ts; : condExpr; if (ts.isModuleExportsAccessExpression(location)) return; - var type = checkTruthinessExpression(location); + var type = location === condExpr ? condType : checkTruthinessExpression(location); var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression); if (!(getTypeFacts(type) & 4194304 /* TypeFacts.Truthy */) || isPropertyExpressionCast) return; @@ -83920,12 +84580,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -83965,14 +84625,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node); // There may be a destructuring assignment on the left side - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -84004,7 +84664,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -84018,7 +84678,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -84500,7 +85160,16 @@ var ts; var message = allowAsyncIterables ? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator : ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator; - return errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type)); + var suggestAwait = + // for (const x of Promise<...>) or [...Promise<...>] + !!getAwaitedTypeOfPromise(type) + // for (const x of AsyncIterable<...>) + || (!allowAsyncIterables && + ts.isForOfStatement(errorNode.parent) && + errorNode.parent.expression === errorNode && + getGlobalAsyncIterableType(/** reportErrors */ false) !== emptyGenericType && + isTypeAssignableTo(type, getGlobalAsyncIterableType(/** reportErrors */ false))); + return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type)); } /** * Gets the *yield*, *return*, and *next* types from an `Iterator`-like or `AsyncIterator`-like type. @@ -84818,12 +85487,12 @@ var ts; var functionFlags = ts.getFunctionFlags(container); if (strictNullChecks || node.expression || returnType.flags & 131072 /* TypeFlags.Never */) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (container.kind === 173 /* SyntaxKind.SetAccessor */) { + if (container.kind === 175 /* SyntaxKind.SetAccessor */) { if (node.expression) { error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -84841,7 +85510,7 @@ var ts; } } } - else if (container.kind !== 171 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { + else if (container.kind !== 173 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { // The function has a return type, but the return statement doesn't have an expression. error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -84870,7 +85539,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -84879,7 +85548,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause)); } ts.forEach(clause.statements, checkSourceElement); @@ -84916,7 +85585,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 250 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { + if (current.kind === 253 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -85011,9 +85680,9 @@ var ts; return; } var indexInfos = getApplicableIndexInfos(type, propNameType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; - var propDeclaration = declaration && declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || - name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || + name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined; var _loop_30 = function (info) { var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; @@ -85038,7 +85707,7 @@ var ts; function checkIndexConstraintForIndexSignature(type, checkInfo) { var declaration = checkInfo.declaration; var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined; var _loop_31 = function (info) { if (info === checkInfo) @@ -85110,7 +85779,7 @@ var ts; } else { ts.forEach(jsdocParameters, function (_a, index) { - var name = _a.name; + var name = _a.name, isNameFirst = _a.isNameFirst; if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) { return; } @@ -85120,7 +85789,9 @@ var ts; } } else { - errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name)); + if (!isNameFirst) { + errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name)); + } } }); } @@ -85158,7 +85829,7 @@ var ts; function checkTypeParametersNotReferenced(root, typeParameters, index) { visit(root); function visit(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */) { var type = getTypeFromTypeReference(node); if (type.flags & 262144 /* TypeFlags.TypeParameter */) { for (var i = index; i < typeParameters.length; i++) { @@ -85248,7 +85919,7 @@ var ts; if (firstDecorator && ts.some(node.members, function (p) { return ts.hasStaticModifier(p) && ts.isPrivateIdentifierClassElementDeclaration(p); })) { grammarErrorOnNode(firstDecorator, ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator); } - if (!node.name && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (!node.name && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -85315,7 +85986,7 @@ var ts; } else { var constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); - if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(node.name || node, ts.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract); } } @@ -85550,7 +86221,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 257 /* SyntaxKind.ClassDeclaration */ || d.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return d.kind === 260 /* SyntaxKind.ClassDeclaration */ || d.kind === 261 /* SyntaxKind.InterfaceDeclaration */; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -85591,7 +86262,7 @@ var ts; // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. - if (baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 128 /* ModifierFlags.Abstract */))) { + if (baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 256 /* ModifierFlags.Abstract */))) { // Searches other base types for a declaration that would satisfy the inherited abstract member. // (The class may have more than one base type via declaration merging with an interface with the // same name.) @@ -85605,7 +86276,7 @@ var ts; return "continue-basePropertyCheck"; } } - if (derivedClassDecl.kind === 226 /* SyntaxKind.ClassExpression */) { + if (derivedClassDecl.kind === 228 /* SyntaxKind.ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -85640,11 +86311,11 @@ var ts; error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type)); } else if (useDefineForClassFields) { - var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); + var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); if (uninitialized && !(derived.flags & 33554432 /* SymbolFlags.Transient */) - && !(baseDeclarationFlags & 128 /* ModifierFlags.Abstract */) - && !(derivedDeclarationFlags & 128 /* ModifierFlags.Abstract */) + && !(baseDeclarationFlags & 256 /* ModifierFlags.Abstract */) + && !(derivedDeclarationFlags & 256 /* ModifierFlags.Abstract */) && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* NodeFlags.Ambient */); }))) { var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol)); var propName = uninitialized.name; @@ -85687,7 +86358,7 @@ var ts; } } function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) { - return baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) + return baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) || ts.isInterfaceDeclaration(declaration.parent); } function getNonInheritedProperties(type, baseTypes, properties) { @@ -85769,7 +86440,7 @@ var ts; } } function isPropertyWithoutInitializer(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; @@ -85812,7 +86483,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -85845,7 +86516,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); checkExportsOnMergedDeclarations(node); checkTypeParameters(node.typeParameters); - if (node.type.kind === 138 /* SyntaxKind.IntrinsicKeyword */) { + if (node.type.kind === 139 /* SyntaxKind.IntrinsicKeyword */) { if (!intrinsicTypeKinds.has(node.name.escapedText) || ts.length(node.typeParameters) !== 1) { error(node.type, ts.Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); } @@ -85931,7 +86602,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -85941,7 +86612,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -85970,7 +86641,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: checkGrammarNumericLiteral(expr); return +expr.text; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return evaluate(expr.expression); case 79 /* SyntaxKind.Identifier */: var identifier = expr; @@ -85978,13 +86649,13 @@ var ts; return +(identifier.escapedText); } return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (isConstantMemberAccess(expr)) { var type = getTypeOfExpression(expr.expression); if (type.symbol && type.symbol.flags & 384 /* SymbolFlags.Enum */) { var name = void 0; - if (expr.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (expr.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { name = expr.name.escapedText; } else { @@ -86021,8 +86692,8 @@ var ts; return false; } return node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || - node.kind === 207 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && + node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || + node.kind === 209 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && ts.isStringLiteralLike(node.argumentExpression); } function checkEnumDeclaration(node) { @@ -86056,7 +86727,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -86085,8 +86756,8 @@ var ts; if (declarations) { for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; - if ((declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || - (declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || + (declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { return declaration; } @@ -86157,7 +86828,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 257 /* SyntaxKind.ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 260 /* SyntaxKind.ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* NodeCheckFlags.LexicalModuleMergesWithClass */; @@ -86200,56 +86871,43 @@ var ts; } } function checkModuleAugmentationElement(node, isGlobalAugmentation) { - var _a; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement - for (var _i = 0, _b = node.declarationList.declarations; _i < _b.length; _i++) { - var decl = _b[_i]; + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 203 /* SyntaxKind.BindingElement */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: var name = node.name; if (ts.isBindingPattern(name)) { - for (var _c = 0, _d = name.elements; _c < _d.length; _c++) { - var el = _d[_c]; + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { + var el = _c[_b]; // mark individual names in binding pattern checkModuleAugmentationElement(el, isGlobalAugmentation); } break; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } - var symbol = getSymbolOfNode(node); - if (symbol) { - // module augmentations cannot introduce new names on the top level scope of the module - // this is done it two steps - // 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error - // 2. main check - report error if value declaration of the parent symbol is module augmentation) - var reportError = !(symbol.flags & 33554432 /* SymbolFlags.Transient */); - if (!reportError) { - // symbol should not originate in augmentation - reportError = !!((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.declarations) && ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); - } - } break; } } @@ -86257,12 +86915,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { if (ts.isModuleExportsAccessExpression(node.expression) && !ts.isPrivateIdentifier(node.name)) { return node.name; @@ -86282,9 +86940,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 272 /* SyntaxKind.ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 275 /* SyntaxKind.ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -86331,8 +86989,8 @@ var ts; var errorNode = ts.isImportOrExportSpecifier(node) ? node.propertyName || node.name : ts.isNamedDeclaration(node) ? node.name : node; - ts.Debug.assert(node.kind !== 274 /* SyntaxKind.NamespaceExport */); - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */) { + ts.Debug.assert(node.kind !== 277 /* SyntaxKind.NamespaceExport */); + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */) { var diag = error(errorNode, ts.Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files); var alreadyExportedSymbol = (_b = (_a = ts.getSourceFileOfNode(node).symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.get((node.propertyName || node.name).escapedText); if (alreadyExportedSymbol === target) { @@ -86343,7 +87001,7 @@ var ts; } } else { - ts.Debug.assert(node.kind !== 254 /* SyntaxKind.VariableDeclaration */); + ts.Debug.assert(node.kind !== 257 /* SyntaxKind.VariableDeclaration */); var importDeclaration = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)); var moduleSpecifier = (_e = (importDeclaration && ((_d = ts.tryGetModuleSpecifierFromDeclaration(importDeclaration)) === null || _d === void 0 ? void 0 : _d.text))) !== null && _e !== void 0 ? _e : "..."; var importedIdentifier = ts.unescapeLeadingUnderscores(ts.isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName); @@ -86351,11 +87009,12 @@ var ts; } return; } + var targetFlags = getAllSymbolFlags(target); var excludedMeanings = (symbol.flags & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */) ? 111551 /* SymbolFlags.Value */ : 0) | (symbol.flags & 788968 /* SymbolFlags.Type */ ? 788968 /* SymbolFlags.Type */ : 0) | (symbol.flags & 1920 /* SymbolFlags.Namespace */ ? 1920 /* SymbolFlags.Namespace */ : 0); - if (target.flags & excludedMeanings) { - var message = node.kind === 275 /* SyntaxKind.ExportSpecifier */ ? + if (targetFlags & excludedMeanings) { + var message = node.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -86364,26 +87023,26 @@ var ts; && !ts.isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 16777216 /* NodeFlags.Ambient */)) { var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol); - var isType = !(target.flags & 111551 /* SymbolFlags.Value */); + var isType = !(targetFlags & 111551 /* SymbolFlags.Value */); if (isType || typeOnlyAlias) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { if (compilerOptions.preserveValueImports) { ts.Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name"); var message = isType ? ts.Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled : ts.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled; - var name = ts.idText(node.kind === 270 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); + var name = ts.idText(node.kind === 273 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name); } - if (isType && node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { + if (isType && node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided); } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // Don't allow re-exporting an export that will be elided when `--isolatedModules` is set. // The exception is that `import type { A } from './a'; export { A }` is allowed // because single-file analysis can determine that the export should be dropped. @@ -86442,7 +87101,7 @@ var ts; function checkImportBinding(node) { checkCollisionsForDeclarationName(node, node.name); checkAliasSymbol(node); - if (node.kind === 270 /* SyntaxKind.ImportSpecifier */ && + if (node.kind === 273 /* SyntaxKind.ImportSpecifier */ && ts.idText(node.propertyName || node.name) === "default" && ts.getESModuleInterop(compilerOptions) && moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) { @@ -86492,7 +87151,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { checkImportBinding(importClause.namedBindings); if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && ts.getESModuleInterop(compilerOptions)) { // import * as ns from "foo"; @@ -86521,17 +87180,18 @@ var ts; if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */) { + if (node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { - if (target.flags & 111551 /* SymbolFlags.Value */) { + var targetFlags = getAllSymbolFlags(target); + if (targetFlags & 111551 /* SymbolFlags.Value */) { // Target is a value symbol, check that it is not hidden by a local declaration with the same name var moduleName = ts.getFirstIdentifier(node.moduleReference); if (!(resolveEntityName(moduleName, 111551 /* SymbolFlags.Value */ | 1920 /* SymbolFlags.Namespace */).flags & 1920 /* SymbolFlags.Namespace */)) { error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName)); } } - if (target.flags & 788968 /* SymbolFlags.Type */) { + if (targetFlags & 788968 /* SymbolFlags.Type */) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0); } } @@ -86564,10 +87224,10 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* NodeFlags.Ambient */; - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -86602,7 +87262,7 @@ var ts; function checkGrammarExportDeclaration(node) { var _a; if (node.isTypeOnly) { - if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 273 /* SyntaxKind.NamedExports */) { + if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 276 /* SyntaxKind.NamedExports */) { return checkGrammarNamedImportsOrExports(node.exportClause); } else { @@ -86612,7 +87272,7 @@ var ts; return false; } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 305 /* SyntaxKind.SourceFile */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 308 /* SyntaxKind.SourceFile */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -86670,7 +87330,7 @@ var ts; markExportAsReferenced(node); } var target = symbol && (symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol); - if (!target || target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (!target || getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) { checkExpressionCached(node.propertyName || node.name); } } @@ -86692,8 +87352,8 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -86717,7 +87377,7 @@ var ts; markAliasReferenced(sym, id); // If not a value, we're interpreting the identifier as a type export, along the lines of (`export { Id as default }`) var target = sym.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(sym) : sym; - if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) { // However if it is a value, we need to check it's being used correctly checkExpressionCached(node.expression); } @@ -86825,181 +87485,181 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } - if (kind >= 237 /* SyntaxKind.FirstStatement */ && kind <= 253 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { + if (kind >= 240 /* SyntaxKind.FirstStatement */ && kind <= 256 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, ts.Diagnostics.Unreachable_code_detected); } switch (kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return checkTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return checkParameter(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return checkPropertyDeclaration(node); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checkPropertySignature(node); - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return checkSignatureDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return checkMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return checkClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return checkConstructorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return checkAccessorDeclaration(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return checkTypeReferenceNode(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return checkTypePredicate(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return checkTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return checkTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return checkArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return checkTupleType(node); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return checkUnionOrIntersectionType(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: return checkSourceElement(node.type); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return checkThisType(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return checkTypeOperator(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return checkConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return checkInferType(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return checkTemplateLiteralType(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return checkImportType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return checkNamedTupleMember(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return checkJSDocImplementsTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return checkJSDocTypeAliasTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return checkJSDocTemplateTag(node); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return checkJSDocTypeTag(node); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: + case 327 /* SyntaxKind.JSDocLink */: + case 328 /* SyntaxKind.JSDocLinkCode */: + case 329 /* SyntaxKind.JSDocLinkPlain */: return checkJSDocLinkLikeTag(node); - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return checkJSDocParameterTag(node); - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return checkJSDocPropertyTag(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: checkJSDocFunctionType(node); // falls through - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: checkJSDocVariadicType(node); return; - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return checkSourceElement(node.type); - case 333 /* SyntaxKind.JSDocPublicTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: return checkJSDocAccessibilityModifiers(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return checkIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return checkMappedType(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return checkFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return checkBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return checkVariableStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return checkExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return checkIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return checkDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return checkWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return checkForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return checkForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: return checkBreakOrContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return checkReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return checkSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return checkThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return checkTryStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checkVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return checkBindingElement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return checkClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return checkEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return checkModuleDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return checkImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return checkExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return checkExportAssignment(node); - case 236 /* SyntaxKind.EmptyStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -87106,36 +87766,36 @@ var ts; currentNode = node; instantiationCount = 0; switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: // These node kinds are deferred checked when overload resolution fails // To save on work, we ensure the arguments are checked just once, in // a deferred way resolveUntypedCall(node); break; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: checkAccessorDeclaration(node); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: checkClassExpressionDeferred(node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: checkTypeParameterDeferred(node); break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: checkJsxSelfClosingElementDeferred(node); break; - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: checkJsxElementDeferred(node); break; } @@ -87308,17 +87968,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalModule(location)) break; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: copyLocallyVisibleExportSymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* SymbolFlags.ModuleMember */); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* SymbolFlags.EnumMember */); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); @@ -87326,8 +87986,8 @@ var ts; // this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration. // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -87336,7 +87996,7 @@ var ts; copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968 /* SymbolFlags.Type */); } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -87380,7 +88040,7 @@ var ts; if (meaning) { source.forEach(function (symbol) { // Similar condition as in `resolveNameHelper` - if (!ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 274 /* SyntaxKind.NamespaceExport */)) { + if (!ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 277 /* SyntaxKind.NamespaceExport */)) { copySymbol(symbol, meaning); } }); @@ -87389,41 +88049,21 @@ var ts; } function isTypeDeclarationName(name) { return name.kind === 79 /* SyntaxKind.Identifier */ && - isTypeDeclaration(name.parent) && + ts.isTypeDeclaration(name.parent) && ts.getNameOfDeclaration(name.parent) === name; } - function isTypeDeclaration(node) { - switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - return true; - case 267 /* SyntaxKind.ImportClause */: - return node.isTypeOnly; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - return node.parent.parent.isTypeOnly; - default: - return false; - } - } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 178 /* SyntaxKind.TypeReference */; + return node.parent.kind === 180 /* SyntaxKind.TypeReference */; } function isHeritageClauseElementIdentifier(node) { - while (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - return node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -87451,13 +88091,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (nodeOnRightSide.parent.kind === 163 /* SyntaxKind.QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } - if (nodeOnRightSide.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } return undefined; @@ -87483,7 +88123,7 @@ var ts; node = parent; parent = parent.parent; } - if (parent && parent.kind === 200 /* SyntaxKind.ImportType */ && parent.qualifier === node) { + if (parent && parent.kind === 202 /* SyntaxKind.ImportType */ && parent.qualifier === node) { return parent; } return undefined; @@ -87493,7 +88133,7 @@ var ts; return getSymbolOfNode(name.parent); } if (ts.isInJSFile(name) && - name.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + name.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && name.parent === name.parent.parent.left) { // Check if this is a special property assignment if (!ts.isPrivateIdentifier(name) && !ts.isJSDocMemberName(name)) { @@ -87503,7 +88143,7 @@ var ts; } } } - if (name.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { + if (name.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { // Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression var success = resolveEntityName(name, /*all meanings*/ 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*ignoreErrors*/ true); @@ -87513,7 +88153,7 @@ var ts; } else if (ts.isEntityName(name) && isInRightSideOfImportOrExportAssignment(name)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(name, 265 /* SyntaxKind.ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(name, 268 /* SyntaxKind.ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(name, /*dontResolveAlias*/ true); } @@ -87531,7 +88171,7 @@ var ts; if (isHeritageClauseElementIdentifier(name)) { var meaning = 0 /* SymbolFlags.None */; // In an interface or class, we're definitely interested in a type. - if (name.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (name.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { meaning = 788968 /* SymbolFlags.Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) { @@ -87547,10 +88187,10 @@ var ts; return entityNameSymbol; } } - if (name.parent.kind === 340 /* SyntaxKind.JSDocParameterTag */) { + if (name.parent.kind === 343 /* SyntaxKind.JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(name.parent); } - if (name.parent.kind === 163 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 344 /* SyntaxKind.JSDocTemplateTag */) { + if (name.parent.kind === 165 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 347 /* SyntaxKind.JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJSFile(name)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(name.parent); return typeParameter && typeParameter.symbol; @@ -87574,18 +88214,53 @@ var ts; return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container)); } } + if (result && isJSDoc_1) { + var container = ts.getJSDocHost(name); + if (container && ts.isEnumMember(container) && container === result.valueDeclaration) { + return resolveEntityName(name, meaning, /*ignoreErrors*/ true, /* dontResolveAlias */ true, ts.getSourceFileOfNode(container)) || result; + } + } return result; } else if (ts.isPrivateIdentifier(name)) { return getSymbolForPrivateIdentifierExpression(name); } - else if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 161 /* SyntaxKind.QualifiedName */) { + else if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 163 /* SyntaxKind.QualifiedName */) { var links = getNodeLinks(name); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { checkPropertyAccessExpression(name, 0 /* CheckMode.Normal */); + if (!links.resolvedSymbol) { + var expressionType = checkExpressionCached(name.expression); + var infos = getApplicableIndexInfos(expressionType, getLiteralTypeFromPropertyName(name.name)); + if (infos.length && expressionType.members) { + var resolved = resolveStructuredTypeMembers(expressionType); + var symbol = resolved.members.get("__index" /* InternalSymbolName.Index */); + if (infos === getIndexInfosOfType(expressionType)) { + links.resolvedSymbol = symbol; + } + else if (symbol) { + var symbolLinks_1 = getSymbolLinks(symbol); + var declarationList = ts.mapDefined(infos, function (i) { return i.declaration; }); + var nodeListId = ts.map(declarationList, getNodeId).join(","); + if (!symbolLinks_1.filteredIndexSymbolCache) { + symbolLinks_1.filteredIndexSymbolCache = new ts.Map(); + } + if (symbolLinks_1.filteredIndexSymbolCache.has(nodeListId)) { + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + else { + var copy = createSymbol(131072 /* SymbolFlags.Signature */, "__index" /* InternalSymbolName.Index */); + copy.declarations = ts.mapDefined(infos, function (i) { return i.declaration; }); + copy.parent = expressionType.aliasSymbol ? expressionType.aliasSymbol : expressionType.symbol ? expressionType.symbol : getSymbolAtLocation(copy.declarations[0].parent); + symbolLinks_1.filteredIndexSymbolCache.set(nodeListId, copy); + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + } + } + } } else { checkQualifiedName(name, 0 /* CheckMode.Normal */); @@ -87600,11 +88275,11 @@ var ts; } } else if (isTypeReferenceIdentifier(name)) { - var meaning = name.parent.kind === 178 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; + var meaning = name.parent.kind === 180 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; var symbol = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name); } - if (name.parent.kind === 177 /* SyntaxKind.TypePredicate */) { + if (name.parent.kind === 179 /* SyntaxKind.TypePredicate */) { return resolveEntityName(name, /*meaning*/ 1 /* SymbolFlags.FunctionScopedVariable */); } return undefined; @@ -87638,7 +88313,7 @@ var ts; } } function getSymbolAtLocation(node, ignoreErrors) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } var parent = node.parent; @@ -87661,8 +88336,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } - else if (parent.kind === 203 /* SyntaxKind.BindingElement */ && - grandParent.kind === 201 /* SyntaxKind.ObjectBindingPattern */ && + else if (parent.kind === 205 /* SyntaxKind.BindingElement */ && + grandParent.kind === 203 /* SyntaxKind.ObjectBindingPattern */ && node === parent.propertyName) { var typeOfPattern = getTypeOfNode(grandParent); var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText); @@ -87689,8 +88364,8 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: if (!ts.isThisInTypeQuery(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } @@ -87707,14 +88382,14 @@ var ts; return checkExpression(node).symbol; } // falls through - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return getTypeFromThisTypeNode(node).symbol; case 106 /* SyntaxKind.SuperKeyword */: return checkExpression(node).symbol; - case 134 /* SyntaxKind.ConstructorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 171 /* SyntaxKind.Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 173 /* SyntaxKind.Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -87725,7 +88400,7 @@ var ts; // 3). Dynamic import call or require in javascript // 4). type A = import("./f/*gotToDefinitionHere*/oo") if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 272 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || + ((node.parent.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 275 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || ((ts.isInJSFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent)) || (ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) { return resolveExternalModuleName(node, node, ignoreErrors); @@ -87747,14 +88422,14 @@ var ts; case 38 /* SyntaxKind.EqualsGreaterThanToken */: case 84 /* SyntaxKind.ClassKeyword */: return getSymbolOfNode(node.parent); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : undefined; case 93 /* SyntaxKind.ExportKeyword */: return ts.isExportAssignment(node.parent) ? ts.Debug.checkDefined(node.parent.symbol) : undefined; case 100 /* SyntaxKind.ImportKeyword */: case 103 /* SyntaxKind.NewKeyword */: return ts.isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : undefined; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return checkExpression(node).symbol; default: return undefined; @@ -87770,7 +88445,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (location && location.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 111551 /* SymbolFlags.Value */ | 2097152 /* SymbolFlags.Alias */); } return undefined; @@ -87809,7 +88484,7 @@ var ts; var baseType = ts.firstOrUndefined(getBaseTypes(classType)); return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType; } - if (isTypeDeclaration(node)) { + if (ts.isTypeDeclaration(node)) { // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); @@ -87852,23 +88527,23 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfAssignmentPattern(expr) { - ts.Debug.assert(expr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (expr.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expr.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (expr.parent.kind === 299 /* SyntaxKind.PropertyAssignment */) { var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression); var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType; var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent); @@ -87916,7 +88591,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 10 /* SyntaxKind.StringLiteral */: return getStringLiteralType(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameType = checkComputedPropertyName(name); return isTypeAssignableToKind(nameType, 12288 /* TypeFlags.ESSymbolLike */) ? nameType : stringType; default: @@ -88004,7 +88679,7 @@ var ts; return symbolLinks.exportsSomeValue; function isValue(s) { s = resolveSymbol(s); - return s && !!(s.flags & 111551 /* SymbolFlags.Value */); + return s && !!(getAllSymbolFlags(s) & 111551 /* SymbolFlags.Value */); } } function isNameOfModuleOrEnumDeclaration(node) { @@ -88034,7 +88709,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 305 /* SyntaxKind.SourceFile */) { + if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 308 /* SyntaxKind.SourceFile */) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -88054,10 +88729,10 @@ var ts; } var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier); if (node) { - var symbol = getReferencedValueSymbol(node); + var symbol = getReferencedValueOrAliasSymbol(node); // We should only get the declaration of an alias if there isn't a local value // declaration for the symbol - if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) { return getDeclarationOfAliasSymbol(symbol); } } @@ -88066,7 +88741,7 @@ var ts; function isSymbolOfDestructuredElementOfCatchBinding(symbol) { return symbol.valueDeclaration && ts.isBindingElement(symbol.valueDeclaration) - && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 292 /* SyntaxKind.CatchClause */; + && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 295 /* SyntaxKind.CatchClause */; } function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 /* SymbolFlags.BlockScoped */ && symbol.valueDeclaration && !ts.isSourceFile(symbol.valueDeclaration)) { @@ -88097,7 +88772,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 235 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 238 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -88138,19 +88813,19 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: var symbol = getSymbolOfNode(node); - return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol); - case 272 /* SyntaxKind.ExportDeclaration */: + return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */); + case 275 /* SyntaxKind.ExportDeclaration */: var exportClause = node.exportClause; return !!exportClause && (ts.isNamespaceExport(exportClause) || ts.some(exportClause.elements, isValueAliasDeclaration)); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return node.expression && node.expression.kind === 79 /* SyntaxKind.Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; @@ -88159,7 +88834,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(nodeIn) { var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -88167,6 +88842,7 @@ var ts; return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference); } function isAliasResolvedToValue(symbol) { + var _a; if (!symbol) { return false; } @@ -88176,7 +88852,7 @@ var ts; } // const enums and modules that contain only const enums are not considered values from the emit perspective // unless 'preserveConstEnums' option is set to true - return !!(target.flags & 111551 /* SymbolFlags.Value */) && + return !!(((_a = getAllSymbolFlags(target)) !== null && _a !== void 0 ? _a : -1) & 111551 /* SymbolFlags.Value */) && (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target)); } function isConstEnumOrConstEnumOnlyModule(s) { @@ -88191,7 +88867,7 @@ var ts; } var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217 if (target && ts.getEffectiveModifierFlags(node) & 1 /* ModifierFlags.Export */ && - target.flags & 111551 /* SymbolFlags.Value */ && + getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */ && (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) { // An `export import ... =` of a value symbol is always considered referenced return true; @@ -88269,15 +88945,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 299 /* SyntaxKind.EnumMember */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 302 /* SyntaxKind.EnumMember */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return true; } return false; } function getConstantValue(node) { - if (node.kind === 299 /* SyntaxKind.EnumMember */) { + if (node.kind === 302 /* SyntaxKind.EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -88370,7 +89046,7 @@ var ts; function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) { var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor); if (!declaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } // Get type of the symbol if this is the valid symbol otherwise get type at location var symbol = getSymbolOfNode(declaration); @@ -88389,7 +89065,7 @@ var ts; function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) { var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike); if (!signatureDeclaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var signature = getSignatureFromDeclaration(signatureDeclaration); return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88397,7 +89073,7 @@ var ts; function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) { var expr = ts.getParseTreeNode(exprIn, ts.isExpression); if (!expr) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var type = getWidenedType(getRegularTypeOfExpression(expr)); return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88421,6 +89097,25 @@ var ts; } return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); } + /** + * Get either a value-meaning symbol or an alias symbol. + * Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol, + * we call `resolveName` to find a symbol. + * This is because when caching the resolved symbol, we only consider value symbols, but here + * we want to also get an alias symbol if one exists. + */ + function getReferencedValueOrAliasSymbol(reference) { + var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; + if (resolvedSymbol && resolvedSymbol !== unknownSymbol) { + return resolvedSymbol; + } + return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, + /*nodeNotFoundMessage*/ undefined, + /*nameArg*/ undefined, + /*isUse*/ true, + /*excludeGlobals*/ undefined, + /*getSpellingSuggestions*/ undefined); + } function getReferencedValueDeclaration(referenceIn) { if (!ts.isGeneratedIdentifier(referenceIn)) { var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier); @@ -88554,12 +89249,12 @@ var ts; getJsxFragmentFactoryEntity: getJsxFragmentFactoryEntity, getAllAccessorDeclarations: function (accessor) { accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); // TODO: GH#18217 - var otherKind = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? 172 /* SyntaxKind.GetAccessor */ : 173 /* SyntaxKind.SetAccessor */; + var otherKind = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? 174 /* SyntaxKind.GetAccessor */ : 175 /* SyntaxKind.SetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind); var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor; var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor; - var setAccessor = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; - var getAccessor = accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; + var setAccessor = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; + var getAccessor = accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; return { firstAccessor: firstAccessor, secondAccessor: secondAccessor, @@ -88575,7 +89270,7 @@ var ts; }, getDeclarationStatementsForSourceFile: function (node, flags, tracker, bundled) { var n = ts.getParseTreeNode(node); - ts.Debug.assert(n && n.kind === 305 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); + ts.Debug.assert(n && n.kind === 308 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); var sym = getSymbolOfNode(node); if (!sym) { return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker, bundled); @@ -88612,7 +89307,7 @@ var ts; return false; } function isInHeritageClause(node) { - return node.parent && node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */; + return node.parent && node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */; } // defined here to avoid outer scope pollution function getTypeReferenceDirectivesForEntityName(node) { @@ -88625,12 +89320,12 @@ var ts; // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries var meaning; - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } else { meaning = 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */; - if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { + if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } } @@ -88679,7 +89374,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 305 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 308 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -88707,12 +89402,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); // TODO: GH#18217 if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 305 /* SyntaxKind.SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 308 /* SyntaxKind.SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -88924,14 +89619,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) { - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (ts.hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -88950,26 +89645,26 @@ var ts; var modifier = _a[_i]; if (ts.isDecorator(modifier)) continue; - if (modifier.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.kind === 166 /* SyntaxKind.PropertySignature */ || node.kind === 168 /* SyntaxKind.MethodSignature */) { + if (modifier.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.kind === 168 /* SyntaxKind.PropertySignature */ || node.kind === 170 /* SyntaxKind.MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 176 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } - if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 144 /* SyntaxKind.OutKeyword */) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 145 /* SyntaxKind.OutKeyword */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 85 /* SyntaxKind.ConstKeyword */: - if (node.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(85 /* SyntaxKind.ConstKeyword */)); } break; - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "override"); @@ -88980,7 +89675,10 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor"); + } + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); } flags |= 16384 /* ModifierFlags.Override */; @@ -88999,16 +89697,19 @@ var ts; else if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor"); + } else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { if (modifier.kind === 121 /* SyntaxKind.PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } @@ -89028,16 +89729,19 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); + } + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -89046,11 +89750,26 @@ var ts; flags |= 32 /* ModifierFlags.Static */; lastStatic = modifier; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "accessor"); + } + else if (flags & 64 /* ModifierFlags.Readonly */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); + } + else if (flags & 2 /* ModifierFlags.Ambient */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); + } + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */) { + return grammarErrorOnNode(modifier, ts.Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); + } + flags |= 128 /* ModifierFlags.Accessor */; + break; + case 146 /* SyntaxKind.ReadonlyKeyword */: if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */ && node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 164 /* SyntaxKind.Parameter */) { + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */ && node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 166 /* SyntaxKind.Parameter */) { // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } @@ -89063,35 +89782,35 @@ var ts; else if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (ts.isClassLike(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* ModifierFlags.Export */; break; case 88 /* SyntaxKind.DefaultKeyword */: - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } else if (!(flags & 1 /* ModifierFlags.Export */)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); } - flags |= 512 /* ModifierFlags.Default */; + flags |= 1024 /* ModifierFlags.Default */; break; - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -89100,10 +89819,10 @@ var ts; else if (ts.isClassLike(node.parent) && !ts.isPropertyDeclaration(node)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } else if (ts.isPrivateIdentifierClassElementDeclaration(node)) { @@ -89113,18 +89832,18 @@ var ts; lastDeclare = modifier; break; case 126 /* SyntaxKind.AbstractKeyword */: - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - node.kind !== 180 /* SyntaxKind.ConstructorType */) { - if (node.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - node.kind !== 172 /* SyntaxKind.GetAccessor */ && - node.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (node.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + node.kind !== 182 /* SyntaxKind.ConstructorType */) { + if (node.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + node.kind !== 174 /* SyntaxKind.GetAccessor */ && + node.kind !== 175 /* SyntaxKind.SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */))) { + if (!(node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* ModifierFlags.Static */) { @@ -89133,39 +89852,42 @@ var ts; if (flags & 8 /* ModifierFlags.Private */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } - if (flags & 256 /* ModifierFlags.Async */ && lastAsync) { + if (flags & 512 /* ModifierFlags.Async */ && lastAsync) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); } + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); + } } if (ts.isNamedDeclaration(node) && node.name.kind === 80 /* SyntaxKind.PrivateIdentifier */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); } - flags |= 128 /* ModifierFlags.Abstract */; + flags |= 256 /* ModifierFlags.Abstract */; break; - case 131 /* SyntaxKind.AsyncKeyword */: - if (flags & 256 /* ModifierFlags.Async */) { + case 132 /* SyntaxKind.AsyncKeyword */: + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* ModifierFlags.Ambient */ || node.parent.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } - flags |= 256 /* ModifierFlags.Async */; + flags |= 512 /* ModifierFlags.Async */; lastAsync = modifier; break; case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: var inOutFlag = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? 32768 /* ModifierFlags.In */ : 65536 /* ModifierFlags.Out */; var inOutText = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? "in" : "out"; - if (node.kind !== 163 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { + if (node.kind !== 165 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); } if (flags & inOutFlag) { @@ -89178,28 +89900,28 @@ var ts; break; } } - if (node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 173 /* SyntaxKind.Constructor */) { if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(lastOverride, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override"); // TODO: GH#18217 } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return false; } - else if ((node.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { + else if ((node.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return checkGrammarAsyncModifier(node, lastAsync); } return false; @@ -89217,47 +89939,47 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 179 /* SyntaxKind.FunctionType */: - case 276 /* SyntaxKind.MissingDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 279 /* SyntaxKind.MissingDeclaration */: return true; default: - if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return false; } switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - return nodeHasAnyModifiersExcept(node, 131 /* SyntaxKind.AsyncKeyword */); - case 257 /* SyntaxKind.ClassDeclaration */: - case 180 /* SyntaxKind.ConstructorType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + return nodeHasAnyModifiersExcept(node, 132 /* SyntaxKind.AsyncKeyword */); + case 260 /* SyntaxKind.ClassDeclaration */: + case 182 /* SyntaxKind.ConstructorType */: return nodeHasAnyModifiersExcept(node, 126 /* SyntaxKind.AbstractKeyword */); - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 85 /* SyntaxKind.ConstKeyword */); default: ts.Debug.assertNever(node); @@ -89275,10 +89997,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); @@ -89507,20 +90229,20 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 221 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { + if (computedPropertyName.expression.kind === 223 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } return false; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.Debug.assert(node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */); if (node.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -89539,7 +90261,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (prop.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (inDestructuring) { // a rest property cannot be destructured any further var expression = ts.skipParentheses(prop.expression); @@ -89550,11 +90272,11 @@ var ts; continue; } var name = prop.name; - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern); @@ -89566,7 +90288,7 @@ var ts; if (ts.canHaveModifiers(prop) && prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (ts.isModifier(mod) && (mod.kind !== 131 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 169 /* SyntaxKind.MethodDeclaration */)) { + if (ts.isModifier(mod) && (mod.kind !== 132 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 171 /* SyntaxKind.MethodDeclaration */)) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -89587,8 +90309,8 @@ var ts; // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; switch (prop.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); @@ -89597,13 +90319,13 @@ var ts; } currentKind = 4 /* DeclarationMeaning.PropertyAssignment */; break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: currentKind = 8 /* DeclarationMeaning.Method */; break; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: currentKind = 1 /* DeclarationMeaning.GetAccessor */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: currentKind = 2 /* DeclarationMeaning.SetAccessor */; break; default: @@ -89646,7 +90368,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (attr.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { continue; } var name = attr.name, initializer = attr.initializer; @@ -89656,7 +90378,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 288 /* SyntaxKind.JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 291 /* SyntaxKind.JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -89691,7 +90413,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 244 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 247 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { if (!(forInOrOfStatement.flags & 32768 /* NodeFlags.AwaitContext */)) { var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement); if (ts.isInTopLevelContext(forInOrOfStatement)) { @@ -89725,7 +90447,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); var func = ts.getContainingFunction(forInOrOfStatement); - if (func && func.kind !== 171 /* SyntaxKind.Constructor */) { + if (func && func.kind !== 173 /* SyntaxKind.Constructor */) { ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* FunctionFlags.Async */) === 0, "Enclosing function should never be an async function."); var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); @@ -89742,7 +90464,7 @@ var ts; grammarErrorOnNode(forInOrOfStatement.initializer, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); return false; } - if (forInOrOfStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -89757,20 +90479,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -89780,22 +90502,22 @@ var ts; return false; } function checkGrammarAccessor(accessor) { - if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 182 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 184 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */)) { if (languageVersion < 1 /* ScriptTarget.ES5 */) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(accessor.name)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } - if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } if (accessor.body) { - if (ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); } - if (accessor.parent.kind === 182 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (accessor.parent.kind === 184 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return grammarErrorOnNode(accessor.body, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } } @@ -89803,11 +90525,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? + return grammarErrorOnNode(accessor.name, accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -89829,17 +90551,17 @@ var ts; * A set accessor has one parameter or a `this` parameter and one more parameter. */ function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { return ts.getThisParameter(accessor); } } function checkGrammarTypeOperatorNode(node) { - if (node.operator === 154 /* SyntaxKind.UniqueKeyword */) { - if (node.type.kind !== 151 /* SyntaxKind.SymbolKeyword */) { - return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + if (node.operator === 156 /* SyntaxKind.UniqueKeyword */) { + if (node.type.kind !== 153 /* SyntaxKind.SymbolKeyword */) { + return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } var parent = ts.walkUpParenthesizedTypes(node.parent); if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) { @@ -89849,7 +90571,7 @@ var ts; } } switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: var decl = parent; if (decl.name.kind !== 79 /* SyntaxKind.Identifier */) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -89861,13 +90583,13 @@ var ts; return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (!ts.isStatic(parent) || !ts.hasEffectiveReadonlyModifier(parent)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (!ts.hasSyntacticModifier(parent, 64 /* ModifierFlags.Readonly */)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); } @@ -89876,9 +90598,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here); } } - else if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.type.kind !== 183 /* SyntaxKind.ArrayType */ && node.type.kind !== 184 /* SyntaxKind.TupleType */) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + else if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.type.kind !== 185 /* SyntaxKind.ArrayType */ && node.type.kind !== 186 /* SyntaxKind.TupleType */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } } } @@ -89891,10 +90613,10 @@ var ts; if (checkGrammarFunctionLikeDeclaration(node)) { return true; } - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */) { - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */) { + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 131 /* SyntaxKind.AsyncKeyword */)) { + if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 132 /* SyntaxKind.AsyncKeyword */)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { @@ -89923,14 +90645,14 @@ var ts; if (node.flags & 16777216 /* NodeFlags.Ambient */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !node.body) { + else if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !node.body) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) { + else if (node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } @@ -89941,11 +90663,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: if (node.label && current.label.escapedText === node.label.escapedText) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 245 /* SyntaxKind.ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 248 /* SyntaxKind.ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -89953,8 +90675,8 @@ var ts; return false; } break; - case 249 /* SyntaxKind.SwitchStatement */: - if (node.kind === 246 /* SyntaxKind.BreakStatement */ && !node.label) { + case 252 /* SyntaxKind.SwitchStatement */: + if (node.kind === 249 /* SyntaxKind.BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -89969,13 +90691,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -89999,12 +90721,12 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return ts.isStringOrNumericLiteralLike(expr) || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; } function isBigIntLiteralExpression(expr) { return expr.kind === 9 /* SyntaxKind.BigIntLiteral */ || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 9 /* SyntaxKind.BigIntLiteral */; } function isSimpleLiteralEnumReference(expr) { @@ -90032,7 +90754,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 247 /* SyntaxKind.ForOfStatement */) { if (node.flags & 16777216 /* NodeFlags.Ambient */) { checkAmbientInitializer(node); } @@ -90045,7 +90767,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 237 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { + if (node.exclamationToken && (node.parent.parent.kind !== 240 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { var message = node.initializer ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type @@ -90112,15 +90834,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return false; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -90214,8 +90936,14 @@ var ts; if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(node.name)) { return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } + if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isAutoAccessorPropertyDeclaration(node)) { + return grammarErrorOnNode(node.name, ts.Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (ts.isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_accessor_property_cannot_be_declared_optional)) { + return true; + } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } @@ -90261,14 +90989,14 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */)) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); @@ -90276,7 +91004,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 237 /* SyntaxKind.VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 240 /* SyntaxKind.VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -90299,7 +91027,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 235 /* SyntaxKind.Block */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 238 /* SyntaxKind.Block */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { var links_2 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_2.hasReportedStatementInAmbientContext) { @@ -90321,10 +91049,10 @@ var ts; if (languageVersion >= 1 /* ScriptTarget.ES5 */) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 196 /* SyntaxKind.LiteralType */)) { + else if (ts.isChildOfNodeWithKind(node, 198 /* SyntaxKind.LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 299 /* SyntaxKind.EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 302 /* SyntaxKind.EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -90396,7 +91124,7 @@ var ts; if (node.isTypeOnly && node.name && node.namedBindings) { return grammarErrorOnNode(node, ts.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both); } - if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 269 /* SyntaxKind.NamedImports */) { + if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 272 /* SyntaxKind.NamedImports */) { return checkGrammarNamedImportsOrExports(node.namedBindings); } return false; @@ -90404,7 +91132,7 @@ var ts; function checkGrammarNamedImportsOrExports(namedBindings) { return !!ts.forEach(namedBindings.elements, function (specifier) { if (specifier.isTypeOnly) { - return grammarErrorOnFirstToken(specifier, specifier.kind === 270 /* SyntaxKind.ImportSpecifier */ + return grammarErrorOnFirstToken(specifier, specifier.kind === 273 /* SyntaxKind.ImportSpecifier */ ? ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement); } @@ -90527,14 +91255,14 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 169 /* SyntaxKind.MethodDeclaration */) || + return (declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 171 /* SyntaxKind.MethodDeclaration */) || !!declaration.body; } /** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */ function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -90570,6 +91298,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var _a; function visitNode(node, visitor, test, lift) { if (node === undefined || visitor === undefined) { return node; @@ -90636,7 +91365,6 @@ var ts; return nodes; } ts.visitNodes = visitNodes; - /* @internal */ function visitArray(nodes, visitor, test, start, count) { if (nodes === undefined) { return nodes; @@ -90784,12 +91512,10 @@ var ts; return updated; } ts.visitFunctionBody = visitFunctionBody; - /** - * Visits an iteration body, adding any block-scoped variables required by the transformation. - */ - function visitIterationBody(body, visitor, context) { + function visitIterationBody(body, visitor, context, nodeVisitor) { + if (nodeVisitor === void 0) { nodeVisitor = visitNode; } context.startBlockScope(); - var updated = visitNode(body, visitor, ts.isStatement, context.factory.liftToBlock); + var updated = nodeVisitor(body, visitor, ts.isStatement, context.factory.liftToBlock); var declarations = context.endBlockScope(); if (ts.some(declarations)) { if (ts.isBlock(updated)) { @@ -90808,456 +91534,446 @@ var ts; if (node === undefined) { return undefined; } - var kind = node.kind; - // No need to visit nodes with no children. - if ((kind > 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */) || kind === 192 /* SyntaxKind.ThisType */) { - return node; - } - var factory = context.factory; - switch (kind) { - // Names - case 79 /* SyntaxKind.Identifier */: - ts.Debug.type(node); - return factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); - case 161 /* SyntaxKind.QualifiedName */: - ts.Debug.type(node); - return factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); - case 162 /* SyntaxKind.ComputedPropertyName */: - ts.Debug.type(node); - return factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Signature elements - case 163 /* SyntaxKind.TypeParameter */: - ts.Debug.type(node); - return factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); - case 164 /* SyntaxKind.Parameter */: - ts.Debug.type(node); - return factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 165 /* SyntaxKind.Decorator */: - ts.Debug.type(node); - return factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Type elements - case 166 /* SyntaxKind.PropertySignature */: - ts.Debug.type(node); - return factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 167 /* SyntaxKind.PropertyDeclaration */: - ts.Debug.type(node); - return factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), - // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too - nodeVisitor(node.questionToken || node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 168 /* SyntaxKind.MethodSignature */: - ts.Debug.type(node); - return factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 169 /* SyntaxKind.MethodDeclaration */: - ts.Debug.type(node); - return factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 171 /* SyntaxKind.Constructor */: - ts.Debug.type(node); - return factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 172 /* SyntaxKind.GetAccessor */: - ts.Debug.type(node); - return factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 173 /* SyntaxKind.SetAccessor */: - ts.Debug.type(node); - return factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - ts.Debug.type(node); - context.startLexicalEnvironment(); - context.suspendLexicalEnvironment(); - return factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 174 /* SyntaxKind.CallSignature */: - ts.Debug.type(node); - return factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 175 /* SyntaxKind.ConstructSignature */: - ts.Debug.type(node); - return factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 176 /* SyntaxKind.IndexSignature */: - ts.Debug.type(node); - return factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - // Types - case 177 /* SyntaxKind.TypePredicate */: - ts.Debug.type(node); - return factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 178 /* SyntaxKind.TypeReference */: - ts.Debug.type(node); - return factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 179 /* SyntaxKind.FunctionType */: - ts.Debug.type(node); - return factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 180 /* SyntaxKind.ConstructorType */: - ts.Debug.type(node); - return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 181 /* SyntaxKind.TypeQuery */: - ts.Debug.type(node); - return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 182 /* SyntaxKind.TypeLiteral */: - ts.Debug.type(node); - return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 183 /* SyntaxKind.ArrayType */: - ts.Debug.type(node); - return factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); - case 184 /* SyntaxKind.TupleType */: - ts.Debug.type(node); - return factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); - case 185 /* SyntaxKind.OptionalType */: - ts.Debug.type(node); - return factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 186 /* SyntaxKind.RestType */: - ts.Debug.type(node); - return factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 187 /* SyntaxKind.UnionType */: - ts.Debug.type(node); - return factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 188 /* SyntaxKind.IntersectionType */: - ts.Debug.type(node); - return factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 189 /* SyntaxKind.ConditionalType */: - ts.Debug.type(node); - return factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); - case 190 /* SyntaxKind.InferType */: - ts.Debug.type(node); - return factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); - case 200 /* SyntaxKind.ImportType */: - ts.Debug.type(node); - return factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isNode), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - ts.Debug.type(node); - return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine); - case 197 /* SyntaxKind.NamedTupleMember */: - ts.Debug.type(node); - return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 191 /* SyntaxKind.ParenthesizedType */: - ts.Debug.type(node); - return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 193 /* SyntaxKind.TypeOperator */: - ts.Debug.type(node); - return factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 194 /* SyntaxKind.IndexedAccessType */: - ts.Debug.type(node); - return factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); - case 195 /* SyntaxKind.MappedType */: - ts.Debug.type(node); - return factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 196 /* SyntaxKind.LiteralType */: - ts.Debug.type(node); - return factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); - case 198 /* SyntaxKind.TemplateLiteralType */: - ts.Debug.type(node); - return factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - ts.Debug.type(node); - return factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: - ts.Debug.type(node); - return factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); - case 202 /* SyntaxKind.ArrayBindingPattern */: - ts.Debug.type(node); - return factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); - case 203 /* SyntaxKind.BindingElement */: - ts.Debug.type(node); - return factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Expression - case 204 /* SyntaxKind.ArrayLiteralExpression */: - ts.Debug.type(node); - return factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - ts.Debug.type(node); - return factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 206 /* SyntaxKind.PropertyAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)); - } - ts.Debug.type(node); - return factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); - case 207 /* SyntaxKind.ElementAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - case 208 /* SyntaxKind.CallExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 209 /* SyntaxKind.NewExpression */: - ts.Debug.type(node); - return factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - ts.Debug.type(node); - return factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); - case 211 /* SyntaxKind.TypeAssertionExpression */: - ts.Debug.type(node); - return factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 212 /* SyntaxKind.ParenthesizedExpression */: - ts.Debug.type(node); - return factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 213 /* SyntaxKind.FunctionExpression */: - ts.Debug.type(node); - return factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 214 /* SyntaxKind.ArrowFunction */: - ts.Debug.type(node); - return factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 215 /* SyntaxKind.DeleteExpression */: - ts.Debug.type(node); - return factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 216 /* SyntaxKind.TypeOfExpression */: - ts.Debug.type(node); - return factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 217 /* SyntaxKind.VoidExpression */: - ts.Debug.type(node); - return factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 218 /* SyntaxKind.AwaitExpression */: - ts.Debug.type(node); - return factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 221 /* SyntaxKind.BinaryExpression */: - ts.Debug.type(node); - return factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); - case 222 /* SyntaxKind.ConditionalExpression */: - ts.Debug.type(node); - return factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); - case 223 /* SyntaxKind.TemplateExpression */: - ts.Debug.type(node); - return factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); - case 224 /* SyntaxKind.YieldExpression */: - ts.Debug.type(node); - return factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 225 /* SyntaxKind.SpreadElement */: - ts.Debug.type(node); - return factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 226 /* SyntaxKind.ClassExpression */: - ts.Debug.type(node); - return factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - ts.Debug.type(node); - return factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 229 /* SyntaxKind.AsExpression */: - ts.Debug.type(node); - return factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 230 /* SyntaxKind.NonNullExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 231 /* SyntaxKind.MetaProperty */: - ts.Debug.type(node); - return factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Misc - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.type(node); - return factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Element - case 235 /* SyntaxKind.Block */: - ts.Debug.type(node); - return factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 237 /* SyntaxKind.VariableStatement */: - ts.Debug.type(node); - return factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 238 /* SyntaxKind.ExpressionStatement */: - ts.Debug.type(node); - return factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 239 /* SyntaxKind.IfStatement */: - ts.Debug.type(node); - return factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, factory.liftToBlock)); - case 240 /* SyntaxKind.DoStatement */: - ts.Debug.type(node); - return factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 241 /* SyntaxKind.WhileStatement */: - ts.Debug.type(node); - return factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 242 /* SyntaxKind.ForStatement */: - ts.Debug.type(node); - return factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 243 /* SyntaxKind.ForInStatement */: - ts.Debug.type(node); - return factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 244 /* SyntaxKind.ForOfStatement */: - ts.Debug.type(node); - return factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 245 /* SyntaxKind.ContinueStatement */: - ts.Debug.type(node); - return factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 246 /* SyntaxKind.BreakStatement */: - ts.Debug.type(node); - return factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 247 /* SyntaxKind.ReturnStatement */: - ts.Debug.type(node); - return factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 248 /* SyntaxKind.WithStatement */: - ts.Debug.type(node); - return factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 249 /* SyntaxKind.SwitchStatement */: - ts.Debug.type(node); - return factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); - case 250 /* SyntaxKind.LabeledStatement */: - ts.Debug.type(node); - return factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 251 /* SyntaxKind.ThrowStatement */: - ts.Debug.type(node); - return factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 252 /* SyntaxKind.TryStatement */: - ts.Debug.type(node); - return factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); - case 254 /* SyntaxKind.VariableDeclaration */: - ts.Debug.type(node); - return factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 255 /* SyntaxKind.VariableDeclarationList */: - ts.Debug.type(node); - return factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); - case 256 /* SyntaxKind.FunctionDeclaration */: - ts.Debug.type(node); - return factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 257 /* SyntaxKind.ClassDeclaration */: - ts.Debug.type(node); - return factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 258 /* SyntaxKind.InterfaceDeclaration */: - ts.Debug.type(node); - return factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - ts.Debug.type(node); - return factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 260 /* SyntaxKind.EnumDeclaration */: - ts.Debug.type(node); - return factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); - case 261 /* SyntaxKind.ModuleDeclaration */: - ts.Debug.type(node); - return factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); - case 262 /* SyntaxKind.ModuleBlock */: - ts.Debug.type(node); - return factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 263 /* SyntaxKind.CaseBlock */: - ts.Debug.type(node); - return factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - ts.Debug.type(node); - return factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - ts.Debug.type(node); - return factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); - case 266 /* SyntaxKind.ImportDeclaration */: - ts.Debug.type(node); - return factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 293 /* SyntaxKind.AssertClause */: - ts.Debug.type(node); - return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); - case 294 /* SyntaxKind.AssertEntry */: - ts.Debug.type(node); - return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode)); - case 267 /* SyntaxKind.ImportClause */: - ts.Debug.type(node); - return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); - case 268 /* SyntaxKind.NamespaceImport */: - ts.Debug.type(node); - return factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 274 /* SyntaxKind.NamespaceExport */: - ts.Debug.type(node); - return factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 269 /* SyntaxKind.NamedImports */: - ts.Debug.type(node); - return factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); - case 270 /* SyntaxKind.ImportSpecifier */: - ts.Debug.type(node); - return factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 271 /* SyntaxKind.ExportAssignment */: - ts.Debug.type(node); - return factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 272 /* SyntaxKind.ExportDeclaration */: - ts.Debug.type(node); - return factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 273 /* SyntaxKind.NamedExports */: - ts.Debug.type(node); - return factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); - case 275 /* SyntaxKind.ExportSpecifier */: - ts.Debug.type(node); - return factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: - ts.Debug.type(node); - return factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // JSX - case 278 /* SyntaxKind.JsxElement */: - ts.Debug.type(node); - return factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - ts.Debug.type(node); - return factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 280 /* SyntaxKind.JsxOpeningElement */: - ts.Debug.type(node); - return factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 281 /* SyntaxKind.JsxClosingElement */: - ts.Debug.type(node); - return factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 282 /* SyntaxKind.JsxFragment */: - ts.Debug.type(node); - return factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 285 /* SyntaxKind.JsxAttribute */: - ts.Debug.type(node); - return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 286 /* SyntaxKind.JsxAttributes */: - ts.Debug.type(node); - return factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - ts.Debug.type(node); - return factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 288 /* SyntaxKind.JsxExpression */: - ts.Debug.type(node); - return factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Clauses - case 289 /* SyntaxKind.CaseClause */: - ts.Debug.type(node); - return factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 290 /* SyntaxKind.DefaultClause */: - ts.Debug.type(node); - return factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 291 /* SyntaxKind.HeritageClause */: - ts.Debug.type(node); - return factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 292 /* SyntaxKind.CatchClause */: - ts.Debug.type(node); - return factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); - // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: - ts.Debug.type(node); - return factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - ts.Debug.type(node); - return factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 298 /* SyntaxKind.SpreadAssignment */: - ts.Debug.type(node); - return factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Enum - case 299 /* SyntaxKind.EnumMember */: - ts.Debug.type(node); - return factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: - ts.Debug.type(node); - return factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context)); - // Transformation nodes - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - ts.Debug.type(node); - return factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 351 /* SyntaxKind.CommaListExpression */: - ts.Debug.type(node); - return factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - default: - // No need to visit nodes with no children. - return node; - } + var fn = visitEachChildTable[node.kind]; + return fn === undefined ? node : fn(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor); } ts.visitEachChild = visitEachChild; + // NOTE: Before you can add a new method to `visitEachChildTable`, you must first ensure the `Node` subtype you + // wish to add is defined in the `HasChildren` union in types.ts. + var visitEachChildTable = (_a = {}, + _a[79 /* SyntaxKind.Identifier */] = function visitEachChildOfIdentifier(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); + }, + _a[163 /* SyntaxKind.QualifiedName */] = function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Signature elements + _a[165 /* SyntaxKind.TypeParameter */] = function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); + }, + _a[166 /* SyntaxKind.Parameter */] = function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[167 /* SyntaxKind.Decorator */] = function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Type elements + _a[168 /* SyntaxKind.PropertySignature */] = function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + var _a; + return context.factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), + // QuestionToken and ExclamationToken are mutually exclusive in PropertyDeclaration + nodeVisitor((_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[171 /* SyntaxKind.MethodDeclaration */] = function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[173 /* SyntaxKind.Constructor */] = function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + context.startLexicalEnvironment(); + context.suspendLexicalEnvironment(); + return context.factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[176 /* SyntaxKind.CallSignature */] = function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[177 /* SyntaxKind.ConstructSignature */] = function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + // Types + _a[179 /* SyntaxKind.TypePredicate */] = function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[180 /* SyntaxKind.TypeReference */] = function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[181 /* SyntaxKind.FunctionType */] = function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[185 /* SyntaxKind.ArrayType */] = function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); + }, + _a[186 /* SyntaxKind.TupleType */] = function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); + }, + _a[187 /* SyntaxKind.OptionalType */] = function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[188 /* SyntaxKind.RestType */] = function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[189 /* SyntaxKind.UnionType */] = function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[190 /* SyntaxKind.IntersectionType */] = function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[191 /* SyntaxKind.ConditionalType */] = function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); + }, + _a[192 /* SyntaxKind.InferType */] = function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + }, + _a[202 /* SyntaxKind.ImportType */] = function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isImportTypeAssertionContainer), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isAssertClause), node.multiLine); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[195 /* SyntaxKind.TypeOperator */] = function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[196 /* SyntaxKind.IndexedAccessType */] = function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); + }, + _a[197 /* SyntaxKind.MappedType */] = function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[198 /* SyntaxKind.LiteralType */] = function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Binding patterns + _a[203 /* SyntaxKind.ObjectBindingPattern */] = function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); + }, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + }, + _a[205 /* SyntaxKind.BindingElement */] = function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Expression + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isPropertyAccessChain(node) ? + context.factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)) : + context.factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isElementAccessChain(node) ? + context.factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)) : + context.factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); + }, + _a[210 /* SyntaxKind.CallExpression */] = function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isCallChain(node) ? + context.factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)) : + context.factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[211 /* SyntaxKind.NewExpression */] = function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[228 /* SyntaxKind.ClassExpression */] = function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[231 /* SyntaxKind.AsExpression */] = function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSatisfiesExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return ts.isOptionalChain(node) ? + context.factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)) : + context.factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Misc + _a[236 /* SyntaxKind.TemplateSpan */] = function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Element + _a[238 /* SyntaxKind.Block */] = function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[242 /* SyntaxKind.IfStatement */] = function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, context.factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[243 /* SyntaxKind.DoStatement */] = function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context, nodeVisitor), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[245 /* SyntaxKind.ForStatement */] = function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[249 /* SyntaxKind.BreakStatement */] = function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[250 /* SyntaxKind.ReturnStatement */] = function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[251 /* SyntaxKind.WithStatement */] = function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[255 /* SyntaxKind.TryStatement */] = function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); + }, + _a[265 /* SyntaxKind.ModuleBlock */] = function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[296 /* SyntaxKind.AssertClause */] = function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpression)); + }, + _a[270 /* SyntaxKind.ImportClause */] = function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[272 /* SyntaxKind.NamedImports */] = function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[274 /* SyntaxKind.ExportAssignment */] = function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[275 /* SyntaxKind.ExportDeclaration */] = function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[276 /* SyntaxKind.NamedExports */] = function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + }, + _a[278 /* SyntaxKind.ExportSpecifier */] = function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Module references + _a[280 /* SyntaxKind.ExternalModuleReference */] = function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // JSX + _a[281 /* SyntaxKind.JsxElement */] = function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[283 /* SyntaxKind.JsxOpeningElement */] = function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + }, + _a[289 /* SyntaxKind.JsxAttributes */] = function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Clauses + _a[292 /* SyntaxKind.CaseClause */] = function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + }, + _a[295 /* SyntaxKind.CatchClause */] = function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); + }, + // Property assignments + _a[299 /* SyntaxKind.PropertyAssignment */] = function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Enum + _a[302 /* SyntaxKind.EnumMember */] = function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Top-level nodes + _a[308 /* SyntaxKind.SourceFile */] = function visitEachChildOfSourceFile(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context, /*start*/ undefined, /*ensureUseStrict*/ undefined, nodesVisitor)); + }, + // Transformation nodes + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a); /** * Extracts the single node from a NodeArray. * @@ -91325,7 +92041,7 @@ var ts; exit(); return sourceIndex; } - /* eslint-disable boolean-trivia, no-null/no-null */ + /* eslint-disable local/boolean-trivia, no-null/no-null */ function setSourceContent(sourceIndex, content) { enter(); if (content !== null) { @@ -91338,7 +92054,7 @@ var ts; } exit(); } - /* eslint-enable boolean-trivia, no-null/no-null */ + /* eslint-enable local/boolean-trivia, no-null/no-null */ function addName(name) { enter(); if (!nameToNameIndexMap) @@ -91940,7 +92656,7 @@ var ts; function chainBundle(context, transformSourceFile) { return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -91991,7 +92707,7 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" @@ -92004,13 +92720,13 @@ var ts; hasImportDefault = true; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - if (node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + if (node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -92041,13 +92757,13 @@ var ts; addExportedNamesForExportDeclaration(node); } break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { for (var _b = 0, _c = node.declarationList.declarations; _b < _c.length; _b++) { var decl = _c[_b]; @@ -92055,9 +92771,9 @@ var ts; } } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default function() { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -92075,9 +92791,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default class { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -92255,7 +92971,7 @@ var ts; * @param isStatic A value indicating whether the member should be a static or instance member. */ function isInitializedProperty(member) { - return member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + return member.kind === 169 /* SyntaxKind.PropertyDeclaration */ && member.initializer !== undefined; } ts.isInitializedProperty = isInitializedProperty; @@ -92265,7 +92981,7 @@ var ts; * @param member The class element node. */ function isNonStaticMethodOrAccessorWithPrivateName(member) { - return !ts.isStatic(member) && ts.isMethodOrAccessor(member) && ts.isPrivateIdentifier(member.name); + return !ts.isStatic(member) && (ts.isMethodOrAccessor(member) || ts.isAutoAccessorPropertyDeclaration(member)) && ts.isPrivateIdentifier(member.name); } ts.isNonStaticMethodOrAccessorWithPrivateName = isNonStaticMethodOrAccessorWithPrivateName; /** @@ -92319,12 +93035,12 @@ var ts; */ function getAllDecoratorsOfClassElement(member, parent) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return getAllDecoratorsOfAccessors(member, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -92985,8 +93701,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -93006,14 +93722,14 @@ var ts; var applicableSubstitutions; return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { return transformBundle(node); } return transformSourceFile(node); } function transformBundle(node) { return factory.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { return ts.createUnparsedSourceFile(prepend, "js"); } return prepend; @@ -93062,15 +93778,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 262 /* SyntaxKind.ModuleBlock */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 265 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: currentLexicalScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */)) { break; } @@ -93082,7 +93798,7 @@ var ts; // These nodes should always have names unless they are default-exports; // however, class declaration parsing allows for undefined names, so syntactically invalid // programs may also have an undefined name. - ts.Debug.assert(node.kind === 257 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)); + ts.Debug.assert(node.kind === 260 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)); } break; } @@ -93121,10 +93837,10 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitElidableStatement(node); default: return visitorWorker(node); @@ -93145,13 +93861,13 @@ var ts; return node; } switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -93171,11 +93887,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ || - (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && - node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */)) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ || + (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && + node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -93199,27 +93915,27 @@ var ts; */ function classElementVisitorWorker(node, parent) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructor(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Property declarations are not TypeScript syntax, but they must be visited // for the decorator transformation. return visitPropertyDeclaration(node, parent); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.visitEachChild(node, visitor, context); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return node; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Index signatures are elided return; default: @@ -93231,17 +93947,17 @@ var ts; } function objectLiteralElementVisitorWorker(node, parent) { switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return visitor(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); @@ -93252,7 +93968,7 @@ var ts; function modifierVisitor(node) { if (ts.isDecorator(node)) return undefined; - if (ts.modifierToFlag(node.kind) & 116958 /* ModifierFlags.TypeScriptModifier */) { + if (ts.modifierToFlag(node.kind) & 117086 /* ModifierFlags.TypeScriptModifier */) { return undefined; } else if (currentNamespace && node.kind === 93 /* SyntaxKind.ExportKeyword */) { @@ -93280,58 +93996,58 @@ var ts; case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: // TypeScript accessibility and readonly modifiers are elided // falls through - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 177 /* SyntaxKind.TypePredicate */: - case 163 /* SyntaxKind.TypeParameter */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 179 /* SyntaxKind.TypePredicate */: + case 165 /* SyntaxKind.TypeParameter */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 181 /* SyntaxKind.TypeQuery */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 189 /* SyntaxKind.ConditionalType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 192 /* SyntaxKind.ThisType */: - case 193 /* SyntaxKind.TypeOperator */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 196 /* SyntaxKind.LiteralType */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 183 /* SyntaxKind.TypeQuery */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 191 /* SyntaxKind.ConditionalType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 194 /* SyntaxKind.ThisType */: + case 195 /* SyntaxKind.TypeOperator */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 198 /* SyntaxKind.LiteralType */: // TypeScript type nodes are elided. // falls through - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // TypeScript index signatures are elided. return undefined; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // TypeScript type-only declarations are elided. return factory.createNotEmittedStatement(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // TypeScript namespace export declarations are elided. return undefined; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return factory.createNotEmittedStatement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // This may be a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93341,7 +94057,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // This may be a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93351,34 +94067,34 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: // This may be a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.Debug.fail("Class and object literal elements must be visited with their respective visitors"); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // This may be a parameter declaration with TypeScript syntax extensions. // // TypeScript parameter declaration syntax extensions include: @@ -93388,40 +94104,42 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return visitSatisfiesExpression(node); + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return visitJsxJsxOpeningElement(node); default: // node contains some other TypeScript syntax @@ -93691,10 +94409,10 @@ var ts; */ function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */; + return kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */; } /** * Determines whether to emit the "design:returntype" metadata based on the node's kind. @@ -93704,7 +94422,7 @@ var ts; * @param node The node to test. */ function shouldAddReturnTypeMetadata(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } /** * Determines whether to emit the "design:paramtypes" metadata based on the node's kind. @@ -93715,12 +94433,12 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; } return false; @@ -93810,7 +94528,7 @@ var ts; return !ts.nodeIsMissing(node.body); } function visitPropertyDeclaration(node, parent) { - var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); if (isAmbient && !ts.hasDecorators(node)) { return undefined; } @@ -93918,7 +94636,7 @@ var ts; * @param node The declaration node. */ function shouldEmitAccessorDeclaration(node) { - return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)); + return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)); } function visitGetAccessor(node, parent) { if (!(node.transformFlags & 1 /* TransformFlags.ContainsTypeScript */)) { @@ -94060,6 +94778,10 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); return factory.createPartiallyEmittedExpression(expression, node); } + function visitSatisfiesExpression(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } function visitCallExpression(node) { return factory.updateCallExpression(node, ts.visitNode(node.expression, visitor, ts.isExpression), /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); @@ -94273,12 +94995,12 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = factory.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), factory.createVariableDeclarationList([ factory.createVariableDeclaration(factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentLexicalScope.kind === 305 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); + ], currentLexicalScope.kind === 308 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind === 263 /* SyntaxKind.EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -94403,7 +95125,7 @@ var ts; var statementsLocation; var blockLocation; if (node.body) { - if (node.body.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (node.body.kind === 265 /* SyntaxKind.ModuleBlock */) { saveStateAndInvoke(node.body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = node.body.statements; blockLocation = node.body; @@ -94450,13 +95172,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (!node.body || node.body.kind !== 262 /* SyntaxKind.ModuleBlock */) { + if (!node.body || node.body.kind !== 265 /* SyntaxKind.ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* EmitFlags.NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -94503,7 +95225,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (node.kind === 271 /* SyntaxKind.NamespaceImport */) { // Elide a namespace import if it is not referenced. return shouldEmitAliasDeclaration(node) ? node : undefined; } @@ -94661,7 +95383,7 @@ var ts; */ function isNamedExternalModuleExport(node) { return isExternalModuleExport(node) - && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } /** * Gets a value indicating whether the node is the default export of an external module. @@ -94670,7 +95392,7 @@ var ts; */ function isDefaultExternalModuleExport(node) { return isExternalModuleExport(node) - && ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } function addExportMemberAssignment(statements, node) { var expression = factory.createAssignment(factory.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), factory.getLocalName(node)); @@ -94715,16 +95437,16 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(79 /* SyntaxKind.Identifier */); - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(261 /* SyntaxKind.ModuleDeclaration */); + context.enableEmitNotification(264 /* SyntaxKind.ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 261 /* SyntaxKind.ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 260 /* SyntaxKind.EnumDeclaration */; + return ts.getOriginalNode(node).kind === 263 /* SyntaxKind.EnumDeclaration */; } /** * Hook for node emit. @@ -94785,9 +95507,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -94802,9 +95524,9 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 305 /* SyntaxKind.SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 261 /* SyntaxKind.ModuleDeclaration */) || - (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 260 /* SyntaxKind.EnumDeclaration */); + if (container && container.kind !== 308 /* SyntaxKind.SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 264 /* SyntaxKind.ModuleDeclaration */) || + (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 263 /* SyntaxKind.EnumDeclaration */); if (substitute) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(container), node), /*location*/ node); @@ -94843,9 +95565,10 @@ var ts; return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined; } function shouldEmitAliasDeclaration(node) { - return compilerOptions.preserveValueImports - ? resolver.isValueAliasDeclaration(node) - : resolver.isReferencedAliasDeclaration(node); + return ts.isInJSFile(node) || + (compilerOptions.preserveValueImports + ? resolver.isValueAliasDeclaration(node) + : resolver.isReferencedAliasDeclaration(node)); } } ts.transformTypeScript = transformTypeScript; @@ -94893,13 +95616,24 @@ var ts; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions); + // Always transform field initializers using Set semantics when `useDefineForClassFields: false`. + var shouldTransformInitializersUsingSet = !useDefineForClassFields; + // Transform field initializers using Define semantics when `useDefineForClassFields: true` and target < ES2022. + var shouldTransformInitializersUsingDefine = useDefineForClassFields && languageVersion < 9 /* ScriptTarget.ES2022 */; + var shouldTransformInitializers = shouldTransformInitializersUsingSet || shouldTransformInitializersUsingDefine; + // We need to transform private members and class static blocks when target < ES2022. var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* ScriptTarget.ES2022 */; + // We need to transform `accessor` fields when target < ESNext + var shouldTransformAutoAccessors = languageVersion < 99 /* ScriptTarget.ESNext */; // We need to transform `this` in a static initializer into a reference to the class - // when targeting < ES2022 since the assignment will be moved outside of the class body. + // when target < ES2022 since the assignment will be moved outside of the class body. var shouldTransformThisInStaticInitializers = languageVersion < 9 /* ScriptTarget.ES2022 */; - // We don't need to transform `super` property access when targeting ES5, ES3 because + // We don't need to transform `super` property access when target <= ES5 because // the es2015 transformation handles those. var shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2 /* ScriptTarget.ES2015 */; + var shouldTransformAnything = shouldTransformInitializers || + shouldTransformPrivateElementsOrClassStaticBlocks || + shouldTransformAutoAccessors; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -94919,98 +95653,149 @@ var ts; var classLexicalEnvironmentStack = []; var classLexicalEnvironmentMap = new ts.Map(); var currentClassLexicalEnvironment; + var currentClassContainer; var currentComputedPropertyNameClassLexicalEnvironment; var currentStaticPropertyDeclarationOrStaticBlock; return ts.chainBundle(context, transformSourceFile); function transformSourceFile(node) { - var options = context.getCompilerOptions(); - if (node.isDeclarationFile - || useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9 /* ScriptTarget.ES2022 */) { + if (node.isDeclarationFile || !shouldTransformAnything) { return node; } var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); return visited; } - function visitorWorker(node, valueIsDiscarded) { - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) { - switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - return visitClassLike(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: - return visitVariableStatement(node); - case 80 /* SyntaxKind.PrivateIdentifier */: - return visitPrivateIdentifier(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitClassStaticBlockDeclaration(node); - } + function visitor(node) { + if (!(node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) && + !(node.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */)) { + return node; } - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */ || - node.transformFlags & 134217728 /* TransformFlags.ContainsLexicalSuper */ && - shouldTransformSuperInStaticInitializers && - currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: - return visitBinaryExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: - return visitCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitElementAccessExpression(node); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitExpressionStatement(node); - case 242 /* SyntaxKind.ForStatement */: - return visitForStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = undefined; - var result = ts.visitEachChild(node, visitor, context); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; - return result; - } + switch (node.kind) { + case 127 /* SyntaxKind.AccessorKeyword */: + return shouldTransformAutoAccessors ? undefined : node; + case 260 /* SyntaxKind.ClassDeclaration */: + return visitClassDeclaration(node); + case 228 /* SyntaxKind.ClassExpression */: + return visitClassExpression(node); + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + return visitClassStaticBlockDeclaration(node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return visitPropertyDeclaration(node); + case 240 /* SyntaxKind.VariableStatement */: + return visitVariableStatement(node); + case 80 /* SyntaxKind.PrivateIdentifier */: + return visitPrivateIdentifier(node); + case 208 /* SyntaxKind.PropertyAccessExpression */: + return visitPropertyAccessExpression(node); + case 209 /* SyntaxKind.ElementAccessExpression */: + return visitElementAccessExpression(node); + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ false); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ false); + case 210 /* SyntaxKind.CallExpression */: + return visitCallExpression(node); + case 241 /* SyntaxKind.ExpressionStatement */: + return visitExpressionStatement(node); + case 212 /* SyntaxKind.TaggedTemplateExpression */: + return visitTaggedTemplateExpression(node); + case 245 /* SyntaxKind.ForStatement */: + return visitForStatement(node); + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + // If we are descending into a new scope, clear the current static property or block + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, fallbackVisitor, node); } + default: + return fallbackVisitor(node); } + } + function fallbackVisitor(node) { return ts.visitEachChild(node, visitor, context); } + /** + * Visits a node in an expression whose result is discarded. + */ function discardedValueVisitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ true); - } - function visitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ false); + switch (node.kind) { + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ true); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ true); + default: + return visitor(node); + } } + /** + * Visits a node in a {@link HeritageClause}. + */ function heritageClauseVisitor(node) { switch (node.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return ts.visitEachChild(node, heritageClauseVisitor, context); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitExpressionWithTypeArguments(node); + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + return visitExpressionWithTypeArgumentsInHeritageClause(node); + default: + return visitor(node); } - return visitor(node); } - function visitorDestructuringTarget(node) { + /** + * Visits the assignment target of a destructuring assignment. + */ + function assignmentTargetVisitor(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitAssignmentPattern(node); default: return visitor(node); } } + /** + * Visits a member of a class. + */ + function classElementVisitor(node) { + switch (node.kind) { + case 173 /* SyntaxKind.Constructor */: + return visitConstructorDeclaration(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitMethodOrAccessorDeclaration, node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitPropertyDeclaration, node); + case 164 /* SyntaxKind.ComputedPropertyName */: + return visitComputedPropertyName(node); + case 237 /* SyntaxKind.SemicolonClassElement */: + return node; + default: + return visitor(node); + } + } + /** + * Visits the results of an auto-accessor field transformation in a second pass. + */ + function accessorFieldResultVisitor(node) { + switch (node.kind) { + case 169 /* SyntaxKind.PropertyDeclaration */: + return transformFieldInitializer(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return classElementVisitor(node); + default: + ts.Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); + break; + } + } /** * If we visit a private name, this means it is an undeclared private name. * Replace it with an empty identifier to indicate a problem with the code, @@ -95026,17 +95811,15 @@ var ts; } return ts.setOriginalNode(factory.createIdentifier(""), node); } + function isPrivateIdentifierInExpression(node) { + return ts.isPrivateIdentifier(node.left) + && node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; + } /** * Visits `#id in expr` */ - function visitPrivateIdentifierInInExpression(node) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return node; - } - var privId = node.left; - ts.Debug.assertNode(privId, ts.isPrivateIdentifier); - ts.Debug.assert(node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */); - var info = accessPrivateIdentifier(privId); + function transformPrivateIdentifierInInExpression(node) { + var info = accessPrivateIdentifier(node.left); if (info) { var receiver = ts.visitNode(node.right, visitor, ts.isExpression); return ts.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node); @@ -95044,31 +95827,6 @@ var ts; // Private name has not been declared. Subsequent transformers will handle this error return ts.visitEachChild(node, visitor, context); } - /** - * Visits the members of a class that has fields. - * - * @param node The node to visit. - */ - function classElementVisitor(node) { - switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - // Constructors for classes using class fields are transformed in - // `visitClassDeclaration` or `visitClassExpression`. - return undefined; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - return visitMethodOrAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitComputedPropertyName(node); - case 234 /* SyntaxKind.SemicolonClassElement */: - return node; - default: - return visitor(node); - } - } function visitVariableStatement(node) { var savedPendingStatements = pendingStatements; pendingStatements = []; @@ -95078,15 +95836,24 @@ var ts; pendingStatements = savedPendingStatements; return statement; } - function visitComputedPropertyName(name) { - var node = ts.visitEachChild(name, visitor, context); + function visitComputedPropertyName(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (ts.some(pendingExpressions)) { - var expressions = pendingExpressions; - expressions.push(node.expression); - pendingExpressions = []; - node = factory.updateComputedPropertyName(node, factory.inlineExpressions(expressions)); + if (ts.isParenthesizedExpression(expression)) { + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression.expression], false))); + } + else { + expression = factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression], false)); + } + pendingExpressions = undefined; } - return node; + return factory.updateComputedPropertyName(node, expression); + } + function visitConstructorDeclaration(node) { + if (currentClassContainer) { + return transformConstructor(node, currentClassContainer); + } + return fallbackVisitor(node); } function visitMethodOrAccessorDeclaration(node) { ts.Debug.assert(!ts.hasDecorators(node)); @@ -95101,13 +95868,20 @@ var ts; } var functionName = getHoistedFunctionName(node); if (functionName) { - getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m); }), node.asteriskToken, functionName, - /* typeParameters */ undefined, ts.visitParameterList(node.parameters, classElementVisitor, context), - /* type */ undefined, ts.visitFunctionBody(node.body, classElementVisitor, context)))); + getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m) && !ts.isAccessorModifier(m); }), node.asteriskToken, functionName, + /* typeParameters */ undefined, ts.visitParameterList(node.parameters, visitor, context), + /* type */ undefined, ts.visitFunctionBody(node.body, visitor, context)))); } // remove method declaration from class return undefined; } + function setCurrentStaticPropertyDeclarationOrStaticBlockAnd(current, visitor, arg) { + var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + currentStaticPropertyDeclarationOrStaticBlock = current; + var result = visitor(arg); + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return result; + } function getHoistedFunctionName(node) { ts.Debug.assert(ts.isPrivateIdentifier(node.name)); var info = accessPrivateIdentifier(node.name); @@ -95124,49 +95898,104 @@ var ts; } } } - function visitPropertyDeclaration(node) { - ts.Debug.assert(!ts.hasDecorators(node)); - if (ts.isPrivateIdentifier(node.name)) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - if (ts.isStatic(node)) { - // static fields are left as is - return ts.visitEachChild(node, visitor, context); - } - // Initializer is elided as the field is initialized in transformConstructor. - return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*questionOrExclamationToken*/ undefined, - /*type*/ undefined, - /*initializer*/ undefined); - } - // leave invalid code untransformed + function transformAutoAccessor(node) { + // transforms: + // accessor x = 1; + // into: + // #x = 1; + // get x() { return this.#x; } + // set x(value) { this.#x = value; } + ts.Debug.assertEachNode(node.modifiers, ts.isModifier); + var commentRange = ts.getCommentRange(node); + var sourceMapRange = ts.getSourceMapRange(node); + // Since we're creating two declarations where there was previously one, cache + // the expression for any computed property names. + var name = node.name; + var getterName = name; + var setterName = name; + if (ts.isComputedPropertyName(name) && !ts.isSimpleInlineableExpression(name.expression)) { + var temp = factory.createTempVariable(hoistVariableDeclaration); + ts.setSourceMapRange(temp, name.expression); + var expression = ts.visitNode(name.expression, visitor, ts.isExpression); + var assignment = factory.createAssignment(temp, expression); + ts.setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp])); + setterName = factory.updateComputedPropertyName(name, temp); + } + var backingField = ts.createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); + ts.setOriginalNode(backingField, node); + ts.setEmitFlags(backingField, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(backingField, sourceMapRange); + var getter = ts.createAccessorPropertyGetRedirector(factory, node, node.modifiers, getterName); + ts.setOriginalNode(getter, node); + ts.setCommentRange(getter, commentRange); + ts.setSourceMapRange(getter, sourceMapRange); + var setter = ts.createAccessorPropertySetRedirector(factory, node, node.modifiers, setterName); + ts.setOriginalNode(setter, node); + ts.setEmitFlags(setter, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(setter, sourceMapRange); + return ts.visitArray([backingField, getter, setter], accessorFieldResultVisitor, ts.isClassElement); + } + function transformPrivateFieldInitializer(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + // If we are transforming private elements into WeakMap/WeakSet, we should elide the node. var info = accessPrivateIdentifier(node.name); ts.Debug.assert(info, "Undeclared private name for property declaration."); - if (!info.isValid) { - return node; - } - } - // Create a temporary variable to store a computed property name (if necessary). - // If it's not inlineable, then we emit an expression after the class which assigns - // the property name to the temporary variable. - var expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer || useDefineForClassFields); - if (expr && !ts.isSimpleInlineableExpression(expr)) { - getPendingExpressions().push(expr); + // Leave invalid code untransformed; otherwise, elide the node as it is transformed elsewhere. + return info.isValid ? undefined : node; + } + if (shouldTransformInitializersUsingSet && !ts.isStatic(node)) { + // If we are transforming initializers using Set semantics we will elide the initializer as it will + // be moved to the constructor to preserve evaluation order next to public instance fields. We don't + // need to do this transformation for private static fields since public static fields can be + // transformed into `static {}` blocks. + return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + /*initializer*/ undefined); } - if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) { - var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); - if (initializerStatement) { - var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); - ts.setOriginalNode(staticBlock, node); - ts.setCommentRange(staticBlock, node); - // Set the comment range for the statement to an empty synthetic range - // and drop synthetic comments from the statement to avoid printing them twice. - ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); - ts.setSyntheticLeadingComments(initializerStatement, undefined); - ts.setSyntheticTrailingComments(initializerStatement, undefined); - return staticBlock; + return ts.visitEachChild(node, visitor, context); + } + function transformPublicFieldInitializer(node) { + if (shouldTransformInitializers) { + // Create a temporary variable to store a computed property name (if necessary). + // If it's not inlineable, then we emit an expression after the class which assigns + // the property name to the temporary variable. + var expr = getPropertyNameExpressionIfNeeded(node.name, /*shouldHoist*/ !!node.initializer || useDefineForClassFields); + if (expr) { + getPendingExpressions().push(expr); + } + if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks) { + var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); + if (initializerStatement) { + var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); + ts.setOriginalNode(staticBlock, node); + ts.setCommentRange(staticBlock, node); + // Set the comment range for the statement to an empty synthetic range + // and drop synthetic comments from the statement to avoid printing them twice. + ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); + ts.setSyntheticLeadingComments(initializerStatement, undefined); + ts.setSyntheticTrailingComments(initializerStatement, undefined); + return staticBlock; + } } + return undefined; } - return undefined; + return ts.visitEachChild(node, classElementVisitor, context); + } + function transformFieldInitializer(node) { + ts.Debug.assert(!ts.hasDecorators(node), "Decorators should already have been transformed and elided."); + return ts.isPrivateIdentifierClassElementDeclaration(node) ? + transformPrivateFieldInitializer(node) : + transformPublicFieldInitializer(node); + } + function visitPropertyDeclaration(node) { + // If this is an auto-accessor, we defer to `transformAutoAccessor`. That function + // will in turn call `transformFieldInitializer` as needed. + if (shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(node)) { + return transformAutoAccessor(node); + } + return transformFieldInitializer(node); } function createPrivateIdentifierAccess(info, receiver) { return createPrivateIdentifierAccessHelper(info, ts.visitNode(receiver, visitor, ts.isExpression)); @@ -95230,9 +96059,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) { - if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || node.operator === 46 /* SyntaxKind.MinusMinusToken */) { + if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || + node.operator === 46 /* SyntaxKind.MinusMinusToken */) { var operand = ts.skipParentheses(node.operand); - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(operand)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(operand)) { var info = void 0; if (info = accessPrivateIdentifier(operand.name)) { var receiver = ts.visitNode(operand.expression, visitor, ts.isExpression); @@ -95321,7 +96152,9 @@ var ts; return { readExpression: readExpression, initializeExpression: initializeExpression }; } function visitCallExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + // obj.#x() // Transform call expressions of private names to properly bind the `this` parameter. var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; if (ts.isCallChain(node)) { @@ -95336,6 +96169,8 @@ var ts; ts.isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.classConstructor)) { + // super.x() + // super[x]() // converts `super.f(...)` into `Reflect.get(_baseTemp, "f", _classTemp).call(_classTemp, ...)` var invocation = factory.createFunctionCallCall(ts.visitNode(node.expression, visitor, ts.isExpression), currentClassLexicalEnvironment.classConstructor, ts.visitNodes(node.arguments, visitor, ts.isExpression)); ts.setOriginalNode(invocation, node); @@ -95345,7 +96180,8 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitTaggedTemplateExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { // Bind the `this` correctly for tagged template literals when the tag is a private identifier property access. var _a = factory.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; return factory.updateTaggedTemplateExpression(node, factory.createCallExpression(factory.createPropertyAccessExpression(ts.visitNode(target, visitor), "bind"), @@ -95371,11 +96207,8 @@ var ts; classLexicalEnvironmentMap.set(ts.getOriginalNodeId(node), currentClassLexicalEnvironment); } startLexicalEnvironment(); - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = node; - var statements = ts.visitNodes(node.body.statements, visitor, ts.isStatement); + var statements = setCurrentStaticPropertyDeclarationOrStaticBlockAnd(node, function (statements) { return ts.visitNodes(statements, visitor, ts.isStatement); }, node.body.statements); statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; var iife = factory.createImmediatelyInvokedArrowFunction(statements); ts.setOriginalNode(iife, node); ts.setTextRange(iife, node); @@ -95385,9 +96218,12 @@ var ts; } function visitBinaryExpression(node, valueIsDiscarded) { if (ts.isDestructuringAssignment(node)) { + // ({ x: obj.#x } = ...) + // ({ x: super.x } = ...) + // ({ x: super[x] } = ...) var savedPendingExpressions = pendingExpressions; pendingExpressions = undefined; - node = factory.updateBinaryExpression(node, ts.visitNode(node.left, visitorDestructuringTarget), node.operatorToken, ts.visitNode(node.right, visitor)); + node = factory.updateBinaryExpression(node, ts.visitNode(node.left, assignmentTargetVisitor), node.operatorToken, ts.visitNode(node.right, visitor)); var expr = ts.some(pendingExpressions) ? factory.inlineExpressions(ts.compact(__spreadArray(__spreadArray([], pendingExpressions, true), [node], false))) : node; @@ -95395,7 +96231,9 @@ var ts; return expr; } if (ts.isAssignmentExpression(node)) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + // obj.#x = ... var info = accessPrivateIdentifier(node.left.name); if (info) { return ts.setTextRange(ts.setOriginalNode(createPrivateIdentifierAssignment(info, node.left.expression, node.right, node.operatorToken.kind), node), node); @@ -95405,6 +96243,10 @@ var ts; ts.isSuperProperty(node.left) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + // super.x = ... + // super[x] = ... + // super.x += ... + // super.x -= ... var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts; if (facts & 1 /* ClassFacts.ClassWasDecorated */) { return factory.updateBinaryExpression(node, visitInvalidSuperProperty(node.left), node.operatorToken, ts.visitNode(node.right, visitor, ts.isExpression)); @@ -95448,8 +96290,10 @@ var ts; } } } - if (node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ && ts.isPrivateIdentifier(node.left)) { - return visitPrivateIdentifierInInExpression(node); + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierInExpression(node)) { + // #x in obj + return transformPrivateIdentifierInInExpression(node); } return ts.visitEachChild(node, visitor, context); } @@ -95474,36 +96318,6 @@ var ts; ts.Debug.assertNever(info, "Unknown private element type"); } } - /** - * Set up the environment for a class. - */ - function visitClassLike(node) { - if (!ts.forEach(node.members, doesClassElementNeedTransform)) { - return ts.visitEachChild(node, visitor, context); - } - var savedPendingExpressions = pendingExpressions; - pendingExpressions = undefined; - startClassLexicalEnvironment(); - if (shouldTransformPrivateElementsOrClassStaticBlocks) { - var name = ts.getNameOfDeclaration(node); - if (name && ts.isIdentifier(name)) { - getPrivateIdentifierEnvironment().className = ts.idText(name); - } - var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); - if (ts.some(privateInstanceMethodsAndAccessors)) { - getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); - } - } - var result = ts.isClassDeclaration(node) ? - visitClassDeclaration(node) : - visitClassExpression(node); - endClassLexicalEnvironment(); - pendingExpressions = savedPendingExpressions; - return result; - } - function doesClassElementNeedTransform(node) { - return ts.isPropertyDeclaration(node) || ts.isClassStaticBlockDeclaration(node) || (shouldTransformPrivateElementsOrClassStaticBlocks && node.name && ts.isPrivateIdentifier(node.name)); - } function getPrivateInstanceMethodsAndAccessors(node) { return ts.filter(node.members, ts.isNonStaticMethodOrAccessorWithPrivateName); } @@ -95517,7 +96331,7 @@ var ts; var member = _a[_i]; if (!ts.isStatic(member)) continue; - if (member.name && ts.isPrivateIdentifier(member.name) && shouldTransformPrivateElementsOrClassStaticBlocks) { + if (member.name && (ts.isPrivateIdentifier(member.name) || ts.isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) { facts |= 2 /* ClassFacts.NeedsClassConstructorReference */; } if (ts.isPropertyDeclaration(member) || ts.isClassStaticBlockDeclaration(member)) { @@ -95536,7 +96350,7 @@ var ts; } return facts; } - function visitExpressionWithTypeArguments(node) { + function visitExpressionWithTypeArgumentsInHeritageClause(node) { var facts = (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.facts) || 0 /* ClassFacts.None */; if (facts & 4 /* ClassFacts.NeedsClassSuperReference */) { var temp = factory.createTempVariable(hoistVariableDeclaration, /*reserveInNestedScopes*/ true); @@ -95546,7 +96360,22 @@ var ts; } return ts.visitEachChild(node, visitor, context); } - function visitClassDeclaration(node) { + function visitInNewClassLexicalEnvironment(node, visitor) { + var savedCurrentClassContainer = currentClassContainer; + var savedPendingExpressions = pendingExpressions; + currentClassContainer = node; + pendingExpressions = undefined; + startClassLexicalEnvironment(); + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + var name = ts.getNameOfDeclaration(node); + if (name && ts.isIdentifier(name)) { + getPrivateIdentifierEnvironment().className = name; + } + var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); + if (ts.some(privateInstanceMethodsAndAccessors)) { + getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); + } + } var facts = getClassFacts(node); if (facts) { getClassLexicalEnvironment().facts = facts; @@ -95554,6 +96383,16 @@ var ts; if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { enableSubstitutionForClassStaticThisOrSuperReference(); } + var result = visitor(node, facts); + endClassLexicalEnvironment(); + currentClassContainer = savedCurrentClassContainer; + pendingExpressions = savedPendingExpressions; + return result; + } + function visitClassDeclaration(node) { + return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); + } + function visitClassDeclarationInNewClassLexicalEnvironment(node, facts) { // If a class has private static fields, or a static field has a `this` or `super` reference, // then we need to allocate a temp variable to hold on to that reference. var pendingClassReferenceAssignment; @@ -95562,12 +96401,16 @@ var ts; getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); - var statements = [ - factory.updateClassDeclaration(node, node.modifiers, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) - ]; + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classDecl = factory.updateClassDeclaration(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var statements = []; + if (prologue) { + statements.push(factory.createExpressionStatement(prologue)); + } + statements.push(classDecl); if (pendingClassReferenceAssignment) { getPendingExpressions().unshift(pendingClassReferenceAssignment); } @@ -95575,25 +96418,23 @@ var ts; if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); } - // Emit static property assignment. Because classDeclaration is lexically evaluated, - // it is safe to emit static property assignment after classDeclaration - // From ES6 specification: - // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using - // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. - var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); - if (ts.some(staticProperties)) { - addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + if (shouldTransformInitializersUsingSet || shouldTransformPrivateElementsOrClassStaticBlocks) { + // Emit static property assignment. Because classDeclaration is lexically evaluated, + // it is safe to emit static property assignment after classDeclaration + // From ES6 specification: + // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using + // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. + var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); + if (ts.some(staticProperties)) { + addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + } } return statements; } function visitClassExpression(node) { - var facts = getClassFacts(node); - if (facts) { - getClassLexicalEnvironment().facts = facts; - } - if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { - enableSubstitutionForClassStaticThisOrSuperReference(); - } + return visitInNewClassLexicalEnvironment(node, visitClassExpressionInNewClassLexicalEnvironment); + } + function visitClassExpressionInNewClassLexicalEnvironment(node, facts) { // If this class expression is a transformation of a decorated class declaration, // then we want to output the pendingExpressions as statements, not as inlined // expressions with the class statement. @@ -95603,8 +96444,6 @@ var ts; // these statements after the class expression variable statement. var isDecoratedClassDeclaration = !!(facts & 1 /* ClassFacts.ClassWasDecorated */); var staticPropertiesOrClassStaticBlocks = ts.getStaticPropertiesAndClassStaticBlock(node); - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; var temp; function createClassTempVar() { @@ -95617,9 +96456,23 @@ var ts; temp = createClassTempVar(); getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); } - var classExpression = factory.updateClassExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)); - var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(staticPropertiesOrClassStaticBlocks, function (p) { return ts.isClassStaticBlockDeclaration(p) || !!p.initializer || ts.isPrivateIdentifier(p.name); }); + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classExpression = factory.updateClassExpression(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var expressions = []; + if (prologue) { + expressions.push(prologue); + } + // Static initializers are transformed to `static {}` blocks when `useDefineForClassFields: false` + // and not also transforming static blocks. + var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && + ts.some(staticPropertiesOrClassStaticBlocks, function (node) { + return ts.isClassStaticBlockDeclaration(node) || + ts.isPrivateIdentifierClassElementDeclaration(node) || + shouldTransformInitializers && ts.isInitializedProperty(node); + }); if (hasTransformableStatics || ts.some(pendingExpressions)) { if (isDecoratedClassDeclaration) { ts.Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); @@ -95631,12 +96484,16 @@ var ts; addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); } if (temp) { - return factory.inlineExpressions([factory.createAssignment(temp, classExpression), temp]); + expressions.push(ts.startOnNewLine(factory.createAssignment(temp, classExpression)), ts.startOnNewLine(temp)); + } + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } } - return classExpression; } else { - var expressions = []; temp || (temp = createClassTempVar()); if (isClassWithConstructorReference) { // record an alias as the class name is not in scope for statics. @@ -95653,45 +96510,87 @@ var ts; ts.addRange(expressions, ts.map(pendingExpressions, ts.startOnNewLine)); ts.addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); expressions.push(ts.startOnNewLine(temp)); - return factory.inlineExpressions(expressions); } } - return classExpression; + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } + } + return factory.inlineExpressions(expressions); } function visitClassStaticBlockDeclaration(node) { if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return ts.visitEachChild(node, classElementVisitor, context); + return ts.visitEachChild(node, visitor, context); } // ClassStaticBlockDeclaration for classes are transformed in `visitClassDeclaration` or `visitClassExpression`. return undefined; } - function transformClassMembers(node, isDerivedClass) { - var members = []; + function transformClassMembers(node) { + // Declare private names if (shouldTransformPrivateElementsOrClassStaticBlocks) { - // Declare private names. for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (ts.isPrivateIdentifierClassElementDeclaration(member)) { - addPrivateIdentifierToEnvironment(member); + addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); } } if (ts.some(getPrivateInstanceMethodsAndAccessors(node))) { createBrandCheckWeakSetForPrivateMethods(); } + if (shouldTransformAutoAccessors) { + for (var _b = 0, _c = node.members; _b < _c.length; _b++) { + var member = _c[_b]; + if (ts.isAutoAccessorPropertyDeclaration(member)) { + var storageName = factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"); + addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + } + } + } } - var constructor = transformConstructor(node, isDerivedClass); - var visitedMembers = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); - if (constructor) { - members.push(constructor); + var members = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); + // Create a synthetic constructor if necessary + var syntheticConstructor; + if (!ts.some(members, ts.isConstructorDeclaration)) { + syntheticConstructor = transformConstructor(/*constructor*/ undefined, node); } + var prologue; + // If there are pending expressions create a class static block in which to evaluate them, but only if + // class static blocks are not also being transformed. This block will be injected at the top of the class + // to ensure that expressions from computed property names are evaluated before any other static + // initializers. + var syntheticStaticBlock; if (!shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(pendingExpressions)) { - members.push(factory.createClassStaticBlockDeclaration(factory.createBlock([ - factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)) - ]))); + var statement = factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)); + if (statement.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */) { + // If there are `this` or `super` references from computed property names, shift the expression + // into an arrow function to be evaluated in the outer scope so that `this` and `super` are + // properly captured. + var temp = factory.createTempVariable(hoistVariableDeclaration); + var arrow = factory.createArrowFunction( + /*modifiers*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, + /*equalsGreaterThanToken*/ undefined, factory.createBlock([statement])); + prologue = factory.createAssignment(temp, arrow); + statement = factory.createExpressionStatement(factory.createCallExpression(temp, /*typeArguments*/ undefined, [])); + } + var block = factory.createBlock([statement]); + syntheticStaticBlock = factory.createClassStaticBlockDeclaration(block); pendingExpressions = undefined; } - ts.addRange(members, visitedMembers); - return ts.setTextRange(factory.createNodeArray(members), /*location*/ node.members); + // If we created a synthetic constructor or class static block, add them to the visited members + // and return a new array. + if (syntheticConstructor || syntheticStaticBlock) { + var membersArray = void 0; + membersArray = ts.append(membersArray, syntheticConstructor); + membersArray = ts.append(membersArray, syntheticStaticBlock); + membersArray = ts.addRange(membersArray, members); + members = ts.setTextRange(factory.createNodeArray(membersArray), /*location*/ node.members); + } + return { members: members, prologue: prologue }; } function createBrandCheckWeakSetForPrivateMethods() { var weakSetName = getPrivateIdentifierEnvironment().weakSetName; @@ -95700,35 +96599,38 @@ var ts; /*typeArguments*/ undefined, []))); } function isClassElementThatRequiresConstructorStatement(member) { - if (ts.isStatic(member) || ts.hasSyntacticModifier(ts.getOriginalNode(member), 128 /* ModifierFlags.Abstract */)) { + if (ts.isStatic(member) || ts.hasAbstractModifier(ts.getOriginalNode(member))) { return false; } - if (useDefineForClassFields) { - // If we are using define semantics and targeting ESNext or higher, - // then we don't need to transform any class properties. - return languageVersion < 9 /* ScriptTarget.ES2022 */; - } - return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member); + return shouldTransformInitializersUsingDefine && ts.isPropertyDeclaration(member) || + shouldTransformInitializersUsingSet && ts.isInitializedProperty(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(member); } - function transformConstructor(node, isDerivedClass) { - var constructor = ts.visitNode(ts.getFirstConstructorWithBody(node), visitor, ts.isConstructorDeclaration); - var elements = node.members.filter(isClassElementThatRequiresConstructorStatement); - if (!ts.some(elements)) { + function transformConstructor(constructor, container) { + constructor = ts.visitNode(constructor, visitor, ts.isConstructorDeclaration); + if (!ts.some(container.members, isClassElementThatRequiresConstructorStatement)) { return constructor; } + var extendsClauseElement = ts.getEffectiveBaseTypeNode(container); + var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var parameters = ts.visitParameterList(constructor ? constructor.parameters : undefined, visitor, context); - var body = transformConstructorBody(node, constructor, isDerivedClass); + var body = transformConstructorBody(container, constructor, isDerivedClass); if (!body) { - return undefined; + return constructor; + } + if (constructor) { + ts.Debug.assert(parameters); + return factory.updateConstructorDeclaration(constructor, /*modifiers*/ undefined, parameters, body); } return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration( - /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || node), constructor)); + /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || container), constructor)); } function transformConstructorBody(node, constructor, isDerivedClass) { - var _a; + var _a, _b; var properties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ false); if (!useDefineForClassFields) { - properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name); }); + properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name) || ts.hasAccessorModifier(property); }); } var privateMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); var needsConstructorBody = ts.some(properties) || ts.some(privateMethodsAndAccessors); @@ -95780,8 +96682,8 @@ var ts; statements = statements.filter(function (statement) { return !ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor); }); } else { - for (var _i = 0, _b = constructor.body.statements; _i < _b.length; _i++) { - var statement = _b[_i]; + for (var _i = 0, _c = constructor.body.statements; _i < _c.length; _i++) { + var statement = _c[_i]; if (ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { parameterPropertyDeclarationCount++; } @@ -95813,9 +96715,14 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue)); } statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + if (statements.length === 0 && !constructor) { + return undefined; + } + var multiLine = (constructor === null || constructor === void 0 ? void 0 : constructor.body) && constructor.body.statements.length >= statements.length ? + (_b = constructor.body.multiLine) !== null && _b !== void 0 ? _b : statements.length > 0 : + statements.length > 0; return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), - /*location*/ constructor ? constructor.body.statements : node.members), - /*multiLine*/ true), + /*location*/ constructor ? constructor.body.statements : node.members), multiLine), /*location*/ constructor ? constructor.body : undefined); function visitBodyStatement(statement) { if (useDefineForClassFields && ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { @@ -95851,9 +96758,10 @@ var ts; return undefined; } var statement = factory.createExpressionStatement(expression); + ts.setOriginalNode(statement, property); + ts.addEmitFlags(statement, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); - ts.setOriginalNode(statement, property); // `setOriginalNode` *copies* the `emitNode` from `property`, so now both // `statement` and `expression` have a copy of the synthesized comments. // Drop the comments from expression to avoid printing them twice. @@ -95876,9 +96784,10 @@ var ts; continue; } ts.startOnNewLine(expression); + ts.setOriginalNode(expression, property); + ts.addEmitFlags(expression, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); ts.setCommentRange(expression, property); - ts.setOriginalNode(expression, property); expressions.push(expression); } return expressions; @@ -95905,9 +96814,11 @@ var ts; var _a; // We generate a name here in order to reuse the value cached by the relocated computed name expression (which uses the same generated name) var emitAssignment = !useDefineForClassFields; - var propertyName = ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) - ? factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) - : property.name; + var propertyName = ts.hasAccessorModifier(property) ? + factory.getGeneratedPrivateNameForNode(property.name) : + ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) ? + factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) : + property.name; if (ts.hasStaticModifier(property)) { currentStaticPropertyDeclarationOrStaticBlock = property; } @@ -95934,7 +96845,7 @@ var ts; return undefined; } var propertyOriginalNode = ts.getOriginalNode(property); - if (ts.hasSyntacticModifier(propertyOriginalNode, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(propertyOriginalNode, 256 /* ModifierFlags.Abstract */)) { return undefined; } var initializer = property.initializer || emitAssignment ? (_a = ts.visitNode(property.initializer, visitor, ts.isExpression)) !== null && _a !== void 0 ? _a : factory.createVoidZero() @@ -95968,17 +96879,17 @@ var ts; // substitute `this` in a static field initializer context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); // these push a new lexical environment that is not the class lexical environment - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // these push a new lexical environment that is not the class lexical environment, except // when they have a computed property name - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(167 /* SyntaxKind.PropertyDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(169 /* SyntaxKind.PropertyDeclaration */); // class lexical environments are restored when entering a computed property name - context.enableEmitNotification(162 /* SyntaxKind.ComputedPropertyName */); + context.enableEmitNotification(164 /* SyntaxKind.ComputedPropertyName */); } } /** @@ -96017,13 +96928,13 @@ var ts; } } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (ts.isArrowFunction(original) || ts.getEmitFlags(node) & 262144 /* EmitFlags.AsyncFunctionBody */) { break; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = undefined; @@ -96033,10 +96944,10 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentComputedPropertyNameClassLexicalEnvironment = currentClassLexicalEnvironment; @@ -96046,7 +96957,7 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 162 /* SyntaxKind.ComputedPropertyName */: { + case 164 /* SyntaxKind.ComputedPropertyName */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; @@ -96160,149 +97071,138 @@ var ts; function getPrivateIdentifierEnvironment() { var lex = getClassLexicalEnvironment(); lex.privateIdentifierEnvironment || (lex.privateIdentifierEnvironment = { - className: "", - identifiers: new ts.Map() + className: undefined, + weakSetName: undefined, + identifiers: undefined, + generatedIdentifiers: undefined, }); return lex.privateIdentifierEnvironment; } function getPendingExpressions() { - return pendingExpressions || (pendingExpressions = []); + return pendingExpressions !== null && pendingExpressions !== void 0 ? pendingExpressions : (pendingExpressions = []); } - function addPrivateIdentifierToEnvironment(node) { - var _a; - var text = ts.getTextOfPropertyName(node.name); - var lex = getClassLexicalEnvironment(); - var classConstructor = lex.classConstructor; - var privateEnv = getPrivateIdentifierEnvironment(); - var weakSetName = privateEnv.weakSetName; - var assignmentExpressions = []; - var privateName = node.name.escapedText; - var previousInfo = privateEnv.identifiers.get(privateName); - var isValid = !isReservedPrivateName(node.name) && previousInfo === undefined; - if (ts.hasStaticModifier(node)) { - ts.Debug.assert(classConstructor, "weakSetName should be set in private identifier environment"); - if (ts.isPropertyDeclaration(node)) { - var variableName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f" /* PrivateIdentifierKind.Field */, - variableName: variableName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isMethodDeclaration(node)) { - var functionName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: functionName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isGetAccessorDeclaration(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else if (ts.isSetAccessorDeclaration(node)) { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else { - ts.Debug.assertNever(node, "Unknown class element type."); - } + function addPrivateIdentifierClassElementToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + if (ts.isAutoAccessorPropertyDeclaration(node)) { + addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isPropertyDeclaration(node)) { - var weakMapName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { + addPrivateIdentifierPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isMethodDeclaration(node)) { + addPrivateIdentifierMethodDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isGetAccessorDeclaration(node)) { + addPrivateIdentifierGetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isSetAccessorDeclaration(node)) { + addPrivateIdentifierSetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + } + function addPrivateIdentifierPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + if (isStatic) { + ts.Debug.assert(lex.classConstructor, "classConstructor should be set in private identifier environment"); + var variableName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f" /* PrivateIdentifierKind.Field */, + brandCheckIdentifier: lex.classConstructor, + variableName: variableName, + isStatic: true, + isValid: isValid, + }); + } + else { + var weakMapName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { kind: "f" /* PrivateIdentifierKind.Field */, brandCheckIdentifier: weakMapName, - isStatic: false, variableName: undefined, + isStatic: false, isValid: isValid, }); - assignmentExpressions.push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), + getPendingExpressions().push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), /*typeArguments*/ undefined, []))); } - else if (ts.isMethodDeclaration(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: createHoistedVariableForPrivateName(text, node), - brandCheckIdentifier: weakSetName, - isStatic: false, + } + function addPrivateIdentifierMethodDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var methodName = createHoistedVariableForPrivateName(name); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "m" /* PrivateIdentifierKind.Method */, + methodName: methodName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierGetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.getterName) { + previousInfo.getterName = getterName; + } + else { + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: undefined, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, isValid: isValid, }); } - else if (ts.isAccessor(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - if (ts.isGetAccessor(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } - else { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } + } + function addPrivateIdentifierSetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.setterName) { + previousInfo.setterName = setterName; } else { - ts.Debug.assertNever(node, "Unknown class element type."); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: undefined, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); } - (_a = getPendingExpressions()).push.apply(_a, assignmentExpressions); } - function createHoistedVariableForClass(name, node) { + function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierToEnvironment(node, name, addDeclaration) { + var lex = getClassLexicalEnvironment(); + var privateEnv = getPrivateIdentifierEnvironment(); + var previousInfo = getPrivateIdentifier(privateEnv, name); + var isStatic = ts.hasStaticModifier(node); + var isValid = !isReservedPrivateName(name) && previousInfo === undefined; + addDeclaration(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + function createHoistedVariableForClass(name, node, suffix) { var className = getPrivateIdentifierEnvironment().className; - var prefix = className ? "_".concat(className) : ""; - var identifier = factory.createUniqueName("".concat(prefix, "_").concat(name), 16 /* GeneratedIdentifierFlags.Optimistic */); + var prefix = className ? { prefix: "_", node: className, suffix: "_" } : "_"; + var identifier = typeof name === "object" ? factory.getGeneratedNameForNode(name, 16 /* GeneratedIdentifierFlags.Optimistic */ | 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */, prefix, suffix) : + typeof name === "string" ? factory.createUniqueName(name, 16 /* GeneratedIdentifierFlags.Optimistic */, prefix, suffix) : + factory.createTempVariable(/*recordTempVariable*/ undefined, /*reserveInNestedScopes*/ true, prefix, suffix); if (resolver.getNodeCheckFlags(node) & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */) { addBlockScopedVariable(identifier); } @@ -96311,13 +97211,33 @@ var ts; } return identifier; } - function createHoistedVariableForPrivateName(privateName, node) { - return createHoistedVariableForClass(privateName.substring(1), node.name); + function createHoistedVariableForPrivateName(name, suffix) { + var _a; + var text = ts.tryGetTextOfPropertyName(name); + return createHoistedVariableForClass((_a = text === null || text === void 0 ? void 0 : text.substring(1)) !== null && _a !== void 0 ? _a : name, name, suffix); } + /** + * Access an already defined {@link PrivateIdentifier} in the current {@link PrivateIdentifierEnvironment}. + * + * @seealso {@link addPrivateIdentifierToEnvironment} + */ function accessPrivateIdentifier(name) { - var _a; + if (ts.isGeneratedPrivateIdentifier(name)) { + return accessGeneratedPrivateIdentifier(name); + } + else { + return accessPrivateIdentifierByText(name.escapedText); + } + } + function accessPrivateIdentifierByText(text) { + return accessPrivateIdentifierWorker(getPrivateIdentifierInfo, text); + } + function accessGeneratedPrivateIdentifier(name) { + return accessPrivateIdentifierWorker(getGeneratedPrivateIdentifierInfo, ts.getNodeForGeneratedName(name)); + } + function accessPrivateIdentifierWorker(getPrivateIdentifierInfo, privateIdentifierKey) { if (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.privateIdentifierEnvironment) { - var info = currentClassLexicalEnvironment.privateIdentifierEnvironment.identifiers.get(name.escapedText); + var info = getPrivateIdentifierInfo(currentClassLexicalEnvironment.privateIdentifierEnvironment, privateIdentifierKey); if (info) { return info; } @@ -96327,9 +97247,11 @@ var ts; if (!env) { continue; } - var info = (_a = env.privateIdentifierEnvironment) === null || _a === void 0 ? void 0 : _a.identifiers.get(name.escapedText); - if (info) { - return info; + if (env.privateIdentifierEnvironment) { + var info = getPrivateIdentifierInfo(env.privateIdentifierEnvironment, privateIdentifierKey); + if (info) { + return info; + } } } return undefined; @@ -96386,7 +97308,7 @@ var ts; } } } - return ts.visitNode(node, visitorDestructuringTarget); + return ts.visitNode(node, assignmentTargetVisitor); } function visitObjectAssignmentTarget(node) { if (ts.isObjectBindingOrAssignmentElement(node) && !ts.isShorthandPropertyAssignment(node)) { @@ -96419,10 +97341,10 @@ var ts; var initializer = ts.getInitializerOfBindingOrAssignmentElement(node); return factory.updatePropertyAssignment(node, ts.visitNode(node.name, visitor, ts.isPropertyName), wrapped ? initializer ? factory.createAssignment(wrapped, ts.visitNode(initializer, visitor)) : wrapped : - ts.visitNode(node.initializer, visitorDestructuringTarget, ts.isExpression)); + ts.visitNode(node.initializer, assignmentTargetVisitor, ts.isExpression)); } if (ts.isSpreadAssignment(node)) { - return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, visitorDestructuringTarget, ts.isExpression)); + return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, assignmentTargetVisitor, ts.isExpression)); } ts.Debug.assert(wrapped === undefined, "Should not have generated a wrapped target"); } @@ -96468,7 +97390,31 @@ var ts; /*typeArguments*/ undefined, [receiver]); } function isReservedPrivateName(node) { - return node.escapedText === "#constructor"; + return !ts.isGeneratedPrivateIdentifier(node) && node.escapedText === "#constructor"; + } + function getPrivateIdentifier(privateEnv, name) { + return ts.isGeneratedPrivateIdentifier(name) ? + getGeneratedPrivateIdentifierInfo(privateEnv, ts.getNodeForGeneratedName(name)) : + getPrivateIdentifierInfo(privateEnv, name.escapedText); + } + function setPrivateIdentifier(privateEnv, name, info) { + var _a, _b; + if (ts.isGeneratedPrivateIdentifier(name)) { + (_a = privateEnv.generatedIdentifiers) !== null && _a !== void 0 ? _a : (privateEnv.generatedIdentifiers = new ts.Map()); + privateEnv.generatedIdentifiers.set(ts.getNodeForGeneratedName(name), info); + } + else { + (_b = privateEnv.identifiers) !== null && _b !== void 0 ? _b : (privateEnv.identifiers = new ts.Map()); + privateEnv.identifiers.set(name.escapedText, info); + } + } + function getPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.identifiers) === null || _a === void 0 ? void 0 : _a.get(key); + } + function getGeneratedPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.generatedIdentifiers) === null || _a === void 0 ? void 0 : _a.get(key); } })(ts || (ts = {})); /*@internal*/ @@ -96509,15 +97455,15 @@ var ts; */ function serializeTypeOfNode(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: return serializeTypeNode(node.type); - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return serializeTypeNode(getAccessorTypeNode(node)); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createIdentifier("Function"); default: return ts.factory.createVoidZero(); @@ -96553,7 +97499,7 @@ var ts; return ts.factory.createArrayLiteralExpression(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (container && node.kind === 174 /* SyntaxKind.GetAccessor */) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -96599,66 +97545,66 @@ var ts; node = ts.skipTypeParentheses(node); switch (node.kind) { case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return ts.factory.createVoidZero(); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return ts.factory.createIdentifier("Function"); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return ts.factory.createIdentifier("Array"); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? ts.factory.createVoidZero() : ts.factory.createIdentifier("Boolean"); - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return ts.factory.createIdentifier("Boolean"); - case 198 /* SyntaxKind.TemplateLiteralType */: - case 150 /* SyntaxKind.StringKeyword */: + case 200 /* SyntaxKind.TemplateLiteralType */: + case 152 /* SyntaxKind.StringKeyword */: return ts.factory.createIdentifier("String"); - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return ts.factory.createIdentifier("Object"); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return serializeLiteralOfLiteralTypeNode(node.literal); - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return ts.factory.createIdentifier("Number"); - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return getGlobalConstructor("BigInt", 7 /* ScriptTarget.ES2020 */); - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return getGlobalConstructor("Symbol", 2 /* ScriptTarget.ES2015 */); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return serializeTypeReferenceNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ true); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ false); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return serializeUnionOrIntersectionConstituents([node.trueType, node.falseType], /*isIntersection*/ false); - case 193 /* SyntaxKind.TypeOperator */: - if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + case 195 /* SyntaxKind.TypeOperator */: + if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { return serializeTypeNode(node.type); } break; - case 181 /* SyntaxKind.TypeQuery */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 192 /* SyntaxKind.ThisType */: - case 200 /* SyntaxKind.ImportType */: + case 183 /* SyntaxKind.TypeQuery */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 194 /* SyntaxKind.ThisType */: + case 202 /* SyntaxKind.ImportType */: break; // handle JSDoc types from an invalid parse - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - case 319 /* SyntaxKind.JSDocNamepathType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 321 /* SyntaxKind.JSDocVariadicType */: + case 322 /* SyntaxKind.JSDocNamepathType */: break; - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return serializeTypeNode(node.type); default: return ts.Debug.failBadSyntaxKind(node); @@ -96670,7 +97616,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.factory.createIdentifier("String"); - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; switch (operand.kind) { case 8 /* SyntaxKind.NumericLiteral */: @@ -96699,20 +97645,20 @@ var ts; for (var _i = 0, types_22 = types; _i < types_22.length; _i++) { var typeNode = types_22[_i]; typeNode = ts.skipTypeParentheses(typeNode); - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { if (isIntersection) return ts.factory.createVoidZero(); // Reduce to `never` in an intersection continue; // Elide `never` in a union } - if (typeNode.kind === 155 /* SyntaxKind.UnknownKeyword */) { + if (typeNode.kind === 157 /* SyntaxKind.UnknownKeyword */) { if (!isIntersection) return ts.factory.createIdentifier("Object"); // Reduce to `unknown` in a union continue; // Elide `unknown` in an intersection } - if (typeNode.kind === 130 /* SyntaxKind.AnyKeyword */) { + if (typeNode.kind === 131 /* SyntaxKind.AnyKeyword */) { return ts.factory.createIdentifier("Object"); // Reduce to `any` in a union or intersection } - if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var serializedConstituent = serializeTypeNode(typeNode); @@ -96860,7 +97806,7 @@ var ts; name.original = undefined; ts.setParent(name, ts.getParseTreeNode(currentLexicalScope)); // ensure the parent is set to a parse tree node. return name; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return serializeQualifiedNameAsExpression(node); } } @@ -96915,24 +97861,24 @@ var ts; return node; } switch (node.kind) { - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are elided. They will be emitted as part of `visitClassDeclaration`. return undefined; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructorDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitSetAccessorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return visitGetAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return visitPropertyDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameterDeclaration(node); default: return ts.visitEachChild(node, visitor, context); @@ -97288,7 +98234,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ !ts.hasSyntacticModifier(member, 2 /* ModifierFlags.Ambient */)); var descriptor = languageVersion > 0 /* ScriptTarget.ES3 */ - ? member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + ? ts.isPropertyDeclaration(member) && !ts.hasAccessorModifier(member) // We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it // should not invoke `Object.getOwnPropertyDescriptor`. ? factory.createVoidZero() @@ -97551,34 +98497,37 @@ var ts; return node; } switch (node.kind) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 return undefined; - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitMethodDeclaration, node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionDeclaration, node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionExpression, node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithContext(1 /* ContextFlags.NonTopLevel */, visitArrowFunction, node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 174 /* SyntaxKind.GetAccessor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitGetAccessorDeclaration, node); + case 175 /* SyntaxKind.SetAccessor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitSetAccessorDeclaration, node); + case 173 /* SyntaxKind.Constructor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitConstructorDeclaration, node); + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node); default: return ts.visitEachChild(node, visitor, context); @@ -97587,27 +98536,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatementInAsyncBody(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatementInAsyncBody(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatementInAsyncBody(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatementInAsyncBody(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClauseInAsyncBody(node); - case 235 /* SyntaxKind.Block */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 250 /* SyntaxKind.LabeledStatement */: + case 238 /* SyntaxKind.Block */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -97677,6 +98626,9 @@ var ts; return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression( /*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node); } + function visitConstructorDeclaration(node) { + return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node)); + } /** * Visits a MethodDeclaration node. * @@ -97691,7 +98643,14 @@ var ts; /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* FunctionFlags.Async */ ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : transformMethodBody(node)); + } + function visitGetAccessorDeclaration(node) { + return factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformMethodBody(node)); + } + function visitSetAccessorDeclaration(node) { + return factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node)); } /** * Visits a FunctionDeclaration node. @@ -97805,12 +98764,48 @@ var ts; } return false; } + function transformMethodBody(node) { + ts.Debug.assertIsDefined(node.body); + var savedCapturedSuperProperties = capturedSuperProperties; + var savedHasSuperElementAccess = hasSuperElementAccess; + capturedSuperProperties = new ts.Set(); + hasSuperElementAccess = false; + var updated = ts.visitFunctionBody(node.body, visitor, context); + // Minor optimization, emit `_super` helper to capture `super` access in an arrow. + // This step isn't needed if we eventually transform this to ES5. + var originalMethod = ts.getOriginalNode(node, ts.isFunctionLikeDeclaration); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && + resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) && + (ts.getFunctionFlags(originalMethod) & 3 /* FunctionFlags.AsyncGenerator */) !== 3 /* FunctionFlags.AsyncGenerator */; + if (emitSuperHelpers) { + enableSubstitutionForAsyncMethodsWithSuper(); + if (capturedSuperProperties.size) { + var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties); + substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true; + var statements = updated.statements.slice(); + ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]); + updated = factory.updateBlock(updated, statements); + } + if (hasSuperElementAccess) { + // Emit helpers for super element access expressions (`super[x]`). + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { + ts.addEmitHelper(updated, ts.advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { + ts.addEmitHelper(updated, ts.asyncSuperHelper); + } + } + } + capturedSuperProperties = savedCapturedSuperProperties; + hasSuperElementAccess = savedHasSuperElementAccess; + return updated; + } function transformAsyncFunctionBody(node) { resumeLexicalEnvironment(); var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ScriptTarget.ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 214 /* SyntaxKind.ArrowFunction */; + var isArrowFunction = node.kind === 216 /* SyntaxKind.ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* NodeCheckFlags.CaptureArguments */) !== 0; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current @@ -97837,7 +98832,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); // Minor optimization, emit `_super` helper to capture `super` access in an arrow. // This step isn't needed if we eventually transform this to ES5. - var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */ | 2048 /* NodeCheckFlags.AsyncMethodWithSuper */); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */); if (emitSuperHelpers) { enableSubstitutionForAsyncMethodsWithSuper(); if (capturedSuperProperties.size) { @@ -97850,10 +98845,10 @@ var ts; ts.setTextRange(block, node.body); if (emitSuperHelpers && hasSuperElementAccess) { // Emit helpers for super element access expressions (`super[x]`). - if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); } - else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) { + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { ts.addEmitHelper(block, ts.asyncSuperHelper); } } @@ -97901,17 +98896,17 @@ var ts; enabledSubstitutions |= 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -97925,7 +98920,7 @@ var ts; // If we need to support substitutions for `super` in an async method, // we should track it here. if (enabledSubstitutions & 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) { - var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */); + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */); if (superContainerFlags !== enclosingSuperContainerFlags) { var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; enclosingSuperContainerFlags = superContainerFlags; @@ -97959,11 +98954,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -97995,14 +98990,14 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { - if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createUniqueName("_superIndex", 16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */), /*typeArguments*/ undefined, [argumentExpression]), "value"), location); } @@ -98017,7 +99012,7 @@ var ts; function createSuperAccessVariableStatement(factory, resolver, node, names) { // Create a variable declaration with a getter/setter (if binding) definition for each name: // const _super = Object.create(null, { x: { get: () => super.x, set: (v) => super.x = v }, ... }); - var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) !== 0; + var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) !== 0; var accessors = []; names.forEach(function (_, key) { var name = ts.unescapeLeadingUnderscores(key); @@ -98156,7 +99151,7 @@ var ts; return visitorWorker(node, /*expressionResultIsUnused*/ true); } function visitorNoAsyncModifier(node) { - if (node.kind === 131 /* SyntaxKind.AsyncKeyword */) { + if (node.kind === 132 /* SyntaxKind.AsyncKeyword */) { return undefined; } return node; @@ -98182,70 +99177,70 @@ var ts; return node; } switch (node.kind) { - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: return doWithHierarchyFacts(visitDefault, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return doWithHierarchyFacts(visitForStatement, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return doWithHierarchyFacts(visitConstructorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithHierarchyFacts(visitMethodDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return doWithHierarchyFacts(visitGetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return doWithHierarchyFacts(visitSetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithHierarchyFacts(visitFunctionDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithHierarchyFacts(visitFunctionExpression, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithHierarchyFacts(visitArrowFunction, node, 2 /* HierarchyFacts.ArrowFunctionExcludes */, 0 /* HierarchyFacts.ArrowFunctionIncludes */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithHierarchyFacts(visitDefault, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); default: return ts.visitEachChild(node, visitor, context); @@ -98281,7 +99276,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2 /* FunctionFlags.Async */) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 244 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { + if (statement.kind === 247 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { return visitForOfStatement(statement, node); } return factory.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement, factory.liftToBlock), node); @@ -98293,7 +99288,7 @@ var ts; var objects = []; for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) { var e = elements_5[_i]; - if (e.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (e.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (chunkObject) { objects.push(factory.createObjectLiteralExpression(chunkObject)); chunkObject = undefined; @@ -98302,7 +99297,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 296 /* SyntaxKind.PropertyAssignment */ + chunkObject = ts.append(chunkObject, e.kind === 299 /* SyntaxKind.PropertyAssignment */ ? factory.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -98336,7 +99331,7 @@ var ts; // If we translate the above to `__assign({}, k, l)`, the `l` will evaluate before `k` is spread and we // end up with `{ a: 1, b: 2, c: 3 }` var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { objects.unshift(factory.createObjectLiteralExpression()); } var expression = objects[0]; @@ -98510,11 +99505,22 @@ var ts; } return node; } - function convertForOfStatementHead(node, boundValue) { - var binding = ts.createForOfBindingStatement(factory, node.initializer, boundValue); + function convertForOfStatementHead(node, boundValue, nonUserCode) { + var value = factory.createTempVariable(hoistVariableDeclaration); + var iteratorValueExpression = factory.createAssignment(value, boundValue); + var iteratorValueStatement = factory.createExpressionStatement(iteratorValueExpression); + ts.setSourceMapRange(iteratorValueStatement, node.expression); + var exitNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createFalse()); + var exitNonUserCodeStatement = factory.createExpressionStatement(exitNonUserCodeExpression); + ts.setSourceMapRange(exitNonUserCodeStatement, node.expression); + var enterNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createTrue()); + var enterNonUserCodeStatement = factory.createExpressionStatement(enterNonUserCodeExpression); + ts.setSourceMapRange(exitNonUserCodeStatement, node.expression); + var statements = []; + var binding = ts.createForOfBindingStatement(factory, node.initializer, value); + statements.push(ts.visitNode(binding, visitor, ts.isStatement)); var bodyLocation; var statementsLocation; - var statements = [ts.visitNode(binding, visitor, ts.isStatement)]; var statement = ts.visitIterationBody(node.statement, visitor, context); if (ts.isBlock(statement)) { ts.addRange(statements, statement.statements); @@ -98524,8 +99530,16 @@ var ts; else { statements.push(statement); } - return ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), + var body = ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), /*multiLine*/ true), bodyLocation), 48 /* EmitFlags.NoSourceMap */ | 384 /* EmitFlags.NoTokenSourceMaps */); + return factory.createBlock([ + iteratorValueStatement, + exitNonUserCodeStatement, + factory.createTryStatement(body, + /*catchClause*/ undefined, factory.createBlock([ + enterNonUserCodeStatement + ])) + ]); } function createDownlevelAwait(expression) { return enclosingFunctionFlags & 1 /* FunctionFlags.Generator */ @@ -98536,6 +99550,8 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isExpression); var iterator = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(expression) : factory.createTempVariable(/*recordTempVariable*/ undefined); var result = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(iterator) : factory.createTempVariable(/*recordTempVariable*/ undefined); + var nonUserCode = factory.createTempVariable(/*recordTempVariable*/ undefined); + var done = factory.createTempVariable(hoistVariableDeclaration); var errorRecord = factory.createUniqueName("e"); var catchVariable = factory.getGeneratedNameForNode(errorRecord); var returnMethod = factory.createTempVariable(/*recordTempVariable*/ undefined); @@ -98552,12 +99568,17 @@ var ts; callValues; var forStatement = ts.setEmitFlags(ts.setTextRange(factory.createForStatement( /*initializer*/ ts.setEmitFlags(ts.setTextRange(factory.createVariableDeclarationList([ + factory.createVariableDeclaration(nonUserCode, /*exclamationToken*/ undefined, /*type*/ undefined, factory.createTrue()), ts.setTextRange(factory.createVariableDeclaration(iterator, /*exclamationToken*/ undefined, /*type*/ undefined, initializer), node.expression), factory.createVariableDeclaration(result) ]), node.expression), 2097152 /* EmitFlags.NoHoisting */), - /*condition*/ factory.createComma(factory.createAssignment(result, createDownlevelAwait(callNext)), factory.createLogicalNot(getDone)), + /*condition*/ factory.inlineExpressions([ + factory.createAssignment(result, createDownlevelAwait(callNext)), + factory.createAssignment(done, getDone), + factory.createLogicalNot(done) + ]), /*incrementor*/ undefined, - /*statement*/ convertForOfStatementHead(node, getValue)), + /*statement*/ convertForOfStatementHead(node, getValue, nonUserCode)), /*location*/ node), 256 /* EmitFlags.NoTokenTrailingSourceMaps */); ts.setOriginalNode(forStatement, node); return factory.createTryStatement(factory.createBlock([ @@ -98569,7 +99590,7 @@ var ts; ]), 1 /* EmitFlags.SingleLine */)), factory.createBlock([ factory.createTryStatement( /*tryBlock*/ factory.createBlock([ - ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(result, factory.createLogicalNot(getDone)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), 1 /* EmitFlags.SingleLine */) + ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(factory.createLogicalNot(nonUserCode), factory.createLogicalNot(done)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), 1 /* EmitFlags.SingleLine */) ]), /*catchClause*/ undefined, /*finallyBlock*/ ts.setEmitFlags(factory.createBlock([ @@ -98725,7 +99746,7 @@ var ts; /*type*/ undefined, factory.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !!(hierarchyFacts & 1 /* HierarchyFacts.HasLexicalThis */))); // Minor optimization, emit `_super` helper to capture `super` access in an arrow. // This step isn't needed if we eventually transform this to ES5. - var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */ | 2048 /* NodeCheckFlags.AsyncMethodWithSuper */); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */); if (emitSuperHelpers) { enableSubstitutionForAsyncMethodsWithSuper(); var variableStatement = ts.createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties); @@ -98736,10 +99757,10 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var block = factory.updateBlock(node.body, statements); if (emitSuperHelpers && hasSuperElementAccess) { - if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); } - else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) { + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { ts.addEmitHelper(block, ts.asyncSuperHelper); } } @@ -98844,17 +99865,17 @@ var ts; enabledSubstitutions |= 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -98868,7 +99889,7 @@ var ts; // If we need to support substitutions for `super` in an async method, // we should track it here. if (enabledSubstitutions & 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) { - var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */); + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */); if (superContainerFlags !== enclosingSuperContainerFlags) { var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; enclosingSuperContainerFlags = superContainerFlags; @@ -98902,11 +99923,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -98938,14 +99959,14 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { - if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createIdentifier("_superIndex"), /*typeArguments*/ undefined, [argumentExpression]), "value"), location); } @@ -98974,7 +99995,7 @@ var ts; return node; } switch (node.kind) { - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -99006,25 +100027,25 @@ var ts; return node; } switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { var updated = visitNonOptionalCallExpression(node, /*captureThisArg*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (ts.isOptionalChain(node)) { var updated = visitOptionalExpression(node, /*captureThisArg*/ false, /*isDelete*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } return ts.visitEachChild(node, visitor, context); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) { return transformNullishCoalescingExpression(node); } return ts.visitEachChild(node, visitor, context); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return visitDeleteExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99066,7 +100087,7 @@ var ts; thisArg = expression; } } - expression = node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + expression = node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.updatePropertyAccessExpression(node, expression, ts.visitNode(node.name, visitor, ts.isIdentifier)) : factory.updateElementAccessExpression(node, expression, ts.visitNode(node.argumentExpression, visitor, ts.isExpression)); return thisArg ? factory.createSyntheticReferenceExpression(expression, thisArg) : expression; @@ -99089,10 +100110,10 @@ var ts; } function visitNonOptionalExpression(node, captureThisArg, isDelete) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); - case 208 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); + case 210 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); default: return ts.visitNode(node, visitor, ts.isExpression); } } @@ -99111,8 +100132,8 @@ var ts; for (var i = 0; i < chain.length; i++) { var segment = chain[i]; switch (segment.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (i === chain.length - 1 && captureThisArg) { if (!ts.isSimpleCopiableExpression(rightExpression)) { thisArg = factory.createTempVariable(hoistVariableDeclaration); @@ -99122,11 +100143,11 @@ var ts; thisArg = rightExpression; } } - rightExpression = segment.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + rightExpression = segment.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.createPropertyAccessExpression(rightExpression, ts.visitNode(segment.name, visitor, ts.isIdentifier)) : factory.createElementAccessExpression(rightExpression, ts.visitNode(segment.argumentExpression, visitor, ts.isExpression)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (i === 0 && leftThisArg) { if (!ts.isGeneratedIdentifier(leftThisArg)) { leftThisArg = factory.cloneNode(leftThisArg); @@ -99187,7 +100208,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryExpression = node; if (ts.isLogicalOrCoalescingAssignmentExpression(binaryExpression)) { return transformLogicalAssignment(binaryExpression); @@ -99356,13 +100377,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ false); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99372,13 +100393,13 @@ var ts; switch (node.kind) { case 11 /* SyntaxKind.JsxText */: return visitJsxText(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ true); default: return ts.Debug.failBadSyntaxKind(node); @@ -99559,7 +100580,7 @@ var ts; var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote); return ts.setTextRange(literal, node); } - if (node.kind === 288 /* SyntaxKind.JsxExpression */) { + if (node.kind === 291 /* SyntaxKind.JsxExpression */) { if (node.expression === undefined) { return factory.createTrue(); } @@ -99660,7 +100681,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 278 /* SyntaxKind.JsxElement */) { + if (node.kind === 281 /* SyntaxKind.JsxElement */) { return getTagName(node.openingElement); } else { @@ -99967,7 +100988,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -100192,7 +101213,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return (hierarchyFacts & 8192 /* HierarchyFacts.ConstructorWithCapturedSuper */) !== 0 - && node.kind === 247 /* SyntaxKind.ReturnStatement */ + && node.kind === 250 /* SyntaxKind.ReturnStatement */ && !node.expression; } function isOrMayContainReturnCompletion(node) { @@ -100246,65 +101267,65 @@ var ts; switch (node.kind) { case 124 /* SyntaxKind.StaticKeyword */: return undefined; // elide static keyword - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return visitArrowFunction(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); case 79 /* SyntaxKind.Identifier */: return visitIdentifier(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return visitVariableDeclarationList(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node, /*isFunctionBody*/ false); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitBreakOrContinueStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*outermostLabeledStatement*/ undefined); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return visitComputedPropertyName(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: @@ -100315,30 +101336,30 @@ var ts; return visitStringLiteral(node); case 8 /* SyntaxKind.NumericLiteral */: return visitNumericLiteral(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return visitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return visitSpreadElement(node); case 106 /* SyntaxKind.SuperKeyword */: return visitSuperKeyword(/*isExpressionOfCall*/ false); case 108 /* SyntaxKind.ThisKeyword */: return visitThisKeyword(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return visitMetaProperty(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -100414,11 +101435,13 @@ var ts; return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context); } function visitIdentifier(node) { - if (!convertedLoopState) { - return node; + if (convertedLoopState) { + if (resolver.isArgumentsLocalBinding(node)) { + return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments")); + } } - if (resolver.isArgumentsLocalBinding(node)) { - return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments")); + if (node.hasExtendedUnicodeEscape) { + return ts.setOriginalNode(ts.setTextRange(factory.createIdentifier(ts.unescapeLeadingUnderscores(node.escapedText)), node), node); } return node; } @@ -100428,14 +101451,14 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 246 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; + var jump = node.kind === 249 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; var label = node.label; if (!label) { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Jump.Break */; labelMarker = "break"; } @@ -100446,7 +101469,7 @@ var ts; } } else { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { labelMarker = "break-".concat(label.escapedText); setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(label), labelMarker); } @@ -100502,7 +101525,7 @@ var ts; statements.push(statement); // Add an `export default` statement for default exports (for `--target es5 --module es6`) if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - var exportStatement = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) + var exportStatement = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? factory.createExportDefault(factory.getLocalName(node)) : factory.createExternalModuleExport(factory.getLocalName(node)); ts.setOriginalNode(exportStatement, statement); @@ -100871,11 +101894,11 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (statement.kind === 250 /* SyntaxKind.ReturnStatement */) { return true; } // An if-statement with two covered branches is covered. - else if (statement.kind === 239 /* SyntaxKind.IfStatement */) { + else if (statement.kind === 242 /* SyntaxKind.IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && @@ -100883,7 +101906,7 @@ var ts; } } // A block is covered if it has a last statement which is covered. - else if (statement.kind === 235 /* SyntaxKind.Block */) { + else if (statement.kind === 238 /* SyntaxKind.Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -101083,7 +102106,7 @@ var ts; * @param node A node. */ function insertCaptureThisForNodeIfNeeded(statements, node) { - if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 216 /* SyntaxKind.ArrowFunction */) { insertCaptureThisForNode(statements, node, factory.createThis()); return true; } @@ -101117,22 +102140,22 @@ var ts; if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */) { var newTarget = void 0; switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return statements; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Methods and accessors cannot be constructors, so 'new.target' will // always return 'undefined'. newTarget = factory.createVoidZero(); break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Class constructors can only be called with `new`, so `this.constructor` // should be relatively safe to use. newTarget = factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), "constructor"); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: // Functions can be called or constructed, and may have a `this` due to // being a member or when calling an imported function via `other_1.f()`. newTarget = factory.createConditionalExpression(factory.createLogicalAnd(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), factory.createBinaryExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), 102 /* SyntaxKind.InstanceOfKeyword */, factory.getLocalName(node))), @@ -101167,21 +102190,21 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Constructors are handled in visitClassExpression/visitClassDeclaration break; default: @@ -101380,7 +102403,7 @@ var ts; : enterSubtree(32670 /* HierarchyFacts.FunctionExcludes */, 65 /* HierarchyFacts.FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) { + if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) { name = factory.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 98304 /* HierarchyFacts.FunctionSubtreeExcludes */, 0 /* HierarchyFacts.None */); @@ -101426,7 +102449,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 214 /* SyntaxKind.ArrowFunction */); + ts.Debug.assert(node.kind === 216 /* SyntaxKind.ArrowFunction */); // To align with the old emitter, we use a synthetic end position on the location // for the statement list we synthesize when we down-level an arrow function with // an expression function body. This prevents both comments and source maps from @@ -101733,14 +102756,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -101926,7 +102949,7 @@ var ts; var property = properties[i]; if ((property.transformFlags & 1048576 /* TransformFlags.ContainsYield */ && hierarchyFacts & 4 /* HierarchyFacts.AsyncFunctionBody */) - || (hasComputed = ts.Debug.checkDefined(property.name).kind === 162 /* SyntaxKind.ComputedPropertyName */)) { + || (hasComputed = ts.Debug.checkDefined(property.name).kind === 164 /* SyntaxKind.ComputedPropertyName */)) { numInitialProperties = i; break; } @@ -102042,11 +103065,11 @@ var ts; } function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); - case 243 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); - case 244 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); - case 240 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); - case 241 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); + case 245 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); + case 246 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); + case 247 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); + case 243 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); + case 244 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected"); } } @@ -102071,11 +103094,11 @@ var ts; function createConvertedLoopState(node) { var loopInitializer; switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer && initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -102491,20 +103514,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine)); } break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -102611,7 +103634,7 @@ var ts; var updated; var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { updated = factory.updateGetAccessorDeclaration(node, node.modifiers, node.name, parameters, node.type, body); } else { @@ -103071,13 +104094,13 @@ var ts; if ((enabledSubstitutions & 1 /* ES2015SubstitutionFlags.CapturedThis */) === 0) { enabledSubstitutions |= 1 /* ES2015SubstitutionFlags.CapturedThis */; context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(214 /* SyntaxKind.ArrowFunction */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(216 /* SyntaxKind.ArrowFunction */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); } } /** @@ -103118,10 +104141,10 @@ var ts; */ function isNameOfDeclarationWithCollidingName(node) { switch (node.parent.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return node.parent.name === node && resolver.isDeclarationWithCollidingName(node.parent); } @@ -103203,11 +104226,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 238 /* SyntaxKind.ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 241 /* SyntaxKind.ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -103215,7 +104238,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 227 /* SyntaxKind.SpreadElement */) { return false; } var expression = callArgument.expression; @@ -103241,15 +104264,15 @@ var ts; if (compilerOptions.jsx === 1 /* JsxEmit.Preserve */ || compilerOptions.jsx === 3 /* JsxEmit.ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(280 /* SyntaxKind.JsxOpeningElement */); - context.enableEmitNotification(281 /* SyntaxKind.JsxClosingElement */); - context.enableEmitNotification(279 /* SyntaxKind.JsxSelfClosingElement */); + context.enableEmitNotification(283 /* SyntaxKind.JsxOpeningElement */); + context.enableEmitNotification(284 /* SyntaxKind.JsxClosingElement */); + context.enableEmitNotification(282 /* SyntaxKind.JsxSelfClosingElement */); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(296 /* SyntaxKind.PropertyAssignment */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(299 /* SyntaxKind.PropertyAssignment */); return ts.chainBundle(context, transformSourceFile); /** * Transforms an ES5 source file to ES3. @@ -103268,9 +104291,9 @@ var ts; */ function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -103605,13 +104628,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -103624,24 +104647,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return visitBreakStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 1048576 /* TransformFlags.ContainsYield */) { @@ -103662,23 +104685,23 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return visitConditionalExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -103691,9 +104714,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -103900,7 +104923,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // [source] // a.b = yield; // @@ -103912,7 +104935,7 @@ var ts; // _a.b = %sent%; target = factory.updatePropertyAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // [source] // a[b] = yield; // @@ -104306,35 +105329,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return transformAndEmitBlock(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return transformAndEmitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return transformAndEmitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return transformAndEmitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return transformAndEmitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return transformAndEmitForInStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return transformAndEmitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return transformAndEmitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return transformAndEmitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return transformAndEmitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return transformAndEmitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -104565,7 +105588,6 @@ var ts; return node; } function transformAndEmitForInStatement(node) { - // TODO(rbuckton): Source map locations if (containsYield(node)) { // [source] // for (var p in o) { @@ -104573,34 +105595,41 @@ var ts; // } // // [intermediate] - // .local _a, _b, _i - // _a = []; - // for (_b in o) _a.push(_b); + // .local _b, _a, _c, _i + // _b = []; + // _a = o; + // for (_c in _a) _b.push(_c); // _i = 0; // .loop incrementLabel, endLoopLabel // .mark conditionLabel - // .brfalse endLoopLabel, (_i < _a.length) - // p = _a[_i]; + // .brfalse endLoopLabel, (_i < _b.length) + // _c = _b[_i]; + // .brfalse incrementLabel, (_c in _a) + // p = _c; // /*body*/ // .mark incrementLabel - // _b++; + // _c++; // .br conditionLabel // .endloop // .mark endLoopLabel - var keysArray = declareLocal(); // _a - var key = declareLocal(); // _b + var obj = declareLocal(); // _a + var keysArray = declareLocal(); // _b + var key = declareLocal(); // _c var keysIndex = factory.createLoopVariable(); // _i var initializer = node.initializer; hoistVariableDeclaration(keysIndex); + emitAssignment(obj, ts.visitNode(node.expression, visitor, ts.isExpression)); emitAssignment(keysArray, factory.createArrayLiteralExpression()); - emitStatement(factory.createForInStatement(key, ts.visitNode(node.expression, visitor, ts.isExpression), factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"), + emitStatement(factory.createForInStatement(key, obj, factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"), /*typeArguments*/ undefined, [key])))); emitAssignment(keysIndex, factory.createNumericLiteral(0)); var conditionLabel = defineLabel(); var incrementLabel = defineLabel(); - var endLabel = beginLoopBlock(incrementLabel); + var endLoopLabel = beginLoopBlock(incrementLabel); markLabel(conditionLabel); - emitBreakWhenFalse(endLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length"))); + emitBreakWhenFalse(endLoopLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length"))); + emitAssignment(key, factory.createElementAccessExpression(keysArray, keysIndex)); + emitBreakWhenFalse(incrementLabel, factory.createBinaryExpression(key, 101 /* SyntaxKind.InKeyword */, obj)); var variable = void 0; if (ts.isVariableDeclarationList(initializer)) { for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { @@ -104613,7 +105642,7 @@ var ts; variable = ts.visitNode(initializer, visitor, ts.isExpression); ts.Debug.assert(ts.isLeftHandSideExpression(variable)); } - emitAssignment(variable, factory.createElementAccessExpression(keysArray, keysIndex)); + emitAssignment(variable, key); transformAndEmitEmbeddedStatement(node.statement); markLabel(incrementLabel); emitStatement(factory.createExpressionStatement(factory.createPostfixIncrement(keysIndex))); @@ -104764,7 +105793,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -104777,7 +105806,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -105937,12 +106966,12 @@ var ts; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. - context.enableSubstitution(210 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(212 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. @@ -106270,23 +107299,23 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -106299,26 +107328,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node) && currentSourceFile.impliedNodeFormat === undefined) { return visitImportCallExpression(node); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -106334,24 +107363,24 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var elem = _a[_i]; switch (elem.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (destructuringNeedsFlattening(elem.initializer)) { return true; } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (destructuringNeedsFlattening(elem.name)) { return true; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: if (destructuringNeedsFlattening(elem.expression)) { return true; } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return false; default: ts.Debug.assertNever(elem, "Unhandled object member kind"); } @@ -106454,7 +107483,7 @@ var ts; return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis); case ts.ModuleKind.CommonJS: default: - return createImportCallExpressionCommonJS(argument, containsLexicalThis); + return createImportCallExpressionCommonJS(argument); } } function createImportCallExpressionUMD(arg, containsLexicalThis) { @@ -106477,7 +107506,7 @@ var ts; return factory.createConditionalExpression( /*condition*/ factory.createIdentifier("__syncRequire"), /*questionToken*/ undefined, - /*whenTrue*/ createImportCallExpressionCommonJS(arg, containsLexicalThis), + /*whenTrue*/ createImportCallExpressionCommonJS(arg), /*colonToken*/ undefined, /*whenFalse*/ createImportCallExpressionAMD(argClone, containsLexicalThis)); } @@ -106486,7 +107515,7 @@ var ts; return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression( /*condition*/ factory.createIdentifier("__syncRequire"), /*questionToken*/ undefined, - /*whenTrue*/ createImportCallExpressionCommonJS(temp, containsLexicalThis), + /*whenTrue*/ createImportCallExpressionCommonJS(temp, /* isInlineable */ true), /*colonToken*/ undefined, /*whenFalse*/ createImportCallExpressionAMD(temp, containsLexicalThis))); } @@ -106536,14 +107565,20 @@ var ts; } return promise; } - function createImportCallExpressionCommonJS(arg, containsLexicalThis) { - // import("./blah") + function createImportCallExpressionCommonJS(arg, isInlineable) { + // import(x) // emit as - // Promise.resolve().then(function () { return require(x); }) /*CommonJs Require*/ + // var _a; + // (_a = x, Promise.resolve().then(() => require(_a)) /*CommonJs Require*/ // We have to wrap require in then callback so that require is done in asynchronously // if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately - var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []); - var requireCall = factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []); + // If the arg is not inlineable, we have to evaluate it in the current scope with a temp var + var temp = arg && !ts.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined; + var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), + /*typeArguments*/ undefined, + /*argumentsArray*/ []); + var requireCall = factory.createCallExpression(factory.createIdentifier("require"), + /*typeArguments*/ undefined, temp ? [temp] : arg ? [arg] : []); if (ts.getESModuleInterop(compilerOptions)) { requireCall = emitHelpers().createImportStarHelper(requireCall); } @@ -106564,14 +107599,9 @@ var ts; /*typeParameters*/ undefined, /*parameters*/ [], /*type*/ undefined, factory.createBlock([factory.createReturnStatement(requireCall)])); - // if there is a lexical 'this' in the import call arguments, ensure we indicate - // that this new function expression indicates it captures 'this' so that the - // es2015 transformer will properly substitute 'this' with '_this'. - if (containsLexicalThis) { - ts.setEmitFlags(func, 8 /* EmitFlags.CapturesThis */); - } } - return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]); + var downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]); + return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]); } function getHelperExpressionForExport(node, innerExpr) { if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864 /* EmitFlags.NeverApplyImportHelper */) { @@ -106937,7 +107967,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -106992,10 +108022,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding, /* liveBinding */ true); @@ -107079,7 +108109,7 @@ var ts; return statements; } if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); statements = appendExportStatement(statements, exportName, factory.getLocalName(decl), /*location*/ decl); } if (decl.name) { @@ -107208,7 +108238,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; previousOnEmitNode(hint, node, emitCallback); @@ -107270,11 +108300,11 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return substituteTaggedTemplateExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); } return node; @@ -107318,7 +108348,7 @@ var ts; } else if (!(ts.isGeneratedIdentifier(node) && !(node.autoGenerateFlags & 64 /* GeneratedIdentifierFlags.AllowNameSubstitution */)) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(node)), /*location*/ node); } @@ -107408,10 +108438,10 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(231 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(233 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var exportFunctionsMap = []; // The export function associated with a source file. @@ -107601,7 +108631,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var exportStarFunction = addExportStarIfNeeded(statements); // TODO: GH#18217 var modifiers = node.transformFlags & 2097152 /* TransformFlags.ContainsAwait */ ? - factory.createModifiersFromModifierFlags(256 /* ModifierFlags.Async */) : + factory.createModifiersFromModifierFlags(512 /* ModifierFlags.Async */) : undefined; var moduleObject = factory.createObjectLiteralExpression([ factory.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), @@ -107635,7 +108665,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 272 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 275 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -107724,19 +108754,26 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(factory, entry, currentSourceFile); // TODO: GH#18217 switch (entry.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName))); + if (ts.hasSyntacticModifier(entry, 1 /* ModifierFlags.Export */)) { + statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction, + /*typeArguments*/ undefined, [ + factory.createStringLiteral(ts.idText(importVariableName)), + parameterName, + ]))); + } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { if (ts.isNamedExports(entry.exportClause)) { @@ -107795,13 +108832,13 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); default: return topLevelNestedVisitor(node); @@ -107980,7 +109017,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 2097152 /* EmitFlags.NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 305 /* SyntaxKind.SourceFile */ + && (enclosingBlockScopedContainer.kind === 308 /* SyntaxKind.SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* NodeFlags.BlockScoped */) === 0); } /** @@ -108044,7 +109081,7 @@ var ts; // // To balance the declaration, we defer the exports of the elided variable // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasSyntacticModifier(node.original, 1 /* ModifierFlags.Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -108106,10 +109143,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -108204,7 +109241,7 @@ var ts; } var excludeName; if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; statements = appendExportStatement(statements, exportName, factory.getLocalName(decl)); excludeName = ts.getTextOfIdentifierOrLiteral(exportName); } @@ -108289,43 +109326,43 @@ var ts; */ function topLevelNestedVisitor(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ true); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return visitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return visitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return visitDefaultClause(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return visitTryStatement(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -108511,26 +109548,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node)) { return visitImportCallExpression(node); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -108610,7 +109647,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 305 /* SyntaxKind.SourceFile */; + return container !== undefined && container.kind === 308 /* SyntaxKind.SourceFile */; } else { return false; @@ -108688,7 +109725,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -108738,7 +109775,7 @@ var ts; */ function substituteUnspecified(node) { switch (node.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return substituteShorthandPropertyAssignment(node); } return node; @@ -108775,9 +109812,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return substituteMetaProperty(node); } return node; @@ -108867,7 +109904,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { exportedNames = ts.append(exportedNames, factory.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -108910,7 +109947,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); context.enableSubstitution(79 /* SyntaxKind.Identifier */); var helperNameSubstitutions; var currentSourceFile; @@ -108950,14 +109987,14 @@ var ts; } function visitor(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // Though an error in es2020 modules, in node-flavor es2020 modules, we can helpfully transform this to a synthetic `require` call // To give easy access to a synchronous `require` in node-flavor esm. We do the transform even in scenarios where we error, but `import.meta.url` // is available, just because the output is reasonable for a node-like runtime. return ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.Node16 ? visitImportEqualsDeclaration(node) : undefined; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDecl = node; return visitExportDeclaration(exportDecl); } @@ -109114,8 +110151,8 @@ var ts; var cjsOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(305 /* SyntaxKind.SourceFile */); - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableSubstitution(308 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); var currentSourceFile; return transformSourceFileOrBundle; function onSubstituteNode(hint, node) { @@ -109162,7 +110199,7 @@ var ts; return result; } function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -109222,7 +110259,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109251,7 +110288,7 @@ var ts; ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109298,7 +110335,7 @@ var ts; return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: ".concat(ts.Debug.formatSyntaxKind(node.kind))); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109307,8 +110344,8 @@ var ts; } // This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit // The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all. - else if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 166 /* SyntaxKind.PropertySignature */ || - (node.kind === 164 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { + else if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 168 /* SyntaxKind.PropertySignature */ || + (node.kind === 166 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { // TODO(jfreeman): Deal with computed properties in error reporting. if (ts.isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? @@ -109317,7 +110354,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 166 /* SyntaxKind.Parameter */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109342,7 +110379,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Getters can infer the return type from the returned expression, but setters cannot, so the // "_from_external_module_1_but_cannot_be_named" case cannot occur. if (ts.isStatic(node)) { @@ -109381,26 +110418,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109408,7 +110445,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109422,7 +110459,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109447,30 +110484,30 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109478,7 +110515,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109491,15 +110528,15 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 256 /* SyntaxKind.FunctionDeclaration */: - case 179 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109513,39 +110550,39 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1; break; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 179 /* SyntaxKind.FunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -109611,7 +110648,7 @@ var ts; } function isInternalDeclaration(node, currentSourceFile) { var parseTreeNode = ts.getParseTreeNode(node); - if (parseTreeNode && parseTreeNode.kind === 164 /* SyntaxKind.Parameter */) { + if (parseTreeNode && parseTreeNode.kind === 166 /* SyntaxKind.Parameter */) { var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode); var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined; var text = currentSourceFile.text; @@ -109787,7 +110824,7 @@ var ts; var _a; var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; }); var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; }); - if (augmentingDeclarations) { + if (primaryDeclaration && augmentingDeclarations) { for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) { var augmentations = augmentingDeclarations_1[_i]; context.addDiagnostic(ts.addRelatedInfo(ts.createDiagnosticForNode(augmentations, ts.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts.createDiagnosticForNode(primaryDeclaration, ts.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file))); @@ -109817,10 +110854,10 @@ var ts; return result; } function transformRoot(node) { - if (node.kind === 305 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { + if (node.kind === 308 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { return node; } - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { isBundledEmit = true; refs = new ts.Map(); libs = new ts.Map(); @@ -109843,14 +110880,14 @@ var ts; resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) needsDeclare = false; var statements = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile, /*bundled*/ true)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); + var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); return newFile; } needsDeclare = true; var updated = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); return factory.updateSourceFile(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); }), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal); hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib; collectReferences(sourceFile, refs); @@ -109991,7 +111028,7 @@ var ts; return name; } else { - if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { return factory.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -109999,7 +111036,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (elem.kind === 229 /* SyntaxKind.OmittedExpression */) { return elem; } if (elem.propertyName && ts.isIdentifier(elem.propertyName) && ts.isIdentifier(elem.name) && !elem.symbol.isReferenced) { @@ -110041,19 +111078,19 @@ var ts; // Literal const declarations will have an initializer ensured rather than a type return; } - var shouldUseResolverType = node.kind === 164 /* SyntaxKind.Parameter */ && + var shouldUseResolverType = node.kind === 166 /* SyntaxKind.Parameter */ && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); if (type && !shouldUseResolverType) { return ts.visitNode(type, visitDeclarationSubtree); } if (!ts.getParseTreeNode(node)) { - return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now // (The inferred type here will be void, but the old declaration emitter printed `any`, so this replicates that) - return factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } errorNameNode = node.name; var oldDiag; @@ -110061,12 +111098,12 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } - if (node.kind === 164 /* SyntaxKind.Parameter */ - || node.kind === 167 /* SyntaxKind.PropertyDeclaration */ - || node.kind === 166 /* SyntaxKind.PropertySignature */) { + if (node.kind === 166 /* SyntaxKind.Parameter */ + || node.kind === 169 /* SyntaxKind.PropertyDeclaration */ + || node.kind === 168 /* SyntaxKind.PropertySignature */) { if (ts.isPropertySignature(node) || !node.initializer) return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType)); return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); @@ -110077,28 +111114,28 @@ var ts; if (!suppressNewDiagnosticContexts) { getSymbolAccessibilityDiagnostic = oldDiag; } - return returnValue || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return returnValue || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return !resolver.isDeclarationVisible(node); // The following should be doing their own visibility checks based on filtering their members - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !getBindingNameVisible(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; } return false; @@ -110187,7 +111224,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return undefined; // TODO: GH#18217 - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 200 /* SyntaxKind.ImportType */); + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 202 /* SyntaxKind.ImportType */); if (ts.isStringLiteralLike(input)) { if (isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); @@ -110207,7 +111244,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (decl.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // Rewrite external module names if necessary var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return factory.updateImportEqualsDeclaration(decl, decl.modifiers, decl.isTypeOnly, decl.name, factory.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))); @@ -110232,7 +111269,7 @@ var ts; return visibleDefaultBinding && factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); } - if (decl.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (decl.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // Namespace import (optionally with visible default) var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined; return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined; @@ -110335,7 +111372,7 @@ var ts; // We'd see a TDZ violation at runtime var canProduceDiagnostic = ts.canProduceDiagnostics(input); var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 182 /* SyntaxKind.TypeLiteral */ || input.kind === 195 /* SyntaxKind.MappedType */) && input.parent.kind !== 259 /* SyntaxKind.TypeAliasDeclaration */); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 184 /* SyntaxKind.TypeLiteral */ || input.kind === 197 /* SyntaxKind.MappedType */) && input.parent.kind !== 262 /* SyntaxKind.TypeAliasDeclaration */); // Emit methods which are private as properties with no type information if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) { if (ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)) { @@ -110356,28 +111393,28 @@ var ts; } if (isProcessedComponent(input)) { switch (input.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments)); } - case 178 /* SyntaxKind.TypeReference */: { + case 180 /* SyntaxKind.TypeReference */: { checkEntityNameVisibility(input.typeName, enclosingDeclaration); var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); } - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return cleanup(factory.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { // A constructor declaration may not have a type annotation var ctor = factory.createConstructorDeclaration( /*modifiers*/ ensureModifiers(input), updateParamsList(input, input.parameters, 0 /* ModifierFlags.None */), /*body*/ undefined); return cleanup(ctor); } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110386,7 +111423,7 @@ var ts; /*body*/ undefined); return cleanup(sig); } - case 172 /* SyntaxKind.GetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110394,36 +111431,36 @@ var ts; return cleanup(factory.updateGetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), ensureType(input, accessorType), /*body*/ undefined)); } - case 173 /* SyntaxKind.SetAccessor */: { + case 175 /* SyntaxKind.SetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateSetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), /*body*/ undefined)); } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertyDeclaration(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type), ensureNoInitializer(input))); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type))); - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateMethodSignature(input, ensureModifiers(input), input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { return cleanup(factory.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 176 /* SyntaxKind.IndexSignature */: { - return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */))); + case 178 /* SyntaxKind.IndexSignature */: { + return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */))); } - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -110431,13 +111468,13 @@ var ts; suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types return cleanup(factory.updateVariableDeclaration(input, input.name, /*exclamationToken*/ undefined, ensureType(input, input.type), ensureNoInitializer(input))); } - case 163 /* SyntaxKind.TypeParameter */: { + case 165 /* SyntaxKind.TypeParameter */: { if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) { return cleanup(factory.updateTypeParameterDeclaration(input, input.modifiers, input.name, /*constraint*/ undefined, /*defaultType*/ undefined)); } return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context)); } - case 189 /* SyntaxKind.ConditionalType */: { + case 191 /* SyntaxKind.ConditionalType */: { // We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration // just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type. var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree); @@ -110449,13 +111486,13 @@ var ts; var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree); return cleanup(factory.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); } - case 179 /* SyntaxKind.FunctionType */: { + case 181 /* SyntaxKind.FunctionType */: { return cleanup(factory.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 180 /* SyntaxKind.ConstructorType */: { + case 182 /* SyntaxKind.ConstructorType */: { return cleanup(factory.updateConstructorTypeNode(input, ensureModifiers(input), ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 200 /* SyntaxKind.ImportType */: { + case 202 /* SyntaxKind.ImportType */: { if (!ts.isLiteralImportTypeNode(input)) return cleanup(input); return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); @@ -110487,7 +111524,7 @@ var ts; } } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); + return node.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); } function visitDeclarationStatements(input) { if (!isPreservedDeclarationStatement(input)) { @@ -110497,7 +111534,7 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -110506,7 +111543,7 @@ var ts; // Rewrite external module names if necessary return factory.updateExportDeclaration(input, input.modifiers, input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), ts.getResolutionModeOverrideForClause(input.assertClause) ? input.assertClause : undefined); } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { // Always visible if the parent node isn't dropped for being not visible if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; @@ -110524,7 +111561,7 @@ var ts; errorFallbackNode = input; var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); errorFallbackNode = undefined; - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); preserveJsDoc(statement, input); ts.removeAllComments(input); return [statement, factory.updateExportAssignment(input, input.modifiers, newId)]; @@ -110537,12 +111574,12 @@ var ts; return input; } function stripExportModifiers(statement) { - if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 512 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { + if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 1024 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { // `export import` statements should remain as-is, as imports are _not_ implicitly exported in an ambient namespace // Likewise, `export default` classes and the like and just be `default`, so we preserve their `export` modifiers, too return statement; } - var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (257023 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); + var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (258047 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); return factory.updateModifiers(statement, modifiers); } function transformTopLevelDeclaration(input) { @@ -110553,10 +111590,10 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { return transformImportEqualsDeclaration(input); } - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { return transformImportDeclaration(input); } } @@ -110577,12 +111614,16 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 259 /* SyntaxKind.TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all - return cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 258 /* SyntaxKind.InterfaceDeclaration */: { + case 262 /* SyntaxKind.TypeAliasDeclaration */: { + needsDeclare = false; + var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); + needsDeclare = previousNeedsDeclare; + return clean; + } + case 261 /* SyntaxKind.InterfaceDeclaration */: { return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { // Generators lose their generator-ness, excepting their return type var clean = cleanup(factory.updateFunctionDeclaration(input, ensureModifiers(input), /*asteriskToken*/ undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), @@ -110623,10 +111664,10 @@ var ts; })))); } var namespaceDecl = factory.createModuleDeclaration(ensureModifiers(input), input.name, factory.createModuleBlock(declarations), 16 /* NodeFlags.Namespace */); - if (!ts.hasEffectiveModifier(clean, 512 /* ModifierFlags.Default */)) { + if (!ts.hasEffectiveModifier(clean, 1024 /* ModifierFlags.Default */)) { return [clean, namespaceDecl]; } - var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~513 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); + var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~1025 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); var cleanDeclaration = factory.updateFunctionDeclaration(clean, modifiers, /*asteriskToken*/ undefined, clean.name, clean.typeParameters, clean.parameters, clean.type, /*body*/ undefined); @@ -110644,10 +111685,10 @@ var ts; return clean; } } - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 264 /* SyntaxKind.ModuleDeclaration */: { needsDeclare = false; var inner = input.body; - if (inner && inner.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (inner && inner.kind === 265 /* SyntaxKind.ModuleBlock */) { var oldNeedsScopeFix = needsScopeFixMarker; var oldHasScopeFix = resultHasScopeMarker; resultHasScopeMarker = false; @@ -110688,7 +111729,7 @@ var ts; return cleanup(factory.updateModuleDeclaration(input, mods, input.name, body)); } } - case 257 /* SyntaxKind.ClassDeclaration */: { + case 260 /* SyntaxKind.ClassDeclaration */: { errorNameNode = input.name; errorFallbackNode = input; var modifiers = factory.createNodeArray(ensureModifiers(input)); @@ -110750,7 +111791,7 @@ var ts; typeName: input.name }); }; var varDecl = factory.createVariableDeclaration(newId_1, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); var heritageClauses = factory.createNodeArray(ts.map(input.heritageClauses, function (clause) { if (clause.token === 94 /* SyntaxKind.ExtendsKeyword */) { var oldDiag_2 = getSymbolAccessibilityDiagnostic; @@ -110768,10 +111809,10 @@ var ts; return cleanup(factory.updateClassDeclaration(input, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { return cleanup(transformVariableStatement(input)); } - case 260 /* SyntaxKind.EnumDeclaration */: { + case 263 /* SyntaxKind.EnumDeclaration */: { return cleanup(factory.updateEnumDeclaration(input, factory.createNodeArray(ensureModifiers(input)), input.name, factory.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -110790,7 +111831,7 @@ var ts; if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - if (input.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (input.kind === 264 /* SyntaxKind.ModuleDeclaration */) { needsDeclare = previousNeedsDeclare; } if (node === input) { @@ -110813,7 +111854,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (e.kind === 229 /* SyntaxKind.OmittedExpression */) { return; } if (e.name) { @@ -110861,9 +111902,9 @@ var ts; return factory.createModifiersFromModifierFlags(newFlags); } function ensureModifierFlags(node) { - var mask = 257023 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 256 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files + var mask = 258047 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 512 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* ModifierFlags.Ambient */ : 0 /* ModifierFlags.None */; - var parentIsFile = node.parent.kind === 305 /* SyntaxKind.SourceFile */; + var parentIsFile = node.parent.kind === 308 /* SyntaxKind.SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= 2 /* ModifierFlags.Ambient */; additions = 0 /* ModifierFlags.None */; @@ -110892,7 +111933,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return true; } return false; @@ -110902,22 +111943,22 @@ var ts; return ts.factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); } function maskModifierFlags(node, modifierMask, modifierAdditions) { - if (modifierMask === void 0) { modifierMask = 257023 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } + if (modifierMask === void 0) { modifierMask = 258047 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } if (modifierAdditions === void 0) { modifierAdditions = 0 /* ModifierFlags.None */; } var flags = (ts.getEffectiveModifierFlags(node) & modifierMask) | modifierAdditions; - if (flags & 512 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { + if (flags & 1024 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { // A non-exported default is a nonsequitor - we usually try to remove all export modifiers // from statements in ambient declarations; but a default export must retain its export modifier to be syntactically valid flags ^= 1 /* ModifierFlags.Export */; } - if (flags & 512 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { + if (flags & 1024 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { flags ^= 2 /* ModifierFlags.Ambient */; // `declare` is never required alongside `default` (and would be an error if printed) } return flags; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 172 /* SyntaxKind.GetAccessor */ + return accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -110926,52 +111967,52 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return !ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */); - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } return false; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return true; } return false; } function isProcessedComponent(node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 254 /* SyntaxKind.VariableDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: - case 189 /* SyntaxKind.ConditionalType */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 200 /* SyntaxKind.ImportType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 191 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 202 /* SyntaxKind.ImportType */: return true; } return false; @@ -111111,7 +112152,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, factory, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(355 /* SyntaxKind.Count */); + var enabledSyntaxKindFeatures = new Array(358 /* SyntaxKind.Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentStatements; @@ -111193,7 +112234,7 @@ var ts; var transformed = []; for (var _a = 0, nodes_3 = nodes; _a < nodes_3.length; _a++) { var node = nodes_3[_a]; - ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 305 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); + ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 308 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); transformed.push((allowDtsFiles ? transformation : transformRoot)(node)); ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop(); } @@ -111599,7 +112640,7 @@ var ts; /*@internal*/ function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 306 /* SyntaxKind.Bundle */) { + if (sourceFile.kind === 309 /* SyntaxKind.Bundle */) { return getOutputPathsForBundle(options, forceDtsPaths); } else { @@ -111968,8 +113009,8 @@ var ts; } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) { var sourceFileOrBundle = transform.transformed[0]; - var bundle = sourceFileOrBundle.kind === 306 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 309 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; var sourceMapGenerator; if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) { @@ -112019,7 +113060,7 @@ var ts; } function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) { return (mapOptions.sourceMap || mapOptions.inlineSourceMap) - && (sourceFileOrBundle.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); + && (sourceFileOrBundle.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); } function getSourceRoot(mapOptions) { // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the @@ -112082,8 +113123,8 @@ var ts; } ts.getBuildInfoText = getBuildInfoText; /*@internal*/ - function getBuildInfo(buildInfoText) { - return JSON.parse(buildInfoText); + function getBuildInfo(buildInfoFile, buildInfoText) { + return ts.readJsonOrUndefined(buildInfoFile, buildInfoText); } ts.getBuildInfo = getBuildInfo; /*@internal*/ @@ -112161,17 +113202,16 @@ var ts; var buildInfo; if (host.getBuildInfo) { // If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo - var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); - if (!hostBuildInfo) - return buildInfoPath; - buildInfo = hostBuildInfo; + buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); } else { var buildInfoText = host.readFile(buildInfoPath); if (!buildInfoText) return buildInfoPath; - buildInfo = getBuildInfo(buildInfoText); + buildInfo = getBuildInfo(buildInfoPath, buildInfoText); } + if (!buildInfo) + return buildInfoPath; if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts)) return buildInfoPath; var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath)); @@ -112297,6 +113337,10 @@ var ts; var nodeIdToGeneratedName; // Map of generated names for specific nodes. var autoGeneratedIdToGeneratedName; // Map of generated names for temp and loop variables. var generatedNames; // Set of names generated by the NameGenerator. + var formattedNameTempFlagsStack; + var formattedNameTempFlags; + var privateNameTempFlagsStack; // Stack of enclosing name generation scopes. + var privateNameTempFlags; // TempFlags for the current name generation scope. var tempFlagsStack; // Stack of enclosing name generation scopes. var tempFlags; // TempFlags for the current name generation scope. var reservedNamesStack; // Stack of TempFlags reserved in enclosing name generation scopes. @@ -112362,9 +113406,9 @@ var ts; break; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: return printFile(node); - case 306 /* SyntaxKind.Bundle */: return printBundle(node); - case 307 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); + case 308 /* SyntaxKind.SourceFile */: return printFile(node); + case 309 /* SyntaxKind.Bundle */: return printBundle(node); + case 310 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -112555,6 +113599,10 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNames = new ts.Set(); + formattedNameTempFlagsStack = []; + formattedNameTempFlags = new ts.Map(); + privateNameTempFlagsStack = []; + privateNameTempFlags = 0 /* TempFlags.Auto */; tempFlagsStack = []; tempFlags = 0 /* TempFlags.Auto */; reservedNamesStack = []; @@ -112698,315 +113746,315 @@ var ts; return emitPrivateIdentifier(node); // Parse tree nodes // Names - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return emitQualifiedName(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return emitComputedPropertyName(node); // Signature elements - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return emitTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return emitParameter(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return emitDecorator(node); // Type members - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return emitPropertySignature(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return emitPropertyDeclaration(node); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return emitMethodSignature(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return emitMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return emitClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return emitConstructor(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return emitAccessorDeclaration(node); - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return emitCallSignature(node); - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return emitConstructSignature(node); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return emitIndexSignature(node); // Types - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return emitTypePredicate(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return emitTypeReference(node); - case 179 /* SyntaxKind.FunctionType */: + case 181 /* SyntaxKind.FunctionType */: return emitFunctionType(node); - case 180 /* SyntaxKind.ConstructorType */: + case 182 /* SyntaxKind.ConstructorType */: return emitConstructorType(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return emitTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return emitTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return emitArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return emitTupleType(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return emitOptionalType(node); // SyntaxKind.RestType is handled below - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return emitUnionType(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return emitIntersectionType(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return emitConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return emitInferType(node); - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return emitParenthesizedType(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return emitThisType(); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return emitTypeOperator(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return emitIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return emitMappedType(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return emitLiteralType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return emitNamedTupleMember(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return emitTemplateType(node); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return emitTemplateTypeSpan(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return emitImportTypeNode(node); // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return emitBindingElement(node); // Misc - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return emitTemplateSpan(node); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return emitBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return emitVariableStatement(node); - case 236 /* SyntaxKind.EmptyStatement */: + case 239 /* SyntaxKind.EmptyStatement */: return emitEmptyStatement(/*isEmbeddedStatement*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return emitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return emitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return emitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return emitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return emitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return emitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return emitForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return emitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return emitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return emitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return emitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return emitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return emitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return emitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return emitTryStatement(node); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return emitVariableDeclaration(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return emitVariableDeclarationList(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return emitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return emitClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return emitEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return emitModuleDeclaration(node); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return emitModuleBlock(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return emitCaseBlock(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return emitNamespaceExportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return emitImportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return emitImportClause(node); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return emitNamespaceImport(node); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return emitNamespaceExport(node); - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: return emitNamedImports(node); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return emitImportSpecifier(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return emitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return emitExportDeclaration(node); - case 273 /* SyntaxKind.NamedExports */: + case 276 /* SyntaxKind.NamedExports */: return emitNamedExports(node); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return emitExportSpecifier(node); - case 293 /* SyntaxKind.AssertClause */: + case 296 /* SyntaxKind.AssertClause */: return emitAssertClause(node); - case 294 /* SyntaxKind.AssertEntry */: + case 297 /* SyntaxKind.AssertEntry */: return emitAssertEntry(node); - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return; // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 11 /* SyntaxKind.JsxText */: return emitJsxText(node); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: return emitJsxOpeningElementOrFragment(node); - case 281 /* SyntaxKind.JsxClosingElement */: - case 284 /* SyntaxKind.JsxClosingFragment */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 287 /* SyntaxKind.JsxClosingFragment */: return emitJsxClosingElementOrFragment(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return emitJsxAttribute(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return emitJsxAttributes(node); - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return emitJsxExpression(node); // Clauses - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return emitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return emitDefaultClause(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return emitHeritageClause(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return emitCatchClause(node); // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return emitPropertyAssignment(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return emitEnumMember(node); // Unparsed - case 300 /* SyntaxKind.UnparsedPrologue */: + case 303 /* SyntaxKind.UnparsedPrologue */: return writeUnparsedNode(node); - case 307 /* SyntaxKind.UnparsedSource */: - case 301 /* SyntaxKind.UnparsedPrepend */: + case 310 /* SyntaxKind.UnparsedSource */: + case 304 /* SyntaxKind.UnparsedPrepend */: return emitUnparsedSourceOrPrepend(node); - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return emitUnparsedTextLike(node); - case 304 /* SyntaxKind.UnparsedSyntheticReference */: + case 307 /* SyntaxKind.UnparsedSyntheticReference */: return emitUnparsedSyntheticReference(node); // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return emitSourceFile(node); - case 306 /* SyntaxKind.Bundle */: + case 309 /* SyntaxKind.Bundle */: return ts.Debug.fail("Bundles should be printed using printBundle"); // SyntaxKind.UnparsedSource (handled above) - case 308 /* SyntaxKind.InputFiles */: + case 311 /* SyntaxKind.InputFiles */: return ts.Debug.fail("InputFiles should not be printed"); // JSDoc nodes (only used in codefixes currently) - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return emitJSDocTypeExpression(node); - case 310 /* SyntaxKind.JSDocNameReference */: + case 313 /* SyntaxKind.JSDocNameReference */: return emitJSDocNameReference(node); - case 312 /* SyntaxKind.JSDocAllType */: + case 315 /* SyntaxKind.JSDocAllType */: return writePunctuation("*"); - case 313 /* SyntaxKind.JSDocUnknownType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return writePunctuation("?"); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return emitJSDocNullableType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return emitJSDocOptionalType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return emitJSDocFunctionType(node); - case 186 /* SyntaxKind.RestType */: - case 318 /* SyntaxKind.JSDocVariadicType */: + case 188 /* SyntaxKind.RestType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return emitRestOrJSDocVariadicType(node); - case 319 /* SyntaxKind.JSDocNamepathType */: + case 322 /* SyntaxKind.JSDocNamepathType */: return; - case 320 /* SyntaxKind.JSDoc */: + case 323 /* SyntaxKind.JSDoc */: return emitJSDoc(node); - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: return emitJSDocTypeLiteral(node); - case 323 /* SyntaxKind.JSDocSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return emitJSDocSignature(node); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 337 /* SyntaxKind.JSDocOverrideTag */: + case 330 /* SyntaxKind.JSDocTag */: + case 335 /* SyntaxKind.JSDocClassTag */: + case 340 /* SyntaxKind.JSDocOverrideTag */: return emitJSDocSimpleTag(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return emitJSDocHeritageTag(node); - case 330 /* SyntaxKind.JSDocAuthorTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: + case 333 /* SyntaxKind.JSDocAuthorTag */: + case 334 /* SyntaxKind.JSDocDeprecatedTag */: return; // SyntaxKind.JSDocClassTag (see JSDocTag, above) - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 339 /* SyntaxKind.JSDocReadonlyTag */: return; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return emitJSDocCallbackTag(node); // SyntaxKind.JSDocEnumTag (see below) - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return emitJSDocPropertyLikeTag(node); - case 339 /* SyntaxKind.JSDocEnumTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return emitJSDocSimpleTypedTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return emitJSDocTemplateTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return emitJSDocTypedefTag(node); - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: return emitJSDocSeeTag(node); // SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above) // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 352 /* SyntaxKind.NotEmittedStatement */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return; } if (ts.isExpression(node)) { @@ -113038,85 +114086,87 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: return emitPrivateIdentifier(node); // Expressions - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return emitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return emitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return emitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return emitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return emitArrowFunction(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return emitDeleteExpression(node); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return emitTypeOfExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return emitVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return emitAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return emitBinaryExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return emitConditionalExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return emitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return emitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return emitSpreadElement(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return emitClassExpression(node); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: return emitAsExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return emitNonNullExpression(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return emitSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return emitMetaProperty(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return ts.Debug.fail("SyntheticExpression should never be printed."); // JSX - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return emitJsxElement(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return emitJsxFragment(node); // Synthesized list - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.Debug.fail("SyntaxList should not be printed"); // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: + case 352 /* SyntaxKind.NotEmittedStatement */: return; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return emitCommaList(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return; - case 354 /* SyntaxKind.SyntheticReferenceExpression */: + case 357 /* SyntaxKind.SyntheticReferenceExpression */: return ts.Debug.fail("SyntheticReferenceExpression should not be printed"); } } @@ -113164,7 +114214,7 @@ var ts; } function emitHelpers(node) { var helpersEmitted = false; - var bundle = node.kind === 306 /* SyntaxKind.Bundle */ ? node : undefined; + var bundle = node.kind === 309 /* SyntaxKind.Bundle */ ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -113264,7 +114314,7 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 302 /* SyntaxKind.UnparsedText */ ? + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 305 /* SyntaxKind.UnparsedText */ ? "text" /* BundleFileSectionKind.Text */ : "internal" /* BundleFileSectionKind.Internal */); } @@ -113301,7 +114351,7 @@ var ts; } function emitTabStop(hint, node, snippet) { // A tab stop should only be attached to an empty node, i.e. a node that doesn't emit any text. - ts.Debug.assert(node.kind === 236 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); + ts.Debug.assert(node.kind === 239 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); ts.Debug.assert(hint !== 5 /* EmitHint.EmbeddedStatement */, "A tab stop cannot be attached to an embedded statement."); nonEscapingWrite("$".concat(snippet.order)); } @@ -113362,7 +114412,7 @@ var ts; emit(node.dotDotDotToken); emitNodeWithWriter(node.name, writeParameter); emit(node.questionToken); - if (node.parent && node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */ && !node.name) { + if (node.parent && node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */ && !node.name) { emit(node.type); } else { @@ -113423,7 +114473,7 @@ var ts; } function emitAccessorDeclaration(node) { emitDecoratorsAndModifiers(node, node.modifiers); - writeKeyword(node.kind === 172 /* SyntaxKind.GetAccessor */ ? "get" : "set"); + writeKeyword(node.kind === 174 /* SyntaxKind.GetAccessor */ ? "get" : "set"); writeSpace(); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); @@ -113596,7 +114646,7 @@ var ts; function emitTypeOperator(node) { writeTokenText(node.operator, writeKeyword); writeSpace(); - var parenthesizerRule = node.operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + var parenthesizerRule = node.operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : parenthesizer.parenthesizeOperandOfTypeOperator; emit(node.type, parenthesizerRule); @@ -113619,7 +114669,7 @@ var ts; } if (node.readonlyToken) { emit(node.readonlyToken); - if (node.readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { + if (node.readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { writeKeyword("readonly"); } writeSpace(); @@ -113865,7 +114915,7 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } function emitAwaitExpression(node) { - emitTokenWithComment(132 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(133 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } @@ -113890,7 +114940,7 @@ var ts; // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. var operand = node.operand; - return operand.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ + return operand.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && ((node.operator === 39 /* SyntaxKind.PlusToken */ && (operand.operator === 39 /* SyntaxKind.PlusToken */ || operand.operator === 45 /* SyntaxKind.PlusPlusToken */)) || (node.operator === 40 /* SyntaxKind.MinusToken */ && (operand.operator === 40 /* SyntaxKind.MinusToken */ || operand.operator === 46 /* SyntaxKind.MinusMinusToken */))); } @@ -114038,6 +115088,15 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); writeOperator("!"); } + function emitSatisfiesExpression(node) { + emitExpression(node.expression, /*parenthesizerRules*/ undefined); + if (node.type) { + writeSpace(); + writeKeyword("satisfies"); + writeSpace(); + emit(node.type); + } + } function emitMetaProperty(node) { writeToken(node.keywordToken, node.pos, writePunctuation); writePunctuation("."); @@ -114095,7 +115154,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node, node.thenStatement, node.elseStatement); emitTokenWithComment(91 /* SyntaxKind.ElseKeyword */, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 239 /* SyntaxKind.IfStatement */) { + if (node.elseStatement.kind === 242 /* SyntaxKind.IfStatement */) { writeSpace(); emit(node.elseStatement); } @@ -114158,7 +115217,7 @@ var ts; emitTokenWithComment(20 /* SyntaxKind.OpenParenToken */, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(160 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); + emitTokenWithComment(162 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitTokenWithComment(21 /* SyntaxKind.CloseParenToken */, node.expression.end, writePunctuation, node); @@ -114166,7 +115225,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { emit(node); } else { @@ -114203,7 +115262,7 @@ var ts; } pos = writeTokenText(token, writer, pos); if (isSimilarNode && contextNode.end !== pos) { - var isJsxExprContext = contextNode.kind === 288 /* SyntaxKind.JsxExpression */; + var isJsxExprContext = contextNode.kind === 291 /* SyntaxKind.JsxExpression */; emitTrailingCommentsOfPosition(pos, /*prefixSpace*/ !isJsxExprContext, /*forceNoNewline*/ isJsxExprContext); } return pos; @@ -114513,7 +115572,7 @@ var ts; emitTokenWithComment(100 /* SyntaxKind.ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114538,7 +115597,7 @@ var ts; if (node.importClause) { emit(node.importClause); writeSpace(); - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); writeSpace(); } emitExpression(node.moduleSpecifier); @@ -114549,7 +115608,7 @@ var ts; } function emitImportClause(node) { if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114562,7 +115621,7 @@ var ts; function emitNamespaceImport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114588,10 +115647,11 @@ var ts; writeTrailingSemicolon(); } function emitExportDeclaration(node) { + emitModifiers(node, node.modifiers); var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - nextPos = emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); writeSpace(); } if (node.exportClause) { @@ -114603,7 +115663,7 @@ var ts; if (node.moduleSpecifier) { writeSpace(); var fromPos = node.exportClause ? node.exportClause.end : nextPos; - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); writeSpace(); emitExpression(node.moduleSpecifier); } @@ -114613,7 +115673,7 @@ var ts; writeTrailingSemicolon(); } function emitAssertClause(node) { - emitTokenWithComment(129 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(130 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); writeSpace(); var elements = node.elements; emitList(node, elements, 526226 /* ListFormat.ImportClauseEntries */); @@ -114633,9 +115693,9 @@ var ts; function emitNamespaceExportDeclaration(node) { var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(142 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(143 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); writeSpace(); emit(node.name); writeTrailingSemicolon(); @@ -114643,7 +115703,7 @@ var ts; function emitNamespaceExport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114666,7 +115726,7 @@ var ts; if (node.propertyName) { emit(node.propertyName); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114887,7 +115947,7 @@ var ts; } } if (node.tags) { - if (node.tags.length === 1 && node.tags[0].kind === 343 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { + if (node.tags.length === 1 && node.tags[0].kind === 346 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { writeSpace(); emit(node.tags[0]); } @@ -114932,7 +115992,7 @@ var ts; function emitJSDocTypedefTag(tag) { emitJSDocTagName(tag.tagName); if (tag.typeExpression) { - if (tag.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */) { + if (tag.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */) { emitJSDocTypeExpression(tag.typeExpression); } else { @@ -114951,7 +116011,7 @@ var ts; emit(tag.fullName); } emitJSDocComment(tag.comment); - if (tag.typeExpression && tag.typeExpression.kind === 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (tag.typeExpression && tag.typeExpression.kind === 325 /* SyntaxKind.JSDocTypeLiteral */) { emitJSDocTypeLiteral(tag.typeExpression); } } @@ -115884,13 +116944,13 @@ var ts; && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile)); } function skipSynthesizedParentheses(node) { - while (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; } function getTextOfNode(node, includeTrivia) { - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.isGeneratedPrivateIdentifier(node)) { return generateName(node); } if (ts.isStringLiteral(node) && node.textSourceNode) { @@ -115914,7 +116974,7 @@ var ts; function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) { if (node.kind === 10 /* SyntaxKind.StringLiteral */ && node.textSourceNode) { var textSourceNode = node.textSourceNode; - if (ts.isIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { + if (ts.isIdentifier(textSourceNode) || ts.isPrivateIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { var text = ts.isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode); return jsxAttributeEscape ? "\"".concat(ts.escapeJsxAttributeString(text), "\"") : neverAsciiEscape || (ts.getEmitFlags(node) & 16777216 /* EmitFlags.NoAsciiEscaping */) ? "\"".concat(ts.escapeString(text), "\"") : @@ -115938,7 +116998,11 @@ var ts; return; } tempFlagsStack.push(tempFlags); - tempFlags = 0; + tempFlags = 0 /* TempFlags.Auto */; + privateNameTempFlagsStack.push(privateNameTempFlags); + privateNameTempFlags = 0 /* TempFlags.Auto */; + formattedNameTempFlagsStack.push(formattedNameTempFlags); + formattedNameTempFlags = undefined; reservedNamesStack.push(reservedNames); } /** @@ -115949,6 +117013,8 @@ var ts; return; } tempFlags = tempFlagsStack.pop(); + privateNameTempFlags = privateNameTempFlagsStack.pop(); + formattedNameTempFlags = formattedNameTempFlagsStack.pop(); reservedNames = reservedNamesStack.pop(); } function reserveNameInNestedScopes(name) { @@ -115961,84 +117027,84 @@ var ts; if (!node) return; switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: ts.forEach(node.statements, generateNames); break; - case 250 /* SyntaxKind.LabeledStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: generateNames(node.statement); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: generateNames(node.thenStatement); generateNames(node.elseStatement); break; - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: generateNames(node.initializer); generateNames(node.statement); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: generateNames(node.caseBlock); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: ts.forEach(node.clauses, generateNames); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: ts.forEach(node.statements, generateNames); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: generateNames(node.tryBlock); generateNames(node.catchClause); generateNames(node.finallyBlock); break; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: generateNames(node.variableDeclaration); generateNames(node.block); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: generateNames(node.declarationList); break; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: ts.forEach(node.declarations, generateNames); break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: generateNameIfNeeded(node.name); break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: generateNameIfNeeded(node.name); if (ts.getEmitFlags(node) & 524288 /* EmitFlags.ReuseTempVariableScope */) { ts.forEach(node.parameters, generateNames); generateNames(node.body); } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: ts.forEach(node.elements, generateNames); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: generateNames(node.importClause); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: generateNameIfNeeded(node.name); generateNames(node.namedBindings); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: generateNameIfNeeded(node.name); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: generateNameIfNeeded(node.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: ts.forEach(node.elements, generateNames); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: generateNameIfNeeded(node.propertyName || node.name); break; } @@ -116047,19 +117113,19 @@ var ts; if (!node) return; switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: generateNameIfNeeded(node.name); break; } } function generateNameIfNeeded(name) { if (name) { - if (ts.isGeneratedIdentifier(name)) { + if (ts.isGeneratedIdentifier(name) || ts.isGeneratedPrivateIdentifier(name)) { generateName(name); } else if (ts.isBindingPattern(name)) { @@ -116074,7 +117140,7 @@ var ts; if ((name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) === 4 /* GeneratedIdentifierFlags.Node */) { // Node names generate unique names based on their original node // and are cached based on that node's id. - return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags); + return generateNameCached(ts.getNodeForGeneratedName(name), ts.isPrivateIdentifier(name), name.autoGenerateFlags, name.autoGeneratePrefix, name.autoGenerateSuffix); } else { // Auto, Loop, and Unique names are cached based on their unique @@ -116083,9 +117149,9 @@ var ts; return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name)); } } - function generateNameCached(node, flags) { + function generateNameCached(node, privateName, flags, prefix, suffix) { var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags)); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags !== null && flags !== void 0 ? flags : 0 /* GeneratedIdentifierFlags.None */, ts.formatGeneratedNamePart(prefix, generateName), ts.formatGeneratedNamePart(suffix))); } /** * Returns a value indicating whether a name is unique globally, within the current file, @@ -116117,20 +117183,53 @@ var ts; } return true; } + function getTempFlags(formattedNameKey) { + var _a; + switch (formattedNameKey) { + case "": + return tempFlags; + case "#": + return privateNameTempFlags; + default: + return (_a = formattedNameTempFlags === null || formattedNameTempFlags === void 0 ? void 0 : formattedNameTempFlags.get(formattedNameKey)) !== null && _a !== void 0 ? _a : 0 /* TempFlags.Auto */; + } + } + function setTempFlags(formattedNameKey, flags) { + switch (formattedNameKey) { + case "": + tempFlags = flags; + break; + case "#": + privateNameTempFlags = flags; + break; + default: + formattedNameTempFlags !== null && formattedNameTempFlags !== void 0 ? formattedNameTempFlags : (formattedNameTempFlags = new ts.Map()); + formattedNameTempFlags.set(formattedNameKey, flags); + break; + } + } /** * Return the next available name in the pattern _a ... _z, _0, _1, ... * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. * Note that names generated by makeTempVariableName and makeUniqueName will never conflict. */ - function makeTempVariableName(flags, reservedInNestedScopes) { + function makeTempVariableName(flags, reservedInNestedScopes, privateName, prefix, suffix) { + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } + // Generate a key to use to acquire a TempFlags counter based on the fixed portions of the generated name. + var key = ts.formatGeneratedName(privateName, prefix, "", suffix); + var tempFlags = getTempFlags(key); if (flags && !(tempFlags & flags)) { var name = flags === 268435456 /* TempFlags._i */ ? "_i" : "_n"; - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { tempFlags |= flags; if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } while (true) { @@ -116141,11 +117240,13 @@ var ts; var name = count < 26 ? "_" + String.fromCharCode(97 /* CharacterCodes.a */ + count) : "_" + (count - 26); - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } } @@ -116157,17 +117258,24 @@ var ts; * makeUniqueName are guaranteed to never conflict. * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1' */ - function makeUniqueName(baseName, checkFn, optimistic, scoped) { + function makeUniqueName(baseName, checkFn, optimistic, scoped, privateName, prefix, suffix) { if (checkFn === void 0) { checkFn = isUniqueName; } + if (baseName.length > 0 && baseName.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + baseName = baseName.slice(1); + } + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } if (optimistic) { - if (checkFn(baseName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(baseName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(baseName); + generatedNames.add(fullName); } - return baseName; + return fullName; } } // Find the first unique 'name_n', where n is a positive number @@ -116176,21 +117284,21 @@ var ts; } var i = 1; while (true) { - var generatedName = baseName + i; - if (checkFn(generatedName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName + i, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(generatedName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(generatedName); + generatedNames.add(fullName); } - return generatedName; + return fullName; } i++; } } function makeFileLevelOptimisticUniqueName(name) { - return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true); + return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a ModuleDeclaration or EnumDeclaration. @@ -116198,7 +117306,7 @@ var ts; function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); // Use module/enum name itself if it is unique, otherwise make a unique variation - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + return isUniqueLocalName(name, node) ? name : makeUniqueName(name, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for an ImportDeclaration or ExportDeclaration. @@ -116207,89 +117315,76 @@ var ts; var expr = ts.getExternalModuleName(node); // TODO: GH#18217 var baseName = ts.isStringLiteral(expr) ? ts.makeIdentifierFromModuleName(expr.text) : "module"; - return makeUniqueName(baseName); + return makeUniqueName(baseName, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a default export. */ function generateNameForExportDefault() { - return makeUniqueName("default"); + return makeUniqueName("default", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a class expression. */ function generateNameForClassExpression() { - return makeUniqueName("class"); + return makeUniqueName("class", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } - function generateNameForMethodOrAccessor(node) { + function generateNameForMethodOrAccessor(node, privateName, prefix, suffix) { if (ts.isIdentifier(node.name)) { - return generateNameCached(node.name); + return generateNameCached(node.name, privateName); } - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reservedInNestedScopes*/ false, privateName, prefix, suffix); } /** * Generates a unique name from a node. */ - function generateNameForNode(node, flags) { + function generateNameForNode(node, privateName, flags, prefix, suffix) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 80 /* SyntaxKind.PrivateIdentifier */: + return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), privateName, prefix, suffix); + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForModuleOrEnum(node); - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForImportOrExportDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForExportDefault(); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForClassExpression(); - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return generateNameForMethodOrAccessor(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true); + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return generateNameForMethodOrAccessor(node, privateName, prefix, suffix); + case 164 /* SyntaxKind.ComputedPropertyName */: + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true, privateName, prefix, suffix); default: - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ false, privateName, prefix, suffix); } } /** * Generates a unique identifier for a node. */ function makeName(name) { + var prefix = ts.formatGeneratedNamePart(name.autoGeneratePrefix, generateName); + var suffix = ts.formatGeneratedNamePart(name.autoGenerateSuffix); switch (name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) { case 1 /* GeneratedIdentifierFlags.Auto */: - return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); case 2 /* GeneratedIdentifierFlags.Loop */: - return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + ts.Debug.assertNode(name, ts.isIdentifier); + return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), /*privateName*/ false, prefix, suffix); case 3 /* GeneratedIdentifierFlags.Unique */: - return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); - } - return ts.Debug.fail("Unsupported GeneratedIdentifierKind."); - } - /** - * Gets the node from which a name should be generated. - */ - function getNodeForGeneratedName(name) { - var autoGenerateId = name.autoGenerateId; - var node = name; - var original = node.original; - while (original) { - node = original; - // if "node" is a different generated name (having a different - // "autoGenerateId"), use it and stop traversing. - if (ts.isIdentifier(node) - && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) - && node.autoGenerateId !== autoGenerateId) { - break; - } - original = node.original; + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); } - // otherwise, return the original node for the source; - return node; + return ts.Debug.fail("Unsupported GeneratedIdentifierKind: ".concat(ts.Debug.formatEnum(name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */, ts.GeneratedIdentifierFlags, /*isFlags*/ true), ".")); } // Comments function pipelineEmitWithComments(hint, node) { @@ -116335,7 +117430,7 @@ var ts; // Emit leading comments if the position is not synthesized and the node // has not opted out from emitting leading comments. if (!skipLeadingComments) { - emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 349 /* SyntaxKind.NotEmittedStatement */); + emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 352 /* SyntaxKind.NotEmittedStatement */); } if (!skipLeadingComments || (pos >= 0 && (emitFlags & 512 /* EmitFlags.NoLeadingComments */) !== 0)) { // Advance the container position if comments get emitted or if they've been disabled explicitly using NoLeadingComments. @@ -116346,7 +117441,7 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -116365,7 +117460,7 @@ var ts; declarationListContainerEnd = savedDeclarationListContainerEnd; // Emit trailing comments if the position is not synthesized and the node // has not opted out from emitting leading comments and is an emitted node. - if (!skipTrailingComments && node.kind !== 349 /* SyntaxKind.NotEmittedStatement */) { + if (!skipTrailingComments && node.kind !== 352 /* SyntaxKind.NotEmittedStatement */) { emitTrailingComments(end); } } @@ -116646,7 +117741,7 @@ var ts; } else { var source = sourceMapRange.source || sourceMapSource; - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 16 /* EmitFlags.NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos)); @@ -116664,7 +117759,7 @@ var ts; if (emitFlags & 64 /* EmitFlags.NoNestedSourceMaps */) { sourceMapsDisabled = false; } - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 32 /* EmitFlags.NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end); @@ -116829,7 +117924,16 @@ var ts; return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath)); } function getCachedFileSystemEntriesForBaseDir(path) { - return getCachedFileSystemEntries(ts.getDirectoryPath(path)); + var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path)); + if (!entries) { + return entries; + } + // If we're looking for the base directory, we're definitely going to search the entries + if (!entries.sortedAndCanonicalizedFiles) { + entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort(); + entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort(); + } + return entries; } function getBaseNameOfFileName(fileName) { return ts.getBaseFileName(ts.normalizePath(fileName)); @@ -116872,21 +117976,10 @@ var ts; return undefined; } } - function fileNameEqual(name1, name2) { - return getCanonicalFileName(name1) === getCanonicalFileName(name2); - } function hasEntry(entries, name) { - return ts.some(entries, function (file) { return fileNameEqual(file, name); }); - } - function updateFileSystemEntry(entries, baseName, isValid) { - if (hasEntry(entries, baseName)) { - if (!isValid) { - return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); }); - } - } - else if (isValid) { - return entries.push(baseName); - } + // Case-sensitive comparison since already canonicalized + var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive); + return index >= 0; } function writeFile(fileName, data, writeByteOrderMark) { var path = toPath(fileName); @@ -116899,7 +117992,7 @@ var ts; function fileExists(fileName) { var path = toPath(fileName); var result = getCachedFileSystemEntriesForBaseDir(path); - return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) || + return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) || host.fileExists(fileName); } function directoryExists(dirPath) { @@ -116909,9 +118002,14 @@ var ts; function createDirectory(dirPath) { var path = toPath(dirPath); var result = getCachedFileSystemEntriesForBaseDir(path); - var baseFileName = getBaseNameOfFileName(dirPath); if (result) { - updateFileSystemEntry(result.directories, baseFileName, /*isValid*/ true); + var baseName = getBaseNameOfFileName(dirPath); + var canonicalizedBaseName = getCanonicalFileName(baseName); + var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories; + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + result.directories.push(baseName); + } } host.createDirectory(dirPath); } @@ -116980,7 +118078,7 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) { // Folder added or removed, clear the cache instead of updating the folder and its structure clearCache(); } @@ -117000,7 +118098,23 @@ var ts; } } function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) { - updateFileSystemEntry(parentResult.files, baseName, fileExists); + var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles; + var canonicalizedBaseName = getCanonicalFileName(baseName); + if (fileExists) { + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + parentResult.files.push(baseName); + } + } + else { + // Case-sensitive comparison since already canonicalized + var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive); + if (sortedIndex >= 0) { + canonicalizedFiles.splice(sortedIndex, 1); + var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; }); + parentResult.files.splice(unsortedIndex, 1); + } + } } function clearCache() { cachedReadDirectoryResult.clear(); @@ -117480,14 +118594,16 @@ var ts; } return setReadFileCache(key, fileName); }; - var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersion, onError, shouldCreateNewSourceFile) { + var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) { var key = toPath(fileName); - var value = sourceFileCache.get(key); + var impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : undefined; + var forImpliedNodeFormat = sourceFileCache.get(impliedNodeFormat); + var value = forImpliedNodeFormat === null || forImpliedNodeFormat === void 0 ? void 0 : forImpliedNodeFormat.get(key); if (value) return value; - var sourceFile = getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile); + var sourceFile = getSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile); if (sourceFile && (ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Extension.Json */))) { - sourceFileCache.set(key, sourceFile); + sourceFileCache.set(impliedNodeFormat, (forImpliedNodeFormat || new ts.Map()).set(key, sourceFile)); } return sourceFile; } : undefined; @@ -117512,13 +118628,15 @@ var ts; var value = readFileCache.get(key); if (value !== undefined && value !== data) { readFileCache.delete(key); - sourceFileCache.delete(key); + sourceFileCache.forEach(function (map) { return map.delete(key); }); } else if (getSourceFileWithCache) { - var sourceFile = sourceFileCache.get(key); - if (sourceFile && sourceFile.text !== data) { - sourceFileCache.delete(key); - } + sourceFileCache.forEach(function (map) { + var sourceFile = map.get(key); + if (sourceFile && sourceFile.text !== data) { + map.delete(key); + } + }); } originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false)); }; @@ -117760,7 +118878,6 @@ var ts; return resolutions; } ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache; - ; /** * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file. @@ -117960,7 +119077,7 @@ var ts; * Determines if program structure is upto date or needs to be recreated */ /* @internal */ - function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { + function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { // If we haven't created a program yet or have changed automatic type directives, then it is not up-to-date if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames())) return false; @@ -117988,7 +119105,7 @@ var ts; return true; function sourceFileNotUptoDate(sourceFile) { return !sourceFileVersionUptoDate(sourceFile) || - hasInvalidatedResolution(sourceFile.path); + hasInvalidatedResolutions(sourceFile.path); } function sourceFileVersionUptoDate(sourceFile) { return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName); @@ -118234,7 +119351,7 @@ var ts; var moduleResolutionCache; var typeReferenceDirectiveResolutionCache; var actualResolveModuleNamesWorker; - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; if (host.resolveModuleNames) { actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) { // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. @@ -118681,7 +119798,7 @@ var ts; for (var i = 0; i < moduleNames.length; i++) { var moduleName = moduleNames[i]; // If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions - if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) { + if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) { var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i)); if (oldResolvedModule) { if (ts.isTraceEnabled(options, host)) { @@ -118917,7 +120034,7 @@ var ts; // tentatively approve the file modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); } - else if (hasInvalidatedResolution(oldSourceFile.path)) { + else if (hasInvalidatedResolutions(oldSourceFile.path)) { // 'module/types' references could have changed structureIsReused = 1 /* StructureIsReused.SafeModules */; // add file to the modified list so that we will resolve it later @@ -119305,22 +120422,22 @@ var ts; // Return directly from the case if the given node doesnt want to visit each child // Otherwise break to visit each child switch (parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); return "skip"; } // falls through - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 257 /* SyntaxKind.VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); @@ -119328,65 +120445,68 @@ var ts; } } switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type")); return "skip"; } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type")); return "skip"; } break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, ts.isImportSpecifier(node) ? "import...type" : "export...type")); return "skip"; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_TypeScript_files)); return "skip"; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: var heritageClause = node; if (heritageClause.token === 117 /* SyntaxKind.ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: var interfaceKeyword = ts.tokenToString(118 /* SyntaxKind.InterfaceKeyword */); ts.Debug.assertIsDefined(interfaceKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword)); return "skip"; - case 261 /* SyntaxKind.ModuleDeclaration */: - var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(142 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(141 /* SyntaxKind.ModuleKeyword */); + case 264 /* SyntaxKind.ModuleDeclaration */: + var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(143 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(142 /* SyntaxKind.ModuleKeyword */); ts.Debug.assertIsDefined(moduleKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); return "skip"; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); return "skip"; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumKeyword = ts.Debug.checkDefined(ts.tokenToString(92 /* SyntaxKind.EnumKeyword */)); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); return "skip"; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 213 /* SyntaxKind.TypeAssertionExpression */: ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. } } @@ -119395,53 +120515,55 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)); } switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); return "skip"; } // falls through - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - checkModifiers(parent.modifiers, parent.kind === 237 /* SyntaxKind.VariableStatement */); + checkModifiers(parent.modifiers, parent.kind === 240 /* SyntaxKind.VariableStatement */); return "skip"; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Check modifiers of property declaration if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; - if (ts.isModifier(modifier) && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */) { + if (ts.isModifier(modifier) + && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ + && modifier.kind !== 127 /* SyntaxKind.AccessorKeyword */) { diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); } } return "skip"; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Check modifiers of parameter declaration if (nodes === parent.modifiers && ts.some(nodes, ts.isModifier)) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); @@ -119463,18 +120585,19 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); break; // These are all legal modifiers. case 124 /* SyntaxKind.StaticKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: } } } @@ -120399,10 +121522,12 @@ var ts; if (options.preserveConstEnums === false) { createDiagnosticForOptionName(ts.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled, "preserveConstEnums", "isolatedModules"); } - var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* ScriptKind.JSON */; }); - if (firstNonExternalModuleSourceFile) { - var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(firstNonExternalModuleSourceFile.fileName))); + for (var _a = 0, files_5 = files; _a < files_5.length; _a++) { + var file = files_5[_a]; + if (!ts.isExternalModule(file) && !ts.isSourceFileJS(file) && !file.isDeclarationFile && file.scriptKind !== 6 /* ScriptKind.JSON */) { + var span = ts.getErrorSpanForNode(file, file); + programDiagnostics.add(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(file.fileName))); + } } } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ScriptTarget.ES2015 */ && options.module === ts.ModuleKind.None) { @@ -121653,10 +122778,16 @@ var ts; var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined; var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile && !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions); + // We can only reuse emit signatures (i.e. .d.ts signatures) if the .d.ts file is unchanged, + // which will eg be depedent on change in options like declarationDir and outDir options are unchanged. + // We need to look in oldState.compilerOptions, rather than oldCompilerOptions (i.e.we need to disregard useOldState) because + // oldCompilerOptions can be undefined if there was change in say module from None to some other option + // which would make useOldState as false since we can now use reference maps that are needed to track what to emit, what to check etc + // but that option change does not affect d.ts file name so emitSignatures should still be reused. var canCopyEmitSignatures = compilerOptions.composite && (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) && !outFilePath && - !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions); + !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions); if (useOldState) { // Copy old state's changed files set (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); }); @@ -122871,7 +124002,7 @@ var ts; var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* CharacterCodes.slash */; if (isNonDirectorySeparatorRoot && dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths - pathPartForUserCheck.search(/[a-zA-z]\$\//) === 0) { // Dos style nextPart + pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) { // Dos style nextPart nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, nextDirectorySeparator + 1); if (nextDirectorySeparator === -1) { // ignore "//vda1cs4850/c$/folderAtRoot" @@ -122955,7 +124086,7 @@ var ts; invalidateResolutionOfFile: invalidateResolutionOfFile, invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations, setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports, - createHasInvalidatedResolution: createHasInvalidatedResolution, + createHasInvalidatedResolutions: createHasInvalidatedResolutions, isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports, updateTypeRootsWatch: updateTypeRootsWatch, closeTypeRootsWatch: closeTypeRootsWatch, @@ -123010,17 +124141,13 @@ var ts; var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path); return !!value && !!value.length; } - function createHasInvalidatedResolution(forceAllFilesAsInvalidated) { + function createHasInvalidatedResolutions(customHasInvalidatedResolutions) { // Ensure pending resolutions are applied invalidateResolutionsOfFailedLookupLocations(); - if (forceAllFilesAsInvalidated) { - // Any file asked would have invalidated resolution - filesWithInvalidatedResolutions = undefined; - return ts.returnTrue; - } var collected = filesWithInvalidatedResolutions; filesWithInvalidatedResolutions = undefined; - return function (path) { return (!!collected && collected.has(path)) || + return function (path) { return customHasInvalidatedResolutions(path) || + !!(collected === null || collected === void 0 ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path); }; } function startCachingPerDirectoryResolution() { @@ -124381,15 +125508,21 @@ var ts; return undefined; } function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) { - var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); - if (normalizedTargetPath === undefined) { + var normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); + if (normalizedTargetPaths === undefined) { + return undefined; + } + var normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); + var relativePaths = ts.flatMap(normalizedSourcePaths, function (sourcePath) { + return ts.map(normalizedTargetPaths, function (targetPath) { return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)); }); + }); + var shortest = ts.min(relativePaths, ts.compareNumberOfDirectorySeparators); + if (!shortest) { return undefined; } - var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); - var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath; return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs - ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions) - : ts.removeFileExtension(relativePath); + ? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions) + : ts.removeFileExtension(shortest); } function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) { var path = _a.path, isRedirect = _a.isRedirect; @@ -124526,8 +125659,8 @@ var ts; } } } - function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) { - return ts.firstDefined(rootDirs, function (rootDir) { + function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) { + return ts.mapDefined(rootDirs, function (rootDir) { var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName); return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath; }); @@ -125238,18 +126371,14 @@ var ts; if (host.getBuildInfo) { // host provides buildinfo, get it from there. This allows host to cache it buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath); - if (!buildInfo) - return undefined; } else { var content = host.readFile(buildInfoPath); if (!content) return undefined; - buildInfo = ts.getBuildInfo(content); + buildInfo = ts.getBuildInfo(buildInfoPath, content); } - if (buildInfo.version !== ts.version) - return undefined; - if (!buildInfo.program) + if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program) return undefined; return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host); } @@ -125404,6 +126533,10 @@ var ts; ts.maybeBind(host, host.getModuleResolutionCache) : (function () { return resolutionCache.getModuleResolutionCache(); }); var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; + // All resolutions are invalid if user provided resolutions and didnt supply hasInvalidatedResolutions + var customHasInvalidatedResolutions = userProvidedResolution ? + ts.maybeBind(host, host.hasInvalidatedResolutions) || ts.returnTrue : + ts.returnFalse; builderProgram = readBuilderProgram(compilerOptions, compilerHost); synchronizeProgram(); // Update the wild card directory watch @@ -125469,9 +126602,9 @@ var ts; resolutionCache.clear(); } } - // All resolutions are invalid if user provided resolutions - var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + var hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions); + var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile; + if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { if (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -125484,15 +126617,20 @@ var ts; if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); } - createNewProgram(hasInvalidatedResolution); + createNewProgram(hasInvalidatedResolutions); } reportFileChangeDetectedOnCreateProgram = false; if (host.afterProgramCreate && program !== builderProgram) { host.afterProgramCreate(builderProgram); } + compilerHost.readFile = originalReadFile; + compilerHost.fileExists = originalFileExists; + compilerHost.directoryExists = originalDirectoryExists; + compilerHost.createDirectory = originalCreateDirectory; + compilerHost.writeFile = originalWriteFile; return builderProgram; } - function createNewProgram(hasInvalidatedResolution) { + function createNewProgram(hasInvalidatedResolutions) { // Compile the program writeLog("CreatingProgramWith::"); writeLog(" roots: ".concat(JSON.stringify(rootFileNames))); @@ -125503,7 +126641,7 @@ var ts; hasChangedCompilerOptions = false; hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); - compilerHost.hasInvalidatedResolution = hasInvalidatedResolution; + compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; var oldProgram = getCurrentProgram(); builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences); @@ -125967,19 +127105,20 @@ var ts; */ UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend"; UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream"; - UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo"; - UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate"; - UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked"; - UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream"; - UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate"; - UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText"; + UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream"; + UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo"; + UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate"; + UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked"; + UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream"; + UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate"; + UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText"; /** * Projects with no outputs (i.e. "solution" files) */ - UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly"; - UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild"; + UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly"; + UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild"; })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {})); function resolveConfigFileProjectName(project) { if (ts.fileExtensionIs(project, ".json" /* Extension.Json */)) { @@ -126197,6 +127336,7 @@ var ts; if (value) { return isParsedCommandLine(value) ? value : undefined; } + ts.performance.mark("SolutionBuilder::beforeConfigFileParsing"); var diagnostic; var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host; var parsed; @@ -126211,6 +127351,8 @@ var ts; parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop; } configFileCache.set(configFilePath, parsed || diagnostic); + ts.performance.mark("SolutionBuilder::afterConfigFileParsing"); + ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing"); return parsed; } function resolveProjectName(state, name) { @@ -126410,6 +127552,7 @@ var ts; if (updateOutputFileStampsPending) { updateOutputTimestamps(state, config, projectPath); } + ts.performance.mark("SolutionBuilder::Timestamps only updates"); return doneInvalidatedProject(state, projectPath); } }; @@ -126503,6 +127646,10 @@ var ts; }; function done(cancellationToken, writeFile, customTransformers) { executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers); + if (kind === InvalidatedProjectKind.Build) + ts.performance.mark("SolutionBuilder::Projects built"); + else + ts.performance.mark("SolutionBuilder::Bundles updated"); return doneInvalidatedProject(state, projectPath); } function withProgramOrUndefined(action) { @@ -126681,13 +127828,13 @@ var ts; var emitterDiagnostics = ts.createDiagnosticCollection(); var emittedOutputs = new ts.Map(); var resultFlags = BuildResultFlags.DeclarationOutputUnchanged; - var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo; + var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined; outputFiles.forEach(function (_a) { var _b, _c; var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo; emittedOutputs.set(toPath(state, name), name); if (buildInfo) { - if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { + if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; } setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags); @@ -126980,8 +128127,7 @@ var ts; return existing.buildInfo || undefined; } var value = state.readFileWithCache(buildInfoPath); - var buildInfo = value ? ts.getBuildInfo(value) : undefined; - ts.Debug.assert(modifiedTime || !buildInfo); + var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined; state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime }); return buildInfo; } @@ -127066,7 +128212,14 @@ var ts; missingOutputFileName: buildInfoPath }; } - var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime)); + var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime); + if (!buildInfo) { + // Error reading buildInfo + return { + type: ts.UpToDateStatusType.ErrorReadingFile, + fileName: buildInfoPath + }; + } if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) { return { type: ts.UpToDateStatusType.TsVersionOutputOfDate, @@ -127075,8 +128228,15 @@ var ts; } if (buildInfo.program) { // If there are pending changes that are not emitted, project is out of date + // When there are syntax errors, changeFileSet will have list of files changed (irrespective of noEmit) + // But in case of semantic error we need special treatment. + // Checking presence of affectedFilesPendingEmit list is fast and good way to tell if there were semantic errors and file emit was blocked + // But if noEmit is true, affectedFilesPendingEmit will have file list even if there are no semantic errors to preserve list of files to be emitted when running with noEmit false + // So with noEmit set to true, check on semantic diagnostics needs to be explicit as oppose to when it is false when only files pending emit is sufficient if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) || - (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) { + (!project.options.noEmit ? + (_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length : + ts.some(buildInfo.program.semanticDiagnosticsPerFile, ts.isArray))) { return { type: ts.UpToDateStatusType.OutOfDateBuildInfo, buildInfoFile: buildInfoPath @@ -127251,7 +128411,10 @@ var ts; if (prior !== undefined) { return prior; } + ts.performance.mark("SolutionBuilder::beforeUpToDateCheck"); var actual = getUpToDateStatusWorker(state, project, resolvedPath); + ts.performance.mark("SolutionBuilder::afterUpToDateCheck"); + ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck"); state.projectStatus.set(resolvedPath, actual); return actual; } @@ -127389,6 +128552,13 @@ var ts; } } function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + return result; + } + function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127416,6 +128586,13 @@ var ts; : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } function clean(state, project, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeClean"); + var result = cleanWorker(state, project, onlyReferences); + ts.performance.mark("SolutionBuilder::afterClean"); + ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean"); + return result; + } + function cleanWorker(state, project, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127489,6 +128666,14 @@ var ts; state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected); } function buildNextInvalidatedProject(state, changeDetected) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + if (buildOrder) + reportErrorSummary(state, buildOrder); + } + function buildNextInvalidatedProjectWorker(state, changeDetected) { state.timerToBuildInvalidatedProject = undefined; if (state.reportFileChangeDetected) { state.reportFileChangeDetected = false; @@ -127521,7 +128706,7 @@ var ts; } } disableCache(state); - reportErrorSummary(state, buildOrder); + return buildOrder; } function watchConfigFile(state, resolved, resolvedPath, parsed) { if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath)) @@ -127576,6 +128761,7 @@ var ts; function startWatching(state, buildOrder) { if (!state.watchAllProjectsPending) return; + ts.performance.mark("SolutionBuilder::beforeWatcherCreation"); state.watchAllProjectsPending = false; for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) { var resolved = _a[_i]; @@ -127593,6 +128779,8 @@ var ts; watchPackageJsonFiles(state, resolved, resolvedPath, cfg); } } + ts.performance.mark("SolutionBuilder::afterWatcherCreation"); + ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation"); } function stopWatching(state) { ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher); @@ -127706,6 +128894,8 @@ var ts; return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName)); case ts.UpToDateStatusType.OutputMissing: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName)); + case ts.UpToDateStatusType.ErrorReadingFile: + return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName)); case ts.UpToDateStatusType.OutOfDateBuildInfo: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile)); case ts.UpToDateStatusType.UpToDate: @@ -128227,6 +129417,12 @@ var ts; SemanticClassificationFormat["Original"] = "original"; SemanticClassificationFormat["TwentyTwenty"] = "2020"; })(SemanticClassificationFormat = ts.SemanticClassificationFormat || (ts.SemanticClassificationFormat = {})); + var OrganizeImportsMode; + (function (OrganizeImportsMode) { + OrganizeImportsMode["All"] = "All"; + OrganizeImportsMode["SortAndCombine"] = "SortAndCombine"; + OrganizeImportsMode["RemoveUnused"] = "RemoveUnused"; + })(OrganizeImportsMode = ts.OrganizeImportsMode || (ts.OrganizeImportsMode = {})); var CompletionTriggerKind; (function (CompletionTriggerKind) { /** Completion was triggered by typing an identifier, manual invocation (e.g Ctrl+Space) or via API. */ @@ -128413,6 +129609,8 @@ var ts; * interface Y { foo:number; } */ ScriptElementKind["memberVariableElement"] = "property"; + /** class X { [public|private]* accessor foo: number; } */ + ScriptElementKind["memberAccessorVariableElement"] = "accessor"; /** * class X { constructor() { } } * class X { static { } } @@ -128545,37 +129743,37 @@ var ts; })(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {})); function getMeaningFromDeclaration(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.isInJSFile(node) && ts.getJSDocEnumTag(node) ? 7 /* SemanticMeaning.All */ : 1 /* SemanticMeaning.Value */; - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 292 /* SyntaxKind.CatchClause */: - case 285 /* SyntaxKind.JsxAttribute */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 295 /* SyntaxKind.CatchClause */: + case 288 /* SyntaxKind.JsxAttribute */: return 1 /* SemanticMeaning.Value */; - case 163 /* SyntaxKind.TypeParameter */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 165 /* SyntaxKind.TypeParameter */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: return 2 /* SemanticMeaning.Type */; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: // If it has no name node, it shares the name with the value declaration below it. return node.name === undefined ? 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */ : 2 /* SemanticMeaning.Type */; - case 299 /* SyntaxKind.EnumMember */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: return 1 /* SemanticMeaning.Value */ | 2 /* SemanticMeaning.Type */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isAmbientModule(node)) { return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } @@ -128585,16 +129783,16 @@ var ts; else { return 4 /* SemanticMeaning.Namespace */; } - case 260 /* SyntaxKind.EnumDeclaration */: - case 269 /* SyntaxKind.NamedImports */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 272 /* SyntaxKind.NamedImports */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return 7 /* SemanticMeaning.All */; // An external module can be a Value - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 4 /* SemanticMeaning.Namespace */ | 1 /* SemanticMeaning.Value */; } return 7 /* SemanticMeaning.All */; @@ -128603,7 +129801,7 @@ var ts; function getMeaningFromLocation(node) { node = getAdjustedReferenceLocation(node); var parent = node.parent; - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return 1 /* SemanticMeaning.Value */; } else if (ts.isExportAssignment(parent) @@ -128646,11 +129844,11 @@ var ts; // import a = |b|; // Namespace // import a = |b.c|; // Value, type, namespace // import a = |b.c|.d; // Namespace - var name = node.kind === 161 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; - return name && name.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; + var name = node.kind === 163 /* SyntaxKind.QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined; + return name && name.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? 7 /* SemanticMeaning.All */ : 4 /* SemanticMeaning.Namespace */; } function isInRightSideOfInternalImportEqualsDeclaration(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node; @@ -128662,27 +129860,27 @@ var ts; function isQualifiedNameNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { - while (root.parent && root.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { + while (root.parent && root.parent.kind === 163 /* SyntaxKind.QualifiedName */) { root = root.parent; } isLastClause = root.right === node; } - return root.parent.kind === 178 /* SyntaxKind.TypeReference */ && !isLastClause; + return root.parent.kind === 180 /* SyntaxKind.TypeReference */ && !isLastClause; } function isPropertyAccessNamespaceReference(node) { var root = node; var isLastClause = true; - if (root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - while (root.parent && root.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + while (root.parent && root.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { root = root.parent; } isLastClause = root.name === node; } - if (!isLastClause && root.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */) { + if (!isLastClause && root.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && root.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */) { var decl = root.parent.parent.parent; - return (decl.kind === 257 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || - (decl.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); + return (decl.kind === 260 /* SyntaxKind.ClassDeclaration */ && root.parent.parent.token === 117 /* SyntaxKind.ImplementsKeyword */) || + (decl.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && root.parent.parent.token === 94 /* SyntaxKind.ExtendsKeyword */); } return false; } @@ -128693,15 +129891,15 @@ var ts; switch (node.kind) { case 108 /* SyntaxKind.ThisKeyword */: return !ts.isExpressionNode(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return true; } switch (node.parent.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return true; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return !node.parent.isTypeOf; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isPartOfTypeNode(node.parent); } return false; @@ -128768,7 +129966,7 @@ var ts; ts.climbPastPropertyOrElementAccess = climbPastPropertyOrElementAccess; function getTargetLabel(referenceNode, labelName) { while (referenceNode) { - if (referenceNode.kind === 250 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { + if (referenceNode.kind === 253 /* SyntaxKind.LabeledStatement */ && referenceNode.label.escapedText === labelName) { return referenceNode.label; } referenceNode = referenceNode.parent; @@ -128829,22 +130027,22 @@ var ts; ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration; function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) { switch (node.parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.getNameOfDeclaration(node.parent) === node; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.parent.argumentExpression === node; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return true; - case 196 /* SyntaxKind.LiteralType */: - return node.parent.parent.kind === 194 /* SyntaxKind.IndexedAccessType */; + case 198 /* SyntaxKind.LiteralType */: + return node.parent.parent.kind === 196 /* SyntaxKind.IndexedAccessType */; default: return false; } @@ -128868,17 +130066,17 @@ var ts; return undefined; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node; } } @@ -128886,56 +130084,56 @@ var ts; ts.getContainerNode = getContainerNode; function getNodeKind(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node) ? "module" /* ScriptElementKind.moduleElement */ : "script" /* ScriptElementKind.scriptElement */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return "module" /* ScriptElementKind.moduleElement */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return "class" /* ScriptElementKind.classElement */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return "interface" /* ScriptElementKind.interfaceElement */; + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return "type" /* ScriptElementKind.typeElement */; - case 260 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; - case 254 /* SyntaxKind.VariableDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return "enum" /* ScriptElementKind.enumElement */; + case 257 /* SyntaxKind.VariableDeclaration */: return getKindOfVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getKindOfVariableDeclaration(ts.getRootDeclaration(node)); - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return "function" /* ScriptElementKind.functionElement */; - case 172 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; - case 173 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: return "getter" /* ScriptElementKind.memberGetAccessorElement */; + case 175 /* SyntaxKind.SetAccessor */: return "setter" /* ScriptElementKind.memberSetAccessorElement */; + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return "method" /* ScriptElementKind.memberFunctionElement */; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: var initializer = node.initializer; return ts.isFunctionLike(initializer) ? "method" /* ScriptElementKind.memberFunctionElement */ : "property" /* ScriptElementKind.memberVariableElement */; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return "property" /* ScriptElementKind.memberVariableElement */; - case 176 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; - case 175 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; - case 174 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: return "index" /* ScriptElementKind.indexSignatureElement */; + case 177 /* SyntaxKind.ConstructSignature */: return "construct" /* ScriptElementKind.constructSignatureElement */; + case 176 /* SyntaxKind.CallSignature */: return "call" /* ScriptElementKind.callSignatureElement */; + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return "constructor" /* ScriptElementKind.constructorImplementationElement */; - case 163 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; - case 299 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; - case 164 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: + case 165 /* SyntaxKind.TypeParameter */: return "type parameter" /* ScriptElementKind.typeParameterElement */; + case 302 /* SyntaxKind.EnumMember */: return "enum member" /* ScriptElementKind.enumMemberElement */; + case 166 /* SyntaxKind.Parameter */: return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) ? "property" /* ScriptElementKind.memberVariableElement */ : "parameter" /* ScriptElementKind.parameterElement */; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: return "alias" /* ScriptElementKind.alias */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var kind = ts.getAssignmentDeclarationKind(node); var right = node.right; switch (kind) { @@ -128964,7 +130162,7 @@ var ts; } case 79 /* SyntaxKind.Identifier */: return ts.isImportClause(node.parent) ? "alias" /* ScriptElementKind.alias */ : "" /* ScriptElementKind.unknown */; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: var scriptKind = getNodeKind(node.expression); // If the expression didn't come back with something (like it does for an identifiers) return scriptKind === "" /* ScriptElementKind.unknown */ ? "const" /* ScriptElementKind.constElement */ : scriptKind; @@ -128987,7 +130185,7 @@ var ts; return true; case 79 /* SyntaxKind.Identifier */: // 'this' as a parameter - return ts.identifierIsThisKeyword(node) && node.parent.kind === 164 /* SyntaxKind.Parameter */; + return ts.identifierIsThisKeyword(node) && node.parent.kind === 166 /* SyntaxKind.Parameter */; default: return false; } @@ -129052,42 +130250,42 @@ var ts; return false; } switch (n.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 182 /* SyntaxKind.TypeLiteral */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 263 /* SyntaxKind.CaseBlock */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 184 /* SyntaxKind.TypeLiteral */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 266 /* SyntaxKind.CaseBlock */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return nodeEndsWith(n, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return isCompletedNode(n.block, sourceFile); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: if (!n.arguments) { return true; } // falls through - case 208 /* SyntaxKind.CallExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 191 /* SyntaxKind.ParenthesizedType */: + case 210 /* SyntaxKind.CallExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: return nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return isCompletedNode(n.type, sourceFile); - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 216 /* SyntaxKind.ArrowFunction */: if (n.body) { return isCompletedNode(n.body, sourceFile); } @@ -129097,65 +130295,65 @@ var ts; // Even though type parameters can be unclosed, we can get away with // having at least a closing paren. return hasChildOfKind(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return !!n.body && isCompletedNode(n.body, sourceFile); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (n.elseStatement) { return isCompletedNode(n.elseStatement, sourceFile); } return isCompletedNode(n.thenStatement, sourceFile); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return isCompletedNode(n.expression, sourceFile) || hasChildOfKind(n, 26 /* SyntaxKind.SemicolonToken */, sourceFile); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 184 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 186 /* SyntaxKind.TupleType */: return nodeEndsWith(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: if (n.type) { return isCompletedNode(n.type, sourceFile); } return hasChildOfKind(n, 23 /* SyntaxKind.CloseBracketToken */, sourceFile); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed return false; - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: return isCompletedNode(n.statement, sourceFile); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')'; return hasChildOfKind(n, 115 /* SyntaxKind.WhileKeyword */, sourceFile) ? nodeEndsWith(n, 21 /* SyntaxKind.CloseParenToken */, sourceFile) : isCompletedNode(n.statement, sourceFile); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return isCompletedNode(n.exprName, sourceFile); - case 216 /* SyntaxKind.TypeOfExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 225 /* SyntaxKind.SpreadElement */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 227 /* SyntaxKind.SpreadElement */: var unaryWordExpression = n; return isCompletedNode(unaryWordExpression.expression, sourceFile); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return isCompletedNode(n.template, sourceFile); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: var lastSpan = ts.lastOrUndefined(n.templateSpans); return isCompletedNode(lastSpan, sourceFile); - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return ts.nodeIsPresent(n.literal); - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.nodeIsPresent(n.moduleSpecifier); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return isCompletedNode(n.operand, sourceFile); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isCompletedNode(n.right, sourceFile); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isCompletedNode(n.whenFalse, sourceFile); default: return true; @@ -129270,6 +130468,8 @@ var ts; return lastTypeNode; } function getContextualTypeFromParentOrAncestorTypeNode(node, checker) { + if (node.flags & (8388608 /* NodeFlags.JSDoc */ & ~262144 /* NodeFlags.JavaScriptFile */)) + return undefined; var contextualType = getContextualTypeFromParent(node, checker); if (contextualType) return contextualType; @@ -129280,13 +130480,13 @@ var ts; function getAdjustedLocationForDeclaration(node, forRename) { if (!forRename) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return getAdjustedLocationForClass(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return getAdjustedLocationForFunction(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return node; } } @@ -129381,11 +130581,11 @@ var ts; node.kind === 98 /* SyntaxKind.FunctionKeyword */ ? ts.isFunctionDeclaration(parent) || ts.isFunctionExpression(node) : node.kind === 118 /* SyntaxKind.InterfaceKeyword */ ? ts.isInterfaceDeclaration(parent) : node.kind === 92 /* SyntaxKind.EnumKeyword */ ? ts.isEnumDeclaration(parent) : - node.kind === 152 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : - node.kind === 142 /* SyntaxKind.NamespaceKeyword */ || node.kind === 141 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : + node.kind === 154 /* SyntaxKind.TypeKeyword */ ? ts.isTypeAliasDeclaration(parent) : + node.kind === 143 /* SyntaxKind.NamespaceKeyword */ || node.kind === 142 /* SyntaxKind.ModuleKeyword */ ? ts.isModuleDeclaration(parent) : node.kind === 100 /* SyntaxKind.ImportKeyword */ ? ts.isImportEqualsDeclaration(parent) : - node.kind === 136 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : - node.kind === 149 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { + node.kind === 137 /* SyntaxKind.GetKeyword */ ? ts.isGetAccessorDeclaration(parent) : + node.kind === 151 /* SyntaxKind.SetKeyword */ && ts.isSetAccessorDeclaration(parent)) { var location = getAdjustedLocationForDeclaration(parent, forRename); if (location) { return location; @@ -129399,7 +130599,7 @@ var ts; return decl.name; } } - if (node.kind === 152 /* SyntaxKind.TypeKeyword */) { + if (node.kind === 154 /* SyntaxKind.TypeKeyword */) { // import /**/type [|name|] from ...; // import /**/type { [|name|] } from ...; // import /**/type { propertyName as [|name|] } from ...; @@ -129425,7 +130625,7 @@ var ts; // import * /**/as [|name|] ... // export { propertyName /**/as [|name|] } ... // export * /**/as [|name|] ... - if (node.kind === 127 /* SyntaxKind.AsKeyword */) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */) { if (ts.isImportSpecifier(parent) && parent.propertyName || ts.isExportSpecifier(parent) && parent.propertyName || ts.isNamespaceImport(parent) || @@ -129466,12 +130666,12 @@ var ts; } } // import name = /**/require("[|module|]"); - if (node.kind === 146 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { + if (node.kind === 147 /* SyntaxKind.RequireKeyword */ && ts.isExternalModuleReference(parent)) { return parent.expression; } // import ... /**/from "[|module|]"; // export ... /**/from "[|module|]"; - if (node.kind === 156 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { + if (node.kind === 158 /* SyntaxKind.FromKeyword */ && (ts.isImportDeclaration(parent) || ts.isExportDeclaration(parent)) && parent.moduleSpecifier) { return parent.moduleSpecifier; } // class ... /**/extends [|name|] ... @@ -129496,7 +130696,7 @@ var ts; } } // ... T extends /**/infer [|U|] ? ... - if (node.kind === 137 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { + if (node.kind === 138 /* SyntaxKind.InferKeyword */ && ts.isInferTypeNode(parent)) { return parent.typeParameter.name; } // { [ [|K|] /**/in keyof T]: ... } @@ -129504,12 +130704,12 @@ var ts; return parent.name; } // /**/keyof [|T|] - if (node.kind === 140 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 140 /* SyntaxKind.KeyOfKeyword */ && + if (node.kind === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 141 /* SyntaxKind.KeyOfKeyword */ && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // /**/readonly [|name|][] - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */ && + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(parent) && parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isArrayTypeNode(parent.type) && ts.isTypeReferenceNode(parent.type.elementType)) { return parent.type.elementType.typeName; } @@ -129527,7 +130727,7 @@ var ts; if (node.kind === 103 /* SyntaxKind.NewKeyword */ && ts.isNewExpression(parent) || node.kind === 114 /* SyntaxKind.VoidKeyword */ && ts.isVoidExpression(parent) || node.kind === 112 /* SyntaxKind.TypeOfKeyword */ && ts.isTypeOfExpression(parent) || - node.kind === 132 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || + node.kind === 133 /* SyntaxKind.AwaitKeyword */ && ts.isAwaitExpression(parent) || node.kind === 125 /* SyntaxKind.YieldKeyword */ && ts.isYieldExpression(parent) || node.kind === 89 /* SyntaxKind.DeleteKeyword */ && ts.isDeleteExpression(parent)) { if (parent.expression) { @@ -129540,13 +130740,13 @@ var ts; return ts.skipOuterExpressions(parent.right); } // left /**/as [|name|] - if (node.kind === 127 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { + if (node.kind === 128 /* SyntaxKind.AsKeyword */ && ts.isAsExpression(parent) && ts.isTypeReferenceNode(parent.type)) { return parent.type.typeName; } // for (... /**/in [|name|]) // for (... /**/of [|name|]) if (node.kind === 101 /* SyntaxKind.InKeyword */ && ts.isForInStatement(parent) || - node.kind === 160 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { + node.kind === 162 /* SyntaxKind.OfKeyword */ && ts.isForOfStatement(parent)) { return ts.skipOuterExpressions(parent.expression); } } @@ -129778,7 +130978,7 @@ var ts; } } } - ts.Debug.assert(startNode !== undefined || n.kind === 305 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); + ts.Debug.assert(startNode !== undefined || n.kind === 308 /* SyntaxKind.SourceFile */ || n.kind === 1 /* SyntaxKind.EndOfFileToken */ || ts.isJSDocCommentContainingNode(n)); // Here we know that none of child token nodes embrace the position, // the only known case is when position is at the end of the file. // Try to find the rightmost token in the file without filtering. @@ -129809,7 +131009,7 @@ var ts; for (var i = exclusiveStartPosition - 1; i >= 0; i--) { var child = children[i]; if (isWhiteSpaceOnlyJsxText(child)) { - if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (i === 0 && (parentKind === 11 /* SyntaxKind.JsxText */ || parentKind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { ts.Debug.fail("`JsxText` tokens should not be the first child of `JsxElement | JsxSelfClosingElement`"); } } @@ -129853,17 +131053,17 @@ var ts; return true; } //
{ |
or
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
{ // | // } < /div> - if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 288 /* SyntaxKind.JsxExpression */) { + if (token && token.kind === 19 /* SyntaxKind.CloseBraceToken */ && token.parent.kind === 291 /* SyntaxKind.JsxExpression */) { return true; } //
|
- if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (token.kind === 29 /* SyntaxKind.LessThanToken */ && token.parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return true; } return false; @@ -129894,7 +131094,7 @@ var ts; function isInsideJsxElement(sourceFile, position) { function isInsideJsxElementTraversal(node) { while (node) { - if (node.kind >= 279 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 288 /* SyntaxKind.JsxExpression */ + if (node.kind >= 282 /* SyntaxKind.JsxSelfClosingElement */ && node.kind <= 291 /* SyntaxKind.JsxExpression */ || node.kind === 11 /* SyntaxKind.JsxText */ || node.kind === 29 /* SyntaxKind.LessThanToken */ || node.kind === 31 /* SyntaxKind.GreaterThanToken */ @@ -129904,7 +131104,7 @@ var ts; || node.kind === 43 /* SyntaxKind.SlashToken */) { node = node.parent; } - else if (node.kind === 278 /* SyntaxKind.JsxElement */) { + else if (node.kind === 281 /* SyntaxKind.JsxElement */) { if (position > node.getStart(sourceFile)) return true; node = node.parent; @@ -130052,7 +131252,7 @@ var ts; // falls through case 112 /* SyntaxKind.TypeOfKeyword */: case 94 /* SyntaxKind.ExtendsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: case 24 /* SyntaxKind.DotToken */: case 51 /* SyntaxKind.BarToken */: case 57 /* SyntaxKind.QuestionToken */: @@ -130073,7 +131273,7 @@ var ts; /** * Returns true if the cursor at position in sourceFile is within a comment. * - * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position) + * @param tokenAtPosition Must equal `getTokenAtPosition(sourceFile, position)` * @param predicate Additional predicate to test on the comment range. */ function isInComment(sourceFile, position, tokenAtPosition) { @@ -130104,7 +131304,7 @@ var ts; result.push("public" /* ScriptElementKindModifier.publicMemberModifier */); if (flags & 32 /* ModifierFlags.Static */ || ts.isClassStaticBlockDeclaration(node)) result.push("static" /* ScriptElementKindModifier.staticModifier */); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push("abstract" /* ScriptElementKindModifier.abstractModifier */); if (flags & 1 /* ModifierFlags.Export */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); @@ -130112,16 +131312,16 @@ var ts; result.push("deprecated" /* ScriptElementKindModifier.deprecatedModifier */); if (node.flags & 16777216 /* NodeFlags.Ambient */) result.push("declare" /* ScriptElementKindModifier.ambientModifier */); - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) result.push("export" /* ScriptElementKindModifier.exportedModifier */); return result.length > 0 ? result.join(",") : "" /* ScriptElementKindModifier.none */; } ts.getNodeModifiers = getNodeModifiers; function getTypeArgumentOrTypeParameterList(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 210 /* SyntaxKind.CallExpression */) { return node.typeArguments; } - if (ts.isFunctionLike(node) || node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isFunctionLike(node) || node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return node.typeParameters; } return undefined; @@ -130166,18 +131366,18 @@ var ts; } ts.cloneCompilerOptions = cloneCompilerOptions; function isArrayLiteralOrObjectLiteralDestructuringPattern(node) { - if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || - node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || + node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // [a,b,c] from: // [a, b, c] = someExpression; - if (node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + if (node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return true; } // [a, b, c] from: // for([a, b, c] of expression) - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && node.parent.initializer === node) { return true; } @@ -130185,7 +131385,7 @@ var ts; // [x, [a, b, c] ] = someExpression // or // {x, a: {a, b, c} } = someExpression - if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { + if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.parent.parent : node.parent)) { return true; } } @@ -130247,32 +131447,32 @@ var ts; } ts.createTextChange = createTextChange; ts.typeKeywords = [ - 130 /* SyntaxKind.AnyKeyword */, - 128 /* SyntaxKind.AssertsKeyword */, - 158 /* SyntaxKind.BigIntKeyword */, - 133 /* SyntaxKind.BooleanKeyword */, + 131 /* SyntaxKind.AnyKeyword */, + 129 /* SyntaxKind.AssertsKeyword */, + 160 /* SyntaxKind.BigIntKeyword */, + 134 /* SyntaxKind.BooleanKeyword */, 95 /* SyntaxKind.FalseKeyword */, - 137 /* SyntaxKind.InferKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 143 /* SyntaxKind.NeverKeyword */, + 138 /* SyntaxKind.InferKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 144 /* SyntaxKind.NeverKeyword */, 104 /* SyntaxKind.NullKeyword */, - 147 /* SyntaxKind.NumberKeyword */, - 148 /* SyntaxKind.ObjectKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 150 /* SyntaxKind.StringKeyword */, - 151 /* SyntaxKind.SymbolKeyword */, + 148 /* SyntaxKind.NumberKeyword */, + 149 /* SyntaxKind.ObjectKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 152 /* SyntaxKind.StringKeyword */, + 153 /* SyntaxKind.SymbolKeyword */, 110 /* SyntaxKind.TrueKeyword */, 114 /* SyntaxKind.VoidKeyword */, - 153 /* SyntaxKind.UndefinedKeyword */, - 154 /* SyntaxKind.UniqueKeyword */, - 155 /* SyntaxKind.UnknownKeyword */, + 155 /* SyntaxKind.UndefinedKeyword */, + 156 /* SyntaxKind.UniqueKeyword */, + 157 /* SyntaxKind.UnknownKeyword */, ]; function isTypeKeyword(kind) { return ts.contains(ts.typeKeywords, kind); } ts.isTypeKeyword = isTypeKeyword; function isTypeKeywordToken(node) { - return node.kind === 152 /* SyntaxKind.TypeKeyword */; + return node.kind === 154 /* SyntaxKind.TypeKeyword */; } ts.isTypeKeywordToken = isTypeKeywordToken; function isTypeKeywordTokenOrIdentifier(node) { @@ -130309,7 +131509,7 @@ var ts; } ts.skipConstraint = skipConstraint; function getNameFromPropertyName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ // treat computed property names where expression is string/numeric literal as just string/numeric literal ? ts.isStringOrNumericLiteralLike(name.expression) ? name.expression.text : undefined : ts.isPrivateIdentifier(name) ? ts.idText(name) : ts.getTextOfIdentifierOrLiteral(name); @@ -130459,7 +131659,7 @@ var ts; ts.findModifier = findModifier; function insertImports(changes, sourceFile, imports, blankLineBetween) { var decl = ts.isArray(imports) ? imports[0] : imports; - var importKindPredicate = decl.kind === 237 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; + var importKindPredicate = decl.kind === 240 /* SyntaxKind.VariableStatement */ ? ts.isRequireVariableStatement : ts.isAnyImportSyntax; var existingImportStatements = ts.filter(sourceFile.statements, importKindPredicate); var sortedNewImports = ts.isArray(imports) ? ts.stableSort(imports, ts.OrganizeImports.compareImportsOrRequireStatements) : [imports]; if (!existingImportStatements.length) { @@ -131133,15 +132333,15 @@ var ts; function getContextualTypeFromParent(node, checker) { var parent = node.parent; switch (parent.kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checker.getContextualType(parent); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var _a = parent, left = _a.left, operatorToken = _a.operatorToken, right = _a.right; return isEqualityOperatorKind(operatorToken.kind) ? checker.getTypeAtLocation(node === right ? left : right) : checker.getContextualType(node); } - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return parent.expression === node ? getSwitchedType(parent, checker) : undefined; default: return checker.getContextualType(node); @@ -131171,8 +132371,8 @@ var ts; switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return true; default: return false; @@ -131206,38 +132406,38 @@ var ts; } ts.getTypeNodeIfAccessible = getTypeNodeIfAccessible; function syntaxRequiresTrailingCommaOrSemicolonOrASI(kind) { - return kind === 174 /* SyntaxKind.CallSignature */ - || kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */; + return kind === 176 /* SyntaxKind.CallSignature */ + || kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */; } function syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind) { - return kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 264 /* SyntaxKind.ModuleDeclaration */; } function syntaxRequiresTrailingSemicolonOrASI(kind) { - return kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.syntaxRequiresTrailingSemicolonOrASI = syntaxRequiresTrailingSemicolonOrASI; ts.syntaxMayBeASICandidate = ts.or(syntaxRequiresTrailingCommaOrSemicolonOrASI, syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI, syntaxRequiresTrailingModuleBlockOrSemicolonOrASI, syntaxRequiresTrailingSemicolonOrASI); @@ -131267,7 +132467,7 @@ var ts; return false; } // See comment in parser’s `parseDoStatement` - if (node.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.kind === 243 /* SyntaxKind.DoStatement */) { return true; } var topNode = ts.findAncestor(node, function (ancestor) { return !ancestor.parent; }); @@ -131756,6 +132956,10 @@ var ts; return jsx === 2 /* JsxEmit.React */ || jsx === 3 /* JsxEmit.ReactNative */; } ts.jsxModeNeedsExplicitImport = jsxModeNeedsExplicitImport; + function isSourceFileFromLibrary(program, node) { + return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node); + } + ts.isSourceFileFromLibrary = isSourceFileFromLibrary; // #endregion })(ts || (ts = {})); /*@internal*/ @@ -131871,14 +133075,16 @@ var ts; search: function (importingFile, preferCapitalized, matches, action) { if (importingFile !== usableByFileName) return; - exportInfo.forEach(function (info, key) { + return ts.forEachEntry(exportInfo, function (info, key) { var _a = parseKey(key), symbolName = _a.symbolName, ambientModuleName = _a.ambientModuleName; var name = preferCapitalized && info[0].capitalizedSymbolName || symbolName; if (matches(name, info[0].targetFlags)) { var rehydrated = info.map(rehydrateCachedInfo); var filtered = rehydrated.filter(function (r, i) { return isNotShadowedByDeeperNodeModulesPackage(r, info[i].packageName); }); if (filtered.length) { - action(filtered, name, !!ambientModuleName, key); + var res = action(filtered, name, !!ambientModuleName, key); + if (res !== undefined) + return res; } } }); @@ -132266,11 +133472,11 @@ var ts; angleBracketStack--; } break; - case 130 /* SyntaxKind.AnyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: if (angleBracketStack > 0 && !syntacticClassifierAbsent) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, @@ -132459,10 +133665,11 @@ var ts; return true; } switch (keyword2) { - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: return true; // Allow things like "public get", "public constructor" and "public static". default: return false; // Any other keyword following "public" is actually an identifier, not a real keyword. @@ -132509,7 +133716,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: case 34 /* SyntaxKind.EqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: @@ -132605,13 +133813,13 @@ var ts; // That means we're calling back into the host around every 1.2k of the file we process. // Lib.d.ts has similar numbers. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -132833,46 +134041,46 @@ var ts; pos = tag.tagName.end; var commentStart = tag.tagName.end; switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var param = tag; processJSDocParameterTag(param); commentStart = param.isNameFirst && ((_a = param.typeExpression) === null || _a === void 0 ? void 0 : _a.end) || param.name.end; break; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var prop = tag; commentStart = prop.isNameFirst && ((_b = prop.typeExpression) === null || _b === void 0 ? void 0 : _b.end) || prop.name.end; break; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: processJSDocTemplateTag(tag); pos = tag.end; commentStart = tag.typeParameters.end; break; - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: var type = tag; - commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 309 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; + commentStart = ((_c = type.typeExpression) === null || _c === void 0 ? void 0 : _c.kind) === 312 /* SyntaxKind.JSDocTypeExpression */ && ((_d = type.fullName) === null || _d === void 0 ? void 0 : _d.end) || ((_e = type.typeExpression) === null || _e === void 0 ? void 0 : _e.end) || commentStart; break; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: commentStart = tag.typeExpression.end; break; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = tag.typeExpression.end; break; - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: commentStart = tag.typeExpression.end; break; - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: processElement(tag.typeExpression); pos = tag.end; commentStart = ((_f = tag.typeExpression) === null || _f === void 0 ? void 0 : _f.end) || commentStart; break; - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: commentStart = ((_g = tag.name) === null || _g === void 0 ? void 0 : _g.end) || commentStart; break; - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: commentStart = tag.class.end; break; } @@ -132919,7 +134127,7 @@ var ts; // defined in `ts.commentPragmas` would be excessive, but we can avoid // some obvious false positives (e.g. in XML-like doc comments) by // checking the element name. - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!match[3] || !(match[3] in ts.commentPragmas)) { return false; } @@ -133029,22 +134237,22 @@ var ts; } function tryClassifyJsxElementName(token) { switch (token.parent && token.parent.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: if (token.parent.tagName === token) { return 19 /* ClassificationType.jsxOpenTagName */; } break; - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (token.parent.tagName === token) { return 20 /* ClassificationType.jsxCloseTagName */; } break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: if (token.parent.tagName === token) { return 21 /* ClassificationType.jsxSelfClosingTagName */; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: if (token.parent.name === token) { return 22 /* ClassificationType.jsxAttribute */; } @@ -133073,17 +134281,17 @@ var ts; var parent = token.parent; if (tokenKind === 63 /* SyntaxKind.EqualsToken */) { // the '=' in a variable declaration is special cased here. - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 164 /* SyntaxKind.Parameter */ || - parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 166 /* SyntaxKind.Parameter */ || + parent.kind === 288 /* SyntaxKind.JsxAttribute */) { return 5 /* ClassificationType.operator */; } } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ || - parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || - parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */ || - parent.kind === 222 /* SyntaxKind.ConditionalExpression */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ || + parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || + parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */ || + parent.kind === 224 /* SyntaxKind.ConditionalExpression */) { return 5 /* ClassificationType.operator */; } } @@ -133096,7 +134304,7 @@ var ts; return 25 /* ClassificationType.bigintLiteral */; } else if (tokenKind === 10 /* SyntaxKind.StringLiteral */) { - return token && token.parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; + return token && token.parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? 24 /* ClassificationType.jsxAttributeStringLiteralValue */ : 6 /* ClassificationType.stringLiteral */; } else if (tokenKind === 13 /* SyntaxKind.RegularExpressionLiteral */) { // TODO: we should get another classification type for these literals. @@ -133112,32 +134320,32 @@ var ts; else if (tokenKind === 79 /* SyntaxKind.Identifier */) { if (token) { switch (token.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (token.parent.name === token) { return 11 /* ClassificationType.className */; } return; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: if (token.parent.name === token) { return 15 /* ClassificationType.typeParameterName */; } return; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: if (token.parent.name === token) { return 13 /* ClassificationType.interfaceName */; } return; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (token.parent.name === token) { return 12 /* ClassificationType.enumName */; } return; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (token.parent.name === token) { return 14 /* ClassificationType.moduleName */; } return; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (token.parent.name === token) { return ts.isThisIdentifier(token) ? 3 /* ClassificationType.keyword */ : 17 /* ClassificationType.parameterName */; } @@ -133242,13 +134450,13 @@ var ts; var inJSXElement = false; function visit(node) { switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!node || !ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth()) || node.getFullWidth() === 0) { @@ -133288,7 +134496,7 @@ var ts; if (modifiers & 32 /* ModifierFlags.Static */) { modifierSet |= 1 << 1 /* TokenModifier.static */; } - if (modifiers & 256 /* ModifierFlags.Async */) { + if (modifiers & 512 /* ModifierFlags.Async */) { modifierSet |= 1 << 2 /* TokenModifier.async */; } if (typeIdx !== 0 /* TokenType.class */ && typeIdx !== 2 /* TokenType.interface */) { @@ -133394,25 +134602,25 @@ var ts; return (ts.isQualifiedName(node.parent) && node.parent.right === node) || (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node); } var tokenFromDeclarationMapping = new ts.Map([ - [254 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], - [164 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], - [167 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], - [261 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], - [260 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], - [299 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], - [257 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], - [169 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], - [256 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], - [213 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], - [168 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], - [172 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], - [173 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], - [166 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], - [258 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], - [259 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], - [163 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], - [296 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], - [297 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] + [257 /* SyntaxKind.VariableDeclaration */, 7 /* TokenType.variable */], + [166 /* SyntaxKind.Parameter */, 6 /* TokenType.parameter */], + [169 /* SyntaxKind.PropertyDeclaration */, 9 /* TokenType.property */], + [264 /* SyntaxKind.ModuleDeclaration */, 3 /* TokenType.namespace */], + [263 /* SyntaxKind.EnumDeclaration */, 1 /* TokenType.enum */], + [302 /* SyntaxKind.EnumMember */, 8 /* TokenType.enumMember */], + [260 /* SyntaxKind.ClassDeclaration */, 0 /* TokenType.class */], + [171 /* SyntaxKind.MethodDeclaration */, 11 /* TokenType.member */], + [259 /* SyntaxKind.FunctionDeclaration */, 10 /* TokenType.function */], + [215 /* SyntaxKind.FunctionExpression */, 10 /* TokenType.function */], + [170 /* SyntaxKind.MethodSignature */, 11 /* TokenType.member */], + [174 /* SyntaxKind.GetAccessor */, 9 /* TokenType.property */], + [175 /* SyntaxKind.SetAccessor */, 9 /* TokenType.property */], + [168 /* SyntaxKind.PropertySignature */, 9 /* TokenType.property */], + [261 /* SyntaxKind.InterfaceDeclaration */, 2 /* TokenType.interface */], + [262 /* SyntaxKind.TypeAliasDeclaration */, 5 /* TokenType.type */], + [165 /* SyntaxKind.TypeParameter */, 4 /* TokenType.typeParameter */], + [299 /* SyntaxKind.PropertyAssignment */, 9 /* TokenType.property */], + [300 /* SyntaxKind.ShorthandPropertyAssignment */, 9 /* TokenType.property */] ]); })(v2020 = classifier.v2020 || (classifier.v2020 = {})); })(classifier = ts.classifier || (ts.classifier = {})); @@ -133546,18 +134754,18 @@ var ts; function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host, preferences) { var parent = walkUpParentheses(node.parent); switch (parent.kind) { - case 196 /* SyntaxKind.LiteralType */: { + case 198 /* SyntaxKind.LiteralType */: { var grandParent_1 = walkUpParentheses(parent.parent); switch (grandParent_1.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: { var typeArgument = ts.findAncestor(parent, function (n) { return n.parent === grandParent_1; }); if (typeArgument) { return { kind: 2 /* StringLiteralCompletionKind.Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(typeArgument)), isNewIdentifier: false }; } return undefined; } - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: // Get all apparent property names // i.e. interface Foo { // foo: string; @@ -133569,9 +134777,9 @@ var ts; return undefined; } return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(objectType)); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return { kind: 0 /* StringLiteralCompletionKind.Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker, preferences) }; - case 187 /* SyntaxKind.UnionType */: { + case 189 /* SyntaxKind.UnionType */: { if (!ts.isTypeReferenceNode(grandParent_1.parent)) { return undefined; } @@ -133583,7 +134791,7 @@ var ts; return undefined; } } - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isObjectLiteralExpression(parent.parent) && parent.name === node) { // Get quoted name of properties of the object literal expression // i.e. interface ConfigFiles { @@ -133600,7 +134808,7 @@ var ts; return stringLiteralCompletionsForObjectLiteral(typeChecker, parent.parent); } return fromContextualType(); - case 207 /* SyntaxKind.ElementAccessExpression */: { + case 209 /* SyntaxKind.ElementAccessExpression */: { var _b = parent, expression = _b.expression, argumentExpression = _b.argumentExpression; if (node === ts.skipParentheses(argumentExpression)) { // Get all names of properties on the expression @@ -133613,20 +134821,20 @@ var ts; } return undefined; } - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 285 /* SyntaxKind.JsxAttribute */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 288 /* SyntaxKind.JsxAttribute */: if (!isRequireCallArgument(node) && !ts.isImportCall(parent)) { - var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 285 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); + var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(parent.kind === 288 /* SyntaxKind.JsxAttribute */ ? parent.parent : node, position, sourceFile); // Get string literal completions from specialized signatures of the target // i.e. declare function f(a: 'A'); // f("/*completion position*/") - return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) : fromContextualType(); + return argumentInfo && getStringLiteralCompletionsFromSignature(argumentInfo.invocation, node, argumentInfo, typeChecker) || fromContextualType(); } // falls through (is `require("")` or `require(""` or `import("")`) - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 277 /* SyntaxKind.ExternalModuleReference */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 280 /* SyntaxKind.ExternalModuleReference */: // Get all known external module names or complete a path to a module // i.e. import * as ns from "/*completion position*/"; // var y = import("/*completion position*/"); @@ -133645,9 +134853,9 @@ var ts; } function walkUpParentheses(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return ts.walkUpParenthesizedTypes(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return ts.walkUpParenthesizedExpressions(node); default: return node; @@ -133677,7 +134885,7 @@ var ts; isNewIdentifier = isNewIdentifier || !!(type.flags & 4 /* TypeFlags.String */); return getStringLiteralTypes(type, uniques); }); - return { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier }; + return ts.length(types) ? { kind: 2 /* StringLiteralCompletionKind.Types */, types: types, isNewIdentifier: isNewIdentifier } : undefined; } function stringLiteralCompletionsFromProperties(type) { return type && { @@ -134195,7 +135403,7 @@ var ts; if (!dependencies) continue; for (var dep in dependencies) { - if (dependencies.hasOwnProperty(dep) && !ts.startsWith(dep, "@types/")) { + if (ts.hasProperty(dependencies, dep) && !ts.startsWith(dep, "@types/")) { result.push(dep); } } @@ -134570,7 +135778,7 @@ var ts; } function keywordFiltersFromSyntaxKind(keywordCompletion) { switch (keywordCompletion) { - case 152 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; + case 154 /* SyntaxKind.TypeKeyword */: return 8 /* KeywordCompletionFilters.TypeKeyword */; default: ts.Debug.fail("Unknown mapping from SyntaxKind to KeywordCompletionFilters"); } } @@ -134579,7 +135787,7 @@ var ts; return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* SyntaxKind.Identifier */ ? ts.createTextSpanFromNode(location) : undefined; } function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences, formatContext, position) { - var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importCompletionNode = completionData.importCompletionNode, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; + var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, isRightOfOpenTag = completionData.isRightOfOpenTag, importStatementCompletion = completionData.importStatementCompletion, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports; // Verify if the file is JSX language variant if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* LanguageVariant.JSX */) { var completionInfo = getJsxClosingTagCompletion(location, sourceFile); @@ -134593,7 +135801,7 @@ var ts; return undefined; } var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, - /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); + /*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag); if (keywordFilters !== 0 /* KeywordCompletionFilters.None */) { for (var _i = 0, _a = getKeywordCompletions(keywordFilters, !insideJsDocTagTypeExpression && ts.isSourceFileJS(sourceFile)); _i < _a.length; _i++) { var keywordEntry = _a[_i]; @@ -134646,12 +135854,12 @@ var ts; // We wanna walk up the tree till we find a JSX closing element var jsxClosingElement = ts.findAncestor(location, function (node) { switch (node.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: return true; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return false; default: return "quit"; @@ -134711,7 +135919,7 @@ var ts; function createCompletionEntryForLiteral(sourceFile, preferences, literal) { return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* ScriptElementKind.string */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.LocationPriority }; } - function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { + function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, options, preferences, completionKind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag) { var _a, _b; var insertText; var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken); @@ -134767,8 +135975,8 @@ var ts; } if (originIsResolvedExport(origin)) { sourceDisplay = [ts.textPart(origin.moduleSpecifier)]; - if (importCompletionNode) { - (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); + if (importStatementCompletion) { + (_a = getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences), insertText = _a.insertText, replacementSpan = _a.replacementSpan); isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined; } } @@ -134778,7 +135986,7 @@ var ts; if (preferences.includeCompletionsWithClassMemberSnippets && preferences.includeCompletionsWithInsertText && completionKind === 3 /* CompletionKind.MemberLike */ && - isClassLikeMemberCompletion(symbol, location)) { + isClassLikeMemberCompletion(symbol, location, sourceFile)) { var importAdder = void 0; (_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken, formatContext), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder, replacementSpan = _b.replacementSpan); sortText = Completions.SortText.ClassMemberSnippets; // sortText has to be lower priority than the sortText for keywords. See #47852. @@ -134823,7 +136031,7 @@ var ts; } if (originIsExport(origin) || originIsResolvedExport(origin)) { data = originToCompletionEntryData(origin); - hasAction = !importCompletionNode; + hasAction = !importStatementCompletion; } // TODO(drosen): Right now we just permit *all* semantic meanings when calling // 'getSymbolKind' which is permissible given that it is backwards compatible; but @@ -134846,11 +136054,11 @@ var ts; labelDetails: labelDetails, isSnippet: isSnippet, isPackageJsonImport: originIsPackageJsonImport(origin) || undefined, - isImportStatementCompletion: !!importCompletionNode || undefined, + isImportStatementCompletion: !!importStatementCompletion || undefined, data: data, }; } - function isClassLikeMemberCompletion(symbol, location) { + function isClassLikeMemberCompletion(symbol, location, sourceFile) { // TODO: support JS files. if (ts.isInJSFile(location)) { return false; @@ -134884,6 +136092,7 @@ var ts; location.parent.parent && ts.isClassElement(location.parent) && location === location.parent.name && + location.parent.getLastToken(sourceFile) === location.parent.name && ts.isClassLike(location.parent.parent)) || (location.parent && ts.isSyntaxList(location) && @@ -134925,7 +136134,7 @@ var ts; // Whether the suggested member should be abstract. // e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`. var _a = getPresentModifiers(contextToken), presentModifiers = _a.modifiers, modifiersSpan = _a.span; - var isAbstract = !!(presentModifiers & 128 /* ModifierFlags.Abstract */); + var isAbstract = !!(presentModifiers & 256 /* ModifierFlags.Abstract */); var completionNodes = []; ts.codefix.addNewNodeForMemberSymbol(symbol, classLikeDeclaration, sourceFile, { program: program, host: host }, preferences, importAdder, // `addNewNodeForMemberSymbol` calls this callback function for each new member node @@ -134938,7 +136147,7 @@ var ts; function (node) { var requiredModifiers = 0 /* ModifierFlags.None */; if (isAbstract) { - requiredModifiers |= 128 /* ModifierFlags.Abstract */; + requiredModifiers |= 256 /* ModifierFlags.Abstract */; } if (ts.isClassElement(node) && checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* MemberOverrideStatus.NeedsOverride */) { @@ -134999,7 +136208,7 @@ var ts; span = ts.createTextSpanFromNode(contextToken); } if (ts.isPropertyDeclaration(contextToken.parent)) { - modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 125951 /* ModifierFlags.Modifier */; + modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers) & 126975 /* ModifierFlags.Modifier */; span = ts.createTextSpanFromNode(contextToken.parent); } return { modifiers: modifiers, span: span }; @@ -135048,7 +136257,6 @@ var ts; var labelDetails = { detail: signaturePrinter.printNode(4 /* EmitHint.Unspecified */, methodSignature, sourceFile) }; return { isSnippet: isSnippet, insertText: insertText, labelDetails: labelDetails }; } - ; function createObjectLiteralMethod(symbol, enclosingDeclaration, sourceFile, program, host, preferences) { var declarations = symbol.getDeclarations(); if (!(declarations && declarations.length)) { @@ -135061,10 +136269,10 @@ var ts; var quotePreference = ts.getQuotePreference(sourceFile, preferences); var builderFlags = 33554432 /* NodeBuilderFlags.OmitThisParameter */ | (quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : 0 /* NodeBuilderFlags.None */); switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: { var effectiveType = type.flags & 1048576 /* TypeFlags.Union */ && type.types.length < 10 ? checker.getUnionType(type.types, 2 /* UnionReduction.Subtype */) : type; @@ -135098,7 +136306,8 @@ var ts; } var parameters = typeNode.parameters.map(function (typedParam) { return ts.factory.createParameterDeclaration( - /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, typedParam.questionToken, + /*modifiers*/ undefined, typedParam.dotDotDotToken, typedParam.name, + /*questionToken*/ undefined, /*type*/ undefined, typedParam.initializer); }); return ts.factory.createMethodDeclaration( @@ -135218,20 +136427,17 @@ var ts; }; return unresolvedOrigin; } - function getInsertTextAndReplacementSpanForImportCompletion(name, importCompletionNode, contextToken, origin, useSemicolons, options, preferences) { - var _a, _b, _c; - var sourceFile = importCompletionNode.getSourceFile(); - var replacementSpan = ts.createTextSpanFromNode(ts.findAncestor(importCompletionNode, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)) || importCompletionNode, sourceFile); + function getInsertTextAndReplacementSpanForImportCompletion(name, importStatementCompletion, origin, useSemicolons, sourceFile, options, preferences) { + var replacementSpan = importStatementCompletion.replacementSpan; var quotedModuleSpecifier = ts.quote(sourceFile, preferences, origin.moduleSpecifier); var exportKind = origin.isDefaultExport ? 1 /* ExportKind.Default */ : origin.exportName === "export=" /* InternalSymbolName.ExportEquals */ ? 2 /* ExportKind.ExportEquals */ : 0 /* ExportKind.Named */; var tabStop = preferences.includeCompletionsWithSnippetText ? "$1" : ""; var importKind = ts.codefix.getImportKind(sourceFile, exportKind, options, /*forceImportKeyword*/ true); - var isTopLevelTypeOnly = ((_b = (_a = ts.tryCast(importCompletionNode, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || ((_c = ts.tryCast(importCompletionNode, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly); - var isImportSpecifierTypeOnly = couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); - var topLevelTypeOnlyText = isTopLevelTypeOnly ? " ".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : " "; - var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(152 /* SyntaxKind.TypeKeyword */), " ") : ""; + var isImportSpecifierTypeOnly = importStatementCompletion.couldBeTypeOnlyImportSpecifier; + var topLevelTypeOnlyText = importStatementCompletion.isTopLevelTypeOnly ? " ".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : " "; + var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? "".concat(ts.tokenToString(154 /* SyntaxKind.TypeKeyword */), " ") : ""; var suffix = useSemicolons ? ";" : ""; switch (importKind) { case 3 /* ImportKind.CommonJS */: return { replacementSpan: replacementSpan, insertText: "import".concat(topLevelTypeOnlyText).concat(ts.escapeSnippetText(name)).concat(tabStop, " = require(").concat(quotedModuleSpecifier, ")").concat(suffix) }; @@ -135264,7 +136470,7 @@ var ts; return CompletionSource.TypeOnlyAlias; } } - function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { + function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, formatContext, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importStatementCompletion, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap, isJsxIdentifierExpected, isRightOfOpenTag) { var _a; var start = ts.timestamp(); var variableDeclaration = getVariableDeclaration(location); @@ -135285,7 +136491,7 @@ var ts; var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess; var originalSortText = (_a = symbolToSortTextMap === null || symbolToSortTextMap === void 0 ? void 0 : symbolToSortTextMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : Completions.SortText.LocationPriority; var sortText = (isDeprecated(symbol, typeChecker) ? Completions.SortText.Deprecated(originalSortText) : originalSortText); - var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); + var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importStatementCompletion, useSemicolons, compilerOptions, preferences, kind, formatContext, isJsxIdentifierExpected, isRightOfOpenTag); if (!entry) { continue; } @@ -135445,7 +136651,7 @@ var ts; } case "symbol": { var symbol = symbolCompletion.symbol, location = symbolCompletion.location, contextToken_2 = symbolCompletion.contextToken, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken; - var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; + var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay; return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); // TODO: GH#18217 } case "literal": { @@ -135474,9 +136680,9 @@ var ts; return { name: name, kindModifiers: kindModifiers, kind: kind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source, sourceDisplay: source }; } Completions.createCompletionDetails = createCompletionDetails; - function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) { + function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken) { if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) { - if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementNode) { + if (previousToken && getImportStatementCompletionInfo(contextToken || previousToken).replacementSpan) { // Import statement completion: 'import c|' return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] }; } @@ -135506,7 +136712,7 @@ var ts; var moduleSymbol = origin.moduleSymbol; var targetSymbol = checker.getMergedSymbol(ts.skipAlias(symbol.exportSymbol || symbol, checker)); var isJsxOpeningTagName = (contextToken === null || contextToken === void 0 ? void 0 : contextToken.kind) === 29 /* SyntaxKind.LessThanToken */ && ts.isJsxOpeningLikeElement(contextToken.parent); - var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; + var _a = ts.codefix.getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, ts.getNameForExportedSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), isJsxOpeningTagName), isJsxOpeningTagName, host, program, formatContext, previousToken && ts.isIdentifier(previousToken) ? previousToken.getStart(sourceFile) : position, preferences, cancellationToken), moduleSpecifier = _a.moduleSpecifier, codeAction = _a.codeAction; ts.Debug.assert(!(data === null || data === void 0 ? void 0 : data.moduleSpecifier) || moduleSpecifier === data.moduleSpecifier); return { sourceDisplay: [ts.textPart(moduleSpecifier)], codeActions: [codeAction] }; } @@ -135549,11 +136755,11 @@ var ts; return ts.getContextualTypeFromParent(previousToken, checker); case 63 /* SyntaxKind.EqualsToken */: switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.getContextualType(parent.initializer); // TODO: GH#18217 - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checker.getTypeAtLocation(parent.left); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return checker.getContextualTypeForJsxAttribute(parent); default: return undefined; @@ -135584,7 +136790,7 @@ var ts; } function isModuleSymbol(symbol) { var _a; - return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 305 /* SyntaxKind.SourceFile */; })); + return !!((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d.kind === 308 /* SyntaxKind.SourceFile */; })); } function getCompletionData(program, log, sourceFile, compilerOptions, position, preferences, detailsEntryId, host, formatContext, cancellationToken) { var typeChecker = program.getTypeChecker(); @@ -135641,7 +136847,7 @@ var ts; currentToken = ts.getTokenAtPosition(sourceFile, position); if (!currentToken || (!ts.isDeclarationName(currentToken) && - (currentToken.parent.kind !== 347 /* SyntaxKind.JSDocPropertyTag */ || + (currentToken.parent.kind !== 350 /* SyntaxKind.JSDocPropertyTag */ || currentToken.parent.name !== currentToken))) { // Use as type location if inside tag's type expression insideJsDocTagTypeExpression = isCurrentlyEditingNode(typeExpression); @@ -135677,34 +136883,34 @@ var ts; var isStartingCloseTag = false; var isJsxInitializer = false; var isJsxIdentifierExpected = false; - var importCompletionNode; + var importStatementCompletion; var location = ts.getTouchingPropertyName(sourceFile, position); var keywordFilters = 0 /* KeywordCompletionFilters.None */; var isNewIdentifierLocation = false; var flags = 0 /* CompletionInfoFlags.None */; if (contextToken) { - var importStatementCompletion = getImportStatementCompletionInfo(contextToken); - isNewIdentifierLocation = importStatementCompletion.isNewIdentifierLocation; - if (importStatementCompletion.keywordCompletion) { - if (importStatementCompletion.isKeywordOnlyCompletion) { + var importStatementCompletionInfo = getImportStatementCompletionInfo(contextToken); + if (importStatementCompletionInfo.keywordCompletion) { + if (importStatementCompletionInfo.isKeywordOnlyCompletion) { return { kind: 4 /* CompletionDataKind.Keywords */, - keywordCompletions: [keywordToCompletionEntry(importStatementCompletion.keywordCompletion)], - isNewIdentifierLocation: isNewIdentifierLocation, + keywordCompletions: [keywordToCompletionEntry(importStatementCompletionInfo.keywordCompletion)], + isNewIdentifierLocation: importStatementCompletionInfo.isNewIdentifierLocation, }; } - keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletion.keywordCompletion); + keywordFilters = keywordFiltersFromSyntaxKind(importStatementCompletionInfo.keywordCompletion); } - if (importStatementCompletion.replacementNode && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { + if (importStatementCompletionInfo.replacementSpan && preferences.includeCompletionsForImportStatements && preferences.includeCompletionsWithInsertText) { // Import statement completions use `insertText`, and also require the `data` property of `CompletionEntryIdentifier` // added in TypeScript 4.3 to be sent back from the client during `getCompletionEntryDetails`. Since this feature // is not backward compatible with older clients, the language service defaults to disabling it, allowing newer clients // to opt in with the `includeCompletionsForImportStatements` user preference. - importCompletionNode = importStatementCompletion.replacementNode; flags |= 2 /* CompletionInfoFlags.IsImportStatementCompletion */; + importStatementCompletion = importStatementCompletionInfo; + isNewIdentifierLocation = importStatementCompletionInfo.isNewIdentifierLocation; } // Bail out if this is a known invalid completion location - if (!importCompletionNode && isCompletionListBlocker(contextToken)) { + if (!importStatementCompletionInfo.replacementSpan && isCompletionListBlocker(contextToken)) { log("Returning an empty list because completion was requested in an invalid position."); return keywordFilters ? keywordCompletionData(keywordFilters, isJsOnlyLocation, isNewIdentifierDefinitionLocation()) @@ -135715,7 +136921,7 @@ var ts; isRightOfDot = contextToken.kind === 24 /* SyntaxKind.DotToken */; isRightOfQuestionDot = contextToken.kind === 28 /* SyntaxKind.QuestionDotToken */; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: propertyAccessToConvert = parent; node = propertyAccessToConvert.expression; var leftmostAccessExpression = ts.getLeftmostAccessExpression(propertyAccessToConvert); @@ -135731,16 +136937,16 @@ var ts; return undefined; } break; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: node = parent.left; break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: node = parent.name; break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: node = parent; break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: node = parent.getFirstToken(sourceFile); ts.Debug.assert(node.kind === 100 /* SyntaxKind.ImportKeyword */ || node.kind === 103 /* SyntaxKind.NewKeyword */); break; @@ -135750,11 +136956,11 @@ var ts; return undefined; } } - else if (!importCompletionNode && sourceFile.languageVariant === 1 /* LanguageVariant.JSX */) { + else if (!importStatementCompletion) { // // If the tagname is a property access expression, we will then walk up to the top most of property access expression. // Then, try to get a JSX container and its associated attributes type. - if (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { contextToken = parent; parent = parent.parent; } @@ -135762,46 +136968,46 @@ var ts; if (currentToken.parent === location) { switch (currentToken.kind) { case 31 /* SyntaxKind.GreaterThanToken */: - if (currentToken.parent.kind === 278 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (currentToken.parent.kind === 281 /* SyntaxKind.JsxElement */ || currentToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { location = currentToken; } break; case 43 /* SyntaxKind.SlashToken */: - if (currentToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { + if (currentToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { location = currentToken; } break; } } switch (parent.kind) { - case 281 /* SyntaxKind.JsxClosingElement */: + case 284 /* SyntaxKind.JsxClosingElement */: if (contextToken.kind === 43 /* SyntaxKind.SlashToken */) { isStartingCloseTag = true; location = contextToken; } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (!binaryExpressionMayBeOpenTag(parent)) { break; } // falls through - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: isJsxIdentifierExpected = true; if (contextToken.kind === 29 /* SyntaxKind.LessThanToken */) { isRightOfOpenTag = true; location = contextToken; } break; - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: // For `
`, `parent` will be `{true}` and `previousToken` will be `}` if (previousToken.kind === 19 /* SyntaxKind.CloseBraceToken */ && currentToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { isJsxIdentifierExpected = true; } break; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: // For `
`, `parent` will be JsxAttribute and `previousToken` will be its initializer if (parent.initializer === previousToken && previousToken.end < position) { @@ -135893,19 +137099,19 @@ var ts; isTypeOnlyLocation: isTypeOnlyLocation, isJsxIdentifierExpected: isJsxIdentifierExpected, isRightOfOpenTag: isRightOfOpenTag, - importCompletionNode: importCompletionNode, + importStatementCompletion: importStatementCompletion, hasUnresolvedAutoImports: hasUnresolvedAutoImports, flags: flags, }; function isTagWithTypeExpression(tag) { switch (tag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return true; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return !!tag.constraint; default: return false; @@ -135914,7 +137120,7 @@ var ts; function tryGetTypeExpressionFromTag(tag) { if (isTagWithTypeExpression(tag)) { var typeExpression = ts.isJSDocTemplateTag(tag) ? tag.constraint : tag.typeExpression; - return typeExpression && typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; + return typeExpression && typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ ? typeExpression : undefined; } return undefined; } @@ -135957,7 +137163,7 @@ var ts; // If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods). if (!isTypeLocation && symbol.declarations && - symbol.declarations.some(function (d) { return d.kind !== 305 /* SyntaxKind.SourceFile */ && d.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 260 /* SyntaxKind.EnumDeclaration */; })) { + symbol.declarations.some(function (d) { return d.kind !== 308 /* SyntaxKind.SourceFile */ && d.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && d.kind !== 263 /* SyntaxKind.EnumDeclaration */; })) { var type = typeChecker.getTypeOfSymbolAtLocation(symbol, node).getNonOptionalType(); var insertQuestionDot = false; if (type.isNullableType()) { @@ -136003,7 +137209,7 @@ var ts; if (isRightOfQuestionDot && ts.some(type.getCallSignatures())) { isNewIdentifierLocation = true; } - var propertyAccess = node.kind === 200 /* SyntaxKind.ImportType */ ? node : node.parent; + var propertyAccess = node.kind === 202 /* SyntaxKind.ImportType */ ? node : node.parent; if (inCheckedFile) { for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) { var symbol = _a[_i]; @@ -136147,7 +137353,7 @@ var ts; return 1 /* GlobalsSearch.Success */; } function tryGetImportCompletionSymbols() { - if (!importCompletionNode) + if (!importStatementCompletion) return 0 /* GlobalsSearch.Continue */; isNewIdentifierLocation = true; collectAutoImports(); @@ -136210,7 +137416,7 @@ var ts; } } // Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions` - if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 305 /* SyntaxKind.SourceFile */) { + if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 308 /* SyntaxKind.SourceFile */) { var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false, ts.isClassLike(scopeNode.parent) ? scopeNode : undefined); if (thisType && !isProbablyGlobalType(thisType, sourceFile, typeChecker)) { for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) { @@ -136230,7 +137436,7 @@ var ts; } function shouldOfferImportCompletions() { // If already typing an import statement, provide completions for it. - if (importCompletionNode) + if (importStatementCompletion) return true; // If current completion is for non-contextual Object literal shortahands, ignore auto-import symbols if (isNonContextualObjectLiteral) @@ -136249,10 +137455,10 @@ var ts; } function isSnippetScope(scopeNode) { switch (scopeNode.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 223 /* SyntaxKind.TemplateExpression */: - case 288 /* SyntaxKind.JsxExpression */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 225 /* SyntaxKind.TemplateExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 238 /* SyntaxKind.Block */: return true; default: return ts.isStatement(scopeNode); @@ -136260,7 +137466,7 @@ var ts; } function isTypeOnlyCompletion() { return insideJsDocTagTypeExpression - || !!importCompletionNode && ts.isTypeOnlyImportOrExportDeclaration(location.parent) + || !!importStatementCompletion && ts.isTypeOnlyImportOrExportDeclaration(location.parent) || !isContextTokenValueLocation(contextToken) && (ts.isPossiblyTypeArgumentPosition(contextToken, sourceFile, typeChecker) || ts.isPartOfTypeNode(location) @@ -136269,28 +137475,30 @@ var ts; function isContextTokenValueLocation(contextToken) { return contextToken && ((contextToken.kind === 112 /* SyntaxKind.TypeOfKeyword */ && - (contextToken.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || - (contextToken.kind === 128 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 177 /* SyntaxKind.TypePredicate */)); + (contextToken.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isTypeOfExpression(contextToken.parent))) || + (contextToken.kind === 129 /* SyntaxKind.AssertsKeyword */ && contextToken.parent.kind === 179 /* SyntaxKind.TypePredicate */)); } function isContextTokenTypeLocation(contextToken) { if (contextToken) { var parentKind = contextToken.parent.kind; switch (contextToken.kind) { case 58 /* SyntaxKind.ColonToken */: - return parentKind === 167 /* SyntaxKind.PropertyDeclaration */ || - parentKind === 166 /* SyntaxKind.PropertySignature */ || - parentKind === 164 /* SyntaxKind.Parameter */ || - parentKind === 254 /* SyntaxKind.VariableDeclaration */ || + return parentKind === 169 /* SyntaxKind.PropertyDeclaration */ || + parentKind === 168 /* SyntaxKind.PropertySignature */ || + parentKind === 166 /* SyntaxKind.Parameter */ || + parentKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(parentKind); case 63 /* SyntaxKind.EqualsToken */: - return parentKind === 259 /* SyntaxKind.TypeAliasDeclaration */; - case 127 /* SyntaxKind.AsKeyword */: - return parentKind === 229 /* SyntaxKind.AsExpression */; + return parentKind === 262 /* SyntaxKind.TypeAliasDeclaration */; + case 128 /* SyntaxKind.AsKeyword */: + return parentKind === 231 /* SyntaxKind.AsExpression */; case 29 /* SyntaxKind.LessThanToken */: - return parentKind === 178 /* SyntaxKind.TypeReference */ || - parentKind === 211 /* SyntaxKind.TypeAssertionExpression */; + return parentKind === 180 /* SyntaxKind.TypeReference */ || + parentKind === 213 /* SyntaxKind.TypeAssertionExpression */; case 94 /* SyntaxKind.ExtendsKeyword */: - return parentKind === 163 /* SyntaxKind.TypeParameter */; + return parentKind === 165 /* SyntaxKind.TypeParameter */; + case 150 /* SyntaxKind.SatisfiesKeyword */: + return parentKind === 235 /* SyntaxKind.SatisfiesExpression */; } } return false; @@ -136308,8 +137516,7 @@ var ts; flags |= 1 /* CompletionInfoFlags.MayIncludeAutoImports */; // import { type | -> token text should be blank var isAfterTypeOnlyImportSpecifierModifier = previousToken === contextToken - && importCompletionNode - && couldBeTypeOnlyImportSpecifier(importCompletionNode, contextToken); + && importStatementCompletion; var lowerCaseTokenText = isAfterTypeOnlyImportSpecifierModifier ? "" : previousToken && ts.isIdentifier(previousToken) ? previousToken.text.toLowerCase() : ""; @@ -136317,14 +137524,14 @@ var ts; var exportInfo = ts.getExportInfoMap(sourceFile, host, program, preferences, cancellationToken); var packageJsonAutoImportProvider = (_b = host.getPackageJsonAutoImportProvider) === null || _b === void 0 ? void 0 : _b.call(host); var packageJsonFilter = detailsEntryId ? undefined : ts.createPackageJsonImportFilter(sourceFile, preferences, host); - resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importCompletionNode, ts.isValidTypeOnlyAliasUseSite(location), function (context) { + resolvingModuleSpecifiers("collectAutoImports", host, importSpecifierResolver || (importSpecifierResolver = ts.codefix.createImportSpecifierResolver(sourceFile, program, host, preferences)), program, position, preferences, !!importStatementCompletion, ts.isValidTypeOnlyAliasUseSite(location), function (context) { exportInfo.search(sourceFile.path, /*preferCapitalized*/ isRightOfOpenTag, function (symbolName, targetFlags) { if (!ts.isIdentifierText(symbolName, ts.getEmitScriptTarget(host.getCompilationSettings()))) return false; if (!detailsEntryId && ts.isStringANonContextualKeyword(symbolName)) return false; - if (!isTypeOnlyLocation && !importCompletionNode && !(targetFlags & 111551 /* SymbolFlags.Value */)) + if (!isTypeOnlyLocation && !importStatementCompletion && !(targetFlags & 111551 /* SymbolFlags.Value */)) return false; if (isTypeOnlyLocation && !(targetFlags & (1536 /* SymbolFlags.Module */ | 788968 /* SymbolFlags.Type */))) return false; @@ -136405,7 +137612,7 @@ var ts; return; } symbolToOriginInfoMap[symbols.length] = origin; - symbolToSortTextMap[symbolId] = importCompletionNode ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; + symbolToSortTextMap[symbolId] = importStatementCompletion ? Completions.SortText.LocationPriority : Completions.SortText.AutoImportSuggestions; symbols.push(symbol); } /* Mutates `symbols` and `symbolToOriginInfoMap`. */ @@ -136481,18 +137688,18 @@ var ts; // - contextToken: GreaterThanToken (before cursor) // - location: JsxSelfClosingElement or JsxOpeningElement // - contextToken.parent === location - if (location === contextToken.parent && (location.kind === 280 /* SyntaxKind.JsxOpeningElement */ || location.kind === 279 /* SyntaxKind.JsxSelfClosingElement */)) { + if (location === contextToken.parent && (location.kind === 283 /* SyntaxKind.JsxOpeningElement */ || location.kind === 282 /* SyntaxKind.JsxSelfClosingElement */)) { return false; } - if (contextToken.parent.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (contextToken.parent.kind === 283 /* SyntaxKind.JsxOpeningElement */) { //
/**/ // - contextToken: GreaterThanToken (before cursor) // - location: JSXElement // - different parents (JSXOpeningElement, JSXElement) - return location.parent.kind !== 280 /* SyntaxKind.JsxOpeningElement */; + return location.parent.kind !== 283 /* SyntaxKind.JsxOpeningElement */; } - if (contextToken.parent.kind === 281 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */) { - return !!contextToken.parent.parent && contextToken.parent.parent.kind === 278 /* SyntaxKind.JsxElement */; + if (contextToken.parent.kind === 284 /* SyntaxKind.JsxClosingElement */ || contextToken.parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */) { + return !!contextToken.parent.parent && contextToken.parent.parent.kind === 281 /* SyntaxKind.JsxElement */; } } return false; @@ -136504,44 +137711,44 @@ var ts; // Previous token may have been a keyword that was converted to an identifier. switch (tokenKind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( a, | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a, | - || containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [a, | - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */ // const x = (a, | - || containingNodeKind === 179 /* SyntaxKind.FunctionType */ // var x: (s: string, list| - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( a, | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */ + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a, | + || containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [a, | + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */ // const x = (a, | + || containingNodeKind === 181 /* SyntaxKind.FunctionType */ // var x: (s: string, list| + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { x, | case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 208 /* SyntaxKind.CallExpression */ // func( | - || containingNodeKind === 171 /* SyntaxKind.Constructor */ // constructor( | - || containingNodeKind === 209 /* SyntaxKind.NewExpression */ // new C(a| - || containingNodeKind === 212 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| - || containingNodeKind === 191 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ + return containingNodeKind === 210 /* SyntaxKind.CallExpression */ // func( | + || containingNodeKind === 173 /* SyntaxKind.Constructor */ // constructor( | + || containingNodeKind === 211 /* SyntaxKind.NewExpression */ // new C(a| + || containingNodeKind === 214 /* SyntaxKind.ParenthesizedExpression */ // const x = (a| + || containingNodeKind === 193 /* SyntaxKind.ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */ case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 204 /* SyntaxKind.ArrayLiteralExpression */ // [ | - || containingNodeKind === 176 /* SyntaxKind.IndexSignature */ // [ | : string ] - || containingNodeKind === 162 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ - case 141 /* SyntaxKind.ModuleKeyword */: // module | - case 142 /* SyntaxKind.NamespaceKeyword */: // namespace | + return containingNodeKind === 206 /* SyntaxKind.ArrayLiteralExpression */ // [ | + || containingNodeKind === 178 /* SyntaxKind.IndexSignature */ // [ | : string ] + || containingNodeKind === 164 /* SyntaxKind.ComputedPropertyName */; // [ | /* this can become an index signature */ + case 142 /* SyntaxKind.ModuleKeyword */: // module | + case 143 /* SyntaxKind.NamespaceKeyword */: // namespace | case 100 /* SyntaxKind.ImportKeyword */: // import | return true; case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 261 /* SyntaxKind.ModuleDeclaration */; // module A.| + return containingNodeKind === 264 /* SyntaxKind.ModuleDeclaration */; // module A.| case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ // class A { | - || containingNodeKind === 205 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ // class A { | + || containingNodeKind === 207 /* SyntaxKind.ObjectLiteralExpression */; // const obj = { | case 63 /* SyntaxKind.EqualsToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ // const x = a| - || containingNodeKind === 221 /* SyntaxKind.BinaryExpression */; // x = a| + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ // const x = a| + || containingNodeKind === 223 /* SyntaxKind.BinaryExpression */; // x = a| case 15 /* SyntaxKind.TemplateHead */: - return containingNodeKind === 223 /* SyntaxKind.TemplateExpression */; // `aa ${| + return containingNodeKind === 225 /* SyntaxKind.TemplateExpression */; // `aa ${| case 16 /* SyntaxKind.TemplateMiddle */: - return containingNodeKind === 233 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| - case 131 /* SyntaxKind.AsyncKeyword */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() - || containingNodeKind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| + return containingNodeKind === 236 /* SyntaxKind.TemplateSpan */; // `aa ${10} dd ${| + case 132 /* SyntaxKind.AsyncKeyword */: + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */ // const obj = { async c|() + || containingNodeKind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; // const obj = { async c| case 41 /* SyntaxKind.AsteriskToken */: - return containingNodeKind === 169 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| + return containingNodeKind === 171 /* SyntaxKind.MethodDeclaration */; // const obj = { * c| } if (isClassMemberCompletionKeyword(tokenKind)) { return true; @@ -136591,7 +137798,7 @@ var ts; completionKind = 0 /* CompletionKind.ObjectPropertyDeclaration */; var typeMembers; var existingMembers; - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { var instantiatedType = tryGetObjectLiteralContextualType(objectLikeContainer, typeChecker); // Check completions for Object property value shorthand if (instantiatedType === undefined) { @@ -136616,7 +137823,7 @@ var ts; } } else { - ts.Debug.assert(objectLikeContainer.kind === 201 /* SyntaxKind.ObjectBindingPattern */); + ts.Debug.assert(objectLikeContainer.kind === 203 /* SyntaxKind.ObjectBindingPattern */); // We are *only* completing on properties from the type being destructured. isNewIdentifierLocation = false; var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent); @@ -136627,12 +137834,12 @@ var ts; // through type declaration or inference. // Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed - // type of parameter will flow in from the contextual type of the function - var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */; - if (!canGetType && rootDeclaration.kind === 164 /* SyntaxKind.Parameter */) { + var canGetType = ts.hasInitializer(rootDeclaration) || !!ts.getEffectiveTypeAnnotationNode(rootDeclaration) || rootDeclaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */; + if (!canGetType && rootDeclaration.kind === 166 /* SyntaxKind.Parameter */) { if (ts.isExpression(rootDeclaration.parent)) { canGetType = !!typeChecker.getContextualType(rootDeclaration.parent); } - else if (rootDeclaration.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (rootDeclaration.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ || rootDeclaration.parent.kind === 175 /* SyntaxKind.SetAccessor */) { canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent); } } @@ -136651,7 +137858,7 @@ var ts; var filteredMembers = filterObjectMembersList(typeMembers, ts.Debug.checkDefined(existingMembers)); symbols = ts.concatenate(symbols, filteredMembers); setSortTextToOptionalMember(); - if (objectLikeContainer.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ + if (objectLikeContainer.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && preferences.includeCompletionsWithObjectLiteralMethodSnippets && preferences.includeCompletionsWithInsertText) { transformObjectLiteralMembersSortText(symbolsStartIndex); @@ -136686,10 +137893,10 @@ var ts; keywordFilters = 8 /* KeywordCompletionFilters.TypeKeyword */; } // try to show exported member for imported/re-exported module - var moduleSpecifier = (namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; + var moduleSpecifier = (namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier; if (!moduleSpecifier) { isNewIdentifierLocation = true; - return namedImportsOrExports.kind === 269 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; + return namedImportsOrExports.kind === 272 /* SyntaxKind.NamedImports */ ? 2 /* GlobalsSearch.Fail */ : 0 /* GlobalsSearch.Continue */; } var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); // TODO: GH#18217 if (!moduleSpecifierSymbol) { @@ -136834,11 +138041,11 @@ var ts; case 30 /* SyntaxKind.LessThanSlashToken */: case 43 /* SyntaxKind.SlashToken */: case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 286 /* SyntaxKind.JsxAttributes */: - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - if (parent && (parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 280 /* SyntaxKind.JsxOpeningElement */)) { + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 289 /* SyntaxKind.JsxAttributes */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + if (parent && (parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || parent.kind === 283 /* SyntaxKind.JsxOpeningElement */)) { if (contextToken.kind === 31 /* SyntaxKind.GreaterThanToken */) { var precedingToken = ts.findPrecedingToken(contextToken.pos, sourceFile, /*startNode*/ undefined); if (!parent.typeArguments || (precedingToken && precedingToken.kind === 43 /* SyntaxKind.SlashToken */)) @@ -136846,7 +138053,7 @@ var ts; } return parent; } - else if (parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + else if (parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136858,7 +138065,7 @@ var ts; // its parent is a JsxExpression, whose parent is a JsxAttribute, // whose parent is a JsxOpeningLikeElement case 10 /* SyntaxKind.StringLiteral */: - if (parent && ((parent.kind === 285 /* SyntaxKind.JsxAttribute */) || (parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */))) { + if (parent && ((parent.kind === 288 /* SyntaxKind.JsxAttribute */) || (parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */))) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136868,8 +138075,8 @@ var ts; break; case 19 /* SyntaxKind.CloseBraceToken */: if (parent && - parent.kind === 288 /* SyntaxKind.JsxExpression */ && - parent.parent && parent.parent.kind === 285 /* SyntaxKind.JsxAttribute */) { + parent.kind === 291 /* SyntaxKind.JsxExpression */ && + parent.parent && parent.parent.kind === 288 /* SyntaxKind.JsxAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136877,7 +138084,7 @@ var ts; // each JsxAttribute can have initializer as JsxExpression return parent.parent.parent.parent; } - if (parent && parent.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (parent && parent.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { // Currently we parse JsxOpeningLikeElement as: // JsxOpeningLikeElement // attributes: JsxAttributes @@ -136897,54 +138104,54 @@ var ts; var containingNodeKind = parent.kind; switch (contextToken.kind) { case 27 /* SyntaxKind.CommaToken */: - return containingNodeKind === 254 /* SyntaxKind.VariableDeclaration */ || + return containingNodeKind === 257 /* SyntaxKind.VariableDeclaration */ || isVariableDeclarationListButNotTypeArgument(contextToken) || - containingNodeKind === 237 /* SyntaxKind.VariableStatement */ || - containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | + containingNodeKind === 240 /* SyntaxKind.VariableStatement */ || + containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */ || // enum a { foo, | isFunctionLikeButNotConstructor(containingNodeKind) || - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A= contextToken.pos); case 24 /* SyntaxKind.DotToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [.| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [.| case 58 /* SyntaxKind.ColonToken */: - return containingNodeKind === 203 /* SyntaxKind.BindingElement */; // var {x :html| + return containingNodeKind === 205 /* SyntaxKind.BindingElement */; // var {x :html| case 22 /* SyntaxKind.OpenBracketToken */: - return containingNodeKind === 202 /* SyntaxKind.ArrayBindingPattern */; // var [x| + return containingNodeKind === 204 /* SyntaxKind.ArrayBindingPattern */; // var [x| case 20 /* SyntaxKind.OpenParenToken */: - return containingNodeKind === 292 /* SyntaxKind.CatchClause */ || + return containingNodeKind === 295 /* SyntaxKind.CatchClause */ || isFunctionLikeButNotConstructor(containingNodeKind); case 18 /* SyntaxKind.OpenBraceToken */: - return containingNodeKind === 260 /* SyntaxKind.EnumDeclaration */; // enum a { | + return containingNodeKind === 263 /* SyntaxKind.EnumDeclaration */; // enum a { | case 29 /* SyntaxKind.LessThanToken */: - return containingNodeKind === 257 /* SyntaxKind.ClassDeclaration */ || // class A< | - containingNodeKind === 226 /* SyntaxKind.ClassExpression */ || // var C = class D< | - containingNodeKind === 258 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | - containingNodeKind === 259 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | + return containingNodeKind === 260 /* SyntaxKind.ClassDeclaration */ || // class A< | + containingNodeKind === 228 /* SyntaxKind.ClassExpression */ || // var C = class D< | + containingNodeKind === 261 /* SyntaxKind.InterfaceDeclaration */ || // interface A< | + containingNodeKind === 262 /* SyntaxKind.TypeAliasDeclaration */ || // type List< | ts.isFunctionLikeKind(containingNodeKind); case 124 /* SyntaxKind.StaticKeyword */: - return containingNodeKind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); + return containingNodeKind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isClassLike(parent.parent); case 25 /* SyntaxKind.DotDotDotToken */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ || - (!!parent.parent && parent.parent.kind === 202 /* SyntaxKind.ArrayBindingPattern */); // var [...z| + return containingNodeKind === 166 /* SyntaxKind.Parameter */ || + (!!parent.parent && parent.parent.kind === 204 /* SyntaxKind.ArrayBindingPattern */); // var [...z| case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - return containingNodeKind === 164 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); - case 127 /* SyntaxKind.AsKeyword */: - return containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ || - containingNodeKind === 275 /* SyntaxKind.ExportSpecifier */ || - containingNodeKind === 268 /* SyntaxKind.NamespaceImport */; - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + return containingNodeKind === 166 /* SyntaxKind.Parameter */ && !ts.isConstructorDeclaration(parent.parent); + case 128 /* SyntaxKind.AsKeyword */: + return containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ || + containingNodeKind === 278 /* SyntaxKind.ExportSpecifier */ || + containingNodeKind === 271 /* SyntaxKind.NamespaceImport */; + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: return !isFromObjectTypeDeclaration(contextToken); case 79 /* SyntaxKind.Identifier */: - if (containingNodeKind === 270 /* SyntaxKind.ImportSpecifier */ && + if (containingNodeKind === 273 /* SyntaxKind.ImportSpecifier */ && contextToken === parent.name && contextToken.text === "type") { // import { type | } @@ -136959,11 +138166,11 @@ var ts; case 100 /* SyntaxKind.ImportKeyword */: case 119 /* SyntaxKind.LetKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return true; - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: // import { type foo| } - return containingNodeKind !== 270 /* SyntaxKind.ImportSpecifier */; + return containingNodeKind !== 273 /* SyntaxKind.ImportSpecifier */; case 41 /* SyntaxKind.AsteriskToken */: return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent); } @@ -136988,7 +138195,7 @@ var ts; case 126 /* SyntaxKind.AbstractKeyword */: case 84 /* SyntaxKind.ClassKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 98 /* SyntaxKind.FunctionKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: @@ -136999,7 +138206,7 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: case 113 /* SyntaxKind.VarKeyword */: return true; - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return ts.isPropertyDeclaration(contextToken.parent); } // If we are inside a class declaration, and `constructor` is totally not present, @@ -137008,7 +138215,7 @@ var ts; if (ancestorClassLike && contextToken === previousToken && isPreviousPropertyDeclarationTerminated(contextToken, position)) { return false; // Don't block completions. } - var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 167 /* SyntaxKind.PropertyDeclaration */); + var ancestorPropertyDeclaraion = ts.getAncestor(contextToken.parent, 169 /* SyntaxKind.PropertyDeclaration */); // If we are inside a class declaration and typing `constructor` after property declaration... if (ancestorPropertyDeclaraion && contextToken !== previousToken @@ -137040,7 +138247,7 @@ var ts; || !ts.positionsAreOnSameLine(contextToken.end, position, sourceFile)); } function isFunctionLikeButNotConstructor(kind) { - return ts.isFunctionLikeKind(kind) && kind !== 171 /* SyntaxKind.Constructor */; + return ts.isFunctionLikeKind(kind) && kind !== 173 /* SyntaxKind.Constructor */; } function isDotOfNumericLiteral(contextToken) { if (contextToken.kind === 8 /* SyntaxKind.NumericLiteral */) { @@ -137050,7 +138257,7 @@ var ts; return false; } function isVariableDeclarationListButNotTypeArgument(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && !ts.isPossiblyTypeArgumentPosition(node, sourceFile, typeChecker); } /** @@ -137068,13 +138275,13 @@ var ts; for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) { var m = existingMembers_1[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 296 /* SyntaxKind.PropertyAssignment */ && - m.kind !== 297 /* SyntaxKind.ShorthandPropertyAssignment */ && - m.kind !== 203 /* SyntaxKind.BindingElement */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */ && - m.kind !== 298 /* SyntaxKind.SpreadAssignment */) { + if (m.kind !== 299 /* SyntaxKind.PropertyAssignment */ && + m.kind !== 300 /* SyntaxKind.ShorthandPropertyAssignment */ && + m.kind !== 205 /* SyntaxKind.BindingElement */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */ && + m.kind !== 301 /* SyntaxKind.SpreadAssignment */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -137165,10 +138372,10 @@ var ts; for (var _i = 0, existingMembers_2 = existingMembers; _i < existingMembers_2.length; _i++) { var m = existingMembers_2[_i]; // Ignore omitted expressions for missing members - if (m.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - m.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - m.kind !== 172 /* SyntaxKind.GetAccessor */ && - m.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (m.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + m.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + m.kind !== 174 /* SyntaxKind.GetAccessor */ && + m.kind !== 175 /* SyntaxKind.SetAccessor */) { continue; } // If this is the current item we are editing right now, do not filter it out @@ -137210,7 +138417,7 @@ var ts; if (isCurrentlyEditingNode(attr)) { continue; } - if (attr.kind === 285 /* SyntaxKind.JsxAttribute */) { + if (attr.kind === 288 /* SyntaxKind.JsxAttribute */) { seenNames.add(attr.name.escapedText); } else if (ts.isJsxSpreadAttribute(attr)) { @@ -137308,7 +138515,7 @@ var ts; var _keywordCompletions = []; var allKeywordsCompletions = ts.memoize(function () { var res = []; - for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 160 /* SyntaxKind.LastKeyword */; i++) { + for (var i = 81 /* SyntaxKind.FirstKeyword */; i <= 162 /* SyntaxKind.LastKeyword */; i++) { res.push({ name: ts.tokenToString(i), kind: "keyword" /* ScriptElementKind.keyword */, @@ -137334,12 +138541,12 @@ var ts; return false; case 1 /* KeywordCompletionFilters.All */: return isFunctionLikeBodyKeyword(kind) - || kind === 135 /* SyntaxKind.DeclareKeyword */ - || kind === 141 /* SyntaxKind.ModuleKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ - || kind === 142 /* SyntaxKind.NamespaceKeyword */ + || kind === 136 /* SyntaxKind.DeclareKeyword */ + || kind === 142 /* SyntaxKind.ModuleKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ + || kind === 143 /* SyntaxKind.NamespaceKeyword */ || kind === 126 /* SyntaxKind.AbstractKeyword */ - || ts.isTypeKeyword(kind) && kind !== 153 /* SyntaxKind.UndefinedKeyword */; + || ts.isTypeKeyword(kind) && kind !== 155 /* SyntaxKind.UndefinedKeyword */; case 5 /* KeywordCompletionFilters.FunctionLikeBodyKeywords */: return isFunctionLikeBodyKeyword(kind); case 2 /* KeywordCompletionFilters.ClassElementKeywords */: @@ -137353,7 +138560,7 @@ var ts; case 7 /* KeywordCompletionFilters.TypeKeywords */: return ts.isTypeKeyword(kind); case 8 /* KeywordCompletionFilters.TypeKeyword */: - return kind === 152 /* SyntaxKind.TypeKeyword */; + return kind === 154 /* SyntaxKind.TypeKeyword */; default: return ts.Debug.assertNever(keywordFilter); } @@ -137362,59 +138569,61 @@ var ts; function isTypeScriptOnlyKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 92 /* SyntaxKind.EnumKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: case 117 /* SyntaxKind.ImplementsKeyword */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 139 /* SyntaxKind.IsKeyword */: - case 140 /* SyntaxKind.KeyOfKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 140 /* SyntaxKind.IsKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return true; default: return false; } } function isInterfaceOrTypeLiteralCompletionKeyword(kind) { - return kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return kind === 146 /* SyntaxKind.ReadonlyKeyword */; } function isClassMemberCompletionKeyword(kind) { switch (kind) { case 126 /* SyntaxKind.AbstractKeyword */: - case 134 /* SyntaxKind.ConstructorKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; default: return ts.isClassMemberModifier(kind); } } function isFunctionLikeBodyKeyword(kind) { - return kind === 131 /* SyntaxKind.AsyncKeyword */ - || kind === 132 /* SyntaxKind.AwaitKeyword */ - || kind === 127 /* SyntaxKind.AsKeyword */ - || kind === 152 /* SyntaxKind.TypeKeyword */ + return kind === 132 /* SyntaxKind.AsyncKeyword */ + || kind === 133 /* SyntaxKind.AwaitKeyword */ + || kind === 128 /* SyntaxKind.AsKeyword */ + || kind === 150 /* SyntaxKind.SatisfiesKeyword */ + || kind === 154 /* SyntaxKind.TypeKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind); } function keywordForNode(node) { @@ -137439,7 +138648,7 @@ var ts; && contextToken === parent.moduleSpecifier && tokenLine === currentLine) { entries.push({ - name: ts.tokenToString(129 /* SyntaxKind.AssertKeyword */), + name: ts.tokenToString(130 /* SyntaxKind.AssertKeyword */), kind: "keyword" /* ScriptElementKind.keyword */, kindModifiers: "" /* ScriptElementKindModifier.none */, sortText: Completions.SortText.GlobalsOrKeywords, @@ -137505,7 +138714,7 @@ var ts; function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location, position) { // class c { method() { } | method2() { } } switch (location.kind) { - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.tryCast(location.parent, ts.isObjectTypeDeclaration); case 1 /* SyntaxKind.EndOfFileToken */: var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration); @@ -137531,7 +138740,7 @@ var ts; if (!contextToken) return undefined; // class C { blah; constructor/**/ } and so on - if (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ + if (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ // class C { blah \n constructor/**/ } || (ts.isIdentifier(contextToken) && ts.isPropertyDeclaration(contextToken.parent) && ts.isClassLike(location))) { return ts.findAncestor(contextToken, ts.isClassLike); @@ -137574,7 +138783,7 @@ var ts; case 26 /* SyntaxKind.SemicolonToken */: case 27 /* SyntaxKind.CommaToken */: case 79 /* SyntaxKind.Identifier */: - if (parent.kind === 166 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { + if (parent.kind === 168 /* SyntaxKind.PropertySignature */ && ts.isTypeLiteralNode(parent.parent)) { return parent.parent; } break; @@ -137591,11 +138800,11 @@ var ts; if (!t) return undefined; switch (node.kind) { - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checker.getTypeOfPropertyOfContextualType(t, node.symbol.escapedName); - case 188 /* SyntaxKind.IntersectionType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 189 /* SyntaxKind.UnionType */: return t; } } @@ -137623,7 +138832,7 @@ var ts; ? !!ts.tryGetImportFromModuleSpecifier(contextToken) : contextToken.kind === 43 /* SyntaxKind.SlashToken */ && ts.isJsxClosingElement(contextToken.parent)); case " ": - return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 305 /* SyntaxKind.SourceFile */; + return !!contextToken && ts.isImportKeyword(contextToken) && contextToken.parent.kind === 308 /* SyntaxKind.SourceFile */; default: return ts.Debug.assertNever(triggerCharacter); } @@ -137670,21 +138879,22 @@ var ts; return undefined; } function getImportStatementCompletionInfo(contextToken) { + var _a, _b, _c; var keywordCompletion; var isKeywordOnlyCompletion = false; var candidate = getCandidate(); return { isKeywordOnlyCompletion: isKeywordOnlyCompletion, keywordCompletion: keywordCompletion, - isNewIdentifierLocation: !!(candidate || keywordCompletion === 152 /* SyntaxKind.TypeKeyword */), - replacementNode: candidate && ts.rangeIsOnSingleLine(candidate, candidate.getSourceFile()) - ? candidate - : undefined + isNewIdentifierLocation: !!(candidate || keywordCompletion === 154 /* SyntaxKind.TypeKeyword */), + isTopLevelTypeOnly: !!((_b = (_a = ts.tryCast(candidate, ts.isImportDeclaration)) === null || _a === void 0 ? void 0 : _a.importClause) === null || _b === void 0 ? void 0 : _b.isTypeOnly) || !!((_c = ts.tryCast(candidate, ts.isImportEqualsDeclaration)) === null || _c === void 0 ? void 0 : _c.isTypeOnly), + couldBeTypeOnlyImportSpecifier: !!candidate && couldBeTypeOnlyImportSpecifier(candidate, contextToken), + replacementSpan: getSingleLineReplacementSpanForImportCompletionNode(candidate), }; function getCandidate() { var parent = contextToken.parent; if (ts.isImportEqualsDeclaration(parent)) { - keywordCompletion = contextToken.kind === 152 /* SyntaxKind.TypeKeyword */ ? undefined : 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = contextToken.kind === 154 /* SyntaxKind.TypeKeyword */ ? undefined : 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleReference) ? parent : undefined; } if (couldBeTypeOnlyImportSpecifier(parent, contextToken) && canCompleteFromNamedBindings(parent.parent)) { @@ -137694,13 +138904,13 @@ var ts; if (!parent.parent.isTypeOnly && (contextToken.kind === 18 /* SyntaxKind.OpenBraceToken */ || contextToken.kind === 100 /* SyntaxKind.ImportKeyword */ || contextToken.kind === 27 /* SyntaxKind.CommaToken */)) { - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; } if (canCompleteFromNamedBindings(parent)) { // At `import { ... } |` or `import * as Foo |`, the only possible completion is `from` if (contextToken.kind === 19 /* SyntaxKind.CloseBraceToken */ || contextToken.kind === 79 /* SyntaxKind.Identifier */) { isKeywordOnlyCompletion = true; - keywordCompletion = 156 /* SyntaxKind.FromKeyword */; + keywordCompletion = 158 /* SyntaxKind.FromKeyword */; } else { return parent.parent.parent; @@ -137710,25 +138920,82 @@ var ts; } if (ts.isImportKeyword(contextToken) && ts.isSourceFile(parent)) { // A lone import keyword with nothing following it does not parse as a statement at all - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return contextToken; } if (ts.isImportKeyword(contextToken) && ts.isImportDeclaration(parent)) { // `import s| from` - keywordCompletion = 152 /* SyntaxKind.TypeKeyword */; + keywordCompletion = 154 /* SyntaxKind.TypeKeyword */; return isModuleSpecifierMissingOrEmpty(parent.moduleSpecifier) ? parent : undefined; } return undefined; } } + function getSingleLineReplacementSpanForImportCompletionNode(node) { + var _a, _b, _c; + if (!node) + return undefined; + var top = (_a = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration))) !== null && _a !== void 0 ? _a : node; + var sourceFile = top.getSourceFile(); + if (ts.rangeIsOnSingleLine(top, sourceFile)) { + return ts.createTextSpanFromNode(top, sourceFile); + } + // ImportKeyword was necessarily on one line; ImportSpecifier was necessarily parented in an ImportDeclaration + ts.Debug.assert(top.kind !== 100 /* SyntaxKind.ImportKeyword */ && top.kind !== 273 /* SyntaxKind.ImportSpecifier */); + // Guess which point in the import might actually be a later statement parsed as part of the import + // during parser recovery - either in the middle of named imports, or the module specifier. + var potentialSplitPoint = top.kind === 269 /* SyntaxKind.ImportDeclaration */ + ? (_c = getPotentiallyInvalidImportSpecifier((_b = top.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings)) !== null && _c !== void 0 ? _c : top.moduleSpecifier + : top.moduleReference; + var withoutModuleSpecifier = { + pos: top.getFirstToken().getStart(), + end: potentialSplitPoint.pos, + }; + // The module specifier/reference was previously found to be missing, empty, or + // not a string literal - in this last case, it's likely that statement on a following + // line was parsed as the module specifier of a partially-typed import, e.g. + // import Foo| + // interface Blah {} + // This appears to be a multiline-import, and editors can't replace multiple lines. + // But if everything but the "module specifier" is on one line, by this point we can + // assume that the "module specifier" is actually just another statement, and return + // the single-line range of the import excluding that probable statement. + if (ts.rangeIsOnSingleLine(withoutModuleSpecifier, sourceFile)) { + return ts.createTextSpanFromRange(withoutModuleSpecifier); + } + } + // Tries to identify the first named import that is not really a named import, but rather + // just parser recovery for a situation like: + // import { Foo| + // interface Bar {} + // in which `Foo`, `interface`, and `Bar` are all parsed as import specifiers. The caller + // will also check if this token is on a separate line from the rest of the import. + function getPotentiallyInvalidImportSpecifier(namedBindings) { + var _a; + return ts.find((_a = ts.tryCast(namedBindings, ts.isNamedImports)) === null || _a === void 0 ? void 0 : _a.elements, function (e) { + var _a; + return !e.propertyName && + ts.isStringANonContextualKeyword(e.name.text) && + ((_a = ts.findPrecedingToken(e.name.pos, namedBindings.getSourceFile(), namedBindings)) === null || _a === void 0 ? void 0 : _a.kind) !== 27 /* SyntaxKind.CommaToken */; + }); + } function couldBeTypeOnlyImportSpecifier(importSpecifier, contextToken) { return ts.isImportSpecifier(importSpecifier) && (importSpecifier.isTypeOnly || contextToken === importSpecifier.name && ts.isTypeKeywordTokenOrIdentifier(contextToken)); } function canCompleteFromNamedBindings(namedBindings) { - return isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) - && (ts.isNamespaceImport(namedBindings) || namedBindings.elements.length < 2) - && !namedBindings.parent.name; + if (!isModuleSpecifierMissingOrEmpty(namedBindings.parent.parent.moduleSpecifier) || namedBindings.parent.name) { + return false; + } + if (ts.isNamedImports(namedBindings)) { + // We can only complete on named imports if there are no other named imports already, + // but parser recovery sometimes puts later statements in the named imports list, so + // we try to only consider the probably-valid ones. + var invalidNamedImport = getPotentiallyInvalidImportSpecifier(namedBindings); + var validImports = invalidNamedImport ? namedBindings.elements.indexOf(invalidNamedImport) : namedBindings.elements.length; + return validImports < 2; + } + return true; } function isModuleSpecifierMissingOrEmpty(specifier) { var _a; @@ -137747,7 +139014,6 @@ var ts; function isArrowFunctionBody(node) { return node.parent && ts.isArrowFunction(node.parent) && node.parent.body === node; } - ; /** True if symbol is a type or a module containing at least one type. */ function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) { if (seenModules === void 0) { seenModules = new ts.Map(); } @@ -137896,14 +139162,14 @@ var ts; case 115 /* SyntaxKind.WhileKeyword */: case 90 /* SyntaxKind.DoKeyword */: return useParent(node.parent, function (n) { return ts.isIterationStatement(n, /*lookInLabeledStatements*/ true); }, getLoopBreakContinueOccurrences); - case 134 /* SyntaxKind.ConstructorKeyword */: - return getFromAllDeclarations(ts.isConstructorDeclaration, [134 /* SyntaxKind.ConstructorKeyword */]); - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: - return getFromAllDeclarations(ts.isAccessor, [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */]); - case 132 /* SyntaxKind.AwaitKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: + return getFromAllDeclarations(ts.isConstructorDeclaration, [135 /* SyntaxKind.ConstructorKeyword */]); + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: + return getFromAllDeclarations(ts.isAccessor, [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */]); + case 133 /* SyntaxKind.AwaitKeyword */: return useParent(node.parent, ts.isAwaitExpression, getAsyncAndAwaitOccurrences); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: return highlightSpans(getAsyncAndAwaitOccurrences(node)); case 125 /* SyntaxKind.YieldKeyword */: return highlightSpans(getYieldOccurrences(node)); @@ -137950,7 +139216,7 @@ var ts; var child = throwStatement; while (child.parent) { var parent = child.parent; - if (ts.isFunctionBlock(parent) || parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (ts.isFunctionBlock(parent) || parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } // A throw-statement is only owned by a try-statement if the try-statement has @@ -137982,16 +139248,16 @@ var ts; function getBreakOrContinueOwner(statement) { return ts.findAncestor(statement, function (node) { switch (node.kind) { - case 249 /* SyntaxKind.SwitchStatement */: - if (statement.kind === 245 /* SyntaxKind.ContinueStatement */) { + case 252 /* SyntaxKind.SwitchStatement */: + if (statement.kind === 248 /* SyntaxKind.ContinueStatement */) { return false; } // falls through - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return !statement.label || isLabeledBy(node, statement.label.escapedText); default: // Don't cross function boundaries. @@ -138007,26 +139273,26 @@ var ts; // Types of node whose children might have modifiers. var container = declaration.parent; switch (container.kind) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // Container is either a class declaration or the declaration is a classDeclaration - if (modifierFlag & 128 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { + if (modifierFlag & 256 /* ModifierFlags.Abstract */ && ts.isClassDeclaration(declaration)) { return __spreadArray(__spreadArray([], declaration.members, true), [declaration], false); } else { return container.statements; } - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return __spreadArray(__spreadArray([], container.parameters, true), (ts.isClassLike(container.parent) ? container.parent.members : []), true); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: var nodes = container.members; // If we're an accessibility modifier, we're in an instance member and should search // the constructor's parameter list for instance members as well. @@ -138036,12 +139302,12 @@ var ts; return __spreadArray(__spreadArray([], nodes, true), constructor.parameters, true); } } - else if (modifierFlag & 128 /* ModifierFlags.Abstract */) { + else if (modifierFlag & 256 /* ModifierFlags.Abstract */) { return __spreadArray(__spreadArray([], nodes, true), [container], false); } return nodes; // Syntactically invalid positions that the parser might produce anyway - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return undefined; default: ts.Debug.assertNever(container, "Invalid container kind."); @@ -138062,7 +139328,7 @@ var ts; var keywords = []; if (pushKeywordIf(keywords, loopNode.getFirstToken(), 97 /* SyntaxKind.ForKeyword */, 115 /* SyntaxKind.WhileKeyword */, 90 /* SyntaxKind.DoKeyword */)) { // If we succeeded and got a do-while loop, then start looking for a 'while' keyword. - if (loopNode.kind === 240 /* SyntaxKind.DoStatement */) { + if (loopNode.kind === 243 /* SyntaxKind.DoStatement */) { var loopTokens = loopNode.getChildren(); for (var i = loopTokens.length - 1; i >= 0; i--) { if (pushKeywordIf(keywords, loopTokens[i], 115 /* SyntaxKind.WhileKeyword */)) { @@ -138082,13 +139348,13 @@ var ts; var owner = getBreakOrContinueOwner(breakOrContinueStatement); if (owner) { switch (owner.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return getLoopBreakContinueOccurrences(owner); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return getSwitchCaseDefaultOccurrences(owner); } } @@ -138161,13 +139427,13 @@ var ts; var keywords = []; if (func.modifiers) { func.modifiers.forEach(function (modifier) { - pushKeywordIf(keywords, modifier, 131 /* SyntaxKind.AsyncKeyword */); + pushKeywordIf(keywords, modifier, 132 /* SyntaxKind.AsyncKeyword */); }); } ts.forEachChild(func, function (child) { traverseWithoutCrossingFunction(child, function (node) { if (ts.isAwaitExpression(node)) { - pushKeywordIf(keywords, node.getFirstToken(), 132 /* SyntaxKind.AwaitKeyword */); + pushKeywordIf(keywords, node.getFirstToken(), 133 /* SyntaxKind.AwaitKeyword */); } }); }); @@ -138551,14 +139817,14 @@ var ts; if (cancellationToken) cancellationToken.throwIfCancellationRequested(); switch (direct.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(direct)) { handleImportCall(direct); break; } if (!isAvailableThroughGlobal) { var parent = direct.parent; - if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (exportKind === 2 /* ExportKind.ExportEquals */ && parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { var name = parent.name; if (name.kind === 79 /* SyntaxKind.Identifier */) { directImports.push(name); @@ -138569,25 +139835,25 @@ var ts; break; case 79 /* SyntaxKind.Identifier */: // for 'const x = require("y"); break; // TODO: GH#23879 - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: handleNamespaceImport(direct, direct.name, ts.hasSyntacticModifier(direct, 1 /* ModifierFlags.Export */), /*alreadyAddedDirect*/ false); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: directImports.push(direct); var namedBindings = direct.importClause && direct.importClause.namedBindings; - if (namedBindings && namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings && namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { handleNamespaceImport(direct, namedBindings.name, /*isReExport*/ false, /*alreadyAddedDirect*/ true); } else if (!isAvailableThroughGlobal && ts.isDefaultImport(direct)) { addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); // Add a check for indirect uses to handle synthetic default imports } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (!direct.exportClause) { // This is `export * from "foo"`, so imports of this module may import the export too. handleDirectImports(getContainingModuleSymbol(direct, checker)); } - else if (direct.exportClause.kind === 274 /* SyntaxKind.NamespaceExport */) { + else if (direct.exportClause.kind === 277 /* SyntaxKind.NamespaceExport */) { // `export * as foo from "foo"` add to indirect uses addIndirectUser(getSourceFileLikeForImportDeclaration(direct), /** addTransitiveDependencies */ true); } @@ -138596,9 +139862,9 @@ var ts; directImports.push(direct); } break; - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: // Only check for typeof import('xyz') - if (direct.isTypeOf && !direct.qualifier && isExported(direct)) { + if (!isAvailableThroughGlobal && direct.isTypeOf && !direct.qualifier && isExported(direct)) { addIndirectUser(direct.getSourceFile(), /** addTransitiveDependencies */ true); } directImports.push(direct); @@ -138629,7 +139895,7 @@ var ts; } else if (!isAvailableThroughGlobal) { var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration); - ts.Debug.assert(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 261 /* SyntaxKind.ModuleDeclaration */); + ts.Debug.assert(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ || sourceFileLike.kind === 264 /* SyntaxKind.ModuleDeclaration */); if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) { addIndirectUser(sourceFileLike, /** addTransitiveDependencies */ true); } @@ -138685,7 +139951,7 @@ var ts; } return { importSearches: importSearches, singleReferences: singleReferences }; function handleImport(decl) { - if (decl.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (decl.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { if (isExternalModuleImportEquals(decl)) { handleNamespaceImportLike(decl.name); } @@ -138695,7 +139961,7 @@ var ts; handleNamespaceImportLike(decl); return; } - if (decl.kind === 200 /* SyntaxKind.ImportType */) { + if (decl.kind === 202 /* SyntaxKind.ImportType */) { if (decl.qualifier) { var firstIdentifier = ts.getFirstIdentifier(decl.qualifier); if (firstIdentifier.escapedText === ts.symbolName(exportSymbol)) { @@ -138711,7 +139977,7 @@ var ts; if (decl.moduleSpecifier.kind !== 10 /* SyntaxKind.StringLiteral */) { return; } - if (decl.kind === 272 /* SyntaxKind.ExportDeclaration */) { + if (decl.kind === 275 /* SyntaxKind.ExportDeclaration */) { if (decl.exportClause && ts.isNamedExports(decl.exportClause)) { searchForNamedImport(decl.exportClause); } @@ -138720,10 +139986,10 @@ var ts; var _a = decl.importClause || { name: undefined, namedBindings: undefined }, name = _a.name, namedBindings = _a.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: handleNamespaceImportLike(namedBindings.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: // 'default' might be accessed as a named import `{ default as foo }`. if (exportKind === 0 /* ExportKind.Named */ || exportKind === 1 /* ExportKind.Default */) { searchForNamedImport(namedBindings); @@ -138773,7 +140039,7 @@ var ts; } } else { - var localSymbol = element.kind === 275 /* SyntaxKind.ExportSpecifier */ && element.propertyName + var localSymbol = element.kind === 278 /* SyntaxKind.ExportSpecifier */ && element.propertyName ? checker.getExportSpecifierLocalTargetSymbol(element) // For re-exporting under a different name, we want to get the re-exported symbol. : checker.getSymbolAtLocation(name); addSearch(name, localSymbol); @@ -138802,7 +140068,7 @@ var ts; for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) { var referencingFile = sourceFiles_1[_i]; var searchSourceFile = searchModuleSymbol.valueDeclaration; - if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 305 /* SyntaxKind.SourceFile */) { + if ((searchSourceFile === null || searchSourceFile === void 0 ? void 0 : searchSourceFile.kind) === 308 /* SyntaxKind.SourceFile */) { for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) { var ref = _b[_a]; if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) { @@ -138850,7 +140116,7 @@ var ts; } /** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */ function forEachPossibleImportOrExportStatement(sourceFileLike, action) { - return ts.forEach(sourceFileLike.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { + return ts.forEach(sourceFileLike.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) { return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action)); }); } @@ -138865,15 +140131,15 @@ var ts; else { forEachPossibleImportOrExportStatement(sourceFile, function (statement) { switch (statement.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: { var decl = statement; if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) { action(decl, decl.moduleSpecifier); } break; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { var decl = statement; if (isExternalModuleImportEquals(decl)) { action(decl, decl.moduleReference.expression); @@ -138898,7 +140164,7 @@ var ts; var parent = node.parent; var grandparent = parent.parent; if (symbol.exportSymbol) { - if (parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { // When accessing an export of a JS module, there's no alias. The symbol will still be flagged as an export even though we're at the use. // So check that we are at the declaration. return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === parent; })) && ts.isBinaryExpression(grandparent) @@ -138982,6 +140248,8 @@ var ts; // Similarly, skip past the symbol for 'export =' if (importedSymbol.escapedName === "export=") { importedSymbol = getExportEqualsLocalSymbol(importedSymbol, checker); + if (importedSymbol === undefined) + return undefined; } // If the import has a different name than the export, do not continue searching. // If `importedName` is undefined, do continue searching as the export is anonymous. @@ -138997,25 +140265,25 @@ var ts; } // Not meant for use with export specifiers or export assignment. function getExportKindForDeclaration(node) { - return ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; + return ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? 1 /* ExportKind.Default */ : 0 /* ExportKind.Named */; } } FindAllReferences.getImportOrExportSymbol = getImportOrExportSymbol; function getExportEqualsLocalSymbol(importedSymbol, checker) { if (importedSymbol.flags & 2097152 /* SymbolFlags.Alias */) { - return ts.Debug.checkDefined(checker.getImmediateAliasedSymbol(importedSymbol)); + return checker.getImmediateAliasedSymbol(importedSymbol); } var decl = ts.Debug.checkDefined(importedSymbol.valueDeclaration); if (ts.isExportAssignment(decl)) { // `export = class {}` - return ts.Debug.checkDefined(decl.expression.symbol); + return decl.expression.symbol; } else if (ts.isBinaryExpression(decl)) { // `module.exports = class {}` - return ts.Debug.checkDefined(decl.right.symbol); + return decl.right.symbol; } else if (ts.isSourceFile(decl)) { // json module - return ts.Debug.checkDefined(decl.symbol); + return decl.symbol; } - return ts.Debug.fail(); + return undefined; } // If a reference is a class expression, the exported node would be its parent. // If a reference is a variable declaration, the exported node would be the variable statement. @@ -139032,16 +140300,16 @@ var ts; function isNodeImport(node) { var parent = node.parent; switch (parent.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return parent.name === node && isExternalModuleImportEquals(parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: // For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`. return !parent.propertyName; - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: ts.Debug.assert(parent.name === node); return true; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(parent.parent.parent); default: return false; @@ -139082,21 +140350,21 @@ var ts; return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol); } function getSourceFileLikeForImportDeclaration(node) { - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { return node.getSourceFile(); } var parent = node.parent; - if (parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */) { return parent; } - ts.Debug.assert(parent.kind === 262 /* SyntaxKind.ModuleBlock */); + ts.Debug.assert(parent.kind === 265 /* SyntaxKind.ModuleBlock */); return ts.cast(parent.parent, isAmbientModuleDeclaration); } function isAmbientModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && node.name.kind === 10 /* SyntaxKind.StringLiteral */; } function isExternalModuleImportEquals(eq) { - return eq.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; + return eq.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* SyntaxKind.StringLiteral */; } })(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {})); })(ts || (ts = {})); @@ -139190,7 +140458,7 @@ var ts; ((ts.isImportOrExportSpecifier(node.parent) || ts.isBindingElement(node.parent)) && node.parent.propertyName === node) || // Is default export - (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 513 /* ModifierFlags.ExportDefault */))) { + (node.kind === 88 /* SyntaxKind.DefaultKeyword */ && ts.hasSyntacticModifier(node.parent, 1025 /* ModifierFlags.ExportDefault */))) { return getContextNode(node.parent); } return undefined; @@ -139199,7 +140467,7 @@ var ts; if (!node) return undefined; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !ts.isVariableDeclarationList(node.parent) || node.parent.declarations.length !== 1 ? node : ts.isVariableStatement(node.parent.parent) ? @@ -139207,28 +140475,28 @@ var ts; ts.isForInOrOfStatement(node.parent.parent) ? getContextNode(node.parent.parent) : node.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextNode(node.parent.parent); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; - case 275 /* SyntaxKind.ExportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 267 /* SyntaxKind.ImportClause */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ts.isExpressionStatement(node.parent) ? node.parent : node; - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return { start: node.initializer, end: node.expression }; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent) ? getContextNode(ts.findAncestor(node.parent, function (node) { return ts.isBinaryExpression(node) || ts.isForInOrOfStatement(node); @@ -139289,15 +140557,15 @@ var ts; return node.kind === 88 /* SyntaxKind.DefaultKeyword */ || !!ts.getDeclarationFromName(node) || ts.isLiteralComputedPropertyDeclarationName(node) - || (node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); + || (node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent)); } function getImplementationsAtPosition(program, cancellationToken, sourceFiles, sourceFile, position) { var node = ts.getTouchingPropertyName(sourceFile, position); var referenceEntries; var entries = getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position); - if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || node.parent.kind === 203 /* SyntaxKind.BindingElement */ - || node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ + if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || node.parent.kind === 205 /* SyntaxKind.BindingElement */ + || node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ || node.kind === 106 /* SyntaxKind.SuperKeyword */) { referenceEntries = entries && __spreadArray([], entries, true); } @@ -139321,13 +140589,13 @@ var ts; } FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition; function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return undefined; } var checker = program.getTypeChecker(); // If invoked directly on a shorthand property assignment, then return // the declaration of the symbol being assigned (not the symbol being assigned to). - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var result_2 = []; Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_2.push(nodeEntry(node)); }); return result_2; @@ -139503,13 +140771,13 @@ var ts; if (symbol) { return getDefinitionKindAndDisplayParts(symbol, checker, node); } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return { kind: "interface" /* ScriptElementKind.interfaceElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] }; } - else if (node.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (node.kind === 228 /* SyntaxKind.ClassExpression */) { return { kind: "local class" /* ScriptElementKind.localClassElement */, displayParts: [ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)] @@ -139563,7 +140831,7 @@ var ts; var source = ts.getDeclarationFromName(node) || (node.kind === 88 /* SyntaxKind.DefaultKeyword */ ? node.parent : ts.isLiteralComputedPropertyDeclarationName(node) ? node.parent.parent - : node.kind === 134 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent + : node.kind === 135 /* SyntaxKind.ConstructorKeyword */ && ts.isConstructorDeclaration(node.parent) ? node.parent.parent : undefined); var commonjsSource = source && ts.isBinaryExpression(source) ? source.left : undefined; return !!(source && ((_a = target.declarations) === null || _a === void 0 ? void 0 : _a.some(function (d) { return d === source || d === commonjsSource; }))); @@ -139578,47 +140846,47 @@ var ts; if (!!(decl.flags & 16777216 /* NodeFlags.Ambient */)) return true; switch (decl.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: case 88 /* SyntaxKind.DefaultKeyword */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: // default import - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 285 /* SyntaxKind.JsxAttribute */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 274 /* SyntaxKind.NamespaceExport */: - case 164 /* SyntaxKind.Parameter */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: // default import + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 288 /* SyntaxKind.JsxAttribute */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 277 /* SyntaxKind.NamespaceExport */: + case 166 /* SyntaxKind.Parameter */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // In `({ x: y } = 0);`, `x` is not a write access. (Won't call this function for `y`.) return !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(decl.parent); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return !!decl.body; - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return !!decl.initializer || ts.isCatchClause(decl.parent); - case 168 /* SyntaxKind.MethodSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 170 /* SyntaxKind.MethodSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return false; default: return ts.Debug.failBadSyntaxKind(decl); @@ -139844,10 +141112,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; switch (decl.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.) break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (sourceFilesSet.has(decl.getSourceFile().fileName)) { references.push(nodeEntry(decl.name)); } @@ -139876,9 +141144,9 @@ var ts; } /** As in a `readonly prop: any` or `constructor(readonly prop: any)`, not a `readonly any[]`. */ function isReadonlyTypeOperator(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && ts.isTypeOperatorNode(node.parent) - && node.parent.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + && node.parent.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } /** getReferencedSymbols for special node kinds. */ function getReferencedSymbolsSpecial(node, sourceFiles, cancellationToken) { @@ -139889,12 +141157,12 @@ var ts; } // A modifier readonly (like on a property declaration) is not special; // a readonly type keyword (like `readonly string[]`) is. - if (node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { + if (node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ && !isReadonlyTypeOperator(node)) { return undefined; } // Likewise, when we *are* looking for a special keyword, make sure we // *don’t* include readonly member modifiers. - return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 145 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); + return getAllReferencesForKeyword(sourceFiles, node.kind, cancellationToken, node.kind === 146 /* SyntaxKind.ReadonlyKeyword */ ? isReadonlyTypeOperator : undefined); } if (ts.isImportMeta(node.parent) && node.parent.name === node) { return getAllReferencesForImportMeta(sourceFiles, cancellationToken); @@ -139961,8 +141229,8 @@ var ts; } function getSpecialSearchKind(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 134 /* SyntaxKind.ConstructorKeyword */: + case 173 /* SyntaxKind.Constructor */: + case 135 /* SyntaxKind.ConstructorKeyword */: return 1 /* SpecialSearchKind.Constructor */; case 79 /* SyntaxKind.Identifier */: if (ts.isClassLike(node.parent)) { @@ -140210,7 +141478,7 @@ var ts; // If this is the symbol of a named function expression or named class expression, // then named references are limited to its own scope. var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration; - if (valueDeclaration && (valueDeclaration.kind === 213 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 226 /* SyntaxKind.ClassExpression */)) { + if (valueDeclaration && (valueDeclaration.kind === 215 /* SyntaxKind.FunctionExpression */ || valueDeclaration.kind === 228 /* SyntaxKind.ClassExpression */)) { return valueDeclaration; } if (!declarations) { @@ -140220,7 +141488,7 @@ var ts; if (flags & (4 /* SymbolFlags.Property */ | 8192 /* SymbolFlags.Method */)) { var privateDeclaration = ts.find(declarations, function (d) { return ts.hasEffectiveModifier(d, 8 /* ModifierFlags.Private */) || ts.isPrivateIdentifierClassElementDeclaration(d); }); if (privateDeclaration) { - return ts.getAncestor(privateDeclaration, 257 /* SyntaxKind.ClassDeclaration */); + return ts.getAncestor(privateDeclaration, 260 /* SyntaxKind.ClassDeclaration */); } // Else this is a public property and could be accessed from anywhere. return undefined; @@ -140249,7 +141517,7 @@ var ts; // Different declarations have different containers, bail out return undefined; } - if (!container || container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { + if (!container || container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(container)) { // This is a global variable and not an external module, any declaration defined // within this scope is visible outside the file return undefined; @@ -140507,7 +141775,7 @@ var ts; } // Use the parent symbol if the location is commonjs require syntax on javascript files only. if (ts.isInJSFile(referenceLocation) - && referenceLocation.parent.kind === 203 /* SyntaxKind.BindingElement */ + && referenceLocation.parent.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(referenceLocation.parent.parent.parent)) { referenceSymbol = referenceLocation.parent.symbol; // The parent will not have a symbol if it's an ObjectBindingPattern (when destructuring is used). In @@ -140614,7 +141882,7 @@ var ts; } } function addReference(referenceLocation, relatedSymbol, state) { - var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line no-in-operator + var _a = "kind" in relatedSymbol ? relatedSymbol : { kind: undefined, symbol: relatedSymbol }, kind = _a.kind, symbol = _a.symbol; // eslint-disable-line local/no-in-operator // if rename symbol from default export anonymous function, for example `export default function() {}`, we do not need to add reference if (state.options.use === 2 /* FindReferencesUse.Rename */ && referenceLocation.kind === 88 /* SyntaxKind.DefaultKeyword */) { return; @@ -140680,15 +141948,15 @@ var ts; if (constructorSymbol && constructorSymbol.declarations) { for (var _i = 0, _a = constructorSymbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - var ctrKeyword = ts.findChildOfKind(decl, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */ && !!ctrKeyword); + var ctrKeyword = ts.findChildOfKind(decl, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */ && !!ctrKeyword); addNode(ctrKeyword); } } if (classSymbol.exports) { classSymbol.exports.forEach(function (member) { var decl = member.valueDeclaration; - if (decl && decl.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (decl && decl.kind === 171 /* SyntaxKind.MethodDeclaration */) { var body = decl.body; if (body) { forEachDescendantOfKind(body, 108 /* SyntaxKind.ThisKeyword */, function (thisKeyword) { @@ -140712,7 +141980,7 @@ var ts; } for (var _i = 0, _a = constructor.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - ts.Debug.assert(decl.kind === 171 /* SyntaxKind.Constructor */); + ts.Debug.assert(decl.kind === 173 /* SyntaxKind.Constructor */); var body = decl.body; if (body) { forEachDescendantOfKind(body, 106 /* SyntaxKind.SuperKeyword */, function (node) { @@ -140742,7 +142010,7 @@ var ts; if (refNode.kind !== 79 /* SyntaxKind.Identifier */) { return; } - if (refNode.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (refNode.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { // Go ahead and dereference the shorthand assignment by going to its definition getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference); } @@ -140762,7 +142030,7 @@ var ts; } else if (ts.isFunctionLike(typeHavingNode) && typeHavingNode.body) { var body = typeHavingNode.body; - if (body.kind === 235 /* SyntaxKind.Block */) { + if (body.kind === 238 /* SyntaxKind.Block */) { ts.forEachReturnStatement(body, function (returnStatement) { if (returnStatement.expression) addIfImplementation(returnStatement.expression); @@ -140790,13 +142058,13 @@ var ts; */ function isImplementationExpression(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isImplementationExpression(node.expression); - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; default: return false; @@ -140849,13 +142117,13 @@ var ts; // Whether 'super' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; @@ -140876,43 +142144,43 @@ var ts; return [{ definition: { type: 0 /* DefinitionKind.Symbol */, symbol: searchSpaceNode.symbol }, references: references }]; } function isParameterName(node) { - return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 164 /* SyntaxKind.Parameter */ && node.parent.name === node; + return node.kind === 79 /* SyntaxKind.Identifier */ && node.parent.kind === 166 /* SyntaxKind.Parameter */ && node.parent.name === node; } function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) { var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false); // Whether 'this' occurs in a static context within a class. var staticFlag = 32 /* ModifierFlags.Static */; switch (searchSpaceNode.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isObjectLiteralMethod(searchSpaceNode)) { staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning object literals break; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: staticFlag &= ts.getSyntacticModifierFlags(searchSpaceNode); searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) { return undefined; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: break; // Computed properties in classes are not handled here because references to this are illegal, // so there is no point finding references to them. default: return undefined; } - var references = ts.flatMap(searchSpaceNode.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { + var references = ts.flatMap(searchSpaceNode.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) { cancellationToken.throwIfCancellationRequested(); return getPossibleSymbolReferenceNodes(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(function (node) { if (!ts.isThis(node)) { @@ -140920,20 +142188,20 @@ var ts; } var container = ts.getThisContainer(node, /* includeArrowFunctions */ false); switch (searchSpaceNode.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return searchSpaceNode.symbol === container.symbol; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol; - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // Make sure the container belongs to the same class/object literals // and has the appropriate static modifier from the original container. return container.parent && searchSpaceNode.symbol === container.parent.symbol && ts.isStatic(container) === !!staticFlag; - case 305 /* SyntaxKind.SourceFile */: - return container.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); + case 308 /* SyntaxKind.SourceFile */: + return container.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node); } }); }).map(function (n) { return nodeEntry(n); }); @@ -141044,7 +142312,7 @@ var ts; ts.Debug.assert(paramProps.length === 2 && !!(paramProps[0].flags & 1 /* SymbolFlags.FunctionScopedVariable */) && !!(paramProps[1].flags & 4 /* SymbolFlags.Property */)); // is [parameter, property] return fromRoot(symbol.flags & 1 /* SymbolFlags.FunctionScopedVariable */ ? paramProps[1] : paramProps[0]); } - var exportSpecifier = ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */); + var exportSpecifier = ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */); if (!isForRenamePopulateSearchSymbolSet || exportSpecifier && !exportSpecifier.propertyName) { var localSymbol = exportSpecifier && checker.getExportSpecifierLocalTargetSymbol(exportSpecifier); if (localSymbol) { @@ -141089,7 +142357,7 @@ var ts; }); } function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) { - var bindingElement = ts.getDeclarationOfKind(symbol, 203 /* SyntaxKind.BindingElement */); + var bindingElement = ts.getDeclarationOfKind(symbol, 205 /* SyntaxKind.BindingElement */); if (bindingElement && ts.isObjectBindingElementWithoutPropertyName(bindingElement)) { return ts.getPropertySymbolFromBindingElement(checker, bindingElement); } @@ -141352,16 +142620,16 @@ var ts; return; } switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return (_a = ts.getAssignedName(node.parent)) === null || _a === void 0 ? void 0 : _a.getText(); } return (_b = ts.getNameOfDeclaration(node.parent)) === null || _b === void 0 ? void 0 : _b.getText(); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.isModuleBlock(node.parent) && ts.isIdentifier(node.parent.parent.name)) { return node.parent.parent.name.getText(); } @@ -141576,61 +142844,65 @@ var ts; } switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // do not descend into nodes that cannot contain callable nodes return; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: recordCallSite(node); return; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // do not descend into the type side of an assertion collect(node.expression); return; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: // do not descend into the type of a variable or parameter declaration collect(node.name); collect(node.initializer); return; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: // do not descend into the type arguments of a call expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: // do not descend into the type arguments of a new expression recordCallSite(node); collect(node.expression); ts.forEach(node.arguments, collect); return; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // do not descend into the type arguments of a tagged template expression recordCallSite(node); collect(node.tag); collect(node.template); return; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // do not descend into the type arguments of a JsxOpeningLikeElement recordCallSite(node); collect(node.tagName); collect(node.attributes); return; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: recordCallSite(node); collect(node.expression); return; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: recordCallSite(node); ts.forEachChild(node, collect); break; + case 235 /* SyntaxKind.SatisfiesExpression */: + // do not descend into the type side of an assertion + collect(node.expression); + return; } if (ts.isPartOfTypeNode(node)) { // do not descend into types @@ -141685,25 +142957,25 @@ var ts; var callSites = []; var collect = createCallSiteCollector(program, callSites); switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: collectCallSitesOfSourceFile(node, collect); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: collectCallSitesOfModuleDeclaration(node, collect); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: collectCallSitesOfFunctionLikeDeclaration(program.getTypeChecker(), node, collect); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: collectCallSitesOfClassLikeDeclaration(node, collect); break; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: collectCallSitesOfClassStaticBlockDeclaration(node, collect); break; default: @@ -141974,7 +143246,7 @@ var ts; } var parent = node.parent; var typeChecker = program.getTypeChecker(); - if (node.kind === 159 /* SyntaxKind.OverrideKeyword */ || (ts.isIdentifier(node) && ts.isJSDocOverrideTag(parent) && parent.tagName === node)) { + if (node.kind === 161 /* SyntaxKind.OverrideKeyword */ || (ts.isIdentifier(node) && ts.isJSDocOverrideTag(parent) && parent.tagName === node)) { return getDefinitionFromOverriddenMember(typeChecker, node) || ts.emptyArray; } // Labels @@ -141982,6 +143254,12 @@ var ts; var label = ts.getTargetLabel(node.parent, node.text); return label ? [createDefinitionInfoFromName(typeChecker, label, "label" /* ScriptElementKind.label */, node.text, /*containerName*/ undefined)] : undefined; // TODO: GH#18217 } + if (node.kind === 105 /* SyntaxKind.ReturnKeyword */) { + var functionDeclaration = ts.findAncestor(node.parent, function (n) { + return ts.isClassStaticBlockDeclaration(n) ? "quit" : ts.isFunctionLikeDeclaration(n); + }); + return functionDeclaration ? [createDefinitionFromSignatureDeclaration(typeChecker, functionDeclaration)] : undefined; + } if (ts.isStaticModifier(node) && ts.isClassStaticBlockDeclaration(node.parent)) { var classDecl = node.parent.parent; var _c = getSymbol(classDecl, typeChecker, stopAtAlias), symbol_1 = _c.symbol, failedAliasResolution_1 = _c.failedAliasResolution; @@ -142050,7 +143328,7 @@ var ts; // go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition // is performed at the location of property access, we would like to go to definition of the property in the short-hand // assignment. This case and others are handled by the following code. - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration); var definitions = (shorthandSymbol_1 === null || shorthandSymbol_1 === void 0 ? void 0 : shorthandSymbol_1.declarations) ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node, /*unverified*/ false, failedAliasResolution); }) : ts.emptyArray; return ts.concatenate(definitions, getDefinitionFromObjectLiteralElement(typeChecker, node) || ts.emptyArray); @@ -142117,13 +143395,16 @@ var ts; if (!baseDeclaration) return; var baseTypeNode = ts.getEffectiveBaseTypeNode(baseDeclaration); - var baseType = baseTypeNode ? typeChecker.getTypeAtLocation(baseTypeNode) : undefined; - if (!baseType) + if (!baseTypeNode) + return; + var expression = ts.skipParentheses(baseTypeNode.expression); + var base = ts.isClassExpression(expression) ? expression.symbol : typeChecker.getSymbolAtLocation(expression); + if (!base) return; var name = ts.unescapeLeadingUnderscores(ts.getTextOfPropertyName(classElement.name)); var symbol = ts.hasStaticModifier(classElement) - ? typeChecker.getPropertyOfType(typeChecker.getTypeOfSymbolAtLocation(baseType.symbol, baseDeclaration), name) - : typeChecker.getPropertyOfType(baseType, name); + ? typeChecker.getPropertyOfType(typeChecker.getTypeOfSymbol(base), name) + : typeChecker.getPropertyOfType(typeChecker.getDeclaredTypeOfSymbol(base), name); if (!symbol) return; return getDefinitionFromSymbol(typeChecker, symbol, node); @@ -142256,7 +143537,7 @@ var ts; if (node.parent === declaration) { return true; } - if (declaration.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (declaration.kind === 271 /* SyntaxKind.NamespaceImport */) { return false; } return true; @@ -142298,7 +143579,7 @@ var ts; function getConstructSignatureDefinition() { // Applicable only if we are in a new expression, or we are on a constructor declaration // and in either case the symbol has a construct signature definition, i.e. class - if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 134 /* SyntaxKind.ConstructorKeyword */)) { + if (symbol.flags & 32 /* SymbolFlags.Class */ && !(symbol.flags & (16 /* SymbolFlags.Function */ | 3 /* SymbolFlags.Variable */)) && (ts.isNewExpressionTarget(node) || node.kind === 135 /* SyntaxKind.ConstructorKeyword */)) { var cls = ts.find(filteredDeclarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration"); return getSignatureDefinition(cls.members, /*selectConstructors*/ true); } @@ -142350,22 +143631,22 @@ var ts; return isDefinitionVisible(checker, declaration.parent); // Handle some exceptions here like arrow function, members of class and object literal expression which are technically not visible but we want the definition to be determined by its parent switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // Private/protected properties/methods are not visible if (ts.hasEffectiveModifier(declaration, 8 /* ModifierFlags.Private */)) return false; // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: return isDefinitionVisible(checker, declaration.parent); default: return false; @@ -142403,9 +143684,9 @@ var ts; } function isConstructorLike(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return true; default: return false; @@ -142511,17 +143792,17 @@ var ts; ts.forEachUnique(declarations, function (declaration) { for (var _i = 0, _a = getCommentHavingNodes(declaration); _i < _a.length; _i++) { var jsdoc = _a[_i]; - var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 327 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); + var inheritDoc = ts.isJSDoc(jsdoc) && jsdoc.tags && ts.find(jsdoc.tags, function (t) { return t.kind === 330 /* SyntaxKind.JSDocTag */ && (t.tagName.escapedText === "inheritDoc" || t.tagName.escapedText === "inheritdoc"); }); // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @typedefs are themselves declarations with associated comments // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation if (jsdoc.comment === undefined && !inheritDoc || ts.isJSDoc(jsdoc) - && declaration.kind !== 345 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 338 /* SyntaxKind.JSDocCallbackTag */ + && declaration.kind !== 348 /* SyntaxKind.JSDocTypedefTag */ && declaration.kind !== 341 /* SyntaxKind.JSDocCallbackTag */ && jsdoc.tags - && jsdoc.tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !jsdoc.tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + && jsdoc.tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !jsdoc.tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { continue; } var newparts = jsdoc.comment ? getDisplayPartsFromComment(jsdoc.comment, checker) : []; @@ -142541,11 +143822,11 @@ var ts; } function getCommentHavingNodes(declaration) { switch (declaration.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return [declaration]; - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return [declaration, declaration.parent]; default: return ts.getJSDocCommentsAndTags(declaration); @@ -142559,8 +143840,8 @@ var ts; // skip comments containing @typedefs since they're not associated with particular declarations // Exceptions: // - @param or @return indicate that the author thinks of it as a 'local' @typedef that's part of the function documentation - if (tags.some(function (t) { return t.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 338 /* SyntaxKind.JSDocCallbackTag */; }) - && !tags.some(function (t) { return t.kind === 340 /* SyntaxKind.JSDocParameterTag */ || t.kind === 341 /* SyntaxKind.JSDocReturnTag */; })) { + if (tags.some(function (t) { return t.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || t.kind === 341 /* SyntaxKind.JSDocCallbackTag */; }) + && !tags.some(function (t) { return t.kind === 343 /* SyntaxKind.JSDocParameterTag */ || t.kind === 344 /* SyntaxKind.JSDocReturnTag */; })) { return; } for (var _i = 0, tags_1 = tags; _i < tags_1.length; _i++) { @@ -142575,17 +143856,17 @@ var ts; if (typeof comment === "string") { return [ts.textPart(comment)]; } - return ts.flatMap(comment, function (node) { return node.kind === 321 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); + return ts.flatMap(comment, function (node) { return node.kind === 324 /* SyntaxKind.JSDocText */ ? [ts.textPart(node.text)] : ts.buildLinkParts(node, checker); }); } function getCommentDisplayParts(tag, checker) { var comment = tag.comment, kind = tag.kind; var namePart = getTagNameDisplayPart(kind); switch (kind) { - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return withNode(tag.class); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return withNode(tag.class); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: var templateTag = tag; var displayParts_3 = []; if (templateTag.constraint) { @@ -142607,13 +143888,13 @@ var ts; displayParts_3.push.apply(displayParts_3, __spreadArray([ts.spacePart()], getDisplayPartsFromComment(comment, checker), true)); } return displayParts_3; - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return withNode(tag.typeExpression); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: - case 346 /* SyntaxKind.JSDocSeeTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: var name = tag.name; return name ? withNode(name) : comment === undefined ? undefined @@ -142640,14 +143921,14 @@ var ts; } function getTagNameDisplayPart(kind) { switch (kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return ts.parameterNamePart; - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return ts.propertyNamePart; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return ts.typeParameterNamePart; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return ts.typeAliasNamePart; default: return ts.textPart; @@ -142818,43 +144099,48 @@ var ts; } function getCommentOwnerInfoWorker(commentOwner, options) { switch (commentOwner.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: var host = commentOwner; return { commentOwner: commentOwner, parameters: host.parameters, hasReturn: hasReturn(host, options) }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getCommentOwnerInfoWorker(commentOwner.initializer, options); - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return { commentOwner: commentOwner }; - case 237 /* SyntaxKind.VariableStatement */: { + case 168 /* SyntaxKind.PropertySignature */: { + var host_1 = commentOwner; + return host_1.type && ts.isFunctionTypeNode(host_1.type) + ? { commentOwner: commentOwner, parameters: host_1.type.parameters, hasReturn: hasReturn(host_1.type, options) } + : { commentOwner: commentOwner }; + } + case 240 /* SyntaxKind.VariableStatement */: { var varStatement = commentOwner; var varDeclarations = varStatement.declarationList.declarations; - var host_1 = varDeclarations.length === 1 && varDeclarations[0].initializer + var host_2 = varDeclarations.length === 1 && varDeclarations[0].initializer ? getRightHandSideOfAssignment(varDeclarations[0].initializer) : undefined; - return host_1 - ? { commentOwner: commentOwner, parameters: host_1.parameters, hasReturn: hasReturn(host_1, options) } + return host_2 + ? { commentOwner: commentOwner, parameters: host_2.parameters, hasReturn: hasReturn(host_2, options) } : { commentOwner: commentOwner }; } - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return "quit"; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // If in walking up the tree, we hit a a nested namespace declaration, // then we must be somewhere within a dotted namespace name; however we don't // want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'. - return commentOwner.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; - case 238 /* SyntaxKind.ExpressionStatement */: + return commentOwner.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? undefined : { commentOwner: commentOwner }; + case 241 /* SyntaxKind.ExpressionStatement */: return getCommentOwnerInfoWorker(commentOwner.expression, options); - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var be = commentOwner; if (ts.getAssignmentDeclarationKind(be) === 0 /* AssignmentDeclarationKind.None */) { return "quit"; @@ -142863,7 +144149,7 @@ var ts; ? { commentOwner: commentOwner, parameters: be.right.parameters, hasReturn: hasReturn(be.right, options) } : { commentOwner: commentOwner }; } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: var init = commentOwner.initializer; if (init && (ts.isFunctionExpression(init) || ts.isArrowFunction(init))) { return { commentOwner: commentOwner, parameters: init.parameters, hasReturn: hasReturn(init, options) }; @@ -142872,18 +144158,18 @@ var ts; } function hasReturn(node, options) { return !!(options === null || options === void 0 ? void 0 : options.generateReturnInDocTemplate) && - (ts.isArrowFunction(node) && ts.isExpression(node.body) + (ts.isFunctionTypeNode(node) || ts.isArrowFunction(node) && ts.isExpression(node.body) || ts.isFunctionLikeDeclaration(node) && node.body && ts.isBlock(node.body) && !!ts.forEachReturnStatement(node.body, function (n) { return n; })); } function getRightHandSideOfAssignment(rightHandSide) { - while (rightHandSide.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (rightHandSide.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { rightHandSide = rightHandSide.expression; } switch (rightHandSide.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return rightHandSide; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return ts.find(rightHandSide.members, ts.isConstructorDeclaration); } } @@ -142942,9 +144228,9 @@ var ts; } function shouldKeepItem(declaration, checker) { switch (declaration.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var importer = checker.getSymbolAtLocation(declaration.name); // TODO: GH#18217 var imported = checker.getAliasedSymbol(importer); return importer.escapedName !== imported.escapedName; @@ -142954,7 +144240,7 @@ var ts; } function tryAddSingleDeclarationName(declaration, containers) { var name = ts.getNameOfDeclaration(declaration); - return !!name && (pushLiteral(name, containers) || name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); + return !!name && (pushLiteral(name, containers) || name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers)); } // Only added the names of computed properties if they're simple dotted expressions, like: // @@ -142971,7 +144257,7 @@ var ts; // First, if we started with a computed property name, then add all but the last // portion into the container array. var name = ts.getNameOfDeclaration(declaration); - if (name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { + if (name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) { return ts.emptyArray; } // Don't include the last portion. @@ -143188,7 +144474,7 @@ var ts; */ function hasNavigationBarName(node) { return !ts.hasDynamicName(node) || - (node.kind !== 221 /* SyntaxKind.BinaryExpression */ && + (node.kind !== 223 /* SyntaxKind.BinaryExpression */ && ts.isPropertyAccessExpression(node.name.expression) && ts.isIdentifier(node.name.expression.expression) && ts.idText(node.name.expression.expression) === "Symbol"); @@ -143201,7 +144487,7 @@ var ts; return; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Get parameter properties, and treat them as being on the *same* level as the constructor, not under it. var ctr = node; addNodeWithRecursiveChild(ctr, ctr.body); @@ -143213,25 +144499,25 @@ var ts; } } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 170 /* SyntaxKind.MethodSignature */: if (hasNavigationBarName(node)) { addNodeWithRecursiveChild(node, node.body); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (hasNavigationBarName(node)) { addNodeWithRecursiveInitializer(node); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (hasNavigationBarName(node)) { addLeafNode(node); } break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: var importClause = node; // Handle default import case e.g.: // import d from "mod"; @@ -143243,7 +144529,7 @@ var ts; // import {a, b as B} from "mod"; var namedBindings = importClause.namedBindings; if (namedBindings) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addLeafNode(namedBindings); } else { @@ -143254,17 +144540,17 @@ var ts; } } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: addNodeWithRecursiveChild(node, node.name); break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: var expression = node.expression; // Use the expression as the name of the SpreadAssignment, otherwise show as . ts.isIdentifier(expression) ? addLeafNode(node, expression) : addLeafNode(node); break; - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: { + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: { var child = node; if (ts.isBindingPattern(child.name)) { addChildrenRecursively(child.name); @@ -143274,7 +144560,7 @@ var ts; } break; } - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: var nameNode = node.name; // If we see a function declaration track as a possible ES5 class if (nameNode && ts.isIdentifier(nameNode)) { @@ -143282,11 +144568,11 @@ var ts; } addNodeWithRecursiveChild(node, node.body); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: addNodeWithRecursiveChild(node, node.body); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: startNode(node); for (var _e = 0, _f = node.members; _e < _f.length; _e++) { var member = _f[_e]; @@ -143296,9 +144582,9 @@ var ts; } endNode(); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: startNode(node); for (var _g = 0, _h = node.members; _g < _h.length; _g++) { var member = _h[_g]; @@ -143306,10 +144592,10 @@ var ts; } endNode(); break; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: addNodeWithRecursiveChild(node, getInteriorModule(node).body); break; - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression_1 = node.expression; var child = ts.isObjectLiteralExpression(expression_1) || ts.isCallExpression(expression_1) ? expression_1 : ts.isArrowFunction(expression_1) || ts.isFunctionExpression(expression_1) ? expression_1.body : undefined; @@ -143323,16 +144609,16 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 176 /* SyntaxKind.IndexSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: addLeafNode(node); break; - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var special = ts.getAssignmentDeclarationKind(node); switch (special) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -143572,12 +144858,12 @@ var ts; return false; } switch (a.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.isStatic(a) === ts.isStatic(b); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return areSameModule(a, b) && getFullyQualifiedModuleName(a) === getFullyQualifiedModuleName(b); default: @@ -143599,7 +144885,7 @@ var ts; if (!a.body || !b.body) { return a.body === b.body; } - return a.body.kind === b.body.kind && (a.body.kind !== 261 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); + return a.body.kind === b.body.kind && (a.body.kind !== 264 /* SyntaxKind.ModuleDeclaration */ || areSameModule(a.body, b.body)); } /** Merge source into target. Source should be thrown away after this is called. */ function merge(target, source) { @@ -143629,7 +144915,7 @@ var ts; * So `new()` can still come before an `aardvark` method. */ function tryGetName(node) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return getModuleName(node); } var declName = ts.getNameOfDeclaration(node); @@ -143638,16 +144924,16 @@ var ts; return propertyName && ts.unescapeLeadingUnderscores(propertyName); } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: return getFunctionOrClassName(node); default: return undefined; } } function getItemName(node, name) { - if (node.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (node.kind === 264 /* SyntaxKind.ModuleDeclaration */) { return cleanText(getModuleName(node)); } if (name) { @@ -143659,32 +144945,32 @@ var ts; } } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var sourceFile = node; return ts.isExternalModule(sourceFile) ? "\"".concat(ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))), "\"") : ""; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return ts.isExportAssignment(node) && node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } // We may get a string with newlines or other whitespace in the case of an object dereference // (eg: "app\n.onactivated"), so we should remove the whitespace for readability in the // navigation bar. return getFunctionOrClassName(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return "new()"; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return "()"; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "[]"; default: return ""; @@ -143717,19 +145003,19 @@ var ts; } // Some nodes are otherwise important enough to always include in the primary navigation menu. switch (navigationBarNodeKind(item)) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 305 /* SyntaxKind.SourceFile */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return true; - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return isTopLevelFunctionDeclaration(item); default: return false; @@ -143739,10 +145025,10 @@ var ts; return false; } switch (navigationBarNodeKind(item.parent)) { - case 262 /* SyntaxKind.ModuleBlock */: - case 305 /* SyntaxKind.SourceFile */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 265 /* SyntaxKind.ModuleBlock */: + case 308 /* SyntaxKind.SourceFile */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: return true; default: return false; @@ -143804,7 +145090,7 @@ var ts; function getFullyQualifiedModuleName(moduleDeclaration) { // Otherwise, we need to aggregate each identifier to build up the qualified name. var result = [ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)]; - while (moduleDeclaration.body && moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + while (moduleDeclaration.body && moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { moduleDeclaration = moduleDeclaration.body; result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name)); } @@ -143818,13 +145104,13 @@ var ts; return decl.body && ts.isModuleDeclaration(decl.body) ? getInteriorModule(decl.body) : decl; } function isComputedProperty(member) { - return !member.name || member.name.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return !member.name || member.name.kind === 164 /* SyntaxKind.ComputedPropertyName */; } function getNodeSpan(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile); } function getModifiers(node) { - if (node.parent && node.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.parent && node.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } return ts.getNodeModifiers(node); @@ -143847,7 +145133,7 @@ var ts; return nodeText(parent.name); } // Default exports are named "default" - else if (ts.getSyntacticModifierFlags(node) & 512 /* ModifierFlags.Default */) { + else if (ts.getSyntacticModifierFlags(node) & 1024 /* ModifierFlags.Default */) { return "default"; } else if (ts.isClassLike(node)) { @@ -143882,9 +145168,9 @@ var ts; } function isFunctionOrClassExpression(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; default: return false; @@ -143913,23 +145199,39 @@ var ts; * 2) Coalescing imports from the same module * 3) Sorting imports */ - function organizeImports(sourceFile, formatContext, host, program, preferences, skipDestructiveCodeActions) { + function organizeImports(sourceFile, formatContext, host, program, preferences, mode) { var changeTracker = ts.textChanges.ChangeTracker.fromContext({ host: host, formatContext: formatContext, preferences: preferences }); - var coalesceAndOrganizeImports = function (importGroup) { return ts.stableSort(coalesceImports(removeUnusedImports(importGroup, sourceFile, program, skipDestructiveCodeActions)), function (s1, s2) { return compareImportsOrRequireStatements(s1, s2); }); }; + var shouldSort = mode === "SortAndCombine" /* OrganizeImportsMode.SortAndCombine */ || mode === "All" /* OrganizeImportsMode.All */; + var shouldCombine = shouldSort; // These are currently inseparable, but I draw a distinction for clarity and in case we add modes in the future. + var shouldRemove = mode === "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */ || mode === "All" /* OrganizeImportsMode.All */; + var maybeRemove = shouldRemove ? removeUnusedImports : ts.identity; + var maybeCoalesce = shouldCombine ? coalesceImports : ts.identity; + var processImportsOfSameModuleSpecifier = function (importGroup) { + var processedDeclarations = maybeCoalesce(maybeRemove(importGroup, sourceFile, program)); + return shouldSort + ? ts.stableSort(processedDeclarations, function (s1, s2) { return compareImportsOrRequireStatements(s1, s2); }) + : processedDeclarations; + }; // All of the old ImportDeclarations in the file, in syntactic order. var topLevelImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, sourceFile.statements.filter(ts.isImportDeclaration)); - topLevelImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, coalesceAndOrganizeImports); }); - // All of the old ExportDeclarations in the file, in syntactic order. - var topLevelExportDecls = sourceFile.statements.filter(ts.isExportDeclaration); - organizeImportsWorker(topLevelExportDecls, coalesceExports); + topLevelImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier); }); + // Exports are always used + if (mode !== "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */) { + // All of the old ExportDeclarations in the file, in syntactic order. + var topLevelExportDecls = sourceFile.statements.filter(ts.isExportDeclaration); + organizeImportsWorker(topLevelExportDecls, coalesceExports); + } for (var _i = 0, _a = sourceFile.statements.filter(ts.isAmbientModule); _i < _a.length; _i++) { var ambientModule = _a[_i]; if (!ambientModule.body) continue; var ambientModuleImportGroupDecls = groupImportsByNewlineContiguous(sourceFile, ambientModule.body.statements.filter(ts.isImportDeclaration)); - ambientModuleImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, coalesceAndOrganizeImports); }); - var ambientModuleExportDecls = ambientModule.body.statements.filter(ts.isExportDeclaration); - organizeImportsWorker(ambientModuleExportDecls, coalesceExports); + ambientModuleImportGroupDecls.forEach(function (importGroupDecl) { return organizeImportsWorker(importGroupDecl, processImportsOfSameModuleSpecifier); }); + // Exports are always used + if (mode !== "RemoveUnused" /* OrganizeImportsMode.RemoveUnused */) { + var ambientModuleExportDecls = ambientModule.body.statements.filter(ts.isExportDeclaration); + organizeImportsWorker(ambientModuleExportDecls, coalesceExports); + } } return changeTracker.getChanges(); function organizeImportsWorker(oldImportDecls, coalesce) { @@ -143942,8 +145244,12 @@ var ts; // Consider: we could do a more careful check that this trivia is actually a header, // but the consequences of being wrong are very minor. ts.suppressLeadingTrivia(oldImportDecls[0]); - var oldImportGroups = ts.group(oldImportDecls, function (importDecl) { return getExternalModuleName(importDecl.moduleSpecifier); }); - var sortedImportGroups = ts.stableSort(oldImportGroups, function (group1, group2) { return compareModuleSpecifiers(group1[0].moduleSpecifier, group2[0].moduleSpecifier); }); + var oldImportGroups = shouldCombine + ? ts.group(oldImportDecls, function (importDecl) { return getExternalModuleName(importDecl.moduleSpecifier); }) + : [oldImportDecls]; + var sortedImportGroups = shouldSort + ? ts.stableSort(oldImportGroups, function (group1, group2) { return compareModuleSpecifiers(group1[0].moduleSpecifier, group2[0].moduleSpecifier); }) + : oldImportGroups; var newImportDecls = ts.flatMap(sortedImportGroups, function (importGroup) { return getExternalModuleName(importGroup[0].moduleSpecifier) ? coalesce(importGroup) @@ -144007,11 +145313,7 @@ var ts; } return false; } - function removeUnusedImports(oldImports, sourceFile, program, skipDestructiveCodeActions) { - // As a precaution, consider unused import detection to be destructive (GH #43051) - if (skipDestructiveCodeActions) { - return oldImports; - } + function removeUnusedImports(oldImports, sourceFile, program) { var typeChecker = program.getTypeChecker(); var compilerOptions = program.getCompilerOptions(); var jsxNamespace = typeChecker.getJsxNamespace(sourceFile); @@ -144285,11 +145587,11 @@ var ts; function getModuleSpecifierExpression(declaration) { var _a; switch (declaration.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return (_a = ts.tryCast(declaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return declaration.moduleSpecifier; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return declaration.declarationList.declarations[0].initializer.arguments[0]; } } @@ -144328,19 +145630,19 @@ var ts; function getImportKindOrder(s1) { var _a; switch (s1.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!s1.importClause) return 0; if (s1.importClause.isTypeOnly) return 1; - if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 268 /* SyntaxKind.NamespaceImport */) + if (((_a = s1.importClause.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 271 /* SyntaxKind.NamespaceImport */) return 2; if (s1.importClause.name) return 3; return 4; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return 5; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return 6; } } @@ -144529,7 +145831,7 @@ var ts; } function getOutliningSpanForNode(n, sourceFile) { switch (n.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionLike(n.parent)) { return functionSpan(n.parent, n, sourceFile); } @@ -144537,16 +145839,16 @@ var ts; // If the latter, we want to collapse the block, but consider its hint span // to be the entire span of the parent. switch (n.parent.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 243 /* SyntaxKind.DoStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 295 /* SyntaxKind.CatchClause */: return spanForNode(n.parent); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // Could be the try-block, or the finally-block. var tryStatement = n.parent; if (tryStatement.tryBlock === n) { @@ -144563,42 +145865,42 @@ var ts; // the span of the block, independent of any parent span. return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile), "code" /* OutliningSpanKind.Code */); } - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanForNode(n.parent); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 263 /* SyntaxKind.CaseBlock */: - case 182 /* SyntaxKind.TypeLiteral */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 266 /* SyntaxKind.CaseBlock */: + case 184 /* SyntaxKind.TypeLiteral */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return spanForNode(n); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isTupleTypeNode(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return spanForNodeArray(n.statements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return spanForObjectOrArrayLiteral(n); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return spanForObjectOrArrayLiteral(n, 22 /* SyntaxKind.OpenBracketToken */); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return spanForJSXElement(n); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return spanForJSXFragment(n); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return spanForJSXAttributes(n.attributes); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return spanForTemplateLiteral(n); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanForNode(n, /*autoCollapse*/ false, /*useFullStart*/ !ts.isBindingElement(n.parent), 22 /* SyntaxKind.OpenBracketToken */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return spanForArrowFunction(n); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return spanForCallExpression(n); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanForParenthesizedExpression(n); } function spanForCallExpression(node) { @@ -144671,7 +145973,7 @@ var ts; function functionSpan(node, body, sourceFile) { var openToken = tryGetFunctionOpenToken(node, body, sourceFile); var closeToken = ts.findChildOfKind(body, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); - return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 214 /* SyntaxKind.ArrowFunction */); + return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 216 /* SyntaxKind.ArrowFunction */); } function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart) { if (autoCollapse === void 0) { autoCollapse = false; } @@ -144867,7 +146169,7 @@ var ts; return bestMatch; } function betterMatch(a, b) { - return ts.min(a, b, compareMatches); + return ts.min([a, b], compareMatches); } function compareMatches(a, b) { return a === undefined ? 1 /* Comparison.GreaterThan */ : b === undefined ? -1 /* Comparison.LessThan */ @@ -145215,10 +146517,10 @@ var ts; */ function tryConsumeDeclare() { var token = ts.scanner.getToken(); - if (token === 135 /* SyntaxKind.DeclareKeyword */) { + if (token === 136 /* SyntaxKind.DeclareKeyword */) { // declare module "mod" token = nextToken(); - if (token === 141 /* SyntaxKind.ModuleKeyword */) { + if (token === 142 /* SyntaxKind.ModuleKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { recordAmbientExternalModule(); @@ -145252,10 +146554,10 @@ var ts; return true; } else { - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); - return token !== 156 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || + return token !== 158 /* SyntaxKind.FromKeyword */ && (token === 41 /* SyntaxKind.AsteriskToken */ || token === 18 /* SyntaxKind.OpenBraceToken */ || token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)); @@ -145266,7 +146568,7 @@ var ts; } if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import d from "mod"; @@ -145297,7 +146599,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import {a as A} from "mod"; @@ -145309,11 +146611,11 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 127 /* SyntaxKind.AsKeyword */) { + if (token === 128 /* SyntaxKind.AsKeyword */) { token = nextToken(); if (token === 79 /* SyntaxKind.Identifier */ || ts.isKeyword(token)) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // import * as NS from "mod" @@ -145334,7 +146636,7 @@ var ts; if (token === 93 /* SyntaxKind.ExportKeyword */) { markAsExternalModuleIfTopLevel(); token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 41 /* SyntaxKind.AsteriskToken */ || @@ -145353,7 +146655,7 @@ var ts; } if (token === 19 /* SyntaxKind.CloseBraceToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export {a as A} from "mod"; @@ -145365,7 +146667,7 @@ var ts; } else if (token === 41 /* SyntaxKind.AsteriskToken */) { token = nextToken(); - if (token === 156 /* SyntaxKind.FromKeyword */) { + if (token === 158 /* SyntaxKind.FromKeyword */) { token = nextToken(); if (token === 10 /* SyntaxKind.StringLiteral */) { // export * from "mod" @@ -145375,7 +146677,7 @@ var ts; } else if (token === 100 /* SyntaxKind.ImportKeyword */) { token = nextToken(); - if (token === 152 /* SyntaxKind.TypeKeyword */) { + if (token === 154 /* SyntaxKind.TypeKeyword */) { var skipTypeKeyword = ts.scanner.lookAhead(function () { var token = ts.scanner.scan(); return token === 79 /* SyntaxKind.Identifier */ || @@ -145401,7 +146703,7 @@ var ts; function tryConsumeRequireCall(skipCurrentToken, allowTemplateLiterals) { if (allowTemplateLiterals === void 0) { allowTemplateLiterals = false; } var token = skipCurrentToken ? nextToken() : ts.scanner.getToken(); - if (token === 146 /* SyntaxKind.RequireKeyword */) { + if (token === 147 /* SyntaxKind.RequireKeyword */) { token = nextToken(); if (token === 20 /* SyntaxKind.OpenParenToken */) { token = nextToken(); @@ -145476,8 +146778,8 @@ var ts; } if (ts.scanner.getToken() === 15 /* SyntaxKind.TemplateHead */) { var stack = [ts.scanner.getToken()]; - var token = ts.scanner.scan(); loop: while (ts.length(stack)) { + var token = ts.scanner.scan(); switch (token) { case 1 /* SyntaxKind.EndOfFileToken */: break loop; @@ -145505,7 +146807,6 @@ var ts; } break; } - token = ts.scanner.scan(); } nextToken(); } @@ -145613,7 +146914,7 @@ var ts; return getRenameInfoError(wouldRenameNodeModules); } var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node); - var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) + var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) ? ts.stripQuotes(ts.getTextOfIdentifierOrLiteral(node)) : undefined; var displayName = specifierName || typeChecker.symbolToString(symbol); @@ -145758,6 +147059,10 @@ var ts; pushSelectionCommentRange(comment.pos, comment.end); } if (positionShouldSnapToNode(sourceFile, pos, node)) { + if (ts.isFunctionBody(node) + && ts.isFunctionLikeDeclaration(parentNode) && !ts.positionsAreOnSameLine(node.getStart(sourceFile), node.getEnd(), sourceFile)) { + pushSelectionRange(node.getStart(sourceFile), node.getEnd()); + } // 1. Blocks are effectively redundant with SyntaxLists. // 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping // of things that should be considered independently. @@ -145895,14 +147200,14 @@ var ts; ts.Debug.assertEqual(closeBraceToken.kind, 19 /* SyntaxKind.CloseBraceToken */); // Group `-/+readonly` and `-/+?` var groupedWithPlusMinusTokens = groupChildren(children, function (child) { - return child === node.readonlyToken || child.kind === 145 /* SyntaxKind.ReadonlyKeyword */ || + return child === node.readonlyToken || child.kind === 146 /* SyntaxKind.ReadonlyKeyword */ || child === node.questionToken || child.kind === 57 /* SyntaxKind.QuestionToken */; }); // Group type parameter with surrounding brackets var groupedWithBrackets = groupChildren(groupedWithPlusMinusTokens, function (_a) { var kind = _a.kind; return kind === 22 /* SyntaxKind.OpenBracketToken */ || - kind === 163 /* SyntaxKind.TypeParameter */ || + kind === 165 /* SyntaxKind.TypeParameter */ || kind === 23 /* SyntaxKind.CloseBracketToken */; }); return [ @@ -145920,7 +147225,7 @@ var ts; var children = groupChildren(node.getChildren(), function (child) { return child === node.name || ts.contains(node.modifiers, child); }); - var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDoc */ ? children[0] : undefined; + var firstJSDocChild = ((_a = children[0]) === null || _a === void 0 ? void 0 : _a.kind) === 323 /* SyntaxKind.JSDoc */ ? children[0] : undefined; var withJSDocSeparated = firstJSDocChild ? children.slice(1) : children; var splittedChildren = splitChildren(withJSDocSeparated, function (_a) { var kind = _a.kind; @@ -146019,22 +147324,22 @@ var ts; return kind === 18 /* SyntaxKind.OpenBraceToken */ || kind === 22 /* SyntaxKind.OpenBracketToken */ || kind === 20 /* SyntaxKind.OpenParenToken */ - || kind === 280 /* SyntaxKind.JsxOpeningElement */; + || kind === 283 /* SyntaxKind.JsxOpeningElement */; } function isListCloser(token) { var kind = token && token.kind; return kind === 19 /* SyntaxKind.CloseBraceToken */ || kind === 23 /* SyntaxKind.CloseBracketToken */ || kind === 21 /* SyntaxKind.CloseParenToken */ - || kind === 281 /* SyntaxKind.JsxClosingElement */; + || kind === 284 /* SyntaxKind.JsxClosingElement */; } function getEndPos(sourceFile, node) { switch (node.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 342 /* SyntaxKind.JSDocThisTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 345 /* SyntaxKind.JSDocThisTag */: return sourceFile.getLineEndOfPosition(node.getStart()); default: return node.getEnd(); @@ -146244,10 +147549,10 @@ var ts; } return undefined; } - else if (ts.isTemplateHead(node) && parent.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + else if (ts.isTemplateHead(node) && parent.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var templateExpression = parent; var tagExpression = templateExpression.parent; - ts.Debug.assert(templateExpression.kind === 223 /* SyntaxKind.TemplateExpression */); + ts.Debug.assert(templateExpression.kind === 225 /* SyntaxKind.TemplateExpression */); var argumentIndex = ts.isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1; return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile); } @@ -146319,17 +147624,17 @@ var ts; return undefined; var parent = startingToken.parent; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: var info = getArgumentOrParameterListInfo(startingToken, position, sourceFile); if (!info) return undefined; var argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan; var contextualType = ts.isMethodDeclaration(parent) ? checker.getContextualTypeForObjectLiteralElement(parent) : checker.getContextualType(parent); return contextualType && { contextualType: contextualType, argumentIndex: argumentIndex, argumentCount: argumentCount, argumentsSpan: argumentsSpan }; - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var highestBinary = getHighestBinary(parent); var contextualType_1 = checker.getContextualType(highestBinary); var argumentIndex_1 = startingToken.kind === 20 /* SyntaxKind.OpenParenToken */ ? 0 : countBinaryExpressionParameters(parent) - 1; @@ -146400,11 +147705,11 @@ var ts; // not enough to put us in the substitution expression; we should consider ourselves part of // the *next* span's expression by offsetting the index (argIndex = (spanIndex + 1) + 1). // - /* eslint-disable no-double-space */ + /* eslint-disable local/no-double-space */ // Example: f `# abcd $#{# 1 + 1# }# efghi ${ #"#hello"# } # ` // ^ ^ ^ ^ ^ ^ ^ ^ ^ // Case: 1 1 3 2 1 3 2 2 1 - /* eslint-enable no-double-space */ + /* eslint-enable local/no-double-space */ ts.Debug.assert(position >= node.getStart(), "Assumed 'position' could not occur before node."); if (ts.isTemplateLiteralToken(node)) { if (ts.isInsideTemplateLiteral(node, position, sourceFile)) { @@ -146453,7 +147758,7 @@ var ts; // | | // This is because a Missing node has no width. However, what we actually want is to include trivia // leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail. - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { var lastSpan = ts.last(template.templateSpans); if (lastSpan.literal.getFullWidth() === 0) { applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false); @@ -146658,14 +147963,14 @@ var ts; return; } switch (node.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } if (!ts.textSpanIntersectsWith(span, node.pos, node.getFullWidth())) { @@ -146809,7 +148114,7 @@ var ts; } function isHintableLiteral(node) { switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; return ts.isLiteralExpression(operand) || ts.isIdentifier(operand) && ts.isInfinityOrNaNString(operand.escapedText); } @@ -146817,7 +148122,7 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; case 79 /* SyntaxKind.Identifier */: { var name = node.escapedText; @@ -147138,11 +148443,11 @@ var ts; function containsTopLevelCommonjs(sourceFile) { return sourceFile.statements.some(function (statement) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return statement.declarationList.declarations.some(function (decl) { return !!decl.initializer && ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), /*checkArgumentIsStringLiteralLike*/ true); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; if (!ts.isBinaryExpression(expression)) return ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true); @@ -147159,12 +148464,12 @@ var ts; } function importNameForConvertToDefaultImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier; - return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) + return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ && ts.isStringLiteral(moduleSpecifier) ? importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; default: return undefined; @@ -147240,20 +148545,20 @@ var ts; // should be kept up to date with getTransformationBody in convertToAsyncFunction.ts function isFixablePromiseArgument(arg, checker) { switch (arg.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var functionFlags = ts.getFunctionFlags(arg); if (functionFlags & 1 /* FunctionFlags.Generator */) { return false; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true); // falls through case 104 /* SyntaxKind.NullKeyword */: return true; case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var symbol = checker.getSymbolAtLocation(arg); if (!symbol) { return false; @@ -147270,24 +148575,24 @@ var ts; } function canBeConvertedToClass(node, checker) { var _a, _b, _c, _d; - if (node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (node.kind === 215 /* SyntaxKind.FunctionExpression */) { if (ts.isVariableDeclaration(node.parent) && ((_a = node.symbol.members) === null || _a === void 0 ? void 0 : _a.size)) { return true; } var symbol = checker.getSymbolOfExpando(node, /*allowDeclaration*/ false); return !!(symbol && (((_b = symbol.exports) === null || _b === void 0 ? void 0 : _b.size) || ((_c = symbol.members) === null || _c === void 0 ? void 0 : _c.size))); } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */) { return !!((_d = node.symbol.members) === null || _d === void 0 ? void 0 : _d.size); } return false; } function canBeConvertedToAsync(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -147309,7 +148614,7 @@ var ts; } var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol); if (flags & 32 /* SymbolFlags.Class */) { - return ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */) ? + return ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */) ? "local class" /* ScriptElementKind.localClassElement */ : "class" /* ScriptElementKind.classElement */; } if (flags & 384 /* SymbolFlags.Enum */) @@ -147372,6 +148677,8 @@ var ts; return "method" /* ScriptElementKind.memberFunctionElement */; if (flags & 16384 /* SymbolFlags.Constructor */) return "constructor" /* ScriptElementKind.constructorImplementationElement */; + if (flags & 131072 /* SymbolFlags.Signature */) + return "index" /* ScriptElementKind.indexSignatureElement */; if (flags & 4 /* SymbolFlags.Property */) { if (flags & 33554432 /* SymbolFlags.Transient */ && symbol.checkFlags & 6 /* CheckFlags.Synthetic */) { // If union property is result of union of non method (property/accessors/variables), it is labeled as property @@ -147455,12 +148762,15 @@ var ts; var declaration = ts.find(symbol.declarations, function (declaration) { return declaration.name === location; }); if (declaration) { switch (declaration.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: symbolKind = "getter" /* ScriptElementKind.memberGetAccessorElement */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: symbolKind = "setter" /* ScriptElementKind.memberSetAccessorElement */; break; + case 169 /* SyntaxKind.PropertyDeclaration */: + symbolKind = "accessor" /* ScriptElementKind.memberAccessorVariableElement */; + break; default: ts.Debug.assertNever(declaration); } @@ -147471,7 +148781,7 @@ var ts; } var signature = void 0; type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol, location); - if (location.parent && location.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (location.parent && location.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var right = location.parent.name; // Either the location is on the right of a property access, or on the left and the right is missing if (right === location || (right && right.getFullWidth() === 0)) { @@ -147491,7 +148801,7 @@ var ts; } if (callExpressionLike) { signature = typeChecker.getResolvedSignature(callExpressionLike); // TODO: GH#18217 - var useConstructSignatures = callExpressionLike.kind === 209 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); + var useConstructSignatures = callExpressionLike.kind === 211 /* SyntaxKind.NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 106 /* SyntaxKind.SuperKeyword */); var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures(); if (signature && !ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) { // Get the first signature if there is one -- allSignatures may contain @@ -147555,29 +148865,29 @@ var ts; } } else if ((ts.isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* SymbolFlags.Accessor */)) || // name of function declaration - (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 171 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration + (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ && location.parent.kind === 173 /* SyntaxKind.Constructor */)) { // At constructor keyword of constructor declaration // get the signature from the declaration and write it var functionDeclaration_1 = location.parent; // Use function declaration to write the signatures only if the symbol corresponding to this declaration var locationIsSymbolDeclaration = symbol.declarations && ts.find(symbol.declarations, function (declaration) { - return declaration === (location.kind === 134 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); + return declaration === (location.kind === 135 /* SyntaxKind.ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1); }); if (locationIsSymbolDeclaration) { - var allSignatures = functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); + var allSignatures = functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures(); if (!typeChecker.isImplementationOfOverload(functionDeclaration_1)) { signature = typeChecker.getSignatureFromDeclaration(functionDeclaration_1); // TODO: GH#18217 } else { signature = allSignatures[0]; } - if (functionDeclaration_1.kind === 171 /* SyntaxKind.Constructor */) { + if (functionDeclaration_1.kind === 173 /* SyntaxKind.Constructor */) { // show (constructor) Type(...) signature symbolKind = "constructor" /* ScriptElementKind.constructorImplementationElement */; addPrefixForAnyFunctionOrVar(type.symbol, symbolKind); } else { // (function/method) symbol(..signature) - addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 174 /* SyntaxKind.CallSignature */ && + addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 176 /* SyntaxKind.CallSignature */ && !(type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ || type.symbol.flags & 4096 /* SymbolFlags.ObjectLiteral */) ? type.symbol : symbol, symbolKind); } if (signature) { @@ -147590,7 +148900,7 @@ var ts; } if (symbolFlags & 32 /* SymbolFlags.Class */ && !hasAddedSymbolInfo && !isThisExpression) { addAliasPrefixIfNecessary(); - if (ts.getDeclarationOfKind(symbol, 226 /* SyntaxKind.ClassExpression */)) { + if (ts.getDeclarationOfKind(symbol, 228 /* SyntaxKind.ClassExpression */)) { // Special case for class expressions because we would like to indicate that // the class name is local to the class body (similar to function expression) // (local class) class @@ -147613,7 +148923,7 @@ var ts; } if ((symbolFlags & 524288 /* SymbolFlags.TypeAlias */) && (semanticMeaning & 2 /* SemanticMeaning.Type */)) { prefixNextMeaning(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); writeTypeParametersOfSymbol(symbol, sourceFile); @@ -147634,9 +148944,9 @@ var ts; } if (symbolFlags & 1536 /* SymbolFlags.Module */ && !isThisExpression) { prefixNextMeaning(); - var declaration = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.ModuleDeclaration */); + var declaration = ts.getDeclarationOfKind(symbol, 264 /* SyntaxKind.ModuleDeclaration */); var isNamespace = declaration && declaration.name && declaration.name.kind === 79 /* SyntaxKind.Identifier */; - displayParts.push(ts.keywordPart(isNamespace ? 142 /* SyntaxKind.NamespaceKeyword */ : 141 /* SyntaxKind.ModuleKeyword */)); + displayParts.push(ts.keywordPart(isNamespace ? 143 /* SyntaxKind.NamespaceKeyword */ : 142 /* SyntaxKind.ModuleKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(symbol); } @@ -147655,7 +148965,7 @@ var ts; } else { // Method/function type parameter - var decl = ts.getDeclarationOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var decl = ts.getDeclarationOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (decl === undefined) return ts.Debug.fail(); var declaration = decl.parent; @@ -147663,21 +148973,21 @@ var ts; if (ts.isFunctionLikeKind(declaration.kind)) { addInPrefix(); var signature = typeChecker.getSignatureFromDeclaration(declaration); // TODO: GH#18217 - if (declaration.kind === 175 /* SyntaxKind.ConstructSignature */) { + if (declaration.kind === 177 /* SyntaxKind.ConstructSignature */) { displayParts.push(ts.keywordPart(103 /* SyntaxKind.NewKeyword */)); displayParts.push(ts.spacePart()); } - else if (declaration.kind !== 174 /* SyntaxKind.CallSignature */ && declaration.name) { + else if (declaration.kind !== 176 /* SyntaxKind.CallSignature */ && declaration.name) { addFullSymbolName(declaration.symbol); } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* TypeFormatFlags.WriteTypeArgumentsOfSignature */)); } - else if (declaration.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + else if (declaration.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Type alias type parameter // For example // type list = T[]; // Both T will go through same code path addInPrefix(); - displayParts.push(ts.keywordPart(152 /* SyntaxKind.TypeKeyword */)); + displayParts.push(ts.keywordPart(154 /* SyntaxKind.TypeKeyword */)); displayParts.push(ts.spacePart()); addFullSymbolName(declaration.symbol); writeTypeParametersOfSymbol(declaration.symbol, sourceFile); @@ -147689,7 +148999,7 @@ var ts; symbolKind = "enum member" /* ScriptElementKind.enumMemberElement */; addPrefixForAnyFunctionOrVar(symbol, "enum member"); var declaration = (_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a[0]; - if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 299 /* SyntaxKind.EnumMember */) { + if ((declaration === null || declaration === void 0 ? void 0 : declaration.kind) === 302 /* SyntaxKind.EnumMember */) { var constantValue = typeChecker.getConstantValue(declaration); if (constantValue !== undefined) { displayParts.push(ts.spacePart()); @@ -147725,17 +149035,17 @@ var ts; } if (symbol.declarations) { switch (symbol.declarations[0].kind) { - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(142 /* SyntaxKind.NamespaceKeyword */)); + displayParts.push(ts.keywordPart(143 /* SyntaxKind.NamespaceKeyword */)); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); displayParts.push(ts.spacePart()); displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 63 /* SyntaxKind.EqualsToken */ : 88 /* SyntaxKind.DefaultKeyword */)); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: displayParts.push(ts.keywordPart(93 /* SyntaxKind.ExportKeyword */)); break; default: @@ -147745,13 +149055,13 @@ var ts; displayParts.push(ts.spacePart()); addFullSymbolName(symbol); ts.forEach(symbol.declarations, function (declaration) { - if (declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var importEqualsDeclaration = declaration; if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) { displayParts.push(ts.spacePart()); displayParts.push(ts.operatorPart(63 /* SyntaxKind.EqualsToken */)); displayParts.push(ts.spacePart()); - displayParts.push(ts.keywordPart(146 /* SyntaxKind.RequireKeyword */)); + displayParts.push(ts.keywordPart(147 /* SyntaxKind.RequireKeyword */)); displayParts.push(ts.punctuationPart(20 /* SyntaxKind.OpenParenToken */)); displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral)); displayParts.push(ts.punctuationPart(21 /* SyntaxKind.CloseParenToken */)); @@ -147781,16 +149091,18 @@ var ts; } // For properties, variables and local vars: show the type if (symbolKind === "property" /* ScriptElementKind.memberVariableElement */ || + symbolKind === "accessor" /* ScriptElementKind.memberAccessorVariableElement */ || symbolKind === "getter" /* ScriptElementKind.memberGetAccessorElement */ || symbolKind === "setter" /* ScriptElementKind.memberSetAccessorElement */ || symbolKind === "JSX attribute" /* ScriptElementKind.jsxAttribute */ || symbolFlags & 3 /* SymbolFlags.Variable */ || symbolKind === "local var" /* ScriptElementKind.localVariableElement */ || + symbolKind === "index" /* ScriptElementKind.indexSignatureElement */ || isThisExpression) { displayParts.push(ts.punctuationPart(58 /* SyntaxKind.ColonToken */)); displayParts.push(ts.spacePart()); // If the type is type parameter, format it specially - if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */) { + if (type.symbol && type.symbol.flags & 262144 /* SymbolFlags.TypeParameter */ && symbolKind !== "index" /* ScriptElementKind.indexSignatureElement */) { var typeParameterParts = ts.mapToDisplayParts(function (writer) { var param = typeChecker.typeParameterToDeclaration(type, enclosingDeclaration, symbolDisplayNodeBuilderFlags); getPrinter().writeNode(4 /* EmitHint.Unspecified */, param, ts.getSourceFileOfNode(ts.getParseTreeNode(enclosingDeclaration)), writer); @@ -147834,10 +149146,10 @@ var ts; // For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo` // there documentation comments might be attached to the right hand side symbol of their declarations. // The pattern of such special property access is that the parent symbol is the symbol of the file. - if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 305 /* SyntaxKind.SourceFile */; })) { + if (symbol.parent && symbol.declarations && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 308 /* SyntaxKind.SourceFile */; })) { for (var _i = 0, _b = symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - if (!declaration.parent || declaration.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (!declaration.parent || declaration.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { continue; } var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right); @@ -147898,10 +149210,34 @@ var ts; displayParts.push(ts.spacePart()); } function addFullSymbolName(symbolToDisplay, enclosingDeclaration) { + var indexInfos; if (alias && symbolToDisplay === symbol) { symbolToDisplay = alias; } - var fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + if (symbolKind === "index" /* ScriptElementKind.indexSignatureElement */) { + indexInfos = typeChecker.getIndexInfosOfIndexSymbol(symbolToDisplay); + } + var fullSymbolDisplayParts = []; + if (symbolToDisplay.flags & 131072 /* SymbolFlags.Signature */ && indexInfos) { + if (symbolToDisplay.parent) { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay.parent); + } + fullSymbolDisplayParts.push(ts.punctuationPart(22 /* SyntaxKind.OpenBracketToken */)); + //Needed to handle more than one type of index + indexInfos.forEach(function (info, i) { + //Needed to handle template literals + fullSymbolDisplayParts.push.apply(fullSymbolDisplayParts, ts.typeToDisplayParts(typeChecker, info.keyType)); + if (i !== indexInfos.length - 1) { + fullSymbolDisplayParts.push(ts.spacePart()); + fullSymbolDisplayParts.push(ts.punctuationPart(51 /* SyntaxKind.BarToken */)); + fullSymbolDisplayParts.push(ts.spacePart()); + } + }); + fullSymbolDisplayParts.push(ts.punctuationPart(23 /* SyntaxKind.CloseBracketToken */)); + } + else { + fullSymbolDisplayParts = ts.symbolToDisplayParts(typeChecker, symbolToDisplay, enclosingDeclaration || sourceFile, /*meaning*/ undefined, 1 /* SymbolFormatFlags.WriteTypeParametersOrArguments */ | 2 /* SymbolFormatFlags.UseOnlyExternalAliasing */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + } ts.addRange(displayParts, fullSymbolDisplayParts); if (symbol.flags & 16777216 /* SymbolFlags.Optional */) { displayParts.push(ts.punctuationPart(57 /* SyntaxKind.QuestionToken */)); @@ -147949,7 +149285,7 @@ var ts; tags = signature.getJsDocTags(); if (allSignatures.length > 1 && documentation.length === 0 && tags.length === 0) { documentation = allSignatures[0].getDocumentationComment(typeChecker); - tags = allSignatures[0].getJsDocTags(); + tags = allSignatures[0].getJsDocTags().filter(function (tag) { return tag.name !== "deprecated"; }); // should only include @deprecated JSDoc tag on the first overload (#49368) } } function writeTypeParametersOfSymbol(symbol, enclosingDeclaration) { @@ -147967,16 +149303,16 @@ var ts; } return ts.forEach(symbol.declarations, function (declaration) { // Function expressions are local - if (declaration.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (declaration.kind === 215 /* SyntaxKind.FunctionExpression */) { return true; } - if (declaration.kind !== 254 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */) { + if (declaration.kind !== 257 /* SyntaxKind.VariableDeclaration */ && declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */) { return false; } // If the parent is not sourceFile or module block it is local variable for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) { // Reached source file or module block - if (parent.kind === 305 /* SyntaxKind.SourceFile */ || parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ || parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return false; } } @@ -148281,10 +149617,10 @@ var ts; function shouldRescanJsxIdentifier(node) { if (node.parent) { switch (node.parent.kind) { - case 285 /* SyntaxKind.JsxAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 288 /* SyntaxKind.JsxAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: // May parse an identifier like `module-layout`; that will be scanned as a keyword at first, but we should parse the whole thing to get an identifier. return ts.isKeyword(node.kind) || node.kind === 79 /* SyntaxKind.Identifier */; } @@ -148292,7 +149628,7 @@ var ts; return false; } function shouldRescanJsxText(node) { - return ts.isJsxText(node); + return ts.isJsxText(node) || ts.isJsxElement(node) && (lastTokenInfo === null || lastTokenInfo === void 0 ? void 0 : lastTokenInfo.token.kind) === 11 /* SyntaxKind.JsxText */; } function shouldRescanSlashToken(container) { return container.kind === 13 /* SyntaxKind.RegularExpressionLiteral */; @@ -148477,7 +149813,7 @@ var ts; (function (formatting) { function getAllRules() { var allTokens = []; - for (var token = 0 /* SyntaxKind.FirstToken */; token <= 160 /* SyntaxKind.LastToken */; token++) { + for (var token = 0 /* SyntaxKind.FirstToken */; token <= 162 /* SyntaxKind.LastToken */; token++) { if (token !== 1 /* SyntaxKind.EndOfFileToken */) { allTokens.push(token); } @@ -148492,9 +149828,9 @@ var ts; var anyToken = { tokens: allTokens, isSpecific: false }; var anyTokenIncludingMultilineComments = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [3 /* SyntaxKind.MultiLineCommentTrivia */], false)); var anyTokenIncludingEOF = tokenRangeFrom(__spreadArray(__spreadArray([], allTokens, true), [1 /* SyntaxKind.EndOfFileToken */], false)); - var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 160 /* SyntaxKind.LastKeyword */); + var keywords = tokenRangeFromRange(81 /* SyntaxKind.FirstKeyword */, 162 /* SyntaxKind.LastKeyword */); var binaryOperators = tokenRangeFromRange(29 /* SyntaxKind.FirstBinaryOperator */, 78 /* SyntaxKind.LastBinaryOperator */); - var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 160 /* SyntaxKind.OfKeyword */, 127 /* SyntaxKind.AsKeyword */, 139 /* SyntaxKind.IsKeyword */]; + var binaryKeywordOperators = [101 /* SyntaxKind.InKeyword */, 102 /* SyntaxKind.InstanceOfKeyword */, 162 /* SyntaxKind.OfKeyword */, 128 /* SyntaxKind.AsKeyword */, 140 /* SyntaxKind.IsKeyword */]; var unaryPrefixOperators = [45 /* SyntaxKind.PlusPlusToken */, 46 /* SyntaxKind.MinusMinusToken */, 54 /* SyntaxKind.TildeToken */, 53 /* SyntaxKind.ExclamationToken */]; var unaryPrefixExpressions = [ 8 /* SyntaxKind.NumericLiteral */, 9 /* SyntaxKind.BigIntLiteral */, 79 /* SyntaxKind.Identifier */, 20 /* SyntaxKind.OpenParenToken */, @@ -148525,7 +149861,7 @@ var ts; rule("SpaceAfterQuestionMarkInConditionalOperator", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext, isConditionalOperatorContext], 4 /* RuleAction.InsertSpace */), // in other cases there should be no space between '?' and next token rule("NoSpaceAfterQuestionMark", 57 /* SyntaxKind.QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeDot", anyToken, [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], [isNonJsxSameLineTokenContext, isNotPropertyAccessOnIntegerLiteral], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterDot", [24 /* SyntaxKind.DotToken */, 28 /* SyntaxKind.QuestionDotToken */], anyToken, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceBetweenImportParenInImportType", 100 /* SyntaxKind.ImportKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 16 /* RuleAction.DeleteSpace */), // Special handling of unary operators. @@ -148568,11 +149904,11 @@ var ts; // Though, we do extra check on the context to make sure we are dealing with get/set node. Example: // get x() {} // set x(val) {} - rule("SpaceAfterGetSetInMember", [136 /* SyntaxKind.GetKeyword */, 149 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterGetSetInMember", [137 /* SyntaxKind.GetKeyword */, 151 /* SyntaxKind.SetKeyword */], 79 /* SyntaxKind.Identifier */, [isFunctionDeclContext], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenYieldKeywordAndStar", 125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 16 /* RuleAction.DeleteSpace */), rule("SpaceBetweenYieldOrYieldStarAndOperand", [125 /* SyntaxKind.YieldKeyword */, 41 /* SyntaxKind.AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBetweenReturnAndSemicolon", 105 /* SyntaxKind.ReturnKeyword */, 26 /* SyntaxKind.SemicolonToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), - rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 132 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceAfterCertainKeywords", [113 /* SyntaxKind.VarKeyword */, 109 /* SyntaxKind.ThrowKeyword */, 103 /* SyntaxKind.NewKeyword */, 89 /* SyntaxKind.DeleteKeyword */, 105 /* SyntaxKind.ReturnKeyword */, 112 /* SyntaxKind.TypeOfKeyword */, 133 /* SyntaxKind.AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterLetConstInVariableDeclaration", [119 /* SyntaxKind.LetKeyword */, 85 /* SyntaxKind.ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 4 /* RuleAction.InsertSpace */), rule("NoSpaceBeforeOpenParenInFuncCall", anyToken, 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], 16 /* RuleAction.DeleteSpace */), // Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options. @@ -148580,8 +149916,8 @@ var ts; rule("SpaceAfterBinaryKeywordOperator", binaryKeywordOperators, anyToken, [isNonJsxSameLineTokenContext, isBinaryOpContext], 4 /* RuleAction.InsertSpace */), rule("SpaceAfterVoidOperator", 114 /* SyntaxKind.VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 4 /* RuleAction.InsertSpace */), // Async-await - rule("SpaceBetweenAsyncAndOpenParen", 131 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBetweenAsyncAndFunctionKeyword", 131 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndOpenParen", 132 /* SyntaxKind.AsyncKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenAsyncAndFunctionKeyword", 132 /* SyntaxKind.AsyncKeyword */, [98 /* SyntaxKind.FunctionKeyword */, 79 /* SyntaxKind.Identifier */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Template string rule("NoSpaceBetweenTagAndTemplateString", [79 /* SyntaxKind.Identifier */, 21 /* SyntaxKind.CloseParenToken */], [14 /* SyntaxKind.NoSubstitutionTemplateLiteral */, 15 /* SyntaxKind.TemplateHead */], [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // JSX opening elements @@ -148592,34 +149928,35 @@ var ts; rule("NoSpaceAfterEqualInJsxAttribute", 63 /* SyntaxKind.EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // TypeScript-specific rules // Use of module as a function call. e.g.: import m2 = module("m2"); - rule("NoSpaceAfterModuleImport", [141 /* SyntaxKind.ModuleKeyword */, 146 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceAfterModuleImport", [142 /* SyntaxKind.ModuleKeyword */, 147 /* SyntaxKind.RequireKeyword */], 20 /* SyntaxKind.OpenParenToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // Add a space around certain TypeScript keywords rule("SpaceAfterCertainTypeScriptKeywords", [ 126 /* SyntaxKind.AbstractKeyword */, + 127 /* SyntaxKind.AccessorKeyword */, 84 /* SyntaxKind.ClassKeyword */, - 135 /* SyntaxKind.DeclareKeyword */, + 136 /* SyntaxKind.DeclareKeyword */, 88 /* SyntaxKind.DefaultKeyword */, 92 /* SyntaxKind.EnumKeyword */, 93 /* SyntaxKind.ExportKeyword */, 94 /* SyntaxKind.ExtendsKeyword */, - 136 /* SyntaxKind.GetKeyword */, + 137 /* SyntaxKind.GetKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 100 /* SyntaxKind.ImportKeyword */, 118 /* SyntaxKind.InterfaceKeyword */, - 141 /* SyntaxKind.ModuleKeyword */, - 142 /* SyntaxKind.NamespaceKeyword */, + 142 /* SyntaxKind.ModuleKeyword */, + 143 /* SyntaxKind.NamespaceKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 123 /* SyntaxKind.PublicKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 145 /* SyntaxKind.ReadonlyKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 146 /* SyntaxKind.ReadonlyKeyword */, + 151 /* SyntaxKind.SetKeyword */, 124 /* SyntaxKind.StaticKeyword */, - 152 /* SyntaxKind.TypeKeyword */, - 156 /* SyntaxKind.FromKeyword */, - 140 /* SyntaxKind.KeyOfKeyword */, - 137 /* SyntaxKind.InferKeyword */, + 154 /* SyntaxKind.TypeKeyword */, + 158 /* SyntaxKind.FromKeyword */, + 141 /* SyntaxKind.KeyOfKeyword */, + 138 /* SyntaxKind.InferKeyword */, ], anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 156 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [94 /* SyntaxKind.ExtendsKeyword */, 117 /* SyntaxKind.ImplementsKeyword */, 158 /* SyntaxKind.FromKeyword */], [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" { rule("SpaceAfterModuleName", 10 /* SyntaxKind.StringLiteral */, 18 /* SyntaxKind.OpenBraceToken */, [isModuleDeclContext], 4 /* RuleAction.InsertSpace */), // Lambda expressions @@ -148650,8 +149987,8 @@ var ts; 123 /* SyntaxKind.PublicKeyword */, 121 /* SyntaxKind.PrivateKeyword */, 122 /* SyntaxKind.ProtectedKeyword */, - 136 /* SyntaxKind.GetKeyword */, - 149 /* SyntaxKind.SetKeyword */, + 137 /* SyntaxKind.GetKeyword */, + 151 /* SyntaxKind.SetKeyword */, 22 /* SyntaxKind.OpenBracketToken */, 41 /* SyntaxKind.AsteriskToken */, ], [isEndOfDecoratorContextOnSameLine], 4 /* RuleAction.InsertSpace */), @@ -148662,8 +149999,8 @@ var ts; // These rules are applied after high priority var userConfigurableRules = [ // Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses - rule("SpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), - rule("NoSpaceAfterConstructor", 134 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("SpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("NoSpaceAfterConstructor", 135 /* SyntaxKind.ConstructorKeyword */, 20 /* SyntaxKind.OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket, isNextTokenNotCloseParen], 4 /* RuleAction.InsertSpace */), rule("NoSpaceAfterComma", 27 /* SyntaxKind.CommaToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], 16 /* RuleAction.DeleteSpace */), // Insert space after function keyword for anonymous functions @@ -148737,11 +150074,11 @@ var ts; rule("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 18 /* SyntaxKind.OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 4 /* RuleAction.InsertSpace */, 1 /* RuleFlags.CanDeleteNewLines */), rule("NoSpaceBeforeComma", anyToken, 27 /* SyntaxKind.CommaToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), // No space before and after indexer `x[]` - rule("NoSpaceBeforeOpenBracket", anyTokenExcept(131 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), + rule("NoSpaceBeforeOpenBracket", anyTokenExcept(132 /* SyntaxKind.AsyncKeyword */, 82 /* SyntaxKind.CaseKeyword */), 22 /* SyntaxKind.OpenBracketToken */, [isNonJsxSameLineTokenContext], 16 /* RuleAction.DeleteSpace */), rule("NoSpaceAfterCloseBracket", 23 /* SyntaxKind.CloseBracketToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], 16 /* RuleAction.DeleteSpace */), rule("SpaceAfterSemicolon", 26 /* SyntaxKind.SemicolonToken */, anyToken, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Remove extra space between for and await - rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 132 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), + rule("SpaceBetweenForAndAwaitKeyword", 97 /* SyntaxKind.ForKeyword */, 133 /* SyntaxKind.AwaitKeyword */, [isNonJsxSameLineTokenContext], 4 /* RuleAction.InsertSpace */), // Add a space between statements. All keywords except (do,else,case) has open/close parens after them. // So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any] rule("SpaceBetweenStatements", [21 /* SyntaxKind.CloseParenToken */, 90 /* SyntaxKind.DoKeyword */, 91 /* SyntaxKind.ElseKeyword */, 82 /* SyntaxKind.CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 4 /* RuleAction.InsertSpace */), @@ -148790,69 +150127,70 @@ var ts; return function (context) { return context.options && context.options[optionName] === optionValue; }; } function isOptionEnabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !!context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !!context.options[optionName]; }; } function isOptionDisabled(optionName) { - return function (context) { return context.options && context.options.hasOwnProperty(optionName) && !context.options[optionName]; }; + return function (context) { return context.options && ts.hasProperty(context.options, optionName) && !context.options[optionName]; }; } function isOptionDisabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName]; }; } function isOptionDisabledOrUndefinedOrTokensOnSameLine(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !context.options[optionName] || context.TokensAreOnSameLine(); }; } function isOptionEnabledOrUndefined(optionName) { - return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; }; + return function (context) { return !context.options || !ts.hasProperty(context.options, optionName) || !!context.options[optionName]; }; } function isForContext(context) { - return context.contextNode.kind === 242 /* SyntaxKind.ForStatement */; + return context.contextNode.kind === 245 /* SyntaxKind.ForStatement */; } function isNotForContext(context) { return !isForContext(context); } function isBinaryOpContext(context) { switch (context.contextNode.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return context.contextNode.operatorToken.kind !== 27 /* SyntaxKind.CommaToken */; - case 222 /* SyntaxKind.ConditionalExpression */: - case 189 /* SyntaxKind.ConditionalType */: - case 229 /* SyntaxKind.AsExpression */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 177 /* SyntaxKind.TypePredicate */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 191 /* SyntaxKind.ConditionalType */: + case 231 /* SyntaxKind.AsExpression */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 179 /* SyntaxKind.TypePredicate */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; // equals in binding elements: function foo([[x, y] = [1, 2]]) - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // equals in type X = ... // falls through - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // equal in import a = module('a'); // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // equal in export = 1 // falls through - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // equal in let a = 0 // falls through - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // equal in p = 0 // falls through - case 164 /* SyntaxKind.Parameter */: - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // "in" keyword in for (let x in []) { } - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // "in" keyword in [P in keyof T]: T[P] // falls through - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return context.currentTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.nextTokenSpan.kind === 101 /* SyntaxKind.InKeyword */ || context.currentTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */ || context.nextTokenSpan.kind === 63 /* SyntaxKind.EqualsToken */; // Technically, "of" is not a binary operator, but format it the same way as "in" - case 244 /* SyntaxKind.ForOfStatement */: - return context.currentTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 160 /* SyntaxKind.OfKeyword */; + case 247 /* SyntaxKind.ForOfStatement */: + return context.currentTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */ || context.nextTokenSpan.kind === 162 /* SyntaxKind.OfKeyword */; } return false; } @@ -148864,22 +150202,22 @@ var ts; } function isTypeAnnotationContext(context) { var contextKind = context.contextNode.kind; - return contextKind === 167 /* SyntaxKind.PropertyDeclaration */ || - contextKind === 166 /* SyntaxKind.PropertySignature */ || - contextKind === 164 /* SyntaxKind.Parameter */ || - contextKind === 254 /* SyntaxKind.VariableDeclaration */ || + return contextKind === 169 /* SyntaxKind.PropertyDeclaration */ || + contextKind === 168 /* SyntaxKind.PropertySignature */ || + contextKind === 166 /* SyntaxKind.Parameter */ || + contextKind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isFunctionLikeKind(contextKind); } function isConditionalOperatorContext(context) { - return context.contextNode.kind === 222 /* SyntaxKind.ConditionalExpression */ || - context.contextNode.kind === 189 /* SyntaxKind.ConditionalType */; + return context.contextNode.kind === 224 /* SyntaxKind.ConditionalExpression */ || + context.contextNode.kind === 191 /* SyntaxKind.ConditionalType */; } function isSameLineTokenOrBeforeBlockContext(context) { return context.TokensAreOnSameLine() || isBeforeBlockContext(context); } function isBraceWrappedContext(context) { - return context.contextNode.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || - context.contextNode.kind === 195 /* SyntaxKind.MappedType */ || + return context.contextNode.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || + context.contextNode.kind === 197 /* SyntaxKind.MappedType */ || isSingleLineBlockContext(context); } // This check is done before an open brace in a control construct, a function, or a typescript block declaration @@ -148905,34 +150243,34 @@ var ts; return true; } switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 265 /* SyntaxKind.ModuleBlock */: return true; } return false; } function isFunctionDeclContext(context) { switch (context.contextNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // case SyntaxKind.MemberFunctionDeclaration: // falls through - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // case SyntaxKind.MethodSignature: // falls through - case 174 /* SyntaxKind.CallSignature */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: // case SyntaxKind.ConstructorDeclaration: // case SyntaxKind.SimpleArrowFunctionExpression: // case SyntaxKind.ParenthesizedArrowFunctionExpression: // falls through - case 258 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one + case 261 /* SyntaxKind.InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one return true; } return false; @@ -148941,40 +150279,40 @@ var ts; return !isFunctionDeclContext(context); } function isFunctionDeclarationOrFunctionExpressionContext(context) { - return context.contextNode.kind === 256 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 213 /* SyntaxKind.FunctionExpression */; + return context.contextNode.kind === 259 /* SyntaxKind.FunctionDeclaration */ || context.contextNode.kind === 215 /* SyntaxKind.FunctionExpression */; } function isTypeScriptDeclWithBlockContext(context) { return nodeIsTypeScriptDeclWithBlockContext(context.contextNode); } function nodeIsTypeScriptDeclWithBlockContext(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 182 /* SyntaxKind.TypeLiteral */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 273 /* SyntaxKind.NamedExports */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 269 /* SyntaxKind.NamedImports */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 276 /* SyntaxKind.NamedExports */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 272 /* SyntaxKind.NamedImports */: return true; } return false; } function isAfterCodeBlockContext(context) { switch (context.currentTokenParent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 292 /* SyntaxKind.CatchClause */: - case 262 /* SyntaxKind.ModuleBlock */: - case 249 /* SyntaxKind.SwitchStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 295 /* SyntaxKind.CatchClause */: + case 265 /* SyntaxKind.ModuleBlock */: + case 252 /* SyntaxKind.SwitchStatement */: return true; - case 235 /* SyntaxKind.Block */: { + case 238 /* SyntaxKind.Block */: { var blockParent = context.currentTokenParent.parent; // In a codefix scenario, we can't rely on parents being set. So just always return true. - if (!blockParent || blockParent.kind !== 214 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (!blockParent || blockParent.kind !== 216 /* SyntaxKind.ArrowFunction */ && blockParent.kind !== 215 /* SyntaxKind.FunctionExpression */) { return true; } } @@ -148983,32 +150321,32 @@ var ts; } function isControlDeclContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 248 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 251 /* SyntaxKind.WithStatement */: // TODO // case SyntaxKind.ElseClause: // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return true; default: return false; } } function isObjectContext(context) { - return context.contextNode.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return context.contextNode.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } function isFunctionCallContext(context) { - return context.contextNode.kind === 208 /* SyntaxKind.CallExpression */; + return context.contextNode.kind === 210 /* SyntaxKind.CallExpression */; } function isNewContext(context) { - return context.contextNode.kind === 209 /* SyntaxKind.NewExpression */; + return context.contextNode.kind === 211 /* SyntaxKind.NewExpression */; } function isFunctionCallOrNewContext(context) { return isFunctionCallContext(context) || isNewContext(context); @@ -149023,10 +150361,10 @@ var ts; return context.nextTokenSpan.kind !== 21 /* SyntaxKind.CloseParenToken */; } function isArrowFunctionContext(context) { - return context.contextNode.kind === 214 /* SyntaxKind.ArrowFunction */; + return context.contextNode.kind === 216 /* SyntaxKind.ArrowFunction */; } function isImportTypeContext(context) { - return context.contextNode.kind === 200 /* SyntaxKind.ImportType */; + return context.contextNode.kind === 202 /* SyntaxKind.ImportType */; } function isNonJsxSameLineTokenContext(context) { return context.TokensAreOnSameLine() && context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; @@ -149035,19 +150373,19 @@ var ts; return context.contextNode.kind !== 11 /* SyntaxKind.JsxText */; } function isNonJsxElementOrFragmentContext(context) { - return context.contextNode.kind !== 278 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 282 /* SyntaxKind.JsxFragment */; + return context.contextNode.kind !== 281 /* SyntaxKind.JsxElement */ && context.contextNode.kind !== 285 /* SyntaxKind.JsxFragment */; } function isJsxExpressionContext(context) { - return context.contextNode.kind === 288 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return context.contextNode.kind === 291 /* SyntaxKind.JsxExpression */ || context.contextNode.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } function isNextTokenParentJsxAttribute(context) { - return context.nextTokenParent.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.nextTokenParent.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxAttributeContext(context) { - return context.contextNode.kind === 285 /* SyntaxKind.JsxAttribute */; + return context.contextNode.kind === 288 /* SyntaxKind.JsxAttribute */; } function isJsxSelfClosingElementContext(context) { - return context.contextNode.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return context.contextNode.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } function isNotBeforeBlockInFunctionDeclarationContext(context) { return !isFunctionDeclContext(context) && !isBeforeBlockContext(context); @@ -149059,48 +150397,48 @@ var ts; !nodeIsInDecoratorContext(context.nextTokenParent); } function nodeIsInDecoratorContext(node) { - while (ts.isExpressionNode(node)) { + while (node && ts.isExpression(node)) { node = node.parent; } - return node.kind === 165 /* SyntaxKind.Decorator */; + return node && node.kind === 167 /* SyntaxKind.Decorator */; } function isStartOfVariableDeclarationList(context) { - return context.currentTokenParent.kind === 255 /* SyntaxKind.VariableDeclarationList */ && + return context.currentTokenParent.kind === 258 /* SyntaxKind.VariableDeclarationList */ && context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos; } function isNotFormatOnEnter(context) { return context.formattingRequestKind !== 2 /* FormattingRequestKind.FormatOnEnter */; } function isModuleDeclContext(context) { - return context.contextNode.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return context.contextNode.kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isObjectTypeContext(context) { - return context.contextNode.kind === 182 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; + return context.contextNode.kind === 184 /* SyntaxKind.TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration; } function isConstructorSignatureContext(context) { - return context.contextNode.kind === 175 /* SyntaxKind.ConstructSignature */; + return context.contextNode.kind === 177 /* SyntaxKind.ConstructSignature */; } function isTypeArgumentOrParameterOrAssertion(token, parent) { if (token.kind !== 29 /* SyntaxKind.LessThanToken */ && token.kind !== 31 /* SyntaxKind.GreaterThanToken */) { return false; } switch (parent.kind) { - case 178 /* SyntaxKind.TypeReference */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return true; default: return false; @@ -149111,28 +150449,28 @@ var ts; isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent); } function isTypeAssertionContext(context) { - return context.contextNode.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return context.contextNode.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } function isVoidOpContext(context) { - return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 217 /* SyntaxKind.VoidExpression */; + return context.currentTokenSpan.kind === 114 /* SyntaxKind.VoidKeyword */ && context.currentTokenParent.kind === 219 /* SyntaxKind.VoidExpression */; } function isYieldOrYieldStarWithOperand(context) { - return context.contextNode.kind === 224 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; + return context.contextNode.kind === 226 /* SyntaxKind.YieldExpression */ && context.contextNode.expression !== undefined; } function isNonNullAssertionContext(context) { - return context.contextNode.kind === 230 /* SyntaxKind.NonNullExpression */; + return context.contextNode.kind === 232 /* SyntaxKind.NonNullExpression */; } function isNotStatementConditionContext(context) { return !isStatementConditionContext(context); } function isStatementConditionContext(context) { switch (context.contextNode.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; default: return false; @@ -149157,12 +150495,12 @@ var ts; return nextTokenKind === 19 /* SyntaxKind.CloseBraceToken */ || nextTokenKind === 1 /* SyntaxKind.EndOfFileToken */; } - if (nextTokenKind === 234 /* SyntaxKind.SemicolonClassElement */ || + if (nextTokenKind === 237 /* SyntaxKind.SemicolonClassElement */ || nextTokenKind === 26 /* SyntaxKind.SemicolonToken */) { return false; } - if (context.contextNode.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - context.contextNode.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (context.contextNode.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + context.contextNode.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { // Can’t remove semicolon after `foo`; it would parse as a method declaration: // // interface I { @@ -149176,9 +150514,9 @@ var ts; if (ts.isPropertyDeclaration(context.currentTokenParent)) { return !context.currentTokenParent.initializer; } - return context.currentTokenParent.kind !== 242 /* SyntaxKind.ForStatement */ - && context.currentTokenParent.kind !== 236 /* SyntaxKind.EmptyStatement */ - && context.currentTokenParent.kind !== 234 /* SyntaxKind.SemicolonClassElement */ + return context.currentTokenParent.kind !== 245 /* SyntaxKind.ForStatement */ + && context.currentTokenParent.kind !== 239 /* SyntaxKind.EmptyStatement */ + && context.currentTokenParent.kind !== 237 /* SyntaxKind.SemicolonClassElement */ && nextTokenKind !== 22 /* SyntaxKind.OpenBracketToken */ && nextTokenKind !== 20 /* SyntaxKind.OpenParenToken */ && nextTokenKind !== 39 /* SyntaxKind.PlusToken */ @@ -149186,7 +150524,7 @@ var ts; && nextTokenKind !== 43 /* SyntaxKind.SlashToken */ && nextTokenKind !== 13 /* SyntaxKind.RegularExpressionLiteral */ && nextTokenKind !== 27 /* SyntaxKind.CommaToken */ - && nextTokenKind !== 223 /* SyntaxKind.TemplateExpression */ + && nextTokenKind !== 225 /* SyntaxKind.TemplateExpression */ && nextTokenKind !== 15 /* SyntaxKind.TemplateHead */ && nextTokenKind !== 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */ && nextTokenKind !== 24 /* SyntaxKind.DotToken */; @@ -149194,6 +150532,11 @@ var ts; function isSemicolonInsertionContext(context) { return ts.positionIsASICandidate(context.currentTokenSpan.end, context.currentTokenParent, context.sourceFile); } + function isNotPropertyAccessOnIntegerLiteral(context) { + return !ts.isPropertyAccessExpression(context.contextNode) + || !ts.isNumericLiteral(context.contextNode.expression) + || context.contextNode.expression.getText().indexOf(".") !== -1; + } })(formatting = ts.formatting || (ts.formatting = {})); })(ts || (ts = {})); /* @internal */ @@ -149277,12 +150620,12 @@ var ts; return map; } function getRuleBucketIndex(row, column) { - ts.Debug.assert(row <= 160 /* SyntaxKind.LastKeyword */ && column <= 160 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); + ts.Debug.assert(row <= 162 /* SyntaxKind.LastKeyword */ && column <= 162 /* SyntaxKind.LastKeyword */, "Must compute formatting context from tokens"); return (row * mapRowLength) + column; } var maskBitSize = 5; var mask = 31; // MaskBitSize bits - var mapRowLength = 160 /* SyntaxKind.LastToken */ + 1; + var mapRowLength = 162 /* SyntaxKind.LastToken */ + 1; var RulesPosition; (function (RulesPosition) { RulesPosition[RulesPosition["StopRulesSpecific"] = 0] = "StopRulesSpecific"; @@ -149470,17 +150813,17 @@ var ts; // i.e. parent is class declaration with the list of members and node is one of members. function isListElement(parent, node) { switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.rangeContainsRange(parent.members, node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var body = parent.body; - return !!body && body.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); - case 305 /* SyntaxKind.SourceFile */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + return !!body && body.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.rangeContainsRange(body.statements, node); + case 308 /* SyntaxKind.SourceFile */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return ts.rangeContainsRange(parent.statements, node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return ts.rangeContainsRange(parent.block.statements, node); } return false; @@ -149743,19 +151086,19 @@ var ts; return modifier.kind; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; - case 258 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; - case 256 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; - case 260 /* SyntaxKind.EnumDeclaration */: return 260 /* SyntaxKind.EnumDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: return 136 /* SyntaxKind.GetKeyword */; - case 173 /* SyntaxKind.SetAccessor */: return 149 /* SyntaxKind.SetKeyword */; - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return 84 /* SyntaxKind.ClassKeyword */; + case 261 /* SyntaxKind.InterfaceDeclaration */: return 118 /* SyntaxKind.InterfaceKeyword */; + case 259 /* SyntaxKind.FunctionDeclaration */: return 98 /* SyntaxKind.FunctionKeyword */; + case 263 /* SyntaxKind.EnumDeclaration */: return 263 /* SyntaxKind.EnumDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: return 137 /* SyntaxKind.GetKeyword */; + case 175 /* SyntaxKind.SetAccessor */: return 151 /* SyntaxKind.SetKeyword */; + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { return 41 /* SyntaxKind.AsteriskToken */; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: var name = ts.getNameOfDeclaration(node); if (name) { return name.kind; @@ -149812,15 +151155,15 @@ var ts; case 43 /* SyntaxKind.SlashToken */: case 31 /* SyntaxKind.GreaterThanToken */: switch (container.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return false; } break; case 22 /* SyntaxKind.OpenBracketToken */: case 23 /* SyntaxKind.CloseBracketToken */: - if (container.kind !== 195 /* SyntaxKind.MappedType */) { + if (container.kind !== 197 /* SyntaxKind.MappedType */) { return false; } break; @@ -149924,11 +151267,11 @@ var ts; return inheritedIndentation; } } - var effectiveParentStartLine = child.kind === 165 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; + var effectiveParentStartLine = child.kind === 167 /* SyntaxKind.Decorator */ ? childStartLine : undecoratedParentStartLine; var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine); processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); childContextNode = node; - if (isFirstListItem && parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { + if (isFirstListItem && parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && inheritedIndentation === -1 /* Constants.Unknown */) { inheritedIndentation = childIndentation.indentation; } return inheritedIndentation; @@ -150386,18 +151729,18 @@ var ts; formatting.getRangeOfEnclosingComment = getRangeOfEnclosingComment; function getOpenTokenForList(node, list) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -150405,8 +151748,8 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } @@ -150414,24 +151757,24 @@ var ts; return 20 /* SyntaxKind.OpenParenToken */; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (node.typeParameters === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 178 /* SyntaxKind.TypeReference */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 181 /* SyntaxKind.TypeQuery */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 200 /* SyntaxKind.ImportType */: + case 180 /* SyntaxKind.TypeReference */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 183 /* SyntaxKind.TypeQuery */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 202 /* SyntaxKind.ImportType */: if (node.typeArguments === list) { return 29 /* SyntaxKind.LessThanToken */; } break; - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return 18 /* SyntaxKind.OpenBraceToken */; } return 0 /* SyntaxKind.Unknown */; @@ -150567,11 +151910,11 @@ var ts; // y: undefined, // } // ``` - var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + var isObjectLiteral = currentToken.kind === 18 /* SyntaxKind.OpenBraceToken */ && currentToken.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; if (options.indentStyle === ts.IndentStyle.Block || isObjectLiteral) { return getBlockIndent(sourceFile, position, options); } - if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (precedingToken.kind === 27 /* SyntaxKind.CommaToken */ && precedingToken.parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options); if (actualIndentation !== -1 /* Value.Unknown */) { @@ -150581,7 +151924,7 @@ var ts; var containerList = getListByPosition(position, precedingToken.parent, sourceFile); // use list position if the preceding token is before any list items if (containerList && !ts.rangeContainsRange(containerList, precedingToken)) { - var useTheSameBaseIndentation = [213 /* SyntaxKind.FunctionExpression */, 214 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; + var useTheSameBaseIndentation = [215 /* SyntaxKind.FunctionExpression */, 216 /* SyntaxKind.ArrowFunction */].indexOf(currentToken.parent.kind) !== -1; var indentSize = useTheSameBaseIndentation ? 0 : options.indentSize; return getActualIndentationForListStartLine(containerList, sourceFile, options) + indentSize; // TODO: GH#18217 } @@ -150746,7 +152089,7 @@ var ts; // - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually // - parent and child are not on the same line var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) && - (parent.kind === 305 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); + (parent.kind === 308 /* SyntaxKind.SourceFile */ || !parentAndChildShareLine); if (!useActualIndentation) { return -1 /* Value.Unknown */; } @@ -150794,7 +152137,7 @@ var ts; } SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled; function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) { - if (parent.kind === 239 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { + if (parent.kind === 242 /* SyntaxKind.IfStatement */ && parent.elseStatement === child) { var elseKeyword = ts.findChildOfKind(parent, 91 /* SyntaxKind.ElseKeyword */, sourceFile); ts.Debug.assert(elseKeyword !== undefined); var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; @@ -150875,42 +152218,42 @@ var ts; } function getListByRange(start, end, node, sourceFile) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getList(node.typeArguments); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return getList(node.properties); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getList(node.elements); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return getList(node.members); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return getList(node.typeParameters) || getList(node.parameters); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return getList(node.parameters); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return getList(node.typeParameters); - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: return getList(node.typeArguments) || getList(node.arguments); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return getList(node.declarations); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return getList(node.elements); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return getList(node.elements); } function getList(list) { @@ -150933,7 +152276,7 @@ var ts; return findColumnForFirstNonWhitespaceCharacterInLine(sourceFile.getLineAndCharacterOfPosition(list.pos), sourceFile, options); } function getActualIndentationForListItem(node, sourceFile, options, listIndentsChild) { - if (node.parent && node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.parent && node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // VariableDeclarationList has no wrapping tokens return -1 /* Value.Unknown */; } @@ -151006,96 +152349,96 @@ var ts; function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) { var childKind = child ? child.kind : 0 /* SyntaxKind.Unknown */; switch (parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 195 /* SyntaxKind.MappedType */: - case 184 /* SyntaxKind.TupleType */: - case 263 /* SyntaxKind.CaseBlock */: - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 237 /* SyntaxKind.VariableStatement */: - case 271 /* SyntaxKind.ExportAssignment */: - case 247 /* SyntaxKind.ReturnStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 288 /* SyntaxKind.JsxExpression */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 164 /* SyntaxKind.Parameter */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 273 /* SyntaxKind.NamedExports */: - case 269 /* SyntaxKind.NamedImports */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 197 /* SyntaxKind.MappedType */: + case 186 /* SyntaxKind.TupleType */: + case 266 /* SyntaxKind.CaseBlock */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 240 /* SyntaxKind.VariableStatement */: + case 274 /* SyntaxKind.ExportAssignment */: + case 250 /* SyntaxKind.ReturnStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 291 /* SyntaxKind.JsxExpression */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 166 /* SyntaxKind.Parameter */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 276 /* SyntaxKind.NamedExports */: + case 272 /* SyntaxKind.NamedImports */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: - if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 205 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 + case 257 /* SyntaxKind.VariableDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: + if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // TODO: GH#18217 return rangeIsOnOneLine(sourceFile, child); } - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 278 /* SyntaxKind.JsxElement */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && sourceFile && child && childKind === 281 /* SyntaxKind.JsxElement */) { var parentStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, parent.pos)).line; var childStartLine = sourceFile.getLineAndCharacterOfPosition(ts.skipTrivia(sourceFile.text, child.pos)).line; return parentStartLine !== childStartLine; } - if (parent.kind !== 221 /* SyntaxKind.BinaryExpression */) { + if (parent.kind !== 223 /* SyntaxKind.BinaryExpression */) { return true; } break; - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return childKind !== 235 /* SyntaxKind.Block */; - case 214 /* SyntaxKind.ArrowFunction */: - if (sourceFile && childKind === 212 /* SyntaxKind.ParenthesizedExpression */) { + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return childKind !== 238 /* SyntaxKind.Block */; + case 216 /* SyntaxKind.ArrowFunction */: + if (sourceFile && childKind === 214 /* SyntaxKind.ParenthesizedExpression */) { return rangeIsOnOneLine(sourceFile, child); } - return childKind !== 235 /* SyntaxKind.Block */; - case 272 /* SyntaxKind.ExportDeclaration */: - return childKind !== 273 /* SyntaxKind.NamedExports */; - case 266 /* SyntaxKind.ImportDeclaration */: - return childKind !== 267 /* SyntaxKind.ImportClause */ || - (!!child.namedBindings && child.namedBindings.kind !== 269 /* SyntaxKind.NamedImports */); - case 278 /* SyntaxKind.JsxElement */: - return childKind !== 281 /* SyntaxKind.JsxClosingElement */; - case 282 /* SyntaxKind.JsxFragment */: - return childKind !== 284 /* SyntaxKind.JsxClosingFragment */; - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: - if (childKind === 182 /* SyntaxKind.TypeLiteral */ || childKind === 184 /* SyntaxKind.TupleType */) { + return childKind !== 238 /* SyntaxKind.Block */; + case 275 /* SyntaxKind.ExportDeclaration */: + return childKind !== 276 /* SyntaxKind.NamedExports */; + case 269 /* SyntaxKind.ImportDeclaration */: + return childKind !== 270 /* SyntaxKind.ImportClause */ || + (!!child.namedBindings && child.namedBindings.kind !== 272 /* SyntaxKind.NamedImports */); + case 281 /* SyntaxKind.JsxElement */: + return childKind !== 284 /* SyntaxKind.JsxClosingElement */; + case 285 /* SyntaxKind.JsxFragment */: + return childKind !== 287 /* SyntaxKind.JsxClosingFragment */; + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + if (childKind === 184 /* SyntaxKind.TypeLiteral */ || childKind === 186 /* SyntaxKind.TupleType */) { return false; } break; @@ -151106,11 +152449,11 @@ var ts; SmartIndenter.nodeWillIndentChild = nodeWillIndentChild; function isControlFlowEndingStatement(kind, parent) { switch (kind) { - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return parent.kind !== 235 /* SyntaxKind.Block */; + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + return parent.kind !== 238 /* SyntaxKind.Block */; default: return false; } @@ -151327,7 +152670,7 @@ var ts; * Checks if 'candidate' argument is a legal separator in the list that contains 'node' as an element */ function isSeparator(node, candidate) { - return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)); + return !!candidate && !!node.parent && (candidate.kind === 27 /* SyntaxKind.CommaToken */ || (candidate.kind === 26 /* SyntaxKind.SemicolonToken */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)); } function isThisTypeAnnotatable(containingFunction) { return ts.isFunctionExpression(containingFunction) || ts.isFunctionDeclaration(containingFunction); @@ -151559,7 +152902,7 @@ var ts; } } else { - endNode = (_a = (node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; + endNode = (_a = (node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node.exclamationToken : node.questionToken)) !== null && _a !== void 0 ? _a : node.name; } this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " }); return true; @@ -151725,18 +153068,18 @@ var ts; }; ChangeTracker.prototype.getInsertNodeAfterOptionsWorker = function (node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return { prefix: this.newLineCharacter, suffix: this.newLineCharacter }; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: case 10 /* SyntaxKind.StringLiteral */: case 79 /* SyntaxKind.Identifier */: return { prefix: ", " }; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return { suffix: "," + this.newLineCharacter }; case 93 /* SyntaxKind.ExportKeyword */: return { prefix: " " }; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return {}; default: ts.Debug.assert(ts.isStatement(node) || ts.isClassOrTypeElement(node)); // Else we haven't handled this kind of node yet -- add it @@ -151745,7 +153088,7 @@ var ts; }; ChangeTracker.prototype.insertName = function (sourceFile, node, name) { ts.Debug.assert(!node.name); - if (node.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind === 216 /* SyntaxKind.ArrowFunction */) { var arrow = ts.findChildOfKind(node, 38 /* SyntaxKind.EqualsGreaterThanToken */, sourceFile); var lparen = ts.findChildOfKind(node, 20 /* SyntaxKind.OpenParenToken */, sourceFile); if (lparen) { @@ -151759,14 +153102,14 @@ var ts; // Replacing full range of arrow to get rid of the leading space -- replace ` =>` with `)` this.replaceRange(sourceFile, arrow, ts.factory.createToken(21 /* SyntaxKind.CloseParenToken */)); } - if (node.body.kind !== 235 /* SyntaxKind.Block */) { + if (node.body.kind !== 238 /* SyntaxKind.Block */) { // `() => 0` => `function f() { return 0; }` this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.factory.createToken(18 /* SyntaxKind.OpenBraceToken */), ts.factory.createToken(105 /* SyntaxKind.ReturnKeyword */)], { joiner: " ", suffix: " " }); this.insertNodesAt(sourceFile, node.body.end, [ts.factory.createToken(26 /* SyntaxKind.SemicolonToken */), ts.factory.createToken(19 /* SyntaxKind.CloseBraceToken */)], { joiner: " " }); } } else { - var pos = ts.findChildOfKind(node, node.kind === 213 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; + var pos = ts.findChildOfKind(node, node.kind === 215 /* SyntaxKind.FunctionExpression */ ? 98 /* SyntaxKind.FunctionKeyword */ : 84 /* SyntaxKind.ClassKeyword */, sourceFile).end; this.insertNodeAt(sourceFile, pos, ts.factory.createIdentifier(name), { prefix: " " }); } }; @@ -151943,10 +153286,10 @@ var ts; }()); textChanges_3.ChangeTracker = ChangeTracker; function updateJSDocHost(parent) { - if (parent.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (parent.kind !== 216 /* SyntaxKind.ArrowFunction */) { return parent; } - var jsDocNode = parent.parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ ? + var jsDocNode = parent.parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ ? parent.parent : parent.parent.parent; jsDocNode.jsDoc = parent.jsDoc; @@ -151958,16 +153301,16 @@ var ts; return undefined; } switch (oldTag.kind) { - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 343 /* SyntaxKind.JSDocParameterTag */: { var oldParam = oldTag; var newParam = newTag; return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText ? ts.factory.createJSDocParameterTag(/*tagName*/ undefined, newParam.name, /*isBracketed*/ false, newParam.typeExpression, newParam.isNameFirst, oldParam.comment) : undefined; } - case 341 /* SyntaxKind.JSDocReturnTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: return ts.factory.createJSDocReturnTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return ts.factory.createJSDocTypeTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment); } } @@ -151975,6 +153318,26 @@ var ts; function startPositionToDeleteNodeInList(sourceFile, node) { return ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, { leadingTriviaOption: LeadingTriviaOption.IncludeAll }), /*stopAfterLineBreak*/ false, /*stopAtComments*/ true); } + function endPositionToDeleteNodeInList(sourceFile, node, prevNode, nextNode) { + var end = startPositionToDeleteNodeInList(sourceFile, nextNode); + if (prevNode === undefined || ts.positionsAreOnSameLine(getAdjustedEndPosition(sourceFile, node, {}), end, sourceFile)) { + return end; + } + var token = ts.findPrecedingToken(nextNode.getStart(sourceFile), sourceFile); + if (isSeparator(node, token)) { + var prevToken = ts.findPrecedingToken(node.getStart(sourceFile), sourceFile); + if (isSeparator(prevNode, prevToken)) { + var pos = ts.skipTrivia(sourceFile.text, token.getEnd(), /*stopAfterLineBreak*/ true, /*stopAtComments*/ true); + if (ts.positionsAreOnSameLine(prevToken.getStart(sourceFile), token.getStart(sourceFile), sourceFile)) { + return ts.isLineBreak(sourceFile.text.charCodeAt(pos - 1)) ? pos - 1 : pos; + } + if (ts.isLineBreak(sourceFile.text.charCodeAt(pos))) { + return pos; + } + } + } + return end; + } function getClassOrObjectBraceEnds(cls, sourceFile) { var open = ts.findChildOfKind(cls, 18 /* SyntaxKind.OpenBraceToken */, sourceFile); var close = ts.findChildOfKind(cls, 19 /* SyntaxKind.CloseBraceToken */, sourceFile); @@ -152361,14 +153724,14 @@ var ts; } textChanges_3.isValidLocationToAddComment = isValidLocationToAddComment; function needSemicolonBetween(a, b) { - return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[` } var deleteDeclaration; (function (deleteDeclaration_1) { function deleteDeclaration(changes, deletedNodesInLists, sourceFile, node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: { + case 166 /* SyntaxKind.Parameter */: { var oldFunction = node.parent; if (ts.isArrowFunction(oldFunction) && oldFunction.parameters.length === 1 && @@ -152383,17 +153746,17 @@ var ts; } break; } - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: var isFirstImport = sourceFile.imports.length && node === ts.first(sourceFile.imports).parent || node === ts.find(sourceFile.statements, ts.isAnyImportSyntax); // For first import, leave header comment in place, otherwise only delete JSDoc comments deleteNode(changes, sourceFile, node, { leadingTriviaOption: isFirstImport ? LeadingTriviaOption.Exclude : ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine, }); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: var pattern = node.parent; - var preserveComma = pattern.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); + var preserveComma = pattern.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && node !== ts.last(pattern.elements); if (preserveComma) { deleteNode(changes, sourceFile, node); } @@ -152401,13 +153764,13 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: var namedImports = node.parent; if (namedImports.elements.length === 1) { deleteImportBinding(changes, sourceFile, namedImports); @@ -152416,7 +153779,7 @@ var ts; deleteNodeInList(changes, deletedNodesInLists, sourceFile, node); } break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: deleteImportBinding(changes, sourceFile, node); break; case 26 /* SyntaxKind.SemicolonToken */: @@ -152425,8 +153788,8 @@ var ts; case 98 /* SyntaxKind.FunctionKeyword */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: LeadingTriviaOption.Exclude }); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: deleteNode(changes, sourceFile, node, { leadingTriviaOption: ts.hasJSDocNodes(node) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -152477,13 +153840,13 @@ var ts; // Delete the entire import declaration // |import * as ns from './file'| // |import { a } from './file'| - var importDecl = ts.getAncestor(node, 266 /* SyntaxKind.ImportDeclaration */); + var importDecl = ts.getAncestor(node, 269 /* SyntaxKind.ImportDeclaration */); deleteNode(changes, sourceFile, importDecl); } } function deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node) { var parent = node.parent; - if (parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (parent.kind === 295 /* SyntaxKind.CatchClause */) { // TODO: There's currently no unused diagnostic for this, could be a suggestion changes.deleteNodeRange(sourceFile, ts.findChildOfKind(parent, 20 /* SyntaxKind.OpenParenToken */, sourceFile), ts.findChildOfKind(parent, 21 /* SyntaxKind.CloseParenToken */, sourceFile)); return; @@ -152494,14 +153857,14 @@ var ts; } var gp = parent.parent; switch (gp.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: changes.replaceNode(sourceFile, node, ts.factory.createObjectLiteralExpression()); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: deleteNode(changes, sourceFile, parent); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: deleteNode(changes, sourceFile, gp, { leadingTriviaOption: ts.hasJSDocNodes(gp) ? LeadingTriviaOption.JSDoc : LeadingTriviaOption.StartLine }); break; default: @@ -152532,7 +153895,7 @@ var ts; deletedNodesInLists.add(node); changes.deleteRange(sourceFile, { pos: startPositionToDeleteNodeInList(sourceFile, node), - end: index === containingList.length - 1 ? getAdjustedEndPosition(sourceFile, node, {}) : startPositionToDeleteNodeInList(sourceFile, containingList[index + 1]), + end: index === containingList.length - 1 ? getAdjustedEndPosition(sourceFile, node, {}) : endPositionToDeleteNodeInList(sourceFile, node, containingList[index - 1], containingList[index + 1]), }); } })(textChanges = ts.textChanges || (ts.textChanges = {})); @@ -152688,8 +154051,8 @@ var ts; }); function makeChange(changeTracker, sourceFile, assertion) { var replacement = ts.isAsExpression(assertion) - ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)) - : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), assertion.expression); + ? ts.factory.createAsExpression(assertion.expression, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)) + : ts.factory.createTypeAssertion(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), assertion.expression); changeTracker.replaceNode(sourceFile, assertion.expression, replacement); } function getAssertion(sourceFile, pos) { @@ -152773,7 +154136,7 @@ var ts; } } fixedDeclarations === null || fixedDeclarations === void 0 ? void 0 : fixedDeclarations.add(ts.getNodeId(insertionSite)); - var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 256 /* ModifierFlags.Async */))); + var cloneWithModifier = ts.factory.updateModifiers(ts.getSynthesizedDeepClone(insertionSite, /*includeTrivia*/ true), ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(ts.getSyntacticModifierFlags(insertionSite) | 512 /* ModifierFlags.Async */))); changeTracker.replaceNode(sourceFile, insertionSite, cloneWithModifier); } function getFixableErrorSpanDeclaration(sourceFile, span) { @@ -152819,7 +154182,7 @@ var ts; ts.Diagnostics.The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_type_1.code, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2.code, - ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap.code, + ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap.code, ts.Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined.code, ts.Diagnostics.Type_0_is_not_an_array_type.code, ts.Diagnostics.Type_0_is_not_an_array_type_or_a_string_type.code, @@ -152917,7 +154280,7 @@ var ts; } var declaration = ts.tryCast(symbol.valueDeclaration, ts.isVariableDeclaration); var variableName = declaration && ts.tryCast(declaration.name, ts.isIdentifier); - var variableStatement = ts.getAncestor(declaration, 237 /* SyntaxKind.VariableStatement */); + var variableStatement = ts.getAncestor(declaration, 240 /* SyntaxKind.VariableStatement */); if (!declaration || !variableStatement || declaration.type || !declaration.initializer || @@ -152995,13 +154358,22 @@ var ts; function isInsideAwaitableBody(node) { return node.kind & 32768 /* NodeFlags.AwaitContext */ || !!ts.findAncestor(node, function (ancestor) { return ancestor.parent && ts.isArrowFunction(ancestor.parent) && ancestor.parent.body === ancestor || - ts.isBlock(ancestor) && (ancestor.parent.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - ancestor.parent.kind === 213 /* SyntaxKind.FunctionExpression */ || - ancestor.parent.kind === 214 /* SyntaxKind.ArrowFunction */ || - ancestor.parent.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.isBlock(ancestor) && (ancestor.parent.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + ancestor.parent.kind === 215 /* SyntaxKind.FunctionExpression */ || + ancestor.parent.kind === 216 /* SyntaxKind.ArrowFunction */ || + ancestor.parent.kind === 171 /* SyntaxKind.MethodDeclaration */); }); } function makeChange(changeTracker, errorCode, sourceFile, checker, insertionSite, fixedDeclarations) { + if (ts.isForOfStatement(insertionSite.parent) && !insertionSite.parent.awaitModifier) { + var exprType = checker.getTypeAtLocation(insertionSite); + var asyncIter = checker.getAsyncIterableType(); + if (asyncIter && checker.isTypeAssignableTo(exprType, asyncIter)) { + var forOf = insertionSite.parent; + changeTracker.replaceNode(sourceFile, forOf, ts.factory.updateForOfStatement(forOf, ts.factory.createToken(133 /* SyntaxKind.AwaitKeyword */), forOf.initializer, forOf.expression, forOf.statement)); + return; + } + } if (ts.isBinaryExpression(insertionSite)) { for (var _i = 0, _a = [insertionSite.left, insertionSite.right]; _i < _a.length; _i++) { var side = _a[_i]; @@ -153117,10 +154489,10 @@ var ts; function isPossiblyPartOfDestructuring(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return true; default: return false; @@ -153135,7 +154507,7 @@ var ts; function isPossiblyPartOfCommaSeperatedInitializer(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: case 27 /* SyntaxKind.CommaToken */: return true; default: @@ -153184,9 +154556,9 @@ var ts; return; } var declaration = token.parent; - if (declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + if (declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && (!fixedNodes || ts.tryAddToSet(fixedNodes, declaration))) { - changeTracker.insertModifierBefore(sourceFile, 135 /* SyntaxKind.DeclareKeyword */, declaration); + changeTracker.insertModifierBefore(sourceFile, 136 /* SyntaxKind.DeclareKeyword */, declaration); } } })(codefix = ts.codefix || (ts.codefix = {})); @@ -153340,7 +154712,7 @@ var ts; var add = toAdd_1[_i]; var d = add.valueDeclaration; if (d && (ts.isPropertySignature(d) || ts.isPropertyDeclaration(d)) && d.type) { - var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 187 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ + var t = ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], d.type.kind === 189 /* SyntaxKind.UnionType */ ? d.type.types : [d.type], true), [ ts.factory.createTypeReferenceNode("undefined") ], false)); changes.replaceNode(d.getSourceFile(), d.type, t); @@ -153420,26 +154792,26 @@ var ts; } function isDeclarationWithType(node) { return ts.isFunctionLikeDeclaration(node) || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } function transformJSDocType(node) { switch (node.kind) { - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return ts.factory.createTypeReferenceNode("any", ts.emptyArray); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return transformJSDocOptionalType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return transformJSDocType(node.type); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return transformJSDocNullableType(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return transformJSDocVariadicType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return transformJSDocFunctionType(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return transformJSDocTypeReference(node); default: var visited = ts.visitEachChild(node, transformJSDocType, ts.nullTransformationContext); @@ -153460,11 +154832,11 @@ var ts; var _a; // TODO: This does not properly handle `function(new:C, string)` per https://github.com/google/closure-compiler/wiki/Types-in-the-Closure-Type-System#the-javascript-type-language // however we do handle it correctly in `serializeTypeForDeclaration` in checker.ts - return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + return ts.factory.createFunctionTypeNode(ts.emptyArray, node.parameters.map(transformJSDocParameter), (_a = node.type) !== null && _a !== void 0 ? _a : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } function transformJSDocParameter(node) { var index = node.parent.parameters.indexOf(node); - var isRest = node.type.kind === 318 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 + var isRest = node.type.kind === 321 /* SyntaxKind.JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217 var name = node.name || (isRest ? "rest" : "arg" + index); var dotdotdot = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : node.dotDotDotToken; return ts.factory.createParameterDeclaration(node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer); @@ -153503,8 +154875,8 @@ var ts; function transformJSDocIndexSignature(node) { var index = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, - /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "n" : "s", - /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), + /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "n" : "s", + /*questionToken*/ undefined, ts.factory.createTypeReferenceNode(node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */ ? "number" : "string", []), /*initializer*/ undefined); var indexSignature = ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature(/*modifiers*/ undefined, [index], node.typeArguments[1])]); ts.setEmitFlags(indexSignature, 1 /* EmitFlags.SingleLine */); @@ -153539,8 +154911,8 @@ var ts; return undefined; } var ctorDeclaration = ctorSymbol.valueDeclaration; - if (ts.isFunctionDeclaration(ctorDeclaration)) { - changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunctionDeclaration(ctorDeclaration)); + if (ts.isFunctionDeclaration(ctorDeclaration) || ts.isFunctionExpression(ctorDeclaration)) { + changes.replaceNode(sourceFile, ctorDeclaration, createClassFromFunction(ctorDeclaration)); } else if (ts.isVariableDeclaration(ctorDeclaration)) { var classDeclaration = createClassFromVariableDeclaration(ctorDeclaration); @@ -153644,7 +155016,7 @@ var ts; return; } // delete the entire statement if this expression is the sole expression to take care of the semicolon at the end - var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ + var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ ? assignmentBinaryExpression.parent : assignmentBinaryExpression; changes.delete(sourceFile, nodeToDelete); if (!assignmentExpr) { @@ -153696,7 +155068,7 @@ var ts; return createArrowFunctionExpressionMember(members, expression, name); } function createFunctionExpressionMember(members, functionExpression, name) { - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -153707,14 +155079,14 @@ var ts; var arrowFunctionBody = arrowFunction.body; var bodyBlock; // case 1: () => { return [1,2,3] } - if (arrowFunctionBody.kind === 235 /* SyntaxKind.Block */) { + if (arrowFunctionBody.kind === 238 /* SyntaxKind.Block */) { bodyBlock = arrowFunctionBody; } // case 2: () => [1,2,3] else { bodyBlock = ts.factory.createBlock([ts.factory.createReturnStatement(arrowFunctionBody)]); } - var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 131 /* SyntaxKind.AsyncKeyword */)); + var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 132 /* SyntaxKind.AsyncKeyword */)); var method = ts.factory.createMethodDeclaration(fullModifiers, /*asteriskToken*/ undefined, name, /*questionToken*/ undefined, /*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock); ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile); @@ -153737,7 +155109,7 @@ var ts; // Don't call copyComments here because we'll already leave them in place return cls; } - function createClassFromFunctionDeclaration(node) { + function createClassFromFunction(node) { var memberElements = createClassElementsFromSymbol(ctorSymbol); if (node.body) { memberElements.unshift(ts.factory.createConstructorDeclaration(/*modifiers*/ undefined, node.parameters, node.body)); @@ -153827,7 +155199,7 @@ var ts; return; } var pos = ts.skipTrivia(sourceFile.text, ts.moveRangePastModifiers(functionToConvert).pos); - changes.insertModifierAt(sourceFile, pos, 131 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); + changes.insertModifierAt(sourceFile, pos, 132 /* SyntaxKind.AsyncKeyword */, { suffix: " " }); var _loop_12 = function (returnStatement) { ts.forEachChild(returnStatement, function visit(node) { if (ts.isCallExpression(node)) { @@ -154233,7 +155605,7 @@ var ts; case 104 /* SyntaxKind.NullKeyword */: // do not produce a transformed statement for a null argument break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 79 /* SyntaxKind.Identifier */: // identifier includes undefined if (!inputArgName) { // undefined was argument passed to promise handler @@ -154255,8 +155627,8 @@ var ts; continuationArgName.types.push(transformer.checker.getAwaitedType(returnType) || returnType); } return varDeclOrAssignment; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: { + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: { var funcBody = func.body; var returnType_1 = (_a = getLastCallSignature(transformer.checker.getTypeAtLocation(func), transformer.checker)) === null || _a === void 0 ? void 0 : _a.getReturnType(); // Arrow functions with block bodies { } will enter this control flow @@ -154425,7 +155797,7 @@ var ts; name = getMapEntryOrDefault(funcNode.name); } // return undefined argName when arg is null or undefined - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (!name || "identifier" in name && name.identifier.text === "undefined") { return undefined; } @@ -154534,10 +155906,10 @@ var ts; } var importNode = ts.importFromModuleSpecifier(moduleSpecifier); switch (importNode.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.replaceNode(importingFile, importNode, ts.makeImport(importNode.name, /*namedImports*/ undefined, moduleSpecifier, quotePreference)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isRequireCall(importNode, /*checkArgumentIsStringLiteralLike*/ false)) { changes.replaceNode(importingFile, importNode, ts.factory.createPropertyAccessExpression(ts.getSynthesizedDeepClone(importNode), "default")); } @@ -154604,20 +155976,20 @@ var ts; } function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, useSitesToUnqualify, quotePreference) { switch (statement.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference); return false; - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; switch (expression.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { if (ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true)) { // For side-effecting require() call, just make a side-effecting import. changes.replaceNode(sourceFile, statement, ts.makeImport(/*name*/ undefined, /*namedImports*/ undefined, expression.arguments[0], quotePreference)); } return false; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var operatorToken = expression.operatorToken; return operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports, useSitesToUnqualify); } @@ -154666,8 +156038,8 @@ var ts; /** Converts `const name = require("moduleSpecifier").propertyName` */ function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: { // `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;` var tmp = makeUniqueName(propertyName, identifiers); return convertedImports([ @@ -154718,16 +156090,16 @@ var ts; function tryChangeModuleExportsObject(object, useSitesToUnqualify) { var statements = ts.mapAllOrFail(object.properties, function (prop) { switch (prop.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`. // falls through - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return undefined; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer, useSitesToUnqualify); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)], prop, useSitesToUnqualify); default: ts.Debug.assertNever(prop, "Convert to ES6 got invalid prop kind ".concat(prop.kind)); @@ -154791,7 +156163,7 @@ var ts; function convertExportsDotXEquals_replaceNode(name, exported, useSitesToUnqualify) { var modifiers = [ts.factory.createToken(93 /* SyntaxKind.ExportKeyword */)]; switch (exported.kind) { - case 213 /* SyntaxKind.FunctionExpression */: { + case 215 /* SyntaxKind.FunctionExpression */: { var expressionName = exported.name; if (expressionName && expressionName.text !== name) { // `exports.f = function g() {}` -> `export const f = function g() {}` @@ -154799,10 +156171,10 @@ var ts; } } // falls through - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // `exports.f = function() {}` --> `export function f() {}` return functionExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // `exports.C = class {}` --> `export class C {}` return classExpressionToDeclaration(name, modifiers, exported, useSitesToUnqualify); default: @@ -154822,7 +156194,7 @@ var ts; : ts.getSynthesizedDeepCloneWithReplacements(nodeOrNodes, /*includeTrivia*/ true, replaceNode); function replaceNode(original) { // We are replacing `mod.SomeExport` wih `SomeExport`, so we only need to look at PropertyAccessExpressions - if (original.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (original.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var replacement = useSitesToUnqualify.get(original); // Remove entry from `useSitesToUnqualify` so the refactor knows it's taken care of by the parent statement we're replacing useSitesToUnqualify.delete(original); @@ -154837,7 +156209,7 @@ var ts; */ function convertSingleImport(name, moduleSpecifier, checker, identifiers, target, quotePreference) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { var importSpecifiers = ts.mapAllOrFail(name.elements, function (e) { return e.dotDotDotToken || e.initializer || e.propertyName && !ts.isIdentifier(e.propertyName) || !ts.isIdentifier(e.name) ? undefined @@ -154848,7 +156220,7 @@ var ts; } } // falls through -- object destructuring has an interesting pattern and must be a variable declaration - case 202 /* SyntaxKind.ArrayBindingPattern */: { + case 204 /* SyntaxKind.ArrayBindingPattern */: { /* import x from "x"; const [a, b, c] = x; @@ -154941,11 +156313,11 @@ var ts; function isFreeIdentifier(node) { var parent = node.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return parent.propertyName !== node; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return parent.propertyName !== node; default: return true; @@ -155056,7 +156428,7 @@ var ts; var exportDeclaration = exportClause.parent; var typeExportSpecifiers = getTypeExportSpecifiers(exportSpecifier, context); if (typeExportSpecifiers.length === exportClause.elements.length) { - changes.insertModifierBefore(context.sourceFile, 152 /* SyntaxKind.TypeKeyword */, exportClause); + changes.insertModifierBefore(context.sourceFile, 154 /* SyntaxKind.TypeKeyword */, exportClause); } else { var valueExportDeclaration = ts.factory.updateExportDeclaration(exportDeclaration, exportDeclaration.modifiers, @@ -155292,27 +156664,29 @@ var ts; errorCodes: errorCodes, getCodeActions: function (context) { var errorCode = context.errorCode, preferences = context.preferences, sourceFile = context.sourceFile, span = context.span, program = context.program; - var info = getFixesInfo(context, errorCode, span.start, /*useAutoImportProvider*/ true); + var info = getFixInfos(context, errorCode, span.start, /*useAutoImportProvider*/ true); if (!info) return undefined; - var fixes = info.fixes, symbolName = info.symbolName, errorIdentifierText = info.errorIdentifierText; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - return fixes.map(function (fix) { return codeActionForFix(context, sourceFile, symbolName, fix, - /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); }); + return info.map(function (_a) { + var fix = _a.fix, symbolName = _a.symbolName, errorIdentifierText = _a.errorIdentifierText; + return codeActionForFix(context, sourceFile, symbolName, fix, + /*includeSymbolNameInDescription*/ symbolName !== errorIdentifierText, quotePreference, program.getCompilerOptions()); + }); }, fixIds: [importFixId], getAllCodeActions: function (context) { - var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host; - var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host); + var sourceFile = context.sourceFile, program = context.program, preferences = context.preferences, host = context.host, cancellationToken = context.cancellationToken; + var importAdder = createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ true, preferences, host, cancellationToken); codefix.eachDiagnostic(context, errorCodes, function (diag) { return importAdder.addImportFromDiagnostic(diag, context); }); return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, importAdder.writeFixes)); }, }); - function createImportAdder(sourceFile, program, preferences, host) { - return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host); + function createImportAdder(sourceFile, program, preferences, host, cancellationToken) { + return createImportAdderWorker(sourceFile, program, /*useAutoImportProvider*/ false, preferences, host, cancellationToken); } codefix.createImportAdder = createImportAdder; - function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host) { + function createImportAdderWorker(sourceFile, program, useAutoImportProvider, preferences, host, cancellationToken) { var compilerOptions = program.getCompilerOptions(); // Namespace fixes don't conflict, so just build a list. var addToNamespace = []; @@ -155323,27 +156697,26 @@ var ts; var newImports = new ts.Map(); return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes }; function addImportFromDiagnostic(diagnostic, context) { - var info = getFixesInfo(context, diagnostic.code, diagnostic.start, useAutoImportProvider); - if (!info || !info.fixes.length) + var info = getFixInfos(context, diagnostic.code, diagnostic.start, useAutoImportProvider); + if (!info || !info.length) return; - addImport(info); + addImport(ts.first(info)); } function addImportFromExportedSymbol(exportedSymbol, isValidTypeOnlyUseSite) { var moduleSymbol = ts.Debug.checkDefined(exportedSymbol.parent); var symbolName = ts.getNameForExportedSymbol(exportedSymbol, ts.getEmitScriptTarget(compilerOptions)); var checker = program.getTypeChecker(); var symbol = checker.getMergedSymbol(ts.skipAlias(exportedSymbol, checker)); - var exportInfo = getAllReExportingModules(sourceFile, symbol, moduleSymbol, symbolName, /*isJsxTagName*/ false, host, program, preferences, useAutoImportProvider); + var exportInfo = getAllExportInfoForSymbol(sourceFile, symbol, symbolName, /*isJsxTagName*/ false, program, host, preferences, cancellationToken); var useRequire = shouldUseRequire(sourceFile, program); - var fix = getImportFixForSymbol(sourceFile, exportInfo, moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); + var fix = getImportFixForSymbol(sourceFile, ts.Debug.checkDefined(exportInfo), moduleSymbol, program, /*useNamespaceInfo*/ undefined, !!isValidTypeOnlyUseSite, useRequire, host, preferences); if (fix) { - addImport({ fixes: [fix], symbolName: symbolName, errorIdentifierText: undefined }); + addImport({ fix: fix, symbolName: symbolName, errorIdentifierText: undefined }); } } function addImport(info) { var _a, _b; - var fixes = info.fixes, symbolName = info.symbolName; - var fix = ts.first(fixes); + var fix = info.fix, symbolName = info.symbolName; switch (fix.kind) { case 0 /* ImportFixKind.UseNamespace */: addToNamespace.push(fix); @@ -155510,11 +156883,12 @@ var ts; AddAsTypeOnly[AddAsTypeOnly["Required"] = 2] = "Required"; AddAsTypeOnly[AddAsTypeOnly["NotAllowed"] = 4] = "NotAllowed"; })(AddAsTypeOnly || (AddAsTypeOnly = {})); - function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences) { + function getImportCompletionAction(targetSymbol, moduleSymbol, sourceFile, symbolName, isJsxTagName, host, program, formatContext, position, preferences, cancellationToken) { var compilerOptions = program.getCompilerOptions(); var exportInfos = ts.pathIsBareSpecifier(ts.stripQuotes(moduleSymbol.name)) - ? [getSymbolExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] - : getAllReExportingModules(sourceFile, targetSymbol, moduleSymbol, symbolName, isJsxTagName, host, program, preferences, /*useAutoImportProvider*/ true); + ? [getSingleExportInfoForSymbol(targetSymbol, moduleSymbol, program, host)] + : getAllExportInfoForSymbol(sourceFile, targetSymbol, symbolName, isJsxTagName, program, host, preferences, cancellationToken); + ts.Debug.assertIsDefined(exportInfos); var useRequire = shouldUseRequire(sourceFile, program); var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(ts.getTokenAtPosition(sourceFile, position)); var fix = ts.Debug.checkDefined(getImportFixForSymbol(sourceFile, exportInfos, moduleSymbol, program, { symbolName: symbolName, position: position }, isValidTypeOnlyUseSite, useRequire, host, preferences)); @@ -155527,7 +156901,7 @@ var ts; codefix.getImportCompletionAction = getImportCompletionAction; function getPromoteTypeOnlyCompletionAction(sourceFile, symbolToken, program, host, formatContext, preferences) { var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions); + var symbolName = ts.single(getSymbolNamesToImport(sourceFile, program.getTypeChecker(), symbolToken, compilerOptions)); var fix = getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program); var includeSymbolNameInDescription = symbolName !== symbolToken.text; return fix && codeFixActionToCodeAction(codeActionForFix({ host: host, formatContext: formatContext, preferences: preferences }, sourceFile, symbolName, fix, includeSymbolNameInDescription, 1 /* QuotePreference.Double */, compilerOptions)); @@ -155542,7 +156916,16 @@ var ts; var description = _a.description, changes = _a.changes, commands = _a.commands; return { description: description, changes: changes, commands: commands }; } - function getSymbolExportInfoForSymbol(symbol, moduleSymbol, program, host) { + function getAllExportInfoForSymbol(importingFile, symbol, symbolName, preferCapitalized, program, host, preferences, cancellationToken) { + var getChecker = createGetChecker(program, host); + return ts.getExportInfoMap(importingFile, host, program, preferences, cancellationToken) + .search(importingFile.path, preferCapitalized, function (name) { return name === symbolName; }, function (info) { + if (ts.skipAlias(info[0].symbol, getChecker(info[0].isFromPackageJson)) === symbol) { + return info; + } + }); + } + function getSingleExportInfoForSymbol(symbol, moduleSymbol, program, host) { var _a, _b; var compilerOptions = program.getCompilerOptions(); var mainProgramInfo = getInfoWithChecker(program.getTypeChecker(), /*isFromPackageJson*/ false); @@ -155562,35 +156945,6 @@ var ts; } } } - function getAllReExportingModules(importingFile, targetSymbol, exportingModuleSymbol, symbolName, isJsxTagName, host, program, preferences, useAutoImportProvider) { - var result = []; - var compilerOptions = program.getCompilerOptions(); - var getModuleSpecifierResolutionHost = ts.memoizeOne(function (isFromPackageJson) { - return ts.createModuleSpecifierResolutionHost(isFromPackageJson ? host.getPackageJsonAutoImportProvider() : program, host); - }); - ts.forEachExternalModuleToImportFrom(program, host, preferences, useAutoImportProvider, function (moduleSymbol, moduleFile, program, isFromPackageJson) { - var checker = program.getTypeChecker(); - // Don't import from a re-export when looking "up" like to `./index` or `../index`. - if (moduleFile && moduleSymbol !== exportingModuleSymbol && ts.startsWith(importingFile.fileName, ts.getDirectoryPath(moduleFile.fileName))) { - return; - } - var defaultInfo = ts.getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions); - if (defaultInfo && (defaultInfo.name === symbolName || moduleSymbolToValidIdentifier(moduleSymbol, ts.getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName) && ts.skipAlias(defaultInfo.symbol, checker) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: defaultInfo.symbol, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: defaultInfo.exportKind, targetFlags: ts.skipAlias(defaultInfo.symbol, checker).flags, isFromPackageJson: isFromPackageJson }); - } - for (var _i = 0, _a = checker.getExportsAndPropertiesOfModule(moduleSymbol); _i < _a.length; _i++) { - var exported = _a[_i]; - if (exported.name === symbolName && checker.getMergedSymbol(ts.skipAlias(exported, checker)) === targetSymbol && isImportable(program, moduleFile, isFromPackageJson)) { - result.push({ symbol: exported, moduleSymbol: moduleSymbol, moduleFileName: moduleFile === null || moduleFile === void 0 ? void 0 : moduleFile.fileName, exportKind: 0 /* ExportKind.Named */, targetFlags: ts.skipAlias(exported, checker).flags, isFromPackageJson: isFromPackageJson }); - } - } - }); - return result; - function isImportable(program, moduleFile, isFromPackageJson) { - var _a; - return !moduleFile || ts.isImportableFile(program, importingFile, moduleFile, preferences, /*packageJsonFilter*/ undefined, getModuleSpecifierResolutionHost(isFromPackageJson), (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host)); - } - } function getImportFixes(exportInfos, useNamespaceInfo, /** undefined only for missing JSX namespace */ isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap, fromCacheOnly) { @@ -155641,11 +156995,11 @@ var ts; function getTargetModuleFromNamespaceLikeImport(declaration, checker) { var _a; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checker.resolveExternalModuleName(declaration.initializer.arguments[0]); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checker.getAliasedSymbol(declaration.symbol); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var namespaceImport = ts.tryCast((_a = declaration.importClause) === null || _a === void 0 ? void 0 : _a.namedBindings, ts.isNamespaceImport); return namespaceImport && checker.getAliasedSymbol(namespaceImport.symbol); default: @@ -155655,11 +157009,11 @@ var ts; function getNamespaceLikeImportText(declaration) { var _a, _b, _c; switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.tryCast(declaration.name, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return declaration.name.text; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return (_c = ts.tryCast((_b = declaration.importClause) === null || _b === void 0 ? void 0 : _b.namedBindings, ts.isNamespaceImport)) === null || _c === void 0 ? void 0 : _c.name.text; default: return ts.Debug.assertNever(declaration); @@ -155686,12 +157040,12 @@ var ts; function tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, compilerOptions) { return ts.firstDefined(existingImports, function (_a) { var declaration = _a.declaration, importKind = _a.importKind, symbol = _a.symbol, targetFlags = _a.targetFlags; - if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (importKind === 3 /* ImportKind.CommonJS */ || importKind === 2 /* ImportKind.Namespace */ || declaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // These kinds of imports are not combinable with anything return undefined; } - if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { - return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { + return (importKind === 0 /* ImportKind.Named */ || importKind === 1 /* ImportKind.Default */) && declaration.name.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? { kind: 2 /* ImportFixKind.AddToExisting */, importClauseOrBindingPattern: declaration.name, importKind: importKind, moduleSpecifier: declaration.initializer.arguments[0].text, addAsTypeOnly: 4 /* AddAsTypeOnly.NotAllowed */ } : undefined; } @@ -155712,7 +157066,7 @@ var ts; )) return undefined; if (importKind === 0 /* ImportKind.Named */ && - (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 268 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import + (namedBindings === null || namedBindings === void 0 ? void 0 : namedBindings.kind) === 271 /* SyntaxKind.NamespaceImport */ // Cannot add a named import to a declaration that has a namespace import ) return undefined; return { @@ -155735,7 +157089,7 @@ var ts; (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i.parent); } } - else if (i.kind === 266 /* SyntaxKind.ImportDeclaration */ || i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (i.kind === 269 /* SyntaxKind.ImportDeclaration */ || i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { var moduleSymbol = checker.getSymbolAtLocation(moduleSpecifier); if (moduleSymbol) { (importMap || (importMap = ts.createMultiMap())).add(ts.getSymbolId(moduleSymbol), i); @@ -155784,11 +157138,14 @@ var ts; // 5. Literally nothing to go on return true; } + function createGetChecker(program, host) { + return ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + } function getNewImportFixes(program, sourceFile, position, isValidTypeOnlyUseSite, useRequire, exportInfo, host, preferences, fromCacheOnly) { var isJs = ts.isSourceFileJS(sourceFile); var compilerOptions = program.getCompilerOptions(); var moduleSpecifierResolutionHost = ts.createModuleSpecifierResolutionHost(program, host); - var getChecker = ts.memoizeOne(function (isFromPackageJson) { return isFromPackageJson ? host.getPackageJsonAutoImportProvider().getTypeChecker() : program.getTypeChecker(); }); + var getChecker = createGetChecker(program, host); var rejectNodeModulesRelativePaths = ts.moduleResolutionUsesNodeModules(ts.getEmitModuleResolutionKind(compilerOptions)); var getModuleSpecifiers = fromCacheOnly ? function (moduleSymbol) { return ({ moduleSpecifiers: ts.moduleSpecifiers.tryGetModuleSpecifiersFromCache(moduleSymbol, sourceFile, moduleSpecifierResolutionHost, preferences), computedWithoutCache: false }); } @@ -155832,7 +157189,7 @@ var ts; return { kind: 3 /* ImportFixKind.AddNew */, moduleSpecifier: moduleSpecifier, importKind: importKind, addAsTypeOnly: addAsTypeOnly, useRequire: useRequire }; } } - function getFixesInfo(context, errorCode, pos, useAutoImportProvider) { + function getFixInfos(context, errorCode, pos, useAutoImportProvider) { var symbolToken = ts.getTokenAtPosition(context.sourceFile, pos); var info; if (errorCode === ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead.code) { @@ -155842,19 +157199,23 @@ var ts; return undefined; } else if (errorCode === ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type.code) { - var symbolName_1 = getSymbolName(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions()); + var symbolName_1 = ts.single(getSymbolNamesToImport(context.sourceFile, context.program.getTypeChecker(), symbolToken, context.program.getCompilerOptions())); var fix = getTypeOnlyPromotionFix(context.sourceFile, symbolToken, symbolName_1, context.program); - return fix && { fixes: [fix], symbolName: symbolName_1, errorIdentifierText: symbolToken.text }; + return fix && [{ fix: fix, symbolName: symbolName_1, errorIdentifierText: symbolToken.text }]; } else { info = getFixesInfoForNonUMDImport(context, symbolToken, useAutoImportProvider); } var packageJsonImportFilter = ts.createPackageJsonImportFilter(context.sourceFile, context.preferences, context.host); - return info && __assign(__assign({}, info), { fixes: sortFixes(info.fixes, context.sourceFile, context.program, packageJsonImportFilter, context.host) }); + return info && sortFixInfo(info, context.sourceFile, context.program, packageJsonImportFilter, context.host); } - function sortFixes(fixes, sourceFile, program, packageJsonImportFilter, host) { + function sortFixInfo(fixes, sourceFile, program, packageJsonImportFilter, host) { var _toPath = function (fileName) { return ts.toPath(fileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); }; - return ts.sort(fixes, function (a, b) { return ts.compareValues(a.kind, b.kind) || compareModuleSpecifiers(a, b, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); }); + return ts.sort(fixes, function (a, b) { + return ts.compareBooleans(!!a.isJsxNamespaceFix, !!b.isJsxNamespaceFix) || + ts.compareValues(a.fix.kind, b.fix.kind) || + compareModuleSpecifiers(a.fix, b.fix, sourceFile, program, packageJsonImportFilter.allowsImportingSpecifier, _toPath); + }); } function getBestFix(fixes, sourceFile, program, packageJsonImportFilter, host) { if (!ts.some(fixes)) @@ -155905,7 +157266,6 @@ var ts; return 0 /* Comparison.EqualTo */; } function getFixesInfoForUMDImport(_a, token) { - var _b; var sourceFile = _a.sourceFile, program = _a.program, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var umdSymbol = getUmdSymbol(token, checker); @@ -155917,7 +157277,7 @@ var ts; var useRequire = shouldUseRequire(sourceFile, program); var position = ts.isIdentifier(token) ? token.getStart(sourceFile) : undefined; var fixes = getImportFixes(exportInfo, position ? { position: position, symbolName: symbolName } : undefined, /*isValidTypeOnlyUseSite*/ false, useRequire, program, sourceFile, host, preferences).fixes; - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: (_b = ts.tryCast(token, ts.isIdentifier)) === null || _b === void 0 ? void 0 : _b.text }; + return fixes.map(function (fix) { var _a; return ({ fix: fix, symbolName: symbolName, errorIdentifierText: (_a = ts.tryCast(token, ts.isIdentifier)) === null || _a === void 0 ? void 0 : _a.text }); }); } function getUmdSymbol(token, checker) { // try the identifier to see if it is the umd symbol @@ -155978,19 +157338,20 @@ var ts; var sourceFile = _a.sourceFile, program = _a.program, cancellationToken = _a.cancellationToken, host = _a.host, preferences = _a.preferences; var checker = program.getTypeChecker(); var compilerOptions = program.getCompilerOptions(); - var symbolName = getSymbolName(sourceFile, checker, symbolToken, compilerOptions); - // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. - if (symbolName === "default" /* InternalSymbolName.Default */) { - return undefined; - } - var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); - var useRequire = shouldUseRequire(sourceFile, program); - var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); - var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { - var _ = _a[0], exportInfos = _a[1]; - return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; - })); - return { fixes: fixes, symbolName: symbolName, errorIdentifierText: symbolToken.text }; + return ts.flatMap(getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions), function (symbolName) { + // "default" is a keyword and not a legal identifier for the import, but appears as an identifier. + if (symbolName === "default" /* InternalSymbolName.Default */) { + return undefined; + } + var isValidTypeOnlyUseSite = ts.isValidTypeOnlyAliasUseSite(symbolToken); + var useRequire = shouldUseRequire(sourceFile, program); + var exportInfo = getExportInfos(symbolName, ts.isJSXTagName(symbolToken), ts.getMeaningFromLocation(symbolToken), cancellationToken, sourceFile, program, useAutoImportProvider, host, preferences); + var fixes = ts.arrayFrom(ts.flatMapIterator(exportInfo.entries(), function (_a) { + var _ = _a[0], exportInfos = _a[1]; + return getImportFixes(exportInfos, { symbolName: symbolName, position: symbolToken.getStart(sourceFile) }, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences).fixes; + })); + return fixes.map(function (fix) { return ({ fix: fix, symbolName: symbolName, errorIdentifierText: symbolToken.text, isJsxNamespaceFix: symbolName !== symbolToken.text }); }); + }); } function getTypeOnlyPromotionFix(sourceFile, symbolToken, symbolName, program) { var checker = program.getTypeChecker(); @@ -156002,15 +157363,16 @@ var ts; return undefined; return { kind: 4 /* ImportFixKind.PromoteTypeOnly */, typeOnlyAliasDeclaration: typeOnlyAliasDeclaration }; } - function getSymbolName(sourceFile, checker, symbolToken, compilerOptions) { + function getSymbolNamesToImport(sourceFile, checker, symbolToken, compilerOptions) { var parent = symbolToken.parent; if ((ts.isJsxOpeningLikeElement(parent) || ts.isJsxClosingElement(parent)) && parent.tagName === symbolToken && ts.jsxModeNeedsExplicitImport(compilerOptions.jsx)) { var jsxNamespace = checker.getJsxNamespace(sourceFile); if (needsJsxNamespaceFix(jsxNamespace, symbolToken, checker)) { - return jsxNamespace; + var needsComponentNameFix = !ts.isIntrinsicJsxName(symbolToken.text) && !checker.resolveName(symbolToken.text, symbolToken, 111551 /* SymbolFlags.Value */, /*excludeGlobals*/ false); + return needsComponentNameFix ? [symbolToken.text, jsxNamespace] : [jsxNamespace]; } } - return symbolToken.text; + return [symbolToken.text]; } function needsJsxNamespaceFix(jsxNamespace, symbolToken, checker) { if (ts.isIntrinsicJsxName(symbolToken.text)) @@ -156119,7 +157481,7 @@ var ts; case 4 /* ImportFixKind.PromoteTypeOnly */: { var typeOnlyAliasDeclaration = fix.typeOnlyAliasDeclaration; var promotedDeclaration = promoteFromTypeOnly(changes, typeOnlyAliasDeclaration, compilerOptions, sourceFile); - return promotedDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ + return promotedDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ ? [ts.Diagnostics.Remove_type_from_import_of_0_from_1, symbolName, getModuleSpecifierText(promotedDeclaration.parent.parent)] : [ts.Diagnostics.Remove_type_from_import_declaration_from_0, getModuleSpecifierText(promotedDeclaration)]; } @@ -156129,7 +157491,7 @@ var ts; } function getModuleSpecifierText(promotedDeclaration) { var _a, _b; - return promotedDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ + return promotedDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? ((_b = ts.tryCast((_a = ts.tryCast(promotedDeclaration.moduleReference, ts.isExternalModuleReference)) === null || _a === void 0 ? void 0 : _a.expression, ts.isStringLiteralLike)) === null || _b === void 0 ? void 0 : _b.text) || promotedDeclaration.moduleReference.getText() : ts.cast(promotedDeclaration.parent.moduleSpecifier, ts.isStringLiteral).text; } @@ -156137,7 +157499,7 @@ var ts; // See comment in `doAddExistingFix` on constant with the same name. var convertExistingToTypeOnly = compilerOptions.preserveValueImports && compilerOptions.isolatedModules; switch (aliasDeclaration.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: if (aliasDeclaration.isTypeOnly) { if (aliasDeclaration.parent.elements.length > 1 && ts.OrganizeImports.importSpecifiersAreSorted(aliasDeclaration.parent.elements)) { changes.delete(sourceFile, aliasDeclaration); @@ -156155,13 +157517,13 @@ var ts; promoteImportClause(aliasDeclaration.parent.parent); return aliasDeclaration.parent.parent; } - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: promoteImportClause(aliasDeclaration); return aliasDeclaration; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: promoteImportClause(aliasDeclaration.parent); return aliasDeclaration.parent; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: changes.deleteRange(sourceFile, aliasDeclaration.getChildAt(1)); return aliasDeclaration; default: @@ -156173,7 +157535,7 @@ var ts; var namedImports = ts.tryCast(importClause.namedBindings, ts.isNamedImports); if (namedImports && namedImports.elements.length > 1) { if (ts.OrganizeImports.importSpecifiersAreSorted(namedImports.elements) && - aliasDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && + aliasDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && namedImports.elements.indexOf(aliasDeclaration) !== 0) { // The import specifier being promoted will be the only non-type-only, // import in the NamedImports, so it should be moved to the front. @@ -156183,7 +157545,7 @@ var ts; for (var _i = 0, _a = namedImports.elements; _i < _a.length; _i++) { var element = _a[_i]; if (element !== aliasDeclaration && !element.isTypeOnly) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, element); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, element); } } } @@ -156192,7 +157554,7 @@ var ts; } function doAddExistingFix(changes, sourceFile, clause, defaultImport, namedImports, compilerOptions) { var _a; - if (clause.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (clause.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (defaultImport) { addElementToBindingPattern(clause, defaultImport.name, "default"); } @@ -156253,7 +157615,7 @@ var ts; if (convertExistingToTypeOnly && existingSpecifiers) { for (var _d = 0, existingSpecifiers_1 = existingSpecifiers; _d < existingSpecifiers_1.length; _d++) { var specifier = existingSpecifiers_1[_d]; - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, specifier); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, specifier); } } } @@ -156428,7 +157790,7 @@ var ts; var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.This_type_parameter_might_need_an_extends_0_constraint.code; }); if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) return; - var declaration = findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + var declaration = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); if (declaration === undefined) return; if (ts.isIdentifier(declaration) && ts.isTypeParameterDeclaration(declaration.parent)) { @@ -156462,14 +157824,6 @@ var ts; } } } - function findAncestorMatchingSpan(sourceFile, span) { - var end = ts.textSpanEnd(span); - var token = ts.getTokenAtPosition(sourceFile, span.start); - while (token.end < end) { - token = token.parent; - } - return token; - } function tryGetConstraintFromDiagnosticMessage(messageText) { var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/`extends (.*)`/) || [], _ = _a[0], constraint = _a[1]; return constraint; @@ -156613,7 +157967,7 @@ var ts; accessibilityModifier ? accessibilityModifier.end : lastDecorator ? ts.skipTrivia(sourceFile.text, lastDecorator.end) : classElement.getStart(sourceFile); var options = accessibilityModifier || staticModifier || abstractModifier ? { prefix: " " } : { suffix: " " }; - changeTracker.insertModifierAt(sourceFile, modifierPos, 159 /* SyntaxKind.OverrideKeyword */, options); + changeTracker.insertModifierAt(sourceFile, modifierPos, 161 /* SyntaxKind.OverrideKeyword */, options); } function doRemoveOverrideModifierChange(changeTracker, sourceFile, pos) { var classElement = findContainerClassElementLike(sourceFile, pos); @@ -156627,13 +157981,13 @@ var ts; } function isClassElementLikeHasJSDoc(node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.isParameterPropertyDeclaration(node, node.parent); default: return false; @@ -156745,6 +158099,143 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + var fixId = "fixImportNonExportedMember"; + var errorCodes = [ + ts.Diagnostics.Module_0_declares_1_locally_but_it_is_not_exported.code, + ]; + codefix.registerCodeFix({ + errorCodes: errorCodes, + fixIds: [fixId], + getCodeActions: function (context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getInfo(sourceFile, span.start, program); + if (info === undefined) + return undefined; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, program, info); }); + return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Export_0_from_module_1, info.exportName.node.text, info.moduleSpecifier], fixId, ts.Diagnostics.Export_all_referenced_locals)]; + }, + getAllCodeActions: function (context) { + var program = context.program; + return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) { + var exports = new ts.Map(); + codefix.eachDiagnostic(context, errorCodes, function (diag) { + var info = getInfo(diag.file, diag.start, program); + if (info === undefined) + return undefined; + var exportName = info.exportName, node = info.node, moduleSourceFile = info.moduleSourceFile; + if (tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly) === undefined && ts.canHaveExportModifier(node)) { + changes.insertExportModifier(moduleSourceFile, node); + } + else { + var moduleExports = exports.get(moduleSourceFile) || { typeOnlyExports: [], exports: [] }; + if (exportName.isTypeOnly) { + moduleExports.typeOnlyExports.push(exportName); + } + else { + moduleExports.exports.push(exportName); + } + exports.set(moduleSourceFile, moduleExports); + } + }); + exports.forEach(function (moduleExports, moduleSourceFile) { + var exportDeclaration = tryGetExportDeclaration(moduleSourceFile, /*isTypeOnly*/ true); + if (exportDeclaration && exportDeclaration.isTypeOnly) { + doChanges(changes, program, moduleSourceFile, moduleExports.typeOnlyExports, exportDeclaration); + doChanges(changes, program, moduleSourceFile, moduleExports.exports, tryGetExportDeclaration(moduleSourceFile, /*isTypeOnly*/ false)); + } + else { + doChanges(changes, program, moduleSourceFile, __spreadArray(__spreadArray([], moduleExports.exports, true), moduleExports.typeOnlyExports, true), exportDeclaration); + } + }); + })); + } + }); + function getInfo(sourceFile, pos, program) { + var _a; + var token = ts.getTokenAtPosition(sourceFile, pos); + if (ts.isIdentifier(token)) { + var importDeclaration = ts.findAncestor(token, ts.isImportDeclaration); + if (importDeclaration === undefined) + return undefined; + var moduleSpecifier = ts.isStringLiteral(importDeclaration.moduleSpecifier) ? importDeclaration.moduleSpecifier.text : undefined; + if (moduleSpecifier === undefined) + return undefined; + var resolvedModule = ts.getResolvedModule(sourceFile, moduleSpecifier, /*mode*/ undefined); + if (resolvedModule === undefined) + return undefined; + var moduleSourceFile = program.getSourceFile(resolvedModule.resolvedFileName); + if (moduleSourceFile === undefined || ts.isSourceFileFromLibrary(program, moduleSourceFile)) + return undefined; + var moduleSymbol = moduleSourceFile.symbol; + var locals = (_a = moduleSymbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.locals; + if (locals === undefined) + return undefined; + var localSymbol = locals.get(token.escapedText); + if (localSymbol === undefined) + return undefined; + var node = getNodeOfSymbol(localSymbol); + if (node === undefined) + return undefined; + var exportName = { node: token, isTypeOnly: ts.isTypeDeclaration(node) }; + return { exportName: exportName, node: node, moduleSourceFile: moduleSourceFile, moduleSpecifier: moduleSpecifier }; + } + return undefined; + } + function doChange(changes, program, _a) { + var exportName = _a.exportName, node = _a.node, moduleSourceFile = _a.moduleSourceFile; + var exportDeclaration = tryGetExportDeclaration(moduleSourceFile, exportName.isTypeOnly); + if (exportDeclaration) { + updateExport(changes, program, moduleSourceFile, exportDeclaration, [exportName]); + } + else if (ts.canHaveExportModifier(node)) { + changes.insertExportModifier(moduleSourceFile, node); + } + else { + createExport(changes, program, moduleSourceFile, [exportName]); + } + } + function doChanges(changes, program, sourceFile, moduleExports, node) { + if (ts.length(moduleExports)) { + if (node) { + updateExport(changes, program, sourceFile, node, moduleExports); + } + else { + createExport(changes, program, sourceFile, moduleExports); + } + } + } + function tryGetExportDeclaration(sourceFile, isTypeOnly) { + var predicate = function (node) { + return ts.isExportDeclaration(node) && (isTypeOnly && node.isTypeOnly || !node.isTypeOnly); + }; + return ts.findLast(sourceFile.statements, predicate); + } + function updateExport(changes, program, sourceFile, node, names) { + var namedExports = node.exportClause && ts.isNamedExports(node.exportClause) ? node.exportClause.elements : ts.factory.createNodeArray([]); + var allowTypeModifier = !node.isTypeOnly && !!(program.getCompilerOptions().isolatedModules || ts.find(namedExports, function (e) { return e.isTypeOnly; })); + changes.replaceNode(sourceFile, node, ts.factory.updateExportDeclaration(node, node.modifiers, node.isTypeOnly, ts.factory.createNamedExports(ts.factory.createNodeArray(__spreadArray(__spreadArray([], namedExports, true), createExportSpecifiers(names, allowTypeModifier), true), /*hasTrailingComma*/ namedExports.hasTrailingComma)), node.moduleSpecifier, node.assertClause)); + } + function createExport(changes, program, sourceFile, names) { + changes.insertNodeAtEndOfScope(sourceFile, sourceFile, ts.factory.createExportDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamedExports(createExportSpecifiers(names, /*allowTypeModifier*/ !!program.getCompilerOptions().isolatedModules)), /*moduleSpecifier*/ undefined, /*assertClause*/ undefined)); + } + function createExportSpecifiers(names, allowTypeModifier) { + return ts.factory.createNodeArray(ts.map(names, function (n) { return ts.factory.createExportSpecifier(allowTypeModifier && n.isTypeOnly, /*propertyName*/ undefined, n.node); })); + } + function getNodeOfSymbol(symbol) { + if (symbol.valueDeclaration === undefined) { + return ts.firstOrUndefined(symbol.declarations); + } + var declaration = symbol.valueDeclaration; + var variableStatement = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : undefined; + return variableStatement && ts.length(variableStatement.declarationList.declarations) === 1 ? variableStatement : declaration; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -156765,7 +158256,7 @@ var ts; }); function getNamedTupleMember(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); - return ts.findAncestor(token, function (t) { return t.kind === 197 /* SyntaxKind.NamedTupleMember */; }); + return ts.findAncestor(token, function (t) { return t.kind === 199 /* SyntaxKind.NamedTupleMember */; }); } function doChange(changes, sourceFile, namedTupleMember) { if (!namedTupleMember) { @@ -156774,11 +158265,11 @@ var ts; var unwrappedType = namedTupleMember.type; var sawOptional = false; var sawRest = false; - while (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 186 /* SyntaxKind.RestType */ || unwrappedType.kind === 191 /* SyntaxKind.ParenthesizedType */) { - if (unwrappedType.kind === 185 /* SyntaxKind.OptionalType */) { + while (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */ || unwrappedType.kind === 188 /* SyntaxKind.RestType */ || unwrappedType.kind === 193 /* SyntaxKind.ParenthesizedType */) { + if (unwrappedType.kind === 187 /* SyntaxKind.OptionalType */) { sawOptional = true; } - else if (unwrappedType.kind === 186 /* SyntaxKind.RestType */) { + else if (unwrappedType.kind === 188 /* SyntaxKind.RestType */) { sawRest = true; } unwrappedType = unwrappedType.type; @@ -157049,7 +158540,7 @@ var ts; if (isFunctionType) { var sig = checker.getSignatureFromDeclaration(declaration); if (sig) { - if (ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Async */)) { + if (ts.hasSyntacticModifier(declaration, 512 /* ModifierFlags.Async */)) { exprType = checker.createPromiseType(exprType); } var newSig = checker.createSignature(declaration, sig.typeParameters, sig.thisParameter, sig.parameters, exprType, @@ -157093,19 +158584,19 @@ var ts; } function getVariableLikeInitializer(declaration) { switch (declaration.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: return declaration.initializer; - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return declaration.initializer && (ts.isJsxExpression(declaration.initializer) ? declaration.initializer.expression : undefined); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return undefined; } } @@ -157159,6 +158650,15 @@ var ts; ts.Diagnostics.Argument_of_type_0_is_not_assignable_to_parameter_of_type_1.code, ts.Diagnostics.Cannot_find_name_0.code ]; + var InfoKind; + (function (InfoKind) { + InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; + InfoKind[InfoKind["Enum"] = 1] = "Enum"; + InfoKind[InfoKind["Function"] = 2] = "Function"; + InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; + InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; + InfoKind[InfoKind["Signature"] = 5] = "Signature"; + })(InfoKind || (InfoKind = {})); codefix.registerCodeFix({ errorCodes: errorCodes, getCodeActions: function (context) { @@ -157167,19 +158667,19 @@ var ts; if (!info) { return undefined; } - if (info.kind === 3 /* InfoKind.ObjectLiteral */) { + if (info.kind === InfoKind.ObjectLiteral) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addObjectLiteralProperties(t, context, info); }); return [codefix.createCodeFixAction(fixMissingProperties, changes, ts.Diagnostics.Add_missing_properties, fixMissingProperties, ts.Diagnostics.Add_all_missing_properties)]; } - if (info.kind === 4 /* InfoKind.JsxAttributes */) { + if (info.kind === InfoKind.JsxAttributes) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addJsxAttributes(t, context, info); }); return [codefix.createCodeFixAction(fixMissingAttributes, changes, ts.Diagnostics.Add_missing_attributes, fixMissingAttributes, ts.Diagnostics.Add_all_missing_attributes)]; } - if (info.kind === 2 /* InfoKind.Function */) { + if (info.kind === InfoKind.Function || info.kind === InfoKind.Signature) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addFunctionDeclaration(t, context, info); }); return [codefix.createCodeFixAction(fixMissingFunctionDeclaration, changes, [ts.Diagnostics.Add_missing_function_declaration_0, info.token.text], fixMissingFunctionDeclaration, ts.Diagnostics.Add_all_missing_function_declarations)]; } - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addEnumMemberDeclaration(t, context.program.getTypeChecker(), info); }); return [codefix.createCodeFixAction(fixMissingMember, changes, [ts.Diagnostics.Add_missing_enum_member_0, info.token.text], fixMissingMember, ts.Diagnostics.Add_all_missing_members)]; } @@ -157197,20 +158697,20 @@ var ts; if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) { return; } - if (fixId === fixMissingFunctionDeclaration && info.kind === 2 /* InfoKind.Function */) { + if (fixId === fixMissingFunctionDeclaration && (info.kind === InfoKind.Function || info.kind === InfoKind.Signature)) { addFunctionDeclaration(changes, context, info); } - else if (fixId === fixMissingProperties && info.kind === 3 /* InfoKind.ObjectLiteral */) { + else if (fixId === fixMissingProperties && info.kind === InfoKind.ObjectLiteral) { addObjectLiteralProperties(changes, context, info); } - else if (fixId === fixMissingAttributes && info.kind === 4 /* InfoKind.JsxAttributes */) { + else if (fixId === fixMissingAttributes && info.kind === InfoKind.JsxAttributes) { addJsxAttributes(changes, context, info); } else { - if (info.kind === 1 /* InfoKind.Enum */) { + if (info.kind === InfoKind.Enum) { addEnumMemberDeclaration(changes, checker, info); } - if (info.kind === 0 /* InfoKind.TypeLikeDeclaration */) { + if (info.kind === InfoKind.TypeLikeDeclaration) { var parentDeclaration = info.parentDeclaration, token_1 = info.token; var infos = ts.getOrUpdate(typeDeclToMembers, parentDeclaration, function () { return []; }); if (!infos.some(function (i) { return i.token.text === token_1.text; })) { @@ -157254,14 +158754,6 @@ var ts; })); }, }); - var InfoKind; - (function (InfoKind) { - InfoKind[InfoKind["TypeLikeDeclaration"] = 0] = "TypeLikeDeclaration"; - InfoKind[InfoKind["Enum"] = 1] = "Enum"; - InfoKind[InfoKind["Function"] = 2] = "Function"; - InfoKind[InfoKind["ObjectLiteral"] = 3] = "ObjectLiteral"; - InfoKind[InfoKind["JsxAttributes"] = 4] = "JsxAttributes"; - })(InfoKind || (InfoKind = {})); function getInfo(sourceFile, tokenPos, errorCode, checker, program) { // The identifier of the missing property. eg: // this.missing = 1; @@ -157274,7 +158766,7 @@ var ts; var argIndex = ts.findIndex(parent.parent.arguments, function (arg) { return arg === parent; }); if (argIndex < 0) return undefined; - var signature = ts.singleOrUndefined(checker.getSignaturesOfType(checker.getTypeAtLocation(parent.parent.expression), 0 /* SignatureKind.Call */)); + var signature = checker.getResolvedSignature(parent.parent); if (!(signature && signature.declaration && signature.parameters[argIndex])) return undefined; var param = signature.parameters[argIndex].valueDeclaration; @@ -157283,7 +158775,7 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent), checker.getParameterType(signature, argIndex), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: param.name, properties: properties, parentDeclaration: parent }; + return { kind: InfoKind.ObjectLiteral, token: param.name, properties: properties, parentDeclaration: parent }; } if (!ts.isMemberName(token)) return undefined; @@ -157291,17 +158783,26 @@ var ts; var properties = ts.arrayFrom(checker.getUnmatchedProperties(checker.getTypeAtLocation(parent.initializer), checker.getTypeAtLocation(token), /* requireOptionalProperties */ false, /* matchDiscriminantProperties */ false)); if (!ts.length(properties)) return undefined; - return { kind: 3 /* InfoKind.ObjectLiteral */, token: token, properties: properties, parentDeclaration: parent.initializer }; + return { kind: InfoKind.ObjectLiteral, token: token, properties: properties, parentDeclaration: parent.initializer }; } if (ts.isIdentifier(token) && ts.isJsxOpeningLikeElement(token.parent)) { var target = ts.getEmitScriptTarget(program.getCompilerOptions()); var attributes = getUnmatchedAttributes(checker, target, token.parent); if (!ts.length(attributes)) return undefined; - return { kind: 4 /* InfoKind.JsxAttributes */, token: token, attributes: attributes, parentDeclaration: token.parent }; + return { kind: InfoKind.JsxAttributes, token: token, attributes: attributes, parentDeclaration: token.parent }; } - if (ts.isIdentifier(token) && ts.isCallExpression(parent) && parent.expression === token) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: sourceFile }; + if (ts.isIdentifier(token)) { + var type = checker.getContextualType(token); + if (type && ts.getObjectFlags(type) & 16 /* ObjectFlags.Anonymous */) { + var signature = ts.firstOrUndefined(checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */)); + if (signature === undefined) + return undefined; + return { kind: InfoKind.Signature, token: token, signature: signature, sourceFile: sourceFile, parentDeclaration: findScope(token) }; + } + if (ts.isCallExpression(parent) && parent.expression === token) { + return { kind: InfoKind.Function, token: token, call: parent, sourceFile: sourceFile, modifierFlags: 0 /* ModifierFlags.None */, parentDeclaration: findScope(token) }; + } } if (!ts.isPropertyAccessExpression(parent)) return undefined; @@ -157312,14 +158813,14 @@ var ts; if (ts.isIdentifier(token) && ts.isCallExpression(parent.parent)) { var moduleDeclaration = ts.find(symbol.declarations, ts.isModuleDeclaration); var moduleDeclarationSourceFile = moduleDeclaration === null || moduleDeclaration === void 0 ? void 0 : moduleDeclaration.getSourceFile(); - if (moduleDeclaration && moduleDeclarationSourceFile && !isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; + if (moduleDeclaration && moduleDeclarationSourceFile && !ts.isSourceFileFromLibrary(program, moduleDeclarationSourceFile)) { + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: sourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleDeclaration }; } var moduleSourceFile = ts.find(symbol.declarations, ts.isSourceFile); if (sourceFile.commonJsModuleIndicator) return undefined; - if (moduleSourceFile && !isSourceFileFromLibrary(program, moduleSourceFile)) { - return { kind: 2 /* InfoKind.Function */, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; + if (moduleSourceFile && !ts.isSourceFileFromLibrary(program, moduleSourceFile)) { + return { kind: InfoKind.Function, token: token, call: parent.parent, sourceFile: moduleSourceFile, modifierFlags: 1 /* ModifierFlags.Export */, parentDeclaration: moduleSourceFile }; } } var classDeclaration = ts.find(symbol.declarations, ts.isClassLike); @@ -157328,7 +158829,7 @@ var ts; return undefined; // Prefer to change the class instead of the interface if they are merged var declaration = classDeclaration || ts.find(symbol.declarations, function (d) { return ts.isInterfaceDeclaration(d) || ts.isTypeLiteralNode(d); }); - if (declaration && !isSourceFileFromLibrary(program, declaration.getSourceFile())) { + if (declaration && !ts.isSourceFileFromLibrary(program, declaration.getSourceFile())) { var makeStatic = !ts.isTypeLiteralNode(declaration) && (leftExpressionType.target || leftExpressionType) !== checker.getDeclaredTypeOfSymbol(symbol); if (makeStatic && (ts.isPrivateIdentifier(token) || ts.isInterfaceDeclaration(declaration))) return undefined; @@ -157337,17 +158838,14 @@ var ts; (makeStatic ? 32 /* ModifierFlags.Static */ : 0 /* ModifierFlags.None */) | (ts.startsWithUnderscore(token.text) ? 8 /* ModifierFlags.Private */ : 0 /* ModifierFlags.None */); var isJSFile = ts.isSourceFileJS(declSourceFile); var call = ts.tryCast(parent.parent, ts.isCallExpression); - return { kind: 0 /* InfoKind.TypeLikeDeclaration */, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; + return { kind: InfoKind.TypeLikeDeclaration, token: token, call: call, modifierFlags: modifierFlags, parentDeclaration: declaration, declSourceFile: declSourceFile, isJSFile: isJSFile }; } var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration); - if (enumDeclaration && !ts.isPrivateIdentifier(token) && !isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { - return { kind: 1 /* InfoKind.Enum */, token: token, parentDeclaration: enumDeclaration }; + if (enumDeclaration && !(leftExpressionType.flags & 1056 /* TypeFlags.EnumLike */) && !ts.isPrivateIdentifier(token) && !ts.isSourceFileFromLibrary(program, enumDeclaration.getSourceFile())) { + return { kind: InfoKind.Enum, token: token, parentDeclaration: enumDeclaration }; } return undefined; } - function isSourceFileFromLibrary(program, node) { - return program.isSourceFileFromExternalLibrary(node) || program.isSourceFileDefaultLibrary(node); - } function getActionsForMissingMemberDeclaration(context, info) { return info.isJSFile ? ts.singleElementArray(createActionForAddMissingMemberInJavascriptFile(context, info)) : createActionsForAddMissingMemberInTypeScriptFile(context, info); @@ -157368,7 +158866,7 @@ var ts; function addMissingMemberInJs(changeTracker, sourceFile, classDeclaration, token, makeStatic) { var tokenName = token.text; if (makeStatic) { - if (classDeclaration.kind === 226 /* SyntaxKind.ClassExpression */) { + if (classDeclaration.kind === 228 /* SyntaxKind.ClassExpression */) { return; } var className = classDeclaration.name.getText(); @@ -157419,7 +158917,7 @@ var ts; } function getTypeNode(checker, node, token) { var typeNode; - if (token.parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (token.parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var binaryExpression = token.parent.parent; var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left; var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression))); @@ -157429,7 +158927,7 @@ var ts; var contextualType = checker.getContextualType(token.parent); typeNode = contextualType ? checker.typeToTypeNode(contextualType, /*enclosingDeclaration*/ undefined, 1 /* NodeBuilderFlags.NoTruncation */) : undefined; } - return typeNode || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return typeNode || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function addPropertyDeclaration(changeTracker, sourceFile, node, tokenName, typeNode, modifierFlags) { var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; @@ -157457,7 +158955,7 @@ var ts; } function createAddIndexSignatureAction(context, sourceFile, node, tokenName, typeNode) { // Index signatures cannot have the static modifier. - var stringTypeNode = ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + var stringTypeNode = ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); var indexingParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, "x", @@ -157488,7 +158986,7 @@ var ts; } function addMethodDeclaration(context, changes, callExpression, name, modifierFlags, parentDeclaration, sourceFile) { var importAdder = codefix.createImportAdder(sourceFile, context.program, context.preferences, context.host); - var kind = ts.isClassLike(parentDeclaration) ? 169 /* SyntaxKind.MethodDeclaration */ : 168 /* SyntaxKind.MethodSignature */; + var kind = ts.isClassLike(parentDeclaration) ? 171 /* SyntaxKind.MethodDeclaration */ : 170 /* SyntaxKind.MethodSignature */; var signatureDeclaration = codefix.createSignatureDeclarationFromCallExpression(kind, context, importAdder, callExpression, name, modifierFlags, parentDeclaration); var containingMethodDeclaration = tryGetContainingMethodDeclaration(parentDeclaration, callExpression); if (containingMethodDeclaration) { @@ -157517,9 +159015,17 @@ var ts; }); } function addFunctionDeclaration(changes, context, info) { + var quotePreference = ts.getQuotePreference(context.sourceFile, context.preferences); var importAdder = codefix.createImportAdder(context.sourceFile, context.program, context.preferences, context.host); - var functionDeclaration = codefix.createSignatureDeclarationFromCallExpression(256 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration); - changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); + var functionDeclaration = info.kind === InfoKind.Function + ? codefix.createSignatureDeclarationFromCallExpression(259 /* SyntaxKind.FunctionDeclaration */, context, importAdder, info.call, ts.idText(info.token), info.modifierFlags, info.parentDeclaration) + : codefix.createSignatureDeclarationFromSignature(259 /* SyntaxKind.FunctionDeclaration */, context, quotePreference, info.signature, codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), info.token, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ undefined, importAdder); + if (functionDeclaration === undefined) { + ts.Debug.fail("fixMissingFunctionDeclaration codefix got unexpected error."); + } + ts.isReturnStatement(info.parentDeclaration) + ? changes.insertNodeBefore(info.sourceFile, info.parentDeclaration, functionDeclaration, /*blankLineBetween*/ true) + : changes.insertNodeAtEndOfScope(info.sourceFile, info.parentDeclaration, functionDeclaration); importAdder.writeFixes(changes); } function addJsxAttributes(changes, context, info) { @@ -157615,7 +159121,7 @@ var ts; var signature = checker.getSignaturesOfType(type, 0 /* SignatureKind.Call */); if (signature === undefined) return createUndefined(); - var func = codefix.createSignatureDeclarationFromSignature(213 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); + var func = codefix.createSignatureDeclarationFromSignature(215 /* SyntaxKind.FunctionExpression */, context, quotePreference, signature[0], codefix.createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference), /*name*/ undefined, /*modifiers*/ undefined, /*optional*/ undefined, /*enclosingDeclaration*/ enclosingDeclaration, importAdder); return func !== null && func !== void 0 ? func : createUndefined(); } if (ts.getObjectFlags(type) & 1 /* ObjectFlags.Class */) { @@ -157669,14 +159175,21 @@ var ts; return declaration && declaration.parent === node ? declaration : undefined; } function createPropertyNameFromSymbol(symbol, target, quotePreference, checker) { - if (ts.isTransientSymbol(symbol) && symbol.nameType && symbol.nameType.flags & 8192 /* TypeFlags.UniqueESSymbol */) { - var expression = checker.symbolToExpression(symbol.nameType.symbol, 111551 /* SymbolFlags.Value */, symbol.valueDeclaration, 1048576 /* NodeBuilderFlags.AllowUniqueESSymbolType */); - if (expression) { - return ts.factory.createComputedPropertyName(expression); - } + if (ts.isTransientSymbol(symbol)) { + var prop = checker.symbolToNode(symbol, 111551 /* SymbolFlags.Value */, /*enclosingDeclaration*/ undefined, 1073741824 /* NodeBuilderFlags.WriteComputedProps */); + if (prop && ts.isComputedPropertyName(prop)) + return prop; } return ts.createPropertyNameNodeForIdentifierOrLiteral(symbol.name, target, quotePreference === 0 /* QuotePreference.Single */); } + function findScope(node) { + if (ts.findAncestor(node, ts.isJsxExpression)) { + var returnStatement = ts.findAncestor(node.parent, ts.isReturnStatement); + if (returnStatement) + return returnStatement; + } + return ts.getSourceFileOfNode(node); + } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -157827,7 +159340,7 @@ var ts; // See `codeFixClassExtendAbstractProtectedProperty.ts` in https://github.com/Microsoft/TypeScript/pull/11547/files // (now named `codeFixClassExtendAbstractPrivateProperty.ts`) var flags = ts.getSyntacticModifierFlags(ts.first(symbol.getDeclarations())); - return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 128 /* ModifierFlags.Abstract */); + return !(flags & 8 /* ModifierFlags.Private */) && !!(flags & 256 /* ModifierFlags.Abstract */); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -157990,6 +159503,63 @@ var ts; })(ts || (ts = {})); /* @internal */ var ts; +(function (ts) { + var codefix; + (function (codefix) { + var fixId = "fixNaNEquality"; + var errorCodes = [ + ts.Diagnostics.This_condition_will_always_return_0.code, + ]; + codefix.registerCodeFix({ + errorCodes: errorCodes, + getCodeActions: function (context) { + var sourceFile = context.sourceFile, span = context.span, program = context.program; + var info = getInfo(program, sourceFile, span); + if (info === undefined) + return; + var suggestion = info.suggestion, expression = info.expression, arg = info.arg; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, arg, expression); }); + return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Use_0, suggestion], fixId, ts.Diagnostics.Use_Number_isNaN_in_all_conditions)]; + }, + fixIds: [fixId], + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(context.program, diag.file, ts.createTextSpan(diag.start, diag.length)); + if (info) { + doChange(changes, diag.file, info.arg, info.expression); + } + }); + } + }); + function getInfo(program, sourceFile, span) { + var diag = ts.find(program.getSemanticDiagnostics(sourceFile), function (diag) { return diag.start === span.start && diag.length === span.length; }); + if (diag === undefined || diag.relatedInformation === undefined) + return; + var related = ts.find(diag.relatedInformation, function (related) { return related.code === ts.Diagnostics.Did_you_mean_0.code; }); + if (related === undefined || related.file === undefined || related.start === undefined || related.length === undefined) + return; + var token = codefix.findAncestorMatchingSpan(related.file, ts.createTextSpan(related.start, related.length)); + if (token === undefined) + return; + if (ts.isExpression(token) && ts.isBinaryExpression(token.parent)) { + return { suggestion: getSuggestion(related.messageText), expression: token.parent, arg: token }; + } + return undefined; + } + function doChange(changes, sourceFile, arg, expression) { + var callExpression = ts.factory.createCallExpression(ts.factory.createPropertyAccessExpression(ts.factory.createIdentifier("Number"), ts.factory.createIdentifier("isNaN")), /*typeArguments*/ undefined, [arg]); + var operator = expression.operatorToken.kind; + changes.replaceNode(sourceFile, expression, operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ + ? ts.factory.createPrefixUnaryExpression(53 /* SyntaxKind.ExclamationToken */, callExpression) : callExpression); + } + function getSuggestion(messageText) { + var _a = ts.flattenDiagnosticMessageText(messageText, "\n", 0).match(/\'(.*)\'/) || [], _ = _a[0], suggestion = _a[1]; + return suggestion; + } + })(codefix = ts.codefix || (ts.codefix = {})); +})(ts || (ts = {})); +/* @internal */ +var ts; (function (ts) { var codefix; (function (codefix) { @@ -158307,7 +159877,7 @@ var ts; var importDeclaration = getImportDeclaration(context.sourceFile, context.program, context.span.start); if (!importDeclaration) return; - var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 270 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); + var namespaceChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return importDeclaration.kind === 273 /* SyntaxKind.ImportSpecifier */ && doNamespaceImportChange(t, context.sourceFile, importDeclaration, context.program); }); var typeOnlyChanges = ts.textChanges.ChangeTracker.with(context, function (t) { return doTypeOnlyImportChange(t, context.sourceFile, importDeclaration, context.program); }); var actions; if (namespaceChanges.length) { @@ -158322,7 +159892,7 @@ var ts; }); function getImportDeclaration(sourceFile, program, start) { var identifier = ts.tryCast(ts.getTokenAtPosition(sourceFile, start), ts.isIdentifier); - if (!identifier || identifier.parent.kind !== 178 /* SyntaxKind.TypeReference */) + if (!identifier || identifier.parent.kind !== 180 /* SyntaxKind.TypeReference */) return; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(identifier); @@ -158334,11 +159904,11 @@ var ts; // new type-only import declaration, but honestly I doubt anyone will ever use this // codefix at all, so it's probably not worth the lines of code. function doTypeOnlyImportChange(changes, sourceFile, importDeclaration, program) { - if (importDeclaration.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importDeclaration.name); + if (importDeclaration.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importDeclaration.name); return; } - var importClause = importDeclaration.kind === 267 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; + var importClause = importDeclaration.kind === 270 /* SyntaxKind.ImportClause */ ? importDeclaration : importDeclaration.parent.parent; if (importClause.name && importClause.namedBindings) { // Cannot convert an import with a default import and named bindings to type-only // (it's a grammar error). @@ -158355,7 +159925,7 @@ var ts; // Don't convert it to type-only. return; } - changes.insertModifierBefore(sourceFile, 152 /* SyntaxKind.TypeKeyword */, importClause); + changes.insertModifierBefore(sourceFile, 154 /* SyntaxKind.TypeKeyword */, importClause); } function doNamespaceImportChange(changes, sourceFile, importDeclaration, program) { ts.refactor.doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, importDeclaration.parent); @@ -158433,7 +160003,7 @@ var ts; ]; } var result = []; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return changeInferToUnknown(t, sourceFile, token); }); var name = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name.text; result.push(codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Replace_infer_0_with_unknown, name], fixIdInfer, ts.Diagnostics.Replace_all_unused_infer_with_unknown)); @@ -158475,7 +160045,7 @@ var ts; break; } case fixIdDelete: { - if (token.kind === 137 /* SyntaxKind.InferKeyword */ || isImport(token)) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */ || isImport(token)) { break; // Can't delete } else if (ts.isJSDocTemplateTag(token)) { @@ -158504,7 +160074,7 @@ var ts; break; } case fixIdInfer: - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { changeInferToUnknown(changes, sourceFile, token); } break; @@ -158515,7 +160085,7 @@ var ts; }, }); function changeInferToUnknown(changes, sourceFile, token) { - changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)); + changes.replaceNode(sourceFile, token.parent, ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)); } function createDeleteFix(changes, diag) { return codefix.createCodeFixAction(fixName, changes, diag, fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations); @@ -158525,7 +160095,7 @@ var ts; } function isImport(token) { return token.kind === 100 /* SyntaxKind.ImportKeyword */ - || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 270 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 267 /* SyntaxKind.ImportClause */); + || token.kind === 79 /* SyntaxKind.Identifier */ && (token.parent.kind === 273 /* SyntaxKind.ImportSpecifier */ || token.parent.kind === 270 /* SyntaxKind.ImportClause */); } /** Sometimes the diagnostic span is an entire ImportDeclaration, so we should remove the whole thing. */ function tryGetFullImport(token) { @@ -158535,7 +160105,7 @@ var ts; return ts.isVariableDeclarationList(token.parent) && ts.first(token.parent.getChildren(sourceFile)) === token; } function deleteEntireVariableStatement(changes, sourceFile, node) { - changes.delete(sourceFile, node.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? node.parent : node); + changes.delete(sourceFile, node.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? node.parent : node); } function deleteDestructuringElements(changes, sourceFile, node) { ts.forEach(node.elements, function (n) { return changes.delete(sourceFile, n); }); @@ -158544,7 +160114,7 @@ var ts; // Don't offer to prefix a property. if (errorCode === ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code) return; - if (token.kind === 137 /* SyntaxKind.InferKeyword */) { + if (token.kind === 138 /* SyntaxKind.InferKeyword */) { token = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name; } if (ts.isIdentifier(token) && canPrefix(token)) { @@ -158560,14 +160130,14 @@ var ts; } function canPrefix(token) { switch (token.parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var varDecl = token.parent; switch (varDecl.parent.parent.kind) { - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return true; } } @@ -158622,8 +160192,8 @@ var ts; function mayDeleteParameter(checker, sourceFile, parameter, sourceFiles, program, cancellationToken, isFixAll) { var parent = parameter.parent; switch (parent.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: var index = parent.parameters.indexOf(parameter); var referent = ts.isMethodDeclaration(parent) ? parent.name : parent; var entries = ts.FindAllReferences.Core.getReferencedSymbolsForNode(parent.pos, referent, program, sourceFiles, cancellationToken); @@ -158653,20 +160223,20 @@ var ts; } } return true; - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { if (parent.name && isCallbackLike(checker, sourceFile, parent.name)) { return isLastParameter(parent, parameter, isFixAll); } return true; } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: // Can't remove a non-last parameter in a callback. Can remove a parameter in code-fix-all if future parameters are also unused. return isLastParameter(parent, parameter, isFixAll); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Setter must have a parameter return false; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Getter cannot have parameters return true; default: @@ -158727,7 +160297,7 @@ var ts; var container = (ts.isBlock(statement.parent) ? statement.parent : statement).parent; if (!ts.isBlock(statement.parent) || statement === ts.first(statement.parent.statements)) { switch (container.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: if (container.elseStatement) { if (ts.isBlock(statement.parent)) { break; @@ -158738,8 +160308,8 @@ var ts; return; } // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: changes.delete(sourceFile, container); return; } @@ -158812,7 +160382,7 @@ var ts; var typeNode = info.typeNode, type = info.type; var original = typeNode.getText(sourceFile); var actions = [fix(type, fixIdPlain, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)]; - if (typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */) { + if (typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */) { // for nullable types, suggest the flow-compatible `T | null | undefined` // in addition to the jsdoc/closure-compatible `T | null` actions.push(fix(checker.getNullableType(type, 32768 /* TypeFlags.Undefined */), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types)); @@ -158832,7 +160402,7 @@ var ts; if (!info) return; var typeNode = info.typeNode, type = info.type; - var fixedType = typeNode.kind === 314 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; + var fixedType = typeNode.kind === 317 /* SyntaxKind.JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* TypeFlags.Undefined */) : type; doChange(changes, sourceFile, typeNode, fixedType, checker); }); } @@ -158849,22 +160419,22 @@ var ts; // NOTE: Some locations are not handled yet: // MappedTypeNode.typeParameters and SignatureDeclaration.typeParameters, as well as CallExpression.typeArguments switch (node.kind) { - case 229 /* SyntaxKind.AsExpression */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 176 /* SyntaxKind.IndexSignature */: - case 195 /* SyntaxKind.MappedType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 231 /* SyntaxKind.AsExpression */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 178 /* SyntaxKind.IndexSignature */: + case 197 /* SyntaxKind.MappedType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; default: return false; @@ -158967,14 +160537,14 @@ var ts; } var insertBefore; switch (containingFunction.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: insertBefore = containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: insertBefore = ts.findChildOfKind(containingFunction, 98 /* SyntaxKind.FunctionKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: var kind = containingFunction.typeParameters ? 29 /* SyntaxKind.LessThanToken */ : 20 /* SyntaxKind.OpenParenToken */; insertBefore = ts.findChildOfKind(containingFunction, kind, sourceFile) || ts.first(containingFunction.parameters); break; @@ -158994,7 +160564,7 @@ var ts; changes.replaceNode(sourceFile, returnType, ts.factory.createTypeReferenceNode("Promise", ts.factory.createNodeArray([returnType]))); } } - changes.insertModifierBefore(sourceFile, 131 /* SyntaxKind.AsyncKeyword */, insertBefore); + changes.insertModifierBefore(sourceFile, 132 /* SyntaxKind.AsyncKeyword */, insertBefore); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -159310,7 +160880,7 @@ var ts; function annotate(changes, importAdder, sourceFile, declaration, type, program, host) { var typeNode = ts.getTypeNodeIfAccessible(type, declaration, program, host); if (typeNode) { - if (ts.isInJSFile(sourceFile) && declaration.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (ts.isInJSFile(sourceFile) && declaration.kind !== 168 /* SyntaxKind.PropertySignature */) { var parent = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : declaration; if (!parent) { return; @@ -159397,19 +160967,19 @@ var ts; function getFunctionReferences(containingFunction, sourceFile, program, cancellationToken) { var searchToken; switch (containingFunction.kind) { - case 171 /* SyntaxKind.Constructor */: - searchToken = ts.findChildOfKind(containingFunction, 134 /* SyntaxKind.ConstructorKeyword */, sourceFile); + case 173 /* SyntaxKind.Constructor */: + searchToken = ts.findChildOfKind(containingFunction, 135 /* SyntaxKind.ConstructorKeyword */, sourceFile); break; - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: var parent = containingFunction.parent; searchToken = (ts.isVariableDeclaration(parent) || ts.isPropertyDeclaration(parent)) && ts.isIdentifier(parent.name) ? parent.name : containingFunction.name; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: searchToken = containingFunction.name; break; } @@ -159551,24 +161121,24 @@ var ts; node = node.parent; } switch (node.parent.kind) { - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: inferTypeFromExpressionStatement(node, usage); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: usage.isNumber = true; break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: inferTypeFromPrefixUnaryExpression(node.parent, usage); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: inferTypeFromBinaryExpression(node, node.parent, usage); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: inferTypeFromSwitchStatementLabel(node.parent, usage); break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: if (node.parent.expression === node) { inferTypeFromCallExpression(node.parent, usage); } @@ -159576,20 +161146,20 @@ var ts; inferTypeFromContextualType(node, usage); } break; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: inferTypeFromPropertyAccessExpression(node.parent, usage); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: inferTypeFromPropertyElementExpression(node.parent, node, usage); break; - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: inferTypeFromPropertyAssignment(node.parent, usage); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: inferTypeFromPropertyDeclaration(node.parent, usage); break; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var _a = node.parent, name = _a.name, initializer = _a.initializer; if (node === name) { if (initializer) { // This can happen for `let x = null;` which still has an implicit-any error. @@ -159711,7 +161281,7 @@ var ts; case 56 /* SyntaxKind.BarBarToken */: case 60 /* SyntaxKind.QuestionQuestionToken */: if (node === parent.left && - (node.parent.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { + (node.parent.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) { // var x = x || {}; // TODO: use getFalsyflagsOfType addCandidateType(usage, checker.getTypeAtLocation(parent.right)); @@ -159739,7 +161309,7 @@ var ts; } } calculateUsageOfNode(parent, call.return_); - if (parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */) { (usage.calls || (usage.calls = [])).push(call); } else { @@ -160193,25 +161763,44 @@ var ts; * @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub. */ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) { + var _a; if (preserveOptional === void 0) { preserveOptional = 3 /* PreserveOptionalFlags.All */; } if (isAmbient === void 0) { isAmbient = false; } var declarations = symbol.getDeclarations(); - if (!(declarations && declarations.length)) { - return undefined; - } + var declaration = declarations === null || declarations === void 0 ? void 0 : declarations[0]; var checker = context.program.getTypeChecker(); var scriptTarget = ts.getEmitScriptTarget(context.program.getCompilerOptions()); - var declaration = declarations[0]; - var name = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); - var visibilityModifier = createVisibilityModifier(ts.getEffectiveModifierFlags(declaration)); - var modifiers = visibilityModifier ? ts.factory.createNodeArray([visibilityModifier]) : undefined; + /** + * (#49811) + * Note that there are cases in which the symbol declaration is not present. For example, in the code below both + * `MappedIndirect.ax` and `MappedIndirect.ay` have no declaration node attached (due to their mapped-type + * parent): + * + * ```ts + * type Base = { ax: number; ay: string }; + * type BaseKeys = keyof Base; + * type MappedIndirect = { [K in BaseKeys]: boolean }; + * ``` + * + * In such cases, we assume the declaration to be a `PropertySignature`. + */ + var kind = (_a = declaration === null || declaration === void 0 ? void 0 : declaration.kind) !== null && _a !== void 0 ? _a : 168 /* SyntaxKind.PropertySignature */; + var declarationName = ts.getSynthesizedDeepClone(ts.getNameOfDeclaration(declaration), /*includeTrivia*/ false); + var effectiveModifierFlags = declaration ? ts.getEffectiveModifierFlags(declaration) : 0 /* ModifierFlags.None */; + var modifierFlags = effectiveModifierFlags & 4 /* ModifierFlags.Public */ ? 4 /* ModifierFlags.Public */ : + effectiveModifierFlags & 16 /* ModifierFlags.Protected */ ? 16 /* ModifierFlags.Protected */ : + 0 /* ModifierFlags.None */; + if (declaration && ts.isAutoAccessorPropertyDeclaration(declaration)) { + modifierFlags |= 128 /* ModifierFlags.Accessor */; + } + var modifiers = modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration)); var optional = !!(symbol.flags & 16777216 /* SymbolFlags.Optional */); var ambient = !!(enclosingDeclaration.flags & 16777216 /* NodeFlags.Ambient */) || isAmbient; var quotePreference = ts.getQuotePreference(sourceFile, preferences); - switch (declaration.kind) { - case 166 /* SyntaxKind.PropertySignature */: - case 167 /* SyntaxKind.PropertyDeclaration */: + switch (kind) { + case 168 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: var flags = quotePreference === 0 /* QuotePreference.Single */ ? 268435456 /* NodeBuilderFlags.UseSingleQuotesForStringLiteralType */ : undefined; var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, flags, getNoopSymbolTrackerWithResolver(context)); if (importAdder) { @@ -160221,11 +161810,12 @@ var ts; importSymbols(importAdder, importableReference.symbols); } } - addClassElement(ts.factory.createPropertyDeclaration(modifiers, name, optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, + addClassElement(ts.factory.createPropertyDeclaration(modifiers, declaration ? createName(declarationName) : symbol.getName(), optional && (preserveOptional & 2 /* PreserveOptionalFlags.Property */) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, typeNode, /*initializer*/ undefined)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + ts.Debug.assertIsDefined(declarations); var typeNode_1 = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context)); var allAccessors = ts.getAllAccessorDeclarations(declarations, declaration); var orderedAccessors = allAccessors.secondAccessor @@ -160241,19 +161831,19 @@ var ts; for (var _i = 0, orderedAccessors_1 = orderedAccessors; _i < orderedAccessors_1.length; _i++) { var accessor = orderedAccessors_1[_i]; if (ts.isGetAccessorDeclaration(accessor)) { - addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createGetAccessorDeclaration(modifiers, createName(declarationName), ts.emptyArray, createTypeNode(typeNode_1), createBody(body, quotePreference, ambient))); } else { ts.Debug.assertNode(accessor, ts.isSetAccessorDeclaration, "The counterpart to a getter should be a setter"); var parameter = ts.getSetAccessorValueParameter(accessor); var parameterName = parameter && ts.isIdentifier(parameter.name) ? ts.idText(parameter.name) : undefined; - addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : body || createStubbedMethodBody(quotePreference))); + addClassElement(ts.factory.createSetAccessorDeclaration(modifiers, createName(declarationName), createDummyParameters(1, [parameterName], [createTypeNode(typeNode_1)], 1, /*inJs*/ false), createBody(body, quotePreference, ambient))); } } break; } - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: // The signature for the implementation appears as an entry in `signatures` iff // there is only one signature. // If there are overloads and an implementation signature, it appears as an @@ -160261,6 +161851,7 @@ var ts; // If there is more than one overload but no implementation signature // (eg: an abstract method or interface declaration), there is a 1-1 // correspondence of declarations and signatures. + ts.Debug.assertIsDefined(declarations); var signatures = type.isUnion() ? ts.flatMap(type.types, function (t) { return t.getCallSignatures(); }) : type.getCallSignatures(); if (!ts.some(signatures)) { break; @@ -160268,31 +161859,41 @@ var ts; if (declarations.length === 1) { ts.Debug.assert(signatures.length === 1, "One declaration implies one signature"); var signature = signatures[0]; - outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference, ambient)); break; } - for (var _a = 0, signatures_1 = signatures; _a < signatures_1.length; _a++) { - var signature = signatures_1[_a]; + for (var _b = 0, signatures_1 = signatures; _b < signatures_1.length; _b++) { + var signature = signatures_1[_b]; // Ensure nodes are fresh so they can have different positions when going through formatting. - outputMethod(quotePreference, signature, ts.getSynthesizedDeepClones(modifiers, /*includeTrivia*/ false), ts.getSynthesizedDeepClone(name, /*includeTrivia*/ false)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName)); } if (!ambient) { if (declarations.length > signatures.length) { var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]); - outputMethod(quotePreference, signature, modifiers, name, body || createStubbedMethodBody(quotePreference)); + outputMethod(quotePreference, signature, modifiers, createName(declarationName), createBody(body, quotePreference)); } else { ts.Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count"); - addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); + addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, createName(declarationName), optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), modifiers, quotePreference, body)); } } break; } function outputMethod(quotePreference, signature, modifiers, name, body) { - var method = createSignatureDeclarationFromSignature(169 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); + var method = createSignatureDeclarationFromSignature(171 /* SyntaxKind.MethodDeclaration */, context, quotePreference, signature, body, name, modifiers, optional && !!(preserveOptional & 1 /* PreserveOptionalFlags.Method */), enclosingDeclaration, importAdder); if (method) addClassElement(method); } + function createName(node) { + return ts.getSynthesizedDeepClone(node, /*includeTrivia*/ false); + } + function createBody(block, quotePreference, ambient) { + return ambient ? undefined : + ts.getSynthesizedDeepClone(block, /*includeTrivia*/ false) || createStubbedMethodBody(quotePreference); + } + function createTypeNode(typeNode) { + return ts.getSynthesizedDeepClone(typeNode, /*includeTrivia*/ false); + } } codefix.addNewNodeForMemberSymbol = addNewNodeForMemberSymbol; function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) { @@ -160366,6 +161967,9 @@ var ts; if (ts.isMethodDeclaration(signatureDeclaration)) { return ts.factory.updateMethodDeclaration(signatureDeclaration, modifiers, asteriskToken, name !== null && name !== void 0 ? name : ts.factory.createIdentifier(""), questionToken, typeParameters, parameters, type, body); } + if (ts.isFunctionDeclaration(signatureDeclaration)) { + return ts.factory.updateFunctionDeclaration(signatureDeclaration, modifiers, signatureDeclaration.asteriskToken, ts.tryCast(name, ts.isIdentifier), typeParameters, parameters, type, body !== null && body !== void 0 ? body : signatureDeclaration.body); + } return undefined; } codefix.createSignatureDeclarationFromSignature = createSignatureDeclarationFromSignature; @@ -160394,13 +161998,13 @@ var ts; ? undefined : checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker); switch (kind) { - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createMethodDeclaration(modifiers, asteriskToken, name, /*questionToken*/ undefined, typeParameters, parameters, type, createStubbedMethodBody(quotePreference)); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return ts.factory.createMethodSignature(modifiers, name, - /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */) : type); - case 256 /* SyntaxKind.FunctionDeclaration */: + /*questionToken*/ undefined, typeParameters, parameters, type === undefined ? ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */) : type); + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, createStubbedBody(ts.Diagnostics.Function_not_implemented.message, quotePreference)); default: ts.Debug.fail("Unexpected kind"); @@ -160537,7 +162141,7 @@ var ts; /*dotDotDotToken*/ undefined, /*name*/ parameterName + (parameterNameCount || ""), /*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, - /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */), + /*type*/ inJs ? undefined : (types === null || types === void 0 ? void 0 : types[i]) || ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */), /*initializer*/ undefined); parameters.push(newParameter); } @@ -160567,7 +162171,7 @@ var ts; if (someSigHasRestParameter) { var restParameter = ts.factory.createParameterDeclaration( /*modifiers*/ undefined, ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest", - /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */)), + /*questionToken*/ maxNonRestArgs >= minArgumentCount ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, ts.factory.createArrayTypeNode(ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */)), /*initializer*/ undefined); parameters.push(restParameter); } @@ -160595,15 +162199,6 @@ var ts; /*multiline*/ true); } codefix.createStubbedBody = createStubbedBody; - function createVisibilityModifier(flags) { - if (flags & 4 /* ModifierFlags.Public */) { - return ts.factory.createToken(123 /* SyntaxKind.PublicKeyword */); - } - else if (flags & 16 /* ModifierFlags.Protected */) { - return ts.factory.createToken(122 /* SyntaxKind.ProtectedKeyword */); - } - return undefined; - } function setJsonCompilerOptionValues(changeTracker, configFile, options) { var tsconfigObjectLiteral = ts.getTsConfigObjectLiteralExpression(configFile); if (!tsconfigObjectLiteral) @@ -160682,6 +162277,15 @@ var ts; symbols.forEach(function (s) { return importAdder.addImportFromExportedSymbol(s, /*isValidTypeOnlyUseSite*/ true); }); } codefix.importSymbols = importSymbols; + function findAncestorMatchingSpan(sourceFile, span) { + var end = ts.textSpanEnd(span); + var token = ts.getTokenAtPosition(sourceFile, span.start); + while (token.end < end) { + token = token.parent; + } + return token; + } + codefix.findAncestorMatchingSpan = findAncestorMatchingSpan; })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); /* @internal */ @@ -160704,13 +162308,13 @@ var ts; if (ts.isClassLike(container)) { var modifierFlags = ts.getEffectiveModifierFlags(declaration); if (ts.isSourceFileJS(file)) { - var modifiers = ts.createModifiers(modifierFlags); + var modifiers = ts.factory.createModifiersFromModifierFlags(modifierFlags); accessorModifiers = modifiers; fieldModifiers = modifiers; } else { - accessorModifiers = ts.createModifiers(prepareModifierFlagsForAccessor(modifierFlags)); - fieldModifiers = ts.createModifiers(prepareModifierFlagsForField(modifierFlags)); + accessorModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForAccessor(modifierFlags)); + fieldModifiers = ts.factory.createModifiersFromModifierFlags(prepareModifierFlagsForField(modifierFlags)); } if (ts.canHaveDecorators(declaration)) { fieldModifiers = ts.concatenate(ts.getDecorators(declaration), fieldModifiers); @@ -160779,7 +162383,7 @@ var ts; error: ts.getLocaleSpecificMessage(ts.Diagnostics.Name_is_not_valid) }; } - if (((ts.getEffectiveModifierFlags(declaration) & 125951 /* ModifierFlags.Modifier */) | meaning) !== meaning) { + if (((ts.getEffectiveModifierFlags(declaration) & 126975 /* ModifierFlags.Modifier */) | meaning) !== meaning) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_property_with_modifier) }; @@ -160792,7 +162396,7 @@ var ts; isStatic: ts.hasStaticModifier(declaration), isReadonly: ts.hasEffectiveReadonlyModifier(declaration), type: getDeclarationType(declaration, program), - container: declaration.kind === 164 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, + container: declaration.kind === 166 /* SyntaxKind.Parameter */ ? declaration.parent.parent : declaration.parent, originalName: declaration.name.text, declaration: declaration, fieldName: fieldName, @@ -160866,7 +162470,7 @@ var ts; var type = typeChecker.getTypeFromTypeNode(typeNode); if (!typeChecker.isTypeAssignableTo(typeChecker.getUndefinedType(), type)) { var types = ts.isUnionTypeNode(typeNode) ? typeNode.types : [typeNode]; - return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)], false)); + return ts.factory.createUnionTypeNode(__spreadArray(__spreadArray([], types, true), [ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)], false)); } } return typeNode; @@ -160924,7 +162528,7 @@ var ts; }); function getActionsForUsageOfInvalidImport(context) { var sourceFile = context.sourceFile; - var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 208 /* SyntaxKind.CallExpression */ : 209 /* SyntaxKind.NewExpression */; + var targetKind = ts.Diagnostics.This_expression_is_not_callable.code === context.errorCode ? 210 /* SyntaxKind.CallExpression */ : 211 /* SyntaxKind.NewExpression */; var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start), function (a) { return a.kind === targetKind; }); if (!node) { return []; @@ -161050,7 +162654,7 @@ var ts; return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_undefined_type_to_property_0, info.prop.name.getText()], fixIdAddUndefinedType, ts.Diagnostics.Add_undefined_type_to_all_uninitialized_properties); } function addUndefinedType(changeTracker, sourceFile, info) { - var undefinedTypeNode = ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + var undefinedTypeNode = ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); var types = ts.isUnionTypeNode(info.type) ? info.type.types.concat(undefinedTypeNode) : [info.type, undefinedTypeNode]; var unionTypeNode = ts.factory.createUnionTypeNode(types); if (info.isJs) { @@ -161096,7 +162700,7 @@ var ts; } else if (type.isClass()) { var classDeclaration = ts.getClassLikeDeclarationOfSymbol(type.symbol); - if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 128 /* ModifierFlags.Abstract */)) + if (!classDeclaration || ts.hasSyntacticModifier(classDeclaration, 256 /* ModifierFlags.Abstract */)) return undefined; var constructorDeclaration = ts.getFirstConstructorWithBody(classDeclaration); if (constructorDeclaration && constructorDeclaration.parameters.length) @@ -161273,7 +162877,7 @@ var ts; function getImportTypeNode(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); ts.Debug.assert(token.kind === 100 /* SyntaxKind.ImportKeyword */, "This token should be an ImportKeyword"); - ts.Debug.assert(token.parent.kind === 200 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); + ts.Debug.assert(token.parent.kind === 202 /* SyntaxKind.ImportType */, "Token parent should be an ImportType"); return token.parent; } function doChange(changes, sourceFile, importType) { @@ -161402,7 +163006,7 @@ var ts; var otherMembers = members.filter(function (member) { return !ts.isIndexSignatureDeclaration(member); }); var parameter = ts.first(indexSignature.parameters); var mappedTypeParameter = ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.cast(parameter.name, ts.isIdentifier), parameter.type); - var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, + var mappedIntersectionType = ts.factory.createMappedTypeNode(ts.hasEffectiveReadonlyModifier(indexSignature) ? ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */) : undefined, mappedTypeParameter, /*nameType*/ undefined, indexSignature.questionToken, indexSignature.type, /*members*/ undefined); var intersectionType = ts.factory.createIntersectionTypeNode(__spreadArray(__spreadArray(__spreadArray([], ts.getAllSuperTypeNodes(container), true), [ @@ -161460,7 +163064,7 @@ var ts; }, }); function makeChange(changeTracker, sourceFile, span) { - var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 132 /* SyntaxKind.AwaitKeyword */; }); + var awaitKeyword = ts.tryCast(ts.getTokenAtPosition(sourceFile, span.start), function (node) { return node.kind === 133 /* SyntaxKind.AwaitKeyword */; }); var awaitExpression = awaitKeyword && ts.tryCast(awaitKeyword.parent, ts.isAwaitExpression); if (!awaitExpression) { return; @@ -161527,28 +163131,45 @@ var ts; errorCodes: errorCodes, getCodeActions: function getCodeActionsToConvertConstToLet(context) { var sourceFile = context.sourceFile, span = context.span, program = context.program; - var range = getConstTokenRange(sourceFile, span.start, program); - if (range === undefined) + var info = getInfo(sourceFile, span.start, program); + if (info === undefined) return; - var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, range); }); - return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_const_to_let)]; + var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, info.token); }); + return [codefix.createCodeFixActionMaybeFixAll(fixId, changes, ts.Diagnostics.Convert_const_to_let, fixId, ts.Diagnostics.Convert_all_const_to_let)]; + }, + getAllCodeActions: function (context) { + var program = context.program; + var seen = new ts.Map(); + return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) { + codefix.eachDiagnostic(context, errorCodes, function (diag) { + var info = getInfo(diag.file, diag.start, program); + if (info) { + if (ts.addToSeen(seen, ts.getSymbolId(info.symbol))) { + return doChange(changes, diag.file, info.token); + } + } + return undefined; + }); + })); }, fixIds: [fixId] }); - function getConstTokenRange(sourceFile, pos, program) { + function getInfo(sourceFile, pos, program) { var _a; var checker = program.getTypeChecker(); var symbol = checker.getSymbolAtLocation(ts.getTokenAtPosition(sourceFile, pos)); + if (symbol === undefined) + return; var declaration = ts.tryCast((_a = symbol === null || symbol === void 0 ? void 0 : symbol.valueDeclaration) === null || _a === void 0 ? void 0 : _a.parent, ts.isVariableDeclarationList); if (declaration === undefined) return; var constToken = ts.findChildOfKind(declaration, 85 /* SyntaxKind.ConstKeyword */, sourceFile); if (constToken === undefined) return; - return ts.createRange(constToken.pos, constToken.end); + return { symbol: symbol, token: constToken }; } - function doChange(changes, sourceFile, range) { - changes.replaceRangeWithText(sourceFile, range, "let"); + function doChange(changes, sourceFile, token) { + changes.replaceNode(sourceFile, token, ts.factory.createToken(119 /* SyntaxKind.LetKeyword */)); } })(codefix = ts.codefix || (ts.codefix = {})); })(ts || (ts = {})); @@ -161723,7 +163344,6 @@ var ts; return { edits: edits, renameFilename: undefined, renameLocation: undefined }; }, }); - ; function getInfo(context, considerPartialSpans) { if (considerPartialSpans === void 0) { considerPartialSpans = true; } var file = context.file, program = context.program; @@ -161735,8 +163355,8 @@ var ts; } var checker = program.getTypeChecker(); var exportingModuleSymbol = getExportingModuleSymbol(exportNode, checker); - var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 513 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); - var wasDefault = !!(flags & 512 /* ModifierFlags.Default */); + var flags = ts.getSyntacticModifierFlags(exportNode) || ((ts.isExportAssignment(exportNode) && !exportNode.isExportEquals) ? 1025 /* ModifierFlags.ExportDefault */ : 0 /* ModifierFlags.None */); + var wasDefault = !!(flags & 1024 /* ModifierFlags.Default */); // If source file already has a default export, don't offer refactor. if (!(flags & 1 /* ModifierFlags.Export */) || !wasDefault && exportingModuleSymbol.exports.has("default" /* InternalSymbolName.Default */)) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.This_file_already_has_a_default_export) }; @@ -161746,19 +163366,19 @@ var ts; : { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_named_export) }; }; switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: { var node = exportNode; if (!node.name) return undefined; return noSymbolError(node.name) || { exportNode: node, exportName: node.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { var vs = exportNode; // Must be `export const x = something;`. if (!(vs.declarationList.flags & 2 /* NodeFlags.Const */) || vs.declarationList.declarations.length !== 1) { @@ -161771,7 +163391,7 @@ var ts; return noSymbolError(decl.name) || { exportNode: vs, exportName: decl.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol }; } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var node = exportNode; if (node.isExportEquals) return undefined; @@ -161801,12 +163421,12 @@ var ts; else { var exportKeyword = ts.Debug.checkDefined(ts.findModifier(exportNode, 93 /* SyntaxKind.ExportKeyword */), "Should find an export keyword in modifier list"); switch (exportNode.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.factory.createToken(88 /* SyntaxKind.DefaultKeyword */)); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // If 'x' isn't used in this file and doesn't have type definition, `export const x = 0;` --> `export default 0;` var decl = ts.first(exportNode.declarationList.declarations); if (!ts.FindAllReferences.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile) && !decl.type) { @@ -161815,9 +163435,9 @@ var ts; break; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // `export type T = number;` -> `type T = number; export default T;` changes.deleteModifier(exportingSourceFile, exportKeyword); changes.insertNodeAfter(exportingSourceFile, exportNode, ts.factory.createExportDefault(ts.factory.createIdentifier(exportName.text))); @@ -161846,18 +163466,18 @@ var ts; function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.default` --> `a.foo` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier(exportName)); break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: { var spec = parent; // `default as foo` --> `foo`, `default as bar` --> `foo as bar` changes.replaceNode(importingSourceFile, spec, makeImportSpecifier(exportName, spec.name.text)); break; } - case 267 /* SyntaxKind.ImportClause */: { + case 270 /* SyntaxKind.ImportClause */: { var clause = parent; ts.Debug.assert(clause.name === ref, "Import clause name should match provided ref"); var spec = makeImportSpecifier(exportName, ref.text); @@ -161866,7 +163486,7 @@ var ts; // `import foo from "./a";` --> `import { foo } from "./a";` changes.replaceNode(importingSourceFile, ref, ts.factory.createNamedImports([spec])); } - else if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + else if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // `import foo, * as a from "./a";` --> `import * as a from ".a/"; import { foo } from "./a";` changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) }); var quotePreference = ts.isStringLiteral(clause.parent.moduleSpecifier) ? ts.quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1 /* QuotePreference.Double */; @@ -161880,7 +163500,7 @@ var ts; } break; } - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: var importTypeNode = parent; changes.replaceNode(importingSourceFile, parent, ts.factory.createImportTypeNode(importTypeNode.argument, importTypeNode.assertions, ts.factory.createIdentifier(exportName), importTypeNode.typeArguments, importTypeNode.isTypeOf)); break; @@ -161891,11 +163511,11 @@ var ts; function changeNamedToDefaultImport(importingSourceFile, ref, changes) { var parent = ref.parent; switch (parent.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // `a.foo` --> `a.default` changes.replaceNode(importingSourceFile, ref, ts.factory.createIdentifier("default")); break; - case 270 /* SyntaxKind.ImportSpecifier */: { + case 273 /* SyntaxKind.ImportSpecifier */: { // `import { foo } from "./a";` --> `import foo from "./a";` // `import { foo as bar } from "./a";` --> `import bar from "./a";` var defaultImport = ts.factory.createIdentifier(parent.name.text); @@ -161908,7 +163528,7 @@ var ts; } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // `export { foo } from "./a";` --> `export { default as foo } from "./a";` // `export { foo as bar } from "./a";` --> `export { default as bar } from "./a";` // `export { foo as default } from "./a";` --> `export { default } from "./a";` @@ -162009,7 +163629,7 @@ var ts; if (!importClause.namedBindings) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_namespace_import_or_named_imports) }; } - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return { convertTo: 0 /* ImportKind.Named */, import: importClause.namedBindings }; } var shouldUseDefault = getShouldUseDefault(context.program, importClause); @@ -162200,7 +163820,6 @@ var ts; }); return { edits: edits, renameFilename: undefined, renameLocation: undefined }; } - ; function isValidExpression(node) { return ts.isBinaryExpression(node) || ts.isConditionalExpression(node); } @@ -162248,7 +163867,6 @@ var ts; if (expression.operatorToken.kind !== 55 /* SyntaxKind.AmpersandAmpersandToken */) { return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Can_only_convert_logical_AND_access_chains) }; } - ; var finalExpression = getFinalExpressionInChain(expression.right); if (!finalExpression) return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Could_not_find_convertible_access_expression) }; @@ -162458,27 +164076,27 @@ var ts; var lastDeclaration = signatureDecls[signatureDecls.length - 1]; var updated = lastDeclaration; switch (lastDeclaration.kind) { - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { updated = ts.factory.updateMethodSignature(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { updated = ts.factory.updateMethodDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.questionToken, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { updated = ts.factory.updateCallSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { updated = ts.factory.updateConstructorDeclaration(lastDeclaration, lastDeclaration.modifiers, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.body); break; } - case 175 /* SyntaxKind.ConstructSignature */: { + case 177 /* SyntaxKind.ConstructSignature */: { updated = ts.factory.updateConstructSignature(lastDeclaration, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type); break; } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { updated = ts.factory.updateFunctionDeclaration(lastDeclaration, lastDeclaration.modifiers, lastDeclaration.asteriskToken, lastDeclaration.name, lastDeclaration.typeParameters, getNewParametersForCombinedSignature(signatureDecls), lastDeclaration.type, lastDeclaration.body); break; } @@ -162509,7 +164127,7 @@ var ts; } function convertParameterToNamedTupleMember(p) { ts.Debug.assert(ts.isIdentifier(p.name)); // This is checked during refactoring applicability checking - var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)), p); + var result = ts.setTextRange(ts.factory.createNamedTupleMember(p.dotDotDotToken, p.name, p.questionToken, p.type || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)), p); var parameterDocComment = p.symbol && p.symbol.getDocumentationComment(checker); if (parameterDocComment) { var newComment = ts.displayPartsToString(parameterDocComment); @@ -162529,12 +164147,12 @@ var ts; } function isConvertableSignatureDeclaration(d) { switch (d.kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: return true; } return false; @@ -162653,8 +164271,8 @@ var ts; var i = 0; for (var _i = 0, extractions_1 = extractions; _i < extractions_1.length; _i++) { var _a = extractions_1[_i], functionExtraction = _a.functionExtraction, constantExtraction = _a.constantExtraction; - var description = functionExtraction.description; if (refactor.refactorKindBeginsWith(extractFunctionAction.kind, requestedRefactor)) { + var description = functionExtraction.description; if (functionExtraction.errors.length === 0) { // Don't issue refactorings with duplicated names. // Scopes come back in "innermost first" order, so extractions will @@ -162678,15 +164296,15 @@ var ts; } } if (refactor.refactorKindBeginsWith(extractConstantAction.kind, requestedRefactor)) { + var description = constantExtraction.description; if (constantExtraction.errors.length === 0) { // Don't issue refactorings with duplicated names. // Scopes come back in "innermost first" order, so extractions will // preferentially go into nearer scopes - var description_1 = constantExtraction.description; - if (!usedConstantNames.has(description_1)) { - usedConstantNames.set(description_1, true); + if (!usedConstantNames.has(description)) { + usedConstantNames.set(description, true); constantActions.push({ - description: description_1, + description: description, name: "constant_scope_".concat(i), kind: extractConstantAction.kind }); @@ -162831,7 +164449,6 @@ var ts; var start = cursorRequest ? getExtractableParent(startToken) : ts.getParentNodeInSpan(startToken, sourceFile, adjustedSpan); // Do the same for the ending position var end = cursorRequest ? start : ts.getParentNodeInSpan(endToken, sourceFile, adjustedSpan); - var declarations = []; // We'll modify these flags as we walk the tree to collect data // about what things need to be done as part of the extraction. var rangeFacts = RangeFacts.None; @@ -162874,7 +164491,7 @@ var ts; // the expression. return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractRange)] }; } - return { targetRange: { range: statements, facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; + return { targetRange: { range: statements, facts: rangeFacts, thisNode: thisNode } }; } if (ts.isReturnStatement(start) && !start.expression) { // Makes no sense to extract an expression-less return statement. @@ -162886,7 +164503,7 @@ var ts; if (errors) { return { errors: errors }; } - return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, declarations: declarations, thisNode: thisNode } }; // TODO: GH#18217 + return { targetRange: { range: getStatementOrExpressionRange(node), facts: rangeFacts, thisNode: thisNode } }; // TODO: GH#18217 /** * Attempt to refine the extraction node (generally, by shrinking it) to produce better results. * @param node The unrefined extraction node. @@ -162898,10 +164515,10 @@ var ts; } } else if (ts.isVariableStatement(node) || ts.isVariableDeclarationList(node)) { - var declarations_6 = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations; + var declarations = ts.isVariableStatement(node) ? node.declarationList.declarations : node.declarations; var numInitializers = 0; var lastInitializer = void 0; - for (var _i = 0, declarations_5 = declarations_6; _i < declarations_5.length; _i++) { + for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) { var declaration = declarations_5[_i]; if (declaration.initializer) { numInitializers++; @@ -162929,20 +164546,20 @@ var ts; function checkForStaticContext(nodeToCheck, containingClass) { var current = nodeToCheck; while (current !== containingClass) { - if (current.kind === 167 /* SyntaxKind.PropertyDeclaration */) { + if (current.kind === 169 /* SyntaxKind.PropertyDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 164 /* SyntaxKind.Parameter */) { + else if (current.kind === 166 /* SyntaxKind.Parameter */) { var ctorOrMethod = ts.getContainingFunction(current); - if (ctorOrMethod.kind === 171 /* SyntaxKind.Constructor */) { + if (ctorOrMethod.kind === 173 /* SyntaxKind.Constructor */) { rangeFacts |= RangeFacts.InStaticRegion; } break; } - else if (current.kind === 169 /* SyntaxKind.MethodDeclaration */) { + else if (current.kind === 171 /* SyntaxKind.MethodDeclaration */) { if (ts.isStatic(current)) { rangeFacts |= RangeFacts.InStaticRegion; } @@ -162980,9 +164597,9 @@ var ts; visit(nodeToCheck); if (rangeFacts & RangeFacts.UsesThis) { var container = ts.getThisContainer(nodeToCheck, /** includeArrowFunctions */ false); - if (container.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) || - container.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (container.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) || + container.kind === 215 /* SyntaxKind.FunctionExpression */) { rangeFacts |= RangeFacts.UsesThisInFunction; } } @@ -162993,7 +164610,7 @@ var ts; return true; } if (ts.isDeclaration(node)) { - var declaringNode = (node.kind === 254 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; + var declaringNode = (node.kind === 257 /* SyntaxKind.VariableDeclaration */) ? node.parent.parent : node; if (ts.hasSyntacticModifier(declaringNode, 1 /* ModifierFlags.Export */)) { // TODO: GH#18217 Silly to use `errors ||` since it's definitely not defined (see top of `visit`) // Also, if we're only pushing one error, just use `let error: Diagnostic | undefined`! @@ -163001,20 +164618,19 @@ var ts; (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; } - declarations.push(node.symbol); } // Some things can't be extracted in certain situations switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport)); return true; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractExportedEntity)); return true; case 106 /* SyntaxKind.SuperKeyword */: // For a super *constructor call*, we have to be extracting the entire class, // but a super *method call* simply implies a 'this' reference - if (node.parent.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.parent.kind === 210 /* SyntaxKind.CallExpression */) { // Super constructor call var containingClass_1 = ts.getContainingClass(node); if (containingClass_1 === undefined || containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) { @@ -163027,7 +164643,7 @@ var ts; thisNode = node; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // check if arrow function uses this ts.forEachChild(node, function check(n) { if (ts.isThis(n)) { @@ -163042,39 +164658,39 @@ var ts; } }); // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) { // You cannot extract global declarations (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope)); } // falls through - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // do not dive into functions or classes return false; } var savedPermittedJumps = permittedJumps; switch (node.kind) { - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: permittedJumps &= ~4 /* PermittedJumps.Return */; break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // forbid all jumps inside try blocks permittedJumps = 0 /* PermittedJumps.None */; break; - case 235 /* SyntaxKind.Block */: - if (node.parent && node.parent.kind === 252 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { + case 238 /* SyntaxKind.Block */: + if (node.parent && node.parent.kind === 255 /* SyntaxKind.TryStatement */ && node.parent.finallyBlock === node) { // allow unconditional returns from finally blocks permittedJumps = 4 /* PermittedJumps.Return */; } break; - case 290 /* SyntaxKind.DefaultClause */: - case 289 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: // allow unlabeled break inside case clauses permittedJumps |= 1 /* PermittedJumps.Break */; break; @@ -163086,20 +164702,20 @@ var ts; break; } switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: rangeFacts |= RangeFacts.UsesThis; thisNode = node; break; - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { var label = node.label; (seenLabels || (seenLabels = [])).push(label.escapedText); ts.forEachChild(node, visit); seenLabels.pop(); break; } - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: { + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: { var label = node.label; if (label) { if (!ts.contains(seenLabels, label.escapedText)) { @@ -163108,20 +164724,20 @@ var ts; } } else { - if (!(permittedJumps & (node.kind === 246 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { + if (!(permittedJumps & (node.kind === 249 /* SyntaxKind.BreakStatement */ ? 1 /* PermittedJumps.Break */ : 2 /* PermittedJumps.Continue */))) { // attempt to break or continue in a forbidden context (errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements)); } } break; } - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: rangeFacts |= RangeFacts.IsAsyncFunction; break; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: rangeFacts |= RangeFacts.IsGenerator; break; - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: if (permittedJumps & 4 /* PermittedJumps.Return */) { rangeFacts |= RangeFacts.HasReturn; } @@ -163191,7 +164807,7 @@ var ts; while (true) { current = current.parent; // A function parameter's initializer is actually in the outer scope, not the function declaration - if (current.kind === 164 /* SyntaxKind.Parameter */) { + if (current.kind === 166 /* SyntaxKind.Parameter */) { // Skip all the way to the outer scope of the function that declared this parameter current = ts.findAncestor(current, function (parent) { return ts.isFunctionLikeDeclaration(parent); }).parent; } @@ -163202,7 +164818,7 @@ var ts; // * Module/namespace or source file if (isScope(current)) { scopes.push(current); - if (current.kind === 305 /* SyntaxKind.SourceFile */) { + if (current.kind === 308 /* SyntaxKind.SourceFile */) { return scopes; } } @@ -163292,32 +164908,32 @@ var ts; } function getDescriptionForFunctionLikeDeclaration(scope) { switch (scope.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "constructor"; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return scope.name ? "function '".concat(scope.name.text, "'") : ts.ANONYMOUS; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return "arrow function"; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return "method '".concat(scope.name.getText(), "'"); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return "'get ".concat(scope.name.getText(), "'"); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return "'set ".concat(scope.name.getText(), "'"); default: throw ts.Debug.assertNever(scope, "Unexpected scope kind ".concat(scope.kind)); } } function getDescriptionForClassLikeDeclaration(scope) { - return scope.kind === 257 /* SyntaxKind.ClassDeclaration */ + return scope.kind === 260 /* SyntaxKind.ClassDeclaration */ ? scope.name ? "class '".concat(scope.name.text, "'") : "anonymous class declaration" : scope.name ? "class expression '".concat(scope.name.text, "'") : "anonymous class expression"; } function getDescriptionForModuleLikeDeclaration(scope) { - return scope.kind === 262 /* SyntaxKind.ModuleBlock */ + return scope.kind === 265 /* SyntaxKind.ModuleBlock */ ? "namespace '".concat(scope.parent.name.getText(), "'") : scope.externalModuleIndicator ? 0 /* SpecialScope.Module */ : 1 /* SpecialScope.Global */; } @@ -163390,7 +165006,7 @@ var ts; modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } if (range.facts & RangeFacts.IsAsyncFunction) { - modifiers.push(ts.factory.createModifier(131 /* SyntaxKind.AsyncKeyword */)); + modifiers.push(ts.factory.createModifier(132 /* SyntaxKind.AsyncKeyword */)); } newFunction = ts.factory.createMethodDeclaration(modifiers.length ? modifiers : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, /*questionToken*/ undefined, typeParameters, parameters, returnType, body); @@ -163404,7 +165020,7 @@ var ts; /*questionToken*/ undefined, checker.typeToTypeNode(checker.getTypeAtLocation(range.thisNode), scope, 1 /* NodeBuilderFlags.NoTruncation */), /*initializer*/ undefined)); } - newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(131 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); + newFunction = ts.factory.createFunctionDeclaration(range.facts & RangeFacts.IsAsyncFunction ? [ts.factory.createToken(132 /* SyntaxKind.AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.factory.createToken(41 /* SyntaxKind.AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body); } var changeTracker = ts.textChanges.ChangeTracker.fromContext(context); var minInsertionPos = (isReadonlyArray(range.range) ? ts.last(range.range) : range.range).end; @@ -163552,9 +165168,9 @@ var ts; while (ts.isParenthesizedTypeNode(withoutParens)) { withoutParens = withoutParens.type; } - return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 153 /* SyntaxKind.UndefinedKeyword */; }) + return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 155 /* SyntaxKind.UndefinedKeyword */; }) ? clone - : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + : ts.factory.createUnionTypeNode([clone, ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } } /** @@ -163585,7 +165201,7 @@ var ts; if (rangeFacts & RangeFacts.InStaticRegion) { modifiers.push(ts.factory.createModifier(124 /* SyntaxKind.StaticKeyword */)); } - modifiers.push(ts.factory.createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); + modifiers.push(ts.factory.createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); var newVariable = ts.factory.createPropertyDeclaration(modifiers, localNameText, /*questionToken*/ undefined, variableType, initializer); var localReference = ts.factory.createPropertyAccessExpression(rangeFacts & RangeFacts.InStaticRegion @@ -163616,7 +165232,7 @@ var ts; var localReference = ts.factory.createIdentifier(localNameText); changeTracker.replaceNode(context.file, node, localReference); } - else if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { + else if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) { // If the parent is an expression statement and the target scope is the immediately enclosing one, // replace the statement with the declaration. var newVariableStatement = ts.factory.createVariableStatement( @@ -163635,7 +165251,7 @@ var ts; changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ false); } // Consume - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { // If the parent is an expression statement, delete it. changeTracker.delete(context.file, node.parent); } @@ -164281,30 +165897,30 @@ var ts; function isExtractableExpression(node) { var parent = node.parent; switch (parent.kind) { - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return false; } switch (node.kind) { case 10 /* SyntaxKind.StringLiteral */: - return parent.kind !== 266 /* SyntaxKind.ImportDeclaration */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */; - case 225 /* SyntaxKind.SpreadElement */: - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 203 /* SyntaxKind.BindingElement */: + return parent.kind !== 269 /* SyntaxKind.ImportDeclaration */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */; + case 227 /* SyntaxKind.SpreadElement */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 205 /* SyntaxKind.BindingElement */: return false; case 79 /* SyntaxKind.Identifier */: - return parent.kind !== 203 /* SyntaxKind.BindingElement */ && - parent.kind !== 270 /* SyntaxKind.ImportSpecifier */ && - parent.kind !== 275 /* SyntaxKind.ExportSpecifier */; + return parent.kind !== 205 /* SyntaxKind.BindingElement */ && + parent.kind !== 273 /* SyntaxKind.ImportSpecifier */ && + parent.kind !== 278 /* SyntaxKind.ExportSpecifier */; } return true; } function isBlockLike(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 305 /* SyntaxKind.SourceFile */: - case 262 /* SyntaxKind.ModuleBlock */: - case 289 /* SyntaxKind.CaseClause */: + case 238 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 265 /* SyntaxKind.ModuleBlock */: + case 292 /* SyntaxKind.CaseClause */: return true; default: return false; @@ -164592,7 +166208,6 @@ var ts; (function (ts) { var refactor; (function (refactor) { - ; /** * Checks if some refactor info has refactor error info. */ @@ -164697,15 +166312,14 @@ var ts; // Imports will be copied to the new file anyway, and may still be needed in the old file. // Prologue directives will be copied to the new file and should be left in the old file. return !isPureImport(statement) && !ts.isPrologueDirective(statement); - ; } function isPureImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return true; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return !ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return node.declarationList.declarations.every(function (d) { return !!d.initializer && ts.isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true); }); default: return false; @@ -164728,7 +166342,7 @@ var ts; function getNewStatementsAndRemoveFromOldFile(oldFile, usage, changes, toMove, program, newModuleName, preferences) { var checker = program.getTypeChecker(); var prologueDirectives = ts.takeWhile(oldFile.statements, ts.isPrologueDirective); - if (!oldFile.externalModuleIndicator && !oldFile.commonJsModuleIndicator) { + if (oldFile.externalModuleIndicator === undefined && oldFile.commonJsModuleIndicator === undefined && usage.oldImportsNeededByNewFile.size() === 0) { deleteMovedStatements(oldFile, toMove.ranges, changes); return __spreadArray(__spreadArray([], prologueDirectives, true), toMove.all, true); } @@ -164801,12 +166415,12 @@ var ts; } function getNamespaceLikeImport(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? + case 269 /* SyntaxKind.ImportDeclaration */: + return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? node.importClause.namedBindings.name : undefined; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.name; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.tryCast(node.name, ts.isIdentifier); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); @@ -164837,21 +166451,21 @@ var ts; var newNamespaceId = ts.factory.createIdentifier(newNamespaceName); var newModuleString = ts.factory.createStringLiteral(newModuleSpecifier); switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*name*/ undefined, ts.factory.createNamespaceImport(newNamespaceId)), newModuleString, /*assertClause*/ undefined); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.createImportEqualsDeclaration(/*modifiers*/ undefined, /*isTypeOnly*/ false, newNamespaceId, ts.factory.createExternalModuleReference(newModuleString)); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ts.factory.createVariableDeclaration(newNamespaceId, /*exclamationToken*/ undefined, /*type*/ undefined, createRequireCall(newModuleString)); default: return ts.Debug.assertNever(node, "Unexpected node kind ".concat(node.kind)); } } function moduleSpecifierFromImport(i) { - return (i.kind === 266 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier - : i.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression + return (i.kind === 269 /* SyntaxKind.ImportDeclaration */ ? i.moduleSpecifier + : i.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ ? i.moduleReference.expression : i.initializer.arguments[0]); } function forEachImportInStatement(statement, cb) { @@ -164921,15 +166535,15 @@ var ts; } function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) { switch (importDecl.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (isUnused(importDecl.name)) { changes.delete(sourceFile, importDecl); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused); break; default: @@ -164942,7 +166556,7 @@ var ts; var _a = importDecl.importClause, name = _a.name, namedBindings = _a.namedBindings; var defaultUnused = !name || isUnused(name); var namedBindingsUnused = !namedBindings || - (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); + (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); })); if (defaultUnused && namedBindingsUnused) { changes.delete(sourceFile, importDecl); } @@ -164954,7 +166568,7 @@ var ts; if (namedBindingsUnused) { changes.replaceNode(sourceFile, importDecl.importClause, ts.factory.updateImportClause(importDecl.importClause, importDecl.importClause.isTypeOnly, name, /*namedBindings*/ undefined)); } - else if (namedBindings.kind === 269 /* SyntaxKind.NamedImports */) { + else if (namedBindings.kind === 272 /* SyntaxKind.NamedImports */) { for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) { var element = _b[_i]; if (isUnused(element.name)) @@ -164969,12 +166583,17 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: if (isUnused(name)) { - changes.delete(sourceFile, name); + if (varDecl.initializer && ts.isRequireCall(varDecl.initializer, /*requireStringLiteralLikeArgument*/ true)) { + changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && ts.length(varDecl.parent.declarations) === 1 ? varDecl.parent.parent : varDecl); + } + else { + changes.delete(sourceFile, name); + } } break; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: break; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: if (name.elements.every(function (e) { return ts.isIdentifier(e.name) && isUnused(e.name); })) { changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl); } @@ -165016,7 +166635,7 @@ var ts; if (markSeenTop(top)) { addExportToChanges(oldFile, top, name, changes, useEsModuleSyntax); } - if (ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */)) { oldFileDefault = name; } else { @@ -165104,14 +166723,14 @@ var ts; // Below should all be utilities function isInImport(decl) { switch (decl.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: return true; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return isVariableDeclarationInImport(decl); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return ts.isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent); default: return false; @@ -165123,7 +166742,7 @@ var ts; } function filterImport(i, moduleSpecifier, keep) { switch (i.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { var clause = i.importClause; if (!clause) return undefined; @@ -165133,9 +166752,9 @@ var ts; ? ts.factory.createImportDeclaration(/*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, defaultImport, namedBindings), moduleSpecifier, /*assertClause*/ undefined) : undefined; } - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return keep(i.name) ? i : undefined; - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { var name = filterBindingName(i.name, keep); return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : undefined; } @@ -165144,7 +166763,7 @@ var ts; } } function filterNamedBindings(namedBindings, keep) { - if (namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { return keep(namedBindings.name) ? namedBindings : undefined; } else { @@ -165156,9 +166775,9 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return keep(name) ? name : undefined; - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return name; - case 201 /* SyntaxKind.ObjectBindingPattern */: { + case 203 /* SyntaxKind.ObjectBindingPattern */: { // We can't handle nested destructurings or property names well here, so just copy them all. var newElements = name.elements.filter(function (prop) { return prop.propertyName || !ts.isIdentifier(prop.name) || keep(prop.name); }); return newElements.length ? ts.factory.createObjectBindingPattern(newElements) : undefined; @@ -165201,6 +166820,9 @@ var ts; ts.copyEntries(this.map, clone.map); return clone; }; + SymbolSet.prototype.size = function () { + return this.map.size; + }; return SymbolSet; }()); function isTopLevelDeclaration(node) { @@ -165215,13 +166837,13 @@ var ts; } function isNonVariableTopLevelDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -165229,17 +166851,17 @@ var ts; } function forEachTopLevelDeclaration(statement, cb) { switch (statement.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return cb(statement); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.firstDefined(statement.declarationList.declarations, function (decl) { return forEachTopLevelDeclarationInBindingName(decl.name, cb); }); - case 238 /* SyntaxKind.ExpressionStatement */: { + case 241 /* SyntaxKind.ExpressionStatement */: { var expression = statement.expression; return ts.isBinaryExpression(expression) && ts.getAssignmentDeclarationKind(expression) === 1 /* AssignmentDeclarationKind.ExportsProperty */ ? cb(statement) @@ -165251,8 +166873,8 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return cb(ts.cast(name.parent, function (x) { return ts.isVariableDeclaration(x) || ts.isBindingElement(x); })); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return ts.firstDefined(name.elements, function (em) { return ts.isOmittedExpression(em) ? undefined : forEachTopLevelDeclarationInBindingName(em.name, cb); }); default: return ts.Debug.assertNever(name, "Unexpected name kind ".concat(name.kind)); @@ -165263,9 +166885,9 @@ var ts; } function getTopLevelDeclarationStatement(d) { switch (d.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return d.parent.parent; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getTopLevelDeclarationStatement(ts.cast(d.parent.parent, function (p) { return ts.isVariableDeclaration(p) || ts.isBindingElement(p); })); default: return d; @@ -165289,7 +166911,8 @@ var ts; if (useEs6Exports) { return !ts.isExpressionStatement(decl) && ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */) || !!(name && ((_a = sourceFile.symbol.exports) === null || _a === void 0 ? void 0 : _a.has(name.escapedText))); } - return getNamesToExportInCommonJS(decl).some(function (name) { return sourceFile.symbol.exports.has(ts.escapeLeadingUnderscores(name)); }); + return !!sourceFile.symbol && !!sourceFile.symbol.exports && + getNamesToExportInCommonJS(decl).some(function (name) { return sourceFile.symbol.exports.has(ts.escapeLeadingUnderscores(name)); }); } function addExport(decl, useEs6Exports) { return useEs6Exports ? [addEs6Export(decl)] : addCommonjsExport(decl); @@ -165297,24 +166920,24 @@ var ts; function addEs6Export(d) { var modifiers = ts.canHaveModifiers(d) ? ts.concatenate([ts.factory.createModifier(93 /* SyntaxKind.ExportKeyword */)], ts.getModifiers(d)) : undefined; switch (d.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return ts.factory.updateFunctionDeclaration(d, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var decorators = ts.canHaveDecorators(d) ? ts.getDecorators(d) : undefined; return ts.factory.updateClassDeclaration(d, ts.concatenate(decorators, modifiers), d.name, d.typeParameters, d.heritageClauses, d.members); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.factory.updateVariableStatement(d, modifiers, d.declarationList); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.factory.updateModuleDeclaration(d, modifiers, d.name, d.body); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.factory.updateEnumDeclaration(d, modifiers, d.name, d.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return ts.factory.updateTypeAliasDeclaration(d, modifiers, d.name, d.typeParameters, d.type); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.factory.updateInterfaceDeclaration(d, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.factory.updateImportEqualsDeclaration(d, modifiers, d.isTypeOnly, d.name, d.moduleReference); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(d, "Unexpected declaration kind ".concat(d.kind)); @@ -165325,18 +166948,18 @@ var ts; } function getNamesToExportInCommonJS(decl) { switch (decl.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return [decl.name.text]; // TODO: GH#18217 - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return ts.mapDefined(decl.declarationList.declarations, function (d) { return ts.isIdentifier(d.name) ? d.name.text : undefined; }); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.emptyArray; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.Debug.fail("Can't export an ExpressionStatement"); // Shouldn't try to add 'export' keyword to `exports.x = ...` default: return ts.Debug.assertNever(decl, "Unexpected decl kind ".concat(decl.kind)); @@ -165677,15 +167300,15 @@ var ts; var parent = functionReference.parent; switch (parent.kind) { // foo(...) or super(...) or new Foo(...) - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: var callOrNewExpression = ts.tryCast(parent, ts.isCallOrNewExpression); if (callOrNewExpression && callOrNewExpression.expression === functionReference) { return callOrNewExpression; } break; // x.foo(...) - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) { var callOrNewExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallOrNewExpression); @@ -165695,7 +167318,7 @@ var ts; } break; // x["foo"](...) - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) { var callOrNewExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallOrNewExpression); @@ -165714,14 +167337,14 @@ var ts; var parent = reference.parent; switch (parent.kind) { // `C.foo` - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression); if (propertyAccessExpression && propertyAccessExpression.expression === reference) { return propertyAccessExpression; } break; // `C["foo"]` - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression); if (elementAccessExpression && elementAccessExpression.expression === reference) { return elementAccessExpression; @@ -165767,16 +167390,16 @@ var ts; if (!isValidParameterNodeArray(functionDeclaration.parameters, checker)) return false; switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralExpression(functionDeclaration.parent)) { var contextualSymbol = getSymbolForContextualType(functionDeclaration.name, checker); // don't offer the refactor when there are multiple signatures since we won't know which ones the user wants to change return ((_a = contextualSymbol === null || contextualSymbol === void 0 ? void 0 : contextualSymbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 && isSingleImplementation(functionDeclaration, checker); } return isSingleImplementation(functionDeclaration, checker); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (ts.isClassDeclaration(functionDeclaration.parent)) { return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker); } @@ -165784,8 +167407,8 @@ var ts; return isValidVariableDeclaration(functionDeclaration.parent.parent) && isSingleImplementation(functionDeclaration, checker); } - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return isValidVariableDeclaration(functionDeclaration.parent); } return false; @@ -165933,7 +167556,7 @@ var ts; } function getClassNames(constructorDeclaration) { switch (constructorDeclaration.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = constructorDeclaration.parent; if (classDeclaration.name) return [classDeclaration.name]; @@ -165941,7 +167564,7 @@ var ts; // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(classDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless class declaration should be a default export"); return [defaultModifier]; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var classExpression = constructorDeclaration.parent; var variableDeclaration = constructorDeclaration.parent.parent; var className = classExpression.name; @@ -165952,25 +167575,25 @@ var ts; } function getFunctionNames(functionDeclaration) { switch (functionDeclaration.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (functionDeclaration.name) return [functionDeclaration.name]; // If the function declaration doesn't have a name, it should have a default modifier. // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault` var defaultModifier = ts.Debug.checkDefined(ts.findModifier(functionDeclaration, 88 /* SyntaxKind.DefaultKeyword */), "Nameless function declaration should be a default export"); return [defaultModifier]; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return [functionDeclaration.name]; - case 171 /* SyntaxKind.Constructor */: - var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 134 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); - if (functionDeclaration.parent.kind === 226 /* SyntaxKind.ClassExpression */) { + case 173 /* SyntaxKind.Constructor */: + var ctrKeyword = ts.Debug.checkDefined(ts.findChildOfKind(functionDeclaration, 135 /* SyntaxKind.ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword"); + if (functionDeclaration.parent.kind === 228 /* SyntaxKind.ClassExpression */) { var variableDeclaration = functionDeclaration.parent.parent; return [variableDeclaration.name, ctrKeyword]; } return [ctrKeyword]; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return [functionDeclaration.parent.name]; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (functionDeclaration.name) return [functionDeclaration.name, functionDeclaration.parent.name]; return [functionDeclaration.parent.name]; @@ -166061,11 +167684,11 @@ var ts; function getParentBinaryExpression(expr) { var container = ts.findAncestor(expr.parent, function (n) { switch (n.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return false; - case 223 /* SyntaxKind.TemplateExpression */: - case 221 /* SyntaxKind.BinaryExpression */: + case 225 /* SyntaxKind.TemplateExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return !(ts.isBinaryExpression(n.parent) && isNotEqualsOperator(n.parent)); default: return "quit"; @@ -166513,10 +168136,10 @@ var ts; } function isConvertibleDeclaration(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return true; default: return false; @@ -166561,7 +168184,7 @@ var ts; this.kind = kind; } NodeObject.prototype.assertHasRealPosition = function (message) { - // eslint-disable-next-line debug-assert + // eslint-disable-next-line local/debug-assert ts.Debug.assert(!ts.positionIsSynthesized(this.pos) && !ts.positionIsSynthesized(this.end), message || "Node must have a real position for this operation"); }; NodeObject.prototype.getSourceFile = function () { @@ -166618,8 +168241,8 @@ var ts; if (!children.length) { return undefined; } - var child = ts.find(children, function (kid) { return kid.kind < 309 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 347 /* SyntaxKind.LastJSDocNode */; }); - return child.kind < 161 /* SyntaxKind.FirstNode */ ? + var child = ts.find(children, function (kid) { return kid.kind < 312 /* SyntaxKind.FirstJSDocNode */ || kid.kind > 350 /* SyntaxKind.LastJSDocNode */; }); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getFirstToken(sourceFile); }; @@ -166630,7 +168253,7 @@ var ts; if (!child) { return undefined; } - return child.kind < 161 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); + return child.kind < 163 /* SyntaxKind.FirstNode */ ? child : child.getLastToken(sourceFile); }; NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) { return ts.forEachChild(this, cbNode, cbNodeArray); @@ -166690,7 +168313,7 @@ var ts; } } function createSyntaxList(nodes, parent) { - var list = createNode(348 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); + var list = createNode(351 /* SyntaxKind.SyntaxList */, nodes.pos, nodes.end, parent); list._children = []; var pos = nodes.pos; for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) { @@ -167039,7 +168662,7 @@ var ts; var _a; if (!seenSymbols_1.has(symbol)) { seenSymbols_1.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualJsDocTags(declaration, checker); } return ((_a = symbol.declarations) === null || _a === void 0 ? void 0 : _a.length) === 1 ? symbol.getJsDocTags() : undefined; @@ -167049,8 +168672,8 @@ var ts; tags = __spreadArray(__spreadArray([], inheritedTags, true), tags, true); } }; - for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { - var declaration = declarations_7[_i]; + for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { + var declaration = declarations_6[_i]; _loop_20(declaration); } } @@ -167066,7 +168689,7 @@ var ts; var inheritedDocs = findBaseOfDeclaration(checker, declaration, function (symbol) { if (!seenSymbols_2.has(symbol)) { seenSymbols_2.add(symbol); - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) { return symbol.getContextualDocumentationComment(declaration, checker); } return symbol.getDocumentationComment(checker); @@ -167076,8 +168699,8 @@ var ts; if (inheritedDocs) doc = doc.length === 0 ? inheritedDocs.slice() : inheritedDocs.concat(ts.lineBreakPart(), doc); }; - for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) { - var declaration = declarations_8[_i]; + for (var _i = 0, declarations_7 = declarations; _i < declarations_7.length; _i++) { + var declaration = declarations_7[_i]; _loop_21(declaration); } } @@ -167085,7 +168708,7 @@ var ts; } function findBaseOfDeclaration(checker, declaration, cb) { var _a; - var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; + var classOrInterfaceDeclaration = ((_a = declaration.parent) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ ? declaration.parent.parent : declaration.parent; if (!classOrInterfaceDeclaration) return; var isStaticMember = ts.hasStaticModifier(declaration); @@ -167100,7 +168723,7 @@ var ts; __extends(SourceFileObject, _super); function SourceFileObject(kind, pos, end) { var _this = _super.call(this, kind, pos, end) || this; - _this.kind = 305 /* SyntaxKind.SourceFile */; + _this.kind = 308 /* SyntaxKind.SourceFile */; return _this; } SourceFileObject.prototype.update = function (newText, textChangeRange) { @@ -167159,10 +168782,10 @@ var ts; } function visit(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var functionDeclaration = node; var declarationName = getDeclarationName(functionDeclaration); if (declarationName) { @@ -167182,31 +168805,31 @@ var ts; } ts.forEachChild(node, visit); break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 182 /* SyntaxKind.TypeLiteral */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 184 /* SyntaxKind.TypeLiteral */: addDeclaration(node); ts.forEachChild(node, visit); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Only consider parameter properties if (!ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { break; } // falls through - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: { var decl = node; if (ts.isBindingPattern(decl.name)) { ts.forEachChild(decl.name, visit); @@ -167217,12 +168840,12 @@ var ts; } } // falls through - case 299 /* SyntaxKind.EnumMember */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: addDeclaration(node); break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // Handle named exports case e.g.: // export {a, b as B} from "mod"; var exportDeclaration = node; @@ -167235,7 +168858,7 @@ var ts; } } break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: var importClause = node.importClause; if (importClause) { // Handle default import case e.g.: @@ -167247,7 +168870,7 @@ var ts; // import * as NS from "mod"; // import {a, b as B} from "mod"; if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { addDeclaration(importClause.namedBindings); } else { @@ -167256,7 +168879,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) !== 0 /* AssignmentDeclarationKind.None */) { addDeclaration(node); } @@ -167602,7 +169225,7 @@ var ts; var rootFileNames = host.getScriptFileNames().slice(); // Get a fresh cache of the host information var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; var hasChangedAutomaticTypeDirectiveNames = ts.maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames); var projectReferences = (_b = host.getProjectReferences) === null || _b === void 0 ? void 0 : _b.call(host); var parsedCommandLines; @@ -167633,7 +169256,7 @@ var ts; }, onReleaseOldSourceFile: onReleaseOldSourceFile, onReleaseParsedCommandLine: onReleaseParsedCommandLine, - hasInvalidatedResolution: hasInvalidatedResolution, + hasInvalidatedResolutions: hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames, trace: ts.maybeBind(host, host.trace), resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames), @@ -167668,8 +169291,12 @@ var ts; getCurrentDirectory: compilerHost.getCurrentDirectory, onUnRecoverableConfigFileDiagnostic: ts.noop, }; + // The call to isProgramUptoDate below may refer back to documentRegistryBucketKey; + // calculate this early so it's not undefined if downleveled to a var (or, if emitted + // as a const variable without downleveling, doesn't crash). + var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); // If the program is already up-to-date, we can reuse it - if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { return; } // IMPORTANT - It is critical from this moment onward that we do not check @@ -167677,7 +169304,6 @@ var ts; // instance. If we cancel midway through, we may end up in an inconsistent state where // the program points to old source files that have been invalidated because of // incremental parsing. - var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings); var options = { rootNames: rootFileNames, options: newSettings, @@ -167973,16 +169599,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return !ts.isLabelName(node) && !ts.isTagName(node) && !ts.isConstTypeReference(node.parent); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: // Don't return quickInfo if inside the comment in `a/**/.b` return !ts.isInComment(sourceFile, position); case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 106 /* SyntaxKind.SuperKeyword */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return true; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return ts.isImportMeta(node); default: return false; @@ -168089,15 +169715,15 @@ var ts; return undefined; } switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: case 10 /* SyntaxKind.StringLiteral */: case 95 /* SyntaxKind.FalseKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 106 /* SyntaxKind.SuperKeyword */: case 108 /* SyntaxKind.ThisKeyword */: - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 79 /* SyntaxKind.Identifier */: break; // Cant create the text span @@ -168114,7 +169740,7 @@ var ts; // If this is name of a module declarations, check if this is right side of dotted module name // If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of // Then this name is name from dotted module - if (nodeForStartPos.parent.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */ && + if (nodeForStartPos.parent.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */ && nodeForStartPos.parent.parent.body === nodeForStartPos.parent) { // Use parent module declarations name for start pos nodeForStartPos = nodeForStartPos.parent.parent.name; @@ -168244,12 +169870,14 @@ var ts; return ts.codefix.getAllFixes({ fixId: fixId, sourceFile: sourceFile, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences }); } function organizeImports(args, formatOptions, preferences) { + var _a; if (preferences === void 0) { preferences = ts.emptyOptions; } synchronizeHostData(); ts.Debug.assert(args.type === "file"); var sourceFile = getValidSourceFile(args.fileName); var formatContext = ts.formatting.getFormatContext(formatOptions, host); - return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences, args.skipDestructiveCodeActions); + var mode = (_a = args.mode) !== null && _a !== void 0 ? _a : (args.skipDestructiveCodeActions ? "SortAndCombine" /* OrganizeImportsMode.SortAndCombine */ : "All" /* OrganizeImportsMode.All */); + return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences, mode); } function getEditsForFileRename(oldFilePath, newFilePath, formatOptions, preferences) { if (preferences === void 0) { preferences = ts.emptyOptions; } @@ -168863,7 +170491,7 @@ var ts; */ function literalIsName(node) { return ts.isDeclarationName(node) || - node.parent.kind === 277 /* SyntaxKind.ExternalModuleReference */ || + node.parent.kind === 280 /* SyntaxKind.ExternalModuleReference */ || isArgumentOfElementAccessExpression(node) || ts.isLiteralComputedPropertyDeclarationName(node); } @@ -168881,13 +170509,13 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined; } // falls through case 79 /* SyntaxKind.Identifier */: return ts.isObjectLiteralElement(node.parent) && - (node.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 286 /* SyntaxKind.JsxAttributes */) && + (node.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.parent.parent.kind === 289 /* SyntaxKind.JsxAttributes */) && node.parent.name === node ? node.parent : undefined; } return undefined; @@ -168929,7 +170557,7 @@ var ts; function isArgumentOfElementAccessExpression(node) { return node && node.parent && - node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.argumentExpression === node; } /** @@ -169022,114 +170650,114 @@ var ts; if (node) { var parent = node.parent; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Span on first variable declaration return spanInVariableDeclaration(node.declarationList.declarations[0]); - case 254 /* SyntaxKind.VariableDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return spanInVariableDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return spanInParameterDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return spanInFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node)) { return spanInFunctionBlock(node); } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return spanInBlock(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInBlock(node.block); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: // span on the expression return textSpan(node.expression); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: // span on return keyword and expression if present return textSpan(node.getChildAt(0), node.expression); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: // Span on while(...) return textSpanEndingAtNextToken(node, node.expression); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // span in statement of the do statement return spanInNode(node.statement); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: // span on debugger keyword return textSpan(node.getChildAt(0)); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: // set on if(..) span return textSpanEndingAtNextToken(node, node.expression); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: // span in statement return spanInNode(node.statement); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: // On break or continue keyword and label if present return textSpan(node.getChildAt(0), node.label); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return spanInForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: // span of for (a in ...) return textSpanEndingAtNextToken(node, node.expression); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // span in initializer return spanInInitializerOfForLike(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: // span on switch(...) return textSpanEndingAtNextToken(node, node.expression); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: // span in first statement of the clause return spanInNode(node.statements[0]); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: // span in try block return spanInBlock(node.tryBlock); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: // span in throw ... return textSpan(node, node.expression); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: // span on export = id return textSpan(node, node.expression); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: // import statement without including semicolon return textSpan(node, node.moduleSpecifier); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // span on complete module if it is instantiated if (ts.getModuleInstanceState(node) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 203 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 205 /* SyntaxKind.BindingElement */: // span on complete node return textSpan(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: // span in statement return spanInNode(node.statement); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return spanInNodeArray(parent.modifiers, node, ts.isDecorator); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return spanInBindingPattern(node); // No breakpoint in interface, type alias - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return undefined; // Tokens: case 26 /* SyntaxKind.SemicolonToken */: @@ -169159,7 +170787,7 @@ var ts; case 83 /* SyntaxKind.CatchKeyword */: case 96 /* SyntaxKind.FinallyKeyword */: return spanInNextNode(node); - case 160 /* SyntaxKind.OfKeyword */: + case 162 /* SyntaxKind.OfKeyword */: return spanInOfKeyword(node); default: // Destructuring pattern in destructuring assignment @@ -169172,13 +170800,13 @@ var ts; // `a` or `...c` or `d: x` from // `[a, b, ...c]` or `{ a, b }` or `{ d: x }` from destructuring pattern if ((node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 225 /* SyntaxKind.SpreadElement */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) && + node.kind === 227 /* SyntaxKind.SpreadElement */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(parent)) { return textSpan(node); } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { var _a = node, left = _a.left, operatorToken = _a.operatorToken; // Set breakpoint in destructuring pattern if its destructuring assignment // [a, b, c] or {a, b, c} of @@ -169200,22 +170828,22 @@ var ts; } if (ts.isExpressionNode(node)) { switch (parent.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: // Set span as if on while keyword return spanInPreviousNode(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Set breakpoint on the decorator emit return spanInNode(node.parent); - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return textSpan(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { // If this is a comma expression, the breakpoint is possible in this expression return textSpan(node); } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (node.parent.body === node) { // If this is body of arrow function, it is allowed to have the breakpoint return textSpan(node); @@ -169224,21 +170852,21 @@ var ts; } } switch (node.parent.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // If this is name of property assignment, set breakpoint in the initializer if (node.parent.name === node && !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) { return spanInNode(node.parent.initializer); } break; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: // Breakpoint in type assertion goes to its operand if (node.parent.type === node) { return spanInNextNode(node.parent.type); } break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: { + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: { // initializer of variable/parameter declaration go to previous node var _b = node.parent, initializer = _b.initializer, type = _b.type; if (initializer === node || type === node || ts.isAssignmentOperator(node.kind)) { @@ -169246,7 +170874,7 @@ var ts; } break; } - case 221 /* SyntaxKind.BinaryExpression */: { + case 223 /* SyntaxKind.BinaryExpression */: { var left = node.parent.left; if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) { // If initializer of destructuring assignment move to previous token @@ -169276,7 +170904,7 @@ var ts; } function spanInVariableDeclaration(variableDeclaration) { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (variableDeclaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return spanInNode(variableDeclaration.parent.parent); } var parent = variableDeclaration.parent; @@ -169288,7 +170916,7 @@ var ts; // or its declaration from 'for of' if ((ts.hasOnlyExpressionInitializer(variableDeclaration) && variableDeclaration.initializer) || ts.hasSyntacticModifier(variableDeclaration, 1 /* ModifierFlags.Export */) || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return textSpanFromVariableDeclaration(variableDeclaration); } if (ts.isVariableDeclarationList(variableDeclaration.parent) && @@ -169329,7 +170957,7 @@ var ts; } function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) { return ts.hasSyntacticModifier(functionDeclaration, 1 /* ModifierFlags.Export */) || - (functionDeclaration.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 171 /* SyntaxKind.Constructor */); + (functionDeclaration.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && functionDeclaration.kind !== 173 /* SyntaxKind.Constructor */); } function spanInFunctionDeclaration(functionDeclaration) { // No breakpoints in the function signature @@ -169352,26 +170980,26 @@ var ts; } function spanInBlock(block) { switch (block.parent.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: if (ts.getModuleInstanceState(block.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // Set on parent if on same line otherwise on first statement // falls through - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 246 /* SyntaxKind.ForInStatement */: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]); } // Default action is to set on first statement return spanInNode(block.statements[0]); } function spanInInitializerOfForLike(forLikeStatement) { - if (forLikeStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forLikeStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { // Declaration list - set breakpoint in first declaration var variableDeclarationList = forLikeStatement.initializer; if (variableDeclarationList.declarations.length > 0) { @@ -169396,21 +171024,21 @@ var ts; } function spanInBindingPattern(bindingPattern) { // Set breakpoint in first binding element - var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } // Empty binding pattern of binding element, set breakpoint on binding element - if (bindingPattern.parent.kind === 203 /* SyntaxKind.BindingElement */) { + if (bindingPattern.parent.kind === 205 /* SyntaxKind.BindingElement */) { return textSpan(bindingPattern.parent); } // Variable declaration is used as the span return textSpanFromVariableDeclaration(bindingPattern.parent); } function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) { - ts.Debug.assert(node.kind !== 202 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 201 /* SyntaxKind.ObjectBindingPattern */); - var elements = node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; - var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 227 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); + ts.Debug.assert(node.kind !== 204 /* SyntaxKind.ArrayBindingPattern */ && node.kind !== 203 /* SyntaxKind.ObjectBindingPattern */); + var elements = node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ ? node.elements : node.properties; + var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 229 /* SyntaxKind.OmittedExpression */ ? element : undefined; }); if (firstBindingElement) { return spanInNode(firstBindingElement); } @@ -169418,18 +171046,18 @@ var ts; // just nested element in another destructuring assignment // set breakpoint on assignment when parent is destructuring assignment // Otherwise set breakpoint for this element - return textSpan(node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ ? node.parent : node); + return textSpan(node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ ? node.parent : node); } // Tokens: function spanInOpenBraceToken(node) { switch (node.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile)); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var classDeclaration = node.parent; return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]); } // Default to parent node @@ -169437,25 +171065,25 @@ var ts; } function spanInCloseBraceToken(node) { switch (node.parent.kind) { - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: // If this is not an instantiated module block, no bp span if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* ModuleInstanceState.Instantiated */) { return undefined; } // falls through - case 260 /* SyntaxKind.EnumDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // Span on close brace token return textSpan(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (ts.isFunctionBlock(node.parent)) { // Span on close brace token return textSpan(node); } // falls through - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return spanInNode(ts.lastOrUndefined(node.parent.statements)); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: // breakpoint in last statement of the last clause var caseBlock = node.parent; var lastClause = ts.lastOrUndefined(caseBlock.clauses); @@ -169463,7 +171091,7 @@ var ts; return spanInNode(ts.lastOrUndefined(lastClause.statements)); } return undefined; - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -169479,7 +171107,7 @@ var ts; } function spanInCloseBracketToken(node) { switch (node.parent.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: // Breakpoint in last binding element or binding pattern if it contains no elements var bindingPattern = node.parent; return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern); @@ -169494,12 +171122,12 @@ var ts; } } function spanInOpenParenToken(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead - node.parent.kind === 208 /* SyntaxKind.CallExpression */ || - node.parent.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */ || // Go to while keyword and do action instead + node.parent.kind === 210 /* SyntaxKind.CallExpression */ || + node.parent.kind === 211 /* SyntaxKind.NewExpression */) { return spanInPreviousNode(node); } - if (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return spanInNextNode(node); } // Default to parent node @@ -169508,21 +171136,21 @@ var ts; function spanInCloseParenToken(node) { // Is this close paren token of parameter list, set span in previous token switch (node.parent.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return spanInPreviousNode(node); // Default to parent node default: @@ -169532,20 +171160,20 @@ var ts; function spanInColonToken(node) { // Is this : specifying return annotation of the function declaration if (ts.isFunctionLike(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - node.parent.kind === 164 /* SyntaxKind.Parameter */) { + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + node.parent.kind === 166 /* SyntaxKind.Parameter */) { return spanInPreviousNode(node); } return spanInNode(node.parent); } function spanInGreaterThanOrLessThanToken(node) { - if (node.parent.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.parent.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { return spanInNextNode(node); } return spanInNode(node.parent); } function spanInWhileKeyword(node) { - if (node.parent.kind === 240 /* SyntaxKind.DoStatement */) { + if (node.parent.kind === 243 /* SyntaxKind.DoStatement */) { // Set span on while expression return textSpanEndingAtNextToken(node, node.parent.expression); } @@ -169553,7 +171181,7 @@ var ts; return spanInNode(node.parent); } function spanInOfKeyword(node) { - if (node.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // Set using next token return spanInNextNode(node); } @@ -169602,7 +171230,7 @@ var debugObjectHost = (function () { return this; })(); // We need to use 'null' to interface with the managed side. -/* eslint-disable no-in-operator */ +/* eslint-disable local/no-in-operator */ /* @internal */ var ts; (function (ts) { @@ -170402,7 +172030,7 @@ var ts; }()); ts.TypeScriptServicesFactory = TypeScriptServicesFactory; })(ts || (ts = {})); -/* eslint-enable no-in-operator */ +/* eslint-enable local/no-in-operator */ // We polyfill `globalThis` here so re can reliably patch the global scope // in the contexts we want to in the same way across script and module formats /* eslint-enable no-var */ @@ -171172,7 +172800,7 @@ var ts; if (typeof value === "number") { return ts.factory.createNumericLiteral(value); } - // eslint-disable-next-line no-in-operator + // eslint-disable-next-line local/no-in-operator if (typeof value === "object" && "base10Value" in value) { // PseudoBigInt return ts.factory.createBigIntLiteral(value); } @@ -171200,7 +172828,7 @@ var ts; } else { type = operatorOrType; - operator = 140 /* SyntaxKind.KeyOfKeyword */; + operator = 141 /* SyntaxKind.KeyOfKeyword */; } return ts.factory.createTypeOperatorNode(operator, type); }, factoryDeprecation); @@ -171378,7 +173006,7 @@ var ts; ts.createNode = ts.Debug.deprecate(function createNode(kind, pos, end) { if (pos === void 0) { pos = 0; } if (end === void 0) { end = 0; } - return ts.setTextRangePosEnd(kind === 305 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : + return ts.setTextRangePosEnd(kind === 308 /* SyntaxKind.SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : kind === 79 /* SyntaxKind.Identifier */ ? ts.parseBaseNodeFactory.createBaseIdentifierNode(kind) : kind === 80 /* SyntaxKind.PrivateIdentifier */ ? ts.parseBaseNodeFactory.createBasePrivateIdentifierNode(kind) : !ts.isNodeKind(kind) ? ts.parseBaseNodeFactory.createBaseTokenNode(kind) : @@ -171408,7 +173036,7 @@ var ts; (function (ts) { /** @deprecated Use `isTypeAssertionExpression` instead. */ ts.isTypeAssertion = ts.Debug.deprecate(function isTypeAssertion(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; }, { since: "4.0", warnAfter: "4.1", diff --git a/node_modules/typescript/lib/typingsInstaller.js b/node_modules/typescript/lib/typingsInstaller.js index c7a265d6c..df6dbf82c 100644 --- a/node_modules/typescript/lib/typingsInstaller.js +++ b/node_modules/typescript/lib/typingsInstaller.js @@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); - while (_) try { + while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { @@ -85,11 +85,11 @@ var ts; (function (ts) { // WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configurePrerelease` too. - ts.versionMajorMinor = "4.8"; + ts.versionMajorMinor = "4.9"; // The following is baselined as a literal template type without intervention /** The version of the TypeScript compiler release */ // eslint-disable-next-line @typescript-eslint/no-inferrable-types - ts.version = "4.8.4"; + ts.version = "".concat(ts.versionMajorMinor, ".3"); /* @internal */ var Comparison; (function (Comparison) { @@ -110,8 +110,12 @@ var ts; function tryGetNativeMap() { // Internet Explorer's Map doesn't support iteration, so don't use it. var gMap = globals === null || globals === void 0 ? void 0 : globals.Map; - // eslint-disable-next-line no-in-operator - return typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gMap !== "undefined" && "entries" in gMap.prototype && new gMap([[0, 0]]).size === 1 ? gMap : undefined; + if (!constructor) { + throw new Error("No compatible Map implementation found."); + } + return constructor; } NativeCollections.tryGetNativeMap = tryGetNativeMap; /** @@ -120,24 +124,19 @@ var ts; function tryGetNativeSet() { // Internet Explorer's Set doesn't support iteration, so don't use it. var gSet = globals === null || globals === void 0 ? void 0 : globals.Set; - // eslint-disable-next-line no-in-operator - return typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + // eslint-disable-next-line local/no-in-operator + var constructor = typeof gSet !== "undefined" && "entries" in gSet.prototype && new gSet([0]).size === 1 ? gSet : undefined; + if (!constructor) { + throw new Error("No compatible Set implementation found."); + } + return constructor; } NativeCollections.tryGetNativeSet = tryGetNativeSet; })(NativeCollections || (NativeCollections = {})); /* @internal */ - ts.Map = getCollectionImplementation("Map", "tryGetNativeMap", "createMapShim"); - /* @internal */ - ts.Set = getCollectionImplementation("Set", "tryGetNativeSet", "createSetShim"); + ts.Map = NativeCollections.tryGetNativeMap(); /* @internal */ - function getCollectionImplementation(name, nativeFactory, shimFactory) { - var _a; - // NOTE: ts.ShimCollections will be defined for typescriptServices.js but not for tsc.js, so we must test for it. - var constructor = (_a = NativeCollections[nativeFactory]()) !== null && _a !== void 0 ? _a : ts.ShimCollections === null || ts.ShimCollections === void 0 ? void 0 : ts.ShimCollections[shimFactory](ts.getIterator); - if (constructor) - return constructor; - throw new Error("TypeScript requires an environment that provides a compatible native ".concat(name, " implementation.")); - } + ts.Set = NativeCollections.tryGetNativeSet(); })(ts || (ts = {})); /* @internal */ var ts; @@ -853,15 +852,18 @@ var ts; function insertSorted(array, insert, compare, allowDuplicates) { if (array.length === 0) { array.push(insert); - return; + return true; } var insertIndex = binarySearch(array, insert, identity, compare); if (insertIndex < 0) { array.splice(~insertIndex, 0, insert); + return true; } - else if (allowDuplicates) { + if (allowDuplicates) { array.splice(insertIndex, 0, insert); + return true; } + return false; } ts.insertSorted = insertSorted; function sortAndDeduplicate(array, comparer, equalityComparer) { @@ -1141,6 +1143,13 @@ var ts; : undefined; } ts.singleOrUndefined = singleOrUndefined; + /** + * Returns the only element of an array if it contains only one element; throws otherwise. + */ + function single(array) { + return ts.Debug.checkDefined(singleOrUndefined(array)); + } + ts.single = single; function singleOrMany(array) { return array && array.length === 1 ? array[0] @@ -1872,8 +1881,8 @@ var ts; return compareValues(a === null || a === void 0 ? void 0 : a.start, b === null || b === void 0 ? void 0 : b.start) || compareValues(a === null || a === void 0 ? void 0 : a.length, b === null || b === void 0 ? void 0 : b.length); } ts.compareTextSpans = compareTextSpans; - function min(a, b, compare) { - return compare(a, b) === -1 /* Comparison.LessThan */ ? a : b; + function min(items, compare) { + return reduceLeft(items, function (x, y) { return compare(x, y) === -1 /* Comparison.LessThan */ ? x : y; }); } ts.min = min; /** @@ -2664,7 +2673,7 @@ var ts; if (typeof func !== "function") { return ""; } - else if (func.hasOwnProperty("name")) { + else if (ts.hasProperty(func, "name")) { return func.name; } else { @@ -2814,7 +2823,7 @@ var ts; Debug.formatControlFlowGraph = formatControlFlowGraph; var flowNodeProto; function attachFlowNodeDebugInfoWorker(flowNode) { - if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line no-in-operator + if (!("__debugFlowFlags" in flowNode)) { // eslint-disable-line local/no-in-operator Object.defineProperties(flowNode, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -2860,7 +2869,7 @@ var ts; Debug.attachFlowNodeDebugInfo = attachFlowNodeDebugInfo; var nodeArrayProto; function attachNodeArrayDebugInfoWorker(array) { - if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line no-in-operator + if (!("__tsDebuggerDisplay" in array)) { // eslint-disable-line local/no-in-operator Object.defineProperties(array, { __tsDebuggerDisplay: { value: function (defaultValue) { @@ -2989,7 +2998,7 @@ var ts; ]; for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) { var ctor = nodeConstructors_1[_i]; - if (!ctor.prototype.hasOwnProperty("__debugKind")) { + if (!ts.hasProperty(ctor.prototype, "__debugKind")) { Object.defineProperties(ctor.prototype, { // for use with vscode-js-debug's new customDescriptionGenerator in launch.json __tsDebuggerDisplay: { @@ -3186,11 +3195,13 @@ var ts; // > alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric identifiers // > MUST NOT include leading zeroes. var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-][a-z0-9-]*))*$/i; + var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i; // https://semver.org/#spec-item-10 // > Build metadata MAY be denoted by appending a plus sign and a series of dot separated // > identifiers immediately following the patch or pre-release version. Identifiers MUST // > comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i; + var buildPartRegExp = /^[a-z0-9-]+$/i; // https://semver.org/#spec-item-9 // > Numeric identifiers MUST NOT include leading zeroes. var numericIdentifierRegExp = /^(0|[1-9]\d*)$/; @@ -3210,13 +3221,15 @@ var ts; ts.Debug.assert(major >= 0, "Invalid argument: major"); ts.Debug.assert(minor >= 0, "Invalid argument: minor"); ts.Debug.assert(patch >= 0, "Invalid argument: patch"); - ts.Debug.assert(!prerelease || prereleaseRegExp.test(prerelease), "Invalid argument: prerelease"); - ts.Debug.assert(!build || buildRegExp.test(build), "Invalid argument: build"); + var prereleaseArray = prerelease ? ts.isArray(prerelease) ? prerelease : prerelease.split(".") : ts.emptyArray; + var buildArray = build ? ts.isArray(build) ? build : build.split(".") : ts.emptyArray; + ts.Debug.assert(ts.every(prereleaseArray, function (s) { return prereleasePartRegExp.test(s); }), "Invalid argument: prerelease"); + ts.Debug.assert(ts.every(buildArray, function (s) { return buildPartRegExp.test(s); }), "Invalid argument: build"); this.major = major; this.minor = minor; this.patch = patch; - this.prerelease = prerelease ? prerelease.split(".") : ts.emptyArray; - this.build = build ? build.split(".") : ts.emptyArray; + this.prerelease = prereleaseArray; + this.build = buildArray; } Version.tryParse = function (text) { var result = tryParseComponents(text); @@ -3255,6 +3268,10 @@ var ts; default: return ts.Debug.assertNever(field); } }; + Version.prototype.with = function (fields) { + var _a = fields.major, major = _a === void 0 ? this.major : _a, _b = fields.minor, minor = _b === void 0 ? this.minor : _b, _c = fields.patch, patch = _c === void 0 ? this.patch : _c, _d = fields.prerelease, prerelease = _d === void 0 ? this.prerelease : _d, _e = fields.build, build = _e === void 0 ? this.build : _e; + return new Version(major, minor, patch, prerelease, build); + }; Version.prototype.toString = function () { var result = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch); if (ts.some(this.prerelease)) @@ -3263,7 +3280,7 @@ var ts; result += "+".concat(this.build.join(".")); return result; }; - Version.zero = new Version(0, 0, 0); + Version.zero = new Version(0, 0, 0, ["0"]); return Version; }()); ts.Version = Version; @@ -3346,6 +3363,10 @@ var ts; } return undefined; }; + /** + * Tests whether a version matches the range. This is equivalent to `satisfies(version, range, { includePrerelease: true })`. + * in `node-semver`. + */ VersionRange.prototype.test = function (version) { if (typeof version === "string") version = new Version(version); @@ -3456,19 +3477,20 @@ var ts; break; case "<": case ">=": - comparators.push(createComparator(operator, version)); + comparators.push(isWildcard(minor) || isWildcard(patch) ? createComparator(operator, version.with({ prerelease: "0" })) : + createComparator(operator, version)); break; case "<=": case ">": - comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major")) : - isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor")) : + comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major").with({ prerelease: "0" })) : + isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor").with({ prerelease: "0" })) : createComparator(operator, version)); break; case "=": case undefined: if (isWildcard(minor) || isWildcard(patch)) { - comparators.push(createComparator(">=", version)); - comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor"))); + comparators.push(createComparator(">=", version.with({ prerelease: "0" }))); + comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor").with({ prerelease: "0" }))); } else { comparators.push(createComparator("=", version)); @@ -3542,6 +3564,8 @@ var ts; typeof performance.mark === "function" && typeof performance.measure === "function" && typeof performance.now === "function" && + typeof performance.clearMarks === "function" && + typeof performance.clearMeasures === "function" && typeof PerformanceObserver === "function"; } function tryGetWebPerformanceHooks() { @@ -3586,7 +3610,9 @@ var ts; if (end === "__performance.measure-fix__") { nodePerformance_1.clearMarks("__performance.measure-fix__"); } - } + }, + clearMarks: function (name) { return nodePerformance_1.clearMarks(name); }, + clearMeasures: function (name) { return nodePerformance_1.clearMeasures(name); }, }; } return { @@ -3719,6 +3745,30 @@ var ts; durations.forEach(function (duration, measureName) { return cb(measureName, duration); }); } performance.forEachMeasure = forEachMeasure; + function forEachMark(cb) { + marks.forEach(function (_time, markName) { return cb(markName); }); + } + performance.forEachMark = forEachMark; + function clearMeasures(name) { + if (name !== undefined) + durations.delete(name); + else + durations.clear(); + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMeasures(name); + } + performance.clearMeasures = clearMeasures; + function clearMarks(name) { + if (name !== undefined) { + counts.delete(name); + marks.delete(name); + } + else { + counts.clear(); + marks.clear(); + } + performanceImpl === null || performanceImpl === void 0 ? void 0 : performanceImpl.clearMarks(name); + } + performance.clearMarks = clearMarks; /** * Indicates whether the performance API is enabled. */ @@ -3816,7 +3866,6 @@ var ts; var typeCatalog = []; // NB: id is index + 1 var legendPath; var legend = []; - ; /** Starts tracing for the given project. */ function startTracing(tracingMode, traceDir, configFilePath) { ts.Debug.assert(!ts.tracing, "Tracing already started"); @@ -4021,7 +4070,7 @@ var ts; var substitutionType = type; substitutionProperties = { substitutionBaseType: (_o = substitutionType.baseType) === null || _o === void 0 ? void 0 : _o.id, - substituteType: (_p = substitutionType.substitute) === null || _p === void 0 ? void 0 : _p.id, + constraintType: (_p = substitutionType.constraint) === null || _p === void 0 ? void 0 : _p.id, }; } var reverseMappedProperties = {}; @@ -4221,257 +4270,260 @@ var ts; SyntaxKind[SyntaxKind["YieldKeyword"] = 125] = "YieldKeyword"; // Contextual keywords SyntaxKind[SyntaxKind["AbstractKeyword"] = 126] = "AbstractKeyword"; - SyntaxKind[SyntaxKind["AsKeyword"] = 127] = "AsKeyword"; - SyntaxKind[SyntaxKind["AssertsKeyword"] = 128] = "AssertsKeyword"; - SyntaxKind[SyntaxKind["AssertKeyword"] = 129] = "AssertKeyword"; - SyntaxKind[SyntaxKind["AnyKeyword"] = 130] = "AnyKeyword"; - SyntaxKind[SyntaxKind["AsyncKeyword"] = 131] = "AsyncKeyword"; - SyntaxKind[SyntaxKind["AwaitKeyword"] = 132] = "AwaitKeyword"; - SyntaxKind[SyntaxKind["BooleanKeyword"] = 133] = "BooleanKeyword"; - SyntaxKind[SyntaxKind["ConstructorKeyword"] = 134] = "ConstructorKeyword"; - SyntaxKind[SyntaxKind["DeclareKeyword"] = 135] = "DeclareKeyword"; - SyntaxKind[SyntaxKind["GetKeyword"] = 136] = "GetKeyword"; - SyntaxKind[SyntaxKind["InferKeyword"] = 137] = "InferKeyword"; - SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 138] = "IntrinsicKeyword"; - SyntaxKind[SyntaxKind["IsKeyword"] = 139] = "IsKeyword"; - SyntaxKind[SyntaxKind["KeyOfKeyword"] = 140] = "KeyOfKeyword"; - SyntaxKind[SyntaxKind["ModuleKeyword"] = 141] = "ModuleKeyword"; - SyntaxKind[SyntaxKind["NamespaceKeyword"] = 142] = "NamespaceKeyword"; - SyntaxKind[SyntaxKind["NeverKeyword"] = 143] = "NeverKeyword"; - SyntaxKind[SyntaxKind["OutKeyword"] = 144] = "OutKeyword"; - SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 145] = "ReadonlyKeyword"; - SyntaxKind[SyntaxKind["RequireKeyword"] = 146] = "RequireKeyword"; - SyntaxKind[SyntaxKind["NumberKeyword"] = 147] = "NumberKeyword"; - SyntaxKind[SyntaxKind["ObjectKeyword"] = 148] = "ObjectKeyword"; - SyntaxKind[SyntaxKind["SetKeyword"] = 149] = "SetKeyword"; - SyntaxKind[SyntaxKind["StringKeyword"] = 150] = "StringKeyword"; - SyntaxKind[SyntaxKind["SymbolKeyword"] = 151] = "SymbolKeyword"; - SyntaxKind[SyntaxKind["TypeKeyword"] = 152] = "TypeKeyword"; - SyntaxKind[SyntaxKind["UndefinedKeyword"] = 153] = "UndefinedKeyword"; - SyntaxKind[SyntaxKind["UniqueKeyword"] = 154] = "UniqueKeyword"; - SyntaxKind[SyntaxKind["UnknownKeyword"] = 155] = "UnknownKeyword"; - SyntaxKind[SyntaxKind["FromKeyword"] = 156] = "FromKeyword"; - SyntaxKind[SyntaxKind["GlobalKeyword"] = 157] = "GlobalKeyword"; - SyntaxKind[SyntaxKind["BigIntKeyword"] = 158] = "BigIntKeyword"; - SyntaxKind[SyntaxKind["OverrideKeyword"] = 159] = "OverrideKeyword"; - SyntaxKind[SyntaxKind["OfKeyword"] = 160] = "OfKeyword"; + SyntaxKind[SyntaxKind["AccessorKeyword"] = 127] = "AccessorKeyword"; + SyntaxKind[SyntaxKind["AsKeyword"] = 128] = "AsKeyword"; + SyntaxKind[SyntaxKind["AssertsKeyword"] = 129] = "AssertsKeyword"; + SyntaxKind[SyntaxKind["AssertKeyword"] = 130] = "AssertKeyword"; + SyntaxKind[SyntaxKind["AnyKeyword"] = 131] = "AnyKeyword"; + SyntaxKind[SyntaxKind["AsyncKeyword"] = 132] = "AsyncKeyword"; + SyntaxKind[SyntaxKind["AwaitKeyword"] = 133] = "AwaitKeyword"; + SyntaxKind[SyntaxKind["BooleanKeyword"] = 134] = "BooleanKeyword"; + SyntaxKind[SyntaxKind["ConstructorKeyword"] = 135] = "ConstructorKeyword"; + SyntaxKind[SyntaxKind["DeclareKeyword"] = 136] = "DeclareKeyword"; + SyntaxKind[SyntaxKind["GetKeyword"] = 137] = "GetKeyword"; + SyntaxKind[SyntaxKind["InferKeyword"] = 138] = "InferKeyword"; + SyntaxKind[SyntaxKind["IntrinsicKeyword"] = 139] = "IntrinsicKeyword"; + SyntaxKind[SyntaxKind["IsKeyword"] = 140] = "IsKeyword"; + SyntaxKind[SyntaxKind["KeyOfKeyword"] = 141] = "KeyOfKeyword"; + SyntaxKind[SyntaxKind["ModuleKeyword"] = 142] = "ModuleKeyword"; + SyntaxKind[SyntaxKind["NamespaceKeyword"] = 143] = "NamespaceKeyword"; + SyntaxKind[SyntaxKind["NeverKeyword"] = 144] = "NeverKeyword"; + SyntaxKind[SyntaxKind["OutKeyword"] = 145] = "OutKeyword"; + SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 146] = "ReadonlyKeyword"; + SyntaxKind[SyntaxKind["RequireKeyword"] = 147] = "RequireKeyword"; + SyntaxKind[SyntaxKind["NumberKeyword"] = 148] = "NumberKeyword"; + SyntaxKind[SyntaxKind["ObjectKeyword"] = 149] = "ObjectKeyword"; + SyntaxKind[SyntaxKind["SatisfiesKeyword"] = 150] = "SatisfiesKeyword"; + SyntaxKind[SyntaxKind["SetKeyword"] = 151] = "SetKeyword"; + SyntaxKind[SyntaxKind["StringKeyword"] = 152] = "StringKeyword"; + SyntaxKind[SyntaxKind["SymbolKeyword"] = 153] = "SymbolKeyword"; + SyntaxKind[SyntaxKind["TypeKeyword"] = 154] = "TypeKeyword"; + SyntaxKind[SyntaxKind["UndefinedKeyword"] = 155] = "UndefinedKeyword"; + SyntaxKind[SyntaxKind["UniqueKeyword"] = 156] = "UniqueKeyword"; + SyntaxKind[SyntaxKind["UnknownKeyword"] = 157] = "UnknownKeyword"; + SyntaxKind[SyntaxKind["FromKeyword"] = 158] = "FromKeyword"; + SyntaxKind[SyntaxKind["GlobalKeyword"] = 159] = "GlobalKeyword"; + SyntaxKind[SyntaxKind["BigIntKeyword"] = 160] = "BigIntKeyword"; + SyntaxKind[SyntaxKind["OverrideKeyword"] = 161] = "OverrideKeyword"; + SyntaxKind[SyntaxKind["OfKeyword"] = 162] = "OfKeyword"; // Parse tree nodes // Names - SyntaxKind[SyntaxKind["QualifiedName"] = 161] = "QualifiedName"; - SyntaxKind[SyntaxKind["ComputedPropertyName"] = 162] = "ComputedPropertyName"; + SyntaxKind[SyntaxKind["QualifiedName"] = 163] = "QualifiedName"; + SyntaxKind[SyntaxKind["ComputedPropertyName"] = 164] = "ComputedPropertyName"; // Signature elements - SyntaxKind[SyntaxKind["TypeParameter"] = 163] = "TypeParameter"; - SyntaxKind[SyntaxKind["Parameter"] = 164] = "Parameter"; - SyntaxKind[SyntaxKind["Decorator"] = 165] = "Decorator"; + SyntaxKind[SyntaxKind["TypeParameter"] = 165] = "TypeParameter"; + SyntaxKind[SyntaxKind["Parameter"] = 166] = "Parameter"; + SyntaxKind[SyntaxKind["Decorator"] = 167] = "Decorator"; // TypeMember - SyntaxKind[SyntaxKind["PropertySignature"] = 166] = "PropertySignature"; - SyntaxKind[SyntaxKind["PropertyDeclaration"] = 167] = "PropertyDeclaration"; - SyntaxKind[SyntaxKind["MethodSignature"] = 168] = "MethodSignature"; - SyntaxKind[SyntaxKind["MethodDeclaration"] = 169] = "MethodDeclaration"; - SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 170] = "ClassStaticBlockDeclaration"; - SyntaxKind[SyntaxKind["Constructor"] = 171] = "Constructor"; - SyntaxKind[SyntaxKind["GetAccessor"] = 172] = "GetAccessor"; - SyntaxKind[SyntaxKind["SetAccessor"] = 173] = "SetAccessor"; - SyntaxKind[SyntaxKind["CallSignature"] = 174] = "CallSignature"; - SyntaxKind[SyntaxKind["ConstructSignature"] = 175] = "ConstructSignature"; - SyntaxKind[SyntaxKind["IndexSignature"] = 176] = "IndexSignature"; + SyntaxKind[SyntaxKind["PropertySignature"] = 168] = "PropertySignature"; + SyntaxKind[SyntaxKind["PropertyDeclaration"] = 169] = "PropertyDeclaration"; + SyntaxKind[SyntaxKind["MethodSignature"] = 170] = "MethodSignature"; + SyntaxKind[SyntaxKind["MethodDeclaration"] = 171] = "MethodDeclaration"; + SyntaxKind[SyntaxKind["ClassStaticBlockDeclaration"] = 172] = "ClassStaticBlockDeclaration"; + SyntaxKind[SyntaxKind["Constructor"] = 173] = "Constructor"; + SyntaxKind[SyntaxKind["GetAccessor"] = 174] = "GetAccessor"; + SyntaxKind[SyntaxKind["SetAccessor"] = 175] = "SetAccessor"; + SyntaxKind[SyntaxKind["CallSignature"] = 176] = "CallSignature"; + SyntaxKind[SyntaxKind["ConstructSignature"] = 177] = "ConstructSignature"; + SyntaxKind[SyntaxKind["IndexSignature"] = 178] = "IndexSignature"; // Type - SyntaxKind[SyntaxKind["TypePredicate"] = 177] = "TypePredicate"; - SyntaxKind[SyntaxKind["TypeReference"] = 178] = "TypeReference"; - SyntaxKind[SyntaxKind["FunctionType"] = 179] = "FunctionType"; - SyntaxKind[SyntaxKind["ConstructorType"] = 180] = "ConstructorType"; - SyntaxKind[SyntaxKind["TypeQuery"] = 181] = "TypeQuery"; - SyntaxKind[SyntaxKind["TypeLiteral"] = 182] = "TypeLiteral"; - SyntaxKind[SyntaxKind["ArrayType"] = 183] = "ArrayType"; - SyntaxKind[SyntaxKind["TupleType"] = 184] = "TupleType"; - SyntaxKind[SyntaxKind["OptionalType"] = 185] = "OptionalType"; - SyntaxKind[SyntaxKind["RestType"] = 186] = "RestType"; - SyntaxKind[SyntaxKind["UnionType"] = 187] = "UnionType"; - SyntaxKind[SyntaxKind["IntersectionType"] = 188] = "IntersectionType"; - SyntaxKind[SyntaxKind["ConditionalType"] = 189] = "ConditionalType"; - SyntaxKind[SyntaxKind["InferType"] = 190] = "InferType"; - SyntaxKind[SyntaxKind["ParenthesizedType"] = 191] = "ParenthesizedType"; - SyntaxKind[SyntaxKind["ThisType"] = 192] = "ThisType"; - SyntaxKind[SyntaxKind["TypeOperator"] = 193] = "TypeOperator"; - SyntaxKind[SyntaxKind["IndexedAccessType"] = 194] = "IndexedAccessType"; - SyntaxKind[SyntaxKind["MappedType"] = 195] = "MappedType"; - SyntaxKind[SyntaxKind["LiteralType"] = 196] = "LiteralType"; - SyntaxKind[SyntaxKind["NamedTupleMember"] = 197] = "NamedTupleMember"; - SyntaxKind[SyntaxKind["TemplateLiteralType"] = 198] = "TemplateLiteralType"; - SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 199] = "TemplateLiteralTypeSpan"; - SyntaxKind[SyntaxKind["ImportType"] = 200] = "ImportType"; + SyntaxKind[SyntaxKind["TypePredicate"] = 179] = "TypePredicate"; + SyntaxKind[SyntaxKind["TypeReference"] = 180] = "TypeReference"; + SyntaxKind[SyntaxKind["FunctionType"] = 181] = "FunctionType"; + SyntaxKind[SyntaxKind["ConstructorType"] = 182] = "ConstructorType"; + SyntaxKind[SyntaxKind["TypeQuery"] = 183] = "TypeQuery"; + SyntaxKind[SyntaxKind["TypeLiteral"] = 184] = "TypeLiteral"; + SyntaxKind[SyntaxKind["ArrayType"] = 185] = "ArrayType"; + SyntaxKind[SyntaxKind["TupleType"] = 186] = "TupleType"; + SyntaxKind[SyntaxKind["OptionalType"] = 187] = "OptionalType"; + SyntaxKind[SyntaxKind["RestType"] = 188] = "RestType"; + SyntaxKind[SyntaxKind["UnionType"] = 189] = "UnionType"; + SyntaxKind[SyntaxKind["IntersectionType"] = 190] = "IntersectionType"; + SyntaxKind[SyntaxKind["ConditionalType"] = 191] = "ConditionalType"; + SyntaxKind[SyntaxKind["InferType"] = 192] = "InferType"; + SyntaxKind[SyntaxKind["ParenthesizedType"] = 193] = "ParenthesizedType"; + SyntaxKind[SyntaxKind["ThisType"] = 194] = "ThisType"; + SyntaxKind[SyntaxKind["TypeOperator"] = 195] = "TypeOperator"; + SyntaxKind[SyntaxKind["IndexedAccessType"] = 196] = "IndexedAccessType"; + SyntaxKind[SyntaxKind["MappedType"] = 197] = "MappedType"; + SyntaxKind[SyntaxKind["LiteralType"] = 198] = "LiteralType"; + SyntaxKind[SyntaxKind["NamedTupleMember"] = 199] = "NamedTupleMember"; + SyntaxKind[SyntaxKind["TemplateLiteralType"] = 200] = "TemplateLiteralType"; + SyntaxKind[SyntaxKind["TemplateLiteralTypeSpan"] = 201] = "TemplateLiteralTypeSpan"; + SyntaxKind[SyntaxKind["ImportType"] = 202] = "ImportType"; // Binding patterns - SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 201] = "ObjectBindingPattern"; - SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 202] = "ArrayBindingPattern"; - SyntaxKind[SyntaxKind["BindingElement"] = 203] = "BindingElement"; + SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 203] = "ObjectBindingPattern"; + SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 204] = "ArrayBindingPattern"; + SyntaxKind[SyntaxKind["BindingElement"] = 205] = "BindingElement"; // Expression - SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 204] = "ArrayLiteralExpression"; - SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 205] = "ObjectLiteralExpression"; - SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 206] = "PropertyAccessExpression"; - SyntaxKind[SyntaxKind["ElementAccessExpression"] = 207] = "ElementAccessExpression"; - SyntaxKind[SyntaxKind["CallExpression"] = 208] = "CallExpression"; - SyntaxKind[SyntaxKind["NewExpression"] = 209] = "NewExpression"; - SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 210] = "TaggedTemplateExpression"; - SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 211] = "TypeAssertionExpression"; - SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 212] = "ParenthesizedExpression"; - SyntaxKind[SyntaxKind["FunctionExpression"] = 213] = "FunctionExpression"; - SyntaxKind[SyntaxKind["ArrowFunction"] = 214] = "ArrowFunction"; - SyntaxKind[SyntaxKind["DeleteExpression"] = 215] = "DeleteExpression"; - SyntaxKind[SyntaxKind["TypeOfExpression"] = 216] = "TypeOfExpression"; - SyntaxKind[SyntaxKind["VoidExpression"] = 217] = "VoidExpression"; - SyntaxKind[SyntaxKind["AwaitExpression"] = 218] = "AwaitExpression"; - SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 219] = "PrefixUnaryExpression"; - SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 220] = "PostfixUnaryExpression"; - SyntaxKind[SyntaxKind["BinaryExpression"] = 221] = "BinaryExpression"; - SyntaxKind[SyntaxKind["ConditionalExpression"] = 222] = "ConditionalExpression"; - SyntaxKind[SyntaxKind["TemplateExpression"] = 223] = "TemplateExpression"; - SyntaxKind[SyntaxKind["YieldExpression"] = 224] = "YieldExpression"; - SyntaxKind[SyntaxKind["SpreadElement"] = 225] = "SpreadElement"; - SyntaxKind[SyntaxKind["ClassExpression"] = 226] = "ClassExpression"; - SyntaxKind[SyntaxKind["OmittedExpression"] = 227] = "OmittedExpression"; - SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 228] = "ExpressionWithTypeArguments"; - SyntaxKind[SyntaxKind["AsExpression"] = 229] = "AsExpression"; - SyntaxKind[SyntaxKind["NonNullExpression"] = 230] = "NonNullExpression"; - SyntaxKind[SyntaxKind["MetaProperty"] = 231] = "MetaProperty"; - SyntaxKind[SyntaxKind["SyntheticExpression"] = 232] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 206] = "ArrayLiteralExpression"; + SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 207] = "ObjectLiteralExpression"; + SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 208] = "PropertyAccessExpression"; + SyntaxKind[SyntaxKind["ElementAccessExpression"] = 209] = "ElementAccessExpression"; + SyntaxKind[SyntaxKind["CallExpression"] = 210] = "CallExpression"; + SyntaxKind[SyntaxKind["NewExpression"] = 211] = "NewExpression"; + SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 212] = "TaggedTemplateExpression"; + SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 213] = "TypeAssertionExpression"; + SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 214] = "ParenthesizedExpression"; + SyntaxKind[SyntaxKind["FunctionExpression"] = 215] = "FunctionExpression"; + SyntaxKind[SyntaxKind["ArrowFunction"] = 216] = "ArrowFunction"; + SyntaxKind[SyntaxKind["DeleteExpression"] = 217] = "DeleteExpression"; + SyntaxKind[SyntaxKind["TypeOfExpression"] = 218] = "TypeOfExpression"; + SyntaxKind[SyntaxKind["VoidExpression"] = 219] = "VoidExpression"; + SyntaxKind[SyntaxKind["AwaitExpression"] = 220] = "AwaitExpression"; + SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 221] = "PrefixUnaryExpression"; + SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 222] = "PostfixUnaryExpression"; + SyntaxKind[SyntaxKind["BinaryExpression"] = 223] = "BinaryExpression"; + SyntaxKind[SyntaxKind["ConditionalExpression"] = 224] = "ConditionalExpression"; + SyntaxKind[SyntaxKind["TemplateExpression"] = 225] = "TemplateExpression"; + SyntaxKind[SyntaxKind["YieldExpression"] = 226] = "YieldExpression"; + SyntaxKind[SyntaxKind["SpreadElement"] = 227] = "SpreadElement"; + SyntaxKind[SyntaxKind["ClassExpression"] = 228] = "ClassExpression"; + SyntaxKind[SyntaxKind["OmittedExpression"] = 229] = "OmittedExpression"; + SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 230] = "ExpressionWithTypeArguments"; + SyntaxKind[SyntaxKind["AsExpression"] = 231] = "AsExpression"; + SyntaxKind[SyntaxKind["NonNullExpression"] = 232] = "NonNullExpression"; + SyntaxKind[SyntaxKind["MetaProperty"] = 233] = "MetaProperty"; + SyntaxKind[SyntaxKind["SyntheticExpression"] = 234] = "SyntheticExpression"; + SyntaxKind[SyntaxKind["SatisfiesExpression"] = 235] = "SatisfiesExpression"; // Misc - SyntaxKind[SyntaxKind["TemplateSpan"] = 233] = "TemplateSpan"; - SyntaxKind[SyntaxKind["SemicolonClassElement"] = 234] = "SemicolonClassElement"; + SyntaxKind[SyntaxKind["TemplateSpan"] = 236] = "TemplateSpan"; + SyntaxKind[SyntaxKind["SemicolonClassElement"] = 237] = "SemicolonClassElement"; // Element - SyntaxKind[SyntaxKind["Block"] = 235] = "Block"; - SyntaxKind[SyntaxKind["EmptyStatement"] = 236] = "EmptyStatement"; - SyntaxKind[SyntaxKind["VariableStatement"] = 237] = "VariableStatement"; - SyntaxKind[SyntaxKind["ExpressionStatement"] = 238] = "ExpressionStatement"; - SyntaxKind[SyntaxKind["IfStatement"] = 239] = "IfStatement"; - SyntaxKind[SyntaxKind["DoStatement"] = 240] = "DoStatement"; - SyntaxKind[SyntaxKind["WhileStatement"] = 241] = "WhileStatement"; - SyntaxKind[SyntaxKind["ForStatement"] = 242] = "ForStatement"; - SyntaxKind[SyntaxKind["ForInStatement"] = 243] = "ForInStatement"; - SyntaxKind[SyntaxKind["ForOfStatement"] = 244] = "ForOfStatement"; - SyntaxKind[SyntaxKind["ContinueStatement"] = 245] = "ContinueStatement"; - SyntaxKind[SyntaxKind["BreakStatement"] = 246] = "BreakStatement"; - SyntaxKind[SyntaxKind["ReturnStatement"] = 247] = "ReturnStatement"; - SyntaxKind[SyntaxKind["WithStatement"] = 248] = "WithStatement"; - SyntaxKind[SyntaxKind["SwitchStatement"] = 249] = "SwitchStatement"; - SyntaxKind[SyntaxKind["LabeledStatement"] = 250] = "LabeledStatement"; - SyntaxKind[SyntaxKind["ThrowStatement"] = 251] = "ThrowStatement"; - SyntaxKind[SyntaxKind["TryStatement"] = 252] = "TryStatement"; - SyntaxKind[SyntaxKind["DebuggerStatement"] = 253] = "DebuggerStatement"; - SyntaxKind[SyntaxKind["VariableDeclaration"] = 254] = "VariableDeclaration"; - SyntaxKind[SyntaxKind["VariableDeclarationList"] = 255] = "VariableDeclarationList"; - SyntaxKind[SyntaxKind["FunctionDeclaration"] = 256] = "FunctionDeclaration"; - SyntaxKind[SyntaxKind["ClassDeclaration"] = 257] = "ClassDeclaration"; - SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 258] = "InterfaceDeclaration"; - SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 259] = "TypeAliasDeclaration"; - SyntaxKind[SyntaxKind["EnumDeclaration"] = 260] = "EnumDeclaration"; - SyntaxKind[SyntaxKind["ModuleDeclaration"] = 261] = "ModuleDeclaration"; - SyntaxKind[SyntaxKind["ModuleBlock"] = 262] = "ModuleBlock"; - SyntaxKind[SyntaxKind["CaseBlock"] = 263] = "CaseBlock"; - SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 264] = "NamespaceExportDeclaration"; - SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 265] = "ImportEqualsDeclaration"; - SyntaxKind[SyntaxKind["ImportDeclaration"] = 266] = "ImportDeclaration"; - SyntaxKind[SyntaxKind["ImportClause"] = 267] = "ImportClause"; - SyntaxKind[SyntaxKind["NamespaceImport"] = 268] = "NamespaceImport"; - SyntaxKind[SyntaxKind["NamedImports"] = 269] = "NamedImports"; - SyntaxKind[SyntaxKind["ImportSpecifier"] = 270] = "ImportSpecifier"; - SyntaxKind[SyntaxKind["ExportAssignment"] = 271] = "ExportAssignment"; - SyntaxKind[SyntaxKind["ExportDeclaration"] = 272] = "ExportDeclaration"; - SyntaxKind[SyntaxKind["NamedExports"] = 273] = "NamedExports"; - SyntaxKind[SyntaxKind["NamespaceExport"] = 274] = "NamespaceExport"; - SyntaxKind[SyntaxKind["ExportSpecifier"] = 275] = "ExportSpecifier"; - SyntaxKind[SyntaxKind["MissingDeclaration"] = 276] = "MissingDeclaration"; + SyntaxKind[SyntaxKind["Block"] = 238] = "Block"; + SyntaxKind[SyntaxKind["EmptyStatement"] = 239] = "EmptyStatement"; + SyntaxKind[SyntaxKind["VariableStatement"] = 240] = "VariableStatement"; + SyntaxKind[SyntaxKind["ExpressionStatement"] = 241] = "ExpressionStatement"; + SyntaxKind[SyntaxKind["IfStatement"] = 242] = "IfStatement"; + SyntaxKind[SyntaxKind["DoStatement"] = 243] = "DoStatement"; + SyntaxKind[SyntaxKind["WhileStatement"] = 244] = "WhileStatement"; + SyntaxKind[SyntaxKind["ForStatement"] = 245] = "ForStatement"; + SyntaxKind[SyntaxKind["ForInStatement"] = 246] = "ForInStatement"; + SyntaxKind[SyntaxKind["ForOfStatement"] = 247] = "ForOfStatement"; + SyntaxKind[SyntaxKind["ContinueStatement"] = 248] = "ContinueStatement"; + SyntaxKind[SyntaxKind["BreakStatement"] = 249] = "BreakStatement"; + SyntaxKind[SyntaxKind["ReturnStatement"] = 250] = "ReturnStatement"; + SyntaxKind[SyntaxKind["WithStatement"] = 251] = "WithStatement"; + SyntaxKind[SyntaxKind["SwitchStatement"] = 252] = "SwitchStatement"; + SyntaxKind[SyntaxKind["LabeledStatement"] = 253] = "LabeledStatement"; + SyntaxKind[SyntaxKind["ThrowStatement"] = 254] = "ThrowStatement"; + SyntaxKind[SyntaxKind["TryStatement"] = 255] = "TryStatement"; + SyntaxKind[SyntaxKind["DebuggerStatement"] = 256] = "DebuggerStatement"; + SyntaxKind[SyntaxKind["VariableDeclaration"] = 257] = "VariableDeclaration"; + SyntaxKind[SyntaxKind["VariableDeclarationList"] = 258] = "VariableDeclarationList"; + SyntaxKind[SyntaxKind["FunctionDeclaration"] = 259] = "FunctionDeclaration"; + SyntaxKind[SyntaxKind["ClassDeclaration"] = 260] = "ClassDeclaration"; + SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 261] = "InterfaceDeclaration"; + SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 262] = "TypeAliasDeclaration"; + SyntaxKind[SyntaxKind["EnumDeclaration"] = 263] = "EnumDeclaration"; + SyntaxKind[SyntaxKind["ModuleDeclaration"] = 264] = "ModuleDeclaration"; + SyntaxKind[SyntaxKind["ModuleBlock"] = 265] = "ModuleBlock"; + SyntaxKind[SyntaxKind["CaseBlock"] = 266] = "CaseBlock"; + SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 267] = "NamespaceExportDeclaration"; + SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 268] = "ImportEqualsDeclaration"; + SyntaxKind[SyntaxKind["ImportDeclaration"] = 269] = "ImportDeclaration"; + SyntaxKind[SyntaxKind["ImportClause"] = 270] = "ImportClause"; + SyntaxKind[SyntaxKind["NamespaceImport"] = 271] = "NamespaceImport"; + SyntaxKind[SyntaxKind["NamedImports"] = 272] = "NamedImports"; + SyntaxKind[SyntaxKind["ImportSpecifier"] = 273] = "ImportSpecifier"; + SyntaxKind[SyntaxKind["ExportAssignment"] = 274] = "ExportAssignment"; + SyntaxKind[SyntaxKind["ExportDeclaration"] = 275] = "ExportDeclaration"; + SyntaxKind[SyntaxKind["NamedExports"] = 276] = "NamedExports"; + SyntaxKind[SyntaxKind["NamespaceExport"] = 277] = "NamespaceExport"; + SyntaxKind[SyntaxKind["ExportSpecifier"] = 278] = "ExportSpecifier"; + SyntaxKind[SyntaxKind["MissingDeclaration"] = 279] = "MissingDeclaration"; // Module references - SyntaxKind[SyntaxKind["ExternalModuleReference"] = 277] = "ExternalModuleReference"; + SyntaxKind[SyntaxKind["ExternalModuleReference"] = 280] = "ExternalModuleReference"; // JSX - SyntaxKind[SyntaxKind["JsxElement"] = 278] = "JsxElement"; - SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 279] = "JsxSelfClosingElement"; - SyntaxKind[SyntaxKind["JsxOpeningElement"] = 280] = "JsxOpeningElement"; - SyntaxKind[SyntaxKind["JsxClosingElement"] = 281] = "JsxClosingElement"; - SyntaxKind[SyntaxKind["JsxFragment"] = 282] = "JsxFragment"; - SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 283] = "JsxOpeningFragment"; - SyntaxKind[SyntaxKind["JsxClosingFragment"] = 284] = "JsxClosingFragment"; - SyntaxKind[SyntaxKind["JsxAttribute"] = 285] = "JsxAttribute"; - SyntaxKind[SyntaxKind["JsxAttributes"] = 286] = "JsxAttributes"; - SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 287] = "JsxSpreadAttribute"; - SyntaxKind[SyntaxKind["JsxExpression"] = 288] = "JsxExpression"; + SyntaxKind[SyntaxKind["JsxElement"] = 281] = "JsxElement"; + SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 282] = "JsxSelfClosingElement"; + SyntaxKind[SyntaxKind["JsxOpeningElement"] = 283] = "JsxOpeningElement"; + SyntaxKind[SyntaxKind["JsxClosingElement"] = 284] = "JsxClosingElement"; + SyntaxKind[SyntaxKind["JsxFragment"] = 285] = "JsxFragment"; + SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 286] = "JsxOpeningFragment"; + SyntaxKind[SyntaxKind["JsxClosingFragment"] = 287] = "JsxClosingFragment"; + SyntaxKind[SyntaxKind["JsxAttribute"] = 288] = "JsxAttribute"; + SyntaxKind[SyntaxKind["JsxAttributes"] = 289] = "JsxAttributes"; + SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 290] = "JsxSpreadAttribute"; + SyntaxKind[SyntaxKind["JsxExpression"] = 291] = "JsxExpression"; // Clauses - SyntaxKind[SyntaxKind["CaseClause"] = 289] = "CaseClause"; - SyntaxKind[SyntaxKind["DefaultClause"] = 290] = "DefaultClause"; - SyntaxKind[SyntaxKind["HeritageClause"] = 291] = "HeritageClause"; - SyntaxKind[SyntaxKind["CatchClause"] = 292] = "CatchClause"; - SyntaxKind[SyntaxKind["AssertClause"] = 293] = "AssertClause"; - SyntaxKind[SyntaxKind["AssertEntry"] = 294] = "AssertEntry"; - SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 295] = "ImportTypeAssertionContainer"; + SyntaxKind[SyntaxKind["CaseClause"] = 292] = "CaseClause"; + SyntaxKind[SyntaxKind["DefaultClause"] = 293] = "DefaultClause"; + SyntaxKind[SyntaxKind["HeritageClause"] = 294] = "HeritageClause"; + SyntaxKind[SyntaxKind["CatchClause"] = 295] = "CatchClause"; + SyntaxKind[SyntaxKind["AssertClause"] = 296] = "AssertClause"; + SyntaxKind[SyntaxKind["AssertEntry"] = 297] = "AssertEntry"; + SyntaxKind[SyntaxKind["ImportTypeAssertionContainer"] = 298] = "ImportTypeAssertionContainer"; // Property assignments - SyntaxKind[SyntaxKind["PropertyAssignment"] = 296] = "PropertyAssignment"; - SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 297] = "ShorthandPropertyAssignment"; - SyntaxKind[SyntaxKind["SpreadAssignment"] = 298] = "SpreadAssignment"; + SyntaxKind[SyntaxKind["PropertyAssignment"] = 299] = "PropertyAssignment"; + SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 300] = "ShorthandPropertyAssignment"; + SyntaxKind[SyntaxKind["SpreadAssignment"] = 301] = "SpreadAssignment"; // Enum - SyntaxKind[SyntaxKind["EnumMember"] = 299] = "EnumMember"; + SyntaxKind[SyntaxKind["EnumMember"] = 302] = "EnumMember"; // Unparsed - SyntaxKind[SyntaxKind["UnparsedPrologue"] = 300] = "UnparsedPrologue"; - SyntaxKind[SyntaxKind["UnparsedPrepend"] = 301] = "UnparsedPrepend"; - SyntaxKind[SyntaxKind["UnparsedText"] = 302] = "UnparsedText"; - SyntaxKind[SyntaxKind["UnparsedInternalText"] = 303] = "UnparsedInternalText"; - SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 304] = "UnparsedSyntheticReference"; + SyntaxKind[SyntaxKind["UnparsedPrologue"] = 303] = "UnparsedPrologue"; + SyntaxKind[SyntaxKind["UnparsedPrepend"] = 304] = "UnparsedPrepend"; + SyntaxKind[SyntaxKind["UnparsedText"] = 305] = "UnparsedText"; + SyntaxKind[SyntaxKind["UnparsedInternalText"] = 306] = "UnparsedInternalText"; + SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 307] = "UnparsedSyntheticReference"; // Top-level nodes - SyntaxKind[SyntaxKind["SourceFile"] = 305] = "SourceFile"; - SyntaxKind[SyntaxKind["Bundle"] = 306] = "Bundle"; - SyntaxKind[SyntaxKind["UnparsedSource"] = 307] = "UnparsedSource"; - SyntaxKind[SyntaxKind["InputFiles"] = 308] = "InputFiles"; + SyntaxKind[SyntaxKind["SourceFile"] = 308] = "SourceFile"; + SyntaxKind[SyntaxKind["Bundle"] = 309] = "Bundle"; + SyntaxKind[SyntaxKind["UnparsedSource"] = 310] = "UnparsedSource"; + SyntaxKind[SyntaxKind["InputFiles"] = 311] = "InputFiles"; // JSDoc nodes - SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 309] = "JSDocTypeExpression"; - SyntaxKind[SyntaxKind["JSDocNameReference"] = 310] = "JSDocNameReference"; - SyntaxKind[SyntaxKind["JSDocMemberName"] = 311] = "JSDocMemberName"; - SyntaxKind[SyntaxKind["JSDocAllType"] = 312] = "JSDocAllType"; - SyntaxKind[SyntaxKind["JSDocUnknownType"] = 313] = "JSDocUnknownType"; - SyntaxKind[SyntaxKind["JSDocNullableType"] = 314] = "JSDocNullableType"; - SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 315] = "JSDocNonNullableType"; - SyntaxKind[SyntaxKind["JSDocOptionalType"] = 316] = "JSDocOptionalType"; - SyntaxKind[SyntaxKind["JSDocFunctionType"] = 317] = "JSDocFunctionType"; - SyntaxKind[SyntaxKind["JSDocVariadicType"] = 318] = "JSDocVariadicType"; - SyntaxKind[SyntaxKind["JSDocNamepathType"] = 319] = "JSDocNamepathType"; - SyntaxKind[SyntaxKind["JSDoc"] = 320] = "JSDoc"; + SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 312] = "JSDocTypeExpression"; + SyntaxKind[SyntaxKind["JSDocNameReference"] = 313] = "JSDocNameReference"; + SyntaxKind[SyntaxKind["JSDocMemberName"] = 314] = "JSDocMemberName"; + SyntaxKind[SyntaxKind["JSDocAllType"] = 315] = "JSDocAllType"; + SyntaxKind[SyntaxKind["JSDocUnknownType"] = 316] = "JSDocUnknownType"; + SyntaxKind[SyntaxKind["JSDocNullableType"] = 317] = "JSDocNullableType"; + SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 318] = "JSDocNonNullableType"; + SyntaxKind[SyntaxKind["JSDocOptionalType"] = 319] = "JSDocOptionalType"; + SyntaxKind[SyntaxKind["JSDocFunctionType"] = 320] = "JSDocFunctionType"; + SyntaxKind[SyntaxKind["JSDocVariadicType"] = 321] = "JSDocVariadicType"; + SyntaxKind[SyntaxKind["JSDocNamepathType"] = 322] = "JSDocNamepathType"; + SyntaxKind[SyntaxKind["JSDoc"] = 323] = "JSDoc"; /** @deprecated Use SyntaxKind.JSDoc */ - SyntaxKind[SyntaxKind["JSDocComment"] = 320] = "JSDocComment"; - SyntaxKind[SyntaxKind["JSDocText"] = 321] = "JSDocText"; - SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 322] = "JSDocTypeLiteral"; - SyntaxKind[SyntaxKind["JSDocSignature"] = 323] = "JSDocSignature"; - SyntaxKind[SyntaxKind["JSDocLink"] = 324] = "JSDocLink"; - SyntaxKind[SyntaxKind["JSDocLinkCode"] = 325] = "JSDocLinkCode"; - SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 326] = "JSDocLinkPlain"; - SyntaxKind[SyntaxKind["JSDocTag"] = 327] = "JSDocTag"; - SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 328] = "JSDocAugmentsTag"; - SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 329] = "JSDocImplementsTag"; - SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 330] = "JSDocAuthorTag"; - SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 331] = "JSDocDeprecatedTag"; - SyntaxKind[SyntaxKind["JSDocClassTag"] = 332] = "JSDocClassTag"; - SyntaxKind[SyntaxKind["JSDocPublicTag"] = 333] = "JSDocPublicTag"; - SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 334] = "JSDocPrivateTag"; - SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 335] = "JSDocProtectedTag"; - SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 336] = "JSDocReadonlyTag"; - SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 337] = "JSDocOverrideTag"; - SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 338] = "JSDocCallbackTag"; - SyntaxKind[SyntaxKind["JSDocEnumTag"] = 339] = "JSDocEnumTag"; - SyntaxKind[SyntaxKind["JSDocParameterTag"] = 340] = "JSDocParameterTag"; - SyntaxKind[SyntaxKind["JSDocReturnTag"] = 341] = "JSDocReturnTag"; - SyntaxKind[SyntaxKind["JSDocThisTag"] = 342] = "JSDocThisTag"; - SyntaxKind[SyntaxKind["JSDocTypeTag"] = 343] = "JSDocTypeTag"; - SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 344] = "JSDocTemplateTag"; - SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 345] = "JSDocTypedefTag"; - SyntaxKind[SyntaxKind["JSDocSeeTag"] = 346] = "JSDocSeeTag"; - SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 347] = "JSDocPropertyTag"; + SyntaxKind[SyntaxKind["JSDocComment"] = 323] = "JSDocComment"; + SyntaxKind[SyntaxKind["JSDocText"] = 324] = "JSDocText"; + SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 325] = "JSDocTypeLiteral"; + SyntaxKind[SyntaxKind["JSDocSignature"] = 326] = "JSDocSignature"; + SyntaxKind[SyntaxKind["JSDocLink"] = 327] = "JSDocLink"; + SyntaxKind[SyntaxKind["JSDocLinkCode"] = 328] = "JSDocLinkCode"; + SyntaxKind[SyntaxKind["JSDocLinkPlain"] = 329] = "JSDocLinkPlain"; + SyntaxKind[SyntaxKind["JSDocTag"] = 330] = "JSDocTag"; + SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 331] = "JSDocAugmentsTag"; + SyntaxKind[SyntaxKind["JSDocImplementsTag"] = 332] = "JSDocImplementsTag"; + SyntaxKind[SyntaxKind["JSDocAuthorTag"] = 333] = "JSDocAuthorTag"; + SyntaxKind[SyntaxKind["JSDocDeprecatedTag"] = 334] = "JSDocDeprecatedTag"; + SyntaxKind[SyntaxKind["JSDocClassTag"] = 335] = "JSDocClassTag"; + SyntaxKind[SyntaxKind["JSDocPublicTag"] = 336] = "JSDocPublicTag"; + SyntaxKind[SyntaxKind["JSDocPrivateTag"] = 337] = "JSDocPrivateTag"; + SyntaxKind[SyntaxKind["JSDocProtectedTag"] = 338] = "JSDocProtectedTag"; + SyntaxKind[SyntaxKind["JSDocReadonlyTag"] = 339] = "JSDocReadonlyTag"; + SyntaxKind[SyntaxKind["JSDocOverrideTag"] = 340] = "JSDocOverrideTag"; + SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 341] = "JSDocCallbackTag"; + SyntaxKind[SyntaxKind["JSDocEnumTag"] = 342] = "JSDocEnumTag"; + SyntaxKind[SyntaxKind["JSDocParameterTag"] = 343] = "JSDocParameterTag"; + SyntaxKind[SyntaxKind["JSDocReturnTag"] = 344] = "JSDocReturnTag"; + SyntaxKind[SyntaxKind["JSDocThisTag"] = 345] = "JSDocThisTag"; + SyntaxKind[SyntaxKind["JSDocTypeTag"] = 346] = "JSDocTypeTag"; + SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 347] = "JSDocTemplateTag"; + SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 348] = "JSDocTypedefTag"; + SyntaxKind[SyntaxKind["JSDocSeeTag"] = 349] = "JSDocSeeTag"; + SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 350] = "JSDocPropertyTag"; // Synthesized list - SyntaxKind[SyntaxKind["SyntaxList"] = 348] = "SyntaxList"; + SyntaxKind[SyntaxKind["SyntaxList"] = 351] = "SyntaxList"; // Transformation nodes - SyntaxKind[SyntaxKind["NotEmittedStatement"] = 349] = "NotEmittedStatement"; - SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 350] = "PartiallyEmittedExpression"; - SyntaxKind[SyntaxKind["CommaListExpression"] = 351] = "CommaListExpression"; - SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 352] = "MergeDeclarationMarker"; - SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 353] = "EndOfDeclarationMarker"; - SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 354] = "SyntheticReferenceExpression"; + SyntaxKind[SyntaxKind["NotEmittedStatement"] = 352] = "NotEmittedStatement"; + SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 353] = "PartiallyEmittedExpression"; + SyntaxKind[SyntaxKind["CommaListExpression"] = 354] = "CommaListExpression"; + SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 355] = "MergeDeclarationMarker"; + SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 356] = "EndOfDeclarationMarker"; + SyntaxKind[SyntaxKind["SyntheticReferenceExpression"] = 357] = "SyntheticReferenceExpression"; // Enum value count - SyntaxKind[SyntaxKind["Count"] = 355] = "Count"; + SyntaxKind[SyntaxKind["Count"] = 358] = "Count"; // Markers SyntaxKind[SyntaxKind["FirstAssignment"] = 63] = "FirstAssignment"; SyntaxKind[SyntaxKind["LastAssignment"] = 78] = "LastAssignment"; @@ -4480,15 +4532,15 @@ var ts; SyntaxKind[SyntaxKind["FirstReservedWord"] = 81] = "FirstReservedWord"; SyntaxKind[SyntaxKind["LastReservedWord"] = 116] = "LastReservedWord"; SyntaxKind[SyntaxKind["FirstKeyword"] = 81] = "FirstKeyword"; - SyntaxKind[SyntaxKind["LastKeyword"] = 160] = "LastKeyword"; + SyntaxKind[SyntaxKind["LastKeyword"] = 162] = "LastKeyword"; SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 117] = "FirstFutureReservedWord"; SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 125] = "LastFutureReservedWord"; - SyntaxKind[SyntaxKind["FirstTypeNode"] = 177] = "FirstTypeNode"; - SyntaxKind[SyntaxKind["LastTypeNode"] = 200] = "LastTypeNode"; + SyntaxKind[SyntaxKind["FirstTypeNode"] = 179] = "FirstTypeNode"; + SyntaxKind[SyntaxKind["LastTypeNode"] = 202] = "LastTypeNode"; SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation"; SyntaxKind[SyntaxKind["LastPunctuation"] = 78] = "LastPunctuation"; SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken"; - SyntaxKind[SyntaxKind["LastToken"] = 160] = "LastToken"; + SyntaxKind[SyntaxKind["LastToken"] = 162] = "LastToken"; SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken"; SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken"; SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken"; @@ -4497,15 +4549,15 @@ var ts; SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken"; SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 29] = "FirstBinaryOperator"; SyntaxKind[SyntaxKind["LastBinaryOperator"] = 78] = "LastBinaryOperator"; - SyntaxKind[SyntaxKind["FirstStatement"] = 237] = "FirstStatement"; - SyntaxKind[SyntaxKind["LastStatement"] = 253] = "LastStatement"; - SyntaxKind[SyntaxKind["FirstNode"] = 161] = "FirstNode"; - SyntaxKind[SyntaxKind["FirstJSDocNode"] = 309] = "FirstJSDocNode"; - SyntaxKind[SyntaxKind["LastJSDocNode"] = 347] = "LastJSDocNode"; - SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 327] = "FirstJSDocTagNode"; - SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 347] = "LastJSDocTagNode"; + SyntaxKind[SyntaxKind["FirstStatement"] = 240] = "FirstStatement"; + SyntaxKind[SyntaxKind["LastStatement"] = 256] = "LastStatement"; + SyntaxKind[SyntaxKind["FirstNode"] = 163] = "FirstNode"; + SyntaxKind[SyntaxKind["FirstJSDocNode"] = 312] = "FirstJSDocNode"; + SyntaxKind[SyntaxKind["LastJSDocNode"] = 350] = "LastJSDocNode"; + SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 330] = "FirstJSDocTagNode"; + SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 350] = "LastJSDocTagNode"; /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 126] = "FirstContextualKeyword"; - /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 160] = "LastContextualKeyword"; + /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 162] = "LastContextualKeyword"; })(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {})); var NodeFlags; (function (NodeFlags) { @@ -4570,9 +4622,10 @@ var ts; ModifierFlags[ModifierFlags["Protected"] = 16] = "Protected"; ModifierFlags[ModifierFlags["Static"] = 32] = "Static"; ModifierFlags[ModifierFlags["Readonly"] = 64] = "Readonly"; - ModifierFlags[ModifierFlags["Abstract"] = 128] = "Abstract"; - ModifierFlags[ModifierFlags["Async"] = 256] = "Async"; - ModifierFlags[ModifierFlags["Default"] = 512] = "Default"; + ModifierFlags[ModifierFlags["Accessor"] = 128] = "Accessor"; + ModifierFlags[ModifierFlags["Abstract"] = 256] = "Abstract"; + ModifierFlags[ModifierFlags["Async"] = 512] = "Async"; + ModifierFlags[ModifierFlags["Default"] = 1024] = "Default"; ModifierFlags[ModifierFlags["Const"] = 2048] = "Const"; ModifierFlags[ModifierFlags["HasComputedJSDocModifiers"] = 4096] = "HasComputedJSDocModifiers"; ModifierFlags[ModifierFlags["Deprecated"] = 8192] = "Deprecated"; @@ -4585,10 +4638,10 @@ var ts; // Accessibility modifiers and 'readonly' can be attached to a parameter in a constructor to make it a property. ModifierFlags[ModifierFlags["ParameterPropertyModifier"] = 16476] = "ParameterPropertyModifier"; ModifierFlags[ModifierFlags["NonPublicAccessibilityModifier"] = 24] = "NonPublicAccessibilityModifier"; - ModifierFlags[ModifierFlags["TypeScriptModifier"] = 116958] = "TypeScriptModifier"; - ModifierFlags[ModifierFlags["ExportDefault"] = 513] = "ExportDefault"; - ModifierFlags[ModifierFlags["All"] = 257023] = "All"; - ModifierFlags[ModifierFlags["Modifier"] = 125951] = "Modifier"; + ModifierFlags[ModifierFlags["TypeScriptModifier"] = 117086] = "TypeScriptModifier"; + ModifierFlags[ModifierFlags["ExportDefault"] = 1025] = "ExportDefault"; + ModifierFlags[ModifierFlags["All"] = 258047] = "All"; + ModifierFlags[ModifierFlags["Modifier"] = 126975] = "Modifier"; })(ModifierFlags = ts.ModifierFlags || (ts.ModifierFlags = {})); var JsxFlags; (function (JsxFlags) { @@ -4784,6 +4837,7 @@ var ts; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyTuple"] = 524288] = "AllowEmptyTuple"; NodeBuilderFlags[NodeBuilderFlags["AllowUniqueESSymbolType"] = 1048576] = "AllowUniqueESSymbolType"; NodeBuilderFlags[NodeBuilderFlags["AllowEmptyIndexInfoType"] = 2097152] = "AllowEmptyIndexInfoType"; + /* @internal */ NodeBuilderFlags[NodeBuilderFlags["WriteComputedProps"] = 1073741824] = "WriteComputedProps"; // Errors (cont.) NodeBuilderFlags[NodeBuilderFlags["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths"; /* @internal */ NodeBuilderFlags[NodeBuilderFlags["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain"; @@ -4844,8 +4898,10 @@ var ts; SymbolFormatFlags[SymbolFormatFlags["AllowAnyNodeKind"] = 4] = "AllowAnyNodeKind"; // Prefer aliases which are not directly visible SymbolFormatFlags[SymbolFormatFlags["UseAliasDefinedOutsideCurrentScope"] = 8] = "UseAliasDefinedOutsideCurrentScope"; + // { [E.A]: 1 } + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["WriteComputedProps"] = 16] = "WriteComputedProps"; // Skip building an accessible symbol chain - /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 16] = "DoNotIncludeSymbolChain"; + /* @internal */ SymbolFormatFlags[SymbolFormatFlags["DoNotIncludeSymbolChain"] = 32] = "DoNotIncludeSymbolChain"; })(SymbolFormatFlags = ts.SymbolFormatFlags || (ts.SymbolFormatFlags = {})); /* @internal */ var SymbolAccessibility; @@ -4959,6 +5015,7 @@ var ts; SymbolFlags[SymbolFlags["MethodExcludes"] = 103359] = "MethodExcludes"; SymbolFlags[SymbolFlags["GetAccessorExcludes"] = 46015] = "GetAccessorExcludes"; SymbolFlags[SymbolFlags["SetAccessorExcludes"] = 78783] = "SetAccessorExcludes"; + SymbolFlags[SymbolFlags["AccessorExcludes"] = 13247] = "AccessorExcludes"; SymbolFlags[SymbolFlags["TypeParameterExcludes"] = 526824] = "TypeParameterExcludes"; SymbolFlags[SymbolFlags["TypeAliasExcludes"] = 788968] = "TypeAliasExcludes"; SymbolFlags[SymbolFlags["AliasExcludes"] = 2097152] = "AliasExcludes"; @@ -5042,8 +5099,8 @@ var ts; NodeCheckFlags[NodeCheckFlags["SuperInstance"] = 256] = "SuperInstance"; NodeCheckFlags[NodeCheckFlags["SuperStatic"] = 512] = "SuperStatic"; NodeCheckFlags[NodeCheckFlags["ContextChecked"] = 1024] = "ContextChecked"; - NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuper"] = 2048] = "AsyncMethodWithSuper"; - NodeCheckFlags[NodeCheckFlags["AsyncMethodWithSuperBinding"] = 4096] = "AsyncMethodWithSuperBinding"; + NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAccessInAsync"] = 2048] = "MethodWithSuperPropertyAccessInAsync"; + NodeCheckFlags[NodeCheckFlags["MethodWithSuperPropertyAssignmentInAsync"] = 4096] = "MethodWithSuperPropertyAssignmentInAsync"; NodeCheckFlags[NodeCheckFlags["CaptureArguments"] = 8192] = "CaptureArguments"; NodeCheckFlags[NodeCheckFlags["EnumValuesComputed"] = 16384] = "EnumValuesComputed"; NodeCheckFlags[NodeCheckFlags["LexicalModuleMergesWithClass"] = 32768] = "LexicalModuleMergesWithClass"; @@ -6085,7 +6142,6 @@ var ts; var pollingChunkSize = createPollingIntervalBasedLevels(defaultChunkLevels); /* @internal */ ts.unchangedPollThresholds = createPollingIntervalBasedLevels(defaultChunkLevels); - /* @internal */ function setCustomPollingValues(system) { if (!system.getEnvironmentVariable) { return; @@ -6128,7 +6184,6 @@ var ts; createPollingIntervalBasedLevels(customLevels ? __assign(__assign({}, defaultLevels), customLevels) : defaultLevels); } } - ts.setCustomPollingValues = setCustomPollingValues; function pollWatchedFileQueue(host, queue, pollIndex, chunkSize, callbackOnWatchFileStat) { var definedValueCopyToIndex = pollIndex; // Max visit would be all elements of the queue @@ -6174,7 +6229,6 @@ var ts; } } } - /* @internal */ function createDynamicPriorityPollingWatchFile(host) { var watchedFiles = []; var changedFilesInLastPoll = []; @@ -6283,7 +6337,6 @@ var ts; pollingIntervalQueue(pollingInterval).pollScheduled = host.setTimeout(pollingInterval === PollingInterval.Low ? pollLowPollingIntervalQueue : pollPollingIntervalQueue, pollingInterval, pollingIntervalQueue(pollingInterval)); } } - ts.createDynamicPriorityPollingWatchFile = createDynamicPriorityPollingWatchFile; function createUseFsEventsOnParentDirectoryWatchFile(fsWatch, useCaseSensitiveFileNames) { // One file can have multiple watchers var fileWatcherCallbacks = ts.createMultiMap(); @@ -6362,42 +6415,38 @@ var ts; pollScheduled = host.setTimeout(pollQueue, PollingInterval.High); } } - /* @internal */ - function createSingleFileWatcherPerName(watchFile, useCaseSensitiveFileNames) { - var cache = new ts.Map(); - var callbacksCache = ts.createMultiMap(); + function createSingleWatcherPerName(cache, useCaseSensitiveFileNames, name, callback, createWatcher) { var toCanonicalFileName = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - return function (fileName, callback, pollingInterval, options) { - var path = toCanonicalFileName(fileName); - var existing = cache.get(path); - if (existing) { - existing.refCount++; - } - else { - cache.set(path, { - watcher: watchFile(fileName, function (fileName, eventKind, modifiedTime) { return ts.forEach(callbacksCache.get(path), function (cb) { return cb(fileName, eventKind, modifiedTime); }); }, pollingInterval, options), - refCount: 1 - }); + var path = toCanonicalFileName(name); + var existing = cache.get(path); + if (existing) { + existing.callbacks.push(callback); + } + else { + cache.set(path, { + watcher: createWatcher(( + // Cant infer types correctly so lets satisfy checker + function (param1, param2, param3) { var _a; return (_a = cache.get(path)) === null || _a === void 0 ? void 0 : _a.callbacks.slice().forEach(function (cb) { return cb(param1, param2, param3); }); })), + callbacks: [callback] + }); + } + return { + close: function () { + var watcher = cache.get(path); + // Watcher is not expected to be undefined, but if it is normally its because + // exception was thrown somewhere else and watch state is not what it should be + if (!watcher) + return; + if (!ts.orderedRemoveItem(watcher.callbacks, callback) || watcher.callbacks.length) + return; + cache.delete(path); + ts.closeFileWatcherOf(watcher); } - callbacksCache.add(path, callback); - return { - close: function () { - var watcher = ts.Debug.checkDefined(cache.get(path)); - callbacksCache.remove(path, callback); - watcher.refCount--; - if (watcher.refCount) - return; - cache.delete(path); - ts.closeFileWatcherOf(watcher); - } - }; }; } - ts.createSingleFileWatcherPerName = createSingleFileWatcherPerName; /** * Returns true if file status changed */ - /*@internal*/ function onWatchedFileStat(watchedFile, modifiedTime) { var oldTime = watchedFile.mtime.getTime(); var newTime = modifiedTime.getTime(); @@ -6409,7 +6458,6 @@ var ts; } return false; } - ts.onWatchedFileStat = onWatchedFileStat; /*@internal*/ function getFileWatcherEventKind(oldTime, newTime) { return oldTime === 0 @@ -6437,7 +6485,6 @@ var ts; * that means if this is recursive watcher, watch the children directories as well * (eg on OS that dont support recursive watch using fs.watch use fs.watchFile) */ - /*@internal*/ function createDirectoryWatcherSupportingRecursive(_a) { var watchDirectory = _a.watchDirectory, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, fileSystemEntryExists = _a.fileSystemEntryExists, realpath = _a.realpath, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout; var cache = new ts.Map(); @@ -6646,18 +6693,15 @@ var ts; return ts.stringContains(toCanonicalFilePath(path), searchPath); } } - ts.createDirectoryWatcherSupportingRecursive = createDirectoryWatcherSupportingRecursive; /*@internal*/ var FileSystemEntryKind; (function (FileSystemEntryKind) { FileSystemEntryKind[FileSystemEntryKind["File"] = 0] = "File"; FileSystemEntryKind[FileSystemEntryKind["Directory"] = 1] = "Directory"; })(FileSystemEntryKind = ts.FileSystemEntryKind || (ts.FileSystemEntryKind = {})); - /*@internal*/ function createFileWatcherCallback(callback) { return function (_fileName, eventKind, modifiedTime) { return callback(eventKind === FileWatcherEventKind.Changed ? "change" : "rename", "", modifiedTime); }; } - ts.createFileWatcherCallback = createFileWatcherCallback; function createFsWatchCallbackForFileWatcherCallback(fileName, callback, getModifiedTime) { return function (eventName, _relativeFileName, modifiedTime) { if (eventName === "rename") { @@ -6691,7 +6735,10 @@ var ts; } /*@internal*/ function createSystemWatchFunctions(_a) { - var pollingWatchFile = _a.pollingWatchFile, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, defaultWatchFileKind = _a.defaultWatchFileKind, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatchFileWorker = _a.pollingWatchFileWorker, getModifiedTime = _a.getModifiedTime, setTimeout = _a.setTimeout, clearTimeout = _a.clearTimeout, fsWatchWorker = _a.fsWatchWorker, fileSystemEntryExists = _a.fileSystemEntryExists, useCaseSensitiveFileNames = _a.useCaseSensitiveFileNames, getCurrentDirectory = _a.getCurrentDirectory, fsSupportsRecursiveFsWatch = _a.fsSupportsRecursiveFsWatch, getAccessibleSortedChildDirectories = _a.getAccessibleSortedChildDirectories, realpath = _a.realpath, tscWatchFile = _a.tscWatchFile, useNonPollingWatchers = _a.useNonPollingWatchers, tscWatchDirectory = _a.tscWatchDirectory, inodeWatching = _a.inodeWatching, sysLog = _a.sysLog; + var pollingWatches = new ts.Map(); + var fsWatches = new ts.Map(); + var fsWatchesRecursive = new ts.Map(); var dynamicPollingWatchFile; var fixedChunkSizePollingWatchFile; var nonPollingWatchFile; @@ -6754,8 +6801,8 @@ var ts; return useNonPollingWatchers ? // Use notifications from FS to watch with falling back to fs.watchFile generateWatchFileOptions(ts.WatchFileKind.UseFsEventsOnParentDirectory, ts.PollingWatchKind.PriorityInterval, options) : - // Default to do not use fixed polling interval - { watchFile: (defaultWatchFileKind === null || defaultWatchFileKind === void 0 ? void 0 : defaultWatchFileKind()) || ts.WatchFileKind.FixedPollingInterval }; + // Default to using fs events + { watchFile: ts.WatchFileKind.UseFsEvents }; } } function generateWatchFileOptions(watchFile, fallbackPolling, options) { @@ -6826,7 +6873,13 @@ var ts; }; } } + function pollingWatchFile(fileName, callback, pollingInterval, options) { + return createSingleWatcherPerName(pollingWatches, useCaseSensitiveFileNames, fileName, callback, function (cb) { return pollingWatchFileWorker(fileName, cb, pollingInterval, options); }); + } function fsWatch(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { + return createSingleWatcherPerName(recursive ? fsWatchesRecursive : fsWatches, useCaseSensitiveFileNames, fileOrDirectory, callback, function (cb) { return fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, cb, recursive, fallbackPollingInterval, fallbackOptions); }); + } + function fsWatchHandlingExistenceOnHost(fileOrDirectory, entryKind, callback, recursive, fallbackPollingInterval, fallbackOptions) { var lastDirectoryPartWithDirectorySeparator; var lastDirectoryPart; if (inodeWatching) { @@ -7005,7 +7058,7 @@ var ts; var fsSupportsRecursiveFsWatch = isNode4OrLater && (process.platform === "win32" || process.platform === "darwin"); var getCurrentDirectory = ts.memoize(function () { return process.cwd(); }); var _b = createSystemWatchFunctions({ - pollingWatchFile: createSingleFileWatcherPerName(fsWatchFileWorker, useCaseSensitiveFileNames), + pollingWatchFileWorker: fsWatchFileWorker, getModifiedTime: getModifiedTime, setTimeout: setTimeout, clearTimeout: clearTimeout, @@ -7021,7 +7074,6 @@ var ts; tscWatchFile: process.env.TSC_WATCHFILE, useNonPollingWatchers: process.env.TSC_NONPOLLING_WATCHER, tscWatchDirectory: process.env.TSC_WATCHDIRECTORY, - defaultWatchFileKind: function () { var _a, _b; return (_b = (_a = sys).defaultWatchFileKind) === null || _b === void 0 ? void 0 : _b.call(_a); }, inodeWatching: isLinuxOrMacOs, sysLog: sysLog, }), watchFile = _b.watchFile, watchDirectory = _b.watchDirectory; @@ -7825,12 +7877,9 @@ var ts; * Normalize path separators, converting `\` into `/`. */ function normalizeSlashes(path) { - var index = path.indexOf("\\"); - if (index === -1) { - return path; - } - backslashRegExp.lastIndex = index; // prime regex with known position - return path.replace(backslashRegExp, ts.directorySeparator); + return path.indexOf("\\") !== -1 + ? path.replace(backslashRegExp, ts.directorySeparator) + : path; } ts.normalizeSlashes = normalizeSlashes; /** @@ -8413,6 +8462,8 @@ var ts; A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_when_isolatedModules_and_emitDecoratorMetadata_are_enabled: diag(1272, ts.DiagnosticCategory.Error, "A_type_referenced_in_a_decorated_signature_must_be_imported_with_import_type_or_a_namespace_import_w_1272", "A type referenced in a decorated signature must be imported with 'import type' or a namespace import when 'isolatedModules' and 'emitDecoratorMetadata' are enabled."), _0_modifier_cannot_appear_on_a_type_parameter: diag(1273, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_type_parameter_1273", "'{0}' modifier cannot appear on a type parameter"), _0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias: diag(1274, ts.DiagnosticCategory.Error, "_0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias_1274", "'{0}' modifier can only appear on a type parameter of a class, interface or type alias"), + accessor_modifier_can_only_appear_on_a_property_declaration: diag(1275, ts.DiagnosticCategory.Error, "accessor_modifier_can_only_appear_on_a_property_declaration_1275", "'accessor' modifier can only appear on a property declaration."), + An_accessor_property_cannot_be_declared_optional: diag(1276, ts.DiagnosticCategory.Error, "An_accessor_property_cannot_be_declared_optional_1276", "An 'accessor' property cannot be declared optional."), with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."), await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules: diag(1308, ts.DiagnosticCategory.Error, "await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules_1308", "'await' expressions are only allowed within async functions and at the top levels of modules."), The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level: diag(1309, ts.DiagnosticCategory.Error, "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309", "The current file is a CommonJS module and cannot use 'await' at the top level."), @@ -8463,7 +8514,7 @@ var ts; An_enum_member_name_must_be_followed_by_a_or: diag(1357, ts.DiagnosticCategory.Error, "An_enum_member_name_must_be_followed_by_a_or_1357", "An enum member name must be followed by a ',', '=', or '}'."), Tagged_template_expressions_are_not_permitted_in_an_optional_chain: diag(1358, ts.DiagnosticCategory.Error, "Tagged_template_expressions_are_not_permitted_in_an_optional_chain_1358", "Tagged template expressions are not permitted in an optional chain."), Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here: diag(1359, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here_1359", "Identifier expected. '{0}' is a reserved word that cannot be used here."), - Class_constructor_may_not_be_a_generator: diag(1360, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1360", "Class constructor may not be a generator."), + Type_0_does_not_satisfy_the_expected_type_1: diag(1360, ts.DiagnosticCategory.Error, "Type_0_does_not_satisfy_the_expected_type_1_1360", "Type '{0}' does not satisfy the expected type '{1}'."), _0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type: diag(1361, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type_1361", "'{0}' cannot be used as a value because it was imported using 'import type'."), _0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type: diag(1362, ts.DiagnosticCategory.Error, "_0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type_1362", "'{0}' cannot be used as a value because it was exported using 'export type'."), A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both: diag(1363, ts.DiagnosticCategory.Error, "A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both_1363", "A type-only import can specify a default import or named bindings, but not both."), @@ -8471,6 +8522,7 @@ var ts; Convert_all_re_exported_types_to_type_only_exports: diag(1365, ts.DiagnosticCategory.Message, "Convert_all_re_exported_types_to_type_only_exports_1365", "Convert all re-exported types to type-only exports"), Split_into_two_separate_import_declarations: diag(1366, ts.DiagnosticCategory.Message, "Split_into_two_separate_import_declarations_1366", "Split into two separate import declarations"), Split_all_invalid_type_only_imports: diag(1367, ts.DiagnosticCategory.Message, "Split_all_invalid_type_only_imports_1367", "Split all invalid type-only imports"), + Class_constructor_may_not_be_a_generator: diag(1368, ts.DiagnosticCategory.Error, "Class_constructor_may_not_be_a_generator_1368", "Class constructor may not be a generator."), Did_you_mean_0: diag(1369, ts.DiagnosticCategory.Message, "Did_you_mean_0_1369", "Did you mean '{0}'?"), This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set_to_error: diag(1371, ts.DiagnosticCategory.Error, "This_import_is_never_used_as_a_value_and_must_use_import_type_because_importsNotUsedAsValues_is_set__1371", "This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'."), Convert_to_type_only_import: diag(1373, ts.DiagnosticCategory.Message, "Convert_to_type_only_import_1373", "Convert to type-only import"), @@ -8644,14 +8696,12 @@ var ts; The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access: diag(2357, ts.DiagnosticCategory.Error, "The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_or_a_property_access_2357", "The operand of an increment or decrement operator must be a variable or a property access."), The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: diag(2358, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358", "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter."), The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: diag(2359, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359", "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type."), - The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol: diag(2360, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360", "The left-hand side of an 'in' expression must be a private identifier or of type 'any', 'string', 'number', or 'symbol'."), - The_right_hand_side_of_an_in_expression_must_not_be_a_primitive: diag(2361, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361", "The right-hand side of an 'in' expression must not be a primitive."), The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2362, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362", "The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type: diag(2363, ts.DiagnosticCategory.Error, "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363", "The right-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type."), The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access: diag(2364, ts.DiagnosticCategory.Error, "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364", "The left-hand side of an assignment expression must be a variable or a property access."), Operator_0_cannot_be_applied_to_types_1_and_2: diag(2365, ts.DiagnosticCategory.Error, "Operator_0_cannot_be_applied_to_types_1_and_2_2365", "Operator '{0}' cannot be applied to types '{1}' and '{2}'."), Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined: diag(2366, ts.DiagnosticCategory.Error, "Function_lacks_ending_return_statement_and_return_type_does_not_include_undefined_2366", "Function lacks ending return statement and return type does not include 'undefined'."), - This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367", "This condition will always return '{0}' since the types '{1}' and '{2}' have no overlap."), + This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap: diag(2367, ts.DiagnosticCategory.Error, "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367", "This comparison appears to be unintentional because the types '{0}' and '{1}' have no overlap."), Type_parameter_name_cannot_be_0: diag(2368, ts.DiagnosticCategory.Error, "Type_parameter_name_cannot_be_0_2368", "Type parameter name cannot be '{0}'."), A_parameter_property_is_only_allowed_in_a_constructor_implementation: diag(2369, ts.DiagnosticCategory.Error, "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369", "A parameter property is only allowed in a constructor implementation."), A_rest_parameter_must_be_of_an_array_type: diag(2370, ts.DiagnosticCategory.Error, "A_rest_parameter_must_be_of_an_array_type_2370", "A rest parameter must be of an array type."), @@ -8894,6 +8944,7 @@ var ts; Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable: diag(2635, ts.DiagnosticCategory.Error, "Type_0_has_no_signatures_for_which_the_type_argument_list_is_applicable_2635", "Type '{0}' has no signatures for which the type argument list is applicable."), Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation: diag(2636, ts.DiagnosticCategory.Error, "Type_0_is_not_assignable_to_type_1_as_implied_by_variance_annotation_2636", "Type '{0}' is not assignable to type '{1}' as implied by variance annotation."), Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_types: diag(2637, ts.DiagnosticCategory.Error, "Variance_annotations_are_only_supported_in_type_aliases_for_object_function_constructor_and_mapped_t_2637", "Variance annotations are only supported in type aliases for object, function, constructor, and mapped types."), + Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator: diag(2638, ts.DiagnosticCategory.Error, "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638", "Type '{0}' may represent a primitive value, which is not permitted as the right operand of the 'in' operator."), Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity: diag(2649, ts.DiagnosticCategory.Error, "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649", "Cannot augment module '{0}' with value exports because it resolves to a non-module entity."), A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_members_defined_in_other_enums: diag(2651, ts.DiagnosticCategory.Error, "A_member_initializer_in_a_enum_declaration_cannot_reference_members_declared_after_it_including_memb_2651", "A member initializer in a enum declaration cannot reference members declared after it, including members defined in other enums."), Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_default_0_declaration_instead: diag(2652, ts.DiagnosticCategory.Error, "Merged_declaration_0_cannot_include_a_default_export_declaration_Consider_adding_a_separate_export_d_2652", "Merged declaration '{0}' cannot include a default export declaration. Consider adding a separate 'export default {0}' declaration instead."), @@ -9074,6 +9125,7 @@ var ts; _0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation: diag(2842, ts.DiagnosticCategory.Error, "_0_is_an_unused_renaming_of_1_Did_you_intend_to_use_it_as_a_type_annotation_2842", "'{0}' is an unused renaming of '{1}'. Did you intend to use it as a type annotation?"), We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here: diag(2843, ts.DiagnosticCategory.Error, "We_can_only_write_a_type_for_0_by_adding_a_type_for_the_entire_parameter_here_2843", "We can only write a type for '{0}' by adding a type for the entire parameter here."), Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2844, ts.DiagnosticCategory.Error, "Type_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2844", "Type of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."), + This_condition_will_always_return_0: diag(2845, ts.DiagnosticCategory.Error, "This_condition_will_always_return_0_2845", "This condition will always return '{0}'."), Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."), Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."), Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."), @@ -9531,6 +9583,11 @@ var ts; Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved: diag(6398, ts.DiagnosticCategory.Message, "Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_re_6398", "Reusing resolution of type reference directive '{0}' from '{1}' found in cache from location '{2}', it was not resolved."), Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted: diag(6399, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitte_6399", "Project '{0}' is out of date because buildinfo file '{1}' indicates that some of the changes were not emitted"), Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_files: diag(6400, ts.DiagnosticCategory.Message, "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400", "Project '{0}' is up to date but needs to update timestamps of output files that are older than input files"), + Project_0_is_out_of_date_because_there_was_error_reading_file_1: diag(6401, ts.DiagnosticCategory.Message, "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401", "Project '{0}' is out of date because there was error reading file '{1}'"), + Resolving_in_0_mode_with_conditions_1: diag(6402, ts.DiagnosticCategory.Message, "Resolving_in_0_mode_with_conditions_1_6402", "Resolving in {0} mode with conditions {1}."), + Matched_0_condition_1: diag(6403, ts.DiagnosticCategory.Message, "Matched_0_condition_1_6403", "Matched '{0}' condition '{1}'."), + Using_0_subpath_1_with_target_2: diag(6404, ts.DiagnosticCategory.Message, "Using_0_subpath_1_with_target_2_6404", "Using '{0}' subpath '{1}' with target '{2}'."), + Saw_non_matching_condition_0: diag(6405, ts.DiagnosticCategory.Message, "Saw_non_matching_condition_0_6405", "Saw non-matching condition '{0}'."), The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1: diag(6500, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_property_0_which_is_declared_here_on_type_1_6500", "The expected type comes from property '{0}' which is declared here on type '{1}'"), The_expected_type_comes_from_this_index_signature: diag(6501, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_this_index_signature_6501", "The expected type comes from this index signature."), The_expected_type_comes_from_the_return_type_of_this_signature: diag(6502, ts.DiagnosticCategory.Message, "The_expected_type_comes_from_the_return_type_of_this_signature_6502", "The expected type comes from the return type of this signature."), @@ -9773,6 +9830,7 @@ var ts; The_tag_was_first_specified_here: diag(8034, ts.DiagnosticCategory.Error, "The_tag_was_first_specified_here_8034", "The tag was first specified here."), You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder: diag(8035, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035", "You cannot rename elements that are defined in a 'node_modules' folder."), You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder: diag(8036, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_another_node_modules_folder_8036", "You cannot rename elements that are defined in another 'node_modules' folder."), + Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files: diag(8037, ts.DiagnosticCategory.Error, "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037", "Type satisfaction expressions can only be used in TypeScript files."), Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9005, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_9005", "Declaration emit for this file requires using private name '{0}'. An explicit type annotation may unblock declaration emit."), Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit: diag(9006, ts.DiagnosticCategory.Error, "Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotati_9006", "Declaration emit for this file requires using private name '{0}' from module '{1}'. An explicit type annotation may unblock declaration emit."), JSX_attributes_must_only_be_assigned_a_non_empty_expression: diag(17000, ts.DiagnosticCategory.Error, "JSX_attributes_must_only_be_assigned_a_non_empty_expression_17000", "JSX attributes must only be assigned a non-empty 'expression'."), @@ -9846,6 +9904,8 @@ var ts; Remove_type_from_import_of_0_from_1: diag(90056, ts.DiagnosticCategory.Message, "Remove_type_from_import_of_0_from_1_90056", "Remove 'type' from import of '{0}' from \"{1}\""), Add_import_from_0: diag(90057, ts.DiagnosticCategory.Message, "Add_import_from_0_90057", "Add import from \"{0}\""), Update_import_from_0: diag(90058, ts.DiagnosticCategory.Message, "Update_import_from_0_90058", "Update import from \"{0}\""), + Export_0_from_module_1: diag(90059, ts.DiagnosticCategory.Message, "Export_0_from_module_1_90059", "Export '{0}' from module '{1}'"), + Export_all_referenced_locals: diag(90060, ts.DiagnosticCategory.Message, "Export_all_referenced_locals_90060", "Export all referenced locals"), Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"), Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"), Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"), @@ -9944,6 +10004,7 @@ var ts; Set_the_module_option_in_your_configuration_file_to_0: diag(95099, ts.DiagnosticCategory.Message, "Set_the_module_option_in_your_configuration_file_to_0_95099", "Set the 'module' option in your configuration file to '{0}'"), Convert_invalid_character_to_its_html_entity_code: diag(95100, ts.DiagnosticCategory.Message, "Convert_invalid_character_to_its_html_entity_code_95100", "Convert invalid character to its html entity code"), Convert_all_invalid_characters_to_HTML_entity_code: diag(95101, ts.DiagnosticCategory.Message, "Convert_all_invalid_characters_to_HTML_entity_code_95101", "Convert all invalid characters to HTML entity code"), + Convert_all_const_to_let: diag(95102, ts.DiagnosticCategory.Message, "Convert_all_const_to_let_95102", "Convert all 'const' to 'let'"), Convert_function_expression_0_to_arrow_function: diag(95105, ts.DiagnosticCategory.Message, "Convert_function_expression_0_to_arrow_function_95105", "Convert function expression '{0}' to arrow function"), Convert_function_declaration_0_to_arrow_function: diag(95106, ts.DiagnosticCategory.Message, "Convert_function_declaration_0_to_arrow_function_95106", "Convert function declaration '{0}' to arrow function"), Fix_all_implicit_this_errors: diag(95107, ts.DiagnosticCategory.Message, "Fix_all_implicit_this_errors_95107", "Fix all implicit-'this' errors"), @@ -10013,6 +10074,8 @@ var ts; Delete_unused_param_tag_0: diag(95171, ts.DiagnosticCategory.Message, "Delete_unused_param_tag_0_95171", "Delete unused '@param' tag '{0}'"), Delete_all_unused_param_tags: diag(95172, ts.DiagnosticCategory.Message, "Delete_all_unused_param_tags_95172", "Delete all unused '@param' tags"), Rename_param_tag_name_0_to_1: diag(95173, ts.DiagnosticCategory.Message, "Rename_param_tag_name_0_to_1_95173", "Rename '@param' tag name '{0}' to '{1}'"), + Use_0: diag(95174, ts.DiagnosticCategory.Message, "Use_0_95174", "Use `{0}`."), + Use_Number_isNaN_in_all_conditions: diag(95175, ts.DiagnosticCategory.Message, "Use_Number_isNaN_in_all_conditions_95175", "Use `Number.isNaN` in all conditions."), No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."), Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."), JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array: diag(18007, ts.DiagnosticCategory.Error, "JSX_expressions_may_not_use_the_comma_operator_Did_you_mean_to_write_an_array_18007", "JSX expressions may not use the comma operator. Did you mean to write an array?"), @@ -10046,6 +10109,12 @@ var ts; _0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation: diag(18042, ts.DiagnosticCategory.Error, "_0_is_a_type_and_cannot_be_imported_in_JavaScript_files_Use_1_in_a_JSDoc_type_annotation_18042", "'{0}' is a type and cannot be imported in JavaScript files. Use '{1}' in a JSDoc type annotation."), Types_cannot_appear_in_export_declarations_in_JavaScript_files: diag(18043, ts.DiagnosticCategory.Error, "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043", "Types cannot appear in export declarations in JavaScript files."), _0_is_automatically_exported_here: diag(18044, ts.DiagnosticCategory.Message, "_0_is_automatically_exported_here_18044", "'{0}' is automatically exported here."), + Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher: diag(18045, ts.DiagnosticCategory.Error, "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045", "Properties with the 'accessor' modifier are only available when targeting ECMAScript 2015 and higher."), + _0_is_of_type_unknown: diag(18046, ts.DiagnosticCategory.Error, "_0_is_of_type_unknown_18046", "'{0}' is of type 'unknown'."), + _0_is_possibly_null: diag(18047, ts.DiagnosticCategory.Error, "_0_is_possibly_null_18047", "'{0}' is possibly 'null'."), + _0_is_possibly_undefined: diag(18048, ts.DiagnosticCategory.Error, "_0_is_possibly_undefined_18048", "'{0}' is possibly 'undefined'."), + _0_is_possibly_null_or_undefined: diag(18049, ts.DiagnosticCategory.Error, "_0_is_possibly_null_or_undefined_18049", "'{0}' is possibly 'null' or 'undefined'."), + The_value_0_cannot_be_used_here: diag(18050, ts.DiagnosticCategory.Error, "The_value_0_cannot_be_used_here_18050", "The value '{0}' cannot be used here."), }; })(ts || (ts = {})); var ts; @@ -10064,12 +10133,13 @@ var ts; /** @internal */ ts.textToKeywordObj = (_a = { abstract: 126 /* SyntaxKind.AbstractKeyword */, - any: 130 /* SyntaxKind.AnyKeyword */, - as: 127 /* SyntaxKind.AsKeyword */, - asserts: 128 /* SyntaxKind.AssertsKeyword */, - assert: 129 /* SyntaxKind.AssertKeyword */, - bigint: 158 /* SyntaxKind.BigIntKeyword */, - boolean: 133 /* SyntaxKind.BooleanKeyword */, + accessor: 127 /* SyntaxKind.AccessorKeyword */, + any: 131 /* SyntaxKind.AnyKeyword */, + as: 128 /* SyntaxKind.AsKeyword */, + asserts: 129 /* SyntaxKind.AssertsKeyword */, + assert: 130 /* SyntaxKind.AssertKeyword */, + bigint: 160 /* SyntaxKind.BigIntKeyword */, + boolean: 134 /* SyntaxKind.BooleanKeyword */, break: 81 /* SyntaxKind.BreakKeyword */, case: 82 /* SyntaxKind.CaseKeyword */, catch: 83 /* SyntaxKind.CatchKeyword */, @@ -10077,9 +10147,9 @@ var ts; continue: 86 /* SyntaxKind.ContinueKeyword */, const: 85 /* SyntaxKind.ConstKeyword */ }, - _a["" + "constructor"] = 134 /* SyntaxKind.ConstructorKeyword */, + _a["" + "constructor"] = 135 /* SyntaxKind.ConstructorKeyword */, _a.debugger = 87 /* SyntaxKind.DebuggerKeyword */, - _a.declare = 135 /* SyntaxKind.DeclareKeyword */, + _a.declare = 136 /* SyntaxKind.DeclareKeyword */, _a.default = 88 /* SyntaxKind.DefaultKeyword */, _a.delete = 89 /* SyntaxKind.DeleteKeyword */, _a.do = 90 /* SyntaxKind.DoKeyword */, @@ -10090,60 +10160,61 @@ var ts; _a.false = 95 /* SyntaxKind.FalseKeyword */, _a.finally = 96 /* SyntaxKind.FinallyKeyword */, _a.for = 97 /* SyntaxKind.ForKeyword */, - _a.from = 156 /* SyntaxKind.FromKeyword */, + _a.from = 158 /* SyntaxKind.FromKeyword */, _a.function = 98 /* SyntaxKind.FunctionKeyword */, - _a.get = 136 /* SyntaxKind.GetKeyword */, + _a.get = 137 /* SyntaxKind.GetKeyword */, _a.if = 99 /* SyntaxKind.IfKeyword */, _a.implements = 117 /* SyntaxKind.ImplementsKeyword */, _a.import = 100 /* SyntaxKind.ImportKeyword */, _a.in = 101 /* SyntaxKind.InKeyword */, - _a.infer = 137 /* SyntaxKind.InferKeyword */, + _a.infer = 138 /* SyntaxKind.InferKeyword */, _a.instanceof = 102 /* SyntaxKind.InstanceOfKeyword */, _a.interface = 118 /* SyntaxKind.InterfaceKeyword */, - _a.intrinsic = 138 /* SyntaxKind.IntrinsicKeyword */, - _a.is = 139 /* SyntaxKind.IsKeyword */, - _a.keyof = 140 /* SyntaxKind.KeyOfKeyword */, + _a.intrinsic = 139 /* SyntaxKind.IntrinsicKeyword */, + _a.is = 140 /* SyntaxKind.IsKeyword */, + _a.keyof = 141 /* SyntaxKind.KeyOfKeyword */, _a.let = 119 /* SyntaxKind.LetKeyword */, - _a.module = 141 /* SyntaxKind.ModuleKeyword */, - _a.namespace = 142 /* SyntaxKind.NamespaceKeyword */, - _a.never = 143 /* SyntaxKind.NeverKeyword */, + _a.module = 142 /* SyntaxKind.ModuleKeyword */, + _a.namespace = 143 /* SyntaxKind.NamespaceKeyword */, + _a.never = 144 /* SyntaxKind.NeverKeyword */, _a.new = 103 /* SyntaxKind.NewKeyword */, _a.null = 104 /* SyntaxKind.NullKeyword */, - _a.number = 147 /* SyntaxKind.NumberKeyword */, - _a.object = 148 /* SyntaxKind.ObjectKeyword */, + _a.number = 148 /* SyntaxKind.NumberKeyword */, + _a.object = 149 /* SyntaxKind.ObjectKeyword */, _a.package = 120 /* SyntaxKind.PackageKeyword */, _a.private = 121 /* SyntaxKind.PrivateKeyword */, _a.protected = 122 /* SyntaxKind.ProtectedKeyword */, _a.public = 123 /* SyntaxKind.PublicKeyword */, - _a.override = 159 /* SyntaxKind.OverrideKeyword */, - _a.out = 144 /* SyntaxKind.OutKeyword */, - _a.readonly = 145 /* SyntaxKind.ReadonlyKeyword */, - _a.require = 146 /* SyntaxKind.RequireKeyword */, - _a.global = 157 /* SyntaxKind.GlobalKeyword */, + _a.override = 161 /* SyntaxKind.OverrideKeyword */, + _a.out = 145 /* SyntaxKind.OutKeyword */, + _a.readonly = 146 /* SyntaxKind.ReadonlyKeyword */, + _a.require = 147 /* SyntaxKind.RequireKeyword */, + _a.global = 159 /* SyntaxKind.GlobalKeyword */, _a.return = 105 /* SyntaxKind.ReturnKeyword */, - _a.set = 149 /* SyntaxKind.SetKeyword */, + _a.satisfies = 150 /* SyntaxKind.SatisfiesKeyword */, + _a.set = 151 /* SyntaxKind.SetKeyword */, _a.static = 124 /* SyntaxKind.StaticKeyword */, - _a.string = 150 /* SyntaxKind.StringKeyword */, + _a.string = 152 /* SyntaxKind.StringKeyword */, _a.super = 106 /* SyntaxKind.SuperKeyword */, _a.switch = 107 /* SyntaxKind.SwitchKeyword */, - _a.symbol = 151 /* SyntaxKind.SymbolKeyword */, + _a.symbol = 153 /* SyntaxKind.SymbolKeyword */, _a.this = 108 /* SyntaxKind.ThisKeyword */, _a.throw = 109 /* SyntaxKind.ThrowKeyword */, _a.true = 110 /* SyntaxKind.TrueKeyword */, _a.try = 111 /* SyntaxKind.TryKeyword */, - _a.type = 152 /* SyntaxKind.TypeKeyword */, + _a.type = 154 /* SyntaxKind.TypeKeyword */, _a.typeof = 112 /* SyntaxKind.TypeOfKeyword */, - _a.undefined = 153 /* SyntaxKind.UndefinedKeyword */, - _a.unique = 154 /* SyntaxKind.UniqueKeyword */, - _a.unknown = 155 /* SyntaxKind.UnknownKeyword */, + _a.undefined = 155 /* SyntaxKind.UndefinedKeyword */, + _a.unique = 156 /* SyntaxKind.UniqueKeyword */, + _a.unknown = 157 /* SyntaxKind.UnknownKeyword */, _a.var = 113 /* SyntaxKind.VarKeyword */, _a.void = 114 /* SyntaxKind.VoidKeyword */, _a.while = 115 /* SyntaxKind.WhileKeyword */, _a.with = 116 /* SyntaxKind.WithKeyword */, _a.yield = 125 /* SyntaxKind.YieldKeyword */, - _a.async = 131 /* SyntaxKind.AsyncKeyword */, - _a.await = 132 /* SyntaxKind.AwaitKeyword */, - _a.of = 160 /* SyntaxKind.OfKeyword */, + _a.async = 132 /* SyntaxKind.AsyncKeyword */, + _a.await = 133 /* SyntaxKind.AwaitKeyword */, + _a.of = 162 /* SyntaxKind.OfKeyword */, _a); var textToKeyword = new ts.Map(ts.getEntries(ts.textToKeywordObj)); var textToToken = new ts.Map(ts.getEntries(__assign(__assign({}, ts.textToKeywordObj), { "{": 18 /* SyntaxKind.OpenBraceToken */, "}": 19 /* SyntaxKind.CloseBraceToken */, "(": 20 /* SyntaxKind.OpenParenToken */, ")": 21 /* SyntaxKind.CloseParenToken */, "[": 22 /* SyntaxKind.OpenBracketToken */, "]": 23 /* SyntaxKind.CloseBracketToken */, ".": 24 /* SyntaxKind.DotToken */, "...": 25 /* SyntaxKind.DotDotDotToken */, ";": 26 /* SyntaxKind.SemicolonToken */, ",": 27 /* SyntaxKind.CommaToken */, "<": 29 /* SyntaxKind.LessThanToken */, ">": 31 /* SyntaxKind.GreaterThanToken */, "<=": 32 /* SyntaxKind.LessThanEqualsToken */, ">=": 33 /* SyntaxKind.GreaterThanEqualsToken */, "==": 34 /* SyntaxKind.EqualsEqualsToken */, "!=": 35 /* SyntaxKind.ExclamationEqualsToken */, "===": 36 /* SyntaxKind.EqualsEqualsEqualsToken */, "!==": 37 /* SyntaxKind.ExclamationEqualsEqualsToken */, "=>": 38 /* SyntaxKind.EqualsGreaterThanToken */, "+": 39 /* SyntaxKind.PlusToken */, "-": 40 /* SyntaxKind.MinusToken */, "**": 42 /* SyntaxKind.AsteriskAsteriskToken */, "*": 41 /* SyntaxKind.AsteriskToken */, "/": 43 /* SyntaxKind.SlashToken */, "%": 44 /* SyntaxKind.PercentToken */, "++": 45 /* SyntaxKind.PlusPlusToken */, "--": 46 /* SyntaxKind.MinusMinusToken */, "<<": 47 /* SyntaxKind.LessThanLessThanToken */, ">": 48 /* SyntaxKind.GreaterThanGreaterThanToken */, ">>>": 49 /* SyntaxKind.GreaterThanGreaterThanGreaterThanToken */, "&": 50 /* SyntaxKind.AmpersandToken */, "|": 51 /* SyntaxKind.BarToken */, "^": 52 /* SyntaxKind.CaretToken */, "!": 53 /* SyntaxKind.ExclamationToken */, "~": 54 /* SyntaxKind.TildeToken */, "&&": 55 /* SyntaxKind.AmpersandAmpersandToken */, "||": 56 /* SyntaxKind.BarBarToken */, "?": 57 /* SyntaxKind.QuestionToken */, "??": 60 /* SyntaxKind.QuestionQuestionToken */, "?.": 28 /* SyntaxKind.QuestionDotToken */, ":": 58 /* SyntaxKind.ColonToken */, "=": 63 /* SyntaxKind.EqualsToken */, "+=": 64 /* SyntaxKind.PlusEqualsToken */, "-=": 65 /* SyntaxKind.MinusEqualsToken */, "*=": 66 /* SyntaxKind.AsteriskEqualsToken */, "**=": 67 /* SyntaxKind.AsteriskAsteriskEqualsToken */, "/=": 68 /* SyntaxKind.SlashEqualsToken */, "%=": 69 /* SyntaxKind.PercentEqualsToken */, "<<=": 70 /* SyntaxKind.LessThanLessThanEqualsToken */, ">>=": 71 /* SyntaxKind.GreaterThanGreaterThanEqualsToken */, ">>>=": 72 /* SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 73 /* SyntaxKind.AmpersandEqualsToken */, "|=": 74 /* SyntaxKind.BarEqualsToken */, "^=": 78 /* SyntaxKind.CaretEqualsToken */, "||=": 75 /* SyntaxKind.BarBarEqualsToken */, "&&=": 76 /* SyntaxKind.AmpersandAmpersandEqualsToken */, "??=": 77 /* SyntaxKind.QuestionQuestionEqualsToken */, "@": 59 /* SyntaxKind.AtToken */, "#": 62 /* SyntaxKind.HashToken */, "`": 61 /* SyntaxKind.BacktickToken */ }))); @@ -10266,7 +10337,7 @@ var ts; ts.stringToToken = stringToToken; /* @internal */ function computeLineStarts(text) { - var result = new Array(); + var result = []; var pos = 0; var lineStart = 0; while (pos < text.length) { @@ -11292,7 +11363,7 @@ var ts; return -1; } function peekExtendedUnicodeEscape() { - if (languageVersion >= 2 /* ScriptTarget.ES2015 */ && codePointAt(text, pos + 1) === 117 /* CharacterCodes.u */ && codePointAt(text, pos + 2) === 123 /* CharacterCodes.openBrace */) { + if (codePointAt(text, pos + 1) === 117 /* CharacterCodes.u */ && codePointAt(text, pos + 2) === 123 /* CharacterCodes.openBrace */) { var start_2 = pos; pos += 3; var escapedValueString = scanMinimumNumberOfHexDigits(1, /*canHaveSeparators*/ false); @@ -11827,12 +11898,36 @@ var ts; pos++; return token = 0 /* SyntaxKind.Unknown */; } - if (isIdentifierStart(codePointAt(text, pos + 1), languageVersion)) { + var charAfterHash = codePointAt(text, pos + 1); + if (charAfterHash === 92 /* CharacterCodes.backslash */) { + pos++; + var extendedCookedChar_1 = peekExtendedUnicodeEscape(); + if (extendedCookedChar_1 >= 0 && isIdentifierStart(extendedCookedChar_1, languageVersion)) { + pos += 3; + tokenFlags |= 8 /* TokenFlags.ExtendedUnicodeEscape */; + tokenValue = "#" + scanExtendedUnicodeEscape() + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + var cookedChar_1 = peekUnicodeEscape(); + if (cookedChar_1 >= 0 && isIdentifierStart(cookedChar_1, languageVersion)) { + pos += 6; + tokenFlags |= 1024 /* TokenFlags.UnicodeEscape */; + tokenValue = "#" + String.fromCharCode(cookedChar_1) + scanIdentifierParts(); + return token = 80 /* SyntaxKind.PrivateIdentifier */; + } + pos--; + } + if (isIdentifierStart(charAfterHash, languageVersion)) { pos++; - scanIdentifier(codePointAt(text, pos), languageVersion); + // We're relying on scanIdentifier's behavior and adjusting the token kind after the fact. + // Notably absent from this block is the fact that calling a function named "scanIdentifier", + // but identifiers don't include '#', and that function doesn't deal with it at all. + // This works because 'scanIdentifier' tries to reuse source characters and builds up substrings; + // however, it starts at the 'tokenPos' which includes the '#', and will "accidentally" prepend the '#' for us. + scanIdentifier(charAfterHash, languageVersion); } else { - tokenValue = String.fromCharCode(codePointAt(text, pos)); + tokenValue = "#"; error(ts.Diagnostics.Invalid_character, pos++, charSize(ch)); } return token = 80 /* SyntaxKind.PrivateIdentifier */; @@ -12583,9 +12678,9 @@ var ts; } ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions; function getTypeParameterOwner(d) { - if (d && d.kind === 163 /* SyntaxKind.TypeParameter */) { + if (d && d.kind === 165 /* SyntaxKind.TypeParameter */) { for (var current = d; current; current = current.parent) { - if (isFunctionLike(current) || isClassLike(current) || current.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (isFunctionLike(current) || isClassLike(current) || current.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return current; } } @@ -12593,7 +12688,7 @@ var ts; } ts.getTypeParameterOwner = getTypeParameterOwner; function isParameterPropertyDeclaration(node, parent) { - return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 171 /* SyntaxKind.Constructor */; + return ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */) && parent.kind === 173 /* SyntaxKind.Constructor */; } ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration; function isEmptyBindingPattern(node) { @@ -12623,14 +12718,14 @@ var ts; node = walkUpBindingElementsAndPatterns(node); } var flags = getFlags(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */) { node = node.parent; } - if (node && node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node && node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { flags |= getFlags(node); node = node.parent; } - if (node && node.kind === 237 /* SyntaxKind.VariableStatement */) { + if (node && node.kind === 240 /* SyntaxKind.VariableStatement */) { flags |= getFlags(node); } return flags; @@ -12803,30 +12898,30 @@ var ts; } // Covers remaining cases (returning undefined if none match). switch (hostNode.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (hostNode.declarationList && hostNode.declarationList.declarations[0]) { return getDeclarationIdentifier(hostNode.declarationList.declarations[0]); } break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: var expr = hostNode.expression; - if (expr.kind === 221 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (expr.kind === 223 /* SyntaxKind.BinaryExpression */ && expr.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { expr = expr.left; } switch (expr.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return expr.name; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var arg = expr.argumentExpression; if (ts.isIdentifier(arg)) { return arg; } } break; - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { return getDeclarationIdentifier(hostNode.expression); } - case 250 /* SyntaxKind.LabeledStatement */: { + case 253 /* SyntaxKind.LabeledStatement */: { if (isDeclaration(hostNode.statement) || isExpression(hostNode.statement)) { return getDeclarationIdentifier(hostNode.statement); } @@ -12863,16 +12958,16 @@ var ts; switch (declaration.kind) { case 79 /* SyntaxKind.Identifier */: return declaration; - case 347 /* SyntaxKind.JSDocPropertyTag */: - case 340 /* SyntaxKind.JSDocParameterTag */: { + case 350 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: { var name = declaration.name; - if (name.kind === 161 /* SyntaxKind.QualifiedName */) { + if (name.kind === 163 /* SyntaxKind.QualifiedName */) { return name.right; } break; } - case 208 /* SyntaxKind.CallExpression */: - case 221 /* SyntaxKind.BinaryExpression */: { + case 210 /* SyntaxKind.CallExpression */: + case 223 /* SyntaxKind.BinaryExpression */: { var expr_1 = declaration; switch (ts.getAssignmentDeclarationKind(expr_1)) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -12888,15 +12983,15 @@ var ts; return undefined; } } - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return getNameOfJSDocTypedef(declaration); - case 339 /* SyntaxKind.JSDocEnumTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return nameForNamelessJSDocTypedef(declaration); - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { var expression = declaration.expression; return ts.isIdentifier(expression) ? expression : undefined; } - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = declaration; if (ts.isBindableStaticElementAccessExpression(expr)) { return expr.argumentExpression; @@ -12940,7 +13035,7 @@ var ts; } ts.getDecorators = getDecorators; function getModifiers(node) { - if (ts.hasSyntacticModifier(node, 125951 /* ModifierFlags.Modifier */)) { + if (ts.hasSyntacticModifier(node, 126975 /* ModifierFlags.Modifier */)) { return ts.filter(node.modifiers, isModifier); } } @@ -13201,12 +13296,12 @@ var ts; /** Gets the text of a jsdoc comment, flattening links to their text. */ function getTextOfJSDocComment(comment) { return typeof comment === "string" ? comment - : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 321 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); + : comment === null || comment === void 0 ? void 0 : comment.map(function (c) { return c.kind === 324 /* SyntaxKind.JSDocText */ ? c.text : formatJSDocLink(c); }).join(""); } ts.getTextOfJSDocComment = getTextOfJSDocComment; function formatJSDocLink(link) { - var kind = link.kind === 324 /* SyntaxKind.JSDocLink */ ? "link" - : link.kind === 325 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" + var kind = link.kind === 327 /* SyntaxKind.JSDocLink */ ? "link" + : link.kind === 328 /* SyntaxKind.JSDocLinkCode */ ? "linkcode" : "linkplain"; var name = link.name ? ts.entityNameToString(link.name) : ""; var space = link.name && link.text.startsWith("://") ? "" : " "; @@ -13227,7 +13322,7 @@ var ts; return ts.emptyArray; } if (ts.isJSDocTypeAlias(node)) { - ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDoc */); + ts.Debug.assert(node.parent.kind === 323 /* SyntaxKind.JSDoc */); return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; }); } if (node.typeParameters) { @@ -13262,7 +13357,7 @@ var ts; ts.isMemberName = isMemberName; /* @internal */ function isGetOrSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */ || node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */ || node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration; function isPropertyAccessChain(node) { @@ -13280,10 +13375,10 @@ var ts; function isOptionalChain(node) { var kind = node.kind; return !!(node.flags & 32 /* NodeFlags.OptionalChain */) && - (kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 207 /* SyntaxKind.ElementAccessExpression */ - || kind === 208 /* SyntaxKind.CallExpression */ - || kind === 230 /* SyntaxKind.NonNullExpression */); + (kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 209 /* SyntaxKind.ElementAccessExpression */ + || kind === 210 /* SyntaxKind.CallExpression */ + || kind === 232 /* SyntaxKind.NonNullExpression */); } ts.isOptionalChain = isOptionalChain; /* @internal */ @@ -13318,7 +13413,7 @@ var ts; } ts.isOutermostOptionalChain = isOutermostOptionalChain; function isNullishCoalesce(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */; } ts.isNullishCoalesce = isNullishCoalesce; function isConstTypeReference(node) { @@ -13335,17 +13430,17 @@ var ts; } ts.isNonNullChain = isNonNullChain; function isBreakOrContinueStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */ || node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */ || node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isBreakOrContinueStatement = isBreakOrContinueStatement; function isNamedExportBindings(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExportBindings = isNamedExportBindings; function isUnparsedTextLike(node) { switch (node.kind) { - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return true; default: return false; @@ -13354,12 +13449,12 @@ var ts; ts.isUnparsedTextLike = isUnparsedTextLike; function isUnparsedNode(node) { return isUnparsedTextLike(node) || - node.kind === 300 /* SyntaxKind.UnparsedPrologue */ || - node.kind === 304 /* SyntaxKind.UnparsedSyntheticReference */; + node.kind === 303 /* SyntaxKind.UnparsedPrologue */ || + node.kind === 307 /* SyntaxKind.UnparsedSyntheticReference */; } ts.isUnparsedNode = isUnparsedNode; function isJSDocPropertyLikeTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */ || node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag; // #endregion @@ -13375,7 +13470,7 @@ var ts; ts.isNode = isNode; /* @internal */ function isNodeKind(kind) { - return kind >= 161 /* SyntaxKind.FirstNode */; + return kind >= 163 /* SyntaxKind.FirstNode */; } ts.isNodeKind = isNodeKind; /** @@ -13384,7 +13479,7 @@ var ts; * Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail. */ function isTokenKind(kind) { - return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */; + return kind >= 0 /* SyntaxKind.FirstToken */ && kind <= 162 /* SyntaxKind.LastToken */; } ts.isTokenKind = isTokenKind; /** @@ -13399,7 +13494,7 @@ var ts; // Node Arrays /* @internal */ function isNodeArray(array) { - return array.hasOwnProperty("pos") && array.hasOwnProperty("end"); + return ts.hasProperty(array, "pos") && ts.hasProperty(array, "end"); } ts.isNodeArray = isNodeArray; // Literals @@ -13415,11 +13510,11 @@ var ts; /** @internal */ function isLiteralExpressionOfObject(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: return true; } return false; @@ -13447,13 +13542,13 @@ var ts; ts.isImportOrExportSpecifier = isImportOrExportSpecifier; function isTypeOnlyImportOrExportDeclaration(node) { switch (node.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return node.isTypeOnly || node.parent.parent.isTypeOnly; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.isTypeOnly; - case 267 /* SyntaxKind.ImportClause */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 270 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node.isTypeOnly; default: return false; @@ -13474,6 +13569,11 @@ var ts; return ts.isIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; } ts.isGeneratedIdentifier = isGeneratedIdentifier; + /* @internal */ + function isGeneratedPrivateIdentifier(node) { + return ts.isPrivateIdentifier(node) && (node.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) > 0 /* GeneratedIdentifierFlags.None */; + } + ts.isGeneratedPrivateIdentifier = isGeneratedPrivateIdentifier; // Private Identifiers /*@internal*/ function isPrivateIdentifierClassElementDeclaration(node) { @@ -13490,19 +13590,20 @@ var ts; function isModifierKind(token) { switch (token) { case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 101 /* SyntaxKind.InKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: return true; } return false; @@ -13515,7 +13616,10 @@ var ts; ts.isParameterPropertyModifier = isParameterPropertyModifier; /* @internal */ function isClassMemberModifier(idToken) { - return isParameterPropertyModifier(idToken) || idToken === 124 /* SyntaxKind.StaticKeyword */ || idToken === 159 /* SyntaxKind.OverrideKeyword */; + return isParameterPropertyModifier(idToken) || + idToken === 124 /* SyntaxKind.StaticKeyword */ || + idToken === 161 /* SyntaxKind.OverrideKeyword */ || + idToken === 127 /* SyntaxKind.AccessorKeyword */; } ts.isClassMemberModifier = isClassMemberModifier; function isModifier(node) { @@ -13524,7 +13628,7 @@ var ts; ts.isModifier = isModifier; function isEntityName(node) { var kind = node.kind; - return kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isEntityName = isEntityName; @@ -13534,14 +13638,14 @@ var ts; || kind === 80 /* SyntaxKind.PrivateIdentifier */ || kind === 10 /* SyntaxKind.StringLiteral */ || kind === 8 /* SyntaxKind.NumericLiteral */ - || kind === 162 /* SyntaxKind.ComputedPropertyName */; + || kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isPropertyName = isPropertyName; function isBindingName(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */ - || kind === 202 /* SyntaxKind.ArrayBindingPattern */; + || kind === 203 /* SyntaxKind.ObjectBindingPattern */ + || kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isBindingName = isBindingName; // Functions @@ -13566,13 +13670,13 @@ var ts; ts.isBooleanLiteral = isBooleanLiteral; function isFunctionLikeDeclarationKind(kind) { switch (kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: return false; @@ -13581,14 +13685,14 @@ var ts; /* @internal */ function isFunctionLikeKind(kind) { switch (kind) { - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; default: return isFunctionLikeDeclarationKind(kind); @@ -13603,36 +13707,53 @@ var ts; // Classes function isClassElement(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 234 /* SyntaxKind.SemicolonClassElement */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isClassElement = isClassElement; function isClassLike(node) { - return node && (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */); + return node && (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isClassLike = isClassLike; function isAccessor(node) { - return node && (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */); + return node && (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */); } ts.isAccessor = isAccessor; + function isAutoAccessorPropertyDeclaration(node) { + return ts.isPropertyDeclaration(node) && ts.hasAccessorModifier(node); + } + ts.isAutoAccessorPropertyDeclaration = isAutoAccessorPropertyDeclaration; /* @internal */ function isMethodOrAccessor(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; } } ts.isMethodOrAccessor = isMethodOrAccessor; + /* @internal */ + function isNamedClassElement(node) { + switch (node.kind) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return true; + default: + return false; + } + } + ts.isNamedClassElement = isNamedClassElement; // Type members function isModifierLike(node) { return isModifier(node) || ts.isDecorator(node); @@ -13640,13 +13761,13 @@ var ts; ts.isModifierLike = isModifierLike; function isTypeElement(node) { var kind = node.kind; - return kind === 175 /* SyntaxKind.ConstructSignature */ - || kind === 174 /* SyntaxKind.CallSignature */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 177 /* SyntaxKind.ConstructSignature */ + || kind === 176 /* SyntaxKind.CallSignature */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isTypeElement = isTypeElement; function isClassOrTypeElement(node) { @@ -13655,12 +13776,12 @@ var ts; ts.isClassOrTypeElement = isClassOrTypeElement; function isObjectLiteralElementLike(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 298 /* SyntaxKind.SpreadAssignment */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 301 /* SyntaxKind.SpreadAssignment */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.isObjectLiteralElementLike = isObjectLiteralElementLike; // Type @@ -13675,8 +13796,8 @@ var ts; ts.isTypeNode = isTypeNode; function isFunctionOrConstructorTypeNode(node) { switch (node.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return true; } return false; @@ -13687,8 +13808,8 @@ var ts; function isBindingPattern(node) { if (node) { var kind = node.kind; - return kind === 202 /* SyntaxKind.ArrayBindingPattern */ - || kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return kind === 204 /* SyntaxKind.ArrayBindingPattern */ + || kind === 203 /* SyntaxKind.ObjectBindingPattern */; } return false; } @@ -13696,15 +13817,15 @@ var ts; /* @internal */ function isAssignmentPattern(node) { var kind = node.kind; - return kind === 204 /* SyntaxKind.ArrayLiteralExpression */ - || kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return kind === 206 /* SyntaxKind.ArrayLiteralExpression */ + || kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isAssignmentPattern = isAssignmentPattern; /* @internal */ function isArrayBindingElement(node) { var kind = node.kind; - return kind === 203 /* SyntaxKind.BindingElement */ - || kind === 227 /* SyntaxKind.OmittedExpression */; + return kind === 205 /* SyntaxKind.BindingElement */ + || kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isArrayBindingElement = isArrayBindingElement; /** @@ -13713,9 +13834,9 @@ var ts; /* @internal */ function isDeclarationBindingElement(bindingElement) { switch (bindingElement.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: return true; } return false; @@ -13736,8 +13857,8 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentPattern(node) { switch (node.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return true; } return false; @@ -13746,10 +13867,10 @@ var ts; /* @internal */ function isObjectBindingOrAssignmentElement(node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty - case 298 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: // AssignmentProperty + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // AssignmentProperty + case 301 /* SyntaxKind.SpreadAssignment */: // AssignmentRestProperty return true; } return false; @@ -13761,8 +13882,8 @@ var ts; /* @internal */ function isArrayBindingOrAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return true; } return false; @@ -13771,26 +13892,26 @@ var ts; /* @internal */ function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */ - || kind === 200 /* SyntaxKind.ImportType */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */ + || kind === 202 /* SyntaxKind.ImportType */; } ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode; // Expression function isPropertyAccessOrQualifiedName(node) { var kind = node.kind; - return kind === 206 /* SyntaxKind.PropertyAccessExpression */ - || kind === 161 /* SyntaxKind.QualifiedName */; + return kind === 208 /* SyntaxKind.PropertyAccessExpression */ + || kind === 163 /* SyntaxKind.QualifiedName */; } ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName; function isCallLikeExpression(node) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: return true; default: return false; @@ -13798,12 +13919,12 @@ var ts; } ts.isCallLikeExpression = isCallLikeExpression; function isCallOrNewExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */ || node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */ || node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isCallOrNewExpression = isCallOrNewExpression; function isTemplateLiteral(node) { var kind = node.kind; - return kind === 223 /* SyntaxKind.TemplateExpression */ + return kind === 225 /* SyntaxKind.TemplateExpression */ || kind === 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */; } ts.isTemplateLiteral = isTemplateLiteral; @@ -13814,19 +13935,19 @@ var ts; ts.isLeftHandSideExpression = isLeftHandSideExpression; function isLeftHandSideExpressionKind(kind) { switch (kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: // technically this is only an Expression if it's in a `#field in expr` BinaryExpression case 13 /* SyntaxKind.RegularExpressionLiteral */: @@ -13834,15 +13955,15 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 110 /* SyntaxKind.TrueKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 230 /* SyntaxKind.NonNullExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 231 /* SyntaxKind.MetaProperty */: + case 232 /* SyntaxKind.NonNullExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 233 /* SyntaxKind.MetaProperty */: case 100 /* SyntaxKind.ImportKeyword */: // technically this is only an Expression if it's in a CallExpression return true; default: @@ -13856,13 +13977,13 @@ var ts; ts.isUnaryExpression = isUnaryExpression; function isUnaryExpressionKind(kind) { switch (kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return true; default: return isLeftHandSideExpressionKind(kind); @@ -13871,9 +13992,9 @@ var ts; /* @internal */ function isUnaryExpressionWithWrite(expr) { switch (expr.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; default: @@ -13892,15 +14013,16 @@ var ts; ts.isExpression = isExpression; function isExpressionKind(kind) { switch (kind) { - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 221 /* SyntaxKind.BinaryExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 229 /* SyntaxKind.AsExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 223 /* SyntaxKind.BinaryExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 231 /* SyntaxKind.AsExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return true; default: return isUnaryExpressionKind(kind); @@ -13908,8 +14030,8 @@ var ts; } function isAssertionExpression(node) { var kind = node.kind; - return kind === 211 /* SyntaxKind.TypeAssertionExpression */ - || kind === 229 /* SyntaxKind.AsExpression */; + return kind === 213 /* SyntaxKind.TypeAssertionExpression */ + || kind === 231 /* SyntaxKind.AsExpression */; } ts.isAssertionExpression = isAssertionExpression; /* @internal */ @@ -13920,13 +14042,13 @@ var ts; ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode; function isIterationStatement(node, lookInLabeledStatements) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return true; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements); } return false; @@ -13955,7 +14077,7 @@ var ts; ts.isExternalModuleIndicator = isExternalModuleIndicator; /* @internal */ function isForInOrOfStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */ || node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */ || node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForInOrOfStatement = isForInOrOfStatement; // Element @@ -13979,115 +14101,115 @@ var ts; /* @internal */ function isModuleBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleBody = isModuleBody; /* @internal */ function isNamespaceBody(node) { var kind = node.kind; - return kind === 262 /* SyntaxKind.ModuleBlock */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + return kind === 265 /* SyntaxKind.ModuleBlock */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isNamespaceBody = isNamespaceBody; /* @internal */ function isJSDocNamespaceBody(node) { var kind = node.kind; return kind === 79 /* SyntaxKind.Identifier */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */; + || kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isJSDocNamespaceBody = isJSDocNamespaceBody; /* @internal */ function isNamedImportBindings(node) { var kind = node.kind; - return kind === 269 /* SyntaxKind.NamedImports */ - || kind === 268 /* SyntaxKind.NamespaceImport */; + return kind === 272 /* SyntaxKind.NamedImports */ + || kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamedImportBindings = isNamedImportBindings; /* @internal */ function isModuleOrEnumDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration; function isDeclarationKind(kind) { - return kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 203 /* SyntaxKind.BindingElement */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 299 /* SyntaxKind.EnumMember */ - || kind === 275 /* SyntaxKind.ExportSpecifier */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 267 /* SyntaxKind.ImportClause */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 270 /* SyntaxKind.ImportSpecifier */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 268 /* SyntaxKind.NamespaceImport */ - || kind === 274 /* SyntaxKind.NamespaceExport */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 254 /* SyntaxKind.VariableDeclaration */ - || kind === 345 /* SyntaxKind.JSDocTypedefTag */ - || kind === 338 /* SyntaxKind.JSDocCallbackTag */ - || kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 205 /* SyntaxKind.BindingElement */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 302 /* SyntaxKind.EnumMember */ + || kind === 278 /* SyntaxKind.ExportSpecifier */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 270 /* SyntaxKind.ImportClause */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 273 /* SyntaxKind.ImportSpecifier */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 271 /* SyntaxKind.NamespaceImport */ + || kind === 277 /* SyntaxKind.NamespaceExport */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 257 /* SyntaxKind.VariableDeclaration */ + || kind === 348 /* SyntaxKind.JSDocTypedefTag */ + || kind === 341 /* SyntaxKind.JSDocCallbackTag */ + || kind === 350 /* SyntaxKind.JSDocPropertyTag */; } function isDeclarationStatementKind(kind) { - return kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } function isStatementKindButNotDeclarationKind(kind) { - return kind === 246 /* SyntaxKind.BreakStatement */ - || kind === 245 /* SyntaxKind.ContinueStatement */ - || kind === 253 /* SyntaxKind.DebuggerStatement */ - || kind === 240 /* SyntaxKind.DoStatement */ - || kind === 238 /* SyntaxKind.ExpressionStatement */ - || kind === 236 /* SyntaxKind.EmptyStatement */ - || kind === 243 /* SyntaxKind.ForInStatement */ - || kind === 244 /* SyntaxKind.ForOfStatement */ - || kind === 242 /* SyntaxKind.ForStatement */ - || kind === 239 /* SyntaxKind.IfStatement */ - || kind === 250 /* SyntaxKind.LabeledStatement */ - || kind === 247 /* SyntaxKind.ReturnStatement */ - || kind === 249 /* SyntaxKind.SwitchStatement */ - || kind === 251 /* SyntaxKind.ThrowStatement */ - || kind === 252 /* SyntaxKind.TryStatement */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 241 /* SyntaxKind.WhileStatement */ - || kind === 248 /* SyntaxKind.WithStatement */ - || kind === 349 /* SyntaxKind.NotEmittedStatement */ - || kind === 353 /* SyntaxKind.EndOfDeclarationMarker */ - || kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return kind === 249 /* SyntaxKind.BreakStatement */ + || kind === 248 /* SyntaxKind.ContinueStatement */ + || kind === 256 /* SyntaxKind.DebuggerStatement */ + || kind === 243 /* SyntaxKind.DoStatement */ + || kind === 241 /* SyntaxKind.ExpressionStatement */ + || kind === 239 /* SyntaxKind.EmptyStatement */ + || kind === 246 /* SyntaxKind.ForInStatement */ + || kind === 247 /* SyntaxKind.ForOfStatement */ + || kind === 245 /* SyntaxKind.ForStatement */ + || kind === 242 /* SyntaxKind.IfStatement */ + || kind === 253 /* SyntaxKind.LabeledStatement */ + || kind === 250 /* SyntaxKind.ReturnStatement */ + || kind === 252 /* SyntaxKind.SwitchStatement */ + || kind === 254 /* SyntaxKind.ThrowStatement */ + || kind === 255 /* SyntaxKind.TryStatement */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 244 /* SyntaxKind.WhileStatement */ + || kind === 251 /* SyntaxKind.WithStatement */ + || kind === 352 /* SyntaxKind.NotEmittedStatement */ + || kind === 356 /* SyntaxKind.EndOfDeclarationMarker */ + || kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } /* @internal */ function isDeclaration(node) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { - return (node.parent && node.parent.kind !== 344 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { + return (node.parent && node.parent.kind !== 347 /* SyntaxKind.JSDocTemplateTag */) || ts.isInJSFile(node); } return isDeclarationKind(node.kind); } @@ -14114,10 +14236,10 @@ var ts; } ts.isStatement = isStatement; function isBlockStatement(node) { - if (node.kind !== 235 /* SyntaxKind.Block */) + if (node.kind !== 238 /* SyntaxKind.Block */) return false; if (node.parent !== undefined) { - if (node.parent.kind === 252 /* SyntaxKind.TryStatement */ || node.parent.kind === 292 /* SyntaxKind.CatchClause */) { + if (node.parent.kind === 255 /* SyntaxKind.TryStatement */ || node.parent.kind === 295 /* SyntaxKind.CatchClause */) { return false; } } @@ -14131,15 +14253,15 @@ var ts; var kind = node.kind; return isStatementKindButNotDeclarationKind(kind) || isDeclarationStatementKind(kind) - || kind === 235 /* SyntaxKind.Block */; + || kind === 238 /* SyntaxKind.Block */; } ts.isStatementOrBlock = isStatementOrBlock; // Module references /* @internal */ function isModuleReference(node) { var kind = node.kind; - return kind === 277 /* SyntaxKind.ExternalModuleReference */ - || kind === 161 /* SyntaxKind.QualifiedName */ + return kind === 280 /* SyntaxKind.ExternalModuleReference */ + || kind === 163 /* SyntaxKind.QualifiedName */ || kind === 79 /* SyntaxKind.Identifier */; } ts.isModuleReference = isModuleReference; @@ -14149,58 +14271,58 @@ var ts; var kind = node.kind; return kind === 108 /* SyntaxKind.ThisKeyword */ || kind === 79 /* SyntaxKind.Identifier */ - || kind === 206 /* SyntaxKind.PropertyAccessExpression */; + || kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isJsxTagNameExpression = isJsxTagNameExpression; /* @internal */ function isJsxChild(node) { var kind = node.kind; - return kind === 278 /* SyntaxKind.JsxElement */ - || kind === 288 /* SyntaxKind.JsxExpression */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */ + return kind === 281 /* SyntaxKind.JsxElement */ + || kind === 291 /* SyntaxKind.JsxExpression */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || kind === 11 /* SyntaxKind.JsxText */ - || kind === 282 /* SyntaxKind.JsxFragment */; + || kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxChild = isJsxChild; /* @internal */ function isJsxAttributeLike(node) { var kind = node.kind; - return kind === 285 /* SyntaxKind.JsxAttribute */ - || kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return kind === 288 /* SyntaxKind.JsxAttribute */ + || kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxAttributeLike = isJsxAttributeLike; /* @internal */ function isStringLiteralOrJsxExpression(node) { var kind = node.kind; return kind === 10 /* SyntaxKind.StringLiteral */ - || kind === 288 /* SyntaxKind.JsxExpression */; + || kind === 291 /* SyntaxKind.JsxExpression */; } ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression; function isJsxOpeningLikeElement(node) { var kind = node.kind; - return kind === 280 /* SyntaxKind.JsxOpeningElement */ - || kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return kind === 283 /* SyntaxKind.JsxOpeningElement */ + || kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement; // Clauses function isCaseOrDefaultClause(node) { var kind = node.kind; - return kind === 289 /* SyntaxKind.CaseClause */ - || kind === 290 /* SyntaxKind.DefaultClause */; + return kind === 292 /* SyntaxKind.CaseClause */ + || kind === 293 /* SyntaxKind.DefaultClause */; } ts.isCaseOrDefaultClause = isCaseOrDefaultClause; // JSDoc /** True if node is of some JSDoc syntax kind. */ /* @internal */ function isJSDocNode(node) { - return node.kind >= 309 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocNode */; + return node.kind >= 312 /* SyntaxKind.FirstJSDocNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocNode */; } ts.isJSDocNode = isJSDocNode; /** True if node is of a kind that may contain comment text. */ function isJSDocCommentContainingNode(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */ - || node.kind === 319 /* SyntaxKind.JSDocNamepathType */ - || node.kind === 321 /* SyntaxKind.JSDocText */ + return node.kind === 323 /* SyntaxKind.JSDoc */ + || node.kind === 322 /* SyntaxKind.JSDocNamepathType */ + || node.kind === 324 /* SyntaxKind.JSDocText */ || isJSDocLinkLike(node) || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) @@ -14210,15 +14332,15 @@ var ts; // TODO: determine what this does before making it public. /* @internal */ function isJSDocTag(node) { - return node.kind >= 327 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 347 /* SyntaxKind.LastJSDocTagNode */; + return node.kind >= 330 /* SyntaxKind.FirstJSDocTagNode */ && node.kind <= 350 /* SyntaxKind.LastJSDocTagNode */; } ts.isJSDocTag = isJSDocTag; function isSetAccessor(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessor = isSetAccessor; function isGetAccessor(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessor = isGetAccessor; /** True if has jsdoc nodes attached to it. */ @@ -14244,12 +14366,12 @@ var ts; /** True if has initializer node attached to it. */ function hasOnlyExpressionInitializer(node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 299 /* SyntaxKind.EnumMember */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 302 /* SyntaxKind.EnumMember */: return true; default: return false; @@ -14257,12 +14379,12 @@ var ts; } ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer; function isObjectLiteralElement(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */ || node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); + return node.kind === 288 /* SyntaxKind.JsxAttribute */ || node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */ || isObjectLiteralElementLike(node); } ts.isObjectLiteralElement = isObjectLiteralElement; /* @internal */ function isTypeReferenceType(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isTypeReferenceType = isTypeReferenceType; var MAX_SMI_X86 = 1073741823; @@ -14295,7 +14417,7 @@ var ts; } ts.isStringLiteralLike = isStringLiteralLike; function isJSDocLinkLike(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */ || node.kind === 325 /* SyntaxKind.JSDocLinkCode */ || node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 327 /* SyntaxKind.JSDocLink */ || node.kind === 328 /* SyntaxKind.JSDocLinkCode */ || node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkLike = isJSDocLinkLike; function hasRestParameter(s) { @@ -14305,7 +14427,7 @@ var ts; ts.hasRestParameter = hasRestParameter; function isRestParameter(node) { var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type; - return node.dotDotDotToken !== undefined || !!type && type.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.dotDotDotToken !== undefined || !!type && type.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isRestParameter = isRestParameter; // #endregion @@ -14563,7 +14685,7 @@ var ts; } } function getSourceFileOfNode(node) { - while (node && node.kind !== 305 /* SyntaxKind.SourceFile */) { + while (node && node.kind !== 308 /* SyntaxKind.SourceFile */) { node = node.parent; } return node; @@ -14579,11 +14701,11 @@ var ts; ts.isPlainJsFile = isPlainJsFile; function isStatementWithLocals(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return true; } return false; @@ -14779,7 +14901,7 @@ var ts; // the syntax list itself considers them as normal trivia. Therefore if we simply skip // trivia for the list, we may have skipped the JSDocComment as well. So we should process its // first child to determine the actual position of its first token. - if (node.kind === 348 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { + if (node.kind === 351 /* SyntaxKind.SyntaxList */ && node._children.length > 0) { return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc); } return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos, @@ -14844,7 +14966,6 @@ var ts; return emitNode && emitNode.flags || 0; } ts.getEmitFlags = getEmitFlags; - ; function getScriptTargetFeatures() { return { es2015: { @@ -15017,7 +15138,7 @@ var ts; ts.isBlockOrCatchScoped = isBlockOrCatchScoped; function isCatchClauseVariableDeclarationOrBindingElement(declaration) { var node = getRootDeclaration(declaration); - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement; function isAmbientModule(node) { @@ -15049,11 +15170,11 @@ var ts; ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol; function isShorthandAmbientModule(node) { // The only kind of module that can be missing a body is a shorthand ambient module. - return !!node && node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && (!node.body); + return !!node && node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && (!node.body); } function isBlockScopedContainerTopLevel(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 261 /* SyntaxKind.ModuleDeclaration */ || + return node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 264 /* SyntaxKind.ModuleDeclaration */ || ts.isFunctionLikeOrClassStaticBlockDeclaration(node); } ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel; @@ -15070,9 +15191,9 @@ var ts; // - defined in the top level scope and source file is an external module // - defined inside ambient module declaration located in the top level scope and source file not an external module switch (node.parent.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return ts.isExternalModule(node.parent); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent); } return false; @@ -15127,26 +15248,30 @@ var ts; return false; } ts.isEffectiveStrictModeSourceFile = isEffectiveStrictModeSourceFile; + function isAmbientPropertyDeclaration(node) { + return !!(node.flags & 16777216 /* NodeFlags.Ambient */) || hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); + } + ts.isAmbientPropertyDeclaration = isAmbientPropertyDeclaration; function isBlockScope(node, parentNode) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 292 /* SyntaxKind.CatchClause */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // function block is not considered block-scope container // see comment in binder.ts: bind(...), case for SyntaxKind.Block return !ts.isFunctionLikeOrClassStaticBlockDeclaration(parentNode); @@ -15156,9 +15281,9 @@ var ts; ts.isBlockScope = isBlockScope; function isDeclarationWithTypeParameters(node) { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 323 /* SyntaxKind.JSDocSignature */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 326 /* SyntaxKind.JSDocSignature */: return true; default: ts.assertType(node); @@ -15168,25 +15293,25 @@ var ts; ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters; function isDeclarationWithTypeParameterChildren(node) { switch (node.kind) { - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; default: ts.assertType(node); @@ -15196,8 +15321,8 @@ var ts; ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren; function isAnyImportSyntax(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return true; default: return false; @@ -15210,15 +15335,15 @@ var ts; ts.isAnyImportOrBareOrAccessedRequire = isAnyImportOrBareOrAccessedRequire; function isLateVisibilityPaintedStatement(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return true; default: return false; @@ -15259,19 +15384,19 @@ var ts; } ts.getNameFromIndexInfo = getNameFromIndexInfo; function isComputedNonLiteralName(name) { - return name.kind === 162 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); + return name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && !isStringOrNumericLiteralLike(name.expression); } ts.isComputedNonLiteralName = isComputedNonLiteralName; function tryGetTextOfPropertyName(name) { switch (name.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - return name.escapedText; + return name.autoGenerateFlags ? undefined : name.escapedText; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: if (isStringOrNumericLiteralLike(name.expression)) return ts.escapeLeadingUnderscores(name.expression.text); return undefined; @@ -15291,16 +15416,16 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: case 79 /* SyntaxKind.Identifier */: return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return entityNameToString(name.left) + "." + entityNameToString(name.right); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (ts.isIdentifier(name.name) || ts.isPrivateIdentifier(name.name)) { return entityNameToString(name.expression) + "." + entityNameToString(name.name); } else { return ts.Debug.assertNever(name.name); } - case 311 /* SyntaxKind.JSDocMemberName */: + case 314 /* SyntaxKind.JSDocMemberName */: return entityNameToString(name.left) + entityNameToString(name.right); default: return ts.Debug.assertNever(name); @@ -15390,7 +15515,7 @@ var ts; ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition; function getErrorSpanForArrowFunction(sourceFile, node) { var pos = ts.skipTrivia(sourceFile.text, node.pos); - if (node.body && node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body && node.body.kind === 238 /* SyntaxKind.Block */) { var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line; var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line; if (startLine < endLine) { @@ -15404,7 +15529,7 @@ var ts; function getErrorSpanForNode(sourceFile, node) { var errorNode = node; switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false); if (pos_1 === sourceFile.text.length) { // file is empty - return span for the beginning of the file @@ -15413,29 +15538,29 @@ var ts; return getSpanOfTokenAtPosition(sourceFile, pos_1); // This list is a work in progress. Add missing node kinds to improve their error // spans. - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 268 /* SyntaxKind.NamespaceImport */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 271 /* SyntaxKind.NamespaceImport */: errorNode = node.name; break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return getErrorSpanForArrowFunction(sourceFile, node); - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: var start = ts.skipTrivia(sourceFile.text, node.pos); var end = node.statements.length > 0 ? node.statements[0].pos : node.end; return ts.createTextSpanFromBounds(start, end); @@ -15487,11 +15612,11 @@ var ts; } ts.isLet = isLet; function isSuperCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperCall = isSuperCall; function isImportCall(n) { - return n.kind === 208 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; + return n.kind === 210 /* SyntaxKind.CallExpression */ && n.expression.kind === 100 /* SyntaxKind.ImportKeyword */; } ts.isImportCall = isImportCall; function isImportMeta(n) { @@ -15505,7 +15630,7 @@ var ts; } ts.isLiteralImportTypeNode = isLiteralImportTypeNode; function isPrologueDirective(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */ + return node.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.expression.kind === 10 /* SyntaxKind.StringLiteral */; } ts.isPrologueDirective = isPrologueDirective; @@ -15533,13 +15658,13 @@ var ts; } ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode; function getJSDocCommentRanges(node, text) { - var commentRanges = (node.kind === 164 /* SyntaxKind.Parameter */ || - node.kind === 163 /* SyntaxKind.TypeParameter */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 214 /* SyntaxKind.ArrowFunction */ || - node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - node.kind === 254 /* SyntaxKind.VariableDeclaration */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */) ? + var commentRanges = (node.kind === 166 /* SyntaxKind.Parameter */ || + node.kind === 165 /* SyntaxKind.TypeParameter */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 216 /* SyntaxKind.ArrowFunction */ || + node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + node.kind === 257 /* SyntaxKind.VariableDeclaration */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */) ? ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) : ts.getLeadingCommentRanges(text, node.pos); // True if the comment starts with '/**' but not if it is '/**/' @@ -15555,48 +15680,48 @@ var ts; ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*/; var defaultLibReferenceRegEx = /^(\/\/\/\s*/; function isPartOfTypeNode(node) { - if (177 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= node.kind && node.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return true; case 114 /* SyntaxKind.VoidKeyword */: - return node.parent.kind !== 217 /* SyntaxKind.VoidExpression */; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + return node.parent.kind !== 219 /* SyntaxKind.VoidExpression */; + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(node.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(node); - case 163 /* SyntaxKind.TypeParameter */: - return node.parent.kind === 195 /* SyntaxKind.MappedType */ || node.parent.kind === 190 /* SyntaxKind.InferType */; + case 165 /* SyntaxKind.TypeParameter */: + return node.parent.kind === 197 /* SyntaxKind.MappedType */ || node.parent.kind === 192 /* SyntaxKind.InferType */; // Identifiers and qualified names may be type nodes, depending on their context. Climb // above them to find the lowest container case 79 /* SyntaxKind.Identifier */: // If the identifier is the RHS of a qualified name, then it's a type iff its parent is. - if (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { + if (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) { node = node.parent; } - else if (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { + else if (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node) { node = node.parent; } // At this point, node is either a qualified name or an identifier - ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); + ts.Debug.assert(node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'."); // falls through - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: case 108 /* SyntaxKind.ThisKeyword */: { var parent = node.parent; - if (parent.kind === 181 /* SyntaxKind.TypeQuery */) { + if (parent.kind === 183 /* SyntaxKind.TypeQuery */) { return false; } - if (parent.kind === 200 /* SyntaxKind.ImportType */) { + if (parent.kind === 202 /* SyntaxKind.ImportType */) { return !parent.isTypeOf; } // Do not recursively call isPartOfTypeNode on the parent. In the example: @@ -15605,40 +15730,40 @@ var ts; // // Calling isPartOfTypeNode would consider the qualified name A.B a type node. // Only C and A.B.C are type nodes. - if (177 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (179 /* SyntaxKind.FirstTypeNode */ <= parent.kind && parent.kind <= 202 /* SyntaxKind.LastTypeNode */) { return true; } switch (parent.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return ts.isHeritageClause(parent.parent) && !isExpressionWithTypeArgumentsInClassExtendsClause(parent); - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return node === parent.constraint; - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return node === parent.constraint; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return node === parent.type; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return node === parent.type; - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return node === parent.type; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return node === parent.type; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.contains(parent.typeArguments, node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // TODO (drosen): TaggedTemplateExpressions may eventually support type arguments. return false; } @@ -15663,23 +15788,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitor(node); - case 263 /* SyntaxKind.CaseBlock */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 266 /* SyntaxKind.CaseBlock */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return ts.forEachChild(node, traverse); } } @@ -15689,23 +15814,23 @@ var ts; return traverse(body); function traverse(node) { switch (node.kind) { - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: visitor(node); var operand = node.expression; if (operand) { traverse(operand); } return; - case 260 /* SyntaxKind.EnumDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // These are not allowed inside a generator now, but eventually they may be allowed // as local types. Regardless, skip them to avoid the work. return; default: if (ts.isFunctionLike(node)) { - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Note that we will not include methods/accessors of a class because they would require // first descending into the class. This is by design. traverse(node.name.expression); @@ -15728,10 +15853,10 @@ var ts; * @param node The type node. */ function getRestParameterElementType(node) { - if (node && node.kind === 183 /* SyntaxKind.ArrayType */) { + if (node && node.kind === 185 /* SyntaxKind.ArrayType */) { return node.elementType; } - else if (node && node.kind === 178 /* SyntaxKind.TypeReference */) { + else if (node && node.kind === 180 /* SyntaxKind.TypeReference */) { return ts.singleOrUndefined(node.typeArguments); } else { @@ -15741,12 +15866,12 @@ var ts; ts.getRestParameterElementType = getRestParameterElementType; function getMembersOfDeclaration(node) { switch (node.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 182 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 184 /* SyntaxKind.TypeLiteral */: return node.members; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return node.properties; } } @@ -15754,14 +15879,14 @@ var ts; function isVariableLike(node) { if (node) { switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 299 /* SyntaxKind.EnumMember */: - case 164 /* SyntaxKind.Parameter */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 302 /* SyntaxKind.EnumMember */: + case 166 /* SyntaxKind.Parameter */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } } @@ -15773,8 +15898,8 @@ var ts; } ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor; function isVariableDeclarationInVariableStatement(node) { - return node.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */ - && node.parent.parent.kind === 237 /* SyntaxKind.VariableStatement */; + return node.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */ + && node.parent.parent.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement; function isCommonJsExportedExpression(node) { @@ -15798,13 +15923,13 @@ var ts; ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration; function introducesArgumentsExoticObject(node) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return true; } return false; @@ -15815,7 +15940,7 @@ var ts; if (beforeUnwrapLabelCallback) { beforeUnwrapLabelCallback(node); } - if (node.statement.kind !== 250 /* SyntaxKind.LabeledStatement */) { + if (node.statement.kind !== 253 /* SyntaxKind.LabeledStatement */) { return node.statement; } node = node.statement; @@ -15823,17 +15948,17 @@ var ts; } ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel; function isFunctionBlock(node) { - return node && node.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); + return node && node.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(node.parent); } ts.isFunctionBlock = isFunctionBlock; function isObjectLiteralMethod(node) { - return node && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralMethod = isObjectLiteralMethod; function isObjectLiteralOrClassExpressionMethodOrAccessor(node) { - return (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) && - (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || - node.parent.kind === 226 /* SyntaxKind.ClassExpression */); + return (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) && + (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || + node.parent.kind === 228 /* SyntaxKind.ClassExpression */); } ts.isObjectLiteralOrClassExpressionMethodOrAccessor = isObjectLiteralOrClassExpressionMethodOrAccessor; function isIdentifierTypePredicate(predicate) { @@ -15846,7 +15971,7 @@ var ts; ts.isThisTypePredicate = isThisTypePredicate; function getPropertyAssignment(objectLiteral, key, key2) { return objectLiteral.properties.filter(function (property) { - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */) { var propName = tryGetTextOfPropertyName(property.name); return key === propName || (!!key2 && key2 === propName); } @@ -15908,14 +16033,14 @@ var ts; } ts.getContainingFunctionOrClassStaticBlock = getContainingFunctionOrClassStaticBlock; function getThisContainer(node, includeArrowFunctions) { - ts.Debug.assert(node.kind !== 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(node.kind !== 308 /* SyntaxKind.SourceFile */); while (true) { node = node.parent; if (!node) { return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that. } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: // If the grandparent node is an object literal (as opposed to a class), // then the computed property is not a 'this' container. // A computed property name in a class needs to be a this container @@ -15930,9 +16055,9 @@ var ts; // the *body* of the container. node = node.parent; break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -15943,27 +16068,27 @@ var ts; node = node.parent; } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: if (!includeArrowFunctions) { continue; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 305 /* SyntaxKind.SourceFile */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 308 /* SyntaxKind.SourceFile */: return node; } } @@ -15976,17 +16101,17 @@ var ts; switch (node.kind) { // Arrow functions use the same scope, but may do so in a "delayed" manner // For example, `const getThis = () => this` may be before a super() call in a derived constructor - case 214 /* SyntaxKind.ArrowFunction */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Object properties can have computed names; only method-like bodies start a new scope return true; default: @@ -16010,9 +16135,9 @@ var ts; var container = getThisContainer(node, /*includeArrowFunctions*/ false); if (container) { switch (container.kind) { - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: return container; } } @@ -16034,28 +16159,28 @@ var ts; return node; } switch (node.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: node = node.parent; break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (!stopOnFunctions) { continue; } // falls through - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return node; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are always applied outside of the body of a class or method. - if (node.parent.kind === 164 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { + if (node.parent.kind === 166 /* SyntaxKind.Parameter */ && ts.isClassElement(node.parent.parent)) { // If the decorator's parent is a Parameter, we resolve the this container from // the grandparent class declaration. node = node.parent.parent; @@ -16071,14 +16196,14 @@ var ts; } ts.getSuperContainer = getSuperContainer; function getImmediatelyInvokedFunctionExpression(func) { - if (func.kind === 213 /* SyntaxKind.FunctionExpression */ || func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 215 /* SyntaxKind.FunctionExpression */ || func.kind === 216 /* SyntaxKind.ArrowFunction */) { var prev = func; var parent = func.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { prev = parent; parent = parent.parent; } - if (parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === prev) { + if (parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === prev) { return parent; } } @@ -16094,7 +16219,7 @@ var ts; */ function isSuperProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */; } ts.isSuperProperty = isSuperProperty; @@ -16103,7 +16228,7 @@ var ts; */ function isThisProperty(node) { var kind = node.kind; - return (kind === 206 /* SyntaxKind.PropertyAccessExpression */ || kind === 207 /* SyntaxKind.ElementAccessExpression */) + return (kind === 208 /* SyntaxKind.PropertyAccessExpression */ || kind === 209 /* SyntaxKind.ElementAccessExpression */) && node.expression.kind === 108 /* SyntaxKind.ThisKeyword */; } ts.isThisProperty = isThisProperty; @@ -16122,15 +16247,15 @@ var ts; ts.isThisInitializedObjectBindingExpression = isThisInitializedObjectBindingExpression; function getEntityNameFromTypeNode(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return isEntityNameExpression(node.expression) ? node.expression : undefined; // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return node; } return undefined; @@ -16138,10 +16263,10 @@ var ts; ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode; function getInvokedExpression(node) { switch (node.kind) { - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return node.tag; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return node.tagName; default: return node.expression; @@ -16154,25 +16279,25 @@ var ts; return false; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // classes are valid targets return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // property declarations are valid if their parent is a class declaration. - return parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + return parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: // if this method has a body and its parent is a class declaration, this is a valid target. return node.body !== undefined - && parent.kind === 257 /* SyntaxKind.ClassDeclaration */; - case 164 /* SyntaxKind.Parameter */: + && parent.kind === 260 /* SyntaxKind.ClassDeclaration */; + case 166 /* SyntaxKind.Parameter */: // if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target; return parent.body !== undefined - && (parent.kind === 171 /* SyntaxKind.Constructor */ - || parent.kind === 169 /* SyntaxKind.MethodDeclaration */ - || parent.kind === 173 /* SyntaxKind.SetAccessor */) - && grandparent.kind === 257 /* SyntaxKind.ClassDeclaration */; + && (parent.kind === 173 /* SyntaxKind.Constructor */ + || parent.kind === 171 /* SyntaxKind.MethodDeclaration */ + || parent.kind === 175 /* SyntaxKind.SetAccessor */) + && grandparent.kind === 260 /* SyntaxKind.ClassDeclaration */; } return false; } @@ -16188,11 +16313,11 @@ var ts; ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated; function childIsDecorated(node, parent) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217 - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217 default: return false; @@ -16208,9 +16333,9 @@ var ts; ts.classOrConstructorParameterIsDecorated = classOrConstructorParameterIsDecorated; function isJSXTagName(node) { var parent = node.parent; - if (parent.kind === 280 /* SyntaxKind.JsxOpeningElement */ || - parent.kind === 279 /* SyntaxKind.JsxSelfClosingElement */ || - parent.kind === 281 /* SyntaxKind.JsxClosingElement */) { + if (parent.kind === 283 /* SyntaxKind.JsxOpeningElement */ || + parent.kind === 282 /* SyntaxKind.JsxSelfClosingElement */ || + parent.kind === 284 /* SyntaxKind.JsxClosingElement */) { return parent.tagName === node; } return false; @@ -16223,53 +16348,54 @@ var ts; case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 221 /* SyntaxKind.BinaryExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 223 /* SyntaxKind.TemplateExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: - case 224 /* SyntaxKind.YieldExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 225 /* SyntaxKind.TemplateExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: + case 226 /* SyntaxKind.YieldExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 233 /* SyntaxKind.MetaProperty */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return !ts.isHeritageClause(node.parent); - case 161 /* SyntaxKind.QualifiedName */: - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + case 163 /* SyntaxKind.QualifiedName */: + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); - case 311 /* SyntaxKind.JSDocMemberName */: + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + case 314 /* SyntaxKind.JSDocMemberName */: while (ts.isJSDocMemberName(node.parent)) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node); case 80 /* SyntaxKind.PrivateIdentifier */: return ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; case 79 /* SyntaxKind.Identifier */: - if (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { + if (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ || ts.isJSDocLinkLike(node.parent) || ts.isJSDocNameReference(node.parent) || ts.isJSDocMemberName(node.parent) || isJSXTagName(node)) { return true; } // falls through @@ -16287,60 +16413,62 @@ var ts; function isInExpressionContext(node) { var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: return parent.initializer === node; - case 238 /* SyntaxKind.ExpressionStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 289 /* SyntaxKind.CaseClause */: - case 251 /* SyntaxKind.ThrowStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 292 /* SyntaxKind.CaseClause */: + case 254 /* SyntaxKind.ThrowStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: var forStatement = parent; - return (forStatement.initializer === node && forStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forStatement.initializer === node && forStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forStatement.condition === node || forStatement.incrementor === node; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var forInStatement = parent; - return (forInStatement.initializer === node && forInStatement.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) || + return (forInStatement.initializer === node && forInStatement.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) || forInStatement.expression === node; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return node === parent.expression; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node === parent.expression; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return node === parent.expression; - case 165 /* SyntaxKind.Decorator */: - case 288 /* SyntaxKind.JsxExpression */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 167 /* SyntaxKind.Decorator */: + case 291 /* SyntaxKind.JsxExpression */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 301 /* SyntaxKind.SpreadAssignment */: return true; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return parent.expression === node && !isPartOfTypeNode(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return parent.objectAssignmentInitializer === node; + case 235 /* SyntaxKind.SatisfiesExpression */: + return node === parent.expression; default: return isExpressionNode(parent); } } ts.isInExpressionContext = isInExpressionContext; function isPartOfTypeQuery(node) { - while (node.kind === 161 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { + while (node.kind === 163 /* SyntaxKind.QualifiedName */ || node.kind === 79 /* SyntaxKind.Identifier */) { node = node.parent; } - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isPartOfTypeQuery = isPartOfTypeQuery; function isNamespaceReexportDeclaration(node) { @@ -16348,7 +16476,7 @@ var ts; } ts.isNamespaceReexportDeclaration = isNamespaceReexportDeclaration; function isExternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration; function getExternalModuleImportEqualsDeclarationExpression(node) { @@ -16361,7 +16489,7 @@ var ts; } ts.getExternalModuleRequireArgument = getExternalModuleRequireArgument; function isInternalModuleImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */; } ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration; function isSourceFileJS(file) { @@ -16393,11 +16521,11 @@ var ts; ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && node.typeArguments && node.typeArguments.length === 2 && - (node.typeArguments[0].kind === 150 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 147 /* SyntaxKind.NumberKeyword */); + (node.typeArguments[0].kind === 152 /* SyntaxKind.StringKeyword */ || node.typeArguments[0].kind === 148 /* SyntaxKind.NumberKeyword */); } ts.isJSDocIndexSignature = isJSDocIndexSignature; function isRequireCall(callExpression, requireStringLiteralLikeArgument) { - if (callExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (callExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var _a = callExpression, expression = _a.expression, args = _a.arguments; @@ -16506,11 +16634,11 @@ var ts; function getExpandoInitializer(initializer, isPrototypeAssignment) { if (ts.isCallExpression(initializer)) { var e = skipParentheses(initializer.expression); - return e.kind === 213 /* SyntaxKind.FunctionExpression */ || e.kind === 214 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; + return e.kind === 215 /* SyntaxKind.FunctionExpression */ || e.kind === 216 /* SyntaxKind.ArrowFunction */ ? initializer : undefined; } - if (initializer.kind === 213 /* SyntaxKind.FunctionExpression */ || - initializer.kind === 226 /* SyntaxKind.ClassExpression */ || - initializer.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (initializer.kind === 215 /* SyntaxKind.FunctionExpression */ || + initializer.kind === 228 /* SyntaxKind.ClassExpression */ || + initializer.kind === 216 /* SyntaxKind.ArrowFunction */) { return initializer; } if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) { @@ -16756,7 +16884,7 @@ var ts; ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment; function isSpecialPropertyDeclaration(expr) { return isInJSFile(expr) && - expr.parent && expr.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + expr.parent && expr.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && (!ts.isElementAccessExpression(expr) || isLiteralLikeElementAccess(expr)) && !!ts.getJSDocTypeTag(expr.parent); } @@ -16777,17 +16905,17 @@ var ts; return false; } var decl = symbol.valueDeclaration; - return decl.kind === 256 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); + return decl.kind === 259 /* SyntaxKind.FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer); } ts.isFunctionSymbol = isFunctionSymbol; function tryGetModuleSpecifierFromDeclaration(node) { var _a, _b; switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return (_a = ts.findAncestor(node.initializer, function (node) { return isRequireCall(node, /*requireStringLiteralLikeArgument*/ true); })) === null || _a === void 0 ? void 0 : _a.arguments[0]; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return ts.tryCast(node.moduleSpecifier, ts.isStringLiteralLike); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.tryCast((_b = ts.tryCast(node.moduleReference, ts.isExternalModuleReference)) === null || _b === void 0 ? void 0 : _b.expression, ts.isStringLiteralLike); default: ts.Debug.assertNever(node); @@ -16800,14 +16928,14 @@ var ts; ts.importFromModuleSpecifier = importFromModuleSpecifier; function tryGetImportFromModuleSpecifier(node) { switch (node.parent.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.parent; - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return node.parent.parent; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return isImportCall(node.parent) || isRequireCall(node.parent, /*checkArg*/ false) ? node.parent : undefined; - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: ts.Debug.assert(ts.isStringLiteral(node)); return ts.tryCast(node.parent.parent, ts.isImportTypeNode); default: @@ -16817,16 +16945,16 @@ var ts; ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier; function getExternalModuleName(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; - case 200 /* SyntaxKind.ImportType */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + return node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */ ? node.moduleReference.expression : undefined; + case 202 /* SyntaxKind.ImportType */: return isLiteralImportTypeNode(node) ? node.argument.literal : undefined; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return node.arguments[0]; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return node.name.kind === 10 /* SyntaxKind.StringLiteral */ ? node.name : undefined; default: return ts.Debug.assertNever(node); @@ -16835,11 +16963,11 @@ var ts; ts.getExternalModuleName = getExternalModuleName; function getNamespaceDeclarationNode(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return node.exportClause && ts.tryCast(node.exportClause, ts.isNamespaceExport); default: return ts.Debug.assertNever(node); @@ -16847,7 +16975,7 @@ var ts; } ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode; function isDefaultImport(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */ && !!node.importClause && !!node.importClause.name; } ts.isDefaultImport = isDefaultImport; function forEachImportClauseDeclaration(node, action) { @@ -16868,13 +16996,13 @@ var ts; function hasQuestionToken(node) { if (node) { switch (node.kind) { - case 164 /* SyntaxKind.Parameter */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 166 /* SyntaxKind.Parameter */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return node.questionToken !== undefined; } } @@ -16888,7 +17016,7 @@ var ts; } ts.isJSDocConstructSignature = isJSDocConstructSignature; function isJSDocTypeAlias(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 338 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */ || node.kind === 341 /* SyntaxKind.JSDocCallbackTag */ || node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocTypeAlias = isJSDocTypeAlias; function isTypeAlias(node) { @@ -16913,12 +17041,12 @@ var ts; } function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: var v = getSingleVariableOfVariableStatement(node); return v && v.initializer; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return node.initializer; } } @@ -16930,7 +17058,7 @@ var ts; function getNestedModuleDeclaration(node) { return ts.isModuleDeclaration(node) && node.body && - node.body.kind === 261 /* SyntaxKind.ModuleDeclaration */ + node.body.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? node.body : undefined; } @@ -16945,11 +17073,11 @@ var ts; if (ts.hasJSDocNodes(node)) { result = ts.addRange(result, filterOwnedJSDocTags(hostNode, ts.last(node.jsDoc))); } - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocParameterTagsNoCache : ts.getJSDocParameterTags)(node)); break; } - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { result = ts.addRange(result, (noCache ? ts.getJSDocTypeParameterTagsNoCache : ts.getJSDocTypeParameterTags)(node)); break; } @@ -16978,11 +17106,11 @@ var ts; } function getNextJSDocCommentLocation(node) { var parent = node.parent; - if (parent.kind === 296 /* SyntaxKind.PropertyAssignment */ || - parent.kind === 271 /* SyntaxKind.ExportAssignment */ || - parent.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 247 /* SyntaxKind.ReturnStatement */ || + if (parent.kind === 299 /* SyntaxKind.PropertyAssignment */ || + parent.kind === 274 /* SyntaxKind.ExportAssignment */ || + parent.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 250 /* SyntaxKind.ReturnStatement */ || getNestedModuleDeclaration(parent) || ts.isBinaryExpression(node) && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { return parent; @@ -17092,34 +17220,34 @@ var ts; var parent = node.parent; while (true) { switch (parent.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryOperator = parent.operatorToken.kind; return isAssignmentOperator(binaryOperator) && parent.left === node ? binaryOperator === 63 /* SyntaxKind.EqualsToken */ || isLogicalOrCoalescingAssignmentOperator(binaryOperator) ? 1 /* AssignmentKind.Definite */ : 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: var unaryOperator = parent.operator; return unaryOperator === 45 /* SyntaxKind.PlusPlusToken */ || unaryOperator === 46 /* SyntaxKind.MinusMinusToken */ ? 2 /* AssignmentKind.Compound */ : 0 /* AssignmentKind.None */; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return parent.initializer === node ? 1 /* AssignmentKind.Definite */ : 0 /* AssignmentKind.None */; - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 225 /* SyntaxKind.SpreadElement */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 227 /* SyntaxKind.SpreadElement */: + case 232 /* SyntaxKind.NonNullExpression */: node = parent; break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: node = parent.parent; break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (parent.name !== node) { return 0 /* AssignmentKind.None */; } node = parent.parent; break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (parent.name === node) { return 0 /* AssignmentKind.None */; } @@ -17146,22 +17274,22 @@ var ts; */ function isNodeWithPossibleHoistedDeclaration(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: - case 237 /* SyntaxKind.VariableStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 250 /* SyntaxKind.LabeledStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 292 /* SyntaxKind.CatchClause */: + case 238 /* SyntaxKind.Block */: + case 240 /* SyntaxKind.VariableStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 253 /* SyntaxKind.LabeledStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 295 /* SyntaxKind.CatchClause */: return true; } return false; @@ -17178,11 +17306,11 @@ var ts; return node; } function walkUpParenthesizedTypes(node) { - return walkUp(node, 191 /* SyntaxKind.ParenthesizedType */); + return walkUp(node, 193 /* SyntaxKind.ParenthesizedType */); } ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes; function walkUpParenthesizedExpressions(node) { - return walkUp(node, 212 /* SyntaxKind.ParenthesizedExpression */); + return walkUp(node, 214 /* SyntaxKind.ParenthesizedExpression */); } ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions; /** @@ -17192,7 +17320,7 @@ var ts; */ function walkUpParenthesizedTypesAndGetParentAndChild(node) { var child; - while (node && node.kind === 191 /* SyntaxKind.ParenthesizedType */) { + while (node && node.kind === 193 /* SyntaxKind.ParenthesizedType */) { child = node; node = node.parent; } @@ -17214,11 +17342,11 @@ var ts; ts.skipParentheses = skipParentheses; // a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped function isDeleteTarget(node) { - if (node.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 207 /* SyntaxKind.ElementAccessExpression */) { + if (node.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && node.kind !== 209 /* SyntaxKind.ElementAccessExpression */) { return false; } node = walkUpParenthesizedExpressions(node.parent); - return node && node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node && node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteTarget = isDeleteTarget; function isNodeDescendantOf(node, ancestor) { @@ -17271,7 +17399,7 @@ var ts; ts.getDeclarationFromName = getDeclarationFromName; function isLiteralComputedPropertyDeclarationName(node) { return isStringOrNumericLiteralLike(node) && - node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */ && + node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */ && ts.isDeclaration(node.parent.parent); } ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName; @@ -17279,29 +17407,29 @@ var ts; function isIdentifierName(node) { var parent = node.parent; switch (parent.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 299 /* SyntaxKind.EnumMember */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 302 /* SyntaxKind.EnumMember */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // Name in member declaration or property name in property access return parent.name === node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: // Name on right hand side of dot in a type query or type reference return parent.right === node; - case 203 /* SyntaxKind.BindingElement */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: // Property name in binding element or import specifier return parent.propertyName === node; - case 275 /* SyntaxKind.ExportSpecifier */: - case 285 /* SyntaxKind.JsxAttribute */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 288 /* SyntaxKind.JsxAttribute */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: // Any name in an export specifier or JSX Attribute or Jsx Element return true; } @@ -17324,14 +17452,14 @@ var ts; // const x = require("...").y // const { x } = require("...").y function isAliasSymbolDeclaration(node) { - if (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name || - node.kind === 268 /* SyntaxKind.NamespaceImport */ || - node.kind === 274 /* SyntaxKind.NamespaceExport */ || - node.kind === 270 /* SyntaxKind.ImportSpecifier */ || - node.kind === 275 /* SyntaxKind.ExportSpecifier */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { + if (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name || + node.kind === 271 /* SyntaxKind.NamespaceImport */ || + node.kind === 277 /* SyntaxKind.NamespaceExport */ || + node.kind === 273 /* SyntaxKind.ImportSpecifier */ || + node.kind === 278 /* SyntaxKind.ExportSpecifier */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ && exportAssignmentIsAlias(node)) { return true; } return isInJSFile(node) && (ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && exportAssignmentIsAlias(node) || @@ -17344,18 +17472,18 @@ var ts; ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration; function getAliasDeclarationFromName(node) { switch (node.parent.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 268 /* SyntaxKind.NamespaceImport */: - case 275 /* SyntaxKind.ExportSpecifier */: - case 271 /* SyntaxKind.ExportAssignment */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 274 /* SyntaxKind.NamespaceExport */: + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 271 /* SyntaxKind.NamespaceImport */: + case 278 /* SyntaxKind.ExportSpecifier */: + case 274 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 277 /* SyntaxKind.NamespaceExport */: return node.parent; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.parent; - } while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */); + } while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */); return getAliasDeclarationFromName(node); } } @@ -17374,7 +17502,7 @@ var ts; } ts.getExportAssignmentExpression = getExportAssignmentExpression; function getPropertyAssignmentAliasLikeExpression(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 296 /* SyntaxKind.PropertyAssignment */ ? node.initializer : + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? node.name : node.kind === 299 /* SyntaxKind.PropertyAssignment */ ? node.initializer : node.parent.right; } ts.getPropertyAssignmentAliasLikeExpression = getPropertyAssignmentAliasLikeExpression; @@ -17440,11 +17568,11 @@ var ts; } ts.getAncestor = getAncestor; function isKeyword(token) { - return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 160 /* SyntaxKind.LastKeyword */; + return 81 /* SyntaxKind.FirstKeyword */ <= token && token <= 162 /* SyntaxKind.LastKeyword */; } ts.isKeyword = isKeyword; function isContextualKeyword(token) { - return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 160 /* SyntaxKind.LastContextualKeyword */; + return 126 /* SyntaxKind.FirstContextualKeyword */ <= token && token <= 162 /* SyntaxKind.LastContextualKeyword */; } ts.isContextualKeyword = isContextualKeyword; function isNonContextualKeyword(token) { @@ -17488,15 +17616,15 @@ var ts; } var flags = 0 /* FunctionFlags.Normal */; switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: if (node.asteriskToken) { flags |= 1 /* FunctionFlags.Generator */; } // falls through - case 214 /* SyntaxKind.ArrowFunction */: - if (hasSyntacticModifier(node, 256 /* ModifierFlags.Async */)) { + case 216 /* SyntaxKind.ArrowFunction */: + if (hasSyntacticModifier(node, 512 /* ModifierFlags.Async */)) { flags |= 2 /* FunctionFlags.Async */; } break; @@ -17509,13 +17637,13 @@ var ts; ts.getFunctionFlags = getFunctionFlags; function isAsyncFunction(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: return node.body !== undefined && node.asteriskToken === undefined - && hasSyntacticModifier(node, 256 /* ModifierFlags.Async */); + && hasSyntacticModifier(node, 512 /* ModifierFlags.Async */); } return false; } @@ -17542,7 +17670,7 @@ var ts; } ts.hasDynamicName = hasDynamicName; function isDynamicName(name) { - if (!(name.kind === 162 /* SyntaxKind.ComputedPropertyName */ || name.kind === 207 /* SyntaxKind.ElementAccessExpression */)) { + if (!(name.kind === 164 /* SyntaxKind.ComputedPropertyName */ || name.kind === 209 /* SyntaxKind.ElementAccessExpression */)) { return false; } var expr = ts.isElementAccessExpression(name) ? skipParentheses(name.argumentExpression) : name.expression; @@ -17558,7 +17686,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 8 /* SyntaxKind.NumericLiteral */: return ts.escapeLeadingUnderscores(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameExpression = name.expression; if (isStringOrNumericLiteralLike(nameExpression)) { return ts.escapeLeadingUnderscores(nameExpression.text); @@ -17624,11 +17752,11 @@ var ts; ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier; function isParameterDeclaration(node) { var root = getRootDeclaration(node); - return root.kind === 164 /* SyntaxKind.Parameter */; + return root.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameterDeclaration = isParameterDeclaration; function getRootDeclaration(node) { - while (node.kind === 203 /* SyntaxKind.BindingElement */) { + while (node.kind === 205 /* SyntaxKind.BindingElement */) { node = node.parent.parent; } return node; @@ -17636,15 +17764,15 @@ var ts; ts.getRootDeclaration = getRootDeclaration; function nodeStartsNewLexicalEnvironment(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 305 /* SyntaxKind.SourceFile */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 308 /* SyntaxKind.SourceFile */; } ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment; function nodeIsSynthesized(range) { @@ -17663,23 +17791,23 @@ var ts; })(Associativity = ts.Associativity || (ts.Associativity = {})); function getExpressionAssociativity(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorAssociativity(expression.kind, operator, hasArguments); } ts.getExpressionAssociativity = getExpressionAssociativity; function getOperatorAssociativity(kind, operator, hasArguments) { switch (kind) { - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 0 /* Associativity.Left */ : 1 /* Associativity.Right */; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: - case 222 /* SyntaxKind.ConditionalExpression */: - case 224 /* SyntaxKind.YieldExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 1 /* Associativity.Right */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operator) { case 42 /* SyntaxKind.AsteriskAsteriskToken */: case 63 /* SyntaxKind.EqualsToken */: @@ -17706,15 +17834,15 @@ var ts; ts.getOperatorAssociativity = getOperatorAssociativity; function getExpressionPrecedence(expression) { var operator = getOperator(expression); - var hasArguments = expression.kind === 209 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; + var hasArguments = expression.kind === 211 /* SyntaxKind.NewExpression */ && expression.arguments !== undefined; return getOperatorPrecedence(expression.kind, operator, hasArguments); } ts.getExpressionPrecedence = getExpressionPrecedence; function getOperator(expression) { - if (expression.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expression.kind === 223 /* SyntaxKind.BinaryExpression */) { return expression.operatorToken.kind; } - else if (expression.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 220 /* SyntaxKind.PostfixUnaryExpression */) { + else if (expression.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || expression.kind === 222 /* SyntaxKind.PostfixUnaryExpression */) { return expression.operator; } else { @@ -17893,15 +18021,15 @@ var ts; })(OperatorPrecedence = ts.OperatorPrecedence || (ts.OperatorPrecedence = {})); function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) { switch (nodeKind) { - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return 0 /* OperatorPrecedence.Comma */; - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return 1 /* OperatorPrecedence.Spread */; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return 2 /* OperatorPrecedence.Yield */; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return 4 /* OperatorPrecedence.Conditional */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (operatorKind) { case 27 /* SyntaxKind.CommaToken */: return 0 /* OperatorPrecedence.Comma */; @@ -17926,26 +18054,27 @@ var ts; return getBinaryOperatorPrecedence(operatorKind); } // TODO: Should prefix `++` and `--` be moved to the `Update` precedence? - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 217 /* SyntaxKind.VoidExpression */: - case 215 /* SyntaxKind.DeleteExpression */: - case 218 /* SyntaxKind.AwaitExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 219 /* SyntaxKind.VoidExpression */: + case 217 /* SyntaxKind.DeleteExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return 16 /* OperatorPrecedence.Unary */; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return 17 /* OperatorPrecedence.Update */; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return 18 /* OperatorPrecedence.LeftHandSide */; - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return hasArguments ? 19 /* OperatorPrecedence.Member */ : 18 /* OperatorPrecedence.LeftHandSide */; - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 231 /* SyntaxKind.MetaProperty */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 233 /* SyntaxKind.MetaProperty */: return 19 /* OperatorPrecedence.Member */; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return 11 /* OperatorPrecedence.Relational */; case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: @@ -17957,19 +18086,19 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 226 /* SyntaxKind.ClassExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: case 13 /* SyntaxKind.RegularExpressionLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: - case 223 /* SyntaxKind.TemplateExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 227 /* SyntaxKind.OmittedExpression */: - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 225 /* SyntaxKind.TemplateExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: return 20 /* OperatorPrecedence.Primary */; default: return -1 /* OperatorPrecedence.Invalid */; @@ -18001,7 +18130,8 @@ var ts; case 33 /* SyntaxKind.GreaterThanEqualsToken */: case 102 /* SyntaxKind.InstanceOfKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: + case 150 /* SyntaxKind.SatisfiesKeyword */: return 11 /* OperatorPrecedence.Relational */; case 47 /* SyntaxKind.LessThanLessThanToken */: case 48 /* SyntaxKind.GreaterThanGreaterThanToken */: @@ -18025,7 +18155,7 @@ var ts; function getSemanticJsxChildren(children) { return ts.filter(children, function (i) { switch (i.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !!i.expression; case 11 /* SyntaxKind.JsxText */: return !i.containsOnlyTriviaWhiteSpaces; @@ -18081,7 +18211,7 @@ var ts; } diagnostics = nonFileDiagnostics; } - ts.insertSorted(diagnostics, diagnostic, compareDiagnostics); + ts.insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation); } function getGlobalDiagnostics() { hasReadNonFileDiagnostics = true; @@ -18617,7 +18747,7 @@ var ts; while (ts.isQualifiedName(node.parent) && node.parent.left === node) { node = node.parent; } - return node.parent.kind === 181 /* SyntaxKind.TypeQuery */; + return node.parent.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isThisInTypeQuery = isThisInTypeQuery; function identifierIsThisKeyword(id) { @@ -18632,10 +18762,10 @@ var ts; var setAccessor; if (hasDynamicName(accessor)) { firstAccessor = accessor; - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { + if (accessor.kind === 174 /* SyntaxKind.GetAccessor */) { getAccessor = accessor; } - else if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { setAccessor = accessor; } else { @@ -18655,10 +18785,10 @@ var ts; else if (!secondAccessor) { secondAccessor = member; } - if (member.kind === 172 /* SyntaxKind.GetAccessor */ && !getAccessor) { + if (member.kind === 174 /* SyntaxKind.GetAccessor */ && !getAccessor) { getAccessor = member; } - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && !setAccessor) { + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && !setAccessor) { setAccessor = member; } } @@ -18707,7 +18837,7 @@ var ts; ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations; /** template tags are only available when a typedef isn't already using them */ function isNonTypeAliasTemplate(tag) { - return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 320 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); + return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 323 /* SyntaxKind.JSDoc */ && tag.parent.tags.some(isJSDocTypeAlias)); } /** * Gets the effective type annotation of the value parameter of a set accessor. If the node @@ -18940,13 +19070,17 @@ var ts; } ts.hasOverrideModifier = hasOverrideModifier; function hasAbstractModifier(node) { - return hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + return hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); } ts.hasAbstractModifier = hasAbstractModifier; function hasAmbientModifier(node) { return hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */); } ts.hasAmbientModifier = hasAmbientModifier; + function hasAccessorModifier(node) { + return hasSyntacticModifier(node, 128 /* ModifierFlags.Accessor */); + } + ts.hasAccessorModifier = hasAccessorModifier; function hasEffectiveReadonlyModifier(node) { return hasEffectiveModifier(node, 64 /* ModifierFlags.Readonly */); } @@ -18964,7 +19098,7 @@ var ts; } ts.getSelectedSyntacticModifierFlags = getSelectedSyntacticModifierFlags; function getModifierFlagsWorker(node, includeJSDoc, alwaysIncludeJSDoc) { - if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node.kind >= 0 /* SyntaxKind.FirstToken */ && node.kind <= 162 /* SyntaxKind.LastToken */) { return 0 /* ModifierFlags.None */; } if (!(node.modifierFlagsCache & 536870912 /* ModifierFlags.HasComputedFlags */)) { @@ -19056,25 +19190,22 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: return 4 /* ModifierFlags.Public */; case 122 /* SyntaxKind.ProtectedKeyword */: return 16 /* ModifierFlags.Protected */; case 121 /* SyntaxKind.PrivateKeyword */: return 8 /* ModifierFlags.Private */; - case 126 /* SyntaxKind.AbstractKeyword */: return 128 /* ModifierFlags.Abstract */; + case 126 /* SyntaxKind.AbstractKeyword */: return 256 /* ModifierFlags.Abstract */; + case 127 /* SyntaxKind.AccessorKeyword */: return 128 /* ModifierFlags.Accessor */; case 93 /* SyntaxKind.ExportKeyword */: return 1 /* ModifierFlags.Export */; - case 135 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; + case 136 /* SyntaxKind.DeclareKeyword */: return 2 /* ModifierFlags.Ambient */; case 85 /* SyntaxKind.ConstKeyword */: return 2048 /* ModifierFlags.Const */; - case 88 /* SyntaxKind.DefaultKeyword */: return 512 /* ModifierFlags.Default */; - case 131 /* SyntaxKind.AsyncKeyword */: return 256 /* ModifierFlags.Async */; - case 145 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; - case 159 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; + case 88 /* SyntaxKind.DefaultKeyword */: return 1024 /* ModifierFlags.Default */; + case 132 /* SyntaxKind.AsyncKeyword */: return 512 /* ModifierFlags.Async */; + case 146 /* SyntaxKind.ReadonlyKeyword */: return 64 /* ModifierFlags.Readonly */; + case 161 /* SyntaxKind.OverrideKeyword */: return 16384 /* ModifierFlags.Override */; case 101 /* SyntaxKind.InKeyword */: return 32768 /* ModifierFlags.In */; - case 144 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; - case 165 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; + case 145 /* SyntaxKind.OutKeyword */: return 65536 /* ModifierFlags.Out */; + case 167 /* SyntaxKind.Decorator */: return 131072 /* ModifierFlags.Decorator */; } return 0 /* ModifierFlags.None */; } ts.modifierToFlag = modifierToFlag; - function createModifiers(modifierFlags) { - return modifierFlags ? ts.factory.createNodeArray(ts.factory.createModifiersFromModifierFlags(modifierFlags)) : undefined; - } - ts.createModifiers = createModifiers; function isLogicalOperator(token) { return token === 56 /* SyntaxKind.BarBarToken */ || token === 55 /* SyntaxKind.AmpersandAmpersandToken */ @@ -19124,8 +19255,8 @@ var ts; function isDestructuringAssignment(node) { if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) { var kind = node.left.kind; - return kind === 205 /* SyntaxKind.ObjectLiteralExpression */ - || kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return kind === 207 /* SyntaxKind.ObjectLiteralExpression */ + || kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } return false; } @@ -19142,12 +19273,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { node = node.expression; } while (node.kind !== 79 /* SyntaxKind.Identifier */); @@ -19159,9 +19290,9 @@ var ts; return node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 108 /* SyntaxKind.ThisKeyword */ || node.kind === 106 /* SyntaxKind.SuperKeyword */ - || node.kind === 231 /* SyntaxKind.MetaProperty */ - || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) - || node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); + || node.kind === 233 /* SyntaxKind.MetaProperty */ + || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isDottedName(node.expression) + || node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && isDottedName(node.expression); } ts.isDottedName = isDottedName; function isPropertyAccessEntityNameExpression(node) { @@ -19192,8 +19323,8 @@ var ts; } ts.isPrototypeAccess = isPrototypeAccess; function isRightSideOfQualifiedNameOrPropertyAccess(node) { - return (node.parent.kind === 161 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || - (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); + return (node.parent.kind === 163 /* SyntaxKind.QualifiedName */ && node.parent.right === node) || + (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.name === node); } ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess; function isRightSideOfAccessExpression(node) { @@ -19208,12 +19339,12 @@ var ts; } ts.isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName = isRightSideOfQualifiedNameOrPropertyAccessOrJSDocMemberName; function isEmptyObjectLiteral(expression) { - return expression.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + return expression.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && expression.properties.length === 0; } ts.isEmptyObjectLiteral = isEmptyObjectLiteral; function isEmptyArrayLiteral(expression) { - return expression.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && + return expression.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expression.elements.length === 0; } ts.isEmptyArrayLiteral = isEmptyArrayLiteral; @@ -19229,7 +19360,7 @@ var ts; } ts.getLocalSymbolForExportDefault = getLocalSymbolForExportDefault; function isExportDefaultSymbol(symbol) { - return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 512 /* ModifierFlags.Default */); + return symbol && ts.length(symbol.declarations) > 0 && hasSyntacticModifier(symbol.declarations[0], 1024 /* ModifierFlags.Default */); } /** Return ".ts", ".d.ts", or ".tsx", if that is the extension. */ function tryExtractTSExtension(fileName) { @@ -19374,21 +19505,17 @@ var ts; return getStringFromExpandedCharCodes(expandedCharCodes); } ts.base64decode = base64decode; + function readJsonOrUndefined(path, hostOrText) { + var jsonText = ts.isString(hostOrText) ? hostOrText : hostOrText.readFile(path); + if (!jsonText) + return undefined; + // gracefully handle if readFile fails or returns not JSON + var result = ts.parseConfigFileTextToJson(path, jsonText); + return !result.error ? result.config : undefined; + } + ts.readJsonOrUndefined = readJsonOrUndefined; function readJson(path, host) { - try { - var jsonText = host.readFile(path); - if (!jsonText) - return {}; - var result = ts.parseConfigFileTextToJson(path, jsonText); - if (result.error) { - return {}; - } - return result.config; - } - catch (e) { - // gracefully handle if readFile fails or returns not JSON - return {}; - } + return readJsonOrUndefined(path, host) || {}; } ts.readJson = readJson; function directoryProbablyExists(directoryName, host) { @@ -19547,8 +19674,8 @@ var ts; var parseNode = ts.getParseTreeNode(node); if (parseNode) { switch (parseNode.parent.kind) { - case 260 /* SyntaxKind.EnumDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return parseNode === parseNode.parent.name; } } @@ -19564,7 +19691,7 @@ var ts; } function isWatchSet(options) { // Firefox has Object.prototype.watch - return options.watch && options.hasOwnProperty("watch"); + return options.watch && ts.hasProperty(options, "watch"); } ts.isWatchSet = isWatchSet; function closeFileWatcher(watcher) { @@ -19628,35 +19755,35 @@ var ts; if (!parent) return 0 /* AccessKind.Read */; switch (parent.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return accessKind(parent); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var operator = parent.operator; return operator === 45 /* SyntaxKind.PlusPlusToken */ || operator === 46 /* SyntaxKind.MinusMinusToken */ ? writeOrReadWrite() : 0 /* AccessKind.Read */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var _a = parent, left = _a.left, operatorToken = _a.operatorToken; return left === node && isAssignmentOperator(operatorToken.kind) ? operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ ? 1 /* AccessKind.Write */ : writeOrReadWrite() : 0 /* AccessKind.Read */; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return parent.name !== node ? 0 /* AccessKind.Read */ : accessKind(parent); - case 296 /* SyntaxKind.PropertyAssignment */: { + case 299 /* SyntaxKind.PropertyAssignment */: { var parentAccess = accessKind(parent.parent); // In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write. return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess; } - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals. return node === parent.objectAssignmentInitializer ? 0 /* AccessKind.Read */ : accessKind(parent.parent); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return accessKind(parent); default: return 0 /* AccessKind.Read */; } function writeOrReadWrite() { // If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect. - return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 238 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; + return parent.parent && walkUpParenthesizedExpressions(parent.parent).kind === 241 /* SyntaxKind.ExpressionStatement */ ? 1 /* AccessKind.Write */ : 2 /* AccessKind.ReadWrite */; } } function reverseAccessKind(a) { @@ -19738,7 +19865,7 @@ var ts; function isAbstractConstructorSymbol(symbol) { if (symbol.flags & 32 /* SymbolFlags.Class */) { var declaration = getClassLikeDeclarationOfSymbol(symbol); - return !!declaration && hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + return !!declaration && hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); } return false; } @@ -19800,37 +19927,37 @@ var ts; } ts.isObjectTypeDeclaration = isObjectTypeDeclaration; function isTypeNodeKind(kind) { - return (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) - || kind === 130 /* SyntaxKind.AnyKeyword */ - || kind === 155 /* SyntaxKind.UnknownKeyword */ - || kind === 147 /* SyntaxKind.NumberKeyword */ - || kind === 158 /* SyntaxKind.BigIntKeyword */ - || kind === 148 /* SyntaxKind.ObjectKeyword */ - || kind === 133 /* SyntaxKind.BooleanKeyword */ - || kind === 150 /* SyntaxKind.StringKeyword */ - || kind === 151 /* SyntaxKind.SymbolKeyword */ + return (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) + || kind === 131 /* SyntaxKind.AnyKeyword */ + || kind === 157 /* SyntaxKind.UnknownKeyword */ + || kind === 148 /* SyntaxKind.NumberKeyword */ + || kind === 160 /* SyntaxKind.BigIntKeyword */ + || kind === 149 /* SyntaxKind.ObjectKeyword */ + || kind === 134 /* SyntaxKind.BooleanKeyword */ + || kind === 152 /* SyntaxKind.StringKeyword */ + || kind === 153 /* SyntaxKind.SymbolKeyword */ || kind === 114 /* SyntaxKind.VoidKeyword */ - || kind === 153 /* SyntaxKind.UndefinedKeyword */ - || kind === 143 /* SyntaxKind.NeverKeyword */ - || kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ - || kind === 312 /* SyntaxKind.JSDocAllType */ - || kind === 313 /* SyntaxKind.JSDocUnknownType */ - || kind === 314 /* SyntaxKind.JSDocNullableType */ - || kind === 315 /* SyntaxKind.JSDocNonNullableType */ - || kind === 316 /* SyntaxKind.JSDocOptionalType */ - || kind === 317 /* SyntaxKind.JSDocFunctionType */ - || kind === 318 /* SyntaxKind.JSDocVariadicType */; + || kind === 155 /* SyntaxKind.UndefinedKeyword */ + || kind === 144 /* SyntaxKind.NeverKeyword */ + || kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ + || kind === 315 /* SyntaxKind.JSDocAllType */ + || kind === 316 /* SyntaxKind.JSDocUnknownType */ + || kind === 317 /* SyntaxKind.JSDocNullableType */ + || kind === 318 /* SyntaxKind.JSDocNonNullableType */ + || kind === 319 /* SyntaxKind.JSDocOptionalType */ + || kind === 320 /* SyntaxKind.JSDocFunctionType */ + || kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isTypeNodeKind = isTypeNodeKind; function isAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isAccessExpression = isAccessExpression; function getNameOfAccessExpression(node) { - if (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { return node.name; } - ts.Debug.assert(node.kind === 207 /* SyntaxKind.ElementAccessExpression */); + ts.Debug.assert(node.kind === 209 /* SyntaxKind.ElementAccessExpression */); return node.argumentExpression; } ts.getNameOfAccessExpression = getNameOfAccessExpression; @@ -19845,7 +19972,7 @@ var ts; } ts.isBundleFileTextLike = isBundleFileTextLike; function isNamedImportsOrExports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */ || node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 272 /* SyntaxKind.NamedImports */ || node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedImportsOrExports = isNamedImportsOrExports; function getLeftmostAccessExpression(expr) { @@ -19860,13 +19987,13 @@ var ts; return walkAccessExpression(name.parent); } function walkAccessExpression(access) { - if (access.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (access.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var res = action(access.name); if (res !== undefined) { return res; } } - else if (access.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + else if (access.kind === 209 /* SyntaxKind.ElementAccessExpression */) { if (ts.isIdentifier(access.argumentExpression) || ts.isStringLiteralLike(access.argumentExpression)) { var res = action(access.argumentExpression); if (res !== undefined) { @@ -19893,28 +20020,29 @@ var ts; function getLeftmostExpression(node, stopAtCallExpressions) { while (true) { switch (node.kind) { - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: node = node.operand; continue; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: node = node.left; continue; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: node = node.condition; continue; - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: node = node.tag; continue; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (stopAtCallExpressions) { return node; } // falls through - case 229 /* SyntaxKind.AsExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: node = node.expression; continue; } @@ -21150,17 +21278,17 @@ var ts; return ts.isIdentifier(useSite) && ts.isShorthandPropertyAssignment(useSite.parent) && useSite.parent.name === useSite; } function isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(node) { - while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } - if (hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */)) { + if (hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */)) { return true; } var containerKind = node.parent.parent.kind; - return containerKind === 258 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 182 /* SyntaxKind.TypeLiteral */; + return containerKind === 261 /* SyntaxKind.InterfaceDeclaration */ || containerKind === 184 /* SyntaxKind.TypeLiteral */; } /** Returns true for an identifier in 1) an `implements` clause, and 2) an `extends` clause of an interface. */ function isIdentifierInNonEmittingHeritageClause(node) { @@ -21168,16 +21296,16 @@ var ts; return false; var heritageClause = ts.findAncestor(node.parent, function (parent) { switch (parent.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return false; default: return "quit"; } }); - return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 258 /* SyntaxKind.InterfaceDeclaration */; + return (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.token) === 117 /* SyntaxKind.ImplementsKeyword */ || (heritageClause === null || heritageClause === void 0 ? void 0 : heritageClause.parent.kind) === 261 /* SyntaxKind.InterfaceDeclaration */; } function isIdentifierTypeReference(node) { return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName); @@ -21338,22 +21466,22 @@ var ts; if (!node.parent) return undefined; switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: var parent_1 = node.parent; - return parent_1.kind === 190 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; - case 164 /* SyntaxKind.Parameter */: + return parent_1.kind === 192 /* SyntaxKind.InferType */ ? undefined : parent_1.typeParameters; + case 166 /* SyntaxKind.Parameter */: return node.parent.parameters; - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return node.parent.templateSpans; - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return node.parent.templateSpans; - case 165 /* SyntaxKind.Decorator */: { + case 167 /* SyntaxKind.Decorator */: { var parent_2 = node.parent; return ts.canHaveDecorators(parent_2) ? parent_2.modifiers : ts.canHaveIllegalDecorators(parent_2) ? parent_2.illegalDecorators : undefined; } - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return node.parent.heritageClauses; } var parent = node.parent; @@ -21361,45 +21489,45 @@ var ts; return ts.isJSDocTypeLiteral(node.parent) ? undefined : node.parent.tags; } switch (parent.kind) { - case 182 /* SyntaxKind.TypeLiteral */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 184 /* SyntaxKind.TypeLiteral */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return ts.isTypeElement(node) ? parent.members : undefined; - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return parent.types; - case 184 /* SyntaxKind.TupleType */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 351 /* SyntaxKind.CommaListExpression */: - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: + case 186 /* SyntaxKind.TupleType */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 354 /* SyntaxKind.CommaListExpression */: + case 272 /* SyntaxKind.NamedImports */: + case 276 /* SyntaxKind.NamedExports */: return parent.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 286 /* SyntaxKind.JsxAttributes */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 289 /* SyntaxKind.JsxAttributes */: return parent.properties; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return ts.isTypeNode(node) ? parent.typeArguments : parent.expression === node ? undefined : parent.arguments; - case 278 /* SyntaxKind.JsxElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 285 /* SyntaxKind.JsxFragment */: return ts.isJsxChild(node) ? parent.children : undefined; - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return ts.isTypeNode(node) ? parent.typeArguments : undefined; - case 235 /* SyntaxKind.Block */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 265 /* SyntaxKind.ModuleBlock */: return parent.statements; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return parent.clauses; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.isClassElement(node) ? parent.members : undefined; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.isEnumMember(node) ? parent.members : undefined; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return parent.statements; } } @@ -21411,7 +21539,7 @@ var ts; if (ts.some(node.parameters, function (p) { return !getEffectiveTypeAnnotationNode(p); })) { return true; } - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { // If the first parameter is not an explicit 'this' parameter, then the function has // an implicit 'this' parameter which is subject to contextual typing. var parameter = ts.firstOrUndefined(node.parameters); @@ -21429,7 +21557,7 @@ var ts; } ts.isInfinityOrNaNString = isInfinityOrNaNString; function isCatchClauseVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.parent.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClauseVariableDeclaration = isCatchClauseVariableDeclaration; function isParameterOrCatchClauseVariable(symbol) { @@ -21438,7 +21566,7 @@ var ts; } ts.isParameterOrCatchClauseVariable = isParameterOrCatchClauseVariable; function isFunctionExpressionOrArrowFunction(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */ || node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */ || node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction; function escapeSnippetText(text) { @@ -21535,9 +21663,35 @@ var ts; ts.getNodeModulePathParts = getNodeModulePathParts; function getParameterTypeNode(parameter) { var _a; - return parameter.kind === 340 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; + return parameter.kind === 343 /* SyntaxKind.JSDocParameterTag */ ? (_a = parameter.typeExpression) === null || _a === void 0 ? void 0 : _a.type : parameter.type; } ts.getParameterTypeNode = getParameterTypeNode; + function isTypeDeclaration(node) { + switch (node.kind) { + case 165 /* SyntaxKind.TypeParameter */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + return true; + case 270 /* SyntaxKind.ImportClause */: + return node.isTypeOnly; + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: + return node.parent.parent.isTypeOnly; + default: + return false; + } + } + ts.isTypeDeclaration = isTypeDeclaration; + function canHaveExportModifier(node) { + return ts.isEnumDeclaration(node) || ts.isVariableStatement(node) || ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node) + || ts.isInterfaceDeclaration(node) || isTypeDeclaration(node) || (ts.isModuleDeclaration(node) && !isExternalModuleAugmentation(node) && !isGlobalScopeAugmentation(node)); + } + ts.canHaveExportModifier = canHaveExportModifier; })(ts || (ts = {})); /* @internal */ var ts; @@ -21546,13 +21700,11 @@ var ts; * Creates a `BaseNodeFactory` which can be used to create `Node` instances from the constructors provided by the object allocator. */ function createBaseNodeFactory() { - // tslint:disable variable-name var NodeConstructor; var TokenConstructor; var IdentifierConstructor; var PrivateIdentifierConstructor; var SourceFileConstructor; - // tslint:enable variable-name return { createBaseSourceFileNode: createBaseSourceFileNode, createBaseIdentifierNode: createBaseIdentifierNode, @@ -21660,10 +21812,10 @@ var ts; // // If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve // the intended order of operations: `(a ** b) ** c` - var binaryOperatorPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, binaryOperator); - var binaryOperatorAssociativity = ts.getOperatorAssociativity(221 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, binaryOperator); + var binaryOperatorAssociativity = ts.getOperatorAssociativity(223 /* SyntaxKind.BinaryExpression */, binaryOperator); var emittedOperand = ts.skipPartiallyEmittedExpressions(operand); - if (!isLeftSideOfBinary && operand.kind === 214 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { + if (!isLeftSideOfBinary && operand.kind === 216 /* SyntaxKind.ArrowFunction */ && binaryOperatorPrecedence > 3 /* OperatorPrecedence.Assignment */) { // We need to parenthesize arrow functions on the right side to avoid it being // parsed as parenthesized expression: `a && (() => {})` return true; @@ -21675,7 +21827,7 @@ var ts; // and is a yield expression, then we do not need parentheses. if (!isLeftSideOfBinary && binaryOperatorAssociativity === 1 /* Associativity.Right */ - && operand.kind === 224 /* SyntaxKind.YieldExpression */) { + && operand.kind === 226 /* SyntaxKind.YieldExpression */) { return false; } return true; @@ -21744,13 +21896,15 @@ var ts; // (a|b)|c -> a|(b|c) -> a|b|c // (a&b)&c -> a&(b&c) -> a&b&c // (a^b)^c -> a^(b^c) -> a^b^c + // (a,b),c -> a,(b,c) -> a,b,c // // While addition is associative in mathematics, JavaScript's `+` is not // guaranteed to be associative as it is overloaded with string concatenation. return binaryOperator === 41 /* SyntaxKind.AsteriskToken */ || binaryOperator === 51 /* SyntaxKind.BarToken */ || binaryOperator === 50 /* SyntaxKind.AmpersandToken */ - || binaryOperator === 52 /* SyntaxKind.CaretToken */; + || binaryOperator === 52 /* SyntaxKind.CaretToken */ + || binaryOperator === 27 /* SyntaxKind.CommaToken */; } /** * This function determines whether an expression consists of a homogeneous set of @@ -21763,7 +21917,7 @@ var ts; if (ts.isLiteralKind(node.kind)) { return node.kind; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 39 /* SyntaxKind.PlusToken */) { if (node.cachedLiteralKind !== undefined) { return node.cachedLiteralKind; } @@ -21789,7 +21943,7 @@ var ts; function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) { var skipped = ts.skipPartiallyEmittedExpressions(operand); // If the resulting expression is already parenthesized, we do not need to do any further processing. - if (skipped.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (skipped.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { return operand; } return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) @@ -21806,7 +21960,7 @@ var ts; return ts.isCommaSequence(expression) ? factory.createParenthesizedExpression(expression) : expression; } function parenthesizeConditionOfConditionalExpression(condition) { - var conditionalPrecedence = ts.getOperatorPrecedence(222 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); + var conditionalPrecedence = ts.getOperatorPrecedence(224 /* SyntaxKind.ConditionalExpression */, 57 /* SyntaxKind.QuestionToken */); var emittedCondition = ts.skipPartiallyEmittedExpressions(condition); var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition); if (ts.compareValues(conditionPrecedence, conditionalPrecedence) !== 1 /* Comparison.GreaterThan */) { @@ -21839,8 +21993,8 @@ var ts; var needsParens = ts.isCommaSequence(check); if (!needsParens) { switch (ts.getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: needsParens = true; } } @@ -21853,9 +22007,9 @@ var ts; function parenthesizeExpressionOfNew(expression) { var leftmostExpr = ts.getLeftmostExpression(expression, /*stopAtCallExpressions*/ true); switch (leftmostExpr.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return factory.createParenthesizedExpression(expression); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return !leftmostExpr.arguments ? factory.createParenthesizedExpression(expression) : expression; // TODO(rbuckton): Verify this assertion holds @@ -21875,7 +22029,7 @@ var ts; // var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); if (ts.isLeftHandSideExpression(emittedExpression) - && (emittedExpression.kind !== 209 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) + && (emittedExpression.kind !== 211 /* SyntaxKind.NewExpression */ || emittedExpression.arguments) && (optionalChain || !ts.isOptionalChain(emittedExpression))) { // TODO(rbuckton): Verify whether this assertion holds. return expression; @@ -21898,7 +22052,7 @@ var ts; function parenthesizeExpressionForDisallowedComma(expression) { var emittedExpression = ts.skipPartiallyEmittedExpressions(expression); var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression); - var commaPrecedence = ts.getOperatorPrecedence(221 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); + var commaPrecedence = ts.getOperatorPrecedence(223 /* SyntaxKind.BinaryExpression */, 27 /* SyntaxKind.CommaToken */); // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return expressionPrecedence > commaPrecedence ? expression : ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } @@ -21907,21 +22061,21 @@ var ts; if (ts.isCallExpression(emittedExpression)) { var callee = emittedExpression.expression; var kind = ts.skipPartiallyEmittedExpressions(callee).kind; - if (kind === 213 /* SyntaxKind.FunctionExpression */ || kind === 214 /* SyntaxKind.ArrowFunction */) { + if (kind === 215 /* SyntaxKind.FunctionExpression */ || kind === 216 /* SyntaxKind.ArrowFunction */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. var updated = factory.updateCallExpression(emittedExpression, ts.setTextRange(factory.createParenthesizedExpression(callee), callee), emittedExpression.typeArguments, emittedExpression.arguments); return factory.restoreOuterExpressions(expression, updated, 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */); } } var leftmostExpressionKind = ts.getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind; - if (leftmostExpressionKind === 205 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 213 /* SyntaxKind.FunctionExpression */) { + if (leftmostExpressionKind === 207 /* SyntaxKind.ObjectLiteralExpression */ || leftmostExpressionKind === 215 /* SyntaxKind.FunctionExpression */) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(expression), expression); } return expression; } function parenthesizeConciseBodyOfArrowFunction(body) { - if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + if (!ts.isBlock(body) && (ts.isCommaSequence(body) || ts.getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { // TODO(rbuckton): Verifiy whether `setTextRange` is needed. return ts.setTextRange(factory.createParenthesizedExpression(body), body); } @@ -21939,16 +22093,16 @@ var ts; // - The true and false branch types (the second and third `Type` non-terminals, above) allow any type function parenthesizeCheckTypeOfConditionalType(checkType) { switch (checkType.kind) { - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 189 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(checkType); } return checkType; } function parenthesizeExtendsTypeOfConditionalType(extendsType) { switch (extendsType.kind) { - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return factory.createParenthesizedType(extendsType); } return extendsType; @@ -21960,8 +22114,8 @@ var ts; // - A union type constituent has the same precedence as the check type of a conditional type function parenthesizeConstituentTypeOfUnionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 189 /* SyntaxKind.UnionType */: // Not strictly necessary, but a union containing a union should have been flattened + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeCheckTypeOfConditionalType(type); @@ -21976,8 +22130,8 @@ var ts; // - An intersection type constituent does not allow function, constructor, conditional, or union types (they must be parenthesized) function parenthesizeConstituentTypeOfIntersectionType(type) { switch (type.kind) { - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: // Not strictly necessary, but an intersection containing an intersection should have been flattened return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfUnionType(type); @@ -21994,14 +22148,14 @@ var ts; // function parenthesizeOperandOfTypeOperator(type) { switch (type.kind) { - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return factory.createParenthesizedType(type); } return parenthesizeConstituentTypeOfIntersectionType(type); } function parenthesizeOperandOfReadonlyTypeOperator(type) { switch (type.kind) { - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22021,9 +22175,9 @@ var ts; // function parenthesizeNonArrayTypeOfPostfixType(type) { switch (type.kind) { - case 190 /* SyntaxKind.InferType */: - case 193 /* SyntaxKind.TypeOperator */: - case 181 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests + case 192 /* SyntaxKind.InferType */: + case 195 /* SyntaxKind.TypeOperator */: + case 183 /* SyntaxKind.TypeQuery */: // Not strictly necessary, but makes generated output more readable and avoids breaks in DT tests return factory.createParenthesizedType(type); } return parenthesizeOperandOfTypeOperator(type); @@ -22217,11 +22371,11 @@ var ts; } function convertToAssignmentPattern(node) { switch (node.kind) { - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return convertToArrayAssignmentPattern(node); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return convertToObjectAssignmentPattern(node); } } @@ -22315,6 +22469,8 @@ var ts; createUniqueName: createUniqueName, getGeneratedNameForNode: getGeneratedNameForNode, createPrivateIdentifier: createPrivateIdentifier, + createUniquePrivateName: createUniquePrivateName, + getGeneratedPrivateNameForNode: getGeneratedPrivateNameForNode, createToken: createToken, createSuper: createSuper, createThis: createThis, @@ -22477,6 +22633,8 @@ var ts; updateAsExpression: updateAsExpression, createNonNullExpression: createNonNullExpression, updateNonNullExpression: updateNonNullExpression, + createSatisfiesExpression: createSatisfiesExpression, + updateSatisfiesExpression: updateSatisfiesExpression, createNonNullChain: createNonNullChain, updateNonNullChain: updateNonNullChain, createMetaProperty: createMetaProperty, @@ -22574,18 +22732,18 @@ var ts; createExternalModuleReference: createExternalModuleReference, updateExternalModuleReference: updateExternalModuleReference, // lazily load factory members for JSDoc types with similar structure - get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(312 /* SyntaxKind.JSDocAllType */); }, - get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(313 /* SyntaxKind.JSDocUnknownType */); }, - get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(315 /* SyntaxKind.JSDocNonNullableType */); }, - get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(314 /* SyntaxKind.JSDocNullableType */); }, - get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(316 /* SyntaxKind.JSDocOptionalType */); }, - get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocVariadicType */); }, - get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, - get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocNamepathType */); }, + get createJSDocAllType() { return getJSDocPrimaryTypeCreateFunction(315 /* SyntaxKind.JSDocAllType */); }, + get createJSDocUnknownType() { return getJSDocPrimaryTypeCreateFunction(316 /* SyntaxKind.JSDocUnknownType */); }, + get createJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get updateJSDocNonNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(318 /* SyntaxKind.JSDocNonNullableType */); }, + get createJSDocNullableType() { return getJSDocPrePostfixUnaryTypeCreateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get updateJSDocNullableType() { return getJSDocPrePostfixUnaryTypeUpdateFunction(317 /* SyntaxKind.JSDocNullableType */); }, + get createJSDocOptionalType() { return getJSDocUnaryTypeCreateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get updateJSDocOptionalType() { return getJSDocUnaryTypeUpdateFunction(319 /* SyntaxKind.JSDocOptionalType */); }, + get createJSDocVariadicType() { return getJSDocUnaryTypeCreateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get updateJSDocVariadicType() { return getJSDocUnaryTypeUpdateFunction(321 /* SyntaxKind.JSDocVariadicType */); }, + get createJSDocNamepathType() { return getJSDocUnaryTypeCreateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, + get updateJSDocNamepathType() { return getJSDocUnaryTypeUpdateFunction(322 /* SyntaxKind.JSDocNamepathType */); }, createJSDocFunctionType: createJSDocFunctionType, updateJSDocFunctionType: updateJSDocFunctionType, createJSDocTypeLiteral: createJSDocTypeLiteral, @@ -22621,30 +22779,30 @@ var ts; createJSDocLinkPlain: createJSDocLinkPlain, updateJSDocLinkPlain: updateJSDocLinkPlain, // lazily load factory members for JSDoc tags with similar structure - get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(343 /* SyntaxKind.JSDocTypeTag */); }, - get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(341 /* SyntaxKind.JSDocReturnTag */); }, - get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocThisTag */); }, - get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(339 /* SyntaxKind.JSDocEnumTag */); }, - get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(330 /* SyntaxKind.JSDocAuthorTag */); }, - get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(332 /* SyntaxKind.JSDocClassTag */); }, - get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocPublicTag */); }, - get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocPrivateTag */); }, - get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocProtectedTag */); }, - get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocReadonlyTag */); }, - get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocOverrideTag */); }, - get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, - get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(331 /* SyntaxKind.JSDocDeprecatedTag */); }, + get createJSDocTypeTag() { return getJSDocTypeLikeTagCreateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get updateJSDocTypeTag() { return getJSDocTypeLikeTagUpdateFunction(346 /* SyntaxKind.JSDocTypeTag */); }, + get createJSDocReturnTag() { return getJSDocTypeLikeTagCreateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get updateJSDocReturnTag() { return getJSDocTypeLikeTagUpdateFunction(344 /* SyntaxKind.JSDocReturnTag */); }, + get createJSDocThisTag() { return getJSDocTypeLikeTagCreateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get updateJSDocThisTag() { return getJSDocTypeLikeTagUpdateFunction(345 /* SyntaxKind.JSDocThisTag */); }, + get createJSDocEnumTag() { return getJSDocTypeLikeTagCreateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get updateJSDocEnumTag() { return getJSDocTypeLikeTagUpdateFunction(342 /* SyntaxKind.JSDocEnumTag */); }, + get createJSDocAuthorTag() { return getJSDocSimpleTagCreateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get updateJSDocAuthorTag() { return getJSDocSimpleTagUpdateFunction(333 /* SyntaxKind.JSDocAuthorTag */); }, + get createJSDocClassTag() { return getJSDocSimpleTagCreateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get updateJSDocClassTag() { return getJSDocSimpleTagUpdateFunction(335 /* SyntaxKind.JSDocClassTag */); }, + get createJSDocPublicTag() { return getJSDocSimpleTagCreateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get updateJSDocPublicTag() { return getJSDocSimpleTagUpdateFunction(336 /* SyntaxKind.JSDocPublicTag */); }, + get createJSDocPrivateTag() { return getJSDocSimpleTagCreateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get updateJSDocPrivateTag() { return getJSDocSimpleTagUpdateFunction(337 /* SyntaxKind.JSDocPrivateTag */); }, + get createJSDocProtectedTag() { return getJSDocSimpleTagCreateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get updateJSDocProtectedTag() { return getJSDocSimpleTagUpdateFunction(338 /* SyntaxKind.JSDocProtectedTag */); }, + get createJSDocReadonlyTag() { return getJSDocSimpleTagCreateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get updateJSDocReadonlyTag() { return getJSDocSimpleTagUpdateFunction(339 /* SyntaxKind.JSDocReadonlyTag */); }, + get createJSDocOverrideTag() { return getJSDocSimpleTagCreateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get updateJSDocOverrideTag() { return getJSDocSimpleTagUpdateFunction(340 /* SyntaxKind.JSDocOverrideTag */); }, + get createJSDocDeprecatedTag() { return getJSDocSimpleTagCreateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, + get updateJSDocDeprecatedTag() { return getJSDocSimpleTagUpdateFunction(334 /* SyntaxKind.JSDocDeprecatedTag */); }, createJSDocUnknownTag: createJSDocUnknownTag, updateJSDocUnknownTag: updateJSDocUnknownTag, createJSDocText: createJSDocText, @@ -22847,11 +23005,11 @@ var ts; // don't propagate child flags. if (name) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: if (ts.isIdentifier(name)) { node.transformFlags |= propagateIdentifierNameFlags(name); break; @@ -23000,23 +23158,29 @@ var ts; node.escapedText = ts.escapeLeadingUnderscores(text); return node; } - function createBaseGeneratedIdentifier(text, autoGenerateFlags) { + function createBaseGeneratedIdentifier(text, autoGenerateFlags, prefix, suffix) { var node = createBaseIdentifier(text, /*originalKeywordKind*/ undefined); node.autoGenerateFlags = autoGenerateFlags; node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; nextAutoGenerateId++; return node; } // @api - function createIdentifier(text, typeArguments, originalKeywordKind) { + function createIdentifier(text, typeArguments, originalKeywordKind, hasExtendedUnicodeEscape) { var node = createBaseIdentifier(text, originalKeywordKind); if (typeArguments) { // NOTE: we do not use `setChildren` here because typeArguments in an identifier do not contribute to transformations node.typeArguments = createNodeArray(typeArguments); } - if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { node.transformFlags |= 67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; } + if (hasExtendedUnicodeEscape) { + node.hasExtendedUnicodeEscape = hasExtendedUnicodeEscape; + node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; + } return node; } // @api @@ -23026,11 +23190,11 @@ var ts; : node; } // @api - function createTempVariable(recordTempVariable, reservedInNestedScopes) { + function createTempVariable(recordTempVariable, reservedInNestedScopes, prefix, suffix) { var flags = 1 /* GeneratedIdentifierFlags.Auto */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - var name = createBaseGeneratedIdentifier("", flags); + var name = createBaseGeneratedIdentifier("", flags, prefix, suffix); if (recordTempVariable) { recordTempVariable(name); } @@ -23042,34 +23206,69 @@ var ts; var flags = 2 /* GeneratedIdentifierFlags.Loop */; if (reservedInNestedScopes) flags |= 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */; - return createBaseGeneratedIdentifier("", flags); + return createBaseGeneratedIdentifier("", flags, /*prefix*/ undefined, /*suffix*/ undefined); } /** Create a unique name based on the supplied text. */ // @api - function createUniqueName(text, flags) { + function createUniqueName(text, flags, prefix, suffix) { if (flags === void 0) { flags = 0 /* GeneratedIdentifierFlags.None */; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); ts.Debug.assert((flags & (16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */)) !== 32 /* GeneratedIdentifierFlags.FileLevel */, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"); - return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags); + return createBaseGeneratedIdentifier(text, 3 /* GeneratedIdentifierFlags.Unique */ | flags, prefix, suffix); } /** Create a unique name generated for a node. */ // @api - function getGeneratedNameForNode(node, flags) { + function getGeneratedNameForNode(node, flags, prefix, suffix) { if (flags === void 0) { flags = 0; } ts.Debug.assert(!(flags & 7 /* GeneratedIdentifierFlags.KindMask */), "Argument out of range: flags"); - var name = createBaseGeneratedIdentifier(node && ts.isIdentifier(node) ? ts.idText(node) : "", 4 /* GeneratedIdentifierFlags.Node */ | flags); + var text = !node ? "" : + ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ false, prefix, node, suffix, ts.idText) : + "generated@".concat(ts.getNodeId(node)); + if (prefix || suffix) + flags |= 16 /* GeneratedIdentifierFlags.Optimistic */; + var name = createBaseGeneratedIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); name.original = node; return name; } + function createBasePrivateIdentifier(text) { + var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); + node.escapedText = ts.escapeLeadingUnderscores(text); + node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return node; + } // @api function createPrivateIdentifier(text) { if (!ts.startsWith(text, "#")) ts.Debug.fail("First character of private identifier must be #: " + text); - var node = baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */); - node.escapedText = ts.escapeLeadingUnderscores(text); - node.transformFlags |= 16777216 /* TransformFlags.ContainsClassFields */; + return createBasePrivateIdentifier(text); + } + function createBaseGeneratedPrivateIdentifier(text, autoGenerateFlags, prefix, suffix) { + var node = createBasePrivateIdentifier(text); + node.autoGenerateFlags = autoGenerateFlags; + node.autoGenerateId = nextAutoGenerateId; + node.autoGeneratePrefix = prefix; + node.autoGenerateSuffix = suffix; + nextAutoGenerateId++; return node; } + /** Create a unique name based on the supplied text. */ + // @api + function createUniquePrivateName(text, prefix, suffix) { + if (text && !ts.startsWith(text, "#")) + ts.Debug.fail("First character of private identifier must be #: " + text); + var autoGenerateFlags = 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */ | + (text ? 3 /* GeneratedIdentifierFlags.Unique */ : 1 /* GeneratedIdentifierFlags.Auto */); + return createBaseGeneratedPrivateIdentifier(text !== null && text !== void 0 ? text : "", autoGenerateFlags, prefix, suffix); + } + // @api + function getGeneratedPrivateNameForNode(node, prefix, suffix) { + var text = ts.isMemberName(node) ? ts.formatGeneratedName(/*privateName*/ true, prefix, node, suffix, ts.idText) : + "#generated@".concat(ts.getNodeId(node)); + var flags = prefix || suffix ? 16 /* GeneratedIdentifierFlags.Optimistic */ : 0 /* GeneratedIdentifierFlags.None */; + var name = createBaseGeneratedPrivateIdentifier(text, 4 /* GeneratedIdentifierFlags.Node */ | flags, prefix, suffix); + name.original = node; + return name; + } // // Punctuation // @@ -23077,14 +23276,14 @@ var ts; return baseFactory.createBaseTokenNode(kind); } function createToken(token) { - ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 160 /* SyntaxKind.LastToken */, "Invalid token"); + ts.Debug.assert(token >= 0 /* SyntaxKind.FirstToken */ && token <= 162 /* SyntaxKind.LastToken */, "Invalid token"); ts.Debug.assert(token <= 14 /* SyntaxKind.FirstTemplateToken */ || token >= 17 /* SyntaxKind.LastTemplateToken */, "Invalid token. Use 'createTemplateLiteralLikeNode' to create template literals."); ts.Debug.assert(token <= 8 /* SyntaxKind.FirstLiteralToken */ || token >= 14 /* SyntaxKind.LastLiteralToken */, "Invalid token. Use 'createLiteralLikeNode' to create literals."); ts.Debug.assert(token !== 79 /* SyntaxKind.Identifier */, "Invalid token. Use 'createIdentifier' to create identifiers"); var node = createBaseToken(token); var transformFlags = 0 /* TransformFlags.None */; switch (token) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // 'async' modifier is ES2017 (async functions) or ES2018 (async generators) transformFlags = 256 /* TransformFlags.ContainsES2017 */ | @@ -23093,24 +23292,24 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 145 /* SyntaxKind.OutKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. + case 157 /* SyntaxKind.UnknownKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: // `undefined` is an Identifier in the expression case. transformFlags = 1 /* TransformFlags.ContainsTypeScript */; break; case 106 /* SyntaxKind.SuperKeyword */: @@ -23119,6 +23318,9 @@ var ts; case 124 /* SyntaxKind.StaticKeyword */: transformFlags = 1024 /* TransformFlags.ContainsES2015 */; break; + case 127 /* SyntaxKind.AccessorKeyword */: + transformFlags = 16777216 /* TransformFlags.ContainsClassFields */; + break; case 108 /* SyntaxKind.ThisKeyword */: // 'this' indicates a lexical 'this' transformFlags = 16384 /* TransformFlags.ContainsLexicalThis */; @@ -23165,8 +23367,8 @@ var ts; if (flags & 1 /* ModifierFlags.Export */) result.push(createModifier(93 /* SyntaxKind.ExportKeyword */)); if (flags & 2 /* ModifierFlags.Ambient */) - result.push(createModifier(135 /* SyntaxKind.DeclareKeyword */)); - if (flags & 512 /* ModifierFlags.Default */) + result.push(createModifier(136 /* SyntaxKind.DeclareKeyword */)); + if (flags & 1024 /* ModifierFlags.Default */) result.push(createModifier(88 /* SyntaxKind.DefaultKeyword */)); if (flags & 2048 /* ModifierFlags.Const */) result.push(createModifier(85 /* SyntaxKind.ConstKeyword */)); @@ -23176,20 +23378,22 @@ var ts; result.push(createModifier(121 /* SyntaxKind.PrivateKeyword */)); if (flags & 16 /* ModifierFlags.Protected */) result.push(createModifier(122 /* SyntaxKind.ProtectedKeyword */)); - if (flags & 128 /* ModifierFlags.Abstract */) + if (flags & 256 /* ModifierFlags.Abstract */) result.push(createModifier(126 /* SyntaxKind.AbstractKeyword */)); if (flags & 32 /* ModifierFlags.Static */) result.push(createModifier(124 /* SyntaxKind.StaticKeyword */)); if (flags & 16384 /* ModifierFlags.Override */) - result.push(createModifier(159 /* SyntaxKind.OverrideKeyword */)); + result.push(createModifier(161 /* SyntaxKind.OverrideKeyword */)); if (flags & 64 /* ModifierFlags.Readonly */) - result.push(createModifier(145 /* SyntaxKind.ReadonlyKeyword */)); - if (flags & 256 /* ModifierFlags.Async */) - result.push(createModifier(131 /* SyntaxKind.AsyncKeyword */)); + result.push(createModifier(146 /* SyntaxKind.ReadonlyKeyword */)); + if (flags & 128 /* ModifierFlags.Accessor */) + result.push(createModifier(127 /* SyntaxKind.AccessorKeyword */)); + if (flags & 512 /* ModifierFlags.Async */) + result.push(createModifier(132 /* SyntaxKind.AsyncKeyword */)); if (flags & 32768 /* ModifierFlags.In */) result.push(createModifier(101 /* SyntaxKind.InKeyword */)); if (flags & 65536 /* ModifierFlags.Out */) - result.push(createModifier(144 /* SyntaxKind.OutKeyword */)); + result.push(createModifier(145 /* SyntaxKind.OutKeyword */)); return result.length ? result : undefined; } // @@ -23197,7 +23401,7 @@ var ts; // // @api function createQualifiedName(left, right) { - var node = createBaseNode(161 /* SyntaxKind.QualifiedName */); + var node = createBaseNode(163 /* SyntaxKind.QualifiedName */); node.left = left; node.right = asName(right); node.transformFlags |= @@ -23214,7 +23418,7 @@ var ts; } // @api function createComputedPropertyName(expression) { - var node = createBaseNode(162 /* SyntaxKind.ComputedPropertyName */); + var node = createBaseNode(164 /* SyntaxKind.ComputedPropertyName */); node.expression = parenthesizerRules().parenthesizeExpressionOfComputedPropertyName(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23233,7 +23437,7 @@ var ts; // // @api function createTypeParameterDeclaration(modifiers, name, constraint, defaultType) { - var node = createBaseNamedDeclaration(163 /* SyntaxKind.TypeParameter */, modifiers, name); + var node = createBaseNamedDeclaration(165 /* SyntaxKind.TypeParameter */, modifiers, name); node.constraint = constraint; node.default = defaultType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23250,7 +23454,7 @@ var ts; } // @api function createParameterDeclaration(modifiers, dotDotDotToken, name, questionToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(164 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); + var node = createBaseVariableLikeDeclaration(166 /* SyntaxKind.Parameter */, modifiers, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.dotDotDotToken = dotDotDotToken; node.questionToken = questionToken; if (ts.isThisIdentifier(node.name)) { @@ -23282,7 +23486,7 @@ var ts; } // @api function createDecorator(expression) { - var node = createBaseNode(165 /* SyntaxKind.Decorator */); + var node = createBaseNode(167 /* SyntaxKind.Decorator */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -23302,7 +23506,7 @@ var ts; // // @api function createPropertySignature(modifiers, name, questionToken, type) { - var node = createBaseNamedDeclaration(166 /* SyntaxKind.PropertySignature */, modifiers, name); + var node = createBaseNamedDeclaration(168 /* SyntaxKind.PropertySignature */, modifiers, name); node.type = type; node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23328,7 +23532,7 @@ var ts; } // @api function createPropertyDeclaration(modifiers, name, questionOrExclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(167 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); + var node = createBaseVariableLikeDeclaration(169 /* SyntaxKind.PropertyDeclaration */, modifiers, name, type, initializer); node.questionToken = questionOrExclamationToken && ts.isQuestionToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.exclamationToken = questionOrExclamationToken && ts.isExclamationToken(questionOrExclamationToken) ? questionOrExclamationToken : undefined; node.transformFlags |= @@ -23356,7 +23560,7 @@ var ts; } // @api function createMethodSignature(modifiers, name, questionToken, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(168 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); + var node = createBaseSignatureDeclaration(170 /* SyntaxKind.MethodSignature */, modifiers, name, typeParameters, parameters, type); node.questionToken = questionToken; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23374,7 +23578,7 @@ var ts; } // @api function createMethodDeclaration(modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(169 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.MethodDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.questionToken = questionToken; node.transformFlags |= @@ -23384,7 +23588,7 @@ var ts; if (questionToken) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -23420,7 +23624,7 @@ var ts; } // @api function createClassStaticBlockDeclaration(body) { - var node = createBaseGenericNamedDeclaration(170 /* SyntaxKind.ClassStaticBlockDeclaration */, + var node = createBaseGenericNamedDeclaration(172 /* SyntaxKind.ClassStaticBlockDeclaration */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined); @@ -23446,7 +23650,7 @@ var ts; } // @api function createConstructorDeclaration(modifiers, parameters, body) { - var node = createBaseFunctionLikeDeclaration(171 /* SyntaxKind.Constructor */, modifiers, + var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.Constructor */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); @@ -23475,7 +23679,7 @@ var ts; } // @api function createGetAccessorDeclaration(modifiers, name, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(172 /* SyntaxKind.GetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(174 /* SyntaxKind.GetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, type, body); // The following properties are used only to report grammar errors node.typeParameters = undefined; @@ -23499,7 +23703,7 @@ var ts; } // @api function createSetAccessorDeclaration(modifiers, name, parameters, body) { - var node = createBaseFunctionLikeDeclaration(173 /* SyntaxKind.SetAccessor */, modifiers, name, + var node = createBaseFunctionLikeDeclaration(175 /* SyntaxKind.SetAccessor */, modifiers, name, /*typeParameters*/ undefined, parameters, /*type*/ undefined, body); // The following properties are used only to report grammar errors @@ -23525,7 +23729,7 @@ var ts; } // @api function createCallSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(174 /* SyntaxKind.CallSignature */, + var node = createBaseSignatureDeclaration(176 /* SyntaxKind.CallSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23541,7 +23745,7 @@ var ts; } // @api function createConstructSignature(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(175 /* SyntaxKind.ConstructSignature */, + var node = createBaseSignatureDeclaration(177 /* SyntaxKind.ConstructSignature */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23557,7 +23761,7 @@ var ts; } // @api function createIndexSignature(modifiers, parameters, type) { - var node = createBaseSignatureDeclaration(176 /* SyntaxKind.IndexSignature */, modifiers, + var node = createBaseSignatureDeclaration(178 /* SyntaxKind.IndexSignature */, modifiers, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23573,7 +23777,7 @@ var ts; } // @api function createTemplateLiteralTypeSpan(type, literal) { - var node = createBaseNode(199 /* SyntaxKind.TemplateLiteralTypeSpan */); + var node = createBaseNode(201 /* SyntaxKind.TemplateLiteralTypeSpan */); node.type = type; node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23595,7 +23799,7 @@ var ts; } // @api function createTypePredicateNode(assertsModifier, parameterName, type) { - var node = createBaseNode(177 /* SyntaxKind.TypePredicate */); + var node = createBaseNode(179 /* SyntaxKind.TypePredicate */); node.assertsModifier = assertsModifier; node.parameterName = asName(parameterName); node.type = type; @@ -23612,7 +23816,7 @@ var ts; } // @api function createTypeReferenceNode(typeName, typeArguments) { - var node = createBaseNode(178 /* SyntaxKind.TypeReference */); + var node = createBaseNode(180 /* SyntaxKind.TypeReference */); node.typeName = asName(typeName); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(createNodeArray(typeArguments)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23627,7 +23831,7 @@ var ts; } // @api function createFunctionTypeNode(typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(179 /* SyntaxKind.FunctionType */, + var node = createBaseSignatureDeclaration(181 /* SyntaxKind.FunctionType */, /*modifiers*/ undefined, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23660,7 +23864,7 @@ var ts; ts.Debug.fail("Incorrect number of arguments specified."); } function createConstructorTypeNode1(modifiers, typeParameters, parameters, type) { - var node = createBaseSignatureDeclaration(180 /* SyntaxKind.ConstructorType */, modifiers, + var node = createBaseSignatureDeclaration(182 /* SyntaxKind.ConstructorType */, modifiers, /*name*/ undefined, typeParameters, parameters, type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23693,7 +23897,7 @@ var ts; } // @api function createTypeQueryNode(exprName, typeArguments) { - var node = createBaseNode(181 /* SyntaxKind.TypeQuery */); + var node = createBaseNode(183 /* SyntaxKind.TypeQuery */); node.exprName = exprName; node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23708,7 +23912,7 @@ var ts; } // @api function createTypeLiteralNode(members) { - var node = createBaseNode(182 /* SyntaxKind.TypeLiteral */); + var node = createBaseNode(184 /* SyntaxKind.TypeLiteral */); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23721,7 +23925,7 @@ var ts; } // @api function createArrayTypeNode(elementType) { - var node = createBaseNode(183 /* SyntaxKind.ArrayType */); + var node = createBaseNode(185 /* SyntaxKind.ArrayType */); node.elementType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(elementType); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23734,7 +23938,7 @@ var ts; } // @api function createTupleTypeNode(elements) { - var node = createBaseNode(184 /* SyntaxKind.TupleType */); + var node = createBaseNode(186 /* SyntaxKind.TupleType */); node.elements = createNodeArray(parenthesizerRules().parenthesizeElementTypesOfTupleType(elements)); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23747,7 +23951,7 @@ var ts; } // @api function createNamedTupleMember(dotDotDotToken, name, questionToken, type) { - var node = createBaseNode(197 /* SyntaxKind.NamedTupleMember */); + var node = createBaseNode(199 /* SyntaxKind.NamedTupleMember */); node.dotDotDotToken = dotDotDotToken; node.name = name; node.questionToken = questionToken; @@ -23766,7 +23970,7 @@ var ts; } // @api function createOptionalTypeNode(type) { - var node = createBaseNode(185 /* SyntaxKind.OptionalType */); + var node = createBaseNode(187 /* SyntaxKind.OptionalType */); node.type = parenthesizerRules().parenthesizeTypeOfOptionalType(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23779,7 +23983,7 @@ var ts; } // @api function createRestTypeNode(type) { - var node = createBaseNode(186 /* SyntaxKind.RestType */); + var node = createBaseNode(188 /* SyntaxKind.RestType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23803,7 +24007,7 @@ var ts; } // @api function createUnionTypeNode(types) { - return createUnionOrIntersectionTypeNode(187 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); + return createUnionOrIntersectionTypeNode(189 /* SyntaxKind.UnionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfUnionType); } // @api function updateUnionTypeNode(node, types) { @@ -23811,7 +24015,7 @@ var ts; } // @api function createIntersectionTypeNode(types) { - return createUnionOrIntersectionTypeNode(188 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); + return createUnionOrIntersectionTypeNode(190 /* SyntaxKind.IntersectionType */, types, parenthesizerRules().parenthesizeConstituentTypesOfIntersectionType); } // @api function updateIntersectionTypeNode(node, types) { @@ -23819,7 +24023,7 @@ var ts; } // @api function createConditionalTypeNode(checkType, extendsType, trueType, falseType) { - var node = createBaseNode(189 /* SyntaxKind.ConditionalType */); + var node = createBaseNode(191 /* SyntaxKind.ConditionalType */); node.checkType = parenthesizerRules().parenthesizeCheckTypeOfConditionalType(checkType); node.extendsType = parenthesizerRules().parenthesizeExtendsTypeOfConditionalType(extendsType); node.trueType = trueType; @@ -23838,7 +24042,7 @@ var ts; } // @api function createInferTypeNode(typeParameter) { - var node = createBaseNode(190 /* SyntaxKind.InferType */); + var node = createBaseNode(192 /* SyntaxKind.InferType */); node.typeParameter = typeParameter; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23851,7 +24055,7 @@ var ts; } // @api function createTemplateLiteralType(head, templateSpans) { - var node = createBaseNode(198 /* SyntaxKind.TemplateLiteralType */); + var node = createBaseNode(200 /* SyntaxKind.TemplateLiteralType */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23867,7 +24071,7 @@ var ts; // @api function createImportTypeNode(argument, assertions, qualifier, typeArguments, isTypeOf) { if (isTypeOf === void 0) { isTypeOf = false; } - var node = createBaseNode(200 /* SyntaxKind.ImportType */); + var node = createBaseNode(202 /* SyntaxKind.ImportType */); node.argument = argument; node.assertions = assertions; node.qualifier = qualifier; @@ -23889,7 +24093,7 @@ var ts; } // @api function createParenthesizedType(type) { - var node = createBaseNode(191 /* SyntaxKind.ParenthesizedType */); + var node = createBaseNode(193 /* SyntaxKind.ParenthesizedType */); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23902,15 +24106,15 @@ var ts; } // @api function createThisTypeNode() { - var node = createBaseNode(192 /* SyntaxKind.ThisType */); + var node = createBaseNode(194 /* SyntaxKind.ThisType */); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; } // @api function createTypeOperatorNode(operator, type) { - var node = createBaseNode(193 /* SyntaxKind.TypeOperator */); + var node = createBaseNode(195 /* SyntaxKind.TypeOperator */); node.operator = operator; - node.type = operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + node.type = operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizerRules().parenthesizeOperandOfReadonlyTypeOperator(type) : parenthesizerRules().parenthesizeOperandOfTypeOperator(type); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23924,7 +24128,7 @@ var ts; } // @api function createIndexedAccessTypeNode(objectType, indexType) { - var node = createBaseNode(194 /* SyntaxKind.IndexedAccessType */); + var node = createBaseNode(196 /* SyntaxKind.IndexedAccessType */); node.objectType = parenthesizerRules().parenthesizeNonArrayTypeOfPostfixType(objectType); node.indexType = indexType; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -23939,7 +24143,7 @@ var ts; } // @api function createMappedTypeNode(readonlyToken, typeParameter, nameType, questionToken, type, members) { - var node = createBaseNode(195 /* SyntaxKind.MappedType */); + var node = createBaseNode(197 /* SyntaxKind.MappedType */); node.readonlyToken = readonlyToken; node.typeParameter = typeParameter; node.nameType = nameType; @@ -23962,7 +24166,7 @@ var ts; } // @api function createLiteralTypeNode(literal) { - var node = createBaseNode(196 /* SyntaxKind.LiteralType */); + var node = createBaseNode(198 /* SyntaxKind.LiteralType */); node.literal = literal; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; return node; @@ -23978,7 +24182,7 @@ var ts; // // @api function createObjectBindingPattern(elements) { - var node = createBaseNode(201 /* SyntaxKind.ObjectBindingPattern */); + var node = createBaseNode(203 /* SyntaxKind.ObjectBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -23999,7 +24203,7 @@ var ts; } // @api function createArrayBindingPattern(elements) { - var node = createBaseNode(202 /* SyntaxKind.ArrayBindingPattern */); + var node = createBaseNode(204 /* SyntaxKind.ArrayBindingPattern */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements) | @@ -24015,7 +24219,7 @@ var ts; } // @api function createBindingElement(dotDotDotToken, propertyName, name, initializer) { - var node = createBaseBindingLikeDeclaration(203 /* SyntaxKind.BindingElement */, + var node = createBaseBindingLikeDeclaration(205 /* SyntaxKind.BindingElement */, /*modifiers*/ undefined, name, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.propertyName = asName(propertyName); node.dotDotDotToken = dotDotDotToken; @@ -24050,7 +24254,7 @@ var ts; } // @api function createArrayLiteralExpression(elements, multiLine) { - var node = createBaseExpression(204 /* SyntaxKind.ArrayLiteralExpression */); + var node = createBaseExpression(206 /* SyntaxKind.ArrayLiteralExpression */); // Ensure we add a trailing comma for something like `[NumericLiteral(1), NumericLiteral(2), OmittedExpresion]` so that // we end up with `[1, 2, ,]` instead of `[1, 2, ]` otherwise the `OmittedExpression` will just end up being treated like // a trailing comma. @@ -24069,7 +24273,7 @@ var ts; } // @api function createObjectLiteralExpression(properties, multiLine) { - var node = createBaseExpression(205 /* SyntaxKind.ObjectLiteralExpression */); + var node = createBaseExpression(207 /* SyntaxKind.ObjectLiteralExpression */); node.properties = createNodeArray(properties); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.properties); @@ -24083,7 +24287,7 @@ var ts; } // @api function createPropertyAccessExpression(expression, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.name = asName(name); node.transformFlags = @@ -24112,7 +24316,7 @@ var ts; } // @api function createPropertyAccessChain(expression, questionDotToken, name) { - var node = createBaseExpression(206 /* SyntaxKind.PropertyAccessExpression */); + var node = createBaseExpression(208 /* SyntaxKind.PropertyAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24139,7 +24343,7 @@ var ts; } // @api function createElementAccessExpression(expression, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.argumentExpression = asExpression(index); node.transformFlags |= @@ -24166,7 +24370,7 @@ var ts; } // @api function createElementAccessChain(expression, questionDotToken, index) { - var node = createBaseExpression(207 /* SyntaxKind.ElementAccessExpression */); + var node = createBaseExpression(209 /* SyntaxKind.ElementAccessExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24191,7 +24395,7 @@ var ts; } // @api function createCallExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.arguments = parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(createNodeArray(argumentsArray)); @@ -24223,7 +24427,7 @@ var ts; } // @api function createCallChain(expression, questionDotToken, typeArguments, argumentsArray) { - var node = createBaseExpression(208 /* SyntaxKind.CallExpression */); + var node = createBaseExpression(210 /* SyntaxKind.CallExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.questionDotToken = questionDotToken; @@ -24255,7 +24459,7 @@ var ts; } // @api function createNewExpression(expression, typeArguments, argumentsArray) { - var node = createBaseExpression(209 /* SyntaxKind.NewExpression */); + var node = createBaseExpression(211 /* SyntaxKind.NewExpression */); node.expression = parenthesizerRules().parenthesizeExpressionOfNew(expression); node.typeArguments = asNodeArray(typeArguments); node.arguments = argumentsArray ? parenthesizerRules().parenthesizeExpressionsOfCommaDelimitedList(argumentsArray) : undefined; @@ -24279,7 +24483,7 @@ var ts; } // @api function createTaggedTemplateExpression(tag, typeArguments, template) { - var node = createBaseExpression(210 /* SyntaxKind.TaggedTemplateExpression */); + var node = createBaseExpression(212 /* SyntaxKind.TaggedTemplateExpression */); node.tag = parenthesizerRules().parenthesizeLeftSideOfAccess(tag, /*optionalChain*/ false); node.typeArguments = asNodeArray(typeArguments); node.template = template; @@ -24306,7 +24510,7 @@ var ts; } // @api function createTypeAssertion(type, expression) { - var node = createBaseExpression(211 /* SyntaxKind.TypeAssertionExpression */); + var node = createBaseExpression(213 /* SyntaxKind.TypeAssertionExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.type = type; node.transformFlags |= @@ -24324,7 +24528,7 @@ var ts; } // @api function createParenthesizedExpression(expression) { - var node = createBaseExpression(212 /* SyntaxKind.ParenthesizedExpression */); + var node = createBaseExpression(214 /* SyntaxKind.ParenthesizedExpression */); node.expression = expression; node.transformFlags = propagateChildFlags(node.expression); return node; @@ -24337,13 +24541,13 @@ var ts; } // @api function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(213 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(215 /* SyntaxKind.FunctionExpression */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; node.transformFlags |= propagateChildFlags(node.asteriskToken); if (node.typeParameters) { node.transformFlags |= 1 /* TransformFlags.ContainsTypeScript */; } - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -24370,13 +24574,13 @@ var ts; } // @api function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) { - var node = createBaseFunctionLikeDeclaration(214 /* SyntaxKind.ArrowFunction */, modifiers, + var node = createBaseFunctionLikeDeclaration(216 /* SyntaxKind.ArrowFunction */, modifiers, /*name*/ undefined, typeParameters, parameters, type, parenthesizerRules().parenthesizeConciseBodyOfArrowFunction(body)); node.equalsGreaterThanToken = equalsGreaterThanToken !== null && equalsGreaterThanToken !== void 0 ? equalsGreaterThanToken : createToken(38 /* SyntaxKind.EqualsGreaterThanToken */); node.transformFlags |= propagateChildFlags(node.equalsGreaterThanToken) | 1024 /* TransformFlags.ContainsES2015 */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { node.transformFlags |= 256 /* TransformFlags.ContainsES2017 */ | 16384 /* TransformFlags.ContainsLexicalThis */; } return node; @@ -24394,7 +24598,7 @@ var ts; } // @api function createDeleteExpression(expression) { - var node = createBaseExpression(215 /* SyntaxKind.DeleteExpression */); + var node = createBaseExpression(217 /* SyntaxKind.DeleteExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24407,7 +24611,7 @@ var ts; } // @api function createTypeOfExpression(expression) { - var node = createBaseExpression(216 /* SyntaxKind.TypeOfExpression */); + var node = createBaseExpression(218 /* SyntaxKind.TypeOfExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24420,7 +24624,7 @@ var ts; } // @api function createVoidExpression(expression) { - var node = createBaseExpression(217 /* SyntaxKind.VoidExpression */); + var node = createBaseExpression(219 /* SyntaxKind.VoidExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24433,7 +24637,7 @@ var ts; } // @api function createAwaitExpression(expression) { - var node = createBaseExpression(218 /* SyntaxKind.AwaitExpression */); + var node = createBaseExpression(220 /* SyntaxKind.AwaitExpression */); node.expression = parenthesizerRules().parenthesizeOperandOfPrefixUnary(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24450,7 +24654,7 @@ var ts; } // @api function createPrefixUnaryExpression(operator, operand) { - var node = createBaseExpression(219 /* SyntaxKind.PrefixUnaryExpression */); + var node = createBaseExpression(221 /* SyntaxKind.PrefixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPrefixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24472,7 +24676,7 @@ var ts; } // @api function createPostfixUnaryExpression(operand, operator) { - var node = createBaseExpression(220 /* SyntaxKind.PostfixUnaryExpression */); + var node = createBaseExpression(222 /* SyntaxKind.PostfixUnaryExpression */); node.operator = operator; node.operand = parenthesizerRules().parenthesizeOperandOfPostfixUnary(operand); node.transformFlags |= propagateChildFlags(node.operand); @@ -24493,7 +24697,7 @@ var ts; } // @api function createBinaryExpression(left, operator, right) { - var node = createBaseExpression(221 /* SyntaxKind.BinaryExpression */); + var node = createBaseExpression(223 /* SyntaxKind.BinaryExpression */); var operatorToken = asToken(operator); var operatorKind = operatorToken.kind; node.left = parenthesizerRules().parenthesizeLeftSideOfBinary(operatorKind, left); @@ -24565,7 +24769,7 @@ var ts; } // @api function createConditionalExpression(condition, questionToken, whenTrue, colonToken, whenFalse) { - var node = createBaseExpression(222 /* SyntaxKind.ConditionalExpression */); + var node = createBaseExpression(224 /* SyntaxKind.ConditionalExpression */); node.condition = parenthesizerRules().parenthesizeConditionOfConditionalExpression(condition); node.questionToken = questionToken !== null && questionToken !== void 0 ? questionToken : createToken(57 /* SyntaxKind.QuestionToken */); node.whenTrue = parenthesizerRules().parenthesizeBranchOfConditionalExpression(whenTrue); @@ -24591,7 +24795,7 @@ var ts; } // @api function createTemplateExpression(head, templateSpans) { - var node = createBaseExpression(223 /* SyntaxKind.TemplateExpression */); + var node = createBaseExpression(225 /* SyntaxKind.TemplateExpression */); node.head = head; node.templateSpans = createNodeArray(templateSpans); node.transformFlags |= @@ -24661,7 +24865,7 @@ var ts; // @api function createYieldExpression(asteriskToken, expression) { ts.Debug.assert(!asteriskToken || !!expression, "A `YieldExpression` with an asteriskToken must have an expression."); - var node = createBaseExpression(224 /* SyntaxKind.YieldExpression */); + var node = createBaseExpression(226 /* SyntaxKind.YieldExpression */); node.expression = expression && parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.asteriskToken = asteriskToken; node.transformFlags |= @@ -24681,7 +24885,7 @@ var ts; } // @api function createSpreadElement(expression) { - var node = createBaseExpression(225 /* SyntaxKind.SpreadElement */); + var node = createBaseExpression(227 /* SyntaxKind.SpreadElement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24697,7 +24901,7 @@ var ts; } // @api function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(226 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(228 /* SyntaxKind.ClassExpression */, modifiers, name, typeParameters, heritageClauses, members); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -24713,11 +24917,11 @@ var ts; } // @api function createOmittedExpression() { - return createBaseExpression(227 /* SyntaxKind.OmittedExpression */); + return createBaseExpression(229 /* SyntaxKind.OmittedExpression */); } // @api function createExpressionWithTypeArguments(expression, typeArguments) { - var node = createBaseNode(228 /* SyntaxKind.ExpressionWithTypeArguments */); + var node = createBaseNode(230 /* SyntaxKind.ExpressionWithTypeArguments */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.typeArguments = typeArguments && parenthesizerRules().parenthesizeTypeArguments(typeArguments); node.transformFlags |= @@ -24735,7 +24939,7 @@ var ts; } // @api function createAsExpression(expression, type) { - var node = createBaseExpression(229 /* SyntaxKind.AsExpression */); + var node = createBaseExpression(231 /* SyntaxKind.AsExpression */); node.expression = expression; node.type = type; node.transformFlags |= @@ -24753,7 +24957,7 @@ var ts; } // @api function createNonNullExpression(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ false); node.transformFlags |= propagateChildFlags(node.expression) | @@ -24770,8 +24974,26 @@ var ts; : node; } // @api + function createSatisfiesExpression(expression, type) { + var node = createBaseExpression(235 /* SyntaxKind.SatisfiesExpression */); + node.expression = expression; + node.type = type; + node.transformFlags |= + propagateChildFlags(node.expression) | + propagateChildFlags(node.type) | + 1 /* TransformFlags.ContainsTypeScript */; + return node; + } + // @api + function updateSatisfiesExpression(node, expression, type) { + return node.expression !== expression + || node.type !== type + ? update(createSatisfiesExpression(expression, type), node) + : node; + } + // @api function createNonNullChain(expression) { - var node = createBaseExpression(230 /* SyntaxKind.NonNullExpression */); + var node = createBaseExpression(232 /* SyntaxKind.NonNullExpression */); node.flags |= 32 /* NodeFlags.OptionalChain */; node.expression = parenthesizerRules().parenthesizeLeftSideOfAccess(expression, /*optionalChain*/ true); node.transformFlags |= @@ -24788,7 +25010,7 @@ var ts; } // @api function createMetaProperty(keywordToken, name) { - var node = createBaseExpression(231 /* SyntaxKind.MetaProperty */); + var node = createBaseExpression(233 /* SyntaxKind.MetaProperty */); node.keywordToken = keywordToken; node.name = name; node.transformFlags |= propagateChildFlags(node.name); @@ -24815,7 +25037,7 @@ var ts; // // @api function createTemplateSpan(expression, literal) { - var node = createBaseNode(233 /* SyntaxKind.TemplateSpan */); + var node = createBaseNode(236 /* SyntaxKind.TemplateSpan */); node.expression = expression; node.literal = literal; node.transformFlags |= @@ -24833,7 +25055,7 @@ var ts; } // @api function createSemicolonClassElement() { - var node = createBaseNode(234 /* SyntaxKind.SemicolonClassElement */); + var node = createBaseNode(237 /* SyntaxKind.SemicolonClassElement */); node.transformFlags |= 1024 /* TransformFlags.ContainsES2015 */; return node; } @@ -24842,7 +25064,7 @@ var ts; // // @api function createBlock(statements, multiLine) { - var node = createBaseNode(235 /* SyntaxKind.Block */); + var node = createBaseNode(238 /* SyntaxKind.Block */); node.statements = createNodeArray(statements); node.multiLine = multiLine; node.transformFlags |= propagateChildrenFlags(node.statements); @@ -24856,7 +25078,7 @@ var ts; } // @api function createVariableStatement(modifiers, declarationList) { - var node = createBaseDeclaration(237 /* SyntaxKind.VariableStatement */); + var node = createBaseDeclaration(240 /* SyntaxKind.VariableStatement */); node.modifiers = asNodeArray(modifiers); node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList; node.transformFlags |= @@ -24876,11 +25098,11 @@ var ts; } // @api function createEmptyStatement() { - return createBaseNode(236 /* SyntaxKind.EmptyStatement */); + return createBaseNode(239 /* SyntaxKind.EmptyStatement */); } // @api function createExpressionStatement(expression) { - var node = createBaseNode(238 /* SyntaxKind.ExpressionStatement */); + var node = createBaseNode(241 /* SyntaxKind.ExpressionStatement */); node.expression = parenthesizerRules().parenthesizeExpressionOfExpressionStatement(expression); node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -24893,7 +25115,7 @@ var ts; } // @api function createIfStatement(expression, thenStatement, elseStatement) { - var node = createBaseNode(239 /* SyntaxKind.IfStatement */); + var node = createBaseNode(242 /* SyntaxKind.IfStatement */); node.expression = expression; node.thenStatement = asEmbeddedStatement(thenStatement); node.elseStatement = asEmbeddedStatement(elseStatement); @@ -24913,7 +25135,7 @@ var ts; } // @api function createDoStatement(statement, expression) { - var node = createBaseNode(240 /* SyntaxKind.DoStatement */); + var node = createBaseNode(243 /* SyntaxKind.DoStatement */); node.statement = asEmbeddedStatement(statement); node.expression = expression; node.transformFlags |= @@ -24930,7 +25152,7 @@ var ts; } // @api function createWhileStatement(expression, statement) { - var node = createBaseNode(241 /* SyntaxKind.WhileStatement */); + var node = createBaseNode(244 /* SyntaxKind.WhileStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -24947,7 +25169,7 @@ var ts; } // @api function createForStatement(initializer, condition, incrementor, statement) { - var node = createBaseNode(242 /* SyntaxKind.ForStatement */); + var node = createBaseNode(245 /* SyntaxKind.ForStatement */); node.initializer = initializer; node.condition = condition; node.incrementor = incrementor; @@ -24970,7 +25192,7 @@ var ts; } // @api function createForInStatement(initializer, expression, statement) { - var node = createBaseNode(243 /* SyntaxKind.ForInStatement */); + var node = createBaseNode(246 /* SyntaxKind.ForInStatement */); node.initializer = initializer; node.expression = expression; node.statement = asEmbeddedStatement(statement); @@ -24990,7 +25212,7 @@ var ts; } // @api function createForOfStatement(awaitModifier, initializer, expression, statement) { - var node = createBaseNode(244 /* SyntaxKind.ForOfStatement */); + var node = createBaseNode(247 /* SyntaxKind.ForOfStatement */); node.awaitModifier = awaitModifier; node.initializer = initializer; node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); @@ -25016,7 +25238,7 @@ var ts; } // @api function createContinueStatement(label) { - var node = createBaseNode(245 /* SyntaxKind.ContinueStatement */); + var node = createBaseNode(248 /* SyntaxKind.ContinueStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25031,7 +25253,7 @@ var ts; } // @api function createBreakStatement(label) { - var node = createBaseNode(246 /* SyntaxKind.BreakStatement */); + var node = createBaseNode(249 /* SyntaxKind.BreakStatement */); node.label = asName(label); node.transformFlags |= propagateChildFlags(node.label) | @@ -25046,7 +25268,7 @@ var ts; } // @api function createReturnStatement(expression) { - var node = createBaseNode(247 /* SyntaxKind.ReturnStatement */); + var node = createBaseNode(250 /* SyntaxKind.ReturnStatement */); node.expression = expression; // return in an ES2018 async generator must be awaited node.transformFlags |= @@ -25063,7 +25285,7 @@ var ts; } // @api function createWithStatement(expression, statement) { - var node = createBaseNode(248 /* SyntaxKind.WithStatement */); + var node = createBaseNode(251 /* SyntaxKind.WithStatement */); node.expression = expression; node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25080,7 +25302,7 @@ var ts; } // @api function createSwitchStatement(expression, caseBlock) { - var node = createBaseNode(249 /* SyntaxKind.SwitchStatement */); + var node = createBaseNode(252 /* SyntaxKind.SwitchStatement */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.caseBlock = caseBlock; node.transformFlags |= @@ -25097,7 +25319,7 @@ var ts; } // @api function createLabeledStatement(label, statement) { - var node = createBaseNode(250 /* SyntaxKind.LabeledStatement */); + var node = createBaseNode(253 /* SyntaxKind.LabeledStatement */); node.label = asName(label); node.statement = asEmbeddedStatement(statement); node.transformFlags |= @@ -25114,7 +25336,7 @@ var ts; } // @api function createThrowStatement(expression) { - var node = createBaseNode(251 /* SyntaxKind.ThrowStatement */); + var node = createBaseNode(254 /* SyntaxKind.ThrowStatement */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); return node; @@ -25127,7 +25349,7 @@ var ts; } // @api function createTryStatement(tryBlock, catchClause, finallyBlock) { - var node = createBaseNode(252 /* SyntaxKind.TryStatement */); + var node = createBaseNode(255 /* SyntaxKind.TryStatement */); node.tryBlock = tryBlock; node.catchClause = catchClause; node.finallyBlock = finallyBlock; @@ -25147,11 +25369,11 @@ var ts; } // @api function createDebuggerStatement() { - return createBaseNode(253 /* SyntaxKind.DebuggerStatement */); + return createBaseNode(256 /* SyntaxKind.DebuggerStatement */); } // @api function createVariableDeclaration(name, exclamationToken, type, initializer) { - var node = createBaseVariableLikeDeclaration(254 /* SyntaxKind.VariableDeclaration */, + var node = createBaseVariableLikeDeclaration(257 /* SyntaxKind.VariableDeclaration */, /*modifiers*/ undefined, name, type, initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer)); node.exclamationToken = exclamationToken; node.transformFlags |= propagateChildFlags(node.exclamationToken); @@ -25172,7 +25394,7 @@ var ts; // @api function createVariableDeclarationList(declarations, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseNode(255 /* SyntaxKind.VariableDeclarationList */); + var node = createBaseNode(258 /* SyntaxKind.VariableDeclarationList */); node.flags |= flags & 3 /* NodeFlags.BlockScoped */; node.declarations = createNodeArray(declarations); node.transformFlags |= @@ -25193,7 +25415,7 @@ var ts; } // @api function createFunctionDeclaration(modifiers, asteriskToken, name, typeParameters, parameters, type, body) { - var node = createBaseFunctionLikeDeclaration(256 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); + var node = createBaseFunctionLikeDeclaration(259 /* SyntaxKind.FunctionDeclaration */, modifiers, name, typeParameters, parameters, type, body); node.asteriskToken = asteriskToken; if (!node.body || ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; @@ -25202,7 +25424,7 @@ var ts; node.transformFlags |= propagateChildFlags(node.asteriskToken) | 4194304 /* TransformFlags.ContainsHoistedDeclarationOrCompletion */; - if (ts.modifiersToFlags(node.modifiers) & 256 /* ModifierFlags.Async */) { + if (ts.modifiersToFlags(node.modifiers) & 512 /* ModifierFlags.Async */) { if (node.asteriskToken) { node.transformFlags |= 128 /* TransformFlags.ContainsES2018 */; } @@ -25239,7 +25461,7 @@ var ts; } // @api function createClassDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseClassLikeDeclaration(257 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); + var node = createBaseClassLikeDeclaration(260 /* SyntaxKind.ClassDeclaration */, modifiers, name, typeParameters, heritageClauses, members); if (ts.modifiersToFlags(node.modifiers) & 2 /* ModifierFlags.Ambient */) { node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; } @@ -25263,7 +25485,7 @@ var ts; } // @api function createInterfaceDeclaration(modifiers, name, typeParameters, heritageClauses, members) { - var node = createBaseInterfaceOrClassLikeDeclaration(258 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); + var node = createBaseInterfaceOrClassLikeDeclaration(261 /* SyntaxKind.InterfaceDeclaration */, modifiers, name, typeParameters, heritageClauses); node.members = createNodeArray(members); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25288,7 +25510,7 @@ var ts; } // @api function createTypeAliasDeclaration(modifiers, name, typeParameters, type) { - var node = createBaseGenericNamedDeclaration(259 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); + var node = createBaseGenericNamedDeclaration(262 /* SyntaxKind.TypeAliasDeclaration */, modifiers, name, typeParameters); node.type = type; node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25312,7 +25534,7 @@ var ts; } // @api function createEnumDeclaration(modifiers, name, members) { - var node = createBaseNamedDeclaration(260 /* SyntaxKind.EnumDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(263 /* SyntaxKind.EnumDeclaration */, modifiers, name); node.members = createNodeArray(members); node.transformFlags |= propagateChildrenFlags(node.members) | @@ -25339,7 +25561,7 @@ var ts; // @api function createModuleDeclaration(modifiers, name, body, flags) { if (flags === void 0) { flags = 0 /* NodeFlags.None */; } - var node = createBaseDeclaration(261 /* SyntaxKind.ModuleDeclaration */); + var node = createBaseDeclaration(264 /* SyntaxKind.ModuleDeclaration */); node.modifiers = asNodeArray(modifiers); node.flags |= flags & (16 /* NodeFlags.Namespace */ | 4 /* NodeFlags.NestedNamespace */ | 1024 /* NodeFlags.GlobalAugmentation */); node.name = name; @@ -25375,7 +25597,7 @@ var ts; } // @api function createModuleBlock(statements) { - var node = createBaseNode(262 /* SyntaxKind.ModuleBlock */); + var node = createBaseNode(265 /* SyntaxKind.ModuleBlock */); node.statements = createNodeArray(statements); node.transformFlags |= propagateChildrenFlags(node.statements); return node; @@ -25388,7 +25610,7 @@ var ts; } // @api function createCaseBlock(clauses) { - var node = createBaseNode(263 /* SyntaxKind.CaseBlock */); + var node = createBaseNode(266 /* SyntaxKind.CaseBlock */); node.clauses = createNodeArray(clauses); node.transformFlags |= propagateChildrenFlags(node.clauses); return node; @@ -25401,7 +25623,7 @@ var ts; } // @api function createNamespaceExportDeclaration(name) { - var node = createBaseNamedDeclaration(264 /* SyntaxKind.NamespaceExportDeclaration */, + var node = createBaseNamedDeclaration(267 /* SyntaxKind.NamespaceExportDeclaration */, /*modifiers*/ undefined, name); node.transformFlags = 1 /* TransformFlags.ContainsTypeScript */; // The following properties are used only to report grammar errors @@ -25424,7 +25646,7 @@ var ts; } // @api function createImportEqualsDeclaration(modifiers, isTypeOnly, name, moduleReference) { - var node = createBaseNamedDeclaration(265 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); + var node = createBaseNamedDeclaration(268 /* SyntaxKind.ImportEqualsDeclaration */, modifiers, name); node.isTypeOnly = isTypeOnly; node.moduleReference = moduleReference; node.transformFlags |= propagateChildFlags(node.moduleReference); @@ -25452,7 +25674,7 @@ var ts; } // @api function createImportDeclaration(modifiers, importClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(266 /* SyntaxKind.ImportDeclaration */); + var node = createBaseDeclaration(269 /* SyntaxKind.ImportDeclaration */); node.modifiers = asNodeArray(modifiers); node.importClause = importClause; node.moduleSpecifier = moduleSpecifier; @@ -25482,7 +25704,7 @@ var ts; } // @api function createImportClause(isTypeOnly, name, namedBindings) { - var node = createBaseNode(267 /* SyntaxKind.ImportClause */); + var node = createBaseNode(270 /* SyntaxKind.ImportClause */); node.isTypeOnly = isTypeOnly; node.name = name; node.namedBindings = namedBindings; @@ -25505,7 +25727,7 @@ var ts; } // @api function createAssertClause(elements, multiLine) { - var node = createBaseNode(293 /* SyntaxKind.AssertClause */); + var node = createBaseNode(296 /* SyntaxKind.AssertClause */); node.elements = createNodeArray(elements); node.multiLine = multiLine; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25520,7 +25742,7 @@ var ts; } // @api function createAssertEntry(name, value) { - var node = createBaseNode(294 /* SyntaxKind.AssertEntry */); + var node = createBaseNode(297 /* SyntaxKind.AssertEntry */); node.name = name; node.value = value; node.transformFlags |= 4 /* TransformFlags.ContainsESNext */; @@ -25535,7 +25757,7 @@ var ts; } // @api function createImportTypeAssertionContainer(clause, multiLine) { - var node = createBaseNode(295 /* SyntaxKind.ImportTypeAssertionContainer */); + var node = createBaseNode(298 /* SyntaxKind.ImportTypeAssertionContainer */); node.assertClause = clause; node.multiLine = multiLine; return node; @@ -25549,7 +25771,7 @@ var ts; } // @api function createNamespaceImport(name) { - var node = createBaseNode(268 /* SyntaxKind.NamespaceImport */); + var node = createBaseNode(271 /* SyntaxKind.NamespaceImport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25563,7 +25785,7 @@ var ts; } // @api function createNamespaceExport(name) { - var node = createBaseNode(274 /* SyntaxKind.NamespaceExport */); + var node = createBaseNode(277 /* SyntaxKind.NamespaceExport */); node.name = name; node.transformFlags |= propagateChildFlags(node.name) | @@ -25579,7 +25801,7 @@ var ts; } // @api function createNamedImports(elements) { - var node = createBaseNode(269 /* SyntaxKind.NamedImports */); + var node = createBaseNode(272 /* SyntaxKind.NamedImports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25593,7 +25815,7 @@ var ts; } // @api function createImportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(270 /* SyntaxKind.ImportSpecifier */); + var node = createBaseNode(273 /* SyntaxKind.ImportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = propertyName; node.name = name; @@ -25613,7 +25835,7 @@ var ts; } // @api function createExportAssignment(modifiers, isExportEquals, expression) { - var node = createBaseDeclaration(271 /* SyntaxKind.ExportAssignment */); + var node = createBaseDeclaration(274 /* SyntaxKind.ExportAssignment */); node.modifiers = asNodeArray(modifiers); node.isExportEquals = isExportEquals; node.expression = isExportEquals @@ -25640,7 +25862,7 @@ var ts; } // @api function createExportDeclaration(modifiers, isTypeOnly, exportClause, moduleSpecifier, assertClause) { - var node = createBaseDeclaration(272 /* SyntaxKind.ExportDeclaration */); + var node = createBaseDeclaration(275 /* SyntaxKind.ExportDeclaration */); node.modifiers = asNodeArray(modifiers); node.isTypeOnly = isTypeOnly; node.exportClause = exportClause; @@ -25673,7 +25895,7 @@ var ts; } // @api function createNamedExports(elements) { - var node = createBaseNode(273 /* SyntaxKind.NamedExports */); + var node = createBaseNode(276 /* SyntaxKind.NamedExports */); node.elements = createNodeArray(elements); node.transformFlags |= propagateChildrenFlags(node.elements); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25687,7 +25909,7 @@ var ts; } // @api function createExportSpecifier(isTypeOnly, propertyName, name) { - var node = createBaseNode(275 /* SyntaxKind.ExportSpecifier */); + var node = createBaseNode(278 /* SyntaxKind.ExportSpecifier */); node.isTypeOnly = isTypeOnly; node.propertyName = asName(propertyName); node.name = asName(name); @@ -25707,7 +25929,7 @@ var ts; } // @api function createMissingDeclaration() { - var node = createBaseDeclaration(276 /* SyntaxKind.MissingDeclaration */); + var node = createBaseDeclaration(279 /* SyntaxKind.MissingDeclaration */); return node; } // @@ -25715,7 +25937,7 @@ var ts; // // @api function createExternalModuleReference(expression) { - var node = createBaseNode(277 /* SyntaxKind.ExternalModuleReference */); + var node = createBaseNode(280 /* SyntaxKind.ExternalModuleReference */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression); node.transformFlags &= ~67108864 /* TransformFlags.ContainsPossibleTopLevelAwait */; // always parsed in an Await context @@ -25773,7 +25995,7 @@ var ts; } // @api function createJSDocFunctionType(parameters, type) { - var node = createBaseSignatureDeclaration(317 /* SyntaxKind.JSDocFunctionType */, + var node = createBaseSignatureDeclaration(320 /* SyntaxKind.JSDocFunctionType */, /*modifiers*/ undefined, /*name*/ undefined, /*typeParameters*/ undefined, parameters, type); @@ -25789,7 +26011,7 @@ var ts; // @api function createJSDocTypeLiteral(propertyTags, isArrayType) { if (isArrayType === void 0) { isArrayType = false; } - var node = createBaseNode(322 /* SyntaxKind.JSDocTypeLiteral */); + var node = createBaseNode(325 /* SyntaxKind.JSDocTypeLiteral */); node.jsDocPropertyTags = asNodeArray(propertyTags); node.isArrayType = isArrayType; return node; @@ -25803,7 +26025,7 @@ var ts; } // @api function createJSDocTypeExpression(type) { - var node = createBaseNode(309 /* SyntaxKind.JSDocTypeExpression */); + var node = createBaseNode(312 /* SyntaxKind.JSDocTypeExpression */); node.type = type; return node; } @@ -25815,7 +26037,7 @@ var ts; } // @api function createJSDocSignature(typeParameters, parameters, type) { - var node = createBaseNode(323 /* SyntaxKind.JSDocSignature */); + var node = createBaseNode(326 /* SyntaxKind.JSDocSignature */); node.typeParameters = asNodeArray(typeParameters); node.parameters = createNodeArray(parameters); node.type = type; @@ -25844,7 +26066,7 @@ var ts; } // @api function createJSDocTemplateTag(tagName, constraint, typeParameters, comment) { - var node = createBaseJSDocTag(344 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); + var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocTemplateTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("template"), comment); node.constraint = constraint; node.typeParameters = createNodeArray(typeParameters); return node; @@ -25861,7 +26083,7 @@ var ts; } // @api function createJSDocTypedefTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(345 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); + var node = createBaseJSDocTag(348 /* SyntaxKind.JSDocTypedefTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("typedef"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -25879,7 +26101,7 @@ var ts; } // @api function createJSDocParameterTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(340 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); + var node = createBaseJSDocTag(343 /* SyntaxKind.JSDocParameterTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("param"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -25900,7 +26122,7 @@ var ts; } // @api function createJSDocPropertyTag(tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - var node = createBaseJSDocTag(347 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); + var node = createBaseJSDocTag(350 /* SyntaxKind.JSDocPropertyTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("prop"), comment); node.typeExpression = typeExpression; node.name = name; node.isNameFirst = !!isNameFirst; @@ -25921,7 +26143,7 @@ var ts; } // @api function createJSDocCallbackTag(tagName, typeExpression, fullName, comment) { - var node = createBaseJSDocTag(338 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); + var node = createBaseJSDocTag(341 /* SyntaxKind.JSDocCallbackTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("callback"), comment); node.typeExpression = typeExpression; node.fullName = fullName; node.name = ts.getJSDocTypeAliasName(fullName); @@ -25939,7 +26161,7 @@ var ts; } // @api function createJSDocAugmentsTag(tagName, className, comment) { - var node = createBaseJSDocTag(328 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); + var node = createBaseJSDocTag(331 /* SyntaxKind.JSDocAugmentsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("augments"), comment); node.class = className; return node; } @@ -25954,13 +26176,13 @@ var ts; } // @api function createJSDocImplementsTag(tagName, className, comment) { - var node = createBaseJSDocTag(329 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); + var node = createBaseJSDocTag(332 /* SyntaxKind.JSDocImplementsTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("implements"), comment); node.class = className; return node; } // @api function createJSDocSeeTag(tagName, name, comment) { - var node = createBaseJSDocTag(346 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); + var node = createBaseJSDocTag(349 /* SyntaxKind.JSDocSeeTag */, tagName !== null && tagName !== void 0 ? tagName : createIdentifier("see"), comment); node.name = name; return node; } @@ -25974,7 +26196,7 @@ var ts; } // @api function createJSDocNameReference(name) { - var node = createBaseNode(310 /* SyntaxKind.JSDocNameReference */); + var node = createBaseNode(313 /* SyntaxKind.JSDocNameReference */); node.name = name; return node; } @@ -25986,7 +26208,7 @@ var ts; } // @api function createJSDocMemberName(left, right) { - var node = createBaseNode(311 /* SyntaxKind.JSDocMemberName */); + var node = createBaseNode(314 /* SyntaxKind.JSDocMemberName */); node.left = left; node.right = right; node.transformFlags |= @@ -26003,7 +26225,7 @@ var ts; } // @api function createJSDocLink(name, text) { - var node = createBaseNode(324 /* SyntaxKind.JSDocLink */); + var node = createBaseNode(327 /* SyntaxKind.JSDocLink */); node.name = name; node.text = text; return node; @@ -26016,7 +26238,7 @@ var ts; } // @api function createJSDocLinkCode(name, text) { - var node = createBaseNode(325 /* SyntaxKind.JSDocLinkCode */); + var node = createBaseNode(328 /* SyntaxKind.JSDocLinkCode */); node.name = name; node.text = text; return node; @@ -26029,7 +26251,7 @@ var ts; } // @api function createJSDocLinkPlain(name, text) { - var node = createBaseNode(326 /* SyntaxKind.JSDocLinkPlain */); + var node = createBaseNode(329 /* SyntaxKind.JSDocLinkPlain */); node.name = name; node.text = text; return node; @@ -26101,7 +26323,7 @@ var ts; } // @api function createJSDocUnknownTag(tagName, comment) { - var node = createBaseJSDocTag(327 /* SyntaxKind.JSDocTag */, tagName, comment); + var node = createBaseJSDocTag(330 /* SyntaxKind.JSDocTag */, tagName, comment); return node; } // @api @@ -26113,7 +26335,7 @@ var ts; } // @api function createJSDocText(text) { - var node = createBaseNode(321 /* SyntaxKind.JSDocText */); + var node = createBaseNode(324 /* SyntaxKind.JSDocText */); node.text = text; return node; } @@ -26125,7 +26347,7 @@ var ts; } // @api function createJSDocComment(comment, tags) { - var node = createBaseNode(320 /* SyntaxKind.JSDoc */); + var node = createBaseNode(323 /* SyntaxKind.JSDoc */); node.comment = comment; node.tags = asNodeArray(tags); return node; @@ -26142,7 +26364,7 @@ var ts; // // @api function createJsxElement(openingElement, children, closingElement) { - var node = createBaseNode(278 /* SyntaxKind.JsxElement */); + var node = createBaseNode(281 /* SyntaxKind.JsxElement */); node.openingElement = openingElement; node.children = createNodeArray(children); node.closingElement = closingElement; @@ -26163,7 +26385,7 @@ var ts; } // @api function createJsxSelfClosingElement(tagName, typeArguments, attributes) { - var node = createBaseNode(279 /* SyntaxKind.JsxSelfClosingElement */); + var node = createBaseNode(282 /* SyntaxKind.JsxSelfClosingElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26187,7 +26409,7 @@ var ts; } // @api function createJsxOpeningElement(tagName, typeArguments, attributes) { - var node = createBaseNode(280 /* SyntaxKind.JsxOpeningElement */); + var node = createBaseNode(283 /* SyntaxKind.JsxOpeningElement */); node.tagName = tagName; node.typeArguments = asNodeArray(typeArguments); node.attributes = attributes; @@ -26211,7 +26433,7 @@ var ts; } // @api function createJsxClosingElement(tagName) { - var node = createBaseNode(281 /* SyntaxKind.JsxClosingElement */); + var node = createBaseNode(284 /* SyntaxKind.JsxClosingElement */); node.tagName = tagName; node.transformFlags |= propagateChildFlags(node.tagName) | @@ -26226,7 +26448,7 @@ var ts; } // @api function createJsxFragment(openingFragment, children, closingFragment) { - var node = createBaseNode(282 /* SyntaxKind.JsxFragment */); + var node = createBaseNode(285 /* SyntaxKind.JsxFragment */); node.openingFragment = openingFragment; node.children = createNodeArray(children); node.closingFragment = closingFragment; @@ -26262,19 +26484,19 @@ var ts; } // @api function createJsxOpeningFragment() { - var node = createBaseNode(283 /* SyntaxKind.JsxOpeningFragment */); + var node = createBaseNode(286 /* SyntaxKind.JsxOpeningFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxJsxClosingFragment() { - var node = createBaseNode(284 /* SyntaxKind.JsxClosingFragment */); + var node = createBaseNode(287 /* SyntaxKind.JsxClosingFragment */); node.transformFlags |= 2 /* TransformFlags.ContainsJsx */; return node; } // @api function createJsxAttribute(name, initializer) { - var node = createBaseNode(285 /* SyntaxKind.JsxAttribute */); + var node = createBaseNode(288 /* SyntaxKind.JsxAttribute */); node.name = name; node.initializer = initializer; node.transformFlags |= @@ -26292,7 +26514,7 @@ var ts; } // @api function createJsxAttributes(properties) { - var node = createBaseNode(286 /* SyntaxKind.JsxAttributes */); + var node = createBaseNode(289 /* SyntaxKind.JsxAttributes */); node.properties = createNodeArray(properties); node.transformFlags |= propagateChildrenFlags(node.properties) | @@ -26307,7 +26529,7 @@ var ts; } // @api function createJsxSpreadAttribute(expression) { - var node = createBaseNode(287 /* SyntaxKind.JsxSpreadAttribute */); + var node = createBaseNode(290 /* SyntaxKind.JsxSpreadAttribute */); node.expression = expression; node.transformFlags |= propagateChildFlags(node.expression) | @@ -26322,7 +26544,7 @@ var ts; } // @api function createJsxExpression(dotDotDotToken, expression) { - var node = createBaseNode(288 /* SyntaxKind.JsxExpression */); + var node = createBaseNode(291 /* SyntaxKind.JsxExpression */); node.dotDotDotToken = dotDotDotToken; node.expression = expression; node.transformFlags |= @@ -26342,7 +26564,7 @@ var ts; // // @api function createCaseClause(expression, statements) { - var node = createBaseNode(289 /* SyntaxKind.CaseClause */); + var node = createBaseNode(292 /* SyntaxKind.CaseClause */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.statements = createNodeArray(statements); node.transformFlags |= @@ -26359,7 +26581,7 @@ var ts; } // @api function createDefaultClause(statements) { - var node = createBaseNode(290 /* SyntaxKind.DefaultClause */); + var node = createBaseNode(293 /* SyntaxKind.DefaultClause */); node.statements = createNodeArray(statements); node.transformFlags = propagateChildrenFlags(node.statements); return node; @@ -26372,7 +26594,7 @@ var ts; } // @api function createHeritageClause(token, types) { - var node = createBaseNode(291 /* SyntaxKind.HeritageClause */); + var node = createBaseNode(294 /* SyntaxKind.HeritageClause */); node.token = token; node.types = createNodeArray(types); node.transformFlags |= propagateChildrenFlags(node.types); @@ -26396,7 +26618,7 @@ var ts; } // @api function createCatchClause(variableDeclaration, block) { - var node = createBaseNode(292 /* SyntaxKind.CatchClause */); + var node = createBaseNode(295 /* SyntaxKind.CatchClause */); if (typeof variableDeclaration === "string" || variableDeclaration && !ts.isVariableDeclaration(variableDeclaration)) { variableDeclaration = createVariableDeclaration(variableDeclaration, /*exclamationToken*/ undefined, @@ -26424,7 +26646,7 @@ var ts; // // @api function createPropertyAssignment(name, initializer) { - var node = createBaseNamedDeclaration(296 /* SyntaxKind.PropertyAssignment */, + var node = createBaseNamedDeclaration(299 /* SyntaxKind.PropertyAssignment */, /*modifiers*/ undefined, name); node.initializer = parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26456,7 +26678,7 @@ var ts; } // @api function createShorthandPropertyAssignment(name, objectAssignmentInitializer) { - var node = createBaseNamedDeclaration(297 /* SyntaxKind.ShorthandPropertyAssignment */, + var node = createBaseNamedDeclaration(300 /* SyntaxKind.ShorthandPropertyAssignment */, /*modifiers*/ undefined, name); node.objectAssignmentInitializer = objectAssignmentInitializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(objectAssignmentInitializer); node.transformFlags |= @@ -26490,7 +26712,7 @@ var ts; } // @api function createSpreadAssignment(expression) { - var node = createBaseNode(298 /* SyntaxKind.SpreadAssignment */); + var node = createBaseNode(301 /* SyntaxKind.SpreadAssignment */); node.expression = parenthesizerRules().parenthesizeExpressionForDisallowedComma(expression); node.transformFlags |= propagateChildFlags(node.expression) | @@ -26509,7 +26731,7 @@ var ts; // // @api function createEnumMember(name, initializer) { - var node = createBaseNode(299 /* SyntaxKind.EnumMember */); + var node = createBaseNode(302 /* SyntaxKind.EnumMember */); node.name = asName(name); node.initializer = initializer && parenthesizerRules().parenthesizeExpressionForDisallowedComma(initializer); node.transformFlags |= @@ -26530,7 +26752,7 @@ var ts; // // @api function createSourceFile(statements, endOfFileToken, flags) { - var node = baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */); + var node = baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */); node.statements = createNodeArray(statements); node.endOfFileToken = endOfFileToken; node.flags |= flags; @@ -26547,7 +26769,7 @@ var ts; return node; } function cloneSourceFileWithChanges(source, statements, isDeclarationFile, referencedFiles, typeReferences, hasNoDefaultLib, libReferences) { - var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */)); + var node = (source.redirectInfo ? Object.create(source.redirectInfo.redirectTarget) : baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */)); for (var p in source) { if (p === "emitNode" || ts.hasProperty(node, p) || !ts.hasProperty(source, p)) continue; @@ -26586,7 +26808,7 @@ var ts; // @api function createBundle(sourceFiles, prepends) { if (prepends === void 0) { prepends = ts.emptyArray; } - var node = createBaseNode(306 /* SyntaxKind.Bundle */); + var node = createBaseNode(309 /* SyntaxKind.Bundle */); node.prepends = prepends; node.sourceFiles = sourceFiles; return node; @@ -26601,7 +26823,7 @@ var ts; } // @api function createUnparsedSource(prologues, syntheticReferences, texts) { - var node = createBaseNode(307 /* SyntaxKind.UnparsedSource */); + var node = createBaseNode(310 /* SyntaxKind.UnparsedSource */); node.prologues = prologues; node.syntheticReferences = syntheticReferences; node.texts = texts; @@ -26619,28 +26841,28 @@ var ts; } // @api function createUnparsedPrologue(data) { - return createBaseUnparsedNode(300 /* SyntaxKind.UnparsedPrologue */, data); + return createBaseUnparsedNode(303 /* SyntaxKind.UnparsedPrologue */, data); } // @api function createUnparsedPrepend(data, texts) { - var node = createBaseUnparsedNode(301 /* SyntaxKind.UnparsedPrepend */, data); + var node = createBaseUnparsedNode(304 /* SyntaxKind.UnparsedPrepend */, data); node.texts = texts; return node; } // @api function createUnparsedTextLike(data, internal) { - return createBaseUnparsedNode(internal ? 303 /* SyntaxKind.UnparsedInternalText */ : 302 /* SyntaxKind.UnparsedText */, data); + return createBaseUnparsedNode(internal ? 306 /* SyntaxKind.UnparsedInternalText */ : 305 /* SyntaxKind.UnparsedText */, data); } // @api function createUnparsedSyntheticReference(section) { - var node = createBaseNode(304 /* SyntaxKind.UnparsedSyntheticReference */); + var node = createBaseNode(307 /* SyntaxKind.UnparsedSyntheticReference */); node.data = section.data; node.section = section; return node; } // @api function createInputFiles() { - var node = createBaseNode(308 /* SyntaxKind.InputFiles */); + var node = createBaseNode(311 /* SyntaxKind.InputFiles */); node.javascriptText = ""; node.declarationText = ""; return node; @@ -26651,7 +26873,7 @@ var ts; // @api function createSyntheticExpression(type, isSpread, tupleNameSource) { if (isSpread === void 0) { isSpread = false; } - var node = createBaseNode(232 /* SyntaxKind.SyntheticExpression */); + var node = createBaseNode(234 /* SyntaxKind.SyntheticExpression */); node.type = type; node.isSpread = isSpread; node.tupleNameSource = tupleNameSource; @@ -26659,7 +26881,7 @@ var ts; } // @api function createSyntaxList(children) { - var node = createBaseNode(348 /* SyntaxKind.SyntaxList */); + var node = createBaseNode(351 /* SyntaxKind.SyntaxList */); node._children = children; return node; } @@ -26674,7 +26896,7 @@ var ts; */ // @api function createNotEmittedStatement(original) { - var node = createBaseNode(349 /* SyntaxKind.NotEmittedStatement */); + var node = createBaseNode(352 /* SyntaxKind.NotEmittedStatement */); node.original = original; ts.setTextRange(node, original); return node; @@ -26688,7 +26910,7 @@ var ts; */ // @api function createPartiallyEmittedExpression(expression, original) { - var node = createBaseNode(350 /* SyntaxKind.PartiallyEmittedExpression */); + var node = createBaseNode(353 /* SyntaxKind.PartiallyEmittedExpression */); node.expression = expression; node.original = original; node.transformFlags |= @@ -26716,7 +26938,7 @@ var ts; } // @api function createCommaListExpression(elements) { - var node = createBaseNode(351 /* SyntaxKind.CommaListExpression */); + var node = createBaseNode(354 /* SyntaxKind.CommaListExpression */); node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements)); node.transformFlags |= propagateChildrenFlags(node.elements); return node; @@ -26733,7 +26955,7 @@ var ts; */ // @api function createEndOfDeclarationMarker(original) { - var node = createBaseNode(353 /* SyntaxKind.EndOfDeclarationMarker */); + var node = createBaseNode(356 /* SyntaxKind.EndOfDeclarationMarker */); node.emitNode = {}; node.original = original; return node; @@ -26744,14 +26966,14 @@ var ts; */ // @api function createMergeDeclarationMarker(original) { - var node = createBaseNode(352 /* SyntaxKind.MergeDeclarationMarker */); + var node = createBaseNode(355 /* SyntaxKind.MergeDeclarationMarker */); node.emitNode = {}; node.original = original; return node; } // @api function createSyntheticReferenceExpression(expression, thisArg) { - var node = createBaseNode(354 /* SyntaxKind.SyntheticReferenceExpression */); + var node = createBaseNode(357 /* SyntaxKind.SyntheticReferenceExpression */); node.expression = expression; node.thisArg = thisArg; node.transformFlags |= @@ -26773,7 +26995,7 @@ var ts; if (node === undefined) { return node; } - var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(305 /* SyntaxKind.SourceFile */) : + var clone = ts.isSourceFile(node) ? baseFactory.createBaseSourceFileNode(308 /* SyntaxKind.SourceFile */) : ts.isIdentifier(node) ? baseFactory.createBaseIdentifierNode(79 /* SyntaxKind.Identifier */) : ts.isPrivateIdentifier(node) ? baseFactory.createBasePrivateIdentifierNode(80 /* SyntaxKind.PrivateIdentifier */) : !ts.isNodeKind(node.kind) ? baseFactory.createBaseTokenNode(node.kind) : @@ -26782,7 +27004,7 @@ var ts; clone.transformFlags = node.transformFlags; setOriginalNode(clone, node); for (var key in node) { - if (clone.hasOwnProperty(key) || !node.hasOwnProperty(key)) { + if (ts.hasProperty(clone, key) || !ts.hasProperty(node, key)) { continue; } clone[key] = node[key]; @@ -26890,11 +27112,12 @@ var ts; } function updateOuterExpression(outerExpression, expression) { switch (outerExpression.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); - case 211 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); - case 229 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); - case 230 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); + case 214 /* SyntaxKind.ParenthesizedExpression */: return updateParenthesizedExpression(outerExpression, expression); + case 213 /* SyntaxKind.TypeAssertionExpression */: return updateTypeAssertion(outerExpression, outerExpression.type, expression); + case 231 /* SyntaxKind.AsExpression */: return updateAsExpression(outerExpression, expression, outerExpression.type); + case 235 /* SyntaxKind.SatisfiesExpression */: return updateSatisfiesExpression(outerExpression, expression, outerExpression.type); + case 232 /* SyntaxKind.NonNullExpression */: return updateNonNullExpression(outerExpression, expression); + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return updatePartiallyEmittedExpression(outerExpression, expression); } } /** @@ -26948,13 +27171,13 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 10 /* SyntaxKind.StringLiteral */: return false; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: var elements = target.elements; if (elements.length === 0) { return false; } return true; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return target.properties.length > 0; default: return true; @@ -27380,24 +27603,24 @@ var ts; } function getDefaultTagNameForKind(kind) { switch (kind) { - case 343 /* SyntaxKind.JSDocTypeTag */: return "type"; - case 341 /* SyntaxKind.JSDocReturnTag */: return "returns"; - case 342 /* SyntaxKind.JSDocThisTag */: return "this"; - case 339 /* SyntaxKind.JSDocEnumTag */: return "enum"; - case 330 /* SyntaxKind.JSDocAuthorTag */: return "author"; - case 332 /* SyntaxKind.JSDocClassTag */: return "class"; - case 333 /* SyntaxKind.JSDocPublicTag */: return "public"; - case 334 /* SyntaxKind.JSDocPrivateTag */: return "private"; - case 335 /* SyntaxKind.JSDocProtectedTag */: return "protected"; - case 336 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; - case 337 /* SyntaxKind.JSDocOverrideTag */: return "override"; - case 344 /* SyntaxKind.JSDocTemplateTag */: return "template"; - case 345 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; - case 340 /* SyntaxKind.JSDocParameterTag */: return "param"; - case 347 /* SyntaxKind.JSDocPropertyTag */: return "prop"; - case 338 /* SyntaxKind.JSDocCallbackTag */: return "callback"; - case 328 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; - case 329 /* SyntaxKind.JSDocImplementsTag */: return "implements"; + case 346 /* SyntaxKind.JSDocTypeTag */: return "type"; + case 344 /* SyntaxKind.JSDocReturnTag */: return "returns"; + case 345 /* SyntaxKind.JSDocThisTag */: return "this"; + case 342 /* SyntaxKind.JSDocEnumTag */: return "enum"; + case 333 /* SyntaxKind.JSDocAuthorTag */: return "author"; + case 335 /* SyntaxKind.JSDocClassTag */: return "class"; + case 336 /* SyntaxKind.JSDocPublicTag */: return "public"; + case 337 /* SyntaxKind.JSDocPrivateTag */: return "private"; + case 338 /* SyntaxKind.JSDocProtectedTag */: return "protected"; + case 339 /* SyntaxKind.JSDocReadonlyTag */: return "readonly"; + case 340 /* SyntaxKind.JSDocOverrideTag */: return "override"; + case 347 /* SyntaxKind.JSDocTemplateTag */: return "template"; + case 348 /* SyntaxKind.JSDocTypedefTag */: return "typedef"; + case 343 /* SyntaxKind.JSDocParameterTag */: return "param"; + case 350 /* SyntaxKind.JSDocPropertyTag */: return "prop"; + case 341 /* SyntaxKind.JSDocCallbackTag */: return "callback"; + case 331 /* SyntaxKind.JSDocAugmentsTag */: return "augments"; + case 332 /* SyntaxKind.JSDocImplementsTag */: return "implements"; default: return ts.Debug.fail("Unsupported kind: ".concat(ts.Debug.formatSyntaxKind(kind))); } @@ -27413,11 +27636,9 @@ var ts; rawTextScanner.setText("`" + rawText + "`"); break; case 15 /* SyntaxKind.TemplateHead */: - // tslint:disable-next-line no-invalid-template-strings rawTextScanner.setText("`" + rawText + "${"); break; case 16 /* SyntaxKind.TemplateMiddle */: - // tslint:disable-next-line no-invalid-template-strings rawTextScanner.setText("}" + rawText + "${"); break; case 17 /* SyntaxKind.TemplateTail */: @@ -27477,69 +27698,70 @@ var ts; */ /* @internal */ function getTransformFlagsSubtreeExclusions(kind) { - if (kind >= 177 /* SyntaxKind.FirstTypeNode */ && kind <= 200 /* SyntaxKind.LastTypeNode */) { + if (kind >= 179 /* SyntaxKind.FirstTypeNode */ && kind <= 202 /* SyntaxKind.LastTypeNode */) { return -2 /* TransformFlags.TypeExcludes */; } switch (kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return -2147450880 /* TransformFlags.ArrayLiteralOrCallOrNewExcludes */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return -1941676032 /* TransformFlags.ModuleExcludes */; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return -2147483648 /* TransformFlags.ParameterExcludes */; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return -2072174592 /* TransformFlags.ArrowFunctionExcludes */; - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: return -1937940480 /* TransformFlags.FunctionExcludes */; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return -2146893824 /* TransformFlags.VariableDeclarationListExcludes */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return -2147344384 /* TransformFlags.ClassExcludes */; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return -1937948672 /* TransformFlags.ConstructorExcludes */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return -2013249536 /* TransformFlags.PropertyExcludes */; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return -2005057536 /* TransformFlags.MethodOrAccessorExcludes */; - case 130 /* SyntaxKind.AnyKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 163 /* SyntaxKind.TypeParameter */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return -2 /* TransformFlags.TypeExcludes */; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return -2147278848 /* TransformFlags.ObjectLiteralExcludes */; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return -2147418112 /* TransformFlags.CatchClauseExcludes */; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return -2147450880 /* TransformFlags.BindingPatternExcludes */; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: case 106 /* SyntaxKind.SuperKeyword */: return -2147483648 /* TransformFlags.OuterExpressionExcludes */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return -2147483648 /* TransformFlags.PropertyAccessExcludes */; default: return -2147483648 /* TransformFlags.NodeExcludes */; @@ -27739,9 +27961,10 @@ var ts; }; var buildInfo_1; var getAndCacheBuildInfo_1 = function (getText) { + var _a; if (buildInfo_1 === undefined) { var result = getText(); - buildInfo_1 = result !== undefined ? ts.getBuildInfo(result) : false; + buildInfo_1 = result !== undefined ? (_a = ts.getBuildInfo(node.buildInfoPath, result)) !== null && _a !== void 0 ? _a : false : false; } return buildInfo_1 || undefined; }; @@ -27774,7 +27997,6 @@ var ts; return node; } ts.createInputFiles = createInputFiles; - // tslint:disable-next-line variable-name var SourceMapSource; /** * Create an external source map source file reference @@ -27795,7 +28017,7 @@ var ts; } ts.setOriginalNode = setOriginalNode; function mergeEmitNode(sourceEmitNode, destEmitNode) { - var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine; + var flags = sourceEmitNode.flags, leadingComments = sourceEmitNode.leadingComments, trailingComments = sourceEmitNode.trailingComments, commentRange = sourceEmitNode.commentRange, sourceMapRange = sourceEmitNode.sourceMapRange, tokenSourceMapRanges = sourceEmitNode.tokenSourceMapRanges, constantValue = sourceEmitNode.constantValue, helpers = sourceEmitNode.helpers, startsOnNewLine = sourceEmitNode.startsOnNewLine, snippetElement = sourceEmitNode.snippetElement; if (!destEmitNode) destEmitNode = {}; // We are using `.slice()` here in case `destEmitNode.leadingComments` is pushed to later. @@ -27821,6 +28043,8 @@ var ts; } if (startsOnNewLine !== undefined) destEmitNode.startsOnNewLine = startsOnNewLine; + if (snippetElement !== undefined) + destEmitNode.snippetElement = snippetElement; return destEmitNode; } function mergeTokenSourceMapRanges(sourceRanges, destRanges) { @@ -27846,7 +28070,7 @@ var ts; // To avoid holding onto transformation artifacts, we keep track of any // parse tree node we are annotating. This allows us to clean them up after // all transformations have completed. - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return node.emitNode = { annotatedNodes: [node] }; } var sourceFile = (_a = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)))) !== null && _a !== void 0 ? _a : ts.Debug.fail("Could not determine parsed source file."); @@ -28564,6 +28788,8 @@ var ts; // - The verb (`next`, `throw`, or `return` method) to delegate to the expression // of a `yield*`. // - The result of evaluating the verb delegated to the expression of a `yield*`. + // g A temporary variable that holds onto the generator object until the generator + // is started, allowing it to also act as the `suspendedStart` state. // // functions: // verb(n) Creates a bound callback to the `step` function for opcode `n`. @@ -28602,7 +28828,7 @@ var ts; importName: "__generator", scoped: false, priority: 6, - text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (_) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" + text: "\n var __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n };" }; // ES Module Helpers ts.createBindingHelper = { @@ -28924,22 +29150,22 @@ var ts; ts.isExportModifier = isExportModifier; /* @internal */ function isAsyncModifier(node) { - return node.kind === 131 /* SyntaxKind.AsyncKeyword */; + return node.kind === 132 /* SyntaxKind.AsyncKeyword */; } ts.isAsyncModifier = isAsyncModifier; /* @internal */ function isAssertsKeyword(node) { - return node.kind === 128 /* SyntaxKind.AssertsKeyword */; + return node.kind === 129 /* SyntaxKind.AssertsKeyword */; } ts.isAssertsKeyword = isAssertsKeyword; /* @internal */ function isAwaitKeyword(node) { - return node.kind === 132 /* SyntaxKind.AwaitKeyword */; + return node.kind === 133 /* SyntaxKind.AwaitKeyword */; } ts.isAwaitKeyword = isAwaitKeyword; /* @internal */ function isReadonlyKeyword(node) { - return node.kind === 145 /* SyntaxKind.ReadonlyKeyword */; + return node.kind === 146 /* SyntaxKind.ReadonlyKeyword */; } ts.isReadonlyKeyword = isReadonlyKeyword; /* @internal */ @@ -28954,9 +29180,14 @@ var ts; ts.isAbstractModifier = isAbstractModifier; /* @internal */ function isOverrideModifier(node) { - return node.kind === 159 /* SyntaxKind.OverrideKeyword */; + return node.kind === 161 /* SyntaxKind.OverrideKeyword */; } ts.isOverrideModifier = isOverrideModifier; + /* @internal */ + function isAccessorModifier(node) { + return node.kind === 127 /* SyntaxKind.AccessorKeyword */; + } + ts.isAccessorModifier = isAccessorModifier; /*@internal*/ function isSuperKeyword(node) { return node.kind === 106 /* SyntaxKind.SuperKeyword */; @@ -28969,605 +29200,609 @@ var ts; ts.isImportKeyword = isImportKeyword; // Names function isQualifiedName(node) { - return node.kind === 161 /* SyntaxKind.QualifiedName */; + return node.kind === 163 /* SyntaxKind.QualifiedName */; } ts.isQualifiedName = isQualifiedName; function isComputedPropertyName(node) { - return node.kind === 162 /* SyntaxKind.ComputedPropertyName */; + return node.kind === 164 /* SyntaxKind.ComputedPropertyName */; } ts.isComputedPropertyName = isComputedPropertyName; // Signature elements function isTypeParameterDeclaration(node) { - return node.kind === 163 /* SyntaxKind.TypeParameter */; + return node.kind === 165 /* SyntaxKind.TypeParameter */; } ts.isTypeParameterDeclaration = isTypeParameterDeclaration; // TODO(rbuckton): Rename to 'isParameterDeclaration' function isParameter(node) { - return node.kind === 164 /* SyntaxKind.Parameter */; + return node.kind === 166 /* SyntaxKind.Parameter */; } ts.isParameter = isParameter; function isDecorator(node) { - return node.kind === 165 /* SyntaxKind.Decorator */; + return node.kind === 167 /* SyntaxKind.Decorator */; } ts.isDecorator = isDecorator; // TypeMember function isPropertySignature(node) { - return node.kind === 166 /* SyntaxKind.PropertySignature */; + return node.kind === 168 /* SyntaxKind.PropertySignature */; } ts.isPropertySignature = isPropertySignature; function isPropertyDeclaration(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */; } ts.isPropertyDeclaration = isPropertyDeclaration; function isMethodSignature(node) { - return node.kind === 168 /* SyntaxKind.MethodSignature */; + return node.kind === 170 /* SyntaxKind.MethodSignature */; } ts.isMethodSignature = isMethodSignature; function isMethodDeclaration(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } ts.isMethodDeclaration = isMethodDeclaration; function isClassStaticBlockDeclaration(node) { - return node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } ts.isClassStaticBlockDeclaration = isClassStaticBlockDeclaration; function isConstructorDeclaration(node) { - return node.kind === 171 /* SyntaxKind.Constructor */; + return node.kind === 173 /* SyntaxKind.Constructor */; } ts.isConstructorDeclaration = isConstructorDeclaration; function isGetAccessorDeclaration(node) { - return node.kind === 172 /* SyntaxKind.GetAccessor */; + return node.kind === 174 /* SyntaxKind.GetAccessor */; } ts.isGetAccessorDeclaration = isGetAccessorDeclaration; function isSetAccessorDeclaration(node) { - return node.kind === 173 /* SyntaxKind.SetAccessor */; + return node.kind === 175 /* SyntaxKind.SetAccessor */; } ts.isSetAccessorDeclaration = isSetAccessorDeclaration; function isCallSignatureDeclaration(node) { - return node.kind === 174 /* SyntaxKind.CallSignature */; + return node.kind === 176 /* SyntaxKind.CallSignature */; } ts.isCallSignatureDeclaration = isCallSignatureDeclaration; function isConstructSignatureDeclaration(node) { - return node.kind === 175 /* SyntaxKind.ConstructSignature */; + return node.kind === 177 /* SyntaxKind.ConstructSignature */; } ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration; function isIndexSignatureDeclaration(node) { - return node.kind === 176 /* SyntaxKind.IndexSignature */; + return node.kind === 178 /* SyntaxKind.IndexSignature */; } ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration; // Type function isTypePredicateNode(node) { - return node.kind === 177 /* SyntaxKind.TypePredicate */; + return node.kind === 179 /* SyntaxKind.TypePredicate */; } ts.isTypePredicateNode = isTypePredicateNode; function isTypeReferenceNode(node) { - return node.kind === 178 /* SyntaxKind.TypeReference */; + return node.kind === 180 /* SyntaxKind.TypeReference */; } ts.isTypeReferenceNode = isTypeReferenceNode; function isFunctionTypeNode(node) { - return node.kind === 179 /* SyntaxKind.FunctionType */; + return node.kind === 181 /* SyntaxKind.FunctionType */; } ts.isFunctionTypeNode = isFunctionTypeNode; function isConstructorTypeNode(node) { - return node.kind === 180 /* SyntaxKind.ConstructorType */; + return node.kind === 182 /* SyntaxKind.ConstructorType */; } ts.isConstructorTypeNode = isConstructorTypeNode; function isTypeQueryNode(node) { - return node.kind === 181 /* SyntaxKind.TypeQuery */; + return node.kind === 183 /* SyntaxKind.TypeQuery */; } ts.isTypeQueryNode = isTypeQueryNode; function isTypeLiteralNode(node) { - return node.kind === 182 /* SyntaxKind.TypeLiteral */; + return node.kind === 184 /* SyntaxKind.TypeLiteral */; } ts.isTypeLiteralNode = isTypeLiteralNode; function isArrayTypeNode(node) { - return node.kind === 183 /* SyntaxKind.ArrayType */; + return node.kind === 185 /* SyntaxKind.ArrayType */; } ts.isArrayTypeNode = isArrayTypeNode; function isTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */; + return node.kind === 186 /* SyntaxKind.TupleType */; } ts.isTupleTypeNode = isTupleTypeNode; function isNamedTupleMember(node) { - return node.kind === 197 /* SyntaxKind.NamedTupleMember */; + return node.kind === 199 /* SyntaxKind.NamedTupleMember */; } ts.isNamedTupleMember = isNamedTupleMember; function isOptionalTypeNode(node) { - return node.kind === 185 /* SyntaxKind.OptionalType */; + return node.kind === 187 /* SyntaxKind.OptionalType */; } ts.isOptionalTypeNode = isOptionalTypeNode; function isRestTypeNode(node) { - return node.kind === 186 /* SyntaxKind.RestType */; + return node.kind === 188 /* SyntaxKind.RestType */; } ts.isRestTypeNode = isRestTypeNode; function isUnionTypeNode(node) { - return node.kind === 187 /* SyntaxKind.UnionType */; + return node.kind === 189 /* SyntaxKind.UnionType */; } ts.isUnionTypeNode = isUnionTypeNode; function isIntersectionTypeNode(node) { - return node.kind === 188 /* SyntaxKind.IntersectionType */; + return node.kind === 190 /* SyntaxKind.IntersectionType */; } ts.isIntersectionTypeNode = isIntersectionTypeNode; function isConditionalTypeNode(node) { - return node.kind === 189 /* SyntaxKind.ConditionalType */; + return node.kind === 191 /* SyntaxKind.ConditionalType */; } ts.isConditionalTypeNode = isConditionalTypeNode; function isInferTypeNode(node) { - return node.kind === 190 /* SyntaxKind.InferType */; + return node.kind === 192 /* SyntaxKind.InferType */; } ts.isInferTypeNode = isInferTypeNode; function isParenthesizedTypeNode(node) { - return node.kind === 191 /* SyntaxKind.ParenthesizedType */; + return node.kind === 193 /* SyntaxKind.ParenthesizedType */; } ts.isParenthesizedTypeNode = isParenthesizedTypeNode; function isThisTypeNode(node) { - return node.kind === 192 /* SyntaxKind.ThisType */; + return node.kind === 194 /* SyntaxKind.ThisType */; } ts.isThisTypeNode = isThisTypeNode; function isTypeOperatorNode(node) { - return node.kind === 193 /* SyntaxKind.TypeOperator */; + return node.kind === 195 /* SyntaxKind.TypeOperator */; } ts.isTypeOperatorNode = isTypeOperatorNode; function isIndexedAccessTypeNode(node) { - return node.kind === 194 /* SyntaxKind.IndexedAccessType */; + return node.kind === 196 /* SyntaxKind.IndexedAccessType */; } ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode; function isMappedTypeNode(node) { - return node.kind === 195 /* SyntaxKind.MappedType */; + return node.kind === 197 /* SyntaxKind.MappedType */; } ts.isMappedTypeNode = isMappedTypeNode; function isLiteralTypeNode(node) { - return node.kind === 196 /* SyntaxKind.LiteralType */; + return node.kind === 198 /* SyntaxKind.LiteralType */; } ts.isLiteralTypeNode = isLiteralTypeNode; function isImportTypeNode(node) { - return node.kind === 200 /* SyntaxKind.ImportType */; + return node.kind === 202 /* SyntaxKind.ImportType */; } ts.isImportTypeNode = isImportTypeNode; function isTemplateLiteralTypeSpan(node) { - return node.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */; + return node.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */; } ts.isTemplateLiteralTypeSpan = isTemplateLiteralTypeSpan; function isTemplateLiteralTypeNode(node) { - return node.kind === 198 /* SyntaxKind.TemplateLiteralType */; + return node.kind === 200 /* SyntaxKind.TemplateLiteralType */; } ts.isTemplateLiteralTypeNode = isTemplateLiteralTypeNode; // Binding patterns function isObjectBindingPattern(node) { - return node.kind === 201 /* SyntaxKind.ObjectBindingPattern */; + return node.kind === 203 /* SyntaxKind.ObjectBindingPattern */; } ts.isObjectBindingPattern = isObjectBindingPattern; function isArrayBindingPattern(node) { - return node.kind === 202 /* SyntaxKind.ArrayBindingPattern */; + return node.kind === 204 /* SyntaxKind.ArrayBindingPattern */; } ts.isArrayBindingPattern = isArrayBindingPattern; function isBindingElement(node) { - return node.kind === 203 /* SyntaxKind.BindingElement */; + return node.kind === 205 /* SyntaxKind.BindingElement */; } ts.isBindingElement = isBindingElement; // Expression function isArrayLiteralExpression(node) { - return node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */; + return node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */; } ts.isArrayLiteralExpression = isArrayLiteralExpression; function isObjectLiteralExpression(node) { - return node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + return node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; } ts.isObjectLiteralExpression = isObjectLiteralExpression; function isPropertyAccessExpression(node) { - return node.kind === 206 /* SyntaxKind.PropertyAccessExpression */; + return node.kind === 208 /* SyntaxKind.PropertyAccessExpression */; } ts.isPropertyAccessExpression = isPropertyAccessExpression; function isElementAccessExpression(node) { - return node.kind === 207 /* SyntaxKind.ElementAccessExpression */; + return node.kind === 209 /* SyntaxKind.ElementAccessExpression */; } ts.isElementAccessExpression = isElementAccessExpression; function isCallExpression(node) { - return node.kind === 208 /* SyntaxKind.CallExpression */; + return node.kind === 210 /* SyntaxKind.CallExpression */; } ts.isCallExpression = isCallExpression; function isNewExpression(node) { - return node.kind === 209 /* SyntaxKind.NewExpression */; + return node.kind === 211 /* SyntaxKind.NewExpression */; } ts.isNewExpression = isNewExpression; function isTaggedTemplateExpression(node) { - return node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; + return node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; } ts.isTaggedTemplateExpression = isTaggedTemplateExpression; function isTypeAssertionExpression(node) { - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */; + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */; } ts.isTypeAssertionExpression = isTypeAssertionExpression; function isParenthesizedExpression(node) { - return node.kind === 212 /* SyntaxKind.ParenthesizedExpression */; + return node.kind === 214 /* SyntaxKind.ParenthesizedExpression */; } ts.isParenthesizedExpression = isParenthesizedExpression; function isFunctionExpression(node) { - return node.kind === 213 /* SyntaxKind.FunctionExpression */; + return node.kind === 215 /* SyntaxKind.FunctionExpression */; } ts.isFunctionExpression = isFunctionExpression; function isArrowFunction(node) { - return node.kind === 214 /* SyntaxKind.ArrowFunction */; + return node.kind === 216 /* SyntaxKind.ArrowFunction */; } ts.isArrowFunction = isArrowFunction; function isDeleteExpression(node) { - return node.kind === 215 /* SyntaxKind.DeleteExpression */; + return node.kind === 217 /* SyntaxKind.DeleteExpression */; } ts.isDeleteExpression = isDeleteExpression; function isTypeOfExpression(node) { - return node.kind === 216 /* SyntaxKind.TypeOfExpression */; + return node.kind === 218 /* SyntaxKind.TypeOfExpression */; } ts.isTypeOfExpression = isTypeOfExpression; function isVoidExpression(node) { - return node.kind === 217 /* SyntaxKind.VoidExpression */; + return node.kind === 219 /* SyntaxKind.VoidExpression */; } ts.isVoidExpression = isVoidExpression; function isAwaitExpression(node) { - return node.kind === 218 /* SyntaxKind.AwaitExpression */; + return node.kind === 220 /* SyntaxKind.AwaitExpression */; } ts.isAwaitExpression = isAwaitExpression; function isPrefixUnaryExpression(node) { - return node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */; + return node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */; } ts.isPrefixUnaryExpression = isPrefixUnaryExpression; function isPostfixUnaryExpression(node) { - return node.kind === 220 /* SyntaxKind.PostfixUnaryExpression */; + return node.kind === 222 /* SyntaxKind.PostfixUnaryExpression */; } ts.isPostfixUnaryExpression = isPostfixUnaryExpression; function isBinaryExpression(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */; } ts.isBinaryExpression = isBinaryExpression; function isConditionalExpression(node) { - return node.kind === 222 /* SyntaxKind.ConditionalExpression */; + return node.kind === 224 /* SyntaxKind.ConditionalExpression */; } ts.isConditionalExpression = isConditionalExpression; function isTemplateExpression(node) { - return node.kind === 223 /* SyntaxKind.TemplateExpression */; + return node.kind === 225 /* SyntaxKind.TemplateExpression */; } ts.isTemplateExpression = isTemplateExpression; function isYieldExpression(node) { - return node.kind === 224 /* SyntaxKind.YieldExpression */; + return node.kind === 226 /* SyntaxKind.YieldExpression */; } ts.isYieldExpression = isYieldExpression; function isSpreadElement(node) { - return node.kind === 225 /* SyntaxKind.SpreadElement */; + return node.kind === 227 /* SyntaxKind.SpreadElement */; } ts.isSpreadElement = isSpreadElement; function isClassExpression(node) { - return node.kind === 226 /* SyntaxKind.ClassExpression */; + return node.kind === 228 /* SyntaxKind.ClassExpression */; } ts.isClassExpression = isClassExpression; function isOmittedExpression(node) { - return node.kind === 227 /* SyntaxKind.OmittedExpression */; + return node.kind === 229 /* SyntaxKind.OmittedExpression */; } ts.isOmittedExpression = isOmittedExpression; function isExpressionWithTypeArguments(node) { - return node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments; function isAsExpression(node) { - return node.kind === 229 /* SyntaxKind.AsExpression */; + return node.kind === 231 /* SyntaxKind.AsExpression */; } ts.isAsExpression = isAsExpression; + function isSatisfiesExpression(node) { + return node.kind === 235 /* SyntaxKind.SatisfiesExpression */; + } + ts.isSatisfiesExpression = isSatisfiesExpression; function isNonNullExpression(node) { - return node.kind === 230 /* SyntaxKind.NonNullExpression */; + return node.kind === 232 /* SyntaxKind.NonNullExpression */; } ts.isNonNullExpression = isNonNullExpression; function isMetaProperty(node) { - return node.kind === 231 /* SyntaxKind.MetaProperty */; + return node.kind === 233 /* SyntaxKind.MetaProperty */; } ts.isMetaProperty = isMetaProperty; function isSyntheticExpression(node) { - return node.kind === 232 /* SyntaxKind.SyntheticExpression */; + return node.kind === 234 /* SyntaxKind.SyntheticExpression */; } ts.isSyntheticExpression = isSyntheticExpression; function isPartiallyEmittedExpression(node) { - return node.kind === 350 /* SyntaxKind.PartiallyEmittedExpression */; + return node.kind === 353 /* SyntaxKind.PartiallyEmittedExpression */; } ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression; function isCommaListExpression(node) { - return node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaListExpression = isCommaListExpression; // Misc function isTemplateSpan(node) { - return node.kind === 233 /* SyntaxKind.TemplateSpan */; + return node.kind === 236 /* SyntaxKind.TemplateSpan */; } ts.isTemplateSpan = isTemplateSpan; function isSemicolonClassElement(node) { - return node.kind === 234 /* SyntaxKind.SemicolonClassElement */; + return node.kind === 237 /* SyntaxKind.SemicolonClassElement */; } ts.isSemicolonClassElement = isSemicolonClassElement; // Elements function isBlock(node) { - return node.kind === 235 /* SyntaxKind.Block */; + return node.kind === 238 /* SyntaxKind.Block */; } ts.isBlock = isBlock; function isVariableStatement(node) { - return node.kind === 237 /* SyntaxKind.VariableStatement */; + return node.kind === 240 /* SyntaxKind.VariableStatement */; } ts.isVariableStatement = isVariableStatement; function isEmptyStatement(node) { - return node.kind === 236 /* SyntaxKind.EmptyStatement */; + return node.kind === 239 /* SyntaxKind.EmptyStatement */; } ts.isEmptyStatement = isEmptyStatement; function isExpressionStatement(node) { - return node.kind === 238 /* SyntaxKind.ExpressionStatement */; + return node.kind === 241 /* SyntaxKind.ExpressionStatement */; } ts.isExpressionStatement = isExpressionStatement; function isIfStatement(node) { - return node.kind === 239 /* SyntaxKind.IfStatement */; + return node.kind === 242 /* SyntaxKind.IfStatement */; } ts.isIfStatement = isIfStatement; function isDoStatement(node) { - return node.kind === 240 /* SyntaxKind.DoStatement */; + return node.kind === 243 /* SyntaxKind.DoStatement */; } ts.isDoStatement = isDoStatement; function isWhileStatement(node) { - return node.kind === 241 /* SyntaxKind.WhileStatement */; + return node.kind === 244 /* SyntaxKind.WhileStatement */; } ts.isWhileStatement = isWhileStatement; function isForStatement(node) { - return node.kind === 242 /* SyntaxKind.ForStatement */; + return node.kind === 245 /* SyntaxKind.ForStatement */; } ts.isForStatement = isForStatement; function isForInStatement(node) { - return node.kind === 243 /* SyntaxKind.ForInStatement */; + return node.kind === 246 /* SyntaxKind.ForInStatement */; } ts.isForInStatement = isForInStatement; function isForOfStatement(node) { - return node.kind === 244 /* SyntaxKind.ForOfStatement */; + return node.kind === 247 /* SyntaxKind.ForOfStatement */; } ts.isForOfStatement = isForOfStatement; function isContinueStatement(node) { - return node.kind === 245 /* SyntaxKind.ContinueStatement */; + return node.kind === 248 /* SyntaxKind.ContinueStatement */; } ts.isContinueStatement = isContinueStatement; function isBreakStatement(node) { - return node.kind === 246 /* SyntaxKind.BreakStatement */; + return node.kind === 249 /* SyntaxKind.BreakStatement */; } ts.isBreakStatement = isBreakStatement; function isReturnStatement(node) { - return node.kind === 247 /* SyntaxKind.ReturnStatement */; + return node.kind === 250 /* SyntaxKind.ReturnStatement */; } ts.isReturnStatement = isReturnStatement; function isWithStatement(node) { - return node.kind === 248 /* SyntaxKind.WithStatement */; + return node.kind === 251 /* SyntaxKind.WithStatement */; } ts.isWithStatement = isWithStatement; function isSwitchStatement(node) { - return node.kind === 249 /* SyntaxKind.SwitchStatement */; + return node.kind === 252 /* SyntaxKind.SwitchStatement */; } ts.isSwitchStatement = isSwitchStatement; function isLabeledStatement(node) { - return node.kind === 250 /* SyntaxKind.LabeledStatement */; + return node.kind === 253 /* SyntaxKind.LabeledStatement */; } ts.isLabeledStatement = isLabeledStatement; function isThrowStatement(node) { - return node.kind === 251 /* SyntaxKind.ThrowStatement */; + return node.kind === 254 /* SyntaxKind.ThrowStatement */; } ts.isThrowStatement = isThrowStatement; function isTryStatement(node) { - return node.kind === 252 /* SyntaxKind.TryStatement */; + return node.kind === 255 /* SyntaxKind.TryStatement */; } ts.isTryStatement = isTryStatement; function isDebuggerStatement(node) { - return node.kind === 253 /* SyntaxKind.DebuggerStatement */; + return node.kind === 256 /* SyntaxKind.DebuggerStatement */; } ts.isDebuggerStatement = isDebuggerStatement; function isVariableDeclaration(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */; + return node.kind === 257 /* SyntaxKind.VariableDeclaration */; } ts.isVariableDeclaration = isVariableDeclaration; function isVariableDeclarationList(node) { - return node.kind === 255 /* SyntaxKind.VariableDeclarationList */; + return node.kind === 258 /* SyntaxKind.VariableDeclarationList */; } ts.isVariableDeclarationList = isVariableDeclarationList; function isFunctionDeclaration(node) { - return node.kind === 256 /* SyntaxKind.FunctionDeclaration */; + return node.kind === 259 /* SyntaxKind.FunctionDeclaration */; } ts.isFunctionDeclaration = isFunctionDeclaration; function isClassDeclaration(node) { - return node.kind === 257 /* SyntaxKind.ClassDeclaration */; + return node.kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.isClassDeclaration = isClassDeclaration; function isInterfaceDeclaration(node) { - return node.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return node.kind === 261 /* SyntaxKind.InterfaceDeclaration */; } ts.isInterfaceDeclaration = isInterfaceDeclaration; function isTypeAliasDeclaration(node) { - return node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */; + return node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */; } ts.isTypeAliasDeclaration = isTypeAliasDeclaration; function isEnumDeclaration(node) { - return node.kind === 260 /* SyntaxKind.EnumDeclaration */; + return node.kind === 263 /* SyntaxKind.EnumDeclaration */; } ts.isEnumDeclaration = isEnumDeclaration; function isModuleDeclaration(node) { - return node.kind === 261 /* SyntaxKind.ModuleDeclaration */; + return node.kind === 264 /* SyntaxKind.ModuleDeclaration */; } ts.isModuleDeclaration = isModuleDeclaration; function isModuleBlock(node) { - return node.kind === 262 /* SyntaxKind.ModuleBlock */; + return node.kind === 265 /* SyntaxKind.ModuleBlock */; } ts.isModuleBlock = isModuleBlock; function isCaseBlock(node) { - return node.kind === 263 /* SyntaxKind.CaseBlock */; + return node.kind === 266 /* SyntaxKind.CaseBlock */; } ts.isCaseBlock = isCaseBlock; function isNamespaceExportDeclaration(node) { - return node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration; function isImportEqualsDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */; + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */; } ts.isImportEqualsDeclaration = isImportEqualsDeclaration; function isImportDeclaration(node) { - return node.kind === 266 /* SyntaxKind.ImportDeclaration */; + return node.kind === 269 /* SyntaxKind.ImportDeclaration */; } ts.isImportDeclaration = isImportDeclaration; function isImportClause(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */; + return node.kind === 270 /* SyntaxKind.ImportClause */; } ts.isImportClause = isImportClause; function isImportTypeAssertionContainer(node) { - return node.kind === 295 /* SyntaxKind.ImportTypeAssertionContainer */; + return node.kind === 298 /* SyntaxKind.ImportTypeAssertionContainer */; } ts.isImportTypeAssertionContainer = isImportTypeAssertionContainer; function isAssertClause(node) { - return node.kind === 293 /* SyntaxKind.AssertClause */; + return node.kind === 296 /* SyntaxKind.AssertClause */; } ts.isAssertClause = isAssertClause; function isAssertEntry(node) { - return node.kind === 294 /* SyntaxKind.AssertEntry */; + return node.kind === 297 /* SyntaxKind.AssertEntry */; } ts.isAssertEntry = isAssertEntry; function isNamespaceImport(node) { - return node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 271 /* SyntaxKind.NamespaceImport */; } ts.isNamespaceImport = isNamespaceImport; function isNamespaceExport(node) { - return node.kind === 274 /* SyntaxKind.NamespaceExport */; + return node.kind === 277 /* SyntaxKind.NamespaceExport */; } ts.isNamespaceExport = isNamespaceExport; function isNamedImports(node) { - return node.kind === 269 /* SyntaxKind.NamedImports */; + return node.kind === 272 /* SyntaxKind.NamedImports */; } ts.isNamedImports = isNamedImports; function isImportSpecifier(node) { - return node.kind === 270 /* SyntaxKind.ImportSpecifier */; + return node.kind === 273 /* SyntaxKind.ImportSpecifier */; } ts.isImportSpecifier = isImportSpecifier; function isExportAssignment(node) { - return node.kind === 271 /* SyntaxKind.ExportAssignment */; + return node.kind === 274 /* SyntaxKind.ExportAssignment */; } ts.isExportAssignment = isExportAssignment; function isExportDeclaration(node) { - return node.kind === 272 /* SyntaxKind.ExportDeclaration */; + return node.kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.isExportDeclaration = isExportDeclaration; function isNamedExports(node) { - return node.kind === 273 /* SyntaxKind.NamedExports */; + return node.kind === 276 /* SyntaxKind.NamedExports */; } ts.isNamedExports = isNamedExports; function isExportSpecifier(node) { - return node.kind === 275 /* SyntaxKind.ExportSpecifier */; + return node.kind === 278 /* SyntaxKind.ExportSpecifier */; } ts.isExportSpecifier = isExportSpecifier; function isMissingDeclaration(node) { - return node.kind === 276 /* SyntaxKind.MissingDeclaration */; + return node.kind === 279 /* SyntaxKind.MissingDeclaration */; } ts.isMissingDeclaration = isMissingDeclaration; function isNotEmittedStatement(node) { - return node.kind === 349 /* SyntaxKind.NotEmittedStatement */; + return node.kind === 352 /* SyntaxKind.NotEmittedStatement */; } ts.isNotEmittedStatement = isNotEmittedStatement; /* @internal */ function isSyntheticReference(node) { - return node.kind === 354 /* SyntaxKind.SyntheticReferenceExpression */; + return node.kind === 357 /* SyntaxKind.SyntheticReferenceExpression */; } ts.isSyntheticReference = isSyntheticReference; /* @internal */ function isMergeDeclarationMarker(node) { - return node.kind === 352 /* SyntaxKind.MergeDeclarationMarker */; + return node.kind === 355 /* SyntaxKind.MergeDeclarationMarker */; } ts.isMergeDeclarationMarker = isMergeDeclarationMarker; /* @internal */ function isEndOfDeclarationMarker(node) { - return node.kind === 353 /* SyntaxKind.EndOfDeclarationMarker */; + return node.kind === 356 /* SyntaxKind.EndOfDeclarationMarker */; } ts.isEndOfDeclarationMarker = isEndOfDeclarationMarker; // Module References function isExternalModuleReference(node) { - return node.kind === 277 /* SyntaxKind.ExternalModuleReference */; + return node.kind === 280 /* SyntaxKind.ExternalModuleReference */; } ts.isExternalModuleReference = isExternalModuleReference; // JSX function isJsxElement(node) { - return node.kind === 278 /* SyntaxKind.JsxElement */; + return node.kind === 281 /* SyntaxKind.JsxElement */; } ts.isJsxElement = isJsxElement; function isJsxSelfClosingElement(node) { - return node.kind === 279 /* SyntaxKind.JsxSelfClosingElement */; + return node.kind === 282 /* SyntaxKind.JsxSelfClosingElement */; } ts.isJsxSelfClosingElement = isJsxSelfClosingElement; function isJsxOpeningElement(node) { - return node.kind === 280 /* SyntaxKind.JsxOpeningElement */; + return node.kind === 283 /* SyntaxKind.JsxOpeningElement */; } ts.isJsxOpeningElement = isJsxOpeningElement; function isJsxClosingElement(node) { - return node.kind === 281 /* SyntaxKind.JsxClosingElement */; + return node.kind === 284 /* SyntaxKind.JsxClosingElement */; } ts.isJsxClosingElement = isJsxClosingElement; function isJsxFragment(node) { - return node.kind === 282 /* SyntaxKind.JsxFragment */; + return node.kind === 285 /* SyntaxKind.JsxFragment */; } ts.isJsxFragment = isJsxFragment; function isJsxOpeningFragment(node) { - return node.kind === 283 /* SyntaxKind.JsxOpeningFragment */; + return node.kind === 286 /* SyntaxKind.JsxOpeningFragment */; } ts.isJsxOpeningFragment = isJsxOpeningFragment; function isJsxClosingFragment(node) { - return node.kind === 284 /* SyntaxKind.JsxClosingFragment */; + return node.kind === 287 /* SyntaxKind.JsxClosingFragment */; } ts.isJsxClosingFragment = isJsxClosingFragment; function isJsxAttribute(node) { - return node.kind === 285 /* SyntaxKind.JsxAttribute */; + return node.kind === 288 /* SyntaxKind.JsxAttribute */; } ts.isJsxAttribute = isJsxAttribute; function isJsxAttributes(node) { - return node.kind === 286 /* SyntaxKind.JsxAttributes */; + return node.kind === 289 /* SyntaxKind.JsxAttributes */; } ts.isJsxAttributes = isJsxAttributes; function isJsxSpreadAttribute(node) { - return node.kind === 287 /* SyntaxKind.JsxSpreadAttribute */; + return node.kind === 290 /* SyntaxKind.JsxSpreadAttribute */; } ts.isJsxSpreadAttribute = isJsxSpreadAttribute; function isJsxExpression(node) { - return node.kind === 288 /* SyntaxKind.JsxExpression */; + return node.kind === 291 /* SyntaxKind.JsxExpression */; } ts.isJsxExpression = isJsxExpression; // Clauses function isCaseClause(node) { - return node.kind === 289 /* SyntaxKind.CaseClause */; + return node.kind === 292 /* SyntaxKind.CaseClause */; } ts.isCaseClause = isCaseClause; function isDefaultClause(node) { - return node.kind === 290 /* SyntaxKind.DefaultClause */; + return node.kind === 293 /* SyntaxKind.DefaultClause */; } ts.isDefaultClause = isDefaultClause; function isHeritageClause(node) { - return node.kind === 291 /* SyntaxKind.HeritageClause */; + return node.kind === 294 /* SyntaxKind.HeritageClause */; } ts.isHeritageClause = isHeritageClause; function isCatchClause(node) { - return node.kind === 292 /* SyntaxKind.CatchClause */; + return node.kind === 295 /* SyntaxKind.CatchClause */; } ts.isCatchClause = isCatchClause; // Property assignments function isPropertyAssignment(node) { - return node.kind === 296 /* SyntaxKind.PropertyAssignment */; + return node.kind === 299 /* SyntaxKind.PropertyAssignment */; } ts.isPropertyAssignment = isPropertyAssignment; function isShorthandPropertyAssignment(node) { - return node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */; + return node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */; } ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment; function isSpreadAssignment(node) { - return node.kind === 298 /* SyntaxKind.SpreadAssignment */; + return node.kind === 301 /* SyntaxKind.SpreadAssignment */; } ts.isSpreadAssignment = isSpreadAssignment; // Enum function isEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } ts.isEnumMember = isEnumMember; // Unparsed // TODO(rbuckton): isUnparsedPrologue function isUnparsedPrepend(node) { - return node.kind === 301 /* SyntaxKind.UnparsedPrepend */; + return node.kind === 304 /* SyntaxKind.UnparsedPrepend */; } ts.isUnparsedPrepend = isUnparsedPrepend; // TODO(rbuckton): isUnparsedText @@ -29575,176 +29810,176 @@ var ts; // TODO(rbuckton): isUnparsedSyntheticReference // Top-level nodes function isSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */; + return node.kind === 308 /* SyntaxKind.SourceFile */; } ts.isSourceFile = isSourceFile; function isBundle(node) { - return node.kind === 306 /* SyntaxKind.Bundle */; + return node.kind === 309 /* SyntaxKind.Bundle */; } ts.isBundle = isBundle; function isUnparsedSource(node) { - return node.kind === 307 /* SyntaxKind.UnparsedSource */; + return node.kind === 310 /* SyntaxKind.UnparsedSource */; } ts.isUnparsedSource = isUnparsedSource; // TODO(rbuckton): isInputFiles // JSDoc Elements function isJSDocTypeExpression(node) { - return node.kind === 309 /* SyntaxKind.JSDocTypeExpression */; + return node.kind === 312 /* SyntaxKind.JSDocTypeExpression */; } ts.isJSDocTypeExpression = isJSDocTypeExpression; function isJSDocNameReference(node) { - return node.kind === 310 /* SyntaxKind.JSDocNameReference */; + return node.kind === 313 /* SyntaxKind.JSDocNameReference */; } ts.isJSDocNameReference = isJSDocNameReference; function isJSDocMemberName(node) { - return node.kind === 311 /* SyntaxKind.JSDocMemberName */; + return node.kind === 314 /* SyntaxKind.JSDocMemberName */; } ts.isJSDocMemberName = isJSDocMemberName; function isJSDocLink(node) { - return node.kind === 324 /* SyntaxKind.JSDocLink */; + return node.kind === 327 /* SyntaxKind.JSDocLink */; } ts.isJSDocLink = isJSDocLink; function isJSDocLinkCode(node) { - return node.kind === 325 /* SyntaxKind.JSDocLinkCode */; + return node.kind === 328 /* SyntaxKind.JSDocLinkCode */; } ts.isJSDocLinkCode = isJSDocLinkCode; function isJSDocLinkPlain(node) { - return node.kind === 326 /* SyntaxKind.JSDocLinkPlain */; + return node.kind === 329 /* SyntaxKind.JSDocLinkPlain */; } ts.isJSDocLinkPlain = isJSDocLinkPlain; function isJSDocAllType(node) { - return node.kind === 312 /* SyntaxKind.JSDocAllType */; + return node.kind === 315 /* SyntaxKind.JSDocAllType */; } ts.isJSDocAllType = isJSDocAllType; function isJSDocUnknownType(node) { - return node.kind === 313 /* SyntaxKind.JSDocUnknownType */; + return node.kind === 316 /* SyntaxKind.JSDocUnknownType */; } ts.isJSDocUnknownType = isJSDocUnknownType; function isJSDocNullableType(node) { - return node.kind === 314 /* SyntaxKind.JSDocNullableType */; + return node.kind === 317 /* SyntaxKind.JSDocNullableType */; } ts.isJSDocNullableType = isJSDocNullableType; function isJSDocNonNullableType(node) { - return node.kind === 315 /* SyntaxKind.JSDocNonNullableType */; + return node.kind === 318 /* SyntaxKind.JSDocNonNullableType */; } ts.isJSDocNonNullableType = isJSDocNonNullableType; function isJSDocOptionalType(node) { - return node.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return node.kind === 319 /* SyntaxKind.JSDocOptionalType */; } ts.isJSDocOptionalType = isJSDocOptionalType; function isJSDocFunctionType(node) { - return node.kind === 317 /* SyntaxKind.JSDocFunctionType */; + return node.kind === 320 /* SyntaxKind.JSDocFunctionType */; } ts.isJSDocFunctionType = isJSDocFunctionType; function isJSDocVariadicType(node) { - return node.kind === 318 /* SyntaxKind.JSDocVariadicType */; + return node.kind === 321 /* SyntaxKind.JSDocVariadicType */; } ts.isJSDocVariadicType = isJSDocVariadicType; function isJSDocNamepathType(node) { - return node.kind === 319 /* SyntaxKind.JSDocNamepathType */; + return node.kind === 322 /* SyntaxKind.JSDocNamepathType */; } ts.isJSDocNamepathType = isJSDocNamepathType; function isJSDoc(node) { - return node.kind === 320 /* SyntaxKind.JSDoc */; + return node.kind === 323 /* SyntaxKind.JSDoc */; } ts.isJSDoc = isJSDoc; function isJSDocTypeLiteral(node) { - return node.kind === 322 /* SyntaxKind.JSDocTypeLiteral */; + return node.kind === 325 /* SyntaxKind.JSDocTypeLiteral */; } ts.isJSDocTypeLiteral = isJSDocTypeLiteral; function isJSDocSignature(node) { - return node.kind === 323 /* SyntaxKind.JSDocSignature */; + return node.kind === 326 /* SyntaxKind.JSDocSignature */; } ts.isJSDocSignature = isJSDocSignature; // JSDoc Tags function isJSDocAugmentsTag(node) { - return node.kind === 328 /* SyntaxKind.JSDocAugmentsTag */; + return node.kind === 331 /* SyntaxKind.JSDocAugmentsTag */; } ts.isJSDocAugmentsTag = isJSDocAugmentsTag; function isJSDocAuthorTag(node) { - return node.kind === 330 /* SyntaxKind.JSDocAuthorTag */; + return node.kind === 333 /* SyntaxKind.JSDocAuthorTag */; } ts.isJSDocAuthorTag = isJSDocAuthorTag; function isJSDocClassTag(node) { - return node.kind === 332 /* SyntaxKind.JSDocClassTag */; + return node.kind === 335 /* SyntaxKind.JSDocClassTag */; } ts.isJSDocClassTag = isJSDocClassTag; function isJSDocCallbackTag(node) { - return node.kind === 338 /* SyntaxKind.JSDocCallbackTag */; + return node.kind === 341 /* SyntaxKind.JSDocCallbackTag */; } ts.isJSDocCallbackTag = isJSDocCallbackTag; function isJSDocPublicTag(node) { - return node.kind === 333 /* SyntaxKind.JSDocPublicTag */; + return node.kind === 336 /* SyntaxKind.JSDocPublicTag */; } ts.isJSDocPublicTag = isJSDocPublicTag; function isJSDocPrivateTag(node) { - return node.kind === 334 /* SyntaxKind.JSDocPrivateTag */; + return node.kind === 337 /* SyntaxKind.JSDocPrivateTag */; } ts.isJSDocPrivateTag = isJSDocPrivateTag; function isJSDocProtectedTag(node) { - return node.kind === 335 /* SyntaxKind.JSDocProtectedTag */; + return node.kind === 338 /* SyntaxKind.JSDocProtectedTag */; } ts.isJSDocProtectedTag = isJSDocProtectedTag; function isJSDocReadonlyTag(node) { - return node.kind === 336 /* SyntaxKind.JSDocReadonlyTag */; + return node.kind === 339 /* SyntaxKind.JSDocReadonlyTag */; } ts.isJSDocReadonlyTag = isJSDocReadonlyTag; function isJSDocOverrideTag(node) { - return node.kind === 337 /* SyntaxKind.JSDocOverrideTag */; + return node.kind === 340 /* SyntaxKind.JSDocOverrideTag */; } ts.isJSDocOverrideTag = isJSDocOverrideTag; function isJSDocDeprecatedTag(node) { - return node.kind === 331 /* SyntaxKind.JSDocDeprecatedTag */; + return node.kind === 334 /* SyntaxKind.JSDocDeprecatedTag */; } ts.isJSDocDeprecatedTag = isJSDocDeprecatedTag; function isJSDocSeeTag(node) { - return node.kind === 346 /* SyntaxKind.JSDocSeeTag */; + return node.kind === 349 /* SyntaxKind.JSDocSeeTag */; } ts.isJSDocSeeTag = isJSDocSeeTag; function isJSDocEnumTag(node) { - return node.kind === 339 /* SyntaxKind.JSDocEnumTag */; + return node.kind === 342 /* SyntaxKind.JSDocEnumTag */; } ts.isJSDocEnumTag = isJSDocEnumTag; function isJSDocParameterTag(node) { - return node.kind === 340 /* SyntaxKind.JSDocParameterTag */; + return node.kind === 343 /* SyntaxKind.JSDocParameterTag */; } ts.isJSDocParameterTag = isJSDocParameterTag; function isJSDocReturnTag(node) { - return node.kind === 341 /* SyntaxKind.JSDocReturnTag */; + return node.kind === 344 /* SyntaxKind.JSDocReturnTag */; } ts.isJSDocReturnTag = isJSDocReturnTag; function isJSDocThisTag(node) { - return node.kind === 342 /* SyntaxKind.JSDocThisTag */; + return node.kind === 345 /* SyntaxKind.JSDocThisTag */; } ts.isJSDocThisTag = isJSDocThisTag; function isJSDocTypeTag(node) { - return node.kind === 343 /* SyntaxKind.JSDocTypeTag */; + return node.kind === 346 /* SyntaxKind.JSDocTypeTag */; } ts.isJSDocTypeTag = isJSDocTypeTag; function isJSDocTemplateTag(node) { - return node.kind === 344 /* SyntaxKind.JSDocTemplateTag */; + return node.kind === 347 /* SyntaxKind.JSDocTemplateTag */; } ts.isJSDocTemplateTag = isJSDocTemplateTag; function isJSDocTypedefTag(node) { - return node.kind === 345 /* SyntaxKind.JSDocTypedefTag */; + return node.kind === 348 /* SyntaxKind.JSDocTypedefTag */; } ts.isJSDocTypedefTag = isJSDocTypedefTag; function isJSDocUnknownTag(node) { - return node.kind === 327 /* SyntaxKind.JSDocTag */; + return node.kind === 330 /* SyntaxKind.JSDocTag */; } ts.isJSDocUnknownTag = isJSDocUnknownTag; function isJSDocPropertyTag(node) { - return node.kind === 347 /* SyntaxKind.JSDocPropertyTag */; + return node.kind === 350 /* SyntaxKind.JSDocPropertyTag */; } ts.isJSDocPropertyTag = isJSDocPropertyTag; function isJSDocImplementsTag(node) { - return node.kind === 329 /* SyntaxKind.JSDocImplementsTag */; + return node.kind === 332 /* SyntaxKind.JSDocImplementsTag */; } ts.isJSDocImplementsTag = isJSDocImplementsTag; // Synthesized list /* @internal */ function isSyntaxList(n) { - return n.kind === 348 /* SyntaxKind.SyntaxList */; + return n.kind === 351 /* SyntaxKind.SyntaxList */; } ts.isSyntaxList = isSyntaxList; })(ts || (ts = {})); @@ -29943,14 +30178,14 @@ var ts; ts.Debug.failBadSyntaxKind(property.name, "Private identifiers are not allowed in object literals."); } switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return createExpressionForAccessorDeclaration(factory, node.properties, property, receiver, !!node.multiLine); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return createExpressionForPropertyAssignment(factory, property, receiver); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return createExpressionForShorthandPropertyAssignment(factory, property, receiver); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return createExpressionForMethodDeclaration(factory, property, receiver); } } @@ -30058,8 +30293,8 @@ var ts; } ts.startsWithUseStrict = startsWithUseStrict; function isCommaSequence(node) { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || - node.kind === 351 /* SyntaxKind.CommaListExpression */; + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ || + node.kind === 354 /* SyntaxKind.CommaListExpression */; } ts.isCommaSequence = isCommaSequence; function isJSDocTypeAssertion(node) { @@ -30077,17 +30312,18 @@ var ts; function isOuterExpression(node, kinds) { if (kinds === void 0) { kinds = 15 /* OuterExpressionKinds.All */; } switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: if (kinds & 16 /* OuterExpressionKinds.ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) { return false; } return (kinds & 1 /* OuterExpressionKinds.Parentheses */) !== 0; - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: return (kinds & 2 /* OuterExpressionKinds.TypeAssertions */) !== 0; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return (kinds & 4 /* OuterExpressionKinds.NonNullAssertions */) !== 0; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return (kinds & 8 /* OuterExpressionKinds.PartiallyEmittedExpressions */) !== 0; } return false; @@ -30208,10 +30444,10 @@ var ts; var name = namespaceDeclaration.name; return ts.isGeneratedIdentifier(name) ? name : factory.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name)); } - if (node.kind === 266 /* SyntaxKind.ImportDeclaration */ && node.importClause) { + if (node.kind === 269 /* SyntaxKind.ImportDeclaration */ && node.importClause) { return factory.getGeneratedNameForNode(node); } - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ && node.moduleSpecifier) { return factory.getGeneratedNameForNode(node); } return undefined; @@ -30330,7 +30566,7 @@ var ts; } if (ts.isObjectLiteralElementLike(bindingElement)) { switch (bindingElement.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `b` in `({ a: b } = ...)` // `b` in `({ a: b = 1 } = ...)` // `{b}` in `({ a: {b} } = ...)` @@ -30342,11 +30578,11 @@ var ts; // `b[0]` in `({ a: b[0] } = ...)` // `b[0]` in `({ a: b[0] = 1 } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.initializer); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: // `a` in `({ a } = ...)` // `a` in `({ a = 1 } = ...)` return bindingElement.name; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` return getTargetOfBindingOrAssignmentElement(bindingElement.expression); } @@ -30378,12 +30614,12 @@ var ts; */ function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: // `...` in `let [...a] = ...` return bindingElement.dotDotDotToken; - case 225 /* SyntaxKind.SpreadElement */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 227 /* SyntaxKind.SpreadElement */: + case 301 /* SyntaxKind.SpreadAssignment */: // `...` in `[...a] = ...` return bindingElement; } @@ -30401,7 +30637,7 @@ var ts; ts.getPropertyNameOfBindingOrAssignmentElement = getPropertyNameOfBindingOrAssignmentElement; function tryGetPropertyNameOfBindingOrAssignmentElement(bindingElement) { switch (bindingElement.kind) { - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: // `a` in `let { a: b } = ...` // `[a]` in `let { [a]: b } = ...` // `"a"` in `let { "a": b } = ...` @@ -30416,7 +30652,7 @@ var ts; : propertyName; } break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // `a` in `({ a: b } = ...)` // `[a]` in `({ [a]: b } = ...)` // `"a"` in `({ "a": b } = ...)` @@ -30431,7 +30667,7 @@ var ts; : propertyName; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: // `a` in `({ ...a } = ...)` if (bindingElement.name && ts.isPrivateIdentifier(bindingElement.name)) { return ts.Debug.failBadSyntaxKind(bindingElement.name); @@ -30454,13 +30690,13 @@ var ts; */ function getElementsOfBindingOrAssignmentPattern(name) { switch (name.kind) { - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: // `a` in `{a}` // `a` in `[a]` return name.elements; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: // `a` in `{a}` return name.properties; } @@ -30481,46 +30717,46 @@ var ts; ts.getJSDocTypeAliasName = getJSDocTypeAliasName; function canHaveIllegalType(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalType = canHaveIllegalType; function canHaveIllegalTypeParameters(node) { var kind = node.kind; - return kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } ts.canHaveIllegalTypeParameters = canHaveIllegalTypeParameters; function canHaveIllegalDecorators(node) { var kind = node.kind; - return kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || kind === 272 /* SyntaxKind.ExportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */; + return kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || kind === 275 /* SyntaxKind.ExportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */; } ts.canHaveIllegalDecorators = canHaveIllegalDecorators; function canHaveIllegalModifiers(node) { var kind = node.kind; - return kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ - || kind === 296 /* SyntaxKind.PropertyAssignment */ - || kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || kind === 179 /* SyntaxKind.FunctionType */ - || kind === 276 /* SyntaxKind.MissingDeclaration */ - || kind === 264 /* SyntaxKind.NamespaceExportDeclaration */; + return kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ + || kind === 299 /* SyntaxKind.PropertyAssignment */ + || kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || kind === 181 /* SyntaxKind.FunctionType */ + || kind === 279 /* SyntaxKind.MissingDeclaration */ + || kind === 267 /* SyntaxKind.NamespaceExportDeclaration */; } ts.canHaveIllegalModifiers = canHaveIllegalModifiers; ts.isTypeNodeOrTypeParameterDeclaration = ts.or(ts.isTypeNode, ts.isTypeParameterDeclaration); @@ -30794,6 +31030,83 @@ var ts; return ts.setTextRange(factory.createNodeArray([], nodes.hasTrailingComma), nodes); } ts.elideNodes = elideNodes; + /** + * Gets the node from which a name should be generated. + */ + function getNodeForGeneratedName(name) { + if (name.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) { + var autoGenerateId = name.autoGenerateId; + var node = name; + var original = node.original; + while (original) { + node = original; + // if "node" is a different generated name (having a different "autoGenerateId"), use it and stop traversing. + if (ts.isMemberName(node) + && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) + && node.autoGenerateId !== autoGenerateId) { + break; + } + original = node.original; + } + // otherwise, return the original node for the source + return node; + } + return name; + } + ts.getNodeForGeneratedName = getNodeForGeneratedName; + function formatGeneratedNamePart(part, generateName) { + return typeof part === "object" ? formatGeneratedName(/*privateName*/ false, part.prefix, part.node, part.suffix, generateName) : + typeof part === "string" ? part.length > 0 && part.charCodeAt(0) === 35 /* CharacterCodes.hash */ ? part.slice(1) : part : + ""; + } + ts.formatGeneratedNamePart = formatGeneratedNamePart; + function formatIdentifier(name, generateName) { + return typeof name === "string" ? name : + formatIdentifierWorker(name, ts.Debug.checkDefined(generateName)); + } + function formatIdentifierWorker(node, generateName) { + return ts.isGeneratedPrivateIdentifier(node) ? generateName(node).slice(1) : + ts.isGeneratedIdentifier(node) ? generateName(node) : + ts.isPrivateIdentifier(node) ? node.escapedText.slice(1) : + ts.idText(node); + } + function formatGeneratedName(privateName, prefix, baseName, suffix, generateName) { + prefix = formatGeneratedNamePart(prefix, generateName); + suffix = formatGeneratedNamePart(suffix, generateName); + baseName = formatIdentifier(baseName, generateName); + return "".concat(privateName ? "#" : "").concat(prefix).concat(baseName).concat(suffix); + } + ts.formatGeneratedName = formatGeneratedName; + /** + * Creates a private backing field for an `accessor` {@link PropertyDeclaration}. + */ + function createAccessorPropertyBackingField(factory, node, modifiers, initializer) { + return factory.updatePropertyDeclaration(node, modifiers, factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"), + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, initializer); + } + ts.createAccessorPropertyBackingField = createAccessorPropertyBackingField; + /** + * Creates a {@link GetAccessorDeclaration} that reads from a private backing field. + */ + function createAccessorPropertyGetRedirector(factory, node, modifiers, name) { + return factory.createGetAccessorDeclaration(modifiers, name, [], + /*type*/ undefined, factory.createBlock([ + factory.createReturnStatement(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage"))) + ])); + } + ts.createAccessorPropertyGetRedirector = createAccessorPropertyGetRedirector; + /** + * Creates a {@link SetAccessorDeclaration} that writes to a private backing field. + */ + function createAccessorPropertySetRedirector(factory, node, modifiers, name) { + return factory.createSetAccessorDeclaration(modifiers, name, [factory.createParameterDeclaration( + /*modifiers*/ undefined, + /*dotdotDotToken*/ undefined, "value")], factory.createBlock([ + factory.createExpressionStatement(factory.createAssignment(factory.createPropertyAccessExpression(factory.createThis(), factory.getGeneratedPrivateNameForNode(node.name, /*prefix*/ undefined, "_accessor_storage")), factory.createIdentifier("value"))) + ])); + } + ts.createAccessorPropertySetRedirector = createAccessorPropertySetRedirector; })(ts || (ts = {})); var ts; (function (ts) { @@ -30803,47 +31116,48 @@ var ts; ts.setTextRange = setTextRange; function canHaveModifiers(node) { var kind = node.kind; - return kind === 163 /* SyntaxKind.TypeParameter */ - || kind === 164 /* SyntaxKind.Parameter */ - || kind === 166 /* SyntaxKind.PropertySignature */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 168 /* SyntaxKind.MethodSignature */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 176 /* SyntaxKind.IndexSignature */ - || kind === 180 /* SyntaxKind.ConstructorType */ - || kind === 213 /* SyntaxKind.FunctionExpression */ - || kind === 214 /* SyntaxKind.ArrowFunction */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 237 /* SyntaxKind.VariableStatement */ - || kind === 256 /* SyntaxKind.FunctionDeclaration */ - || kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 258 /* SyntaxKind.InterfaceDeclaration */ - || kind === 259 /* SyntaxKind.TypeAliasDeclaration */ - || kind === 260 /* SyntaxKind.EnumDeclaration */ - || kind === 261 /* SyntaxKind.ModuleDeclaration */ - || kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || kind === 266 /* SyntaxKind.ImportDeclaration */ - || kind === 271 /* SyntaxKind.ExportAssignment */ - || kind === 272 /* SyntaxKind.ExportDeclaration */; + return kind === 165 /* SyntaxKind.TypeParameter */ + || kind === 166 /* SyntaxKind.Parameter */ + || kind === 168 /* SyntaxKind.PropertySignature */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 170 /* SyntaxKind.MethodSignature */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 178 /* SyntaxKind.IndexSignature */ + || kind === 182 /* SyntaxKind.ConstructorType */ + || kind === 215 /* SyntaxKind.FunctionExpression */ + || kind === 216 /* SyntaxKind.ArrowFunction */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 240 /* SyntaxKind.VariableStatement */ + || kind === 259 /* SyntaxKind.FunctionDeclaration */ + || kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 261 /* SyntaxKind.InterfaceDeclaration */ + || kind === 262 /* SyntaxKind.TypeAliasDeclaration */ + || kind === 263 /* SyntaxKind.EnumDeclaration */ + || kind === 264 /* SyntaxKind.ModuleDeclaration */ + || kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || kind === 269 /* SyntaxKind.ImportDeclaration */ + || kind === 274 /* SyntaxKind.ExportAssignment */ + || kind === 275 /* SyntaxKind.ExportDeclaration */; } ts.canHaveModifiers = canHaveModifiers; function canHaveDecorators(node) { var kind = node.kind; - return kind === 164 /* SyntaxKind.Parameter */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 226 /* SyntaxKind.ClassExpression */ - || kind === 257 /* SyntaxKind.ClassDeclaration */; + return kind === 166 /* SyntaxKind.Parameter */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 228 /* SyntaxKind.ClassExpression */ + || kind === 260 /* SyntaxKind.ClassDeclaration */; } ts.canHaveDecorators = canHaveDecorators; })(ts || (ts = {})); var ts; (function (ts) { + var _a; var SignatureFlags; (function (SignatureFlags) { SignatureFlags[SignatureFlags["None"] = 0] = "None"; @@ -30931,6 +31245,718 @@ var ts; function isImportMeta(node) { return ts.isMetaProperty(node) && node.keywordToken === 100 /* SyntaxKind.ImportKeyword */ && node.name.escapedText === "meta"; } + var forEachChildTable = (_a = {}, + _a[163 /* SyntaxKind.QualifiedName */] = function forEachChildInQualifiedName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[165 /* SyntaxKind.TypeParameter */] = function forEachChildInTypeParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.constraint) || + visitNode(cbNode, node.default) || + visitNode(cbNode, node.expression); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function forEachChildInShorthandPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.equalsToken) || + visitNode(cbNode, node.objectAssignmentInitializer); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function forEachChildInSpreadAssignment(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[166 /* SyntaxKind.Parameter */] = function forEachChildInParameter(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function forEachChildInPropertyDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[168 /* SyntaxKind.PropertySignature */] = function forEachChildInPropertySignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[299 /* SyntaxKind.PropertyAssignment */] = function forEachChildInPropertyAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.initializer); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function forEachChildInVariableDeclaration(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.exclamationToken) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.initializer); + }, + _a[205 /* SyntaxKind.BindingElement */] = function forEachChildInBindingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function forEachChildInIndexSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function forEachChildInConstructorType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[181 /* SyntaxKind.FunctionType */] = function forEachChildInFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[176 /* SyntaxKind.CallSignature */] = forEachChildInCallOrConstructSignature, + _a[177 /* SyntaxKind.ConstructSignature */] = forEachChildInCallOrConstructSignature, + _a[171 /* SyntaxKind.MethodDeclaration */] = function forEachChildInMethodDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.exclamationToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function forEachChildInMethodSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[173 /* SyntaxKind.Constructor */] = function forEachChildInConstructor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function forEachChildInGetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function forEachChildInSetAccessor(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function forEachChildInFunctionDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function forEachChildInFunctionExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.body); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function forEachChildInArrowFunction(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type) || + visitNode(cbNode, node.equalsGreaterThanToken) || + visitNode(cbNode, node.body); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function forEachChildInClassStaticBlockDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.body); + }, + _a[180 /* SyntaxKind.TypeReference */] = function forEachChildInTypeReference(node, cbNode, cbNodes) { + return visitNode(cbNode, node.typeName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[179 /* SyntaxKind.TypePredicate */] = function forEachChildInTypePredicate(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertsModifier) || + visitNode(cbNode, node.parameterName) || + visitNode(cbNode, node.type); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function forEachChildInTypeQuery(node, cbNode, cbNodes) { + return visitNode(cbNode, node.exprName) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function forEachChildInTypeLiteral(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.members); + }, + _a[185 /* SyntaxKind.ArrayType */] = function forEachChildInArrayType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.elementType); + }, + _a[186 /* SyntaxKind.TupleType */] = function forEachChildInTupleType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[189 /* SyntaxKind.UnionType */] = forEachChildInUnionOrIntersectionType, + _a[190 /* SyntaxKind.IntersectionType */] = forEachChildInUnionOrIntersectionType, + _a[191 /* SyntaxKind.ConditionalType */] = function forEachChildInConditionalType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.checkType) || + visitNode(cbNode, node.extendsType) || + visitNode(cbNode, node.trueType) || + visitNode(cbNode, node.falseType); + }, + _a[192 /* SyntaxKind.InferType */] = function forEachChildInInferType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.typeParameter); + }, + _a[202 /* SyntaxKind.ImportType */] = function forEachChildInImportType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.argument) || + visitNode(cbNode, node.assertions) || + visitNode(cbNode, node.qualifier) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function forEachChildInImportTypeAssertionContainer(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.assertClause); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[195 /* SyntaxKind.TypeOperator */] = forEachChildInParenthesizedTypeOrTypeOperator, + _a[196 /* SyntaxKind.IndexedAccessType */] = function forEachChildInIndexedAccessType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.objectType) || + visitNode(cbNode, node.indexType); + }, + _a[197 /* SyntaxKind.MappedType */] = function forEachChildInMappedType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.readonlyToken) || + visitNode(cbNode, node.typeParameter) || + visitNode(cbNode, node.nameType) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[198 /* SyntaxKind.LiteralType */] = function forEachChildInLiteralType(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.literal); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function forEachChildInNamedTupleMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.type); + }, + _a[203 /* SyntaxKind.ObjectBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = forEachChildInObjectOrArrayBindingPattern, + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function forEachChildInArrayLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function forEachChildInObjectLiteralExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function forEachChildInPropertyAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.name); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function forEachChildInElementAccessExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.questionDotToken) || + visitNode(cbNode, node.argumentExpression); + }, + _a[210 /* SyntaxKind.CallExpression */] = forEachChildInCallOrNewExpression, + _a[211 /* SyntaxKind.NewExpression */] = forEachChildInCallOrNewExpression, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function forEachChildInTaggedTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tag) || + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.template); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function forEachChildInTypeAssertionExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.expression); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function forEachChildInParenthesizedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function forEachChildInDeleteExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function forEachChildInTypeOfExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function forEachChildInVoidExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function forEachChildInPrefixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function forEachChildInYieldExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.asteriskToken) || + visitNode(cbNode, node.expression); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function forEachChildInAwaitExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function forEachChildInPostfixUnaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.operand); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function forEachChildInBinaryExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.operatorToken) || + visitNode(cbNode, node.right); + }, + _a[231 /* SyntaxKind.AsExpression */] = function forEachChildInAsExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.type); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function forEachChildInNonNullExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function forEachChildInSatisfiesExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || visitNode(cbNode, node.type); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function forEachChildInMetaProperty(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function forEachChildInConditionalExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.condition) || + visitNode(cbNode, node.questionToken) || + visitNode(cbNode, node.whenTrue) || + visitNode(cbNode, node.colonToken) || + visitNode(cbNode, node.whenFalse); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function forEachChildInSpreadElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[238 /* SyntaxKind.Block */] = forEachChildInBlock, + _a[265 /* SyntaxKind.ModuleBlock */] = forEachChildInBlock, + _a[308 /* SyntaxKind.SourceFile */] = function forEachChildInSourceFile(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements) || + visitNode(cbNode, node.endOfFileToken); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function forEachChildInVariableStatement(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.declarationList); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function forEachChildInVariableDeclarationList(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.declarations); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function forEachChildInExpressionStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[242 /* SyntaxKind.IfStatement */] = function forEachChildInIfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.thenStatement) || + visitNode(cbNode, node.elseStatement); + }, + _a[243 /* SyntaxKind.DoStatement */] = function forEachChildInDoStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.statement) || + visitNode(cbNode, node.expression); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function forEachChildInWhileStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[245 /* SyntaxKind.ForStatement */] = function forEachChildInForStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.condition) || + visitNode(cbNode, node.incrementor) || + visitNode(cbNode, node.statement); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function forEachChildInForInStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function forEachChildInForOfStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.awaitModifier) || + visitNode(cbNode, node.initializer) || + visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = forEachChildInContinueOrBreakStatement, + _a[249 /* SyntaxKind.BreakStatement */] = forEachChildInContinueOrBreakStatement, + _a[250 /* SyntaxKind.ReturnStatement */] = function forEachChildInReturnStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[251 /* SyntaxKind.WithStatement */] = function forEachChildInWithStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.statement); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function forEachChildInSwitchStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.caseBlock); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function forEachChildInCaseBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.clauses); + }, + _a[292 /* SyntaxKind.CaseClause */] = function forEachChildInCaseClause(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.statements); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function forEachChildInDefaultClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function forEachChildInLabeledStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label) || + visitNode(cbNode, node.statement); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function forEachChildInThrowStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[255 /* SyntaxKind.TryStatement */] = function forEachChildInTryStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tryBlock) || + visitNode(cbNode, node.catchClause) || + visitNode(cbNode, node.finallyBlock); + }, + _a[295 /* SyntaxKind.CatchClause */] = function forEachChildInCatchClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.variableDeclaration) || + visitNode(cbNode, node.block); + }, + _a[167 /* SyntaxKind.Decorator */] = function forEachChildInDecorator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = forEachChildInClassDeclarationOrExpression, + _a[228 /* SyntaxKind.ClassExpression */] = forEachChildInClassDeclarationOrExpression, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function forEachChildInInterfaceDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function forEachChildInTypeAliasDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNode(cbNode, node.type); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function forEachChildInEnumDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.members); + }, + _a[302 /* SyntaxKind.EnumMember */] = function forEachChildInEnumMember(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function forEachChildInModuleDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.body); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function forEachChildInImportEqualsDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNode(cbNode, node.moduleReference); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function forEachChildInImportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.importClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[270 /* SyntaxKind.ImportClause */] = function forEachChildInImportClause(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.namedBindings); + }, + _a[296 /* SyntaxKind.AssertClause */] = function forEachChildInAssertClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function forEachChildInAssertEntry(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.value); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function forEachChildInNamespaceExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNode(cbNode, node.name); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function forEachChildInNamespaceImport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function forEachChildInNamespaceExport(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[272 /* SyntaxKind.NamedImports */] = forEachChildInNamedImportsOrExports, + _a[276 /* SyntaxKind.NamedExports */] = forEachChildInNamedImportsOrExports, + _a[275 /* SyntaxKind.ExportDeclaration */] = function forEachChildInExportDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.exportClause) || + visitNode(cbNode, node.moduleSpecifier) || + visitNode(cbNode, node.assertClause); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[278 /* SyntaxKind.ExportSpecifier */] = forEachChildInImportOrExportSpecifier, + _a[274 /* SyntaxKind.ExportAssignment */] = function forEachChildInExportAssignment(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.expression); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function forEachChildInTemplateExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[236 /* SyntaxKind.TemplateSpan */] = function forEachChildInTemplateSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression) || + visitNode(cbNode, node.literal); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function forEachChildInTemplateLiteralType(node, cbNode, cbNodes) { + return visitNode(cbNode, node.head) || + visitNodes(cbNode, cbNodes, node.templateSpans); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function forEachChildInTemplateLiteralTypeSpan(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type) || + visitNode(cbNode, node.literal); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function forEachChildInComputedPropertyName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function forEachChildInHeritageClause(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function forEachChildInExpressionWithTypeArguments(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + visitNodes(cbNode, cbNodes, node.typeArguments); + }, + _a[280 /* SyntaxKind.ExternalModuleReference */] = function forEachChildInExternalModuleReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[279 /* SyntaxKind.MissingDeclaration */] = function forEachChildInMissingDeclaration(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.illegalDecorators) || + visitNodes(cbNode, cbNodes, node.modifiers); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function forEachChildInCommaListExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + }, + _a[281 /* SyntaxKind.JsxElement */] = function forEachChildInJsxElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingElement) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingElement); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function forEachChildInJsxFragment(node, cbNode, cbNodes) { + return visitNode(cbNode, node.openingFragment) || + visitNodes(cbNode, cbNodes, node.children) || + visitNode(cbNode, node.closingFragment); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[283 /* SyntaxKind.JsxOpeningElement */] = forEachChildInJsxOpeningOrSelfClosingElement, + _a[289 /* SyntaxKind.JsxAttributes */] = function forEachChildInJsxAttributes(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.properties); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function forEachChildInJsxAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name) || + visitNode(cbNode, node.initializer); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function forEachChildInJsxSpreadAttribute(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function forEachChildInJsxExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.dotDotDotToken) || + visitNode(cbNode, node.expression); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function forEachChildInJsxClosingElement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.tagName); + }, + _a[187 /* SyntaxKind.OptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[188 /* SyntaxKind.RestType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[312 /* SyntaxKind.JSDocTypeExpression */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[318 /* SyntaxKind.JSDocNonNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[317 /* SyntaxKind.JSDocNullableType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[319 /* SyntaxKind.JSDocOptionalType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[321 /* SyntaxKind.JSDocVariadicType */] = forEachChildInOptionalRestOrJSDocParameterModifier, + _a[320 /* SyntaxKind.JSDocFunctionType */] = function forEachChildInJSDocFunctionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + }, + _a[323 /* SyntaxKind.JSDoc */] = function forEachChildInJSDoc(node, cbNode, cbNodes) { + return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + || visitNodes(cbNode, cbNodes, node.tags); + }, + _a[349 /* SyntaxKind.JSDocSeeTag */] = function forEachChildInJSDocSeeTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.name) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[313 /* SyntaxKind.JSDocNameReference */] = function forEachChildInJSDocNameReference(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + }, + _a[314 /* SyntaxKind.JSDocMemberName */] = function forEachChildInJSDocMemberName(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.left) || + visitNode(cbNode, node.right); + }, + _a[343 /* SyntaxKind.JSDocParameterTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[350 /* SyntaxKind.JSDocPropertyTag */] = forEachChildInJSDocParameterOrPropertyTag, + _a[333 /* SyntaxKind.JSDocAuthorTag */] = function forEachChildInJSDocAuthorTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[332 /* SyntaxKind.JSDocImplementsTag */] = function forEachChildInJSDocImplementsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[331 /* SyntaxKind.JSDocAugmentsTag */] = function forEachChildInJSDocAugmentsTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.class) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[347 /* SyntaxKind.JSDocTemplateTag */] = function forEachChildInJSDocTemplateTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.constraint) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[348 /* SyntaxKind.JSDocTypedefTag */] = function forEachChildInJSDocTypedefTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.typeExpression && + node.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */ + ? visitNode(cbNode, node.typeExpression) || + visitNode(cbNode, node.fullName) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) + : visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); + }, + _a[341 /* SyntaxKind.JSDocCallbackTag */] = function forEachChildInJSDocCallbackTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.fullName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + }, + _a[344 /* SyntaxKind.JSDocReturnTag */] = forEachChildInJSDocReturnTag, + _a[346 /* SyntaxKind.JSDocTypeTag */] = forEachChildInJSDocReturnTag, + _a[345 /* SyntaxKind.JSDocThisTag */] = forEachChildInJSDocReturnTag, + _a[342 /* SyntaxKind.JSDocEnumTag */] = forEachChildInJSDocReturnTag, + _a[326 /* SyntaxKind.JSDocSignature */] = function forEachChildInJSDocSignature(node, cbNode, _cbNodes) { + return ts.forEach(node.typeParameters, cbNode) || + ts.forEach(node.parameters, cbNode) || + visitNode(cbNode, node.type); + }, + _a[327 /* SyntaxKind.JSDocLink */] = forEachChildInJSDocLinkCodeOrPlain, + _a[328 /* SyntaxKind.JSDocLinkCode */] = forEachChildInJSDocLinkCodeOrPlain, + _a[329 /* SyntaxKind.JSDocLinkPlain */] = forEachChildInJSDocLinkCodeOrPlain, + _a[325 /* SyntaxKind.JSDocTypeLiteral */] = function forEachChildInJSDocTypeLiteral(node, cbNode, _cbNodes) { + return ts.forEach(node.jsDocPropertyTags, cbNode); + }, + _a[330 /* SyntaxKind.JSDocTag */] = forEachChildInJSDocTag, + _a[335 /* SyntaxKind.JSDocClassTag */] = forEachChildInJSDocTag, + _a[336 /* SyntaxKind.JSDocPublicTag */] = forEachChildInJSDocTag, + _a[337 /* SyntaxKind.JSDocPrivateTag */] = forEachChildInJSDocTag, + _a[338 /* SyntaxKind.JSDocProtectedTag */] = forEachChildInJSDocTag, + _a[339 /* SyntaxKind.JSDocReadonlyTag */] = forEachChildInJSDocTag, + _a[334 /* SyntaxKind.JSDocDeprecatedTag */] = forEachChildInJSDocTag, + _a[340 /* SyntaxKind.JSDocOverrideTag */] = forEachChildInJSDocTag, + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = forEachChildInPartiallyEmittedExpression, + _a); + // shared + function forEachChildInCallOrConstructSignature(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.parameters) || + visitNode(cbNode, node.type); + } + function forEachChildInUnionOrIntersectionType(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.types); + } + function forEachChildInParenthesizedTypeOrTypeOperator(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInObjectOrArrayBindingPattern(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInCallOrNewExpression(node, cbNode, cbNodes) { + return visitNode(cbNode, node.expression) || + // TODO: should we separate these branches out? + visitNode(cbNode, node.questionDotToken) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNodes(cbNode, cbNodes, node.arguments); + } + function forEachChildInBlock(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.statements); + } + function forEachChildInContinueOrBreakStatement(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.label); + } + function forEachChildInClassDeclarationOrExpression(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.modifiers) || + visitNode(cbNode, node.name) || + visitNodes(cbNode, cbNodes, node.typeParameters) || + visitNodes(cbNode, cbNodes, node.heritageClauses) || + visitNodes(cbNode, cbNodes, node.members); + } + function forEachChildInNamedImportsOrExports(node, cbNode, cbNodes) { + return visitNodes(cbNode, cbNodes, node.elements); + } + function forEachChildInImportOrExportSpecifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.propertyName) || + visitNode(cbNode, node.name); + } + function forEachChildInJsxOpeningOrSelfClosingElement(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNodes(cbNode, cbNodes, node.typeArguments) || + visitNode(cbNode, node.attributes); + } + function forEachChildInOptionalRestOrJSDocParameterModifier(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.type); + } + function forEachChildInJSDocParameterOrPropertyTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + (node.isNameFirst + ? visitNode(cbNode, node.name) || visitNode(cbNode, node.typeExpression) + : visitNode(cbNode, node.typeExpression) || visitNode(cbNode, node.name)) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocReturnTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) || + visitNode(cbNode, node.typeExpression) || + (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInJSDocLinkCodeOrPlain(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.name); + } + function forEachChildInJSDocTag(node, cbNode, cbNodes) { + return visitNode(cbNode, node.tagName) + || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); + } + function forEachChildInPartiallyEmittedExpression(node, cbNode, _cbNodes) { + return visitNode(cbNode, node.expression); + } /** * Invokes a callback for each child of the given node. The 'cbNode' callback is invoked for all child nodes * stored in properties. If a 'cbNodes' callback is specified, it is invoked for embedded arrays; otherwise, @@ -30945,563 +31971,11 @@ var ts; * that they appear in the source code. The language service depends on this property to locate nodes by position. */ function forEachChild(node, cbNode, cbNodes) { - if (!node || node.kind <= 160 /* SyntaxKind.LastToken */) { + if (node === undefined || node.kind <= 162 /* SyntaxKind.LastToken */) { return; } - switch (node.kind) { - case 161 /* SyntaxKind.QualifiedName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 163 /* SyntaxKind.TypeParameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.constraint) || - visitNode(cbNode, node.default) || - visitNode(cbNode, node.expression); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.equalsToken) || - visitNode(cbNode, node.objectAssignmentInitializer); - case 298 /* SyntaxKind.SpreadAssignment */: - return visitNode(cbNode, node.expression); - case 164 /* SyntaxKind.Parameter */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 166 /* SyntaxKind.PropertySignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 296 /* SyntaxKind.PropertyAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.initializer); - case 254 /* SyntaxKind.VariableDeclaration */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.exclamationToken) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.initializer); - case 203 /* SyntaxKind.BindingElement */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 176 /* SyntaxKind.IndexSignature */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 180 /* SyntaxKind.ConstructorType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 179 /* SyntaxKind.FunctionType */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - return visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 169 /* SyntaxKind.MethodDeclaration */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.exclamationToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 168 /* SyntaxKind.MethodSignature */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 171 /* SyntaxKind.Constructor */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 172 /* SyntaxKind.GetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 173 /* SyntaxKind.SetAccessor */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 256 /* SyntaxKind.FunctionDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 213 /* SyntaxKind.FunctionExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.body); - case 214 /* SyntaxKind.ArrowFunction */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type) || - visitNode(cbNode, node.equalsGreaterThanToken) || - visitNode(cbNode, node.body); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.body); - case 178 /* SyntaxKind.TypeReference */: - return visitNode(cbNode, node.typeName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 177 /* SyntaxKind.TypePredicate */: - return visitNode(cbNode, node.assertsModifier) || - visitNode(cbNode, node.parameterName) || - visitNode(cbNode, node.type); - case 181 /* SyntaxKind.TypeQuery */: - return visitNode(cbNode, node.exprName) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 182 /* SyntaxKind.TypeLiteral */: - return visitNodes(cbNode, cbNodes, node.members); - case 183 /* SyntaxKind.ArrayType */: - return visitNode(cbNode, node.elementType); - case 184 /* SyntaxKind.TupleType */: - return visitNodes(cbNode, cbNodes, node.elements); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - return visitNodes(cbNode, cbNodes, node.types); - case 189 /* SyntaxKind.ConditionalType */: - return visitNode(cbNode, node.checkType) || - visitNode(cbNode, node.extendsType) || - visitNode(cbNode, node.trueType) || - visitNode(cbNode, node.falseType); - case 190 /* SyntaxKind.InferType */: - return visitNode(cbNode, node.typeParameter); - case 200 /* SyntaxKind.ImportType */: - return visitNode(cbNode, node.argument) || - visitNode(cbNode, node.assertions) || - visitNode(cbNode, node.qualifier) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - return visitNode(cbNode, node.assertClause); - case 191 /* SyntaxKind.ParenthesizedType */: - case 193 /* SyntaxKind.TypeOperator */: - return visitNode(cbNode, node.type); - case 194 /* SyntaxKind.IndexedAccessType */: - return visitNode(cbNode, node.objectType) || - visitNode(cbNode, node.indexType); - case 195 /* SyntaxKind.MappedType */: - return visitNode(cbNode, node.readonlyToken) || - visitNode(cbNode, node.typeParameter) || - visitNode(cbNode, node.nameType) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type) || - visitNodes(cbNode, cbNodes, node.members); - case 196 /* SyntaxKind.LiteralType */: - return visitNode(cbNode, node.literal); - case 197 /* SyntaxKind.NamedTupleMember */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.type); - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - return visitNodes(cbNode, cbNodes, node.elements); - case 204 /* SyntaxKind.ArrayLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - return visitNodes(cbNode, cbNodes, node.properties); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.name); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNode(cbNode, node.argumentExpression); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNodes(cbNode, cbNodes, node.arguments); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitNode(cbNode, node.tag) || - visitNode(cbNode, node.questionDotToken) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.template); - case 211 /* SyntaxKind.TypeAssertionExpression */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.expression); - case 212 /* SyntaxKind.ParenthesizedExpression */: - return visitNode(cbNode, node.expression); - case 215 /* SyntaxKind.DeleteExpression */: - return visitNode(cbNode, node.expression); - case 216 /* SyntaxKind.TypeOfExpression */: - return visitNode(cbNode, node.expression); - case 217 /* SyntaxKind.VoidExpression */: - return visitNode(cbNode, node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 224 /* SyntaxKind.YieldExpression */: - return visitNode(cbNode, node.asteriskToken) || - visitNode(cbNode, node.expression); - case 218 /* SyntaxKind.AwaitExpression */: - return visitNode(cbNode, node.expression); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitNode(cbNode, node.operand); - case 221 /* SyntaxKind.BinaryExpression */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.operatorToken) || - visitNode(cbNode, node.right); - case 229 /* SyntaxKind.AsExpression */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.type); - case 230 /* SyntaxKind.NonNullExpression */: - return visitNode(cbNode, node.expression); - case 231 /* SyntaxKind.MetaProperty */: - return visitNode(cbNode, node.name); - case 222 /* SyntaxKind.ConditionalExpression */: - return visitNode(cbNode, node.condition) || - visitNode(cbNode, node.questionToken) || - visitNode(cbNode, node.whenTrue) || - visitNode(cbNode, node.colonToken) || - visitNode(cbNode, node.whenFalse); - case 225 /* SyntaxKind.SpreadElement */: - return visitNode(cbNode, node.expression); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: - return visitNodes(cbNode, cbNodes, node.statements); - case 305 /* SyntaxKind.SourceFile */: - return visitNodes(cbNode, cbNodes, node.statements) || - visitNode(cbNode, node.endOfFileToken); - case 237 /* SyntaxKind.VariableStatement */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.declarationList); - case 255 /* SyntaxKind.VariableDeclarationList */: - return visitNodes(cbNode, cbNodes, node.declarations); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitNode(cbNode, node.expression); - case 239 /* SyntaxKind.IfStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.thenStatement) || - visitNode(cbNode, node.elseStatement); - case 240 /* SyntaxKind.DoStatement */: - return visitNode(cbNode, node.statement) || - visitNode(cbNode, node.expression); - case 241 /* SyntaxKind.WhileStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 242 /* SyntaxKind.ForStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.condition) || - visitNode(cbNode, node.incrementor) || - visitNode(cbNode, node.statement); - case 243 /* SyntaxKind.ForInStatement */: - return visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 244 /* SyntaxKind.ForOfStatement */: - return visitNode(cbNode, node.awaitModifier) || - visitNode(cbNode, node.initializer) || - visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: - return visitNode(cbNode, node.label); - case 247 /* SyntaxKind.ReturnStatement */: - return visitNode(cbNode, node.expression); - case 248 /* SyntaxKind.WithStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.statement); - case 249 /* SyntaxKind.SwitchStatement */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.caseBlock); - case 263 /* SyntaxKind.CaseBlock */: - return visitNodes(cbNode, cbNodes, node.clauses); - case 289 /* SyntaxKind.CaseClause */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.statements); - case 290 /* SyntaxKind.DefaultClause */: - return visitNodes(cbNode, cbNodes, node.statements); - case 250 /* SyntaxKind.LabeledStatement */: - return visitNode(cbNode, node.label) || - visitNode(cbNode, node.statement); - case 251 /* SyntaxKind.ThrowStatement */: - return visitNode(cbNode, node.expression); - case 252 /* SyntaxKind.TryStatement */: - return visitNode(cbNode, node.tryBlock) || - visitNode(cbNode, node.catchClause) || - visitNode(cbNode, node.finallyBlock); - case 292 /* SyntaxKind.CatchClause */: - return visitNode(cbNode, node.variableDeclaration) || - visitNode(cbNode, node.block); - case 165 /* SyntaxKind.Decorator */: - return visitNode(cbNode, node.expression); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - return visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 258 /* SyntaxKind.InterfaceDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNodes(cbNode, cbNodes, node.heritageClauses) || - visitNodes(cbNode, cbNodes, node.members); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - visitNode(cbNode, node.type); - case 260 /* SyntaxKind.EnumDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNodes(cbNode, cbNodes, node.members); - case 299 /* SyntaxKind.EnumMember */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 261 /* SyntaxKind.ModuleDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.body); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.name) || - visitNode(cbNode, node.moduleReference); - case 266 /* SyntaxKind.ImportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.importClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 267 /* SyntaxKind.ImportClause */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.namedBindings); - case 293 /* SyntaxKind.AssertClause */: - return visitNodes(cbNode, cbNodes, node.elements); - case 294 /* SyntaxKind.AssertEntry */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.value); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNode(cbNode, node.name); - case 268 /* SyntaxKind.NamespaceImport */: - return visitNode(cbNode, node.name); - case 274 /* SyntaxKind.NamespaceExport */: - return visitNode(cbNode, node.name); - case 269 /* SyntaxKind.NamedImports */: - case 273 /* SyntaxKind.NamedExports */: - return visitNodes(cbNode, cbNodes, node.elements); - case 272 /* SyntaxKind.ExportDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.exportClause) || - visitNode(cbNode, node.moduleSpecifier) || - visitNode(cbNode, node.assertClause); - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - return visitNode(cbNode, node.propertyName) || - visitNode(cbNode, node.name); - case 271 /* SyntaxKind.ExportAssignment */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers) || - visitNode(cbNode, node.expression); - case 223 /* SyntaxKind.TemplateExpression */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 233 /* SyntaxKind.TemplateSpan */: - return visitNode(cbNode, node.expression) || - visitNode(cbNode, node.literal); - case 198 /* SyntaxKind.TemplateLiteralType */: - return visitNode(cbNode, node.head) || - visitNodes(cbNode, cbNodes, node.templateSpans); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - return visitNode(cbNode, node.type) || - visitNode(cbNode, node.literal); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitNode(cbNode, node.expression); - case 291 /* SyntaxKind.HeritageClause */: - return visitNodes(cbNode, cbNodes, node.types); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitNode(cbNode, node.expression) || - visitNodes(cbNode, cbNodes, node.typeArguments); - case 277 /* SyntaxKind.ExternalModuleReference */: - return visitNode(cbNode, node.expression); - case 276 /* SyntaxKind.MissingDeclaration */: - return visitNodes(cbNode, cbNodes, node.illegalDecorators) || - visitNodes(cbNode, cbNodes, node.modifiers); - case 351 /* SyntaxKind.CommaListExpression */: - return visitNodes(cbNode, cbNodes, node.elements); - case 278 /* SyntaxKind.JsxElement */: - return visitNode(cbNode, node.openingElement) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingElement); - case 282 /* SyntaxKind.JsxFragment */: - return visitNode(cbNode, node.openingFragment) || - visitNodes(cbNode, cbNodes, node.children) || - visitNode(cbNode, node.closingFragment); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - return visitNode(cbNode, node.tagName) || - visitNodes(cbNode, cbNodes, node.typeArguments) || - visitNode(cbNode, node.attributes); - case 286 /* SyntaxKind.JsxAttributes */: - return visitNodes(cbNode, cbNodes, node.properties); - case 285 /* SyntaxKind.JsxAttribute */: - return visitNode(cbNode, node.name) || - visitNode(cbNode, node.initializer); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - return visitNode(cbNode, node.expression); - case 288 /* SyntaxKind.JsxExpression */: - return visitNode(cbNode, node.dotDotDotToken) || - visitNode(cbNode, node.expression); - case 281 /* SyntaxKind.JsxClosingElement */: - return visitNode(cbNode, node.tagName); - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - return visitNode(cbNode, node.type); - case 317 /* SyntaxKind.JSDocFunctionType */: - return visitNodes(cbNode, cbNodes, node.parameters) || - visitNode(cbNode, node.type); - case 320 /* SyntaxKind.JSDoc */: - return (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - || visitNodes(cbNode, cbNodes, node.tags); - case 346 /* SyntaxKind.JSDocSeeTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 310 /* SyntaxKind.JSDocNameReference */: - return visitNode(cbNode, node.name); - case 311 /* SyntaxKind.JSDocMemberName */: - return visitNode(cbNode, node.left) || - visitNode(cbNode, node.right); - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: - return visitNode(cbNode, node.tagName) || - (node.isNameFirst - ? visitNode(cbNode, node.name) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.name) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 330 /* SyntaxKind.JSDocAuthorTag */: - return visitNode(cbNode, node.tagName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 329 /* SyntaxKind.JSDocImplementsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.class) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 344 /* SyntaxKind.JSDocTemplateTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.constraint) || - visitNodes(cbNode, cbNodes, node.typeParameters) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 345 /* SyntaxKind.JSDocTypedefTag */: - return visitNode(cbNode, node.tagName) || - (node.typeExpression && - node.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */ - ? visitNode(cbNode, node.typeExpression) || - visitNode(cbNode, node.fullName) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)) - : visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment))); - case 338 /* SyntaxKind.JSDocCallbackTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.fullName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 341 /* SyntaxKind.JSDocReturnTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - return visitNode(cbNode, node.tagName) || - visitNode(cbNode, node.typeExpression) || - (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 323 /* SyntaxKind.JSDocSignature */: - return ts.forEach(node.typeParameters, cbNode) || - ts.forEach(node.parameters, cbNode) || - visitNode(cbNode, node.type); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: - return visitNode(cbNode, node.name); - case 322 /* SyntaxKind.JSDocTypeLiteral */: - return ts.forEach(node.jsDocPropertyTags, cbNode); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: - case 337 /* SyntaxKind.JSDocOverrideTag */: - return visitNode(cbNode, node.tagName) - || (typeof node.comment === "string" ? undefined : visitNodes(cbNode, cbNodes, node.comment)); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - return visitNode(cbNode, node.expression); - } + var fn = forEachChildTable[node.kind]; + return fn === undefined ? undefined : fn(node, cbNode, cbNodes); } ts.forEachChild = forEachChild; /** @internal */ @@ -31548,7 +32022,7 @@ var ts; continue; return res; } - if (current.kind >= 161 /* SyntaxKind.FirstNode */) { + if (current.kind >= 163 /* SyntaxKind.FirstNode */) { // add children in reverse order to the queue, so popping gives the first child for (var _i = 0, _a = gatherPossibleChildren(current); _i < _a.length; _i++) { var child = _a[_i]; @@ -31658,13 +32132,11 @@ var ts; var scanner = ts.createScanner(99 /* ScriptTarget.Latest */, /*skipTrivia*/ true); var disallowInAndDecoratorContext = 4096 /* NodeFlags.DisallowInContext */ | 16384 /* NodeFlags.DecoratorContext */; // capture constructors in 'initializeState' to avoid null checks - // tslint:disable variable-name var NodeConstructor; var TokenConstructor; var IdentifierConstructor; var PrivateIdentifierConstructor; var SourceFileConstructor; - // tslint:enable variable-name function countNode(node) { nodeCount++; return node; @@ -32373,7 +32845,7 @@ var ts; } // If we have a 'await' keyword, and we're in the [Await] context, then 'await' is // considered a keyword and is not an identifier. - if (token() === 132 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */ && inAwaitContext()) { return false; } return token() > 116 /* SyntaxKind.LastReservedWord */; @@ -32619,7 +33091,7 @@ var ts; ts.isTemplateLiteralKind(kind) ? factory.createTemplateLiteralLikeNode(kind, "", "", /*templateFlags*/ undefined) : kind === 8 /* SyntaxKind.NumericLiteral */ ? factory.createNumericLiteral("", /*numericLiteralFlags*/ undefined) : kind === 10 /* SyntaxKind.StringLiteral */ ? factory.createStringLiteral("", /*isSingleQuote*/ undefined) : - kind === 276 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : + kind === 279 /* SyntaxKind.MissingDeclaration */ ? factory.createMissingDeclaration() : factory.createToken(kind); return finishNode(result, pos); } @@ -32640,8 +33112,9 @@ var ts; // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker var originalKeywordKind = token(); var text = internIdentifier(scanner.getTokenValue()); + var hasExtendedUnicodeEscape = scanner.hasExtendedUnicodeEscape(); nextTokenWithoutCheck(); - return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind), pos); + return finishNode(factory.createIdentifier(text, /*typeArguments*/ undefined, originalKeywordKind, hasExtendedUnicodeEscape), pos); } if (token() === 80 /* SyntaxKind.PrivateIdentifier */) { parseErrorAtCurrentToken(privateIdentifierDiagnosticMessage || ts.Diagnostics.Private_identifiers_are_not_allowed_outside_class_bodies); @@ -32718,7 +33191,7 @@ var ts; } function parsePrivateIdentifier() { var pos = getNodePos(); - var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenText())); + var node = factory.createPrivateIdentifier(internPrivateIdentifier(scanner.getTokenValue())); nextToken(); return finishNode(node, pos); } @@ -32742,15 +33215,16 @@ var ts; if (token() === 88 /* SyntaxKind.DefaultKeyword */) { return lookAhead(nextTokenCanFollowDefaultKeyword); } - if (token() === 152 /* SyntaxKind.TypeKeyword */) { + if (token() === 154 /* SyntaxKind.TypeKeyword */) { return lookAhead(nextTokenCanFollowExportModifier); } return canFollowExportModifier(); case 88 /* SyntaxKind.DefaultKeyword */: return nextTokenCanFollowDefaultKeyword(); + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 136 /* SyntaxKind.GetKeyword */: - case 149 /* SyntaxKind.SetKeyword */: + case 137 /* SyntaxKind.GetKeyword */: + case 151 /* SyntaxKind.SetKeyword */: nextToken(); return canFollowModifier(); default: @@ -32759,7 +33233,7 @@ var ts; } function canFollowExportModifier() { return token() !== 41 /* SyntaxKind.AsteriskToken */ - && token() !== 127 /* SyntaxKind.AsKeyword */ + && token() !== 128 /* SyntaxKind.AsKeyword */ && token() !== 18 /* SyntaxKind.OpenBraceToken */ && canFollowModifier(); } @@ -32782,7 +33256,7 @@ var ts; return token() === 84 /* SyntaxKind.ClassKeyword */ || token() === 98 /* SyntaxKind.FunctionKeyword */ || token() === 118 /* SyntaxKind.InterfaceKeyword */ || (token() === 126 /* SyntaxKind.AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) || - (token() === 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); + (token() === 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine)); } // True if positioned at the start of a list element function isListElement(parsingContext, inErrorRecovery) { @@ -33162,20 +33636,20 @@ var ts; function isReusableClassMember(node) { if (node) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - case 176 /* SyntaxKind.IndexSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 234 /* SyntaxKind.SemicolonClassElement */: + case 173 /* SyntaxKind.Constructor */: + case 178 /* SyntaxKind.IndexSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 237 /* SyntaxKind.SemicolonClassElement */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // Method declarations are not necessarily reusable. An object-literal // may have a method calls "constructor(...)" and we must reparse that // into an actual .ConstructorDeclaration. var methodDeclaration = node; var nameIsConstructor = methodDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ && - methodDeclaration.name.originalKeywordKind === 134 /* SyntaxKind.ConstructorKeyword */; + methodDeclaration.name.originalKeywordKind === 135 /* SyntaxKind.ConstructorKeyword */; return !nameIsConstructor; } } @@ -33184,8 +33658,8 @@ var ts; function isReusableSwitchClause(node) { if (node) { switch (node.kind) { - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: return true; } } @@ -33194,58 +33668,58 @@ var ts; function isReusableStatement(node) { if (node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 235 /* SyntaxKind.Block */: - case 239 /* SyntaxKind.IfStatement */: - case 238 /* SyntaxKind.ExpressionStatement */: - case 251 /* SyntaxKind.ThrowStatement */: - case 247 /* SyntaxKind.ReturnStatement */: - case 249 /* SyntaxKind.SwitchStatement */: - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 236 /* SyntaxKind.EmptyStatement */: - case 252 /* SyntaxKind.TryStatement */: - case 250 /* SyntaxKind.LabeledStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 238 /* SyntaxKind.Block */: + case 242 /* SyntaxKind.IfStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: + case 254 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 252 /* SyntaxKind.SwitchStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 255 /* SyntaxKind.TryStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } } return false; } function isReusableEnumMember(node) { - return node.kind === 299 /* SyntaxKind.EnumMember */; + return node.kind === 302 /* SyntaxKind.EnumMember */; } function isReusableTypeMember(node) { if (node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 166 /* SyntaxKind.PropertySignature */: - case 174 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 168 /* SyntaxKind.PropertySignature */: + case 176 /* SyntaxKind.CallSignature */: return true; } } return false; } function isReusableVariableDeclaration(node) { - if (node.kind !== 254 /* SyntaxKind.VariableDeclaration */) { + if (node.kind !== 257 /* SyntaxKind.VariableDeclaration */) { return false; } // Very subtle incremental parsing bug. Consider the following code: @@ -33266,7 +33740,7 @@ var ts; return variableDeclarator.initializer === undefined; } function isReusableParameter(node) { - if (node.kind !== 164 /* SyntaxKind.Parameter */) { + if (node.kind !== 166 /* SyntaxKind.Parameter */) { return false; } // See the comment in isReusableVariableDeclaration for why we do this. @@ -33559,14 +34033,14 @@ var ts; // If true, we should abort parsing an error function. function typeHasArrowFunctionBlockingParseError(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return ts.nodeIsMissing(node.typeName); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: { + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: { var _a = node, parameters = _a.parameters, type = _a.type; return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type); } - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return typeHasArrowFunctionBlockingParseError(node.type); default: return false; @@ -33645,7 +34119,7 @@ var ts; function parseJSDocType() { scanner.setInJSDocType(true); var pos = getNodePos(); - if (parseOptional(141 /* SyntaxKind.ModuleKeyword */)) { + if (parseOptional(142 /* SyntaxKind.ModuleKeyword */)) { // TODO(rbuckton): We never set the type for a JSDocNamepathType. What should we put here? var moduleTag = factory.createJSDocNamepathType(/*type*/ undefined); terminate: while (true) { @@ -33861,14 +34335,14 @@ var ts; function parseSignatureMember(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - if (kind === 175 /* SyntaxKind.ConstructSignature */) { + if (kind === 177 /* SyntaxKind.ConstructSignature */) { parseExpected(103 /* SyntaxKind.NewKeyword */); } var typeParameters = parseTypeParameters(); var parameters = parseParameters(4 /* SignatureFlags.Type */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ true); parseTypeMemberSemicolon(); - var node = kind === 174 /* SyntaxKind.CallSignature */ + var node = kind === 176 /* SyntaxKind.CallSignature */ ? factory.createCallSignature(typeParameters, parameters, type) : factory.createConstructSignature(typeParameters, parameters, type); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -33962,8 +34436,8 @@ var ts; // Return true if we have the start of a signature member if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || - token() === 136 /* SyntaxKind.GetKeyword */ || - token() === 149 /* SyntaxKind.SetKeyword */) { + token() === 137 /* SyntaxKind.GetKeyword */ || + token() === 151 /* SyntaxKind.SetKeyword */) { return true; } var idToken = false; @@ -33995,19 +34469,19 @@ var ts; } function parseTypeMember() { if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */) { - return parseSignatureMember(174 /* SyntaxKind.CallSignature */); + return parseSignatureMember(176 /* SyntaxKind.CallSignature */); } if (token() === 103 /* SyntaxKind.NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) { - return parseSignatureMember(175 /* SyntaxKind.ConstructSignature */); + return parseSignatureMember(177 /* SyntaxKind.ConstructSignature */); } var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 172 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 174 /* SyntaxKind.GetAccessor */, 4 /* SignatureFlags.Type */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 173 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers, 175 /* SyntaxKind.SetAccessor */, 4 /* SignatureFlags.Type */); } if (isIndexSignature()) { return parseIndexSignatureDeclaration(pos, hasJSDoc, /*decorators*/ undefined, modifiers); @@ -34048,9 +34522,9 @@ var ts; function isStartOfMappedType() { nextToken(); if (token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { - return nextToken() === 145 /* SyntaxKind.ReadonlyKeyword */; + return nextToken() === 146 /* SyntaxKind.ReadonlyKeyword */; } - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */) { nextToken(); } return token() === 22 /* SyntaxKind.OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 101 /* SyntaxKind.InKeyword */; @@ -34066,15 +34540,15 @@ var ts; var pos = getNodePos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var readonlyToken; - if (token() === 145 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { + if (token() === 146 /* SyntaxKind.ReadonlyKeyword */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { readonlyToken = parseTokenNode(); - if (readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - parseExpected(145 /* SyntaxKind.ReadonlyKeyword */); + if (readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + parseExpected(146 /* SyntaxKind.ReadonlyKeyword */); } } parseExpected(22 /* SyntaxKind.OpenBracketToken */); var typeParameter = parseMappedTypeParameter(); - var nameType = parseOptional(127 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; + var nameType = parseOptional(128 /* SyntaxKind.AsKeyword */) ? parseType() : undefined; parseExpected(23 /* SyntaxKind.CloseBracketToken */); var questionToken; if (token() === 57 /* SyntaxKind.QuestionToken */ || token() === 39 /* SyntaxKind.PlusToken */ || token() === 40 /* SyntaxKind.MinusToken */) { @@ -34188,7 +34662,7 @@ var ts; var openBracePosition = scanner.getTokenPos(); parseExpected(18 /* SyntaxKind.OpenBraceToken */); var multiLine = scanner.hasPrecedingLineBreak(); - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); parseExpected(58 /* SyntaxKind.ColonToken */); var clause = parseAssertClause(/*skipAssertKeyword*/ true); if (!parseExpected(19 /* SyntaxKind.CloseBraceToken */)) { @@ -34221,16 +34695,16 @@ var ts; } function parseNonArrayType() { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: // If these are followed by a dot, then parse these out as a dotted type reference instead. return tryParse(parseKeywordAndNoDot) || parseTypeReference(); case 66 /* SyntaxKind.AsteriskEqualsToken */: @@ -34263,7 +34737,7 @@ var ts; return parseTokenNode(); case 108 /* SyntaxKind.ThisKeyword */: { var thisKeyword = parseThisTypeNode(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { return parseThisTypePredicate(thisKeyword); } else { @@ -34280,7 +34754,7 @@ var ts; return parseParenthesizedType(); case 100 /* SyntaxKind.ImportKeyword */: return parseImportType(); - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: return lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine) ? parseAssertsTypePredicate() : parseTypeReference(); case 15 /* SyntaxKind.TemplateHead */: return parseTemplateType(); @@ -34290,21 +34764,21 @@ var ts; } function isStartOfType(inStartOfParameter) { switch (token()) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 108 /* SyntaxKind.ThisKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 18 /* SyntaxKind.OpenBraceToken */: case 22 /* SyntaxKind.OpenBracketToken */: case 29 /* SyntaxKind.LessThanToken */: @@ -34316,14 +34790,14 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 41 /* SyntaxKind.AsteriskToken */: case 57 /* SyntaxKind.QuestionToken */: case 53 /* SyntaxKind.ExclamationToken */: case 25 /* SyntaxKind.DotDotDotToken */: - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: case 100 /* SyntaxKind.ImportKeyword */: - case 128 /* SyntaxKind.AssertsKeyword */: + case 129 /* SyntaxKind.AssertsKeyword */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: return true; @@ -34400,17 +34874,17 @@ var ts; } function parseInferType() { var pos = getNodePos(); - parseExpected(137 /* SyntaxKind.InferKeyword */); + parseExpected(138 /* SyntaxKind.InferKeyword */); return finishNode(factory.createInferTypeNode(parseTypeParameterOfInferType()), pos); } function parseTypeOperatorOrHigher() { var operator = token(); switch (operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: - case 154 /* SyntaxKind.UniqueKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: + case 156 /* SyntaxKind.UniqueKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: return parseTypeOperator(operator); - case 137 /* SyntaxKind.InferKeyword */: + case 138 /* SyntaxKind.InferKeyword */: return parseInferType(); } return allowConditionalTypesAnd(parsePostfixTypeOrHigher); @@ -34530,16 +35004,16 @@ var ts; } function parseTypePredicatePrefix() { var id = parseIdentifier(); - if (token() === 139 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 140 /* SyntaxKind.IsKeyword */ && !scanner.hasPrecedingLineBreak()) { nextToken(); return id; } } function parseAssertsTypePredicate() { var pos = getNodePos(); - var assertsModifier = parseExpectedToken(128 /* SyntaxKind.AssertsKeyword */); + var assertsModifier = parseExpectedToken(129 /* SyntaxKind.AssertsKeyword */); var parameterName = token() === 108 /* SyntaxKind.ThisKeyword */ ? parseThisTypeNode() : parseIdentifier(); - var type = parseOptional(139 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; + var type = parseOptional(140 /* SyntaxKind.IsKeyword */) ? parseType() : undefined; return finishNode(factory.createTypePredicateNode(assertsModifier, parameterName, type), pos); } function parseType() { @@ -34609,7 +35083,7 @@ var ts; case 45 /* SyntaxKind.PlusPlusToken */: case 46 /* SyntaxKind.MinusMinusToken */: case 29 /* SyntaxKind.LessThanToken */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: case 125 /* SyntaxKind.YieldKeyword */: case 80 /* SyntaxKind.PrivateIdentifier */: // Yield/await always starts an expression. Either it is an identifier (in which case @@ -34797,7 +35271,7 @@ var ts; // Unknown -> There *might* be a parenthesized arrow function here. // Speculatively look ahead to be sure, and rollback if not. function isParenthesizedArrowFunctionExpression() { - if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 20 /* SyntaxKind.OpenParenToken */ || token() === 29 /* SyntaxKind.LessThanToken */ || token() === 132 /* SyntaxKind.AsyncKeyword */) { return lookAhead(isParenthesizedArrowFunctionExpressionWorker); } if (token() === 38 /* SyntaxKind.EqualsGreaterThanToken */) { @@ -34810,7 +35284,7 @@ var ts; return 0 /* Tristate.False */; } function isParenthesizedArrowFunctionExpressionWorker() { - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); if (scanner.hasPrecedingLineBreak()) { return 0 /* Tristate.False */; @@ -34854,8 +35328,8 @@ var ts; // Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This // isn't actually allowed, but we want to treat it as a lambda so we can provide // a good error message. - if (ts.isModifierKind(second) && second !== 131 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { - if (nextToken() === 127 /* SyntaxKind.AsKeyword */) { + if (ts.isModifierKind(second) && second !== 132 /* SyntaxKind.AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) { + if (nextToken() === 128 /* SyntaxKind.AsKeyword */) { // https://github.com/microsoft/TypeScript/issues/44466 return 0 /* Tristate.False */; } @@ -34937,7 +35411,7 @@ var ts; } function tryParseAsyncSimpleArrowFunctionExpression(allowReturnTypeInArrowFunction) { // We do a check here so that we won't be doing unnecessarily call to "lookAhead" - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* Tristate.True */) { var pos = getNodePos(); var asyncModifier = parseModifiersForArrowFunction(); @@ -34951,7 +35425,7 @@ var ts; // AsyncArrowFunctionExpression: // 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In] // 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In] - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { nextToken(); // If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function // but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher" @@ -35017,7 +35491,7 @@ var ts; // // So we need just a bit of lookahead to ensure that it can only be a signature. var unwrappedType = type; - while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 191 /* SyntaxKind.ParenthesizedType */) { + while ((unwrappedType === null || unwrappedType === void 0 ? void 0 : unwrappedType.kind) === 193 /* SyntaxKind.ParenthesizedType */) { unwrappedType = unwrappedType.type; // Skip parens if need be } var hasJSDocFunctionType = unwrappedType && ts.isJSDocFunctionType(unwrappedType); @@ -35112,7 +35586,7 @@ var ts; return parseBinaryExpressionRest(precedence, leftOperand, pos); } function isInOrOfKeyword(t) { - return t === 101 /* SyntaxKind.InKeyword */ || t === 160 /* SyntaxKind.OfKeyword */; + return t === 101 /* SyntaxKind.InKeyword */ || t === 162 /* SyntaxKind.OfKeyword */; } function parseBinaryExpressionRest(precedence, leftOperand, pos) { while (true) { @@ -35150,7 +35624,7 @@ var ts; if (token() === 101 /* SyntaxKind.InKeyword */ && inDisallowInContext()) { break; } - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */ || token() === 150 /* SyntaxKind.SatisfiesKeyword */) { // Make sure we *do* perform ASI for constructs like this: // var x = foo // as (Bar) @@ -35160,8 +35634,10 @@ var ts; break; } else { + var keywordKind = token(); nextToken(); - leftOperand = makeAsExpression(leftOperand, parseType()); + leftOperand = keywordKind === 150 /* SyntaxKind.SatisfiesKeyword */ ? makeSatisfiesExpression(leftOperand, parseType()) : + makeAsExpression(leftOperand, parseType()); } } else { @@ -35176,6 +35652,9 @@ var ts; } return ts.getBinaryOperatorPrecedence(token()) > 0; } + function makeSatisfiesExpression(left, right) { + return finishNode(factory.createSatisfiesExpression(left, right), left.pos); + } function makeBinaryExpression(left, operatorToken, right, pos) { return finishNode(factory.createBinaryExpression(left, operatorToken, right), pos); } @@ -35199,7 +35678,7 @@ var ts; return finishNode(factory.createVoidExpression(nextTokenAnd(parseSimpleUnaryExpression)), pos); } function isAwaitExpression() { - if (token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (token() === 133 /* SyntaxKind.AwaitKeyword */) { if (inAwaitContext()) { return true; } @@ -35252,7 +35731,7 @@ var ts; if (token() === 42 /* SyntaxKind.AsteriskAsteriskToken */) { var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos); var end = simpleUnaryExpression.end; - if (simpleUnaryExpression.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (simpleUnaryExpression.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses); } else { @@ -35293,7 +35772,7 @@ var ts; // UnaryExpression (modified): // < type > UnaryExpression return parseTypeAssertion(); - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: if (isAwaitExpression()) { return parseAwaitExpression(); } @@ -35323,7 +35802,7 @@ var ts; case 89 /* SyntaxKind.DeleteKeyword */: case 112 /* SyntaxKind.TypeOfKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 132 /* SyntaxKind.AwaitKeyword */: + case 133 /* SyntaxKind.AwaitKeyword */: return false; case 29 /* SyntaxKind.LessThanToken */: // If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression @@ -35506,11 +35985,11 @@ var ts; var pos = getNodePos(); var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext); var result; - if (opening.kind === 280 /* SyntaxKind.JsxOpeningElement */) { + if (opening.kind === 283 /* SyntaxKind.JsxOpeningElement */) { var children = parseJsxChildren(opening); var closingElement = void 0; var lastChild = children[children.length - 1]; - if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 278 /* SyntaxKind.JsxElement */ + if ((lastChild === null || lastChild === void 0 ? void 0 : lastChild.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(lastChild.openingElement.tagName, lastChild.closingElement.tagName) && tagNamesAreEquivalent(opening.tagName, lastChild.closingElement.tagName)) { // when an unclosed JsxOpeningElement incorrectly parses its parent's JsxClosingElement, @@ -35536,11 +36015,11 @@ var ts; } result = finishNode(factory.createJsxElement(opening, children, closingElement), pos); } - else if (opening.kind === 283 /* SyntaxKind.JsxOpeningFragment */) { + else if (opening.kind === 286 /* SyntaxKind.JsxOpeningFragment */) { result = finishNode(factory.createJsxFragment(opening, parseJsxChildren(opening), parseJsxClosingFragment(inExpressionContext)), pos); } else { - ts.Debug.assert(opening.kind === 279 /* SyntaxKind.JsxSelfClosingElement */); + ts.Debug.assert(opening.kind === 282 /* SyntaxKind.JsxSelfClosingElement */); // Nothing else to do for self-closing elements result = opening; } @@ -35610,7 +36089,7 @@ var ts; break; list.push(child); if (ts.isJsxOpeningElement(openingTag) - && (child === null || child === void 0 ? void 0 : child.kind) === 278 /* SyntaxKind.JsxElement */ + && (child === null || child === void 0 ? void 0 : child.kind) === 281 /* SyntaxKind.JsxElement */ && !tagNamesAreEquivalent(child.openingElement.tagName, child.closingElement.tagName) && tagNamesAreEquivalent(openingTag.tagName, child.closingElement.tagName)) { // stop after parsing a mismatched child like
...(
) in order to reattach the
higher @@ -35855,7 +36334,7 @@ var ts; } if (isTemplateStartOfTaggedTemplate()) { // Absorb type arguments into TemplateExpression when preceding expression is ExpressionWithTypeArguments - expression = !questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? + expression = !questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? parseTaggedTemplateRest(pos, expression.expression, questionDotToken, expression.typeArguments) : parseTaggedTemplateRest(pos, expression, questionDotToken, /*typeArguments*/ undefined); continue; @@ -35902,7 +36381,7 @@ var ts; } if (typeArguments || token() === 20 /* SyntaxKind.OpenParenToken */) { // Absorb type arguments into CallExpression when preceding expression is ExpressionWithTypeArguments - if (!questionDotToken && expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (!questionDotToken && expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -35988,7 +36467,7 @@ var ts; return parseArrayLiteralExpression(); case 18 /* SyntaxKind.OpenBraceToken */: return parseObjectLiteralExpression(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher. // If we encounter `async [no LineTerminator here] function` then this is an async // function; otherwise, its an identifier. @@ -36055,11 +36534,11 @@ var ts; } var decorators = parseDecorators(); var modifiers = parseModifiers(); - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); var tokenIsIdentifier = isIdentifier(); @@ -36147,7 +36626,7 @@ var ts; var expression = parseMemberExpressionRest(expressionPos, parsePrimaryExpression(), /*allowOptionalChain*/ false); var typeArguments; // Absorb type arguments into NewExpression when preceding expression is ExpressionWithTypeArguments - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { typeArguments = expression.typeArguments; expression = expression.expression; } @@ -36251,7 +36730,7 @@ var ts; var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); parseExpected(97 /* SyntaxKind.ForKeyword */); - var awaitToken = parseOptionalToken(132 /* SyntaxKind.AwaitKeyword */); + var awaitToken = parseOptionalToken(133 /* SyntaxKind.AwaitKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var initializer; if (token() !== 26 /* SyntaxKind.SemicolonToken */) { @@ -36263,7 +36742,7 @@ var ts; } } var node; - if (awaitToken ? parseExpected(160 /* SyntaxKind.OfKeyword */) : parseOptional(160 /* SyntaxKind.OfKeyword */)) { + if (awaitToken ? parseExpected(162 /* SyntaxKind.OfKeyword */) : parseOptional(162 /* SyntaxKind.OfKeyword */)) { var expression = allowInAnd(function () { return parseAssignmentExpressionOrHigher(/*allowReturnTypeInArrowFunction*/ true); }); parseExpected(21 /* SyntaxKind.CloseParenToken */); node = factory.createForOfStatement(awaitToken, initializer, expression, parseStatement()); @@ -36290,10 +36769,10 @@ var ts; function parseBreakOrContinueStatement(kind) { var pos = getNodePos(); var hasJSDoc = hasPrecedingJSDocComment(); - parseExpected(kind === 246 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); + parseExpected(kind === 249 /* SyntaxKind.BreakStatement */ ? 81 /* SyntaxKind.BreakKeyword */ : 86 /* SyntaxKind.ContinueKeyword */); var label = canParseSemicolon() ? undefined : parseIdentifier(); parseSemicolon(); - var node = kind === 246 /* SyntaxKind.BreakStatement */ + var node = kind === 249 /* SyntaxKind.BreakStatement */ ? factory.createBreakStatement(label) : factory.createContinueStatement(label); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -36484,25 +36963,26 @@ var ts; // // could be legal, it would add complexity for very little gain. case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return nextTokenIsIdentifierOnSameLine(); - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return nextTokenIsIdentifierOrStringLiteralOnSameLine(); case 126 /* SyntaxKind.AbstractKeyword */: - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: nextToken(); // ASI takes effect for this modifier. if (scanner.hasPrecedingLineBreak()) { return false; } continue; - case 157 /* SyntaxKind.GlobalKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: nextToken(); return token() === 18 /* SyntaxKind.OpenBraceToken */ || token() === 79 /* SyntaxKind.Identifier */ || token() === 93 /* SyntaxKind.ExportKeyword */; case 100 /* SyntaxKind.ImportKeyword */: @@ -36511,12 +36991,12 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token()); case 93 /* SyntaxKind.ExportKeyword */: var currentToken_1 = nextToken(); - if (currentToken_1 === 152 /* SyntaxKind.TypeKeyword */) { + if (currentToken_1 === 154 /* SyntaxKind.TypeKeyword */) { currentToken_1 = lookAhead(nextToken); } if (currentToken_1 === 63 /* SyntaxKind.EqualsToken */ || currentToken_1 === 41 /* SyntaxKind.AsteriskToken */ || currentToken_1 === 18 /* SyntaxKind.OpenBraceToken */ || currentToken_1 === 88 /* SyntaxKind.DefaultKeyword */ || - currentToken_1 === 127 /* SyntaxKind.AsKeyword */) { + currentToken_1 === 128 /* SyntaxKind.AsKeyword */) { return true; } continue; @@ -36564,20 +37044,21 @@ var ts; case 85 /* SyntaxKind.ConstKeyword */: case 93 /* SyntaxKind.ExportKeyword */: return isStartOfDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: // When these don't start a declaration, they're an identifier in an expression statement return true; + case 127 /* SyntaxKind.AccessorKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: // When these don't start a declaration, they may be the start of a class member if an identifier // immediately follows. Otherwise they're an identifier in an expression statement. return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine); @@ -36620,9 +37101,9 @@ var ts; case 97 /* SyntaxKind.ForKeyword */: return parseForOrForInOrForOfStatement(); case 86 /* SyntaxKind.ContinueKeyword */: - return parseBreakOrContinueStatement(245 /* SyntaxKind.ContinueStatement */); + return parseBreakOrContinueStatement(248 /* SyntaxKind.ContinueStatement */); case 81 /* SyntaxKind.BreakKeyword */: - return parseBreakOrContinueStatement(246 /* SyntaxKind.BreakStatement */); + return parseBreakOrContinueStatement(249 /* SyntaxKind.BreakStatement */); case 105 /* SyntaxKind.ReturnKeyword */: return parseReturnStatement(); case 116 /* SyntaxKind.WithKeyword */: @@ -36641,12 +37122,12 @@ var ts; return parseDebuggerStatement(); case 59 /* SyntaxKind.AtToken */: return parseDeclaration(); - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: case 118 /* SyntaxKind.InterfaceKeyword */: - case 152 /* SyntaxKind.TypeKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 85 /* SyntaxKind.ConstKeyword */: case 92 /* SyntaxKind.EnumKeyword */: case 93 /* SyntaxKind.ExportKeyword */: @@ -36655,9 +37136,10 @@ var ts; case 122 /* SyntaxKind.ProtectedKeyword */: case 123 /* SyntaxKind.PublicKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: case 124 /* SyntaxKind.StaticKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 157 /* SyntaxKind.GlobalKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: if (isStartOfDeclaration()) { return parseDeclaration(); } @@ -36666,7 +37148,7 @@ var ts; return parseExpressionOrLabeledStatement(); } function isDeclareModifier(modifier) { - return modifier.kind === 135 /* SyntaxKind.DeclareKeyword */; + return modifier.kind === 136 /* SyntaxKind.DeclareKeyword */; } function parseDeclaration() { // `parseListElement` attempted to get the reused node at this position, @@ -36712,13 +37194,13 @@ var ts; return parseClassDeclaration(pos, hasJSDoc, decorators, modifiers); case 118 /* SyntaxKind.InterfaceKeyword */: return parseInterfaceDeclaration(pos, hasJSDoc, decorators, modifiers); - case 152 /* SyntaxKind.TypeKeyword */: + case 154 /* SyntaxKind.TypeKeyword */: return parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers); case 92 /* SyntaxKind.EnumKeyword */: return parseEnumDeclaration(pos, hasJSDoc, decorators, modifiers); - case 157 /* SyntaxKind.GlobalKeyword */: - case 141 /* SyntaxKind.ModuleKeyword */: - case 142 /* SyntaxKind.NamespaceKeyword */: + case 159 /* SyntaxKind.GlobalKeyword */: + case 142 /* SyntaxKind.ModuleKeyword */: + case 143 /* SyntaxKind.NamespaceKeyword */: return parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers); case 100 /* SyntaxKind.ImportKeyword */: return parseImportDeclarationOrImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36728,7 +37210,7 @@ var ts; case 88 /* SyntaxKind.DefaultKeyword */: case 63 /* SyntaxKind.EqualsToken */: return parseExportAssignment(pos, hasJSDoc, decorators, modifiers); - case 127 /* SyntaxKind.AsKeyword */: + case 128 /* SyntaxKind.AsKeyword */: return parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers); default: return parseExportDeclaration(pos, hasJSDoc, decorators, modifiers); @@ -36737,7 +37219,7 @@ var ts; if (decorators || modifiers) { // We reached this point because we encountered decorators and/or modifiers and assumed a declaration // would follow. For recovery and error reporting purposes, return an incomplete declaration. - var missing = createMissingNode(276 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); + var missing = createMissingNode(279 /* SyntaxKind.MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected); ts.setTextRangePos(missing, pos); missing.illegalDecorators = decorators; missing.modifiers = modifiers; @@ -36863,7 +37345,7 @@ var ts; // this context. // The checker will then give an error that there is an empty declaration list. var declarations; - if (token() === 160 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { + if (token() === 162 /* SyntaxKind.OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) { declarations = createMissingList(); } else { @@ -36891,9 +37373,9 @@ var ts; parseExpected(98 /* SyntaxKind.FunctionKeyword */); var asteriskToken = parseOptionalToken(41 /* SyntaxKind.AsteriskToken */); // We don't parse the name here in await context, instead we will report a grammar error in the checker. - var name = modifierFlags & 512 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); + var name = modifierFlags & 1024 /* ModifierFlags.Default */ ? parseOptionalBindingIdentifier() : parseBindingIdentifier(); var isGenerator = asteriskToken ? 1 /* SignatureFlags.Yield */ : 0 /* SignatureFlags.None */; - var isAsync = modifierFlags & 256 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; + var isAsync = modifierFlags & 512 /* ModifierFlags.Async */ ? 2 /* SignatureFlags.Await */ : 0 /* SignatureFlags.None */; var typeParameters = parseTypeParameters(); if (modifierFlags & 1 /* ModifierFlags.Export */) setAwaitContext(/*value*/ true); @@ -36906,8 +37388,8 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseConstructorName() { - if (token() === 134 /* SyntaxKind.ConstructorKeyword */) { - return parseExpected(134 /* SyntaxKind.ConstructorKeyword */); + if (token() === 135 /* SyntaxKind.ConstructorKeyword */) { + return parseExpected(135 /* SyntaxKind.ConstructorKeyword */); } if (token() === 10 /* SyntaxKind.StringLiteral */ && lookAhead(nextToken) === 20 /* SyntaxKind.OpenParenToken */) { return tryParse(function () { @@ -36969,7 +37451,7 @@ var ts; var parameters = parseParameters(0 /* SignatureFlags.None */); var type = parseReturnType(58 /* SyntaxKind.ColonToken */, /*isType*/ false); var body = parseFunctionBlockOrSemicolon(flags); - var node = kind === 172 /* SyntaxKind.GetAccessor */ + var node = kind === 174 /* SyntaxKind.GetAccessor */ ? factory.createGetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, type, body) : factory.createSetAccessorDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, parameters, body); // Keep track of `typeParameters` (for both) and `type` (for setters) if they were parsed those indicate grammar errors @@ -37013,7 +37495,7 @@ var ts; // If we were able to get any potential identifier... if (idToken !== undefined) { // If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse. - if (!ts.isKeyword(idToken) || idToken === 149 /* SyntaxKind.SetKeyword */ || idToken === 136 /* SyntaxKind.GetKeyword */) { + if (!ts.isKeyword(idToken) || idToken === 151 /* SyntaxKind.SetKeyword */ || idToken === 137 /* SyntaxKind.GetKeyword */) { return true; } // If it *is* a keyword, but not an accessor, check a little farther along @@ -37056,7 +37538,7 @@ var ts; return body; } function parseDecoratorExpression() { - if (inAwaitContext() && token() === 132 /* SyntaxKind.AwaitKeyword */) { + if (inAwaitContext() && token() === 133 /* SyntaxKind.AwaitKeyword */) { // `@await` is is disallowed in an [Await] context, but can cause parsing to go off the rails // This simply parses the missing identifier and moves on. var pos = getNodePos(); @@ -37134,10 +37616,10 @@ var ts; } function parseModifiersForArrowFunction() { var modifiers; - if (token() === 131 /* SyntaxKind.AsyncKeyword */) { + if (token() === 132 /* SyntaxKind.AsyncKeyword */) { var pos = getNodePos(); nextToken(); - var modifier = finishNode(factory.createToken(131 /* SyntaxKind.AsyncKeyword */), pos); + var modifier = finishNode(factory.createToken(132 /* SyntaxKind.AsyncKeyword */), pos); modifiers = createNodeArray([modifier], pos); } return modifiers; @@ -37154,13 +37636,13 @@ var ts; if (token() === 124 /* SyntaxKind.StaticKeyword */ && lookAhead(nextTokenIsOpenBrace)) { return parseClassStaticBlockDeclaration(pos, hasJSDoc, decorators, modifiers); } - if (parseContextualModifier(136 /* SyntaxKind.GetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 172 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(137 /* SyntaxKind.GetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 174 /* SyntaxKind.GetAccessor */, 0 /* SignatureFlags.None */); } - if (parseContextualModifier(149 /* SyntaxKind.SetKeyword */)) { - return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 173 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); + if (parseContextualModifier(151 /* SyntaxKind.SetKeyword */)) { + return parseAccessorDeclaration(pos, hasJSDoc, decorators, modifiers, 175 /* SyntaxKind.SetAccessor */, 0 /* SignatureFlags.None */); } - if (token() === 134 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { + if (token() === 135 /* SyntaxKind.ConstructorKeyword */ || token() === 10 /* SyntaxKind.StringLiteral */) { var constructorDeclaration = tryParseConstructorDeclaration(pos, hasJSDoc, decorators, modifiers); if (constructorDeclaration) { return constructorDeclaration; @@ -37197,10 +37679,10 @@ var ts; return ts.Debug.fail("Should not have attempted to parse class member declaration."); } function parseClassExpression() { - return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 226 /* SyntaxKind.ClassExpression */); + return parseClassDeclarationOrExpression(getNodePos(), hasPrecedingJSDocComment(), /*decorators*/ undefined, /*modifiers*/ undefined, 228 /* SyntaxKind.ClassExpression */); } function parseClassDeclaration(pos, hasJSDoc, decorators, modifiers) { - return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 257 /* SyntaxKind.ClassDeclaration */); + return parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, 260 /* SyntaxKind.ClassDeclaration */); } function parseClassDeclarationOrExpression(pos, hasJSDoc, decorators, modifiers, kind) { var savedAwaitContext = inAwaitContext(); @@ -37222,7 +37704,7 @@ var ts; members = createMissingList(); } setAwaitContext(savedAwaitContext); - var node = kind === 257 /* SyntaxKind.ClassDeclaration */ + var node = kind === 260 /* SyntaxKind.ClassDeclaration */ ? factory.createClassDeclaration(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members) : factory.createClassExpression(combineDecoratorsAndModifiers(decorators, modifiers), name, typeParameters, heritageClauses, members); return withJSDoc(finishNode(node, pos), hasJSDoc); @@ -37259,7 +37741,7 @@ var ts; function parseExpressionWithTypeArguments() { var pos = getNodePos(); var expression = parseLeftHandSideExpressionOrHigher(); - if (expression.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (expression.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { return expression; } var typeArguments = tryParseTypeArguments(); @@ -37286,11 +37768,11 @@ var ts; return withJSDoc(finishNode(node, pos), hasJSDoc); } function parseTypeAliasDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(152 /* SyntaxKind.TypeKeyword */); + parseExpected(154 /* SyntaxKind.TypeKeyword */); var name = parseIdentifier(); var typeParameters = parseTypeParameters(); parseExpected(63 /* SyntaxKind.EqualsToken */); - var type = token() === 138 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); + var type = token() === 139 /* SyntaxKind.IntrinsicKeyword */ && tryParse(parseKeywordAndNoDot) || parseType(); parseSemicolon(); var node = factory.createTypeAliasDeclaration(modifiers, name, typeParameters, type); node.illegalDecorators = decorators; @@ -37349,7 +37831,7 @@ var ts; function parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; var name; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // parse 'global' as name of global scope augmentation name = parseIdentifier(); flags |= 1024 /* NodeFlags.GlobalAugmentation */; @@ -37371,15 +37853,15 @@ var ts; } function parseModuleDeclaration(pos, hasJSDoc, decorators, modifiers) { var flags = 0; - if (token() === 157 /* SyntaxKind.GlobalKeyword */) { + if (token() === 159 /* SyntaxKind.GlobalKeyword */) { // global augmentation return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } - else if (parseOptional(142 /* SyntaxKind.NamespaceKeyword */)) { + else if (parseOptional(143 /* SyntaxKind.NamespaceKeyword */)) { flags |= 16 /* NodeFlags.Namespace */; } else { - parseExpected(141 /* SyntaxKind.ModuleKeyword */); + parseExpected(142 /* SyntaxKind.ModuleKeyword */); if (token() === 10 /* SyntaxKind.StringLiteral */) { return parseAmbientExternalModuleDeclaration(pos, hasJSDoc, decorators, modifiers); } @@ -37387,7 +37869,7 @@ var ts; return parseModuleOrNamespaceDeclaration(pos, hasJSDoc, decorators, modifiers, flags); } function isExternalModuleReference() { - return token() === 146 /* SyntaxKind.RequireKeyword */ && + return token() === 147 /* SyntaxKind.RequireKeyword */ && lookAhead(nextTokenIsOpenParen); } function nextTokenIsOpenParen() { @@ -37400,8 +37882,8 @@ var ts; return nextToken() === 43 /* SyntaxKind.SlashToken */; } function parseNamespaceExportDeclaration(pos, hasJSDoc, decorators, modifiers) { - parseExpected(127 /* SyntaxKind.AsKeyword */); - parseExpected(142 /* SyntaxKind.NamespaceKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); + parseExpected(143 /* SyntaxKind.NamespaceKeyword */); var name = parseIdentifier(); parseSemicolon(); var node = factory.createNamespaceExportDeclaration(name); @@ -37419,7 +37901,7 @@ var ts; identifier = parseIdentifier(); } var isTypeOnly = false; - if (token() !== 156 /* SyntaxKind.FromKeyword */ && + if (token() !== 158 /* SyntaxKind.FromKeyword */ && (identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) === "type" && (isIdentifier() || tokenAfterImportDefinitelyProducesImportDeclaration())) { isTypeOnly = true; @@ -37437,11 +37919,11 @@ var ts; token() === 18 /* SyntaxKind.OpenBraceToken */ // import { ) { importClause = parseImportClause(identifier, afterImportPos, isTypeOnly); - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); } var moduleSpecifier = parseModuleSpecifier(); var assertClause; - if (token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -37459,7 +37941,7 @@ var ts; function parseAssertClause(skipAssertKeyword) { var pos = getNodePos(); if (!skipAssertKeyword) { - parseExpected(129 /* SyntaxKind.AssertKeyword */); + parseExpected(130 /* SyntaxKind.AssertKeyword */); } var openBracePosition = scanner.getTokenPos(); if (parseExpected(18 /* SyntaxKind.OpenBraceToken */)) { @@ -37484,7 +37966,7 @@ var ts; function tokenAfterImportedIdentifierDefinitelyProducesImportDeclaration() { // In `import id ___`, the current token decides whether to produce // an ImportDeclaration or ImportEqualsDeclaration. - return token() === 27 /* SyntaxKind.CommaToken */ || token() === 156 /* SyntaxKind.FromKeyword */; + return token() === 27 /* SyntaxKind.CommaToken */ || token() === 158 /* SyntaxKind.FromKeyword */; } function parseImportEqualsDeclaration(pos, hasJSDoc, decorators, modifiers, identifier, isTypeOnly) { parseExpected(63 /* SyntaxKind.EqualsToken */); @@ -37507,7 +37989,7 @@ var ts; var namedBindings; if (!identifier || parseOptional(27 /* SyntaxKind.CommaToken */)) { - namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(269 /* SyntaxKind.NamedImports */); + namedBindings = token() === 41 /* SyntaxKind.AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(272 /* SyntaxKind.NamedImports */); } return finishNode(factory.createImportClause(isTypeOnly, identifier, namedBindings), pos); } @@ -37518,7 +38000,7 @@ var ts; } function parseExternalModuleReference() { var pos = getNodePos(); - parseExpected(146 /* SyntaxKind.RequireKeyword */); + parseExpected(147 /* SyntaxKind.RequireKeyword */); parseExpected(20 /* SyntaxKind.OpenParenToken */); var expression = parseModuleSpecifier(); parseExpected(21 /* SyntaxKind.CloseParenToken */); @@ -37542,7 +38024,7 @@ var ts; // * as ImportedBinding var pos = getNodePos(); parseExpected(41 /* SyntaxKind.AsteriskToken */); - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); var name = parseIdentifier(); return finishNode(factory.createNamespaceImport(name), pos); } @@ -37555,17 +38037,17 @@ var ts; // ImportsList: // ImportSpecifier // ImportsList, ImportSpecifier - var node = kind === 269 /* SyntaxKind.NamedImports */ + var node = kind === 272 /* SyntaxKind.NamedImports */ ? factory.createNamedImports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseImportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)) : factory.createNamedExports(parseBracketedList(23 /* ParsingContext.ImportOrExportSpecifiers */, parseExportSpecifier, 18 /* SyntaxKind.OpenBraceToken */, 19 /* SyntaxKind.CloseBraceToken */)); return finishNode(node, pos); } function parseExportSpecifier() { var hasJSDoc = hasPrecedingJSDocComment(); - return withJSDoc(parseImportOrExportSpecifier(275 /* SyntaxKind.ExportSpecifier */), hasJSDoc); + return withJSDoc(parseImportOrExportSpecifier(278 /* SyntaxKind.ExportSpecifier */), hasJSDoc); } function parseImportSpecifier() { - return parseImportOrExportSpecifier(270 /* SyntaxKind.ImportSpecifier */); + return parseImportOrExportSpecifier(273 /* SyntaxKind.ImportSpecifier */); } function parseImportOrExportSpecifier(kind) { var pos = getNodePos(); @@ -37590,10 +38072,10 @@ var ts; // import { type as } from "mod"; - isTypeOnly: true, name: as // import { type as as } from "mod"; - isTypeOnly: false, name: as, propertyName: type // import { type as as as } from "mod"; - isTypeOnly: true, name: as, propertyName: as - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as ...? } var firstAs = parseIdentifierName(); - if (token() === 127 /* SyntaxKind.AsKeyword */) { + if (token() === 128 /* SyntaxKind.AsKeyword */) { // { type as as ...? } var secondAs = parseIdentifierName(); if (ts.tokenIsIdentifierOrKeyword(token())) { @@ -37628,15 +38110,15 @@ var ts; name = parseNameWithKeywordCheck(); } } - if (canParseAsKeyword && token() === 127 /* SyntaxKind.AsKeyword */) { + if (canParseAsKeyword && token() === 128 /* SyntaxKind.AsKeyword */) { propertyName = name; - parseExpected(127 /* SyntaxKind.AsKeyword */); + parseExpected(128 /* SyntaxKind.AsKeyword */); name = parseNameWithKeywordCheck(); } - if (kind === 270 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { + if (kind === 273 /* SyntaxKind.ImportSpecifier */ && checkIdentifierIsKeyword) { parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected); } - var node = kind === 270 /* SyntaxKind.ImportSpecifier */ + var node = kind === 273 /* SyntaxKind.ImportSpecifier */ ? factory.createImportSpecifier(isTypeOnly, propertyName, name) : factory.createExportSpecifier(isTypeOnly, propertyName, name); return finishNode(node, pos); @@ -37656,26 +38138,26 @@ var ts; var exportClause; var moduleSpecifier; var assertClause; - var isTypeOnly = parseOptional(152 /* SyntaxKind.TypeKeyword */); + var isTypeOnly = parseOptional(154 /* SyntaxKind.TypeKeyword */); var namespaceExportPos = getNodePos(); if (parseOptional(41 /* SyntaxKind.AsteriskToken */)) { - if (parseOptional(127 /* SyntaxKind.AsKeyword */)) { + if (parseOptional(128 /* SyntaxKind.AsKeyword */)) { exportClause = parseNamespaceExport(namespaceExportPos); } - parseExpected(156 /* SyntaxKind.FromKeyword */); + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } else { - exportClause = parseNamedImportsOrExports(273 /* SyntaxKind.NamedExports */); + exportClause = parseNamedImportsOrExports(276 /* SyntaxKind.NamedExports */); // It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios, // the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`) // If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect. - if (token() === 156 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { - parseExpected(156 /* SyntaxKind.FromKeyword */); + if (token() === 158 /* SyntaxKind.FromKeyword */ || (token() === 10 /* SyntaxKind.StringLiteral */ && !scanner.hasPrecedingLineBreak())) { + parseExpected(158 /* SyntaxKind.FromKeyword */); moduleSpecifier = parseModuleSpecifier(); } } - if (moduleSpecifier && token() === 129 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { + if (moduleSpecifier && token() === 130 /* SyntaxKind.AssertKeyword */ && !scanner.hasPrecedingLineBreak()) { assertClause = parseAssertClause(); } parseSemicolon(); @@ -38288,9 +38770,9 @@ var ts; } function isObjectOrObjectArrayTypeReference(node) { switch (node.kind) { - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isObjectOrObjectArrayTypeReference(node.elementType); default: return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object" && !node.typeArguments; @@ -38322,12 +38804,12 @@ var ts; var child = void 0; var children = void 0; while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) { - if (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) { + if (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) { children = ts.append(children, child); } } if (children) { - var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */), pos); + var literal = finishNode(factory.createJSDocTypeLiteral(children, typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */), pos); return finishNode(factory.createJSDocTypeExpression(literal), pos); } } @@ -38445,7 +38927,7 @@ var ts; var hasChildren = false; while (child = tryParse(function () { return parseChildPropertyTag(indent); })) { hasChildren = true; - if (child.kind === 343 /* SyntaxKind.JSDocTypeTag */) { + if (child.kind === 346 /* SyntaxKind.JSDocTypeTag */) { if (childTypeTag) { var lastError = parseErrorAtCurrentToken(ts.Diagnostics.A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags); if (lastError) { @@ -38462,7 +38944,7 @@ var ts; } } if (hasChildren) { - var isArrayType = typeExpression && typeExpression.type.kind === 183 /* SyntaxKind.ArrayType */; + var isArrayType = typeExpression && typeExpression.type.kind === 185 /* SyntaxKind.ArrayType */; var jsdocTypeLiteral = factory.createJSDocTypeLiteral(jsDocPropertyTags, isArrayType); typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ? childTypeTag.typeExpression : @@ -38514,7 +38996,7 @@ var ts; var returnTag = tryParse(function () { if (parseOptionalJsdoc(59 /* SyntaxKind.AtToken */)) { var tag = parseTag(indent); - if (tag && tag.kind === 341 /* SyntaxKind.JSDocReturnTag */) { + if (tag && tag.kind === 344 /* SyntaxKind.JSDocReturnTag */) { return tag; } } @@ -38549,7 +39031,7 @@ var ts; case 59 /* SyntaxKind.AtToken */: if (canParseTag) { var child = tryParseChildTag(target, indent); - if (child && (child.kind === 340 /* SyntaxKind.JSDocParameterTag */ || child.kind === 347 /* SyntaxKind.JSDocPropertyTag */) && + if (child && (child.kind === 343 /* SyntaxKind.JSDocParameterTag */ || child.kind === 350 /* SyntaxKind.JSDocPropertyTag */) && target !== 4 /* PropertyLikeParse.CallbackParameter */ && name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) { return false; @@ -39519,6 +40001,7 @@ var ts; ["es2019.object", "lib.es2019.object.d.ts"], ["es2019.string", "lib.es2019.string.d.ts"], ["es2019.symbol", "lib.es2019.symbol.d.ts"], + ["es2019.intl", "lib.es2019.intl.d.ts"], ["es2020.bigint", "lib.es2020.bigint.d.ts"], ["es2020.date", "lib.es2020.date.d.ts"], ["es2020.promise", "lib.es2020.promise.d.ts"], @@ -39639,6 +40122,7 @@ var ts; shortName: "h", type: "boolean", showInSimplifiedHelpView: true, + isCommandLineOnly: true, category: ts.Diagnostics.Command_line_Options, description: ts.Diagnostics.Print_this_message, defaultValueDescription: false, @@ -39647,6 +40131,8 @@ var ts; name: "help", shortName: "?", type: "boolean", + isCommandLineOnly: true, + category: ts.Diagnostics.Command_line_Options, defaultValueDescription: false, }, { @@ -41378,7 +41864,7 @@ var ts; var _a; var rootExpression = (_a = sourceFile.statements[0]) === null || _a === void 0 ? void 0 : _a.expression; var knownRootOptions = reportOptionsErrors ? getTsconfigRootOptionsMap() : undefined; - if (rootExpression && rootExpression.kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (rootExpression && rootExpression.kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, rootExpression, ts.Diagnostics.The_root_value_of_a_0_file_must_be_an_object, ts.getBaseFileName(sourceFile.fileName) === "jsconfig.json" ? "jsconfig.json" : "tsconfig.json")); // Last-ditch error recovery. Somewhat useful because the JSON parser will recover from some parse errors by // synthesizing a top-level array literal expression. There's a reasonable chance the first element of that @@ -41418,7 +41904,7 @@ var ts; function convertObjectLiteralExpressionToJson(node, knownOptions, extraKeyDiagnostics, parentOption) { var result = returnValue ? {} : undefined; var _loop_4 = function (element) { - if (element.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (element.kind !== 299 /* SyntaxKind.PropertyAssignment */) { errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected)); return "continue"; } @@ -41512,13 +41998,13 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: reportInvalidOptionValue(option && option.type !== "number"); return validateValue(Number(valueExpression.text)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (valueExpression.operator !== 40 /* SyntaxKind.MinusToken */ || valueExpression.operand.kind !== 8 /* SyntaxKind.NumericLiteral */) { break; // not valid JSON syntax } reportInvalidOptionValue(option && option.type !== "number"); return validateValue(-Number(valueExpression.operand.text)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: reportInvalidOptionValue(option && option.type !== "object"); var objectLiteralExpression = valueExpression; // Currently having element option declaration in the tsconfig with type "object" @@ -41535,7 +42021,7 @@ var ts; return validateValue(convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined, /*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined)); } - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: reportInvalidOptionValue(option && option.type !== "list"); return validateValue(convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element)); } @@ -41767,12 +42253,23 @@ var ts; } function writeConfigurations() { // Filter applicable options to place in the file - var categorizedOptions = ts.createMultiMap(); + var categorizedOptions = new ts.Map(); + // Set allowed categories in order + categorizedOptions.set(ts.Diagnostics.Projects, []); + categorizedOptions.set(ts.Diagnostics.Language_and_Environment, []); + categorizedOptions.set(ts.Diagnostics.Modules, []); + categorizedOptions.set(ts.Diagnostics.JavaScript_Support, []); + categorizedOptions.set(ts.Diagnostics.Emit, []); + categorizedOptions.set(ts.Diagnostics.Interop_Constraints, []); + categorizedOptions.set(ts.Diagnostics.Type_Checking, []); + categorizedOptions.set(ts.Diagnostics.Completeness, []); for (var _i = 0, optionDeclarations_1 = ts.optionDeclarations; _i < optionDeclarations_1.length; _i++) { var option = optionDeclarations_1[_i]; - var category = option.category; if (isAllowedOptionForOutput(option)) { - categorizedOptions.add(ts.getLocaleSpecificMessage(category), option); + var listForCategory = categorizedOptions.get(option.category); + if (!listForCategory) + categorizedOptions.set(option.category, listForCategory = []); + listForCategory.push(option); } } // Serialize all options and their descriptions @@ -41783,7 +42280,7 @@ var ts; if (entries.length !== 0) { entries.push({ value: "" }); } - entries.push({ value: "/* ".concat(category, " */") }); + entries.push({ value: "/* ".concat(ts.getLocaleSpecificMessage(category), " */") }); for (var _i = 0, options_1 = options; _i < options_1.length; _i++) { var option = options_1[_i]; var optionName = void 0; @@ -42719,7 +43216,7 @@ var ts; function convertCompilerOptionsForTelemetry(opts) { var out = {}; for (var key in opts) { - if (opts.hasOwnProperty(key)) { + if (ts.hasProperty(opts, key)) { var type = getOptionFromName(key); if (type !== undefined) { // Ignore unknown options out[key] = getOptionValueWithEmptyStrings(opts[key], type); @@ -43825,6 +44322,9 @@ var ts; requestContainingDirectory: containingDirectory, reportDiagnostic: function (diag) { return void diagnostics.push(diag); }, }; + if (traceEnabled && ts.getEmitModuleResolutionKind(compilerOptions) >= ts.ModuleResolutionKind.Node16 && ts.getEmitModuleResolutionKind(compilerOptions) <= ts.ModuleResolutionKind.NodeNext) { + trace(host, ts.Diagnostics.Resolving_in_0_mode_with_conditions_1, features & NodeResolutionFeatures.EsmMode ? "ESM" : "CJS", conditions.map(function (c) { return "'".concat(c, "'"); }).join(", ")); + } var result = ts.forEach(extensions, function (ext) { return tryResolve(ext); }); return createResolvedModuleWithFailedLookupLocations((_a = result === null || result === void 0 ? void 0 : result.value) === null || _a === void 0 ? void 0 : _a.resolved, (_b = result === null || result === void 0 ? void 0 : result.value) === null || _b === void 0 ? void 0 : _b.isExternalLibraryImport, failedLookupLocations, affectingLocations, diagnostics, state.resultFromCache); function tryResolve(extensions) { @@ -44414,7 +44914,7 @@ var ts; } if (mainExport) { var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, subpath, scope, /*isImports*/ false); - return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false); + return loadModuleFromTargetImportOrExport(mainExport, "", /*pattern*/ false, "."); } } else if (allKeysStartWithDot(scope.contents.packageJsonContent.exports)) { @@ -44494,7 +44994,7 @@ var ts; var loadModuleFromTargetImportOrExport = getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports); if (!ts.endsWith(moduleName, ts.directorySeparator) && moduleName.indexOf("*") === -1 && ts.hasProperty(lookupTable, moduleName)) { var target = lookupTable[moduleName]; - return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false); + return loadModuleFromTargetImportOrExport(target, /*subpath*/ "", /*pattern*/ false, moduleName); } var expandingKeys = ts.sort(ts.filter(ts.getOwnKeys(lookupTable), function (k) { return k.indexOf("*") !== -1 || ts.endsWith(k, "/"); }), comparePatternKeys); for (var _i = 0, expandingKeys_1 = expandingKeys; _i < expandingKeys_1.length; _i++) { @@ -44503,17 +45003,17 @@ var ts; var target = lookupTable[potentialTarget]; var starPos = potentialTarget.indexOf("*"); var subpath = moduleName.substring(potentialTarget.substring(0, starPos).length, moduleName.length - (potentialTarget.length - 1 - starPos)); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget); } else if (ts.endsWith(potentialTarget, "*") && ts.startsWith(moduleName, potentialTarget.substring(0, potentialTarget.length - 1))) { var target = lookupTable[potentialTarget]; var subpath = moduleName.substring(potentialTarget.length - 1); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ true, potentialTarget); } else if (ts.startsWith(moduleName, potentialTarget)) { var target = lookupTable[potentialTarget]; var subpath = moduleName.substring(potentialTarget.length); - return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false); + return loadModuleFromTargetImportOrExport(target, subpath, /*pattern*/ false, potentialTarget); } } function matchesPatternWithTrailer(target, name) { @@ -44530,7 +45030,7 @@ var ts; */ function getLoadModuleFromTargetImportOrExport(extensions, state, cache, redirectedReference, moduleName, scope, isImports) { return loadModuleFromTargetImportOrExport; - function loadModuleFromTargetImportOrExport(target, subpath, pattern) { + function loadModuleFromTargetImportOrExport(target, subpath, pattern, key) { if (typeof target === "string") { if (!pattern && subpath.length > 0 && !ts.endsWith(target, "/")) { if (state.traceEnabled) { @@ -44541,6 +45041,8 @@ var ts; if (!ts.startsWith(target, "./")) { if (isImports && !ts.startsWith(target, "../") && !ts.startsWith(target, "/") && !ts.isRootedDiskPath(target)) { var combinedLookup = pattern ? target.replace(/\*/g, subpath) : target + subpath; + traceIfEnabled(state, ts.Diagnostics.Using_0_subpath_1_with_target_2, "imports", key, combinedLookup); + traceIfEnabled(state, ts.Diagnostics.Resolving_module_0_from_1, combinedLookup, scope.packageDirectory + "/"); var result = nodeModuleNameResolverWorker(state.features, combinedLookup, scope.packageDirectory + "/", state.compilerOptions, state.host, cache, [extensions], redirectedReference); return toSearchResult(result.resolvedModule ? { path: result.resolvedModule.resolvedFileName, extension: result.resolvedModule.extension, packageId: result.resolvedModule.packageId, originalPath: result.resolvedModule.originalPath } : undefined); } @@ -44567,6 +45069,9 @@ var ts; } return toSearchResult(/*value*/ undefined); } + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.Using_0_subpath_1_with_target_2, isImports ? "imports" : "exports", key, pattern ? target.replace(/\*/g, subpath) : target + subpath); + } var finalPath = toAbsolutePath(pattern ? resolvedTarget.replace(/\*/g, subpath) : resolvedTarget + subpath); var inputLink = tryLoadInputFileForPath(finalPath, subpath, ts.combinePaths(scope.packageDirectory, "package.json"), isImports); if (inputLink) @@ -44576,14 +45081,18 @@ var ts; else if (typeof target === "object" && target !== null) { // eslint-disable-line no-null/no-null if (!Array.isArray(target)) { for (var _i = 0, _a = ts.getOwnKeys(target); _i < _a.length; _i++) { - var key = _a[_i]; - if (key === "default" || state.conditions.indexOf(key) >= 0 || isApplicableVersionedTypesKey(state.conditions, key)) { - var subTarget = target[key]; - var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern); + var condition = _a[_i]; + if (condition === "default" || state.conditions.indexOf(condition) >= 0 || isApplicableVersionedTypesKey(state.conditions, condition)) { + traceIfEnabled(state, ts.Diagnostics.Matched_0_condition_1, isImports ? "imports" : "exports", condition); + var subTarget = target[condition]; + var result = loadModuleFromTargetImportOrExport(subTarget, subpath, pattern, key); if (result) { return result; } } + else { + traceIfEnabled(state, ts.Diagnostics.Saw_non_matching_condition_0, condition); + } } return undefined; } @@ -44596,7 +45105,7 @@ var ts; } for (var _b = 0, target_2 = target; _b < target_2.length; _b++) { var elem = target_2[_b]; - var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern); + var result = loadModuleFromTargetImportOrExport(elem, subpath, pattern, key); if (result) { return result; } @@ -44791,6 +45300,7 @@ var ts; } } function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state, cache, redirectedReference) { + var _a; var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName)); // First look for a nested package.json, as in `node_modules/foo/bar/package.json`. var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state); @@ -44805,13 +45315,7 @@ var ts; return withPackageId(packageInfo, fromDirectory); } } - var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest; var loader = function (extensions, candidate, onlyRecordFailures, state) { - var _a; - // package exports are higher priority than file/directory lookups (and, if there's exports present, blocks them) - if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { - return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; - } var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) || loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.contents.packageJsonContent, packageInfo && packageInfo.contents.versionPaths); if (!pathAndExtension && packageInfo @@ -44824,19 +45328,24 @@ var ts; } return withPackageId(packageInfo, pathAndExtension); }; - if (rest !== "") { // If "rest" is empty, we just did this search above. - var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); - // Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings. + var _b = parsePackageName(moduleName), packageName = _b.packageName, rest = _b.rest; + var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName); + if (rest !== "") { + // Previous `packageInfo` may have been from a nested package.json; ensure we have the one from the package root now. packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state); - if (packageInfo && packageInfo.contents.versionPaths) { - if (state.traceEnabled) { - trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); - } - var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); - var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); - if (fromPaths) { - return fromPaths.value; - } + } + // package exports are higher priority than file/directory/typesVersions lookups and (and, if there's exports present, blocks them) + if (packageInfo && packageInfo.contents.packageJsonContent.exports && state.features & NodeResolutionFeatures.Exports) { + return (_a = loadModuleFromExports(packageInfo, extensions, ts.combinePaths(".", rest), state, cache, redirectedReference)) === null || _a === void 0 ? void 0 : _a.value; + } + if (rest !== "" && packageInfo && packageInfo.contents.versionPaths) { + if (state.traceEnabled) { + trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.contents.versionPaths.version, ts.version, rest); + } + var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host); + var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.contents.versionPaths.paths, /*pathPatterns*/ undefined, loader, !packageDirectoryExists, state); + if (fromPaths) { + return fromPaths.value; } } return loader(extensions, candidate, !nodeModulesDirectoryExists, state); @@ -45012,6 +45521,15 @@ var ts; function toSearchResult(value) { return value !== undefined ? { value: value } : undefined; } + function traceIfEnabled(state, diagnostic) { + var args = []; + for (var _i = 2; _i < arguments.length; _i++) { + args[_i - 2] = arguments[_i]; + } + if (state.traceEnabled) { + trace.apply(void 0, __spreadArray([state.host, diagnostic], args, false)); + } + } })(ts || (ts = {})); /* @internal */ var ts; @@ -45046,26 +45564,26 @@ var ts; // A module is uninstantiated if it contains only switch (node.kind) { // 1. interface declarations, type alias declarations - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return 0 /* ModuleInstanceState.NonInstantiated */; // 2. const enum declarations - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (ts.isEnumConst(node)) { return 2 /* ModuleInstanceState.ConstEnumOnly */; } break; // 3. non-exported import declarations - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: if (!(ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */))) { return 0 /* ModuleInstanceState.NonInstantiated */; } break; // 4. Export alias declarations pointing at only uninstantiated modules or things uninstantiated modules contain - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDeclaration = node; - if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 273 /* SyntaxKind.NamedExports */) { + if (!exportDeclaration.moduleSpecifier && exportDeclaration.exportClause && exportDeclaration.exportClause.kind === 276 /* SyntaxKind.NamedExports */) { var state = 0 /* ModuleInstanceState.NonInstantiated */; for (var _i = 0, _a = exportDeclaration.exportClause.elements; _i < _a.length; _i++) { var specifier = _a[_i]; @@ -45081,7 +45599,7 @@ var ts; } break; // 5. other uninstantiated module declarations. - case 262 /* SyntaxKind.ModuleBlock */: { + case 265 /* SyntaxKind.ModuleBlock */: { var state_1 = 0 /* ModuleInstanceState.NonInstantiated */; ts.forEachChild(node, function (n) { var childState = getModuleInstanceStateCached(n, visited); @@ -45103,7 +45621,7 @@ var ts; }); return state_1; } - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(node, visited); case 79 /* SyntaxKind.Identifier */: // Only jsdoc typedef definition can exist in jsdoc namespace, and it should @@ -45304,7 +45822,7 @@ var ts; // Should not be called on a declaration with a computed property name, // unless it is a well known Symbol. function getDeclarationName(node) { - if (node.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.kind === 274 /* SyntaxKind.ExportAssignment */) { return node.isExportEquals ? "export=" /* InternalSymbolName.ExportEquals */ : "default" /* InternalSymbolName.Default */; } var name = ts.getNameOfDeclaration(node); @@ -45313,7 +45831,7 @@ var ts; var moduleName = ts.getTextOfIdentifierOrLiteral(name); return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"".concat(moduleName, "\"")); } - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { var nameExpression = name.expression; // treat computed property names where expression is string/numeric literal as just string/numeric literal if (ts.isStringOrNumericLiteralLike(nameExpression)) { @@ -45339,36 +45857,36 @@ var ts; return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined; } switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return "__constructor" /* InternalSymbolName.Constructor */; - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return "__call" /* InternalSymbolName.Call */; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: return "__new" /* InternalSymbolName.New */; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return "__index" /* InternalSymbolName.Index */; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return "__export" /* InternalSymbolName.ExportStar */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // json file should behave as // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */) { // module.exports = ... return "export=" /* InternalSymbolName.ExportEquals */; } ts.Debug.fail("Unknown binary declaration kind"); break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return (ts.isJSDocConstructSignature(node) ? "__new" /* InternalSymbolName.New */ : "__call" /* InternalSymbolName.Call */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Parameters with names are handled at the top of this function. Parameters // without names can only come from JSDocFunctionTypes. - ts.Debug.assert(node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); + ts.Debug.assert(node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: ".concat(ts.Debug.formatSyntaxKind(node.parent.kind), ", expected JSDocFunctionType"); }); var functionType = node.parent; var index = functionType.parameters.indexOf(node); return "arg" + index; @@ -45387,7 +45905,7 @@ var ts; */ function declareSymbol(symbolTable, parent, node, includes, excludes, isReplaceableByMethod, isComputedName) { ts.Debug.assert(isComputedName || !ts.hasDynamicName(node)); - var isDefaultExport = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; + var isDefaultExport = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node) && node.name.escapedText === "default"; // The exported symbol for an export default function/class node is always named "default" var name = isComputedName ? "__computed" /* InternalSymbolName.Computed */ : isDefaultExport && parent ? "default" /* InternalSymbolName.Default */ @@ -45470,7 +45988,7 @@ var ts; // 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default // 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers) if (symbol.declarations && symbol.declarations.length && - (node.kind === 271 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { + (node.kind === 274 /* SyntaxKind.ExportAssignment */ && !node.isExportEquals)) { message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports; messageNeedsName_1 = false; multipleDefaultExports_1 = true; @@ -45509,7 +46027,7 @@ var ts; function declareModuleMember(node, symbolFlags, symbolExcludes) { var hasExportModifier = !!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) || jsdocTreatAsExported(node); if (symbolFlags & 2097152 /* SymbolFlags.Alias */) { - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */ || (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */ || (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && hasExportModifier)) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); } else { @@ -45534,7 +46052,7 @@ var ts; if (ts.isJSDocTypeAlias(node)) ts.Debug.assert(ts.isInJSFile(node)); // We shouldn't add symbols for JSDoc nodes if not in a JS file. if (!ts.isAmbientModule(node) && (hasExportModifier || container.flags & 64 /* NodeFlags.ExportContext */)) { - if (!container.locals || (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) && !getDeclarationName(node))) { + if (!container.locals || (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) && !getDeclarationName(node))) { return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); // No local symbol for an unnamed default! } var exportKind = symbolFlags & 111551 /* SymbolFlags.Value */ ? 1048576 /* SymbolFlags.ExportValue */ : 0; @@ -45598,7 +46116,7 @@ var ts; // for it. We must clear this so we don't accidentally move any stale data forward from // a previous compilation. if (containerFlags & 1 /* ContainerFlags.IsContainer */) { - if (node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (node.kind !== 216 /* SyntaxKind.ArrowFunction */) { thisParentContainer = container; } container = blockScopeContainer = node; @@ -45620,10 +46138,10 @@ var ts; var saveActiveLabelList = activeLabelList; var saveHasExplicitReturn = hasExplicitReturn; var isImmediatelyInvoked = (containerFlags & 16 /* ContainerFlags.IsFunctionExpression */ && - !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Async */) && + !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Async */) && !node.asteriskToken && !!ts.getImmediatelyInvokedFunctionExpression(node)) || - node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; // A non-async, non-generator IIFE is considered part of the containing control flow. Return statements behave // similarly to break statements that exit to a label just past the statement body. if (!isImmediatelyInvoked) { @@ -45634,7 +46152,7 @@ var ts; } // We create a return control flow graph for IIFEs and constructors. For constructors // we use the return control flow graph in strict property initialization checks. - currentReturnTarget = isImmediatelyInvoked || node.kind === 171 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; + currentReturnTarget = isImmediatelyInvoked || node.kind === 173 /* SyntaxKind.Constructor */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) ? createBranchLabel() : undefined; currentExceptionTarget = undefined; currentBreakTarget = undefined; currentContinueTarget = undefined; @@ -45649,14 +46167,14 @@ var ts; node.flags |= 512 /* NodeFlags.HasExplicitReturn */; node.endFlowNode = currentFlow; } - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { node.flags |= emitFlags; node.endFlowNode = currentFlow; } if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); currentFlow = finishFlowLabel(currentReturnTarget); - if (node.kind === 171 /* SyntaxKind.Constructor */ || node.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */))) { + if (node.kind === 173 /* SyntaxKind.Constructor */ || node.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */ || (ts.isInJSFile(node) && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */))) { node.returnFlowNode = currentFlow; } } @@ -45683,8 +46201,8 @@ var ts; blockScopeContainer = savedBlockScopeContainer; } function bindEachFunctionsFirst(nodes) { - bindEach(nodes, function (n) { return n.kind === 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); - bindEach(nodes, function (n) { return n.kind !== 256 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); + bindEach(nodes, function (n) { return n.kind !== 259 /* SyntaxKind.FunctionDeclaration */ ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { if (bindFunction === void 0) { bindFunction = bind; } @@ -45707,59 +46225,59 @@ var ts; inAssignmentPattern = saveInAssignmentPattern; return; } - if (node.kind >= 237 /* SyntaxKind.FirstStatement */ && node.kind <= 253 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { + if (node.kind >= 240 /* SyntaxKind.FirstStatement */ && node.kind <= 256 /* SyntaxKind.LastStatement */ && !options.allowUnreachableCode) { node.flowNode = currentFlow; } switch (node.kind) { - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: bindWhileStatement(node); break; - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: bindDoStatement(node); break; - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: bindForStatement(node); break; - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: bindForInOrForOfStatement(node); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: bindIfStatement(node); break; - case 247 /* SyntaxKind.ReturnStatement */: - case 251 /* SyntaxKind.ThrowStatement */: + case 250 /* SyntaxKind.ReturnStatement */: + case 254 /* SyntaxKind.ThrowStatement */: bindReturnOrThrow(node); break; - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: bindBreakOrContinueStatement(node); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: bindTryStatement(node); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: bindSwitchStatement(node); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: bindCaseBlock(node); break; - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: bindCaseClause(node); break; - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: bindExpressionStatement(node); break; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: bindLabeledStatement(node); break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: bindPrefixUnaryExpressionFlow(node); break; - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: bindPostfixUnaryExpressionFlow(node); break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { // Carry over whether we are in an assignment pattern to // binary expressions that could actually be an initializer @@ -45769,47 +46287,50 @@ var ts; } bindBinaryExpressionFlow(node); break; - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: bindDeleteExpressionFlow(node); break; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: bindConditionalExpressionFlow(node); break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: bindVariableDeclarationFlow(node); break; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bindAccessExpressionFlow(node); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bindCallExpressionFlow(node); break; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: bindNonNullExpressionFlow(node); break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: bindJSDocTypeAlias(node); break; // In source files and blocks, bind functions first to match hoisting that occurs at runtime - case 305 /* SyntaxKind.SourceFile */: { + case 308 /* SyntaxKind.SourceFile */: { bindEachFunctionsFirst(node.statements); bind(node.endOfFileToken); break; } - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: bindEachFunctionsFirst(node.statements); break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: bindBindingElementFlow(node); break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 225 /* SyntaxKind.SpreadElement */: + case 166 /* SyntaxKind.Parameter */: + bindParameterFlow(node); + break; + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 227 /* SyntaxKind.SpreadElement */: // Carry over whether we are in an assignment pattern of Object and Array literals // as well as their children that are valid assignment targets. inAssignmentPattern = saveInAssignmentPattern; @@ -45826,19 +46347,19 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: case 108 /* SyntaxKind.ThisKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return containsNarrowableReference(expr); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return hasNarrowableArgument(expr); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isNarrowingExpression(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isNarrowingBinaryExpression(expr); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 53 /* SyntaxKind.ExclamationToken */ && isNarrowingExpression(expr.operand); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return isNarrowingExpression(expr.expression); } return false; @@ -45862,7 +46383,7 @@ var ts; } } } - if (expr.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expr.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && containsNarrowableReference(expr.expression.expression)) { return true; } @@ -45895,9 +46416,9 @@ var ts; } function isNarrowableOperand(expr) { switch (expr.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isNarrowableOperand(expr.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (expr.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: return isNarrowableOperand(expr.left); @@ -45973,26 +46494,26 @@ var ts; function isStatementCondition(node) { var parent = node.parent; switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 240 /* SyntaxKind.DoStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: return parent.expression === node; - case 242 /* SyntaxKind.ForStatement */: - case 222 /* SyntaxKind.ConditionalExpression */: + case 245 /* SyntaxKind.ForStatement */: + case 224 /* SyntaxKind.ConditionalExpression */: return parent.condition === node; } return false; } function isLogicalExpression(node) { while (true) { - if (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + if (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.expression; } - else if (node.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { + else if (node.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && node.operator === 53 /* SyntaxKind.ExclamationToken */) { node = node.operand; } else { - return node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || + return node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */); } @@ -46038,7 +46559,7 @@ var ts; } function setContinueTarget(node, target) { var label = activeLabelList; - while (label && node.parent.kind === 250 /* SyntaxKind.LabeledStatement */) { + while (label && node.parent.kind === 253 /* SyntaxKind.LabeledStatement */) { label.continueTarget = target; label = label.next; node = node.parent; @@ -46089,12 +46610,12 @@ var ts; bind(node.expression); addAntecedent(preLoopLabel, currentFlow); currentFlow = preLoopLabel; - if (node.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.kind === 247 /* SyntaxKind.ForOfStatement */) { bind(node.awaitModifier); } addAntecedent(postLoopLabel, currentFlow); bind(node.initializer); - if (node.initializer.kind !== 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind !== 258 /* SyntaxKind.VariableDeclarationList */) { bindAssignmentTargetFlow(node.initializer); } bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel); @@ -46116,7 +46637,7 @@ var ts; } function bindReturnOrThrow(node) { bind(node.expression); - if (node.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (node.kind === 250 /* SyntaxKind.ReturnStatement */) { hasExplicitReturn = true; if (currentReturnTarget) { addAntecedent(currentReturnTarget, currentFlow); @@ -46133,7 +46654,7 @@ var ts; return undefined; } function bindBreakOrContinueFlow(node, breakTarget, continueTarget) { - var flowLabel = node.kind === 246 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; + var flowLabel = node.kind === 249 /* SyntaxKind.BreakStatement */ ? breakTarget : continueTarget; if (flowLabel) { addAntecedent(flowLabel, currentFlow); currentFlow = unreachableFlow; @@ -46238,7 +46759,7 @@ var ts; preSwitchCaseFlow = currentFlow; bind(node.caseBlock); addAntecedent(postSwitchLabel, currentFlow); - var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 290 /* SyntaxKind.DefaultClause */; }); + var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 293 /* SyntaxKind.DefaultClause */; }); // We mark a switch statement as possibly exhaustive if it has no default clause and if all // case clauses have unreachable end points (e.g. they all return). Note, we no longer need // this property in control flow analysis, it's there only for backwards compatibility. @@ -46286,7 +46807,7 @@ var ts; function maybeBindExpressionFlowIfCall(node) { // A top level or comma expression call expression with a dotted function name and at least one argument // is potentially an assertion and is therefore included in the control flow. - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { var call = node; if (call.expression.kind !== 106 /* SyntaxKind.SuperKeyword */ && ts.isDottedName(call.expression)) { currentFlow = createFlowCall(currentFlow, call); @@ -46312,7 +46833,7 @@ var ts; currentFlow = finishFlowLabel(postStatementLabel); } function bindDestructuringTargetFlow(node) { - if (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { bindAssignmentTargetFlow(node.left); } else { @@ -46323,10 +46844,10 @@ var ts; if (isNarrowableReference(node)) { currentFlow = createFlowMutation(16 /* FlowFlags.Assignment */, currentFlow, node); } - else if (node.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + else if (node.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { for (var _i = 0, _a = node.elements; _i < _a.length; _i++) { var e = _a[_i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { bindAssignmentTargetFlow(e.expression); } else { @@ -46334,16 +46855,16 @@ var ts; } } } - else if (node.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + else if (node.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var p = _c[_b]; - if (p.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (p.kind === 299 /* SyntaxKind.PropertyAssignment */) { bindDestructuringTargetFlow(p.initializer); } - else if (p.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + else if (p.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { bindAssignmentTargetFlow(p.name); } - else if (p.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (p.kind === 301 /* SyntaxKind.SpreadAssignment */) { bindAssignmentTargetFlow(p.expression); } } @@ -46480,7 +47001,7 @@ var ts; var operator = node.operatorToken.kind; if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) { bindAssignmentTargetFlow(node.left); - if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 207 /* SyntaxKind.ElementAccessExpression */) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && node.left.kind === 209 /* SyntaxKind.ElementAccessExpression */) { var elementAccess = node.left; if (isNarrowableOperand(elementAccess.expression)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46508,7 +47029,7 @@ var ts; } function bindDeleteExpressionFlow(node) { bindEachChild(node); - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { bindAssignmentTargetFlow(node.expression); } } @@ -46546,24 +47067,42 @@ var ts; } } function bindBindingElementFlow(node) { - if (ts.isBindingPattern(node.name)) { - // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: - // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization - // - `BindingElement: BindingPattern Initializer?` - bind(node.dotDotDotToken); - bind(node.propertyName); - bind(node.initializer); - bind(node.name); + // When evaluating a binding pattern, the initializer is evaluated before the binding pattern, per: + // - https://tc39.es/ecma262/#sec-destructuring-binding-patterns-runtime-semantics-iteratorbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + // - https://tc39.es/ecma262/#sec-runtime-semantics-keyedbindinginitialization + // - `BindingElement: BindingPattern Initializer?` + bind(node.dotDotDotToken); + bind(node.propertyName); + bindInitializer(node.initializer); + bind(node.name); + } + function bindParameterFlow(node) { + bindEach(node.modifiers); + bind(node.dotDotDotToken); + bind(node.questionToken); + bind(node.type); + bindInitializer(node.initializer); + bind(node.name); + } + // a BindingElement/Parameter does not have side effects if initializers are not evaluated and used. (see GH#49759) + function bindInitializer(node) { + if (!node) { + return; } - else { - bindEachChild(node); + var entryFlow = currentFlow; + bind(node); + if (entryFlow === unreachableFlow || entryFlow === currentFlow) { + return; } + var exitFlow = createBranchLabel(); + addAntecedent(exitFlow, entryFlow); + addAntecedent(exitFlow, currentFlow); + currentFlow = finishFlowLabel(exitFlow); } function bindJSDocTypeAlias(node) { bind(node.tagName); - if (node.kind !== 339 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { + if (node.kind !== 342 /* SyntaxKind.JSDocEnumTag */ && node.fullName) { // don't bind the type name yet; that's delayed until delayedBindJSDocTypedefTag ts.setParent(node.fullName, node); ts.setParentRecursive(node.fullName, /*incremental*/ false); @@ -46575,7 +47114,7 @@ var ts; function bindJSDocClassTag(node) { bindEachChild(node); var host = ts.getHostSignatureFromJSDoc(node); - if (host && host.kind !== 169 /* SyntaxKind.MethodDeclaration */) { + if (host && host.kind !== 171 /* SyntaxKind.MethodDeclaration */) { addDeclarationToSymbol(host.symbol, host, 32 /* SymbolFlags.Class */); } } @@ -46588,15 +47127,15 @@ var ts; } function bindOptionalChainRest(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: bind(node.questionDotToken); bind(node.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: bind(node.questionDotToken); bind(node.argumentExpression); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: bind(node.questionDotToken); bindEach(node.typeArguments); bindEach(node.arguments); @@ -46661,7 +47200,7 @@ var ts; // an immediately invoked function expression (IIFE). Initialize the flowNode property to // the current control flow (which includes evaluation of the IIFE arguments). var expr = ts.skipParentheses(node.expression); - if (expr.kind === 213 /* SyntaxKind.FunctionExpression */ || expr.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (expr.kind === 215 /* SyntaxKind.FunctionExpression */ || expr.kind === 216 /* SyntaxKind.ArrowFunction */) { bindEach(node.typeArguments); bindEach(node.arguments); bind(node.expression); @@ -46673,7 +47212,7 @@ var ts; } } } - if (node.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (node.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { var propertyAccess = node.expression; if (ts.isIdentifier(propertyAccess.name) && isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) { currentFlow = createFlowMutation(256 /* FlowFlags.ArrayMutation */, currentFlow, node); @@ -46682,55 +47221,55 @@ var ts; } function getContainerFlags(node) { switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 286 /* SyntaxKind.JsxAttributes */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 289 /* SyntaxKind.JsxAttributes */: return 1 /* ContainerFlags.IsContainer */; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 64 /* ContainerFlags.IsInterface */; - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: - case 176 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: + case 178 /* SyntaxKind.IndexSignature */: return 1 /* ContainerFlags.IsContainer */ | 32 /* ContainerFlags.HasLocals */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: if (ts.isObjectLiteralOrClassExpressionMethodOrAccessor(node)) { return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 128 /* ContainerFlags.IsObjectLiteralOrClassExpressionMethodOrAccessor */; } // falls through - case 171 /* SyntaxKind.Constructor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 179 /* SyntaxKind.FunctionType */: - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 181 /* SyntaxKind.FunctionType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return 1 /* ContainerFlags.IsContainer */ | 4 /* ContainerFlags.IsControlFlowContainer */ | 32 /* ContainerFlags.HasLocals */ | 8 /* ContainerFlags.IsFunctionLike */ | 16 /* ContainerFlags.IsFunctionExpression */; - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return 4 /* ContainerFlags.IsControlFlowContainer */; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return node.initializer ? 4 /* ContainerFlags.IsControlFlowContainer */ : 0; - case 292 /* SyntaxKind.CatchClause */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 263 /* SyntaxKind.CaseBlock */: + case 295 /* SyntaxKind.CatchClause */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 266 /* SyntaxKind.CaseBlock */: return 2 /* ContainerFlags.IsBlockScopedContainer */; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: // do not treat blocks directly inside a function as a block-scoped-container. // Locals that reside in this block should go to the function locals. Otherwise 'x' // would not appear to be a redeclaration of a block scoped local in the following @@ -46763,46 +47302,46 @@ var ts; // members are declared (for example, a member of a class will go into a specific // symbol table depending on if it is static or not). We defer to specialized // handlers to take care of declaring these child members. - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return declareModuleMember(node, symbolFlags, symbolExcludes); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return declareSourceFileMember(node, symbolFlags, symbolExcludes); - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: return declareClassMember(node, symbolFlags, symbolExcludes); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 286 /* SyntaxKind.JsxAttributes */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 289 /* SyntaxKind.JsxAttributes */: // Interface/Object-types always have their children added to the 'members' of // their container. They are only accessible through an instance of their // container, and are never in scope otherwise (even inside the body of the // object / type / interface declaring them). An exception is type parameters, // which are in scope without qualification (similar to 'locals'). return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 323 /* SyntaxKind.JSDocSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 195 /* SyntaxKind.MappedType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 326 /* SyntaxKind.JSDocSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 197 /* SyntaxKind.MappedType */: // All the children of these container types are never visible through another // symbol (i.e. through another symbol's 'exports' or 'members'). Instead, // they're only accessed 'lexically' (i.e. from code that exists underneath @@ -46910,10 +47449,10 @@ var ts; } function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) { switch (blockScopeContainer.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: declareModuleMember(node, symbolFlags, symbolExcludes); break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (ts.isExternalOrCommonJsModule(container)) { declareModuleMember(node, symbolFlags, symbolExcludes); break; @@ -47010,7 +47549,7 @@ var ts; node.originalKeywordKind <= 125 /* SyntaxKind.LastFutureReservedWord */) { file.bindDiagnostics.push(createDiagnosticForNode(node, getStrictModeIdentifierMessage(node), ts.declarationNameToString(node))); } - else if (node.originalKeywordKind === 132 /* SyntaxKind.AwaitKeyword */) { + else if (node.originalKeywordKind === 133 /* SyntaxKind.AwaitKeyword */) { if (ts.isExternalModule(file) && ts.isInTopLevelContext(node)) { file.bindDiagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module, ts.declarationNameToString(node))); } @@ -47112,8 +47651,8 @@ var ts; function checkStrictModeFunctionDeclaration(node) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { // Report error if function is not top level function declaration - if (blockScopeContainer.kind !== 305 /* SyntaxKind.SourceFile */ && - blockScopeContainer.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && + if (blockScopeContainer.kind !== 308 /* SyntaxKind.SourceFile */ && + blockScopeContainer.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isFunctionLikeOrClassStaticBlockDeclaration(blockScopeContainer)) { // We check first if the name is inside class declaration or class expression; if so give explicit message // otherwise report generic error message. @@ -47210,7 +47749,7 @@ var ts; // the current 'container' node when it changes. This helps us know which symbol table // a local should go into for example. Since terminal nodes are known not to have // children, as an optimization we don't process those. - if (node.kind > 160 /* SyntaxKind.LastToken */) { + if (node.kind > 162 /* SyntaxKind.LastToken */) { var saveParent = parent; parent = node; var containerFlags = getContainerFlags(node); @@ -47286,23 +47825,23 @@ var ts; } // falls through case 108 /* SyntaxKind.ThisKeyword */: - if (currentFlow && (ts.isExpression(node) || parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */)) { + if (currentFlow && (ts.isExpression(node) || parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */)) { node.flowNode = currentFlow; } return checkContextualIdentifier(node); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: if (currentFlow && ts.isPartOfTypeQuery(node)) { node.flowNode = currentFlow; } break; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: case 106 /* SyntaxKind.SuperKeyword */: node.flowNode = currentFlow; break; case 80 /* SyntaxKind.PrivateIdentifier */: return checkPrivateIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node; if (currentFlow && isNarrowableReference(expr)) { expr.flowNode = currentFlow; @@ -47317,7 +47856,7 @@ var ts; declareSymbol(file.locals, /*parent*/ undefined, expr.expression, 1 /* SymbolFlags.FunctionScopedVariable */ | 134217728 /* SymbolFlags.ModuleExports */, 111550 /* SymbolFlags.FunctionScopedVariableExcludes */); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var specialKind = ts.getAssignmentDeclarationKind(node); switch (specialKind) { case 1 /* AssignmentDeclarationKind.ExportsProperty */: @@ -47353,78 +47892,78 @@ var ts; ts.Debug.fail("Unknown binary expression special property assignment kind"); } return checkStrictModeBinaryExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return checkStrictModeCatchClause(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkStrictModeDeleteExpression(node); case 8 /* SyntaxKind.NumericLiteral */: return checkStrictModeNumericLiteral(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkStrictModePostfixUnaryExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkStrictModePrefixUnaryExpression(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkStrictModeWithStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkStrictModeLabeledStatement(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: seenThisKeyword = true; return; - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: break; // Binding the children will handle everything - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return bindTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return bindParameter(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return bindVariableDeclarationOrBindingElement(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: node.flowNode = currentFlow; return bindVariableDeclarationOrBindingElement(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return bindPropertyWorker(node); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return bindPropertyOrMethodOrAccessor(node, 8 /* SymbolFlags.EnumMember */, 900095 /* SymbolFlags.EnumMemberExcludes */); - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return declareSymbolAndAddToSymbolTable(node, 131072 /* SymbolFlags.Signature */, 0 /* SymbolFlags.None */); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: // If this is an ObjectLiteralExpression method, then it sits in the same space // as other properties in the object literal. So we use SymbolFlags.PropertyExcludes // so that it will conflict with any other object literal members with the same // name. return bindPropertyOrMethodOrAccessor(node, 8192 /* SymbolFlags.Method */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), ts.isObjectLiteralMethod(node) ? 0 /* SymbolFlags.PropertyExcludes */ : 103359 /* SymbolFlags.MethodExcludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return bindFunctionDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return declareSymbolAndAddToSymbolTable(node, 16384 /* SymbolFlags.Constructor */, /*symbolExcludes:*/ 0 /* SymbolFlags.None */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return bindPropertyOrMethodOrAccessor(node, 32768 /* SymbolFlags.GetAccessor */, 46015 /* SymbolFlags.GetAccessorExcludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return bindPropertyOrMethodOrAccessor(node, 65536 /* SymbolFlags.SetAccessor */, 78783 /* SymbolFlags.SetAccessorExcludes */); - case 179 /* SyntaxKind.FunctionType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: + case 182 /* SyntaxKind.ConstructorType */: return bindFunctionOrConstructorType(node); - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 195 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 197 /* SyntaxKind.MappedType */: return bindAnonymousTypeWorker(node); - case 332 /* SyntaxKind.JSDocClassTag */: + case 335 /* SyntaxKind.JSDocClassTag */: return bindJSDocClassTag(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return bindObjectLiteralExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return bindFunctionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: var assignmentKind = ts.getAssignmentDeclarationKind(node); switch (assignmentKind) { case 7 /* AssignmentDeclarationKind.ObjectDefinePropertyValue */: @@ -47443,70 +47982,73 @@ var ts; } break; // Members of classes, interfaces, and modules - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: // All classes are automatically in strict mode in ES6. inStrictMode = true; return bindClassLikeDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return bindBlockScopedDeclaration(node, 64 /* SymbolFlags.Interface */, 788872 /* SymbolFlags.InterfaceExcludes */); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return bindBlockScopedDeclaration(node, 524288 /* SymbolFlags.TypeAlias */, 788968 /* SymbolFlags.TypeAliasExcludes */); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return bindEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return bindModuleDeclaration(node); // Jsx-attributes - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return bindJsxAttributes(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return bindJsxAttribute(node, 4 /* SymbolFlags.Property */, 0 /* SymbolFlags.PropertyExcludes */); // Imports and exports - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return declareSymbolAndAddToSymbolTable(node, 2097152 /* SymbolFlags.Alias */, 2097152 /* SymbolFlags.AliasExcludes */); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return bindNamespaceExportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return bindImportClause(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return bindExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return bindExportAssignment(node); - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: updateStrictModeStatementList(node.statements); return bindSourceFileIfExternalModule(); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: if (!ts.isFunctionLikeOrClassStaticBlockDeclaration(node.parent)) { return; } // falls through - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return updateStrictModeStatementList(node.statements); - case 340 /* SyntaxKind.JSDocParameterTag */: - if (node.parent.kind === 323 /* SyntaxKind.JSDocSignature */) { + case 343 /* SyntaxKind.JSDocParameterTag */: + if (node.parent.kind === 326 /* SyntaxKind.JSDocSignature */) { return bindParameter(node); } - if (node.parent.kind !== 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (node.parent.kind !== 325 /* SyntaxKind.JSDocTypeLiteral */) { break; } // falls through - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: var propTag = node; - var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ ? + var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ ? 4 /* SymbolFlags.Property */ | 16777216 /* SymbolFlags.Optional */ : 4 /* SymbolFlags.Property */; return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* SymbolFlags.PropertyExcludes */); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return (delayedTypeAliases || (delayedTypeAliases = [])).push(node); } } function bindPropertyWorker(node) { - return bindPropertyOrMethodOrAccessor(node, 4 /* SymbolFlags.Property */ | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), 0 /* SymbolFlags.PropertyExcludes */); + var isAutoAccessor = ts.isAutoAccessorPropertyDeclaration(node); + var includes = isAutoAccessor ? 98304 /* SymbolFlags.Accessor */ : 4 /* SymbolFlags.Property */; + var excludes = isAutoAccessor ? 13247 /* SymbolFlags.AccessorExcludes */ : 0 /* SymbolFlags.PropertyExcludes */; + return bindPropertyOrMethodOrAccessor(node, includes | (node.questionToken ? 16777216 /* SymbolFlags.Optional */ : 0 /* SymbolFlags.None */), excludes); } function bindAnonymousTypeWorker(node) { return bindAnonymousDeclaration(node, 2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); @@ -47666,8 +48208,8 @@ var ts; } var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false); switch (thisContainer.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: var constructorSymbol = thisContainer.symbol; // For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression. if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -47689,12 +48231,12 @@ var ts; addDeclarationToSymbol(constructorSymbol, constructorSymbol.valueDeclaration, 32 /* SymbolFlags.Class */); } break; - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // this.foo assignment in a JavaScript class // Bind this property to the containing class var containingClass = thisContainer.parent; @@ -47706,7 +48248,7 @@ var ts; declareSymbol(symbolTable, containingClass.symbol, node, 4 /* SymbolFlags.Property */ | 67108864 /* SymbolFlags.Assignment */, 0 /* SymbolFlags.None */, /*isReplaceableByMethod*/ true); } break; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: // this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script if (ts.hasDynamicName(node)) { break; @@ -47735,7 +48277,7 @@ var ts; if (node.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { bindThisPropertyAssignment(node); } - else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (ts.isBindableStaticAccessExpression(node) && node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */) { if (ts.isPrototypeAccess(node.expression)) { bindPrototypePropertyAssignment(node, node.parent); } @@ -47775,7 +48317,7 @@ var ts; } function bindObjectDefinePropertyAssignment(node) { var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]); - var isToplevel = node.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + var isToplevel = node.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false, /*containerIsClass*/ false); bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false); } @@ -47884,8 +48426,8 @@ var ts; } function isTopLevelNamespaceAssignment(propertyAccess) { return ts.isBinaryExpression(propertyAccess.parent) - ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 305 /* SyntaxKind.SourceFile */ - : propertyAccess.parent.parent.kind === 305 /* SyntaxKind.SourceFile */; + ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 308 /* SyntaxKind.SourceFile */ + : propertyAccess.parent.parent.kind === 308 /* SyntaxKind.SourceFile */; } function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty, containerIsClass) { var namespaceSymbol = lookupSymbolForPropertyAccess(name, container) || lookupSymbolForPropertyAccess(name, blockScopeContainer); @@ -47964,7 +48506,7 @@ var ts; } } function bindClassLikeDeclaration(node) { - if (node.kind === 257 /* SyntaxKind.ClassDeclaration */) { + if (node.kind === 260 /* SyntaxKind.ClassDeclaration */) { bindBlockScopedDeclaration(node, 32 /* SymbolFlags.Class */, 899503 /* SymbolFlags.ClassExcludes */); } else { @@ -48006,7 +48548,7 @@ var ts; checkStrictModeEvalOrArguments(node, node.name); } if (!ts.isBindingPattern(node.name)) { - var possibleVariableDecl = node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; + var possibleVariableDecl = node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? node : node.parent.parent; if (ts.isInJSFile(node) && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(possibleVariableDecl) && !ts.getJSDocTypeTag(node) && @@ -48034,7 +48576,7 @@ var ts; } } function bindParameter(node) { - if (node.kind === 340 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 323 /* SyntaxKind.JSDocSignature */) { + if (node.kind === 343 /* SyntaxKind.JSDocParameterTag */ && container.kind !== 326 /* SyntaxKind.JSDocSignature */) { return; } if (inStrictMode && !(node.flags & 16777216 /* NodeFlags.Ambient */)) { @@ -48111,7 +48653,7 @@ var ts; declareSymbolAndAddToSymbolTable(node, 262144 /* SymbolFlags.TypeParameter */, 526824 /* SymbolFlags.TypeParameterExcludes */); } } - else if (node.parent.kind === 190 /* SyntaxKind.InferType */) { + else if (node.parent.kind === 192 /* SyntaxKind.InferType */) { var container_2 = getInferTypeContainer(node.parent); if (container_2) { if (!container_2.locals) { @@ -48139,11 +48681,11 @@ var ts; if (currentFlow === unreachableFlow) { var reportError = // report error on all statements except empty ones - (ts.isStatementButNotDeclaration(node) && node.kind !== 236 /* SyntaxKind.EmptyStatement */) || + (ts.isStatementButNotDeclaration(node) && node.kind !== 239 /* SyntaxKind.EmptyStatement */) || // report error on class declarations - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || // report error on instantiated modules or const-enums only modules if preserveConstEnums is set - (node.kind === 261 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); + (node.kind === 264 /* SyntaxKind.ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)); if (reportError) { currentFlow = reportedUnreachableFlow; if (!options.allowUnreachableCode) { @@ -48187,12 +48729,12 @@ var ts; } function isPurelyTypeDeclaration(s) { switch (s.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return getModuleInstanceState(s) !== 1 /* ModuleInstanceState.Instantiated */; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return ts.hasSyntacticModifier(s, 2048 /* ModifierFlags.Const */); default: return false; @@ -48393,7 +48935,7 @@ var ts; // (their type resolved directly to the member deeply referenced) // So to get the intervening symbols, we need to check if there's a type // query node on any of the symbol's declarations and get symbols there - if (d.type && d.type.kind === 181 /* SyntaxKind.TypeQuery */) { + if (d.type && d.type.kind === 183 /* SyntaxKind.TypeQuery */) { var query = d.type; var entity = getResolvedSymbol(getFirstIdentifier(query.exprName)); visitSymbol(entity); @@ -48579,8 +49121,6 @@ var ts; IntersectionState[IntersectionState["None"] = 0] = "None"; IntersectionState[IntersectionState["Source"] = 1] = "Source"; IntersectionState[IntersectionState["Target"] = 2] = "Target"; - IntersectionState[IntersectionState["PropertyCheck"] = 4] = "PropertyCheck"; - IntersectionState[IntersectionState["InPropertyCheck"] = 8] = "InPropertyCheck"; })(IntersectionState || (IntersectionState = {})); var RecursionFlags; (function (RecursionFlags) { @@ -48804,6 +49344,7 @@ var ts; getTypeOfPropertyOfType: function (type, name) { return getTypeOfPropertyOfType(type, ts.escapeLeadingUnderscores(name)); }, getIndexInfoOfType: function (type, kind) { return getIndexInfoOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexInfosOfType: getIndexInfosOfType, + getIndexInfosOfIndexSymbol: getIndexInfosOfIndexSymbol, getSignaturesOfType: getSignaturesOfType, getIndexTypeOfType: function (type, kind) { return getIndexTypeOfType(type, kind === 0 /* IndexKind.String */ ? stringType : numberType); }, getIndexType: function (type) { return getIndexType(type); }, @@ -48829,6 +49370,7 @@ var ts; signatureToSignatureDeclaration: nodeBuilder.signatureToSignatureDeclaration, symbolToEntityName: nodeBuilder.symbolToEntityName, symbolToExpression: nodeBuilder.symbolToExpression, + symbolToNode: nodeBuilder.symbolToNode, symbolToTypeParameterDeclarations: nodeBuilder.symbolToTypeParameterDeclarations, symbolToParameterDeclaration: nodeBuilder.symbolToParameterDeclaration, typeParameterToDeclaration: nodeBuilder.typeParameterToDeclaration, @@ -48997,6 +49539,12 @@ var ts; getOptionalType: function () { return optionalType; }, getPromiseType: function () { return getGlobalPromiseType(/*reportErrors*/ false); }, getPromiseLikeType: function () { return getGlobalPromiseLikeType(/*reportErrors*/ false); }, + getAsyncIterableType: function () { + var type = getGlobalAsyncIterableType(/*reportErrors*/ false); + if (type === emptyGenericType) + return undefined; + return type; + }, isSymbolAccessible: isSymbolAccessible, isArrayType: isArrayType, isTupleType: isTupleType, @@ -49077,6 +49625,7 @@ var ts; isPropertyAccessible: isPropertyAccessible, getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration, getMemberOverrideModifierStatus: getMemberOverrideModifierStatus, + isTypeParameterPossiblyReferenced: isTypeParameterPossiblyReferenced, }; function runWithInferenceBlockedFromSourceNode(node, fn) { var containingCall = ts.findAncestor(node, ts.isCallLikeExpression); @@ -49196,7 +49745,8 @@ var ts; var emptyTypeLiteralSymbol = createSymbol(2048 /* SymbolFlags.TypeLiteral */, "__type" /* InternalSymbolName.Type */); emptyTypeLiteralSymbol.members = ts.createSymbolTable(); var emptyTypeLiteralType = createAnonymousType(emptyTypeLiteralSymbol, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); - var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray)]) : unknownType; + var unknownEmptyObjectType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); + var unknownUnionType = strictNullChecks ? getUnionType([undefinedType, nullType, unknownEmptyObjectType]) : unknownType; var emptyGenericType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); emptyGenericType.instantiations = new ts.Map(); var anyFunctionType = createAnonymousType(undefined, emptySymbols, ts.emptyArray, ts.emptyArray, ts.emptyArray); @@ -49310,6 +49860,8 @@ var ts; var deferredGlobalOmitSymbol; var deferredGlobalAwaitedSymbol; var deferredGlobalBigIntType; + var deferredGlobalNaNSymbol; + var deferredGlobalRecordSymbol; var allPotentiallyUnusedIdentifiers = new ts.Map(); // key is file name var flowLoopStart = 0; var flowLoopCount = 0; @@ -49499,10 +50051,10 @@ var ts; } // Issue errors globally var file = ts.getSourceFileOfNode(location); - addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createFileDiagnostic(file, 0, 0, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForFileFromMessageChain(file, message)); // eslint-disable-line local/no-in-operator return; } - addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line no-in-operator + addErrorOrSuggestion(isError, "message" in message ? ts.createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) : ts.createDiagnosticForNodeFromMessageChain(location, message)); // eslint-disable-line local/no-in-operator } function errorAndMaybeSuggestAwait(location, maybeMissingAwait, message, arg0, arg1, arg2, arg3) { var diagnostic = error(location, message, arg0, arg1, arg2, arg3); @@ -49731,7 +50283,7 @@ var ts; if (unidirectional === void 0) { unidirectional = false; } source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); - target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol); + target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : getMergedSymbol(sourceSymbol)); }); } function mergeModuleAugmentation(moduleName) { @@ -49819,7 +50371,7 @@ var ts; return nodeLinks[nodeId] || (nodeLinks[nodeId] = new NodeLinks()); } function isGlobalSourceFile(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ && !ts.isExternalOrCommonJsModule(node); } function getSymbol(symbols, name, meaning) { if (meaning) { @@ -49830,9 +50382,9 @@ var ts; return symbol; } if (symbol.flags & 2097152 /* SymbolFlags.Alias */) { - var target = resolveAlias(symbol); - // Unknown symbol means an error occurred in alias resolution, treat it as positive answer to avoid cascading errors - if (target === unknownSymbol || target.flags & meaning) { + var targetFlags = getAllSymbolFlags(symbol); + // `targetFlags` will be `SymbolFlags.All` if an error occurred in alias resolution; this avoids cascading errors + if (targetFlags & meaning) { return symbol; } } @@ -49878,17 +50430,17 @@ var ts; } if (declaration.pos <= usage.pos && !(ts.isPropertyDeclaration(declaration) && ts.isThisProperty(usage.parent) && !declaration.initializer && !declaration.exclamationToken)) { // declaration is before usage - if (declaration.kind === 203 /* SyntaxKind.BindingElement */) { + if (declaration.kind === 205 /* SyntaxKind.BindingElement */) { // still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2]) - var errorBindingElement = ts.getAncestor(usage, 203 /* SyntaxKind.BindingElement */); + var errorBindingElement = ts.getAncestor(usage, 205 /* SyntaxKind.BindingElement */); if (errorBindingElement) { return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) || declaration.pos < errorBindingElement.pos; } // or it might be illegal if usage happens before parent variable is declared (eg var [a] = a) - return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 254 /* SyntaxKind.VariableDeclaration */), usage); + return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 257 /* SyntaxKind.VariableDeclaration */), usage); } - else if (declaration.kind === 254 /* SyntaxKind.VariableDeclaration */) { + else if (declaration.kind === 257 /* SyntaxKind.VariableDeclaration */) { // still might be illegal if usage is in the initializer of the variable declaration (eg var a = a) return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage); } @@ -49918,12 +50470,12 @@ var ts; // or if usage is in a type context: // 1. inside a type query (typeof in type position) // 2. inside a jsdoc comment - if (usage.parent.kind === 275 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { + if (usage.parent.kind === 278 /* SyntaxKind.ExportSpecifier */ || (usage.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.parent.isExportEquals)) { // export specifiers do not use the variable, they only make it available for use return true; } // When resolving symbols for exports, the `usage` location passed in can be the export site directly - if (usage.kind === 271 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { + if (usage.kind === 274 /* SyntaxKind.ExportAssignment */ && usage.isExportEquals) { return true; } if (!!(usage.flags & 8388608 /* NodeFlags.JSDoc */) || isInTypeQuery(usage) || usageInTypeDeclaration()) { @@ -49945,9 +50497,9 @@ var ts; } function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) { switch (declaration.parent.parent.kind) { - case 237 /* SyntaxKind.VariableStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 240 /* SyntaxKind.VariableStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: // variable statement/for/for-of statement case, // use site should not be inside variable declaration (initializer of declaration or binding element) if (isSameScopeDescendentOf(usage, declaration, declContainer)) { @@ -49975,7 +50527,7 @@ var ts; var initializerOfProperty = propertyDeclaration.initializer === current; if (initializerOfProperty) { if (ts.isStatic(current.parent)) { - if (declaration.kind === 169 /* SyntaxKind.MethodDeclaration */) { + if (declaration.kind === 171 /* SyntaxKind.MethodDeclaration */) { return true; } if (ts.isPropertyDeclaration(declaration) && ts.getContainingClass(usage) === ts.getContainingClass(declaration)) { @@ -49990,7 +50542,7 @@ var ts; } } else { - var isDeclarationInstanceProperty = declaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); + var isDeclarationInstanceProperty = declaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(declaration); if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) { return true; } @@ -50013,19 +50565,19 @@ var ts; return "quit"; } switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // even when stopping at any property declaration, they need to come from the same class return stopAtAnyPropertyDeclaration && (ts.isPropertyDeclaration(declaration) && node.parent === declaration.parent || ts.isParameterPropertyDeclaration(declaration, declaration.parent) && node.parent === declaration.parent.parent) ? "quit" : true; - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: switch (node.parent.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 175 /* SyntaxKind.SetAccessor */: return true; default: return false; @@ -50065,18 +50617,18 @@ var ts; } function requiresScopeChangeWorker(node) { switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: + case 216 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: // do not descend into these return false; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: return requiresScopeChangeWorker(node.name); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // static properties in classes introduce temporary variables if (ts.hasStaticModifier(node)) { return target < 99 /* ScriptTarget.ESNext */ || !useDefineForClassFields; @@ -50105,12 +50657,13 @@ var ts; * the nameNotFoundMessage argument is not undefined. Returns the resolved symbol, or undefined if no symbol with * the given name can be found. * + * @param nameNotFoundMessage If defined, we will report errors found during resolve. * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters. */ - function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) { + function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions) { if (excludeGlobals === void 0) { excludeGlobals = false; } - if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; } - return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol); + if (getSpellingSuggestions === void 0) { getSpellingSuggestions = true; } + return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, getSymbol); } function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) { var _a, _b, _c; @@ -50141,14 +50694,14 @@ var ts; // - parameters are only in the scope of function body // This restriction does not apply to JSDoc comment types because they are parented // at a higher level than type parameters would normally be - if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 320 /* SyntaxKind.JSDoc */) { + if (meaning & result.flags & 788968 /* SymbolFlags.Type */ && lastLocation.kind !== 323 /* SyntaxKind.JSDoc */) { useResult = result.flags & 262144 /* SymbolFlags.TypeParameter */ // type parameters are visible in parameter list, return type and type parameter list ? lastLocation === location.type || - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || - lastLocation.kind === 340 /* SyntaxKind.JSDocParameterTag */ || - lastLocation.kind === 341 /* SyntaxKind.JSDocReturnTag */ || - lastLocation.kind === 163 /* SyntaxKind.TypeParameter */ + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || + lastLocation.kind === 343 /* SyntaxKind.JSDocParameterTag */ || + lastLocation.kind === 344 /* SyntaxKind.JSDocReturnTag */ || + lastLocation.kind === 165 /* SyntaxKind.TypeParameter */ // local types not visible outside the function body : false; } @@ -50163,13 +50716,13 @@ var ts; // however it is detected separately when checking initializers of parameters // to make sure that they reference no variables declared after them. useResult = - lastLocation.kind === 164 /* SyntaxKind.Parameter */ || + lastLocation.kind === 166 /* SyntaxKind.Parameter */ || (lastLocation === location.type && !!ts.findAncestor(result.valueDeclaration, ts.isParameter)); } } } - else if (location.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (location.kind === 191 /* SyntaxKind.ConditionalType */) { // A type parameter declared using 'infer T' in a conditional type is visible only in // the true branch of the conditional type. useResult = lastLocation === location.trueType; @@ -50184,14 +50737,14 @@ var ts; } withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation); switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) break; isInExternalModule = true; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var moduleExports = ((_a = getSymbolOfNode(location)) === null || _a === void 0 ? void 0 : _a.exports) || emptySymbols; - if (location.kind === 305 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { + if (location.kind === 308 /* SyntaxKind.SourceFile */ || (ts.isModuleDeclaration(location) && location.flags & 16777216 /* NodeFlags.Ambient */ && !ts.isGlobalScopeAugmentation(location))) { // It's an external module. First see if the module has an export default and if the local // name of that export default matches. if (result = moduleExports.get("default" /* InternalSymbolName.Default */)) { @@ -50215,7 +50768,7 @@ var ts; var moduleExport = moduleExports.get(name); if (moduleExport && moduleExport.flags === 2097152 /* SymbolFlags.Alias */ && - (ts.getDeclarationOfKind(moduleExport, 275 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 274 /* SyntaxKind.NamespaceExport */))) { + (ts.getDeclarationOfKind(moduleExport, 278 /* SyntaxKind.ExportSpecifier */) || ts.getDeclarationOfKind(moduleExport, 277 /* SyntaxKind.NamespaceExport */))) { break; } } @@ -50229,12 +50782,12 @@ var ts; } } break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: if (result = lookup(((_c = getSymbolOfNode(location)) === null || _c === void 0 ? void 0 : _c.exports) || emptySymbols, name, meaning & 8 /* SymbolFlags.EnumMember */)) { break loop; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // TypeScript 1.0 spec (April 2014): 8.4.1 // Initializer expressions for instance member variables are evaluated in the scope // of the class constructor body but are not permitted to reference parameters or @@ -50252,9 +50805,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals // These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would // trigger resolving late-bound names, which we may already be in the process of doing while we're here! @@ -50268,12 +50821,14 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.4.1 // The scope of a type parameter extends over the entire declaration with which the type // parameter list is associated, with the exception of static member declarations in classes. - error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.Static_members_cannot_reference_class_type_parameters); + } return undefined; } break loop; } - if (location.kind === 226 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { + if (location.kind === 228 /* SyntaxKind.ClassExpression */ && meaning & 32 /* SymbolFlags.Class */) { var className = location.name; if (className && name === className.escapedText) { result = location.symbol; @@ -50281,7 +50836,7 @@ var ts; } } break; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // The type parameters of a class are not in scope in the base class expression. if (lastLocation === location.expression && location.parent.token === 94 /* SyntaxKind.ExtendsKeyword */) { var container = location.parent.parent; @@ -50301,34 +50856,36 @@ var ts; // [foo()]() { } // <-- Reference to T from class's own computed property // } // - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: grandparent = location.parent.parent; - if (ts.isClassLike(grandparent) || grandparent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (ts.isClassLike(grandparent) || grandparent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { // A reference to this grandparent's type parameters would be an error if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 788968 /* SymbolFlags.Type */)) { - error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + if (nameNotFoundMessage) { + error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type); + } return undefined; } } break; - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // when targeting ES6 or higher there is no 'arguments' in an arrow function // for lower compile targets the resolved symbol is used to emit an error if (ts.getEmitScriptTarget(compilerOptions) >= 2 /* ScriptTarget.ES2015 */) { break; } // falls through - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (meaning & 3 /* SymbolFlags.Variable */ && name === "arguments") { result = argumentsSymbol; break loop; @@ -50341,7 +50898,7 @@ var ts; } } break; - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are resolved at the class declaration. Resolving at the parameter // or member would result in looking up locals in the method. // @@ -50350,7 +50907,7 @@ var ts; // method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter. // } // - if (location.parent && location.parent.kind === 164 /* SyntaxKind.Parameter */) { + if (location.parent && location.parent.kind === 166 /* SyntaxKind.Parameter */) { location = location.parent; } // @@ -50365,20 +50922,20 @@ var ts; // declare function y(x: T): any; // @param(1 as T) // <-- T should resolve to the type alias outside of class C // class C {} - if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 257 /* SyntaxKind.ClassDeclaration */)) { + if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 260 /* SyntaxKind.ClassDeclaration */)) { location = location.parent; } break; - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // js type aliases do not resolve names from their host, so skip past it var root = ts.getJSDocRoot(location); if (root) { location = root.parent; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (!associatedDeclarationForContainingInitializerOrBindingName) { @@ -50386,7 +50943,7 @@ var ts; } } break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: if (lastLocation && (lastLocation === location.initializer || lastLocation === location.name && ts.isBindingPattern(lastLocation))) { if (ts.isParameterDeclaration(location) && !associatedDeclarationForContainingInitializerOrBindingName) { @@ -50394,7 +50951,7 @@ var ts; } } break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: if (meaning & 262144 /* SymbolFlags.TypeParameter */) { var parameterName = location.typeParameter.name; if (parameterName && name === parameterName.escapedText) { @@ -50420,7 +50977,7 @@ var ts; } if (!result) { if (lastLocation) { - ts.Debug.assert(lastLocation.kind === 305 /* SyntaxKind.SourceFile */); + ts.Debug.assert(lastLocation.kind === 308 /* SyntaxKind.SourceFile */); if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) { return lastLocation.symbol; } @@ -50460,8 +51017,8 @@ var ts; !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && + !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && - !checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) { var suggestion = void 0; var suggestedLib = void 0; @@ -50502,7 +51059,7 @@ var ts; } return undefined; } - else if (checkAndReportErrorForInvalidInitializer()) { + else if (nameNotFoundMessage && checkAndReportErrorForInvalidInitializer()) { return undefined; } // Perform extra checks only if error reporting was requested @@ -50548,9 +51105,9 @@ var ts; } } if (result && errorLocation && meaning & 111551 /* SymbolFlags.Value */ && result.flags & 2097152 /* SymbolFlags.Alias */ && !(result.flags & 111551 /* SymbolFlags.Value */) && !ts.isValidTypeOnlyAliasUseSite(errorLocation)) { - var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result); + var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(result, 111551 /* SymbolFlags.Value */); if (typeOnlyDeclaration) { - var message = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ + var message = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_exported_using_export_type : ts.Diagnostics._0_cannot_be_used_as_a_value_because_it_was_imported_using_import_type; var unescapedName = ts.unescapeLeadingUnderscores(name); @@ -50564,31 +51121,31 @@ var ts; function addTypeOnlyDeclarationRelatedInfo(diagnostic, typeOnlyDeclaration, unescapedName) { if (!typeOnlyDeclaration) return diagnostic; - return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); + return ts.addRelatedInfo(diagnostic, ts.createDiagnosticForNode(typeOnlyDeclaration, typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics._0_was_exported_here : ts.Diagnostics._0_was_imported_here, unescapedName)); } function getIsDeferredContext(location, lastLocation) { - if (location.kind !== 214 /* SyntaxKind.ArrowFunction */ && location.kind !== 213 /* SyntaxKind.FunctionExpression */) { + if (location.kind !== 216 /* SyntaxKind.ArrowFunction */ && location.kind !== 215 /* SyntaxKind.FunctionExpression */) { // initializers in instance property declaration of class like entities are executed in constructor and thus deferred return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) || - (location.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred + (location.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(location))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred } if (lastLocation && lastLocation === location.name) { return false; } // generator functions and async functions are not inlined in control flow when immediately invoked - if (location.asteriskToken || ts.hasSyntacticModifier(location, 256 /* ModifierFlags.Async */)) { + if (location.asteriskToken || ts.hasSyntacticModifier(location, 512 /* ModifierFlags.Async */)) { return true; } return !ts.getImmediatelyInvokedFunctionExpression(location); } function isSelfReferenceLocation(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // For `namespace N { N; }` return true; default: return false; @@ -50601,7 +51158,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var decl = _a[_i]; - if (decl.kind === 163 /* SyntaxKind.TypeParameter */) { + if (decl.kind === 165 /* SyntaxKind.TypeParameter */) { var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent; if (parent === container) { return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); @@ -50658,9 +51215,9 @@ var ts; function getEntityNameForExtendingInterface(node) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: if (ts.isEntityNameExpression(node.expression)) { return node.expression; } @@ -50704,14 +51261,14 @@ var ts; return name === "any" || name === "string" || name === "number" || name === "boolean" || name === "never" || name === "unknown"; } function checkAndReportErrorForExportingPrimitiveType(errorLocation, name) { - if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + if (isPrimitiveTypeName(name) && errorLocation.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { error(errorLocation, ts.Diagnostics.Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module, name); return true; } return false; } function checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) { - if (meaning & (111551 /* SymbolFlags.Value */ & ~1024 /* SymbolFlags.NamespaceModule */)) { + if (meaning & 111551 /* SymbolFlags.Value */) { if (isPrimitiveTypeName(name)) { if (isExtendedByInterface(errorLocation)) { error(errorLocation, ts.Diagnostics.An_interface_cannot_extend_a_primitive_type_like_0_an_interface_can_only_extend_named_types_and_classes, ts.unescapeLeadingUnderscores(name)); @@ -50722,7 +51279,8 @@ var ts; return true; } var symbol = resolveSymbol(resolveName(errorLocation, name, 788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); - if (symbol && !(symbol.flags & 1024 /* SymbolFlags.NamespaceModule */)) { + var allFlags = symbol && getAllSymbolFlags(symbol); + if (symbol && allFlags !== undefined && !(allFlags & 111551 /* SymbolFlags.Value */)) { var rawName = ts.unescapeLeadingUnderscores(name); if (isES2015OrLaterConstructorName(name)) { error(errorLocation, ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later, rawName); @@ -50770,16 +51328,16 @@ var ts; } return false; } - function checkAndReportErrorForUsingNamespaceModuleAsValue(errorLocation, name, meaning) { - if (meaning & (111551 /* SymbolFlags.Value */ & ~1024 /* SymbolFlags.NamespaceModule */ & ~788968 /* SymbolFlags.Type */)) { - var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */ & ~111551 /* SymbolFlags.Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); + function checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) { + if (meaning & (111551 /* SymbolFlags.Value */ & ~788968 /* SymbolFlags.Type */)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1024 /* SymbolFlags.NamespaceModule */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); if (symbol) { error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_value, ts.unescapeLeadingUnderscores(name)); return true; } } - else if (meaning & (788968 /* SymbolFlags.Type */ & ~1024 /* SymbolFlags.NamespaceModule */ & ~111551 /* SymbolFlags.Value */)) { - var symbol = resolveSymbol(resolveName(errorLocation, name, (512 /* SymbolFlags.ValueModule */ | 1024 /* SymbolFlags.NamespaceModule */) & ~788968 /* SymbolFlags.Type */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); + else if (meaning & (788968 /* SymbolFlags.Type */ & ~111551 /* SymbolFlags.Value */)) { + var symbol = resolveSymbol(resolveName(errorLocation, name, 1536 /* SymbolFlags.Module */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)); if (symbol) { error(errorLocation, ts.Diagnostics.Cannot_use_namespace_0_as_a_type, ts.unescapeLeadingUnderscores(name)); return true; @@ -50795,7 +51353,7 @@ var ts; return; } // Block-scoped variables cannot be used before their definition - var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 260 /* SyntaxKind.EnumDeclaration */); }); + var declaration = (_a = result.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 263 /* SyntaxKind.EnumDeclaration */); }); if (declaration === undefined) return ts.Debug.fail("checkResolvedBlockScopedVariable could not find block-scoped declaration"); if (!(declaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) { @@ -50832,13 +51390,13 @@ var ts; } function getAnyImportSyntax(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return node; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return node.parent; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent; default: return undefined; @@ -50863,24 +51421,24 @@ var ts; * const { x } = require ... */ function isAliasSymbolDeclaration(node) { - return node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ - || node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ - || node.kind === 267 /* SyntaxKind.ImportClause */ && !!node.name - || node.kind === 268 /* SyntaxKind.NamespaceImport */ - || node.kind === 274 /* SyntaxKind.NamespaceExport */ - || node.kind === 270 /* SyntaxKind.ImportSpecifier */ - || node.kind === 275 /* SyntaxKind.ExportSpecifier */ - || node.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) + return node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ + || node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ + || node.kind === 270 /* SyntaxKind.ImportClause */ && !!node.name + || node.kind === 271 /* SyntaxKind.NamespaceImport */ + || node.kind === 277 /* SyntaxKind.NamespaceExport */ + || node.kind === 273 /* SyntaxKind.ImportSpecifier */ + || node.kind === 278 /* SyntaxKind.ExportSpecifier */ + || node.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.exportAssignmentIsAlias(node) || ts.isBinaryExpression(node) && ts.getAssignmentDeclarationKind(node) === 2 /* AssignmentDeclarationKind.ModuleExports */ && ts.exportAssignmentIsAlias(node) || ts.isAccessExpression(node) && ts.isBinaryExpression(node.parent) && node.parent.left === node && node.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && isAliasableOrJsExpression(node.parent.right) - || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ - || node.kind === 296 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) - || node.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) - || node.kind === 203 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); + || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ + || node.kind === 299 /* SyntaxKind.PropertyAssignment */ && isAliasableOrJsExpression(node.initializer) + || node.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node) + || node.kind === 205 /* SyntaxKind.BindingElement */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.parent.parent); } function isAliasableOrJsExpression(e) { return ts.isAliasableExpression(e) || ts.isFunctionExpression(e) && isJSConstructor(e); @@ -50893,7 +51451,7 @@ var ts; ? resolveSymbol(getPropertyOfType(resolveExternalModuleTypeByLiteral(name), commonJSPropertyAccess.name.escapedText)) : undefined; } - if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (ts.isVariableDeclaration(node) || node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { var immediate = resolveExternalModuleName(node, ts.getExternalModuleRequireArgument(node) || ts.getExternalModuleImportEqualsDeclarationExpression(node)); var resolved_4 = resolveExternalModuleSymbol(immediate); markSymbolOfAliasDeclarationIfTypeOnly(node, immediate, resolved_4, /*overwriteEmpty*/ false); @@ -50906,7 +51464,7 @@ var ts; function checkAndReportErrorForResolvingImportAliasToTypeOnlySymbol(node, resolved) { if (markSymbolOfAliasDeclarationIfTypeOnly(node, /*immediateTarget*/ undefined, resolved, /*overwriteEmpty*/ false) && !node.isTypeOnly) { var typeOnlyDeclaration = getTypeOnlyAliasDeclaration(getSymbolOfNode(node)); - var isExport = typeOnlyDeclaration.kind === 275 /* SyntaxKind.ExportSpecifier */; + var isExport = typeOnlyDeclaration.kind === 278 /* SyntaxKind.ExportSpecifier */; var message = isExport ? ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type : ts.Diagnostics.An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type; @@ -50925,7 +51483,7 @@ var ts; return resolved; } function isSyntacticDefault(node) { - return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); + return ((ts.isExportAssignment(node) && !node.isExportEquals) || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) || ts.isExportSpecifier(node)); } function getUsageModeForExpression(usage) { return ts.isStringLiteralLike(usage) ? ts.getModeForUsageLocation(ts.getSourceFileOfNode(usage), usage) : undefined; @@ -51025,11 +51583,11 @@ var ts; } function getModuleSpecifierForImportOrExport(node) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; - case 268 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; - case 270 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; - case 275 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; + case 270 /* SyntaxKind.ImportClause */: return node.parent.moduleSpecifier; + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return ts.isExternalModuleReference(node.moduleReference) ? node.moduleReference.expression : undefined; + case 271 /* SyntaxKind.NamespaceImport */: return node.parent.parent.moduleSpecifier; + case 273 /* SyntaxKind.ImportSpecifier */: return node.parent.parent.parent.moduleSpecifier; + case 278 /* SyntaxKind.ExportSpecifier */: return node.parent.parent.moduleSpecifier; default: return ts.Debug.assertNever(node); } } @@ -51298,31 +51856,31 @@ var ts; function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; } switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return getTargetOfImportClause(node, dontRecursivelyResolve); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return getTargetOfNamespaceImport(node, dontRecursivelyResolve); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return getTargetOfNamespaceExport(node, dontRecursivelyResolve); - case 270 /* SyntaxKind.ImportSpecifier */: - case 203 /* SyntaxKind.BindingElement */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 205 /* SyntaxKind.BindingElement */: return getTargetOfImportSpecifier(node, dontRecursivelyResolve); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return getTargetOfExportSpecifier(node, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, dontRecursivelyResolve); - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: return getTargetOfExportAssignment(node, dontRecursivelyResolve); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return resolveEntityName(node.name, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ true, dontRecursivelyResolve); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getTargetOfAliasLikeExpression(node.initializer, dontRecursivelyResolve); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return getTargetOfAccessExpression(node, dontRecursivelyResolve); default: return ts.Debug.fail(); @@ -51369,6 +51927,52 @@ var ts; } return undefined; } + /** + * Gets combined flags of a `symbol` and all alias targets it resolves to. `resolveAlias` + * is typically recursive over chains of aliases, but stops mid-chain if an alias is merged + * with another exported symbol, e.g. + * ```ts + * // a.ts + * export const a = 0; + * // b.ts + * export { a } from "./a"; + * export type a = number; + * // c.ts + * import { a } from "./b"; + * ``` + * Calling `resolveAlias` on the `a` in c.ts would stop at the merged symbol exported + * from b.ts, even though there is still more alias to resolve. Consequently, if we were + * trying to determine if the `a` in c.ts has a value meaning, looking at the flags on + * the local symbol and on the symbol returned by `resolveAlias` is not enough. + * @returns SymbolFlags.All if `symbol` is an alias that ultimately resolves to `unknown`; + * combined flags of all alias targets otherwise. + */ + function getAllSymbolFlags(symbol) { + var flags = symbol.flags; + var seenSymbols; + while (symbol.flags & 2097152 /* SymbolFlags.Alias */) { + var target = resolveAlias(symbol); + if (target === unknownSymbol) { + return 67108863 /* SymbolFlags.All */; + } + // Optimizations - try to avoid creating or adding to + // `seenSymbols` if possible + if (target === symbol || (seenSymbols === null || seenSymbols === void 0 ? void 0 : seenSymbols.has(target))) { + break; + } + if (target.flags & 2097152 /* SymbolFlags.Alias */) { + if (seenSymbols) { + seenSymbols.add(target); + } + else { + seenSymbols = new ts.Set([symbol, target]); + } + } + flags |= target.flags; + symbol = target; + } + return flags; + } /** * Marks a symbol as type-only if its declaration is syntactically type-only. * If it is not itself marked type-only, but resolves to a type-only alias @@ -51414,19 +52018,25 @@ var ts; return !!aliasDeclarationLinks.typeOnlyDeclaration; } /** Indicates that a symbol directly or indirectly resolves to a type-only import or export. */ - function getTypeOnlyAliasDeclaration(symbol) { + function getTypeOnlyAliasDeclaration(symbol, include) { if (!(symbol.flags & 2097152 /* SymbolFlags.Alias */)) { return undefined; } var links = getSymbolLinks(symbol); - return links.typeOnlyDeclaration || undefined; + if (include === undefined) { + return links.typeOnlyDeclaration || undefined; + } + if (links.typeOnlyDeclaration) { + return getAllSymbolFlags(resolveAlias(links.typeOnlyDeclaration.symbol)) & include ? links.typeOnlyDeclaration : undefined; + } + return undefined; } function markExportAsReferenced(node) { var symbol = getSymbolOfNode(node); var target = resolveAlias(symbol); if (target) { var markAlias = target === unknownSymbol || - ((target.flags & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol)); + ((getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) && !isConstEnumOrConstEnumOnlyModule(target) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)); if (markAlias) { markAliasSymbolAsReferenced(symbol); } @@ -51446,8 +52056,7 @@ var ts; // This way a chain of imports can be elided if ultimately the final input is only used in a type // position. if (ts.isInternalModuleImportEqualsDeclaration(node)) { - var target = resolveSymbol(symbol); - if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(resolveSymbol(symbol)) & 111551 /* SymbolFlags.Value */) { // import foo = checkExpressionCached(node.moduleReference); } @@ -51474,18 +52083,18 @@ var ts; entityName = entityName.parent; } // Check for case 1 and 3 in the above example - if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + if (entityName.kind === 79 /* SyntaxKind.Identifier */ || entityName.parent.kind === 163 /* SyntaxKind.QualifiedName */) { return resolveEntityName(entityName, 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } else { // Case 2 in above example // entityName.kind could be a QualifiedName or a Missing identifier - ts.Debug.assert(entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */); + ts.Debug.assert(entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */); return resolveEntityName(entityName, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */, /*ignoreErrors*/ false, dontResolveAlias); } } function getFullyQualifiedName(symbol, containingLocation) { - return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); + return symbol.parent ? getFullyQualifiedName(symbol.parent, containingLocation) + "." + symbolToString(symbol) : symbolToString(symbol, containingLocation, /*meaning*/ undefined, 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */ | 4 /* SymbolFormatFlags.AllowAnyNodeKind */); } function getContainingQualifiedNameNode(node) { while (ts.isQualifiedName(node.parent)) { @@ -51526,9 +52135,9 @@ var ts; return getMergedSymbol(symbolFromJSPrototype); } } - else if (name.kind === 161 /* SyntaxKind.QualifiedName */ || name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { - var left = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; - var right = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : name.name; + else if (name.kind === 163 /* SyntaxKind.QualifiedName */ || name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { + var left = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.left : name.expression; + var right = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : name.name; var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location); if (!namespace || ts.nodeIsMissing(right)) { return undefined; @@ -51586,7 +52195,7 @@ var ts; throw ts.Debug.assertNever(name, "Unknown entity name kind."); } ts.Debug.assert((ts.getCheckFlags(symbol) & 1 /* CheckFlags.Instantiated */) === 0, "Should never get an instantiated symbol here."); - if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 271 /* SyntaxKind.ExportAssignment */)) { + if (!ts.nodeIsSynthesized(name) && ts.isEntityName(name) && (symbol.flags & 2097152 /* SymbolFlags.Alias */ || name.parent.kind === 274 /* SyntaxKind.ExportAssignment */)) { markSymbolOfAliasDeclarationIfTypeOnly(ts.getAliasDeclarationFromName(name), symbol, /*finalTarget*/ undefined, /*overwriteEmpty*/ true); } return (symbol.flags & meaning) || dontResolveAlias ? symbol : resolveAlias(symbol); @@ -51909,7 +52518,7 @@ var ts; var _a; var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias); if (!dontResolveAlias && symbol) { - if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */)) { + if (!suppressInteropError && !(symbol.flags & (1536 /* SymbolFlags.Module */ | 3 /* SymbolFlags.Variable */)) && !ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */)) { var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop"; @@ -52269,13 +52878,13 @@ var ts; } function symbolIsValue(symbol, includeTypeOnlyMembers) { return !!(symbol.flags & 111551 /* SymbolFlags.Value */ || - symbol.flags & 2097152 /* SymbolFlags.Alias */ && resolveAlias(symbol).flags & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol))); + symbol.flags & 2097152 /* SymbolFlags.Alias */ && getAllSymbolFlags(symbol) & 111551 /* SymbolFlags.Value */ && (includeTypeOnlyMembers || !getTypeOnlyAliasDeclaration(symbol))); } function findConstructorDeclaration(node) { var members = node.members; for (var _i = 0, members_3 = members; _i < members_3.length; _i++) { var member = members_3[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { + if (member.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(member.body)) { return member; } } @@ -52383,12 +52992,12 @@ var ts; } } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalOrCommonJsModule(location)) { break; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: var sym = getSymbolOfNode(location); // `sym` may not have exports if this module declaration is backed by the symbol for a `const` that's being rewritten // into a namespace - in such cases, it's best to just let the namespace appear empty (the const members couldn't have referred @@ -52397,9 +53006,9 @@ var ts; return { value: result }; } break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // Type parameters are bound into `members` lists so they can merge across declarations // This is troublesome, since in all other respects, they behave like locals :cries: // TODO: the below is shared with similar code in `resolveName` - in fact, rephrasing all this symbol @@ -52494,7 +53103,7 @@ var ts; && (isLocalNameLookup ? !ts.some(symbolFromSymbolTable.declarations, ts.isNamespaceReexportDeclaration) : true) // While exports are generally considered to be in scope, export-specifier declared symbols are _not_ // See similar comment in `resolveName` for details - && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */))) { + && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */))) { var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable); var candidate = getCandidateListForSymbol(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification); if (candidate) { @@ -52538,8 +53147,10 @@ var ts; return true; } // Qualify if the symbol from symbol table has same meaning as expected - symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 275 /* SyntaxKind.ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; - if (symbolFromSymbolTable.flags & meaning) { + var shouldResolveAlias = (symbolFromSymbolTable.flags & 2097152 /* SymbolFlags.Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 278 /* SyntaxKind.ExportSpecifier */)); + symbolFromSymbolTable = shouldResolveAlias ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable; + var flags = shouldResolveAlias ? getAllSymbolFlags(symbolFromSymbolTable) : symbolFromSymbolTable.flags; + if (flags & meaning) { qualify = true; return true; } @@ -52553,10 +53164,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: continue; default: return false; @@ -52686,10 +53297,10 @@ var ts; return node && getSymbolOfNode(node); } function hasExternalModuleSymbol(declaration) { - return ts.isAmbientModule(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isAmbientModule(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasNonGlobalAugmentationExternalModuleSymbol(declaration) { - return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); + return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(declaration)); } function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) { var aliasesToMakeVisible; @@ -52757,14 +53368,14 @@ var ts; function isEntityNameVisible(entityName, enclosingDeclaration) { // get symbol of the first identifier of the entityName var meaning; - if (entityName.parent.kind === 181 /* SyntaxKind.TypeQuery */ || - entityName.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || - entityName.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (entityName.parent.kind === 183 /* SyntaxKind.TypeQuery */ || + entityName.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && !ts.isPartOfTypeNode(entityName.parent) || + entityName.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // Typeof value meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } - else if (entityName.kind === 161 /* SyntaxKind.QualifiedName */ || entityName.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - entityName.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + else if (entityName.kind === 163 /* SyntaxKind.QualifiedName */ || entityName.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + entityName.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { // Left identifier from type reference or TypeAlias // Entity name of the import declaration meaning = 1920 /* SymbolFlags.Namespace */; @@ -52800,15 +53411,18 @@ var ts; if (flags & 8 /* SymbolFormatFlags.UseAliasDefinedOutsideCurrentScope */) { nodeFlags |= 16384 /* NodeBuilderFlags.UseAliasDefinedOutsideCurrentScope */; } - if (flags & 16 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { + if (flags & 32 /* SymbolFormatFlags.DoNotIncludeSymbolChain */) { nodeFlags |= 134217728 /* NodeBuilderFlags.DoNotIncludeSymbolChain */; } - var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToExpression : nodeBuilder.symbolToEntityName; + if (flags & 16 /* SymbolFormatFlags.WriteComputedProps */) { + nodeFlags |= 1073741824 /* NodeBuilderFlags.WriteComputedProps */; + } + var builder = flags & 4 /* SymbolFormatFlags.AllowAnyNodeKind */ ? nodeBuilder.symbolToNode : nodeBuilder.symbolToEntityName; return writer ? symbolToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(symbolToStringWorker); function symbolToStringWorker(writer) { var entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags); // TODO: GH#18217 // add neverAsciiEscape for GH#39027 - var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 305 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); + var printer = (enclosingDeclaration === null || enclosingDeclaration === void 0 ? void 0 : enclosingDeclaration.kind) === 308 /* SyntaxKind.SourceFile */ ? ts.createPrinter({ removeComments: true, neverAsciiEscape: true }) : ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); printer.writeNode(4 /* EmitHint.Unspecified */, entity, /*sourceFile*/ sourceFile, writer); return writer; @@ -52820,10 +53434,10 @@ var ts; function signatureToStringWorker(writer) { var sigOutput; if (flags & 262144 /* TypeFormatFlags.WriteArrowStyleSignature */) { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 180 /* SyntaxKind.ConstructorType */ : 179 /* SyntaxKind.FunctionType */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 182 /* SyntaxKind.ConstructorType */ : 181 /* SyntaxKind.FunctionType */; } else { - sigOutput = kind === 1 /* SignatureKind.Construct */ ? 175 /* SyntaxKind.ConstructSignature */ : 174 /* SyntaxKind.CallSignature */; + sigOutput = kind === 1 /* SignatureKind.Construct */ ? 177 /* SyntaxKind.ConstructSignature */ : 176 /* SyntaxKind.CallSignature */; } var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */); var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true }); @@ -52903,7 +53517,25 @@ var ts; symbolTableToDeclarationStatements: function (symbolTable, enclosingDeclaration, flags, tracker, bundled) { return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolTableToDeclarationStatements(symbolTable, context, bundled); }); }, + symbolToNode: function (symbol, meaning, enclosingDeclaration, flags, tracker) { + return withContext(enclosingDeclaration, flags, tracker, function (context) { return symbolToNode(symbol, context, meaning); }); + }, }; + function symbolToNode(symbol, context, meaning) { + if (context.flags & 1073741824 /* NodeBuilderFlags.WriteComputedProps */) { + if (symbol.valueDeclaration) { + var name = ts.getNameOfDeclaration(symbol.valueDeclaration); + if (name && ts.isComputedPropertyName(name)) + return name; + } + var nameType = getSymbolLinks(symbol).nameType; + if (nameType && nameType.flags & (1024 /* TypeFlags.EnumLiteral */ | 8192 /* TypeFlags.UniqueESSymbol */)) { + context.enclosingDeclaration = nameType.symbol.valueDeclaration; + return ts.factory.createComputedPropertyName(symbolToExpression(nameType.symbol, context, meaning)); + } + } + return symbolToExpression(symbol, context, meaning); + } function withContext(enclosingDeclaration, flags, tracker, cb) { var _a, _b; ts.Debug.assert(enclosingDeclaration === undefined || (enclosingDeclaration.flags & 8 /* NodeFlags.Synthesized */) === 0); @@ -52988,7 +53620,7 @@ var ts; return undefined; // TODO: GH#18217 } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (!(context.flags & 536870912 /* NodeBuilderFlags.NoTypeReduction */)) { type = getReducedType(type); @@ -52998,29 +53630,29 @@ var ts; return ts.factory.createTypeReferenceNode(symbolToEntityNameNode(type.aliasSymbol), mapToTypeNodes(type.aliasTypeArguments, context)); } if (type === unresolvedType) { - return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); + return ts.addSyntheticLeadingComment(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), 3 /* SyntaxKind.MultiLineCommentTrivia */, "unresolved"); } context.approximateLength += 3; - return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 138 /* SyntaxKind.IntrinsicKeyword */ : 130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(type === intrinsicMarkerType ? 139 /* SyntaxKind.IntrinsicKeyword */ : 131 /* SyntaxKind.AnyKeyword */); } if (type.flags & 2 /* TypeFlags.Unknown */) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (type.flags & 4 /* TypeFlags.String */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(150 /* SyntaxKind.StringKeyword */); + return ts.factory.createKeywordTypeNode(152 /* SyntaxKind.StringKeyword */); } if (type.flags & 8 /* TypeFlags.Number */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(147 /* SyntaxKind.NumberKeyword */); + return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.NumberKeyword */); } if (type.flags & 64 /* TypeFlags.BigInt */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(158 /* SyntaxKind.BigIntKeyword */); + return ts.factory.createKeywordTypeNode(160 /* SyntaxKind.BigIntKeyword */); } if (type.flags & 16 /* TypeFlags.Boolean */ && !type.aliasSymbol) { context.approximateLength += 7; - return ts.factory.createKeywordTypeNode(133 /* SyntaxKind.BooleanKeyword */); + return ts.factory.createKeywordTypeNode(134 /* SyntaxKind.BooleanKeyword */); } if (type.flags & 1024 /* TypeFlags.EnumLiteral */ && !(type.flags & 1048576 /* TypeFlags.Union */)) { var parentSymbol = getParentOfSymbol(type.symbol); @@ -53074,7 +53706,7 @@ var ts; } } context.approximateLength += 13; - return ts.factory.createTypeOperatorNode(154 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */)); + return ts.factory.createTypeOperatorNode(156 /* SyntaxKind.UniqueKeyword */, ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */)); } if (type.flags & 16384 /* TypeFlags.Void */) { context.approximateLength += 4; @@ -53082,7 +53714,7 @@ var ts; } if (type.flags & 32768 /* TypeFlags.Undefined */) { context.approximateLength += 9; - return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */); + return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */); } if (type.flags & 65536 /* TypeFlags.Null */) { context.approximateLength += 4; @@ -53090,15 +53722,15 @@ var ts; } if (type.flags & 131072 /* TypeFlags.Never */) { context.approximateLength += 5; - return ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */); + return ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */); } if (type.flags & 4096 /* TypeFlags.ESSymbol */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(151 /* SyntaxKind.SymbolKeyword */); + return ts.factory.createKeywordTypeNode(153 /* SyntaxKind.SymbolKeyword */); } if (type.flags & 67108864 /* TypeFlags.NonPrimitive */) { context.approximateLength += 6; - return ts.factory.createKeywordTypeNode(148 /* SyntaxKind.ObjectKeyword */); + return ts.factory.createKeywordTypeNode(149 /* SyntaxKind.ObjectKeyword */); } if (ts.isThisTypeParameter(type)) { if (context.flags & 4194304 /* NodeBuilderFlags.InObjectTypeLiteral */) { @@ -53187,7 +53819,7 @@ var ts; var indexedType = type.type; context.approximateLength += 6; var indexTypeNode = typeToTypeNodeHelper(indexedType, context); - return ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); + return ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, indexTypeNode); } if (type.flags & 134217728 /* TypeFlags.TemplateLiteral */) { var texts_1 = type.texts; @@ -53239,7 +53871,7 @@ var ts; // On the other hand, // checkType extends infer T extends checkType ? T extends extendsType ? trueType : falseType : never; // may also work with `infer ... extends ...` in, but would produce declarations only compatible with the latest TS. - return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(checkTypeNode, ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName))), ts.factory.createConditionalTypeNode(ts.factory.createTypeReferenceNode(ts.factory.cloneNode(name)), typeToTypeNodeHelper(type.checkType, context), ts.factory.createConditionalTypeNode(newTypeVariable, extendsTypeNode_1, trueTypeNode_1, falseTypeNode_1), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)), ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } var saveInferTypeParameters = context.inferTypeParameters; context.inferTypeParameters = type.root.inferTypeParameters; @@ -53281,7 +53913,7 @@ var ts; var name = typeParameterToName(newParam, context); newTypeVariable = ts.factory.createTypeReferenceNode(name); } - appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(140 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); + appropriateConstraintTypeNode = ts.factory.createTypeOperatorNode(141 /* SyntaxKind.KeyOfKeyword */, newTypeVariable || typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context)); } else { appropriateConstraintTypeNode = typeToTypeNodeHelper(getConstraintTypeFromMappedType(type), context); @@ -53297,7 +53929,7 @@ var ts; // wrap it with a conditional like `SomeModifiersType extends infer U ? {..the mapped type...} : never` to ensure the resulting // type stays homomorphic var originalConstraint = instantiateType(getConstraintOfTypeParameter(getTypeFromTypeNode(type.declaration.typeParameter.constraint.type)) || unknownType, type.mapper); - return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(143 /* SyntaxKind.NeverKeyword */)); + return ts.factory.createConditionalTypeNode(typeToTypeNodeHelper(getModifiersTypeFromMappedType(type), context), ts.factory.createInferTypeNode(ts.factory.createTypeParameterDeclaration(/*modifiers*/ undefined, ts.factory.cloneNode(newTypeVariable.typeName), originalConstraint.flags & 2 /* TypeFlags.Unknown */ ? undefined : typeToTypeNodeHelper(originalConstraint, context))), result, ts.factory.createKeywordTypeNode(144 /* SyntaxKind.NeverKeyword */)); } return result; } @@ -53345,7 +53977,7 @@ var ts; var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* SymbolFlags.Function */) && (symbol.parent || // is exported function symbol ts.forEach(symbol.declarations, function (declaration) { - return declaration.parent.kind === 305 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 262 /* SyntaxKind.ModuleBlock */; + return declaration.parent.kind === 308 /* SyntaxKind.SourceFile */ || declaration.parent.kind === 265 /* SyntaxKind.ModuleBlock */; })); if (isStaticMethodSymbol || isNonLocalFunctionSymbol) { // typeof is allowed only for static/non local functions @@ -53434,12 +54066,12 @@ var ts; } if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) { var signature = resolved.callSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 179 /* SyntaxKind.FunctionType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 181 /* SyntaxKind.FunctionType */, context); return signatureNode; } if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) { var signature = resolved.constructSignatures[0]; - var signatureNode = signatureToSignatureDeclarationHelper(signature, 180 /* SyntaxKind.ConstructorType */, context); + var signatureNode = signatureToSignatureDeclarationHelper(signature, 182 /* SyntaxKind.ConstructorType */, context); return signatureNode; } } @@ -53482,7 +54114,7 @@ var ts; } var elementType = typeToTypeNodeHelper(typeArguments[0], context); var arrayType = ts.factory.createArrayTypeNode(elementType); - return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, arrayType); + return type.target === globalArrayType ? arrayType : ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, arrayType); } else if (type.target.objectFlags & 8 /* ObjectFlags.Tuple */) { typeArguments = ts.sameMap(typeArguments, function (t, i) { return removeMissingType(t, !!(type.target.elementFlags[i] & 2 /* ElementFlags.Optional */)); }); @@ -53507,12 +54139,12 @@ var ts; } } var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode(tupleConstituentNodes), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } } if (context.encounteredError || (context.flags & 524288 /* NodeBuilderFlags.AllowEmptyTuple */)) { var tupleTypeNode = ts.setEmitFlags(ts.factory.createTupleTypeNode([]), 1 /* EmitFlags.SingleLine */); - return type.target.readonly ? ts.factory.createTypeOperatorNode(145 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; + return type.target.readonly ? ts.factory.createTypeOperatorNode(146 /* SyntaxKind.ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode; } context.encounteredError = true; return undefined; // TODO: GH#18217 @@ -53619,13 +54251,13 @@ var ts; var typeElements = []; for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) { var signature = _a[_i]; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 174 /* SyntaxKind.CallSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 176 /* SyntaxKind.CallSignature */, context)); } for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) { var signature = _c[_b]; if (signature.flags & 4 /* SignatureFlags.Abstract */) continue; - typeElements.push(signatureToSignatureDeclarationHelper(signature, 175 /* SyntaxKind.ConstructSignature */, context)); + typeElements.push(signatureToSignatureDeclarationHelper(signature, 177 /* SyntaxKind.ConstructSignature */, context)); } for (var _d = 0, _e = resolvedType.indexInfos; _d < _e.length; _d++) { var info = _e[_d]; @@ -53662,7 +54294,7 @@ var ts; if (!(context.flags & 1 /* NodeBuilderFlags.NoTruncation */)) { return ts.factory.createTypeReferenceNode(ts.factory.createIdentifier("..."), /*typeArguments*/ undefined); } - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } function shouldUsePlaceholderForProperty(propertySymbol, context) { var _a; @@ -53712,7 +54344,7 @@ var ts; var signatures = getSignaturesOfType(filterType(propertyType, function (t) { return !(t.flags & 32768 /* TypeFlags.Undefined */); }), 0 /* SignatureKind.Call */); for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) { var signature = signatures_1[_i]; - var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 168 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); + var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 170 /* SyntaxKind.MethodSignature */, context, { name: propertyName, questionToken: optionalToken }); typeElements.push(preserveCommentsOn(methodDeclaration)); } } @@ -53726,12 +54358,12 @@ var ts; context.reverseMappedStack || (context.reverseMappedStack = []); context.reverseMappedStack.push(propertySymbol); } - propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); if (propertyIsReverseMapped) { context.reverseMappedStack.pop(); } } - var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined; + var modifiers = isReadonlySymbol(propertySymbol) ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined; if (modifiers) { context.approximateLength += 9; } @@ -53740,8 +54372,8 @@ var ts; } function preserveCommentsOn(node) { var _a; - if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; })) { - var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 347 /* SyntaxKind.JSDocPropertyTag */; }); + if (ts.some(propertySymbol.declarations, function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; })) { + var d = (_a = propertySymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return d.kind === 350 /* SyntaxKind.JSDocPropertyTag */; }); var commentText = ts.getTextOfJSDocComment(d.comment); if (commentText) { ts.setSyntheticLeadingComments(node, [{ kind: 3 /* SyntaxKind.MultiLineCommentTrivia */, text: "*\n * " + commentText.replace(/\n/g, "\n * ") + "\n ", pos: -1, end: -1, hasTrailingNewLine: true }]); @@ -53840,7 +54472,7 @@ var ts; context.encounteredError = true; } context.approximateLength += (name.length + 4); - return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(145 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); + return ts.factory.createIndexSignature(indexInfo.isReadonly ? [ts.factory.createToken(146 /* SyntaxKind.ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode); } function signatureToSignatureDeclarationHelper(signature, kind, context, options) { var _a, _b, _c, _d; @@ -53858,7 +54490,7 @@ var ts; } var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0]; // If the expanded parameter list had a variadic in a non-trailing position, don't expand it - var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 171 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); + var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* CheckFlags.RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 173 /* SyntaxKind.Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); }); var thisParameter = context.flags & 33554432 /* NodeBuilderFlags.OmitThisParameter */ ? undefined : tryGetThisParameterDeclaration(signature, context); if (thisParameter) { parameters.unshift(thisParameter); @@ -53867,7 +54499,7 @@ var ts; var typePredicate = getTypePredicateOfSignature(signature); if (typePredicate) { var assertsModifier = typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? - ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : + ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined; var parameterName = typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.setEmitFlags(ts.factory.createIdentifier(typePredicate.parameterName), 16777216 /* EmitFlags.NoAsciiEscaping */) : @@ -53881,28 +54513,28 @@ var ts; returnTypeNode = serializeReturnTypeForSignature(context, returnType, signature, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); } else if (!suppressAny) { - returnTypeNode = ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + returnTypeNode = ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } var modifiers = options === null || options === void 0 ? void 0 : options.modifiers; - if ((kind === 180 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { + if ((kind === 182 /* SyntaxKind.ConstructorType */) && signature.flags & 4 /* SignatureFlags.Abstract */) { var flags = ts.modifiersToFlags(modifiers); - modifiers = ts.factory.createModifiersFromModifierFlags(flags | 128 /* ModifierFlags.Abstract */); - } - var node = kind === 174 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : - kind === 175 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : - kind === 168 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : - kind === 169 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 171 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : - kind === 172 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : - kind === 173 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : - kind === 176 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : - kind === 317 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : - kind === 179 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 180 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : - kind === 256 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : - kind === 213 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : - kind === 214 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : + modifiers = ts.factory.createModifiersFromModifierFlags(flags | 256 /* ModifierFlags.Abstract */); + } + var node = kind === 176 /* SyntaxKind.CallSignature */ ? ts.factory.createCallSignature(typeParameters, parameters, returnTypeNode) : + kind === 177 /* SyntaxKind.ConstructSignature */ ? ts.factory.createConstructSignature(typeParameters, parameters, returnTypeNode) : + kind === 170 /* SyntaxKind.MethodSignature */ ? ts.factory.createMethodSignature(modifiers, (_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : ts.factory.createIdentifier(""), options === null || options === void 0 ? void 0 : options.questionToken, typeParameters, parameters, returnTypeNode) : + kind === 171 /* SyntaxKind.MethodDeclaration */ ? ts.factory.createMethodDeclaration(modifiers, /*asteriskToken*/ undefined, (_b = options === null || options === void 0 ? void 0 : options.name) !== null && _b !== void 0 ? _b : ts.factory.createIdentifier(""), /*questionToken*/ undefined, typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 173 /* SyntaxKind.Constructor */ ? ts.factory.createConstructorDeclaration(modifiers, parameters, /*body*/ undefined) : + kind === 174 /* SyntaxKind.GetAccessor */ ? ts.factory.createGetAccessorDeclaration(modifiers, (_c = options === null || options === void 0 ? void 0 : options.name) !== null && _c !== void 0 ? _c : ts.factory.createIdentifier(""), parameters, returnTypeNode, /*body*/ undefined) : + kind === 175 /* SyntaxKind.SetAccessor */ ? ts.factory.createSetAccessorDeclaration(modifiers, (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : ts.factory.createIdentifier(""), parameters, /*body*/ undefined) : + kind === 178 /* SyntaxKind.IndexSignature */ ? ts.factory.createIndexSignature(modifiers, parameters, returnTypeNode) : + kind === 320 /* SyntaxKind.JSDocFunctionType */ ? ts.factory.createJSDocFunctionType(parameters, returnTypeNode) : + kind === 181 /* SyntaxKind.FunctionType */ ? ts.factory.createFunctionTypeNode(typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 182 /* SyntaxKind.ConstructorType */ ? ts.factory.createConstructorTypeNode(modifiers, typeParameters, parameters, returnTypeNode !== null && returnTypeNode !== void 0 ? returnTypeNode : ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(""))) : + kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.factory.createFunctionDeclaration(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, /*body*/ undefined) : + kind === 215 /* SyntaxKind.FunctionExpression */ ? ts.factory.createFunctionExpression(modifiers, /*asteriskToken*/ undefined, (options === null || options === void 0 ? void 0 : options.name) ? ts.cast(options.name, ts.isIdentifier) : ts.factory.createIdentifier(""), typeParameters, parameters, returnTypeNode, ts.factory.createBlock([])) : + kind === 216 /* SyntaxKind.ArrowFunction */ ? ts.factory.createArrowFunction(modifiers, typeParameters, parameters, returnTypeNode, /*equalsGreaterThanToken*/ undefined, ts.factory.createBlock([])) : ts.Debug.assertNever(kind); if (typeArguments) { node.typeArguments = ts.factory.createNodeArray(typeArguments); @@ -53939,9 +54571,9 @@ var ts; return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags, privateSymbolVisitor, bundledImports) { - var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 164 /* SyntaxKind.Parameter */); + var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 166 /* SyntaxKind.Parameter */); if (!parameterDeclaration && !ts.isTransientSymbol(parameterSymbol)) { - parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 340 /* SyntaxKind.JSDocParameterTag */); + parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 343 /* SyntaxKind.JSDocParameterTag */); } var parameterType = getTypeOfSymbol(parameterSymbol); if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) { @@ -53953,7 +54585,7 @@ var ts; var dotDotDotToken = isRest ? ts.factory.createToken(25 /* SyntaxKind.DotDotDotToken */) : undefined; var name = parameterDeclaration ? parameterDeclaration.name ? parameterDeclaration.name.kind === 79 /* SyntaxKind.Identifier */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name), 16777216 /* EmitFlags.NoAsciiEscaping */) : - parameterDeclaration.name.kind === 161 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : + parameterDeclaration.name.kind === 163 /* SyntaxKind.QualifiedName */ ? ts.setEmitFlags(ts.factory.cloneNode(parameterDeclaration.name.right), 16777216 /* EmitFlags.NoAsciiEscaping */) : cloneBindingName(parameterDeclaration.name) : ts.symbolName(parameterSymbol) : ts.symbolName(parameterSymbol); @@ -54117,11 +54749,11 @@ var ts; } function getSpecifierForModuleSymbol(symbol, context, overrideImportMode) { var _a; - var file = ts.getDeclarationOfKind(symbol, 305 /* SyntaxKind.SourceFile */); + var file = ts.getDeclarationOfKind(symbol, 308 /* SyntaxKind.SourceFile */); if (!file) { var equivalentFileSymbol = ts.firstDefined(symbol.declarations, function (d) { return getFileSymbolIfFileSymbolExportEqualsContainer(d, symbol); }); if (equivalentFileSymbol) { - file = ts.getDeclarationOfKind(equivalentFileSymbol, 305 /* SyntaxKind.SourceFile */); + file = ts.getDeclarationOfKind(equivalentFileSymbol, 308 /* SyntaxKind.SourceFile */); } } if (file && file.moduleName !== undefined) { @@ -54589,17 +55221,17 @@ var ts; return transformed === existing ? ts.setTextRange(ts.factory.cloneNode(existing), existing) : transformed; function visitExistingNodeTreeSymbols(node) { // We don't _actually_ support jsdoc namepath types, emit `any` instead - if (ts.isJSDocAllType(node) || node.kind === 319 /* SyntaxKind.JSDocNamepathType */) { - return ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + if (ts.isJSDocAllType(node) || node.kind === 322 /* SyntaxKind.JSDocNamepathType */) { + return ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } if (ts.isJSDocUnknownType(node)) { - return ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UnknownKeyword */); + return ts.factory.createKeywordTypeNode(157 /* SyntaxKind.UnknownKeyword */); } if (ts.isJSDocNullableType(node)) { return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createLiteralTypeNode(ts.factory.createNull())]); } if (ts.isJSDocOptionalType(node)) { - return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(153 /* SyntaxKind.UndefinedKeyword */)]); + return ts.factory.createUnionTypeNode([ts.visitNode(node.type, visitExistingNodeTreeSymbols), ts.factory.createKeywordTypeNode(155 /* SyntaxKind.UndefinedKeyword */)]); } if (ts.isJSDocNonNullableType(node)) { return ts.visitNode(node.type, visitExistingNodeTreeSymbols); @@ -54613,11 +55245,11 @@ var ts; var typeViaParent = getTypeOfPropertyOfType(getTypeFromTypeNode(node), name.escapedText); var overrideTypeNode = typeViaParent && t.typeExpression && getTypeFromTypeNode(t.typeExpression.type) !== typeViaParent ? typeToTypeNodeHelper(typeViaParent, context) : undefined; return ts.factory.createPropertySignature( - /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*modifiers*/ undefined, name, t.isBracketed || t.typeExpression && ts.isJSDocOptionalType(t.typeExpression.type) ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, overrideTypeNode || (t.typeExpression && ts.visitNode(t.typeExpression.type, visitExistingNodeTreeSymbols)) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); })); } if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "") { - return ts.setOriginalNode(ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */), node); + return ts.setOriginalNode(ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */), node); } if ((ts.isExpressionWithTypeArguments(node) || ts.isTypeReferenceNode(node)) && ts.isJSDocIndexSignature(node)) { return ts.factory.createTypeLiteralNode([ts.factory.createIndexSignature( @@ -54632,12 +55264,12 @@ var ts; return ts.factory.createConstructorTypeNode( /*modifiers*/ undefined, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } else { return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration( /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); } } if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */, /*ignoreErrors*/ true))) { @@ -54705,8 +55337,8 @@ var ts; } } function symbolTableToDeclarationStatements(symbolTable, context, bundled) { - var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 169 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); - var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 168 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); + var serializePropertySymbolForClass = makeSerializePropertySymbol(ts.factory.createPropertyDeclaration, 171 /* SyntaxKind.MethodDeclaration */, /*useAcessors*/ true); + var serializePropertySymbolForInterfaceWorker = makeSerializePropertySymbol(function (mods, name, question, type) { return ts.factory.createPropertySignature(mods, name, question, type); }, 170 /* SyntaxKind.MethodSignature */, /*useAcessors*/ false); // TODO: Use `setOriginalNode` on original declaration names where possible so these declarations see some kind of // declaration mapping // We save the enclosing declaration off here so it's not adjusted by well-meaning declaration @@ -54830,7 +55462,7 @@ var ts; // export {name} - look thru `statements` for `name`, and if all results can take an `export` modifier, do so and filter it var indices = ts.indicesOf(statements); var associatedIndices = ts.filter(indices, function (i) { return ts.nodeHasName(statements[i], e.name); }); - if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return canHaveExportModifier(statements[i]); })) { + if (ts.length(associatedIndices) && ts.every(associatedIndices, function (i) { return ts.canHaveExportModifier(statements[i]); })) { for (var _i = 0, associatedIndices_1 = associatedIndices; _i < associatedIndices_1.length; _i++) { var index_1 = associatedIndices_1[_i]; statements[index_1] = addExportModifier(statements[index_1]); @@ -54864,15 +55496,6 @@ var ts; } return statements; } - function canHaveExportModifier(node) { - return ts.isEnumDeclaration(node) || - ts.isVariableStatement(node) || - ts.isFunctionDeclaration(node) || - ts.isClassDeclaration(node) || - (ts.isModuleDeclaration(node) && !ts.isExternalModuleAugmentation(node) && !ts.isGlobalScopeAugmentation(node)) || - ts.isInterfaceDeclaration(node) || - isTypeDeclaration(node); - } function addExportModifier(node) { var flags = (ts.getEffectiveModifierFlags(node) | 1 /* ModifierFlags.Export */) & ~2 /* ModifierFlags.Ambient */; return ts.factory.updateModifiers(node, flags); @@ -54944,7 +55567,7 @@ var ts; if (needsPostExportDefault || needsExportDeclaration) { isPrivate = true; } - var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 512 /* ModifierFlags.Default */ : 0); + var modifierFlags = (!isPrivate ? 1 /* ModifierFlags.Export */ : 0) | (isDefault && !needsPostExportDefault ? 1024 /* ModifierFlags.Default */ : 0); var isConstMergedWithNS = symbol.flags & 1536 /* SymbolFlags.Module */ && symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 1 /* SymbolFlags.FunctionScopedVariable */ | 4 /* SymbolFlags.Property */) && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */; @@ -54961,6 +55584,7 @@ var ts; && symbol.escapedName !== "export=" /* InternalSymbolName.ExportEquals */ && !(symbol.flags & 4194304 /* SymbolFlags.Prototype */) && !(symbol.flags & 32 /* SymbolFlags.Class */) + && !(symbol.flags & 8192 /* SymbolFlags.Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) { if (propertyAsAlias) { var createdExport = serializeMaybeAliasAssignment(symbol); @@ -55118,7 +55742,7 @@ var ts; (ts.isJSDocTypeAlias(context.enclosingDeclaration) ? ts.getSourceFileOfNode(context.enclosingDeclaration) : context.enclosingDeclaration); if (additionalModifierFlags & 1 /* ModifierFlags.Export */ && enclosingDeclaration_1 && (isExportingScope(enclosingDeclaration_1) || ts.isModuleDeclaration(enclosingDeclaration_1)) && - canHaveExportModifier(node)) { + ts.canHaveExportModifier(node)) { // Classes, namespaces, variables, functions, interfaces, and types should all be `export`ed in a module context if not private newModifierFlags |= 1 /* ModifierFlags.Export */; } @@ -55128,8 +55752,8 @@ var ts; // Classes, namespaces, variables, enums, and functions all need `declare` modifiers to be valid in a declaration file top-level scope newModifierFlags |= 2 /* ModifierFlags.Ambient */; } - if ((additionalModifierFlags & 512 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { - newModifierFlags |= 512 /* ModifierFlags.Default */; + if ((additionalModifierFlags & 1024 /* ModifierFlags.Default */) && (ts.isClassDeclaration(node) || ts.isInterfaceDeclaration(node) || ts.isFunctionDeclaration(node))) { + newModifierFlags |= 1024 /* ModifierFlags.Default */; } if (newModifierFlags) { node = ts.factory.updateModifiers(node, newModifierFlags | ts.getEffectiveModifierFlags(node)); @@ -55163,8 +55787,8 @@ var ts; var baseTypes = getBaseTypes(interfaceType); var baseType = ts.length(baseTypes) ? getIntersectionType(baseTypes) : undefined; var members = ts.flatMap(getPropertiesOfType(interfaceType), function (p) { return serializePropertySymbolForInterface(p, baseType); }); - var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 174 /* SyntaxKind.CallSignature */); - var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 175 /* SyntaxKind.ConstructSignature */); + var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 176 /* SyntaxKind.CallSignature */); + var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 177 /* SyntaxKind.ConstructSignature */); var indexSignatures = serializeIndexSignatures(interfaceType, baseType); var heritageClauses = !ts.length(baseTypes) ? undefined : [ts.factory.createHeritageClause(94 /* SyntaxKind.ExtendsKeyword */, ts.mapDefined(baseTypes, function (b) { return trySerializeAsTypeReference(b, 111551 /* SymbolFlags.Value */); }))]; addResult(ts.factory.createInterfaceDeclaration( @@ -55174,7 +55798,7 @@ var ts; return !symbol.exports ? [] : ts.filter(ts.arrayFrom(symbol.exports.values()), isNamespaceMember); } function isTypeOnlyNamespace(symbol) { - return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(resolveSymbol(m).flags & 111551 /* SymbolFlags.Value */); }); + return ts.every(getNamespaceMembersForSerialization(symbol), function (m) { return !(getAllSymbolFlags(resolveSymbol(m)) & 111551 /* SymbolFlags.Value */); }); } function serializeModule(symbol, symbolName, modifierFlags) { var members = getNamespaceMembersForSerialization(symbol); @@ -55229,7 +55853,7 @@ var ts; for (var _i = 0, signatures_2 = signatures; _i < signatures_2.length; _i++) { var sig = signatures_2[_i]; // Each overload becomes a separate function declaration, in order - var decl = signatureToSignatureDeclarationHelper(sig, 256 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); + var decl = signatureToSignatureDeclarationHelper(sig, 259 /* SyntaxKind.FunctionDeclaration */, context, { name: ts.factory.createIdentifier(localName), privateSymbolVisitor: includePrivateSymbol, bundledImports: bundled }); addResult(ts.setTextRange(decl, getSignatureTextRangeLocation(sig)), modifierFlags); } // Module symbol emit will take care of module-y members, provided it has exports @@ -55387,7 +56011,7 @@ var ts; !ts.some(getSignaturesOfType(staticType, 1 /* SignatureKind.Construct */)); var constructors = isNonConstructableClassLikeInJsFile ? [ts.factory.createConstructorDeclaration(ts.factory.createModifiersFromModifierFlags(8 /* ModifierFlags.Private */), [], /*body*/ undefined)] : - serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 171 /* SyntaxKind.Constructor */); + serializeSignatures(1 /* SignatureKind.Construct */, staticType, staticBaseType, 173 /* SyntaxKind.Constructor */); var indexSignatures = serializeIndexSignatures(classType, baseTypes[0]); context.enclosingDeclaration = oldEnclosing; addResult(ts.setTextRange(ts.factory.createClassDeclaration( @@ -55436,8 +56060,8 @@ var ts; var targetName = getInternalSymbolName(target, verbatimTargetName); includePrivateSymbol(target); // the target may be within the same scope - attempt to serialize it first switch (node.kind) { - case 203 /* SyntaxKind.BindingElement */: - if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 254 /* SyntaxKind.VariableDeclaration */) { + case 205 /* SyntaxKind.BindingElement */: + if (((_b = (_a = node.parent) === null || _a === void 0 ? void 0 : _a.parent) === null || _b === void 0 ? void 0 : _b.kind) === 257 /* SyntaxKind.VariableDeclaration */) { // const { SomeClass } = require('./lib'); var specifier_1 = getSpecifierForModuleSymbol(target.parent || target, context); // './lib' var propertyName = node.propertyName; @@ -55450,13 +56074,13 @@ var ts; // We don't know how to serialize this (nested?) binding element ts.Debug.failBadSyntaxKind(((_c = node.parent) === null || _c === void 0 ? void 0 : _c.parent) || node, "Unhandled binding element grandparent kind in declaration serialization"); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 221 /* SyntaxKind.BinaryExpression */) { + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + if (((_e = (_d = node.parent) === null || _d === void 0 ? void 0 : _d.parent) === null || _e === void 0 ? void 0 : _e.kind) === 223 /* SyntaxKind.BinaryExpression */) { // module.exports = { SomeClass } serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), targetName); } break; - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: // commonjs require: const x = require('y') if (ts.isPropertyAccessExpression(node.initializer)) { // const x = require('y').z @@ -55474,7 +56098,7 @@ var ts; break; } // else fall through and treat commonjs require just like import= - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // This _specifically_ only exists to handle json declarations - where we make aliases, but since // we emit no declarations for the json document, must not refer to it in the declarations if (target.escapedName === "export=" /* InternalSymbolName.ExportEquals */ && ts.some(target.declarations, ts.isJsonSourceFile)) { @@ -55490,13 +56114,13 @@ var ts; ? symbolToName(target, context, 67108863 /* SymbolFlags.All */, /*expectsIdentifier*/ false) : ts.factory.createExternalModuleReference(ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)))), isLocalImport ? modifierFlags : 0 /* ModifierFlags.None */); break; - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // export as namespace foo // TODO: Not part of a file's local or export symbol tables // Is bound into file.symbol.globalExports instead, which we don't currently traverse addResult(ts.factory.createNamespaceExportDeclaration(ts.idText(node.name)), 0 /* ModifierFlags.None */); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, ts.factory.createIdentifier(localName), /*namedBindings*/ undefined), // We use `target.parent || target` below as `target.parent` is unset when the target is a module which has been export assigned @@ -55505,17 +56129,17 @@ var ts; ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause(/*isTypeOnly*/ false, /*importClause*/ undefined, ts.factory.createNamespaceImport(ts.factory.createIdentifier(localName))), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: addResult(ts.factory.createExportDeclaration( /*modifiers*/ undefined, /*isTypeOnly*/ false, ts.factory.createNamespaceExport(ts.factory.createIdentifier(localName)), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target, context))), 0 /* ModifierFlags.None */); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: addResult(ts.factory.createImportDeclaration( /*modifiers*/ undefined, ts.factory.createImportClause( /*isTypeOnly*/ false, @@ -55525,7 +56149,7 @@ var ts; ])), ts.factory.createStringLiteral(getSpecifierForModuleSymbol(target.parent || target, context)), /*assertClause*/ undefined), 0 /* ModifierFlags.None */); break; - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: // does not use localName because the symbol name in this case refers to the name in the exports table, // which we must exactly preserve var specifier = node.parent.parent.moduleSpecifier; @@ -55533,12 +56157,12 @@ var ts; // another file serializeExportSpecifier(ts.unescapeLeadingUnderscores(symbol.escapedName), specifier ? verbatimTargetName : targetName, specifier && ts.isStringLiteralLike(specifier) ? ts.factory.createStringLiteral(specifier.text) : undefined); break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: serializeMaybeAliasAssignment(symbol); break; - case 221 /* SyntaxKind.BinaryExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 223 /* SyntaxKind.BinaryExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // Could be best encoded as though an export specifier or as though an export assignment // If name is default or export=, do an export assignment // Otherwise do an export specifier @@ -55682,7 +56306,7 @@ var ts; && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName)))) { return []; } - var flag = (modifierFlags & ~256 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); + var flag = (modifierFlags & ~512 /* ModifierFlags.Async */) | (isStatic ? 32 /* ModifierFlags.Static */ : 0); var name = getPropertyNameNodeForSymbol(p, context); var firstPropertyLikeDecl = (_a = p.declarations) === null || _a === void 0 ? void 0 : _a.find(ts.or(ts.isPropertyDeclaration, ts.isAccessor, ts.isVariableDeclaration, ts.isPropertySignature, ts.isBinaryExpression, ts.isPropertyAccessExpression)); if (p.flags & 98304 /* SymbolFlags.Accessor */ && useAccessors) { @@ -55704,7 +56328,7 @@ var ts; // This is an else/if as accessors and properties can't merge in TS, but might in JS // If this happens, we assume the accessor takes priority, as it imposes more constraints else if (p.flags & (4 /* SymbolFlags.Property */ | 3 /* SymbolFlags.Variable */ | 98304 /* SymbolFlags.Accessor */)) { - return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), + return ts.setTextRange(createProperty(ts.factory.createModifiersFromModifierFlags((isReadonlySymbol(p) ? 64 /* ModifierFlags.Readonly */ : 0) | flag), name, p.flags & 16777216 /* SymbolFlags.Optional */ ? ts.factory.createToken(57 /* SyntaxKind.QuestionToken */) : undefined, isPrivate ? undefined : serializeTypeForDeclaration(context, getWriteTypeOfSymbol(p), p, enclosingDeclaration, includePrivateSymbol, bundled), // TODO: https://github.com/microsoft/TypeScript/pull/32372#discussion_r328386357 // interface members can't have initializers, however class members _can_ /*initializer*/ undefined), ((_d = p.declarations) === null || _d === void 0 ? void 0 : _d.find(ts.or(ts.isPropertyDeclaration, ts.isVariableDeclaration))) || firstPropertyLikeDecl); @@ -55894,7 +56518,7 @@ var ts; if (flags === void 0) { flags = 16384 /* TypeFormatFlags.UseAliasDefinedOutsideCurrentScope */; } return writer ? typePredicateToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(typePredicateToStringWorker); function typePredicateToStringWorker(writer) { - var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(128 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 + var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* TypePredicateKind.AssertsThis */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createToken(129 /* SyntaxKind.AssertsKeyword */) : undefined, typePredicate.kind === 1 /* TypePredicateKind.Identifier */ || typePredicate.kind === 3 /* TypePredicateKind.AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* NodeBuilderFlags.IgnoreErrors */ | 512 /* NodeBuilderFlags.WriteTypeParametersInQualifiedName */) // TODO: GH#18217 ); var printer = ts.createPrinter({ removeComments: true }); var sourceFile = enclosingDeclaration && ts.getSourceFileOfNode(enclosingDeclaration); @@ -55941,7 +56565,7 @@ var ts; function getTypeAliasForTypeLiteral(type) { if (type.symbol && type.symbol.flags & 2048 /* SymbolFlags.TypeLiteral */ && type.symbol.declarations) { var node = ts.walkUpParenthesizedTypes(type.symbol.declarations[0].parent); - if (node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */) { + if (node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */) { return getSymbolOfNode(node); } } @@ -55949,11 +56573,11 @@ var ts; } function isTopLevelInExternalModuleAugmentation(node) { return node && node.parent && - node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isExternalModuleAugmentation(node.parent.parent); } function isDefaultBindingContext(location) { - return location.kind === 305 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); + return location.kind === 308 /* SyntaxKind.SourceFile */ || ts.isAmbientModule(location); } function getNameOfSymbolFromNameType(symbol, context) { var nameType = getSymbolLinks(symbol).nameType; @@ -56012,17 +56636,17 @@ var ts; if (!declaration) { declaration = symbol.declarations[0]; // Declaration may be nameless, but we'll try anyway } - if (declaration.parent && declaration.parent.kind === 254 /* SyntaxKind.VariableDeclaration */) { + if (declaration.parent && declaration.parent.kind === 257 /* SyntaxKind.VariableDeclaration */) { return ts.declarationNameToString(declaration.parent.name); } switch (declaration.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (context && !context.encounteredError && !(context.flags & 131072 /* NodeBuilderFlags.AllowAnonymousIdentifier */)) { context.encounteredError = true; } - return declaration.kind === 226 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; + return declaration.kind === 228 /* SyntaxKind.ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)"; } } var name = getNameOfSymbolFromNameType(symbol, context); @@ -56039,28 +56663,28 @@ var ts; return false; function determineIfDeclarationIsVisible() { switch (node.kind) { - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: // Top-level jsdoc type aliases are considered exported // First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent)); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return isDeclarationVisible(node.parent.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: if (ts.isBindingPattern(node.name) && !node.name.elements.length) { // If the binding pattern is empty, this variable declaration is not visible return false; } // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // external module augmentation is always visible if (ts.isExternalModuleAugmentation(node)) { return true; @@ -56068,55 +56692,55 @@ var ts; var parent = getDeclarationContainer(node); // If the node is not exported or it is not ambient module element (except import declaration) if (!(ts.getCombinedModifierFlags(node) & 1 /* ModifierFlags.Export */) && - !(node.kind !== 265 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 305 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { + !(node.kind !== 268 /* SyntaxKind.ImportEqualsDeclaration */ && parent.kind !== 308 /* SyntaxKind.SourceFile */ && parent.flags & 16777216 /* NodeFlags.Ambient */)) { return isGlobalSourceFile(parent); } // Exported members/ambient module elements (exception import declaration) are visible if parent is visible return isDeclarationVisible(parent); - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { // Private/protected properties/methods are not visible return false; } // Public properties/methods are visible if its parents are visible, so: // falls through - case 171 /* SyntaxKind.Constructor */: - case 175 /* SyntaxKind.ConstructSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 164 /* SyntaxKind.Parameter */: - case 262 /* SyntaxKind.ModuleBlock */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 178 /* SyntaxKind.TypeReference */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 173 /* SyntaxKind.Constructor */: + case 177 /* SyntaxKind.ConstructSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 166 /* SyntaxKind.Parameter */: + case 265 /* SyntaxKind.ModuleBlock */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 180 /* SyntaxKind.TypeReference */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return isDeclarationVisible(node.parent); // Default binding, import specifier and namespace import is visible // only on demand so by default it is not visible - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: return false; // Type parameters are always visible - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: // Source file and namespace export are always visible // falls through - case 305 /* SyntaxKind.SourceFile */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 308 /* SyntaxKind.SourceFile */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return true; // Export assignments do not create name bindings outside the module - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return false; default: return false; @@ -56125,10 +56749,10 @@ var ts; } function collectLinkedAliases(node, setVisibility) { var exportSymbol; - if (node.parent && node.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (node.parent && node.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { exportSymbol = resolveName(node, node.escapedText, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false); } - else if (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) { + else if (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) { exportSymbol = getTargetOfExportSpecifier(node.parent, 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */); } var result; @@ -56235,12 +56859,12 @@ var ts; function getDeclarationContainer(node) { return ts.findAncestor(ts.getRootDeclaration(node), function (node) { switch (node.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 255 /* SyntaxKind.VariableDeclarationList */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 269 /* SyntaxKind.NamedImports */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 258 /* SyntaxKind.VariableDeclarationList */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 272 /* SyntaxKind.NamedImports */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: return false; default: return true; @@ -56370,23 +56994,23 @@ var ts; function getParentElementAccess(node) { var ancestor = node.parent.parent; switch (ancestor.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 205 /* SyntaxKind.BindingElement */: + case 299 /* SyntaxKind.PropertyAssignment */: return getSyntheticElementAccess(ancestor); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getSyntheticElementAccess(node.parent); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return ancestor.initializer; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return ancestor.right; } } function getDestructuringPropertyName(node) { var parent = node.parent; - if (node.kind === 203 /* SyntaxKind.BindingElement */ && parent.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (node.kind === 205 /* SyntaxKind.BindingElement */ && parent.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { return getLiteralPropertyNameText(node.propertyName || node.name); } - if (node.kind === 296 /* SyntaxKind.PropertyAssignment */ || node.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.kind === 299 /* SyntaxKind.PropertyAssignment */ || node.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return getLiteralPropertyNameText(node.name); } return "" + parent.elements.indexOf(node); @@ -56416,7 +57040,7 @@ var ts; parentType = getTypeWithFacts(parentType, 524288 /* TypeFacts.NEUndefined */); } var type; - if (pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + if (pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (declaration.dotDotDotToken) { parentType = getReducedType(parentType); if (parentType.flags & 2 /* TypeFlags.Unknown */ || !isValidSpreadType(parentType)) { @@ -56487,7 +57111,7 @@ var ts; } function isEmptyArrayLiteral(node) { var expr = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; + return expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, isProperty, isOptional) { if (isProperty === void 0) { isProperty = false; } @@ -56498,11 +57122,11 @@ var ts; function getTypeForVariableLikeDeclaration(declaration, includeOptionality, checkMode) { // A variable declared in a for..in statement is of type string, or of type keyof T when the // right hand expression is of a type parameter type. - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression, /*checkMode*/ checkMode))); return indexType.flags & (262144 /* TypeFlags.TypeParameter */ | 4194304 /* TypeFlags.Index */) ? getExtractStringType(indexType) : stringType; } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { // checkRightHandSideOfForOf will return undefined if the for-of expression type was // missing properties/signatures required to get its iteratedType (like // [Symbol.iterator] or next). This may be because we accessed properties from anyType, @@ -56513,7 +57137,7 @@ var ts; if (ts.isBindingPattern(declaration.parent)) { return getTypeForBindingElement(declaration); } - var isProperty = ts.isPropertyDeclaration(declaration) || ts.isPropertySignature(declaration); + var isProperty = ts.isPropertyDeclaration(declaration) && !ts.hasAccessorModifier(declaration) || ts.isPropertySignature(declaration); var isOptional = includeOptionality && (isProperty && !!declaration.questionToken || ts.isParameter(declaration) && (!!declaration.questionToken || isJSDocOptionalParameter(declaration)) || isOptionalJSDocPropertyLikeTag(declaration)); @@ -56540,8 +57164,8 @@ var ts; if (ts.isParameter(declaration)) { var func = declaration.parent; // For a parameter of a set accessor, use the type of the get accessor if one is present - if (func.kind === 173 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { - var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 172 /* SyntaxKind.GetAccessor */); + if (func.kind === 175 /* SyntaxKind.SetAccessor */ && hasBindableName(func)) { + var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 174 /* SyntaxKind.GetAccessor */); if (getter) { var getterSignature = getSignatureFromDeclaration(getter); var thisParameter = getAccessorThisParameter(func); @@ -56553,11 +57177,9 @@ var ts; return getReturnTypeOfSignature(getterSignature); } } - if (ts.isInJSFile(declaration)) { - var type_1 = getParameterTypeOfTypeTag(func, declaration); - if (type_1) - return type_1; - } + var parameterTypeOfTypeTag = getParameterTypeOfTypeTag(func, declaration); + if (parameterTypeOfTypeTag) + return parameterTypeOfTypeTag; // Use contextual parameter type if one is available var type = declaration.symbol.escapedName === "this" /* InternalSymbolName.This */ ? getContextualThisParameterType(func) : getContextuallyTypedParameterType(declaration); if (type) { @@ -56618,7 +57240,7 @@ var ts; links.isConstructorDeclaredProperty = !!getDeclaringConstructor(symbol) && ts.every(symbol.declarations, function (declaration) { return ts.isBinaryExpression(declaration) && isPossiblyAliasedThisProperty(declaration) && - (declaration.left.kind !== 207 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && + (declaration.left.kind !== 209 /* SyntaxKind.ElementAccessExpression */ || ts.isStringOrNumericLiteralLike(declaration.left.argumentExpression)) && !getAnnotatedTypeForAssignmentDeclaration(/*declaredType*/ undefined, declaration, symbol, declaration); }); } @@ -56640,11 +57262,10 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; var container = ts.getThisContainer(declaration, /*includeArrowFunctions*/ false); - if (container && (container.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { + if (container && (container.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(container))) { return container; } } - ; } /** Create a synthetic property access flow node after the last statement of the file */ function getFlowTypeFromCommonJSExport(symbol) { @@ -56937,9 +57558,9 @@ var ts; var thisContainer = ts.getThisContainer(expression, /*includeArrowFunctions*/ false); // Properties defined in a constructor (or base constructor, or javascript constructor function) don't get undefined added. // Function expressions that are assigned to the prototype count as methods. - return thisContainer.kind === 171 /* SyntaxKind.Constructor */ || - thisContainer.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - (thisContainer.kind === 213 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); + return thisContainer.kind === 173 /* SyntaxKind.Constructor */ || + thisContainer.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + (thisContainer.kind === 215 /* SyntaxKind.FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent)); } function getConstructorDefinedThisAssignmentTypes(types, declarations) { ts.Debug.assert(types.length === declarations.length); @@ -57009,7 +57630,7 @@ var ts; function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) { var elements = pattern.elements; var lastElement = ts.lastOrUndefined(elements); - var restElement = lastElement && lastElement.kind === 203 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; + var restElement = lastElement && lastElement.kind === 205 /* SyntaxKind.BindingElement */ && lastElement.dotDotDotToken ? lastElement : undefined; if (elements.length === 0 || elements.length === 1 && restElement) { return languageVersion >= 2 /* ScriptTarget.ES2015 */ ? createIterableType(anyType) : anyArrayType; } @@ -57034,7 +57655,7 @@ var ts; function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { if (includePatternInType === void 0) { includePatternInType = false; } if (reportErrors === void 0) { reportErrors = false; } - return pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ + return pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); } @@ -57082,7 +57703,7 @@ var ts; } function declarationBelongsToPrivateAmbientMember(declaration) { var root = ts.getRootDeclaration(declaration); - var memberDeclaration = root.kind === 164 /* SyntaxKind.Parameter */ ? root.parent : root; + var memberDeclaration = root.kind === 166 /* SyntaxKind.Parameter */ ? root.parent : root; return isPrivateWithinAmbient(memberDeclaration); } function tryGetTypeFromEffectiveTypeNode(node) { @@ -57137,9 +57758,9 @@ var ts; if (typeNode === undefined) { return useUnknownInCatchVariables ? unknownType : anyType; } - var type_2 = getTypeOfNode(typeNode); + var type_1 = getTypeOfNode(typeNode); // an errorType will make `checkTryStatement` issue an error - return isTypeAny(type_2) || type_2 === unknownType ? type_2 : errorType; + return isTypeAny(type_1) || type_1 === unknownType ? type_1 : errorType; } // Handle export default expressions if (ts.isSourceFile(declaration) && ts.isJsonSourceFile(declaration)) { @@ -57162,7 +57783,7 @@ var ts; return reportCircularityError(symbol); } var type; - if (declaration.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (declaration.kind === 274 /* SyntaxKind.ExportAssignment */) { type = widenTypeForVariableLikeDeclaration(tryGetTypeFromEffectiveTypeNode(declaration) || checkExpressionCached(declaration.expression), declaration); } else if (ts.isBinaryExpression(declaration) || @@ -57230,13 +57851,17 @@ var ts; } function getAnnotatedAccessorTypeNode(accessor) { if (accessor) { - if (accessor.kind === 172 /* SyntaxKind.GetAccessor */) { - var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); - return getterTypeAnnotation; - } - else { - var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); - return setterTypeAnnotation; + switch (accessor.kind) { + case 174 /* SyntaxKind.GetAccessor */: + var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor); + return getterTypeAnnotation; + case 175 /* SyntaxKind.SetAccessor */: + var setterTypeAnnotation = ts.getEffectiveSetAccessorTypeAnnotationNode(accessor); + return setterTypeAnnotation; + case 169 /* SyntaxKind.PropertyDeclaration */: + ts.Debug.assert(ts.hasAccessorModifier(accessor)); + var accessorTypeAnnotation = ts.getEffectiveTypeAnnotationNode(accessor); + return accessorTypeAnnotation; } } return undefined; @@ -57258,14 +57883,17 @@ var ts; if (!pushTypeResolution(symbol, 0 /* TypeSystemPropertyName.Type */)) { return errorType; } - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); + var accessor = ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); // We try to resolve a getter type annotation, a setter type annotation, or a getter function // body return type inference, in that order. var type = getter && ts.isInJSFile(getter) && getTypeForDeclarationFromJSDocComment(getter) || getAnnotatedAccessorType(getter) || getAnnotatedAccessorType(setter) || - getter && getter.body && getReturnTypeFromBody(getter); + getAnnotatedAccessorType(accessor) || + getter && getter.body && getReturnTypeFromBody(getter) || + accessor && accessor.initializer && getWidenedTypeForVariableLikeDeclaration(accessor, /*includeOptionality*/ true); if (!type) { if (setter && !isPrivateWithinAmbient(setter)) { errorOrSuggestion(noImplicitAny, setter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_set_accessor_lacks_a_parameter_type_annotation, symbolToString(symbol)); @@ -57273,6 +57901,9 @@ var ts; else if (getter && !isPrivateWithinAmbient(getter)) { errorOrSuggestion(noImplicitAny, getter, ts.Diagnostics.Property_0_implicitly_has_type_any_because_its_get_accessor_lacks_a_return_type_annotation, symbolToString(symbol)); } + else if (accessor && !isPrivateWithinAmbient(accessor)) { + errorOrSuggestion(noImplicitAny, accessor, ts.Diagnostics.Member_0_implicitly_has_an_1_type, symbolToString(symbol), "any"); + } type = anyType; } if (!popTypeResolution()) { @@ -57282,6 +57913,9 @@ var ts; else if (getAnnotatedAccessorTypeNode(setter)) { error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); } + else if (getAnnotatedAccessorTypeNode(accessor)) { + error(setter, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol)); + } else if (getter && noImplicitAny) { error(getter, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol)); } @@ -57292,12 +57926,13 @@ var ts; return links.type; } function getWriteTypeOfAccessors(symbol) { + var _a; var links = getSymbolLinks(symbol); if (!links.writeType) { if (!pushTypeResolution(symbol, 8 /* TypeSystemPropertyName.WriteType */)) { return errorType; } - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var setter = (_a = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */)) !== null && _a !== void 0 ? _a : ts.tryCast(ts.getDeclarationOfKind(symbol, 169 /* SyntaxKind.PropertyDeclaration */), ts.isAutoAccessorPropertyDeclaration); var writeType = getAnnotatedAccessorType(setter); if (!popTypeResolution()) { if (getAnnotatedAccessorTypeNode(setter)) { @@ -57337,9 +57972,9 @@ var ts; if (symbol.flags & 1536 /* SymbolFlags.Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) { return anyType; } - else if (declaration && (declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || + else if (declaration && (declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || ts.isAccessExpression(declaration) && - declaration.parent.kind === 221 /* SyntaxKind.BinaryExpression */)) { + declaration.parent.kind === 223 /* SyntaxKind.BinaryExpression */)) { return getWidenedTypeForAssignmentDeclaration(symbol); } else if (symbol.flags & 512 /* SymbolFlags.ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) { @@ -57349,11 +57984,11 @@ var ts; return errorType; } var exportEquals = getMergedSymbol(symbol.exports.get("export=" /* InternalSymbolName.ExportEquals */)); - var type_3 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); + var type_2 = getWidenedTypeForAssignmentDeclaration(exportEquals, exportEquals === resolvedModule ? undefined : resolvedModule); if (!popTypeResolution()) { return reportCircularityError(symbol); } - return type_3; + return type_2; } } var type = createObjectType(16 /* ObjectFlags.Anonymous */, symbol); @@ -57383,7 +58018,7 @@ var ts; links.type = (exportSymbol === null || exportSymbol === void 0 ? void 0 : exportSymbol.declarations) && isDuplicatedCommonJSExport(exportSymbol.declarations) && symbol.declarations.length ? getFlowTypeFromCommonJSExport(exportSymbol) : isDuplicatedCommonJSExport(symbol.declarations) ? autoType : declaredType ? declaredType - : targetSymbol.flags & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol) + : getAllSymbolFlags(targetSymbol) & 111551 /* SymbolFlags.Value */ ? getTypeOfSymbol(targetSymbol) : errorType; } return links.type; @@ -57404,7 +58039,7 @@ var ts; return errorType; } // Check if variable has initializer that circularly references the variable itself - if (noImplicitAny && (declaration.kind !== 164 /* SyntaxKind.Parameter */ || declaration.initializer)) { + if (noImplicitAny && (declaration.kind !== 166 /* SyntaxKind.Parameter */ || declaration.initializer)) { error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol)); } // Circularities could also result from parameters in function expressions that end up @@ -57536,46 +58171,46 @@ var ts; return undefined; } switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 344 /* SyntaxKind.JSDocTemplateTag */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 195 /* SyntaxKind.MappedType */: - case 189 /* SyntaxKind.ConditionalType */: { + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 347 /* SyntaxKind.JSDocTemplateTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 197 /* SyntaxKind.MappedType */: + case 191 /* SyntaxKind.ConditionalType */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); - if (node.kind === 195 /* SyntaxKind.MappedType */) { + if (node.kind === 197 /* SyntaxKind.MappedType */) { return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter))); } - else if (node.kind === 189 /* SyntaxKind.ConditionalType */) { + else if (node.kind === 191 /* SyntaxKind.ConditionalType */) { return ts.concatenate(outerTypeParameters, getInferTypeParameters(node)); } var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node)); var thisType = includeThisTypes && - (node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */ || node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && + (node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */ || node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || isJSConstructor(node)) && getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType; return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters; } - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: var paramSymbol = ts.getParameterSymbolFromJSDoc(node); if (paramSymbol) { node = paramSymbol.valueDeclaration; } break; - case 320 /* SyntaxKind.JSDoc */: { + case 323 /* SyntaxKind.JSDoc */: { var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes); return node.tags ? appendTypeParameters(outerTypeParameters, ts.flatMap(node.tags, function (t) { return ts.isJSDocTemplateTag(t) ? t.typeParameters : undefined; })) @@ -57586,7 +58221,7 @@ var ts; } // The outer type parameters are those defined by enclosing generic classes, methods, or functions. function getOuterTypeParametersOfClassOrInterface(symbol) { - var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var declaration = symbol.flags & 32 /* SymbolFlags.Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); ts.Debug.assert(!!declaration, "Class was missing valueDeclaration -OR- non-class had no interface declarations"); return getOuterTypeParameters(declaration); } @@ -57599,9 +58234,9 @@ var ts; var result; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var node = _a[_i]; - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 257 /* SyntaxKind.ClassDeclaration */ || - node.kind === 226 /* SyntaxKind.ClassExpression */ || + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 260 /* SyntaxKind.ClassDeclaration */ || + node.kind === 228 /* SyntaxKind.ClassExpression */ || isJSConstructor(node) || ts.isTypeAlias(node)) { var declaration = node; @@ -57753,7 +58388,7 @@ var ts; if (!popTypeResolution() && type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { reportCircularBaseType(declaration, type); } } @@ -57849,7 +58484,7 @@ var ts; if (type.symbol.declarations) { for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) { for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) { var node = _c[_b]; var baseType = getReducedType(getTypeFromTypeNode(node)); @@ -57889,7 +58524,7 @@ var ts; } for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (declaration.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (declaration.flags & 128 /* NodeFlags.ContainsThis */) { return false; } @@ -57968,7 +58603,7 @@ var ts; } else { type = errorType; - if (declaration.kind === 339 /* SyntaxKind.JSDocEnumTag */) { + if (declaration.kind === 342 /* SyntaxKind.JSDocEnumTag */) { error(declaration.typeExpression.type, ts.Diagnostics.Type_alias_0_circularly_references_itself, symbolToString(symbol)); } else { @@ -57983,7 +58618,7 @@ var ts; if (ts.isStringLiteralLike(expr)) { return true; } - else if (expr.kind === 221 /* SyntaxKind.BinaryExpression */) { + else if (expr.kind === 223 /* SyntaxKind.BinaryExpression */) { return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right); } return false; @@ -57998,12 +58633,12 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return true; - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; case 79 /* SyntaxKind.Identifier */: return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return isStringConcatExpression(expr); default: return false; @@ -58018,7 +58653,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; if (member.initializer && ts.isStringLiteralLike(member.initializer)) { @@ -58047,7 +58682,7 @@ var ts; if (symbol.declarations) { for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - if (declaration.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind === 263 /* SyntaxKind.EnumDeclaration */) { for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) { var member = _c[_b]; var value = getEnumMemberValue(member); @@ -58120,22 +58755,22 @@ var ts; */ function isThislessType(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 158 /* SyntaxKind.BigIntKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 148 /* SyntaxKind.ObjectKeyword */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: - case 196 /* SyntaxKind.LiteralType */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: + case 198 /* SyntaxKind.LiteralType */: return true; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return isThislessType(node.elementType); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return !node.typeArguments || node.typeArguments.every(isThislessType); } return false; @@ -58161,7 +58796,7 @@ var ts; function isThislessFunctionLikeDeclaration(node) { var returnType = ts.getEffectiveReturnTypeNode(node); var typeParameters = ts.getEffectiveTypeParameterDeclarations(node); - return (node.kind === 171 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && + return (node.kind === 173 /* SyntaxKind.Constructor */ || (!!returnType && isThislessType(returnType))) && node.parameters.every(isThislessVariableLikeDeclaration) && typeParameters.every(isThislessTypeParameter); } @@ -58177,14 +58812,14 @@ var ts; var declaration = symbol.declarations[0]; if (declaration) { switch (declaration.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return isThislessVariableLikeDeclaration(declaration); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return isThislessFunctionLikeDeclaration(declaration); } } @@ -58395,8 +59030,10 @@ var ts; if (members) { for (var _b = 0, members_5 = members; _b < members_5.length; _b++) { var member = members_5[_b]; - if (isStatic_1 === ts.hasStaticModifier(member) && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === ts.hasStaticModifier(member)) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58411,8 +59048,10 @@ var ts; || ts.isBinaryExpression(member) && isPossiblyAliasedThisProperty(member, assignmentKind) || assignmentKind === 9 /* AssignmentDeclarationKind.ObjectDefinePrototypeProperty */ || assignmentKind === 6 /* AssignmentDeclarationKind.Prototype */; // A straight `Prototype` assignment probably can never have a computed name - if (isStatic_1 === !isInstanceMember && hasLateBindableName(member)) { - lateBindMember(symbol, earlySymbols, lateSymbols, member); + if (isStatic_1 === !isInstanceMember) { + if (hasLateBindableName(member)) { + lateBindMember(symbol, earlySymbols, lateSymbols, member); + } } } } @@ -58599,7 +59238,7 @@ var ts; var baseConstructorType = getBaseConstructorTypeOfClass(classType); var baseSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); var declaration = ts.getClassLikeDeclarationOfSymbol(classType.symbol); - var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */); + var isAbstract = !!declaration && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */); if (baseSignatures.length === 0) { return [createSignature(undefined, classType.localTypeParameters, undefined, ts.emptyArray, classType, /*resolvedTypePredicate*/ undefined, 0, isAbstract ? 4 /* SignatureFlags.Abstract */ : 0 /* SignatureFlags.None */)]; } @@ -59221,8 +59860,8 @@ var ts; } function isMappedTypeWithKeyofConstraintDeclaration(type) { var constraintDeclaration = getConstraintDeclarationForMappedType(type); // TODO: GH#18217 - return constraintDeclaration.kind === 193 /* SyntaxKind.TypeOperator */ && - constraintDeclaration.operator === 140 /* SyntaxKind.KeyOfKeyword */; + return constraintDeclaration.kind === 195 /* SyntaxKind.TypeOperator */ && + constraintDeclaration.operator === 141 /* SyntaxKind.KeyOfKeyword */; } function getModifiersTypeFromMappedType(type) { if (!type.modifiersType) { @@ -59262,7 +59901,20 @@ var ts; return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(type) & 4 /* MappedTypeModifiers.IncludeOptional */); } function isGenericMappedType(type) { - return !!(ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) && isGenericIndexType(getConstraintTypeFromMappedType(type)); + if (ts.getObjectFlags(type) & 32 /* ObjectFlags.Mapped */) { + var constraint = getConstraintTypeFromMappedType(type); + if (isGenericIndexType(constraint)) { + return true; + } + // A mapped type is generic if the 'as' clause references generic types other than the iteration type. + // To determine this, we substitute the constraint type (that we now know isn't generic) for the iteration + // type and check whether the resulting type is generic. + var nameType = getNameTypeFromMappedType(type); + if (nameType && isGenericIndexType(instantiateType(nameType, makeUnaryTypeMapper(getTypeParameterFromMappedType(type), constraint)))) { + return true; + } + } + return false; } function resolveStructuredTypeMembers(type) { if (!type.members) { @@ -59582,10 +60234,10 @@ var ts; var baseTypes = []; var different = false; for (var _i = 0, types_7 = types; _i < types_7.length; _i++) { - var type_4 = types_7[_i]; - var baseType = getBaseConstraint(type_4); + var type_3 = types_7[_i]; + var baseType = getBaseConstraint(type_3); if (baseType) { - if (baseType !== type_4) { + if (baseType !== type_3) { different = true; } baseTypes.push(baseType); @@ -59629,7 +60281,7 @@ var ts; return constraint && getBaseConstraint(constraint); } if (t.flags & 33554432 /* TypeFlags.Substitution */) { - return getBaseConstraint(t.substitute); + return getBaseConstraint(getSubstitutionIntersection(t)); } return t; } @@ -59732,7 +60384,7 @@ var ts; var indexTypes; var isUnion = containingType.flags & 1048576 /* TypeFlags.Union */; // Flags we want to propagate to the result if they exist in all source symbols - var optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */; + var optionalFlag; var syntheticFlag = 4 /* CheckFlags.SyntheticMethod */; var checkFlags = isUnion ? 0 : 8 /* CheckFlags.Readonly */; var mergedInstantiations = false; @@ -59743,11 +60395,14 @@ var ts; var prop = getPropertyOfType(type, name, skipObjectFunctionPropertyAugment); var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0; if (prop) { - if (isUnion) { - optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */); - } - else { - optionalFlag &= prop.flags; + if (prop.flags & 106500 /* SymbolFlags.ClassMember */) { + optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : (optionalFlag = isUnion ? 0 /* SymbolFlags.None */ : 16777216 /* SymbolFlags.Optional */); + if (isUnion) { + optionalFlag |= (prop.flags & 16777216 /* SymbolFlags.Optional */); + } + else { + optionalFlag &= prop.flags; + } } if (!singleProp) { singleProp = prop; @@ -59756,7 +60411,7 @@ var ts; var isInstantiation = (getTargetSymbol(prop) || prop) === (getTargetSymbol(singleProp) || singleProp); // If the symbols are instances of one another with identical types - consider the symbols // equivalent and just use the first one, which thus allows us to avoid eliding private - // members when intersecting a (this-)instantiations of a class with it's raw base or another instance + // members when intersecting a (this-)instantiations of a class with its raw base or another instance if (isInstantiation && compareProperties(singleProp, prop, function (a, b) { return a === b ? -1 /* Ternary.True */ : 0 /* Ternary.False */; }) === -1 /* Ternary.True */) { // If we merged instantiations of a generic type, we replicate the symbol parent resetting behavior we used // to do when we recorded multiple distinct symbols so that we still get, eg, `Array.length` printed @@ -59804,7 +60459,11 @@ var ts; } } } - if (!singleProp || isUnion && (propSet || checkFlags & 48 /* CheckFlags.Partial */) && checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */)) { + if (!singleProp || + isUnion && + (propSet || checkFlags & 48 /* CheckFlags.Partial */) && + checkFlags & (1024 /* CheckFlags.ContainsPrivate */ | 512 /* CheckFlags.ContainsProtected */) && + !(propSet && getCommonDeclarationsOfSymbols(ts.arrayFrom(propSet.values())))) { // No property was found, or, in a union, a property has a private or protected declaration in one // constituent, but is missing or has a different declaration in another constituent. return undefined; @@ -59862,7 +60521,7 @@ var ts; propTypes.push(type); } ts.addRange(propTypes, indexTypes); - var result = createSymbol(4 /* SymbolFlags.Property */ | optionalFlag, name, syntheticFlag | checkFlags); + var result = createSymbol(4 /* SymbolFlags.Property */ | (optionalFlag !== null && optionalFlag !== void 0 ? optionalFlag : 0), name, syntheticFlag | checkFlags); result.containingType = containingType; if (!hasNonUniformValueDeclaration && firstValueDeclaration) { result.valueDeclaration = firstValueDeclaration; @@ -59906,6 +60565,33 @@ var ts; } return property; } + function getCommonDeclarationsOfSymbols(symbols) { + var commonDeclarations; + var _loop_14 = function (symbol) { + if (!symbol.declarations) { + return { value: undefined }; + } + if (!commonDeclarations) { + commonDeclarations = new ts.Set(symbol.declarations); + return "continue"; + } + commonDeclarations.forEach(function (declaration) { + if (!ts.contains(symbol.declarations, declaration)) { + commonDeclarations.delete(declaration); + } + }); + if (commonDeclarations.size === 0) { + return { value: undefined }; + } + }; + for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) { + var symbol = symbols_3[_i]; + var state_4 = _loop_14(symbol); + if (typeof state_4 === "object") + return state_4.value; + } + return commonDeclarations; + } function getPropertyOfUnionOrIntersectionType(type, name, skipObjectFunctionPropertyAugment) { var property = getUnionOrIntersectionProperty(type, name, skipObjectFunctionPropertyAugment); // We need to filter out partial properties in union types @@ -60109,10 +60795,10 @@ var ts; function isJSDocOptionalParameter(node) { return ts.isInJSFile(node) && ( // node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType - node.type && node.type.kind === 316 /* SyntaxKind.JSDocOptionalType */ + node.type && node.type.kind === 319 /* SyntaxKind.JSDocOptionalType */ || ts.getJSDocParameterTags(node).some(function (_a) { var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; })); } function tryFindAmbientModule(moduleName, withAugmentations) { @@ -60145,14 +60831,14 @@ var ts; return false; } function isOptionalPropertyDeclaration(node) { - return ts.isPropertyDeclaration(node) && node.questionToken; + return ts.isPropertyDeclaration(node) && !ts.hasAccessorModifier(node) && node.questionToken; } function isOptionalJSDocPropertyLikeTag(node) { if (!ts.isJSDocPropertyLikeTag(node)) { return false; } var isBracketed = node.isBracketed, typeExpression = node.typeExpression; - return isBracketed || !!typeExpression && typeExpression.type.kind === 316 /* SyntaxKind.JSDocOptionalType */; + return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* SyntaxKind.JSDocOptionalType */; } function createTypePredicate(kind, parameterName, parameterIndex, type) { return { kind: kind, parameterName: parameterName, parameterIndex: parameterIndex, type: type }; @@ -60234,7 +60920,7 @@ var ts; else { parameters.push(paramSymbol); } - if (type && type.kind === 196 /* SyntaxKind.LiteralType */) { + if (type && type.kind === 198 /* SyntaxKind.LiteralType */) { flags |= 2 /* SignatureFlags.HasLiteralTypes */; } // Record a new minimum argument count if this is not an optional parameter @@ -60247,24 +60933,24 @@ var ts; } } // If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation - if ((declaration.kind === 172 /* SyntaxKind.GetAccessor */ || declaration.kind === 173 /* SyntaxKind.SetAccessor */) && + if ((declaration.kind === 174 /* SyntaxKind.GetAccessor */ || declaration.kind === 175 /* SyntaxKind.SetAccessor */) && hasBindableName(declaration) && (!hasThisParameter || !thisParameter)) { - var otherKind = declaration.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + var otherKind = declaration.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind); if (other) { thisParameter = getAnnotatedAccessorThisParameter(other); } } - var classType = declaration.kind === 171 /* SyntaxKind.Constructor */ ? + var classType = declaration.kind === 173 /* SyntaxKind.Constructor */ ? getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)) : undefined; var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration); if (ts.hasRestParameter(declaration) || ts.isInJSFile(declaration) && maybeAddJsSyntheticRestParameter(declaration, parameters)) { flags |= 1 /* SignatureFlags.HasRestParameter */; } - if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 128 /* ModifierFlags.Abstract */) || - ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 128 /* ModifierFlags.Abstract */)) { + if (ts.isConstructorTypeNode(declaration) && ts.hasSyntacticModifier(declaration, 256 /* ModifierFlags.Abstract */) || + ts.isConstructorDeclaration(declaration) && ts.hasSyntacticModifier(declaration.parent, 256 /* ModifierFlags.Abstract */)) { flags |= 4 /* SignatureFlags.Abstract */; } links.resolvedSignature = createSignature(declaration, typeParameters, thisParameter, parameters, @@ -60343,16 +61029,16 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node.escapedText === argumentsSymbol.escapedName && getReferencedValueSymbol(node) === argumentsSymbol; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ && traverse(node.name); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return traverse(node.expression); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return traverse(node.initializer); default: return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse); @@ -60376,7 +61062,12 @@ var ts; continue; } } - result.push(getSignatureFromDeclaration(decl)); + // If this is a function or method declaration, get the signature from the @type tag for the sake of optional parameters. + // Exclude contextually-typed kinds because we already apply the @type tag to the context, plus applying it here to the initializer would supress checks that the two are compatible. + result.push((!ts.isFunctionExpressionOrArrowFunction(decl) && + !ts.isObjectLiteralMethod(decl) && + getSignatureOfTypeTag(decl)) || + getSignatureFromDeclaration(decl)); } return result; } @@ -60407,7 +61098,7 @@ var ts; else { var type = signature.declaration && ts.getEffectiveReturnTypeNode(signature.declaration); var jsdocPredicate = void 0; - if (!type && ts.isInJSFile(signature.declaration)) { + if (!type) { var jsdocSignature = getSignatureOfTypeTag(signature.declaration); if (jsdocSignature && signature !== jsdocSignature) { jsdocPredicate = getTypePredicateOfSignature(jsdocSignature); @@ -60424,7 +61115,7 @@ var ts; function createTypePredicateFromTypePredicateNode(node, signature) { var parameterName = node.parameterName; var type = node.type && getTypeFromTypeNode(node.type); - return parameterName.kind === 192 /* SyntaxKind.ThisType */ ? + return parameterName.kind === 194 /* SyntaxKind.ThisType */ ? createTypePredicate(node.assertsModifier ? 2 /* TypePredicateKind.AssertsThis */ : 0 /* TypePredicateKind.This */, /*parameterName*/ undefined, /*parameterIndex*/ undefined, type) : createTypePredicate(node.assertsModifier ? 3 /* TypePredicateKind.AssertsIdentifier */ : 1 /* TypePredicateKind.Identifier */, parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type); } @@ -60470,7 +61161,7 @@ var ts; return signature.resolvedReturnType; } function getReturnTypeFromAnnotation(declaration) { - if (declaration.kind === 171 /* SyntaxKind.Constructor */) { + if (declaration.kind === 173 /* SyntaxKind.Constructor */) { return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol)); } if (ts.isJSDocConstructSignature(declaration)) { @@ -60480,12 +61171,12 @@ var ts; if (typeNode) { return getTypeFromTypeNode(typeNode); } - if (declaration.kind === 172 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { + if (declaration.kind === 174 /* SyntaxKind.GetAccessor */ && hasBindableName(declaration)) { var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration); if (jsDocType) { return jsDocType; } - var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 173 /* SyntaxKind.SetAccessor */); + var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 175 /* SyntaxKind.SetAccessor */); var setterType = getAnnotatedAccessorType(setter); if (setterType) { return setterType; @@ -60588,7 +61279,7 @@ var ts; if (!signature.isolatedSignatureType) { var kind = (_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind; // If declaration is undefined, it is likely to be the signature of the default constructor. - var isConstructor = kind === undefined || kind === 171 /* SyntaxKind.Constructor */ || kind === 175 /* SyntaxKind.ConstructSignature */ || kind === 180 /* SyntaxKind.ConstructorType */; + var isConstructor = kind === undefined || kind === 173 /* SyntaxKind.Constructor */ || kind === 177 /* SyntaxKind.ConstructSignature */ || kind === 182 /* SyntaxKind.ConstructorType */; var type = createObjectType(16 /* ObjectFlags.Anonymous */); type.members = emptySymbols; type.properties = ts.emptyArray; @@ -60615,7 +61306,7 @@ var ts; function getIndexInfosOfIndexSymbol(indexSymbol) { if (indexSymbol.declarations) { var indexInfos_4 = []; - var _loop_14 = function (declaration) { + var _loop_15 = function (declaration) { if (declaration.parameters.length === 1) { var parameter = declaration.parameters[0]; if (parameter.type) { @@ -60629,7 +61320,7 @@ var ts; }; for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) { var declaration = _a[_i]; - _loop_14(declaration); + _loop_15(declaration); } return indexInfos_4; } @@ -60646,14 +61337,14 @@ var ts; var _a; var inferences; if ((_a = typeParameter.symbol) === null || _a === void 0 ? void 0 : _a.declarations) { - var _loop_15 = function (declaration) { - if (declaration.parent.kind === 190 /* SyntaxKind.InferType */) { + var _loop_16 = function (declaration) { + if (declaration.parent.kind === 192 /* SyntaxKind.InferType */) { // When an 'infer T' declaration is immediately contained in a type reference node // (such as 'Foo'), T's constraint is inferred from the constraint of the // corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are // present, we form an intersection of the inferred constraint types. var _c = ts.walkUpParenthesizedTypesAndGetParentAndChild(declaration.parent.parent), _d = _c[0], childTypeParameter = _d === void 0 ? declaration.parent : _d, grandParent = _c[1]; - if (grandParent.kind === 178 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { + if (grandParent.kind === 180 /* SyntaxKind.TypeReference */ && !omitTypeReferences) { var typeReference_1 = grandParent; var typeParameters_1 = getTypeParametersForTypeReference(typeReference_1); if (typeParameters_1) { @@ -60680,27 +61371,27 @@ var ts; } // When an 'infer T' declaration is immediately contained in a rest parameter declaration, a rest type // or a named rest tuple element, we infer an 'unknown[]' constraint. - else if (grandParent.kind === 164 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || - grandParent.kind === 186 /* SyntaxKind.RestType */ || - grandParent.kind === 197 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { + else if (grandParent.kind === 166 /* SyntaxKind.Parameter */ && grandParent.dotDotDotToken || + grandParent.kind === 188 /* SyntaxKind.RestType */ || + grandParent.kind === 199 /* SyntaxKind.NamedTupleMember */ && grandParent.dotDotDotToken) { inferences = ts.append(inferences, createArrayType(unknownType)); } // When an 'infer T' declaration is immediately contained in a string template type, we infer a 'string' // constraint. - else if (grandParent.kind === 199 /* SyntaxKind.TemplateLiteralTypeSpan */) { + else if (grandParent.kind === 201 /* SyntaxKind.TemplateLiteralTypeSpan */) { inferences = ts.append(inferences, stringType); } // When an 'infer T' declaration is in the constraint position of a mapped type, we infer a 'keyof any' // constraint. - else if (grandParent.kind === 163 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 195 /* SyntaxKind.MappedType */) { + else if (grandParent.kind === 165 /* SyntaxKind.TypeParameter */ && grandParent.parent.kind === 197 /* SyntaxKind.MappedType */) { inferences = ts.append(inferences, keyofConstraintType); } // When an 'infer T' declaration is the template of a mapped type, and that mapped type is the extends // clause of a conditional whose check type is also a mapped type, give it a constraint equal to the template // of the check type's mapped type - else if (grandParent.kind === 195 /* SyntaxKind.MappedType */ && grandParent.type && - ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 189 /* SyntaxKind.ConditionalType */ && - grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 195 /* SyntaxKind.MappedType */ && + else if (grandParent.kind === 197 /* SyntaxKind.MappedType */ && grandParent.type && + ts.skipParentheses(grandParent.type) === declaration.parent && grandParent.parent.kind === 191 /* SyntaxKind.ConditionalType */ && + grandParent.parent.extendsType === grandParent && grandParent.parent.checkType.kind === 197 /* SyntaxKind.MappedType */ && grandParent.parent.checkType.type) { var checkMappedType_1 = grandParent.parent.checkType; var nodeType = getTypeFromTypeNode(checkMappedType_1.type); @@ -60710,7 +61401,7 @@ var ts; }; for (var _i = 0, _b = typeParameter.symbol.declarations; _i < _b.length; _i++) { var declaration = _b[_i]; - _loop_15(declaration); + _loop_16(declaration); } } return inferences && getIntersectionType(inferences); @@ -60732,7 +61423,7 @@ var ts; if (type.flags & 1 /* TypeFlags.Any */ && !isErrorType(type)) { // Allow errorType to propegate to keep downstream errors suppressed // use keyofConstraintType as the base constraint for mapped type key constraints (unknown isn;t assignable to that, but `any` was), // use unknown otherwise - type = constraintDeclaration.parent.parent.kind === 195 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; + type = constraintDeclaration.parent.parent.kind === 197 /* SyntaxKind.MappedType */ ? keyofConstraintType : unknownType; } typeParameter.constraint = type; } @@ -60741,7 +61432,7 @@ var ts; return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint; } function getParentSymbolOfTypeParameter(typeParameter) { - var tp = ts.getDeclarationOfKind(typeParameter.symbol, 163 /* SyntaxKind.TypeParameter */); + var tp = ts.getDeclarationOfKind(typeParameter.symbol, 165 /* SyntaxKind.TypeParameter */); var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getEffectiveContainerForJSDocTemplateTag(tp.parent) : tp.parent; return host && getSymbolOfNode(host); } @@ -60827,8 +61518,8 @@ var ts; } var node = type.node; var typeArguments = !node ? ts.emptyArray : - node.kind === 178 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : - node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : + node.kind === 180 /* SyntaxKind.TypeReference */ ? ts.concatenate(type.target.outerTypeParameters, getEffectiveTypeArguments(node, type.target.localTypeParameters)) : + node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); if (popTypeResolution()) { type.resolvedTypeArguments = type.mapper ? instantiateTypes(typeArguments, type.mapper) : typeArguments; @@ -60870,7 +61561,7 @@ var ts; return errorType; } } - if (node.kind === 178 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && isDeferredTypeReferenceNode(node, ts.length(node.typeArguments) !== typeParameters.length)) { return createDeferredTypeReference(type, node, /*mapper*/ undefined); } // In a type reference, the outer type parameters of the referenced class or interface are automatically @@ -60941,9 +61632,9 @@ var ts; } function getTypeReferenceName(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // We only support expressions that are simple qualified names. For other // expressions this produces undefined. var expr = node.expression; @@ -60958,13 +61649,13 @@ var ts; return symbol.parent ? "".concat(getSymbolPath(symbol.parent), ".").concat(symbol.escapedName) : symbol.escapedName; } function getUnresolvedSymbolForEntityName(name) { - var identifier = name.kind === 161 /* SyntaxKind.QualifiedName */ ? name.right : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? name.name : + var identifier = name.kind === 163 /* SyntaxKind.QualifiedName */ ? name.right : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? name.name : name; var text = identifier.escapedText; if (text) { - var parentSymbol = name.kind === 161 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : - name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : + var parentSymbol = name.kind === 163 /* SyntaxKind.QualifiedName */ ? getUnresolvedSymbolForEntityName(name.left) : + name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? getUnresolvedSymbolForEntityName(name.expression) : undefined; var path = parentSymbol ? "".concat(getSymbolPath(parentSymbol), ".").concat(text) : text; var result = unresolvedSymbols.get(path); @@ -61025,7 +61716,7 @@ var ts; var valueType = getTypeOfSymbol(symbol); var typeType = valueType; if (symbol.valueDeclaration) { - var isImportTypeWithQualifier = node.kind === 200 /* SyntaxKind.ImportType */ && node.qualifier; + var isImportTypeWithQualifier = node.kind === 202 /* SyntaxKind.ImportType */ && node.qualifier; // valueType might not have a symbol, eg, {import('./b').STRING_LITERAL} if (valueType.symbol && valueType.symbol !== symbol && isImportTypeWithQualifier) { typeType = getTypeReferenceType(node, valueType.symbol); @@ -61035,23 +61726,27 @@ var ts; } return links.resolvedJSDocType; } - function getSubstitutionType(baseType, substitute) { - if (substitute.flags & 3 /* TypeFlags.AnyOrUnknown */ || substitute === baseType) { + function getSubstitutionType(baseType, constraint) { + if (constraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || constraint === baseType || + !isGenericType(baseType) && !isGenericType(constraint)) { return baseType; } - var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(substitute)); + var id = "".concat(getTypeId(baseType), ">").concat(getTypeId(constraint)); var cached = substitutionTypes.get(id); if (cached) { return cached; } var result = createType(33554432 /* TypeFlags.Substitution */); result.baseType = baseType; - result.substitute = substitute; + result.constraint = constraint; substitutionTypes.set(id, result); return result; } + function getSubstitutionIntersection(substitutionType) { + return getIntersectionType([substitutionType.constraint, substitutionType.baseType]); + } function isUnaryTupleTypeNode(node) { - return node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 1; + return node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 1; } function getImpliedConstraint(type, checkNode, extendsNode) { return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(type, checkNode.elements[0], extendsNode.elements[0]) : @@ -61061,16 +61756,16 @@ var ts; function getConditionalFlowTypeOfType(type, node) { var constraints; var covariant = true; - while (node && !ts.isStatement(node) && node.kind !== 320 /* SyntaxKind.JSDoc */) { + while (node && !ts.isStatement(node) && node.kind !== 323 /* SyntaxKind.JSDoc */) { var parent = node.parent; // only consider variance flipped by parameter locations - `keyof` types would usually be considered variance inverting, but // often get used in indexed accesses where they behave sortof invariantly, but our checking is lax - if (parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 166 /* SyntaxKind.Parameter */) { covariant = !covariant; } // Always substitute on type parameters, regardless of variance, since even // in contravariant positions, they may rely on substituted constraints to be valid - if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 189 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { + if ((covariant || type.flags & 8650752 /* TypeFlags.TypeVariable */) && parent.kind === 191 /* SyntaxKind.ConditionalType */ && node === parent.trueType) { var constraint = getImpliedConstraint(type, parent.checkType, parent.extendsType); if (constraint) { constraints = ts.append(constraints, constraint); @@ -61078,7 +61773,7 @@ var ts; } // Given a homomorphic mapped type { [K in keyof T]: XXX }, where T is constrained to an array or tuple type, in the // template type XXX, K has an added constraint of number | `${number}`. - else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 195 /* SyntaxKind.MappedType */ && node === parent.type) { + else if (type.flags & 262144 /* TypeFlags.TypeParameter */ && parent.kind === 197 /* SyntaxKind.MappedType */ && node === parent.type) { var mappedType = getTypeFromTypeNode(parent); if (getTypeParameterFromMappedType(mappedType) === getActualTypeVariable(type)) { var typeParameter = getHomomorphicTypeVariable(mappedType); @@ -61092,10 +61787,10 @@ var ts; } node = parent; } - return constraints ? getSubstitutionType(type, getIntersectionType(ts.append(constraints, type))) : type; + return constraints ? getSubstitutionType(type, getIntersectionType(constraints)) : type; } function isJSDocTypeReference(node) { - return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 178 /* SyntaxKind.TypeReference */ || node.kind === 200 /* SyntaxKind.ImportType */); + return !!(node.flags & 8388608 /* NodeFlags.JSDoc */) && (node.kind === 180 /* SyntaxKind.TypeReference */ || node.kind === 202 /* SyntaxKind.ImportType */); } function checkNoTypeArguments(node, symbol) { if (node.typeArguments) { @@ -61210,9 +61905,9 @@ var ts; for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) { var declaration = declarations_3[_i]; switch (declaration.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return declaration; } } @@ -61363,6 +62058,13 @@ var ts; function getGlobalBigIntType() { return (deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, /*reportErrors*/ false))) || emptyObjectType; } + function getGlobalNaNSymbol() { + return (deferredGlobalNaNSymbol || (deferredGlobalNaNSymbol = getGlobalValueSymbol("NaN", /*reportErrors*/ false))); + } + function getGlobalRecordSymbol() { + deferredGlobalRecordSymbol || (deferredGlobalRecordSymbol = getGlobalTypeAliasSymbol("Record", /*arity*/ 2, /*reportErrors*/ true) || unknownSymbol); + return deferredGlobalRecordSymbol === unknownSymbol ? undefined : deferredGlobalRecordSymbol; + } /** * Instantiates a global type that is generic with some element type, and returns that instantiation. */ @@ -61380,11 +62082,11 @@ var ts; } function getTupleElementFlags(node) { switch (node.kind) { - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return 2 /* ElementFlags.Optional */; - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getRestTypeElementFlags(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return node.questionToken ? 2 /* ElementFlags.Optional */ : node.dotDotDotToken ? getRestTypeElementFlags(node) : 1 /* ElementFlags.Required */; @@ -61402,14 +62104,14 @@ var ts; return readonly ? globalReadonlyArrayType : globalArrayType; } var elementFlags = ts.map(node.elements, getTupleElementFlags); - var missingName = ts.some(node.elements, function (e) { return e.kind !== 197 /* SyntaxKind.NamedTupleMember */; }); + var missingName = ts.some(node.elements, function (e) { return e.kind !== 199 /* SyntaxKind.NamedTupleMember */; }); return getTupleTargetType(elementFlags, readonly, /*associatedNames*/ missingName ? undefined : node.elements); } // Return true if the given type reference node is directly aliased or if it needs to be deferred // because it is possibly contained in a circular chain of eagerly resolved types. function isDeferredTypeReferenceNode(node, hasDefaultTypeArguments) { - return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 183 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : - node.kind === 184 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : + return !!getAliasSymbolForTypeNode(node) || isResolvedByTypeAlias(node) && (node.kind === 185 /* SyntaxKind.ArrayType */ ? mayResolveTypeAlias(node.elementType) : + node.kind === 186 /* SyntaxKind.TupleType */ ? ts.some(node.elements, mayResolveTypeAlias) : hasDefaultTypeArguments || ts.some(node.typeArguments, mayResolveTypeAlias)); } // Return true when the given node is transitively contained in type constructs that eagerly @@ -61418,18 +62120,18 @@ var ts; function isResolvedByTypeAlias(node) { var parent = node.parent; switch (parent.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 189 /* SyntaxKind.ConditionalType */: - case 193 /* SyntaxKind.TypeOperator */: - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 191 /* SyntaxKind.ConditionalType */: + case 195 /* SyntaxKind.TypeOperator */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return isResolvedByTypeAlias(parent); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; } return false; @@ -61438,28 +62140,28 @@ var ts; // of a type alias. function mayResolveTypeAlias(node) { switch (node.kind) { - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return isJSDocTypeReference(node) || !!(resolveTypeReferenceName(node, 788968 /* SymbolFlags.Type */).flags & 524288 /* SymbolFlags.TypeAlias */); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return true; - case 193 /* SyntaxKind.TypeOperator */: - return node.operator !== 154 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 197 /* SyntaxKind.NamedTupleMember */: - case 316 /* SyntaxKind.JSDocOptionalType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 195 /* SyntaxKind.TypeOperator */: + return node.operator !== 156 /* SyntaxKind.UniqueKeyword */ && mayResolveTypeAlias(node.type); + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 199 /* SyntaxKind.NamedTupleMember */: + case 319 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return mayResolveTypeAlias(node.type); - case 186 /* SyntaxKind.RestType */: - return node.type.kind !== 183 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 188 /* SyntaxKind.RestType */: + return node.type.kind !== 185 /* SyntaxKind.ArrayType */ || mayResolveTypeAlias(node.type.elementType); + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return ts.some(node.types, mayResolveTypeAlias); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return mayResolveTypeAlias(node.objectType) || mayResolveTypeAlias(node.indexType); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return mayResolveTypeAlias(node.checkType) || mayResolveTypeAlias(node.extendsType) || mayResolveTypeAlias(node.trueType) || mayResolveTypeAlias(node.falseType); } @@ -61472,19 +62174,19 @@ var ts; if (target === emptyGenericType) { links.resolvedType = emptyObjectType; } - else if (!(node.kind === 184 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { - links.resolvedType = node.kind === 184 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : + else if (!(node.kind === 186 /* SyntaxKind.TupleType */ && ts.some(node.elements, function (e) { return !!(getTupleElementFlags(e) & 8 /* ElementFlags.Variadic */); })) && isDeferredTypeReferenceNode(node)) { + links.resolvedType = node.kind === 186 /* SyntaxKind.TupleType */ && node.elements.length === 0 ? target : createDeferredTypeReference(target, node, /*mapper*/ undefined); } else { - var elementTypes = node.kind === 183 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); + var elementTypes = node.kind === 185 /* SyntaxKind.ArrayType */ ? [getTypeFromTypeNode(node.elementType)] : ts.map(node.elements, getTypeFromTypeNode); links.resolvedType = createNormalizedTypeReference(target, elementTypes); } } return links.resolvedType; } function isReadonlyTypeOperator(node) { - return ts.isTypeOperatorNode(node) && node.operator === 145 /* SyntaxKind.ReadonlyKeyword */; + return ts.isTypeOperatorNode(node) && node.operator === 146 /* SyntaxKind.ReadonlyKeyword */; } function createTupleType(elementTypes, elementFlags, readonly, namedMemberDeclarations) { if (readonly === void 0) { readonly = false; } @@ -61599,7 +62301,7 @@ var ts; var lastRequiredIndex = -1; var firstRestIndex = -1; var lastOptionalOrRestIndex = -1; - var _loop_16 = function (i) { + var _loop_17 = function (i) { var type = elementTypes[i]; var flags = target.elementFlags[i]; if (flags & 8 /* ElementFlags.Variadic */) { @@ -61629,9 +62331,9 @@ var ts; } }; for (var i = 0; i < elementTypes.length; i++) { - var state_4 = _loop_16(i); - if (typeof state_4 === "object") - return state_4.value; + var state_5 = _loop_17(i); + if (typeof state_5 === "object") + return state_5.value; } // Turn optional elements preceding the last required element into required elements for (var i = 0; i < lastRequiredIndex; i++) { @@ -61659,7 +62361,7 @@ var ts; if (flags & (2 /* ElementFlags.Optional */ | 4 /* ElementFlags.Rest */)) { lastOptionalOrRestIndex = expandedFlags.length; } - expandedTypes.push(type); + expandedTypes.push(flags & 2 /* ElementFlags.Optional */ ? addOptionality(type, /*isProperty*/ true) : type); expandedFlags.push(flags); if (expandedDeclarations && declaration) { expandedDeclarations.push(declaration); @@ -61825,7 +62527,7 @@ var ts; var templates = ts.filter(types, isPatternLiteralType); if (templates.length) { var i = types.length; - var _loop_17 = function () { + var _loop_18 = function () { i--; var t = types[i]; if (t.flags & 128 /* TypeFlags.StringLiteral */ && ts.some(templates, function (template) { return isTypeMatchedByTemplateLiteralType(t, template); })) { @@ -61833,7 +62535,7 @@ var ts; } }; while (i > 0) { - _loop_17(); + _loop_18(); } } } @@ -61910,14 +62612,14 @@ var ts; var namedUnions = []; addNamedUnions(namedUnions, types); var reducedTypes = []; - var _loop_18 = function (t) { + var _loop_19 = function (t) { if (!ts.some(namedUnions, function (union) { return containsType(union.types, t); })) { reducedTypes.push(t); } }; for (var _i = 0, typeSet_1 = typeSet; _i < typeSet_1.length; _i++) { var t = typeSet_1[_i]; - _loop_18(t); + _loop_19(t); } if (!aliasSymbol && namedUnions.length === 1 && reducedTypes.length === 0) { return namedUnions[0]; @@ -62407,7 +63109,7 @@ var ts; type.flags & 16777216 /* TypeFlags.Conditional */ ? type.root.isDistributive && type.checkType === typeVariable : type.flags & (3145728 /* TypeFlags.UnionOrIntersection */ | 134217728 /* TypeFlags.TemplateLiteral */) ? ts.every(type.types, isDistributive) : type.flags & 8388608 /* TypeFlags.IndexedAccess */ ? isDistributive(type.objectType) && isDistributive(type.indexType) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.substitute) : + type.flags & 33554432 /* TypeFlags.Substitution */ ? isDistributive(type.baseType) && isDistributive(type.constraint) : type.flags & 268435456 /* TypeFlags.StringMapping */ ? isDistributive(type.type) : false; } @@ -62488,15 +63190,15 @@ var ts; var links = getNodeLinks(node); if (!links.resolvedType) { switch (node.operator) { - case 140 /* SyntaxKind.KeyOfKeyword */: + case 141 /* SyntaxKind.KeyOfKeyword */: links.resolvedType = getIndexType(getTypeFromTypeNode(node.type)); break; - case 154 /* SyntaxKind.UniqueKeyword */: - links.resolvedType = node.type.kind === 151 /* SyntaxKind.SymbolKeyword */ + case 156 /* SyntaxKind.UniqueKeyword */: + links.resolvedType = node.type.kind === 153 /* SyntaxKind.SymbolKeyword */ ? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent)) : errorType; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: links.resolvedType = getTypeFromTypeNode(node.type); break; default: @@ -62532,8 +63234,14 @@ var ts; return getStringLiteralType(text); } newTexts.push(text); - if (ts.every(newTexts, function (t) { return t === ""; }) && ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) { - return stringType; + if (ts.every(newTexts, function (t) { return t === ""; })) { + if (ts.every(newTypes, function (t) { return !!(t.flags & 4 /* TypeFlags.String */); })) { + return stringType; + } + // Normalize `${Mapping}` into Mapping + if (newTypes.length === 1 && isPatternLiteralType(newTypes[0])) { + return newTypes[0]; + } } var id = "".concat(getTypeListId(newTypes), "|").concat(ts.map(newTexts, function (t) { return t.length; }).join(","), "|").concat(newTexts.join("")); var type = templateLiteralTypes.get(id); @@ -62592,12 +63300,14 @@ var ts; } function getStringMappingType(symbol, type) { return type.flags & (1048576 /* TypeFlags.Union */ | 131072 /* TypeFlags.Never */) ? mapType(type, function (t) { return getStringMappingType(symbol, t); }) : - // Mapping> === Mapping - type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type : - isGenericIndexType(type) || isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, isPatternLiteralPlaceholderType(type) && !(type.flags & 268435456 /* TypeFlags.StringMapping */) ? getTemplateLiteralType(["", ""], [type]) : type) : - type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : - type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) : - type; + type.flags & 128 /* TypeFlags.StringLiteral */ ? getStringLiteralType(applyStringMapping(symbol, type.value)) : + type.flags & 134217728 /* TypeFlags.TemplateLiteral */ ? getTemplateLiteralType.apply(void 0, applyTemplateStringMapping(symbol, type.texts, type.types)) : + // Mapping> === Mapping + type.flags & 268435456 /* TypeFlags.StringMapping */ && symbol === type.symbol ? type : + type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 268435456 /* TypeFlags.StringMapping */) || isGenericIndexType(type) ? getStringMappingTypeForGenericType(symbol, type) : + // This handles Mapping<`${number}`> and Mapping<`${bigint}`> + isPatternLiteralPlaceholderType(type) ? getStringMappingTypeForGenericType(symbol, getTemplateLiteralType(["", ""], [type])) : + type; } function applyStringMapping(symbol, str) { switch (intrinsicTypeKinds.get(symbol.escapedName)) { @@ -62688,7 +63398,7 @@ var ts; } function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, accessNode, accessFlags) { var _a; - var accessExpression = accessNode && accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; + var accessExpression = accessNode && accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode : undefined; var propName = accessNode && ts.isPrivateIdentifier(accessNode) ? undefined : getPropertyNameFromIndex(indexType, accessNode); if (propName !== undefined) { if (accessFlags & 256 /* AccessFlags.Contextual */) { @@ -62762,7 +63472,18 @@ var ts; return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; } errorIfWritingToReadonlyIndex(indexInfo); - return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type; + // When accessing an enum object with its own type, + // e.g. E[E.A] for enum E { A }, undefined shouldn't + // be included in the result type + if ((accessFlags & 1 /* AccessFlags.IncludeUndefined */) && + !(objectType.symbol && + objectType.symbol.flags & (256 /* SymbolFlags.RegularEnum */ | 128 /* SymbolFlags.ConstEnum */) && + (indexType.symbol && + indexType.flags & 1024 /* TypeFlags.EnumLiteral */ && + getParentOfSymbol(indexType.symbol) === objectType.symbol))) { + return getUnionType([indexInfo.type, undefinedType]); + } + return indexInfo.type; } if (indexType.flags & 131072 /* TypeFlags.Never */) { return neverType; @@ -62859,16 +63580,17 @@ var ts; } } function getIndexNodeForAccessExpression(accessNode) { - return accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : - accessNode.kind === 194 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : - accessNode.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : + return accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ ? accessNode.argumentExpression : + accessNode.kind === 196 /* SyntaxKind.IndexedAccessType */ ? accessNode.indexType : + accessNode.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? accessNode.expression : accessNode; } function isPatternLiteralPlaceholderType(type) { - return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || !!(type.flags & 268435456 /* TypeFlags.StringMapping */ && isPatternLiteralPlaceholderType(type.type)); + return !!(type.flags & (1 /* TypeFlags.Any */ | 4 /* TypeFlags.String */ | 8 /* TypeFlags.Number */ | 64 /* TypeFlags.BigInt */)) || isPatternLiteralType(type); } function isPatternLiteralType(type) { - return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType); + return !!(type.flags & 134217728 /* TypeFlags.TemplateLiteral */) && ts.every(type.types, isPatternLiteralPlaceholderType) || + !!(type.flags & 268435456 /* TypeFlags.StringMapping */) && isPatternLiteralPlaceholderType(type.type); } function isGenericType(type) { return !!getGenericObjectFlags(type); @@ -62890,7 +63612,7 @@ var ts; if (type.flags & 33554432 /* TypeFlags.Substitution */) { if (!(type.objectFlags & 2097152 /* ObjectFlags.IsGenericTypeComputed */)) { type.objectFlags |= 2097152 /* ObjectFlags.IsGenericTypeComputed */ | - getGenericObjectFlags(type.substitute) | getGenericObjectFlags(type.baseType); + getGenericObjectFlags(type.baseType) | getGenericObjectFlags(type.constraint); } return type.objectFlags & 12582912 /* ObjectFlags.IsGenericType */; } @@ -63041,7 +63763,7 @@ var ts; // for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in an expression. This is to // preserve backwards compatibility. For example, an element access 'this["foo"]' has always been resolved // eagerly using the constraint type of 'this' at the given location. - if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 194 /* SyntaxKind.IndexedAccessType */ ? + if (isGenericIndexType(indexType) || (accessNode && accessNode.kind !== 196 /* SyntaxKind.IndexedAccessType */ ? isGenericTupleType(objectType) && !indexTypeLessThan(indexType, objectType.target.fixedLength) : isGenericObjectType(objectType) && !(isTupleType(objectType) && indexTypeLessThan(indexType, objectType.target.fixedLength)))) { if (objectType.flags & 3 /* TypeFlags.AnyOrUnknown */) { @@ -63093,11 +63815,7 @@ var ts; var objectType = getTypeFromTypeNode(node.objectType); var indexType = getTypeFromTypeNode(node.indexType); var potentialAlias = getAliasSymbolForTypeNode(node); - var resolved = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); - links.resolvedType = resolved.flags & 8388608 /* TypeFlags.IndexedAccess */ && - resolved.objectType === objectType && - resolved.indexType === indexType ? - getConditionalFlowTypeOfType(resolved, node) : resolved; + links.resolvedType = getIndexedAccessType(objectType, indexType, 0 /* AccessFlags.None */, node, potentialAlias, getTypeArgumentsForAliasSymbol(potentialAlias)); } return links.resolvedType; } @@ -63151,18 +63869,23 @@ var ts; var result; var extraTypes; var tailCount = 0; - var _loop_19 = function () { + // We loop here for an immediately nested conditional type in the false position, effectively treating + // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for + // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of + // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive + // cases we increment the tail recursion counter and stop after 1000 iterations. + while (true) { if (tailCount === 1000) { error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite); result = errorType; - return "break"; + break; } var isUnwrapped = isTypicalNondistributiveConditional(root); var checkType = instantiateType(unwrapNondistributiveConditionalTuple(root, getActualTypeVariable(root.checkType)), mapper); var checkTypeInstantiable = isGenericType(checkType); var extendsType = instantiateType(unwrapNondistributiveConditionalTuple(root, root.extendsType), mapper); if (checkType === wildcardType || extendsType === wildcardType) { - return { value: wildcardType }; + return wildcardType; } var combinedMapper = void 0; if (root.inferTypeParameters) { @@ -63195,11 +63918,7 @@ var ts; } } } - // We skip inference of the possible `infer` types unles the `extendsType` _is_ an infer type - // if it was, it's trivial to say that extendsType = checkType, however such a pattern is used to - // "reset" the type being build up during constraint calculation and avoid making an apparently "infinite" constraint - // so in those cases we refain from performing inference and retain the uninfered type parameter - if (!checkTypeInstantiable || !ts.some(root.inferTypeParameters, function (t) { return t === extendsType; })) { + if (!checkTypeInstantiable) { // We don't want inferences from constraints as they may cause us to eagerly resolve the // conditional type instead of deferring resolution. Also, we always want strict function // types rules (i.e. proper contravariance) for inferences. @@ -63231,14 +63950,14 @@ var ts; var newRoot = falseType_1.root; if (newRoot.node.parent === root.node && (!newRoot.isDistributive || newRoot.checkType === root.checkType)) { root = newRoot; - return "continue"; + continue; } if (canTailRecurse(falseType_1, mapper)) { - return "continue"; + continue; } } result = instantiateType(falseType_1, mapper); - return "break"; + break; } // Return trueType for a definitely true extends check. We check instantiations of the two // types with type parameters mapped to their restrictive form, i.e. a form of the type parameter @@ -63249,10 +63968,10 @@ var ts; var trueType_1 = getTypeFromTypeNode(root.node.trueType); var trueMapper = combinedMapper || mapper; if (canTailRecurse(trueType_1, trueMapper)) { - return "continue"; + continue; } result = instantiateType(trueType_1, trueMapper); - return "break"; + break; } } // Return a deferred type for a check that is neither definitely true nor definitely false @@ -63264,19 +63983,7 @@ var ts; result.combinedMapper = combinedMapper; result.aliasSymbol = aliasSymbol || root.aliasSymbol; result.aliasTypeArguments = aliasSymbol ? aliasTypeArguments : instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217 - return "break"; - }; - // We loop here for an immediately nested conditional type in the false position, effectively treating - // types of the form 'A extends B ? X : C extends D ? Y : E extends F ? Z : ...' as a single construct for - // purposes of resolution. We also loop here when resolution of a conditional type ends in resolution of - // another (or, through recursion, possibly the same) conditional type. In the potentially tail-recursive - // cases we increment the tail recursion counter and stop after 1000 iterations. - while (true) { - var state_5 = _loop_19(); - if (typeof state_5 === "object") - return state_5.value; - if (state_5 === "break") - break; + break; } return extraTypes ? getUnionType(ts.append(extraTypes, result)) : result; // We tail-recurse for generic conditional types that (a) have not already been evaluated and cached, and @@ -63468,7 +64175,7 @@ var ts; } function getAliasSymbolForTypeNode(node) { var host = node.parent; - while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + while (ts.isParenthesizedTypeNode(host) || ts.isJSDocTypeExpression(host) || ts.isTypeOperatorNode(host) && host.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { host = host.parent; } return ts.isTypeAlias(host) ? getSymbolOfNode(host) : undefined; @@ -63713,7 +64420,7 @@ var ts; function getThisType(node) { var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); var parent = container && container.parent; - if (parent && (ts.isClassLike(parent) || parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (parent && (ts.isClassLike(parent) || parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */)) { if (!ts.isStatic(container) && (!ts.isConstructorDeclaration(container) || ts.isNodeDescendantOf(node, container.body))) { return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType; @@ -63748,17 +64455,17 @@ var ts; } function getArrayElementTypeNode(node) { switch (node.kind) { - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return getArrayElementTypeNode(node.type); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: if (node.elements.length === 1) { node = node.elements[0]; - if (node.kind === 186 /* SyntaxKind.RestType */ || node.kind === 197 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { + if (node.kind === 188 /* SyntaxKind.RestType */ || node.kind === 199 /* SyntaxKind.NamedTupleMember */ && node.dotDotDotToken) { return getArrayElementTypeNode(node.type); } } break; - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return node.elementType; } return undefined; @@ -63774,99 +64481,99 @@ var ts; } function getTypeFromTypeNodeWorker(node) { switch (node.kind) { - case 130 /* SyntaxKind.AnyKeyword */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: + case 131 /* SyntaxKind.AnyKeyword */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return anyType; - case 155 /* SyntaxKind.UnknownKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: return unknownType; - case 150 /* SyntaxKind.StringKeyword */: + case 152 /* SyntaxKind.StringKeyword */: return stringType; - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return numberType; - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return bigintType; - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return booleanType; - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return esSymbolType; case 114 /* SyntaxKind.VoidKeyword */: return voidType; - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return undefinedType; case 104 /* SyntaxKind.NullKeyword */: // TODO(rbuckton): `NullKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service. return nullType; - case 143 /* SyntaxKind.NeverKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return neverType; - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return node.flags & 262144 /* NodeFlags.JavaScriptFile */ && !noImplicitAny ? anyType : nonPrimitiveType; - case 138 /* SyntaxKind.IntrinsicKeyword */: + case 139 /* SyntaxKind.IntrinsicKeyword */: return intrinsicMarkerType; - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: case 108 /* SyntaxKind.ThisKeyword */: // TODO(rbuckton): `ThisKeyword` is no longer a `TypeNode`, but we defensively allow it here because of incorrect casts in the Language Service and because of `isPartOfTypeNode`. return getTypeFromThisTypeNode(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return getTypeFromLiteralTypeNode(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return getTypeFromTypeReference(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? voidType : booleanType; - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return getTypeFromTypeReference(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return getTypeFromTypeQueryNode(node); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return getTypeFromArrayOrTupleTypeNode(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return getTypeFromOptionalTypeNode(node); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return getTypeFromUnionTypeNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return getTypeFromIntersectionTypeNode(node); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return getTypeFromJSDocNullableTypeNode(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return addOptionality(getTypeFromTypeNode(node.type)); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return getTypeFromNamedTupleTypeNode(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return getTypeFromTypeNode(node.type); - case 186 /* SyntaxKind.RestType */: + case 188 /* SyntaxKind.RestType */: return getTypeFromRestTypeNode(node); - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return getTypeFromJSDocVariadicType(node); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 323 /* SyntaxKind.JSDocSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 326 /* SyntaxKind.JSDocSignature */: return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return getTypeFromTypeOperatorNode(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return getTypeFromIndexedAccessTypeNode(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return getTypeFromMappedTypeNode(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getTypeFromConditionalTypeNode(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return getTypeFromInferTypeNode(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return getTypeFromTemplateTypeNode(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return getTypeFromImportTypeNode(node); // This function assumes that an identifier, qualified name, or property access expression is a type expression // Callers should first ensure this by calling `isPartOfTypeNode` // TODO(rbuckton): These aren't valid TypeNodes, but we treat them as such because of `isPartOfTypeNode`, which returns `true` for things that aren't `TypeNode`s. case 79 /* SyntaxKind.Identifier */: - case 161 /* SyntaxKind.QualifiedName */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: var symbol = getSymbolAtLocation(node); return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType; default: @@ -63973,8 +64680,8 @@ var ts; return !mapper ? makeUnaryTypeMapper(source, target) : makeCompositeTypeMapper(5 /* TypeMapKind.Merged */, mapper, makeUnaryTypeMapper(source, target)); } function getRestrictiveTypeParameter(tp) { - return tp.constraint === unknownType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), - tp.restrictiveInstantiation.constraint = unknownType, + return !tp.constraint && !getConstraintDeclaration(tp) || tp.constraint === noConstraintType ? tp : tp.restrictiveInstantiation || (tp.restrictiveInstantiation = createTypeParameter(tp.symbol), + tp.restrictiveInstantiation.constraint = noConstraintType, tp.restrictiveInstantiation); } function cloneTypeParameter(typeParameter) { @@ -64088,17 +64795,18 @@ var ts; return type; } function maybeTypeParameterReference(node) { - return !(node.parent.kind === 178 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || - node.parent.kind === 200 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); + return !(node.parent.kind === 180 /* SyntaxKind.TypeReference */ && node.parent.typeArguments && node === node.parent.typeName || + node.parent.kind === 202 /* SyntaxKind.ImportType */ && node.parent.typeArguments && node === node.parent.qualifier); } function isTypeParameterPossiblyReferenced(tp, node) { - // If the type parameter doesn't have exactly one declaration, if there are invening statement blocks + // If the type parameter doesn't have exactly one declaration, if there are intervening statement blocks // between the node and the type parameter declaration, if the node contains actual references to the - // type parameter, or if the node contains type queries, we consider the type parameter possibly referenced. + // type parameter, or if the node contains type queries that we can't prove couldn't contain references to the type parameter, + // we consider the type parameter possibly referenced. if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) { var container = tp.symbol.declarations[0].parent; for (var n = node; n !== container; n = n.parent) { - if (!n || n.kind === 235 /* SyntaxKind.Block */ || n.kind === 189 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { + if (!n || n.kind === 238 /* SyntaxKind.Block */ || n.kind === 191 /* SyntaxKind.ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) { return true; } } @@ -64107,15 +64815,36 @@ var ts; return true; function containsReference(node) { switch (node.kind) { - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return !!tp.isThisType; case 79 /* SyntaxKind.Identifier */: return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) && getTypeFromTypeNodeWorker(node) === tp; // use worker because we're looking for === equality - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: + var entityName = node.exprName; + var firstIdentifier = ts.getFirstIdentifier(entityName); + var firstIdentifierSymbol = getResolvedSymbol(firstIdentifier); + var tpDeclaration = tp.symbol.declarations[0]; // There is exactly one declaration, otherwise `containsReference` is not called + var tpScope_1; + if (tpDeclaration.kind === 165 /* SyntaxKind.TypeParameter */) { // Type parameter is a regular type parameter, e.g. foo + tpScope_1 = tpDeclaration.parent; + } + else if (tp.isThisType) { + // Type parameter is the this type, and its declaration is the class declaration. + tpScope_1 = tpDeclaration; + } + else { + // Type parameter's declaration was unrecognized. + // This could happen if the type parameter comes from e.g. a JSDoc annotation, so we default to returning true. + return true; + } + if (firstIdentifierSymbol.declarations) { + return ts.some(firstIdentifierSymbol.declarations, function (idDecl) { return ts.isNodeDescendantOf(idDecl, tpScope_1); }) || + ts.some(node.typeArguments, containsReference); + } return true; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return !node.type && !!node.body || ts.some(node.typeParameters, containsReference) || ts.some(node.parameters, containsReference) || @@ -64337,17 +65066,18 @@ var ts; return getConditionalTypeInstantiation(type, combineTypeMappers(type.mapper, mapper), aliasSymbol, aliasTypeArguments); } if (flags & 33554432 /* TypeFlags.Substitution */) { - var maybeVariable = instantiateType(type.baseType, mapper); - if (maybeVariable.flags & 8650752 /* TypeFlags.TypeVariable */) { - return getSubstitutionType(maybeVariable, instantiateType(type.substitute, mapper)); + var newBaseType = instantiateType(type.baseType, mapper); + var newConstraint = instantiateType(type.constraint, mapper); + // A substitution type originates in the true branch of a conditional type and can be resolved + // to just the base type in the same cases as the conditional type resolves to its true branch + // (because the base type is then known to satisfy the constraint). + if (newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ && isGenericType(newConstraint)) { + return getSubstitutionType(newBaseType, newConstraint); } - else { - var sub = instantiateType(type.substitute, mapper); - if (sub.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) { - return maybeVariable; - } - return sub; + if (newConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(newBaseType), getRestrictiveInstantiation(newConstraint))) { + return newBaseType; } + return newBaseType.flags & 8650752 /* TypeFlags.TypeVariable */ ? getSubstitutionType(newBaseType, newConstraint) : getIntersectionType([newConstraint, newBaseType]); } return type; } @@ -64396,35 +65126,35 @@ var ts; // Returns true if the given expression contains (at any level of nesting) a function or arrow expression // that is subject to contextual typing. function isContextSensitive(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Function declarations can have context when annotated with a jsdoc @type return isContextSensitiveFunctionLikeDeclaration(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return ts.some(node.properties, isContextSensitive); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return ts.some(node.elements, isContextSensitive); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isContextSensitive(node.whenTrue) || isContextSensitive(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ || node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) && (isContextSensitive(node.left) || isContextSensitive(node.right)); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return isContextSensitive(node.initializer); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isContextSensitive(node.expression); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive); - case 285 /* SyntaxKind.JsxAttribute */: { + case 288 /* SyntaxKind.JsxAttribute */: { // If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive. var initializer = node.initializer; return !!initializer && isContextSensitive(initializer); } - case 288 /* SyntaxKind.JsxExpression */: { + case 291 /* SyntaxKind.JsxExpression */: { // It is possible to that node.expression is undefined (e.g
) var expression = node.expression; return !!expression && isContextSensitive(expression); @@ -64433,15 +65163,14 @@ var ts; return false; } function isContextSensitiveFunctionLikeDeclaration(node) { - return (!ts.isFunctionDeclaration(node) || ts.isInJSFile(node) && !!getTypeForDeclarationFromJSDocComment(node)) && - (ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node)); + return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node); } function hasContextSensitiveReturnExpression(node) { // TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value. - return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 235 /* SyntaxKind.Block */ && isContextSensitive(node.body); + return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 238 /* SyntaxKind.Block */ && isContextSensitive(node.body); } function isContextSensitiveFunctionOrObjectLiteralMethod(func) { - return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && + return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) && isContextSensitiveFunctionLikeDeclaration(func); } function getTypeWithoutSignatures(type) { @@ -64542,23 +65271,23 @@ var ts; return true; } switch (node.kind) { - case 288 /* SyntaxKind.JsxExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 291 /* SyntaxKind.JsxExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return elaborateError(node.expression, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 27 /* SyntaxKind.CommaToken */: return elaborateError(node.right, source, target, relation, headMessage, containingMessageChain, errorOutputContainer); } break; - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return elaborateObjectLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return elaborateArrayLiteral(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return elaborateJsxComponents(node, source, target, relation, containingMessageChain, errorOutputContainer); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return elaborateArrowFunction(node, source, target, relation, containingMessageChain, errorOutputContainer); } return false; @@ -64767,7 +65496,7 @@ var ts; } function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) { switch (child.kind) { - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: // child is of the type of the expression return { errorNode: child, innerExpression: child.expression, nameType: nameType }; case 11 /* SyntaxKind.JsxText */: @@ -64776,9 +65505,9 @@ var ts; } // child is a string return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() }; - case 278 /* SyntaxKind.JsxElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 282 /* SyntaxKind.JsxFragment */: + case 281 /* SyntaxKind.JsxElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 285 /* SyntaxKind.JsxFragment */: // child is of type JSX.Element return { errorNode: child, innerExpression: child, nameType: nameType }; default: @@ -64926,11 +65655,11 @@ var ts; } _b = prop.kind; switch (_b) { - case 173 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; - case 172 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; - case 169 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; - case 296 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; + case 175 /* SyntaxKind.SetAccessor */: return [3 /*break*/, 2]; + case 174 /* SyntaxKind.GetAccessor */: return [3 /*break*/, 2]; + case 171 /* SyntaxKind.MethodDeclaration */: return [3 /*break*/, 2]; + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return [3 /*break*/, 2]; + case 299 /* SyntaxKind.PropertyAssignment */: return [3 /*break*/, 4]; } return [3 /*break*/, 6]; case 2: return [4 /*yield*/, { errorNode: prop.name, innerExpression: undefined, nameType: type }]; @@ -65003,8 +65732,8 @@ var ts; void instantiateType(sourceRestType || targetRestType, reportUnreliableMarkers); } var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; - var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 169 /* SyntaxKind.MethodDeclaration */ && - kind !== 168 /* SyntaxKind.MethodSignature */ && kind !== 171 /* SyntaxKind.Constructor */; + var strictVariance = !(checkMode & 3 /* SignatureCheckMode.Callback */) && strictFunctionTypes && kind !== 171 /* SyntaxKind.MethodDeclaration */ && + kind !== 170 /* SyntaxKind.MethodSignature */ && kind !== 173 /* SyntaxKind.Constructor */; var result = -1 /* Ternary.True */; var sourceThisType = getThisTypeOfSignature(source); if (sourceThisType && sourceThisType !== voidType) { @@ -65301,7 +66030,7 @@ var ts; var t = isFreshLiteralType(type) ? type.regularType : ts.getObjectFlags(type) & 4 /* ObjectFlags.Reference */ ? type.node ? createTypeReference(type.target, getTypeArguments(type)) : getSingleBaseForNonAugmentingSubtype(type) || type : type.flags & 3145728 /* TypeFlags.UnionOrIntersection */ ? getNormalizedUnionOrIntersectionType(type, writing) : - type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : type.substitute : + type.flags & 33554432 /* TypeFlags.Substitution */ ? writing ? type.baseType : getSubstitutionIntersection(type) : type.flags & 25165824 /* TypeFlags.Simplifiable */ ? getSimplifiedType(type, writing) : type; if (t === type) @@ -65708,7 +66437,8 @@ var ts; return 0 /* Ternary.False */; } } - var isPerformingCommonPropertyChecks = relation !== comparableRelation && !(intersectionState & 2 /* IntersectionState.Target */) && + var isPerformingCommonPropertyChecks = (relation !== comparableRelation || isUnitType(source)) && + !(intersectionState & 2 /* IntersectionState.Target */) && source.flags & (131068 /* TypeFlags.Primitive */ | 524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && source !== globalObjectType && target.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) && isWeakType(target) && (getPropertiesOfType(source).length > 0 || typeHasCallOrConstructSignatures(source)); @@ -65735,27 +66465,6 @@ var ts; var result_7 = skipCaching ? unionOrIntersectionRelatedTo(source, target, reportErrors, intersectionState) : recursiveTypeRelatedTo(source, target, reportErrors, intersectionState, recursionFlags); - // For certain combinations involving intersections and optional, excess, or mismatched properties we need - // an extra property check where the intersection is viewed as a single object. The following are motivating - // examples that all should be errors, but aren't without this extra property check: - // - // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property - // - // declare let wrong: { a: { y: string } }; - // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type - // - // function foo(x: { a?: string }, y: T & { a: boolean }) { - // x = y; // Mismatched property in source intersection - // } - // - // We suppress recursive intersection property checks because they can generate lots of work when relating - // recursive intersections that are structurally similar but not exactly identical. See #37854. - if (result_7 && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && (isPerformingExcessPropertyChecks || isPerformingCommonPropertyChecks) || - isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) { - inPropertyCheck = true; - result_7 &= recursiveTypeRelatedTo(source, target, reportErrors, 4 /* IntersectionState.PropertyCheck */, recursionFlags); - inPropertyCheck = false; - } if (result_7) { return result_7; } @@ -65960,11 +66669,15 @@ var ts; // parameter 'T extends 1 | 2', the intersection 'T & 1' should be reduced to '1' such that it doesn't // appear to be comparable to '2'. if (relation === comparableRelation && target.flags & 131068 /* TypeFlags.Primitive */) { - var constraints = ts.sameMap(source.types, getBaseConstraintOrType); + var constraints = ts.sameMap(source.types, function (t) { return t.flags & 465829888 /* TypeFlags.Instantiable */ ? getBaseConstraintOfType(t) || unknownType : t; }); if (constraints !== source.types) { source = getIntersectionType(constraints); + if (source.flags & 131072 /* TypeFlags.Never */) { + return 0 /* Ternary.False */; + } if (!(source.flags & 2097152 /* TypeFlags.Intersection */)) { - return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); + return isRelatedTo(source, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false) || + isRelatedTo(target, source, 1 /* RecursionFlags.Source */, /*reportErrors*/ false); } } } @@ -66149,8 +66862,7 @@ var ts; if (overflow) { return 0 /* Ternary.False */; } - var keyIntersectionState = intersectionState | (inPropertyCheck ? 8 /* IntersectionState.InPropertyCheck */ : 0); - var id = getRelationKey(source, target, keyIntersectionState, relation, /*ingnoreConstraints*/ false); + var id = getRelationKey(source, target, intersectionState, relation, /*ingnoreConstraints*/ false); var entry = relation.get(id); if (entry !== undefined) { if (reportErrors && entry & 2 /* RelationComparisonResult.Failed */ && !(entry & 4 /* RelationComparisonResult.Reported */)) { @@ -66180,7 +66892,7 @@ var ts; // A key that starts with "*" is an indication that we have type references that reference constrained // type parameters. For such keys we also check against the key we would have gotten if all type parameters // were unconstrained. - var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, keyIntersectionState, relation, /*ignoreConstraints*/ true) : undefined; + var broadestEquivalentId = id.startsWith("*") ? getRelationKey(source, target, intersectionState, relation, /*ignoreConstraints*/ true) : undefined; for (var i = 0; i < maybeCount; i++) { // If source and target are already being compared, consider them related with assumptions if (id === maybeKeys[i] || broadestEquivalentId && broadestEquivalentId === maybeKeys[i]) { @@ -66267,7 +66979,7 @@ var ts; function structuredTypeRelatedTo(source, target, reportErrors, intersectionState) { var saveErrorInfo = captureErrorCalculationState(); var result = structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo); - if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) { + if (relation !== identityRelation) { // The combined constraint of an intersection type is the intersection of the constraints of // the constituents. When an intersection type contains instantiable types with union type // constraints, there are situations where we need to examine the combined constraint. One is @@ -66281,10 +66993,33 @@ var ts; // needs to have its constraint hoisted into an intersection with said type parameter, this way // the type param can be compared with itself in the target (with the influence of its constraint to match other parts) // For example, if `T extends 1 | 2` and `U extends 2 | 3` and we compare `T & U` to `T & U & (1 | 2 | 3)` - var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */)); - if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself - // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this - result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); + if (!result && (source.flags & 2097152 /* TypeFlags.Intersection */ || source.flags & 262144 /* TypeFlags.TypeParameter */ && target.flags & 1048576 /* TypeFlags.Union */)) { + var constraint = getEffectiveConstraintOfIntersection(source.flags & 2097152 /* TypeFlags.Intersection */ ? source.types : [source], !!(target.flags & 1048576 /* TypeFlags.Union */)); + if (constraint && everyType(constraint, function (c) { return c !== source; })) { // Skip comparison if expansion contains the source itself + // TODO: Stack errors so we get a pyramid for the "normal" comparison above, _and_ a second for this + result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false, /*headMessage*/ undefined, intersectionState); + } + } + // For certain combinations involving intersections and optional, excess, or mismatched properties we need + // an extra property check where the intersection is viewed as a single object. The following are motivating + // examples that all should be errors, but aren't without this extra property check: + // + // let obj: { a: { x: string } } & { c: number } = { a: { x: 'hello', y: 2 }, c: 5 }; // Nested excess property + // + // declare let wrong: { a: { y: string } }; + // let weak: { a?: { x?: number } } & { c?: string } = wrong; // Nested weak object type + // + // function foo(x: { a?: string }, y: T & { a: boolean }) { + // x = y; // Mismatched property in source intersection + // } + // + // We suppress recursive intersection property checks because they can generate lots of work when relating + // recursive intersections that are structurally similar but not exactly identical. See #37854. + if (result && !inPropertyCheck && (target.flags & 2097152 /* TypeFlags.Intersection */ && !isGenericObjectType(target) && source.flags & (524288 /* TypeFlags.Object */ | 2097152 /* TypeFlags.Intersection */) || + isNonGenericObjectType(target) && !isArrayOrTupleType(target) && source.flags & 2097152 /* TypeFlags.Intersection */ && getApparentType(source).flags & 3670016 /* TypeFlags.StructuredType */ && !ts.some(source.types, function (t) { return !!(ts.getObjectFlags(t) & 262144 /* ObjectFlags.NonInferrableType */); }))) { + inPropertyCheck = true; + result &= propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */); + inPropertyCheck = false; } } if (result) { @@ -66293,9 +67028,6 @@ var ts; return result; } function structuredTypeRelatedToWorker(source, target, reportErrors, intersectionState, saveErrorInfo) { - if (intersectionState & 4 /* IntersectionState.PropertyCheck */) { - return propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined, 0 /* IntersectionState.None */); - } var result; var originalErrorInfo; var varianceCheckFailed = false; @@ -66334,7 +67066,11 @@ var ts; } } if (sourceFlags & 33554432 /* TypeFlags.Substitution */) { - return isRelatedTo(source.substitute, target.substitute, 3 /* RecursionFlags.Both */, /*reportErrors*/ false); + if (result = isRelatedTo(source.baseType, target.baseType, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + if (result &= isRelatedTo(source.constraint, target.constraint, 3 /* RecursionFlags.Both */, /*reportErrors*/ false)) { + return result; + } + } } if (!(sourceFlags & 524288 /* TypeFlags.Object */)) { return 0 /* Ternary.False */; @@ -66392,7 +67128,7 @@ var ts; // with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!) var constraint = getConstraintOfTypeParameter(source); if (constraint && hasNonCircularBaseConstraint(source)) { - while (constraint && constraint.flags & 262144 /* TypeFlags.TypeParameter */) { + while (constraint && someType(constraint, function (c) { return !!(c.flags & 262144 /* TypeFlags.TypeParameter */); })) { if (result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false)) { return result; } @@ -67048,7 +67784,7 @@ var ts; return 0 /* Ternary.False */; } // When checking for comparability, be more lenient with optional properties. - if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) { + if (!skipOptional && sourceProp.flags & 16777216 /* SymbolFlags.Optional */ && targetProp.flags & 106500 /* SymbolFlags.ClassMember */ && !(targetProp.flags & 16777216 /* SymbolFlags.Optional */)) { // TypeScript 1.0 spec (April 2014): 3.8.3 // S is a subtype of a type T, and T is a supertype of S if ... // S' and T are object types and, for each member M in T.. @@ -67086,7 +67822,7 @@ var ts; shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it } if (props.length === 1) { - var propName = symbolToString(unmatchedProperty); + var propName = symbolToString(unmatchedProperty, /*enclosingDeclaration*/ undefined, 0 /* SymbolFlags.None */, 4 /* SymbolFormatFlags.AllowAnyNodeKind */ | 16 /* SymbolFormatFlags.WriteComputedProps */); reportError.apply(void 0, __spreadArray([ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName], getTypeNamesForErrorDisplay(source, target), false)); if (ts.length(unmatchedProperty.declarations)) { associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName)); @@ -67335,7 +68071,7 @@ var ts; var targetSignature = ts.first(targetSignatures); result = signatureRelatedTo(sourceSignature, targetSignature, eraseGenerics, reportErrors, incompatibleReporter(sourceSignature, targetSignature)); if (!result && reportErrors && kind === 1 /* SignatureKind.Construct */ && (sourceObjectFlags & targetObjectFlags) && - (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 171 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 171 /* SyntaxKind.Constructor */)) { + (((_a = targetSignature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 173 /* SyntaxKind.Constructor */ || ((_b = sourceSignature.declaration) === null || _b === void 0 ? void 0 : _b.kind) === 173 /* SyntaxKind.Constructor */)) { var constructSignatureToString = function (signature) { return signatureToString(signature, /*enclosingDeclaration*/ undefined, 262144 /* TypeFormatFlags.WriteArrowStyleSignature */, kind); }; @@ -68100,7 +68836,7 @@ var ts; var baseTypeNode = getBaseTypeNodeOfClass(target); // A base type expression may circularly reference the class itself (e.g. as an argument to function call), so we only // check for base types specified as simple qualified names. - if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 206 /* SyntaxKind.PropertyAccessExpression */) { + if (baseTypeNode && baseTypeNode.expression.kind !== 79 /* SyntaxKind.Identifier */ && baseTypeNode.expression.kind !== 208 /* SyntaxKind.PropertyAccessExpression */) { return undefined; } } @@ -68148,8 +68884,7 @@ var ts; return !!(type.flags & 109440 /* TypeFlags.Unit */); } function isUnitLikeType(type) { - return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.some(type.types, isUnitType) : - !!(type.flags & 109440 /* TypeFlags.Unit */); + return isUnitType(getBaseConstraintOrType(type)); } function extractUnitType(type) { return type.flags & 2097152 /* TypeFlags.Intersection */ ? ts.find(type.types, isUnitType) || type : type; @@ -68191,7 +68926,7 @@ var ts; if (!isLiteralOfContextualType(type, contextualType)) { type = getWidenedUniqueESSymbolType(getWidenedLiteralType(type)); } - return type; + return getRegularTypeOfLiteralType(type); } function getWidenedLiteralLikeTypeForContextualReturnTypeIfNeeded(type, contextualSignatureReturnType, isAsync) { if (type && isUnitType(type)) { @@ -68286,7 +69021,8 @@ var ts; function getOptionalType(type, isProperty) { if (isProperty === void 0) { isProperty = false; } ts.Debug.assert(strictNullChecks); - return type.flags & 32768 /* TypeFlags.Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]); + var missingOrUndefined = isProperty ? missingType : undefinedType; + return type.flags & 32768 /* TypeFlags.Undefined */ || type.flags & 1048576 /* TypeFlags.Union */ && type.types[0] === missingOrUndefined ? type : getUnionType([type, missingOrUndefined]); } function getGlobalNonNullableTypeInstantiation(type) { if (!deferredGlobalNonNullableTypeAlias) { @@ -68575,12 +69311,12 @@ var ts; } var diagnostic; switch (declaration.kind) { - case 221 /* SyntaxKind.BinaryExpression */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 223 /* SyntaxKind.BinaryExpression */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: var param = declaration; if (ts.isIdentifier(param.name) && (ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) && @@ -68596,23 +69332,23 @@ var ts; noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage : noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage; break; - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type; if (!noImplicitAny) { // Don't issue a suggestion for binding elements since the codefix doesn't yet support them. return; } break; - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString); return; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: if (noImplicitAny && !declaration.name) { if (wideningKind === 3 /* WideningKind.GeneratorYield */) { error(declaration, ts.Diagnostics.Generator_implicitly_has_yield_type_0_because_it_does_not_yield_any_values_Consider_supplying_a_return_type_annotation, typeAsString); @@ -68626,7 +69362,7 @@ var ts; wideningKind === 3 /* WideningKind.GeneratorYield */ ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type : ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: if (noImplicitAny) { error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type); } @@ -68743,7 +69479,7 @@ var ts; if (context.intraExpressionInferenceSites) { for (var _i = 0, _a = context.intraExpressionInferenceSites; _i < _a.length; _i++) { var _b = _a[_i], node = _b.node, type = _b.type; - var contextualType = node.kind === 169 /* SyntaxKind.MethodDeclaration */ ? + var contextualType = node.kind === 171 /* SyntaxKind.MethodDeclaration */ ? getContextualTypeForObjectLiteralMethod(node, 2 /* ContextFlags.NoConstraints */) : getContextualType(node, 2 /* ContextFlags.NoConstraints */); if (contextualType) { @@ -68806,8 +69542,8 @@ var ts; } function isNonGenericTopLevelType(type) { if (type.aliasSymbol && !type.aliasTypeArguments) { - var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 259 /* SyntaxKind.TypeAliasDeclaration */); - return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 305 /* SyntaxKind.SourceFile */ ? true : n.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); + var declaration = ts.getDeclarationOfKind(type.aliasSymbol, 262 /* SyntaxKind.TypeAliasDeclaration */); + return !!(declaration && ts.findAncestor(declaration.parent, function (n) { return n.kind === 308 /* SyntaxKind.SourceFile */ ? true : n.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? false : "quit"; })); } return false; } @@ -69027,7 +69763,7 @@ var ts; && (!roundTripOnly || s === ts.pseudoBigIntToString({ negative: negative, base10Value: ts.parsePseudoBigInt(scanner.getTokenValue()) })); } function isMemberOfStringMapping(source, target) { - if (target.flags & (4 /* TypeFlags.String */ | 3 /* TypeFlags.AnyOrUnknown */)) { + if (target.flags & (4 /* TypeFlags.String */ | 1 /* TypeFlags.Any */)) { return true; } if (target.flags & 134217728 /* TypeFlags.TemplateLiteral */) { @@ -69341,7 +70077,7 @@ var ts; } else if (source.flags & 33554432 /* TypeFlags.Substitution */) { inferFromTypes(source.baseType, target); - inferWithPriority(source.substitute, target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority + inferWithPriority(getSubstitutionIntersection(source), target, 4 /* InferencePriority.SubstituteSource */); // Make substitute inference at a lower priority } else if (target.flags & 16777216 /* TypeFlags.Conditional */) { invokeOnce(source, target, inferToConditionalType); @@ -69823,7 +70559,7 @@ var ts; var saveBivariant = bivariant; var kind = target.declaration ? target.declaration.kind : 0 /* SyntaxKind.Unknown */; // Once we descend into a bivariant signature we remain bivariant for all nested inferences - bivariant = bivariant || kind === 169 /* SyntaxKind.MethodDeclaration */ || kind === 168 /* SyntaxKind.MethodSignature */ || kind === 171 /* SyntaxKind.Constructor */; + bivariant = bivariant || kind === 171 /* SyntaxKind.MethodDeclaration */ || kind === 170 /* SyntaxKind.MethodSignature */ || kind === 173 /* SyntaxKind.Constructor */; applyToParameterTypes(source, target, inferFromContravariantTypesIfStrictFunctionTypes); bivariant = saveBivariant; applyToReturnTypes(source, target, inferFromTypes); @@ -70022,7 +70758,7 @@ var ts; } // falls through default: - if (node.parent.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (node.parent.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer; } else { @@ -70043,7 +70779,7 @@ var ts; // TypeScript 1.0 spec (April 2014): 3.6.3 // A type query consists of the keyword typeof followed by an expression. // The expression is restricted to a single identifier or a sequence of identifiers separated by periods - return !!ts.findAncestor(node, function (n) { return n.kind === 181 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 161 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); + return !!ts.findAncestor(node, function (n) { return n.kind === 183 /* SyntaxKind.TypeQuery */ ? true : n.kind === 79 /* SyntaxKind.Identifier */ || n.kind === 163 /* SyntaxKind.QualifiedName */ ? false : "quit"; }); } // Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers // separated by dots). The key consists of the id of the symbol referenced by the @@ -70059,26 +70795,26 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: return "0|".concat(flowContainer ? getNodeId(flowContainer) : "-1", "|").concat(getTypeId(declaredType), "|").concat(getTypeId(initialType)); - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: var left = getFlowCacheKey(node.left, declaredType, initialType, flowContainer); return left && left + "." + node.right.escapedText; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var propName = getAccessedPropertyName(node); if (propName !== undefined) { var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer); return key && key + "." + propName; } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: // Handle pseudo-references originating in getNarrowedTypeOfSymbol. return "".concat(getNodeId(node), "#").concat(getTypeId(declaredType)); } @@ -70086,16 +70822,16 @@ var ts; } function isMatchingReference(source, target) { switch (target.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return isMatchingReference(source, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isAssignmentExpression(target) && isMatchingReference(source, target.left)) || (ts.isBinaryExpression(target) && target.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source, target.right)); } switch (source.kind) { - case 231 /* SyntaxKind.MetaProperty */: - return target.kind === 231 /* SyntaxKind.MetaProperty */ + case 233 /* SyntaxKind.MetaProperty */: + return target.kind === 233 /* SyntaxKind.MetaProperty */ && source.keywordToken === target.keywordToken && source.name.escapedText === target.name.escapedText; case 79 /* SyntaxKind.Identifier */: @@ -70103,26 +70839,26 @@ var ts; return ts.isThisInTypeQuery(source) ? target.kind === 108 /* SyntaxKind.ThisKeyword */ : target.kind === 79 /* SyntaxKind.Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) || - (target.kind === 254 /* SyntaxKind.VariableDeclaration */ || target.kind === 203 /* SyntaxKind.BindingElement */) && + (target.kind === 257 /* SyntaxKind.VariableDeclaration */ || target.kind === 205 /* SyntaxKind.BindingElement */) && getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target); case 108 /* SyntaxKind.ThisKeyword */: return target.kind === 108 /* SyntaxKind.ThisKeyword */; case 106 /* SyntaxKind.SuperKeyword */: return target.kind === 106 /* SyntaxKind.SuperKeyword */; - case 230 /* SyntaxKind.NonNullExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isMatchingReference(source.expression, target); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var sourcePropertyName = getAccessedPropertyName(source); var targetPropertyName = ts.isAccessExpression(target) ? getAccessedPropertyName(target) : undefined; return sourcePropertyName !== undefined && targetPropertyName !== undefined && targetPropertyName === sourcePropertyName && isMatchingReference(source.expression, target.expression); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return ts.isAccessExpression(target) && source.right.escapedText === getAccessedPropertyName(target) && isMatchingReference(source.left, target.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return (ts.isBinaryExpression(source) && source.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && isMatchingReference(source.right, target)); } return false; @@ -70153,7 +70889,7 @@ var ts; } if (ts.isEntityNameExpression(node.argumentExpression)) { var symbol = resolveEntityName(node.argumentExpression, 111551 /* SymbolFlags.Value */, /*ignoreErrors*/ true); - if (!symbol || !isConstVariable(symbol)) + if (!symbol || !(isConstVariable(symbol) || (symbol.flags & 8 /* SymbolFlags.EnumMember */))) return undefined; var declaration = symbol.valueDeclaration; if (declaration === undefined) @@ -70165,9 +70901,14 @@ var ts; return name; } } - if (ts.hasOnlyExpressionInitializer(declaration)) { + if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) { var initializer = ts.getEffectiveInitializer(declaration); - return initializer && tryGetNameFromType(getTypeOfExpression(initializer)); + if (initializer) { + return tryGetNameFromType(getTypeOfExpression(initializer)); + } + if (ts.isEnumMember(declaration)) { + return ts.getTextOfPropertyName(declaration.name); + } } } return undefined; @@ -70294,7 +71035,7 @@ var ts; } function getMatchingUnionConstituentForObjectLiteral(unionType, node) { var keyPropertyName = getKeyPropertyName(unionType); - var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && + var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); }); var propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); return propType && getConstituentTypeForKeyType(unionType, propType); @@ -70311,7 +71052,7 @@ var ts; } } } - if (expression.expression.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + if (expression.expression.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isOrContainsMatchingReference(reference, expression.expression.expression)) { return true; } @@ -70511,15 +71252,15 @@ var ts; return createArrayType(checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, type, undefinedType, /*errorNode*/ undefined) || errorType); } function getAssignedTypeOfBinaryExpression(node) { - var isDestructuringDefaultAssignment = node.parent.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || - node.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); + var isDestructuringDefaultAssignment = node.parent.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) || + node.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent); return isDestructuringDefaultAssignment ? getTypeWithDefault(getAssignedType(node), node.right) : getTypeOfExpression(node.right); } function isDestructuringAssignmentTarget(parent) { - return parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || - parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; + return parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.left === parent || + parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */ && parent.parent.initializer === parent; } function getAssignedTypeOfArrayLiteralElement(node, element) { return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element)); @@ -70536,21 +71277,21 @@ var ts; function getAssignedType(node) { var parent = node.parent; switch (parent.kind) { - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return stringType; - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkRightHandSideOfForOf(parent) || errorType; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getAssignedTypeOfBinaryExpression(parent); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return undefinedType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return getAssignedTypeOfArrayLiteralElement(parent, node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return getAssignedTypeOfSpreadExpression(parent); - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return getAssignedTypeOfPropertyAssignment(parent); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getAssignedTypeOfShorthandPropertyAssignment(parent); } return errorType; @@ -70558,7 +71299,7 @@ var ts; function getInitialTypeOfBindingElement(node) { var pattern = node.parent; var parentType = getInitialType(pattern.parent); - var type = pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ ? + var type = pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ ? getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) : !node.dotDotDotToken ? getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) : @@ -70576,30 +71317,30 @@ var ts; if (node.initializer) { return getTypeOfInitializer(node.initializer); } - if (node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */) { + if (node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */) { return stringType; } - if (node.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { return checkRightHandSideOfForOf(node.parent.parent) || errorType; } return errorType; } function getInitialType(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ ? + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ ? getInitialTypeOfVariableDeclaration(node) : getInitialTypeOfBindingElement(node); } function isEmptyArrayAssignment(node) { - return node.kind === 254 /* SyntaxKind.VariableDeclaration */ && node.initializer && + return node.kind === 257 /* SyntaxKind.VariableDeclaration */ && node.initializer && isEmptyArrayLiteral(node.initializer) || - node.kind !== 203 /* SyntaxKind.BindingElement */ && node.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + node.kind !== 205 /* SyntaxKind.BindingElement */ && node.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && isEmptyArrayLiteral(node.parent.right); } function getReferenceCandidate(node) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getReferenceCandidate(node.expression); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: switch (node.operatorToken.kind) { case 63 /* SyntaxKind.EqualsToken */: case 75 /* SyntaxKind.BarBarEqualsToken */: @@ -70614,13 +71355,13 @@ var ts; } function getReferenceRoot(node) { var parent = node.parent; - return parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || - parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? + return parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.left === node || + parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 27 /* SyntaxKind.CommaToken */ && parent.right === node ? getReferenceRoot(parent) : node; } function getTypeOfSwitchClause(clause) { - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression)); } return neverType; @@ -70639,13 +71380,13 @@ var ts; // Get the type names from all cases in a switch on `typeof`. The default clause and/or duplicate type names are // represented as undefined. Return undefined if one or more case clause expressions are not string literals. function getSwitchClauseTypeOfWitnesses(switchStatement) { - if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 289 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { + if (ts.some(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 292 /* SyntaxKind.CaseClause */ && !ts.isStringLiteralLike(clause.expression); })) { return undefined; } var witnesses = []; for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) { var clause = _a[_i]; - var text = clause.kind === 289 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; + var text = clause.kind === 292 /* SyntaxKind.CaseClause */ ? clause.expression.text : undefined; witnesses.push(text && !ts.contains(witnesses, text) ? text : undefined); } return witnesses; @@ -70832,12 +71573,12 @@ var ts; var root = getReferenceRoot(node); var parent = root.parent; var isLengthPushOrUnshift = ts.isPropertyAccessExpression(parent) && (parent.name.escapedText === "length" || - parent.parent.kind === 208 /* SyntaxKind.CallExpression */ + parent.parent.kind === 210 /* SyntaxKind.CallExpression */ && ts.isIdentifier(parent.name) && ts.isPushOrUnshiftIdentifier(parent.name)); - var isElementAssignment = parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && + var isElementAssignment = parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === root && - parent.parent.kind === 221 /* SyntaxKind.BinaryExpression */ && + parent.parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */ && parent.parent.left === parent && !ts.isAssignmentTarget(parent.parent) && @@ -70850,6 +71591,7 @@ var ts; ts.isInJSFile(node) && ts.hasInitializer(node) && node.initializer && ts.isFunctionExpressionOrArrowFunction(node.initializer) && ts.getEffectiveReturnTypeNode(node.initializer)); } function getExplicitTypeOfSymbol(symbol, diagnostic) { + symbol = resolveSymbol(symbol); if (symbol.flags & (16 /* SymbolFlags.Function */ | 8192 /* SymbolFlags.Method */ | 32 /* SymbolFlags.Class */ | 512 /* SymbolFlags.ValueModule */)) { return getTypeOfSymbol(symbol); } @@ -70865,7 +71607,7 @@ var ts; if (isDeclarationWithExplicitTypeAnnotation(declaration)) { return getTypeOfSymbol(symbol); } - if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var statement = declaration.parent.parent; var expressionType = getTypeOfDottedName(statement.expression, /*diagnostic*/ undefined); if (expressionType) { @@ -70888,12 +71630,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: var symbol = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(node)); - return getExplicitTypeOfSymbol(symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol, diagnostic); + return getExplicitTypeOfSymbol(symbol, diagnostic); case 108 /* SyntaxKind.ThisKeyword */: return getExplicitThisType(node); case 106 /* SyntaxKind.SuperKeyword */: return checkSuperExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: { + case 208 /* SyntaxKind.PropertyAccessExpression */: { var type = getTypeOfDottedName(node.expression, diagnostic); if (type) { var name = node.name; @@ -70911,7 +71653,7 @@ var ts; } return undefined; } - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return getTypeOfDottedName(node.expression, diagnostic); } } @@ -70925,7 +71667,7 @@ var ts; // circularities in control flow analysis, we use getTypeOfDottedName when resolving the call // target expression of an assertion. var funcType = void 0; - if (node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */) { + if (node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */) { funcType = getTypeOfDottedName(node.expression, /*diagnostic*/ undefined); } else if (node.expression.kind !== 106 /* SyntaxKind.SuperKeyword */) { @@ -70969,7 +71711,7 @@ var ts; } function isFalseExpression(expr) { var node = ts.skipParentheses(expr, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 221 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || + return node.kind === 95 /* SyntaxKind.FalseKeyword */ || node.kind === 223 /* SyntaxKind.BinaryExpression */ && (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ && (isFalseExpression(node.left) || isFalseExpression(node.right)) || node.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */ && isFalseExpression(node.left) && isFalseExpression(node.right)); } function isReachableFlowNodeWorker(flow, noCacheCheck) { @@ -71090,8 +71832,8 @@ var ts; var symbol = getResolvedSymbol(node); return isConstVariable(symbol) || ts.isParameterOrCatchClauseVariable(symbol) && !isSymbolAssigned(symbol); } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // The resolvedSymbol property is initialized by checkPropertyAccess or checkElementAccess before we get here. return isConstantReference(node.expression) && isReadonlySymbol(getNodeLinks(node).resolvedSymbol || unknownSymbol); } @@ -71118,7 +71860,7 @@ var ts; // on empty arrays are possible without implicit any errors and new element types can be inferred without // type mismatch errors. var resultType = ts.getObjectFlags(evolvedType) & 256 /* ObjectFlags.EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType); - if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 230 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { + if (resultType === unreachableNeverType || reference.parent && reference.parent.kind === 232 /* SyntaxKind.NonNullExpression */ && !(resultType.flags & 131072 /* TypeFlags.Never */) && getTypeWithFacts(resultType, 2097152 /* TypeFacts.NEUndefinedOrNull */).flags & 131072 /* TypeFlags.Never */) { return declaredType; } // The non-null unknown type should never escape control flow analysis. @@ -71203,8 +71945,8 @@ var ts; // Check if we should continue with the control flow of the containing function. var container = flow.node; if (container && container !== flowContainer && - reference.kind !== 206 /* SyntaxKind.PropertyAccessExpression */ && - reference.kind !== 207 /* SyntaxKind.ElementAccessExpression */ && + reference.kind !== 208 /* SyntaxKind.PropertyAccessExpression */ && + reference.kind !== 209 /* SyntaxKind.ElementAccessExpression */ && reference.kind !== 108 /* SyntaxKind.ThisKeyword */) { flow = container.flowNode; continue; @@ -71229,7 +71971,7 @@ var ts; } function getInitialOrAssignedType(flow) { var node = flow.node; - return getNarrowableTypeForReference(node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */ ? + return getNarrowableTypeForReference(node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */ ? getInitialType(node) : getAssignedType(node), reference); } @@ -71269,14 +72011,14 @@ var ts; // in which case we continue control flow analysis back to the function's declaration if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) { var init = ts.getDeclaredExpandoInitializer(node); - if (init && (init.kind === 213 /* SyntaxKind.FunctionExpression */ || init.kind === 214 /* SyntaxKind.ArrowFunction */)) { + if (init && (init.kind === 215 /* SyntaxKind.FunctionExpression */ || init.kind === 216 /* SyntaxKind.ArrowFunction */)) { return getTypeAtFlowNode(flow.antecedent); } } return declaredType; } // for (const _ in ref) acts as a nonnull on ref - if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 243 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { + if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 246 /* SyntaxKind.ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) { return getNonNullableTypeIfNeeded(finalizeEvolvingArrayType(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)))); } // Assignment doesn't affect reference @@ -71287,7 +72029,7 @@ var ts; if (node.kind === 95 /* SyntaxKind.FalseKeyword */) { return unreachableNeverType; } - if (node.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (node.kind === 223 /* SyntaxKind.BinaryExpression */) { if (node.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */) { return narrowTypeByAssertion(narrowTypeByAssertion(type, node.left), node.right); } @@ -71318,7 +72060,7 @@ var ts; function getTypeAtFlowArrayMutation(flow) { if (declaredType === autoType || declaredType === autoArrayType) { var node = flow.node; - var expr = node.kind === 208 /* SyntaxKind.CallExpression */ ? + var expr = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression.expression : node.left.expression; if (isMatchingReference(reference, getReferenceCandidate(expr))) { @@ -71326,7 +72068,7 @@ var ts; var type = getTypeFromFlowType(flowType); if (ts.getObjectFlags(type) & 256 /* ObjectFlags.EvolvingArray */) { var evolvedType_1 = type; - if (node.kind === 208 /* SyntaxKind.CallExpression */) { + if (node.kind === 210 /* SyntaxKind.CallExpression */) { for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) { var arg = _a[_i]; evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg); @@ -71374,15 +72116,15 @@ var ts; if (isMatchingReference(reference, expr)) { type = narrowTypeBySwitchOnDiscriminant(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { - type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && isMatchingReference(reference, expr.expression)) { + type = narrowTypeBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd); } else { if (strictNullChecks) { if (optionalChainContainsReference(expr, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & (32768 /* TypeFlags.Undefined */ | 131072 /* TypeFlags.Never */)); }); } - else if (expr.kind === 216 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { + else if (expr.kind === 218 /* SyntaxKind.TypeOfExpression */ && optionalChainContainsReference(expr.expression, reference)) { type = narrowTypeBySwitchOptionalChainContainment(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd, function (t) { return !(t.flags & 131072 /* TypeFlags.Never */ || t.flags & 128 /* TypeFlags.StringLiteral */ && t.value === "undefined"); }); } } @@ -71610,7 +72352,7 @@ var ts; var narrowedPropType = narrowType(propType); return filterType(type, function (t) { var discriminantType = getTypeOfPropertyOrIndexSignature(t, propName); - return !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); + return !(discriminantType.flags & 131072 /* TypeFlags.Never */) && !(narrowedPropType.flags & 131072 /* TypeFlags.Never */) && areTypesComparable(narrowedPropType, discriminantType); }); } function narrowTypeByDiscriminantProperty(type, access, operator, value, assumeTrue) { @@ -71652,18 +72394,26 @@ var ts; } function isTypePresencePossible(type, propName, assumeTrue) { var prop = getPropertyOfType(type, propName); - if (prop) { - return prop.flags & 16777216 /* SymbolFlags.Optional */ ? true : assumeTrue; - } - return getApplicableIndexInfoForName(type, propName) ? true : !assumeTrue; - } - function narrowByInKeyword(type, name, assumeTrue) { - if (type.flags & 1048576 /* TypeFlags.Union */ - || type.flags & 524288 /* TypeFlags.Object */ && declaredType !== type && !(declaredType === unknownType && isEmptyAnonymousObjectType(type)) - || ts.isThisTypeParameter(type) - || type.flags & 2097152 /* TypeFlags.Intersection */ && ts.every(type.types, function (t) { return t.symbol !== globalThisSymbol; })) { + return prop ? + !!(prop.flags & 16777216 /* SymbolFlags.Optional */) || assumeTrue : + !!getApplicableIndexInfoForName(type, propName) || !assumeTrue; + } + function narrowTypeByInKeyword(type, nameType, assumeTrue) { + var name = getPropertyNameFromType(nameType); + var isKnownProperty = someType(type, function (t) { return isTypePresencePossible(t, name, /*assumeTrue*/ true); }); + if (isKnownProperty) { + // If the check is for a known property (i.e. a property declared in some constituent of + // the target type), we filter the target type by presence of absence of the property. return filterType(type, function (t) { return isTypePresencePossible(t, name, assumeTrue); }); } + if (assumeTrue) { + // If the check is for an unknown property, we intersect the target type with `Record`, + // where X is the name of the property. + var recordSymbol = getGlobalRecordSymbol(); + if (recordSymbol) { + return getIntersectionType([type, getTypeAliasInstantiation(recordSymbol, [nameType, unknownType])]); + } + } return type; } function narrowTypeByBinaryExpression(type, expr, assumeTrue) { @@ -71680,10 +72430,10 @@ var ts; var operator = expr.operatorToken.kind; var left = getReferenceCandidate(expr.left); var right = getReferenceCandidate(expr.right); - if (left.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { + if (left.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(right)) { return narrowTypeByTypeof(type, left, operator, right, assumeTrue); } - if (right.kind === 216 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { + if (right.kind === 218 /* SyntaxKind.TypeOfExpression */ && ts.isStringLiteralLike(left)) { return narrowTypeByTypeof(type, right, operator, left, assumeTrue); } if (isMatchingReference(reference, left)) { @@ -71722,15 +72472,14 @@ var ts; return narrowTypeByPrivateIdentifierInInExpression(type, expr, assumeTrue); } var target = getReferenceCandidate(expr.right); - var leftType = getTypeOfNode(expr.left); - if (leftType.flags & 128 /* TypeFlags.StringLiteral */) { - var name = ts.escapeLeadingUnderscores(leftType.value); + var leftType = getTypeOfExpression(expr.left); + if (leftType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */) { if (containsMissingType(type) && ts.isAccessExpression(reference) && isMatchingReference(reference.expression, target) && - getAccessedPropertyName(reference) === name) { + getAccessedPropertyName(reference) === getPropertyNameFromType(leftType)) { return getTypeWithFacts(type, assumeTrue ? 524288 /* TypeFacts.NEUndefined */ : 65536 /* TypeFacts.EQUndefined */); } if (isMatchingReference(reference, target)) { - return narrowByInKeyword(type, name, assumeTrue); + return narrowTypeByInKeyword(type, leftType, assumeTrue); } } break; @@ -71792,24 +72541,11 @@ var ts; assumeTrue = !assumeTrue; } var valueType = getTypeOfExpression(value); - if (((type.flags & 2 /* TypeFlags.Unknown */) || isEmptyAnonymousObjectType(type) && !(valueType.flags & 98304 /* TypeFlags.Nullable */)) && - assumeTrue && - (operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */)) { - if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */)) { - return valueType; - } - if (valueType.flags & 524288 /* TypeFlags.Object */) { - return nonPrimitiveType; - } - if (type.flags & 2 /* TypeFlags.Unknown */) { - return type; - } - } + var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; if (valueType.flags & 98304 /* TypeFlags.Nullable */) { if (!strictNullChecks) { return type; } - var doubleEquals = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */; var facts = doubleEquals ? assumeTrue ? 262144 /* TypeFacts.EQUndefinedOrNull */ : 2097152 /* TypeFacts.NEUndefinedOrNull */ : valueType.flags & 65536 /* TypeFlags.Null */ ? @@ -71818,10 +72554,16 @@ var ts; return getAdjustedTypeWithFacts(type, facts); } if (assumeTrue) { - var filterFn = operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? - function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); } : - function (t) { return areTypesComparable(t, valueType); }; - return replacePrimitivesWithLiterals(filterType(type, filterFn), valueType); + if (!doubleEquals && (type.flags & 2 /* TypeFlags.Unknown */ || someType(type, isEmptyAnonymousObjectType))) { + if (valueType.flags & (131068 /* TypeFlags.Primitive */ | 67108864 /* TypeFlags.NonPrimitive */) || isEmptyAnonymousObjectType(valueType)) { + return valueType; + } + if (valueType.flags & 524288 /* TypeFlags.Object */) { + return nonPrimitiveType; + } + } + var filteredType = filterType(type, function (t) { return areTypesComparable(t, valueType) || doubleEquals && isCoercibleUnderDoubleEquals(t, valueType); }); + return replacePrimitivesWithLiterals(filteredType, valueType); } if (isUnitType(valueType)) { return filterType(type, function (t) { return !(isUnitLikeType(t) && areTypesComparable(t, valueType)); }); @@ -71835,11 +72577,18 @@ var ts; } var target = getReferenceCandidate(typeOfExpr.expression); if (!isMatchingReference(reference, target)) { + var propertyAccess = getDiscriminantPropertyAccess(typeOfExpr.expression, type); + if (propertyAccess) { + return narrowTypeByDiscriminant(type, propertyAccess, function (t) { return narrowTypeByLiteralExpression(t, literal, assumeTrue); }); + } if (strictNullChecks && optionalChainContainsReference(target, reference) && assumeTrue === (literal.text !== "undefined")) { return getAdjustedTypeWithFacts(type, 2097152 /* TypeFacts.NEUndefinedOrNull */); } return type; } + return narrowTypeByLiteralExpression(type, literal, assumeTrue); + } + function narrowTypeByLiteralExpression(type, literal, assumeTrue) { return assumeTrue ? narrowTypeByTypeName(type, literal.text) : getTypeWithFacts(type, typeofNEFacts.get(literal.text) || 32768 /* TypeFacts.TypeofNEHostObject */); @@ -71919,13 +72668,13 @@ var ts; neverType; }); } - function narrowBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) { + function narrowTypeBySwitchOnTypeOf(type, switchStatement, clauseStart, clauseEnd) { var witnesses = getSwitchClauseTypeOfWitnesses(switchStatement); if (!witnesses) { return type; } // Equal start and end denotes implicit fallthrough; undefined marks explicit default clause. - var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 290 /* SyntaxKind.DefaultClause */; }); + var defaultIndex = ts.findIndex(switchStatement.caseBlock.clauses, function (clause) { return clause.kind === 293 /* SyntaxKind.DefaultClause */; }); var hasDefaultClause = clauseStart === clauseEnd || (defaultIndex >= clauseStart && defaultIndex < clauseEnd); if (hasDefaultClause) { // In the default clause we filter constituents down to those that are not-equal to all handled cases. @@ -72129,17 +72878,17 @@ var ts; // falls through case 108 /* SyntaxKind.ThisKeyword */: case 106 /* SyntaxKind.SuperKeyword */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return narrowTypeByTruthiness(type, expr, assumeTrue); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return narrowTypeByCallExpression(type, expr, assumeTrue); - case 212 /* SyntaxKind.ParenthesizedExpression */: - case 230 /* SyntaxKind.NonNullExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return narrowType(type, expr.expression, assumeTrue); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return narrowTypeByBinaryExpression(type, expr, assumeTrue); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: if (expr.operator === 53 /* SyntaxKind.ExclamationToken */) { return narrowType(type, expr.operand, !assumeTrue); } @@ -72188,9 +72937,9 @@ var ts; function getControlFlowContainer(node) { return ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) || - node.kind === 262 /* SyntaxKind.ModuleBlock */ || - node.kind === 305 /* SyntaxKind.SourceFile */ || - node.kind === 167 /* SyntaxKind.PropertyDeclaration */; + node.kind === 265 /* SyntaxKind.ModuleBlock */ || + node.kind === 308 /* SyntaxKind.SourceFile */ || + node.kind === 169 /* SyntaxKind.PropertyDeclaration */; }); } // Check if a parameter or catch variable is assigned anywhere @@ -72233,7 +72982,7 @@ var ts; function removeOptionalityFromDeclaredType(declaredType, declaration) { if (pushTypeResolution(declaration.symbol, 2 /* TypeSystemPropertyName.DeclaredType */)) { var annotationIncludesUndefined = strictNullChecks && - declaration.kind === 164 /* SyntaxKind.Parameter */ && + declaration.kind === 166 /* SyntaxKind.Parameter */ && declaration.initializer && getTypeFacts(declaredType) & 16777216 /* TypeFacts.IsUndefined */ && !(getTypeFacts(checkExpression(declaration.initializer)) & 16777216 /* TypeFacts.IsUndefined */); @@ -72250,10 +72999,10 @@ var ts; // In an element access obj[x], we consider obj to be in a constraint position, except when obj is of // a generic type without a nullable constraint and x is a generic type. This is because when both obj // and x are of generic types T and K, we want the resulting type to be T[K]. - return parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || - parent.kind === 161 /* SyntaxKind.QualifiedName */ || - parent.kind === 208 /* SyntaxKind.CallExpression */ && parent.expression === node || - parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && + return parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || + parent.kind === 163 /* SyntaxKind.QualifiedName */ || + parent.kind === 210 /* SyntaxKind.CallExpression */ && parent.expression === node || + parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && parent.expression === node && !(someType(type, isGenericTypeWithoutNullableConstraint) && isGenericIndexType(getTypeOfExpression(parent.argumentExpression))); } function isGenericTypeWithUnionConstraint(type) { @@ -72307,15 +73056,15 @@ var ts; }); } function markAliasReferenced(symbol, location) { - if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !isInTypeQuery(location) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) { var target = resolveAlias(symbol); - if (target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(target) & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */)) { // An alias resolving to a const enum cannot be elided if (1) 'isolatedModules' is enabled // (because the const enum value will not be inlined), or if (2) the alias is an export // of a const enum declaration that will be preserved. if (compilerOptions.isolatedModules || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(location) || - !isConstEnumOrConstEnumOnlyModule(target)) { + !isConstEnumOrConstEnumOnlyModule(getExportSymbolOfValueSymbolIfExported(target))) { markAliasSymbolAsReferenced(symbol); } else { @@ -72352,15 +73101,16 @@ var ts; // destructuring from the narrowed parent type. if (ts.isBindingElement(declaration) && !declaration.initializer && !declaration.dotDotDotToken && declaration.parent.elements.length >= 2) { var parent = declaration.parent.parent; - if (parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 164 /* SyntaxKind.Parameter */) { + if (parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || parent.kind === 166 /* SyntaxKind.Parameter */) { var links = getNodeLinks(parent); if (!(links.flags & 268435456 /* NodeCheckFlags.InCheckIdentifier */)) { links.flags |= 268435456 /* NodeCheckFlags.InCheckIdentifier */; var parentType = getTypeForBindingElementParent(parent, 0 /* CheckMode.Normal */); + var parentTypeConstraint = parentType && mapType(parentType, getBaseConstraintOrType); links.flags &= ~268435456 /* NodeCheckFlags.InCheckIdentifier */; - if (parentType && parentType.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 164 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { + if (parentTypeConstraint && parentTypeConstraint.flags & 1048576 /* TypeFlags.Union */ && !(parent.kind === 166 /* SyntaxKind.Parameter */ && isSymbolAssigned(symbol))) { var pattern = declaration.parent; - var narrowedType = getFlowTypeOfReference(pattern, parentType, parentType, /*flowContainer*/ undefined, location.flowNode); + var narrowedType = getFlowTypeOfReference(pattern, parentTypeConstraint, parentTypeConstraint, /*flowContainer*/ undefined, location.flowNode); if (narrowedType.flags & 131072 /* TypeFlags.Never */) { return neverType; } @@ -72427,10 +73177,10 @@ var ts; } var container = ts.getContainingFunction(node); if (languageVersion < 2 /* ScriptTarget.ES2015 */) { - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression); } - else if (ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + else if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) { error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_async_function_or_method_in_ES3_and_ES5_Consider_using_a_standard_function_or_method); } } @@ -72450,7 +73200,7 @@ var ts; // Due to the emit for class decorators, any reference to the class from inside of the class body // must instead be rewritten to point to a temporary variable to avoid issues with the double-bind // behavior of class names in ES6. - if (declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + if (declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.nodeIsDecorated(declaration)) { var container = ts.getContainingClass(node); while (container !== undefined) { @@ -72462,12 +73212,12 @@ var ts; container = ts.getContainingClass(container); } } - else if (declaration.kind === 226 /* SyntaxKind.ClassExpression */) { + else if (declaration.kind === 228 /* SyntaxKind.ClassExpression */) { // When we emit a class expression with static members that contain a reference // to the constructor in the initializer, we will need to substitute that // binding with an alias as the class name is not in scope. var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); - while (container.kind !== 305 /* SyntaxKind.SourceFile */) { + while (container.kind !== 308 /* SyntaxKind.SourceFile */) { if (container.parent === declaration) { if (ts.isPropertyDeclaration(container) && ts.isStatic(container) || ts.isClassStaticBlockDeclaration(container)) { getNodeLinks(declaration).flags |= 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; @@ -72525,7 +73275,7 @@ var ts; // The declaration container is the innermost function that encloses the declaration of the variable // or parameter. The flow container is the innermost function starting with which we analyze the control // flow graph to determine the control flow based type. - var isParameter = ts.getRootDeclaration(declaration).kind === 164 /* SyntaxKind.Parameter */; + var isParameter = ts.getRootDeclaration(declaration).kind === 166 /* SyntaxKind.Parameter */; var declarationContainer = getControlFlowContainer(declaration); var flowContainer = getControlFlowContainer(node); var isOuterVariable = flowContainer !== declarationContainer; @@ -72534,19 +73284,19 @@ var ts; // When the control flow originates in a function expression or arrow function and we are referencing // a const variable or parameter from an outer function, we extend the origin of the control flow // analysis to include the immediately enclosing function. - while (flowContainer !== declarationContainer && (flowContainer.kind === 213 /* SyntaxKind.FunctionExpression */ || - flowContainer.kind === 214 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && + while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* SyntaxKind.FunctionExpression */ || + flowContainer.kind === 216 /* SyntaxKind.ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter && !isSymbolAssigned(localOrExportSymbol))) { flowContainer = getControlFlowContainer(flowContainer); } // We only look for uninitialized variables in strict null checking mode, and only when we can analyze // the entire control flow graph from the variable's declaration (i.e. when the flow container and // declaration container are the same). - var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) || + var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* TypeFlags.AnyOrUnknown */ | 16384 /* TypeFlags.Void */)) !== 0 || - isInTypeQuery(node) || node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */) || - node.parent.kind === 230 /* SyntaxKind.NonNullExpression */ || - declaration.kind === 254 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || + isInTypeQuery(node) || node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */) || + node.parent.kind === 232 /* SyntaxKind.NonNullExpression */ || + declaration.kind === 257 /* SyntaxKind.VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* NodeFlags.Ambient */; var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) : type === autoType || type === autoArrayType ? undefinedType : @@ -72571,6 +73321,12 @@ var ts; } return assignmentKind ? getBaseTypeOfLiteralType(flowType) : flowType; } + function isSameScopedBindingElement(node, declaration) { + if (ts.isBindingElement(declaration)) { + var bindingElement = ts.findAncestor(node, ts.isBindingElement); + return bindingElement && ts.getRootDeclaration(bindingElement) === ts.getRootDeclaration(declaration); + } + } function shouldMarkIdentifierAliasReferenced(node) { var _a; var parent = node.parent; @@ -72604,7 +73360,7 @@ var ts; (symbol.flags & (2 /* SymbolFlags.BlockScopedVariable */ | 32 /* SymbolFlags.Class */)) === 0 || !symbol.valueDeclaration || ts.isSourceFile(symbol.valueDeclaration) || - symbol.valueDeclaration.parent.kind === 292 /* SyntaxKind.CatchClause */) { + symbol.valueDeclaration.parent.kind === 295 /* SyntaxKind.CatchClause */) { return; } // 1. walk from the use site up to the declaration and check @@ -72619,7 +73375,7 @@ var ts; // mark iteration statement as containing block-scoped binding captured in some function var capturesBlockScopeBindingInLoopBody = true; if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container) { var part = getPartOfForStatementContainingNode(node.parent, container); if (part) { @@ -72640,7 +73396,7 @@ var ts; // mark variables that are declared in loop initializer and reassigned inside the body of ForStatement. // if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back. if (ts.isForStatement(container)) { - var varDeclList = ts.getAncestor(symbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); + var varDeclList = ts.getAncestor(symbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); if (varDeclList && varDeclList.parent === container && isAssignedInBodyOfForStatement(node, container)) { getNodeLinks(symbol.valueDeclaration).flags |= 4194304 /* NodeCheckFlags.NeedsLoopOutParameter */; } @@ -72659,7 +73415,7 @@ var ts; function isAssignedInBodyOfForStatement(node, container) { // skip parenthesized nodes var current = node; - while (current.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (current.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { current = current.parent; } // check if node is used as LHS in some assignment expression @@ -72667,7 +73423,7 @@ var ts; if (ts.isAssignmentTarget(current)) { isAssigned = true; } - else if ((current.parent.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 220 /* SyntaxKind.PostfixUnaryExpression */)) { + else if ((current.parent.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ || current.parent.kind === 222 /* SyntaxKind.PostfixUnaryExpression */)) { var expr = current.parent; isAssigned = expr.operator === 45 /* SyntaxKind.PlusPlusToken */ || expr.operator === 46 /* SyntaxKind.MinusMinusToken */; } @@ -72680,7 +73436,7 @@ var ts; } function captureLexicalThis(node, container) { getNodeLinks(node).flags |= 2 /* NodeCheckFlags.LexicalThis */; - if (container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || container.kind === 173 /* SyntaxKind.Constructor */) { var classNode = container.parent; getNodeLinks(classNode).flags |= 4 /* NodeCheckFlags.CaptureThis */; } @@ -72727,31 +73483,31 @@ var ts; // tell whether 'this' needs to be captured. var container = ts.getThisContainer(node, /* includeArrowFunctions */ true); var capturedByArrowFunction = false; - if (container.kind === 171 /* SyntaxKind.Constructor */) { + if (container.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class); } // Now skip arrow functions to get the "real" owner of 'this'. - if (container.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (container.kind === 216 /* SyntaxKind.ArrowFunction */) { container = ts.getThisContainer(container, /* includeArrowFunctions */ false); capturedByArrowFunction = true; } checkThisInStaticClassFieldInitializerInDecoratedClass(node, container); switch (container.kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: if (isInConstructorArgumentInitializer(node, container)) { error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments); // do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks } break; - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name); break; } @@ -72839,7 +73595,7 @@ var ts; } function getClassNameFromPrototypeMethod(container) { // Check if it's the RHS of a x.prototype.y = function [name]() { .... } - if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isBinaryExpression(container.parent) && ts.getAssignmentDeclarationKind(container.parent) === 3 /* AssignmentDeclarationKind.PrototypeProperty */) { // Get the 'x' of 'x.prototype.y = container' @@ -72849,16 +73605,16 @@ var ts; .expression; // x } // x.prototype = { method() { } } - else if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && - container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && + container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.left.expression; } // x.prototype = { method: function() { } } - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && - container.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ && - container.parent.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && + container.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ && + container.parent.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ && ts.isBinaryExpression(container.parent.parent.parent) && ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* AssignmentDeclarationKind.Prototype */) { return container.parent.parent.parent.left.expression; @@ -72866,7 +73622,7 @@ var ts; // Object.defineProperty(x, "method", { value: function() { } }); // Object.defineProperty(x, "method", { set: (x: () => void) => void }); // Object.defineProperty(x, "method", { get: () => function() { }) }); - else if (container.kind === 213 /* SyntaxKind.FunctionExpression */ && + else if (container.kind === 215 /* SyntaxKind.FunctionExpression */ && ts.isPropertyAssignment(container.parent) && ts.isIdentifier(container.parent.name) && (container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") && @@ -72891,7 +73647,7 @@ var ts; } function getTypeForThisExpressionFromJSDoc(node) { var jsdocType = ts.getJSDocType(node); - if (jsdocType && jsdocType.kind === 317 /* SyntaxKind.JSDocFunctionType */) { + if (jsdocType && jsdocType.kind === 320 /* SyntaxKind.JSDocFunctionType */) { var jsDocFunctionType = jsdocType; if (jsDocFunctionType.parameters.length > 0 && jsDocFunctionType.parameters[0].name && @@ -72905,19 +73661,24 @@ var ts; } } function isInConstructorArgumentInitializer(node, constructorDecl) { - return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 164 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); + return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 166 /* SyntaxKind.Parameter */ && n.parent === constructorDecl; }); } function checkSuperExpression(node) { - var isCallExpression = node.parent.kind === 208 /* SyntaxKind.CallExpression */ && node.parent.expression === node; + var isCallExpression = node.parent.kind === 210 /* SyntaxKind.CallExpression */ && node.parent.expression === node; var immediateContainer = ts.getSuperContainer(node, /*stopOnFunctions*/ true); var container = immediateContainer; var needToCaptureLexicalThis = false; + var inAsyncFunction = false; // adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting if (!isCallExpression) { - while (container && container.kind === 214 /* SyntaxKind.ArrowFunction */) { + while (container && container.kind === 216 /* SyntaxKind.ArrowFunction */) { + if (ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) + inAsyncFunction = true; container = ts.getSuperContainer(container, /*stopOnFunctions*/ true); needToCaptureLexicalThis = languageVersion < 2 /* ScriptTarget.ES2015 */; } + if (container && ts.hasSyntacticModifier(container, 512 /* ModifierFlags.Async */)) + inAsyncFunction = true; } var canUseSuperExpression = isLegalUsageOfSuperExpression(container); var nodeCheckFlag = 0; @@ -72927,14 +73688,14 @@ var ts; // class B { // [super.foo()]() {} // } - var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 162 /* SyntaxKind.ComputedPropertyName */; }); - if (current && current.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 164 /* SyntaxKind.ComputedPropertyName */; }); + if (current && current.kind === 164 /* SyntaxKind.ComputedPropertyName */) { error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name); } else if (isCallExpression) { error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors); } - else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */)) { + else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */)) { error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions); } else { @@ -72942,7 +73703,7 @@ var ts; } return errorType; } - if (!isCallExpression && immediateContainer.kind === 171 /* SyntaxKind.Constructor */) { + if (!isCallExpression && immediateContainer.kind === 173 /* SyntaxKind.Constructor */) { checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class); } if (ts.isStatic(container) || isCallExpression) { @@ -73023,12 +73784,12 @@ var ts; // as a call expression cannot be used as the target of a destructuring assignment while a property access can. // // For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations. - if (container.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasSyntacticModifier(container, 256 /* ModifierFlags.Async */)) { + if (container.kind === 171 /* SyntaxKind.MethodDeclaration */ && inAsyncFunction) { if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) { - getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */; + getNodeLinks(container).flags |= 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */; } else { - getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.AsyncMethodWithSuper */; + getNodeLinks(container).flags |= 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */; } } if (needToCaptureLexicalThis) { @@ -73037,7 +73798,7 @@ var ts; // in this case they should also use correct lexical this captureLexicalThis(node.parent, container); } - if (container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher); return errorType; @@ -73058,7 +73819,7 @@ var ts; if (!baseClassType) { return errorType; } - if (container.kind === 171 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { + if (container.kind === 173 /* SyntaxKind.Constructor */ && isInConstructorArgumentInitializer(node, container)) { // issue custom error message for super property access in constructor arguments (to be aligned with old compiler) error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments); return errorType; @@ -73073,7 +73834,7 @@ var ts; if (isCallExpression) { // TS 1.0 SPEC (April 2014): 4.8.1 // Super calls are only permitted in constructors of derived classes - return container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 173 /* SyntaxKind.Constructor */; } else { // TS 1.0 SPEC (April 2014) @@ -73081,23 +73842,23 @@ var ts; // - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance // - In a static member function or static member accessor // topmost container must be something that is directly nested in the class declaration\object literal expression - if (ts.isClassLike(container.parent) || container.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (ts.isClassLike(container.parent) || container.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { if (ts.isStatic(container)) { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 170 /* SyntaxKind.ClassStaticBlockDeclaration */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 172 /* SyntaxKind.ClassStaticBlockDeclaration */; } else { - return container.kind === 169 /* SyntaxKind.MethodDeclaration */ || - container.kind === 168 /* SyntaxKind.MethodSignature */ || - container.kind === 172 /* SyntaxKind.GetAccessor */ || - container.kind === 173 /* SyntaxKind.SetAccessor */ || - container.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - container.kind === 166 /* SyntaxKind.PropertySignature */ || - container.kind === 171 /* SyntaxKind.Constructor */; + return container.kind === 171 /* SyntaxKind.MethodDeclaration */ || + container.kind === 170 /* SyntaxKind.MethodSignature */ || + container.kind === 174 /* SyntaxKind.GetAccessor */ || + container.kind === 175 /* SyntaxKind.SetAccessor */ || + container.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + container.kind === 168 /* SyntaxKind.PropertySignature */ || + container.kind === 173 /* SyntaxKind.Constructor */; } } } @@ -73105,10 +73866,10 @@ var ts; } } function getContainingObjectLiteral(func) { - return (func.kind === 169 /* SyntaxKind.MethodDeclaration */ || - func.kind === 172 /* SyntaxKind.GetAccessor */ || - func.kind === 173 /* SyntaxKind.SetAccessor */) && func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : - func.kind === 213 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 296 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : + return (func.kind === 171 /* SyntaxKind.MethodDeclaration */ || + func.kind === 174 /* SyntaxKind.GetAccessor */ || + func.kind === 175 /* SyntaxKind.SetAccessor */) && func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ ? func.parent : + func.kind === 215 /* SyntaxKind.FunctionExpression */ && func.parent.kind === 299 /* SyntaxKind.PropertyAssignment */ ? func.parent.parent : undefined; } function getThisTypeArgument(type) { @@ -73120,7 +73881,7 @@ var ts; }); } function getContextualThisParameterType(func) { - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { return undefined; } if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) { @@ -73147,7 +73908,7 @@ var ts; if (thisType) { return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral))); } - if (literal.parent.kind !== 296 /* SyntaxKind.PropertyAssignment */) { + if (literal.parent.kind !== 299 /* SyntaxKind.PropertyAssignment */) { break; } literal = literal.parent.parent; @@ -73161,7 +73922,7 @@ var ts; // In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the // contextual type for 'this' is 'obj'. var parent = ts.walkUpParenthesizedExpressions(func.parent); - if (parent.kind === 221 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (parent.kind === 223 /* SyntaxKind.BinaryExpression */ && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { var target = parent.left; if (ts.isAccessExpression(target)) { var expression = target.expression; @@ -73214,11 +73975,11 @@ var ts; return getTypeFromTypeNode(typeNode); } switch (declaration.kind) { - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return getContextuallyTypedParameterType(declaration); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForBindingElement(declaration, contextFlags); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isStatic(declaration)) { return getContextualTypeForStaticPropertyDeclaration(declaration, contextFlags); } @@ -73229,10 +73990,10 @@ var ts; var parent = declaration.parent.parent; var name = declaration.propertyName || declaration.name; var parentType = getContextualTypeForVariableLikeDeclaration(parent, contextFlags) || - parent.kind !== 203 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); + parent.kind !== 205 /* SyntaxKind.BindingElement */ && parent.initializer && checkDeclarationInitializer(parent, declaration.dotDotDotToken ? 64 /* CheckMode.RestBindingElement */ : 0 /* CheckMode.Normal */); if (!parentType || ts.isBindingPattern(name) || ts.isComputedNonLiteralName(name)) return undefined; - if (parent.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (parent.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { var index = ts.indexOfNode(declaration.parent.elements, declaration); if (index < 0) return undefined; @@ -73389,7 +74150,7 @@ var ts; getTypeAtPosition(signature, argIndex); } function getContextualTypeForSubstitutionExpression(template, substitutionExpression) { - if (template.parent.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (template.parent.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { return getContextualTypeForArgument(template.parent, substitutionExpression); } return undefined; @@ -73508,9 +74269,11 @@ var ts; case 1 /* AssignmentDeclarationKind.ExportsProperty */: case 6 /* AssignmentDeclarationKind.Prototype */: case 3 /* AssignmentDeclarationKind.PrototypeProperty */: - var valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; - // falls through case 2 /* AssignmentDeclarationKind.ModuleExports */: + var valueDeclaration = void 0; + if (kind !== 2 /* AssignmentDeclarationKind.ModuleExports */) { + valueDeclaration = (_a = binaryExpression.left.symbol) === null || _a === void 0 ? void 0 : _a.valueDeclaration; + } valueDeclaration || (valueDeclaration = (_b = binaryExpression.symbol) === null || _b === void 0 ? void 0 : _b.valueDeclaration); var annotated = valueDeclaration && ts.getEffectiveTypeAnnotationNode(valueDeclaration); return annotated ? getTypeFromTypeNode(annotated) : undefined; @@ -73687,21 +74450,21 @@ var ts; case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: case 79 /* SyntaxKind.Identifier */: - case 153 /* SyntaxKind.UndefinedKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: return true; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isPossiblyDiscriminantValue(node.expression); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return !node.expression || isPossiblyDiscriminantValue(node.expression); } return false; } function discriminateContextualTypeByObjectMembers(node, contextualType) { - return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 296 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return getMatchingUnionConstituentForObjectLiteral(contextualType, node) || discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 299 /* SyntaxKind.PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return getContextFreeTypeOfExpression(prop.initializer); }, prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } function discriminateContextualTypeByJSXAttributes(node, contextualType) { - return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 285 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); + return discriminateTypeByDiscriminableItems(contextualType, ts.concatenate(ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 288 /* SyntaxKind.JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return getContextFreeTypeOfExpression(prop.initializer); }), prop.symbol.escapedName]; }), ts.map(ts.filter(getPropertiesOfType(contextualType), function (s) { var _a; return !!(s.flags & 16777216 /* SymbolFlags.Optional */) && !!((_a = node === null || node === void 0 ? void 0 : node.symbol) === null || _a === void 0 ? void 0 : _a.members) && !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName); }), function (s) { return [function () { return undefinedType; }, s.escapedName]; })), isTypeAssignableTo, contextualType); } // Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily // be "pushed" onto a node using the contextualType property. @@ -73722,9 +74485,10 @@ var ts; function instantiateContextualType(contextualType, node, contextFlags) { if (contextualType && maybeTypeOfKind(contextualType, 465829888 /* TypeFlags.Instantiable */)) { var inferenceContext = getInferenceContext(node); - // If no inferences have been made, nothing is gained from instantiating as type parameters - // would just be replaced with their defaults similar to the apparent type. - if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidates)) { + // If no inferences have been made, and none of the type parameters for which we are inferring + // specify default types, nothing is gained from instantiating as type parameters would just be + // replaced with their constraints similar to the apparent type. + if (inferenceContext && contextFlags & 1 /* ContextFlags.Signature */ && ts.some(inferenceContext.inferences, hasInferenceCandidatesOrDefault)) { // For contextual signatures we incorporate all inferences made so far, e.g. from return // types as well as arguments to the left in a function call. return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper); @@ -73784,60 +74548,62 @@ var ts; } var parent = node.parent; switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 203 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 205 /* SyntaxKind.BindingElement */: return getContextualTypeForInitializerExpression(node, contextFlags); - case 214 /* SyntaxKind.ArrowFunction */: - case 247 /* SyntaxKind.ReturnStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 250 /* SyntaxKind.ReturnStatement */: return getContextualTypeForReturnExpression(node, contextFlags); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return getContextualTypeForYieldOperand(parent, contextFlags); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return getContextualTypeForAwaitOperand(parent, contextFlags); - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: return getContextualTypeForArgument(parent, node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return ts.isConstTypeReference(parent.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(parent.type); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return getContextualTypeForBinaryOperand(node, contextFlags); - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return getContextualTypeForObjectLiteralElement(parent, contextFlags); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return getContextualType(parent.parent, contextFlags); - case 204 /* SyntaxKind.ArrayLiteralExpression */: { + case 206 /* SyntaxKind.ArrayLiteralExpression */: { var arrayLiteral = parent; var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags); return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node)); } - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return getContextualTypeForConditionalOperand(node, contextFlags); - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.assert(parent.parent.kind === 223 /* SyntaxKind.TemplateExpression */); + case 236 /* SyntaxKind.TemplateSpan */: + ts.Debug.assert(parent.parent.kind === 225 /* SyntaxKind.TemplateExpression */); return getContextualTypeForSubstitutionExpression(parent.parent, node); - case 212 /* SyntaxKind.ParenthesizedExpression */: { + case 214 /* SyntaxKind.ParenthesizedExpression */: { // Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast. var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined; return !tag ? getContextualType(parent, contextFlags) : ts.isJSDocTypeTag(tag) && ts.isConstTypeReference(tag.typeExpression.type) ? tryFindWhenConstTypeReference(parent) : getTypeFromTypeNode(tag.typeExpression.type); } - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return getContextualType(parent, contextFlags); - case 271 /* SyntaxKind.ExportAssignment */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return getTypeFromTypeNode(parent.type); + case 274 /* SyntaxKind.ExportAssignment */: return tryGetTypeFromEffectiveTypeNode(parent); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return getContextualTypeForJsxExpression(parent, contextFlags); - case 285 /* SyntaxKind.JsxAttribute */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return getContextualTypeForJsxAttribute(parent, contextFlags); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getContextualJsxElementAttributesType(parent, contextFlags); } return undefined; @@ -73963,9 +74729,16 @@ var ts; if (!isErrorType(intrinsicClassAttribs)) { var typeParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(intrinsicClassAttribs.symbol); var hostClassType = getReturnTypeOfSignature(sig); - apparentAttributesType = intersectTypes(typeParams - ? createTypeReference(intrinsicClassAttribs, fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context))) - : intrinsicClassAttribs, apparentAttributesType); + var libraryManagedAttributeType = void 0; + if (typeParams) { + // apply JSX.IntrinsicClassElements + var inferredArgs = fillMissingTypeArguments([hostClassType], typeParams, getMinTypeArgumentCount(typeParams), ts.isInJSFile(context)); + libraryManagedAttributeType = instantiateType(intrinsicClassAttribs, createTypeMapper(typeParams, inferredArgs)); + } + // or JSX.IntrinsicClassElements has no generics. + else + libraryManagedAttributeType = intrinsicClassAttribs; + apparentAttributesType = intersectTypes(libraryManagedAttributeType, apparentAttributesType); } var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context); if (!isErrorType(intrinsicAttribs)) { @@ -74088,7 +74861,7 @@ var ts; // all identical ignoring their return type, the result is same signature but with return type as // union type of return types from these signatures function getContextualSignature(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var typeTagSignature = getSignatureOfTypeTag(node); if (typeTagSignature) { return typeTagSignature; @@ -74136,8 +74909,8 @@ var ts; return node.isSpread ? getIndexedAccessType(node.type, numberType) : node.type; } function hasDefaultValue(node) { - return (node.kind === 203 /* SyntaxKind.BindingElement */ && !!node.initializer) || - (node.kind === 221 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); + return (node.kind === 205 /* SyntaxKind.BindingElement */ && !!node.initializer) || + (node.kind === 223 /* SyntaxKind.BinaryExpression */ && node.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */); } function checkArrayLiteral(node, checkMode, forceTuple) { var elements = node.elements; @@ -74150,7 +74923,7 @@ var ts; var hasOmittedExpression = false; for (var i = 0; i < elementCount; i++) { var e = elements[i]; - if (e.kind === 225 /* SyntaxKind.SpreadElement */) { + if (e.kind === 227 /* SyntaxKind.SpreadElement */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(e, compilerOptions.downlevelIteration ? 1536 /* ExternalEmitHelpers.SpreadIncludes */ : 1024 /* ExternalEmitHelpers.SpreadArray */); } @@ -74183,7 +74956,7 @@ var ts; elementFlags.push(4 /* ElementFlags.Rest */); } } - else if (exactOptionalPropertyTypes && e.kind === 227 /* SyntaxKind.OmittedExpression */) { + else if (exactOptionalPropertyTypes && e.kind === 229 /* SyntaxKind.OmittedExpression */) { hasOmittedExpression = true; elementTypes.push(missingType); elementFlags.push(2 /* ElementFlags.Optional */); @@ -74223,7 +74996,7 @@ var ts; } function isNumericName(name) { switch (name.kind) { - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return isNumericComputedName(name); case 79 /* SyntaxKind.Identifier */: return ts.isNumericLiteralName(name.escapedText); @@ -74244,7 +75017,7 @@ var ts; if (!links.resolvedType) { if ((ts.isTypeLiteralNode(node.parent.parent) || ts.isClassLike(node.parent.parent) || ts.isInterfaceDeclaration(node.parent.parent)) && ts.isBinaryExpression(node.expression) && node.expression.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ - && node.parent.kind !== 172 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 173 /* SyntaxKind.SetAccessor */) { + && node.parent.kind !== 174 /* SyntaxKind.GetAccessor */ && node.parent.kind !== 175 /* SyntaxKind.SetAccessor */) { return links.resolvedType = errorType; } links.resolvedType = checkExpression(node.expression); @@ -74317,7 +75090,7 @@ var ts; var spread = emptyObjectType; var contextualType = getApparentTypeOfContextualType(node, /*contextFlags*/ undefined); var contextualTypeHasPattern = contextualType && contextualType.pattern && - (contextualType.pattern.kind === 201 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 205 /* SyntaxKind.ObjectLiteralExpression */); + (contextualType.pattern.kind === 203 /* SyntaxKind.ObjectBindingPattern */ || contextualType.pattern.kind === 207 /* SyntaxKind.ObjectLiteralExpression */); var inConstContext = isConstContext(node); var checkFlags = inConstContext ? 8 /* CheckFlags.Readonly */ : 0; var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node); @@ -74341,16 +75114,16 @@ var ts; for (var _b = 0, _c = node.properties; _b < _c.length; _b++) { var memberDecl = _c[_b]; var member = getSymbolOfNode(memberDecl); - var computedNameType = memberDecl.name && memberDecl.name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? + var computedNameType = memberDecl.name && memberDecl.name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? checkComputedPropertyName(memberDecl.name) : undefined; - if (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ || + if (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ || ts.isObjectLiteralMethod(memberDecl)) { - var type = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : + var type = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) : // avoid resolving the left side of the ShorthandPropertyAssignment outside of the destructuring // for error recovery purposes. For example, if a user wrote `{ a = 100 }` instead of `{ a: 100 }`. // we don't want to say "could not find 'a'". - memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : + memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(!inDestructuringPattern && memberDecl.objectAssignmentInitializer ? memberDecl.objectAssignmentInitializer : memberDecl.name, checkMode) : checkObjectLiteralMethod(memberDecl, checkMode); if (isInJavascript) { var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl); @@ -74373,8 +75146,8 @@ var ts; if (inDestructuringPattern) { // If object literal is an assignment pattern and if the assignment pattern specifies a default value // for the property, make the property optional. - var isOptional = (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || - (memberDecl.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); + var isOptional = (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) || + (memberDecl.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer); if (isOptional) { prop.flags |= 16777216 /* SymbolFlags.Optional */; } @@ -74400,14 +75173,14 @@ var ts; member = prop; allPropertiesTable === null || allPropertiesTable === void 0 ? void 0 : allPropertiesTable.set(prop.escapedName, prop); if (contextualType && checkMode && checkMode & 2 /* CheckMode.Inferential */ && !(checkMode & 4 /* CheckMode.SkipContextSensitive */) && - (memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 169 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { + (memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ || memberDecl.kind === 171 /* SyntaxKind.MethodDeclaration */) && isContextSensitive(memberDecl)) { var inferenceContext = getInferenceContext(node); ts.Debug.assert(inferenceContext); // In CheckMode.Inferential we should always have an inference context - var inferenceNode = memberDecl.kind === 296 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; + var inferenceNode = memberDecl.kind === 299 /* SyntaxKind.PropertyAssignment */ ? memberDecl.initializer : memberDecl; addIntraExpressionInferenceSite(inferenceContext, inferenceNode, type); } } - else if (memberDecl.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (memberDecl.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (languageVersion < 2 /* ScriptTarget.ES2015 */) { checkExternalEmitHelpers(memberDecl, 2 /* ExternalEmitHelpers.Assign */); } @@ -74443,7 +75216,7 @@ var ts; // an ordinary function declaration(section 6.1) with no parameters. // A set accessor declaration is processed in the same manner // as an ordinary function declaration with a single parameter and a Void return type. - ts.Debug.assert(memberDecl.kind === 172 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 173 /* SyntaxKind.SetAccessor */); + ts.Debug.assert(memberDecl.kind === 174 /* SyntaxKind.GetAccessor */ || memberDecl.kind === 175 /* SyntaxKind.SetAccessor */); checkNodeDeferred(memberDecl); } if (computedNameType && !(computedNameType.flags & 8576 /* TypeFlags.StringOrNumberLiteralOrUnique */)) { @@ -74470,16 +75243,30 @@ var ts; // If object literal is contextually typed by the implied type of a binding pattern, augment the result // type with those properties for which the binding pattern specifies a default value. // If the object literal is spread into another object literal, skip this step and let the top-level object - // literal handle it instead. - if (contextualTypeHasPattern && node.parent.kind !== 298 /* SyntaxKind.SpreadAssignment */) { - for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { - var prop = _e[_d]; - if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { - if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { - error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + // literal handle it instead. Note that this might require full traversal to the root pattern's parent + // as it's the guaranteed to be the common ancestor of the pattern node and the current object node. + // It's not possible to check if the immediate parent node is a spread assignment + // since the type flows in non-obvious ways through conditional expressions, IIFEs and more. + if (contextualTypeHasPattern) { + var rootPatternParent_1 = ts.findAncestor(contextualType.pattern.parent, function (n) { + return n.kind === 257 /* SyntaxKind.VariableDeclaration */ || + n.kind === 223 /* SyntaxKind.BinaryExpression */ || + n.kind === 166 /* SyntaxKind.Parameter */; + }); + var spreadOrOutsideRootObject = ts.findAncestor(node, function (n) { + return n === rootPatternParent_1 || + n.kind === 301 /* SyntaxKind.SpreadAssignment */; + }); + if (spreadOrOutsideRootObject.kind !== 301 /* SyntaxKind.SpreadAssignment */) { + for (var _d = 0, _e = getPropertiesOfType(contextualType); _d < _e.length; _d++) { + var prop = _e[_d]; + if (!propertiesTable.get(prop.escapedName) && !getPropertyOfType(spread, prop.escapedName)) { + if (!(prop.flags & 16777216 /* SymbolFlags.Optional */)) { + error(prop.valueDeclaration || prop.bindingElement, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value); + } + propertiesTable.set(prop.escapedName, prop); + propertiesArray.push(prop); } - propertiesTable.set(prop.escapedName, prop); - propertiesArray.push(prop); } } } @@ -74587,6 +75374,7 @@ var ts; */ function createJsxAttributesTypeFromAttributesProperty(openingLikeElement, checkMode) { var attributes = openingLikeElement.attributes; + var attributesType = getContextualType(attributes, 0 /* ContextFlags.None */); var allAttributesTable = strictNullChecks ? ts.createSymbolTable() : undefined; var attributesTable = ts.createSymbolTable(); var spread = emptyJsxObjectType; @@ -74614,9 +75402,15 @@ var ts; if (attributeDecl.name.escapedText === jsxChildrenPropertyName) { explicitlySpecifyChildrenAttribute = true; } + if (attributesType) { + var prop = getPropertyOfType(attributesType, member.escapedName); + if (prop && prop.declarations && isDeprecatedSymbol(prop)) { + addDeprecatedSuggestion(attributeDecl.name, prop.declarations, attributeDecl.name.escapedText); + } + } } else { - ts.Debug.assert(attributeDecl.kind === 287 /* SyntaxKind.JsxSpreadAttribute */); + ts.Debug.assert(attributeDecl.kind === 290 /* SyntaxKind.JsxSpreadAttribute */); if (attributesTable.size > 0) { spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false); attributesTable = ts.createSymbolTable(); @@ -74643,7 +75437,7 @@ var ts; } } // Handle children attribute - var parent = openingLikeElement.parent.kind === 278 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; + var parent = openingLikeElement.parent.kind === 281 /* SyntaxKind.JsxElement */ ? openingLikeElement.parent : undefined; // We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) { var childrenTypes = checkJsxChildren(parent, checkMode); @@ -74700,7 +75494,7 @@ var ts; childrenTypes.push(stringType); } } - else if (child.kind === 288 /* SyntaxKind.JsxExpression */ && !child.expression) { + else if (child.kind === 291 /* SyntaxKind.JsxExpression */ && !child.expression) { continue; // empty jsx expressions don't *really* count as present children } else { @@ -75132,9 +75926,9 @@ var ts; function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError) { if (reportError === void 0) { reportError = true; } var errorNode = !reportError ? undefined : - node.kind === 161 /* SyntaxKind.QualifiedName */ ? node.right : - node.kind === 200 /* SyntaxKind.ImportType */ ? node : - node.kind === 203 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; + node.kind === 163 /* SyntaxKind.QualifiedName */ ? node.right : + node.kind === 202 /* SyntaxKind.ImportType */ ? node : + node.kind === 205 /* SyntaxKind.BindingElement */ && node.propertyName ? node.propertyName : node.name; return checkPropertyAccessibilityAtLocation(node, isSuper, writing, type, prop, errorNode); } /** @@ -75165,7 +75959,7 @@ var ts; return false; } } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { // A method cannot be accessed in a super property access if the method is abstract. // This error could mask a private property access error. But, a member // cannot simultaneously be private and abstract, so this will trigger an @@ -75177,7 +75971,7 @@ var ts; } } // Referencing abstract properties within their own constructors is not allowed - if ((flags & 128 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && + if ((flags & 256 /* ModifierFlags.Abstract */) && symbolHasNonMethodDeclaration(prop) && (ts.isThisProperty(location) || ts.isThisInitializedObjectBindingExpression(location) || ts.isObjectBindingPattern(location.parent) && ts.isThisInitializedDeclaration(location.parent.parent))) { var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(getParentOfSymbol(prop)); if (declaringClassDeclaration && isNodeUsedDuringClassInitialization(location)) { @@ -75271,10 +76065,27 @@ var ts; return isNullableType(type) ? getNonNullableType(type) : type; } function reportObjectPossiblyNullOrUndefinedError(node, facts) { - error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? - ts.Diagnostics.Object_is_possibly_null_or_undefined : - ts.Diagnostics.Object_is_possibly_undefined : - ts.Diagnostics.Object_is_possibly_null); + var nodeText = ts.isEntityNameExpression(node) ? ts.entityNameToString(node) : undefined; + if (node.kind === 104 /* SyntaxKind.NullKeyword */) { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "null"); + return; + } + if (nodeText !== undefined && nodeText.length < 100) { + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, "undefined"); + return; + } + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics._0_is_possibly_null_or_undefined : + ts.Diagnostics._0_is_possibly_undefined : + ts.Diagnostics._0_is_possibly_null, nodeText); + } + else { + error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? + ts.Diagnostics.Object_is_possibly_null_or_undefined : + ts.Diagnostics.Object_is_possibly_undefined : + ts.Diagnostics.Object_is_possibly_null); + } } function reportCannotInvokePossiblyNullOrUndefinedError(node, facts) { error(node, facts & 16777216 /* TypeFacts.IsUndefined */ ? facts & 33554432 /* TypeFacts.IsNull */ ? @@ -75284,6 +76095,13 @@ var ts; } function checkNonNullTypeWithReporter(type, node, reportError) { if (strictNullChecks && type.flags & 2 /* TypeFlags.Unknown */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_of_type_unknown, nodeText); + return errorType; + } + } error(node, ts.Diagnostics.Object_is_of_type_unknown); return errorType; } @@ -75301,6 +76119,17 @@ var ts; function checkNonNullNonVoidType(type, node) { var nonNullType = checkNonNullType(type, node); if (nonNullType.flags & 16384 /* TypeFlags.Void */) { + if (ts.isEntityNameExpression(node)) { + var nodeText = ts.entityNameToString(node); + if (ts.isIdentifier(node) && nodeText === "undefined") { + error(node, ts.Diagnostics.The_value_0_cannot_be_used_here, nodeText); + return nonNullType; + } + if (nodeText.length < 100) { + error(node, ts.Diagnostics._0_is_possibly_undefined, nodeText); + return nonNullType; + } + } error(node, ts.Diagnostics.Object_is_possibly_undefined); } return nonNullType; @@ -75319,7 +76148,7 @@ var ts; return checkPropertyAccessExpressionOrQualifiedName(node, node.left, leftType, node.right, checkMode); } function isMethodAccessForCall(node) { - while (node.parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */) { + while (node.parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */) { node = node.parent; } return ts.isCallOrNewExpression(node.parent) && node.parent.expression === node; @@ -75459,7 +76288,7 @@ var ts; } return isErrorType(apparentType) ? errorType : apparentType; } - prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 161 /* SyntaxKind.QualifiedName */); + prop = getPropertyOfType(apparentType, right.escapedText, /*skipObjectFunctionPropertyAugment*/ false, /*includeTypeOnlyMembers*/ node.kind === 163 /* SyntaxKind.QualifiedName */); } // In `Foo.Bar.Baz`, 'Foo' is not referenced if 'Bar' is a const enum or a module containing only const enums. // `Foo` is also not referenced in `enum FooCopy { Bar = Foo.Bar }`, because the enum member value gets inlined @@ -75469,7 +76298,7 @@ var ts; // 1. if 'isolatedModules' is enabled, because the const enum value will not be inlined, and // 2. if 'preserveConstEnums' is enabled and the expression is itself an export, e.g. `export = Foo.Bar.Baz`. if (ts.isIdentifier(left) && parentSymbol && (compilerOptions.isolatedModules || - !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 299 /* SyntaxKind.EnumMember */)) || + !(prop && (isConstEnumOrConstEnumOnlyModule(prop) || prop.flags & 8 /* SymbolFlags.EnumMember */ && node.parent.kind === 302 /* SyntaxKind.EnumMember */)) || ts.shouldPreserveConstEnums(compilerOptions) && isExportOrExportExpression(node))) { markAliasReferenced(parentSymbol, node); } @@ -75571,7 +76400,7 @@ var ts; if (declaration && isPropertyWithoutInitializer(declaration)) { if (!ts.isStatic(declaration)) { var flowContainer = getControlFlowContainer(node); - if (flowContainer.kind === 171 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { + if (flowContainer.kind === 173 /* SyntaxKind.Constructor */ && flowContainer.parent === declaration.parent && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { assumeUninitialized = true; } } @@ -75606,8 +76435,8 @@ var ts; && (compilerOptions.useDefineForClassFields || !isPropertyDeclaredInAncestorClass(prop))) { diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName); } - else if (valueDeclaration.kind === 257 /* SyntaxKind.ClassDeclaration */ && - node.parent.kind !== 178 /* SyntaxKind.TypeReference */ && + else if (valueDeclaration.kind === 260 /* SyntaxKind.ClassDeclaration */ && + node.parent.kind !== 180 /* SyntaxKind.TypeReference */ && !(valueDeclaration.flags & 16777216 /* NodeFlags.Ambient */) && !isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) { diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName); @@ -75619,25 +76448,25 @@ var ts; function isInPropertyInitializerOrClassStaticBlock(node) { return !!ts.findAncestor(node, function (node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return true; - case 296 /* SyntaxKind.PropertyAssignment */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 298 /* SyntaxKind.SpreadAssignment */: - case 162 /* SyntaxKind.ComputedPropertyName */: - case 233 /* SyntaxKind.TemplateSpan */: - case 288 /* SyntaxKind.JsxExpression */: - case 285 /* SyntaxKind.JsxAttribute */: - case 286 /* SyntaxKind.JsxAttributes */: - case 287 /* SyntaxKind.JsxSpreadAttribute */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 291 /* SyntaxKind.HeritageClause */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 301 /* SyntaxKind.SpreadAssignment */: + case 164 /* SyntaxKind.ComputedPropertyName */: + case 236 /* SyntaxKind.TemplateSpan */: + case 291 /* SyntaxKind.JsxExpression */: + case 288 /* SyntaxKind.JsxAttribute */: + case 289 /* SyntaxKind.JsxAttributes */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 294 /* SyntaxKind.HeritageClause */: return false; - case 214 /* SyntaxKind.ArrowFunction */: - case 238 /* SyntaxKind.ExpressionStatement */: + case 216 /* SyntaxKind.ArrowFunction */: + case 241 /* SyntaxKind.ExpressionStatement */: return ts.isBlock(node.parent) && ts.isClassStaticBlockDeclaration(node.parent.parent) ? true : "quit"; default: return ts.isExpressionNode(node) ? false : "quit"; @@ -75832,7 +76661,6 @@ var ts; } return false; } - ; var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get"; if (!hasProp(suggestedMethod)) { return undefined; @@ -75912,11 +76740,11 @@ var ts; } function isValidPropertyAccess(node, propertyName) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return isValidPropertyAccessWithType(node, node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression))); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getWidenedType(checkExpression(node.left))); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getTypeFromTypeNode(node)); } } @@ -75931,7 +76759,7 @@ var ts; * @param property the accessed property's symbol. */ function isValidPropertyAccessForCompletions(node, type, property) { - return isPropertyAccessible(node, node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, + return isPropertyAccessible(node, node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */, /* isWrite */ false, type, property); // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context. } @@ -75971,7 +76799,7 @@ var ts; */ function getForInVariableSymbol(node) { var initializer = node.initializer; - if (initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = initializer.declarations[0]; if (variable && !ts.isBindingPattern(variable.name)) { return getSymbolOfNode(variable); @@ -76000,7 +76828,7 @@ var ts; var child = expr; var node = expr.parent; while (node) { - if (node.kind === 243 /* SyntaxKind.ForInStatement */ && + if (node.kind === 246 /* SyntaxKind.ForInStatement */ && child === node.statement && getForInVariableSymbol(node) === symbol && hasNumericPropertyNames(getTypeOfExpression(node.expression))) { @@ -76049,13 +76877,13 @@ var ts; // This gets us diagnostics for the type arguments and marks them as referenced. ts.forEach(node.typeArguments, checkSourceElement); } - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { checkExpression(node.template); } else if (ts.isJsxOpeningLikeElement(node)) { checkExpression(node.attributes); } - else if (node.kind !== 165 /* SyntaxKind.Decorator */) { + else if (node.kind !== 167 /* SyntaxKind.Decorator */) { ts.forEach(node.arguments, function (argument) { checkExpression(argument); }); @@ -76119,7 +76947,7 @@ var ts; } } function isSpreadArgument(arg) { - return !!arg && (arg.kind === 225 /* SyntaxKind.SpreadElement */ || arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); + return !!arg && (arg.kind === 227 /* SyntaxKind.SpreadElement */ || arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.isSpread); } function getSpreadArgumentIndex(args) { return ts.findIndex(args, isSpreadArgument); @@ -76136,9 +76964,9 @@ var ts; var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments var effectiveParameterCount = getParameterCount(signature); var effectiveMinimumArguments = getMinArgumentCount(signature); - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { argCount = args.length; - if (node.template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (node.template.kind === 225 /* SyntaxKind.TemplateExpression */) { // If a tagged template expression lacks a tail literal, the call is incomplete. // Specifically, a template only can end in a TemplateTail or a Missing literal. var lastSpan = ts.last(node.template.templateSpans); // we should always have at least one span. @@ -76153,7 +76981,7 @@ var ts; callIsIncomplete = !!templateLiteral.isUnterminated; } } - else if (node.kind === 165 /* SyntaxKind.Decorator */) { + else if (node.kind === 167 /* SyntaxKind.Decorator */) { argCount = getDecoratorArgumentCount(node, signature); } else if (ts.isJsxOpeningLikeElement(node)) { @@ -76167,7 +76995,7 @@ var ts; } else if (!node.arguments) { // This only happens when we have something of the form: 'new C' - ts.Debug.assert(node.kind === 209 /* SyntaxKind.NewExpression */); + ts.Debug.assert(node.kind === 211 /* SyntaxKind.NewExpression */); return getMinArgumentCount(signature) === 0; } else { @@ -76270,7 +77098,7 @@ var ts; // example, given a 'function wrap(cb: (x: T) => U): (x: T) => U' and a call expression // 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the // return type of 'wrap'. - if (node.kind !== 165 /* SyntaxKind.Decorator */) { + if (node.kind !== 167 /* SyntaxKind.Decorator */) { var skipBindingPatterns = ts.every(signature.typeParameters, function (p) { return !!getDefaultFromTypeParameter(p); }); var contextualType = getContextualType(node, skipBindingPatterns ? 8 /* ContextFlags.SkipBindingPatterns */ : 0 /* ContextFlags.None */); if (contextualType) { @@ -76334,7 +77162,7 @@ var ts; } for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */ && !(checkMode & 32 /* CheckMode.IsForStringLiteralArgumentCompletions */ && hasSkipDirectInferenceFlag(arg))) { var paramType = getTypeAtPosition(signature, i); if (couldContainTypeVariables(paramType)) { var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode); @@ -76360,7 +77188,7 @@ var ts; if (isSpreadArgument(arg)) { // We are inferring from a spread expression in the last argument position, i.e. both the parameter // and the argument are ...x forms. - return getMutableArrayOrTupleType(arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : + return getMutableArrayOrTupleType(arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpressionWithContextualType(arg.expression, restType, context, checkMode)); } } @@ -76370,13 +77198,13 @@ var ts; for (var i = index; i < argCount; i++) { var arg = args[i]; if (isSpreadArgument(arg)) { - var spreadType = arg.kind === 232 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); + var spreadType = arg.kind === 234 /* SyntaxKind.SyntheticExpression */ ? arg.type : checkExpression(arg.expression); if (isArrayLikeType(spreadType)) { types.push(spreadType); flags.push(8 /* ElementFlags.Variadic */); } else { - types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 225 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); + types.push(checkIteratedTypeOrElementType(33 /* IterationUse.Spread */, spreadType, undefinedType, arg.kind === 227 /* SyntaxKind.SpreadElement */ ? arg.expression : arg)); flags.push(4 /* ElementFlags.Rest */); } } @@ -76387,7 +77215,7 @@ var ts; types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType)); flags.push(1 /* ElementFlags.Required */); } - if (arg.kind === 232 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { + if (arg.kind === 234 /* SyntaxKind.SyntheticExpression */ && arg.tupleNameSource) { names.push(arg.tupleNameSource); } } @@ -76531,7 +77359,7 @@ var ts; return undefined; } var thisType = getThisTypeOfSignature(signature); - if (thisType && thisType !== voidType && node.kind !== 209 /* SyntaxKind.NewExpression */) { + if (thisType && thisType !== voidType && node.kind !== 211 /* SyntaxKind.NewExpression */) { // If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType // If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible. // If the expression is a new expression, then the check is skipped. @@ -76549,7 +77377,7 @@ var ts; var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length; for (var i = 0; i < argCount; i++) { var arg = args[i]; - if (arg.kind !== 227 /* SyntaxKind.OmittedExpression */) { + if (arg.kind !== 229 /* SyntaxKind.OmittedExpression */) { var paramType = getTypeAtPosition(signature, i); var argType = checkExpressionWithContextualType(arg, paramType, /*inferenceContext*/ undefined, checkMode); // If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive), @@ -76594,8 +77422,8 @@ var ts; * Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise. */ function getThisArgumentOfCall(node) { - var expression = node.kind === 208 /* SyntaxKind.CallExpression */ ? node.expression : - node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; + var expression = node.kind === 210 /* SyntaxKind.CallExpression */ ? node.expression : + node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */ ? node.tag : undefined; if (expression) { var callee = ts.skipOuterExpressions(expression); if (ts.isAccessExpression(callee)) { @@ -76613,17 +77441,17 @@ var ts; * Returns the effective arguments for an expression that works like a function invocation. */ function getEffectiveCallArguments(node) { - if (node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */) { + if (node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */) { var template = node.template; var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())]; - if (template.kind === 223 /* SyntaxKind.TemplateExpression */) { + if (template.kind === 225 /* SyntaxKind.TemplateExpression */) { ts.forEach(template.templateSpans, function (span) { args_3.push(span.expression); }); } return args_3; } - if (node.kind === 165 /* SyntaxKind.Decorator */) { + if (node.kind === 167 /* SyntaxKind.Decorator */) { return getEffectiveDecoratorArguments(node); } if (ts.isJsxOpeningLikeElement(node)) { @@ -76637,7 +77465,7 @@ var ts; var _loop_26 = function (i) { var arg = args[i]; // We can call checkExpressionCached because spread expressions never have a contextual type. - var spreadType = arg.kind === 225 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); + var spreadType = arg.kind === 227 /* SyntaxKind.SpreadElement */ && (flowLoopCount ? checkExpression(arg.expression) : checkExpressionCached(arg.expression)); if (spreadType && isTupleType(spreadType)) { ts.forEach(getTypeArguments(spreadType), function (t, i) { var _a; @@ -76664,30 +77492,30 @@ var ts; var parent = node.parent; var expr = node.expression; switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: // For a class decorator, the `target` is the type of the class (e.g. the // "static" or "constructor" side of the class). return [ createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent))) ]; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // A parameter declaration decorator will have three arguments (see // `ParameterDecorator` in core.d.ts). var func = parent.parent; return [ - createSyntheticExpression(expr, parent.parent.kind === 171 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), + createSyntheticExpression(expr, parent.parent.kind === 173 /* SyntaxKind.Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType), createSyntheticExpression(expr, anyType), createSyntheticExpression(expr, numberType) ]; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // A method or accessor declaration decorator will have two or three arguments (see // `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators // for ES3, we will only pass two arguments. - var hasPropDesc = parent.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && languageVersion !== 0 /* ScriptTarget.ES3 */; + var hasPropDesc = languageVersion !== 0 /* ScriptTarget.ES3 */ && (!ts.isPropertyDeclaration(parent) || ts.hasAccessorModifier(parent)); return [ createSyntheticExpression(expr, getParentTypeOfClassElement(parent)), createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)), @@ -76701,17 +77529,17 @@ var ts; */ function getDecoratorArgumentCount(node, signature) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return 1; - case 167 /* SyntaxKind.PropertyDeclaration */: - return 2; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + return ts.hasAccessorModifier(node.parent) ? 3 : 2; + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // For ES3 or decorators with only two parameters we supply only two arguments return languageVersion === 0 /* ScriptTarget.ES3 */ || signature.parameters.length <= 2 ? 2 : 3; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return 3; default: return ts.Debug.fail(); @@ -76853,8 +77681,8 @@ var ts; return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount); } function resolveCall(node, signatures, candidatesOutArray, checkMode, callChainFlags, fallbackError) { - var isTaggedTemplate = node.kind === 210 /* SyntaxKind.TaggedTemplateExpression */; - var isDecorator = node.kind === 165 /* SyntaxKind.Decorator */; + var isTaggedTemplate = node.kind === 212 /* SyntaxKind.TaggedTemplateExpression */; + var isDecorator = node.kind === 167 /* SyntaxKind.Decorator */; var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node); var reportErrors = !candidatesOutArray; var typeArguments; @@ -76917,7 +77745,7 @@ var ts; var result; // If we are in signature help, a trailing comma indicates that we intend to provide another argument, // so we will only accept overloads with arity at least 1 higher than the current number of provided arguments. - var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 208 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; + var signatureHelpTrailingComma = !!(checkMode & 16 /* CheckMode.IsForSignatureHelp */) && node.kind === 210 /* SyntaxKind.CallExpression */ && node.arguments.hasTrailingComma; // Section 4.12.1: // if the candidate list contains one or more signatures for which the type of each argument // expression is a subtype of each corresponding parameter type, the return type of the first @@ -77406,7 +78234,7 @@ var ts; return resolveErrorCall(node); } var valueDecl = expressionType.symbol && ts.getClassLikeDeclarationOfSymbol(expressionType.symbol); - if (valueDecl && ts.hasSyntacticModifier(valueDecl, 128 /* ModifierFlags.Abstract */)) { + if (valueDecl && ts.hasSyntacticModifier(valueDecl, 256 /* ModifierFlags.Abstract */)) { error(node, ts.Diagnostics.Cannot_create_an_instance_of_an_abstract_class); return resolveErrorCall(node); } @@ -77477,7 +78305,7 @@ var ts; var declaration = signature.declaration; var modifiers = ts.getSelectedEffectiveModifierFlags(declaration, 24 /* ModifierFlags.NonPublicAccessibilityModifier */); // (1) Public constructors and (2) constructor functions are always accessible. - if (!modifiers || declaration.kind !== 171 /* SyntaxKind.Constructor */) { + if (!modifiers || declaration.kind !== 173 /* SyntaxKind.Constructor */) { return true; } var declaringClassDeclaration = ts.getClassLikeDeclarationOfSymbol(declaration.parent.symbol); @@ -77621,16 +78449,16 @@ var ts; */ function getDiagnosticHeadMessageForDecoratorResolution(node) { switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression; default: return ts.Debug.fail(); @@ -77676,7 +78504,7 @@ var ts; // file would probably be preferable. var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 788968 /* SymbolFlags.Type */); var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 788968 /* SymbolFlags.Type */, node); - var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */)); + var declaration = ts.factory.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.factory.createParameterDeclaration(/*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.factory.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */)); var parameterSymbol = createSymbol(1 /* SymbolFlags.FunctionScopedVariable */, "props"); parameterSymbol.type = result; return createSignature(declaration, @@ -77725,16 +78553,16 @@ var ts; } function resolveSignature(node, candidatesOutArray, checkMode) { switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return resolveCallExpression(node, candidatesOutArray, checkMode); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return resolveNewExpression(node, candidatesOutArray, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return resolveDecorator(node, candidatesOutArray, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode); } throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable."); @@ -77778,12 +78606,15 @@ var ts; return false; } var func = ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) ? node : - ts.isVariableDeclaration(node) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : + (ts.isVariableDeclaration(node) || ts.isPropertyAssignment(node)) && node.initializer && ts.isFunctionExpression(node.initializer) ? node.initializer : undefined; if (func) { - // If the node has a @class tag, treat it like a constructor. + // If the node has a @class or @constructor tag, treat it like a constructor. if (ts.getJSDocClassTag(node)) return true; + // If the node is a property of an object literal. + if (ts.isPropertyAssignment(ts.walkUpParenthesizedExpressions(func.parent))) + return false; // If the symbol of the node has members, treat it like a constructor. var symbol = getSymbolOfNode(func); return !!((_a = symbol === null || symbol === void 0 ? void 0 : symbol.members) === null || _a === void 0 ? void 0 : _a.size); @@ -77866,7 +78697,7 @@ var ts; return false; } var parent = node.parent; - while (parent && parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (parent && parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { parent = parent.parent; } if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { @@ -77892,12 +78723,12 @@ var ts; if (node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { return voidType; } - if (node.kind === 209 /* SyntaxKind.NewExpression */) { + if (node.kind === 211 /* SyntaxKind.NewExpression */) { var declaration = signature.declaration; if (declaration && - declaration.kind !== 171 /* SyntaxKind.Constructor */ && - declaration.kind !== 175 /* SyntaxKind.ConstructSignature */ && - declaration.kind !== 180 /* SyntaxKind.ConstructorType */ && + declaration.kind !== 173 /* SyntaxKind.Constructor */ && + declaration.kind !== 177 /* SyntaxKind.ConstructSignature */ && + declaration.kind !== 182 /* SyntaxKind.ConstructorType */ && !ts.isJSDocConstructSignature(declaration) && !isJSConstructor(declaration)) { // When resolved signature is a call signature (and not a construct signature) the result type is any @@ -77917,7 +78748,7 @@ var ts; if (returnType.flags & 12288 /* TypeFlags.ESSymbolLike */ && isSymbolOrSymbolForCall(node)) { return getESSymbolLikeTypeForNode(ts.walkUpParenthesizedExpressions(node.parent)); } - if (node.kind === 208 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 238 /* SyntaxKind.ExpressionStatement */ && + if (node.kind === 210 /* SyntaxKind.CallExpression */ && !node.questionDotToken && node.parent.kind === 241 /* SyntaxKind.ExpressionStatement */ && returnType.flags & 16384 /* TypeFlags.Void */ && getTypePredicateOfSignature(signature)) { if (!ts.isDottedName(node.expression)) { error(node.expression, ts.Diagnostics.Assertions_require_the_call_target_to_be_an_identifier_or_qualified_name); @@ -77947,20 +78778,20 @@ var ts; function getDeprecatedSuggestionNode(node) { node = ts.skipParentheses(node); switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 165 /* SyntaxKind.Decorator */: - case 209 /* SyntaxKind.NewExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 167 /* SyntaxKind.Decorator */: + case 211 /* SyntaxKind.NewExpression */: return getDeprecatedSuggestionNode(node.expression); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return getDeprecatedSuggestionNode(node.tag); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return getDeprecatedSuggestionNode(node.tagName); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return node.argumentExpression; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: var typeReference = node; return ts.isQualifiedName(typeReference.typeName) ? typeReference.typeName.right : typeReference; default: @@ -78031,8 +78862,8 @@ var ts; if (hasDefaultOnly && type && !isErrorType(type)) { var synthType = type; if (!synthType.defaultOnlyType) { - var type_5 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); - synthType.defaultOnlyType = type_5; + var type_4 = createDefaultPropertyWrapperForModule(symbol, originalSymbol); + synthType.defaultOnlyType = type_4; } return synthType.defaultOnlyType; } @@ -78075,9 +78906,9 @@ var ts; return false; } var targetDeclarationKind = resolvedRequire.flags & 16 /* SymbolFlags.Function */ - ? 256 /* SyntaxKind.FunctionDeclaration */ + ? 259 /* SyntaxKind.FunctionDeclaration */ : resolvedRequire.flags & 3 /* SymbolFlags.Variable */ - ? 254 /* SyntaxKind.VariableDeclaration */ + ? 257 /* SyntaxKind.VariableDeclaration */ : 0 /* SyntaxKind.Unknown */; if (targetDeclarationKind !== 0 /* SyntaxKind.Unknown */) { var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind); @@ -78097,7 +78928,7 @@ var ts; return getReturnTypeOfSignature(signature); } function checkAssertion(node) { - if (node.kind === 211 /* SyntaxKind.TypeAssertionExpression */) { + if (node.kind === 213 /* SyntaxKind.TypeAssertionExpression */) { var file = ts.getSourceFileOfNode(node); if (file && ts.fileExtensionIsOneOf(file.fileName, [".cts" /* Extension.Cts */, ".mts" /* Extension.Mts */])) { grammarErrorOnNode(node, ts.Diagnostics.This_syntax_is_reserved_in_files_with_the_mts_or_cts_extension_Use_an_as_expression_instead); @@ -78113,25 +78944,25 @@ var ts; case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return true; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return isValidConstAssertionArgument(node.expression); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var op = node.operator; var arg = node.operand; return op === 40 /* SyntaxKind.MinusToken */ && (arg.kind === 8 /* SyntaxKind.NumericLiteral */ || arg.kind === 9 /* SyntaxKind.BigIntLiteral */) || op === 39 /* SyntaxKind.PlusToken */ && arg.kind === 8 /* SyntaxKind.NumericLiteral */; - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: var expr = node.expression; var symbol = getTypeOfNode(expr).symbol; if (symbol && symbol.flags & 2097152 /* SymbolFlags.Alias */) { symbol = resolveAlias(symbol); } - return !!(symbol && (symbol.flags & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */); + return !!(symbol && (getAllSymbolFlags(symbol) & 384 /* SymbolFlags.Enum */) && getEnumKind(symbol) === 1 /* EnumKind.Literal */); } return false; } @@ -78167,7 +78998,7 @@ var ts; } function checkExpressionWithTypeArguments(node) { checkGrammarExpressionWithTypeArguments(node); - var exprType = node.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : + var exprType = node.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ ? checkExpression(node.expression) : ts.isThisIdentifier(node.exprName) ? checkThisExpression(node.exprName) : checkExpression(node.exprName); var typeArguments = node.typeArguments; @@ -78231,6 +79062,16 @@ var ts; }); } } + function checkSatisfiesExpression(node) { + checkSourceElement(node.type); + var targetType = getTypeFromTypeNode(node.type); + if (isErrorType(targetType)) { + return targetType; + } + var exprType = checkExpression(node.expression); + checkTypeAssignableToAndOptionallyElaborate(exprType, targetType, node.type, node.expression, ts.Diagnostics.Type_0_does_not_satisfy_the_expected_type_1); + return exprType; + } function checkMetaProperty(node) { checkGrammarMetaProperty(node); if (node.keywordToken === 103 /* SyntaxKind.NewKeyword */) { @@ -78258,7 +79099,7 @@ var ts; error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target"); return errorType; } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { var symbol = getSymbolOfNode(container.parent); return getTypeOfSymbol(symbol); } @@ -78310,7 +79151,7 @@ var ts; } function getParameterIdentifierNameAtPosition(signature, pos) { var _a; - if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 317 /* SyntaxKind.JSDocFunctionType */) { + if (((_a = signature.declaration) === null || _a === void 0 ? void 0 : _a.kind) === 320 /* SyntaxKind.JSDocFunctionType */) { return undefined; } var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78342,7 +79183,7 @@ var ts; return symbol.valueDeclaration && ts.isParameter(symbol.valueDeclaration) && ts.isIdentifier(symbol.valueDeclaration.name); } function isValidDeclarationForTupleLabel(d) { - return d.kind === 197 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); + return d.kind === 199 /* SyntaxKind.NamedTupleMember */ || (ts.isParameter(d) && d.name && ts.isIdentifier(d.name)); } function getNameableDeclarationAtPosition(signature, pos) { var paramCount = signature.parameters.length - (signatureHasRestParameter(signature) ? 1 : 0); @@ -78634,7 +79475,7 @@ var ts; var yieldType; var nextType; var fallbackReturnType = voidType; - if (func.body.kind !== 235 /* SyntaxKind.Block */) { // Async or normal arrow function + if (func.body.kind !== 238 /* SyntaxKind.Block */) { // Async or normal arrow function returnType = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* CheckMode.SkipGenericFunctions */); if (isAsync) { // From within an async function you can return either a non-promise value or a promise. Any @@ -78783,15 +79624,25 @@ var ts; } function isExhaustiveSwitchStatement(node) { var links = getNodeLinks(node); - return links.isExhaustive !== undefined ? links.isExhaustive : (links.isExhaustive = computeExhaustiveSwitchStatement(node)); + if (links.isExhaustive === undefined) { + links.isExhaustive = 0; // Indicate resolution is in process + var exhaustive = computeExhaustiveSwitchStatement(node); + if (links.isExhaustive === 0) { + links.isExhaustive = exhaustive; + } + } + else if (links.isExhaustive === 0) { + links.isExhaustive = false; // Resolve circularity to false + } + return links.isExhaustive; } function computeExhaustiveSwitchStatement(node) { - if (node.expression.kind === 216 /* SyntaxKind.TypeOfExpression */) { + if (node.expression.kind === 218 /* SyntaxKind.TypeOfExpression */) { var witnesses = getSwitchClauseTypeOfWitnesses(node); if (!witnesses) { return false; } - var operandConstraint = getBaseConstraintOrType(getTypeOfExpression(node.expression.expression)); + var operandConstraint = getBaseConstraintOrType(checkExpressionCached(node.expression.expression)); // Get the not-equal flags for all handled cases. var notEqualFacts_2 = getNotEqualFactsFromTypeofSwitch(0, 0, witnesses); if (operandConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */) { @@ -78801,7 +79652,7 @@ var ts; // A missing not-equal flag indicates that the type wasn't handled by some case. return !someType(operandConstraint, function (t) { return (getTypeFacts(t) & notEqualFacts_2) === notEqualFacts_2; }); } - var type = getTypeOfExpression(node.expression); + var type = checkExpressionCached(node.expression); if (!isLiteralType(type)) { return false; } @@ -78852,11 +79703,11 @@ var ts; } function mayReturnNever(func) { switch (func.kind) { - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return true; - case 169 /* SyntaxKind.MethodDeclaration */: - return func.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */; + case 171 /* SyntaxKind.MethodDeclaration */: + return func.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */; default: return false; } @@ -78882,7 +79733,7 @@ var ts; } // If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check. // also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw - if (func.kind === 168 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 235 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { + if (func.kind === 170 /* SyntaxKind.MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 238 /* SyntaxKind.Block */ || !functionHasImplicitReturn(func)) { return; } var hasExplicitReturn = func.flags & 512 /* NodeFlags.HasExplicitReturn */; @@ -78916,7 +79767,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); checkNodeDeferred(node); if (ts.isFunctionExpression(node)) { checkCollisionsForDeclarationName(node, node.name); @@ -78943,7 +79794,7 @@ var ts; } // Grammar checking var hasGrammarError = checkGrammarFunctionLikeDeclaration(node); - if (!hasGrammarError && node.kind === 213 /* SyntaxKind.FunctionExpression */) { + if (!hasGrammarError && node.kind === 215 /* SyntaxKind.FunctionExpression */) { checkGrammarForGenerator(node); } contextuallyCheckFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -78994,7 +79845,7 @@ var ts; } } function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) { - ts.Debug.assert(node.kind !== 169 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); + ts.Debug.assert(node.kind !== 171 /* SyntaxKind.MethodDeclaration */ || ts.isObjectLiteralMethod(node)); var functionFlags = ts.getFunctionFlags(node); var returnType = getReturnTypeFromAnnotation(node); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); @@ -79007,7 +79858,7 @@ var ts; // checkFunctionExpressionBodies). So it must be done now. getReturnTypeOfSignature(getSignatureFromDeclaration(node)); } - if (node.body.kind === 235 /* SyntaxKind.Block */) { + if (node.body.kind === 238 /* SyntaxKind.Block */) { checkSourceElement(node.body); } else { @@ -79097,7 +79948,7 @@ var ts; expr.expression.kind === 108 /* SyntaxKind.ThisKeyword */) { // Look for if this is the constructor for the class that `symbol` is a property of. var ctor = ts.getContainingFunction(expr); - if (!(ctor && (ctor.kind === 171 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { + if (!(ctor && (ctor.kind === 173 /* SyntaxKind.Constructor */ || isJSConstructor(ctor)))) { return true; } if (symbol.valueDeclaration) { @@ -79122,7 +79973,7 @@ var ts; var symbol_2 = getNodeLinks(node).resolvedSymbol; if (symbol_2.flags & 2097152 /* SymbolFlags.Alias */) { var declaration = getDeclarationOfAliasSymbol(symbol_2); - return !!declaration && declaration.kind === 268 /* SyntaxKind.NamespaceImport */; + return !!declaration && declaration.kind === 271 /* SyntaxKind.NamespaceImport */; } } } @@ -79222,7 +80073,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos); var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expressions_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); - if (container && container.kind !== 171 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { + if (container && container.kind !== 173 /* SyntaxKind.Constructor */ && (ts.getFunctionFlags(container) & 2 /* FunctionFlags.Async */) === 0) { var relatedInfo = ts.createDiagnosticForNode(container, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); } @@ -79390,6 +80241,9 @@ var ts; } return booleanType; } + function hasEmptyObjectIntersection(type) { + return someType(type, function (t) { return t === unknownEmptyObjectType || !!(t.flags & 2097152 /* TypeFlags.Intersection */) && ts.some(t.types, isEmptyAnonymousObjectType); }); + } function checkInExpression(left, right, leftType, rightType) { if (leftType === silentNeverType || rightType === silentNeverType) { return silentNeverType; @@ -79406,40 +80260,20 @@ var ts; } } else { - leftType = checkNonNullType(leftType, left); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // Require the left operand to be of type Any, the String primitive type, or the Number primitive type. - if (!(allTypesAssignableToKind(leftType, 402653316 /* TypeFlags.StringLike */ | 296 /* TypeFlags.NumberLike */ | 12288 /* TypeFlags.ESSymbolLike */) || - isTypeAssignableToKind(leftType, 4194304 /* TypeFlags.Index */ | 134217728 /* TypeFlags.TemplateLiteral */ | 268435456 /* TypeFlags.StringMapping */ | 262144 /* TypeFlags.TypeParameter */))) { - error(left, ts.Diagnostics.The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or_symbol); + // The type of the lef operand must be assignable to string, number, or symbol. + checkTypeAssignableTo(checkNonNullType(leftType, left), stringNumberSymbolType, left); + } + // The type of the right operand must be assignable to 'object'. + if (checkTypeAssignableTo(checkNonNullType(rightType, right), nonPrimitiveType, right)) { + // The {} type is assignable to the object type, yet {} might represent a primitive type. Here we + // detect and error on {} that results from narrowing the unknown type, as well as intersections + // that include {} (we know that the other types in such intersections are assignable to object + // since we already checked for that). + if (hasEmptyObjectIntersection(rightType)) { + error(right, ts.Diagnostics.Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operator, typeToString(rightType)); } } - rightType = checkNonNullType(rightType, right); - // TypeScript 1.0 spec (April 2014): 4.15.5 - // The in operator requires the right operand to be - // - // 1. assignable to the non-primitive type, - // 2. an unconstrained type parameter, - // 3. a union or intersection including one or more type parameters, whose constituents are all assignable to the - // the non-primitive type, or are unconstrainted type parameters, or have constraints assignable to the - // non-primitive type, or - // 4. a type parameter whose constraint is - // i. an object type, - // ii. the non-primitive type, or - // iii. a union or intersection with at least one constituent assignable to an object or non-primitive type. - // - // The divergent behavior for type parameters and unions containing type parameters is a workaround for type - // parameters not being narrowable. If the right operand is a concrete type, we can error if there is any chance - // it is a primitive. But if the operand is a type parameter, it cannot be narrowed, so we don't issue an error - // unless *all* instantiations would result in an error. - // // The result is always of the Boolean primitive type. - var rightTypeConstraint = getConstraintOfType(rightType); - if (!allTypesAssignableToKind(rightType, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - rightTypeConstraint && (isTypeAssignableToKind(rightType, 3145728 /* TypeFlags.UnionOrIntersection */) && !allTypesAssignableToKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */) || - !maybeTypeOfKind(rightTypeConstraint, 67108864 /* TypeFlags.NonPrimitive */ | 58982400 /* TypeFlags.InstantiableNonPrimitive */ | 524288 /* TypeFlags.Object */))) { - error(right, ts.Diagnostics.The_right_hand_side_of_an_in_expression_must_not_be_a_primitive); - } return booleanType; } function checkObjectLiteralAssignment(node, sourceType, rightIsThis) { @@ -79457,7 +80291,7 @@ var ts; if (rightIsThis === void 0) { rightIsThis = false; } var properties = node.properties; var property = properties[propertyIndex]; - if (property.kind === 296 /* SyntaxKind.PropertyAssignment */ || property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (property.kind === 299 /* SyntaxKind.PropertyAssignment */ || property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var name = property.name; var exprType = getLiteralTypeFromPropertyName(name); if (isTypeUsableAsPropertyName(exprType)) { @@ -79470,9 +80304,9 @@ var ts; } var elementType = getIndexedAccessType(objectLiteralType, exprType, 32 /* AccessFlags.ExpressionPosition */, name); var type = getFlowTypeOfDestructuring(property, elementType); - return checkDestructuringAssignment(property.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); + return checkDestructuringAssignment(property.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ ? property : property.initializer, type); } - else if (property.kind === 298 /* SyntaxKind.SpreadAssignment */) { + else if (property.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (propertyIndex < properties.length - 1) { error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern); } @@ -79510,7 +80344,7 @@ var ts; var inBoundsType = compilerOptions.noUncheckedIndexedAccess ? undefined : possiblyOutOfBoundsType; for (var i = 0; i < elements.length; i++) { var type = possiblyOutOfBoundsType; - if (node.elements[i].kind === 225 /* SyntaxKind.SpreadElement */) { + if (node.elements[i].kind === 227 /* SyntaxKind.SpreadElement */) { type = inBoundsType = inBoundsType !== null && inBoundsType !== void 0 ? inBoundsType : (checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, sourceType, undefinedType, node) || errorType); } checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode); @@ -79520,8 +80354,8 @@ var ts; function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) { var elements = node.elements; var element = elements[elementIndex]; - if (element.kind !== 227 /* SyntaxKind.OmittedExpression */) { - if (element.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (element.kind !== 229 /* SyntaxKind.OmittedExpression */) { + if (element.kind !== 227 /* SyntaxKind.SpreadElement */) { var indexType = getNumberLiteralType(elementIndex); if (isArrayLikeType(sourceType)) { // We create a synthetic expression so that getIndexedAccessType doesn't get confused @@ -79539,7 +80373,7 @@ var ts; } else { var restExpression = element.expression; - if (restExpression.kind === 221 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (restExpression.kind === 223 /* SyntaxKind.BinaryExpression */ && restExpression.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer); } else { @@ -79555,7 +80389,7 @@ var ts; } function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) { var target; - if (exprOrAssignment.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (exprOrAssignment.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { var prop = exprOrAssignment; if (prop.objectAssignmentInitializer) { // In strict null checking mode, if a default value of a non-undefined type is specified, remove @@ -79571,7 +80405,7 @@ var ts; else { target = exprOrAssignment; } - if (target.kind === 221 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { + if (target.kind === 223 /* SyntaxKind.BinaryExpression */ && target.operatorToken.kind === 63 /* SyntaxKind.EqualsToken */) { checkBinaryExpression(target, checkMode); target = target.left; // A default value is specified, so remove undefined from the final type. @@ -79579,20 +80413,20 @@ var ts; sourceType = getTypeWithFacts(sourceType, 524288 /* TypeFacts.NEUndefined */); } } - if (target.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (target.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { return checkObjectLiteralAssignment(target, sourceType, rightIsThis); } - if (target.kind === 204 /* SyntaxKind.ArrayLiteralExpression */) { + if (target.kind === 206 /* SyntaxKind.ArrayLiteralExpression */) { return checkArrayLiteralAssignment(target, sourceType, checkMode); } return checkReferenceAssignment(target, sourceType, checkMode); } function checkReferenceAssignment(target, sourceType, checkMode) { var targetType = checkExpression(target, checkMode); - var error = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var error = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access; - var optionalError = target.parent.kind === 298 /* SyntaxKind.SpreadAssignment */ ? + var optionalError = target.parent.kind === 301 /* SyntaxKind.SpreadAssignment */ ? ts.Diagnostics.The_target_of_an_object_rest_assignment_may_not_be_an_optional_property_access : ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access; if (checkReferenceExpression(target, error, optionalError)) { @@ -79617,36 +80451,36 @@ var ts; case 79 /* SyntaxKind.Identifier */: case 10 /* SyntaxKind.StringLiteral */: case 13 /* SyntaxKind.RegularExpressionLiteral */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 223 /* SyntaxKind.TemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 8 /* SyntaxKind.NumericLiteral */: case 9 /* SyntaxKind.BigIntLiteral */: case 110 /* SyntaxKind.TrueKeyword */: case 95 /* SyntaxKind.FalseKeyword */: case 104 /* SyntaxKind.NullKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 213 /* SyntaxKind.FunctionExpression */: - case 226 /* SyntaxKind.ClassExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 216 /* SyntaxKind.TypeOfExpression */: - case 230 /* SyntaxKind.NonNullExpression */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 278 /* SyntaxKind.JsxElement */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 215 /* SyntaxKind.FunctionExpression */: + case 228 /* SyntaxKind.ClassExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: + case 232 /* SyntaxKind.NonNullExpression */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 281 /* SyntaxKind.JsxElement */: return true; - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return isSideEffectFree(node.whenTrue) && isSideEffectFree(node.whenFalse); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isAssignmentOperator(node.operatorToken.kind)) { return false; } return isSideEffectFree(node.left) && isSideEffectFree(node.right); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: // Unary operators ~, !, +, and - have no side effects. // The rest do. switch (node.operator) { @@ -79658,9 +80492,9 @@ var ts; } return false; // Some forms listed here for clarity - case 217 /* SyntaxKind.VoidExpression */: // Explicit opt-out - case 211 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings - case 229 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings + case 219 /* SyntaxKind.VoidExpression */: // Explicit opt-out + case 213 /* SyntaxKind.TypeAssertionExpression */: // Not SEF, but can produce useful type warnings + case 231 /* SyntaxKind.AsExpression */: // Not SEF, but can produce useful type warnings default: return false; } @@ -79697,7 +80531,7 @@ var ts; } checkGrammarNullishCoalesceWithLogicalExpression(node); var operator = node.operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (node.left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || node.left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { state.skip = true; setLastResult(state, checkDestructuringAssignment(node.left, checkExpression(node.right, checkMode), checkMode, node.right.kind === 108 /* SyntaxKind.ThisKeyword */)); return state; @@ -79719,11 +80553,11 @@ var ts; if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */ || operator === 56 /* SyntaxKind.BarBarToken */ || operator === 60 /* SyntaxKind.QuestionQuestionToken */) { if (operator === 55 /* SyntaxKind.AmpersandAmpersandToken */) { var parent = node.parent; - while (parent.kind === 212 /* SyntaxKind.ParenthesizedExpression */ + while (parent.kind === 214 /* SyntaxKind.ParenthesizedExpression */ || ts.isBinaryExpression(parent) && (parent.operatorToken.kind === 55 /* SyntaxKind.AmpersandAmpersandToken */ || parent.operatorToken.kind === 56 /* SyntaxKind.BarBarToken */)) { parent = parent.parent; } - checkTestingKnownTruthyCallableOrAwaitableType(node.left, ts.isIfStatement(parent) ? parent.thenStatement : undefined); + checkTestingKnownTruthyCallableOrAwaitableType(node.left, leftType, ts.isIfStatement(parent) ? parent.thenStatement : undefined); } checkTruthinessOfType(leftType, node.left); } @@ -79794,7 +80628,7 @@ var ts; // expression-wide checks and does not use a work stack to fold nested binary expressions into the same callstack frame function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) { var operator = operatorToken.kind; - if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 204 /* SyntaxKind.ArrayLiteralExpression */)) { + if (operator === 63 /* SyntaxKind.EqualsToken */ && (left.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || left.kind === 206 /* SyntaxKind.ArrayLiteralExpression */)) { return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 108 /* SyntaxKind.ThisKeyword */); } var leftType; @@ -79950,6 +80784,7 @@ var ts; var eqType = operator === 34 /* SyntaxKind.EqualsEqualsToken */ || operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */; error(errorNode, ts.Diagnostics.This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value, eqType ? "false" : "true"); } + checkNaNEquality(errorNode, operator, left, right); reportOperatorErrorUnless(function (left, right) { return isTypeEqualityComparableTo(left, right) || isTypeEqualityComparableTo(right, left); }); return booleanType; case 102 /* SyntaxKind.InstanceOfKeyword */: @@ -80145,20 +80980,35 @@ var ts; } } function tryGiveBetterPrimaryError(errNode, maybeMissingAwait, leftStr, rightStr) { - var typeName; switch (operatorToken.kind) { case 36 /* SyntaxKind.EqualsEqualsEqualsToken */: case 34 /* SyntaxKind.EqualsEqualsToken */: - typeName = "false"; - break; case 37 /* SyntaxKind.ExclamationEqualsEqualsToken */: case 35 /* SyntaxKind.ExclamationEqualsToken */: - typeName = "true"; + return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap, leftStr, rightStr); + default: + return undefined; } - if (typeName) { - return errorAndMaybeSuggestAwait(errNode, maybeMissingAwait, ts.Diagnostics.This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap, typeName, leftStr, rightStr); + } + function checkNaNEquality(errorNode, operator, left, right) { + var isLeftNaN = isGlobalNaN(ts.skipParentheses(left)); + var isRightNaN = isGlobalNaN(ts.skipParentheses(right)); + if (isLeftNaN || isRightNaN) { + var err = error(errorNode, ts.Diagnostics.This_condition_will_always_return_0, ts.tokenToString(operator === 36 /* SyntaxKind.EqualsEqualsEqualsToken */ || operator === 34 /* SyntaxKind.EqualsEqualsToken */ ? 95 /* SyntaxKind.FalseKeyword */ : 110 /* SyntaxKind.TrueKeyword */)); + if (isLeftNaN && isRightNaN) + return; + var operatorString = operator === 37 /* SyntaxKind.ExclamationEqualsEqualsToken */ || operator === 35 /* SyntaxKind.ExclamationEqualsToken */ ? ts.tokenToString(53 /* SyntaxKind.ExclamationToken */) : ""; + var location = isLeftNaN ? right : left; + var expression = ts.skipParentheses(location); + ts.addRelatedInfo(err, ts.createDiagnosticForNode(location, ts.Diagnostics.Did_you_mean_0, "".concat(operatorString, "Number.isNaN(").concat(ts.isEntityNameExpression(expression) ? ts.entityNameToString(expression) : "...", ")"))); } - return undefined; + } + function isGlobalNaN(expr) { + if (ts.isIdentifier(expr) && expr.escapedText === "NaN") { + var globalNaNSymbol = getGlobalNaNSymbol(); + return !!globalNaNSymbol && globalNaNSymbol === getResolvedSymbol(expr); + } + return false; } } function getBaseTypesIfUnrelated(leftType, rightType, isRelated) { @@ -80239,8 +81089,8 @@ var ts; } } function checkConditionalExpression(node, checkMode) { - checkTruthinessExpression(node.condition); - checkTestingKnownTruthyCallableOrAwaitableType(node.condition, node.whenTrue); + var type = checkTruthinessExpression(node.condition); + checkTestingKnownTruthyCallableOrAwaitableType(node.condition, type, node.whenTrue); var type1 = checkExpression(node.whenTrue, checkMode); var type2 = checkExpression(node.whenFalse, checkMode); return getUnionType([type1, type2], 2 /* UnionReduction.Subtype */); @@ -80269,7 +81119,7 @@ var ts; type.flags & 58982400 /* TypeFlags.InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 402653316 /* TypeFlags.StringLike */)); } function getContextNode(node) { - if (node.kind === 286 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { + if (node.kind === 289 /* SyntaxKind.JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) { return node.parent.parent; // Needs to be the root JsxElement, so it encompasses the attributes _and_ the children (which are essentially part of the attributes) } return node; @@ -80323,8 +81173,8 @@ var ts; } function isTypeAssertion(node) { node = ts.skipParentheses(node, /*excludeJSDocTypeAssertions*/ true); - return node.kind === 211 /* SyntaxKind.TypeAssertionExpression */ || - node.kind === 229 /* SyntaxKind.AsExpression */ || + return node.kind === 213 /* SyntaxKind.TypeAssertionExpression */ || + node.kind === 231 /* SyntaxKind.AsExpression */ || ts.isJSDocTypeAssertion(node); } function checkDeclarationInitializer(declaration, checkMode, contextualType) { @@ -80333,7 +81183,7 @@ var ts; (contextualType ? checkExpressionWithContextualType(initializer, contextualType, /*inferenceContext*/ undefined, checkMode || 0 /* CheckMode.Normal */) : checkExpressionCached(initializer, checkMode)); - return ts.isParameter(declaration) && declaration.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && + return ts.isParameter(declaration) && declaration.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && isTupleType(type) && !type.target.hasRestElement && getTypeReferenceArity(type) < declaration.name.elements.length ? padTupleType(type, declaration.name) : type; } @@ -80343,7 +81193,7 @@ var ts; var elementFlags = type.target.elementFlags.slice(); for (var i = getTypeReferenceArity(type); i < patternElements.length; i++) { var e = patternElements[i]; - if (i < patternElements.length - 1 || !(e.kind === 203 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { + if (i < patternElements.length - 1 || !(e.kind === 205 /* SyntaxKind.BindingElement */ && e.dotDotDotToken)) { elementTypes.push(!ts.isOmittedExpression(e) && hasDefaultValue(e) ? getTypeFromBindingElement(e, /*includePatternInType*/ false, /*reportErrors*/ false) : anyType); elementFlags.push(2 /* ElementFlags.Optional */); if (!ts.isOmittedExpression(e) && !hasDefaultValue(e)) { @@ -80411,7 +81261,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } return checkExpressionForMutableLocation(node.initializer, checkMode); @@ -80422,7 +81272,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); @@ -80496,6 +81346,9 @@ var ts; function hasInferenceCandidates(info) { return !!(info.candidates || info.contraCandidates); } + function hasInferenceCandidatesOrDefault(info) { + return !!(info.candidates || info.contraCandidates || hasTypeParameterDefault(info.typeParameter)); + } function hasOverlappingInferences(a, b) { for (var i = 0; i < a.length; i++) { if (hasInferenceCandidates(a[i]) && hasInferenceCandidates(b[i])) { @@ -80665,11 +81518,11 @@ var ts; // - 'left' in property access // - 'object' in indexed access // - target in rhs of import statement - var ok = (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || - (node.parent.kind === 207 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || - ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 161 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || - (node.parent.kind === 181 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || - (node.parent.kind === 275 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums + var ok = (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && node.parent.expression === node) || + (node.parent.kind === 209 /* SyntaxKind.ElementAccessExpression */ && node.parent.expression === node) || + ((node.kind === 79 /* SyntaxKind.Identifier */ || node.kind === 163 /* SyntaxKind.QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) || + (node.parent.kind === 183 /* SyntaxKind.TypeQuery */ && node.parent.exprName === node)) || + (node.parent.kind === 278 /* SyntaxKind.ExportSpecifier */); // We allow reexporting const enums if (!ok) { error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query); } @@ -80694,9 +81547,9 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 228 /* SyntaxKind.ClassExpression */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: cancellationToken.throwIfCancellationRequested(); } } @@ -80727,80 +81580,82 @@ var ts; return trueType; case 95 /* SyntaxKind.FalseKeyword */: return falseType; - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return checkTemplateExpression(node); case 13 /* SyntaxKind.RegularExpressionLiteral */: return globalRegExpType; - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return checkArrayLiteral(node, checkMode, forceTuple); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return checkObjectLiteral(node, checkMode); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return checkPropertyAccessExpression(node, checkMode); - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return checkQualifiedName(node, checkMode); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return checkIndexedAccess(node, checkMode); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (node.expression.kind === 100 /* SyntaxKind.ImportKeyword */) { return checkImportCallExpression(node); } // falls through - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return checkCallExpression(node, checkMode); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return checkTaggedTemplateExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return checkParenthesizedExpression(node, checkMode); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return checkClassExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return checkTypeOfExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: return checkAssertion(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return checkNonNullAssertion(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return checkExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return checkSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return checkMetaProperty(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return checkDeleteExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return checkVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return checkAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return checkPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return checkPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return checkBinaryExpression(node, checkMode); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return checkConditionalExpression(node, checkMode); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return checkSpreadExpression(node, checkMode); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return undefinedWideningType; - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return checkYieldExpression(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return checkSyntheticExpression(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return checkJsxExpression(node, checkMode); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return checkJsxElement(node, checkMode); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return checkJsxSelfClosingElement(node, checkMode); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return checkJsxFragment(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return checkJsxAttributes(node, checkMode); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement"); } return errorType; @@ -80859,10 +81714,10 @@ var ts; checkVariableLikeDeclaration(node); var func = ts.getContainingFunction(node); if (ts.hasSyntacticModifier(node, 16476 /* ModifierFlags.ParameterPropertyModifier */)) { - if (!(func.kind === 171 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { + if (!(func.kind === 173 /* SyntaxKind.Constructor */ && ts.nodeIsPresent(func.body))) { error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation); } - if (func.kind === 171 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { + if (func.kind === 173 /* SyntaxKind.Constructor */ && ts.isIdentifier(node.name) && node.name.escapedText === "constructor") { error(node.name, ts.Diagnostics.constructor_cannot_be_used_as_a_parameter_property_name); } } @@ -80873,13 +81728,13 @@ var ts; if (func.parameters.indexOf(node) !== 0) { error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText); } - if (func.kind === 171 /* SyntaxKind.Constructor */ || func.kind === 175 /* SyntaxKind.ConstructSignature */ || func.kind === 180 /* SyntaxKind.ConstructorType */) { + if (func.kind === 173 /* SyntaxKind.Constructor */ || func.kind === 177 /* SyntaxKind.ConstructSignature */ || func.kind === 182 /* SyntaxKind.ConstructorType */) { error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter); } - if (func.kind === 214 /* SyntaxKind.ArrowFunction */) { + if (func.kind === 216 /* SyntaxKind.ArrowFunction */) { error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter); } - if (func.kind === 172 /* SyntaxKind.GetAccessor */ || func.kind === 173 /* SyntaxKind.SetAccessor */) { + if (func.kind === 174 /* SyntaxKind.GetAccessor */ || func.kind === 175 /* SyntaxKind.SetAccessor */) { error(node, ts.Diagnostics.get_and_set_accessors_cannot_declare_this_parameters); } } @@ -80937,13 +81792,13 @@ var ts; } function getTypePredicateParent(node) { switch (node.parent.kind) { - case 214 /* SyntaxKind.ArrowFunction */: - case 174 /* SyntaxKind.CallSignature */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 179 /* SyntaxKind.FunctionType */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 216 /* SyntaxKind.ArrowFunction */: + case 176 /* SyntaxKind.CallSignature */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 181 /* SyntaxKind.FunctionType */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: var parent = node.parent; if (node === parent.type) { return parent; @@ -80961,7 +81816,7 @@ var ts; error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName); return true; } - else if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 201 /* SyntaxKind.ObjectBindingPattern */) { + else if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ || name.kind === 203 /* SyntaxKind.ObjectBindingPattern */) { if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) { return true; } @@ -80970,13 +81825,13 @@ var ts; } function checkSignatureDeclaration(node) { // Grammar checking - if (node.kind === 176 /* SyntaxKind.IndexSignature */) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */) { checkGrammarIndexSignature(node); } // TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled - else if (node.kind === 179 /* SyntaxKind.FunctionType */ || node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 180 /* SyntaxKind.ConstructorType */ || - node.kind === 174 /* SyntaxKind.CallSignature */ || node.kind === 171 /* SyntaxKind.Constructor */ || - node.kind === 175 /* SyntaxKind.ConstructSignature */) { + else if (node.kind === 181 /* SyntaxKind.FunctionType */ || node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 182 /* SyntaxKind.ConstructorType */ || + node.kind === 176 /* SyntaxKind.CallSignature */ || node.kind === 173 /* SyntaxKind.Constructor */ || + node.kind === 177 /* SyntaxKind.ConstructSignature */) { checkGrammarFunctionLikeDeclaration(node); } var functionFlags = ts.getFunctionFlags(node); @@ -81008,10 +81863,10 @@ var ts; var returnTypeNode = ts.getEffectiveReturnTypeNode(node); if (noImplicitAny && !returnTypeNode) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type); break; } @@ -81041,7 +81896,7 @@ var ts; checkAsyncFunctionReturnType(node, returnTypeNode); } } - if (node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 317 /* SyntaxKind.JSDocFunctionType */) { + if (node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 320 /* SyntaxKind.JSDocFunctionType */) { registerForUnusedIdentifiersCheck(node); } } @@ -81053,7 +81908,7 @@ var ts; var privateIdentifiers = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 171 /* SyntaxKind.Constructor */) { + if (member.kind === 173 /* SyntaxKind.Constructor */) { for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var param = _c[_b]; if (ts.isParameterPropertyDeclaration(param, member) && !ts.isBindingPattern(param.name)) { @@ -81075,16 +81930,16 @@ var ts; var memberName = name && ts.getPropertyNameForPropertyNameNode(name); if (memberName) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: addName(names, name, memberName, 1 /* DeclarationMeaning.GetAccessor */ | privateStaticFlags); break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: addName(names, name, memberName, 2 /* DeclarationMeaning.SetAccessor */ | privateStaticFlags); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: addName(names, name, memberName, 3 /* DeclarationMeaning.GetOrSetAccessor */ | privateStaticFlags); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: addName(names, name, memberName, 8 /* DeclarationMeaning.Method */ | privateStaticFlags); break; } @@ -81156,7 +82011,7 @@ var ts; var names = new ts.Map(); for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; - if (member.kind === 166 /* SyntaxKind.PropertySignature */) { + if (member.kind === 168 /* SyntaxKind.PropertySignature */) { var memberName = void 0; var name = member.name; switch (name.kind) { @@ -81181,7 +82036,7 @@ var ts; } } function checkTypeForDuplicateIndexSignatures(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { var nodeSymbol = getSymbolOfNode(node); // in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration // to prevent this run check only for the first declaration of a given kind @@ -81229,7 +82084,7 @@ var ts; checkVariableLikeDeclaration(node); setNodeLinksForPrivateIdentifierScope(node); // property signatures already report "initializer not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && node.initializer) { error(node, ts.Diagnostics.Property_0_cannot_have_an_initializer_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } } @@ -81249,7 +82104,7 @@ var ts; // Grammar checking for modifiers is done inside the function checkGrammarFunctionLikeDeclaration checkFunctionOrMethodDeclaration(node); // method signatures already report "implementation not allowed in ambient context" elsewhere - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */) && node.kind === 169 /* SyntaxKind.MethodDeclaration */ && node.body) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */) && node.kind === 171 /* SyntaxKind.MethodDeclaration */ && node.body) { error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name)); } // Private named methods are only allowed in class declarations @@ -81302,7 +82157,7 @@ var ts; if (ts.isPrivateIdentifierClassElementDeclaration(n)) { return true; } - return n.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return n.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.isStatic(n) && !!n.initializer; } @@ -81385,7 +82240,7 @@ var ts; checkGrammarComputedPropertyName(node.name); checkDecorators(node); checkSignatureDeclaration(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { if (!(node.flags & 16777216 /* NodeFlags.Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 256 /* NodeFlags.HasImplicitReturn */)) { if (!(node.flags & 512 /* NodeFlags.HasExplicitReturn */)) { error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value); @@ -81395,20 +82250,20 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); } if (hasBindableName(node)) { // TypeScript 1.0 spec (April 2014): 8.4.3 // Accessors for the same member name must specify the same accessibility. var symbol = getSymbolOfNode(node); - var getter = ts.getDeclarationOfKind(symbol, 172 /* SyntaxKind.GetAccessor */); - var setter = ts.getDeclarationOfKind(symbol, 173 /* SyntaxKind.SetAccessor */); + var getter = ts.getDeclarationOfKind(symbol, 174 /* SyntaxKind.GetAccessor */); + var setter = ts.getDeclarationOfKind(symbol, 175 /* SyntaxKind.SetAccessor */); if (getter && setter && !(getNodeCheckFlags(getter) & 1 /* NodeCheckFlags.TypeChecked */)) { getNodeLinks(getter).flags |= 1 /* NodeCheckFlags.TypeChecked */; var getterFlags = ts.getEffectiveModifierFlags(getter); var setterFlags = ts.getEffectiveModifierFlags(setter); - if ((getterFlags & 128 /* ModifierFlags.Abstract */) !== (setterFlags & 128 /* ModifierFlags.Abstract */)) { + if ((getterFlags & 256 /* ModifierFlags.Abstract */) !== (setterFlags & 256 /* ModifierFlags.Abstract */)) { error(getter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); error(setter.name, ts.Diagnostics.Accessors_must_both_be_abstract_or_non_abstract); } @@ -81425,7 +82280,7 @@ var ts; } } var returnType = getTypeOfAccessors(getSymbolOfNode(node)); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType); } } @@ -81471,7 +82326,7 @@ var ts; } function checkTypeReferenceNode(node) { checkGrammarTypeArguments(node, node.typeArguments); - if (node.kind === 178 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { + if (node.kind === 180 /* SyntaxKind.TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) { grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments); } ts.forEach(node.typeArguments, checkSourceElement); @@ -81487,7 +82342,7 @@ var ts; } var symbol = getNodeLinks(node).resolvedSymbol; if (symbol) { - if (ts.some(symbol.declarations, function (d) { return isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) { + if (ts.some(symbol.declarations, function (d) { return ts.isTypeDeclaration(d) && !!(d.flags & 268435456 /* NodeFlags.Deprecated */); })) { addDeprecatedSuggestion(getDeprecatedSuggestionNode(node), symbol.declarations, symbol.escapedName); } if (type.flags & 32 /* TypeFlags.Enum */ && symbol.flags & 8 /* SymbolFlags.EnumMember */) { @@ -81529,7 +82384,7 @@ var ts; var hasNamedElement = ts.some(elementTypes, ts.isNamedTupleMember); for (var _i = 0, elementTypes_1 = elementTypes; _i < elementTypes_1.length; _i++) { var e = elementTypes_1[_i]; - if (e.kind !== 197 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { + if (e.kind !== 199 /* SyntaxKind.NamedTupleMember */ && hasNamedElement) { grammarErrorOnNode(e, ts.Diagnostics.Tuple_members_must_all_have_names_or_all_not_have_names); break; } @@ -81578,7 +82433,7 @@ var ts; var objectType = type.objectType; var indexType = type.indexType; if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) { - if (accessNode.kind === 207 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && + if (accessNode.kind === 209 /* SyntaxKind.ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) && ts.getObjectFlags(objectType) & 32 /* ObjectFlags.Mapped */ && getMappedTypeModifiers(objectType) & 1 /* MappedTypeModifiers.IncludeReadonly */) { error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType)); } @@ -81643,7 +82498,7 @@ var ts; ts.forEachChild(node, checkSourceElement); } function checkInferType(node) { - if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 189 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { + if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 191 /* SyntaxKind.ConditionalType */ && n.parent.extendsType === n; })) { grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type); } checkSourceElement(node.typeParameter); @@ -81653,7 +82508,7 @@ var ts; if (!links.typeParametersChecked) { links.typeParametersChecked = true; var typeParameter = getDeclaredTypeOfTypeParameter(symbol); - var declarations = ts.getDeclarationsOfKind(symbol, 163 /* SyntaxKind.TypeParameter */); + var declarations = ts.getDeclarationsOfKind(symbol, 165 /* SyntaxKind.TypeParameter */); if (!areTypeParametersIdentical(declarations, [typeParameter], function (decl) { return [decl]; })) { // Report an error on every conflicting declaration. var name = symbolToString(symbol); @@ -81694,10 +82549,10 @@ var ts; if (node.dotDotDotToken && node.questionToken) { grammarErrorOnNode(node, ts.Diagnostics.A_tuple_member_cannot_be_both_optional_and_rest); } - if (node.type.kind === 185 /* SyntaxKind.OptionalType */) { + if (node.type.kind === 187 /* SyntaxKind.OptionalType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_optional_with_a_question_mark_after_the_name_and_before_the_colon_rather_than_after_the_type); } - if (node.type.kind === 186 /* SyntaxKind.RestType */) { + if (node.type.kind === 188 /* SyntaxKind.RestType */) { grammarErrorOnNode(node.type, ts.Diagnostics.A_labeled_tuple_element_is_declared_as_rest_with_a_before_the_name_rather_than_before_the_type); } checkSourceElement(node.type); @@ -81710,9 +82565,9 @@ var ts; var flags = ts.getCombinedModifierFlags(n); // children of classes (even ambient classes) should not be marked as ambient or export // because those flags have no useful semantics there. - if (n.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */ && - n.parent.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - n.parent.kind !== 226 /* SyntaxKind.ClassExpression */ && + if (n.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */ && + n.parent.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + n.parent.kind !== 228 /* SyntaxKind.ClassExpression */ && n.flags & 16777216 /* NodeFlags.Ambient */) { if (!(flags & 2 /* ModifierFlags.Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) { // It is nested in an ambient context, which means it is automatically exported @@ -81752,7 +82607,7 @@ var ts; else if (deviation & (8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */)) { error(ts.getNameOfDeclaration(o) || o, ts.Diagnostics.Overload_signatures_must_all_be_public_private_or_protected); } - else if (deviation & 128 /* ModifierFlags.Abstract */) { + else if (deviation & 256 /* ModifierFlags.Abstract */) { error(ts.getNameOfDeclaration(o), ts.Diagnostics.Overload_signatures_must_all_be_abstract_or_non_abstract); } }); @@ -81769,7 +82624,7 @@ var ts; }); } } - var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 128 /* ModifierFlags.Abstract */; + var flagsToCheck = 1 /* ModifierFlags.Export */ | 2 /* ModifierFlags.Ambient */ | 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | 256 /* ModifierFlags.Abstract */; var someNodeFlags = 0 /* ModifierFlags.None */; var allNodeFlags = flagsToCheck; var someHaveQuestionToken = false; @@ -81808,7 +82663,7 @@ var ts; // Both are literal property names that are the same. ts.isPropertyNameLiteral(node.name) && ts.isPropertyNameLiteral(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) { - var reportError = (node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */) && + var reportError = (node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */) && ts.isStatic(node) !== ts.isStatic(subsequentNode); // we can get here in two cases // 1. mixed static and instance class members @@ -81833,7 +82688,7 @@ var ts; else { // Report different errors regarding non-consecutive blocks of declarations depending on whether // the node in question is abstract. - if (ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(errorNode, ts.Diagnostics.All_declarations_of_an_abstract_method_must_be_consecutive); } else { @@ -81850,7 +82705,7 @@ var ts; var current = declarations_5[_i]; var node = current; var inAmbientContext = node.flags & 16777216 /* NodeFlags.Ambient */; - var inAmbientContextOrInterface = node.parent && (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) || inAmbientContext; + var inAmbientContextOrInterface = node.parent && (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) || inAmbientContext; if (inAmbientContextOrInterface) { // check if declarations are consecutive only if they are non-ambient // 1. ambient declarations can be interleaved @@ -81861,10 +82716,10 @@ var ts; // 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one previousDeclaration = undefined; } - if ((node.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 226 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { + if ((node.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 228 /* SyntaxKind.ClassExpression */) && !inAmbientContext) { hasNonAmbientClass = true; } - if (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 169 /* SyntaxKind.MethodDeclaration */ || node.kind === 168 /* SyntaxKind.MethodSignature */ || node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 171 /* SyntaxKind.MethodDeclaration */ || node.kind === 170 /* SyntaxKind.MethodSignature */ || node.kind === 173 /* SyntaxKind.Constructor */) { functionDeclarations.push(node); var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck); someNodeFlags |= currentNodeFlags; @@ -81909,12 +82764,12 @@ var ts; }); } if (hasNonAmbientClass && !isConstructor && symbol.flags & 16 /* SymbolFlags.Function */ && declarations) { - var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 257 /* SyntaxKind.ClassDeclaration */; }) + var relatedDiagnostics_1 = ts.filter(declarations, function (d) { return d.kind === 260 /* SyntaxKind.ClassDeclaration */; }) .map(function (d) { return ts.createDiagnosticForNode(d, ts.Diagnostics.Consider_adding_a_declare_modifier_to_this_class); }); ts.forEach(declarations, function (declaration) { - var diagnostic = declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ + var diagnostic = declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ ? ts.Diagnostics.Class_declaration_cannot_implement_overload_list_for_0 - : declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ + : declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ ? ts.Diagnostics.Function_with_bodies_can_only_merge_with_classes_that_are_ambient : undefined; if (diagnostic) { @@ -81924,7 +82779,7 @@ var ts; } // Abstract methods can't have an implementation -- in particular, they don't need one. if (lastSeenNonAmbientDeclaration && !lastSeenNonAmbientDeclaration.body && - !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 128 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { + !ts.hasSyntacticModifier(lastSeenNonAmbientDeclaration, 256 /* ModifierFlags.Abstract */) && !lastSeenNonAmbientDeclaration.questionToken) { reportImplementationExpectedError(lastSeenNonAmbientDeclaration); } if (hasOverloads) { @@ -81970,9 +82825,9 @@ var ts; for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) { var d = _a[_i]; var declarationSpaces = getDeclarationSpaces(d); - var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */); + var effectiveDeclarationFlags = getEffectiveDeclarationFlags(d, 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */); if (effectiveDeclarationFlags & 1 /* ModifierFlags.Export */) { - if (effectiveDeclarationFlags & 512 /* ModifierFlags.Default */) { + if (effectiveDeclarationFlags & 1024 /* ModifierFlags.Default */) { defaultExportedDeclarationSpaces |= declarationSpaces; } else { @@ -82005,26 +82860,26 @@ var ts; function getDeclarationSpaces(decl) { var d = decl; switch (d.kind) { - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // A jsdoc typedef and callback are, by definition, type aliases. // falls through - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return 2 /* DeclarationSpaces.ExportType */; - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* ModuleInstanceState.NonInstantiated */ ? 4 /* DeclarationSpaces.ExportNamespace */ | 1 /* DeclarationSpaces.ExportValue */ : 4 /* DeclarationSpaces.ExportNamespace */; - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 299 /* SyntaxKind.EnumMember */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 302 /* SyntaxKind.EnumMember */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */; - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return 2 /* DeclarationSpaces.ExportType */ | 1 /* DeclarationSpaces.ExportValue */ | 4 /* DeclarationSpaces.ExportNamespace */; - case 271 /* SyntaxKind.ExportAssignment */: - case 221 /* SyntaxKind.BinaryExpression */: + case 274 /* SyntaxKind.ExportAssignment */: + case 223 /* SyntaxKind.BinaryExpression */: var node_2 = d; var expression = ts.isExportAssignment(node_2) ? node_2.expression : node_2.right; // Export assigned entity name expressions act as aliases and should fall through, otherwise they export values @@ -82034,19 +82889,19 @@ var ts; d = expression; // The below options all declare an Alias, which is allowed to merge with other values within the importing module. // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 268 /* SyntaxKind.NamespaceImport */: - case 267 /* SyntaxKind.ImportClause */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 271 /* SyntaxKind.NamespaceImport */: + case 270 /* SyntaxKind.ImportClause */: var result_12 = 0 /* DeclarationSpaces.None */; var target = resolveAlias(getSymbolOfNode(d)); ts.forEach(target.declarations, function (d) { result_12 |= getDeclarationSpaces(d); }); return result_12; - case 254 /* SyntaxKind.VariableDeclaration */: - case 203 /* SyntaxKind.BindingElement */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 270 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 + case 257 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 273 /* SyntaxKind.ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591 case 79 /* SyntaxKind.Identifier */: // https://github.com/microsoft/TypeScript/issues/36098 // Identifiers are used as declarations of assignment declarations whose parents may be // SyntaxKind.CallExpression - `Object.defineProperty(thing, "aField", {value: 42});` @@ -82090,7 +82945,7 @@ var ts; return typeAsPromise.promisedTypeOfPromise = getTypeArguments(type)[0]; } // primitives with a `{ then() }` won't be unwrapped/adopted. - if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { return undefined; } var thenFunction = getTypeOfPropertyOfType(type, "then"); // TODO: GH#18217 @@ -82157,7 +83012,7 @@ var ts; * Determines whether a type is an object with a callable `then` member. */ function isThenableType(type) { - if (allTypesAssignableToKind(type, 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { + if (allTypesAssignableToKind(getBaseConstraintOrType(type), 131068 /* TypeFlags.Primitive */ | 131072 /* TypeFlags.Never */)) { // primitive types cannot be considered "thenable" since they are not objects. return false; } @@ -82191,7 +83046,7 @@ var ts; // We only need `Awaited` if `T` is a type variable that has no base constraint, or the base constraint of `T` is `any`, `unknown`, `{}`, `object`, // or is promise-like. if (baseConstraint ? - baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || isThenableType(baseConstraint) : + baseConstraint.flags & 3 /* TypeFlags.AnyOrUnknown */ || isEmptyObjectType(baseConstraint) || someType(baseConstraint, isThenableType) : maybeTypeOfKind(type, 8650752 /* TypeFlags.TypeVariable */)) { return true; } @@ -82459,20 +83314,20 @@ var ts; var headMessage; var expectedReturnType; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var classSymbol = getSymbolOfNode(node.parent); var classConstructorType = getTypeOfSymbol(classSymbol); expectedReturnType = getUnionType([classConstructorType, voidType]); break; - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: headMessage = ts.Diagnostics.Decorator_function_return_type_is_0_but_is_expected_to_be_void_or_any; expectedReturnType = voidType; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: headMessage = ts.Diagnostics.Decorator_function_return_type_0_is_not_assignable_to_type_1; var methodType = getTypeOfNode(node.parent); var descriptorType = createTypedPropertyDescriptorType(methodType); @@ -82531,15 +83386,15 @@ var ts; function getEntityNameForDecoratorMetadata(node) { if (node) { switch (node.kind) { - case 188 /* SyntaxKind.IntersectionType */: - case 187 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: return getEntityNameForDecoratorMetadataFromTypeList(node.types); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]); - case 191 /* SyntaxKind.ParenthesizedType */: - case 197 /* SyntaxKind.NamedTupleMember */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 199 /* SyntaxKind.NamedTupleMember */: return getEntityNameForDecoratorMetadata(node.type); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return node.typeName; } } @@ -82548,13 +83403,13 @@ var ts; var commonEntityName; for (var _i = 0, types_21 = types; _i < types_21.length; _i++) { var typeNode = types_21[_i]; - while (typeNode.kind === 191 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 197 /* SyntaxKind.NamedTupleMember */) { + while (typeNode.kind === 193 /* SyntaxKind.ParenthesizedType */ || typeNode.kind === 199 /* SyntaxKind.NamedTupleMember */) { typeNode = typeNode.type; // Skip parens if need be } - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { continue; // Always elide `never` from the union/intersection if possible } - if (!strictNullChecks && (typeNode.kind === 196 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && (typeNode.kind === 198 /* SyntaxKind.LiteralType */ && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */ || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var individualEntityName = getEntityNameForDecoratorMetadata(typeNode); @@ -82600,14 +83455,14 @@ var ts; return; } checkExternalEmitHelpers(firstDecorator, 8 /* ExternalEmitHelpers.Decorate */); - if (node.kind === 164 /* SyntaxKind.Parameter */) { + if (node.kind === 166 /* SyntaxKind.Parameter */) { checkExternalEmitHelpers(firstDecorator, 32 /* ExternalEmitHelpers.Param */); } if (compilerOptions.emitDecoratorMetadata) { checkExternalEmitHelpers(firstDecorator, 16 /* ExternalEmitHelpers.Metadata */); // we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator. switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: var constructor = ts.getFirstConstructorWithBody(node); if (constructor) { for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) { @@ -82616,23 +83471,23 @@ var ts; } } break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - var otherKind = node.kind === 172 /* SyntaxKind.GetAccessor */ ? 173 /* SyntaxKind.SetAccessor */ : 172 /* SyntaxKind.GetAccessor */; + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + var otherKind = node.kind === 174 /* SyntaxKind.GetAccessor */ ? 175 /* SyntaxKind.SetAccessor */ : 174 /* SyntaxKind.GetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind); markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter)); } markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node)); break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node)); break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node)); var containingSignature = node.parent; for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) { @@ -82734,7 +83589,7 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return node.name; default: return undefined; @@ -82748,7 +83603,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name && node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name && node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); @@ -82774,7 +83629,7 @@ var ts; checkFunctionOrConstructorSymbol(symbol); } } - var body = node.kind === 168 /* SyntaxKind.MethodSignature */ ? undefined : node.body; + var body = node.kind === 170 /* SyntaxKind.MethodSignature */ ? undefined : node.body; checkSourceElement(body); checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, getReturnTypeFromAnnotation(node)); addLazyDiagnostic(checkFunctionOrMethodDeclarationDiagnostics); @@ -82820,42 +83675,42 @@ var ts; for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) { var node = potentiallyUnusedIdentifiers_1[_i]; switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: checkUnusedClassMembers(node, addDiagnostic); checkUnusedTypeParameters(node, addDiagnostic); break; - case 305 /* SyntaxKind.SourceFile */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 235 /* SyntaxKind.Block */: - case 263 /* SyntaxKind.CaseBlock */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 308 /* SyntaxKind.SourceFile */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 238 /* SyntaxKind.Block */: + case 266 /* SyntaxKind.CaseBlock */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: checkUnusedLocalsAndParameters(node, addDiagnostic); break; - case 171 /* SyntaxKind.Constructor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: if (node.body) { // Don't report unused parameters in overloads checkUnusedLocalsAndParameters(node, addDiagnostic); } checkUnusedTypeParameters(node, addDiagnostic); break; - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: checkUnusedTypeParameters(node, addDiagnostic); break; - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: checkUnusedInferTypeParameter(node, addDiagnostic); break; default: @@ -82865,7 +83720,7 @@ var ts; } function errorUnusedLocal(declaration, name, addDiagnostic) { var node = ts.getNameOfDeclaration(declaration) || declaration; - var message = isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read; + var message = ts.isTypeDeclaration(declaration) ? ts.Diagnostics._0_is_declared_but_never_used : ts.Diagnostics._0_is_declared_but_its_value_is_never_read; addDiagnostic(declaration, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(node, message, name)); } function isIdentifierThatStartsWithUnderscore(node) { @@ -82875,11 +83730,11 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - if (member.kind === 173 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + if (member.kind === 175 /* SyntaxKind.SetAccessor */ && member.symbol.flags & 32768 /* SymbolFlags.GetAccessor */) { // Already would have reported an error on the getter. break; } @@ -82890,7 +83745,7 @@ var ts; addDiagnostic(member, 0 /* UnusedKind.Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol))); } break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) { var parameter = _c[_b]; if (!parameter.symbol.isReferenced && ts.hasSyntacticModifier(parameter, 8 /* ModifierFlags.Private */)) { @@ -82898,9 +83753,9 @@ var ts; } } break; - case 176 /* SyntaxKind.IndexSignature */: - case 234 /* SyntaxKind.SemicolonClassElement */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 178 /* SyntaxKind.IndexSignature */: + case 237 /* SyntaxKind.SemicolonClassElement */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Can't be private break; default: @@ -82928,7 +83783,7 @@ var ts; continue; var name = ts.idText(typeParameter.name); var parent = typeParameter.parent; - if (parent.kind !== 190 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { + if (parent.kind !== 192 /* SyntaxKind.InferType */ && parent.typeParameters.every(isTypeParameterUnused)) { if (ts.tryAddToSet(seenParentsWithEveryUnused, parent)) { var sourceFile = ts.getSourceFileOfNode(parent); var range = ts.isJSDocTemplateTag(parent) @@ -83034,7 +83889,7 @@ var ts; var importDecl = importClause.parent; var nDeclarations = (importClause.name ? 1 : 0) + (importClause.namedBindings ? - (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) + (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */ ? 1 : importClause.namedBindings.elements.length) : 0); if (nDeclarations === unuseds.length) { addDiagnostic(importDecl, 0 /* UnusedKind.Local */, unuseds.length === 1 @@ -83052,7 +83907,7 @@ var ts; var bindingPattern = _a[0], bindingElements = _a[1]; var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* UnusedKind.Parameter */ : 0 /* UnusedKind.Local */; if (bindingPattern.elements.length === bindingElements.length) { - if (bindingElements.length === 1 && bindingPattern.parent.kind === 254 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (bindingElements.length === 1 && bindingPattern.parent.kind === 257 /* SyntaxKind.VariableDeclaration */ && bindingPattern.parent.parent.kind === 258 /* SyntaxKind.VariableDeclarationList */) { addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId); } else { @@ -83073,7 +83928,7 @@ var ts; if (declarationList.declarations.length === declarations.length) { addDiagnostic(declarationList, 0 /* UnusedKind.Local */, declarations.length === 1 ? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name)) - : ts.createDiagnosticForNode(declarationList.parent.kind === 237 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); + : ts.createDiagnosticForNode(declarationList.parent.kind === 240 /* SyntaxKind.VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused)); } else { for (var _i = 0, declarations_6 = declarations; _i < declarations_6.length; _i++) { @@ -83103,22 +83958,22 @@ var ts; switch (name.kind) { case 79 /* SyntaxKind.Identifier */: return ts.idText(name); - case 202 /* SyntaxKind.ArrayBindingPattern */: - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name); default: return ts.Debug.assertNever(name); } } function isImportedDeclaration(node) { - return node.kind === 267 /* SyntaxKind.ImportClause */ || node.kind === 270 /* SyntaxKind.ImportSpecifier */ || node.kind === 268 /* SyntaxKind.NamespaceImport */; + return node.kind === 270 /* SyntaxKind.ImportClause */ || node.kind === 273 /* SyntaxKind.ImportSpecifier */ || node.kind === 271 /* SyntaxKind.NamespaceImport */; } function importClauseFromImported(decl) { - return decl.kind === 267 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 268 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; + return decl.kind === 270 /* SyntaxKind.ImportClause */ ? decl : decl.kind === 271 /* SyntaxKind.NamespaceImport */ ? decl.parent : decl.parent.parent; } function checkBlock(node) { // Grammar checking for SyntaxKind.Block - if (node.kind === 235 /* SyntaxKind.Block */) { + if (node.kind === 238 /* SyntaxKind.Block */) { checkGrammarStatementInAmbientContext(node); } if (ts.isFunctionOrModuleBlock(node)) { @@ -83153,13 +84008,13 @@ var ts; if ((identifier === null || identifier === void 0 ? void 0 : identifier.escapedText) !== name) { return false; } - if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || - node.kind === 166 /* SyntaxKind.PropertySignature */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */ || - node.kind === 168 /* SyntaxKind.MethodSignature */ || - node.kind === 172 /* SyntaxKind.GetAccessor */ || - node.kind === 173 /* SyntaxKind.SetAccessor */ || - node.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || + node.kind === 168 /* SyntaxKind.PropertySignature */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */ || + node.kind === 170 /* SyntaxKind.MethodSignature */ || + node.kind === 174 /* SyntaxKind.GetAccessor */ || + node.kind === 175 /* SyntaxKind.SetAccessor */ || + node.kind === 299 /* SyntaxKind.PropertyAssignment */) { // it is ok to have member named '_super', '_this', `Promise`, etc. - member access is always qualified return false; } @@ -83225,7 +84080,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83240,7 +84095,7 @@ var ts; } // In case of variable declaration, node.parent is variable statement so look at the variable statement's parent var parent = getDeclarationContainer(node); - if (parent.kind === 305 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { + if (parent.kind === 308 /* SyntaxKind.SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 2048 /* NodeFlags.HasAsyncFunctions */) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. errorSkippedOn("noEmit", name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name)); } @@ -83340,7 +84195,7 @@ var ts; // skip variable declarations that don't have initializers // NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern // so we'll always treat binding elements as initialized - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ && !node.initializer) { return; } var symbol = getSymbolOfNode(node); @@ -83352,17 +84207,17 @@ var ts; localDeclarationSymbol !== symbol && localDeclarationSymbol.flags & 2 /* SymbolFlags.BlockScopedVariable */) { if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* NodeFlags.BlockScoped */) { - var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 255 /* SyntaxKind.VariableDeclarationList */); - var container = varDeclList.parent.kind === 237 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent + var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 258 /* SyntaxKind.VariableDeclarationList */); + var container = varDeclList.parent.kind === 240 /* SyntaxKind.VariableStatement */ && varDeclList.parent.parent ? varDeclList.parent.parent : undefined; // names of block-scoped and function scoped variables can collide only // if block scoped variable is defined in the function\module\source file scope (because of variable hoisting) var namesShareScope = container && - (container.kind === 235 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || - container.kind === 262 /* SyntaxKind.ModuleBlock */ || - container.kind === 261 /* SyntaxKind.ModuleDeclaration */ || - container.kind === 305 /* SyntaxKind.SourceFile */); + (container.kind === 238 /* SyntaxKind.Block */ && ts.isFunctionLike(container.parent) || + container.kind === 265 /* SyntaxKind.ModuleBlock */ || + container.kind === 264 /* SyntaxKind.ModuleDeclaration */ || + container.kind === 308 /* SyntaxKind.SourceFile */); // here we know that function scoped variable is shadowed by block scoped one // if they are defined in the same scope - binder has already reported redeclaration error // otherwise if variable has an initializer - show error that initialization will fail @@ -83393,7 +84248,7 @@ var ts; // Do not use hasDynamicName here, because that returns false for well known symbols. // We want to perform checkComputedPropertyName for all computed properties, including // well known symbols. - if (node.name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.name); if (ts.hasOnlyExpressionInitializer(node) && node.initializer) { checkExpressionCached(node.initializer); @@ -83415,7 +84270,7 @@ var ts; checkExternalEmitHelpers(node, 4 /* ExternalEmitHelpers.Rest */); } // check computed properties inside property names of binding elements - if (node.propertyName && node.propertyName.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.propertyName && node.propertyName.kind === 164 /* SyntaxKind.ComputedPropertyName */) { checkComputedPropertyName(node.propertyName); } // check private/protected variable access @@ -83437,7 +84292,7 @@ var ts; } // For a binding pattern, check contained binding elements if (ts.isBindingPattern(node.name)) { - if (node.name.kind === 202 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { + if (node.name.kind === 204 /* SyntaxKind.ArrayBindingPattern */ && languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) { checkExternalEmitHelpers(node, 512 /* ExternalEmitHelpers.Read */); } ts.forEach(node.name.elements, checkSourceElement); @@ -83449,7 +84304,7 @@ var ts; } // For a binding pattern, validate the initializer and exit if (ts.isBindingPattern(node.name)) { - var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */; + var needCheckInitializer = ts.hasOnlyExpressionInitializer(node) && node.initializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */; var needCheckWidenedType = !ts.some(node.name.elements, ts.not(ts.isOmittedExpression)); if (needCheckInitializer || needCheckWidenedType) { // Don't validate for-in initializer as it is already an error @@ -83477,7 +84332,7 @@ var ts; } // For a commonjs `const x = require`, validate the alias and exit var symbol = getSymbolOfNode(node); - if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 203 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { + if (symbol.flags & 2097152 /* SymbolFlags.Alias */ && ts.isVariableDeclarationInitializedToBareOrAccessedRequire(node.kind === 205 /* SyntaxKind.BindingElement */ ? node.parent.parent : node)) { checkAliasSymbol(node); return; } @@ -83491,7 +84346,7 @@ var ts; ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) && !!((_a = symbol.exports) === null || _a === void 0 ? void 0 : _a.size); - if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */) { + if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */) { checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined); } } @@ -83517,10 +84372,10 @@ var ts; error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name)); } } - if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */) { + if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */) { // We know we don't have a binding pattern or computed name here checkExportsOnMergedDeclarations(node); - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { checkVarDeclaredNamesNotShadowed(node); } checkCollisionsForDeclarationName(node, node.name); @@ -83528,7 +84383,7 @@ var ts; } function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) { var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration); - var message = nextDeclaration.kind === 167 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 166 /* SyntaxKind.PropertySignature */ + var message = nextDeclaration.kind === 169 /* SyntaxKind.PropertyDeclaration */ || nextDeclaration.kind === 168 /* SyntaxKind.PropertySignature */ ? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2 : ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2; var declName = ts.declarationNameToString(nextDeclarationName); @@ -83538,8 +84393,8 @@ var ts; } } function areDeclarationFlagsIdentical(left, right) { - if ((left.kind === 164 /* SyntaxKind.Parameter */ && right.kind === 254 /* SyntaxKind.VariableDeclaration */) || - (left.kind === 254 /* SyntaxKind.VariableDeclaration */ && right.kind === 164 /* SyntaxKind.Parameter */)) { + if ((left.kind === 166 /* SyntaxKind.Parameter */ && right.kind === 257 /* SyntaxKind.VariableDeclaration */) || + (left.kind === 257 /* SyntaxKind.VariableDeclaration */ && right.kind === 166 /* SyntaxKind.Parameter */)) { // Differences in optionality between parameters and variables are allowed. return true; } @@ -83548,8 +84403,8 @@ var ts; } var interestingFlags = 8 /* ModifierFlags.Private */ | 16 /* ModifierFlags.Protected */ | - 256 /* ModifierFlags.Async */ | - 128 /* ModifierFlags.Abstract */ | + 512 /* ModifierFlags.Async */ | + 256 /* ModifierFlags.Abstract */ | 64 /* ModifierFlags.Readonly */ | 32 /* ModifierFlags.Static */; return ts.getSelectedEffectiveModifierFlags(left, interestingFlags) === ts.getSelectedEffectiveModifierFlags(right, interestingFlags); @@ -83578,15 +84433,15 @@ var ts; function checkIfStatement(node) { // Grammar checking checkGrammarStatementInAmbientContext(node); - checkTruthinessExpression(node.expression); - checkTestingKnownTruthyCallableOrAwaitableType(node.expression, node.thenStatement); + var type = checkTruthinessExpression(node.expression); + checkTestingKnownTruthyCallableOrAwaitableType(node.expression, type, node.thenStatement); checkSourceElement(node.thenStatement); - if (node.thenStatement.kind === 236 /* SyntaxKind.EmptyStatement */) { + if (node.thenStatement.kind === 239 /* SyntaxKind.EmptyStatement */) { error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement); } checkSourceElement(node.elseStatement); } - function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, body) { + function checkTestingKnownTruthyCallableOrAwaitableType(condExpr, condType, body) { if (!strictNullChecks) return; helper(condExpr, body); @@ -83601,7 +84456,7 @@ var ts; : condExpr; if (ts.isModuleExportsAccessExpression(location)) return; - var type = checkTruthinessExpression(location); + var type = location === condExpr ? condType : checkTruthinessExpression(location); var isPropertyExpressionCast = ts.isPropertyAccessExpression(location) && isTypeAssertion(location.expression); if (!(getTypeFacts(type) & 4194304 /* TypeFacts.Truthy */) || isPropertyExpressionCast) return; @@ -83715,12 +84570,12 @@ var ts; function checkForStatement(node) { // Grammar checking if (!checkGrammarStatementInAmbientContext(node)) { - if (node.initializer && node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer && node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkGrammarVariableDeclarationList(node.initializer); } } if (node.initializer) { - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { ts.forEach(node.initializer.declarations, checkVariableDeclaration); } else { @@ -83760,14 +84615,14 @@ var ts; // via checkRightHandSideOfForOf. // If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference. // Then check that the RHS is assignable to it. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { checkForInOrForOfVariableDeclaration(node); } else { var varExpr = node.initializer; var iteratedType = checkRightHandSideOfForOf(node); // There may be a destructuring assignment on the left side - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // iteratedType may be undefined. In this case, we still want to check the structure of // varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like // to short circuit the type relation checking as much as possible, so we pass the unknownType. @@ -83799,7 +84654,7 @@ var ts; // for (let VarDecl in Expr) Statement // VarDecl must be a variable declaration without a type annotation that declares a variable of type Any, // and Expr must be an expression of type Any, an object type, or a type parameter type. - if (node.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variable = node.initializer.declarations[0]; if (variable && ts.isBindingPattern(variable.name)) { error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); @@ -83813,7 +84668,7 @@ var ts; // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var leftType = checkExpression(varExpr); - if (varExpr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (varExpr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */ || varExpr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern); } else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) { @@ -84295,7 +85150,16 @@ var ts; var message = allowAsyncIterables ? ts.Diagnostics.Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator : ts.Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator; - return errorAndMaybeSuggestAwait(errorNode, !!getAwaitedTypeOfPromise(type), message, typeToString(type)); + var suggestAwait = + // for (const x of Promise<...>) or [...Promise<...>] + !!getAwaitedTypeOfPromise(type) + // for (const x of AsyncIterable<...>) + || (!allowAsyncIterables && + ts.isForOfStatement(errorNode.parent) && + errorNode.parent.expression === errorNode && + getGlobalAsyncIterableType(/** reportErrors */ false) !== emptyGenericType && + isTypeAssignableTo(type, getGlobalAsyncIterableType(/** reportErrors */ false))); + return errorAndMaybeSuggestAwait(errorNode, suggestAwait, message, typeToString(type)); } /** * Gets the *yield*, *return*, and *next* types from an `Iterator`-like or `AsyncIterator`-like type. @@ -84613,12 +85477,12 @@ var ts; var functionFlags = ts.getFunctionFlags(container); if (strictNullChecks || node.expression || returnType.flags & 131072 /* TypeFlags.Never */) { var exprType = node.expression ? checkExpressionCached(node.expression) : undefinedType; - if (container.kind === 173 /* SyntaxKind.SetAccessor */) { + if (container.kind === 175 /* SyntaxKind.SetAccessor */) { if (node.expression) { error(node, ts.Diagnostics.Setters_cannot_return_a_value); } } - else if (container.kind === 171 /* SyntaxKind.Constructor */) { + else if (container.kind === 173 /* SyntaxKind.Constructor */) { if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) { error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class); } @@ -84636,7 +85500,7 @@ var ts; } } } - else if (container.kind !== 171 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { + else if (container.kind !== 173 /* SyntaxKind.Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(container, returnType)) { // The function has a return type, but the return statement doesn't have an expression. error(node, ts.Diagnostics.Not_all_code_paths_return_a_value); } @@ -84665,7 +85529,7 @@ var ts; var expressionIsLiteral = isLiteralType(expressionType); ts.forEach(node.caseBlock.clauses, function (clause) { // Grammar check for duplicate default clauses, skip if we already report duplicate default clause - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && !hasDuplicateDefaultClause) { if (firstDefaultClause === undefined) { firstDefaultClause = clause; } @@ -84674,7 +85538,7 @@ var ts; hasDuplicateDefaultClause = true; } } - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { addLazyDiagnostic(createLazyCaseClauseDiagnostics(clause)); } ts.forEach(clause.statements, checkSourceElement); @@ -84711,7 +85575,7 @@ var ts; if (ts.isFunctionLike(current)) { return "quit"; } - if (current.kind === 250 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { + if (current.kind === 253 /* SyntaxKind.LabeledStatement */ && current.label.escapedText === node.label.escapedText) { grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label)); return true; } @@ -84806,9 +85670,9 @@ var ts; return; } var indexInfos = getApplicableIndexInfos(type, propNameType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; - var propDeclaration = declaration && declaration.kind === 221 /* SyntaxKind.BinaryExpression */ || - name && name.kind === 162 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var propDeclaration = declaration && declaration.kind === 223 /* SyntaxKind.BinaryExpression */ || + name && name.kind === 164 /* SyntaxKind.ComputedPropertyName */ ? declaration : undefined; var localPropDeclaration = getParentOfSymbol(prop) === type.symbol ? declaration : undefined; var _loop_30 = function (info) { var localIndexDeclaration = info.declaration && getParentOfSymbol(getSymbolOfNode(info.declaration)) === type.symbol ? info.declaration : undefined; @@ -84833,7 +85697,7 @@ var ts; function checkIndexConstraintForIndexSignature(type, checkInfo) { var declaration = checkInfo.declaration; var indexInfos = getApplicableIndexInfos(type, checkInfo.keyType); - var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 258 /* SyntaxKind.InterfaceDeclaration */) : undefined; + var interfaceDeclaration = ts.getObjectFlags(type) & 2 /* ObjectFlags.Interface */ ? ts.getDeclarationOfKind(type.symbol, 261 /* SyntaxKind.InterfaceDeclaration */) : undefined; var localCheckDeclaration = declaration && getParentOfSymbol(getSymbolOfNode(declaration)) === type.symbol ? declaration : undefined; var _loop_31 = function (info) { if (info === checkInfo) @@ -84905,7 +85769,7 @@ var ts; } else { ts.forEach(jsdocParameters, function (_a, index) { - var name = _a.name; + var name = _a.name, isNameFirst = _a.isNameFirst; if (excludedParameters.has(index) || ts.isIdentifier(name) && parameters.has(name.escapedText)) { return; } @@ -84915,7 +85779,9 @@ var ts; } } else { - errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name)); + if (!isNameFirst) { + errorOrSuggestion(isJs, name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name, ts.idText(name)); + } } }); } @@ -84953,7 +85819,7 @@ var ts; function checkTypeParametersNotReferenced(root, typeParameters, index) { visit(root); function visit(node) { - if (node.kind === 178 /* SyntaxKind.TypeReference */) { + if (node.kind === 180 /* SyntaxKind.TypeReference */) { var type = getTypeFromTypeReference(node); if (type.flags & 262144 /* TypeFlags.TypeParameter */) { for (var i = index; i < typeParameters.length; i++) { @@ -85043,7 +85909,7 @@ var ts; if (firstDecorator && ts.some(node.members, function (p) { return ts.hasStaticModifier(p) && ts.isPrivateIdentifierClassElementDeclaration(p); })) { grammarErrorOnNode(firstDecorator, ts.Diagnostics.Class_decorators_can_t_be_used_with_static_private_identifier_Consider_removing_the_experimental_decorator); } - if (!node.name && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (!node.name && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { grammarErrorOnFirstToken(node, ts.Diagnostics.A_class_declaration_without_the_default_modifier_must_have_a_name); } checkClassLikeDeclaration(node); @@ -85110,7 +85976,7 @@ var ts; } else { var constructSignatures = getSignaturesOfType(baseConstructorType, 1 /* SignatureKind.Construct */); - if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)) { + if (constructSignatures.some(function (signature) { return signature.flags & 4 /* SignatureFlags.Abstract */; }) && !ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)) { error(node.name || node, ts.Diagnostics.A_mixin_class_that_extends_from_a_type_variable_containing_an_abstract_construct_signature_must_also_be_declared_abstract); } } @@ -85345,7 +86211,7 @@ var ts; } function getClassOrInterfaceDeclarationsOfSymbol(symbol) { return ts.filter(symbol.declarations, function (d) { - return d.kind === 257 /* SyntaxKind.ClassDeclaration */ || d.kind === 258 /* SyntaxKind.InterfaceDeclaration */; + return d.kind === 260 /* SyntaxKind.ClassDeclaration */ || d.kind === 261 /* SyntaxKind.InterfaceDeclaration */; }); } function checkKindsOfPropertyMemberOverrides(type, baseType) { @@ -85386,7 +86252,7 @@ var ts; // It is an error to inherit an abstract member without implementing it or being declared abstract. // If there is no declaration for the derived class (as in the case of class expressions), // then the class cannot be declared abstract. - if (baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 128 /* ModifierFlags.Abstract */))) { + if (baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!derivedClassDecl || !ts.hasSyntacticModifier(derivedClassDecl, 256 /* ModifierFlags.Abstract */))) { // Searches other base types for a declaration that would satisfy the inherited abstract member. // (The class may have more than one base type via declaration merging with an interface with the // same name.) @@ -85400,7 +86266,7 @@ var ts; return "continue-basePropertyCheck"; } } - if (derivedClassDecl.kind === 226 /* SyntaxKind.ClassExpression */) { + if (derivedClassDecl.kind === 228 /* SyntaxKind.ClassExpression */) { error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType)); } else { @@ -85435,11 +86301,11 @@ var ts; error(ts.getNameOfDeclaration(derived.valueDeclaration) || derived.valueDeclaration, errorMessage_1, symbolToString(base), typeToString(baseType), typeToString(type)); } else if (useDefineForClassFields) { - var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 167 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); + var uninitialized = (_c = derived.declarations) === null || _c === void 0 ? void 0 : _c.find(function (d) { return d.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !d.initializer; }); if (uninitialized && !(derived.flags & 33554432 /* SymbolFlags.Transient */) - && !(baseDeclarationFlags & 128 /* ModifierFlags.Abstract */) - && !(derivedDeclarationFlags & 128 /* ModifierFlags.Abstract */) + && !(baseDeclarationFlags & 256 /* ModifierFlags.Abstract */) + && !(derivedDeclarationFlags & 256 /* ModifierFlags.Abstract */) && !((_d = derived.declarations) === null || _d === void 0 ? void 0 : _d.some(function (d) { return !!(d.flags & 16777216 /* NodeFlags.Ambient */); }))) { var constructor = findConstructorDeclaration(ts.getClassLikeDeclarationOfSymbol(type.symbol)); var propName = uninitialized.name; @@ -85482,7 +86348,7 @@ var ts; } } function isPropertyAbstractOrInterface(declaration, baseDeclarationFlags) { - return baseDeclarationFlags & 128 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) + return baseDeclarationFlags & 256 /* ModifierFlags.Abstract */ && (!ts.isPropertyDeclaration(declaration) || !declaration.initializer) || ts.isInterfaceDeclaration(declaration.parent); } function getNonInheritedProperties(type, baseTypes, properties) { @@ -85564,7 +86430,7 @@ var ts; } } function isPropertyWithoutInitializer(node) { - return node.kind === 167 /* SyntaxKind.PropertyDeclaration */ && + return node.kind === 169 /* SyntaxKind.PropertyDeclaration */ && !ts.hasAbstractModifier(node) && !node.exclamationToken && !node.initializer; @@ -85607,7 +86473,7 @@ var ts; var symbol = getSymbolOfNode(node); checkTypeParameterListsIdentical(symbol); // Only check this symbol once - var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 258 /* SyntaxKind.InterfaceDeclaration */); + var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 261 /* SyntaxKind.InterfaceDeclaration */); if (node === firstInterfaceDecl) { var type = getDeclaredTypeOfSymbol(symbol); var typeWithThis = getTypeWithThisArgument(type); @@ -85640,7 +86506,7 @@ var ts; checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_alias_name_cannot_be_0); checkExportsOnMergedDeclarations(node); checkTypeParameters(node.typeParameters); - if (node.type.kind === 138 /* SyntaxKind.IntrinsicKeyword */) { + if (node.type.kind === 139 /* SyntaxKind.IntrinsicKeyword */) { if (!intrinsicTypeKinds.has(node.name.escapedText) || ts.length(node.typeParameters) !== 1) { error(node.type, ts.Diagnostics.The_intrinsic_keyword_can_only_be_used_to_declare_compiler_provided_intrinsic_types); } @@ -85726,7 +86592,7 @@ var ts; return value; function evaluate(expr) { switch (expr.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: var value_2 = evaluate(expr.operand); if (typeof value_2 === "number") { switch (expr.operator) { @@ -85736,7 +86602,7 @@ var ts; } } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var left = evaluate(expr.left); var right = evaluate(expr.right); if (typeof left === "number" && typeof right === "number") { @@ -85765,7 +86631,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: checkGrammarNumericLiteral(expr); return +expr.text; - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return evaluate(expr.expression); case 79 /* SyntaxKind.Identifier */: var identifier = expr; @@ -85773,13 +86639,13 @@ var ts; return +(identifier.escapedText); } return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText); - case 207 /* SyntaxKind.ElementAccessExpression */: - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (isConstantMemberAccess(expr)) { var type = getTypeOfExpression(expr.expression); if (type.symbol && type.symbol.flags & 384 /* SymbolFlags.Enum */) { var name = void 0; - if (expr.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (expr.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { name = expr.name.escapedText; } else { @@ -85816,8 +86682,8 @@ var ts; return false; } return node.kind === 79 /* SyntaxKind.Identifier */ || - node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || - node.kind === 207 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && + node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && isConstantMemberAccess(node.expression) || + node.kind === 209 /* SyntaxKind.ElementAccessExpression */ && isConstantMemberAccess(node.expression) && ts.isStringLiteralLike(node.argumentExpression); } function checkEnumDeclaration(node) { @@ -85851,7 +86717,7 @@ var ts; var seenEnumMissingInitialInitializer_1 = false; ts.forEach(enumSymbol.declarations, function (declaration) { // return true if we hit a violation of the rule, false otherwise - if (declaration.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (declaration.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return false; } var enumDeclaration = declaration; @@ -85880,8 +86746,8 @@ var ts; if (declarations) { for (var _i = 0, declarations_9 = declarations; _i < declarations_9.length; _i++) { var declaration = declarations_9[_i]; - if ((declaration.kind === 257 /* SyntaxKind.ClassDeclaration */ || - (declaration.kind === 256 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && + if ((declaration.kind === 260 /* SyntaxKind.ClassDeclaration */ || + (declaration.kind === 259 /* SyntaxKind.FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) && !(declaration.flags & 16777216 /* NodeFlags.Ambient */)) { return declaration; } @@ -85952,7 +86818,7 @@ var ts; } // if the module merges with a class declaration in the same lexical scope, // we need to track this to ensure the correct emit. - var mergedClass = ts.getDeclarationOfKind(symbol, 257 /* SyntaxKind.ClassDeclaration */); + var mergedClass = ts.getDeclarationOfKind(symbol, 260 /* SyntaxKind.ClassDeclaration */); if (mergedClass && inSameLexicalScope(node, mergedClass)) { getNodeLinks(node).flags |= 32768 /* NodeCheckFlags.LexicalModuleMergesWithClass */; @@ -85995,56 +86861,43 @@ var ts; } } function checkModuleAugmentationElement(node, isGlobalAugmentation) { - var _a; switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // error each individual name in variable statement instead of marking the entire variable statement - for (var _i = 0, _b = node.declarationList.declarations; _i < _b.length; _i++) { - var decl = _b[_i]; + for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) { + var decl = _a[_i]; checkModuleAugmentationElement(decl, isGlobalAugmentation); } break; - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations); break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module); break; - case 203 /* SyntaxKind.BindingElement */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 257 /* SyntaxKind.VariableDeclaration */: var name = node.name; if (ts.isBindingPattern(name)) { - for (var _c = 0, _d = name.elements; _c < _d.length; _c++) { - var el = _d[_c]; + for (var _b = 0, _c = name.elements; _b < _c.length; _b++) { + var el = _c[_b]; // mark individual names in binding pattern checkModuleAugmentationElement(el, isGlobalAugmentation); } break; } // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: if (isGlobalAugmentation) { return; } - var symbol = getSymbolOfNode(node); - if (symbol) { - // module augmentations cannot introduce new names on the top level scope of the module - // this is done it two steps - // 1. quick check - if symbol for node is not merged - this is local symbol to this augmentation - report error - // 2. main check - report error if value declaration of the parent symbol is module augmentation) - var reportError = !(symbol.flags & 33554432 /* SymbolFlags.Transient */); - if (!reportError) { - // symbol should not originate in augmentation - reportError = !!((_a = symbol.parent) === null || _a === void 0 ? void 0 : _a.declarations) && ts.isExternalModuleAugmentation(symbol.parent.declarations[0]); - } - } break; } } @@ -86052,12 +86905,12 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return node; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: do { node = node.left; } while (node.kind !== 79 /* SyntaxKind.Identifier */); return node; - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: do { if (ts.isModuleExportsAccessExpression(node.expression) && !ts.isPrivateIdentifier(node.name)) { return node.name; @@ -86077,9 +86930,9 @@ var ts; error(moduleName, ts.Diagnostics.String_literal_expected); return false; } - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { - error(moduleName, node.kind === 272 /* SyntaxKind.ExportDeclaration */ ? + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule) { + error(moduleName, node.kind === 275 /* SyntaxKind.ExportDeclaration */ ? ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace : ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module); return false; @@ -86126,8 +86979,8 @@ var ts; var errorNode = ts.isImportOrExportSpecifier(node) ? node.propertyName || node.name : ts.isNamedDeclaration(node) ? node.name : node; - ts.Debug.assert(node.kind !== 274 /* SyntaxKind.NamespaceExport */); - if (node.kind === 275 /* SyntaxKind.ExportSpecifier */) { + ts.Debug.assert(node.kind !== 277 /* SyntaxKind.NamespaceExport */); + if (node.kind === 278 /* SyntaxKind.ExportSpecifier */) { var diag = error(errorNode, ts.Diagnostics.Types_cannot_appear_in_export_declarations_in_JavaScript_files); var alreadyExportedSymbol = (_b = (_a = ts.getSourceFileOfNode(node).symbol) === null || _a === void 0 ? void 0 : _a.exports) === null || _b === void 0 ? void 0 : _b.get((node.propertyName || node.name).escapedText); if (alreadyExportedSymbol === target) { @@ -86138,7 +86991,7 @@ var ts; } } else { - ts.Debug.assert(node.kind !== 254 /* SyntaxKind.VariableDeclaration */); + ts.Debug.assert(node.kind !== 257 /* SyntaxKind.VariableDeclaration */); var importDeclaration = ts.findAncestor(node, ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration)); var moduleSpecifier = (_e = (importDeclaration && ((_d = ts.tryGetModuleSpecifierFromDeclaration(importDeclaration)) === null || _d === void 0 ? void 0 : _d.text))) !== null && _e !== void 0 ? _e : "..."; var importedIdentifier = ts.unescapeLeadingUnderscores(ts.isIdentifier(errorNode) ? errorNode.escapedText : symbol.escapedName); @@ -86146,11 +86999,12 @@ var ts; } return; } + var targetFlags = getAllSymbolFlags(target); var excludedMeanings = (symbol.flags & (111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */) ? 111551 /* SymbolFlags.Value */ : 0) | (symbol.flags & 788968 /* SymbolFlags.Type */ ? 788968 /* SymbolFlags.Type */ : 0) | (symbol.flags & 1920 /* SymbolFlags.Namespace */ ? 1920 /* SymbolFlags.Namespace */ : 0); - if (target.flags & excludedMeanings) { - var message = node.kind === 275 /* SyntaxKind.ExportSpecifier */ ? + if (targetFlags & excludedMeanings) { + var message = node.kind === 278 /* SyntaxKind.ExportSpecifier */ ? ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 : ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0; error(node, message, symbolToString(symbol)); @@ -86159,26 +87013,26 @@ var ts; && !ts.isTypeOnlyImportOrExportDeclaration(node) && !(node.flags & 16777216 /* NodeFlags.Ambient */)) { var typeOnlyAlias = getTypeOnlyAliasDeclaration(symbol); - var isType = !(target.flags & 111551 /* SymbolFlags.Value */); + var isType = !(targetFlags & 111551 /* SymbolFlags.Value */); if (isType || typeOnlyAlias) { switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 270 /* SyntaxKind.ImportClause */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { if (compilerOptions.preserveValueImports) { ts.Debug.assertIsDefined(node.name, "An ImportClause with a symbol should have a name"); var message = isType ? ts.Diagnostics._0_is_a_type_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled : ts.Diagnostics._0_resolves_to_a_type_only_declaration_and_must_be_imported_using_a_type_only_import_when_preserveValueImports_and_isolatedModules_are_both_enabled; - var name = ts.idText(node.kind === 270 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); + var name = ts.idText(node.kind === 273 /* SyntaxKind.ImportSpecifier */ ? node.propertyName || node.name : node.name); addTypeOnlyDeclarationRelatedInfo(error(node, message, name), isType ? undefined : typeOnlyAlias, name); } - if (isType && node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { + if (isType && node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && ts.hasEffectiveModifier(node, 1 /* ModifierFlags.Export */)) { error(node, ts.Diagnostics.Cannot_use_export_import_on_a_type_or_type_only_namespace_when_the_isolatedModules_flag_is_provided); } break; } - case 275 /* SyntaxKind.ExportSpecifier */: { + case 278 /* SyntaxKind.ExportSpecifier */: { // Don't allow re-exporting an export that will be elided when `--isolatedModules` is set. // The exception is that `import type { A } from './a'; export { A }` is allowed // because single-file analysis can determine that the export should be dropped. @@ -86237,7 +87091,7 @@ var ts; function checkImportBinding(node) { checkCollisionsForDeclarationName(node, node.name); checkAliasSymbol(node); - if (node.kind === 270 /* SyntaxKind.ImportSpecifier */ && + if (node.kind === 273 /* SyntaxKind.ImportSpecifier */ && ts.idText(node.propertyName || node.name) === "default" && ts.getESModuleInterop(compilerOptions) && moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS)) { @@ -86287,7 +87141,7 @@ var ts; checkImportBinding(importClause); } if (importClause.namedBindings) { - if (importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { checkImportBinding(importClause.namedBindings); if (moduleKind !== ts.ModuleKind.System && (moduleKind < ts.ModuleKind.ES2015 || ts.getSourceFileOfNode(node).impliedNodeFormat === ts.ModuleKind.CommonJS) && ts.getESModuleInterop(compilerOptions)) { // import * as ns from "foo"; @@ -86316,17 +87170,18 @@ var ts; if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { markExportAsReferenced(node); } - if (node.moduleReference.kind !== 277 /* SyntaxKind.ExternalModuleReference */) { + if (node.moduleReference.kind !== 280 /* SyntaxKind.ExternalModuleReference */) { var target = resolveAlias(getSymbolOfNode(node)); if (target !== unknownSymbol) { - if (target.flags & 111551 /* SymbolFlags.Value */) { + var targetFlags = getAllSymbolFlags(target); + if (targetFlags & 111551 /* SymbolFlags.Value */) { // Target is a value symbol, check that it is not hidden by a local declaration with the same name var moduleName = ts.getFirstIdentifier(node.moduleReference); if (!(resolveEntityName(moduleName, 111551 /* SymbolFlags.Value */ | 1920 /* SymbolFlags.Namespace */).flags & 1920 /* SymbolFlags.Namespace */)) { error(moduleName, ts.Diagnostics.Module_0_is_hidden_by_a_local_declaration_with_the_same_name, ts.declarationNameToString(moduleName)); } } - if (target.flags & 788968 /* SymbolFlags.Type */) { + if (targetFlags & 788968 /* SymbolFlags.Type */) { checkTypeNameIsReserved(node.name, ts.Diagnostics.Import_name_cannot_be_0); } } @@ -86359,10 +87214,10 @@ var ts; // export { x, y } // export { x, y } from "foo" ts.forEach(node.exportClause.elements, checkExportSpecifier); - var inAmbientExternalModule = node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); - var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ && + var inAmbientExternalModule = node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && ts.isAmbientModule(node.parent.parent); + var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ && !node.moduleSpecifier && node.flags & 16777216 /* NodeFlags.Ambient */; - if (node.parent.kind !== 305 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { + if (node.parent.kind !== 308 /* SyntaxKind.SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) { error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace); } } @@ -86397,7 +87252,7 @@ var ts; function checkGrammarExportDeclaration(node) { var _a; if (node.isTypeOnly) { - if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 273 /* SyntaxKind.NamedExports */) { + if (((_a = node.exportClause) === null || _a === void 0 ? void 0 : _a.kind) === 276 /* SyntaxKind.NamedExports */) { return checkGrammarNamedImportsOrExports(node.exportClause); } else { @@ -86407,7 +87262,7 @@ var ts; return false; } function checkGrammarModuleElementContext(node, errorMessage) { - var isInAppropriateContext = node.parent.kind === 305 /* SyntaxKind.SourceFile */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 261 /* SyntaxKind.ModuleDeclaration */; + var isInAppropriateContext = node.parent.kind === 308 /* SyntaxKind.SourceFile */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 264 /* SyntaxKind.ModuleDeclaration */; if (!isInAppropriateContext) { grammarErrorOnFirstToken(node, errorMessage); } @@ -86465,7 +87320,7 @@ var ts; markExportAsReferenced(node); } var target = symbol && (symbol.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(symbol) : symbol); - if (!target || target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (!target || getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) { checkExpressionCached(node.propertyName || node.name); } } @@ -86487,8 +87342,8 @@ var ts; // If we hit an export assignment in an illegal context, just bail out to avoid cascading errors. return; } - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { if (node.isExportEquals) { error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace); } @@ -86512,7 +87367,7 @@ var ts; markAliasReferenced(sym, id); // If not a value, we're interpreting the identifier as a type export, along the lines of (`export { Id as default }`) var target = sym.flags & 2097152 /* SymbolFlags.Alias */ ? resolveAlias(sym) : sym; - if (target === unknownSymbol || target.flags & 111551 /* SymbolFlags.Value */) { + if (getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */) { // However if it is a value, we need to check it's being used correctly checkExpressionCached(node.expression); } @@ -86620,181 +87475,181 @@ var ts; // Only bother checking on a few construct kinds. We don't want to be excessively // hitting the cancellation token on every node we check. switch (kind) { - case 261 /* SyntaxKind.ModuleDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: cancellationToken.throwIfCancellationRequested(); } } - if (kind >= 237 /* SyntaxKind.FirstStatement */ && kind <= 253 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { + if (kind >= 240 /* SyntaxKind.FirstStatement */ && kind <= 256 /* SyntaxKind.LastStatement */ && node.flowNode && !isReachableFlowNode(node.flowNode)) { errorOrSuggestion(compilerOptions.allowUnreachableCode === false, node, ts.Diagnostics.Unreachable_code_detected); } switch (kind) { - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return checkTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return checkParameter(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return checkPropertyDeclaration(node); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return checkPropertySignature(node); - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 174 /* SyntaxKind.CallSignature */: - case 175 /* SyntaxKind.ConstructSignature */: - case 176 /* SyntaxKind.IndexSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 176 /* SyntaxKind.CallSignature */: + case 177 /* SyntaxKind.ConstructSignature */: + case 178 /* SyntaxKind.IndexSignature */: return checkSignatureDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: return checkMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return checkClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return checkConstructorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return checkAccessorDeclaration(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return checkTypeReferenceNode(node); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return checkTypePredicate(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return checkTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return checkTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return checkArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return checkTupleType(node); - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: return checkUnionOrIntersectionType(node); - case 191 /* SyntaxKind.ParenthesizedType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: return checkSourceElement(node.type); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return checkThisType(node); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return checkTypeOperator(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return checkConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return checkInferType(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return checkTemplateLiteralType(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return checkImportType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return checkNamedTupleMember(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: return checkJSDocAugmentsTag(node); - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return checkJSDocImplementsTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: return checkJSDocTypeAliasTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return checkJSDocTemplateTag(node); - case 343 /* SyntaxKind.JSDocTypeTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return checkJSDocTypeTag(node); - case 324 /* SyntaxKind.JSDocLink */: - case 325 /* SyntaxKind.JSDocLinkCode */: - case 326 /* SyntaxKind.JSDocLinkPlain */: + case 327 /* SyntaxKind.JSDocLink */: + case 328 /* SyntaxKind.JSDocLinkCode */: + case 329 /* SyntaxKind.JSDocLinkPlain */: return checkJSDocLinkLikeTag(node); - case 340 /* SyntaxKind.JSDocParameterTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: return checkJSDocParameterTag(node); - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return checkJSDocPropertyTag(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: checkJSDocFunctionType(node); // falls through - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 314 /* SyntaxKind.JSDocNullableType */: - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: checkJSDocTypeIsInJsFile(node); ts.forEachChild(node, checkSourceElement); return; - case 318 /* SyntaxKind.JSDocVariadicType */: + case 321 /* SyntaxKind.JSDocVariadicType */: checkJSDocVariadicType(node); return; - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return checkSourceElement(node.type); - case 333 /* SyntaxKind.JSDocPublicTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: return checkJSDocAccessibilityModifiers(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return checkIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return checkMappedType(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return checkFunctionDeclaration(node); - case 235 /* SyntaxKind.Block */: - case 262 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: + case 265 /* SyntaxKind.ModuleBlock */: return checkBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return checkVariableStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return checkExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return checkIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return checkDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return checkWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return checkForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return checkForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return checkForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: - case 246 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: return checkBreakOrContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return checkReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return checkWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return checkSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return checkLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return checkThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return checkTryStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return checkVariableDeclaration(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return checkBindingElement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return checkClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return checkInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return checkTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return checkEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return checkModuleDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return checkImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return checkImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return checkExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return checkExportAssignment(node); - case 236 /* SyntaxKind.EmptyStatement */: - case 253 /* SyntaxKind.DebuggerStatement */: + case 239 /* SyntaxKind.EmptyStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: checkGrammarStatementInAmbientContext(node); return; - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return checkMissingDeclaration(node); } } @@ -86901,36 +87756,36 @@ var ts; currentNode = node; instantiationCount = 0; switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: - case 165 /* SyntaxKind.Decorator */: - case 280 /* SyntaxKind.JsxOpeningElement */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: + case 167 /* SyntaxKind.Decorator */: + case 283 /* SyntaxKind.JsxOpeningElement */: // These node kinds are deferred checked when overload resolution fails // To save on work, we ensure the arguments are checked just once, in // a deferred way resolveUntypedCall(node); break; - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: checkFunctionExpressionOrObjectLiteralMethodDeferred(node); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: checkAccessorDeclaration(node); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: checkClassExpressionDeferred(node); break; - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: checkTypeParameterDeferred(node); break; - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: checkJsxSelfClosingElementDeferred(node); break; - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: checkJsxElementDeferred(node); break; } @@ -87103,17 +87958,17 @@ var ts; copySymbols(location.locals, meaning); } switch (location.kind) { - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: if (!ts.isExternalModule(location)) break; // falls through - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: copyLocallyVisibleExportSymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* SymbolFlags.ModuleMember */); break; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* SymbolFlags.EnumMember */); break; - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: var className = location.name; if (className) { copySymbol(location.symbol, meaning); @@ -87121,8 +87976,8 @@ var ts; // this fall-through is necessary because we would like to handle // type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration. // falls through - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // If we didn't come from static member of class or interface, // add the type parameters into the symbol table // (type parameters of classDeclaration/classExpression and interface are in member property of the symbol. @@ -87131,7 +87986,7 @@ var ts; copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 788968 /* SymbolFlags.Type */); } break; - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: var funcName = location.name; if (funcName) { copySymbol(location.symbol, meaning); @@ -87175,7 +88030,7 @@ var ts; if (meaning) { source.forEach(function (symbol) { // Similar condition as in `resolveNameHelper` - if (!ts.getDeclarationOfKind(symbol, 275 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 274 /* SyntaxKind.NamespaceExport */)) { + if (!ts.getDeclarationOfKind(symbol, 278 /* SyntaxKind.ExportSpecifier */) && !ts.getDeclarationOfKind(symbol, 277 /* SyntaxKind.NamespaceExport */)) { copySymbol(symbol, meaning); } }); @@ -87184,41 +88039,21 @@ var ts; } function isTypeDeclarationName(name) { return name.kind === 79 /* SyntaxKind.Identifier */ && - isTypeDeclaration(name.parent) && + ts.isTypeDeclaration(name.parent) && ts.getNameOfDeclaration(name.parent) === name; } - function isTypeDeclaration(node) { - switch (node.kind) { - case 163 /* SyntaxKind.TypeParameter */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 345 /* SyntaxKind.JSDocTypedefTag */: - case 338 /* SyntaxKind.JSDocCallbackTag */: - case 339 /* SyntaxKind.JSDocEnumTag */: - return true; - case 267 /* SyntaxKind.ImportClause */: - return node.isTypeOnly; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: - return node.parent.parent.isTypeOnly; - default: - return false; - } - } // True if the given identifier is part of a type reference function isTypeReferenceIdentifier(node) { - while (node.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (node.parent.kind === 163 /* SyntaxKind.QualifiedName */) { node = node.parent; } - return node.parent.kind === 178 /* SyntaxKind.TypeReference */; + return node.parent.kind === 180 /* SyntaxKind.TypeReference */; } function isHeritageClauseElementIdentifier(node) { - while (node.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + while (node.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { node = node.parent; } - return node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */; + return node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */; } function forEachEnclosingClass(node, callback) { var result; @@ -87246,13 +88081,13 @@ var ts; return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; }); } function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) { - while (nodeOnRightSide.parent.kind === 161 /* SyntaxKind.QualifiedName */) { + while (nodeOnRightSide.parent.kind === 163 /* SyntaxKind.QualifiedName */) { nodeOnRightSide = nodeOnRightSide.parent; } - if (nodeOnRightSide.parent.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) { + if (nodeOnRightSide.parent.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) { return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } - if (nodeOnRightSide.parent.kind === 271 /* SyntaxKind.ExportAssignment */) { + if (nodeOnRightSide.parent.kind === 274 /* SyntaxKind.ExportAssignment */) { return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined; } return undefined; @@ -87278,7 +88113,7 @@ var ts; node = parent; parent = parent.parent; } - if (parent && parent.kind === 200 /* SyntaxKind.ImportType */ && parent.qualifier === node) { + if (parent && parent.kind === 202 /* SyntaxKind.ImportType */ && parent.qualifier === node) { return parent; } return undefined; @@ -87288,7 +88123,7 @@ var ts; return getSymbolOfNode(name.parent); } if (ts.isInJSFile(name) && - name.parent.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && + name.parent.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && name.parent === name.parent.parent.left) { // Check if this is a special property assignment if (!ts.isPrivateIdentifier(name) && !ts.isJSDocMemberName(name)) { @@ -87298,7 +88133,7 @@ var ts; } } } - if (name.parent.kind === 271 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { + if (name.parent.kind === 274 /* SyntaxKind.ExportAssignment */ && ts.isEntityNameExpression(name)) { // Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression var success = resolveEntityName(name, /*all meanings*/ 111551 /* SymbolFlags.Value */ | 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */ | 2097152 /* SymbolFlags.Alias */, /*ignoreErrors*/ true); @@ -87308,7 +88143,7 @@ var ts; } else if (ts.isEntityName(name) && isInRightSideOfImportOrExportAssignment(name)) { // Since we already checked for ExportAssignment, this really could only be an Import - var importEqualsDeclaration = ts.getAncestor(name, 265 /* SyntaxKind.ImportEqualsDeclaration */); + var importEqualsDeclaration = ts.getAncestor(name, 268 /* SyntaxKind.ImportEqualsDeclaration */); ts.Debug.assert(importEqualsDeclaration !== undefined); return getSymbolOfPartOfRightHandSideOfImportEquals(name, /*dontResolveAlias*/ true); } @@ -87326,7 +88161,7 @@ var ts; if (isHeritageClauseElementIdentifier(name)) { var meaning = 0 /* SymbolFlags.None */; // In an interface or class, we're definitely interested in a type. - if (name.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */) { + if (name.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */) { meaning = 788968 /* SymbolFlags.Type */; // In a class 'extends' clause we are also looking for a value. if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(name.parent)) { @@ -87342,10 +88177,10 @@ var ts; return entityNameSymbol; } } - if (name.parent.kind === 340 /* SyntaxKind.JSDocParameterTag */) { + if (name.parent.kind === 343 /* SyntaxKind.JSDocParameterTag */) { return ts.getParameterSymbolFromJSDoc(name.parent); } - if (name.parent.kind === 163 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 344 /* SyntaxKind.JSDocTemplateTag */) { + if (name.parent.kind === 165 /* SyntaxKind.TypeParameter */ && name.parent.parent.kind === 347 /* SyntaxKind.JSDocTemplateTag */) { ts.Debug.assert(!ts.isInJSFile(name)); // Otherwise `isDeclarationName` would have been true. var typeParameter = ts.getTypeParameterFromJsDoc(name.parent); return typeParameter && typeParameter.symbol; @@ -87369,18 +88204,53 @@ var ts; return resolveJSDocMemberName(name, /*ignoreErrors*/ false, getSymbolOfNode(container)); } } + if (result && isJSDoc_1) { + var container = ts.getJSDocHost(name); + if (container && ts.isEnumMember(container) && container === result.valueDeclaration) { + return resolveEntityName(name, meaning, /*ignoreErrors*/ true, /* dontResolveAlias */ true, ts.getSourceFileOfNode(container)) || result; + } + } return result; } else if (ts.isPrivateIdentifier(name)) { return getSymbolForPrivateIdentifierExpression(name); } - else if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 161 /* SyntaxKind.QualifiedName */) { + else if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || name.kind === 163 /* SyntaxKind.QualifiedName */) { var links = getNodeLinks(name); if (links.resolvedSymbol) { return links.resolvedSymbol; } - if (name.kind === 206 /* SyntaxKind.PropertyAccessExpression */) { + if (name.kind === 208 /* SyntaxKind.PropertyAccessExpression */) { checkPropertyAccessExpression(name, 0 /* CheckMode.Normal */); + if (!links.resolvedSymbol) { + var expressionType = checkExpressionCached(name.expression); + var infos = getApplicableIndexInfos(expressionType, getLiteralTypeFromPropertyName(name.name)); + if (infos.length && expressionType.members) { + var resolved = resolveStructuredTypeMembers(expressionType); + var symbol = resolved.members.get("__index" /* InternalSymbolName.Index */); + if (infos === getIndexInfosOfType(expressionType)) { + links.resolvedSymbol = symbol; + } + else if (symbol) { + var symbolLinks_1 = getSymbolLinks(symbol); + var declarationList = ts.mapDefined(infos, function (i) { return i.declaration; }); + var nodeListId = ts.map(declarationList, getNodeId).join(","); + if (!symbolLinks_1.filteredIndexSymbolCache) { + symbolLinks_1.filteredIndexSymbolCache = new ts.Map(); + } + if (symbolLinks_1.filteredIndexSymbolCache.has(nodeListId)) { + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + else { + var copy = createSymbol(131072 /* SymbolFlags.Signature */, "__index" /* InternalSymbolName.Index */); + copy.declarations = ts.mapDefined(infos, function (i) { return i.declaration; }); + copy.parent = expressionType.aliasSymbol ? expressionType.aliasSymbol : expressionType.symbol ? expressionType.symbol : getSymbolAtLocation(copy.declarations[0].parent); + symbolLinks_1.filteredIndexSymbolCache.set(nodeListId, copy); + links.resolvedSymbol = symbolLinks_1.filteredIndexSymbolCache.get(nodeListId); + } + } + } + } } else { checkQualifiedName(name, 0 /* CheckMode.Normal */); @@ -87395,11 +88265,11 @@ var ts; } } else if (isTypeReferenceIdentifier(name)) { - var meaning = name.parent.kind === 178 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; + var meaning = name.parent.kind === 180 /* SyntaxKind.TypeReference */ ? 788968 /* SymbolFlags.Type */ : 1920 /* SymbolFlags.Namespace */; var symbol = resolveEntityName(name, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true); return symbol && symbol !== unknownSymbol ? symbol : getUnresolvedSymbolForEntityName(name); } - if (name.parent.kind === 177 /* SyntaxKind.TypePredicate */) { + if (name.parent.kind === 179 /* SyntaxKind.TypePredicate */) { return resolveEntityName(name, /*meaning*/ 1 /* SymbolFlags.FunctionScopedVariable */); } return undefined; @@ -87433,7 +88303,7 @@ var ts; } } function getSymbolAtLocation(node, ignoreErrors) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined; } var parent = node.parent; @@ -87456,8 +88326,8 @@ var ts; if (isInRightSideOfImportOrExportAssignment(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } - else if (parent.kind === 203 /* SyntaxKind.BindingElement */ && - grandParent.kind === 201 /* SyntaxKind.ObjectBindingPattern */ && + else if (parent.kind === 205 /* SyntaxKind.BindingElement */ && + grandParent.kind === 203 /* SyntaxKind.ObjectBindingPattern */ && node === parent.propertyName) { var typeOfPattern = getTypeOfNode(grandParent); var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText); @@ -87484,8 +88354,8 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: case 80 /* SyntaxKind.PrivateIdentifier */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 161 /* SyntaxKind.QualifiedName */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 163 /* SyntaxKind.QualifiedName */: if (!ts.isThisInTypeQuery(node)) { return getSymbolOfNameOrPropertyAccessExpression(node); } @@ -87502,14 +88372,14 @@ var ts; return checkExpression(node).symbol; } // falls through - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return getTypeFromThisTypeNode(node).symbol; case 106 /* SyntaxKind.SuperKeyword */: return checkExpression(node).symbol; - case 134 /* SyntaxKind.ConstructorKeyword */: + case 135 /* SyntaxKind.ConstructorKeyword */: // constructor keyword for an overload, should take us to the definition if it exist var constructorDeclaration = node.parent; - if (constructorDeclaration && constructorDeclaration.kind === 171 /* SyntaxKind.Constructor */) { + if (constructorDeclaration && constructorDeclaration.kind === 173 /* SyntaxKind.Constructor */) { return constructorDeclaration.parent.symbol; } return undefined; @@ -87520,7 +88390,7 @@ var ts; // 3). Dynamic import call or require in javascript // 4). type A = import("./f/*gotToDefinitionHere*/oo") if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) || - ((node.parent.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 272 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || + ((node.parent.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.parent.kind === 275 /* SyntaxKind.ExportDeclaration */) && node.parent.moduleSpecifier === node) || ((ts.isInJSFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent)) || (ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) { return resolveExternalModuleName(node, node, ignoreErrors); @@ -87542,14 +88412,14 @@ var ts; case 38 /* SyntaxKind.EqualsGreaterThanToken */: case 84 /* SyntaxKind.ClassKeyword */: return getSymbolOfNode(node.parent); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal, ignoreErrors) : undefined; case 93 /* SyntaxKind.ExportKeyword */: return ts.isExportAssignment(node.parent) ? ts.Debug.checkDefined(node.parent.symbol) : undefined; case 100 /* SyntaxKind.ImportKeyword */: case 103 /* SyntaxKind.NewKeyword */: return ts.isMetaProperty(node.parent) ? checkMetaPropertyKeyword(node.parent).symbol : undefined; - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return checkExpression(node).symbol; default: return undefined; @@ -87565,7 +88435,7 @@ var ts; return undefined; } function getShorthandAssignmentValueSymbol(location) { - if (location && location.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */) { + if (location && location.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */) { return resolveEntityName(location.name, 111551 /* SymbolFlags.Value */ | 2097152 /* SymbolFlags.Alias */); } return undefined; @@ -87604,7 +88474,7 @@ var ts; var baseType = ts.firstOrUndefined(getBaseTypes(classType)); return baseType ? getTypeWithThisArgument(baseType, classType.thisType) : errorType; } - if (isTypeDeclaration(node)) { + if (ts.isTypeDeclaration(node)) { // In this case, we call getSymbolOfNode instead of getSymbolAtLocation because it is a declaration var symbol = getSymbolOfNode(node); return getDeclaredTypeOfSymbol(symbol); @@ -87647,23 +88517,23 @@ var ts; // [ a ] from // [a] = [ some array ...] function getTypeOfAssignmentPattern(expr) { - ts.Debug.assert(expr.kind === 205 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 204 /* SyntaxKind.ArrayLiteralExpression */); + ts.Debug.assert(expr.kind === 207 /* SyntaxKind.ObjectLiteralExpression */ || expr.kind === 206 /* SyntaxKind.ArrayLiteralExpression */); // If this is from "for of" // for ( { a } of elems) { // } - if (expr.parent.kind === 244 /* SyntaxKind.ForOfStatement */) { + if (expr.parent.kind === 247 /* SyntaxKind.ForOfStatement */) { var iteratedType = checkRightHandSideOfForOf(expr.parent); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from "for" initializer // for ({a } = elems[0];.....) { } - if (expr.parent.kind === 221 /* SyntaxKind.BinaryExpression */) { + if (expr.parent.kind === 223 /* SyntaxKind.BinaryExpression */) { var iteratedType = getTypeOfExpression(expr.parent.right); return checkDestructuringAssignment(expr, iteratedType || errorType); } // If this is from nested object binding pattern // for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) { - if (expr.parent.kind === 296 /* SyntaxKind.PropertyAssignment */) { + if (expr.parent.kind === 299 /* SyntaxKind.PropertyAssignment */) { var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression); var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType; var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent); @@ -87711,7 +88581,7 @@ var ts; case 8 /* SyntaxKind.NumericLiteral */: case 10 /* SyntaxKind.StringLiteral */: return getStringLiteralType(name.text); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: var nameType = checkComputedPropertyName(name); return isTypeAssignableToKind(nameType, 12288 /* TypeFlags.ESSymbolLike */) ? nameType : stringType; default: @@ -87799,7 +88669,7 @@ var ts; return symbolLinks.exportsSomeValue; function isValue(s) { s = resolveSymbol(s); - return s && !!(s.flags & 111551 /* SymbolFlags.Value */); + return s && !!(getAllSymbolFlags(s) & 111551 /* SymbolFlags.Value */); } } function isNameOfModuleOrEnumDeclaration(node) { @@ -87829,7 +88699,7 @@ var ts; } var parentSymbol_1 = getParentOfSymbol(symbol); if (parentSymbol_1) { - if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 305 /* SyntaxKind.SourceFile */) { + if (parentSymbol_1.flags & 512 /* SymbolFlags.ValueModule */ && ((_a = parentSymbol_1.valueDeclaration) === null || _a === void 0 ? void 0 : _a.kind) === 308 /* SyntaxKind.SourceFile */) { var symbolFile = parentSymbol_1.valueDeclaration; var referenceFile = ts.getSourceFileOfNode(node); // If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined. @@ -87849,10 +88719,10 @@ var ts; } var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier); if (node) { - var symbol = getReferencedValueSymbol(node); + var symbol = getReferencedValueOrAliasSymbol(node); // We should only get the declaration of an alias if there isn't a local value // declaration for the symbol - if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol)) { + if (isNonLocalAlias(symbol, /*excludes*/ 111551 /* SymbolFlags.Value */) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */)) { return getDeclarationOfAliasSymbol(symbol); } } @@ -87861,7 +88731,7 @@ var ts; function isSymbolOfDestructuredElementOfCatchBinding(symbol) { return symbol.valueDeclaration && ts.isBindingElement(symbol.valueDeclaration) - && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 292 /* SyntaxKind.CatchClause */; + && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 295 /* SyntaxKind.CatchClause */; } function isSymbolOfDeclarationWithCollidingName(symbol) { if (symbol.flags & 418 /* SymbolFlags.BlockScoped */ && symbol.valueDeclaration && !ts.isSourceFile(symbol.valueDeclaration)) { @@ -87892,7 +88762,7 @@ var ts; // they will not collide with anything var isDeclaredInLoop = nodeLinks_1.flags & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */; var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false); - var inLoopBodyBlock = container.kind === 235 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); + var inLoopBodyBlock = container.kind === 238 /* SyntaxKind.Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false); links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock)); } else { @@ -87933,19 +88803,19 @@ var ts; } function isValueAliasDeclaration(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return isAliasResolvedToValue(getSymbolOfNode(node)); - case 267 /* SyntaxKind.ImportClause */: - case 268 /* SyntaxKind.NamespaceImport */: - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 270 /* SyntaxKind.ImportClause */: + case 271 /* SyntaxKind.NamespaceImport */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: var symbol = getSymbolOfNode(node); - return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol); - case 272 /* SyntaxKind.ExportDeclaration */: + return !!symbol && isAliasResolvedToValue(symbol) && !getTypeOnlyAliasDeclaration(symbol, 111551 /* SymbolFlags.Value */); + case 275 /* SyntaxKind.ExportDeclaration */: var exportClause = node.exportClause; return !!exportClause && (ts.isNamespaceExport(exportClause) || ts.some(exportClause.elements, isValueAliasDeclaration)); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return node.expression && node.expression.kind === 79 /* SyntaxKind.Identifier */ ? isAliasResolvedToValue(getSymbolOfNode(node)) : true; @@ -87954,7 +88824,7 @@ var ts; } function isTopLevelValueImportEqualsWithEntityName(nodeIn) { var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration); - if (node === undefined || node.parent.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { + if (node === undefined || node.parent.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) { // parent is not source file or it is not reference to internal module return false; } @@ -87962,6 +88832,7 @@ var ts; return isValue && node.moduleReference && !ts.nodeIsMissing(node.moduleReference); } function isAliasResolvedToValue(symbol) { + var _a; if (!symbol) { return false; } @@ -87971,7 +88842,7 @@ var ts; } // const enums and modules that contain only const enums are not considered values from the emit perspective // unless 'preserveConstEnums' option is set to true - return !!(target.flags & 111551 /* SymbolFlags.Value */) && + return !!(((_a = getAllSymbolFlags(target)) !== null && _a !== void 0 ? _a : -1) & 111551 /* SymbolFlags.Value */) && (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target)); } function isConstEnumOrConstEnumOnlyModule(s) { @@ -87986,7 +88857,7 @@ var ts; } var target = getSymbolLinks(symbol).aliasTarget; // TODO: GH#18217 if (target && ts.getEffectiveModifierFlags(node) & 1 /* ModifierFlags.Export */ && - target.flags & 111551 /* SymbolFlags.Value */ && + getAllSymbolFlags(target) & 111551 /* SymbolFlags.Value */ && (ts.shouldPreserveConstEnums(compilerOptions) || !isConstEnumOrConstEnumOnlyModule(target))) { // An `export import ... =` of a value symbol is always considered referenced return true; @@ -88064,15 +88935,15 @@ var ts; } function canHaveConstantValue(node) { switch (node.kind) { - case 299 /* SyntaxKind.EnumMember */: - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 302 /* SyntaxKind.EnumMember */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return true; } return false; } function getConstantValue(node) { - if (node.kind === 299 /* SyntaxKind.EnumMember */) { + if (node.kind === 302 /* SyntaxKind.EnumMember */) { return getEnumMemberValue(node); } var symbol = getNodeLinks(node).resolvedSymbol; @@ -88165,7 +89036,7 @@ var ts; function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) { var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor); if (!declaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } // Get type of the symbol if this is the valid symbol otherwise get type at location var symbol = getSymbolOfNode(declaration); @@ -88184,7 +89055,7 @@ var ts; function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) { var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike); if (!signatureDeclaration) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var signature = getSignatureFromDeclaration(signatureDeclaration); return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88192,7 +89063,7 @@ var ts; function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) { var expr = ts.getParseTreeNode(exprIn, ts.isExpression); if (!expr) { - return ts.factory.createToken(130 /* SyntaxKind.AnyKeyword */); + return ts.factory.createToken(131 /* SyntaxKind.AnyKeyword */); } var type = getWidenedType(getRegularTypeOfExpression(expr)); return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* NodeBuilderFlags.MultilineObjectLiterals */, tracker); @@ -88216,6 +89087,25 @@ var ts; } return resolveName(location, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, /*nodeNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ true); } + /** + * Get either a value-meaning symbol or an alias symbol. + * Unlike `getReferencedValueSymbol`, if the cached resolved symbol is the unknown symbol, + * we call `resolveName` to find a symbol. + * This is because when caching the resolved symbol, we only consider value symbols, but here + * we want to also get an alias symbol if one exists. + */ + function getReferencedValueOrAliasSymbol(reference) { + var resolvedSymbol = getNodeLinks(reference).resolvedSymbol; + if (resolvedSymbol && resolvedSymbol !== unknownSymbol) { + return resolvedSymbol; + } + return resolveName(reference, reference.escapedText, 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */ | 2097152 /* SymbolFlags.Alias */, + /*nodeNotFoundMessage*/ undefined, + /*nameArg*/ undefined, + /*isUse*/ true, + /*excludeGlobals*/ undefined, + /*getSpellingSuggestions*/ undefined); + } function getReferencedValueDeclaration(referenceIn) { if (!ts.isGeneratedIdentifier(referenceIn)) { var reference = ts.getParseTreeNode(referenceIn, ts.isIdentifier); @@ -88349,12 +89239,12 @@ var ts; getJsxFragmentFactoryEntity: getJsxFragmentFactoryEntity, getAllAccessorDeclarations: function (accessor) { accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); // TODO: GH#18217 - var otherKind = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? 172 /* SyntaxKind.GetAccessor */ : 173 /* SyntaxKind.SetAccessor */; + var otherKind = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? 174 /* SyntaxKind.GetAccessor */ : 175 /* SyntaxKind.SetAccessor */; var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind); var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor; var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor; - var setAccessor = accessor.kind === 173 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; - var getAccessor = accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; + var setAccessor = accessor.kind === 175 /* SyntaxKind.SetAccessor */ ? accessor : otherAccessor; + var getAccessor = accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor : otherAccessor; return { firstAccessor: firstAccessor, secondAccessor: secondAccessor, @@ -88370,7 +89260,7 @@ var ts; }, getDeclarationStatementsForSourceFile: function (node, flags, tracker, bundled) { var n = ts.getParseTreeNode(node); - ts.Debug.assert(n && n.kind === 305 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); + ts.Debug.assert(n && n.kind === 308 /* SyntaxKind.SourceFile */, "Non-sourcefile node passed into getDeclarationsForSourceFile"); var sym = getSymbolOfNode(node); if (!sym) { return !node.locals ? [] : nodeBuilder.symbolTableToDeclarationStatements(node.locals, node, flags, tracker, bundled); @@ -88407,7 +89297,7 @@ var ts; return false; } function isInHeritageClause(node) { - return node.parent && node.parent.kind === 228 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 291 /* SyntaxKind.HeritageClause */; + return node.parent && node.parent.kind === 230 /* SyntaxKind.ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 294 /* SyntaxKind.HeritageClause */; } // defined here to avoid outer scope pollution function getTypeReferenceDirectivesForEntityName(node) { @@ -88420,12 +89310,12 @@ var ts; // qualified names can only be used as types\namespaces // identifiers are treated as values only if they appear in type queries var meaning; - if (node.parent.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.parent.kind === 164 /* SyntaxKind.ComputedPropertyName */) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } else { meaning = 788968 /* SymbolFlags.Type */ | 1920 /* SymbolFlags.Namespace */; - if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { + if ((node.kind === 79 /* SyntaxKind.Identifier */ && isInTypeQuery(node)) || (node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ && !isInHeritageClause(node))) { meaning = 111551 /* SymbolFlags.Value */ | 1048576 /* SymbolFlags.ExportValue */; } } @@ -88474,7 +89364,7 @@ var ts; break; } } - if (current.valueDeclaration && current.valueDeclaration.kind === 305 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { + if (current.valueDeclaration && current.valueDeclaration.kind === 308 /* SyntaxKind.SourceFile */ && current.flags & 512 /* SymbolFlags.ValueModule */) { return false; } // check that at least one declaration of top level symbol originates from type declaration file @@ -88502,12 +89392,12 @@ var ts; } } function getExternalModuleFileFromDeclaration(declaration) { - var specifier = declaration.kind === 261 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); + var specifier = declaration.kind === 264 /* SyntaxKind.ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration); var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); // TODO: GH#18217 if (!moduleSymbol) { return undefined; } - return ts.getDeclarationOfKind(moduleSymbol, 305 /* SyntaxKind.SourceFile */); + return ts.getDeclarationOfKind(moduleSymbol, 308 /* SyntaxKind.SourceFile */); } function initializeTypeChecker() { // Bind all source files and propagate errors @@ -88719,14 +89609,14 @@ var ts; return false; } if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) { - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !ts.nodeIsPresent(node.body)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload); } else { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here); } } - else if (node.kind === 172 /* SyntaxKind.GetAccessor */ || node.kind === 173 /* SyntaxKind.SetAccessor */) { + else if (node.kind === 174 /* SyntaxKind.GetAccessor */ || node.kind === 175 /* SyntaxKind.SetAccessor */) { var accessors = ts.getAllAccessorDeclarations(node.parent.members, node); if (ts.hasDecorators(accessors.firstAccessor) && node === accessors.secondAccessor) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name); @@ -88745,26 +89635,26 @@ var ts; var modifier = _a[_i]; if (ts.isDecorator(modifier)) continue; - if (modifier.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.kind === 166 /* SyntaxKind.PropertySignature */ || node.kind === 168 /* SyntaxKind.MethodSignature */) { + if (modifier.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.kind === 168 /* SyntaxKind.PropertySignature */ || node.kind === 170 /* SyntaxKind.MethodSignature */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind)); } - if (node.kind === 176 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { + if (node.kind === 178 /* SyntaxKind.IndexSignature */ && (modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ || !ts.isClassLike(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind)); } } - if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 144 /* SyntaxKind.OutKeyword */) { - if (node.kind === 163 /* SyntaxKind.TypeParameter */) { + if (modifier.kind !== 101 /* SyntaxKind.InKeyword */ && modifier.kind !== 145 /* SyntaxKind.OutKeyword */) { + if (node.kind === 165 /* SyntaxKind.TypeParameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_parameter, ts.tokenToString(modifier.kind)); } } switch (modifier.kind) { case 85 /* SyntaxKind.ConstKeyword */: - if (node.kind !== 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind !== 263 /* SyntaxKind.EnumDeclaration */) { return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(85 /* SyntaxKind.ConstKeyword */)); } break; - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "override"); @@ -88775,7 +89665,10 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "accessor"); + } + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "override", "async"); } flags |= 16384 /* ModifierFlags.Override */; @@ -88794,16 +89687,19 @@ var ts; else if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "static"); } + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "accessor"); + } else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { if (modifier.kind === 121 /* SyntaxKind.PrivateKeyword */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract"); } @@ -88823,16 +89719,19 @@ var ts; else if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "readonly"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async"); } - else if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + else if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "accessor"); + } + else if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "static", "abstract"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -88841,11 +89740,26 @@ var ts; flags |= 32 /* ModifierFlags.Static */; lastStatic = modifier; break; - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "accessor"); + } + else if (flags & 64 /* ModifierFlags.Readonly */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "readonly"); + } + else if (flags & 2 /* ModifierFlags.Ambient */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "accessor", "declare"); + } + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */) { + return grammarErrorOnNode(modifier, ts.Diagnostics.accessor_modifier_can_only_appear_on_a_property_declaration); + } + flags |= 128 /* ModifierFlags.Accessor */; + break; + case 146 /* SyntaxKind.ReadonlyKeyword */: if (flags & 64 /* ModifierFlags.Readonly */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly"); } - else if (node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 166 /* SyntaxKind.PropertySignature */ && node.kind !== 176 /* SyntaxKind.IndexSignature */ && node.kind !== 164 /* SyntaxKind.Parameter */) { + else if (node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && node.kind !== 168 /* SyntaxKind.PropertySignature */ && node.kind !== 178 /* SyntaxKind.IndexSignature */ && node.kind !== 166 /* SyntaxKind.Parameter */) { // If node.kind === SyntaxKind.Parameter, checkParameter reports an error if it's not a parameter property. return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature); } @@ -88858,35 +89772,35 @@ var ts; else if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "declare"); } - else if (flags & 128 /* ModifierFlags.Abstract */) { + else if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "abstract"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async"); } else if (ts.isClassLike(node.parent)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "export"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export"); } flags |= 1 /* ModifierFlags.Export */; break; case 88 /* SyntaxKind.DefaultKeyword */: - var container = node.parent.kind === 305 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; - if (container.kind === 261 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { + var container = node.parent.kind === 308 /* SyntaxKind.SourceFile */ ? node.parent : node.parent.parent; + if (container.kind === 264 /* SyntaxKind.ModuleDeclaration */ && !ts.isAmbientModule(container)) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module); } else if (!(flags & 1 /* ModifierFlags.Export */)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "default"); } - flags |= 512 /* ModifierFlags.Default */; + flags |= 1024 /* ModifierFlags.Default */; break; - case 135 /* SyntaxKind.DeclareKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: if (flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare"); } - else if (flags & 256 /* ModifierFlags.Async */) { + else if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } else if (flags & 16384 /* ModifierFlags.Override */) { @@ -88895,10 +89809,10 @@ var ts; else if (ts.isClassLike(node.parent) && !ts.isPropertyDeclaration(node)) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_class_elements_of_this_kind, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare"); } - else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 262 /* SyntaxKind.ModuleBlock */) { + else if ((node.parent.flags & 16777216 /* NodeFlags.Ambient */) && node.parent.kind === 265 /* SyntaxKind.ModuleBlock */) { return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context); } else if (ts.isPrivateIdentifierClassElementDeclaration(node)) { @@ -88908,18 +89822,18 @@ var ts; lastDeclare = modifier; break; case 126 /* SyntaxKind.AbstractKeyword */: - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract"); } - if (node.kind !== 257 /* SyntaxKind.ClassDeclaration */ && - node.kind !== 180 /* SyntaxKind.ConstructorType */) { - if (node.kind !== 169 /* SyntaxKind.MethodDeclaration */ && - node.kind !== 167 /* SyntaxKind.PropertyDeclaration */ && - node.kind !== 172 /* SyntaxKind.GetAccessor */ && - node.kind !== 173 /* SyntaxKind.SetAccessor */) { + if (node.kind !== 260 /* SyntaxKind.ClassDeclaration */ && + node.kind !== 182 /* SyntaxKind.ConstructorType */) { + if (node.kind !== 171 /* SyntaxKind.MethodDeclaration */ && + node.kind !== 169 /* SyntaxKind.PropertyDeclaration */ && + node.kind !== 174 /* SyntaxKind.GetAccessor */ && + node.kind !== 175 /* SyntaxKind.SetAccessor */) { return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration); } - if (!(node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 128 /* ModifierFlags.Abstract */))) { + if (!(node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ && ts.hasSyntacticModifier(node.parent, 256 /* ModifierFlags.Abstract */))) { return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class); } if (flags & 32 /* ModifierFlags.Static */) { @@ -88928,39 +89842,42 @@ var ts; if (flags & 8 /* ModifierFlags.Private */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "private", "abstract"); } - if (flags & 256 /* ModifierFlags.Async */ && lastAsync) { + if (flags & 512 /* ModifierFlags.Async */ && lastAsync) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "override"); } + if (flags & 128 /* ModifierFlags.Accessor */) { + return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "abstract", "accessor"); + } } if (ts.isNamedDeclaration(node) && node.name.kind === 80 /* SyntaxKind.PrivateIdentifier */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_a_private_identifier, "abstract"); } - flags |= 128 /* ModifierFlags.Abstract */; + flags |= 256 /* ModifierFlags.Abstract */; break; - case 131 /* SyntaxKind.AsyncKeyword */: - if (flags & 256 /* ModifierFlags.Async */) { + case 132 /* SyntaxKind.AsyncKeyword */: + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async"); } else if (flags & 2 /* ModifierFlags.Ambient */ || node.parent.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.kind === 166 /* SyntaxKind.Parameter */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async"); } - if (flags & 128 /* ModifierFlags.Abstract */) { + if (flags & 256 /* ModifierFlags.Abstract */) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, "async", "abstract"); } - flags |= 256 /* ModifierFlags.Async */; + flags |= 512 /* ModifierFlags.Async */; lastAsync = modifier; break; case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: var inOutFlag = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? 32768 /* ModifierFlags.In */ : 65536 /* ModifierFlags.Out */; var inOutText = modifier.kind === 101 /* SyntaxKind.InKeyword */ ? "in" : "out"; - if (node.kind !== 163 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { + if (node.kind !== 165 /* SyntaxKind.TypeParameter */ || !(ts.isInterfaceDeclaration(node.parent) || ts.isClassLike(node.parent) || ts.isTypeAliasDeclaration(node.parent))) { return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_can_only_appear_on_a_type_parameter_of_a_class_interface_or_type_alias, inOutText); } if (flags & inOutFlag) { @@ -88973,28 +89890,28 @@ var ts; break; } } - if (node.kind === 171 /* SyntaxKind.Constructor */) { + if (node.kind === 173 /* SyntaxKind.Constructor */) { if (flags & 32 /* ModifierFlags.Static */) { return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static"); } if (flags & 16384 /* ModifierFlags.Override */) { return grammarErrorOnNode(lastOverride, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "override"); // TODO: GH#18217 } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return grammarErrorOnNode(lastAsync, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "async"); } return false; } - else if ((node.kind === 266 /* SyntaxKind.ImportDeclaration */ || node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { + else if ((node.kind === 269 /* SyntaxKind.ImportDeclaration */ || node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */) && flags & 2 /* ModifierFlags.Ambient */) { return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare"); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern); } - else if (node.kind === 164 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { + else if (node.kind === 166 /* SyntaxKind.Parameter */ && (flags & 16476 /* ModifierFlags.ParameterPropertyModifier */) && node.dotDotDotToken) { return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter); } - if (flags & 256 /* ModifierFlags.Async */) { + if (flags & 512 /* ModifierFlags.Async */) { return checkGrammarAsyncModifier(node, lastAsync); } return false; @@ -89012,47 +89929,47 @@ var ts; } function shouldReportBadModifier(node) { switch (node.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: - case 164 /* SyntaxKind.Parameter */: - case 163 /* SyntaxKind.TypeParameter */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: + case 166 /* SyntaxKind.Parameter */: + case 165 /* SyntaxKind.TypeParameter */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - case 179 /* SyntaxKind.FunctionType */: - case 276 /* SyntaxKind.MissingDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 279 /* SyntaxKind.MissingDeclaration */: return true; default: - if (node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { return false; } switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - return nodeHasAnyModifiersExcept(node, 131 /* SyntaxKind.AsyncKeyword */); - case 257 /* SyntaxKind.ClassDeclaration */: - case 180 /* SyntaxKind.ConstructorType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + return nodeHasAnyModifiersExcept(node, 132 /* SyntaxKind.AsyncKeyword */); + case 260 /* SyntaxKind.ClassDeclaration */: + case 182 /* SyntaxKind.ConstructorType */: return nodeHasAnyModifiersExcept(node, 126 /* SyntaxKind.AbstractKeyword */); - case 226 /* SyntaxKind.ClassExpression */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return true; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return nodeHasAnyModifiersExcept(node, 85 /* SyntaxKind.ConstKeyword */); default: ts.Debug.assertNever(node); @@ -89070,10 +89987,10 @@ var ts; } function checkGrammarAsyncModifier(node, asyncModifier) { switch (node.kind) { - case 169 /* SyntaxKind.MethodDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 214 /* SyntaxKind.ArrowFunction */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 216 /* SyntaxKind.ArrowFunction */: return false; } return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); @@ -89302,20 +90219,20 @@ var ts; } function checkGrammarComputedPropertyName(node) { // If node is not a computedPropertyName, just skip the grammar checking - if (node.kind !== 162 /* SyntaxKind.ComputedPropertyName */) { + if (node.kind !== 164 /* SyntaxKind.ComputedPropertyName */) { return false; } var computedPropertyName = node; - if (computedPropertyName.expression.kind === 221 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { + if (computedPropertyName.expression.kind === 223 /* SyntaxKind.BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* SyntaxKind.CommaToken */) { return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } return false; } function checkGrammarForGenerator(node) { if (node.asteriskToken) { - ts.Debug.assert(node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || - node.kind === 213 /* SyntaxKind.FunctionExpression */ || - node.kind === 169 /* SyntaxKind.MethodDeclaration */); + ts.Debug.assert(node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || + node.kind === 215 /* SyntaxKind.FunctionExpression */ || + node.kind === 171 /* SyntaxKind.MethodDeclaration */); if (node.flags & 16777216 /* NodeFlags.Ambient */) { return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context); } @@ -89334,7 +90251,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var prop = _a[_i]; - if (prop.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (prop.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (inDestructuring) { // a rest property cannot be destructured any further var expression = ts.skipParentheses(prop.expression); @@ -89345,11 +90262,11 @@ var ts; continue; } var name = prop.name; - if (name.kind === 162 /* SyntaxKind.ComputedPropertyName */) { + if (name.kind === 164 /* SyntaxKind.ComputedPropertyName */) { // If the name is not a ComputedPropertyName, the grammar checking will skip it checkGrammarComputedPropertyName(name); } - if (prop.kind === 297 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { + if (prop.kind === 300 /* SyntaxKind.ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) { // having objectAssignmentInitializer is only valid in ObjectAssignmentPattern // outside of destructuring it is a syntax error grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.Did_you_mean_to_use_a_Colon_An_can_only_follow_a_property_name_when_the_containing_object_literal_is_part_of_a_destructuring_pattern); @@ -89361,7 +90278,7 @@ var ts; if (ts.canHaveModifiers(prop) && prop.modifiers) { for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { var mod = _c[_b]; - if (ts.isModifier(mod) && (mod.kind !== 131 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 169 /* SyntaxKind.MethodDeclaration */)) { + if (ts.isModifier(mod) && (mod.kind !== 132 /* SyntaxKind.AsyncKeyword */ || prop.kind !== 171 /* SyntaxKind.MethodDeclaration */)) { grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod)); } } @@ -89382,8 +90299,8 @@ var ts; // and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields var currentKind = void 0; switch (prop.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 296 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: // Grammar checking for computedPropertyName and shorthandPropertyAssignment checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional); @@ -89392,13 +90309,13 @@ var ts; } currentKind = 4 /* DeclarationMeaning.PropertyAssignment */; break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: currentKind = 8 /* DeclarationMeaning.Method */; break; - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: currentKind = 1 /* DeclarationMeaning.GetAccessor */; break; - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: currentKind = 2 /* DeclarationMeaning.SetAccessor */; break; default: @@ -89441,7 +90358,7 @@ var ts; var seen = new ts.Map(); for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) { var attr = _a[_i]; - if (attr.kind === 287 /* SyntaxKind.JsxSpreadAttribute */) { + if (attr.kind === 290 /* SyntaxKind.JsxSpreadAttribute */) { continue; } var name = attr.name, initializer = attr.initializer; @@ -89451,7 +90368,7 @@ var ts; else { return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name); } - if (initializer && initializer.kind === 288 /* SyntaxKind.JsxExpression */ && !initializer.expression) { + if (initializer && initializer.kind === 291 /* SyntaxKind.JsxExpression */ && !initializer.expression) { return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression); } } @@ -89486,7 +90403,7 @@ var ts; if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } - if (forInOrOfStatement.kind === 244 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { + if (forInOrOfStatement.kind === 247 /* SyntaxKind.ForOfStatement */ && forInOrOfStatement.awaitModifier) { if (!(forInOrOfStatement.flags & 32768 /* NodeFlags.AwaitContext */)) { var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement); if (ts.isInTopLevelContext(forInOrOfStatement)) { @@ -89520,7 +90437,7 @@ var ts; if (!hasParseDiagnostics(sourceFile)) { var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.for_await_loops_are_only_allowed_within_async_functions_and_at_the_top_levels_of_modules); var func = ts.getContainingFunction(forInOrOfStatement); - if (func && func.kind !== 171 /* SyntaxKind.Constructor */) { + if (func && func.kind !== 173 /* SyntaxKind.Constructor */) { ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* FunctionFlags.Async */) === 0, "Enclosing function should never be an async function."); var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async); ts.addRelatedInfo(diagnostic, relatedInfo); @@ -89537,7 +90454,7 @@ var ts; grammarErrorOnNode(forInOrOfStatement.initializer, ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_may_not_be_async); return false; } - if (forInOrOfStatement.initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (forInOrOfStatement.initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { var declarations = variableList.declarations; @@ -89552,20 +90469,20 @@ var ts; return false; } if (declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === 243 /* SyntaxKind.ForInStatement */ + var diagnostic = forInOrOfStatement.kind === 246 /* SyntaxKind.ForInStatement */ ? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); @@ -89575,22 +90492,22 @@ var ts; return false; } function checkGrammarAccessor(accessor) { - if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 182 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 258 /* SyntaxKind.InterfaceDeclaration */)) { + if (!(accessor.flags & 16777216 /* NodeFlags.Ambient */) && (accessor.parent.kind !== 184 /* SyntaxKind.TypeLiteral */) && (accessor.parent.kind !== 261 /* SyntaxKind.InterfaceDeclaration */)) { if (languageVersion < 1 /* ScriptTarget.ES5 */) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher); } if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(accessor.name)) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } - if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (accessor.body === undefined && !ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorAtPos(accessor, accessor.end - 1, ";".length, ts.Diagnostics._0_expected, "{"); } } if (accessor.body) { - if (ts.hasSyntacticModifier(accessor, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(accessor, 256 /* ModifierFlags.Abstract */)) { return grammarErrorOnNode(accessor, ts.Diagnostics.An_abstract_accessor_cannot_have_an_implementation); } - if (accessor.parent.kind === 182 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (accessor.parent.kind === 184 /* SyntaxKind.TypeLiteral */ || accessor.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return grammarErrorOnNode(accessor.body, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts); } } @@ -89598,11 +90515,11 @@ var ts; return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters); } if (!doesAccessorHaveCorrectParameterCount(accessor)) { - return grammarErrorOnNode(accessor.name, accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? + return grammarErrorOnNode(accessor.name, accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? ts.Diagnostics.A_get_accessor_cannot_have_parameters : ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter); } - if (accessor.kind === 173 /* SyntaxKind.SetAccessor */) { + if (accessor.kind === 175 /* SyntaxKind.SetAccessor */) { if (accessor.type) { return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation); } @@ -89624,17 +90541,17 @@ var ts; * A set accessor has one parameter or a `this` parameter and one more parameter. */ function doesAccessorHaveCorrectParameterCount(accessor) { - return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 0 : 1); + return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 0 : 1); } function getAccessorThisParameter(accessor) { - if (accessor.parameters.length === (accessor.kind === 172 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { + if (accessor.parameters.length === (accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? 1 : 2)) { return ts.getThisParameter(accessor); } } function checkGrammarTypeOperatorNode(node) { - if (node.operator === 154 /* SyntaxKind.UniqueKeyword */) { - if (node.type.kind !== 151 /* SyntaxKind.SymbolKeyword */) { - return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + if (node.operator === 156 /* SyntaxKind.UniqueKeyword */) { + if (node.type.kind !== 153 /* SyntaxKind.SymbolKeyword */) { + return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } var parent = ts.walkUpParenthesizedTypes(node.parent); if (ts.isInJSFile(parent) && ts.isJSDocTypeExpression(parent)) { @@ -89644,7 +90561,7 @@ var ts; } } switch (parent.kind) { - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: var decl = parent; if (decl.name.kind !== 79 /* SyntaxKind.Identifier */) { return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name); @@ -89656,13 +90573,13 @@ var ts; return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const); } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (!ts.isStatic(parent) || !ts.hasEffectiveReadonlyModifier(parent)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly); } break; - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (!ts.hasSyntacticModifier(parent, 64 /* ModifierFlags.Readonly */)) { return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly); } @@ -89671,9 +90588,9 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here); } } - else if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { - if (node.type.kind !== 183 /* SyntaxKind.ArrayType */ && node.type.kind !== 184 /* SyntaxKind.TupleType */) { - return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(151 /* SyntaxKind.SymbolKeyword */)); + else if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { + if (node.type.kind !== 185 /* SyntaxKind.ArrayType */ && node.type.kind !== 186 /* SyntaxKind.TupleType */) { + return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(153 /* SyntaxKind.SymbolKeyword */)); } } } @@ -89686,10 +90603,10 @@ var ts; if (checkGrammarFunctionLikeDeclaration(node)) { return true; } - if (node.kind === 169 /* SyntaxKind.MethodDeclaration */) { - if (node.parent.kind === 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (node.kind === 171 /* SyntaxKind.MethodDeclaration */) { + if (node.parent.kind === 207 /* SyntaxKind.ObjectLiteralExpression */) { // We only disallow modifier on a method declaration if it is a property of object-literal-expression - if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 131 /* SyntaxKind.AsyncKeyword */)) { + if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 132 /* SyntaxKind.AsyncKeyword */)) { return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here); } else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) { @@ -89718,14 +90635,14 @@ var ts; if (node.flags & 16777216 /* NodeFlags.Ambient */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.kind === 169 /* SyntaxKind.MethodDeclaration */ && !node.body) { + else if (node.kind === 171 /* SyntaxKind.MethodDeclaration */ && !node.body) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } - else if (node.parent.kind === 182 /* SyntaxKind.TypeLiteral */) { + else if (node.parent.kind === 184 /* SyntaxKind.TypeLiteral */) { return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type); } } @@ -89736,11 +90653,11 @@ var ts; return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary); } switch (current.kind) { - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: if (node.label && current.label.escapedText === node.label.escapedText) { // found matching label - verify that label usage is correct // continue can only target labels that are on iteration statements - var isMisplacedContinueLabel = node.kind === 245 /* SyntaxKind.ContinueStatement */ + var isMisplacedContinueLabel = node.kind === 248 /* SyntaxKind.ContinueStatement */ && !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true); if (isMisplacedContinueLabel) { return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement); @@ -89748,8 +90665,8 @@ var ts; return false; } break; - case 249 /* SyntaxKind.SwitchStatement */: - if (node.kind === 246 /* SyntaxKind.BreakStatement */ && !node.label) { + case 252 /* SyntaxKind.SwitchStatement */: + if (node.kind === 249 /* SyntaxKind.BreakStatement */ && !node.label) { // unlabeled break within switch statement - ok return false; } @@ -89764,13 +90681,13 @@ var ts; current = current.parent; } if (node.label) { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement : ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); } else { - var message = node.kind === 246 /* SyntaxKind.BreakStatement */ + var message = node.kind === 249 /* SyntaxKind.BreakStatement */ ? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement : ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement; return grammarErrorOnNode(node, message); @@ -89794,12 +90711,12 @@ var ts; } function isStringOrNumberLiteralExpression(expr) { return ts.isStringOrNumericLiteralLike(expr) || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 8 /* SyntaxKind.NumericLiteral */; } function isBigIntLiteralExpression(expr) { return expr.kind === 9 /* SyntaxKind.BigIntLiteral */ || - expr.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && + expr.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && expr.operator === 40 /* SyntaxKind.MinusToken */ && expr.operand.kind === 9 /* SyntaxKind.BigIntLiteral */; } function isSimpleLiteralEnumReference(expr) { @@ -89827,7 +90744,7 @@ var ts; } } function checkGrammarVariableDeclaration(node) { - if (node.parent.parent.kind !== 243 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 244 /* SyntaxKind.ForOfStatement */) { + if (node.parent.parent.kind !== 246 /* SyntaxKind.ForInStatement */ && node.parent.parent.kind !== 247 /* SyntaxKind.ForOfStatement */) { if (node.flags & 16777216 /* NodeFlags.Ambient */) { checkAmbientInitializer(node); } @@ -89840,7 +90757,7 @@ var ts; } } } - if (node.exclamationToken && (node.parent.parent.kind !== 237 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { + if (node.exclamationToken && (node.parent.parent.kind !== 240 /* SyntaxKind.VariableStatement */ || !node.type || node.initializer || node.flags & 16777216 /* NodeFlags.Ambient */)) { var message = node.initializer ? ts.Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions : !node.type @@ -89907,15 +90824,15 @@ var ts; } function allowLetAndConstDeclarations(parent) { switch (parent.kind) { - case 239 /* SyntaxKind.IfStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return false; - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return allowLetAndConstDeclarations(parent.parent); } return true; @@ -90009,8 +90926,14 @@ var ts; if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isPrivateIdentifier(node.name)) { return grammarErrorOnNode(node.name, ts.Diagnostics.Private_identifiers_are_only_available_when_targeting_ECMAScript_2015_and_higher); } + if (languageVersion < 2 /* ScriptTarget.ES2015 */ && ts.isAutoAccessorPropertyDeclaration(node)) { + return grammarErrorOnNode(node.name, ts.Diagnostics.Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher); + } + if (ts.isAutoAccessorPropertyDeclaration(node) && checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_accessor_property_cannot_be_declared_optional)) { + return true; + } } - else if (node.parent.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + else if (node.parent.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) { return true; } @@ -90056,14 +90979,14 @@ var ts; // export_opt AmbientDeclaration // // TODO: The spec needs to be amended to reflect this grammar. - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */ || - node.kind === 259 /* SyntaxKind.TypeAliasDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ || - node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 271 /* SyntaxKind.ExportAssignment */ || - node.kind === 264 /* SyntaxKind.NamespaceExportDeclaration */ || - ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 512 /* ModifierFlags.Default */)) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */ || + node.kind === 262 /* SyntaxKind.TypeAliasDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ || + node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 274 /* SyntaxKind.ExportAssignment */ || + node.kind === 267 /* SyntaxKind.NamespaceExportDeclaration */ || + ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */ | 1 /* ModifierFlags.Export */ | 1024 /* ModifierFlags.Default */)) { return false; } return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier); @@ -90071,7 +90994,7 @@ var ts; function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) { for (var _i = 0, _a = file.statements; _i < _a.length; _i++) { var decl = _a[_i]; - if (ts.isDeclaration(decl) || decl.kind === 237 /* SyntaxKind.VariableStatement */) { + if (ts.isDeclaration(decl) || decl.kind === 240 /* SyntaxKind.VariableStatement */) { if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) { return true; } @@ -90094,7 +91017,7 @@ var ts; // to prevent noisiness. So use a bit on the block to indicate if // this has already been reported, and don't report if it has. // - if (node.parent.kind === 235 /* SyntaxKind.Block */ || node.parent.kind === 262 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.parent.kind === 238 /* SyntaxKind.Block */ || node.parent.kind === 265 /* SyntaxKind.ModuleBlock */ || node.parent.kind === 308 /* SyntaxKind.SourceFile */) { var links_2 = getNodeLinks(node.parent); // Check if the containing block ever report this error if (!links_2.hasReportedStatementInAmbientContext) { @@ -90116,10 +91039,10 @@ var ts; if (languageVersion >= 1 /* ScriptTarget.ES5 */) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 196 /* SyntaxKind.LiteralType */)) { + else if (ts.isChildOfNodeWithKind(node, 198 /* SyntaxKind.LiteralType */)) { diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0; } - else if (ts.isChildOfNodeWithKind(node, 299 /* SyntaxKind.EnumMember */)) { + else if (ts.isChildOfNodeWithKind(node, 302 /* SyntaxKind.EnumMember */)) { diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0; } if (diagnosticMessage) { @@ -90191,7 +91114,7 @@ var ts; if (node.isTypeOnly && node.name && node.namedBindings) { return grammarErrorOnNode(node, ts.Diagnostics.A_type_only_import_can_specify_a_default_import_or_named_bindings_but_not_both); } - if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 269 /* SyntaxKind.NamedImports */) { + if (node.isTypeOnly && ((_a = node.namedBindings) === null || _a === void 0 ? void 0 : _a.kind) === 272 /* SyntaxKind.NamedImports */) { return checkGrammarNamedImportsOrExports(node.namedBindings); } return false; @@ -90199,7 +91122,7 @@ var ts; function checkGrammarNamedImportsOrExports(namedBindings) { return !!ts.forEach(namedBindings.elements, function (specifier) { if (specifier.isTypeOnly) { - return grammarErrorOnFirstToken(specifier, specifier.kind === 270 /* SyntaxKind.ImportSpecifier */ + return grammarErrorOnFirstToken(specifier, specifier.kind === 273 /* SyntaxKind.ImportSpecifier */ ? ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_import_when_import_type_is_used_on_its_import_statement : ts.Diagnostics.The_type_modifier_cannot_be_used_on_a_named_export_when_export_type_is_used_on_its_export_statement); } @@ -90322,14 +91245,14 @@ var ts; return !ts.isAccessor(declaration); } function isNotOverload(declaration) { - return (declaration.kind !== 256 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 169 /* SyntaxKind.MethodDeclaration */) || + return (declaration.kind !== 259 /* SyntaxKind.FunctionDeclaration */ && declaration.kind !== 171 /* SyntaxKind.MethodDeclaration */) || !!declaration.body; } /** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */ function isDeclarationNameOrImportPropertyName(name) { switch (name.parent.kind) { - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return ts.isIdentifier(name); default: return ts.isDeclarationName(name); @@ -90365,6 +91288,7 @@ var ts; })(ts || (ts = {})); var ts; (function (ts) { + var _a; function visitNode(node, visitor, test, lift) { if (node === undefined || visitor === undefined) { return node; @@ -90431,7 +91355,6 @@ var ts; return nodes; } ts.visitNodes = visitNodes; - /* @internal */ function visitArray(nodes, visitor, test, start, count) { if (nodes === undefined) { return nodes; @@ -90579,12 +91502,10 @@ var ts; return updated; } ts.visitFunctionBody = visitFunctionBody; - /** - * Visits an iteration body, adding any block-scoped variables required by the transformation. - */ - function visitIterationBody(body, visitor, context) { + function visitIterationBody(body, visitor, context, nodeVisitor) { + if (nodeVisitor === void 0) { nodeVisitor = visitNode; } context.startBlockScope(); - var updated = visitNode(body, visitor, ts.isStatement, context.factory.liftToBlock); + var updated = nodeVisitor(body, visitor, ts.isStatement, context.factory.liftToBlock); var declarations = context.endBlockScope(); if (ts.some(declarations)) { if (ts.isBlock(updated)) { @@ -90603,456 +91524,446 @@ var ts; if (node === undefined) { return undefined; } - var kind = node.kind; - // No need to visit nodes with no children. - if ((kind > 0 /* SyntaxKind.FirstToken */ && kind <= 160 /* SyntaxKind.LastToken */) || kind === 192 /* SyntaxKind.ThisType */) { - return node; - } - var factory = context.factory; - switch (kind) { - // Names - case 79 /* SyntaxKind.Identifier */: - ts.Debug.type(node); - return factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); - case 161 /* SyntaxKind.QualifiedName */: - ts.Debug.type(node); - return factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); - case 162 /* SyntaxKind.ComputedPropertyName */: - ts.Debug.type(node); - return factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Signature elements - case 163 /* SyntaxKind.TypeParameter */: - ts.Debug.type(node); - return factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); - case 164 /* SyntaxKind.Parameter */: - ts.Debug.type(node); - return factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 165 /* SyntaxKind.Decorator */: - ts.Debug.type(node); - return factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Type elements - case 166 /* SyntaxKind.PropertySignature */: - ts.Debug.type(node); - return factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 167 /* SyntaxKind.PropertyDeclaration */: - ts.Debug.type(node); - return factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), - // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too - nodeVisitor(node.questionToken || node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 168 /* SyntaxKind.MethodSignature */: - ts.Debug.type(node); - return factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 169 /* SyntaxKind.MethodDeclaration */: - ts.Debug.type(node); - return factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 171 /* SyntaxKind.Constructor */: - ts.Debug.type(node); - return factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 172 /* SyntaxKind.GetAccessor */: - ts.Debug.type(node); - return factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 173 /* SyntaxKind.SetAccessor */: - ts.Debug.type(node); - return factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - ts.Debug.type(node); - context.startLexicalEnvironment(); - context.suspendLexicalEnvironment(); - return factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 174 /* SyntaxKind.CallSignature */: - ts.Debug.type(node); - return factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 175 /* SyntaxKind.ConstructSignature */: - ts.Debug.type(node); - return factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 176 /* SyntaxKind.IndexSignature */: - ts.Debug.type(node); - return factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - // Types - case 177 /* SyntaxKind.TypePredicate */: - ts.Debug.type(node); - return factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 178 /* SyntaxKind.TypeReference */: - ts.Debug.type(node); - return factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 179 /* SyntaxKind.FunctionType */: - ts.Debug.type(node); - return factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 180 /* SyntaxKind.ConstructorType */: - ts.Debug.type(node); - return factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 181 /* SyntaxKind.TypeQuery */: - ts.Debug.type(node); - return factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 182 /* SyntaxKind.TypeLiteral */: - ts.Debug.type(node); - return factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 183 /* SyntaxKind.ArrayType */: - ts.Debug.type(node); - return factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); - case 184 /* SyntaxKind.TupleType */: - ts.Debug.type(node); - return factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); - case 185 /* SyntaxKind.OptionalType */: - ts.Debug.type(node); - return factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 186 /* SyntaxKind.RestType */: - ts.Debug.type(node); - return factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 187 /* SyntaxKind.UnionType */: - ts.Debug.type(node); - return factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 188 /* SyntaxKind.IntersectionType */: - ts.Debug.type(node); - return factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); - case 189 /* SyntaxKind.ConditionalType */: - ts.Debug.type(node); - return factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); - case 190 /* SyntaxKind.InferType */: - ts.Debug.type(node); - return factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); - case 200 /* SyntaxKind.ImportType */: - ts.Debug.type(node); - return factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isNode), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); - case 295 /* SyntaxKind.ImportTypeAssertionContainer */: - ts.Debug.type(node); - return factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isNode), node.multiLine); - case 197 /* SyntaxKind.NamedTupleMember */: - ts.Debug.type(node); - return factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 191 /* SyntaxKind.ParenthesizedType */: - ts.Debug.type(node); - return factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 193 /* SyntaxKind.TypeOperator */: - ts.Debug.type(node); - return factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 194 /* SyntaxKind.IndexedAccessType */: - ts.Debug.type(node); - return factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); - case 195 /* SyntaxKind.MappedType */: - ts.Debug.type(node); - return factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 196 /* SyntaxKind.LiteralType */: - ts.Debug.type(node); - return factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); - case 198 /* SyntaxKind.TemplateLiteralType */: - ts.Debug.type(node); - return factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: - ts.Debug.type(node); - return factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: - ts.Debug.type(node); - return factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); - case 202 /* SyntaxKind.ArrayBindingPattern */: - ts.Debug.type(node); - return factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); - case 203 /* SyntaxKind.BindingElement */: - ts.Debug.type(node); - return factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Expression - case 204 /* SyntaxKind.ArrayLiteralExpression */: - ts.Debug.type(node); - return factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - case 205 /* SyntaxKind.ObjectLiteralExpression */: - ts.Debug.type(node); - return factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); - case 206 /* SyntaxKind.PropertyAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)); - } - ts.Debug.type(node); - return factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); - case 207 /* SyntaxKind.ElementAccessExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); - case 208 /* SyntaxKind.CallExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 209 /* SyntaxKind.NewExpression */: - ts.Debug.type(node); - return factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - ts.Debug.type(node); - return factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); - case 211 /* SyntaxKind.TypeAssertionExpression */: - ts.Debug.type(node); - return factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 212 /* SyntaxKind.ParenthesizedExpression */: - ts.Debug.type(node); - return factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 213 /* SyntaxKind.FunctionExpression */: - ts.Debug.type(node); - return factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 214 /* SyntaxKind.ArrowFunction */: - ts.Debug.type(node); - return factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 215 /* SyntaxKind.DeleteExpression */: - ts.Debug.type(node); - return factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 216 /* SyntaxKind.TypeOfExpression */: - ts.Debug.type(node); - return factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 217 /* SyntaxKind.VoidExpression */: - ts.Debug.type(node); - return factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 218 /* SyntaxKind.AwaitExpression */: - ts.Debug.type(node); - return factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 219 /* SyntaxKind.PrefixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 220 /* SyntaxKind.PostfixUnaryExpression */: - ts.Debug.type(node); - return factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); - case 221 /* SyntaxKind.BinaryExpression */: - ts.Debug.type(node); - return factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); - case 222 /* SyntaxKind.ConditionalExpression */: - ts.Debug.type(node); - return factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); - case 223 /* SyntaxKind.TemplateExpression */: - ts.Debug.type(node); - return factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); - case 224 /* SyntaxKind.YieldExpression */: - ts.Debug.type(node); - return factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 225 /* SyntaxKind.SpreadElement */: - ts.Debug.type(node); - return factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 226 /* SyntaxKind.ClassExpression */: - ts.Debug.type(node); - return factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - ts.Debug.type(node); - return factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); - case 229 /* SyntaxKind.AsExpression */: - ts.Debug.type(node); - return factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 230 /* SyntaxKind.NonNullExpression */: - if (node.flags & 32 /* NodeFlags.OptionalChain */) { - ts.Debug.type(node); - return factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - } - ts.Debug.type(node); - return factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 231 /* SyntaxKind.MetaProperty */: - ts.Debug.type(node); - return factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Misc - case 233 /* SyntaxKind.TemplateSpan */: - ts.Debug.type(node); - return factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); - // Element - case 235 /* SyntaxKind.Block */: - ts.Debug.type(node); - return factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 237 /* SyntaxKind.VariableStatement */: - ts.Debug.type(node); - return factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); - case 238 /* SyntaxKind.ExpressionStatement */: - ts.Debug.type(node); - return factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 239 /* SyntaxKind.IfStatement */: - ts.Debug.type(node); - return factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, factory.liftToBlock)); - case 240 /* SyntaxKind.DoStatement */: - ts.Debug.type(node); - return factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 241 /* SyntaxKind.WhileStatement */: - ts.Debug.type(node); - return factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 242 /* SyntaxKind.ForStatement */: - ts.Debug.type(node); - return factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 243 /* SyntaxKind.ForInStatement */: - ts.Debug.type(node); - return factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 244 /* SyntaxKind.ForOfStatement */: - ts.Debug.type(node); - return factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context)); - case 245 /* SyntaxKind.ContinueStatement */: - ts.Debug.type(node); - return factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 246 /* SyntaxKind.BreakStatement */: - ts.Debug.type(node); - return factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); - case 247 /* SyntaxKind.ReturnStatement */: - ts.Debug.type(node); - return factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 248 /* SyntaxKind.WithStatement */: - ts.Debug.type(node); - return factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 249 /* SyntaxKind.SwitchStatement */: - ts.Debug.type(node); - return factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); - case 250 /* SyntaxKind.LabeledStatement */: - ts.Debug.type(node); - return factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, factory.liftToBlock)); - case 251 /* SyntaxKind.ThrowStatement */: - ts.Debug.type(node); - return factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 252 /* SyntaxKind.TryStatement */: - ts.Debug.type(node); - return factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); - case 254 /* SyntaxKind.VariableDeclaration */: - ts.Debug.type(node); - return factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 255 /* SyntaxKind.VariableDeclarationList */: - ts.Debug.type(node); - return factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); - case 256 /* SyntaxKind.FunctionDeclaration */: - ts.Debug.type(node); - return factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); - case 257 /* SyntaxKind.ClassDeclaration */: - ts.Debug.type(node); - return factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); - case 258 /* SyntaxKind.InterfaceDeclaration */: - ts.Debug.type(node); - return factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); - case 259 /* SyntaxKind.TypeAliasDeclaration */: - ts.Debug.type(node); - return factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); - case 260 /* SyntaxKind.EnumDeclaration */: - ts.Debug.type(node); - return factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); - case 261 /* SyntaxKind.ModuleDeclaration */: - ts.Debug.type(node); - return factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); - case 262 /* SyntaxKind.ModuleBlock */: - ts.Debug.type(node); - return factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 263 /* SyntaxKind.CaseBlock */: - ts.Debug.type(node); - return factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: - ts.Debug.type(node); - return factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - ts.Debug.type(node); - return factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); - case 266 /* SyntaxKind.ImportDeclaration */: - ts.Debug.type(node); - return factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 293 /* SyntaxKind.AssertClause */: - ts.Debug.type(node); - return factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); - case 294 /* SyntaxKind.AssertEntry */: - ts.Debug.type(node); - return factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpressionNode)); - case 267 /* SyntaxKind.ImportClause */: - ts.Debug.type(node); - return factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); - case 268 /* SyntaxKind.NamespaceImport */: - ts.Debug.type(node); - return factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 274 /* SyntaxKind.NamespaceExport */: - ts.Debug.type(node); - return factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 269 /* SyntaxKind.NamedImports */: - ts.Debug.type(node); - return factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); - case 270 /* SyntaxKind.ImportSpecifier */: - ts.Debug.type(node); - return factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - case 271 /* SyntaxKind.ExportAssignment */: - ts.Debug.type(node); - return factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); - case 272 /* SyntaxKind.ExportDeclaration */: - ts.Debug.type(node); - return factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); - case 273 /* SyntaxKind.NamedExports */: - ts.Debug.type(node); - return factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); - case 275 /* SyntaxKind.ExportSpecifier */: - ts.Debug.type(node); - return factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); - // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: - ts.Debug.type(node); - return factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // JSX - case 278 /* SyntaxKind.JsxElement */: - ts.Debug.type(node); - return factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); - case 279 /* SyntaxKind.JsxSelfClosingElement */: - ts.Debug.type(node); - return factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 280 /* SyntaxKind.JsxOpeningElement */: - ts.Debug.type(node); - return factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); - case 281 /* SyntaxKind.JsxClosingElement */: - ts.Debug.type(node); - return factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); - case 282 /* SyntaxKind.JsxFragment */: - ts.Debug.type(node); - return factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); - case 285 /* SyntaxKind.JsxAttribute */: - ts.Debug.type(node); - return factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); - case 286 /* SyntaxKind.JsxAttributes */: - ts.Debug.type(node); - return factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); - case 287 /* SyntaxKind.JsxSpreadAttribute */: - ts.Debug.type(node); - return factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 288 /* SyntaxKind.JsxExpression */: - ts.Debug.type(node); - return factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Clauses - case 289 /* SyntaxKind.CaseClause */: - ts.Debug.type(node); - return factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); - case 290 /* SyntaxKind.DefaultClause */: - ts.Debug.type(node); - return factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); - case 291 /* SyntaxKind.HeritageClause */: - ts.Debug.type(node); - return factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); - case 292 /* SyntaxKind.CatchClause */: - ts.Debug.type(node); - return factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); - // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: - ts.Debug.type(node); - return factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - ts.Debug.type(node); - return factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); - case 298 /* SyntaxKind.SpreadAssignment */: - ts.Debug.type(node); - return factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - // Enum - case 299 /* SyntaxKind.EnumMember */: - ts.Debug.type(node); - return factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); - // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: - ts.Debug.type(node); - return factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context)); - // Transformation nodes - case 350 /* SyntaxKind.PartiallyEmittedExpression */: - ts.Debug.type(node); - return factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); - case 351 /* SyntaxKind.CommaListExpression */: - ts.Debug.type(node); - return factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); - default: - // No need to visit nodes with no children. - return node; - } + var fn = visitEachChildTable[node.kind]; + return fn === undefined ? node : fn(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor); } ts.visitEachChild = visitEachChild; + // NOTE: Before you can add a new method to `visitEachChildTable`, you must first ensure the `Node` subtype you + // wish to add is defined in the `HasChildren` union in types.ts. + var visitEachChildTable = (_a = {}, + _a[79 /* SyntaxKind.Identifier */] = function visitEachChildOfIdentifier(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNodeOrTypeParameterDeclaration)); + }, + _a[163 /* SyntaxKind.QualifiedName */] = function visitEachChildOfQualifiedName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateQualifiedName(node, nodeVisitor(node.left, visitor, ts.isEntityName), nodeVisitor(node.right, visitor, ts.isIdentifier)); + }, + _a[164 /* SyntaxKind.ComputedPropertyName */] = function visitEachChildOfComputedPropertyName(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateComputedPropertyName(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Signature elements + _a[165 /* SyntaxKind.TypeParameter */] = function visitEachChildOfTypeParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.constraint, visitor, ts.isTypeNode), nodeVisitor(node.default, visitor, ts.isTypeNode)); + }, + _a[166 /* SyntaxKind.Parameter */] = function visitEachChildOfParameterDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateParameterDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[167 /* SyntaxKind.Decorator */] = function visitEachChildOfDecorator(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDecorator(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Type elements + _a[168 /* SyntaxKind.PropertySignature */] = function visitEachChildOfPropertySignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[169 /* SyntaxKind.PropertyDeclaration */] = function visitEachChildOfPropertyDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + var _a; + return context.factory.updatePropertyDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), + // QuestionToken and ExclamationToken are mutually exclusive in PropertyDeclaration + nodeVisitor((_a = node.questionToken) !== null && _a !== void 0 ? _a : node.exclamationToken, tokenVisitor, ts.isQuestionOrExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[170 /* SyntaxKind.MethodSignature */] = function visitEachChildOfMethodSignature(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[171 /* SyntaxKind.MethodDeclaration */] = function visitEachChildOfMethodDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMethodDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[173 /* SyntaxKind.Constructor */] = function visitEachChildOfConstructorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[174 /* SyntaxKind.GetAccessor */] = function visitEachChildOfGetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateGetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[175 /* SyntaxKind.SetAccessor */] = function visitEachChildOfSetAccessorDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSetAccessorDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[172 /* SyntaxKind.ClassStaticBlockDeclaration */] = function visitEachChildOfClassStaticBlockDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + context.startLexicalEnvironment(); + context.suspendLexicalEnvironment(); + return context.factory.updateClassStaticBlockDeclaration(node, visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[176 /* SyntaxKind.CallSignature */] = function visitEachChildOfCallSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[177 /* SyntaxKind.ConstructSignature */] = function visitEachChildOfConstructSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[178 /* SyntaxKind.IndexSignature */] = function visitEachChildOfIndexSignatureDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexSignature(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + // Types + _a[179 /* SyntaxKind.TypePredicate */] = function visitEachChildOfTypePredicateNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypePredicateNode(node, nodeVisitor(node.assertsModifier, visitor, ts.isAssertsKeyword), nodeVisitor(node.parameterName, visitor, ts.isIdentifierOrThisTypeNode), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[180 /* SyntaxKind.TypeReference */] = function visitEachChildOfTypeReferenceNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeReferenceNode(node, nodeVisitor(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[181 /* SyntaxKind.FunctionType */] = function visitEachChildOfFunctionTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[182 /* SyntaxKind.ConstructorType */] = function visitEachChildOfConstructorTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConstructorTypeNode(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[183 /* SyntaxKind.TypeQuery */] = function visitEachChildOfTypeQueryNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeQueryNode(node, nodeVisitor(node.exprName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[184 /* SyntaxKind.TypeLiteral */] = function visitEachChildOfTypeLiteralNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[185 /* SyntaxKind.ArrayType */] = function visitEachChildOfArrayTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayTypeNode(node, nodeVisitor(node.elementType, visitor, ts.isTypeNode)); + }, + _a[186 /* SyntaxKind.TupleType */] = function visitEachChildOfTupleTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateTupleTypeNode(node, nodesVisitor(node.elements, visitor, ts.isTypeNode)); + }, + _a[187 /* SyntaxKind.OptionalType */] = function visitEachChildOfOptionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateOptionalTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[188 /* SyntaxKind.RestType */] = function visitEachChildOfRestTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateRestTypeNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[189 /* SyntaxKind.UnionType */] = function visitEachChildOfUnionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[190 /* SyntaxKind.IntersectionType */] = function visitEachChildOfIntersectionTypeNode(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode)); + }, + _a[191 /* SyntaxKind.ConditionalType */] = function visitEachChildOfConditionalTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateConditionalTypeNode(node, nodeVisitor(node.checkType, visitor, ts.isTypeNode), nodeVisitor(node.extendsType, visitor, ts.isTypeNode), nodeVisitor(node.trueType, visitor, ts.isTypeNode), nodeVisitor(node.falseType, visitor, ts.isTypeNode)); + }, + _a[192 /* SyntaxKind.InferType */] = function visitEachChildOfInferTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInferTypeNode(node, nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration)); + }, + _a[202 /* SyntaxKind.ImportType */] = function visitEachChildOfImportTypeNode(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeNode(node, nodeVisitor(node.argument, visitor, ts.isTypeNode), nodeVisitor(node.assertions, visitor, ts.isImportTypeAssertionContainer), nodeVisitor(node.qualifier, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf); + }, + _a[298 /* SyntaxKind.ImportTypeAssertionContainer */] = function visitEachChildOfImportTypeAssertionContainer(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportTypeAssertionContainer(node, nodeVisitor(node.assertClause, visitor, ts.isAssertClause), node.multiLine); + }, + _a[199 /* SyntaxKind.NamedTupleMember */] = function visitEachChildOfNamedTupleMember(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateNamedTupleMember(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[193 /* SyntaxKind.ParenthesizedType */] = function visitEachChildOfParenthesizedType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedType(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[195 /* SyntaxKind.TypeOperator */] = function visitEachChildOfTypeOperatorNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOperatorNode(node, nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[196 /* SyntaxKind.IndexedAccessType */] = function visitEachChildOfIndexedAccessType(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIndexedAccessTypeNode(node, nodeVisitor(node.objectType, visitor, ts.isTypeNode), nodeVisitor(node.indexType, visitor, ts.isTypeNode)); + }, + _a[197 /* SyntaxKind.MappedType */] = function visitEachChildOfMappedType(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateMappedTypeNode(node, nodeVisitor(node.readonlyToken, tokenVisitor, ts.isReadonlyKeywordOrPlusOrMinusToken), nodeVisitor(node.typeParameter, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.nameType, visitor, ts.isTypeNode), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionOrPlusOrMinusToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[198 /* SyntaxKind.LiteralType */] = function visitEachChildOfLiteralTypeNode(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLiteralTypeNode(node, nodeVisitor(node.literal, visitor, ts.isExpression)); + }, + _a[200 /* SyntaxKind.TemplateLiteralType */] = function visitEachChildOfTemplateLiteralType(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralType(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateLiteralTypeSpan)); + }, + _a[201 /* SyntaxKind.TemplateLiteralTypeSpan */] = function visitEachChildOfTemplateLiteralTypeSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateLiteralTypeSpan(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Binding patterns + _a[203 /* SyntaxKind.ObjectBindingPattern */] = function visitEachChildOfObjectBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement)); + }, + _a[204 /* SyntaxKind.ArrayBindingPattern */] = function visitEachChildOfArrayBindingPattern(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement)); + }, + _a[205 /* SyntaxKind.BindingElement */] = function visitEachChildOfBindingElement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBindingElement(node, nodeVisitor(node.dotDotDotToken, tokenVisitor, ts.isDotDotDotToken), nodeVisitor(node.propertyName, visitor, ts.isPropertyName), nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Expression + _a[206 /* SyntaxKind.ArrayLiteralExpression */] = function visitEachChildOfArrayLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateArrayLiteralExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a[207 /* SyntaxKind.ObjectLiteralExpression */] = function visitEachChildOfObjectLiteralExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateObjectLiteralExpression(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike)); + }, + _a[208 /* SyntaxKind.PropertyAccessExpression */] = function visitEachChildOfPropertyAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isPropertyAccessChain(node) ? + context.factory.updatePropertyAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.name, visitor, ts.isMemberName)) : + context.factory.updatePropertyAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.name, visitor, ts.isMemberName)); + }, + _a[209 /* SyntaxKind.ElementAccessExpression */] = function visitEachChildOfElementAccessExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isElementAccessChain(node) ? + context.factory.updateElementAccessChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)) : + context.factory.updateElementAccessExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.argumentExpression, visitor, ts.isExpression)); + }, + _a[210 /* SyntaxKind.CallExpression */] = function visitEachChildOfCallExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return ts.isCallChain(node) ? + context.factory.updateCallChain(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.questionDotToken, tokenVisitor, ts.isQuestionDotToken), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)) : + context.factory.updateCallExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[211 /* SyntaxKind.NewExpression */] = function visitEachChildOfNewExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNewExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression)); + }, + _a[212 /* SyntaxKind.TaggedTemplateExpression */] = function visitEachChildOfTaggedTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTaggedTemplateExpression(node, nodeVisitor(node.tag, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.template, visitor, ts.isTemplateLiteral)); + }, + _a[213 /* SyntaxKind.TypeAssertionExpression */] = function visitEachChildOfTypeAssertionExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAssertion(node, nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[214 /* SyntaxKind.ParenthesizedExpression */] = function visitEachChildOfParenthesizedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateParenthesizedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[215 /* SyntaxKind.FunctionExpression */] = function visitEachChildOfFunctionExpression(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[216 /* SyntaxKind.ArrowFunction */] = function visitEachChildOfArrowFunction(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.equalsGreaterThanToken, tokenVisitor, ts.isEqualsGreaterThanToken), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[217 /* SyntaxKind.DeleteExpression */] = function visitEachChildOfDeleteExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDeleteExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[218 /* SyntaxKind.TypeOfExpression */] = function visitEachChildOfTypeOfExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeOfExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[219 /* SyntaxKind.VoidExpression */] = function visitEachChildOfVoidExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVoidExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[220 /* SyntaxKind.AwaitExpression */] = function visitEachChildOfAwaitExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAwaitExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[221 /* SyntaxKind.PrefixUnaryExpression */] = function visitEachChildOfPrefixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePrefixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[222 /* SyntaxKind.PostfixUnaryExpression */] = function visitEachChildOfPostfixUnaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePostfixUnaryExpression(node, nodeVisitor(node.operand, visitor, ts.isExpression)); + }, + _a[223 /* SyntaxKind.BinaryExpression */] = function visitEachChildOfBinaryExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateBinaryExpression(node, nodeVisitor(node.left, visitor, ts.isExpression), nodeVisitor(node.operatorToken, tokenVisitor, ts.isBinaryOperatorToken), nodeVisitor(node.right, visitor, ts.isExpression)); + }, + _a[224 /* SyntaxKind.ConditionalExpression */] = function visitEachChildOfConditionalExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateConditionalExpression(node, nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.questionToken, tokenVisitor, ts.isQuestionToken), nodeVisitor(node.whenTrue, visitor, ts.isExpression), nodeVisitor(node.colonToken, tokenVisitor, ts.isColonToken), nodeVisitor(node.whenFalse, visitor, ts.isExpression)); + }, + _a[225 /* SyntaxKind.TemplateExpression */] = function visitEachChildOfTemplateExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateExpression(node, nodeVisitor(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan)); + }, + _a[226 /* SyntaxKind.YieldExpression */] = function visitEachChildOfYieldExpression(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateYieldExpression(node, nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[227 /* SyntaxKind.SpreadElement */] = function visitEachChildOfSpreadElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadElement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[228 /* SyntaxKind.ClassExpression */] = function visitEachChildOfClassExpression(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[230 /* SyntaxKind.ExpressionWithTypeArguments */] = function visitEachChildOfExpressionWithTypeArguments(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionWithTypeArguments(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode)); + }, + _a[231 /* SyntaxKind.AsExpression */] = function visitEachChildOfAsExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAsExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[235 /* SyntaxKind.SatisfiesExpression */] = function visitEachChildOfSatisfiesExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSatisfiesExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[232 /* SyntaxKind.NonNullExpression */] = function visitEachChildOfNonNullExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return ts.isOptionalChain(node) ? + context.factory.updateNonNullChain(node, nodeVisitor(node.expression, visitor, ts.isExpression)) : + context.factory.updateNonNullExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[233 /* SyntaxKind.MetaProperty */] = function visitEachChildOfMetaProperty(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateMetaProperty(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Misc + _a[236 /* SyntaxKind.TemplateSpan */] = function visitEachChildOfTemplateSpan(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTemplateSpan(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail)); + }, + // Element + _a[238 /* SyntaxKind.Block */] = function visitEachChildOfBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[240 /* SyntaxKind.VariableStatement */] = function visitEachChildOfVariableStatement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.declarationList, visitor, ts.isVariableDeclarationList)); + }, + _a[241 /* SyntaxKind.ExpressionStatement */] = function visitEachChildOfExpressionStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExpressionStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[242 /* SyntaxKind.IfStatement */] = function visitEachChildOfIfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateIfStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.thenStatement, visitor, ts.isStatement, context.factory.liftToBlock), nodeVisitor(node.elseStatement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[243 /* SyntaxKind.DoStatement */] = function visitEachChildOfDoStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateDoStatement(node, visitIterationBody(node.statement, visitor, context, nodeVisitor), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[244 /* SyntaxKind.WhileStatement */] = function visitEachChildOfWhileStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWhileStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[245 /* SyntaxKind.ForStatement */] = function visitEachChildOfForStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.condition, visitor, ts.isExpression), nodeVisitor(node.incrementor, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[246 /* SyntaxKind.ForInStatement */] = function visitEachChildOfForInStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateForInStatement(node, nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[247 /* SyntaxKind.ForOfStatement */] = function visitEachChildOfForOfStatement(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateForOfStatement(node, nodeVisitor(node.awaitModifier, tokenVisitor, ts.isAwaitKeyword), nodeVisitor(node.initializer, visitor, ts.isForInitializer), nodeVisitor(node.expression, visitor, ts.isExpression), visitIterationBody(node.statement, visitor, context, nodeVisitor)); + }, + _a[248 /* SyntaxKind.ContinueStatement */] = function visitEachChildOfContinueStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateContinueStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[249 /* SyntaxKind.BreakStatement */] = function visitEachChildOfBreakStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateBreakStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier)); + }, + _a[250 /* SyntaxKind.ReturnStatement */] = function visitEachChildOfReturnStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateReturnStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[251 /* SyntaxKind.WithStatement */] = function visitEachChildOfWithStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateWithStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[252 /* SyntaxKind.SwitchStatement */] = function visitEachChildOfSwitchStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSwitchStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodeVisitor(node.caseBlock, visitor, ts.isCaseBlock)); + }, + _a[253 /* SyntaxKind.LabeledStatement */] = function visitEachChildOfLabeledStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateLabeledStatement(node, nodeVisitor(node.label, visitor, ts.isIdentifier), nodeVisitor(node.statement, visitor, ts.isStatement, context.factory.liftToBlock)); + }, + _a[254 /* SyntaxKind.ThrowStatement */] = function visitEachChildOfThrowStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateThrowStatement(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[255 /* SyntaxKind.TryStatement */] = function visitEachChildOfTryStatement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTryStatement(node, nodeVisitor(node.tryBlock, visitor, ts.isBlock), nodeVisitor(node.catchClause, visitor, ts.isCatchClause), nodeVisitor(node.finallyBlock, visitor, ts.isBlock)); + }, + _a[257 /* SyntaxKind.VariableDeclaration */] = function visitEachChildOfVariableDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateVariableDeclaration(node, nodeVisitor(node.name, visitor, ts.isBindingName), nodeVisitor(node.exclamationToken, tokenVisitor, ts.isExclamationToken), nodeVisitor(node.type, visitor, ts.isTypeNode), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[258 /* SyntaxKind.VariableDeclarationList */] = function visitEachChildOfVariableDeclarationList(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration)); + }, + _a[259 /* SyntaxKind.FunctionDeclaration */] = function visitEachChildOfFunctionDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, tokenVisitor) { + return context.factory.updateFunctionDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.asteriskToken, tokenVisitor, ts.isAsteriskToken), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), nodeVisitor(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context, nodeVisitor)); + }, + _a[260 /* SyntaxKind.ClassDeclaration */] = function visitEachChildOfClassDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateClassDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifierLike), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement)); + }, + _a[261 /* SyntaxKind.InterfaceDeclaration */] = function visitEachChildOfInterfaceDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateInterfaceDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement)); + }, + _a[262 /* SyntaxKind.TypeAliasDeclaration */] = function visitEachChildOfTypeAliasDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateTypeAliasDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodeVisitor(node.type, visitor, ts.isTypeNode)); + }, + _a[263 /* SyntaxKind.EnumDeclaration */] = function visitEachChildOfEnumDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember)); + }, + _a[264 /* SyntaxKind.ModuleDeclaration */] = function visitEachChildOfModuleDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.name, visitor, ts.isModuleName), nodeVisitor(node.body, visitor, ts.isModuleBody)); + }, + _a[265 /* SyntaxKind.ModuleBlock */] = function visitEachChildOfModuleBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[266 /* SyntaxKind.CaseBlock */] = function visitEachChildOfCaseBlock(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause)); + }, + _a[267 /* SyntaxKind.NamespaceExportDeclaration */] = function visitEachChildOfNamespaceExportDeclaration(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExportDeclaration(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[268 /* SyntaxKind.ImportEqualsDeclaration */] = function visitEachChildOfImportEqualsDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportEqualsDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.moduleReference, visitor, ts.isModuleReference)); + }, + _a[269 /* SyntaxKind.ImportDeclaration */] = function visitEachChildOfImportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.importClause, visitor, ts.isImportClause), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[296 /* SyntaxKind.AssertClause */] = function visitEachChildOfAssertClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertClause(node, nodesVisitor(node.elements, visitor, ts.isAssertEntry), node.multiLine); + }, + _a[297 /* SyntaxKind.AssertEntry */] = function visitEachChildOfAssertEntry(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateAssertEntry(node, nodeVisitor(node.name, visitor, ts.isAssertionKey), nodeVisitor(node.value, visitor, ts.isExpression)); + }, + _a[270 /* SyntaxKind.ImportClause */] = function visitEachChildOfImportClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportClause(node, node.isTypeOnly, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.namedBindings, visitor, ts.isNamedImportBindings)); + }, + _a[271 /* SyntaxKind.NamespaceImport */] = function visitEachChildOfNamespaceImport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceImport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[277 /* SyntaxKind.NamespaceExport */] = function visitEachChildOfNamespaceExport(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateNamespaceExport(node, nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[272 /* SyntaxKind.NamedImports */] = function visitEachChildOfNamedImports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier)); + }, + _a[273 /* SyntaxKind.ImportSpecifier */] = function visitEachChildOfImportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateImportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + _a[274 /* SyntaxKind.ExportAssignment */] = function visitEachChildOfExportAssignment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportAssignment(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[275 /* SyntaxKind.ExportDeclaration */] = function visitEachChildOfExportDeclaration(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportDeclaration(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), node.isTypeOnly, nodeVisitor(node.exportClause, visitor, ts.isNamedExportBindings), nodeVisitor(node.moduleSpecifier, visitor, ts.isExpression), nodeVisitor(node.assertClause, visitor, ts.isAssertClause)); + }, + _a[276 /* SyntaxKind.NamedExports */] = function visitEachChildOfNamedExports(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier)); + }, + _a[278 /* SyntaxKind.ExportSpecifier */] = function visitEachChildOfExportSpecifier(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExportSpecifier(node, node.isTypeOnly, nodeVisitor(node.propertyName, visitor, ts.isIdentifier), nodeVisitor(node.name, visitor, ts.isIdentifier)); + }, + // Module references + _a[280 /* SyntaxKind.ExternalModuleReference */] = function visitEachChildOfExternalModuleReference(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateExternalModuleReference(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // JSX + _a[281 /* SyntaxKind.JsxElement */] = function visitEachChildOfJsxElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxElement(node, nodeVisitor(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingElement, visitor, ts.isJsxClosingElement)); + }, + _a[282 /* SyntaxKind.JsxSelfClosingElement */] = function visitEachChildOfJsxSelfClosingElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSelfClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[283 /* SyntaxKind.JsxOpeningElement */] = function visitEachChildOfJsxOpeningElement(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxOpeningElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodeVisitor(node.attributes, visitor, ts.isJsxAttributes)); + }, + _a[284 /* SyntaxKind.JsxClosingElement */] = function visitEachChildOfJsxClosingElement(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxClosingElement(node, nodeVisitor(node.tagName, visitor, ts.isJsxTagNameExpression)); + }, + _a[285 /* SyntaxKind.JsxFragment */] = function visitEachChildOfJsxFragment(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxFragment(node, nodeVisitor(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), nodeVisitor(node.closingFragment, visitor, ts.isJsxClosingFragment)); + }, + _a[288 /* SyntaxKind.JsxAttribute */] = function visitEachChildOfJsxAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttribute(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.initializer, visitor, ts.isStringLiteralOrJsxExpression)); + }, + _a[289 /* SyntaxKind.JsxAttributes */] = function visitEachChildOfJsxAttributes(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike)); + }, + _a[290 /* SyntaxKind.JsxSpreadAttribute */] = function visitEachChildOfJsxSpreadAttribute(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxSpreadAttribute(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[291 /* SyntaxKind.JsxExpression */] = function visitEachChildOfJsxExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateJsxExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Clauses + _a[292 /* SyntaxKind.CaseClause */] = function visitEachChildOfCaseClause(node, visitor, context, nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCaseClause(node, nodeVisitor(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[293 /* SyntaxKind.DefaultClause */] = function visitEachChildOfDefaultClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement)); + }, + _a[294 /* SyntaxKind.HeritageClause */] = function visitEachChildOfHeritageClause(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments)); + }, + _a[295 /* SyntaxKind.CatchClause */] = function visitEachChildOfCatchClause(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateCatchClause(node, nodeVisitor(node.variableDeclaration, visitor, ts.isVariableDeclaration), nodeVisitor(node.block, visitor, ts.isBlock)); + }, + // Property assignments + _a[299 /* SyntaxKind.PropertyAssignment */] = function visitEachChildOfPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + _a[300 /* SyntaxKind.ShorthandPropertyAssignment */] = function visitEachChildOfShorthandPropertyAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateShorthandPropertyAssignment(node, nodeVisitor(node.name, visitor, ts.isIdentifier), nodeVisitor(node.objectAssignmentInitializer, visitor, ts.isExpression)); + }, + _a[301 /* SyntaxKind.SpreadAssignment */] = function visitEachChildOfSpreadAssignment(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateSpreadAssignment(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + // Enum + _a[302 /* SyntaxKind.EnumMember */] = function visitEachChildOfEnumMember(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updateEnumMember(node, nodeVisitor(node.name, visitor, ts.isPropertyName), nodeVisitor(node.initializer, visitor, ts.isExpression)); + }, + // Top-level nodes + _a[308 /* SyntaxKind.SourceFile */] = function visitEachChildOfSourceFile(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateSourceFile(node, visitLexicalEnvironment(node.statements, visitor, context, /*start*/ undefined, /*ensureUseStrict*/ undefined, nodesVisitor)); + }, + // Transformation nodes + _a[353 /* SyntaxKind.PartiallyEmittedExpression */] = function visitEachChildOfPartiallyEmittedExpression(node, visitor, context, _nodesVisitor, nodeVisitor, _tokenVisitor) { + return context.factory.updatePartiallyEmittedExpression(node, nodeVisitor(node.expression, visitor, ts.isExpression)); + }, + _a[354 /* SyntaxKind.CommaListExpression */] = function visitEachChildOfCommaListExpression(node, visitor, context, nodesVisitor, _nodeVisitor, _tokenVisitor) { + return context.factory.updateCommaListExpression(node, nodesVisitor(node.elements, visitor, ts.isExpression)); + }, + _a); /** * Extracts the single node from a NodeArray. * @@ -91120,7 +92031,7 @@ var ts; exit(); return sourceIndex; } - /* eslint-disable boolean-trivia, no-null/no-null */ + /* eslint-disable local/boolean-trivia, no-null/no-null */ function setSourceContent(sourceIndex, content) { enter(); if (content !== null) { @@ -91133,7 +92044,7 @@ var ts; } exit(); } - /* eslint-enable boolean-trivia, no-null/no-null */ + /* eslint-enable local/boolean-trivia, no-null/no-null */ function addName(name) { enter(); if (!nameToNameIndexMap) @@ -91735,7 +92646,7 @@ var ts; function chainBundle(context, transformSourceFile) { return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -91786,7 +92697,7 @@ var ts; for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) { var node = _a[_i]; switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: // import "mod" // import x from "mod" // import * as x from "mod" @@ -91799,13 +92710,13 @@ var ts; hasImportDefault = true; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - if (node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + if (node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // import x = require("mod") externalImports.push(node); } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.moduleSpecifier) { if (!node.exportClause) { // export * from "mod" @@ -91836,13 +92747,13 @@ var ts; addExportedNamesForExportDeclaration(node); } break; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals && !exportEquals) { // export = x exportEquals = node; } break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { for (var _b = 0, _c = node.declarationList.declarations; _b < _c.length; _b++) { var decl = _c[_b]; @@ -91850,9 +92761,9 @@ var ts; } } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default function() { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -91870,9 +92781,9 @@ var ts; } } break; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - if (ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)) { + if (ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)) { // export default class { } if (!hasExportDefault) { multiMapSparseArrayAdd(exportedBindings, getOriginalNodeId(node), context.factory.getDeclarationName(node)); @@ -92050,7 +92961,7 @@ var ts; * @param isStatic A value indicating whether the member should be a static or instance member. */ function isInitializedProperty(member) { - return member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + return member.kind === 169 /* SyntaxKind.PropertyDeclaration */ && member.initializer !== undefined; } ts.isInitializedProperty = isInitializedProperty; @@ -92060,7 +92971,7 @@ var ts; * @param member The class element node. */ function isNonStaticMethodOrAccessorWithPrivateName(member) { - return !ts.isStatic(member) && ts.isMethodOrAccessor(member) && ts.isPrivateIdentifier(member.name); + return !ts.isStatic(member) && (ts.isMethodOrAccessor(member) || ts.isAutoAccessorPropertyDeclaration(member)) && ts.isPrivateIdentifier(member.name); } ts.isNonStaticMethodOrAccessorWithPrivateName = isNonStaticMethodOrAccessorWithPrivateName; /** @@ -92114,12 +93025,12 @@ var ts; */ function getAllDecoratorsOfClassElement(member, parent) { switch (member.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return getAllDecoratorsOfAccessors(member, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return getAllDecoratorsOfMethod(member); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return getAllDecoratorsOfProperty(member); default: return undefined; @@ -92780,8 +93691,8 @@ var ts; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; // Enable substitution for property/element access to emit const enum values. - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // These variables contain state that changes as we descend into the tree. var currentSourceFile; var currentNamespace; @@ -92801,14 +93712,14 @@ var ts; var applicableSubstitutions; return transformSourceFileOrBundle; function transformSourceFileOrBundle(node) { - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { return transformBundle(node); } return transformSourceFile(node); } function transformBundle(node) { return factory.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { return ts.createUnparsedSourceFile(prepend, "js"); } return prepend; @@ -92857,15 +93768,15 @@ var ts; */ function onBeforeVisitNode(node) { switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: - case 263 /* SyntaxKind.CaseBlock */: - case 262 /* SyntaxKind.ModuleBlock */: - case 235 /* SyntaxKind.Block */: + case 308 /* SyntaxKind.SourceFile */: + case 266 /* SyntaxKind.CaseBlock */: + case 265 /* SyntaxKind.ModuleBlock */: + case 238 /* SyntaxKind.Block */: currentLexicalScope = node; currentScopeFirstDeclarationsOfName = undefined; break; - case 257 /* SyntaxKind.ClassDeclaration */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: if (ts.hasSyntacticModifier(node, 2 /* ModifierFlags.Ambient */)) { break; } @@ -92877,7 +93788,7 @@ var ts; // These nodes should always have names unless they are default-exports; // however, class declaration parsing allows for undefined names, so syntactically invalid // programs may also have an undefined name. - ts.Debug.assert(node.kind === 257 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */)); + ts.Debug.assert(node.kind === 260 /* SyntaxKind.ClassDeclaration */ || ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */)); } break; } @@ -92916,10 +93827,10 @@ var ts; */ function sourceElementVisitorWorker(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitElidableStatement(node); default: return visitorWorker(node); @@ -92940,13 +93851,13 @@ var ts; return node; } switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); default: ts.Debug.fail("Unhandled ellided statement"); @@ -92966,11 +93877,11 @@ var ts; * @param node The node to visit. */ function namespaceElementVisitorWorker(node) { - if (node.kind === 272 /* SyntaxKind.ExportDeclaration */ || - node.kind === 266 /* SyntaxKind.ImportDeclaration */ || - node.kind === 267 /* SyntaxKind.ImportClause */ || - (node.kind === 265 /* SyntaxKind.ImportEqualsDeclaration */ && - node.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */)) { + if (node.kind === 275 /* SyntaxKind.ExportDeclaration */ || + node.kind === 269 /* SyntaxKind.ImportDeclaration */ || + node.kind === 270 /* SyntaxKind.ImportClause */ || + (node.kind === 268 /* SyntaxKind.ImportEqualsDeclaration */ && + node.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */)) { // do not emit ES6 imports and exports since they are illegal inside a namespace return undefined; } @@ -92994,27 +93905,27 @@ var ts; */ function classElementVisitorWorker(node, parent) { switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructor(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Property declarations are not TypeScript syntax, but they must be visited // for the decorator transformation. return visitPropertyDeclaration(node, parent); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.visitEachChild(node, visitor, context); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return node; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Index signatures are elided return; default: @@ -93026,17 +93937,17 @@ var ts; } function objectLiteralElementVisitorWorker(node, parent) { switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 298 /* SyntaxKind.SpreadAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return visitor(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: // Get Accessors can have TypeScript modifiers, decorators, and type annotations. return visitGetAccessor(node, parent); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Set Accessors can have TypeScript modifiers and type annotations. return visitSetAccessor(node, parent); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: // TypeScript method declarations may have decorators, modifiers // or type annotations. return visitMethodDeclaration(node, parent); @@ -93047,7 +93958,7 @@ var ts; function modifierVisitor(node) { if (ts.isDecorator(node)) return undefined; - if (ts.modifierToFlag(node.kind) & 116958 /* ModifierFlags.TypeScriptModifier */) { + if (ts.modifierToFlag(node.kind) & 117086 /* ModifierFlags.TypeScriptModifier */) { return undefined; } else if (currentNamespace && node.kind === 93 /* SyntaxKind.ExportKeyword */) { @@ -93075,58 +93986,58 @@ var ts; case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 85 /* SyntaxKind.ConstKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: // TypeScript accessibility and readonly modifiers are elided // falls through - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: - case 185 /* SyntaxKind.OptionalType */: - case 186 /* SyntaxKind.RestType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 177 /* SyntaxKind.TypePredicate */: - case 163 /* SyntaxKind.TypeParameter */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 133 /* SyntaxKind.BooleanKeyword */: - case 150 /* SyntaxKind.StringKeyword */: - case 147 /* SyntaxKind.NumberKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: + case 187 /* SyntaxKind.OptionalType */: + case 188 /* SyntaxKind.RestType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 179 /* SyntaxKind.TypePredicate */: + case 165 /* SyntaxKind.TypeParameter */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: + case 152 /* SyntaxKind.StringKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: case 114 /* SyntaxKind.VoidKeyword */: - case 151 /* SyntaxKind.SymbolKeyword */: - case 180 /* SyntaxKind.ConstructorType */: - case 179 /* SyntaxKind.FunctionType */: - case 181 /* SyntaxKind.TypeQuery */: - case 178 /* SyntaxKind.TypeReference */: - case 187 /* SyntaxKind.UnionType */: - case 188 /* SyntaxKind.IntersectionType */: - case 189 /* SyntaxKind.ConditionalType */: - case 191 /* SyntaxKind.ParenthesizedType */: - case 192 /* SyntaxKind.ThisType */: - case 193 /* SyntaxKind.TypeOperator */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 196 /* SyntaxKind.LiteralType */: + case 153 /* SyntaxKind.SymbolKeyword */: + case 182 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 183 /* SyntaxKind.TypeQuery */: + case 180 /* SyntaxKind.TypeReference */: + case 189 /* SyntaxKind.UnionType */: + case 190 /* SyntaxKind.IntersectionType */: + case 191 /* SyntaxKind.ConditionalType */: + case 193 /* SyntaxKind.ParenthesizedType */: + case 194 /* SyntaxKind.ThisType */: + case 195 /* SyntaxKind.TypeOperator */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 198 /* SyntaxKind.LiteralType */: // TypeScript type nodes are elided. // falls through - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // TypeScript index signatures are elided. return undefined; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: // TypeScript type-only declarations are elided. return factory.createNotEmittedStatement(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: // TypeScript namespace export declarations are elided. return undefined; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: // TypeScript interfaces are elided, but some comments may be preserved. // See the implementation of `getLeadingComments` in comments.ts for more details. return factory.createNotEmittedStatement(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: // This may be a class declaration with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93136,7 +94047,7 @@ var ts; // - index signatures // - method overload signatures return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: // This may be a class expression with TypeScript syntax extensions. // // TypeScript class syntax extensions include: @@ -93146,34 +94057,34 @@ var ts; // - index signatures // - method overload signatures return visitClassExpression(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: // This may be a heritage clause with TypeScript syntax extensions. // // TypeScript heritage clause extensions include: // - `implements` clause return visitHeritageClause(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: // TypeScript supports type arguments on an expression in an `extends` heritage clause. return visitExpressionWithTypeArguments(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 171 /* SyntaxKind.Constructor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return ts.Debug.fail("Class and object literal elements must be visited with their respective visitors"); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: // Typescript function declarations can have modifiers, decorators, and type annotations. return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: // TypeScript function expressions can have modifiers and type annotations. return visitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: // TypeScript arrow functions can have modifiers and type annotations. return visitArrowFunction(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // This may be a parameter declaration with TypeScript syntax extensions. // // TypeScript parameter declaration syntax extensions include: @@ -93183,40 +94094,42 @@ var ts; // - type annotations // - this parameters return visitParameter(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: // ParenthesizedExpressions are TypeScript if their expression is a // TypeAssertion or AsExpression return visitParenthesizedExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: - case 229 /* SyntaxKind.AsExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: + case 231 /* SyntaxKind.AsExpression */: // TypeScript type assertions are removed, but their subtrees are preserved. return visitAssertionExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return visitSatisfiesExpression(node); + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: // TypeScript non-null expressions are removed, but their subtrees are preserved. return visitNonNullExpression(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: // TypeScript enum declarations do not exist in ES6 and must be rewritten. return visitEnumDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // TypeScript namespace exports for variable statements must be transformed. return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: // TypeScript namespace declarations must be transformed. return visitModuleDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // TypeScript namespace or external module import. return visitImportEqualsDeclaration(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node); - case 280 /* SyntaxKind.JsxOpeningElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: return visitJsxJsxOpeningElement(node); default: // node contains some other TypeScript syntax @@ -93486,10 +94399,10 @@ var ts; */ function shouldAddTypeMetadata(node) { var kind = node.kind; - return kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */ - || kind === 167 /* SyntaxKind.PropertyDeclaration */; + return kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */ + || kind === 169 /* SyntaxKind.PropertyDeclaration */; } /** * Determines whether to emit the "design:returntype" metadata based on the node's kind. @@ -93499,7 +94412,7 @@ var ts; * @param node The node to test. */ function shouldAddReturnTypeMetadata(node) { - return node.kind === 169 /* SyntaxKind.MethodDeclaration */; + return node.kind === 171 /* SyntaxKind.MethodDeclaration */; } /** * Determines whether to emit the "design:paramtypes" metadata based on the node's kind. @@ -93510,12 +94423,12 @@ var ts; */ function shouldAddParamTypesMetadata(node) { switch (node.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return ts.getFirstConstructorWithBody(node) !== undefined; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return true; } return false; @@ -93605,7 +94518,7 @@ var ts; return !ts.nodeIsMissing(node.body); } function visitPropertyDeclaration(node, parent) { - var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */); + var isAmbient = node.flags & 16777216 /* NodeFlags.Ambient */ || ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */); if (isAmbient && !ts.hasDecorators(node)) { return undefined; } @@ -93713,7 +94626,7 @@ var ts; * @param node The declaration node. */ function shouldEmitAccessorDeclaration(node) { - return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 128 /* ModifierFlags.Abstract */)); + return !(ts.nodeIsMissing(node.body) && ts.hasSyntacticModifier(node, 256 /* ModifierFlags.Abstract */)); } function visitGetAccessor(node, parent) { if (!(node.transformFlags & 1 /* TransformFlags.ContainsTypeScript */)) { @@ -93855,6 +94768,10 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isLeftHandSideExpression); return factory.createPartiallyEmittedExpression(expression, node); } + function visitSatisfiesExpression(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); + return factory.createPartiallyEmittedExpression(expression, node); + } function visitCallExpression(node) { return factory.updateCallExpression(node, ts.visitNode(node.expression, visitor, ts.isExpression), /*typeArguments*/ undefined, ts.visitNodes(node.arguments, visitor, ts.isExpression)); @@ -94068,12 +94985,12 @@ var ts; // enums in any other scope are emitted as a `let` declaration. var statement = factory.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), factory.createVariableDeclarationList([ factory.createVariableDeclaration(factory.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true)) - ], currentLexicalScope.kind === 305 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); + ], currentLexicalScope.kind === 308 /* SyntaxKind.SourceFile */ ? 0 /* NodeFlags.None */ : 1 /* NodeFlags.Let */)); ts.setOriginalNode(statement, node); recordEmittedDeclarationInScope(node); if (isFirstEmittedDeclarationInScope(node)) { // Adjust the source map emit to match the old emitter. - if (node.kind === 260 /* SyntaxKind.EnumDeclaration */) { + if (node.kind === 263 /* SyntaxKind.EnumDeclaration */) { ts.setSourceMapRange(statement.declarationList, node); } else { @@ -94198,7 +95115,7 @@ var ts; var statementsLocation; var blockLocation; if (node.body) { - if (node.body.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (node.body.kind === 265 /* SyntaxKind.ModuleBlock */) { saveStateAndInvoke(node.body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); }); statementsLocation = node.body.statements; blockLocation = node.body; @@ -94245,13 +95162,13 @@ var ts; // })(hi = hello.hi || (hello.hi = {})); // })(hello || (hello = {})); // We only want to emit comment on the namespace which contains block body itself, not the containing namespaces. - if (!node.body || node.body.kind !== 262 /* SyntaxKind.ModuleBlock */) { + if (!node.body || node.body.kind !== 265 /* SyntaxKind.ModuleBlock */) { ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* EmitFlags.NoComments */); } return block; } function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) { - if (moduleDeclaration.body.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (moduleDeclaration.body.kind === 264 /* SyntaxKind.ModuleDeclaration */) { var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body); return recursiveInnerModule || moduleDeclaration.body; } @@ -94298,7 +95215,7 @@ var ts; * @param node The named import bindings node. */ function visitNamedImportBindings(node) { - if (node.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (node.kind === 271 /* SyntaxKind.NamespaceImport */) { // Elide a namespace import if it is not referenced. return shouldEmitAliasDeclaration(node) ? node : undefined; } @@ -94456,7 +95373,7 @@ var ts; */ function isNamedExternalModuleExport(node) { return isExternalModuleExport(node) - && !ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && !ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } /** * Gets a value indicating whether the node is the default export of an external module. @@ -94465,7 +95382,7 @@ var ts; */ function isDefaultExternalModuleExport(node) { return isExternalModuleExport(node) - && ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */); + && ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */); } function addExportMemberAssignment(statements, node) { var expression = factory.createAssignment(factory.getExternalModuleOrNamespaceExportName(currentNamespaceContainerName, node, /*allowComments*/ false, /*allowSourceMaps*/ true), factory.getLocalName(node)); @@ -94510,16 +95427,16 @@ var ts; // We need to enable substitutions for identifiers and shorthand property assignments. This allows us to // substitute the names of exported members of a namespace. context.enableSubstitution(79 /* SyntaxKind.Identifier */); - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // We need to be notified when entering and exiting namespaces. - context.enableEmitNotification(261 /* SyntaxKind.ModuleDeclaration */); + context.enableEmitNotification(264 /* SyntaxKind.ModuleDeclaration */); } } function isTransformedModuleDeclaration(node) { - return ts.getOriginalNode(node).kind === 261 /* SyntaxKind.ModuleDeclaration */; + return ts.getOriginalNode(node).kind === 264 /* SyntaxKind.ModuleDeclaration */; } function isTransformedEnumDeclaration(node) { - return ts.getOriginalNode(node).kind === 260 /* SyntaxKind.EnumDeclaration */; + return ts.getOriginalNode(node).kind === 263 /* SyntaxKind.EnumDeclaration */; } /** * Hook for node emit. @@ -94580,9 +95497,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); } return node; @@ -94597,9 +95514,9 @@ var ts; // If we are nested within a namespace declaration, we may need to qualifiy // an identifier that is exported from a merged namespace. var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false); - if (container && container.kind !== 305 /* SyntaxKind.SourceFile */) { - var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 261 /* SyntaxKind.ModuleDeclaration */) || - (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 260 /* SyntaxKind.EnumDeclaration */); + if (container && container.kind !== 308 /* SyntaxKind.SourceFile */) { + var substitute = (applicableSubstitutions & 2 /* TypeScriptSubstitutionFlags.NamespaceExports */ && container.kind === 264 /* SyntaxKind.ModuleDeclaration */) || + (applicableSubstitutions & 8 /* TypeScriptSubstitutionFlags.NonQualifiedEnumMembers */ && container.kind === 263 /* SyntaxKind.EnumDeclaration */); if (substitute) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.getGeneratedNameForNode(container), node), /*location*/ node); @@ -94638,9 +95555,10 @@ var ts; return ts.isPropertyAccessExpression(node) || ts.isElementAccessExpression(node) ? resolver.getConstantValue(node) : undefined; } function shouldEmitAliasDeclaration(node) { - return compilerOptions.preserveValueImports - ? resolver.isValueAliasDeclaration(node) - : resolver.isReferencedAliasDeclaration(node); + return ts.isInJSFile(node) || + (compilerOptions.preserveValueImports + ? resolver.isValueAliasDeclaration(node) + : resolver.isReferencedAliasDeclaration(node)); } } ts.transformTypeScript = transformTypeScript; @@ -94688,13 +95606,24 @@ var ts; var compilerOptions = context.getCompilerOptions(); var languageVersion = ts.getEmitScriptTarget(compilerOptions); var useDefineForClassFields = ts.getUseDefineForClassFields(compilerOptions); + // Always transform field initializers using Set semantics when `useDefineForClassFields: false`. + var shouldTransformInitializersUsingSet = !useDefineForClassFields; + // Transform field initializers using Define semantics when `useDefineForClassFields: true` and target < ES2022. + var shouldTransformInitializersUsingDefine = useDefineForClassFields && languageVersion < 9 /* ScriptTarget.ES2022 */; + var shouldTransformInitializers = shouldTransformInitializersUsingSet || shouldTransformInitializersUsingDefine; + // We need to transform private members and class static blocks when target < ES2022. var shouldTransformPrivateElementsOrClassStaticBlocks = languageVersion < 9 /* ScriptTarget.ES2022 */; + // We need to transform `accessor` fields when target < ESNext + var shouldTransformAutoAccessors = languageVersion < 99 /* ScriptTarget.ESNext */; // We need to transform `this` in a static initializer into a reference to the class - // when targeting < ES2022 since the assignment will be moved outside of the class body. + // when target < ES2022 since the assignment will be moved outside of the class body. var shouldTransformThisInStaticInitializers = languageVersion < 9 /* ScriptTarget.ES2022 */; - // We don't need to transform `super` property access when targeting ES5, ES3 because + // We don't need to transform `super` property access when target <= ES5 because // the es2015 transformation handles those. var shouldTransformSuperInStaticInitializers = shouldTransformThisInStaticInitializers && languageVersion >= 2 /* ScriptTarget.ES2015 */; + var shouldTransformAnything = shouldTransformInitializers || + shouldTransformPrivateElementsOrClassStaticBlocks || + shouldTransformAutoAccessors; var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; var previousOnEmitNode = context.onEmitNode; @@ -94714,98 +95643,149 @@ var ts; var classLexicalEnvironmentStack = []; var classLexicalEnvironmentMap = new ts.Map(); var currentClassLexicalEnvironment; + var currentClassContainer; var currentComputedPropertyNameClassLexicalEnvironment; var currentStaticPropertyDeclarationOrStaticBlock; return ts.chainBundle(context, transformSourceFile); function transformSourceFile(node) { - var options = context.getCompilerOptions(); - if (node.isDeclarationFile - || useDefineForClassFields && ts.getEmitScriptTarget(options) >= 9 /* ScriptTarget.ES2022 */) { + if (node.isDeclarationFile || !shouldTransformAnything) { return node; } var visited = ts.visitEachChild(node, visitor, context); ts.addEmitHelpers(visited, context.readEmitHelpers()); return visited; } - function visitorWorker(node, valueIsDiscarded) { - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) { - switch (node.kind) { - case 226 /* SyntaxKind.ClassExpression */: - case 257 /* SyntaxKind.ClassDeclaration */: - return visitClassLike(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: - return visitVariableStatement(node); - case 80 /* SyntaxKind.PrivateIdentifier */: - return visitPrivateIdentifier(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: - return visitClassStaticBlockDeclaration(node); - } + function visitor(node) { + if (!(node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */) && + !(node.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */)) { + return node; } - if (node.transformFlags & 16777216 /* TransformFlags.ContainsClassFields */ || - node.transformFlags & 134217728 /* TransformFlags.ContainsLexicalSuper */ && - shouldTransformSuperInStaticInitializers && - currentStaticPropertyDeclarationOrStaticBlock && - currentClassLexicalEnvironment) { - switch (node.kind) { - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: - return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: - return visitBinaryExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: - return visitCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: - return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: - return visitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: - return visitElementAccessExpression(node); - case 238 /* SyntaxKind.ExpressionStatement */: - return visitExpressionStatement(node); - case 242 /* SyntaxKind.ForStatement */: - return visitForStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: { - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = undefined; - var result = ts.visitEachChild(node, visitor, context); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; - return result; - } + switch (node.kind) { + case 127 /* SyntaxKind.AccessorKeyword */: + return shouldTransformAutoAccessors ? undefined : node; + case 260 /* SyntaxKind.ClassDeclaration */: + return visitClassDeclaration(node); + case 228 /* SyntaxKind.ClassExpression */: + return visitClassExpression(node); + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: + return visitClassStaticBlockDeclaration(node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return visitPropertyDeclaration(node); + case 240 /* SyntaxKind.VariableStatement */: + return visitVariableStatement(node); + case 80 /* SyntaxKind.PrivateIdentifier */: + return visitPrivateIdentifier(node); + case 208 /* SyntaxKind.PropertyAccessExpression */: + return visitPropertyAccessExpression(node); + case 209 /* SyntaxKind.ElementAccessExpression */: + return visitElementAccessExpression(node); + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ false); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ false); + case 210 /* SyntaxKind.CallExpression */: + return visitCallExpression(node); + case 241 /* SyntaxKind.ExpressionStatement */: + return visitExpressionStatement(node); + case 212 /* SyntaxKind.TaggedTemplateExpression */: + return visitTaggedTemplateExpression(node); + case 245 /* SyntaxKind.ForStatement */: + return visitForStatement(node); + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: { + // If we are descending into a new scope, clear the current static property or block + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, fallbackVisitor, node); } + default: + return fallbackVisitor(node); } + } + function fallbackVisitor(node) { return ts.visitEachChild(node, visitor, context); } + /** + * Visits a node in an expression whose result is discarded. + */ function discardedValueVisitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ true); - } - function visitor(node) { - return visitorWorker(node, /*valueIsDiscarded*/ false); + switch (node.kind) { + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: + return visitPreOrPostfixUnaryExpression(node, /*valueIsDiscarded*/ true); + case 223 /* SyntaxKind.BinaryExpression */: + return visitBinaryExpression(node, /*valueIsDiscarded*/ true); + default: + return visitor(node); + } } + /** + * Visits a node in a {@link HeritageClause}. + */ function heritageClauseVisitor(node) { switch (node.kind) { - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return ts.visitEachChild(node, heritageClauseVisitor, context); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - return visitExpressionWithTypeArguments(node); + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + return visitExpressionWithTypeArgumentsInHeritageClause(node); + default: + return visitor(node); } - return visitor(node); } - function visitorDestructuringTarget(node) { + /** + * Visits the assignment target of a destructuring assignment. + */ + function assignmentTargetVisitor(node) { switch (node.kind) { - case 205 /* SyntaxKind.ObjectLiteralExpression */: - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitAssignmentPattern(node); default: return visitor(node); } } + /** + * Visits a member of a class. + */ + function classElementVisitor(node) { + switch (node.kind) { + case 173 /* SyntaxKind.Constructor */: + return visitConstructorDeclaration(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitMethodOrAccessorDeclaration, node); + case 169 /* SyntaxKind.PropertyDeclaration */: + return setCurrentStaticPropertyDeclarationOrStaticBlockAnd( + /*current*/ undefined, visitPropertyDeclaration, node); + case 164 /* SyntaxKind.ComputedPropertyName */: + return visitComputedPropertyName(node); + case 237 /* SyntaxKind.SemicolonClassElement */: + return node; + default: + return visitor(node); + } + } + /** + * Visits the results of an auto-accessor field transformation in a second pass. + */ + function accessorFieldResultVisitor(node) { + switch (node.kind) { + case 169 /* SyntaxKind.PropertyDeclaration */: + return transformFieldInitializer(node); + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return classElementVisitor(node); + default: + ts.Debug.assertMissingNode(node, "Expected node to either be a PropertyDeclaration, GetAccessorDeclaration, or SetAccessorDeclaration"); + break; + } + } /** * If we visit a private name, this means it is an undeclared private name. * Replace it with an empty identifier to indicate a problem with the code, @@ -94821,17 +95801,15 @@ var ts; } return ts.setOriginalNode(factory.createIdentifier(""), node); } + function isPrivateIdentifierInExpression(node) { + return ts.isPrivateIdentifier(node.left) + && node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */; + } /** * Visits `#id in expr` */ - function visitPrivateIdentifierInInExpression(node) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return node; - } - var privId = node.left; - ts.Debug.assertNode(privId, ts.isPrivateIdentifier); - ts.Debug.assert(node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */); - var info = accessPrivateIdentifier(privId); + function transformPrivateIdentifierInInExpression(node) { + var info = accessPrivateIdentifier(node.left); if (info) { var receiver = ts.visitNode(node.right, visitor, ts.isExpression); return ts.setOriginalNode(context.getEmitHelperFactory().createClassPrivateFieldInHelper(info.brandCheckIdentifier, receiver), node); @@ -94839,31 +95817,6 @@ var ts; // Private name has not been declared. Subsequent transformers will handle this error return ts.visitEachChild(node, visitor, context); } - /** - * Visits the members of a class that has fields. - * - * @param node The node to visit. - */ - function classElementVisitor(node) { - switch (node.kind) { - case 171 /* SyntaxKind.Constructor */: - // Constructors for classes using class fields are transformed in - // `visitClassDeclaration` or `visitClassExpression`. - return undefined; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - return visitMethodOrAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: - return visitPropertyDeclaration(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return visitComputedPropertyName(node); - case 234 /* SyntaxKind.SemicolonClassElement */: - return node; - default: - return visitor(node); - } - } function visitVariableStatement(node) { var savedPendingStatements = pendingStatements; pendingStatements = []; @@ -94873,15 +95826,24 @@ var ts; pendingStatements = savedPendingStatements; return statement; } - function visitComputedPropertyName(name) { - var node = ts.visitEachChild(name, visitor, context); + function visitComputedPropertyName(node) { + var expression = ts.visitNode(node.expression, visitor, ts.isExpression); if (ts.some(pendingExpressions)) { - var expressions = pendingExpressions; - expressions.push(node.expression); - pendingExpressions = []; - node = factory.updateComputedPropertyName(node, factory.inlineExpressions(expressions)); + if (ts.isParenthesizedExpression(expression)) { + expression = factory.updateParenthesizedExpression(expression, factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression.expression], false))); + } + else { + expression = factory.inlineExpressions(__spreadArray(__spreadArray([], pendingExpressions, true), [expression], false)); + } + pendingExpressions = undefined; } - return node; + return factory.updateComputedPropertyName(node, expression); + } + function visitConstructorDeclaration(node) { + if (currentClassContainer) { + return transformConstructor(node, currentClassContainer); + } + return fallbackVisitor(node); } function visitMethodOrAccessorDeclaration(node) { ts.Debug.assert(!ts.hasDecorators(node)); @@ -94896,13 +95858,20 @@ var ts; } var functionName = getHoistedFunctionName(node); if (functionName) { - getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m); }), node.asteriskToken, functionName, - /* typeParameters */ undefined, ts.visitParameterList(node.parameters, classElementVisitor, context), - /* type */ undefined, ts.visitFunctionBody(node.body, classElementVisitor, context)))); + getPendingExpressions().push(factory.createAssignment(functionName, factory.createFunctionExpression(ts.filter(node.modifiers, function (m) { return ts.isModifier(m) && !ts.isStaticModifier(m) && !ts.isAccessorModifier(m); }), node.asteriskToken, functionName, + /* typeParameters */ undefined, ts.visitParameterList(node.parameters, visitor, context), + /* type */ undefined, ts.visitFunctionBody(node.body, visitor, context)))); } // remove method declaration from class return undefined; } + function setCurrentStaticPropertyDeclarationOrStaticBlockAnd(current, visitor, arg) { + var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; + currentStaticPropertyDeclarationOrStaticBlock = current; + var result = visitor(arg); + currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; + return result; + } function getHoistedFunctionName(node) { ts.Debug.assert(ts.isPrivateIdentifier(node.name)); var info = accessPrivateIdentifier(node.name); @@ -94919,49 +95888,104 @@ var ts; } } } - function visitPropertyDeclaration(node) { - ts.Debug.assert(!ts.hasDecorators(node)); - if (ts.isPrivateIdentifier(node.name)) { - if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - if (ts.isStatic(node)) { - // static fields are left as is - return ts.visitEachChild(node, visitor, context); - } - // Initializer is elided as the field is initialized in transformConstructor. - return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*questionOrExclamationToken*/ undefined, - /*type*/ undefined, - /*initializer*/ undefined); - } - // leave invalid code untransformed + function transformAutoAccessor(node) { + // transforms: + // accessor x = 1; + // into: + // #x = 1; + // get x() { return this.#x; } + // set x(value) { this.#x = value; } + ts.Debug.assertEachNode(node.modifiers, ts.isModifier); + var commentRange = ts.getCommentRange(node); + var sourceMapRange = ts.getSourceMapRange(node); + // Since we're creating two declarations where there was previously one, cache + // the expression for any computed property names. + var name = node.name; + var getterName = name; + var setterName = name; + if (ts.isComputedPropertyName(name) && !ts.isSimpleInlineableExpression(name.expression)) { + var temp = factory.createTempVariable(hoistVariableDeclaration); + ts.setSourceMapRange(temp, name.expression); + var expression = ts.visitNode(name.expression, visitor, ts.isExpression); + var assignment = factory.createAssignment(temp, expression); + ts.setSourceMapRange(assignment, name.expression); + getterName = factory.updateComputedPropertyName(name, factory.inlineExpressions([assignment, temp])); + setterName = factory.updateComputedPropertyName(name, temp); + } + var backingField = ts.createAccessorPropertyBackingField(factory, node, node.modifiers, node.initializer); + ts.setOriginalNode(backingField, node); + ts.setEmitFlags(backingField, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(backingField, sourceMapRange); + var getter = ts.createAccessorPropertyGetRedirector(factory, node, node.modifiers, getterName); + ts.setOriginalNode(getter, node); + ts.setCommentRange(getter, commentRange); + ts.setSourceMapRange(getter, sourceMapRange); + var setter = ts.createAccessorPropertySetRedirector(factory, node, node.modifiers, setterName); + ts.setOriginalNode(setter, node); + ts.setEmitFlags(setter, 1536 /* EmitFlags.NoComments */); + ts.setSourceMapRange(setter, sourceMapRange); + return ts.visitArray([backingField, getter, setter], accessorFieldResultVisitor, ts.isClassElement); + } + function transformPrivateFieldInitializer(node) { + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + // If we are transforming private elements into WeakMap/WeakSet, we should elide the node. var info = accessPrivateIdentifier(node.name); ts.Debug.assert(info, "Undeclared private name for property declaration."); - if (!info.isValid) { - return node; - } - } - // Create a temporary variable to store a computed property name (if necessary). - // If it's not inlineable, then we emit an expression after the class which assigns - // the property name to the temporary variable. - var expr = getPropertyNameExpressionIfNeeded(node.name, !!node.initializer || useDefineForClassFields); - if (expr && !ts.isSimpleInlineableExpression(expr)) { - getPendingExpressions().push(expr); + // Leave invalid code untransformed; otherwise, elide the node as it is transformed elsewhere. + return info.isValid ? undefined : node; + } + if (shouldTransformInitializersUsingSet && !ts.isStatic(node)) { + // If we are transforming initializers using Set semantics we will elide the initializer as it will + // be moved to the constructor to preserve evaluation order next to public instance fields. We don't + // need to do this transformation for private static fields since public static fields can be + // transformed into `static {}` blocks. + return factory.updatePropertyDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, + /*questionOrExclamationToken*/ undefined, + /*type*/ undefined, + /*initializer*/ undefined); } - if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks && !useDefineForClassFields) { - var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); - if (initializerStatement) { - var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); - ts.setOriginalNode(staticBlock, node); - ts.setCommentRange(staticBlock, node); - // Set the comment range for the statement to an empty synthetic range - // and drop synthetic comments from the statement to avoid printing them twice. - ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); - ts.setSyntheticLeadingComments(initializerStatement, undefined); - ts.setSyntheticTrailingComments(initializerStatement, undefined); - return staticBlock; + return ts.visitEachChild(node, visitor, context); + } + function transformPublicFieldInitializer(node) { + if (shouldTransformInitializers) { + // Create a temporary variable to store a computed property name (if necessary). + // If it's not inlineable, then we emit an expression after the class which assigns + // the property name to the temporary variable. + var expr = getPropertyNameExpressionIfNeeded(node.name, /*shouldHoist*/ !!node.initializer || useDefineForClassFields); + if (expr) { + getPendingExpressions().push(expr); + } + if (ts.isStatic(node) && !shouldTransformPrivateElementsOrClassStaticBlocks) { + var initializerStatement = transformPropertyOrClassStaticBlock(node, factory.createThis()); + if (initializerStatement) { + var staticBlock = factory.createClassStaticBlockDeclaration(factory.createBlock([initializerStatement])); + ts.setOriginalNode(staticBlock, node); + ts.setCommentRange(staticBlock, node); + // Set the comment range for the statement to an empty synthetic range + // and drop synthetic comments from the statement to avoid printing them twice. + ts.setCommentRange(initializerStatement, { pos: -1, end: -1 }); + ts.setSyntheticLeadingComments(initializerStatement, undefined); + ts.setSyntheticTrailingComments(initializerStatement, undefined); + return staticBlock; + } } + return undefined; } - return undefined; + return ts.visitEachChild(node, classElementVisitor, context); + } + function transformFieldInitializer(node) { + ts.Debug.assert(!ts.hasDecorators(node), "Decorators should already have been transformed and elided."); + return ts.isPrivateIdentifierClassElementDeclaration(node) ? + transformPrivateFieldInitializer(node) : + transformPublicFieldInitializer(node); + } + function visitPropertyDeclaration(node) { + // If this is an auto-accessor, we defer to `transformAutoAccessor`. That function + // will in turn call `transformFieldInitializer` as needed. + if (shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(node)) { + return transformAutoAccessor(node); + } + return transformFieldInitializer(node); } function createPrivateIdentifierAccess(info, receiver) { return createPrivateIdentifierAccessHelper(info, ts.visitNode(receiver, visitor, ts.isExpression)); @@ -95025,9 +96049,11 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitPreOrPostfixUnaryExpression(node, valueIsDiscarded) { - if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || node.operator === 46 /* SyntaxKind.MinusMinusToken */) { + if (node.operator === 45 /* SyntaxKind.PlusPlusToken */ || + node.operator === 46 /* SyntaxKind.MinusMinusToken */) { var operand = ts.skipParentheses(node.operand); - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(operand)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(operand)) { var info = void 0; if (info = accessPrivateIdentifier(operand.name)) { var receiver = ts.visitNode(operand.expression, visitor, ts.isExpression); @@ -95116,7 +96142,9 @@ var ts; return { readExpression: readExpression, initializeExpression: initializeExpression }; } function visitCallExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.expression)) { + // obj.#x() // Transform call expressions of private names to properly bind the `this` parameter. var _a = factory.createCallBinding(node.expression, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; if (ts.isCallChain(node)) { @@ -95131,6 +96159,8 @@ var ts; ts.isSuperProperty(node.expression) && currentStaticPropertyDeclarationOrStaticBlock && (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.classConstructor)) { + // super.x() + // super[x]() // converts `super.f(...)` into `Reflect.get(_baseTemp, "f", _classTemp).call(_classTemp, ...)` var invocation = factory.createFunctionCallCall(ts.visitNode(node.expression, visitor, ts.isExpression), currentClassLexicalEnvironment.classConstructor, ts.visitNodes(node.arguments, visitor, ts.isExpression)); ts.setOriginalNode(invocation, node); @@ -95140,7 +96170,8 @@ var ts; return ts.visitEachChild(node, visitor, context); } function visitTaggedTemplateExpression(node) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.tag)) { // Bind the `this` correctly for tagged template literals when the tag is a private identifier property access. var _a = factory.createCallBinding(node.tag, hoistVariableDeclaration, languageVersion), thisArg = _a.thisArg, target = _a.target; return factory.updateTaggedTemplateExpression(node, factory.createCallExpression(factory.createPropertyAccessExpression(ts.visitNode(target, visitor), "bind"), @@ -95166,11 +96197,8 @@ var ts; classLexicalEnvironmentMap.set(ts.getOriginalNodeId(node), currentClassLexicalEnvironment); } startLexicalEnvironment(); - var savedCurrentStaticPropertyDeclarationOrStaticBlock = currentStaticPropertyDeclarationOrStaticBlock; - currentStaticPropertyDeclarationOrStaticBlock = node; - var statements = ts.visitNodes(node.body.statements, visitor, ts.isStatement); + var statements = setCurrentStaticPropertyDeclarationOrStaticBlockAnd(node, function (statements) { return ts.visitNodes(statements, visitor, ts.isStatement); }, node.body.statements); statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); - currentStaticPropertyDeclarationOrStaticBlock = savedCurrentStaticPropertyDeclarationOrStaticBlock; var iife = factory.createImmediatelyInvokedArrowFunction(statements); ts.setOriginalNode(iife, node); ts.setTextRange(iife, node); @@ -95180,9 +96208,12 @@ var ts; } function visitBinaryExpression(node, valueIsDiscarded) { if (ts.isDestructuringAssignment(node)) { + // ({ x: obj.#x } = ...) + // ({ x: super.x } = ...) + // ({ x: super[x] } = ...) var savedPendingExpressions = pendingExpressions; pendingExpressions = undefined; - node = factory.updateBinaryExpression(node, ts.visitNode(node.left, visitorDestructuringTarget), node.operatorToken, ts.visitNode(node.right, visitor)); + node = factory.updateBinaryExpression(node, ts.visitNode(node.left, assignmentTargetVisitor), node.operatorToken, ts.visitNode(node.right, visitor)); var expr = ts.some(pendingExpressions) ? factory.inlineExpressions(ts.compact(__spreadArray(__spreadArray([], pendingExpressions, true), [node], false))) : node; @@ -95190,7 +96221,9 @@ var ts; return expr; } if (ts.isAssignmentExpression(node)) { - if (shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + if (shouldTransformPrivateElementsOrClassStaticBlocks && + ts.isPrivateIdentifierPropertyAccessExpression(node.left)) { + // obj.#x = ... var info = accessPrivateIdentifier(node.left.name); if (info) { return ts.setTextRange(ts.setOriginalNode(createPrivateIdentifierAssignment(info, node.left.expression, node.right, node.operatorToken.kind), node), node); @@ -95200,6 +96233,10 @@ var ts; ts.isSuperProperty(node.left) && currentStaticPropertyDeclarationOrStaticBlock && currentClassLexicalEnvironment) { + // super.x = ... + // super[x] = ... + // super.x += ... + // super.x -= ... var classConstructor = currentClassLexicalEnvironment.classConstructor, superClassReference = currentClassLexicalEnvironment.superClassReference, facts = currentClassLexicalEnvironment.facts; if (facts & 1 /* ClassFacts.ClassWasDecorated */) { return factory.updateBinaryExpression(node, visitInvalidSuperProperty(node.left), node.operatorToken, ts.visitNode(node.right, visitor, ts.isExpression)); @@ -95243,8 +96280,10 @@ var ts; } } } - if (node.operatorToken.kind === 101 /* SyntaxKind.InKeyword */ && ts.isPrivateIdentifier(node.left)) { - return visitPrivateIdentifierInInExpression(node); + if (shouldTransformPrivateElementsOrClassStaticBlocks && + isPrivateIdentifierInExpression(node)) { + // #x in obj + return transformPrivateIdentifierInInExpression(node); } return ts.visitEachChild(node, visitor, context); } @@ -95269,36 +96308,6 @@ var ts; ts.Debug.assertNever(info, "Unknown private element type"); } } - /** - * Set up the environment for a class. - */ - function visitClassLike(node) { - if (!ts.forEach(node.members, doesClassElementNeedTransform)) { - return ts.visitEachChild(node, visitor, context); - } - var savedPendingExpressions = pendingExpressions; - pendingExpressions = undefined; - startClassLexicalEnvironment(); - if (shouldTransformPrivateElementsOrClassStaticBlocks) { - var name = ts.getNameOfDeclaration(node); - if (name && ts.isIdentifier(name)) { - getPrivateIdentifierEnvironment().className = ts.idText(name); - } - var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); - if (ts.some(privateInstanceMethodsAndAccessors)) { - getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); - } - } - var result = ts.isClassDeclaration(node) ? - visitClassDeclaration(node) : - visitClassExpression(node); - endClassLexicalEnvironment(); - pendingExpressions = savedPendingExpressions; - return result; - } - function doesClassElementNeedTransform(node) { - return ts.isPropertyDeclaration(node) || ts.isClassStaticBlockDeclaration(node) || (shouldTransformPrivateElementsOrClassStaticBlocks && node.name && ts.isPrivateIdentifier(node.name)); - } function getPrivateInstanceMethodsAndAccessors(node) { return ts.filter(node.members, ts.isNonStaticMethodOrAccessorWithPrivateName); } @@ -95312,7 +96321,7 @@ var ts; var member = _a[_i]; if (!ts.isStatic(member)) continue; - if (member.name && ts.isPrivateIdentifier(member.name) && shouldTransformPrivateElementsOrClassStaticBlocks) { + if (member.name && (ts.isPrivateIdentifier(member.name) || ts.isAutoAccessorPropertyDeclaration(member)) && shouldTransformPrivateElementsOrClassStaticBlocks) { facts |= 2 /* ClassFacts.NeedsClassConstructorReference */; } if (ts.isPropertyDeclaration(member) || ts.isClassStaticBlockDeclaration(member)) { @@ -95331,7 +96340,7 @@ var ts; } return facts; } - function visitExpressionWithTypeArguments(node) { + function visitExpressionWithTypeArgumentsInHeritageClause(node) { var facts = (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.facts) || 0 /* ClassFacts.None */; if (facts & 4 /* ClassFacts.NeedsClassSuperReference */) { var temp = factory.createTempVariable(hoistVariableDeclaration, /*reserveInNestedScopes*/ true); @@ -95341,7 +96350,22 @@ var ts; } return ts.visitEachChild(node, visitor, context); } - function visitClassDeclaration(node) { + function visitInNewClassLexicalEnvironment(node, visitor) { + var savedCurrentClassContainer = currentClassContainer; + var savedPendingExpressions = pendingExpressions; + currentClassContainer = node; + pendingExpressions = undefined; + startClassLexicalEnvironment(); + if (shouldTransformPrivateElementsOrClassStaticBlocks) { + var name = ts.getNameOfDeclaration(node); + if (name && ts.isIdentifier(name)) { + getPrivateIdentifierEnvironment().className = name; + } + var privateInstanceMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); + if (ts.some(privateInstanceMethodsAndAccessors)) { + getPrivateIdentifierEnvironment().weakSetName = createHoistedVariableForClass("instances", privateInstanceMethodsAndAccessors[0].name); + } + } var facts = getClassFacts(node); if (facts) { getClassLexicalEnvironment().facts = facts; @@ -95349,6 +96373,16 @@ var ts; if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { enableSubstitutionForClassStaticThisOrSuperReference(); } + var result = visitor(node, facts); + endClassLexicalEnvironment(); + currentClassContainer = savedCurrentClassContainer; + pendingExpressions = savedPendingExpressions; + return result; + } + function visitClassDeclaration(node) { + return visitInNewClassLexicalEnvironment(node, visitClassDeclarationInNewClassLexicalEnvironment); + } + function visitClassDeclarationInNewClassLexicalEnvironment(node, facts) { // If a class has private static fields, or a static field has a `this` or `super` reference, // then we need to allocate a temp variable to hold on to that reference. var pendingClassReferenceAssignment; @@ -95357,12 +96391,16 @@ var ts; getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); pendingClassReferenceAssignment = factory.createAssignment(temp, factory.getInternalName(node)); } - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); - var statements = [ - factory.updateClassDeclaration(node, node.modifiers, node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)) - ]; + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classDecl = factory.updateClassDeclaration(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var statements = []; + if (prologue) { + statements.push(factory.createExpressionStatement(prologue)); + } + statements.push(classDecl); if (pendingClassReferenceAssignment) { getPendingExpressions().unshift(pendingClassReferenceAssignment); } @@ -95370,25 +96408,23 @@ var ts; if (ts.some(pendingExpressions)) { statements.push(factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions))); } - // Emit static property assignment. Because classDeclaration is lexically evaluated, - // it is safe to emit static property assignment after classDeclaration - // From ES6 specification: - // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using - // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. - var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); - if (ts.some(staticProperties)) { - addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + if (shouldTransformInitializersUsingSet || shouldTransformPrivateElementsOrClassStaticBlocks) { + // Emit static property assignment. Because classDeclaration is lexically evaluated, + // it is safe to emit static property assignment after classDeclaration + // From ES6 specification: + // HasLexicalDeclaration (N) : Determines if the argument identifier has a binding in this environment record that was created using + // a lexical declaration such as a LexicalDeclaration or a ClassDeclaration. + var staticProperties = ts.getStaticPropertiesAndClassStaticBlock(node); + if (ts.some(staticProperties)) { + addPropertyOrClassStaticBlockStatements(statements, staticProperties, factory.getInternalName(node)); + } } return statements; } function visitClassExpression(node) { - var facts = getClassFacts(node); - if (facts) { - getClassLexicalEnvironment().facts = facts; - } - if (facts & 8 /* ClassFacts.NeedsSubstitutionForThisInClassStaticField */) { - enableSubstitutionForClassStaticThisOrSuperReference(); - } + return visitInNewClassLexicalEnvironment(node, visitClassExpressionInNewClassLexicalEnvironment); + } + function visitClassExpressionInNewClassLexicalEnvironment(node, facts) { // If this class expression is a transformation of a decorated class declaration, // then we want to output the pendingExpressions as statements, not as inlined // expressions with the class statement. @@ -95398,8 +96434,6 @@ var ts; // these statements after the class expression variable statement. var isDecoratedClassDeclaration = !!(facts & 1 /* ClassFacts.ClassWasDecorated */); var staticPropertiesOrClassStaticBlocks = ts.getStaticPropertiesAndClassStaticBlock(node); - var extendsClauseElement = ts.getEffectiveBaseTypeNode(node); - var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var isClassWithConstructorReference = resolver.getNodeCheckFlags(node) & 16777216 /* NodeCheckFlags.ClassWithConstructorReference */; var temp; function createClassTempVar() { @@ -95412,9 +96446,23 @@ var ts; temp = createClassTempVar(); getClassLexicalEnvironment().classConstructor = factory.cloneNode(temp); } - var classExpression = factory.updateClassExpression(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, - /*typeParameters*/ undefined, ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause), transformClassMembers(node, isDerivedClass)); - var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(staticPropertiesOrClassStaticBlocks, function (p) { return ts.isClassStaticBlockDeclaration(p) || !!p.initializer || ts.isPrivateIdentifier(p.name); }); + var modifiers = ts.visitNodes(node.modifiers, visitor, ts.isModifierLike); + var heritageClauses = ts.visitNodes(node.heritageClauses, heritageClauseVisitor, ts.isHeritageClause); + var _a = transformClassMembers(node), members = _a.members, prologue = _a.prologue; + var classExpression = factory.updateClassExpression(node, modifiers, node.name, + /*typeParameters*/ undefined, heritageClauses, members); + var expressions = []; + if (prologue) { + expressions.push(prologue); + } + // Static initializers are transformed to `static {}` blocks when `useDefineForClassFields: false` + // and not also transforming static blocks. + var hasTransformableStatics = shouldTransformPrivateElementsOrClassStaticBlocks && + ts.some(staticPropertiesOrClassStaticBlocks, function (node) { + return ts.isClassStaticBlockDeclaration(node) || + ts.isPrivateIdentifierClassElementDeclaration(node) || + shouldTransformInitializers && ts.isInitializedProperty(node); + }); if (hasTransformableStatics || ts.some(pendingExpressions)) { if (isDecoratedClassDeclaration) { ts.Debug.assertIsDefined(pendingStatements, "Decorated classes transformed by TypeScript are expected to be within a variable declaration."); @@ -95426,12 +96474,16 @@ var ts; addPropertyOrClassStaticBlockStatements(pendingStatements, staticPropertiesOrClassStaticBlocks, factory.getInternalName(node)); } if (temp) { - return factory.inlineExpressions([factory.createAssignment(temp, classExpression), temp]); + expressions.push(ts.startOnNewLine(factory.createAssignment(temp, classExpression)), ts.startOnNewLine(temp)); + } + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } } - return classExpression; } else { - var expressions = []; temp || (temp = createClassTempVar()); if (isClassWithConstructorReference) { // record an alias as the class name is not in scope for statics. @@ -95448,45 +96500,87 @@ var ts; ts.addRange(expressions, ts.map(pendingExpressions, ts.startOnNewLine)); ts.addRange(expressions, generateInitializedPropertyExpressionsOrClassStaticBlock(staticPropertiesOrClassStaticBlocks, temp)); expressions.push(ts.startOnNewLine(temp)); - return factory.inlineExpressions(expressions); } } - return classExpression; + else { + expressions.push(classExpression); + if (prologue) { + ts.startOnNewLine(classExpression); + } + } + return factory.inlineExpressions(expressions); } function visitClassStaticBlockDeclaration(node) { if (!shouldTransformPrivateElementsOrClassStaticBlocks) { - return ts.visitEachChild(node, classElementVisitor, context); + return ts.visitEachChild(node, visitor, context); } // ClassStaticBlockDeclaration for classes are transformed in `visitClassDeclaration` or `visitClassExpression`. return undefined; } - function transformClassMembers(node, isDerivedClass) { - var members = []; + function transformClassMembers(node) { + // Declare private names if (shouldTransformPrivateElementsOrClassStaticBlocks) { - // Declare private names. for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; if (ts.isPrivateIdentifierClassElementDeclaration(member)) { - addPrivateIdentifierToEnvironment(member); + addPrivateIdentifierToEnvironment(member, member.name, addPrivateIdentifierClassElementToEnvironment); } } if (ts.some(getPrivateInstanceMethodsAndAccessors(node))) { createBrandCheckWeakSetForPrivateMethods(); } + if (shouldTransformAutoAccessors) { + for (var _b = 0, _c = node.members; _b < _c.length; _b++) { + var member = _c[_b]; + if (ts.isAutoAccessorPropertyDeclaration(member)) { + var storageName = factory.getGeneratedPrivateNameForNode(member.name, /*prefix*/ undefined, "_accessor_storage"); + addPrivateIdentifierToEnvironment(member, storageName, addPrivateIdentifierPropertyDeclarationToEnvironment); + } + } + } } - var constructor = transformConstructor(node, isDerivedClass); - var visitedMembers = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); - if (constructor) { - members.push(constructor); + var members = ts.visitNodes(node.members, classElementVisitor, ts.isClassElement); + // Create a synthetic constructor if necessary + var syntheticConstructor; + if (!ts.some(members, ts.isConstructorDeclaration)) { + syntheticConstructor = transformConstructor(/*constructor*/ undefined, node); } + var prologue; + // If there are pending expressions create a class static block in which to evaluate them, but only if + // class static blocks are not also being transformed. This block will be injected at the top of the class + // to ensure that expressions from computed property names are evaluated before any other static + // initializers. + var syntheticStaticBlock; if (!shouldTransformPrivateElementsOrClassStaticBlocks && ts.some(pendingExpressions)) { - members.push(factory.createClassStaticBlockDeclaration(factory.createBlock([ - factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)) - ]))); + var statement = factory.createExpressionStatement(factory.inlineExpressions(pendingExpressions)); + if (statement.transformFlags & 134234112 /* TransformFlags.ContainsLexicalThisOrSuper */) { + // If there are `this` or `super` references from computed property names, shift the expression + // into an arrow function to be evaluated in the outer scope so that `this` and `super` are + // properly captured. + var temp = factory.createTempVariable(hoistVariableDeclaration); + var arrow = factory.createArrowFunction( + /*modifiers*/ undefined, + /*typeParameters*/ undefined, + /*parameters*/ [], + /*type*/ undefined, + /*equalsGreaterThanToken*/ undefined, factory.createBlock([statement])); + prologue = factory.createAssignment(temp, arrow); + statement = factory.createExpressionStatement(factory.createCallExpression(temp, /*typeArguments*/ undefined, [])); + } + var block = factory.createBlock([statement]); + syntheticStaticBlock = factory.createClassStaticBlockDeclaration(block); pendingExpressions = undefined; } - ts.addRange(members, visitedMembers); - return ts.setTextRange(factory.createNodeArray(members), /*location*/ node.members); + // If we created a synthetic constructor or class static block, add them to the visited members + // and return a new array. + if (syntheticConstructor || syntheticStaticBlock) { + var membersArray = void 0; + membersArray = ts.append(membersArray, syntheticConstructor); + membersArray = ts.append(membersArray, syntheticStaticBlock); + membersArray = ts.addRange(membersArray, members); + members = ts.setTextRange(factory.createNodeArray(membersArray), /*location*/ node.members); + } + return { members: members, prologue: prologue }; } function createBrandCheckWeakSetForPrivateMethods() { var weakSetName = getPrivateIdentifierEnvironment().weakSetName; @@ -95495,35 +96589,38 @@ var ts; /*typeArguments*/ undefined, []))); } function isClassElementThatRequiresConstructorStatement(member) { - if (ts.isStatic(member) || ts.hasSyntacticModifier(ts.getOriginalNode(member), 128 /* ModifierFlags.Abstract */)) { + if (ts.isStatic(member) || ts.hasAbstractModifier(ts.getOriginalNode(member))) { return false; } - if (useDefineForClassFields) { - // If we are using define semantics and targeting ESNext or higher, - // then we don't need to transform any class properties. - return languageVersion < 9 /* ScriptTarget.ES2022 */; - } - return ts.isInitializedProperty(member) || shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member); + return shouldTransformInitializersUsingDefine && ts.isPropertyDeclaration(member) || + shouldTransformInitializersUsingSet && ts.isInitializedProperty(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && ts.isPrivateIdentifierClassElementDeclaration(member) || + shouldTransformPrivateElementsOrClassStaticBlocks && shouldTransformAutoAccessors && ts.isAutoAccessorPropertyDeclaration(member); } - function transformConstructor(node, isDerivedClass) { - var constructor = ts.visitNode(ts.getFirstConstructorWithBody(node), visitor, ts.isConstructorDeclaration); - var elements = node.members.filter(isClassElementThatRequiresConstructorStatement); - if (!ts.some(elements)) { + function transformConstructor(constructor, container) { + constructor = ts.visitNode(constructor, visitor, ts.isConstructorDeclaration); + if (!ts.some(container.members, isClassElementThatRequiresConstructorStatement)) { return constructor; } + var extendsClauseElement = ts.getEffectiveBaseTypeNode(container); + var isDerivedClass = !!(extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 104 /* SyntaxKind.NullKeyword */); var parameters = ts.visitParameterList(constructor ? constructor.parameters : undefined, visitor, context); - var body = transformConstructorBody(node, constructor, isDerivedClass); + var body = transformConstructorBody(container, constructor, isDerivedClass); if (!body) { - return undefined; + return constructor; + } + if (constructor) { + ts.Debug.assert(parameters); + return factory.updateConstructorDeclaration(constructor, /*modifiers*/ undefined, parameters, body); } return ts.startOnNewLine(ts.setOriginalNode(ts.setTextRange(factory.createConstructorDeclaration( - /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || node), constructor)); + /*modifiers*/ undefined, parameters !== null && parameters !== void 0 ? parameters : [], body), constructor || container), constructor)); } function transformConstructorBody(node, constructor, isDerivedClass) { - var _a; + var _a, _b; var properties = ts.getProperties(node, /*requireInitializer*/ false, /*isStatic*/ false); if (!useDefineForClassFields) { - properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name); }); + properties = ts.filter(properties, function (property) { return !!property.initializer || ts.isPrivateIdentifier(property.name) || ts.hasAccessorModifier(property); }); } var privateMethodsAndAccessors = getPrivateInstanceMethodsAndAccessors(node); var needsConstructorBody = ts.some(properties) || ts.some(privateMethodsAndAccessors); @@ -95575,8 +96672,8 @@ var ts; statements = statements.filter(function (statement) { return !ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor); }); } else { - for (var _i = 0, _b = constructor.body.statements; _i < _b.length; _i++) { - var statement = _b[_i]; + for (var _i = 0, _c = constructor.body.statements; _i < _c.length; _i++) { + var statement = _c[_i]; if (ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { parameterPropertyDeclarationCount++; } @@ -95608,9 +96705,14 @@ var ts; ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitBodyStatement, ts.isStatement, indexOfFirstStatementAfterSuperAndPrologue)); } statements = factory.mergeLexicalEnvironment(statements, endLexicalEnvironment()); + if (statements.length === 0 && !constructor) { + return undefined; + } + var multiLine = (constructor === null || constructor === void 0 ? void 0 : constructor.body) && constructor.body.statements.length >= statements.length ? + (_b = constructor.body.multiLine) !== null && _b !== void 0 ? _b : statements.length > 0 : + statements.length > 0; return ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), - /*location*/ constructor ? constructor.body.statements : node.members), - /*multiLine*/ true), + /*location*/ constructor ? constructor.body.statements : node.members), multiLine), /*location*/ constructor ? constructor.body : undefined); function visitBodyStatement(statement) { if (useDefineForClassFields && ts.isParameterPropertyDeclaration(ts.getOriginalNode(statement), constructor)) { @@ -95646,9 +96748,10 @@ var ts; return undefined; } var statement = factory.createExpressionStatement(expression); + ts.setOriginalNode(statement, property); + ts.addEmitFlags(statement, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property)); ts.setCommentRange(statement, property); - ts.setOriginalNode(statement, property); // `setOriginalNode` *copies* the `emitNode` from `property`, so now both // `statement` and `expression` have a copy of the synthesized comments. // Drop the comments from expression to avoid printing them twice. @@ -95671,9 +96774,10 @@ var ts; continue; } ts.startOnNewLine(expression); + ts.setOriginalNode(expression, property); + ts.addEmitFlags(expression, ts.getEmitFlags(property) & 1536 /* EmitFlags.NoComments */); ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property)); ts.setCommentRange(expression, property); - ts.setOriginalNode(expression, property); expressions.push(expression); } return expressions; @@ -95700,9 +96804,11 @@ var ts; var _a; // We generate a name here in order to reuse the value cached by the relocated computed name expression (which uses the same generated name) var emitAssignment = !useDefineForClassFields; - var propertyName = ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) - ? factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) - : property.name; + var propertyName = ts.hasAccessorModifier(property) ? + factory.getGeneratedPrivateNameForNode(property.name) : + ts.isComputedPropertyName(property.name) && !ts.isSimpleInlineableExpression(property.name.expression) ? + factory.updateComputedPropertyName(property.name, factory.getGeneratedNameForNode(property.name)) : + property.name; if (ts.hasStaticModifier(property)) { currentStaticPropertyDeclarationOrStaticBlock = property; } @@ -95729,7 +96835,7 @@ var ts; return undefined; } var propertyOriginalNode = ts.getOriginalNode(property); - if (ts.hasSyntacticModifier(propertyOriginalNode, 128 /* ModifierFlags.Abstract */)) { + if (ts.hasSyntacticModifier(propertyOriginalNode, 256 /* ModifierFlags.Abstract */)) { return undefined; } var initializer = property.initializer || emitAssignment ? (_a = ts.visitNode(property.initializer, visitor, ts.isExpression)) !== null && _a !== void 0 ? _a : factory.createVoidZero() @@ -95763,17 +96869,17 @@ var ts; // substitute `this` in a static field initializer context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); // these push a new lexical environment that is not the class lexical environment - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // these push a new lexical environment that is not the class lexical environment, except // when they have a computed property name - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(167 /* SyntaxKind.PropertyDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(169 /* SyntaxKind.PropertyDeclaration */); // class lexical environments are restored when entering a computed property name - context.enableEmitNotification(162 /* SyntaxKind.ComputedPropertyName */); + context.enableEmitNotification(164 /* SyntaxKind.ComputedPropertyName */); } } /** @@ -95812,13 +96918,13 @@ var ts; } } switch (node.kind) { - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: if (ts.isArrowFunction(original) || ts.getEmitFlags(node) & 262144 /* EmitFlags.AsyncFunctionBody */) { break; } // falls through - case 256 /* SyntaxKind.FunctionDeclaration */: - case 171 /* SyntaxKind.Constructor */: { + case 259 /* SyntaxKind.FunctionDeclaration */: + case 173 /* SyntaxKind.Constructor */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = undefined; @@ -95828,10 +96934,10 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 167 /* SyntaxKind.PropertyDeclaration */: { + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentComputedPropertyNameClassLexicalEnvironment = currentClassLexicalEnvironment; @@ -95841,7 +96947,7 @@ var ts; currentComputedPropertyNameClassLexicalEnvironment = savedCurrentComputedPropertyNameClassLexicalEnvironment; return; } - case 162 /* SyntaxKind.ComputedPropertyName */: { + case 164 /* SyntaxKind.ComputedPropertyName */: { var savedClassLexicalEnvironment = currentClassLexicalEnvironment; var savedCurrentComputedPropertyNameClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; currentClassLexicalEnvironment = currentComputedPropertyNameClassLexicalEnvironment; @@ -95955,149 +97061,138 @@ var ts; function getPrivateIdentifierEnvironment() { var lex = getClassLexicalEnvironment(); lex.privateIdentifierEnvironment || (lex.privateIdentifierEnvironment = { - className: "", - identifiers: new ts.Map() + className: undefined, + weakSetName: undefined, + identifiers: undefined, + generatedIdentifiers: undefined, }); return lex.privateIdentifierEnvironment; } function getPendingExpressions() { - return pendingExpressions || (pendingExpressions = []); + return pendingExpressions !== null && pendingExpressions !== void 0 ? pendingExpressions : (pendingExpressions = []); } - function addPrivateIdentifierToEnvironment(node) { - var _a; - var text = ts.getTextOfPropertyName(node.name); - var lex = getClassLexicalEnvironment(); - var classConstructor = lex.classConstructor; - var privateEnv = getPrivateIdentifierEnvironment(); - var weakSetName = privateEnv.weakSetName; - var assignmentExpressions = []; - var privateName = node.name.escapedText; - var previousInfo = privateEnv.identifiers.get(privateName); - var isValid = !isReservedPrivateName(node.name) && previousInfo === undefined; - if (ts.hasStaticModifier(node)) { - ts.Debug.assert(classConstructor, "weakSetName should be set in private identifier environment"); - if (ts.isPropertyDeclaration(node)) { - var variableName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "f" /* PrivateIdentifierKind.Field */, - variableName: variableName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isMethodDeclaration(node)) { - var functionName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: functionName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - else if (ts.isGetAccessorDeclaration(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else if (ts.isSetAccessorDeclaration(node)) { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: classConstructor, - isStatic: true, - isValid: isValid, - }); - } - } - else { - ts.Debug.assertNever(node, "Unknown class element type."); - } + function addPrivateIdentifierClassElementToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + if (ts.isAutoAccessorPropertyDeclaration(node)) { + addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); } else if (ts.isPropertyDeclaration(node)) { - var weakMapName = createHoistedVariableForPrivateName(text, node); - privateEnv.identifiers.set(privateName, { + addPrivateIdentifierPropertyDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isMethodDeclaration(node)) { + addPrivateIdentifierMethodDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isGetAccessorDeclaration(node)) { + addPrivateIdentifierGetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + else if (ts.isSetAccessorDeclaration(node)) { + addPrivateIdentifierSetAccessorDeclarationToEnvironment(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + } + function addPrivateIdentifierPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + if (isStatic) { + ts.Debug.assert(lex.classConstructor, "classConstructor should be set in private identifier environment"); + var variableName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { + kind: "f" /* PrivateIdentifierKind.Field */, + brandCheckIdentifier: lex.classConstructor, + variableName: variableName, + isStatic: true, + isValid: isValid, + }); + } + else { + var weakMapName = createHoistedVariableForPrivateName(name); + setPrivateIdentifier(privateEnv, name, { kind: "f" /* PrivateIdentifierKind.Field */, brandCheckIdentifier: weakMapName, - isStatic: false, variableName: undefined, + isStatic: false, isValid: isValid, }); - assignmentExpressions.push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), + getPendingExpressions().push(factory.createAssignment(weakMapName, factory.createNewExpression(factory.createIdentifier("WeakMap"), /*typeArguments*/ undefined, []))); } - else if (ts.isMethodDeclaration(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - privateEnv.identifiers.set(privateName, { - kind: "m" /* PrivateIdentifierKind.Method */, - methodName: createHoistedVariableForPrivateName(text, node), - brandCheckIdentifier: weakSetName, - isStatic: false, + } + function addPrivateIdentifierMethodDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var methodName = createHoistedVariableForPrivateName(name); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "m" /* PrivateIdentifierKind.Method */, + methodName: methodName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierGetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.getterName) { + previousInfo.getterName = getterName; + } + else { + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: undefined, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, isValid: isValid, }); } - else if (ts.isAccessor(node)) { - ts.Debug.assert(weakSetName, "weakSetName should be set in private identifier environment"); - if (ts.isGetAccessor(node)) { - var getterName = createHoistedVariableForPrivateName(text + "_get", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.getterName) { - previousInfo.getterName = getterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: getterName, - setterName: undefined, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } - else { - var setterName = createHoistedVariableForPrivateName(text + "_set", node); - if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && !previousInfo.isStatic && !previousInfo.setterName) { - previousInfo.setterName = setterName; - } - else { - privateEnv.identifiers.set(privateName, { - kind: "a" /* PrivateIdentifierKind.Accessor */, - getterName: undefined, - setterName: setterName, - brandCheckIdentifier: weakSetName, - isStatic: false, - isValid: isValid, - }); - } - } + } + function addPrivateIdentifierSetAccessorDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, previousInfo) { + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + if ((previousInfo === null || previousInfo === void 0 ? void 0 : previousInfo.kind) === "a" /* PrivateIdentifierKind.Accessor */ && previousInfo.isStatic === isStatic && !previousInfo.setterName) { + previousInfo.setterName = setterName; } else { - ts.Debug.assertNever(node, "Unknown class element type."); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: undefined, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); } - (_a = getPendingExpressions()).push.apply(_a, assignmentExpressions); } - function createHoistedVariableForClass(name, node) { + function addPrivateIdentifierAutoAccessorPropertyDeclarationToEnvironment(_node, name, lex, privateEnv, isStatic, isValid, _previousInfo) { + var getterName = createHoistedVariableForPrivateName(name, "_get"); + var setterName = createHoistedVariableForPrivateName(name, "_set"); + var brandCheckIdentifier = isStatic ? + ts.Debug.checkDefined(lex.classConstructor, "classConstructor should be set in private identifier environment") : + ts.Debug.checkDefined(privateEnv.weakSetName, "weakSetName should be set in private identifier environment"); + setPrivateIdentifier(privateEnv, name, { + kind: "a" /* PrivateIdentifierKind.Accessor */, + getterName: getterName, + setterName: setterName, + brandCheckIdentifier: brandCheckIdentifier, + isStatic: isStatic, + isValid: isValid, + }); + } + function addPrivateIdentifierToEnvironment(node, name, addDeclaration) { + var lex = getClassLexicalEnvironment(); + var privateEnv = getPrivateIdentifierEnvironment(); + var previousInfo = getPrivateIdentifier(privateEnv, name); + var isStatic = ts.hasStaticModifier(node); + var isValid = !isReservedPrivateName(name) && previousInfo === undefined; + addDeclaration(node, name, lex, privateEnv, isStatic, isValid, previousInfo); + } + function createHoistedVariableForClass(name, node, suffix) { var className = getPrivateIdentifierEnvironment().className; - var prefix = className ? "_".concat(className) : ""; - var identifier = factory.createUniqueName("".concat(prefix, "_").concat(name), 16 /* GeneratedIdentifierFlags.Optimistic */); + var prefix = className ? { prefix: "_", node: className, suffix: "_" } : "_"; + var identifier = typeof name === "object" ? factory.getGeneratedNameForNode(name, 16 /* GeneratedIdentifierFlags.Optimistic */ | 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */, prefix, suffix) : + typeof name === "string" ? factory.createUniqueName(name, 16 /* GeneratedIdentifierFlags.Optimistic */, prefix, suffix) : + factory.createTempVariable(/*recordTempVariable*/ undefined, /*reserveInNestedScopes*/ true, prefix, suffix); if (resolver.getNodeCheckFlags(node) & 524288 /* NodeCheckFlags.BlockScopedBindingInLoop */) { addBlockScopedVariable(identifier); } @@ -96106,13 +97201,33 @@ var ts; } return identifier; } - function createHoistedVariableForPrivateName(privateName, node) { - return createHoistedVariableForClass(privateName.substring(1), node.name); + function createHoistedVariableForPrivateName(name, suffix) { + var _a; + var text = ts.tryGetTextOfPropertyName(name); + return createHoistedVariableForClass((_a = text === null || text === void 0 ? void 0 : text.substring(1)) !== null && _a !== void 0 ? _a : name, name, suffix); } + /** + * Access an already defined {@link PrivateIdentifier} in the current {@link PrivateIdentifierEnvironment}. + * + * @seealso {@link addPrivateIdentifierToEnvironment} + */ function accessPrivateIdentifier(name) { - var _a; + if (ts.isGeneratedPrivateIdentifier(name)) { + return accessGeneratedPrivateIdentifier(name); + } + else { + return accessPrivateIdentifierByText(name.escapedText); + } + } + function accessPrivateIdentifierByText(text) { + return accessPrivateIdentifierWorker(getPrivateIdentifierInfo, text); + } + function accessGeneratedPrivateIdentifier(name) { + return accessPrivateIdentifierWorker(getGeneratedPrivateIdentifierInfo, ts.getNodeForGeneratedName(name)); + } + function accessPrivateIdentifierWorker(getPrivateIdentifierInfo, privateIdentifierKey) { if (currentClassLexicalEnvironment === null || currentClassLexicalEnvironment === void 0 ? void 0 : currentClassLexicalEnvironment.privateIdentifierEnvironment) { - var info = currentClassLexicalEnvironment.privateIdentifierEnvironment.identifiers.get(name.escapedText); + var info = getPrivateIdentifierInfo(currentClassLexicalEnvironment.privateIdentifierEnvironment, privateIdentifierKey); if (info) { return info; } @@ -96122,9 +97237,11 @@ var ts; if (!env) { continue; } - var info = (_a = env.privateIdentifierEnvironment) === null || _a === void 0 ? void 0 : _a.identifiers.get(name.escapedText); - if (info) { - return info; + if (env.privateIdentifierEnvironment) { + var info = getPrivateIdentifierInfo(env.privateIdentifierEnvironment, privateIdentifierKey); + if (info) { + return info; + } } } return undefined; @@ -96181,7 +97298,7 @@ var ts; } } } - return ts.visitNode(node, visitorDestructuringTarget); + return ts.visitNode(node, assignmentTargetVisitor); } function visitObjectAssignmentTarget(node) { if (ts.isObjectBindingOrAssignmentElement(node) && !ts.isShorthandPropertyAssignment(node)) { @@ -96214,10 +97331,10 @@ var ts; var initializer = ts.getInitializerOfBindingOrAssignmentElement(node); return factory.updatePropertyAssignment(node, ts.visitNode(node.name, visitor, ts.isPropertyName), wrapped ? initializer ? factory.createAssignment(wrapped, ts.visitNode(initializer, visitor)) : wrapped : - ts.visitNode(node.initializer, visitorDestructuringTarget, ts.isExpression)); + ts.visitNode(node.initializer, assignmentTargetVisitor, ts.isExpression)); } if (ts.isSpreadAssignment(node)) { - return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, visitorDestructuringTarget, ts.isExpression)); + return factory.updateSpreadAssignment(node, wrapped || ts.visitNode(node.expression, assignmentTargetVisitor, ts.isExpression)); } ts.Debug.assert(wrapped === undefined, "Should not have generated a wrapped target"); } @@ -96263,7 +97380,31 @@ var ts; /*typeArguments*/ undefined, [receiver]); } function isReservedPrivateName(node) { - return node.escapedText === "#constructor"; + return !ts.isGeneratedPrivateIdentifier(node) && node.escapedText === "#constructor"; + } + function getPrivateIdentifier(privateEnv, name) { + return ts.isGeneratedPrivateIdentifier(name) ? + getGeneratedPrivateIdentifierInfo(privateEnv, ts.getNodeForGeneratedName(name)) : + getPrivateIdentifierInfo(privateEnv, name.escapedText); + } + function setPrivateIdentifier(privateEnv, name, info) { + var _a, _b; + if (ts.isGeneratedPrivateIdentifier(name)) { + (_a = privateEnv.generatedIdentifiers) !== null && _a !== void 0 ? _a : (privateEnv.generatedIdentifiers = new ts.Map()); + privateEnv.generatedIdentifiers.set(ts.getNodeForGeneratedName(name), info); + } + else { + (_b = privateEnv.identifiers) !== null && _b !== void 0 ? _b : (privateEnv.identifiers = new ts.Map()); + privateEnv.identifiers.set(name.escapedText, info); + } + } + function getPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.identifiers) === null || _a === void 0 ? void 0 : _a.get(key); + } + function getGeneratedPrivateIdentifierInfo(privateEnv, key) { + var _a; + return (_a = privateEnv.generatedIdentifiers) === null || _a === void 0 ? void 0 : _a.get(key); } })(ts || (ts = {})); /*@internal*/ @@ -96304,15 +97445,15 @@ var ts; */ function serializeTypeOfNode(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 164 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 166 /* SyntaxKind.Parameter */: return serializeTypeNode(node.type); - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return serializeTypeNode(getAccessorTypeNode(node)); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: return ts.factory.createIdentifier("Function"); default: return ts.factory.createVoidZero(); @@ -96348,7 +97489,7 @@ var ts; return ts.factory.createArrayLiteralExpression(expressions); } function getParametersOfDecoratedDeclaration(node, container) { - if (container && node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (container && node.kind === 174 /* SyntaxKind.GetAccessor */) { var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor; if (setAccessor) { return setAccessor.parameters; @@ -96394,66 +97535,66 @@ var ts; node = ts.skipTypeParentheses(node); switch (node.kind) { case 114 /* SyntaxKind.VoidKeyword */: - case 153 /* SyntaxKind.UndefinedKeyword */: - case 143 /* SyntaxKind.NeverKeyword */: + case 155 /* SyntaxKind.UndefinedKeyword */: + case 144 /* SyntaxKind.NeverKeyword */: return ts.factory.createVoidZero(); - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: return ts.factory.createIdentifier("Function"); - case 183 /* SyntaxKind.ArrayType */: - case 184 /* SyntaxKind.TupleType */: + case 185 /* SyntaxKind.ArrayType */: + case 186 /* SyntaxKind.TupleType */: return ts.factory.createIdentifier("Array"); - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return node.assertsModifier ? ts.factory.createVoidZero() : ts.factory.createIdentifier("Boolean"); - case 133 /* SyntaxKind.BooleanKeyword */: + case 134 /* SyntaxKind.BooleanKeyword */: return ts.factory.createIdentifier("Boolean"); - case 198 /* SyntaxKind.TemplateLiteralType */: - case 150 /* SyntaxKind.StringKeyword */: + case 200 /* SyntaxKind.TemplateLiteralType */: + case 152 /* SyntaxKind.StringKeyword */: return ts.factory.createIdentifier("String"); - case 148 /* SyntaxKind.ObjectKeyword */: + case 149 /* SyntaxKind.ObjectKeyword */: return ts.factory.createIdentifier("Object"); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return serializeLiteralOfLiteralTypeNode(node.literal); - case 147 /* SyntaxKind.NumberKeyword */: + case 148 /* SyntaxKind.NumberKeyword */: return ts.factory.createIdentifier("Number"); - case 158 /* SyntaxKind.BigIntKeyword */: + case 160 /* SyntaxKind.BigIntKeyword */: return getGlobalConstructor("BigInt", 7 /* ScriptTarget.ES2020 */); - case 151 /* SyntaxKind.SymbolKeyword */: + case 153 /* SyntaxKind.SymbolKeyword */: return getGlobalConstructor("Symbol", 2 /* ScriptTarget.ES2015 */); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return serializeTypeReferenceNode(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ true); - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return serializeUnionOrIntersectionConstituents(node.types, /*isIntersection*/ false); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return serializeUnionOrIntersectionConstituents([node.trueType, node.falseType], /*isIntersection*/ false); - case 193 /* SyntaxKind.TypeOperator */: - if (node.operator === 145 /* SyntaxKind.ReadonlyKeyword */) { + case 195 /* SyntaxKind.TypeOperator */: + if (node.operator === 146 /* SyntaxKind.ReadonlyKeyword */) { return serializeTypeNode(node.type); } break; - case 181 /* SyntaxKind.TypeQuery */: - case 194 /* SyntaxKind.IndexedAccessType */: - case 195 /* SyntaxKind.MappedType */: - case 182 /* SyntaxKind.TypeLiteral */: - case 130 /* SyntaxKind.AnyKeyword */: - case 155 /* SyntaxKind.UnknownKeyword */: - case 192 /* SyntaxKind.ThisType */: - case 200 /* SyntaxKind.ImportType */: + case 183 /* SyntaxKind.TypeQuery */: + case 196 /* SyntaxKind.IndexedAccessType */: + case 197 /* SyntaxKind.MappedType */: + case 184 /* SyntaxKind.TypeLiteral */: + case 131 /* SyntaxKind.AnyKeyword */: + case 157 /* SyntaxKind.UnknownKeyword */: + case 194 /* SyntaxKind.ThisType */: + case 202 /* SyntaxKind.ImportType */: break; // handle JSDoc types from an invalid parse - case 312 /* SyntaxKind.JSDocAllType */: - case 313 /* SyntaxKind.JSDocUnknownType */: - case 317 /* SyntaxKind.JSDocFunctionType */: - case 318 /* SyntaxKind.JSDocVariadicType */: - case 319 /* SyntaxKind.JSDocNamepathType */: + case 315 /* SyntaxKind.JSDocAllType */: + case 316 /* SyntaxKind.JSDocUnknownType */: + case 320 /* SyntaxKind.JSDocFunctionType */: + case 321 /* SyntaxKind.JSDocVariadicType */: + case 322 /* SyntaxKind.JSDocNamepathType */: break; - case 314 /* SyntaxKind.JSDocNullableType */: - case 315 /* SyntaxKind.JSDocNonNullableType */: - case 316 /* SyntaxKind.JSDocOptionalType */: + case 317 /* SyntaxKind.JSDocNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return serializeTypeNode(node.type); default: return ts.Debug.failBadSyntaxKind(node); @@ -96465,7 +97606,7 @@ var ts; case 10 /* SyntaxKind.StringLiteral */: case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: return ts.factory.createIdentifier("String"); - case 219 /* SyntaxKind.PrefixUnaryExpression */: { + case 221 /* SyntaxKind.PrefixUnaryExpression */: { var operand = node.operand; switch (operand.kind) { case 8 /* SyntaxKind.NumericLiteral */: @@ -96494,20 +97635,20 @@ var ts; for (var _i = 0, types_22 = types; _i < types_22.length; _i++) { var typeNode = types_22[_i]; typeNode = ts.skipTypeParentheses(typeNode); - if (typeNode.kind === 143 /* SyntaxKind.NeverKeyword */) { + if (typeNode.kind === 144 /* SyntaxKind.NeverKeyword */) { if (isIntersection) return ts.factory.createVoidZero(); // Reduce to `never` in an intersection continue; // Elide `never` in a union } - if (typeNode.kind === 155 /* SyntaxKind.UnknownKeyword */) { + if (typeNode.kind === 157 /* SyntaxKind.UnknownKeyword */) { if (!isIntersection) return ts.factory.createIdentifier("Object"); // Reduce to `unknown` in a union continue; // Elide `unknown` in an intersection } - if (typeNode.kind === 130 /* SyntaxKind.AnyKeyword */) { + if (typeNode.kind === 131 /* SyntaxKind.AnyKeyword */) { return ts.factory.createIdentifier("Object"); // Reduce to `any` in a union or intersection } - if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 153 /* SyntaxKind.UndefinedKeyword */)) { + if (!strictNullChecks && ((ts.isLiteralTypeNode(typeNode) && typeNode.literal.kind === 104 /* SyntaxKind.NullKeyword */) || typeNode.kind === 155 /* SyntaxKind.UndefinedKeyword */)) { continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks } var serializedConstituent = serializeTypeNode(typeNode); @@ -96655,7 +97796,7 @@ var ts; name.original = undefined; ts.setParent(name, ts.getParseTreeNode(currentLexicalScope)); // ensure the parent is set to a parse tree node. return name; - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return serializeQualifiedNameAsExpression(node); } } @@ -96710,24 +97851,24 @@ var ts; return node; } switch (node.kind) { - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: // Decorators are elided. They will be emitted as part of `visitClassDeclaration`. return undefined; - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return visitConstructorDeclaration(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitSetAccessorDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return visitGetAccessorDeclaration(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return visitPropertyDeclaration(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameterDeclaration(node); default: return ts.visitEachChild(node, visitor, context); @@ -97083,7 +98224,7 @@ var ts; var prefix = getClassMemberPrefix(node, member); var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ !ts.hasSyntacticModifier(member, 2 /* ModifierFlags.Ambient */)); var descriptor = languageVersion > 0 /* ScriptTarget.ES3 */ - ? member.kind === 167 /* SyntaxKind.PropertyDeclaration */ + ? ts.isPropertyDeclaration(member) && !ts.hasAccessorModifier(member) // We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it // should not invoke `Object.getOwnPropertyDescriptor`. ? factory.createVoidZero() @@ -97346,34 +98487,37 @@ var ts; return node; } switch (node.kind) { - case 131 /* SyntaxKind.AsyncKeyword */: + case 132 /* SyntaxKind.AsyncKeyword */: // ES2017 async modifier should be elided for targets < ES2017 return undefined; - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitMethodDeclaration, node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionDeclaration, node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitFunctionExpression, node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithContext(1 /* ContextFlags.NonTopLevel */, visitArrowFunction, node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 171 /* SyntaxKind.Constructor */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 174 /* SyntaxKind.GetAccessor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitGetAccessorDeclaration, node); + case 175 /* SyntaxKind.SetAccessor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitSetAccessorDeclaration, node); + case 173 /* SyntaxKind.Constructor */: + return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitConstructorDeclaration, node); + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithContext(1 /* ContextFlags.NonTopLevel */ | 2 /* ContextFlags.HasLexicalThis */, visitDefault, node); default: return ts.visitEachChild(node, visitor, context); @@ -97382,27 +98526,27 @@ var ts; function asyncBodyVisitor(node) { if (ts.isNodeWithPossibleHoistedDeclaration(node)) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatementInAsyncBody(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatementInAsyncBody(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatementInAsyncBody(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatementInAsyncBody(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClauseInAsyncBody(node); - case 235 /* SyntaxKind.Block */: - case 249 /* SyntaxKind.SwitchStatement */: - case 263 /* SyntaxKind.CaseBlock */: - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: - case 252 /* SyntaxKind.TryStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 239 /* SyntaxKind.IfStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 250 /* SyntaxKind.LabeledStatement */: + case 238 /* SyntaxKind.Block */: + case 252 /* SyntaxKind.SwitchStatement */: + case 266 /* SyntaxKind.CaseBlock */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: + case 255 /* SyntaxKind.TryStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 242 /* SyntaxKind.IfStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return ts.visitEachChild(node, asyncBodyVisitor, context); default: return ts.Debug.assertNever(node, "Unhandled node."); @@ -97472,6 +98616,9 @@ var ts; return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression( /*asteriskToken*/ undefined, ts.visitNode(node.expression, visitor, ts.isExpression)), node), node); } + function visitConstructorDeclaration(node) { + return factory.updateConstructorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node)); + } /** * Visits a MethodDeclaration node. * @@ -97486,7 +98633,14 @@ var ts; /*typeParameters*/ undefined, ts.visitParameterList(node.parameters, visitor, context), /*type*/ undefined, ts.getFunctionFlags(node) & 2 /* FunctionFlags.Async */ ? transformAsyncFunctionBody(node) - : ts.visitFunctionBody(node.body, visitor, context)); + : transformMethodBody(node)); + } + function visitGetAccessorDeclaration(node) { + return factory.updateGetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), + /*type*/ undefined, transformMethodBody(node)); + } + function visitSetAccessorDeclaration(node) { + return factory.updateSetAccessorDeclaration(node, ts.visitNodes(node.modifiers, visitor, ts.isModifierLike), node.name, ts.visitParameterList(node.parameters, visitor, context), transformMethodBody(node)); } /** * Visits a FunctionDeclaration node. @@ -97600,12 +98754,48 @@ var ts; } return false; } + function transformMethodBody(node) { + ts.Debug.assertIsDefined(node.body); + var savedCapturedSuperProperties = capturedSuperProperties; + var savedHasSuperElementAccess = hasSuperElementAccess; + capturedSuperProperties = new ts.Set(); + hasSuperElementAccess = false; + var updated = ts.visitFunctionBody(node.body, visitor, context); + // Minor optimization, emit `_super` helper to capture `super` access in an arrow. + // This step isn't needed if we eventually transform this to ES5. + var originalMethod = ts.getOriginalNode(node, ts.isFunctionLikeDeclaration); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && + resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) && + (ts.getFunctionFlags(originalMethod) & 3 /* FunctionFlags.AsyncGenerator */) !== 3 /* FunctionFlags.AsyncGenerator */; + if (emitSuperHelpers) { + enableSubstitutionForAsyncMethodsWithSuper(); + if (capturedSuperProperties.size) { + var variableStatement = createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties); + substitutedSuperAccessors[ts.getNodeId(variableStatement)] = true; + var statements = updated.statements.slice(); + ts.insertStatementsAfterStandardPrologue(statements, [variableStatement]); + updated = factory.updateBlock(updated, statements); + } + if (hasSuperElementAccess) { + // Emit helpers for super element access expressions (`super[x]`). + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { + ts.addEmitHelper(updated, ts.advancedAsyncSuperHelper); + } + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { + ts.addEmitHelper(updated, ts.asyncSuperHelper); + } + } + } + capturedSuperProperties = savedCapturedSuperProperties; + hasSuperElementAccess = savedHasSuperElementAccess; + return updated; + } function transformAsyncFunctionBody(node) { resumeLexicalEnvironment(); var original = ts.getOriginalNode(node, ts.isFunctionLike); var nodeType = original.type; var promiseConstructor = languageVersion < 2 /* ScriptTarget.ES2015 */ ? getPromiseConstructor(nodeType) : undefined; - var isArrowFunction = node.kind === 214 /* SyntaxKind.ArrowFunction */; + var isArrowFunction = node.kind === 216 /* SyntaxKind.ArrowFunction */; var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* NodeCheckFlags.CaptureArguments */) !== 0; // An async function is emit as an outer function that calls an inner // generator function. To preserve lexical bindings, we pass the current @@ -97632,7 +98822,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); // Minor optimization, emit `_super` helper to capture `super` access in an arrow. // This step isn't needed if we eventually transform this to ES5. - var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */ | 2048 /* NodeCheckFlags.AsyncMethodWithSuper */); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */); if (emitSuperHelpers) { enableSubstitutionForAsyncMethodsWithSuper(); if (capturedSuperProperties.size) { @@ -97645,10 +98835,10 @@ var ts; ts.setTextRange(block, node.body); if (emitSuperHelpers && hasSuperElementAccess) { // Emit helpers for super element access expressions (`super[x]`). - if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); } - else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) { + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { ts.addEmitHelper(block, ts.asyncSuperHelper); } } @@ -97696,17 +98886,17 @@ var ts; enabledSubstitutions |= 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -97720,7 +98910,7 @@ var ts; // If we need to support substitutions for `super` in an async method, // we should track it here. if (enabledSubstitutions & 1 /* ES2017SubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) { - var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */); + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */); if (superContainerFlags !== enclosingSuperContainerFlags) { var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; enclosingSuperContainerFlags = superContainerFlags; @@ -97754,11 +98944,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -97790,14 +98980,14 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { - if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createUniqueName("_superIndex", 16 /* GeneratedIdentifierFlags.Optimistic */ | 32 /* GeneratedIdentifierFlags.FileLevel */), /*typeArguments*/ undefined, [argumentExpression]), "value"), location); } @@ -97812,7 +99002,7 @@ var ts; function createSuperAccessVariableStatement(factory, resolver, node, names) { // Create a variable declaration with a getter/setter (if binding) definition for each name: // const _super = Object.create(null, { x: { get: () => super.x, set: (v) => super.x = v }, ... }); - var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) !== 0; + var hasBinding = (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) !== 0; var accessors = []; names.forEach(function (_, key) { var name = ts.unescapeLeadingUnderscores(key); @@ -97951,7 +99141,7 @@ var ts; return visitorWorker(node, /*expressionResultIsUnused*/ true); } function visitorNoAsyncModifier(node) { - if (node.kind === 131 /* SyntaxKind.AsyncKeyword */) { + if (node.kind === 132 /* SyntaxKind.AsyncKeyword */) { return undefined; } return node; @@ -97977,70 +99167,70 @@ var ts; return node; } switch (node.kind) { - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return visitAwaitExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: + case 246 /* SyntaxKind.ForInStatement */: return doWithHierarchyFacts(visitDefault, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return doWithHierarchyFacts(visitForStatement, node, 0 /* HierarchyFacts.IterationStatementExcludes */, 2 /* HierarchyFacts.IterationStatementIncludes */); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return doWithHierarchyFacts(visitConstructorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return doWithHierarchyFacts(visitMethodDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 172 /* SyntaxKind.GetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return doWithHierarchyFacts(visitGetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 173 /* SyntaxKind.SetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return doWithHierarchyFacts(visitSetAccessorDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return doWithHierarchyFacts(visitFunctionDeclaration, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return doWithHierarchyFacts(visitFunctionExpression, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return doWithHierarchyFacts(visitArrowFunction, node, 2 /* HierarchyFacts.ArrowFunctionExcludes */, 0 /* HierarchyFacts.ArrowFunctionIncludes */); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { capturedSuperProperties.add(node.name.escapedText); } return ts.visitEachChild(node, visitor, context); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (capturedSuperProperties && node.expression.kind === 106 /* SyntaxKind.SuperKeyword */) { hasSuperElementAccess = true; } return ts.visitEachChild(node, visitor, context); - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: return doWithHierarchyFacts(visitDefault, node, 2 /* HierarchyFacts.ClassOrFunctionExcludes */, 1 /* HierarchyFacts.ClassOrFunctionIncludes */); default: return ts.visitEachChild(node, visitor, context); @@ -98076,7 +99266,7 @@ var ts; function visitLabeledStatement(node) { if (enclosingFunctionFlags & 2 /* FunctionFlags.Async */) { var statement = ts.unwrapInnermostStatementOfLabel(node); - if (statement.kind === 244 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { + if (statement.kind === 247 /* SyntaxKind.ForOfStatement */ && statement.awaitModifier) { return visitForOfStatement(statement, node); } return factory.restoreEnclosingLabel(ts.visitNode(statement, visitor, ts.isStatement, factory.liftToBlock), node); @@ -98088,7 +99278,7 @@ var ts; var objects = []; for (var _i = 0, elements_5 = elements; _i < elements_5.length; _i++) { var e = elements_5[_i]; - if (e.kind === 298 /* SyntaxKind.SpreadAssignment */) { + if (e.kind === 301 /* SyntaxKind.SpreadAssignment */) { if (chunkObject) { objects.push(factory.createObjectLiteralExpression(chunkObject)); chunkObject = undefined; @@ -98097,7 +99287,7 @@ var ts; objects.push(ts.visitNode(target, visitor, ts.isExpression)); } else { - chunkObject = ts.append(chunkObject, e.kind === 296 /* SyntaxKind.PropertyAssignment */ + chunkObject = ts.append(chunkObject, e.kind === 299 /* SyntaxKind.PropertyAssignment */ ? factory.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression)) : ts.visitNode(e, visitor, ts.isObjectLiteralElementLike)); } @@ -98131,7 +99321,7 @@ var ts; // If we translate the above to `__assign({}, k, l)`, the `l` will evaluate before `k` is spread and we // end up with `{ a: 1, b: 2, c: 3 }` var objects = chunkObjectLiteralElements(node.properties); - if (objects.length && objects[0].kind !== 205 /* SyntaxKind.ObjectLiteralExpression */) { + if (objects.length && objects[0].kind !== 207 /* SyntaxKind.ObjectLiteralExpression */) { objects.unshift(factory.createObjectLiteralExpression()); } var expression = objects[0]; @@ -98305,11 +99495,22 @@ var ts; } return node; } - function convertForOfStatementHead(node, boundValue) { - var binding = ts.createForOfBindingStatement(factory, node.initializer, boundValue); + function convertForOfStatementHead(node, boundValue, nonUserCode) { + var value = factory.createTempVariable(hoistVariableDeclaration); + var iteratorValueExpression = factory.createAssignment(value, boundValue); + var iteratorValueStatement = factory.createExpressionStatement(iteratorValueExpression); + ts.setSourceMapRange(iteratorValueStatement, node.expression); + var exitNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createFalse()); + var exitNonUserCodeStatement = factory.createExpressionStatement(exitNonUserCodeExpression); + ts.setSourceMapRange(exitNonUserCodeStatement, node.expression); + var enterNonUserCodeExpression = factory.createAssignment(nonUserCode, factory.createTrue()); + var enterNonUserCodeStatement = factory.createExpressionStatement(enterNonUserCodeExpression); + ts.setSourceMapRange(exitNonUserCodeStatement, node.expression); + var statements = []; + var binding = ts.createForOfBindingStatement(factory, node.initializer, value); + statements.push(ts.visitNode(binding, visitor, ts.isStatement)); var bodyLocation; var statementsLocation; - var statements = [ts.visitNode(binding, visitor, ts.isStatement)]; var statement = ts.visitIterationBody(node.statement, visitor, context); if (ts.isBlock(statement)) { ts.addRange(statements, statement.statements); @@ -98319,8 +99520,16 @@ var ts; else { statements.push(statement); } - return ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), + var body = ts.setEmitFlags(ts.setTextRange(factory.createBlock(ts.setTextRange(factory.createNodeArray(statements), statementsLocation), /*multiLine*/ true), bodyLocation), 48 /* EmitFlags.NoSourceMap */ | 384 /* EmitFlags.NoTokenSourceMaps */); + return factory.createBlock([ + iteratorValueStatement, + exitNonUserCodeStatement, + factory.createTryStatement(body, + /*catchClause*/ undefined, factory.createBlock([ + enterNonUserCodeStatement + ])) + ]); } function createDownlevelAwait(expression) { return enclosingFunctionFlags & 1 /* FunctionFlags.Generator */ @@ -98331,6 +99540,8 @@ var ts; var expression = ts.visitNode(node.expression, visitor, ts.isExpression); var iterator = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(expression) : factory.createTempVariable(/*recordTempVariable*/ undefined); var result = ts.isIdentifier(expression) ? factory.getGeneratedNameForNode(iterator) : factory.createTempVariable(/*recordTempVariable*/ undefined); + var nonUserCode = factory.createTempVariable(/*recordTempVariable*/ undefined); + var done = factory.createTempVariable(hoistVariableDeclaration); var errorRecord = factory.createUniqueName("e"); var catchVariable = factory.getGeneratedNameForNode(errorRecord); var returnMethod = factory.createTempVariable(/*recordTempVariable*/ undefined); @@ -98347,12 +99558,17 @@ var ts; callValues; var forStatement = ts.setEmitFlags(ts.setTextRange(factory.createForStatement( /*initializer*/ ts.setEmitFlags(ts.setTextRange(factory.createVariableDeclarationList([ + factory.createVariableDeclaration(nonUserCode, /*exclamationToken*/ undefined, /*type*/ undefined, factory.createTrue()), ts.setTextRange(factory.createVariableDeclaration(iterator, /*exclamationToken*/ undefined, /*type*/ undefined, initializer), node.expression), factory.createVariableDeclaration(result) ]), node.expression), 2097152 /* EmitFlags.NoHoisting */), - /*condition*/ factory.createComma(factory.createAssignment(result, createDownlevelAwait(callNext)), factory.createLogicalNot(getDone)), + /*condition*/ factory.inlineExpressions([ + factory.createAssignment(result, createDownlevelAwait(callNext)), + factory.createAssignment(done, getDone), + factory.createLogicalNot(done) + ]), /*incrementor*/ undefined, - /*statement*/ convertForOfStatementHead(node, getValue)), + /*statement*/ convertForOfStatementHead(node, getValue, nonUserCode)), /*location*/ node), 256 /* EmitFlags.NoTokenTrailingSourceMaps */); ts.setOriginalNode(forStatement, node); return factory.createTryStatement(factory.createBlock([ @@ -98364,7 +99580,7 @@ var ts; ]), 1 /* EmitFlags.SingleLine */)), factory.createBlock([ factory.createTryStatement( /*tryBlock*/ factory.createBlock([ - ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(result, factory.createLogicalNot(getDone)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), 1 /* EmitFlags.SingleLine */) + ts.setEmitFlags(factory.createIfStatement(factory.createLogicalAnd(factory.createLogicalAnd(factory.createLogicalNot(nonUserCode), factory.createLogicalNot(done)), factory.createAssignment(returnMethod, factory.createPropertyAccessExpression(iterator, "return"))), factory.createExpressionStatement(createDownlevelAwait(callReturn))), 1 /* EmitFlags.SingleLine */) ]), /*catchClause*/ undefined, /*finallyBlock*/ ts.setEmitFlags(factory.createBlock([ @@ -98520,7 +99736,7 @@ var ts; /*type*/ undefined, factory.updateBlock(node.body, ts.visitLexicalEnvironment(node.body.statements, visitor, context, statementOffset))), !!(hierarchyFacts & 1 /* HierarchyFacts.HasLexicalThis */))); // Minor optimization, emit `_super` helper to capture `super` access in an arrow. // This step isn't needed if we eventually transform this to ES5. - var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */ | 2048 /* NodeCheckFlags.AsyncMethodWithSuper */); + var emitSuperHelpers = languageVersion >= 2 /* ScriptTarget.ES2015 */ && resolver.getNodeCheckFlags(node) & (4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */ | 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */); if (emitSuperHelpers) { enableSubstitutionForAsyncMethodsWithSuper(); var variableStatement = ts.createSuperAccessVariableStatement(factory, resolver, node, capturedSuperProperties); @@ -98531,10 +99747,10 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var block = factory.updateBlock(node.body, statements); if (emitSuperHelpers && hasSuperElementAccess) { - if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (resolver.getNodeCheckFlags(node) & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { ts.addEmitHelper(block, ts.advancedAsyncSuperHelper); } - else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.AsyncMethodWithSuper */) { + else if (resolver.getNodeCheckFlags(node) & 2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */) { ts.addEmitHelper(block, ts.asyncSuperHelper); } } @@ -98639,17 +99855,17 @@ var ts; enabledSubstitutions |= 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */; // We need to enable substitutions for call, property access, and element access // if we need to rewrite super calls. - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(207 /* SyntaxKind.ElementAccessExpression */); + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(209 /* SyntaxKind.ElementAccessExpression */); // We need to be notified when entering and exiting declarations that bind super. - context.enableEmitNotification(257 /* SyntaxKind.ClassDeclaration */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); + context.enableEmitNotification(260 /* SyntaxKind.ClassDeclaration */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); // We need to be notified when entering the generated accessor arrow functions. - context.enableEmitNotification(237 /* SyntaxKind.VariableStatement */); + context.enableEmitNotification(240 /* SyntaxKind.VariableStatement */); } } /** @@ -98663,7 +99879,7 @@ var ts; // If we need to support substitutions for `super` in an async method, // we should track it here. if (enabledSubstitutions & 1 /* ESNextSubstitutionFlags.AsyncMethodsWithSuper */ && isSuperContainer(node)) { - var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.AsyncMethodWithSuper */ | 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */); + var superContainerFlags = resolver.getNodeCheckFlags(node) & (2048 /* NodeCheckFlags.MethodWithSuperPropertyAccessInAsync */ | 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */); if (superContainerFlags !== enclosingSuperContainerFlags) { var savedEnclosingSuperContainerFlags = enclosingSuperContainerFlags; enclosingSuperContainerFlags = superContainerFlags; @@ -98697,11 +99913,11 @@ var ts; } function substituteExpression(node) { switch (node.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return substitutePropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return substituteElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); } return node; @@ -98733,14 +99949,14 @@ var ts; } function isSuperContainer(node) { var kind = node.kind; - return kind === 257 /* SyntaxKind.ClassDeclaration */ - || kind === 171 /* SyntaxKind.Constructor */ - || kind === 169 /* SyntaxKind.MethodDeclaration */ - || kind === 172 /* SyntaxKind.GetAccessor */ - || kind === 173 /* SyntaxKind.SetAccessor */; + return kind === 260 /* SyntaxKind.ClassDeclaration */ + || kind === 173 /* SyntaxKind.Constructor */ + || kind === 171 /* SyntaxKind.MethodDeclaration */ + || kind === 174 /* SyntaxKind.GetAccessor */ + || kind === 175 /* SyntaxKind.SetAccessor */; } function createSuperElementAccessInAsyncMethod(argumentExpression, location) { - if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.AsyncMethodWithSuperBinding */) { + if (enclosingSuperContainerFlags & 4096 /* NodeCheckFlags.MethodWithSuperPropertyAssignmentInAsync */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createCallExpression(factory.createIdentifier("_superIndex"), /*typeArguments*/ undefined, [argumentExpression]), "value"), location); } @@ -98769,7 +99985,7 @@ var ts; return node; } switch (node.kind) { - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); default: return ts.visitEachChild(node, visitor, context); @@ -98801,25 +100017,25 @@ var ts; return node; } switch (node.kind) { - case 208 /* SyntaxKind.CallExpression */: { + case 210 /* SyntaxKind.CallExpression */: { var updated = visitNonOptionalCallExpression(node, /*captureThisArg*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (ts.isOptionalChain(node)) { var updated = visitOptionalExpression(node, /*captureThisArg*/ false, /*isDelete*/ false); ts.Debug.assertNotNode(updated, ts.isSyntheticReference); return updated; } return ts.visitEachChild(node, visitor, context); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (node.operatorToken.kind === 60 /* SyntaxKind.QuestionQuestionToken */) { return transformNullishCoalescingExpression(node); } return ts.visitEachChild(node, visitor, context); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return visitDeleteExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -98861,7 +100077,7 @@ var ts; thisArg = expression; } } - expression = node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + expression = node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.updatePropertyAccessExpression(node, expression, ts.visitNode(node.name, visitor, ts.isIdentifier)) : factory.updateElementAccessExpression(node, expression, ts.visitNode(node.argumentExpression, visitor, ts.isExpression)); return thisArg ? factory.createSyntheticReferenceExpression(expression, thisArg) : expression; @@ -98884,10 +100100,10 @@ var ts; } function visitNonOptionalExpression(node, captureThisArg, isDelete) { switch (node.kind) { - case 212 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); - case 208 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitNonOptionalParenthesizedExpression(node, captureThisArg, isDelete); + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitNonOptionalPropertyOrElementAccessExpression(node, captureThisArg, isDelete); + case 210 /* SyntaxKind.CallExpression */: return visitNonOptionalCallExpression(node, captureThisArg); default: return ts.visitNode(node, visitor, ts.isExpression); } } @@ -98906,8 +100122,8 @@ var ts; for (var i = 0; i < chain.length; i++) { var segment = chain[i]; switch (segment.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: - case 207 /* SyntaxKind.ElementAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: if (i === chain.length - 1 && captureThisArg) { if (!ts.isSimpleCopiableExpression(rightExpression)) { thisArg = factory.createTempVariable(hoistVariableDeclaration); @@ -98917,11 +100133,11 @@ var ts; thisArg = rightExpression; } } - rightExpression = segment.kind === 206 /* SyntaxKind.PropertyAccessExpression */ + rightExpression = segment.kind === 208 /* SyntaxKind.PropertyAccessExpression */ ? factory.createPropertyAccessExpression(rightExpression, ts.visitNode(segment.name, visitor, ts.isIdentifier)) : factory.createElementAccessExpression(rightExpression, ts.visitNode(segment.argumentExpression, visitor, ts.isExpression)); break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (i === 0 && leftThisArg) { if (!ts.isGeneratedIdentifier(leftThisArg)) { leftThisArg = factory.cloneNode(leftThisArg); @@ -98982,7 +100198,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: var binaryExpression = node; if (ts.isLogicalOrCoalescingAssignmentExpression(binaryExpression)) { return transformLogicalAssignment(binaryExpression); @@ -99151,13 +100367,13 @@ var ts; } function visitorWorker(node) { switch (node.kind) { - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ false); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ false); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ false); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99167,13 +100383,13 @@ var ts; switch (node.kind) { case 11 /* SyntaxKind.JsxText */: return visitJsxText(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return visitJsxExpression(node); - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return visitJsxElement(node, /*isChild*/ true); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return visitJsxSelfClosingElement(node, /*isChild*/ true); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return visitJsxFragment(node, /*isChild*/ true); default: return ts.Debug.failBadSyntaxKind(node); @@ -99354,7 +100570,7 @@ var ts; var literal = factory.createStringLiteral(tryDecodeEntities(node.text) || node.text, singleQuote); return ts.setTextRange(literal, node); } - if (node.kind === 288 /* SyntaxKind.JsxExpression */) { + if (node.kind === 291 /* SyntaxKind.JsxExpression */) { if (node.expression === undefined) { return factory.createTrue(); } @@ -99455,7 +100671,7 @@ var ts; return decoded === text ? undefined : decoded; } function getTagName(node) { - if (node.kind === 278 /* SyntaxKind.JsxElement */) { + if (node.kind === 281 /* SyntaxKind.JsxElement */) { return getTagName(node.openingElement); } else { @@ -99762,7 +100978,7 @@ var ts; return node; } switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -99987,7 +101203,7 @@ var ts; } function isReturnVoidStatementInConstructorWithCapturedSuper(node) { return (hierarchyFacts & 8192 /* HierarchyFacts.ConstructorWithCapturedSuper */) !== 0 - && node.kind === 247 /* SyntaxKind.ReturnStatement */ + && node.kind === 250 /* SyntaxKind.ReturnStatement */ && !node.expression; } function isOrMayContainReturnCompletion(node) { @@ -100041,65 +101257,65 @@ var ts; switch (node.kind) { case 124 /* SyntaxKind.StaticKeyword */: return undefined; // elide static keyword - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return visitClassExpression(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return visitParameter(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return visitArrowFunction(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return visitVariableDeclaration(node); case 79 /* SyntaxKind.Identifier */: return visitIdentifier(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return visitVariableDeclarationList(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node, /*isFunctionBody*/ false); - case 246 /* SyntaxKind.BreakStatement */: - case 245 /* SyntaxKind.ContinueStatement */: + case 249 /* SyntaxKind.BreakStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitBreakOrContinueStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*outermostLabeledStatement*/ undefined); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, /*outermostLabeledStatement*/ undefined); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return visitShorthandPropertyAssignment(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return visitComputedPropertyName(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, expressionResultIsUnused); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node, expressionResultIsUnused); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node, expressionResultIsUnused); case 14 /* SyntaxKind.NoSubstitutionTemplateLiteral */: case 15 /* SyntaxKind.TemplateHead */: @@ -100110,30 +101326,30 @@ var ts; return visitStringLiteral(node); case 8 /* SyntaxKind.NumericLiteral */: return visitNumericLiteral(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return visitTaggedTemplateExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return visitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return visitSpreadElement(node); case 106 /* SyntaxKind.SuperKeyword */: return visitSuperKeyword(/*isExpressionOfCall*/ false); case 108 /* SyntaxKind.ThisKeyword */: return visitThisKeyword(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return visitMetaProperty(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return visitMethodDeclaration(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return visitVoidExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -100209,11 +101425,13 @@ var ts; return ts.visitEachChild(node, visitorWithUnusedExpressionResult, context); } function visitIdentifier(node) { - if (!convertedLoopState) { - return node; + if (convertedLoopState) { + if (resolver.isArgumentsLocalBinding(node)) { + return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments")); + } } - if (resolver.isArgumentsLocalBinding(node)) { - return convertedLoopState.argumentsName || (convertedLoopState.argumentsName = factory.createUniqueName("arguments")); + if (node.hasExtendedUnicodeEscape) { + return ts.setOriginalNode(ts.setTextRange(factory.createIdentifier(ts.unescapeLeadingUnderscores(node.escapedText)), node), node); } return node; } @@ -100223,14 +101441,14 @@ var ts; // it is possible if either // - break/continue is labeled and label is located inside the converted loop // - break/continue is non-labeled and located in non-converted loop/switch statement - var jump = node.kind === 246 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; + var jump = node.kind === 249 /* SyntaxKind.BreakStatement */ ? 2 /* Jump.Break */ : 4 /* Jump.Continue */; var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) || (!node.label && (convertedLoopState.allowedNonLabeledJumps & jump)); if (!canUseBreakOrContinue) { var labelMarker = void 0; var label = node.label; if (!label) { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { convertedLoopState.nonLocalJumps |= 2 /* Jump.Break */; labelMarker = "break"; } @@ -100241,7 +101459,7 @@ var ts; } } else { - if (node.kind === 246 /* SyntaxKind.BreakStatement */) { + if (node.kind === 249 /* SyntaxKind.BreakStatement */) { labelMarker = "break-".concat(label.escapedText); setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(label), labelMarker); } @@ -100297,7 +101515,7 @@ var ts; statements.push(statement); // Add an `export default` statement for default exports (for `--target es5 --module es6`) if (ts.hasSyntacticModifier(node, 1 /* ModifierFlags.Export */)) { - var exportStatement = ts.hasSyntacticModifier(node, 512 /* ModifierFlags.Default */) + var exportStatement = ts.hasSyntacticModifier(node, 1024 /* ModifierFlags.Default */) ? factory.createExportDefault(factory.getLocalName(node)) : factory.createExternalModuleExport(factory.getLocalName(node)); ts.setOriginalNode(exportStatement, statement); @@ -100666,11 +101884,11 @@ var ts; */ function isSufficientlyCoveredByReturnStatements(statement) { // A return statement is considered covered. - if (statement.kind === 247 /* SyntaxKind.ReturnStatement */) { + if (statement.kind === 250 /* SyntaxKind.ReturnStatement */) { return true; } // An if-statement with two covered branches is covered. - else if (statement.kind === 239 /* SyntaxKind.IfStatement */) { + else if (statement.kind === 242 /* SyntaxKind.IfStatement */) { var ifStatement = statement; if (ifStatement.elseStatement) { return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) && @@ -100678,7 +101896,7 @@ var ts; } } // A block is covered if it has a last statement which is covered. - else if (statement.kind === 235 /* SyntaxKind.Block */) { + else if (statement.kind === 238 /* SyntaxKind.Block */) { var lastStatement = ts.lastOrUndefined(statement.statements); if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) { return true; @@ -100878,7 +102096,7 @@ var ts; * @param node A node. */ function insertCaptureThisForNodeIfNeeded(statements, node) { - if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 214 /* SyntaxKind.ArrowFunction */) { + if (hierarchyFacts & 65536 /* HierarchyFacts.CapturedLexicalThis */ && node.kind !== 216 /* SyntaxKind.ArrowFunction */) { insertCaptureThisForNode(statements, node, factory.createThis()); return true; } @@ -100912,22 +102130,22 @@ var ts; if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */) { var newTarget = void 0; switch (node.kind) { - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return statements; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: // Methods and accessors cannot be constructors, so 'new.target' will // always return 'undefined'. newTarget = factory.createVoidZero(); break; - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: // Class constructors can only be called with `new`, so `this.constructor` // should be relatively safe to use. newTarget = factory.createPropertyAccessExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), "constructor"); break; - case 256 /* SyntaxKind.FunctionDeclaration */: - case 213 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 215 /* SyntaxKind.FunctionExpression */: // Functions can be called or constructed, and may have a `this` due to // being a member or when calling an imported function via `other_1.f()`. newTarget = factory.createConditionalExpression(factory.createLogicalAnd(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), factory.createBinaryExpression(ts.setEmitFlags(factory.createThis(), 4 /* EmitFlags.NoSubstitution */), 102 /* SyntaxKind.InstanceOfKeyword */, factory.getLocalName(node))), @@ -100962,21 +102180,21 @@ var ts; for (var _i = 0, _a = node.members; _i < _a.length; _i++) { var member = _a[_i]; switch (member.kind) { - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: statements.push(transformSemicolonClassElementToStatement(member)); break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node)); break; - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node)); } break; - case 171 /* SyntaxKind.Constructor */: - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: // Constructors are handled in visitClassExpression/visitClassDeclaration break; default: @@ -101175,7 +102393,7 @@ var ts; : enterSubtree(32670 /* HierarchyFacts.FunctionExcludes */, 65 /* HierarchyFacts.FunctionIncludes */); var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 256 /* SyntaxKind.FunctionDeclaration */ || node.kind === 213 /* SyntaxKind.FunctionExpression */)) { + if (hierarchyFacts & 32768 /* HierarchyFacts.NewTarget */ && !name && (node.kind === 259 /* SyntaxKind.FunctionDeclaration */ || node.kind === 215 /* SyntaxKind.FunctionExpression */)) { name = factory.getGeneratedNameForNode(node); } exitSubtree(ancestorFacts, 98304 /* HierarchyFacts.FunctionSubtreeExcludes */, 0 /* HierarchyFacts.None */); @@ -101221,7 +102439,7 @@ var ts; } } else { - ts.Debug.assert(node.kind === 214 /* SyntaxKind.ArrowFunction */); + ts.Debug.assert(node.kind === 216 /* SyntaxKind.ArrowFunction */); // To align with the old emitter, we use a synthetic end position on the location // for the statement list we synthesize when we down-level an arrow function with // an expression function body. This prevents both comments and source maps from @@ -101528,14 +102746,14 @@ var ts; } function visitIterationStatement(node, outermostLabeledStatement) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitDoOrWhileStatement(node, outermostLabeledStatement); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, outermostLabeledStatement); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node, outermostLabeledStatement); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node, outermostLabeledStatement); } } @@ -101721,7 +102939,7 @@ var ts; var property = properties[i]; if ((property.transformFlags & 1048576 /* TransformFlags.ContainsYield */ && hierarchyFacts & 4 /* HierarchyFacts.AsyncFunctionBody */) - || (hasComputed = ts.Debug.checkDefined(property.name).kind === 162 /* SyntaxKind.ComputedPropertyName */)) { + || (hasComputed = ts.Debug.checkDefined(property.name).kind === 164 /* SyntaxKind.ComputedPropertyName */)) { numInitialProperties = i; break; } @@ -101837,11 +103055,11 @@ var ts; } function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) { switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); - case 243 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); - case 244 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); - case 240 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); - case 241 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); + case 245 /* SyntaxKind.ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody); + case 246 /* SyntaxKind.ForInStatement */: return convertForInStatement(node, convertedLoopBody); + case 247 /* SyntaxKind.ForOfStatement */: return convertForOfStatement(node, convertedLoopBody); + case 243 /* SyntaxKind.DoStatement */: return convertDoStatement(node, convertedLoopBody); + case 244 /* SyntaxKind.WhileStatement */: return convertWhileStatement(node, convertedLoopBody); default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected"); } } @@ -101866,11 +103084,11 @@ var ts; function createConvertedLoopState(node) { var loopInitializer; switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: - case 243 /* SyntaxKind.ForInStatement */: - case 244 /* SyntaxKind.ForOfStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 246 /* SyntaxKind.ForInStatement */: + case 247 /* SyntaxKind.ForOfStatement */: var initializer = node.initializer; - if (initializer && initializer.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (initializer && initializer.kind === 258 /* SyntaxKind.VariableDeclarationList */) { loopInitializer = initializer; } break; @@ -102286,20 +103504,20 @@ var ts; for (var i = start; i < numProperties; i++) { var property = properties[i]; switch (property.kind) { - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: var accessors = ts.getAllAccessorDeclarations(node.properties, property); if (property === accessors.firstAccessor) { expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine)); } break; - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine)); break; - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine)); break; default: @@ -102406,7 +103624,7 @@ var ts; var updated; var parameters = ts.visitParameterList(node.parameters, visitor, context); var body = transformFunctionBody(node); - if (node.kind === 172 /* SyntaxKind.GetAccessor */) { + if (node.kind === 174 /* SyntaxKind.GetAccessor */) { updated = factory.updateGetAccessorDeclaration(node, node.modifiers, node.name, parameters, node.type, body); } else { @@ -102866,13 +104084,13 @@ var ts; if ((enabledSubstitutions & 1 /* ES2015SubstitutionFlags.CapturedThis */) === 0) { enabledSubstitutions |= 1 /* ES2015SubstitutionFlags.CapturedThis */; context.enableSubstitution(108 /* SyntaxKind.ThisKeyword */); - context.enableEmitNotification(171 /* SyntaxKind.Constructor */); - context.enableEmitNotification(169 /* SyntaxKind.MethodDeclaration */); - context.enableEmitNotification(172 /* SyntaxKind.GetAccessor */); - context.enableEmitNotification(173 /* SyntaxKind.SetAccessor */); - context.enableEmitNotification(214 /* SyntaxKind.ArrowFunction */); - context.enableEmitNotification(213 /* SyntaxKind.FunctionExpression */); - context.enableEmitNotification(256 /* SyntaxKind.FunctionDeclaration */); + context.enableEmitNotification(173 /* SyntaxKind.Constructor */); + context.enableEmitNotification(171 /* SyntaxKind.MethodDeclaration */); + context.enableEmitNotification(174 /* SyntaxKind.GetAccessor */); + context.enableEmitNotification(175 /* SyntaxKind.SetAccessor */); + context.enableEmitNotification(216 /* SyntaxKind.ArrowFunction */); + context.enableEmitNotification(215 /* SyntaxKind.FunctionExpression */); + context.enableEmitNotification(259 /* SyntaxKind.FunctionDeclaration */); } } /** @@ -102913,10 +104131,10 @@ var ts; */ function isNameOfDeclarationWithCollidingName(node) { switch (node.parent.kind) { - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return node.parent.name === node && resolver.isDeclarationWithCollidingName(node.parent); } @@ -102998,11 +104216,11 @@ var ts; return false; } var statement = ts.firstOrUndefined(constructor.body.statements); - if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 238 /* SyntaxKind.ExpressionStatement */) { + if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 241 /* SyntaxKind.ExpressionStatement */) { return false; } var statementExpression = statement.expression; - if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 208 /* SyntaxKind.CallExpression */) { + if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 210 /* SyntaxKind.CallExpression */) { return false; } var callTarget = statementExpression.expression; @@ -103010,7 +104228,7 @@ var ts; return false; } var callArgument = ts.singleOrUndefined(statementExpression.arguments); - if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 225 /* SyntaxKind.SpreadElement */) { + if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 227 /* SyntaxKind.SpreadElement */) { return false; } var expression = callArgument.expression; @@ -103036,15 +104254,15 @@ var ts; if (compilerOptions.jsx === 1 /* JsxEmit.Preserve */ || compilerOptions.jsx === 3 /* JsxEmit.ReactNative */) { previousOnEmitNode = context.onEmitNode; context.onEmitNode = onEmitNode; - context.enableEmitNotification(280 /* SyntaxKind.JsxOpeningElement */); - context.enableEmitNotification(281 /* SyntaxKind.JsxClosingElement */); - context.enableEmitNotification(279 /* SyntaxKind.JsxSelfClosingElement */); + context.enableEmitNotification(283 /* SyntaxKind.JsxOpeningElement */); + context.enableEmitNotification(284 /* SyntaxKind.JsxClosingElement */); + context.enableEmitNotification(282 /* SyntaxKind.JsxSelfClosingElement */); noSubstitution = []; } var previousOnSubstituteNode = context.onSubstituteNode; context.onSubstituteNode = onSubstituteNode; - context.enableSubstitution(206 /* SyntaxKind.PropertyAccessExpression */); - context.enableSubstitution(296 /* SyntaxKind.PropertyAssignment */); + context.enableSubstitution(208 /* SyntaxKind.PropertyAccessExpression */); + context.enableSubstitution(299 /* SyntaxKind.PropertyAssignment */); return ts.chainBundle(context, transformSourceFile); /** * Transforms an ES5 source file to ES3. @@ -103063,9 +104281,9 @@ var ts; */ function onEmitNode(hint, node, emitCallback) { switch (node.kind) { - case 280 /* SyntaxKind.JsxOpeningElement */: - case 281 /* SyntaxKind.JsxClosingElement */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: var tagName = node.tagName; noSubstitution[ts.getOriginalNodeId(tagName)] = true; break; @@ -103400,13 +104618,13 @@ var ts; */ function visitJavaScriptInStatementContainingYield(node) { switch (node.kind) { - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); default: return visitJavaScriptInGeneratorFunctionBody(node); @@ -103419,24 +104637,24 @@ var ts; */ function visitJavaScriptInGeneratorFunctionBody(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return visitAccessorDeclaration(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return visitBreakStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return visitContinueStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return visitReturnStatement(node); default: if (node.transformFlags & 1048576 /* TransformFlags.ContainsYield */) { @@ -103457,23 +104675,23 @@ var ts; */ function visitJavaScriptContainingYield(node) { switch (node.kind) { - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return visitBinaryExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return visitCommaListExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return visitConditionalExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return visitYieldExpression(node); - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return visitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return visitObjectLiteralExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return visitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return visitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return visitNewExpression(node); default: return ts.visitEachChild(node, visitor, context); @@ -103486,9 +104704,9 @@ var ts; */ function visitGenerator(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return visitFunctionExpression(node); default: return ts.Debug.failBadSyntaxKind(node); @@ -103695,7 +104913,7 @@ var ts; if (containsYield(right)) { var target = void 0; switch (left.kind) { - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: // [source] // a.b = yield; // @@ -103707,7 +104925,7 @@ var ts; // _a.b = %sent%; target = factory.updatePropertyAccessExpression(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name); break; - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: // [source] // a[b] = yield; // @@ -104101,35 +105319,35 @@ var ts; } function transformAndEmitStatementWorker(node) { switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return transformAndEmitBlock(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return transformAndEmitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return transformAndEmitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return transformAndEmitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return transformAndEmitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return transformAndEmitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return transformAndEmitForInStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return transformAndEmitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return transformAndEmitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return transformAndEmitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return transformAndEmitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return transformAndEmitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return transformAndEmitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return transformAndEmitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return transformAndEmitTryStatement(node); default: return emitStatement(ts.visitNode(node, visitor, ts.isStatement)); @@ -104360,7 +105578,6 @@ var ts; return node; } function transformAndEmitForInStatement(node) { - // TODO(rbuckton): Source map locations if (containsYield(node)) { // [source] // for (var p in o) { @@ -104368,34 +105585,41 @@ var ts; // } // // [intermediate] - // .local _a, _b, _i - // _a = []; - // for (_b in o) _a.push(_b); + // .local _b, _a, _c, _i + // _b = []; + // _a = o; + // for (_c in _a) _b.push(_c); // _i = 0; // .loop incrementLabel, endLoopLabel // .mark conditionLabel - // .brfalse endLoopLabel, (_i < _a.length) - // p = _a[_i]; + // .brfalse endLoopLabel, (_i < _b.length) + // _c = _b[_i]; + // .brfalse incrementLabel, (_c in _a) + // p = _c; // /*body*/ // .mark incrementLabel - // _b++; + // _c++; // .br conditionLabel // .endloop // .mark endLoopLabel - var keysArray = declareLocal(); // _a - var key = declareLocal(); // _b + var obj = declareLocal(); // _a + var keysArray = declareLocal(); // _b + var key = declareLocal(); // _c var keysIndex = factory.createLoopVariable(); // _i var initializer = node.initializer; hoistVariableDeclaration(keysIndex); + emitAssignment(obj, ts.visitNode(node.expression, visitor, ts.isExpression)); emitAssignment(keysArray, factory.createArrayLiteralExpression()); - emitStatement(factory.createForInStatement(key, ts.visitNode(node.expression, visitor, ts.isExpression), factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"), + emitStatement(factory.createForInStatement(key, obj, factory.createExpressionStatement(factory.createCallExpression(factory.createPropertyAccessExpression(keysArray, "push"), /*typeArguments*/ undefined, [key])))); emitAssignment(keysIndex, factory.createNumericLiteral(0)); var conditionLabel = defineLabel(); var incrementLabel = defineLabel(); - var endLabel = beginLoopBlock(incrementLabel); + var endLoopLabel = beginLoopBlock(incrementLabel); markLabel(conditionLabel); - emitBreakWhenFalse(endLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length"))); + emitBreakWhenFalse(endLoopLabel, factory.createLessThan(keysIndex, factory.createPropertyAccessExpression(keysArray, "length"))); + emitAssignment(key, factory.createElementAccessExpression(keysArray, keysIndex)); + emitBreakWhenFalse(incrementLabel, factory.createBinaryExpression(key, 101 /* SyntaxKind.InKeyword */, obj)); var variable = void 0; if (ts.isVariableDeclarationList(initializer)) { for (var _i = 0, _a = initializer.declarations; _i < _a.length; _i++) { @@ -104408,7 +105632,7 @@ var ts; variable = ts.visitNode(initializer, visitor, ts.isExpression); ts.Debug.assert(ts.isLeftHandSideExpression(variable)); } - emitAssignment(variable, factory.createElementAccessExpression(keysArray, keysIndex)); + emitAssignment(variable, key); transformAndEmitEmbeddedStatement(node.statement); markLabel(incrementLabel); emitStatement(factory.createExpressionStatement(factory.createPostfixIncrement(keysIndex))); @@ -104559,7 +105783,7 @@ var ts; for (var i = 0; i < numClauses; i++) { var clause = caseBlock.clauses[i]; clauseLabels.push(defineLabel()); - if (clause.kind === 290 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { + if (clause.kind === 293 /* SyntaxKind.DefaultClause */ && defaultClauseIndex === -1) { defaultClauseIndex = i; } } @@ -104572,7 +105796,7 @@ var ts; var defaultClausesSkipped = 0; for (var i = clausesWritten; i < numClauses; i++) { var clause = caseBlock.clauses[i]; - if (clause.kind === 289 /* SyntaxKind.CaseClause */) { + if (clause.kind === 292 /* SyntaxKind.CaseClause */) { if (containsYield(clause.expression) && pendingClauses.length > 0) { break; } @@ -105732,12 +106956,12 @@ var ts; var previousOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(208 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. - context.enableSubstitution(210 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(210 /* SyntaxKind.CallExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. + context.enableSubstitution(212 /* SyntaxKind.TaggedTemplateExpression */); // Substitute calls to imported/exported symbols to avoid incorrect `this`. context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers with imported/exported symbols. - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols. + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var currentSourceFile; // The current file. @@ -106065,23 +107289,23 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -106094,26 +107318,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node) && currentSourceFile.impliedNodeFormat === undefined) { return visitImportCallExpression(node); } break; - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPreOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -106129,24 +107353,24 @@ var ts; for (var _i = 0, _a = node.properties; _i < _a.length; _i++) { var elem = _a[_i]; switch (elem.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: if (destructuringNeedsFlattening(elem.initializer)) { return true; } break; - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: if (destructuringNeedsFlattening(elem.name)) { return true; } break; - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: if (destructuringNeedsFlattening(elem.expression)) { return true; } break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return false; default: ts.Debug.assertNever(elem, "Unhandled object member kind"); } @@ -106249,7 +107473,7 @@ var ts; return createImportCallExpressionUMD(argument !== null && argument !== void 0 ? argument : factory.createVoidZero(), containsLexicalThis); case ts.ModuleKind.CommonJS: default: - return createImportCallExpressionCommonJS(argument, containsLexicalThis); + return createImportCallExpressionCommonJS(argument); } } function createImportCallExpressionUMD(arg, containsLexicalThis) { @@ -106272,7 +107496,7 @@ var ts; return factory.createConditionalExpression( /*condition*/ factory.createIdentifier("__syncRequire"), /*questionToken*/ undefined, - /*whenTrue*/ createImportCallExpressionCommonJS(arg, containsLexicalThis), + /*whenTrue*/ createImportCallExpressionCommonJS(arg), /*colonToken*/ undefined, /*whenFalse*/ createImportCallExpressionAMD(argClone, containsLexicalThis)); } @@ -106281,7 +107505,7 @@ var ts; return factory.createComma(factory.createAssignment(temp, arg), factory.createConditionalExpression( /*condition*/ factory.createIdentifier("__syncRequire"), /*questionToken*/ undefined, - /*whenTrue*/ createImportCallExpressionCommonJS(temp, containsLexicalThis), + /*whenTrue*/ createImportCallExpressionCommonJS(temp, /* isInlineable */ true), /*colonToken*/ undefined, /*whenFalse*/ createImportCallExpressionAMD(temp, containsLexicalThis))); } @@ -106331,14 +107555,20 @@ var ts; } return promise; } - function createImportCallExpressionCommonJS(arg, containsLexicalThis) { - // import("./blah") + function createImportCallExpressionCommonJS(arg, isInlineable) { + // import(x) // emit as - // Promise.resolve().then(function () { return require(x); }) /*CommonJs Require*/ + // var _a; + // (_a = x, Promise.resolve().then(() => require(_a)) /*CommonJs Require*/ // We have to wrap require in then callback so that require is done in asynchronously // if we simply do require in resolve callback in Promise constructor. We will execute the loading immediately - var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), /*typeArguments*/ undefined, /*argumentsArray*/ []); - var requireCall = factory.createCallExpression(factory.createIdentifier("require"), /*typeArguments*/ undefined, arg ? [arg] : []); + // If the arg is not inlineable, we have to evaluate it in the current scope with a temp var + var temp = arg && !ts.isSimpleInlineableExpression(arg) && !isInlineable ? factory.createTempVariable(hoistVariableDeclaration) : undefined; + var promiseResolveCall = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier("Promise"), "resolve"), + /*typeArguments*/ undefined, + /*argumentsArray*/ []); + var requireCall = factory.createCallExpression(factory.createIdentifier("require"), + /*typeArguments*/ undefined, temp ? [temp] : arg ? [arg] : []); if (ts.getESModuleInterop(compilerOptions)) { requireCall = emitHelpers().createImportStarHelper(requireCall); } @@ -106359,14 +107589,9 @@ var ts; /*typeParameters*/ undefined, /*parameters*/ [], /*type*/ undefined, factory.createBlock([factory.createReturnStatement(requireCall)])); - // if there is a lexical 'this' in the import call arguments, ensure we indicate - // that this new function expression indicates it captures 'this' so that the - // es2015 transformer will properly substitute 'this' with '_this'. - if (containsLexicalThis) { - ts.setEmitFlags(func, 8 /* EmitFlags.CapturesThis */); - } } - return factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]); + var downleveledImport = factory.createCallExpression(factory.createPropertyAccessExpression(promiseResolveCall, "then"), /*typeArguments*/ undefined, [func]); + return temp === undefined ? downleveledImport : factory.createCommaListExpression([factory.createAssignment(temp, arg), downleveledImport]); } function getHelperExpressionForExport(node, innerExpr) { if (!ts.getESModuleInterop(compilerOptions) || ts.getEmitFlags(node) & 67108864 /* EmitFlags.NeverApplyImportHelper */) { @@ -106732,7 +107957,7 @@ var ts; // // To balance the declaration, add the exports of the elided variable // statement. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original); } @@ -106787,10 +108012,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding, /* liveBinding */ true); @@ -106874,7 +108099,7 @@ var ts; return statements; } if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createIdentifier("default") : factory.getDeclarationName(decl); statements = appendExportStatement(statements, exportName, factory.getLocalName(decl), /*location*/ decl); } if (decl.name) { @@ -107003,7 +108228,7 @@ var ts; * @param emit A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { currentSourceFile = node; currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)]; previousOnEmitNode(hint, node, emitCallback); @@ -107065,11 +108290,11 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return substituteCallExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return substituteTaggedTemplateExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); } return node; @@ -107113,7 +108338,7 @@ var ts; } else if (!(ts.isGeneratedIdentifier(node) && !(node.autoGenerateFlags & 64 /* GeneratedIdentifierFlags.AllowNameSubstitution */)) && !ts.isLocalName(node)) { var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node)); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { return ts.setTextRange(factory.createPropertyAccessExpression(factory.createIdentifier("exports"), factory.cloneNode(node)), /*location*/ node); } @@ -107203,10 +108428,10 @@ var ts; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; context.enableSubstitution(79 /* SyntaxKind.Identifier */); // Substitutes expression identifiers for imported symbols. - context.enableSubstitution(297 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols - context.enableSubstitution(221 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. - context.enableSubstitution(231 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. + context.enableSubstitution(300 /* SyntaxKind.ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols + context.enableSubstitution(223 /* SyntaxKind.BinaryExpression */); // Substitutes assignments to exported symbols. + context.enableSubstitution(233 /* SyntaxKind.MetaProperty */); // Substitutes 'import.meta' + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); // Restore state when substituting nodes in a file. var moduleInfoMap = []; // The ExternalModuleInfo for each file. var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found. var exportFunctionsMap = []; // The export function associated with a source file. @@ -107396,7 +108621,7 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, endLexicalEnvironment()); var exportStarFunction = addExportStarIfNeeded(statements); // TODO: GH#18217 var modifiers = node.transformFlags & 2097152 /* TransformFlags.ContainsAwait */ ? - factory.createModifiersFromModifierFlags(256 /* ModifierFlags.Async */) : + factory.createModifiersFromModifierFlags(512 /* ModifierFlags.Async */) : undefined; var moduleObject = factory.createObjectLiteralExpression([ factory.createPropertyAssignment("setters", createSettersArray(exportStarFunction, dependencyGroups)), @@ -107430,7 +108655,7 @@ var ts; var hasExportDeclarationWithExportClause = false; for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) { var externalImport = _a[_i]; - if (externalImport.kind === 272 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { + if (externalImport.kind === 275 /* SyntaxKind.ExportDeclaration */ && externalImport.exportClause) { hasExportDeclarationWithExportClause = true; break; } @@ -107519,19 +108744,26 @@ var ts; var entry = _b[_a]; var importVariableName = ts.getLocalNameForExternalImport(factory, entry, currentSourceFile); // TODO: GH#18217 switch (entry.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: if (!entry.importClause) { // 'import "..."' case // module is imported only for side-effects, no emit required break; } // falls through - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: ts.Debug.assert(importVariableName !== undefined); // save import into the local statements.push(factory.createExpressionStatement(factory.createAssignment(importVariableName, parameterName))); + if (ts.hasSyntacticModifier(entry, 1 /* ModifierFlags.Export */)) { + statements.push(factory.createExpressionStatement(factory.createCallExpression(exportFunction, + /*typeArguments*/ undefined, [ + factory.createStringLiteral(ts.idText(importVariableName)), + parameterName, + ]))); + } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: ts.Debug.assert(importVariableName !== undefined); if (entry.exportClause) { if (ts.isNamedExports(entry.exportClause)) { @@ -107590,13 +108822,13 @@ var ts; */ function topLevelVisitor(node) { switch (node.kind) { - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return visitImportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return visitImportEqualsDeclaration(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return visitExportDeclaration(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); default: return topLevelNestedVisitor(node); @@ -107775,7 +109007,7 @@ var ts; function shouldHoistVariableDeclarationList(node) { // hoist only non-block scoped declarations or block scoped declarations parented by source file return (ts.getEmitFlags(node) & 2097152 /* EmitFlags.NoHoisting */) === 0 - && (enclosingBlockScopedContainer.kind === 305 /* SyntaxKind.SourceFile */ + && (enclosingBlockScopedContainer.kind === 308 /* SyntaxKind.SourceFile */ || (ts.getOriginalNode(node).flags & 3 /* NodeFlags.BlockScoped */) === 0); } /** @@ -107839,7 +109071,7 @@ var ts; // // To balance the declaration, we defer the exports of the elided variable // statement until we visit this declaration's `EndOfDeclarationMarker`. - if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 237 /* SyntaxKind.VariableStatement */) { + if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 240 /* SyntaxKind.VariableStatement */) { var id = ts.getOriginalNodeId(node); var isExportedDeclaration = ts.hasSyntacticModifier(node.original, 1 /* ModifierFlags.Export */); deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration); @@ -107901,10 +109133,10 @@ var ts; var namedBindings = importClause.namedBindings; if (namedBindings) { switch (namedBindings.kind) { - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: statements = appendExportsOfDeclaration(statements, namedBindings); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) { var importBinding = _a[_i]; statements = appendExportsOfDeclaration(statements, importBinding); @@ -107999,7 +109231,7 @@ var ts; } var excludeName; if (ts.hasSyntacticModifier(decl, 1 /* ModifierFlags.Export */)) { - var exportName = ts.hasSyntacticModifier(decl, 512 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; + var exportName = ts.hasSyntacticModifier(decl, 1024 /* ModifierFlags.Default */) ? factory.createStringLiteral("default") : decl.name; statements = appendExportStatement(statements, exportName, factory.getLocalName(decl)); excludeName = ts.getTextOfIdentifierOrLiteral(exportName); } @@ -108084,43 +109316,43 @@ var ts; */ function topLevelNestedVisitor(node) { switch (node.kind) { - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return visitVariableStatement(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return visitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return visitClassDeclaration(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ true); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return visitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return visitForOfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return visitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return visitWhileStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return visitLabeledStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return visitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return visitSwitchStatement(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return visitCaseBlock(node); - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return visitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return visitDefaultClause(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return visitTryStatement(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return visitCatchClause(node); - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return visitBlock(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return visitMergeDeclarationMarker(node); - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return visitEndOfDeclarationMarker(node); default: return visitor(node); @@ -108306,26 +109538,26 @@ var ts; return node; } switch (node.kind) { - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return visitForStatement(node, /*isTopLevel*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return visitExpressionStatement(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return visitParenthesizedExpression(node, valueIsDiscarded); - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return visitPartiallyEmittedExpression(node, valueIsDiscarded); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: if (ts.isDestructuringAssignment(node)) { return visitDestructuringAssignment(node, valueIsDiscarded); } break; - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: if (ts.isImportCall(node)) { return visitImportCallExpression(node); } break; - case 219 /* SyntaxKind.PrefixUnaryExpression */: - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return visitPrefixOrPostfixUnaryExpression(node, valueIsDiscarded); } return ts.visitEachChild(node, visitor, context); @@ -108405,7 +109637,7 @@ var ts; } else if (ts.isIdentifier(node)) { var container = resolver.getReferencedExportContainer(node); - return container !== undefined && container.kind === 305 /* SyntaxKind.SourceFile */; + return container !== undefined && container.kind === 308 /* SyntaxKind.SourceFile */; } else { return false; @@ -108483,7 +109715,7 @@ var ts; * @param emitCallback A callback used to emit the node in the printer. */ function onEmitNode(hint, node, emitCallback) { - if (node.kind === 305 /* SyntaxKind.SourceFile */) { + if (node.kind === 308 /* SyntaxKind.SourceFile */) { var id = ts.getOriginalNodeId(node); currentSourceFile = node; moduleInfo = moduleInfoMap[id]; @@ -108533,7 +109765,7 @@ var ts; */ function substituteUnspecified(node) { switch (node.kind) { - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return substituteShorthandPropertyAssignment(node); } return node; @@ -108570,9 +109802,9 @@ var ts; switch (node.kind) { case 79 /* SyntaxKind.Identifier */: return substituteExpressionIdentifier(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return substituteBinaryExpression(node); - case 231 /* SyntaxKind.MetaProperty */: + case 233 /* SyntaxKind.MetaProperty */: return substituteMetaProperty(node); } return node; @@ -108662,7 +109894,7 @@ var ts; || resolver.getReferencedValueDeclaration(name); if (valueDeclaration) { var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false); - if (exportContainer && exportContainer.kind === 305 /* SyntaxKind.SourceFile */) { + if (exportContainer && exportContainer.kind === 308 /* SyntaxKind.SourceFile */) { exportedNames = ts.append(exportedNames, factory.getDeclarationName(valueDeclaration)); } exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]); @@ -108705,7 +109937,7 @@ var ts; var previousOnSubstituteNode = context.onSubstituteNode; context.onEmitNode = onEmitNode; context.onSubstituteNode = onSubstituteNode; - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); context.enableSubstitution(79 /* SyntaxKind.Identifier */); var helperNameSubstitutions; var currentSourceFile; @@ -108745,14 +109977,14 @@ var ts; } function visitor(node) { switch (node.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: // Though an error in es2020 modules, in node-flavor es2020 modules, we can helpfully transform this to a synthetic `require` call // To give easy access to a synchronous `require` in node-flavor esm. We do the transform even in scenarios where we error, but `import.meta.url` // is available, just because the output is reasonable for a node-like runtime. return ts.getEmitModuleKind(compilerOptions) >= ts.ModuleKind.Node16 ? visitImportEqualsDeclaration(node) : undefined; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return visitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: var exportDecl = node; return visitExportDeclaration(exportDecl); } @@ -108909,8 +110141,8 @@ var ts; var cjsOnEmitNode = context.onEmitNode; context.onSubstituteNode = onSubstituteNode; context.onEmitNode = onEmitNode; - context.enableSubstitution(305 /* SyntaxKind.SourceFile */); - context.enableEmitNotification(305 /* SyntaxKind.SourceFile */); + context.enableSubstitution(308 /* SyntaxKind.SourceFile */); + context.enableEmitNotification(308 /* SyntaxKind.SourceFile */); var currentSourceFile; return transformSourceFileOrBundle; function onSubstituteNode(hint, node) { @@ -108957,7 +110189,7 @@ var ts; return result; } function transformSourceFileOrBundle(node) { - return node.kind === 305 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); + return node.kind === 308 /* SyntaxKind.SourceFile */ ? transformSourceFile(node) : transformBundle(node); } function transformBundle(node) { return context.factory.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends); @@ -109017,7 +110249,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109046,7 +110278,7 @@ var ts; ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109093,7 +110325,7 @@ var ts; return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: ".concat(ts.Debug.formatSyntaxKind(node.kind))); } function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109102,8 +110334,8 @@ var ts; } // This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit // The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all. - else if (node.kind === 167 /* SyntaxKind.PropertyDeclaration */ || node.kind === 206 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 166 /* SyntaxKind.PropertySignature */ || - (node.kind === 164 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { + else if (node.kind === 169 /* SyntaxKind.PropertyDeclaration */ || node.kind === 208 /* SyntaxKind.PropertyAccessExpression */ || node.kind === 168 /* SyntaxKind.PropertySignature */ || + (node.kind === 166 /* SyntaxKind.Parameter */ && ts.hasSyntacticModifier(node.parent, 8 /* ModifierFlags.Private */))) { // TODO(jfreeman): Deal with computed properties in error reporting. if (ts.isStatic(node)) { return symbolAccessibilityResult.errorModuleName ? @@ -109112,7 +110344,7 @@ var ts; ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */ || node.kind === 164 /* SyntaxKind.Parameter */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */ || node.kind === 166 /* SyntaxKind.Parameter */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109137,7 +110369,7 @@ var ts; } function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Getters can infer the return type from the returned expression, but setters cannot, so the // "_from_external_module_1_but_cannot_be_named" case cannot occur. if (ts.isStatic(node)) { @@ -109176,26 +110408,26 @@ var ts; function getReturnTypeVisibilityError(symbolAccessibilityResult) { var diagnosticMessage; switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have return types that cannot be named diagnosticMessage = symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node)) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109203,7 +110435,7 @@ var ts; ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 : ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0; } - else if (node.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109217,7 +110449,7 @@ var ts; ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0; } break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named : @@ -109242,30 +110474,30 @@ var ts; } function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) { switch (node.parent.kind) { - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1; - case 175 /* SyntaxKind.ConstructSignature */: - case 180 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: // Interfaces cannot have parameter types that cannot be named return symbolAccessibilityResult.errorModuleName ? ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? @@ -109273,7 +110505,7 @@ var ts; ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109286,15 +110518,15 @@ var ts; ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } - case 256 /* SyntaxKind.FunctionDeclaration */: - case 179 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2 : ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_private_name_1; - case 173 /* SyntaxKind.SetAccessor */: - case 172 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: return symbolAccessibilityResult.errorModuleName ? symbolAccessibilityResult.accessibility === 2 /* SymbolAccessibility.CannotBeNamed */ ? ts.Diagnostics.Parameter_0_of_accessor_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named : @@ -109308,39 +110540,39 @@ var ts; // Type parameter constraints are named by user so we should always be able to name it var diagnosticMessage; switch (node.parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1; break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1; break; - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1; break; - case 180 /* SyntaxKind.ConstructorType */: - case 175 /* SyntaxKind.ConstructSignature */: + case 182 /* SyntaxKind.ConstructorType */: + case 177 /* SyntaxKind.ConstructSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1; break; - case 169 /* SyntaxKind.MethodDeclaration */: - case 168 /* SyntaxKind.MethodSignature */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: if (ts.isStatic(node.parent)) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1; } - else if (node.parent.parent.kind === 257 /* SyntaxKind.ClassDeclaration */) { + else if (node.parent.parent.kind === 260 /* SyntaxKind.ClassDeclaration */) { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1; } else { diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1; } break; - case 179 /* SyntaxKind.FunctionType */: - case 256 /* SyntaxKind.FunctionDeclaration */: + case 181 /* SyntaxKind.FunctionType */: + case 259 /* SyntaxKind.FunctionDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1; break; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1; break; default: @@ -109406,7 +110638,7 @@ var ts; } function isInternalDeclaration(node, currentSourceFile) { var parseTreeNode = ts.getParseTreeNode(node); - if (parseTreeNode && parseTreeNode.kind === 164 /* SyntaxKind.Parameter */) { + if (parseTreeNode && parseTreeNode.kind === 166 /* SyntaxKind.Parameter */) { var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode); var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined; var text = currentSourceFile.text; @@ -109582,7 +110814,7 @@ var ts; var _a; var primaryDeclaration = (_a = parentSymbol.declarations) === null || _a === void 0 ? void 0 : _a.find(function (d) { return ts.getSourceFileOfNode(d) === containingFile; }); var augmentingDeclarations = ts.filter(symbol.declarations, function (d) { return ts.getSourceFileOfNode(d) !== containingFile; }); - if (augmentingDeclarations) { + if (primaryDeclaration && augmentingDeclarations) { for (var _i = 0, augmentingDeclarations_1 = augmentingDeclarations; _i < augmentingDeclarations_1.length; _i++) { var augmentations = augmentingDeclarations_1[_i]; context.addDiagnostic(ts.addRelatedInfo(ts.createDiagnosticForNode(augmentations, ts.Diagnostics.Declaration_augments_declaration_in_another_file_This_cannot_be_serialized), ts.createDiagnosticForNode(primaryDeclaration, ts.Diagnostics.This_is_the_declaration_being_augmented_Consider_moving_the_augmenting_declaration_into_the_same_file))); @@ -109612,10 +110844,10 @@ var ts; return result; } function transformRoot(node) { - if (node.kind === 305 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { + if (node.kind === 308 /* SyntaxKind.SourceFile */ && node.isDeclarationFile) { return node; } - if (node.kind === 306 /* SyntaxKind.Bundle */) { + if (node.kind === 309 /* SyntaxKind.Bundle */) { isBundledEmit = true; refs = new ts.Map(); libs = new ts.Map(); @@ -109638,14 +110870,14 @@ var ts; resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules) needsDeclare = false; var statements = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile, /*bundled*/ true)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); - var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); + var newFile = factory.updateSourceFile(sourceFile, [factory.createModuleDeclaration([factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)], factory.createStringLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), factory.createModuleBlock(ts.setTextRange(factory.createNodeArray(transformAndReplaceLatePaintedStatements(statements)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); return newFile; } needsDeclare = true; var updated = ts.isSourceFileJS(sourceFile) ? factory.createNodeArray(transformDeclarationsForJS(sourceFile)) : ts.visitNodes(sourceFile.statements, visitDeclarationStatements); return factory.updateSourceFile(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []); }), ts.mapDefined(node.prepends, function (prepend) { - if (prepend.kind === 308 /* SyntaxKind.InputFiles */) { + if (prepend.kind === 311 /* SyntaxKind.InputFiles */) { var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal); hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib; collectReferences(sourceFile, refs); @@ -109786,7 +111018,7 @@ var ts; return name; } else { - if (name.kind === 202 /* SyntaxKind.ArrayBindingPattern */) { + if (name.kind === 204 /* SyntaxKind.ArrayBindingPattern */) { return factory.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement)); } else { @@ -109794,7 +111026,7 @@ var ts; } } function visitBindingElement(elem) { - if (elem.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (elem.kind === 229 /* SyntaxKind.OmittedExpression */) { return elem; } if (elem.propertyName && ts.isIdentifier(elem.propertyName) && ts.isIdentifier(elem.name) && !elem.symbol.isReferenced) { @@ -109836,19 +111068,19 @@ var ts; // Literal const declarations will have an initializer ensured rather than a type return; } - var shouldUseResolverType = node.kind === 164 /* SyntaxKind.Parameter */ && + var shouldUseResolverType = node.kind === 166 /* SyntaxKind.Parameter */ && (resolver.isRequiredInitializedParameter(node) || resolver.isOptionalUninitializedParameterProperty(node)); if (type && !shouldUseResolverType) { return ts.visitNode(type, visitDeclarationSubtree); } if (!ts.getParseTreeNode(node)) { - return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return type ? ts.visitNode(type, visitDeclarationSubtree) : factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } - if (node.kind === 173 /* SyntaxKind.SetAccessor */) { + if (node.kind === 175 /* SyntaxKind.SetAccessor */) { // Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now // (The inferred type here will be void, but the old declaration emitter printed `any`, so this replicates that) - return factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } errorNameNode = node.name; var oldDiag; @@ -109856,12 +111088,12 @@ var ts; oldDiag = getSymbolAccessibilityDiagnostic; getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node); } - if (node.kind === 254 /* SyntaxKind.VariableDeclaration */ || node.kind === 203 /* SyntaxKind.BindingElement */) { + if (node.kind === 257 /* SyntaxKind.VariableDeclaration */ || node.kind === 205 /* SyntaxKind.BindingElement */) { return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); } - if (node.kind === 164 /* SyntaxKind.Parameter */ - || node.kind === 167 /* SyntaxKind.PropertyDeclaration */ - || node.kind === 166 /* SyntaxKind.PropertySignature */) { + if (node.kind === 166 /* SyntaxKind.Parameter */ + || node.kind === 169 /* SyntaxKind.PropertyDeclaration */ + || node.kind === 168 /* SyntaxKind.PropertySignature */) { if (ts.isPropertySignature(node) || !node.initializer) return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType)); return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker)); @@ -109872,28 +111104,28 @@ var ts; if (!suppressNewDiagnosticContexts) { getSymbolAccessibilityDiagnostic = oldDiag; } - return returnValue || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */); + return returnValue || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */); } } function isDeclarationAndNotVisible(node) { node = ts.getParseTreeNode(node); switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return !resolver.isDeclarationVisible(node); // The following should be doing their own visibility checks based on filtering their members - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return !getBindingNameVisible(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return false; - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return true; } return false; @@ -109982,7 +111214,7 @@ var ts; function rewriteModuleSpecifier(parent, input) { if (!input) return undefined; // TODO: GH#18217 - resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 261 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 200 /* SyntaxKind.ImportType */); + resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 264 /* SyntaxKind.ModuleDeclaration */ && parent.kind !== 202 /* SyntaxKind.ImportType */); if (ts.isStringLiteralLike(input)) { if (isBundledEmit) { var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent); @@ -110002,7 +111234,7 @@ var ts; function transformImportEqualsDeclaration(decl) { if (!resolver.isDeclarationVisible(decl)) return; - if (decl.moduleReference.kind === 277 /* SyntaxKind.ExternalModuleReference */) { + if (decl.moduleReference.kind === 280 /* SyntaxKind.ExternalModuleReference */) { // Rewrite external module names if necessary var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl); return factory.updateImportEqualsDeclaration(decl, decl.modifiers, decl.isTypeOnly, decl.name, factory.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier))); @@ -110027,7 +111259,7 @@ var ts; return visibleDefaultBinding && factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, /*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)); } - if (decl.importClause.namedBindings.kind === 268 /* SyntaxKind.NamespaceImport */) { + if (decl.importClause.namedBindings.kind === 271 /* SyntaxKind.NamespaceImport */) { // Namespace import (optionally with visible default) var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined; return visibleDefaultBinding || namedBindings ? factory.updateImportDeclaration(decl, decl.modifiers, factory.updateImportClause(decl.importClause, decl.importClause.isTypeOnly, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier), getResolutionModeOverrideForClauseInNightly(decl.assertClause)) : undefined; @@ -110130,7 +111362,7 @@ var ts; // We'd see a TDZ violation at runtime var canProduceDiagnostic = ts.canProduceDiagnostics(input); var oldWithinObjectLiteralType = suppressNewDiagnosticContexts; - var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 182 /* SyntaxKind.TypeLiteral */ || input.kind === 195 /* SyntaxKind.MappedType */) && input.parent.kind !== 259 /* SyntaxKind.TypeAliasDeclaration */); + var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 184 /* SyntaxKind.TypeLiteral */ || input.kind === 197 /* SyntaxKind.MappedType */) && input.parent.kind !== 262 /* SyntaxKind.TypeAliasDeclaration */); // Emit methods which are private as properties with no type information if (ts.isMethodDeclaration(input) || ts.isMethodSignature(input)) { if (ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)) { @@ -110151,28 +111383,28 @@ var ts; } if (isProcessedComponent(input)) { switch (input.kind) { - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: { + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: { if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) { checkEntityNameVisibility(input.expression, enclosingDeclaration); } var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateExpressionWithTypeArguments(node, node.expression, node.typeArguments)); } - case 178 /* SyntaxKind.TypeReference */: { + case 180 /* SyntaxKind.TypeReference */: { checkEntityNameVisibility(input.typeName, enclosingDeclaration); var node = ts.visitEachChild(input, visitDeclarationSubtree, context); return cleanup(factory.updateTypeReferenceNode(node, node.typeName, node.typeArguments)); } - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return cleanup(factory.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); - case 171 /* SyntaxKind.Constructor */: { + case 173 /* SyntaxKind.Constructor */: { // A constructor declaration may not have a type annotation var ctor = factory.createConstructorDeclaration( /*modifiers*/ ensureModifiers(input), updateParamsList(input, input.parameters, 0 /* ModifierFlags.None */), /*body*/ undefined); return cleanup(ctor); } - case 169 /* SyntaxKind.MethodDeclaration */: { + case 171 /* SyntaxKind.MethodDeclaration */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110181,7 +111413,7 @@ var ts; /*body*/ undefined); return cleanup(sig); } - case 172 /* SyntaxKind.GetAccessor */: { + case 174 /* SyntaxKind.GetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } @@ -110189,36 +111421,36 @@ var ts; return cleanup(factory.updateGetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), ensureType(input, accessorType), /*body*/ undefined)); } - case 173 /* SyntaxKind.SetAccessor */: { + case 175 /* SyntaxKind.SetAccessor */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateSetAccessorDeclaration(input, ensureModifiers(input), input.name, updateAccessorParamsList(input, ts.hasEffectiveModifier(input, 8 /* ModifierFlags.Private */)), /*body*/ undefined)); } - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertyDeclaration(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type), ensureNoInitializer(input))); - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, ensureType(input, input.type))); - case 168 /* SyntaxKind.MethodSignature */: { + case 170 /* SyntaxKind.MethodSignature */: { if (ts.isPrivateIdentifier(input.name)) { return cleanup(/*returnValue*/ undefined); } return cleanup(factory.updateMethodSignature(input, ensureModifiers(input), input.name, input.questionToken, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 174 /* SyntaxKind.CallSignature */: { + case 176 /* SyntaxKind.CallSignature */: { return cleanup(factory.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type))); } - case 176 /* SyntaxKind.IndexSignature */: { - return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(130 /* SyntaxKind.AnyKeyword */))); + case 178 /* SyntaxKind.IndexSignature */: { + return cleanup(factory.updateIndexSignature(input, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || factory.createKeywordTypeNode(131 /* SyntaxKind.AnyKeyword */))); } - case 254 /* SyntaxKind.VariableDeclaration */: { + case 257 /* SyntaxKind.VariableDeclaration */: { if (ts.isBindingPattern(input.name)) { return recreateBindingPattern(input.name); } @@ -110226,13 +111458,13 @@ var ts; suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types return cleanup(factory.updateVariableDeclaration(input, input.name, /*exclamationToken*/ undefined, ensureType(input, input.type), ensureNoInitializer(input))); } - case 163 /* SyntaxKind.TypeParameter */: { + case 165 /* SyntaxKind.TypeParameter */: { if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) { return cleanup(factory.updateTypeParameterDeclaration(input, input.modifiers, input.name, /*constraint*/ undefined, /*defaultType*/ undefined)); } return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context)); } - case 189 /* SyntaxKind.ConditionalType */: { + case 191 /* SyntaxKind.ConditionalType */: { // We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration // just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type. var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree); @@ -110244,13 +111476,13 @@ var ts; var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree); return cleanup(factory.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType)); } - case 179 /* SyntaxKind.FunctionType */: { + case 181 /* SyntaxKind.FunctionType */: { return cleanup(factory.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 180 /* SyntaxKind.ConstructorType */: { + case 182 /* SyntaxKind.ConstructorType */: { return cleanup(factory.updateConstructorTypeNode(input, ensureModifiers(input), ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree))); } - case 200 /* SyntaxKind.ImportType */: { + case 202 /* SyntaxKind.ImportType */: { if (!ts.isLiteralImportTypeNode(input)) return cleanup(input); return cleanup(factory.updateImportTypeNode(input, factory.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.assertions, input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf)); @@ -110282,7 +111514,7 @@ var ts; } } function isPrivateMethodTypeParameter(node) { - return node.parent.kind === 169 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); + return node.parent.kind === 171 /* SyntaxKind.MethodDeclaration */ && ts.hasEffectiveModifier(node.parent, 8 /* ModifierFlags.Private */); } function visitDeclarationStatements(input) { if (!isPreservedDeclarationStatement(input)) { @@ -110292,7 +111524,7 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 272 /* SyntaxKind.ExportDeclaration */: { + case 275 /* SyntaxKind.ExportDeclaration */: { if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; } @@ -110301,7 +111533,7 @@ var ts; // Rewrite external module names if necessary return factory.updateExportDeclaration(input, input.modifiers, input.isTypeOnly, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier), ts.getResolutionModeOverrideForClause(input.assertClause) ? input.assertClause : undefined); } - case 271 /* SyntaxKind.ExportAssignment */: { + case 274 /* SyntaxKind.ExportAssignment */: { // Always visible if the parent node isn't dropped for being not visible if (ts.isSourceFile(input.parent)) { resultHasExternalModuleIndicator = true; @@ -110319,7 +111551,7 @@ var ts; errorFallbackNode = input; var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); errorFallbackNode = undefined; - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); preserveJsDoc(statement, input); ts.removeAllComments(input); return [statement, factory.updateExportAssignment(input, input.modifiers, newId)]; @@ -110332,12 +111564,12 @@ var ts; return input; } function stripExportModifiers(statement) { - if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 512 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { + if (ts.isImportEqualsDeclaration(statement) || ts.hasEffectiveModifier(statement, 1024 /* ModifierFlags.Default */) || !ts.canHaveModifiers(statement)) { // `export import` statements should remain as-is, as imports are _not_ implicitly exported in an ambient namespace // Likewise, `export default` classes and the like and just be `default`, so we preserve their `export` modifiers, too return statement; } - var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (257023 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); + var modifiers = factory.createModifiersFromModifierFlags(ts.getEffectiveModifierFlags(statement) & (258047 /* ModifierFlags.All */ ^ 1 /* ModifierFlags.Export */)); return factory.updateModifiers(statement, modifiers); } function transformTopLevelDeclaration(input) { @@ -110348,10 +111580,10 @@ var ts; if (shouldStripInternal(input)) return; switch (input.kind) { - case 265 /* SyntaxKind.ImportEqualsDeclaration */: { + case 268 /* SyntaxKind.ImportEqualsDeclaration */: { return transformImportEqualsDeclaration(input); } - case 266 /* SyntaxKind.ImportDeclaration */: { + case 269 /* SyntaxKind.ImportDeclaration */: { return transformImportDeclaration(input); } } @@ -110372,12 +111604,16 @@ var ts; } var previousNeedsDeclare = needsDeclare; switch (input.kind) { - case 259 /* SyntaxKind.TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all - return cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); - case 258 /* SyntaxKind.InterfaceDeclaration */: { + case 262 /* SyntaxKind.TypeAliasDeclaration */: { + needsDeclare = false; + var clean = cleanup(factory.updateTypeAliasDeclaration(input, ensureModifiers(input), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode))); + needsDeclare = previousNeedsDeclare; + return clean; + } + case 261 /* SyntaxKind.InterfaceDeclaration */: { return cleanup(factory.updateInterfaceDeclaration(input, ensureModifiers(input), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree))); } - case 256 /* SyntaxKind.FunctionDeclaration */: { + case 259 /* SyntaxKind.FunctionDeclaration */: { // Generators lose their generator-ness, excepting their return type var clean = cleanup(factory.updateFunctionDeclaration(input, ensureModifiers(input), /*asteriskToken*/ undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), @@ -110418,10 +111654,10 @@ var ts; })))); } var namespaceDecl = factory.createModuleDeclaration(ensureModifiers(input), input.name, factory.createModuleBlock(declarations), 16 /* NodeFlags.Namespace */); - if (!ts.hasEffectiveModifier(clean, 512 /* ModifierFlags.Default */)) { + if (!ts.hasEffectiveModifier(clean, 1024 /* ModifierFlags.Default */)) { return [clean, namespaceDecl]; } - var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~513 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); + var modifiers = factory.createModifiersFromModifierFlags((ts.getEffectiveModifierFlags(clean) & ~1025 /* ModifierFlags.ExportDefault */) | 2 /* ModifierFlags.Ambient */); var cleanDeclaration = factory.updateFunctionDeclaration(clean, modifiers, /*asteriskToken*/ undefined, clean.name, clean.typeParameters, clean.parameters, clean.type, /*body*/ undefined); @@ -110439,10 +111675,10 @@ var ts; return clean; } } - case 261 /* SyntaxKind.ModuleDeclaration */: { + case 264 /* SyntaxKind.ModuleDeclaration */: { needsDeclare = false; var inner = input.body; - if (inner && inner.kind === 262 /* SyntaxKind.ModuleBlock */) { + if (inner && inner.kind === 265 /* SyntaxKind.ModuleBlock */) { var oldNeedsScopeFix = needsScopeFixMarker; var oldHasScopeFix = resultHasScopeMarker; resultHasScopeMarker = false; @@ -110483,7 +111719,7 @@ var ts; return cleanup(factory.updateModuleDeclaration(input, mods, input.name, body)); } } - case 257 /* SyntaxKind.ClassDeclaration */: { + case 260 /* SyntaxKind.ClassDeclaration */: { errorNameNode = input.name; errorFallbackNode = input; var modifiers = factory.createNodeArray(ensureModifiers(input)); @@ -110545,7 +111781,7 @@ var ts; typeName: input.name }); }; var varDecl = factory.createVariableDeclaration(newId_1, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); - var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); + var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(136 /* SyntaxKind.DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* NodeFlags.Const */)); var heritageClauses = factory.createNodeArray(ts.map(input.heritageClauses, function (clause) { if (clause.token === 94 /* SyntaxKind.ExtendsKeyword */) { var oldDiag_2 = getSymbolAccessibilityDiagnostic; @@ -110563,10 +111799,10 @@ var ts; return cleanup(factory.updateClassDeclaration(input, modifiers, input.name, typeParameters, heritageClauses, members)); } } - case 237 /* SyntaxKind.VariableStatement */: { + case 240 /* SyntaxKind.VariableStatement */: { return cleanup(transformVariableStatement(input)); } - case 260 /* SyntaxKind.EnumDeclaration */: { + case 263 /* SyntaxKind.EnumDeclaration */: { return cleanup(factory.updateEnumDeclaration(input, factory.createNodeArray(ensureModifiers(input)), input.name, factory.createNodeArray(ts.mapDefined(input.members, function (m) { if (shouldStripInternal(m)) return; @@ -110585,7 +111821,7 @@ var ts; if (canProdiceDiagnostic) { getSymbolAccessibilityDiagnostic = oldDiag; } - if (input.kind === 261 /* SyntaxKind.ModuleDeclaration */) { + if (input.kind === 264 /* SyntaxKind.ModuleDeclaration */) { needsDeclare = previousNeedsDeclare; } if (node === input) { @@ -110608,7 +111844,7 @@ var ts; return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); })); } function recreateBindingElement(e) { - if (e.kind === 227 /* SyntaxKind.OmittedExpression */) { + if (e.kind === 229 /* SyntaxKind.OmittedExpression */) { return; } if (e.name) { @@ -110656,9 +111892,9 @@ var ts; return factory.createModifiersFromModifierFlags(newFlags); } function ensureModifierFlags(node) { - var mask = 257023 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 256 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files + var mask = 258047 /* ModifierFlags.All */ ^ (4 /* ModifierFlags.Public */ | 512 /* ModifierFlags.Async */ | 16384 /* ModifierFlags.Override */); // No async and override modifiers in declaration files var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* ModifierFlags.Ambient */ : 0 /* ModifierFlags.None */; - var parentIsFile = node.parent.kind === 305 /* SyntaxKind.SourceFile */; + var parentIsFile = node.parent.kind === 308 /* SyntaxKind.SourceFile */; if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) { mask ^= 2 /* ModifierFlags.Ambient */; additions = 0 /* ModifierFlags.None */; @@ -110687,7 +111923,7 @@ var ts; } ts.transformDeclarations = transformDeclarations; function isAlwaysType(node) { - if (node.kind === 258 /* SyntaxKind.InterfaceDeclaration */) { + if (node.kind === 261 /* SyntaxKind.InterfaceDeclaration */) { return true; } return false; @@ -110697,22 +111933,22 @@ var ts; return ts.factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); } function maskModifierFlags(node, modifierMask, modifierAdditions) { - if (modifierMask === void 0) { modifierMask = 257023 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } + if (modifierMask === void 0) { modifierMask = 258047 /* ModifierFlags.All */ ^ 4 /* ModifierFlags.Public */; } if (modifierAdditions === void 0) { modifierAdditions = 0 /* ModifierFlags.None */; } var flags = (ts.getEffectiveModifierFlags(node) & modifierMask) | modifierAdditions; - if (flags & 512 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { + if (flags & 1024 /* ModifierFlags.Default */ && !(flags & 1 /* ModifierFlags.Export */)) { // A non-exported default is a nonsequitor - we usually try to remove all export modifiers // from statements in ambient declarations; but a default export must retain its export modifier to be syntactically valid flags ^= 1 /* ModifierFlags.Export */; } - if (flags & 512 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { + if (flags & 1024 /* ModifierFlags.Default */ && flags & 2 /* ModifierFlags.Ambient */) { flags ^= 2 /* ModifierFlags.Ambient */; // `declare` is never required alongside `default` (and would be an error if printed) } return flags; } function getTypeAnnotationFromAccessor(accessor) { if (accessor) { - return accessor.kind === 172 /* SyntaxKind.GetAccessor */ + return accessor.kind === 174 /* SyntaxKind.GetAccessor */ ? accessor.type // Getter - return type : accessor.parameters.length > 0 ? accessor.parameters[0].type // Setter parameter type @@ -110721,52 +111957,52 @@ var ts; } function canHaveLiteralInitializer(node) { switch (node.kind) { - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: return !ts.hasEffectiveModifier(node, 8 /* ModifierFlags.Private */); - case 164 /* SyntaxKind.Parameter */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 257 /* SyntaxKind.VariableDeclaration */: return true; } return false; } function isPreservedDeclarationStatement(node) { switch (node.kind) { - case 256 /* SyntaxKind.FunctionDeclaration */: - case 261 /* SyntaxKind.ModuleDeclaration */: - case 265 /* SyntaxKind.ImportEqualsDeclaration */: - case 258 /* SyntaxKind.InterfaceDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 259 /* SyntaxKind.TypeAliasDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: - case 237 /* SyntaxKind.VariableStatement */: - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + case 240 /* SyntaxKind.VariableStatement */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: return true; } return false; } function isProcessedComponent(node) { switch (node.kind) { - case 175 /* SyntaxKind.ConstructSignature */: - case 171 /* SyntaxKind.Constructor */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 166 /* SyntaxKind.PropertySignature */: - case 168 /* SyntaxKind.MethodSignature */: - case 174 /* SyntaxKind.CallSignature */: - case 176 /* SyntaxKind.IndexSignature */: - case 254 /* SyntaxKind.VariableDeclaration */: - case 163 /* SyntaxKind.TypeParameter */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 178 /* SyntaxKind.TypeReference */: - case 189 /* SyntaxKind.ConditionalType */: - case 179 /* SyntaxKind.FunctionType */: - case 180 /* SyntaxKind.ConstructorType */: - case 200 /* SyntaxKind.ImportType */: + case 177 /* SyntaxKind.ConstructSignature */: + case 173 /* SyntaxKind.Constructor */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 168 /* SyntaxKind.PropertySignature */: + case 170 /* SyntaxKind.MethodSignature */: + case 176 /* SyntaxKind.CallSignature */: + case 178 /* SyntaxKind.IndexSignature */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 165 /* SyntaxKind.TypeParameter */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 180 /* SyntaxKind.TypeReference */: + case 191 /* SyntaxKind.ConditionalType */: + case 181 /* SyntaxKind.FunctionType */: + case 182 /* SyntaxKind.ConstructorType */: + case 202 /* SyntaxKind.ImportType */: return true; } return false; @@ -110906,7 +112142,7 @@ var ts; * @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files. */ function transformNodes(resolver, host, factory, options, nodes, transformers, allowDtsFiles) { - var enabledSyntaxKindFeatures = new Array(355 /* SyntaxKind.Count */); + var enabledSyntaxKindFeatures = new Array(358 /* SyntaxKind.Count */); var lexicalEnvironmentVariableDeclarations; var lexicalEnvironmentFunctionDeclarations; var lexicalEnvironmentStatements; @@ -110988,7 +112224,7 @@ var ts; var transformed = []; for (var _a = 0, nodes_3 = nodes; _a < nodes_3.length; _a++) { var node = nodes_3[_a]; - ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 305 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); + ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("emit" /* tracing.Phase.Emit */, "transformNodes", node.kind === 308 /* SyntaxKind.SourceFile */ ? { path: node.path } : { kind: node.kind, pos: node.pos, end: node.end }); transformed.push((allowDtsFiles ? transformation : transformRoot)(node)); ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.pop(); } @@ -111394,7 +112630,7 @@ var ts; /*@internal*/ function getOutputPathsFor(sourceFile, host, forceDtsPaths) { var options = host.getCompilerOptions(); - if (sourceFile.kind === 306 /* SyntaxKind.Bundle */) { + if (sourceFile.kind === 309 /* SyntaxKind.Bundle */) { return getOutputPathsForBundle(options, forceDtsPaths); } else { @@ -111763,8 +112999,8 @@ var ts; } function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, transform, printer, mapOptions) { var sourceFileOrBundle = transform.transformed[0]; - var bundle = sourceFileOrBundle.kind === 306 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; - var sourceFile = sourceFileOrBundle.kind === 305 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; + var bundle = sourceFileOrBundle.kind === 309 /* SyntaxKind.Bundle */ ? sourceFileOrBundle : undefined; + var sourceFile = sourceFileOrBundle.kind === 308 /* SyntaxKind.SourceFile */ ? sourceFileOrBundle : undefined; var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile]; var sourceMapGenerator; if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) { @@ -111814,7 +113050,7 @@ var ts; } function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) { return (mapOptions.sourceMap || mapOptions.inlineSourceMap) - && (sourceFileOrBundle.kind !== 305 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); + && (sourceFileOrBundle.kind !== 308 /* SyntaxKind.SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Extension.Json */)); } function getSourceRoot(mapOptions) { // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the @@ -111877,8 +113113,8 @@ var ts; } ts.getBuildInfoText = getBuildInfoText; /*@internal*/ - function getBuildInfo(buildInfoText) { - return JSON.parse(buildInfoText); + function getBuildInfo(buildInfoFile, buildInfoText) { + return ts.readJsonOrUndefined(buildInfoFile, buildInfoText); } ts.getBuildInfo = getBuildInfo; /*@internal*/ @@ -111956,17 +113192,16 @@ var ts; var buildInfo; if (host.getBuildInfo) { // If host directly provides buildinfo we can get it directly. This allows host to cache the buildinfo - var hostBuildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); - if (!hostBuildInfo) - return buildInfoPath; - buildInfo = hostBuildInfo; + buildInfo = host.getBuildInfo(buildInfoPath, config.options.configFilePath); } else { var buildInfoText = host.readFile(buildInfoPath); if (!buildInfoText) return buildInfoPath; - buildInfo = getBuildInfo(buildInfoText); + buildInfo = getBuildInfo(buildInfoPath, buildInfoText); } + if (!buildInfo) + return buildInfoPath; if (!buildInfo.bundle || !buildInfo.bundle.js || (declarationFilePath && !buildInfo.bundle.dts)) return buildInfoPath; var jsFileText = host.readFile(ts.Debug.checkDefined(jsFilePath)); @@ -112092,6 +113327,10 @@ var ts; var nodeIdToGeneratedName; // Map of generated names for specific nodes. var autoGeneratedIdToGeneratedName; // Map of generated names for temp and loop variables. var generatedNames; // Set of names generated by the NameGenerator. + var formattedNameTempFlagsStack; + var formattedNameTempFlags; + var privateNameTempFlagsStack; // Stack of enclosing name generation scopes. + var privateNameTempFlags; // TempFlags for the current name generation scope. var tempFlagsStack; // Stack of enclosing name generation scopes. var tempFlags; // TempFlags for the current name generation scope. var reservedNamesStack; // Stack of TempFlags reserved in enclosing name generation scopes. @@ -112157,9 +113396,9 @@ var ts; break; } switch (node.kind) { - case 305 /* SyntaxKind.SourceFile */: return printFile(node); - case 306 /* SyntaxKind.Bundle */: return printBundle(node); - case 307 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); + case 308 /* SyntaxKind.SourceFile */: return printFile(node); + case 309 /* SyntaxKind.Bundle */: return printBundle(node); + case 310 /* SyntaxKind.UnparsedSource */: return printUnparsedSource(node); } writeNode(hint, node, sourceFile, beginPrint()); return endPrint(); @@ -112350,6 +113589,10 @@ var ts; nodeIdToGeneratedName = []; autoGeneratedIdToGeneratedName = []; generatedNames = new ts.Set(); + formattedNameTempFlagsStack = []; + formattedNameTempFlags = new ts.Map(); + privateNameTempFlagsStack = []; + privateNameTempFlags = 0 /* TempFlags.Auto */; tempFlagsStack = []; tempFlags = 0 /* TempFlags.Auto */; reservedNamesStack = []; @@ -112493,315 +113736,315 @@ var ts; return emitPrivateIdentifier(node); // Parse tree nodes // Names - case 161 /* SyntaxKind.QualifiedName */: + case 163 /* SyntaxKind.QualifiedName */: return emitQualifiedName(node); - case 162 /* SyntaxKind.ComputedPropertyName */: + case 164 /* SyntaxKind.ComputedPropertyName */: return emitComputedPropertyName(node); // Signature elements - case 163 /* SyntaxKind.TypeParameter */: + case 165 /* SyntaxKind.TypeParameter */: return emitTypeParameter(node); - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: return emitParameter(node); - case 165 /* SyntaxKind.Decorator */: + case 167 /* SyntaxKind.Decorator */: return emitDecorator(node); // Type members - case 166 /* SyntaxKind.PropertySignature */: + case 168 /* SyntaxKind.PropertySignature */: return emitPropertySignature(node); - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: return emitPropertyDeclaration(node); - case 168 /* SyntaxKind.MethodSignature */: + case 170 /* SyntaxKind.MethodSignature */: return emitMethodSignature(node); - case 169 /* SyntaxKind.MethodDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: return emitMethodDeclaration(node); - case 170 /* SyntaxKind.ClassStaticBlockDeclaration */: + case 172 /* SyntaxKind.ClassStaticBlockDeclaration */: return emitClassStaticBlockDeclaration(node); - case 171 /* SyntaxKind.Constructor */: + case 173 /* SyntaxKind.Constructor */: return emitConstructor(node); - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: return emitAccessorDeclaration(node); - case 174 /* SyntaxKind.CallSignature */: + case 176 /* SyntaxKind.CallSignature */: return emitCallSignature(node); - case 175 /* SyntaxKind.ConstructSignature */: + case 177 /* SyntaxKind.ConstructSignature */: return emitConstructSignature(node); - case 176 /* SyntaxKind.IndexSignature */: + case 178 /* SyntaxKind.IndexSignature */: return emitIndexSignature(node); // Types - case 177 /* SyntaxKind.TypePredicate */: + case 179 /* SyntaxKind.TypePredicate */: return emitTypePredicate(node); - case 178 /* SyntaxKind.TypeReference */: + case 180 /* SyntaxKind.TypeReference */: return emitTypeReference(node); - case 179 /* SyntaxKind.FunctionType */: + case 181 /* SyntaxKind.FunctionType */: return emitFunctionType(node); - case 180 /* SyntaxKind.ConstructorType */: + case 182 /* SyntaxKind.ConstructorType */: return emitConstructorType(node); - case 181 /* SyntaxKind.TypeQuery */: + case 183 /* SyntaxKind.TypeQuery */: return emitTypeQuery(node); - case 182 /* SyntaxKind.TypeLiteral */: + case 184 /* SyntaxKind.TypeLiteral */: return emitTypeLiteral(node); - case 183 /* SyntaxKind.ArrayType */: + case 185 /* SyntaxKind.ArrayType */: return emitArrayType(node); - case 184 /* SyntaxKind.TupleType */: + case 186 /* SyntaxKind.TupleType */: return emitTupleType(node); - case 185 /* SyntaxKind.OptionalType */: + case 187 /* SyntaxKind.OptionalType */: return emitOptionalType(node); // SyntaxKind.RestType is handled below - case 187 /* SyntaxKind.UnionType */: + case 189 /* SyntaxKind.UnionType */: return emitUnionType(node); - case 188 /* SyntaxKind.IntersectionType */: + case 190 /* SyntaxKind.IntersectionType */: return emitIntersectionType(node); - case 189 /* SyntaxKind.ConditionalType */: + case 191 /* SyntaxKind.ConditionalType */: return emitConditionalType(node); - case 190 /* SyntaxKind.InferType */: + case 192 /* SyntaxKind.InferType */: return emitInferType(node); - case 191 /* SyntaxKind.ParenthesizedType */: + case 193 /* SyntaxKind.ParenthesizedType */: return emitParenthesizedType(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 192 /* SyntaxKind.ThisType */: + case 194 /* SyntaxKind.ThisType */: return emitThisType(); - case 193 /* SyntaxKind.TypeOperator */: + case 195 /* SyntaxKind.TypeOperator */: return emitTypeOperator(node); - case 194 /* SyntaxKind.IndexedAccessType */: + case 196 /* SyntaxKind.IndexedAccessType */: return emitIndexedAccessType(node); - case 195 /* SyntaxKind.MappedType */: + case 197 /* SyntaxKind.MappedType */: return emitMappedType(node); - case 196 /* SyntaxKind.LiteralType */: + case 198 /* SyntaxKind.LiteralType */: return emitLiteralType(node); - case 197 /* SyntaxKind.NamedTupleMember */: + case 199 /* SyntaxKind.NamedTupleMember */: return emitNamedTupleMember(node); - case 198 /* SyntaxKind.TemplateLiteralType */: + case 200 /* SyntaxKind.TemplateLiteralType */: return emitTemplateType(node); - case 199 /* SyntaxKind.TemplateLiteralTypeSpan */: + case 201 /* SyntaxKind.TemplateLiteralTypeSpan */: return emitTemplateTypeSpan(node); - case 200 /* SyntaxKind.ImportType */: + case 202 /* SyntaxKind.ImportType */: return emitImportTypeNode(node); // Binding patterns - case 201 /* SyntaxKind.ObjectBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: return emitObjectBindingPattern(node); - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: return emitArrayBindingPattern(node); - case 203 /* SyntaxKind.BindingElement */: + case 205 /* SyntaxKind.BindingElement */: return emitBindingElement(node); // Misc - case 233 /* SyntaxKind.TemplateSpan */: + case 236 /* SyntaxKind.TemplateSpan */: return emitTemplateSpan(node); - case 234 /* SyntaxKind.SemicolonClassElement */: + case 237 /* SyntaxKind.SemicolonClassElement */: return emitSemicolonClassElement(); // Statements - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: return emitBlock(node); - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: return emitVariableStatement(node); - case 236 /* SyntaxKind.EmptyStatement */: + case 239 /* SyntaxKind.EmptyStatement */: return emitEmptyStatement(/*isEmbeddedStatement*/ false); - case 238 /* SyntaxKind.ExpressionStatement */: + case 241 /* SyntaxKind.ExpressionStatement */: return emitExpressionStatement(node); - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: return emitIfStatement(node); - case 240 /* SyntaxKind.DoStatement */: + case 243 /* SyntaxKind.DoStatement */: return emitDoStatement(node); - case 241 /* SyntaxKind.WhileStatement */: + case 244 /* SyntaxKind.WhileStatement */: return emitWhileStatement(node); - case 242 /* SyntaxKind.ForStatement */: + case 245 /* SyntaxKind.ForStatement */: return emitForStatement(node); - case 243 /* SyntaxKind.ForInStatement */: + case 246 /* SyntaxKind.ForInStatement */: return emitForInStatement(node); - case 244 /* SyntaxKind.ForOfStatement */: + case 247 /* SyntaxKind.ForOfStatement */: return emitForOfStatement(node); - case 245 /* SyntaxKind.ContinueStatement */: + case 248 /* SyntaxKind.ContinueStatement */: return emitContinueStatement(node); - case 246 /* SyntaxKind.BreakStatement */: + case 249 /* SyntaxKind.BreakStatement */: return emitBreakStatement(node); - case 247 /* SyntaxKind.ReturnStatement */: + case 250 /* SyntaxKind.ReturnStatement */: return emitReturnStatement(node); - case 248 /* SyntaxKind.WithStatement */: + case 251 /* SyntaxKind.WithStatement */: return emitWithStatement(node); - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: return emitSwitchStatement(node); - case 250 /* SyntaxKind.LabeledStatement */: + case 253 /* SyntaxKind.LabeledStatement */: return emitLabeledStatement(node); - case 251 /* SyntaxKind.ThrowStatement */: + case 254 /* SyntaxKind.ThrowStatement */: return emitThrowStatement(node); - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: return emitTryStatement(node); - case 253 /* SyntaxKind.DebuggerStatement */: + case 256 /* SyntaxKind.DebuggerStatement */: return emitDebuggerStatement(node); // Declarations - case 254 /* SyntaxKind.VariableDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: return emitVariableDeclaration(node); - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: return emitVariableDeclarationList(node); - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: return emitFunctionDeclaration(node); - case 257 /* SyntaxKind.ClassDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: return emitClassDeclaration(node); - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: return emitInterfaceDeclaration(node); - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: return emitTypeAliasDeclaration(node); - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: return emitEnumDeclaration(node); - case 261 /* SyntaxKind.ModuleDeclaration */: + case 264 /* SyntaxKind.ModuleDeclaration */: return emitModuleDeclaration(node); - case 262 /* SyntaxKind.ModuleBlock */: + case 265 /* SyntaxKind.ModuleBlock */: return emitModuleBlock(node); - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: return emitCaseBlock(node); - case 264 /* SyntaxKind.NamespaceExportDeclaration */: + case 267 /* SyntaxKind.NamespaceExportDeclaration */: return emitNamespaceExportDeclaration(node); - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: return emitImportEqualsDeclaration(node); - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: return emitImportDeclaration(node); - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: return emitImportClause(node); - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: return emitNamespaceImport(node); - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: return emitNamespaceExport(node); - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: return emitNamedImports(node); - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: return emitImportSpecifier(node); - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: return emitExportAssignment(node); - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: return emitExportDeclaration(node); - case 273 /* SyntaxKind.NamedExports */: + case 276 /* SyntaxKind.NamedExports */: return emitNamedExports(node); - case 275 /* SyntaxKind.ExportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: return emitExportSpecifier(node); - case 293 /* SyntaxKind.AssertClause */: + case 296 /* SyntaxKind.AssertClause */: return emitAssertClause(node); - case 294 /* SyntaxKind.AssertEntry */: + case 297 /* SyntaxKind.AssertEntry */: return emitAssertEntry(node); - case 276 /* SyntaxKind.MissingDeclaration */: + case 279 /* SyntaxKind.MissingDeclaration */: return; // Module references - case 277 /* SyntaxKind.ExternalModuleReference */: + case 280 /* SyntaxKind.ExternalModuleReference */: return emitExternalModuleReference(node); // JSX (non-expression) case 11 /* SyntaxKind.JsxText */: return emitJsxText(node); - case 280 /* SyntaxKind.JsxOpeningElement */: - case 283 /* SyntaxKind.JsxOpeningFragment */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 286 /* SyntaxKind.JsxOpeningFragment */: return emitJsxOpeningElementOrFragment(node); - case 281 /* SyntaxKind.JsxClosingElement */: - case 284 /* SyntaxKind.JsxClosingFragment */: + case 284 /* SyntaxKind.JsxClosingElement */: + case 287 /* SyntaxKind.JsxClosingFragment */: return emitJsxClosingElementOrFragment(node); - case 285 /* SyntaxKind.JsxAttribute */: + case 288 /* SyntaxKind.JsxAttribute */: return emitJsxAttribute(node); - case 286 /* SyntaxKind.JsxAttributes */: + case 289 /* SyntaxKind.JsxAttributes */: return emitJsxAttributes(node); - case 287 /* SyntaxKind.JsxSpreadAttribute */: + case 290 /* SyntaxKind.JsxSpreadAttribute */: return emitJsxSpreadAttribute(node); - case 288 /* SyntaxKind.JsxExpression */: + case 291 /* SyntaxKind.JsxExpression */: return emitJsxExpression(node); // Clauses - case 289 /* SyntaxKind.CaseClause */: + case 292 /* SyntaxKind.CaseClause */: return emitCaseClause(node); - case 290 /* SyntaxKind.DefaultClause */: + case 293 /* SyntaxKind.DefaultClause */: return emitDefaultClause(node); - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: return emitHeritageClause(node); - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: return emitCatchClause(node); // Property assignments - case 296 /* SyntaxKind.PropertyAssignment */: + case 299 /* SyntaxKind.PropertyAssignment */: return emitPropertyAssignment(node); - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: return emitShorthandPropertyAssignment(node); - case 298 /* SyntaxKind.SpreadAssignment */: + case 301 /* SyntaxKind.SpreadAssignment */: return emitSpreadAssignment(node); // Enum - case 299 /* SyntaxKind.EnumMember */: + case 302 /* SyntaxKind.EnumMember */: return emitEnumMember(node); // Unparsed - case 300 /* SyntaxKind.UnparsedPrologue */: + case 303 /* SyntaxKind.UnparsedPrologue */: return writeUnparsedNode(node); - case 307 /* SyntaxKind.UnparsedSource */: - case 301 /* SyntaxKind.UnparsedPrepend */: + case 310 /* SyntaxKind.UnparsedSource */: + case 304 /* SyntaxKind.UnparsedPrepend */: return emitUnparsedSourceOrPrepend(node); - case 302 /* SyntaxKind.UnparsedText */: - case 303 /* SyntaxKind.UnparsedInternalText */: + case 305 /* SyntaxKind.UnparsedText */: + case 306 /* SyntaxKind.UnparsedInternalText */: return emitUnparsedTextLike(node); - case 304 /* SyntaxKind.UnparsedSyntheticReference */: + case 307 /* SyntaxKind.UnparsedSyntheticReference */: return emitUnparsedSyntheticReference(node); // Top-level nodes - case 305 /* SyntaxKind.SourceFile */: + case 308 /* SyntaxKind.SourceFile */: return emitSourceFile(node); - case 306 /* SyntaxKind.Bundle */: + case 309 /* SyntaxKind.Bundle */: return ts.Debug.fail("Bundles should be printed using printBundle"); // SyntaxKind.UnparsedSource (handled above) - case 308 /* SyntaxKind.InputFiles */: + case 311 /* SyntaxKind.InputFiles */: return ts.Debug.fail("InputFiles should not be printed"); // JSDoc nodes (only used in codefixes currently) - case 309 /* SyntaxKind.JSDocTypeExpression */: + case 312 /* SyntaxKind.JSDocTypeExpression */: return emitJSDocTypeExpression(node); - case 310 /* SyntaxKind.JSDocNameReference */: + case 313 /* SyntaxKind.JSDocNameReference */: return emitJSDocNameReference(node); - case 312 /* SyntaxKind.JSDocAllType */: + case 315 /* SyntaxKind.JSDocAllType */: return writePunctuation("*"); - case 313 /* SyntaxKind.JSDocUnknownType */: + case 316 /* SyntaxKind.JSDocUnknownType */: return writePunctuation("?"); - case 314 /* SyntaxKind.JSDocNullableType */: + case 317 /* SyntaxKind.JSDocNullableType */: return emitJSDocNullableType(node); - case 315 /* SyntaxKind.JSDocNonNullableType */: + case 318 /* SyntaxKind.JSDocNonNullableType */: return emitJSDocNonNullableType(node); - case 316 /* SyntaxKind.JSDocOptionalType */: + case 319 /* SyntaxKind.JSDocOptionalType */: return emitJSDocOptionalType(node); - case 317 /* SyntaxKind.JSDocFunctionType */: + case 320 /* SyntaxKind.JSDocFunctionType */: return emitJSDocFunctionType(node); - case 186 /* SyntaxKind.RestType */: - case 318 /* SyntaxKind.JSDocVariadicType */: + case 188 /* SyntaxKind.RestType */: + case 321 /* SyntaxKind.JSDocVariadicType */: return emitRestOrJSDocVariadicType(node); - case 319 /* SyntaxKind.JSDocNamepathType */: + case 322 /* SyntaxKind.JSDocNamepathType */: return; - case 320 /* SyntaxKind.JSDoc */: + case 323 /* SyntaxKind.JSDoc */: return emitJSDoc(node); - case 322 /* SyntaxKind.JSDocTypeLiteral */: + case 325 /* SyntaxKind.JSDocTypeLiteral */: return emitJSDocTypeLiteral(node); - case 323 /* SyntaxKind.JSDocSignature */: + case 326 /* SyntaxKind.JSDocSignature */: return emitJSDocSignature(node); - case 327 /* SyntaxKind.JSDocTag */: - case 332 /* SyntaxKind.JSDocClassTag */: - case 337 /* SyntaxKind.JSDocOverrideTag */: + case 330 /* SyntaxKind.JSDocTag */: + case 335 /* SyntaxKind.JSDocClassTag */: + case 340 /* SyntaxKind.JSDocOverrideTag */: return emitJSDocSimpleTag(node); - case 328 /* SyntaxKind.JSDocAugmentsTag */: - case 329 /* SyntaxKind.JSDocImplementsTag */: + case 331 /* SyntaxKind.JSDocAugmentsTag */: + case 332 /* SyntaxKind.JSDocImplementsTag */: return emitJSDocHeritageTag(node); - case 330 /* SyntaxKind.JSDocAuthorTag */: - case 331 /* SyntaxKind.JSDocDeprecatedTag */: + case 333 /* SyntaxKind.JSDocAuthorTag */: + case 334 /* SyntaxKind.JSDocDeprecatedTag */: return; // SyntaxKind.JSDocClassTag (see JSDocTag, above) - case 333 /* SyntaxKind.JSDocPublicTag */: - case 334 /* SyntaxKind.JSDocPrivateTag */: - case 335 /* SyntaxKind.JSDocProtectedTag */: - case 336 /* SyntaxKind.JSDocReadonlyTag */: + case 336 /* SyntaxKind.JSDocPublicTag */: + case 337 /* SyntaxKind.JSDocPrivateTag */: + case 338 /* SyntaxKind.JSDocProtectedTag */: + case 339 /* SyntaxKind.JSDocReadonlyTag */: return; - case 338 /* SyntaxKind.JSDocCallbackTag */: + case 341 /* SyntaxKind.JSDocCallbackTag */: return emitJSDocCallbackTag(node); // SyntaxKind.JSDocEnumTag (see below) - case 340 /* SyntaxKind.JSDocParameterTag */: - case 347 /* SyntaxKind.JSDocPropertyTag */: + case 343 /* SyntaxKind.JSDocParameterTag */: + case 350 /* SyntaxKind.JSDocPropertyTag */: return emitJSDocPropertyLikeTag(node); - case 339 /* SyntaxKind.JSDocEnumTag */: - case 341 /* SyntaxKind.JSDocReturnTag */: - case 342 /* SyntaxKind.JSDocThisTag */: - case 343 /* SyntaxKind.JSDocTypeTag */: + case 342 /* SyntaxKind.JSDocEnumTag */: + case 344 /* SyntaxKind.JSDocReturnTag */: + case 345 /* SyntaxKind.JSDocThisTag */: + case 346 /* SyntaxKind.JSDocTypeTag */: return emitJSDocSimpleTypedTag(node); - case 344 /* SyntaxKind.JSDocTemplateTag */: + case 347 /* SyntaxKind.JSDocTemplateTag */: return emitJSDocTemplateTag(node); - case 345 /* SyntaxKind.JSDocTypedefTag */: + case 348 /* SyntaxKind.JSDocTypedefTag */: return emitJSDocTypedefTag(node); - case 346 /* SyntaxKind.JSDocSeeTag */: + case 349 /* SyntaxKind.JSDocSeeTag */: return emitJSDocSeeTag(node); // SyntaxKind.JSDocPropertyTag (see JSDocParameterTag, above) // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: - case 352 /* SyntaxKind.MergeDeclarationMarker */: + case 352 /* SyntaxKind.NotEmittedStatement */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: return; } if (ts.isExpression(node)) { @@ -112833,85 +114076,87 @@ var ts; case 80 /* SyntaxKind.PrivateIdentifier */: return emitPrivateIdentifier(node); // Expressions - case 204 /* SyntaxKind.ArrayLiteralExpression */: + case 206 /* SyntaxKind.ArrayLiteralExpression */: return emitArrayLiteralExpression(node); - case 205 /* SyntaxKind.ObjectLiteralExpression */: + case 207 /* SyntaxKind.ObjectLiteralExpression */: return emitObjectLiteralExpression(node); - case 206 /* SyntaxKind.PropertyAccessExpression */: + case 208 /* SyntaxKind.PropertyAccessExpression */: return emitPropertyAccessExpression(node); - case 207 /* SyntaxKind.ElementAccessExpression */: + case 209 /* SyntaxKind.ElementAccessExpression */: return emitElementAccessExpression(node); - case 208 /* SyntaxKind.CallExpression */: + case 210 /* SyntaxKind.CallExpression */: return emitCallExpression(node); - case 209 /* SyntaxKind.NewExpression */: + case 211 /* SyntaxKind.NewExpression */: return emitNewExpression(node); - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: return emitTaggedTemplateExpression(node); - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 213 /* SyntaxKind.TypeAssertionExpression */: return emitTypeAssertionExpression(node); - case 212 /* SyntaxKind.ParenthesizedExpression */: + case 214 /* SyntaxKind.ParenthesizedExpression */: return emitParenthesizedExpression(node); - case 213 /* SyntaxKind.FunctionExpression */: + case 215 /* SyntaxKind.FunctionExpression */: return emitFunctionExpression(node); - case 214 /* SyntaxKind.ArrowFunction */: + case 216 /* SyntaxKind.ArrowFunction */: return emitArrowFunction(node); - case 215 /* SyntaxKind.DeleteExpression */: + case 217 /* SyntaxKind.DeleteExpression */: return emitDeleteExpression(node); - case 216 /* SyntaxKind.TypeOfExpression */: + case 218 /* SyntaxKind.TypeOfExpression */: return emitTypeOfExpression(node); - case 217 /* SyntaxKind.VoidExpression */: + case 219 /* SyntaxKind.VoidExpression */: return emitVoidExpression(node); - case 218 /* SyntaxKind.AwaitExpression */: + case 220 /* SyntaxKind.AwaitExpression */: return emitAwaitExpression(node); - case 219 /* SyntaxKind.PrefixUnaryExpression */: + case 221 /* SyntaxKind.PrefixUnaryExpression */: return emitPrefixUnaryExpression(node); - case 220 /* SyntaxKind.PostfixUnaryExpression */: + case 222 /* SyntaxKind.PostfixUnaryExpression */: return emitPostfixUnaryExpression(node); - case 221 /* SyntaxKind.BinaryExpression */: + case 223 /* SyntaxKind.BinaryExpression */: return emitBinaryExpression(node); - case 222 /* SyntaxKind.ConditionalExpression */: + case 224 /* SyntaxKind.ConditionalExpression */: return emitConditionalExpression(node); - case 223 /* SyntaxKind.TemplateExpression */: + case 225 /* SyntaxKind.TemplateExpression */: return emitTemplateExpression(node); - case 224 /* SyntaxKind.YieldExpression */: + case 226 /* SyntaxKind.YieldExpression */: return emitYieldExpression(node); - case 225 /* SyntaxKind.SpreadElement */: + case 227 /* SyntaxKind.SpreadElement */: return emitSpreadElement(node); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: return emitClassExpression(node); - case 227 /* SyntaxKind.OmittedExpression */: + case 229 /* SyntaxKind.OmittedExpression */: return; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: return emitAsExpression(node); - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: return emitNonNullExpression(node); - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: return emitExpressionWithTypeArguments(node); - case 231 /* SyntaxKind.MetaProperty */: + case 235 /* SyntaxKind.SatisfiesExpression */: + return emitSatisfiesExpression(node); + case 233 /* SyntaxKind.MetaProperty */: return emitMetaProperty(node); - case 232 /* SyntaxKind.SyntheticExpression */: + case 234 /* SyntaxKind.SyntheticExpression */: return ts.Debug.fail("SyntheticExpression should never be printed."); // JSX - case 278 /* SyntaxKind.JsxElement */: + case 281 /* SyntaxKind.JsxElement */: return emitJsxElement(node); - case 279 /* SyntaxKind.JsxSelfClosingElement */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: return emitJsxSelfClosingElement(node); - case 282 /* SyntaxKind.JsxFragment */: + case 285 /* SyntaxKind.JsxFragment */: return emitJsxFragment(node); // Synthesized list - case 348 /* SyntaxKind.SyntaxList */: + case 351 /* SyntaxKind.SyntaxList */: return ts.Debug.fail("SyntaxList should not be printed"); // Transformation nodes - case 349 /* SyntaxKind.NotEmittedStatement */: + case 352 /* SyntaxKind.NotEmittedStatement */: return; - case 350 /* SyntaxKind.PartiallyEmittedExpression */: + case 353 /* SyntaxKind.PartiallyEmittedExpression */: return emitPartiallyEmittedExpression(node); - case 351 /* SyntaxKind.CommaListExpression */: + case 354 /* SyntaxKind.CommaListExpression */: return emitCommaList(node); - case 352 /* SyntaxKind.MergeDeclarationMarker */: - case 353 /* SyntaxKind.EndOfDeclarationMarker */: + case 355 /* SyntaxKind.MergeDeclarationMarker */: + case 356 /* SyntaxKind.EndOfDeclarationMarker */: return; - case 354 /* SyntaxKind.SyntheticReferenceExpression */: + case 357 /* SyntaxKind.SyntheticReferenceExpression */: return ts.Debug.fail("SyntheticReferenceExpression should not be printed"); } } @@ -112959,7 +114204,7 @@ var ts; } function emitHelpers(node) { var helpersEmitted = false; - var bundle = node.kind === 306 /* SyntaxKind.Bundle */ ? node : undefined; + var bundle = node.kind === 309 /* SyntaxKind.Bundle */ ? node : undefined; if (bundle && moduleKind === ts.ModuleKind.None) { return; } @@ -113059,7 +114304,7 @@ var ts; var pos = getTextPosWithWriteLine(); writeUnparsedNode(unparsed); if (bundleFileInfo) { - updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 302 /* SyntaxKind.UnparsedText */ ? + updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 305 /* SyntaxKind.UnparsedText */ ? "text" /* BundleFileSectionKind.Text */ : "internal" /* BundleFileSectionKind.Internal */); } @@ -113096,7 +114341,7 @@ var ts; } function emitTabStop(hint, node, snippet) { // A tab stop should only be attached to an empty node, i.e. a node that doesn't emit any text. - ts.Debug.assert(node.kind === 236 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); + ts.Debug.assert(node.kind === 239 /* SyntaxKind.EmptyStatement */, "A tab stop cannot be attached to a node of kind ".concat(ts.Debug.formatSyntaxKind(node.kind), ".")); ts.Debug.assert(hint !== 5 /* EmitHint.EmbeddedStatement */, "A tab stop cannot be attached to an embedded statement."); nonEscapingWrite("$".concat(snippet.order)); } @@ -113157,7 +114402,7 @@ var ts; emit(node.dotDotDotToken); emitNodeWithWriter(node.name, writeParameter); emit(node.questionToken); - if (node.parent && node.parent.kind === 317 /* SyntaxKind.JSDocFunctionType */ && !node.name) { + if (node.parent && node.parent.kind === 320 /* SyntaxKind.JSDocFunctionType */ && !node.name) { emit(node.type); } else { @@ -113218,7 +114463,7 @@ var ts; } function emitAccessorDeclaration(node) { emitDecoratorsAndModifiers(node, node.modifiers); - writeKeyword(node.kind === 172 /* SyntaxKind.GetAccessor */ ? "get" : "set"); + writeKeyword(node.kind === 174 /* SyntaxKind.GetAccessor */ ? "get" : "set"); writeSpace(); emit(node.name); emitSignatureAndBody(node, emitSignatureHead); @@ -113391,7 +114636,7 @@ var ts; function emitTypeOperator(node) { writeTokenText(node.operator, writeKeyword); writeSpace(); - var parenthesizerRule = node.operator === 145 /* SyntaxKind.ReadonlyKeyword */ ? + var parenthesizerRule = node.operator === 146 /* SyntaxKind.ReadonlyKeyword */ ? parenthesizer.parenthesizeOperandOfReadonlyTypeOperator : parenthesizer.parenthesizeOperandOfTypeOperator; emit(node.type, parenthesizerRule); @@ -113414,7 +114659,7 @@ var ts; } if (node.readonlyToken) { emit(node.readonlyToken); - if (node.readonlyToken.kind !== 145 /* SyntaxKind.ReadonlyKeyword */) { + if (node.readonlyToken.kind !== 146 /* SyntaxKind.ReadonlyKeyword */) { writeKeyword("readonly"); } writeSpace(); @@ -113660,7 +114905,7 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } function emitAwaitExpression(node) { - emitTokenWithComment(132 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(133 /* SyntaxKind.AwaitKeyword */, node.pos, writeKeyword, node); writeSpace(); emitExpression(node.expression, parenthesizer.parenthesizeOperandOfPrefixUnary); } @@ -113685,7 +114930,7 @@ var ts; // expression a prefix increment whose operand is a plus expression - (++(+x)) // The same is true of minus of course. var operand = node.operand; - return operand.kind === 219 /* SyntaxKind.PrefixUnaryExpression */ + return operand.kind === 221 /* SyntaxKind.PrefixUnaryExpression */ && ((node.operator === 39 /* SyntaxKind.PlusToken */ && (operand.operator === 39 /* SyntaxKind.PlusToken */ || operand.operator === 45 /* SyntaxKind.PlusPlusToken */)) || (node.operator === 40 /* SyntaxKind.MinusToken */ && (operand.operator === 40 /* SyntaxKind.MinusToken */ || operand.operator === 46 /* SyntaxKind.MinusMinusToken */))); } @@ -113833,6 +115078,15 @@ var ts; emitExpression(node.expression, parenthesizer.parenthesizeLeftSideOfAccess); writeOperator("!"); } + function emitSatisfiesExpression(node) { + emitExpression(node.expression, /*parenthesizerRules*/ undefined); + if (node.type) { + writeSpace(); + writeKeyword("satisfies"); + writeSpace(); + emit(node.type); + } + } function emitMetaProperty(node) { writeToken(node.keywordToken, node.pos, writePunctuation); writePunctuation("."); @@ -113890,7 +115144,7 @@ var ts; if (node.elseStatement) { writeLineOrSpace(node, node.thenStatement, node.elseStatement); emitTokenWithComment(91 /* SyntaxKind.ElseKeyword */, node.thenStatement.end, writeKeyword, node); - if (node.elseStatement.kind === 239 /* SyntaxKind.IfStatement */) { + if (node.elseStatement.kind === 242 /* SyntaxKind.IfStatement */) { writeSpace(); emit(node.elseStatement); } @@ -113953,7 +115207,7 @@ var ts; emitTokenWithComment(20 /* SyntaxKind.OpenParenToken */, openParenPos, writePunctuation, node); emitForBinding(node.initializer); writeSpace(); - emitTokenWithComment(160 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); + emitTokenWithComment(162 /* SyntaxKind.OfKeyword */, node.initializer.end, writeKeyword, node); writeSpace(); emitExpression(node.expression); emitTokenWithComment(21 /* SyntaxKind.CloseParenToken */, node.expression.end, writePunctuation, node); @@ -113961,7 +115215,7 @@ var ts; } function emitForBinding(node) { if (node !== undefined) { - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { emit(node); } else { @@ -113998,7 +115252,7 @@ var ts; } pos = writeTokenText(token, writer, pos); if (isSimilarNode && contextNode.end !== pos) { - var isJsxExprContext = contextNode.kind === 288 /* SyntaxKind.JsxExpression */; + var isJsxExprContext = contextNode.kind === 291 /* SyntaxKind.JsxExpression */; emitTrailingCommentsOfPosition(pos, /*prefixSpace*/ !isJsxExprContext, /*forceNoNewline*/ isJsxExprContext); } return pos; @@ -114308,7 +115562,7 @@ var ts; emitTokenWithComment(100 /* SyntaxKind.ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114333,7 +115587,7 @@ var ts; if (node.importClause) { emit(node.importClause); writeSpace(); - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, node.importClause.end, writeKeyword, node); writeSpace(); } emitExpression(node.moduleSpecifier); @@ -114344,7 +115598,7 @@ var ts; } function emitImportClause(node) { if (node.isTypeOnly) { - emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, node.pos, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114357,7 +115611,7 @@ var ts; function emitNamespaceImport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114383,10 +115637,11 @@ var ts; writeTrailingSemicolon(); } function emitExportDeclaration(node) { + emitModifiers(node, node.modifiers); var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); if (node.isTypeOnly) { - nextPos = emitTokenWithComment(152 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(154 /* SyntaxKind.TypeKeyword */, nextPos, writeKeyword, node); writeSpace(); } if (node.exportClause) { @@ -114398,7 +115653,7 @@ var ts; if (node.moduleSpecifier) { writeSpace(); var fromPos = node.exportClause ? node.exportClause.end : nextPos; - emitTokenWithComment(156 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); + emitTokenWithComment(158 /* SyntaxKind.FromKeyword */, fromPos, writeKeyword, node); writeSpace(); emitExpression(node.moduleSpecifier); } @@ -114408,7 +115663,7 @@ var ts; writeTrailingSemicolon(); } function emitAssertClause(node) { - emitTokenWithComment(129 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); + emitTokenWithComment(130 /* SyntaxKind.AssertKeyword */, node.pos, writeKeyword, node); writeSpace(); var elements = node.elements; emitList(node, elements, 526226 /* ListFormat.ImportClauseEntries */); @@ -114428,9 +115683,9 @@ var ts; function emitNamespaceExportDeclaration(node) { var nextPos = emitTokenWithComment(93 /* SyntaxKind.ExportKeyword */, node.pos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, nextPos, writeKeyword, node); writeSpace(); - nextPos = emitTokenWithComment(142 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); + nextPos = emitTokenWithComment(143 /* SyntaxKind.NamespaceKeyword */, nextPos, writeKeyword, node); writeSpace(); emit(node.name); writeTrailingSemicolon(); @@ -114438,7 +115693,7 @@ var ts; function emitNamespaceExport(node) { var asPos = emitTokenWithComment(41 /* SyntaxKind.AsteriskToken */, node.pos, writePunctuation, node); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, asPos, writeKeyword, node); writeSpace(); emit(node.name); } @@ -114461,7 +115716,7 @@ var ts; if (node.propertyName) { emit(node.propertyName); writeSpace(); - emitTokenWithComment(127 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); + emitTokenWithComment(128 /* SyntaxKind.AsKeyword */, node.propertyName.end, writeKeyword, node); writeSpace(); } emit(node.name); @@ -114682,7 +115937,7 @@ var ts; } } if (node.tags) { - if (node.tags.length === 1 && node.tags[0].kind === 343 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { + if (node.tags.length === 1 && node.tags[0].kind === 346 /* SyntaxKind.JSDocTypeTag */ && !node.comment) { writeSpace(); emit(node.tags[0]); } @@ -114727,7 +115982,7 @@ var ts; function emitJSDocTypedefTag(tag) { emitJSDocTagName(tag.tagName); if (tag.typeExpression) { - if (tag.typeExpression.kind === 309 /* SyntaxKind.JSDocTypeExpression */) { + if (tag.typeExpression.kind === 312 /* SyntaxKind.JSDocTypeExpression */) { emitJSDocTypeExpression(tag.typeExpression); } else { @@ -114746,7 +116001,7 @@ var ts; emit(tag.fullName); } emitJSDocComment(tag.comment); - if (tag.typeExpression && tag.typeExpression.kind === 322 /* SyntaxKind.JSDocTypeLiteral */) { + if (tag.typeExpression && tag.typeExpression.kind === 325 /* SyntaxKind.JSDocTypeLiteral */) { emitJSDocTypeLiteral(tag.typeExpression); } } @@ -115679,13 +116934,13 @@ var ts; && (!currentSourceFile || ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile)); } function skipSynthesizedParentheses(node) { - while (node.kind === 212 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { + while (node.kind === 214 /* SyntaxKind.ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) { node = node.expression; } return node; } function getTextOfNode(node, includeTrivia) { - if (ts.isGeneratedIdentifier(node)) { + if (ts.isGeneratedIdentifier(node) || ts.isGeneratedPrivateIdentifier(node)) { return generateName(node); } if (ts.isStringLiteral(node) && node.textSourceNode) { @@ -115709,7 +116964,7 @@ var ts; function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) { if (node.kind === 10 /* SyntaxKind.StringLiteral */ && node.textSourceNode) { var textSourceNode = node.textSourceNode; - if (ts.isIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { + if (ts.isIdentifier(textSourceNode) || ts.isPrivateIdentifier(textSourceNode) || ts.isNumericLiteral(textSourceNode)) { var text = ts.isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode(textSourceNode); return jsxAttributeEscape ? "\"".concat(ts.escapeJsxAttributeString(text), "\"") : neverAsciiEscape || (ts.getEmitFlags(node) & 16777216 /* EmitFlags.NoAsciiEscaping */) ? "\"".concat(ts.escapeString(text), "\"") : @@ -115733,7 +116988,11 @@ var ts; return; } tempFlagsStack.push(tempFlags); - tempFlags = 0; + tempFlags = 0 /* TempFlags.Auto */; + privateNameTempFlagsStack.push(privateNameTempFlags); + privateNameTempFlags = 0 /* TempFlags.Auto */; + formattedNameTempFlagsStack.push(formattedNameTempFlags); + formattedNameTempFlags = undefined; reservedNamesStack.push(reservedNames); } /** @@ -115744,6 +117003,8 @@ var ts; return; } tempFlags = tempFlagsStack.pop(); + privateNameTempFlags = privateNameTempFlagsStack.pop(); + formattedNameTempFlags = formattedNameTempFlagsStack.pop(); reservedNames = reservedNamesStack.pop(); } function reserveNameInNestedScopes(name) { @@ -115756,84 +117017,84 @@ var ts; if (!node) return; switch (node.kind) { - case 235 /* SyntaxKind.Block */: + case 238 /* SyntaxKind.Block */: ts.forEach(node.statements, generateNames); break; - case 250 /* SyntaxKind.LabeledStatement */: - case 248 /* SyntaxKind.WithStatement */: - case 240 /* SyntaxKind.DoStatement */: - case 241 /* SyntaxKind.WhileStatement */: + case 253 /* SyntaxKind.LabeledStatement */: + case 251 /* SyntaxKind.WithStatement */: + case 243 /* SyntaxKind.DoStatement */: + case 244 /* SyntaxKind.WhileStatement */: generateNames(node.statement); break; - case 239 /* SyntaxKind.IfStatement */: + case 242 /* SyntaxKind.IfStatement */: generateNames(node.thenStatement); generateNames(node.elseStatement); break; - case 242 /* SyntaxKind.ForStatement */: - case 244 /* SyntaxKind.ForOfStatement */: - case 243 /* SyntaxKind.ForInStatement */: + case 245 /* SyntaxKind.ForStatement */: + case 247 /* SyntaxKind.ForOfStatement */: + case 246 /* SyntaxKind.ForInStatement */: generateNames(node.initializer); generateNames(node.statement); break; - case 249 /* SyntaxKind.SwitchStatement */: + case 252 /* SyntaxKind.SwitchStatement */: generateNames(node.caseBlock); break; - case 263 /* SyntaxKind.CaseBlock */: + case 266 /* SyntaxKind.CaseBlock */: ts.forEach(node.clauses, generateNames); break; - case 289 /* SyntaxKind.CaseClause */: - case 290 /* SyntaxKind.DefaultClause */: + case 292 /* SyntaxKind.CaseClause */: + case 293 /* SyntaxKind.DefaultClause */: ts.forEach(node.statements, generateNames); break; - case 252 /* SyntaxKind.TryStatement */: + case 255 /* SyntaxKind.TryStatement */: generateNames(node.tryBlock); generateNames(node.catchClause); generateNames(node.finallyBlock); break; - case 292 /* SyntaxKind.CatchClause */: + case 295 /* SyntaxKind.CatchClause */: generateNames(node.variableDeclaration); generateNames(node.block); break; - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: generateNames(node.declarationList); break; - case 255 /* SyntaxKind.VariableDeclarationList */: + case 258 /* SyntaxKind.VariableDeclarationList */: ts.forEach(node.declarations, generateNames); break; - case 254 /* SyntaxKind.VariableDeclaration */: - case 164 /* SyntaxKind.Parameter */: - case 203 /* SyntaxKind.BindingElement */: - case 257 /* SyntaxKind.ClassDeclaration */: + case 257 /* SyntaxKind.VariableDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 205 /* SyntaxKind.BindingElement */: + case 260 /* SyntaxKind.ClassDeclaration */: generateNameIfNeeded(node.name); break; - case 256 /* SyntaxKind.FunctionDeclaration */: + case 259 /* SyntaxKind.FunctionDeclaration */: generateNameIfNeeded(node.name); if (ts.getEmitFlags(node) & 524288 /* EmitFlags.ReuseTempVariableScope */) { ts.forEach(node.parameters, generateNames); generateNames(node.body); } break; - case 201 /* SyntaxKind.ObjectBindingPattern */: - case 202 /* SyntaxKind.ArrayBindingPattern */: + case 203 /* SyntaxKind.ObjectBindingPattern */: + case 204 /* SyntaxKind.ArrayBindingPattern */: ts.forEach(node.elements, generateNames); break; - case 266 /* SyntaxKind.ImportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: generateNames(node.importClause); break; - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: generateNameIfNeeded(node.name); generateNames(node.namedBindings); break; - case 268 /* SyntaxKind.NamespaceImport */: + case 271 /* SyntaxKind.NamespaceImport */: generateNameIfNeeded(node.name); break; - case 274 /* SyntaxKind.NamespaceExport */: + case 277 /* SyntaxKind.NamespaceExport */: generateNameIfNeeded(node.name); break; - case 269 /* SyntaxKind.NamedImports */: + case 272 /* SyntaxKind.NamedImports */: ts.forEach(node.elements, generateNames); break; - case 270 /* SyntaxKind.ImportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: generateNameIfNeeded(node.propertyName || node.name); break; } @@ -115842,19 +117103,19 @@ var ts; if (!node) return; switch (node.kind) { - case 296 /* SyntaxKind.PropertyAssignment */: - case 297 /* SyntaxKind.ShorthandPropertyAssignment */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: + case 299 /* SyntaxKind.PropertyAssignment */: + case 300 /* SyntaxKind.ShorthandPropertyAssignment */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: generateNameIfNeeded(node.name); break; } } function generateNameIfNeeded(name) { if (name) { - if (ts.isGeneratedIdentifier(name)) { + if (ts.isGeneratedIdentifier(name) || ts.isGeneratedPrivateIdentifier(name)) { generateName(name); } else if (ts.isBindingPattern(name)) { @@ -115869,7 +117130,7 @@ var ts; if ((name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) === 4 /* GeneratedIdentifierFlags.Node */) { // Node names generate unique names based on their original node // and are cached based on that node's id. - return generateNameCached(getNodeForGeneratedName(name), name.autoGenerateFlags); + return generateNameCached(ts.getNodeForGeneratedName(name), ts.isPrivateIdentifier(name), name.autoGenerateFlags, name.autoGeneratePrefix, name.autoGenerateSuffix); } else { // Auto, Loop, and Unique names are cached based on their unique @@ -115878,9 +117139,9 @@ var ts; return autoGeneratedIdToGeneratedName[autoGenerateId] || (autoGeneratedIdToGeneratedName[autoGenerateId] = makeName(name)); } } - function generateNameCached(node, flags) { + function generateNameCached(node, privateName, flags, prefix, suffix) { var nodeId = ts.getNodeId(node); - return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, flags)); + return nodeIdToGeneratedName[nodeId] || (nodeIdToGeneratedName[nodeId] = generateNameForNode(node, privateName, flags !== null && flags !== void 0 ? flags : 0 /* GeneratedIdentifierFlags.None */, ts.formatGeneratedNamePart(prefix, generateName), ts.formatGeneratedNamePart(suffix))); } /** * Returns a value indicating whether a name is unique globally, within the current file, @@ -115912,20 +117173,53 @@ var ts; } return true; } + function getTempFlags(formattedNameKey) { + var _a; + switch (formattedNameKey) { + case "": + return tempFlags; + case "#": + return privateNameTempFlags; + default: + return (_a = formattedNameTempFlags === null || formattedNameTempFlags === void 0 ? void 0 : formattedNameTempFlags.get(formattedNameKey)) !== null && _a !== void 0 ? _a : 0 /* TempFlags.Auto */; + } + } + function setTempFlags(formattedNameKey, flags) { + switch (formattedNameKey) { + case "": + tempFlags = flags; + break; + case "#": + privateNameTempFlags = flags; + break; + default: + formattedNameTempFlags !== null && formattedNameTempFlags !== void 0 ? formattedNameTempFlags : (formattedNameTempFlags = new ts.Map()); + formattedNameTempFlags.set(formattedNameKey, flags); + break; + } + } /** * Return the next available name in the pattern _a ... _z, _0, _1, ... * TempFlags._i or TempFlags._n may be used to express a preference for that dedicated name. * Note that names generated by makeTempVariableName and makeUniqueName will never conflict. */ - function makeTempVariableName(flags, reservedInNestedScopes) { + function makeTempVariableName(flags, reservedInNestedScopes, privateName, prefix, suffix) { + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } + // Generate a key to use to acquire a TempFlags counter based on the fixed portions of the generated name. + var key = ts.formatGeneratedName(privateName, prefix, "", suffix); + var tempFlags = getTempFlags(key); if (flags && !(tempFlags & flags)) { var name = flags === 268435456 /* TempFlags._i */ ? "_i" : "_n"; - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { tempFlags |= flags; if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } while (true) { @@ -115936,11 +117230,13 @@ var ts; var name = count < 26 ? "_" + String.fromCharCode(97 /* CharacterCodes.a */ + count) : "_" + (count - 26); - if (isUniqueName(name)) { + var fullName = ts.formatGeneratedName(privateName, prefix, name, suffix); + if (isUniqueName(fullName)) { if (reservedInNestedScopes) { - reserveNameInNestedScopes(name); + reserveNameInNestedScopes(fullName); } - return name; + setTempFlags(key, tempFlags); + return fullName; } } } @@ -115952,17 +117248,24 @@ var ts; * makeUniqueName are guaranteed to never conflict. * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1' */ - function makeUniqueName(baseName, checkFn, optimistic, scoped) { + function makeUniqueName(baseName, checkFn, optimistic, scoped, privateName, prefix, suffix) { if (checkFn === void 0) { checkFn = isUniqueName; } + if (baseName.length > 0 && baseName.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + baseName = baseName.slice(1); + } + if (prefix.length > 0 && prefix.charCodeAt(0) === 35 /* CharacterCodes.hash */) { + prefix = prefix.slice(1); + } if (optimistic) { - if (checkFn(baseName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(baseName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(baseName); + generatedNames.add(fullName); } - return baseName; + return fullName; } } // Find the first unique 'name_n', where n is a positive number @@ -115971,21 +117274,21 @@ var ts; } var i = 1; while (true) { - var generatedName = baseName + i; - if (checkFn(generatedName)) { + var fullName = ts.formatGeneratedName(privateName, prefix, baseName + i, suffix); + if (checkFn(fullName)) { if (scoped) { - reserveNameInNestedScopes(generatedName); + reserveNameInNestedScopes(fullName); } else { - generatedNames.add(generatedName); + generatedNames.add(fullName); } - return generatedName; + return fullName; } i++; } } function makeFileLevelOptimisticUniqueName(name) { - return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true); + return makeUniqueName(name, isFileLevelUniqueName, /*optimistic*/ true, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a ModuleDeclaration or EnumDeclaration. @@ -115993,7 +117296,7 @@ var ts; function generateNameForModuleOrEnum(node) { var name = getTextOfNode(node.name); // Use module/enum name itself if it is unique, otherwise make a unique variation - return isUniqueLocalName(name, node) ? name : makeUniqueName(name); + return isUniqueLocalName(name, node) ? name : makeUniqueName(name, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for an ImportDeclaration or ExportDeclaration. @@ -116002,89 +117305,76 @@ var ts; var expr = ts.getExternalModuleName(node); // TODO: GH#18217 var baseName = ts.isStringLiteral(expr) ? ts.makeIdentifierFromModuleName(expr.text) : "module"; - return makeUniqueName(baseName); + return makeUniqueName(baseName, isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a default export. */ function generateNameForExportDefault() { - return makeUniqueName("default"); + return makeUniqueName("default", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } /** * Generates a unique name for a class expression. */ function generateNameForClassExpression() { - return makeUniqueName("class"); + return makeUniqueName("class", isUniqueName, /*optimistic*/ false, /*scoped*/ false, /*privateName*/ false, /*prefix*/ "", /*suffix*/ ""); } - function generateNameForMethodOrAccessor(node) { + function generateNameForMethodOrAccessor(node, privateName, prefix, suffix) { if (ts.isIdentifier(node.name)) { - return generateNameCached(node.name); + return generateNameCached(node.name, privateName); } - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reservedInNestedScopes*/ false, privateName, prefix, suffix); } /** * Generates a unique name from a node. */ - function generateNameForNode(node, flags) { + function generateNameForNode(node, privateName, flags, prefix, suffix) { switch (node.kind) { case 79 /* SyntaxKind.Identifier */: - return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); - case 261 /* SyntaxKind.ModuleDeclaration */: - case 260 /* SyntaxKind.EnumDeclaration */: + case 80 /* SyntaxKind.PrivateIdentifier */: + return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(flags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), privateName, prefix, suffix); + case 264 /* SyntaxKind.ModuleDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForModuleOrEnum(node); - case 266 /* SyntaxKind.ImportDeclaration */: - case 272 /* SyntaxKind.ExportDeclaration */: + case 269 /* SyntaxKind.ImportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForImportOrExportDeclaration(node); - case 256 /* SyntaxKind.FunctionDeclaration */: - case 257 /* SyntaxKind.ClassDeclaration */: - case 271 /* SyntaxKind.ExportAssignment */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 274 /* SyntaxKind.ExportAssignment */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForExportDefault(); - case 226 /* SyntaxKind.ClassExpression */: + case 228 /* SyntaxKind.ClassExpression */: + ts.Debug.assert(!prefix && !suffix && !privateName); return generateNameForClassExpression(); - case 169 /* SyntaxKind.MethodDeclaration */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - return generateNameForMethodOrAccessor(node); - case 162 /* SyntaxKind.ComputedPropertyName */: - return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true); + case 171 /* SyntaxKind.MethodDeclaration */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + return generateNameForMethodOrAccessor(node, privateName, prefix, suffix); + case 164 /* SyntaxKind.ComputedPropertyName */: + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ true, privateName, prefix, suffix); default: - return makeTempVariableName(0 /* TempFlags.Auto */); + return makeTempVariableName(0 /* TempFlags.Auto */, /*reserveInNestedScopes*/ false, privateName, prefix, suffix); } } /** * Generates a unique identifier for a node. */ function makeName(name) { + var prefix = ts.formatGeneratedNamePart(name.autoGeneratePrefix, generateName); + var suffix = ts.formatGeneratedNamePart(name.autoGenerateSuffix); switch (name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */) { case 1 /* GeneratedIdentifierFlags.Auto */: - return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + return makeTempVariableName(0 /* TempFlags.Auto */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); case 2 /* GeneratedIdentifierFlags.Loop */: - return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); + ts.Debug.assertNode(name, ts.isIdentifier); + return makeTempVariableName(268435456 /* TempFlags._i */, !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), /*privateName*/ false, prefix, suffix); case 3 /* GeneratedIdentifierFlags.Unique */: - return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */)); - } - return ts.Debug.fail("Unsupported GeneratedIdentifierKind."); - } - /** - * Gets the node from which a name should be generated. - */ - function getNodeForGeneratedName(name) { - var autoGenerateId = name.autoGenerateId; - var node = name; - var original = node.original; - while (original) { - node = original; - // if "node" is a different generated name (having a different - // "autoGenerateId"), use it and stop traversing. - if (ts.isIdentifier(node) - && !!(node.autoGenerateFlags & 4 /* GeneratedIdentifierFlags.Node */) - && node.autoGenerateId !== autoGenerateId) { - break; - } - original = node.original; + return makeUniqueName(ts.idText(name), (name.autoGenerateFlags & 32 /* GeneratedIdentifierFlags.FileLevel */) ? isFileLevelUniqueName : isUniqueName, !!(name.autoGenerateFlags & 16 /* GeneratedIdentifierFlags.Optimistic */), !!(name.autoGenerateFlags & 8 /* GeneratedIdentifierFlags.ReservedInNestedScopes */), ts.isPrivateIdentifier(name), prefix, suffix); } - // otherwise, return the original node for the source; - return node; + return ts.Debug.fail("Unsupported GeneratedIdentifierKind: ".concat(ts.Debug.formatEnum(name.autoGenerateFlags & 7 /* GeneratedIdentifierFlags.KindMask */, ts.GeneratedIdentifierFlags, /*isFlags*/ true), ".")); } // Comments function pipelineEmitWithComments(hint, node) { @@ -116130,7 +117420,7 @@ var ts; // Emit leading comments if the position is not synthesized and the node // has not opted out from emitting leading comments. if (!skipLeadingComments) { - emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 349 /* SyntaxKind.NotEmittedStatement */); + emitLeadingComments(pos, /*isEmittedNode*/ node.kind !== 352 /* SyntaxKind.NotEmittedStatement */); } if (!skipLeadingComments || (pos >= 0 && (emitFlags & 512 /* EmitFlags.NoLeadingComments */) !== 0)) { // Advance the container position if comments get emitted or if they've been disabled explicitly using NoLeadingComments. @@ -116141,7 +117431,7 @@ var ts; containerEnd = end; // To avoid invalid comment emit in a down-level binding pattern, we // keep track of the last declaration list container's end - if (node.kind === 255 /* SyntaxKind.VariableDeclarationList */) { + if (node.kind === 258 /* SyntaxKind.VariableDeclarationList */) { declarationListContainerEnd = end; } } @@ -116160,7 +117450,7 @@ var ts; declarationListContainerEnd = savedDeclarationListContainerEnd; // Emit trailing comments if the position is not synthesized and the node // has not opted out from emitting leading comments and is an emitted node. - if (!skipTrailingComments && node.kind !== 349 /* SyntaxKind.NotEmittedStatement */) { + if (!skipTrailingComments && node.kind !== 352 /* SyntaxKind.NotEmittedStatement */) { emitTrailingComments(end); } } @@ -116441,7 +117731,7 @@ var ts; } else { var source = sourceMapRange.source || sourceMapSource; - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 16 /* EmitFlags.NoLeadingSourceMap */) === 0 && sourceMapRange.pos >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, skipSourceTrivia(source, sourceMapRange.pos)); @@ -116459,7 +117749,7 @@ var ts; if (emitFlags & 64 /* EmitFlags.NoNestedSourceMaps */) { sourceMapsDisabled = false; } - if (node.kind !== 349 /* SyntaxKind.NotEmittedStatement */ + if (node.kind !== 352 /* SyntaxKind.NotEmittedStatement */ && (emitFlags & 32 /* EmitFlags.NoTrailingSourceMap */) === 0 && sourceMapRange.end >= 0) { emitSourcePos(sourceMapRange.source || sourceMapSource, sourceMapRange.end); @@ -116624,7 +117914,16 @@ var ts; return cachedReadDirectoryResult.get(ts.ensureTrailingDirectorySeparator(rootDirPath)); } function getCachedFileSystemEntriesForBaseDir(path) { - return getCachedFileSystemEntries(ts.getDirectoryPath(path)); + var entries = getCachedFileSystemEntries(ts.getDirectoryPath(path)); + if (!entries) { + return entries; + } + // If we're looking for the base directory, we're definitely going to search the entries + if (!entries.sortedAndCanonicalizedFiles) { + entries.sortedAndCanonicalizedFiles = entries.files.map(getCanonicalFileName).sort(); + entries.sortedAndCanonicalizedDirectories = entries.directories.map(getCanonicalFileName).sort(); + } + return entries; } function getBaseNameOfFileName(fileName) { return ts.getBaseFileName(ts.normalizePath(fileName)); @@ -116667,21 +117966,10 @@ var ts; return undefined; } } - function fileNameEqual(name1, name2) { - return getCanonicalFileName(name1) === getCanonicalFileName(name2); - } function hasEntry(entries, name) { - return ts.some(entries, function (file) { return fileNameEqual(file, name); }); - } - function updateFileSystemEntry(entries, baseName, isValid) { - if (hasEntry(entries, baseName)) { - if (!isValid) { - return ts.filterMutate(entries, function (entry) { return !fileNameEqual(entry, baseName); }); - } - } - else if (isValid) { - return entries.push(baseName); - } + // Case-sensitive comparison since already canonicalized + var index = ts.binarySearch(entries, name, ts.identity, ts.compareStringsCaseSensitive); + return index >= 0; } function writeFile(fileName, data, writeByteOrderMark) { var path = toPath(fileName); @@ -116694,7 +117982,7 @@ var ts; function fileExists(fileName) { var path = toPath(fileName); var result = getCachedFileSystemEntriesForBaseDir(path); - return result && hasEntry(result.files, getBaseNameOfFileName(fileName)) || + return result && hasEntry(result.sortedAndCanonicalizedFiles, getCanonicalFileName(getBaseNameOfFileName(fileName))) || host.fileExists(fileName); } function directoryExists(dirPath) { @@ -116704,9 +117992,14 @@ var ts; function createDirectory(dirPath) { var path = toPath(dirPath); var result = getCachedFileSystemEntriesForBaseDir(path); - var baseFileName = getBaseNameOfFileName(dirPath); if (result) { - updateFileSystemEntry(result.directories, baseFileName, /*isValid*/ true); + var baseName = getBaseNameOfFileName(dirPath); + var canonicalizedBaseName = getCanonicalFileName(baseName); + var canonicalizedDirectories = result.sortedAndCanonicalizedDirectories; + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedDirectories, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + result.directories.push(baseName); + } } host.createDirectory(dirPath); } @@ -116775,7 +118068,7 @@ var ts; fileExists: host.fileExists(fileOrDirectoryPath), directoryExists: host.directoryExists(fileOrDirectoryPath) }; - if (fsQueryResult.directoryExists || hasEntry(parentResult.directories, baseName)) { + if (fsQueryResult.directoryExists || hasEntry(parentResult.sortedAndCanonicalizedDirectories, getCanonicalFileName(baseName))) { // Folder added or removed, clear the cache instead of updating the folder and its structure clearCache(); } @@ -116795,7 +118088,23 @@ var ts; } } function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists) { - updateFileSystemEntry(parentResult.files, baseName, fileExists); + var canonicalizedFiles = parentResult.sortedAndCanonicalizedFiles; + var canonicalizedBaseName = getCanonicalFileName(baseName); + if (fileExists) { + // Case-sensitive comparison since already canonicalized + if (ts.insertSorted(canonicalizedFiles, canonicalizedBaseName, ts.compareStringsCaseSensitive)) { + parentResult.files.push(baseName); + } + } + else { + // Case-sensitive comparison since already canonicalized + var sortedIndex = ts.binarySearch(canonicalizedFiles, canonicalizedBaseName, ts.identity, ts.compareStringsCaseSensitive); + if (sortedIndex >= 0) { + canonicalizedFiles.splice(sortedIndex, 1); + var unsortedIndex = parentResult.files.findIndex(function (entry) { return getCanonicalFileName(entry) === canonicalizedBaseName; }); + parentResult.files.splice(unsortedIndex, 1); + } + } } function clearCache() { cachedReadDirectoryResult.clear(); @@ -117275,14 +118584,16 @@ var ts; } return setReadFileCache(key, fileName); }; - var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersion, onError, shouldCreateNewSourceFile) { + var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) { var key = toPath(fileName); - var value = sourceFileCache.get(key); + var impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : undefined; + var forImpliedNodeFormat = sourceFileCache.get(impliedNodeFormat); + var value = forImpliedNodeFormat === null || forImpliedNodeFormat === void 0 ? void 0 : forImpliedNodeFormat.get(key); if (value) return value; - var sourceFile = getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile); + var sourceFile = getSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile); if (sourceFile && (ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Extension.Json */))) { - sourceFileCache.set(key, sourceFile); + sourceFileCache.set(impliedNodeFormat, (forImpliedNodeFormat || new ts.Map()).set(key, sourceFile)); } return sourceFile; } : undefined; @@ -117307,13 +118618,15 @@ var ts; var value = readFileCache.get(key); if (value !== undefined && value !== data) { readFileCache.delete(key); - sourceFileCache.delete(key); + sourceFileCache.forEach(function (map) { return map.delete(key); }); } else if (getSourceFileWithCache) { - var sourceFile = sourceFileCache.get(key); - if (sourceFile && sourceFile.text !== data) { - sourceFileCache.delete(key); - } + sourceFileCache.forEach(function (map) { + var sourceFile = map.get(key); + if (sourceFile && sourceFile.text !== data) { + map.delete(key); + } + }); } originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false)); }; @@ -117555,7 +118868,6 @@ var ts; return resolutions; } ts.loadWithTypeDirectiveCache = loadWithTypeDirectiveCache; - ; /** * Calculates the resulting resolution mode for some reference in some file - this is generally the explicitly * provided resolution mode in the reference, unless one is not present, in which case it is the mode of the containing file. @@ -117755,7 +119067,7 @@ var ts; * Determines if program structure is upto date or needs to be recreated */ /* @internal */ - function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { + function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) { // If we haven't created a program yet or have changed automatic type directives, then it is not up-to-date if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames())) return false; @@ -117783,7 +119095,7 @@ var ts; return true; function sourceFileNotUptoDate(sourceFile) { return !sourceFileVersionUptoDate(sourceFile) || - hasInvalidatedResolution(sourceFile.path); + hasInvalidatedResolutions(sourceFile.path); } function sourceFileVersionUptoDate(sourceFile) { return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName); @@ -118029,7 +119341,7 @@ var ts; var moduleResolutionCache; var typeReferenceDirectiveResolutionCache; var actualResolveModuleNamesWorker; - var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; + var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse; if (host.resolveModuleNames) { actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) { // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. @@ -118476,7 +119788,7 @@ var ts; for (var i = 0; i < moduleNames.length; i++) { var moduleName = moduleNames[i]; // If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions - if (file === oldSourceFile && !hasInvalidatedResolution(oldSourceFile.path)) { + if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) { var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i)); if (oldResolvedModule) { if (ts.isTraceEnabled(options, host)) { @@ -118712,7 +120024,7 @@ var ts; // tentatively approve the file modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile }); } - else if (hasInvalidatedResolution(oldSourceFile.path)) { + else if (hasInvalidatedResolutions(oldSourceFile.path)) { // 'module/types' references could have changed structureIsReused = 1 /* StructureIsReused.SafeModules */; // add file to the modified list so that we will resolve it later @@ -119100,22 +120412,22 @@ var ts; // Return directly from the case if the given node doesnt want to visit each child // Otherwise break to visit each child switch (parent.kind) { - case 164 /* SyntaxKind.Parameter */: - case 167 /* SyntaxKind.PropertyDeclaration */: - case 169 /* SyntaxKind.MethodDeclaration */: + case 166 /* SyntaxKind.Parameter */: + case 169 /* SyntaxKind.PropertyDeclaration */: + case 171 /* SyntaxKind.MethodDeclaration */: if (parent.questionToken === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, "?")); return "skip"; } // falls through - case 168 /* SyntaxKind.MethodSignature */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: - case 254 /* SyntaxKind.VariableDeclaration */: + case 170 /* SyntaxKind.MethodSignature */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: + case 257 /* SyntaxKind.VariableDeclaration */: // type annotation if (parent.type === node) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_annotations_can_only_be_used_in_TypeScript_files)); @@ -119123,65 +120435,68 @@ var ts; } } switch (node.kind) { - case 267 /* SyntaxKind.ImportClause */: + case 270 /* SyntaxKind.ImportClause */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "import type")); return "skip"; } break; - case 272 /* SyntaxKind.ExportDeclaration */: + case 275 /* SyntaxKind.ExportDeclaration */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, "export type")); return "skip"; } break; - case 270 /* SyntaxKind.ImportSpecifier */: - case 275 /* SyntaxKind.ExportSpecifier */: + case 273 /* SyntaxKind.ImportSpecifier */: + case 278 /* SyntaxKind.ExportSpecifier */: if (node.isTypeOnly) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, ts.isImportSpecifier(node) ? "import...type" : "export...type")); return "skip"; } break; - case 265 /* SyntaxKind.ImportEqualsDeclaration */: + case 268 /* SyntaxKind.ImportEqualsDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_TypeScript_files)); return "skip"; - case 271 /* SyntaxKind.ExportAssignment */: + case 274 /* SyntaxKind.ExportAssignment */: if (node.isExportEquals) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 291 /* SyntaxKind.HeritageClause */: + case 294 /* SyntaxKind.HeritageClause */: var heritageClause = node; if (heritageClause.token === 117 /* SyntaxKind.ImplementsKeyword */) { diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 258 /* SyntaxKind.InterfaceDeclaration */: + case 261 /* SyntaxKind.InterfaceDeclaration */: var interfaceKeyword = ts.tokenToString(118 /* SyntaxKind.InterfaceKeyword */); ts.Debug.assertIsDefined(interfaceKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, interfaceKeyword)); return "skip"; - case 261 /* SyntaxKind.ModuleDeclaration */: - var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(142 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(141 /* SyntaxKind.ModuleKeyword */); + case 264 /* SyntaxKind.ModuleDeclaration */: + var moduleKeyword = node.flags & 16 /* NodeFlags.Namespace */ ? ts.tokenToString(143 /* SyntaxKind.NamespaceKeyword */) : ts.tokenToString(142 /* SyntaxKind.ModuleKeyword */); ts.Debug.assertIsDefined(moduleKeyword); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, moduleKeyword)); return "skip"; - case 259 /* SyntaxKind.TypeAliasDeclaration */: + case 262 /* SyntaxKind.TypeAliasDeclaration */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Type_aliases_can_only_be_used_in_TypeScript_files)); return "skip"; - case 260 /* SyntaxKind.EnumDeclaration */: + case 263 /* SyntaxKind.EnumDeclaration */: var enumKeyword = ts.Debug.checkDefined(ts.tokenToString(92 /* SyntaxKind.EnumKeyword */)); diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_declarations_can_only_be_used_in_TypeScript_files, enumKeyword)); return "skip"; - case 230 /* SyntaxKind.NonNullExpression */: + case 232 /* SyntaxKind.NonNullExpression */: diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.Non_null_assertions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 229 /* SyntaxKind.AsExpression */: + case 231 /* SyntaxKind.AsExpression */: diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_assertion_expressions_can_only_be_used_in_TypeScript_files)); return "skip"; - case 211 /* SyntaxKind.TypeAssertionExpression */: + case 235 /* SyntaxKind.SatisfiesExpression */: + diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files)); + return "skip"; + case 213 /* SyntaxKind.TypeAssertionExpression */: ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX. } } @@ -119190,53 +120505,55 @@ var ts; diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning)); } switch (parent.kind) { - case 257 /* SyntaxKind.ClassDeclaration */: - case 226 /* SyntaxKind.ClassExpression */: - case 169 /* SyntaxKind.MethodDeclaration */: - case 171 /* SyntaxKind.Constructor */: - case 172 /* SyntaxKind.GetAccessor */: - case 173 /* SyntaxKind.SetAccessor */: - case 213 /* SyntaxKind.FunctionExpression */: - case 256 /* SyntaxKind.FunctionDeclaration */: - case 214 /* SyntaxKind.ArrowFunction */: + case 260 /* SyntaxKind.ClassDeclaration */: + case 228 /* SyntaxKind.ClassExpression */: + case 171 /* SyntaxKind.MethodDeclaration */: + case 173 /* SyntaxKind.Constructor */: + case 174 /* SyntaxKind.GetAccessor */: + case 175 /* SyntaxKind.SetAccessor */: + case 215 /* SyntaxKind.FunctionExpression */: + case 259 /* SyntaxKind.FunctionDeclaration */: + case 216 /* SyntaxKind.ArrowFunction */: // Check type parameters if (nodes === parent.typeParameters) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_parameter_declarations_can_only_be_used_in_TypeScript_files)); return "skip"; } // falls through - case 237 /* SyntaxKind.VariableStatement */: + case 240 /* SyntaxKind.VariableStatement */: // Check modifiers if (nodes === parent.modifiers) { - checkModifiers(parent.modifiers, parent.kind === 237 /* SyntaxKind.VariableStatement */); + checkModifiers(parent.modifiers, parent.kind === 240 /* SyntaxKind.VariableStatement */); return "skip"; } break; - case 167 /* SyntaxKind.PropertyDeclaration */: + case 169 /* SyntaxKind.PropertyDeclaration */: // Check modifiers of property declaration if (nodes === parent.modifiers) { for (var _i = 0, _a = nodes; _i < _a.length; _i++) { var modifier = _a[_i]; - if (ts.isModifier(modifier) && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */) { + if (ts.isModifier(modifier) + && modifier.kind !== 124 /* SyntaxKind.StaticKeyword */ + && modifier.kind !== 127 /* SyntaxKind.AccessorKeyword */) { diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); } } return "skip"; } break; - case 164 /* SyntaxKind.Parameter */: + case 166 /* SyntaxKind.Parameter */: // Check modifiers of parameter declaration if (nodes === parent.modifiers && ts.some(nodes, ts.isModifier)) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Parameter_modifiers_can_only_be_used_in_TypeScript_files)); return "skip"; } break; - case 208 /* SyntaxKind.CallExpression */: - case 209 /* SyntaxKind.NewExpression */: - case 228 /* SyntaxKind.ExpressionWithTypeArguments */: - case 279 /* SyntaxKind.JsxSelfClosingElement */: - case 280 /* SyntaxKind.JsxOpeningElement */: - case 210 /* SyntaxKind.TaggedTemplateExpression */: + case 210 /* SyntaxKind.CallExpression */: + case 211 /* SyntaxKind.NewExpression */: + case 230 /* SyntaxKind.ExpressionWithTypeArguments */: + case 282 /* SyntaxKind.JsxSelfClosingElement */: + case 283 /* SyntaxKind.JsxOpeningElement */: + case 212 /* SyntaxKind.TaggedTemplateExpression */: // Check type arguments if (nodes === parent.typeArguments) { diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.Type_arguments_can_only_be_used_in_TypeScript_files)); @@ -119258,18 +120575,19 @@ var ts; case 123 /* SyntaxKind.PublicKeyword */: case 121 /* SyntaxKind.PrivateKeyword */: case 122 /* SyntaxKind.ProtectedKeyword */: - case 145 /* SyntaxKind.ReadonlyKeyword */: - case 135 /* SyntaxKind.DeclareKeyword */: + case 146 /* SyntaxKind.ReadonlyKeyword */: + case 136 /* SyntaxKind.DeclareKeyword */: case 126 /* SyntaxKind.AbstractKeyword */: - case 159 /* SyntaxKind.OverrideKeyword */: + case 161 /* SyntaxKind.OverrideKeyword */: case 101 /* SyntaxKind.InKeyword */: - case 144 /* SyntaxKind.OutKeyword */: + case 145 /* SyntaxKind.OutKeyword */: diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics.The_0_modifier_can_only_be_used_in_TypeScript_files, ts.tokenToString(modifier.kind))); break; // These are all legal modifiers. case 124 /* SyntaxKind.StaticKeyword */: case 93 /* SyntaxKind.ExportKeyword */: case 88 /* SyntaxKind.DefaultKeyword */: + case 127 /* SyntaxKind.AccessorKeyword */: } } } @@ -120194,10 +121512,12 @@ var ts; if (options.preserveConstEnums === false) { createDiagnosticForOptionName(ts.Diagnostics.Option_preserveConstEnums_cannot_be_disabled_when_isolatedModules_is_enabled, "preserveConstEnums", "isolatedModules"); } - var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* ScriptKind.JSON */; }); - if (firstNonExternalModuleSourceFile) { - var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile); - programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(firstNonExternalModuleSourceFile.fileName))); + for (var _a = 0, files_5 = files; _a < files_5.length; _a++) { + var file = files_5[_a]; + if (!ts.isExternalModule(file) && !ts.isSourceFileJS(file) && !file.isDeclarationFile && file.scriptKind !== 6 /* ScriptKind.JSON */) { + var span = ts.getErrorSpanForNode(file, file); + programDiagnostics.add(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics._0_cannot_be_compiled_under_isolatedModules_because_it_is_considered_a_global_script_file_Add_an_import_export_or_an_empty_export_statement_to_make_it_a_module, ts.getBaseFileName(file.fileName))); + } } } else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ScriptTarget.ES2015 */ && options.module === ts.ModuleKind.None) { @@ -121448,10 +122768,16 @@ var ts; var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined; var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile && !ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions); + // We can only reuse emit signatures (i.e. .d.ts signatures) if the .d.ts file is unchanged, + // which will eg be depedent on change in options like declarationDir and outDir options are unchanged. + // We need to look in oldState.compilerOptions, rather than oldCompilerOptions (i.e.we need to disregard useOldState) because + // oldCompilerOptions can be undefined if there was change in say module from None to some other option + // which would make useOldState as false since we can now use reference maps that are needed to track what to emit, what to check etc + // but that option change does not affect d.ts file name so emitSignatures should still be reused. var canCopyEmitSignatures = compilerOptions.composite && (oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) && !outFilePath && - !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldCompilerOptions); + !ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions); if (useOldState) { // Copy old state's changed files set (_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); }); @@ -122666,7 +123992,7 @@ var ts; var isNonDirectorySeparatorRoot = rootLength > 1 || dirPath.charCodeAt(0) !== 47 /* CharacterCodes.slash */; if (isNonDirectorySeparatorRoot && dirPath.search(/[a-zA-Z]:/) !== 0 && // Non dos style paths - pathPartForUserCheck.search(/[a-zA-z]\$\//) === 0) { // Dos style nextPart + pathPartForUserCheck.search(/[a-zA-Z]\$\//) === 0) { // Dos style nextPart nextDirectorySeparator = dirPath.indexOf(ts.directorySeparator, nextDirectorySeparator + 1); if (nextDirectorySeparator === -1) { // ignore "//vda1cs4850/c$/folderAtRoot" @@ -122750,7 +124076,7 @@ var ts; invalidateResolutionOfFile: invalidateResolutionOfFile, invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations, setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports, - createHasInvalidatedResolution: createHasInvalidatedResolution, + createHasInvalidatedResolutions: createHasInvalidatedResolutions, isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports, updateTypeRootsWatch: updateTypeRootsWatch, closeTypeRootsWatch: closeTypeRootsWatch, @@ -122805,17 +124131,13 @@ var ts; var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path); return !!value && !!value.length; } - function createHasInvalidatedResolution(forceAllFilesAsInvalidated) { + function createHasInvalidatedResolutions(customHasInvalidatedResolutions) { // Ensure pending resolutions are applied invalidateResolutionsOfFailedLookupLocations(); - if (forceAllFilesAsInvalidated) { - // Any file asked would have invalidated resolution - filesWithInvalidatedResolutions = undefined; - return ts.returnTrue; - } var collected = filesWithInvalidatedResolutions; filesWithInvalidatedResolutions = undefined; - return function (path) { return (!!collected && collected.has(path)) || + return function (path) { return customHasInvalidatedResolutions(path) || + !!(collected === null || collected === void 0 ? void 0 : collected.has(path)) || isFileWithInvalidatedNonRelativeUnresolvedImports(path); }; } function startCachingPerDirectoryResolution() { @@ -124176,15 +125498,21 @@ var ts; return undefined; } function tryGetModuleNameFromRootDirs(rootDirs, moduleFileName, sourceDirectory, getCanonicalFileName, ending, compilerOptions) { - var normalizedTargetPath = getPathRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); - if (normalizedTargetPath === undefined) { + var normalizedTargetPaths = getPathsRelativeToRootDirs(moduleFileName, rootDirs, getCanonicalFileName); + if (normalizedTargetPaths === undefined) { + return undefined; + } + var normalizedSourcePaths = getPathsRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); + var relativePaths = ts.flatMap(normalizedSourcePaths, function (sourcePath) { + return ts.map(normalizedTargetPaths, function (targetPath) { return ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(sourcePath, targetPath, getCanonicalFileName)); }); + }); + var shortest = ts.min(relativePaths, ts.compareNumberOfDirectorySeparators); + if (!shortest) { return undefined; } - var normalizedSourcePath = getPathRelativeToRootDirs(sourceDirectory, rootDirs, getCanonicalFileName); - var relativePath = normalizedSourcePath !== undefined ? ts.ensurePathIsNonModuleName(ts.getRelativePathFromDirectory(normalizedSourcePath, normalizedTargetPath, getCanonicalFileName)) : normalizedTargetPath; return ts.getEmitModuleResolutionKind(compilerOptions) === ts.ModuleResolutionKind.NodeJs - ? removeExtensionAndIndexPostFix(relativePath, ending, compilerOptions) - : ts.removeFileExtension(relativePath); + ? removeExtensionAndIndexPostFix(shortest, ending, compilerOptions) + : ts.removeFileExtension(shortest); } function tryGetModuleNameAsNodeModule(_a, _b, importingSourceFile, host, options, userPreferences, packageNameOnly, overrideMode) { var path = _a.path, isRedirect = _a.isRedirect; @@ -124321,8 +125649,8 @@ var ts; } } } - function getPathRelativeToRootDirs(path, rootDirs, getCanonicalFileName) { - return ts.firstDefined(rootDirs, function (rootDir) { + function getPathsRelativeToRootDirs(path, rootDirs, getCanonicalFileName) { + return ts.mapDefined(rootDirs, function (rootDir) { var relativePath = getRelativePathIfInDirectory(path, rootDir, getCanonicalFileName); return relativePath !== undefined && isPathRelativeToParent(relativePath) ? undefined : relativePath; }); @@ -125033,18 +126361,14 @@ var ts; if (host.getBuildInfo) { // host provides buildinfo, get it from there. This allows host to cache it buildInfo = host.getBuildInfo(buildInfoPath, compilerOptions.configFilePath); - if (!buildInfo) - return undefined; } else { var content = host.readFile(buildInfoPath); if (!content) return undefined; - buildInfo = ts.getBuildInfo(content); + buildInfo = ts.getBuildInfo(buildInfoPath, content); } - if (buildInfo.version !== ts.version) - return undefined; - if (!buildInfo.program) + if (!buildInfo || buildInfo.version !== ts.version || !buildInfo.program) return undefined; return ts.createBuilderProgramUsingProgramBuildInfo(buildInfo.program, buildInfoPath, host); } @@ -125199,6 +126523,10 @@ var ts; ts.maybeBind(host, host.getModuleResolutionCache) : (function () { return resolutionCache.getModuleResolutionCache(); }); var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives; + // All resolutions are invalid if user provided resolutions and didnt supply hasInvalidatedResolutions + var customHasInvalidatedResolutions = userProvidedResolution ? + ts.maybeBind(host, host.hasInvalidatedResolutions) || ts.returnTrue : + ts.returnFalse; builderProgram = readBuilderProgram(compilerOptions, compilerHost); synchronizeProgram(); // Update the wild card directory watch @@ -125264,9 +126592,9 @@ var ts; resolutionCache.clear(); } } - // All resolutions are invalid if user provided resolutions - var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution); - if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { + var hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions); + var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile; + if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { if (hasChangedConfigFileParsingErrors) { if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); @@ -125279,15 +126607,20 @@ var ts; if (reportFileChangeDetectedOnCreateProgram) { reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation); } - createNewProgram(hasInvalidatedResolution); + createNewProgram(hasInvalidatedResolutions); } reportFileChangeDetectedOnCreateProgram = false; if (host.afterProgramCreate && program !== builderProgram) { host.afterProgramCreate(builderProgram); } + compilerHost.readFile = originalReadFile; + compilerHost.fileExists = originalFileExists; + compilerHost.directoryExists = originalDirectoryExists; + compilerHost.createDirectory = originalCreateDirectory; + compilerHost.writeFile = originalWriteFile; return builderProgram; } - function createNewProgram(hasInvalidatedResolution) { + function createNewProgram(hasInvalidatedResolutions) { // Compile the program writeLog("CreatingProgramWith::"); writeLog(" roots: ".concat(JSON.stringify(rootFileNames))); @@ -125298,7 +126631,7 @@ var ts; hasChangedCompilerOptions = false; hasChangedConfigFileParsingErrors = false; resolutionCache.startCachingPerDirectoryResolution(); - compilerHost.hasInvalidatedResolution = hasInvalidatedResolution; + compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions; compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames; var oldProgram = getCurrentProgram(); builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences); @@ -125762,19 +127095,20 @@ var ts; */ UpToDateStatusType[UpToDateStatusType["OutOfDateWithPrepend"] = 3] = "OutOfDateWithPrepend"; UpToDateStatusType[UpToDateStatusType["OutputMissing"] = 4] = "OutputMissing"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 5] = "OutOfDateWithSelf"; - UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 6] = "OutOfDateWithUpstream"; - UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 7] = "OutOfDateBuildInfo"; - UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 8] = "UpstreamOutOfDate"; - UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 9] = "UpstreamBlocked"; - UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 10] = "ComputingUpstream"; - UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 11] = "TsVersionOutputOfDate"; - UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 12] = "UpToDateWithInputFileText"; + UpToDateStatusType[UpToDateStatusType["ErrorReadingFile"] = 5] = "ErrorReadingFile"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithSelf"] = 6] = "OutOfDateWithSelf"; + UpToDateStatusType[UpToDateStatusType["OutOfDateWithUpstream"] = 7] = "OutOfDateWithUpstream"; + UpToDateStatusType[UpToDateStatusType["OutOfDateBuildInfo"] = 8] = "OutOfDateBuildInfo"; + UpToDateStatusType[UpToDateStatusType["UpstreamOutOfDate"] = 9] = "UpstreamOutOfDate"; + UpToDateStatusType[UpToDateStatusType["UpstreamBlocked"] = 10] = "UpstreamBlocked"; + UpToDateStatusType[UpToDateStatusType["ComputingUpstream"] = 11] = "ComputingUpstream"; + UpToDateStatusType[UpToDateStatusType["TsVersionOutputOfDate"] = 12] = "TsVersionOutputOfDate"; + UpToDateStatusType[UpToDateStatusType["UpToDateWithInputFileText"] = 13] = "UpToDateWithInputFileText"; /** * Projects with no outputs (i.e. "solution" files) */ - UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 13] = "ContainerOnly"; - UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 14] = "ForceBuild"; + UpToDateStatusType[UpToDateStatusType["ContainerOnly"] = 14] = "ContainerOnly"; + UpToDateStatusType[UpToDateStatusType["ForceBuild"] = 15] = "ForceBuild"; })(UpToDateStatusType = ts.UpToDateStatusType || (ts.UpToDateStatusType = {})); function resolveConfigFileProjectName(project) { if (ts.fileExtensionIs(project, ".json" /* Extension.Json */)) { @@ -125992,6 +127326,7 @@ var ts; if (value) { return isParsedCommandLine(value) ? value : undefined; } + ts.performance.mark("SolutionBuilder::beforeConfigFileParsing"); var diagnostic; var parseConfigFileHost = state.parseConfigFileHost, baseCompilerOptions = state.baseCompilerOptions, baseWatchOptions = state.baseWatchOptions, extendedConfigCache = state.extendedConfigCache, host = state.host; var parsed; @@ -126006,6 +127341,8 @@ var ts; parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop; } configFileCache.set(configFilePath, parsed || diagnostic); + ts.performance.mark("SolutionBuilder::afterConfigFileParsing"); + ts.performance.measure("SolutionBuilder::Config file parsing", "SolutionBuilder::beforeConfigFileParsing", "SolutionBuilder::afterConfigFileParsing"); return parsed; } function resolveProjectName(state, name) { @@ -126205,6 +127542,7 @@ var ts; if (updateOutputFileStampsPending) { updateOutputTimestamps(state, config, projectPath); } + ts.performance.mark("SolutionBuilder::Timestamps only updates"); return doneInvalidatedProject(state, projectPath); } }; @@ -126298,6 +127636,10 @@ var ts; }; function done(cancellationToken, writeFile, customTransformers) { executeSteps(BuildStep.Done, cancellationToken, writeFile, customTransformers); + if (kind === InvalidatedProjectKind.Build) + ts.performance.mark("SolutionBuilder::Projects built"); + else + ts.performance.mark("SolutionBuilder::Bundles updated"); return doneInvalidatedProject(state, projectPath); } function withProgramOrUndefined(action) { @@ -126476,13 +127818,13 @@ var ts; var emitterDiagnostics = ts.createDiagnosticCollection(); var emittedOutputs = new ts.Map(); var resultFlags = BuildResultFlags.DeclarationOutputUnchanged; - var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo; + var existingBuildInfo = state.buildInfoCache.get(projectPath).buildInfo || undefined; outputFiles.forEach(function (_a) { var _b, _c; var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark, buildInfo = _a.buildInfo; emittedOutputs.set(toPath(state, name), name); if (buildInfo) { - if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { + if (((_b = buildInfo.program) === null || _b === void 0 ? void 0 : _b.outSignature) !== ((_c = existingBuildInfo === null || existingBuildInfo === void 0 ? void 0 : existingBuildInfo.program) === null || _c === void 0 ? void 0 : _c.outSignature)) { resultFlags &= ~BuildResultFlags.DeclarationOutputUnchanged; } setBuildInfo(state, buildInfo, projectPath, config.options, resultFlags); @@ -126775,8 +128117,7 @@ var ts; return existing.buildInfo || undefined; } var value = state.readFileWithCache(buildInfoPath); - var buildInfo = value ? ts.getBuildInfo(value) : undefined; - ts.Debug.assert(modifiedTime || !buildInfo); + var buildInfo = value ? ts.getBuildInfo(buildInfoPath, value) : undefined; state.buildInfoCache.set(resolvedConfigPath, { path: path, buildInfo: buildInfo || false, modifiedTime: modifiedTime || ts.missingFileModifiedTime }); return buildInfo; } @@ -126861,7 +128202,14 @@ var ts; missingOutputFileName: buildInfoPath }; } - var buildInfo = ts.Debug.checkDefined(getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime)); + var buildInfo = getBuildInfo(state, buildInfoPath, resolvedPath, buildInfoTime); + if (!buildInfo) { + // Error reading buildInfo + return { + type: ts.UpToDateStatusType.ErrorReadingFile, + fileName: buildInfoPath + }; + } if ((buildInfo.bundle || buildInfo.program) && buildInfo.version !== ts.version) { return { type: ts.UpToDateStatusType.TsVersionOutputOfDate, @@ -126870,8 +128218,15 @@ var ts; } if (buildInfo.program) { // If there are pending changes that are not emitted, project is out of date + // When there are syntax errors, changeFileSet will have list of files changed (irrespective of noEmit) + // But in case of semantic error we need special treatment. + // Checking presence of affectedFilesPendingEmit list is fast and good way to tell if there were semantic errors and file emit was blocked + // But if noEmit is true, affectedFilesPendingEmit will have file list even if there are no semantic errors to preserve list of files to be emitted when running with noEmit false + // So with noEmit set to true, check on semantic diagnostics needs to be explicit as oppose to when it is false when only files pending emit is sufficient if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) || - (!project.options.noEmit && ((_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length))) { + (!project.options.noEmit ? + (_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length : + ts.some(buildInfo.program.semanticDiagnosticsPerFile, ts.isArray))) { return { type: ts.UpToDateStatusType.OutOfDateBuildInfo, buildInfoFile: buildInfoPath @@ -127046,7 +128401,10 @@ var ts; if (prior !== undefined) { return prior; } + ts.performance.mark("SolutionBuilder::beforeUpToDateCheck"); var actual = getUpToDateStatusWorker(state, project, resolvedPath); + ts.performance.mark("SolutionBuilder::afterUpToDateCheck"); + ts.performance.measure("SolutionBuilder::Up-to-date check", "SolutionBuilder::beforeUpToDateCheck", "SolutionBuilder::afterUpToDateCheck"); state.projectStatus.set(resolvedPath, actual); return actual; } @@ -127184,6 +128542,13 @@ var ts; } } function build(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var result = buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + return result; + } + function buildWorker(state, project, cancellationToken, writeFile, getCustomTransformers, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127211,6 +128576,13 @@ var ts; : ts.ExitStatus.DiagnosticsPresent_OutputsSkipped; } function clean(state, project, onlyReferences) { + ts.performance.mark("SolutionBuilder::beforeClean"); + var result = cleanWorker(state, project, onlyReferences); + ts.performance.mark("SolutionBuilder::afterClean"); + ts.performance.measure("SolutionBuilder::Clean", "SolutionBuilder::beforeClean", "SolutionBuilder::afterClean"); + return result; + } + function cleanWorker(state, project, onlyReferences) { var buildOrder = getBuildOrderFor(state, project, onlyReferences); if (!buildOrder) return ts.ExitStatus.InvalidProject_OutputsSkipped; @@ -127284,6 +128656,14 @@ var ts; state.timerToBuildInvalidatedProject = hostWithWatch.setTimeout(buildNextInvalidatedProject, time, state, changeDetected); } function buildNextInvalidatedProject(state, changeDetected) { + ts.performance.mark("SolutionBuilder::beforeBuild"); + var buildOrder = buildNextInvalidatedProjectWorker(state, changeDetected); + ts.performance.mark("SolutionBuilder::afterBuild"); + ts.performance.measure("SolutionBuilder::Build", "SolutionBuilder::beforeBuild", "SolutionBuilder::afterBuild"); + if (buildOrder) + reportErrorSummary(state, buildOrder); + } + function buildNextInvalidatedProjectWorker(state, changeDetected) { state.timerToBuildInvalidatedProject = undefined; if (state.reportFileChangeDetected) { state.reportFileChangeDetected = false; @@ -127316,7 +128696,7 @@ var ts; } } disableCache(state); - reportErrorSummary(state, buildOrder); + return buildOrder; } function watchConfigFile(state, resolved, resolvedPath, parsed) { if (!state.watch || state.allWatchedConfigFiles.has(resolvedPath)) @@ -127371,6 +128751,7 @@ var ts; function startWatching(state, buildOrder) { if (!state.watchAllProjectsPending) return; + ts.performance.mark("SolutionBuilder::beforeWatcherCreation"); state.watchAllProjectsPending = false; for (var _i = 0, _a = getBuildOrderFromAnyBuildOrder(buildOrder); _i < _a.length; _i++) { var resolved = _a[_i]; @@ -127388,6 +128769,8 @@ var ts; watchPackageJsonFiles(state, resolved, resolvedPath, cfg); } } + ts.performance.mark("SolutionBuilder::afterWatcherCreation"); + ts.performance.measure("SolutionBuilder::Watcher creation", "SolutionBuilder::beforeWatcherCreation", "SolutionBuilder::afterWatcherCreation"); } function stopWatching(state) { ts.clearMap(state.allWatchedConfigFiles, ts.closeFileWatcher); @@ -127501,6 +128884,8 @@ var ts; return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_1_is_older_than_input_2, relName(state, configFileName), relName(state, status.outOfDateOutputFileName), relName(state, status.newerProjectName)); case ts.UpToDateStatusType.OutputMissing: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, relName(state, configFileName), relName(state, status.missingOutputFileName)); + case ts.UpToDateStatusType.ErrorReadingFile: + return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_there_was_error_reading_file_1, relName(state, configFileName), relName(state, status.fileName)); case ts.UpToDateStatusType.OutOfDateBuildInfo: return reportStatus(state, ts.Diagnostics.Project_0_is_out_of_date_because_buildinfo_file_1_indicates_that_some_of_the_changes_were_not_emitted, relName(state, configFileName), relName(state, status.buildInfoFile)); case ts.UpToDateStatusType.UpToDate: diff --git a/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json b/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json index bc09e0e36..b22244527 100644 --- a/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +++ b/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json @@ -3,8 +3,8 @@ "A_0_modifier_cannot_be_used_with_an_import_declaration_1079": "“{0}”修饰符不能与导入声明一起使用。", "A_0_parameter_must_be_the_first_parameter_2680": "“{0}”参数必须是第一个参数。", "A_JSDoc_typedef_comment_may_not_contain_multiple_type_tags_8033": "JSDoc \"@typedef\" 注释不能包含多个 \"@type\" 标记。", - "A_bigint_literal_cannot_use_exponential_notation_1352": "bigint 文本不能使用指数符号。", - "A_bigint_literal_must_be_an_integer_1353": "bigint 文本必须是整数。", + "A_bigint_literal_cannot_use_exponential_notation_1352": "BigInt 字面量中不能使用指数符号。", + "A_bigint_literal_must_be_an_integer_1353": "BigInt 字面量必须是整数。", "A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature_2463": "绑定模式参数在实现签名中不能为可选参数。", "A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement_1105": "\"break\" 语句只能在封闭迭代或 switch 语句内使用。", "A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement_1116": "\"break\" 语句只能跳转到封闭语句的标签。", @@ -20,7 +20,7 @@ "A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_t_1165": "环境上下文中的计算属性名称必须引用类型为文本类型或 \"unique symbol\" 类型的表达式。", "A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_1169": "接口中的计算属性名称必须引用必须引用类型为文本类型或 \"unique symbol\" 的表达式。", "A_computed_property_name_must_be_of_type_string_number_symbol_or_any_2464": "计算属性名的类型必须为 \"string\"、\"number\"、\"symbol\" 或 \"any\"。", - "A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array__1355": "\"const\" 断言只能用于引用枚举成员、字符串、数字、布尔值、数组或对象文本。", + "A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array__1355": "'const' 断言只能作用于枚举成员、字符串、数字、布尔值、数组或对象字面量。", "A_const_enum_member_can_only_be_accessed_using_a_string_literal_2476": "只有使用字符串文本才能访问常数枚举成员。", "A_const_initializer_in_an_ambient_context_must_be_a_string_or_numeric_literal_or_literal_enum_refere_1254": "环境上下文中的 \"const\" 初始化表达式必须为字符串、数字文本或文本枚举引用。", "A_constructor_cannot_contain_a_super_call_when_its_class_extends_null_17005": "当构造函数的类扩展 \"null\" 时,它不能包含 \"super\" 调用。", @@ -38,7 +38,7 @@ "A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES20_2711": "动态导入调用返回 “Promise”。请确保具有对 “Promise” 的声明或在 “--lib” 选项中包含了 “ES2015”。", "A_file_cannot_have_a_reference_to_itself_1006": "文件不能引用自身。", "A_function_returning_never_cannot_have_a_reachable_end_point_2534": "返回“从不”的函数不能具有可访问的终结点。", - "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679": "使用 \"new\" 关键字调用的函数不可具有“失效”的 \"this\" 类型。", + "A_function_that_is_called_with_the_new_keyword_cannot_have_a_this_type_that_is_void_2679": "使用 'new' 关键字调用的函数的 'this' 类型不能为 'void'。", "A_function_whose_declared_type_is_neither_void_nor_any_must_return_a_value_2355": "其声明类型不为 \"void\" 或 \"any\" 的函数必须返回值。", "A_generator_cannot_have_a_void_type_annotation_2505": "生成器不能具有 \"void\" 类型批注。", "A_get_accessor_cannot_have_parameters_1054": "\"get\" 访问器不能具有参数。", @@ -57,13 +57,13 @@ "A_namespace_declaration_is_only_allowed_at_the_top_level_of_a_namespace_or_module_1235": "命名空间声明只允许位于命名空间或模块的顶层。", "A_non_dry_build_would_build_project_0_6357": "非 -dry 生成将生成项目“{0}”", "A_non_dry_build_would_delete_the_following_files_Colon_0_6356": "非 -dry 生成将删除以下文件: {0}", - "A_non_dry_build_would_update_output_of_project_0_6375": "非干燥生成将更新项目 \"{0}\" 的输出", - "A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374": "非干燥生成将更新项目 \"{0}\" 的输出的时间戳", + "A_non_dry_build_would_update_output_of_project_0_6375": "非 dry 生成将更新项目 '{0}' 的输出", + "A_non_dry_build_would_update_timestamps_for_output_of_project_0_6374": "非 dry 生成将更新项目 '{0}' 的输出的时间戳", "A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation_2371": "只允许在函数或构造函数实现中使用参数初始化表达式。", "A_parameter_property_cannot_be_declared_using_a_rest_parameter_1317": "不能使用 rest 参数声明参数属性。", "A_parameter_property_is_only_allowed_in_a_constructor_implementation_2369": "只允许在构造函数实现中使用参数属性。", "A_parameter_property_may_not_be_declared_using_a_binding_pattern_1187": "不能使用绑定模式声明参数属性。", - "A_promise_must_have_a_then_method_1059": "承诺必须具有 \"then\" 方法。", + "A_promise_must_have_a_then_method_1059": "'Promise' 必须具有 'then' 方法。", "A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly_1331": "类型为 \"unique symbol\" 的类的属性必须同时为 \"static\" 和 \"readonly\"。", "A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly_1330": "类型为 \"unique symbol\" 的接口或类型文本的属性必须为 \"readonly\"。", "A_required_element_cannot_follow_an_optional_element_1257": "必选元素不能位于可选元素后。", @@ -116,13 +116,13 @@ "Add_all_missing_async_modifiers_95041": "添加所有缺失的 \"async\" 修饰符", "Add_all_missing_attributes_95168": "添加所有缺少的属性", "Add_all_missing_call_parentheses_95068": "添加所有缺失的调用括号", - "Add_all_missing_function_declarations_95157": "添加缺少的所有函数声明", + "Add_all_missing_function_declarations_95157": "添加所有缺少的函数声明", "Add_all_missing_imports_95064": "添加所有缺少的导入", "Add_all_missing_members_95022": "添加所有缺少的成员", "Add_all_missing_override_modifiers_95162": "添加所有缺失的 \"override\" 修饰符", "Add_all_missing_properties_95166": "添加所有缺少的属性", "Add_all_missing_return_statement_95114": "添加所有缺少的 return 语句", - "Add_all_missing_super_calls_95039": "添加所有缺失的超级调用", + "Add_all_missing_super_calls_95039": "添加所有缺失的 super() 调用", "Add_async_modifier_to_containing_function_90029": "将异步修饰符添加到包含函数", "Add_await_95083": "添加 \"await\"", "Add_await_to_initializer_for_0_95084": "将 \"await\" 添加到 \"{0}\" 的初始值设定项", @@ -158,18 +158,18 @@ "Add_undefined_to_a_type_when_accessed_using_an_index_6674": "使用索引访问时,将 “undefined” 添加到类型。", "Add_undefined_to_optional_property_type_95169": "将 “undefined” 添加到可选属性类型", "Add_undefined_type_to_all_uninitialized_properties_95029": "将未定义的类型添加到未初始化的所有属性", - "Add_undefined_type_to_property_0_95018": "向属性“{0}”添加“未定义”类型", + "Add_undefined_type_to_property_0_95018": "向属性“{0}”添加 \"undefined\" 类型", "Add_unknown_conversion_for_non_overlapping_types_95069": "为非重叠类型添加 \"unknown\" 转换", "Add_unknown_to_all_conversions_of_non_overlapping_types_95070": "将 \"unknown\" 添加到非重叠类型的所有转换", - "Add_void_to_Promise_resolved_without_a_value_95143": "将 \"void\" 添加到已解析但没有值的承诺", - "Add_void_to_all_Promises_resolved_without_a_value_95144": "将 \"void\" 添加到所有已解析但没有值的承诺", + "Add_void_to_Promise_resolved_without_a_value_95143": "将 \"void\" 添加到已解析但没有值的 Promise", + "Add_void_to_all_Promises_resolved_without_a_value_95144": "将 \"void\" 添加到所有已解析但没有值的 Promise", "Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript__5068": "添加 tsconfig.json 文件有助于组织包含 TypeScript 和 JavaScript 文件的项目。有关详细信息,请访问 https://aka.ms/tsconfig。", "All_declarations_of_0_must_have_identical_constraints_2838": "\"{0}\" 的所有声明必须具有相同的限制。", "All_declarations_of_0_must_have_identical_modifiers_2687": "“{0}”的所有声明必须具有相同的修饰符。", "All_declarations_of_0_must_have_identical_type_parameters_2428": "“{0}”的所有声明都必须具有相同的类型参数。", "All_declarations_of_an_abstract_method_must_be_consecutive_2516": "抽象方法的所有声明必须是连续的。", - "All_destructured_elements_are_unused_6198": "未取消使用任何解构元素。", - "All_imports_in_import_declaration_are_unused_6192": "未使用导入声明中的所有导入。", + "All_destructured_elements_are_unused_6198": "所有解构出的成员都未使用。", + "All_imports_in_import_declaration_are_unused_6192": "导入声明中的所有导入都未使用。", "All_type_parameters_are_unused_6205": "未使用任何类型参数。", "All_variables_are_unused_6199": "所有变量均未使用。", "Allow_JavaScript_files_to_be_a_part_of_your_program_Use_the_checkJS_option_to_get_errors_from_these__6600": "允许 JavaScript 文件成为程序的一部分。使用 “checkJS” 选项从这些文件中获取错误。", @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "抽象访问器不能有实现。", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "可访问性修饰符不能与专用标识符一起使用。", "An_accessor_cannot_have_type_parameters_1094": "访问器不能具有类型参数。", + "An_accessor_property_cannot_be_declared_optional_1276": "\"accessor\" 属性不能声明为可选。", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "只允许在文件的顶层中使用环境模块声明。", "An_argument_for_0_was_not_provided_6210": "未提供 \"{0}\" 的自变量。", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "未提供与此绑定模式匹配的自变量。", @@ -208,7 +209,7 @@ "An_export_declaration_cannot_have_modifiers_1193": "导出声明不能有修饰符。", "An_expression_of_type_void_cannot_be_tested_for_truthiness_1345": "无法测试 \"void\" 类型的表达式的真实性。", "An_extended_Unicode_escape_value_must_be_between_0x0_and_0x10FFFF_inclusive_1198": "扩展的 Unicode 转义值必须介于(含) 0x0 和 0x10FFFF 之间。", - "An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal_1351": "标识符或关键字不能紧跟在数字文本之后。", + "An_identifier_or_keyword_cannot_immediately_follow_a_numeric_literal_1351": "标识符或关键字不能紧跟在数字字面量之后。", "An_implementation_cannot_be_declared_in_ambient_contexts_1183": "不能在环境上下文中声明实现。", "An_import_alias_cannot_reference_a_declaration_that_was_exported_using_export_type_1379": "导入别名不能引用使用 \"export type\" 导出的声明。", "An_import_alias_cannot_reference_a_declaration_that_was_imported_using_import_type_1380": "导入别名不能引用使用 \"import type\" 导入的声明。", @@ -260,14 +261,14 @@ "Augmentations_for_the_global_scope_can_only_be_directly_nested_in_external_modules_or_ambient_module_2669": "全局范围的扩大仅可直接嵌套在外部模块中或环境模块声明中。", "Augmentations_for_the_global_scope_should_have_declare_modifier_unless_they_appear_in_already_ambien_2670": "全局范围的扩大应具有 \"declare\" 修饰符,除非它们显示在已有的环境上下文中。", "Auto_discovery_for_typings_is_enabled_in_project_0_Running_extra_resolution_pass_for_module_1_using__6140": "项目“{0}”中启用了键入内容的自动发现。使用缓存位置“{2}”运行模块“{1}”的额外解决传递。", - "Await_expression_cannot_be_used_inside_a_class_static_block_18037": "无法在类静态块内使用 Await 表达式。", + "Await_expression_cannot_be_used_inside_a_class_static_block_18037": "无法在类静态块内使用 await 表达式。", "BUILD_OPTIONS_6919": "生成选项", - "Backwards_Compatibility_6253": "后向兼容性", + "Backwards_Compatibility_6253": "向后兼容性", "Base_class_expressions_cannot_reference_class_type_parameters_2562": "基类表达式无法引用类类型参数。", "Base_constructor_return_type_0_is_not_an_object_type_or_intersection_of_object_types_with_statically_2509": "基构造函数返回类型 \"{0}\" 不是具有静态已知成员的对象类型或对象类型的交集。", "Base_constructors_must_all_have_the_same_return_type_2510": "所有的基构造函数必须具有相同的返回类型。", "Base_directory_to_resolve_non_absolute_module_names_6083": "用于解析非绝对模块名的基目录。", - "BigInt_literals_are_not_available_when_targeting_lower_than_ES2020_2737": "目标低于 ES2020 时,bigInt 文本不可用。", + "BigInt_literals_are_not_available_when_targeting_lower_than_ES2020_2737": "目标低于 ES2020 时,BigInt 字面量不可用。", "Binary_digit_expected_1177": "需要二进制数字。", "Binding_element_0_implicitly_has_an_1_type_7031": "绑定元素“{0}”隐式具有“{1}”类型。", "Block_scoped_variable_0_used_before_its_declaration_2448": "声明之前已使用的块范围变量“{0}”。", @@ -296,11 +297,11 @@ "Cannot_assign_to_0_because_it_is_a_constant_2588": "无法分配到 \"{0}\" ,因为它是常数。", "Cannot_assign_to_0_because_it_is_a_function_2630": "无法为“{0}”赋值,因为它是函数。", "Cannot_assign_to_0_because_it_is_a_namespace_2631": "无法为“{0}”赋值,因为它是命名空间。", - "Cannot_assign_to_0_because_it_is_a_read_only_property_2540": "无法分配到 \"{0}\" ,因为它是只读属性。", + "Cannot_assign_to_0_because_it_is_a_read_only_property_2540": "无法为“{0}”赋值,因为它是只读属性。", "Cannot_assign_to_0_because_it_is_an_enum_2628": "无法为“{0}”赋值,因为它是枚举。", "Cannot_assign_to_0_because_it_is_an_import_2632": "无法为“{0}”赋值,因为它是导入。", - "Cannot_assign_to_0_because_it_is_not_a_variable_2539": "无法分配到“{0}”,因为它不是变量。", - "Cannot_assign_to_private_method_0_Private_methods_are_not_writable_2803": "无法分配给专用方法 \"{0}\"。专用方法不可写。", + "Cannot_assign_to_0_because_it_is_not_a_variable_2539": "无法为“{0}”赋值,因为它不是变量。", + "Cannot_assign_to_private_method_0_Private_methods_are_not_writable_2803": "无法赋值给私有方法“{0}”。私有方法不可写。", "Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity_2671": "无法扩大模块“{0}”,因为它解析为非模块实体。", "Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity_2649": "无法扩充具有值导出的模块“{0}”,因为它解析为一个非模块的实体。", "Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system_6131": "无法使用选项“{0}”来编译模块,除非 \"--module\" 标记为 \"amd\" 或 \"system\"。", @@ -308,7 +309,7 @@ "Cannot_delegate_iteration_to_value_because_the_next_method_of_its_iterator_expects_type_1_but_the_co_2766": "无法将迭代委托到值,因为其迭代器的 \"next\" 方法需要类型 \"{1}\",但包含它的生成器将始终发送 \"{0}\"。", "Cannot_export_0_Only_local_declarations_can_be_exported_from_a_module_2661": "无法导出“{0}”。仅可从模块中导出本地声明。", "Cannot_extend_a_class_0_Class_constructor_is_marked_as_private_2675": "无法扩展类“{0}”。类构造函数标记为私有。", - "Cannot_extend_an_interface_0_Did_you_mean_implements_2689": "无法扩展接口‘{0}’。您的意思是‘实施’吗?", + "Cannot_extend_an_interface_0_Did_you_mean_implements_2689": "无法扩展接口“{0}”。您是否想使用 \"implements\"?", "Cannot_find_a_tsconfig_json_file_at_the_current_directory_Colon_0_5081": "无法在当前目录找到 tsconfig.json 文件: {0}。", "Cannot_find_a_tsconfig_json_file_at_the_specified_directory_Colon_0_5057": "无法在指定目录找到 tsconfig.json 文件:“{0}”。", "Cannot_find_global_type_0_2318": "找不到全局类型“{0}”。", @@ -329,8 +330,8 @@ "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_save_dev_type_2593": "找不到名称“{0}”。是否需要安装测试运行器的类型定义? 请尝试使用 `npm i --save-dev @types/jest` 或 `npm i --save-dev @types/mocha`,然后将 “jest” 或 “mocha” 添加到 tsconfig 中的类型字段。。", "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2581": "找不到名称 \"{0}\"。是否需要安装 jQuery 的类型定义? 请尝试使用 `npm i --save-dev @types/jquery`。", "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_save_dev_types_Slash_2592": "找不到名称“{0}”。是否需要安装 jQuery 的类型定义? 请尝试使用 `npm i --save-dev @types/jquery`,然后将 “jquery” 添加到 teconfig 中的类型字段。", - "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2580": "找不到名称 \"{0}\"。是否需要为节点安装类型定义? 请尝试使用 `npm i --save-dev @types/node`。", - "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2591": "找不到名称“{0}”。是否需要为节点安装类型定义? 请尝试使用 `npm i --save-dev @types/node`,然后将 “node” 添加到类型字段。", + "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2580": "找不到名称“{0}”。是否需要安装 Node.js 的类型定义? 请尝试运行 `npm i --save-dev @types/node`。", + "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_save_dev_types_Slashno_2591": "找不到名称“{0}”。是否需要安装 Node.js 的类型定义? 请尝试运行 `npm i --save-dev @types/node`,然后将 \"node\" 添加到 tsconfig 的 types 字段。", "Cannot_find_namespace_0_2503": "找不到命名空间“{0}”。", "Cannot_find_namespace_0_Did_you_mean_1_2833": "找不到命名空间“{0}”。你是否指的是“{1}”?", "Cannot_find_parameter_0_1225": "找不到参数“{0}”。", @@ -365,8 +366,8 @@ "Catch_clause_variable_type_annotation_must_be_any_or_unknown_if_specified_1196": "Catch 子句变量类型注释必须为 \"any\" 或 \"unknown\" (若已指定)。", "Change_0_to_1_90014": "将“{0}”更改为“{1}”", "Change_all_extended_interfaces_to_implements_95038": "将所有扩展接口都更改为 \"implements\"", - "Change_all_jsdoc_style_types_to_TypeScript_95030": "将所有 jsdoc 样式类型都更改为 TypeScript", - "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031": "将所有 jsdoc 样式类型都更改为 TypeScript (并将 \"| undefined\" 添加到可以为 null 的类型)", + "Change_all_jsdoc_style_types_to_TypeScript_95030": "将所有 JSDoc 样式类型都更改为 TypeScript", + "Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types_95031": "将所有 JSDoc 样式类型都更改为 TypeScript (并将 \"| undefined\" 添加到可以为 null 的类型)", "Change_extends_to_implements_90003": "将 \"extends\" 改为 \"implements\"", "Change_spelling_to_0_90022": "将拼写更改为“{0}”", "Check_for_class_properties_that_are_declared_but_not_set_in_the_constructor_6700": "检查是否有已声明但未在构造函数中设置的类属性。", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "类“{0}”错误实现类“{1}”。你是想扩展“{1}”并将其成员作为子类继承吗?", "Class_0_incorrectly_implements_interface_1_2420": "类“{0}”错误实现接口“{1}”。", "Class_0_used_before_its_declaration_2449": "类“{0}”用于其声明前。", - "Class_constructor_may_not_be_a_generator_1360": "类构造函数可能不是生成器。", + "Class_constructor_may_not_be_a_generator_1368": "类构造函数可能不是生成器。", "Class_constructor_may_not_be_an_accessor_1341": "类构造函数可能不是访问器。", "Class_declaration_cannot_implement_overload_list_for_0_2813": "类声明无法实现“{0}”的重载列表。", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "类声明不能有多个 “@augments” 或 “@extends” 标记。", @@ -430,13 +431,14 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "类型 \"{0}\" 到类型 \"{1}\" 的转换可能是错误的,因为两种类型不能充分重叠。如果这是有意的,请先将表达式转换为 \"unknown\"。", "Convert_0_to_1_in_0_95003": "将“{0}”转换为 {0} 中的 {1}", "Convert_0_to_mapped_object_type_95055": "将“{0}”转换为映射对象类型", + "Convert_all_const_to_let_95102": "将所有 'const' 转换为 'let'", "Convert_all_constructor_functions_to_classes_95045": "将所有构造函数都转换为类", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "将不用作值的所有导入转换为仅类型导入", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "将所有无效字符转换为 HTML 实体代码", "Convert_all_re_exported_types_to_type_only_exports_1365": "将所有重新导出的类型转换为仅类型导出", "Convert_all_require_to_import_95048": "将所有 \"require\" 转换为 \"import\"", "Convert_all_to_async_functions_95066": "全部转换为异步函数", - "Convert_all_to_bigint_numeric_literals_95092": "全部转换为 bigint 数字文本", + "Convert_all_to_bigint_numeric_literals_95092": "全部转换为 BigInt 数字字面量", "Convert_all_to_default_imports_95035": "全部转换为默认导入", "Convert_all_type_literals_to_mapped_type_95021": "将所有类型文本转换为映射类型", "Convert_arrow_function_or_function_expression_95122": "转换箭头函数或函数表达式", @@ -454,7 +456,7 @@ "Convert_parameters_to_destructured_object_95075": "将参数转换为析构对象", "Convert_require_to_import_95047": "将 \"require\" 转换为 \"import\"", "Convert_to_ES_module_95017": "转换为 ES 模块", - "Convert_to_a_bigint_numeric_literal_95091": "转换为 bigint 数字文本", + "Convert_to_a_bigint_numeric_literal_95091": "转换为 BigInt 数字字面量", "Convert_to_anonymous_function_95123": "转换为异步函数", "Convert_to_arrow_function_95125": "转换为箭头函数", "Convert_to_async_function_95065": "转换为异步函数", @@ -658,6 +660,8 @@ "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219": "对修饰器的实验支持功能在将来的版本中可能更改。在 \"tsconfig\" 或 \"jsconfig\" 中设置 \"experimentalDecorators\" 选项以删除此警告。", "Explicitly_specified_module_resolution_kind_Colon_0_6087": "显示指定了模块解析类型:“{0}”。", "Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791": "除非 \"target\" 选项设置为 \"es2016\" 或更高版本,否则不能对 \"bigint\" 值执行求幂运算。", + "Export_0_from_module_1_90059": "从模块“{1}”导出“{0}”", + "Export_all_referenced_locals_90060": "导出所有引用的局部变量", "Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203": "面向 ECMAScript 模块时,不能使用导出分配。请考虑改用 \"export default\" 或另一种模块格式。", "Export_assignment_is_not_supported_when_module_flag_is_system_1218": "当 \"--module\" 标志是 \"system\" 时不支持导出分配。", "Export_declaration_conflicts_with_exported_declaration_of_0_2484": "导出声明与“{0}”的导出声明冲突。", @@ -729,7 +733,7 @@ "Fix_all_expressions_possibly_missing_await_95085": "修复可能缺少 \"await\" 的所有表达式", "Fix_all_implicit_this_errors_95107": "修复所有 implicit-'this' 错误", "Fix_all_incorrect_return_type_of_an_async_functions_90037": "修复所有错误的异步函数返回类型", - "For_await_loops_cannot_be_used_inside_a_class_static_block_18038": "无法在类静态块内使用 “For await 循环。", + "For_await_loops_cannot_be_used_inside_a_class_static_block_18038": "无法在类静态块内使用 for...await 循环。", "Found_0_errors_6217": "找到 {0} 个错误。", "Found_0_errors_Watching_for_file_changes_6194": "找到 {0} 个错误。注意文件更改。", "Found_0_errors_in_1_files_6261": "在 {1} 个文件中找到 {0} 个错误。", @@ -906,6 +910,7 @@ "Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650": "使 keyof 仅返回字符串,而不是字符串、数字或符号。旧版选项。", "Make_super_call_the_first_statement_in_the_constructor_90002": "在构造函数中,使 \"super()\" 调用第一个语句", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "映射的对象类型隐式地含有 \"any\" 模板类型。", + "Matched_0_condition_1_6403": "匹配的“{0}”条件“{1}”。", "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457": "默认情况下匹配包括模式 “**/*”", "Matched_by_include_pattern_0_in_1_1407": "通过在 \"{1}\" 中的包含模式 \"{0}\" 匹配", "Member_0_implicitly_has_an_1_type_7008": "成员“{0}”隐式包含类型“{1}”。", @@ -919,7 +924,7 @@ "Method_not_implemented_95158": "方法未实现。", "Modifiers_cannot_appear_here_1184": "修饰符不能出现在此处。", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "模块 \"{0}\" 只能在使用 \"{1}\" 标志时进行默认导入", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "无法使用此构造导入模块 '{0}'。说明符仅解析为无法同步导入的 ES 模块。请改用动态导入。", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "无法使用此构造导入模块“{0}”。说明符仅解析为 ES 模块,后者不能使用“require”进行导入。请改用 ECMAScript 导入。", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "模块 \"{0}\" 在本地声明 \"{1}\",但它被导出为 \"{2}\"。", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "模块 \"{0}\" 在本地声明 \"{1}\",但未导出它。", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "模块 \"{0}\" 不引用类型,但在此处用作类型。你是想使用 \"typeof import('{0}')\" 吗?", @@ -978,9 +983,9 @@ "Object_is_possibly_null_2531": "对象可能为 \"null\"。", "Object_is_possibly_null_or_undefined_2533": "对象可能为 \"null\" 或“未定义”。", "Object_is_possibly_undefined_2532": "对象可能为“未定义”。", - "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353": "对象文字可以只指定已知属性,并且“{0}”不在类型“{1}”中。", - "Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_writ_2561": "对象文字只能指定已知的属性,但“{0}”中不存在类型“{1}”。是否要写入 {2}?", - "Object_literal_s_property_0_implicitly_has_an_1_type_7018": "对象文字的属性“{0}”隐式含有“{1}”类型。", + "Object_literal_may_only_specify_known_properties_and_0_does_not_exist_in_type_1_2353": "对象字面量只能指定已知属性,并且“{0}”不在类型“{1}”中。", + "Object_literal_may_only_specify_known_properties_but_0_does_not_exist_in_type_1_Did_you_mean_to_writ_2561": "对象字面量只能指定已知的属性,但“{0}”中不存在类型“{1}”。是否要写入 {2}?", + "Object_literal_s_property_0_implicitly_has_an_1_type_7018": "对象字面量的属性“{0}”隐式含有“{1}”类型。", "Octal_digit_expected_1178": "需要八进制数字。", "Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0_8017": "八进制文本类型必须使用 ES2015 语法。请使用语法“{0}”。", "Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0_8018": "枚举成员初始值设定项中不允许有八进制文本。请使用语法“{0}”。", @@ -1103,6 +1108,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "项目“{0}”已过期,因为输出文件“{1}”不存在", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "项目 \"{0}\" 已过期,因为其输出是使用与当前版本 \"{2}\" 不同的版本 \"{1}\" 生成的", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "项目 \"{0}\" 已过期,因为其依赖项 \"{1}\" 的输出已更改", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "项目“{0}”已过期,因为读取文件“{1}”时出错", "Project_0_is_up_to_date_6361": "“{0}”项目已是最新", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "项目“{0}”是最新的,因为最新的输入“{1}”早于输出“{2}”", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "项目“{0}”是最新的,但需要更新早于输入文件的输出文件的时间戳", @@ -1110,6 +1116,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "项目引用不能形成环形图。检测到循环: {0}", "Projects_6255": "项目", "Projects_in_this_build_Colon_0_6355": "此生成中的项目: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "只有在面向 ECMAScript 2015 及更高版本时,才可使用带有 \"accessor\" 修饰符的属性。", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "属性“{0}”不能具有初始化表杰式,因为它标记为摘要。", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "属性“{0}”来自索引签名,因此必须使用[“{0}”]访问它。", "Property_0_does_not_exist_on_type_1_2339": "类型“{1}”上不存在属性“{0}”。", @@ -1151,7 +1158,7 @@ "Property_assignment_expected_1136": "应为属性分配。", "Property_destructuring_pattern_expected_1180": "应为属性析构模式。", "Property_or_signature_expected_1131": "应为属性或签名。", - "Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_li_1328": "属性值只能是字符串文本、数字文本、\"true\"、\"false\"、\"null\"、对象文字或数组文本。", + "Property_value_can_only_be_string_literal_numeric_literal_true_false_null_object_literal_or_array_li_1328": "属性值只能是字符串、数字、\"true\"、\"false\"、\"null\"、对象或数组等类型的字面量。", "Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3_6179": "以 \"ES5\" 或 \"ES3\" 设为目标时,对 \"for-of\"、传播和析构中的可迭代项提供完全支持。", "Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named_4098": "导出类的公共方法“{0}”具有或正在使用外部模块“{2}”中的名称“{1}”,但不能为其命名。", "Public_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2_4099": "导出类的公共方法“{0}”具有或正在使用私有模块“{2}”中的名称“{1}”。", @@ -1216,6 +1223,7 @@ "Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "在位置“{1}”的缓存中找到模块“{0}”的解析。", "Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241": "在位置“{1}”的缓存中找到类型引用指令“{0}”的解析。", "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195": "只将 \"keyof\" 解析为字符串值的属性名称(不含数字或符号)。", + "Resolving_in_0_mode_with_conditions_1_6402": "正在 {0} 模式下解析,条件为 {1}。", "Resolving_module_0_from_1_6086": "======== 正在从“{1}”解析模块“{0}”。========", "Resolving_module_name_0_relative_to_base_url_1_2_6094": "正在相对于基 URL“{1}”-“{2}”解析模块名“{0}”。", "Resolving_real_path_for_0_result_1_6130": "正在解析“{0}”的真实路径,结果为“{1}”。", @@ -1272,6 +1280,7 @@ "Root_file_specified_for_compilation_1427": "为编译指定的根文件", "STRATEGY_6039": "策略", "Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642": "保存 .tsbuildinfo 文件以允许项目增量编译。", + "Saw_non_matching_condition_0_6405": "看到了不匹配的条件“{0}”。", "Scoped_package_detected_looking_in_0_6182": "检测到范围包,请在“{0}”中查看", "Selection_is_not_a_valid_statement_or_statements_95155": "所选内容不是有效的语句", "Selection_is_not_a_valid_type_node_95133": "所选内容不是有效的类型节点", @@ -1350,8 +1359,8 @@ "Statements_are_not_allowed_in_ambient_contexts_1036": "不允许在环境上下文中使用语句。", "Static_members_cannot_reference_class_type_parameters_2302": "静态成员不能引用类类型参数。", "Static_property_0_conflicts_with_built_in_property_Function_0_of_constructor_function_1_2699": "静态属性“{0}”与构造函数“{1}”的内置属性函数“{0}”冲突。", - "String_literal_expected_1141": "应为字符串文本。", - "String_literal_with_double_quotes_expected_1327": "应为带双引号的字符串文字。", + "String_literal_expected_1141": "应为字符串字面量。", + "String_literal_with_double_quotes_expected_1327": "应为带双引号的字符串字面量。", "Stylize_errors_and_messages_using_color_and_context_experimental_6073": "使用颜色和上下文风格化错误和消息(实验)。", "Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_t_2717": "后续属性声明必须属于同一类型。属性“{0}”的类型必须为“{1}”,但此处却为类型“{2}”。", "Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_t_2403": "后续变量声明必须属于同一类型。变量“{0}”必须属于类型“{1}”,但此处却为类型“{2}”。", @@ -1361,7 +1370,7 @@ "Substitutions_for_pattern_0_shouldn_t_be_an_empty_array_5066": "模式“{0}”的替换模式不应为空数组。", "Successfully_created_a_tsconfig_json_file_6071": "已成功创建 tsconfig.json 文件。", "Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors_2337": "不允许在构造函数外部或在构造函数内的嵌套函数中进行 Super 调用。", - "Suppress_excess_property_checks_for_object_literals_6072": "取消对象文字的多余属性检查。", + "Suppress_excess_property_checks_for_object_literals_6072": "取消对对象字面量的多余属性检查。", "Suppress_noImplicitAny_errors_for_indexing_objects_lacking_index_signatures_6055": "抑制缺少索引签名的索引对象的 noImplicitAny 错误。", "Suppress_noImplicitAny_errors_when_indexing_objects_that_lack_index_signatures_6703": "在对缺少索引签名的对象编制索引时,抑制 “noImplicitAny” 错误。", "Switch_each_misused_0_to_1_95138": "将每个误用的“{0}”切换到“{1}”", @@ -1385,6 +1394,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "包含箭头函数捕获 \"this\" 的全局值。", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "包含函数或模块体对于控制流分析而言太大。", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "当前文件是 CommonJS 模块,因此不能在顶级使用 “await”。", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "当前文件是 CommonJS 模块,其导入将生成“require”调用;但是,引用的文件是 ECMAScript 模块,它不能使用“require”进行导入。请考虑改为编写动态“import(\"{0}\")”调用。", "The_current_host_does_not_support_the_0_option_5001": "当前主机不支持“{0}”选项。", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "你可能打算使用的 \"{0}\" 的声明在此处定义", "The_declaration_was_marked_as_deprecated_here_2798": "该声明曾在此处标记为已弃用。", @@ -1422,7 +1432,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "算术运算左侧必须是 \"any\"、\"number\"、\"bigint\" 或枚举类型。", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "赋值表达式的左侧不能是可选属性访问。", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "赋值表达式的左侧必须是变量或属性访问。", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "\"in\" 表达式的左侧必须是专用标识符或其类型必须为 \"any\"、\"string\"、\"number\" 或 \"symbol\"。", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "\"instanceof\" 表达式左侧必须是 \"any\" 类型、对象类型或类型参数。", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "向用户显示消息时所用的区域设置(例如,\"en-us\")", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "用于搜索 node_modules 和加载 JavaScript 文件的最大依赖项深度。", @@ -1443,7 +1452,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "异步函数或方法的返回类型必须为全局 Promise 类型。你是否是指写入 \"Promise<{0}>\"?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "\"for...in\" 语句右侧必须是 \"any\" 类型、对象类型或类型参数,但此处的类型为“{0}”。", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "算术运算右侧必须是 \"any\"、\"number\"、\"bigint\" 或枚举类型。", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "\"in\" 表达式的右侧不得是基元。", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "\"instanceof\" 表达式的右侧必须属于类型 \"any\",或属于可分配给 \"Function\" 接口类型的类型。", "The_root_value_of_a_0_file_must_be_an_object_5092": "“{0}”文件的根值必须是一个对象。", "The_shadowing_declaration_of_0_is_defined_here_18017": "在此处定义了“{0}”的阴影声明", @@ -1464,13 +1472,15 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "迭代器的 \"{0}()\" 方法返回的类型必须具有 \"value\" 属性。", "The_types_of_0_are_incompatible_between_these_types_2200": "在这些类型中,\"{0}\" 的类型不兼容。", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "在这些类型中,\"{0}\" 返回的类型不兼容。", + "The_value_0_cannot_be_used_here_18050": "此处不能使用值“{0}”。", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "\"for...in\" 语句的变量声明不能有初始化表达式。", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "\"for...of\" 语句的变量声明不能有初始化表达式。", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "不支持 \"with\" 语句。\"with\" 程序块中的所有符号都将具有类型 \"any\"。", "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "此 JSX 标记的 \"{0}\" 属性需要 \"{1}\" 类型的子级,但提供了多个子级。", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "此 JSX 标记的 \"{0}\" 属性需要类型 \"{1}\",该类型需要多个子级,但仅提供了一个子级。", + "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "此比较似乎是无意的,因为类型“{0}”和“{1}”没有重叠。", + "This_condition_will_always_return_0_2845": "此条件将始终返回“{0}”。", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "此条件将始终返回“{0}”,因为 JavaScript 按引用而不是值比较对象。", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "此条件将始终返回 \"{0}\",因为类型 \"{1}\" 和 \"{2}\" 没有重叠。", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "此条件将始终返回 true,因为此“{0}”已始终定义。", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "此条件将始终返回 true,因为始终定义了函数。你是想改为调用它吗?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "此构造函数可能会转换为类声明。", @@ -1491,7 +1501,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "此成员必须有 \"override\" 修饰符,因为它替代基类 \"{0}\" 中的一个成员。", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "此成员必须有 \"override\" 修饰符,因为它替代基类 \"{0}\" 中声明的一个抽象方法。", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "只能通过启用 \"{0}\" 标志并引用其默认导出,使用 ECMAScript 导入/导出来引用此模块。", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "此模块是使用 \"export =\" 声明的,只能在使用 \"{0}\" 标志时进行默认导入。", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "此模块是使用 “export =” 声明的,只能在使用“{0}”标志时用于默认导入。", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "此重载签名与其实现签名不兼容。", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "此参数不允许与 \"use strict\" 指令一起使用。", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "此参数属性必须具有带 “@override” 标记的 JSDoc 注释,因为它将替代基类“{0}”中的成员。", @@ -1504,6 +1514,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "此语法需要一个名为 \"{1}\" 且包含 {2} 参数的导入帮助程序,该帮助程序与 \"{0}\" 中的相应帮助程序不兼容。请考虑升级 \"{0}\" 的版本。", "This_type_parameter_might_need_an_extends_0_constraint_2208": "此类型参数可能需要 `extends {0}` 约束。", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "“import” 的这种用法无效。可以写入 “import()” 调用,但它们必须具有括号,并且不能带有类型参数。", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "若要将此文件转换为 ECMAScript 模块,请将字段“\"type\": \"module\"”添加到“{0}”。", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "若要将此文件转换为 ECMAScript 模块,请将其文件扩展名更改为“{0}”,或将字段“\"type\": \"module\"”添加到“{1}”。", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "若要将此文件转换为 ECMAScript 模块,请将其文件扩展名更改为“{0}”,或者使用“{ \"type\": \"module\" }”创建本地 package.json 文件。", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "若要将此文件转换为 ECMAScript 模块,请使用“{ \"type\": \"module\" }”创建本地 package.json 文件。", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "仅当 “module” 选项设置为 “es2022”、“esnext”、“system”、“node16” 或 “nodenext”,且 “target” 选项设置为 “es2017” 或更高版本时,才允许使用顶级 “await” 表达式。", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": ".d.ts 文件中的顶级声明必须以 \"declare\" 或 \"export\" 修饰符开头。", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "仅当 “module” 选项设置为 “es2022”、“esnext”、“system”、“node16” 或 “nodenext”,且 “target” 选项设置为 “es2017” 或更高版本时,才允许使用顶级 “for await” 循环。", @@ -1519,6 +1533,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "类型“{0}”不能作为索引类型使用。", "Type_0_cannot_be_used_to_index_type_1_2536": "类型“{0}”无法用于索引类型“{1}”。", "Type_0_does_not_satisfy_the_constraint_1_2344": "类型“{0}”不满足约束“{1}”。", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "类型“{0}”不满足预期类型“{1}”。", "Type_0_has_no_call_signatures_2757": "类型 \"{0}\" 没有调用签名。", "Type_0_has_no_construct_signatures_2761": "类型 \"{0}\" 没有构造签名。", "Type_0_has_no_matching_index_signature_for_type_1_2537": "类型“{0}”没有匹配的类型“{1}”的索引签名。", @@ -1540,6 +1555,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "类型 “{0}” 不能分配给“exactOptionalPropertyTypes: true”的类型 “{1}”。请考虑将 “undefined” 添加到目标类型。。", "Type_0_is_not_comparable_to_type_1_2678": "类型“{0}”不可与类型“{1}”进行比较。", "Type_0_is_not_generic_2315": "类型“{0}”不是泛型类型。", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "类型 \"{0}\" 可以表示基元值,该值不允许作为“in”运算符的右操作数。", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "类型“{0}”必须具有返回异步迭代器的 \"[Symbol.asyncIterator]()\" 方法。", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "类型“{0}”必须具有返回迭代器的 \"[Symbol.iterator]()\" 方法。", "Type_0_provides_no_match_for_the_signature_1_2658": "类型“{0}”提供的内容与签名“{1}”不匹配。", @@ -1596,6 +1612,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== 未解析类型引用指令“{0}”。========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== 类型引用指令“{0}”已成功解析为“{1}”,主要: {2}。========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== 类型引用指令 \"{0}\" 已成功解析为 \"{1}\" ,包 ID 为 \"{2}\",主要: {3}。========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "类型满意度表达式只能在 TypeScript 文件中使用。", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "类型不能出现在 JavaScript 文件的导出声明中。", "Types_have_separate_declarations_of_a_private_property_0_2442": "类型具有私有属性“{0}”的单独声明。", "Types_of_construct_signatures_are_incompatible_2419": "构造签名的类型不兼容。", @@ -1627,9 +1644,9 @@ "Unreachable_code_detected_7027": "检测到无法访问的代码。", "Unterminated_Unicode_escape_sequence_1199": "未终止的 Unicode 转义序列。", "Unterminated_quoted_string_in_response_file_0_6045": "响应文件“{0}”中引号不配对。", - "Unterminated_regular_expression_literal_1161": "未终止的正则表达式文本。", - "Unterminated_string_literal_1002": "未终止的字符串文本。", - "Unterminated_template_literal_1160": "未终止的模板文本。", + "Unterminated_regular_expression_literal_1161": "未终止的正则表达式字面量。", + "Unterminated_string_literal_1002": "未终止的字符串字面量。", + "Unterminated_template_literal_1160": "未终止的模板字面量。", "Untyped_function_calls_may_not_accept_type_arguments_2347": "非类型化函数调用不能接受类型参数。", "Unused_label_7028": "未使用的标签。", "Unused_ts_expect_error_directive_2578": "未使用的 \"@ts-expect-error\" 指令。", @@ -1637,9 +1654,12 @@ "Updating_output_of_project_0_6373": "正在更新项目 \"{0}\" 的输出…", "Updating_output_timestamps_of_project_0_6359": "正在更新项目“{0}”的输出时间戳...", "Updating_unchanged_output_timestamps_of_project_0_6371": "正在更新项目 \"{0}\" 未更改的输出时间戳…", + "Use_0_95174": "使用 `{0}`", + "Use_Number_isNaN_in_all_conditions_95175": "在所有条件下使用 `Number.isNaN`。", "Use_element_access_for_0_95145": "对“{0}”使用元素访问", "Use_element_access_for_all_undeclared_properties_95146": "对所有未声明的属性使用元素访问。", "Use_synthetic_default_member_95016": "使用综合的“默认”成员。", + "Using_0_subpath_1_with_target_2_6404": "将“{0}”子路径“{1}”与目标“{2}”一起使用", "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "仅 ECMAScript 5 和更高版本支持在 \"for...of\" 语句中使用字符串。", "Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915": "使用 --build,-b 将使 tsc 的行为更像生成业务流程协调程序,而非编译器。这可用于触发生成复合项目,你可以在 {0} 详细了解这些项目", "Using_compiler_options_of_project_reference_redirect_0_6215": "使用项目引用重定向“{0}”的编译器选项。", @@ -1667,11 +1687,11 @@ "When_type_checking_take_into_account_null_and_undefined_6699": "进行类型检查时,请考虑 “null” 和 “undefined”。", "Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191": "是否在监视模式下保留过时的控制台输出,而不是清除屏幕。", "Wrap_all_invalid_characters_in_an_expression_container_95109": "包装表达式容器中的所有无效字符", - "Wrap_all_object_literal_with_parentheses_95116": "用括号将所有对象文字括起来", + "Wrap_all_object_literal_with_parentheses_95116": "用括号括起所有对象字面量", "Wrap_all_unparented_JSX_in_JSX_fragment_95121": "将所有没有父级的 JSX 包装在 JSX 片段中", "Wrap_in_JSX_fragment_95120": "包装在 JSX 片段中", "Wrap_invalid_character_in_an_expression_container_95108": "包装表达式容器中的无效字符", - "Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal_95113": "用括号将以下应为对象文字的正文括起来", + "Wrap_the_following_body_with_parentheses_which_should_be_an_object_literal_95113": "用括号括起以下应为对象字面量的内容", "You_can_learn_about_all_of_the_compiler_options_at_0_6913": "你可以在 {0} 了解编译器选项的所有内容", "You_cannot_rename_a_module_via_a_global_import_8031": "不能通过全局导入对模块进行重命名。", "You_cannot_rename_elements_that_are_defined_in_a_node_modules_folder_8035": "不能重命名已在 “node_modules” 文件夹中定义的元素。", @@ -1717,6 +1737,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "“{0}”不是关键字“{1}”的有效元属性。是否是指“{2}”?", "_0_is_not_allowed_as_a_parameter_name_1390": "不允许将 '{0}' 作为参数名。", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "“{0}”不得用作变量声明名称。", + "_0_is_of_type_unknown_18046": "“{0}”的类型为“未知”。", + "_0_is_possibly_null_18047": "“{0}”可能为 “null”。", + "_0_is_possibly_null_or_undefined_18049": "{0}可能为 “null” 或“未定义”。", + "_0_is_possibly_undefined_18048": "“{0}”可能为“未定义”。", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "“{0}”在其自身的基表达式中得到直接或间接引用。", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "“{0}”在其自身的类型批注中得到直接或间接引用。", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "多次指定了 \"{0}\",因此将重写此用法。", @@ -1752,6 +1776,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "缺少返回类型批注的“{0}”隐式具有“{1}”返回类型。", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "缺少返回类型批注的 \"{0}\" 隐式具有 \"{1}\" 产出类型。", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "\"abstract\" 修饰符仅可出现在类、方法或属性声明中。", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "\"accessor\" 修饰符只能出现在属性声明中。", "and_here_6204": "并在这里。", "arguments_cannot_be_referenced_in_property_initializers_2815": "无法在属性初始化表达式中引用 \"arguments\"。", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "“auto”: 将带有导入、导出、import.meta、jsx (带有 jsx: react-jsx)或 esm 格式(带模块: node16+)的文件视为模块。", @@ -1767,7 +1792,7 @@ "const_declarations_must_be_initialized_1155": "必须初始化 \"const\" 声明。", "const_enum_member_initializer_was_evaluated_to_a_non_finite_value_2477": "\"const\" 枚举成员初始化表达式的求值结果为非有限值。", "const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN_2478": "\"const\" 枚举成员初始化表达式的求值结果为不允许使用的值 \"NaN\"。", - "const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values_2474": "常量枚举成员初始值设定项只能包含文字值和其他计算的枚举值。", + "const_enum_member_initializers_can_only_contain_literal_values_and_other_computed_enum_values_2474": "常量枚举成员初始值设定项只能包含字面量值和其他计算的枚举值。", "const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_im_2475": "\"const\" 枚举仅可在属性、索引访问表达式、导入声明的右侧、导出分配或类型查询中使用。", "constructor_cannot_be_used_as_a_parameter_property_name_2398": "“构造函数”不能用作参数属性名称。", "constructor_is_a_reserved_word_18012": "\"#constructor\" 是保留字。", @@ -1815,8 +1840,8 @@ "package_json_scope_0_has_no_imports_defined_6273": "package.json 作用域 '{0}' 未定义导入。", "paths_option_is_specified_looking_for_a_pattern_to_match_module_name_0_6091": "指定了 \"paths“ 选项,正在查找模式以匹配模块名“{0}”。", "readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature_1024": "\"readonly\" 修饰符仅可出现在属性声明或索引签名中。", - "readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types_1354": "仅允许对数组和元组文本类型使用 \"readonly\" 类型修饰符。", - "require_call_may_be_converted_to_an_import_80005": "可将“要求”调用转换为导入。", + "readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types_1354": "仅允许对数组和元组字面量类型使用 \"readonly\" 类型修饰符。", + "require_call_may_be_converted_to_an_import_80005": "可将 \"require\" 调用转换为 import 语句。", "resolution_mode_assertions_are_only_supported_when_moduleResolution_is_node16_or_nodenext_1452": "仅当“moduleResolution”为“node16”或“nodenext”时才支持“resolution-mode”断言。", "resolution_mode_assertions_are_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_wi_4125": "“resolution-mode”断言不稳定。请使用夜间 TypeScript 消除此错误。请尝试使用“npm install -D typescript@next”进行更新。", "resolution_mode_can_only_be_set_for_type_only_imports_1454": "只能为仅类型导入设置 \"resolution-mode\"。", @@ -1824,10 +1849,10 @@ "resolution_mode_should_be_either_require_or_import_1453": "“resolution-mode”应为“require”或“import”。", "rootDirs_option_is_set_using_it_to_resolve_relative_module_name_0_6107": "设置了 \"rootDirs\" 选项,可将其用于解析相对模块名称“{0}”。", "super_can_only_be_referenced_in_a_derived_class_2335": "只能在派生类中引用 \"super\"。", - "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660": "仅可在派生类或对象文字表达式的成员中引用 \"super\"。", + "super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions_2660": "仅可在派生类或对象字面量表达式的成员中引用 \"super\"。", "super_cannot_be_referenced_in_a_computed_property_name_2466": "不能在计算属性名中引用 \"super\"。", "super_cannot_be_referenced_in_constructor_arguments_2336": "不能在构造函数参数中引用 \"super\"。", - "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659": "\"target\" 选项为 \"ES2015\" 或更高版本时,仅对象文字表达式的成员中允许 \"super\"。", + "super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_highe_2659": "\"target\" 选项为 \"ES2015\" 或更高版本时,仅对象字面量表达式的成员中允许 \"super\"。", "super_may_not_use_type_arguments_2754": "\"super\" 不能使用类型参数。", "super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class_17011": "访问派生类构造函数中的 \"super\" 属性前,必须调用 \"super\"。", "super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class_17009": "访问派生类的构造函数中的 \"this\" 前,必须调用 \"super\"。", diff --git a/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json b/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json index eed2d3e67..b53887e8c 100644 --- a/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +++ b/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json @@ -186,6 +186,7 @@ "An_abstract_accessor_cannot_have_an_implementation_1318": "抽象存取子無法實作。", "An_accessibility_modifier_cannot_be_used_with_a_private_identifier_18010": "協助工具修飾元不可搭配私人識別碼使用。", "An_accessor_cannot_have_type_parameters_1094": "存取子不得有類型參數。", + "An_accessor_property_cannot_be_declared_optional_1276": "無法將 'accessor' 屬性宣告為選擇性。", "An_ambient_module_declaration_is_only_allowed_at_the_top_level_in_a_file_1234": "環境模組宣告只可出現在檔案的最上層。", "An_argument_for_0_was_not_provided_6210": "未提供 '{0}' 的引數。", "An_argument_matching_this_binding_pattern_was_not_provided_6211": "未提供符合此繫結模式的引數。", @@ -382,7 +383,7 @@ "Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclas_2720": "類別 '{0}' 不當實作類別 '{1}'。您是否要擴充 '{1}',並繼承其成員以成為子類別?", "Class_0_incorrectly_implements_interface_1_2420": "類別 '{0}' 不正確地實作介面 '{1}'。", "Class_0_used_before_its_declaration_2449": "類別 '{0}' 的位置在其宣告之前。", - "Class_constructor_may_not_be_a_generator_1360": "類別建構函式可能不是產生器。", + "Class_constructor_may_not_be_a_generator_1368": "類別建構函式可能不是產生器。", "Class_constructor_may_not_be_an_accessor_1341": "類別建構函式可能不是存取子。", "Class_declaration_cannot_implement_overload_list_for_0_2813": "類別宣告無法為 '{0}' 實作多載清單。", "Class_declarations_cannot_have_more_than_one_augments_or_extends_tag_8025": "類別宣告不能有一個以上的 `@augments` 或 `@extends` 標籤。", @@ -430,6 +431,7 @@ "Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the__2352": "將類型 '{0}' 轉換為類型 '{1}' 可能會發生錯誤,原因是這兩個類型彼此並未充分重疊。如果是故意轉換的,請先將運算式轉換為 'unknown'。", "Convert_0_to_1_in_0_95003": "將 '{0}' 轉換成 '{1} in {0}'", "Convert_0_to_mapped_object_type_95055": "將 '{0}' 轉換為對應的物件類型", + "Convert_all_const_to_let_95102": "將所有 'const' 轉換為 'let'", "Convert_all_constructor_functions_to_classes_95045": "將所有建構函式轉換為類別", "Convert_all_imports_not_used_as_a_value_to_type_only_imports_1374": "將所有未作為值使用的匯入轉換為僅限類型的匯入", "Convert_all_invalid_characters_to_HTML_entity_code_95101": "將所有無效字元轉換為 HTML 實體代碼", @@ -658,6 +660,8 @@ "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219": "裝飾項目的實驗性支援是未來版本中可能會變更的功能。在 'tsconfig' 或 'jsconfig' 中設定 'experimentalDecorators' 選項可移除此警告。", "Explicitly_specified_module_resolution_kind_Colon_0_6087": "明確指定的模組解析種類: '{0}'。", "Exponentiation_cannot_be_performed_on_bigint_values_unless_the_target_option_is_set_to_es2016_or_lat_2791": "'target' 選項必須設定為 'es2016' 或更新版本,才可以對 'bigint' 值執行乘冪運算。", + "Export_0_from_module_1_90059": "從模組 '{1}' 匯出 '{0}'", + "Export_all_referenced_locals_90060": "匯出所有參考的本機", "Export_assignment_cannot_be_used_when_targeting_ECMAScript_modules_Consider_using_export_default_or__1203": "當目標為 ECMAScript 模組時,無法使用匯出指派。請考慮改用 'export default' 或其他模組格式。", "Export_assignment_is_not_supported_when_module_flag_is_system_1218": "當 '--module' 旗標為 'system' 時,不支援匯出指派。", "Export_declaration_conflicts_with_exported_declaration_of_0_2484": "匯出宣告與匯出的 '{0}' 宣告相衝突。", @@ -906,6 +910,7 @@ "Make_keyof_only_return_strings_instead_of_string_numbers_or_symbols_Legacy_option_6650": "僅讓 keyof 傳回字串,而不是單一字串、數字或符號。舊版選項。", "Make_super_call_the_first_statement_in_the_constructor_90002": "使 'super()' 呼叫成為建構函式中的第一個陳述式", "Mapped_object_type_implicitly_has_an_any_template_type_7039": "對應的物件類型隱含具有 'any' 範本類型。", + "Matched_0_condition_1_6403": "符合 '{0}' 條件 '{1}'。", "Matched_by_default_include_pattern_Asterisk_Asterisk_Slash_Asterisk_1457": "依預設比對包含模式 '**/*'", "Matched_by_include_pattern_0_in_1_1407": "依 '{1}' 中的包含模式 '{0}' 比對", "Member_0_implicitly_has_an_1_type_7008": "成員 '{0}' 隱含了 '{1}' 類型。", @@ -919,7 +924,7 @@ "Method_not_implemented_95158": "未實作方法。", "Modifiers_cannot_appear_here_1184": "此處不得出現修飾元。", "Module_0_can_only_be_default_imported_using_the_1_flag_1259": "模組 '{0}' 只能依預設使用 '{1}' 旗標匯入", - "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "無法使用此構造匯入模組 '{0}'。指定名稱只能解析成無法同步匯入的 ES 模組。請改為使用動態匯入。", + "Module_0_cannot_be_imported_using_this_construct_The_specifier_only_resolves_to_an_ES_module_which_c_1471": "無法使用此建構匯入模組 '{0}'。指定名稱只能解析成無法以 'require' 匯入的 ES 模組。請改為使用 ECMAScript 匯入。", "Module_0_declares_1_locally_but_it_is_exported_as_2_2460": "模組 '{0}' 區域性地宣告 '{1}',但卻將該模組匯出為 '{2}'。", "Module_0_declares_1_locally_but_it_is_not_exported_2459": "模組 '{0}' 區域性地宣告 '{1}',但並未匯出該模組。", "Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0_1340": "模組 '{0}' 不是類型,但在此處卻作為類型使用。您是指 'typeof import('{0}')' 嗎?", @@ -1103,6 +1108,7 @@ "Project_0_is_out_of_date_because_output_file_1_does_not_exist_6352": "因為輸出檔案 '{1}' 不存在,所以專案 '{0}' 已過期", "Project_0_is_out_of_date_because_output_for_it_was_generated_with_version_1_that_differs_with_curren_6381": "因為專案 '{0}' 的輸出使用版本 '{1}' 產生而成,與目前的版本 '{2}' 不同,所以該專案已過期", "Project_0_is_out_of_date_because_output_of_its_dependency_1_has_changed_6372": "因為專案 '{0}' 的相依性 '{1}' 輸出已變更,所以該專案已過期", + "Project_0_is_out_of_date_because_there_was_error_reading_file_1_6401": "專案 '{0}' 已過期,因為讀取檔案 '{1}' 時發生錯誤", "Project_0_is_up_to_date_6361": "專案 '{0}' 為最新狀態", "Project_0_is_up_to_date_because_newest_input_1_is_older_than_output_2_6351": "因為最新的輸入 '{1}' 早於最舊的輸出 '{2}',所以專案 '{0}' 為最新狀態", "Project_0_is_up_to_date_but_needs_to_update_timestamps_of_output_files_that_are_older_than_input_fil_6400": "專案 '{0}' 為最新狀態,但需要更新比輸入檔案還舊的輸出檔案時間戳記", @@ -1110,6 +1116,7 @@ "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202": "專案參考不會形成循環圖。但偵測到循環: {0}", "Projects_6255": "專案", "Projects_in_this_build_Colon_0_6355": "此組建中的專案: {0}", + "Properties_with_the_accessor_modifier_are_only_available_when_targeting_ECMAScript_2015_and_higher_18045": "只有以 ECMAScript 2015 及更新版本為目標時,才可使用具有 'accessor' 修飾詞的屬性。", "Property_0_cannot_have_an_initializer_because_it_is_marked_abstract_1267": "屬性 '{0}' 已標記為抽象,因此不得有初始設定式。", "Property_0_comes_from_an_index_signature_so_it_must_be_accessed_with_0_4111": "屬性 '{0}' 來自索引簽章,因此必須使用 ['{0}'] 存取。", "Property_0_does_not_exist_on_type_1_2339": "類型 '{1}' 沒有屬性 '{0}'。", @@ -1216,6 +1223,7 @@ "Resolution_for_module_0_was_found_in_cache_from_location_1_6147": "從位置 '{1}' 的快取中找到模組 '{0}' 的解析。", "Resolution_for_type_reference_directive_0_was_found_in_cache_from_location_1_6241": "從位置 '{0}' 的快取記憶體找到類型參照指示詞 '{1}'。", "Resolve_keyof_to_string_valued_property_names_only_no_numbers_or_symbols_6195": "只將 'keyof' 解析為字串值的屬性名稱 (無任何數字或符號)。", + "Resolving_in_0_mode_with_conditions_1_6402": "正在以條件 {1} 在 {0} 模式中解析。", "Resolving_module_0_from_1_6086": "======== 正在從 '{1}' 解析模組 '{0}'。========", "Resolving_module_name_0_relative_to_base_url_1_2_6094": "正在解析與基底 URL '{1}' 相對的模組名稱 '{0}' - '{2}'。", "Resolving_real_path_for_0_result_1_6130": "正在解析 '{0}' 的真實路徑,結果 '{1}'。", @@ -1272,6 +1280,7 @@ "Root_file_specified_for_compilation_1427": "為編譯指定的根檔案", "STRATEGY_6039": "策略", "Save_tsbuildinfo_files_to_allow_for_incremental_compilation_of_projects_6642": "儲存 .tsbuildinfo 檔案,以允許對專案進行累加編譯。", + "Saw_non_matching_condition_0_6405": "儲存不相符條件 '{0}'。", "Scoped_package_detected_looking_in_0_6182": "偵測到範圍套件,正於 '{0}' 尋找", "Selection_is_not_a_valid_statement_or_statements_95155": "選取項目非有效的一或多個陳述式", "Selection_is_not_a_valid_type_node_95133": "選取範圍不是有效的類型節點", @@ -1385,6 +1394,7 @@ "The_containing_arrow_function_captures_the_global_value_of_this_7041": "包含的箭號函式會擷取 'this' 的全域值。", "The_containing_function_or_module_body_is_too_large_for_control_flow_analysis_2563": "內含的函式或模組主體對控制流程分析而言過大。", "The_current_file_is_a_CommonJS_module_and_cannot_use_await_at_the_top_level_1309": "目前的檔案是 CommonJS 模組,無法在最上層使用 'await'。", + "The_current_file_is_a_CommonJS_module_whose_imports_will_produce_require_calls_however_the_reference_1479": "目前的檔案是 CommonJS 模組,其匯入將會產生 'require' 呼叫;不過,參考的檔案是 ECMAScript 模組,無法以 'require' 匯入。請考慮改為撰寫動態 'import(\"{0}\")' 呼叫。", "The_current_host_does_not_support_the_0_option_5001": "目前的主機不支援 '{0}' 選項。", "The_declaration_of_0_that_you_probably_intended_to_use_is_defined_here_18018": "您可能要使用的 '{0}' 宣告定義於此處", "The_declaration_was_marked_as_deprecated_here_2798": "該宣告在這裡標示為已淘汰。", @@ -1422,7 +1432,6 @@ "The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2362": "算術運算的左側內容必須屬於 'any'、'number'、'bigint' 或列舉類型。", "The_left_hand_side_of_an_assignment_expression_may_not_be_an_optional_property_access_2779": "指派運算式的左側不可為選擇性屬性存取。", "The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access_2364": "指派運算式的左邊必須是變數或屬性存取。", - "The_left_hand_side_of_an_in_expression_must_be_a_private_identifier_or_of_type_any_string_number_or__2360": "'in' 運算式的左側必須是私人識別碼或 'any'、'string'、'number' 或 'symbol' 類型。", "The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_paramete_2358": "'instanceof' 運算式左側必須是類型 'any'、物件類型或型別參數。", "The_locale_used_when_displaying_messages_to_the_user_e_g_en_us_6156": "對使用者顯示訊息時所使用的地區設定 (例如 'zh-tw')", "The_maximum_dependency_depth_to_search_under_node_modules_and_load_JavaScript_files_6136": "在 node_modules 及載入 JavaScript 檔案下搜尋時的最大相依性深度。", @@ -1443,7 +1452,6 @@ "The_return_type_of_an_async_function_or_method_must_be_the_global_Promise_T_type_Did_you_mean_to_wri_1064": "非同步函式或方法的傳回型別,必須為全域 Promise 類型。是否要寫入 'Promise<{0}>'?", "The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter_but_2407": "'for...in' 陳述式的右方必須是類型 'any'、物件類型或型別參數,但此處為類型 '{0}'。", "The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_bigint_or_an_enum_type_2363": "算術運算的右側內容必須屬於 'any'、'number'、'bigint' 或列舉類型。", - "The_right_hand_side_of_an_in_expression_must_not_be_a_primitive_2361": "'In' 運算式的右側不得為基元。", "The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_F_2359": "'instanceof' 運算式的右側必須是 'any' 類型,或是可指派給 'Function' 介面類型的類型。", "The_root_value_of_a_0_file_must_be_an_object_5092": "'{0}' 檔案的根值必須是物件。", "The_shadowing_declaration_of_0_is_defined_here_18017": "'{0}' 的隱蔽宣告定義於此處", @@ -1464,13 +1472,15 @@ "The_type_returned_by_the_0_method_of_an_iterator_must_have_a_value_property_2490": "迭代器 '{0}()' 方法所傳回的類型必須具有 'value' 屬性。", "The_types_of_0_are_incompatible_between_these_types_2200": "'{0}' 的類型在這些類型之間不相容。", "The_types_returned_by_0_are_incompatible_between_these_types_2201": "'{0}' 所傳回的類型在這些類型之間不相容。", + "The_value_0_cannot_be_used_here_18050": "此處無法使用值 '{0}'。", "The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer_1189": "'for...in' 陳述式的變數宣告不得有初始設定式。", "The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer_1190": "'for...of' 陳述式的變數宣告不得有初始設定式。", "The_with_statement_is_not_supported_All_symbols_in_a_with_block_will_have_type_any_2410": "不支援 'with' 陳述式。'with' 區塊中的所有符號都會有類型 'any'。", "This_JSX_tag_s_0_prop_expects_a_single_child_of_type_1_but_multiple_children_were_provided_2746": "此 JSX 標籤的 '{0}' 屬性只能有一個 '{1}' 類型的子系,但提供的子系卻有多個。", "This_JSX_tag_s_0_prop_expects_type_1_which_requires_multiple_children_but_only_a_single_child_was_pr_2745": "此 JSX 標籤的 '{0}' 屬性需要必須有多個子系的類型 '{1}',但僅提供的子系只有一個。", + "This_comparison_appears_to_be_unintentional_because_the_types_0_and_1_have_no_overlap_2367": "此比較似乎是無意的,因為類型 '{0}' 和 '{1}' 沒有重疊。", + "This_condition_will_always_return_0_2845": "此條件一律傳回 '{0}'。", "This_condition_will_always_return_0_since_JavaScript_compares_objects_by_reference_not_value_2839": "此條件一律會傳回 '{0}',因為 JavaScript 會依參照而非值比較物件。", - "This_condition_will_always_return_0_since_the_types_1_and_2_have_no_overlap_2367": "因為類型 '{1}' 與 '{2}' 未重疊,所以此條件永遠會傳回 '{0}'。", "This_condition_will_always_return_true_since_this_0_is_always_defined_2801": "因為此 '{0}' 一律會被定義,所以此條件一律傳回 True。", "This_condition_will_always_return_true_since_this_function_is_always_defined_Did_you_mean_to_call_it_2774": "因為永遠會定義此函式,所以此條件永遠會傳回 true。您是要改為呼叫該條件嗎?", "This_constructor_function_may_be_converted_to_a_class_declaration_80002": "此建構函式可轉換為類別宣告。", @@ -1491,7 +1501,7 @@ "This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0_4114": "因為此成員會覆寫基底類別 '{0}' 中的成員,所以其必須具有 'override' 修飾元。", "This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared__4116": "因為此成員會覆寫基底類別 '{0}' 中宣告的抽象方法,所以其必須具有 'override' 修飾元。", "This_module_can_only_be_referenced_with_ECMAScript_imports_Slashexports_by_turning_on_the_0_flag_and_2497": "只能以 ECMAScript 匯入/匯出來參考此模組,方法為開啟 '{0}' 旗標並參考其預設匯出。", - "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594": "此模組使用 'export =' 宣告,只能在使用 '{0}' 旗標時搭配預設匯入使用。", + "This_module_is_declared_with_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag_2594": "此模組使用 'export =' 宣告,只能在使用 '{0}' 旗標時搭配預設匯入使用。", "This_overload_signature_is_not_compatible_with_its_implementation_signature_2394": "此多載簽章與其實作簽章不相容。", "This_parameter_is_not_allowed_with_use_strict_directive_1346": "不允許此參數搭配 'use strict' 指示詞使用。", "This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_4120": "此參數屬性必須包含具有 '@override' 標籤的 JSDoc 註解,因為其會覆寫基底類別 '{0}' 中的成員。", @@ -1504,6 +1514,10 @@ "This_syntax_requires_an_imported_helper_named_1_with_2_parameters_which_is_not_compatible_with_the_o_2807": "此語法需要名為 '{1}' 且具有 {2} 參數的匯入協助程式,其與 '{0}' 中的參數不相容。請考慮升級 '{0}' 的版本。", "This_type_parameter_might_need_an_extends_0_constraint_2208": "此類型參數可能需要 'extends {0}' 限制式。", "This_use_of_import_is_invalid_import_calls_can_be_written_but_they_must_have_parentheses_and_cannot__1326": "此 'import' 的使用方式無效。'import()' 呼叫可以寫入,但必須有括弧,而且不能有類型引數。", + "To_convert_this_file_to_an_ECMAScript_module_add_the_field_type_Colon_module_to_0_1482": "若要將此檔案轉換為 ECMAScript 模組,請將欄位 `{ \"type\": \"module\" }` 新增至 '{0}'。", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_add_the_field_type_Co_1481": "若要將此檔案轉換為 ECMAScript 模組,請將其副檔名變更為 '{0}',或將欄位 `\"type\": \"module\"` 新增至 '{1}'。", + "To_convert_this_file_to_an_ECMAScript_module_change_its_file_extension_to_0_or_create_a_local_packag_1480": "若要將此檔案轉換為 ECMAScript 模組,請將其副檔名變更為 '{0}',或使用 `{ \"type\": \"module\" }` 建立本機 package.json 檔案。", + "To_convert_this_file_to_an_ECMAScript_module_create_a_local_package_json_file_with_type_Colon_module_1483": "若要將此檔案轉換為 ECMAScript 模組,請建立具有 `{ \"type\": \"module\" }` 的本機 package.json 檔案。", "Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_n_1378": "只有在 'module' 選項設定為 'es2022'、'esnext'、'system'、'node16' 或 'nodenext',而且 'target' 選項設定為 'es2017' 或更高版本時,才允許最上層的 'await' 運算式。", "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046": ".d.ts 檔案中的最上層宣告必須以 'declare' 或 'export' 修飾元開頭。", "Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_nod_1432": "只有在 'module' 選項設為 'es2022'、'esnext'、'system'、'node16' 或 'nodenext',而且 'target' 選項設為 'es2017' 或更高版本時,才允許最上層的 'for await' 迴圈。", @@ -1519,6 +1533,7 @@ "Type_0_cannot_be_used_as_an_index_type_2538": "類型 '{0}' 無法作為索引類型。", "Type_0_cannot_be_used_to_index_type_1_2536": "類型 '{0}' 無法用來為類型 '{1}' 編制索引。", "Type_0_does_not_satisfy_the_constraint_1_2344": "類型 '{0}' 不符合條件約束 '{1}'。", + "Type_0_does_not_satisfy_the_expected_type_1_1360": "類型 '{0}' 不符合預期類型 '{1}'。", "Type_0_has_no_call_signatures_2757": "類型 '{0}' 沒有任何呼叫簽章。", "Type_0_has_no_construct_signatures_2761": "類型 '{0}' 沒有任何建構簽章。", "Type_0_has_no_matching_index_signature_for_type_1_2537": "類型 '{0}' 沒有與類型 '{1}' 相符的索引簽章。", @@ -1540,6 +1555,7 @@ "Type_0_is_not_assignable_to_type_1_with_exactOptionalPropertyTypes_Colon_true_Consider_adding_undefi_2412": "類型 '{0}' 無法指派給類型為具有 'exactOptionalPropertyTypes: true' 的類型 '{1}'。請考慮將 'undefined' 新增到目標的類型。", "Type_0_is_not_comparable_to_type_1_2678": "類型 '{0}' 無法和類型 '{1}' 比較。", "Type_0_is_not_generic_2315": "'{0}' 不是泛型類型。", + "Type_0_may_represent_a_primitive_value_which_is_not_permitted_as_the_right_operand_of_the_in_operato_2638": "類型 '{0}' 可能代表基本值,但不允許做為 'in' 運算子的右運算元。", "Type_0_must_have_a_Symbol_asyncIterator_method_that_returns_an_async_iterator_2504": "類型 '{0}' 必須具備會傳回非同步迭代器的 '[Symbol.asyncIterator]()' 方法。", "Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator_2488": "類型 '{0}' 必須具備會傳回迭代器的 '[Symbol.iterator]()' 方法。", "Type_0_provides_no_match_for_the_signature_1_2658": "類型 '{0}' 沒有符合特徵標記 '{1}' 的項目。", @@ -1596,6 +1612,7 @@ "Type_reference_directive_0_was_not_resolved_6120": "======== 類型參考指示詞 '{0}' 未解析。========", "Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2_6119": "======== 類型參考指示詞 '{0}' 已成功解析為 '{1}',主要: {2}。========", "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219": "======== 類型參考指示詞 '{0}' 已成功解析為 '{1}',套件識別碼為 '{2}',主要: {3}。========", + "Type_satisfaction_expressions_can_only_be_used_in_TypeScript_files_8037": "類型滿足運算式只可用於 TypeScript 檔案。", "Types_cannot_appear_in_export_declarations_in_JavaScript_files_18043": "類型不能出現在 JavaScript 檔案的匯出宣告中。", "Types_have_separate_declarations_of_a_private_property_0_2442": "類型具有私用屬性 '{0}' 的個別宣告。", "Types_of_construct_signatures_are_incompatible_2419": "建構簽章的類型不相容。", @@ -1637,9 +1654,12 @@ "Updating_output_of_project_0_6373": "正在更新專案 '{0}' 的輸出...", "Updating_output_timestamps_of_project_0_6359": "正在更新專案 '{0}' 的輸出時間戳記...", "Updating_unchanged_output_timestamps_of_project_0_6371": "正在更新專案 '{0}' 的未更變輸出時間戳記...", + "Use_0_95174": "使用 `{0}`。", + "Use_Number_isNaN_in_all_conditions_95175": "在所有條件中都使用 'Number.isNaN'。", "Use_element_access_for_0_95145": "對 '{0}' 使用元素存取", "Use_element_access_for_all_undeclared_properties_95146": "對所有未宣告的屬性使用元素存取。", "Use_synthetic_default_member_95016": "使用綜合 'default' 成員。", + "Using_0_subpath_1_with_target_2_6404": "使用 '{0}' 子路徑 '{1}' 與目標 '{2}'。", "Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher_2494": "只有在 ECMAScript 5 及更高版本中,才可在 'for...of' 陳述式中使用字串。", "Using_build_b_will_make_tsc_behave_more_like_a_build_orchestrator_than_a_compiler_This_is_used_to_tr_6915": "使用 --build、-b 會讓 tsc 的行為較編譯器更像是建置協調器。這可用於觸發建置複合專案,您可以在以下位置深入了解: {0}", "Using_compiler_options_of_project_reference_redirect_0_6215": "正在使用專案參考重新導向 '{0}' 的編譯器選項。", @@ -1717,6 +1737,10 @@ "_0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2_17012": "'{0}' 對關鍵字 '{1}' 而言不是有效的中繼屬性。您是指 '{2}' 嗎?", "_0_is_not_allowed_as_a_parameter_name_1390": "不允許 '{0}' 做為參數名稱。", "_0_is_not_allowed_as_a_variable_declaration_name_1389": "'{0}' 不能是變數宣告名稱。", + "_0_is_of_type_unknown_18046": "'{0}' 的類型為 'unknown'。", + "_0_is_possibly_null_18047": "'{0}' 可能是 'null'。", + "_0_is_possibly_null_or_undefined_18049": "'{0}' 可能為「null」或「未定義」。", + "_0_is_possibly_undefined_18048": "'{0}' 可能為「未定義」。", "_0_is_referenced_directly_or_indirectly_in_its_own_base_expression_2506": "'{0}' 在其本身的基底運算式中直接或間接受到參考。", "_0_is_referenced_directly_or_indirectly_in_its_own_type_annotation_2502": "'{0}' 在其本身的類型註釋中直接或間接受到參考。", "_0_is_specified_more_than_once_so_this_usage_will_be_overwritten_2783": "多次指定 '{0}',因此將會覆寫此使用方式。", @@ -1752,6 +1776,7 @@ "_0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type_7010": "缺少傳回型別註解的 '{0}' 隱含了 '{1}' 傳回型別。", "_0_which_lacks_return_type_annotation_implicitly_has_an_1_yield_type_7055": "缺少傳回型別註解的 '{0}' 隱含 '{1}' 產生類型。", "abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration_1242": "'abstract' 修飾元只能出現在類別宣告、方法宣告或屬性宣告。", + "accessor_modifier_can_only_appear_on_a_property_declaration_1275": "'accessor' 修飾詞只能出現在屬性宣告。", "and_here_6204": "及此處。", "arguments_cannot_be_referenced_in_property_initializers_2815": "屬性初始設定式中不得參考 'arguments'。", "auto_Colon_Treat_files_with_imports_exports_import_meta_jsx_with_jsx_Colon_react_jsx_or_esm_format_w_1476": "\"auto\": 處理具有 imports、exports、import.meta, jsx (具有 jsx: react-jsx) 的檔案,或以 esm 格式 (具有 module: node16+) 作為模組。", diff --git a/node_modules/typescript/loc/lcl/CHS/Targets/ProjectItemsSchema.xaml.lcl b/node_modules/typescript/loc/lcl/CHS/Targets/ProjectItemsSchema.xaml.lcl deleted file mode 100644 index 66aa75541..000000000 --- a/node_modules/typescript/loc/lcl/CHS/Targets/ProjectItemsSchema.xaml.lcl +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/CHS/Targets/TypeScriptCompile.xaml.lcl b/node_modules/typescript/loc/lcl/CHS/Targets/TypeScriptCompile.xaml.lcl deleted file mode 100644 index b18f49335..000000000 --- a/node_modules/typescript/loc/lcl/CHS/Targets/TypeScriptCompile.xaml.lcl +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/CHS/Targets/TypeScriptProjectProperties.xaml.lcl b/node_modules/typescript/loc/lcl/CHS/Targets/TypeScriptProjectProperties.xaml.lcl deleted file mode 100644 index 3848d2863..000000000 --- a/node_modules/typescript/loc/lcl/CHS/Targets/TypeScriptProjectProperties.xaml.lcl +++ /dev/null @@ -1,492 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/CHS/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl b/node_modules/typescript/loc/lcl/CHS/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl deleted file mode 100644 index 55b5b5cfc..000000000 --- a/node_modules/typescript/loc/lcl/CHS/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/CHS/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl b/node_modules/typescript/loc/lcl/CHS/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl deleted file mode 100644 index 622e1165b..000000000 --- a/node_modules/typescript/loc/lcl/CHS/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl +++ /dev/null @@ -1,864 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element from your project file.]]> - - 元素。]]> - - - - - - - element from your project file.]]> - - 元素。]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/CHS/TypeScriptTasks/TypeScript.Tasks.dll.lcl b/node_modules/typescript/loc/lcl/CHS/TypeScriptTasks/TypeScript.Tasks.dll.lcl deleted file mode 100644 index a54ba19a2..000000000 --- a/node_modules/typescript/loc/lcl/CHS/TypeScriptTasks/TypeScript.Tasks.dll.lcl +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element in your project file.]]> - - 元素。]]> - - - - - - - - - - - - - - - - element in your project file.]]> - - 元素,或许可以修复此问题。]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/CHT/Targets/ProjectItemsSchema.xaml.lcl b/node_modules/typescript/loc/lcl/CHT/Targets/ProjectItemsSchema.xaml.lcl deleted file mode 100644 index 9f40d2385..000000000 --- a/node_modules/typescript/loc/lcl/CHT/Targets/ProjectItemsSchema.xaml.lcl +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/CHT/Targets/TypeScriptCompile.xaml.lcl b/node_modules/typescript/loc/lcl/CHT/Targets/TypeScriptCompile.xaml.lcl deleted file mode 100644 index 90f9ecccd..000000000 --- a/node_modules/typescript/loc/lcl/CHT/Targets/TypeScriptCompile.xaml.lcl +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/CHT/Targets/TypeScriptProjectProperties.xaml.lcl b/node_modules/typescript/loc/lcl/CHT/Targets/TypeScriptProjectProperties.xaml.lcl deleted file mode 100644 index f9ee81ea5..000000000 --- a/node_modules/typescript/loc/lcl/CHT/Targets/TypeScriptProjectProperties.xaml.lcl +++ /dev/null @@ -1,492 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/CHT/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl b/node_modules/typescript/loc/lcl/CHT/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl deleted file mode 100644 index c1f286add..000000000 --- a/node_modules/typescript/loc/lcl/CHT/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/CHT/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl b/node_modules/typescript/loc/lcl/CHT/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl deleted file mode 100644 index d1369cd3e..000000000 --- a/node_modules/typescript/loc/lcl/CHT/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl +++ /dev/null @@ -1,864 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element from your project file.]]> - - 項目。]]> - - - - - - - element from your project file.]]> - - 項目。]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/CHT/TypeScriptTasks/TypeScript.Tasks.dll.lcl b/node_modules/typescript/loc/lcl/CHT/TypeScriptTasks/TypeScript.Tasks.dll.lcl deleted file mode 100644 index 3f00716d9..000000000 --- a/node_modules/typescript/loc/lcl/CHT/TypeScriptTasks/TypeScript.Tasks.dll.lcl +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element in your project file.]]> - - 元素。]]> - - - - - - - - - - - - - - - - element in your project file.]]> - - 元素,或許可以修正此問題。]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/CSY/Targets/ProjectItemsSchema.xaml.lcl b/node_modules/typescript/loc/lcl/CSY/Targets/ProjectItemsSchema.xaml.lcl deleted file mode 100644 index 3e5d867f9..000000000 --- a/node_modules/typescript/loc/lcl/CSY/Targets/ProjectItemsSchema.xaml.lcl +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/CSY/Targets/TypeScriptCompile.xaml.lcl b/node_modules/typescript/loc/lcl/CSY/Targets/TypeScriptCompile.xaml.lcl deleted file mode 100644 index dd9f13ce1..000000000 --- a/node_modules/typescript/loc/lcl/CSY/Targets/TypeScriptCompile.xaml.lcl +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/CSY/Targets/TypeScriptProjectProperties.xaml.lcl b/node_modules/typescript/loc/lcl/CSY/Targets/TypeScriptProjectProperties.xaml.lcl deleted file mode 100644 index 6eeb21dde..000000000 --- a/node_modules/typescript/loc/lcl/CSY/Targets/TypeScriptProjectProperties.xaml.lcl +++ /dev/null @@ -1,492 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/CSY/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl b/node_modules/typescript/loc/lcl/CSY/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl deleted file mode 100644 index d57e042e0..000000000 --- a/node_modules/typescript/loc/lcl/CSY/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/CSY/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl b/node_modules/typescript/loc/lcl/CSY/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl deleted file mode 100644 index d9e11d295..000000000 --- a/node_modules/typescript/loc/lcl/CSY/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl +++ /dev/null @@ -1,864 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element from your project file.]]> - - .]]> - - - - - - - element from your project file.]]> - - .]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/CSY/TypeScriptTasks/TypeScript.Tasks.dll.lcl b/node_modules/typescript/loc/lcl/CSY/TypeScriptTasks/TypeScript.Tasks.dll.lcl deleted file mode 100644 index 6982658b2..000000000 --- a/node_modules/typescript/loc/lcl/CSY/TypeScriptTasks/TypeScript.Tasks.dll.lcl +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element in your project file.]]> - - .]]> - - - - - - - - - - - - - - - - element in your project file.]]> - - v souboru projektu.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/DEU/Targets/ProjectItemsSchema.xaml.lcl b/node_modules/typescript/loc/lcl/DEU/Targets/ProjectItemsSchema.xaml.lcl deleted file mode 100644 index f634c9a46..000000000 --- a/node_modules/typescript/loc/lcl/DEU/Targets/ProjectItemsSchema.xaml.lcl +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/DEU/Targets/TypeScriptCompile.xaml.lcl b/node_modules/typescript/loc/lcl/DEU/Targets/TypeScriptCompile.xaml.lcl deleted file mode 100644 index 77bcc5e04..000000000 --- a/node_modules/typescript/loc/lcl/DEU/Targets/TypeScriptCompile.xaml.lcl +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/DEU/Targets/TypeScriptProjectProperties.xaml.lcl b/node_modules/typescript/loc/lcl/DEU/Targets/TypeScriptProjectProperties.xaml.lcl deleted file mode 100644 index 0b8f33ef8..000000000 --- a/node_modules/typescript/loc/lcl/DEU/Targets/TypeScriptProjectProperties.xaml.lcl +++ /dev/null @@ -1,492 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/DEU/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl b/node_modules/typescript/loc/lcl/DEU/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl deleted file mode 100644 index 6f6184cbb..000000000 --- a/node_modules/typescript/loc/lcl/DEU/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/DEU/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl b/node_modules/typescript/loc/lcl/DEU/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl deleted file mode 100644 index dacc61ad6..000000000 --- a/node_modules/typescript/loc/lcl/DEU/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl +++ /dev/null @@ -1,864 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element from your project file.]]> - - -Element aus der Projektdatei.]]> - - - - - - - element from your project file.]]> - - -Element aus der Projektdatei.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/DEU/TypeScriptTasks/TypeScript.Tasks.dll.lcl b/node_modules/typescript/loc/lcl/DEU/TypeScriptTasks/TypeScript.Tasks.dll.lcl deleted file mode 100644 index e9a334566..000000000 --- a/node_modules/typescript/loc/lcl/DEU/TypeScriptTasks/TypeScript.Tasks.dll.lcl +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element in your project file.]]> - - -Element in Ihrer Projektdatei.]]> - - - - - - - - - - - - - - - - element in your project file.]]> - - -Element in der Projektdatei ändern.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/ESN/Targets/ProjectItemsSchema.xaml.lcl b/node_modules/typescript/loc/lcl/ESN/Targets/ProjectItemsSchema.xaml.lcl deleted file mode 100644 index 5e95d2e74..000000000 --- a/node_modules/typescript/loc/lcl/ESN/Targets/ProjectItemsSchema.xaml.lcl +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/ESN/Targets/TypeScriptCompile.xaml.lcl b/node_modules/typescript/loc/lcl/ESN/Targets/TypeScriptCompile.xaml.lcl deleted file mode 100644 index 79165cc5a..000000000 --- a/node_modules/typescript/loc/lcl/ESN/Targets/TypeScriptCompile.xaml.lcl +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/ESN/Targets/TypeScriptProjectProperties.xaml.lcl b/node_modules/typescript/loc/lcl/ESN/Targets/TypeScriptProjectProperties.xaml.lcl deleted file mode 100644 index 2d9136200..000000000 --- a/node_modules/typescript/loc/lcl/ESN/Targets/TypeScriptProjectProperties.xaml.lcl +++ /dev/null @@ -1,492 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/ESN/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl b/node_modules/typescript/loc/lcl/ESN/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl deleted file mode 100644 index 2e5b906f1..000000000 --- a/node_modules/typescript/loc/lcl/ESN/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/ESN/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl b/node_modules/typescript/loc/lcl/ESN/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl deleted file mode 100644 index fed590043..000000000 --- a/node_modules/typescript/loc/lcl/ESN/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl +++ /dev/null @@ -1,864 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element from your project file.]]> - - del archivo de proyecto.]]> - - - - - - - element from your project file.]]> - - del archivo de proyecto.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/ESN/TypeScriptTasks/TypeScript.Tasks.dll.lcl b/node_modules/typescript/loc/lcl/ESN/TypeScriptTasks/TypeScript.Tasks.dll.lcl deleted file mode 100644 index 66f3da120..000000000 --- a/node_modules/typescript/loc/lcl/ESN/TypeScriptTasks/TypeScript.Tasks.dll.lcl +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element in your project file.]]> - - en el archivo del proyecto.]]> - - - - - - - - - - - - - - - - element in your project file.]]> - - en el archivo del proyecto.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/FRA/Targets/ProjectItemsSchema.xaml.lcl b/node_modules/typescript/loc/lcl/FRA/Targets/ProjectItemsSchema.xaml.lcl deleted file mode 100644 index 4b19c03a1..000000000 --- a/node_modules/typescript/loc/lcl/FRA/Targets/ProjectItemsSchema.xaml.lcl +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/FRA/Targets/TypeScriptCompile.xaml.lcl b/node_modules/typescript/loc/lcl/FRA/Targets/TypeScriptCompile.xaml.lcl deleted file mode 100644 index 6b4dc82fa..000000000 --- a/node_modules/typescript/loc/lcl/FRA/Targets/TypeScriptCompile.xaml.lcl +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/FRA/Targets/TypeScriptProjectProperties.xaml.lcl b/node_modules/typescript/loc/lcl/FRA/Targets/TypeScriptProjectProperties.xaml.lcl deleted file mode 100644 index 6e129bfd3..000000000 --- a/node_modules/typescript/loc/lcl/FRA/Targets/TypeScriptProjectProperties.xaml.lcl +++ /dev/null @@ -1,492 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/FRA/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl b/node_modules/typescript/loc/lcl/FRA/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl deleted file mode 100644 index 3e7ab1b33..000000000 --- a/node_modules/typescript/loc/lcl/FRA/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/FRA/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl b/node_modules/typescript/loc/lcl/FRA/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl deleted file mode 100644 index 013ad45e8..000000000 --- a/node_modules/typescript/loc/lcl/FRA/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl +++ /dev/null @@ -1,864 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element from your project file.]]> - - de votre fichier projet.]]> - - - - - - - element from your project file.]]> - - de votre fichier projet.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/FRA/TypeScriptTasks/TypeScript.Tasks.dll.lcl b/node_modules/typescript/loc/lcl/FRA/TypeScriptTasks/TypeScript.Tasks.dll.lcl deleted file mode 100644 index 2d66ad3d9..000000000 --- a/node_modules/typescript/loc/lcl/FRA/TypeScriptTasks/TypeScript.Tasks.dll.lcl +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element in your project file.]]> - - dans votre fichier projet.]]> - - - - - - - - - - - - - - - - element in your project file.]]> - - dans votre fichier projet.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/ITA/Targets/ProjectItemsSchema.xaml.lcl b/node_modules/typescript/loc/lcl/ITA/Targets/ProjectItemsSchema.xaml.lcl deleted file mode 100644 index 6b51a563a..000000000 --- a/node_modules/typescript/loc/lcl/ITA/Targets/ProjectItemsSchema.xaml.lcl +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/ITA/Targets/TypeScriptCompile.xaml.lcl b/node_modules/typescript/loc/lcl/ITA/Targets/TypeScriptCompile.xaml.lcl deleted file mode 100644 index 2e77b63cb..000000000 --- a/node_modules/typescript/loc/lcl/ITA/Targets/TypeScriptCompile.xaml.lcl +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/ITA/Targets/TypeScriptProjectProperties.xaml.lcl b/node_modules/typescript/loc/lcl/ITA/Targets/TypeScriptProjectProperties.xaml.lcl deleted file mode 100644 index 1a1c8f08b..000000000 --- a/node_modules/typescript/loc/lcl/ITA/Targets/TypeScriptProjectProperties.xaml.lcl +++ /dev/null @@ -1,492 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/ITA/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl b/node_modules/typescript/loc/lcl/ITA/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl deleted file mode 100644 index d5f535bfc..000000000 --- a/node_modules/typescript/loc/lcl/ITA/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/ITA/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl b/node_modules/typescript/loc/lcl/ITA/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl deleted file mode 100644 index b29fef84c..000000000 --- a/node_modules/typescript/loc/lcl/ITA/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl +++ /dev/null @@ -1,864 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element from your project file.]]> - - dal file di progetto.]]> - - - - - - - element from your project file.]]> - - dal file di progetto.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/ITA/TypeScriptTasks/TypeScript.Tasks.dll.lcl b/node_modules/typescript/loc/lcl/ITA/TypeScriptTasks/TypeScript.Tasks.dll.lcl deleted file mode 100644 index e243f948f..000000000 --- a/node_modules/typescript/loc/lcl/ITA/TypeScriptTasks/TypeScript.Tasks.dll.lcl +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element in your project file.]]> - - nel file di progetto.]]> - - - - - - - - - - - - - - - - element in your project file.]]> - - nel file di progetto.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/JPN/Targets/ProjectItemsSchema.xaml.lcl b/node_modules/typescript/loc/lcl/JPN/Targets/ProjectItemsSchema.xaml.lcl deleted file mode 100644 index 9422cb387..000000000 --- a/node_modules/typescript/loc/lcl/JPN/Targets/ProjectItemsSchema.xaml.lcl +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/JPN/Targets/TypeScriptCompile.xaml.lcl b/node_modules/typescript/loc/lcl/JPN/Targets/TypeScriptCompile.xaml.lcl deleted file mode 100644 index 737d901d6..000000000 --- a/node_modules/typescript/loc/lcl/JPN/Targets/TypeScriptCompile.xaml.lcl +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/JPN/Targets/TypeScriptProjectProperties.xaml.lcl b/node_modules/typescript/loc/lcl/JPN/Targets/TypeScriptProjectProperties.xaml.lcl deleted file mode 100644 index 89579bcbd..000000000 --- a/node_modules/typescript/loc/lcl/JPN/Targets/TypeScriptProjectProperties.xaml.lcl +++ /dev/null @@ -1,492 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/JPN/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl b/node_modules/typescript/loc/lcl/JPN/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl deleted file mode 100644 index affbaa5cc..000000000 --- a/node_modules/typescript/loc/lcl/JPN/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/JPN/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl b/node_modules/typescript/loc/lcl/JPN/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl deleted file mode 100644 index 796ff9dea..000000000 --- a/node_modules/typescript/loc/lcl/JPN/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl +++ /dev/null @@ -1,864 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element from your project file.]]> - - 要素を削除します。]]> - - - - - - - element from your project file.]]> - - 要素を削除します。]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/JPN/TypeScriptTasks/TypeScript.Tasks.dll.lcl b/node_modules/typescript/loc/lcl/JPN/TypeScriptTasks/TypeScript.Tasks.dll.lcl deleted file mode 100644 index bed4087cb..000000000 --- a/node_modules/typescript/loc/lcl/JPN/TypeScriptTasks/TypeScript.Tasks.dll.lcl +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element in your project file.]]> - - 要素を変更します。]]> - - - - - - - - - - - - - - - - element in your project file.]]> - - 要素を変更して解決できることがあります。]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/KOR/Targets/ProjectItemsSchema.xaml.lcl b/node_modules/typescript/loc/lcl/KOR/Targets/ProjectItemsSchema.xaml.lcl deleted file mode 100644 index 7f6fe97ed..000000000 --- a/node_modules/typescript/loc/lcl/KOR/Targets/ProjectItemsSchema.xaml.lcl +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/KOR/Targets/TypeScriptCompile.xaml.lcl b/node_modules/typescript/loc/lcl/KOR/Targets/TypeScriptCompile.xaml.lcl deleted file mode 100644 index 7e1a0d775..000000000 --- a/node_modules/typescript/loc/lcl/KOR/Targets/TypeScriptCompile.xaml.lcl +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/KOR/Targets/TypeScriptProjectProperties.xaml.lcl b/node_modules/typescript/loc/lcl/KOR/Targets/TypeScriptProjectProperties.xaml.lcl deleted file mode 100644 index 40568512c..000000000 --- a/node_modules/typescript/loc/lcl/KOR/Targets/TypeScriptProjectProperties.xaml.lcl +++ /dev/null @@ -1,492 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/KOR/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl b/node_modules/typescript/loc/lcl/KOR/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl deleted file mode 100644 index 430729305..000000000 --- a/node_modules/typescript/loc/lcl/KOR/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/KOR/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl b/node_modules/typescript/loc/lcl/KOR/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl deleted file mode 100644 index 3fcfe834a..000000000 --- a/node_modules/typescript/loc/lcl/KOR/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl +++ /dev/null @@ -1,864 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element from your project file.]]> - - 요소를 제거하세요.]]> - - - - - - - element from your project file.]]> - - 요소를 제거하세요.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/KOR/TypeScriptTasks/TypeScript.Tasks.dll.lcl b/node_modules/typescript/loc/lcl/KOR/TypeScriptTasks/TypeScript.Tasks.dll.lcl deleted file mode 100644 index 55b0a23db..000000000 --- a/node_modules/typescript/loc/lcl/KOR/TypeScriptTasks/TypeScript.Tasks.dll.lcl +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element in your project file.]]> - - 요소를 변경하세요.]]> - - - - - - - - - - - - - - - - element in your project file.]]> - - 요소를 변경하여 이 문제를 해결할 수 있습니다.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/PLK/Targets/ProjectItemsSchema.xaml.lcl b/node_modules/typescript/loc/lcl/PLK/Targets/ProjectItemsSchema.xaml.lcl deleted file mode 100644 index 2308c4f85..000000000 --- a/node_modules/typescript/loc/lcl/PLK/Targets/ProjectItemsSchema.xaml.lcl +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/PLK/Targets/TypeScriptCompile.xaml.lcl b/node_modules/typescript/loc/lcl/PLK/Targets/TypeScriptCompile.xaml.lcl deleted file mode 100644 index fd37639bc..000000000 --- a/node_modules/typescript/loc/lcl/PLK/Targets/TypeScriptCompile.xaml.lcl +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/PLK/Targets/TypeScriptProjectProperties.xaml.lcl b/node_modules/typescript/loc/lcl/PLK/Targets/TypeScriptProjectProperties.xaml.lcl deleted file mode 100644 index ec3be6bac..000000000 --- a/node_modules/typescript/loc/lcl/PLK/Targets/TypeScriptProjectProperties.xaml.lcl +++ /dev/null @@ -1,492 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/PLK/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl b/node_modules/typescript/loc/lcl/PLK/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl deleted file mode 100644 index 70e557e0d..000000000 --- a/node_modules/typescript/loc/lcl/PLK/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/PLK/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl b/node_modules/typescript/loc/lcl/PLK/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl deleted file mode 100644 index f501e6ba0..000000000 --- a/node_modules/typescript/loc/lcl/PLK/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl +++ /dev/null @@ -1,864 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element from your project file.]]> - - z pliku projektu.]]> - - - - - - - element from your project file.]]> - - z pliku projektu.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/PLK/TypeScriptTasks/TypeScript.Tasks.dll.lcl b/node_modules/typescript/loc/lcl/PLK/TypeScriptTasks/TypeScript.Tasks.dll.lcl deleted file mode 100644 index 745ee2b6b..000000000 --- a/node_modules/typescript/loc/lcl/PLK/TypeScriptTasks/TypeScript.Tasks.dll.lcl +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element in your project file.]]> - - w pliku projektu.]]> - - - - - - - - - - - - - - - - element in your project file.]]> - - w pliku projektu.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/PTB/Targets/ProjectItemsSchema.xaml.lcl b/node_modules/typescript/loc/lcl/PTB/Targets/ProjectItemsSchema.xaml.lcl deleted file mode 100644 index 7c43d83fe..000000000 --- a/node_modules/typescript/loc/lcl/PTB/Targets/ProjectItemsSchema.xaml.lcl +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/PTB/Targets/TypeScriptCompile.xaml.lcl b/node_modules/typescript/loc/lcl/PTB/Targets/TypeScriptCompile.xaml.lcl deleted file mode 100644 index 1b9e5c6c3..000000000 --- a/node_modules/typescript/loc/lcl/PTB/Targets/TypeScriptCompile.xaml.lcl +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/PTB/Targets/TypeScriptProjectProperties.xaml.lcl b/node_modules/typescript/loc/lcl/PTB/Targets/TypeScriptProjectProperties.xaml.lcl deleted file mode 100644 index 87d52534f..000000000 --- a/node_modules/typescript/loc/lcl/PTB/Targets/TypeScriptProjectProperties.xaml.lcl +++ /dev/null @@ -1,492 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/PTB/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl b/node_modules/typescript/loc/lcl/PTB/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl deleted file mode 100644 index ed88f7a1b..000000000 --- a/node_modules/typescript/loc/lcl/PTB/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/PTB/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl b/node_modules/typescript/loc/lcl/PTB/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl deleted file mode 100644 index 8683af153..000000000 --- a/node_modules/typescript/loc/lcl/PTB/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl +++ /dev/null @@ -1,864 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element from your project file.]]> - - do arquivo do seu projeto.]]> - - - - - - - element from your project file.]]> - - do arquivo do seu projeto.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/PTB/TypeScriptTasks/TypeScript.Tasks.dll.lcl b/node_modules/typescript/loc/lcl/PTB/TypeScriptTasks/TypeScript.Tasks.dll.lcl deleted file mode 100644 index 619685aa7..000000000 --- a/node_modules/typescript/loc/lcl/PTB/TypeScriptTasks/TypeScript.Tasks.dll.lcl +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element in your project file.]]> - - em seu arquivo de projeto.]]> - - - - - - - - - - - - - - - - element in your project file.]]> - - no arquivo de projeto.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/RUS/Targets/ProjectItemsSchema.xaml.lcl b/node_modules/typescript/loc/lcl/RUS/Targets/ProjectItemsSchema.xaml.lcl deleted file mode 100644 index 0a8d433cf..000000000 --- a/node_modules/typescript/loc/lcl/RUS/Targets/ProjectItemsSchema.xaml.lcl +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/RUS/Targets/TypeScriptCompile.xaml.lcl b/node_modules/typescript/loc/lcl/RUS/Targets/TypeScriptCompile.xaml.lcl deleted file mode 100644 index fd4183b56..000000000 --- a/node_modules/typescript/loc/lcl/RUS/Targets/TypeScriptCompile.xaml.lcl +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/RUS/Targets/TypeScriptProjectProperties.xaml.lcl b/node_modules/typescript/loc/lcl/RUS/Targets/TypeScriptProjectProperties.xaml.lcl deleted file mode 100644 index 6224107db..000000000 --- a/node_modules/typescript/loc/lcl/RUS/Targets/TypeScriptProjectProperties.xaml.lcl +++ /dev/null @@ -1,492 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/RUS/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl b/node_modules/typescript/loc/lcl/RUS/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl deleted file mode 100644 index d26f0a6ff..000000000 --- a/node_modules/typescript/loc/lcl/RUS/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/RUS/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl b/node_modules/typescript/loc/lcl/RUS/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl deleted file mode 100644 index f856815ba..000000000 --- a/node_modules/typescript/loc/lcl/RUS/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl +++ /dev/null @@ -1,867 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element from your project file.]]> - - из файла проекта.]]> - - - - - - - element from your project file.]]> - - из файла проекта.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/RUS/TypeScriptTasks/TypeScript.Tasks.dll.lcl b/node_modules/typescript/loc/lcl/RUS/TypeScriptTasks/TypeScript.Tasks.dll.lcl deleted file mode 100644 index 35c45d8e2..000000000 --- a/node_modules/typescript/loc/lcl/RUS/TypeScriptTasks/TypeScript.Tasks.dll.lcl +++ /dev/null @@ -1,180 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element in your project file.]]> - - в файле проекта.]]> - - - - - - - - - - - - - - - - element in your project file.]]> - - в файле проекта.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/TRK/Targets/ProjectItemsSchema.xaml.lcl b/node_modules/typescript/loc/lcl/TRK/Targets/ProjectItemsSchema.xaml.lcl deleted file mode 100644 index 4f0f7c5ed..000000000 --- a/node_modules/typescript/loc/lcl/TRK/Targets/ProjectItemsSchema.xaml.lcl +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/TRK/Targets/TypeScriptCompile.xaml.lcl b/node_modules/typescript/loc/lcl/TRK/Targets/TypeScriptCompile.xaml.lcl deleted file mode 100644 index 3ca35c413..000000000 --- a/node_modules/typescript/loc/lcl/TRK/Targets/TypeScriptCompile.xaml.lcl +++ /dev/null @@ -1,195 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/TRK/Targets/TypeScriptProjectProperties.xaml.lcl b/node_modules/typescript/loc/lcl/TRK/Targets/TypeScriptProjectProperties.xaml.lcl deleted file mode 100644 index b0a176b57..000000000 --- a/node_modules/typescript/loc/lcl/TRK/Targets/TypeScriptProjectProperties.xaml.lcl +++ /dev/null @@ -1,492 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/TRK/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl b/node_modules/typescript/loc/lcl/TRK/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl deleted file mode 100644 index ff60eb141..000000000 --- a/node_modules/typescript/loc/lcl/TRK/TypeScriptDebugEngine/TypeScriptDebugEngine.dll.lcl +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/TRK/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl b/node_modules/typescript/loc/lcl/TRK/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl deleted file mode 100644 index 0ccb69139..000000000 --- a/node_modules/typescript/loc/lcl/TRK/TypeScriptLanguageService/Microsoft.CodeAnalysis.TypeScript.EditorFeatures.dll.lcl +++ /dev/null @@ -1,864 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element from your project file.]]> - - öğesini proje dosyanızdan kaldırın.]]> - - - - - - - element from your project file.]]> - - öğesini proje dosyanızdan kaldırın.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/loc/lcl/TRK/TypeScriptTasks/TypeScript.Tasks.dll.lcl b/node_modules/typescript/loc/lcl/TRK/TypeScriptTasks/TypeScript.Tasks.dll.lcl deleted file mode 100644 index 3ec715073..000000000 --- a/node_modules/typescript/loc/lcl/TRK/TypeScriptTasks/TypeScript.Tasks.dll.lcl +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - element in your project file.]]> - - öğesini değiştirin.]]> - - - - - - - - - - - - - - - - element in your project file.]]> - - öğesini değiştirerek düzeltebilirsiniz.]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/node_modules/typescript/package.json b/node_modules/typescript/package.json index 5abd9d225..18f05a1d5 100644 --- a/node_modules/typescript/package.json +++ b/node_modules/typescript/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "https://www.typescriptlang.org/", - "version": "4.8.4", + "version": "4.9.3", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ @@ -28,10 +28,20 @@ "engines": { "node": ">=4.2.0" }, + "files": [ + "bin", + "lib", + "!lib/enu", + "LICENSE.txt", + "README.md", + "SECURITY.md", + "ThirdPartyNoticeText.txt", + "!**/.gitattributes" + ], "devDependencies": { "@octokit/rest": "latest", "@types/chai": "latest", - "@types/convert-source-map": "latest", + "@types/fancy-log": "^2.0.0", "@types/fs-extra": "^9.0.13", "@types/glob": "latest", "@types/gulp": "^4.0.9", @@ -41,31 +51,28 @@ "@types/gulp-sourcemaps": "latest", "@types/merge2": "latest", "@types/microsoft__typescript-etw": "latest", - "@types/minimatch": "latest", "@types/minimist": "latest", "@types/mkdirp": "latest", "@types/mocha": "latest", "@types/ms": "latest", "@types/node": "latest", - "@types/node-fetch": "^2.6.2", - "@types/q": "latest", "@types/source-map-support": "latest", + "@types/which": "^2.0.1", "@types/xml2js": "^0.4.11", - "@typescript-eslint/eslint-plugin": "^5.28.0", - "@typescript-eslint/parser": "^5.28.0", - "@typescript-eslint/utils": "^5.28.0", - "async": "latest", - "azure-devops-node-api": "^11.1.1", + "@typescript-eslint/eslint-plugin": "^5.33.1", + "@typescript-eslint/parser": "^5.33.1", + "@typescript-eslint/utils": "^5.33.1", + "azure-devops-node-api": "^11.2.0", "chai": "latest", "chalk": "^4.1.2", - "convert-source-map": "latest", - "del": "6.1.1", + "del": "^6.1.1", "diff": "^5.1.0", - "eslint": "8.17.0", - "eslint-formatter-autolinkable-stylish": "1.2.0", - "eslint-plugin-import": "2.26.0", - "eslint-plugin-jsdoc": "39.3.2", - "eslint-plugin-no-null": "1.0.2", + "eslint": "^8.22.0", + "eslint-formatter-autolinkable-stylish": "^1.2.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-jsdoc": "^39.3.6", + "eslint-plugin-local": "^1.0.0", + "eslint-plugin-no-null": "^1.0.2", "fancy-log": "latest", "fs-extra": "^9.1.0", "glob": "latest", @@ -81,21 +88,17 @@ "mocha": "latest", "mocha-fivemat-progress-reporter": "latest", "ms": "^2.1.3", - "node-fetch": "^2.6.7", - "prex": "^0.4.7", - "q": "latest", + "node-fetch": "^3.2.10", "source-map-support": "latest", - "typescript": "^4.5.5", + "typescript": "^4.8.4", "vinyl": "latest", - "vinyl-sourcemaps-apply": "latest", + "which": "^2.0.2", "xml2js": "^0.4.23" }, "overrides": { "es5-ext": "0.10.53" }, "scripts": { - "prepare": "gulp build-eslint-rules", - "pretest": "gulp tests", "test": "gulp runtests-parallel --light=false", "test:eslint-rules": "gulp run-eslint-rules-tests", "build": "npm run build:compiler && npm run build:tests", @@ -105,10 +108,7 @@ "clean": "gulp clean", "gulp": "gulp", "lint": "gulp lint", - "lint:ci": "gulp lint --ci", - "lint:compiler": "gulp lint-compiler", - "lint:scripts": "gulp lint-scripts", - "setup-hooks": "node scripts/link-hooks.js" + "setup-hooks": "node scripts/link-hooks.mjs" }, "browser": { "fs": false, @@ -125,4 +125,4 @@ "node": "14.20.0", "npm": "8.15.0" } -} +} \ No newline at end of file diff --git a/node_modules/webpack-cli/README.md b/node_modules/webpack-cli/README.md index 063b299d5..bdb0e382a 100644 --- a/node_modules/webpack-cli/README.md +++ b/node_modules/webpack-cli/README.md @@ -69,51 +69,48 @@ npx webpack-cli --help verbose info|i [options] Outputs information about your system. init|create|new|c|n [generation-path] [options] Initialize a new webpack project. loader|l [output-path] [options] Scaffold a loader. - migrate|m [new-config-path] Migrate a configuration to a new version. plugin|p [output-path] [options] Scaffold a plugin. serve|server|s [entries...] [options] Run the webpack dev server. version|v [commands...] Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. watch|w [entries...] [options] Run webpack and watch for files changes. ``` -### webpack 4 +### Available Options ``` - Options: - --analyze It invokes webpack-bundle-analyzer plugin to get bundle information - -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. - --config-name Name of the configuration to use. - -m, --merge Merge two or more configurations using 'webpack-merge'. - --env Environment passed to the configuration when it is a function. - --node-env Sets process.env.NODE_ENV to the specified value. - --progress [value] Print compilation progress during build. - -j, --json [value] Prints result as JSON or store it in a file. - -d, --devtool Determine source maps to use. - --no-devtool Do not generate source maps. - --entry The entry point(s) of your application e.g. ./src/main.js. - -h, --hot [value] Enables Hot Module Replacement - --no-hot Disables Hot Module Replacement - --mode Defines the mode to pass to webpack. - --name Name of the configuration. Used when loading multiple configurations. - -o, --output-path Output location of the file generated by webpack e.g. ./dist/. - --prefetch Prefetch this request - --stats [value] It instructs webpack on how to treat the stats e.g. verbose. - --no-stats Disable stats output. - -t, --target Sets the build target e.g. node. - -w, --watch Watch for files changes. - --no-watch Do not watch for file changes. - --watch-options-stdin Stop watching when stdin stream has ended. - --no-watch-options-stdin Do not stop watching when stdin stream has ended. +Options: + -c, --config Provide path to a webpack configuration file e.g. ./webpack.config.js. + --config-name Name of the configuration to use. + -m, --merge Merge two or more configurations using 'webpack-merge'. + --disable-interpret Disable interpret for loading the config file. + --env Environment passed to the configuration when it is a function. + --define-process-env-node-env Sets process.env.NODE_ENV to the specified value. + --analyze It invokes webpack-bundle-analyzer plugin to get bundle information. + --progress [value] Print compilation progress during build. + -j, --json [value] Prints result as JSON or store it in a file. + --fail-on-warnings Stop webpack-cli process with non-zero exit code on warnings from webpack + -d, --devtool A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map). + --no-devtool Negative 'devtool' option. + --entry A module that is loaded upon startup. Only the last one is exported. + --mode Enable production optimizations or development hints. + --name Name of the configuration. Used when loading multiple configurations. + -o, --output-path The output directory as **absolute path** (required). + --stats [value] Stats options object or preset name. + --no-stats Negative 'stats' option. + -t, --target Environment to build for. Environment to build for. An array of environments to build for all of them when possible. + --no-target Negative 'target' option. + -w, --watch Enter watch mode, which rebuilds on file change. + --no-watch Negative 'watch' option. + --watch-options-stdin Stop watching when stdin stream has ended. + --no-watch-options-stdin Negative 'watch-options-stdin' option. Global options: - --color Enable colors on console. - --no-color Disable colors on console. - -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. - -h, --help [verbose] Display help for commands and options. + --color Enable colors on console. + --no-color Disable colors on console. + -v, --version Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands. + -h, --help [verbose] Display help for commands and options. ``` -### webpack 5 - Checkout [`OPTIONS.md`](https://github.com/webpack/webpack-cli/blob/master/OPTIONS.md) to see list of all available options. ## Exit codes and their meanings diff --git a/node_modules/webpack-cli/lib/index.js b/node_modules/webpack-cli/lib/index.js index 709cf1af3..ce7e36c7f 100644 --- a/node_modules/webpack-cli/lib/index.js +++ b/node_modules/webpack-cli/lib/index.js @@ -18,5 +18,3 @@ __exportStar(require("./types"), exports); // eslint-disable-next-line @typescript-eslint/no-var-requires const CLI = require("./webpack-cli"); module.exports = CLI; -// TODO remove after drop `@webpack-cli/migrate` -module.exports.utils = { logger: console }; diff --git a/node_modules/webpack-cli/lib/plugins/CLIPlugin.d.ts b/node_modules/webpack-cli/lib/plugins/CLIPlugin.d.ts index 2cf1611d8..b03ce944a 100644 --- a/node_modules/webpack-cli/lib/plugins/CLIPlugin.d.ts +++ b/node_modules/webpack-cli/lib/plugins/CLIPlugin.d.ts @@ -4,8 +4,6 @@ export declare class CLIPlugin { logger: ReturnType; options: CLIPluginOptions; constructor(options: CLIPluginOptions); - setupHotPlugin(compiler: Compiler): void; - setupPrefetchPlugin(compiler: Compiler): void; setupBundleAnalyzerPlugin(compiler: Compiler): Promise; setupProgressPlugin(compiler: Compiler): void; setupHelpfulOutput(compiler: Compiler): void; diff --git a/node_modules/webpack-cli/lib/plugins/CLIPlugin.js b/node_modules/webpack-cli/lib/plugins/CLIPlugin.js index 50cbcafad..3369b8428 100644 --- a/node_modules/webpack-cli/lib/plugins/CLIPlugin.js +++ b/node_modules/webpack-cli/lib/plugins/CLIPlugin.js @@ -5,17 +5,6 @@ class CLIPlugin { constructor(options) { this.options = options; } - setupHotPlugin(compiler) { - const { HotModuleReplacementPlugin } = compiler.webpack || require("webpack"); - const hotModuleReplacementPlugin = Boolean(compiler.options.plugins.find((plugin) => plugin instanceof HotModuleReplacementPlugin)); - if (!hotModuleReplacementPlugin) { - new HotModuleReplacementPlugin().apply(compiler); - } - } - setupPrefetchPlugin(compiler) { - const { PrefetchPlugin } = compiler.webpack || require("webpack"); - new PrefetchPlugin(null, this.options.prefetch).apply(compiler); - } async setupBundleAnalyzerPlugin(compiler) { // eslint-disable-next-line node/no-extraneous-require,@typescript-eslint/no-var-requires const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); @@ -83,12 +72,6 @@ class CLIPlugin { if (this.options.progress) { this.setupProgressPlugin(compiler); } - if (this.options.hot) { - this.setupHotPlugin(compiler); - } - if (this.options.prefetch) { - this.setupPrefetchPlugin(compiler); - } if (this.options.analyze) { this.setupBundleAnalyzerPlugin(compiler); } diff --git a/node_modules/webpack-cli/lib/types.d.ts b/node_modules/webpack-cli/lib/types.d.ts index 8b5d86ee5..f8bf39e9b 100644 --- a/node_modules/webpack-cli/lib/types.d.ts +++ b/node_modules/webpack-cli/lib/types.d.ts @@ -2,7 +2,7 @@ import webpack, { EntryOptions, Stats, Configuration, WebpackError, StatsOptions, WebpackOptionsNormalized, Compiler, MultiCompiler, Problem, Argument, AssetEmittedInfo, FileCacheOptions } from "webpack"; import { ClientConfiguration, Configuration as DevServerConfig } from "webpack-dev-server"; import { Colorette } from "colorette"; -import { Command, CommandOptions, OptionConstructor, ParseOptions } from "commander"; +import { Command, CommandOptions, Option, ParseOptions } from "commander"; import { prepare } from "rechoir"; import { stringifyStream } from "@discoveryjs/json-ext"; /** @@ -28,6 +28,11 @@ interface IWebpackCLI { doInstall(packageName: string, options?: PackageInstallOptions): Promise; loadJSONFile(path: Path, handleError: boolean): Promise; tryRequireThenImport(module: ModuleName, handleError: boolean): Promise; + getInfoOptions(): WebpackCLIBuiltInOption[]; + getInfoOutput(options: { + output: string; + additionalPackage: string[]; + }): Promise; makeCommand(commandOptions: WebpackCLIOptions, options: WebpackCLICommandOptions, action: CommandAction): Promise; makeOption(command: WebpackCLICommand, option: WebpackCLIBuiltInOption): void; run(args: Parameters[0], parseOptions?: ParseOptions): Promise; @@ -117,6 +122,7 @@ declare type WebpackDevServerOptions = DevServerConfig & WebpackConfiguration & merge?: boolean; config: string[]; configName?: string[]; + disableInterpret?: boolean; argv: Argv; }; declare type Callback = (...args: T) => void; @@ -147,6 +153,7 @@ interface WebpackRunOptions extends WebpackOptionsNormalized { json?: boolean; argv?: Argv; env: Env; + failOnWarnings?: boolean; } /** * Package management @@ -161,13 +168,6 @@ interface BasicPackageJsonContent { description: string; license: string; } -/** - * Webpack V4 - */ -declare type WebpackV4LegacyStats = Required; -interface WebpackV4Compiler extends Compiler { - compiler: Compiler; -} /** * Plugins and util types */ @@ -208,6 +208,7 @@ interface ImportLoaderError extends Error { /** * External libraries types */ +declare type OptionConstructor = new (flags: string, description?: string) => Option; declare type CommanderOption = InstanceType; interface Rechoir { prepare: typeof prepare; @@ -224,4 +225,4 @@ interface PromptOptions { defaultResponse: string; stream: NodeJS.WritableStream; } -export { IWebpackCLI, WebpackCLICommandOption, WebpackCLIBuiltInOption, WebpackCLIBuiltInFlag, WebpackCLIColors, WebpackCLIStats, WebpackCLIConfig, WebpackCLIExternalCommandInfo, WebpackCLIOptions, WebpackCLICommand, WebpackCLICommandOptions, WebpackCLIMainOption, WebpackCLILogger, WebpackV4LegacyStats, WebpackDevServerOptions, WebpackRunOptions, WebpackV4Compiler, WebpackCompiler, WebpackConfiguration, Argv, Argument, BasicPrimitive, BasicPackageJsonContent, CallableOption, Callback, CLIPluginOptions, CommandAction, CommanderOption, CommandOptions, ConfigOptions, DynamicImport, FileSystemCacheOptions, FlagConfig, ImportLoaderError, Instantiable, JsonExt, ModuleName, MultipleCompilerStatsOptions, PackageInstallOptions, PackageManager, Path, ProcessedArguments, PromptOptions, Problem, PotentialPromise, Rechoir, RechoirError, }; +export { IWebpackCLI, WebpackCLICommandOption, WebpackCLIBuiltInOption, WebpackCLIBuiltInFlag, WebpackCLIColors, WebpackCLIStats, WebpackCLIConfig, WebpackCLIExternalCommandInfo, WebpackCLIOptions, WebpackCLICommand, WebpackCLICommandOptions, WebpackCLIMainOption, WebpackCLILogger, WebpackDevServerOptions, WebpackRunOptions, WebpackCompiler, WebpackConfiguration, Argv, Argument, BasicPrimitive, BasicPackageJsonContent, CallableOption, Callback, CLIPluginOptions, CommandAction, CommanderOption, CommandOptions, ConfigOptions, DynamicImport, FileSystemCacheOptions, FlagConfig, ImportLoaderError, Instantiable, JsonExt, ModuleName, MultipleCompilerStatsOptions, PackageInstallOptions, PackageManager, Path, ProcessedArguments, PromptOptions, Problem, PotentialPromise, Rechoir, RechoirError, }; diff --git a/node_modules/webpack-cli/lib/webpack-cli.js b/node_modules/webpack-cli/lib/webpack-cli.js index 9e99f5ae6..ff28fce0e 100644 --- a/node_modules/webpack-cli/lib/webpack-cli.js +++ b/node_modules/webpack-cli/lib/webpack-cli.js @@ -5,6 +5,7 @@ const path = require("path"); const { pathToFileURL } = require("url"); const util = require("util"); const { program, Option } = require("commander"); +const envinfo = require("envinfo"); const WEBPACK_PACKAGE = process.env.WEBPACK_PACKAGE || "webpack"; const WEBPACK_DEV_SERVER_PACKAGE = process.env.WEBPACK_DEV_SERVER_PACKAGE || "webpack-dev-server"; class WebpackCLI { @@ -73,6 +74,17 @@ class WebpackCLI { // Nothing } } while (dir !== (dir = path.dirname(dir))); + // https://github.com/nodejs/node/blob/v18.9.1/lib/internal/modules/cjs/loader.js#L1274 + for (const internalPath of require("module").globalPaths) { + try { + if (fs.statSync(path.join(internalPath, packageName)).isDirectory()) { + return true; + } + } + catch (_error) { + // Nothing + } + } return false; } getAvailablePackageManagers() { @@ -244,6 +256,73 @@ class WebpackCLI { } return result; } + getInfoOptions() { + return [ + { + name: "output", + alias: "o", + configs: [ + { + type: "string", + }, + ], + description: "To get the output in a specified format ( accept json or markdown )", + }, + { + name: "additional-package", + alias: "a", + configs: [{ type: "string" }], + multiple: true, + description: "Adds additional packages to the output", + }, + ]; + } + async getInfoOutput(options) { + let { output } = options; + const envinfoConfig = {}; + if (output) { + // Remove quotes if exist + output = output.replace(/['"]+/g, ""); + switch (output) { + case "markdown": + envinfoConfig["markdown"] = true; + break; + case "json": + envinfoConfig["json"] = true; + break; + default: + this.logger.error(`'${output}' is not a valid value for output`); + process.exit(2); + } + } + const defaultInformation = { + Binaries: ["Node", "Yarn", "npm"], + Browsers: [ + "Brave Browser", + "Chrome", + "Chrome Canary", + "Edge", + "Firefox", + "Firefox Developer Edition", + "Firefox Nightly", + "Internet Explorer", + "Safari", + "Safari Technology Preview", + ], + Monorepos: ["Yarn Workspaces", "Lerna"], + System: ["OS", "CPU", "Memory"], + npmGlobalPackages: ["webpack", "webpack-cli", "webpack-dev-server"], + }; + let defaultPackages = ["webpack", "loader", "@webpack-cli/"]; + if (typeof options.additionalPackage !== "undefined") { + defaultPackages = [...defaultPackages, ...options.additionalPackage]; + } + defaultInformation.npmPackages = `{${defaultPackages.map((item) => `*${item}*`).join(",")}}`; + let info = await envinfo.run(defaultInformation, envinfoConfig); + info = info.replace(/npmPackages/g, "Packages"); + info = info.replace(/npmGlobalPackages/g, "Global Packages"); + return info; + } async makeCommand(commandOptions, options, action) { const alreadyLoaded = this.program.commands.find((command) => command.name() === commandOptions.name.split(" ")[0] || command.aliases().includes(commandOptions.alias)); @@ -326,6 +405,10 @@ class WebpackCLI { makeOption(command, option) { let mainOption; let negativeOption; + const flagsWithAlias = ["devtool", "output-path", "target", "watch"]; + if (flagsWithAlias.includes(option.name)) { + option.alias = option.name[0]; + } if (option.configs) { let needNegativeOption = false; let negatedDescription; @@ -394,8 +477,7 @@ class WebpackCLI { else { mainOption = { flags: option.alias ? `-${option.alias}, --${option.name}` : `--${option.name}`, - // TODO `describe` used by `webpack-dev-server@3` - description: option.description || option.describe || "", + description: option.description || "", type: option.type ? new Set(Array.isArray(option.type) ? option.type : [option.type]) : new Set([Boolean]), @@ -503,24 +585,6 @@ class WebpackCLI { if (this.builtInOptionsCache) { return this.builtInOptionsCache; } - const minimumHelpFlags = [ - "config", - "config-name", - "merge", - "env", - "mode", - "watch", - "watch-options-stdin", - "stats", - "devtool", - "entry", - "target", - "progress", - "json", - "name", - "output-path", - "node-env", - ]; const builtInFlags = [ // For configs { @@ -555,6 +619,16 @@ class WebpackCLI { ], description: "Merge two or more configurations using 'webpack-merge'.", }, + { + name: "disable-interpret", + configs: [ + { + type: "enum", + values: [true], + }, + ], + description: "Disable interpret for loading the config file.", + }, // Complex configs { name: "env", @@ -594,7 +668,7 @@ class WebpackCLI { description: "Environment passed to the configuration when it is a function.", }, { - name: "node-env", + name: "define-process-env-node-env", configs: [ { type: "string", @@ -604,21 +678,6 @@ class WebpackCLI { description: "Sets process.env.NODE_ENV to the specified value.", }, // Adding more plugins - { - name: "hot", - alias: "h", - configs: [ - { - type: "string", - }, - { - type: "boolean", - }, - ], - negative: true, - description: "Enables Hot Module Replacement", - negatedDescription: "Disables Hot Module Replacement.", - }, { name: "analyze", configs: [ @@ -643,15 +702,6 @@ class WebpackCLI { ], description: "Print compilation progress during build.", }, - { - name: "prefetch", - configs: [ - { - type: "string", - }, - ], - description: "Prefetch this request.", - }, // Output options { name: "json", @@ -667,126 +717,43 @@ class WebpackCLI { alias: "j", description: "Prints result as JSON or store it in a file.", }, - // For webpack@4 { - name: "entry", - configs: [ - { - type: "string", - }, - ], - multiple: true, - description: "The entry point(s) of your application e.g. ./src/main.js.", - }, - { - name: "output-path", - alias: "o", - configs: [ - { - type: "string", - }, - ], - description: "Output location of the file generated by webpack e.g. ./dist/.", - }, - { - name: "target", - alias: "t", + name: "fail-on-warnings", configs: [ - { - type: "string", - }, - ], - multiple: this.webpack.cli !== undefined, - description: "Sets the build target e.g. node.", - }, - { - name: "devtool", - configs: [ - { - type: "string", - }, { type: "enum", - values: [false], - }, - ], - negative: true, - alias: "d", - description: "Determine source maps to use.", - negatedDescription: "Do not generate source maps.", - }, - { - name: "mode", - configs: [ - { - type: "string", - }, - ], - description: "Defines the mode to pass to webpack.", - }, - { - name: "name", - configs: [ - { - type: "string", - }, - ], - description: "Name of the configuration. Used when loading multiple configurations.", - }, - { - name: "stats", - configs: [ - { - type: "string", - }, - { - type: "boolean", - }, - ], - negative: true, - description: "It instructs webpack on how to treat the stats e.g. verbose.", - negatedDescription: "Disable stats output.", - }, - { - name: "watch", - configs: [ - { - type: "boolean", - }, - ], - negative: true, - alias: "w", - description: "Watch for files changes.", - negatedDescription: "Do not watch for file changes.", - }, - { - name: "watch-options-stdin", - configs: [ - { - type: "boolean", + values: [true], }, ], - negative: true, - description: "Stop watching when stdin stream has ended.", - negatedDescription: "Do not stop watching when stdin stream has ended.", + description: "Stop webpack-cli process with non-zero exit code on warnings from webpack", }, ]; + const minimumHelpFlags = [ + ...builtInFlags.map((flag) => flag.name), + "mode", + "watch", + "watch-options-stdin", + "stats", + "devtool", + "entry", + "target", + "name", + "output-path", + ]; // Extract all the flags being exported from core. - // A list of cli flags generated by core can be found here https://github.com/webpack/webpack/blob/master/test/__snapshots__/Cli.test.js.snap - const coreFlags = this.webpack.cli - ? Object.entries(this.webpack.cli.getArguments()).map(([flag, meta]) => { - const inBuiltIn = builtInFlags.find((builtInFlag) => builtInFlag.name === flag); - if (inBuiltIn) { - return Object.assign(Object.assign(Object.assign(Object.assign({}, meta), { - // @ts-expect-error this might be overwritten - name: flag, group: "core" }), inBuiltIn), { configs: meta.configs || [] }); - } - return Object.assign(Object.assign({}, meta), { name: flag, group: "core" }); - }) - : []; + // A list of cli flags generated by core can be found here https://github.com/webpack/webpack/blob/main/test/__snapshots__/Cli.basictest.js.snap + const coreArguments = Object.entries(this.webpack.cli.getArguments()).map(([flag, meta]) => { + const inBuiltIn = builtInFlags.find((builtInFlag) => builtInFlag.name === flag); + if (inBuiltIn) { + return Object.assign(Object.assign(Object.assign(Object.assign({}, meta), { + // @ts-expect-error this might be overwritten + name: flag, group: "core" }), inBuiltIn), { configs: meta.configs || [] }); + } + return Object.assign(Object.assign({}, meta), { name: flag, group: "core" }); + }); const options = [] - .concat(builtInFlags.filter((builtInFlag) => !coreFlags.find((coreFlag) => builtInFlag.name === coreFlag.name))) - .concat(coreFlags) + .concat(builtInFlags.filter((builtInFlag) => !coreArguments.find((coreArgument) => builtInFlag.name === coreArgument.name))) + .concat(coreArguments) .map((option) => { option.helpLevel = minimumHelpFlags.includes(option.name) ? "minimum" @@ -816,8 +783,9 @@ class WebpackCLI { dependencies: [WEBPACK_PACKAGE], }; const versionCommandOptions = { - name: "version [commands...]", + name: "version", alias: "v", + usage: "[options]", description: "Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands.", }; const helpCommandOptions = { @@ -852,11 +820,6 @@ class WebpackCLI { alias: "p", pkg: "@webpack-cli/generators", }, - { - name: "migrate", - alias: "m", - pkg: "@webpack-cli/migrate", - }, { name: "configtest [config-path]", alias: "t", @@ -919,8 +882,10 @@ class WebpackCLI { } else if (isCommand(commandName, versionCommandOptions)) { // Stub for the `version` command - // eslint-disable-next-line @typescript-eslint/no-empty-function - this.makeCommand(versionCommandOptions, [], () => { }); + this.makeCommand(versionCommandOptions, this.getInfoOptions(), async (options) => { + const info = await cli.getInfoOutput(options); + cli.logger.raw(info); + }); } else { const builtInExternalCommandInfo = externalBuiltInCommandsInfo.find((externalBuiltInCommandInfo) => getCommandName(externalBuiltInCommandInfo.name) === commandName || @@ -1028,62 +993,9 @@ class WebpackCLI { cli.isColorSupportChanged = color; cli.colors = cli.createColors(color); }); - // Make `-v, --version` options - // Make `version|v [commands...]` command - const outputVersion = async (options) => { - // Filter `bundle`, `watch`, `version` and `help` commands - const possibleCommandNames = options.filter((option) => !isCommand(option, buildCommandOptions) && - !isCommand(option, watchCommandOptions) && - !isCommand(option, versionCommandOptions) && - !isCommand(option, helpCommandOptions)); - possibleCommandNames.forEach((possibleCommandName) => { - if (!isOption(possibleCommandName)) { - return; - } - this.logger.error(`Unknown option '${possibleCommandName}'`); - this.logger.error("Run 'webpack --help' to see available commands and options"); - process.exit(2); - }); - if (possibleCommandNames.length > 0) { - await Promise.all(possibleCommandNames.map((possibleCommand) => loadCommandByName(possibleCommand))); - for (const possibleCommandName of possibleCommandNames) { - const foundCommand = findCommandByName(possibleCommandName); - if (!foundCommand) { - this.logger.error(`Unknown command '${possibleCommandName}'`); - this.logger.error("Run 'webpack --help' to see available commands and options"); - process.exit(2); - } - try { - const { name, version } = this.loadJSONFile(`${foundCommand.pkg}/package.json`); - this.logger.raw(`${name} ${version}`); - } - catch (e) { - this.logger.error(`Error: External package '${foundCommand.pkg}' not found`); - process.exit(2); - } - } - } - let webpack; - try { - webpack = await this.loadWebpack(false); - } - catch (_error) { - // Nothing - } - this.logger.raw(`webpack: ${webpack ? webpack.version : "not installed"}`); - const pkgJSON = this.loadJSONFile("../package.json"); - this.logger.raw(`webpack-cli: ${pkgJSON.version}`); - let devServer; - try { - devServer = await this.loadJSONFile("webpack-dev-server/package.json", false); - } - catch (_error) { - // Nothing - } - this.logger.raw(`webpack-dev-server ${devServer ? devServer.version : "not installed"}`); - process.exit(0); - }; this.program.option("-v, --version", "Output the version number of 'webpack', 'webpack-cli' and 'webpack-dev-server' and commands."); + // webpack-cli has it's own logic for showing suggestions + this.program.showSuggestionAfterError(false); const outputHelp = async (options, isVerbose, isHelpCommandSyntax, program) => { const { bold } = this.colors; const outputIncorrectUsageOfHelp = () => { @@ -1113,7 +1025,7 @@ class WebpackCLI { // Support multiple aliases subcommandTerm: (command) => { const humanReadableArgumentName = (argument) => { - const nameOutput = argument.name + (argument.variadic === true ? "..." : ""); + const nameOutput = argument.name() + (argument.variadic === true ? "..." : ""); return argument.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]"; }; const args = command._args @@ -1136,7 +1048,7 @@ class WebpackCLI { }); }, padWidth(command, helper) { - return Math.max(helper.longestArgumentTermLength(command, helper), helper.longestOptionTermLength(command, helper), + return Math.max(helper.longestArgumentTermLength(command, helper), helper.longestOptionTermLength(command, helper), // For global options helper.longestOptionTermLength(program, helper), helper.longestSubcommandTermLength(isGlobalHelp ? program : command, helper)); }, @@ -1165,7 +1077,7 @@ class WebpackCLI { // Arguments const argumentList = helper .visibleArguments(command) - .map((argument) => formatItem(argument.term, argument.description)); + .map((argument) => formatItem(argument.name(), argument.description)); if (argumentList.length > 0) { output = output.concat([bold("Arguments:"), formatList(argumentList), ""]); } @@ -1298,6 +1210,7 @@ class WebpackCLI { // Default action this.program.usage("[options]"); this.program.allowUnknownOption(true); + // Basic command for lazy loading other commands this.program.action(async (options, program) => { if (!isInternalActionCalled) { isInternalActionCalled = true; @@ -1338,13 +1251,10 @@ class WebpackCLI { await outputHelp(optionsForHelp, isVerbose, isHelpCommandSyntax, program); } const isVersionOption = typeof options.version !== "undefined"; - const isVersionCommandSyntax = isCommand(operand, versionCommandOptions); - if (isVersionOption || isVersionCommandSyntax) { - const optionsForVersion = [] - .concat(isVersionOption ? [operand] : []) - .concat(operands.slice(1)) - .concat(unknown); - await outputVersion(optionsForVersion); + if (isVersionOption) { + const info = await this.getInfoOutput({ output: "", additionalPackage: [] }); + this.logger.raw(info); + process.exit(0); } let commandToRun = operand; let commandOperands = operands.slice(1); @@ -1376,11 +1286,12 @@ class WebpackCLI { await this.program.parseAsync(args, parseOptions); } async loadConfig(options) { + const disableInterpret = typeof options.disableInterpret !== "undefined" && options.disableInterpret; const interpret = require("interpret"); const loadConfigByPath = async (configPath, argv = {}) => { const ext = path.extname(configPath); const interpreted = Object.keys(interpret.jsVariants).find((variant) => variant === ext); - if (interpreted) { + if (interpreted && !disableInterpret) { const rechoir = require("rechoir"); try { rechoir.prepare(interpret.extensions, configPath); @@ -1490,7 +1401,7 @@ class WebpackCLI { ".webpack/webpack.config", ".webpack/webpackfile", ] - .map((filename) => + .map((filename) => // Since .cjs is not available on interpret side add it manually to default config extension list [...Object.keys(interpret.extensions), ".cjs"].map((ext) => ({ path: path.resolve(filename + ext), @@ -1587,10 +1498,6 @@ class WebpackCLI { this.logger.error(`'${options.progress}' is an invalid value for the --progress option. Only 'profile' is allowed.`); process.exit(2); } - if (typeof options.hot === "string" && options.hot !== "only") { - this.logger.error(`'${options.hot}' is an invalid value for the --hot option. Use 'only' instead.`); - process.exit(2); - } const CLIPlugin = await this.tryRequireThenImport("./plugins/CLIPlugin"); const internalBuildConfig = (item) => { // Output warnings @@ -1604,98 +1511,67 @@ class WebpackCLI { } } // Apply options - if (this.webpack.cli) { - const args = this.getBuiltInOptions() - .filter((flag) => flag.group === "core") - .reduce((accumulator, flag) => { - accumulator[flag.name] = flag; + const args = this.getBuiltInOptions() + .filter((flag) => flag.group === "core") + .reduce((accumulator, flag) => { + accumulator[flag.name] = flag; + return accumulator; + }, {}); + const values = Object.keys(options).reduce((accumulator, name) => { + if (name === "argv") { return accumulator; - }, {}); - const values = Object.keys(options).reduce((accumulator, name) => { - if (name === "argv") { - return accumulator; + } + const kebabName = this.toKebabCase(name); + if (args[kebabName]) { + accumulator[kebabName] = options[name]; + } + return accumulator; + }, {}); + const problems = this.webpack.cli.processArguments(args, item, values); + if (problems) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const groupBy = (xs, key) => { + return xs.reduce((rv, x) => { + (rv[x[key]] = rv[x[key]] || []).push(x); + return rv; + }, {}); + }; + const problemsByPath = groupBy(problems, "path"); + for (const path in problemsByPath) { + const problems = problemsByPath[path]; + problems.forEach((problem) => { + this.logger.error(`${this.capitalizeFirstLetter(problem.type.replace(/-/g, " "))}${problem.value ? ` '${problem.value}'` : ""} for the '--${problem.argument}' option${problem.index ? ` by index '${problem.index}'` : ""}`); + if (problem.expected) { + this.logger.error(`Expected: '${problem.expected}'`); + } + }); + } + process.exit(2); + } + const isFileSystemCacheOptions = (config) => { + return (Boolean(config.cache) && config.cache.type === "filesystem"); + }; + // Setup default cache options + if (isFileSystemCacheOptions(item)) { + const configPath = config.path.get(item); + if (configPath) { + if (!item.cache.buildDependencies) { + item.cache.buildDependencies = {}; } - const kebabName = this.toKebabCase(name); - if (args[kebabName]) { - accumulator[kebabName] = options[name]; + if (!item.cache.buildDependencies.defaultConfig) { + item.cache.buildDependencies.defaultConfig = []; } - return accumulator; - }, {}); - const problems = this.webpack.cli.processArguments(args, item, values); - if (problems) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const groupBy = (xs, key) => { - return xs.reduce((rv, x) => { - (rv[x[key]] = rv[x[key]] || []).push(x); - return rv; - }, {}); - }; - const problemsByPath = groupBy(problems, "path"); - for (const path in problemsByPath) { - const problems = problemsByPath[path]; - problems.forEach((problem) => { - this.logger.error(`${this.capitalizeFirstLetter(problem.type.replace(/-/g, " "))}${problem.value ? ` '${problem.value}'` : ""} for the '--${problem.argument}' option${problem.index ? ` by index '${problem.index}'` : ""}`); - if (problem.expected) { - this.logger.error(`Expected: '${problem.expected}'`); - } + if (Array.isArray(configPath)) { + configPath.forEach((oneOfConfigPath) => { + item.cache.buildDependencies.defaultConfig.push(oneOfConfigPath); }); } - process.exit(2); - } - const isFileSystemCacheOptions = (config) => { - return (Boolean(config.cache) && config.cache.type === "filesystem"); - }; - // Setup default cache options - if (isFileSystemCacheOptions(item)) { - const configPath = config.path.get(item); - if (configPath) { - if (!item.cache.buildDependencies) { - item.cache.buildDependencies = {}; - } - if (!item.cache.buildDependencies.defaultConfig) { - item.cache.buildDependencies.defaultConfig = []; - } - if (Array.isArray(configPath)) { - configPath.forEach((oneOfConfigPath) => { - item.cache.buildDependencies.defaultConfig.push(oneOfConfigPath); - }); - } - else { - item.cache.buildDependencies.defaultConfig.push(configPath); - } + else { + item.cache.buildDependencies.defaultConfig.push(configPath); } } } - // Setup legacy logic for webpack@4 - // TODO respect `--entry-reset` in th next major release - // TODO drop in the next major release - if (options.entry) { - item.entry = options.entry; - } - if (options.outputPath) { - item.output = Object.assign(Object.assign({}, item.output), { path: path.resolve(options.outputPath) }); - } - if (options.target) { - item.target = options.target; - } - if (typeof options.devtool !== "undefined") { - item.devtool = options.devtool; - } - if (options.name) { - item.name = options.name; - } - if (typeof options.stats !== "undefined") { - item.stats = options.stats; - } - if (typeof options.watch !== "undefined") { - item.watch = options.watch; - } - if (typeof options.watchOptionsStdin !== "undefined") { - item.watchOptions = Object.assign(Object.assign({}, item.watchOptions), { stdin: options.watchOptionsStdin }); - } - if (options.mode) { - item.mode = options.mode; - } + // Respect `process.env.NODE_ENV` if (!item.mode && process.env && @@ -1706,37 +1582,14 @@ class WebpackCLI { item.mode = process.env.NODE_ENV; } // Setup stats - // TODO remove after drop webpack@4 - const statsForWebpack4 = this.webpack.Stats && - this.webpack.Stats.presetToOptions; - if (statsForWebpack4) { - if (typeof item.stats === "undefined") { - item.stats = {}; - } - else if (typeof item.stats === "boolean") { - item.stats = this.webpack.Stats.presetToOptions(item.stats); - } - else if (typeof item.stats === "string" && - (item.stats === "none" || - item.stats === "verbose" || - item.stats === "detailed" || - item.stats === "normal" || - item.stats === "minimal" || - item.stats === "errors-only" || - item.stats === "errors-warnings")) { - item.stats = this.webpack.Stats.presetToOptions(item.stats); - } + if (typeof item.stats === "undefined") { + item.stats = { preset: "normal" }; } - else { - if (typeof item.stats === "undefined") { - item.stats = { preset: "normal" }; - } - else if (typeof item.stats === "boolean") { - item.stats = item.stats ? { preset: "normal" } : { preset: "none" }; - } - else if (typeof item.stats === "string") { - item.stats = { preset: item.stats }; - } + else if (typeof item.stats === "boolean") { + item.stats = item.stats ? { preset: "normal" } : { preset: "none" }; + } + else if (typeof item.stats === "string") { + item.stats = { preset: item.stats }; } let colors; // From arguments @@ -1751,10 +1604,7 @@ class WebpackCLI { else { colors = Boolean(this.colors.isColorSupported); } - // TODO remove after drop webpack v4 - if (typeof item.stats === "object" && item.stats !== null) { - item.stats.colors = colors; - } + item.stats.colors = colors; // Apply CLI plugin if (!item.plugins) { item.plugins = []; @@ -1762,9 +1612,7 @@ class WebpackCLI { item.plugins.unshift(new CLIPlugin({ configPath: config.path.get(item), helpfulOutput: !options.json, - hot: options.hot, progress: options.progress, - prefetch: options.prefetch, analyze: options.analyze, })); return options; @@ -1773,14 +1621,11 @@ class WebpackCLI { return config; } isValidationError(error) { - // https://github.com/webpack/webpack/blob/master/lib/index.js#L267 - // https://github.com/webpack/webpack/blob/v4.44.2/lib/webpack.js#L90 - const ValidationError = this.webpack.ValidationError || this.webpack.WebpackOptionsValidationError; - return error instanceof ValidationError || error.name === "ValidationError"; + return error instanceof this.webpack.ValidationError || error.name === "ValidationError"; } async createCompiler(options, callback) { - if (typeof options.nodeEnv === "string") { - process.env.NODE_ENV = options.nodeEnv; + if (typeof options.defineProcessEnvNodeEnv === "string") { + process.env.NODE_ENV = options.defineProcessEnvNodeEnv; } let config = await this.loadConfig(options); config = await this.buildConfig(config, options); @@ -1806,10 +1651,6 @@ class WebpackCLI { } process.exit(2); } - // TODO webpack@4 return Watching and MultiWatching instead Compiler and MultiCompiler, remove this after drop webpack@4 - if (compiler && compiler.compiler) { - compiler = compiler.compiler; - } return compiler; } needWatchStdin(compiler) { @@ -1831,7 +1672,7 @@ class WebpackCLI { this.logger.error(error); process.exit(2); } - if (stats && stats.hasErrors()) { + if (stats && (stats.hasErrors() || (options.failOnWarnings && stats.hasWarnings()))) { process.exitCode = 1; } if (!compiler || !stats) { @@ -1844,12 +1685,6 @@ class WebpackCLI { : compiler.options ? compiler.options.stats : undefined; - // TODO webpack@4 doesn't support `{ children: [{ colors: true }, { colors: true }] }` for stats - const statsForWebpack4 = this.webpack.Stats && - this.webpack.Stats.presetToOptions; - if (this.isMultipleCompiler(compiler) && statsForWebpack4) { - statsOptions.colors = statsOptions.children.some((child) => child.colors); - } if (options.json && createJsonStringifyStream) { const handleWriteError = (error) => { this.logger.error(error); diff --git a/node_modules/webpack-cli/package.json b/node_modules/webpack-cli/package.json index 0f5d19444..d41011c21 100644 --- a/node_modules/webpack-cli/package.json +++ b/node_modules/webpack-cli/package.json @@ -1,6 +1,6 @@ { "name": "webpack-cli", - "version": "4.10.0", + "version": "5.0.0", "description": "CLI for webpack & friends", "license": "MIT", "repository": { @@ -18,7 +18,7 @@ }, "main": "./lib/index.js", "engines": { - "node": ">=10.13.0" + "node": ">=14.15.0" }, "keywords": [ "webpack", @@ -35,28 +35,29 @@ ], "dependencies": { "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^1.2.0", - "@webpack-cli/info": "^1.5.0", - "@webpack-cli/serve": "^1.7.0", + "@webpack-cli/configtest": "^2.0.0", + "@webpack-cli/info": "^2.0.0", + "@webpack-cli/serve": "^2.0.0", "colorette": "^2.0.14", - "commander": "^7.0.0", + "commander": "^9.4.1", "cross-spawn": "^7.0.3", + "envinfo": "^7.7.3", "fastest-levenshtein": "^1.0.12", "import-local": "^3.0.2", - "interpret": "^2.2.0", - "rechoir": "^0.7.0", + "interpret": "^3.1.1", + "rechoir": "^0.8.0", "webpack-merge": "^5.7.3" }, + "devDependencies": { + "@types/envinfo": "^7.8.1" + }, "peerDependencies": { - "webpack": "4.x.x || 5.x.x" + "webpack": "5.x.x" }, "peerDependenciesMeta": { "@webpack-cli/generators": { "optional": true }, - "@webpack-cli/migrate": { - "optional": true - }, "webpack-bundle-analyzer": { "optional": true }, @@ -64,5 +65,5 @@ "optional": true } }, - "gitHead": "20882d463450d010bb76e0824fe555e9785e9561" + "gitHead": "1d6ada1a84c68a00e56c536d2f004f60939bd946" } diff --git a/node_modules/webpack/README.md b/node_modules/webpack/README.md index 6def8435e..c712d27fd 100644 --- a/node_modules/webpack/README.md +++ b/node_modules/webpack/README.md @@ -8,7 +8,6 @@ [![npm][npm]][npm-url] [![node][node]][node-url] -[![deps][deps]][deps-url] [![builds2][builds2]][builds2-url] [![coverage][cover]][cover-url] [![licenses][licenses]][licenses-url] @@ -706,8 +705,6 @@ src="https://static.monei.net/monei-logo.svg" height="30" alt="MONEI"> [npm-url]: https://npmjs.com/package/webpack [node]: https://img.shields.io/node/v/webpack.svg [node-url]: https://nodejs.org -[deps]: https://img.shields.io/david/webpack/webpack.svg -[deps-url]: https://david-dm.org/webpack/webpack [prs]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg [prs-url]: https://webpack.js.org/contribute/ [builds2]: https://dev.azure.com/webpack/webpack/_apis/build/status/webpack.webpack diff --git a/node_modules/webpack/hot/dev-server.js b/node_modules/webpack/hot/dev-server.js index a93ab3700..a2f760a7c 100644 --- a/node_modules/webpack/hot/dev-server.js +++ b/node_modules/webpack/hot/dev-server.js @@ -14,12 +14,20 @@ if (module.hot) { .check(true) .then(function (updatedModules) { if (!updatedModules) { - log("warning", "[HMR] Cannot find update. Need to do a full reload!"); + log( + "warning", + "[HMR] Cannot find update. " + + (typeof window !== "undefined" + ? "Need to do a full reload!" + : "Please reload manually!") + ); log( "warning", "[HMR] (Probably because of restarting the webpack-dev-server)" ); - window.location.reload(); + if (typeof window !== "undefined") { + window.location.reload(); + } return; } @@ -38,10 +46,15 @@ if (module.hot) { if (["abort", "fail"].indexOf(status) >= 0) { log( "warning", - "[HMR] Cannot apply update. Need to do a full reload!" + "[HMR] Cannot apply update. " + + (typeof window !== "undefined" + ? "Need to do a full reload!" + : "Please reload manually!") ); log("warning", "[HMR] " + log.formatError(err)); - window.location.reload(); + if (typeof window !== "undefined") { + window.location.reload(); + } } else { log("warning", "[HMR] Update failed: " + log.formatError(err)); } diff --git a/node_modules/webpack/lib/BannerPlugin.js b/node_modules/webpack/lib/BannerPlugin.js index 94243ad82..8561ef616 100644 --- a/node_modules/webpack/lib/BannerPlugin.js +++ b/node_modules/webpack/lib/BannerPlugin.js @@ -33,7 +33,7 @@ const wrapComment = str => { .split("\n") .join("\n * ") .replace(/\s+\n/g, "\n") - .trimRight()}\n */`; + .trimEnd()}\n */`; }; class BannerPlugin { diff --git a/node_modules/webpack/lib/Compilation.js b/node_modules/webpack/lib/Compilation.js index 66ae146f4..866b2608e 100644 --- a/node_modules/webpack/lib/Compilation.js +++ b/node_modules/webpack/lib/Compilation.js @@ -1938,7 +1938,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si // This avoids deadlocks for circular dependencies if (this.processDependenciesQueue.isProcessing(module)) { - return callback(); + return callback(null, module); } this.processModuleDependencies(module, err => { @@ -3192,6 +3192,9 @@ Or do you want to use the entrypoints '${name}' and '${runtime}' independently o } _runCodeGenerationJobs(jobs, callback) { + if (jobs.length === 0) { + return callback(); + } let statModulesFromCache = 0; let statModulesGenerated = 0; const { chunkGraph, moduleGraph, dependencyTemplates, runtimeTemplate } = diff --git a/node_modules/webpack/lib/EvalSourceMapDevToolPlugin.js b/node_modules/webpack/lib/EvalSourceMapDevToolPlugin.js index 63129b9f6..c03b09007 100644 --- a/node_modules/webpack/lib/EvalSourceMapDevToolPlugin.js +++ b/node_modules/webpack/lib/EvalSourceMapDevToolPlugin.js @@ -18,6 +18,7 @@ const { makePathsAbsolute } = require("./util/identifier"); /** @typedef {import("../declarations/WebpackOptions").DevTool} DevToolOptions */ /** @typedef {import("../declarations/plugins/SourceMapDevToolPlugin").SourceMapDevToolPluginOptions} SourceMapDevToolPluginOptions */ /** @typedef {import("./Compiler")} Compiler */ +/** @typedef {import("./NormalModule").SourceMap} SourceMap */ /** @type {WeakMap} */ const cache = new WeakMap(); @@ -105,15 +106,15 @@ class EvalSourceMapDevToolPlugin { return result(source); } - /** @type {{ [key: string]: TODO; }} */ + /** @type {SourceMap} */ let sourceMap; let content; if (source.sourceAndMap) { const sourceAndMap = source.sourceAndMap(options); - sourceMap = sourceAndMap.map; + sourceMap = /** @type {SourceMap} */ (sourceAndMap.map); content = sourceAndMap.source; } else { - sourceMap = source.map(options); + sourceMap = /** @type {SourceMap} */ (source.map(options)); content = source.source(); } if (!sourceMap) { @@ -152,6 +153,9 @@ class EvalSourceMapDevToolPlugin { } ); sourceMap.sources = moduleFilenames; + if (options.noSources) { + sourceMap.sourcesContent = undefined; + } sourceMap.sourceRoot = options.sourceRoot || ""; const moduleId = chunkGraph.getModuleId(m); sourceMap.file = `${moduleId}.js`; diff --git a/node_modules/webpack/lib/Template.js b/node_modules/webpack/lib/Template.js index a3b9611eb..35c17ec2b 100644 --- a/node_modules/webpack/lib/Template.js +++ b/node_modules/webpack/lib/Template.js @@ -217,7 +217,7 @@ class Template { if (Array.isArray(s)) { return s.map(Template.indent).join("\n"); } else { - const str = s.trimRight(); + const str = s.trimEnd(); if (!str) return ""; const ind = str[0] === "\n" ? "" : "\t"; return ind + str.replace(/\n([^\n])/g, "\n\t$1"); diff --git a/node_modules/webpack/lib/WebpackOptionsApply.js b/node_modules/webpack/lib/WebpackOptionsApply.js index c6d594000..96a485f74 100644 --- a/node_modules/webpack/lib/WebpackOptionsApply.js +++ b/node_modules/webpack/lib/WebpackOptionsApply.js @@ -160,6 +160,28 @@ class WebpackOptionsApply extends OptionsApply { } : /^(\/\/|https?:\/\/|std:)/ ).apply(compiler); + } else if (options.externalsPresets.node) { + if (options.experiments.css) { + //@ts-expect-error https://github.com/microsoft/TypeScript/issues/41697 + const ExternalsPlugin = require("./ExternalsPlugin"); + new ExternalsPlugin( + "module", + ({ request, dependencyType }, callback) => { + if (dependencyType === "url") { + if (/^(\/\/|https?:\/\/)/.test(request)) + return callback(null, `asset ${request}`); + } else if (dependencyType === "css-import") { + if (/^(\/\/|https?:\/\/)/.test(request)) + return callback(null, `css-import ${request}`); + } else if (/^(\/\/|https?:\/\/|std:)/.test(request)) { + if (/^\.css(\?|$)/.test(request)) + return callback(null, `css-import ${request}`); + return callback(null, `module ${request}`); + } + callback(); + } + ).apply(compiler); + } } new ChunkPrefetchPreloadPlugin().apply(compiler); diff --git a/node_modules/webpack/lib/buildChunkGraph.js b/node_modules/webpack/lib/buildChunkGraph.js index 0e9e2cc96..ecf6743c9 100644 --- a/node_modules/webpack/lib/buildChunkGraph.js +++ b/node_modules/webpack/lib/buildChunkGraph.js @@ -508,8 +508,9 @@ const visitModules = ( new AsyncDependencyToInitialChunkError(chunkName, module, b.loc) ); c = chunkGroup; + } else { + c.addOptions(b.groupOptions); } - c.addOptions(b.groupOptions); c.addOrigin(module, b.loc, b.request); } blockConnections.set(b, []); diff --git a/node_modules/webpack/lib/config/defaults.js b/node_modules/webpack/lib/config/defaults.js index cbaeb174b..81fca07eb 100644 --- a/node_modules/webpack/lib/config/defaults.js +++ b/node_modules/webpack/lib/config/defaults.js @@ -485,7 +485,7 @@ const applyJavascriptParserOptionsDefaults = ( * @param {boolean} options.cache is caching enabled * @param {boolean} options.syncWebAssembly is syncWebAssembly enabled * @param {boolean} options.asyncWebAssembly is asyncWebAssembly enabled - * @param {CssExperimentOptions} options.css is css enabled + * @param {CssExperimentOptions|false} options.css is css enabled * @param {boolean} options.futureDefaults is future defaults enabled * @param {boolean} options.isNode is node target platform * @returns {void} @@ -1122,7 +1122,7 @@ const applyPerformanceDefaults = (performance, { production }) => { * @param {Object} options options * @param {boolean} options.production is production * @param {boolean} options.development is development - * @param {CssExperimentOptions} options.css is css enabled + * @param {CssExperimentOptions|false} options.css is css enabled * @param {boolean} options.records using records * @returns {void} */ diff --git a/node_modules/webpack/lib/config/normalization.js b/node_modules/webpack/lib/config/normalization.js index 0b17d8a41..45cfca6ad 100644 --- a/node_modules/webpack/lib/config/normalization.js +++ b/node_modules/webpack/lib/config/normalization.js @@ -178,11 +178,10 @@ const getNormalizedWebpackOptions = config => { ), lazyCompilation: optionalNestedConfig( experiments.lazyCompilation, - options => - options === true ? {} : options === false ? undefined : options + options => (options === true ? {} : options) ), css: optionalNestedConfig(experiments.css, options => - options === true ? {} : options === false ? undefined : options + options === true ? {} : options ) })), externals: config.externals, diff --git a/node_modules/webpack/lib/css/CssParser.js b/node_modules/webpack/lib/css/CssParser.js index 6e96a1523..12df8759a 100644 --- a/node_modules/webpack/lib/css/CssParser.js +++ b/node_modules/webpack/lib/css/CssParser.js @@ -196,7 +196,7 @@ class CssParser extends Parser { } if (pos === input.length) break; } - return [pos, text.trimRight()]; + return [pos, text.trimEnd()]; }; const eatExportName = eatUntil(":};/"); const eatExportValue = eatUntil("};/"); diff --git a/node_modules/webpack/lib/dependencies/ImportMetaContextDependencyParserPlugin.js b/node_modules/webpack/lib/dependencies/ImportMetaContextDependencyParserPlugin.js index 73c24261c..6019bf550 100644 --- a/node_modules/webpack/lib/dependencies/ImportMetaContextDependencyParserPlugin.js +++ b/node_modules/webpack/lib/dependencies/ImportMetaContextDependencyParserPlugin.js @@ -38,7 +38,7 @@ module.exports = class ImportMetaContextDependencyParserPlugin { apply(parser) { parser.hooks.evaluateIdentifier .for("import.meta.webpackContext") - .tap("HotModuleReplacementPlugin", expr => { + .tap("ImportMetaContextDependencyParserPlugin", expr => { return evaluateToIdentifier( "import.meta.webpackContext", "import.meta", diff --git a/node_modules/webpack/lib/dependencies/WorkerPlugin.js b/node_modules/webpack/lib/dependencies/WorkerPlugin.js index cbe732556..5b68d84c0 100644 --- a/node_modules/webpack/lib/dependencies/WorkerPlugin.js +++ b/node_modules/webpack/lib/dependencies/WorkerPlugin.js @@ -190,8 +190,10 @@ class WorkerPlugin { } = arg2 && arg2.type === "ObjectExpression" ? parseObjectExpression(parser, arg2) : { + /** @type {Record} */ expressions: {}, otherElements: [], + /** @type {Record} */ values: {}, spread: false, insertType: arg2 ? "spread" : "argument", diff --git a/node_modules/webpack/lib/ids/IdHelpers.js b/node_modules/webpack/lib/ids/IdHelpers.js index e674a4484..57fa481a9 100644 --- a/node_modules/webpack/lib/ids/IdHelpers.js +++ b/node_modules/webpack/lib/ids/IdHelpers.js @@ -387,7 +387,7 @@ const assignDeterministicIds = ( // max 5% fill rate const optimalRange = Math.min( - Math.ceil(items.length * 20) + extraSpace, + items.length * 20 + extraSpace, Number.MAX_SAFE_INTEGER ); diff --git a/node_modules/webpack/lib/index.js b/node_modules/webpack/lib/index.js index 3db445350..425b5aad5 100644 --- a/node_modules/webpack/lib/index.js +++ b/node_modules/webpack/lib/index.js @@ -495,6 +495,9 @@ module.exports = mergeExports(fn, { wasm: { get AsyncWebAssemblyModulesPlugin() { return require("./wasm-async/AsyncWebAssemblyModulesPlugin"); + }, + get EnableWasmLoadingPlugin() { + return require("./wasm/EnableWasmLoadingPlugin"); } }, diff --git a/node_modules/webpack/lib/runtime/LoadScriptRuntimeModule.js b/node_modules/webpack/lib/runtime/LoadScriptRuntimeModule.js index 00564b9b4..b483e977c 100644 --- a/node_modules/webpack/lib/runtime/LoadScriptRuntimeModule.js +++ b/node_modules/webpack/lib/runtime/LoadScriptRuntimeModule.js @@ -146,8 +146,8 @@ class LoadScriptRuntimeModule extends HelperRuntimeModule { )});`, "if(prev) return prev(event);" ]) - ), - ";", + ) + + ";", `var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), ${loadTimeout});`, "script.onerror = onScriptComplete.bind(null, script.onerror);", "script.onload = onScriptComplete.bind(null, script.onload);", diff --git a/node_modules/webpack/lib/stats/DefaultStatsPrinterPlugin.js b/node_modules/webpack/lib/stats/DefaultStatsPrinterPlugin.js index d6ce97181..71c35e1fe 100644 --- a/node_modules/webpack/lib/stats/DefaultStatsPrinterPlugin.js +++ b/node_modules/webpack/lib/stats/DefaultStatsPrinterPlugin.js @@ -1153,7 +1153,7 @@ const SIMPLE_ELEMENT_JOINERS = { chunkOrigin: items => "> " + joinOneLine(items), "errors[].error": joinError(true), "warnings[].error": joinError(false), - loggingGroup: items => joinExplicitNewLine(items, "").trimRight(), + loggingGroup: items => joinExplicitNewLine(items, "").trimEnd(), moduleTraceItem: items => " @ " + joinOneLine(items), moduleTraceDependency: joinOneLine }; diff --git a/node_modules/webpack/lib/wasm-sync/WebAssemblyParser.js b/node_modules/webpack/lib/wasm-sync/WebAssemblyParser.js index c3078cf1c..e3ea0a814 100644 --- a/node_modules/webpack/lib/wasm-sync/WebAssemblyParser.js +++ b/node_modules/webpack/lib/wasm-sync/WebAssemblyParser.js @@ -17,7 +17,7 @@ const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDe /** @typedef {import("../Parser").ParserState} ParserState */ /** @typedef {import("../Parser").PreparsedAst} PreparsedAst */ -const JS_COMPAT_TYPES = new Set(["i32", "f32", "f64"]); +const JS_COMPAT_TYPES = new Set(["i32", "i64", "f32", "f64"]); /** * @param {t.Signature} signature the func signature diff --git a/node_modules/webpack/package.json b/node_modules/webpack/package.json index 769674d93..112ccc561 100644 --- a/node_modules/webpack/package.json +++ b/node_modules/webpack/package.json @@ -1,6 +1,6 @@ { "name": "webpack", - "version": "5.74.0", + "version": "5.75.0", "author": "Tobias Koppers @sokra", "description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jsx, es7, css, less, ... and your custom stuff.", "license": "MIT", @@ -84,7 +84,7 @@ "mini-svg-data-uri": "^1.2.3", "nyc": "^15.1.0", "open-cli": "^6.0.1", - "prettier": "^2.2.0", + "prettier": "^2.7.1", "pretty-format": "^27.0.2", "pug": "^3.0.0", "pug-loader": "^2.4.0", @@ -98,9 +98,9 @@ "style-loader": "^2.0.0", "terser": "^5.7.0", "toml": "^3.0.0", - "tooling": "webpack/tooling#v1.21.0", + "tooling": "webpack/tooling#v1.22.0", "ts-loader": "^8.0.2", - "typescript": "^4.5.5", + "typescript": "^4.8.4", "url-loader": "^4.1.0", "wast-loader": "^1.11.0", "webassembly-feature": "1.3.0", diff --git a/node_modules/webpack/schemas/WebpackOptions.json b/node_modules/webpack/schemas/WebpackOptions.json index 7cf56fcb6..3b6efb8fd 100644 --- a/node_modules/webpack/schemas/WebpackOptions.json +++ b/node_modules/webpack/schemas/WebpackOptions.json @@ -897,7 +897,10 @@ }, "css": { "description": "Enable css support.", - "oneOf": [ + "anyOf": [ + { + "enum": [false] + }, { "$ref": "#/definitions/CssExperimentOptions" } @@ -913,7 +916,10 @@ }, "lazyCompilation": { "description": "Compile entrypoints and import()s only when they are accessed.", - "oneOf": [ + "anyOf": [ + { + "enum": [false] + }, { "$ref": "#/definitions/LazyCompilationOptions" } diff --git a/node_modules/webpack/types.d.ts b/node_modules/webpack/types.d.ts index d876a7b99..251d0adfd 100644 --- a/node_modules/webpack/types.d.ts +++ b/node_modules/webpack/types.d.ts @@ -731,12 +731,12 @@ declare class Chunk { renderedHash?: string; chunkReason?: string; extraAsync: boolean; - readonly entryModule?: Module; + get entryModule(): Module; hasEntryModule(): boolean; addModule(module: Module): boolean; removeModule(module: Module): void; getNumberOfModules(): number; - readonly modulesIterable: Iterable; + get modulesIterable(): Iterable; compareTo(otherChunk: Chunk): 0 | 1 | -1; containsModule(module: Module): boolean; getModules(): Module[]; @@ -762,7 +762,7 @@ declare class Chunk { removeGroup(chunkGroup: ChunkGroup): void; isInGroup(chunkGroup: ChunkGroup): boolean; getNumberOfGroups(): number; - readonly groupsIterable: Iterable; + get groupsIterable(): Iterable; disconnectFromGroups(): void; split(newChunk: Chunk): void; updateHash(hash: Hash, chunkGraph: ChunkGraph): void; @@ -982,12 +982,12 @@ declare abstract class ChunkGroup { /** * get a uniqueId for ChunkGroup, made up of its member Chunk debugId's */ - readonly debugId: string; + get debugId(): string; /** * get a unique id for ChunkGroup, made up of its member Chunk id's */ - readonly id: string; + get id(): string; /** * Performs an unshift of a specific chunk @@ -1009,20 +1009,20 @@ declare abstract class ChunkGroup { addChild(group: ChunkGroup): boolean; getChildren(): ChunkGroup[]; getNumberOfChildren(): number; - readonly childrenIterable: SortableSet; + get childrenIterable(): SortableSet; removeChild(group: ChunkGroup): boolean; addParent(parentChunk: ChunkGroup): boolean; getParents(): ChunkGroup[]; getNumberOfParents(): number; hasParent(parent: ChunkGroup): boolean; - readonly parentsIterable: SortableSet; + get parentsIterable(): SortableSet; removeParent(chunkGroup: ChunkGroup): boolean; addAsyncEntrypoint(entrypoint: Entrypoint): boolean; - readonly asyncEntrypointsIterable: SortableSet; + get asyncEntrypointsIterable(): SortableSet; getBlocks(): any[]; getNumberOfBlocks(): number; hasBlock(block?: any): boolean; - readonly blocksIterable: Iterable; + get blocksIterable(): Iterable; addBlock(block: AsyncDependenciesBlock): boolean; addOrigin(module: Module, loc: DependencyLocation, request: string): void; getFiles(): string[]; @@ -1175,7 +1175,7 @@ declare abstract class ChunkTemplate { hash: { tap: (options?: any, fn?: any) => void }; hashForChunk: { tap: (options?: any, fn?: any) => void }; }>; - readonly outputOptions: Output; + get outputOptions(): Output; } /** @@ -1492,7 +1492,7 @@ declare class Compilation { >; statsFactory: SyncHook<[StatsFactory, NormalizedStatsOptions]>; statsPrinter: SyncHook<[StatsPrinter, NormalizedStatsOptions]>; - readonly normalModuleLoader: SyncHook<[object, NormalModule]>; + get normalModuleLoader(): SyncHook<[object, NormalModule]>; }>; name?: string; startTime: any; @@ -2653,8 +2653,8 @@ declare class Dependency { constructor(); weak: boolean; optional: boolean; - readonly type: string; - readonly category: string; + get type(): string; + get category(): string; loc: DependencyLocation; setLoc( startLine?: any, @@ -2716,7 +2716,7 @@ declare class Dependency { serialize(__0: { write: any }): void; deserialize(__0: { read: any }): void; module: any; - readonly disconnect: any; + get disconnect(): any; static NO_EXPORTS_REFERENCED: string[][]; static EXPORTS_OBJECT_REFERENCED: string[][]; static TRANSITIVE: typeof TRANSITIVE; @@ -3133,6 +3133,17 @@ declare class EnableLibraryPlugin { static setEnabled(compiler: Compiler, type: string): void; static checkEnabled(compiler: Compiler, type: string): void; } +declare class EnableWasmLoadingPlugin { + constructor(type: string); + type: string; + + /** + * Apply the plugin + */ + apply(compiler: Compiler): void; + static setEnabled(compiler: Compiler, type: string): void; + static checkEnabled(compiler: Compiler, type: string): void; +} type Entry = | string | (() => string | EntryObject | string[] | Promise) @@ -3543,12 +3554,12 @@ declare interface ExperimentsNormalizedExtra { /** * Enable css support. */ - css?: CssExperimentOptions; + css?: false | CssExperimentOptions; /** * Compile entrypoints and import()s only when they are accessed. */ - lazyCompilation?: LazyCompilationOptions; + lazyCompilation?: false | LazyCompilationOptions; } declare abstract class ExportInfo { name: string; @@ -3581,7 +3592,7 @@ declare abstract class ExportInfo { canMangleUse?: boolean; exportsInfoOwned: boolean; exportsInfo?: ExportsInfo; - readonly canMangle?: boolean; + get canMangle(): boolean; setUsedInUnknownWay(runtime: RuntimeSpec): boolean; setUsedWithoutInfo(runtime: RuntimeSpec): boolean; setHasUseInfo(): void; @@ -3702,11 +3713,11 @@ declare interface ExportSpec { } type ExportedVariableInfo = string | ScopeInfo | VariableInfo; declare abstract class ExportsInfo { - readonly ownedExports: Iterable; - readonly orderedOwnedExports: Iterable; - readonly exports: Iterable; - readonly orderedExports: Iterable; - readonly otherExportsInfo: ExportInfo; + get ownedExports(): Iterable; + get orderedOwnedExports(): Iterable; + get exports(): Iterable; + get orderedExports(): Iterable; + get otherExportsInfo(): ExportInfo; setRedirectNamedTo(exportsInfo?: any): boolean; setHasProvideInfo(): void; setHasUseInfo(): void; @@ -4549,12 +4560,12 @@ declare class Hash { constructor(); /** - * Update hash {@link https ://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} + * Update hash {@link https://nodejs.org/api/crypto.html#crypto_hash_update_data_inputencoding} */ update(data: string | Buffer, inputEncoding?: string): Hash; /** - * Calculates the digest {@link https ://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} + * Calculates the digest {@link https://nodejs.org/api/crypto.html#crypto_hash_digest_encoding} */ digest(encoding?: string): string | Buffer; } @@ -6157,7 +6168,7 @@ declare interface LazyCompilationOptions { } declare class LazySet { constructor(iterable?: Iterable); - readonly size: number; + get size(): number; add(item: T): LazySet; addAll(iterable: LazySet | Iterable): LazySet; clear(): void; @@ -6669,9 +6680,9 @@ declare abstract class MainTemplate { localVars: SyncWaterfallHook<[string, Chunk, string]>; requireExtensions: SyncWaterfallHook<[string, Chunk, string]>; requireEnsure: SyncWaterfallHook<[string, Chunk, string, string]>; - readonly jsonpScript: SyncWaterfallHook<[string, Chunk]>; - readonly linkPrefetch: SyncWaterfallHook<[string, Chunk]>; - readonly linkPreload: SyncWaterfallHook<[string, Chunk]>; + get jsonpScript(): SyncWaterfallHook<[string, Chunk]>; + get linkPrefetch(): SyncWaterfallHook<[string, Chunk]>; + get linkPreload(): SyncWaterfallHook<[string, Chunk]>; }>; renderCurrentHashCode: (hash: string, length?: number) => string; getPublicPath: (options: object) => string; @@ -6680,8 +6691,8 @@ declare abstract class MainTemplate { path?: any, options?: any ) => { path: string; info: AssetInfo }; - readonly requireFn: "__webpack_require__"; - readonly outputOptions: Output; + get requireFn(): "__webpack_require__"; + get outputOptions(): Output; } declare interface MapOptions { columns?: boolean; @@ -6756,29 +6767,29 @@ declare class Module extends DependenciesBlock { presentationalDependencies?: Dependency[]; codeGenerationDependencies?: Dependency[]; id: string | number; - readonly hash: string; - readonly renderedHash: string; + get hash(): string; + get renderedHash(): string; profile: null | ModuleProfile; index: number; index2: number; depth: number; issuer: null | Module; - readonly usedExports: null | boolean | SortableSet; - readonly optimizationBailout: ( + get usedExports(): null | boolean | SortableSet; + get optimizationBailout(): ( | string | ((requestShortener: RequestShortener) => string) )[]; - readonly optional: boolean; + get optional(): boolean; addChunk(chunk?: any): boolean; removeChunk(chunk?: any): void; isInChunk(chunk?: any): boolean; isEntryModule(): boolean; getChunks(): Chunk[]; getNumberOfChunks(): number; - readonly chunksIterable: Iterable; + get chunksIterable(): Iterable; isProvided(exportName: string): null | boolean; - readonly exportsArgument: string; - readonly moduleArgument: string; + get exportsArgument(): string; + get moduleArgument(): string; getExportsType( moduleGraph: ModuleGraph, strict: boolean @@ -6872,10 +6883,10 @@ declare class Module extends DependenciesBlock { missingDependencies: LazySet, buildDependencies: LazySet ): void; - readonly hasEqualsChunks: any; - readonly isUsed: any; - readonly errors: any; - readonly warnings: any; + get hasEqualsChunks(): any; + get isUsed(): any; + get errors(): any; + get warnings(): any; used: any; } declare class ModuleConcatenationPlugin { @@ -7144,7 +7155,7 @@ declare class ModuleGraphConnection { ) => ConnectionState ): void; addExplanation(explanation: string): void; - readonly explanation: string; + get explanation(): string; active: void; isActive(runtime: RuntimeSpec): boolean; isTargetActive(runtime: RuntimeSpec): boolean; @@ -7401,7 +7412,7 @@ declare abstract class ModuleTemplate { package: { tap: (options?: any, fn?: any) => void }; hash: { tap: (options?: any, fn?: any) => void }; }>; - readonly runtimeTemplate: any; + get runtimeTemplate(): any; } declare class MultiCompiler { constructor( @@ -7419,8 +7430,8 @@ declare class MultiCompiler { compilers: Compiler[]; dependencies: WeakMap; running: boolean; - readonly options: WebpackOptionsNormalized[] & MultiCompilerOptions; - readonly outputPath: string; + get options(): WebpackOptionsNormalized[] & MultiCompilerOptions; + get outputPath(): string; inputFileSystem: InputFileSystem; outputFileSystem: OutputFileSystem; watchFileSystem: WatchFileSystem; @@ -7449,7 +7460,7 @@ declare interface MultiCompilerOptions { } declare abstract class MultiStats { stats: Stats[]; - readonly hash: string; + get hash(): string; hasErrors(): boolean; hasWarnings(): boolean; toJson(options?: any): StatsCompilation; @@ -10378,13 +10389,13 @@ declare class RuntimeSpecMap { update(runtime?: any, fn?: any): void; keys(): RuntimeSpec[]; values(): IterableIterator; - readonly size?: number; + get size(): number; } declare class RuntimeSpecSet { constructor(iterable?: any); add(runtime?: any): void; has(runtime?: any): boolean; - readonly size: number; + get size(): number; [Symbol.iterator](): IterableIterator; } declare abstract class RuntimeTemplate { @@ -10809,7 +10820,7 @@ declare abstract class RuntimeValue { readonly version?: string; }) => CodeValuePrimitive; options: true | RuntimeValueOptions; - readonly fileDependencies?: true | string[]; + get fileDependencies(): true | string[]; exec( parser: JavascriptParser, valueCacheVersions: Map>, @@ -11262,7 +11273,7 @@ declare abstract class StackedMap { asSet(): Set; asPairArray(): [K, Cell][]; asMap(): Map>; - readonly size: number; + get size(): number; createChild(): StackedMap; } type StartupRenderContext = RenderContext & { inlined: boolean }; @@ -11292,9 +11303,9 @@ type Statement = declare class Stats { constructor(compilation: Compilation); compilation: Compilation; - readonly hash?: string; - readonly startTime: any; - readonly endTime: any; + get hash(): string; + get startTime(): any; + get endTime(): any; hasWarnings(): boolean; hasErrors(): boolean; toJson(options?: string | StatsOptions): StatsCompilation; @@ -11835,7 +11846,7 @@ declare class SyncModuleIdsPlugin { /** * operation mode (defaults to merge) */ - mode?: "read" | "create" | "merge" | "update"; + mode?: "read" | "merge" | "create" | "update"; }); /** @@ -12686,75 +12697,75 @@ declare namespace exports { export let matchObject: (obj?: any, str?: any) => boolean; } export namespace RuntimeGlobals { - export let require: string; - export let requireScope: string; - export let exports: string; - export let thisAsExports: string; - export let returnExportsFromRuntime: string; - export let module: string; - export let moduleId: string; - export let moduleLoaded: string; - export let publicPath: string; - export let entryModuleId: string; - export let moduleCache: string; - export let moduleFactories: string; - export let moduleFactoriesAddOnly: string; - export let ensureChunk: string; - export let ensureChunkHandlers: string; - export let ensureChunkIncludeEntries: string; - export let prefetchChunk: string; - export let prefetchChunkHandlers: string; - export let preloadChunk: string; - export let preloadChunkHandlers: string; - export let definePropertyGetters: string; - export let makeNamespaceObject: string; - export let createFakeNamespaceObject: string; - export let compatGetDefaultExport: string; - export let harmonyModuleDecorator: string; - export let nodeModuleDecorator: string; - export let getFullHash: string; - export let wasmInstances: string; - export let instantiateWasm: string; - export let uncaughtErrorHandler: string; - export let scriptNonce: string; - export let loadScript: string; - export let createScript: string; - export let createScriptUrl: string; - export let getTrustedTypesPolicy: string; - export let chunkName: string; - export let runtimeId: string; - export let getChunkScriptFilename: string; - export let getChunkCssFilename: string; - export let hasCssModules: string; - export let getChunkUpdateScriptFilename: string; - export let getChunkUpdateCssFilename: string; - export let startup: string; - export let startupNoDefault: string; - export let startupOnlyAfter: string; - export let startupOnlyBefore: string; - export let chunkCallback: string; - export let startupEntrypoint: string; - export let onChunksLoaded: string; - export let externalInstallChunk: string; - export let interceptModuleExecution: string; - export let global: string; - export let shareScopeMap: string; - export let initializeSharing: string; - export let currentRemoteGetScope: string; - export let getUpdateManifestFilename: string; - export let hmrDownloadManifest: string; - export let hmrDownloadUpdateHandlers: string; - export let hmrModuleData: string; - export let hmrInvalidateModuleHandlers: string; - export let hmrRuntimeStatePrefix: string; - export let amdDefine: string; - export let amdOptions: string; - export let system: string; - export let hasOwnProperty: string; - export let systemContext: string; - export let baseURI: string; - export let relativeUrl: string; - export let asyncModule: string; + export let require: "__webpack_require__"; + export let requireScope: "__webpack_require__.*"; + export let exports: "__webpack_exports__"; + export let thisAsExports: "top-level-this-exports"; + export let returnExportsFromRuntime: "return-exports-from-runtime"; + export let module: "module"; + export let moduleId: "module.id"; + export let moduleLoaded: "module.loaded"; + export let publicPath: "__webpack_require__.p"; + export let entryModuleId: "__webpack_require__.s"; + export let moduleCache: "__webpack_require__.c"; + export let moduleFactories: "__webpack_require__.m"; + export let moduleFactoriesAddOnly: "__webpack_require__.m (add only)"; + export let ensureChunk: "__webpack_require__.e"; + export let ensureChunkHandlers: "__webpack_require__.f"; + export let ensureChunkIncludeEntries: "__webpack_require__.f (include entries)"; + export let prefetchChunk: "__webpack_require__.E"; + export let prefetchChunkHandlers: "__webpack_require__.F"; + export let preloadChunk: "__webpack_require__.G"; + export let preloadChunkHandlers: "__webpack_require__.H"; + export let definePropertyGetters: "__webpack_require__.d"; + export let makeNamespaceObject: "__webpack_require__.r"; + export let createFakeNamespaceObject: "__webpack_require__.t"; + export let compatGetDefaultExport: "__webpack_require__.n"; + export let harmonyModuleDecorator: "__webpack_require__.hmd"; + export let nodeModuleDecorator: "__webpack_require__.nmd"; + export let getFullHash: "__webpack_require__.h"; + export let wasmInstances: "__webpack_require__.w"; + export let instantiateWasm: "__webpack_require__.v"; + export let uncaughtErrorHandler: "__webpack_require__.oe"; + export let scriptNonce: "__webpack_require__.nc"; + export let loadScript: "__webpack_require__.l"; + export let createScript: "__webpack_require__.ts"; + export let createScriptUrl: "__webpack_require__.tu"; + export let getTrustedTypesPolicy: "__webpack_require__.tt"; + export let chunkName: "__webpack_require__.cn"; + export let runtimeId: "__webpack_require__.j"; + export let getChunkScriptFilename: "__webpack_require__.u"; + export let getChunkCssFilename: "__webpack_require__.k"; + export let hasCssModules: "has css modules"; + export let getChunkUpdateScriptFilename: "__webpack_require__.hu"; + export let getChunkUpdateCssFilename: "__webpack_require__.hk"; + export let startup: "__webpack_require__.x"; + export let startupNoDefault: "__webpack_require__.x (no default handler)"; + export let startupOnlyAfter: "__webpack_require__.x (only after)"; + export let startupOnlyBefore: "__webpack_require__.x (only before)"; + export let chunkCallback: "webpackChunk"; + export let startupEntrypoint: "__webpack_require__.X"; + export let onChunksLoaded: "__webpack_require__.O"; + export let externalInstallChunk: "__webpack_require__.C"; + export let interceptModuleExecution: "__webpack_require__.i"; + export let global: "__webpack_require__.g"; + export let shareScopeMap: "__webpack_require__.S"; + export let initializeSharing: "__webpack_require__.I"; + export let currentRemoteGetScope: "__webpack_require__.R"; + export let getUpdateManifestFilename: "__webpack_require__.hmrF"; + export let hmrDownloadManifest: "__webpack_require__.hmrM"; + export let hmrDownloadUpdateHandlers: "__webpack_require__.hmrC"; + export let hmrModuleData: "__webpack_require__.hmrD"; + export let hmrInvalidateModuleHandlers: "__webpack_require__.hmrI"; + export let hmrRuntimeStatePrefix: "__webpack_require__.hmrS"; + export let amdDefine: "__webpack_require__.amdD"; + export let amdOptions: "__webpack_require__.amdO"; + export let system: "__webpack_require__.System"; + export let hasOwnProperty: "__webpack_require__.o"; + export let systemContext: "__webpack_require__.y"; + export let baseURI: "__webpack_require__.b"; + export let relativeUrl: "__webpack_require__.U"; + export let asyncModule: "__webpack_require__.a"; } export const UsageState: Readonly<{ Unused: 0; @@ -12891,7 +12902,7 @@ declare namespace exports { export { ElectronTargetPlugin }; } export namespace wasm { - export { AsyncWebAssemblyModulesPlugin }; + export { AsyncWebAssemblyModulesPlugin, EnableWasmLoadingPlugin }; } export namespace library { export { AbstractLibraryPlugin, EnableLibraryPlugin }; diff --git a/node_modules/yaml/LICENSE b/node_modules/yaml/LICENSE deleted file mode 100644 index 7ca44e3ff..000000000 --- a/node_modules/yaml/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2018 Eemeli Aro - -Permission to use, copy, modify, and/or distribute this software for any purpose -with or without fee is hereby granted, provided that the above copyright notice -and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF -THIS SOFTWARE. diff --git a/node_modules/yaml/README.md b/node_modules/yaml/README.md deleted file mode 100644 index 2c51aea2a..000000000 --- a/node_modules/yaml/README.md +++ /dev/null @@ -1,127 +0,0 @@ -# YAML - -`yaml` is a JavaScript parser and stringifier for [YAML](http://yaml.org/), a human friendly data serialization standard. It supports both parsing and stringifying data using all versions of YAML, along with all common data schemas. As a particularly distinguishing feature, `yaml` fully supports reading and writing comments and blank lines in YAML documents. - -The library is released under the ISC open source license, and the code is [available on GitHub](https://github.com/eemeli/yaml/). It has no external dependencies and runs on Node.js 6 and later, and in browsers from IE 11 upwards. - -For the purposes of versioning, any changes that break any of the endpoints or APIs documented here will be considered semver-major breaking changes. Undocumented library internals may change between minor versions, and previous APIs may be deprecated (but not removed). - -For more information, see the project's documentation site: [**eemeli.org/yaml/v1**](https://eemeli.org/yaml/v1/) - -To install: - -```sh -npm install yaml -``` - -**Note:** This is `yaml@1`. You may also be interested in the next version, currently available as [`yaml@next`](https://www.npmjs.com/package/yaml/v/next). - -## API Overview - -The API provided by `yaml` has three layers, depending on how deep you need to go: [Parse & Stringify](https://eemeli.org/yaml/v1/#parse-amp-stringify), [Documents](https://eemeli.org/yaml/#documents), and the [CST Parser](https://eemeli.org/yaml/#cst-parser). The first has the simplest API and "just works", the second gets you all the bells and whistles supported by the library along with a decent [AST](https://eemeli.org/yaml/#content-nodes), and the third is the closest to YAML source, making it fast, raw, and crude. - -```js -import YAML from 'yaml' -// or -const YAML = require('yaml') -``` - -### Parse & Stringify - -- [`YAML.parse(str, options): value`](https://eemeli.org/yaml/v1/#yaml-parse) -- [`YAML.stringify(value, options): string`](https://eemeli.org/yaml/v1/#yaml-stringify) - -### YAML Documents - -- [`YAML.createNode(value, wrapScalars, tag): Node`](https://eemeli.org/yaml/v1/#creating-nodes) -- [`YAML.defaultOptions`](https://eemeli.org/yaml/v1/#options) -- [`YAML.Document`](https://eemeli.org/yaml/v1/#yaml-documents) - - [`constructor(options)`](https://eemeli.org/yaml/v1/#creating-documents) - - [`defaults`](https://eemeli.org/yaml/v1/#options) - - [`#anchors`](https://eemeli.org/yaml/v1/#working-with-anchors) - - [`#contents`](https://eemeli.org/yaml/v1/#content-nodes) - - [`#errors`](https://eemeli.org/yaml/v1/#errors) -- [`YAML.parseAllDocuments(str, options): YAML.Document[]`](https://eemeli.org/yaml/v1/#parsing-documents) -- [`YAML.parseDocument(str, options): YAML.Document`](https://eemeli.org/yaml/v1/#parsing-documents) - -```js -import { Pair, YAMLMap, YAMLSeq } from 'yaml/types' -``` - -- [`new Pair(key, value)`](https://eemeli.org/yaml/v1/#creating-nodes) -- [`new YAMLMap()`](https://eemeli.org/yaml/v1/#creating-nodes) -- [`new YAMLSeq()`](https://eemeli.org/yaml/v1/#creating-nodes) - -### CST Parser - -```js -import parseCST from 'yaml/parse-cst' -``` - -- [`parseCST(str): CSTDocument[]`](https://eemeli.org/yaml/v1/#parsecst) -- [`YAML.parseCST(str): CSTDocument[]`](https://eemeli.org/yaml/v1/#parsecst) - -## YAML.parse - -```yaml -# file.yml -YAML: - - A human-readable data serialization language - - https://en.wikipedia.org/wiki/YAML -yaml: - - A complete JavaScript implementation - - https://www.npmjs.com/package/yaml -``` - -```js -import fs from 'fs' -import YAML from 'yaml' - -YAML.parse('3.14159') -// 3.14159 - -YAML.parse('[ true, false, maybe, null ]\n') -// [ true, false, 'maybe', null ] - -const file = fs.readFileSync('./file.yml', 'utf8') -YAML.parse(file) -// { YAML: -// [ 'A human-readable data serialization language', -// 'https://en.wikipedia.org/wiki/YAML' ], -// yaml: -// [ 'A complete JavaScript implementation', -// 'https://www.npmjs.com/package/yaml' ] } -``` - -## YAML.stringify - -```js -import YAML from 'yaml' - -YAML.stringify(3.14159) -// '3.14159\n' - -YAML.stringify([true, false, 'maybe', null]) -// `- true -// - false -// - maybe -// - null -// ` - -YAML.stringify({ number: 3, plain: 'string', block: 'two\nlines\n' }) -// `number: 3 -// plain: string -// block: > -// two -// -// lines -// ` -``` - ---- - -Browser testing provided by: - - - - diff --git a/node_modules/yaml/browser/dist/PlainValue-b8036b75.js b/node_modules/yaml/browser/dist/PlainValue-b8036b75.js deleted file mode 100644 index 2a4255a29..000000000 --- a/node_modules/yaml/browser/dist/PlainValue-b8036b75.js +++ /dev/null @@ -1,1275 +0,0 @@ -function _typeof(obj) { - "@babel/helpers - typeof"; - - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - _typeof = function (obj) { - return typeof obj; - }; - } else { - _typeof = function (obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } - - return _typeof(obj); -} - -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } -} - -function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } -} - -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; -} - -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; -} - -function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - if (superClass) _setPrototypeOf(subClass, superClass); -} - -function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); -} - -function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - return _setPrototypeOf(o, p); -} - -function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) return false; - if (Reflect.construct.sham) return false; - if (typeof Proxy === "function") return true; - - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); - return true; - } catch (e) { - return false; - } -} - -function _construct(Parent, args, Class) { - if (_isNativeReflectConstruct()) { - _construct = Reflect.construct; - } else { - _construct = function _construct(Parent, args, Class) { - var a = [null]; - a.push.apply(a, args); - var Constructor = Function.bind.apply(Parent, a); - var instance = new Constructor(); - if (Class) _setPrototypeOf(instance, Class.prototype); - return instance; - }; - } - - return _construct.apply(null, arguments); -} - -function _isNativeFunction(fn) { - return Function.toString.call(fn).indexOf("[native code]") !== -1; -} - -function _wrapNativeSuper(Class) { - var _cache = typeof Map === "function" ? new Map() : undefined; - - _wrapNativeSuper = function _wrapNativeSuper(Class) { - if (Class === null || !_isNativeFunction(Class)) return Class; - - if (typeof Class !== "function") { - throw new TypeError("Super expression must either be null or a function"); - } - - if (typeof _cache !== "undefined") { - if (_cache.has(Class)) return _cache.get(Class); - - _cache.set(Class, Wrapper); - } - - function Wrapper() { - return _construct(Class, arguments, _getPrototypeOf(this).constructor); - } - - Wrapper.prototype = Object.create(Class.prototype, { - constructor: { - value: Wrapper, - enumerable: false, - writable: true, - configurable: true - } - }); - return _setPrototypeOf(Wrapper, Class); - }; - - return _wrapNativeSuper(Class); -} - -function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return self; -} - -function _possibleConstructorReturn(self, call) { - if (call && (typeof call === "object" || typeof call === "function")) { - return call; - } - - return _assertThisInitialized(self); -} - -function _createSuper(Derived) { - var hasNativeReflectConstruct = _isNativeReflectConstruct(); - - return function _createSuperInternal() { - var Super = _getPrototypeOf(Derived), - result; - - if (hasNativeReflectConstruct) { - var NewTarget = _getPrototypeOf(this).constructor; - - result = Reflect.construct(Super, arguments, NewTarget); - } else { - result = Super.apply(this, arguments); - } - - return _possibleConstructorReturn(this, result); - }; -} - -function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = _getPrototypeOf(object); - if (object === null) break; - } - - return object; -} - -function _get(target, property, receiver) { - if (typeof Reflect !== "undefined" && Reflect.get) { - _get = Reflect.get; - } else { - _get = function _get(target, property, receiver) { - var base = _superPropBase(target, property); - - if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property); - - if (desc.get) { - return desc.get.call(receiver); - } - - return desc.value; - }; - } - - return _get(target, property, receiver || target); -} - -function _slicedToArray(arr, i) { - return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); -} - -function _toArray(arr) { - return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); -} - -function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; -} - -function _iterableToArray(iter) { - if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); -} - -function _iterableToArrayLimit(arr, i) { - if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; - - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; -} - -function _unsupportedIterableToArray(o, minLen) { - if (!o) return; - if (typeof o === "string") return _arrayLikeToArray(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); -} - -function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; - - for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; - - return arr2; -} - -function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); -} - -function _createForOfIteratorHelper(o, allowArrayLike) { - var it; - - if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { - if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { - if (it) o = it; - var i = 0; - - var F = function () {}; - - return { - s: F, - n: function () { - if (i >= o.length) return { - done: true - }; - return { - done: false, - value: o[i++] - }; - }, - e: function (e) { - throw e; - }, - f: F - }; - } - - throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - - var normalCompletion = true, - didErr = false, - err; - return { - s: function () { - it = o[Symbol.iterator](); - }, - n: function () { - var step = it.next(); - normalCompletion = step.done; - return step; - }, - e: function (e) { - didErr = true; - err = e; - }, - f: function () { - try { - if (!normalCompletion && it.return != null) it.return(); - } finally { - if (didErr) throw err; - } - } - }; -} - -var Char = { - ANCHOR: '&', - COMMENT: '#', - TAG: '!', - DIRECTIVES_END: '-', - DOCUMENT_END: '.' -}; -var Type = { - ALIAS: 'ALIAS', - BLANK_LINE: 'BLANK_LINE', - BLOCK_FOLDED: 'BLOCK_FOLDED', - BLOCK_LITERAL: 'BLOCK_LITERAL', - COMMENT: 'COMMENT', - DIRECTIVE: 'DIRECTIVE', - DOCUMENT: 'DOCUMENT', - FLOW_MAP: 'FLOW_MAP', - FLOW_SEQ: 'FLOW_SEQ', - MAP: 'MAP', - MAP_KEY: 'MAP_KEY', - MAP_VALUE: 'MAP_VALUE', - PLAIN: 'PLAIN', - QUOTE_DOUBLE: 'QUOTE_DOUBLE', - QUOTE_SINGLE: 'QUOTE_SINGLE', - SEQ: 'SEQ', - SEQ_ITEM: 'SEQ_ITEM' -}; -var defaultTagPrefix = 'tag:yaml.org,2002:'; -var defaultTags = { - MAP: 'tag:yaml.org,2002:map', - SEQ: 'tag:yaml.org,2002:seq', - STR: 'tag:yaml.org,2002:str' -}; - -function findLineStarts(src) { - var ls = [0]; - var offset = src.indexOf('\n'); - - while (offset !== -1) { - offset += 1; - ls.push(offset); - offset = src.indexOf('\n', offset); - } - - return ls; -} - -function getSrcInfo(cst) { - var lineStarts, src; - - if (typeof cst === 'string') { - lineStarts = findLineStarts(cst); - src = cst; - } else { - if (Array.isArray(cst)) cst = cst[0]; - - if (cst && cst.context) { - if (!cst.lineStarts) cst.lineStarts = findLineStarts(cst.context.src); - lineStarts = cst.lineStarts; - src = cst.context.src; - } - } - - return { - lineStarts: lineStarts, - src: src - }; -} -/** - * @typedef {Object} LinePos - One-indexed position in the source - * @property {number} line - * @property {number} col - */ - -/** - * Determine the line/col position matching a character offset. - * - * Accepts a source string or a CST document as the second parameter. With - * the latter, starting indices for lines are cached in the document as - * `lineStarts: number[]`. - * - * Returns a one-indexed `{ line, col }` location if found, or - * `undefined` otherwise. - * - * @param {number} offset - * @param {string|Document|Document[]} cst - * @returns {?LinePos} - */ - - -function getLinePos(offset, cst) { - if (typeof offset !== 'number' || offset < 0) return null; - - var _getSrcInfo = getSrcInfo(cst), - lineStarts = _getSrcInfo.lineStarts, - src = _getSrcInfo.src; - - if (!lineStarts || !src || offset > src.length) return null; - - for (var i = 0; i < lineStarts.length; ++i) { - var start = lineStarts[i]; - - if (offset < start) { - return { - line: i, - col: offset - lineStarts[i - 1] + 1 - }; - } - - if (offset === start) return { - line: i + 1, - col: 1 - }; - } - - var line = lineStarts.length; - return { - line: line, - col: offset - lineStarts[line - 1] + 1 - }; -} -/** - * Get a specified line from the source. - * - * Accepts a source string or a CST document as the second parameter. With - * the latter, starting indices for lines are cached in the document as - * `lineStarts: number[]`. - * - * Returns the line as a string if found, or `null` otherwise. - * - * @param {number} line One-indexed line number - * @param {string|Document|Document[]} cst - * @returns {?string} - */ - -function getLine(line, cst) { - var _getSrcInfo2 = getSrcInfo(cst), - lineStarts = _getSrcInfo2.lineStarts, - src = _getSrcInfo2.src; - - if (!lineStarts || !(line >= 1) || line > lineStarts.length) return null; - var start = lineStarts[line - 1]; - var end = lineStarts[line]; // undefined for last line; that's ok for slice() - - while (end && end > start && src[end - 1] === '\n') { - --end; - } - - return src.slice(start, end); -} -/** - * Pretty-print the starting line from the source indicated by the range `pos` - * - * Trims output to `maxWidth` chars while keeping the starting column visible, - * using `…` at either end to indicate dropped characters. - * - * Returns a two-line string (or `null`) with `\n` as separator; the second line - * will hold appropriately indented `^` marks indicating the column range. - * - * @param {Object} pos - * @param {LinePos} pos.start - * @param {LinePos} [pos.end] - * @param {string|Document|Document[]*} cst - * @param {number} [maxWidth=80] - * @returns {?string} - */ - -function getPrettyContext(_ref, cst) { - var start = _ref.start, - end = _ref.end; - var maxWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 80; - var src = getLine(start.line, cst); - if (!src) return null; - var col = start.col; - - if (src.length > maxWidth) { - if (col <= maxWidth - 10) { - src = src.substr(0, maxWidth - 1) + '…'; - } else { - var halfWidth = Math.round(maxWidth / 2); - if (src.length > col + halfWidth) src = src.substr(0, col + halfWidth - 1) + '…'; - col -= src.length - maxWidth; - src = '…' + src.substr(1 - maxWidth); - } - } - - var errLen = 1; - var errEnd = ''; - - if (end) { - if (end.line === start.line && col + (end.col - start.col) <= maxWidth + 1) { - errLen = end.col - start.col; - } else { - errLen = Math.min(src.length + 1, maxWidth) - col; - errEnd = '…'; - } - } - - var offset = col > 1 ? ' '.repeat(col - 1) : ''; - var err = '^'.repeat(errLen); - return "".concat(src, "\n").concat(offset).concat(err).concat(errEnd); -} - -var Range = /*#__PURE__*/function () { - function Range(start, end) { - _classCallCheck(this, Range); - - this.start = start; - this.end = end || start; - } - - _createClass(Range, [{ - key: "isEmpty", - value: function isEmpty() { - return typeof this.start !== 'number' || !this.end || this.end <= this.start; - } - /** - * Set `origStart` and `origEnd` to point to the original source range for - * this node, which may differ due to dropped CR characters. - * - * @param {number[]} cr - Positions of dropped CR characters - * @param {number} offset - Starting index of `cr` from the last call - * @returns {number} - The next offset, matching the one found for `origStart` - */ - - }, { - key: "setOrigRange", - value: function setOrigRange(cr, offset) { - var start = this.start, - end = this.end; - - if (cr.length === 0 || end <= cr[0]) { - this.origStart = start; - this.origEnd = end; - return offset; - } - - var i = offset; - - while (i < cr.length) { - if (cr[i] > start) break;else ++i; - } - - this.origStart = start + i; - var nextOffset = i; - - while (i < cr.length) { - // if end was at \n, it should now be at \r - if (cr[i] >= end) break;else ++i; - } - - this.origEnd = end + i; - return nextOffset; - } - }], [{ - key: "copy", - value: function copy(orig) { - return new Range(orig.start, orig.end); - } - }]); - - return Range; -}(); - -/** Root class of all nodes */ - -var Node = /*#__PURE__*/function () { - function Node(type, props, context) { - _classCallCheck(this, Node); - - Object.defineProperty(this, 'context', { - value: context || null, - writable: true - }); - this.error = null; - this.range = null; - this.valueRange = null; - this.props = props || []; - this.type = type; - this.value = null; - } - - _createClass(Node, [{ - key: "getPropValue", - value: function getPropValue(idx, key, skipKey) { - if (!this.context) return null; - var src = this.context.src; - var prop = this.props[idx]; - return prop && src[prop.start] === key ? src.slice(prop.start + (skipKey ? 1 : 0), prop.end) : null; - } - }, { - key: "anchor", - get: function get() { - for (var i = 0; i < this.props.length; ++i) { - var anchor = this.getPropValue(i, Char.ANCHOR, true); - if (anchor != null) return anchor; - } - - return null; - } - }, { - key: "comment", - get: function get() { - var comments = []; - - for (var i = 0; i < this.props.length; ++i) { - var comment = this.getPropValue(i, Char.COMMENT, true); - if (comment != null) comments.push(comment); - } - - return comments.length > 0 ? comments.join('\n') : null; - } - }, { - key: "commentHasRequiredWhitespace", - value: function commentHasRequiredWhitespace(start) { - var src = this.context.src; - if (this.header && start === this.header.end) return false; - if (!this.valueRange) return false; - var end = this.valueRange.end; - return start !== end || Node.atBlank(src, end - 1); - } - }, { - key: "hasComment", - get: function get() { - if (this.context) { - var src = this.context.src; - - for (var i = 0; i < this.props.length; ++i) { - if (src[this.props[i].start] === Char.COMMENT) return true; - } - } - - return false; - } - }, { - key: "hasProps", - get: function get() { - if (this.context) { - var src = this.context.src; - - for (var i = 0; i < this.props.length; ++i) { - if (src[this.props[i].start] !== Char.COMMENT) return true; - } - } - - return false; - } - }, { - key: "includesTrailingLines", - get: function get() { - return false; - } - }, { - key: "jsonLike", - get: function get() { - var jsonLikeTypes = [Type.FLOW_MAP, Type.FLOW_SEQ, Type.QUOTE_DOUBLE, Type.QUOTE_SINGLE]; - return jsonLikeTypes.indexOf(this.type) !== -1; - } - }, { - key: "rangeAsLinePos", - get: function get() { - if (!this.range || !this.context) return undefined; - var start = getLinePos(this.range.start, this.context.root); - if (!start) return undefined; - var end = getLinePos(this.range.end, this.context.root); - return { - start: start, - end: end - }; - } - }, { - key: "rawValue", - get: function get() { - if (!this.valueRange || !this.context) return null; - var _this$valueRange = this.valueRange, - start = _this$valueRange.start, - end = _this$valueRange.end; - return this.context.src.slice(start, end); - } - }, { - key: "tag", - get: function get() { - for (var i = 0; i < this.props.length; ++i) { - var tag = this.getPropValue(i, Char.TAG, false); - - if (tag != null) { - if (tag[1] === '<') { - return { - verbatim: tag.slice(2, -1) - }; - } else { - // eslint-disable-next-line no-unused-vars - var _tag$match = tag.match(/^(.*!)([^!]*)$/), - _tag$match2 = _slicedToArray(_tag$match, 3); - _tag$match2[0]; - var handle = _tag$match2[1], - suffix = _tag$match2[2]; - - return { - handle: handle, - suffix: suffix - }; - } - } - } - - return null; - } - }, { - key: "valueRangeContainsNewline", - get: function get() { - if (!this.valueRange || !this.context) return false; - var _this$valueRange2 = this.valueRange, - start = _this$valueRange2.start, - end = _this$valueRange2.end; - var src = this.context.src; - - for (var i = start; i < end; ++i) { - if (src[i] === '\n') return true; - } - - return false; - } - }, { - key: "parseComment", - value: function parseComment(start) { - var src = this.context.src; - - if (src[start] === Char.COMMENT) { - var end = Node.endOfLine(src, start + 1); - var commentRange = new Range(start, end); - this.props.push(commentRange); - return end; - } - - return start; - } - /** - * Populates the `origStart` and `origEnd` values of all ranges for this - * node. Extended by child classes to handle descendant nodes. - * - * @param {number[]} cr - Positions of dropped CR characters - * @param {number} offset - Starting index of `cr` from the last call - * @returns {number} - The next offset, matching the one found for `origStart` - */ - - }, { - key: "setOrigRanges", - value: function setOrigRanges(cr, offset) { - if (this.range) offset = this.range.setOrigRange(cr, offset); - if (this.valueRange) this.valueRange.setOrigRange(cr, offset); - this.props.forEach(function (prop) { - return prop.setOrigRange(cr, offset); - }); - return offset; - } - }, { - key: "toString", - value: function toString() { - var src = this.context.src, - range = this.range, - value = this.value; - if (value != null) return value; - var str = src.slice(range.start, range.end); - return Node.addStringTerminator(src, range.end, str); - } - }], [{ - key: "addStringTerminator", - value: function addStringTerminator(src, offset, str) { - if (str[str.length - 1] === '\n') return str; - var next = Node.endOfWhiteSpace(src, offset); - return next >= src.length || src[next] === '\n' ? str + '\n' : str; - } // ^(---|...) - - }, { - key: "atDocumentBoundary", - value: function atDocumentBoundary(src, offset, sep) { - var ch0 = src[offset]; - if (!ch0) return true; - var prev = src[offset - 1]; - if (prev && prev !== '\n') return false; - - if (sep) { - if (ch0 !== sep) return false; - } else { - if (ch0 !== Char.DIRECTIVES_END && ch0 !== Char.DOCUMENT_END) return false; - } - - var ch1 = src[offset + 1]; - var ch2 = src[offset + 2]; - if (ch1 !== ch0 || ch2 !== ch0) return false; - var ch3 = src[offset + 3]; - return !ch3 || ch3 === '\n' || ch3 === '\t' || ch3 === ' '; - } - }, { - key: "endOfIdentifier", - value: function endOfIdentifier(src, offset) { - var ch = src[offset]; - var isVerbatim = ch === '<'; - var notOk = isVerbatim ? ['\n', '\t', ' ', '>'] : ['\n', '\t', ' ', '[', ']', '{', '}', ',']; - - while (ch && notOk.indexOf(ch) === -1) { - ch = src[offset += 1]; - } - - if (isVerbatim && ch === '>') offset += 1; - return offset; - } - }, { - key: "endOfIndent", - value: function endOfIndent(src, offset) { - var ch = src[offset]; - - while (ch === ' ') { - ch = src[offset += 1]; - } - - return offset; - } - }, { - key: "endOfLine", - value: function endOfLine(src, offset) { - var ch = src[offset]; - - while (ch && ch !== '\n') { - ch = src[offset += 1]; - } - - return offset; - } - }, { - key: "endOfWhiteSpace", - value: function endOfWhiteSpace(src, offset) { - var ch = src[offset]; - - while (ch === '\t' || ch === ' ') { - ch = src[offset += 1]; - } - - return offset; - } - }, { - key: "startOfLine", - value: function startOfLine(src, offset) { - var ch = src[offset - 1]; - if (ch === '\n') return offset; - - while (ch && ch !== '\n') { - ch = src[offset -= 1]; - } - - return offset + 1; - } - /** - * End of indentation, or null if the line's indent level is not more - * than `indent` - * - * @param {string} src - * @param {number} indent - * @param {number} lineStart - * @returns {?number} - */ - - }, { - key: "endOfBlockIndent", - value: function endOfBlockIndent(src, indent, lineStart) { - var inEnd = Node.endOfIndent(src, lineStart); - - if (inEnd > lineStart + indent) { - return inEnd; - } else { - var wsEnd = Node.endOfWhiteSpace(src, inEnd); - var ch = src[wsEnd]; - if (!ch || ch === '\n') return wsEnd; - } - - return null; - } - }, { - key: "atBlank", - value: function atBlank(src, offset, endAsBlank) { - var ch = src[offset]; - return ch === '\n' || ch === '\t' || ch === ' ' || endAsBlank && !ch; - } - }, { - key: "nextNodeIsIndented", - value: function nextNodeIsIndented(ch, indentDiff, indicatorAsIndent) { - if (!ch || indentDiff < 0) return false; - if (indentDiff > 0) return true; - return indicatorAsIndent && ch === '-'; - } // should be at line or string end, or at next non-whitespace char - - }, { - key: "normalizeOffset", - value: function normalizeOffset(src, offset) { - var ch = src[offset]; - return !ch ? offset : ch !== '\n' && src[offset - 1] === '\n' ? offset - 1 : Node.endOfWhiteSpace(src, offset); - } // fold single newline into space, multiple newlines to N - 1 newlines - // presumes src[offset] === '\n' - - }, { - key: "foldNewline", - value: function foldNewline(src, offset, indent) { - var inCount = 0; - var error = false; - var fold = ''; - var ch = src[offset + 1]; - - while (ch === ' ' || ch === '\t' || ch === '\n') { - switch (ch) { - case '\n': - inCount = 0; - offset += 1; - fold += '\n'; - break; - - case '\t': - if (inCount <= indent) error = true; - offset = Node.endOfWhiteSpace(src, offset + 2) - 1; - break; - - case ' ': - inCount += 1; - offset += 1; - break; - } - - ch = src[offset + 1]; - } - - if (!fold) fold = ' '; - if (ch && inCount <= indent) error = true; - return { - fold: fold, - offset: offset, - error: error - }; - } - }]); - - return Node; -}(); - -var YAMLError = /*#__PURE__*/function (_Error) { - _inherits(YAMLError, _Error); - - var _super = _createSuper(YAMLError); - - function YAMLError(name, source, message) { - var _this; - - _classCallCheck(this, YAMLError); - - if (!message || !(source instanceof Node)) throw new Error("Invalid arguments for new ".concat(name)); - _this = _super.call(this); - _this.name = name; - _this.message = message; - _this.source = source; - return _this; - } - - _createClass(YAMLError, [{ - key: "makePretty", - value: function makePretty() { - if (!this.source) return; - this.nodeType = this.source.type; - var cst = this.source.context && this.source.context.root; - - if (typeof this.offset === 'number') { - this.range = new Range(this.offset, this.offset + 1); - var start = cst && getLinePos(this.offset, cst); - - if (start) { - var end = { - line: start.line, - col: start.col + 1 - }; - this.linePos = { - start: start, - end: end - }; - } - - delete this.offset; - } else { - this.range = this.source.range; - this.linePos = this.source.rangeAsLinePos; - } - - if (this.linePos) { - var _this$linePos$start = this.linePos.start, - line = _this$linePos$start.line, - col = _this$linePos$start.col; - this.message += " at line ".concat(line, ", column ").concat(col); - var ctx = cst && getPrettyContext(this.linePos, cst); - if (ctx) this.message += ":\n\n".concat(ctx, "\n"); - } - - delete this.source; - } - }]); - - return YAMLError; -}( /*#__PURE__*/_wrapNativeSuper(Error)); -var YAMLReferenceError = /*#__PURE__*/function (_YAMLError) { - _inherits(YAMLReferenceError, _YAMLError); - - var _super2 = _createSuper(YAMLReferenceError); - - function YAMLReferenceError(source, message) { - _classCallCheck(this, YAMLReferenceError); - - return _super2.call(this, 'YAMLReferenceError', source, message); - } - - return YAMLReferenceError; -}(YAMLError); -var YAMLSemanticError = /*#__PURE__*/function (_YAMLError2) { - _inherits(YAMLSemanticError, _YAMLError2); - - var _super3 = _createSuper(YAMLSemanticError); - - function YAMLSemanticError(source, message) { - _classCallCheck(this, YAMLSemanticError); - - return _super3.call(this, 'YAMLSemanticError', source, message); - } - - return YAMLSemanticError; -}(YAMLError); -var YAMLSyntaxError = /*#__PURE__*/function (_YAMLError3) { - _inherits(YAMLSyntaxError, _YAMLError3); - - var _super4 = _createSuper(YAMLSyntaxError); - - function YAMLSyntaxError(source, message) { - _classCallCheck(this, YAMLSyntaxError); - - return _super4.call(this, 'YAMLSyntaxError', source, message); - } - - return YAMLSyntaxError; -}(YAMLError); -var YAMLWarning = /*#__PURE__*/function (_YAMLError4) { - _inherits(YAMLWarning, _YAMLError4); - - var _super5 = _createSuper(YAMLWarning); - - function YAMLWarning(source, message) { - _classCallCheck(this, YAMLWarning); - - return _super5.call(this, 'YAMLWarning', source, message); - } - - return YAMLWarning; -}(YAMLError); - -var PlainValue = /*#__PURE__*/function (_Node) { - _inherits(PlainValue, _Node); - - var _super = _createSuper(PlainValue); - - function PlainValue() { - _classCallCheck(this, PlainValue); - - return _super.apply(this, arguments); - } - - _createClass(PlainValue, [{ - key: "strValue", - get: function get() { - if (!this.valueRange || !this.context) return null; - var _this$valueRange = this.valueRange, - start = _this$valueRange.start, - end = _this$valueRange.end; - var src = this.context.src; - var ch = src[end - 1]; - - while (start < end && (ch === '\n' || ch === '\t' || ch === ' ')) { - ch = src[--end - 1]; - } - - var str = ''; - - for (var i = start; i < end; ++i) { - var _ch = src[i]; - - if (_ch === '\n') { - var _Node$foldNewline = Node.foldNewline(src, i, -1), - fold = _Node$foldNewline.fold, - offset = _Node$foldNewline.offset; - - str += fold; - i = offset; - } else if (_ch === ' ' || _ch === '\t') { - // trim trailing whitespace - var wsStart = i; - var next = src[i + 1]; - - while (i < end && (next === ' ' || next === '\t')) { - i += 1; - next = src[i + 1]; - } - - if (next !== '\n') str += i > wsStart ? src.slice(wsStart, i + 1) : _ch; - } else { - str += _ch; - } - } - - var ch0 = src[start]; - - switch (ch0) { - case '\t': - { - var msg = 'Plain value cannot start with a tab character'; - var errors = [new YAMLSemanticError(this, msg)]; - return { - errors: errors, - str: str - }; - } - - case '@': - case '`': - { - var _msg = "Plain value cannot start with reserved character ".concat(ch0); - - var _errors = [new YAMLSemanticError(this, _msg)]; - return { - errors: _errors, - str: str - }; - } - - default: - return str; - } - } - }, { - key: "parseBlockValue", - value: function parseBlockValue(start) { - var _this$context = this.context, - indent = _this$context.indent, - inFlow = _this$context.inFlow, - src = _this$context.src; - var offset = start; - var valueEnd = start; - - for (var ch = src[offset]; ch === '\n'; ch = src[offset]) { - if (Node.atDocumentBoundary(src, offset + 1)) break; - var end = Node.endOfBlockIndent(src, indent, offset + 1); - if (end === null || src[end] === '#') break; - - if (src[end] === '\n') { - offset = end; - } else { - valueEnd = PlainValue.endOfLine(src, end, inFlow); - offset = valueEnd; - } - } - - if (this.valueRange.isEmpty()) this.valueRange.start = start; - this.valueRange.end = valueEnd; - return valueEnd; - } - /** - * Parses a plain value from the source - * - * Accepted forms are: - * ``` - * #comment - * - * first line - * - * first line #comment - * - * first line - * block - * lines - * - * #comment - * block - * lines - * ``` - * where block lines are empty or have an indent level greater than `indent`. - * - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this scalar, may be `\n` - */ - - }, { - key: "parse", - value: function parse(context, start) { - this.context = context; - var inFlow = context.inFlow, - src = context.src; - var offset = start; - var ch = src[offset]; - - if (ch && ch !== '#' && ch !== '\n') { - offset = PlainValue.endOfLine(src, start, inFlow); - } - - this.valueRange = new Range(start, offset); - offset = Node.endOfWhiteSpace(src, offset); - offset = this.parseComment(offset); - - if (!this.hasComment || this.valueRange.isEmpty()) { - offset = this.parseBlockValue(offset); - } - - return offset; - } - }], [{ - key: "endOfLine", - value: function endOfLine(src, start, inFlow) { - var ch = src[start]; - var offset = start; - - while (ch && ch !== '\n') { - if (inFlow && (ch === '[' || ch === ']' || ch === '{' || ch === '}' || ch === ',')) break; - var next = src[offset + 1]; - if (ch === ':' && (!next || next === '\n' || next === '\t' || next === ' ' || inFlow && next === ',')) break; - if ((ch === ' ' || ch === '\t') && next === '#') break; - offset += 1; - ch = next; - } - - return offset; - } - }]); - - return PlainValue; -}(Node); - -export { Char as C, Node as N, PlainValue as P, Range as R, Type as T, YAMLSyntaxError as Y, _createForOfIteratorHelper as _, _typeof as a, _createClass as b, _classCallCheck as c, defaultTagPrefix as d, _defineProperty as e, YAMLWarning as f, YAMLSemanticError as g, _slicedToArray as h, YAMLError as i, _inherits as j, _createSuper as k, _get as l, _getPrototypeOf as m, defaultTags as n, YAMLReferenceError as o, _assertThisInitialized as p, _toArray as q, _possibleConstructorReturn as r }; diff --git a/node_modules/yaml/browser/dist/Schema-e94716c8.js b/node_modules/yaml/browser/dist/Schema-e94716c8.js deleted file mode 100644 index f18527dcf..000000000 --- a/node_modules/yaml/browser/dist/Schema-e94716c8.js +++ /dev/null @@ -1,682 +0,0 @@ -import { _ as _createForOfIteratorHelper, h as _slicedToArray, a as _typeof, b as _createClass, e as _defineProperty, c as _classCallCheck, d as defaultTagPrefix, n as defaultTags } from './PlainValue-b8036b75.js'; -import { d as YAMLMap, g as resolveMap, Y as YAMLSeq, h as resolveSeq, j as resolveString, c as stringifyString, s as strOptions, S as Scalar, n as nullOptions, a as boolOptions, i as intOptions, k as stringifyNumber, N as Node, A as Alias, P as Pair } from './resolveSeq-492ab440.js'; -import { b as binary, o as omap, p as pairs, s as set, i as intTime, f as floatTime, t as timestamp, a as warnOptionDeprecation } from './warnings-df54cb69.js'; - -function createMap(schema, obj, ctx) { - var map = new YAMLMap(schema); - - if (obj instanceof Map) { - var _iterator = _createForOfIteratorHelper(obj), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var _step$value = _slicedToArray(_step.value, 2), - key = _step$value[0], - value = _step$value[1]; - - map.items.push(schema.createPair(key, value, ctx)); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - } else if (obj && _typeof(obj) === 'object') { - for (var _i = 0, _Object$keys = Object.keys(obj); _i < _Object$keys.length; _i++) { - var _key = _Object$keys[_i]; - map.items.push(schema.createPair(_key, obj[_key], ctx)); - } - } - - if (typeof schema.sortMapEntries === 'function') { - map.items.sort(schema.sortMapEntries); - } - - return map; -} - -var map = { - createNode: createMap, - default: true, - nodeClass: YAMLMap, - tag: 'tag:yaml.org,2002:map', - resolve: resolveMap -}; - -function createSeq(schema, obj, ctx) { - var seq = new YAMLSeq(schema); - - if (obj && obj[Symbol.iterator]) { - var _iterator = _createForOfIteratorHelper(obj), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var it = _step.value; - var v = schema.createNode(it, ctx.wrapScalars, null, ctx); - seq.items.push(v); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - } - - return seq; -} - -var seq = { - createNode: createSeq, - default: true, - nodeClass: YAMLSeq, - tag: 'tag:yaml.org,2002:seq', - resolve: resolveSeq -}; - -var string = { - identify: function identify(value) { - return typeof value === 'string'; - }, - default: true, - tag: 'tag:yaml.org,2002:str', - resolve: resolveString, - stringify: function stringify(item, ctx, onComment, onChompKeep) { - ctx = Object.assign({ - actualString: true - }, ctx); - return stringifyString(item, ctx, onComment, onChompKeep); - }, - options: strOptions -}; - -var failsafe = [map, seq, string]; - -/* global BigInt */ - -var intIdentify$2 = function intIdentify(value) { - return typeof value === 'bigint' || Number.isInteger(value); -}; - -var intResolve$1 = function intResolve(src, part, radix) { - return intOptions.asBigInt ? BigInt(src) : parseInt(part, radix); -}; - -function intStringify$1(node, radix, prefix) { - var value = node.value; - if (intIdentify$2(value) && value >= 0) return prefix + value.toString(radix); - return stringifyNumber(node); -} - -var nullObj = { - identify: function identify(value) { - return value == null; - }, - createNode: function createNode(schema, value, ctx) { - return ctx.wrapScalars ? new Scalar(null) : null; - }, - default: true, - tag: 'tag:yaml.org,2002:null', - test: /^(?:~|[Nn]ull|NULL)?$/, - resolve: function resolve() { - return null; - }, - options: nullOptions, - stringify: function stringify() { - return nullOptions.nullStr; - } -}; -var boolObj = { - identify: function identify(value) { - return typeof value === 'boolean'; - }, - default: true, - tag: 'tag:yaml.org,2002:bool', - test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/, - resolve: function resolve(str) { - return str[0] === 't' || str[0] === 'T'; - }, - options: boolOptions, - stringify: function stringify(_ref) { - var value = _ref.value; - return value ? boolOptions.trueStr : boolOptions.falseStr; - } -}; -var octObj = { - identify: function identify(value) { - return intIdentify$2(value) && value >= 0; - }, - default: true, - tag: 'tag:yaml.org,2002:int', - format: 'OCT', - test: /^0o([0-7]+)$/, - resolve: function resolve(str, oct) { - return intResolve$1(str, oct, 8); - }, - options: intOptions, - stringify: function stringify(node) { - return intStringify$1(node, 8, '0o'); - } -}; -var intObj = { - identify: intIdentify$2, - default: true, - tag: 'tag:yaml.org,2002:int', - test: /^[-+]?[0-9]+$/, - resolve: function resolve(str) { - return intResolve$1(str, str, 10); - }, - options: intOptions, - stringify: stringifyNumber -}; -var hexObj = { - identify: function identify(value) { - return intIdentify$2(value) && value >= 0; - }, - default: true, - tag: 'tag:yaml.org,2002:int', - format: 'HEX', - test: /^0x([0-9a-fA-F]+)$/, - resolve: function resolve(str, hex) { - return intResolve$1(str, hex, 16); - }, - options: intOptions, - stringify: function stringify(node) { - return intStringify$1(node, 16, '0x'); - } -}; -var nanObj = { - identify: function identify(value) { - return typeof value === 'number'; - }, - default: true, - tag: 'tag:yaml.org,2002:float', - test: /^(?:[-+]?\.inf|(\.nan))$/i, - resolve: function resolve(str, nan) { - return nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY; - }, - stringify: stringifyNumber -}; -var expObj = { - identify: function identify(value) { - return typeof value === 'number'; - }, - default: true, - tag: 'tag:yaml.org,2002:float', - format: 'EXP', - test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/, - resolve: function resolve(str) { - return parseFloat(str); - }, - stringify: function stringify(_ref2) { - var value = _ref2.value; - return Number(value).toExponential(); - } -}; -var floatObj = { - identify: function identify(value) { - return typeof value === 'number'; - }, - default: true, - tag: 'tag:yaml.org,2002:float', - test: /^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/, - resolve: function resolve(str, frac1, frac2) { - var frac = frac1 || frac2; - var node = new Scalar(parseFloat(str)); - if (frac && frac[frac.length - 1] === '0') node.minFractionDigits = frac.length; - return node; - }, - stringify: stringifyNumber -}; -var core = failsafe.concat([nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj]); - -/* global BigInt */ - -var intIdentify$1 = function intIdentify(value) { - return typeof value === 'bigint' || Number.isInteger(value); -}; - -var stringifyJSON = function stringifyJSON(_ref) { - var value = _ref.value; - return JSON.stringify(value); -}; - -var json = [map, seq, { - identify: function identify(value) { - return typeof value === 'string'; - }, - default: true, - tag: 'tag:yaml.org,2002:str', - resolve: resolveString, - stringify: stringifyJSON -}, { - identify: function identify(value) { - return value == null; - }, - createNode: function createNode(schema, value, ctx) { - return ctx.wrapScalars ? new Scalar(null) : null; - }, - default: true, - tag: 'tag:yaml.org,2002:null', - test: /^null$/, - resolve: function resolve() { - return null; - }, - stringify: stringifyJSON -}, { - identify: function identify(value) { - return typeof value === 'boolean'; - }, - default: true, - tag: 'tag:yaml.org,2002:bool', - test: /^true|false$/, - resolve: function resolve(str) { - return str === 'true'; - }, - stringify: stringifyJSON -}, { - identify: intIdentify$1, - default: true, - tag: 'tag:yaml.org,2002:int', - test: /^-?(?:0|[1-9][0-9]*)$/, - resolve: function resolve(str) { - return intOptions.asBigInt ? BigInt(str) : parseInt(str, 10); - }, - stringify: function stringify(_ref2) { - var value = _ref2.value; - return intIdentify$1(value) ? value.toString() : JSON.stringify(value); - } -}, { - identify: function identify(value) { - return typeof value === 'number'; - }, - default: true, - tag: 'tag:yaml.org,2002:float', - test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/, - resolve: function resolve(str) { - return parseFloat(str); - }, - stringify: stringifyJSON -}]; - -json.scalarFallback = function (str) { - throw new SyntaxError("Unresolved plain scalar ".concat(JSON.stringify(str))); -}; - -/* global BigInt */ - -var boolStringify = function boolStringify(_ref) { - var value = _ref.value; - return value ? boolOptions.trueStr : boolOptions.falseStr; -}; - -var intIdentify = function intIdentify(value) { - return typeof value === 'bigint' || Number.isInteger(value); -}; - -function intResolve(sign, src, radix) { - var str = src.replace(/_/g, ''); - - if (intOptions.asBigInt) { - switch (radix) { - case 2: - str = "0b".concat(str); - break; - - case 8: - str = "0o".concat(str); - break; - - case 16: - str = "0x".concat(str); - break; - } - - var _n = BigInt(str); - - return sign === '-' ? BigInt(-1) * _n : _n; - } - - var n = parseInt(str, radix); - return sign === '-' ? -1 * n : n; -} - -function intStringify(node, radix, prefix) { - var value = node.value; - - if (intIdentify(value)) { - var str = value.toString(radix); - return value < 0 ? '-' + prefix + str.substr(1) : prefix + str; - } - - return stringifyNumber(node); -} - -var yaml11 = failsafe.concat([{ - identify: function identify(value) { - return value == null; - }, - createNode: function createNode(schema, value, ctx) { - return ctx.wrapScalars ? new Scalar(null) : null; - }, - default: true, - tag: 'tag:yaml.org,2002:null', - test: /^(?:~|[Nn]ull|NULL)?$/, - resolve: function resolve() { - return null; - }, - options: nullOptions, - stringify: function stringify() { - return nullOptions.nullStr; - } -}, { - identify: function identify(value) { - return typeof value === 'boolean'; - }, - default: true, - tag: 'tag:yaml.org,2002:bool', - test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/, - resolve: function resolve() { - return true; - }, - options: boolOptions, - stringify: boolStringify -}, { - identify: function identify(value) { - return typeof value === 'boolean'; - }, - default: true, - tag: 'tag:yaml.org,2002:bool', - test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i, - resolve: function resolve() { - return false; - }, - options: boolOptions, - stringify: boolStringify -}, { - identify: intIdentify, - default: true, - tag: 'tag:yaml.org,2002:int', - format: 'BIN', - test: /^([-+]?)0b([0-1_]+)$/, - resolve: function resolve(str, sign, bin) { - return intResolve(sign, bin, 2); - }, - stringify: function stringify(node) { - return intStringify(node, 2, '0b'); - } -}, { - identify: intIdentify, - default: true, - tag: 'tag:yaml.org,2002:int', - format: 'OCT', - test: /^([-+]?)0([0-7_]+)$/, - resolve: function resolve(str, sign, oct) { - return intResolve(sign, oct, 8); - }, - stringify: function stringify(node) { - return intStringify(node, 8, '0'); - } -}, { - identify: intIdentify, - default: true, - tag: 'tag:yaml.org,2002:int', - test: /^([-+]?)([0-9][0-9_]*)$/, - resolve: function resolve(str, sign, abs) { - return intResolve(sign, abs, 10); - }, - stringify: stringifyNumber -}, { - identify: intIdentify, - default: true, - tag: 'tag:yaml.org,2002:int', - format: 'HEX', - test: /^([-+]?)0x([0-9a-fA-F_]+)$/, - resolve: function resolve(str, sign, hex) { - return intResolve(sign, hex, 16); - }, - stringify: function stringify(node) { - return intStringify(node, 16, '0x'); - } -}, { - identify: function identify(value) { - return typeof value === 'number'; - }, - default: true, - tag: 'tag:yaml.org,2002:float', - test: /^(?:[-+]?\.inf|(\.nan))$/i, - resolve: function resolve(str, nan) { - return nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY; - }, - stringify: stringifyNumber -}, { - identify: function identify(value) { - return typeof value === 'number'; - }, - default: true, - tag: 'tag:yaml.org,2002:float', - format: 'EXP', - test: /^[-+]?([0-9][0-9_]*)?(\.[0-9_]*)?[eE][-+]?[0-9]+$/, - resolve: function resolve(str) { - return parseFloat(str.replace(/_/g, '')); - }, - stringify: function stringify(_ref2) { - var value = _ref2.value; - return Number(value).toExponential(); - } -}, { - identify: function identify(value) { - return typeof value === 'number'; - }, - default: true, - tag: 'tag:yaml.org,2002:float', - test: /^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/, - resolve: function resolve(str, frac) { - var node = new Scalar(parseFloat(str.replace(/_/g, ''))); - - if (frac) { - var f = frac.replace(/_/g, ''); - if (f[f.length - 1] === '0') node.minFractionDigits = f.length; - } - - return node; - }, - stringify: stringifyNumber -}], binary, omap, pairs, set, intTime, floatTime, timestamp); - -var schemas = { - core: core, - failsafe: failsafe, - json: json, - yaml11: yaml11 -}; -var tags = { - binary: binary, - bool: boolObj, - float: floatObj, - floatExp: expObj, - floatNaN: nanObj, - floatTime: floatTime, - int: intObj, - intHex: hexObj, - intOct: octObj, - intTime: intTime, - map: map, - null: nullObj, - omap: omap, - pairs: pairs, - seq: seq, - set: set, - timestamp: timestamp -}; - -function findTagObject(value, tagName, tags) { - if (tagName) { - var match = tags.filter(function (t) { - return t.tag === tagName; - }); - var tagObj = match.find(function (t) { - return !t.format; - }) || match[0]; - if (!tagObj) throw new Error("Tag ".concat(tagName, " not found")); - return tagObj; - } // TODO: deprecate/remove class check - - - return tags.find(function (t) { - return (t.identify && t.identify(value) || t.class && value instanceof t.class) && !t.format; - }); -} - -function createNode(value, tagName, ctx) { - if (value instanceof Node) return value; - var defaultPrefix = ctx.defaultPrefix, - onTagObj = ctx.onTagObj, - prevObjects = ctx.prevObjects, - schema = ctx.schema, - wrapScalars = ctx.wrapScalars; - if (tagName && tagName.startsWith('!!')) tagName = defaultPrefix + tagName.slice(2); - var tagObj = findTagObject(value, tagName, schema.tags); - - if (!tagObj) { - if (typeof value.toJSON === 'function') value = value.toJSON(); - if (!value || _typeof(value) !== 'object') return wrapScalars ? new Scalar(value) : value; - tagObj = value instanceof Map ? map : value[Symbol.iterator] ? seq : map; - } - - if (onTagObj) { - onTagObj(tagObj); - delete ctx.onTagObj; - } // Detect duplicate references to the same object & use Alias nodes for all - // after first. The `obj` wrapper allows for circular references to resolve. - - - var obj = { - value: undefined, - node: undefined - }; - - if (value && _typeof(value) === 'object' && prevObjects) { - var prev = prevObjects.get(value); - - if (prev) { - var alias = new Alias(prev); // leaves source dirty; must be cleaned by caller - - ctx.aliasNodes.push(alias); // defined along with prevObjects - - return alias; - } - - obj.value = value; - prevObjects.set(value, obj); - } - - obj.node = tagObj.createNode ? tagObj.createNode(ctx.schema, value, ctx) : wrapScalars ? new Scalar(value) : value; - if (tagName && obj.node instanceof Node) obj.node.tag = tagName; - return obj.node; -} - -function getSchemaTags(schemas, knownTags, customTags, schemaId) { - var tags = schemas[schemaId.replace(/\W/g, '')]; // 'yaml-1.1' -> 'yaml11' - - if (!tags) { - var keys = Object.keys(schemas).map(function (key) { - return JSON.stringify(key); - }).join(', '); - throw new Error("Unknown schema \"".concat(schemaId, "\"; use one of ").concat(keys)); - } - - if (Array.isArray(customTags)) { - var _iterator = _createForOfIteratorHelper(customTags), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var tag = _step.value; - tags = tags.concat(tag); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - } else if (typeof customTags === 'function') { - tags = customTags(tags.slice()); - } - - for (var i = 0; i < tags.length; ++i) { - var _tag = tags[i]; - - if (typeof _tag === 'string') { - var tagObj = knownTags[_tag]; - - if (!tagObj) { - var _keys = Object.keys(knownTags).map(function (key) { - return JSON.stringify(key); - }).join(', '); - - throw new Error("Unknown custom tag \"".concat(_tag, "\"; use one of ").concat(_keys)); - } - - tags[i] = tagObj; - } - } - - return tags; -} - -var sortMapEntriesByKey = function sortMapEntriesByKey(a, b) { - return a.key < b.key ? -1 : a.key > b.key ? 1 : 0; -}; - -var Schema = /*#__PURE__*/function () { - // TODO: remove in v2 - // TODO: remove in v2 - function Schema(_ref) { - var customTags = _ref.customTags, - merge = _ref.merge, - schema = _ref.schema, - sortMapEntries = _ref.sortMapEntries, - deprecatedCustomTags = _ref.tags; - - _classCallCheck(this, Schema); - - this.merge = !!merge; - this.name = schema; - this.sortMapEntries = sortMapEntries === true ? sortMapEntriesByKey : sortMapEntries || null; - if (!customTags && deprecatedCustomTags) warnOptionDeprecation('tags', 'customTags'); - this.tags = getSchemaTags(schemas, tags, customTags || deprecatedCustomTags, schema); - } - - _createClass(Schema, [{ - key: "createNode", - value: function createNode$1(value, wrapScalars, tagName, ctx) { - var baseCtx = { - defaultPrefix: Schema.defaultPrefix, - schema: this, - wrapScalars: wrapScalars - }; - var createCtx = ctx ? Object.assign(ctx, baseCtx) : baseCtx; - return createNode(value, tagName, createCtx); - } - }, { - key: "createPair", - value: function createPair(key, value, ctx) { - if (!ctx) ctx = { - wrapScalars: true - }; - var k = this.createNode(key, ctx.wrapScalars, null, ctx); - var v = this.createNode(value, ctx.wrapScalars, null, ctx); - return new Pair(k, v); - } - }]); - - return Schema; -}(); - -_defineProperty(Schema, "defaultPrefix", defaultTagPrefix); - -_defineProperty(Schema, "defaultTags", defaultTags); - -export { Schema as S }; diff --git a/node_modules/yaml/browser/dist/index.js b/node_modules/yaml/browser/dist/index.js deleted file mode 100644 index e67898bca..000000000 --- a/node_modules/yaml/browser/dist/index.js +++ /dev/null @@ -1,1002 +0,0 @@ -import { d as defaultTagPrefix, _ as _createForOfIteratorHelper, a as _typeof, b as _createClass, c as _classCallCheck, e as _defineProperty, Y as YAMLSyntaxError, T as Type, f as YAMLWarning, g as YAMLSemanticError, h as _slicedToArray, i as YAMLError, j as _inherits, k as _createSuper } from './PlainValue-b8036b75.js'; -import { parse as parse$1 } from './parse-cst.js'; -import { b as binaryOptions, a as boolOptions, i as intOptions, n as nullOptions, s as strOptions, N as Node, P as Pair, S as Scalar, c as stringifyString, A as Alias, Y as YAMLSeq, d as YAMLMap, M as Merge, C as Collection, r as resolveNode, e as isEmptyPath, t as toJSON, f as addComment } from './resolveSeq-492ab440.js'; -import { S as Schema } from './Schema-e94716c8.js'; -import { w as warn } from './warnings-df54cb69.js'; - -var defaultOptions = { - anchorPrefix: 'a', - customTags: null, - indent: 2, - indentSeq: true, - keepCstNodes: false, - keepNodeTypes: true, - keepBlobsInJSON: true, - mapAsMap: false, - maxAliasCount: 100, - prettyErrors: false, - // TODO Set true in v2 - simpleKeys: false, - version: '1.2' -}; -var scalarOptions = { - get binary() { - return binaryOptions; - }, - - set binary(opt) { - Object.assign(binaryOptions, opt); - }, - - get bool() { - return boolOptions; - }, - - set bool(opt) { - Object.assign(boolOptions, opt); - }, - - get int() { - return intOptions; - }, - - set int(opt) { - Object.assign(intOptions, opt); - }, - - get null() { - return nullOptions; - }, - - set null(opt) { - Object.assign(nullOptions, opt); - }, - - get str() { - return strOptions; - }, - - set str(opt) { - Object.assign(strOptions, opt); - } - -}; -var documentOptions = { - '1.0': { - schema: 'yaml-1.1', - merge: true, - tagPrefixes: [{ - handle: '!', - prefix: defaultTagPrefix - }, { - handle: '!!', - prefix: 'tag:private.yaml.org,2002:' - }] - }, - 1.1: { - schema: 'yaml-1.1', - merge: true, - tagPrefixes: [{ - handle: '!', - prefix: '!' - }, { - handle: '!!', - prefix: defaultTagPrefix - }] - }, - 1.2: { - schema: 'core', - merge: false, - tagPrefixes: [{ - handle: '!', - prefix: '!' - }, { - handle: '!!', - prefix: defaultTagPrefix - }] - } -}; - -function stringifyTag(doc, tag) { - if ((doc.version || doc.options.version) === '1.0') { - var priv = tag.match(/^tag:private\.yaml\.org,2002:([^:/]+)$/); - if (priv) return '!' + priv[1]; - var vocab = tag.match(/^tag:([a-zA-Z0-9-]+)\.yaml\.org,2002:(.*)/); - return vocab ? "!".concat(vocab[1], "/").concat(vocab[2]) : "!".concat(tag.replace(/^tag:/, '')); - } - - var p = doc.tagPrefixes.find(function (p) { - return tag.indexOf(p.prefix) === 0; - }); - - if (!p) { - var dtp = doc.getDefaults().tagPrefixes; - p = dtp && dtp.find(function (p) { - return tag.indexOf(p.prefix) === 0; - }); - } - - if (!p) return tag[0] === '!' ? tag : "!<".concat(tag, ">"); - var suffix = tag.substr(p.prefix.length).replace(/[!,[\]{}]/g, function (ch) { - return { - '!': '%21', - ',': '%2C', - '[': '%5B', - ']': '%5D', - '{': '%7B', - '}': '%7D' - }[ch]; - }); - return p.handle + suffix; -} - -function getTagObject(tags, item) { - if (item instanceof Alias) return Alias; - - if (item.tag) { - var match = tags.filter(function (t) { - return t.tag === item.tag; - }); - if (match.length > 0) return match.find(function (t) { - return t.format === item.format; - }) || match[0]; - } - - var tagObj, obj; - - if (item instanceof Scalar) { - obj = item.value; // TODO: deprecate/remove class check - - var _match = tags.filter(function (t) { - return t.identify && t.identify(obj) || t.class && obj instanceof t.class; - }); - - tagObj = _match.find(function (t) { - return t.format === item.format; - }) || _match.find(function (t) { - return !t.format; - }); - } else { - obj = item; - tagObj = tags.find(function (t) { - return t.nodeClass && obj instanceof t.nodeClass; - }); - } - - if (!tagObj) { - var name = obj && obj.constructor ? obj.constructor.name : _typeof(obj); - throw new Error("Tag not resolved for ".concat(name, " value")); - } - - return tagObj; -} // needs to be called before value stringifier to allow for circular anchor refs - - -function stringifyProps(node, tagObj, _ref) { - var anchors = _ref.anchors, - doc = _ref.doc; - var props = []; - var anchor = doc.anchors.getName(node); - - if (anchor) { - anchors[anchor] = node; - props.push("&".concat(anchor)); - } - - if (node.tag) { - props.push(stringifyTag(doc, node.tag)); - } else if (!tagObj.default) { - props.push(stringifyTag(doc, tagObj.tag)); - } - - return props.join(' '); -} - -function stringify$1(item, ctx, onComment, onChompKeep) { - var _ctx$doc = ctx.doc, - anchors = _ctx$doc.anchors, - schema = _ctx$doc.schema; - var tagObj; - - if (!(item instanceof Node)) { - var createCtx = { - aliasNodes: [], - onTagObj: function onTagObj(o) { - return tagObj = o; - }, - prevObjects: new Map() - }; - item = schema.createNode(item, true, null, createCtx); - - var _iterator = _createForOfIteratorHelper(createCtx.aliasNodes), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var alias = _step.value; - alias.source = alias.source.node; - var name = anchors.getName(alias.source); - - if (!name) { - name = anchors.newName(); - anchors.map[name] = alias.source; - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - } - - if (item instanceof Pair) return item.toString(ctx, onComment, onChompKeep); - if (!tagObj) tagObj = getTagObject(schema.tags, item); - var props = stringifyProps(item, tagObj, ctx); - if (props.length > 0) ctx.indentAtStart = (ctx.indentAtStart || 0) + props.length + 1; - var str = typeof tagObj.stringify === 'function' ? tagObj.stringify(item, ctx, onComment, onChompKeep) : item instanceof Scalar ? stringifyString(item, ctx, onComment, onChompKeep) : item.toString(ctx, onComment, onChompKeep); - if (!props) return str; - return item instanceof Scalar || str[0] === '{' || str[0] === '[' ? "".concat(props, " ").concat(str) : "".concat(props, "\n").concat(ctx.indent).concat(str); -} - -var Anchors = /*#__PURE__*/function () { - function Anchors(prefix) { - _classCallCheck(this, Anchors); - - _defineProperty(this, "map", Object.create(null)); - - this.prefix = prefix; - } - - _createClass(Anchors, [{ - key: "createAlias", - value: function createAlias(node, name) { - this.setAnchor(node, name); - return new Alias(node); - } - }, { - key: "createMergePair", - value: function createMergePair() { - var _this = this; - - var merge = new Merge(); - - for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) { - sources[_key] = arguments[_key]; - } - - merge.value.items = sources.map(function (s) { - if (s instanceof Alias) { - if (s.source instanceof YAMLMap) return s; - } else if (s instanceof YAMLMap) { - return _this.createAlias(s); - } - - throw new Error('Merge sources must be Map nodes or their Aliases'); - }); - return merge; - } - }, { - key: "getName", - value: function getName(node) { - var map = this.map; - return Object.keys(map).find(function (a) { - return map[a] === node; - }); - } - }, { - key: "getNames", - value: function getNames() { - return Object.keys(this.map); - } - }, { - key: "getNode", - value: function getNode(name) { - return this.map[name]; - } - }, { - key: "newName", - value: function newName(prefix) { - if (!prefix) prefix = this.prefix; - var names = Object.keys(this.map); - - for (var i = 1; true; ++i) { - var name = "".concat(prefix).concat(i); - if (!names.includes(name)) return name; - } - } // During parsing, map & aliases contain CST nodes - - }, { - key: "resolveNodes", - value: function resolveNodes() { - var map = this.map, - _cstAliases = this._cstAliases; - Object.keys(map).forEach(function (a) { - map[a] = map[a].resolved; - }); - - _cstAliases.forEach(function (a) { - a.source = a.source.resolved; - }); - - delete this._cstAliases; - } - }, { - key: "setAnchor", - value: function setAnchor(node, name) { - if (node != null && !Anchors.validAnchorNode(node)) { - throw new Error('Anchors may only be set for Scalar, Seq and Map nodes'); - } - - if (name && /[\x00-\x19\s,[\]{}]/.test(name)) { - throw new Error('Anchor names must not contain whitespace or control characters'); - } - - var map = this.map; - var prev = node && Object.keys(map).find(function (a) { - return map[a] === node; - }); - - if (prev) { - if (!name) { - return prev; - } else if (prev !== name) { - delete map[prev]; - map[name] = node; - } - } else { - if (!name) { - if (!node) return null; - name = this.newName(); - } - - map[name] = node; - } - - return name; - } - }], [{ - key: "validAnchorNode", - value: function validAnchorNode(node) { - return node instanceof Scalar || node instanceof YAMLSeq || node instanceof YAMLMap; - } - }]); - - return Anchors; -}(); - -var visit = function visit(node, tags) { - if (node && _typeof(node) === 'object') { - var tag = node.tag; - - if (node instanceof Collection) { - if (tag) tags[tag] = true; - node.items.forEach(function (n) { - return visit(n, tags); - }); - } else if (node instanceof Pair) { - visit(node.key, tags); - visit(node.value, tags); - } else if (node instanceof Scalar) { - if (tag) tags[tag] = true; - } - } - - return tags; -}; - -var listTagNames = function listTagNames(node) { - return Object.keys(visit(node, {})); -}; - -function parseContents(doc, contents) { - var comments = { - before: [], - after: [] - }; - var body = undefined; - var spaceBefore = false; - - var _iterator = _createForOfIteratorHelper(contents), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var node = _step.value; - - if (node.valueRange) { - if (body !== undefined) { - var msg = 'Document contains trailing content not separated by a ... or --- line'; - doc.errors.push(new YAMLSyntaxError(node, msg)); - break; - } - - var res = resolveNode(doc, node); - - if (spaceBefore) { - res.spaceBefore = true; - spaceBefore = false; - } - - body = res; - } else if (node.comment !== null) { - var cc = body === undefined ? comments.before : comments.after; - cc.push(node.comment); - } else if (node.type === Type.BLANK_LINE) { - spaceBefore = true; - - if (body === undefined && comments.before.length > 0 && !doc.commentBefore) { - // space-separated comments at start are parsed as document comments - doc.commentBefore = comments.before.join('\n'); - comments.before = []; - } - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - doc.contents = body || null; - - if (!body) { - doc.comment = comments.before.concat(comments.after).join('\n') || null; - } else { - var cb = comments.before.join('\n'); - - if (cb) { - var cbNode = body instanceof Collection && body.items[0] ? body.items[0] : body; - cbNode.commentBefore = cbNode.commentBefore ? "".concat(cb, "\n").concat(cbNode.commentBefore) : cb; - } - - doc.comment = comments.after.join('\n') || null; - } -} - -function resolveTagDirective(_ref, directive) { - var tagPrefixes = _ref.tagPrefixes; - - var _directive$parameters = _slicedToArray(directive.parameters, 2), - handle = _directive$parameters[0], - prefix = _directive$parameters[1]; - - if (!handle || !prefix) { - var msg = 'Insufficient parameters given for %TAG directive'; - throw new YAMLSemanticError(directive, msg); - } - - if (tagPrefixes.some(function (p) { - return p.handle === handle; - })) { - var _msg = 'The %TAG directive must only be given at most once per handle in the same document.'; - throw new YAMLSemanticError(directive, _msg); - } - - return { - handle: handle, - prefix: prefix - }; -} - -function resolveYamlDirective(doc, directive) { - var _directive$parameters2 = _slicedToArray(directive.parameters, 1), - version = _directive$parameters2[0]; - - if (directive.name === 'YAML:1.0') version = '1.0'; - - if (!version) { - var msg = 'Insufficient parameters given for %YAML directive'; - throw new YAMLSemanticError(directive, msg); - } - - if (!documentOptions[version]) { - var v0 = doc.version || doc.options.version; - - var _msg2 = "Document will be parsed as YAML ".concat(v0, " rather than YAML ").concat(version); - - doc.warnings.push(new YAMLWarning(directive, _msg2)); - } - - return version; -} - -function parseDirectives(doc, directives, prevDoc) { - var directiveComments = []; - var hasDirectives = false; - - var _iterator = _createForOfIteratorHelper(directives), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var directive = _step.value; - var comment = directive.comment, - name = directive.name; - - switch (name) { - case 'TAG': - try { - doc.tagPrefixes.push(resolveTagDirective(doc, directive)); - } catch (error) { - doc.errors.push(error); - } - - hasDirectives = true; - break; - - case 'YAML': - case 'YAML:1.0': - if (doc.version) { - var msg = 'The %YAML directive must only be given at most once per document.'; - doc.errors.push(new YAMLSemanticError(directive, msg)); - } - - try { - doc.version = resolveYamlDirective(doc, directive); - } catch (error) { - doc.errors.push(error); - } - - hasDirectives = true; - break; - - default: - if (name) { - var _msg3 = "YAML only supports %TAG and %YAML directives, and not %".concat(name); - - doc.warnings.push(new YAMLWarning(directive, _msg3)); - } - - } - - if (comment) directiveComments.push(comment); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - if (prevDoc && !hasDirectives && '1.1' === (doc.version || prevDoc.version || doc.options.version)) { - var copyTagPrefix = function copyTagPrefix(_ref2) { - var handle = _ref2.handle, - prefix = _ref2.prefix; - return { - handle: handle, - prefix: prefix - }; - }; - - doc.tagPrefixes = prevDoc.tagPrefixes.map(copyTagPrefix); - doc.version = prevDoc.version; - } - - doc.commentBefore = directiveComments.join('\n') || null; -} - -function assertCollection(contents) { - if (contents instanceof Collection) return true; - throw new Error('Expected a YAML collection as document contents'); -} - -var Document$1 = /*#__PURE__*/function () { - function Document(options) { - _classCallCheck(this, Document); - - this.anchors = new Anchors(options.anchorPrefix); - this.commentBefore = null; - this.comment = null; - this.contents = null; - this.directivesEndMarker = null; - this.errors = []; - this.options = options; - this.schema = null; - this.tagPrefixes = []; - this.version = null; - this.warnings = []; - } - - _createClass(Document, [{ - key: "add", - value: function add(value) { - assertCollection(this.contents); - return this.contents.add(value); - } - }, { - key: "addIn", - value: function addIn(path, value) { - assertCollection(this.contents); - this.contents.addIn(path, value); - } - }, { - key: "delete", - value: function _delete(key) { - assertCollection(this.contents); - return this.contents.delete(key); - } - }, { - key: "deleteIn", - value: function deleteIn(path) { - if (isEmptyPath(path)) { - if (this.contents == null) return false; - this.contents = null; - return true; - } - - assertCollection(this.contents); - return this.contents.deleteIn(path); - } - }, { - key: "getDefaults", - value: function getDefaults() { - return Document.defaults[this.version] || Document.defaults[this.options.version] || {}; - } - }, { - key: "get", - value: function get(key, keepScalar) { - return this.contents instanceof Collection ? this.contents.get(key, keepScalar) : undefined; - } - }, { - key: "getIn", - value: function getIn(path, keepScalar) { - if (isEmptyPath(path)) return !keepScalar && this.contents instanceof Scalar ? this.contents.value : this.contents; - return this.contents instanceof Collection ? this.contents.getIn(path, keepScalar) : undefined; - } - }, { - key: "has", - value: function has(key) { - return this.contents instanceof Collection ? this.contents.has(key) : false; - } - }, { - key: "hasIn", - value: function hasIn(path) { - if (isEmptyPath(path)) return this.contents !== undefined; - return this.contents instanceof Collection ? this.contents.hasIn(path) : false; - } - }, { - key: "set", - value: function set(key, value) { - assertCollection(this.contents); - this.contents.set(key, value); - } - }, { - key: "setIn", - value: function setIn(path, value) { - if (isEmptyPath(path)) this.contents = value;else { - assertCollection(this.contents); - this.contents.setIn(path, value); - } - } - }, { - key: "setSchema", - value: function setSchema(id, customTags) { - if (!id && !customTags && this.schema) return; - if (typeof id === 'number') id = id.toFixed(1); - - if (id === '1.0' || id === '1.1' || id === '1.2') { - if (this.version) this.version = id;else this.options.version = id; - delete this.options.schema; - } else if (id && typeof id === 'string') { - this.options.schema = id; - } - - if (Array.isArray(customTags)) this.options.customTags = customTags; - var opt = Object.assign({}, this.getDefaults(), this.options); - this.schema = new Schema(opt); - } - }, { - key: "parse", - value: function parse(node, prevDoc) { - if (this.options.keepCstNodes) this.cstNode = node; - if (this.options.keepNodeTypes) this.type = 'DOCUMENT'; - var _node$directives = node.directives, - directives = _node$directives === void 0 ? [] : _node$directives, - _node$contents = node.contents, - contents = _node$contents === void 0 ? [] : _node$contents, - directivesEndMarker = node.directivesEndMarker, - error = node.error, - valueRange = node.valueRange; - - if (error) { - if (!error.source) error.source = this; - this.errors.push(error); - } - - parseDirectives(this, directives, prevDoc); - if (directivesEndMarker) this.directivesEndMarker = true; - this.range = valueRange ? [valueRange.start, valueRange.end] : null; - this.setSchema(); - this.anchors._cstAliases = []; - parseContents(this, contents); - this.anchors.resolveNodes(); - - if (this.options.prettyErrors) { - var _iterator = _createForOfIteratorHelper(this.errors), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var _error = _step.value; - if (_error instanceof YAMLError) _error.makePretty(); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - var _iterator2 = _createForOfIteratorHelper(this.warnings), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var warn = _step2.value; - if (warn instanceof YAMLError) warn.makePretty(); - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - } - - return this; - } - }, { - key: "listNonDefaultTags", - value: function listNonDefaultTags() { - return listTagNames(this.contents).filter(function (t) { - return t.indexOf(Schema.defaultPrefix) !== 0; - }); - } - }, { - key: "setTagPrefix", - value: function setTagPrefix(handle, prefix) { - if (handle[0] !== '!' || handle[handle.length - 1] !== '!') throw new Error('Handle must start and end with !'); - - if (prefix) { - var prev = this.tagPrefixes.find(function (p) { - return p.handle === handle; - }); - if (prev) prev.prefix = prefix;else this.tagPrefixes.push({ - handle: handle, - prefix: prefix - }); - } else { - this.tagPrefixes = this.tagPrefixes.filter(function (p) { - return p.handle !== handle; - }); - } - } - }, { - key: "toJSON", - value: function toJSON$1(arg, onAnchor) { - var _this = this; - - var _this$options = this.options, - keepBlobsInJSON = _this$options.keepBlobsInJSON, - mapAsMap = _this$options.mapAsMap, - maxAliasCount = _this$options.maxAliasCount; - var keep = keepBlobsInJSON && (typeof arg !== 'string' || !(this.contents instanceof Scalar)); - var ctx = { - doc: this, - indentStep: ' ', - keep: keep, - mapAsMap: keep && !!mapAsMap, - maxAliasCount: maxAliasCount, - stringify: stringify$1 // Requiring directly in Pair would create circular dependencies - - }; - var anchorNames = Object.keys(this.anchors.map); - if (anchorNames.length > 0) ctx.anchors = new Map(anchorNames.map(function (name) { - return [_this.anchors.map[name], { - alias: [], - aliasCount: 0, - count: 1 - }]; - })); - - var res = toJSON(this.contents, arg, ctx); - - if (typeof onAnchor === 'function' && ctx.anchors) { - var _iterator3 = _createForOfIteratorHelper(ctx.anchors.values()), - _step3; - - try { - for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { - var _step3$value = _step3.value, - count = _step3$value.count, - _res = _step3$value.res; - onAnchor(_res, count); - } - } catch (err) { - _iterator3.e(err); - } finally { - _iterator3.f(); - } - } - - return res; - } - }, { - key: "toString", - value: function toString() { - if (this.errors.length > 0) throw new Error('Document with errors cannot be stringified'); - var indentSize = this.options.indent; - - if (!Number.isInteger(indentSize) || indentSize <= 0) { - var s = JSON.stringify(indentSize); - throw new Error("\"indent\" option must be a positive integer, not ".concat(s)); - } - - this.setSchema(); - var lines = []; - var hasDirectives = false; - - if (this.version) { - var vd = '%YAML 1.2'; - - if (this.schema.name === 'yaml-1.1') { - if (this.version === '1.0') vd = '%YAML:1.0';else if (this.version === '1.1') vd = '%YAML 1.1'; - } - - lines.push(vd); - hasDirectives = true; - } - - var tagNames = this.listNonDefaultTags(); - this.tagPrefixes.forEach(function (_ref) { - var handle = _ref.handle, - prefix = _ref.prefix; - - if (tagNames.some(function (t) { - return t.indexOf(prefix) === 0; - })) { - lines.push("%TAG ".concat(handle, " ").concat(prefix)); - hasDirectives = true; - } - }); - if (hasDirectives || this.directivesEndMarker) lines.push('---'); - - if (this.commentBefore) { - if (hasDirectives || !this.directivesEndMarker) lines.unshift(''); - lines.unshift(this.commentBefore.replace(/^/gm, '#')); - } - - var ctx = { - anchors: Object.create(null), - doc: this, - indent: '', - indentStep: ' '.repeat(indentSize), - stringify: stringify$1 // Requiring directly in nodes would create circular dependencies - - }; - var chompKeep = false; - var contentComment = null; - - if (this.contents) { - if (this.contents instanceof Node) { - if (this.contents.spaceBefore && (hasDirectives || this.directivesEndMarker)) lines.push(''); - if (this.contents.commentBefore) lines.push(this.contents.commentBefore.replace(/^/gm, '#')); // top-level block scalars need to be indented if followed by a comment - - ctx.forceBlockIndent = !!this.comment; - contentComment = this.contents.comment; - } - - var onChompKeep = contentComment ? null : function () { - return chompKeep = true; - }; - var body = stringify$1(this.contents, ctx, function () { - return contentComment = null; - }, onChompKeep); - lines.push(addComment(body, '', contentComment)); - } else if (this.contents !== undefined) { - lines.push(stringify$1(this.contents, ctx)); - } - - if (this.comment) { - if ((!chompKeep || contentComment) && lines[lines.length - 1] !== '') lines.push(''); - lines.push(this.comment.replace(/^/gm, '#')); - } - - return lines.join('\n') + '\n'; - } - }]); - - return Document; -}(); - -_defineProperty(Document$1, "defaults", documentOptions); - -function createNode(value) { - var wrapScalars = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - var tag = arguments.length > 2 ? arguments[2] : undefined; - - if (tag === undefined && typeof wrapScalars === 'string') { - tag = wrapScalars; - wrapScalars = true; - } - - var options = Object.assign({}, Document$1.defaults[defaultOptions.version], defaultOptions); - var schema = new Schema(options); - return schema.createNode(value, wrapScalars, tag); -} - -var Document = /*#__PURE__*/function (_YAMLDocument) { - _inherits(Document, _YAMLDocument); - - var _super = _createSuper(Document); - - function Document(options) { - _classCallCheck(this, Document); - - return _super.call(this, Object.assign({}, defaultOptions, options)); - } - - return Document; -}(Document$1); - -function parseAllDocuments(src, options) { - var stream = []; - var prev; - - var _iterator = _createForOfIteratorHelper(parse$1(src)), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var cstDoc = _step.value; - var doc = new Document(options); - doc.parse(cstDoc, prev); - stream.push(doc); - prev = doc; - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return stream; -} - -function parseDocument(src, options) { - var cst = parse$1(src); - var doc = new Document(options).parse(cst[0]); - - if (cst.length > 1) { - var errMsg = 'Source contains multiple documents; please use YAML.parseAllDocuments()'; - doc.errors.unshift(new YAMLSemanticError(cst[1], errMsg)); - } - - return doc; -} - -function parse(src, options) { - var doc = parseDocument(src, options); - doc.warnings.forEach(function (warning) { - return warn(warning); - }); - if (doc.errors.length > 0) throw doc.errors[0]; - return doc.toJSON(); -} - -function stringify(value, options) { - var doc = new Document(options); - doc.contents = value; - return String(doc); -} - -var YAML = { - createNode: createNode, - defaultOptions: defaultOptions, - Document: Document, - parse: parse, - parseAllDocuments: parseAllDocuments, - parseCST: parse$1, - parseDocument: parseDocument, - scalarOptions: scalarOptions, - stringify: stringify -}; - -export { YAML }; diff --git a/node_modules/yaml/browser/dist/legacy-exports.js b/node_modules/yaml/browser/dist/legacy-exports.js deleted file mode 100644 index 4400ed652..000000000 --- a/node_modules/yaml/browser/dist/legacy-exports.js +++ /dev/null @@ -1,3 +0,0 @@ -export { b as binary, f as floatTime, i as intTime, o as omap, p as pairs, s as set, t as timestamp, c as warnFileDeprecation } from './warnings-df54cb69.js'; -import './PlainValue-b8036b75.js'; -import './resolveSeq-492ab440.js'; diff --git a/node_modules/yaml/browser/dist/package.json b/node_modules/yaml/browser/dist/package.json deleted file mode 100644 index 5ffd9800b..000000000 --- a/node_modules/yaml/browser/dist/package.json +++ /dev/null @@ -1 +0,0 @@ -{ "type": "module" } diff --git a/node_modules/yaml/browser/dist/parse-cst.js b/node_modules/yaml/browser/dist/parse-cst.js deleted file mode 100644 index b68cf3c6b..000000000 --- a/node_modules/yaml/browser/dist/parse-cst.js +++ /dev/null @@ -1,1904 +0,0 @@ -import { j as _inherits, k as _createSuper, c as _classCallCheck, T as Type, b as _createClass, R as Range, N as Node, g as YAMLSemanticError, l as _get, m as _getPrototypeOf, Y as YAMLSyntaxError, C as Char, e as _defineProperty, P as PlainValue } from './PlainValue-b8036b75.js'; - -var BlankLine = /*#__PURE__*/function (_Node) { - _inherits(BlankLine, _Node); - - var _super = _createSuper(BlankLine); - - function BlankLine() { - _classCallCheck(this, BlankLine); - - return _super.call(this, Type.BLANK_LINE); - } - /* istanbul ignore next */ - - - _createClass(BlankLine, [{ - key: "includesTrailingLines", - get: function get() { - // This is never called from anywhere, but if it were, - // this is the value it should return. - return true; - } - /** - * Parses a blank line from the source - * - * @param {ParseContext} context - * @param {number} start - Index of first \n character - * @returns {number} - Index of the character after this - */ - - }, { - key: "parse", - value: function parse(context, start) { - this.context = context; - this.range = new Range(start, start + 1); - return start + 1; - } - }]); - - return BlankLine; -}(Node); - -var CollectionItem = /*#__PURE__*/function (_Node) { - _inherits(CollectionItem, _Node); - - var _super = _createSuper(CollectionItem); - - function CollectionItem(type, props) { - var _this; - - _classCallCheck(this, CollectionItem); - - _this = _super.call(this, type, props); - _this.node = null; - return _this; - } - - _createClass(CollectionItem, [{ - key: "includesTrailingLines", - get: function get() { - return !!this.node && this.node.includesTrailingLines; - } - /** - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this - */ - - }, { - key: "parse", - value: function parse(context, start) { - this.context = context; - var parseNode = context.parseNode, - src = context.src; - var atLineStart = context.atLineStart, - lineStart = context.lineStart; - if (!atLineStart && this.type === Type.SEQ_ITEM) this.error = new YAMLSemanticError(this, 'Sequence items must not have preceding content on the same line'); - var indent = atLineStart ? start - lineStart : context.indent; - var offset = Node.endOfWhiteSpace(src, start + 1); - var ch = src[offset]; - var inlineComment = ch === '#'; - var comments = []; - var blankLine = null; - - while (ch === '\n' || ch === '#') { - if (ch === '#') { - var _end = Node.endOfLine(src, offset + 1); - - comments.push(new Range(offset, _end)); - offset = _end; - } else { - atLineStart = true; - lineStart = offset + 1; - var wsEnd = Node.endOfWhiteSpace(src, lineStart); - - if (src[wsEnd] === '\n' && comments.length === 0) { - blankLine = new BlankLine(); - lineStart = blankLine.parse({ - src: src - }, lineStart); - } - - offset = Node.endOfIndent(src, lineStart); - } - - ch = src[offset]; - } - - if (Node.nextNodeIsIndented(ch, offset - (lineStart + indent), this.type !== Type.SEQ_ITEM)) { - this.node = parseNode({ - atLineStart: atLineStart, - inCollection: false, - indent: indent, - lineStart: lineStart, - parent: this - }, offset); - } else if (ch && lineStart > start + 1) { - offset = lineStart - 1; - } - - if (this.node) { - if (blankLine) { - // Only blank lines preceding non-empty nodes are captured. Note that - // this means that collection item range start indices do not always - // increase monotonically. -- eemeli/yaml#126 - var items = context.parent.items || context.parent.contents; - if (items) items.push(blankLine); - } - - if (comments.length) Array.prototype.push.apply(this.props, comments); - offset = this.node.range.end; - } else { - if (inlineComment) { - var c = comments[0]; - this.props.push(c); - offset = c.end; - } else { - offset = Node.endOfLine(src, start + 1); - } - } - - var end = this.node ? this.node.valueRange.end : offset; - this.valueRange = new Range(start, end); - return offset; - } - }, { - key: "setOrigRanges", - value: function setOrigRanges(cr, offset) { - offset = _get(_getPrototypeOf(CollectionItem.prototype), "setOrigRanges", this).call(this, cr, offset); - return this.node ? this.node.setOrigRanges(cr, offset) : offset; - } - }, { - key: "toString", - value: function toString() { - var src = this.context.src, - node = this.node, - range = this.range, - value = this.value; - if (value != null) return value; - var str = node ? src.slice(range.start, node.range.start) + String(node) : src.slice(range.start, range.end); - return Node.addStringTerminator(src, range.end, str); - } - }]); - - return CollectionItem; -}(Node); - -var Comment = /*#__PURE__*/function (_Node) { - _inherits(Comment, _Node); - - var _super = _createSuper(Comment); - - function Comment() { - _classCallCheck(this, Comment); - - return _super.call(this, Type.COMMENT); - } - /** - * Parses a comment line from the source - * - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this scalar - */ - - - _createClass(Comment, [{ - key: "parse", - value: function parse(context, start) { - this.context = context; - var offset = this.parseComment(start); - this.range = new Range(start, offset); - return offset; - } - }]); - - return Comment; -}(Node); - -function grabCollectionEndComments(node) { - var cnode = node; - - while (cnode instanceof CollectionItem) { - cnode = cnode.node; - } - - if (!(cnode instanceof Collection)) return null; - var len = cnode.items.length; - var ci = -1; - - for (var i = len - 1; i >= 0; --i) { - var n = cnode.items[i]; - - if (n.type === Type.COMMENT) { - // Keep sufficiently indented comments with preceding node - var _n$context = n.context, - indent = _n$context.indent, - lineStart = _n$context.lineStart; - if (indent > 0 && n.range.start >= lineStart + indent) break; - ci = i; - } else if (n.type === Type.BLANK_LINE) ci = i;else break; - } - - if (ci === -1) return null; - var ca = cnode.items.splice(ci, len - ci); - var prevEnd = ca[0].range.start; - - while (true) { - cnode.range.end = prevEnd; - if (cnode.valueRange && cnode.valueRange.end > prevEnd) cnode.valueRange.end = prevEnd; - if (cnode === node) break; - cnode = cnode.context.parent; - } - - return ca; -} -var Collection = /*#__PURE__*/function (_Node) { - _inherits(Collection, _Node); - - var _super = _createSuper(Collection); - - function Collection(firstItem) { - var _this; - - _classCallCheck(this, Collection); - - _this = _super.call(this, firstItem.type === Type.SEQ_ITEM ? Type.SEQ : Type.MAP); - - for (var i = firstItem.props.length - 1; i >= 0; --i) { - if (firstItem.props[i].start < firstItem.context.lineStart) { - // props on previous line are assumed by the collection - _this.props = firstItem.props.slice(0, i + 1); - firstItem.props = firstItem.props.slice(i + 1); - var itemRange = firstItem.props[0] || firstItem.valueRange; - firstItem.range.start = itemRange.start; - break; - } - } - - _this.items = [firstItem]; - var ec = grabCollectionEndComments(firstItem); - if (ec) Array.prototype.push.apply(_this.items, ec); - return _this; - } - - _createClass(Collection, [{ - key: "includesTrailingLines", - get: function get() { - return this.items.length > 0; - } - /** - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this - */ - - }, { - key: "parse", - value: function parse(context, start) { - this.context = context; - var parseNode = context.parseNode, - src = context.src; // It's easier to recalculate lineStart here rather than tracking down the - // last context from which to read it -- eemeli/yaml#2 - - var lineStart = Node.startOfLine(src, start); - var firstItem = this.items[0]; // First-item context needs to be correct for later comment handling - // -- eemeli/yaml#17 - - firstItem.context.parent = this; - this.valueRange = Range.copy(firstItem.valueRange); - var indent = firstItem.range.start - firstItem.context.lineStart; - var offset = start; - offset = Node.normalizeOffset(src, offset); - var ch = src[offset]; - var atLineStart = Node.endOfWhiteSpace(src, lineStart) === offset; - var prevIncludesTrailingLines = false; - - while (ch) { - while (ch === '\n' || ch === '#') { - if (atLineStart && ch === '\n' && !prevIncludesTrailingLines) { - var blankLine = new BlankLine(); - offset = blankLine.parse({ - src: src - }, offset); - this.valueRange.end = offset; - - if (offset >= src.length) { - ch = null; - break; - } - - this.items.push(blankLine); - offset -= 1; // blankLine.parse() consumes terminal newline - } else if (ch === '#') { - if (offset < lineStart + indent && !Collection.nextContentHasIndent(src, offset, indent)) { - return offset; - } - - var comment = new Comment(); - offset = comment.parse({ - indent: indent, - lineStart: lineStart, - src: src - }, offset); - this.items.push(comment); - this.valueRange.end = offset; - - if (offset >= src.length) { - ch = null; - break; - } - } - - lineStart = offset + 1; - offset = Node.endOfIndent(src, lineStart); - - if (Node.atBlank(src, offset)) { - var wsEnd = Node.endOfWhiteSpace(src, offset); - var next = src[wsEnd]; - - if (!next || next === '\n' || next === '#') { - offset = wsEnd; - } - } - - ch = src[offset]; - atLineStart = true; - } - - if (!ch) { - break; - } - - if (offset !== lineStart + indent && (atLineStart || ch !== ':')) { - if (offset < lineStart + indent) { - if (lineStart > start) offset = lineStart; - break; - } else if (!this.error) { - var msg = 'All collection items must start at the same column'; - this.error = new YAMLSyntaxError(this, msg); - } - } - - if (firstItem.type === Type.SEQ_ITEM) { - if (ch !== '-') { - if (lineStart > start) offset = lineStart; - break; - } - } else if (ch === '-' && !this.error) { - // map key may start with -, as long as it's followed by a non-whitespace char - var _next = src[offset + 1]; - - if (!_next || _next === '\n' || _next === '\t' || _next === ' ') { - var _msg = 'A collection cannot be both a mapping and a sequence'; - this.error = new YAMLSyntaxError(this, _msg); - } - } - - var node = parseNode({ - atLineStart: atLineStart, - inCollection: true, - indent: indent, - lineStart: lineStart, - parent: this - }, offset); - if (!node) return offset; // at next document start - - this.items.push(node); - this.valueRange.end = node.valueRange.end; - offset = Node.normalizeOffset(src, node.range.end); - ch = src[offset]; - atLineStart = false; - prevIncludesTrailingLines = node.includesTrailingLines; // Need to reset lineStart and atLineStart here if preceding node's range - // has advanced to check the current line's indentation level - // -- eemeli/yaml#10 & eemeli/yaml#38 - - if (ch) { - var ls = offset - 1; - var prev = src[ls]; - - while (prev === ' ' || prev === '\t') { - prev = src[--ls]; - } - - if (prev === '\n') { - lineStart = ls + 1; - atLineStart = true; - } - } - - var ec = grabCollectionEndComments(node); - if (ec) Array.prototype.push.apply(this.items, ec); - } - - return offset; - } - }, { - key: "setOrigRanges", - value: function setOrigRanges(cr, offset) { - offset = _get(_getPrototypeOf(Collection.prototype), "setOrigRanges", this).call(this, cr, offset); - this.items.forEach(function (node) { - offset = node.setOrigRanges(cr, offset); - }); - return offset; - } - }, { - key: "toString", - value: function toString() { - var src = this.context.src, - items = this.items, - range = this.range, - value = this.value; - if (value != null) return value; - var str = src.slice(range.start, items[0].range.start) + String(items[0]); - - for (var i = 1; i < items.length; ++i) { - var item = items[i]; - var _item$context = item.context, - atLineStart = _item$context.atLineStart, - indent = _item$context.indent; - if (atLineStart) for (var _i = 0; _i < indent; ++_i) { - str += ' '; - } - str += String(item); - } - - return Node.addStringTerminator(src, range.end, str); - } - }], [{ - key: "nextContentHasIndent", - value: function nextContentHasIndent(src, offset, indent) { - var lineStart = Node.endOfLine(src, offset) + 1; - offset = Node.endOfWhiteSpace(src, lineStart); - var ch = src[offset]; - if (!ch) return false; - if (offset >= lineStart + indent) return true; - if (ch !== '#' && ch !== '\n') return false; - return Collection.nextContentHasIndent(src, offset, indent); - } - }]); - - return Collection; -}(Node); - -var Directive = /*#__PURE__*/function (_Node) { - _inherits(Directive, _Node); - - var _super = _createSuper(Directive); - - function Directive() { - var _this; - - _classCallCheck(this, Directive); - - _this = _super.call(this, Type.DIRECTIVE); - _this.name = null; - return _this; - } - - _createClass(Directive, [{ - key: "parameters", - get: function get() { - var raw = this.rawValue; - return raw ? raw.trim().split(/[ \t]+/) : []; - } - }, { - key: "parseName", - value: function parseName(start) { - var src = this.context.src; - var offset = start; - var ch = src[offset]; - - while (ch && ch !== '\n' && ch !== '\t' && ch !== ' ') { - ch = src[offset += 1]; - } - - this.name = src.slice(start, offset); - return offset; - } - }, { - key: "parseParameters", - value: function parseParameters(start) { - var src = this.context.src; - var offset = start; - var ch = src[offset]; - - while (ch && ch !== '\n' && ch !== '#') { - ch = src[offset += 1]; - } - - this.valueRange = new Range(start, offset); - return offset; - } - }, { - key: "parse", - value: function parse(context, start) { - this.context = context; - var offset = this.parseName(start + 1); - offset = this.parseParameters(offset); - offset = this.parseComment(offset); - this.range = new Range(start, offset); - return offset; - } - }]); - - return Directive; -}(Node); - -var Document = /*#__PURE__*/function (_Node) { - _inherits(Document, _Node); - - var _super = _createSuper(Document); - - function Document() { - var _this; - - _classCallCheck(this, Document); - - _this = _super.call(this, Type.DOCUMENT); - _this.directives = null; - _this.contents = null; - _this.directivesEndMarker = null; - _this.documentEndMarker = null; - return _this; - } - - _createClass(Document, [{ - key: "parseDirectives", - value: function parseDirectives(start) { - var src = this.context.src; - this.directives = []; - var atLineStart = true; - var hasDirectives = false; - var offset = start; - - while (!Node.atDocumentBoundary(src, offset, Char.DIRECTIVES_END)) { - offset = Document.startCommentOrEndBlankLine(src, offset); - - switch (src[offset]) { - case '\n': - if (atLineStart) { - var blankLine = new BlankLine(); - offset = blankLine.parse({ - src: src - }, offset); - - if (offset < src.length) { - this.directives.push(blankLine); - } - } else { - offset += 1; - atLineStart = true; - } - - break; - - case '#': - { - var comment = new Comment(); - offset = comment.parse({ - src: src - }, offset); - this.directives.push(comment); - atLineStart = false; - } - break; - - case '%': - { - var directive = new Directive(); - offset = directive.parse({ - parent: this, - src: src - }, offset); - this.directives.push(directive); - hasDirectives = true; - atLineStart = false; - } - break; - - default: - if (hasDirectives) { - this.error = new YAMLSemanticError(this, 'Missing directives-end indicator line'); - } else if (this.directives.length > 0) { - this.contents = this.directives; - this.directives = []; - } - - return offset; - } - } - - if (src[offset]) { - this.directivesEndMarker = new Range(offset, offset + 3); - return offset + 3; - } - - if (hasDirectives) { - this.error = new YAMLSemanticError(this, 'Missing directives-end indicator line'); - } else if (this.directives.length > 0) { - this.contents = this.directives; - this.directives = []; - } - - return offset; - } - }, { - key: "parseContents", - value: function parseContents(start) { - var _this$context = this.context, - parseNode = _this$context.parseNode, - src = _this$context.src; - if (!this.contents) this.contents = []; - var lineStart = start; - - while (src[lineStart - 1] === '-') { - lineStart -= 1; - } - - var offset = Node.endOfWhiteSpace(src, start); - var atLineStart = lineStart === start; - this.valueRange = new Range(offset); - - while (!Node.atDocumentBoundary(src, offset, Char.DOCUMENT_END)) { - switch (src[offset]) { - case '\n': - if (atLineStart) { - var blankLine = new BlankLine(); - offset = blankLine.parse({ - src: src - }, offset); - - if (offset < src.length) { - this.contents.push(blankLine); - } - } else { - offset += 1; - atLineStart = true; - } - - lineStart = offset; - break; - - case '#': - { - var comment = new Comment(); - offset = comment.parse({ - src: src - }, offset); - this.contents.push(comment); - atLineStart = false; - } - break; - - default: - { - var iEnd = Node.endOfIndent(src, offset); - var context = { - atLineStart: atLineStart, - indent: -1, - inFlow: false, - inCollection: false, - lineStart: lineStart, - parent: this - }; - var node = parseNode(context, iEnd); - if (!node) return this.valueRange.end = iEnd; // at next document start - - this.contents.push(node); - offset = node.range.end; - atLineStart = false; - var ec = grabCollectionEndComments(node); - if (ec) Array.prototype.push.apply(this.contents, ec); - } - } - - offset = Document.startCommentOrEndBlankLine(src, offset); - } - - this.valueRange.end = offset; - - if (src[offset]) { - this.documentEndMarker = new Range(offset, offset + 3); - offset += 3; - - if (src[offset]) { - offset = Node.endOfWhiteSpace(src, offset); - - if (src[offset] === '#') { - var _comment = new Comment(); - - offset = _comment.parse({ - src: src - }, offset); - this.contents.push(_comment); - } - - switch (src[offset]) { - case '\n': - offset += 1; - break; - - case undefined: - break; - - default: - this.error = new YAMLSyntaxError(this, 'Document end marker line cannot have a non-comment suffix'); - } - } - } - - return offset; - } - /** - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this - */ - - }, { - key: "parse", - value: function parse(context, start) { - context.root = this; - this.context = context; - var src = context.src; - var offset = src.charCodeAt(start) === 0xfeff ? start + 1 : start; // skip BOM - - offset = this.parseDirectives(offset); - offset = this.parseContents(offset); - return offset; - } - }, { - key: "setOrigRanges", - value: function setOrigRanges(cr, offset) { - offset = _get(_getPrototypeOf(Document.prototype), "setOrigRanges", this).call(this, cr, offset); - this.directives.forEach(function (node) { - offset = node.setOrigRanges(cr, offset); - }); - if (this.directivesEndMarker) offset = this.directivesEndMarker.setOrigRange(cr, offset); - this.contents.forEach(function (node) { - offset = node.setOrigRanges(cr, offset); - }); - if (this.documentEndMarker) offset = this.documentEndMarker.setOrigRange(cr, offset); - return offset; - } - }, { - key: "toString", - value: function toString() { - var contents = this.contents, - directives = this.directives, - value = this.value; - if (value != null) return value; - var str = directives.join(''); - - if (contents.length > 0) { - if (directives.length > 0 || contents[0].type === Type.COMMENT) str += '---\n'; - str += contents.join(''); - } - - if (str[str.length - 1] !== '\n') str += '\n'; - return str; - } - }], [{ - key: "startCommentOrEndBlankLine", - value: function startCommentOrEndBlankLine(src, start) { - var offset = Node.endOfWhiteSpace(src, start); - var ch = src[offset]; - return ch === '#' || ch === '\n' ? offset : start; - } - }]); - - return Document; -}(Node); - -var Alias = /*#__PURE__*/function (_Node) { - _inherits(Alias, _Node); - - var _super = _createSuper(Alias); - - function Alias() { - _classCallCheck(this, Alias); - - return _super.apply(this, arguments); - } - - _createClass(Alias, [{ - key: "parse", - value: - /** - * Parses an *alias from the source - * - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this scalar - */ - function parse(context, start) { - this.context = context; - var src = context.src; - var offset = Node.endOfIdentifier(src, start + 1); - this.valueRange = new Range(start + 1, offset); - offset = Node.endOfWhiteSpace(src, offset); - offset = this.parseComment(offset); - return offset; - } - }]); - - return Alias; -}(Node); - -var Chomp = { - CLIP: 'CLIP', - KEEP: 'KEEP', - STRIP: 'STRIP' -}; -var BlockValue = /*#__PURE__*/function (_Node) { - _inherits(BlockValue, _Node); - - var _super = _createSuper(BlockValue); - - function BlockValue(type, props) { - var _this; - - _classCallCheck(this, BlockValue); - - _this = _super.call(this, type, props); - _this.blockIndent = null; - _this.chomping = Chomp.CLIP; - _this.header = null; - return _this; - } - - _createClass(BlockValue, [{ - key: "includesTrailingLines", - get: function get() { - return this.chomping === Chomp.KEEP; - } - }, { - key: "strValue", - get: function get() { - if (!this.valueRange || !this.context) return null; - var _this$valueRange = this.valueRange, - start = _this$valueRange.start, - end = _this$valueRange.end; - var _this$context = this.context, - indent = _this$context.indent, - src = _this$context.src; - if (this.valueRange.isEmpty()) return ''; - var lastNewLine = null; - var ch = src[end - 1]; - - while (ch === '\n' || ch === '\t' || ch === ' ') { - end -= 1; - - if (end <= start) { - if (this.chomping === Chomp.KEEP) break;else return ''; // probably never happens - } - - if (ch === '\n') lastNewLine = end; - ch = src[end - 1]; - } - - var keepStart = end + 1; - - if (lastNewLine) { - if (this.chomping === Chomp.KEEP) { - keepStart = lastNewLine; - end = this.valueRange.end; - } else { - end = lastNewLine; - } - } - - var bi = indent + this.blockIndent; - var folded = this.type === Type.BLOCK_FOLDED; - var atStart = true; - var str = ''; - var sep = ''; - var prevMoreIndented = false; - - for (var i = start; i < end; ++i) { - for (var j = 0; j < bi; ++j) { - if (src[i] !== ' ') break; - i += 1; - } - - var _ch = src[i]; - - if (_ch === '\n') { - if (sep === '\n') str += '\n';else sep = '\n'; - } else { - var lineEnd = Node.endOfLine(src, i); - var line = src.slice(i, lineEnd); - i = lineEnd; - - if (folded && (_ch === ' ' || _ch === '\t') && i < keepStart) { - if (sep === ' ') sep = '\n';else if (!prevMoreIndented && !atStart && sep === '\n') sep = '\n\n'; - str += sep + line; //+ ((lineEnd < end && src[lineEnd]) || '') - - sep = lineEnd < end && src[lineEnd] || ''; - prevMoreIndented = true; - } else { - str += sep + line; - sep = folded && i < keepStart ? ' ' : '\n'; - prevMoreIndented = false; - } - - if (atStart && line !== '') atStart = false; - } - } - - return this.chomping === Chomp.STRIP ? str : str + '\n'; - } - }, { - key: "parseBlockHeader", - value: function parseBlockHeader(start) { - var src = this.context.src; - var offset = start + 1; - var bi = ''; - - while (true) { - var ch = src[offset]; - - switch (ch) { - case '-': - this.chomping = Chomp.STRIP; - break; - - case '+': - this.chomping = Chomp.KEEP; - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - bi += ch; - break; - - default: - this.blockIndent = Number(bi) || null; - this.header = new Range(start, offset); - return offset; - } - - offset += 1; - } - } - }, { - key: "parseBlockValue", - value: function parseBlockValue(start) { - var _this$context2 = this.context, - indent = _this$context2.indent, - src = _this$context2.src; - var explicit = !!this.blockIndent; - var offset = start; - var valueEnd = start; - var minBlockIndent = 1; - - for (var ch = src[offset]; ch === '\n'; ch = src[offset]) { - offset += 1; - if (Node.atDocumentBoundary(src, offset)) break; - var end = Node.endOfBlockIndent(src, indent, offset); // should not include tab? - - if (end === null) break; - var _ch2 = src[end]; - var lineIndent = end - (offset + indent); - - if (!this.blockIndent) { - // no explicit block indent, none yet detected - if (src[end] !== '\n') { - // first line with non-whitespace content - if (lineIndent < minBlockIndent) { - var msg = 'Block scalars with more-indented leading empty lines must use an explicit indentation indicator'; - this.error = new YAMLSemanticError(this, msg); - } - - this.blockIndent = lineIndent; - } else if (lineIndent > minBlockIndent) { - // empty line with more whitespace - minBlockIndent = lineIndent; - } - } else if (_ch2 && _ch2 !== '\n' && lineIndent < this.blockIndent) { - if (src[end] === '#') break; - - if (!this.error) { - var _src = explicit ? 'explicit indentation indicator' : 'first line'; - - var _msg = "Block scalars must not be less indented than their ".concat(_src); - - this.error = new YAMLSemanticError(this, _msg); - } - } - - if (src[end] === '\n') { - offset = end; - } else { - offset = valueEnd = Node.endOfLine(src, end); - } - } - - if (this.chomping !== Chomp.KEEP) { - offset = src[valueEnd] ? valueEnd + 1 : valueEnd; - } - - this.valueRange = new Range(start + 1, offset); - return offset; - } - /** - * Parses a block value from the source - * - * Accepted forms are: - * ``` - * BS - * block - * lines - * - * BS #comment - * block - * lines - * ``` - * where the block style BS matches the regexp `[|>][-+1-9]*` and block lines - * are empty or have an indent level greater than `indent`. - * - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this block - */ - - }, { - key: "parse", - value: function parse(context, start) { - this.context = context; - var src = context.src; - var offset = this.parseBlockHeader(start); - offset = Node.endOfWhiteSpace(src, offset); - offset = this.parseComment(offset); - offset = this.parseBlockValue(offset); - return offset; - } - }, { - key: "setOrigRanges", - value: function setOrigRanges(cr, offset) { - offset = _get(_getPrototypeOf(BlockValue.prototype), "setOrigRanges", this).call(this, cr, offset); - return this.header ? this.header.setOrigRange(cr, offset) : offset; - } - }]); - - return BlockValue; -}(Node); - -var FlowCollection = /*#__PURE__*/function (_Node) { - _inherits(FlowCollection, _Node); - - var _super = _createSuper(FlowCollection); - - function FlowCollection(type, props) { - var _this; - - _classCallCheck(this, FlowCollection); - - _this = _super.call(this, type, props); - _this.items = null; - return _this; - } - - _createClass(FlowCollection, [{ - key: "prevNodeIsJsonLike", - value: function prevNodeIsJsonLike() { - var idx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.items.length; - var node = this.items[idx - 1]; - return !!node && (node.jsonLike || node.type === Type.COMMENT && this.prevNodeIsJsonLike(idx - 1)); - } - /** - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this - */ - - }, { - key: "parse", - value: function parse(context, start) { - this.context = context; - var parseNode = context.parseNode, - src = context.src; - var indent = context.indent, - lineStart = context.lineStart; - var char = src[start]; // { or [ - - this.items = [{ - char: char, - offset: start - }]; - var offset = Node.endOfWhiteSpace(src, start + 1); - char = src[offset]; - - while (char && char !== ']' && char !== '}') { - switch (char) { - case '\n': - { - lineStart = offset + 1; - var wsEnd = Node.endOfWhiteSpace(src, lineStart); - - if (src[wsEnd] === '\n') { - var blankLine = new BlankLine(); - lineStart = blankLine.parse({ - src: src - }, lineStart); - this.items.push(blankLine); - } - - offset = Node.endOfIndent(src, lineStart); - - if (offset <= lineStart + indent) { - char = src[offset]; - - if (offset < lineStart + indent || char !== ']' && char !== '}') { - var msg = 'Insufficient indentation in flow collection'; - this.error = new YAMLSemanticError(this, msg); - } - } - } - break; - - case ',': - { - this.items.push({ - char: char, - offset: offset - }); - offset += 1; - } - break; - - case '#': - { - var comment = new Comment(); - offset = comment.parse({ - src: src - }, offset); - this.items.push(comment); - } - break; - - case '?': - case ':': - { - var next = src[offset + 1]; - - if (next === '\n' || next === '\t' || next === ' ' || next === ',' || // in-flow : after JSON-like key does not need to be followed by whitespace - char === ':' && this.prevNodeIsJsonLike()) { - this.items.push({ - char: char, - offset: offset - }); - offset += 1; - break; - } - } - // fallthrough - - default: - { - var node = parseNode({ - atLineStart: false, - inCollection: false, - inFlow: true, - indent: -1, - lineStart: lineStart, - parent: this - }, offset); - - if (!node) { - // at next document start - this.valueRange = new Range(start, offset); - return offset; - } - - this.items.push(node); - offset = Node.normalizeOffset(src, node.range.end); - } - } - - offset = Node.endOfWhiteSpace(src, offset); - char = src[offset]; - } - - this.valueRange = new Range(start, offset + 1); - - if (char) { - this.items.push({ - char: char, - offset: offset - }); - offset = Node.endOfWhiteSpace(src, offset + 1); - offset = this.parseComment(offset); - } - - return offset; - } - }, { - key: "setOrigRanges", - value: function setOrigRanges(cr, offset) { - offset = _get(_getPrototypeOf(FlowCollection.prototype), "setOrigRanges", this).call(this, cr, offset); - this.items.forEach(function (node) { - if (node instanceof Node) { - offset = node.setOrigRanges(cr, offset); - } else if (cr.length === 0) { - node.origOffset = node.offset; - } else { - var i = offset; - - while (i < cr.length) { - if (cr[i] > node.offset) break;else ++i; - } - - node.origOffset = node.offset + i; - offset = i; - } - }); - return offset; - } - }, { - key: "toString", - value: function toString() { - var src = this.context.src, - items = this.items, - range = this.range, - value = this.value; - if (value != null) return value; - var nodes = items.filter(function (item) { - return item instanceof Node; - }); - var str = ''; - var prevEnd = range.start; - nodes.forEach(function (node) { - var prefix = src.slice(prevEnd, node.range.start); - prevEnd = node.range.end; - str += prefix + String(node); - - if (str[str.length - 1] === '\n' && src[prevEnd - 1] !== '\n' && src[prevEnd] === '\n') { - // Comment range does not include the terminal newline, but its - // stringified value does. Without this fix, newlines at comment ends - // get duplicated. - prevEnd += 1; - } - }); - str += src.slice(prevEnd, range.end); - return Node.addStringTerminator(src, range.end, str); - } - }]); - - return FlowCollection; -}(Node); - -var QuoteDouble = /*#__PURE__*/function (_Node) { - _inherits(QuoteDouble, _Node); - - var _super = _createSuper(QuoteDouble); - - function QuoteDouble() { - _classCallCheck(this, QuoteDouble); - - return _super.apply(this, arguments); - } - - _createClass(QuoteDouble, [{ - key: "strValue", - get: - /** - * @returns {string | { str: string, errors: YAMLSyntaxError[] }} - */ - function get() { - if (!this.valueRange || !this.context) return null; - var errors = []; - var _this$valueRange = this.valueRange, - start = _this$valueRange.start, - end = _this$valueRange.end; - var _this$context = this.context, - indent = _this$context.indent, - src = _this$context.src; - if (src[end - 1] !== '"') errors.push(new YAMLSyntaxError(this, 'Missing closing "quote')); // Using String#replace is too painful with escaped newlines preceded by - // escaped backslashes; also, this should be faster. - - var str = ''; - - for (var i = start + 1; i < end - 1; ++i) { - var ch = src[i]; - - if (ch === '\n') { - if (Node.atDocumentBoundary(src, i + 1)) errors.push(new YAMLSemanticError(this, 'Document boundary indicators are not allowed within string values')); - - var _Node$foldNewline = Node.foldNewline(src, i, indent), - fold = _Node$foldNewline.fold, - offset = _Node$foldNewline.offset, - error = _Node$foldNewline.error; - - str += fold; - i = offset; - if (error) errors.push(new YAMLSemanticError(this, 'Multi-line double-quoted string needs to be sufficiently indented')); - } else if (ch === '\\') { - i += 1; - - switch (src[i]) { - case '0': - str += '\0'; - break; - // null character - - case 'a': - str += '\x07'; - break; - // bell character - - case 'b': - str += '\b'; - break; - // backspace - - case 'e': - str += '\x1b'; - break; - // escape character - - case 'f': - str += '\f'; - break; - // form feed - - case 'n': - str += '\n'; - break; - // line feed - - case 'r': - str += '\r'; - break; - // carriage return - - case 't': - str += '\t'; - break; - // horizontal tab - - case 'v': - str += '\v'; - break; - // vertical tab - - case 'N': - str += "\x85"; - break; - // Unicode next line - - case '_': - str += "\xA0"; - break; - // Unicode non-breaking space - - case 'L': - str += "\u2028"; - break; - // Unicode line separator - - case 'P': - str += "\u2029"; - break; - // Unicode paragraph separator - - case ' ': - str += ' '; - break; - - case '"': - str += '"'; - break; - - case '/': - str += '/'; - break; - - case '\\': - str += '\\'; - break; - - case '\t': - str += '\t'; - break; - - case 'x': - str += this.parseCharCode(i + 1, 2, errors); - i += 2; - break; - - case 'u': - str += this.parseCharCode(i + 1, 4, errors); - i += 4; - break; - - case 'U': - str += this.parseCharCode(i + 1, 8, errors); - i += 8; - break; - - case '\n': - // skip escaped newlines, but still trim the following line - while (src[i + 1] === ' ' || src[i + 1] === '\t') { - i += 1; - } - - break; - - default: - errors.push(new YAMLSyntaxError(this, "Invalid escape sequence ".concat(src.substr(i - 1, 2)))); - str += '\\' + src[i]; - } - } else if (ch === ' ' || ch === '\t') { - // trim trailing whitespace - var wsStart = i; - var next = src[i + 1]; - - while (next === ' ' || next === '\t') { - i += 1; - next = src[i + 1]; - } - - if (next !== '\n') str += i > wsStart ? src.slice(wsStart, i + 1) : ch; - } else { - str += ch; - } - } - - return errors.length > 0 ? { - errors: errors, - str: str - } : str; - } - }, { - key: "parseCharCode", - value: function parseCharCode(offset, length, errors) { - var src = this.context.src; - var cc = src.substr(offset, length); - var ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc); - var code = ok ? parseInt(cc, 16) : NaN; - - if (isNaN(code)) { - errors.push(new YAMLSyntaxError(this, "Invalid escape sequence ".concat(src.substr(offset - 2, length + 2)))); - return src.substr(offset - 2, length + 2); - } - - return String.fromCodePoint(code); - } - /** - * Parses a "double quoted" value from the source - * - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this scalar - */ - - }, { - key: "parse", - value: function parse(context, start) { - this.context = context; - var src = context.src; - var offset = QuoteDouble.endOfQuote(src, start + 1); - this.valueRange = new Range(start, offset); - offset = Node.endOfWhiteSpace(src, offset); - offset = this.parseComment(offset); - return offset; - } - }], [{ - key: "endOfQuote", - value: function endOfQuote(src, offset) { - var ch = src[offset]; - - while (ch && ch !== '"') { - offset += ch === '\\' ? 2 : 1; - ch = src[offset]; - } - - return offset + 1; - } - }]); - - return QuoteDouble; -}(Node); - -var QuoteSingle = /*#__PURE__*/function (_Node) { - _inherits(QuoteSingle, _Node); - - var _super = _createSuper(QuoteSingle); - - function QuoteSingle() { - _classCallCheck(this, QuoteSingle); - - return _super.apply(this, arguments); - } - - _createClass(QuoteSingle, [{ - key: "strValue", - get: - /** - * @returns {string | { str: string, errors: YAMLSyntaxError[] }} - */ - function get() { - if (!this.valueRange || !this.context) return null; - var errors = []; - var _this$valueRange = this.valueRange, - start = _this$valueRange.start, - end = _this$valueRange.end; - var _this$context = this.context, - indent = _this$context.indent, - src = _this$context.src; - if (src[end - 1] !== "'") errors.push(new YAMLSyntaxError(this, "Missing closing 'quote")); - var str = ''; - - for (var i = start + 1; i < end - 1; ++i) { - var ch = src[i]; - - if (ch === '\n') { - if (Node.atDocumentBoundary(src, i + 1)) errors.push(new YAMLSemanticError(this, 'Document boundary indicators are not allowed within string values')); - - var _Node$foldNewline = Node.foldNewline(src, i, indent), - fold = _Node$foldNewline.fold, - offset = _Node$foldNewline.offset, - error = _Node$foldNewline.error; - - str += fold; - i = offset; - if (error) errors.push(new YAMLSemanticError(this, 'Multi-line single-quoted string needs to be sufficiently indented')); - } else if (ch === "'") { - str += ch; - i += 1; - if (src[i] !== "'") errors.push(new YAMLSyntaxError(this, 'Unescaped single quote? This should not happen.')); - } else if (ch === ' ' || ch === '\t') { - // trim trailing whitespace - var wsStart = i; - var next = src[i + 1]; - - while (next === ' ' || next === '\t') { - i += 1; - next = src[i + 1]; - } - - if (next !== '\n') str += i > wsStart ? src.slice(wsStart, i + 1) : ch; - } else { - str += ch; - } - } - - return errors.length > 0 ? { - errors: errors, - str: str - } : str; - } - /** - * Parses a 'single quoted' value from the source - * - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this scalar - */ - - }, { - key: "parse", - value: function parse(context, start) { - this.context = context; - var src = context.src; - var offset = QuoteSingle.endOfQuote(src, start + 1); - this.valueRange = new Range(start, offset); - offset = Node.endOfWhiteSpace(src, offset); - offset = this.parseComment(offset); - return offset; - } - }], [{ - key: "endOfQuote", - value: function endOfQuote(src, offset) { - var ch = src[offset]; - - while (ch) { - if (ch === "'") { - if (src[offset + 1] !== "'") break; - ch = src[offset += 2]; - } else { - ch = src[offset += 1]; - } - } - - return offset + 1; - } - }]); - - return QuoteSingle; -}(Node); - -function createNewNode(type, props) { - switch (type) { - case Type.ALIAS: - return new Alias(type, props); - - case Type.BLOCK_FOLDED: - case Type.BLOCK_LITERAL: - return new BlockValue(type, props); - - case Type.FLOW_MAP: - case Type.FLOW_SEQ: - return new FlowCollection(type, props); - - case Type.MAP_KEY: - case Type.MAP_VALUE: - case Type.SEQ_ITEM: - return new CollectionItem(type, props); - - case Type.COMMENT: - case Type.PLAIN: - return new PlainValue(type, props); - - case Type.QUOTE_DOUBLE: - return new QuoteDouble(type, props); - - case Type.QUOTE_SINGLE: - return new QuoteSingle(type, props); - - /* istanbul ignore next */ - - default: - return null; - // should never happen - } -} -/** - * @param {boolean} atLineStart - Node starts at beginning of line - * @param {boolean} inFlow - true if currently in a flow context - * @param {boolean} inCollection - true if currently in a collection context - * @param {number} indent - Current level of indentation - * @param {number} lineStart - Start of the current line - * @param {Node} parent - The parent of the node - * @param {string} src - Source of the YAML document - */ - - -var ParseContext = /*#__PURE__*/function () { - function ParseContext() { - var _this = this; - - var orig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - - var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, - atLineStart = _ref.atLineStart, - inCollection = _ref.inCollection, - inFlow = _ref.inFlow, - indent = _ref.indent, - lineStart = _ref.lineStart, - parent = _ref.parent; - - _classCallCheck(this, ParseContext); - - _defineProperty(this, "parseNode", function (overlay, start) { - if (Node.atDocumentBoundary(_this.src, start)) return null; - var context = new ParseContext(_this, overlay); - - var _context$parseProps = context.parseProps(start), - props = _context$parseProps.props, - type = _context$parseProps.type, - valueStart = _context$parseProps.valueStart; - - var node = createNewNode(type, props); - var offset = node.parse(context, valueStart); - node.range = new Range(start, offset); - /* istanbul ignore if */ - - if (offset <= start) { - // This should never happen, but if it does, let's make sure to at least - // step one character forward to avoid a busy loop. - node.error = new Error("Node#parse consumed no characters"); - node.error.parseEnd = offset; - node.error.source = node; - node.range.end = start + 1; - } - - if (context.nodeStartsCollection(node)) { - if (!node.error && !context.atLineStart && context.parent.type === Type.DOCUMENT) { - node.error = new YAMLSyntaxError(node, 'Block collection must not have preceding content here (e.g. directives-end indicator)'); - } - - var collection = new Collection(node); - offset = collection.parse(new ParseContext(context), offset); - collection.range = new Range(start, offset); - return collection; - } - - return node; - }); - - this.atLineStart = atLineStart != null ? atLineStart : orig.atLineStart || false; - this.inCollection = inCollection != null ? inCollection : orig.inCollection || false; - this.inFlow = inFlow != null ? inFlow : orig.inFlow || false; - this.indent = indent != null ? indent : orig.indent; - this.lineStart = lineStart != null ? lineStart : orig.lineStart; - this.parent = parent != null ? parent : orig.parent || {}; - this.root = orig.root; - this.src = orig.src; - } - - _createClass(ParseContext, [{ - key: "nodeStartsCollection", - value: function nodeStartsCollection(node) { - var inCollection = this.inCollection, - inFlow = this.inFlow, - src = this.src; - if (inCollection || inFlow) return false; - if (node instanceof CollectionItem) return true; // check for implicit key - - var offset = node.range.end; - if (src[offset] === '\n' || src[offset - 1] === '\n') return false; - offset = Node.endOfWhiteSpace(src, offset); - return src[offset] === ':'; - } // Anchor and tag are before type, which determines the node implementation - // class; hence this intermediate step. - - }, { - key: "parseProps", - value: function parseProps(offset) { - var inFlow = this.inFlow, - parent = this.parent, - src = this.src; - var props = []; - var lineHasProps = false; - offset = this.atLineStart ? Node.endOfIndent(src, offset) : Node.endOfWhiteSpace(src, offset); - var ch = src[offset]; - - while (ch === Char.ANCHOR || ch === Char.COMMENT || ch === Char.TAG || ch === '\n') { - if (ch === '\n') { - var inEnd = offset; - var lineStart = void 0; - - do { - lineStart = inEnd + 1; - inEnd = Node.endOfIndent(src, lineStart); - } while (src[inEnd] === '\n'); - - var indentDiff = inEnd - (lineStart + this.indent); - var noIndicatorAsIndent = parent.type === Type.SEQ_ITEM && parent.context.atLineStart; - if (src[inEnd] !== '#' && !Node.nextNodeIsIndented(src[inEnd], indentDiff, !noIndicatorAsIndent)) break; - this.atLineStart = true; - this.lineStart = lineStart; - lineHasProps = false; - offset = inEnd; - } else if (ch === Char.COMMENT) { - var end = Node.endOfLine(src, offset + 1); - props.push(new Range(offset, end)); - offset = end; - } else { - var _end = Node.endOfIdentifier(src, offset + 1); - - if (ch === Char.TAG && src[_end] === ',' && /^[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+,\d\d\d\d(-\d\d){0,2}\/\S/.test(src.slice(offset + 1, _end + 13))) { - // Let's presume we're dealing with a YAML 1.0 domain tag here, rather - // than an empty but 'foo.bar' private-tagged node in a flow collection - // followed without whitespace by a plain string starting with a year - // or date divided by something. - _end = Node.endOfIdentifier(src, _end + 5); - } - - props.push(new Range(offset, _end)); - lineHasProps = true; - offset = Node.endOfWhiteSpace(src, _end); - } - - ch = src[offset]; - } // '- &a : b' has an anchor on an empty node - - - if (lineHasProps && ch === ':' && Node.atBlank(src, offset + 1, true)) offset -= 1; - var type = ParseContext.parseType(src, offset, inFlow); - return { - props: props, - type: type, - valueStart: offset - }; - } - /** - * Parses a node from the source - * @param {ParseContext} overlay - * @param {number} start - Index of first non-whitespace character for the node - * @returns {?Node} - null if at a document boundary - */ - - }], [{ - key: "parseType", - value: function parseType(src, offset, inFlow) { - switch (src[offset]) { - case '*': - return Type.ALIAS; - - case '>': - return Type.BLOCK_FOLDED; - - case '|': - return Type.BLOCK_LITERAL; - - case '{': - return Type.FLOW_MAP; - - case '[': - return Type.FLOW_SEQ; - - case '?': - return !inFlow && Node.atBlank(src, offset + 1, true) ? Type.MAP_KEY : Type.PLAIN; - - case ':': - return !inFlow && Node.atBlank(src, offset + 1, true) ? Type.MAP_VALUE : Type.PLAIN; - - case '-': - return !inFlow && Node.atBlank(src, offset + 1, true) ? Type.SEQ_ITEM : Type.PLAIN; - - case '"': - return Type.QUOTE_DOUBLE; - - case "'": - return Type.QUOTE_SINGLE; - - default: - return Type.PLAIN; - } - } - }]); - - return ParseContext; -}(); - -// Published as 'yaml/parse-cst' -function parse(src) { - var cr = []; - - if (src.indexOf('\r') !== -1) { - src = src.replace(/\r\n?/g, function (match, offset) { - if (match.length > 1) cr.push(offset); - return '\n'; - }); - } - - var documents = []; - var offset = 0; - - do { - var doc = new Document(); - var context = new ParseContext({ - src: src - }); - offset = doc.parse(context, offset); - documents.push(doc); - } while (offset < src.length); - - documents.setOrigRanges = function () { - if (cr.length === 0) return false; - - for (var i = 1; i < cr.length; ++i) { - cr[i] -= i; - } - - var crOffset = 0; - - for (var _i = 0; _i < documents.length; ++_i) { - crOffset = documents[_i].setOrigRanges(cr, crOffset); - } - - cr.splice(0, cr.length); - return true; - }; - - documents.toString = function () { - return documents.join('...\n'); - }; - - return documents; -} - -export { parse }; diff --git a/node_modules/yaml/browser/dist/resolveSeq-492ab440.js b/node_modules/yaml/browser/dist/resolveSeq-492ab440.js deleted file mode 100644 index 50c7c1960..000000000 --- a/node_modules/yaml/browser/dist/resolveSeq-492ab440.js +++ /dev/null @@ -1,2419 +0,0 @@ -import { c as _classCallCheck, j as _inherits, k as _createSuper, b as _createClass, e as _defineProperty, p as _assertThisInitialized, a as _typeof, q as _toArray, T as Type, _ as _createForOfIteratorHelper, l as _get, m as _getPrototypeOf, o as YAMLReferenceError, r as _possibleConstructorReturn, h as _slicedToArray, g as YAMLSemanticError, n as defaultTags, f as YAMLWarning, C as Char, Y as YAMLSyntaxError, P as PlainValue } from './PlainValue-b8036b75.js'; - -function addCommentBefore(str, indent, comment) { - if (!comment) return str; - var cc = comment.replace(/[\s\S]^/gm, "$&".concat(indent, "#")); - return "#".concat(cc, "\n").concat(indent).concat(str); -} -function addComment(str, indent, comment) { - return !comment ? str : comment.indexOf('\n') === -1 ? "".concat(str, " #").concat(comment) : "".concat(str, "\n") + comment.replace(/^/gm, "".concat(indent || '', "#")); -} - -var Node = function Node() { - _classCallCheck(this, Node); -}; - -function toJSON(value, arg, ctx) { - if (Array.isArray(value)) return value.map(function (v, i) { - return toJSON(v, String(i), ctx); - }); - - if (value && typeof value.toJSON === 'function') { - var anchor = ctx && ctx.anchors && ctx.anchors.get(value); - if (anchor) ctx.onCreate = function (res) { - anchor.res = res; - delete ctx.onCreate; - }; - var res = value.toJSON(arg, ctx); - if (anchor && ctx.onCreate) ctx.onCreate(res); - return res; - } - - if ((!ctx || !ctx.keep) && typeof value === 'bigint') return Number(value); - return value; -} - -var Scalar = /*#__PURE__*/function (_Node) { - _inherits(Scalar, _Node); - - var _super = _createSuper(Scalar); - - function Scalar(value) { - var _this; - - _classCallCheck(this, Scalar); - - _this = _super.call(this); - _this.value = value; - return _this; - } - - _createClass(Scalar, [{ - key: "toJSON", - value: function toJSON$1(arg, ctx) { - return ctx && ctx.keep ? this.value : toJSON(this.value, arg, ctx); - } - }, { - key: "toString", - value: function toString() { - return String(this.value); - } - }]); - - return Scalar; -}(Node); - -function collectionFromPath(schema, path, value) { - var v = value; - - for (var i = path.length - 1; i >= 0; --i) { - var k = path[i]; - - if (Number.isInteger(k) && k >= 0) { - var a = []; - a[k] = v; - v = a; - } else { - var o = {}; - Object.defineProperty(o, k, { - value: v, - writable: true, - enumerable: true, - configurable: true - }); - v = o; - } - } - - return schema.createNode(v, false); -} // null, undefined, or an empty non-string iterable (e.g. []) - - -var isEmptyPath = function isEmptyPath(path) { - return path == null || _typeof(path) === 'object' && path[Symbol.iterator]().next().done; -}; -var Collection = /*#__PURE__*/function (_Node) { - _inherits(Collection, _Node); - - var _super = _createSuper(Collection); - - function Collection(schema) { - var _this; - - _classCallCheck(this, Collection); - - _this = _super.call(this); - - _defineProperty(_assertThisInitialized(_this), "items", []); - - _this.schema = schema; - return _this; - } - - _createClass(Collection, [{ - key: "addIn", - value: function addIn(path, value) { - if (isEmptyPath(path)) this.add(value);else { - var _path = _toArray(path), - key = _path[0], - rest = _path.slice(1); - - var node = this.get(key, true); - if (node instanceof Collection) node.addIn(rest, value);else if (node === undefined && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));else throw new Error("Expected YAML collection at ".concat(key, ". Remaining path: ").concat(rest)); - } - } - }, { - key: "deleteIn", - value: function deleteIn(_ref) { - var _ref2 = _toArray(_ref), - key = _ref2[0], - rest = _ref2.slice(1); - - if (rest.length === 0) return this.delete(key); - var node = this.get(key, true); - if (node instanceof Collection) return node.deleteIn(rest);else throw new Error("Expected YAML collection at ".concat(key, ". Remaining path: ").concat(rest)); - } - }, { - key: "getIn", - value: function getIn(_ref3, keepScalar) { - var _ref4 = _toArray(_ref3), - key = _ref4[0], - rest = _ref4.slice(1); - - var node = this.get(key, true); - if (rest.length === 0) return !keepScalar && node instanceof Scalar ? node.value : node;else return node instanceof Collection ? node.getIn(rest, keepScalar) : undefined; - } - }, { - key: "hasAllNullValues", - value: function hasAllNullValues() { - return this.items.every(function (node) { - if (!node || node.type !== 'PAIR') return false; - var n = node.value; - return n == null || n instanceof Scalar && n.value == null && !n.commentBefore && !n.comment && !n.tag; - }); - } - }, { - key: "hasIn", - value: function hasIn(_ref5) { - var _ref6 = _toArray(_ref5), - key = _ref6[0], - rest = _ref6.slice(1); - - if (rest.length === 0) return this.has(key); - var node = this.get(key, true); - return node instanceof Collection ? node.hasIn(rest) : false; - } - }, { - key: "setIn", - value: function setIn(_ref7, value) { - var _ref8 = _toArray(_ref7), - key = _ref8[0], - rest = _ref8.slice(1); - - if (rest.length === 0) { - this.set(key, value); - } else { - var node = this.get(key, true); - if (node instanceof Collection) node.setIn(rest, value);else if (node === undefined && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));else throw new Error("Expected YAML collection at ".concat(key, ". Remaining path: ").concat(rest)); - } - } // overridden in implementations - - /* istanbul ignore next */ - - }, { - key: "toJSON", - value: function toJSON() { - return null; - } - }, { - key: "toString", - value: function toString(ctx, _ref9, onComment, onChompKeep) { - var _this2 = this; - - var blockItem = _ref9.blockItem, - flowChars = _ref9.flowChars, - isMap = _ref9.isMap, - itemIndent = _ref9.itemIndent; - var _ctx = ctx, - indent = _ctx.indent, - indentStep = _ctx.indentStep, - stringify = _ctx.stringify; - var inFlow = this.type === Type.FLOW_MAP || this.type === Type.FLOW_SEQ || ctx.inFlow; - if (inFlow) itemIndent += indentStep; - var allNullValues = isMap && this.hasAllNullValues(); - ctx = Object.assign({}, ctx, { - allNullValues: allNullValues, - indent: itemIndent, - inFlow: inFlow, - type: null - }); - var chompKeep = false; - var hasItemWithNewLine = false; - var nodes = this.items.reduce(function (nodes, item, i) { - var comment; - - if (item) { - if (!chompKeep && item.spaceBefore) nodes.push({ - type: 'comment', - str: '' - }); - if (item.commentBefore) item.commentBefore.match(/^.*$/gm).forEach(function (line) { - nodes.push({ - type: 'comment', - str: "#".concat(line) - }); - }); - if (item.comment) comment = item.comment; - if (inFlow && (!chompKeep && item.spaceBefore || item.commentBefore || item.comment || item.key && (item.key.commentBefore || item.key.comment) || item.value && (item.value.commentBefore || item.value.comment))) hasItemWithNewLine = true; - } - - chompKeep = false; - var str = stringify(item, ctx, function () { - return comment = null; - }, function () { - return chompKeep = true; - }); - if (inFlow && !hasItemWithNewLine && str.includes('\n')) hasItemWithNewLine = true; - if (inFlow && i < _this2.items.length - 1) str += ','; - str = addComment(str, itemIndent, comment); - if (chompKeep && (comment || inFlow)) chompKeep = false; - nodes.push({ - type: 'item', - str: str - }); - return nodes; - }, []); - var str; - - if (nodes.length === 0) { - str = flowChars.start + flowChars.end; - } else if (inFlow) { - var start = flowChars.start, - end = flowChars.end; - var strings = nodes.map(function (n) { - return n.str; - }); - - if (hasItemWithNewLine || strings.reduce(function (sum, str) { - return sum + str.length + 2; - }, 2) > Collection.maxFlowStringSingleLineLength) { - str = start; - - var _iterator = _createForOfIteratorHelper(strings), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var s = _step.value; - str += s ? "\n".concat(indentStep).concat(indent).concat(s) : '\n'; - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - str += "\n".concat(indent).concat(end); - } else { - str = "".concat(start, " ").concat(strings.join(' '), " ").concat(end); - } - } else { - var _strings = nodes.map(blockItem); - - str = _strings.shift(); - - var _iterator2 = _createForOfIteratorHelper(_strings), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var _s = _step2.value; - str += _s ? "\n".concat(indent).concat(_s) : '\n'; - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - } - - if (this.comment) { - str += '\n' + this.comment.replace(/^/gm, "".concat(indent, "#")); - if (onComment) onComment(); - } else if (chompKeep && onChompKeep) onChompKeep(); - - return str; - } - }]); - - return Collection; -}(Node); - -_defineProperty(Collection, "maxFlowStringSingleLineLength", 60); - -function asItemIndex(key) { - var idx = key instanceof Scalar ? key.value : key; - if (idx && typeof idx === 'string') idx = Number(idx); - return Number.isInteger(idx) && idx >= 0 ? idx : null; -} - -var YAMLSeq = /*#__PURE__*/function (_Collection) { - _inherits(YAMLSeq, _Collection); - - var _super = _createSuper(YAMLSeq); - - function YAMLSeq() { - _classCallCheck(this, YAMLSeq); - - return _super.apply(this, arguments); - } - - _createClass(YAMLSeq, [{ - key: "add", - value: function add(value) { - this.items.push(value); - } - }, { - key: "delete", - value: function _delete(key) { - var idx = asItemIndex(key); - if (typeof idx !== 'number') return false; - var del = this.items.splice(idx, 1); - return del.length > 0; - } - }, { - key: "get", - value: function get(key, keepScalar) { - var idx = asItemIndex(key); - if (typeof idx !== 'number') return undefined; - var it = this.items[idx]; - return !keepScalar && it instanceof Scalar ? it.value : it; - } - }, { - key: "has", - value: function has(key) { - var idx = asItemIndex(key); - return typeof idx === 'number' && idx < this.items.length; - } - }, { - key: "set", - value: function set(key, value) { - var idx = asItemIndex(key); - if (typeof idx !== 'number') throw new Error("Expected a valid index, not ".concat(key, ".")); - this.items[idx] = value; - } - }, { - key: "toJSON", - value: function toJSON$1(_, ctx) { - var seq = []; - if (ctx && ctx.onCreate) ctx.onCreate(seq); - var i = 0; - - var _iterator = _createForOfIteratorHelper(this.items), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var item = _step.value; - seq.push(toJSON(item, String(i++), ctx)); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return seq; - } - }, { - key: "toString", - value: function toString(ctx, onComment, onChompKeep) { - if (!ctx) return JSON.stringify(this); - return _get(_getPrototypeOf(YAMLSeq.prototype), "toString", this).call(this, ctx, { - blockItem: function blockItem(n) { - return n.type === 'comment' ? n.str : "- ".concat(n.str); - }, - flowChars: { - start: '[', - end: ']' - }, - isMap: false, - itemIndent: (ctx.indent || '') + ' ' - }, onComment, onChompKeep); - } - }]); - - return YAMLSeq; -}(Collection); - -var stringifyKey = function stringifyKey(key, jsKey, ctx) { - if (jsKey === null) return ''; - if (_typeof(jsKey) !== 'object') return String(jsKey); - if (key instanceof Node && ctx && ctx.doc) return key.toString({ - anchors: Object.create(null), - doc: ctx.doc, - indent: '', - indentStep: ctx.indentStep, - inFlow: true, - inStringifyKey: true, - stringify: ctx.stringify - }); - return JSON.stringify(jsKey); -}; - -var Pair = /*#__PURE__*/function (_Node) { - _inherits(Pair, _Node); - - var _super = _createSuper(Pair); - - function Pair(key) { - var _this; - - var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; - - _classCallCheck(this, Pair); - - _this = _super.call(this); - _this.key = key; - _this.value = value; - _this.type = Pair.Type.PAIR; - return _this; - } - - _createClass(Pair, [{ - key: "commentBefore", - get: function get() { - return this.key instanceof Node ? this.key.commentBefore : undefined; - }, - set: function set(cb) { - if (this.key == null) this.key = new Scalar(null); - if (this.key instanceof Node) this.key.commentBefore = cb;else { - var msg = 'Pair.commentBefore is an alias for Pair.key.commentBefore. To set it, the key must be a Node.'; - throw new Error(msg); - } - } - }, { - key: "addToJSMap", - value: function addToJSMap(ctx, map) { - var key = toJSON(this.key, '', ctx); - - if (map instanceof Map) { - var value = toJSON(this.value, key, ctx); - map.set(key, value); - } else if (map instanceof Set) { - map.add(key); - } else { - var stringKey = stringifyKey(this.key, key, ctx); - - var _value = toJSON(this.value, stringKey, ctx); - - if (stringKey in map) Object.defineProperty(map, stringKey, { - value: _value, - writable: true, - enumerable: true, - configurable: true - });else map[stringKey] = _value; - } - - return map; - } - }, { - key: "toJSON", - value: function toJSON(_, ctx) { - var pair = ctx && ctx.mapAsMap ? new Map() : {}; - return this.addToJSMap(ctx, pair); - } - }, { - key: "toString", - value: function toString(ctx, onComment, onChompKeep) { - if (!ctx || !ctx.doc) return JSON.stringify(this); - var _ctx$doc$options = ctx.doc.options, - indentSize = _ctx$doc$options.indent, - indentSeq = _ctx$doc$options.indentSeq, - simpleKeys = _ctx$doc$options.simpleKeys; - var key = this.key, - value = this.value; - var keyComment = key instanceof Node && key.comment; - - if (simpleKeys) { - if (keyComment) { - throw new Error('With simple keys, key nodes cannot have comments'); - } - - if (key instanceof Collection) { - var msg = 'With simple keys, collection cannot be used as a key value'; - throw new Error(msg); - } - } - - var explicitKey = !simpleKeys && (!key || keyComment || (key instanceof Node ? key instanceof Collection || key.type === Type.BLOCK_FOLDED || key.type === Type.BLOCK_LITERAL : _typeof(key) === 'object')); - var _ctx = ctx, - doc = _ctx.doc, - indent = _ctx.indent, - indentStep = _ctx.indentStep, - stringify = _ctx.stringify; - ctx = Object.assign({}, ctx, { - implicitKey: !explicitKey, - indent: indent + indentStep - }); - var chompKeep = false; - var str = stringify(key, ctx, function () { - return keyComment = null; - }, function () { - return chompKeep = true; - }); - str = addComment(str, ctx.indent, keyComment); - - if (!explicitKey && str.length > 1024) { - if (simpleKeys) throw new Error('With simple keys, single line scalar must not span more than 1024 characters'); - explicitKey = true; - } - - if (ctx.allNullValues && !simpleKeys) { - if (this.comment) { - str = addComment(str, ctx.indent, this.comment); - if (onComment) onComment(); - } else if (chompKeep && !keyComment && onChompKeep) onChompKeep(); - - return ctx.inFlow && !explicitKey ? str : "? ".concat(str); - } - - str = explicitKey ? "? ".concat(str, "\n").concat(indent, ":") : "".concat(str, ":"); - - if (this.comment) { - // expected (but not strictly required) to be a single-line comment - str = addComment(str, ctx.indent, this.comment); - if (onComment) onComment(); - } - - var vcb = ''; - var valueComment = null; - - if (value instanceof Node) { - if (value.spaceBefore) vcb = '\n'; - - if (value.commentBefore) { - var cs = value.commentBefore.replace(/^/gm, "".concat(ctx.indent, "#")); - vcb += "\n".concat(cs); - } - - valueComment = value.comment; - } else if (value && _typeof(value) === 'object') { - value = doc.schema.createNode(value, true); - } - - ctx.implicitKey = false; - if (!explicitKey && !this.comment && value instanceof Scalar) ctx.indentAtStart = str.length + 1; - chompKeep = false; - - if (!indentSeq && indentSize >= 2 && !ctx.inFlow && !explicitKey && value instanceof YAMLSeq && value.type !== Type.FLOW_SEQ && !value.tag && !doc.anchors.getName(value)) { - // If indentSeq === false, consider '- ' as part of indentation where possible - ctx.indent = ctx.indent.substr(2); - } - - var valueStr = stringify(value, ctx, function () { - return valueComment = null; - }, function () { - return chompKeep = true; - }); - var ws = ' '; - - if (vcb || this.comment) { - ws = "".concat(vcb, "\n").concat(ctx.indent); - } else if (!explicitKey && value instanceof Collection) { - var flow = valueStr[0] === '[' || valueStr[0] === '{'; - if (!flow || valueStr.includes('\n')) ws = "\n".concat(ctx.indent); - } else if (valueStr[0] === '\n') ws = ''; - - if (chompKeep && !valueComment && onChompKeep) onChompKeep(); - return addComment(str + ws + valueStr, ctx.indent, valueComment); - } - }]); - - return Pair; -}(Node); - -_defineProperty(Pair, "Type", { - PAIR: 'PAIR', - MERGE_PAIR: 'MERGE_PAIR' -}); - -var getAliasCount = function getAliasCount(node, anchors) { - if (node instanceof Alias) { - var anchor = anchors.get(node.source); - return anchor.count * anchor.aliasCount; - } else if (node instanceof Collection) { - var count = 0; - - var _iterator = _createForOfIteratorHelper(node.items), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var item = _step.value; - var c = getAliasCount(item, anchors); - if (c > count) count = c; - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return count; - } else if (node instanceof Pair) { - var kc = getAliasCount(node.key, anchors); - var vc = getAliasCount(node.value, anchors); - return Math.max(kc, vc); - } - - return 1; -}; - -var Alias = /*#__PURE__*/function (_Node) { - _inherits(Alias, _Node); - - var _super = _createSuper(Alias); - - function Alias(source) { - var _this; - - _classCallCheck(this, Alias); - - _this = _super.call(this); - _this.source = source; - _this.type = Type.ALIAS; - return _this; - } - - _createClass(Alias, [{ - key: "tag", - set: function set(t) { - throw new Error('Alias nodes cannot have tags'); - } - }, { - key: "toJSON", - value: function toJSON$1(arg, ctx) { - if (!ctx) return toJSON(this.source, arg, ctx); - var anchors = ctx.anchors, - maxAliasCount = ctx.maxAliasCount; - var anchor = anchors.get(this.source); - /* istanbul ignore if */ - - if (!anchor || anchor.res === undefined) { - var msg = 'This should not happen: Alias anchor was not resolved?'; - if (this.cstNode) throw new YAMLReferenceError(this.cstNode, msg);else throw new ReferenceError(msg); - } - - if (maxAliasCount >= 0) { - anchor.count += 1; - if (anchor.aliasCount === 0) anchor.aliasCount = getAliasCount(this.source, anchors); - - if (anchor.count * anchor.aliasCount > maxAliasCount) { - var _msg = 'Excessive alias count indicates a resource exhaustion attack'; - if (this.cstNode) throw new YAMLReferenceError(this.cstNode, _msg);else throw new ReferenceError(_msg); - } - } - - return anchor.res; - } // Only called when stringifying an alias mapping key while constructing - // Object output. - - }, { - key: "toString", - value: function toString(ctx) { - return Alias.stringify(this, ctx); - } - }], [{ - key: "stringify", - value: function stringify(_ref, _ref2) { - var range = _ref.range, - source = _ref.source; - var anchors = _ref2.anchors, - doc = _ref2.doc, - implicitKey = _ref2.implicitKey, - inStringifyKey = _ref2.inStringifyKey; - var anchor = Object.keys(anchors).find(function (a) { - return anchors[a] === source; - }); - if (!anchor && inStringifyKey) anchor = doc.anchors.getName(source) || doc.anchors.newName(); - if (anchor) return "*".concat(anchor).concat(implicitKey ? ' ' : ''); - var msg = doc.anchors.getName(source) ? 'Alias node must be after source node' : 'Source node not found for alias node'; - throw new Error("".concat(msg, " [").concat(range, "]")); - } - }]); - - return Alias; -}(Node); - -_defineProperty(Alias, "default", true); - -function findPair(items, key) { - var k = key instanceof Scalar ? key.value : key; - - var _iterator = _createForOfIteratorHelper(items), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var it = _step.value; - - if (it instanceof Pair) { - if (it.key === key || it.key === k) return it; - if (it.key && it.key.value === k) return it; - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return undefined; -} -var YAMLMap = /*#__PURE__*/function (_Collection) { - _inherits(YAMLMap, _Collection); - - var _super = _createSuper(YAMLMap); - - function YAMLMap() { - _classCallCheck(this, YAMLMap); - - return _super.apply(this, arguments); - } - - _createClass(YAMLMap, [{ - key: "add", - value: function add(pair, overwrite) { - if (!pair) pair = new Pair(pair);else if (!(pair instanceof Pair)) pair = new Pair(pair.key || pair, pair.value); - var prev = findPair(this.items, pair.key); - var sortEntries = this.schema && this.schema.sortMapEntries; - - if (prev) { - if (overwrite) prev.value = pair.value;else throw new Error("Key ".concat(pair.key, " already set")); - } else if (sortEntries) { - var i = this.items.findIndex(function (item) { - return sortEntries(pair, item) < 0; - }); - if (i === -1) this.items.push(pair);else this.items.splice(i, 0, pair); - } else { - this.items.push(pair); - } - } - }, { - key: "delete", - value: function _delete(key) { - var it = findPair(this.items, key); - if (!it) return false; - var del = this.items.splice(this.items.indexOf(it), 1); - return del.length > 0; - } - }, { - key: "get", - value: function get(key, keepScalar) { - var it = findPair(this.items, key); - var node = it && it.value; - return !keepScalar && node instanceof Scalar ? node.value : node; - } - }, { - key: "has", - value: function has(key) { - return !!findPair(this.items, key); - } - }, { - key: "set", - value: function set(key, value) { - this.add(new Pair(key, value), true); - } - /** - * @param {*} arg ignored - * @param {*} ctx Conversion context, originally set in Document#toJSON() - * @param {Class} Type If set, forces the returned collection type - * @returns {*} Instance of Type, Map, or Object - */ - - }, { - key: "toJSON", - value: function toJSON(_, ctx, Type) { - var map = Type ? new Type() : ctx && ctx.mapAsMap ? new Map() : {}; - if (ctx && ctx.onCreate) ctx.onCreate(map); - - var _iterator2 = _createForOfIteratorHelper(this.items), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var item = _step2.value; - item.addToJSMap(ctx, map); - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - - return map; - } - }, { - key: "toString", - value: function toString(ctx, onComment, onChompKeep) { - if (!ctx) return JSON.stringify(this); - - var _iterator3 = _createForOfIteratorHelper(this.items), - _step3; - - try { - for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { - var item = _step3.value; - if (!(item instanceof Pair)) throw new Error("Map items must all be pairs; found ".concat(JSON.stringify(item), " instead")); - } - } catch (err) { - _iterator3.e(err); - } finally { - _iterator3.f(); - } - - return _get(_getPrototypeOf(YAMLMap.prototype), "toString", this).call(this, ctx, { - blockItem: function blockItem(n) { - return n.str; - }, - flowChars: { - start: '{', - end: '}' - }, - isMap: true, - itemIndent: ctx.indent || '' - }, onComment, onChompKeep); - } - }]); - - return YAMLMap; -}(Collection); - -var MERGE_KEY = '<<'; -var Merge = /*#__PURE__*/function (_Pair) { - _inherits(Merge, _Pair); - - var _super = _createSuper(Merge); - - function Merge(pair) { - var _this; - - _classCallCheck(this, Merge); - - if (pair instanceof Pair) { - var seq = pair.value; - - if (!(seq instanceof YAMLSeq)) { - seq = new YAMLSeq(); - seq.items.push(pair.value); - seq.range = pair.value.range; - } - - _this = _super.call(this, pair.key, seq); - _this.range = pair.range; - } else { - _this = _super.call(this, new Scalar(MERGE_KEY), new YAMLSeq()); - } - - _this.type = Pair.Type.MERGE_PAIR; - return _possibleConstructorReturn(_this); - } // If the value associated with a merge key is a single mapping node, each of - // its key/value pairs is inserted into the current mapping, unless the key - // already exists in it. If the value associated with the merge key is a - // sequence, then this sequence is expected to contain mapping nodes and each - // of these nodes is merged in turn according to its order in the sequence. - // Keys in mapping nodes earlier in the sequence override keys specified in - // later mapping nodes. -- http://yaml.org/type/merge.html - - - _createClass(Merge, [{ - key: "addToJSMap", - value: function addToJSMap(ctx, map) { - var _iterator = _createForOfIteratorHelper(this.value.items), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var source = _step.value.source; - if (!(source instanceof YAMLMap)) throw new Error('Merge sources must be maps'); - var srcMap = source.toJSON(null, ctx, Map); - - var _iterator2 = _createForOfIteratorHelper(srcMap), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var _step2$value = _slicedToArray(_step2.value, 2), - key = _step2$value[0], - value = _step2$value[1]; - - if (map instanceof Map) { - if (!map.has(key)) map.set(key, value); - } else if (map instanceof Set) { - map.add(key); - } else if (!Object.prototype.hasOwnProperty.call(map, key)) { - Object.defineProperty(map, key, { - value: value, - writable: true, - enumerable: true, - configurable: true - }); - } - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return map; - } - }, { - key: "toString", - value: function toString(ctx, onComment) { - var seq = this.value; - if (seq.items.length > 1) return _get(_getPrototypeOf(Merge.prototype), "toString", this).call(this, ctx, onComment); - this.value = seq.items[0]; - - var str = _get(_getPrototypeOf(Merge.prototype), "toString", this).call(this, ctx, onComment); - - this.value = seq; - return str; - } - }]); - - return Merge; -}(Pair); - -var binaryOptions = { - defaultType: Type.BLOCK_LITERAL, - lineWidth: 76 -}; -var boolOptions = { - trueStr: 'true', - falseStr: 'false' -}; -var intOptions = { - asBigInt: false -}; -var nullOptions = { - nullStr: 'null' -}; -var strOptions = { - defaultType: Type.PLAIN, - doubleQuoted: { - jsonEncoding: false, - minMultiLineLength: 40 - }, - fold: { - lineWidth: 80, - minContentWidth: 20 - } -}; - -function resolveScalar(str, tags, scalarFallback) { - var _iterator = _createForOfIteratorHelper(tags), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var _step$value = _step.value, - format = _step$value.format, - test = _step$value.test, - resolve = _step$value.resolve; - - if (test) { - var match = str.match(test); - - if (match) { - var res = resolve.apply(null, match); - if (!(res instanceof Scalar)) res = new Scalar(res); - if (format) res.format = format; - return res; - } - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - if (scalarFallback) str = scalarFallback(str); - return new Scalar(str); -} - -var FOLD_FLOW = 'flow'; -var FOLD_BLOCK = 'block'; -var FOLD_QUOTED = 'quoted'; // presumes i+1 is at the start of a line -// returns index of last newline in more-indented block - -var consumeMoreIndentedLines = function consumeMoreIndentedLines(text, i) { - var ch = text[i + 1]; - - while (ch === ' ' || ch === '\t') { - do { - ch = text[i += 1]; - } while (ch && ch !== '\n'); - - ch = text[i + 1]; - } - - return i; -}; -/** - * Tries to keep input at up to `lineWidth` characters, splitting only on spaces - * not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are - * terminated with `\n` and started with `indent`. - * - * @param {string} text - * @param {string} indent - * @param {string} [mode='flow'] `'block'` prevents more-indented lines - * from being folded; `'quoted'` allows for `\` escapes, including escaped - * newlines - * @param {Object} options - * @param {number} [options.indentAtStart] Accounts for leading contents on - * the first line, defaulting to `indent.length` - * @param {number} [options.lineWidth=80] - * @param {number} [options.minContentWidth=20] Allow highly indented lines to - * stretch the line width or indent content from the start - * @param {function} options.onFold Called once if the text is folded - * @param {function} options.onFold Called once if any line of text exceeds - * lineWidth characters - */ - - -function foldFlowLines(text, indent, mode, _ref) { - var indentAtStart = _ref.indentAtStart, - _ref$lineWidth = _ref.lineWidth, - lineWidth = _ref$lineWidth === void 0 ? 80 : _ref$lineWidth, - _ref$minContentWidth = _ref.minContentWidth, - minContentWidth = _ref$minContentWidth === void 0 ? 20 : _ref$minContentWidth, - onFold = _ref.onFold, - onOverflow = _ref.onOverflow; - if (!lineWidth || lineWidth < 0) return text; - var endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length); - if (text.length <= endStep) return text; - var folds = []; - var escapedFolds = {}; - var end = lineWidth - indent.length; - - if (typeof indentAtStart === 'number') { - if (indentAtStart > lineWidth - Math.max(2, minContentWidth)) folds.push(0);else end = lineWidth - indentAtStart; - } - - var split = undefined; - var prev = undefined; - var overflow = false; - var i = -1; - var escStart = -1; - var escEnd = -1; - - if (mode === FOLD_BLOCK) { - i = consumeMoreIndentedLines(text, i); - if (i !== -1) end = i + endStep; - } - - for (var ch; ch = text[i += 1];) { - if (mode === FOLD_QUOTED && ch === '\\') { - escStart = i; - - switch (text[i + 1]) { - case 'x': - i += 3; - break; - - case 'u': - i += 5; - break; - - case 'U': - i += 9; - break; - - default: - i += 1; - } - - escEnd = i; - } - - if (ch === '\n') { - if (mode === FOLD_BLOCK) i = consumeMoreIndentedLines(text, i); - end = i + endStep; - split = undefined; - } else { - if (ch === ' ' && prev && prev !== ' ' && prev !== '\n' && prev !== '\t') { - // space surrounded by non-space can be replaced with newline + indent - var next = text[i + 1]; - if (next && next !== ' ' && next !== '\n' && next !== '\t') split = i; - } - - if (i >= end) { - if (split) { - folds.push(split); - end = split + endStep; - split = undefined; - } else if (mode === FOLD_QUOTED) { - // white-space collected at end may stretch past lineWidth - while (prev === ' ' || prev === '\t') { - prev = ch; - ch = text[i += 1]; - overflow = true; - } // Account for newline escape, but don't break preceding escape - - - var j = i > escEnd + 1 ? i - 2 : escStart - 1; // Bail out if lineWidth & minContentWidth are shorter than an escape string - - if (escapedFolds[j]) return text; - folds.push(j); - escapedFolds[j] = true; - end = j + endStep; - split = undefined; - } else { - overflow = true; - } - } - } - - prev = ch; - } - - if (overflow && onOverflow) onOverflow(); - if (folds.length === 0) return text; - if (onFold) onFold(); - var res = text.slice(0, folds[0]); - - for (var _i = 0; _i < folds.length; ++_i) { - var fold = folds[_i]; - - var _end = folds[_i + 1] || text.length; - - if (fold === 0) res = "\n".concat(indent).concat(text.slice(0, _end));else { - if (mode === FOLD_QUOTED && escapedFolds[fold]) res += "".concat(text[fold], "\\"); - res += "\n".concat(indent).concat(text.slice(fold + 1, _end)); - } - } - - return res; -} - -var getFoldOptions = function getFoldOptions(_ref) { - var indentAtStart = _ref.indentAtStart; - return indentAtStart ? Object.assign({ - indentAtStart: indentAtStart - }, strOptions.fold) : strOptions.fold; -}; // Also checks for lines starting with %, as parsing the output as YAML 1.1 will -// presume that's starting a new document. - - -var containsDocumentMarker = function containsDocumentMarker(str) { - return /^(%|---|\.\.\.)/m.test(str); -}; - -function lineLengthOverLimit(str, lineWidth, indentLength) { - if (!lineWidth || lineWidth < 0) return false; - var limit = lineWidth - indentLength; - var strLen = str.length; - if (strLen <= limit) return false; - - for (var i = 0, start = 0; i < strLen; ++i) { - if (str[i] === '\n') { - if (i - start > limit) return true; - start = i + 1; - if (strLen - start <= limit) return false; - } - } - - return true; -} - -function doubleQuotedString(value, ctx) { - var implicitKey = ctx.implicitKey; - var _strOptions$doubleQuo = strOptions.doubleQuoted, - jsonEncoding = _strOptions$doubleQuo.jsonEncoding, - minMultiLineLength = _strOptions$doubleQuo.minMultiLineLength; - var json = JSON.stringify(value); - if (jsonEncoding) return json; - var indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : ''); - var str = ''; - var start = 0; - - for (var i = 0, ch = json[i]; ch; ch = json[++i]) { - if (ch === ' ' && json[i + 1] === '\\' && json[i + 2] === 'n') { - // space before newline needs to be escaped to not be folded - str += json.slice(start, i) + '\\ '; - i += 1; - start = i; - ch = '\\'; - } - - if (ch === '\\') switch (json[i + 1]) { - case 'u': - { - str += json.slice(start, i); - var code = json.substr(i + 2, 4); - - switch (code) { - case '0000': - str += '\\0'; - break; - - case '0007': - str += '\\a'; - break; - - case '000b': - str += '\\v'; - break; - - case '001b': - str += '\\e'; - break; - - case '0085': - str += '\\N'; - break; - - case '00a0': - str += '\\_'; - break; - - case '2028': - str += '\\L'; - break; - - case '2029': - str += '\\P'; - break; - - default: - if (code.substr(0, 2) === '00') str += '\\x' + code.substr(2);else str += json.substr(i, 6); - } - - i += 5; - start = i + 1; - } - break; - - case 'n': - if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) { - i += 1; - } else { - // folding will eat first newline - str += json.slice(start, i) + '\n\n'; - - while (json[i + 2] === '\\' && json[i + 3] === 'n' && json[i + 4] !== '"') { - str += '\n'; - i += 2; - } - - str += indent; // space after newline needs to be escaped to not be folded - - if (json[i + 2] === ' ') str += '\\'; - i += 1; - start = i + 1; - } - - break; - - default: - i += 1; - } - } - - str = start ? str + json.slice(start) : json; - return implicitKey ? str : foldFlowLines(str, indent, FOLD_QUOTED, getFoldOptions(ctx)); -} - -function singleQuotedString(value, ctx) { - if (ctx.implicitKey) { - if (/\n/.test(value)) return doubleQuotedString(value, ctx); - } else { - // single quoted string can't have leading or trailing whitespace around newline - if (/[ \t]\n|\n[ \t]/.test(value)) return doubleQuotedString(value, ctx); - } - - var indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : ''); - var res = "'" + value.replace(/'/g, "''").replace(/\n+/g, "$&\n".concat(indent)) + "'"; - return ctx.implicitKey ? res : foldFlowLines(res, indent, FOLD_FLOW, getFoldOptions(ctx)); -} - -function blockString(_ref2, ctx, onComment, onChompKeep) { - var comment = _ref2.comment, - type = _ref2.type, - value = _ref2.value; - - // 1. Block can't end in whitespace unless the last line is non-empty. - // 2. Strings consisting of only whitespace are best rendered explicitly. - if (/\n[\t ]+$/.test(value) || /^\s*$/.test(value)) { - return doubleQuotedString(value, ctx); - } - - var indent = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value) ? ' ' : ''); - var indentSize = indent ? '2' : '1'; // root is at -1 - - var literal = type === Type.BLOCK_FOLDED ? false : type === Type.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, strOptions.fold.lineWidth, indent.length); - var header = literal ? '|' : '>'; - if (!value) return header + '\n'; - var wsStart = ''; - var wsEnd = ''; - value = value.replace(/[\n\t ]*$/, function (ws) { - var n = ws.indexOf('\n'); - - if (n === -1) { - header += '-'; // strip - } else if (value === ws || n !== ws.length - 1) { - header += '+'; // keep - - if (onChompKeep) onChompKeep(); - } - - wsEnd = ws.replace(/\n$/, ''); - return ''; - }).replace(/^[\n ]*/, function (ws) { - if (ws.indexOf(' ') !== -1) header += indentSize; - var m = ws.match(/ +$/); - - if (m) { - wsStart = ws.slice(0, -m[0].length); - return m[0]; - } else { - wsStart = ws; - return ''; - } - }); - if (wsEnd) wsEnd = wsEnd.replace(/\n+(?!\n|$)/g, "$&".concat(indent)); - if (wsStart) wsStart = wsStart.replace(/\n+/g, "$&".concat(indent)); - - if (comment) { - header += ' #' + comment.replace(/ ?[\r\n]+/g, ' '); - if (onComment) onComment(); - } - - if (!value) return "".concat(header).concat(indentSize, "\n").concat(indent).concat(wsEnd); - - if (literal) { - value = value.replace(/\n+/g, "$&".concat(indent)); - return "".concat(header, "\n").concat(indent).concat(wsStart).concat(value).concat(wsEnd); - } - - value = value.replace(/\n+/g, '\n$&').replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded - // ^ ind.line ^ empty ^ capture next empty lines only at end of indent - .replace(/\n+/g, "$&".concat(indent)); - var body = foldFlowLines("".concat(wsStart).concat(value).concat(wsEnd), indent, FOLD_BLOCK, strOptions.fold); - return "".concat(header, "\n").concat(indent).concat(body); -} - -function plainString(item, ctx, onComment, onChompKeep) { - var comment = item.comment, - type = item.type, - value = item.value; - var actualString = ctx.actualString, - implicitKey = ctx.implicitKey, - indent = ctx.indent, - inFlow = ctx.inFlow; - - if (implicitKey && /[\n[\]{},]/.test(value) || inFlow && /[[\]{},]/.test(value)) { - return doubleQuotedString(value, ctx); - } - - if (!value || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) { - // not allowed: - // - empty string, '-' or '?' - // - start with an indicator character (except [?:-]) or /[?-] / - // - '\n ', ': ' or ' \n' anywhere - // - '#' not preceded by a non-space char - // - end with ' ' or ':' - return implicitKey || inFlow || value.indexOf('\n') === -1 ? value.indexOf('"') !== -1 && value.indexOf("'") === -1 ? singleQuotedString(value, ctx) : doubleQuotedString(value, ctx) : blockString(item, ctx, onComment, onChompKeep); - } - - if (!implicitKey && !inFlow && type !== Type.PLAIN && value.indexOf('\n') !== -1) { - // Where allowed & type not set explicitly, prefer block style for multiline strings - return blockString(item, ctx, onComment, onChompKeep); - } - - if (indent === '' && containsDocumentMarker(value)) { - ctx.forceBlockIndent = true; - return blockString(item, ctx, onComment, onChompKeep); - } - - var str = value.replace(/\n+/g, "$&\n".concat(indent)); // Verify that output will be parsed as a string, as e.g. plain numbers and - // booleans get parsed with those types in v1.2 (e.g. '42', 'true' & '0.9e-3'), - // and others in v1.1. - - if (actualString) { - var tags = ctx.doc.schema.tags; - var resolved = resolveScalar(str, tags, tags.scalarFallback).value; - if (typeof resolved !== 'string') return doubleQuotedString(value, ctx); - } - - var body = implicitKey ? str : foldFlowLines(str, indent, FOLD_FLOW, getFoldOptions(ctx)); - - if (comment && !inFlow && (body.indexOf('\n') !== -1 || comment.indexOf('\n') !== -1)) { - if (onComment) onComment(); - return addCommentBefore(body, indent, comment); - } - - return body; -} - -function stringifyString(item, ctx, onComment, onChompKeep) { - var defaultType = strOptions.defaultType; - var implicitKey = ctx.implicitKey, - inFlow = ctx.inFlow; - var _item = item, - type = _item.type, - value = _item.value; - - if (typeof value !== 'string') { - value = String(value); - item = Object.assign({}, item, { - value: value - }); - } - - var _stringify = function _stringify(_type) { - switch (_type) { - case Type.BLOCK_FOLDED: - case Type.BLOCK_LITERAL: - return blockString(item, ctx, onComment, onChompKeep); - - case Type.QUOTE_DOUBLE: - return doubleQuotedString(value, ctx); - - case Type.QUOTE_SINGLE: - return singleQuotedString(value, ctx); - - case Type.PLAIN: - return plainString(item, ctx, onComment, onChompKeep); - - default: - return null; - } - }; - - if (type !== Type.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(value)) { - // force double quotes on control characters - type = Type.QUOTE_DOUBLE; - } else if ((implicitKey || inFlow) && (type === Type.BLOCK_FOLDED || type === Type.BLOCK_LITERAL)) { - // should not happen; blocks are not valid inside flow containers - type = Type.QUOTE_DOUBLE; - } - - var res = _stringify(type); - - if (res === null) { - res = _stringify(defaultType); - if (res === null) throw new Error("Unsupported default string type ".concat(defaultType)); - } - - return res; -} - -function stringifyNumber(_ref) { - var format = _ref.format, - minFractionDigits = _ref.minFractionDigits, - tag = _ref.tag, - value = _ref.value; - if (typeof value === 'bigint') return String(value); - if (!isFinite(value)) return isNaN(value) ? '.nan' : value < 0 ? '-.inf' : '.inf'; - var n = JSON.stringify(value); - - if (!format && minFractionDigits && (!tag || tag === 'tag:yaml.org,2002:float') && /^\d/.test(n)) { - var i = n.indexOf('.'); - - if (i < 0) { - i = n.length; - n += '.'; - } - - var d = minFractionDigits - (n.length - i - 1); - - while (d-- > 0) { - n += '0'; - } - } - - return n; -} - -function checkFlowCollectionEnd(errors, cst) { - var char, name; - - switch (cst.type) { - case Type.FLOW_MAP: - char = '}'; - name = 'flow map'; - break; - - case Type.FLOW_SEQ: - char = ']'; - name = 'flow sequence'; - break; - - default: - errors.push(new YAMLSemanticError(cst, 'Not a flow collection!?')); - return; - } - - var lastItem; - - for (var i = cst.items.length - 1; i >= 0; --i) { - var item = cst.items[i]; - - if (!item || item.type !== Type.COMMENT) { - lastItem = item; - break; - } - } - - if (lastItem && lastItem.char !== char) { - var msg = "Expected ".concat(name, " to end with ").concat(char); - var err; - - if (typeof lastItem.offset === 'number') { - err = new YAMLSemanticError(cst, msg); - err.offset = lastItem.offset + 1; - } else { - err = new YAMLSemanticError(lastItem, msg); - if (lastItem.range && lastItem.range.end) err.offset = lastItem.range.end - lastItem.range.start; - } - - errors.push(err); - } -} -function checkFlowCommentSpace(errors, comment) { - var prev = comment.context.src[comment.range.start - 1]; - - if (prev !== '\n' && prev !== '\t' && prev !== ' ') { - var msg = 'Comments must be separated from other tokens by white space characters'; - errors.push(new YAMLSemanticError(comment, msg)); - } -} -function getLongKeyError(source, key) { - var sk = String(key); - var k = sk.substr(0, 8) + '...' + sk.substr(-8); - return new YAMLSemanticError(source, "The \"".concat(k, "\" key is too long")); -} -function resolveComments(collection, comments) { - var _iterator = _createForOfIteratorHelper(comments), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var _step$value = _step.value, - afterKey = _step$value.afterKey, - before = _step$value.before, - comment = _step$value.comment; - var item = collection.items[before]; - - if (!item) { - if (comment !== undefined) { - if (collection.comment) collection.comment += '\n' + comment;else collection.comment = comment; - } - } else { - if (afterKey && item.value) item = item.value; - - if (comment === undefined) { - if (afterKey || !item.commentBefore) item.spaceBefore = true; - } else { - if (item.commentBefore) item.commentBefore += '\n' + comment;else item.commentBefore = comment; - } - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } -} - -// on error, will return { str: string, errors: Error[] } -function resolveString(doc, node) { - var res = node.strValue; - if (!res) return ''; - if (typeof res === 'string') return res; - res.errors.forEach(function (error) { - if (!error.source) error.source = node; - doc.errors.push(error); - }); - return res.str; -} - -function resolveTagHandle(doc, node) { - var _node$tag = node.tag, - handle = _node$tag.handle, - suffix = _node$tag.suffix; - var prefix = doc.tagPrefixes.find(function (p) { - return p.handle === handle; - }); - - if (!prefix) { - var dtp = doc.getDefaults().tagPrefixes; - if (dtp) prefix = dtp.find(function (p) { - return p.handle === handle; - }); - if (!prefix) throw new YAMLSemanticError(node, "The ".concat(handle, " tag handle is non-default and was not declared.")); - } - - if (!suffix) throw new YAMLSemanticError(node, "The ".concat(handle, " tag has no suffix.")); - - if (handle === '!' && (doc.version || doc.options.version) === '1.0') { - if (suffix[0] === '^') { - doc.warnings.push(new YAMLWarning(node, 'YAML 1.0 ^ tag expansion is not supported')); - return suffix; - } - - if (/[:/]/.test(suffix)) { - // word/foo -> tag:word.yaml.org,2002:foo - var vocab = suffix.match(/^([a-z0-9-]+)\/(.*)/i); - return vocab ? "tag:".concat(vocab[1], ".yaml.org,2002:").concat(vocab[2]) : "tag:".concat(suffix); - } - } - - return prefix.prefix + decodeURIComponent(suffix); -} - -function resolveTagName(doc, node) { - var tag = node.tag, - type = node.type; - var nonSpecific = false; - - if (tag) { - var handle = tag.handle, - suffix = tag.suffix, - verbatim = tag.verbatim; - - if (verbatim) { - if (verbatim !== '!' && verbatim !== '!!') return verbatim; - var msg = "Verbatim tags aren't resolved, so ".concat(verbatim, " is invalid."); - doc.errors.push(new YAMLSemanticError(node, msg)); - } else if (handle === '!' && !suffix) { - nonSpecific = true; - } else { - try { - return resolveTagHandle(doc, node); - } catch (error) { - doc.errors.push(error); - } - } - } - - switch (type) { - case Type.BLOCK_FOLDED: - case Type.BLOCK_LITERAL: - case Type.QUOTE_DOUBLE: - case Type.QUOTE_SINGLE: - return defaultTags.STR; - - case Type.FLOW_MAP: - case Type.MAP: - return defaultTags.MAP; - - case Type.FLOW_SEQ: - case Type.SEQ: - return defaultTags.SEQ; - - case Type.PLAIN: - return nonSpecific ? defaultTags.STR : null; - - default: - return null; - } -} - -function resolveByTagName(doc, node, tagName) { - var tags = doc.schema.tags; - var matchWithTest = []; - - var _iterator = _createForOfIteratorHelper(tags), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var tag = _step.value; - - if (tag.tag === tagName) { - if (tag.test) matchWithTest.push(tag);else { - var res = tag.resolve(doc, node); - return res instanceof Collection ? res : new Scalar(res); - } - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - var str = resolveString(doc, node); - if (typeof str === 'string' && matchWithTest.length > 0) return resolveScalar(str, matchWithTest, tags.scalarFallback); - return null; -} - -function getFallbackTagName(_ref) { - var type = _ref.type; - - switch (type) { - case Type.FLOW_MAP: - case Type.MAP: - return defaultTags.MAP; - - case Type.FLOW_SEQ: - case Type.SEQ: - return defaultTags.SEQ; - - default: - return defaultTags.STR; - } -} - -function resolveTag(doc, node, tagName) { - try { - var res = resolveByTagName(doc, node, tagName); - - if (res) { - if (tagName && node.tag) res.tag = tagName; - return res; - } - } catch (error) { - /* istanbul ignore if */ - if (!error.source) error.source = node; - doc.errors.push(error); - return null; - } - - try { - var fallback = getFallbackTagName(node); - if (!fallback) throw new Error("The tag ".concat(tagName, " is unavailable")); - var msg = "The tag ".concat(tagName, " is unavailable, falling back to ").concat(fallback); - doc.warnings.push(new YAMLWarning(node, msg)); - - var _res = resolveByTagName(doc, node, fallback); - - _res.tag = tagName; - return _res; - } catch (error) { - var refError = new YAMLReferenceError(node, error.message); - refError.stack = error.stack; - doc.errors.push(refError); - return null; - } -} - -var isCollectionItem = function isCollectionItem(node) { - if (!node) return false; - var type = node.type; - return type === Type.MAP_KEY || type === Type.MAP_VALUE || type === Type.SEQ_ITEM; -}; - -function resolveNodeProps(errors, node) { - var comments = { - before: [], - after: [] - }; - var hasAnchor = false; - var hasTag = false; - var props = isCollectionItem(node.context.parent) ? node.context.parent.props.concat(node.props) : node.props; - - var _iterator = _createForOfIteratorHelper(props), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var _step$value = _step.value, - start = _step$value.start, - end = _step$value.end; - - switch (node.context.src[start]) { - case Char.COMMENT: - { - if (!node.commentHasRequiredWhitespace(start)) { - var msg = 'Comments must be separated from other tokens by white space characters'; - errors.push(new YAMLSemanticError(node, msg)); - } - - var header = node.header, - valueRange = node.valueRange; - var cc = valueRange && (start > valueRange.start || header && start > header.start) ? comments.after : comments.before; - cc.push(node.context.src.slice(start + 1, end)); - break; - } - // Actual anchor & tag resolution is handled by schema, here we just complain - - case Char.ANCHOR: - if (hasAnchor) { - var _msg = 'A node can have at most one anchor'; - errors.push(new YAMLSemanticError(node, _msg)); - } - - hasAnchor = true; - break; - - case Char.TAG: - if (hasTag) { - var _msg2 = 'A node can have at most one tag'; - errors.push(new YAMLSemanticError(node, _msg2)); - } - - hasTag = true; - break; - } - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return { - comments: comments, - hasAnchor: hasAnchor, - hasTag: hasTag - }; -} - -function resolveNodeValue(doc, node) { - var anchors = doc.anchors, - errors = doc.errors, - schema = doc.schema; - - if (node.type === Type.ALIAS) { - var name = node.rawValue; - var src = anchors.getNode(name); - - if (!src) { - var msg = "Aliased anchor not found: ".concat(name); - errors.push(new YAMLReferenceError(node, msg)); - return null; - } // Lazy resolution for circular references - - - var res = new Alias(src); - - anchors._cstAliases.push(res); - - return res; - } - - var tagName = resolveTagName(doc, node); - if (tagName) return resolveTag(doc, node, tagName); - - if (node.type !== Type.PLAIN) { - var _msg3 = "Failed to resolve ".concat(node.type, " node here"); - - errors.push(new YAMLSyntaxError(node, _msg3)); - return null; - } - - try { - var str = resolveString(doc, node); - return resolveScalar(str, schema.tags, schema.tags.scalarFallback); - } catch (error) { - if (!error.source) error.source = node; - errors.push(error); - return null; - } -} // sets node.resolved on success - - -function resolveNode(doc, node) { - if (!node) return null; - if (node.error) doc.errors.push(node.error); - - var _resolveNodeProps = resolveNodeProps(doc.errors, node), - comments = _resolveNodeProps.comments, - hasAnchor = _resolveNodeProps.hasAnchor, - hasTag = _resolveNodeProps.hasTag; - - if (hasAnchor) { - var anchors = doc.anchors; - var name = node.anchor; - var prev = anchors.getNode(name); // At this point, aliases for any preceding node with the same anchor - // name have already been resolved, so it may safely be renamed. - - if (prev) anchors.map[anchors.newName(name)] = prev; // During parsing, we need to store the CST node in anchors.map as - // anchors need to be available during resolution to allow for - // circular references. - - anchors.map[name] = node; - } - - if (node.type === Type.ALIAS && (hasAnchor || hasTag)) { - var msg = 'An alias node must not specify any properties'; - doc.errors.push(new YAMLSemanticError(node, msg)); - } - - var res = resolveNodeValue(doc, node); - - if (res) { - res.range = [node.range.start, node.range.end]; - if (doc.options.keepCstNodes) res.cstNode = node; - if (doc.options.keepNodeTypes) res.type = node.type; - var cb = comments.before.join('\n'); - - if (cb) { - res.commentBefore = res.commentBefore ? "".concat(res.commentBefore, "\n").concat(cb) : cb; - } - - var ca = comments.after.join('\n'); - if (ca) res.comment = res.comment ? "".concat(res.comment, "\n").concat(ca) : ca; - } - - return node.resolved = res; -} - -function resolveMap(doc, cst) { - if (cst.type !== Type.MAP && cst.type !== Type.FLOW_MAP) { - var msg = "A ".concat(cst.type, " node cannot be resolved as a mapping"); - doc.errors.push(new YAMLSyntaxError(cst, msg)); - return null; - } - - var _ref = cst.type === Type.FLOW_MAP ? resolveFlowMapItems(doc, cst) : resolveBlockMapItems(doc, cst), - comments = _ref.comments, - items = _ref.items; - - var map = new YAMLMap(); - map.items = items; - resolveComments(map, comments); - var hasCollectionKey = false; - - for (var i = 0; i < items.length; ++i) { - var iKey = items[i].key; - if (iKey instanceof Collection) hasCollectionKey = true; - - if (doc.schema.merge && iKey && iKey.value === MERGE_KEY) { - items[i] = new Merge(items[i]); - var sources = items[i].value.items; - var error = null; - sources.some(function (node) { - if (node instanceof Alias) { - // During parsing, alias sources are CST nodes; to account for - // circular references their resolved values can't be used here. - var type = node.source.type; - if (type === Type.MAP || type === Type.FLOW_MAP) return false; - return error = 'Merge nodes aliases can only point to maps'; - } - - return error = 'Merge nodes can only have Alias nodes as values'; - }); - if (error) doc.errors.push(new YAMLSemanticError(cst, error)); - } else { - for (var j = i + 1; j < items.length; ++j) { - var jKey = items[j].key; - - if (iKey === jKey || iKey && jKey && Object.prototype.hasOwnProperty.call(iKey, 'value') && iKey.value === jKey.value) { - var _msg = "Map keys must be unique; \"".concat(iKey, "\" is repeated"); - - doc.errors.push(new YAMLSemanticError(cst, _msg)); - break; - } - } - } - } - - if (hasCollectionKey && !doc.options.mapAsMap) { - var warn = 'Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.'; - doc.warnings.push(new YAMLWarning(cst, warn)); - } - - cst.resolved = map; - return map; -} - -var valueHasPairComment = function valueHasPairComment(_ref2) { - var _ref2$context = _ref2.context, - lineStart = _ref2$context.lineStart, - node = _ref2$context.node, - src = _ref2$context.src, - props = _ref2.props; - if (props.length === 0) return false; - var start = props[0].start; - if (node && start > node.valueRange.start) return false; - if (src[start] !== Char.COMMENT) return false; - - for (var i = lineStart; i < start; ++i) { - if (src[i] === '\n') return false; - } - - return true; -}; - -function resolvePairComment(item, pair) { - if (!valueHasPairComment(item)) return; - var comment = item.getPropValue(0, Char.COMMENT, true); - var found = false; - var cb = pair.value.commentBefore; - - if (cb && cb.startsWith(comment)) { - pair.value.commentBefore = cb.substr(comment.length + 1); - found = true; - } else { - var cc = pair.value.comment; - - if (!item.node && cc && cc.startsWith(comment)) { - pair.value.comment = cc.substr(comment.length + 1); - found = true; - } - } - - if (found) pair.comment = comment; -} - -function resolveBlockMapItems(doc, cst) { - var comments = []; - var items = []; - var key = undefined; - var keyStart = null; - - for (var i = 0; i < cst.items.length; ++i) { - var item = cst.items[i]; - - switch (item.type) { - case Type.BLANK_LINE: - comments.push({ - afterKey: !!key, - before: items.length - }); - break; - - case Type.COMMENT: - comments.push({ - afterKey: !!key, - before: items.length, - comment: item.comment - }); - break; - - case Type.MAP_KEY: - if (key !== undefined) items.push(new Pair(key)); - if (item.error) doc.errors.push(item.error); - key = resolveNode(doc, item.node); - keyStart = null; - break; - - case Type.MAP_VALUE: - { - if (key === undefined) key = null; - if (item.error) doc.errors.push(item.error); - - if (!item.context.atLineStart && item.node && item.node.type === Type.MAP && !item.node.context.atLineStart) { - var msg = 'Nested mappings are not allowed in compact mappings'; - doc.errors.push(new YAMLSemanticError(item.node, msg)); - } - - var valueNode = item.node; - - if (!valueNode && item.props.length > 0) { - // Comments on an empty mapping value need to be preserved, so we - // need to construct a minimal empty node here to use instead of the - // missing `item.node`. -- eemeli/yaml#19 - valueNode = new PlainValue(Type.PLAIN, []); - valueNode.context = { - parent: item, - src: item.context.src - }; - var pos = item.range.start + 1; - valueNode.range = { - start: pos, - end: pos - }; - valueNode.valueRange = { - start: pos, - end: pos - }; - - if (typeof item.range.origStart === 'number') { - var origPos = item.range.origStart + 1; - valueNode.range.origStart = valueNode.range.origEnd = origPos; - valueNode.valueRange.origStart = valueNode.valueRange.origEnd = origPos; - } - } - - var pair = new Pair(key, resolveNode(doc, valueNode)); - resolvePairComment(item, pair); - items.push(pair); - - if (key && typeof keyStart === 'number') { - if (item.range.start > keyStart + 1024) doc.errors.push(getLongKeyError(cst, key)); - } - - key = undefined; - keyStart = null; - } - break; - - default: - if (key !== undefined) items.push(new Pair(key)); - key = resolveNode(doc, item); - keyStart = item.range.start; - if (item.error) doc.errors.push(item.error); - - next: for (var j = i + 1;; ++j) { - var nextItem = cst.items[j]; - - switch (nextItem && nextItem.type) { - case Type.BLANK_LINE: - case Type.COMMENT: - continue next; - - case Type.MAP_VALUE: - break next; - - default: - { - var _msg2 = 'Implicit map keys need to be followed by map values'; - doc.errors.push(new YAMLSemanticError(item, _msg2)); - break next; - } - } - } - - if (item.valueRangeContainsNewline) { - var _msg3 = 'Implicit map keys need to be on a single line'; - doc.errors.push(new YAMLSemanticError(item, _msg3)); - } - - } - } - - if (key !== undefined) items.push(new Pair(key)); - return { - comments: comments, - items: items - }; -} - -function resolveFlowMapItems(doc, cst) { - var comments = []; - var items = []; - var key = undefined; - var explicitKey = false; - var next = '{'; - - for (var i = 0; i < cst.items.length; ++i) { - var item = cst.items[i]; - - if (typeof item.char === 'string') { - var char = item.char, - offset = item.offset; - - if (char === '?' && key === undefined && !explicitKey) { - explicitKey = true; - next = ':'; - continue; - } - - if (char === ':') { - if (key === undefined) key = null; - - if (next === ':') { - next = ','; - continue; - } - } else { - if (explicitKey) { - if (key === undefined && char !== ',') key = null; - explicitKey = false; - } - - if (key !== undefined) { - items.push(new Pair(key)); - key = undefined; - - if (char === ',') { - next = ':'; - continue; - } - } - } - - if (char === '}') { - if (i === cst.items.length - 1) continue; - } else if (char === next) { - next = ':'; - continue; - } - - var msg = "Flow map contains an unexpected ".concat(char); - var err = new YAMLSyntaxError(cst, msg); - err.offset = offset; - doc.errors.push(err); - } else if (item.type === Type.BLANK_LINE) { - comments.push({ - afterKey: !!key, - before: items.length - }); - } else if (item.type === Type.COMMENT) { - checkFlowCommentSpace(doc.errors, item); - comments.push({ - afterKey: !!key, - before: items.length, - comment: item.comment - }); - } else if (key === undefined) { - if (next === ',') doc.errors.push(new YAMLSemanticError(item, 'Separator , missing in flow map')); - key = resolveNode(doc, item); - } else { - if (next !== ',') doc.errors.push(new YAMLSemanticError(item, 'Indicator : missing in flow map entry')); - items.push(new Pair(key, resolveNode(doc, item))); - key = undefined; - explicitKey = false; - } - } - - checkFlowCollectionEnd(doc.errors, cst); - if (key !== undefined) items.push(new Pair(key)); - return { - comments: comments, - items: items - }; -} - -function resolveSeq(doc, cst) { - if (cst.type !== Type.SEQ && cst.type !== Type.FLOW_SEQ) { - var msg = "A ".concat(cst.type, " node cannot be resolved as a sequence"); - doc.errors.push(new YAMLSyntaxError(cst, msg)); - return null; - } - - var _ref = cst.type === Type.FLOW_SEQ ? resolveFlowSeqItems(doc, cst) : resolveBlockSeqItems(doc, cst), - comments = _ref.comments, - items = _ref.items; - - var seq = new YAMLSeq(); - seq.items = items; - resolveComments(seq, comments); - - if (!doc.options.mapAsMap && items.some(function (it) { - return it instanceof Pair && it.key instanceof Collection; - })) { - var warn = 'Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.'; - doc.warnings.push(new YAMLWarning(cst, warn)); - } - - cst.resolved = seq; - return seq; -} - -function resolveBlockSeqItems(doc, cst) { - var comments = []; - var items = []; - - for (var i = 0; i < cst.items.length; ++i) { - var item = cst.items[i]; - - switch (item.type) { - case Type.BLANK_LINE: - comments.push({ - before: items.length - }); - break; - - case Type.COMMENT: - comments.push({ - comment: item.comment, - before: items.length - }); - break; - - case Type.SEQ_ITEM: - if (item.error) doc.errors.push(item.error); - items.push(resolveNode(doc, item.node)); - - if (item.hasProps) { - var msg = 'Sequence items cannot have tags or anchors before the - indicator'; - doc.errors.push(new YAMLSemanticError(item, msg)); - } - - break; - - default: - if (item.error) doc.errors.push(item.error); - doc.errors.push(new YAMLSyntaxError(item, "Unexpected ".concat(item.type, " node in sequence"))); - } - } - - return { - comments: comments, - items: items - }; -} - -function resolveFlowSeqItems(doc, cst) { - var comments = []; - var items = []; - var explicitKey = false; - var key = undefined; - var keyStart = null; - var next = '['; - var prevItem = null; - - for (var i = 0; i < cst.items.length; ++i) { - var item = cst.items[i]; - - if (typeof item.char === 'string') { - var char = item.char, - offset = item.offset; - - if (char !== ':' && (explicitKey || key !== undefined)) { - if (explicitKey && key === undefined) key = next ? items.pop() : null; - items.push(new Pair(key)); - explicitKey = false; - key = undefined; - keyStart = null; - } - - if (char === next) { - next = null; - } else if (!next && char === '?') { - explicitKey = true; - } else if (next !== '[' && char === ':' && key === undefined) { - if (next === ',') { - key = items.pop(); - - if (key instanceof Pair) { - var msg = 'Chaining flow sequence pairs is invalid'; - var err = new YAMLSemanticError(cst, msg); - err.offset = offset; - doc.errors.push(err); - } - - if (!explicitKey && typeof keyStart === 'number') { - var keyEnd = item.range ? item.range.start : item.offset; - if (keyEnd > keyStart + 1024) doc.errors.push(getLongKeyError(cst, key)); - var src = prevItem.context.src; - - for (var _i = keyStart; _i < keyEnd; ++_i) { - if (src[_i] === '\n') { - var _msg = 'Implicit keys of flow sequence pairs need to be on a single line'; - doc.errors.push(new YAMLSemanticError(prevItem, _msg)); - break; - } - } - } - } else { - key = null; - } - - keyStart = null; - explicitKey = false; - next = null; - } else if (next === '[' || char !== ']' || i < cst.items.length - 1) { - var _msg2 = "Flow sequence contains an unexpected ".concat(char); - - var _err = new YAMLSyntaxError(cst, _msg2); - - _err.offset = offset; - doc.errors.push(_err); - } - } else if (item.type === Type.BLANK_LINE) { - comments.push({ - before: items.length - }); - } else if (item.type === Type.COMMENT) { - checkFlowCommentSpace(doc.errors, item); - comments.push({ - comment: item.comment, - before: items.length - }); - } else { - if (next) { - var _msg3 = "Expected a ".concat(next, " in flow sequence"); - - doc.errors.push(new YAMLSemanticError(item, _msg3)); - } - - var value = resolveNode(doc, item); - - if (key === undefined) { - items.push(value); - prevItem = item; - } else { - items.push(new Pair(key, value)); - key = undefined; - } - - keyStart = item.range.start; - next = ','; - } - } - - checkFlowCollectionEnd(doc.errors, cst); - if (key !== undefined) items.push(new Pair(key)); - return { - comments: comments, - items: items - }; -} - -export { Alias as A, Collection as C, Merge as M, Node as N, Pair as P, Scalar as S, YAMLSeq as Y, boolOptions as a, binaryOptions as b, stringifyString as c, YAMLMap as d, isEmptyPath as e, addComment as f, resolveMap as g, resolveSeq as h, intOptions as i, resolveString as j, stringifyNumber as k, findPair as l, nullOptions as n, resolveNode as r, strOptions as s, toJSON as t }; diff --git a/node_modules/yaml/browser/dist/types.js b/node_modules/yaml/browser/dist/types.js deleted file mode 100644 index da2288bc0..000000000 --- a/node_modules/yaml/browser/dist/types.js +++ /dev/null @@ -1,4 +0,0 @@ -export { A as Alias, C as Collection, M as Merge, N as Node, P as Pair, S as Scalar, d as YAMLMap, Y as YAMLSeq, b as binaryOptions, a as boolOptions, i as intOptions, n as nullOptions, s as strOptions } from './resolveSeq-492ab440.js'; -export { S as Schema } from './Schema-e94716c8.js'; -import './PlainValue-b8036b75.js'; -import './warnings-df54cb69.js'; diff --git a/node_modules/yaml/browser/dist/util.js b/node_modules/yaml/browser/dist/util.js deleted file mode 100644 index 29f4663d6..000000000 --- a/node_modules/yaml/browser/dist/util.js +++ /dev/null @@ -1,2 +0,0 @@ -export { l as findPair, g as parseMap, h as parseSeq, k as stringifyNumber, c as stringifyString, t as toJSON } from './resolveSeq-492ab440.js'; -export { T as Type, i as YAMLError, o as YAMLReferenceError, g as YAMLSemanticError, Y as YAMLSyntaxError, f as YAMLWarning } from './PlainValue-b8036b75.js'; diff --git a/node_modules/yaml/browser/dist/warnings-df54cb69.js b/node_modules/yaml/browser/dist/warnings-df54cb69.js deleted file mode 100644 index 9532e8322..000000000 --- a/node_modules/yaml/browser/dist/warnings-df54cb69.js +++ /dev/null @@ -1,499 +0,0 @@ -import { o as YAMLReferenceError, T as Type, g as YAMLSemanticError, _ as _createForOfIteratorHelper, e as _defineProperty, j as _inherits, k as _createSuper, c as _classCallCheck, p as _assertThisInitialized, b as _createClass, a as _typeof, l as _get, m as _getPrototypeOf } from './PlainValue-b8036b75.js'; -import { j as resolveString, b as binaryOptions, c as stringifyString, h as resolveSeq, P as Pair, d as YAMLMap, Y as YAMLSeq, t as toJSON, S as Scalar, l as findPair, g as resolveMap, k as stringifyNumber } from './resolveSeq-492ab440.js'; - -/* global atob, btoa, Buffer */ -var binary = { - identify: function identify(value) { - return value instanceof Uint8Array; - }, - // Buffer inherits from Uint8Array - default: false, - tag: 'tag:yaml.org,2002:binary', - - /** - * Returns a Buffer in node and an Uint8Array in browsers - * - * To use the resulting buffer as an image, you'll want to do something like: - * - * const blob = new Blob([buffer], { type: 'image/jpeg' }) - * document.querySelector('#photo').src = URL.createObjectURL(blob) - */ - resolve: function resolve(doc, node) { - var src = resolveString(doc, node); - - if (typeof Buffer === 'function') { - return Buffer.from(src, 'base64'); - } else if (typeof atob === 'function') { - // On IE 11, atob() can't handle newlines - var str = atob(src.replace(/[\n\r]/g, '')); - var buffer = new Uint8Array(str.length); - - for (var i = 0; i < str.length; ++i) { - buffer[i] = str.charCodeAt(i); - } - - return buffer; - } else { - var msg = 'This environment does not support reading binary tags; either Buffer or atob is required'; - doc.errors.push(new YAMLReferenceError(node, msg)); - return null; - } - }, - options: binaryOptions, - stringify: function stringify(_ref, ctx, onComment, onChompKeep) { - var comment = _ref.comment, - type = _ref.type, - value = _ref.value; - var src; - - if (typeof Buffer === 'function') { - src = value instanceof Buffer ? value.toString('base64') : Buffer.from(value.buffer).toString('base64'); - } else if (typeof btoa === 'function') { - var s = ''; - - for (var i = 0; i < value.length; ++i) { - s += String.fromCharCode(value[i]); - } - - src = btoa(s); - } else { - throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required'); - } - - if (!type) type = binaryOptions.defaultType; - - if (type === Type.QUOTE_DOUBLE) { - value = src; - } else { - var lineWidth = binaryOptions.lineWidth; - var n = Math.ceil(src.length / lineWidth); - var lines = new Array(n); - - for (var _i = 0, o = 0; _i < n; ++_i, o += lineWidth) { - lines[_i] = src.substr(o, lineWidth); - } - - value = lines.join(type === Type.BLOCK_LITERAL ? '\n' : ' '); - } - - return stringifyString({ - comment: comment, - type: type, - value: value - }, ctx, onComment, onChompKeep); - } -}; - -function parsePairs(doc, cst) { - var seq = resolveSeq(doc, cst); - - for (var i = 0; i < seq.items.length; ++i) { - var item = seq.items[i]; - if (item instanceof Pair) continue;else if (item instanceof YAMLMap) { - if (item.items.length > 1) { - var msg = 'Each pair must have its own sequence indicator'; - throw new YAMLSemanticError(cst, msg); - } - - var pair = item.items[0] || new Pair(); - if (item.commentBefore) pair.commentBefore = pair.commentBefore ? "".concat(item.commentBefore, "\n").concat(pair.commentBefore) : item.commentBefore; - if (item.comment) pair.comment = pair.comment ? "".concat(item.comment, "\n").concat(pair.comment) : item.comment; - item = pair; - } - seq.items[i] = item instanceof Pair ? item : new Pair(item); - } - - return seq; -} -function createPairs(schema, iterable, ctx) { - var pairs = new YAMLSeq(schema); - pairs.tag = 'tag:yaml.org,2002:pairs'; - - var _iterator = _createForOfIteratorHelper(iterable), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var it = _step.value; - var key = void 0, - value = void 0; - - if (Array.isArray(it)) { - if (it.length === 2) { - key = it[0]; - value = it[1]; - } else throw new TypeError("Expected [key, value] tuple: ".concat(it)); - } else if (it && it instanceof Object) { - var keys = Object.keys(it); - - if (keys.length === 1) { - key = keys[0]; - value = it[key]; - } else throw new TypeError("Expected { key: value } tuple: ".concat(it)); - } else { - key = it; - } - - var pair = schema.createPair(key, value, ctx); - pairs.items.push(pair); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return pairs; -} -var pairs = { - default: false, - tag: 'tag:yaml.org,2002:pairs', - resolve: parsePairs, - createNode: createPairs -}; - -var YAMLOMap = /*#__PURE__*/function (_YAMLSeq) { - _inherits(YAMLOMap, _YAMLSeq); - - var _super = _createSuper(YAMLOMap); - - function YAMLOMap() { - var _this; - - _classCallCheck(this, YAMLOMap); - - _this = _super.call(this); - - _defineProperty(_assertThisInitialized(_this), "add", YAMLMap.prototype.add.bind(_assertThisInitialized(_this))); - - _defineProperty(_assertThisInitialized(_this), "delete", YAMLMap.prototype.delete.bind(_assertThisInitialized(_this))); - - _defineProperty(_assertThisInitialized(_this), "get", YAMLMap.prototype.get.bind(_assertThisInitialized(_this))); - - _defineProperty(_assertThisInitialized(_this), "has", YAMLMap.prototype.has.bind(_assertThisInitialized(_this))); - - _defineProperty(_assertThisInitialized(_this), "set", YAMLMap.prototype.set.bind(_assertThisInitialized(_this))); - - _this.tag = YAMLOMap.tag; - return _this; - } - - _createClass(YAMLOMap, [{ - key: "toJSON", - value: function toJSON$1(_, ctx) { - var map = new Map(); - if (ctx && ctx.onCreate) ctx.onCreate(map); - - var _iterator = _createForOfIteratorHelper(this.items), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var pair = _step.value; - var key = void 0, - value = void 0; - - if (pair instanceof Pair) { - key = toJSON(pair.key, '', ctx); - value = toJSON(pair.value, key, ctx); - } else { - key = toJSON(pair, '', ctx); - } - - if (map.has(key)) throw new Error('Ordered maps must not include duplicate keys'); - map.set(key, value); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return map; - } - }]); - - return YAMLOMap; -}(YAMLSeq); - -_defineProperty(YAMLOMap, "tag", 'tag:yaml.org,2002:omap'); - -function parseOMap(doc, cst) { - var pairs = parsePairs(doc, cst); - var seenKeys = []; - - var _iterator2 = _createForOfIteratorHelper(pairs.items), - _step2; - - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { - var key = _step2.value.key; - - if (key instanceof Scalar) { - if (seenKeys.includes(key.value)) { - var msg = 'Ordered maps must not include duplicate keys'; - throw new YAMLSemanticError(cst, msg); - } else { - seenKeys.push(key.value); - } - } - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); - } - - return Object.assign(new YAMLOMap(), pairs); -} - -function createOMap(schema, iterable, ctx) { - var pairs = createPairs(schema, iterable, ctx); - var omap = new YAMLOMap(); - omap.items = pairs.items; - return omap; -} - -var omap = { - identify: function identify(value) { - return value instanceof Map; - }, - nodeClass: YAMLOMap, - default: false, - tag: 'tag:yaml.org,2002:omap', - resolve: parseOMap, - createNode: createOMap -}; - -var YAMLSet = /*#__PURE__*/function (_YAMLMap) { - _inherits(YAMLSet, _YAMLMap); - - var _super = _createSuper(YAMLSet); - - function YAMLSet() { - var _this; - - _classCallCheck(this, YAMLSet); - - _this = _super.call(this); - _this.tag = YAMLSet.tag; - return _this; - } - - _createClass(YAMLSet, [{ - key: "add", - value: function add(key) { - var pair = key instanceof Pair ? key : new Pair(key); - var prev = findPair(this.items, pair.key); - if (!prev) this.items.push(pair); - } - }, { - key: "get", - value: function get(key, keepPair) { - var pair = findPair(this.items, key); - return !keepPair && pair instanceof Pair ? pair.key instanceof Scalar ? pair.key.value : pair.key : pair; - } - }, { - key: "set", - value: function set(key, value) { - if (typeof value !== 'boolean') throw new Error("Expected boolean value for set(key, value) in a YAML set, not ".concat(_typeof(value))); - var prev = findPair(this.items, key); - - if (prev && !value) { - this.items.splice(this.items.indexOf(prev), 1); - } else if (!prev && value) { - this.items.push(new Pair(key)); - } - } - }, { - key: "toJSON", - value: function toJSON(_, ctx) { - return _get(_getPrototypeOf(YAMLSet.prototype), "toJSON", this).call(this, _, ctx, Set); - } - }, { - key: "toString", - value: function toString(ctx, onComment, onChompKeep) { - if (!ctx) return JSON.stringify(this); - if (this.hasAllNullValues()) return _get(_getPrototypeOf(YAMLSet.prototype), "toString", this).call(this, ctx, onComment, onChompKeep);else throw new Error('Set items must all have null values'); - } - }]); - - return YAMLSet; -}(YAMLMap); - -_defineProperty(YAMLSet, "tag", 'tag:yaml.org,2002:set'); - -function parseSet(doc, cst) { - var map = resolveMap(doc, cst); - if (!map.hasAllNullValues()) throw new YAMLSemanticError(cst, 'Set items must all have null values'); - return Object.assign(new YAMLSet(), map); -} - -function createSet(schema, iterable, ctx) { - var set = new YAMLSet(); - - var _iterator = _createForOfIteratorHelper(iterable), - _step; - - try { - for (_iterator.s(); !(_step = _iterator.n()).done;) { - var value = _step.value; - set.items.push(schema.createPair(value, null, ctx)); - } - } catch (err) { - _iterator.e(err); - } finally { - _iterator.f(); - } - - return set; -} - -var set = { - identify: function identify(value) { - return value instanceof Set; - }, - nodeClass: YAMLSet, - default: false, - tag: 'tag:yaml.org,2002:set', - resolve: parseSet, - createNode: createSet -}; - -var parseSexagesimal = function parseSexagesimal(sign, parts) { - var n = parts.split(':').reduce(function (n, p) { - return n * 60 + Number(p); - }, 0); - return sign === '-' ? -n : n; -}; // hhhh:mm:ss.sss - - -var stringifySexagesimal = function stringifySexagesimal(_ref) { - var value = _ref.value; - if (isNaN(value) || !isFinite(value)) return stringifyNumber(value); - var sign = ''; - - if (value < 0) { - sign = '-'; - value = Math.abs(value); - } - - var parts = [value % 60]; // seconds, including ms - - if (value < 60) { - parts.unshift(0); // at least one : is required - } else { - value = Math.round((value - parts[0]) / 60); - parts.unshift(value % 60); // minutes - - if (value >= 60) { - value = Math.round((value - parts[0]) / 60); - parts.unshift(value); // hours - } - } - - return sign + parts.map(function (n) { - return n < 10 ? '0' + String(n) : String(n); - }).join(':').replace(/000000\d*$/, '') // % 60 may introduce error - ; -}; - -var intTime = { - identify: function identify(value) { - return typeof value === 'number'; - }, - default: true, - tag: 'tag:yaml.org,2002:int', - format: 'TIME', - test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/, - resolve: function resolve(str, sign, parts) { - return parseSexagesimal(sign, parts.replace(/_/g, '')); - }, - stringify: stringifySexagesimal -}; -var floatTime = { - identify: function identify(value) { - return typeof value === 'number'; - }, - default: true, - tag: 'tag:yaml.org,2002:float', - format: 'TIME', - test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/, - resolve: function resolve(str, sign, parts) { - return parseSexagesimal(sign, parts.replace(/_/g, '')); - }, - stringify: stringifySexagesimal -}; -var timestamp = { - identify: function identify(value) { - return value instanceof Date; - }, - default: true, - tag: 'tag:yaml.org,2002:timestamp', - // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part - // may be omitted altogether, resulting in a date format. In such a case, the time part is - // assumed to be 00:00:00Z (start of day, UTC). - test: RegExp('^(?:' + '([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})' + // YYYY-Mm-Dd - '(?:(?:t|T|[ \\t]+)' + // t | T | whitespace - '([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)' + // Hh:Mm:Ss(.ss)? - '(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?' + // Z | +5 | -03:30 - ')?' + ')$'), - resolve: function resolve(str, year, month, day, hour, minute, second, millisec, tz) { - if (millisec) millisec = (millisec + '00').substr(1, 3); - var date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec || 0); - - if (tz && tz !== 'Z') { - var d = parseSexagesimal(tz[0], tz.slice(1)); - if (Math.abs(d) < 30) d *= 60; - date -= 60000 * d; - } - - return new Date(date); - }, - stringify: function stringify(_ref2) { - var value = _ref2.value; - return value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, ''); - } -}; - -/* global console, process, YAML_SILENCE_DEPRECATION_WARNINGS, YAML_SILENCE_WARNINGS */ -function shouldWarn(deprecation) { - var env = typeof process !== 'undefined' && process.env || {}; - - if (deprecation) { - if (typeof YAML_SILENCE_DEPRECATION_WARNINGS !== 'undefined') return !YAML_SILENCE_DEPRECATION_WARNINGS; - return !env.YAML_SILENCE_DEPRECATION_WARNINGS; - } - - if (typeof YAML_SILENCE_WARNINGS !== 'undefined') return !YAML_SILENCE_WARNINGS; - return !env.YAML_SILENCE_WARNINGS; -} - -function warn(warning, type) { - if (shouldWarn(false)) { - var emit = typeof process !== 'undefined' && process.emitWarning; // This will throw in Jest if `warning` is an Error instance due to - // https://github.com/facebook/jest/issues/2549 - - if (emit) emit(warning, type);else { - // eslint-disable-next-line no-console - console.warn(type ? "".concat(type, ": ").concat(warning) : warning); - } - } -} -function warnFileDeprecation(filename) { - if (shouldWarn(true)) { - var path = filename.replace(/.*yaml[/\\]/i, '').replace(/\.js$/, '').replace(/\\/g, '/'); - warn("The endpoint 'yaml/".concat(path, "' will be removed in a future release."), 'DeprecationWarning'); - } -} -var warned = {}; -function warnOptionDeprecation(name, alternative) { - if (!warned[name] && shouldWarn(true)) { - warned[name] = true; - var msg = "The option '".concat(name, "' will be removed in a future release"); - msg += alternative ? ", use '".concat(alternative, "' instead.") : '.'; - warn(msg, 'DeprecationWarning'); - } -} - -export { warnOptionDeprecation as a, binary as b, warnFileDeprecation as c, floatTime as f, intTime as i, omap as o, pairs as p, set as s, timestamp as t, warn as w }; diff --git a/node_modules/yaml/browser/index.js b/node_modules/yaml/browser/index.js deleted file mode 100644 index b501ac4db..000000000 --- a/node_modules/yaml/browser/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist').YAML diff --git a/node_modules/yaml/browser/map.js b/node_modules/yaml/browser/map.js deleted file mode 100644 index 78f2ebc74..000000000 --- a/node_modules/yaml/browser/map.js +++ /dev/null @@ -1,2 +0,0 @@ -module.exports = require('./dist/types').YAMLMap -require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/node_modules/yaml/browser/pair.js b/node_modules/yaml/browser/pair.js deleted file mode 100644 index b2880a256..000000000 --- a/node_modules/yaml/browser/pair.js +++ /dev/null @@ -1,2 +0,0 @@ -module.exports = require('./dist/types').Pair -require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/node_modules/yaml/browser/parse-cst.js b/node_modules/yaml/browser/parse-cst.js deleted file mode 100644 index 806575652..000000000 --- a/node_modules/yaml/browser/parse-cst.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/parse-cst').parse diff --git a/node_modules/yaml/browser/scalar.js b/node_modules/yaml/browser/scalar.js deleted file mode 100644 index deee1b03a..000000000 --- a/node_modules/yaml/browser/scalar.js +++ /dev/null @@ -1,2 +0,0 @@ -module.exports = require('./dist/types').Scalar -require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/node_modules/yaml/browser/schema.js b/node_modules/yaml/browser/schema.js deleted file mode 100644 index 4139c4bf8..000000000 --- a/node_modules/yaml/browser/schema.js +++ /dev/null @@ -1,9 +0,0 @@ -const types = require('./dist/types') -const util = require('./dist/util') - -module.exports = types.Schema -module.exports.nullOptions = types.nullOptions -module.exports.strOptions = types.strOptions -module.exports.stringify = util.stringifyString - -require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/node_modules/yaml/browser/seq.js b/node_modules/yaml/browser/seq.js deleted file mode 100644 index 66147df38..000000000 --- a/node_modules/yaml/browser/seq.js +++ /dev/null @@ -1,2 +0,0 @@ -module.exports = require('./dist/types').YAMLSeq -require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/node_modules/yaml/browser/types.js b/node_modules/yaml/browser/types.js deleted file mode 100644 index b1e46c47a..000000000 --- a/node_modules/yaml/browser/types.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/types') diff --git a/node_modules/yaml/browser/types/binary.js b/node_modules/yaml/browser/types/binary.js deleted file mode 100644 index 271b9de38..000000000 --- a/node_modules/yaml/browser/types/binary.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict' -Object.defineProperty(exports, '__esModule', { value: true }) - -const legacy = require('../dist/legacy-exports') -exports.binary = legacy.binary -exports.default = [exports.binary] - -legacy.warnFileDeprecation(__filename) diff --git a/node_modules/yaml/browser/types/omap.js b/node_modules/yaml/browser/types/omap.js deleted file mode 100644 index 37b638b73..000000000 --- a/node_modules/yaml/browser/types/omap.js +++ /dev/null @@ -1,3 +0,0 @@ -const legacy = require('../dist/legacy-exports') -module.exports = legacy.omap -legacy.warnFileDeprecation(__filename) diff --git a/node_modules/yaml/browser/types/pairs.js b/node_modules/yaml/browser/types/pairs.js deleted file mode 100644 index f1df201ce..000000000 --- a/node_modules/yaml/browser/types/pairs.js +++ /dev/null @@ -1,3 +0,0 @@ -const legacy = require('../dist/legacy-exports') -module.exports = legacy.pairs -legacy.warnFileDeprecation(__filename) diff --git a/node_modules/yaml/browser/types/set.js b/node_modules/yaml/browser/types/set.js deleted file mode 100644 index e7dc9d42c..000000000 --- a/node_modules/yaml/browser/types/set.js +++ /dev/null @@ -1,3 +0,0 @@ -const legacy = require('../dist/legacy-exports') -module.exports = legacy.set -legacy.warnFileDeprecation(__filename) diff --git a/node_modules/yaml/browser/types/timestamp.js b/node_modules/yaml/browser/types/timestamp.js deleted file mode 100644 index 39c5b6dd4..000000000 --- a/node_modules/yaml/browser/types/timestamp.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict' -Object.defineProperty(exports, '__esModule', { value: true }) - -const legacy = require('../dist/legacy-exports') -exports.default = [legacy.intTime, legacy.floatTime, legacy.timestamp] -exports.floatTime = legacy.floatTime -exports.intTime = legacy.intTime -exports.timestamp = legacy.timestamp - -legacy.warnFileDeprecation(__filename) diff --git a/node_modules/yaml/browser/util.js b/node_modules/yaml/browser/util.js deleted file mode 100644 index bf3845621..000000000 --- a/node_modules/yaml/browser/util.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/util') diff --git a/node_modules/yaml/dist/Document-9b4560a1.js b/node_modules/yaml/dist/Document-9b4560a1.js deleted file mode 100644 index a2613db28..000000000 --- a/node_modules/yaml/dist/Document-9b4560a1.js +++ /dev/null @@ -1,757 +0,0 @@ -'use strict'; - -var PlainValue = require('./PlainValue-ec8e588e.js'); -var resolveSeq = require('./resolveSeq-d03cb037.js'); -var Schema = require('./Schema-88e323a7.js'); - -const defaultOptions = { - anchorPrefix: 'a', - customTags: null, - indent: 2, - indentSeq: true, - keepCstNodes: false, - keepNodeTypes: true, - keepBlobsInJSON: true, - mapAsMap: false, - maxAliasCount: 100, - prettyErrors: false, - // TODO Set true in v2 - simpleKeys: false, - version: '1.2' -}; -const scalarOptions = { - get binary() { - return resolveSeq.binaryOptions; - }, - - set binary(opt) { - Object.assign(resolveSeq.binaryOptions, opt); - }, - - get bool() { - return resolveSeq.boolOptions; - }, - - set bool(opt) { - Object.assign(resolveSeq.boolOptions, opt); - }, - - get int() { - return resolveSeq.intOptions; - }, - - set int(opt) { - Object.assign(resolveSeq.intOptions, opt); - }, - - get null() { - return resolveSeq.nullOptions; - }, - - set null(opt) { - Object.assign(resolveSeq.nullOptions, opt); - }, - - get str() { - return resolveSeq.strOptions; - }, - - set str(opt) { - Object.assign(resolveSeq.strOptions, opt); - } - -}; -const documentOptions = { - '1.0': { - schema: 'yaml-1.1', - merge: true, - tagPrefixes: [{ - handle: '!', - prefix: PlainValue.defaultTagPrefix - }, { - handle: '!!', - prefix: 'tag:private.yaml.org,2002:' - }] - }, - 1.1: { - schema: 'yaml-1.1', - merge: true, - tagPrefixes: [{ - handle: '!', - prefix: '!' - }, { - handle: '!!', - prefix: PlainValue.defaultTagPrefix - }] - }, - 1.2: { - schema: 'core', - merge: false, - tagPrefixes: [{ - handle: '!', - prefix: '!' - }, { - handle: '!!', - prefix: PlainValue.defaultTagPrefix - }] - } -}; - -function stringifyTag(doc, tag) { - if ((doc.version || doc.options.version) === '1.0') { - const priv = tag.match(/^tag:private\.yaml\.org,2002:([^:/]+)$/); - if (priv) return '!' + priv[1]; - const vocab = tag.match(/^tag:([a-zA-Z0-9-]+)\.yaml\.org,2002:(.*)/); - return vocab ? `!${vocab[1]}/${vocab[2]}` : `!${tag.replace(/^tag:/, '')}`; - } - - let p = doc.tagPrefixes.find(p => tag.indexOf(p.prefix) === 0); - - if (!p) { - const dtp = doc.getDefaults().tagPrefixes; - p = dtp && dtp.find(p => tag.indexOf(p.prefix) === 0); - } - - if (!p) return tag[0] === '!' ? tag : `!<${tag}>`; - const suffix = tag.substr(p.prefix.length).replace(/[!,[\]{}]/g, ch => ({ - '!': '%21', - ',': '%2C', - '[': '%5B', - ']': '%5D', - '{': '%7B', - '}': '%7D' - })[ch]); - return p.handle + suffix; -} - -function getTagObject(tags, item) { - if (item instanceof resolveSeq.Alias) return resolveSeq.Alias; - - if (item.tag) { - const match = tags.filter(t => t.tag === item.tag); - if (match.length > 0) return match.find(t => t.format === item.format) || match[0]; - } - - let tagObj, obj; - - if (item instanceof resolveSeq.Scalar) { - obj = item.value; // TODO: deprecate/remove class check - - const match = tags.filter(t => t.identify && t.identify(obj) || t.class && obj instanceof t.class); - tagObj = match.find(t => t.format === item.format) || match.find(t => !t.format); - } else { - obj = item; - tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass); - } - - if (!tagObj) { - const name = obj && obj.constructor ? obj.constructor.name : typeof obj; - throw new Error(`Tag not resolved for ${name} value`); - } - - return tagObj; -} // needs to be called before value stringifier to allow for circular anchor refs - - -function stringifyProps(node, tagObj, { - anchors, - doc -}) { - const props = []; - const anchor = doc.anchors.getName(node); - - if (anchor) { - anchors[anchor] = node; - props.push(`&${anchor}`); - } - - if (node.tag) { - props.push(stringifyTag(doc, node.tag)); - } else if (!tagObj.default) { - props.push(stringifyTag(doc, tagObj.tag)); - } - - return props.join(' '); -} - -function stringify(item, ctx, onComment, onChompKeep) { - const { - anchors, - schema - } = ctx.doc; - let tagObj; - - if (!(item instanceof resolveSeq.Node)) { - const createCtx = { - aliasNodes: [], - onTagObj: o => tagObj = o, - prevObjects: new Map() - }; - item = schema.createNode(item, true, null, createCtx); - - for (const alias of createCtx.aliasNodes) { - alias.source = alias.source.node; - let name = anchors.getName(alias.source); - - if (!name) { - name = anchors.newName(); - anchors.map[name] = alias.source; - } - } - } - - if (item instanceof resolveSeq.Pair) return item.toString(ctx, onComment, onChompKeep); - if (!tagObj) tagObj = getTagObject(schema.tags, item); - const props = stringifyProps(item, tagObj, ctx); - if (props.length > 0) ctx.indentAtStart = (ctx.indentAtStart || 0) + props.length + 1; - const str = typeof tagObj.stringify === 'function' ? tagObj.stringify(item, ctx, onComment, onChompKeep) : item instanceof resolveSeq.Scalar ? resolveSeq.stringifyString(item, ctx, onComment, onChompKeep) : item.toString(ctx, onComment, onChompKeep); - if (!props) return str; - return item instanceof resolveSeq.Scalar || str[0] === '{' || str[0] === '[' ? `${props} ${str}` : `${props}\n${ctx.indent}${str}`; -} - -class Anchors { - static validAnchorNode(node) { - return node instanceof resolveSeq.Scalar || node instanceof resolveSeq.YAMLSeq || node instanceof resolveSeq.YAMLMap; - } - - constructor(prefix) { - PlainValue._defineProperty(this, "map", Object.create(null)); - - this.prefix = prefix; - } - - createAlias(node, name) { - this.setAnchor(node, name); - return new resolveSeq.Alias(node); - } - - createMergePair(...sources) { - const merge = new resolveSeq.Merge(); - merge.value.items = sources.map(s => { - if (s instanceof resolveSeq.Alias) { - if (s.source instanceof resolveSeq.YAMLMap) return s; - } else if (s instanceof resolveSeq.YAMLMap) { - return this.createAlias(s); - } - - throw new Error('Merge sources must be Map nodes or their Aliases'); - }); - return merge; - } - - getName(node) { - const { - map - } = this; - return Object.keys(map).find(a => map[a] === node); - } - - getNames() { - return Object.keys(this.map); - } - - getNode(name) { - return this.map[name]; - } - - newName(prefix) { - if (!prefix) prefix = this.prefix; - const names = Object.keys(this.map); - - for (let i = 1; true; ++i) { - const name = `${prefix}${i}`; - if (!names.includes(name)) return name; - } - } // During parsing, map & aliases contain CST nodes - - - resolveNodes() { - const { - map, - _cstAliases - } = this; - Object.keys(map).forEach(a => { - map[a] = map[a].resolved; - }); - - _cstAliases.forEach(a => { - a.source = a.source.resolved; - }); - - delete this._cstAliases; - } - - setAnchor(node, name) { - if (node != null && !Anchors.validAnchorNode(node)) { - throw new Error('Anchors may only be set for Scalar, Seq and Map nodes'); - } - - if (name && /[\x00-\x19\s,[\]{}]/.test(name)) { - throw new Error('Anchor names must not contain whitespace or control characters'); - } - - const { - map - } = this; - const prev = node && Object.keys(map).find(a => map[a] === node); - - if (prev) { - if (!name) { - return prev; - } else if (prev !== name) { - delete map[prev]; - map[name] = node; - } - } else { - if (!name) { - if (!node) return null; - name = this.newName(); - } - - map[name] = node; - } - - return name; - } - -} - -const visit = (node, tags) => { - if (node && typeof node === 'object') { - const { - tag - } = node; - - if (node instanceof resolveSeq.Collection) { - if (tag) tags[tag] = true; - node.items.forEach(n => visit(n, tags)); - } else if (node instanceof resolveSeq.Pair) { - visit(node.key, tags); - visit(node.value, tags); - } else if (node instanceof resolveSeq.Scalar) { - if (tag) tags[tag] = true; - } - } - - return tags; -}; - -const listTagNames = node => Object.keys(visit(node, {})); - -function parseContents(doc, contents) { - const comments = { - before: [], - after: [] - }; - let body = undefined; - let spaceBefore = false; - - for (const node of contents) { - if (node.valueRange) { - if (body !== undefined) { - const msg = 'Document contains trailing content not separated by a ... or --- line'; - doc.errors.push(new PlainValue.YAMLSyntaxError(node, msg)); - break; - } - - const res = resolveSeq.resolveNode(doc, node); - - if (spaceBefore) { - res.spaceBefore = true; - spaceBefore = false; - } - - body = res; - } else if (node.comment !== null) { - const cc = body === undefined ? comments.before : comments.after; - cc.push(node.comment); - } else if (node.type === PlainValue.Type.BLANK_LINE) { - spaceBefore = true; - - if (body === undefined && comments.before.length > 0 && !doc.commentBefore) { - // space-separated comments at start are parsed as document comments - doc.commentBefore = comments.before.join('\n'); - comments.before = []; - } - } - } - - doc.contents = body || null; - - if (!body) { - doc.comment = comments.before.concat(comments.after).join('\n') || null; - } else { - const cb = comments.before.join('\n'); - - if (cb) { - const cbNode = body instanceof resolveSeq.Collection && body.items[0] ? body.items[0] : body; - cbNode.commentBefore = cbNode.commentBefore ? `${cb}\n${cbNode.commentBefore}` : cb; - } - - doc.comment = comments.after.join('\n') || null; - } -} - -function resolveTagDirective({ - tagPrefixes -}, directive) { - const [handle, prefix] = directive.parameters; - - if (!handle || !prefix) { - const msg = 'Insufficient parameters given for %TAG directive'; - throw new PlainValue.YAMLSemanticError(directive, msg); - } - - if (tagPrefixes.some(p => p.handle === handle)) { - const msg = 'The %TAG directive must only be given at most once per handle in the same document.'; - throw new PlainValue.YAMLSemanticError(directive, msg); - } - - return { - handle, - prefix - }; -} - -function resolveYamlDirective(doc, directive) { - let [version] = directive.parameters; - if (directive.name === 'YAML:1.0') version = '1.0'; - - if (!version) { - const msg = 'Insufficient parameters given for %YAML directive'; - throw new PlainValue.YAMLSemanticError(directive, msg); - } - - if (!documentOptions[version]) { - const v0 = doc.version || doc.options.version; - const msg = `Document will be parsed as YAML ${v0} rather than YAML ${version}`; - doc.warnings.push(new PlainValue.YAMLWarning(directive, msg)); - } - - return version; -} - -function parseDirectives(doc, directives, prevDoc) { - const directiveComments = []; - let hasDirectives = false; - - for (const directive of directives) { - const { - comment, - name - } = directive; - - switch (name) { - case 'TAG': - try { - doc.tagPrefixes.push(resolveTagDirective(doc, directive)); - } catch (error) { - doc.errors.push(error); - } - - hasDirectives = true; - break; - - case 'YAML': - case 'YAML:1.0': - if (doc.version) { - const msg = 'The %YAML directive must only be given at most once per document.'; - doc.errors.push(new PlainValue.YAMLSemanticError(directive, msg)); - } - - try { - doc.version = resolveYamlDirective(doc, directive); - } catch (error) { - doc.errors.push(error); - } - - hasDirectives = true; - break; - - default: - if (name) { - const msg = `YAML only supports %TAG and %YAML directives, and not %${name}`; - doc.warnings.push(new PlainValue.YAMLWarning(directive, msg)); - } - - } - - if (comment) directiveComments.push(comment); - } - - if (prevDoc && !hasDirectives && '1.1' === (doc.version || prevDoc.version || doc.options.version)) { - const copyTagPrefix = ({ - handle, - prefix - }) => ({ - handle, - prefix - }); - - doc.tagPrefixes = prevDoc.tagPrefixes.map(copyTagPrefix); - doc.version = prevDoc.version; - } - - doc.commentBefore = directiveComments.join('\n') || null; -} - -function assertCollection(contents) { - if (contents instanceof resolveSeq.Collection) return true; - throw new Error('Expected a YAML collection as document contents'); -} - -class Document { - constructor(options) { - this.anchors = new Anchors(options.anchorPrefix); - this.commentBefore = null; - this.comment = null; - this.contents = null; - this.directivesEndMarker = null; - this.errors = []; - this.options = options; - this.schema = null; - this.tagPrefixes = []; - this.version = null; - this.warnings = []; - } - - add(value) { - assertCollection(this.contents); - return this.contents.add(value); - } - - addIn(path, value) { - assertCollection(this.contents); - this.contents.addIn(path, value); - } - - delete(key) { - assertCollection(this.contents); - return this.contents.delete(key); - } - - deleteIn(path) { - if (resolveSeq.isEmptyPath(path)) { - if (this.contents == null) return false; - this.contents = null; - return true; - } - - assertCollection(this.contents); - return this.contents.deleteIn(path); - } - - getDefaults() { - return Document.defaults[this.version] || Document.defaults[this.options.version] || {}; - } - - get(key, keepScalar) { - return this.contents instanceof resolveSeq.Collection ? this.contents.get(key, keepScalar) : undefined; - } - - getIn(path, keepScalar) { - if (resolveSeq.isEmptyPath(path)) return !keepScalar && this.contents instanceof resolveSeq.Scalar ? this.contents.value : this.contents; - return this.contents instanceof resolveSeq.Collection ? this.contents.getIn(path, keepScalar) : undefined; - } - - has(key) { - return this.contents instanceof resolveSeq.Collection ? this.contents.has(key) : false; - } - - hasIn(path) { - if (resolveSeq.isEmptyPath(path)) return this.contents !== undefined; - return this.contents instanceof resolveSeq.Collection ? this.contents.hasIn(path) : false; - } - - set(key, value) { - assertCollection(this.contents); - this.contents.set(key, value); - } - - setIn(path, value) { - if (resolveSeq.isEmptyPath(path)) this.contents = value;else { - assertCollection(this.contents); - this.contents.setIn(path, value); - } - } - - setSchema(id, customTags) { - if (!id && !customTags && this.schema) return; - if (typeof id === 'number') id = id.toFixed(1); - - if (id === '1.0' || id === '1.1' || id === '1.2') { - if (this.version) this.version = id;else this.options.version = id; - delete this.options.schema; - } else if (id && typeof id === 'string') { - this.options.schema = id; - } - - if (Array.isArray(customTags)) this.options.customTags = customTags; - const opt = Object.assign({}, this.getDefaults(), this.options); - this.schema = new Schema.Schema(opt); - } - - parse(node, prevDoc) { - if (this.options.keepCstNodes) this.cstNode = node; - if (this.options.keepNodeTypes) this.type = 'DOCUMENT'; - const { - directives = [], - contents = [], - directivesEndMarker, - error, - valueRange - } = node; - - if (error) { - if (!error.source) error.source = this; - this.errors.push(error); - } - - parseDirectives(this, directives, prevDoc); - if (directivesEndMarker) this.directivesEndMarker = true; - this.range = valueRange ? [valueRange.start, valueRange.end] : null; - this.setSchema(); - this.anchors._cstAliases = []; - parseContents(this, contents); - this.anchors.resolveNodes(); - - if (this.options.prettyErrors) { - for (const error of this.errors) if (error instanceof PlainValue.YAMLError) error.makePretty(); - - for (const warn of this.warnings) if (warn instanceof PlainValue.YAMLError) warn.makePretty(); - } - - return this; - } - - listNonDefaultTags() { - return listTagNames(this.contents).filter(t => t.indexOf(Schema.Schema.defaultPrefix) !== 0); - } - - setTagPrefix(handle, prefix) { - if (handle[0] !== '!' || handle[handle.length - 1] !== '!') throw new Error('Handle must start and end with !'); - - if (prefix) { - const prev = this.tagPrefixes.find(p => p.handle === handle); - if (prev) prev.prefix = prefix;else this.tagPrefixes.push({ - handle, - prefix - }); - } else { - this.tagPrefixes = this.tagPrefixes.filter(p => p.handle !== handle); - } - } - - toJSON(arg, onAnchor) { - const { - keepBlobsInJSON, - mapAsMap, - maxAliasCount - } = this.options; - const keep = keepBlobsInJSON && (typeof arg !== 'string' || !(this.contents instanceof resolveSeq.Scalar)); - const ctx = { - doc: this, - indentStep: ' ', - keep, - mapAsMap: keep && !!mapAsMap, - maxAliasCount, - stringify // Requiring directly in Pair would create circular dependencies - - }; - const anchorNames = Object.keys(this.anchors.map); - if (anchorNames.length > 0) ctx.anchors = new Map(anchorNames.map(name => [this.anchors.map[name], { - alias: [], - aliasCount: 0, - count: 1 - }])); - const res = resolveSeq.toJSON(this.contents, arg, ctx); - if (typeof onAnchor === 'function' && ctx.anchors) for (const { - count, - res - } of ctx.anchors.values()) onAnchor(res, count); - return res; - } - - toString() { - if (this.errors.length > 0) throw new Error('Document with errors cannot be stringified'); - const indentSize = this.options.indent; - - if (!Number.isInteger(indentSize) || indentSize <= 0) { - const s = JSON.stringify(indentSize); - throw new Error(`"indent" option must be a positive integer, not ${s}`); - } - - this.setSchema(); - const lines = []; - let hasDirectives = false; - - if (this.version) { - let vd = '%YAML 1.2'; - - if (this.schema.name === 'yaml-1.1') { - if (this.version === '1.0') vd = '%YAML:1.0';else if (this.version === '1.1') vd = '%YAML 1.1'; - } - - lines.push(vd); - hasDirectives = true; - } - - const tagNames = this.listNonDefaultTags(); - this.tagPrefixes.forEach(({ - handle, - prefix - }) => { - if (tagNames.some(t => t.indexOf(prefix) === 0)) { - lines.push(`%TAG ${handle} ${prefix}`); - hasDirectives = true; - } - }); - if (hasDirectives || this.directivesEndMarker) lines.push('---'); - - if (this.commentBefore) { - if (hasDirectives || !this.directivesEndMarker) lines.unshift(''); - lines.unshift(this.commentBefore.replace(/^/gm, '#')); - } - - const ctx = { - anchors: Object.create(null), - doc: this, - indent: '', - indentStep: ' '.repeat(indentSize), - stringify // Requiring directly in nodes would create circular dependencies - - }; - let chompKeep = false; - let contentComment = null; - - if (this.contents) { - if (this.contents instanceof resolveSeq.Node) { - if (this.contents.spaceBefore && (hasDirectives || this.directivesEndMarker)) lines.push(''); - if (this.contents.commentBefore) lines.push(this.contents.commentBefore.replace(/^/gm, '#')); // top-level block scalars need to be indented if followed by a comment - - ctx.forceBlockIndent = !!this.comment; - contentComment = this.contents.comment; - } - - const onChompKeep = contentComment ? null : () => chompKeep = true; - const body = stringify(this.contents, ctx, () => contentComment = null, onChompKeep); - lines.push(resolveSeq.addComment(body, '', contentComment)); - } else if (this.contents !== undefined) { - lines.push(stringify(this.contents, ctx)); - } - - if (this.comment) { - if ((!chompKeep || contentComment) && lines[lines.length - 1] !== '') lines.push(''); - lines.push(this.comment.replace(/^/gm, '#')); - } - - return lines.join('\n') + '\n'; - } - -} - -PlainValue._defineProperty(Document, "defaults", documentOptions); - -exports.Document = Document; -exports.defaultOptions = defaultOptions; -exports.scalarOptions = scalarOptions; diff --git a/node_modules/yaml/dist/PlainValue-ec8e588e.js b/node_modules/yaml/dist/PlainValue-ec8e588e.js deleted file mode 100644 index db8a14e3c..000000000 --- a/node_modules/yaml/dist/PlainValue-ec8e588e.js +++ /dev/null @@ -1,876 +0,0 @@ -'use strict'; - -const Char = { - ANCHOR: '&', - COMMENT: '#', - TAG: '!', - DIRECTIVES_END: '-', - DOCUMENT_END: '.' -}; -const Type = { - ALIAS: 'ALIAS', - BLANK_LINE: 'BLANK_LINE', - BLOCK_FOLDED: 'BLOCK_FOLDED', - BLOCK_LITERAL: 'BLOCK_LITERAL', - COMMENT: 'COMMENT', - DIRECTIVE: 'DIRECTIVE', - DOCUMENT: 'DOCUMENT', - FLOW_MAP: 'FLOW_MAP', - FLOW_SEQ: 'FLOW_SEQ', - MAP: 'MAP', - MAP_KEY: 'MAP_KEY', - MAP_VALUE: 'MAP_VALUE', - PLAIN: 'PLAIN', - QUOTE_DOUBLE: 'QUOTE_DOUBLE', - QUOTE_SINGLE: 'QUOTE_SINGLE', - SEQ: 'SEQ', - SEQ_ITEM: 'SEQ_ITEM' -}; -const defaultTagPrefix = 'tag:yaml.org,2002:'; -const defaultTags = { - MAP: 'tag:yaml.org,2002:map', - SEQ: 'tag:yaml.org,2002:seq', - STR: 'tag:yaml.org,2002:str' -}; - -function findLineStarts(src) { - const ls = [0]; - let offset = src.indexOf('\n'); - - while (offset !== -1) { - offset += 1; - ls.push(offset); - offset = src.indexOf('\n', offset); - } - - return ls; -} - -function getSrcInfo(cst) { - let lineStarts, src; - - if (typeof cst === 'string') { - lineStarts = findLineStarts(cst); - src = cst; - } else { - if (Array.isArray(cst)) cst = cst[0]; - - if (cst && cst.context) { - if (!cst.lineStarts) cst.lineStarts = findLineStarts(cst.context.src); - lineStarts = cst.lineStarts; - src = cst.context.src; - } - } - - return { - lineStarts, - src - }; -} -/** - * @typedef {Object} LinePos - One-indexed position in the source - * @property {number} line - * @property {number} col - */ - -/** - * Determine the line/col position matching a character offset. - * - * Accepts a source string or a CST document as the second parameter. With - * the latter, starting indices for lines are cached in the document as - * `lineStarts: number[]`. - * - * Returns a one-indexed `{ line, col }` location if found, or - * `undefined` otherwise. - * - * @param {number} offset - * @param {string|Document|Document[]} cst - * @returns {?LinePos} - */ - - -function getLinePos(offset, cst) { - if (typeof offset !== 'number' || offset < 0) return null; - const { - lineStarts, - src - } = getSrcInfo(cst); - if (!lineStarts || !src || offset > src.length) return null; - - for (let i = 0; i < lineStarts.length; ++i) { - const start = lineStarts[i]; - - if (offset < start) { - return { - line: i, - col: offset - lineStarts[i - 1] + 1 - }; - } - - if (offset === start) return { - line: i + 1, - col: 1 - }; - } - - const line = lineStarts.length; - return { - line, - col: offset - lineStarts[line - 1] + 1 - }; -} -/** - * Get a specified line from the source. - * - * Accepts a source string or a CST document as the second parameter. With - * the latter, starting indices for lines are cached in the document as - * `lineStarts: number[]`. - * - * Returns the line as a string if found, or `null` otherwise. - * - * @param {number} line One-indexed line number - * @param {string|Document|Document[]} cst - * @returns {?string} - */ - -function getLine(line, cst) { - const { - lineStarts, - src - } = getSrcInfo(cst); - if (!lineStarts || !(line >= 1) || line > lineStarts.length) return null; - const start = lineStarts[line - 1]; - let end = lineStarts[line]; // undefined for last line; that's ok for slice() - - while (end && end > start && src[end - 1] === '\n') --end; - - return src.slice(start, end); -} -/** - * Pretty-print the starting line from the source indicated by the range `pos` - * - * Trims output to `maxWidth` chars while keeping the starting column visible, - * using `…` at either end to indicate dropped characters. - * - * Returns a two-line string (or `null`) with `\n` as separator; the second line - * will hold appropriately indented `^` marks indicating the column range. - * - * @param {Object} pos - * @param {LinePos} pos.start - * @param {LinePos} [pos.end] - * @param {string|Document|Document[]*} cst - * @param {number} [maxWidth=80] - * @returns {?string} - */ - -function getPrettyContext({ - start, - end -}, cst, maxWidth = 80) { - let src = getLine(start.line, cst); - if (!src) return null; - let { - col - } = start; - - if (src.length > maxWidth) { - if (col <= maxWidth - 10) { - src = src.substr(0, maxWidth - 1) + '…'; - } else { - const halfWidth = Math.round(maxWidth / 2); - if (src.length > col + halfWidth) src = src.substr(0, col + halfWidth - 1) + '…'; - col -= src.length - maxWidth; - src = '…' + src.substr(1 - maxWidth); - } - } - - let errLen = 1; - let errEnd = ''; - - if (end) { - if (end.line === start.line && col + (end.col - start.col) <= maxWidth + 1) { - errLen = end.col - start.col; - } else { - errLen = Math.min(src.length + 1, maxWidth) - col; - errEnd = '…'; - } - } - - const offset = col > 1 ? ' '.repeat(col - 1) : ''; - const err = '^'.repeat(errLen); - return `${src}\n${offset}${err}${errEnd}`; -} - -class Range { - static copy(orig) { - return new Range(orig.start, orig.end); - } - - constructor(start, end) { - this.start = start; - this.end = end || start; - } - - isEmpty() { - return typeof this.start !== 'number' || !this.end || this.end <= this.start; - } - /** - * Set `origStart` and `origEnd` to point to the original source range for - * this node, which may differ due to dropped CR characters. - * - * @param {number[]} cr - Positions of dropped CR characters - * @param {number} offset - Starting index of `cr` from the last call - * @returns {number} - The next offset, matching the one found for `origStart` - */ - - - setOrigRange(cr, offset) { - const { - start, - end - } = this; - - if (cr.length === 0 || end <= cr[0]) { - this.origStart = start; - this.origEnd = end; - return offset; - } - - let i = offset; - - while (i < cr.length) { - if (cr[i] > start) break;else ++i; - } - - this.origStart = start + i; - const nextOffset = i; - - while (i < cr.length) { - // if end was at \n, it should now be at \r - if (cr[i] >= end) break;else ++i; - } - - this.origEnd = end + i; - return nextOffset; - } - -} - -/** Root class of all nodes */ - -class Node { - static addStringTerminator(src, offset, str) { - if (str[str.length - 1] === '\n') return str; - const next = Node.endOfWhiteSpace(src, offset); - return next >= src.length || src[next] === '\n' ? str + '\n' : str; - } // ^(---|...) - - - static atDocumentBoundary(src, offset, sep) { - const ch0 = src[offset]; - if (!ch0) return true; - const prev = src[offset - 1]; - if (prev && prev !== '\n') return false; - - if (sep) { - if (ch0 !== sep) return false; - } else { - if (ch0 !== Char.DIRECTIVES_END && ch0 !== Char.DOCUMENT_END) return false; - } - - const ch1 = src[offset + 1]; - const ch2 = src[offset + 2]; - if (ch1 !== ch0 || ch2 !== ch0) return false; - const ch3 = src[offset + 3]; - return !ch3 || ch3 === '\n' || ch3 === '\t' || ch3 === ' '; - } - - static endOfIdentifier(src, offset) { - let ch = src[offset]; - const isVerbatim = ch === '<'; - const notOk = isVerbatim ? ['\n', '\t', ' ', '>'] : ['\n', '\t', ' ', '[', ']', '{', '}', ',']; - - while (ch && notOk.indexOf(ch) === -1) ch = src[offset += 1]; - - if (isVerbatim && ch === '>') offset += 1; - return offset; - } - - static endOfIndent(src, offset) { - let ch = src[offset]; - - while (ch === ' ') ch = src[offset += 1]; - - return offset; - } - - static endOfLine(src, offset) { - let ch = src[offset]; - - while (ch && ch !== '\n') ch = src[offset += 1]; - - return offset; - } - - static endOfWhiteSpace(src, offset) { - let ch = src[offset]; - - while (ch === '\t' || ch === ' ') ch = src[offset += 1]; - - return offset; - } - - static startOfLine(src, offset) { - let ch = src[offset - 1]; - if (ch === '\n') return offset; - - while (ch && ch !== '\n') ch = src[offset -= 1]; - - return offset + 1; - } - /** - * End of indentation, or null if the line's indent level is not more - * than `indent` - * - * @param {string} src - * @param {number} indent - * @param {number} lineStart - * @returns {?number} - */ - - - static endOfBlockIndent(src, indent, lineStart) { - const inEnd = Node.endOfIndent(src, lineStart); - - if (inEnd > lineStart + indent) { - return inEnd; - } else { - const wsEnd = Node.endOfWhiteSpace(src, inEnd); - const ch = src[wsEnd]; - if (!ch || ch === '\n') return wsEnd; - } - - return null; - } - - static atBlank(src, offset, endAsBlank) { - const ch = src[offset]; - return ch === '\n' || ch === '\t' || ch === ' ' || endAsBlank && !ch; - } - - static nextNodeIsIndented(ch, indentDiff, indicatorAsIndent) { - if (!ch || indentDiff < 0) return false; - if (indentDiff > 0) return true; - return indicatorAsIndent && ch === '-'; - } // should be at line or string end, or at next non-whitespace char - - - static normalizeOffset(src, offset) { - const ch = src[offset]; - return !ch ? offset : ch !== '\n' && src[offset - 1] === '\n' ? offset - 1 : Node.endOfWhiteSpace(src, offset); - } // fold single newline into space, multiple newlines to N - 1 newlines - // presumes src[offset] === '\n' - - - static foldNewline(src, offset, indent) { - let inCount = 0; - let error = false; - let fold = ''; - let ch = src[offset + 1]; - - while (ch === ' ' || ch === '\t' || ch === '\n') { - switch (ch) { - case '\n': - inCount = 0; - offset += 1; - fold += '\n'; - break; - - case '\t': - if (inCount <= indent) error = true; - offset = Node.endOfWhiteSpace(src, offset + 2) - 1; - break; - - case ' ': - inCount += 1; - offset += 1; - break; - } - - ch = src[offset + 1]; - } - - if (!fold) fold = ' '; - if (ch && inCount <= indent) error = true; - return { - fold, - offset, - error - }; - } - - constructor(type, props, context) { - Object.defineProperty(this, 'context', { - value: context || null, - writable: true - }); - this.error = null; - this.range = null; - this.valueRange = null; - this.props = props || []; - this.type = type; - this.value = null; - } - - getPropValue(idx, key, skipKey) { - if (!this.context) return null; - const { - src - } = this.context; - const prop = this.props[idx]; - return prop && src[prop.start] === key ? src.slice(prop.start + (skipKey ? 1 : 0), prop.end) : null; - } - - get anchor() { - for (let i = 0; i < this.props.length; ++i) { - const anchor = this.getPropValue(i, Char.ANCHOR, true); - if (anchor != null) return anchor; - } - - return null; - } - - get comment() { - const comments = []; - - for (let i = 0; i < this.props.length; ++i) { - const comment = this.getPropValue(i, Char.COMMENT, true); - if (comment != null) comments.push(comment); - } - - return comments.length > 0 ? comments.join('\n') : null; - } - - commentHasRequiredWhitespace(start) { - const { - src - } = this.context; - if (this.header && start === this.header.end) return false; - if (!this.valueRange) return false; - const { - end - } = this.valueRange; - return start !== end || Node.atBlank(src, end - 1); - } - - get hasComment() { - if (this.context) { - const { - src - } = this.context; - - for (let i = 0; i < this.props.length; ++i) { - if (src[this.props[i].start] === Char.COMMENT) return true; - } - } - - return false; - } - - get hasProps() { - if (this.context) { - const { - src - } = this.context; - - for (let i = 0; i < this.props.length; ++i) { - if (src[this.props[i].start] !== Char.COMMENT) return true; - } - } - - return false; - } - - get includesTrailingLines() { - return false; - } - - get jsonLike() { - const jsonLikeTypes = [Type.FLOW_MAP, Type.FLOW_SEQ, Type.QUOTE_DOUBLE, Type.QUOTE_SINGLE]; - return jsonLikeTypes.indexOf(this.type) !== -1; - } - - get rangeAsLinePos() { - if (!this.range || !this.context) return undefined; - const start = getLinePos(this.range.start, this.context.root); - if (!start) return undefined; - const end = getLinePos(this.range.end, this.context.root); - return { - start, - end - }; - } - - get rawValue() { - if (!this.valueRange || !this.context) return null; - const { - start, - end - } = this.valueRange; - return this.context.src.slice(start, end); - } - - get tag() { - for (let i = 0; i < this.props.length; ++i) { - const tag = this.getPropValue(i, Char.TAG, false); - - if (tag != null) { - if (tag[1] === '<') { - return { - verbatim: tag.slice(2, -1) - }; - } else { - // eslint-disable-next-line no-unused-vars - const [_, handle, suffix] = tag.match(/^(.*!)([^!]*)$/); - return { - handle, - suffix - }; - } - } - } - - return null; - } - - get valueRangeContainsNewline() { - if (!this.valueRange || !this.context) return false; - const { - start, - end - } = this.valueRange; - const { - src - } = this.context; - - for (let i = start; i < end; ++i) { - if (src[i] === '\n') return true; - } - - return false; - } - - parseComment(start) { - const { - src - } = this.context; - - if (src[start] === Char.COMMENT) { - const end = Node.endOfLine(src, start + 1); - const commentRange = new Range(start, end); - this.props.push(commentRange); - return end; - } - - return start; - } - /** - * Populates the `origStart` and `origEnd` values of all ranges for this - * node. Extended by child classes to handle descendant nodes. - * - * @param {number[]} cr - Positions of dropped CR characters - * @param {number} offset - Starting index of `cr` from the last call - * @returns {number} - The next offset, matching the one found for `origStart` - */ - - - setOrigRanges(cr, offset) { - if (this.range) offset = this.range.setOrigRange(cr, offset); - if (this.valueRange) this.valueRange.setOrigRange(cr, offset); - this.props.forEach(prop => prop.setOrigRange(cr, offset)); - return offset; - } - - toString() { - const { - context: { - src - }, - range, - value - } = this; - if (value != null) return value; - const str = src.slice(range.start, range.end); - return Node.addStringTerminator(src, range.end, str); - } - -} - -class YAMLError extends Error { - constructor(name, source, message) { - if (!message || !(source instanceof Node)) throw new Error(`Invalid arguments for new ${name}`); - super(); - this.name = name; - this.message = message; - this.source = source; - } - - makePretty() { - if (!this.source) return; - this.nodeType = this.source.type; - const cst = this.source.context && this.source.context.root; - - if (typeof this.offset === 'number') { - this.range = new Range(this.offset, this.offset + 1); - const start = cst && getLinePos(this.offset, cst); - - if (start) { - const end = { - line: start.line, - col: start.col + 1 - }; - this.linePos = { - start, - end - }; - } - - delete this.offset; - } else { - this.range = this.source.range; - this.linePos = this.source.rangeAsLinePos; - } - - if (this.linePos) { - const { - line, - col - } = this.linePos.start; - this.message += ` at line ${line}, column ${col}`; - const ctx = cst && getPrettyContext(this.linePos, cst); - if (ctx) this.message += `:\n\n${ctx}\n`; - } - - delete this.source; - } - -} -class YAMLReferenceError extends YAMLError { - constructor(source, message) { - super('YAMLReferenceError', source, message); - } - -} -class YAMLSemanticError extends YAMLError { - constructor(source, message) { - super('YAMLSemanticError', source, message); - } - -} -class YAMLSyntaxError extends YAMLError { - constructor(source, message) { - super('YAMLSyntaxError', source, message); - } - -} -class YAMLWarning extends YAMLError { - constructor(source, message) { - super('YAMLWarning', source, message); - } - -} - -function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; -} - -class PlainValue extends Node { - static endOfLine(src, start, inFlow) { - let ch = src[start]; - let offset = start; - - while (ch && ch !== '\n') { - if (inFlow && (ch === '[' || ch === ']' || ch === '{' || ch === '}' || ch === ',')) break; - const next = src[offset + 1]; - if (ch === ':' && (!next || next === '\n' || next === '\t' || next === ' ' || inFlow && next === ',')) break; - if ((ch === ' ' || ch === '\t') && next === '#') break; - offset += 1; - ch = next; - } - - return offset; - } - - get strValue() { - if (!this.valueRange || !this.context) return null; - let { - start, - end - } = this.valueRange; - const { - src - } = this.context; - let ch = src[end - 1]; - - while (start < end && (ch === '\n' || ch === '\t' || ch === ' ')) ch = src[--end - 1]; - - let str = ''; - - for (let i = start; i < end; ++i) { - const ch = src[i]; - - if (ch === '\n') { - const { - fold, - offset - } = Node.foldNewline(src, i, -1); - str += fold; - i = offset; - } else if (ch === ' ' || ch === '\t') { - // trim trailing whitespace - const wsStart = i; - let next = src[i + 1]; - - while (i < end && (next === ' ' || next === '\t')) { - i += 1; - next = src[i + 1]; - } - - if (next !== '\n') str += i > wsStart ? src.slice(wsStart, i + 1) : ch; - } else { - str += ch; - } - } - - const ch0 = src[start]; - - switch (ch0) { - case '\t': - { - const msg = 'Plain value cannot start with a tab character'; - const errors = [new YAMLSemanticError(this, msg)]; - return { - errors, - str - }; - } - - case '@': - case '`': - { - const msg = `Plain value cannot start with reserved character ${ch0}`; - const errors = [new YAMLSemanticError(this, msg)]; - return { - errors, - str - }; - } - - default: - return str; - } - } - - parseBlockValue(start) { - const { - indent, - inFlow, - src - } = this.context; - let offset = start; - let valueEnd = start; - - for (let ch = src[offset]; ch === '\n'; ch = src[offset]) { - if (Node.atDocumentBoundary(src, offset + 1)) break; - const end = Node.endOfBlockIndent(src, indent, offset + 1); - if (end === null || src[end] === '#') break; - - if (src[end] === '\n') { - offset = end; - } else { - valueEnd = PlainValue.endOfLine(src, end, inFlow); - offset = valueEnd; - } - } - - if (this.valueRange.isEmpty()) this.valueRange.start = start; - this.valueRange.end = valueEnd; - return valueEnd; - } - /** - * Parses a plain value from the source - * - * Accepted forms are: - * ``` - * #comment - * - * first line - * - * first line #comment - * - * first line - * block - * lines - * - * #comment - * block - * lines - * ``` - * where block lines are empty or have an indent level greater than `indent`. - * - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this scalar, may be `\n` - */ - - - parse(context, start) { - this.context = context; - const { - inFlow, - src - } = context; - let offset = start; - const ch = src[offset]; - - if (ch && ch !== '#' && ch !== '\n') { - offset = PlainValue.endOfLine(src, start, inFlow); - } - - this.valueRange = new Range(start, offset); - offset = Node.endOfWhiteSpace(src, offset); - offset = this.parseComment(offset); - - if (!this.hasComment || this.valueRange.isEmpty()) { - offset = this.parseBlockValue(offset); - } - - return offset; - } - -} - -exports.Char = Char; -exports.Node = Node; -exports.PlainValue = PlainValue; -exports.Range = Range; -exports.Type = Type; -exports.YAMLError = YAMLError; -exports.YAMLReferenceError = YAMLReferenceError; -exports.YAMLSemanticError = YAMLSemanticError; -exports.YAMLSyntaxError = YAMLSyntaxError; -exports.YAMLWarning = YAMLWarning; -exports._defineProperty = _defineProperty; -exports.defaultTagPrefix = defaultTagPrefix; -exports.defaultTags = defaultTags; diff --git a/node_modules/yaml/dist/Schema-88e323a7.js b/node_modules/yaml/dist/Schema-88e323a7.js deleted file mode 100644 index 5de109f3f..000000000 --- a/node_modules/yaml/dist/Schema-88e323a7.js +++ /dev/null @@ -1,525 +0,0 @@ -'use strict'; - -var PlainValue = require('./PlainValue-ec8e588e.js'); -var resolveSeq = require('./resolveSeq-d03cb037.js'); -var warnings = require('./warnings-1000a372.js'); - -function createMap(schema, obj, ctx) { - const map = new resolveSeq.YAMLMap(schema); - - if (obj instanceof Map) { - for (const [key, value] of obj) map.items.push(schema.createPair(key, value, ctx)); - } else if (obj && typeof obj === 'object') { - for (const key of Object.keys(obj)) map.items.push(schema.createPair(key, obj[key], ctx)); - } - - if (typeof schema.sortMapEntries === 'function') { - map.items.sort(schema.sortMapEntries); - } - - return map; -} - -const map = { - createNode: createMap, - default: true, - nodeClass: resolveSeq.YAMLMap, - tag: 'tag:yaml.org,2002:map', - resolve: resolveSeq.resolveMap -}; - -function createSeq(schema, obj, ctx) { - const seq = new resolveSeq.YAMLSeq(schema); - - if (obj && obj[Symbol.iterator]) { - for (const it of obj) { - const v = schema.createNode(it, ctx.wrapScalars, null, ctx); - seq.items.push(v); - } - } - - return seq; -} - -const seq = { - createNode: createSeq, - default: true, - nodeClass: resolveSeq.YAMLSeq, - tag: 'tag:yaml.org,2002:seq', - resolve: resolveSeq.resolveSeq -}; - -const string = { - identify: value => typeof value === 'string', - default: true, - tag: 'tag:yaml.org,2002:str', - resolve: resolveSeq.resolveString, - - stringify(item, ctx, onComment, onChompKeep) { - ctx = Object.assign({ - actualString: true - }, ctx); - return resolveSeq.stringifyString(item, ctx, onComment, onChompKeep); - }, - - options: resolveSeq.strOptions -}; - -const failsafe = [map, seq, string]; - -/* global BigInt */ - -const intIdentify$2 = value => typeof value === 'bigint' || Number.isInteger(value); - -const intResolve$1 = (src, part, radix) => resolveSeq.intOptions.asBigInt ? BigInt(src) : parseInt(part, radix); - -function intStringify$1(node, radix, prefix) { - const { - value - } = node; - if (intIdentify$2(value) && value >= 0) return prefix + value.toString(radix); - return resolveSeq.stringifyNumber(node); -} - -const nullObj = { - identify: value => value == null, - createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null, - default: true, - tag: 'tag:yaml.org,2002:null', - test: /^(?:~|[Nn]ull|NULL)?$/, - resolve: () => null, - options: resolveSeq.nullOptions, - stringify: () => resolveSeq.nullOptions.nullStr -}; -const boolObj = { - identify: value => typeof value === 'boolean', - default: true, - tag: 'tag:yaml.org,2002:bool', - test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/, - resolve: str => str[0] === 't' || str[0] === 'T', - options: resolveSeq.boolOptions, - stringify: ({ - value - }) => value ? resolveSeq.boolOptions.trueStr : resolveSeq.boolOptions.falseStr -}; -const octObj = { - identify: value => intIdentify$2(value) && value >= 0, - default: true, - tag: 'tag:yaml.org,2002:int', - format: 'OCT', - test: /^0o([0-7]+)$/, - resolve: (str, oct) => intResolve$1(str, oct, 8), - options: resolveSeq.intOptions, - stringify: node => intStringify$1(node, 8, '0o') -}; -const intObj = { - identify: intIdentify$2, - default: true, - tag: 'tag:yaml.org,2002:int', - test: /^[-+]?[0-9]+$/, - resolve: str => intResolve$1(str, str, 10), - options: resolveSeq.intOptions, - stringify: resolveSeq.stringifyNumber -}; -const hexObj = { - identify: value => intIdentify$2(value) && value >= 0, - default: true, - tag: 'tag:yaml.org,2002:int', - format: 'HEX', - test: /^0x([0-9a-fA-F]+)$/, - resolve: (str, hex) => intResolve$1(str, hex, 16), - options: resolveSeq.intOptions, - stringify: node => intStringify$1(node, 16, '0x') -}; -const nanObj = { - identify: value => typeof value === 'number', - default: true, - tag: 'tag:yaml.org,2002:float', - test: /^(?:[-+]?\.inf|(\.nan))$/i, - resolve: (str, nan) => nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, - stringify: resolveSeq.stringifyNumber -}; -const expObj = { - identify: value => typeof value === 'number', - default: true, - tag: 'tag:yaml.org,2002:float', - format: 'EXP', - test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/, - resolve: str => parseFloat(str), - stringify: ({ - value - }) => Number(value).toExponential() -}; -const floatObj = { - identify: value => typeof value === 'number', - default: true, - tag: 'tag:yaml.org,2002:float', - test: /^[-+]?(?:\.([0-9]+)|[0-9]+\.([0-9]*))$/, - - resolve(str, frac1, frac2) { - const frac = frac1 || frac2; - const node = new resolveSeq.Scalar(parseFloat(str)); - if (frac && frac[frac.length - 1] === '0') node.minFractionDigits = frac.length; - return node; - }, - - stringify: resolveSeq.stringifyNumber -}; -const core = failsafe.concat([nullObj, boolObj, octObj, intObj, hexObj, nanObj, expObj, floatObj]); - -/* global BigInt */ - -const intIdentify$1 = value => typeof value === 'bigint' || Number.isInteger(value); - -const stringifyJSON = ({ - value -}) => JSON.stringify(value); - -const json = [map, seq, { - identify: value => typeof value === 'string', - default: true, - tag: 'tag:yaml.org,2002:str', - resolve: resolveSeq.resolveString, - stringify: stringifyJSON -}, { - identify: value => value == null, - createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null, - default: true, - tag: 'tag:yaml.org,2002:null', - test: /^null$/, - resolve: () => null, - stringify: stringifyJSON -}, { - identify: value => typeof value === 'boolean', - default: true, - tag: 'tag:yaml.org,2002:bool', - test: /^true|false$/, - resolve: str => str === 'true', - stringify: stringifyJSON -}, { - identify: intIdentify$1, - default: true, - tag: 'tag:yaml.org,2002:int', - test: /^-?(?:0|[1-9][0-9]*)$/, - resolve: str => resolveSeq.intOptions.asBigInt ? BigInt(str) : parseInt(str, 10), - stringify: ({ - value - }) => intIdentify$1(value) ? value.toString() : JSON.stringify(value) -}, { - identify: value => typeof value === 'number', - default: true, - tag: 'tag:yaml.org,2002:float', - test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/, - resolve: str => parseFloat(str), - stringify: stringifyJSON -}]; - -json.scalarFallback = str => { - throw new SyntaxError(`Unresolved plain scalar ${JSON.stringify(str)}`); -}; - -/* global BigInt */ - -const boolStringify = ({ - value -}) => value ? resolveSeq.boolOptions.trueStr : resolveSeq.boolOptions.falseStr; - -const intIdentify = value => typeof value === 'bigint' || Number.isInteger(value); - -function intResolve(sign, src, radix) { - let str = src.replace(/_/g, ''); - - if (resolveSeq.intOptions.asBigInt) { - switch (radix) { - case 2: - str = `0b${str}`; - break; - - case 8: - str = `0o${str}`; - break; - - case 16: - str = `0x${str}`; - break; - } - - const n = BigInt(str); - return sign === '-' ? BigInt(-1) * n : n; - } - - const n = parseInt(str, radix); - return sign === '-' ? -1 * n : n; -} - -function intStringify(node, radix, prefix) { - const { - value - } = node; - - if (intIdentify(value)) { - const str = value.toString(radix); - return value < 0 ? '-' + prefix + str.substr(1) : prefix + str; - } - - return resolveSeq.stringifyNumber(node); -} - -const yaml11 = failsafe.concat([{ - identify: value => value == null, - createNode: (schema, value, ctx) => ctx.wrapScalars ? new resolveSeq.Scalar(null) : null, - default: true, - tag: 'tag:yaml.org,2002:null', - test: /^(?:~|[Nn]ull|NULL)?$/, - resolve: () => null, - options: resolveSeq.nullOptions, - stringify: () => resolveSeq.nullOptions.nullStr -}, { - identify: value => typeof value === 'boolean', - default: true, - tag: 'tag:yaml.org,2002:bool', - test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/, - resolve: () => true, - options: resolveSeq.boolOptions, - stringify: boolStringify -}, { - identify: value => typeof value === 'boolean', - default: true, - tag: 'tag:yaml.org,2002:bool', - test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/i, - resolve: () => false, - options: resolveSeq.boolOptions, - stringify: boolStringify -}, { - identify: intIdentify, - default: true, - tag: 'tag:yaml.org,2002:int', - format: 'BIN', - test: /^([-+]?)0b([0-1_]+)$/, - resolve: (str, sign, bin) => intResolve(sign, bin, 2), - stringify: node => intStringify(node, 2, '0b') -}, { - identify: intIdentify, - default: true, - tag: 'tag:yaml.org,2002:int', - format: 'OCT', - test: /^([-+]?)0([0-7_]+)$/, - resolve: (str, sign, oct) => intResolve(sign, oct, 8), - stringify: node => intStringify(node, 8, '0') -}, { - identify: intIdentify, - default: true, - tag: 'tag:yaml.org,2002:int', - test: /^([-+]?)([0-9][0-9_]*)$/, - resolve: (str, sign, abs) => intResolve(sign, abs, 10), - stringify: resolveSeq.stringifyNumber -}, { - identify: intIdentify, - default: true, - tag: 'tag:yaml.org,2002:int', - format: 'HEX', - test: /^([-+]?)0x([0-9a-fA-F_]+)$/, - resolve: (str, sign, hex) => intResolve(sign, hex, 16), - stringify: node => intStringify(node, 16, '0x') -}, { - identify: value => typeof value === 'number', - default: true, - tag: 'tag:yaml.org,2002:float', - test: /^(?:[-+]?\.inf|(\.nan))$/i, - resolve: (str, nan) => nan ? NaN : str[0] === '-' ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY, - stringify: resolveSeq.stringifyNumber -}, { - identify: value => typeof value === 'number', - default: true, - tag: 'tag:yaml.org,2002:float', - format: 'EXP', - test: /^[-+]?([0-9][0-9_]*)?(\.[0-9_]*)?[eE][-+]?[0-9]+$/, - resolve: str => parseFloat(str.replace(/_/g, '')), - stringify: ({ - value - }) => Number(value).toExponential() -}, { - identify: value => typeof value === 'number', - default: true, - tag: 'tag:yaml.org,2002:float', - test: /^[-+]?(?:[0-9][0-9_]*)?\.([0-9_]*)$/, - - resolve(str, frac) { - const node = new resolveSeq.Scalar(parseFloat(str.replace(/_/g, ''))); - - if (frac) { - const f = frac.replace(/_/g, ''); - if (f[f.length - 1] === '0') node.minFractionDigits = f.length; - } - - return node; - }, - - stringify: resolveSeq.stringifyNumber -}], warnings.binary, warnings.omap, warnings.pairs, warnings.set, warnings.intTime, warnings.floatTime, warnings.timestamp); - -const schemas = { - core, - failsafe, - json, - yaml11 -}; -const tags = { - binary: warnings.binary, - bool: boolObj, - float: floatObj, - floatExp: expObj, - floatNaN: nanObj, - floatTime: warnings.floatTime, - int: intObj, - intHex: hexObj, - intOct: octObj, - intTime: warnings.intTime, - map, - null: nullObj, - omap: warnings.omap, - pairs: warnings.pairs, - seq, - set: warnings.set, - timestamp: warnings.timestamp -}; - -function findTagObject(value, tagName, tags) { - if (tagName) { - const match = tags.filter(t => t.tag === tagName); - const tagObj = match.find(t => !t.format) || match[0]; - if (!tagObj) throw new Error(`Tag ${tagName} not found`); - return tagObj; - } // TODO: deprecate/remove class check - - - return tags.find(t => (t.identify && t.identify(value) || t.class && value instanceof t.class) && !t.format); -} - -function createNode(value, tagName, ctx) { - if (value instanceof resolveSeq.Node) return value; - const { - defaultPrefix, - onTagObj, - prevObjects, - schema, - wrapScalars - } = ctx; - if (tagName && tagName.startsWith('!!')) tagName = defaultPrefix + tagName.slice(2); - let tagObj = findTagObject(value, tagName, schema.tags); - - if (!tagObj) { - if (typeof value.toJSON === 'function') value = value.toJSON(); - if (!value || typeof value !== 'object') return wrapScalars ? new resolveSeq.Scalar(value) : value; - tagObj = value instanceof Map ? map : value[Symbol.iterator] ? seq : map; - } - - if (onTagObj) { - onTagObj(tagObj); - delete ctx.onTagObj; - } // Detect duplicate references to the same object & use Alias nodes for all - // after first. The `obj` wrapper allows for circular references to resolve. - - - const obj = { - value: undefined, - node: undefined - }; - - if (value && typeof value === 'object' && prevObjects) { - const prev = prevObjects.get(value); - - if (prev) { - const alias = new resolveSeq.Alias(prev); // leaves source dirty; must be cleaned by caller - - ctx.aliasNodes.push(alias); // defined along with prevObjects - - return alias; - } - - obj.value = value; - prevObjects.set(value, obj); - } - - obj.node = tagObj.createNode ? tagObj.createNode(ctx.schema, value, ctx) : wrapScalars ? new resolveSeq.Scalar(value) : value; - if (tagName && obj.node instanceof resolveSeq.Node) obj.node.tag = tagName; - return obj.node; -} - -function getSchemaTags(schemas, knownTags, customTags, schemaId) { - let tags = schemas[schemaId.replace(/\W/g, '')]; // 'yaml-1.1' -> 'yaml11' - - if (!tags) { - const keys = Object.keys(schemas).map(key => JSON.stringify(key)).join(', '); - throw new Error(`Unknown schema "${schemaId}"; use one of ${keys}`); - } - - if (Array.isArray(customTags)) { - for (const tag of customTags) tags = tags.concat(tag); - } else if (typeof customTags === 'function') { - tags = customTags(tags.slice()); - } - - for (let i = 0; i < tags.length; ++i) { - const tag = tags[i]; - - if (typeof tag === 'string') { - const tagObj = knownTags[tag]; - - if (!tagObj) { - const keys = Object.keys(knownTags).map(key => JSON.stringify(key)).join(', '); - throw new Error(`Unknown custom tag "${tag}"; use one of ${keys}`); - } - - tags[i] = tagObj; - } - } - - return tags; -} - -const sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0; - -class Schema { - // TODO: remove in v2 - // TODO: remove in v2 - constructor({ - customTags, - merge, - schema, - sortMapEntries, - tags: deprecatedCustomTags - }) { - this.merge = !!merge; - this.name = schema; - this.sortMapEntries = sortMapEntries === true ? sortMapEntriesByKey : sortMapEntries || null; - if (!customTags && deprecatedCustomTags) warnings.warnOptionDeprecation('tags', 'customTags'); - this.tags = getSchemaTags(schemas, tags, customTags || deprecatedCustomTags, schema); - } - - createNode(value, wrapScalars, tagName, ctx) { - const baseCtx = { - defaultPrefix: Schema.defaultPrefix, - schema: this, - wrapScalars - }; - const createCtx = ctx ? Object.assign(ctx, baseCtx) : baseCtx; - return createNode(value, tagName, createCtx); - } - - createPair(key, value, ctx) { - if (!ctx) ctx = { - wrapScalars: true - }; - const k = this.createNode(key, ctx.wrapScalars, null, ctx); - const v = this.createNode(value, ctx.wrapScalars, null, ctx); - return new resolveSeq.Pair(k, v); - } - -} - -PlainValue._defineProperty(Schema, "defaultPrefix", PlainValue.defaultTagPrefix); - -PlainValue._defineProperty(Schema, "defaultTags", PlainValue.defaultTags); - -exports.Schema = Schema; diff --git a/node_modules/yaml/dist/index.js b/node_modules/yaml/dist/index.js deleted file mode 100644 index 6df1c7774..000000000 --- a/node_modules/yaml/dist/index.js +++ /dev/null @@ -1,79 +0,0 @@ -'use strict'; - -var parseCst = require('./parse-cst.js'); -var Document$1 = require('./Document-9b4560a1.js'); -var Schema = require('./Schema-88e323a7.js'); -var PlainValue = require('./PlainValue-ec8e588e.js'); -var warnings = require('./warnings-1000a372.js'); -require('./resolveSeq-d03cb037.js'); - -function createNode(value, wrapScalars = true, tag) { - if (tag === undefined && typeof wrapScalars === 'string') { - tag = wrapScalars; - wrapScalars = true; - } - - const options = Object.assign({}, Document$1.Document.defaults[Document$1.defaultOptions.version], Document$1.defaultOptions); - const schema = new Schema.Schema(options); - return schema.createNode(value, wrapScalars, tag); -} - -class Document extends Document$1.Document { - constructor(options) { - super(Object.assign({}, Document$1.defaultOptions, options)); - } - -} - -function parseAllDocuments(src, options) { - const stream = []; - let prev; - - for (const cstDoc of parseCst.parse(src)) { - const doc = new Document(options); - doc.parse(cstDoc, prev); - stream.push(doc); - prev = doc; - } - - return stream; -} - -function parseDocument(src, options) { - const cst = parseCst.parse(src); - const doc = new Document(options).parse(cst[0]); - - if (cst.length > 1) { - const errMsg = 'Source contains multiple documents; please use YAML.parseAllDocuments()'; - doc.errors.unshift(new PlainValue.YAMLSemanticError(cst[1], errMsg)); - } - - return doc; -} - -function parse(src, options) { - const doc = parseDocument(src, options); - doc.warnings.forEach(warning => warnings.warn(warning)); - if (doc.errors.length > 0) throw doc.errors[0]; - return doc.toJSON(); -} - -function stringify(value, options) { - const doc = new Document(options); - doc.contents = value; - return String(doc); -} - -const YAML = { - createNode, - defaultOptions: Document$1.defaultOptions, - Document, - parse, - parseAllDocuments, - parseCST: parseCst.parse, - parseDocument, - scalarOptions: Document$1.scalarOptions, - stringify -}; - -exports.YAML = YAML; diff --git a/node_modules/yaml/dist/legacy-exports.js b/node_modules/yaml/dist/legacy-exports.js deleted file mode 100644 index 9a5d037b7..000000000 --- a/node_modules/yaml/dist/legacy-exports.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -var warnings = require('./warnings-1000a372.js'); -require('./PlainValue-ec8e588e.js'); -require('./resolveSeq-d03cb037.js'); - - - -exports.binary = warnings.binary; -exports.floatTime = warnings.floatTime; -exports.intTime = warnings.intTime; -exports.omap = warnings.omap; -exports.pairs = warnings.pairs; -exports.set = warnings.set; -exports.timestamp = warnings.timestamp; -exports.warnFileDeprecation = warnings.warnFileDeprecation; diff --git a/node_modules/yaml/dist/parse-cst.js b/node_modules/yaml/dist/parse-cst.js deleted file mode 100644 index d69bedc66..000000000 --- a/node_modules/yaml/dist/parse-cst.js +++ /dev/null @@ -1,1753 +0,0 @@ -'use strict'; - -var PlainValue = require('./PlainValue-ec8e588e.js'); - -class BlankLine extends PlainValue.Node { - constructor() { - super(PlainValue.Type.BLANK_LINE); - } - /* istanbul ignore next */ - - - get includesTrailingLines() { - // This is never called from anywhere, but if it were, - // this is the value it should return. - return true; - } - /** - * Parses a blank line from the source - * - * @param {ParseContext} context - * @param {number} start - Index of first \n character - * @returns {number} - Index of the character after this - */ - - - parse(context, start) { - this.context = context; - this.range = new PlainValue.Range(start, start + 1); - return start + 1; - } - -} - -class CollectionItem extends PlainValue.Node { - constructor(type, props) { - super(type, props); - this.node = null; - } - - get includesTrailingLines() { - return !!this.node && this.node.includesTrailingLines; - } - /** - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this - */ - - - parse(context, start) { - this.context = context; - const { - parseNode, - src - } = context; - let { - atLineStart, - lineStart - } = context; - if (!atLineStart && this.type === PlainValue.Type.SEQ_ITEM) this.error = new PlainValue.YAMLSemanticError(this, 'Sequence items must not have preceding content on the same line'); - const indent = atLineStart ? start - lineStart : context.indent; - let offset = PlainValue.Node.endOfWhiteSpace(src, start + 1); - let ch = src[offset]; - const inlineComment = ch === '#'; - const comments = []; - let blankLine = null; - - while (ch === '\n' || ch === '#') { - if (ch === '#') { - const end = PlainValue.Node.endOfLine(src, offset + 1); - comments.push(new PlainValue.Range(offset, end)); - offset = end; - } else { - atLineStart = true; - lineStart = offset + 1; - const wsEnd = PlainValue.Node.endOfWhiteSpace(src, lineStart); - - if (src[wsEnd] === '\n' && comments.length === 0) { - blankLine = new BlankLine(); - lineStart = blankLine.parse({ - src - }, lineStart); - } - - offset = PlainValue.Node.endOfIndent(src, lineStart); - } - - ch = src[offset]; - } - - if (PlainValue.Node.nextNodeIsIndented(ch, offset - (lineStart + indent), this.type !== PlainValue.Type.SEQ_ITEM)) { - this.node = parseNode({ - atLineStart, - inCollection: false, - indent, - lineStart, - parent: this - }, offset); - } else if (ch && lineStart > start + 1) { - offset = lineStart - 1; - } - - if (this.node) { - if (blankLine) { - // Only blank lines preceding non-empty nodes are captured. Note that - // this means that collection item range start indices do not always - // increase monotonically. -- eemeli/yaml#126 - const items = context.parent.items || context.parent.contents; - if (items) items.push(blankLine); - } - - if (comments.length) Array.prototype.push.apply(this.props, comments); - offset = this.node.range.end; - } else { - if (inlineComment) { - const c = comments[0]; - this.props.push(c); - offset = c.end; - } else { - offset = PlainValue.Node.endOfLine(src, start + 1); - } - } - - const end = this.node ? this.node.valueRange.end : offset; - this.valueRange = new PlainValue.Range(start, end); - return offset; - } - - setOrigRanges(cr, offset) { - offset = super.setOrigRanges(cr, offset); - return this.node ? this.node.setOrigRanges(cr, offset) : offset; - } - - toString() { - const { - context: { - src - }, - node, - range, - value - } = this; - if (value != null) return value; - const str = node ? src.slice(range.start, node.range.start) + String(node) : src.slice(range.start, range.end); - return PlainValue.Node.addStringTerminator(src, range.end, str); - } - -} - -class Comment extends PlainValue.Node { - constructor() { - super(PlainValue.Type.COMMENT); - } - /** - * Parses a comment line from the source - * - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this scalar - */ - - - parse(context, start) { - this.context = context; - const offset = this.parseComment(start); - this.range = new PlainValue.Range(start, offset); - return offset; - } - -} - -function grabCollectionEndComments(node) { - let cnode = node; - - while (cnode instanceof CollectionItem) cnode = cnode.node; - - if (!(cnode instanceof Collection)) return null; - const len = cnode.items.length; - let ci = -1; - - for (let i = len - 1; i >= 0; --i) { - const n = cnode.items[i]; - - if (n.type === PlainValue.Type.COMMENT) { - // Keep sufficiently indented comments with preceding node - const { - indent, - lineStart - } = n.context; - if (indent > 0 && n.range.start >= lineStart + indent) break; - ci = i; - } else if (n.type === PlainValue.Type.BLANK_LINE) ci = i;else break; - } - - if (ci === -1) return null; - const ca = cnode.items.splice(ci, len - ci); - const prevEnd = ca[0].range.start; - - while (true) { - cnode.range.end = prevEnd; - if (cnode.valueRange && cnode.valueRange.end > prevEnd) cnode.valueRange.end = prevEnd; - if (cnode === node) break; - cnode = cnode.context.parent; - } - - return ca; -} -class Collection extends PlainValue.Node { - static nextContentHasIndent(src, offset, indent) { - const lineStart = PlainValue.Node.endOfLine(src, offset) + 1; - offset = PlainValue.Node.endOfWhiteSpace(src, lineStart); - const ch = src[offset]; - if (!ch) return false; - if (offset >= lineStart + indent) return true; - if (ch !== '#' && ch !== '\n') return false; - return Collection.nextContentHasIndent(src, offset, indent); - } - - constructor(firstItem) { - super(firstItem.type === PlainValue.Type.SEQ_ITEM ? PlainValue.Type.SEQ : PlainValue.Type.MAP); - - for (let i = firstItem.props.length - 1; i >= 0; --i) { - if (firstItem.props[i].start < firstItem.context.lineStart) { - // props on previous line are assumed by the collection - this.props = firstItem.props.slice(0, i + 1); - firstItem.props = firstItem.props.slice(i + 1); - const itemRange = firstItem.props[0] || firstItem.valueRange; - firstItem.range.start = itemRange.start; - break; - } - } - - this.items = [firstItem]; - const ec = grabCollectionEndComments(firstItem); - if (ec) Array.prototype.push.apply(this.items, ec); - } - - get includesTrailingLines() { - return this.items.length > 0; - } - /** - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this - */ - - - parse(context, start) { - this.context = context; - const { - parseNode, - src - } = context; // It's easier to recalculate lineStart here rather than tracking down the - // last context from which to read it -- eemeli/yaml#2 - - let lineStart = PlainValue.Node.startOfLine(src, start); - const firstItem = this.items[0]; // First-item context needs to be correct for later comment handling - // -- eemeli/yaml#17 - - firstItem.context.parent = this; - this.valueRange = PlainValue.Range.copy(firstItem.valueRange); - const indent = firstItem.range.start - firstItem.context.lineStart; - let offset = start; - offset = PlainValue.Node.normalizeOffset(src, offset); - let ch = src[offset]; - let atLineStart = PlainValue.Node.endOfWhiteSpace(src, lineStart) === offset; - let prevIncludesTrailingLines = false; - - while (ch) { - while (ch === '\n' || ch === '#') { - if (atLineStart && ch === '\n' && !prevIncludesTrailingLines) { - const blankLine = new BlankLine(); - offset = blankLine.parse({ - src - }, offset); - this.valueRange.end = offset; - - if (offset >= src.length) { - ch = null; - break; - } - - this.items.push(blankLine); - offset -= 1; // blankLine.parse() consumes terminal newline - } else if (ch === '#') { - if (offset < lineStart + indent && !Collection.nextContentHasIndent(src, offset, indent)) { - return offset; - } - - const comment = new Comment(); - offset = comment.parse({ - indent, - lineStart, - src - }, offset); - this.items.push(comment); - this.valueRange.end = offset; - - if (offset >= src.length) { - ch = null; - break; - } - } - - lineStart = offset + 1; - offset = PlainValue.Node.endOfIndent(src, lineStart); - - if (PlainValue.Node.atBlank(src, offset)) { - const wsEnd = PlainValue.Node.endOfWhiteSpace(src, offset); - const next = src[wsEnd]; - - if (!next || next === '\n' || next === '#') { - offset = wsEnd; - } - } - - ch = src[offset]; - atLineStart = true; - } - - if (!ch) { - break; - } - - if (offset !== lineStart + indent && (atLineStart || ch !== ':')) { - if (offset < lineStart + indent) { - if (lineStart > start) offset = lineStart; - break; - } else if (!this.error) { - const msg = 'All collection items must start at the same column'; - this.error = new PlainValue.YAMLSyntaxError(this, msg); - } - } - - if (firstItem.type === PlainValue.Type.SEQ_ITEM) { - if (ch !== '-') { - if (lineStart > start) offset = lineStart; - break; - } - } else if (ch === '-' && !this.error) { - // map key may start with -, as long as it's followed by a non-whitespace char - const next = src[offset + 1]; - - if (!next || next === '\n' || next === '\t' || next === ' ') { - const msg = 'A collection cannot be both a mapping and a sequence'; - this.error = new PlainValue.YAMLSyntaxError(this, msg); - } - } - - const node = parseNode({ - atLineStart, - inCollection: true, - indent, - lineStart, - parent: this - }, offset); - if (!node) return offset; // at next document start - - this.items.push(node); - this.valueRange.end = node.valueRange.end; - offset = PlainValue.Node.normalizeOffset(src, node.range.end); - ch = src[offset]; - atLineStart = false; - prevIncludesTrailingLines = node.includesTrailingLines; // Need to reset lineStart and atLineStart here if preceding node's range - // has advanced to check the current line's indentation level - // -- eemeli/yaml#10 & eemeli/yaml#38 - - if (ch) { - let ls = offset - 1; - let prev = src[ls]; - - while (prev === ' ' || prev === '\t') prev = src[--ls]; - - if (prev === '\n') { - lineStart = ls + 1; - atLineStart = true; - } - } - - const ec = grabCollectionEndComments(node); - if (ec) Array.prototype.push.apply(this.items, ec); - } - - return offset; - } - - setOrigRanges(cr, offset) { - offset = super.setOrigRanges(cr, offset); - this.items.forEach(node => { - offset = node.setOrigRanges(cr, offset); - }); - return offset; - } - - toString() { - const { - context: { - src - }, - items, - range, - value - } = this; - if (value != null) return value; - let str = src.slice(range.start, items[0].range.start) + String(items[0]); - - for (let i = 1; i < items.length; ++i) { - const item = items[i]; - const { - atLineStart, - indent - } = item.context; - if (atLineStart) for (let i = 0; i < indent; ++i) str += ' '; - str += String(item); - } - - return PlainValue.Node.addStringTerminator(src, range.end, str); - } - -} - -class Directive extends PlainValue.Node { - constructor() { - super(PlainValue.Type.DIRECTIVE); - this.name = null; - } - - get parameters() { - const raw = this.rawValue; - return raw ? raw.trim().split(/[ \t]+/) : []; - } - - parseName(start) { - const { - src - } = this.context; - let offset = start; - let ch = src[offset]; - - while (ch && ch !== '\n' && ch !== '\t' && ch !== ' ') ch = src[offset += 1]; - - this.name = src.slice(start, offset); - return offset; - } - - parseParameters(start) { - const { - src - } = this.context; - let offset = start; - let ch = src[offset]; - - while (ch && ch !== '\n' && ch !== '#') ch = src[offset += 1]; - - this.valueRange = new PlainValue.Range(start, offset); - return offset; - } - - parse(context, start) { - this.context = context; - let offset = this.parseName(start + 1); - offset = this.parseParameters(offset); - offset = this.parseComment(offset); - this.range = new PlainValue.Range(start, offset); - return offset; - } - -} - -class Document extends PlainValue.Node { - static startCommentOrEndBlankLine(src, start) { - const offset = PlainValue.Node.endOfWhiteSpace(src, start); - const ch = src[offset]; - return ch === '#' || ch === '\n' ? offset : start; - } - - constructor() { - super(PlainValue.Type.DOCUMENT); - this.directives = null; - this.contents = null; - this.directivesEndMarker = null; - this.documentEndMarker = null; - } - - parseDirectives(start) { - const { - src - } = this.context; - this.directives = []; - let atLineStart = true; - let hasDirectives = false; - let offset = start; - - while (!PlainValue.Node.atDocumentBoundary(src, offset, PlainValue.Char.DIRECTIVES_END)) { - offset = Document.startCommentOrEndBlankLine(src, offset); - - switch (src[offset]) { - case '\n': - if (atLineStart) { - const blankLine = new BlankLine(); - offset = blankLine.parse({ - src - }, offset); - - if (offset < src.length) { - this.directives.push(blankLine); - } - } else { - offset += 1; - atLineStart = true; - } - - break; - - case '#': - { - const comment = new Comment(); - offset = comment.parse({ - src - }, offset); - this.directives.push(comment); - atLineStart = false; - } - break; - - case '%': - { - const directive = new Directive(); - offset = directive.parse({ - parent: this, - src - }, offset); - this.directives.push(directive); - hasDirectives = true; - atLineStart = false; - } - break; - - default: - if (hasDirectives) { - this.error = new PlainValue.YAMLSemanticError(this, 'Missing directives-end indicator line'); - } else if (this.directives.length > 0) { - this.contents = this.directives; - this.directives = []; - } - - return offset; - } - } - - if (src[offset]) { - this.directivesEndMarker = new PlainValue.Range(offset, offset + 3); - return offset + 3; - } - - if (hasDirectives) { - this.error = new PlainValue.YAMLSemanticError(this, 'Missing directives-end indicator line'); - } else if (this.directives.length > 0) { - this.contents = this.directives; - this.directives = []; - } - - return offset; - } - - parseContents(start) { - const { - parseNode, - src - } = this.context; - if (!this.contents) this.contents = []; - let lineStart = start; - - while (src[lineStart - 1] === '-') lineStart -= 1; - - let offset = PlainValue.Node.endOfWhiteSpace(src, start); - let atLineStart = lineStart === start; - this.valueRange = new PlainValue.Range(offset); - - while (!PlainValue.Node.atDocumentBoundary(src, offset, PlainValue.Char.DOCUMENT_END)) { - switch (src[offset]) { - case '\n': - if (atLineStart) { - const blankLine = new BlankLine(); - offset = blankLine.parse({ - src - }, offset); - - if (offset < src.length) { - this.contents.push(blankLine); - } - } else { - offset += 1; - atLineStart = true; - } - - lineStart = offset; - break; - - case '#': - { - const comment = new Comment(); - offset = comment.parse({ - src - }, offset); - this.contents.push(comment); - atLineStart = false; - } - break; - - default: - { - const iEnd = PlainValue.Node.endOfIndent(src, offset); - const context = { - atLineStart, - indent: -1, - inFlow: false, - inCollection: false, - lineStart, - parent: this - }; - const node = parseNode(context, iEnd); - if (!node) return this.valueRange.end = iEnd; // at next document start - - this.contents.push(node); - offset = node.range.end; - atLineStart = false; - const ec = grabCollectionEndComments(node); - if (ec) Array.prototype.push.apply(this.contents, ec); - } - } - - offset = Document.startCommentOrEndBlankLine(src, offset); - } - - this.valueRange.end = offset; - - if (src[offset]) { - this.documentEndMarker = new PlainValue.Range(offset, offset + 3); - offset += 3; - - if (src[offset]) { - offset = PlainValue.Node.endOfWhiteSpace(src, offset); - - if (src[offset] === '#') { - const comment = new Comment(); - offset = comment.parse({ - src - }, offset); - this.contents.push(comment); - } - - switch (src[offset]) { - case '\n': - offset += 1; - break; - - case undefined: - break; - - default: - this.error = new PlainValue.YAMLSyntaxError(this, 'Document end marker line cannot have a non-comment suffix'); - } - } - } - - return offset; - } - /** - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this - */ - - - parse(context, start) { - context.root = this; - this.context = context; - const { - src - } = context; - let offset = src.charCodeAt(start) === 0xfeff ? start + 1 : start; // skip BOM - - offset = this.parseDirectives(offset); - offset = this.parseContents(offset); - return offset; - } - - setOrigRanges(cr, offset) { - offset = super.setOrigRanges(cr, offset); - this.directives.forEach(node => { - offset = node.setOrigRanges(cr, offset); - }); - if (this.directivesEndMarker) offset = this.directivesEndMarker.setOrigRange(cr, offset); - this.contents.forEach(node => { - offset = node.setOrigRanges(cr, offset); - }); - if (this.documentEndMarker) offset = this.documentEndMarker.setOrigRange(cr, offset); - return offset; - } - - toString() { - const { - contents, - directives, - value - } = this; - if (value != null) return value; - let str = directives.join(''); - - if (contents.length > 0) { - if (directives.length > 0 || contents[0].type === PlainValue.Type.COMMENT) str += '---\n'; - str += contents.join(''); - } - - if (str[str.length - 1] !== '\n') str += '\n'; - return str; - } - -} - -class Alias extends PlainValue.Node { - /** - * Parses an *alias from the source - * - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this scalar - */ - parse(context, start) { - this.context = context; - const { - src - } = context; - let offset = PlainValue.Node.endOfIdentifier(src, start + 1); - this.valueRange = new PlainValue.Range(start + 1, offset); - offset = PlainValue.Node.endOfWhiteSpace(src, offset); - offset = this.parseComment(offset); - return offset; - } - -} - -const Chomp = { - CLIP: 'CLIP', - KEEP: 'KEEP', - STRIP: 'STRIP' -}; -class BlockValue extends PlainValue.Node { - constructor(type, props) { - super(type, props); - this.blockIndent = null; - this.chomping = Chomp.CLIP; - this.header = null; - } - - get includesTrailingLines() { - return this.chomping === Chomp.KEEP; - } - - get strValue() { - if (!this.valueRange || !this.context) return null; - let { - start, - end - } = this.valueRange; - const { - indent, - src - } = this.context; - if (this.valueRange.isEmpty()) return ''; - let lastNewLine = null; - let ch = src[end - 1]; - - while (ch === '\n' || ch === '\t' || ch === ' ') { - end -= 1; - - if (end <= start) { - if (this.chomping === Chomp.KEEP) break;else return ''; // probably never happens - } - - if (ch === '\n') lastNewLine = end; - ch = src[end - 1]; - } - - let keepStart = end + 1; - - if (lastNewLine) { - if (this.chomping === Chomp.KEEP) { - keepStart = lastNewLine; - end = this.valueRange.end; - } else { - end = lastNewLine; - } - } - - const bi = indent + this.blockIndent; - const folded = this.type === PlainValue.Type.BLOCK_FOLDED; - let atStart = true; - let str = ''; - let sep = ''; - let prevMoreIndented = false; - - for (let i = start; i < end; ++i) { - for (let j = 0; j < bi; ++j) { - if (src[i] !== ' ') break; - i += 1; - } - - const ch = src[i]; - - if (ch === '\n') { - if (sep === '\n') str += '\n';else sep = '\n'; - } else { - const lineEnd = PlainValue.Node.endOfLine(src, i); - const line = src.slice(i, lineEnd); - i = lineEnd; - - if (folded && (ch === ' ' || ch === '\t') && i < keepStart) { - if (sep === ' ') sep = '\n';else if (!prevMoreIndented && !atStart && sep === '\n') sep = '\n\n'; - str += sep + line; //+ ((lineEnd < end && src[lineEnd]) || '') - - sep = lineEnd < end && src[lineEnd] || ''; - prevMoreIndented = true; - } else { - str += sep + line; - sep = folded && i < keepStart ? ' ' : '\n'; - prevMoreIndented = false; - } - - if (atStart && line !== '') atStart = false; - } - } - - return this.chomping === Chomp.STRIP ? str : str + '\n'; - } - - parseBlockHeader(start) { - const { - src - } = this.context; - let offset = start + 1; - let bi = ''; - - while (true) { - const ch = src[offset]; - - switch (ch) { - case '-': - this.chomping = Chomp.STRIP; - break; - - case '+': - this.chomping = Chomp.KEEP; - break; - - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - bi += ch; - break; - - default: - this.blockIndent = Number(bi) || null; - this.header = new PlainValue.Range(start, offset); - return offset; - } - - offset += 1; - } - } - - parseBlockValue(start) { - const { - indent, - src - } = this.context; - const explicit = !!this.blockIndent; - let offset = start; - let valueEnd = start; - let minBlockIndent = 1; - - for (let ch = src[offset]; ch === '\n'; ch = src[offset]) { - offset += 1; - if (PlainValue.Node.atDocumentBoundary(src, offset)) break; - const end = PlainValue.Node.endOfBlockIndent(src, indent, offset); // should not include tab? - - if (end === null) break; - const ch = src[end]; - const lineIndent = end - (offset + indent); - - if (!this.blockIndent) { - // no explicit block indent, none yet detected - if (src[end] !== '\n') { - // first line with non-whitespace content - if (lineIndent < minBlockIndent) { - const msg = 'Block scalars with more-indented leading empty lines must use an explicit indentation indicator'; - this.error = new PlainValue.YAMLSemanticError(this, msg); - } - - this.blockIndent = lineIndent; - } else if (lineIndent > minBlockIndent) { - // empty line with more whitespace - minBlockIndent = lineIndent; - } - } else if (ch && ch !== '\n' && lineIndent < this.blockIndent) { - if (src[end] === '#') break; - - if (!this.error) { - const src = explicit ? 'explicit indentation indicator' : 'first line'; - const msg = `Block scalars must not be less indented than their ${src}`; - this.error = new PlainValue.YAMLSemanticError(this, msg); - } - } - - if (src[end] === '\n') { - offset = end; - } else { - offset = valueEnd = PlainValue.Node.endOfLine(src, end); - } - } - - if (this.chomping !== Chomp.KEEP) { - offset = src[valueEnd] ? valueEnd + 1 : valueEnd; - } - - this.valueRange = new PlainValue.Range(start + 1, offset); - return offset; - } - /** - * Parses a block value from the source - * - * Accepted forms are: - * ``` - * BS - * block - * lines - * - * BS #comment - * block - * lines - * ``` - * where the block style BS matches the regexp `[|>][-+1-9]*` and block lines - * are empty or have an indent level greater than `indent`. - * - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this block - */ - - - parse(context, start) { - this.context = context; - const { - src - } = context; - let offset = this.parseBlockHeader(start); - offset = PlainValue.Node.endOfWhiteSpace(src, offset); - offset = this.parseComment(offset); - offset = this.parseBlockValue(offset); - return offset; - } - - setOrigRanges(cr, offset) { - offset = super.setOrigRanges(cr, offset); - return this.header ? this.header.setOrigRange(cr, offset) : offset; - } - -} - -class FlowCollection extends PlainValue.Node { - constructor(type, props) { - super(type, props); - this.items = null; - } - - prevNodeIsJsonLike(idx = this.items.length) { - const node = this.items[idx - 1]; - return !!node && (node.jsonLike || node.type === PlainValue.Type.COMMENT && this.prevNodeIsJsonLike(idx - 1)); - } - /** - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this - */ - - - parse(context, start) { - this.context = context; - const { - parseNode, - src - } = context; - let { - indent, - lineStart - } = context; - let char = src[start]; // { or [ - - this.items = [{ - char, - offset: start - }]; - let offset = PlainValue.Node.endOfWhiteSpace(src, start + 1); - char = src[offset]; - - while (char && char !== ']' && char !== '}') { - switch (char) { - case '\n': - { - lineStart = offset + 1; - const wsEnd = PlainValue.Node.endOfWhiteSpace(src, lineStart); - - if (src[wsEnd] === '\n') { - const blankLine = new BlankLine(); - lineStart = blankLine.parse({ - src - }, lineStart); - this.items.push(blankLine); - } - - offset = PlainValue.Node.endOfIndent(src, lineStart); - - if (offset <= lineStart + indent) { - char = src[offset]; - - if (offset < lineStart + indent || char !== ']' && char !== '}') { - const msg = 'Insufficient indentation in flow collection'; - this.error = new PlainValue.YAMLSemanticError(this, msg); - } - } - } - break; - - case ',': - { - this.items.push({ - char, - offset - }); - offset += 1; - } - break; - - case '#': - { - const comment = new Comment(); - offset = comment.parse({ - src - }, offset); - this.items.push(comment); - } - break; - - case '?': - case ':': - { - const next = src[offset + 1]; - - if (next === '\n' || next === '\t' || next === ' ' || next === ',' || // in-flow : after JSON-like key does not need to be followed by whitespace - char === ':' && this.prevNodeIsJsonLike()) { - this.items.push({ - char, - offset - }); - offset += 1; - break; - } - } - // fallthrough - - default: - { - const node = parseNode({ - atLineStart: false, - inCollection: false, - inFlow: true, - indent: -1, - lineStart, - parent: this - }, offset); - - if (!node) { - // at next document start - this.valueRange = new PlainValue.Range(start, offset); - return offset; - } - - this.items.push(node); - offset = PlainValue.Node.normalizeOffset(src, node.range.end); - } - } - - offset = PlainValue.Node.endOfWhiteSpace(src, offset); - char = src[offset]; - } - - this.valueRange = new PlainValue.Range(start, offset + 1); - - if (char) { - this.items.push({ - char, - offset - }); - offset = PlainValue.Node.endOfWhiteSpace(src, offset + 1); - offset = this.parseComment(offset); - } - - return offset; - } - - setOrigRanges(cr, offset) { - offset = super.setOrigRanges(cr, offset); - this.items.forEach(node => { - if (node instanceof PlainValue.Node) { - offset = node.setOrigRanges(cr, offset); - } else if (cr.length === 0) { - node.origOffset = node.offset; - } else { - let i = offset; - - while (i < cr.length) { - if (cr[i] > node.offset) break;else ++i; - } - - node.origOffset = node.offset + i; - offset = i; - } - }); - return offset; - } - - toString() { - const { - context: { - src - }, - items, - range, - value - } = this; - if (value != null) return value; - const nodes = items.filter(item => item instanceof PlainValue.Node); - let str = ''; - let prevEnd = range.start; - nodes.forEach(node => { - const prefix = src.slice(prevEnd, node.range.start); - prevEnd = node.range.end; - str += prefix + String(node); - - if (str[str.length - 1] === '\n' && src[prevEnd - 1] !== '\n' && src[prevEnd] === '\n') { - // Comment range does not include the terminal newline, but its - // stringified value does. Without this fix, newlines at comment ends - // get duplicated. - prevEnd += 1; - } - }); - str += src.slice(prevEnd, range.end); - return PlainValue.Node.addStringTerminator(src, range.end, str); - } - -} - -class QuoteDouble extends PlainValue.Node { - static endOfQuote(src, offset) { - let ch = src[offset]; - - while (ch && ch !== '"') { - offset += ch === '\\' ? 2 : 1; - ch = src[offset]; - } - - return offset + 1; - } - /** - * @returns {string | { str: string, errors: YAMLSyntaxError[] }} - */ - - - get strValue() { - if (!this.valueRange || !this.context) return null; - const errors = []; - const { - start, - end - } = this.valueRange; - const { - indent, - src - } = this.context; - if (src[end - 1] !== '"') errors.push(new PlainValue.YAMLSyntaxError(this, 'Missing closing "quote')); // Using String#replace is too painful with escaped newlines preceded by - // escaped backslashes; also, this should be faster. - - let str = ''; - - for (let i = start + 1; i < end - 1; ++i) { - const ch = src[i]; - - if (ch === '\n') { - if (PlainValue.Node.atDocumentBoundary(src, i + 1)) errors.push(new PlainValue.YAMLSemanticError(this, 'Document boundary indicators are not allowed within string values')); - const { - fold, - offset, - error - } = PlainValue.Node.foldNewline(src, i, indent); - str += fold; - i = offset; - if (error) errors.push(new PlainValue.YAMLSemanticError(this, 'Multi-line double-quoted string needs to be sufficiently indented')); - } else if (ch === '\\') { - i += 1; - - switch (src[i]) { - case '0': - str += '\0'; - break; - // null character - - case 'a': - str += '\x07'; - break; - // bell character - - case 'b': - str += '\b'; - break; - // backspace - - case 'e': - str += '\x1b'; - break; - // escape character - - case 'f': - str += '\f'; - break; - // form feed - - case 'n': - str += '\n'; - break; - // line feed - - case 'r': - str += '\r'; - break; - // carriage return - - case 't': - str += '\t'; - break; - // horizontal tab - - case 'v': - str += '\v'; - break; - // vertical tab - - case 'N': - str += '\u0085'; - break; - // Unicode next line - - case '_': - str += '\u00a0'; - break; - // Unicode non-breaking space - - case 'L': - str += '\u2028'; - break; - // Unicode line separator - - case 'P': - str += '\u2029'; - break; - // Unicode paragraph separator - - case ' ': - str += ' '; - break; - - case '"': - str += '"'; - break; - - case '/': - str += '/'; - break; - - case '\\': - str += '\\'; - break; - - case '\t': - str += '\t'; - break; - - case 'x': - str += this.parseCharCode(i + 1, 2, errors); - i += 2; - break; - - case 'u': - str += this.parseCharCode(i + 1, 4, errors); - i += 4; - break; - - case 'U': - str += this.parseCharCode(i + 1, 8, errors); - i += 8; - break; - - case '\n': - // skip escaped newlines, but still trim the following line - while (src[i + 1] === ' ' || src[i + 1] === '\t') i += 1; - - break; - - default: - errors.push(new PlainValue.YAMLSyntaxError(this, `Invalid escape sequence ${src.substr(i - 1, 2)}`)); - str += '\\' + src[i]; - } - } else if (ch === ' ' || ch === '\t') { - // trim trailing whitespace - const wsStart = i; - let next = src[i + 1]; - - while (next === ' ' || next === '\t') { - i += 1; - next = src[i + 1]; - } - - if (next !== '\n') str += i > wsStart ? src.slice(wsStart, i + 1) : ch; - } else { - str += ch; - } - } - - return errors.length > 0 ? { - errors, - str - } : str; - } - - parseCharCode(offset, length, errors) { - const { - src - } = this.context; - const cc = src.substr(offset, length); - const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc); - const code = ok ? parseInt(cc, 16) : NaN; - - if (isNaN(code)) { - errors.push(new PlainValue.YAMLSyntaxError(this, `Invalid escape sequence ${src.substr(offset - 2, length + 2)}`)); - return src.substr(offset - 2, length + 2); - } - - return String.fromCodePoint(code); - } - /** - * Parses a "double quoted" value from the source - * - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this scalar - */ - - - parse(context, start) { - this.context = context; - const { - src - } = context; - let offset = QuoteDouble.endOfQuote(src, start + 1); - this.valueRange = new PlainValue.Range(start, offset); - offset = PlainValue.Node.endOfWhiteSpace(src, offset); - offset = this.parseComment(offset); - return offset; - } - -} - -class QuoteSingle extends PlainValue.Node { - static endOfQuote(src, offset) { - let ch = src[offset]; - - while (ch) { - if (ch === "'") { - if (src[offset + 1] !== "'") break; - ch = src[offset += 2]; - } else { - ch = src[offset += 1]; - } - } - - return offset + 1; - } - /** - * @returns {string | { str: string, errors: YAMLSyntaxError[] }} - */ - - - get strValue() { - if (!this.valueRange || !this.context) return null; - const errors = []; - const { - start, - end - } = this.valueRange; - const { - indent, - src - } = this.context; - if (src[end - 1] !== "'") errors.push(new PlainValue.YAMLSyntaxError(this, "Missing closing 'quote")); - let str = ''; - - for (let i = start + 1; i < end - 1; ++i) { - const ch = src[i]; - - if (ch === '\n') { - if (PlainValue.Node.atDocumentBoundary(src, i + 1)) errors.push(new PlainValue.YAMLSemanticError(this, 'Document boundary indicators are not allowed within string values')); - const { - fold, - offset, - error - } = PlainValue.Node.foldNewline(src, i, indent); - str += fold; - i = offset; - if (error) errors.push(new PlainValue.YAMLSemanticError(this, 'Multi-line single-quoted string needs to be sufficiently indented')); - } else if (ch === "'") { - str += ch; - i += 1; - if (src[i] !== "'") errors.push(new PlainValue.YAMLSyntaxError(this, 'Unescaped single quote? This should not happen.')); - } else if (ch === ' ' || ch === '\t') { - // trim trailing whitespace - const wsStart = i; - let next = src[i + 1]; - - while (next === ' ' || next === '\t') { - i += 1; - next = src[i + 1]; - } - - if (next !== '\n') str += i > wsStart ? src.slice(wsStart, i + 1) : ch; - } else { - str += ch; - } - } - - return errors.length > 0 ? { - errors, - str - } : str; - } - /** - * Parses a 'single quoted' value from the source - * - * @param {ParseContext} context - * @param {number} start - Index of first character - * @returns {number} - Index of the character after this scalar - */ - - - parse(context, start) { - this.context = context; - const { - src - } = context; - let offset = QuoteSingle.endOfQuote(src, start + 1); - this.valueRange = new PlainValue.Range(start, offset); - offset = PlainValue.Node.endOfWhiteSpace(src, offset); - offset = this.parseComment(offset); - return offset; - } - -} - -function createNewNode(type, props) { - switch (type) { - case PlainValue.Type.ALIAS: - return new Alias(type, props); - - case PlainValue.Type.BLOCK_FOLDED: - case PlainValue.Type.BLOCK_LITERAL: - return new BlockValue(type, props); - - case PlainValue.Type.FLOW_MAP: - case PlainValue.Type.FLOW_SEQ: - return new FlowCollection(type, props); - - case PlainValue.Type.MAP_KEY: - case PlainValue.Type.MAP_VALUE: - case PlainValue.Type.SEQ_ITEM: - return new CollectionItem(type, props); - - case PlainValue.Type.COMMENT: - case PlainValue.Type.PLAIN: - return new PlainValue.PlainValue(type, props); - - case PlainValue.Type.QUOTE_DOUBLE: - return new QuoteDouble(type, props); - - case PlainValue.Type.QUOTE_SINGLE: - return new QuoteSingle(type, props); - - /* istanbul ignore next */ - - default: - return null; - // should never happen - } -} -/** - * @param {boolean} atLineStart - Node starts at beginning of line - * @param {boolean} inFlow - true if currently in a flow context - * @param {boolean} inCollection - true if currently in a collection context - * @param {number} indent - Current level of indentation - * @param {number} lineStart - Start of the current line - * @param {Node} parent - The parent of the node - * @param {string} src - Source of the YAML document - */ - - -class ParseContext { - static parseType(src, offset, inFlow) { - switch (src[offset]) { - case '*': - return PlainValue.Type.ALIAS; - - case '>': - return PlainValue.Type.BLOCK_FOLDED; - - case '|': - return PlainValue.Type.BLOCK_LITERAL; - - case '{': - return PlainValue.Type.FLOW_MAP; - - case '[': - return PlainValue.Type.FLOW_SEQ; - - case '?': - return !inFlow && PlainValue.Node.atBlank(src, offset + 1, true) ? PlainValue.Type.MAP_KEY : PlainValue.Type.PLAIN; - - case ':': - return !inFlow && PlainValue.Node.atBlank(src, offset + 1, true) ? PlainValue.Type.MAP_VALUE : PlainValue.Type.PLAIN; - - case '-': - return !inFlow && PlainValue.Node.atBlank(src, offset + 1, true) ? PlainValue.Type.SEQ_ITEM : PlainValue.Type.PLAIN; - - case '"': - return PlainValue.Type.QUOTE_DOUBLE; - - case "'": - return PlainValue.Type.QUOTE_SINGLE; - - default: - return PlainValue.Type.PLAIN; - } - } - - constructor(orig = {}, { - atLineStart, - inCollection, - inFlow, - indent, - lineStart, - parent - } = {}) { - PlainValue._defineProperty(this, "parseNode", (overlay, start) => { - if (PlainValue.Node.atDocumentBoundary(this.src, start)) return null; - const context = new ParseContext(this, overlay); - const { - props, - type, - valueStart - } = context.parseProps(start); - const node = createNewNode(type, props); - let offset = node.parse(context, valueStart); - node.range = new PlainValue.Range(start, offset); - /* istanbul ignore if */ - - if (offset <= start) { - // This should never happen, but if it does, let's make sure to at least - // step one character forward to avoid a busy loop. - node.error = new Error(`Node#parse consumed no characters`); - node.error.parseEnd = offset; - node.error.source = node; - node.range.end = start + 1; - } - - if (context.nodeStartsCollection(node)) { - if (!node.error && !context.atLineStart && context.parent.type === PlainValue.Type.DOCUMENT) { - node.error = new PlainValue.YAMLSyntaxError(node, 'Block collection must not have preceding content here (e.g. directives-end indicator)'); - } - - const collection = new Collection(node); - offset = collection.parse(new ParseContext(context), offset); - collection.range = new PlainValue.Range(start, offset); - return collection; - } - - return node; - }); - - this.atLineStart = atLineStart != null ? atLineStart : orig.atLineStart || false; - this.inCollection = inCollection != null ? inCollection : orig.inCollection || false; - this.inFlow = inFlow != null ? inFlow : orig.inFlow || false; - this.indent = indent != null ? indent : orig.indent; - this.lineStart = lineStart != null ? lineStart : orig.lineStart; - this.parent = parent != null ? parent : orig.parent || {}; - this.root = orig.root; - this.src = orig.src; - } - - nodeStartsCollection(node) { - const { - inCollection, - inFlow, - src - } = this; - if (inCollection || inFlow) return false; - if (node instanceof CollectionItem) return true; // check for implicit key - - let offset = node.range.end; - if (src[offset] === '\n' || src[offset - 1] === '\n') return false; - offset = PlainValue.Node.endOfWhiteSpace(src, offset); - return src[offset] === ':'; - } // Anchor and tag are before type, which determines the node implementation - // class; hence this intermediate step. - - - parseProps(offset) { - const { - inFlow, - parent, - src - } = this; - const props = []; - let lineHasProps = false; - offset = this.atLineStart ? PlainValue.Node.endOfIndent(src, offset) : PlainValue.Node.endOfWhiteSpace(src, offset); - let ch = src[offset]; - - while (ch === PlainValue.Char.ANCHOR || ch === PlainValue.Char.COMMENT || ch === PlainValue.Char.TAG || ch === '\n') { - if (ch === '\n') { - let inEnd = offset; - let lineStart; - - do { - lineStart = inEnd + 1; - inEnd = PlainValue.Node.endOfIndent(src, lineStart); - } while (src[inEnd] === '\n'); - - const indentDiff = inEnd - (lineStart + this.indent); - const noIndicatorAsIndent = parent.type === PlainValue.Type.SEQ_ITEM && parent.context.atLineStart; - if (src[inEnd] !== '#' && !PlainValue.Node.nextNodeIsIndented(src[inEnd], indentDiff, !noIndicatorAsIndent)) break; - this.atLineStart = true; - this.lineStart = lineStart; - lineHasProps = false; - offset = inEnd; - } else if (ch === PlainValue.Char.COMMENT) { - const end = PlainValue.Node.endOfLine(src, offset + 1); - props.push(new PlainValue.Range(offset, end)); - offset = end; - } else { - let end = PlainValue.Node.endOfIdentifier(src, offset + 1); - - if (ch === PlainValue.Char.TAG && src[end] === ',' && /^[a-zA-Z0-9-]+\.[a-zA-Z0-9-]+,\d\d\d\d(-\d\d){0,2}\/\S/.test(src.slice(offset + 1, end + 13))) { - // Let's presume we're dealing with a YAML 1.0 domain tag here, rather - // than an empty but 'foo.bar' private-tagged node in a flow collection - // followed without whitespace by a plain string starting with a year - // or date divided by something. - end = PlainValue.Node.endOfIdentifier(src, end + 5); - } - - props.push(new PlainValue.Range(offset, end)); - lineHasProps = true; - offset = PlainValue.Node.endOfWhiteSpace(src, end); - } - - ch = src[offset]; - } // '- &a : b' has an anchor on an empty node - - - if (lineHasProps && ch === ':' && PlainValue.Node.atBlank(src, offset + 1, true)) offset -= 1; - const type = ParseContext.parseType(src, offset, inFlow); - return { - props, - type, - valueStart: offset - }; - } - /** - * Parses a node from the source - * @param {ParseContext} overlay - * @param {number} start - Index of first non-whitespace character for the node - * @returns {?Node} - null if at a document boundary - */ - - -} - -// Published as 'yaml/parse-cst' -function parse(src) { - const cr = []; - - if (src.indexOf('\r') !== -1) { - src = src.replace(/\r\n?/g, (match, offset) => { - if (match.length > 1) cr.push(offset); - return '\n'; - }); - } - - const documents = []; - let offset = 0; - - do { - const doc = new Document(); - const context = new ParseContext({ - src - }); - offset = doc.parse(context, offset); - documents.push(doc); - } while (offset < src.length); - - documents.setOrigRanges = () => { - if (cr.length === 0) return false; - - for (let i = 1; i < cr.length; ++i) cr[i] -= i; - - let crOffset = 0; - - for (let i = 0; i < documents.length; ++i) { - crOffset = documents[i].setOrigRanges(cr, crOffset); - } - - cr.splice(0, cr.length); - return true; - }; - - documents.toString = () => documents.join('...\n'); - - return documents; -} - -exports.parse = parse; diff --git a/node_modules/yaml/dist/resolveSeq-d03cb037.js b/node_modules/yaml/dist/resolveSeq-d03cb037.js deleted file mode 100644 index d7c7c8c3c..000000000 --- a/node_modules/yaml/dist/resolveSeq-d03cb037.js +++ /dev/null @@ -1,2161 +0,0 @@ -'use strict'; - -var PlainValue = require('./PlainValue-ec8e588e.js'); - -function addCommentBefore(str, indent, comment) { - if (!comment) return str; - const cc = comment.replace(/[\s\S]^/gm, `$&${indent}#`); - return `#${cc}\n${indent}${str}`; -} -function addComment(str, indent, comment) { - return !comment ? str : comment.indexOf('\n') === -1 ? `${str} #${comment}` : `${str}\n` + comment.replace(/^/gm, `${indent || ''}#`); -} - -class Node {} - -function toJSON(value, arg, ctx) { - if (Array.isArray(value)) return value.map((v, i) => toJSON(v, String(i), ctx)); - - if (value && typeof value.toJSON === 'function') { - const anchor = ctx && ctx.anchors && ctx.anchors.get(value); - if (anchor) ctx.onCreate = res => { - anchor.res = res; - delete ctx.onCreate; - }; - const res = value.toJSON(arg, ctx); - if (anchor && ctx.onCreate) ctx.onCreate(res); - return res; - } - - if ((!ctx || !ctx.keep) && typeof value === 'bigint') return Number(value); - return value; -} - -class Scalar extends Node { - constructor(value) { - super(); - this.value = value; - } - - toJSON(arg, ctx) { - return ctx && ctx.keep ? this.value : toJSON(this.value, arg, ctx); - } - - toString() { - return String(this.value); - } - -} - -function collectionFromPath(schema, path, value) { - let v = value; - - for (let i = path.length - 1; i >= 0; --i) { - const k = path[i]; - - if (Number.isInteger(k) && k >= 0) { - const a = []; - a[k] = v; - v = a; - } else { - const o = {}; - Object.defineProperty(o, k, { - value: v, - writable: true, - enumerable: true, - configurable: true - }); - v = o; - } - } - - return schema.createNode(v, false); -} // null, undefined, or an empty non-string iterable (e.g. []) - - -const isEmptyPath = path => path == null || typeof path === 'object' && path[Symbol.iterator]().next().done; -class Collection extends Node { - constructor(schema) { - super(); - - PlainValue._defineProperty(this, "items", []); - - this.schema = schema; - } - - addIn(path, value) { - if (isEmptyPath(path)) this.add(value);else { - const [key, ...rest] = path; - const node = this.get(key, true); - if (node instanceof Collection) node.addIn(rest, value);else if (node === undefined && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`); - } - } - - deleteIn([key, ...rest]) { - if (rest.length === 0) return this.delete(key); - const node = this.get(key, true); - if (node instanceof Collection) return node.deleteIn(rest);else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`); - } - - getIn([key, ...rest], keepScalar) { - const node = this.get(key, true); - if (rest.length === 0) return !keepScalar && node instanceof Scalar ? node.value : node;else return node instanceof Collection ? node.getIn(rest, keepScalar) : undefined; - } - - hasAllNullValues() { - return this.items.every(node => { - if (!node || node.type !== 'PAIR') return false; - const n = node.value; - return n == null || n instanceof Scalar && n.value == null && !n.commentBefore && !n.comment && !n.tag; - }); - } - - hasIn([key, ...rest]) { - if (rest.length === 0) return this.has(key); - const node = this.get(key, true); - return node instanceof Collection ? node.hasIn(rest) : false; - } - - setIn([key, ...rest], value) { - if (rest.length === 0) { - this.set(key, value); - } else { - const node = this.get(key, true); - if (node instanceof Collection) node.setIn(rest, value);else if (node === undefined && this.schema) this.set(key, collectionFromPath(this.schema, rest, value));else throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`); - } - } // overridden in implementations - - /* istanbul ignore next */ - - - toJSON() { - return null; - } - - toString(ctx, { - blockItem, - flowChars, - isMap, - itemIndent - }, onComment, onChompKeep) { - const { - indent, - indentStep, - stringify - } = ctx; - const inFlow = this.type === PlainValue.Type.FLOW_MAP || this.type === PlainValue.Type.FLOW_SEQ || ctx.inFlow; - if (inFlow) itemIndent += indentStep; - const allNullValues = isMap && this.hasAllNullValues(); - ctx = Object.assign({}, ctx, { - allNullValues, - indent: itemIndent, - inFlow, - type: null - }); - let chompKeep = false; - let hasItemWithNewLine = false; - const nodes = this.items.reduce((nodes, item, i) => { - let comment; - - if (item) { - if (!chompKeep && item.spaceBefore) nodes.push({ - type: 'comment', - str: '' - }); - if (item.commentBefore) item.commentBefore.match(/^.*$/gm).forEach(line => { - nodes.push({ - type: 'comment', - str: `#${line}` - }); - }); - if (item.comment) comment = item.comment; - if (inFlow && (!chompKeep && item.spaceBefore || item.commentBefore || item.comment || item.key && (item.key.commentBefore || item.key.comment) || item.value && (item.value.commentBefore || item.value.comment))) hasItemWithNewLine = true; - } - - chompKeep = false; - let str = stringify(item, ctx, () => comment = null, () => chompKeep = true); - if (inFlow && !hasItemWithNewLine && str.includes('\n')) hasItemWithNewLine = true; - if (inFlow && i < this.items.length - 1) str += ','; - str = addComment(str, itemIndent, comment); - if (chompKeep && (comment || inFlow)) chompKeep = false; - nodes.push({ - type: 'item', - str - }); - return nodes; - }, []); - let str; - - if (nodes.length === 0) { - str = flowChars.start + flowChars.end; - } else if (inFlow) { - const { - start, - end - } = flowChars; - const strings = nodes.map(n => n.str); - - if (hasItemWithNewLine || strings.reduce((sum, str) => sum + str.length + 2, 2) > Collection.maxFlowStringSingleLineLength) { - str = start; - - for (const s of strings) { - str += s ? `\n${indentStep}${indent}${s}` : '\n'; - } - - str += `\n${indent}${end}`; - } else { - str = `${start} ${strings.join(' ')} ${end}`; - } - } else { - const strings = nodes.map(blockItem); - str = strings.shift(); - - for (const s of strings) str += s ? `\n${indent}${s}` : '\n'; - } - - if (this.comment) { - str += '\n' + this.comment.replace(/^/gm, `${indent}#`); - if (onComment) onComment(); - } else if (chompKeep && onChompKeep) onChompKeep(); - - return str; - } - -} - -PlainValue._defineProperty(Collection, "maxFlowStringSingleLineLength", 60); - -function asItemIndex(key) { - let idx = key instanceof Scalar ? key.value : key; - if (idx && typeof idx === 'string') idx = Number(idx); - return Number.isInteger(idx) && idx >= 0 ? idx : null; -} - -class YAMLSeq extends Collection { - add(value) { - this.items.push(value); - } - - delete(key) { - const idx = asItemIndex(key); - if (typeof idx !== 'number') return false; - const del = this.items.splice(idx, 1); - return del.length > 0; - } - - get(key, keepScalar) { - const idx = asItemIndex(key); - if (typeof idx !== 'number') return undefined; - const it = this.items[idx]; - return !keepScalar && it instanceof Scalar ? it.value : it; - } - - has(key) { - const idx = asItemIndex(key); - return typeof idx === 'number' && idx < this.items.length; - } - - set(key, value) { - const idx = asItemIndex(key); - if (typeof idx !== 'number') throw new Error(`Expected a valid index, not ${key}.`); - this.items[idx] = value; - } - - toJSON(_, ctx) { - const seq = []; - if (ctx && ctx.onCreate) ctx.onCreate(seq); - let i = 0; - - for (const item of this.items) seq.push(toJSON(item, String(i++), ctx)); - - return seq; - } - - toString(ctx, onComment, onChompKeep) { - if (!ctx) return JSON.stringify(this); - return super.toString(ctx, { - blockItem: n => n.type === 'comment' ? n.str : `- ${n.str}`, - flowChars: { - start: '[', - end: ']' - }, - isMap: false, - itemIndent: (ctx.indent || '') + ' ' - }, onComment, onChompKeep); - } - -} - -const stringifyKey = (key, jsKey, ctx) => { - if (jsKey === null) return ''; - if (typeof jsKey !== 'object') return String(jsKey); - if (key instanceof Node && ctx && ctx.doc) return key.toString({ - anchors: Object.create(null), - doc: ctx.doc, - indent: '', - indentStep: ctx.indentStep, - inFlow: true, - inStringifyKey: true, - stringify: ctx.stringify - }); - return JSON.stringify(jsKey); -}; - -class Pair extends Node { - constructor(key, value = null) { - super(); - this.key = key; - this.value = value; - this.type = Pair.Type.PAIR; - } - - get commentBefore() { - return this.key instanceof Node ? this.key.commentBefore : undefined; - } - - set commentBefore(cb) { - if (this.key == null) this.key = new Scalar(null); - if (this.key instanceof Node) this.key.commentBefore = cb;else { - const msg = 'Pair.commentBefore is an alias for Pair.key.commentBefore. To set it, the key must be a Node.'; - throw new Error(msg); - } - } - - addToJSMap(ctx, map) { - const key = toJSON(this.key, '', ctx); - - if (map instanceof Map) { - const value = toJSON(this.value, key, ctx); - map.set(key, value); - } else if (map instanceof Set) { - map.add(key); - } else { - const stringKey = stringifyKey(this.key, key, ctx); - const value = toJSON(this.value, stringKey, ctx); - if (stringKey in map) Object.defineProperty(map, stringKey, { - value, - writable: true, - enumerable: true, - configurable: true - });else map[stringKey] = value; - } - - return map; - } - - toJSON(_, ctx) { - const pair = ctx && ctx.mapAsMap ? new Map() : {}; - return this.addToJSMap(ctx, pair); - } - - toString(ctx, onComment, onChompKeep) { - if (!ctx || !ctx.doc) return JSON.stringify(this); - const { - indent: indentSize, - indentSeq, - simpleKeys - } = ctx.doc.options; - let { - key, - value - } = this; - let keyComment = key instanceof Node && key.comment; - - if (simpleKeys) { - if (keyComment) { - throw new Error('With simple keys, key nodes cannot have comments'); - } - - if (key instanceof Collection) { - const msg = 'With simple keys, collection cannot be used as a key value'; - throw new Error(msg); - } - } - - let explicitKey = !simpleKeys && (!key || keyComment || (key instanceof Node ? key instanceof Collection || key.type === PlainValue.Type.BLOCK_FOLDED || key.type === PlainValue.Type.BLOCK_LITERAL : typeof key === 'object')); - const { - doc, - indent, - indentStep, - stringify - } = ctx; - ctx = Object.assign({}, ctx, { - implicitKey: !explicitKey, - indent: indent + indentStep - }); - let chompKeep = false; - let str = stringify(key, ctx, () => keyComment = null, () => chompKeep = true); - str = addComment(str, ctx.indent, keyComment); - - if (!explicitKey && str.length > 1024) { - if (simpleKeys) throw new Error('With simple keys, single line scalar must not span more than 1024 characters'); - explicitKey = true; - } - - if (ctx.allNullValues && !simpleKeys) { - if (this.comment) { - str = addComment(str, ctx.indent, this.comment); - if (onComment) onComment(); - } else if (chompKeep && !keyComment && onChompKeep) onChompKeep(); - - return ctx.inFlow && !explicitKey ? str : `? ${str}`; - } - - str = explicitKey ? `? ${str}\n${indent}:` : `${str}:`; - - if (this.comment) { - // expected (but not strictly required) to be a single-line comment - str = addComment(str, ctx.indent, this.comment); - if (onComment) onComment(); - } - - let vcb = ''; - let valueComment = null; - - if (value instanceof Node) { - if (value.spaceBefore) vcb = '\n'; - - if (value.commentBefore) { - const cs = value.commentBefore.replace(/^/gm, `${ctx.indent}#`); - vcb += `\n${cs}`; - } - - valueComment = value.comment; - } else if (value && typeof value === 'object') { - value = doc.schema.createNode(value, true); - } - - ctx.implicitKey = false; - if (!explicitKey && !this.comment && value instanceof Scalar) ctx.indentAtStart = str.length + 1; - chompKeep = false; - - if (!indentSeq && indentSize >= 2 && !ctx.inFlow && !explicitKey && value instanceof YAMLSeq && value.type !== PlainValue.Type.FLOW_SEQ && !value.tag && !doc.anchors.getName(value)) { - // If indentSeq === false, consider '- ' as part of indentation where possible - ctx.indent = ctx.indent.substr(2); - } - - const valueStr = stringify(value, ctx, () => valueComment = null, () => chompKeep = true); - let ws = ' '; - - if (vcb || this.comment) { - ws = `${vcb}\n${ctx.indent}`; - } else if (!explicitKey && value instanceof Collection) { - const flow = valueStr[0] === '[' || valueStr[0] === '{'; - if (!flow || valueStr.includes('\n')) ws = `\n${ctx.indent}`; - } else if (valueStr[0] === '\n') ws = ''; - - if (chompKeep && !valueComment && onChompKeep) onChompKeep(); - return addComment(str + ws + valueStr, ctx.indent, valueComment); - } - -} - -PlainValue._defineProperty(Pair, "Type", { - PAIR: 'PAIR', - MERGE_PAIR: 'MERGE_PAIR' -}); - -const getAliasCount = (node, anchors) => { - if (node instanceof Alias) { - const anchor = anchors.get(node.source); - return anchor.count * anchor.aliasCount; - } else if (node instanceof Collection) { - let count = 0; - - for (const item of node.items) { - const c = getAliasCount(item, anchors); - if (c > count) count = c; - } - - return count; - } else if (node instanceof Pair) { - const kc = getAliasCount(node.key, anchors); - const vc = getAliasCount(node.value, anchors); - return Math.max(kc, vc); - } - - return 1; -}; - -class Alias extends Node { - static stringify({ - range, - source - }, { - anchors, - doc, - implicitKey, - inStringifyKey - }) { - let anchor = Object.keys(anchors).find(a => anchors[a] === source); - if (!anchor && inStringifyKey) anchor = doc.anchors.getName(source) || doc.anchors.newName(); - if (anchor) return `*${anchor}${implicitKey ? ' ' : ''}`; - const msg = doc.anchors.getName(source) ? 'Alias node must be after source node' : 'Source node not found for alias node'; - throw new Error(`${msg} [${range}]`); - } - - constructor(source) { - super(); - this.source = source; - this.type = PlainValue.Type.ALIAS; - } - - set tag(t) { - throw new Error('Alias nodes cannot have tags'); - } - - toJSON(arg, ctx) { - if (!ctx) return toJSON(this.source, arg, ctx); - const { - anchors, - maxAliasCount - } = ctx; - const anchor = anchors.get(this.source); - /* istanbul ignore if */ - - if (!anchor || anchor.res === undefined) { - const msg = 'This should not happen: Alias anchor was not resolved?'; - if (this.cstNode) throw new PlainValue.YAMLReferenceError(this.cstNode, msg);else throw new ReferenceError(msg); - } - - if (maxAliasCount >= 0) { - anchor.count += 1; - if (anchor.aliasCount === 0) anchor.aliasCount = getAliasCount(this.source, anchors); - - if (anchor.count * anchor.aliasCount > maxAliasCount) { - const msg = 'Excessive alias count indicates a resource exhaustion attack'; - if (this.cstNode) throw new PlainValue.YAMLReferenceError(this.cstNode, msg);else throw new ReferenceError(msg); - } - } - - return anchor.res; - } // Only called when stringifying an alias mapping key while constructing - // Object output. - - - toString(ctx) { - return Alias.stringify(this, ctx); - } - -} - -PlainValue._defineProperty(Alias, "default", true); - -function findPair(items, key) { - const k = key instanceof Scalar ? key.value : key; - - for (const it of items) { - if (it instanceof Pair) { - if (it.key === key || it.key === k) return it; - if (it.key && it.key.value === k) return it; - } - } - - return undefined; -} -class YAMLMap extends Collection { - add(pair, overwrite) { - if (!pair) pair = new Pair(pair);else if (!(pair instanceof Pair)) pair = new Pair(pair.key || pair, pair.value); - const prev = findPair(this.items, pair.key); - const sortEntries = this.schema && this.schema.sortMapEntries; - - if (prev) { - if (overwrite) prev.value = pair.value;else throw new Error(`Key ${pair.key} already set`); - } else if (sortEntries) { - const i = this.items.findIndex(item => sortEntries(pair, item) < 0); - if (i === -1) this.items.push(pair);else this.items.splice(i, 0, pair); - } else { - this.items.push(pair); - } - } - - delete(key) { - const it = findPair(this.items, key); - if (!it) return false; - const del = this.items.splice(this.items.indexOf(it), 1); - return del.length > 0; - } - - get(key, keepScalar) { - const it = findPair(this.items, key); - const node = it && it.value; - return !keepScalar && node instanceof Scalar ? node.value : node; - } - - has(key) { - return !!findPair(this.items, key); - } - - set(key, value) { - this.add(new Pair(key, value), true); - } - /** - * @param {*} arg ignored - * @param {*} ctx Conversion context, originally set in Document#toJSON() - * @param {Class} Type If set, forces the returned collection type - * @returns {*} Instance of Type, Map, or Object - */ - - - toJSON(_, ctx, Type) { - const map = Type ? new Type() : ctx && ctx.mapAsMap ? new Map() : {}; - if (ctx && ctx.onCreate) ctx.onCreate(map); - - for (const item of this.items) item.addToJSMap(ctx, map); - - return map; - } - - toString(ctx, onComment, onChompKeep) { - if (!ctx) return JSON.stringify(this); - - for (const item of this.items) { - if (!(item instanceof Pair)) throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`); - } - - return super.toString(ctx, { - blockItem: n => n.str, - flowChars: { - start: '{', - end: '}' - }, - isMap: true, - itemIndent: ctx.indent || '' - }, onComment, onChompKeep); - } - -} - -const MERGE_KEY = '<<'; -class Merge extends Pair { - constructor(pair) { - if (pair instanceof Pair) { - let seq = pair.value; - - if (!(seq instanceof YAMLSeq)) { - seq = new YAMLSeq(); - seq.items.push(pair.value); - seq.range = pair.value.range; - } - - super(pair.key, seq); - this.range = pair.range; - } else { - super(new Scalar(MERGE_KEY), new YAMLSeq()); - } - - this.type = Pair.Type.MERGE_PAIR; - } // If the value associated with a merge key is a single mapping node, each of - // its key/value pairs is inserted into the current mapping, unless the key - // already exists in it. If the value associated with the merge key is a - // sequence, then this sequence is expected to contain mapping nodes and each - // of these nodes is merged in turn according to its order in the sequence. - // Keys in mapping nodes earlier in the sequence override keys specified in - // later mapping nodes. -- http://yaml.org/type/merge.html - - - addToJSMap(ctx, map) { - for (const { - source - } of this.value.items) { - if (!(source instanceof YAMLMap)) throw new Error('Merge sources must be maps'); - const srcMap = source.toJSON(null, ctx, Map); - - for (const [key, value] of srcMap) { - if (map instanceof Map) { - if (!map.has(key)) map.set(key, value); - } else if (map instanceof Set) { - map.add(key); - } else if (!Object.prototype.hasOwnProperty.call(map, key)) { - Object.defineProperty(map, key, { - value, - writable: true, - enumerable: true, - configurable: true - }); - } - } - } - - return map; - } - - toString(ctx, onComment) { - const seq = this.value; - if (seq.items.length > 1) return super.toString(ctx, onComment); - this.value = seq.items[0]; - const str = super.toString(ctx, onComment); - this.value = seq; - return str; - } - -} - -const binaryOptions = { - defaultType: PlainValue.Type.BLOCK_LITERAL, - lineWidth: 76 -}; -const boolOptions = { - trueStr: 'true', - falseStr: 'false' -}; -const intOptions = { - asBigInt: false -}; -const nullOptions = { - nullStr: 'null' -}; -const strOptions = { - defaultType: PlainValue.Type.PLAIN, - doubleQuoted: { - jsonEncoding: false, - minMultiLineLength: 40 - }, - fold: { - lineWidth: 80, - minContentWidth: 20 - } -}; - -function resolveScalar(str, tags, scalarFallback) { - for (const { - format, - test, - resolve - } of tags) { - if (test) { - const match = str.match(test); - - if (match) { - let res = resolve.apply(null, match); - if (!(res instanceof Scalar)) res = new Scalar(res); - if (format) res.format = format; - return res; - } - } - } - - if (scalarFallback) str = scalarFallback(str); - return new Scalar(str); -} - -const FOLD_FLOW = 'flow'; -const FOLD_BLOCK = 'block'; -const FOLD_QUOTED = 'quoted'; // presumes i+1 is at the start of a line -// returns index of last newline in more-indented block - -const consumeMoreIndentedLines = (text, i) => { - let ch = text[i + 1]; - - while (ch === ' ' || ch === '\t') { - do { - ch = text[i += 1]; - } while (ch && ch !== '\n'); - - ch = text[i + 1]; - } - - return i; -}; -/** - * Tries to keep input at up to `lineWidth` characters, splitting only on spaces - * not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are - * terminated with `\n` and started with `indent`. - * - * @param {string} text - * @param {string} indent - * @param {string} [mode='flow'] `'block'` prevents more-indented lines - * from being folded; `'quoted'` allows for `\` escapes, including escaped - * newlines - * @param {Object} options - * @param {number} [options.indentAtStart] Accounts for leading contents on - * the first line, defaulting to `indent.length` - * @param {number} [options.lineWidth=80] - * @param {number} [options.minContentWidth=20] Allow highly indented lines to - * stretch the line width or indent content from the start - * @param {function} options.onFold Called once if the text is folded - * @param {function} options.onFold Called once if any line of text exceeds - * lineWidth characters - */ - - -function foldFlowLines(text, indent, mode, { - indentAtStart, - lineWidth = 80, - minContentWidth = 20, - onFold, - onOverflow -}) { - if (!lineWidth || lineWidth < 0) return text; - const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length); - if (text.length <= endStep) return text; - const folds = []; - const escapedFolds = {}; - let end = lineWidth - indent.length; - - if (typeof indentAtStart === 'number') { - if (indentAtStart > lineWidth - Math.max(2, minContentWidth)) folds.push(0);else end = lineWidth - indentAtStart; - } - - let split = undefined; - let prev = undefined; - let overflow = false; - let i = -1; - let escStart = -1; - let escEnd = -1; - - if (mode === FOLD_BLOCK) { - i = consumeMoreIndentedLines(text, i); - if (i !== -1) end = i + endStep; - } - - for (let ch; ch = text[i += 1];) { - if (mode === FOLD_QUOTED && ch === '\\') { - escStart = i; - - switch (text[i + 1]) { - case 'x': - i += 3; - break; - - case 'u': - i += 5; - break; - - case 'U': - i += 9; - break; - - default: - i += 1; - } - - escEnd = i; - } - - if (ch === '\n') { - if (mode === FOLD_BLOCK) i = consumeMoreIndentedLines(text, i); - end = i + endStep; - split = undefined; - } else { - if (ch === ' ' && prev && prev !== ' ' && prev !== '\n' && prev !== '\t') { - // space surrounded by non-space can be replaced with newline + indent - const next = text[i + 1]; - if (next && next !== ' ' && next !== '\n' && next !== '\t') split = i; - } - - if (i >= end) { - if (split) { - folds.push(split); - end = split + endStep; - split = undefined; - } else if (mode === FOLD_QUOTED) { - // white-space collected at end may stretch past lineWidth - while (prev === ' ' || prev === '\t') { - prev = ch; - ch = text[i += 1]; - overflow = true; - } // Account for newline escape, but don't break preceding escape - - - const j = i > escEnd + 1 ? i - 2 : escStart - 1; // Bail out if lineWidth & minContentWidth are shorter than an escape string - - if (escapedFolds[j]) return text; - folds.push(j); - escapedFolds[j] = true; - end = j + endStep; - split = undefined; - } else { - overflow = true; - } - } - } - - prev = ch; - } - - if (overflow && onOverflow) onOverflow(); - if (folds.length === 0) return text; - if (onFold) onFold(); - let res = text.slice(0, folds[0]); - - for (let i = 0; i < folds.length; ++i) { - const fold = folds[i]; - const end = folds[i + 1] || text.length; - if (fold === 0) res = `\n${indent}${text.slice(0, end)}`;else { - if (mode === FOLD_QUOTED && escapedFolds[fold]) res += `${text[fold]}\\`; - res += `\n${indent}${text.slice(fold + 1, end)}`; - } - } - - return res; -} - -const getFoldOptions = ({ - indentAtStart -}) => indentAtStart ? Object.assign({ - indentAtStart -}, strOptions.fold) : strOptions.fold; // Also checks for lines starting with %, as parsing the output as YAML 1.1 will -// presume that's starting a new document. - - -const containsDocumentMarker = str => /^(%|---|\.\.\.)/m.test(str); - -function lineLengthOverLimit(str, lineWidth, indentLength) { - if (!lineWidth || lineWidth < 0) return false; - const limit = lineWidth - indentLength; - const strLen = str.length; - if (strLen <= limit) return false; - - for (let i = 0, start = 0; i < strLen; ++i) { - if (str[i] === '\n') { - if (i - start > limit) return true; - start = i + 1; - if (strLen - start <= limit) return false; - } - } - - return true; -} - -function doubleQuotedString(value, ctx) { - const { - implicitKey - } = ctx; - const { - jsonEncoding, - minMultiLineLength - } = strOptions.doubleQuoted; - const json = JSON.stringify(value); - if (jsonEncoding) return json; - const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : ''); - let str = ''; - let start = 0; - - for (let i = 0, ch = json[i]; ch; ch = json[++i]) { - if (ch === ' ' && json[i + 1] === '\\' && json[i + 2] === 'n') { - // space before newline needs to be escaped to not be folded - str += json.slice(start, i) + '\\ '; - i += 1; - start = i; - ch = '\\'; - } - - if (ch === '\\') switch (json[i + 1]) { - case 'u': - { - str += json.slice(start, i); - const code = json.substr(i + 2, 4); - - switch (code) { - case '0000': - str += '\\0'; - break; - - case '0007': - str += '\\a'; - break; - - case '000b': - str += '\\v'; - break; - - case '001b': - str += '\\e'; - break; - - case '0085': - str += '\\N'; - break; - - case '00a0': - str += '\\_'; - break; - - case '2028': - str += '\\L'; - break; - - case '2029': - str += '\\P'; - break; - - default: - if (code.substr(0, 2) === '00') str += '\\x' + code.substr(2);else str += json.substr(i, 6); - } - - i += 5; - start = i + 1; - } - break; - - case 'n': - if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) { - i += 1; - } else { - // folding will eat first newline - str += json.slice(start, i) + '\n\n'; - - while (json[i + 2] === '\\' && json[i + 3] === 'n' && json[i + 4] !== '"') { - str += '\n'; - i += 2; - } - - str += indent; // space after newline needs to be escaped to not be folded - - if (json[i + 2] === ' ') str += '\\'; - i += 1; - start = i + 1; - } - - break; - - default: - i += 1; - } - } - - str = start ? str + json.slice(start) : json; - return implicitKey ? str : foldFlowLines(str, indent, FOLD_QUOTED, getFoldOptions(ctx)); -} - -function singleQuotedString(value, ctx) { - if (ctx.implicitKey) { - if (/\n/.test(value)) return doubleQuotedString(value, ctx); - } else { - // single quoted string can't have leading or trailing whitespace around newline - if (/[ \t]\n|\n[ \t]/.test(value)) return doubleQuotedString(value, ctx); - } - - const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : ''); - const res = "'" + value.replace(/'/g, "''").replace(/\n+/g, `$&\n${indent}`) + "'"; - return ctx.implicitKey ? res : foldFlowLines(res, indent, FOLD_FLOW, getFoldOptions(ctx)); -} - -function blockString({ - comment, - type, - value -}, ctx, onComment, onChompKeep) { - // 1. Block can't end in whitespace unless the last line is non-empty. - // 2. Strings consisting of only whitespace are best rendered explicitly. - if (/\n[\t ]+$/.test(value) || /^\s*$/.test(value)) { - return doubleQuotedString(value, ctx); - } - - const indent = ctx.indent || (ctx.forceBlockIndent || containsDocumentMarker(value) ? ' ' : ''); - const indentSize = indent ? '2' : '1'; // root is at -1 - - const literal = type === PlainValue.Type.BLOCK_FOLDED ? false : type === PlainValue.Type.BLOCK_LITERAL ? true : !lineLengthOverLimit(value, strOptions.fold.lineWidth, indent.length); - let header = literal ? '|' : '>'; - if (!value) return header + '\n'; - let wsStart = ''; - let wsEnd = ''; - value = value.replace(/[\n\t ]*$/, ws => { - const n = ws.indexOf('\n'); - - if (n === -1) { - header += '-'; // strip - } else if (value === ws || n !== ws.length - 1) { - header += '+'; // keep - - if (onChompKeep) onChompKeep(); - } - - wsEnd = ws.replace(/\n$/, ''); - return ''; - }).replace(/^[\n ]*/, ws => { - if (ws.indexOf(' ') !== -1) header += indentSize; - const m = ws.match(/ +$/); - - if (m) { - wsStart = ws.slice(0, -m[0].length); - return m[0]; - } else { - wsStart = ws; - return ''; - } - }); - if (wsEnd) wsEnd = wsEnd.replace(/\n+(?!\n|$)/g, `$&${indent}`); - if (wsStart) wsStart = wsStart.replace(/\n+/g, `$&${indent}`); - - if (comment) { - header += ' #' + comment.replace(/ ?[\r\n]+/g, ' '); - if (onComment) onComment(); - } - - if (!value) return `${header}${indentSize}\n${indent}${wsEnd}`; - - if (literal) { - value = value.replace(/\n+/g, `$&${indent}`); - return `${header}\n${indent}${wsStart}${value}${wsEnd}`; - } - - value = value.replace(/\n+/g, '\n$&').replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g, '$1$2') // more-indented lines aren't folded - // ^ ind.line ^ empty ^ capture next empty lines only at end of indent - .replace(/\n+/g, `$&${indent}`); - const body = foldFlowLines(`${wsStart}${value}${wsEnd}`, indent, FOLD_BLOCK, strOptions.fold); - return `${header}\n${indent}${body}`; -} - -function plainString(item, ctx, onComment, onChompKeep) { - const { - comment, - type, - value - } = item; - const { - actualString, - implicitKey, - indent, - inFlow - } = ctx; - - if (implicitKey && /[\n[\]{},]/.test(value) || inFlow && /[[\]{},]/.test(value)) { - return doubleQuotedString(value, ctx); - } - - if (!value || /^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(value)) { - // not allowed: - // - empty string, '-' or '?' - // - start with an indicator character (except [?:-]) or /[?-] / - // - '\n ', ': ' or ' \n' anywhere - // - '#' not preceded by a non-space char - // - end with ' ' or ':' - return implicitKey || inFlow || value.indexOf('\n') === -1 ? value.indexOf('"') !== -1 && value.indexOf("'") === -1 ? singleQuotedString(value, ctx) : doubleQuotedString(value, ctx) : blockString(item, ctx, onComment, onChompKeep); - } - - if (!implicitKey && !inFlow && type !== PlainValue.Type.PLAIN && value.indexOf('\n') !== -1) { - // Where allowed & type not set explicitly, prefer block style for multiline strings - return blockString(item, ctx, onComment, onChompKeep); - } - - if (indent === '' && containsDocumentMarker(value)) { - ctx.forceBlockIndent = true; - return blockString(item, ctx, onComment, onChompKeep); - } - - const str = value.replace(/\n+/g, `$&\n${indent}`); // Verify that output will be parsed as a string, as e.g. plain numbers and - // booleans get parsed with those types in v1.2 (e.g. '42', 'true' & '0.9e-3'), - // and others in v1.1. - - if (actualString) { - const { - tags - } = ctx.doc.schema; - const resolved = resolveScalar(str, tags, tags.scalarFallback).value; - if (typeof resolved !== 'string') return doubleQuotedString(value, ctx); - } - - const body = implicitKey ? str : foldFlowLines(str, indent, FOLD_FLOW, getFoldOptions(ctx)); - - if (comment && !inFlow && (body.indexOf('\n') !== -1 || comment.indexOf('\n') !== -1)) { - if (onComment) onComment(); - return addCommentBefore(body, indent, comment); - } - - return body; -} - -function stringifyString(item, ctx, onComment, onChompKeep) { - const { - defaultType - } = strOptions; - const { - implicitKey, - inFlow - } = ctx; - let { - type, - value - } = item; - - if (typeof value !== 'string') { - value = String(value); - item = Object.assign({}, item, { - value - }); - } - - const _stringify = _type => { - switch (_type) { - case PlainValue.Type.BLOCK_FOLDED: - case PlainValue.Type.BLOCK_LITERAL: - return blockString(item, ctx, onComment, onChompKeep); - - case PlainValue.Type.QUOTE_DOUBLE: - return doubleQuotedString(value, ctx); - - case PlainValue.Type.QUOTE_SINGLE: - return singleQuotedString(value, ctx); - - case PlainValue.Type.PLAIN: - return plainString(item, ctx, onComment, onChompKeep); - - default: - return null; - } - }; - - if (type !== PlainValue.Type.QUOTE_DOUBLE && /[\x00-\x08\x0b-\x1f\x7f-\x9f]/.test(value)) { - // force double quotes on control characters - type = PlainValue.Type.QUOTE_DOUBLE; - } else if ((implicitKey || inFlow) && (type === PlainValue.Type.BLOCK_FOLDED || type === PlainValue.Type.BLOCK_LITERAL)) { - // should not happen; blocks are not valid inside flow containers - type = PlainValue.Type.QUOTE_DOUBLE; - } - - let res = _stringify(type); - - if (res === null) { - res = _stringify(defaultType); - if (res === null) throw new Error(`Unsupported default string type ${defaultType}`); - } - - return res; -} - -function stringifyNumber({ - format, - minFractionDigits, - tag, - value -}) { - if (typeof value === 'bigint') return String(value); - if (!isFinite(value)) return isNaN(value) ? '.nan' : value < 0 ? '-.inf' : '.inf'; - let n = JSON.stringify(value); - - if (!format && minFractionDigits && (!tag || tag === 'tag:yaml.org,2002:float') && /^\d/.test(n)) { - let i = n.indexOf('.'); - - if (i < 0) { - i = n.length; - n += '.'; - } - - let d = minFractionDigits - (n.length - i - 1); - - while (d-- > 0) n += '0'; - } - - return n; -} - -function checkFlowCollectionEnd(errors, cst) { - let char, name; - - switch (cst.type) { - case PlainValue.Type.FLOW_MAP: - char = '}'; - name = 'flow map'; - break; - - case PlainValue.Type.FLOW_SEQ: - char = ']'; - name = 'flow sequence'; - break; - - default: - errors.push(new PlainValue.YAMLSemanticError(cst, 'Not a flow collection!?')); - return; - } - - let lastItem; - - for (let i = cst.items.length - 1; i >= 0; --i) { - const item = cst.items[i]; - - if (!item || item.type !== PlainValue.Type.COMMENT) { - lastItem = item; - break; - } - } - - if (lastItem && lastItem.char !== char) { - const msg = `Expected ${name} to end with ${char}`; - let err; - - if (typeof lastItem.offset === 'number') { - err = new PlainValue.YAMLSemanticError(cst, msg); - err.offset = lastItem.offset + 1; - } else { - err = new PlainValue.YAMLSemanticError(lastItem, msg); - if (lastItem.range && lastItem.range.end) err.offset = lastItem.range.end - lastItem.range.start; - } - - errors.push(err); - } -} -function checkFlowCommentSpace(errors, comment) { - const prev = comment.context.src[comment.range.start - 1]; - - if (prev !== '\n' && prev !== '\t' && prev !== ' ') { - const msg = 'Comments must be separated from other tokens by white space characters'; - errors.push(new PlainValue.YAMLSemanticError(comment, msg)); - } -} -function getLongKeyError(source, key) { - const sk = String(key); - const k = sk.substr(0, 8) + '...' + sk.substr(-8); - return new PlainValue.YAMLSemanticError(source, `The "${k}" key is too long`); -} -function resolveComments(collection, comments) { - for (const { - afterKey, - before, - comment - } of comments) { - let item = collection.items[before]; - - if (!item) { - if (comment !== undefined) { - if (collection.comment) collection.comment += '\n' + comment;else collection.comment = comment; - } - } else { - if (afterKey && item.value) item = item.value; - - if (comment === undefined) { - if (afterKey || !item.commentBefore) item.spaceBefore = true; - } else { - if (item.commentBefore) item.commentBefore += '\n' + comment;else item.commentBefore = comment; - } - } - } -} - -// on error, will return { str: string, errors: Error[] } -function resolveString(doc, node) { - const res = node.strValue; - if (!res) return ''; - if (typeof res === 'string') return res; - res.errors.forEach(error => { - if (!error.source) error.source = node; - doc.errors.push(error); - }); - return res.str; -} - -function resolveTagHandle(doc, node) { - const { - handle, - suffix - } = node.tag; - let prefix = doc.tagPrefixes.find(p => p.handle === handle); - - if (!prefix) { - const dtp = doc.getDefaults().tagPrefixes; - if (dtp) prefix = dtp.find(p => p.handle === handle); - if (!prefix) throw new PlainValue.YAMLSemanticError(node, `The ${handle} tag handle is non-default and was not declared.`); - } - - if (!suffix) throw new PlainValue.YAMLSemanticError(node, `The ${handle} tag has no suffix.`); - - if (handle === '!' && (doc.version || doc.options.version) === '1.0') { - if (suffix[0] === '^') { - doc.warnings.push(new PlainValue.YAMLWarning(node, 'YAML 1.0 ^ tag expansion is not supported')); - return suffix; - } - - if (/[:/]/.test(suffix)) { - // word/foo -> tag:word.yaml.org,2002:foo - const vocab = suffix.match(/^([a-z0-9-]+)\/(.*)/i); - return vocab ? `tag:${vocab[1]}.yaml.org,2002:${vocab[2]}` : `tag:${suffix}`; - } - } - - return prefix.prefix + decodeURIComponent(suffix); -} - -function resolveTagName(doc, node) { - const { - tag, - type - } = node; - let nonSpecific = false; - - if (tag) { - const { - handle, - suffix, - verbatim - } = tag; - - if (verbatim) { - if (verbatim !== '!' && verbatim !== '!!') return verbatim; - const msg = `Verbatim tags aren't resolved, so ${verbatim} is invalid.`; - doc.errors.push(new PlainValue.YAMLSemanticError(node, msg)); - } else if (handle === '!' && !suffix) { - nonSpecific = true; - } else { - try { - return resolveTagHandle(doc, node); - } catch (error) { - doc.errors.push(error); - } - } - } - - switch (type) { - case PlainValue.Type.BLOCK_FOLDED: - case PlainValue.Type.BLOCK_LITERAL: - case PlainValue.Type.QUOTE_DOUBLE: - case PlainValue.Type.QUOTE_SINGLE: - return PlainValue.defaultTags.STR; - - case PlainValue.Type.FLOW_MAP: - case PlainValue.Type.MAP: - return PlainValue.defaultTags.MAP; - - case PlainValue.Type.FLOW_SEQ: - case PlainValue.Type.SEQ: - return PlainValue.defaultTags.SEQ; - - case PlainValue.Type.PLAIN: - return nonSpecific ? PlainValue.defaultTags.STR : null; - - default: - return null; - } -} - -function resolveByTagName(doc, node, tagName) { - const { - tags - } = doc.schema; - const matchWithTest = []; - - for (const tag of tags) { - if (tag.tag === tagName) { - if (tag.test) matchWithTest.push(tag);else { - const res = tag.resolve(doc, node); - return res instanceof Collection ? res : new Scalar(res); - } - } - } - - const str = resolveString(doc, node); - if (typeof str === 'string' && matchWithTest.length > 0) return resolveScalar(str, matchWithTest, tags.scalarFallback); - return null; -} - -function getFallbackTagName({ - type -}) { - switch (type) { - case PlainValue.Type.FLOW_MAP: - case PlainValue.Type.MAP: - return PlainValue.defaultTags.MAP; - - case PlainValue.Type.FLOW_SEQ: - case PlainValue.Type.SEQ: - return PlainValue.defaultTags.SEQ; - - default: - return PlainValue.defaultTags.STR; - } -} - -function resolveTag(doc, node, tagName) { - try { - const res = resolveByTagName(doc, node, tagName); - - if (res) { - if (tagName && node.tag) res.tag = tagName; - return res; - } - } catch (error) { - /* istanbul ignore if */ - if (!error.source) error.source = node; - doc.errors.push(error); - return null; - } - - try { - const fallback = getFallbackTagName(node); - if (!fallback) throw new Error(`The tag ${tagName} is unavailable`); - const msg = `The tag ${tagName} is unavailable, falling back to ${fallback}`; - doc.warnings.push(new PlainValue.YAMLWarning(node, msg)); - const res = resolveByTagName(doc, node, fallback); - res.tag = tagName; - return res; - } catch (error) { - const refError = new PlainValue.YAMLReferenceError(node, error.message); - refError.stack = error.stack; - doc.errors.push(refError); - return null; - } -} - -const isCollectionItem = node => { - if (!node) return false; - const { - type - } = node; - return type === PlainValue.Type.MAP_KEY || type === PlainValue.Type.MAP_VALUE || type === PlainValue.Type.SEQ_ITEM; -}; - -function resolveNodeProps(errors, node) { - const comments = { - before: [], - after: [] - }; - let hasAnchor = false; - let hasTag = false; - const props = isCollectionItem(node.context.parent) ? node.context.parent.props.concat(node.props) : node.props; - - for (const { - start, - end - } of props) { - switch (node.context.src[start]) { - case PlainValue.Char.COMMENT: - { - if (!node.commentHasRequiredWhitespace(start)) { - const msg = 'Comments must be separated from other tokens by white space characters'; - errors.push(new PlainValue.YAMLSemanticError(node, msg)); - } - - const { - header, - valueRange - } = node; - const cc = valueRange && (start > valueRange.start || header && start > header.start) ? comments.after : comments.before; - cc.push(node.context.src.slice(start + 1, end)); - break; - } - // Actual anchor & tag resolution is handled by schema, here we just complain - - case PlainValue.Char.ANCHOR: - if (hasAnchor) { - const msg = 'A node can have at most one anchor'; - errors.push(new PlainValue.YAMLSemanticError(node, msg)); - } - - hasAnchor = true; - break; - - case PlainValue.Char.TAG: - if (hasTag) { - const msg = 'A node can have at most one tag'; - errors.push(new PlainValue.YAMLSemanticError(node, msg)); - } - - hasTag = true; - break; - } - } - - return { - comments, - hasAnchor, - hasTag - }; -} - -function resolveNodeValue(doc, node) { - const { - anchors, - errors, - schema - } = doc; - - if (node.type === PlainValue.Type.ALIAS) { - const name = node.rawValue; - const src = anchors.getNode(name); - - if (!src) { - const msg = `Aliased anchor not found: ${name}`; - errors.push(new PlainValue.YAMLReferenceError(node, msg)); - return null; - } // Lazy resolution for circular references - - - const res = new Alias(src); - - anchors._cstAliases.push(res); - - return res; - } - - const tagName = resolveTagName(doc, node); - if (tagName) return resolveTag(doc, node, tagName); - - if (node.type !== PlainValue.Type.PLAIN) { - const msg = `Failed to resolve ${node.type} node here`; - errors.push(new PlainValue.YAMLSyntaxError(node, msg)); - return null; - } - - try { - const str = resolveString(doc, node); - return resolveScalar(str, schema.tags, schema.tags.scalarFallback); - } catch (error) { - if (!error.source) error.source = node; - errors.push(error); - return null; - } -} // sets node.resolved on success - - -function resolveNode(doc, node) { - if (!node) return null; - if (node.error) doc.errors.push(node.error); - const { - comments, - hasAnchor, - hasTag - } = resolveNodeProps(doc.errors, node); - - if (hasAnchor) { - const { - anchors - } = doc; - const name = node.anchor; - const prev = anchors.getNode(name); // At this point, aliases for any preceding node with the same anchor - // name have already been resolved, so it may safely be renamed. - - if (prev) anchors.map[anchors.newName(name)] = prev; // During parsing, we need to store the CST node in anchors.map as - // anchors need to be available during resolution to allow for - // circular references. - - anchors.map[name] = node; - } - - if (node.type === PlainValue.Type.ALIAS && (hasAnchor || hasTag)) { - const msg = 'An alias node must not specify any properties'; - doc.errors.push(new PlainValue.YAMLSemanticError(node, msg)); - } - - const res = resolveNodeValue(doc, node); - - if (res) { - res.range = [node.range.start, node.range.end]; - if (doc.options.keepCstNodes) res.cstNode = node; - if (doc.options.keepNodeTypes) res.type = node.type; - const cb = comments.before.join('\n'); - - if (cb) { - res.commentBefore = res.commentBefore ? `${res.commentBefore}\n${cb}` : cb; - } - - const ca = comments.after.join('\n'); - if (ca) res.comment = res.comment ? `${res.comment}\n${ca}` : ca; - } - - return node.resolved = res; -} - -function resolveMap(doc, cst) { - if (cst.type !== PlainValue.Type.MAP && cst.type !== PlainValue.Type.FLOW_MAP) { - const msg = `A ${cst.type} node cannot be resolved as a mapping`; - doc.errors.push(new PlainValue.YAMLSyntaxError(cst, msg)); - return null; - } - - const { - comments, - items - } = cst.type === PlainValue.Type.FLOW_MAP ? resolveFlowMapItems(doc, cst) : resolveBlockMapItems(doc, cst); - const map = new YAMLMap(); - map.items = items; - resolveComments(map, comments); - let hasCollectionKey = false; - - for (let i = 0; i < items.length; ++i) { - const { - key: iKey - } = items[i]; - if (iKey instanceof Collection) hasCollectionKey = true; - - if (doc.schema.merge && iKey && iKey.value === MERGE_KEY) { - items[i] = new Merge(items[i]); - const sources = items[i].value.items; - let error = null; - sources.some(node => { - if (node instanceof Alias) { - // During parsing, alias sources are CST nodes; to account for - // circular references their resolved values can't be used here. - const { - type - } = node.source; - if (type === PlainValue.Type.MAP || type === PlainValue.Type.FLOW_MAP) return false; - return error = 'Merge nodes aliases can only point to maps'; - } - - return error = 'Merge nodes can only have Alias nodes as values'; - }); - if (error) doc.errors.push(new PlainValue.YAMLSemanticError(cst, error)); - } else { - for (let j = i + 1; j < items.length; ++j) { - const { - key: jKey - } = items[j]; - - if (iKey === jKey || iKey && jKey && Object.prototype.hasOwnProperty.call(iKey, 'value') && iKey.value === jKey.value) { - const msg = `Map keys must be unique; "${iKey}" is repeated`; - doc.errors.push(new PlainValue.YAMLSemanticError(cst, msg)); - break; - } - } - } - } - - if (hasCollectionKey && !doc.options.mapAsMap) { - const warn = 'Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.'; - doc.warnings.push(new PlainValue.YAMLWarning(cst, warn)); - } - - cst.resolved = map; - return map; -} - -const valueHasPairComment = ({ - context: { - lineStart, - node, - src - }, - props -}) => { - if (props.length === 0) return false; - const { - start - } = props[0]; - if (node && start > node.valueRange.start) return false; - if (src[start] !== PlainValue.Char.COMMENT) return false; - - for (let i = lineStart; i < start; ++i) if (src[i] === '\n') return false; - - return true; -}; - -function resolvePairComment(item, pair) { - if (!valueHasPairComment(item)) return; - const comment = item.getPropValue(0, PlainValue.Char.COMMENT, true); - let found = false; - const cb = pair.value.commentBefore; - - if (cb && cb.startsWith(comment)) { - pair.value.commentBefore = cb.substr(comment.length + 1); - found = true; - } else { - const cc = pair.value.comment; - - if (!item.node && cc && cc.startsWith(comment)) { - pair.value.comment = cc.substr(comment.length + 1); - found = true; - } - } - - if (found) pair.comment = comment; -} - -function resolveBlockMapItems(doc, cst) { - const comments = []; - const items = []; - let key = undefined; - let keyStart = null; - - for (let i = 0; i < cst.items.length; ++i) { - const item = cst.items[i]; - - switch (item.type) { - case PlainValue.Type.BLANK_LINE: - comments.push({ - afterKey: !!key, - before: items.length - }); - break; - - case PlainValue.Type.COMMENT: - comments.push({ - afterKey: !!key, - before: items.length, - comment: item.comment - }); - break; - - case PlainValue.Type.MAP_KEY: - if (key !== undefined) items.push(new Pair(key)); - if (item.error) doc.errors.push(item.error); - key = resolveNode(doc, item.node); - keyStart = null; - break; - - case PlainValue.Type.MAP_VALUE: - { - if (key === undefined) key = null; - if (item.error) doc.errors.push(item.error); - - if (!item.context.atLineStart && item.node && item.node.type === PlainValue.Type.MAP && !item.node.context.atLineStart) { - const msg = 'Nested mappings are not allowed in compact mappings'; - doc.errors.push(new PlainValue.YAMLSemanticError(item.node, msg)); - } - - let valueNode = item.node; - - if (!valueNode && item.props.length > 0) { - // Comments on an empty mapping value need to be preserved, so we - // need to construct a minimal empty node here to use instead of the - // missing `item.node`. -- eemeli/yaml#19 - valueNode = new PlainValue.PlainValue(PlainValue.Type.PLAIN, []); - valueNode.context = { - parent: item, - src: item.context.src - }; - const pos = item.range.start + 1; - valueNode.range = { - start: pos, - end: pos - }; - valueNode.valueRange = { - start: pos, - end: pos - }; - - if (typeof item.range.origStart === 'number') { - const origPos = item.range.origStart + 1; - valueNode.range.origStart = valueNode.range.origEnd = origPos; - valueNode.valueRange.origStart = valueNode.valueRange.origEnd = origPos; - } - } - - const pair = new Pair(key, resolveNode(doc, valueNode)); - resolvePairComment(item, pair); - items.push(pair); - - if (key && typeof keyStart === 'number') { - if (item.range.start > keyStart + 1024) doc.errors.push(getLongKeyError(cst, key)); - } - - key = undefined; - keyStart = null; - } - break; - - default: - if (key !== undefined) items.push(new Pair(key)); - key = resolveNode(doc, item); - keyStart = item.range.start; - if (item.error) doc.errors.push(item.error); - - next: for (let j = i + 1;; ++j) { - const nextItem = cst.items[j]; - - switch (nextItem && nextItem.type) { - case PlainValue.Type.BLANK_LINE: - case PlainValue.Type.COMMENT: - continue next; - - case PlainValue.Type.MAP_VALUE: - break next; - - default: - { - const msg = 'Implicit map keys need to be followed by map values'; - doc.errors.push(new PlainValue.YAMLSemanticError(item, msg)); - break next; - } - } - } - - if (item.valueRangeContainsNewline) { - const msg = 'Implicit map keys need to be on a single line'; - doc.errors.push(new PlainValue.YAMLSemanticError(item, msg)); - } - - } - } - - if (key !== undefined) items.push(new Pair(key)); - return { - comments, - items - }; -} - -function resolveFlowMapItems(doc, cst) { - const comments = []; - const items = []; - let key = undefined; - let explicitKey = false; - let next = '{'; - - for (let i = 0; i < cst.items.length; ++i) { - const item = cst.items[i]; - - if (typeof item.char === 'string') { - const { - char, - offset - } = item; - - if (char === '?' && key === undefined && !explicitKey) { - explicitKey = true; - next = ':'; - continue; - } - - if (char === ':') { - if (key === undefined) key = null; - - if (next === ':') { - next = ','; - continue; - } - } else { - if (explicitKey) { - if (key === undefined && char !== ',') key = null; - explicitKey = false; - } - - if (key !== undefined) { - items.push(new Pair(key)); - key = undefined; - - if (char === ',') { - next = ':'; - continue; - } - } - } - - if (char === '}') { - if (i === cst.items.length - 1) continue; - } else if (char === next) { - next = ':'; - continue; - } - - const msg = `Flow map contains an unexpected ${char}`; - const err = new PlainValue.YAMLSyntaxError(cst, msg); - err.offset = offset; - doc.errors.push(err); - } else if (item.type === PlainValue.Type.BLANK_LINE) { - comments.push({ - afterKey: !!key, - before: items.length - }); - } else if (item.type === PlainValue.Type.COMMENT) { - checkFlowCommentSpace(doc.errors, item); - comments.push({ - afterKey: !!key, - before: items.length, - comment: item.comment - }); - } else if (key === undefined) { - if (next === ',') doc.errors.push(new PlainValue.YAMLSemanticError(item, 'Separator , missing in flow map')); - key = resolveNode(doc, item); - } else { - if (next !== ',') doc.errors.push(new PlainValue.YAMLSemanticError(item, 'Indicator : missing in flow map entry')); - items.push(new Pair(key, resolveNode(doc, item))); - key = undefined; - explicitKey = false; - } - } - - checkFlowCollectionEnd(doc.errors, cst); - if (key !== undefined) items.push(new Pair(key)); - return { - comments, - items - }; -} - -function resolveSeq(doc, cst) { - if (cst.type !== PlainValue.Type.SEQ && cst.type !== PlainValue.Type.FLOW_SEQ) { - const msg = `A ${cst.type} node cannot be resolved as a sequence`; - doc.errors.push(new PlainValue.YAMLSyntaxError(cst, msg)); - return null; - } - - const { - comments, - items - } = cst.type === PlainValue.Type.FLOW_SEQ ? resolveFlowSeqItems(doc, cst) : resolveBlockSeqItems(doc, cst); - const seq = new YAMLSeq(); - seq.items = items; - resolveComments(seq, comments); - - if (!doc.options.mapAsMap && items.some(it => it instanceof Pair && it.key instanceof Collection)) { - const warn = 'Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.'; - doc.warnings.push(new PlainValue.YAMLWarning(cst, warn)); - } - - cst.resolved = seq; - return seq; -} - -function resolveBlockSeqItems(doc, cst) { - const comments = []; - const items = []; - - for (let i = 0; i < cst.items.length; ++i) { - const item = cst.items[i]; - - switch (item.type) { - case PlainValue.Type.BLANK_LINE: - comments.push({ - before: items.length - }); - break; - - case PlainValue.Type.COMMENT: - comments.push({ - comment: item.comment, - before: items.length - }); - break; - - case PlainValue.Type.SEQ_ITEM: - if (item.error) doc.errors.push(item.error); - items.push(resolveNode(doc, item.node)); - - if (item.hasProps) { - const msg = 'Sequence items cannot have tags or anchors before the - indicator'; - doc.errors.push(new PlainValue.YAMLSemanticError(item, msg)); - } - - break; - - default: - if (item.error) doc.errors.push(item.error); - doc.errors.push(new PlainValue.YAMLSyntaxError(item, `Unexpected ${item.type} node in sequence`)); - } - } - - return { - comments, - items - }; -} - -function resolveFlowSeqItems(doc, cst) { - const comments = []; - const items = []; - let explicitKey = false; - let key = undefined; - let keyStart = null; - let next = '['; - let prevItem = null; - - for (let i = 0; i < cst.items.length; ++i) { - const item = cst.items[i]; - - if (typeof item.char === 'string') { - const { - char, - offset - } = item; - - if (char !== ':' && (explicitKey || key !== undefined)) { - if (explicitKey && key === undefined) key = next ? items.pop() : null; - items.push(new Pair(key)); - explicitKey = false; - key = undefined; - keyStart = null; - } - - if (char === next) { - next = null; - } else if (!next && char === '?') { - explicitKey = true; - } else if (next !== '[' && char === ':' && key === undefined) { - if (next === ',') { - key = items.pop(); - - if (key instanceof Pair) { - const msg = 'Chaining flow sequence pairs is invalid'; - const err = new PlainValue.YAMLSemanticError(cst, msg); - err.offset = offset; - doc.errors.push(err); - } - - if (!explicitKey && typeof keyStart === 'number') { - const keyEnd = item.range ? item.range.start : item.offset; - if (keyEnd > keyStart + 1024) doc.errors.push(getLongKeyError(cst, key)); - const { - src - } = prevItem.context; - - for (let i = keyStart; i < keyEnd; ++i) if (src[i] === '\n') { - const msg = 'Implicit keys of flow sequence pairs need to be on a single line'; - doc.errors.push(new PlainValue.YAMLSemanticError(prevItem, msg)); - break; - } - } - } else { - key = null; - } - - keyStart = null; - explicitKey = false; - next = null; - } else if (next === '[' || char !== ']' || i < cst.items.length - 1) { - const msg = `Flow sequence contains an unexpected ${char}`; - const err = new PlainValue.YAMLSyntaxError(cst, msg); - err.offset = offset; - doc.errors.push(err); - } - } else if (item.type === PlainValue.Type.BLANK_LINE) { - comments.push({ - before: items.length - }); - } else if (item.type === PlainValue.Type.COMMENT) { - checkFlowCommentSpace(doc.errors, item); - comments.push({ - comment: item.comment, - before: items.length - }); - } else { - if (next) { - const msg = `Expected a ${next} in flow sequence`; - doc.errors.push(new PlainValue.YAMLSemanticError(item, msg)); - } - - const value = resolveNode(doc, item); - - if (key === undefined) { - items.push(value); - prevItem = item; - } else { - items.push(new Pair(key, value)); - key = undefined; - } - - keyStart = item.range.start; - next = ','; - } - } - - checkFlowCollectionEnd(doc.errors, cst); - if (key !== undefined) items.push(new Pair(key)); - return { - comments, - items - }; -} - -exports.Alias = Alias; -exports.Collection = Collection; -exports.Merge = Merge; -exports.Node = Node; -exports.Pair = Pair; -exports.Scalar = Scalar; -exports.YAMLMap = YAMLMap; -exports.YAMLSeq = YAMLSeq; -exports.addComment = addComment; -exports.binaryOptions = binaryOptions; -exports.boolOptions = boolOptions; -exports.findPair = findPair; -exports.intOptions = intOptions; -exports.isEmptyPath = isEmptyPath; -exports.nullOptions = nullOptions; -exports.resolveMap = resolveMap; -exports.resolveNode = resolveNode; -exports.resolveSeq = resolveSeq; -exports.resolveString = resolveString; -exports.strOptions = strOptions; -exports.stringifyNumber = stringifyNumber; -exports.stringifyString = stringifyString; -exports.toJSON = toJSON; diff --git a/node_modules/yaml/dist/test-events.js b/node_modules/yaml/dist/test-events.js deleted file mode 100644 index 2b856e186..000000000 --- a/node_modules/yaml/dist/test-events.js +++ /dev/null @@ -1,162 +0,0 @@ -'use strict'; - -var parseCst = require('./parse-cst.js'); -var Document = require('./Document-9b4560a1.js'); -require('./PlainValue-ec8e588e.js'); -require('./resolveSeq-d03cb037.js'); -require('./Schema-88e323a7.js'); -require('./warnings-1000a372.js'); - -function testEvents(src, options) { - const opt = Object.assign({ - keepCstNodes: true, - keepNodeTypes: true, - version: '1.2' - }, options); - const docs = parseCst.parse(src).map(cstDoc => new Document.Document(opt).parse(cstDoc)); - const errDoc = docs.find(doc => doc.errors.length > 0); - const error = errDoc ? errDoc.errors[0].message : null; - const events = ['+STR']; - - try { - for (let i = 0; i < docs.length; ++i) { - const doc = docs[i]; - let root = doc.contents; - if (Array.isArray(root)) root = root[0]; - const [rootStart, rootEnd] = doc.range || [0, 0]; - let e = doc.errors[0] && doc.errors[0].source; - if (e && e.type === 'SEQ_ITEM') e = e.node; - if (e && (e.type === 'DOCUMENT' || e.range.start < rootStart)) throw new Error(); - let docStart = '+DOC'; - const pre = src.slice(0, rootStart); - const explicitDoc = /---\s*$/.test(pre); - if (explicitDoc) docStart += ' ---';else if (!doc.contents) continue; - events.push(docStart); - addEvents(events, doc, e, root); - if (doc.contents && doc.contents.length > 1) throw new Error(); - let docEnd = '-DOC'; - - if (rootEnd) { - const post = src.slice(rootEnd); - if (/^\.\.\./.test(post)) docEnd += ' ...'; - } - - events.push(docEnd); - } - } catch (e) { - return { - events, - error: error || e - }; - } - - events.push('-STR'); - return { - events, - error - }; -} - -function addEvents(events, doc, e, node) { - if (!node) { - events.push('=VAL :'); - return; - } - - if (e && node.cstNode === e) throw new Error(); - let props = ''; - let anchor = doc.anchors.getName(node); - - if (anchor) { - if (/\d$/.test(anchor)) { - const alt = anchor.replace(/\d$/, ''); - if (doc.anchors.getNode(alt)) anchor = alt; - } - - props = ` &${anchor}`; - } - - if (node.cstNode && node.cstNode.tag) { - const { - handle, - suffix - } = node.cstNode.tag; - props += handle === '!' && !suffix ? ' ' : ` <${node.tag}>`; - } - - let scalar = null; - - switch (node.type) { - case 'ALIAS': - { - let alias = doc.anchors.getName(node.source); - - if (/\d$/.test(alias)) { - const alt = alias.replace(/\d$/, ''); - if (doc.anchors.getNode(alt)) alias = alt; - } - - events.push(`=ALI${props} *${alias}`); - } - break; - - case 'BLOCK_FOLDED': - scalar = '>'; - break; - - case 'BLOCK_LITERAL': - scalar = '|'; - break; - - case 'PLAIN': - scalar = ':'; - break; - - case 'QUOTE_DOUBLE': - scalar = '"'; - break; - - case 'QUOTE_SINGLE': - scalar = "'"; - break; - - case 'PAIR': - events.push(`+MAP${props}`); - addEvents(events, doc, e, node.key); - addEvents(events, doc, e, node.value); - events.push('-MAP'); - break; - - case 'FLOW_SEQ': - case 'SEQ': - events.push(`+SEQ${props}`); - node.items.forEach(item => { - addEvents(events, doc, e, item); - }); - events.push('-SEQ'); - break; - - case 'FLOW_MAP': - case 'MAP': - events.push(`+MAP${props}`); - node.items.forEach(({ - key, - value - }) => { - addEvents(events, doc, e, key); - addEvents(events, doc, e, value); - }); - events.push('-MAP'); - break; - - default: - throw new Error(`Unexpected node type ${node.type}`); - } - - if (scalar) { - const value = node.cstNode.strValue.replace(/\\/g, '\\\\').replace(/\0/g, '\\0').replace(/\x07/g, '\\a').replace(/\x08/g, '\\b').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\v/g, '\\v').replace(/\f/g, '\\f').replace(/\r/g, '\\r').replace(/\x1b/g, '\\e'); - events.push(`=VAL${props} ${scalar}${value}`); - } -} - -exports.testEvents = testEvents; diff --git a/node_modules/yaml/dist/types.js b/node_modules/yaml/dist/types.js deleted file mode 100644 index 967c04e09..000000000 --- a/node_modules/yaml/dist/types.js +++ /dev/null @@ -1,23 +0,0 @@ -'use strict'; - -var resolveSeq = require('./resolveSeq-d03cb037.js'); -var Schema = require('./Schema-88e323a7.js'); -require('./PlainValue-ec8e588e.js'); -require('./warnings-1000a372.js'); - - - -exports.Alias = resolveSeq.Alias; -exports.Collection = resolveSeq.Collection; -exports.Merge = resolveSeq.Merge; -exports.Node = resolveSeq.Node; -exports.Pair = resolveSeq.Pair; -exports.Scalar = resolveSeq.Scalar; -exports.YAMLMap = resolveSeq.YAMLMap; -exports.YAMLSeq = resolveSeq.YAMLSeq; -exports.binaryOptions = resolveSeq.binaryOptions; -exports.boolOptions = resolveSeq.boolOptions; -exports.intOptions = resolveSeq.intOptions; -exports.nullOptions = resolveSeq.nullOptions; -exports.strOptions = resolveSeq.strOptions; -exports.Schema = Schema.Schema; diff --git a/node_modules/yaml/dist/util.js b/node_modules/yaml/dist/util.js deleted file mode 100644 index bc1e079ac..000000000 --- a/node_modules/yaml/dist/util.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; - -var resolveSeq = require('./resolveSeq-d03cb037.js'); -var PlainValue = require('./PlainValue-ec8e588e.js'); - - - -exports.findPair = resolveSeq.findPair; -exports.parseMap = resolveSeq.resolveMap; -exports.parseSeq = resolveSeq.resolveSeq; -exports.stringifyNumber = resolveSeq.stringifyNumber; -exports.stringifyString = resolveSeq.stringifyString; -exports.toJSON = resolveSeq.toJSON; -exports.Type = PlainValue.Type; -exports.YAMLError = PlainValue.YAMLError; -exports.YAMLReferenceError = PlainValue.YAMLReferenceError; -exports.YAMLSemanticError = PlainValue.YAMLSemanticError; -exports.YAMLSyntaxError = PlainValue.YAMLSyntaxError; -exports.YAMLWarning = PlainValue.YAMLWarning; diff --git a/node_modules/yaml/dist/warnings-1000a372.js b/node_modules/yaml/dist/warnings-1000a372.js deleted file mode 100644 index 7776d9fc2..000000000 --- a/node_modules/yaml/dist/warnings-1000a372.js +++ /dev/null @@ -1,416 +0,0 @@ -'use strict'; - -var PlainValue = require('./PlainValue-ec8e588e.js'); -var resolveSeq = require('./resolveSeq-d03cb037.js'); - -/* global atob, btoa, Buffer */ -const binary = { - identify: value => value instanceof Uint8Array, - // Buffer inherits from Uint8Array - default: false, - tag: 'tag:yaml.org,2002:binary', - - /** - * Returns a Buffer in node and an Uint8Array in browsers - * - * To use the resulting buffer as an image, you'll want to do something like: - * - * const blob = new Blob([buffer], { type: 'image/jpeg' }) - * document.querySelector('#photo').src = URL.createObjectURL(blob) - */ - resolve: (doc, node) => { - const src = resolveSeq.resolveString(doc, node); - - if (typeof Buffer === 'function') { - return Buffer.from(src, 'base64'); - } else if (typeof atob === 'function') { - // On IE 11, atob() can't handle newlines - const str = atob(src.replace(/[\n\r]/g, '')); - const buffer = new Uint8Array(str.length); - - for (let i = 0; i < str.length; ++i) buffer[i] = str.charCodeAt(i); - - return buffer; - } else { - const msg = 'This environment does not support reading binary tags; either Buffer or atob is required'; - doc.errors.push(new PlainValue.YAMLReferenceError(node, msg)); - return null; - } - }, - options: resolveSeq.binaryOptions, - stringify: ({ - comment, - type, - value - }, ctx, onComment, onChompKeep) => { - let src; - - if (typeof Buffer === 'function') { - src = value instanceof Buffer ? value.toString('base64') : Buffer.from(value.buffer).toString('base64'); - } else if (typeof btoa === 'function') { - let s = ''; - - for (let i = 0; i < value.length; ++i) s += String.fromCharCode(value[i]); - - src = btoa(s); - } else { - throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required'); - } - - if (!type) type = resolveSeq.binaryOptions.defaultType; - - if (type === PlainValue.Type.QUOTE_DOUBLE) { - value = src; - } else { - const { - lineWidth - } = resolveSeq.binaryOptions; - const n = Math.ceil(src.length / lineWidth); - const lines = new Array(n); - - for (let i = 0, o = 0; i < n; ++i, o += lineWidth) { - lines[i] = src.substr(o, lineWidth); - } - - value = lines.join(type === PlainValue.Type.BLOCK_LITERAL ? '\n' : ' '); - } - - return resolveSeq.stringifyString({ - comment, - type, - value - }, ctx, onComment, onChompKeep); - } -}; - -function parsePairs(doc, cst) { - const seq = resolveSeq.resolveSeq(doc, cst); - - for (let i = 0; i < seq.items.length; ++i) { - let item = seq.items[i]; - if (item instanceof resolveSeq.Pair) continue;else if (item instanceof resolveSeq.YAMLMap) { - if (item.items.length > 1) { - const msg = 'Each pair must have its own sequence indicator'; - throw new PlainValue.YAMLSemanticError(cst, msg); - } - - const pair = item.items[0] || new resolveSeq.Pair(); - if (item.commentBefore) pair.commentBefore = pair.commentBefore ? `${item.commentBefore}\n${pair.commentBefore}` : item.commentBefore; - if (item.comment) pair.comment = pair.comment ? `${item.comment}\n${pair.comment}` : item.comment; - item = pair; - } - seq.items[i] = item instanceof resolveSeq.Pair ? item : new resolveSeq.Pair(item); - } - - return seq; -} -function createPairs(schema, iterable, ctx) { - const pairs = new resolveSeq.YAMLSeq(schema); - pairs.tag = 'tag:yaml.org,2002:pairs'; - - for (const it of iterable) { - let key, value; - - if (Array.isArray(it)) { - if (it.length === 2) { - key = it[0]; - value = it[1]; - } else throw new TypeError(`Expected [key, value] tuple: ${it}`); - } else if (it && it instanceof Object) { - const keys = Object.keys(it); - - if (keys.length === 1) { - key = keys[0]; - value = it[key]; - } else throw new TypeError(`Expected { key: value } tuple: ${it}`); - } else { - key = it; - } - - const pair = schema.createPair(key, value, ctx); - pairs.items.push(pair); - } - - return pairs; -} -const pairs = { - default: false, - tag: 'tag:yaml.org,2002:pairs', - resolve: parsePairs, - createNode: createPairs -}; - -class YAMLOMap extends resolveSeq.YAMLSeq { - constructor() { - super(); - - PlainValue._defineProperty(this, "add", resolveSeq.YAMLMap.prototype.add.bind(this)); - - PlainValue._defineProperty(this, "delete", resolveSeq.YAMLMap.prototype.delete.bind(this)); - - PlainValue._defineProperty(this, "get", resolveSeq.YAMLMap.prototype.get.bind(this)); - - PlainValue._defineProperty(this, "has", resolveSeq.YAMLMap.prototype.has.bind(this)); - - PlainValue._defineProperty(this, "set", resolveSeq.YAMLMap.prototype.set.bind(this)); - - this.tag = YAMLOMap.tag; - } - - toJSON(_, ctx) { - const map = new Map(); - if (ctx && ctx.onCreate) ctx.onCreate(map); - - for (const pair of this.items) { - let key, value; - - if (pair instanceof resolveSeq.Pair) { - key = resolveSeq.toJSON(pair.key, '', ctx); - value = resolveSeq.toJSON(pair.value, key, ctx); - } else { - key = resolveSeq.toJSON(pair, '', ctx); - } - - if (map.has(key)) throw new Error('Ordered maps must not include duplicate keys'); - map.set(key, value); - } - - return map; - } - -} - -PlainValue._defineProperty(YAMLOMap, "tag", 'tag:yaml.org,2002:omap'); - -function parseOMap(doc, cst) { - const pairs = parsePairs(doc, cst); - const seenKeys = []; - - for (const { - key - } of pairs.items) { - if (key instanceof resolveSeq.Scalar) { - if (seenKeys.includes(key.value)) { - const msg = 'Ordered maps must not include duplicate keys'; - throw new PlainValue.YAMLSemanticError(cst, msg); - } else { - seenKeys.push(key.value); - } - } - } - - return Object.assign(new YAMLOMap(), pairs); -} - -function createOMap(schema, iterable, ctx) { - const pairs = createPairs(schema, iterable, ctx); - const omap = new YAMLOMap(); - omap.items = pairs.items; - return omap; -} - -const omap = { - identify: value => value instanceof Map, - nodeClass: YAMLOMap, - default: false, - tag: 'tag:yaml.org,2002:omap', - resolve: parseOMap, - createNode: createOMap -}; - -class YAMLSet extends resolveSeq.YAMLMap { - constructor() { - super(); - this.tag = YAMLSet.tag; - } - - add(key) { - const pair = key instanceof resolveSeq.Pair ? key : new resolveSeq.Pair(key); - const prev = resolveSeq.findPair(this.items, pair.key); - if (!prev) this.items.push(pair); - } - - get(key, keepPair) { - const pair = resolveSeq.findPair(this.items, key); - return !keepPair && pair instanceof resolveSeq.Pair ? pair.key instanceof resolveSeq.Scalar ? pair.key.value : pair.key : pair; - } - - set(key, value) { - if (typeof value !== 'boolean') throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`); - const prev = resolveSeq.findPair(this.items, key); - - if (prev && !value) { - this.items.splice(this.items.indexOf(prev), 1); - } else if (!prev && value) { - this.items.push(new resolveSeq.Pair(key)); - } - } - - toJSON(_, ctx) { - return super.toJSON(_, ctx, Set); - } - - toString(ctx, onComment, onChompKeep) { - if (!ctx) return JSON.stringify(this); - if (this.hasAllNullValues()) return super.toString(ctx, onComment, onChompKeep);else throw new Error('Set items must all have null values'); - } - -} - -PlainValue._defineProperty(YAMLSet, "tag", 'tag:yaml.org,2002:set'); - -function parseSet(doc, cst) { - const map = resolveSeq.resolveMap(doc, cst); - if (!map.hasAllNullValues()) throw new PlainValue.YAMLSemanticError(cst, 'Set items must all have null values'); - return Object.assign(new YAMLSet(), map); -} - -function createSet(schema, iterable, ctx) { - const set = new YAMLSet(); - - for (const value of iterable) set.items.push(schema.createPair(value, null, ctx)); - - return set; -} - -const set = { - identify: value => value instanceof Set, - nodeClass: YAMLSet, - default: false, - tag: 'tag:yaml.org,2002:set', - resolve: parseSet, - createNode: createSet -}; - -const parseSexagesimal = (sign, parts) => { - const n = parts.split(':').reduce((n, p) => n * 60 + Number(p), 0); - return sign === '-' ? -n : n; -}; // hhhh:mm:ss.sss - - -const stringifySexagesimal = ({ - value -}) => { - if (isNaN(value) || !isFinite(value)) return resolveSeq.stringifyNumber(value); - let sign = ''; - - if (value < 0) { - sign = '-'; - value = Math.abs(value); - } - - const parts = [value % 60]; // seconds, including ms - - if (value < 60) { - parts.unshift(0); // at least one : is required - } else { - value = Math.round((value - parts[0]) / 60); - parts.unshift(value % 60); // minutes - - if (value >= 60) { - value = Math.round((value - parts[0]) / 60); - parts.unshift(value); // hours - } - } - - return sign + parts.map(n => n < 10 ? '0' + String(n) : String(n)).join(':').replace(/000000\d*$/, '') // % 60 may introduce error - ; -}; - -const intTime = { - identify: value => typeof value === 'number', - default: true, - tag: 'tag:yaml.org,2002:int', - format: 'TIME', - test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+)$/, - resolve: (str, sign, parts) => parseSexagesimal(sign, parts.replace(/_/g, '')), - stringify: stringifySexagesimal -}; -const floatTime = { - identify: value => typeof value === 'number', - default: true, - tag: 'tag:yaml.org,2002:float', - format: 'TIME', - test: /^([-+]?)([0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*)$/, - resolve: (str, sign, parts) => parseSexagesimal(sign, parts.replace(/_/g, '')), - stringify: stringifySexagesimal -}; -const timestamp = { - identify: value => value instanceof Date, - default: true, - tag: 'tag:yaml.org,2002:timestamp', - // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part - // may be omitted altogether, resulting in a date format. In such a case, the time part is - // assumed to be 00:00:00Z (start of day, UTC). - test: RegExp('^(?:' + '([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})' + // YYYY-Mm-Dd - '(?:(?:t|T|[ \\t]+)' + // t | T | whitespace - '([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)' + // Hh:Mm:Ss(.ss)? - '(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?' + // Z | +5 | -03:30 - ')?' + ')$'), - resolve: (str, year, month, day, hour, minute, second, millisec, tz) => { - if (millisec) millisec = (millisec + '00').substr(1, 3); - let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec || 0); - - if (tz && tz !== 'Z') { - let d = parseSexagesimal(tz[0], tz.slice(1)); - if (Math.abs(d) < 30) d *= 60; - date -= 60000 * d; - } - - return new Date(date); - }, - stringify: ({ - value - }) => value.toISOString().replace(/((T00:00)?:00)?\.000Z$/, '') -}; - -/* global console, process, YAML_SILENCE_DEPRECATION_WARNINGS, YAML_SILENCE_WARNINGS */ -function shouldWarn(deprecation) { - const env = typeof process !== 'undefined' && process.env || {}; - - if (deprecation) { - if (typeof YAML_SILENCE_DEPRECATION_WARNINGS !== 'undefined') return !YAML_SILENCE_DEPRECATION_WARNINGS; - return !env.YAML_SILENCE_DEPRECATION_WARNINGS; - } - - if (typeof YAML_SILENCE_WARNINGS !== 'undefined') return !YAML_SILENCE_WARNINGS; - return !env.YAML_SILENCE_WARNINGS; -} - -function warn(warning, type) { - if (shouldWarn(false)) { - const emit = typeof process !== 'undefined' && process.emitWarning; // This will throw in Jest if `warning` is an Error instance due to - // https://github.com/facebook/jest/issues/2549 - - if (emit) emit(warning, type);else { - // eslint-disable-next-line no-console - console.warn(type ? `${type}: ${warning}` : warning); - } - } -} -function warnFileDeprecation(filename) { - if (shouldWarn(true)) { - const path = filename.replace(/.*yaml[/\\]/i, '').replace(/\.js$/, '').replace(/\\/g, '/'); - warn(`The endpoint 'yaml/${path}' will be removed in a future release.`, 'DeprecationWarning'); - } -} -const warned = {}; -function warnOptionDeprecation(name, alternative) { - if (!warned[name] && shouldWarn(true)) { - warned[name] = true; - let msg = `The option '${name}' will be removed in a future release`; - msg += alternative ? `, use '${alternative}' instead.` : '.'; - warn(msg, 'DeprecationWarning'); - } -} - -exports.binary = binary; -exports.floatTime = floatTime; -exports.intTime = intTime; -exports.omap = omap; -exports.pairs = pairs; -exports.set = set; -exports.timestamp = timestamp; -exports.warn = warn; -exports.warnFileDeprecation = warnFileDeprecation; -exports.warnOptionDeprecation = warnOptionDeprecation; diff --git a/node_modules/yaml/index.d.ts b/node_modules/yaml/index.d.ts deleted file mode 100644 index 53eb011b8..000000000 --- a/node_modules/yaml/index.d.ts +++ /dev/null @@ -1,372 +0,0 @@ -import { CST } from './parse-cst' -import { - AST, - Alias, - Collection, - Merge, - Node, - Scalar, - Schema, - YAMLMap, - YAMLSeq -} from './types' -import { Type, YAMLError, YAMLWarning } from './util' - -export { AST, CST } -export { default as parseCST } from './parse-cst' - -/** - * `yaml` defines document-specific options in three places: as an argument of - * parse, create and stringify calls, in the values of `YAML.defaultOptions`, - * and in the version-dependent `YAML.Document.defaults` object. Values set in - * `YAML.defaultOptions` override version-dependent defaults, and argument - * options override both. - */ -export const defaultOptions: Options - -export interface Options extends Schema.Options { - /** - * Default prefix for anchors. - * - * Default: `'a'`, resulting in anchors `a1`, `a2`, etc. - */ - anchorPrefix?: string - /** - * The number of spaces to use when indenting code. - * - * Default: `2` - */ - indent?: number - /** - * Whether block sequences should be indented. - * - * Default: `true` - */ - indentSeq?: boolean - /** - * Allow non-JSON JavaScript objects to remain in the `toJSON` output. - * Relevant with the YAML 1.1 `!!timestamp` and `!!binary` tags as well as BigInts. - * - * Default: `true` - */ - keepBlobsInJSON?: boolean - /** - * Include references in the AST to each node's corresponding CST node. - * - * Default: `false` - */ - keepCstNodes?: boolean - /** - * Store the original node type when parsing documents. - * - * Default: `true` - */ - keepNodeTypes?: boolean - /** - * When outputting JS, use Map rather than Object to represent mappings. - * - * Default: `false` - */ - mapAsMap?: boolean - /** - * Prevent exponential entity expansion attacks by limiting data aliasing count; - * set to `-1` to disable checks; `0` disallows all alias nodes. - * - * Default: `100` - */ - maxAliasCount?: number - /** - * Include line position & node type directly in errors; drop their verbose source and context. - * - * Default: `false` - */ - prettyErrors?: boolean - /** - * When stringifying, require keys to be scalars and to use implicit rather than explicit notation. - * - * Default: `false` - */ - simpleKeys?: boolean - /** - * The YAML version used by documents without a `%YAML` directive. - * - * Default: `"1.2"` - */ - version?: '1.0' | '1.1' | '1.2' -} - -/** - * Some customization options are availabe to control the parsing and - * stringification of scalars. Note that these values are used by all documents. - */ -export const scalarOptions: { - binary: scalarOptions.Binary - bool: scalarOptions.Bool - int: scalarOptions.Int - null: scalarOptions.Null - str: scalarOptions.Str -} -export namespace scalarOptions { - interface Binary { - /** - * The type of string literal used to stringify `!!binary` values. - * - * Default: `'BLOCK_LITERAL'` - */ - defaultType: Scalar.Type - /** - * Maximum line width for `!!binary`. - * - * Default: `76` - */ - lineWidth: number - } - - interface Bool { - /** - * String representation for `true`. With the core schema, use `'true' | 'True' | 'TRUE'`. - * - * Default: `'true'` - */ - trueStr: string - /** - * String representation for `false`. With the core schema, use `'false' | 'False' | 'FALSE'`. - * - * Default: `'false'` - */ - falseStr: string - } - - interface Int { - /** - * Whether integers should be parsed into BigInt values. - * - * Default: `false` - */ - asBigInt: boolean - } - - interface Null { - /** - * String representation for `null`. With the core schema, use `'null' | 'Null' | 'NULL' | '~' | ''`. - * - * Default: `'null'` - */ - nullStr: string - } - - interface Str { - /** - * The default type of string literal used to stringify values - * - * Default: `'PLAIN'` - */ - defaultType: Scalar.Type - doubleQuoted: { - /** - * Whether to restrict double-quoted strings to use JSON-compatible syntax. - * - * Default: `false` - */ - jsonEncoding: boolean - /** - * Minimum length to use multiple lines to represent the value. - * - * Default: `40` - */ - minMultiLineLength: number - } - fold: { - /** - * Maximum line width (set to `0` to disable folding). - * - * Default: `80` - */ - lineWidth: number - /** - * Minimum width for highly-indented content. - * - * Default: `20` - */ - minContentWidth: number - } - } -} - -export class Document extends Collection { - cstNode?: CST.Document - constructor(options?: Options) - tag: never - directivesEndMarker?: boolean - type: Type.DOCUMENT - /** - * Anchors associated with the document's nodes; - * also provides alias & merge node creators. - */ - anchors: Document.Anchors - /** The document contents. */ - contents: any - /** Errors encountered during parsing. */ - errors: YAMLError[] - /** - * The schema used with the document. Use `setSchema()` to change or - * initialise. - */ - schema?: Schema - /** - * Array of prefixes; each will have a string `handle` that - * starts and ends with `!` and a string `prefix` that the handle will be replaced by. - */ - tagPrefixes: Document.TagPrefix[] - /** - * The parsed version of the source document; - * if true-ish, stringified output will include a `%YAML` directive. - */ - version?: string - /** Warnings encountered during parsing. */ - warnings: YAMLWarning[] - /** - * List the tags used in the document that are not in the default - * `tag:yaml.org,2002:` namespace. - */ - listNonDefaultTags(): string[] - /** Parse a CST into this document */ - parse(cst: CST.Document): this - /** - * When a document is created with `new YAML.Document()`, the schema object is - * not set as it may be influenced by parsed directives; call this with no - * arguments to set it manually, or with arguments to change the schema used - * by the document. - **/ - setSchema( - id?: Options['version'] | Schema.Name, - customTags?: (Schema.TagId | Schema.Tag)[] - ): void - /** Set `handle` as a shorthand string for the `prefix` tag namespace. */ - setTagPrefix(handle: string, prefix: string): void - /** - * A plain JavaScript representation of the document `contents`. - * - * @param arg Used by `JSON.stringify` to indicate the array index or property - * name. If its value is a `string` and the document `contents` has a scalar - * value, the `keepBlobsInJSON` option has no effect. - * @param onAnchor If defined, called with the resolved `value` and reference - * `count` for each anchor in the document. - * */ - toJSON(arg?: string, onAnchor?: (value: any, count: number) => void): any - /** A YAML representation of the document. */ - toString(): string -} - -export namespace Document { - interface Parsed extends Document { - contents: Scalar | YAMLMap | YAMLSeq | null - /** The schema used with the document. */ - schema: Schema - } - - interface Anchors { - /** - * Create a new `Alias` node, adding the required anchor for `node`. - * If `name` is empty, a new anchor name will be generated. - */ - createAlias(node: Node, name?: string): Alias - /** - * Create a new `Merge` node with the given source nodes. - * Non-`Alias` sources will be automatically wrapped. - */ - createMergePair(...nodes: Node[]): Merge - /** The anchor name associated with `node`, if set. */ - getName(node: Node): undefined | string - /** List of all defined anchor names. */ - getNames(): string[] - /** The node associated with the anchor `name`, if set. */ - getNode(name: string): undefined | Node - /** - * Find an available anchor name with the given `prefix` and a - * numerical suffix. - */ - newName(prefix: string): string - /** - * Associate an anchor with `node`. If `name` is empty, a new name will be generated. - * To remove an anchor, use `setAnchor(null, name)`. - */ - setAnchor(node: Node | null, name?: string): void | string - } - - interface TagPrefix { - handle: string - prefix: string - } -} - -/** - * Recursively turns objects into collections. Generic objects as well as `Map` - * and its descendants become mappings, while arrays and other iterable objects - * result in sequences. - * - * The primary purpose of this function is to enable attaching comments or other - * metadata to a value, or to otherwise exert more fine-grained control over the - * stringified output. To that end, you'll need to assign its return value to - * the `contents` of a Document (or somewhere within said contents), as the - * document's schema is required for YAML string output. - * - * @param wrapScalars If undefined or `true`, also wraps plain values in - * `Scalar` objects; if `false` and `value` is not an object, it will be - * returned directly. - * @param tag Use to specify the collection type, e.g. `"!!omap"`. Note that - * this requires the corresponding tag to be available based on the default - * options. To use a specific document's schema, use `doc.schema.createNode`. - */ -export function createNode( - value: any, - wrapScalars?: true, - tag?: string -): YAMLMap | YAMLSeq | Scalar - -/** - * YAML.createNode recursively turns objects into Map and arrays to Seq collections. - * Its primary use is to enable attaching comments or other metadata to a value, - * or to otherwise exert more fine-grained control over the stringified output. - * - * Doesn't wrap plain values in Scalar objects. - */ -export function createNode( - value: any, - wrapScalars: false, - tag?: string -): YAMLMap | YAMLSeq | string | number | boolean | null - -/** - * Parse an input string into a single YAML.Document. - */ -export function parseDocument(str: string, options?: Options): Document.Parsed - -/** - * Parse the input as a stream of YAML documents. - * - * Documents should be separated from each other by `...` or `---` marker lines. - */ -export function parseAllDocuments( - str: string, - options?: Options -): Document.Parsed[] - -/** - * Parse an input string into JavaScript. - * - * Only supports input consisting of a single YAML document; for multi-document - * support you should use `YAML.parseAllDocuments`. May throw on error, and may - * log warnings using `console.warn`. - * - * @param str A string with YAML formatting. - * @returns The value will match the type of the root value of the parsed YAML - * document, so Maps become objects, Sequences arrays, and scalars result in - * nulls, booleans, numbers and strings. - */ -export function parse(str: string, options?: Options): any - -/** - * @returns Will always include \n as the last character, as is expected of YAML documents. - */ -export function stringify(value: any, options?: Options): string diff --git a/node_modules/yaml/index.js b/node_modules/yaml/index.js deleted file mode 100644 index b501ac4db..000000000 --- a/node_modules/yaml/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist').YAML diff --git a/node_modules/yaml/map.js b/node_modules/yaml/map.js deleted file mode 100644 index 78f2ebc74..000000000 --- a/node_modules/yaml/map.js +++ /dev/null @@ -1,2 +0,0 @@ -module.exports = require('./dist/types').YAMLMap -require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/node_modules/yaml/package.json b/node_modules/yaml/package.json deleted file mode 100644 index d91b0dd13..000000000 --- a/node_modules/yaml/package.json +++ /dev/null @@ -1,106 +0,0 @@ -{ - "name": "yaml", - "version": "1.10.2", - "license": "ISC", - "author": "Eemeli Aro ", - "repository": "github:eemeli/yaml", - "description": "JavaScript parser and stringifier for YAML", - "keywords": [ - "YAML", - "parser", - "stringifier" - ], - "homepage": "https://eemeli.org/yaml/v1/", - "files": [ - "browser/", - "dist/", - "types/", - "*.d.ts", - "*.js", - "*.mjs", - "!*config.js" - ], - "type": "commonjs", - "main": "./index.js", - "browser": { - "./index.js": "./browser/index.js", - "./map.js": "./browser/map.js", - "./pair.js": "./browser/pair.js", - "./parse-cst.js": "./browser/parse-cst.js", - "./scalar.js": "./browser/scalar.js", - "./schema.js": "./browser/schema.js", - "./seq.js": "./browser/seq.js", - "./types.js": "./browser/types.js", - "./types.mjs": "./browser/types.js", - "./types/binary.js": "./browser/types/binary.js", - "./types/omap.js": "./browser/types/omap.js", - "./types/pairs.js": "./browser/types/pairs.js", - "./types/set.js": "./browser/types/set.js", - "./types/timestamp.js": "./browser/types/timestamp.js", - "./util.js": "./browser/util.js", - "./util.mjs": "./browser/util.js" - }, - "exports": { - ".": "./index.js", - "./parse-cst": "./parse-cst.js", - "./types": [ - { - "import": "./types.mjs" - }, - "./types.js" - ], - "./util": [ - { - "import": "./util.mjs" - }, - "./util.js" - ], - "./": "./" - }, - "scripts": { - "build": "npm run build:node && npm run build:browser", - "build:browser": "rollup -c rollup.browser-config.js", - "build:node": "rollup -c rollup.node-config.js", - "clean": "git clean -fdxe node_modules", - "lint": "eslint src/", - "prettier": "prettier --write .", - "start": "cross-env TRACE_LEVEL=log npm run build:node && node -i -e 'YAML=require(\".\")'", - "test": "jest", - "test:browsers": "cd playground && npm test", - "test:dist": "npm run build:node && jest", - "test:types": "tsc --lib ES2017 --noEmit tests/typings.ts", - "docs:install": "cd docs-slate && bundle install", - "docs:deploy": "cd docs-slate && ./deploy.sh", - "docs": "cd docs-slate && bundle exec middleman server", - "preversion": "npm test && npm run build", - "prepublishOnly": "npm run clean && npm test && npm run build" - }, - "browserslist": "> 0.5%, not dead", - "prettier": { - "arrowParens": "avoid", - "semi": false, - "singleQuote": true, - "trailingComma": "none" - }, - "devDependencies": { - "@babel/core": "^7.12.10", - "@babel/plugin-proposal-class-properties": "^7.12.1", - "@babel/preset-env": "^7.12.11", - "@rollup/plugin-babel": "^5.2.3", - "babel-eslint": "^10.1.0", - "babel-jest": "^26.6.3", - "babel-plugin-trace": "^1.1.0", - "common-tags": "^1.8.0", - "cross-env": "^7.0.3", - "eslint": "^7.19.0", - "eslint-config-prettier": "^7.2.0", - "fast-check": "^2.12.0", - "jest": "^26.6.3", - "prettier": "^2.2.1", - "rollup": "^2.38.2", - "typescript": "^4.1.3" - }, - "engines": { - "node": ">= 6" - } -} diff --git a/node_modules/yaml/pair.js b/node_modules/yaml/pair.js deleted file mode 100644 index b2880a256..000000000 --- a/node_modules/yaml/pair.js +++ /dev/null @@ -1,2 +0,0 @@ -module.exports = require('./dist/types').Pair -require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/node_modules/yaml/parse-cst.d.ts b/node_modules/yaml/parse-cst.d.ts deleted file mode 100644 index 9fd2ebf8b..000000000 --- a/node_modules/yaml/parse-cst.d.ts +++ /dev/null @@ -1,191 +0,0 @@ -import { Type, YAMLSyntaxError } from './util' - -export default function parseCST(str: string): ParsedCST - -export interface ParsedCST extends Array { - setOrigRanges(): boolean -} - -export namespace CST { - interface Range { - start: number - end: number - origStart?: number - origEnd?: number - isEmpty(): boolean - } - - interface ParseContext { - /** Node starts at beginning of line */ - atLineStart: boolean - /** true if currently in a collection context */ - inCollection: boolean - /** true if currently in a flow context */ - inFlow: boolean - /** Current level of indentation */ - indent: number - /** Start of the current line */ - lineStart: number - /** The parent of the node */ - parent: Node - /** Source of the YAML document */ - src: string - } - - interface Node { - context: ParseContext | null - /** if not null, indicates a parser failure */ - error: YAMLSyntaxError | null - /** span of context.src parsed into this node */ - range: Range | null - valueRange: Range | null - /** anchors, tags and comments */ - props: Range[] - /** specific node type */ - type: Type - /** if non-null, overrides source value */ - value: string | null - - readonly anchor: string | null - readonly comment: string | null - readonly hasComment: boolean - readonly hasProps: boolean - readonly jsonLike: boolean - readonly rangeAsLinePos: null | { - start: { line: number; col: number } - end?: { line: number; col: number } - } - readonly rawValue: string | null - readonly tag: - | null - | { verbatim: string } - | { handle: string; suffix: string } - readonly valueRangeContainsNewline: boolean - } - - interface Alias extends Node { - type: Type.ALIAS - /** contain the anchor without the * prefix */ - readonly rawValue: string - } - - type Scalar = BlockValue | PlainValue | QuoteValue - - interface BlockValue extends Node { - type: Type.BLOCK_FOLDED | Type.BLOCK_LITERAL - chomping: 'CLIP' | 'KEEP' | 'STRIP' - blockIndent: number | null - header: Range - readonly strValue: string | null - } - - interface BlockFolded extends BlockValue { - type: Type.BLOCK_FOLDED - } - - interface BlockLiteral extends BlockValue { - type: Type.BLOCK_LITERAL - } - - interface PlainValue extends Node { - type: Type.PLAIN - readonly strValue: string | null - } - - interface QuoteValue extends Node { - type: Type.QUOTE_DOUBLE | Type.QUOTE_SINGLE - readonly strValue: - | null - | string - | { str: string; errors: YAMLSyntaxError[] } - } - - interface QuoteDouble extends QuoteValue { - type: Type.QUOTE_DOUBLE - } - - interface QuoteSingle extends QuoteValue { - type: Type.QUOTE_SINGLE - } - - interface Comment extends Node { - type: Type.COMMENT - readonly anchor: null - readonly comment: string - readonly rawValue: null - readonly tag: null - } - - interface BlankLine extends Node { - type: Type.BLANK_LINE - } - - interface MapItem extends Node { - type: Type.MAP_KEY | Type.MAP_VALUE - node: ContentNode | null - } - - interface MapKey extends MapItem { - type: Type.MAP_KEY - } - - interface MapValue extends MapItem { - type: Type.MAP_VALUE - } - - interface Map extends Node { - type: Type.MAP - /** implicit keys are not wrapped */ - items: Array - } - - interface SeqItem extends Node { - type: Type.SEQ_ITEM - node: ContentNode | null - } - - interface Seq extends Node { - type: Type.SEQ - items: Array - } - - interface FlowChar { - char: '{' | '}' | '[' | ']' | ',' | '?' | ':' - offset: number - origOffset?: number - } - - interface FlowCollection extends Node { - type: Type.FLOW_MAP | Type.FLOW_SEQ - items: Array< - FlowChar | BlankLine | Comment | Alias | Scalar | FlowCollection - > - } - - interface FlowMap extends FlowCollection { - type: Type.FLOW_MAP - } - - interface FlowSeq extends FlowCollection { - type: Type.FLOW_SEQ - } - - type ContentNode = Alias | Scalar | Map | Seq | FlowCollection - - interface Directive extends Node { - type: Type.DIRECTIVE - name: string - readonly anchor: null - readonly parameters: string[] - readonly tag: null - } - - interface Document extends Node { - type: Type.DOCUMENT - directives: Array - contents: Array - readonly anchor: null - readonly comment: null - readonly tag: null - } -} diff --git a/node_modules/yaml/parse-cst.js b/node_modules/yaml/parse-cst.js deleted file mode 100644 index 806575652..000000000 --- a/node_modules/yaml/parse-cst.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/parse-cst').parse diff --git a/node_modules/yaml/scalar.js b/node_modules/yaml/scalar.js deleted file mode 100644 index deee1b03a..000000000 --- a/node_modules/yaml/scalar.js +++ /dev/null @@ -1,2 +0,0 @@ -module.exports = require('./dist/types').Scalar -require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/node_modules/yaml/schema.js b/node_modules/yaml/schema.js deleted file mode 100644 index 4139c4bf8..000000000 --- a/node_modules/yaml/schema.js +++ /dev/null @@ -1,9 +0,0 @@ -const types = require('./dist/types') -const util = require('./dist/util') - -module.exports = types.Schema -module.exports.nullOptions = types.nullOptions -module.exports.strOptions = types.strOptions -module.exports.stringify = util.stringifyString - -require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/node_modules/yaml/seq.js b/node_modules/yaml/seq.js deleted file mode 100644 index 66147df38..000000000 --- a/node_modules/yaml/seq.js +++ /dev/null @@ -1,2 +0,0 @@ -module.exports = require('./dist/types').YAMLSeq -require('./dist/legacy-exports').warnFileDeprecation(__filename) diff --git a/node_modules/yaml/types.d.ts b/node_modules/yaml/types.d.ts deleted file mode 100644 index 411e74e8a..000000000 --- a/node_modules/yaml/types.d.ts +++ /dev/null @@ -1,407 +0,0 @@ -import { Document, scalarOptions } from './index' -import { CST } from './parse-cst' -import { Type } from './util' - -export const binaryOptions: scalarOptions.Binary -export const boolOptions: scalarOptions.Bool -export const intOptions: scalarOptions.Int -export const nullOptions: scalarOptions.Null -export const strOptions: scalarOptions.Str - -export class Schema { - /** Default: `'tag:yaml.org,2002:'` */ - static defaultPrefix: string - static defaultTags: { - /** Default: `'tag:yaml.org,2002:map'` */ - MAP: string - /** Default: `'tag:yaml.org,2002:seq'` */ - SEQ: string - /** Default: `'tag:yaml.org,2002:str'` */ - STR: string - } - constructor(options: Schema.Options) - /** - * Convert any value into a `Node` using this schema, recursively turning - * objects into collections. - * - * @param wrapScalars If `true`, also wraps plain values in `Scalar` objects; - * if undefined or `false` and `value` is not an object, it will be returned - * directly. - * @param tag Use to specify the collection type, e.g. `"!!omap"`. Note that - * this requires the corresponding tag to be available in this schema. - */ - createNode( - value: any, - wrapScalars?: boolean, - tag?: string, - ctx?: Schema.CreateNodeContext - ): Node - /** - * Convert a key and a value into a `Pair` using this schema, recursively - * wrapping all values as `Scalar` or `Collection` nodes. - * - * @param ctx To not wrap scalars, use a context `{ wrapScalars: false }` - */ - createPair(key: any, value: any, ctx?: Schema.CreateNodeContext): Pair - merge: boolean - name: Schema.Name - sortMapEntries: ((a: Pair, b: Pair) => number) | null - tags: Schema.Tag[] -} - -export namespace Schema { - type Name = 'core' | 'failsafe' | 'json' | 'yaml-1.1' - - interface Options { - /** - * Array of additional tags to include in the schema, or a function that may - * modify the schema's base tag array. - */ - customTags?: (TagId | Tag)[] | ((tags: Tag[]) => Tag[]) - /** - * Enable support for `<<` merge keys. - * - * Default: `false` for YAML 1.2, `true` for earlier versions - */ - merge?: boolean - /** - * The base schema to use. - * - * Default: `"core"` for YAML 1.2, `"yaml-1.1"` for earlier versions - */ - schema?: Name - /** - * When stringifying, sort map entries. If `true`, sort by comparing key values with `<`. - * - * Default: `false` - */ - sortMapEntries?: boolean | ((a: Pair, b: Pair) => number) - /** - * @deprecated Use `customTags` instead. - */ - tags?: Options['customTags'] - } - - interface CreateNodeContext { - wrapScalars?: boolean - [key: string]: any - } - - interface StringifyContext { - forceBlockIndent?: boolean - implicitKey?: boolean - indent?: string - indentAtStart?: number - inFlow?: boolean - [key: string]: any - } - - type TagId = - | 'binary' - | 'bool' - | 'float' - | 'floatExp' - | 'floatNaN' - | 'floatTime' - | 'int' - | 'intHex' - | 'intOct' - | 'intTime' - | 'null' - | 'omap' - | 'pairs' - | 'set' - | 'timestamp' - - type Tag = CustomTag | DefaultTag - - interface BaseTag { - /** - * An optional factory function, used e.g. by collections when wrapping JS objects as AST nodes. - */ - createNode?: ( - schema: Schema, - value: any, - ctx: Schema.CreateNodeContext - ) => YAMLMap | YAMLSeq | Scalar - /** - * If a tag has multiple forms that should be parsed and/or stringified differently, use `format` to identify them. - */ - format?: string - /** - * Used by `YAML.createNode` to detect your data type, e.g. using `typeof` or - * `instanceof`. - */ - identify(value: any): boolean - /** - * The `Node` child class that implements this tag. Required for collections and tags that have overlapping JS representations. - */ - nodeClass?: new () => any - /** - * Used by some tags to configure their stringification, where applicable. - */ - options?: object - /** - * Optional function stringifying the AST node in the current context. If your - * data includes a suitable `.toString()` method, you can probably leave this - * undefined and use the default stringifier. - * - * @param item The node being stringified. - * @param ctx Contains the stringifying context variables. - * @param onComment Callback to signal that the stringifier includes the - * item's comment in its output. - * @param onChompKeep Callback to signal that the output uses a block scalar - * type with the `+` chomping indicator. - */ - stringify?: ( - item: Node, - ctx: Schema.StringifyContext, - onComment?: () => void, - onChompKeep?: () => void - ) => string - /** - * The identifier for your data type, with which its stringified form will be - * prefixed. Should either be a !-prefixed local `!tag`, or a fully qualified - * `tag:domain,date:foo`. - */ - tag: string - } - - interface CustomTag extends BaseTag { - /** - * A JavaScript class that should be matched to this tag, e.g. `Date` for `!!timestamp`. - * @deprecated Use `Tag.identify` instead - */ - class?: new () => any - /** - * Turns a CST node into an AST node. If returning a non-`Node` value, the - * output will be wrapped as a `Scalar`. - */ - resolve(doc: Document, cstNode: CST.Node): Node | any - } - - interface DefaultTag extends BaseTag { - /** - * If `true`, together with `test` allows for values to be stringified without - * an explicit tag. For most cases, it's unlikely that you'll actually want to - * use this, even if you first think you do. - */ - default: true - /** - * Alternative form used by default tags; called with `test` match results. - */ - resolve(...match: string[]): Node | any - /** - * Together with `default` allows for values to be stringified without an - * explicit tag and detected using a regular expression. For most cases, it's - * unlikely that you'll actually want to use these, even if you first think - * you do. - */ - test: RegExp - } -} - -export class Node { - /** A comment on or immediately after this */ - comment?: string | null - /** A comment before this */ - commentBefore?: string | null - /** Only available when `keepCstNodes` is set to `true` */ - cstNode?: CST.Node - /** - * The [start, end] range of characters of the source parsed - * into this node (undefined for pairs or if not parsed) - */ - range?: [number, number] | null - /** A blank line before this node and its commentBefore */ - spaceBefore?: boolean - /** A fully qualified tag, if required */ - tag?: string - /** A plain JS representation of this node */ - toJSON(arg?: any): any - /** The type of this node */ - type?: Type | Pair.Type -} - -export class Scalar extends Node { - constructor(value: any) - type?: Scalar.Type - /** - * By default (undefined), numbers use decimal notation. - * The YAML 1.2 core schema only supports 'HEX' and 'OCT'. - */ - format?: 'BIN' | 'HEX' | 'OCT' | 'TIME' - value: any - toJSON(arg?: any, ctx?: AST.NodeToJsonContext): any - toString(): string -} -export namespace Scalar { - type Type = - | Type.BLOCK_FOLDED - | Type.BLOCK_LITERAL - | Type.PLAIN - | Type.QUOTE_DOUBLE - | Type.QUOTE_SINGLE -} - -export class Alias extends Node { - type: Type.ALIAS - source: Node - cstNode?: CST.Alias - toString(ctx: Schema.StringifyContext): string -} - -export class Pair extends Node { - constructor(key: any, value?: any) - type: Pair.Type.PAIR | Pair.Type.MERGE_PAIR - /** Always Node or null when parsed, but can be set to anything. */ - key: any - /** Always Node or null when parsed, but can be set to anything. */ - value: any - cstNode?: never // no corresponding cstNode - toJSON(arg?: any, ctx?: AST.NodeToJsonContext): object | Map - toString( - ctx?: Schema.StringifyContext, - onComment?: () => void, - onChompKeep?: () => void - ): string -} -export namespace Pair { - enum Type { - PAIR = 'PAIR', - MERGE_PAIR = 'MERGE_PAIR' - } -} - -export class Merge extends Pair { - type: Pair.Type.MERGE_PAIR - /** Always Scalar('<<'), defined by the type specification */ - key: AST.PlainValue - /** Always YAMLSeq, stringified as *A if length = 1 */ - value: YAMLSeq - toString(ctx?: Schema.StringifyContext, onComment?: () => void): string -} - -export class Collection extends Node { - type?: Type.MAP | Type.FLOW_MAP | Type.SEQ | Type.FLOW_SEQ | Type.DOCUMENT - items: any[] - schema?: Schema - - /** - * Adds a value to the collection. For `!!map` and `!!omap` the value must - * be a Pair instance or a `{ key, value }` object, which may not have a key - * that already exists in the map. - */ - add(value: any): void - addIn(path: Iterable, value: any): void - /** - * Removes a value from the collection. - * @returns `true` if the item was found and removed. - */ - delete(key: any): boolean - deleteIn(path: Iterable): boolean - /** - * Returns item at `key`, or `undefined` if not found. By default unwraps - * scalar values from their surrounding node; to disable set `keepScalar` to - * `true` (collections are always returned intact). - */ - get(key: any, keepScalar?: boolean): any - getIn(path: Iterable, keepScalar?: boolean): any - /** - * Checks if the collection includes a value with the key `key`. - */ - has(key: any): boolean - hasIn(path: Iterable): boolean - /** - * Sets a value in this collection. For `!!set`, `value` needs to be a - * boolean to add/remove the item from the set. - */ - set(key: any, value: any): void - setIn(path: Iterable, value: any): void -} - -export class YAMLMap extends Collection { - type?: Type.FLOW_MAP | Type.MAP - items: Array - hasAllNullValues(): boolean - toJSON(arg?: any, ctx?: AST.NodeToJsonContext): object | Map - toString( - ctx?: Schema.StringifyContext, - onComment?: () => void, - onChompKeep?: () => void - ): string -} - -export class YAMLSeq extends Collection { - type?: Type.FLOW_SEQ | Type.SEQ - delete(key: number | string | Scalar): boolean - get(key: number | string | Scalar, keepScalar?: boolean): any - has(key: number | string | Scalar): boolean - set(key: number | string | Scalar, value: any): void - hasAllNullValues(): boolean - toJSON(arg?: any, ctx?: AST.NodeToJsonContext): any[] - toString( - ctx?: Schema.StringifyContext, - onComment?: () => void, - onChompKeep?: () => void - ): string -} - -export namespace AST { - interface NodeToJsonContext { - anchors?: any[] - doc: Document - keep?: boolean - mapAsMap?: boolean - maxAliasCount?: number - onCreate?: (node: Node) => void - [key: string]: any - } - - interface BlockFolded extends Scalar { - type: Type.BLOCK_FOLDED - cstNode?: CST.BlockFolded - } - - interface BlockLiteral extends Scalar { - type: Type.BLOCK_LITERAL - cstNode?: CST.BlockLiteral - } - - interface PlainValue extends Scalar { - type: Type.PLAIN - cstNode?: CST.PlainValue - } - - interface QuoteDouble extends Scalar { - type: Type.QUOTE_DOUBLE - cstNode?: CST.QuoteDouble - } - - interface QuoteSingle extends Scalar { - type: Type.QUOTE_SINGLE - cstNode?: CST.QuoteSingle - } - - interface FlowMap extends YAMLMap { - type: Type.FLOW_MAP - cstNode?: CST.FlowMap - } - - interface BlockMap extends YAMLMap { - type: Type.MAP - cstNode?: CST.Map - } - - interface FlowSeq extends YAMLSeq { - type: Type.FLOW_SEQ - items: Array - cstNode?: CST.FlowSeq - } - - interface BlockSeq extends YAMLSeq { - type: Type.SEQ - items: Array - cstNode?: CST.Seq - } -} diff --git a/node_modules/yaml/types.js b/node_modules/yaml/types.js deleted file mode 100644 index 88747498d..000000000 --- a/node_modules/yaml/types.js +++ /dev/null @@ -1,17 +0,0 @@ -const types = require('./dist/types') - -exports.binaryOptions = types.binaryOptions -exports.boolOptions = types.boolOptions -exports.intOptions = types.intOptions -exports.nullOptions = types.nullOptions -exports.strOptions = types.strOptions - -exports.Schema = types.Schema -exports.Alias = types.Alias -exports.Collection = types.Collection -exports.Merge = types.Merge -exports.Node = types.Node -exports.Pair = types.Pair -exports.Scalar = types.Scalar -exports.YAMLMap = types.YAMLMap -exports.YAMLSeq = types.YAMLSeq diff --git a/node_modules/yaml/types.mjs b/node_modules/yaml/types.mjs deleted file mode 100644 index 71322884c..000000000 --- a/node_modules/yaml/types.mjs +++ /dev/null @@ -1,17 +0,0 @@ -import types from './dist/types.js' - -export const binaryOptions = types.binaryOptions -export const boolOptions = types.boolOptions -export const intOptions = types.intOptions -export const nullOptions = types.nullOptions -export const strOptions = types.strOptions - -export const Schema = types.Schema -export const Alias = types.Alias -export const Collection = types.Collection -export const Merge = types.Merge -export const Node = types.Node -export const Pair = types.Pair -export const Scalar = types.Scalar -export const YAMLMap = types.YAMLMap -export const YAMLSeq = types.YAMLSeq diff --git a/node_modules/yaml/types/binary.js b/node_modules/yaml/types/binary.js deleted file mode 100644 index 271b9de38..000000000 --- a/node_modules/yaml/types/binary.js +++ /dev/null @@ -1,8 +0,0 @@ -'use strict' -Object.defineProperty(exports, '__esModule', { value: true }) - -const legacy = require('../dist/legacy-exports') -exports.binary = legacy.binary -exports.default = [exports.binary] - -legacy.warnFileDeprecation(__filename) diff --git a/node_modules/yaml/types/omap.js b/node_modules/yaml/types/omap.js deleted file mode 100644 index 37b638b73..000000000 --- a/node_modules/yaml/types/omap.js +++ /dev/null @@ -1,3 +0,0 @@ -const legacy = require('../dist/legacy-exports') -module.exports = legacy.omap -legacy.warnFileDeprecation(__filename) diff --git a/node_modules/yaml/types/pairs.js b/node_modules/yaml/types/pairs.js deleted file mode 100644 index f1df201ce..000000000 --- a/node_modules/yaml/types/pairs.js +++ /dev/null @@ -1,3 +0,0 @@ -const legacy = require('../dist/legacy-exports') -module.exports = legacy.pairs -legacy.warnFileDeprecation(__filename) diff --git a/node_modules/yaml/types/set.js b/node_modules/yaml/types/set.js deleted file mode 100644 index e7dc9d42c..000000000 --- a/node_modules/yaml/types/set.js +++ /dev/null @@ -1,3 +0,0 @@ -const legacy = require('../dist/legacy-exports') -module.exports = legacy.set -legacy.warnFileDeprecation(__filename) diff --git a/node_modules/yaml/types/timestamp.js b/node_modules/yaml/types/timestamp.js deleted file mode 100644 index 39c5b6dd4..000000000 --- a/node_modules/yaml/types/timestamp.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict' -Object.defineProperty(exports, '__esModule', { value: true }) - -const legacy = require('../dist/legacy-exports') -exports.default = [legacy.intTime, legacy.floatTime, legacy.timestamp] -exports.floatTime = legacy.floatTime -exports.intTime = legacy.intTime -exports.timestamp = legacy.timestamp - -legacy.warnFileDeprecation(__filename) diff --git a/node_modules/yaml/util.d.ts b/node_modules/yaml/util.d.ts deleted file mode 100644 index b13554100..000000000 --- a/node_modules/yaml/util.d.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { Document } from './index' -import { CST } from './parse-cst' -import { AST, Pair, Scalar, Schema } from './types' - -export function findPair(items: any[], key: Scalar | any): Pair | undefined - -export function parseMap(doc: Document, cst: CST.Map): AST.BlockMap -export function parseMap(doc: Document, cst: CST.FlowMap): AST.FlowMap -export function parseSeq(doc: Document, cst: CST.Seq): AST.BlockSeq -export function parseSeq(doc: Document, cst: CST.FlowSeq): AST.FlowSeq - -export function stringifyNumber(item: Scalar): string -export function stringifyString( - item: Scalar, - ctx: Schema.StringifyContext, - onComment?: () => void, - onChompKeep?: () => void -): string - -export function toJSON( - value: any, - arg?: any, - ctx?: Schema.CreateNodeContext -): any - -export enum Type { - ALIAS = 'ALIAS', - BLANK_LINE = 'BLANK_LINE', - BLOCK_FOLDED = 'BLOCK_FOLDED', - BLOCK_LITERAL = 'BLOCK_LITERAL', - COMMENT = 'COMMENT', - DIRECTIVE = 'DIRECTIVE', - DOCUMENT = 'DOCUMENT', - FLOW_MAP = 'FLOW_MAP', - FLOW_SEQ = 'FLOW_SEQ', - MAP = 'MAP', - MAP_KEY = 'MAP_KEY', - MAP_VALUE = 'MAP_VALUE', - PLAIN = 'PLAIN', - QUOTE_DOUBLE = 'QUOTE_DOUBLE', - QUOTE_SINGLE = 'QUOTE_SINGLE', - SEQ = 'SEQ', - SEQ_ITEM = 'SEQ_ITEM' -} - -interface LinePos { - line: number - col: number -} - -export class YAMLError extends Error { - name: - | 'YAMLReferenceError' - | 'YAMLSemanticError' - | 'YAMLSyntaxError' - | 'YAMLWarning' - message: string - source?: CST.Node - - nodeType?: Type - range?: CST.Range - linePos?: { start: LinePos; end: LinePos } - - /** - * Drops `source` and adds `nodeType`, `range` and `linePos`, as well as - * adding details to `message`. Run automatically for document errors if - * the `prettyErrors` option is set. - */ - makePretty(): void -} - -export class YAMLReferenceError extends YAMLError { - name: 'YAMLReferenceError' -} - -export class YAMLSemanticError extends YAMLError { - name: 'YAMLSemanticError' -} - -export class YAMLSyntaxError extends YAMLError { - name: 'YAMLSyntaxError' -} - -export class YAMLWarning extends YAMLError { - name: 'YAMLWarning' -} diff --git a/node_modules/yaml/util.js b/node_modules/yaml/util.js deleted file mode 100644 index 06dd2c994..000000000 --- a/node_modules/yaml/util.js +++ /dev/null @@ -1,16 +0,0 @@ -const util = require('./dist/util') - -exports.findPair = util.findPair -exports.toJSON = util.toJSON -exports.parseMap = util.parseMap -exports.parseSeq = util.parseSeq - -exports.stringifyNumber = util.stringifyNumber -exports.stringifyString = util.stringifyString -exports.Type = util.Type - -exports.YAMLError = util.YAMLError -exports.YAMLReferenceError = util.YAMLReferenceError -exports.YAMLSemanticError = util.YAMLSemanticError -exports.YAMLSyntaxError = util.YAMLSyntaxError -exports.YAMLWarning = util.YAMLWarning diff --git a/node_modules/yaml/util.mjs b/node_modules/yaml/util.mjs deleted file mode 100644 index 89e654abe..000000000 --- a/node_modules/yaml/util.mjs +++ /dev/null @@ -1,18 +0,0 @@ -import util from './dist/util.js' - -export const findPair = util.findPair -export const toJSON = util.toJSON - -export const parseMap = util.parseMap -export const parseSeq = util.parseSeq - -export const stringifyNumber = util.stringifyNumber -export const stringifyString = util.stringifyString - -export const Type = util.Type - -export const YAMLError = util.YAMLError -export const YAMLReferenceError = util.YAMLReferenceError -export const YAMLSemanticError = util.YAMLSemanticError -export const YAMLSyntaxError = util.YAMLSyntaxError -export const YAMLWarning = util.YAMLWarning diff --git a/node_modules/yargs/locales/cs.json b/node_modules/yargs/locales/cs.json index 18507772d..639487564 100644 --- a/node_modules/yargs/locales/cs.json +++ b/node_modules/yargs/locales/cs.json @@ -15,7 +15,7 @@ "generated-value": "generovaná-hodnota", "Not enough non-option arguments: got %s, need at least %s": { "one": "Nedostatek argumentů: zadáno %s, je potřeba alespoň %s", - "other": "Nedostatek argumentů: zadáno %s, je potřeba alespoň %s", + "other": "Nedostatek argumentů: zadáno %s, je potřeba alespoň %s" }, "Too many non-option arguments: got %s, maximum of %s": { "one": "Příliš mnoho argumentů: zadáno %s, maximálně %s", diff --git a/node_modules/yargs/locales/fi.json b/node_modules/yargs/locales/fi.json index 0728c5784..481feb710 100644 --- a/node_modules/yargs/locales/fi.json +++ b/node_modules/yargs/locales/fi.json @@ -30,7 +30,7 @@ "other": "Pakollisia argumentteja puuttuu: %s" }, "Unknown argument: %s": { - "one": "Tuntematon argumenttn: %s", + "one": "Tuntematon argumentti: %s", "other": "Tuntemattomia argumentteja: %s" }, "Invalid values:": "Virheelliset arvot:", diff --git a/node_modules/yargs/package.json b/node_modules/yargs/package.json index bb6d59d51..dfc4303e7 100644 --- a/node_modules/yargs/package.json +++ b/node_modules/yargs/package.json @@ -1,6 +1,6 @@ { "name": "yargs", - "version": "17.6.0", + "version": "17.6.2", "description": "yargs the modern, pirate-themed, successor to optimist.", "main": "./index.cjs", "exports": { @@ -59,12 +59,12 @@ "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^21.0.0" + "yargs-parser": "^21.1.1" }, "devDependencies": { "@types/chai": "^4.2.11", "@types/mocha": "^9.0.0", - "@types/node": "^16.11.4", + "@types/node": "^18.0.0", "c8": "^7.7.0", "chai": "^4.2.0", "chalk": "^4.0.0", diff --git a/package-lock.json b/package-lock.json index 7711f3e90..881907448 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,24 +12,24 @@ "@actions/core": "1.10.0", "@actions/github": "5.1.1", "@octokit/webhooks-definitions": "^3.67.3", - "@relative-ci/agent": "^4.1.1", + "@relative-ci/agent": "^4.1.2", "adm-zip": "^0.5.9", "lodash": "^4.17.21" }, "devDependencies": { - "@babel/core": "7.19.3", + "@babel/core": "7.20.5", "@babel/eslint-parser": "^7.19.1", - "@babel/preset-env": "7.19.3", + "@babel/preset-env": "7.20.2", "@types/adm-zip": "^0.5.0", - "babel-loader": "8.2.5", - "core-js": "3.25.5", + "babel-loader": "9.1.0", + "core-js": "3.26.1", "encoding": "^0.1.13", - "eslint": "^8.24.0", + "eslint": "^8.29.0", "eslint-config-airbnb-base": "^15.0.0", - "ts-loader": "^9.4.1", - "typescript": "^4.8.4", - "webpack": "5.74.0", - "webpack-cli": "4.10.0" + "ts-loader": "^9.4.2", + "typescript": "^4.9.3", + "webpack": "5.75.0", + "webpack-cli": "5.0.0" } }, "node_modules/@actions/core": { @@ -85,30 +85,30 @@ } }, "node_modules/@babel/compat-data": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.19.3.tgz", - "integrity": "sha512-prBHMK4JYYK+wDjJF1q99KK4JLL+egWS4nmNqdlMUgCExMZ+iZW0hGhyC3VEbsPjvaN0TBhW//VIFwBrk8sEiw==", + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.20.1.tgz", + "integrity": "sha512-EWZ4mE2diW3QALKvDMiXnbZpRvlj+nayZ112nK93SnhqOtpdsbVD4W+2tEoT3YNBAG9RBR0ISY758ZkOgsn6pQ==", "dev": true, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/core": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.19.3.tgz", - "integrity": "sha512-WneDJxdsjEvyKtXKsaBGbDeiyOjR5vYq4HcShxnIbG0qixpoHjI3MqeZM9NDvsojNCEBItQE4juOo/bU6e72gQ==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.20.5.tgz", + "integrity": "sha512-UdOWmk4pNWTm/4DlPUl/Pt4Gz4rcEMb7CY0Y3eJl5Yz1vI8ZJGmHWaVE55LoxRjdpx0z259GE9U5STA9atUinQ==", "dev": true, "dependencies": { "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.3", - "@babel/helper-compilation-targets": "^7.19.3", - "@babel/helper-module-transforms": "^7.19.0", - "@babel/helpers": "^7.19.0", - "@babel/parser": "^7.19.3", + "@babel/generator": "^7.20.5", + "@babel/helper-compilation-targets": "^7.20.0", + "@babel/helper-module-transforms": "^7.20.2", + "@babel/helpers": "^7.20.5", + "@babel/parser": "^7.20.5", "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.3", - "@babel/types": "^7.19.3", + "@babel/traverse": "^7.20.5", + "@babel/types": "^7.20.5", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -181,12 +181,12 @@ } }, "node_modules/@babel/generator": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.3.tgz", - "integrity": "sha512-fqVZnmp1ncvZU757UzDheKZpfPgatqY59XtW2/j/18H7u76akb8xqvjw82f+i2UKd/ksYsSick/BCLQUUtJ/qQ==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.20.5.tgz", + "integrity": "sha512-jl7JY2Ykn9S0yj4DQP82sYvPU+T3g0HFcWTqDLqiuA9tGRNIj9VfbtXGAYTTkyNEnQk1jkMGOdYka8aG/lulCA==", "dev": true, "dependencies": { - "@babel/types": "^7.19.3", + "@babel/types": "^7.20.5", "@jridgewell/gen-mapping": "^0.3.2", "jsesc": "^2.5.1" }, @@ -234,12 +234,12 @@ } }, "node_modules/@babel/helper-compilation-targets": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.3.tgz", - "integrity": "sha512-65ESqLGyGmLvgR0mst5AdW1FkNlj9rQsCKduzEoEPhBCDFGXvz2jW6bXFG6i0/MrV2s7hhXjjb2yAzcPuQlLwg==", + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.0.tgz", + "integrity": "sha512-0jp//vDGp9e8hZzBc6N/KwA5ZK3Wsm/pfm4CrY7vzegkVxc65SgSn6wYOnwHe9Js9HRQ1YTCKLGPzDtaS3RoLQ==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.19.3", + "@babel/compat-data": "^7.20.0", "@babel/helper-validator-option": "^7.18.6", "browserslist": "^4.21.3", "semver": "^6.3.0" @@ -394,19 +394,19 @@ } }, "node_modules/@babel/helper-module-transforms": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.19.0.tgz", - "integrity": "sha512-3HBZ377Fe14RbLIA+ac3sY4PTgpxHVkFrESaWhoI5PuyXPBBX8+C34qblV9G89ZtycGJCmCI/Ut+VUDK4bltNQ==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.20.2.tgz", + "integrity": "sha512-zvBKyJXRbmK07XhMuujYoJ48B5yvvmM6+wcpv6Ivj4Yg6qO7NOZOSnvZN9CRl1zz1Z4cKf8YejmCMh8clOoOeA==", "dev": true, "dependencies": { "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", + "@babel/helper-simple-access": "^7.20.2", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/helper-validator-identifier": "^7.18.6", + "@babel/helper-validator-identifier": "^7.19.1", "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.0", - "@babel/types": "^7.19.0" + "@babel/traverse": "^7.20.1", + "@babel/types": "^7.20.2" }, "engines": { "node": ">=6.9.0" @@ -425,9 +425,9 @@ } }, "node_modules/@babel/helper-plugin-utils": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.19.0.tgz", - "integrity": "sha512-40Ryx7I8mT+0gaNxm8JGTZFUITNqdLAgdg0hXzeVZxVD6nFsdhQvip6v8dqkRHzsz1VFpFAaOCHNn0vKBL7Czw==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz", + "integrity": "sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==", "dev": true, "engines": { "node": ">=6.9.0" @@ -452,28 +452,28 @@ } }, "node_modules/@babel/helper-replace-supers": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.18.9.tgz", - "integrity": "sha512-dNsWibVI4lNT6HiuOIBr1oyxo40HvIVmbwPUm3XZ7wMh4k2WxrxTqZwSqw/eEmXDS9np0ey5M2bz9tBmO9c+YQ==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.19.1.tgz", + "integrity": "sha512-T7ahH7wV0Hfs46SFh5Jz3s0B6+o8g3c+7TMxu7xKfmHikg7EAZ3I2Qk9LFhjxXq8sL7UkP5JflezNwoZa8WvWw==", "dev": true, "dependencies": { "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-member-expression-to-functions": "^7.18.9", "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/traverse": "^7.18.9", - "@babel/types": "^7.18.9" + "@babel/traverse": "^7.19.1", + "@babel/types": "^7.19.0" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-simple-access": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.18.6.tgz", - "integrity": "sha512-iNpIgTgyAvDQpDj76POqg+YEt8fPxx3yaNBg3S30dxNKm2SWfYhD0TGrK/Eu9wHpUW63VQU894TsTg+GLbUa1g==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz", + "integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==", "dev": true, "dependencies": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.20.2" }, "engines": { "node": ">=6.9.0" @@ -504,9 +504,9 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz", - "integrity": "sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw==", + "version": "7.19.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", + "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", "dev": true, "engines": { "node": ">=6.9.0" @@ -545,14 +545,14 @@ } }, "node_modules/@babel/helpers": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.19.0.tgz", - "integrity": "sha512-DRBCKGwIEdqY3+rPJgG/dKfQy9+08rHIAJx8q2p+HSWP87s2HCrQmaAMMyMll2kIXKCW0cO1RdQskx15Xakftg==", + "version": "7.20.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.20.6.tgz", + "integrity": "sha512-Pf/OjgfgFRW5bApskEz5pvidpim7tEDPlFtKcNRXWmfHGn9IEI2W2flqRQXTFb7gIPTyK++N6rVHuwKut4XK6w==", "dev": true, "dependencies": { "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.0", - "@babel/types": "^7.19.0" + "@babel/traverse": "^7.20.5", + "@babel/types": "^7.20.5" }, "engines": { "node": ">=6.9.0" @@ -572,9 +572,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.3.tgz", - "integrity": "sha512-pJ9xOlNWHiy9+FuFP09DEAFbAn4JskgRsVcc169w2xRBC3FRGuQEwjeIMMND9L2zc0iEhO/tGv4Zq+km+hxNpQ==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.5.tgz", + "integrity": "sha512-r27t/cy/m9uKLXQNWWebeCUHgnAZq0CpG1OwKRxzJMP1vpSU4bSIK2hq+/cp0bQxetkXx38n09rNu8jVkcK/zA==", "dev": true, "bin": { "parser": "bin/babel-parser.js" @@ -616,9 +616,9 @@ } }, "node_modules/@babel/plugin-proposal-async-generator-functions": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.19.1.tgz", - "integrity": "sha512-0yu8vNATgLy4ivqMNBIwb1HebCelqN7YX8SL3FDXORv/RqT0zEEWUCH4GH44JsSrvCu6GqnAdR5EBFAPeNBB4Q==", + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.20.1.tgz", + "integrity": "sha512-Gh5rchzSwE4kC+o/6T8waD0WHEQIsDmjltY8WnWRXHUdH8axZhuH86Ov9M72YhJfDrZseQwuuWaaIT/TmePp3g==", "dev": true, "dependencies": { "@babel/helper-environment-visitor": "^7.18.9", @@ -763,16 +763,16 @@ } }, "node_modules/@babel/plugin-proposal-object-rest-spread": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.18.9.tgz", - "integrity": "sha512-kDDHQ5rflIeY5xl69CEqGEZ0KY369ehsCIEbTGb4siHG5BE9sga/T0r0OUwyZNLMmZE79E1kbsqAjwFCW4ds6Q==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.2.tgz", + "integrity": "sha512-Ks6uej9WFK+fvIMesSqbAto5dD8Dz4VuuFvGJFKgIGSkJuRGcrwGECPA1fDgQK3/DbExBJpEkTeYeB8geIFCSQ==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.18.8", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9", + "@babel/compat-data": "^7.20.1", + "@babel/helper-compilation-targets": "^7.20.0", + "@babel/helper-plugin-utils": "^7.20.2", "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.18.8" + "@babel/plugin-transform-parameters": "^7.20.1" }, "engines": { "node": ">=6.9.0" @@ -928,12 +928,12 @@ } }, "node_modules/@babel/plugin-syntax-import-assertions": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.18.6.tgz", - "integrity": "sha512-/DU3RXad9+bZwrgWJQKbr39gYbJpLJHezqEzRzi/BHRlJ9zsQb4CK2CA/5apllXNomwA1qHwzvHl+AdEmC5krQ==", + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.20.0.tgz", + "integrity": "sha512-IUh1vakzNoWalR8ch/areW7qFopR2AEw03JlG7BbrDqmQ4X3q9uuipQwSGrUn7oGiemKjtSLDhNtQHzMHr1JdQ==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.19.0" }, "engines": { "node": ">=6.9.0" @@ -1104,12 +1104,12 @@ } }, "node_modules/@babel/plugin-transform-block-scoping": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.18.9.tgz", - "integrity": "sha512-5sDIJRV1KtQVEbt/EIBwGy4T01uYIo4KRB3VUqzkhrAIOGx7AoctL9+Ux88btY0zXdDyPJ9mW+bg+v+XEkGmtw==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.20.2.tgz", + "integrity": "sha512-y5V15+04ry69OV2wULmwhEA6jwSWXO1TwAtIwiPXcvHcoOQUqpyMVd2bDsQJMW8AurjulIyUV8kDqtjSwHy1uQ==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.20.2" }, "engines": { "node": ">=6.9.0" @@ -1119,18 +1119,18 @@ } }, "node_modules/@babel/plugin-transform-classes": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.19.0.tgz", - "integrity": "sha512-YfeEE9kCjqTS9IitkgfJuxjcEtLUHMqa8yUJ6zdz8vR7hKuo6mOy2C05P0F1tdMmDCeuyidKnlrw/iTppHcr2A==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.20.2.tgz", + "integrity": "sha512-9rbPp0lCVVoagvtEyQKSo5L8oo0nQS/iif+lwlAz29MccX2642vWDlSZK+2T2buxbopotId2ld7zZAzRfz9j1g==", "dev": true, "dependencies": { "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-compilation-targets": "^7.19.0", + "@babel/helper-compilation-targets": "^7.20.0", "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-function-name": "^7.19.0", "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-replace-supers": "^7.18.9", + "@babel/helper-plugin-utils": "^7.20.2", + "@babel/helper-replace-supers": "^7.19.1", "@babel/helper-split-export-declaration": "^7.18.6", "globals": "^11.1.0" }, @@ -1157,12 +1157,12 @@ } }, "node_modules/@babel/plugin-transform-destructuring": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.18.13.tgz", - "integrity": "sha512-TodpQ29XekIsex2A+YJPj5ax2plkGa8YYY6mFjCohk/IG9IY42Rtuj1FuDeemfg2ipxIFLzPeA83SIBnlhSIow==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.20.2.tgz", + "integrity": "sha512-mENM+ZHrvEgxLTBXUiQ621rRXZes3KWUv6NdQlrnr1TkWVw+hUjQBZuP2X32qKlrlG2BzgR95gkuCRSkJl8vIw==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.20.2" }, "engines": { "node": ">=6.9.0" @@ -1281,14 +1281,13 @@ } }, "node_modules/@babel/plugin-transform-modules-amd": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.18.6.tgz", - "integrity": "sha512-Pra5aXsmTsOnjM3IajS8rTaLCy++nGM4v3YR4esk5PCsyg9z8NA5oQLwxzMUtDBd8F+UmVza3VxoAaWCbzH1rg==", + "version": "7.19.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.19.6.tgz", + "integrity": "sha512-uG3od2mXvAtIFQIh0xrpLH6r5fpSQN04gIVovl+ODLdUMANokxQLZnPBHcjmv3GxRjnqwLuHvppjjcelqUFZvg==", "dev": true, "dependencies": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-module-transforms": "^7.19.6", + "@babel/helper-plugin-utils": "^7.19.0" }, "engines": { "node": ">=6.9.0" @@ -1298,15 +1297,14 @@ } }, "node_modules/@babel/plugin-transform-modules-commonjs": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.18.6.tgz", - "integrity": "sha512-Qfv2ZOWikpvmedXQJDSbxNqy7Xr/j2Y8/KfijM0iJyKkBTmWuvCA1yeH1yDM7NJhBW/2aXxeucLj6i80/LAJ/Q==", + "version": "7.19.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.19.6.tgz", + "integrity": "sha512-8PIa1ym4XRTKuSsOUXqDG0YaOlEuTVvHMe5JCfgBMOtHvJKw/4NGovEGN33viISshG/rZNVrACiBmPQLvWN8xQ==", "dev": true, "dependencies": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-module-transforms": "^7.19.6", + "@babel/helper-plugin-utils": "^7.19.0", + "@babel/helper-simple-access": "^7.19.4" }, "engines": { "node": ">=6.9.0" @@ -1316,16 +1314,15 @@ } }, "node_modules/@babel/plugin-transform-modules-systemjs": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.19.0.tgz", - "integrity": "sha512-x9aiR0WXAWmOWsqcsnrzGR+ieaTMVyGyffPVA7F8cXAGt/UxefYv6uSHZLkAFChN5M5Iy1+wjE+xJuPt22H39A==", + "version": "7.19.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.19.6.tgz", + "integrity": "sha512-fqGLBepcc3kErfR9R3DnVpURmckXP7gj7bAlrTQyBxrigFqszZCkFkcoxzCp2v32XmwXLvbw+8Yq9/b+QqksjQ==", "dev": true, "dependencies": { "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-module-transforms": "^7.19.0", + "@babel/helper-module-transforms": "^7.19.6", "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-validator-identifier": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-validator-identifier": "^7.19.1" }, "engines": { "node": ">=6.9.0" @@ -1398,12 +1395,12 @@ } }, "node_modules/@babel/plugin-transform-parameters": { - "version": "7.18.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.18.8.tgz", - "integrity": "sha512-ivfbE3X2Ss+Fj8nnXvKJS6sjRG4gzwPMsP+taZC+ZzEGjAYlvENixmt1sZ5Ca6tWls+BlKSGKPJ6OOXvXCbkFg==", + "version": "7.20.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.20.3.tgz", + "integrity": "sha512-oZg/Fpx0YDrj13KsLyO8I/CX3Zdw7z0O9qOd95SqcoIzuqy/WTGWvePeHAnZCN54SfdyjHcb1S30gc8zlzlHcA==", "dev": true, "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.20.2" }, "engines": { "node": ">=6.9.0" @@ -1566,18 +1563,18 @@ } }, "node_modules/@babel/preset-env": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.19.3.tgz", - "integrity": "sha512-ziye1OTc9dGFOAXSWKUqQblYHNlBOaDl8wzqf2iKXJAltYiR3hKHUKmkt+S9PppW7RQpq4fFCrwwpIDj/f5P4w==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.20.2.tgz", + "integrity": "sha512-1G0efQEWR1EHkKvKHqbG+IN/QdgwfByUpM5V5QroDzGV2t3S/WXNQd693cHiHTlCFMpr9B6FkPFXDA2lQcKoDg==", "dev": true, "dependencies": { - "@babel/compat-data": "^7.19.3", - "@babel/helper-compilation-targets": "^7.19.3", - "@babel/helper-plugin-utils": "^7.19.0", + "@babel/compat-data": "^7.20.1", + "@babel/helper-compilation-targets": "^7.20.0", + "@babel/helper-plugin-utils": "^7.20.2", "@babel/helper-validator-option": "^7.18.6", "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.18.6", "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.18.9", - "@babel/plugin-proposal-async-generator-functions": "^7.19.1", + "@babel/plugin-proposal-async-generator-functions": "^7.20.1", "@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-proposal-class-static-block": "^7.18.6", "@babel/plugin-proposal-dynamic-import": "^7.18.6", @@ -1586,7 +1583,7 @@ "@babel/plugin-proposal-logical-assignment-operators": "^7.18.9", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", "@babel/plugin-proposal-numeric-separator": "^7.18.6", - "@babel/plugin-proposal-object-rest-spread": "^7.18.9", + "@babel/plugin-proposal-object-rest-spread": "^7.20.2", "@babel/plugin-proposal-optional-catch-binding": "^7.18.6", "@babel/plugin-proposal-optional-chaining": "^7.18.9", "@babel/plugin-proposal-private-methods": "^7.18.6", @@ -1597,7 +1594,7 @@ "@babel/plugin-syntax-class-static-block": "^7.14.5", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-import-assertions": "^7.18.6", + "@babel/plugin-syntax-import-assertions": "^7.20.0", "@babel/plugin-syntax-json-strings": "^7.8.3", "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", @@ -1610,10 +1607,10 @@ "@babel/plugin-transform-arrow-functions": "^7.18.6", "@babel/plugin-transform-async-to-generator": "^7.18.6", "@babel/plugin-transform-block-scoped-functions": "^7.18.6", - "@babel/plugin-transform-block-scoping": "^7.18.9", - "@babel/plugin-transform-classes": "^7.19.0", + "@babel/plugin-transform-block-scoping": "^7.20.2", + "@babel/plugin-transform-classes": "^7.20.2", "@babel/plugin-transform-computed-properties": "^7.18.9", - "@babel/plugin-transform-destructuring": "^7.18.13", + "@babel/plugin-transform-destructuring": "^7.20.2", "@babel/plugin-transform-dotall-regex": "^7.18.6", "@babel/plugin-transform-duplicate-keys": "^7.18.9", "@babel/plugin-transform-exponentiation-operator": "^7.18.6", @@ -1621,14 +1618,14 @@ "@babel/plugin-transform-function-name": "^7.18.9", "@babel/plugin-transform-literals": "^7.18.9", "@babel/plugin-transform-member-expression-literals": "^7.18.6", - "@babel/plugin-transform-modules-amd": "^7.18.6", - "@babel/plugin-transform-modules-commonjs": "^7.18.6", - "@babel/plugin-transform-modules-systemjs": "^7.19.0", + "@babel/plugin-transform-modules-amd": "^7.19.6", + "@babel/plugin-transform-modules-commonjs": "^7.19.6", + "@babel/plugin-transform-modules-systemjs": "^7.19.6", "@babel/plugin-transform-modules-umd": "^7.18.6", "@babel/plugin-transform-named-capturing-groups-regex": "^7.19.1", "@babel/plugin-transform-new-target": "^7.18.6", "@babel/plugin-transform-object-super": "^7.18.6", - "@babel/plugin-transform-parameters": "^7.18.8", + "@babel/plugin-transform-parameters": "^7.20.1", "@babel/plugin-transform-property-literals": "^7.18.6", "@babel/plugin-transform-regenerator": "^7.18.6", "@babel/plugin-transform-reserved-words": "^7.18.6", @@ -1640,7 +1637,7 @@ "@babel/plugin-transform-unicode-escapes": "^7.18.10", "@babel/plugin-transform-unicode-regex": "^7.18.6", "@babel/preset-modules": "^0.1.5", - "@babel/types": "^7.19.3", + "@babel/types": "^7.20.2", "babel-plugin-polyfill-corejs2": "^0.3.3", "babel-plugin-polyfill-corejs3": "^0.6.0", "babel-plugin-polyfill-regenerator": "^0.4.1", @@ -1706,19 +1703,19 @@ } }, "node_modules/@babel/traverse": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.3.tgz", - "integrity": "sha512-qh5yf6149zhq2sgIXmwjnsvmnNQC2iw70UFjp4olxucKrWd/dvlUsBI88VSLUsnMNF7/vnOiA+nk1+yLoCqROQ==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.20.5.tgz", + "integrity": "sha512-WM5ZNN3JITQIq9tFZaw1ojLU3WgWdtkxnhM1AegMS+PvHjkM5IXjmYEGY7yukz5XS4sJyEf2VzWjI8uAavhxBQ==", "dev": true, "dependencies": { "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.3", + "@babel/generator": "^7.20.5", "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-function-name": "^7.19.0", "@babel/helper-hoist-variables": "^7.18.6", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.19.3", - "@babel/types": "^7.19.3", + "@babel/parser": "^7.20.5", + "@babel/types": "^7.20.5", "debug": "^4.1.0", "globals": "^11.1.0" }, @@ -1727,12 +1724,12 @@ } }, "node_modules/@babel/types": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.19.3.tgz", - "integrity": "sha512-hGCaQzIY22DJlDh9CH7NOxgKkFjBk0Cw9xDO1Xmh2151ti7wiGfQ3LauXzL4HP1fmFlTX6XjpRETTpUcv7wQLw==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.20.5.tgz", + "integrity": "sha512-c9fst/h2/dcF7H+MJKZ2T0KjEQ8hY/BNnDk/H3XY8C4Aw/eWQXWn/lWntHF9ooUBnGmEvbfGrTgLWc+um0YDUg==", "dev": true, "dependencies": { - "@babel/helper-string-parser": "^7.18.10", + "@babel/helper-string-parser": "^7.19.4", "@babel/helper-validator-identifier": "^7.19.1", "to-fast-properties": "^2.0.0" }, @@ -1741,9 +1738,9 @@ } }, "node_modules/@bundle-stats/plugin-webpack-filter": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@bundle-stats/plugin-webpack-filter/-/plugin-webpack-filter-4.1.0.tgz", - "integrity": "sha512-EL+PqTNp3O0gOI03jwz1VEIuz0CpR+K2WO3jpKatFeudMITOzSccwIZdvb07kULsiLLMisRH2ElQe0AX4q5Jcw==", + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/@bundle-stats/plugin-webpack-filter/-/plugin-webpack-filter-4.1.5.tgz", + "integrity": "sha512-XWwRJD5K8wKoiLZg0nxd54IbLPgt8e/A9R2PY6tyDBMNPDa21uobkFk+yyvVIo2h2ovN7/lldqxV7QKF3avlTg==", "engines": { "node": ">= 14.0" }, @@ -1752,12 +1749,12 @@ } }, "node_modules/@bundle-stats/plugin-webpack-validate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@bundle-stats/plugin-webpack-validate/-/plugin-webpack-validate-4.1.0.tgz", - "integrity": "sha512-sZmPC3KkOVTdMxheSqtJ3+wFcXcylthMA3lTWhIw10HGKQyNU7bSFatrac48zhkQLTF0TLdrqJp3ZTuAraixMQ==", + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/@bundle-stats/plugin-webpack-validate/-/plugin-webpack-validate-4.1.5.tgz", + "integrity": "sha512-JwNrx+gczi3vBIKAjsndvX2hRAbXUeOOix9yPmD+X6fePQ5KtlGqNHTbx3qezJm7372zPUyJpil+JMPg58FMlg==", "dependencies": { "lodash": "4.17.21", - "superstruct": "0.16.5" + "superstruct": "1.0.3" }, "engines": { "node": ">= 14.0" @@ -1773,9 +1770,9 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.2.tgz", - "integrity": "sha512-AXYd23w1S/bv3fTs3Lz0vjiYemS08jWkI3hYyS9I1ry+0f+Yjs1wm+sU0BS8qDOPrBIkp4qHYC16I8uVtpLajQ==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", + "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", "dev": true, "dependencies": { "ajv": "^6.12.4", @@ -1811,9 +1808,9 @@ } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.5.tgz", - "integrity": "sha512-XVVDtp+dVvRxMoxSiSfasYaG02VEe1qH5cKgMQJWhol6HwzbcqoCMJi8dAGoYAO57jhUyhI6cWuRiTcRaDaYug==", + "version": "0.11.6", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.6.tgz", + "integrity": "sha512-jJr+hPTJYKyDILJfhNSHsjiwXYf26Flsz8DvNndOsHs5pwSnpGUEy8yzF0JYhCEvTDdV2vuOK5tt8BVhwO5/hg==", "dev": true, "dependencies": { "@humanwhocodes/object-schema": "^1.2.1", @@ -1824,16 +1821,6 @@ "node": ">=10.10.0" } }, - "node_modules/@humanwhocodes/gitignore-to-minimatch": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/gitignore-to-minimatch/-/gitignore-to-minimatch-1.0.2.tgz", - "integrity": "sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==", - "dev": true, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/nzakas" - } - }, "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -2081,21 +2068,21 @@ "deprecated": "Use @octokit/webhooks-types, @octokit/webhooks-schemas, or @octokit/webhooks-examples instead. See https://github.com/octokit/webhooks/issues/447" }, "node_modules/@relative-ci/agent": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/@relative-ci/agent/-/agent-4.1.1.tgz", - "integrity": "sha512-J+ec6c5xQQW3S/ZF9EaN1Eit48s3xJbr9WjcHLO9lXpt3XAY7Wunptv0j2he9rRrO+hhSsGNQyjh9dlSrIYSQg==", - "dependencies": { - "@bundle-stats/plugin-webpack-filter": "4.1.0", - "@bundle-stats/plugin-webpack-validate": "4.1.0", - "core-js": "3.25.5", - "cosmiconfig": "7.0.1", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@relative-ci/agent/-/agent-4.1.2.tgz", + "integrity": "sha512-kJ5PiZDW9tpJGXjBbPvtTxeXfeDWh5PJv/c5fI5fSvLVLtr/sq6smanY0DcyWYv1Ha+3e0IqkOKcLnZFEHn9Ow==", + "dependencies": { + "@bundle-stats/plugin-webpack-filter": "4.1.5", + "@bundle-stats/plugin-webpack-validate": "4.1.5", + "core-js": "3.26.1", + "cosmiconfig": "8.0.0", "debug": "4.3.4", "dotenv": "16.0.3", "env-ci": "7.3.0", - "fs-extra": "10.1.0", + "fs-extra": "11.1.0", "isomorphic-fetch": "3.0.0", "lodash": "4.17.21", - "yargs": "17.6.0" + "yargs": "17.6.2" }, "bin": { "relative-ci-agent": "bin/index.js" @@ -2156,11 +2143,6 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.14.tgz", "integrity": "sha512-SbjLmERksKOGzWzPNuW7fJM7fk3YXVTFiZWB/Hs99gwhk+/dnrQRPBQjPW9aO+fi1tAffi9PrwFvsmOKmDTyng==" }, - "node_modules/@types/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==" - }, "node_modules/@webassemblyjs/helper-numbers": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz", @@ -2182,34 +2164,42 @@ "integrity": "sha512-RlhS8CBCXfRUR/cwo2ho9bkheSXG0+NwooXcc3PAILALf2QLdFyj7KGsKRbVc95hZnhnERon4kW/D3SZpp6Tcg==" }, "node_modules/@webpack-cli/configtest": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz", - "integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.0.0.tgz", + "integrity": "sha512-war4OU8NGjBqU3DP3bx6ciODXIh7dSXcpQq+P4K2Tqyd8L5OjZ7COx9QXx/QdCIwL2qoX09Wr4Cwf7uS4qdEng==", "dev": true, + "engines": { + "node": ">=14.15.0" + }, "peerDependencies": { - "webpack": "4.x.x || 5.x.x", - "webpack-cli": "4.x.x" + "webpack": "5.x.x", + "webpack-cli": "5.x.x" } }, "node_modules/@webpack-cli/info": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz", - "integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-2.0.0.tgz", + "integrity": "sha512-NNxDgbo4VOkNhOlTgY0Elhz3vKpOJq4/PKeKg7r8cmYM+GQA9vDofLYyup8jS6EpUvhNmR30cHTCEIyvXpskwA==", "dev": true, - "dependencies": { - "envinfo": "^7.7.3" + "engines": { + "node": ">=14.15.0" }, "peerDependencies": { - "webpack-cli": "4.x.x" + "webpack": "5.x.x", + "webpack-cli": "5.x.x" } }, "node_modules/@webpack-cli/serve": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz", - "integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-2.0.0.tgz", + "integrity": "sha512-Rumq5mHvGXamnOh3O8yLk1sjx8dB30qF1OeR6VC00DIR6SLJ4bwwUGKC4pE7qBFoQyyh0H9sAg3fikYgAqVR0w==", "dev": true, + "engines": { + "node": ">=14.15.0" + }, "peerDependencies": { - "webpack-cli": "4.x.x" + "webpack": "5.x.x", + "webpack-cli": "5.x.x" }, "peerDependenciesMeta": { "webpack-dev-server": { @@ -2270,6 +2260,45 @@ "url": "https://github.com/sponsors/epoberezkin" } }, + "node_modules/ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/ajv-formats/node_modules/ajv": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, "node_modules/ajv-keywords": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", @@ -2300,8 +2329,7 @@ "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, "node_modules/array-includes": { "version": "3.1.4", @@ -2323,15 +2351,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/array.prototype.flat": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz", @@ -2351,22 +2370,20 @@ } }, "node_modules/babel-loader": { - "version": "8.2.5", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.2.5.tgz", - "integrity": "sha512-OSiFfH89LrEMiWd4pLNqGz4CwJDtbs2ZVc+iGu2HrkRfPxId9F2anQj38IxWpmRfsUY0aBZYi1EFcd3mhtRMLQ==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.1.0.tgz", + "integrity": "sha512-Antt61KJPinUMwHwIIz9T5zfMgevnfZkEVWYDWlG888fgdvRRGD0JTuf/fFozQnfT+uq64sk1bmdHDy/mOEWnA==", "dev": true, "dependencies": { - "find-cache-dir": "^3.3.1", - "loader-utils": "^2.0.0", - "make-dir": "^3.1.0", - "schema-utils": "^2.6.5" + "find-cache-dir": "^3.3.2", + "schema-utils": "^4.0.0" }, "engines": { - "node": ">= 8.9" + "node": ">= 14.15.0" }, "peerDependencies": { - "@babel/core": "^7.0.0", - "webpack": ">=2" + "@babel/core": "^7.12.0", + "webpack": ">=5" } }, "node_modules/babel-loader/node_modules/find-cache-dir": { @@ -2401,24 +2418,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/babel-loader/node_modules/schema-utils": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz", - "integrity": "sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==", - "dev": true, - "dependencies": { - "@types/json-schema": "^7.0.5", - "ajv": "^6.12.4", - "ajv-keywords": "^3.5.2" - }, - "engines": { - "node": ">= 8.9.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" - } - }, "node_modules/babel-loader/node_modules/semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", @@ -2428,15 +2427,6 @@ "semver": "bin/semver.js" } }, - "node_modules/babel-plugin-dynamic-import-node": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", - "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", - "dev": true, - "dependencies": { - "object.assign": "^4.1.0" - } - }, "node_modules/babel-plugin-polyfill-corejs2": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.3.tgz", @@ -2496,15 +2486,6 @@ "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz", "integrity": "sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ==" }, - "node_modules/big.js": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", - "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", - "dev": true, - "engines": { - "node": "*" - } - }, "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -2663,12 +2644,12 @@ "dev": true }, "node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.4.1.tgz", + "integrity": "sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==", "dev": true, "engines": { - "node": ">= 10" + "node": "^12.20.0 || >=14" } }, "node_modules/commondir": { @@ -2705,9 +2686,9 @@ "dev": true }, "node_modules/core-js": { - "version": "3.25.5", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.25.5.tgz", - "integrity": "sha512-nbm6eZSjm+ZuBQxCUPQKQCoUEfFOXjUZ8dTTyikyKaWrTYmAVbykQfwsKE5dBK88u3QCkCrzsx/PPlKfhsvgpw==", + "version": "3.26.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.26.1.tgz", + "integrity": "sha512-21491RRQVzUn0GGM9Z1Jrpr6PNPxPi+Za8OM9q4tksTSnlbXXGKK1nXNg/QvwFYettXvSX6zWKCtHHfjN4puyA==", "hasInstallScript": true, "funding": { "type": "opencollective", @@ -2728,18 +2709,17 @@ } }, "node_modules/cosmiconfig": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", - "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.0.0.tgz", + "integrity": "sha512-da1EafcpH6b/TD8vDRaWV7xFINlHlF6zKsGwS1TsuVJTZRkquaS5HTMq7uq6h31619QjbsYl21gVDOm32KM1vQ==", "dependencies": { - "@types/parse-json": "^4.0.0", "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.10.0" + "path-type": "^4.0.0" }, "engines": { - "node": ">=10" + "node": ">=14" } }, "node_modules/cross-spawn": { @@ -2794,18 +2774,6 @@ "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -2836,15 +2804,6 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, - "node_modules/emojis-list": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", - "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", - "dev": true, - "engines": { - "node": ">= 4" - } - }, "node_modules/encoding": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", @@ -2972,15 +2931,15 @@ } }, "node_modules/eslint": { - "version": "8.24.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.24.0.tgz", - "integrity": "sha512-dWFaPhGhTAiPcCgm3f6LI2MBWbogMnTJzFBbhXVRQDJPkr9pGZvVjlVfXd+vyDcWPA2Ic9L2AXPIQM0+vk/cSQ==", + "version": "8.29.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.29.0.tgz", + "integrity": "sha512-isQ4EEiyUjZFbEKvEGJKKGBwXtvXX+zJbkVKCgTuB9t/+jUBcy8avhkEwWJecI15BkRkOYmvIM5ynbhRjEkoeg==", "dev": true, "dependencies": { - "@eslint/eslintrc": "^1.3.2", - "@humanwhocodes/config-array": "^0.10.5", - "@humanwhocodes/gitignore-to-minimatch": "^1.0.2", + "@eslint/eslintrc": "^1.3.3", + "@humanwhocodes/config-array": "^0.11.6", "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -2996,14 +2955,14 @@ "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", - "glob-parent": "^6.0.1", + "glob-parent": "^6.0.2", "globals": "^13.15.0", - "globby": "^11.1.0", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", @@ -3568,22 +3527,6 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, - "node_modules/fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", - "dev": true, - "dependencies": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - }, - "engines": { - "node": ">=8.6.0" - } - }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -3701,16 +3644,16 @@ ] }, "node_modules/fs-extra": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.0.tgz", + "integrity": "sha512-0rcTq621PD5jM/e0a3EJoGC/1TC5ZBCERW82LQuwfGnCa1V8w7dpYH1yNu+SLb6E5dkeCBzKEyLGlFrnr+dUyw==", "dependencies": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" }, "engines": { - "node": ">=12" + "node": ">=14.14" } }, "node_modules/fs.realpath": { @@ -3803,18 +3746,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/glob-to-regexp": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", @@ -3829,26 +3760,6 @@ "node": ">=4" } }, - "node_modules/globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "dependencies": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/graceful-fs": { "version": "4.2.9", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", @@ -4019,18 +3930,18 @@ } }, "node_modules/interpret": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", - "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", + "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", "dev": true, "engines": { - "node": ">= 0.10" + "node": ">=10.13.0" } }, "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" }, "node_modules/is-bigint": { "version": "1.0.4", @@ -4164,6 +4075,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -4335,7 +4255,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, "dependencies": { "argparse": "^2.0.1" }, @@ -4422,32 +4341,6 @@ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, - "node_modules/loader-utils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz", - "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==", - "dev": true, - "dependencies": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - }, - "engines": { - "node": ">=8.9.0" - } - }, - "node_modules/loader-utils/node_modules/json5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", - "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", - "dev": true, - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -4494,15 +4387,6 @@ "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" }, - "node_modules/merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true, - "engines": { - "node": ">= 8" - } - }, "node_modules/micromatch": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", @@ -4899,15 +4783,15 @@ } }, "node_modules/rechoir": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", - "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", "dev": true, "dependencies": { - "resolve": "^1.9.0" + "resolve": "^1.20.0" }, "engines": { - "node": ">= 0.10" + "node": ">= 10.13.0" } }, "node_modules/regenerate": { @@ -5007,6 +4891,15 @@ "node": ">=0.10.0" } }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/resolve": { "version": "1.22.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", @@ -5111,6 +5004,59 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "devOptional": true }, + "node_modules/schema-utils": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", + "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.8.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.0.0" + }, + "engines": { + "node": ">= 12.13.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/webpack" + } + }, + "node_modules/schema-utils/node_modules/ajv": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/schema-utils/node_modules/ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.3" + }, + "peerDependencies": { + "ajv": "^8.8.2" + } + }, + "node_modules/schema-utils/node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + }, "node_modules/semver": { "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", @@ -5184,15 +5130,6 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, - "node_modules/slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -5291,9 +5228,9 @@ } }, "node_modules/superstruct": { - "version": "0.16.5", - "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.16.5.tgz", - "integrity": "sha512-GBa1VPdCUDAIrsoMVy2lzE/hKQnieUlc1JVoVzJ2YLx47SoPY4AqF85Ht1bPg5r+8I0v54GbaRdNTnYQ0p+T+Q==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.3.tgz", + "integrity": "sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg==", "engines": { "node": ">=14.0.0" } @@ -5449,9 +5386,9 @@ "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" }, "node_modules/ts-loader": { - "version": "9.4.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.1.tgz", - "integrity": "sha512-384TYAqGs70rn9F0VBnh6BPTfhga7yFNdC5gXbQpDrBj9/KsT4iRkGqKXhziofHOlE2j6YEaiTYVGKKvPhGWvw==", + "version": "9.4.2", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.2.tgz", + "integrity": "sha512-OmlC4WVmFv5I0PpaxYb+qGeGOdm5giHU7HwDDUjw59emP2UYMHy9fFSDcYgSNoH8sXcj4hGCSEhlDZ9ULeDraA==", "dev": true, "dependencies": { "chalk": "^4.1.0", @@ -5583,9 +5520,9 @@ } }, "node_modules/typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz", + "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -5722,9 +5659,9 @@ "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" }, "node_modules/webpack": { - "version": "5.74.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.74.0.tgz", - "integrity": "sha512-A2InDwnhhGN4LYctJj6M1JEaGL7Luj6LOmyBHjcI8529cm5p6VXiTIW2sn6ffvEAKmveLzvu4jrihwXtPojlAA==", + "version": "5.75.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.75.0.tgz", + "integrity": "sha512-piaIaoVJlqMsPtX/+3KTTO6jfvrSYgauFVdt8cr9LTHKmcq/AMd4mhzsiP7ZF/PGRNPGA8336jldh9l2Kt2ogQ==", "dependencies": { "@types/eslint-scope": "^3.7.3", "@types/estree": "^0.0.51", @@ -5768,44 +5705,42 @@ } }, "node_modules/webpack-cli": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz", - "integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.0.0.tgz", + "integrity": "sha512-AACDTo20yG+xn6HPW5xjbn2Be4KUzQPebWXsDMHwPPyKh9OnTOJgZN2Nc+g/FZKV3ObRTYsGvibAvc+5jAUrVA==", "dev": true, "dependencies": { "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^1.2.0", - "@webpack-cli/info": "^1.5.0", - "@webpack-cli/serve": "^1.7.0", + "@webpack-cli/configtest": "^2.0.0", + "@webpack-cli/info": "^2.0.0", + "@webpack-cli/serve": "^2.0.0", "colorette": "^2.0.14", - "commander": "^7.0.0", + "commander": "^9.4.1", "cross-spawn": "^7.0.3", + "envinfo": "^7.7.3", "fastest-levenshtein": "^1.0.12", "import-local": "^3.0.2", - "interpret": "^2.2.0", - "rechoir": "^0.7.0", + "interpret": "^3.1.1", + "rechoir": "^0.8.0", "webpack-merge": "^5.7.3" }, "bin": { "webpack-cli": "bin/cli.js" }, "engines": { - "node": ">=10.13.0" + "node": ">=14.15.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" }, "peerDependencies": { - "webpack": "4.x.x || 5.x.x" + "webpack": "5.x.x" }, "peerDependenciesMeta": { "@webpack-cli/generators": { "optional": true }, - "@webpack-cli/migrate": { - "optional": true - }, "webpack-bundle-analyzer": { "optional": true }, @@ -6120,18 +6055,10 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, - "node_modules/yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", - "engines": { - "node": ">= 6" - } - }, "node_modules/yargs": { - "version": "17.6.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.0.tgz", - "integrity": "sha512-8H/wTDqlSwoSnScvV2N/JHfLWOKuh5MVla9hqLjK3nsfyy6Y4kDSYSvkU5YCUEPOSnRXfIyx3Sq+B/IWudTo4g==", + "version": "17.6.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", + "integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==", "dependencies": { "cliui": "^8.0.1", "escalade": "^3.1.1", @@ -6139,7 +6066,7 @@ "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^21.0.0" + "yargs-parser": "^21.1.1" }, "engines": { "node": ">=12" @@ -6214,27 +6141,27 @@ } }, "@babel/compat-data": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.19.3.tgz", - "integrity": "sha512-prBHMK4JYYK+wDjJF1q99KK4JLL+egWS4nmNqdlMUgCExMZ+iZW0hGhyC3VEbsPjvaN0TBhW//VIFwBrk8sEiw==", + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.20.1.tgz", + "integrity": "sha512-EWZ4mE2diW3QALKvDMiXnbZpRvlj+nayZ112nK93SnhqOtpdsbVD4W+2tEoT3YNBAG9RBR0ISY758ZkOgsn6pQ==", "dev": true }, "@babel/core": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.19.3.tgz", - "integrity": "sha512-WneDJxdsjEvyKtXKsaBGbDeiyOjR5vYq4HcShxnIbG0qixpoHjI3MqeZM9NDvsojNCEBItQE4juOo/bU6e72gQ==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.20.5.tgz", + "integrity": "sha512-UdOWmk4pNWTm/4DlPUl/Pt4Gz4rcEMb7CY0Y3eJl5Yz1vI8ZJGmHWaVE55LoxRjdpx0z259GE9U5STA9atUinQ==", "dev": true, "requires": { "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.3", - "@babel/helper-compilation-targets": "^7.19.3", - "@babel/helper-module-transforms": "^7.19.0", - "@babel/helpers": "^7.19.0", - "@babel/parser": "^7.19.3", + "@babel/generator": "^7.20.5", + "@babel/helper-compilation-targets": "^7.20.0", + "@babel/helper-module-transforms": "^7.20.2", + "@babel/helpers": "^7.20.5", + "@babel/parser": "^7.20.5", "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.3", - "@babel/types": "^7.19.3", + "@babel/traverse": "^7.20.5", + "@babel/types": "^7.20.5", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -6282,12 +6209,12 @@ } }, "@babel/generator": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.3.tgz", - "integrity": "sha512-fqVZnmp1ncvZU757UzDheKZpfPgatqY59XtW2/j/18H7u76akb8xqvjw82f+i2UKd/ksYsSick/BCLQUUtJ/qQ==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.20.5.tgz", + "integrity": "sha512-jl7JY2Ykn9S0yj4DQP82sYvPU+T3g0HFcWTqDLqiuA9tGRNIj9VfbtXGAYTTkyNEnQk1jkMGOdYka8aG/lulCA==", "dev": true, "requires": { - "@babel/types": "^7.19.3", + "@babel/types": "^7.20.5", "@jridgewell/gen-mapping": "^0.3.2", "jsesc": "^2.5.1" }, @@ -6325,12 +6252,12 @@ } }, "@babel/helper-compilation-targets": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.3.tgz", - "integrity": "sha512-65ESqLGyGmLvgR0mst5AdW1FkNlj9rQsCKduzEoEPhBCDFGXvz2jW6bXFG6i0/MrV2s7hhXjjb2yAzcPuQlLwg==", + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.20.0.tgz", + "integrity": "sha512-0jp//vDGp9e8hZzBc6N/KwA5ZK3Wsm/pfm4CrY7vzegkVxc65SgSn6wYOnwHe9Js9HRQ1YTCKLGPzDtaS3RoLQ==", "dev": true, "requires": { - "@babel/compat-data": "^7.19.3", + "@babel/compat-data": "^7.20.0", "@babel/helper-validator-option": "^7.18.6", "browserslist": "^4.21.3", "semver": "^6.3.0" @@ -6444,19 +6371,19 @@ } }, "@babel/helper-module-transforms": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.19.0.tgz", - "integrity": "sha512-3HBZ377Fe14RbLIA+ac3sY4PTgpxHVkFrESaWhoI5PuyXPBBX8+C34qblV9G89ZtycGJCmCI/Ut+VUDK4bltNQ==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.20.2.tgz", + "integrity": "sha512-zvBKyJXRbmK07XhMuujYoJ48B5yvvmM6+wcpv6Ivj4Yg6qO7NOZOSnvZN9CRl1zz1Z4cKf8YejmCMh8clOoOeA==", "dev": true, "requires": { "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-module-imports": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", + "@babel/helper-simple-access": "^7.20.2", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/helper-validator-identifier": "^7.18.6", + "@babel/helper-validator-identifier": "^7.19.1", "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.0", - "@babel/types": "^7.19.0" + "@babel/traverse": "^7.20.1", + "@babel/types": "^7.20.2" } }, "@babel/helper-optimise-call-expression": { @@ -6469,9 +6396,9 @@ } }, "@babel/helper-plugin-utils": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.19.0.tgz", - "integrity": "sha512-40Ryx7I8mT+0gaNxm8JGTZFUITNqdLAgdg0hXzeVZxVD6nFsdhQvip6v8dqkRHzsz1VFpFAaOCHNn0vKBL7Czw==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.20.2.tgz", + "integrity": "sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==", "dev": true }, "@babel/helper-remap-async-to-generator": { @@ -6487,25 +6414,25 @@ } }, "@babel/helper-replace-supers": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.18.9.tgz", - "integrity": "sha512-dNsWibVI4lNT6HiuOIBr1oyxo40HvIVmbwPUm3XZ7wMh4k2WxrxTqZwSqw/eEmXDS9np0ey5M2bz9tBmO9c+YQ==", + "version": "7.19.1", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.19.1.tgz", + "integrity": "sha512-T7ahH7wV0Hfs46SFh5Jz3s0B6+o8g3c+7TMxu7xKfmHikg7EAZ3I2Qk9LFhjxXq8sL7UkP5JflezNwoZa8WvWw==", "dev": true, "requires": { "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-member-expression-to-functions": "^7.18.9", "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/traverse": "^7.18.9", - "@babel/types": "^7.18.9" + "@babel/traverse": "^7.19.1", + "@babel/types": "^7.19.0" } }, "@babel/helper-simple-access": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.18.6.tgz", - "integrity": "sha512-iNpIgTgyAvDQpDj76POqg+YEt8fPxx3yaNBg3S30dxNKm2SWfYhD0TGrK/Eu9wHpUW63VQU894TsTg+GLbUa1g==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.20.2.tgz", + "integrity": "sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==", "dev": true, "requires": { - "@babel/types": "^7.18.6" + "@babel/types": "^7.20.2" } }, "@babel/helper-skip-transparent-expression-wrappers": { @@ -6527,9 +6454,9 @@ } }, "@babel/helper-string-parser": { - "version": "7.18.10", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.18.10.tgz", - "integrity": "sha512-XtIfWmeNY3i4t7t4D2t02q50HvqHybPqW2ki1kosnvWCwuCMeo81Jf0gwr85jy/neUdg5XDdeFE/80DXiO+njw==", + "version": "7.19.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", + "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", "dev": true }, "@babel/helper-validator-identifier": { @@ -6556,14 +6483,14 @@ } }, "@babel/helpers": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.19.0.tgz", - "integrity": "sha512-DRBCKGwIEdqY3+rPJgG/dKfQy9+08rHIAJx8q2p+HSWP87s2HCrQmaAMMyMll2kIXKCW0cO1RdQskx15Xakftg==", + "version": "7.20.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.20.6.tgz", + "integrity": "sha512-Pf/OjgfgFRW5bApskEz5pvidpim7tEDPlFtKcNRXWmfHGn9IEI2W2flqRQXTFb7gIPTyK++N6rVHuwKut4XK6w==", "dev": true, "requires": { "@babel/template": "^7.18.10", - "@babel/traverse": "^7.19.0", - "@babel/types": "^7.19.0" + "@babel/traverse": "^7.20.5", + "@babel/types": "^7.20.5" } }, "@babel/highlight": { @@ -6577,9 +6504,9 @@ } }, "@babel/parser": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.3.tgz", - "integrity": "sha512-pJ9xOlNWHiy9+FuFP09DEAFbAn4JskgRsVcc169w2xRBC3FRGuQEwjeIMMND9L2zc0iEhO/tGv4Zq+km+hxNpQ==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.20.5.tgz", + "integrity": "sha512-r27t/cy/m9uKLXQNWWebeCUHgnAZq0CpG1OwKRxzJMP1vpSU4bSIK2hq+/cp0bQxetkXx38n09rNu8jVkcK/zA==", "dev": true }, "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { @@ -6603,9 +6530,9 @@ } }, "@babel/plugin-proposal-async-generator-functions": { - "version": "7.19.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.19.1.tgz", - "integrity": "sha512-0yu8vNATgLy4ivqMNBIwb1HebCelqN7YX8SL3FDXORv/RqT0zEEWUCH4GH44JsSrvCu6GqnAdR5EBFAPeNBB4Q==", + "version": "7.20.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.20.1.tgz", + "integrity": "sha512-Gh5rchzSwE4kC+o/6T8waD0WHEQIsDmjltY8WnWRXHUdH8axZhuH86Ov9M72YhJfDrZseQwuuWaaIT/TmePp3g==", "dev": true, "requires": { "@babel/helper-environment-visitor": "^7.18.9", @@ -6696,16 +6623,16 @@ } }, "@babel/plugin-proposal-object-rest-spread": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.18.9.tgz", - "integrity": "sha512-kDDHQ5rflIeY5xl69CEqGEZ0KY369ehsCIEbTGb4siHG5BE9sga/T0r0OUwyZNLMmZE79E1kbsqAjwFCW4ds6Q==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.20.2.tgz", + "integrity": "sha512-Ks6uej9WFK+fvIMesSqbAto5dD8Dz4VuuFvGJFKgIGSkJuRGcrwGECPA1fDgQK3/DbExBJpEkTeYeB8geIFCSQ==", "dev": true, "requires": { - "@babel/compat-data": "^7.18.8", - "@babel/helper-compilation-targets": "^7.18.9", - "@babel/helper-plugin-utils": "^7.18.9", + "@babel/compat-data": "^7.20.1", + "@babel/helper-compilation-targets": "^7.20.0", + "@babel/helper-plugin-utils": "^7.20.2", "@babel/plugin-syntax-object-rest-spread": "^7.8.3", - "@babel/plugin-transform-parameters": "^7.18.8" + "@babel/plugin-transform-parameters": "^7.20.1" } }, "@babel/plugin-proposal-optional-catch-binding": { @@ -6807,12 +6734,12 @@ } }, "@babel/plugin-syntax-import-assertions": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.18.6.tgz", - "integrity": "sha512-/DU3RXad9+bZwrgWJQKbr39gYbJpLJHezqEzRzi/BHRlJ9zsQb4CK2CA/5apllXNomwA1qHwzvHl+AdEmC5krQ==", + "version": "7.20.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.20.0.tgz", + "integrity": "sha512-IUh1vakzNoWalR8ch/areW7qFopR2AEw03JlG7BbrDqmQ4X3q9uuipQwSGrUn7oGiemKjtSLDhNtQHzMHr1JdQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.19.0" } }, "@babel/plugin-syntax-json-strings": { @@ -6926,27 +6853,27 @@ } }, "@babel/plugin-transform-block-scoping": { - "version": "7.18.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.18.9.tgz", - "integrity": "sha512-5sDIJRV1KtQVEbt/EIBwGy4T01uYIo4KRB3VUqzkhrAIOGx7AoctL9+Ux88btY0zXdDyPJ9mW+bg+v+XEkGmtw==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.20.2.tgz", + "integrity": "sha512-y5V15+04ry69OV2wULmwhEA6jwSWXO1TwAtIwiPXcvHcoOQUqpyMVd2bDsQJMW8AurjulIyUV8kDqtjSwHy1uQ==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.20.2" } }, "@babel/plugin-transform-classes": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.19.0.tgz", - "integrity": "sha512-YfeEE9kCjqTS9IitkgfJuxjcEtLUHMqa8yUJ6zdz8vR7hKuo6mOy2C05P0F1tdMmDCeuyidKnlrw/iTppHcr2A==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.20.2.tgz", + "integrity": "sha512-9rbPp0lCVVoagvtEyQKSo5L8oo0nQS/iif+lwlAz29MccX2642vWDlSZK+2T2buxbopotId2ld7zZAzRfz9j1g==", "dev": true, "requires": { "@babel/helper-annotate-as-pure": "^7.18.6", - "@babel/helper-compilation-targets": "^7.19.0", + "@babel/helper-compilation-targets": "^7.20.0", "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-function-name": "^7.19.0", "@babel/helper-optimise-call-expression": "^7.18.6", - "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-replace-supers": "^7.18.9", + "@babel/helper-plugin-utils": "^7.20.2", + "@babel/helper-replace-supers": "^7.19.1", "@babel/helper-split-export-declaration": "^7.18.6", "globals": "^11.1.0" } @@ -6961,12 +6888,12 @@ } }, "@babel/plugin-transform-destructuring": { - "version": "7.18.13", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.18.13.tgz", - "integrity": "sha512-TodpQ29XekIsex2A+YJPj5ax2plkGa8YYY6mFjCohk/IG9IY42Rtuj1FuDeemfg2ipxIFLzPeA83SIBnlhSIow==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.20.2.tgz", + "integrity": "sha512-mENM+ZHrvEgxLTBXUiQ621rRXZes3KWUv6NdQlrnr1TkWVw+hUjQBZuP2X32qKlrlG2BzgR95gkuCRSkJl8vIw==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.9" + "@babel/helper-plugin-utils": "^7.20.2" } }, "@babel/plugin-transform-dotall-regex": { @@ -7037,39 +6964,36 @@ } }, "@babel/plugin-transform-modules-amd": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.18.6.tgz", - "integrity": "sha512-Pra5aXsmTsOnjM3IajS8rTaLCy++nGM4v3YR4esk5PCsyg9z8NA5oQLwxzMUtDBd8F+UmVza3VxoAaWCbzH1rg==", + "version": "7.19.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.19.6.tgz", + "integrity": "sha512-uG3od2mXvAtIFQIh0xrpLH6r5fpSQN04gIVovl+ODLdUMANokxQLZnPBHcjmv3GxRjnqwLuHvppjjcelqUFZvg==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-module-transforms": "^7.19.6", + "@babel/helper-plugin-utils": "^7.19.0" } }, "@babel/plugin-transform-modules-commonjs": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.18.6.tgz", - "integrity": "sha512-Qfv2ZOWikpvmedXQJDSbxNqy7Xr/j2Y8/KfijM0iJyKkBTmWuvCA1yeH1yDM7NJhBW/2aXxeucLj6i80/LAJ/Q==", + "version": "7.19.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.19.6.tgz", + "integrity": "sha512-8PIa1ym4XRTKuSsOUXqDG0YaOlEuTVvHMe5JCfgBMOtHvJKw/4NGovEGN33viISshG/rZNVrACiBmPQLvWN8xQ==", "dev": true, "requires": { - "@babel/helper-module-transforms": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/helper-simple-access": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-module-transforms": "^7.19.6", + "@babel/helper-plugin-utils": "^7.19.0", + "@babel/helper-simple-access": "^7.19.4" } }, "@babel/plugin-transform-modules-systemjs": { - "version": "7.19.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.19.0.tgz", - "integrity": "sha512-x9aiR0WXAWmOWsqcsnrzGR+ieaTMVyGyffPVA7F8cXAGt/UxefYv6uSHZLkAFChN5M5Iy1+wjE+xJuPt22H39A==", + "version": "7.19.6", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.19.6.tgz", + "integrity": "sha512-fqGLBepcc3kErfR9R3DnVpURmckXP7gj7bAlrTQyBxrigFqszZCkFkcoxzCp2v32XmwXLvbw+8Yq9/b+QqksjQ==", "dev": true, "requires": { "@babel/helper-hoist-variables": "^7.18.6", - "@babel/helper-module-transforms": "^7.19.0", + "@babel/helper-module-transforms": "^7.19.6", "@babel/helper-plugin-utils": "^7.19.0", - "@babel/helper-validator-identifier": "^7.18.6", - "babel-plugin-dynamic-import-node": "^2.3.3" + "@babel/helper-validator-identifier": "^7.19.1" } }, "@babel/plugin-transform-modules-umd": { @@ -7112,12 +7036,12 @@ } }, "@babel/plugin-transform-parameters": { - "version": "7.18.8", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.18.8.tgz", - "integrity": "sha512-ivfbE3X2Ss+Fj8nnXvKJS6sjRG4gzwPMsP+taZC+ZzEGjAYlvENixmt1sZ5Ca6tWls+BlKSGKPJ6OOXvXCbkFg==", + "version": "7.20.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.20.3.tgz", + "integrity": "sha512-oZg/Fpx0YDrj13KsLyO8I/CX3Zdw7z0O9qOd95SqcoIzuqy/WTGWvePeHAnZCN54SfdyjHcb1S30gc8zlzlHcA==", "dev": true, "requires": { - "@babel/helper-plugin-utils": "^7.18.6" + "@babel/helper-plugin-utils": "^7.20.2" } }, "@babel/plugin-transform-property-literals": { @@ -7214,18 +7138,18 @@ } }, "@babel/preset-env": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.19.3.tgz", - "integrity": "sha512-ziye1OTc9dGFOAXSWKUqQblYHNlBOaDl8wzqf2iKXJAltYiR3hKHUKmkt+S9PppW7RQpq4fFCrwwpIDj/f5P4w==", + "version": "7.20.2", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.20.2.tgz", + "integrity": "sha512-1G0efQEWR1EHkKvKHqbG+IN/QdgwfByUpM5V5QroDzGV2t3S/WXNQd693cHiHTlCFMpr9B6FkPFXDA2lQcKoDg==", "dev": true, "requires": { - "@babel/compat-data": "^7.19.3", - "@babel/helper-compilation-targets": "^7.19.3", - "@babel/helper-plugin-utils": "^7.19.0", + "@babel/compat-data": "^7.20.1", + "@babel/helper-compilation-targets": "^7.20.0", + "@babel/helper-plugin-utils": "^7.20.2", "@babel/helper-validator-option": "^7.18.6", "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.18.6", "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.18.9", - "@babel/plugin-proposal-async-generator-functions": "^7.19.1", + "@babel/plugin-proposal-async-generator-functions": "^7.20.1", "@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-proposal-class-static-block": "^7.18.6", "@babel/plugin-proposal-dynamic-import": "^7.18.6", @@ -7234,7 +7158,7 @@ "@babel/plugin-proposal-logical-assignment-operators": "^7.18.9", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", "@babel/plugin-proposal-numeric-separator": "^7.18.6", - "@babel/plugin-proposal-object-rest-spread": "^7.18.9", + "@babel/plugin-proposal-object-rest-spread": "^7.20.2", "@babel/plugin-proposal-optional-catch-binding": "^7.18.6", "@babel/plugin-proposal-optional-chaining": "^7.18.9", "@babel/plugin-proposal-private-methods": "^7.18.6", @@ -7245,7 +7169,7 @@ "@babel/plugin-syntax-class-static-block": "^7.14.5", "@babel/plugin-syntax-dynamic-import": "^7.8.3", "@babel/plugin-syntax-export-namespace-from": "^7.8.3", - "@babel/plugin-syntax-import-assertions": "^7.18.6", + "@babel/plugin-syntax-import-assertions": "^7.20.0", "@babel/plugin-syntax-json-strings": "^7.8.3", "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", @@ -7258,10 +7182,10 @@ "@babel/plugin-transform-arrow-functions": "^7.18.6", "@babel/plugin-transform-async-to-generator": "^7.18.6", "@babel/plugin-transform-block-scoped-functions": "^7.18.6", - "@babel/plugin-transform-block-scoping": "^7.18.9", - "@babel/plugin-transform-classes": "^7.19.0", + "@babel/plugin-transform-block-scoping": "^7.20.2", + "@babel/plugin-transform-classes": "^7.20.2", "@babel/plugin-transform-computed-properties": "^7.18.9", - "@babel/plugin-transform-destructuring": "^7.18.13", + "@babel/plugin-transform-destructuring": "^7.20.2", "@babel/plugin-transform-dotall-regex": "^7.18.6", "@babel/plugin-transform-duplicate-keys": "^7.18.9", "@babel/plugin-transform-exponentiation-operator": "^7.18.6", @@ -7269,14 +7193,14 @@ "@babel/plugin-transform-function-name": "^7.18.9", "@babel/plugin-transform-literals": "^7.18.9", "@babel/plugin-transform-member-expression-literals": "^7.18.6", - "@babel/plugin-transform-modules-amd": "^7.18.6", - "@babel/plugin-transform-modules-commonjs": "^7.18.6", - "@babel/plugin-transform-modules-systemjs": "^7.19.0", + "@babel/plugin-transform-modules-amd": "^7.19.6", + "@babel/plugin-transform-modules-commonjs": "^7.19.6", + "@babel/plugin-transform-modules-systemjs": "^7.19.6", "@babel/plugin-transform-modules-umd": "^7.18.6", "@babel/plugin-transform-named-capturing-groups-regex": "^7.19.1", "@babel/plugin-transform-new-target": "^7.18.6", "@babel/plugin-transform-object-super": "^7.18.6", - "@babel/plugin-transform-parameters": "^7.18.8", + "@babel/plugin-transform-parameters": "^7.20.1", "@babel/plugin-transform-property-literals": "^7.18.6", "@babel/plugin-transform-regenerator": "^7.18.6", "@babel/plugin-transform-reserved-words": "^7.18.6", @@ -7288,7 +7212,7 @@ "@babel/plugin-transform-unicode-escapes": "^7.18.10", "@babel/plugin-transform-unicode-regex": "^7.18.6", "@babel/preset-modules": "^0.1.5", - "@babel/types": "^7.19.3", + "@babel/types": "^7.20.2", "babel-plugin-polyfill-corejs2": "^0.3.3", "babel-plugin-polyfill-corejs3": "^0.6.0", "babel-plugin-polyfill-regenerator": "^0.4.1", @@ -7338,47 +7262,47 @@ } }, "@babel/traverse": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.3.tgz", - "integrity": "sha512-qh5yf6149zhq2sgIXmwjnsvmnNQC2iw70UFjp4olxucKrWd/dvlUsBI88VSLUsnMNF7/vnOiA+nk1+yLoCqROQ==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.20.5.tgz", + "integrity": "sha512-WM5ZNN3JITQIq9tFZaw1ojLU3WgWdtkxnhM1AegMS+PvHjkM5IXjmYEGY7yukz5XS4sJyEf2VzWjI8uAavhxBQ==", "dev": true, "requires": { "@babel/code-frame": "^7.18.6", - "@babel/generator": "^7.19.3", + "@babel/generator": "^7.20.5", "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-function-name": "^7.19.0", "@babel/helper-hoist-variables": "^7.18.6", "@babel/helper-split-export-declaration": "^7.18.6", - "@babel/parser": "^7.19.3", - "@babel/types": "^7.19.3", + "@babel/parser": "^7.20.5", + "@babel/types": "^7.20.5", "debug": "^4.1.0", "globals": "^11.1.0" } }, "@babel/types": { - "version": "7.19.3", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.19.3.tgz", - "integrity": "sha512-hGCaQzIY22DJlDh9CH7NOxgKkFjBk0Cw9xDO1Xmh2151ti7wiGfQ3LauXzL4HP1fmFlTX6XjpRETTpUcv7wQLw==", + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.20.5.tgz", + "integrity": "sha512-c9fst/h2/dcF7H+MJKZ2T0KjEQ8hY/BNnDk/H3XY8C4Aw/eWQXWn/lWntHF9ooUBnGmEvbfGrTgLWc+um0YDUg==", "dev": true, "requires": { - "@babel/helper-string-parser": "^7.18.10", + "@babel/helper-string-parser": "^7.19.4", "@babel/helper-validator-identifier": "^7.19.1", "to-fast-properties": "^2.0.0" } }, "@bundle-stats/plugin-webpack-filter": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@bundle-stats/plugin-webpack-filter/-/plugin-webpack-filter-4.1.0.tgz", - "integrity": "sha512-EL+PqTNp3O0gOI03jwz1VEIuz0CpR+K2WO3jpKatFeudMITOzSccwIZdvb07kULsiLLMisRH2ElQe0AX4q5Jcw==", + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/@bundle-stats/plugin-webpack-filter/-/plugin-webpack-filter-4.1.5.tgz", + "integrity": "sha512-XWwRJD5K8wKoiLZg0nxd54IbLPgt8e/A9R2PY6tyDBMNPDa21uobkFk+yyvVIo2h2ovN7/lldqxV7QKF3avlTg==", "requires": {} }, "@bundle-stats/plugin-webpack-validate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@bundle-stats/plugin-webpack-validate/-/plugin-webpack-validate-4.1.0.tgz", - "integrity": "sha512-sZmPC3KkOVTdMxheSqtJ3+wFcXcylthMA3lTWhIw10HGKQyNU7bSFatrac48zhkQLTF0TLdrqJp3ZTuAraixMQ==", + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/@bundle-stats/plugin-webpack-validate/-/plugin-webpack-validate-4.1.5.tgz", + "integrity": "sha512-JwNrx+gczi3vBIKAjsndvX2hRAbXUeOOix9yPmD+X6fePQ5KtlGqNHTbx3qezJm7372zPUyJpil+JMPg58FMlg==", "requires": { "lodash": "4.17.21", - "superstruct": "0.16.5" + "superstruct": "1.0.3" } }, "@discoveryjs/json-ext": { @@ -7388,9 +7312,9 @@ "dev": true }, "@eslint/eslintrc": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.2.tgz", - "integrity": "sha512-AXYd23w1S/bv3fTs3Lz0vjiYemS08jWkI3hYyS9I1ry+0f+Yjs1wm+sU0BS8qDOPrBIkp4qHYC16I8uVtpLajQ==", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.3.3.tgz", + "integrity": "sha512-uj3pT6Mg+3t39fvLrj8iuCIJ38zKO9FpGtJ4BBJebJhEwjoT+KLVNCcHT5QC9NGRIEi7fZ0ZR8YRb884auB4Lg==", "dev": true, "requires": { "ajv": "^6.12.4", @@ -7416,9 +7340,9 @@ } }, "@humanwhocodes/config-array": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.10.5.tgz", - "integrity": "sha512-XVVDtp+dVvRxMoxSiSfasYaG02VEe1qH5cKgMQJWhol6HwzbcqoCMJi8dAGoYAO57jhUyhI6cWuRiTcRaDaYug==", + "version": "0.11.6", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.6.tgz", + "integrity": "sha512-jJr+hPTJYKyDILJfhNSHsjiwXYf26Flsz8DvNndOsHs5pwSnpGUEy8yzF0JYhCEvTDdV2vuOK5tt8BVhwO5/hg==", "dev": true, "requires": { "@humanwhocodes/object-schema": "^1.2.1", @@ -7426,12 +7350,6 @@ "minimatch": "^3.0.4" } }, - "@humanwhocodes/gitignore-to-minimatch": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@humanwhocodes/gitignore-to-minimatch/-/gitignore-to-minimatch-1.0.2.tgz", - "integrity": "sha512-rSqmMJDdLFUsyxR6FMtD00nfQKKLFb1kv+qBbOVKqErvloEIJLo5bDTJTQNTYgeyp78JsA7u/NPi5jT1GR/MuA==", - "dev": true - }, "@humanwhocodes/module-importer": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", @@ -7644,21 +7562,21 @@ "integrity": "sha512-do4Z1r2OVhuI0ihJhQ8Hg+yPWnBYEBNuFNCrvtPKoYT1w81jD7pBXgGe86lYuuNirkDHb0Nxt+zt4O5GiFJfgA==" }, "@relative-ci/agent": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/@relative-ci/agent/-/agent-4.1.1.tgz", - "integrity": "sha512-J+ec6c5xQQW3S/ZF9EaN1Eit48s3xJbr9WjcHLO9lXpt3XAY7Wunptv0j2he9rRrO+hhSsGNQyjh9dlSrIYSQg==", - "requires": { - "@bundle-stats/plugin-webpack-filter": "4.1.0", - "@bundle-stats/plugin-webpack-validate": "4.1.0", - "core-js": "3.25.5", - "cosmiconfig": "7.0.1", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/@relative-ci/agent/-/agent-4.1.2.tgz", + "integrity": "sha512-kJ5PiZDW9tpJGXjBbPvtTxeXfeDWh5PJv/c5fI5fSvLVLtr/sq6smanY0DcyWYv1Ha+3e0IqkOKcLnZFEHn9Ow==", + "requires": { + "@bundle-stats/plugin-webpack-filter": "4.1.5", + "@bundle-stats/plugin-webpack-validate": "4.1.5", + "core-js": "3.26.1", + "cosmiconfig": "8.0.0", "debug": "4.3.4", "dotenv": "16.0.3", "env-ci": "7.3.0", - "fs-extra": "10.1.0", + "fs-extra": "11.1.0", "isomorphic-fetch": "3.0.0", "lodash": "4.17.21", - "yargs": "17.6.0" + "yargs": "17.6.2" } }, "@types/adm-zip": { @@ -7710,11 +7628,6 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.14.tgz", "integrity": "sha512-SbjLmERksKOGzWzPNuW7fJM7fk3YXVTFiZWB/Hs99gwhk+/dnrQRPBQjPW9aO+fi1tAffi9PrwFvsmOKmDTyng==" }, - "@types/parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==" - }, "@webassemblyjs/helper-numbers": { "version": "1.11.1", "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-numbers/-/helper-numbers-1.11.1.tgz", @@ -7738,25 +7651,23 @@ } }, "@webpack-cli/configtest": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-1.2.0.tgz", - "integrity": "sha512-4FB8Tj6xyVkyqjj1OaTqCjXYULB9FMkqQ8yGrZjRDrYh0nOE+7Lhs45WioWQQMV+ceFlE368Ukhe6xdvJM9Egg==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/configtest/-/configtest-2.0.0.tgz", + "integrity": "sha512-war4OU8NGjBqU3DP3bx6ciODXIh7dSXcpQq+P4K2Tqyd8L5OjZ7COx9QXx/QdCIwL2qoX09Wr4Cwf7uS4qdEng==", "dev": true, "requires": {} }, "@webpack-cli/info": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-1.5.0.tgz", - "integrity": "sha512-e8tSXZpw2hPl2uMJY6fsMswaok5FdlGNRTktvFk2sD8RjH0hE2+XistawJx1vmKteh4NmGmNUrp+Tb2w+udPcQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/info/-/info-2.0.0.tgz", + "integrity": "sha512-NNxDgbo4VOkNhOlTgY0Elhz3vKpOJq4/PKeKg7r8cmYM+GQA9vDofLYyup8jS6EpUvhNmR30cHTCEIyvXpskwA==", "dev": true, - "requires": { - "envinfo": "^7.7.3" - } + "requires": {} }, "@webpack-cli/serve": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-1.7.0.tgz", - "integrity": "sha512-oxnCNGj88fL+xzV+dacXs44HcDwf1ovs3AuEzvP7mqXw7fQntqIhQ1BRmynh4qEKQSSSRSWVyXRjmTbZIX9V2Q==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@webpack-cli/serve/-/serve-2.0.0.tgz", + "integrity": "sha512-Rumq5mHvGXamnOh3O8yLk1sjx8dB30qF1OeR6VC00DIR6SLJ4bwwUGKC4pE7qBFoQyyh0H9sAg3fikYgAqVR0w==", "dev": true, "requires": {} }, @@ -7798,6 +7709,35 @@ "uri-js": "^4.2.2" } }, + "ajv-formats": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-2.1.1.tgz", + "integrity": "sha512-Wx0Kx52hxE7C18hkMEggYlEifqWZtYaRgouJor+WMdPnQyEK13vgEWyVNup7SoeeoLMsr4kf5h6dOW11I15MUA==", + "dev": true, + "requires": { + "ajv": "^8.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + } + } + }, "ajv-keywords": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.5.2.tgz", @@ -7820,8 +7760,7 @@ "argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, "array-includes": { "version": "3.1.4", @@ -7837,12 +7776,6 @@ "is-string": "^1.0.7" } }, - "array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true - }, "array.prototype.flat": { "version": "1.2.5", "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz", @@ -7856,15 +7789,13 @@ } }, "babel-loader": { - "version": "8.2.5", - "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.2.5.tgz", - "integrity": "sha512-OSiFfH89LrEMiWd4pLNqGz4CwJDtbs2ZVc+iGu2HrkRfPxId9F2anQj38IxWpmRfsUY0aBZYi1EFcd3mhtRMLQ==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-9.1.0.tgz", + "integrity": "sha512-Antt61KJPinUMwHwIIz9T5zfMgevnfZkEVWYDWlG888fgdvRRGD0JTuf/fFozQnfT+uq64sk1bmdHDy/mOEWnA==", "dev": true, "requires": { - "find-cache-dir": "^3.3.1", - "loader-utils": "^2.0.0", - "make-dir": "^3.1.0", - "schema-utils": "^2.6.5" + "find-cache-dir": "^3.3.2", + "schema-utils": "^4.0.0" }, "dependencies": { "find-cache-dir": { @@ -7887,17 +7818,6 @@ "semver": "^6.0.0" } }, - "schema-utils": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.7.1.tgz", - "integrity": "sha512-SHiNtMOUGWBQJwzISiVYKu82GiV4QYGePp3odlY1tuKO7gPtphAT5R/py0fA6xtbgLL/RvtJZnU9b8s0F1q0Xg==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.5", - "ajv": "^6.12.4", - "ajv-keywords": "^3.5.2" - } - }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", @@ -7906,15 +7826,6 @@ } } }, - "babel-plugin-dynamic-import-node": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", - "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", - "dev": true, - "requires": { - "object.assign": "^4.1.0" - } - }, "babel-plugin-polyfill-corejs2": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.3.tgz", @@ -7964,12 +7875,6 @@ "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.2.tgz", "integrity": "sha512-3pZEU3NT5BFUo/AD5ERPWOgQOCZITni6iavr5AUw5AUwQjMlI0kzu5btnyD39AF0gUEsDPwJT+oY1ORBJijPjQ==" }, - "big.js": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", - "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==", - "dev": true - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -8081,9 +7986,9 @@ "dev": true }, "commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.4.1.tgz", + "integrity": "sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==", "dev": true }, "commondir": { @@ -8122,9 +8027,9 @@ } }, "core-js": { - "version": "3.25.5", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.25.5.tgz", - "integrity": "sha512-nbm6eZSjm+ZuBQxCUPQKQCoUEfFOXjUZ8dTTyikyKaWrTYmAVbykQfwsKE5dBK88u3QCkCrzsx/PPlKfhsvgpw==" + "version": "3.26.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.26.1.tgz", + "integrity": "sha512-21491RRQVzUn0GGM9Z1Jrpr6PNPxPi+Za8OM9q4tksTSnlbXXGKK1nXNg/QvwFYettXvSX6zWKCtHHfjN4puyA==" }, "core-js-compat": { "version": "3.25.3", @@ -8136,15 +8041,14 @@ } }, "cosmiconfig": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", - "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-8.0.0.tgz", + "integrity": "sha512-da1EafcpH6b/TD8vDRaWV7xFINlHlF6zKsGwS1TsuVJTZRkquaS5HTMq7uq6h31619QjbsYl21gVDOm32KM1vQ==", "requires": { - "@types/parse-json": "^4.0.0", "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.10.0" + "path-type": "^4.0.0" } }, "cross-spawn": { @@ -8185,15 +8089,6 @@ "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" }, - "dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "requires": { - "path-type": "^4.0.0" - } - }, "doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -8218,12 +8113,6 @@ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, - "emojis-list": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-3.0.0.tgz", - "integrity": "sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q==", - "dev": true - }, "encoding": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", @@ -8321,15 +8210,15 @@ "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" }, "eslint": { - "version": "8.24.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.24.0.tgz", - "integrity": "sha512-dWFaPhGhTAiPcCgm3f6LI2MBWbogMnTJzFBbhXVRQDJPkr9pGZvVjlVfXd+vyDcWPA2Ic9L2AXPIQM0+vk/cSQ==", + "version": "8.29.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.29.0.tgz", + "integrity": "sha512-isQ4EEiyUjZFbEKvEGJKKGBwXtvXX+zJbkVKCgTuB9t/+jUBcy8avhkEwWJecI15BkRkOYmvIM5ynbhRjEkoeg==", "dev": true, "requires": { - "@eslint/eslintrc": "^1.3.2", - "@humanwhocodes/config-array": "^0.10.5", - "@humanwhocodes/gitignore-to-minimatch": "^1.0.2", + "@eslint/eslintrc": "^1.3.3", + "@humanwhocodes/config-array": "^0.11.6", "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", "ajv": "^6.10.0", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -8345,14 +8234,14 @@ "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", "find-up": "^5.0.0", - "glob-parent": "^6.0.1", + "glob-parent": "^6.0.2", "globals": "^13.15.0", - "globby": "^11.1.0", "grapheme-splitter": "^1.0.4", "ignore": "^5.2.0", "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", "js-sdsl": "^4.1.4", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", @@ -8772,19 +8661,6 @@ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, - "fast-glob": { - "version": "3.2.11", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz", - "integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==", - "dev": true, - "requires": { - "@nodelib/fs.stat": "^2.0.2", - "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.2", - "merge2": "^1.3.0", - "micromatch": "^4.0.4" - } - }, "fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -8872,9 +8748,9 @@ "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==" }, "fs-extra": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.0.tgz", + "integrity": "sha512-0rcTq621PD5jM/e0a3EJoGC/1TC5ZBCERW82LQuwfGnCa1V8w7dpYH1yNu+SLb6E5dkeCBzKEyLGlFrnr+dUyw==", "requires": { "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", @@ -8944,15 +8820,6 @@ "path-is-absolute": "^1.0.0" } }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, "glob-to-regexp": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz", @@ -8964,20 +8831,6 @@ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true }, - "globby": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", - "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", - "dev": true, - "requires": { - "array-union": "^2.1.0", - "dir-glob": "^3.0.1", - "fast-glob": "^3.2.9", - "ignore": "^5.2.0", - "merge2": "^1.4.1", - "slash": "^3.0.0" - } - }, "graceful-fs": { "version": "4.2.9", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", @@ -9097,15 +8950,15 @@ } }, "interpret": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-2.2.0.tgz", - "integrity": "sha512-Ju0Bz/cEia55xDwUWEa8+olFpCiQoypjnQySseKtmjNrnps3P+xfpUmGr90T7yjlVJmOtybRvPXhKMbHr+fWnw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-3.1.1.tgz", + "integrity": "sha512-6xwYfHbajpoF0xLW+iwLkhwgvLoZDfjYfoFNu8ftMoXINzwuymNLd9u/KmwtdT2GbR+/Cz66otEGEVVUHX9QLQ==", "dev": true }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=" + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" }, "is-bigint": { "version": "1.0.4", @@ -9191,6 +9044,12 @@ "has-tostringtag": "^1.0.0" } }, + "is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true + }, "is-plain-object": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", @@ -9313,7 +9172,6 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, "requires": { "argparse": "^2.0.1" } @@ -9380,25 +9238,6 @@ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==" }, - "loader-utils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.2.tgz", - "integrity": "sha512-TM57VeHptv569d/GKh6TAYdzKblwDNiumOdkFnejjD0XwTH87K90w3O7AiJRqdQoXygvi1VQTJTLGhJl7WqA7A==", - "dev": true, - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - }, - "dependencies": { - "json5": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", - "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", - "dev": true - } - } - }, "locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", @@ -9439,12 +9278,6 @@ "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==" }, - "merge2": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "dev": true - }, "micromatch": { "version": "4.0.4", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", @@ -9720,12 +9553,12 @@ } }, "rechoir": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.7.1.tgz", - "integrity": "sha512-/njmZ8s1wVeR6pjTZ+0nCnv8SpZNRMT2D1RLOJQESlYFDBvwpTA4KWJpZ+sBJ4+vhjILRcK7JIFdGCdxEAAitg==", + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.8.0.tgz", + "integrity": "sha512-/vxpCXddiX8NGfGO/mTafwjq4aFa/71pvamip0++IQk3zG8cbCj0fifNPrjjF1XMXUne91jL9OoxmdykoEtifQ==", "dev": true, "requires": { - "resolve": "^1.9.0" + "resolve": "^1.20.0" } }, "regenerate": { @@ -9806,6 +9639,12 @@ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==" }, + "require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "dev": true + }, "resolve": { "version": "1.22.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", @@ -9865,6 +9704,47 @@ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "devOptional": true }, + "schema-utils": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.0.0.tgz", + "integrity": "sha512-1edyXKgh6XnJsJSQ8mKWXnN/BVaIbFMLpouRUrXgVq7WYne5kw3MW7UPhO44uRXQSIpTSXoJbmrR2X0w9kUTyg==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "ajv": "^8.8.0", + "ajv-formats": "^2.1.1", + "ajv-keywords": "^5.0.0" + }, + "dependencies": { + "ajv": { + "version": "8.11.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.11.0.tgz", + "integrity": "sha512-wGgprdCvMalC0BztXvitD2hC04YffAvtsUn93JbGXYLAtCUO4xd17mCCZQxUOItiBwZvJScWo8NIvQMQ71rdpg==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-5.1.0.tgz", + "integrity": "sha512-YCS/JNFAUyr5vAuhk1DWm1CBxRHW9LbJ2ozWeemrIqpbsqKjHVxYPyi5GC0rjZIT5JxJ3virVTS8wk4i/Z+krw==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.3" + } + }, + "json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "dev": true + } + } + }, "semver": { "version": "7.3.5", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", @@ -9920,12 +9800,6 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==" }, - "slash": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", - "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", - "dev": true - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -9997,9 +9871,9 @@ "dev": true }, "superstruct": { - "version": "0.16.5", - "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-0.16.5.tgz", - "integrity": "sha512-GBa1VPdCUDAIrsoMVy2lzE/hKQnieUlc1JVoVzJ2YLx47SoPY4AqF85Ht1bPg5r+8I0v54GbaRdNTnYQ0p+T+Q==" + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/superstruct/-/superstruct-1.0.3.tgz", + "integrity": "sha512-8iTn3oSS8nRGn+C2pgXSKPI3jmpm6FExNazNpjvqS6ZUJQCej3PUXEKM8NjHBOs54ExM+LPW/FBRhymrdcCiSg==" }, "supports-color": { "version": "5.5.0", @@ -10093,9 +9967,9 @@ "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" }, "ts-loader": { - "version": "9.4.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.1.tgz", - "integrity": "sha512-384TYAqGs70rn9F0VBnh6BPTfhga7yFNdC5gXbQpDrBj9/KsT4iRkGqKXhziofHOlE2j6YEaiTYVGKKvPhGWvw==", + "version": "9.4.2", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-9.4.2.tgz", + "integrity": "sha512-OmlC4WVmFv5I0PpaxYb+qGeGOdm5giHU7HwDDUjw59emP2UYMHy9fFSDcYgSNoH8sXcj4hGCSEhlDZ9ULeDraA==", "dev": true, "requires": { "chalk": "^4.1.0", @@ -10189,9 +10063,9 @@ "dev": true }, "typescript": { - "version": "4.8.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz", - "integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==", + "version": "4.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.3.tgz", + "integrity": "sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==", "dev": true }, "unbox-primitive": { @@ -10281,9 +10155,9 @@ "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" }, "webpack": { - "version": "5.74.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.74.0.tgz", - "integrity": "sha512-A2InDwnhhGN4LYctJj6M1JEaGL7Luj6LOmyBHjcI8529cm5p6VXiTIW2sn6ffvEAKmveLzvu4jrihwXtPojlAA==", + "version": "5.75.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.75.0.tgz", + "integrity": "sha512-piaIaoVJlqMsPtX/+3KTTO6jfvrSYgauFVdt8cr9LTHKmcq/AMd4mhzsiP7ZF/PGRNPGA8336jldh9l2Kt2ogQ==", "requires": { "@types/eslint-scope": "^3.7.3", "@types/estree": "^0.0.51", @@ -10465,22 +10339,23 @@ } }, "webpack-cli": { - "version": "4.10.0", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-4.10.0.tgz", - "integrity": "sha512-NLhDfH/h4O6UOy+0LSso42xvYypClINuMNBVVzX4vX98TmTaTUxwRbXdhucbFMd2qLaCTcLq/PdYrvi8onw90w==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-5.0.0.tgz", + "integrity": "sha512-AACDTo20yG+xn6HPW5xjbn2Be4KUzQPebWXsDMHwPPyKh9OnTOJgZN2Nc+g/FZKV3ObRTYsGvibAvc+5jAUrVA==", "dev": true, "requires": { "@discoveryjs/json-ext": "^0.5.0", - "@webpack-cli/configtest": "^1.2.0", - "@webpack-cli/info": "^1.5.0", - "@webpack-cli/serve": "^1.7.0", + "@webpack-cli/configtest": "^2.0.0", + "@webpack-cli/info": "^2.0.0", + "@webpack-cli/serve": "^2.0.0", "colorette": "^2.0.14", - "commander": "^7.0.0", + "commander": "^9.4.1", "cross-spawn": "^7.0.3", + "envinfo": "^7.7.3", "fastest-levenshtein": "^1.0.12", "import-local": "^3.0.2", - "interpret": "^2.2.0", - "rechoir": "^0.7.0", + "interpret": "^3.1.1", + "rechoir": "^0.8.0", "webpack-merge": "^5.7.3" } }, @@ -10590,15 +10465,10 @@ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "dev": true }, - "yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==" - }, "yargs": { - "version": "17.6.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.0.tgz", - "integrity": "sha512-8H/wTDqlSwoSnScvV2N/JHfLWOKuh5MVla9hqLjK3nsfyy6Y4kDSYSvkU5YCUEPOSnRXfIyx3Sq+B/IWudTo4g==", + "version": "17.6.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.6.2.tgz", + "integrity": "sha512-1/9UrdHjDZc0eOU0HxOHoS78C69UD3JRMvzlJ7S79S2nTaWRA/whGCTV8o9e/N/1Va9YIV7Q4sOxD8VV4pCWOw==", "requires": { "cliui": "^8.0.1", "escalade": "^3.1.1", @@ -10606,7 +10476,7 @@ "require-directory": "^2.1.1", "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^21.0.0" + "yargs-parser": "^21.1.1" } }, "yargs-parser": { diff --git a/package.json b/package.json index b87899717..c9f4026fa 100644 --- a/package.json +++ b/package.json @@ -35,23 +35,23 @@ "@actions/core": "1.10.0", "@actions/github": "5.1.1", "@octokit/webhooks-definitions": "^3.67.3", - "@relative-ci/agent": "^4.1.1", + "@relative-ci/agent": "^4.1.2", "adm-zip": "^0.5.9", "lodash": "^4.17.21" }, "devDependencies": { - "@babel/core": "7.19.3", + "@babel/core": "7.20.5", "@babel/eslint-parser": "^7.19.1", - "@babel/preset-env": "7.19.3", + "@babel/preset-env": "7.20.2", "@types/adm-zip": "^0.5.0", - "babel-loader": "8.2.5", - "core-js": "3.25.5", + "babel-loader": "9.1.0", + "core-js": "3.26.1", "encoding": "^0.1.13", - "eslint": "^8.24.0", + "eslint": "^8.29.0", "eslint-config-airbnb-base": "^15.0.0", - "ts-loader": "^9.4.1", - "typescript": "^4.8.4", - "webpack": "5.74.0", - "webpack-cli": "4.10.0" + "ts-loader": "^9.4.2", + "typescript": "^4.9.3", + "webpack": "5.75.0", + "webpack-cli": "5.0.0" } }